aboutsummaryrefslogtreecommitdiffstats
path: root/roms/edk2/BaseTools
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/edk2/BaseTools
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/edk2/BaseTools')
-rw-r--r--roms/edk2/BaseTools/.gitignore20
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/BootSectImage29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/BuildEnv5
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Ecc14
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiLdrImage29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiRom29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenCrc3229
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenDepex14
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFds14
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFfs29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFv29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFw29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenPage29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenSec29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenVtf29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GnuGenBootSector29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/LzmaCompress29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/LzmaF86Compress17
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/RunBinToolFromBuildDir29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/RunToolFromSource5
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Split29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/TargetTool14
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/TianoCompress29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Trim14
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VfrCompile29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VolInfo29
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py87
-rwxr-xr-xroms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/build14
-rw-r--r--roms/edk2/BaseTools/Bin/Darwin-i386/Arm/DEBUG_XCODE31/CompilerIntrinsicsLib.libbin0 -> 36072 bytes
-rw-r--r--roms/edk2/BaseTools/Bin/Darwin-i386/Arm/DEBUG_XCODE32/CompilerIntrinsicsLib.libbin0 -> 36072 bytes
-rw-r--r--roms/edk2/BaseTools/Bin/Darwin-i386/Arm/RELEASE_XCODE31/CompilerIntrinsicsLib.libbin0 -> 11504 bytes
-rw-r--r--roms/edk2/BaseTools/Bin/Darwin-i386/Arm/RELEASE_XCODE32/CompilerIntrinsicsLib.libbin0 -> 11504 bytes
-rw-r--r--roms/edk2/BaseTools/Bin/gcc_aarch64_linux_ext_dep.yaml21
-rw-r--r--roms/edk2/BaseTools/Bin/gcc_arm_linux_ext_dep.yaml21
-rw-r--r--roms/edk2/BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml22
-rw-r--r--roms/edk2/BaseTools/Bin/iasl_ext_dep.yaml21
-rw-r--r--roms/edk2/BaseTools/Bin/nasm_ext_dep.yaml18
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/AmlToC14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/BPDG14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/Brotli29
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/BrotliCompress34
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/DevicePath29
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/Ecc14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/EfiRom29
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/GenCrc3229
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/GenDepex14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/GenFds14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/GenFfs29
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/GenFv29
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/GenFw29
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/GenSec29
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/GenerateCapsule14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/LzmaCompress29
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/LzmaF86Compress19
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/PatchPcdValue14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/Pkcs7Sign14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/Split29
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/TargetTool14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/TianoCompress29
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/Trim14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/UPT14
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/VfrCompile29
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/VolInfo29
-rwxr-xr-xroms/edk2/BaseTools/BinWrappers/PosixLike/build14
-rw-r--r--roms/edk2/BaseTools/BinWrappers/PosixLike/posix_path_env.yaml10
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/AmlToC.bat3
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/BPDG.bat4
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/BrotliCompress.bat55
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/Ecc.bat4
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/GenDepex.bat3
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/GenFds.bat4
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat3
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat1
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat3
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat3
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat1
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256Sign.bat3
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/TargetTool.bat3
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/Trim.bat3
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/UPT.bat3
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/build.bat3
-rw-r--r--roms/edk2/BaseTools/BinWrappers/WindowsLike/win_build_tools_path_env.yaml10
-rwxr-xr-xroms/edk2/BaseTools/BuildEnv269
-rw-r--r--roms/edk2/BaseTools/Conf/Empty_Package_Information_Data_File.ini15
-rw-r--r--roms/edk2/BaseTools/Conf/ReadMe.txt9
-rw-r--r--roms/edk2/BaseTools/Conf/XMLSchema/DistributionPackage.xsd3187
-rwxr-xr-xroms/edk2/BaseTools/Conf/build_rule.template674
-rw-r--r--roms/edk2/BaseTools/Conf/diff.order13
-rw-r--r--roms/edk2/BaseTools/Conf/gitattributes30
-rw-r--r--roms/edk2/BaseTools/Conf/target.template70
-rwxr-xr-xroms/edk2/BaseTools/Conf/tools_def.template3214
-rw-r--r--roms/edk2/BaseTools/Edk2ToolsBuild.py177
-rw-r--r--roms/edk2/BaseTools/GNUmakefile27
-rw-r--r--roms/edk2/BaseTools/Makefile34
-rw-r--r--roms/edk2/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator.py69
-rw-r--r--roms/edk2/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator_plug_in.yaml12
-rw-r--r--roms/edk2/BaseTools/Plugin/BuildToolsReport/BuildToolsReport_Template.html126
-rw-r--r--roms/edk2/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py115
-rw-r--r--roms/edk2/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner_plug_in.yaml12
-rw-r--r--roms/edk2/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py123
-rw-r--r--roms/edk2/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain_plug_in.yaml12
-rw-r--r--roms/edk2/BaseTools/Plugin/WindowsResourceCompiler/WinRcPath.py29
-rw-r--r--roms/edk2/BaseTools/Plugin/WindowsResourceCompiler/WinRcPath_plug_in.yaml13
-rw-r--r--roms/edk2/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py207
-rw-r--r--roms/edk2/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain_plug_in.yaml11
-rw-r--r--roms/edk2/BaseTools/ReadMe.rst41
-rw-r--r--roms/edk2/BaseTools/Scripts/BinToPcd.py220
-rw-r--r--roms/edk2/BaseTools/Scripts/ConvertFceToStructurePcd.py687
-rwxr-xr-xroms/edk2/BaseTools/Scripts/ConvertMasmToNasm.py1005
-rwxr-xr-xroms/edk2/BaseTools/Scripts/ConvertUni.py125
-rw-r--r--roms/edk2/BaseTools/Scripts/DetectNotUsedItem.py198
-rw-r--r--roms/edk2/BaseTools/Scripts/FormatDosFiles.py107
-rw-r--r--roms/edk2/BaseTools/Scripts/GccBase.lds79
-rw-r--r--roms/edk2/BaseTools/Scripts/GetMaintainer.py194
-rw-r--r--roms/edk2/BaseTools/Scripts/GetUtcDateTime.py44
-rw-r--r--roms/edk2/BaseTools/Scripts/MemoryProfileSymbolGen.py276
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/Readme.md19
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/__init__.py6
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py424
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw1060
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/__init__.py6
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/__init__.py6
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py445
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/efibinary.py606
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py475
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/inidocview.py17
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/message.py46
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/__init__.py6
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/__init__.py6
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py928
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py313
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py1084
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py1086
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dsc.py195
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py335
-rw-r--r--roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/__init__.py6
-rwxr-xr-xroms/edk2/BaseTools/Scripts/PatchCheck.py769
-rw-r--r--roms/edk2/BaseTools/Scripts/RunMakefile.py172
-rw-r--r--roms/edk2/BaseTools/Scripts/RunMakefileSample.mak37
-rw-r--r--roms/edk2/BaseTools/Scripts/Rvct-Align32.sct19
-rw-r--r--roms/edk2/BaseTools/Scripts/Rvct-Align4K.sct19
-rwxr-xr-xroms/edk2/BaseTools/Scripts/SetVisualStudio.bat102
-rw-r--r--roms/edk2/BaseTools/Scripts/SetupGit.py213
-rwxr-xr-xroms/edk2/BaseTools/Scripts/ShowEnvironment.bat213
-rw-r--r--roms/edk2/BaseTools/Scripts/SmiHandlerProfileSymbolGen.py307
-rwxr-xr-xroms/edk2/BaseTools/Scripts/UpdateBuildVersions.py398
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/GNUmakefile41
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/Makefile48
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.editorconfig40
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.gitattributes1
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.gitignore18
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.gitmodules6
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.travis.yml229
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/BUILD144
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/CMakeLists.txt407
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/CONTRIBUTING.md27
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/LICENSE19
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/MANIFEST.in17
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/Makefile55
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/Makefile.am38
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/README15
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/README.md98
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/WORKSPACE21
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/bootstrap31
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/constants.h184
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/context.h261
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/dictionary.bin432
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/dictionary.c5914
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/dictionary.h64
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/platform.h567
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/transform.c291
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/transform.h85
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/version.h26
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/bit_reader.c65
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/bit_reader.h356
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c2605
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/huffman.c339
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/huffman.h128
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/prefix.h750
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/state.c157
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/state.h365
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references.c145
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references.h39
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references_hq.c843
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references_hq.h95
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references_inc.h163
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/bit_cost.c35
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/bit_cost.h63
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/bit_cost_inc.h127
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_encoder_inc.h34
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_splitter.c194
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_splitter.h51
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_splitter_inc.h440
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/brotli_bit_stream.c1329
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/brotli_bit_stream.h84
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/cluster.c56
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/cluster.h48
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/cluster_inc.h320
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/command.h190
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment.c790
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment.h61
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment_two_pass.c645
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment_two_pass.h54
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/dictionary_hash.c1846
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/dictionary_hash.h25
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c1925
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encoder_dict.c33
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encoder_dict.h43
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/entropy_encode.c501
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/entropy_encode.h122
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/entropy_encode_static.h539
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/fast_log.h147
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/find_match_length.h80
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash.h488
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_composite_inc.h125
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_forgetful_chain_inc.h293
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_longest_match64_inc.h267
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_longest_match_inc.h262
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_longest_match_quickly_inc.h266
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_rolling_inc.h212
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_to_binary_tree_inc.h329
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/histogram.c100
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/histogram.h63
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/histogram_inc.h51
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/literal_cost.c175
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/literal_cost.h30
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/memory.c170
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/memory.h114
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/metablock.c663
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/metablock.h105
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/metablock_inc.h183
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/params.h46
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/prefix.h53
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/quality.h165
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/ringbuffer.h167
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/static_dict.c486
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/static_dict.h40
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/static_dict_lut.h5864
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/utf8_util.c85
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/utf8_util.h32
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/write_bits.h87
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/fuzz/decode_fuzzer.c58
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/fuzz/run_decode_fuzzer.c44
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/fuzz/test_fuzzer.sh33
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/decode.h344
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/encode.h448
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/port.h288
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/types.h83
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/tools/brotli.c1107
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/tools/brotli.md107
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/compiler_config_setting.bzl28
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/configure8
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/configure-cmake318
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/configure.ac14
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/injected_code.txt32
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BitReader.cs271
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BitReaderTest.cs33
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BrotliInputStream.cs223
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BrotliRuntimeException.cs22
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Context.cs57
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Decode.cs992
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/DecodeTest.cs171
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Dictionary.cs97
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/DictionaryTest.cs36
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Huffman.cs149
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/HuffmanTreeGroup.cs50
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/IntReader.cs36
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Prefix.cs33
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/RunningState.cs37
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/State.cs171
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/SynthTest.cs2174
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Transform.cs154
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/TransformTest.cs74
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Utils.cs59
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/WordTransformType.cs68
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/sharpen.cfg18
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/transpile.sh94
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/brotli-comparison-study-2015-09-22.pdfbin0 -> 215208 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/brotli.1132
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/decode.h.3415
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/encode.h.3586
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/types.h.3117
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/fetch-spec/shared-brotli-fetch-spec.txt116
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/BUILD2
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/WORKSPACE21
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/BUILD26
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/cbrotli_test.go367
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/cgo.go13
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/reader.go161
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/writer.go159
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/BUILD98
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/WORKSPACE41
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BUILD59
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BitReader.java289
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BitReaderTest.java54
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BrotliInputStream.java160
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BrotliRuntimeException.java21
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Context.java58
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Decode.java1251
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/DecodeTest.java160
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Dictionary.java54
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/DictionaryData.java51
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/DictionaryTest.java38
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/EagerStreamTest.java386
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Huffman.java137
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/SetDictionaryTest.java76
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/State.java89
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/SynthTest.java2940
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Transform.java236
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/TransformTest.java71
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Utils.java102
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/build_defs.bzl34
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/pom.xml172
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/proguard.pgcfg6
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BUILD73
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BrotliJniTestBase.java13
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BundleChecker.java112
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BundleHelper.java113
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/fuzz_data.zipbin0 -> 23854 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/pom.xml65
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/test_corpus.zipbin0 -> 3587214 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/test_data.zipbin0 -> 2859607 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/pom.xml101
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/BUILD61
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/BrotliCommon.java130
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/CommonJNI.java16
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/SetRfcDictionaryTest.java74
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/SetZeroDictionaryTest.java48
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/common_jni.cc47
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BUILD84
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliDecoderChannel.java69
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliDecoderChannelTest.java84
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliInputStream.java115
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliInputStreamTest.java82
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/Decoder.java177
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/DecoderJNI.java121
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/DecoderTest.java77
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/EagerStreamTest.java75
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/decoder_jni.cc202
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BUILD88
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliEncoderChannel.java77
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliEncoderChannelTest.java118
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliOutputStream.java87
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliOutputStreamTest.java118
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/EmptyInputTest.java29
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/Encoder.java205
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/EncoderJNI.java118
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/EncoderTest.java80
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/encoder_jni.cc195
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/BUILD43
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/WORKSPACE12
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/decode.js2029
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/decode.min.js2
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/decode_test.js79
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/polyfill.js65
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/premake5.lua78
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/Makefile57
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/README.md54
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/_brotli.cc753
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/bro.py160
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/brotli.py56
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/__init__.py0
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/_test_utils.py112
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/bro_test.py102
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/compress_test.py41
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/compressor_test.py94
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/decompress_test.py42
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/decompressor_test.py59
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/BUILD44
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/BUILD.libdivsufsort55
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/Makefile17
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/README.md67
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/WORKSPACE12
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/brotli_decoder.c93
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/brotlidump.py2362
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/deorummolae.cc302
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/deorummolae.h26
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/dictionary_generator.cc326
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/draw_diff.cc117
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/draw_histogram.cc197
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/durchschlag.cc726
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/durchschlag.h99
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/COPYING24
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/README34
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/cmdline.h704
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/enumSubstring.cpp140
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/esa.hxx125
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/sais.hxx364
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/wafbin0 -> 88387 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/wscript23
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/find_opt_references.cc267
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/img/enwik9_brotli.pngbin0 -> 1981984 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/img/enwik9_diff.pngbin0 -> 5096698 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/img/enwik9_opt.pngbin0 -> 2025431 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/.gitignore32
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CHANGELOG.md21
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeLists.txt99
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/AppendCompilerFlags.cmake38
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/CheckFunctionKeywords.cmake15
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/CheckLFS.cmake109
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/ProjectCPack.cmake38
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/cmake_uninstall.cmake.in36
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/LICENSE21
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/README.md140
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/VERSION.cmake23
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/CMakeLists.txt11
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/bwt.c220
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/mksary.c193
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/sasearch.c165
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/suftest.c164
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/unbwt.c207
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/CMakeLists.txt162
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/config.h.cmake81
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/divsufsort.h.cmake180
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/divsufsort_private.h207
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/lfs.h.cmake56
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/CMakeLists.txt31
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/divsufsort.c398
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/sssort.c815
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/trsort.c586
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/utils.c381
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/pkgconfig/CMakeLists.txt9
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/pkgconfig/libdivsufsort.pc.cmake11
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/read_dist.h50
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/sieve.cc259
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/sieve.h21
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/.bintray.json19
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/.configure-custom.sh1
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/.travis.sh81
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/appveyor.yml111
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/README.md3
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-01-download-rfc.py16
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-02-rfc-to-bin.py34
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-03-validate-bin.py38
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-04-generate-java-literals.py79
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/fix-win-bazel-build.py36
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/libbrotlicommon.pc.in11
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/libbrotlidec.pc.in12
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/libbrotlienc.pc.in12
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/sources.lst99
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/setup.cfg5
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/setup.py288
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/Makefile17
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/compatibility_test.sh25
-rwxr-xr-xroms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/roundtrip_test.sh34
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/run-compatibility-test.cmake31
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/run-roundtrip-test.cmake36
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/10x10y1
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/10x10y.compressedbin0 -> 12 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/64x1
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/64x.compressedbin0 -> 10 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/alice29.txt3609
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/alice29.txt.compressedbin0 -> 50096 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/asyoulik.txt4122
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/asyoulik.txt.compressedbin0 -> 45687 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/backward65536bin0 -> 65792 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/backward65536.compressedbin0 -> 19 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/bb.binastbin0 -> 12356697 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_filebin0 -> 50096 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_file.compressedbin0 -> 50100 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_repeatedbin0 -> 144224 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_repeated.compressedbin0 -> 50299 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty0
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed1
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.001
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.011
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.021
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.031
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.041
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.051
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.061
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.071
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.081
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.091
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.101
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.111
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.121
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.131
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.141
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.151
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.16bin0 -> 4 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.171
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.18bin0 -> 196610 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/lcet10.txt7519
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/lcet10.txt.compressedbin0 -> 124719 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/mapsdatazrhbin0 -> 285886 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/mapsdatazrh.compressedbin0 -> 161743 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/monkey1
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/monkey.compressedbin0 -> 425 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/plrabn12.txt10699
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/plrabn12.txt.compressedbin0 -> 174771 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox1
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox.compressed1
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox_repeated1
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox_repeated.compressed2
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/random_chunksbin0 -> 2704 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/random_org_10k.binbin0 -> 10000 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/random_org_10k.bin.compressedbin0 -> 10004 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/ukkonooa1
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/ukkonooa.compressedbin0 -> 69 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x1
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressedbin0 -> 5 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.00bin0 -> 5 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.01bin0 -> 8 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.02bin0 -> 5 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.03bin0 -> 10 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/xyzzy1
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/xyzzy.compressed1
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/zerosbin0 -> 262144 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/zeros.compressedbin0 -> 13 bytes
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/BasePeCoff.c1469
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/BinderFuncs.c74
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/BinderFuncs.h61
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/CommonLib.c2191
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/CommonLib.h461
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/Compress.h82
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/Crc32.c313
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/Crc32.h41
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/Decompress.c1014
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/Decompress.h159
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/EfiCompress.c1591
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/EfiUtilityMsgs.c902
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/EfiUtilityMsgs.h164
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c1775
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h163
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/FvLib.c927
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/FvLib.h189
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/GNUmakefile33
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/Makefile36
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/MemoryFile.c251
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/MemoryFile.h105
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/MyAlloc.c548
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/MyAlloc.h209
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/OsPath.c295
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/OsPath.h133
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/ParseGuidedSectionTools.c205
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/ParseGuidedSectionTools.h120
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/ParseInf.c695
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/ParseInf.h220
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/PcdValueCommon.c779
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/PcdValueCommon.h185
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/PeCoffLib.h213
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/PeCoffLoaderEx.c334
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/SimpleFileParsing.c1429
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/SimpleFileParsing.h104
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/StringFuncs.c413
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/StringFuncs.h244
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/TianoCompress.c1746
-rw-r--r--roms/edk2/BaseTools/Source/C/Common/WinNtInclude.h66
-rw-r--r--roms/edk2/BaseTools/Source/C/DevicePath/DevicePath.c194
-rw-r--r--roms/edk2/BaseTools/Source/C/DevicePath/DevicePathFromText.c3520
-rw-r--r--roms/edk2/BaseTools/Source/C/DevicePath/DevicePathUtilities.c868
-rw-r--r--roms/edk2/BaseTools/Source/C/DevicePath/GNUmakefile24
-rw-r--r--roms/edk2/BaseTools/Source/C/DevicePath/Makefile18
-rw-r--r--roms/edk2/BaseTools/Source/C/DevicePath/UefiDevicePathLib.c292
-rw-r--r--roms/edk2/BaseTools/Source/C/DevicePath/UefiDevicePathLib.h439
-rw-r--r--roms/edk2/BaseTools/Source/C/EfiRom/EfiRom.c1712
-rw-r--r--roms/edk2/BaseTools/Source/C/EfiRom/EfiRom.h353
-rw-r--r--roms/edk2/BaseTools/Source/C/EfiRom/GNUmakefile15
-rw-r--r--roms/edk2/BaseTools/Source/C/EfiRom/Makefile16
-rw-r--r--roms/edk2/BaseTools/Source/C/GNUmakefile91
-rw-r--r--roms/edk2/BaseTools/Source/C/GenCrc32/GNUmakefile15
-rw-r--r--roms/edk2/BaseTools/Source/C/GenCrc32/GenCrc32.c361
-rw-r--r--roms/edk2/BaseTools/Source/C/GenCrc32/Makefile16
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFfs/GNUmakefile16
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFfs/GenFfs.c1117
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFfs/Makefile16
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFv/GNUmakefile23
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFv/GenFv.c696
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c4427
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.h402
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFv/Makefile16
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFw/Elf32Convert.c1178
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFw/Elf32Convert.h19
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFw/Elf64Convert.c1657
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFw/Elf64Convert.h19
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFw/ElfConvert.c245
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFw/ElfConvert.h81
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFw/GNUmakefile23
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFw/GenFw.c3251
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFw/GenFw.h50
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFw/Makefile18
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFw/elf32.h252
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFw/elf64.h254
-rw-r--r--roms/edk2/BaseTools/Source/C/GenFw/elf_common.h1045
-rw-r--r--roms/edk2/BaseTools/Source/C/GenSec/GNUmakefile23
-rw-r--r--roms/edk2/BaseTools/Source/C/GenSec/GenSec.c1811
-rw-r--r--roms/edk2/BaseTools/Source/C/GenSec/Makefile18
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/AArch64/ProcessorBind.h148
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Arm/ProcessorBind.h147
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Common/BaseTypes.h308
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Common/BuildVersion.h9
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Common/MdeModuleHii.h233
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Common/PiFirmwareFile.h350
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Common/PiFirmwareVolume.h157
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Common/UefiBaseTypes.h168
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Common/UefiCapsule.h26
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h1680
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Common/UefiMultiPhase.h226
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Common/VariableFormat.h44
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Common/WorkingBlockHeader.h35
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Guid/FfsSectionAlignmentPadding.h16
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Guid/PcAnsi.h52
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Guid/PiFirmwareFileSystem.h39
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Ia32/ProcessorBind.h155
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi.h117
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h285
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi2_0.h520
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi3_0.h668
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Bluetooth.h56
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/IndustryStandard/EfiPci.h51
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h39
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/IndustryStandard/PeImage.h766
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/IndustryStandard/pci22.h536
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/IndustryStandard/pci23.h18
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/IndustryStandard/pci30.h38
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Protocol/DevicePath.h1404
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Protocol/DevicePathUtilities.h288
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Protocol/GraphicsOutput.h187
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Protocol/GuidedSectionExtraction.h145
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Protocol/HiiFramework.h944
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/Protocol/UgaDraw.h161
-rw-r--r--roms/edk2/BaseTools/Source/C/Include/X64/ProcessorBind.h183
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/GNUmakefile27
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/LZMA-SDK-README.txt3
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/LzmaCompress.c403
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/LzmaF86Compress.bat26
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Makefile37
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zFile.c286
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zFile.h83
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zStream.c176
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zTypes.h374
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zVersion.h27
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Alloc.c455
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Alloc.h51
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Bra.h64
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Bra86.c82
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Compiler.h33
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/CpuArch.h335
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.c1069
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.h121
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.c820
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.h101
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzHash.h57
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c1185
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.h234
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c2789
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.h76
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Precomp.h10
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Threads.c95
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Threads.h68
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-history.txt424
-rw-r--r--roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-sdk.txt357
-rw-r--r--roms/edk2/BaseTools/Source/C/Makefile70
-rw-r--r--roms/edk2/BaseTools/Source/C/Makefiles/NmakeSubdirs.bat40
-rw-r--r--roms/edk2/BaseTools/Source/C/Makefiles/NmakeSubdirs.py163
-rw-r--r--roms/edk2/BaseTools/Source/C/Makefiles/app.makefile22
-rw-r--r--roms/edk2/BaseTools/Source/C/Makefiles/footer.makefile30
-rw-r--r--roms/edk2/BaseTools/Source/C/Makefiles/header.makefile131
-rw-r--r--roms/edk2/BaseTools/Source/C/Makefiles/lib.makefile14
-rw-r--r--roms/edk2/BaseTools/Source/C/Makefiles/ms.app28
-rw-r--r--roms/edk2/BaseTools/Source/C/Makefiles/ms.common62
-rw-r--r--roms/edk2/BaseTools/Source/C/Makefiles/ms.lib25
-rw-r--r--roms/edk2/BaseTools/Source/C/Makefiles/ms.rule20
-rw-r--r--roms/edk2/BaseTools/Source/C/PyEfiCompressor/EfiCompressor.c206
-rw-r--r--roms/edk2/BaseTools/Source/C/PyEfiCompressor/Makefile18
-rw-r--r--roms/edk2/BaseTools/Source/C/PyEfiCompressor/setup.py37
-rw-r--r--roms/edk2/BaseTools/Source/C/Split/GNUmakefile17
-rw-r--r--roms/edk2/BaseTools/Source/C/Split/Makefile16
-rw-r--r--roms/edk2/BaseTools/Source/C/Split/Split.c466
-rw-r--r--roms/edk2/BaseTools/Source/C/TianoCompress/GNUmakefile15
-rw-r--r--roms/edk2/BaseTools/Source/C/TianoCompress/Makefile16
-rw-r--r--roms/edk2/BaseTools/Source/C/TianoCompress/TianoCompress.c2795
-rw-r--r--roms/edk2/BaseTools/Source/C/TianoCompress/TianoCompress.h431
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/EfiVfr.h44
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/GNUmakefile80
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Makefile50
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_FROM_131.txt522
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_FROM_133.txt2448
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_FROM_133_BEFORE_MR13.txt3666
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_SUMMARY.txt2049
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/KNOWN_PROBLEMS.txt241
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/MPW_Read_Me21
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/Makefile15
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/NOTES.bcc184
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/NOTES.msvc189
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/README159
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/RIGHTS26
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrDDK.mak233
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrMS.mak239
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrPPC.mak101
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/README19
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.1209
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.c3565
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.g2587
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.r787
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr1.txt264
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c1025
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/build.c813
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpcycles.c67
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpnode.c423
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/egman.c328
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/err.c538
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/fcache.c123
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset.c1555
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c2250
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c4797
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/generic.h286
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/globals.c484
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.c221
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.h73
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c878
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c1747
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile225
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile.cygwin219
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile196
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/misc.c1864
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/mode.h12
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/mrhoist.c3030
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/parser.dlg1387
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/pred.c821
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/proto.h852
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/scan.c5735
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/stdpccts.h31
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/syn.h390
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/tokens.h246
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/DlgDDK.mak121
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/DlgMS.mak126
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/DlgPPC.mak84
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/automata.c353
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg.179
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg.h250
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg.r270
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg1.txt132
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg_a.c1414
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg_p.c961
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg_p.g616
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/err.c99
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/main.c281
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile164
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile.cygwin157
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile163
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/mode.h4
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/output.c850
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/parser.dlg398
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/relabel.c217
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/stdpccts.h26
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/support.c240
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/tokens.h133
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/AParser.cpp871
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/AParser.h376
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ASTBase.cpp256
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ASTBase.h122
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtr.h88
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtrImpl.h90
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/AToken.h325
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokenBuffer.cpp374
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokenBuffer.h109
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokenStream.h51
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/BufFileInput.cpp100
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/BufFileInput.h53
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLG_stream_input.h98
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLexer.h194
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLexerBase.cpp302
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLexerBase.h202
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h134
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/PCCTSAST.cpp684
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/PCCTSAST.h143
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/SList.h72
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/antlr.h807
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ast.c345
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ast.h121
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/charbuf.h46
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/charptr.c58
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/charptr.h48
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/config.h1
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/dlgauto.h504
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/dlgdef.h128
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/err.h1170
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/int.h37
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_assert.h10
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_iostream.h10
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_istream.h10
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_setjmp.h10
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_stdarg.h10
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_stdio.h10
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_stdlib.h10
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_string.h10
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pcctscfg.h359
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pcnames.bat11
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/slist.cpp116
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/history.ps473
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/history.txt186
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/makefile.old66
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/genmk/genmk.c1063
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/genmk/genmk_old.c762
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/genmk/makefile29
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/makefile19
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/rexpr.c586
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/rexpr.h30
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/test.c19
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/set/set.c816
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/set/set.h121
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/sym/sym.c402
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/sym/template.h41
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp941
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/VfrCompiler.h108
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/VfrError.cpp297
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/VfrError.h107
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp2457
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/VfrFormPkg.h2776
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/VfrSyntax.g5689
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp3920
-rw-r--r--roms/edk2/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h538
-rw-r--r--roms/edk2/BaseTools/Source/C/VolInfo/GNUmakefile17
-rw-r--r--roms/edk2/BaseTools/Source/C/VolInfo/Makefile16
-rw-r--r--roms/edk2/BaseTools/Source/C/VolInfo/VolInfo.c2427
-rw-r--r--roms/edk2/BaseTools/Source/C/VolInfo/VolInfo.h31
-rw-r--r--roms/edk2/BaseTools/Source/Python/AmlToC/AmlToC.py142
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py113
-rwxr-xr-xroms/edk2/BaseTools/Source/Python/AutoGen/AutoGenWorker.py329
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/BuildEngine.py650
-rwxr-xr-xroms/edk2/BaseTools/Source/Python/AutoGen/DataPipe.py168
-rwxr-xr-xroms/edk2/BaseTools/Source/Python/AutoGen/GenC.py2108
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/GenDepex.py464
-rwxr-xr-xroms/edk2/BaseTools/Source/Python/AutoGen/GenMake.py1762
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/GenPcdDb.py1615
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/GenVar.py366
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/IdfClassObject.py132
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py295
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/InfSectionParser.py119
-rwxr-xr-xroms/edk2/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py2459
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py648
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py1518
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/StrGather.py630
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/UniClassObject.py683
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py280
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py971
-rw-r--r--roms/edk2/BaseTools/Source/Python/AutoGen/__init__.py11
-rw-r--r--roms/edk2/BaseTools/Source/Python/BPDG/BPDG.py158
-rw-r--r--roms/edk2/BaseTools/Source/Python/BPDG/GenVpd.py689
-rw-r--r--roms/edk2/BaseTools/Source/Python/BPDG/StringTable.py72
-rw-r--r--roms/edk2/BaseTools/Source/Python/BPDG/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/Capsule/GenerateCapsule.py1048
-rw-r--r--roms/edk2/BaseTools/Source/Python/Capsule/GenerateWindowsDriver.py120
-rw-r--r--roms/edk2/BaseTools/Source/Python/Capsule/WindowsCapsuleSupportHelper.py64
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/BuildToolError.py160
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/BuildVersion.py10
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/DataType.py539
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/Edk2/Capsule/FmpPayloadHeader.py85
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/Edk2/Capsule/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/Edk2/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/EdkLogger.py383
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/Expression.py1054
-rwxr-xr-xroms/edk2/BaseTools/Source/Python/Common/GlobalData.py124
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py79
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/LongFilePathOsPath.py47
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/LongFilePathSupport.py45
-rwxr-xr-xroms/edk2/BaseTools/Source/Python/Common/Misc.py1929
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/MultipleWorkspace.py150
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/Parsing.py906
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/RangeExpression.py694
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/StringUtils.py873
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/TargetTxtClassObject.py199
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/ToolDefClassObject.py307
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/CapsuleDependency.py409
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/FmpAuthHeader.py190
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py298
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/UefiCapsuleHeader.py130
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/Uefi/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/VariableAttributes.py51
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/VpdInfoFile.py255
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/Common/caching.py41
-rw-r--r--roms/edk2/BaseTools/Source/Python/CommonDataClass/CommonClass.py91
-rw-r--r--roms/edk2/BaseTools/Source/Python/CommonDataClass/DataClass.py369
-rw-r--r--roms/edk2/BaseTools/Source/Python/CommonDataClass/Exceptions.py23
-rw-r--r--roms/edk2/BaseTools/Source/Python/CommonDataClass/FdfClass.py312
-rw-r--r--roms/edk2/BaseTools/Source/Python/CommonDataClass/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/C.g673
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/CParser3/CLexer.py4941
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/CParser3/CParser.py18833
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/CParser3/__init__.py0
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/CParser4/C.g4631
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/CParser4/CLexer.py626
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/CParser4/CListener.py809
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/CParser4/CParser.py6273
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/CParser4/__init__.py0
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/Check.py1532
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/CodeFragment.py159
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py595
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/Configuration.py444
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/Database.py340
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/EccGlobalData.py21
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/EccMain.py415
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/EccToolError.py204
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/Exception.py83
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/FileProfile.py51
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/MetaDataParser.py267
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py213
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py2089
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py329
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/ParserWarning.py24
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py225
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/Xml/__init__.py14
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/c.py2651
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/config.ini281
-rw-r--r--roms/edk2/BaseTools/Source/Python/Ecc/exception.xml315
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/CParser3/CLexer.py4941
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/CParser3/CParser.py18833
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/CParser3/__init__.py0
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/CParser4/CLexer.py627
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/CParser4/CListener.py808
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/CParser4/CParser.py6273
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/CParser4/__init__.py0
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/CodeFragment.py179
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/CodeFragmentCollector.py435
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/Database.py249
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/EfiCompressor.pydbin0 -> 11264 bytes
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/EotGlobalData.py105
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/EotMain.py1713
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/EotToolError.py15
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/FileProfile.py54
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/Identification.py52
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/InfParserLite.py148
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/LzmaCompressor.pydbin0 -> 14848 bytes
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/Parser.py869
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/ParserWarning.py20
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/Report.py468
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/Eot/c.py383
-rw-r--r--roms/edk2/BaseTools/Source/Python/GNUmakefile12
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/AprioriSection.py121
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/Capsule.py250
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/CapsuleData.py239
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/CompressSection.py96
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/DataSection.py124
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/DepexSection.py111
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/EfiSection.py325
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/Fd.py155
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/FdfParser.py4528
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/Ffs.py49
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/FfsFileStatement.py172
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/FfsInfStatement.py1128
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/Fv.py431
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/FvImageSection.py158
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/GenFds.py797
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py919
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/GuidSection.py278
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/OptRomFileStatement.py48
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/OptRomInfStatement.py159
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/OptionRom.py131
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/Region.py348
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/Rule.py23
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/RuleComplexFile.py25
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/RuleSimpleFile.py25
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/Section.py169
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/UiSection.py74
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/VerSection.py76
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenFds/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py228
-rw-r--r--roms/edk2/BaseTools/Source/Python/GenPatchPcdTable/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/Makefile13
-rw-r--r--roms/edk2/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py280
-rw-r--r--roms/edk2/BaseTools/Source/Python/PatchPcdValue/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py280
-rw-r--r--roms/edk2/BaseTools/Source/Python/Pkcs7Sign/Readme.md158
-rw-r--r--roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestCert.pem60
-rw-r--r--roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestCert.pub.pem25
-rw-r--r--roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cerbin0 -> 1008 bytes
-rw-r--r--roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer.inc1
-rw-r--r--roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc1
-rw-r--r--roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pem58
-rw-r--r--roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pub.pem23
-rw-r--r--roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestSub.pem59
-rw-r--r--roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestSub.pub.pem23
-rw-r--r--roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py170
-rw-r--r--roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py235
-rw-r--r--roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigningPrivateKey.pem27
-rw-r--r--roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigningPublicKey.bin1
-rw-r--r--roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigningPublicKey.txt1
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/Table.py114
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/TableDataModel.py90
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/TableDec.py103
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/TableDsc.py103
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/TableEotReport.py71
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/TableFdf.py104
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/TableFile.py99
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/TableFunction.py90
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/TableIdentifier.py85
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/TableInf.py109
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/TablePcd.py85
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/TableQuery.py63
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/TableReport.py127
-rw-r--r--roms/edk2/BaseTools/Source/Python/Table/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/TargetTool/TargetTool.py254
-rw-r--r--roms/edk2/BaseTools/Source/Python/TargetTool/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/Trim/Trim.py628
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/BuildVersion.py14
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Core/DependencyRules.py448
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py267
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Core/FileHook.py193
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Core/IpiDb.py922
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Core/PackageFile.py250
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Core/__init__.py14
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenDecFile.py683
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py1122
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py188
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenXmlFile.py12
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/__init__.py14
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/InstallPkg.py967
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/InventoryWs.py111
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Library/CommentGenerating.py238
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Library/CommentParsing.py593
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Library/DataType.py949
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Library/ExpressionValidate.py567
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Library/GlobalData.py110
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Library/Misc.py989
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Library/ParserValidate.py727
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Library/Parsing.py1015
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Library/StringUtils.py982
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Library/UniClassObject.py1074
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Library/Xml/XmlRoutines.py223
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Library/Xml/__init__.py14
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Library/__init__.py14
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Logger/Log.py319
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Logger/StringTable.py860
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Logger/ToolError.py171
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Logger/__init__.py14
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/MkPkg.py274
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/POM/CommonObject.py953
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/POM/ModuleObject.py654
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/POM/PackageObject.py192
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/POM/__init__.py14
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/DecObject.py605
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py686
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfBuildOptionObject.py87
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfCommonObject.py156
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfDefineCommonObject.py83
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py1002
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfDepexObject.py160
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py347
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfHeaderObject.py113
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py247
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py142
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py181
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py669
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py337
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py305
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py233
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfUserExtensionObject.py127
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/__init__.py14
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Object/__init__.py14
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/DecParser.py1091
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/DecParserMisc.py364
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py283
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py226
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/InfBuildOptionSectionParser.py212
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/InfDefineSectionParser.py191
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/InfDepexSectionParser.py98
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/InfGuidPpiProtocolSectionParser.py368
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py197
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/InfPackageSectionParser.py134
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/InfParser.py680
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/InfParserMisc.py216
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/InfPcdSectionParser.py178
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py493
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/InfSourceSectionParser.py139
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Parser/__init__.py14
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/DecPomAlignment.py1000
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py1071
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignmentMisc.py255
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/__init__.py14
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/ReplacePkg.py142
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/RmPkg.py270
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/TestInstall.py94
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/UPT.py347
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/UnitTest/CommentGeneratingUnitTest.py1414
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/UnitTest/CommentParsingUnitTest.py917
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/UnitTest/DecParserTest.py279
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py528
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.py381
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Xml/CommonXml.py997
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Xml/GuidProtocolPpiXml.py278
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Xml/IniToXml.py496
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py1003
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Xml/PackageSurfaceAreaXml.py402
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Xml/PcdXml.py555
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Xml/XmlParser.py926
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Xml/XmlParserMisc.py95
-rw-r--r--roms/edk2/BaseTools/Source/Python/UPT/Xml/__init__.py14
-rw-r--r--roms/edk2/BaseTools/Source/Python/Workspace/BuildClassObject.py634
-rw-r--r--roms/edk2/BaseTools/Source/Python/Workspace/DecBuildData.py475
-rw-r--r--roms/edk2/BaseTools/Source/Python/Workspace/DscBuildData.py3378
-rw-r--r--roms/edk2/BaseTools/Source/Python/Workspace/InfBuildData.py1064
-rw-r--r--roms/edk2/BaseTools/Source/Python/Workspace/MetaDataTable.py306
-rw-r--r--roms/edk2/BaseTools/Source/Python/Workspace/MetaFileCommentParser.py45
-rw-r--r--roms/edk2/BaseTools/Source/Python/Workspace/MetaFileParser.py2193
-rw-r--r--roms/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py430
-rw-r--r--roms/edk2/BaseTools/Source/Python/Workspace/WorkspaceCommon.py256
-rw-r--r--roms/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py204
-rw-r--r--roms/edk2/BaseTools/Source/Python/Workspace/__init__.py9
-rw-r--r--roms/edk2/BaseTools/Source/Python/basetool_tiano_python_path_env.yaml11
-rw-r--r--roms/edk2/BaseTools/Source/Python/build/BuildReport.py2295
-rw-r--r--roms/edk2/BaseTools/Source/Python/build/__init__.py9
-rwxr-xr-xroms/edk2/BaseTools/Source/Python/build/build.py2728
-rw-r--r--roms/edk2/BaseTools/Source/Python/build/buildoptions.py105
-rw-r--r--roms/edk2/BaseTools/Source/Python/sitecustomize.py15
-rw-r--r--roms/edk2/BaseTools/Tests/CToolsTests.py29
-rw-r--r--roms/edk2/BaseTools/Tests/CheckPythonSyntax.py68
-rw-r--r--roms/edk2/BaseTools/Tests/CheckUnicodeSourceFiles.py175
-rw-r--r--roms/edk2/BaseTools/Tests/GNUmakefile15
-rw-r--r--roms/edk2/BaseTools/Tests/PythonTest.py9
-rw-r--r--roms/edk2/BaseTools/Tests/PythonToolsTests.py28
-rw-r--r--roms/edk2/BaseTools/Tests/RunTests.py39
-rw-r--r--roms/edk2/BaseTools/Tests/TestRegularExpression.py48
-rw-r--r--roms/edk2/BaseTools/Tests/TestTools.py184
-rw-r--r--roms/edk2/BaseTools/Tests/TianoCompress.py69
-rw-r--r--roms/edk2/BaseTools/UserManuals/Build_Utility_Man_Page.rtf495
-rw-r--r--roms/edk2/BaseTools/UserManuals/EfiRom_Utility_Man_Page.rtf294
-rw-r--r--roms/edk2/BaseTools/UserManuals/GenCrc32_Utility_Man_Page.rtf321
-rw-r--r--roms/edk2/BaseTools/UserManuals/GenDepex_Utility_Man_Page.rtf352
-rw-r--r--roms/edk2/BaseTools/UserManuals/GenFds_Utility_Man_Page.rtf413
-rw-r--r--roms/edk2/BaseTools/UserManuals/GenFfs_Utility_Man_Page.rtf339
-rw-r--r--roms/edk2/BaseTools/UserManuals/GenFv_Utility_Man_Page.rtf430
-rw-r--r--roms/edk2/BaseTools/UserManuals/GenFw_Utility_Man_Page.rtf381
-rw-r--r--roms/edk2/BaseTools/UserManuals/GenPatchPcdTable_Utility_Man_Page.rtf276
-rw-r--r--roms/edk2/BaseTools/UserManuals/GenSec_Utility_Man_Page.rtf408
-rw-r--r--roms/edk2/BaseTools/UserManuals/Intel_UEFI_Packaging_Tool_Man_Page.rtf616
-rw-r--r--roms/edk2/BaseTools/UserManuals/LzmaCompress_Utility_Man_Page.rtf382
-rw-r--r--roms/edk2/BaseTools/UserManuals/PatchPcdValue_Utility_Man_Page.rtf297
-rw-r--r--roms/edk2/BaseTools/UserManuals/SplitFile_Utility_Man_Page.rtf318
-rw-r--r--roms/edk2/BaseTools/UserManuals/TargetTool_Utility_Man_Page.rtf348
-rw-r--r--roms/edk2/BaseTools/UserManuals/TianoCompress_Utility_Man_Page.rtf321
-rw-r--r--roms/edk2/BaseTools/UserManuals/Trim_Utility_Man_Page.rtf369
-rw-r--r--roms/edk2/BaseTools/UserManuals/UtilityManPage_template.rtf241
-rw-r--r--roms/edk2/BaseTools/UserManuals/VfrCompiler_Utility_Man_Page.rtf353
-rw-r--r--roms/edk2/BaseTools/UserManuals/VolInfo_Utility_Man_Page.rtf312
-rw-r--r--roms/edk2/BaseTools/basetools_calling_path_env.yaml11
-rw-r--r--roms/edk2/BaseTools/basetools_path_env.yaml11
-rw-r--r--roms/edk2/BaseTools/get_vsvars.bat100
-rw-r--r--roms/edk2/BaseTools/set_vsprefix_envs.bat242
-rwxr-xr-xroms/edk2/BaseTools/toolsetup.bat482
1149 files changed, 458826 insertions, 0 deletions
diff --git a/roms/edk2/BaseTools/.gitignore b/roms/edk2/BaseTools/.gitignore
new file mode 100644
index 000000000..a45689bc8
--- /dev/null
+++ b/roms/edk2/BaseTools/.gitignore
@@ -0,0 +1,20 @@
+*.d
+*.o
+*.obj
+*.pdb
+*.ilk
+*.exe
+*.pyc
+Source/C/VfrCompile/EfiVfrParser.cpp
+Source/C/VfrCompile/EfiVfrParser.h
+Source/C/VfrCompile/Pccts/antlr/antlr
+Source/C/VfrCompile/Pccts/dlg/dlg
+Source/C/VfrCompile/VfrLexer.cpp
+Source/C/VfrCompile/VfrLexer.h
+Source/C/VfrCompile/VfrParser.dlg
+Source/C/VfrCompile/VfrSyntax.cpp
+Source/C/VfrCompile/VfrTokens.h
+Source/C/bin/
+Source/C/libs/
+Bin/Win32
+Lib \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/BootSectImage b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/BootSectImage
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/BootSectImage
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/BuildEnv b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/BuildEnv
new file mode 100755
index 000000000..2cb8b86a9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/BuildEnv
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+PYTHONPATH="`dirname $0`/../../Source/Python" \
+ python "`dirname $0`/../../Source/Python"/`basename $0`/`basename $0`.py $*
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Ecc b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Ecc
new file mode 100755
index 000000000..1ba451cf5
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Ecc
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiLdrImage b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiLdrImage
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiLdrImage
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiRom b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiRom
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/EfiRom
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenCrc32 b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenCrc32
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenCrc32
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenDepex b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenDepex
new file mode 100755
index 000000000..1ba451cf5
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenDepex
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFds b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFds
new file mode 100755
index 000000000..1ba451cf5
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFds
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFfs b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFfs
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFfs
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFv b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFv
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFv
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFw b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFw
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFw
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenPage b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenPage
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenPage
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenSec b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenSec
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenSec
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenVtf b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenVtf
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GenVtf
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GnuGenBootSector b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GnuGenBootSector
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/GnuGenBootSector
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/LzmaCompress b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/LzmaCompress
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/LzmaCompress
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/LzmaF86Compress b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/LzmaF86Compress
new file mode 100755
index 000000000..c712b131b
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/LzmaF86Compress
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+#
+# This script will exec LzmaCompress tool with --f86 option that enables converter for x86 code.
+#
+# Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+for arg; do
+ case $arg in
+ -e|-d)
+ set -- "$@" --f86
+ break
+ ;;
+esac
+
+exec LzmaCompress "$@"
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/RunBinToolFromBuildDir b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/RunBinToolFromBuildDir
new file mode 100755
index 000000000..4821d24fa
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/RunBinToolFromBuildDir
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+#exec `dirname $0`/../../../../C/bin/`basename $0` $*
+
+TOOL_BASENAME=`basename $0`
+
+if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
+then
+ exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
+elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
+then
+ if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
+ then
+ echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
+ echo You may need to run:
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
+ fi
+elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
+then
+ exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
+else
+ echo Unable to find the real \'$TOOL_BASENAME\' to run
+ echo This message was printed by
+ echo " $0"
+ exit -1
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/RunToolFromSource b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/RunToolFromSource
new file mode 100755
index 000000000..2cb8b86a9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/RunToolFromSource
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+PYTHONPATH="`dirname $0`/../../Source/Python" \
+ python "`dirname $0`/../../Source/Python"/`basename $0`/`basename $0`.py $*
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Split b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Split
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Split
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/TargetTool b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/TargetTool
new file mode 100755
index 000000000..1ba451cf5
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/TargetTool
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/TianoCompress b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/TianoCompress
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/TianoCompress
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Trim b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Trim
new file mode 100755
index 000000000..b53b79bba
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/Trim
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+exe=$(basename "$full_cmd")
+
+export PYTHONPATH="$dir/../../Source/Python"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$exe/$exe.py" "$@"
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VfrCompile b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VfrCompile
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VfrCompile
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VolInfo b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VolInfo
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/VolInfo
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
new file mode 100755
index 000000000..3035732d5
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+#
+# ARMCC tools do not support cygwin paths. Ths script converts cygwin paths to DOS paths
+# in any arguments.
+#
+# armcc_wrapper.py ToolToExec [command line to convert]
+#
+# anything with the / will be converted via cygpath cygwin call or manually.
+# -I/cygpath/c/example is a special case as you can not pass -I to cygpath
+#
+# ExceptionList if a tool takes an argument with a / add it to the exception list
+#
+from __future__ import print_function
+import sys
+import os
+import subprocess
+import pipes
+
+#
+# Convert using cygpath command line tool
+# Currently not used, but just in case we need it in the future
+#
+def ConvertCygPathToDosViacygpath(CygPath):
+ p = subprocess.Popen("cygpath -m " + pipes.quote(CygPath), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
+ return p.stdout.read().strip()
+
+#
+#
+#
+def ConvertCygPathToDos(CygPath):
+ if CygPath.find("/cygdrive/") == 0:
+ # convert /cygdrive/c/Xyz to c:/Xyz
+ DosPath = CygPath[10] + ':' + CygPath[11:]
+ else:
+ DosPath = CygPath
+
+ # pipes.quote will add the extra \\ for us.
+ return DosPath.replace('/', '\\')
+
+
+# we receive our options as a list, but we will be passing them to the shell as a line
+# this means we have to requote things as they will get one round of unquoting.
+# we can't set "shell=False" because we are running commands from the PATH and
+# if you don't use the shell you don't get a PATH search.
+def main(argv):
+
+ # use 1st argument as name of tool to call
+ Command = pipes.quote(sys.argv[1]);
+
+ ExceptionList = ["/interwork"]
+
+ for arg in argv:
+ if arg.find('/') == -1:
+ # if we don't need to convert just add to the command line
+ Command = Command + ' ' + pipes.quote(arg)
+ elif arg in ExceptionList:
+ # if it is in the list, then don't do a cygpath
+ # assembler stuff after --apcs has the /.
+ Command = Command + ' ' + pipes.quote(arg)
+ else:
+ if ((arg[0] == '-') and (arg[1] == 'I' or arg[1] == 'i')):
+ CygPath = arg[0] + arg[1] + ConvertCygPathToDos(arg[2:])
+ else:
+ CygPath = ConvertCygPathToDos(arg)
+
+ Command = Command + ' ' + pipes.quote(CygPath)
+
+ # call the real tool with the converted paths
+ return subprocess.call(Command, shell=True)
+
+
+if __name__ == "__main__":
+ try:
+ ret = main(sys.argv[2:])
+
+ except:
+ print("exiting: exception from " + sys.argv[0])
+ ret = 2
+
+ sys.exit(ret)
+
diff --git a/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/build b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/build
new file mode 100755
index 000000000..1ba451cf5
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/CYGWIN_NT-5.1-i686/build
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/Bin/Darwin-i386/Arm/DEBUG_XCODE31/CompilerIntrinsicsLib.lib b/roms/edk2/BaseTools/Bin/Darwin-i386/Arm/DEBUG_XCODE31/CompilerIntrinsicsLib.lib
new file mode 100644
index 000000000..79964fe1b
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/Darwin-i386/Arm/DEBUG_XCODE31/CompilerIntrinsicsLib.lib
Binary files differ
diff --git a/roms/edk2/BaseTools/Bin/Darwin-i386/Arm/DEBUG_XCODE32/CompilerIntrinsicsLib.lib b/roms/edk2/BaseTools/Bin/Darwin-i386/Arm/DEBUG_XCODE32/CompilerIntrinsicsLib.lib
new file mode 100644
index 000000000..79964fe1b
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/Darwin-i386/Arm/DEBUG_XCODE32/CompilerIntrinsicsLib.lib
Binary files differ
diff --git a/roms/edk2/BaseTools/Bin/Darwin-i386/Arm/RELEASE_XCODE31/CompilerIntrinsicsLib.lib b/roms/edk2/BaseTools/Bin/Darwin-i386/Arm/RELEASE_XCODE31/CompilerIntrinsicsLib.lib
new file mode 100644
index 000000000..c82c915b8
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/Darwin-i386/Arm/RELEASE_XCODE31/CompilerIntrinsicsLib.lib
Binary files differ
diff --git a/roms/edk2/BaseTools/Bin/Darwin-i386/Arm/RELEASE_XCODE32/CompilerIntrinsicsLib.lib b/roms/edk2/BaseTools/Bin/Darwin-i386/Arm/RELEASE_XCODE32/CompilerIntrinsicsLib.lib
new file mode 100644
index 000000000..c82c915b8
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/Darwin-i386/Arm/RELEASE_XCODE32/CompilerIntrinsicsLib.lib
Binary files differ
diff --git a/roms/edk2/BaseTools/Bin/gcc_aarch64_linux_ext_dep.yaml b/roms/edk2/BaseTools/Bin/gcc_aarch64_linux_ext_dep.yaml
new file mode 100644
index 000000000..e81223fd9
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/gcc_aarch64_linux_ext_dep.yaml
@@ -0,0 +1,21 @@
+## @file
+# Download GCC AARCH64 compiler from Linaro's release site
+# Set shell variable GCC5_AARCH64_INSTALL to this folder
+#
+# This is only downloaded when a build activates scope gcc_aarch64_linux
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "gcc_aarch64_linux",
+ "type": "web",
+ "name": "gcc_aarch64_linux",
+ "source": "http://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/aarch64-linux-gnu/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz",
+ "version": "7.4.1",
+ "sha256": "27f1dc2c491ed61ae8f0d4b0c11de59cd2f7dd9c94761ee7153006fcac1bf9ab",
+ "compression_type": "tar",
+ "internal_path": "/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/",
+ "flags": ["set_shell_var", ],
+ "var_name": "GCC5_AARCH64_INSTALL"
+}
diff --git a/roms/edk2/BaseTools/Bin/gcc_arm_linux_ext_dep.yaml b/roms/edk2/BaseTools/Bin/gcc_arm_linux_ext_dep.yaml
new file mode 100644
index 000000000..09481ceae
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/gcc_arm_linux_ext_dep.yaml
@@ -0,0 +1,21 @@
+## @file
+# Download GCC ARM compiler from Linaro's release site
+# Set shell variable GCC5_ARM_INSTALL to this folder
+#
+# This is only downloaded when a build activates scope gcc_arm_linux
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "gcc_arm_linux",
+ "type": "web",
+ "name": "gcc_arm_linux",
+ "source": "https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/arm-linux-gnueabihf/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf.tar.xz",
+ "version": "7.4.1",
+ "sha256": "3C951CF1941D0FA06D64CC0D5E88612B209D8123B273FA26C16D70BD7BC6B163",
+ "compression_type": "tar",
+ "internal_path": "/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/",
+ "flags": ["set_shell_var", ],
+ "var_name": "GCC5_ARM_INSTALL"
+}
diff --git a/roms/edk2/BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml b/roms/edk2/BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml
new file mode 100644
index 000000000..8abbcd7ba
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml
@@ -0,0 +1,22 @@
+## @file
+# Download GCC RISCV64 compiler from RISC-V Organization release site
+# Set shell variable GCC5_RISCV64_INSTALL to this folder
+#
+# This is only downloaded when a build activates scope gcc_riscv64_unknown
+#
+# Copyright (c) Microsoft Corporation.
+# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "gcc_riscv64_unknown",
+ "type": "web",
+ "name": "gcc_riscv64_unknown",
+ "source": "https://raw.githubusercontent.com/riscv/riscv-uefi-edk2-docs/master/gcc-riscv-edk2-ci-toolchain/gcc-riscv-9.2.0-2020.04-x86_64_riscv64-unknown-gnu.tar.xz",
+ "version": "9.2.0",
+ "compression_type": "tar",
+ "sha256": "28373643b69f0ce008273c3dc63f172aa1121952f1b9ae94d7485ac94af7f344",
+ "internal_path": "/gcc-riscv-9.2.0-2020.04-x86_64_riscv64-unknown-gnu",
+ "flags": ["set_shell_var", ],
+ "var_name": "GCC5_RISCV64_INSTALL"
+}
diff --git a/roms/edk2/BaseTools/Bin/iasl_ext_dep.yaml b/roms/edk2/BaseTools/Bin/iasl_ext_dep.yaml
new file mode 100644
index 000000000..1d81e89cf
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/iasl_ext_dep.yaml
@@ -0,0 +1,21 @@
+## @file
+# Download iasl executable tool from a nuget.org package
+# - package contains different binaries based on host
+# Add the folder with the tool to the path
+#
+# This is only downloaded for scope cibuild thus
+# should have no impact on the asl compiler used by any
+# given platform to build.
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "id": "iasl-ci-1",
+ "scope": "cibuild",
+ "type": "nuget",
+ "name": "iasl",
+ "source": "https://api.nuget.org/v3/index.json",
+ "version": "20190215.0.0",
+ "flags": ["set_path", "host_specific"]
+}
diff --git a/roms/edk2/BaseTools/Bin/nasm_ext_dep.yaml b/roms/edk2/BaseTools/Bin/nasm_ext_dep.yaml
new file mode 100644
index 000000000..60b1f71b5
--- /dev/null
+++ b/roms/edk2/BaseTools/Bin/nasm_ext_dep.yaml
@@ -0,0 +1,18 @@
+## @file
+# Download nasm x86 assembler executable tool from a nuget.org package
+# - package contains different binaries based on host
+# Put on the tool on the path
+#
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "id": "nasm-1",
+ "scope": "edk2-build",
+ "type": "nuget",
+ "name": "mu_nasm",
+ "source": "https://api.nuget.org/v3/index.json",
+ "version": "2.14.02",
+ "flags": ["set_path", "host_specific"]
+}
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/AmlToC b/roms/edk2/BaseTools/BinWrappers/PosixLike/AmlToC
new file mode 100755
index 000000000..1dd28e966
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/AmlToC
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+exe=$(basename "$full_cmd")
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$exe/$exe.py" "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/BPDG b/roms/edk2/BaseTools/BinWrappers/PosixLike/BPDG
new file mode 100755
index 000000000..c89438490
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/BPDG
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" -m $cmd.$cmd "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/Brotli b/roms/edk2/BaseTools/BinWrappers/PosixLike/Brotli
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/Brotli
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/BrotliCompress b/roms/edk2/BaseTools/BinWrappers/PosixLike/BrotliCompress
new file mode 100755
index 000000000..663860bb3
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/BrotliCompress
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+#
+# This script will exec Brotli tool with -e/-d options.
+#
+# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+QLT="-q 9 -w 22"
+ARGS=
+
+while test $# -gt 0
+do
+ case $1 in
+ -e)
+ ;;
+ -d)
+ ARGS+="$1 "
+ ;;
+ -o|-g)
+ ARGS+="$1 $2 "
+ shift
+ ;;
+ -q)
+ QLT="$1 $2 "
+ shift
+ ;;
+ *)
+ ARGS+="$1 "
+ ;;
+ esac
+ shift
+done
+
+exec Brotli $QLT $ARGS
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/DevicePath b/roms/edk2/BaseTools/BinWrappers/PosixLike/DevicePath
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/DevicePath
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/Ecc b/roms/edk2/BaseTools/BinWrappers/PosixLike/Ecc
new file mode 100755
index 000000000..15edf5210
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/Ecc
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" -m $cmd.EccMain "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/EfiRom b/roms/edk2/BaseTools/BinWrappers/PosixLike/EfiRom
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/EfiRom
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/GenCrc32 b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenCrc32
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenCrc32
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/GenDepex b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenDepex
new file mode 100755
index 000000000..183cf5822
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenDepex
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/AutoGen/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/GenFds b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenFds
new file mode 100755
index 000000000..c89438490
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenFds
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" -m $cmd.$cmd "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/GenFfs b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenFfs
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenFfs
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/GenFv b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenFv
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenFv
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/GenFw b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenFw
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenFw
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable
new file mode 100755
index 000000000..f3770eed4
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/GenSec b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenSec
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenSec
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/GenerateCapsule b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenerateCapsule
new file mode 100755
index 000000000..023048c61
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/GenerateCapsule
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/Capsule/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/LzmaCompress b/roms/edk2/BaseTools/BinWrappers/PosixLike/LzmaCompress
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/LzmaCompress
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/LzmaF86Compress b/roms/edk2/BaseTools/BinWrappers/PosixLike/LzmaF86Compress
new file mode 100755
index 000000000..b55352ae4
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/LzmaF86Compress
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+#
+# This script will exec LzmaCompress tool with --f86 option that enables converter for x86 code.
+#
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+# Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+for arg; do
+ case $arg in
+ -e|-d)
+ set -- "$@" --f86
+ break
+ ;;
+ esac
+done
+
+exec LzmaCompress "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/PatchPcdValue b/roms/edk2/BaseTools/BinWrappers/PosixLike/PatchPcdValue
new file mode 100755
index 000000000..f3770eed4
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/PatchPcdValue
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/Pkcs7Sign b/roms/edk2/BaseTools/BinWrappers/PosixLike/Pkcs7Sign
new file mode 100755
index 000000000..f3770eed4
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/Pkcs7Sign
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys b/roms/edk2/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys
new file mode 100755
index 000000000..ea71c7c61
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/Rsa2048Sha256Sign/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign b/roms/edk2/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign
new file mode 100755
index 000000000..f3770eed4
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/Split b/roms/edk2/BaseTools/BinWrappers/PosixLike/Split
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/Split
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/TargetTool b/roms/edk2/BaseTools/BinWrappers/PosixLike/TargetTool
new file mode 100755
index 000000000..f3770eed4
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/TargetTool
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/TianoCompress b/roms/edk2/BaseTools/BinWrappers/PosixLike/TianoCompress
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/TianoCompress
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/Trim b/roms/edk2/BaseTools/BinWrappers/PosixLike/Trim
new file mode 100755
index 000000000..1dd28e966
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/Trim
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+exe=$(basename "$full_cmd")
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$exe/$exe.py" "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/UPT b/roms/edk2/BaseTools/BinWrappers/PosixLike/UPT
new file mode 100755
index 000000000..f3770eed4
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/UPT
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/VfrCompile b/roms/edk2/BaseTools/BinWrappers/PosixLike/VfrCompile
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/VfrCompile
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/VolInfo b/roms/edk2/BaseTools/BinWrappers/PosixLike/VolInfo
new file mode 100755
index 000000000..0945d86d9
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/VolInfo
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
+then
+ exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
+elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
+then
+ if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
+ then
+ echo "BaseTools C Tool binary was not found ($cmd)"
+ echo "You may need to run:"
+ echo " make -C $EDK_TOOLS_PATH/Source/C"
+ else
+ exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
+ fi
+elif [ -e "$dir/../../Source/C/bin/$cmd" ]
+then
+ exec "$dir/../../Source/C/bin/$cmd" "$@"
+else
+ echo "Unable to find the real '$cmd' to run"
+ echo "This message was printed by"
+ echo " $0"
+ exit 127
+fi
+
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/build b/roms/edk2/BaseTools/BinWrappers/PosixLike/build
new file mode 100755
index 000000000..f3770eed4
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/build
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+ python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
diff --git a/roms/edk2/BaseTools/BinWrappers/PosixLike/posix_path_env.yaml b/roms/edk2/BaseTools/BinWrappers/PosixLike/posix_path_env.yaml
new file mode 100644
index 000000000..8b32e010b
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/PosixLike/posix_path_env.yaml
@@ -0,0 +1,10 @@
+## @file
+# Set this folder on the path for all linux builds
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "global-nix",
+ "flags": ["set_path"]
+}
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/AmlToC.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/AmlToC.bat
new file mode 100644
index 000000000..9616cd893
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/AmlToC.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/BPDG.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/BPDG.bat
new file mode 100644
index 000000000..f43dba81f
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/BPDG.bat
@@ -0,0 +1,4 @@
+@setlocal
+@set ToolName=%~n0%
+@set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python
+@%PYTHON_COMMAND% -m %ToolName%.%ToolName% %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/BrotliCompress.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/BrotliCompress.bat
new file mode 100644
index 000000000..788c99a13
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/BrotliCompress.bat
@@ -0,0 +1,55 @@
+@REM @file
+@REM This script will exec Brotli tool with -e/-d options.
+@REM
+@REM Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
+@REM SPDX-License-Identifier: BSD-2-Clause-Patent
+@REM
+
+@echo off
+@setlocal
+
+set QLT=-q 9 -w 22
+set ARGS=
+
+:Begin
+if "%1"=="" goto End
+
+if "%1"=="-d" (
+ set ARGS=%ARGS% %1
+ shift
+ goto Begin
+)
+
+if "%1"=="-e" (
+ shift
+ goto Begin
+)
+
+if "%1"=="-g" (
+ set ARGS=%ARGS% %1 %2
+ shift
+ shift
+ goto Begin
+)
+
+if "%1"=="-o" (
+ set ARGS=%ARGS% %1 %2
+ shift
+ shift
+ goto Begin
+)
+
+if "%1"=="-q" (
+ set QLT=%1 %2
+ shift
+ shift
+ goto Begin
+)
+
+set ARGS=%ARGS% %1
+shift
+goto Begin
+
+:End
+Brotli %QLT% %ARGS%
+@echo on
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/Ecc.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/Ecc.bat
new file mode 100644
index 000000000..ba1a15b3b
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/Ecc.bat
@@ -0,0 +1,4 @@
+@setlocal
+@set ToolName=%~n0%
+@set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python
+@%PYTHON_COMMAND% -m %ToolName%.EccMain %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/GenDepex.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/GenDepex.bat
new file mode 100644
index 000000000..f8f3eefac
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/GenDepex.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\AutoGen\%ToolName%.py %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/GenFds.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/GenFds.bat
new file mode 100644
index 000000000..f43dba81f
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/GenFds.bat
@@ -0,0 +1,4 @@
+@setlocal
+@set ToolName=%~n0%
+@set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python
+@%PYTHON_COMMAND% -m %ToolName%.%ToolName% %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat
new file mode 100644
index 000000000..9616cd893
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat
new file mode 100644
index 000000000..11b4a48ae
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat
@@ -0,0 +1 @@
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\Capsule\GenerateCapsule.py %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat
new file mode 100644
index 000000000..9616cd893
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat
new file mode 100644
index 000000000..9616cd893
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat
new file mode 100644
index 000000000..6d4443b60
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat
@@ -0,0 +1 @@
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256Sign.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256Sign.bat
new file mode 100644
index 000000000..9616cd893
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256Sign.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/TargetTool.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/TargetTool.bat
new file mode 100644
index 000000000..9616cd893
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/TargetTool.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/Trim.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/Trim.bat
new file mode 100644
index 000000000..9616cd893
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/Trim.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/UPT.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/UPT.bat
new file mode 100644
index 000000000..9616cd893
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/UPT.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/build.bat b/roms/edk2/BaseTools/BinWrappers/WindowsLike/build.bat
new file mode 100644
index 000000000..9616cd893
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/build.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/roms/edk2/BaseTools/BinWrappers/WindowsLike/win_build_tools_path_env.yaml b/roms/edk2/BaseTools/BinWrappers/WindowsLike/win_build_tools_path_env.yaml
new file mode 100644
index 000000000..83f5856e7
--- /dev/null
+++ b/roms/edk2/BaseTools/BinWrappers/WindowsLike/win_build_tools_path_env.yaml
@@ -0,0 +1,10 @@
+## @file
+# Add this folder to the path on Windows
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "global-win",
+ "flags": ["set_path"]
+}
diff --git a/roms/edk2/BaseTools/BuildEnv b/roms/edk2/BaseTools/BuildEnv
new file mode 100755
index 000000000..5943bb9ef
--- /dev/null
+++ b/roms/edk2/BaseTools/BuildEnv
@@ -0,0 +1,269 @@
+## @file
+# Setup the environment for unix-like systems running a bash-like shell.
+# This file must be "sourced" not merely executed. For example: ". edksetup.sh"
+#
+# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+SetWorkspace() {
+
+ #
+ # If WORKSPACE is already set, then we can return right now
+ #
+ if [ -n "$WORKSPACE" ]
+ then
+ return 0
+ fi
+
+ #
+ # Set $WORKSPACE
+ #
+ export WORKSPACE=`pwd`
+
+ return 0
+
+}
+
+RestorePreviousConfiguration() {
+ #
+ # Restore previous configuration
+ #
+ if [ -z "$CONF_PATH" ]
+ then
+ export CONF_PATH=$WORKSPACE/Conf
+ if [ ! -d $WORKSPACE/Conf ] && [ -n "$PACKAGES_PATH" ]
+ then
+ PATH_LIST=${PACKAGES_PATH//:/ }
+ for DIR in $PATH_LIST
+ do
+ if [ -d $DIR/Conf ]
+ then
+ export CONF_PATH=$DIR/Conf
+ break
+ fi
+ done
+ fi
+ fi
+
+ PREVIOUS_CONF_FILE=$CONF_PATH/BuildEnv.sh
+ if [ -e $PREVIOUS_CONF_FILE ]
+ then
+ echo Loading previous configuration from $PREVIOUS_CONF_FILE
+ . $PREVIOUS_CONF_FILE
+ fi
+}
+
+GenerateShellCodeToSetVariable() {
+ VARIABLE=$1
+ OUTPUT_FILE=$2
+ VAR_VALUE="echo \${${VARIABLE}}"
+ VAR_VALUE=`eval $VAR_VALUE`
+ echo "if [ -z \"\$${VARIABLE}\" ]" >> $OUTPUT_FILE
+ echo "then" >> $OUTPUT_FILE
+ echo " export ${VARIABLE}=${VAR_VALUE}" >> $OUTPUT_FILE
+ echo "fi" >> $OUTPUT_FILE
+}
+
+GenerateShellCodeToUpdatePath() {
+ OUTPUT_FILE=$1
+ echo "if [ -e $EDK_TOOLS_PATH_BIN ]" >> $OUTPUT_FILE
+ echo "then" >> $OUTPUT_FILE
+ echo " if [ "\${PATH/$EDK_TOOLS_PATH_BIN/}" == "\$PATH" ]" >> $OUTPUT_FILE
+ echo " then" >> $OUTPUT_FILE
+ echo " export PATH=$EDK_TOOLS_PATH_BIN:\$PATH" >> $OUTPUT_FILE
+ echo " fi" >> $OUTPUT_FILE
+ echo "fi" >> $OUTPUT_FILE
+}
+
+StoreCurrentConfiguration() {
+ #
+ # Write configuration to a shell script to allow for configuration to be
+ # easily reloaded.
+ #
+ OUTPUT_FILE=$CONF_PATH/BuildEnv.sh
+ #echo Storing current configuration into $OUTPUT_FILE
+ echo "# Auto-generated by ${BASH_SOURCE[0]}" >| $OUTPUT_FILE
+ GenerateShellCodeToSetVariable WORKSPACE $OUTPUT_FILE
+ GenerateShellCodeToSetVariable EDK_TOOLS_PATH $OUTPUT_FILE
+ GenerateShellCodeToUpdatePath $OUTPUT_FILE
+}
+
+SetEdkToolsPath() {
+
+ #
+ # If EDK_TOOLS_PATH is already set, then we can return right now
+ #
+ if [ -n "$EDK_TOOLS_PATH" ]
+ then
+ return 0
+ fi
+
+ #
+ # Try $CONF_PATH/EdkTools
+ #
+ if [ -e $CONF_PATH/EdkTools ]
+ then
+ export EDK_TOOLS_PATH=$CONF_PATH/EdkTools
+ return 0
+ fi
+
+ #
+ # Try $CONF_PATH/BaseToolsSource
+ #
+ if [ -e $CONF_PATH/BaseToolsSource ]
+ then
+ export EDK_TOOLS_PATH=$CONF_PATH/BaseToolsSource
+ return 0
+ fi
+
+ #
+ # Try $WORKSPACE/BaseTools
+ #
+ if [ -e $WORKSPACE/BaseTools ]
+ then
+ export EDK_TOOLS_PATH=$WORKSPACE/BaseTools
+ return 0
+ fi
+
+ #
+ # Try $PACKAGES_PATH
+ #
+ if [ -n "$PACKAGES_PATH"]
+ then
+ PATH_LIST=${PACKAGES_PATH//:/ }
+ for DIR in $PATH_LIST
+ do
+ if [ -d $DIR/BaseTools ]
+ then
+ export EDK_TOOLS_PATH=$DIR/BaseTools
+ return 0
+ fi
+ done
+ fi
+
+ echo "Unable to determine EDK_TOOLS_PATH"
+ echo
+ echo "You may need to download the 'BaseTools' from buildtools.tianocore.org."
+ echo "After downloading, either create a symbolic link to the source at"
+ echo "\$WORKSPACE/Conf/BaseToolsSource, or set the EDK_TOOLS_PATH environment"
+ echo "variable."
+
+}
+
+GetBaseToolsBinSubDir() {
+ #
+ # Figure out a uniq directory name from the uname command
+ #
+ UNAME_DIRNAME=`uname -sm`
+ UNAME_DIRNAME=${UNAME_DIRNAME// /-}
+ UNAME_DIRNAME=${UNAME_DIRNAME//\//-}
+ echo $UNAME_DIRNAME
+}
+
+GetEdkToolsPathBinDirectory() {
+ #
+ # Figure out a uniq directory name from the uname command
+ #
+ BIN_SUB_DIR=`GetBaseToolsBinSubDir`
+
+ if [ -e $EDK_TOOLS_PATH/BinWrappers/$BIN_SUB_DIR ]
+ then
+ EDK_TOOLS_PATH_BIN=$EDK_TOOLS_PATH/BinWrappers/$BIN_SUB_DIR
+ else
+ EDK_TOOLS_PATH_BIN=$EDK_TOOLS_PATH/Bin/$BIN_SUB_DIR
+ fi
+
+ echo $EDK_TOOLS_PATH_BIN
+}
+
+AddDirToStartOfPath() {
+ DIRNAME=$1
+ PATH=$DIRNAME:$DIRNAME:$DIRNAME:$PATH
+ PATH=${PATH//$DIRNAME:/}
+ PATH=$DIRNAME:$PATH
+ export PATH
+}
+
+AddEdkToolsToPath() {
+
+ #
+ # If EDK_TOOLS_PATH is not set, then we cannot update PATH
+ #
+ if [ -z "$EDK_TOOLS_PATH" ]
+ then
+ return 1
+ fi
+
+ EDK_TOOLS_PATH_BIN=`GetEdkToolsPathBinDirectory`
+
+ AddDirToStartOfPath $EDK_TOOLS_PATH/BinWrappers/PosixLike
+ AddDirToStartOfPath $EDK_TOOLS_PATH_BIN
+
+}
+
+CopySingleTemplateFile() {
+
+ SRC_FILENAME=Conf/$1.template
+ DST_FILENAME=$CONF_PATH/$1.txt
+
+ if [ -e $DST_FILENAME ]
+ then
+ [ $RECONFIG != TRUE ] && return
+ fi
+
+ echo "Copying \$EDK_TOOLS_PATH/$SRC_FILENAME"
+ echo " to $DST_FILENAME"
+ SRC_FILENAME=$EDK_TOOLS_PATH/$SRC_FILENAME
+ cp $SRC_FILENAME $DST_FILENAME
+
+}
+
+CopyTemplateFiles() {
+
+ CopySingleTemplateFile build_rule
+ CopySingleTemplateFile tools_def
+ CopySingleTemplateFile target
+
+}
+
+ScriptMain() {
+
+ SetWorkspace
+ if [ -z $WORKSPACE ]
+ then
+ echo "Failure setting WORKSPACE"
+ return 1
+ fi
+
+ RestorePreviousConfiguration
+
+ SetEdkToolsPath
+ if [ -z $EDK_TOOLS_PATH ]
+ then
+ return 1
+ fi
+
+ AddEdkToolsToPath
+ if [ $? -ne 0 ]
+ then
+ echo "Failure adding EDK Tools into PATH!"
+ return 1
+ fi
+
+ StoreCurrentConfiguration
+
+ echo WORKSPACE: $WORKSPACE
+ echo EDK_TOOLS_PATH: $EDK_TOOLS_PATH
+ echo CONF_PATH: $CONF_PATH
+
+ CopyTemplateFiles
+
+}
+
+#
+# Run the main function
+#
+ScriptMain
+
diff --git a/roms/edk2/BaseTools/Conf/Empty_Package_Information_Data_File.ini b/roms/edk2/BaseTools/Conf/Empty_Package_Information_Data_File.ini
new file mode 100644
index 000000000..81e52f6e2
--- /dev/null
+++ b/roms/edk2/BaseTools/Conf/Empty_Package_Information_Data_File.ini
@@ -0,0 +1,15 @@
+;@file
+; Example ini file used for UPT.
+;
+; Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>
+; SPDX-License-Identifier: BSD-2-Clause-Patent
+;
+[DistributionHeader]
+Name =
+GUID =
+Version =
+Vendor =
+Copyright =
+License =
+Abstract =
+XmlSpecification = 1.1
diff --git a/roms/edk2/BaseTools/Conf/ReadMe.txt b/roms/edk2/BaseTools/Conf/ReadMe.txt
new file mode 100644
index 000000000..7bded360c
--- /dev/null
+++ b/roms/edk2/BaseTools/Conf/ReadMe.txt
@@ -0,0 +1,9 @@
+This directory contains the template files for the next generation of the
+EDK II Build infrastructure. These files will be copied into the WORKSPACE's
+Conf directory if and only if the target files do not exist.
+
+These files may be updated frequently.
+
+The XMLSchema directory contains the EDK II Packaging XML definitions. The
+schema may change in the future. It differs somewhat from the early versions
+of the XML Schema.
diff --git a/roms/edk2/BaseTools/Conf/XMLSchema/DistributionPackage.xsd b/roms/edk2/BaseTools/Conf/XMLSchema/DistributionPackage.xsd
new file mode 100644
index 000000000..67be9c8f3
--- /dev/null
+++ b/roms/edk2/BaseTools/Conf/XMLSchema/DistributionPackage.xsd
@@ -0,0 +1,3187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Filename: DistributionPackage.xsd
+
+Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+ targetNamespace="http://www.uefi.org/2012/1.0" xmlns="http://www.uefi.org/2012/1.0">
+ <xs:element name="DistributionPackage">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This schema defines the UEFI/PI Distribution Package description (PKG)
+ file. It describes the content of:
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us"> 1) Package descriptions with definitions and headers.</xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ 2) Modules in either source or binary format. (Note that Binary format
+ is for FFS leaf section file types only, complete FFS files cannot be distributed using this
+ distribution format.)
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ 3) The distribution of custom tools used to modify the binary images to
+ create UEFI/PI compliant images.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ 4) Finally, it can be used to distribute other miscellaneous content
+ that is not specific to UEFI/PI images.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ The Package Surface Area describes the content of packages, while the
+ Module Surface Area provides information relevant to source and/or binary distributions.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="DistributionHeader" minOccurs="1" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This header contains (legal) information usually required
+ for distributing both binary and/or source code.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="PackageSurfaceArea" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us"> The list of packages in this distribution. </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ Packages are groups of files and/or modules that are similar
+ in nature.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ Packages are uniquely identified by a package GUID and a
+ package version.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ A package can declare public mappings of C names to GUID
+ values.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ A package can provide header files for library classes
+ and/or other industry standard definitions.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ A package can also declare public mappings of platform
+ configuration database (PCD) &quot;knobs&quot; to control features and operation of modules
+ within a platform.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ Finally, a package lists the library instances and/or
+ modules that are provided in a distribution package.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="ModuleSurfaceArea" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The listing of UEFI/PI compliant modules in this
+ distribution that are NOT part of a Package. Every module that is provided as part of a
+ package needs to be described in a PackageSurfaceArea.Modules section.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ The ModuleSurfaceArea section describes how each module in a
+ distribution is coded, or, in the case of a binary module distribution, how it was built.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ UEFI/PI compliant libraries and modules are uniquely
+ identified by the Module's GUID and version number.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ This section will typically be used for modules that don't
+ require any additional files that would be included in a package. For example, the Enhanced
+ FAT driver binary does not need to have a package description, as no additional files are
+ provided.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="Tools" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section is for distributing vendor specific executable
+ tools, tool source code and/or configuration files. These tools are primarily for
+ manipulating code and/or binary images.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us"> Tools in this section can:</xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ 1) Parse build meta-data files to create source code files
+ and build scripts.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us"> 2) Modify image files to conform to UEFI/PI specifications. </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ 3) Generate binary files from certain types of text/unicode
+ files.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us"> 4) Generate PCI Option Roms or Firmware Device images. </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ 5) Implement external encoding/decoding/signature/GUIDed
+ tools.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ 6) Distribution Package create/install/remove tools.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="MiscellaneousFiles" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The list of miscellaneous files in this distribution. Any
+ files that are not listed in either the Package, Module or Tools sections can be listed
+ here. This section can be used to distribute specifications for packages and modules that
+ are not &quot;industry standards&quot; such as a specification for a chipset or a video
+ device.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="UserExtensions" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The UserExtensions section is used to disseminate processing
+ instructions that may be custom to the content provided by the distribution. This section
+ contains information that is common to all aspects of this distribution.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+
+ </xs:complexType>
+ </xs:element>
+ <!-- End of the DistributionPackage Description -->
+
+ <xs:element name="DistributionHeader">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section defines the content of the UEIF/PI compliant Distribution
+ Package Header. This is the only required element of a UEFI/PI compliant distribution package.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="Name">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the User Interface Name for this Distribution
+ Package.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ Each Distribution Package is uniquely identified by its
+ GUID and Version number.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:normalizedString">
+ <xs:attribute name="BaseName" type="xs:NMTOKEN" use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The reference name of the Distribution
+ Package file. This single word name can be used by tools as a keyword or for
+ directory and/or file creation.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ White space and special characters (dash and
+ underscore characters may be used) are not permitted in this name.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This 128-bit GUID and the Version attribute uniquely
+ identify this Distribution Package.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ Backward compatible releases of a distribution package need
+ only change the version number, while non-backward compatible changes require the GUID to
+ change (resetting the version number to 1.0 is optional.)
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="RegistryFormatGuid">
+ <xs:attribute name="Version" type="xs:decimal" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This value, along with the GUID, is used to
+ uniquely identify this object. The higher the number, the more recent the
+ content.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="Vendor" type="xs:normalizedString">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A string identifying who created this distribution package.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="Date" type="xs:dateTime">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The date and time this distribution was created. The format
+ is: YYYY-MM-DDThh:mm:ss, for example: 2001-01-31T13:30:00 (note the T character separator
+ between the calendar date and the time.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Copyright">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The copyright for this file that is generated by the creator
+ of the distribution. If a derivative work is generated from an existing distribution, then
+ the existing copyright must be maintained, and additional copyrights may be appended to the
+ end of this element. It may also be the primary copyright for all code provided in the
+ Distribution Package.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="License">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A license that describes any restrictions on the use of this
+ distribution. If a derivative work is allowed by the original license and a derivative work
+ is generated from an existing distribution, then the existing license must be maintained,
+ and additional licenses may be appended to the end of this element. It may also be the
+ primary license for all code provided in the distribution file. Alternatively, this may
+ point to a filename that contains the License. The file (included in the content zip file)
+ will be stored in the same location as the distribution package's .pkg file.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Abstract">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A one line description of the Distribution Package.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:normalizedString">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Description">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A complete description of the Distribution Package. This
+ description may include the release name of the file, the version of the file, and a
+ complete description of the file contents and/or features including a description of the
+ updates since the previous file release.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="Signature" type="Md5Sum">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The packaging utilities will use this MD5 sum value of the
+ included ZIP file containing files and/or code. If this element is not present, then
+ installation tools should assume that the content is correct, or that other methods may be
+ needed to verify content.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="XmlSpecification" type="xs:decimal" default="1.1">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us"> This version of this XML Schema is 1.1 </xs:documentation>
+ <xs:documentation xml:lang="en-us"> Changes to 1.1 from 1.0 </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ #1 Updated to present date and new version which is
+ important to reflect the present state of the matter
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ #2 Added definition/enumeration of UNDEFINED type 2 is
+ important since there is a large body of legacy code for which the GUID’s and other
+ code/data objects were not decorated with their usage. This document will allow for
+ importing today’s source artifacts and producing decorations using the ‘Undefined’ versus
+ having an error
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ #3 Allow for inclusion of ARM and future architecture
+ types
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="ReadOnly" type="xs:boolean" default="false" use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ If set to true, all content within this Distribution Package
+ should NOT be modified. The default permits modification of all content.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="RePackage" type="xs:boolean" default="false" use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ If set to true, then the content can be repackaged into another
+ distribution package. The default prohibits repackaging the Distribution content.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of the DistributionHeader element. -->
+
+ <xs:element name="PackageSurfaceArea">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A package is a collection of related objects - Includes, Libraries and
+ Modules.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ Each package is uniquely identified by its GUID and Version number.
+ Backward compatible releases of a package need only change the version number, while non-backward
+ compatible changes require the GUID to change (resetting the version number to 1.0 is optional.)
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+
+ <xs:element minOccurs="1" maxOccurs="1" name="Header">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="Name">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the User Interface Name for this
+ package.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:normalizedString">
+ <xs:attribute name="BaseName" type="xs:NMTOKEN" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is a single word BaseName
+ of the package. This BaseName can be used by tools as a keyword
+ and for directory/file creation.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This GUID and the Version attribute uniquely
+ identify a given package.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="RegistryFormatGuid">
+ <xs:attribute name="Version" type="xs:decimal" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This value, along with the GUID,
+ is used to uniquely identify this object.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ Backward compatible changes must
+ make sure this number is incremented from the most recent
+ version. Non-backward compatible changes require a new GUID, and
+ the version can be reset.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Copyright">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ If the package requires a different copyright
+ than the distribution package, this element can list one or more copyright
+ lines.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"
+ />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="License">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ If the package requires licenses that are
+ different from the distribution package license, this element can contain one or
+ more license text paragraphs (or license filenames.)
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"
+ />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Abstract">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A one line description of this package.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:normalizedString">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"
+ />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Description">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A complete description of a package. This
+ description may include the release name of the package, the version of the
+ package, and a complete description of the package contents and/or features
+ including a description of the updates since the previous package’s release.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"
+ />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="PackagePath" type="xs:anyURI">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This element is the location (in the ZIP file)
+ for the root directory of a package.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PackageSurfaceArea Header element. -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="ClonedFrom">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The term cloned is used here to indicate that this package
+ as been copied and modified to a completely different package. An example might be for a new
+ generation of chipsets that have few or no elements in common with the original.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This GUID and the Version attribute uniquely
+ identify the Package that this Package was copied from.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="RegistryFormatGuid">
+ <xs:attribute name="Version" type="xs:decimal" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This value, along with the GUID,
+ is used to uniquely identify the package that this package was
+ cloned from.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PackageSurfaceArea ClonedFrom element. -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="LibraryClassDeclarations">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Library Classes are public interfaces that can be used by
+ modules. One or more library instances can implement a library class, however only one
+ library instance can be linked to an individual module. This provides the platform
+ integrator with the flexibility of choosing one library instance's implementation over a
+ different library instance.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="LibraryClass">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="HeaderFile" type="xs:anyURI">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The header file provides definitions
+ and function prototypes for a library class. Modules can be coded
+ against these functions, using the definitions in this header,
+ without concerning themselves about the libraries' implementation
+ details. This is a PackagePath relative path and filename for the
+ include file.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="RecommendedInstance">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This GUID and the
+ Version attribute uniquely identify the Recommended Library
+ Instance.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="RegistryFormatGuid">
+ <xs:attribute name="Version" type="xs:decimal"
+ use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This value, along with
+ the GUID, is used to uniquely identify this object. If this
+ value is not specified, then any version of the library
+ instance is recommended.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="Keyword" type="xs:NCName" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The single word name of the Library
+ Class that module developers will use to identify a library class
+ dependency.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attributeGroup ref="SupportedArchMod"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PackageSurfaceArea LibraryClassDeclarations element. -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="IndustryStandardIncludes">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section is used to list header files for industry
+ standards not under the auspices of UEFI.org. For example, headers that contain definitions
+ and data structures for the USB specifications.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="IndustryStandardHeader">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="HeaderFile" type="xs:anyURI">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The package relative path and
+ filename (in the content zip file) of the industry standard include
+ file.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PackageSurfaceArea IndustryStdIncludes element. -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="PackageIncludes">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ All top level header files that are included by a package
+ that are not listed above. They cannot be:
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us"> 1) Local to a module (module specific.) </xs:documentation>
+ <xs:documentation xml:lang="en-us"> 2) An industry standard header. </xs:documentation>
+ <xs:documentation xml:lang="en-us"> 3) A library class header. </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="PackageHeader">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="HeaderFile">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the Package relative path
+ and filename location within the content ZIP file.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attributeGroup ref="SupportedArchMod"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PackageSurfaceArea PackageIncludes element. -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="Modules">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="ModuleSurfaceArea" minOccurs="1" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section lists the Module Surface Area for
+ all modules provided with this package.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PackageSurfaceArea Modules element. -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="GuidDeclarations">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section defines the mapping of GUID C names to GUID
+ values as a Registry Format GUID.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ Modules that use these GUIDs must specify their dependency
+ on this package.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Entry">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us"> Individual GUID Declarations </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="CName" type="xs:NCName"/>
+ <xs:element minOccurs="1" maxOccurs="1" name="GuidValue"
+ type="RegistryFormatGuid"/>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="UiName" type="xs:normalizedString" use="optional"/>
+ <xs:attribute name="GuidTypes" type="GuidListType" use="optional"/>
+ <xs:attributeGroup ref="SupportedArchMod"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PackageSurfaceArea GuidDeclarations element. -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="ProtocolDeclarations">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section defines the mapping of Protocol C names to GUID
+ values as a Registry Format GUID.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ Modules that use these Protocols must specify their
+ dependency on this package.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Entry">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Individual Protocol Declarations
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="CName" type="xs:NCName"/>
+ <xs:element minOccurs="1" maxOccurs="1" name="GuidValue"
+ type="RegistryFormatGuid"/>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="UiName" type="xs:normalizedString" use="optional"/>
+ <xs:attributeGroup ref="SupportedArchMod"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PackageSurfaceArea ProtocolDeclarations element. -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="PpiDeclarations">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section defines the mapping of Ppi C names to GUID
+ values as a Registry Format GUID.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ Modules that use these Ppis must specify their dependency on
+ this package.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Entry">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us"> Individual PPI Declarations </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="CName" type="xs:NCName"/>
+ <xs:element minOccurs="1" maxOccurs="1" name="GuidValue"
+ type="RegistryFormatGuid"/>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="UiName" type="xs:normalizedString" use="optional"/>
+ <xs:attributeGroup ref="SupportedArchMod"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PackageSurfaceArea PpiDeclarations element. -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="PcdDeclarations">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section is used to declare platform configuration knobs
+ that are defined by this package.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ Modules that use these PCD values must specify their
+ dependency on this package.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="PcdEntry">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="TokenSpaceGuidCname"
+ type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Specifies the C name of the Token
+ Space GUID of which this PCD Entry is a member. This C name should
+ also be listed in the GUIDs section, (specified above,) where the C
+ name is assigned to a GUID value.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="Token">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Specifies the 32-bit token value for
+ this PCD Entry. The Token number must be unique to the Token Space
+ that declares the PCD.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ The minLength of 3 is required to
+ handle the "0x" prefix to the hex number.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="HexNumber">
+ <xs:minLength value="3"/>
+ <xs:maxLength value="10"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="CName" type="xs:NCName"/>
+ <xs:element minOccurs="1" maxOccurs="1" name="DatumType" type="PcdDatumTypes">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A string that contains the data type
+ of this PCD Entry. PCD data types are restricted to the following
+ set:UINT8, UINT16, UINT32, UINT64, VOID*, BOOLEAN.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="ValidUsage" type="PcdItemListType">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A string that contains one or more
+ PCD Item types separated by spaces. The PCD Item types are
+ restricted to FeaturePcd, FixedPcd, PatchPcd, Pcd and/or PcdEx.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="DefaultValue"
+ type="xs:normalizedString"/>
+ <xs:element minOccurs="0" maxOccurs="1" name="MaxDatumSize">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is a recommended maximum data
+ size for VOID* data types, the actual value should be defined by the
+ Platform Integrator. It is not required for the other data types.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ The minLength of 3 is required to
+ handle the "0x" prefix to the hex number.
+ </xs:documentation>
+
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="HexNumber">
+ <xs:minLength value="3"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Prompt">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-US">
+ This entry contains prompt
+ information, that may used by tools to assist platform integrators
+ with choosing the correct values
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us"
+ use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="PcdError">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Valid Error messages that may be
+ implemented in a module for the PCD Entry. Only One Error Number per
+ PcdError, (multiple ErrorMessage entries are permitted) and multiple
+ PcdError elements are permitted.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice minOccurs="1" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ One of the following
+ types of comparisons, which must be able to evaluate to
+ either true or false.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:element minOccurs="0" maxOccurs="1" name="ValidValueList">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The PCD Value must be
+ space separated list of values. Values are restricted to the
+ data type of this PCD.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:normalizedString">
+ <xs:attribute name="Lang" type="xs:language" use="optional"
+ />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="ValidValueRange"
+ type="xs:normalizedString">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The PCD must be within a
+ specified range of numeric values. Restricted to C style
+ Relational, Equality and Logical Operators and parenthesis
+ are valid. Only the CName for this PCD is permitted in the
+ ValidValueRange expression. All other values must be
+ numeric.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ LValue (op RValue)+
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="Expression"
+ type="xs:normalizedString">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A in-fix logical
+ expression using C style logical operators.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:choice>
+ <xs:element minOccurs="1" maxOccurs="1" name="ErrorNumber">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A hexadecimal value for
+ the error message as defined by specifications.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ The minLength of 3 is
+ required to handle the "0x" prefix to the hex number.
+ </xs:documentation>
+
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="HexNumber">
+ <xs:minLength value="3"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="ErrorMessage">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This string should be
+ defined by specifications. There are pre-defined error
+ number ranges in the UEFI/PI specification.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us"
+ use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attributeGroup ref="SupportedArchMod"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PackageSurfaceArea PcdDeclarations element. -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="PcdRelationshipChecks">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section is used to describe any PCD interdependencies
+ or relationships.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="PcdCheck" type="xs:normalizedString">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This entry must used
+ TokenSpaceGuidCName.PcdCname for every named PCD. Restricted to Relational,
+ Equality and Logical Operators (NOT, AND, OR, GT, GE, EQ, LE, LT and XOR) and
+ parenthesis are valid. Only the TokenSpaceGuidCName.PcdCname us permitted to
+ name PCDs in the expression. All other values must be numeric.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us"> LValue (op RValue)+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="MiscellaneousFiles">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section contains files that are not part of the code
+ distributed with this package.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1" name="Copyright" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Only required if different from the Package
+ Copyright.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="License" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Only required if different from the Package
+ License.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="Abstract" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A one line description of this section's
+ content.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Description" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A complete description of the files in this
+ section.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the PackagePath relative path and
+ filename location within the ZIP file.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="Executable" type="xs:boolean" default="false"
+ use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ If true, used by installation
+ tools to ensure that a file that must be executable has the
+ correct properties to permit execution.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PackageSurfaceArea Misc element. -->
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="UserExtensions">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section is used for any processing instructions that
+ may be custom to the content provided by this package that are common to this package.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:any processContents="lax" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="UserId" type="xs:NCName" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is a single word identifier for grouping
+ similar content that does not fit into previously defined sections or other sections
+ of the Distribution.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="Identifier" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This can be used to differentiate multiple sections
+ with a grouping.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ For example, a PRE_PROCESS Identifier might indicate
+ specific steps and tools required before processing module content, while a
+ different UserExtensions section with a POST_PROCESS Identifier might describe steps
+ that need to be executed after operations on the modules in this package.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:anyAttribute processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PackageSurfaceArea UserExtensions element. -->
+
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of the PackageSurfaceArea element. -->
+
+ <xs:element name="ModuleSurfaceArea">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Each module is uniquely identified by its GUID and Version number.
+ Backward compatible releases of a module need only change the version number, while non-backward
+ compatible changes require the GUID to change (resetting the version number to 1.0 is optional.)
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+
+ <xs:element minOccurs="1" maxOccurs="1" name="Header">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="Name">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the User Interface Name for this Module.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:normalizedString">
+ <xs:attribute name="BaseName" type="xs:NMTOKEN" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is a single word BaseName
+ that will be used to create a module meta-data file.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ This name should also be used to
+ create output file names and directories.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This GUID and the Version attribute uniquely
+ identify a given Module.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="RegistryFormatGuid">
+ <xs:attribute name="Version" type="xs:decimal" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This value, along with the GUID,
+ is used to uniquely identify this object.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ Backward compatible changes must
+ make sure this number is incremented from the most recent
+ version. Non-backward compatible changes require a new GUID, and
+ the version can be reset.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Copyright">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is only required if the Copyright is
+ different from either the Package or Distribution copyright. Multiple copyright
+ lines are permitted within this section.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"
+ />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="License">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is only required if the license is
+ different from either the Package or Distribution license. Multiple licenses are
+ permitted within this section.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"
+ />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Abstract">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A brief text description of the module.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:normalizedString">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"
+ />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Description">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A complete description of the module contents
+ and/or features including a description of the updates since the previous module
+ release.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"
+ />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of Module Surface Area Header Section -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="ModuleProperties">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ List general information about a module, including the
+ Supported Architectures, this module's type, specifications the module is coded against, and
+ other informational content.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="ModuleType" type="ModuleTypes">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ One of the Enumerated module types that limit
+ the use of a module.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="Path" type="xs:anyURI">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ For stand-alone modules that are NOT part of any
+ package, this is the path to the root of the module as listed in the ZIP file.
+ For modules included in a package, this is the location, relative to the root of
+ the package (PackagePath) this module belongs to.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="PcdIsDriver">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This element is only required for the PEIM that
+ produces the PCD PPI or the DXE Driver that produces the PCD Protocol.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="PEI_PCD_DRIVER"/>
+ <xs:enumeration value="DXE_PCD_DRIVER"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element minOccurs="0" maxOccurs="1" name="UefiSpecificationVersion" type="xs:decimal"/>
+
+ <xs:element minOccurs="0" maxOccurs="1" name="PiSpecificationVersion" type="xs:decimal"/>
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Specification">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is a list of other specifications that this
+ module is written against. These entries can be used in #define statements
+ (depending on the build system implementation, they may be autogenerated.)
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:NCName">
+ <xs:attribute name="Version" type="xs:decimal" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="BootMode">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Different firmware execution paths may be taken
+ based on a given state of the hardware, firmware, or through feature settings. A
+ BootMode may be declared (PRODUCES) or discovered (CONSUMES) based on these
+ states and feature settings. If the usage is UNDEFINE, it implies that a Boot
+ Mode is used, but the package creator does not know how it is used. The
+ supported boot modes map to the PI specification Boot Modes. The boot modes
+ listed with Recovery are to indicate that the BootMode is valid during a
+ recovery boot.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence minOccurs="0">
+ <xs:element minOccurs="1" maxOccurs="1" name="SupportedBootModes">
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="FULL"/>
+ <xs:enumeration value="MINIMAL"/>
+ <xs:enumeration value="NO_CHANGE"/>
+ <xs:enumeration value="DIAGNOSTICS"/>
+ <xs:enumeration value="DEFAULT"/>
+ <xs:enumeration value="S2_RESUME"/>
+ <xs:enumeration value="S3_RESUME"/>
+ <xs:enumeration value="S4_RESUME"/>
+ <xs:enumeration value="S5_RESUME"/>
+ <xs:enumeration value="FLASH_UPDATE"/>
+ <xs:enumeration value="RECOVERY_FULL"/>
+ <xs:enumeration value="RECOVERY_MINIMAL"/>
+ <xs:enumeration value="RECOVERY_NO_CHANGE"/>
+ <xs:enumeration value="RECOVERY_DIAGNOSTICS"/>
+ <xs:enumeration value="RECOVERY_DEFAULT"/>
+ <xs:enumeration value="RECOVERY_S2_RESUME"/>
+ <xs:enumeration value="RECOVERY_S3_RESUME"/>
+ <xs:enumeration value="RECOVERY_S4_RESUME"/>
+ <xs:enumeration value="RECOVERY_S5_RESUME"/>
+ <xs:enumeration value="RECOVERY_FLASH_UPDATE"/>
+ <xs:enumeration value="UNDEFINED"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="Usage" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="CONSUMES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The module always supports
+ the given boot modes.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="SOMETIMES_CONSUMES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The module may support a
+ given mode on some execution paths.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="PRODUCES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The module will change the
+ boot mode.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="SOMETIME_PRODUCES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The module will change the
+ boot mode on some execution paths.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="UNDEFINED">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The package creator does not
+ know how the boot mode is used.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Event" nillable="true">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The functions that make up the Event, Timer, and
+ Task Priority Services are used during preboot to create, close, signal, and
+ wait for events; to set timers; and to raise and restore task priority levels as
+ defined in the UEFI specification. GUIDed events should be listed in the Guids
+ section.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="Usage" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="CONSUMES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The module will register a
+ notification function and calls the function when it is
+ signaled.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="SOMETIMES_CONSUMES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The module will register a
+ notification function and calls the function when it is
+ signaled on some execution paths.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="PRODUCES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The module will signal all
+ events in an event group.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="SOMETIMES_PRODUCES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The module will signal all
+ events in an event group under some execution paths.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="UNDEFINED">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The package creator does not
+ know how an event is used.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="EventType" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="EVENT_TYPE_PERIODIC_TIMER"/>
+ <xs:enumeration value="EVENT_TYPE_RELATIVE_TIMER"/>
+ <xs:enumeration value="UNDEFINED"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+
+ </xs:attribute>
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="HOB" nillable="false">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is a list of non-GUIDed Hand Off Blocks
+ (HOBs) produced or consumed by this module.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="HobType" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="PHIT"/>
+ <xs:enumeration value="MEMORY_ALLOCATION"/>
+ <xs:enumeration value="RESOURCE_DESCRIPTOR"/>
+ <xs:enumeration value="FIRMWARE_VOLUME"/>
+ <xs:enumeration value="LOAD_PEIM"/>
+ <xs:enumeration value="UNDEFINED"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="Usage" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="CONSUMES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A HOB must be present in the
+ system.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="SOMETIMES_CONSUMES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ If present, the HOB will be
+ used.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="PRODUCES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The HOB is always produced
+ by the module.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="SOMETIMES_PRODUCES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The HOB may be produced by
+ the module under some execution paths.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="UNDEFINED">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The package creator knows
+ that a HOB is used, but does not know how it is used.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+
+ </xs:sequence>
+ <xs:attributeGroup ref="SupportedArchMod"/>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of ModuleProperties Section -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="ClonedFrom">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section may be included for Modules that are copied
+ from a different module.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This GUID and the Version attribute uniquely
+ identify the Module that this Module was copied from.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="RegistryFormatGuid">
+ <xs:attribute name="Version" type="xs:decimal" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This value, along with the GUID,
+ is used to uniquely identify this object.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of ClonedFrom Section. -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="LibraryClassDefinitions">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A list of the different Library Classes consumed by a
+ driver, core and/or application module, or produced by a Library module.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="LibraryClass">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="Keyword" type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us ">
+ Used by tools to identify different
+ instances of libraries that provide the library class. This keyword
+ identifies the library class this module needs to be linked against.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="RecommendedInstance">
+ <xs:complexType>
+ <xs:all>
+ <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This GUID and the
+ Version attribute uniquely identify the recommended Library
+ Instance for this module .
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="RegistryFormatGuid">
+ <xs:attribute name="Version" type="xs:decimal"
+ use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This value, along with
+ the GUID, is used to uniquely identify this object.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="Usage" use="required">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Library instances can provide code
+ for a library class, or may require other library instances
+ themselves. Since different execution paths in a library (or module)
+ may need different library classes based on some setting, library
+ classes may not alway be required.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="PRODUCES"/>
+ <xs:enumeration value="CONSUMES"/>
+ <xs:enumeration value="SOMETIMES_CONSUMES"/>
+ <xs:enumeration value="UNDEFINED"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attributeGroup ref="SupportedArchMod"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A FeatureFlag attribute must evaluate to
+ either true or false - it may be a fixed value of true or false, a C
+ name or an in-fix expression.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of LibraryClassDefinitions Section -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="SourceFiles">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the module relative
+ (ModuleProperties.Path) path and filename location within the ZIP file.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="Family" type="FamilyTypes" use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The Family attribute is used to
+ restrict usage to a given family of compilers, such as GCC or
+ MSFT. Since not all code processing tools use the same syntax,
+ especially for assembly, this field can be used to identify
+ different syntax.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of SourceFiles Section -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="BinaryFiles">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="BinaryFile">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the module relative
+ (ModuleProperties.Path) path and filename location within the ZIP
+ file.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="FileType" use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Binary file distribution
+ is limited to UEFI/PI FFS leaf section file types.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:enumeration value="GUID"/>
+ <xs:enumeration value="FREEFORM"/>
+ <xs:enumeration value="UEFI_IMAGE"/>
+ <xs:enumeration value="PE32">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A UEFI/PI FFS Leaf
+ section file type, not a raw PE32 file.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="PIC"/>
+ <xs:enumeration value="PEI_DEPEX"/>
+ <xs:enumeration value="DXE_DEPEX"/>
+ <xs:enumeration value="SMM_DEPEX"/>
+ <xs:enumeration value="COMPAT16"/>
+ <xs:enumeration value="DISPOSABLE"/>
+ <xs:enumeration value="TE"/>
+ <xs:enumeration value="VER"/>
+ <xs:enumeration value="UI"/>
+ <xs:enumeration value="BIN"/>
+ <xs:enumeration value="FV"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="GUID" use="optional"
+ type="RegistryFormatGuid"/>
+ <xs:attribute name="SupArchList" type="ArchListType"
+ use="optional"/>
+ <xs:attribute name="SupModList" type="ModuleListType"
+ use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString"
+ use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="AsBuilt">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section contains information
+ about how the module was coded, such as Compiler Tools, Flags, PCDs
+ (only PatchPcd and/or PcdEx) and Library Class Instances used to
+ build the binary.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="PatchPcdValue">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The element is the
+ Patchable PCD Value that was used during the build.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1"
+ name="TokenSpaceGuidValue" type="RegistryFormatGuid"/>
+ <xs:element minOccurs="1" maxOccurs="1" name="PcdCName"
+ type="xs:NCName"/>
+ <xs:element minOccurs="1" maxOccurs="1" name="Token">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The minLength of 3 is
+ required to handle the "0x" prefix to the hex number.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="HexNumber">
+ <xs:minLength value="3"/>
+ <xs:maxLength value="10"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="DatumType"
+ type="PcdDatumTypes"/>
+ <xs:element minOccurs="0" maxOccurs="1" name="MaxDatumSize">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This field is required
+ if the Pcd Datum Type is VOID*
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ The minLength of 3 is
+ required to handle the "0x" prefix to the hex number.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="HexNumber">
+ <xs:minLength value="3"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="Value"
+ type="xs:normalizedString"/>
+ <xs:element minOccurs="1" maxOccurs="1" name="Offset">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The minLength of 3 is
+ required to handle the "0x" prefix to the hex number.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="HexNumber">
+ <xs:minLength value="3"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element ref="HelpText" minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded"
+ name="PcdError">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Error information
+ implemented by the module.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice>
+ <xs:element minOccurs="0" maxOccurs="1" name="ValidValueList">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:normalizedString">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="ValidValueRange" type="xs:normalizedString"/>
+ <xs:element minOccurs="0" maxOccurs="1" name="Expression" type="xs:normalizedString"/>
+ </xs:choice>
+ <xs:element minOccurs="1" maxOccurs="1" name="ErrorNumber">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The minLength of 3 is
+ required to handle the "0x" prefix to the hex number.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="HexNumber">
+ <xs:minLength value="3"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded"
+ name="ErrorMessage">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us"
+ use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="PcdExValue">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The element is the
+ DynamicEx PCD Value that was used during the build.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1"
+ name="TokenSpaceGuidValue" type="RegistryFormatGuid"/>
+ <xs:element minOccurs="1" maxOccurs="1" name="Token">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The minLength of 3 is
+ required to handle the "0x" prefix to the hex number.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="HexNumber">
+ <xs:minLength value="3"/>
+ <xs:maxLength value="10"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="DatumType"
+ type="PcdDatumTypes"/>
+ <xs:element minOccurs="0" maxOccurs="1" name="MaxDatumSize">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This field is required
+ if the Pcd Datum Type is VOID*
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="HexNumber">
+ <xs:minLength value="3"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="Value"
+ type="xs:normalizedString"/>
+ <xs:element ref="HelpText" minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded"
+ name="PcdError">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Error information
+ implemented by the module.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice>
+ <xs:element minOccurs="0" maxOccurs="1" name="ValidValueList">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:normalizedString">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="ValidValueRange" type="xs:normalizedString"/>
+ <xs:element minOccurs="0" maxOccurs="1" name="Expression" type="xs:normalizedString"/>
+ </xs:choice>
+ <xs:element minOccurs="1" maxOccurs="1" name="ErrorNumber">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The minLength of 3 is
+ required to handle the "0x" prefix to the hex number.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="HexNumber">
+ <xs:minLength value="3"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded"
+ name="ErrorMessage">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us"
+ use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element minOccurs="0" maxOccurs="1" name="LibraryInstances">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the actual
+ library instance that was used to link against the module.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="GUID">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This GUID and the
+ Version attribute uniquely identify the actual Library
+ Instance linked in this module.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="RegistryFormatGuid">
+ <xs:attribute name="Version" type="xs:decimal"
+ use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This value, along with
+ the GUID, is used to uniquely identify this object.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="BuildFlags">
+ <xs:complexType mixed="true">
+ <xs:simpleContent>
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Any description of OS,
+ Tool, and flags for the individual tool can go in this
+ section.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:extension base="xs:string">
+ <xs:anyAttribute processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of AsBuilt -->
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of BinaryFiles Section -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="PackageDependencies">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Package">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Description">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us"
+ use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This GUID and the Version attribute
+ uniquely identify Package that this Module depends on.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="RegistryFormatGuid">
+ <xs:attribute name="Version" type="xs:decimal" use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This value, along with
+ the GUID, is used to uniquely identify this object. If the
+ version attribute is not specified, the most recent version
+ of the package can be used.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PackageDependencies -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="Guids">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="GuidCName">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="CName" type="xs:NCName"/>
+ <xs:element minOccurs="0" maxOccurs="1" name="GUID" type="RegistryFormatGuid"/>
+ <xs:element minOccurs="0" maxOccurs="1" name="VariableName"
+ type="xs:normalizedString">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us"> Only valid for Variable GUID types. </xs:documentation>
+ <xs:documentation>
+ This can be either a Hex Array or C string in unicode
+ format: L"string" Data.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="Usage" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="CONSUMES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The module does not install
+ the GUID, and the GUID must be present for the module to
+ execute.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="SOMETIMES_CONSUMES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The module does not install
+ the GUID, however, the GUID will be used if it is present.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="PRODUCES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The module always installs
+ the GUID.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="SOMETIMES_PRODUCES">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The Module will install the
+ GUID under certain execution paths.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="UNDEFINED">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The package creator knows
+ that a GUID is used, but does not know how it is used.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="GuidType" type="GuidListType" use="required"/>
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of Guids Section -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="Protocols">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A listing of protocols required or produced by this module.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Protocol" nillable="true">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="CName" type="xs:NCName"/>
+ <xs:element minOccurs="0" maxOccurs="1" name="GUID" type="RegistryFormatGuid"/>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="Usage" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="PRODUCES"/>
+ <xs:enumeration value="SOMETIMES_PRODUCES"/>
+ <xs:enumeration value="CONSUMES"/>
+ <xs:enumeration value="SOMETIMES_CONSUMES"/>
+ <xs:enumeration value="TO_START"/>
+ <xs:enumeration value="BY_START"/>
+ <xs:enumeration value="UNDEFINED"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="Notify" type="xs:boolean" use="optional"/>
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of Protocols Section -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="PPIs">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A listing of PPIs required or produced by this module.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Ppi" nillable="true">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="CName" type="xs:NCName"/>
+ <xs:element minOccurs="0" maxOccurs="1" name="GUID" type="RegistryFormatGuid"/>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="Usage" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="PRODUCES"/>
+ <xs:enumeration value="SOMETIMES_PRODUCES"/>
+ <xs:enumeration value="CONSUMES"/>
+ <xs:enumeration value="SOMETIMES_CONSUMES"/>
+ <xs:enumeration value="UNDEFINED"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="Notify" type="xs:boolean" use="optional"/>
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PPIs Section -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="Externs">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ These elements specify additional information about the
+ module. This area may be used by tools to generate code.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Extern">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice minOccurs="1">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1" name="EntryPoint"
+ type="xs:NCName"/>
+ <xs:element minOccurs="0" maxOccurs="1" name="UnloadImage"
+ type="xs:NCName"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1" name="Constructor"
+ type="xs:NCName"/>
+ <xs:element minOccurs="0" maxOccurs="1" name="Destructor"
+ type="xs:NCName"/>
+ </xs:sequence>
+ </xs:choice>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of Externs Section -->
+
+ <xs:element minOccurs="0" maxOccurs="1" name="PcdCoded">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section describes how a platform is coded with respect
+ to the platform configuration knobs.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="PcdEntry">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="CName" type="xs:NCName"/>
+ <xs:element minOccurs="1" maxOccurs="1" name="TokenSpaceGuidCName"
+ type="xs:NCName"/>
+ <xs:element minOccurs="0" maxOccurs="1" name="DefaultValue"
+ type="xs:normalizedString"/>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="PcdItemType" type="PcdItemTypes" use="required"/>
+ <xs:attribute name="PcdUsage" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="PRODUCES"/>
+ <xs:enumeration value="SOMETIMES_PRODUCES"/>
+ <xs:enumeration value="CONSUMES"/>
+ <xs:enumeration value="SOMETIMES_CONSUMES"/>
+ <xs:enumeration value="UNDEFINED"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+
+ </xs:attribute>
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PcdCoded Section -->
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="PeiDepex">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the PEI dependency expression for a Dependency
+ Section.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Expression" type="xs:string" minOccurs="1" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ An in-fix expression, of C identifiers and TRUE,
+ FALSE, AND, OR, NOT, BEFORE, and AFTER as well as parenthesis () in the in-fix
+ notation. The operators are restricted to grammar defined in the PI
+ specification.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of PeiDepex Section -->
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="DxeDepex">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the DXE dependency expression for a Dependency
+ Section.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Expression" type=" xs:string " minOccurs="1" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ An in-fix expression, of C identifiers and TRUE,
+ FALSE, AND, OR, NOT, BEFORE, and AFTER as well as parenthesis () in the in-fix
+ notation. The operators are restricted to grammar defined in the PI
+ specification.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of DxeDepex Section -->
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="SmmDepex">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the SMM dependency expression for a Dependency
+ Section.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Expression" type=" xs:string " minOccurs="1" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ An in-fix expression, of C identifiers and TRUE,
+ FALSE, AND, OR, NOT, BEFORE, and AFTER as well as parenthesis () in the in-fix
+ notation. The operators are restricted to grammar defined in the PI
+ specification.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="HelpText" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+ <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of SmmDepex Section -->
+
+
+ <xs:element minOccurs="0" maxOccurs="1" name="MiscellaneousFiles">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section is used to provide comments and/or list
+ auxiliary files, such as pdb or map files.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Description">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"
+ />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the path and filename location within
+ the ZIP file.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="Executable" type="xs:boolean" default="false"
+ use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ If true, used by installation
+ tools to ensure that a file that must be executable has the
+ correct properties to permit execution.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of Module Surface Area Misc Section -->
+
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="UserExtensions">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section is used for any processing instructions that
+ may be custom to the content provided by the distribution that are common to module.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us"> The content is vendor specific. </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ The content can be plain text as well as any user-defined,
+ properly formatted XML structure.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:attribute name="UserId" type="xs:NCName" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is a single word identifier for grouping
+ similar content. For example, ReferenceBuild might be used to identify non-PI
+ compliant build steps, with two different UserExtensions sections, one with an
+ Identifier of Prebuild, and another of PostBuild. Both UserExtensions sections would
+ use the same UserId.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="Identifier" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This can be any string used to differentiate or
+ identify this section from other UserExtensions sections.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ For example, a PRE_PROCESS Identifier might indicate
+ specific steps and tools required before processing module content, while a
+ different UserExtensions section with a POST_PROCESS Identifier might describe steps
+ that need to be executed after operations on this module.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:anyAttribute processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of Module Surface Area UserExtensions Section -->
+
+ </xs:sequence>
+ <xs:attribute name="BinaryModule" type="xs:boolean" default="false" use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This attribute is used when the binaries are distributed for
+ this module and no code generation from source files is required. If set, then the BinaryFiles
+ section should be used, and any files listed in the SourceFiles section do not have to be built.
+ Additionally, the AsBuilt section for each binary file must be included.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+
+ </xs:element>
+ <!-- End of the ModuleSurfaceArea element. -->
+
+ <xs:element name="Tools">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1" name="Header">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="1" name="Name" type="xs:normalizedString">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the User Interface Name for this Tools
+ Distribution.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="Copyright" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is only required if the Copyright is
+ different from the Distribution Package copyright.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="License" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is only required if the License is
+ different from the Distribution Package license.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="Abstract">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is only required if the Abstract is
+ different from the Distribution Package Abstract.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:normalizedString">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="Description">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is only required if the Description is
+ different from the Distribution Package Description.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the path and filename location within the ZIP file.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="OS" type="SupportedOs" use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is required for tools that execute; it
+ should not be used for configuration files.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="Executable" type="xs:boolean" default="false" use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ If true, used by installation tools to
+ ensure that a file that must be executable has the correct properties to
+ permit execution.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of the Tools element. -->
+
+ <xs:element name="MiscellaneousFiles">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This section contains a list of files that are not part of the code
+ distributed with modules, packages or tools.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1" name="Header">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1" name="Name" type="xs:normalizedString">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The User interface name for this content.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="Copyright" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is only required if the Copyright is
+ different from the Distribution Package Copyright.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="License" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is only required if the License is
+ different from the Distribution Package License.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="1" name="Abstract" type="xs:normalizedString"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Description">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"
+ />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="Filename">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is the path and filename location within the ZIP file.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="Executable" type="xs:boolean" default="false" use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ If true, used by installation tools to
+ ensure that a file that must be executable has the correct properties to
+ permit execution.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- End of the Misc element. -->
+
+ <xs:element name="UserExtensions">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="UserId" type="xs:NCName" use="required">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This is a single word identifier for grouping similar content.
+ For example, ReferenceBuild might be used to identify non-PI compliant build steps, with two
+ different UserExtensions sections, one with an Identifier of Prebuild, and another of PostBuild.
+ Both UserExtensions sections would use the same UserId.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="Identifier" type="xs:string" use="optional">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This can be any string used to differentiate or identify this
+ section from other UserExtensions sections.
+ </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ For example, a PRE_PROCESS Identifier might indicate specific
+ steps and tools required before processing distribution package content, while a different
+ UserExtensions section with a POST_PROCESS Identifier might describe steps that need to be
+ executed after operations on this content.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:anyAttribute processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+ <!-- The following elements are common definitions used with the ref attribute for elements. -->
+
+ <xs:element name="HelpText">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- The following attribute groups are used in various elements above. -->
+
+ <xs:attributeGroup name="SupportedArchMod">
+ <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+ <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+ </xs:attributeGroup>
+
+ <!-- The following data types are used to restrict content. -->
+
+ <xs:simpleType name="ArchListType">
+ <xs:list itemType="ArchTypes"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="ArchTypes">
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="IA32"/>
+ <xs:enumeration value="X64"/>
+ <xs:enumeration value="IPF"/>
+ <xs:enumeration value="EBC"/>
+ <xs:enumeration value="ARM"/>
+ <xs:pattern value="([A-Z])([a-zA-Z0-9])*">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Any processor architecture not listed above. The Architecture
+ must be a target architecture of one or more compiler tool chains.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+
+ <xs:simpleType name="FamilyTypes">
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="MSFT"/>
+ <xs:enumeration value="GCC"/>
+ <xs:pattern value="[A-Z][a-zA-Z0-9]*">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Any other family of build utilities for which compiler tools
+ exist.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="GuidListType">
+ <xs:list itemType="GuidTypes"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="GuidTypes">
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="Event"/>
+ <xs:enumeration value="File"/>
+ <xs:enumeration value="FV"/>
+ <xs:enumeration value="GUID"/>
+ <xs:enumeration value="HII"/>
+ <xs:enumeration value="Hii"/>
+ <xs:enumeration value="HOB"/>
+ <xs:enumeration value="SystemTable"/>
+ <xs:enumeration value="TokenSpaceGuid"/>
+ <xs:enumeration value="Variable"/>
+ <xs:enumeration value="UNDEFINED"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="HexNumber">
+ <xs:restriction base="xs:hexBinary">
+ <xs:pattern value="0x([a-fA-F0-9])+"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="Md5Sum">
+ <xs:restriction base="xs:normalizedString">
+ <xs:pattern value="[a-zA-Z0-9]{32}"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="ModuleListType">
+ <xs:list itemType="ModuleTypes"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="ModuleTypes">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us"> The following module types are defined by specifications. </xs:documentation>
+ <xs:documentation xml:lang="en-us">
+ Module types for components and libraries defined for this distribution
+ mechanism.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="BASE ">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us"> Use of this module is not restricted. </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="DXE_CORE">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This module is only applicable to the DXE core.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="DXE_DRIVER">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This module is only applicable to a DXE driver.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="DXE_RUNTIME_DRIVER">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This module is only applicable to a DXE runtime driver.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="DXE_SAL_DRIVER">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This module is only applicable to an IPF DXE runtime driver.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="DXE_SMM_DRIVER">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This module is only applicable to a DXE SMM driver.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="PEI_CORE">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This module is only applicable to the PEI core.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="PEIM">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us"> This module is only valid for PEI modules. </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="SEC">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This module is only applicable to Security phase.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="UEFI_DRIVER">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us"> This module is only valid for UEFI drivers. </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="UEFI_RUNTIME_DRIVER">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This module is only valid for UEFI runtime
+ drivers.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="UEFI_APPLICATION">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This module is only valid for UEFI applications.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="SMM_CORE">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This module is only applicable to the SMM
+ core.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="USER_DEFINED">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This content is restricted to a specific implementation.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="UNDEFINED">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This enumeration is for use in a list that where the package
+ creator does not know the what module types are supported by a module.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:pattern value="([A-Z])([a-zA-Z0-9])*">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This pattern has been added for use in a module lists - for
+ future expansion.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="PcdDatumTypes">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The following data types are defined by the PCD specification (or PCD
+ section of the UEFI/PI specifications.)
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:normalizedString">
+ <xs:enumeration value="UINT8"/>
+ <xs:enumeration value="UINT16"/>
+ <xs:enumeration value="UINT32"/>
+ <xs:enumeration value="UINT64"/>
+ <xs:enumeration value="BOOLEAN"/>
+ <xs:enumeration value="VOID*"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="PcdItemListType">
+ <xs:list itemType="PcdItemTypes"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="PcdItemTypes">
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="FeaturePcd">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The Feature PCD is a binary, evaluating to either true or false.
+ This is used during build to include/exclude content. It can also be used during execution to
+ force execution paths within drivers, or to enable/disable features within a driver for a given
+ platform.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="FixedPcd">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The Fixed PCD is a #define value that is set at build time.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="PatchPcd">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The Patch PCD is a #define that is set at build time, and that
+ can be modified within a binary file. Additional information, such as the offset location of the
+ value, along with its length may need to be provided.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="Pcd">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ This PCD type has an overloaded definition. Prior to build, the
+ platform integrator may choose to implement a PCD as Fixed, Patchable or a Dynamic PCD. If the
+ platform integrator choose to use the PCD as dynamic, then a PCD driver is required in the
+ platform (PEI/DXE/both) to track the PCD in some sort of 'database' of these items. For Dynamic
+ PCDs, the PcdGet* must pass in the token space guid and the token number to retrieve data
+ (PcdSet* also needs these values.)
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="PcdEx">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The PCD can only be used as Dynamic, and the platform firmware
+ must contain a driver to maintain a 'database' of these items. For Dynamic PCDs, the PcdGet*
+ must pass in the token space guid and the token number to retrieve data (PcdSet* also needs
+ these values.)
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="RegistryFormatGuid">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ A GUID must contain five different Hexadecimal character sets that are
+ separated by a dash (-) character.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:pattern value="\s*[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\s*"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="SupportedOs">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ The EDK II build system supports workstations running one of the
+ following supported operating systems. This is the OS for the developer's workstation, not the target
+ platform.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="Win32">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ For Windows 2003, Windows XP and Windows Vista.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="Win64">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ For Windows 2003, Windows XP and Windows Vista.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="RedHat32"/>
+ <xs:enumeration value="RedHat64"/>
+ <xs:enumeration value="SuSE32"/>
+ <xs:enumeration value="SuSE64"/>
+ <xs:enumeration value="Linux32"/>
+ <xs:enumeration value="Linux64"/>
+ <xs:enumeration value="OS/X32"/>
+ <xs:enumeration value="OS/X64"/>
+ <xs:enumeration value="Generic"/>
+ <xs:enumeration value="GenericWin">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Typically, this is used for Windows Batch files.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="GenericNix">
+ <xs:annotation>
+ <xs:documentation xml:lang="en-us">
+ Typically use for shell scripts - valid for any Linux and Mac
+ OS/X.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:pattern value="[a-zA-Z]([a-zA-Z0-9])*"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+</xs:schema>
diff --git a/roms/edk2/BaseTools/Conf/build_rule.template b/roms/edk2/BaseTools/Conf/build_rule.template
new file mode 100755
index 000000000..c03486991
--- /dev/null
+++ b/roms/edk2/BaseTools/Conf/build_rule.template
@@ -0,0 +1,674 @@
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
+# Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+## Syntax
+#
+# "*" is used to indicate that the source files will be processed at the same time.
+# "?" is used to indicate that the source files will be processed one by one.
+#
+# "[" <File-Type>[.<Build-Type>][.<Arch>][, <File-Type>[.<Build-Type>][.<Arch>]] "]" <EOL>
+# <InputFile[.<ToolChainFamily>]> <EOL>
+# (?|*).<File-Extension> [(\n|,) (?|*).<File-Extension>]
+#
+# <OutputFile[.<ToolChainFamily>]> <EOL>
+# <FileFullPath>
+#
+# <ExtraDependency>
+# <FileFullPath>
+#
+# <Command[.<ToolChainFamily>]> <EOL>
+# <Command1>
+# [<Command2>]
+#
+# <Build-Type> is the MODULE_TYPE in EDK2 or COMPONENT_TYPE in EDK.
+# Missing <InputFile> will cause an exception and break build.
+# Missing <Command> will cause that related build target won't be generated but
+# won't break build.
+#
+
+## Placeholders for string substitution
+#
+# ${src} Source file(s) to be built (full path)
+# ${s_path} Source file directory (absolute path)
+# ${s_dir} Source file relative directory within a module
+# (Note: ${s_dir} is always equals to "." if source file is given in absolute path.)
+# ${s_name} Source file name without path
+# ${s_base} Source file name without extension and path
+# ${s_ext} Source file extension
+#
+# ${dst} Destination file(s) built from ${src} (full path)
+# ${d_path} Destination file directory (absolute path)
+# ${d_name} Destination file name without path
+# ${d_base} Destination file name without extension and path
+# ${d_ext} Destination file extension
+#
+# (+) Directory separator
+#
+
+## Macro
+# $(WORKSPACE) Workspace directory
+# $(OUTPUT_DIR) Directory for intermediate files for building a module
+# $(DEBUG_DIR) Directory for files used to debug a module
+# $(BUILD_DIR) All files for building a platform will be put in this directory
+# $(BIN_DIR) Common directory for executable files
+# $(FV_DIR) Directory to store flash image files
+# $(INC) Search path of current module
+# $(NASM_INC) Search nasm file path of current module
+# $(INC_LIST) A file containing search paths of current module
+# $(LIBS) Static library files of current module
+# $(<tool>_FLAGS) Tools flags of current module
+# $(MODULE_NAME) Current module name
+# $(MODULE_NAME_GUID) Current module name with module FILE_GUID if same $(MODULE_NAME) exists
+# in different modules, otherwise its value is same as $(MODULE_NAME)
+# $(MODULE_TYPE) Current module type
+# $(MODULE_GUID) Current module guid
+# $(ARCH) Architecture of current module
+# $(TOOLCHAIN) Toolchain used to build current module
+# $(TARGET) Target of current module (DEBUG/RELEASE)
+# $(<tool>) Path of tool
+# $(EDK_TOOLS_PATH) Path of build tools
+# $(<FILE_TYPES>) File list of each file type
+# (Note: The macro name is derived from file type name. For example,
+# C-Code-File will have C_CODE_FILES macro.)
+# $(<FILE_TYPES_LIST>) Macro point to a file containing list of files of a file type
+# (
+# Note: The macro and file name are derived from file type name.
+# For example, C-Code-File will have C_CODE_FILES_LIST macro pointing
+# to $(OUTPUT_DIR)/c_code_files.lst. The list file and macro name
+# will be generated only when this macro is used in command line.
+# This is intended to get over the long command line limitation.
+# )
+# $(DEPS_FLAGS) This is a tool flag to have c compiler generate dependent header file list for a source file.
+# To enable incremental build, this flag must apply to $(CC), $(VFRPP), $(PP), $(ASLCC) and $(ASLPP).
+#
+# $(CP) copy command
+# $(MV) move command
+# $(RM) delete command
+# $(MD) create dir command
+# $(RD) remove dir command
+#
+
+## Reserved File-Type
+#
+# Don't change following names of file types and their associated files,
+# which are also used in tools' code
+#
+# C-Code-File
+# C-Header-File
+# Dynamic-Library-File
+# Static-Library-File
+# Visual-Form-Representation-File
+# Unicode-Text-File
+#
+
+## Build Rule Version Number
+# build_rule_version=0.1
+#
+
+[C-Code-File]
+ <InputFile>
+ ?.c
+ ?.C
+ ?.cc
+ ?.CC
+ ?.cpp
+ ?.Cpp
+ ?.CPP
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+
+ <Command.MSFT, Command.INTEL>
+ "$(CC)" /Fo${dst} $(DEPS_FLAGS) $(CC_FLAGS) $(INC) ${src}
+
+ <Command.GCC, Command.RVCT>
+ # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
+ "$(CC)" $(DEPS_FLAGS) $(CC_FLAGS) -c -o ${dst} $(INC) ${src}
+
+ <Command.XCODE>
+ "$(CC)" $(DEPS_FLAGS) $(CC_FLAGS) -o ${dst} $(INC) ${src}
+
+[C-Code-File.BASE.AARCH64,C-Code-File.SEC.AARCH64,C-Code-File.PEI_CORE.AARCH64,C-Code-File.PEIM.AARCH64,C-Code-File.BASE.ARM,C-Code-File.SEC.ARM,C-Code-File.PEI_CORE.ARM,C-Code-File.PEIM.ARM]
+ <InputFile>
+ ?.c
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+
+ <Command.GCC, Command.RVCT>
+ "$(CC)" $(CC_FLAGS) $(CC_XIPFLAGS) -c -o ${dst} $(INC) ${src}
+
+[C-Header-File]
+ <InputFile>
+ *.h, *.H
+
+ <OutputFile>
+
+ <Command>
+
+[Assembly-Code-File.COMMON.COMMON]
+ <InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
+ ?.asm, ?.Asm, ?.ASM
+
+ <InputFile.GCC>
+ ?.S, ?.s
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+
+ <Command.MSFT, Command.INTEL>
+ Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
+ "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
+ Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iiii ${d_path}(+)${s_base}.ii
+ "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iiii
+
+ <Command.GCC, Command.RVCT>
+ Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
+ "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
+ Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iiii ${d_path}(+)${s_base}.ii
+ # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
+ "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iiii
+
+[Assembly-Code-File.COMMON.ARM,Assembly-Code-File.COMMON.AARCH64]
+ # Remove --convert-hex for ARM as it breaks MSFT assemblers
+ <InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
+ ?.asm, ?.Asm, ?.ASM
+
+ <InputFile.GCC>
+ ?.S, ?.s
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+
+ <Command.INTEL>
+ Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
+ "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
+ Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iiii ${d_path}(+)${s_base}.ii
+ "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iiii
+
+ <Command.MSFT>
+ Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
+ "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
+ Trim --source-code --trim-long -o ${d_path}(+)${s_base}.iiii ${d_path}(+)${s_base}.ii
+ "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iiii
+
+ <Command.GCC, Command.RVCT>
+ Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
+ "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
+ Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iiii ${d_path}(+)${s_base}.ii
+ # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
+ "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iiii
+
+[Nasm-Assembly-Code-File.COMMON.COMMON]
+ <InputFile>
+ ?.nasm
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+
+ <Command>
+ Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
+ "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
+ Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii
+ "$(NASM)" -I${s_path}(+) $(NASM_INC) $(NASM_FLAGS) -o $dst ${d_path}(+)${s_base}.iii
+
+[Device-Tree-Source-File]
+ <InputFile>
+ ?.dts
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dtb
+
+ <Command.GCC>
+ "$(DTCPP)" $(DTCPP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
+ "$(DTC)" $(DTC_FLAGS) -I dts -O dtb -o ${dst} ${d_path}(+)${s_base}.i
+
+[Visual-Form-Representation-File]
+ <InputFile>
+ ?.vfr
+ ?.Vfr
+ ?.VFR
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c
+
+ <Command>
+ "$(VFRPP)" $(DEPS_FLAGS) $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_base}.i
+ "$(VFR)" $(VFR_FLAGS) --string-db $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_base}.i
+
+[Object-File]
+ <InputFile>
+ *.obj
+ *.o
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
+
+ <Command.MSFT, Command.INTEL, Command.CLANGPDB>
+ "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} @$(OBJECT_FILES_LIST)
+
+ <Command.GCC>
+ $(RM) ${dst}
+ "$(SLINK)" cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)
+
+ <Command.RVCT>
+ "$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST)
+
+ <Command.RVCTCYGWIN>
+ # $(OBJECT_FILES_LIST) has wrong paths for cygwin
+ "$(SLINK)" $(SLINK_FLAGS) ${dst} $(OBJECT_FILES)
+
+ <Command.XCODE>
+ "$(SLINK)" $(SLINK_FLAGS) ${dst} -filelist $(OBJECT_FILES_LIST)
+
+[Static-Library-File]
+ <InputFile>
+ *.lib
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(DEBUG_DIR)(+)$(MODULE_NAME).dll
+
+ <Command.MSFT, Command.INTEL>
+ "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK2_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
+ "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
+
+ <Command.CLANGPDB>
+ "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
+
+ <Command.GCC>
+ "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(CC_FLAGS) $(DLINK2_FLAGS)
+ "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
+
+ <Command.RVCT>
+ "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
+
+ <Command.RVCTCYGWIN>
+ #$(STATIC_LIBRARY_FILES_LIST) has wrong paths for cygwin
+ "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)
+
+ <Command.XCODE>
+ "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
+
+
+[Static-Library-File.SEC.AARCH64, Static-Library-File.PEI_CORE.AARCH64, Static-Library-File.PEIM.AARCH64,Static-Library-File.SEC.ARM, Static-Library-File.PEI_CORE.ARM, Static-Library-File.PEIM.ARM]
+ <InputFile>
+ *.lib
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(DEBUG_DIR)(+)$(MODULE_NAME).dll
+
+ <Command.GCC>
+ "$(DLINK)" -o ${dst} $(DLINK_FLAGS) $(DLINK_XIPFLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(CC_FLAGS) $(CC_XIPFLAGS) $(DLINK2_FLAGS)
+ "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
+
+
+[Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION]
+ <InputFile>
+ *.lib
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(DEBUG_DIR)(+)$(MODULE_NAME)
+
+ <Command.MSFT, Command.INTEL, Command.CLANGPDB>
+ "$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
+
+ <Command.GCC>
+ "$(DLINK)" $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(DLINK2_FLAGS)
+
+ <Command.RVCT>
+ "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
+
+ <Command.RVCTCYGWIN>
+ #$(STATIC_LIBRARY_FILES_LIST) has the wrong paths for cygwin
+ "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)
+
+ <Command.XCODE>
+ "$(DLINK)" -o ${dst} $(DLINK_FLAGS) $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
+
+
+[Dynamic-Library-File]
+ <InputFile>
+ ?.dll
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
+
+ <Command.MSFT, Command.INTEL, Command.RVCT, Command.CLANGPDB>
+ "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
+ $(CP) ${dst} $(DEBUG_DIR)
+ $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
+ -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
+ -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR)
+ <Command.GCC>
+ $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
+ $(OBJCOPY) --strip-unneeded -R .eh_frame ${src}
+
+ #
+ #The below 2 lines are only needed for UNIXGCC tool chain, which generates PE image directly
+ #
+ -$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}
+ -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug $(BIN_DIR)(+)$(MODULE_NAME_GUID).debug
+
+ "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
+ $(CP) ${dst} $(DEBUG_DIR)
+ $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
+ -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
+
+ <Command.XCODE>
+ # tool to convert Mach-O to PE/COFF
+ "$(MTOC)" -subsystem $(MODULE_TYPE) $(MTOC_FLAGS) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff
+ # create symbol file for GDB debug
+ -$(DSYMUTIL) ${src}
+ "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)
+ $(CP) ${dst} $(DEBUG_DIR)
+ $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
+ -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
+
+[Dependency-Expression-File]
+ <InputFile>
+ ?.dxs, ?.Dxs, ?.DXS
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)$(MODULE_NAME).depex
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <Command>
+ "$(PP)" $(DEPS_FLAGS) $(APP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
+ Trim --source-code -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
+ GenDepex -t $(MODULE_TYPE) -o ${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
+
+[Acpi-Source-Language-File]
+ <InputFile>
+ ?.asl, ?.Asl, ?.ASL
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml
+ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.amli
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <Command.MSFT, Command.INTEL>
+ Trim --asl-file --asl-deps -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
+ "$(ASLPP)" $(DEPS_FLAGS) $(ASLPP_FLAGS) $(INC) /I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
+ Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
+ "$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii
+ $(CP) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.amli
+
+ <Command.GCC>
+ Trim --asl-file --asl-deps -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
+ "$(ASLPP)" $(DEPS_FLAGS) $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
+ Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
+ "$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii
+ $(CP) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.amli
+
+[Acpi-Machine-Language-File-to-C.DXE_DRIVER]
+ <InputFile>
+ ?.amli
+
+ <OutputFile>
+ ${s_path}(+)${s_base}.c
+
+ <Command>
+ -AmlToC ${src}
+
+[C-Code-File.AcpiTable]
+ <InputFile>
+ ?.c
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.acpi
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <Command.MSFT, Command.INTEL>
+ "$(ASLCC)" $(DEPS_FLAGS) /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASLCC_FLAGS) $(DEPS_FLAGS) $(INC) ${src}
+ "$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+ "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
+
+ <Command.GCC>
+ "$(ASLCC)" $(DEPS_FLAGS) -c -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(DEPS_FLAGS) $(INC) ${src}
+ "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+ "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
+
+[Acpi-Table-Code-File]
+ <InputFile>
+ ?.aslc, ?.act
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.acpi
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <Command.MSFT, Command.INTEL>
+ "$(ASLCC)" $(DEPS_FLAGS) /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASLCC_FLAGS) $(DEPS_FLAGS) $(INC) ${src}
+ "$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+ "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
+
+ <Command.GCC>
+ "$(ASLCC)" $(DEPS_FLAGS) -c -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(DEPS_FLAGS) $(INC) ${src}
+ "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS)
+ "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
+
+ <Command.CLANGPDB>
+ "$(ASLCC)" $(DEPS_FLAGS) -c -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(DEPS_FLAGS) $(INC) ${src}
+ "$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+ "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
+
+ <Command.XCODE>
+ "$(ASLCC)" $(DEPS_FLAGS) -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASLCC_FLAGS) $(DEPS_FLAGS) $(INC) ${src}
+ "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+ "$(MTOC)" -subsystem $(MODULE_TYPE) $(MTOC_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.pecoff
+ "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.pecoff $(GENFW_FLAGS)
+
+
+[Masm16-Code-File]
+ <InputFile>
+ ?.asm16, ?.Asm16, ?.ASM16, ?.s16, ?.S16
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_base}.com
+
+ <Command.MSFT, Command.INTEL>
+ Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
+ "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
+ Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii
+ cd $(OUTPUT_DIR)(+)${s_dir}
+ "$(ASM16)" /nologo /c /omf $(INC) /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${d_path}(+)${s_base}.iii
+ "$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,
+
+ <Command.GCC>
+ Trim --asm-file -o {d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
+ "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
+ Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii
+ "$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
+ "$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) $(LIBS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj --end-group
+
+ <Command.XCODE>
+ Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
+ "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
+ Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii
+ "$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
+ "$(SLINK)" $(SLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.slib $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+ otool -t $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.slib | hex2bin.py ${dst}
+
+
+[Nasm-to-Binary-Code-File]
+ <InputFile>
+ ?.nasmb
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_base}.bin
+
+ <Command>
+ Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
+ "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
+ Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii
+ "$(NASM)" -I${s_path}(+) -l ${d_path}(+)${s_base}.lst $(NASMB_FLAGS) $(NASM_INC) -o $dst ${d_path}(+)${s_base}.iii
+ # copy the output file with .com postfix that be same to the output file of .asm16
+ $(CP) ${dst} $(OUTPUT_DIR)(+)${s_base}.com
+
+[Microcode-File.USER_DEFINED, Microcode-File.Microcode]
+ <InputFile>
+ ?.txt, ?.TXT, ?.Txt, ?.mut, ?.inc
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_base}.mcb
+
+ <Command>
+ "$(GENFW)" -o ${dst} -m ${src} $(GENFW_FLAGS)
+
+[Microcode-Binary-File]
+ <InputFile>
+ *.mcb
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)$(MODULE_NAME).bin
+
+ <Command>
+ "$(GENFW)" -o ${dst} -j $(MICROCODE_BINARY_FILES) $(GENFW_FLAGS)
+ -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).bin
+
+[EFI-Image-File]
+ <InputFile>
+ ?.efi, ?.Efi, ?.EFI
+
+ <OutputFile>
+
+ <Command>
+
+[Unicode-Text-File]
+ <InputFile>
+ *.uni, *.Uni, *.UNI
+
+ <OutputFile>
+ $(DEBUG_DIR)(+)AutoGen.c
+ $(DEBUG_DIR)(+)$(MODULE_NAME)StrDefs.h
+ $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk
+
+ <Command>
+
+[Image-Definition-File]
+ <InputFile>
+ *.idf, *.Idf, *.IDF
+
+ <OutputFile>
+ $(DEBUG_DIR)(+)AutoGen.c
+ $(DEBUG_DIR)(+)$(MODULE_NAME)ImgDefs.h
+ $(OUTPUT_DIR)(+)$(MODULE_NAME)Idf.hpk
+
+ <Command>
+
+[Efi-Image.UEFI_OPTIONROM]
+ <InputFile>
+ ?.efi, ?.EFI, ?.Efi
+
+ <OutputFile>
+ $(BIN_DIR)(+)$(MODULE_NAME_GUID).rom
+
+ <Command>
+ $(OPTROM) -i $(PCI_DEVICE_ID) -f $(PCI_VENDOR_ID) -l $(PCI_CLASS_CODE) -r $(PCI_REVISION) -o $dst $(OPTROM_FLAGS) $src
+
+[Unicode-Text-File.UEFI_HII]
+ <InputFile>
+ *.uni, *.Uni, *.UNI
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk
+ $(DEBUG_DIR)(+)$(MODULE_NAME)StrDefs.h
+
+ <Command>
+
+[Image-Definition-File.UEFI_HII]
+ <InputFile>
+ *.idf, *.Idf, *.IDF
+
+ <OutputFile>
+ $(DEBUG_DIR)(+)$(MODULE_NAME)ImgDefs.h
+ $(OUTPUT_DIR)(+)$(MODULE_NAME)Idf.hpk
+
+ <Command>
+
+[Visual-Form-Representation-File.UEFI_HII]
+ <InputFile>
+ ?.vfr
+ ?.Vfr
+ ?.VFR
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.hpk
+
+ <Command>
+ "$(VFRPP)" $(DEPS_FLAGS) $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
+ "$(VFR)" $(VFR_FLAGS) --create-ifr-package --string-db $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk --output-directory $(OUTPUT_DIR)(+)${s_dir} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
+
+[Hii-Binary-Package.UEFI_HII]
+ <InputFile>
+ *.hpk
+
+ <OutputFile.MSFT, OutputFile.INTEL, OutputFile.GCC, OutputFile.CLANGPDB>
+ $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.lib
+
+ <OutputFile.XCODE, OutputFile.RVCT>
+ $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc
+
+ <Command.MSFT, Command.INTEL, Command.CLANGPDB>
+ "$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiipackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
+ "$(RC)" /Fo${dst} $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc
+
+ <Command.GCC>
+ "$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
+ "$(RC)" $(RC_FLAGS) $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc ${dst}
+
+ <Command.XCODE, Command.RVCT>
+ GenFw -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES)
diff --git a/roms/edk2/BaseTools/Conf/diff.order b/roms/edk2/BaseTools/Conf/diff.order
new file mode 100644
index 000000000..f1534f6c1
--- /dev/null
+++ b/roms/edk2/BaseTools/Conf/diff.order
@@ -0,0 +1,13 @@
+#
+# Copyright (c) 2019, Linaro Ltd. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+*.dec
+*.dsc.inc
+*.dsc
+*.fdf
+*.inf
+*.h
+*.vfr
+*.c
diff --git a/roms/edk2/BaseTools/Conf/gitattributes b/roms/edk2/BaseTools/Conf/gitattributes
new file mode 100644
index 000000000..319e89064
--- /dev/null
+++ b/roms/edk2/BaseTools/Conf/gitattributes
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 2019, Linaro Ltd. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+*.efi -diff
+*.EFI -diff
+*.bin -diff
+*.BIN -diff
+*.raw -diff
+*.RAW -diff
+*.bmp -diff
+*.BMP -diff
+*.dec diff=ini
+*.dsc diff=ini
+*.dsc.inc diff=ini
+*.fdf diff=ini
+*.fdf.inc diff=ini
+*.inf diff=ini
+*.c diff=cpp
+*.C diff=cpp
+*.cc diff=cpp
+*.CC diff=cpp
+*.cpp diff=cpp
+*.Cpp diff=cpp
+*.CPP diff=cpp
+*.aslc diff=cpp
+*.act diff=cpp
+*.h diff=cpp
+*.H diff=cpp
diff --git a/roms/edk2/BaseTools/Conf/target.template b/roms/edk2/BaseTools/Conf/target.template
new file mode 100644
index 000000000..d4a3b53b7
--- /dev/null
+++ b/roms/edk2/BaseTools/Conf/target.template
@@ -0,0 +1,70 @@
+#
+# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+# ALL Paths are Relative to WORKSPACE
+
+# Separate multiple LIST entries with a SINGLE SPACE character, do not use comma characters.
+# Un-set an option by either commenting out the line, or not setting a value.
+
+#
+# PROPERTY Type Use Description
+# ---------------- -------- -------- -----------------------------------------------------------
+# ACTIVE_PLATFORM Filename Recommended Specify the WORKSPACE relative Path and Filename
+# of the platform description file that will be used for the
+# build. This line is required if and only if the current
+# working directory does not contain one or more description
+# files.
+ACTIVE_PLATFORM = EmulatorPkg/EmulatorPkg.dsc
+
+# TARGET List Optional Zero or more of the following: DEBUG, RELEASE, NOOPT
+# UserDefined; separated by a space character.
+# If the line is missing or no value is specified, all
+# valid targets specified in the platform description file
+# will attempt to be built. The following line will build
+# DEBUG platform target.
+TARGET = DEBUG
+
+# TARGET_ARCH List Optional What kind of architecture is the binary being target for.
+# One, or more, of the following, IA32, IPF, X64, EBC, ARM
+# or AArch64.
+# Multiple values can be specified on a single line, using
+# space characters to separate the values. These are used
+# during the parsing of a platform description file,
+# restricting the build output target(s.)
+# The Build Target ARCH is determined by (precedence high to low):
+# Command-line: -a ARCH option
+# target.txt: TARGET_ARCH values
+# DSC file: [Defines] SUPPORTED_ARCHITECTURES tag
+# If not specified, then all valid architectures specified
+# in the platform file, for which tools are available, will be
+# built.
+TARGET_ARCH = IA32
+
+# TOOL_DEFINITION_FILE Filename Optional Specify the name of the filename to use for specifying
+# the tools to use for the build. If not specified,
+# WORKSPACE/Conf/tools_def.txt will be used for the build.
+TOOL_CHAIN_CONF = Conf/tools_def.txt
+
+# TAGNAME List Optional Specify the name(s) of the tools_def.txt TagName to use.
+# If not specified, all applicable TagName tools will be
+# used for the build. The list uses space character separation.
+TOOL_CHAIN_TAG = VS2015x86
+
+# MAX_CONCURRENT_THREAD_NUMBER NUMBER Optional The number of concurrent threads. If not specified or set
+# to zero, tool automatically detect number of processor
+# threads. Recommend to set this value to one less than the
+# number of your computer cores or CPUs. When value set to 1,
+# means disable multi-thread build, value set to more than 1,
+# means user specify the thread number to build. Not specify
+# the default value in this file.
+# MAX_CONCURRENT_THREAD_NUMBER = 1
+
+
+# BUILD_RULE_CONF Filename Optional Specify the file name to use for the build rules that are followed
+# when generating Makefiles. If not specified, the file:
+# WORKSPACE/Conf/build_rule.txt will be used
+BUILD_RULE_CONF = Conf/build_rule.txt
+
diff --git a/roms/edk2/BaseTools/Conf/tools_def.template b/roms/edk2/BaseTools/Conf/tools_def.template
new file mode 100755
index 000000000..933b3160f
--- /dev/null
+++ b/roms/edk2/BaseTools/Conf/tools_def.template
@@ -0,0 +1,3214 @@
+#
+# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+# Portions copyright (c) 2011 - 2019, ARM Ltd. All rights reserved.<BR>
+# Copyright (c) 2015, Hewlett-Packard Development Company, L.P.<BR>
+# (C) Copyright 2020, Hewlett Packard Enterprise Development LP<BR>
+# Copyright (c) Microsoft Corporation
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+# Increase this version tag any time you want user to get warning about updating this
+# file in the Conf dir. By default it does not do update existing conf dirs.
+#
+# 2.00 - Initial version with changes for CI
+# - Change RC path to use plugin
+#
+#!VERSION=2.00
+
+IDENTIFIER = Default TOOL_CHAIN_CONF
+
+# common path macros
+DEFINE VS2008_BIN = ENV(VS2008_PREFIX)Vc\bin
+DEFINE VS2008_DLL = ENV(VS2008_PREFIX)Common7\IDE;DEF(VS2008_BIN)
+DEFINE VS2008_BINX64 = DEF(VS2008_BIN)\x86_amd64
+DEFINE VS2008_BIN64 = DEF(VS2008_BIN)\x86_ia64
+
+DEFINE VS2008x86_BIN = ENV(VS2008_PREFIX)Vc\bin
+DEFINE VS2008x86_DLL = ENV(VS2008_PREFIX)Common7\IDE;DEF(VS2008x86_BIN)
+DEFINE VS2008x86_BINX64 = DEF(VS2008x86_BIN)\x86_amd64
+DEFINE VS2008x86_BIN64 = DEF(VS2008x86_BIN)\x86_ia64
+
+DEFINE VS2010_BIN = ENV(VS2010_PREFIX)Vc\bin
+DEFINE VS2010_DLL = ENV(VS2010_PREFIX)Common7\IDE;DEF(VS2010_BIN)
+DEFINE VS2010_BINX64 = DEF(VS2010_BIN)\x86_amd64
+DEFINE VS2010_BIN64 = DEF(VS2010_BIN)\x86_ia64
+
+DEFINE VS2010x86_BIN = ENV(VS2010_PREFIX)Vc\bin
+DEFINE VS2010x86_DLL = ENV(VS2010_PREFIX)Common7\IDE;DEF(VS2010x86_BIN)
+DEFINE VS2010x86_BINX64 = DEF(VS2010x86_BIN)\x86_amd64
+DEFINE VS2010x86_BIN64 = DEF(VS2010x86_BIN)\x86_ia64
+
+DEFINE VS2012_BIN = ENV(VS2012_PREFIX)Vc\bin
+DEFINE VS2012_DLL = ENV(VS2012_PREFIX)Common7\IDE;DEF(VS2012_BIN)
+DEFINE VS2012_BINX64 = DEF(VS2012_BIN)\x86_amd64
+
+DEFINE VS2012x86_BIN = ENV(VS2012_PREFIX)Vc\bin
+DEFINE VS2012x86_DLL = ENV(VS2012_PREFIX)Common7\IDE;DEF(VS2012x86_BIN)
+DEFINE VS2012x86_BINX64 = DEF(VS2012x86_BIN)\x86_amd64
+
+DEFINE VS2013_BIN = ENV(VS2013_PREFIX)Vc\bin
+DEFINE VS2013_DLL = ENV(VS2013_PREFIX)Common7\IDE;DEF(VS2013_BIN)
+DEFINE VS2013_BINX64 = DEF(VS2013_BIN)\x86_amd64
+
+DEFINE VS2013x86_BIN = ENV(VS2013_PREFIX)Vc\bin
+DEFINE VS2013x86_DLL = ENV(VS2013_PREFIX)Common7\IDE;DEF(VS2013x86_BIN)
+DEFINE VS2013x86_BINX64 = DEF(VS2013x86_BIN)\x86_amd64
+
+DEFINE VS2015_BIN = ENV(VS2015_PREFIX)Vc\bin
+DEFINE VS2015_DLL = ENV(VS2015_PREFIX)Common7\IDE;DEF(VS2015_BIN)
+DEFINE VS2015_BINX64 = DEF(VS2015_BIN)\x86_amd64
+
+DEFINE VS2015x86_BIN = ENV(VS2015_PREFIX)Vc\bin
+DEFINE VS2015x86_DLL = ENV(VS2015_PREFIX)Common7\IDE;DEF(VS2015x86_BIN)
+DEFINE VS2015x86_BINX64 = DEF(VS2015x86_BIN)\x86_amd64
+
+DEFINE VS_HOST = x86
+
+DEFINE VS2017_BIN = ENV(VS2017_PREFIX)bin
+DEFINE VS2017_BIN_HOST = DEF(VS2017_BIN)\HostDEF(VS_HOST)\DEF(VS_HOST)
+DEFINE VS2017_BIN_IA32 = DEF(VS2017_BIN)\HostDEF(VS_HOST)\x86
+DEFINE VS2017_BIN_X64 = DEF(VS2017_BIN)\HostDEF(VS_HOST)\x64
+DEFINE VS2017_BIN_ARM = DEF(VS2017_BIN)\HostDEF(VS_HOST)\arm
+DEFINE VS2017_BIN_AARCH64 = DEF(VS2017_BIN)\HostDEF(VS_HOST)\arm64
+
+DEFINE VS2019_BIN = ENV(VS2019_PREFIX)bin
+DEFINE VS2019_BIN_HOST = DEF(VS2019_BIN)\HostDEF(VS_HOST)\DEF(VS_HOST)
+DEFINE VS2019_BIN_IA32 = DEF(VS2019_BIN)\HostDEF(VS_HOST)\x86
+DEFINE VS2019_BIN_X64 = DEF(VS2019_BIN)\HostDEF(VS_HOST)\x64
+DEFINE VS2019_BIN_ARM = DEF(VS2019_BIN)\HostDEF(VS_HOST)\arm
+DEFINE VS2019_BIN_AARCH64 = DEF(VS2019_BIN)\HostDEF(VS_HOST)\arm64
+
+#
+# Resource compiler
+#
+DEFINE RC_PATH = ENV(WINSDK_PATH_FOR_RC_EXE)\rc.exe
+
+DEFINE WINSDK_BIN = ENV(WINSDK_PREFIX)
+DEFINE WINSDKx86_BIN = ENV(WINSDKx86_PREFIX)
+
+# Microsoft Visual Studio 2010
+DEFINE WINSDK7_BIN = ENV(WINSDK7_PREFIX)
+DEFINE WINSDK7x86_BIN = ENV(WINSDK7x86_PREFIX)
+
+# Microsoft Visual Studio 2012 Update 1 (required for rc.exe that was not included in the initial release)
+DEFINE WINSDK71_BIN = ENV(WINSDK71_PREFIX)
+DEFINE WINSDK71x86_BIN = ENV(WINSDK71x86_PREFIX)
+
+# Microsoft Visual Studio 2013 Professional Edition
+DEFINE WINSDK8_BIN = ENV(WINSDK8_PREFIX)x86\
+DEFINE WINSDK8x86_BIN = ENV(WINSDK8x86_PREFIX)x64
+
+# Microsoft Visual Studio 2015 Professional Edition
+DEFINE WINSDK81_BIN = ENV(WINSDK81_PREFIX)x86\
+DEFINE WINSDK81x86_BIN = ENV(WINSDK81x86_PREFIX)x64
+
+# Microsoft Visual Studio 2017/2019 Professional Edition
+DEFINE WINSDK10_BIN = ENV(WINSDK10_PREFIX)DEF(VS_HOST)
+
+# These defines are needed for certain Microsoft Visual Studio tools that
+# are used by other toolchains. An example is that ICC on Windows normally
+# uses Microsoft's nmake.exe.
+
+# Some MS_VS_BIN options: DEF(VS2008_BIN), DEF(VS2008x86_BIN)
+DEFINE MS_VS_BIN = DEF(VS2008_BIN)
+# Some MS_VS_DLL options: DEF(VS2008_DLL), DEF(VS2008x86_DLL)
+DEFINE MS_VS_DLL = DEF(VS2008_DLL)
+
+DEFINE WINDDK_BIN16 = ENV(WINDDK3790_PREFIX)bin16
+DEFINE WINDDK_BINX64 = ENV(WINDDK3790_PREFIX)win64\x86\amd64
+
+DEFINE EBC_BIN = C:\Program Files\Intel\EBC\Bin
+DEFINE EBC_BINx86 = C:\Program Files (x86)\Intel\EBC\Bin
+
+
+DEFINE CYGWIN_BIN = c:/cygwin/bin
+DEFINE CYGWIN_BINIA32 = c:/cygwin/opt/tiano/i386-tiano-pe/i386-tiano-pe/bin/
+DEFINE CYGWIN_BINX64 = c:/cygwin/opt/tiano/x86_64-pc-mingw64/x86_64-pc-mingw64/bin/
+
+DEFINE GCC48_IA32_PREFIX = ENV(GCC48_BIN)
+DEFINE GCC48_X64_PREFIX = ENV(GCC48_BIN)
+
+DEFINE GCC49_IA32_PREFIX = ENV(GCC49_BIN)
+DEFINE GCC49_X64_PREFIX = ENV(GCC49_BIN)
+
+DEFINE GCC5_IA32_PREFIX = ENV(GCC5_BIN)
+DEFINE GCC5_X64_PREFIX = ENV(GCC5_BIN)
+DEFINE GCC_HOST_PREFIX = ENV(GCC_HOST_BIN)
+
+DEFINE UNIX_IASL_BIN = ENV(IASL_PREFIX)iasl
+DEFINE WIN_IASL_BIN = ENV(IASL_PREFIX)iasl.exe
+
+DEFINE IASL_FLAGS =
+DEFINE IASL_OUTFLAGS = -p
+
+DEFINE DEFAULT_WIN_ASL_BIN = DEF(WIN_IASL_BIN)
+DEFINE DEFAULT_WIN_ASL_FLAGS = DEF(IASL_FLAGS)
+DEFINE DEFAULT_WIN_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+
+# MSFT Build Flag for included header file list generation
+DEFINE MSFT_DEPS_FLAGS = /showIncludes
+
+DEFINE MSFT_ASLPP_FLAGS = /nologo /E /C /FIAutoGen.h
+DEFINE MSFT_ASLCC_FLAGS = /nologo /c /FIAutoGen.h /TC /Dmain=ReferenceAcpiTable
+DEFINE MSFT_ASLDLINK_FLAGS = /NODEFAULTLIB /ENTRY:ReferenceAcpiTable /SUBSYSTEM:CONSOLE
+
+DEFINE IPHONE_TOOLS = /Developer/Platforms/iPhoneOS.platform/Developer
+
+DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G++ Lite/bin
+
+DEFINE DTCPP_BIN = ENV(DTCPP_PREFIX)cpp
+DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
+
+####################################################################################
+#
+# format: TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE = <string>
+# priority:
+# TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE (Highest)
+# ******_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE
+# TARGET_*********_ARCH_COMMANDTYPE_ATTRIBUTE
+# ******_*********_ARCH_COMMANDTYPE_ATTRIBUTE
+# TARGET_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE
+# ******_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE
+# TARGET_*********_****_COMMANDTYPE_ATTRIBUTE
+# ******_*********_****_COMMANDTYPE_ATTRIBUTE
+# TARGET_TOOLCHAIN_ARCH_***********_ATTRIBUTE
+# ******_TOOLCHAIN_ARCH_***********_ATTRIBUTE
+# TARGET_*********_ARCH_***********_ATTRIBUTE
+# ******_*********_ARCH_***********_ATTRIBUTE
+# TARGET_TOOLCHAIN_****_***********_ATTRIBUTE
+# ******_TOOLCHAIN_****_***********_ATTRIBUTE
+# TARGET_*********_****_***********_ATTRIBUTE
+# ******_*********_****_***********_ATTRIBUTE (Lowest)
+#
+####################################################################################
+####################################################################################
+#
+# Supported Tool Chains
+# =====================
+# VS2008 -win32- Requires:
+# Microsoft Visual Studio 2008 Team Suite Edition
+# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
+# Optional:
+# Required to build EBC drivers:
+# Intel(r) Compiler for Efi Byte Code (Intel(r) EBC Compiler)
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler (iasl.exe) from
+# https://acpica.org/downloads
+# VS2010 -win32- Requires:
+# Microsoft Visual Studio 2010 Premium Edition
+# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
+# Optional:
+# Required to build EBC drivers:
+# Intel(r) Compiler for Efi Byte Code (Intel(r) EBC Compiler)
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler (iasl.exe) from
+# https://acpica.org/downloads
+# VS2012 -win32- Requires:
+# Microsoft Visual Studio 2012 Professional Edition
+# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
+# Optional:
+# Required to build EBC drivers:
+# Intel(r) Compiler for Efi Byte Code (Intel(r) EBC Compiler)
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler (iasl.exe) from
+# https://acpica.org/downloads
+# VS2013 -win32- Requires:
+# Microsoft Visual Studio 2013 Professional Edition
+# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
+# Optional:
+# Required to build EBC drivers:
+# Intel(r) Compiler for Efi Byte Code (Intel(r) EBC Compiler)
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler (iasl.exe) from
+# https://acpica.org/downloads
+# VS2015 -win32- Requires:
+# Microsoft Visual Studio 2015 Professional Edition
+# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
+# Optional:
+# Required to build EBC drivers:
+# Intel(r) Compiler for Efi Byte Code (Intel(r) EBC Compiler)
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler (iasl.exe) from
+# https://acpica.org/downloads
+# VS2017 -win32- Requires:
+# Microsoft Visual Studio 2017 version 15.2 (15.4 for ARM64) or later
+# Optional:
+# Required to build EBC drivers:
+# Intel(r) Compiler for Efi Byte Code (Intel(r) EBC Compiler)
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler (iasl.exe) from
+# https://acpica.org/downloads
+# Note:
+# Building of XIP firmware images for ARM/ARM64 is not currently supported (only applications).
+# /FILEALIGN:4096 and other changes are needed for ARM firmware builds.
+# VS2019 -win32- Requires:
+# Microsoft Visual Studio 2019 version 16.2 or later
+# Optional:
+# Required to build EBC drivers:
+# Intel(r) Compiler for Efi Byte Code (Intel(r) EBC Compiler)
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler (iasl.exe) from
+# https://acpica.org/downloads
+# Note:
+# Building of XIP firmware images for ARM/ARM64 is not currently supported (only applications).
+# /FILEALIGN:4096 and other changes are needed for ARM firmware builds.
+# GCC48 -Linux,Windows- Requires:
+# GCC 4.8 targeting x86_64-linux-gnu, aarch64-linux-gnu, or arm-linux-gnueabi
+# Optional:
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler from
+# https://acpica.org/downloads
+# GCC49 -Linux,Windows- Requires:
+# GCC 4.9 targeting x86_64-linux-gnu, aarch64-linux-gnu, or arm-linux-gnueabi
+# Optional:
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler from
+# https://acpica.org/downloads
+# GCC5 -Linux,Windows- Requires:
+# GCC 5 with LTO support, targeting x86_64-linux-gnu, aarch64-linux-gnu, arm-linux-gnueabi or riscv64-linux-gnu
+# Optional:
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler from
+# https://acpica.org/downloads
+#
+# CLANG35 -Linux,Windows- Requires:
+# Clang v3.5 or later, and GNU binutils targeting aarch64-linux-gnu or arm-linux-gnueabi
+# Optional:
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler from
+# https://acpica.org/downloads
+# CLANG38 -Linux- Requires:
+# Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi
+# Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi
+# Optional:
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler from
+# https://acpica.org/downloads
+# CLANGPDB -Linux, Windows, Mac- Requires:
+# Clang 9 or above from http://releases.llvm.org/
+# Optional:
+# Required to compile nasm source:
+# nasm compiler from
+# NASM -- http://www.nasm.us/
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler from
+# https://acpica.org/downloads
+# VS2008x86 -win64- Requires:
+# Microsoft Visual Studio 2008 (x86)
+# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
+# Optional:
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler (iasl.exe) from
+# https://acpica.org/downloads
+# VS2010x86 -win64- Requires:
+# Microsoft Visual Studio 2010 (x86) Premium Edition
+# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
+# Optional:
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler (iasl.exe) from
+# https://acpica.org/downloads
+# VS2012x86 -win64- Requires:
+# Microsoft Visual Studio 2012 (x86) Professional Edition
+# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
+# Optional:
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler (iasl.exe) from
+# https://acpica.org/downloads
+# VS2013x86 -win64- Requires:
+# Microsoft Visual Studio 2013 (x86) Professional Edition
+# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
+# Optional:
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler (iasl.exe) from
+# https://acpica.org/downloads
+# VS2015x86 -win64- Requires:
+# Microsoft Visual Studio 2015 (x86) Update 2 or above
+# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
+# Optional:
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler (iasl.exe) from
+# https://acpica.org/downloads
+# RVCT -win- Requires:
+# ARM C/C++ Compiler, 5.00
+# Optional:
+# Required to build EBC drivers:
+# Intel(r) Compiler for Efi Byte Code (Intel(r) EBC Compiler)
+# Required to build platforms or ACPI tables:
+# Microsoft ASL ACPI Compiler (asl.exe) v4.0.0 from
+# http://download.microsoft.com/download/2/c/1/2c16c7e0-96c1-40f5-81fc-3e4bf7b65496/microsoft_asl_compiler-v4-0-0.msi
+# Notes: Since this tool chain is obsolete, it doesn't enable the compiler option for included header file list generation,
+# and lose the incremental build capability.
+# RVCTLINUX -unix- Requires:
+# ARM C/C++ Compiler, 5.00
+# Optional:
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler from
+# https://acpica.org/downloads
+# Notes: Since this tool chain is obsolete, it doesn't enable the compiler option for included header file list generation,
+# and lose the incremental build capability.
+# * Commented out - All versions of VS2005 use the same standard install directory
+#
+####################################################################################
+####################################################################################
+#
+# Supported Tool Chain Family
+# ===========================
+# MSFT - Microsoft
+# GCC - GNU GCC
+# INTEL - INTEL
+# RVCT - ARM RealView Toolchain
+####################################################################################
+####################################################################################
+#
+# Other Supported Tools
+# =====================
+# NASM -- http://www.nasm.us/
+# - NASM 2.10 or later for use with the GCC toolchain family
+# - NASM 2.12.01 or later for use with all other toolchain families
+#
+####################################################################################
+####################################################################################
+#
+# Intel EFI Byte Code Compiler (Template)
+#
+####################################################################################
+# *_*_EBC_*_FAMILY = INTEL
+#
+# *_*_EBC_PP_PATH = C:\Program Files\Intel\EBC\Bin\iec.exe
+# *_*_EBC_CC_PATH = C:\Program Files\Intel\EBC\Bin\iec.exe
+# *_*_EBC_SLINK_PATH = C:\Program Files\Intel\EBC\Bin\link.exe
+#
+# *_*_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
+# *_*_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+# *_*_EBC_CC_FLAGS = /nologo /FAcs /c /W3 /WX /FIAutoGen.h
+# *_*_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /MACHINE:EBC /OPT:REF /NODEFAULTLIB /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /ALIGN:32 /DRIVER
+#
+####################################################################################
+#
+# Intel ACPI Source Language Compiler (Template)
+#
+####################################################################################
+# *_*_*_ASL_FAMILY = INTEL
+#
+# *_*_*_ASL_PATH = C:\ASL\iasl.exe
+#
+####################################################################################
+#
+# Microsoft ACPI Source Language Compiler (Template)
+#
+####################################################################################
+# *_*_*_ASL_FAMILY = MSFT
+#
+# *_*_*_ASL_PATH = C:\ASL\asl.exe
+#
+####################################################################################
+
+####################################################################################
+#
+# Microsoft Visual Studio 2008
+#
+# VS2008 - Microsoft Visual Studio 2005 All Edition, including Standard, Professional, Express, TeamSuite
+# ASL - Intel ACPI Source Language Compiler
+####################################################################################
+# VS2008 - Microsoft Visual Studio 2008 ALL Edition, including Standard, Professional, Express, TeamSuite
+*_VS2008_*_*_FAMILY = MSFT
+
+*_VS2008_*_MAKE_PATH = DEF(VS2008_BIN)\nmake.exe
+*_VS2008_*_MAKE_FLAGS = /nologo
+*_VS2008_*_RC_PATH = DEF(WINSDK_BIN)\rc.exe
+
+*_VS2008_*_SLINK_FLAGS = /NOLOGO /LTCG
+*_VS2008_*_APP_FLAGS = /nologo /E /TC
+*_VS2008_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2008_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2008_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS)
+*_VS2008_*_ASM16_PATH = DEF(VS2008_BIN)\ml.exe
+
+##################
+# ASL definitions
+##################
+*_VS2008_*_ASL_PATH = DEF(DEFAULT_WIN_ASL_BIN)
+*_VS2008_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_VS2008_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_VS2008_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
+*_VS2008_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
+*_VS2008_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+##################
+# IA32 definitions
+##################
+*_VS2008_IA32_*_DLL = DEF(VS2008_DLL)
+
+*_VS2008_IA32_MAKE_PATH = DEF(VS2008_BIN)\nmake.exe
+*_VS2008_IA32_CC_PATH = DEF(VS2008_BIN)\cl.exe
+*_VS2008_IA32_VFRPP_PATH = DEF(VS2008_BIN)\cl.exe
+*_VS2008_IA32_SLINK_PATH = DEF(VS2008_BIN)\lib.exe
+*_VS2008_IA32_DLINK_PATH = DEF(VS2008_BIN)\link.exe
+*_VS2008_IA32_APP_PATH = DEF(VS2008_BIN)\cl.exe
+*_VS2008_IA32_PP_PATH = DEF(VS2008_BIN)\cl.exe
+*_VS2008_IA32_ASM_PATH = DEF(VS2008_BIN)\ml.exe
+*_VS2008_IA32_ASLCC_PATH = DEF(VS2008_BIN)\cl.exe
+*_VS2008_IA32_ASLPP_PATH = DEF(VS2008_BIN)\cl.exe
+*_VS2008_IA32_ASLDLINK_PATH = DEF(VS2008_BIN)\link.exe
+
+ *_VS2008_IA32_MAKE_FLAGS = /nologo
+ DEBUG_VS2008_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm
+RELEASE_VS2008_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF
+NOOPT_VS2008_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm /Od
+
+ DEBUG_VS2008_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+RELEASE_VS2008_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
+NOOPT_VS2008_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+
+ DEBUG_VS2008_IA32_NASM_FLAGS = -Ox -f win32 -g
+RELEASE_VS2008_IA32_NASM_FLAGS = -Ox -f win32
+NOOPT_VS2008_IA32_NASM_FLAGS = -O0 -f win32 -g
+
+ DEBUG_VS2008_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2008_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2008_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# X64 definitions
+##################
+*_VS2008_X64_*_DLL = DEF(VS2008_DLL)
+
+*_VS2008_X64_CC_PATH = DEF(VS2008_BINX64)\cl.exe
+*_VS2008_X64_PP_PATH = DEF(VS2008_BINX64)\cl.exe
+*_VS2008_X64_APP_PATH = DEF(VS2008_BINX64)\cl.exe
+*_VS2008_X64_VFRPP_PATH = DEF(VS2008_BINX64)\cl.exe
+*_VS2008_X64_ASM_PATH = DEF(VS2008_BINX64)\ml64.exe
+*_VS2008_X64_SLINK_PATH = DEF(VS2008_BINX64)\lib.exe
+*_VS2008_X64_DLINK_PATH = DEF(VS2008_BINX64)\link.exe
+*_VS2008_X64_ASLCC_PATH = DEF(VS2008_BINX64)\cl.exe
+*_VS2008_X64_ASLPP_PATH = DEF(VS2008_BINX64)\cl.exe
+*_VS2008_X64_ASLDLINK_PATH = DEF(VS2008_BINX64)\link.exe
+
+ DEBUG_VS2008_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7
+RELEASE_VS2008_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
+NOOPT_VS2008_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od
+
+ DEBUG_VS2008_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+RELEASE_VS2008_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
+NOOPT_VS2008_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+
+ DEBUG_VS2008_X64_NASM_FLAGS = -Ox -f win64 -g
+RELEASE_VS2008_X64_NASM_FLAGS = -Ox -f win64
+NOOPT_VS2008_X64_NASM_FLAGS = -O0 -f win64 -g
+
+ DEBUG_VS2008_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2008_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2008_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# EBC definitions
+##################
+*_VS2008_EBC_*_FAMILY = INTEL
+*_VS2008_EBC_*_DLL = DEF(VS2008_DLL)
+
+*_VS2008_EBC_MAKE_PATH = DEF(VS2008_BIN)\nmake.exe
+*_VS2008_EBC_PP_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2008_EBC_VFRPP_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2008_EBC_CC_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2008_EBC_SLINK_PATH = DEF(VS2008_BIN)\link.exe
+*_VS2008_EBC_DLINK_PATH = DEF(VS2008_BIN)\link.exe
+
+*_VS2008_EBC_MAKE_FLAGS = /nologo
+*_VS2008_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2008_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
+*_VS2008_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2008_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
+*_VS2008_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
+
+
+####################################################################################
+# VS2008x86 - Microsoft Visual Studio 2008 (x86) with Intel ASL
+# ASL - Intel ACPI Source Language Compiler (iasl.exe)
+####################################################################################
+# VS2008x86 - Microsoft Visual Studio 2008 (x86) ALL Edition with Intel ASL
+*_VS2008x86_*_*_FAMILY = MSFT
+
+*_VS2008x86_*_MAKE_PATH = DEF(VS2008x86_BIN)\nmake.exe
+*_VS2008x86_*_MAKE_FLAG = /nologo
+*_VS2008x86_*_RC_PATH = DEF(WINSDK_BIN)\rc.exe
+
+*_VS2008x86_*_MAKE_FLAGS = /nologo
+*_VS2008x86_*_SLINK_FLAGS = /NOLOGO /LTCG
+*_VS2008x86_*_APP_FLAGS = /nologo /E /TC
+*_VS2008x86_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2008x86_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2008x86_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS)
+*_VS2008x86_*_ASM16_PATH = DEF(VS2008x86_BIN)\ml.exe
+
+##################
+# ASL definitions
+##################
+*_VS2008x86_*_ASL_PATH = DEF(WIN_IASL_BIN)
+*_VS2008x86_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_VS2008x86_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_VS2008x86_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
+*_VS2008x86_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
+*_VS2008x86_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+##################
+# IA32 definitions
+##################
+*_VS2008x86_IA32_*_DLL = DEF(VS2008x86_DLL)
+
+*_VS2008x86_IA32_MAKE_PATH = DEF(VS2008x86_BIN)\nmake.exe
+*_VS2008x86_IA32_CC_PATH = DEF(VS2008x86_BIN)\cl.exe
+*_VS2008x86_IA32_VFRPP_PATH = DEF(VS2008x86_BIN)\cl.exe
+*_VS2008x86_IA32_ASLCC_PATH = DEF(VS2008x86_BIN)\cl.exe
+*_VS2008x86_IA32_ASLPP_PATH = DEF(VS2008x86_BIN)\cl.exe
+*_VS2008x86_IA32_SLINK_PATH = DEF(VS2008x86_BIN)\lib.exe
+*_VS2008x86_IA32_DLINK_PATH = DEF(VS2008x86_BIN)\link.exe
+*_VS2008x86_IA32_ASLDLINK_PATH= DEF(VS2008x86_BIN)\link.exe
+*_VS2008x86_IA32_APP_PATH = DEF(VS2008x86_BIN)\cl.exe
+*_VS2008x86_IA32_PP_PATH = DEF(VS2008x86_BIN)\cl.exe
+*_VS2008x86_IA32_ASM_PATH = DEF(VS2008x86_BIN)\ml.exe
+
+ *_VS2008x86_IA32_MAKE_FLAGS = /nologo
+ DEBUG_VS2008x86_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7
+RELEASE_VS2008x86_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF
+NOOPT_VS2008x86_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od
+
+ DEBUG_VS2008x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+RELEASE_VS2008x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
+NOOPT_VS2008x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+
+ DEBUG_VS2008x86_IA32_NASM_FLAGS = -Ox -f win32 -g
+RELEASE_VS2008x86_IA32_NASM_FLAGS = -Ox -f win32
+NOOPT_VS2008x86_IA32_NASM_FLAGS = -O0 -f win32 -g
+
+ DEBUG_VS2008x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2008x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2008x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# X64 definitions
+##################
+*_VS2008x86_X64_*_DLL = DEF(VS2008x86_DLL)
+
+*_VS2008x86_X64_CC_PATH = DEF(VS2008x86_BINX64)\cl.exe
+*_VS2008x86_X64_PP_PATH = DEF(VS2008x86_BINX64)\cl.exe
+*_VS2008x86_X64_APP_PATH = DEF(VS2008x86_BINX64)\cl.exe
+*_VS2008x86_X64_VFRPP_PATH = DEF(VS2008x86_BINX64)\cl.exe
+*_VS2008x86_X64_ASLCC_PATH = DEF(VS2008x86_BINX64)\cl.exe
+*_VS2008x86_X64_ASLPP_PATH = DEF(VS2008x86_BINX64)\cl.exe
+*_VS2008x86_X64_ASM_PATH = DEF(VS2008x86_BINX64)\ml64.exe
+*_VS2008x86_X64_SLINK_PATH = DEF(VS2008x86_BINX64)\lib.exe
+*_VS2008x86_X64_DLINK_PATH = DEF(VS2008x86_BINX64)\link.exe
+*_VS2008x86_X64_ASLDLINK_PATH = DEF(VS2008x86_BINX64)\link.exe
+
+ DEBUG_VS2008x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7
+RELEASE_VS2008x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
+NOOPT_VS2008x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od
+ DEBUG_VS2008x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+RELEASE_VS2008x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
+NOOPT_VS2008x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+
+ DEBUG_VS2008x86_X64_NASM_FLAGS = -Ox -f win64 -g
+RELEASE_VS2008x86_X64_NASM_FLAGS = -Ox -f win64
+NOOPT_VS2008x86_X64_NASM_FLAGS = -O0 -f win64 -g
+
+ DEBUG_VS2008x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2008x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2008x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# EBC definitions
+##################
+*_VS2008x86_EBC_*_FAMILY = INTEL
+*_VS2008x86_EBC_*_DLL = DEF(VS2008x86_DLL)
+
+*_VS2008x86_EBC_MAKE_PATH = DEF(VS2008x86_BIN)\nmake.exe
+*_VS2008x86_EBC_PP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2008x86_EBC_VFRPP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2008x86_EBC_CC_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2008x86_EBC_SLINK_PATH = DEF(VS2008x86_BIN)\link.exe
+*_VS2008x86_EBC_DLINK_PATH = DEF(VS2008x86_BIN)\link.exe
+
+*_VS2008x86_EBC_MAKE_FLAGS = /nologo
+*_VS2008x86_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2008x86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
+*_VS2008x86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2008x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
+*_VS2008x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
+
+
+
+####################################################################################
+#
+# Microsoft Visual Studio 2010
+#
+# VS2010 - Microsoft Visual Studio 2010 Premium Edition with Intel ASL
+# ASL - Intel ACPI Source Language Compiler
+####################################################################################
+# VS2010 - Microsoft Visual Studio 2010 Premium Edition
+*_VS2010_*_*_FAMILY = MSFT
+
+*_VS2010_*_MAKE_PATH = DEF(VS2010_BIN)\nmake.exe
+*_VS2010_*_MAKE_FLAGS = /nologo
+*_VS2010_*_RC_PATH = DEF(WINSDK7_BIN)\rc.exe
+
+*_VS2010_*_SLINK_FLAGS = /NOLOGO /LTCG
+*_VS2010_*_APP_FLAGS = /nologo /E /TC
+*_VS2010_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2010_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2010_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS)
+*_VS2010_*_ASM16_PATH = DEF(VS2010_BIN)\ml.exe
+
+##################
+# ASL definitions
+##################
+*_VS2010_*_ASL_PATH = DEF(DEFAULT_WIN_ASL_BIN)
+*_VS2010_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_VS2010_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_VS2010_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
+*_VS2010_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
+*_VS2010_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+##################
+# IA32 definitions
+##################
+*_VS2010_IA32_*_DLL = DEF(VS2010_DLL)
+
+*_VS2010_IA32_MAKE_PATH = DEF(VS2010_BIN)\nmake.exe
+*_VS2010_IA32_CC_PATH = DEF(VS2010_BIN)\cl.exe
+*_VS2010_IA32_VFRPP_PATH = DEF(VS2010_BIN)\cl.exe
+*_VS2010_IA32_SLINK_PATH = DEF(VS2010_BIN)\lib.exe
+*_VS2010_IA32_DLINK_PATH = DEF(VS2010_BIN)\link.exe
+*_VS2010_IA32_APP_PATH = DEF(VS2010_BIN)\cl.exe
+*_VS2010_IA32_PP_PATH = DEF(VS2010_BIN)\cl.exe
+*_VS2010_IA32_ASM_PATH = DEF(VS2010_BIN)\ml.exe
+*_VS2010_IA32_ASLCC_PATH = DEF(VS2010_BIN)\cl.exe
+*_VS2010_IA32_ASLPP_PATH = DEF(VS2010_BIN)\cl.exe
+*_VS2010_IA32_ASLDLINK_PATH = DEF(VS2010_BIN)\link.exe
+
+ *_VS2010_IA32_MAKE_FLAGS = /nologo
+ DEBUG_VS2010_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7
+RELEASE_VS2010_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF
+NOOPT_VS2010_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm /Od
+
+ DEBUG_VS2010_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+RELEASE_VS2010_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
+NOOPT_VS2010_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+
+ DEBUG_VS2010_IA32_NASM_FLAGS = -Ox -f win32 -g
+RELEASE_VS2010_IA32_NASM_FLAGS = -Ox -f win32
+NOOPT_VS2010_IA32_NASM_FLAGS = -O0 -f win32 -g
+
+ DEBUG_VS2010_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2010_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2010_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# X64 definitions
+##################
+*_VS2010_X64_*_DLL = DEF(VS2010_DLL)
+
+*_VS2010_X64_CC_PATH = DEF(VS2010_BINX64)\cl.exe
+*_VS2010_X64_PP_PATH = DEF(VS2010_BINX64)\cl.exe
+*_VS2010_X64_APP_PATH = DEF(VS2010_BINX64)\cl.exe
+*_VS2010_X64_VFRPP_PATH = DEF(VS2010_BINX64)\cl.exe
+*_VS2010_X64_ASM_PATH = DEF(VS2010_BINX64)\ml64.exe
+*_VS2010_X64_SLINK_PATH = DEF(VS2010_BINX64)\lib.exe
+*_VS2010_X64_DLINK_PATH = DEF(VS2010_BINX64)\link.exe
+*_VS2010_X64_ASLCC_PATH = DEF(VS2010_BINX64)\cl.exe
+*_VS2010_X64_ASLPP_PATH = DEF(VS2010_BINX64)\cl.exe
+*_VS2010_X64_ASLDLINK_PATH = DEF(VS2010_BINX64)\link.exe
+
+ DEBUG_VS2010_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7
+RELEASE_VS2010_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
+NOOPT_VS2010_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od
+
+ DEBUG_VS2010_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+RELEASE_VS2010_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
+NOOPT_VS2010_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+
+ DEBUG_VS2010_X64_NASM_FLAGS = -Ox -f win64 -g
+RELEASE_VS2010_X64_NASM_FLAGS = -Ox -f win64
+NOOPT_VS2010_X64_NASM_FLAGS = -O0 -f win64 -g
+
+ DEBUG_VS2010_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2010_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2010_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# EBC definitions
+##################
+*_VS2010_EBC_*_FAMILY = INTEL
+*_VS2010_EBC_*_DLL = DEF(VS2010_DLL)
+
+*_VS2010_EBC_MAKE_PATH = DEF(VS2010_BIN)\nmake.exe
+*_VS2010_EBC_PP_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2010_EBC_VFRPP_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2010_EBC_CC_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2010_EBC_SLINK_PATH = DEF(VS2010_BIN)\link.exe
+*_VS2010_EBC_DLINK_PATH = DEF(VS2010_BIN)\link.exe
+
+*_VS2010_EBC_MAKE_FLAGS = /nologo
+*_VS2010_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2010_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
+*_VS2010_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2010_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
+*_VS2010_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
+
+
+####################################################################################
+# VS2010x86 - Microsoft Visual Studio 2010 (x86) with Intel ASL
+# ASL - Intel ACPI Source Language Compiler (iasl.exe)
+####################################################################################
+# VS2010x86 - Microsoft Visual Studio 2010 (x86) ALL Edition with Intel ASL
+*_VS2010x86_*_*_FAMILY = MSFT
+
+*_VS2010x86_*_MAKE_PATH = DEF(VS2010x86_BIN)\nmake.exe
+*_VS2010x86_*_MAKE_FLAG = /nologo
+*_VS2010x86_*_RC_PATH = DEF(WINSDK7x86_BIN)\rc.exe
+
+*_VS2010x86_*_MAKE_FLAGS = /nologo
+*_VS2010x86_*_SLINK_FLAGS = /NOLOGO /LTCG
+*_VS2010x86_*_APP_FLAGS = /nologo /E /TC
+*_VS2010x86_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2010x86_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2010x86_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS)
+*_VS2010x86_*_ASM16_PATH = DEF(VS2010x86_BIN)\ml.exe
+
+##################
+# ASL definitions
+##################
+*_VS2010x86_*_ASL_PATH = DEF(WIN_IASL_BIN)
+*_VS2010x86_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_VS2010x86_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_VS2010x86_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
+*_VS2010x86_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
+*_VS2010x86_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+##################
+# IA32 definitions
+##################
+*_VS2010x86_IA32_*_DLL = DEF(VS2010x86_DLL)
+
+*_VS2010x86_IA32_MAKE_PATH = DEF(VS2010x86_BIN)\nmake.exe
+*_VS2010x86_IA32_CC_PATH = DEF(VS2010x86_BIN)\cl.exe
+*_VS2010x86_IA32_VFRPP_PATH = DEF(VS2010x86_BIN)\cl.exe
+*_VS2010x86_IA32_ASLCC_PATH = DEF(VS2010x86_BIN)\cl.exe
+*_VS2010x86_IA32_ASLPP_PATH = DEF(VS2010x86_BIN)\cl.exe
+*_VS2010x86_IA32_SLINK_PATH = DEF(VS2010x86_BIN)\lib.exe
+*_VS2010x86_IA32_DLINK_PATH = DEF(VS2010x86_BIN)\link.exe
+*_VS2010x86_IA32_ASLDLINK_PATH= DEF(VS2010x86_BIN)\link.exe
+*_VS2010x86_IA32_APP_PATH = DEF(VS2010x86_BIN)\cl.exe
+*_VS2010x86_IA32_PP_PATH = DEF(VS2010x86_BIN)\cl.exe
+*_VS2010x86_IA32_ASM_PATH = DEF(VS2010x86_BIN)\ml.exe
+
+ *_VS2010x86_IA32_MAKE_FLAGS = /nologo
+ DEBUG_VS2010x86_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7
+RELEASE_VS2010x86_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF
+NOOPT_VS2010x86_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od
+
+ DEBUG_VS2010x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+RELEASE_VS2010x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
+NOOPT_VS2010x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+
+ DEBUG_VS2010x86_IA32_NASM_FLAGS = -Ox -f win32 -g
+RELEASE_VS2010x86_IA32_NASM_FLAGS = -Ox -f win32
+NOOPT_VS2010x86_IA32_NASM_FLAGS = -O0 -f win32 -g
+
+ DEBUG_VS2010x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2010x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2010x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# X64 definitions
+##################
+*_VS2010x86_X64_*_DLL = DEF(VS2010x86_DLL)
+
+*_VS2010x86_X64_CC_PATH = DEF(VS2010x86_BINX64)\cl.exe
+*_VS2010x86_X64_PP_PATH = DEF(VS2010x86_BINX64)\cl.exe
+*_VS2010x86_X64_APP_PATH = DEF(VS2010x86_BINX64)\cl.exe
+*_VS2010x86_X64_VFRPP_PATH = DEF(VS2010x86_BINX64)\cl.exe
+*_VS2010x86_X64_ASLCC_PATH = DEF(VS2010x86_BINX64)\cl.exe
+*_VS2010x86_X64_ASLPP_PATH = DEF(VS2010x86_BINX64)\cl.exe
+*_VS2010x86_X64_ASM_PATH = DEF(VS2010x86_BINX64)\ml64.exe
+*_VS2010x86_X64_SLINK_PATH = DEF(VS2010x86_BINX64)\lib.exe
+*_VS2010x86_X64_DLINK_PATH = DEF(VS2010x86_BINX64)\link.exe
+*_VS2010x86_X64_ASLDLINK_PATH = DEF(VS2010x86_BINX64)\link.exe
+
+ DEBUG_VS2010x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7
+RELEASE_VS2010x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
+NOOPT_VS2010x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od
+
+ DEBUG_VS2010x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+RELEASE_VS2010x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
+NOOPT_VS2010x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+
+ DEBUG_VS2010x86_X64_NASM_FLAGS = -Ox -f win64 -g
+RELEASE_VS2010x86_X64_NASM_FLAGS = -Ox -f win64
+NOOPT_VS2010x86_X64_NASM_FLAGS = -O0 -f win64 -g
+
+ DEBUG_VS2010x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2010x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2010x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# EBC definitions
+##################
+*_VS2010x86_EBC_*_FAMILY = INTEL
+*_VS2010x86_EBC_*_DLL = DEF(VS2010x86_DLL)
+
+*_VS2010x86_EBC_MAKE_PATH = DEF(VS2010x86_BIN)\nmake.exe
+*_VS2010x86_EBC_PP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2010x86_EBC_VFRPP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2010x86_EBC_CC_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2010x86_EBC_SLINK_PATH = DEF(VS2010x86_BIN)\link.exe
+*_VS2010x86_EBC_DLINK_PATH = DEF(VS2010x86_BIN)\link.exe
+
+*_VS2010x86_EBC_MAKE_FLAGS = /nologo
+*_VS2010x86_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2010x86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
+*_VS2010x86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2010x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
+*_VS2010x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
+
+
+####################################################################################
+#
+# Microsoft Visual Studio 2012
+#
+# VS2012 - Microsoft Visual Studio 2012 Professional Edition with Intel ASL
+# ASL - Intel ACPI Source Language Compiler
+####################################################################################
+# VS2012 - Microsoft Visual Studio 2012 Professional Edition
+*_VS2012_*_*_FAMILY = MSFT
+
+*_VS2012_*_MAKE_PATH = DEF(VS2012_BIN)\nmake.exe
+*_VS2012_*_MAKE_FLAGS = /nologo
+*_VS2012_*_RC_PATH = DEF(WINSDK71_BIN)\rc.exe
+
+*_VS2012_*_SLINK_FLAGS = /NOLOGO /LTCG
+*_VS2012_*_APP_FLAGS = /nologo /E /TC
+*_VS2012_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2012_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2012_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS)
+*_VS2012_*_ASM16_PATH = DEF(VS2012_BIN)\ml.exe
+
+##################
+# ASL definitions
+##################
+*_VS2012_*_ASL_PATH = DEF(DEFAULT_WIN_ASL_BIN)
+*_VS2012_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_VS2012_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_VS2012_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
+*_VS2012_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
+*_VS2012_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+##################
+# IA32 definitions
+##################
+*_VS2012_IA32_*_DLL = DEF(VS2012_DLL)
+
+*_VS2012_IA32_MAKE_PATH = DEF(VS2012_BIN)\nmake.exe
+*_VS2012_IA32_CC_PATH = DEF(VS2012_BIN)\cl.exe
+*_VS2012_IA32_VFRPP_PATH = DEF(VS2012_BIN)\cl.exe
+*_VS2012_IA32_SLINK_PATH = DEF(VS2012_BIN)\lib.exe
+*_VS2012_IA32_DLINK_PATH = DEF(VS2012_BIN)\link.exe
+*_VS2012_IA32_APP_PATH = DEF(VS2012_BIN)\cl.exe
+*_VS2012_IA32_PP_PATH = DEF(VS2012_BIN)\cl.exe
+*_VS2012_IA32_ASM_PATH = DEF(VS2012_BIN)\ml.exe
+*_VS2012_IA32_ASLCC_PATH = DEF(VS2012_BIN)\cl.exe
+*_VS2012_IA32_ASLPP_PATH = DEF(VS2012_BIN)\cl.exe
+*_VS2012_IA32_ASLDLINK_PATH = DEF(VS2012_BIN)\link.exe
+
+ *_VS2012_IA32_MAKE_FLAGS = /nologo
+ DEBUG_VS2012_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7
+RELEASE_VS2012_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF
+NOOPT_VS2012_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od
+
+ DEBUG_VS2012_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+RELEASE_VS2012_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
+NOOPT_VS2012_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+
+ DEBUG_VS2012_IA32_NASM_FLAGS = -Ox -f win32 -g
+RELEASE_VS2012_IA32_NASM_FLAGS = -Ox -f win32
+NOOPT_VS2012_IA32_NASM_FLAGS = -O0 -f win32 -g
+
+ DEBUG_VS2012_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2012_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2012_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# X64 definitions
+##################
+*_VS2012_X64_*_DLL = DEF(VS2012_DLL)
+
+*_VS2012_X64_CC_PATH = DEF(VS2012_BINX64)\cl.exe
+*_VS2012_X64_PP_PATH = DEF(VS2012_BINX64)\cl.exe
+*_VS2012_X64_APP_PATH = DEF(VS2012_BINX64)\cl.exe
+*_VS2012_X64_VFRPP_PATH = DEF(VS2012_BINX64)\cl.exe
+*_VS2012_X64_ASM_PATH = DEF(VS2012_BINX64)\ml64.exe
+*_VS2012_X64_SLINK_PATH = DEF(VS2012_BINX64)\lib.exe
+*_VS2012_X64_DLINK_PATH = DEF(VS2012_BINX64)\link.exe
+*_VS2012_X64_ASLCC_PATH = DEF(VS2012_BINX64)\cl.exe
+*_VS2012_X64_ASLPP_PATH = DEF(VS2012_BINX64)\cl.exe
+*_VS2012_X64_ASLDLINK_PATH = DEF(VS2012_BINX64)\link.exe
+
+ DEBUG_VS2012_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7
+RELEASE_VS2012_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
+NOOPT_VS2012_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od
+
+ DEBUG_VS2012_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+RELEASE_VS2012_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
+NOOPT_VS2012_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+
+ DEBUG_VS2012_X64_NASM_FLAGS = -Ox -f win64 -g
+RELEASE_VS2012_X64_NASM_FLAGS = -Ox -f win64
+NOOPT_VS2012_X64_NASM_FLAGS = -O0 -f win64 -g
+
+ DEBUG_VS2012_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2012_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2012_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# EBC definitions
+##################
+*_VS2012_EBC_*_FAMILY = INTEL
+*_VS2012_EBC_*_DLL = DEF(VS2012_DLL)
+
+*_VS2012_EBC_MAKE_PATH = DEF(VS2012_BIN)\nmake.exe
+*_VS2012_EBC_PP_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2012_EBC_VFRPP_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2012_EBC_CC_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2012_EBC_SLINK_PATH = DEF(VS2012_BIN)\link.exe
+*_VS2012_EBC_DLINK_PATH = DEF(VS2012_BIN)\link.exe
+
+*_VS2012_EBC_MAKE_FLAGS = /nologo
+*_VS2012_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2012_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
+*_VS2012_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2012_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
+*_VS2012_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
+
+
+####################################################################################
+# VS2012x86 - Microsoft Visual Studio 2012 (x86) professional with Intel ASL
+# ASL - Intel ACPI Source Language Compiler (iasl.exe)
+####################################################################################
+# VS2012x86 - Microsoft Visual Studio 2012 (x86) professional Edition with Intel ASL
+*_VS2012x86_*_*_FAMILY = MSFT
+
+*_VS2012x86_*_MAKE_PATH = DEF(VS2012x86_BIN)\nmake.exe
+*_VS2012x86_*_MAKE_FLAG = /nologo
+*_VS2012x86_*_RC_PATH = DEF(WINSDK71x86_BIN)\rc.exe
+
+*_VS2012x86_*_MAKE_FLAGS = /nologo
+*_VS2012x86_*_SLINK_FLAGS = /NOLOGO /LTCG
+*_VS2012x86_*_APP_FLAGS = /nologo /E /TC
+*_VS2012x86_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2012x86_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2012x86_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS)
+*_VS2012x86_*_ASM16_PATH = DEF(VS2012x86_BIN)\ml.exe
+
+##################
+# ASL definitions
+##################
+*_VS2012x86_*_ASL_PATH = DEF(WIN_IASL_BIN)
+*_VS2012x86_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_VS2012x86_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_VS2012x86_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
+*_VS2012x86_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
+*_VS2012x86_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+##################
+# IA32 definitions
+##################
+*_VS2012x86_IA32_*_DLL = DEF(VS2012x86_DLL)
+
+*_VS2012x86_IA32_MAKE_PATH = DEF(VS2012x86_BIN)\nmake.exe
+*_VS2012x86_IA32_CC_PATH = DEF(VS2012x86_BIN)\cl.exe
+*_VS2012x86_IA32_VFRPP_PATH = DEF(VS2012x86_BIN)\cl.exe
+*_VS2012x86_IA32_ASLCC_PATH = DEF(VS2012x86_BIN)\cl.exe
+*_VS2012x86_IA32_ASLPP_PATH = DEF(VS2012x86_BIN)\cl.exe
+*_VS2012x86_IA32_SLINK_PATH = DEF(VS2012x86_BIN)\lib.exe
+*_VS2012x86_IA32_DLINK_PATH = DEF(VS2012x86_BIN)\link.exe
+*_VS2012x86_IA32_ASLDLINK_PATH= DEF(VS2012x86_BIN)\link.exe
+*_VS2012x86_IA32_APP_PATH = DEF(VS2012x86_BIN)\cl.exe
+*_VS2012x86_IA32_PP_PATH = DEF(VS2012x86_BIN)\cl.exe
+*_VS2012x86_IA32_ASM_PATH = DEF(VS2012x86_BIN)\ml.exe
+
+ *_VS2012x86_IA32_MAKE_FLAGS = /nologo
+ DEBUG_VS2012x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7
+RELEASE_VS2012x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF
+NOOPT_VS2012x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od
+
+ DEBUG_VS2012x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+RELEASE_VS2012x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
+NOOPT_VS2012x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+
+ DEBUG_VS2012x86_IA32_NASM_FLAGS = -Ox -f win32 -g
+RELEASE_VS2012x86_IA32_NASM_FLAGS = -Ox -f win32
+NOOPT_VS2012x86_IA32_NASM_FLAGS = -O0 -f win32 -g
+
+ DEBUG_VS2012x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2012x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2012x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# X64 definitions
+##################
+*_VS2012x86_X64_*_DLL = DEF(VS2012x86_DLL)
+
+*_VS2012x86_X64_CC_PATH = DEF(VS2012x86_BINX64)\cl.exe
+*_VS2012x86_X64_PP_PATH = DEF(VS2012x86_BINX64)\cl.exe
+*_VS2012x86_X64_APP_PATH = DEF(VS2012x86_BINX64)\cl.exe
+*_VS2012x86_X64_VFRPP_PATH = DEF(VS2012x86_BINX64)\cl.exe
+*_VS2012x86_X64_ASLCC_PATH = DEF(VS2012x86_BINX64)\cl.exe
+*_VS2012x86_X64_ASLPP_PATH = DEF(VS2012x86_BINX64)\cl.exe
+*_VS2012x86_X64_ASM_PATH = DEF(VS2012x86_BINX64)\ml64.exe
+*_VS2012x86_X64_SLINK_PATH = DEF(VS2012x86_BINX64)\lib.exe
+*_VS2012x86_X64_DLINK_PATH = DEF(VS2012x86_BINX64)\link.exe
+*_VS2012x86_X64_ASLDLINK_PATH = DEF(VS2012x86_BINX64)\link.exe
+
+ DEBUG_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7
+RELEASE_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
+NOOPT_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od
+
+ DEBUG_VS2012x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+RELEASE_VS2012x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
+NOOPT_VS2012x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+
+ DEBUG_VS2012x86_X64_NASM_FLAGS = -Ox -f win64 -g
+RELEASE_VS2012x86_X64_NASM_FLAGS = -Ox -f win64
+NOOPT_VS2012x86_X64_NASM_FLAGS = -O0 -f win64 -g
+
+ DEBUG_VS2012x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2012x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2012x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# EBC definitions
+##################
+*_VS2012x86_EBC_*_FAMILY = INTEL
+*_VS2012x86_EBC_*_DLL = DEF(VS2012x86_DLL)
+
+*_VS2012x86_EBC_MAKE_PATH = DEF(VS2012x86_BIN)\nmake.exe
+*_VS2012x86_EBC_PP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2012x86_EBC_VFRPP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2012x86_EBC_CC_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2012x86_EBC_SLINK_PATH = DEF(VS2012x86_BIN)\link.exe
+*_VS2012x86_EBC_DLINK_PATH = DEF(VS2012x86_BIN)\link.exe
+
+*_VS2012x86_EBC_MAKE_FLAGS = /nologo
+*_VS2012x86_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2012x86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
+*_VS2012x86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2012x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
+*_VS2012x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
+
+
+####################################################################################
+#
+# Microsoft Visual Studio 2013
+#
+# VS2013 - Microsoft Visual Studio 2013 Professional Edition with Intel ASL
+# ASL - Intel ACPI Source Language Compiler
+####################################################################################
+# VS2013 - Microsoft Visual Studio 2013 Professional Edition
+*_VS2013_*_*_FAMILY = MSFT
+
+*_VS2013_*_MAKE_PATH = DEF(VS2013_BIN)\nmake.exe
+*_VS2013_*_MAKE_FLAGS = /nologo
+*_VS2013_*_RC_PATH = DEF(WINSDK8_BIN)\rc.exe
+
+*_VS2013_*_SLINK_FLAGS = /NOLOGO /LTCG
+*_VS2013_*_APP_FLAGS = /nologo /E /TC
+*_VS2013_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2013_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2013_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS)
+*_VS2013_*_ASM16_PATH = DEF(VS2013_BIN)\ml.exe
+
+##################
+# ASL definitions
+##################
+*_VS2013_*_ASL_PATH = DEF(DEFAULT_WIN_ASL_BIN)
+*_VS2013_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_VS2013_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_VS2013_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
+*_VS2013_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
+*_VS2013_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+##################
+# IA32 definitions
+##################
+*_VS2013_IA32_*_DLL = DEF(VS2013_DLL)
+
+*_VS2013_IA32_MAKE_PATH = DEF(VS2013_BIN)\nmake.exe
+*_VS2013_IA32_CC_PATH = DEF(VS2013_BIN)\cl.exe
+*_VS2013_IA32_VFRPP_PATH = DEF(VS2013_BIN)\cl.exe
+*_VS2013_IA32_SLINK_PATH = DEF(VS2013_BIN)\lib.exe
+*_VS2013_IA32_DLINK_PATH = DEF(VS2013_BIN)\link.exe
+*_VS2013_IA32_APP_PATH = DEF(VS2013_BIN)\cl.exe
+*_VS2013_IA32_PP_PATH = DEF(VS2013_BIN)\cl.exe
+*_VS2013_IA32_ASM_PATH = DEF(VS2013_BIN)\ml.exe
+*_VS2013_IA32_ASLCC_PATH = DEF(VS2013_BIN)\cl.exe
+*_VS2013_IA32_ASLPP_PATH = DEF(VS2013_BIN)\cl.exe
+*_VS2013_IA32_ASLDLINK_PATH = DEF(VS2013_BIN)\link.exe
+
+ *_VS2013_IA32_MAKE_FLAGS = /nologo
+ DEBUG_VS2013_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Gw
+RELEASE_VS2013_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw
+NOOPT_VS2013_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od
+
+ DEBUG_VS2013_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+RELEASE_VS2013_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
+NOOPT_VS2013_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+
+ DEBUG_VS2013_IA32_NASM_FLAGS = -Ox -f win32 -g
+RELEASE_VS2013_IA32_NASM_FLAGS = -Ox -f win32
+NOOPT_VS2013_IA32_NASM_FLAGS = -O0 -f win32 -g
+
+ DEBUG_VS2013_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2013_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2013_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# X64 definitions
+##################
+*_VS2013_X64_*_DLL = DEF(VS2013_DLL)
+
+*_VS2013_X64_CC_PATH = DEF(VS2013_BINX64)\cl.exe
+*_VS2013_X64_PP_PATH = DEF(VS2013_BINX64)\cl.exe
+*_VS2013_X64_APP_PATH = DEF(VS2013_BINX64)\cl.exe
+*_VS2013_X64_VFRPP_PATH = DEF(VS2013_BINX64)\cl.exe
+*_VS2013_X64_ASM_PATH = DEF(VS2013_BINX64)\ml64.exe
+*_VS2013_X64_SLINK_PATH = DEF(VS2013_BINX64)\lib.exe
+*_VS2013_X64_DLINK_PATH = DEF(VS2013_BINX64)\link.exe
+*_VS2013_X64_ASLCC_PATH = DEF(VS2013_BINX64)\cl.exe
+*_VS2013_X64_ASLPP_PATH = DEF(VS2013_BINX64)\cl.exe
+*_VS2013_X64_ASLDLINK_PATH = DEF(VS2013_BINX64)\link.exe
+
+ DEBUG_VS2013_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Gw
+RELEASE_VS2013_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw
+NOOPT_VS2013_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od
+
+ DEBUG_VS2013_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+RELEASE_VS2013_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
+NOOPT_VS2013_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+
+ DEBUG_VS2013_X64_NASM_FLAGS = -Ox -f win64 -g
+RELEASE_VS2013_X64_NASM_FLAGS = -Ox -f win64
+NOOPT_VS2013_X64_NASM_FLAGS = -O0 -f win64 -g
+
+ DEBUG_VS2013_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2013_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2013_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# EBC definitions
+##################
+*_VS2013_EBC_*_FAMILY = INTEL
+*_VS2013_EBC_*_DLL = DEF(VS2013_DLL)
+
+*_VS2013_EBC_MAKE_PATH = DEF(VS2013_BIN)\nmake.exe
+*_VS2013_EBC_PP_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2013_EBC_VFRPP_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2013_EBC_CC_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2013_EBC_SLINK_PATH = DEF(VS2013_BIN)\link.exe
+*_VS2013_EBC_DLINK_PATH = DEF(VS2013_BIN)\link.exe
+
+*_VS2013_EBC_MAKE_FLAGS = /nologo
+*_VS2013_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2013_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
+*_VS2013_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2013_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
+*_VS2013_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
+
+
+####################################################################################
+# VS2013x86 - Microsoft Visual Studio 2013 (x86) professional with Intel ASL
+# ASL - Intel ACPI Source Language Compiler (iasl.exe)
+####################################################################################
+# VS2013x86 - Microsoft Visual Studio 2013 (x86) professional Edition with Intel ASL
+*_VS2013x86_*_*_FAMILY = MSFT
+
+*_VS2013x86_*_MAKE_PATH = DEF(VS2013x86_BIN)\nmake.exe
+*_VS2013x86_*_MAKE_FLAG = /nologo
+*_VS2013x86_*_RC_PATH = DEF(WINSDK8x86_BIN)\rc.exe
+
+*_VS2013x86_*_MAKE_FLAGS = /nologo
+*_VS2013x86_*_SLINK_FLAGS = /NOLOGO /LTCG
+*_VS2013x86_*_APP_FLAGS = /nologo /E /TC
+*_VS2013x86_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2013x86_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2013x86_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS)
+*_VS2013x86_*_ASM16_PATH = DEF(VS2013x86_BIN)\ml.exe
+
+##################
+# ASL definitions
+##################
+*_VS2013x86_*_ASL_PATH = DEF(WIN_IASL_BIN)
+*_VS2013x86_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_VS2013x86_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_VS2013x86_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
+*_VS2013x86_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
+*_VS2013x86_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+##################
+# IA32 definitions
+##################
+*_VS2013x86_IA32_*_DLL = DEF(VS2013x86_DLL)
+
+*_VS2013x86_IA32_MAKE_PATH = DEF(VS2013x86_BIN)\nmake.exe
+*_VS2013x86_IA32_CC_PATH = DEF(VS2013x86_BIN)\cl.exe
+*_VS2013x86_IA32_VFRPP_PATH = DEF(VS2013x86_BIN)\cl.exe
+*_VS2013x86_IA32_ASLCC_PATH = DEF(VS2013x86_BIN)\cl.exe
+*_VS2013x86_IA32_ASLPP_PATH = DEF(VS2013x86_BIN)\cl.exe
+*_VS2013x86_IA32_SLINK_PATH = DEF(VS2013x86_BIN)\lib.exe
+*_VS2013x86_IA32_DLINK_PATH = DEF(VS2013x86_BIN)\link.exe
+*_VS2013x86_IA32_ASLDLINK_PATH= DEF(VS2013x86_BIN)\link.exe
+*_VS2013x86_IA32_APP_PATH = DEF(VS2013x86_BIN)\cl.exe
+*_VS2013x86_IA32_PP_PATH = DEF(VS2013x86_BIN)\cl.exe
+*_VS2013x86_IA32_ASM_PATH = DEF(VS2013x86_BIN)\ml.exe
+
+ *_VS2013x86_IA32_MAKE_FLAGS = /nologo
+ DEBUG_VS2013x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Gw
+RELEASE_VS2013x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw
+NOOPT_VS2013x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od
+
+ DEBUG_VS2013x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+RELEASE_VS2013x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
+NOOPT_VS2013x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+
+ DEBUG_VS2013x86_IA32_NASM_FLAGS = -Ox -f win32 -g
+RELEASE_VS2013x86_IA32_NASM_FLAGS = -Ox -f win32
+NOOPT_VS2013x86_IA32_NASM_FLAGS = -O0 -f win32 -g
+
+ DEBUG_VS2013x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2013x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2013x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# X64 definitions
+##################
+*_VS2013x86_X64_*_DLL = DEF(VS2013x86_DLL)
+
+*_VS2013x86_X64_CC_PATH = DEF(VS2013x86_BINX64)\cl.exe
+*_VS2013x86_X64_PP_PATH = DEF(VS2013x86_BINX64)\cl.exe
+*_VS2013x86_X64_APP_PATH = DEF(VS2013x86_BINX64)\cl.exe
+*_VS2013x86_X64_VFRPP_PATH = DEF(VS2013x86_BINX64)\cl.exe
+*_VS2013x86_X64_ASLCC_PATH = DEF(VS2013x86_BINX64)\cl.exe
+*_VS2013x86_X64_ASLPP_PATH = DEF(VS2013x86_BINX64)\cl.exe
+*_VS2013x86_X64_ASM_PATH = DEF(VS2013x86_BINX64)\ml64.exe
+*_VS2013x86_X64_SLINK_PATH = DEF(VS2013x86_BINX64)\lib.exe
+*_VS2013x86_X64_DLINK_PATH = DEF(VS2013x86_BINX64)\link.exe
+*_VS2013x86_X64_ASLDLINK_PATH = DEF(VS2013x86_BINX64)\link.exe
+
+ DEBUG_VS2013x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Gw
+RELEASE_VS2013x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw
+NOOPT_VS2013x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od
+
+ DEBUG_VS2013x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+RELEASE_VS2013x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
+NOOPT_VS2013x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+
+ DEBUG_VS2013x86_X64_NASM_FLAGS = -Ox -f win64 -g
+RELEASE_VS2013x86_X64_NASM_FLAGS = -Ox -f win64
+NOOPT_VS2013x86_X64_NASM_FLAGS = -O0 -f win64 -g
+
+ DEBUG_VS2013x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2013x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2013x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# EBC definitions
+##################
+*_VS2013x86_EBC_*_FAMILY = INTEL
+*_VS2013x86_EBC_*_DLL = DEF(VS2013x86_DLL)
+
+*_VS2013x86_EBC_MAKE_PATH = DEF(VS2013x86_BIN)\nmake.exe
+*_VS2013x86_EBC_PP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2013x86_EBC_VFRPP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2013x86_EBC_CC_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2013x86_EBC_SLINK_PATH = DEF(VS2013x86_BIN)\link.exe
+*_VS2013x86_EBC_DLINK_PATH = DEF(VS2013x86_BIN)\link.exe
+
+*_VS2013x86_EBC_MAKE_FLAGS = /nologo
+*_VS2013x86_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2013x86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
+*_VS2013x86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2013x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
+*_VS2013x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
+
+
+####################################################################################
+#
+# Microsoft Visual Studio 2015
+#
+# VS2015 - Microsoft Visual Studio 2015 Professional Edition with Intel ASL
+# ASL - Intel ACPI Source Language Compiler
+####################################################################################
+# VS2015 - Microsoft Visual Studio 2015 Professional Edition
+*_VS2015_*_*_FAMILY = MSFT
+
+*_VS2015_*_MAKE_PATH = DEF(VS2015_BIN)\nmake.exe
+*_VS2015_*_MAKE_FLAGS = /nologo
+*_VS2015_*_RC_PATH = DEF(WINSDK81_BIN)\rc.exe
+
+*_VS2015_*_SLINK_FLAGS = /NOLOGO /LTCG
+*_VS2015_*_APP_FLAGS = /nologo /E /TC
+*_VS2015_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2015_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2015_*_DLINK2_FLAGS =
+*_VS2015_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS)
+*_VS2015_*_ASM16_PATH = DEF(VS2015_BIN)\ml.exe
+
+##################
+# ASL definitions
+##################
+*_VS2015_*_ASL_PATH = DEF(DEFAULT_WIN_ASL_BIN)
+*_VS2015_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_VS2015_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_VS2015_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
+*_VS2015_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
+*_VS2015_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+##################
+# IA32 definitions
+##################
+*_VS2015_IA32_*_DLL = DEF(VS2015_DLL)
+
+*_VS2015_IA32_MAKE_PATH = DEF(VS2015_BIN)\nmake.exe
+*_VS2015_IA32_CC_PATH = DEF(VS2015_BIN)\cl.exe
+*_VS2015_IA32_VFRPP_PATH = DEF(VS2015_BIN)\cl.exe
+*_VS2015_IA32_SLINK_PATH = DEF(VS2015_BIN)\lib.exe
+*_VS2015_IA32_DLINK_PATH = DEF(VS2015_BIN)\link.exe
+*_VS2015_IA32_APP_PATH = DEF(VS2015_BIN)\cl.exe
+*_VS2015_IA32_PP_PATH = DEF(VS2015_BIN)\cl.exe
+*_VS2015_IA32_ASM_PATH = DEF(VS2015_BIN)\ml.exe
+*_VS2015_IA32_ASLCC_PATH = DEF(VS2015_BIN)\cl.exe
+*_VS2015_IA32_ASLPP_PATH = DEF(VS2015_BIN)\cl.exe
+*_VS2015_IA32_ASLDLINK_PATH = DEF(VS2015_BIN)\link.exe
+
+ *_VS2015_IA32_MAKE_FLAGS = /nologo
+ DEBUG_VS2015_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Gw
+RELEASE_VS2015_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw
+NOOPT_VS2015_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od
+
+ DEBUG_VS2015_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+RELEASE_VS2015_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
+NOOPT_VS2015_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+
+ DEBUG_VS2015_IA32_NASM_FLAGS = -Ox -f win32 -g
+RELEASE_VS2015_IA32_NASM_FLAGS = -Ox -f win32
+NOOPT_VS2015_IA32_NASM_FLAGS = -O0 -f win32 -g
+
+ DEBUG_VS2015_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2015_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2015_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# X64 definitions
+##################
+*_VS2015_X64_*_DLL = DEF(VS2015_DLL)
+
+*_VS2015_X64_CC_PATH = DEF(VS2015_BINX64)\cl.exe
+*_VS2015_X64_PP_PATH = DEF(VS2015_BINX64)\cl.exe
+*_VS2015_X64_APP_PATH = DEF(VS2015_BINX64)\cl.exe
+*_VS2015_X64_VFRPP_PATH = DEF(VS2015_BINX64)\cl.exe
+*_VS2015_X64_ASM_PATH = DEF(VS2015_BINX64)\ml64.exe
+*_VS2015_X64_SLINK_PATH = DEF(VS2015_BINX64)\lib.exe
+*_VS2015_X64_DLINK_PATH = DEF(VS2015_BINX64)\link.exe
+*_VS2015_X64_ASLCC_PATH = DEF(VS2015_BINX64)\cl.exe
+*_VS2015_X64_ASLPP_PATH = DEF(VS2015_BINX64)\cl.exe
+*_VS2015_X64_ASLDLINK_PATH = DEF(VS2015_BINX64)\link.exe
+
+ DEBUG_VS2015_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Gw
+RELEASE_VS2015_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw
+NOOPT_VS2015_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od
+
+ DEBUG_VS2015_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+RELEASE_VS2015_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
+NOOPT_VS2015_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+
+ DEBUG_VS2015_X64_NASM_FLAGS = -Ox -f win64 -g
+RELEASE_VS2015_X64_NASM_FLAGS = -Ox -f win64
+NOOPT_VS2015_X64_NASM_FLAGS = -O0 -f win64 -g
+
+ DEBUG_VS2015_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2015_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2015_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# EBC definitions
+##################
+*_VS2015_EBC_*_FAMILY = INTEL
+*_VS2015_EBC_*_DLL = DEF(VS2015_DLL)
+
+*_VS2015_EBC_MAKE_PATH = DEF(VS2015_BIN)\nmake.exe
+*_VS2015_EBC_PP_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2015_EBC_VFRPP_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2015_EBC_CC_PATH = DEF(EBC_BIN)\iec.exe
+*_VS2015_EBC_SLINK_PATH = DEF(VS2015_BIN)\link.exe
+*_VS2015_EBC_DLINK_PATH = DEF(VS2015_BIN)\link.exe
+
+*_VS2015_EBC_MAKE_FLAGS = /nologo
+*_VS2015_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2015_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
+*_VS2015_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2015_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
+*_VS2015_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
+
+
+####################################################################################
+# VS2015x86 - Microsoft Visual Studio 2015 (x86) professional with Intel ASL
+# ASL - Intel ACPI Source Language Compiler (iasl.exe)
+####################################################################################
+# VS2015x86 - Microsoft Visual Studio 2015 (x86) professional Edition with Intel ASL
+*_VS2015x86_*_*_FAMILY = MSFT
+
+*_VS2015x86_*_MAKE_PATH = DEF(VS2015x86_BIN)\nmake.exe
+*_VS2015x86_*_MAKE_FLAG = /nologo
+*_VS2015x86_*_RC_PATH = DEF(WINSDK81x86_BIN)\rc.exe
+
+*_VS2015x86_*_MAKE_FLAGS = /nologo
+*_VS2015x86_*_SLINK_FLAGS = /NOLOGO /LTCG
+*_VS2015x86_*_APP_FLAGS = /nologo /E /TC
+*_VS2015x86_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2015x86_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2015x86_*_DLINK2_FLAGS =
+*_VS2015x86_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS)
+*_VS2015x86_*_ASM16_PATH = DEF(VS2015x86_BIN)\ml.exe
+
+##################
+# ASL definitions
+##################
+*_VS2015x86_*_ASL_PATH = DEF(WIN_IASL_BIN)
+*_VS2015x86_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_VS2015x86_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_VS2015x86_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
+*_VS2015x86_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
+*_VS2015x86_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+##################
+# IA32 definitions
+##################
+*_VS2015x86_IA32_*_DLL = DEF(VS2015x86_DLL)
+
+*_VS2015x86_IA32_MAKE_PATH = DEF(VS2015x86_BIN)\nmake.exe
+*_VS2015x86_IA32_CC_PATH = DEF(VS2015x86_BIN)\cl.exe
+*_VS2015x86_IA32_VFRPP_PATH = DEF(VS2015x86_BIN)\cl.exe
+*_VS2015x86_IA32_ASLCC_PATH = DEF(VS2015x86_BIN)\cl.exe
+*_VS2015x86_IA32_ASLPP_PATH = DEF(VS2015x86_BIN)\cl.exe
+*_VS2015x86_IA32_SLINK_PATH = DEF(VS2015x86_BIN)\lib.exe
+*_VS2015x86_IA32_DLINK_PATH = DEF(VS2015x86_BIN)\link.exe
+*_VS2015x86_IA32_ASLDLINK_PATH= DEF(VS2015x86_BIN)\link.exe
+*_VS2015x86_IA32_APP_PATH = DEF(VS2015x86_BIN)\cl.exe
+*_VS2015x86_IA32_PP_PATH = DEF(VS2015x86_BIN)\cl.exe
+*_VS2015x86_IA32_ASM_PATH = DEF(VS2015x86_BIN)\ml.exe
+
+ *_VS2015x86_IA32_MAKE_FLAGS = /nologo
+ DEBUG_VS2015x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Gw
+RELEASE_VS2015x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw
+NOOPT_VS2015x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od
+
+ DEBUG_VS2015x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+RELEASE_VS2015x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
+NOOPT_VS2015x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+
+ DEBUG_VS2015x86_IA32_NASM_FLAGS = -Ox -f win32 -g
+RELEASE_VS2015x86_IA32_NASM_FLAGS = -Ox -f win32
+NOOPT_VS2015x86_IA32_NASM_FLAGS = -O0 -f win32 -g
+
+ DEBUG_VS2015x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2015x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2015x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# X64 definitions
+##################
+*_VS2015x86_X64_*_DLL = DEF(VS2015x86_DLL)
+
+*_VS2015x86_X64_CC_PATH = DEF(VS2015x86_BINX64)\cl.exe
+*_VS2015x86_X64_PP_PATH = DEF(VS2015x86_BINX64)\cl.exe
+*_VS2015x86_X64_APP_PATH = DEF(VS2015x86_BINX64)\cl.exe
+*_VS2015x86_X64_VFRPP_PATH = DEF(VS2015x86_BINX64)\cl.exe
+*_VS2015x86_X64_ASLCC_PATH = DEF(VS2015x86_BINX64)\cl.exe
+*_VS2015x86_X64_ASLPP_PATH = DEF(VS2015x86_BINX64)\cl.exe
+*_VS2015x86_X64_ASM_PATH = DEF(VS2015x86_BINX64)\ml64.exe
+*_VS2015x86_X64_SLINK_PATH = DEF(VS2015x86_BINX64)\lib.exe
+*_VS2015x86_X64_DLINK_PATH = DEF(VS2015x86_BINX64)\link.exe
+*_VS2015x86_X64_ASLDLINK_PATH = DEF(VS2015x86_BINX64)\link.exe
+
+ DEBUG_VS2015x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Gw
+RELEASE_VS2015x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw
+NOOPT_VS2015x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od
+
+ DEBUG_VS2015x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+RELEASE_VS2015x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
+NOOPT_VS2015x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+
+ DEBUG_VS2015x86_X64_NASM_FLAGS = -Ox -f win64 -g
+RELEASE_VS2015x86_X64_NASM_FLAGS = -Ox -f win64
+NOOPT_VS2015x86_X64_NASM_FLAGS = -O0 -f win64 -g
+
+ DEBUG_VS2015x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2015x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2015x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# EBC definitions
+##################
+*_VS2015x86_EBC_*_FAMILY = INTEL
+*_VS2015x86_EBC_*_DLL = DEF(VS2015x86_DLL)
+
+*_VS2015x86_EBC_MAKE_PATH = DEF(VS2015x86_BIN)\nmake.exe
+*_VS2015x86_EBC_PP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2015x86_EBC_VFRPP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2015x86_EBC_CC_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2015x86_EBC_SLINK_PATH = DEF(VS2015x86_BIN)\link.exe
+*_VS2015x86_EBC_DLINK_PATH = DEF(VS2015x86_BIN)\link.exe
+
+*_VS2015x86_EBC_MAKE_FLAGS = /nologo
+*_VS2015x86_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2015x86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
+*_VS2015x86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2015x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
+*_VS2015x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
+
+
+####################################################################################
+# VS2017 - Microsoft Visual Studio 2017 with Intel ASL
+# ASL - Intel ACPI Source Language Compiler (iasl.exe)
+####################################################################################
+# VS2017 - Microsoft Visual Studio 2017 professional Edition with Intel ASL
+*_VS2017_*_*_FAMILY = MSFT
+*_VS2017_*_*_DLL = DEF(VS2017_BIN_HOST)
+
+*_VS2017_*_MAKE_PATH = DEF(VS2017_BIN_HOST)\nmake.exe
+*_VS2017_*_MAKE_FLAG = /nologo
+*_VS2017_*_RC_PATH = DEF(RC_PATH)
+
+*_VS2017_*_MAKE_FLAGS = /nologo
+*_VS2017_*_SLINK_FLAGS = /NOLOGO /LTCG
+*_VS2017_*_APP_FLAGS = /nologo /E /TC
+*_VS2017_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2017_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2017_*_DLINK2_FLAGS = /WHOLEARCHIVE
+*_VS2017_*_ASM16_PATH = DEF(VS2017_BIN_IA32)\ml.exe
+*_VS2017_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS)
+##################
+# ASL definitions
+##################
+*_VS2017_*_ASL_PATH = DEF(WIN_IASL_BIN)
+*_VS2017_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_VS2017_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_VS2017_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
+*_VS2017_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
+*_VS2017_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+##################
+# IA32 definitions
+##################
+*_VS2017_IA32_CC_PATH = DEF(VS2017_BIN_IA32)\cl.exe
+*_VS2017_IA32_VFRPP_PATH = DEF(VS2017_BIN_IA32)\cl.exe
+*_VS2017_IA32_ASLCC_PATH = DEF(VS2017_BIN_IA32)\cl.exe
+*_VS2017_IA32_ASLPP_PATH = DEF(VS2017_BIN_IA32)\cl.exe
+*_VS2017_IA32_SLINK_PATH = DEF(VS2017_BIN_IA32)\lib.exe
+*_VS2017_IA32_DLINK_PATH = DEF(VS2017_BIN_IA32)\link.exe
+*_VS2017_IA32_ASLDLINK_PATH= DEF(VS2017_BIN_IA32)\link.exe
+*_VS2017_IA32_APP_PATH = DEF(VS2017_BIN_IA32)\cl.exe
+*_VS2017_IA32_PP_PATH = DEF(VS2017_BIN_IA32)\cl.exe
+*_VS2017_IA32_ASM_PATH = DEF(VS2017_BIN_IA32)\ml.exe
+
+ *_VS2017_IA32_MAKE_FLAGS = /nologo
+ DEBUG_VS2017_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Gw
+RELEASE_VS2017_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw
+NOOPT_VS2017_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od
+
+ DEBUG_VS2017_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+RELEASE_VS2017_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
+NOOPT_VS2017_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+
+ DEBUG_VS2017_IA32_NASM_FLAGS = -Ox -f win32 -g
+RELEASE_VS2017_IA32_NASM_FLAGS = -Ox -f win32
+NOOPT_VS2017_IA32_NASM_FLAGS = -O0 -f win32 -g
+
+ DEBUG_VS2017_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2017_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2017_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# X64 definitions
+##################
+*_VS2017_X64_CC_PATH = DEF(VS2017_BIN_X64)\cl.exe
+*_VS2017_X64_PP_PATH = DEF(VS2017_BIN_X64)\cl.exe
+*_VS2017_X64_APP_PATH = DEF(VS2017_BIN_X64)\cl.exe
+*_VS2017_X64_VFRPP_PATH = DEF(VS2017_BIN_X64)\cl.exe
+*_VS2017_X64_ASLCC_PATH = DEF(VS2017_BIN_X64)\cl.exe
+*_VS2017_X64_ASLPP_PATH = DEF(VS2017_BIN_X64)\cl.exe
+*_VS2017_X64_ASM_PATH = DEF(VS2017_BIN_X64)\ml64.exe
+*_VS2017_X64_SLINK_PATH = DEF(VS2017_BIN_X64)\lib.exe
+*_VS2017_X64_DLINK_PATH = DEF(VS2017_BIN_X64)\link.exe
+*_VS2017_X64_ASLDLINK_PATH = DEF(VS2017_BIN_X64)\link.exe
+
+ DEBUG_VS2017_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Gw
+RELEASE_VS2017_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw
+NOOPT_VS2017_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od
+
+ DEBUG_VS2017_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+RELEASE_VS2017_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
+NOOPT_VS2017_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+
+ DEBUG_VS2017_X64_NASM_FLAGS = -Ox -f win64 -g
+RELEASE_VS2017_X64_NASM_FLAGS = -Ox -f win64
+NOOPT_VS2017_X64_NASM_FLAGS = -O0 -f win64 -g
+
+ DEBUG_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+#################
+# ARM definitions
+#################
+*_VS2017_ARM_CC_PATH = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_VFRPP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_SLINK_PATH = DEF(VS2017_BIN_ARM)\lib.exe
+*_VS2017_ARM_DLINK_PATH = DEF(VS2017_BIN_ARM)\link.exe
+*_VS2017_ARM_APP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_PP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_ASM_PATH = DEF(VS2017_BIN_ARM)\armasm.exe
+*_VS2017_ARM_ASLCC_PATH = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_ASLPP_PATH = DEF(VS2017_BIN_ARM)\cl.exe
+*_VS2017_ARM_ASLDLINK_PATH = DEF(VS2017_BIN_ARM)\link.exe
+
+ *_VS2017_ARM_MAKE_FLAGS = /nologo
+ DEBUG_VS2017_ARM_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gw /Oi-
+RELEASE_VS2017_ARM_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Oi-
+NOOPT_VS2017_ARM_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Od /Oi-
+
+ DEBUG_VS2017_ARM_ASM_FLAGS = /nologo /g
+RELEASE_VS2017_ARM_ASM_FLAGS = /nologo
+NOOPT_VS2017_ARM_ASM_FLAGS = /nologo
+
+ DEBUG_VS2017_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2017_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2017_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+#####################
+# AARCH64 definitions
+#####################
+*_VS2017_AARCH64_CC_PATH = DEF(VS2017_BIN_AARCH64)\cl.exe
+*_VS2017_AARCH64_VFRPP_PATH = DEF(VS2017_BIN_AARCH64)\cl.exe
+*_VS2017_AARCH64_SLINK_PATH = DEF(VS2017_BIN_AARCH64)\lib.exe
+*_VS2017_AARCH64_DLINK_PATH = DEF(VS2017_BIN_AARCH64)\link.exe
+*_VS2017_AARCH64_APP_PATH = DEF(VS2017_BIN_AARCH64)\cl.exe
+*_VS2017_AARCH64_PP_PATH = DEF(VS2017_BIN_AARCH64)\cl.exe
+*_VS2017_AARCH64_ASM_PATH = DEF(VS2017_BIN_AARCH64)\armasm64.exe
+*_VS2017_AARCH64_ASLCC_PATH = DEF(VS2017_BIN_AARCH64)\cl.exe
+*_VS2017_AARCH64_ASLPP_PATH = DEF(VS2017_BIN_AARCH64)\cl.exe
+*_VS2017_AARCH64_ASLDLINK_PATH = DEF(VS2017_BIN_AARCH64)\link.exe
+
+ *_VS2017_AARCH64_MAKE_FLAGS = /nologo
+ DEBUG_VS2017_AARCH64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gw /Oi-
+RELEASE_VS2017_AARCH64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Oi-
+NOOPT_VS2017_AARCH64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Od /Oi-
+
+ DEBUG_VS2017_AARCH64_ASM_FLAGS = /nologo /g
+RELEASE_VS2017_AARCH64_ASM_FLAGS = /nologo
+NOOPT_VS2017_AARCH64_ASM_FLAGS = /nologo
+
+ DEBUG_VS2017_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /DRIVER /DEBUG
+RELEASE_VS2017_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2017_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /DRIVER /DEBUG
+
+##################
+# EBC definitions
+##################
+*_VS2017_EBC_*_FAMILY = INTEL
+
+*_VS2017_EBC_PP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2017_EBC_VFRPP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2017_EBC_CC_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2017_EBC_SLINK_PATH = DEF(VS2017_BIN_IA32)\link.exe
+*_VS2017_EBC_DLINK_PATH = DEF(VS2017_BIN_IA32)\link.exe
+
+*_VS2017_EBC_MAKE_FLAGS = /nologo
+*_VS2017_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2017_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
+*_VS2017_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2017_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
+*_VS2017_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
+
+####################################################################################
+# VS2019 - Microsoft Visual Studio 2019 with Intel ASL
+# ASL - Intel ACPI Source Language Compiler (iasl.exe)
+####################################################################################
+# VS2019 - Microsoft Visual Studio 2017 professional Edition with Intel ASL
+*_VS2019_*_*_FAMILY = MSFT
+*_VS2019_*_*_DLL = DEF(VS2019_BIN_HOST)
+
+*_VS2019_*_MAKE_PATH = DEF(VS2019_BIN_HOST)\nmake.exe
+*_VS2019_*_MAKE_FLAG = /nologo
+*_VS2019_*_RC_PATH = DEF(RC_PATH)
+
+*_VS2019_*_MAKE_FLAGS = /nologo
+*_VS2019_*_SLINK_FLAGS = /NOLOGO /LTCG
+*_VS2019_*_APP_FLAGS = /nologo /E /TC
+*_VS2019_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2019_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2019_*_DLINK2_FLAGS = /WHOLEARCHIVE
+*_VS2019_*_ASM16_PATH = DEF(VS2019_BIN_IA32)\ml.exe
+*_VS2019_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS)
+##################
+# ASL definitions
+##################
+*_VS2019_*_ASL_PATH = DEF(WIN_IASL_BIN)
+*_VS2019_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_VS2019_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_VS2019_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
+*_VS2019_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
+*_VS2019_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+
+##################
+# IA32 definitions
+##################
+*_VS2019_IA32_CC_PATH = DEF(VS2019_BIN_IA32)\cl.exe
+*_VS2019_IA32_VFRPP_PATH = DEF(VS2019_BIN_IA32)\cl.exe
+*_VS2019_IA32_ASLCC_PATH = DEF(VS2019_BIN_IA32)\cl.exe
+*_VS2019_IA32_ASLPP_PATH = DEF(VS2019_BIN_IA32)\cl.exe
+*_VS2019_IA32_SLINK_PATH = DEF(VS2019_BIN_IA32)\lib.exe
+*_VS2019_IA32_DLINK_PATH = DEF(VS2019_BIN_IA32)\link.exe
+*_VS2019_IA32_ASLDLINK_PATH= DEF(VS2019_BIN_IA32)\link.exe
+*_VS2019_IA32_APP_PATH = DEF(VS2019_BIN_IA32)\cl.exe
+*_VS2019_IA32_PP_PATH = DEF(VS2019_BIN_IA32)\cl.exe
+*_VS2019_IA32_ASM_PATH = DEF(VS2019_BIN_IA32)\ml.exe
+
+ *_VS2019_IA32_MAKE_FLAGS = /nologo
+ DEBUG_VS2019_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Gw
+RELEASE_VS2019_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw
+NOOPT_VS2019_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od
+
+ DEBUG_VS2019_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+RELEASE_VS2019_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
+NOOPT_VS2019_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
+
+ DEBUG_VS2019_IA32_NASM_FLAGS = -Ox -f win32 -g
+RELEASE_VS2019_IA32_NASM_FLAGS = -Ox -f win32
+NOOPT_VS2019_IA32_NASM_FLAGS = -O0 -f win32 -g
+
+ DEBUG_VS2019_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2019_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2019_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+##################
+# X64 definitions
+##################
+*_VS2019_X64_CC_PATH = DEF(VS2019_BIN_X64)\cl.exe
+*_VS2019_X64_PP_PATH = DEF(VS2019_BIN_X64)\cl.exe
+*_VS2019_X64_APP_PATH = DEF(VS2019_BIN_X64)\cl.exe
+*_VS2019_X64_VFRPP_PATH = DEF(VS2019_BIN_X64)\cl.exe
+*_VS2019_X64_ASLCC_PATH = DEF(VS2019_BIN_X64)\cl.exe
+*_VS2019_X64_ASLPP_PATH = DEF(VS2019_BIN_X64)\cl.exe
+*_VS2019_X64_ASM_PATH = DEF(VS2019_BIN_X64)\ml64.exe
+*_VS2019_X64_SLINK_PATH = DEF(VS2019_BIN_X64)\lib.exe
+*_VS2019_X64_DLINK_PATH = DEF(VS2019_BIN_X64)\link.exe
+*_VS2019_X64_ASLDLINK_PATH = DEF(VS2019_BIN_X64)\link.exe
+
+ DEBUG_VS2019_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Gw
+RELEASE_VS2019_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw
+NOOPT_VS2019_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od
+
+ DEBUG_VS2019_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+RELEASE_VS2019_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
+NOOPT_VS2019_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
+
+ DEBUG_VS2019_X64_NASM_FLAGS = -Ox -f win64 -g
+RELEASE_VS2019_X64_NASM_FLAGS = -Ox -f win64
+NOOPT_VS2019_X64_NASM_FLAGS = -O0 -f win64 -g
+
+ DEBUG_VS2019_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2019_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2019_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+#################
+# ARM definitions
+#################
+*_VS2019_ARM_CC_PATH = DEF(VS2019_BIN_ARM)\cl.exe
+*_VS2019_ARM_VFRPP_PATH = DEF(VS2019_BIN_ARM)\cl.exe
+*_VS2019_ARM_SLINK_PATH = DEF(VS2019_BIN_ARM)\lib.exe
+*_VS2019_ARM_DLINK_PATH = DEF(VS2019_BIN_ARM)\link.exe
+*_VS2019_ARM_APP_PATH = DEF(VS2019_BIN_ARM)\cl.exe
+*_VS2019_ARM_PP_PATH = DEF(VS2019_BIN_ARM)\cl.exe
+*_VS2019_ARM_ASM_PATH = DEF(VS2019_BIN_ARM)\armasm.exe
+*_VS2019_ARM_ASLCC_PATH = DEF(VS2019_BIN_ARM)\cl.exe
+*_VS2019_ARM_ASLPP_PATH = DEF(VS2019_BIN_ARM)\cl.exe
+*_VS2019_ARM_ASLDLINK_PATH = DEF(VS2019_BIN_ARM)\link.exe
+
+ *_VS2019_ARM_MAKE_FLAGS = /nologo
+ DEBUG_VS2019_ARM_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gw /Oi-
+RELEASE_VS2019_ARM_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Oi-
+NOOPT_VS2019_ARM_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Od /Oi-
+
+ DEBUG_VS2019_ARM_ASM_FLAGS = /nologo /g
+RELEASE_VS2019_ARM_ASM_FLAGS = /nologo
+NOOPT_VS2019_ARM_ASM_FLAGS = /nologo
+
+ DEBUG_VS2019_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+RELEASE_VS2019_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2019_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
+
+#####################
+# AARCH64 definitions
+#####################
+*_VS2019_AARCH64_CC_PATH = DEF(VS2019_BIN_AARCH64)\cl.exe
+*_VS2019_AARCH64_VFRPP_PATH = DEF(VS2019_BIN_AARCH64)\cl.exe
+*_VS2019_AARCH64_SLINK_PATH = DEF(VS2019_BIN_AARCH64)\lib.exe
+*_VS2019_AARCH64_DLINK_PATH = DEF(VS2019_BIN_AARCH64)\link.exe
+*_VS2019_AARCH64_APP_PATH = DEF(VS2019_BIN_AARCH64)\cl.exe
+*_VS2019_AARCH64_PP_PATH = DEF(VS2019_BIN_AARCH64)\cl.exe
+*_VS2019_AARCH64_ASM_PATH = DEF(VS2019_BIN_AARCH64)\armasm64.exe
+*_VS2019_AARCH64_ASLCC_PATH = DEF(VS2019_BIN_AARCH64)\cl.exe
+*_VS2019_AARCH64_ASLPP_PATH = DEF(VS2019_BIN_AARCH64)\cl.exe
+*_VS2019_AARCH64_ASLDLINK_PATH = DEF(VS2019_BIN_AARCH64)\link.exe
+
+ *_VS2019_AARCH64_MAKE_FLAGS = /nologo
+ DEBUG_VS2019_AARCH64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gw /Oi-
+RELEASE_VS2019_AARCH64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Oi-
+NOOPT_VS2019_AARCH64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Od /Oi-
+
+ DEBUG_VS2019_AARCH64_ASM_FLAGS = /nologo /g
+RELEASE_VS2019_AARCH64_ASM_FLAGS = /nologo
+NOOPT_VS2019_AARCH64_ASM_FLAGS = /nologo
+
+ DEBUG_VS2019_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /DRIVER /DEBUG
+RELEASE_VS2019_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /DRIVER /MERGE:.rdata=.data
+NOOPT_VS2019_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /DRIVER /DEBUG
+
+##################
+# EBC definitions
+##################
+*_VS2019_EBC_*_FAMILY = INTEL
+
+*_VS2019_EBC_PP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2019_EBC_VFRPP_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2019_EBC_CC_PATH = DEF(EBC_BINx86)\iec.exe
+*_VS2019_EBC_SLINK_PATH = DEF(VS2019_BIN_IA32)\link.exe
+*_VS2019_EBC_DLINK_PATH = DEF(VS2019_BIN_IA32)\link.exe
+
+*_VS2019_EBC_MAKE_FLAGS = /nologo
+*_VS2019_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
+*_VS2019_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
+*_VS2019_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
+*_VS2019_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
+*_VS2019_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
+
+####################################################################################
+# GCC Common
+####################################################################################
+
+*_*_*_OBJCOPY_PATH = echo
+*_*_*_OBJCOPY_FLAGS = objcopy not needed for
+*_*_*_SYMRENAME_PATH = echo
+*_*_*_SYMRENAME_FLAGS = Symbol renaming not needed for
+DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug
+RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG =
+NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug
+*_*_*_DTC_FLAGS = -H epapr
+*_*_*_DTCPP_PATH = DEF(DTCPP_BIN)
+*_*_*_DTC_PATH = DEF(DTC_BIN)
+
+DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common
+DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe
+DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe
+DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft -fno-pic -fno-pie
+DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access
+DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie -ffixed-x18
+DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align -mgeneral-regs-only
+DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie
+DEFINE GCC_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
+DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
+DEFINE GCC_ARM_AARCH64_DLINK_COMMON= -Wl,--emit-relocs -nostdlib -Wl,--gc-sections -u $(IMAGE_ENTRY_POINT) -Wl,-e,$(IMAGE_ENTRY_POINT),-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z common-page-size=0x20 -Wl,--pic-veneer
+DEFINE GCC_AARCH64_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z common-page-size=0x20
+DEFINE GCC_ARM_AARCH64_ASLDLINK_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(GCC_DLINK2_FLAGS_COMMON) -z common-page-size=0x20
+DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
+DEFINE GCC_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS)
+DEFINE GCC_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS)
+DEFINE GCC_IA32_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros AutoGen.h
+DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h
+DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include $(MODULE_NAME)StrDefs.h
+DEFINE GCC_ASLPP_FLAGS = -x c -E -include AutoGen.h
+DEFINE GCC_ASLCC_FLAGS = -x c
+DEFINE GCC_WINDRES_FLAGS = -J rc -O coff
+DEFINE GCC_DTCPP_FLAGS = -E -x assembler-with-cpp -imacros AutoGen.h -nostdinc -undef
+DEFINE GCC_IA32_RC_FLAGS = -I binary -O elf32-i386 -B i386 --rename-section .data=.hii
+DEFINE GCC_X64_RC_FLAGS = -I binary -O elf64-x86-64 -B i386 --rename-section .data=.hii
+DEFINE GCC_ARM_RC_FLAGS = -I binary -O elf32-littlearm -B arm --rename-section .data=.hii
+DEFINE GCC_AARCH64_RC_FLAGS = -I binary -O elf64-littleaarch64 -B aarch64 --rename-section .data=.hii
+DEFINE GCC_RISCV64_RC_FLAGS = -I binary -O elf64-littleriscv -B riscv --rename-section .data=.hii
+
+# GCC Build Flag for included header file list generation
+DEFINE GCC_DEPS_FLAGS = -MMD -MF $@.deps
+
+DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
+DEFINE GCC48_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20
+DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address
+DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address
+DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
+DEFINE GCC48_IA32_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
+DEFINE GCC48_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON)
+DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_FLAGS) -Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie
+DEFINE GCC48_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 DEF(GCC_DLINK2_FLAGS_COMMON)
+DEFINE GCC48_ASM_FLAGS = DEF(GCC_ASM_FLAGS)
+DEFINE GCC48_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
+DEFINE GCC48_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
+DEFINE GCC48_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations
+DEFINE GCC48_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS)
+DEFINE GCC48_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS)
+DEFINE GCC48_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
+DEFINE GCC48_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--oformat=elf32-littlearm
+DEFINE GCC48_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220
+DEFINE GCC48_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS)
+DEFINE GCC48_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x228
+DEFINE GCC48_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_ASLDLINK_FLAGS) -Wl,--oformat=elf32-littlearm
+DEFINE GCC48_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_ASLDLINK_FLAGS)
+DEFINE GCC48_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+
+DEFINE GCC49_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -fno-pic -fno-pie
+DEFINE GCC49_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS)
+DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x40
+DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
+DEFINE GCC49_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
+DEFINE GCC49_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS)
+DEFINE GCC49_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie
+DEFINE GCC49_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS)
+DEFINE GCC49_ASM_FLAGS = DEF(GCC48_ASM_FLAGS)
+DEFINE GCC49_ARM_ASM_FLAGS = DEF(GCC48_ARM_ASM_FLAGS)
+DEFINE GCC49_AARCH64_ASM_FLAGS = DEF(GCC48_AARCH64_ASM_FLAGS)
+DEFINE GCC49_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS)
+DEFINE GCC49_ARM_CC_XIPFLAGS = DEF(GCC48_ARM_CC_XIPFLAGS)
+DEFINE GCC49_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC48_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -mcmodel=small
+DEFINE GCC49_AARCH64_CC_XIPFLAGS = DEF(GCC48_AARCH64_CC_XIPFLAGS)
+DEFINE GCC49_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
+DEFINE GCC49_ARM_DLINK2_FLAGS = DEF(GCC48_ARM_DLINK2_FLAGS)
+DEFINE GCC49_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
+DEFINE GCC49_AARCH64_DLINK2_FLAGS = DEF(GCC48_AARCH64_DLINK2_FLAGS)
+DEFINE GCC49_ARM_ASLDLINK_FLAGS = DEF(GCC48_ARM_ASLDLINK_FLAGS)
+DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
+DEFINE GCC49_ASLCC_FLAGS = DEF(GCC48_ASLCC_FLAGS)
+
+DEFINE GCC5_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS)
+DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS)
+DEFINE GCC5_IA32_X64_DLINK_COMMON = DEF(GCC49_IA32_X64_DLINK_COMMON)
+DEFINE GCC5_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS)
+DEFINE GCC5_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS)
+DEFINE GCC5_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS) -Wno-error
+DEFINE GCC5_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS)
+DEFINE GCC5_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS) -Wno-error
+DEFINE GCC5_ASM_FLAGS = DEF(GCC49_ASM_FLAGS)
+DEFINE GCC5_ARM_ASM_FLAGS = DEF(GCC49_ARM_ASM_FLAGS)
+DEFINE GCC5_AARCH64_ASM_FLAGS = DEF(GCC49_AARCH64_ASM_FLAGS)
+DEFINE GCC5_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS)
+DEFINE GCC5_ARM_CC_XIPFLAGS = DEF(GCC49_ARM_CC_XIPFLAGS)
+DEFINE GCC5_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS)
+DEFINE GCC5_AARCH64_CC_XIPFLAGS = DEF(GCC49_AARCH64_CC_XIPFLAGS)
+DEFINE GCC5_ARM_DLINK_FLAGS = DEF(GCC49_ARM_DLINK_FLAGS)
+DEFINE GCC5_ARM_DLINK2_FLAGS = DEF(GCC49_ARM_DLINK2_FLAGS) -Wno-error
+DEFINE GCC5_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS)
+DEFINE GCC5_AARCH64_DLINK2_FLAGS = DEF(GCC49_AARCH64_DLINK2_FLAGS) -Wno-error
+DEFINE GCC5_ARM_ASLDLINK_FLAGS = DEF(GCC49_ARM_ASLDLINK_FLAGS)
+DEFINE GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC49_AARCH64_ASLDLINK_FLAGS)
+DEFINE GCC5_ASLCC_FLAGS = DEF(GCC49_ASLCC_FLAGS) -fno-lto
+
+DEFINE GCC5_RISCV_ALL_CC_FLAGS = -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings -msmall-data-limit=0
+DEFINE GCC5_RISCV_ALL_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x40
+DEFINE GCC5_RISCV_ALL_DLINK_FLAGS = DEF(GCC5_RISCV_ALL_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC5_RISCV_ALL_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
+DEFINE GCC5_RISCV_ALL_ASM_FLAGS = -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h
+DEFINE GCC5_RISCV_ALL_CC_FLAGS_WARNING_DISABLE = -Wno-tautological-compare -Wno-pointer-compare
+
+DEFINE GCC5_RISCV_OPENSBI_TYPES = -DOPENSBI_EXTERNAL_SBI_TYPES=OpensbiTypes.h
+
+DEFINE GCC5_RISCV64_ARCH = rv64imafdc
+DEFINE GCC5_RISCV32_RISCV64_ASLDLINK_FLAGS = DEF(GCC5_RISCV_ALL_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
+DEFINE GCC5_RISCV64_CC_FLAGS = DEF(GCC5_RISCV_ALL_CC_FLAGS) DEF(GCC5_RISCV_ALL_CC_FLAGS_WARNING_DISABLE) DEF(GCC5_RISCV_OPENSBI_TYPES) -march=DEF(GCC5_RISCV64_ARCH) -fno-builtin -fno-builtin-memcpy -fno-stack-protector -Wno-address -fno-asynchronous-unwind-tables -Wno-unused-but-set-variable -fpack-struct=8 -mcmodel=medany -mabi=lp64 -mno-relax
+DEFINE GCC5_RISCV64_DLINK_FLAGS = DEF(GCC5_RISCV_ALL_DLINK_FLAGS) -Wl,-melf64lriscv,--oformat=elf64-littleriscv,--no-relax
+DEFINE GCC5_RISCV64_DLINK2_FLAGS = DEF(GCC5_RISCV_ALL_DLINK2_FLAGS)
+DEFINE GCC5_RISCV64_ASM_FLAGS = DEF(GCC5_RISCV_ALL_ASM_FLAGS) -march=DEF(GCC5_RISCV64_ARCH) -mcmodel=medany -mabi=lp64
+DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h DEF(GCC5_RISCV_OPENSBI_TYPES)
+
+####################################################################################
+#
+# GCC 4.8 - This configuration is used to compile under Linux to produce
+# PE/COFF binaries using GCC 4.8.
+#
+####################################################################################
+*_GCC48_*_*_FAMILY = GCC
+
+*_GCC48_*_MAKE_PATH = DEF(GCC_HOST_PREFIX)make
+*_GCC48_*_*_DLL = ENV(GCC48_DLL)
+*_GCC48_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+*_GCC48_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
+*_GCC48_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
+*_GCC48_*_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+*_GCC48_*_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
+*_GCC48_*_APP_FLAGS =
+*_GCC48_*_ASL_FLAGS = DEF(IASL_FLAGS)
+*_GCC48_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+*_GCC48_*_DEPS_FLAGS = DEF(GCC_DEPS_FLAGS)
+
+##################
+# GCC48 IA32 definitions
+##################
+*_GCC48_IA32_OBJCOPY_PATH = DEF(GCC48_IA32_PREFIX)objcopy
+*_GCC48_IA32_CC_PATH = DEF(GCC48_IA32_PREFIX)gcc
+*_GCC48_IA32_SLINK_PATH = DEF(GCC48_IA32_PREFIX)ar
+*_GCC48_IA32_DLINK_PATH = DEF(GCC48_IA32_PREFIX)gcc
+*_GCC48_IA32_ASLDLINK_PATH = DEF(GCC48_IA32_PREFIX)gcc
+*_GCC48_IA32_ASM_PATH = DEF(GCC48_IA32_PREFIX)gcc
+*_GCC48_IA32_PP_PATH = DEF(GCC48_IA32_PREFIX)gcc
+*_GCC48_IA32_VFRPP_PATH = DEF(GCC48_IA32_PREFIX)gcc
+*_GCC48_IA32_ASLCC_PATH = DEF(GCC48_IA32_PREFIX)gcc
+*_GCC48_IA32_ASLPP_PATH = DEF(GCC48_IA32_PREFIX)gcc
+*_GCC48_IA32_RC_PATH = DEF(GCC48_IA32_PREFIX)objcopy
+
+*_GCC48_IA32_ASLCC_FLAGS = DEF(GCC48_ASLCC_FLAGS) -m32
+*_GCC48_IA32_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
+*_GCC48_IA32_ASM_FLAGS = DEF(GCC48_ASM_FLAGS) -m32 -march=i386
+*_GCC48_IA32_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_FLAGS) -Wl,-m,elf_i386,--oformat=elf32-i386
+*_GCC48_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS)
+*_GCC48_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
+*_GCC48_IA32_OBJCOPY_FLAGS =
+*_GCC48_IA32_NASM_FLAGS = -f elf32
+
+ DEBUG_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os
+RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable
+ NOOPT_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -O0
+
+##################
+# GCC48 X64 definitions
+##################
+*_GCC48_X64_OBJCOPY_PATH = DEF(GCC48_X64_PREFIX)objcopy
+*_GCC48_X64_CC_PATH = DEF(GCC48_X64_PREFIX)gcc
+*_GCC48_X64_SLINK_PATH = DEF(GCC48_X64_PREFIX)ar
+*_GCC48_X64_DLINK_PATH = DEF(GCC48_X64_PREFIX)gcc
+*_GCC48_X64_ASLDLINK_PATH = DEF(GCC48_X64_PREFIX)gcc
+*_GCC48_X64_ASM_PATH = DEF(GCC48_X64_PREFIX)gcc
+*_GCC48_X64_PP_PATH = DEF(GCC48_X64_PREFIX)gcc
+*_GCC48_X64_VFRPP_PATH = DEF(GCC48_X64_PREFIX)gcc
+*_GCC48_X64_ASLCC_PATH = DEF(GCC48_X64_PREFIX)gcc
+*_GCC48_X64_ASLPP_PATH = DEF(GCC48_X64_PREFIX)gcc
+*_GCC48_X64_RC_PATH = DEF(GCC48_X64_PREFIX)objcopy
+
+*_GCC48_X64_ASLCC_FLAGS = DEF(GCC48_ASLCC_FLAGS) -m64
+*_GCC48_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
+*_GCC48_X64_ASM_FLAGS = DEF(GCC48_ASM_FLAGS) -m64
+*_GCC48_X64_DLINK_FLAGS = DEF(GCC48_X64_DLINK_FLAGS)
+*_GCC48_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS)
+*_GCC48_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
+*_GCC48_X64_OBJCOPY_FLAGS =
+*_GCC48_X64_NASM_FLAGS = -f elf64
+
+ DEBUG_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Os
+RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Os -Wno-unused-but-set-variable
+ NOOPT_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -O0
+
+##################
+# GCC48 ARM definitions
+##################
+*_GCC48_ARM_CC_PATH = ENV(GCC48_ARM_PREFIX)gcc
+*_GCC48_ARM_SLINK_PATH = ENV(GCC48_ARM_PREFIX)ar
+*_GCC48_ARM_DLINK_PATH = ENV(GCC48_ARM_PREFIX)gcc
+*_GCC48_ARM_ASLDLINK_PATH = ENV(GCC48_ARM_PREFIX)gcc
+*_GCC48_ARM_ASM_PATH = ENV(GCC48_ARM_PREFIX)gcc
+*_GCC48_ARM_PP_PATH = ENV(GCC48_ARM_PREFIX)gcc
+*_GCC48_ARM_VFRPP_PATH = ENV(GCC48_ARM_PREFIX)gcc
+*_GCC48_ARM_ASLCC_PATH = ENV(GCC48_ARM_PREFIX)gcc
+*_GCC48_ARM_ASLPP_PATH = ENV(GCC48_ARM_PREFIX)gcc
+*_GCC48_ARM_RC_PATH = ENV(GCC48_ARM_PREFIX)objcopy
+
+*_GCC48_ARM_ARCHCC_FLAGS = -mthumb
+*_GCC48_ARM_PLATFORM_FLAGS = -march=armv7-a
+
+*_GCC48_ARM_ASLCC_FLAGS = DEF(GCC48_ASLCC_FLAGS)
+*_GCC48_ARM_ASLDLINK_FLAGS = DEF(GCC48_ARM_ASLDLINK_FLAGS)
+*_GCC48_ARM_ASM_FLAGS = DEF(GCC48_ARM_ASM_FLAGS)
+*_GCC48_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
+*_GCC48_ARM_DLINK2_FLAGS = DEF(GCC48_ARM_DLINK2_FLAGS)
+*_GCC48_ARM_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS)
+*_GCC48_ARM_PLATFORM_FLAGS = -march=armv7-a
+*_GCC48_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
+*_GCC48_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
+*_GCC48_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+*_GCC48_ARM_CC_XIPFLAGS = DEF(GCC48_ARM_CC_XIPFLAGS)
+
+ DEBUG_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -O0
+RELEASE_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-variable
+ NOOPT_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -O0
+
+##################
+# GCC48 AARCH64 definitions
+##################
+*_GCC48_AARCH64_CC_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
+*_GCC48_AARCH64_SLINK_PATH = ENV(GCC48_AARCH64_PREFIX)ar
+*_GCC48_AARCH64_DLINK_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
+*_GCC48_AARCH64_ASLDLINK_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
+*_GCC48_AARCH64_ASM_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
+*_GCC48_AARCH64_PP_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
+*_GCC48_AARCH64_VFRPP_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
+*_GCC48_AARCH64_ASLCC_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
+*_GCC48_AARCH64_ASLPP_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
+*_GCC48_AARCH64_RC_PATH = ENV(GCC48_AARCH64_PREFIX)objcopy
+
+*_GCC48_AARCH64_ASLCC_FLAGS = DEF(GCC48_ASLCC_FLAGS)
+*_GCC48_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
+*_GCC48_AARCH64_ASM_FLAGS = DEF(GCC48_AARCH64_ASM_FLAGS)
+*_GCC48_AARCH64_DLINK_FLAGS = DEF(GCC48_AARCH64_DLINK_FLAGS)
+*_GCC48_AARCH64_DLINK2_FLAGS = DEF(GCC48_AARCH64_DLINK2_FLAGS)
+*_GCC48_AARCH64_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS)
+*_GCC48_AARCH64_PLATFORM_FLAGS =
+*_GCC48_AARCH64_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
+*_GCC48_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS)
+*_GCC48_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+*_GCC48_AARCH64_CC_XIPFLAGS = DEF(GCC48_AARCH64_CC_XIPFLAGS)
+
+ DEBUG_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -O0
+RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable
+ NOOPT_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -O0
+
+####################################################################################
+#
+# GCC 4.9 - This configuration is used to compile under Linux to produce
+# PE/COFF binaries using GCC 4.9.
+#
+####################################################################################
+*_GCC49_*_*_FAMILY = GCC
+
+*_GCC49_*_MAKE_PATH = DEF(GCC_HOST_PREFIX)make
+*_GCC49_*_*_DLL = ENV(GCC49_DLL)
+*_GCC49_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+*_GCC49_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
+*_GCC49_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
+*_GCC49_*_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+*_GCC49_*_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
+*_GCC49_*_APP_FLAGS =
+*_GCC49_*_ASL_FLAGS = DEF(IASL_FLAGS)
+*_GCC49_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+*_GCC49_*_DEPS_FLAGS = DEF(GCC_DEPS_FLAGS)
+
+##################
+# GCC49 IA32 definitions
+##################
+*_GCC49_IA32_OBJCOPY_PATH = DEF(GCC49_IA32_PREFIX)objcopy
+*_GCC49_IA32_CC_PATH = DEF(GCC49_IA32_PREFIX)gcc
+*_GCC49_IA32_SLINK_PATH = DEF(GCC49_IA32_PREFIX)ar
+*_GCC49_IA32_DLINK_PATH = DEF(GCC49_IA32_PREFIX)gcc
+*_GCC49_IA32_ASLDLINK_PATH = DEF(GCC49_IA32_PREFIX)gcc
+*_GCC49_IA32_ASM_PATH = DEF(GCC49_IA32_PREFIX)gcc
+*_GCC49_IA32_PP_PATH = DEF(GCC49_IA32_PREFIX)gcc
+*_GCC49_IA32_VFRPP_PATH = DEF(GCC49_IA32_PREFIX)gcc
+*_GCC49_IA32_ASLCC_PATH = DEF(GCC49_IA32_PREFIX)gcc
+*_GCC49_IA32_ASLPP_PATH = DEF(GCC49_IA32_PREFIX)gcc
+*_GCC49_IA32_RC_PATH = DEF(GCC49_IA32_PREFIX)objcopy
+
+*_GCC49_IA32_ASLCC_FLAGS = DEF(GCC49_ASLCC_FLAGS) -m32
+*_GCC49_IA32_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
+*_GCC49_IA32_ASM_FLAGS = DEF(GCC49_ASM_FLAGS) -m32 -march=i386
+*_GCC49_IA32_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -Wl,-m,elf_i386,--oformat=elf32-i386
+*_GCC49_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS)
+*_GCC49_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
+*_GCC49_IA32_OBJCOPY_FLAGS =
+*_GCC49_IA32_NASM_FLAGS = -f elf32
+
+ DEBUG_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os
+RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable -Wno-unused-const-variable
+ NOOPT_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -O0
+
+##################
+# GCC49 X64 definitions
+##################
+*_GCC49_X64_OBJCOPY_PATH = DEF(GCC49_X64_PREFIX)objcopy
+*_GCC49_X64_CC_PATH = DEF(GCC49_X64_PREFIX)gcc
+*_GCC49_X64_SLINK_PATH = DEF(GCC49_X64_PREFIX)ar
+*_GCC49_X64_DLINK_PATH = DEF(GCC49_X64_PREFIX)gcc
+*_GCC49_X64_ASLDLINK_PATH = DEF(GCC49_X64_PREFIX)gcc
+*_GCC49_X64_ASM_PATH = DEF(GCC49_X64_PREFIX)gcc
+*_GCC49_X64_PP_PATH = DEF(GCC49_X64_PREFIX)gcc
+*_GCC49_X64_VFRPP_PATH = DEF(GCC49_X64_PREFIX)gcc
+*_GCC49_X64_ASLCC_PATH = DEF(GCC49_X64_PREFIX)gcc
+*_GCC49_X64_ASLPP_PATH = DEF(GCC49_X64_PREFIX)gcc
+*_GCC49_X64_RC_PATH = DEF(GCC49_X64_PREFIX)objcopy
+
+*_GCC49_X64_ASLCC_FLAGS = DEF(GCC49_ASLCC_FLAGS) -m64
+*_GCC49_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
+*_GCC49_X64_ASM_FLAGS = DEF(GCC49_ASM_FLAGS) -m64
+*_GCC49_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS)
+*_GCC49_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS)
+*_GCC49_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
+*_GCC49_X64_OBJCOPY_FLAGS =
+*_GCC49_X64_NASM_FLAGS = -f elf64
+
+ DEBUG_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Os
+RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Os -Wno-unused-but-set-variable -Wno-unused-const-variable
+ NOOPT_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -O0
+
+##################
+# GCC49 ARM definitions
+##################
+*_GCC49_ARM_CC_PATH = ENV(GCC49_ARM_PREFIX)gcc
+*_GCC49_ARM_SLINK_PATH = ENV(GCC49_ARM_PREFIX)ar
+*_GCC49_ARM_DLINK_PATH = ENV(GCC49_ARM_PREFIX)gcc
+*_GCC49_ARM_ASLDLINK_PATH = ENV(GCC49_ARM_PREFIX)gcc
+*_GCC49_ARM_ASM_PATH = ENV(GCC49_ARM_PREFIX)gcc
+*_GCC49_ARM_PP_PATH = ENV(GCC49_ARM_PREFIX)gcc
+*_GCC49_ARM_VFRPP_PATH = ENV(GCC49_ARM_PREFIX)gcc
+*_GCC49_ARM_ASLCC_PATH = ENV(GCC49_ARM_PREFIX)gcc
+*_GCC49_ARM_ASLPP_PATH = ENV(GCC49_ARM_PREFIX)gcc
+*_GCC49_ARM_RC_PATH = ENV(GCC49_ARM_PREFIX)objcopy
+
+*_GCC49_ARM_ARCHCC_FLAGS = -mthumb
+*_GCC49_ARM_PLATFORM_FLAGS = -march=armv7-a
+
+*_GCC49_ARM_ASLCC_FLAGS = DEF(GCC49_ASLCC_FLAGS)
+*_GCC49_ARM_ASLDLINK_FLAGS = DEF(GCC49_ARM_ASLDLINK_FLAGS)
+*_GCC49_ARM_ASM_FLAGS = DEF(GCC49_ARM_ASM_FLAGS)
+*_GCC49_ARM_DLINK_FLAGS = DEF(GCC49_ARM_DLINK_FLAGS)
+*_GCC49_ARM_DLINK2_FLAGS = DEF(GCC49_ARM_DLINK2_FLAGS)
+*_GCC49_ARM_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS)
+*_GCC49_ARM_PLATFORM_FLAGS = -march=armv7-a
+*_GCC49_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
+*_GCC49_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
+*_GCC49_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+*_GCC49_ARM_CC_XIPFLAGS = DEF(GCC49_ARM_CC_XIPFLAGS)
+
+ DEBUG_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -O0
+RELEASE_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-variable -Wno-unused-const-variable
+ NOOPT_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -O0
+
+##################
+# GCC49 AARCH64 definitions
+##################
+*_GCC49_AARCH64_CC_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
+*_GCC49_AARCH64_SLINK_PATH = ENV(GCC49_AARCH64_PREFIX)ar
+*_GCC49_AARCH64_DLINK_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
+*_GCC49_AARCH64_ASLDLINK_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
+*_GCC49_AARCH64_ASM_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
+*_GCC49_AARCH64_PP_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
+*_GCC49_AARCH64_VFRPP_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
+*_GCC49_AARCH64_ASLCC_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
+*_GCC49_AARCH64_ASLPP_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
+*_GCC49_AARCH64_RC_PATH = ENV(GCC49_AARCH64_PREFIX)objcopy
+
+*_GCC49_AARCH64_ASLCC_FLAGS = DEF(GCC49_ASLCC_FLAGS)
+*_GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC49_AARCH64_ASLDLINK_FLAGS)
+*_GCC49_AARCH64_ASM_FLAGS = DEF(GCC49_AARCH64_ASM_FLAGS)
+*_GCC49_AARCH64_DLINK2_FLAGS = DEF(GCC49_AARCH64_DLINK2_FLAGS)
+*_GCC49_AARCH64_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS)
+*_GCC49_AARCH64_PLATFORM_FLAGS =
+*_GCC49_AARCH64_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
+*_GCC49_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS)
+*_GCC49_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+*_GCC49_AARCH64_CC_XIPFLAGS = DEF(GCC49_AARCH64_CC_XIPFLAGS)
+
+ DEBUG_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0
+ DEBUG_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS)
+ DEBUG_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
+
+RELEASE_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable -Wno-unused-const-variable
+RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS)
+RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
+
+ NOOPT_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0
+ NOOPT_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) -O0
+ NOOPT_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 -O0
+
+####################################################################################
+#
+# GCC 5 - This configuration is used to compile under Linux to produce
+# PE/COFF binaries using GCC 5
+#
+####################################################################################
+*_GCC5_*_*_FAMILY = GCC
+
+*_GCC5_*_MAKE_PATH = DEF(GCC_HOST_PREFIX)make
+*_GCC5_*_*_DLL = ENV(GCC5_DLL)
+*_GCC5_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+*_GCC5_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
+*_GCC5_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
+*_GCC5_*_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+*_GCC5_*_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
+*_GCC5_*_APP_FLAGS =
+*_GCC5_*_ASL_FLAGS = DEF(IASL_FLAGS)
+*_GCC5_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+*_GCC5_*_DEPS_FLAGS = DEF(GCC_DEPS_FLAGS)
+
+##################
+# GCC5 IA32 definitions
+##################
+*_GCC5_IA32_OBJCOPY_PATH = DEF(GCC5_IA32_PREFIX)objcopy
+*_GCC5_IA32_CC_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_SLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc-ar
+*_GCC5_IA32_DLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASLDLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASM_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_PP_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_VFRPP_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASLCC_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASLPP_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_RC_PATH = DEF(GCC5_IA32_PREFIX)objcopy
+
+*_GCC5_IA32_ASLCC_FLAGS = DEF(GCC5_ASLCC_FLAGS) -m32
+*_GCC5_IA32_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -no-pie
+*_GCC5_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386
+*_GCC5_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -no-pie
+*_GCC5_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
+*_GCC5_IA32_OBJCOPY_FLAGS =
+*_GCC5_IA32_NASM_FLAGS = -f elf32
+
+ DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -flto -Os
+ DEBUG_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,-m,elf_i386,--oformat=elf32-i386
+
+RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -flto -Os -Wno-unused-but-set-variable -Wno-unused-const-variable
+RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,-m,elf_i386,--oformat=elf32-i386
+
+ NOOPT_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -O0
+ NOOPT_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-m,elf_i386,--oformat=elf32-i386 -O0
+
+##################
+# GCC5 X64 definitions
+##################
+*_GCC5_X64_OBJCOPY_PATH = DEF(GCC5_X64_PREFIX)objcopy
+*_GCC5_X64_CC_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_SLINK_PATH = DEF(GCC5_X64_PREFIX)gcc-ar
+*_GCC5_X64_DLINK_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASLDLINK_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASM_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_PP_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_VFRPP_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASLCC_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASLPP_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_RC_PATH = DEF(GCC5_X64_PREFIX)objcopy
+
+*_GCC5_X64_ASLCC_FLAGS = DEF(GCC5_ASLCC_FLAGS) -m64
+*_GCC5_X64_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
+*_GCC5_X64_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m64
+*_GCC5_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS)
+*_GCC5_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
+*_GCC5_X64_OBJCOPY_FLAGS =
+*_GCC5_X64_NASM_FLAGS = -f elf64
+
+ DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO -Os
+ DEBUG_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os
+
+RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO -Os -Wno-unused-but-set-variable -Wno-unused-const-variable
+RELEASE_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os
+
+ NOOPT_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -O0
+ NOOPT_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -O0
+
+##################
+# GCC5 ARM definitions
+##################
+*_GCC5_ARM_CC_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_SLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc-ar
+*_GCC5_ARM_DLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_ASLDLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_ASM_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_PP_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_VFRPP_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_ASLCC_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_ASLPP_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_RC_PATH = ENV(GCC5_ARM_PREFIX)objcopy
+
+*_GCC5_ARM_ARCHCC_FLAGS = -mthumb
+*_GCC5_ARM_ASLCC_FLAGS = DEF(GCC5_ASLCC_FLAGS)
+*_GCC5_ARM_ASLDLINK_FLAGS = DEF(GCC5_ARM_ASLDLINK_FLAGS)
+*_GCC5_ARM_ASM_FLAGS = DEF(GCC5_ARM_ASM_FLAGS)
+*_GCC5_ARM_DLINK2_FLAGS = DEF(GCC5_ARM_DLINK2_FLAGS)
+*_GCC5_ARM_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS)
+*_GCC5_ARM_PLATFORM_FLAGS = -march=armv7-a
+*_GCC5_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
+*_GCC5_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
+*_GCC5_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+*_GCC5_ARM_CC_XIPFLAGS = DEF(GCC5_ARM_CC_XIPFLAGS)
+
+ DEBUG_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable
+ DEBUG_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
+
+RELEASE_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable
+RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
+
+ NOOPT_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -O0
+ NOOPT_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -O0
+
+##################
+# GCC5 AARCH64 definitions
+##################
+*_GCC5_AARCH64_CC_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_SLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc-ar
+*_GCC5_AARCH64_DLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_ASLDLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_ASM_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_PP_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_VFRPP_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_ASLCC_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_ASLPP_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_RC_PATH = ENV(GCC5_AARCH64_PREFIX)objcopy
+
+*_GCC5_AARCH64_ASLCC_FLAGS = DEF(GCC5_ASLCC_FLAGS)
+*_GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC5_AARCH64_ASLDLINK_FLAGS)
+*_GCC5_AARCH64_ASM_FLAGS = DEF(GCC5_AARCH64_ASM_FLAGS)
+*_GCC5_AARCH64_DLINK2_FLAGS = DEF(GCC5_AARCH64_DLINK2_FLAGS)
+*_GCC5_AARCH64_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS)
+*_GCC5_AARCH64_PLATFORM_FLAGS =
+*_GCC5_AARCH64_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
+*_GCC5_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS)
+*_GCC5_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+*_GCC5_AARCH64_CC_XIPFLAGS = DEF(GCC5_AARCH64_CC_XIPFLAGS)
+
+ DEBUG_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable
+ DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch
+ DEBUG_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
+
+RELEASE_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable
+RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch
+RELEASE_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
+
+ NOOPT_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -O0
+ NOOPT_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -O0
+ NOOPT_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 -O0
+
+####################################################################################
+#
+# GCC RISC-V This configuration is used to compile under Linux to produce
+# PE/COFF binaries using GCC RISC-V tool chain
+#
+####################################################################################
+
+##################
+# GCC5 RISCV64 definitions
+##################
+*_GCC5_RISCV64_OBJCOPY_PATH = ENV(GCC5_RISCV64_PREFIX)objcopy
+*_GCC5_RISCV64_CC_PATH = ENV(GCC5_RISCV64_PREFIX)gcc
+*_GCC5_RISCV64_SLINK_PATH = ENV(GCC5_RISCV64_PREFIX)gcc-ar
+*_GCC5_RISCV64_DLINK_PATH = ENV(GCC5_RISCV64_PREFIX)gcc
+*_GCC5_RISCV64_ASLDLINK_PATH = ENV(GCC5_RISCV64_PREFIX)gcc
+*_GCC5_RISCV64_ASM_PATH = ENV(GCC5_RISCV64_PREFIX)gcc
+*_GCC5_RISCV64_PP_PATH = ENV(GCC5_RISCV64_PREFIX)gcc
+*_GCC5_RISCV64_VFRPP_PATH = ENV(GCC5_RISCV64_PREFIX)gcc
+*_GCC5_RISCV64_ASLCC_PATH = ENV(GCC5_RISCV64_PREFIX)gcc
+*_GCC5_RISCV64_ASLPP_PATH = ENV(GCC5_RISCV64_PREFIX)gcc
+*_GCC5_RISCV64_RC_PATH = ENV(GCC5_RISCV64_PREFIX)objcopy
+
+*_GCC5_RISCV64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+*_GCC5_RISCV64_ASLDLINK_FLAGS = DEF(GCC5_RISCV32_RISCV64_ASLDLINK_FLAGS)
+*_GCC5_RISCV64_ASM_FLAGS = DEF(GCC5_RISCV64_ASM_FLAGS)
+*_GCC5_RISCV64_CC_FLAGS = DEF(GCC5_RISCV64_CC_FLAGS) -save-temps
+*_GCC5_RISCV64_DLINK_FLAGS = DEF(GCC5_RISCV64_DLINK_FLAGS)
+*_GCC5_RISCV64_DLINK2_FLAGS = DEF(GCC5_RISCV64_DLINK2_FLAGS)
+*_GCC5_RISCV64_RC_FLAGS = DEF(GCC_RISCV64_RC_FLAGS)
+*_GCC5_RISCV64_OBJCOPY_FLAGS =
+
+####################################################################################
+#
+# CLANG35 - This configuration is used to compile under Linux to produce
+# PE/COFF binaries using the clang compiler and assembler (v3.5 and up)
+# and GNU linker
+#
+####################################################################################
+*_CLANG35_*_*_FAMILY = GCC
+
+*_CLANG35_*_MAKE_PATH = make
+*_CLANG35_*_*_DLL = ENV(CLANG35_DLL)
+*_CLANG35_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+*_CLANG35_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
+*_CLANG35_*_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+*_CLANG35_*_APP_FLAGS =
+*_CLANG35_*_ASL_FLAGS = DEF(IASL_FLAGS)
+*_CLANG35_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+*_CLANG35_*_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS)
+
+*_CLANG35_*_CC_PATH = ENV(CLANG35_BIN)clang
+*_CLANG35_*_ASM_PATH = ENV(CLANG35_BIN)clang
+*_CLANG35_*_PP_PATH = ENV(CLANG35_BIN)clang
+*_CLANG35_*_VFRPP_PATH = ENV(CLANG35_BIN)clang
+*_CLANG35_*_ASLCC_PATH = ENV(CLANG35_BIN)clang
+*_CLANG35_*_ASLPP_PATH = ENV(CLANG35_BIN)clang
+*_CLANG35_*_DLINK_PATH = ENV(CLANG35_BIN)clang
+*_CLANG35_*_ASLDLINK_PATH = ENV(CLANG35_BIN)clang
+*_CLANG35_*_DEPS_FLAGS = DEF(GCC_DEPS_FLAGS)
+
+DEFINE CLANG35_ARM_TARGET = -target arm-linux-gnueabi
+DEFINE CLANG35_AARCH64_TARGET = -target aarch64-linux-gnu
+
+DEFINE CLANG35_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-unknown-warning-option
+DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG35_ARM_TARGET) DEF(CLANG35_WARNING_OVERRIDES)
+DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG35_AARCH64_TARGET) -mcmodel=small DEF(CLANG35_WARNING_OVERRIDES)
+
+##################
+# CLANG35 ARM definitions
+##################
+*_CLANG35_ARM_SLINK_PATH = ENV(CLANG35_ARM_PREFIX)ar
+*_CLANG35_ARM_RC_PATH = ENV(CLANG35_ARM_PREFIX)objcopy
+
+*_CLANG35_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+*_CLANG35_ARM_ASLDLINK_FLAGS = DEF(CLANG35_ARM_TARGET) DEF(GCC_ARM_ASLDLINK_FLAGS)
+*_CLANG35_ARM_ASM_FLAGS = DEF(GCC_ASM_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments
+*_CLANG35_ARM_DLINK_FLAGS = DEF(CLANG35_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS)
+*_CLANG35_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220
+*_CLANG35_ARM_PLATFORM_FLAGS = -march=armv7-a -mkernel -Qunused-arguments
+*_CLANG35_ARM_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
+*_CLANG35_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
+*_CLANG35_ARM_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
+*_CLANG35_ARM_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG35_ARM_TARGET)
+*_CLANG35_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS)
+
+ DEBUG_CLANG35_ARM_CC_FLAGS = DEF(CLANG35_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O1
+RELEASE_CLANG35_ARM_CC_FLAGS = DEF(CLANG35_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -Oz
+ NOOPT_CLANG35_ARM_CC_FLAGS = DEF(CLANG35_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0
+
+##################
+# CLANG35 AARCH64 definitions
+##################
+*_CLANG35_AARCH64_SLINK_PATH = ENV(CLANG35_AARCH64_PREFIX)ar
+*_CLANG35_AARCH64_RC_PATH = ENV(CLANG35_AARCH64_PREFIX)objcopy
+
+*_CLANG35_AARCH64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+*_CLANG35_AARCH64_ASLDLINK_FLAGS = DEF(CLANG35_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS)
+*_CLANG35_AARCH64_ASM_FLAGS = DEF(GCC_ASM_FLAGS) DEF(CLANG35_AARCH64_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments
+*_CLANG35_AARCH64_DLINK_FLAGS = DEF(CLANG35_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
+*_CLANG35_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
+*_CLANG35_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x228
+*_CLANG35_AARCH64_PLATFORM_FLAGS =
+*_CLANG35_AARCH64_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG35_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
+*_CLANG35_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS)
+*_CLANG35_AARCH64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG35_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
+*_CLANG35_AARCH64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG35_AARCH64_TARGET)
+*_CLANG35_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
+
+ DEBUG_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O1
+RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -Oz
+ NOOPT_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0
+
+####################################################################################
+#
+# Clang 3.8 - This configuration is used to compile under Linux to produce
+# PE/COFF binaries using LLVM/Clang 3.8 with Link Time Optimization enabled
+#
+####################################################################################
+*_CLANG38_*_*_FAMILY = GCC
+*_CLANG38_*_MAKE_PATH = make
+*_CLANG38_*_*_DLL = ENV(CLANG38_DLL)
+*_CLANG38_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+*_CLANG38_*_APP_FLAGS =
+*_CLANG38_*_ASL_FLAGS = DEF(IASL_FLAGS)
+*_CLANG38_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+*_CLANG38_*_DEPS_FLAGS = DEF(GCC_DEPS_FLAGS)
+DEFINE CLANG38_IA32_PREFIX = ENV(CLANG38_BIN)
+DEFINE CLANG38_X64_PREFIX = ENV(CLANG38_BIN)
+
+DEFINE CLANG38_IA32_TARGET = -target i686-pc-linux-gnu
+DEFINE CLANG38_X64_TARGET = -target x86_64-pc-linux-gnu
+
+DEFINE CLANG38_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option
+DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference
+
+###########################
+# CLANG38 IA32 definitions
+###########################
+*_CLANG38_IA32_OBJCOPY_PATH = objcopy
+*_CLANG38_IA32_CC_PATH = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANG38_IA32_SLINK_PATH = DEF(CLANG38_IA32_PREFIX)llvm-ar
+*_CLANG38_IA32_DLINK_PATH = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANG38_IA32_ASLDLINK_PATH = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANG38_IA32_ASM_PATH = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANG38_IA32_PP_PATH = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANG38_IA32_VFRPP_PATH = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANG38_IA32_ASLCC_PATH = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANG38_IA32_ASLPP_PATH = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANG38_IA32_RC_PATH = objcopy
+
+*_CLANG38_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto DEF(CLANG38_IA32_TARGET)
+*_CLANG38_IA32_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
+*_CLANG38_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 DEF(CLANG38_IA32_TARGET)
+*_CLANG38_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
+*_CLANG38_IA32_OBJCOPY_FLAGS =
+*_CLANG38_IA32_NASM_FLAGS = -f elf32
+*_CLANG38_IA32_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_IA32_TARGET)
+*_CLANG38_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_IA32_TARGET)
+*_CLANG38_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_IA32_TARGET)
+
+DEBUG_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g
+DEBUG_CLANG38_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_i386 -Wl,--oformat=elf32-i386
+DEBUG_CLANG38_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -O3
+
+RELEASE_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET)
+RELEASE_CLANG38_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_i386 -Wl,--oformat=elf32-i386
+RELEASE_CLANG38_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -O3
+
+NOOPT_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586 DEF(CLANG38_IA32_TARGET) -g
+NOOPT_CLANG38_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_i386 -Wl,--oformat=elf32-i386
+NOOPT_CLANG38_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -O0
+
+##########################
+# CLANG38 X64 definitions
+##########################
+*_CLANG38_X64_OBJCOPY_PATH = objcopy
+*_CLANG38_X64_CC_PATH = DEF(CLANG38_X64_PREFIX)clang
+*_CLANG38_X64_SLINK_PATH = DEF(CLANG38_X64_PREFIX)llvm-ar
+*_CLANG38_X64_DLINK_PATH = DEF(CLANG38_X64_PREFIX)clang
+*_CLANG38_X64_ASLDLINK_PATH = DEF(CLANG38_X64_PREFIX)clang
+*_CLANG38_X64_ASM_PATH = DEF(CLANG38_X64_PREFIX)clang
+*_CLANG38_X64_PP_PATH = DEF(CLANG38_X64_PREFIX)clang
+*_CLANG38_X64_VFRPP_PATH = DEF(CLANG38_X64_PREFIX)clang
+*_CLANG38_X64_ASLCC_PATH = DEF(CLANG38_X64_PREFIX)clang
+*_CLANG38_X64_ASLPP_PATH = DEF(CLANG38_X64_PREFIX)clang
+*_CLANG38_X64_RC_PATH = objcopy
+
+*_CLANG38_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 -fno-lto DEF(CLANG38_X64_TARGET)
+*_CLANG38_X64_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
+*_CLANG38_X64_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m64 DEF(CLANG38_X64_TARGET)
+*_CLANG38_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
+*_CLANG38_X64_OBJCOPY_FLAGS =
+*_CLANG38_X64_NASM_FLAGS = -f elf64
+*_CLANG38_X64_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_X64_TARGET)
+*_CLANG38_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_X64_TARGET)
+*_CLANG38_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_X64_TARGET)
+
+DEBUG_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g
+DEBUG_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small
+DEBUG_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O3
+
+RELEASE_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET)
+RELEASE_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small
+RELEASE_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O3
+
+NOOPT_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -O0 DEF(CLANG38_X64_TARGET) -g
+NOOPT_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small
+NOOPT_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O0
+
+##################
+# CLANG38 ARM definitions
+##################
+DEFINE CLANG38_ARM_TARGET = -target arm-linux-gnueabi
+DEFINE CLANG38_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG38_ARM_TARGET) DEF(CLANG38_WARNING_OVERRIDES) -mno-movt
+DEFINE CLANG38_ARM_DLINK_FLAGS = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS)
+
+*_CLANG38_ARM_PP_FLAGS = DEF(GCC_PP_FLAGS)
+*_CLANG38_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+*_CLANG38_ARM_APP_FLAGS =
+*_CLANG38_ARM_ASL_FLAGS = DEF(IASL_FLAGS)
+*_CLANG38_ARM_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+*_CLANG38_ARM_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS)
+
+*_CLANG38_ARM_CC_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_ASM_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_PP_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_VFRPP_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_ASLCC_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_ASLPP_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_DLINK_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_ASLDLINK_PATH = ENV(CLANG38_BIN)clang
+
+*_CLANG38_ARM_SLINK_PATH = ENV(CLANG38_BIN)llvm-ar
+*_CLANG38_ARM_RC_PATH = ENV(CLANG38_ARM_PREFIX)objcopy
+
+*_CLANG38_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -fno-lto
+*_CLANG38_ARM_ASLDLINK_FLAGS = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_ASLDLINK_FLAGS)
+*_CLANG38_ARM_ASM_FLAGS = DEF(GCC_ASM_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments
+*_CLANG38_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220
+*_CLANG38_ARM_PLATFORM_FLAGS = -march=armv7-a
+*_CLANG38_ARM_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
+*_CLANG38_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
+*_CLANG38_ARM_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
+*_CLANG38_ARM_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_ARM_TARGET)
+*_CLANG38_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS)
+
+ DEBUG_CLANG38_ARM_CC_FLAGS = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O1
+ DEBUG_CLANG38_ARM_DLINK_FLAGS = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O1 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
+ NOOPT_CLANG38_ARM_CC_FLAGS = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0
+ NOOPT_CLANG38_ARM_DLINK_FLAGS = DEF(CLANG38_ARM_DLINK_FLAGS)
+RELEASE_CLANG38_ARM_CC_FLAGS = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O3
+RELEASE_CLANG38_ARM_DLINK_FLAGS = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
+
+##################
+# CLANG38 AARCH64 definitions
+##################
+DEFINE CLANG38_AARCH64_TARGET = -target aarch64-linux-gnu
+DEFINE CLANG38_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG38_AARCH64_TARGET) -mcmodel=small DEF(CLANG38_WARNING_OVERRIDES)
+DEFINE CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
+
+*_CLANG38_AARCH64_PP_FLAGS = DEF(GCC_PP_FLAGS)
+*_CLANG38_AARCH64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+*_CLANG38_AARCH64_APP_FLAGS =
+*_CLANG38_AARCH64_ASL_FLAGS = DEF(IASL_FLAGS)
+*_CLANG38_AARCH64_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+*_CLANG38_AARCH64_DTCPP_FLAGS = DEF(GCC_DTCPP_FLAGS)
+
+*_CLANG38_AARCH64_CC_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_ASM_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_PP_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_VFRPP_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_ASLCC_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_ASLPP_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_DLINK_PATH = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_ASLDLINK_PATH = ENV(CLANG38_BIN)clang
+
+*_CLANG38_AARCH64_SLINK_PATH = ENV(CLANG38_BIN)llvm-ar
+*_CLANG38_AARCH64_RC_PATH = ENV(CLANG38_AARCH64_PREFIX)objcopy
+
+*_CLANG38_AARCH64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -fno-lto
+*_CLANG38_AARCH64_ASLDLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS)
+*_CLANG38_AARCH64_ASM_FLAGS = DEF(GCC_ASM_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments
+*_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
+*_CLANG38_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
+*_CLANG38_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x228
+*_CLANG38_AARCH64_PLATFORM_FLAGS =
+*_CLANG38_AARCH64_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
+*_CLANG38_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS)
+*_CLANG38_AARCH64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
+*_CLANG38_AARCH64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_AARCH64_TARGET)
+*_CLANG38_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
+
+ DEBUG_CLANG38_AARCH64_CC_FLAGS = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O1
+ DEBUG_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O1 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64
+ NOOPT_CLANG38_AARCH64_CC_FLAGS = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0
+ NOOPT_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS)
+RELEASE_CLANG38_AARCH64_CC_FLAGS = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O3
+RELEASE_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64
+
+####################################################################################
+#
+# CLANGPDB - This configuration is used to compile under Windows/Linux/Mac to produce
+# PE/COFF binaries using LLVM/Clang/LLD with Link Time Optimization enabled
+#
+####################################################################################
+*_CLANGPDB_*_*_FAMILY = GCC
+*_CLANGPDB_*_*_BUILDRULEFAMILY = CLANGPDB
+*_CLANGPDB_*_MAKE_PATH = ENV(CLANG_HOST_BIN)make
+*_CLANGPDB_*_*_DLL = ENV(CLANGPDB_DLL)
+*_CLANGPDB_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+*_CLANGPDB_*_APP_FLAGS =
+*_CLANGPDB_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
+*_CLANGPDB_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
+*_CLANGPDB_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
+*_CLANGPDB_*_DEPS_FLAGS = DEF(GCC_DEPS_FLAGS)
+
+DEFINE CLANGPDB_IA32_PREFIX = ENV(CLANG_BIN)
+DEFINE CLANGPDB_X64_PREFIX = ENV(CLANG_BIN)
+
+DEFINE CLANGPDB_IA32_TARGET = -target i686-unknown-windows-gnu
+DEFINE CLANGPDB_X64_TARGET = -target x86_64-unknown-windows-gnu
+
+DEFINE CLANGPDB_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option -Wno-microsoft-enum-forward-reference
+DEFINE CLANGPDB_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGPDB_WARNING_OVERRIDES) -fno-stack-protector -funsigned-char -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -Wno-null-dereference -mno-implicit-float -mms-bitfields -mno-stack-arg-probe -nostdlib -nostdlibinc -fseh-exceptions
+
+###########################
+# CLANGPDB IA32 definitions
+###########################
+*_CLANGPDB_IA32_CC_PATH = DEF(CLANGPDB_IA32_PREFIX)clang
+*_CLANGPDB_IA32_SLINK_PATH = DEF(CLANGPDB_IA32_PREFIX)llvm-lib
+*_CLANGPDB_IA32_DLINK_PATH = DEF(CLANGPDB_IA32_PREFIX)lld-link
+*_CLANGPDB_IA32_ASLDLINK_PATH = DEF(CLANGPDB_IA32_PREFIX)lld-link
+*_CLANGPDB_IA32_ASM_PATH = DEF(CLANGPDB_IA32_PREFIX)clang
+*_CLANGPDB_IA32_PP_PATH = DEF(CLANGPDB_IA32_PREFIX)clang
+*_CLANGPDB_IA32_VFRPP_PATH = DEF(CLANGPDB_IA32_PREFIX)clang
+*_CLANGPDB_IA32_ASLCC_PATH = DEF(CLANGPDB_IA32_PREFIX)clang
+*_CLANGPDB_IA32_ASLPP_PATH = DEF(CLANGPDB_IA32_PREFIX)clang
+*_CLANGPDB_IA32_RC_PATH = DEF(CLANGPDB_IA32_PREFIX)llvm-rc
+
+*_CLANGPDB_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto DEF(CLANGPDB_IA32_TARGET)
+*_CLANGPDB_IA32_ASM_FLAGS = DEF(GCC_ASM_FLAGS) -m32 -march=i386 DEF(CLANGPDB_IA32_TARGET)
+*_CLANGPDB_IA32_OBJCOPY_FLAGS =
+*_CLANGPDB_IA32_NASM_FLAGS = -f win32
+*_CLANGPDB_IA32_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANGPDB_IA32_TARGET)
+*_CLANGPDB_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANGPDB_IA32_TARGET)
+*_CLANGPDB_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANGPDB_IA32_TARGET)
+
+DEBUG_CLANGPDB_IA32_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANGPDB_IA32_TARGET) -gcodeview
+DEBUG_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap
+DEBUG_CLANGPDB_IA32_DLINK2_FLAGS =
+
+RELEASE_CLANGPDB_IA32_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANGPDB_IA32_TARGET)
+RELEASE_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /MLLVM:-exception-model=wineh /lldmap
+RELEASE_CLANGPDB_IA32_DLINK2_FLAGS =
+
+NOOPT_CLANGPDB_IA32_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m32 -O0 -march=i586 DEF(CLANGPDB_IA32_TARGET) -gcodeview
+NOOPT_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap
+NOOPT_CLANGPDB_IA32_DLINK2_FLAGS =
+
+##########################
+# CLANGWIN X64 definitions
+##########################
+*_CLANGPDB_X64_CC_PATH = DEF(CLANGPDB_X64_PREFIX)clang
+*_CLANGPDB_X64_SLINK_PATH = DEF(CLANGPDB_X64_PREFIX)llvm-lib
+*_CLANGPDB_X64_DLINK_PATH = DEF(CLANGPDB_X64_PREFIX)lld-link
+*_CLANGPDB_X64_ASLDLINK_PATH = DEF(CLANGPDB_X64_PREFIX)lld-link
+*_CLANGPDB_X64_ASM_PATH = DEF(CLANGPDB_X64_PREFIX)clang
+*_CLANGPDB_X64_PP_PATH = DEF(CLANGPDB_X64_PREFIX)clang
+*_CLANGPDB_X64_VFRPP_PATH = DEF(CLANGPDB_X64_PREFIX)clang
+*_CLANGPDB_X64_ASLCC_PATH = DEF(CLANGPDB_X64_PREFIX)clang
+*_CLANGPDB_X64_ASLPP_PATH = DEF(CLANGPDB_X64_PREFIX)clang
+*_CLANGPDB_X64_RC_PATH = DEF(CLANGPDB_IA32_PREFIX)llvm-rc
+
+*_CLANGPDB_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 -fno-lto DEF(CLANGPDB_X64_TARGET)
+*_CLANGPDB_X64_ASM_FLAGS = DEF(GCC_ASM_FLAGS) -m64 DEF(CLANGPDB_X64_TARGET)
+*_CLANGPDB_X64_OBJCOPY_FLAGS =
+*_CLANGPDB_X64_NASM_FLAGS = -f win64
+*_CLANGPDB_X64_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANGPDB_X64_TARGET)
+*_CLANGPDB_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANGPDB_X64_TARGET)
+*_CLANGPDB_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANGPDB_X64_TARGET)
+
+DEBUG_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -Oz -flto DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables
+DEBUG_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap
+DEBUG_CLANGPDB_X64_DLINK2_FLAGS =
+DEBUG_CLANGPDB_X64_GENFW_FLAGS = --keepexceptiontable
+
+RELEASE_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -Oz -flto DEF(CLANGPDB_X64_TARGET) -fno-unwind-tables
+RELEASE_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /MLLVM:-exception-model=wineh /lldmap
+RELEASE_CLANGPDB_X64_DLINK2_FLAGS =
+RELEASE_CLANGPDB_X64_GENFW_FLAGS =
+
+NOOPT_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -O0 DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables
+NOOPT_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap
+NOOPT_CLANGPDB_X64_DLINK2_FLAGS =
+NOOPT_CLANGPDB_X64_GENFW_FLAGS = --keepexceptiontable
+
+#
+#
+# XCODE5 support
+#
+
+*_XCODE5_*_*_FAMILY = GCC
+*_XCODE5_*_*_BUILDRULEFAMILY = XCODE
+
+#
+# use xcode-select to change Xcode version of command line tools
+#
+*_XCODE5_*_MAKE_PATH = make
+*_XCODE5_*_CC_PATH = clang
+*_XCODE5_*_SLINK_PATH = libtool
+*_XCODE5_*_DLINK_PATH = ld
+*_XCODE5_*_ASM_PATH = as
+*_XCODE5_*_PP_PATH = clang
+*_XCODE5_*_VFRPP_PATH = clang
+*_XCODE5_*_ASL_PATH = iasl
+*_XCODE5_*_ASLCC_PATH = clang
+*_XCODE5_*_ASLPP_PATH = clang
+*_XCODE5_*_ASLDLINK_PATH = ld
+*_XCODE5_*_DSYMUTIL_PATH = /usr/bin/dsymutil
+*_XCODE5_*_MTOC_PATH = /usr/local/bin/mtoc
+*_XCODE5_*_DEPS_FLAGS = DEF(GCC_DEPS_FLAGS)
+
+##################
+# ASL definitions
+##################
+*_XCODE5_*_ASLCC_FLAGS = -x c -save-temps -g -O0 -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -c -include AutoGen.h
+*_XCODE5_*_ASLDLINK_FLAGS = -e _ReferenceAcpiTable -preload -segalign 0x20 -pie -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+*_XCODE5_*_ASLPP_FLAGS = -x c -E -include AutoGen.h
+*_XCODE5_*_ASL_FLAGS =
+*_XCODE5_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+
+##################
+# MTOC definitions
+##################
+
+ DEBUG_XCODE5_*_MTOC_FLAGS = -align 0x20 -d $(DEBUG_DIR)/$(MODULE_NAME).dll
+ NOOPT_XCODE5_*_MTOC_FLAGS = -align 0x20 -d $(DEBUG_DIR)/$(MODULE_NAME).dll
+RELEASE_XCODE5_*_MTOC_FLAGS = -align 0x20
+
+####################
+# IA-32 definitions
+####################
+ DEBUG_XCODE5_IA32_DLINK_FLAGS = -arch i386 -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -pie -all_load -dead_strip -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+ NOOPT_XCODE5_IA32_DLINK_FLAGS = -arch i386 -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -pie -all_load -dead_strip -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+RELEASE_XCODE5_IA32_DLINK_FLAGS = -arch i386 -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -pie -all_load -dead_strip -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+
+*_XCODE5_IA32_SLINK_FLAGS = -static -o
+ DEBUG_XCODE5_IA32_ASM_FLAGS = -arch i386 -g
+ NOOPT_XCODE5_IA32_ASM_FLAGS = -arch i386 -g
+RELEASE_XCODE5_IA32_ASM_FLAGS = -arch i386
+ *_XCODE5_IA32_NASM_FLAGS = -f macho32
+
+
+ DEBUG_XCODE5_IA32_CC_FLAGS = -arch i386 -c -g -Os -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS)
+RELEASE_XCODE5_IA32_CC_FLAGS = -arch i386 -c -Os -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -Wno-unused-const-variable -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS)
+ NOOPT_XCODE5_IA32_CC_FLAGS = -arch i386 -c -g -O0 -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS)
+
+##################
+# X64 definitions
+##################
+ DEBUG_XCODE5_X64_DLINK_FLAGS = -arch x86_64 -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -pie -all_load -dead_strip -seg1addr 0x240 -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+ NOOPT_XCODE5_X64_DLINK_FLAGS = -arch x86_64 -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -pie -all_load -dead_strip -seg1addr 0x240 -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+RELEASE_XCODE5_X64_DLINK_FLAGS = -arch x86_64 -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -pie -all_load -dead_strip -seg1addr 0x240 -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+
+*_XCODE5_X64_SLINK_FLAGS = -static -o
+ DEBUG_XCODE5_X64_ASM_FLAGS = -arch x86_64 -g
+ NOOPT_XCODE5_X64_ASM_FLAGS = -arch x86_64 -g
+RELEASE_XCODE5_X64_ASM_FLAGS = -arch x86_64
+ *_XCODE5_X64_NASM_FLAGS = -f macho64
+*_XCODE5_*_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h
+*_XCODE5_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE -include $(MODULE_NAME)StrDefs.h
+
+ DEBUG_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -g -gdwarf -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
+ NOOPT_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -g -gdwarf -O0 -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
+RELEASE_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -Wno-unused-const-variable -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
+
+####################################################################################
+#
+# RVCT Common
+#
+####################################################################################
+
+DEFINE RVCT_ALL_ASM_FLAGS = --diag_suppress=1786 --diag_error=warning --apcs /interwork
+DEFINE RVCT_ALL_CC_FLAGS = --c90 --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --enum_is_int --preinclude AutoGen.h --diag_suppress=186,188,1,111,68 --diag_warning 167 --diag_error=warning --diag_style=ide --protect_stack
+DEFINE RVCT_ALL_DLINK_FLAGS = --no_scanlib --no_exceptions --datacompressor off --strict --symbols --diag_style=ide --no_legacyalign --scatter $(EDK_TOOLS_PATH)/Scripts/Rvct-Align32.sct
+
+####################################################################################
+#
+# ARM RealView Tools - Windows
+#
+####################################################################################
+# RVCT - Tools from ARM
+
+*_RVCT_*_*_FAMILY = RVCT
+
+#
+# Use default values, or override in DSC file
+#
+*_RVCT_ARM_ARCHCC_FLAGS = --thumb --fpu=softvfp
+*_RVCT_ARM_ARCHASM_FLAGS =
+*_RVCT_ARM_ARCHDLINK_FLAGS =
+*_RVCT_ARM_PLATFORM_FLAGS = --cpu 7-A
+
+ DEBUG_RVCT_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+RELEASE_RVCT_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+
+
+*_RVCT_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_ASM_FLAGS)
+*_RVCT_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E --preinclude AutoGen.h
+*_RVCT_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude $(MODULE_NAME)StrDefs.h
+*_RVCT_ARM_MAKE_PATH = nmake /NOLOGO
+*_RVCT_ARM_SLINK_FLAGS = --partial -o
+ DEBUG_RVCT_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_CC_FLAGS) -O1 -g
+RELEASE_RVCT_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --diag_suppress=550 DEF(RVCT_ALL_CC_FLAGS) -O2
+
+##################
+# ARM definitions
+##################
+*_RVCT_ARM_CC_PATH = ENV(RVCT_TOOLS_PATH)armcc
+*_RVCT_ARM_SLINK_PATH = ENV(RVCT_TOOLS_PATH)armlink
+*_RVCT_ARM_DLINK_PATH = ENV(RVCT_TOOLS_PATH)armlink
+*_RVCT_ARM_ASM_PATH = ENV(RVCT_TOOLS_PATH)armasm
+*_RVCT_ARM_PP_PATH = ENV(RVCT_TOOLS_PATH)armcc
+*_RVCT_ARM_VFRPP_PATH = ENV(RVCT_TOOLS_PATH)armcc
+*_RVCT_ARM_FROMELF_PATH = ENV(RVCT_TOOLS_PATH)fromelf
+
+####################################################################################
+#
+# ARM RealView Tools - Linux
+#
+####################################################################################
+# RVCTLINUX - Tools from ARM in a Cygwin environment
+*_RVCTLINUX_*_*_FAMILY = RVCT
+*_RVCTLINUX_*_*_BUILDRULEFAMILY = RVCTLINUX
+
+*_RVCTLINUX_*_MAKE_PATH = make
+
+#
+# Use default values, or override in DSC file
+#
+*_RVCTLINUX_ARM_ARCHCC_FLAGS = --thumb --fpu=softvfp
+*_RVCTLINUX_ARM_ARCHASM_FLAGS =
+*_RVCTLINUX_ARM_ARCHDLINK_FLAGS =
+*_RVCTLINUX_ARM_PLATFORM_FLAGS = --cpu 7-A
+
+DEBUG_RVCTLINUX_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+RELEASE_RVCTLINUX_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+
+*_RVCTLINUX_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_ASM_FLAGS)
+*_RVCTLINUX_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E
+*_RVCTLINUX_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude $(MODULE_NAME)StrDefs.h
+*_RVCTLINUX_ARM_SLINK_FLAGS = --partial -o
+ DEBUG_RVCTLINUX_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_CC_FLAGS) -O1 -g
+RELEASE_RVCTLINUX_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --diag_suppress=550 DEF(RVCT_ALL_CC_FLAGS) -O2
+
+##################
+# ARM definitions
+##################
+*_RVCTLINUX_ARM_CC_PATH = ENV(RVCT_TOOLS_PATH)armcc
+*_RVCTLINUX_ARM_SLINK_PATH = ENV(RVCT_TOOLS_PATH)armlink
+*_RVCTLINUX_ARM_DLINK_PATH = ENV(RVCT_TOOLS_PATH)armlink
+*_RVCTLINUX_ARM_ASM_PATH = ENV(RVCT_TOOLS_PATH)armasm
+*_RVCTLINUX_ARM_PP_PATH = ENV(RVCT_TOOLS_PATH)armcc
+*_RVCTLINUX_ARM_VFRPP_PATH = ENV(RVCT_TOOLS_PATH)armcc
+*_RVCTLINUX_ARM_FROMELF_PATH = ENV(RVCT_TOOLS_PATH)fromelf
+
+####################################################################################
+#
+# ARM RealView Tools - Cygwin
+#
+####################################################################################
+# ARMCYGWIN - Tools from ARM in a Cygwin environment
+
+*_RVCTCYGWIN_*_*_FAMILY = RVCT
+*_RVCTCYGWIN_*_*_BUILDRULEFAMILY = RVCTCYGWIN
+
+*_RVCTCYGWIN_ARM_CCPATH_FLAG = ENV(RVCT_TOOLS_PATH)armcc
+*_RVCTCYGWIN_ARM_SLINKPATH_FLAG = ENV(RVCT_TOOLS_PATH)armlink
+*_RVCTCYGWIN_ARM_DLINKPATH_FLAG = ENV(RVCT_TOOLS_PATH)armlink
+*_RVCTCYGWIN_ARM_ASMPATH_FLAG = ENV(RVCT_TOOLS_PATH)armasm
+*_RVCTCYGWIN_ARM_PPPATH_FLAG = ENV(RVCT_TOOLS_PATH)armcc
+*_RVCTCYGWIN_ARM_VFRPPPATH_FLAG = ENV(RVCT_TOOLS_PATH)armcc
+*_RVCTCYGWIN_ARM_FROMELFPATH_FLAG = ENV(RVCT_TOOLS_PATH)fromelf
+
+#
+# Use default values, or override in DSC file
+#
+*_RVCTCYGWIN_ARM_ARCHCC_FLAGS = --thumb --fpu=softvfp
+*_RVCTCYGWIN_ARM_ARCHASM_FLAGS =
+*_RVCTCYGWIN_ARM_ARCHDLINK_FLAGS =
+*_RVCTCYGWIN_ARM_PLATFORM_FLAGS = --cpu 7-A
+
+ DEBUG_RVCTCYGWIN_ARM_DLINK_FLAGS = "$(DLINKPATH_FLAG)" $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --map --list `cygpath -m $(DEST_DIR_DEBUG)/$(BASE_NAME).map`
+RELEASE_RVCTCYGWIN_ARM_DLINK_FLAGS = "$(DLINKPATH_FLAG)" $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --map --list `cygpath -m $(DEST_DIR_DEBUG)/$(BASE_NAME).map`
+
+*_RVCTCYGWIN_ARM_ASM_FLAGS = "$(ASMPATH_FLAG)" $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_ASM_FLAGS)
+*_RVCTCYGWIN_ARM_PP_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E
+*_RVCTCYGWIN_ARM_VFRPP_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude `cygpath -m $(MODULE_NAME)StrDefs.h`
+*_RVCTCYGWIN_ARM_MAKE_PATH = make
+*_RVCTCYGWIN_ARM_SLINK_FLAGS = "$(SLINKPATH_FLAG)" --partial -o
+ DEBUG_RVCTCYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_CC_FLAGS) -O1 -g
+RELEASE_RVCTCYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --diag_suppress=550 DEF(RVCT_ALL_CC_FLAGS) -O2
+
+##################
+# ARM definitions
+##################
+*_RVCTCYGWIN_ARM_CC_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
+*_RVCTCYGWIN_ARM_SLINK_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
+*_RVCTCYGWIN_ARM_DLINK_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
+*_RVCTCYGWIN_ARM_ASM_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
+*_RVCTCYGWIN_ARM_PP_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
+*_RVCTCYGWIN_ARM_VFRPP_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
+*_RVCTCYGWIN_ARM_FROMELF_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
+
+#################
+# ASM 16 linker definitions
+#################
+*_*_*_ASMLINK_PATH = DEF(WINDDK_BIN16)\link16.exe
+*_*_*_ASMLINK_FLAGS = /nologo /tiny
+
+##################
+# VfrCompiler definitions
+##################
+*_*_*_VFR_PATH = VfrCompile
+*_*_*_VFR_FLAGS = -l -n
+
+##################
+# OptionRom tool definitions
+##################
+*_*_*_OPTROM_PATH = EfiRom
+*_*_*_OPTROM_FLAGS = -e
+
+##################
+# GenFw tool definitions
+##################
+*_*_*_GENFW_PATH = GenFw
+*_*_*_GENFW_FLAGS =
+
+##################
+# Asl Compiler definitions
+##################
+*_*_*_ASLCC_FLAGS = /nologo /c /FIAutoGen.h /TC /Dmain=ReferenceAcpiTable
+*_*_*_ASLDLINK_FLAGS = /NODEFAULTLIB /ENTRY:ReferenceAcpiTable /SUBSYSTEM:CONSOLE
+*_*_*_ASLPP_FLAGS = /nologo /EP /C
+*_*_*_ASL_FLAGS =
+
+##################
+# GenCrc32 tool definitions
+##################
+*_*_*_CRC32_PATH = GenCrc32
+*_*_*_CRC32_GUID = FC1BCDB0-7D31-49AA-936A-A4600D9DD083
+
+##################
+# Rsa2048Sha256Sign tool definitions
+#
+# Notes: This tool definition uses a test signing key for development purposes only.
+# The tool Rsa2048Sha256GenerateKeys can be used to generate a new private/public key
+# and the gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer PCD value.
+# A custom tool/script can be implemented using the new private/public key with
+# the Rsa2048Sha256Sign tool and this tool definition can be updated to use a
+# custom tool/script.
+#
+# Generate new private/public key and gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer PCD value
+#
+# Rsa2048Sha256GenerateKeys.py -o MyKey.pem --public-key-hash-c MyKey.pcd
+#
+# Custom script example (MyRsa2048Sha256Sign.cmd):
+#
+# Rsa2048Sha256Sign --private-key MyKey.pem %1 %2 %3 %4 %5 %6 %7 %8 %9
+#
+# WARNING: Vendors that uses private keys are responsible for proper management and protection
+# of private keys. Vendors may choose to use infrastructure such as signing servers
+# or signing portals to support the management and protection of private keys.
+#
+##################
+*_*_*_RSA2048SHA256SIGN_PATH = Rsa2048Sha256Sign
+*_*_*_RSA2048SHA256SIGN_GUID = A7717414-C616-4977-9420-844712A735BF
+
+##################
+# BrotliCompress tool definitions
+##################
+*_*_*_BROTLI_PATH = BrotliCompress
+*_*_*_BROTLI_GUID = 3D532050-5CDA-4FD0-879E-0F7F630D5AFB
+
+##################
+# LzmaCompress tool definitions
+##################
+*_*_*_LZMA_PATH = LzmaCompress
+*_*_*_LZMA_GUID = EE4E5898-3914-4259-9D6E-DC7BD79403CF
+
+##################
+# LzmaF86Compress tool definitions with converter for x86 code.
+# It can improve the compression ratio if the input file is IA32 or X64 PE image.
+##################
+*_*_*_LZMAF86_PATH = LzmaF86Compress
+*_*_*_LZMAF86_GUID = D42AE6BD-1352-4bfb-909A-CA72A6EAE889
+
+##################
+# TianoCompress tool definitions
+##################
+*_*_*_TIANO_PATH = TianoCompress
+*_*_*_TIANO_GUID = A31280AD-481E-41B6-95E8-127F4C984779
+
+##################
+# BPDG tool definitions
+##################
+*_*_*_VPDTOOL_PATH = BPDG
+*_*_*_VPDTOOL_GUID = 8C3D856A-9BE6-468E-850A-24F7A8D38E08
+
+##################
+# Pkcs7Sign tool definitions
+##################
+*_*_*_PKCS7SIGN_PATH = Pkcs7Sign
+*_*_*_PKCS7SIGN_GUID = 4AAFD29D-68DF-49EE-8AA9-347D375665A7
+
+##################
+# NASM tool definitions
+##################
+*_*_*_NASM_PATH = ENV(NASM_PREFIX)nasm
+# NASMB uses NASM produce a .bin from a .nasmb NASM source file
+*_*_*_NASMB_FLAGS = -f bin
+
+#################
+# Build rule order
+#################
+*_*_*_*_BUILDRULEORDER = nasm asm Asm ASM S s nasmb asm16
diff --git a/roms/edk2/BaseTools/Edk2ToolsBuild.py b/roms/edk2/BaseTools/Edk2ToolsBuild.py
new file mode 100644
index 000000000..1ea8187de
--- /dev/null
+++ b/roms/edk2/BaseTools/Edk2ToolsBuild.py
@@ -0,0 +1,177 @@
+# @file Edk2ToolsBuild.py
+# Invocable class that builds the basetool c files.
+#
+# Supports VS2017, VS2019, and GCC5
+##
+# Copyright (c) Microsoft Corporation
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+import os
+import sys
+import logging
+import argparse
+import multiprocessing
+from edk2toolext import edk2_logging
+from edk2toolext.environment import self_describing_environment
+from edk2toolext.base_abstract_invocable import BaseAbstractInvocable
+from edk2toollib.utility_functions import RunCmd
+from edk2toollib.windows.locate_tools import QueryVcVariables
+
+
+class Edk2ToolsBuild(BaseAbstractInvocable):
+
+ def ParseCommandLineOptions(self):
+ ''' parse arguments '''
+ ParserObj = argparse.ArgumentParser()
+ ParserObj.add_argument("-t", "--tool_chain_tag", dest="tct", default="VS2017",
+ help="Set the toolchain used to compile the build tools")
+ args = ParserObj.parse_args()
+ self.tool_chain_tag = args.tct
+
+ def GetWorkspaceRoot(self):
+ ''' Return the workspace root for initializing the SDE '''
+
+ # this is the bastools dir...not the traditional EDK2 workspace root
+ return os.path.dirname(os.path.abspath(__file__))
+
+ def GetActiveScopes(self):
+ ''' return tuple containing scopes that should be active for this process '''
+
+ # for now don't use scopes
+ return ('global',)
+
+ def GetLoggingLevel(self, loggerType):
+ ''' Get the logging level for a given type (return Logging.Level)
+ base == lowest logging level supported
+ con == Screen logging
+ txt == plain text file logging
+ md == markdown file logging
+ '''
+ if(loggerType == "con"):
+ return logging.ERROR
+ else:
+ return logging.DEBUG
+
+ def GetLoggingFolderRelativeToRoot(self):
+ ''' Return a path to folder for log files '''
+ return "BaseToolsBuild"
+
+ def GetVerifyCheckRequired(self):
+ ''' Will call self_describing_environment.VerifyEnvironment if this returns True '''
+ return True
+
+ def GetLoggingFileName(self, loggerType):
+ ''' Get the logging file name for the type.
+ Return None if the logger shouldn't be created
+
+ base == lowest logging level supported
+ con == Screen logging
+ txt == plain text file logging
+ md == markdown file logging
+ '''
+ return "BASETOOLS_BUILD"
+
+ def WritePathEnvFile(self, OutputDir):
+ ''' Write a PyTool path env file for future PyTool based edk2 builds'''
+ content = '''##
+# Set shell variable EDK_TOOLS_BIN to this folder
+#
+# Autogenerated by Edk2ToolsBuild.py
+#
+# Copyright (c), Microsoft Corporation
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "id": "You-Built-BaseTools",
+ "scope": "edk2-build",
+ "flags": ["set_shell_var", "set_path"],
+ "var_name": "EDK_TOOLS_BIN"
+}
+'''
+ with open(os.path.join(OutputDir, "basetoolsbin_path_env.yaml"), "w") as f:
+ f.write(content)
+
+ def Go(self):
+ logging.info("Running Python version: " + str(sys.version_info))
+
+ (build_env, shell_env) = self_describing_environment.BootstrapEnvironment(
+ self.GetWorkspaceRoot(), self.GetActiveScopes())
+
+ # # Bind our current execution environment into the shell vars.
+ ph = os.path.dirname(sys.executable)
+ if " " in ph:
+ ph = '"' + ph + '"'
+ shell_env.set_shell_var("PYTHON_HOME", ph)
+ # PYTHON_COMMAND is required to be set for using edk2 python builds.
+ pc = sys.executable
+ if " " in pc:
+ pc = '"' + pc + '"'
+ shell_env.set_shell_var("PYTHON_COMMAND", pc)
+
+ if self.tool_chain_tag.lower().startswith("vs"):
+
+ # # Update environment with required VC vars.
+ interesting_keys = ["ExtensionSdkDir", "INCLUDE", "LIB"]
+ interesting_keys.extend(
+ ["LIBPATH", "Path", "UniversalCRTSdkDir", "UCRTVersion", "WindowsLibPath", "WindowsSdkBinPath"])
+ interesting_keys.extend(
+ ["WindowsSdkDir", "WindowsSdkVerBinPath", "WindowsSDKVersion", "VCToolsInstallDir"])
+ vc_vars = QueryVcVariables(
+ interesting_keys, 'x86', vs_version=self.tool_chain_tag.lower())
+ for key in vc_vars.keys():
+ logging.debug(f"Var - {key} = {vc_vars[key]}")
+ if key.lower() == 'path':
+ shell_env.insert_path(vc_vars[key])
+ else:
+ shell_env.set_shell_var(key, vc_vars[key])
+
+ self.OutputDir = os.path.join(
+ shell_env.get_shell_var("EDK_TOOLS_PATH"), "Bin", "Win32")
+
+ # compiled tools need to be added to path because antlr is referenced
+ shell_env.insert_path(self.OutputDir)
+
+ # Actually build the tools.
+ ret = RunCmd('nmake.exe', None,
+ workingdir=shell_env.get_shell_var("EDK_TOOLS_PATH"))
+ if ret != 0:
+ raise Exception("Failed to build.")
+
+ self.WritePathEnvFile(self.OutputDir)
+ return ret
+
+ elif self.tool_chain_tag.lower().startswith("gcc"):
+ cpu_count = self.GetCpuThreads()
+ ret = RunCmd("make", f"-C . -j {cpu_count}", workingdir=shell_env.get_shell_var("EDK_TOOLS_PATH"))
+ if ret != 0:
+ raise Exception("Failed to build.")
+
+ self.OutputDir = os.path.join(
+ shell_env.get_shell_var("EDK_TOOLS_PATH"), "Source", "C", "bin")
+
+ self.WritePathEnvFile(self.OutputDir)
+ return ret
+
+ logging.critical("Tool Chain not supported")
+ return -1
+
+ def GetCpuThreads(self) -> int:
+ ''' Function to return number of cpus. If error return 1'''
+ cpus = 1
+ try:
+ cpus = multiprocessing.cpu_count()
+ except:
+ # from the internet there are cases where cpu_count is not implemented.
+ # will handle error by just doing single proc build
+ pass
+ return cpus
+
+
+
+def main():
+ Edk2ToolsBuild().Invoke()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/roms/edk2/BaseTools/GNUmakefile b/roms/edk2/BaseTools/GNUmakefile
new file mode 100644
index 000000000..d29f6d9c9
--- /dev/null
+++ b/roms/edk2/BaseTools/GNUmakefile
@@ -0,0 +1,27 @@
+## @file
+# GNU/Linux makefile for Base Tools project build.
+#
+# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+all: subdirs
+
+LANGUAGES = C Python
+
+SOURCE_SUBDIRS := $(patsubst %,Source/%,$(sort $(LANGUAGES)))
+SUBDIRS := $(SOURCE_SUBDIRS) Tests
+CLEAN_SUBDIRS := $(patsubst %,%-clean,$(sort $(SUBDIRS)))
+
+.PHONY: subdirs $(SUBDIRS)
+subdirs: $(SUBDIRS)
+$(SUBDIRS):
+ $(MAKE) -C $@
+
+Tests: $(SOURCE_SUBDIRS)
+
+.PHONY: $(CLEAN_SUBDIRS)
+$(CLEAN_SUBDIRS):
+ -$(MAKE) -C $(@:-clean=) clean
+
+clean: $(CLEAN_SUBDIRS)
diff --git a/roms/edk2/BaseTools/Makefile b/roms/edk2/BaseTools/Makefile
new file mode 100644
index 000000000..10963009e
--- /dev/null
+++ b/roms/edk2/BaseTools/Makefile
@@ -0,0 +1,34 @@
+## @file
+# Windows makefile for Base Tools project build.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+!IFNDEF BASE_TOOLS_PATH
+!ERROR "BASE_TOOLS_PATH is not set! Please run toolsetup.bat first!"
+!ENDIF
+
+SUBDIRS = $(BASE_TOOLS_PATH)\Source\C $(BASE_TOOLS_PATH)\Source\Python
+
+all: c
+
+c :
+ @if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $(BASE_TOOLS_PATH)\Source\C
+ @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $(BASE_TOOLS_PATH)\Source\C
+
+
+subdirs: $(SUBDIRS)
+ @if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $**
+ @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $**
+
+.PHONY: clean
+clean:
+ @if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS)
+ @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS)
+
+.PHONY: cleanall
+cleanall:
+ @if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py cleanall $(SUBDIRS)
+ @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py cleanall $(SUBDIRS)
+
diff --git a/roms/edk2/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator.py b/roms/edk2/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator.py
new file mode 100644
index 000000000..9f86b1c35
--- /dev/null
+++ b/roms/edk2/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator.py
@@ -0,0 +1,69 @@
+##
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+import os
+import logging
+import json
+
+try:
+ from edk2toolext.environment.plugintypes.uefi_build_plugin import IUefiBuildPlugin
+
+ class BuildToolsReportGenerator(IUefiBuildPlugin):
+ def do_report(self, thebuilder):
+ try:
+ from edk2toolext.environment import version_aggregator
+ except ImportError:
+ logging.critical("Loading BuildToolsReportGenerator failed, please update your Edk2-PyTool-Extensions")
+ return 0
+
+ OutputReport = os.path.join(thebuilder.env.GetValue("BUILD_OUTPUT_BASE"), "BUILD_TOOLS_REPORT")
+ OutputReport = os.path.normpath(OutputReport)
+ if not os.path.isdir(os.path.dirname(OutputReport)):
+ os.makedirs(os.path.dirname(OutputReport))
+
+ Report = BuildToolsReport()
+ Report.MakeReport(version_aggregator.GetVersionAggregator().GetAggregatedVersionInformation(), OutputReport=OutputReport)
+
+ def do_pre_build(self, thebuilder):
+ self.do_report(thebuilder)
+ return 0
+
+ def do_post_build(self, thebuilder):
+ self.do_report(thebuilder)
+ return 0
+
+except ImportError:
+ pass
+
+
+class BuildToolsReport(object):
+ MY_FOLDER = os.path.dirname(os.path.realpath(__file__))
+ VERSION = "1.00"
+
+ def __init__(self):
+ pass
+
+ def MakeReport(self, BuildTools, OutputReport="BuildToolsReport"):
+ logging.info("Writing BuildToolsReports to {0}".format(OutputReport))
+ versions_list = []
+ for key, value in BuildTools.items():
+ versions_list.append(value)
+ versions_list = sorted(versions_list, key=lambda k: k['type'])
+ json_dict = {"modules": versions_list,
+ "PluginVersion": BuildToolsReport.VERSION}
+
+ htmlfile = open(OutputReport + ".html", "w")
+ jsonfile = open(OutputReport + ".json", "w")
+ template = open(os.path.join(BuildToolsReport.MY_FOLDER, "BuildToolsReport_Template.html"), "r")
+
+ for line in template.readlines():
+ if "%TO_BE_FILLED_IN_BY_PYTHON_SCRIPT%" in line:
+ line = line.replace("%TO_BE_FILLED_IN_BY_PYTHON_SCRIPT%", json.dumps(json_dict))
+ htmlfile.write(line)
+
+ jsonfile.write(json.dumps(versions_list, indent=4))
+
+ jsonfile.close()
+ template.close()
+ htmlfile.close()
diff --git a/roms/edk2/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator_plug_in.yaml b/roms/edk2/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator_plug_in.yaml
new file mode 100644
index 000000000..893353572
--- /dev/null
+++ b/roms/edk2/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator_plug_in.yaml
@@ -0,0 +1,12 @@
+## @file
+# Build Plugin used to output html report of all versions collected
+# during the build
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "global",
+ "name": "Build Tools Report Generator",
+ "module": "BuildToolsReportGenerator"
+}
diff --git a/roms/edk2/BaseTools/Plugin/BuildToolsReport/BuildToolsReport_Template.html b/roms/edk2/BaseTools/Plugin/BuildToolsReport/BuildToolsReport_Template.html
new file mode 100644
index 000000000..8273fdee4
--- /dev/null
+++ b/roms/edk2/BaseTools/Plugin/BuildToolsReport/BuildToolsReport_Template.html
@@ -0,0 +1,126 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible">
+ <title>Build Tools Report</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="stylesheet" type="text/css" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css" />
+ <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap.min.css" />
+ <style>
+ div.attribution {
+ border: 1px solid #ddd;
+ background-color: #bbb;
+ padding-left: 20px;
+ }
+ </style>
+</head>
+<body>
+ <div class="container-fluid">
+ <h1>Build Tools Report</h1>
+ <ul class="nav nav-tabs">
+ <li class="active"><a data-toggle="tab" href="#tabs-1">Tools</a></li>
+ <li><a data-toggle="tab" href="#tabs-2">About</a></li>
+ </ul>
+ <div class="tab-content">
+ <div id="tabs-1" class="tab-pane fade in active">
+ <table id="modinfo" class="table table-striped table-bordered table-hover" cellspacing="0">
+ <thead>
+ <tr>
+ <th>Key</th>
+ <th>Value</th>
+ <th>Type</th>
+ </tr>
+ </thead>
+ <tbody></tbody>
+ </table>
+ </div>
+ <div id="tabs-2" class="tab-pane">
+ <div class="row">
+ <div class="col-xs-7">
+ <p></p>
+ <p>
+ Build Tools Report Template Version: <span id="ReportTemplateVersion">1.00</span><br />
+ Build Tools Report Plugin Version: <span id='ReportToolVersion'></span><br />
+ </p>
+ <h3>License</h3>
+ <hr />
+ <div id="ToolLicenseContent">
+ <p>
+ <span class="copyright">Copyright (c) Microsoft Corporation.</span><br />
+ <span class="license">
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+ </span>
+ </p>
+ </div>
+ </div>
+ <div id="AttributionListWrapper" class="col-xs-5">
+ <h3>External Licenses</h3>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <!-- Javascript libraries -->
+ <script type="text/javascript" charset="utf8" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
+ <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
+ <script type="text/javascript" charset="utf8" src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"></script>
+ <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap.min.js"></script>
+
+ <script>
+ var EmbeddedJd = %TO_BE_FILLED_IN_BY_PYTHON_SCRIPT%;
+ </script>
+ <!-- Add javascript here -->
+ <script>
+ var MODULE_TABLE_OFFSET = 350; //Space needed for other stuff besides the Table
+ $(document).ready(function () {
+ $('span#ReportToolVersion').text(EmbeddedJd.PluginVersion);
+ //To support tabs and correct column width we need this change
+ $('a[data-toggle="tab"][href="#tabs-1"]').on('shown.bs.tab', function (e) {
+ $.fn.dataTable.tables({ visible: true, api: true }).columns.adjust();
+ });
+ //table for modules
+ var mTable = $('table#modinfo').dataTable({
+ "aaData": EmbeddedJd.modules,
+ "paginate": false,
+ "autoWidth": false,
+ "scrollY": ($(window).height() - MODULE_TABLE_OFFSET) + "px",
+ "aaSorting": [[2, "asc"]],
+ "aoColumnDefs": [
+ {
+ "mData": "name",
+ "aTargets": [0]
+ },
+
+ {
+ "mData": "version",
+ "aTargets": [1]
+ },
+ {
+ "mData": "type",
+ "aTargets": [2],
+ }
+ ] //end of column def
+ }); //end of modules table
+
+ //
+ // Create Attribution List for all external libraries used
+ //
+ [
+ { Title: "JQuery", Copyright: "Copyright 2017 The jQuery Foundation", Version: $.fn.jquery, LicenseType: "MIT", LicenseLink: "https://jquery.org/license/" },
+ { Title: "DataTables", Copyright: "DataTables designed and created by SpryMedia Ltd Copyright 2007-2017", Version: $.fn.dataTable.version, LicenseType: "MIT", LicenseLink: "https://datatables.net/license/mit" },
+ { Title: "BootStrap", Copyright: "Code and documentation copyright 2011-2017 the Bootstrap Authors and Twitter, Inc.", Version: "3.3.7", LicenseType: "MIT", LicenseLink: "https://github.com/twbs/bootstrap/blob/master/LICENSE" }
+ ].forEach(function (element) {
+ $("<div class='attribution'><h4>" + element.Title + "</h4><p>Version: <span class='version'>" + element.Version + "</span><br /><span class='copyright'>" +
+ element.Copyright + "</span><br />License: <a class='license' href='" + element.LicenseLink + "'>" + element.LicenseType + "</a></p></div>").appendTo("div#AttributionListWrapper");
+ });
+ });
+ $(window).resize(function() {
+ $.fn.dataTable.tables({ visible: true, api: true }).columns.adjust();
+ });
+
+
+ </script>
+</body>
+</html>
diff --git a/roms/edk2/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py b/roms/edk2/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
new file mode 100644
index 000000000..c1eeaf262
--- /dev/null
+++ b/roms/edk2/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -0,0 +1,115 @@
+# @file HostBasedUnitTestRunner.py
+# Plugin to located any host-based unit tests in the output directory and execute them.
+##
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+import os
+import logging
+import glob
+import stat
+import xml.etree.ElementTree
+from edk2toolext.environment.plugintypes.uefi_build_plugin import IUefiBuildPlugin
+from edk2toolext import edk2_logging
+import edk2toollib.windows.locate_tools as locate_tools
+from edk2toolext.environment import shell_environment
+from edk2toollib.utility_functions import RunCmd
+from edk2toollib.utility_functions import GetHostInfo
+
+
+class HostBasedUnitTestRunner(IUefiBuildPlugin):
+
+ def do_pre_build(self, thebuilder):
+ '''
+ Run Prebuild
+ '''
+
+ return 0
+
+ def do_post_build(self, thebuilder):
+ '''
+ After a build, will automatically locate and run all host-based unit tests. Logs any
+ failures with Warning severity and will return a count of the failures as the return code.
+
+ EXPECTS:
+ - Build Var 'CI_BUILD_TYPE' - If not set to 'host_unit_test', will not do anything.
+
+ UPDATES:
+ - Shell Var 'CMOCKA_XML_FILE'
+ '''
+ ci_type = thebuilder.env.GetValue('CI_BUILD_TYPE')
+ if ci_type != 'host_unit_test':
+ return 0
+
+ shell_env = shell_environment.GetEnvironment()
+ logging.log(edk2_logging.get_section_level(),
+ "Run Host based Unit Tests")
+ path = thebuilder.env.GetValue("BUILD_OUTPUT_BASE")
+
+ failure_count = 0
+
+ # Set up the reporting type for Cmocka.
+ shell_env.set_shell_var('CMOCKA_MESSAGE_OUTPUT', 'xml')
+
+ for arch in thebuilder.env.GetValue("TARGET_ARCH").split():
+ logging.log(edk2_logging.get_subsection_level(),
+ "Testing for architecture: " + arch)
+ cp = os.path.join(path, arch)
+
+ # If any old results XML files exist, clean them up.
+ for old_result in glob.iglob(os.path.join(cp, "*.result.xml")):
+ os.remove(old_result)
+
+ # Find and Run any Host Tests
+ if GetHostInfo().os.upper() == "LINUX":
+ testList = glob.glob(os.path.join(cp, "*Test*"))
+ for a in testList[:]:
+ p = os.path.join(cp, a)
+ # It must be a file
+ if not os.path.isfile(p):
+ testList.remove(a)
+ logging.debug(f"Remove directory file: {p}")
+ continue
+ # It must be executable
+ if os.stat(p).st_mode & (stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH) == 0:
+ testList.remove(a)
+ logging.debug(f"Remove non-executable file: {p}")
+ continue
+
+ logging.info(f"Test file found: {p}")
+
+ elif GetHostInfo().os.upper() == "WINDOWS":
+ testList = glob.glob(os.path.join(cp, "*Test*.exe"))
+ else:
+ raise NotImplementedError("Unsupported Operating System")
+
+ for test in testList:
+ # Configure output name.
+ shell_env.set_shell_var(
+ 'CMOCKA_XML_FILE', test + ".%g." + arch + ".result.xml")
+
+ # Run the test.
+ ret = RunCmd('"' + test + '"', "", workingdir=cp)
+ if(ret != 0):
+ logging.error("UnitTest Execution Error: " +
+ os.path.basename(test))
+ else:
+ logging.info("UnitTest Completed: " +
+ os.path.basename(test))
+ file_match_pattern = test + ".*." + arch + ".result.xml"
+ xml_results_list = glob.glob(file_match_pattern)
+ for xml_result_file in xml_results_list:
+ root = xml.etree.ElementTree.parse(
+ xml_result_file).getroot()
+ for suite in root:
+ for case in suite:
+ for result in case:
+ if result.tag == 'failure':
+ logging.warning(
+ "%s Test Failed" % os.path.basename(test))
+ logging.warning(
+ " %s - %s" % (case.attrib['name'], result.text))
+ failure_count += 1
+
+ return failure_count
diff --git a/roms/edk2/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner_plug_in.yaml b/roms/edk2/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner_plug_in.yaml
new file mode 100644
index 000000000..a0fbf3d2f
--- /dev/null
+++ b/roms/edk2/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner_plug_in.yaml
@@ -0,0 +1,12 @@
+##
+# IUefiBuildPlugin used to run any unittests that
+# were built on this build.
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "host-based-test",
+ "name": "Host-Based Unit Test Runner",
+ "module": "HostBasedUnitTestRunner"
+}
diff --git a/roms/edk2/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py b/roms/edk2/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
new file mode 100644
index 000000000..81075438d
--- /dev/null
+++ b/roms/edk2/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
@@ -0,0 +1,123 @@
+# @file LinuxGcc5ToolChain.py
+# Plugin to configures paths for GCC5 ARM/AARCH64 Toolchain
+##
+# This plugin works in conjuncture with the tools_def
+#
+# Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+import os
+import logging
+from edk2toolext.environment.plugintypes.uefi_build_plugin import IUefiBuildPlugin
+from edk2toolext.environment import shell_environment
+
+
+class LinuxGcc5ToolChain(IUefiBuildPlugin):
+
+ def do_post_build(self, thebuilder):
+ return 0
+
+ def do_pre_build(self, thebuilder):
+ self.Logger = logging.getLogger("LinuxGcc5ToolChain")
+
+ #
+ # GCC5 - The ARM and AARCH64 compilers need their paths set if available
+ if thebuilder.env.GetValue("TOOL_CHAIN_TAG") == "GCC5":
+
+ # Start with AARACH64 compiler
+ ret = self._check_aarch64()
+ if ret != 0:
+ self.Logger.critical("Failed in check aarch64")
+ return ret
+
+ # Check arm compiler
+ ret = self._check_arm()
+ if ret != 0:
+ self.Logger.critical("Failed in check arm")
+ return ret
+
+ # Check RISCV64 compiler
+ ret = self._check_riscv64()
+ if ret != 0:
+ self.Logger.critical("Failed in check riscv64")
+ return ret
+
+ return 0
+
+ def _check_arm(self):
+ # check to see if full path already configured
+ if shell_environment.GetEnvironment().get_shell_var("GCC5_ARM_PREFIX") is not None:
+ self.Logger.info("GCC5_ARM_PREFIX is already set.")
+
+ else:
+ # now check for install dir. If set then set the Prefix
+ install_path = shell_environment.GetEnvironment().get_shell_var("GCC5_ARM_INSTALL")
+ if install_path is None:
+ return 0
+
+ # make GCC5_ARM_PREFIX to align with tools_def.txt
+ prefix = os.path.join(install_path, "bin", "arm-linux-gnueabihf-")
+ shell_environment.GetEnvironment().set_shell_var("GCC5_ARM_PREFIX", prefix)
+
+ # now confirm it exists
+ if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("GCC5_ARM_PREFIX") + "gcc"):
+ self.Logger.error("Path for GCC5_ARM_PREFIX toolchain is invalid")
+ return -2
+
+ return 0
+
+ def _check_aarch64(self):
+ # check to see if full path already configured
+ if shell_environment.GetEnvironment().get_shell_var("GCC5_AARCH64_PREFIX") is not None:
+ self.Logger.info("GCC5_AARCH64_PREFIX is already set.")
+
+ else:
+ # now check for install dir. If set then set the Prefix
+ install_path = shell_environment.GetEnvironment(
+ ).get_shell_var("GCC5_AARCH64_INSTALL")
+ if install_path is None:
+ return 0
+
+ # make GCC5_AARCH64_PREFIX to align with tools_def.txt
+ prefix = os.path.join(install_path, "bin", "aarch64-linux-gnu-")
+ shell_environment.GetEnvironment().set_shell_var("GCC5_AARCH64_PREFIX", prefix)
+
+ # now confirm it exists
+ if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("GCC5_AARCH64_PREFIX") + "gcc"):
+ self.Logger.error(
+ "Path for GCC5_AARCH64_PREFIX toolchain is invalid")
+ return -2
+
+ return 0
+
+ def _check_riscv64(self):
+ # now check for install dir.  If set then set the Prefix
+ install_path = shell_environment.GetEnvironment(
+ ).get_shell_var("GCC5_RISCV64_INSTALL")
+ if install_path is None:
+ return 0
+
+ # check to see if full path already configured
+ if shell_environment.GetEnvironment().get_shell_var("GCC5_RISCV64_PREFIX") is not None:
+ self.Logger.info("GCC5_RISCV64_PREFIX is already set.")
+
+ else:
+ # make GCC5_RISCV64_PREFIX to align with tools_def.txt
+ prefix = os.path.join(install_path, "bin", "riscv64-unknown-elf-")
+ shell_environment.GetEnvironment().set_shell_var("GCC5_RISCV64_PREFIX", prefix)
+
+ # now confirm it exists
+ if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("GCC5_RISCV64_PREFIX") + "gcc"):
+ self.Logger.error(
+ "Path for GCC5_RISCV64_PREFIX toolchain is invalid")
+ return -2
+
+ # Check if LD_LIBRARY_PATH is set for the libraries of RISC-V GCC toolchain
+ if shell_environment.GetEnvironment().get_shell_var("LD_LIBRARY_PATH") is not None:
+ self.Logger.info("LD_LIBRARY_PATH is already set.")
+
+ prefix = os.path.join(install_path, "lib")
+ shell_environment.GetEnvironment().set_shell_var("LD_LIBRARY_PATH", prefix)
+
+ return 0
diff --git a/roms/edk2/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain_plug_in.yaml b/roms/edk2/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain_plug_in.yaml
new file mode 100644
index 000000000..39c378a92
--- /dev/null
+++ b/roms/edk2/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain_plug_in.yaml
@@ -0,0 +1,12 @@
+## @file
+# Build Plugin used to set the path
+# for the GCC5 ARM/AARCH64 downloaded compilers
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "global-nix",
+ "name": "Linux GCC5 Tool Chain Support",
+ "module": "LinuxGcc5ToolChain"
+}
diff --git a/roms/edk2/BaseTools/Plugin/WindowsResourceCompiler/WinRcPath.py b/roms/edk2/BaseTools/Plugin/WindowsResourceCompiler/WinRcPath.py
new file mode 100644
index 000000000..ec2f2d129
--- /dev/null
+++ b/roms/edk2/BaseTools/Plugin/WindowsResourceCompiler/WinRcPath.py
@@ -0,0 +1,29 @@
+## @file WinRcPath.py
+# Plugin to find Windows SDK Resource Compiler rc.exe
+##
+# This plugin works in conjuncture with the tools_def to support rc.exe
+#
+# Copyright (c) Microsoft Corporation
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+import os
+from edk2toolext.environment.plugintypes.uefi_build_plugin import IUefiBuildPlugin
+import edk2toollib.windows.locate_tools as locate_tools
+from edk2toolext.environment import shell_environment
+from edk2toolext.environment import version_aggregator
+
+class WinRcPath(IUefiBuildPlugin):
+
+ def do_post_build(self, thebuilder):
+ return 0
+
+ def do_pre_build(self, thebuilder):
+ #get the locate tools module
+ path = locate_tools.FindToolInWinSdk("rc.exe")
+ if path is None:
+ thebuilder.logging.warning("Failed to find rc.exe")
+ else:
+ p = os.path.abspath(os.path.dirname(path))
+ shell_environment.GetEnvironment().set_shell_var("WINSDK_PATH_FOR_RC_EXE", p)
+ version_aggregator.GetVersionAggregator().ReportVersion("WINSDK_PATH_FOR_RC_EXE", p, version_aggregator.VersionTypes.INFO)
+ return 0
diff --git a/roms/edk2/BaseTools/Plugin/WindowsResourceCompiler/WinRcPath_plug_in.yaml b/roms/edk2/BaseTools/Plugin/WindowsResourceCompiler/WinRcPath_plug_in.yaml
new file mode 100644
index 000000000..3aec35d86
--- /dev/null
+++ b/roms/edk2/BaseTools/Plugin/WindowsResourceCompiler/WinRcPath_plug_in.yaml
@@ -0,0 +1,13 @@
+## @file
+# Build Plugin used to set the path to rc.exe on windows.
+# The plugin is able to use python to locate the tool as to avoid
+# hard-coding the path
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "global-win",
+ "name": "Windows RC Path Support",
+ "module": "WinRcPath"
+}
diff --git a/roms/edk2/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py b/roms/edk2/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py
new file mode 100644
index 000000000..0fba2c1b5
--- /dev/null
+++ b/roms/edk2/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py
@@ -0,0 +1,207 @@
+# @file WindowsVsToolChain.py
+# Plugin to configures paths for the VS2017 and VS2019 tool chain
+##
+# This plugin works in conjuncture with the tools_def
+#
+# Copyright (c) Microsoft Corporation
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+import os
+import logging
+from edk2toolext.environment.plugintypes.uefi_build_plugin import IUefiBuildPlugin
+import edk2toollib.windows.locate_tools as locate_tools
+from edk2toollib.windows.locate_tools import FindWithVsWhere
+from edk2toolext.environment import shell_environment
+from edk2toolext.environment import version_aggregator
+from edk2toollib.utility_functions import GetHostInfo
+
+
+class WindowsVsToolChain(IUefiBuildPlugin):
+
+ def do_post_build(self, thebuilder):
+ return 0
+
+ def do_pre_build(self, thebuilder):
+ self.Logger = logging.getLogger("WindowsVsToolChain")
+ interesting_keys = ["ExtensionSdkDir", "INCLUDE", "LIB", "LIBPATH", "UniversalCRTSdkDir",
+ "UCRTVersion", "WindowsLibPath", "WindowsSdkBinPath", "WindowsSdkDir", "WindowsSdkVerBinPath",
+ "WindowsSDKVersion", "VCToolsInstallDir", "Path"]
+
+ #
+ # VS2017 - Follow VS2017 where there is potential for many versions of the tools.
+ # If a specific version is required then the user must set both env variables:
+ # VS150INSTALLPATH: base install path on system to VC install dir. Here you will find the VC folder, etc
+ # VS150TOOLVER: version number for the VC compiler tools
+ # VS2017_PREFIX: path to MSVC compiler folder with trailing slash (can be used instead of two vars above)
+ # VS2017_HOST: set the host architecture to use for host tools, and host libs, etc
+ if thebuilder.env.GetValue("TOOL_CHAIN_TAG") == "VS2017":
+
+ # check to see if host is configured
+ # HostType for VS2017 should be (defined in tools_def):
+ # x86 == 32bit Intel
+ # x64 == 64bit Intel
+ # arm == 32bit Arm
+ # arm64 == 64bit Arm
+ #
+ HostType = shell_environment.GetEnvironment().get_shell_var("VS2017_HOST")
+ if HostType is not None:
+ HostType = HostType.lower()
+ self.Logger.info(
+ f"HOST TYPE defined by environment. Host Type is {HostType}")
+ else:
+ HostInfo = GetHostInfo()
+ if HostInfo.arch == "x86":
+ if HostInfo.bit == "32":
+ HostType = "x86"
+ elif HostInfo.bit == "64":
+ HostType = "x64"
+ else:
+ raise NotImplementedError()
+
+ # VS2017_HOST options are not exactly the same as QueryVcVariables. This translates.
+ VC_HOST_ARCH_TRANSLATOR = {
+ "x86": "x86", "x64": "AMD64", "arm": "not supported", "arm64": "not supported"}
+
+ # check to see if full path already configured
+ if shell_environment.GetEnvironment().get_shell_var("VS2017_PREFIX") != None:
+ self.Logger.info("VS2017_PREFIX is already set.")
+
+ else:
+ install_path = self._get_vs_install_path(
+ "VS2017".lower(), "VS150INSTALLPATH")
+ vc_ver = self._get_vc_version(install_path, "VS150TOOLVER")
+
+ if install_path is None or vc_ver is None:
+ self.Logger.error(
+ "Failed to configure environment for VS2017")
+ return -1
+
+ version_aggregator.GetVersionAggregator().ReportVersion(
+ "Visual Studio Install Path", install_path, version_aggregator.VersionTypes.INFO)
+ version_aggregator.GetVersionAggregator().ReportVersion(
+ "VC Version", vc_ver, version_aggregator.VersionTypes.TOOL)
+
+ # make VS2017_PREFIX to align with tools_def.txt
+ prefix = os.path.join(install_path, "VC",
+ "Tools", "MSVC", vc_ver)
+ prefix = prefix + os.path.sep
+ shell_environment.GetEnvironment().set_shell_var("VS2017_PREFIX", prefix)
+ shell_environment.GetEnvironment().set_shell_var("VS2017_HOST", HostType)
+
+ shell_env = shell_environment.GetEnvironment()
+ # Use the tools lib to determine the correct values for the vars that interest us.
+ vs_vars = locate_tools.QueryVcVariables(
+ interesting_keys, VC_HOST_ARCH_TRANSLATOR[HostType], vs_version="vs2017")
+ for (k, v) in vs_vars.items():
+ shell_env.set_shell_var(k, v)
+
+ # now confirm it exists
+ if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("VS2017_PREFIX")):
+ self.Logger.error("Path for VS2017 toolchain is invalid")
+ return -2
+
+ #
+ # VS2019 - Follow VS2019 where there is potential for many versions of the tools.
+ # If a specific version is required then the user must set both env variables:
+ # VS160INSTALLPATH: base install path on system to VC install dir. Here you will find the VC folder, etc
+ # VS160TOOLVER: version number for the VC compiler tools
+ # VS2019_PREFIX: path to MSVC compiler folder with trailing slash (can be used instead of two vars above)
+ # VS2017_HOST: set the host architecture to use for host tools, and host libs, etc
+ elif thebuilder.env.GetValue("TOOL_CHAIN_TAG") == "VS2019":
+
+ # check to see if host is configured
+ # HostType for VS2019 should be (defined in tools_def):
+ # x86 == 32bit Intel
+ # x64 == 64bit Intel
+ # arm == 32bit Arm
+ # arm64 == 64bit Arm
+ #
+ HostType = shell_environment.GetEnvironment().get_shell_var("VS2019_HOST")
+ if HostType is not None:
+ HostType = HostType.lower()
+ self.Logger.info(
+ f"HOST TYPE defined by environment. Host Type is {HostType}")
+ else:
+ HostInfo = GetHostInfo()
+ if HostInfo.arch == "x86":
+ if HostInfo.bit == "32":
+ HostType = "x86"
+ elif HostInfo.bit == "64":
+ HostType = "x64"
+ else:
+ raise NotImplementedError()
+
+ # VS2019_HOST options are not exactly the same as QueryVcVariables. This translates.
+ VC_HOST_ARCH_TRANSLATOR = {
+ "x86": "x86", "x64": "AMD64", "arm": "not supported", "arm64": "not supported"}
+
+ # check to see if full path already configured
+ if shell_environment.GetEnvironment().get_shell_var("VS2019_PREFIX") != None:
+ self.Logger.info("VS2019_PREFIX is already set.")
+
+ else:
+ install_path = self._get_vs_install_path(
+ "VS2019".lower(), "VS160INSTALLPATH")
+ vc_ver = self._get_vc_version(install_path, "VS160TOOLVER")
+
+ if install_path is None or vc_ver is None:
+ self.Logger.error(
+ "Failed to configure environment for VS2019")
+ return -1
+
+ version_aggregator.GetVersionAggregator().ReportVersion(
+ "Visual Studio Install Path", install_path, version_aggregator.VersionTypes.INFO)
+ version_aggregator.GetVersionAggregator().ReportVersion(
+ "VC Version", vc_ver, version_aggregator.VersionTypes.TOOL)
+
+ # make VS2019_PREFIX to align with tools_def.txt
+ prefix = os.path.join(install_path, "VC",
+ "Tools", "MSVC", vc_ver)
+ prefix = prefix + os.path.sep
+ shell_environment.GetEnvironment().set_shell_var("VS2019_PREFIX", prefix)
+ shell_environment.GetEnvironment().set_shell_var("VS2019_HOST", HostType)
+
+ shell_env = shell_environment.GetEnvironment()
+ # Use the tools lib to determine the correct values for the vars that interest us.
+ vs_vars = locate_tools.QueryVcVariables(
+ interesting_keys, VC_HOST_ARCH_TRANSLATOR[HostType], vs_version="vs2019")
+ for (k, v) in vs_vars.items():
+ shell_env.set_shell_var(k, v)
+
+ # now confirm it exists
+ if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("VS2019_PREFIX")):
+ self.Logger.error("Path for VS2019 toolchain is invalid")
+ return -2
+
+ return 0
+
+ def _get_vs_install_path(self, vs_version, varname):
+ # check if already specified
+ path = shell_environment.GetEnvironment().get_shell_var(varname)
+ if(path is None):
+ # Not specified...find latest
+ (rc, path) = FindWithVsWhere(vs_version=vs_version)
+ if rc == 0 and path is not None and os.path.exists(path):
+ self.Logger.debug("Found VS instance for %s", vs_version)
+ else:
+ self.Logger.error(
+ "Failed to find VS instance with VsWhere (%d)" % rc)
+ return path
+
+ def _get_vc_version(self, path, varname):
+ # check if already specified
+ vc_ver = shell_environment.GetEnvironment().get_shell_var(varname)
+ if (path is None):
+ self.Logger.critical(
+ "Failed to find Visual Studio tools. Might need to check for VS install")
+ return vc_ver
+ if(vc_ver is None):
+ # Not specified...find latest
+ p2 = os.path.join(path, "VC", "Tools", "MSVC")
+ if not os.path.isdir(p2):
+ self.Logger.critical(
+ "Failed to find VC tools. Might need to check for VS install")
+ return vc_ver
+ vc_ver = os.listdir(p2)[-1].strip() # get last in list
+ self.Logger.debug("Found VC Tool version is %s" % vc_ver)
+ return vc_ver
diff --git a/roms/edk2/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain_plug_in.yaml b/roms/edk2/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain_plug_in.yaml
new file mode 100644
index 000000000..72b5c4a09
--- /dev/null
+++ b/roms/edk2/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain_plug_in.yaml
@@ -0,0 +1,11 @@
+## @file
+# Build Plugin used to set the path to the visual studio tools chain
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "global-win",
+ "name": "Windows Visual Studio Tool Chain Support",
+ "module": "WindowsVsToolChain"
+}
diff --git a/roms/edk2/BaseTools/ReadMe.rst b/roms/edk2/BaseTools/ReadMe.rst
new file mode 100644
index 000000000..de85ca4be
--- /dev/null
+++ b/roms/edk2/BaseTools/ReadMe.rst
@@ -0,0 +1,41 @@
+This directory contains the EDK II build tools and template files.
+Templates are located in the Conf directory, while the tools executables for
+Microsoft Windows Operating Systems are located in the Bin\\Win32 directory, other
+directory contains tools source.
+
+Build step to generate the binary tools
+---------------------------------------
+
+Windows/Visual Studio Notes
+===========================
+
+To build the BaseTools, you should run the standard vsvars32.bat script
+from your preferred Visual Studio installation or you can run get_vsvars.bat
+to use latest automatically detected version.
+
+In addition to this, you should set the following environment variables::
+
+ * EDK_TOOLS_PATH - Path to the BaseTools sub directory under the edk2 tree
+ * BASE_TOOLS_PATH - The directory where the BaseTools source is located.
+ (It is the same directory where this README.rst is located.)
+
+After this, you can run the toolsetup.bat file, which is in the same
+directory as this file. It should setup the remainder of the environment,
+and build the tools if necessary.
+
+Please also refer to the ``BuildNotes.txt`` file for more information on
+building under Windows.
+
+Unix-like operating systems
+===========================
+
+To build on Unix-like operating systems, you only need to type ``make`` in
+the base directory of the project.
+
+Ubuntu Notes
+============
+
+On Ubuntu, the following command should install all the necessary build
+packages to build all the C BaseTools::
+
+ sudo apt install build-essential uuid-dev
diff --git a/roms/edk2/BaseTools/Scripts/BinToPcd.py b/roms/edk2/BaseTools/Scripts/BinToPcd.py
new file mode 100644
index 000000000..3bc557b84
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/BinToPcd.py
@@ -0,0 +1,220 @@
+## @file
+# Convert a binary file to a VOID* PCD value or DSC file VOID* PCD statement.
+#
+# Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+BinToPcd
+'''
+from __future__ import print_function
+
+import sys
+import argparse
+import re
+import xdrlib
+
+#
+# Globals for help information
+#
+__prog__ = 'BinToPcd'
+__copyright__ = 'Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.'
+__description__ = 'Convert one or more binary files to a VOID* PCD value or DSC file VOID* PCD statement.\n'
+
+if __name__ == '__main__':
+ def ValidateUnsignedInteger (Argument):
+ try:
+ Value = int (Argument, 0)
+ except:
+ Message = '{Argument} is not a valid integer value.'.format (Argument = Argument)
+ raise argparse.ArgumentTypeError (Message)
+ if Value < 0:
+ Message = '{Argument} is a negative value.'.format (Argument = Argument)
+ raise argparse.ArgumentTypeError (Message)
+ return Value
+
+ def ValidatePcdName (Argument):
+ if re.split ('[a-zA-Z\_][a-zA-Z0-9\_]*\.[a-zA-Z\_][a-zA-Z0-9\_]*', Argument) != ['', '']:
+ Message = '{Argument} is not in the form <PcdTokenSpaceGuidCName>.<PcdCName>'.format (Argument = Argument)
+ raise argparse.ArgumentTypeError (Message)
+ return Argument
+
+ def ValidateGuidName (Argument):
+ if re.split ('[a-zA-Z\_][a-zA-Z0-9\_]*', Argument) != ['', '']:
+ Message = '{Argument} is not a valid GUID C name'.format (Argument = Argument)
+ raise argparse.ArgumentTypeError (Message)
+ return Argument
+
+ def ByteArray (Buffer, Xdr = False):
+ if Xdr:
+ #
+ # If Xdr flag is set then encode data using the Variable-Length Opaque
+ # Data format of RFC 4506 External Data Representation Standard (XDR).
+ #
+ XdrEncoder = xdrlib.Packer ()
+ for Item in Buffer:
+ XdrEncoder.pack_bytes (Item)
+ Buffer = bytearray (XdrEncoder.get_buffer ())
+ else:
+ #
+ # If Xdr flag is not set, then concatenate all the data
+ #
+ Buffer = bytearray (b''.join (Buffer))
+ #
+ # Return a PCD value of the form '{0x01, 0x02, ...}' along with the PCD length in bytes
+ #
+ return '{' + (', '.join (['0x{Byte:02X}'.format (Byte = Item) for Item in Buffer])) + '}', len (Buffer)
+
+ #
+ # Create command line argument parser object
+ #
+ parser = argparse.ArgumentParser (prog = __prog__,
+ description = __description__ + __copyright__,
+ conflict_handler = 'resolve')
+ parser.add_argument ("-i", "--input", dest = 'InputFile', type = argparse.FileType ('rb'), action='append', required = True,
+ help = "Input binary filename. Multiple input files are combined into a single PCD.")
+ parser.add_argument ("-o", "--output", dest = 'OutputFile', type = argparse.FileType ('w'),
+ help = "Output filename for PCD value or PCD statement")
+ parser.add_argument ("-p", "--pcd", dest = 'PcdName', type = ValidatePcdName,
+ help = "Name of the PCD in the form <PcdTokenSpaceGuidCName>.<PcdCName>")
+ parser.add_argument ("-t", "--type", dest = 'PcdType', default = None, choices = ['VPD', 'HII'],
+ help = "PCD statement type (HII or VPD). Default is standard.")
+ parser.add_argument ("-m", "--max-size", dest = 'MaxSize', type = ValidateUnsignedInteger,
+ help = "Maximum size of the PCD. Ignored with --type HII.")
+ parser.add_argument ("-f", "--offset", dest = 'Offset', type = ValidateUnsignedInteger,
+ help = "VPD offset if --type is VPD. UEFI Variable offset if --type is HII. Must be 8-byte aligned.")
+ parser.add_argument ("-n", "--variable-name", dest = 'VariableName',
+ help = "UEFI variable name. Only used with --type HII.")
+ parser.add_argument ("-g", "--variable-guid", type = ValidateGuidName, dest = 'VariableGuid',
+ help = "UEFI variable GUID C name. Only used with --type HII.")
+ parser.add_argument ("-x", "--xdr", dest = 'Xdr', action = "store_true",
+ help = "Encode PCD using the Variable-Length Opaque Data format of RFC 4506 External Data Representation Standard (XDR)")
+ parser.add_argument ("-v", "--verbose", dest = 'Verbose', action = "store_true",
+ help = "Increase output messages")
+ parser.add_argument ("-q", "--quiet", dest = 'Quiet', action = "store_true",
+ help = "Reduce output messages")
+ parser.add_argument ("--debug", dest = 'Debug', type = int, metavar = '[0-9]', choices = range (0, 10), default = 0,
+ help = "Set debug level")
+
+ #
+ # Parse command line arguments
+ #
+ args = parser.parse_args ()
+
+ #
+ # Read all binary input files
+ #
+ Buffer = []
+ for File in args.InputFile:
+ try:
+ Buffer.append (File.read ())
+ File.close ()
+ except:
+ print ('BinToPcd: error: can not read binary input file {File}'.format (File = File))
+ sys.exit (1)
+
+ #
+ # Convert PCD to an encoded string of hex values and determine the size of
+ # the encoded PCD in bytes.
+ #
+ PcdValue, PcdSize = ByteArray (Buffer, args.Xdr)
+
+ #
+ # Convert binary buffer to a DSC file PCD statement
+ #
+ if args.PcdName is None:
+ #
+ # If PcdName is None, then only a PCD value is being requested.
+ #
+ Pcd = PcdValue
+ if args.Verbose:
+ print ('BinToPcd: Convert binary file to PCD Value')
+ elif args.PcdType is None:
+ #
+ # If --type is neither VPD nor HII, then use PCD statement syntax that is
+ # compatible with [PcdsFixedAtBuild], [PcdsPatchableInModule],
+ # [PcdsDynamicDefault], and [PcdsDynamicExDefault].
+ #
+ if args.MaxSize is None:
+ #
+ # If --max-size is not provided, then do not generate the syntax that
+ # includes the maximum size.
+ #
+ Pcd = ' {Name}|{Value}'.format (Name = args.PcdName, Value = PcdValue)
+ elif args.MaxSize < PcdSize:
+ print ('BinToPcd: error: argument --max-size is smaller than input file.')
+ sys.exit (1)
+ else:
+ Pcd = ' {Name}|{Value}|VOID*|{Size}'.format (Name = args.PcdName, Value = PcdValue, Size = args.MaxSize)
+
+ if args.Verbose:
+ print ('BinToPcd: Convert binary file to PCD statement compatible with PCD sections:')
+ print (' [PcdsFixedAtBuild]')
+ print (' [PcdsPatchableInModule]')
+ print (' [PcdsDynamicDefault]')
+ print (' [PcdsDynamicExDefault]')
+ elif args.PcdType == 'VPD':
+ if args.MaxSize is None:
+ #
+ # If --max-size is not provided, then set maximum size to the size of the
+ # binary input file
+ #
+ args.MaxSize = PcdSize
+ if args.MaxSize < PcdSize:
+ print ('BinToPcd: error: argument --max-size is smaller than input file.')
+ sys.exit (1)
+ if args.Offset is None:
+ #
+ # if --offset is not provided, then set offset field to '*' so build
+ # tools will compute offset of PCD in VPD region.
+ #
+ Pcd = ' {Name}|*|{Size}|{Value}'.format (Name = args.PcdName, Size = args.MaxSize, Value = PcdValue)
+ else:
+ #
+ # --offset value must be 8-byte aligned
+ #
+ if (args.Offset % 8) != 0:
+ print ('BinToPcd: error: argument --offset must be 8-byte aligned.')
+ sys.exit (1)
+ #
+ # Use the --offset value provided.
+ #
+ Pcd = ' {Name}|{Offset}|{Size}|{Value}'.format (Name = args.PcdName, Offset = args.Offset, Size = args.MaxSize, Value = PcdValue)
+ if args.Verbose:
+ print ('BinToPcd: Convert binary file to PCD statement compatible with PCD sections')
+ print (' [PcdsDynamicVpd]')
+ print (' [PcdsDynamicExVpd]')
+ elif args.PcdType == 'HII':
+ if args.VariableGuid is None or args.VariableName is None:
+ print ('BinToPcd: error: arguments --variable-guid and --variable-name are required for --type HII.')
+ sys.exit (1)
+ if args.Offset is None:
+ #
+ # Use UEFI Variable offset of 0 if --offset is not provided
+ #
+ args.Offset = 0
+ #
+ # --offset value must be 8-byte aligned
+ #
+ if (args.Offset % 8) != 0:
+ print ('BinToPcd: error: argument --offset must be 8-byte aligned.')
+ sys.exit (1)
+ Pcd = ' {Name}|L"{VarName}"|{VarGuid}|{Offset}|{Value}'.format (Name = args.PcdName, VarName = args.VariableName, VarGuid = args.VariableGuid, Offset = args.Offset, Value = PcdValue)
+ if args.Verbose:
+ print ('BinToPcd: Convert binary file to PCD statement compatible with PCD sections')
+ print (' [PcdsDynamicHii]')
+ print (' [PcdsDynamicExHii]')
+
+ #
+ # Write PCD value or PCD statement to the output file
+ #
+ try:
+ args.OutputFile.write (Pcd)
+ args.OutputFile.close ()
+ except:
+ #
+ # If output file is not specified or it can not be written, then write the
+ # PCD value or PCD statement to the console
+ #
+ print (Pcd)
diff --git a/roms/edk2/BaseTools/Scripts/ConvertFceToStructurePcd.py b/roms/edk2/BaseTools/Scripts/ConvertFceToStructurePcd.py
new file mode 100644
index 000000000..89e6a727a
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/ConvertFceToStructurePcd.py
@@ -0,0 +1,687 @@
+#!/usr/bin/python
+## @file
+# Firmware Configuration Editor (FCE) from https://firmware.intel.com/develop
+# can parse BIOS image and generate Firmware Configuration file.
+# This script bases on Firmware Configuration file, and generate the structure
+# PCD setting in DEC/DSC/INF files.
+#
+# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+ConvertFceToStructurePcd
+'''
+
+import re
+import os
+import datetime
+import argparse
+
+#
+# Globals for help information
+#
+__prog__ = 'ConvertFceToStructurePcd'
+__version__ = '%s Version %s' % (__prog__, '0.1 ')
+__copyright__ = 'Copyright (c) 2018, Intel Corporation. All rights reserved.'
+__description__ = 'Generate Structure PCD in DEC/DSC/INF based on Firmware Configuration.\n'
+
+
+dscstatement='''[Defines]
+ VPD_TOOL_GUID = 8C3D856A-9BE6-468E-850A-24F7A8D38E08
+
+[SkuIds]
+ 0|DEFAULT # The entry: 0|DEFAULT is reserved and always required.
+
+[DefaultStores]
+ 0|STANDARD # UEFI Standard default 0|STANDARD is reserved.
+ 1|MANUFACTURING # UEFI Manufacturing default 1|MANUFACTURING is reserved.
+
+[PcdsDynamicExVpd.common.DEFAULT]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdNvStoreDefaultValueBuffer|*
+'''
+
+decstatement = '''[Guids]
+ gStructPcdTokenSpaceGuid = {0x3f1406f4, 0x2b, 0x487a, {0x8b, 0x69, 0x74, 0x29, 0x1b, 0x36, 0x16, 0xf4}}
+
+[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx]
+'''
+
+infstatement = '''[Pcd]
+'''
+
+SECTION='PcdsDynamicHii'
+PCD_NAME='gStructPcdTokenSpaceGuid.Pcd'
+
+WARNING=[]
+ERRORMSG=[]
+
+class parser_lst(object):
+
+ def __init__(self,filelist):
+ self._ignore=['BOOLEAN', 'UINT8', 'UINT16', 'UINT32', 'UINT64']
+ self.file=filelist
+ self.text=self.megre_lst()[0]
+ self.content=self.megre_lst()[1]
+
+ def megre_lst(self):
+ alltext=''
+ content={}
+ for file in self.file:
+ with open(file,'r') as f:
+ read =f.read()
+ alltext += read
+ content[file]=read
+ return alltext,content
+
+ def struct_lst(self):#{struct:lst file}
+ structs_file={}
+ name_format = re.compile(r'(?<!typedef)\s+struct (\w+) {.*?;', re.S)
+ for i in list(self.content.keys()):
+ structs= name_format.findall(self.content[i])
+ if structs:
+ for j in structs:
+ if j not in self._ignore:
+ structs_file[j]=i
+ else:
+ print("%s"%structs)
+ return structs_file
+
+ def struct(self):#struct:{offset:name}
+ unit_num = re.compile('(\d+)')
+ offset1_re = re.compile('(\d+)\[')
+ pcdname_num_re = re.compile('\w+\[(\S+)\]')
+ pcdname_re = re.compile('\](.*)\<')
+ pcdname2_re = re.compile('(\w+)\[')
+ uint_re = re.compile('\<(\S+)\>')
+ name_format = re.compile(r'(?<!typedef)\s+struct (\w+) {.*?;', re.S)
+ name=name_format.findall(self.text)
+ info={}
+ unparse=[]
+ if name:
+ tmp_n = [n for n in name if n not in self._ignore]
+ name = list(set(tmp_n))
+ name.sort(key = tmp_n.index)
+ name.reverse()
+ #name=list(set(name).difference(set(self._ignore)))
+ for struct in name:
+ s_re = re.compile(r'struct %s :(.*?)};'% struct, re.S)
+ content = s_re.search(self.text)
+ if content:
+ tmp_dict = {}
+ text = content.group().split('+')
+ for line in text[1:]:
+ offset = offset1_re.findall(line)
+ t_name = pcdname_re.findall(line)
+ uint = uint_re.findall(line)
+ if offset and uint:
+ offset = offset[0]
+ uint = uint[0]
+ if t_name:
+ t_name = t_name[0].strip()
+ if (' ' in t_name) or ("=" in t_name) or (";" in t_name) or("\\" in name) or (t_name ==''):
+ WARNING.append("Warning:Invalid Pcd name '%s' for Offset %s in struct %s" % (t_name,offset, struct))
+ else:
+ if '[' in t_name:
+ if uint in ['UINT8', 'UINT16', 'UINT32', 'UINT64']:
+ offset = int(offset, 10)
+ tmp_name = pcdname2_re.findall(t_name)[0] + '[0]'
+ tmp_dict[offset] = tmp_name
+ pcdname_num = int(pcdname_num_re.findall(t_name)[0],10)
+ uint = int(unit_num.findall(uint)[0],10)
+ bit = uint // 8
+ for i in range(1, pcdname_num):
+ offset += bit
+ tmp_name = pcdname2_re.findall(t_name)[0] + '[%s]' % i
+ tmp_dict[offset] = tmp_name
+ else:
+ tmp_name = pcdname2_re.findall(t_name)[0]
+ pcdname_num = pcdname_num_re.findall(t_name)[0]
+ line = [offset,tmp_name,pcdname_num,uint]
+ line.append(struct)
+ unparse.append(line)
+ else:
+ if uint not in ['UINT8', 'UINT16', 'UINT32', 'UINT64']:
+ line = [offset, t_name, 0, uint]
+ line.append(struct)
+ unparse.append(line)
+ else:
+ offset = int(offset,10)
+ tmp_dict[offset] = t_name
+ info[struct] = tmp_dict
+ if len(unparse) != 0:
+ for u in unparse:
+ if u[3] in list(info.keys()):
+ unpar = self.nameISstruct(u,info[u[3]])
+ info[u[4]]= dict(list(info[u[4]].items())+list(unpar[u[4]].items()))
+ else:
+ print("ERROR: No struct name found in %s" % self.file)
+ ERRORMSG.append("ERROR: No struct name found in %s" % self.file)
+ return info
+
+
+ def nameISstruct(self,line,key_dict):
+ dict={}
+ dict2={}
+ s_re = re.compile(r'struct %s :(.*?)};' % line[3], re.S)
+ size_re = re.compile(r'mTotalSize \[(\S+)\]')
+ content = s_re.search(self.text)
+ if content:
+ s_size = size_re.findall(content.group())[0]
+ else:
+ s_size = '0'
+ print("ERROR: Struct %s not define mTotalSize in lst file" %line[3])
+ ERRORMSG.append("ERROR: Struct %s not define mTotalSize in lst file" %line[3])
+ size = int(line[0], 10)
+ if line[2] != 0:
+ for j in range(0, int(line[2], 10)):
+ for k in list(key_dict.keys()):
+ offset = size + k
+ name ='%s.%s' %((line[1]+'[%s]'%j),key_dict[k])
+ dict[offset] = name
+ size = int(s_size,16)+size
+ elif line[2] == 0:
+ for k in list(key_dict.keys()):
+ offset = size + k
+ name = '%s.%s' % (line[1], key_dict[k])
+ dict[offset] = name
+ dict2[line[4]] = dict
+ return dict2
+
+ def efivarstore_parser(self):
+ efivarstore_format = re.compile(r'efivarstore.*?;', re.S)
+ struct_re = re.compile(r'efivarstore(.*?),',re.S)
+ name_re = re.compile(r'name=(\w+)')
+ efivarstore_dict={}
+ efitxt = efivarstore_format.findall(self.text)
+ for i in efitxt:
+ struct = struct_re.findall(i.replace(' ',''))
+ name = name_re.findall(i.replace(' ',''))
+ if struct and name:
+ efivarstore_dict[name[0]]=struct[0]
+ else:
+ print("ERROR: Can't find Struct or name in lst file, please check have this format:efivarstore XXXX, name=xxxx")
+ ERRORMSG.append("ERROR: Can't find Struct or name in lst file, please check have this format:efivarstore XXXX, name=xxxx")
+ return efivarstore_dict
+
+class Config(object):
+
+ def __init__(self,Config):
+ self.config=Config
+
+ #Parser .config file,return list[offset,name,guid,value,help]
+ def config_parser(self):
+ ids_re =re.compile('_ID:(\d+)',re.S)
+ id_re= re.compile('\s+')
+ info = []
+ info_dict={}
+ with open(self.config, 'r') as text:
+ read = text.read()
+ if 'DEFAULT_ID:' in read:
+ all_txt = read.split('FCEKEY DEFAULT')
+ for i in all_txt[1:]:
+ part = [] #save all infomation for DEFAULT_ID
+ str_id=''
+ ids = ids_re.findall(i.replace(' ',''))
+ for m in ids:
+ str_id +=m+'_'
+ str_id=str_id[:-1]
+ part.append(ids)
+ section = i.split('\nQ') #split with '\nQ ' to get every block
+ part +=self.section_parser(section)
+ info_dict[str_id] = self.section_parser(section)
+ info.append(part)
+ else:
+ part = []
+ id=('0','0')
+ str_id='0_0'
+ part.append(id)
+ section = read.split('\nQ')
+ part +=self.section_parser(section)
+ info_dict[str_id] = self.section_parser(section)
+ info.append(part)
+ return info_dict
+
+ def eval_id(self,id):
+ id = id.split("_")
+ default_id=id[0:len(id)//2]
+ platform_id=id[len(id)//2:]
+ text=''
+ for i in range(len(default_id)):
+ text +="%s.common.%s.%s,"%(SECTION,self.id_name(platform_id[i],'PLATFORM'),self.id_name(default_id[i],'DEFAULT'))
+ return '\n[%s]\n'%text[:-1]
+
+ def id_name(self,ID, flag):
+ platform_dict = {'0': 'DEFAULT'}
+ default_dict = {'0': 'STANDARD', '1': 'MANUFACTURING'}
+ if flag == "PLATFORM":
+ try:
+ value = platform_dict[ID]
+ except KeyError:
+ value = 'SKUID%s' % ID
+ elif flag == 'DEFAULT':
+ try:
+ value = default_dict[ID]
+ except KeyError:
+ value = 'DEFAULTID%s' % ID
+ else:
+ value = None
+ return value
+
+ def section_parser(self,section):
+ offset_re = re.compile(r'offset=(\w+)')
+ name_re = re.compile(r'name=(\S+)')
+ guid_re = re.compile(r'guid=(\S+)')
+ # help_re = re.compile(r'help = (.*)')
+ attribute_re=re.compile(r'attribute=(\w+)')
+ value_re = re.compile(r'(//.*)')
+ part = []
+ for x in section[1:]:
+ line=x.split('\n')[0]
+ line=value_re.sub('',line) #delete \\... in "Q...." line
+ list1=line.split(' ')
+ value=self.value_parser(list1)
+ offset = offset_re.findall(x.replace(' ',''))
+ name = name_re.findall(x.replace(' ',''))
+ guid = guid_re.findall(x.replace(' ',''))
+ attribute =attribute_re.findall(x.replace(' ',''))
+ if offset and name and guid and value and attribute:
+ if attribute[0] in ['0x3','0x7']:
+ offset = int(offset[0], 16)
+ #help = help_re.findall(x)
+ text = offset, name[0], guid[0], value, attribute[0]
+ part.append(text)
+ return(part)
+
+ def value_parser(self, list1):
+ list1 = [t for t in list1 if t != ''] # remove '' form list
+ first_num = int(list1[0], 16)
+ if list1[first_num + 1] == 'STRING': # parser STRING
+ if list1[-1] == '""':
+ value = "{0x0, 0x0}"
+ else:
+ value = 'L%s' % list1[-1]
+ elif list1[first_num + 1] == 'ORDERED_LIST': # parser ORDERED_LIST
+ value_total = int(list1[first_num + 2])
+ list2 = list1[-value_total:]
+ tmp = []
+ line = ''
+ for i in list2:
+ if len(i) % 2 == 0 and len(i) != 2:
+ for m in range(0, len(i) // 2):
+ tmp.append('0x%02x' % (int('0x%s' % i, 16) >> m * 8 & 0xff))
+ else:
+ tmp.append('0x%s' % i)
+ for i in tmp:
+ line += '%s,' % i
+ value = '{%s}' % line[:-1]
+ else:
+ value = "0x%01x" % int(list1[-1], 16)
+ return value
+
+
+#parser Guid file, get guid name form guid value
+class GUID(object):
+
+ def __init__(self,path):
+ self.path = path
+ self.guidfile = self.gfile()
+ self.guiddict = self.guid_dict()
+
+ def gfile(self):
+ for root, dir, file in os.walk(self.path, topdown=True, followlinks=False):
+ if 'FV' in dir:
+ gfile = os.path.join(root,'Fv','Guid.xref')
+ if os.path.isfile(gfile):
+ return gfile
+ else:
+ print("ERROR: Guid.xref file not found")
+ ERRORMSG.append("ERROR: Guid.xref file not found")
+ exit()
+
+ def guid_dict(self):
+ guiddict={}
+ with open(self.guidfile,'r') as file:
+ lines = file.readlines()
+ guidinfo=lines
+ for line in guidinfo:
+ list=line.strip().split(' ')
+ if list:
+ if len(list)>1:
+ guiddict[list[0].upper()]=list[1]
+ elif list[0] != ''and len(list)==1:
+ print("Error: line %s can't be parser in %s"%(line.strip(),self.guidfile))
+ ERRORMSG.append("Error: line %s can't be parser in %s"%(line.strip(),self.guidfile))
+ else:
+ print("ERROR: No data in %s" %self.guidfile)
+ ERRORMSG.append("ERROR: No data in %s" %self.guidfile)
+ return guiddict
+
+ def guid_parser(self,guid):
+ if guid.upper() in self.guiddict:
+ return self.guiddict[guid.upper()]
+ else:
+ print("ERROR: GUID %s not found in file %s"%(guid, self.guidfile))
+ ERRORMSG.append("ERROR: GUID %s not found in file %s"%(guid, self.guidfile))
+ return guid
+
+class PATH(object):
+
+ def __init__(self,path):
+ self.path=path
+ self.rootdir=self.get_root_dir()
+ self.usefuldir=[]
+ self.lstinf = {}
+ for path in self.rootdir:
+ for o_root, o_dir, o_file in os.walk(os.path.join(path, "OUTPUT"), topdown=True, followlinks=False):
+ for INF in o_file:
+ if os.path.splitext(INF)[1] == '.inf':
+ for l_root, l_dir, l_file in os.walk(os.path.join(path, "DEBUG"), topdown=True,
+ followlinks=False):
+ for LST in l_file:
+ if os.path.splitext(LST)[1] == '.lst':
+ self.lstinf[os.path.join(l_root, LST)] = os.path.join(o_root, INF)
+ self.usefuldir.append(path)
+
+ def get_root_dir(self):
+ rootdir=[]
+ for root,dir,file in os.walk(self.path,topdown=True,followlinks=False):
+ if "OUTPUT" in root:
+ updir=root.split("OUTPUT",1)[0]
+ rootdir.append(updir)
+ rootdir=list(set(rootdir))
+ return rootdir
+
+ def lst_inf(self):
+ return self.lstinf
+
+ def package(self):
+ package={}
+ package_re=re.compile(r'Packages\.\w+]\n(.*)',re.S)
+ for i in list(self.lstinf.values()):
+ with open(i,'r') as inf:
+ read=inf.read()
+ section=read.split('[')
+ for j in section:
+ p=package_re.findall(j)
+ if p:
+ package[i]=p[0].rstrip()
+ return package
+
+ def header(self,struct):
+ header={}
+ head_re = re.compile('typedef.*} %s;[\n]+(.*?)(?:typedef|formset)'%struct,re.M|re.S)
+ head_re2 = re.compile(r'#line[\s\d]+"(\S+h)"')
+ for i in list(self.lstinf.keys()):
+ with open(i,'r') as lst:
+ read = lst.read()
+ h = head_re.findall(read)
+ if h:
+ head=head_re2.findall(h[0])
+ if head:
+ format = head[0].replace('\\\\','/').replace('\\','/')
+ name =format.split('/')[-1]
+ head = self.makefile(name).replace('\\','/')
+ header[struct] = head
+ return header
+
+ def makefile(self,filename):
+ re_format = re.compile(r'DEBUG_DIR.*(?:\S+Pkg)\\(.*\\%s)'%filename)
+ for i in self.usefuldir:
+ with open(os.path.join(i,'Makefile'),'r') as make:
+ read = make.read()
+ dir = re_format.findall(read)
+ if dir:
+ return dir[0]
+
+class mainprocess(object):
+
+ def __init__(self,InputPath,Config,OutputPath):
+ self.init = 0xFCD00000
+ self.inputpath = os.path.abspath(InputPath)
+ self.outputpath = os.path.abspath(OutputPath)
+ self.LST = PATH(self.inputpath)
+ self.lst_dict = self.LST.lst_inf()
+ self.Config = Config
+ self.attribute_dict = {'0x3': 'NV, BS', '0x7': 'NV, BS, RT'}
+ self.guid = GUID(self.inputpath)
+ self.header={}
+
+ def main(self):
+ conf=Config(self.Config)
+ config_dict=conf.config_parser() #get {'0_0':[offset,name,guid,value,attribute]...,'1_0':....}
+ lst=parser_lst(list(self.lst_dict.keys()))
+ efi_dict=lst.efivarstore_parser() #get {name:struct} form lst file
+ keys=sorted(config_dict.keys())
+ all_struct=lst.struct()
+ stru_lst=lst.struct_lst()
+ title_list=[]
+ info_list=[]
+ header_list=[]
+ inf_list =[]
+ for i in stru_lst:
+ tmp = self.LST.header(i)
+ self.header.update(tmp)
+ for id_key in keys:
+ tmp_id=[id_key] #['0_0',[(struct,[name...]),(struct,[name...])]]
+ tmp_info={} #{name:struct}
+ for section in config_dict[id_key]:
+ c_offset,c_name,c_guid,c_value,c_attribute = section
+ if c_name in efi_dict:
+ struct = efi_dict[c_name]
+ title='%s%s|L"%s"|%s|0x00||%s\n'%(PCD_NAME,c_name,c_name,self.guid.guid_parser(c_guid),self.attribute_dict[c_attribute])
+ if struct in all_struct:
+ lstfile = stru_lst[struct]
+ struct_dict=all_struct[struct]
+ try:
+ title2 = '%s%s|{0}|%s|0xFCD00000{\n <HeaderFiles>\n %s\n <Packages>\n%s\n}\n' % (PCD_NAME, c_name, struct, self.header[struct], self.LST.package()[self.lst_dict[lstfile]])
+ except KeyError:
+ WARNING.append("Warning: No <HeaderFiles> for struct %s"%struct)
+ title2 = '%s%s|{0}|%s|0xFCD00000{\n <HeaderFiles>\n %s\n <Packages>\n%s\n}\n' % (PCD_NAME, c_name, struct, '', self.LST.package()[self.lst_dict[lstfile]])
+ header_list.append(title2)
+ else:
+ struct_dict ={}
+ print("ERROR: Struct %s can't found in lst file" %struct)
+ ERRORMSG.append("ERROR: Struct %s can't found in lst file" %struct)
+ if c_offset in struct_dict:
+ offset_name=struct_dict[c_offset]
+ info = "%s%s.%s|%s\n"%(PCD_NAME,c_name,offset_name,c_value)
+ inf = "%s%s\n"%(PCD_NAME,c_name)
+ inf_list.append(inf)
+ tmp_info[info]=title
+ else:
+ print("ERROR: Can't find offset %s with struct name %s"%(c_offset,struct))
+ ERRORMSG.append("ERROR: Can't find offset %s with name %s"%(c_offset,struct))
+ else:
+ print("ERROR: Can't find name %s in lst file"%(c_name))
+ ERRORMSG.append("ERROR: Can't find name %s in lst file"%(c_name))
+ tmp_id.append(list(self.reverse_dict(tmp_info).items()))
+ id,tmp_title_list,tmp_info_list = self.read_list(tmp_id)
+ title_list +=tmp_title_list
+ info_list.append(tmp_info_list)
+ inf_list = self.del_repeat(inf_list)
+ header_list = self.plus(self.del_repeat(header_list))
+ title_all=list(set(title_list))
+ info_list = self.remove_bracket(self.del_repeat(info_list))
+ for i in range(len(info_list)-1,-1,-1):
+ if len(info_list[i]) == 0:
+ info_list.remove(info_list[i])
+ for i in (inf_list, title_all, header_list):
+ i.sort()
+ return keys,title_all,info_list,header_list,inf_list
+
+ def remove_bracket(self,List):
+ for i in List:
+ for j in i:
+ tmp = j.split("|")
+ if (('L"' in j) and ("[" in j)) or (tmp[1].strip() == '{0x0, 0x0}'):
+ tmp[0] = tmp[0][:tmp[0].index('[')]
+ List[List.index(i)][i.index(j)] = "|".join(tmp)
+ else:
+ List[List.index(i)][i.index(j)] = j
+ for i in List:
+ if type(i) == type([0,0]):
+ i.sort()
+ return List
+
+ def write_all(self):
+ title_flag=1
+ info_flag=1
+ if not os.path.isdir(self.outputpath):
+ os.makedirs(self.outputpath)
+ decwrite = write2file(os.path.join(self.outputpath,'StructurePcd.dec'))
+ dscwrite = write2file(os.path.join(self.outputpath,'StructurePcd.dsc'))
+ infwrite = write2file(os.path.join(self.outputpath, 'StructurePcd.inf'))
+ conf = Config(self.Config)
+ ids,title,info,header,inf=self.main()
+ decwrite.add2file(decstatement)
+ decwrite.add2file(header)
+ infwrite.add2file(infstatement)
+ infwrite.add2file(inf)
+ dscwrite.add2file(dscstatement)
+ for id in ids:
+ dscwrite.add2file(conf.eval_id(id))
+ if title_flag:
+ dscwrite.add2file(title)
+ title_flag=0
+ if len(info) == 1:
+ dscwrite.add2file(info)
+ elif len(info) == 2:
+ if info_flag:
+ dscwrite.add2file(info[0])
+ info_flag =0
+ else:
+ dscwrite.add2file(info[1])
+
+ def del_repeat(self,List):
+ if len(List) == 1 or len(List) == 0:
+ return List
+ else:
+ if type(List[0]) != type('xxx'):
+ alist=[]
+ for i in range(len(List)):
+ if i == 0:
+ alist.append(List[0])
+ else:
+ plist = []
+ for j in range(i):
+ plist += List[j]
+ alist.append(self.__del(list(set(plist)), List[i]))
+ return alist
+ else:
+ return list(set(List))
+
+
+ def __del(self,list1,list2):
+ return list(set(list2).difference(set(list1)))
+
+ def reverse_dict(self,dict):
+ data={}
+ for i in list(dict.items()):
+ if i[1] not in list(data.keys()):
+ data[i[1]]=[i[0]]
+ else:
+ data[i[1]].append(i[0])
+ return data
+
+ def read_list(self,list):
+ title_list=[]
+ info_list=[]
+ for i in list[1]:
+ title_list.append(i[0])
+ for j in i[1]:
+ info_list.append(j)
+ return list[0],title_list,info_list
+
+ def plus(self,list):
+ nums=[]
+ for i in list:
+ if type(i) != type([0]):
+ self.init += 1
+ num = "0x%01x" % self.init
+ j=i.replace('0xFCD00000',num.upper())
+ nums.append(j)
+ return nums
+
+class write2file(object):
+
+ def __init__(self,Output):
+ self.output=Output
+ self.text=''
+ if os.path.exists(self.output):
+ os.remove(self.output)
+
+ def add2file(self,content):
+ self.text = ''
+ with open(self.output,'a+') as file:
+ file.write(self.__gen(content))
+
+ def __gen(self,content):
+ if type(content) == type(''):
+ return content
+ elif type(content) == type([0,0])or type(content) == type((0,0)):
+ return self.__readlist(content)
+ elif type(content) == type({0:0}):
+ return self.__readdict(content)
+
+ def __readlist(self,list):
+ for i in list:
+ if type(i) == type([0,0])or type(i) == type((0,0)):
+ self.__readlist(i)
+ elif type(i) == type('') :
+ self.text +=i
+ return self.text
+
+ def __readdict(self,dict):
+ content=list(dict.items())
+ return self.__readlist(content)
+
+def stamp():
+ return datetime.datetime.now()
+
+def dtime(start,end,id=None):
+ if id:
+ pass
+ print("%s time:%s" % (id,str(end - start)))
+ else:
+ print("Total time:%s" %str(end-start)[:-7])
+
+
+def main():
+ start = stamp()
+ parser = argparse.ArgumentParser(prog = __prog__,
+ description = __description__ + __copyright__,
+ conflict_handler = 'resolve')
+ parser.add_argument('-v', '--version', action = 'version',version = __version__, help="show program's version number and exit")
+ parser.add_argument('-p', '--path', metavar='PATH', dest='path', help="platform build output directory")
+ parser.add_argument('-c', '--config',metavar='FILENAME', dest='config', help="firmware configuration file")
+ parser.add_argument('-o', '--outputdir', metavar='PATH', dest='output', help="output directoy")
+ options = parser.parse_args()
+ if options.config:
+ if options.path:
+ if options.output:
+ run = mainprocess(options.path, options.config, options.output)
+ print("Running...")
+ run.write_all()
+ if WARNING:
+ warning = list(set(WARNING))
+ for j in warning:
+ print(j)
+ if ERRORMSG:
+ ERROR = list(set(ERRORMSG))
+ with open("ERROR.log", 'w+') as error:
+ for i in ERROR:
+ error.write(i + '\n')
+ print("Some error find, error log in ERROR.log")
+ print('Finished, Output files in directory %s'%os.path.abspath(options.output))
+ else:
+ print('Error command, no output path, use -h for help')
+ else:
+ print('Error command, no build path input, use -h for help')
+ else:
+ print('Error command, no output file, use -h for help')
+ end = stamp()
+ dtime(start, end)
+
+if __name__ == '__main__':
+ main()
diff --git a/roms/edk2/BaseTools/Scripts/ConvertMasmToNasm.py b/roms/edk2/BaseTools/Scripts/ConvertMasmToNasm.py
new file mode 100755
index 000000000..0ef5a8bad
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/ConvertMasmToNasm.py
@@ -0,0 +1,1005 @@
+# @file ConvertMasmToNasm.py
+# This script assists with conversion of MASM assembly syntax to NASM
+#
+# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import print_function
+
+#
+# Import Modules
+#
+import argparse
+import io
+import os.path
+import re
+import subprocess
+import sys
+
+
+class UnsupportedConversion(Exception):
+ pass
+
+
+class NoSourceFile(Exception):
+ pass
+
+
+class UnsupportedArch(Exception):
+ unsupported = ('aarch64', 'arm', 'ebc', 'ipf')
+
+
+class CommonUtils:
+
+ # Version and Copyright
+ VersionNumber = "0.01"
+ __version__ = "%prog Version " + VersionNumber
+ __copyright__ = "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved."
+ __usage__ = "%prog [options] source.asm [destination.nasm]"
+
+ def __init__(self, clone=None):
+ if clone is None:
+ self.args = self.ProcessCommandLine()
+ else:
+ self.args = clone.args
+
+ self.unsupportedSyntaxSeen = False
+ self.src = self.args.source
+ self.keep = self.args.keep
+ assert(os.path.exists(self.src))
+ self.dirmode = os.path.isdir(self.src)
+ srcExt = os.path.splitext(self.src)[1]
+ assert (self.dirmode or srcExt != '.nasm')
+ self.infmode = not self.dirmode and srcExt == '.inf'
+ self.diff = self.args.diff
+ self.git = self.args.git
+ self.force = self.args.force
+
+ if clone is None:
+ self.rootdir = os.getcwd()
+ self.DetectGit()
+ else:
+ self.rootdir = clone.rootdir
+ self.gitdir = clone.gitdir
+ self.gitemail = clone.gitemail
+
+ def ProcessCommandLine(self):
+ parser = argparse.ArgumentParser(description=self.__copyright__)
+ parser.add_argument('--version', action='version',
+ version='%(prog)s ' + self.VersionNumber)
+ parser.add_argument("-q", "--quiet", action="store_true",
+ help="Disable all messages except FATAL ERRORS.")
+ parser.add_argument("--git", action="store_true",
+ help="Use git to create commits for each file converted")
+ parser.add_argument("--keep", action="append", choices=('asm', 's'),
+ default=[],
+ help="Don't remove files with this extension")
+ parser.add_argument("--diff", action="store_true",
+ help="Show diff of conversion")
+ parser.add_argument("-f", "--force", action="store_true",
+ help="Force conversion even if unsupported")
+ parser.add_argument('source', help='MASM input file')
+ parser.add_argument('dest', nargs='?',
+ help='NASM output file (default=input.nasm; - for stdout)')
+
+ return parser.parse_args()
+
+ def RootRelative(self, path):
+ result = path
+ if result.startswith(self.rootdir):
+ result = result[len(self.rootdir):]
+ while len(result) > 0 and result[0] in '/\\':
+ result = result[1:]
+ return result
+
+ def MatchAndSetMo(self, regexp, string):
+ self.mo = regexp.match(string)
+ return self.mo is not None
+
+ def SearchAndSetMo(self, regexp, string):
+ self.mo = regexp.search(string)
+ return self.mo is not None
+
+ def ReplacePreserveSpacing(self, string, find, replace):
+ if len(find) >= len(replace):
+ padded = replace + (' ' * (len(find) - len(replace)))
+ return string.replace(find, padded)
+ elif find.find(replace) >= 0:
+ return string.replace(find, replace)
+ else:
+ lenDiff = len(replace) - len(find)
+ result = string
+ for i in range(lenDiff, -1, -1):
+ padded = find + (' ' * i)
+ result = result.replace(padded, replace)
+ return result
+
+ def DetectGit(self):
+ lastpath = os.path.realpath(self.src)
+ self.gitdir = None
+ while True:
+ path = os.path.split(lastpath)[0]
+ if path == lastpath:
+ self.gitemail = None
+ return
+ candidate = os.path.join(path, '.git')
+ if os.path.isdir(candidate):
+ self.gitdir = candidate
+ self.gitemail = self.FormatGitEmailAddress()
+ return
+ lastpath = path
+
+ def FormatGitEmailAddress(self):
+ if not self.git or not self.gitdir:
+ return ''
+
+ cmd = ('git', 'config', 'user.name')
+ name = self.RunAndCaptureOutput(cmd).strip()
+ cmd = ('git', 'config', 'user.email')
+ email = self.RunAndCaptureOutput(cmd).strip()
+ if name.find(',') >= 0:
+ name = '"' + name + '"'
+ return name + ' <' + email + '>'
+
+ def RunAndCaptureOutput(self, cmd, checkExitCode=True, pipeIn=None):
+ if pipeIn:
+ subpStdin = subprocess.PIPE
+ else:
+ subpStdin = None
+ p = subprocess.Popen(args=cmd, stdout=subprocess.PIPE, stdin=subpStdin)
+ (stdout, stderr) = p.communicate(pipeIn)
+ if checkExitCode:
+ if p.returncode != 0:
+ print('command:', ' '.join(cmd))
+ print('stdout:', stdout)
+ print('stderr:', stderr)
+ print('return:', p.returncode)
+ assert p.returncode == 0
+ return stdout.decode('utf-8', 'ignore')
+
+ def FileUpdated(self, path):
+ if not self.git or not self.gitdir:
+ return
+
+ cmd = ('git', 'add', path)
+ self.RunAndCaptureOutput(cmd)
+
+ def FileAdded(self, path):
+ self.FileUpdated(path)
+
+ def RemoveFile(self, path):
+ if not self.git or not self.gitdir:
+ return
+
+ if self.ShouldKeepFile(path):
+ return
+
+ cmd = ('git', 'rm', path)
+ self.RunAndCaptureOutput(cmd)
+
+ def ShouldKeepFile(self, path):
+ ext = os.path.splitext(path)[1].lower()
+ if ext.startswith('.'):
+ ext = ext[1:]
+ return ext in self.keep
+
+ def FileConversionFinished(self, pkg, module, src, dst):
+ if not self.git or not self.gitdir:
+ return
+
+ if not self.args.quiet:
+ print('Committing: Conversion of', dst)
+
+ prefix = ' '.join(filter(lambda a: a, [pkg, module]))
+ message = ''
+ if self.unsupportedSyntaxSeen:
+ message += 'ERROR! '
+ message += '%s: Convert %s to NASM\n' % (prefix, src)
+ message += '\n'
+ message += 'The %s script was used to convert\n' % sys.argv[0]
+ message += '%s to %s\n' % (src, dst)
+ message += '\n'
+ message += 'Contributed-under: TianoCore Contribution Agreement 1.0\n'
+ assert(self.gitemail is not None)
+ message += 'Signed-off-by: %s\n' % self.gitemail
+ message = message.encode('utf-8', 'ignore')
+
+ cmd = ('git', 'commit', '-F', '-')
+ self.RunAndCaptureOutput(cmd, pipeIn=message)
+
+
+class ConvertAsmFile(CommonUtils):
+
+ def __init__(self, src, dst, clone):
+ CommonUtils.__init__(self, clone)
+ self.ConvertAsmFile(src, dst)
+ self.FileAdded(dst)
+ self.RemoveFile(src)
+
+ def ConvertAsmFile(self, inputFile, outputFile=None):
+ self.globals = set()
+ self.unsupportedSyntaxSeen = False
+ self.inputFilename = inputFile
+ if not outputFile:
+ outputFile = os.path.splitext(inputFile)[0] + '.nasm'
+ self.outputFilename = outputFile
+
+ fullSrc = os.path.realpath(inputFile)
+ srcParentDir = os.path.basename(os.path.split(fullSrc)[0])
+ maybeArch = srcParentDir.lower()
+ if maybeArch in UnsupportedArch.unsupported:
+ raise UnsupportedArch
+ self.ia32 = maybeArch == 'ia32'
+ self.x64 = maybeArch == 'x64'
+
+ self.inputFileBase = os.path.basename(self.inputFilename)
+ self.outputFileBase = os.path.basename(self.outputFilename)
+ self.output = io.BytesIO()
+ if not self.args.quiet:
+ dirpath, src = os.path.split(self.inputFilename)
+ dirpath = self.RootRelative(dirpath)
+ dst = os.path.basename(self.outputFilename)
+ print('Converting:', dirpath, src, '->', dst)
+ lines = io.open(self.inputFilename).readlines()
+ self.Convert(lines)
+ if self.outputFilename == '-' and not self.diff:
+ output_data = self.output.getvalue()
+ if sys.version_info >= (3, 0):
+ output_data = output_data.decode('utf-8', 'ignore')
+ sys.stdout.write(output_data)
+ self.output.close()
+ else:
+ f = io.open(self.outputFilename, 'wb')
+ f.write(self.output.getvalue())
+ f.close()
+ self.output.close()
+
+ endOfLineRe = re.compile(r'''
+ \s* ( ; .* )? \n $
+ ''',
+ re.VERBOSE | re.MULTILINE
+ )
+ begOfLineRe = re.compile(r'''
+ \s*
+ ''',
+ re.VERBOSE
+ )
+
+ def Convert(self, lines):
+ self.proc = None
+ self.anonLabelCount = -1
+ output = self.output
+ self.oldAsmEmptyLineCount = 0
+ self.newAsmEmptyLineCount = 0
+ for line in lines:
+ mo = self.begOfLineRe.search(line)
+ assert mo is not None
+ self.indent = mo.group()
+ lineWithoutBeginning = line[len(self.indent):]
+ mo = self.endOfLineRe.search(lineWithoutBeginning)
+ if mo is None:
+ endOfLine = ''
+ else:
+ endOfLine = mo.group()
+ oldAsm = line[len(self.indent):len(line) - len(endOfLine)]
+ self.originalLine = line.rstrip()
+ if line.strip() == '':
+ self.oldAsmEmptyLineCount += 1
+ self.TranslateAsm(oldAsm, endOfLine)
+ if line.strip() != '':
+ self.oldAsmEmptyLineCount = 0
+
+ procDeclRe = re.compile(r'''
+ (?: ASM_PFX \s* [(] \s* )?
+ ([\w@][\w@0-9]*) \s*
+ [)]? \s+
+ PROC
+ (?: \s+ NEAR | FAR )?
+ (?: \s+ C )?
+ (?: \s+ (PUBLIC | PRIVATE) )?
+ (?: \s+ USES ( (?: \s+ \w[\w0-9]* )+ ) )?
+ \s* $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ procEndRe = re.compile(r'''
+ ([\w@][\w@0-9]*) \s+
+ ENDP
+ \s* $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ varAndTypeSubRe = r' (?: [\w@][\w@0-9]* ) (?: \s* : \s* \w+ )? '
+ publicRe = re.compile(r'''
+ PUBLIC \s+
+ ( %s (?: \s* , \s* %s )* )
+ \s* $
+ ''' % (varAndTypeSubRe, varAndTypeSubRe),
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ varAndTypeSubRe = re.compile(varAndTypeSubRe, re.VERBOSE | re.IGNORECASE)
+
+ macroDeclRe = re.compile(r'''
+ ([\w@][\w@0-9]*) \s+
+ MACRO
+ \s* $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ sectionDeclRe = re.compile(r'''
+ ([\w@][\w@0-9]*) \s+
+ ( SECTION | ENDS )
+ \s* $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ externRe = re.compile(r'''
+ EXTE?RN \s+ (?: C \s+ )?
+ ([\w@][\w@0-9]*) \s* : \s* (\w+)
+ \s* $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ externdefRe = re.compile(r'''
+ EXTERNDEF \s+ (?: C \s+ )?
+ ([\w@][\w@0-9]*) \s* : \s* (\w+)
+ \s* $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ protoRe = re.compile(r'''
+ ([\w@][\w@0-9]*) \s+
+ PROTO
+ (?: \s+ .* )?
+ \s* $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ defineDataRe = re.compile(r'''
+ ([\w@][\w@0-9]*) \s+
+ ( db | dw | dd | dq ) \s+
+ ( .*? )
+ \s* $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ equRe = re.compile(r'''
+ ([\w@][\w@0-9]*) \s+ EQU \s+ (\S.*?)
+ \s* $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ ignoreRe = re.compile(r'''
+ \. (?: const |
+ mmx |
+ model |
+ xmm |
+ x?list |
+ [3-6]86p?
+ ) |
+ page
+ (?: \s+ .* )?
+ \s* $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ whitespaceRe = re.compile(r'\s+', re.MULTILINE)
+
+ def TranslateAsm(self, oldAsm, endOfLine):
+ assert(oldAsm.strip() == oldAsm)
+
+ endOfLine = endOfLine.replace(self.inputFileBase, self.outputFileBase)
+
+ oldOp = oldAsm.split()
+ if len(oldOp) >= 1:
+ oldOp = oldOp[0]
+ else:
+ oldOp = ''
+
+ if oldAsm == '':
+ newAsm = oldAsm
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ elif oldOp in ('#include', ):
+ newAsm = oldAsm
+ self.EmitLine(oldAsm + endOfLine)
+ elif oldOp.lower() in ('end', 'title', 'text'):
+ newAsm = ''
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ elif oldAsm.lower() == '@@:':
+ self.anonLabelCount += 1
+ self.EmitLine(self.anonLabel(self.anonLabelCount) + ':')
+ elif self.MatchAndSetMo(self.ignoreRe, oldAsm):
+ newAsm = ''
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ elif oldAsm.lower() == 'ret':
+ for i in range(len(self.uses) - 1, -1, -1):
+ register = self.uses[i]
+ self.EmitNewContent('pop ' + register)
+ newAsm = 'ret'
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ self.uses = tuple()
+ elif oldOp.lower() == 'lea':
+ newAsm = self.ConvertLea(oldAsm)
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ elif oldAsm.lower() == 'end':
+ newAsm = ''
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ self.uses = tuple()
+ elif self.MatchAndSetMo(self.equRe, oldAsm):
+ equ = self.mo.group(1)
+ newAsm = '%%define %s %s' % (equ, self.mo.group(2))
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ elif self.MatchAndSetMo(self.externRe, oldAsm) or \
+ self.MatchAndSetMo(self.protoRe, oldAsm):
+ extern = self.mo.group(1)
+ self.NewGlobal(extern)
+ newAsm = 'extern ' + extern
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ elif self.MatchAndSetMo(self.externdefRe, oldAsm):
+ newAsm = ''
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ elif self.MatchAndSetMo(self.macroDeclRe, oldAsm):
+ newAsm = '%%macro %s 0' % self.mo.group(1)
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ elif oldOp.lower() == 'endm':
+ newAsm = r'%endmacro'
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ elif self.MatchAndSetMo(self.sectionDeclRe, oldAsm):
+ name = self.mo.group(1)
+ ty = self.mo.group(2)
+ if ty.lower() == 'section':
+ newAsm = '.' + name
+ else:
+ newAsm = ''
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ elif self.MatchAndSetMo(self.procDeclRe, oldAsm):
+ proc = self.proc = self.mo.group(1)
+ visibility = self.mo.group(2)
+ if visibility is None:
+ visibility = ''
+ else:
+ visibility = visibility.lower()
+ if visibility != 'private':
+ self.NewGlobal(self.proc)
+ proc = 'ASM_PFX(' + proc + ')'
+ self.EmitNewContent('global ' + proc)
+ newAsm = proc + ':'
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ uses = self.mo.group(3)
+ if uses is not None:
+ uses = tuple(filter(None, uses.split()))
+ else:
+ uses = tuple()
+ self.uses = uses
+ for register in self.uses:
+ self.EmitNewContent(' push ' + register)
+ elif self.MatchAndSetMo(self.procEndRe, oldAsm):
+ newAsm = ''
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ elif self.MatchAndSetMo(self.publicRe, oldAsm):
+ publics = re.findall(self.varAndTypeSubRe, self.mo.group(1))
+ publics = tuple(map(lambda p: p.split(':')[0].strip(), publics))
+ for i in range(len(publics) - 1):
+ name = publics[i]
+ self.EmitNewContent('global ASM_PFX(%s)' % publics[i])
+ self.NewGlobal(name)
+ name = publics[-1]
+ self.NewGlobal(name)
+ newAsm = 'global ASM_PFX(%s)' % name
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ elif self.MatchAndSetMo(self.defineDataRe, oldAsm):
+ name = self.mo.group(1)
+ ty = self.mo.group(2)
+ value = self.mo.group(3)
+ if value == '?':
+ value = 0
+ newAsm = '%s: %s %s' % (name, ty, value)
+ newAsm = self.CommonConversions(newAsm)
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+ else:
+ newAsm = self.CommonConversions(oldAsm)
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+
+ def NewGlobal(self, name):
+ regex = re.compile(r'(?<![_\w\d])(?<!ASM_PFX\()(' + re.escape(name) +
+ r')(?![_\w\d])')
+ self.globals.add(regex)
+
+ def ConvertAnonymousLabels(self, oldAsm):
+ newAsm = oldAsm
+ anonLabel = self.anonLabel(self.anonLabelCount)
+ newAsm = newAsm.replace('@b', anonLabel)
+ newAsm = newAsm.replace('@B', anonLabel)
+ anonLabel = self.anonLabel(self.anonLabelCount + 1)
+ newAsm = newAsm.replace('@f', anonLabel)
+ newAsm = newAsm.replace('@F', anonLabel)
+ return newAsm
+
+ def anonLabel(self, count):
+ return '.%d' % count
+
+ def EmitString(self, string):
+ self.output.write(string.encode('utf-8', 'ignore'))
+
+ def EmitLineWithDiff(self, old, new):
+ newLine = (self.indent + new).rstrip()
+ if self.diff:
+ if old is None:
+ print('+%s' % newLine)
+ elif newLine != old:
+ print('-%s' % old)
+ print('+%s' % newLine)
+ else:
+ print('', newLine)
+ if newLine != '':
+ self.newAsmEmptyLineCount = 0
+ self.EmitString(newLine + '\r\n')
+
+ def EmitLine(self, string):
+ self.EmitLineWithDiff(self.originalLine, string)
+
+ def EmitNewContent(self, string):
+ self.EmitLineWithDiff(None, string)
+
+ def EmitAsmReplaceOp(self, oldAsm, oldOp, newOp, endOfLine):
+ newAsm = oldAsm.replace(oldOp, newOp, 1)
+ self.EmitAsmWithComment(oldAsm, newAsm, endOfLine)
+
+ hexNumRe = re.compile(r'0*((?=[\da-f])\d*(?<=\d)[\da-f]*)h', re.IGNORECASE)
+
+ def EmitAsmWithComment(self, oldAsm, newAsm, endOfLine):
+ for glblRe in self.globals:
+ newAsm = glblRe.sub(r'ASM_PFX(\1)', newAsm)
+
+ newAsm = self.hexNumRe.sub(r'0x\1', newAsm)
+
+ newLine = newAsm + endOfLine
+ emitNewLine = ((newLine.strip() != '') or
+ ((oldAsm + endOfLine).strip() == ''))
+ if emitNewLine and newLine.strip() == '':
+ self.newAsmEmptyLineCount += 1
+ if self.newAsmEmptyLineCount > 1:
+ emitNewLine = False
+ if emitNewLine:
+ self.EmitLine(newLine.rstrip())
+ elif self.diff:
+ print('-%s' % self.originalLine)
+
+ leaRe = re.compile(r'''
+ (lea \s+) ([\w@][\w@0-9]*) \s* , \s* (\S (?:.*\S)?)
+ \s* $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ def ConvertLea(self, oldAsm):
+ newAsm = oldAsm
+ if self.MatchAndSetMo(self.leaRe, oldAsm):
+ lea = self.mo.group(1)
+ dst = self.mo.group(2)
+ src = self.mo.group(3)
+ if src.find('[') < 0:
+ src = '[' + src + ']'
+ newAsm = lea + dst + ', ' + src
+ newAsm = self.CommonConversions(newAsm)
+ return newAsm
+
+ ptrRe = re.compile(r'''
+ (?<! \S )
+ ([dfq]?word|byte) \s+ (?: ptr ) (\s*)
+ (?= [[\s] )
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ def ConvertPtr(self, oldAsm):
+ newAsm = oldAsm
+ while self.SearchAndSetMo(self.ptrRe, newAsm):
+ ty = self.mo.group(1)
+ if ty.lower() == 'fword':
+ ty = ''
+ else:
+ ty += self.mo.group(2)
+ newAsm = newAsm[:self.mo.start(0)] + ty + newAsm[self.mo.end(0):]
+ return newAsm
+
+ labelByteRe = re.compile(r'''
+ (?: \s+ label \s+ (?: [dfq]?word | byte ) )
+ (?! \S )
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ def ConvertLabelByte(self, oldAsm):
+ newAsm = oldAsm
+ if self.SearchAndSetMo(self.labelByteRe, newAsm):
+ newAsm = newAsm[:self.mo.start(0)] + ':' + newAsm[self.mo.end(0):]
+ return newAsm
+
+ unaryBitwiseOpRe = re.compile(r'''
+ ( NOT )
+ (?= \s+ \S )
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+ binaryBitwiseOpRe = re.compile(r'''
+ ( \S \s+ )
+ ( AND | OR | SHL | SHR )
+ (?= \s+ \S )
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+ bitwiseOpReplacements = {
+ 'not': '~',
+ 'and': '&',
+ 'shl': '<<',
+ 'shr': '>>',
+ 'or': '|',
+ }
+
+ def ConvertBitwiseOp(self, oldAsm):
+ newAsm = oldAsm
+ while self.SearchAndSetMo(self.binaryBitwiseOpRe, newAsm):
+ prefix = self.mo.group(1)
+ op = self.bitwiseOpReplacements[self.mo.group(2).lower()]
+ newAsm = newAsm[:self.mo.start(0)] + prefix + op + \
+ newAsm[self.mo.end(0):]
+ while self.SearchAndSetMo(self.unaryBitwiseOpRe, newAsm):
+ op = self.bitwiseOpReplacements[self.mo.group(1).lower()]
+ newAsm = newAsm[:self.mo.start(0)] + op + newAsm[self.mo.end(0):]
+ return newAsm
+
+ sectionRe = re.compile(r'''
+ \. ( code |
+ data
+ )
+ (?: \s+ .* )?
+ \s* $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ segmentRe = re.compile(r'''
+ ( code |
+ data )
+ (?: \s+ SEGMENT )
+ (?: \s+ .* )?
+ \s* $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ def ConvertSection(self, oldAsm):
+ newAsm = oldAsm
+ if self.MatchAndSetMo(self.sectionRe, newAsm) or \
+ self.MatchAndSetMo(self.segmentRe, newAsm):
+ name = self.mo.group(1).lower()
+ if name == 'code':
+ if self.x64:
+ self.EmitLine('DEFAULT REL')
+ name = 'text'
+ newAsm = 'SECTION .' + name
+ return newAsm
+
+ fwordRe = re.compile(r'''
+ (?<! \S )
+ fword
+ (?! \S )
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ def FwordUnsupportedCheck(self, oldAsm):
+ newAsm = oldAsm
+ if self.SearchAndSetMo(self.fwordRe, newAsm):
+ newAsm = self.Unsupported(newAsm, 'fword used')
+ return newAsm
+
+ __common_conversion_routines__ = (
+ ConvertAnonymousLabels,
+ ConvertPtr,
+ FwordUnsupportedCheck,
+ ConvertBitwiseOp,
+ ConvertLabelByte,
+ ConvertSection,
+ )
+
+ def CommonConversions(self, oldAsm):
+ newAsm = oldAsm
+ for conv in self.__common_conversion_routines__:
+ newAsm = conv(self, newAsm)
+ return newAsm
+
+ def Unsupported(self, asm, message=None):
+ if not self.force:
+ raise UnsupportedConversion
+
+ self.unsupportedSyntaxSeen = True
+ newAsm = '%error conversion unsupported'
+ if message:
+ newAsm += '; ' + message
+ newAsm += ': ' + asm
+ return newAsm
+
+
+class ConvertInfFile(CommonUtils):
+
+ def __init__(self, inf, clone):
+ CommonUtils.__init__(self, clone)
+ self.inf = inf
+ self.ScanInfAsmFiles()
+ if self.infmode:
+ self.ConvertInfAsmFiles()
+
+ infSrcRe = re.compile(r'''
+ \s*
+ ( [\w@][\w@0-9/]* \.(asm|s) )
+ \s* (?: \| [^#]* )?
+ \s* (?: \# .* )?
+ $
+ ''',
+ re.VERBOSE | re.IGNORECASE
+ )
+
+ def GetInfAsmFileMapping(self):
+ srcToDst = {'order': []}
+ for line in self.lines:
+ line = line.rstrip()
+ if self.MatchAndSetMo(self.infSrcRe, line):
+ src = self.mo.group(1)
+ srcExt = self.mo.group(2)
+ dst = os.path.splitext(src)[0] + '.nasm'
+ fullDst = os.path.join(self.dir, dst)
+ if src not in srcToDst and not os.path.exists(fullDst):
+ srcToDst[src] = dst
+ srcToDst['order'].append(src)
+ return srcToDst
+
+ def ScanInfAsmFiles(self):
+ src = self.inf
+ assert os.path.isfile(src)
+ f = io.open(src, 'rt')
+ self.lines = f.readlines()
+ f.close()
+
+ path = os.path.realpath(self.inf)
+ (self.dir, inf) = os.path.split(path)
+ parent = os.path.normpath(self.dir)
+ (lastpath, self.moduleName) = os.path.split(parent)
+ self.packageName = None
+ while True:
+ lastpath = os.path.normpath(lastpath)
+ (parent, basename) = os.path.split(lastpath)
+ if parent == lastpath:
+ break
+ if basename.endswith('Pkg'):
+ self.packageName = basename
+ break
+ lastpath = parent
+
+ self.srcToDst = self.GetInfAsmFileMapping()
+
+ self.dstToSrc = {'order': []}
+ for src in self.srcToDst['order']:
+ srcExt = os.path.splitext(src)[1]
+ dst = self.srcToDst[src]
+ if dst not in self.dstToSrc:
+ self.dstToSrc[dst] = [src]
+ self.dstToSrc['order'].append(dst)
+ else:
+ self.dstToSrc[dst].append(src)
+
+ def __len__(self):
+ return len(self.dstToSrc['order'])
+
+ def __iter__(self):
+ return iter(self.dstToSrc['order'])
+
+ def ConvertInfAsmFiles(self):
+ notConverted = []
+ unsupportedArchCount = 0
+ for dst in self:
+ didSomething = False
+ try:
+ self.UpdateInfAsmFile(dst)
+ didSomething = True
+ except UnsupportedConversion:
+ if not self.args.quiet:
+ print('MASM=>NASM conversion unsupported for', dst)
+ notConverted.append(dst)
+ except NoSourceFile:
+ if not self.args.quiet:
+ print('Source file missing for', reldst)
+ notConverted.append(dst)
+ except UnsupportedArch:
+ unsupportedArchCount += 1
+ else:
+ if didSomething:
+ self.ConversionFinished(dst)
+ if len(notConverted) > 0 and not self.args.quiet:
+ for dst in notConverted:
+ reldst = self.RootRelative(dst)
+ print('Unabled to convert', reldst)
+ if unsupportedArchCount > 0 and not self.args.quiet:
+ print('Skipped', unsupportedArchCount, 'files based on architecture')
+
+ def UpdateInfAsmFile(self, dst, IgnoreMissingAsm=False):
+ infPath = os.path.split(os.path.realpath(self.inf))[0]
+ asmSrc = os.path.splitext(dst)[0] + '.asm'
+ fullSrc = os.path.join(infPath, asmSrc)
+ fullDst = os.path.join(infPath, dst)
+ srcParentDir = os.path.basename(os.path.split(fullSrc)[0])
+ if srcParentDir.lower() in UnsupportedArch.unsupported:
+ raise UnsupportedArch
+ elif not os.path.exists(fullSrc):
+ if not IgnoreMissingAsm:
+ raise NoSourceFile
+ else: # not os.path.exists(fullDst):
+ conv = ConvertAsmFile(fullSrc, fullDst, self)
+ self.unsupportedSyntaxSeen = conv.unsupportedSyntaxSeen
+
+ fileChanged = False
+ recentSources = list()
+ i = 0
+ while i < len(self.lines):
+ line = self.lines[i].rstrip()
+ updatedLine = line
+ lineChanged = False
+ preserveOldSource = False
+ for src in self.dstToSrc[dst]:
+ assert self.srcToDst[src] == dst
+ updatedLine = self.ReplacePreserveSpacing(
+ updatedLine, src, dst)
+ lineChanged = updatedLine != line
+ if lineChanged:
+ preserveOldSource = self.ShouldKeepFile(src)
+ break
+
+ if lineChanged:
+ if preserveOldSource:
+ if updatedLine.strip() not in recentSources:
+ self.lines.insert(i, updatedLine + '\n')
+ recentSources.append(updatedLine.strip())
+ i += 1
+ if self.diff:
+ print('+%s' % updatedLine)
+ if self.diff:
+ print('', line)
+ else:
+ if self.diff:
+ print('-%s' % line)
+ if updatedLine.strip() in recentSources:
+ self.lines[i] = None
+ else:
+ self.lines[i] = updatedLine + '\n'
+ recentSources.append(updatedLine.strip())
+ if self.diff:
+ print('+%s' % updatedLine)
+ else:
+ if len(recentSources) > 0:
+ recentSources = list()
+ if self.diff:
+ print('', line)
+
+ fileChanged |= lineChanged
+ i += 1
+
+ if fileChanged:
+ self.lines = list(filter(lambda l: l is not None, self.lines))
+
+ for src in self.dstToSrc[dst]:
+ if not src.endswith('.asm'):
+ fullSrc = os.path.join(infPath, src)
+ if os.path.exists(fullSrc):
+ self.RemoveFile(fullSrc)
+
+ if fileChanged:
+ f = io.open(self.inf, 'w', newline='\r\n')
+ f.writelines(self.lines)
+ f.close()
+ self.FileUpdated(self.inf)
+
+ def ConversionFinished(self, dst):
+ asmSrc = os.path.splitext(dst)[0] + '.asm'
+ self.FileConversionFinished(
+ self.packageName, self.moduleName, asmSrc, dst)
+
+
+class ConvertInfFiles(CommonUtils):
+
+ def __init__(self, infs, clone):
+ CommonUtils.__init__(self, clone)
+ infs = map(lambda i: ConvertInfFile(i, self), infs)
+ infs = filter(lambda i: len(i) > 0, infs)
+ dstToInfs = {'order': []}
+ for inf in infs:
+ for dst in inf:
+ fulldst = os.path.realpath(os.path.join(inf.dir, dst))
+ pair = (inf, dst)
+ if fulldst in dstToInfs:
+ dstToInfs[fulldst].append(pair)
+ else:
+ dstToInfs['order'].append(fulldst)
+ dstToInfs[fulldst] = [pair]
+
+ notConverted = []
+ unsupportedArchCount = 0
+ for dst in dstToInfs['order']:
+ didSomething = False
+ try:
+ for inf, reldst in dstToInfs[dst]:
+ inf.UpdateInfAsmFile(reldst, IgnoreMissingAsm=didSomething)
+ didSomething = True
+ except UnsupportedConversion:
+ if not self.args.quiet:
+ print('MASM=>NASM conversion unsupported for', reldst)
+ notConverted.append(dst)
+ except NoSourceFile:
+ if not self.args.quiet:
+ print('Source file missing for', reldst)
+ notConverted.append(dst)
+ except UnsupportedArch:
+ unsupportedArchCount += 1
+ else:
+ if didSomething:
+ inf.ConversionFinished(reldst)
+ if len(notConverted) > 0 and not self.args.quiet:
+ for dst in notConverted:
+ reldst = self.RootRelative(dst)
+ print('Unabled to convert', reldst)
+ if unsupportedArchCount > 0 and not self.args.quiet:
+ print('Skipped', unsupportedArchCount, 'files based on architecture')
+
+
+class ConvertDirectories(CommonUtils):
+
+ def __init__(self, paths, clone):
+ CommonUtils.__init__(self, clone)
+ self.paths = paths
+ self.ConvertInfAndAsmFiles()
+
+ def ConvertInfAndAsmFiles(self):
+ infs = list()
+ for path in self.paths:
+ assert(os.path.exists(path))
+ for path in self.paths:
+ for root, dirs, files in os.walk(path):
+ for d in ('.svn', '.git'):
+ if d in dirs:
+ dirs.remove(d)
+ for f in files:
+ if f.lower().endswith('.inf'):
+ inf = os.path.realpath(os.path.join(root, f))
+ infs.append(inf)
+
+ ConvertInfFiles(infs, self)
+
+
+class ConvertAsmApp(CommonUtils):
+
+ def __init__(self):
+ CommonUtils.__init__(self)
+
+ src = self.args.source
+ dst = self.args.dest
+ if self.infmode:
+ ConvertInfFiles((src,), self)
+ elif self.dirmode:
+ ConvertDirectories((src,), self)
+ elif not self.dirmode:
+ ConvertAsmFile(src, dst, self)
+
+ConvertAsmApp()
diff --git a/roms/edk2/BaseTools/Scripts/ConvertUni.py b/roms/edk2/BaseTools/Scripts/ConvertUni.py
new file mode 100755
index 000000000..d87550b63
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/ConvertUni.py
@@ -0,0 +1,125 @@
+## @file
+# Check a patch for various format issues
+#
+# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import print_function
+
+VersionNumber = '0.1'
+__copyright__ = "Copyright (c) 2015, Intel Corporation All rights reserved."
+
+import argparse
+import codecs
+import os
+import sys
+
+class ConvertOneArg:
+ """Converts utf-16 to utf-8 for one command line argument.
+
+ This could be a single file, or a directory.
+ """
+
+ def __init__(self, utf8, source):
+ self.utf8 = utf8
+ self.source = source
+
+ self.ok = True
+
+ if not os.path.exists(source):
+ self.ok = False
+ elif os.path.isdir(source):
+ for (root, dirs, files) in os.walk(source):
+ files = filter(lambda a: a.endswith('.uni'), files)
+ for filename in files:
+ path = os.path.join(root, filename)
+ self.ok &= self.convert_one_file(path)
+ if not self.ok:
+ break
+
+ if not self.ok:
+ break
+ else:
+ self.ok &= self.convert_one_file(source)
+
+ def convert_one_file(self, source):
+ if self.utf8:
+ new_enc, old_enc = 'utf-8', 'utf-16'
+ else:
+ new_enc, old_enc = 'utf-16', 'utf-8'
+ #
+ # Read file
+ #
+ f = open(source, mode='rb')
+ file_content = f.read()
+ f.close()
+
+ #
+ # Detect UTF-16 Byte Order Mark at beginning of file.
+ #
+ bom = (file_content.startswith(codecs.BOM_UTF16_BE) or
+ file_content.startswith(codecs.BOM_UTF16_LE))
+ if bom != self.utf8:
+ print("%s: already %s" % (source, new_enc))
+ return True
+
+ #
+ # Decode old string data
+ #
+ str_content = file_content.decode(old_enc, 'ignore')
+
+ #
+ # Encode new string data
+ #
+ new_content = str_content.encode(new_enc, 'ignore')
+
+ #
+ # Write converted data back to file
+ #
+ f = open(source, mode='wb')
+ f.write(new_content)
+ f.close()
+
+ print(source + ": converted, size", len(file_content), '=>', len(new_content))
+ return True
+
+
+class ConvertUniApp:
+ """Converts .uni files between utf-16 and utf-8."""
+
+ def __init__(self):
+ self.parse_options()
+ sources = self.args.source
+
+ self.ok = True
+ for patch in sources:
+ self.process_one_arg(patch)
+
+ if self.ok:
+ self.retval = 0
+ else:
+ self.retval = -1
+
+ def process_one_arg(self, arg):
+ self.ok &= ConvertOneArg(self.utf8, arg).ok
+
+ def parse_options(self):
+ parser = argparse.ArgumentParser(description=__copyright__)
+ parser.add_argument('--version', action='version',
+ version='%(prog)s ' + VersionNumber)
+ parser.add_argument('source', nargs='+',
+ help='[uni file | directory]')
+ group = parser.add_mutually_exclusive_group()
+ group.add_argument("--utf-8",
+ action="store_true",
+ help="Convert from utf-16 to utf-8 [default]")
+ group.add_argument("--utf-16",
+ action="store_true",
+ help="Convert from utf-8 to utf-16")
+ self.args = parser.parse_args()
+ self.utf8 = not self.args.utf_16
+
+if __name__ == "__main__":
+ sys.exit(ConvertUniApp().retval)
diff --git a/roms/edk2/BaseTools/Scripts/DetectNotUsedItem.py b/roms/edk2/BaseTools/Scripts/DetectNotUsedItem.py
new file mode 100644
index 000000000..61481fb91
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/DetectNotUsedItem.py
@@ -0,0 +1,198 @@
+## @file
+# Detect unreferenced PCD and GUID/Protocols/PPIs.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+DetectNotUsedItem
+'''
+import re
+import os
+import sys
+import argparse
+
+#
+# Globals for help information
+#
+__prog__ = 'DetectNotUsedItem'
+__version__ = '%s Version %s' % (__prog__, '0.1')
+__copyright__ = 'Copyright (c) 2019, Intel Corporation. All rights reserved.'
+__description__ = "Detect unreferenced PCD and GUID/Protocols/PPIs.\n"
+
+SectionList = ["LibraryClasses", "Guids", "Ppis", "Protocols", "Pcd"]
+
+
+class PROCESS(object):
+
+ def __init__(self, DecPath, InfDirs):
+ self.Dec = DecPath
+ self.InfPath = InfDirs
+ self.Log = []
+
+ def ParserDscFdfInfFile(self):
+ AllContentList = []
+ for File in self.SearchbyExt([".dsc", ".fdf", ".inf"]):
+ AllContentList += self.ParseDscFdfInfContent(File)
+ return AllContentList
+
+ # Search File by extension name
+ def SearchbyExt(self, ExtList):
+ FileList = []
+ for path in self.InfPath:
+ if type(ExtList) == type(''):
+ for root, _, files in os.walk(path, topdown=True, followlinks=False):
+ for filename in files:
+ if filename.endswith(ExtList):
+ FileList.append(os.path.join(root, filename))
+ elif type(ExtList) == type([]):
+ for root, _, files in os.walk(path, topdown=True, followlinks=False):
+ for filename in files:
+ for Ext in ExtList:
+ if filename.endswith(Ext):
+ FileList.append(os.path.join(root, filename))
+ return FileList
+
+ # Parse DEC file to get Line number and Name
+ # return section name, the Item Name and comments line number
+ def ParseDecContent(self):
+ SectionRE = re.compile(r'\[(.*)\]')
+ Flag = False
+ Comments = {}
+ Comment_Line = []
+ ItemName = {}
+ with open(self.Dec, 'r') as F:
+ for Index, content in enumerate(F):
+ NotComment = not content.strip().startswith("#")
+ Section = SectionRE.findall(content)
+ if Section and NotComment:
+ Flag = self.IsNeedParseSection(Section[0])
+ if Flag:
+ Comment_Line.append(Index)
+ if NotComment:
+ if content != "\n" and content != "\r\n":
+ ItemName[Index] = content.split('=')[0].split('|')[0].split('#')[0].strip()
+ Comments[Index] = Comment_Line
+ Comment_Line = []
+ return ItemName, Comments
+
+ def IsNeedParseSection(self, SectionName):
+ for item in SectionList:
+ if item in SectionName:
+ return True
+ return False
+
+ # Parse DSC, FDF, INF File, remove comments, return Lines list
+ def ParseDscFdfInfContent(self, File):
+ with open(File, 'r') as F:
+ lines = F.readlines()
+ for Index in range(len(lines) - 1, -1, -1):
+ if lines[Index].strip().startswith("#") or lines[Index] == "\n" or lines[Index] == "\r\n":
+ lines.remove(lines[Index])
+ elif "#" in lines[Index]:
+ lines[Index] = lines[Index].split("#")[0].strip()
+ else:
+ lines[Index] = lines[Index].strip()
+ return lines
+
+ def DetectNotUsedItem(self):
+ NotUsedItem = {}
+ DecItem, DecComments = self.ParseDecContent()
+ InfDscFdfContent = self.ParserDscFdfInfFile()
+ for LineNum in list(DecItem.keys()):
+ DecItemName = DecItem[LineNum]
+ Match_reg = re.compile("(?<![a-zA-Z0-9_-])%s(?![a-zA-Z0-9_-])" % DecItemName)
+ MatchFlag = False
+ for Line in InfDscFdfContent:
+ if Match_reg.search(Line):
+ MatchFlag = True
+ break
+ if not MatchFlag:
+ NotUsedItem[LineNum] = DecItemName
+ self.Display(NotUsedItem)
+ return NotUsedItem, DecComments
+
+ def Display(self, UnuseDict):
+ print("DEC File:\n%s\n%s%s" % (self.Dec, "{:<15}".format("Line Number"), "{:<0}".format("Unused Item")))
+ self.Log.append(
+ "DEC File:\n%s\n%s%s\n" % (self.Dec, "{:<15}".format("Line Number"), "{:<0}".format("Unused Item")))
+ for num in list(sorted(UnuseDict.keys())):
+ ItemName = UnuseDict[num]
+ print("%s%s%s" % (" " * 3, "{:<12}".format(num + 1), "{:<1}".format(ItemName)))
+ self.Log.append(("%s%s%s\n" % (" " * 3, "{:<12}".format(num + 1), "{:<1}".format(ItemName))))
+
+ def Clean(self, UnUseDict, Comments):
+ removednum = []
+ for num in list(UnUseDict.keys()):
+ if num in list(Comments.keys()):
+ removednum += Comments[num]
+ with open(self.Dec, 'r') as Dec:
+ lines = Dec.readlines()
+ try:
+ with open(self.Dec, 'w+') as T:
+ for linenum in range(len(lines)):
+ if linenum in removednum:
+ continue
+ else:
+ T.write(lines[linenum])
+ print("DEC File has been clean: %s" % (self.Dec))
+ except Exception as err:
+ print(err)
+
+
+class Main(object):
+
+ def mainprocess(self, Dec, Dirs, Isclean, LogPath):
+ for dir in Dirs:
+ if not os.path.exists(dir):
+ print("Error: Invalid path for '--dirs': %s" % dir)
+ sys.exit(1)
+ Pa = PROCESS(Dec, Dirs)
+ unuse, comment = Pa.DetectNotUsedItem()
+ if Isclean:
+ Pa.Clean(unuse, comment)
+ self.Logging(Pa.Log, LogPath)
+
+ def Logging(self, content, LogPath):
+ if LogPath:
+ try:
+ if os.path.isdir(LogPath):
+ FilePath = os.path.dirname(LogPath)
+ if not os.path.exists(FilePath):
+ os.makedirs(FilePath)
+ with open(LogPath, 'w+') as log:
+ for line in content:
+ log.write(line)
+ print("Log save to file: %s" % LogPath)
+ except Exception as e:
+ print("Save log Error: %s" % e)
+
+
+def main():
+ parser = argparse.ArgumentParser(prog=__prog__,
+ description=__description__ + __copyright__,
+ conflict_handler='resolve')
+ parser.add_argument('-i', '--input', metavar="", dest='InputDec', help="Input DEC file name.")
+ parser.add_argument('--dirs', metavar="", action='append', dest='Dirs',
+ help="The package directory. To specify more directories, please repeat this option.")
+ parser.add_argument('--clean', action='store_true', default=False, dest='Clean',
+ help="Clean the unreferenced items from DEC file.")
+ parser.add_argument('--log', metavar="", dest="Logfile", default=False,
+ help="Put log in specified file as well as on console.")
+ options = parser.parse_args()
+ if options.InputDec:
+ if not (os.path.exists(options.InputDec) and options.InputDec.endswith(".dec")):
+ print("Error: Invalid DEC file input: %s" % options.InputDec)
+ if options.Dirs:
+ M = Main()
+ M.mainprocess(options.InputDec, options.Dirs, options.Clean, options.Logfile)
+ else:
+ print("Error: the following argument is required:'--dirs'.")
+ else:
+ print("Error: the following argument is required:'-i/--input'.")
+
+
+if __name__ == '__main__':
+ main()
diff --git a/roms/edk2/BaseTools/Scripts/FormatDosFiles.py b/roms/edk2/BaseTools/Scripts/FormatDosFiles.py
new file mode 100644
index 000000000..e119334de
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/FormatDosFiles.py
@@ -0,0 +1,107 @@
+# @file FormatDosFiles.py
+# This script format the source files to follow dos style.
+# It supports Python2.x and Python3.x both.
+#
+# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+#
+# Import Modules
+#
+from __future__ import print_function
+import argparse
+import os
+import os.path
+import re
+import sys
+import copy
+
+__prog__ = 'FormatDosFiles'
+__version__ = '%s Version %s' % (__prog__, '0.10 ')
+__copyright__ = 'Copyright (c) 2018-2019, Intel Corporation. All rights reserved.'
+__description__ = 'Convert source files to meet the EDKII C Coding Standards Specification.\n'
+DEFAULT_EXT_LIST = ['.h', '.c', '.nasm', '.nasmb', '.asm', '.S', '.inf', '.dec', '.dsc', '.fdf', '.uni', '.asl', '.aslc', '.vfr', '.idf', '.txt', '.bat', '.py']
+
+#For working in python2 and python3 environment, re pattern should use binary string, which is bytes type in python3.
+#Because in python3,read from file in binary mode will return bytes type,and in python3 bytes type can not be mixed with str type.
+def FormatFile(FilePath, Args):
+ with open(FilePath, 'rb') as Fd:
+ Content = Fd.read()
+ # Convert the line endings to CRLF
+ Content = re.sub(br'([^\r])\n', br'\1\r\n', Content)
+ Content = re.sub(br'^\n', br'\r\n', Content, flags=re.MULTILINE)
+ # Add a new empty line if the file is not end with one
+ Content = re.sub(br'([^\r\n])$', br'\1\r\n', Content)
+ # Remove trailing white spaces
+ Content = re.sub(br'[ \t]+(\r\n)', br'\1', Content, flags=re.MULTILINE)
+ # Replace '\t' with two spaces
+ Content = re.sub(b'\t', b' ', Content)
+ with open(FilePath, 'wb') as Fd:
+ Fd.write(Content)
+ if not Args.Quiet:
+ print(FilePath)
+
+def FormatFilesInDir(DirPath, ExtList, Args):
+
+ FileList = []
+ ExcludeDir = DirPath
+ for DirPath, DirNames, FileNames in os.walk(DirPath):
+ if Args.Exclude:
+ DirNames[:] = [d for d in DirNames if d not in Args.Exclude]
+ FileNames[:] = [f for f in FileNames if f not in Args.Exclude]
+ Continue = False
+ for Path in Args.Exclude:
+ Path = Path.strip('\\').strip('/')
+ if not os.path.isdir(Path) and not os.path.isfile(Path):
+ Path = os.path.join(ExcludeDir, Path)
+ if os.path.isdir(Path) and Path.endswith(DirPath):
+ DirNames[:] = []
+ Continue = True
+ elif os.path.isfile(Path):
+ FilePaths = FileNames
+ for ItemPath in FilePaths:
+ FilePath = os.path.join(DirPath, ItemPath)
+ if Path.endswith(FilePath):
+ FileNames.remove(ItemPath)
+ if Continue:
+ continue
+ for FileName in [f for f in FileNames if any(f.endswith(ext) for ext in ExtList)]:
+ FileList.append(os.path.join(DirPath, FileName))
+ for File in FileList:
+ FormatFile(File, Args)
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(prog=__prog__, description=__description__ + __copyright__, conflict_handler = 'resolve')
+
+ parser.add_argument('Path', nargs='+',
+ help='the path for files to be converted.It could be directory or file path.')
+ parser.add_argument('--version', action='version', version=__version__)
+ parser.add_argument('--append-extensions', dest='AppendExt', nargs='+',
+ help='append file extensions filter to default extensions. (Example: .txt .c .h)')
+ parser.add_argument('--override-extensions', dest='OverrideExt', nargs='+',
+ help='override file extensions filter on default extensions. (Example: .txt .c .h)')
+ parser.add_argument('-v', '--verbose', dest='Verbose', action='store_true',
+ help='increase output messages')
+ parser.add_argument('-q', '--quiet', dest='Quiet', action='store_true',
+ help='reduce output messages')
+ parser.add_argument('--debug', dest='Debug', type=int, metavar='[0-9]', choices=range(0, 10), default=0,
+ help='set debug level')
+ parser.add_argument('--exclude', dest='Exclude', nargs='+', help="directory name or file name which will be excluded")
+ args = parser.parse_args()
+ DefaultExt = copy.copy(DEFAULT_EXT_LIST)
+
+ if args.OverrideExt is not None:
+ DefaultExt = args.OverrideExt
+ if args.AppendExt is not None:
+ DefaultExt = list(set(DefaultExt + args.AppendExt))
+
+ for Path in args.Path:
+ if not os.path.exists(Path):
+ print("not exists path: {0}".format(Path))
+ sys.exit(1)
+ if os.path.isdir(Path):
+ FormatFilesInDir(Path, DefaultExt, args)
+ elif os.path.isfile(Path):
+ FormatFile(Path, args)
diff --git a/roms/edk2/BaseTools/Scripts/GccBase.lds b/roms/edk2/BaseTools/Scripts/GccBase.lds
new file mode 100644
index 000000000..a9dd2138d
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/GccBase.lds
@@ -0,0 +1,79 @@
+/** @file
+
+ Unified linker script for GCC based builds
+
+ Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+SECTIONS {
+
+ /*
+ * The PE/COFF binary consists of DOS and PE/COFF headers, and a sequence of
+ * section headers adding up to PECOFF_HEADER_SIZE bytes (which differs
+ * between 32-bit and 64-bit builds). The actual start of the .text section
+ * will be rounded up based on its actual alignment.
+ */
+ . = PECOFF_HEADER_SIZE;
+
+ .text : ALIGN(CONSTANT(COMMONPAGESIZE)) {
+ *(.text .text.* .stub .gnu.linkonce.t.*)
+ *(.rodata .rodata.* .gnu.linkonce.r.*)
+ *(.got .got.*)
+
+ /*
+ * The contents of AutoGen.c files are mostly constant from the POV of the
+ * program, but most of it ends up in .data or .bss by default since few of
+ * the variable definitions that get emitted are declared as CONST.
+ * Unfortunately, we cannot pull it into the .text section entirely, since
+ * patchable PCDs are also emitted here, but we can at least move all of the
+ * emitted GUIDs here.
+ */
+ *:AutoGen.obj(.data.g*Guid)
+ }
+
+ /*
+ * The alignment of the .data section should be less than or equal to the
+ * alignment of the .text section. This ensures that the relative offset
+ * between these sections is the same in the ELF and the PE/COFF versions of
+ * this binary.
+ */
+ .data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(COMMONPAGESIZE)) {
+ *(.data .data.* .gnu.linkonce.d.*)
+ *(.bss .bss.*)
+ }
+
+ .eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : {
+ KEEP (*(.eh_frame))
+ }
+
+ .rela (INFO) : {
+ *(.rela .rela.*)
+ }
+
+ .hii : ALIGN(CONSTANT(COMMONPAGESIZE)) {
+ KEEP (*(.hii))
+ }
+
+ /*
+ * Retain the GNU build id but in a non-allocatable section so GenFw
+ * does not copy it into the PE/COFF image.
+ */
+ .build-id (INFO) : { *(.note.gnu.build-id) }
+
+ /DISCARD/ : {
+ *(.note.GNU-stack)
+ *(.gnu_debuglink)
+ *(.interp)
+ *(.dynsym)
+ *(.dynstr)
+ *(.dynamic)
+ *(.hash .gnu.hash)
+ *(.comment)
+ *(COMMON)
+ }
+}
diff --git a/roms/edk2/BaseTools/Scripts/GetMaintainer.py b/roms/edk2/BaseTools/Scripts/GetMaintainer.py
new file mode 100644
index 000000000..ed7bc7dc2
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/GetMaintainer.py
@@ -0,0 +1,194 @@
+## @file
+# Retrieves the people to request review from on submission of a commit.
+#
+# Copyright (c) 2019, Linaro Ltd. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import print_function
+from collections import defaultdict
+from collections import OrderedDict
+import argparse
+import os
+import re
+import SetupGit
+
+EXPRESSIONS = {
+ 'exclude': re.compile(r'^X:\s*(?P<exclude>.*?)\r*$'),
+ 'file': re.compile(r'^F:\s*(?P<file>.*?)\r*$'),
+ 'list': re.compile(r'^L:\s*(?P<list>.*?)\r*$'),
+ 'maintainer': re.compile(r'^M:\s*(?P<maintainer>.*<.*?>)\r*$'),
+ 'reviewer': re.compile(r'^R:\s*(?P<reviewer>.*?)\r*$'),
+ 'status': re.compile(r'^S:\s*(?P<status>.*?)\r*$'),
+ 'tree': re.compile(r'^T:\s*(?P<tree>.*?)\r*$'),
+ 'webpage': re.compile(r'^W:\s*(?P<webpage>.*?)\r*$')
+}
+
+def printsection(section):
+ """Prints out the dictionary describing a Maintainers.txt section."""
+ print('===')
+ for key in section.keys():
+ print("Key: %s" % key)
+ for item in section[key]:
+ print(' %s' % item)
+
+def pattern_to_regex(pattern):
+ """Takes a string containing regular UNIX path wildcards
+ and returns a string suitable for matching with regex."""
+
+ pattern = pattern.replace('.', r'\.')
+ pattern = pattern.replace('?', r'.')
+ pattern = pattern.replace('*', r'.*')
+
+ if pattern.endswith('/'):
+ pattern += r'.*'
+ elif pattern.endswith('.*'):
+ pattern = pattern[:-2]
+ pattern += r'(?!.*?/.*?)'
+
+ return pattern
+
+def path_in_section(path, section):
+ """Returns True of False indicating whether the path is covered by
+ the current section."""
+ if not 'file' in section:
+ return False
+
+ for pattern in section['file']:
+ regex = pattern_to_regex(pattern)
+
+ match = re.match(regex, path)
+ if match:
+ # Check if there is an exclude pattern that applies
+ for pattern in section['exclude']:
+ regex = pattern_to_regex(pattern)
+
+ match = re.match(regex, path)
+ if match:
+ return False
+
+ return True
+
+ return False
+
+def get_section_maintainers(path, section):
+ """Returns a list with email addresses to any M: and R: entries
+ matching the provided path in the provided section."""
+ maintainers = []
+ lists = []
+ nowarn_status = ['Supported', 'Maintained']
+
+ if path_in_section(path, section):
+ for status in section['status']:
+ if status not in nowarn_status:
+ print('WARNING: Maintained status for "%s" is \'%s\'!' % (path, status))
+ for address in section['maintainer'], section['reviewer']:
+ # Convert to list if necessary
+ if isinstance(address, list):
+ maintainers += address
+ else:
+ lists += [address]
+ for address in section['list']:
+ # Convert to list if necessary
+ if isinstance(address, list):
+ lists += address
+ else:
+ lists += [address]
+
+ return maintainers, lists
+
+def get_maintainers(path, sections, level=0):
+ """For 'path', iterates over all sections, returning maintainers
+ for matching ones."""
+ maintainers = []
+ lists = []
+ for section in sections:
+ tmp_maint, tmp_lists = get_section_maintainers(path, section)
+ if tmp_maint:
+ maintainers += tmp_maint
+ if tmp_lists:
+ lists += tmp_lists
+
+ if not maintainers:
+ # If no match found, look for match for (nonexistent) file
+ # REPO.working_dir/<default>
+ print('"%s": no maintainers found, looking for default' % path)
+ if level == 0:
+ maintainers = get_maintainers('<default>', sections, level=level + 1)
+ else:
+ print("No <default> maintainers set for project.")
+ if not maintainers:
+ return None
+
+ return maintainers + lists
+
+def parse_maintainers_line(line):
+ """Parse one line of Maintainers.txt, returning any match group and its key."""
+ for key, expression in EXPRESSIONS.items():
+ match = expression.match(line)
+ if match:
+ return key, match.group(key)
+ return None, None
+
+def parse_maintainers_file(filename):
+ """Parse the Maintainers.txt from top-level of repo and
+ return a list containing dictionaries of all sections."""
+ with open(filename, 'r') as text:
+ line = text.readline()
+ sectionlist = []
+ section = defaultdict(list)
+ while line:
+ key, value = parse_maintainers_line(line)
+ if key and value:
+ section[key].append(value)
+
+ line = text.readline()
+ # If end of section (end of file, or non-tag line encountered)...
+ if not key or not value or not line:
+ # ...if non-empty, append section to list.
+ if section:
+ sectionlist.append(section.copy())
+ section.clear()
+
+ return sectionlist
+
+def get_modified_files(repo, args):
+ """Returns a list of the files modified by the commit specified in 'args'."""
+ commit = repo.commit(args.commit)
+ return commit.stats.files
+
+if __name__ == '__main__':
+ PARSER = argparse.ArgumentParser(
+ description='Retrieves information on who to cc for review on a given commit')
+ PARSER.add_argument('commit',
+ action="store",
+ help='git revision to examine (default: HEAD)',
+ nargs='?',
+ default='HEAD')
+ PARSER.add_argument('-l', '--lookup',
+ help='Find section matches for path LOOKUP',
+ required=False)
+ ARGS = PARSER.parse_args()
+
+ REPO = SetupGit.locate_repo()
+
+ CONFIG_FILE = os.path.join(REPO.working_dir, 'Maintainers.txt')
+
+ SECTIONS = parse_maintainers_file(CONFIG_FILE)
+
+ if ARGS.lookup:
+ FILES = [ARGS.lookup]
+ else:
+ FILES = get_modified_files(REPO, ARGS)
+
+ ADDRESSES = []
+
+ for file in FILES:
+ print(file)
+ addresslist = get_maintainers(file, SECTIONS)
+ if addresslist:
+ ADDRESSES += addresslist
+
+ for address in list(OrderedDict.fromkeys(ADDRESSES)):
+ print(' %s' % address)
diff --git a/roms/edk2/BaseTools/Scripts/GetUtcDateTime.py b/roms/edk2/BaseTools/Scripts/GetUtcDateTime.py
new file mode 100644
index 000000000..3cfb6ac2a
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/GetUtcDateTime.py
@@ -0,0 +1,44 @@
+## @file
+# Get current UTC date and time information and output as ascii code.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+VersionNumber = '0.1'
+import sys
+import datetime
+import argparse
+
+def Main():
+ PARSER = argparse.ArgumentParser(
+ description='Retrieves UTC date and time information (output ordering: year, date, time) - Version ' + VersionNumber)
+ PARSER.add_argument('--year',
+ action='store_true',
+ help='Return UTC year of now. [Example output (2019): 39313032]')
+ PARSER.add_argument('--date',
+ action='store_true',
+ help='Return UTC date MMDD of now. [Example output (7th August): 37303830]')
+ PARSER.add_argument('--time',
+ action='store_true',
+ help='Return 24-hour-format UTC time HHMM of now. [Example output (14:25): 35323431]')
+
+ ARGS = PARSER.parse_args()
+ if len(sys.argv) == 1:
+ print ("ERROR: At least one argument is required!\n")
+ PARSER.print_help()
+
+ today = datetime.datetime.utcnow()
+ if ARGS.year:
+ ReversedNumber = str(today.year)[::-1]
+ print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNumber))
+ if ARGS.date:
+ ReversedNumber = str(today.strftime("%m%d"))[::-1]
+ print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNumber))
+ if ARGS.time:
+ ReversedNumber = str(today.strftime("%H%M"))[::-1]
+ print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNumber))
+
+if __name__ == '__main__':
+ Main()
diff --git a/roms/edk2/BaseTools/Scripts/MemoryProfileSymbolGen.py b/roms/edk2/BaseTools/Scripts/MemoryProfileSymbolGen.py
new file mode 100644
index 000000000..69df2fb99
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/MemoryProfileSymbolGen.py
@@ -0,0 +1,276 @@
+##
+# Generate symbal for memory profile info.
+#
+# This tool depends on DIA2Dump.exe (VS) or nm (gcc) to parse debug entry.
+#
+# Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+from __future__ import print_function
+import os
+import re
+import sys
+from optparse import OptionParser
+
+versionNumber = "1.1"
+__copyright__ = "Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved."
+
+class Symbols:
+ def __init__(self):
+ self.listLineAddress = []
+ self.pdbName = ""
+ # Cache for function
+ self.functionName = ""
+ # Cache for line
+ self.sourceName = ""
+
+
+ def getSymbol (self, rva):
+ index = 0
+ lineName = 0
+ sourceName = "??"
+ while index + 1 < self.lineCount :
+ if self.listLineAddress[index][0] <= rva and self.listLineAddress[index + 1][0] > rva :
+ offset = rva - self.listLineAddress[index][0]
+ functionName = self.listLineAddress[index][1]
+ lineName = self.listLineAddress[index][2]
+ sourceName = self.listLineAddress[index][3]
+ if lineName == 0 :
+ return " (" + self.listLineAddress[index][1] + "() - " + ")"
+ else :
+ return " (" + self.listLineAddress[index][1] + "() - " + sourceName + ":" + str(lineName) + ")"
+ index += 1
+
+ return " (unknown)"
+
+ def parse_debug_file(self, driverName, pdbName):
+ if cmp (pdbName, "") == 0 :
+ return
+ self.pdbName = pdbName;
+
+ try:
+ nmCommand = "nm"
+ nmLineOption = "-l"
+ print("parsing (debug) - " + pdbName)
+ os.system ('%s %s %s > nmDump.line.log' % (nmCommand, nmLineOption, pdbName))
+ except :
+ print('ERROR: nm command not available. Please verify PATH')
+ return
+
+ #
+ # parse line
+ #
+ linefile = open("nmDump.line.log")
+ reportLines = linefile.readlines()
+ linefile.close()
+
+ # 000113ca T AllocatePool c:\home\edk-ii\MdePkg\Library\UefiMemoryAllocationLib\MemoryAllocationLib.c:399
+ patchLineFileMatchString = "([0-9a-fA-F]*)\s+[T|D|t|d]\s+(\w+)\s*((?:[a-zA-Z]:)?[\w+\-./_a-zA-Z0-9\\\\]*):?([0-9]*)"
+
+ for reportLine in reportLines:
+ #print "check - " + reportLine
+ match = re.match(patchLineFileMatchString, reportLine)
+ if match is not None:
+ #print "match - " + reportLine[:-1]
+ #print "0 - " + match.group(0)
+ #print "1 - " + match.group(1)
+ #print "2 - " + match.group(2)
+ #print "3 - " + match.group(3)
+ #print "4 - " + match.group(4)
+
+ rva = int (match.group(1), 16)
+ functionName = match.group(2)
+ sourceName = match.group(3)
+ if cmp (match.group(4), "") != 0 :
+ lineName = int (match.group(4))
+ else :
+ lineName = 0
+ self.listLineAddress.append ([rva, functionName, lineName, sourceName])
+
+ self.lineCount = len (self.listLineAddress)
+
+ self.listLineAddress = sorted(self.listLineAddress, key=lambda symbolAddress:symbolAddress[0])
+
+ #for key in self.listLineAddress :
+ #print "rva - " + "%x"%(key[0]) + ", func - " + key[1] + ", line - " + str(key[2]) + ", source - " + key[3]
+
+ def parse_pdb_file(self, driverName, pdbName):
+ if cmp (pdbName, "") == 0 :
+ return
+ self.pdbName = pdbName;
+
+ try:
+ #DIA2DumpCommand = "\"C:\\Program Files (x86)\Microsoft Visual Studio 14.0\\DIA SDK\\Samples\\DIA2Dump\\x64\\Debug\\Dia2Dump.exe\""
+ DIA2DumpCommand = "Dia2Dump.exe"
+ #DIA2SymbolOption = "-p"
+ DIA2LinesOption = "-l"
+ print("parsing (pdb) - " + pdbName)
+ #os.system ('%s %s %s > DIA2Dump.symbol.log' % (DIA2DumpCommand, DIA2SymbolOption, pdbName))
+ os.system ('%s %s %s > DIA2Dump.line.log' % (DIA2DumpCommand, DIA2LinesOption, pdbName))
+ except :
+ print('ERROR: DIA2Dump command not available. Please verify PATH')
+ return
+
+ #
+ # parse line
+ #
+ linefile = open("DIA2Dump.line.log")
+ reportLines = linefile.readlines()
+ linefile.close()
+
+ # ** GetDebugPrintErrorLevel
+ # line 32 at [0000C790][0001:0000B790], len = 0x3 c:\home\edk-ii\mdepkg\library\basedebugprinterrorlevellib\basedebugprinterrorlevellib.c (MD5: 687C0AE564079D35D56ED5D84A6164CC)
+ # line 36 at [0000C793][0001:0000B793], len = 0x5
+ # line 37 at [0000C798][0001:0000B798], len = 0x2
+
+ patchLineFileMatchString = "\s+line ([0-9]+) at \[([0-9a-fA-F]{8})\]\[[0-9a-fA-F]{4}\:[0-9a-fA-F]{8}\], len = 0x[0-9a-fA-F]+\s*([\w+\-\:./_a-zA-Z0-9\\\\]*)\s*"
+ patchLineFileMatchStringFunc = "\*\*\s+(\w+)\s*"
+
+ for reportLine in reportLines:
+ #print "check line - " + reportLine
+ match = re.match(patchLineFileMatchString, reportLine)
+ if match is not None:
+ #print "match - " + reportLine[:-1]
+ #print "0 - " + match.group(0)
+ #print "1 - " + match.group(1)
+ #print "2 - " + match.group(2)
+ if cmp (match.group(3), "") != 0 :
+ self.sourceName = match.group(3)
+ sourceName = self.sourceName
+ functionName = self.functionName
+
+ rva = int (match.group(2), 16)
+ lineName = int (match.group(1))
+ self.listLineAddress.append ([rva, functionName, lineName, sourceName])
+ else :
+ match = re.match(patchLineFileMatchStringFunc, reportLine)
+ if match is not None:
+ self.functionName = match.group(1)
+
+ self.lineCount = len (self.listLineAddress)
+ self.listLineAddress = sorted(self.listLineAddress, key=lambda symbolAddress:symbolAddress[0])
+
+ #for key in self.listLineAddress :
+ #print "rva - " + "%x"%(key[0]) + ", func - " + key[1] + ", line - " + str(key[2]) + ", source - " + key[3]
+
+class SymbolsFile:
+ def __init__(self):
+ self.symbolsTable = {}
+
+symbolsFile = ""
+
+driverName = ""
+rvaName = ""
+symbolName = ""
+
+def getSymbolName(driverName, rva):
+ global symbolsFile
+
+ #print "driverName - " + driverName
+
+ try :
+ symbolList = symbolsFile.symbolsTable[driverName]
+ if symbolList is not None:
+ return symbolList.getSymbol (rva)
+ else:
+ return " (???)"
+ except Exception:
+ return " (???)"
+
+def processLine(newline):
+ global driverName
+ global rvaName
+
+ driverPrefixLen = len("Driver - ")
+ # get driver name
+ if cmp(newline[0:driverPrefixLen], "Driver - ") == 0 :
+ driverlineList = newline.split(" ")
+ driverName = driverlineList[2]
+ #print "Checking : ", driverName
+
+ # EDKII application output
+ pdbMatchString = "Driver - \w* \(Usage - 0x[0-9a-fA-F]+\) \(Pdb - ([:\-.\w\\\\/]*)\)\s*"
+ pdbName = ""
+ match = re.match(pdbMatchString, newline)
+ if match is not None:
+ #print "match - " + newline
+ #print "0 - " + match.group(0)
+ #print "1 - " + match.group(1)
+ pdbName = match.group(1)
+ #print "PDB - " + pdbName
+
+ symbolsFile.symbolsTable[driverName] = Symbols()
+
+ if cmp (pdbName[-3:], "pdb") == 0 :
+ symbolsFile.symbolsTable[driverName].parse_pdb_file (driverName, pdbName)
+ else :
+ symbolsFile.symbolsTable[driverName].parse_debug_file (driverName, pdbName)
+
+ elif cmp(newline, "") == 0 :
+ driverName = ""
+
+ # check entry line
+ if newline.find ("<==") != -1 :
+ entry_list = newline.split(" ")
+ rvaName = entry_list[4]
+ #print "rva : ", rvaName
+ symbolName = getSymbolName (driverName, int(rvaName, 16))
+ else :
+ rvaName = ""
+ symbolName = ""
+
+ if cmp(rvaName, "") == 0 :
+ return newline
+ else :
+ return newline + symbolName
+
+def myOptionParser():
+ usage = "%prog [--version] [-h] [--help] [-i inputfile [-o outputfile]]"
+ Parser = OptionParser(usage=usage, description=__copyright__, version="%prog " + str(versionNumber))
+ Parser.add_option("-i", "--inputfile", dest="inputfilename", type="string", help="The input memory profile info file output from MemoryProfileInfo application in MdeModulePkg")
+ Parser.add_option("-o", "--outputfile", dest="outputfilename", type="string", help="The output memory profile info file with symbol, MemoryProfileInfoSymbol.txt will be used if it is not specified")
+
+ (Options, args) = Parser.parse_args()
+ if Options.inputfilename is None:
+ Parser.error("no input file specified")
+ if Options.outputfilename is None:
+ Options.outputfilename = "MemoryProfileInfoSymbol.txt"
+ return Options
+
+def main():
+ global symbolsFile
+ global Options
+ Options = myOptionParser()
+
+ symbolsFile = SymbolsFile()
+
+ try :
+ file = open(Options.inputfilename)
+ except Exception:
+ print("fail to open " + Options.inputfilename)
+ return 1
+ try :
+ newfile = open(Options.outputfilename, "w")
+ except Exception:
+ print("fail to open " + Options.outputfilename)
+ return 1
+
+ try:
+ while True:
+ line = file.readline()
+ if not line:
+ break
+ newline = line[:-1]
+
+ newline = processLine(newline)
+
+ newfile.write(newline)
+ newfile.write("\n")
+ finally:
+ file.close()
+ newfile.close()
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/Readme.md b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/Readme.md
new file mode 100644
index 000000000..dfc2892c4
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/Readme.md
@@ -0,0 +1,19 @@
+Prerequisite Tools:
+1. Install Python 2.7.3 from https://www.python.org/download/releases/2.7.3/
+2. Install wxPython 2.8.12.1 from https://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/
+ generally the libraries will be installed at python's subfolder, for example in windows: c:\python27\Lib\site-packages\
+3. Install DoxyGen 1.8.6 from https://sourceforge.net/projects/doxygen/files/rel-1.8.6/
+4. (Windows only) Install Htmlhelp tool from https://msdn.microsoft.com/en-us/library/windows/desktop/ms669985(v=vs.85).aspx
+
+Limitation:
+1. Current tool doesn't work on latest wxPython and DoxyGen tool. Please use the sepecific version in above.
+
+Run the Tool:
+a) Run with GUI:
+ 1. Enter src folder, double click "packagedocapp.pyw" or run command "python packagedocapp.pyw" to open the GUI.
+ 2. Make sure all the information in blank are correct.
+ 3. Click "Generate Package Document!"
+b) Run with command line:
+ 1. Open command line window
+ 2. Enter src folder, for example: "cd C:\PackageDocumentTools\src"
+ 3. Run "python packagedoc_cli.py --help" for detail command.
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/__init__.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/__init__.py
new file mode 100644
index 000000000..57dfebde5
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/__init__.py
@@ -0,0 +1,6 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py
new file mode 100644
index 000000000..eb3164a55
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py
@@ -0,0 +1,424 @@
+## @file
+# This module provide command line entry for generating package document!
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import print_function
+import os, sys, logging, traceback, subprocess
+from optparse import OptionParser
+
+from plugins.EdkPlugins.edk2.model import baseobject
+from plugins.EdkPlugins.edk2.model import doxygengen
+
+gArchMarcoDict = {'ALL' : 'MDE_CPU_IA32 MDE_CPU_X64 MDE_CPU_EBC MDE_CPU_IPF _MSC_EXTENSIONS __GNUC__ __INTEL_COMPILER',
+ 'IA32_MSFT': 'MDE_CPU_IA32 _MSC_EXTENSIONS',
+ 'IA32_GNU' : 'MDE_CPU_IA32 __GNUC__',
+ 'X64_MSFT' : 'MDE_CPU_X64 _MSC_EXTENSIONS ASM_PFX= OPTIONAL= ',
+ 'X64_GNU' : 'MDE_CPU_X64 __GNUC__ ASM_PFX= OPTIONAL= ',
+ 'IPF_MSFT' : 'MDE_CPU_IPF _MSC_EXTENSIONS ASM_PFX= OPTIONAL= ',
+ 'IPF_GNU' : 'MDE_CPU_IPF __GNUC__ ASM_PFX= OPTIONAL= ',
+ 'EBC_INTEL': 'MDE_CPU_EBC __INTEL_COMPILER ASM_PFX= OPTIONAL= '}
+
+def parseCmdArgs():
+ parser = OptionParser(version="Package Document Generation Tools - Version 0.1")
+ parser.add_option('-w', '--workspace', action='store', type='string', dest='WorkspacePath',
+ help='Specify workspace absolute path. For example: c:\\tianocore')
+ parser.add_option('-p', '--decfile', action='store', dest='PackagePath',
+ help='Specify the absolute path for package DEC file. For example: c:\\tianocore\\MdePkg\\MdePkg.dec')
+ parser.add_option('-x', '--doxygen', action='store', dest='DoxygenPath',
+ help='Specify the absolute path of doxygen tools installation. For example: C:\\Program Files\\doxygen\bin\doxygen.exe')
+ parser.add_option('-o', '--output', action='store', dest='OutputPath',
+ help='Specify the document output path. For example: c:\\docoutput')
+ parser.add_option('-a', '--arch', action='store', dest='Arch', choices=list(gArchMarcoDict.keys()),
+ help='Specify the architecture used in preprocess package\'s source. For example: -a IA32_MSFT')
+ parser.add_option('-m', '--mode', action='store', dest='DocumentMode', choices=['CHM', 'HTML'],
+ help='Specify the document mode from : CHM or HTML')
+ parser.add_option('-i', '--includeonly', action='store_true', dest='IncludeOnly',
+ help='Only generate document for package\'s public interfaces produced by include folder. ')
+ parser.add_option('-c', '--htmlworkshop', dest='HtmlWorkshopPath',
+ help='Specify the absolute path for Microsoft HTML Workshop\'s hhc.exe file. For example: C:\\Program Files\\HTML Help Workshop\\hhc.exe')
+ (options, args) = parser.parse_args()
+
+ # validate the options
+ errors = []
+ if options.WorkspacePath is None:
+ errors.append('- Please specify workspace path via option -w!')
+ elif not os.path.exists(options.WorkspacePath):
+ errors.append("- Invalid workspace path %s! The workspace path should be exist in absolute path!" % options.WorkspacePath)
+
+ if options.PackagePath is None:
+ errors.append('- Please specify package DEC file path via option -p!')
+ elif not os.path.exists(options.PackagePath):
+ errors.append("- Invalid package's DEC file path %s! The DEC path should be exist in absolute path!" % options.PackagePath)
+
+ default = "C:\\Program Files\\doxygen\\bin\\doxygen.exe"
+ if options.DoxygenPath is None:
+ if os.path.exists(default):
+ print("Warning: Assume doxygen tool is installed at %s. If not, please specify via -x" % default)
+ options.DoxygenPath = default
+ else:
+ errors.append('- Please specify the path of doxygen tool installation via option -x! or install it in default path %s' % default)
+ elif not os.path.exists(options.DoxygenPath):
+ errors.append("- Invalid doxygen tool path %s! The doxygen tool path should be exist in absolute path!" % options.DoxygenPath)
+
+ if options.OutputPath is not None:
+ if not os.path.exists(options.OutputPath):
+ # create output
+ try:
+ os.makedirs(options.OutputPath)
+ except:
+ errors.append('- Fail to create the output directory %s' % options.OutputPath)
+ else:
+ if options.PackagePath is not None and os.path.exists(options.PackagePath):
+ dirpath = os.path.dirname(options.PackagePath)
+ default = os.path.join (dirpath, "Document")
+ print('Warning: Assume document output at %s. If not, please specify via option -o' % default)
+ options.OutputPath = default
+ if not os.path.exists(default):
+ try:
+ os.makedirs(default)
+ except:
+ errors.append('- Fail to create default output directory %s! Please specify document output diretory via option -o' % default)
+ else:
+ errors.append('- Please specify document output path via option -o!')
+
+ if options.Arch is None:
+ options.Arch = 'ALL'
+ print("Warning: Assume arch is \"ALL\". If not, specify via -a")
+
+ if options.DocumentMode is None:
+ options.DocumentMode = "HTML"
+ print("Warning: Assume document mode is \"HTML\". If not, specify via -m")
+
+ if options.IncludeOnly is None:
+ options.IncludeOnly = False
+ print("Warning: Assume generate package document for all package\'s source including publich interfaces and implementation libraries and modules.")
+
+ if options.DocumentMode.lower() == 'chm':
+ default = "C:\\Program Files\\HTML Help Workshop\\hhc.exe"
+ if options.HtmlWorkshopPath is None:
+ if os.path.exists(default):
+ print('Warning: Assume the installation path of Microsoft HTML Workshop is %s. If not, specify via option -c.' % default)
+ options.HtmlWorkshopPath = default
+ else:
+ errors.append('- Please specify the installation path of Microsoft HTML Workshop via option -c!')
+ elif not os.path.exists(options.HtmlWorkshopPath):
+ errors.append('- The installation path of Microsoft HTML Workshop %s does not exists. ' % options.HtmlWorkshopPath)
+
+ if len(errors) != 0:
+ print('\n')
+ parser.error('Fail to start due to following reasons: \n%s' %'\n'.join(errors))
+ return (options.WorkspacePath, options.PackagePath, options.DoxygenPath, options.OutputPath,
+ options.Arch, options.DocumentMode, options.IncludeOnly, options.HtmlWorkshopPath)
+
+def createPackageObject(wsPath, pkgPath):
+ try:
+ pkgObj = baseobject.Package(None, wsPath)
+ pkgObj.Load(pkgPath)
+ except:
+ logging.getLogger().error ('Fail to create package object!')
+ return None
+
+ return pkgObj
+
+def callbackLogMessage(msg, level):
+ print(msg.strip())
+
+def callbackCreateDoxygenProcess(doxPath, configPath):
+ if sys.platform == 'win32':
+ cmd = '"%s" %s' % (doxPath, configPath)
+ else:
+ cmd = '%s %s' % (doxPath, configPath)
+ print(cmd)
+ subprocess.call(cmd, shell=True)
+
+
+def DocumentFixup(outPath, arch):
+ # find BASE_LIBRARY_JUMP_BUFFER structure reference page
+
+ print('\n >>> Start fixup document \n')
+
+ for root, dirs, files in os.walk(outPath):
+ for dir in dirs:
+ if dir.lower() in ['.svn', '_svn', 'cvs']:
+ dirs.remove(dir)
+ for file in files:
+ if not file.lower().endswith('.html'): continue
+ fullpath = os.path.join(outPath, root, file)
+ try:
+ f = open(fullpath, 'r')
+ text = f.read()
+ f.close()
+ except:
+ logging.getLogger().error('\nFail to open file %s\n' % fullpath)
+ continue
+ if arch.lower() == 'all':
+ if text.find('BASE_LIBRARY_JUMP_BUFFER Struct Reference') != -1:
+ FixPageBASE_LIBRARY_JUMP_BUFFER(fullpath, text)
+ if text.find('MdePkg/Include/Library/BaseLib.h File Reference') != -1:
+ FixPageBaseLib(fullpath, text)
+ if text.find('IA32_IDT_GATE_DESCRIPTOR Union Reference') != -1:
+ FixPageIA32_IDT_GATE_DESCRIPTOR(fullpath, text)
+ if text.find('MdePkg/Include/Library/UefiDriverEntryPoint.h File Reference') != -1:
+ FixPageUefiDriverEntryPoint(fullpath, text)
+ if text.find('MdePkg/Include/Library/UefiApplicationEntryPoint.h File Reference') != -1:
+ FixPageUefiApplicationEntryPoint(fullpath, text)
+
+ print(' >>> Finish all document fixing up! \n')
+
+def FixPageBaseLib(path, text):
+ print(' >>> Fixup BaseLib file page at file %s \n' % path)
+ lines = text.split('\n')
+ lastBaseJumpIndex = -1
+ lastIdtGateDescriptor = -1
+ for index in range(len(lines) - 1, -1, -1):
+ line = lines[index]
+ if line.strip() == '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT&nbsp;&nbsp;&nbsp;4 </td>':
+ lines[index] = '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT&nbsp;&nbsp;&nbsp;4&nbsp;[IA32] </td>'
+ if line.strip() == '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT&nbsp;&nbsp;&nbsp;0x10 </td>':
+ lines[index] = '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT&nbsp;&nbsp;&nbsp;0x10&nbsp;[IPF] </td>'
+ if line.strip() == '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT&nbsp;&nbsp;&nbsp;8 </td>':
+ lines[index] = '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT&nbsp;&nbsp;&nbsp;9&nbsp;[EBC, x64] </td>'
+ if line.find('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;4') != -1:
+ lines[index] = lines[index].replace('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;4',
+ 'BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;4&nbsp;[IA32]')
+ if line.find('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;0x10') != -1:
+ lines[index] = lines[index].replace('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;0x10',
+ 'BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;0x10&nbsp;[IPF]')
+ if line.find('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;8') != -1:
+ lines[index] = lines[index].replace('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;8',
+ 'BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;8&nbsp;[x64, EBC]')
+ if line.find('>BASE_LIBRARY_JUMP_BUFFER</a>') != -1:
+ if lastBaseJumpIndex != -1:
+ del lines[lastBaseJumpIndex]
+ lastBaseJumpIndex = index
+ if line.find('>IA32_IDT_GATE_DESCRIPTOR</a></td>') != -1:
+ if lastIdtGateDescriptor != -1:
+ del lines[lastIdtGateDescriptor]
+ lastIdtGateDescriptor = index
+ try:
+ f = open(path, 'w')
+ f.write('\n'.join(lines))
+ f.close()
+ except:
+ logging.getLogger().error(" <<< Fail to fixup file %s\n" % path)
+ return
+ print(" <<< Finish to fixup file %s\n" % path)
+
+def FixPageIA32_IDT_GATE_DESCRIPTOR(path, text):
+ print(' >>> Fixup structure reference IA32_IDT_GATE_DESCRIPTOR at file %s \n' % path)
+ lines = text.split('\n')
+ for index in range(len(lines) - 1, -1, -1):
+ line = lines[index].strip()
+ if line.find('struct {</td>') != -1 and lines[index - 2].find('>Uint64</a></td>') != -1:
+ lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For X64</h2></td></tr>')
+ if line.find('struct {</td>') != -1 and lines[index - 1].find('Data Fields') != -1:
+ lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For IA32</h2></td></tr>')
+ try:
+ f = open(path, 'w')
+ f.write('\n'.join(lines))
+ f.close()
+ except:
+ logging.getLogger().error(" <<< Fail to fixup file %s\n" % path)
+ return
+ print(" <<< Finish to fixup file %s\n" % path)
+
+def FixPageBASE_LIBRARY_JUMP_BUFFER(path, text):
+ print(' >>> Fixup structure reference BASE_LIBRARY_JUMP_BUFFER at file %s \n' % path)
+ lines = text.split('\n')
+ bInDetail = True
+ bNeedRemove = False
+ for index in range(len(lines) - 1, -1, -1):
+ line = lines[index]
+ if line.find('Detailed Description') != -1:
+ bInDetail = False
+ if line.startswith('EBC context buffer used by') and lines[index - 1].startswith('x64 context buffer'):
+ lines[index] = "IA32/IPF/X64/" + line
+ bNeedRemove = True
+ if line.startswith("x64 context buffer") or line.startswith('IPF context buffer used by') or \
+ line.startswith('IA32 context buffer used by'):
+ if bNeedRemove:
+ lines.remove(line)
+ if line.find('>R0</a>') != -1 and not bInDetail:
+ if lines[index - 1] != '<tr><td colspan="2"><br><h2>Data Fields For EBC</h2></td></tr>':
+ lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For EBC</h2></td></tr>')
+ if line.find('>Rbx</a>') != -1 and not bInDetail:
+ if lines[index - 1] != '<tr><td colspan="2"><br><h2>Data Fields For X64</h2></td></tr>':
+ lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For X64</h2></td></tr>')
+ if line.find('>F2</a>') != -1 and not bInDetail:
+ if lines[index - 1] != '<tr><td colspan="2"><br><h2>Data Fields For IPF</h2></td></tr>':
+ lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For IPF</h2></td></tr>')
+ if line.find('>Ebx</a>') != -1 and not bInDetail:
+ if lines[index - 1] != '<tr><td colspan="2"><br><h2>Data Fields For IA32</h2></td></tr>':
+ lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For IA32</h2></td></tr>')
+ try:
+ f = open(path, 'w')
+ f.write('\n'.join(lines))
+ f.close()
+ except:
+ logging.getLogger().error(" <<< Fail to fixup file %s" % path)
+ return
+ print(" <<< Finish to fixup file %s\n" % path)
+
+def FixPageUefiDriverEntryPoint(path, text):
+ print(' >>> Fixup file reference MdePkg/Include/Library/UefiDriverEntryPoint.h at file %s \n' % path)
+ lines = text.split('\n')
+ bInModuleEntry = False
+ bInEfiMain = False
+ ModuleEntryDlCount = 0
+ ModuleEntryDelStart = 0
+ ModuleEntryDelEnd = 0
+ EfiMainDlCount = 0
+ EfiMainDelStart = 0
+ EfiMainDelEnd = 0
+
+ for index in range(len(lines)):
+ line = lines[index].strip()
+ if line.find('EFI_STATUS</a> EFIAPI _ModuleEntryPoint </td>') != -1:
+ bInModuleEntry = True
+ if line.find('EFI_STATUS</a> EFIAPI EfiMain </td>') != -1:
+ bInEfiMain = True
+ if line.startswith('<p>References <a'):
+ if bInModuleEntry:
+ ModuleEntryDelEnd = index - 1
+ bInModuleEntry = False
+ elif bInEfiMain:
+ EfiMainDelEnd = index - 1
+ bInEfiMain = False
+ if bInModuleEntry:
+ if line.startswith('</dl>'):
+ ModuleEntryDlCount = ModuleEntryDlCount + 1
+ if ModuleEntryDlCount == 1:
+ ModuleEntryDelStart = index + 1
+ if bInEfiMain:
+ if line.startswith('</dl>'):
+ EfiMainDlCount = EfiMainDlCount + 1
+ if EfiMainDlCount == 1:
+ EfiMainDelStart = index + 1
+
+ if EfiMainDelEnd > EfiMainDelStart:
+ for index in range(EfiMainDelEnd, EfiMainDelStart, -1):
+ del lines[index]
+ if ModuleEntryDelEnd > ModuleEntryDelStart:
+ for index in range(ModuleEntryDelEnd, ModuleEntryDelStart, -1):
+ del lines[index]
+
+ try:
+ f = open(path, 'w')
+ f.write('\n'.join(lines))
+ f.close()
+ except:
+ logging.getLogger().error(" <<< Fail to fixup file %s" % path)
+ return
+ print(" <<< Finish to fixup file %s\n" % path)
+
+
+def FixPageUefiApplicationEntryPoint(path, text):
+ print(' >>> Fixup file reference MdePkg/Include/Library/UefiApplicationEntryPoint.h at file %s \n' % path)
+ lines = text.split('\n')
+ bInModuleEntry = False
+ bInEfiMain = False
+ ModuleEntryDlCount = 0
+ ModuleEntryDelStart = 0
+ ModuleEntryDelEnd = 0
+ EfiMainDlCount = 0
+ EfiMainDelStart = 0
+ EfiMainDelEnd = 0
+
+ for index in range(len(lines)):
+ line = lines[index].strip()
+ if line.find('EFI_STATUS</a> EFIAPI _ModuleEntryPoint </td>') != -1:
+ bInModuleEntry = True
+ if line.find('EFI_STATUS</a> EFIAPI EfiMain </td>') != -1:
+ bInEfiMain = True
+ if line.startswith('<p>References <a'):
+ if bInModuleEntry:
+ ModuleEntryDelEnd = index - 1
+ bInModuleEntry = False
+ elif bInEfiMain:
+ EfiMainDelEnd = index - 1
+ bInEfiMain = False
+ if bInModuleEntry:
+ if line.startswith('</dl>'):
+ ModuleEntryDlCount = ModuleEntryDlCount + 1
+ if ModuleEntryDlCount == 1:
+ ModuleEntryDelStart = index + 1
+ if bInEfiMain:
+ if line.startswith('</dl>'):
+ EfiMainDlCount = EfiMainDlCount + 1
+ if EfiMainDlCount == 1:
+ EfiMainDelStart = index + 1
+
+ if EfiMainDelEnd > EfiMainDelStart:
+ for index in range(EfiMainDelEnd, EfiMainDelStart, -1):
+ del lines[index]
+ if ModuleEntryDelEnd > ModuleEntryDelStart:
+ for index in range(ModuleEntryDelEnd, ModuleEntryDelStart, -1):
+ del lines[index]
+
+ try:
+ f = open(path, 'w')
+ f.write('\n'.join(lines))
+ f.close()
+ except:
+ logging.getLogger().error(" <<< Fail to fixup file %s" % path)
+ return
+ print(" <<< Finish to fixup file %s\n" % path)
+
+if __name__ == '__main__':
+ wspath, pkgpath, doxpath, outpath, archtag, docmode, isinc, hwpath = parseCmdArgs()
+
+ # configure logging system
+ logfilepath = os.path.join(outpath, 'log.txt')
+ logging.basicConfig(format='%(levelname)-8s %(message)s', level=logging.DEBUG)
+
+ # create package model object firstly
+ pkgObj = createPackageObject(wspath, pkgpath)
+ if pkgObj is None:
+ sys.exit(-1)
+
+ # create doxygen action model
+ arch = None
+ tooltag = None
+ if archtag.lower() != 'all':
+ arch = archtag.split('_')[0]
+ tooltag = archtag.split('_')[1]
+ else:
+ arch = 'all'
+ tooltag = 'all'
+
+ # preprocess package and call doxygen
+ try:
+ action = doxygengen.PackageDocumentAction(doxpath,
+ hwpath,
+ outpath,
+ pkgObj,
+ docmode,
+ callbackLogMessage,
+ arch,
+ tooltag,
+ isinc,
+ True)
+ action.RegisterCallbackDoxygenProcess(callbackCreateDoxygenProcess)
+ action.Generate()
+ except:
+ message = traceback.format_exception(*sys.exc_info())
+ logging.getLogger().error('Fail to create doxygen action! \n%s' % ''.join(message))
+ sys.exit(-1)
+
+ DocumentFixup(outpath, arch)
+
+ # generate CHM is necessary
+ if docmode.lower() == 'chm':
+ indexpath = os.path.join(outpath, 'html', 'index.hhp')
+ if sys.platform == 'win32':
+ cmd = '"%s" %s' % (hwpath, indexpath)
+ else:
+ cmd = '%s %s' % (hwpath, indexpath)
+ subprocess.call(cmd)
+ print('\nFinish to generate package document! Please open %s for review' % os.path.join(outpath, 'html', 'index.chm'))
+ else:
+ print('\nFinish to generate package document! Please open %s for review' % os.path.join(outpath, 'html', 'index.html'))
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw
new file mode 100644
index 000000000..e96197a50
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/packagedocapp.pyw
@@ -0,0 +1,1060 @@
+## @file
+# This file is used to define common string related functions used in parsing
+# process
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+import os, sys, wx, logging
+
+import wx.stc
+import wx.lib.newevent
+import wx.lib.agw.genericmessagedialog as GMD
+from plugins.EdkPlugins.edk2.model import baseobject
+from plugins.EdkPlugins.edk2.model import doxygengen
+
+if hasattr(sys, "frozen"):
+ appPath = os.path.abspath(os.path.dirname(sys.executable))
+else:
+ appPath = os.path.abspath(os.path.dirname(__file__))
+
+AppCallBackEvent, EVT_APP_CALLBACK = wx.lib.newevent.NewEvent()
+LogEvent, EVT_LOG = wx.lib.newevent.NewEvent()
+
+class PackageDocApp(wx.App):
+
+ def OnInit(self):
+ logfile = os.path.join(appPath, 'log.txt')
+ logging.basicConfig(format='%(name)-8s %(levelname)-8s %(message)s',
+ filename=logfile, level=logging.ERROR)
+
+ self.SetAppName('Package Doxygen Generate Application')
+ frame = PackageDocMainFrame(None, "Package Document Generation Application!")
+ self.SetTopWindow(frame)
+
+ frame.Show(True)
+
+ EVT_APP_CALLBACK( self, self.OnAppCallBack)
+ return True
+
+ def GetLogger(self):
+ return logging.getLogger('')
+
+ def ForegroundProcess(self, function, args):
+ wx.PostEvent(self, AppCallBackEvent(callback=function, args=args))
+
+ def OnAppCallBack(self, event):
+ try:
+ event.callback(*event.args)
+ except:
+ self._logger.exception( 'OnAppCallBack<%s.%s>\n' %
+ (event.callback.__module__, event.callback.__name__ ))
+
+class PackageDocMainFrame(wx.Frame):
+ def __init__(self, parent, title):
+ wx.Frame.__init__(self, parent, -1, title, size=(550, 290), style=wx.MINIMIZE_BOX|wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX )
+
+ panel = wx.Panel(self)
+ sizer = wx.BoxSizer(wx.VERTICAL)
+
+ subsizer = wx.GridBagSizer(5, 10)
+ subsizer.AddGrowableCol(1)
+ subsizer.Add(wx.StaticText(panel, -1, "Workspace Location : "), (0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
+ self._workspacePathCtrl = wx.ComboBox(panel, -1)
+ list = self.GetConfigure("WorkspacePath")
+ if len(list) != 0:
+ for item in list:
+ self._workspacePathCtrl.Append(item)
+ self._workspacePathCtrl.SetValue(list[len(list) - 1])
+
+ subsizer.Add(self._workspacePathCtrl, (0, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
+ self._workspacePathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
+ subsizer.Add(self._workspacePathBt, (0, 2), flag=wx.ALIGN_CENTER_VERTICAL)
+ wx.EVT_BUTTON(self._workspacePathBt, self._workspacePathBt.GetId(), self.OnBrowsePath)
+
+ subsizer.Add(wx.StaticText(panel, -1, "Package DEC Location : "), (1, 0), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
+ self._packagePathCtrl = wx.ComboBox(panel, -1)
+ list = self.GetConfigure("PackagePath")
+ if len(list) != 0:
+ for item in list:
+ self._packagePathCtrl.Append(item)
+ self._packagePathCtrl.SetValue(list[len(list) - 1])
+ subsizer.Add(self._packagePathCtrl, (1, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
+ self._packagePathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
+ subsizer.Add(self._packagePathBt, (1, 2), flag=wx.ALIGN_CENTER_VERTICAL)
+ wx.EVT_BUTTON(self._packagePathBt, self._packagePathBt.GetId(), self.OnBrowsePath)
+
+ subsizer.Add(wx.StaticText(panel, -1, "Doxygen Tool Location : "), (2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
+ self._doxygenPathCtrl = wx.TextCtrl(panel, -1)
+ list = self.GetConfigure('DoxygenPath')
+ if len(list) != 0:
+ self._doxygenPathCtrl.SetValue(list[0])
+ else:
+ if wx.Platform == '__WXMSW__':
+ self._doxygenPathCtrl.SetValue('C:\\Program Files\\Doxygen\\bin\\doxygen.exe')
+ else:
+ self._doxygenPathCtrl.SetValue('/usr/bin/doxygen')
+
+ self._doxygenPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
+ subsizer.Add(self._doxygenPathCtrl, (2, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
+ subsizer.Add(self._doxygenPathBt, (2, 2), flag=wx.ALIGN_CENTER_VERTICAL)
+ wx.EVT_BUTTON(self._doxygenPathBt, self._doxygenPathBt.GetId(), self.OnBrowsePath)
+
+ subsizer.Add(wx.StaticText(panel, -1, "CHM Tool Location : "), (3, 0), flag=wx.ALIGN_CENTER_VERTICAL)
+ self._chmPathCtrl = wx.TextCtrl(panel, -1)
+ list = self.GetConfigure('CHMPath')
+ if len(list) != 0:
+ self._chmPathCtrl.SetValue(list[0])
+ else:
+ self._chmPathCtrl.SetValue('C:\\Program Files\\HTML Help Workshop\\hhc.exe')
+
+ self._chmPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
+ subsizer.Add(self._chmPathCtrl, (3, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
+ subsizer.Add(self._chmPathBt, (3, 2), flag=wx.ALIGN_CENTER_VERTICAL)
+ wx.EVT_BUTTON(self._chmPathBt, self._chmPathBt.GetId(), self.OnBrowsePath)
+
+ subsizer.Add(wx.StaticText(panel, -1, "Output Location : "), (4, 0), flag=wx.ALIGN_CENTER_VERTICAL)
+ self._outputPathCtrl = wx.ComboBox(panel, -1)
+ list = self.GetConfigure("OutputPath")
+ if len(list) != 0:
+ for item in list:
+ self._outputPathCtrl.Append(item)
+ self._outputPathCtrl.SetValue(list[len(list) - 1])
+
+ subsizer.Add(self._outputPathCtrl, (4, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
+ self._outputPathBt = wx.BitmapButton(panel, -1, bitmap=wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
+ subsizer.Add(self._outputPathBt, (4, 2), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
+ wx.EVT_BUTTON(self._outputPathBt, self._outputPathBt.GetId(), self.OnBrowsePath)
+
+ subsizer.Add(wx.StaticText(panel, -1, "Architecture Specified : "), (5, 0), flag=wx.ALIGN_CENTER_VERTICAL)
+ self._archCtrl = wx.ComboBox(panel, -1, value='ALL', choices=['ALL', 'IA32/MSFT', 'IA32/GNU', 'X64/INTEL', 'X64/GNU', 'IPF/MSFT', 'IPF/GNU', 'EBC/INTEL'],
+ style=wx.CB_READONLY)
+ self._archCtrl.Bind(wx.EVT_COMBOBOX, self.OnArchtectureSelectChanged)
+ subsizer.Add(self._archCtrl, (5, 1), (1, 2), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
+ sizer.Add(subsizer, 0, wx.EXPAND|wx.TOP|wx.BOTTOM|wx.LEFT|wx.RIGHT, 5)
+
+ sizer6 = wx.BoxSizer(wx.HORIZONTAL)
+ self._modesel = wx.RadioBox(panel, -1, 'Generated Document Mode', majorDimension=2, choices=['CHM', 'HTML'], style=wx.RA_SPECIFY_COLS)
+ self._modesel.SetStringSelection('HTML')
+
+ self._includeonlysel = wx.CheckBox(panel, -1, 'Only document public include')
+
+ sizer6.Add(self._modesel, 0 , wx.EXPAND)
+ sizer6.Add(self._includeonlysel, 0, wx.EXPAND|wx.LEFT, 5)
+
+ sizer.Add(sizer6, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5)
+
+ self._generateBt = wx.Button(panel, -1, "Generate Package Document!")
+ self._generateBt.Bind(wx.EVT_BUTTON, self.OnGenerate)
+ sizer.Add(self._generateBt, 0, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5)
+
+ panel.SetSizer(sizer)
+ panel.Layout()
+ panel.SetAutoLayout(True)
+ self.CenterOnScreen()
+
+ def SaveConfigure(self, name, value):
+ if value ==None or len(value) == 0:
+ return
+ config = wx.ConfigBase_Get()
+ oldvalues = config.Read(name, '').split(';')
+ if len(oldvalues) >= 10:
+ oldvalues.remove(oldvalues[0])
+ if value not in oldvalues:
+ oldvalues.append(value)
+ else:
+ oldvalues.remove(value)
+ oldvalues.append(value)
+
+ config.Write(name, ';'.join(oldvalues))
+
+ def GetConfigure(self, name):
+ config = wx.ConfigBase_Get()
+ values = config.Read(name, '').split(';')
+ list = []
+ for item in values:
+ if len(item) != 0:
+ list.append(item)
+ return list
+
+ def OnBrowsePath(self, event):
+ id = event.GetId()
+ editctrl = None
+ startdir = ''
+ isFile = False
+ if id == self._packagePathBt.GetId():
+ dlgTitle = "Choose package path:"
+ editctrl = self._packagePathCtrl
+ isFile = True
+ if os.path.exists(self.GetWorkspace()):
+ startdir = self.GetWorkspace()
+ elif id == self._workspacePathBt.GetId():
+ dlgTitle = "Choose workspace path:"
+ editctrl = self._workspacePathCtrl
+ startdir = editctrl.GetValue()
+ elif id == self._doxygenPathBt.GetId():
+ isFile = True
+ dlgTitle = "Choose doxygen installation path:"
+ editctrl = self._doxygenPathCtrl
+ startdir = editctrl.GetValue()
+ elif id == self._outputPathBt.GetId():
+ dlgTitle = "Choose document output path:"
+ editctrl = self._outputPathCtrl
+ if os.path.exists(self.GetWorkspace()):
+ startdir = self.GetWorkspace()
+ startdir = editctrl.GetValue()
+ elif id == self._chmPathBt.GetId():
+ isFile = True
+ dlgTitle = "Choose installation path for Microsoft HTML workshop software"
+ editctrl = self._chmPathCtrl
+ startdir = editctrl.GetValue()
+ else:
+ return
+
+ if not isFile:
+ dlg = wx.DirDialog(self, dlgTitle, defaultPath=startdir)
+ else:
+ dlg = wx.FileDialog(self, dlgTitle, defaultDir=startdir)
+
+ if dlg.ShowModal() == wx.ID_OK:
+ editctrl.SetValue(dlg.GetPath())
+ dlg.Destroy()
+
+ def OnArchtectureSelectChanged(self, event):
+ str = ''
+ selarch = self._archCtrl.GetValue()
+ if selarch == 'ALL':
+ str += 'MDE_CPU_IA32 MDE_CPU_X64 MDE_CPU_EBC MDE_CPU_IPF _MSC_EXTENSIONS __GNUC__ __INTEL_COMPILER'
+ elif selarch == 'IA32/MSFT':
+ str += 'MDE_CPU_IA32 _MSC_EXTENSIONS'
+ elif selarch == 'IA32/GNU':
+ str += 'MDE_CPU_IA32 __GNUC__'
+ elif selarch == 'X64/MSFT':
+ str += 'MDE_CPU_X64 _MSC_EXTENSIONS'
+ elif selarch == 'X64/GNU':
+ str += 'MDE_CPU_X64 __GNUC__'
+ elif selarch == 'IPF/MSFT':
+ str += 'MDE_CPU_IPF _MSC_EXTENSIONS'
+ elif selarch == 'IPF/GNU':
+ str += 'MDE_CPU_IPF __GNUC__'
+ elif selarch == 'EBC/INTEL':
+ str += 'MDE_CPU_EBC __INTEL_COMPILER'
+
+ str += ' ASM_PFX= OPTIONAL= '
+
+ def OnMacroText(self, event):
+ str = ''
+ selarch = self._archCtrl.GetValue()
+ if selarch == 'ALL':
+ str += 'MDE_CPU_IA32 MDE_CPU_X64 MDE_CPU_EBC MDE_CPU_IPF _MSC_EXTENSIONS __GNUC__ __INTEL_COMPILER'
+ elif selarch == 'IA32/MSFT':
+ str += 'MDE_CPU_IA32 _MSC_EXTENSIONS'
+ elif selarch == 'IA32/GNU':
+ str += 'MDE_CPU_IA32 __GNUC__'
+ elif selarch == 'X64/MSFT':
+ str += 'MDE_CPU_X64 _MSC_EXTENSIONS'
+ elif selarch == 'X64/GNU':
+ str += 'MDE_CPU_X64 __GNUC__'
+ elif selarch == 'IPF/MSFT':
+ str += 'MDE_CPU_IPF _MSC_EXTENSIONS'
+ elif selarch == 'IPF/GNU':
+ str += 'MDE_CPU_IPF __GNUC__'
+ elif selarch == 'EBC/INTEL':
+ str += 'MDE_CPU_EBC __INTEL_COMPILER'
+
+ str += ' ASM_PFX= OPTIONAL= '
+
+ def OnGenerate(self, event):
+ if not self.CheckInput(): return
+
+ dlg = ProgressDialog(self)
+ dlg.ShowModal()
+ dlg.Destroy()
+
+ def CheckInput(self):
+ pPath = self.GetPackagePath()
+ wPath = self.GetWorkspace()
+ dPath = self.GetDoxygenToolPath()
+ cPath = self.GetChmToolPath()
+ oPath = self.GetOutputPath()
+
+ if len(wPath) == 0 or not os.path.exists(wPath):
+ self._Error("Please input existing workspace path!")
+ return False
+ else:
+ self.SaveConfigure('WorkspacePath', wPath)
+
+ if len(pPath) == 0 or not os.path.exists(pPath) or not pPath.lower().endswith('.dec'):
+ self._Error("Please input existing package file location!")
+ return False
+ elif pPath.lower().find(wPath.lower()) == -1:
+ self._Error("Package patch should starts with workspace path, such as if workspace path is c:\\edk2, package patch could be c:\\edk2\MdePkg")
+ return False
+ else:
+ self.SaveConfigure('PackagePath', pPath)
+
+ if len(dPath) == 0 or not os.path.exists(dPath):
+ self._Error("Can not find doxygen tool from path %s! Please download it from www.stack.nl/~dimitri/doxygen/download.html" % dPath)
+ return False
+ else:
+ self.SaveConfigure('DoxygenPath', dPath)
+
+ if self._modesel.GetStringSelection() == 'CHM':
+ if (len(cPath) == 0 or not os.path.exists(cPath)):
+ self._Error("You select CHM mode to generate document, but can not find software of Microsoft HTML Help Workshop.\nPlease\
+ download it from http://www.microsoft.com/downloads/details.aspx?FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc&displaylang=en\n\
+and install!")
+ return False
+ else:
+ self.SaveConfigure('CHMPath', cPath)
+
+ if len(oPath) == 0:
+ self._Error("You must specific document output path")
+ return False
+ else:
+ self.SaveConfigure('OutputPath', oPath)
+
+ if os.path.exists(oPath):
+ # add checking whether there is old doxygen config file here
+ files = os.listdir(oPath)
+ for file in files:
+ if os.path.isfile(os.path.join(oPath,file)):
+ basename, ext = os.path.splitext(file)
+ if ext.lower() == '.doxygen_config':
+ dlg = GMD.GenericMessageDialog(self, "Existing doxygen document in output directory will be overwritten\n, Are you sure?",
+ "Info", wx.ICON_WARNING|wx.YES_NO)
+ if dlg.ShowModal() == wx.ID_YES:
+ break
+ else:
+ return False
+ else:
+ try:
+ os.makedirs(oPath)
+ except:
+ self._Error("Fail to create output directory, please select another output directory!")
+ return False
+
+ return True
+
+ def _Error(self, message):
+ dlg = GMD.GenericMessageDialog(self, message,
+ "Error", wx.ICON_ERROR|wx.OK)
+ dlg.ShowModal()
+ dlg.Destroy()
+
+ def GetWorkspace(self):
+ return os.path.normpath(self._workspacePathCtrl.GetValue())
+
+ def GetPackagePath(self):
+ return os.path.normpath(self._packagePathCtrl.GetValue())
+
+ def GetOutputPath(self):
+ return os.path.normpath(self._outputPathCtrl.GetValue())
+
+ def GetDoxygenToolPath(self):
+ return os.path.normpath(self._doxygenPathCtrl.GetValue())
+
+ def GetChmToolPath(self):
+ return os.path.normpath(self._chmPathCtrl.GetValue())
+
+ def GetDocumentMode(self):
+ return self._modesel.GetStringSelection()
+
+ def GetArchitecture(self):
+ value = self._archCtrl.GetValue()
+ return value.split('/')[0]
+
+ def GetToolTag(self):
+ value = self._archCtrl.GetValue()
+ if value == 'ALL':
+ return 'ALL'
+ return value.split('/')[1]
+
+ def GetIsOnlyDocumentInclude(self):
+ return self._includeonlysel.IsChecked()
+
+class ProgressDialog(wx.Dialog):
+ def __init__(self, parent, id=wx.ID_ANY):
+ title = "Generate Document for " + parent.GetPackagePath()
+ wx.Dialog.__init__(self, parent, id, title=title, style=wx.CAPTION, size=(600, 300))
+ self.Freeze()
+ sizer = wx.BoxSizer(wx.VERTICAL)
+ self._textCtrl = wx.StaticText(self, -1, "Start launching!")
+ self._gaugeCtrl = wx.Gauge(self, -1, 100, size=(-1, 10))
+ self._resultCtrl = wx.stc.StyledTextCtrl(self, -1)
+ self._closeBt = wx.Button(self, -1, "Close")
+ self._gotoOuputBt = wx.Button(self, -1, "Goto Output")
+
+ # clear all margin
+ self._resultCtrl.SetMarginWidth(0, 0)
+ self._resultCtrl.SetMarginWidth(1, 0)
+ self._resultCtrl.SetMarginWidth(2, 0)
+
+ sizer.Add(self._textCtrl, 0, wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, 5)
+ sizer.Add(self._gaugeCtrl, 0, wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, 5)
+ sizer.Add(self._resultCtrl, 1, wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, 5)
+ btsizer = wx.BoxSizer(wx.HORIZONTAL)
+ btsizer.Add(self._gotoOuputBt, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT|wx.TOP|wx.LEFT|wx.BOTTOM, 5)
+ btsizer.Add(self._closeBt, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT|wx.TOP|wx.LEFT|wx.BOTTOM, 5)
+ sizer.Add(btsizer, 0, wx.ALIGN_CENTER_HORIZONTAL)
+
+ self.SetSizer(sizer)
+ self.CenterOnScreen()
+ self.Thaw()
+
+ self._logger = logging.getLogger('')
+ self._loghandle = ResultHandler(self)
+ logging.getLogger('edk').addHandler(self._loghandle)
+ logging.getLogger('').addHandler(self._loghandle)
+ logging.getLogger('app').addHandler(self._loghandle)
+
+ wx.EVT_BUTTON(self._closeBt, self._closeBt.GetId(), self.OnButtonClose)
+ wx.EVT_UPDATE_UI(self, self._closeBt.GetId(), self.OnUpdateCloseButton)
+ wx.EVT_BUTTON(self._gotoOuputBt, self._gotoOuputBt.GetId(), self.OnGotoOutput)
+ EVT_LOG(self, self.OnPostLog)
+
+ self._process = None
+ self._pid = None
+ self._input = None
+ self._output = None
+ self._error = None
+ self._inputThread = None
+ self._errorThread = None
+ self._isBusy = True
+ self._pObj = None
+
+ wx.CallAfter(self.GenerateAction)
+
+ def OnUpdateCloseButton(self, event):
+ self._closeBt.Enable(not self._isBusy)
+ return True
+
+ def OnButtonClose(self, event):
+ if self._isBusy:
+ self._InfoDialog("Please don't close in progressing...")
+ return
+
+ if self._process != None:
+ self._process.CloseOutput()
+
+ if self._inputThread:
+ self._inputThread.Terminate()
+ if self._errorThread:
+ self._errorThread.Terminate()
+
+ if self._pid != None:
+ wx.Process.Kill(self._pid, wx.SIGKILL, wx.KILL_CHILDREN)
+
+ logging.getLogger('edk').removeHandler(self._loghandle)
+ logging.getLogger('').removeHandler(self._loghandle)
+ logging.getLogger('app').removeHandler(self._loghandle)
+
+ if self._pObj != None:
+ self._pObj.Destroy()
+
+ self.EndModal(0)
+
+ def OnGotoOutput(self, event):
+ output = self.GetParent().GetOutputPath()
+ if os.path.exists(output):
+ if wx.Platform == '__WXMSW__':
+ os.startfile(self.GetParent().GetOutputPath())
+ else:
+ import webbrowser
+ webbrowser.open(self.GetParent().GetOutputPath())
+ else:
+ self._ErrorDialog("Output directory does not exist!")
+
+ def _ErrorDialog(self, message):
+ dlg = GMD.GenericMessageDialog(self, message,
+ "Error", wx.ICON_ERROR|wx.OK)
+ dlg.ShowModal()
+ dlg.Destroy()
+
+ def _InfoDialog(self, message):
+ dlg = GMD.GenericMessageDialog(self, message,
+ "Info", wx.ICON_INFORMATION|wx.OK)
+ dlg.ShowModal()
+ dlg.Destroy()
+
+ def _LogStep(self, index, message):
+ stepstr = "Step %d: %s" % (index, message)
+ self._textCtrl.SetLabel(stepstr)
+ self.LogMessage(os.linesep + stepstr + os.linesep)
+ self._gaugeCtrl.SetValue(index * 100 / 6 )
+
+ def OnPostLog(self, event):
+ self.LogMessage(event.message)
+
+ def GenerateAction(self):
+ self._LogStep(1, "Create Package Object Model")
+ wsPath = self.GetParent().GetWorkspace()
+ pkPath = self.GetParent().GetPackagePath()[len(wsPath) + 1:]
+
+ try:
+ pObj = baseobject.Package(None, self.GetParent().GetWorkspace())
+ pObj.Load(pkPath)
+ except:
+ self._ErrorDialog("Fail to create package object model! Please check log.txt under this application folder!")
+ self._isBusy = False
+ return
+ self._pObj = pObj
+
+ self.LogMessage(str(pObj.GetPcds()))
+
+ self._LogStep(2, "Preprocess and Generate Doxygen Config File")
+ try:
+ action = doxygengen.PackageDocumentAction(self.GetParent().GetDoxygenToolPath(),
+ self.GetParent().GetChmToolPath(),
+ self.GetParent().GetOutputPath(),
+ pObj,
+ self.GetParent().GetDocumentMode(),
+ self.LogMessage,
+ self.GetParent().GetArchitecture(),
+ self.GetParent().GetToolTag(),
+ self.GetParent().GetIsOnlyDocumentInclude(),
+ True)
+ except:
+ self._ErrorDialog("Fail to preprocess! Please check log.txt under this application folder!")
+ self._isBusy = False
+ return
+
+ action.RegisterCallbackDoxygenProcess(self.CreateDoxygeProcess)
+
+ try:
+ if not action.Generate():
+ self._isBusy = False
+ self.LogMessage("Fail to generate package document! Please check log.txt under this application folder!", 'error')
+ except:
+ import traceback
+ message = traceback.format_exception(*sys.exc_info())
+ logging.getLogger('').error(''.join(message))
+ self._isBusy = False
+ self._ErrorDialog("Fail to generate package document! Please check log.txt under this application folder!")
+
+ def LogMessage(self, message, level='info'):
+ self._resultCtrl.DocumentEnd()
+ self._resultCtrl.SetReadOnly(False)
+ self._resultCtrl.AppendText(message)
+ self._resultCtrl.Home()
+ self._resultCtrl.Home()
+ self._resultCtrl.SetReadOnly(True)
+ if level == 'error':
+ wx.GetApp().GetLogger().error(message)
+
+ def CreateDoxygeProcess(self, doxPath, configFile):
+ self._LogStep(3, "Launch Doxygen Tool and Generate Package Document")
+
+ cmd = '"%s" %s' % (doxPath, configFile)
+ try:
+ self._process = DoxygenProcess()
+ self._process.SetParent(self)
+ self._process.Redirect()
+ self._pid = wx.Execute(cmd, wx.EXEC_ASYNC, self._process)
+ self._input = self._process.GetInputStream()
+ self._output = self._process.GetOutputStream()
+ self._error = self._process.GetErrorStream()
+ except:
+ self._ErrorDialog('Fail to launch doxygen cmd %s! Please check log.txt under this application folder!' % cmd)
+ self._isBusy = False
+ return False
+
+ self._inputThread = MonitorThread(self._input, self.LogMessage)
+ self._errorThread = MonitorThread(self._error, self.LogMessage)
+ self._inputThread.start()
+ self._errorThread.start()
+ return True
+
+ def OnTerminateDoxygenProcess(self):
+ if self._inputThread:
+ self._inputThread.Terminate()
+ self._inputThread = None
+ if self._errorThread:
+ self._errorThread.Terminate()
+ self._errorThread = None
+
+ if self._error:
+ while self._error.CanRead():
+ text = self._error.read()
+ self.LogMessage(text)
+
+ if self._input:
+ while self._input.CanRead():
+ text = self._input.read()
+ self.LogMessage(text)
+ self._process.Detach()
+
+ self._process.CloseOutput()
+ self._process = None
+ self._pid = None
+
+ self.DocumentFixup()
+
+ if self.GetParent().GetDocumentMode().lower() == 'chm':
+ hhcfile = os.path.join(self.GetParent().GetOutputPath(), 'html', 'index.hhc')
+ hhpfile = os.path.join(self.GetParent().GetOutputPath(), 'html', 'index.hhp')
+ self.FixDecDoxygenFileLink(hhcfile, None)
+ if not self.CreateCHMProcess(self.GetParent().GetChmToolPath(), hhpfile):
+ self._ErrorDialog("Fail to Create %s process for %s" % (self.GetParent().GetChmToolPath(), hhpfile))
+ self._isBusy = False
+ else:
+ self._LogStep(6, "Finished Document Generation!")
+ self._isBusy = False
+ indexpath = os.path.realpath(os.path.join(self.GetParent().GetOutputPath(), 'html', 'index.html'))
+ if wx.Platform == '__WXMSW__':
+ os.startfile(indexpath)
+ else:
+ import webbrowser
+ webbrowser.open(indexpath)
+
+ self._InfoDialog('Success create HTML doxgen document %s' % indexpath)
+
+ def CreateCHMProcess(self, chmPath, hhpfile):
+ self.LogMessage(" >>>>>> Start Microsoft HTML workshop process...Zzz...\n")
+ cmd = '"%s" %s' % (chmPath, hhpfile)
+ try:
+ self._process = CHMProcess()
+ self._process.SetParent(self)
+ self._process.Redirect()
+ self._pid = wx.Execute(cmd, wx.EXEC_ASYNC, self._process)
+ self._input = self._process.GetInputStream()
+ self._output = self._process.GetOutputStream()
+ self._error = self._process.GetErrorStream()
+ except:
+ self.LogMessage('\nFail to launch hhp cmd %s!\n' % cmd)
+ self._isBusy = False
+ return False
+ self._inputThread = MonitorThread(self._input, self.LogMessage)
+ self._errorThread = MonitorThread(self._error, self.LogMessage)
+ self._inputThread.start()
+ self._errorThread.start()
+ return True
+
+ def OnTerminateCHMProcess(self):
+ if self._inputThread:
+ self._inputThread.Terminate()
+ self._inputThread = None
+ if self._errorThread:
+ self._errorThread.Terminate()
+ self._errorThread = None
+
+ if self._error:
+ while self._error.CanRead():
+ text = self._error.read()
+ self.LogMessage(text)
+ if self._input:
+ while self._input.CanRead():
+ text = self._input.read()
+ self.LogMessage(text)
+ self._process.Detach()
+
+ self._process.CloseOutput()
+ self._process = None
+ self._pid = None
+ self._isBusy = False
+ indexpath = os.path.realpath(os.path.join(self.GetParent().GetOutputPath(), 'html', 'index.chm'))
+ if os.path.exists(indexpath):
+ if wx.Platform == '__WXMSW__':
+ os.startfile(indexpath)
+ else:
+ import webbrowser
+ webbrowser.open(indexpath)
+
+ self._LogStep(6, "Finished Document Generation!")
+ self.LogMessage('\nSuccess create CHM doxgen document %s\n' % indexpath)
+ self._InfoDialog('Success create CHM doxgen document %s' % indexpath)
+
+ def DocumentFixup(self):
+ # find BASE_LIBRARY_JUMP_BUFFER structure reference page
+ self._LogStep(4, "Fixup Package Document!")
+ self.LogMessage('\n >>> Start fixup document \n')
+
+ for root, dirs, files in os.walk(os.path.join(self.GetParent().GetOutputPath(), 'html')):
+ for dir in dirs:
+ if dir.lower() in ['.svn', '_svn', 'cvs']:
+ dirs.remove(dir)
+ for file in files:
+ wx.YieldIfNeeded()
+ if not file.lower().endswith('.html'): continue
+ fullpath = os.path.join(self.GetParent().GetOutputPath(), root, file)
+ try:
+ f = open(fullpath, 'r')
+ text = f.read()
+ f.close()
+ except:
+ self.LogMessage('\nFail to open file %s\n' % fullpath)
+ continue
+ if text.find('BASE_LIBRARY_JUMP_BUFFER Struct Reference') != -1 and self.GetParent().GetArchitecture() == 'ALL':
+ self.FixPageBASE_LIBRARY_JUMP_BUFFER(fullpath, text)
+ if text.find('MdePkg/Include/Library/BaseLib.h File Reference') != -1 and self.GetParent().GetArchitecture() == 'ALL':
+ self.FixPageBaseLib(fullpath, text)
+ if text.find('IA32_IDT_GATE_DESCRIPTOR Union Reference') != -1 and self.GetParent().GetArchitecture() == 'ALL':
+ self.FixPageIA32_IDT_GATE_DESCRIPTOR(fullpath, text)
+ if text.find('MdePkg/Include/Library/UefiDriverEntryPoint.h File Reference') != -1:
+ self.FixPageUefiDriverEntryPoint(fullpath, text)
+ if text.find('MdePkg/Include/Library/UefiApplicationEntryPoint.h File Reference') != -1:
+ self.FixPageUefiApplicationEntryPoint(fullpath, text)
+ if text.lower().find('.s.dox') != -1 or \
+ text.lower().find('.asm.dox') != -1 or \
+ text.lower().find('.uni.dox') != -1:
+ self.FixDoxFileLink(fullpath, text)
+
+ self.RemoveFileList()
+ self.LogMessage(' >>> Finish all document fixing up! \n')
+
+ def RemoveFileList(self):
+ path_html = os.path.join(self.GetParent().GetOutputPath(), "html", "tree.html")
+ path_chm = os.path.join(self.GetParent().GetOutputPath(), "html", "index.hhc")
+ if os.path.exists(path_html):
+ self.LogMessage(' >>>Remove FileList item from generated HTML document.\n');
+ lines = []
+ f = open (path_html, "r")
+ lines = f.readlines()
+ f.close()
+ bfound = False
+ for index in range(len(lines)):
+ if lines[index].find('<a class="el" href="files.html" target="basefrm">File List</a>') != -1:
+ lines[index] = "<!-- %s" % lines[index]
+ bfound = True
+ continue
+ if bfound:
+ if lines[index].find('</div>') != -1:
+ lines[index] = "%s -->" % lines[index]
+ break
+ if bfound:
+ f = open(path_html, "w")
+ f.write("".join(lines))
+ f.close()
+ else:
+ self.LogMessage (' !!!Can not found FileList item in HTML document!\n')
+
+ if os.path.exists(path_chm):
+ self.LogMessage(" >>>Warning: Can not remove FileList for CHM files!\n");
+ """
+ self.LogMessage(' >>>Remove FileList item from generated CHM document!\n');
+ lines = []
+ f = open (path_chm, "r")
+ lines = f.readlines()
+ f.close()
+ bfound = False
+ for index in xrange(len(lines)):
+ if not bfound:
+ if lines[index].find('<param name="Local" value="files.html">') != -1:
+ lines[index] = '<!-- %s' % lines[index]
+ bfound = True
+ continue
+ if bfound:
+ if lines[index].find('</UL>') != -1:
+ lines[index] = '%s -->\n' % lines[index].rstrip()
+ break
+ if bfound:
+ f = open(path_chm, "w")
+ f.write("".join(lines))
+ f.close()
+ import time
+ time.sleep(2)
+ else:
+ self.LogMessage(' !!!Can not found the FileList item in CHM document!')
+ """
+ def FixPageBaseLib(self, path, text):
+ self.LogMessage(' >>> Fixup BaseLib file page at file %s \n' % path)
+ lines = text.split('\n')
+ lastBaseJumpIndex = -1
+ lastIdtGateDescriptor = -1
+ for index in range(len(lines) - 1, -1, -1):
+ line = lines[index]
+ if line.strip() == '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT&nbsp;&nbsp;&nbsp;4 </td>':
+ lines[index] = '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT&nbsp;&nbsp;&nbsp;4&nbsp;[IA32] </td>'
+ if line.strip() == '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT&nbsp;&nbsp;&nbsp;0x10 </td>':
+ lines[index] = '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT&nbsp;&nbsp;&nbsp;0x10&nbsp;[IPF] </td>'
+ if line.strip() == '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT&nbsp;&nbsp;&nbsp;8 </td>':
+ lines[index] = '<td class="memname">#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT&nbsp;&nbsp;&nbsp;9&nbsp;[EBC, x64] </td>'
+ if line.find('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;4') != -1:
+ lines[index] = lines[index].replace('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;4',
+ 'BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;4&nbsp;[IA32]')
+ if line.find('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;0x10') != -1:
+ lines[index] = lines[index].replace('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;0x10',
+ 'BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;0x10&nbsp;[IPF]')
+ if line.find('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;8') != -1:
+ lines[index] = lines[index].replace('BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;8',
+ 'BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT</a>&nbsp;&nbsp;&nbsp;8&nbsp;[x64, EBC]')
+ if line.find('>BASE_LIBRARY_JUMP_BUFFER</a>') != -1:
+ if lastBaseJumpIndex != -1:
+ del lines[lastBaseJumpIndex]
+ lastBaseJumpIndex = index
+ if line.find('>IA32_IDT_GATE_DESCRIPTOR</a></td>') != -1:
+ if lastIdtGateDescriptor != -1:
+ del lines[lastIdtGateDescriptor]
+ lastIdtGateDescriptor = index
+ try:
+ f = open(path, 'w')
+ f.write('\n'.join(lines))
+ f.close()
+ except:
+ self._isBusy = False
+ self.LogMessage(" <<< Fail to fixup file %s\n" % path)
+ self.LogMessage(" <<< Finish to fixup file %s\n" % path)
+
+ def FixPageIA32_IDT_GATE_DESCRIPTOR(self, path, text):
+ self.LogMessage(' >>> Fixup structure reference IA32_IDT_GATE_DESCRIPTOR at file %s \n' % path)
+ lines = text.split('\n')
+ for index in range(len(lines) - 1, -1, -1):
+ line = lines[index].strip()
+ if line.find('struct {</td>') != -1 and lines[index - 2].find('>Uint64</a></td>') != -1:
+ lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For X64</h2></td></tr>')
+ if line.find('struct {</td>') != -1 and lines[index - 1].find('Data Fields') != -1:
+ lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For IA32</h2></td></tr>')
+ try:
+ f = open(path, 'w')
+ f.write('\n'.join(lines))
+ f.close()
+ except:
+ self._isBusy = False
+ self.LogMessage(" <<< Fail to fixup file %s\n" % path)
+ self.LogMessage(" <<< Finish to fixup file %s\n" % path)
+
+ def FixPageBASE_LIBRARY_JUMP_BUFFER(self, path, text):
+ self.LogMessage(' >>> Fixup structure reference BASE_LIBRARY_JUMP_BUFFER at file %s \n' % path)
+ lines = text.split('\n')
+ bInDetail = True
+ bNeedRemove = False
+ for index in range(len(lines) - 1, -1, -1):
+ line = lines[index]
+ if line.find('Detailed Description') != -1:
+ bInDetail = False
+ if line.startswith('EBC context buffer used by') and lines[index - 1].startswith('x64 context buffer'):
+ lines[index] = "IA32/IPF/X64/" + line
+ bNeedRemove = True
+ if line.startswith("x64 context buffer") or line.startswith('IPF context buffer used by') or \
+ line.startswith('IA32 context buffer used by'):
+ if bNeedRemove:
+ lines.remove(line)
+ if line.find('>R0</a>') != -1 and not bInDetail:
+ if lines[index - 1] != '<tr><td colspan="2"><br><h2>Data Fields For EBC</h2></td></tr>':
+ lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For EBC</h2></td></tr>')
+ if line.find('>Rbx</a>') != -1 and not bInDetail:
+ if lines[index - 1] != '<tr><td colspan="2"><br><h2>Data Fields For X64</h2></td></tr>':
+ lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For X64</h2></td></tr>')
+ if line.find('>F2</a>') != -1 and not bInDetail:
+ if lines[index - 1] != '<tr><td colspan="2"><br><h2>Data Fields For IPF</h2></td></tr>':
+ lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For IPF</h2></td></tr>')
+ if line.find('>Ebx</a>') != -1 and not bInDetail:
+ if lines[index - 1] != '<tr><td colspan="2"><br><h2>Data Fields For IA32</h2></td></tr>':
+ lines.insert(index, '<tr><td colspan="2"><br><h2>Data Fields For IA32</h2></td></tr>')
+ try:
+ f = open(path, 'w')
+ f.write('\n'.join(lines))
+ f.close()
+ except:
+ self._isBusy = False
+ self.LogMessage(" <<< Fail to fixup file %s" % path)
+ self.LogMessage(" <<< Finish to fixup file %s\n" % path)
+
+ def FixPageUefiDriverEntryPoint(self, path, text):
+ self.LogMessage(' >>> Fixup file reference MdePkg/Include/Library/UefiDriverEntryPoint.h at file %s \n' % path)
+ lines = text.split('\n')
+ bInModuleEntry = False
+ bInEfiMain = False
+ ModuleEntryDlCount = 0
+ ModuleEntryDelStart = 0
+ ModuleEntryDelEnd = 0
+ EfiMainDlCount = 0
+ EfiMainDelStart = 0
+ EfiMainDelEnd = 0
+
+ for index in range(len(lines)):
+ line = lines[index].strip()
+ if line.find('EFI_STATUS</a> EFIAPI _ModuleEntryPoint </td>') != -1:
+ bInModuleEntry = True
+ if line.find('EFI_STATUS</a> EFIAPI EfiMain </td>') != -1:
+ bInEfiMain = True
+ if line.startswith('<p>References <a'):
+ if bInModuleEntry:
+ ModuleEntryDelEnd = index - 1
+ bInModuleEntry = False
+ elif bInEfiMain:
+ EfiMainDelEnd = index - 1
+ bInEfiMain = False
+ if bInModuleEntry:
+ if line.startswith('</dl>'):
+ ModuleEntryDlCount = ModuleEntryDlCount + 1
+ if ModuleEntryDlCount == 1:
+ ModuleEntryDelStart = index + 1
+ if bInEfiMain:
+ if line.startswith('</dl>'):
+ EfiMainDlCount = EfiMainDlCount + 1
+ if EfiMainDlCount == 1:
+ EfiMainDelStart = index + 1
+
+ if EfiMainDelEnd > EfiMainDelStart:
+ for index in range(EfiMainDelEnd, EfiMainDelStart, -1):
+ del lines[index]
+ if ModuleEntryDelEnd > ModuleEntryDelStart:
+ for index in range(ModuleEntryDelEnd, ModuleEntryDelStart, -1):
+ del lines[index]
+
+ try:
+ f = open(path, 'w')
+ f.write('\n'.join(lines))
+ f.close()
+ except:
+ self._isBusy = False
+ self.LogMessage(" <<< Fail to fixup file %s" % path)
+ self.LogMessage(" <<< Finish to fixup file %s\n" % path)
+
+ def FixPageUefiApplicationEntryPoint(self, path, text):
+ self.LogMessage(' >>> Fixup file reference MdePkg/Include/Library/UefiApplicationEntryPoint.h at file %s \n' % path)
+ lines = text.split('\n')
+ bInModuleEntry = False
+ bInEfiMain = False
+ ModuleEntryDlCount = 0
+ ModuleEntryDelStart = 0
+ ModuleEntryDelEnd = 0
+ EfiMainDlCount = 0
+ EfiMainDelStart = 0
+ EfiMainDelEnd = 0
+
+ for index in range(len(lines)):
+ line = lines[index].strip()
+ if line.find('EFI_STATUS</a> EFIAPI _ModuleEntryPoint </td>') != -1:
+ bInModuleEntry = True
+ if line.find('EFI_STATUS</a> EFIAPI EfiMain </td>') != -1:
+ bInEfiMain = True
+ if line.startswith('<p>References <a'):
+ if bInModuleEntry:
+ ModuleEntryDelEnd = index - 1
+ bInModuleEntry = False
+ elif bInEfiMain:
+ EfiMainDelEnd = index - 1
+ bInEfiMain = False
+ if bInModuleEntry:
+ if line.startswith('</dl>'):
+ ModuleEntryDlCount = ModuleEntryDlCount + 1
+ if ModuleEntryDlCount == 1:
+ ModuleEntryDelStart = index + 1
+ if bInEfiMain:
+ if line.startswith('</dl>'):
+ EfiMainDlCount = EfiMainDlCount + 1
+ if EfiMainDlCount == 1:
+ EfiMainDelStart = index + 1
+
+ if EfiMainDelEnd > EfiMainDelStart:
+ for index in range(EfiMainDelEnd, EfiMainDelStart, -1):
+ del lines[index]
+ if ModuleEntryDelEnd > ModuleEntryDelStart:
+ for index in range(ModuleEntryDelEnd, ModuleEntryDelStart, -1):
+ del lines[index]
+
+ try:
+ f = open(path, 'w')
+ f.write('\n'.join(lines))
+ f.close()
+ except:
+ self._isBusy = False
+ self.LogMessage(" <<< Fail to fixup file %s" % path)
+ self.LogMessage(" <<< Finish to fixup file %s\n" % path)
+
+
+ def FixDoxFileLink(self, path, text):
+ self.LogMessage(' >>> Fixup .dox postfix for file %s \n' % path)
+ try:
+ fd = open(path, 'r')
+ text = fd.read()
+ fd.close()
+ except Exception as e:
+ self.LogMessage (" <<<Fail to open file %s" % path)
+ return
+ text = text.replace ('.s.dox', '.s')
+ text = text.replace ('.S.dox', '.S')
+ text = text.replace ('.asm.dox', '.asm')
+ text = text.replace ('.Asm.dox', '.Asm')
+ text = text.replace ('.uni.dox', '.uni')
+ text = text.replace ('.Uni.dox', '.Uni')
+ try:
+ fd = open(path, 'w')
+ fd.write(text)
+ fd.close()
+ except Exception as e:
+ self.LogMessage (" <<<Fail to fixup file %s" % path)
+ return
+ self.LogMessage(' >>> Finish to fixup .dox postfix for file %s \n' % path)
+
+ def FixDecDoxygenFileLink(self, path, text):
+ self.LogMessage(' >>> Fixup .decdoxygen postfix for file %s \n' % path)
+ try:
+ fd = open(path, 'r')
+ lines = fd.readlines()
+ fd.close()
+ except Exception as e:
+ self.LogMessage (" <<<Fail to open file %s" % path)
+ return
+ for line in lines:
+ if line.find('.decdoxygen') != -1:
+ lines.remove(line)
+ break
+ try:
+ fd = open(path, 'w')
+ fd.write("".join(lines))
+ fd.close()
+ except Exception as e:
+ self.LogMessage (" <<<Fail to fixup file %s" % path)
+ return
+ self.LogMessage(' >>> Finish to fixup .decdoxygen postfix for file %s \n' % path)
+
+import threading
+class MonitorThread(threading.Thread):
+ def __init__(self, pipe, callback):
+ threading.Thread.__init__(self)
+ self._pipe = pipe
+ self._callback = callback
+ self._isCancel = False
+
+ def run(self):
+ while (not self._isCancel):
+ self._pipe.Peek()
+ if self._pipe.LastRead() == 0:
+ break
+ text = self._pipe.read()
+ if len(text.strip()) != 0:
+ wx.GetApp().ForegroundProcess(self._callback, (text,))
+
+ def Terminate(self):
+ self._pipe.flush()
+ self._isCancel = True
+
+class DoxygenProcess(wx.Process):
+ def OnTerminate(self, id, status):
+ self._parent.OnTerminateDoxygenProcess()
+
+ def SetParent(self, parent):
+ self._parent = parent
+
+class CHMProcess(wx.Process):
+ def OnTerminate(self, id, status):
+ self._parent.OnTerminateCHMProcess()
+
+ def SetParent(self, parent):
+ self._parent = parent
+
+class ResultHandler:
+ def __init__(self, parent):
+ self._parent = parent
+ self.level = 0
+
+ def emit(self, record):
+ self._parent.LogMessage(record)
+
+ def handle(self, record):
+ wx.PostEvent(self._parent, LogEvent(message=record.getMessage()))
+
+ def acquire(self):
+ pass
+
+ def release(self):
+ pass
+
+if __name__ == '__main__':
+ app = PackageDocApp(redirect=False)
+ app.MainLoop()
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/__init__.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/__init__.py
new file mode 100644
index 000000000..57dfebde5
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/__init__.py
@@ -0,0 +1,6 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/__init__.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/__init__.py
new file mode 100644
index 000000000..57dfebde5
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/__init__.py
@@ -0,0 +1,6 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py
new file mode 100644
index 000000000..a8f87751a
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py
@@ -0,0 +1,445 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import print_function
+from __future__ import absolute_import
+import os
+
+from .message import *
+
+class BaseDoxygeItem:
+ def __init__(self, name, tag=''):
+ self.mName = name
+ self.mTag = tag
+ self.mDescription = ''
+ self.mText = []
+
+ def AddDescription(self, desc):
+ self.mDescription = '%s%s' % (self.mDescription, desc)
+
+ def __str__(self):
+ return '\n'.join(self.mText)
+
+ def Generate(self):
+ """This interface need to be override"""
+
+class Section(BaseDoxygeItem):
+ def Generate(self):
+ """This interface need to be override"""
+ if len(self.mTag) != 0:
+ self.mText.append(' \section %s %s' % (self.mName, self.mTag))
+ else:
+ self.mText.append(' \section %s' % self.mName)
+
+ self.mText.append(self.mDescription)
+ return self.mText
+
+class Page(BaseDoxygeItem):
+ def __init__(self, name, tag=None, isSort=True):
+ BaseDoxygeItem.__init__(self, name, tag)
+ self.mSubPages = []
+ self.mIsMainPage = False
+ self.mSections = []
+ self.mIsSort = isSort
+
+ def GetSubpageCount(self):
+ return len(self.mSubPages)
+
+ def AddPage(self, subpage):
+ self.mSubPages.append(subpage)
+ return subpage
+
+ def AddPages(self, pageArray):
+ if pageArray is None:
+ return
+ for page in pageArray:
+ self.AddPage(page)
+
+ def AddSection(self, section):
+ self.mSections.append(section)
+ self.mSections.sort(key=lambda x: x.mName.lower())
+
+ def Generate(self):
+ if self.mIsMainPage:
+ self.mText.append('/** \mainpage %s' % self.mName)
+ self.mIsSort = False
+ else:
+ self.mText.append('/** \page %s %s' % (self.mTag, self.mName))
+
+ if len(self.mDescription) != 0:
+ self.mText.append(self.mDescription)
+ endIndex = len(self.mText)
+
+ self.mSections.sort(key=lambda x: x.mName.lower())
+ for sect in self.mSections:
+ self.mText += sect.Generate()
+
+ endIndex = len(self.mText)
+
+ if len(self.mSubPages) != 0:
+ self.mText.insert(endIndex, "<p> \section content_index INDEX")
+ endIndex = len(self.mText)
+ self.mText.insert(endIndex, '<ul>')
+ endIndex += 1
+ if self.mIsSort:
+ self.mSubPages.sort(key=lambda x: x.mName.lower())
+ for page in self.mSubPages:
+ self.mText.insert(endIndex, '<li>\subpage %s \"%s\" </li>' % (page.mTag, page.mName))
+ endIndex += 1
+ self.mText += page.Generate()
+ self.mText.insert(endIndex, '</ul>')
+ endIndex += 1
+ self.mText.insert(endIndex, ' **/')
+ return self.mText
+
+class DoxygenFile(Page):
+ def __init__(self, name, file):
+ Page.__init__(self, name)
+ self.mFilename = file
+ self.mIsMainPage = True
+
+ def GetFilename(self):
+ return self.mFilename.replace('/', '\\')
+
+ def Save(self):
+ str = self.Generate()
+ try:
+ f = open(self.mFilename, 'w')
+ f.write('\n'.join(str))
+ f.close()
+ except IOError as e:
+ ErrorMsg ('Fail to write file %s' % self.mFilename)
+ return False
+
+ return True
+
+doxygenConfigTemplate = """
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = %(ProjectName)s
+PROJECT_NUMBER = %(ProjectVersion)s
+OUTPUT_DIRECTORY = %(OutputDir)s
+CREATE_SUBDIRS = YES
+OUTPUT_LANGUAGE = English
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class " \\
+ "The $name widget " \\
+ "The $name file " \\
+ is \\
+ provides \\
+ specifies \\
+ contains \\
+ represents \\
+ a \\
+ an \\
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH = %(StripPath)s
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = YES
+JAVADOC_AUTOBRIEF = NO
+QT_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = YES
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 1
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = YES
+OPTIMIZE_OUTPUT_JAVA = NO
+BUILTIN_STL_SUPPORT = NO
+CPP_CLI_SUPPORT = NO
+SIP_SUPPORT = NO
+DISTRIBUTE_GROUP_DOC = YES
+SUBGROUPING = YES
+TYPEDEF_HIDES_STRUCT = NO
+
+EXTRACT_ALL = YES
+EXTRACT_PRIVATE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = NO
+EXTRACT_LOCAL_METHODS = NO
+EXTRACT_ANON_NSPACES = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = NO
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = NO
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = YES
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = NO
+SHOW_DIRECTORIES = NO
+FILE_VERSION_FILTER =
+
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = YES
+WARN_FORMAT = "$file:$line: $text "
+WARN_LOGFILE = %(WarningFile)s
+
+INPUT = %(FileList)s
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS = %(Pattern)s
+RECURSIVE = NO
+EXCLUDE = *.svn
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS = .svn
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH = %(ExamplePath)s
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+REFERENCES_LINK_SOURCE = NO
+USE_HTAGS = NO
+VERBATIM_HEADERS = NO
+
+ALPHABETICAL_INDEX = NO
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = %(WhetherGenerateHtmlHelp)s
+HTML_DYNAMIC_SECTIONS = NO
+CHM_FILE = index.chm
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = %(WhetherGenerateTreeView)s
+TREEVIEW_WIDTH = 250
+
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = YES
+USE_PDFLATEX = YES
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+
+GENERATE_AUTOGEN_DEF = NO
+
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = YES
+EXPAND_ONLY_PREDEF = YES
+SEARCH_INCLUDES = YES
+INCLUDE_PATH = %(IncludePath)s
+INCLUDE_FILE_PATTERNS = *.h
+PREDEFINED = %(PreDefined)s
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = NO
+
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+
+CLASS_DIAGRAMS = NO
+MSCGEN_PATH =
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = NO
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 1000
+DOT_TRANSPARENT = YES
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+
+SEARCHENGINE = NO
+
+"""
+class DoxygenConfigFile:
+ def __init__(self):
+ self.mProjectName = ''
+ self.mOutputDir = ''
+ self.mFileList = []
+ self.mIncludeList = []
+ self.mStripPath = ''
+ self.mExamplePath = ''
+ self.mPattern = ['*.c', '*.h',
+ '*.asm', '*.s', '.nasm', '*.html', '*.dox']
+ self.mMode = 'HTML'
+ self.mWarningFile = ''
+ self.mPreDefined = []
+ self.mProjectVersion = 0.1
+
+ def SetChmMode(self):
+ self.mMode = 'CHM'
+
+ def SetHtmlMode(self):
+ self.mMode = 'HTML'
+
+ def SetProjectName(self, str):
+ self.mProjectName = str
+
+ def SetProjectVersion(self, str):
+ self.mProjectVersion = str
+
+ def SetOutputDir(self, str):
+ self.mOutputDir = str
+
+ def SetStripPath(self, str):
+ self.mStripPath = str
+
+ def SetExamplePath(self, str):
+ self.mExamplePath = str
+
+ def SetWarningFilePath(self, str):
+ self.mWarningFile = str.replace('\\', '/')
+
+ def FileExists(self, path):
+ if path is None:
+ return False
+ if len(path) == 0:
+ return False
+
+ for p in self.mFileList:
+ if path.lower() == p.lower():
+ return True
+
+ return False
+
+ def AddFile(self, path):
+ if path is None:
+ return
+
+ if len(path) == 0:
+ return
+ path = path.replace('\\', '/')
+ if not self.FileExists(path):
+ self.mFileList.append(path)
+
+ def AddIncludePath(self, path):
+ path = path.replace('\\', '/')
+ if path not in self.mIncludeList:
+ self.mIncludeList.append(path)
+
+ def AddPattern(self, pattern):
+ self.mPattern.append(pattern)
+
+ def AddPreDefined(self, macro):
+ self.mPreDefined.append(macro)
+
+ def Generate(self, path):
+ files = ' \\\n'.join(self.mFileList)
+ includes = ' \\\n'.join(self.mIncludeList)
+ patterns = ' \\\n'.join(self.mPattern)
+ if self.mMode.lower() == 'html':
+ sHtmlHelp = 'NO'
+ sTreeView = 'YES'
+ else:
+ sHtmlHelp = 'YES'
+ sTreeView = 'NO'
+
+ text = doxygenConfigTemplate % {'ProjectName':self.mProjectName,
+ 'OutputDir':self.mOutputDir,
+ 'StripPath':self.mStripPath,
+ 'ExamplePath':self.mExamplePath,
+ 'FileList':files,
+ 'Pattern':patterns,
+ 'WhetherGenerateHtmlHelp':sHtmlHelp,
+ 'WhetherGenerateTreeView':sTreeView,
+ 'IncludePath':includes,
+ 'WarningFile':self.mWarningFile,
+ 'PreDefined':' '.join(self.mPreDefined),
+ 'ProjectVersion':self.mProjectVersion}
+ try:
+ f = open(path, 'w')
+ f.write(text)
+ f.close()
+ except IOError as e:
+ ErrorMsg ('Fail to generate doxygen config file %s' % path)
+ return False
+
+ return True
+
+########################################################################
+# TEST CODE
+########################################################################
+if __name__== '__main__':
+ df = DoxygenFile('Platform Document', 'm:\tree')
+ df.AddPage(Page('Module', 'module'))
+ p = df.AddPage(Page('Library', 'library'))
+ p.AddDescription(desc)
+ p.AddPage(Page('PCD', 'pcds'))
+
+ df.Generate()
+ print(df)
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/efibinary.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/efibinary.py
new file mode 100644
index 000000000..1bc4938bf
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/efibinary.py
@@ -0,0 +1,606 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import print_function
+import array
+import uuid
+import re
+import os
+import logging
+import core.pe as pe
+
+def GetLogger():
+ return logging.getLogger('EFI Binary File')
+
+class EFIBinaryError(Exception):
+ def __init__(self, message):
+ Exception.__init__(self)
+ self._message = message
+
+ def GetMessage(self):
+ return self._message
+
+class EfiFd(object):
+ EFI_FV_HEADER_SIZE = 0x48
+
+ def __init__(self):
+ self._fvs = []
+
+ def Load(self, fd, size):
+ index = fd.tell()
+ while (index + self.EFI_FV_HEADER_SIZE < size):
+ fv = EfiFv(self)
+ fv.Load(fd)
+ self._fvs.append(fv)
+ index += fv.GetHeader().GetFvLength()
+ index = align(index, 8)
+ fd.seek(index)
+
+ def GetFvs(self):
+ return self._fvs
+
+class EfiFv(object):
+ FILE_SYSTEM_GUID = uuid.UUID('{8c8ce578-8a3d-4f1c-9935-896185c32dd3}')
+
+ def __init__(self, parent=None):
+ self._size = 0
+ self._filename = None
+ self._fvheader = None
+ self._blockentries = []
+ self._ffs = []
+
+ # following field is for FV in FD
+ self._parent = parent
+ self._offset = 0
+ self._raw = array.array('B')
+
+ def Load(self, fd):
+ self._offset = fd.tell()
+ self._filename = fd.name
+
+ # get file header
+ self._fvheader = EfiFirmwareVolumeHeader.Read(fd)
+ #self._fvheader.Dump()
+
+ self._size = self._fvheader.GetFvLength()
+
+ if self._fvheader.GetFileSystemGuid() != self.FILE_SYSTEM_GUID:
+ fd.seek(self._offset)
+ self._raw.fromfile(fd, self.GetHeader().GetFvLength())
+ return
+
+ # read block map
+ blockentry = BlockMapEntry.Read(fd)
+ self._blockentries.append(blockentry)
+ while (blockentry.GetNumberBlocks() != 0 and blockentry.GetLength() != 0):
+ self._blockentries.append(blockentry)
+ blockentry = BlockMapEntry.Read(fd)
+
+
+ if self._fvheader.GetSize() + (len(self._blockentries)) * 8 != \
+ self._fvheader.GetHeaderLength():
+ raise EFIBinaryError("Volume Header length not consistent with block map!")
+
+ index = align(fd.tell(), 8)
+ count = 0
+ while ((index + EfiFfs.FFS_HEADER_SIZE) < self._size):
+ ffs = EfiFfs.Read(fd, self)
+ if not isValidGuid(ffs.GetNameGuid()):
+ break
+ self._ffs.append(ffs)
+ count += 1
+ index = align(fd.tell(), 8)
+
+ fd.seek(self._offset)
+ self._raw.fromfile(fd, self.GetHeader().GetFvLength())
+
+ def GetFfs(self):
+ return self._ffs
+
+ def GetHeader(self):
+ return self._fvheader
+
+ def GetBlockEntries(self):
+ return self._blockentries
+
+ def GetHeaderRawData(self):
+ ret = []
+ ret += self._fvheader.GetRawData()
+ for block in self._blockentries:
+ ret += block.GetRawData()
+ return ret
+
+ def GetOffset(self):
+ return 0
+
+ def GetRawData(self):
+ return self._raw.tolist()
+
+class BinaryItem(object):
+ def __init__(self, parent=None):
+ self._size = 0
+ self._arr = array.array('B')
+ self._parent = parent
+
+ @classmethod
+ def Read(cls, fd, parent=None):
+ item = cls(parent)
+ item.fromfile(fd)
+ return item
+
+ def Load(self, fd):
+ self.fromfile(fd)
+
+ def GetSize(self):
+ """should be implemented by inherited class"""
+
+ def fromfile(self, fd):
+ self._arr.fromfile(fd, self.GetSize())
+
+ def GetParent(self):
+ return self._parent
+
+class EfiFirmwareVolumeHeader(BinaryItem):
+ def GetSize(self):
+ return 56
+
+ def GetSigunature(self):
+ list = self._arr.tolist()
+ sig = ''
+ for x in list[40:44]:
+ sig += chr(x)
+ return sig
+
+ def GetAttribute(self):
+ return list2int(self._arr.tolist()[44:48])
+
+ def GetErasePolarity(self):
+ list = self.GetAttrStrings()
+ if 'EFI_FVB2_ERASE_POLARITY' in list:
+ return True
+ return False
+
+ def GetAttrStrings(self):
+ list = []
+ value = self.GetAttribute()
+ if (value & 0x01) != 0:
+ list.append('EFI_FVB2_READ_DISABLED_CAP')
+ if (value & 0x02) != 0:
+ list.append('EFI_FVB2_READ_ENABLED_CAP')
+ if (value & 0x04) != 0:
+ list.append('EFI_FVB2_READ_STATUS')
+ if (value & 0x08) != 0:
+ list.append('EFI_FVB2_WRITE_DISABLED_CAP')
+ if (value & 0x10) != 0:
+ list.append('EFI_FVB2_WRITE_ENABLED_CAP')
+ if (value & 0x20) != 0:
+ list.append('EFI_FVB2_WRITE_STATUS')
+ if (value & 0x40) != 0:
+ list.append('EFI_FVB2_LOCK_CAP')
+ if (value & 0x80) != 0:
+ list.append('EFI_FVB2_LOCK_STATUS')
+ if (value & 0x200) != 0:
+ list.append('EFI_FVB2_STICKY_WRITE')
+ if (value & 0x400) != 0:
+ list.append('EFI_FVB2_MEMORY_MAPPED')
+ if (value & 0x800) != 0:
+ list.append('EFI_FVB2_ERASE_POLARITY')
+ if (value & 0x1000) != 0:
+ list.append('EFI_FVB2_READ_LOCK_CAP')
+ if (value & 0x00002000) != 0:
+ list.append('EFI_FVB2_READ_LOCK_STATUS')
+ if (value & 0x00004000) != 0:
+ list.append('EFI_FVB2_WRITE_LOCK_CAP')
+ if (value & 0x00008000) != 0:
+ list.append('EFI_FVB2_WRITE_LOCK_STATUS')
+
+ if (value == 0):
+ list.append('EFI_FVB2_ALIGNMENT_1')
+ if (value & 0x001F0000) == 0x00010000:
+ list.append('EFI_FVB2_ALIGNMENT_2')
+ if (value & 0x001F0000) == 0x00020000:
+ list.append('EFI_FVB2_ALIGNMENT_4')
+ if (value & 0x001F0000) == 0x00030000:
+ list.append('EFI_FVB2_ALIGNMENT_8')
+ if (value & 0x001F0000) == 0x00040000:
+ list.append('EFI_FVB2_ALIGNMENT_16')
+ if (value & 0x001F0000) == 0x00050000:
+ list.append('EFI_FVB2_ALIGNMENT_32')
+ if (value & 0x001F0000) == 0x00060000:
+ list.append('EFI_FVB2_ALIGNMENT_64')
+ if (value & 0x001F0000) == 0x00070000:
+ list.append('EFI_FVB2_ALIGNMENT_128')
+ if (value & 0x001F0000) == 0x00080000:
+ list.append('EFI_FVB2_ALIGNMENT_256')
+ if (value & 0x001F0000) == 0x00090000:
+ list.append('EFI_FVB2_ALIGNMENT_512')
+ if (value & 0x001F0000) == 0x000A0000:
+ list.append('EFI_FVB2_ALIGNMENT_1K')
+ if (value & 0x001F0000) == 0x000B0000:
+ list.append('EFI_FVB2_ALIGNMENT_2K')
+ if (value & 0x001F0000) == 0x000C0000:
+ list.append('EFI_FVB2_ALIGNMENT_4K')
+ if (value & 0x001F0000) == 0x000D0000:
+ list.append('EFI_FVB2_ALIGNMENT_8K')
+ if (value & 0x001F0000) == 0x000E0000:
+ list.append('EFI_FVB2_ALIGNMENT_16K')
+ if (value & 0x001F0000) == 0x000F0000:
+ list.append('EFI_FVB2_ALIGNMENT_32K')
+ if (value & 0x001F0000) == 0x00100000:
+ list.append('EFI_FVB2_ALIGNMENT_64K')
+ if (value & 0x001F0000) == 0x00110000:
+ list.append('EFI_FVB2_ALIGNMENT_128K')
+ if (value & 0x001F0000) == 0x00120000:
+ list.append('EFI_FVB2_ALIGNMENT_256K')
+ if (value & 0x001F0000) == 0x00130000:
+ list.append('EFI_FVB2_ALIGNMENT_512K')
+
+ return list
+
+ def GetHeaderLength(self):
+ return list2int(self._arr.tolist()[48:50])
+
+ def Dump(self):
+ print('Signature: %s' % self.GetSigunature())
+ print('Attribute: 0x%X' % self.GetAttribute())
+ print('Header Length: 0x%X' % self.GetHeaderLength())
+ print('File system Guid: ', self.GetFileSystemGuid())
+ print('Revision: 0x%X' % self.GetRevision())
+ print('FvLength: 0x%X' % self.GetFvLength())
+
+ def GetFileSystemGuid(self):
+ list = self._arr.tolist()
+ return list2guid(list[16:32])
+
+ def GetRevision(self):
+ list = self._arr.tolist()
+ return int(list[55])
+
+ def GetFvLength(self):
+ list = self._arr.tolist()
+ return list2int(list[32:40])
+
+ def GetRawData(self):
+ return self._arr.tolist()
+
+class BlockMapEntry(BinaryItem):
+ def GetSize(self):
+ return 8
+
+ def GetNumberBlocks(self):
+ list = self._arr.tolist()
+ return list2int(list[0:4])
+
+ def GetLength(self):
+ list = self._arr.tolist()
+ return list2int(list[4:8])
+
+ def GetRawData(self):
+ return self._arr.tolist()
+
+ def __str__(self):
+ return '[BlockEntry] Number = 0x%X, length=0x%X' % (self.GetNumberBlocks(), self.GetLength())
+
+class EfiFfs(object):
+ FFS_HEADER_SIZE = 24
+
+ def __init__(self, parent=None):
+ self._header = None
+
+ # following field is for FFS in FV file.
+ self._parent = parent
+ self._offset = 0
+ self._sections = []
+
+ def Load(self, fd):
+ self._offset = align(fd.tell(), 8)
+
+ self._header = EfiFfsHeader.Read(fd, self)
+
+ if not isValidGuid(self.GetNameGuid()):
+ return
+
+ index = self._offset
+ fileend = self._offset + self.GetSize()
+ while (index + EfiSection.EFI_SECTION_HEADER_SIZE < fileend):
+ section = EfiSection(self)
+ section.Load(fd)
+ if section.GetSize() == 0 and section.GetHeader().GetType() == 0:
+ break
+ self._sections.append(section)
+ index = fd.tell()
+
+ # rebase file pointer to next ffs file
+ index = self._offset + self._header.GetFfsSize()
+ index = align(index, 8)
+ fd.seek(index)
+
+ def GetOffset(self):
+ return self._offset
+
+ def GetSize(self):
+ return self._header.GetFfsSize()
+
+ @classmethod
+ def Read(cls, fd, parent=None):
+ item = cls(parent)
+ item.Load(fd)
+ return item
+
+ def GetNameGuid(self):
+ return self._header.GetNameGuid()
+
+ def DumpContent(self):
+ list = self._content.tolist()
+ line = []
+ count = 0
+ for item in list:
+ if count < 32:
+ line.append('0x%X' % int(item))
+ count += 1
+ else:
+ print(' '.join(line))
+ count = 0
+ line = []
+ line.append('0x%X' % int(item))
+ count += 1
+
+ def GetHeader(self):
+ return self._header
+
+ def GetParent(self):
+ return self._parent
+
+ def GetSections(self):
+ return self._sections
+
+class EfiFfsHeader(BinaryItem):
+ ffs_state_map = {0x01:'EFI_FILE_HEADER_CONSTRUCTION',
+ 0x02:'EFI_FILE_HEADER_VALID',
+ 0x04:'EFI_FILE_DATA_VALID',
+ 0x08:'EFI_FILE_MARKED_FOR_UPDATE',
+ 0x10:'EFI_FILE_DELETED',
+ 0x20:'EFI_FILE_HEADER_INVALID'}
+
+ def GetSize(self):
+ return 24
+
+ def GetNameGuid(self):
+ list = self._arr.tolist()
+ return list2guid(list[0:16])
+
+ def GetType(self):
+ list = self._arr.tolist()
+ return int(list[18])
+
+
+ def GetTypeString(self):
+ value = self.GetType()
+ if value == 0x01:
+ return 'EFI_FV_FILETYPE_RAW'
+ if value == 0x02:
+ return 'EFI_FV_FILETYPE_FREEFORM'
+ if value == 0x03:
+ return 'EFI_FV_FILETYPE_SECURITY_CORE'
+ if value == 0x04:
+ return 'EFI_FV_FILETYPE_PEI_CORE'
+ if value == 0x05:
+ return 'EFI_FV_FILETYPE_DXE_CORE'
+ if value == 0x06:
+ return 'EFI_FV_FILETYPE_PEIM'
+ if value == 0x07:
+ return 'EFI_FV_FILETYPE_DRIVER'
+ if value == 0x08:
+ return 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER'
+ if value == 0x09:
+ return 'EFI_FV_FILETYPE_APPLICATION'
+ if value == 0x0B:
+ return 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE'
+ if value == 0xc0:
+ return 'EFI_FV_FILETYPE_OEM_MIN'
+ if value == 0xdf:
+ return 'EFI_FV_FILETYPE_OEM_MAX'
+ if value == 0xe0:
+ return 'EFI_FV_FILETYPE_DEBUG_MIN'
+ if value == 0xef:
+ return 'EFI_FV_FILETYPE_DEBUG_MAX'
+ if value == 0xf0:
+ return 'EFI_FV_FILETYPE_FFS_PAD'
+ if value == 0xff:
+ return 'EFI_FV_FILETYPE_FFS_MAX'
+ return 'Unknown FFS Type'
+
+ def GetAttributes(self):
+ list = self._arr.tolist()
+ return int(list[19])
+
+ def GetFfsSize(self):
+ list = self._arr.tolist()
+ return list2int(list[20:23])
+
+ def GetState(self):
+ list = self._arr.tolist()
+ state = int(list[23])
+ polarity = self.GetParent().GetParent().GetHeader().GetErasePolarity()
+ if polarity:
+ state = (~state) & 0xFF
+ HighestBit = 0x80
+ while (HighestBit != 0) and (HighestBit & state) == 0:
+ HighestBit = HighestBit >> 1
+ return HighestBit
+
+ def GetStateString(self):
+ state = self.GetState()
+ if state in self.ffs_state_map.keys():
+ return self.ffs_state_map[state]
+ return 'Unknown Ffs State'
+
+ def Dump(self):
+ print("FFS name: ", self.GetNameGuid())
+ print("FFS type: ", self.GetType())
+ print("FFS attr: 0x%X" % self.GetAttributes())
+ print("FFS size: 0x%X" % self.GetFfsSize())
+ print("FFS state: 0x%X" % self.GetState())
+
+ def GetRawData(self):
+ return self._arr.tolist()
+
+
+class EfiSection(object):
+ EFI_SECTION_HEADER_SIZE = 4
+
+ def __init__(self, parent=None):
+ self._size = 0
+ self._parent = parent
+ self._offset = 0
+ self._contents = array.array('B')
+
+ def Load(self, fd):
+ self._offset = align(fd.tell(), 4)
+
+ self._header = EfiSectionHeader.Read(fd, self)
+
+ if self._header.GetTypeString() == "EFI_SECTION_PE32":
+ pefile = pe.PEFile(self)
+ pefile.Load(fd, self.GetContentSize())
+
+ fd.seek(self._offset)
+ self._contents.fromfile(fd, self.GetContentSize())
+
+ # rebase file pointer to next section
+ index = self._offset + self.GetSize()
+ index = align(index, 4)
+ fd.seek(index)
+
+ def GetContentSize(self):
+ return self.GetSize() - self.EFI_SECTION_HEADER_SIZE
+
+ def GetContent(self):
+ return self._contents.tolist()
+
+ def GetSize(self):
+ return self._header.GetSectionSize()
+
+ def GetHeader(self):
+ return self._header
+
+ def GetSectionOffset(self):
+ return self._offset + self.EFI_SECTION_HEADER_SIZE
+
+class EfiSectionHeader(BinaryItem):
+ section_type_map = {0x01: 'EFI_SECTION_COMPRESSION',
+ 0x02: 'EFI_SECTION_GUID_DEFINED',
+ 0x10: 'EFI_SECTION_PE32',
+ 0x11: 'EFI_SECTION_PIC',
+ 0x12: 'EFI_SECTION_TE',
+ 0x13: 'EFI_SECTION_DXE_DEPEX',
+ 0x14: 'EFI_SECTION_VERSION',
+ 0x15: 'EFI_SECTION_USER_INTERFACE',
+ 0x16: 'EFI_SECTION_COMPATIBILITY16',
+ 0x17: 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE',
+ 0x18: 'EFI_SECTION_FREEFORM_SUBTYPE_GUID',
+ 0x19: 'EFI_SECTION_RAW',
+ 0x1B: 'EFI_SECTION_PEI_DEPEX'}
+ def GetSize(self):
+ return 4
+
+ def GetSectionSize(self):
+ list = self._arr.tolist()
+ return list2int(list[0:3])
+
+ def GetType(self):
+ list = self._arr.tolist()
+ return int(list[3])
+
+ def GetTypeString(self):
+ type = self.GetType()
+ if type not in self.section_type_map.keys():
+ return 'Unknown Section Type'
+ return self.section_type_map[type]
+
+ def Dump(self):
+ print('size = 0x%X' % self.GetSectionSize())
+ print('type = 0x%X' % self.GetType())
+
+
+
+rMapEntry = re.compile('^(\w+)[ \(\w\)]* \(BaseAddress=([0-9a-fA-F]+), EntryPoint=([0-9a-fA-F]+), GUID=([0-9a-fA-F\-]+)')
+class EfiFvMapFile(object):
+ def __init__(self):
+ self._mapentries = {}
+
+ def Load(self, path):
+ if not os.path.exists(path):
+ return False
+
+ try:
+ file = open(path, 'r')
+ lines = file.readlines()
+ file.close()
+ except:
+ return False
+
+ for line in lines:
+ if line[0] != ' ':
+ # new entry
+ ret = rMapEntry.match(line)
+ if ret is not None:
+ name = ret.groups()[0]
+ baseaddr = int(ret.groups()[1], 16)
+ entry = int(ret.groups()[2], 16)
+ guidstr = '{' + ret.groups()[3] + '}'
+ guid = uuid.UUID(guidstr)
+ self._mapentries[guid] = EfiFvMapFileEntry(name, baseaddr, entry, guid)
+ return True
+
+ def GetEntry(self, guid):
+ if guid in self._mapentries.keys():
+ return self._mapentries[guid]
+ return None
+
+class EfiFvMapFileEntry(object):
+ def __init__(self, name, baseaddr, entry, guid):
+ self._name = name
+ self._baseaddr = baseaddr
+ self._entry = entry
+ self._guid = guid
+
+ def GetName(self):
+ return self._name
+
+ def GetBaseAddress(self):
+ return self._baseaddr
+
+ def GetEntryPoint(self):
+ return self._entry
+
+def list2guid(list):
+ val1 = list2int(list[0:4])
+ val2 = list2int(list[4:6])
+ val3 = list2int(list[6:8])
+ val4 = 0
+ for item in list[8:16]:
+ val4 = (val4 << 8) | int(item)
+
+ val = val1 << 12 * 8 | val2 << 10 * 8 | val3 << 8 * 8 | val4
+ guid = uuid.UUID(int=val)
+ return guid
+
+def list2int(list):
+ val = 0
+ for index in range(len(list) - 1, -1, -1):
+ val = (val << 8) | int(list[index])
+ return val
+
+def align(value, alignment):
+ return (value + ((alignment - value) & (alignment - 1)))
+
+gInvalidGuid = uuid.UUID(int=0xffffffffffffffffffffffffffffffff)
+def isValidGuid(guid):
+ if guid == gInvalidGuid:
+ return False
+ return True
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py
new file mode 100644
index 000000000..7facb9aa2
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py
@@ -0,0 +1,475 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import absolute_import
+from .message import *
+import re
+import os
+
+section_re = re.compile(r'^\[([\w., "]+)\]')
+
+class BaseINIFile(object):
+ _objs = {}
+ def __new__(cls, *args, **kwargs):
+ """Maintain only a single instance of this object
+ @return: instance of this class
+
+ """
+ if len(args) == 0: return object.__new__(cls)
+ filename = args[0]
+ parent = None
+ if len(args) > 1:
+ parent = args[1]
+
+ key = os.path.normpath(filename)
+ if key not in cls._objs.keys():
+ cls._objs[key] = object.__new__(cls)
+
+ if parent is not None:
+ cls._objs[key].AddParent(parent)
+
+ return cls._objs[key]
+
+ def __init__(self, filename=None, parent=None):
+ self._lines = []
+ self._sections = {}
+ self._filename = filename
+ self._globals = []
+ self._isModify = True
+
+ def AddParent(self, parent):
+ if parent is None: return
+ if not hasattr(self, "_parents"):
+ self._parents = []
+
+ if parent in self._parents:
+ ErrorMsg("Duplicate parent is found for INI file %s" % self._filename)
+ return
+ self._parents.append(parent)
+
+ def GetFilename(self):
+ return os.path.normpath(self._filename)
+
+ def IsModified(self):
+ return self._isModify
+
+ def Modify(self, modify=True, obj=None):
+ if modify == self._isModify: return
+ self._isModify = modify
+ if modify:
+ for parent in self._parents:
+ parent.Modify(True, self)
+
+ def _ReadLines(self, filename):
+ #
+ # try to open file
+ #
+ if not os.path.exists(filename):
+ return False
+
+ try:
+ handle = open(filename, 'r')
+ self._lines = handle.readlines()
+ handle.close()
+ except:
+ raise EdkException("Fail to open file %s" % filename)
+
+ return True
+
+ def GetSectionInstance(self, parent, name, isCombined=False):
+ return BaseINISection(parent, name, isCombined)
+
+ def GetSectionByName(self, name):
+ arr = []
+ for key in self._sections.keys():
+ if '.private' in key:
+ continue
+ for item in self._sections[key]:
+ if item.GetBaseName().lower().find(name.lower()) != -1:
+ arr.append(item)
+ return arr
+
+ def GetSectionObjectsByName(self, name):
+ arr = []
+ sects = self.GetSectionByName(name)
+ for sect in sects:
+ for obj in sect.GetObjects():
+ arr.append(obj)
+ return arr
+
+ def Parse(self):
+ if not self._isModify: return True
+ if not self._ReadLines(self._filename): return False
+
+ sObjs = []
+ inGlobal = True
+ # process line
+ for index in range(len(self._lines)):
+ templine = self._lines[index].strip()
+ # skip comments
+ if len(templine) == 0: continue
+ if re.match("^\[=*\]", templine) or re.match("^#", templine) or \
+ re.match("\*+/", templine):
+ continue
+
+ m = section_re.match(templine)
+ if m is not None: # found a section
+ inGlobal = False
+ # Finish the latest section first
+ if len(sObjs) != 0:
+ for sObj in sObjs:
+ sObj._end = index - 1
+ if not sObj.Parse():
+ ErrorMsg("Fail to parse section %s" % sObj.GetBaseName(),
+ self._filename,
+ sObj._start)
+
+ # start new section
+ sname_arr = m.groups()[0].split(',')
+ sObjs = []
+ for name in sname_arr:
+ sObj = self.GetSectionInstance(self, name, (len(sname_arr) > 1))
+ sObj._start = index
+ sObjs.append(sObj)
+ if name.lower() not in self._sections:
+ self._sections[name.lower()] = [sObj]
+ else:
+ self._sections[name.lower()].append(sObj)
+ elif inGlobal: # not start any section and find global object
+ gObj = BaseINIGlobalObject(self)
+ gObj._start = index
+ gObj.Parse()
+ self._globals.append(gObj)
+
+ # Finish the last section
+ if len(sObjs) != 0:
+ for sObj in sObjs:
+ sObj._end = index
+ if not sObj.Parse():
+ ErrorMsg("Fail to parse section %s" % sObj.GetBaseName(),
+ self._filename,
+ sObj._start)
+
+ self._isModify = False
+ return True
+
+ def Destroy(self, parent):
+
+ # check referenced parent
+ if parent is not None:
+ assert parent in self._parents, "when destory ini object, can not found parent reference!"
+ self._parents.remove(parent)
+
+ if len(self._parents) != 0: return
+
+ for sects in self._sections.values():
+ for sect in sects:
+ sect.Destroy()
+
+ # dereference from _objs array
+ assert self.GetFilename() in self._objs.keys(), "When destroy ini object, can not find obj reference!"
+ assert self in self._objs.values(), "When destroy ini object, can not find obj reference!"
+ del self._objs[self.GetFilename()]
+
+ # dereference self
+ self.Clear()
+
+ def GetDefine(self, name):
+ sects = self.GetSectionByName('Defines')
+ for sect in sects:
+ for obj in sect.GetObjects():
+ line = obj.GetLineByOffset(obj._start).split('#')[0].strip()
+ arr = line.split('=')
+ if arr[0].strip().lower() == name.strip().lower():
+ return arr[1].strip()
+ return None
+
+ def Clear(self):
+ for sects in self._sections.values():
+ for sect in sects:
+ del sect
+ self._sections.clear()
+ for gObj in self._globals:
+ del gObj
+
+ del self._globals[:]
+ del self._lines[:]
+
+ def Reload(self):
+ self.Clear()
+ ret = self.Parse()
+ if ret:
+ self._isModify = False
+ return ret
+
+ def AddNewSection(self, sectName):
+ if sectName.lower() in self._sections.keys():
+ ErrorMsg('Section %s can not be created for conflict with existing section')
+ return None
+
+ sectionObj = self.GetSectionInstance(self, sectName)
+ sectionObj._start = len(self._lines)
+ sectionObj._end = len(self._lines) + 1
+ self._lines.append('[%s]\n' % sectName)
+ self._lines.append('\n\n')
+ self._sections[sectName.lower()] = sectionObj
+ return sectionObj
+
+ def CopySectionsByName(self, oldDscObj, nameStr):
+ sects = oldDscObj.GetSectionByName(nameStr)
+ for sect in sects:
+ sectObj = self.AddNewSection(sect.GetName())
+ sectObj.Copy(sect)
+
+ def __str__(self):
+ return ''.join(self._lines)
+
+ ## Get file header's comment from basic INI file.
+ # The file comments has two style:
+ # 1) #/** @file
+ # 2) ## @file
+ #
+ def GetFileHeader(self):
+ desc = []
+ lineArr = self._lines
+ inHeader = False
+ for num in range(len(self._lines)):
+ line = lineArr[num].strip()
+ if not inHeader and (line.startswith("#/**") or line.startswith("##")) and \
+ line.find("@file") != -1:
+ inHeader = True
+ continue
+ if inHeader and (line.startswith("#**/") or line.startswith('##')):
+ inHeader = False
+ break
+ if inHeader:
+ prefixIndex = line.find('#')
+ if prefixIndex == -1:
+ desc.append(line)
+ else:
+ desc.append(line[prefixIndex + 1:])
+ return '<br>\n'.join(desc)
+
+class BaseINISection(object):
+ def __init__(self, parent, name, isCombined=False):
+ self._parent = parent
+ self._name = name
+ self._isCombined = isCombined
+ self._start = 0
+ self._end = 0
+ self._objs = []
+
+ def __del__(self):
+ for obj in self._objs:
+ del obj
+ del self._objs[:]
+
+ def GetName(self):
+ return self._name
+
+ def GetObjects(self):
+ return self._objs
+
+ def GetParent(self):
+ return self._parent
+
+ def GetStartLinenumber(self):
+ return self._start
+
+ def GetEndLinenumber(self):
+ return self._end
+
+ def GetLine(self, linenumber):
+ return self._parent._lines[linenumber]
+
+ def GetFilename(self):
+ return self._parent.GetFilename()
+
+ def GetSectionINIObject(self, parent):
+ return BaseINISectionObject(parent)
+
+ def Parse(self):
+ # skip first line in section, it is used by section name
+ visit = self._start + 1
+ iniObj = None
+ while (visit <= self._end):
+ line = self.GetLine(visit).strip()
+ if re.match("^\[=*\]", line) or re.match("^#", line) or len(line) == 0:
+ visit += 1
+ continue
+ line = line.split('#')[0].strip()
+ if iniObj is not None:
+ if line.endswith('}'):
+ iniObj._end = visit - self._start
+ if not iniObj.Parse():
+ ErrorMsg("Fail to parse ini object",
+ self.GetFilename(),
+ iniObj.GetStartLinenumber())
+ else:
+ self._objs.append(iniObj)
+ iniObj = None
+ else:
+ iniObj = self.GetSectionINIObject(self)
+ iniObj._start = visit - self._start
+ if not line.endswith('{'):
+ iniObj._end = visit - self._start
+ if not iniObj.Parse():
+ ErrorMsg("Fail to parse ini object",
+ self.GetFilename(),
+ iniObj.GetStartLinenumber())
+ else:
+ self._objs.append(iniObj)
+ iniObj = None
+ visit += 1
+ return True
+
+ def Destroy(self):
+ for obj in self._objs:
+ obj.Destroy()
+
+ def GetBaseName(self):
+ return self._name
+
+ def AddLine(self, line):
+ end = self.GetEndLinenumber()
+ self._parent._lines.insert(end, line)
+ self._end += 1
+
+ def Copy(self, sectObj):
+ index = sectObj.GetStartLinenumber() + 1
+ while index < sectObj.GetEndLinenumber():
+ line = sectObj.GetLine(index)
+ if not line.strip().startswith('#'):
+ self.AddLine(line)
+ index += 1
+
+ def AddObject(self, obj):
+ lines = obj.GenerateLines()
+ for line in lines:
+ self.AddLine(line)
+
+ def GetComment(self):
+ comments = []
+ start = self._start - 1
+ bFound = False
+
+ while (start > 0):
+ line = self.GetLine(start).strip()
+ if len(line) == 0:
+ start -= 1
+ continue
+ if line.startswith('##'):
+ bFound = True
+ index = line.rfind('#')
+ if (index + 1) < len(line):
+ comments.append(line[index + 1:])
+ break
+ if line.startswith('#'):
+ start -= 1
+ continue
+ break
+ if bFound:
+ end = start + 1
+ while (end < self._start):
+ line = self.GetLine(end).strip()
+ if len(line) == 0: break
+ if not line.startswith('#'): break
+ index = line.rfind('#')
+ if (index + 1) < len(line):
+ comments.append(line[index + 1:])
+ end += 1
+ return comments
+
+class BaseINIGlobalObject(object):
+ def __init__(self, parent):
+ self._start = 0
+ self._end = 0
+
+ def Parse(self):
+ return True
+
+ def __str__(self):
+ return parent._lines[self._start]
+
+ def __del__(self):
+ pass
+
+class BaseINISectionObject(object):
+ def __init__(self, parent):
+ self._start = 0
+ self._end = 0
+ self._parent = parent
+
+ def __del__(self):
+ self._parent = None
+
+ def GetParent(self):
+ return self._parent
+
+ def GetFilename(self):
+ return self.GetParent().GetFilename()
+
+ def GetPackageName(self):
+ return self.GetFilename()
+
+ def GetFileObj(self):
+ return self.GetParent().GetParent()
+
+ def GetStartLinenumber(self):
+ return self.GetParent()._start + self._start
+
+ def GetLineByOffset(self, offset):
+ sect_start = self._parent.GetStartLinenumber()
+ linenumber = sect_start + offset
+ return self._parent.GetLine(linenumber)
+
+ def GetLinenumberByOffset(self, offset):
+ return offset + self._parent.GetStartLinenumber()
+
+ def Parse(self):
+ return True
+
+ def Destroy(self):
+ pass
+
+ def __str__(self):
+ return self.GetLineByOffset(self._start).strip()
+
+ def GenerateLines(self):
+ return ['default setion object string\n']
+
+ def GetComment(self):
+ comments = []
+ start = self.GetStartLinenumber() - 1
+ bFound = False
+
+ while (start > 0):
+ line = self.GetParent().GetLine(start).strip()
+ if len(line) == 0:
+ start -= 1
+ continue
+ if line.startswith('##'):
+ bFound = True
+ index = line.rfind('#')
+ if (index + 1) < len(line):
+ comments.append(line[index + 1:])
+ break
+ if line.startswith('#'):
+ start -= 1
+ continue
+ break
+ if bFound:
+ end = start + 1
+ while (end <= self.GetStartLinenumber() - 1):
+ line = self.GetParent().GetLine(end).strip()
+ if len(line) == 0: break
+ if not line.startswith('#'): break
+ index = line.rfind('#')
+ if (index + 1) < len(line):
+ comments.append(line[index + 1:])
+ end += 1
+ return comments
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/inidocview.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/inidocview.py
new file mode 100644
index 000000000..849d0fc91
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/inidocview.py
@@ -0,0 +1,17 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+import core.editor
+
+class INIDoc(core.editor.EditorDocument):
+ def __init__(self):
+ core.editor.EditorDocument.__init__(self)
+ self._iniobj = None
+
+
+class INIView(core.editor.EditorView):
+ pass
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/message.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/message.py
new file mode 100644
index 000000000..882538a17
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/message.py
@@ -0,0 +1,46 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+def GetEdkLogger():
+ import logging
+ return logging.getLogger('edk')
+
+class EdkException(Exception):
+ def __init__(self, message, fName=None, fNo=None):
+ self._message = message
+ ErrorMsg(message, fName, fNo)
+
+ def GetMessage(self):
+ return '[EDK Failure]: %s' %self._message
+
+def ErrorMsg(mess, fName=None, fNo=None):
+ GetEdkLogger().error(NormalMessage('#ERR#', mess, fName, fNo))
+
+def LogMsg(mess, fName=None, fNo=None):
+ GetEdkLogger().info(NormalMessage('@LOG@', mess, fName, fNo))
+
+def WarnMsg(mess, fName=None, fNo=None):
+ GetEdkLogger().warning(NormalMessage('!WAR!', mess, fName, fNo))
+
+def NormalMessage(type, mess, fName=None, fNo=None):
+ strMsg = type
+
+ if fName is not None:
+ strMsg += ' %s' % fName.replace('/', '\\')
+ if fNo is not None:
+ strMsg += '(%d):' % fNo
+ else:
+ strMsg += ' :'
+
+ if fName is None and fNo is None:
+ strMsg += ' '
+ strMsg += mess
+
+ return strMsg
+
+
+
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/__init__.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/__init__.py
new file mode 100644
index 000000000..57dfebde5
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/__init__.py
@@ -0,0 +1,6 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/__init__.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/__init__.py
new file mode 100644
index 000000000..57dfebde5
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/__init__.py
@@ -0,0 +1,6 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
new file mode 100644
index 000000000..ee00529f4
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
@@ -0,0 +1,928 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+from plugins.EdkPlugins.basemodel import ini
+from plugins.EdkPlugins.edk2.model import dsc
+from plugins.EdkPlugins.edk2.model import inf
+from plugins.EdkPlugins.edk2.model import dec
+import os
+from plugins.EdkPlugins.basemodel.message import *
+
+class SurfaceObject(object):
+ _objs = {}
+
+ def __new__(cls, *args, **kwargs):
+ """Maintain only a single instance of this object
+ @return: instance of this class
+
+ """
+ obj = object.__new__(cls)
+ if "None" not in cls._objs:
+ cls._objs["None"] = []
+ cls._objs["None"].append(obj)
+
+ return obj
+
+ def __init__(self, parent, workspace):
+ self._parent = parent
+ self._fileObj = None
+ self._workspace = workspace
+ self._isModify = False
+ self._modifiedObjs = []
+
+ def __del__(self):
+ pass
+
+ def Destroy(self):
+ key = self.GetRelativeFilename()
+ self.GetFileObj().Destroy(self)
+ del self._fileObj
+ # dereference self from _objs arrary
+ assert key in self._objs, "when destory, object is not in obj list"
+ assert self in self._objs[key], "when destory, object is not in obj list"
+ self._objs[key].remove(self)
+ if len(self._objs[key]) == 0:
+ del self._objs[key]
+
+ def GetParent(self):
+ return self._parent
+
+ def GetWorkspace(self):
+ return self._workspace
+
+ def GetFileObjectClass(self):
+ return ini.BaseINIFile
+
+ def GetFilename(self):
+ return self.GetFileObj().GetFilename()
+
+ def GetFileObj(self):
+ return self._fileObj
+
+ def GetRelativeFilename(self):
+ fullPath = self.GetFilename()
+ return fullPath[len(self._workspace) + 1:]
+
+ def Load(self, relativePath):
+ # if has been loaded, directly return
+ if self._fileObj is not None: return True
+
+ relativePath = os.path.normpath(relativePath)
+ fullPath = os.path.join(self._workspace, relativePath)
+ fullPath = os.path.normpath(fullPath)
+
+ if not os.path.exists(fullPath):
+ ErrorMsg("file does not exist!", fullPath)
+ return False
+
+ self._fileObj = self.GetFileObjectClass()(fullPath, self)
+
+ if not self._fileObj.Parse():
+ ErrorMsg("Fail to parse file!", fullPath)
+ return False
+
+ # remove self from None list to list with filename as key
+ cls = self.__class__
+ if self not in cls._objs["None"]:
+ ErrorMsg("Sufrace object does not be create into None list")
+ cls._objs["None"].remove(self)
+ if relativePath not in cls._objs:
+ cls._objs[relativePath] = []
+ cls._objs[relativePath].append(self)
+
+ return True
+
+ def Reload(self, force=False):
+ ret = True
+ # whether require must be update
+ if force:
+ ret = self.GetFileObj().Reload(True)
+ else:
+ if self.IsModified():
+ if self.GetFileObj().IsModified():
+ ret = self.GetFileObj().Reload()
+ return ret
+
+ def Modify(self, modify=True, modifiedObj=None):
+ if modify:
+ #LogMsg("%s is modified, modified object is %s" % (self.GetFilename(), modifiedObj))
+ if issubclass(modifiedObj.__class__, ini.BaseINIFile) and self._isModify:
+ return
+ self._isModify = modify
+ self.GetParent().Modify(modify, self)
+ else:
+ self._isModify = modify
+
+ def IsModified(self):
+ return self._isModify
+
+ def GetModifiedObjs(self):
+ return self._modifiedObjs
+
+ def FilterObjsByArch(self, objs, arch):
+ arr = []
+ for obj in objs:
+ if obj.GetArch().lower() == 'common':
+ arr.append(obj)
+ continue
+ if obj.GetArch().lower() == arch.lower():
+ arr.append(obj)
+ continue
+ return arr
+
+class Platform(SurfaceObject):
+ def __init__(self, parent, workspace):
+ SurfaceObject.__init__(self, parent, workspace)
+ self._modules = []
+ self._packages = []
+
+ def Destroy(self):
+ for module in self._modules:
+ module.Destroy()
+ del self._modules[:]
+
+ del self._packages[:]
+ SurfaceObject.Destroy(self)
+
+ def GetName(self):
+ return self.GetFileObj().GetDefine("PLATFORM_NAME")
+
+ def GetFileObjectClass(self):
+ return dsc.DSCFile
+
+ def GetModuleCount(self):
+ if self.GetFileObj() is None:
+ ErrorMsg("Fail to get module count because DSC file has not been load!")
+
+ return len(self.GetFileObj().GetComponents())
+
+ def GetSupportArchs(self):
+ return self.GetFileObj().GetDefine("SUPPORTED_ARCHITECTURES").strip().split('#')[0].split('|')
+
+ def LoadModules(self, precallback=None, postcallback=None):
+ for obj in self.GetFileObj().GetComponents():
+ mFilename = obj.GetFilename()
+ if precallback is not None:
+ precallback(self, mFilename)
+ arch = obj.GetArch()
+ if arch.lower() == 'common':
+ archarr = self.GetSupportArchs()
+ else:
+ archarr = [arch]
+ for arch in archarr:
+ module = Module(self, self.GetWorkspace())
+ if module.Load(mFilename, arch, obj.GetOveridePcds(), obj.GetOverideLibs()):
+ self._modules.append(module)
+ if postcallback is not None:
+ postcallback(self, module)
+ else:
+ del module
+ ErrorMsg("Fail to load module %s" % mFilename)
+
+ def GetModules(self):
+ return self._modules
+
+ def GetLibraryPath(self, classname, arch, type):
+ objs = self.GetFileObj().GetSectionObjectsByName("libraryclasses")
+
+ for obj in objs:
+ if classname.lower() != obj.GetClass().lower():
+ continue
+ if obj.GetArch().lower() != 'common' and \
+ obj.GetArch().lower() != arch.lower():
+ continue
+
+ if obj.GetModuleType().lower() != 'common' and \
+ obj.GetModuleType().lower() != type.lower():
+ continue
+
+ return obj.GetInstance()
+
+ ErrorMsg("Fail to get library class %s [%s][%s] from platform %s" % (classname, arch, type, self.GetFilename()))
+ return None
+
+ def GetPackage(self, path):
+ package = self.GetParent().GetPackage(path)
+ if package not in self._packages:
+ self._packages.append(package)
+ return package
+
+ def GetPcdBuildObjs(self, name, arch=None):
+ arr = []
+ objs = self.GetFileObj().GetSectionObjectsByName('pcds')
+ for obj in objs:
+ if obj.GetPcdName().lower() == name.lower():
+ arr.append(obj)
+ if arch is not None:
+ arr = self.FilterObjsByArch(arr, arch)
+ return arr
+
+ def Reload(self, callback=None):
+ # do not care force paramter for platform object
+ isFileChanged = self.GetFileObj().IsModified()
+ ret = SurfaceObject.Reload(self, False)
+ if not ret: return False
+ if isFileChanged:
+ # destroy all modules and reload them again
+ for obj in self._modules:
+ obj.Destroy()
+ del self._modules[:]
+ del self._packages[:]
+ self.LoadModules(callback)
+ else:
+ for obj in self._modules:
+ callback(self, obj.GetFilename())
+ obj.Reload()
+
+ self.Modify(False)
+ return True
+
+ def Modify(self, modify=True, modifiedObj=None):
+ if modify:
+ #LogMsg("%s is modified, modified object is %s" % (self.GetFilename(), modifiedObj))
+ if issubclass(modifiedObj.__class__, ini.BaseINIFile) and self._isModify:
+ return
+ self._isModify = modify
+ self.GetParent().Modify(modify, self)
+ else:
+ if self.GetFileObj().IsModified():
+ return
+ for obj in self._modules:
+ if obj.IsModified():
+ return
+
+ self._isModify = modify
+ self.GetParent().Modify(modify, self)
+
+ def GetModuleObject(self, relativePath, arch):
+ path = os.path.normpath(relativePath)
+ for obj in self._modules:
+ if obj.GetRelativeFilename() == path:
+ if arch.lower() == 'common':
+ return obj
+ if obj.GetArch() == arch:
+ return obj
+ return None
+
+ def GenerateFullReferenceDsc(self):
+ oldDsc = self.GetFileObj()
+ newDsc = dsc.DSCFile()
+ newDsc.CopySectionsByName(oldDsc, 'defines')
+ newDsc.CopySectionsByName(oldDsc, 'SkuIds')
+
+ #
+ # Dynamic common section should also be copied
+ #
+ newDsc.CopySectionsByName(oldDsc, 'PcdsDynamicDefault')
+ newDsc.CopySectionsByName(oldDsc, 'PcdsDynamicHii')
+ newDsc.CopySectionsByName(oldDsc, 'PcdsDynamicVpd')
+ newDsc.CopySectionsByName(oldDsc, 'PcdsDynamicEx')
+
+ sects = oldDsc.GetSectionByName('Components')
+ for oldSect in sects:
+ newSect = newDsc.AddNewSection(oldSect.GetName())
+ for oldComObj in oldSect.GetObjects():
+ module = self.GetModuleObject(oldComObj.GetFilename(), oldSect.GetArch())
+ if module is None: continue
+
+ newComObj = dsc.DSCComponentObject(newSect)
+ newComObj.SetFilename(oldComObj.GetFilename())
+
+ # add all library instance for override section
+ libdict = module.GetLibraries()
+ for libclass in libdict.keys():
+ if libdict[libclass] is not None:
+ newComObj.AddOverideLib(libclass, libdict[libclass].GetRelativeFilename().replace('\\', '/'))
+
+ # add all pcds for override section
+ pcddict = module.GetPcds()
+ for pcd in pcddict.values():
+ buildPcd = pcd.GetBuildObj()
+ buildType = buildPcd.GetPcdType()
+ buildValue = None
+ if buildType.lower() == 'pcdsdynamichii' or \
+ buildType.lower() == 'pcdsdynamicvpd' or \
+ buildType.lower() == 'pcdsdynamicdefault':
+ buildType = 'PcdsDynamic'
+ if buildType != 'PcdsDynamic':
+ buildValue = buildPcd.GetPcdValue()
+ newComObj.AddOveridePcd(buildPcd.GetPcdName(),
+ buildType,
+ buildValue)
+ newSect.AddObject(newComObj)
+ return newDsc
+
+class Module(SurfaceObject):
+ def __init__(self, parent, workspace):
+ SurfaceObject.__init__(self, parent, workspace)
+ self._arch = 'common'
+ self._parent = parent
+ self._overidePcds = {}
+ self._overideLibs = {}
+ self._libs = {}
+ self._pcds = {}
+ self._ppis = []
+ self._protocols = []
+ self._depexs = []
+ self._guids = []
+ self._packages = []
+
+ def Destroy(self):
+ for lib in self._libs.values():
+ if lib is not None:
+ lib.Destroy()
+ self._libs.clear()
+
+ for pcd in self._pcds.values():
+ pcd.Destroy()
+ self._pcds.clear()
+
+ for ppi in self._ppis:
+ ppi.DeRef(self)
+ del self._ppis[:]
+
+ for protocol in self._protocols:
+ if protocol is not None:
+ protocol.DeRef(self)
+ del self._protocols[:]
+
+ for guid in self._guids:
+ if guid is not None:
+ guid.DeRef(self)
+ del self._guids[:]
+
+ del self._packages[:]
+ del self._depexs[:]
+ SurfaceObject.Destroy(self)
+
+ def GetFileObjectClass(self):
+ return inf.INFFile
+
+ def GetLibraries(self):
+ return self._libs
+
+ def Load(self, filename, arch='common', overidePcds=None, overideLibs=None):
+ if not SurfaceObject.Load(self, filename):
+ return False
+
+ self._arch = arch
+ if overidePcds is not None:
+ self._overideLibs = overideLibs
+ if overideLibs is not None:
+ self._overidePcds = overidePcds
+
+ self._SearchLibraries()
+ self._SearchPackage()
+ self._SearchSurfaceItems()
+ return True
+
+ def GetArch(self):
+ return self._arch
+
+ def GetModuleName(self):
+ return self.GetFileObj().GetDefine("BASE_NAME")
+
+ def GetModuleType(self):
+ return self.GetFileObj().GetDefine("MODULE_TYPE")
+
+ def GetPlatform(self):
+ return self.GetParent()
+
+ def GetModuleObj(self):
+ return self
+
+ def GetPcds(self):
+ pcds = self._pcds.copy()
+ for lib in self._libs.values():
+ if lib is None: continue
+ for name in lib._pcds.keys():
+ pcds[name] = lib._pcds[name]
+ return pcds
+
+ def GetPpis(self):
+ ppis = []
+ ppis += self._ppis
+ for lib in self._libs.values():
+ if lib is None: continue
+ ppis += lib._ppis
+ return ppis
+
+ def GetProtocols(self):
+ pros = []
+ pros = self._protocols
+ for lib in self._libs.values():
+ if lib is None: continue
+ pros += lib._protocols
+ return pros
+
+ def GetGuids(self):
+ guids = []
+ guids += self._guids
+ for lib in self._libs.values():
+ if lib is None: continue
+ guids += lib._guids
+ return guids
+
+ def GetDepexs(self):
+ deps = []
+ deps += self._depexs
+ for lib in self._libs.values():
+ if lib is None: continue
+ deps += lib._depexs
+ return deps
+
+ def IsLibrary(self):
+ return self.GetFileObj().GetDefine("LIBRARY_CLASS") is not None
+
+ def GetLibraryInstance(self, classname, arch, type):
+ if classname not in self._libs.keys():
+ # find in overide lib firstly
+ if classname in self._overideLibs.keys():
+ self._libs[classname] = Library(self, self.GetWorkspace())
+ self._libs[classname].Load(self._overideLibs[classname])
+ return self._libs[classname]
+
+ parent = self.GetParent()
+ if issubclass(parent.__class__, Platform):
+ path = parent.GetLibraryPath(classname, arch, type)
+ if path is None:
+ ErrorMsg('Fail to get library instance for %s' % classname, self.GetFilename())
+ return None
+ self._libs[classname] = Library(self, self.GetWorkspace())
+ if not self._libs[classname].Load(path, self.GetArch()):
+ self._libs[classname] = None
+ else:
+ self._libs[classname] = parent.GetLibraryInstance(classname, arch, type)
+ return self._libs[classname]
+
+ def GetSourceObjs(self):
+ return self.GetFileObj().GetSectionObjectsByName('source')
+
+ def _SearchLibraries(self):
+ objs = self.GetFileObj().GetSectionObjectsByName('libraryclasses')
+ arch = self.GetArch()
+ type = self.GetModuleType()
+ for obj in objs:
+ if obj.GetArch().lower() != 'common' and \
+ obj.GetArch().lower() not in self.GetPlatform().GetSupportArchs():
+ continue
+ classname = obj.GetClass()
+ instance = self.GetLibraryInstance(classname, arch, type)
+ if not self.IsLibrary() and instance is not None:
+ instance._isInherit = False
+
+ if classname not in self._libs.keys():
+ self._libs[classname] = instance
+
+ def _SearchSurfaceItems(self):
+ # get surface item from self's inf
+ pcds = []
+ ppis = []
+ pros = []
+ deps = []
+ guids = []
+ if self.GetFileObj() is not None:
+ pcds = self.FilterObjsByArch(self.GetFileObj().GetSectionObjectsByName('pcd'),
+ self.GetArch())
+ for pcd in pcds:
+ if pcd.GetPcdName() not in self._pcds.keys():
+ pcdItem = PcdItem(pcd.GetPcdName(), self, pcd)
+ self._pcds[pcd.GetPcdName()] = ModulePcd(self,
+ pcd.GetPcdName(),
+ pcd,
+ pcdItem)
+
+ ppis += self.FilterObjsByArch(self.GetFileObj().GetSectionObjectsByName('ppis'),
+ self.GetArch())
+
+ for ppi in ppis:
+ item = PpiItem(ppi.GetName(), self, ppi)
+ if item not in self._ppis:
+ self._ppis.append(item)
+
+ pros += self.FilterObjsByArch(self.GetFileObj().GetSectionObjectsByName('protocols'),
+ self.GetArch())
+
+ for pro in pros:
+ item = ProtocolItem(pro.GetName(), self, pro)
+ if item not in self._protocols:
+ self._protocols.append(item)
+
+ deps += self.FilterObjsByArch(self.GetFileObj().GetSectionObjectsByName('depex'),
+ self.GetArch())
+ for dep in deps:
+ item = DepexItem(self, dep)
+ self._depexs.append(item)
+
+ guids += self.FilterObjsByArch(self.GetFileObj().GetSectionObjectsByName('guids'),
+ self.GetArch())
+ for guid in guids:
+ item = GuidItem(guid.GetName(), self, guid)
+ if item not in self._guids:
+ self._guids.append(item)
+
+ def _SearchPackage(self):
+ objs = self.GetFileObj().GetSectionObjectsByName('packages')
+ for obj in objs:
+ package = self.GetPlatform().GetPackage(obj.GetPath())
+ if package is not None:
+ self._packages.append(package)
+
+ def GetPackages(self):
+ return self._packages
+
+ def GetPcdObjects(self):
+ if self.GetFileObj() is None:
+ return []
+
+ return self.GetFileObj().GetSectionObjectsByName('pcd')
+
+ def GetLibraryClassHeaderFilePath(self):
+ lcname = self.GetFileObj().GetProduceLibraryClass()
+ if lcname is None: return None
+
+ pkgs = self.GetPackages()
+ for package in pkgs:
+ path = package.GetLibraryClassHeaderPathByName(lcname)
+ if path is not None:
+ return os.path.realpath(os.path.join(package.GetFileObj().GetPackageRootPath(), path))
+ return None
+
+ def Reload(self, force=False, callback=None):
+ if callback is not None:
+ callback(self, "Starting reload...")
+
+ ret = SurfaceObject.Reload(self, force)
+ if not ret: return False
+
+ if not force and not self.IsModified():
+ return True
+
+ for lib in self._libs.values():
+ if lib is not None:
+ lib.Destroy()
+ self._libs.clear()
+
+ for pcd in self._pcds.values():
+ pcd.Destroy()
+ self._pcds.clear()
+
+ for ppi in self._ppis:
+ ppi.DeRef(self)
+ del self._ppis[:]
+
+ for protocol in self._protocols:
+ protocol.DeRef(self)
+ del self._protocols[:]
+
+ for guid in self._guids:
+ guid.DeRef(self)
+ del self._guids[:]
+
+ del self._packages[:]
+ del self._depexs[:]
+
+ if callback is not None:
+ callback(self, "Searching libraries...")
+ self._SearchLibraries()
+ if callback is not None:
+ callback(self, "Searching packages...")
+ self._SearchPackage()
+ if callback is not None:
+ callback(self, "Searching surface items...")
+ self._SearchSurfaceItems()
+
+ self.Modify(False)
+ return True
+
+ def Modify(self, modify=True, modifiedObj=None):
+ if modify:
+ #LogMsg("%s is modified, modified object is %s" % (self.GetFilename(), modifiedObj))
+ if issubclass(modifiedObj.__class__, ini.BaseINIFile) and self._isModify:
+ return
+ self._isModify = modify
+ self.GetParent().Modify(modify, self)
+ else:
+ if self.GetFileObj().IsModified():
+ return
+
+ self._isModify = modify
+ self.GetParent().Modify(modify, self)
+
+class Library(Module):
+ def __init__(self, parent, workspace):
+ Module.__init__(self, parent, workspace)
+ self._isInherit = True
+
+ def IsInherit(self):
+ return self._isInherit
+
+ def GetModuleType(self):
+ return self.GetParent().GetModuleType()
+
+ def GetPlatform(self):
+ return self.GetParent().GetParent()
+
+ def GetModuleObj(self):
+ return self.GetParent()
+
+ def GetArch(self):
+ return self.GetParent().GetArch()
+
+ def Destroy(self):
+ self._libs.clear()
+ self._pcds.clear()
+ SurfaceObject.Destroy(self)
+
+class Package(SurfaceObject):
+ def __init__(self, parent, workspace):
+ SurfaceObject.__init__(self, parent, workspace)
+ self._pcds = {}
+ self._guids = {}
+ self._protocols = {}
+ self._ppis = {}
+
+ def GetPcds(self):
+ return self._pcds
+
+ def GetPpis(self):
+ return list(self._ppis.values())
+
+ def GetProtocols(self):
+ return list(self._protocols.values())
+
+ def GetGuids(self):
+ return list(self._guids.values())
+
+ def Destroy(self):
+ for pcd in self._pcds.values():
+ if pcd is not None:
+ pcd.Destroy()
+ for guid in self._guids.values():
+ if guid is not None:
+ guid.Destroy()
+ for protocol in self._protocols.values():
+ if protocol is not None:
+ protocol.Destroy()
+ for ppi in self._ppis.values():
+ if ppi is not None:
+ ppi.Destroy()
+ self._pcds.clear()
+ self._guids.clear()
+ self._protocols.clear()
+ self._ppis.clear()
+ self._pcds.clear()
+ SurfaceObject.Destroy(self)
+
+ def Load(self, relativePath):
+ ret = SurfaceObject.Load(self, relativePath)
+ if not ret: return False
+ pcds = self.GetFileObj().GetSectionObjectsByName('pcds')
+ for pcd in pcds:
+ if pcd.GetPcdName() in self._pcds.keys():
+ if self._pcds[pcd.GetPcdName()] is not None:
+ self._pcds[pcd.GetPcdName()].AddDecObj(pcd)
+ else:
+ self._pcds[pcd.GetPcdName()] = PcdItem(pcd.GetPcdName(), self, pcd)
+
+ guids = self.GetFileObj().GetSectionObjectsByName('guids')
+ for guid in guids:
+ if guid.GetName() not in self._guids.keys():
+ self._guids[guid.GetName()] = GuidItem(guid.GetName(), self, guid)
+ else:
+ WarnMsg("Duplicate definition for %s" % guid.GetName())
+
+ ppis = self.GetFileObj().GetSectionObjectsByName('ppis')
+ for ppi in ppis:
+ if ppi.GetName() not in self._ppis.keys():
+ self._ppis[ppi.GetName()] = PpiItem(ppi.GetName(), self, ppi)
+ else:
+ WarnMsg("Duplicate definition for %s" % ppi.GetName())
+
+ protocols = self.GetFileObj().GetSectionObjectsByName('protocols')
+ for protocol in protocols:
+ if protocol.GetName() not in self._protocols.keys():
+ self._protocols[protocol.GetName()] = ProtocolItem(protocol.GetName(), self, protocol)
+ else:
+ WarnMsg("Duplicate definition for %s" % protocol.GetName())
+
+ return True
+
+ def GetFileObjectClass(self):
+ return dec.DECFile
+
+ def GetName(self):
+ return self.GetFileObj().GetDefine("PACKAGE_NAME")
+
+ def GetPcdDefineObjs(self, name=None):
+ arr = []
+ objs = self.GetFileObj().GetSectionObjectsByName('pcds')
+ if name is None: return objs
+
+ for obj in objs:
+ if obj.GetPcdName().lower() == name.lower():
+ arr.append(obj)
+ return arr
+
+ def GetLibraryClassObjs(self):
+ return self.GetFileObj().GetSectionObjectsByName('libraryclasses')
+
+ def Modify(self, modify=True, modifiedObj=None):
+ if modify:
+ self._isModify = modify
+ self.GetParent().Modify(modify, self)
+ else:
+ if self.GetFileObj().IsModified():
+ return
+
+ self._isModify = modify
+ self.GetParent().Modify(modify, self)
+
+ def GetLibraryClassHeaderPathByName(self, clsname):
+ objs = self.GetLibraryClassObjs()
+ for obj in objs:
+ if obj.GetClassName() == clsname:
+ return obj.GetHeaderFile()
+ return None
+
+class DepexItem(object):
+ def __init__(self, parent, infObj):
+ self._parent = parent
+ self._infObj = infObj
+
+ def GetDepexString(self):
+ return str(self._infObj)
+
+ def GetInfObject(self):
+ return self._infObj
+
+class ModulePcd(object):
+ _type_mapping = {'FeaturePcd': 'PcdsFeatureFlag',
+ 'FixedPcd': 'PcdsFixedAtBuild',
+ 'PatchPcd': 'PcdsPatchableInModule'}
+
+ def __init__(self, parent, name, infObj, pcdItem):
+ assert issubclass(parent.__class__, Module), "Module's PCD's parent must be module!"
+ assert pcdItem is not None, 'Pcd %s does not in some package!' % name
+
+ self._name = name
+ self._parent = parent
+ self._pcdItem = pcdItem
+ self._infObj = infObj
+
+ def GetName(self):
+ return self._name
+
+ def GetParent(self):
+ return self._name
+
+ def GetArch(self):
+ return self._parent.GetArch()
+
+ def Destroy(self):
+ self._pcdItem.DeRef(self._parent)
+ self._infObj = None
+
+ def GetBuildObj(self):
+ platformInfos = self._parent.GetPlatform().GetPcdBuildObjs(self._name, self.GetArch())
+ modulePcdType = self._infObj.GetPcdType()
+
+ # if platform do not gives pcd's value, get default value from package
+ if len(platformInfos) == 0:
+ if modulePcdType.lower() == 'pcd':
+ return self._pcdItem.GetDecObject()
+ else:
+ for obj in self._pcdItem.GetDecObjects():
+ if modulePcdType not in self._type_mapping.keys():
+ ErrorMsg("Invalid PCD type %s" % modulePcdType)
+ return None
+
+ if self._type_mapping[modulePcdType] == obj.GetPcdType():
+ return obj
+ ErrorMsg ('Module PCD type %s does not in valied range [%s] in package!' % \
+ (modulePcdType))
+ else:
+ if modulePcdType.lower() == 'pcd':
+ if len(platformInfos) > 1:
+ WarnMsg("Find more than one value for PCD %s in platform %s" % \
+ (self._name, self._parent.GetPlatform().GetFilename()))
+ return platformInfos[0]
+ else:
+ for obj in platformInfos:
+ if modulePcdType not in self._type_mapping.keys():
+ ErrorMsg("Invalid PCD type %s" % modulePcdType)
+ return None
+
+ if self._type_mapping[modulePcdType] == obj.GetPcdType():
+ return obj
+
+ ErrorMsg('Can not find value for pcd %s in pcd type %s' % \
+ (self._name, modulePcdType))
+ return None
+
+
+class SurfaceItem(object):
+ _objs = {}
+
+ def __new__(cls, *args, **kwargs):
+ """Maintain only a single instance of this object
+ @return: instance of this class
+
+ """
+ name = args[0]
+ parent = args[1]
+ fileObj = args[2]
+ if issubclass(parent.__class__, Package):
+ if name in cls._objs.keys():
+ ErrorMsg("%s item is duplicated defined in packages: %s and %s" %
+ (name, parent.GetFilename(), cls._objs[name].GetParent().GetFilename()))
+ return None
+ obj = object.__new__(cls)
+ cls._objs[name] = obj
+ return obj
+ elif issubclass(parent.__class__, Module):
+ if name not in cls._objs.keys():
+ ErrorMsg("%s item does not defined in any package! It is used by module %s" % \
+ (name, parent.GetFilename()))
+ return None
+ return cls._objs[name]
+
+ return None
+
+
+ def __init__(self, name, parent, fileObj):
+ if issubclass(parent.__class__, Package):
+ self._name = name
+ self._parent = parent
+ self._decObj = [fileObj]
+ self._refMods = {}
+ else:
+ self.RefModule(parent, fileObj)
+
+ @classmethod
+ def GetObjectDict(cls):
+ return cls._objs
+
+ def GetParent(self):
+ return self._parent
+
+ def GetReference(self):
+ return self._refMods
+
+ def RefModule(self, mObj, infObj):
+ if mObj in self._refMods.keys():
+ return
+ self._refMods[mObj] = infObj
+
+ def DeRef(self, mObj):
+ if mObj not in self._refMods.keys():
+ WarnMsg("%s is not referenced by module %s" % (self._name, mObj.GetFilename()))
+ return
+ del self._refMods[mObj]
+
+ def Destroy(self):
+ self._refMods.clear()
+ cls = self.__class__
+ del cls._objs[self._name]
+
+ def GetName(self):
+ return self._name
+
+ def GetDecObject(self):
+ return self._decObj[0]
+
+ def GetDecObjects(self):
+ return self._decObj
+
+class PcdItem(SurfaceItem):
+ def AddDecObj(self, fileObj):
+ for decObj in self._decObj:
+ if decObj.GetFilename() != fileObj.GetFilename():
+ ErrorMsg("Pcd %s defined in more than one packages : %s and %s" % \
+ (self._name, decObj.GetFilename(), fileObj.GetFilename()))
+ return
+ if decObj.GetPcdType() == fileObj.GetPcdType() and \
+ decObj.GetArch().lower() == fileObj.GetArch():
+ ErrorMsg("Pcd %s is duplicated defined in pcd type %s in package %s" % \
+ (self._name, decObj.GetPcdType(), decObj.GetFilename()))
+ return
+ self._decObj.append(fileObj)
+
+ def GetValidPcdType(self):
+ types = []
+ for obj in self._decObj:
+ if obj.GetPcdType() not in types:
+ types += obj.GetPcdType()
+ return types
+
+class GuidItem(SurfaceItem):
+ pass
+
+class PpiItem(SurfaceItem):
+ pass
+
+class ProtocolItem(SurfaceItem):
+ pass
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py
new file mode 100644
index 000000000..c25ab322e
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py
@@ -0,0 +1,313 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from plugins.EdkPlugins.basemodel import ini
+import re, os
+from plugins.EdkPlugins.basemodel.message import *
+
+class DECFile(ini.BaseINIFile):
+
+ def GetSectionInstance(self, parent, name, isCombined=False):
+ return DECSection(parent, name, isCombined)
+
+ def GetComponents(self):
+ return self.GetSectionByName('Components')
+
+ def GetPackageRootPath(self):
+ return os.path.dirname(self.GetFilename()).strip()
+
+ def GetBaseName(self):
+ return self.GetDefine("PACKAGE_NAME").strip()
+
+ def GetVersion(self):
+ return self.GetDefine("PACKAGE_VERSION").strip()
+
+ def GetSectionObjectsByName(self, name, arch=None):
+ arr = []
+ sects = self.GetSectionByName(name)
+ for sect in sects:
+ # skip unmatched archtecture content
+ if not sect.IsArchMatch(arch):
+ continue
+
+ for obj in sect.GetObjects():
+ arr.append(obj)
+
+ return arr
+
+class DECSection(ini.BaseINISection):
+ def GetSectionINIObject(self, parent):
+ type = self.GetType()
+
+ if type.lower().find('defines') != -1:
+ return DECDefineSectionObject(self)
+ if type.lower().find('includes') != -1:
+ return DECIncludeObject(self)
+ if type.lower().find('pcd') != -1:
+ return DECPcdObject(self)
+ if type.lower() == 'libraryclasses':
+ return DECLibraryClassObject(self)
+ if type.lower() == 'guids':
+ return DECGuidObject(self)
+ if type.lower() == 'ppis':
+ return DECPpiObject(self)
+ if type.lower() == 'protocols':
+ return DECProtocolObject(self)
+
+ return DECSectionObject(self)
+
+ def GetType(self):
+ arr = self._name.split('.')
+ return arr[0].strip()
+
+ def GetArch(self):
+ arr = self._name.split('.')
+ if len(arr) == 1:
+ return 'common'
+ return arr[1]
+
+ def IsArchMatch(self, arch):
+ if arch is None or self.GetArch() == 'common':
+ return True
+
+ if self.GetArch().lower() != arch.lower():
+ return False
+
+ return True
+
+class DECSectionObject(ini.BaseINISectionObject):
+ def GetArch(self):
+ return self.GetParent().GetArch()
+
+class DECDefineSectionObject(DECSectionObject):
+ def __init__(self, parent):
+ DECSectionObject.__init__(self, parent)
+ self._key = None
+ self._value = None
+
+ def Parse(self):
+ assert (self._start == self._end), 'The object in define section must be in single line'
+
+ line = self.GetLineByOffset(self._start).strip()
+
+ line = line.split('#')[0]
+ arr = line.split('=')
+ if len(arr) != 2:
+ ErrorMsg('Invalid define section object',
+ self.GetFilename(),
+ self.GetParent().GetName()
+ )
+ return False
+
+ self._key = arr[0].strip()
+ self._value = arr[1].strip()
+
+ return True
+
+ def GetKey(self):
+ return self._key
+
+ def GetValue(self):
+ return self._value
+
+class DECGuidObject(DECSectionObject):
+ _objs = {}
+
+ def __init__(self, parent):
+ DECSectionObject.__init__(self, parent)
+ self._name = None
+
+ def Parse(self):
+ line = self.GetLineByOffset(self._start).strip().split('#')[0]
+ self._name = line.split('=')[0].strip()
+ self._guid = line.split('=')[1].strip()
+ objdict = DECGuidObject._objs
+ if self._name not in objdict.keys():
+ objdict[self._name] = [self]
+ else:
+ objdict[self._name].append(self)
+
+ return True
+
+ def GetName(self):
+ return self._name
+
+ def GetGuid(self):
+ return self._guid
+
+ def Destroy(self):
+ objdict = DECGuidObject._objs
+ objdict[self._name].remove(self)
+ if len(objdict[self._name]) == 0:
+ del objdict[self._name]
+
+ @staticmethod
+ def GetObjectDict():
+ return DECGuidObject._objs
+
+class DECPpiObject(DECSectionObject):
+ _objs = {}
+ def __init__(self, parent):
+ DECSectionObject.__init__(self, parent)
+ self._name = None
+
+ def Parse(self):
+ line = self.GetLineByOffset(self._start).strip().split('#')[0]
+ self._name = line.split('=')[0].strip()
+ self._guid = line.split('=')[1].strip()
+ objdict = DECPpiObject._objs
+ if self._name not in objdict.keys():
+ objdict[self._name] = [self]
+ else:
+ objdict[self._name].append(self)
+
+ return True
+
+ def GetName(self):
+ return self._name
+
+ def GetGuid(self):
+ return self._guid
+
+ def Destroy(self):
+ objdict = DECPpiObject._objs
+ objdict[self._name].remove(self)
+ if len(objdict[self._name]) == 0:
+ del objdict[self._name]
+
+ @staticmethod
+ def GetObjectDict():
+ return DECPpiObject._objs
+
+class DECProtocolObject(DECSectionObject):
+ _objs = {}
+
+ def __init__(self, parent):
+ DECSectionObject.__init__(self, parent)
+ self._name = None
+
+ def Parse(self):
+ line = self.GetLineByOffset(self._start).strip().split('#')[0]
+ self._name = line.split('=')[0].strip()
+ self._guid = line.split('=')[1].strip()
+ objdict = DECProtocolObject._objs
+ if self._name not in objdict.keys():
+ objdict[self._name] = [self]
+ else:
+ objdict[self._name].append(self)
+
+ return True
+
+ def GetName(self):
+ return self._name
+
+ def GetGuid(self):
+ return self._guid
+
+ def Destroy(self):
+ objdict = DECProtocolObject._objs
+ objdict[self._name].remove(self)
+ if len(objdict[self._name]) == 0:
+ del objdict[self._name]
+
+
+ @staticmethod
+ def GetObjectDict():
+ return DECProtocolObject._objs
+
+class DECLibraryClassObject(DECSectionObject):
+ _objs = {}
+
+ def __init__(self, parent):
+ DECSectionObject.__init__(self, parent)
+ self.mClassName = None
+ self.mHeaderFile = None
+
+ def Parse(self):
+ line = self.GetLineByOffset(self._start).strip().split('#')[0]
+ self.mClassName, self.mHeaderFile = line.split('|')
+ objdict = DECLibraryClassObject._objs
+ if self.mClassName not in objdict.keys():
+ objdict[self.mClassName] = [self]
+ else:
+ objdict[self.mClassName].append(self)
+ return True
+
+ def GetClassName(self):
+ return self.mClassName
+
+ def GetName(self):
+ return self.mClassName
+
+ def GetHeaderFile(self):
+ return self.mHeaderFile
+
+ def Destroy(self):
+ objdict = DECLibraryClassObject._objs
+ objdict[self.mClassName].remove(self)
+ if len(objdict[self.mClassName]) == 0:
+ del objdict[self.mClassName]
+
+ @staticmethod
+ def GetObjectDict():
+ return DECLibraryClassObject._objs
+
+class DECIncludeObject(DECSectionObject):
+ def __init__(self, parent):
+ DECSectionObject.__init__(self, parent)
+
+ def GetPath(self):
+ return self.GetLineByOffset(self._start).split('#')[0].strip()
+
+class DECPcdObject(DECSectionObject):
+ _objs = {}
+
+ def __init__(self, parent):
+ DECSectionObject.__init__(self, parent)
+ self.mPcdName = None
+ self.mPcdDefaultValue = None
+ self.mPcdDataType = None
+ self.mPcdToken = None
+
+ def Parse(self):
+ line = self.GetLineByOffset(self._start).strip().split('#')[0]
+ (self.mPcdName, self.mPcdDefaultValue, self.mPcdDataType, self.mPcdToken) = line.split('|')
+ objdict = DECPcdObject._objs
+ if self.mPcdName not in objdict.keys():
+ objdict[self.mPcdName] = [self]
+ else:
+ objdict[self.mPcdName].append(self)
+
+ return True
+
+ def Destroy(self):
+ objdict = DECPcdObject._objs
+ objdict[self.mPcdName].remove(self)
+ if len(objdict[self.mPcdName]) == 0:
+ del objdict[self.mPcdName]
+
+ def GetPcdType(self):
+ return self.GetParent().GetType()
+
+ def GetPcdName(self):
+ return self.mPcdName
+
+ def GetPcdValue(self):
+ return self.mPcdDefaultValue
+
+ def GetPcdDataType(self):
+ return self.mPcdDataType
+
+ def GetPcdToken(self):
+ return self.mPcdToken
+
+ def GetName(self):
+ return self.GetPcdName().split('.')[1]
+
+ @staticmethod
+ def GetObjectDict():
+ return DECPcdObject._objs
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
new file mode 100644
index 000000000..89833043c
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
@@ -0,0 +1,1084 @@
+## @file
+#
+# This file produce action class to generate doxygen document for edk2 codebase.
+# The action classes are shared by GUI and command line tools.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+"""This file produce action class to generate doxygen document for edk2 codebase.
+ The action classes are shared by GUI and command line tools.
+"""
+from plugins.EdkPlugins.basemodel import doxygen
+import os
+try:
+ import wx
+ gInGui = True
+except:
+ gInGui = False
+import re
+from plugins.EdkPlugins.edk2.model import inf
+from plugins.EdkPlugins.edk2.model import dec
+from plugins.EdkPlugins.basemodel.message import *
+
+_ignore_dir = ['.svn', '_svn', 'cvs']
+_inf_key_description_mapping_table = {
+ 'INF_VERSION':'Version of INF file specification',
+ #'BASE_NAME':'Module Name',
+ 'FILE_GUID':'Module Guid',
+ 'MODULE_TYPE': 'Module Type',
+ 'VERSION_STRING': 'Module Version',
+ 'LIBRARY_CLASS': 'Produced Library Class',
+ 'EFI_SPECIFICATION_VERSION': 'UEFI Specification Version',
+ 'PI_SPECIFICATION_VERSION': 'PI Specification Version',
+ 'ENTRY_POINT': 'Module Entry Point Function',
+ 'CONSTRUCTOR': 'Library Constructor Function'
+}
+
+_dec_key_description_mapping_table = {
+ 'DEC_SPECIFICATION': 'Version of DEC file specification',
+ 'PACKAGE_GUID': 'Package Guid'
+}
+class DoxygenAction:
+ """This is base class for all doxygen action.
+ """
+
+ def __init__(self, doxPath, chmPath, outputPath, projname, mode='html', log=None, verbose=False):
+ """Constructor function.
+ @param doxPath the obosolution path of doxygen execute file.
+ @param outputPath the obosolution output path.
+ @param log log function for output message
+ """
+ self._doxPath = doxPath
+ self._chmPath = chmPath
+ self._outputPath = outputPath
+ self._projname = projname
+ self._configFile = None # doxygen config file is used by doxygen exe file
+ self._indexPageFile = None # doxygen page file for index page.
+ self._log = log
+ self._mode = mode
+ self._verbose = verbose
+ self._doxygenCallback = None
+ self._chmCallback = None
+
+ def Log(self, message, level='info'):
+ if self._log is not None:
+ self._log(message, level)
+
+ def IsVerbose(self):
+ return self._verbose
+
+ def Generate(self):
+ """Generate interface called by outer directly"""
+ self.Log(">>>>>> Start generate doxygen document for %s... Zzz....\n" % self._projname)
+
+ # create doxygen config file at first
+ self._configFile = doxygen.DoxygenConfigFile()
+ self._configFile.SetOutputDir(self._outputPath)
+
+ self._configFile.SetWarningFilePath(os.path.join(self._outputPath, 'warning.txt'))
+ if self._mode.lower() == 'html':
+ self._configFile.SetHtmlMode()
+ else:
+ self._configFile.SetChmMode()
+
+ self.Log(" >>>>>> Initialize doxygen config file...Zzz...\n")
+ self.InitializeConfigFile()
+
+ self.Log(" >>>>>> Generate doxygen index page file...Zzz...\n")
+ indexPagePath = self.GenerateIndexPage()
+ if indexPagePath is None:
+ self.Log("Fail to generate index page!\n", 'error')
+ return False
+ else:
+ self.Log("Success to create doxygen index page file %s \n" % indexPagePath)
+
+ # Add index page doxygen file to file list.
+ self._configFile.AddFile(indexPagePath)
+
+ # save config file to output path
+ configFilePath = os.path.join(self._outputPath, self._projname + '.doxygen_config')
+ self._configFile.Generate(configFilePath)
+ self.Log(" <<<<<< Success Save doxygen config file to %s...\n" % configFilePath)
+
+ # launch doxygen tool to generate document
+ if self._doxygenCallback is not None:
+ self.Log(" >>>>>> Start doxygen process...Zzz...\n")
+ if not self._doxygenCallback(self._doxPath, configFilePath):
+ return False
+ else:
+ self.Log("Fail to create doxygen process!", 'error')
+ return False
+
+ return True
+
+ def InitializeConfigFile(self):
+ """Initialize config setting for doxygen project. It will be invoked after config file
+ object is created. Inherited class should implement it.
+ """
+
+ def GenerateIndexPage(self):
+ """Generate doxygen index page. Inherited class should implement it."""
+ return None
+
+ def RegisterCallbackDoxygenProcess(self, callback):
+ self._doxygenCallback = callback
+
+ def RegisterCallbackCHMProcess(self, callback):
+ self._chmCallback = callback
+
+class PlatformDocumentAction(DoxygenAction):
+ """Generate platform doxygen document, will be implement at future."""
+
+class PackageDocumentAction(DoxygenAction):
+ """Generate package reference document"""
+
+ def __init__(self, doxPath, chmPath, outputPath, pObj, mode='html', log=None, arch=None, tooltag=None,
+ onlyInclude=False, verbose=False):
+ DoxygenAction.__init__(self, doxPath, chmPath, outputPath, pObj.GetName(), mode, log, verbose)
+ self._pObj = pObj
+ self._arch = arch
+ self._tooltag = tooltag
+ self._onlyIncludeDocument = onlyInclude
+
+ def InitializeConfigFile(self):
+ if self._arch == 'IA32':
+ self._configFile.AddPreDefined('MDE_CPU_IA32')
+ elif self._arch == 'X64':
+ self._configFile.AddPreDefined('MDE_CPU_X64')
+ elif self._arch == 'IPF':
+ self._configFile.AddPreDefined('MDE_CPU_IPF')
+ elif self._arch == 'EBC':
+ self._configFile.AddPreDefined('MDE_CPU_EBC')
+ else:
+ self._arch = None
+ self._configFile.AddPreDefined('MDE_CPU_IA32')
+ self._configFile.AddPreDefined('MDE_CPU_X64')
+ self._configFile.AddPreDefined('MDE_CPU_IPF')
+ self._configFile.AddPreDefined('MDE_CPU_EBC')
+ self._configFile.AddPreDefined('MDE_CPU_ARM')
+
+ namestr = self._pObj.GetName()
+ if self._arch is not None:
+ namestr += '[%s]' % self._arch
+ if self._tooltag is not None:
+ namestr += '[%s]' % self._tooltag
+ self._configFile.SetProjectName(namestr)
+ self._configFile.SetStripPath(self._pObj.GetWorkspace())
+ self._configFile.SetProjectVersion(self._pObj.GetFileObj().GetVersion())
+ self._configFile.AddPattern('*.decdoxygen')
+
+ if self._tooltag.lower() == 'msft':
+ self._configFile.AddPreDefined('_MSC_EXTENSIONS')
+ elif self._tooltag.lower() == 'gnu':
+ self._configFile.AddPreDefined('__GNUC__')
+ elif self._tooltag.lower() == 'intel':
+ self._configFile.AddPreDefined('__INTEL_COMPILER')
+ else:
+ self._tooltag = None
+ self._configFile.AddPreDefined('_MSC_EXTENSIONS')
+ self._configFile.AddPreDefined('__GNUC__')
+ self._configFile.AddPreDefined('__INTEL_COMPILER')
+
+ self._configFile.AddPreDefined('ASM_PFX= ')
+ self._configFile.AddPreDefined('OPTIONAL= ')
+
+ def GenerateIndexPage(self):
+ """Generate doxygen index page. Inherited class should implement it."""
+ fObj = self._pObj.GetFileObj()
+ pdObj = doxygen.DoxygenFile('%s Package Document' % self._pObj.GetName(),
+ '%s.decdoxygen' % self._pObj.GetFilename())
+ self._configFile.AddFile(pdObj.GetFilename())
+ pdObj.AddDescription(fObj.GetFileHeader())
+
+ defSection = fObj.GetSectionByName('defines')[0]
+ baseSection = doxygen.Section('PackageBasicInformation', 'Package Basic Information')
+ descr = '<TABLE>'
+ for obj in defSection.GetObjects():
+ if obj.GetKey() in _dec_key_description_mapping_table.keys():
+ descr += '<TR>'
+ descr += '<TD><B>%s</B></TD>' % _dec_key_description_mapping_table[obj.GetKey()]
+ descr += '<TD>%s</TD>' % obj.GetValue()
+ descr += '</TR>'
+ descr += '</TABLE><br>'
+ baseSection.AddDescription(descr)
+ pdObj.AddSection(baseSection)
+
+ knownIssueSection = doxygen.Section('Known_Issue_section', 'Known Issue')
+ knownIssueSection.AddDescription('<ul>')
+ knownIssueSection.AddDescription('<li> OPTIONAL macro for function parameter can not be dealed with doxygen, so it disapear in this document! </li>')
+ knownIssueSection.AddDescription('</ul>')
+ pdObj.AddSection(knownIssueSection)
+
+ self.AddAllIncludeFiles(self._pObj, self._configFile)
+ pages = self.GenerateIncludesSubPage(self._pObj, self._configFile)
+ if len(pages) != 0:
+ pdObj.AddPages(pages)
+ pages = self.GenerateLibraryClassesSubPage(self._pObj, self._configFile)
+ if len(pages) != 0:
+ pdObj.AddPages(pages)
+ pages = self.GeneratePcdSubPages(self._pObj, self._configFile)
+ if len(pages) != 0:
+ pdObj.AddPages(pages)
+ pages = self.GenerateGuidSubPages(self._pObj, self._configFile)
+ if len(pages) != 0:
+ pdObj.AddPages(pages)
+ pages = self.GeneratePpiSubPages(self._pObj, self._configFile)
+ if len(pages) != 0:
+ pdObj.AddPages(pages)
+ pages = self.GenerateProtocolSubPages(self._pObj, self._configFile)
+ if len(pages) != 0:
+ pdObj.AddPages(pages)
+ if not self._onlyIncludeDocument:
+ pdObj.AddPages(self.GenerateModulePages(self._pObj, self._configFile))
+
+ pdObj.Save()
+ return pdObj.GetFilename()
+
+ def GenerateIncludesSubPage(self, pObj, configFile):
+ # by default add following path as include path to config file
+ pkpath = pObj.GetFileObj().GetPackageRootPath()
+ configFile.AddIncludePath(os.path.join(pkpath, 'Include'))
+ configFile.AddIncludePath(os.path.join(pkpath, 'Include', 'Library'))
+ configFile.AddIncludePath(os.path.join(pkpath, 'Include', 'Protocol'))
+ configFile.AddIncludePath(os.path.join(pkpath, 'Include', 'Ppi'))
+ configFile.AddIncludePath(os.path.join(pkpath, 'Include', 'Guid'))
+ configFile.AddIncludePath(os.path.join(pkpath, 'Include', 'IndustryStandard'))
+
+ rootArray = []
+ pageRoot = doxygen.Page("Public Includes", "%s_public_includes" % pObj.GetName())
+ objs = pObj.GetFileObj().GetSectionObjectsByName('includes')
+ if len(objs) == 0: return []
+
+ for obj in objs:
+ # Add path to include path
+ path = os.path.join(pObj.GetFileObj().GetPackageRootPath(), obj.GetPath())
+ configFile.AddIncludePath(path)
+
+ # only list common folder's include file
+ if obj.GetArch().lower() != 'common':
+ continue
+
+ bNeedAddIncludePage = False
+ topPage = doxygen.Page(self._ConvertPathToDoxygen(path, pObj), 'public_include_top')
+
+ topPage.AddDescription('<ul>\n')
+ for file in os.listdir(path):
+ if file.lower() in _ignore_dir: continue
+ fullpath = os.path.join(path, file)
+ if os.path.isfile(fullpath):
+ self.ProcessSourceFileForInclude(fullpath, pObj, configFile)
+ topPage.AddDescription('<li> \link %s\endlink </li>\n' % self._ConvertPathToDoxygen(fullpath, pObj))
+ else:
+ if file.lower() in ['library', 'protocol', 'guid', 'ppi', 'ia32', 'x64', 'ipf', 'ebc', 'arm', 'pi', 'uefi', 'aarch64']:
+ continue
+ bNeedAddSubPage = False
+ subpage = doxygen.Page(self._ConvertPathToDoxygen(fullpath, pObj), 'public_include_%s' % file)
+ subpage.AddDescription('<ul>\n')
+ for subfile in os.listdir(fullpath):
+ if subfile.lower() in _ignore_dir: continue
+ bNeedAddSubPage = True
+ subfullpath = os.path.join(fullpath, subfile)
+ self.ProcessSourceFileForInclude(subfullpath, pObj, configFile)
+ subpage.AddDescription('<li> \link %s \endlink </li>\n' % self._ConvertPathToDoxygen(subfullpath, pObj))
+ subpage.AddDescription('</ul>\n')
+ if bNeedAddSubPage:
+ bNeedAddIncludePage = True
+ pageRoot.AddPage(subpage)
+ topPage.AddDescription('</ul>\n')
+ if bNeedAddIncludePage:
+ pageRoot.AddPage(topPage)
+
+ if pageRoot.GetSubpageCount() != 0:
+ return [pageRoot]
+ else:
+ return []
+
+ def GenerateLibraryClassesSubPage(self, pObj, configFile):
+ """
+ Generate sub page for library class for package.
+ One DEC file maybe contains many library class sections
+ for different architecture.
+
+ @param fObj DEC file object.
+ """
+ rootArray = []
+ pageRoot = doxygen.Page("Library Class", "%s_libraryclass" % pObj.GetName())
+ objs = pObj.GetFileObj().GetSectionObjectsByName('libraryclass', self._arch)
+ if len(objs) == 0: return []
+
+ if self._arch is not None:
+ for obj in objs:
+ classPage = doxygen.Page(obj.GetClassName(),
+ "lc_%s" % obj.GetClassName())
+ comments = obj.GetComment()
+ if len(comments) != 0:
+ classPage.AddDescription('<br>\n'.join(comments) + '<br>\n')
+ pageRoot.AddPage(classPage)
+ path = os.path.join(pObj.GetFileObj().GetPackageRootPath(), obj.GetHeaderFile())
+ path = path[len(pObj.GetWorkspace()) + 1:]
+ if len(comments) == 0:
+ classPage.AddDescription('\copydoc %s<p>' % obj.GetHeaderFile())
+ section = doxygen.Section('ref', 'Refer to Header File')
+ section.AddDescription('\link %s\n' % obj.GetHeaderFile())
+ section.AddDescription(' \endlink<p>\n')
+ classPage.AddSection(section)
+ fullPath = os.path.join(pObj.GetFileObj().GetPackageRootPath(), obj.GetHeaderFile())
+ self.ProcessSourceFileForInclude(fullPath, pObj, configFile)
+ else:
+ archPageDict = {}
+ for obj in objs:
+ if obj.GetArch() not in archPageDict.keys():
+ archPageDict[obj.GetArch()] = doxygen.Page(obj.GetArch(),
+ 'lc_%s' % obj.GetArch())
+ pageRoot.AddPage(archPageDict[obj.GetArch()])
+ subArchRoot = archPageDict[obj.GetArch()]
+ classPage = doxygen.Page(obj.GetClassName(),
+ "lc_%s" % obj.GetClassName())
+ comments = obj.GetComment()
+ if len(comments) != 0:
+ classPage.AddDescription('<br>\n'.join(comments) + '<br>\n')
+ subArchRoot.AddPage(classPage)
+ path = os.path.join(pObj.GetFileObj().GetPackageRootPath(), obj.GetHeaderFile())
+ path = path[len(pObj.GetWorkspace()) + 1:]
+ if len(comments) == 0:
+ classPage.AddDescription('\copydoc %s<p>' % obj.GetHeaderFile())
+ section = doxygen.Section('ref', 'Refer to Header File')
+ section.AddDescription('\link %s\n' % obj.GetHeaderFile())
+ section.AddDescription(' \endlink<p>\n')
+ classPage.AddSection(section)
+ fullPath = os.path.join(pObj.GetFileObj().GetPackageRootPath(), obj.GetHeaderFile())
+
+ self.ProcessSourceFileForInclude(fullPath, pObj, configFile)
+ rootArray.append(pageRoot)
+ return rootArray
+
+ def ProcessSourceFileForInclude(self, path, pObj, configFile, infObj=None):
+ """
+ @param path the analysising file full path
+ @param pObj package object
+ @param configFile doxygen config file.
+ """
+ if gInGui:
+ wx.Yield()
+ if not os.path.exists(path):
+ ErrorMsg('Source file path %s does not exist!' % path)
+ return
+
+ if configFile.FileExists(path):
+ return
+
+ try:
+ with open(path, 'r') as f:
+ lines = f.readlines()
+ except UnicodeDecodeError:
+ return
+ except IOError:
+ ErrorMsg('Fail to open file %s' % path)
+ return
+
+ configFile.AddFile(path)
+
+ no = 0
+ for no in range(len(lines)):
+ if len(lines[no].strip()) == 0:
+ continue
+ if lines[no].strip()[:2] in ['##', '//', '/*', '*/']:
+ continue
+ index = lines[no].lower().find('include')
+ #mo = IncludePattern.finditer(lines[no].lower())
+ mo = re.match(r"^#\s*include\s+[<\"]([\\/\w.]+)[>\"]$", lines[no].strip().lower())
+ if not mo:
+ continue
+ mo = re.match(r"^[#\w\s]+[<\"]([\\/\w.]+)[>\"]$", lines[no].strip())
+ filePath = mo.groups()[0]
+
+ if filePath is None or len(filePath) == 0:
+ continue
+
+ # find header file in module's path firstly.
+ fullPath = None
+
+ if os.path.exists(os.path.join(os.path.dirname(path), filePath)):
+ # Find the file in current directory
+ fullPath = os.path.join(os.path.dirname(path), filePath).replace('\\', '/')
+ else:
+ # find in depedent package's include path
+ incObjs = pObj.GetFileObj().GetSectionObjectsByName('includes')
+ for incObj in incObjs:
+ incPath = os.path.join(pObj.GetFileObj().GetPackageRootPath(), incObj.GetPath()).strip()
+ incPath = os.path.realpath(os.path.join(incPath, filePath))
+ if os.path.exists(incPath):
+ fullPath = incPath
+ break
+ if infObj is not None:
+ pkgInfObjs = infObj.GetSectionObjectsByName('packages')
+ for obj in pkgInfObjs:
+ decObj = dec.DECFile(os.path.join(pObj.GetWorkspace(), obj.GetPath()))
+ if not decObj:
+ ErrorMsg ('Fail to create pacakge object for %s' % obj.GetPackageName())
+ continue
+ if not decObj.Parse():
+ ErrorMsg ('Fail to load package object for %s' % obj.GetPackageName())
+ continue
+ incObjs = decObj.GetSectionObjectsByName('includes')
+ for incObj in incObjs:
+ incPath = os.path.join(decObj.GetPackageRootPath(), incObj.GetPath()).replace('\\', '/')
+ if os.path.exists(os.path.join(incPath, filePath)):
+ fullPath = os.path.join(os.path.join(incPath, filePath))
+ break
+ if fullPath is not None:
+ break
+
+ if fullPath is None and self.IsVerbose():
+ self.Log('Can not resolve header file %s for file %s in package %s\n' % (filePath, path, pObj.GetFileObj().GetFilename()), 'error')
+ return
+ else:
+ fullPath = fullPath.replace('\\', '/')
+ if self.IsVerbose():
+ self.Log('Preprocessing: Add include file %s for file %s\n' % (fullPath, path))
+ #LogMsg ('Preprocessing: Add include file %s for file %s' % (fullPath, path))
+ self.ProcessSourceFileForInclude(fullPath, pObj, configFile, infObj)
+
+ def AddAllIncludeFiles(self, pObj, configFile):
+ objs = pObj.GetFileObj().GetSectionObjectsByName('includes')
+ for obj in objs:
+ incPath = os.path.join(pObj.GetFileObj().GetPackageRootPath(), obj.GetPath())
+ for root, dirs, files in os.walk(incPath):
+ for dir in dirs:
+ if dir.lower() in _ignore_dir:
+ dirs.remove(dir)
+ for file in files:
+ path = os.path.normpath(os.path.join(root, file))
+ configFile.AddFile(path.replace('/', '\\'))
+
+ def GeneratePcdSubPages(self, pObj, configFile):
+ """
+ Generate sub pages for package's PCD definition.
+ @param pObj package object
+ @param configFile config file object
+ """
+ rootArray = []
+ objs = pObj.GetFileObj().GetSectionObjectsByName('pcd')
+ if len(objs) == 0:
+ return []
+
+ pcdRootPage = doxygen.Page('PCD', 'pcd_root_page')
+ typeRootPageDict = {}
+ typeArchRootPageDict = {}
+ for obj in objs:
+ if obj.GetPcdType() not in typeRootPageDict.keys():
+ typeRootPageDict[obj.GetPcdType()] = doxygen.Page(obj.GetPcdType(), 'pcd_%s_root_page' % obj.GetPcdType())
+ pcdRootPage.AddPage(typeRootPageDict[obj.GetPcdType()])
+ typeRoot = typeRootPageDict[obj.GetPcdType()]
+ if self._arch is not None:
+ pcdPage = doxygen.Page('%s' % obj.GetPcdName(),
+ 'pcd_%s_%s_%s' % (obj.GetPcdType(), obj.GetArch(), obj.GetPcdName().split('.')[1]))
+ pcdPage.AddDescription('<br>\n'.join(obj.GetComment()) + '<br>\n')
+ section = doxygen.Section('PCDinformation', 'PCD Information')
+ desc = '<TABLE>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>Name</CAPTION></TD>'
+ desc += '<TD><CAPTION>Token Space</CAPTION></TD>'
+ desc += '<TD><CAPTION>Token number</CAPTION></TD>'
+ desc += '<TD><CAPTION>Data Type</CAPTION></TD>'
+ desc += '<TD><CAPTION>Default Value</CAPTION></TD>'
+ desc += '</TR>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdName().split('.')[1]
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdName().split('.')[0]
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdToken()
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdDataType()
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdValue()
+ desc += '</TR>'
+ desc += '</TABLE>'
+ section.AddDescription(desc)
+ pcdPage.AddSection(section)
+ typeRoot.AddPage(pcdPage)
+ else:
+ keystr = obj.GetPcdType() + obj.GetArch()
+ if keystr not in typeArchRootPageDict.keys():
+ typeArchRootPage = doxygen.Page(obj.GetArch(), 'pcd_%s_%s_root_page' % (obj.GetPcdType(), obj.GetArch()))
+ typeArchRootPageDict[keystr] = typeArchRootPage
+ typeRoot.AddPage(typeArchRootPage)
+ typeArchRoot = typeArchRootPageDict[keystr]
+ pcdPage = doxygen.Page('%s' % obj.GetPcdName(),
+ 'pcd_%s_%s_%s' % (obj.GetPcdType(), obj.GetArch(), obj.GetPcdName().split('.')[1]))
+ pcdPage.AddDescription('<br>\n'.join(obj.GetComment()) + '<br>\n')
+ section = doxygen.Section('PCDinformation', 'PCD Information')
+ desc = '<TABLE>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>Name</CAPTION></TD>'
+ desc += '<TD><CAPTION>Token Space</CAPTION></TD>'
+ desc += '<TD><CAPTION>Token number</CAPTION></TD>'
+ desc += '<TD><CAPTION>Data Type</CAPTION></TD>'
+ desc += '<TD><CAPTION>Default Value</CAPTION></TD>'
+ desc += '</TR>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdName().split('.')[1]
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdName().split('.')[0]
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdToken()
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdDataType()
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdValue()
+ desc += '</TR>'
+ desc += '</TABLE>'
+ section.AddDescription(desc)
+ pcdPage.AddSection(section)
+ typeArchRoot.AddPage(pcdPage)
+ return [pcdRootPage]
+
+ def _GenerateGuidSubPage(self, pObj, obj, configFile):
+ guidPage = doxygen.Page('%s' % obj.GetName(),
+ 'guid_%s_%s' % (obj.GetArch(), obj.GetName()))
+ comments = obj.GetComment()
+ if len(comments) != 0:
+ guidPage.AddDescription('<br>'.join(obj.GetComment()) + '<br>')
+ section = doxygen.Section('BasicGuidInfo', 'GUID Information')
+ desc = '<TABLE>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>GUID\'s Guid Name</CAPTION></TD><TD><CAPTION>GUID\'s Guid</CAPTION></TD>'
+ desc += '</TR>'
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % obj.GetName()
+ desc += '<TD>%s</TD>' % obj.GetGuid()
+ desc += '</TR>'
+ desc += '</TABLE>'
+ section.AddDescription(desc)
+ guidPage.AddSection(section)
+ refFile = self.FindHeaderFileForGuid(pObj, obj.GetName(), configFile)
+ if refFile:
+ relPath = refFile[len(pObj.GetWorkspace()) + 1:]
+ if len(comments) == 0:
+ guidPage.AddDescription(' \\copydoc %s <br>' % relPath)
+
+ section = doxygen.Section('ref', 'Refer to Header File')
+ section.AddDescription('\link %s\n' % relPath)
+ section.AddDescription('\endlink\n')
+ self.ProcessSourceFileForInclude(refFile, pObj, configFile)
+ guidPage.AddSection(section)
+ return guidPage
+
+ def GenerateGuidSubPages(self, pObj, configFile):
+ """
+ Generate sub pages for package's GUID definition.
+ @param pObj package object
+ @param configFilf doxygen config file object
+ """
+ pageRoot = doxygen.Page('GUID', 'guid_root_page')
+ objs = pObj.GetFileObj().GetSectionObjectsByName('guids', self._arch)
+ if len(objs) == 0: return []
+ if self._arch is not None:
+ for obj in objs:
+ pageRoot.AddPage(self._GenerateGuidSubPage(pObj, obj, configFile))
+ else:
+ guidArchRootPageDict = {}
+ for obj in objs:
+ if obj.GetArch() not in guidArchRootPageDict.keys():
+ guidArchRoot = doxygen.Page(obj.GetArch(), 'guid_arch_root_%s' % obj.GetArch())
+ pageRoot.AddPage(guidArchRoot)
+ guidArchRootPageDict[obj.GetArch()] = guidArchRoot
+ guidArchRoot = guidArchRootPageDict[obj.GetArch()]
+ guidArchRoot.AddPage(self._GenerateGuidSubPage(pObj, obj, configFile))
+ return [pageRoot]
+
+ def _GeneratePpiSubPage(self, pObj, obj, configFile):
+ guidPage = doxygen.Page(obj.GetName(), 'ppi_page_%s' % obj.GetName())
+ comments = obj.GetComment()
+ if len(comments) != 0:
+ guidPage.AddDescription('<br>'.join(obj.GetComment()) + '<br>')
+ section = doxygen.Section('BasicPpiInfo', 'PPI Information')
+ desc = '<TABLE>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>PPI\'s Guid Name</CAPTION></TD><TD><CAPTION>PPI\'s Guid</CAPTION></TD>'
+ desc += '</TR>'
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % obj.GetName()
+ desc += '<TD>%s</TD>' % obj.GetGuid()
+ desc += '</TR>'
+ desc += '</TABLE>'
+ section.AddDescription(desc)
+ guidPage.AddSection(section)
+ refFile = self.FindHeaderFileForGuid(pObj, obj.GetName(), configFile)
+ if refFile:
+ relPath = refFile[len(pObj.GetWorkspace()) + 1:]
+ if len(comments) == 0:
+ guidPage.AddDescription(' \\copydoc %s <br>' % relPath)
+ section = doxygen.Section('ref', 'Refer to Header File')
+ section.AddDescription('\link %s\n' % relPath)
+ section.AddDescription('\endlink\n')
+ self.ProcessSourceFileForInclude(refFile, pObj, configFile)
+ guidPage.AddSection(section)
+
+ return guidPage
+
+ def GeneratePpiSubPages(self, pObj, configFile):
+ """
+ Generate sub pages for package's GUID definition.
+ @param pObj package object
+ @param configFilf doxygen config file object
+ """
+ pageRoot = doxygen.Page('PPI', 'ppi_root_page')
+ objs = pObj.GetFileObj().GetSectionObjectsByName('ppis', self._arch)
+ if len(objs) == 0: return []
+ if self._arch is not None:
+ for obj in objs:
+ pageRoot.AddPage(self._GeneratePpiSubPage(pObj, obj, configFile))
+ else:
+ guidArchRootPageDict = {}
+ for obj in objs:
+ if obj.GetArch() not in guidArchRootPageDict.keys():
+ guidArchRoot = doxygen.Page(obj.GetArch(), 'ppi_arch_root_%s' % obj.GetArch())
+ pageRoot.AddPage(guidArchRoot)
+ guidArchRootPageDict[obj.GetArch()] = guidArchRoot
+ guidArchRoot = guidArchRootPageDict[obj.GetArch()]
+ guidArchRoot.AddPage(self._GeneratePpiSubPage(pObj, obj, configFile))
+ return [pageRoot]
+
+ def _GenerateProtocolSubPage(self, pObj, obj, configFile):
+ guidPage = doxygen.Page(obj.GetName(), 'protocol_page_%s' % obj.GetName())
+ comments = obj.GetComment()
+ if len(comments) != 0:
+ guidPage.AddDescription('<br>'.join(obj.GetComment()) + '<br>')
+ section = doxygen.Section('BasicProtocolInfo', 'PROTOCOL Information')
+ desc = '<TABLE>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>PROTOCOL\'s Guid Name</CAPTION></TD><TD><CAPTION>PROTOCOL\'s Guid</CAPTION></TD>'
+ desc += '</TR>'
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % obj.GetName()
+ desc += '<TD>%s</TD>' % obj.GetGuid()
+ desc += '</TR>'
+ desc += '</TABLE>'
+ section.AddDescription(desc)
+ guidPage.AddSection(section)
+
+ refFile = self.FindHeaderFileForGuid(pObj, obj.GetName(), configFile)
+ if refFile:
+ relPath = refFile[len(pObj.GetWorkspace()) + 1:]
+ if len(comments) == 0:
+ guidPage.AddDescription(' \\copydoc %s <br>' % relPath)
+ section = doxygen.Section('ref', 'Refer to Header File')
+ section.AddDescription('\link %s\n' % relPath)
+ section.AddDescription('\endlink\n')
+ self.ProcessSourceFileForInclude(refFile, pObj, configFile)
+ guidPage.AddSection(section)
+
+ return guidPage
+
+ def GenerateProtocolSubPages(self, pObj, configFile):
+ """
+ Generate sub pages for package's GUID definition.
+ @param pObj package object
+ @param configFilf doxygen config file object
+ """
+ pageRoot = doxygen.Page('PROTOCOL', 'protocol_root_page')
+ objs = pObj.GetFileObj().GetSectionObjectsByName('protocols', self._arch)
+ if len(objs) == 0: return []
+ if self._arch is not None:
+ for obj in objs:
+ pageRoot.AddPage(self._GenerateProtocolSubPage(pObj, obj, configFile))
+ else:
+ guidArchRootPageDict = {}
+ for obj in objs:
+ if obj.GetArch() not in guidArchRootPageDict.keys():
+ guidArchRoot = doxygen.Page(obj.GetArch(), 'protocol_arch_root_%s' % obj.GetArch())
+ pageRoot.AddPage(guidArchRoot)
+ guidArchRootPageDict[obj.GetArch()] = guidArchRoot
+ guidArchRoot = guidArchRootPageDict[obj.GetArch()]
+ guidArchRoot.AddPage(self._GenerateProtocolSubPage(pObj, obj, configFile))
+ return [pageRoot]
+
+ def FindHeaderFileForGuid(self, pObj, name, configFile):
+ """
+ For declaration header file for GUID/PPI/Protocol.
+
+ @param pObj package object
+ @param name guid/ppi/protocol's name
+ @param configFile config file object
+
+ @return full path of header file and None if not found.
+ """
+ startPath = pObj.GetFileObj().GetPackageRootPath()
+ incPath = os.path.join(startPath, 'Include').replace('\\', '/')
+ # if <PackagePath>/include exist, then search header under it.
+ if os.path.exists(incPath):
+ startPath = incPath
+
+ for root, dirs, files in os.walk(startPath):
+ for dir in dirs:
+ if dir.lower() in _ignore_dir:
+ dirs.remove(dir)
+ for file in files:
+ fPath = os.path.join(root, file)
+ if not IsCHeaderFile(fPath):
+ continue
+ try:
+ f = open(fPath, 'r')
+ lines = f.readlines()
+ f.close()
+ except IOError:
+ self.Log('Fail to open file %s\n' % fPath)
+ continue
+ for line in lines:
+ if line.find(name) != -1 and \
+ line.find('extern') != -1:
+ return fPath.replace('\\', '/')
+ return None
+
+ def GetPackageModuleList(self, pObj):
+ """
+ Get all module's INF path under package's root path
+ @param pObj package object
+ @return arrary of INF full path
+ """
+ mArray = []
+ packPath = pObj.GetFileObj().GetPackageRootPath()
+ if not os.path.exists:
+ return None
+ for root, dirs, files in os.walk(packPath):
+ for dir in dirs:
+ if dir.lower() in _ignore_dir:
+ dirs.remove(dir)
+ for file in files:
+ if CheckPathPostfix(file, 'inf'):
+ fPath = os.path.join(root, file).replace('\\', '/')
+ mArray.append(fPath)
+ return mArray
+
+ def GenerateModulePages(self, pObj, configFile):
+ """
+ Generate sub pages for package's module which is under the package
+ root directory.
+
+ @param pObj package object
+ @param configFilf doxygen config file object
+ """
+ infList = self.GetPackageModuleList(pObj)
+ rootPages = []
+ libObjs = []
+ modObjs = []
+ for infpath in infList:
+ infObj = inf.INFFile(infpath)
+ #infObj = INFFileObject.INFFile (pObj.GetWorkspacePath(),
+ # inf)
+ if not infObj:
+ self.Log('Fail create INF object for %s' % inf)
+ continue
+ if not infObj.Parse():
+ self.Log('Fail to load INF file %s' % inf)
+ continue
+ if infObj.GetProduceLibraryClass() is not None:
+ libObjs.append(infObj)
+ else:
+ modObjs.append(infObj)
+
+ if len(libObjs) != 0:
+ libRootPage = doxygen.Page('Libraries', 'lib_root_page')
+ rootPages.append(libRootPage)
+ for libInf in libObjs:
+ libRootPage.AddPage(self.GenerateModulePage(pObj, libInf, configFile, True))
+
+ if len(modObjs) != 0:
+ modRootPage = doxygen.Page('Modules', 'module_root_page')
+ rootPages.append(modRootPage)
+ for modInf in modObjs:
+ modRootPage.AddPage(self.GenerateModulePage(pObj, modInf, configFile, False))
+
+ return rootPages
+
+ def GenerateModulePage(self, pObj, infObj, configFile, isLib):
+ """
+ Generate page for a module/library.
+ @param infObj INF file object for module/library
+ @param configFile doxygen config file object
+ @param isLib Whether this module is library
+
+ @param module doxygen page object
+ """
+ workspace = pObj.GetWorkspace()
+ refDecObjs = []
+ for obj in infObj.GetSectionObjectsByName('packages'):
+ decObj = dec.DECFile(os.path.join(workspace, obj.GetPath()))
+ if not decObj:
+ ErrorMsg ('Fail to create pacakge object for %s' % obj.GetPackageName())
+ continue
+ if not decObj.Parse():
+ ErrorMsg ('Fail to load package object for %s' % obj.GetPackageName())
+ continue
+ refDecObjs.append(decObj)
+
+ modPage = doxygen.Page('%s' % infObj.GetBaseName(),
+ 'module_%s' % infObj.GetBaseName())
+ modPage.AddDescription(infObj.GetFileHeader())
+
+ basicInfSection = doxygen.Section('BasicModuleInformation', 'Basic Module Information')
+ desc = "<TABLE>"
+ for obj in infObj.GetSectionObjectsByName('defines'):
+ key = obj.GetKey()
+ value = obj.GetValue()
+ if key not in _inf_key_description_mapping_table.keys(): continue
+ if key == 'LIBRARY_CLASS' and value.find('|') != -1:
+ clsname, types = value.split('|')
+ desc += '<TR>'
+ desc += '<TD><B>%s</B></TD>' % _inf_key_description_mapping_table[key]
+ desc += '<TD>%s</TD>' % clsname
+ desc += '</TR>'
+
+ desc += '<TR>'
+ desc += '<TD><B>Supported Module Types</B></TD>'
+ desc += '<TD>%s</TD>' % types
+ desc += '</TR>'
+ else:
+ desc += '<TR>'
+ desc += '<TD><B>%s</B></TD>' % _inf_key_description_mapping_table[key]
+ if key == 'EFI_SPECIFICATION_VERSION' and value == '0x00020000':
+ value = '2.0'
+ desc += '<TD>%s</TD>' % value
+ desc += '</TR>'
+ desc += '</TABLE>'
+ basicInfSection.AddDescription(desc)
+ modPage.AddSection(basicInfSection)
+
+ # Add protocol section
+ data = []
+ for obj in infObj.GetSectionObjectsByName('pcd', self._arch):
+ data.append(obj.GetPcdName().strip())
+ if len(data) != 0:
+ s = doxygen.Section('Pcds', 'Pcds')
+ desc = "<TABLE>"
+ desc += '<TR><TD><B>PCD Name</B></TD><TD><B>TokenSpace</B></TD><TD><B>Package</B></TD></TR>'
+ for item in data:
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % item.split('.')[1]
+ desc += '<TD>%s</TD>' % item.split('.')[0]
+ pkgbasename = self.SearchPcdPackage(item, workspace, refDecObjs)
+ desc += '<TD>%s</TD>' % pkgbasename
+ desc += '</TR>'
+ desc += "</TABLE>"
+ s.AddDescription(desc)
+ modPage.AddSection(s)
+
+ # Add protocol section
+ #sects = infObj.GetSectionByString('protocol')
+ data = []
+ #for sect in sects:
+ for obj in infObj.GetSectionObjectsByName('protocol', self._arch):
+ data.append(obj.GetName().strip())
+ if len(data) != 0:
+ s = doxygen.Section('Protocols', 'Protocols')
+ desc = "<TABLE>"
+ desc += '<TR><TD><B>Name</B></TD><TD><B>Package</B></TD></TR>'
+ for item in data:
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % item
+ pkgbasename = self.SearchProtocolPackage(item, workspace, refDecObjs)
+ desc += '<TD>%s</TD>' % pkgbasename
+ desc += '</TR>'
+ desc += "</TABLE>"
+ s.AddDescription(desc)
+ modPage.AddSection(s)
+
+ # Add ppi section
+ #sects = infObj.GetSectionByString('ppi')
+ data = []
+ #for sect in sects:
+ for obj in infObj.GetSectionObjectsByName('ppi', self._arch):
+ data.append(obj.GetName().strip())
+ if len(data) != 0:
+ s = doxygen.Section('Ppis', 'Ppis')
+ desc = "<TABLE>"
+ desc += '<TR><TD><B>Name</B></TD><TD><B>Package</B></TD></TR>'
+ for item in data:
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % item
+ pkgbasename = self.SearchPpiPackage(item, workspace, refDecObjs)
+ desc += '<TD>%s</TD>' % pkgbasename
+ desc += '</TR>'
+ desc += "</TABLE>"
+ s.AddDescription(desc)
+ modPage.AddSection(s)
+
+ # Add guid section
+ #sects = infObj.GetSectionByString('guid')
+ data = []
+ #for sect in sects:
+ for obj in infObj.GetSectionObjectsByName('guid', self._arch):
+ data.append(obj.GetName().strip())
+ if len(data) != 0:
+ s = doxygen.Section('Guids', 'Guids')
+ desc = "<TABLE>"
+ desc += '<TR><TD><B>Name</B></TD><TD><B>Package</B></TD></TR>'
+ for item in data:
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % item
+ pkgbasename = self.SearchGuidPackage(item, workspace, refDecObjs)
+ desc += '<TD>%s</TD>' % pkgbasename
+ desc += '</TR>'
+ desc += "</TABLE>"
+ s.AddDescription(desc)
+ modPage.AddSection(s)
+
+ section = doxygen.Section('LibraryClasses', 'Library Classes')
+ desc = "<TABLE>"
+ desc += '<TR><TD><B>Name</B></TD><TD><B>Type</B></TD><TD><B>Package</B></TD><TD><B>Header File</B></TD></TR>'
+ if isLib:
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % infObj.GetProduceLibraryClass()
+ desc += '<TD>Produce</TD>'
+ try:
+ pkgname, hPath = self.SearchLibraryClassHeaderFile(infObj.GetProduceLibraryClass(),
+ workspace,
+ refDecObjs)
+ except:
+ self.Log ('fail to get package header file for lib class %s' % infObj.GetProduceLibraryClass())
+ pkgname = 'NULL'
+ hPath = 'NULL'
+ desc += '<TD>%s</TD>' % pkgname
+ if hPath != "NULL":
+ desc += '<TD>\link %s \endlink</TD>' % hPath
+ else:
+ desc += '<TD>%s</TD>' % hPath
+ desc += '</TR>'
+ for lcObj in infObj.GetSectionObjectsByName('libraryclasses', self._arch):
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % lcObj.GetClass()
+ retarr = self.SearchLibraryClassHeaderFile(lcObj.GetClass(),
+ workspace,
+ refDecObjs)
+ if retarr is not None:
+ pkgname, hPath = retarr
+ else:
+ self.Log('Fail find the library class %s definition from module %s dependent package!' % (lcObj.GetClass(), infObj.GetFilename()), 'error')
+ pkgname = 'NULL'
+ hPath = 'NULL'
+ desc += '<TD>Consume</TD>'
+ desc += '<TD>%s</TD>' % pkgname
+ desc += '<TD>\link %s \endlink</TD>' % hPath
+ desc += '</TR>'
+ desc += "</TABLE>"
+ section.AddDescription(desc)
+ modPage.AddSection(section)
+
+ section = doxygen.Section('SourceFiles', 'Source Files')
+ section.AddDescription('<ul>\n')
+ for obj in infObj.GetSourceObjects(self._arch, self._tooltag):
+ sPath = infObj.GetModuleRootPath()
+ sPath = os.path.join(sPath, obj.GetSourcePath()).replace('\\', '/').strip()
+ if sPath.lower().endswith('.uni') or sPath.lower().endswith('.s') or sPath.lower().endswith('.asm') or sPath.lower().endswith('.nasm'):
+ newPath = self.TranslateUniFile(sPath)
+ configFile.AddFile(newPath)
+ newPath = newPath[len(pObj.GetWorkspace()) + 1:]
+ section.AddDescription('<li> \link %s \endlink </li>' % newPath)
+ else:
+ self.ProcessSourceFileForInclude(sPath, pObj, configFile, infObj)
+ sPath = sPath[len(pObj.GetWorkspace()) + 1:]
+ section.AddDescription('<li>\link %s \endlink </li>' % sPath)
+ section.AddDescription('</ul>\n')
+ modPage.AddSection(section)
+
+ #sects = infObj.GetSectionByString('depex')
+ data = []
+ #for sect in sects:
+ for obj in infObj.GetSectionObjectsByName('depex'):
+ data.append(str(obj))
+ if len(data) != 0:
+ s = doxygen.Section('DependentSection', 'Module Dependencies')
+ s.AddDescription('<br>'.join(data))
+ modPage.AddSection(s)
+
+ return modPage
+
+ def TranslateUniFile(self, path):
+ newpath = path + '.dox'
+ #import core.textfile as textfile
+ #file = textfile.TextFile(path)
+
+ try:
+ file = open(path, 'r')
+ except (IOError, OSError) as msg:
+ return None
+
+ t = file.read()
+ file.close()
+
+ output = '/** @file \n'
+ #output = '<html><body>'
+ arr = t.split('\r\n')
+ for line in arr:
+ if line.find('@file') != -1:
+ continue
+ if line.find('*/') != -1:
+ continue
+ line = line.strip()
+ if line.strip().startswith('/'):
+ arr = line.split(' ')
+ if len(arr) > 1:
+ line = ' '.join(arr[1:])
+ else:
+ continue
+ output += '%s<br>\n' % line
+ output += '**/'
+
+ if os.path.exists(newpath):
+ os.remove(newpath)
+
+ file = open(newpath, "w")
+ file.write(output)
+ file.close()
+ return newpath
+
+ def SearchPcdPackage(self, pcdname, workspace, decObjs):
+ for decObj in decObjs:
+ for pcd in decObj.GetSectionObjectsByName('pcd'):
+ if pcdname == pcd.GetPcdName():
+ return decObj.GetBaseName()
+ return None
+
+ def SearchProtocolPackage(self, protname, workspace, decObjs):
+ for decObj in decObjs:
+ for proto in decObj.GetSectionObjectsByName('protocol'):
+ if protname == proto.GetName():
+ return decObj.GetBaseName()
+ return None
+
+ def SearchPpiPackage(self, ppiname, workspace, decObjs):
+ for decObj in decObjs:
+ for ppi in decObj.GetSectionObjectsByName('ppi'):
+ if ppiname == ppi.GetName():
+ return decObj.GetBaseName()
+ return None
+
+ def SearchGuidPackage(self, guidname, workspace, decObjs):
+ for decObj in decObjs:
+ for guid in decObj.GetSectionObjectsByName('guid'):
+ if guidname == guid.GetName():
+ return decObj.GetBaseName()
+ return None
+
+ def SearchLibraryClassHeaderFile(self, className, workspace, decObjs):
+ for decObj in decObjs:
+ for cls in decObj.GetSectionObjectsByName('libraryclasses'):
+ if cls.GetClassName().strip() == className:
+ path = cls.GetHeaderFile().strip()
+ path = os.path.join(decObj.GetPackageRootPath(), path)
+ path = path[len(workspace) + 1:]
+ return decObj.GetBaseName(), path.replace('\\', '/')
+
+ return None
+
+ def _ConvertPathToDoxygen(self, path, pObj):
+ pRootPath = pObj.GetWorkspace()
+ path = path[len(pRootPath) + 1:]
+ return path.replace('\\', '/')
+
+def IsCHeaderFile(path):
+ return CheckPathPostfix(path, 'h')
+
+def CheckPathPostfix(path, str):
+ index = path.rfind('.')
+ if index == -1:
+ return False
+ if path[index + 1:].lower() == str.lower():
+ return True
+ return False
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py
new file mode 100644
index 000000000..e37938c46
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py
@@ -0,0 +1,1086 @@
+## @file
+#
+# This file produce action class to generate doxygen document for edk2 codebase.
+# The action classes are shared by GUI and command line tools.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+from plugins.EdkPlugins.basemodel import doxygen
+import os
+try:
+ import wx
+ gInGui = True
+except:
+ gInGui = False
+import re
+from plugins.EdkPlugins.edk2.model import inf
+from plugins.EdkPlugins.edk2.model import dec
+from plugins.EdkPlugins.basemodel.message import *
+
+_ignore_dir = ['.svn', '_svn', 'cvs']
+_inf_key_description_mapping_table = {
+ 'INF_VERSION':'Version of INF file specification',
+ #'BASE_NAME':'Module Name',
+ 'FILE_GUID':'Module Guid',
+ 'MODULE_TYPE': 'Module Type',
+ 'VERSION_STRING': 'Module Version',
+ 'LIBRARY_CLASS': 'Produced Library Class',
+ 'EFI_SPECIFICATION_VERSION': 'UEFI Specification Version',
+ 'PI_SPECIFICATION_VERSION': 'PI Specification Version',
+ 'ENTRY_POINT': 'Module Entry Point Function',
+ 'CONSTRUCTOR': 'Library Constructor Function'
+}
+
+_dec_key_description_mapping_table = {
+ 'DEC_SPECIFICATION': 'Version of DEC file specification',
+ 'PACKAGE_GUID': 'Package Guid'
+}
+class DoxygenAction:
+ """This is base class for all doxygen action.
+ """
+
+ def __init__(self, doxPath, chmPath, outputPath, projname, mode='html', log=None, verbose=False):
+ """Constructor function.
+ @param doxPath the obosolution path of doxygen execute file.
+ @param outputPath the obosolution output path.
+ @param log log function for output message
+ """
+ self._doxPath = doxPath
+ self._chmPath = chmPath
+ self._outputPath = outputPath
+ self._projname = projname
+ self._configFile = None # doxygen config file is used by doxygen exe file
+ self._indexPageFile = None # doxygen page file for index page.
+ self._log = log
+ self._mode = mode
+ self._verbose = verbose
+ self._doxygenCallback = None
+ self._chmCallback = None
+
+ def Log(self, message, level='info'):
+ if self._log is not None:
+ self._log(message, level)
+
+ def IsVerbose(self):
+ return self._verbose
+
+ def Generate(self):
+ """Generate interface called by outer directly"""
+ self.Log(">>>>>> Start generate doxygen document for %s... Zzz....\n" % self._projname)
+
+ # create doxygen config file at first
+ self._configFile = doxygen.DoxygenConfigFile()
+ self._configFile.SetOutputDir(self._outputPath)
+
+ self._configFile.SetWarningFilePath(os.path.join(self._outputPath, 'warning.txt'))
+ if self._mode.lower() == 'html':
+ self._configFile.SetHtmlMode()
+ else:
+ self._configFile.SetChmMode()
+
+ self.Log(" >>>>>> Initialize doxygen config file...Zzz...\n")
+ self.InitializeConfigFile()
+
+ self.Log(" >>>>>> Generate doxygen index page file...Zzz...\n")
+ indexPagePath = self.GenerateIndexPage()
+ if indexPagePath is None:
+ self.Log("Fail to generate index page!\n", 'error')
+ return False
+ else:
+ self.Log("Success to create doxygen index page file %s \n" % indexPagePath)
+
+ # Add index page doxygen file to file list.
+ self._configFile.AddFile(indexPagePath)
+
+ # save config file to output path
+ configFilePath = os.path.join(self._outputPath, self._projname + '.doxygen_config')
+ self._configFile.Generate(configFilePath)
+ self.Log(" <<<<<< Success Save doxygen config file to %s...\n" % configFilePath)
+
+ # launch doxygen tool to generate document
+ if self._doxygenCallback is not None:
+ self.Log(" >>>>>> Start doxygen process...Zzz...\n")
+ if not self._doxygenCallback(self._doxPath, configFilePath):
+ return False
+ else:
+ self.Log("Fail to create doxygen process!", 'error')
+ return False
+
+ return True
+
+ def InitializeConfigFile(self):
+ """Initialize config setting for doxygen project. It will be invoked after config file
+ object is created. Inherited class should implement it.
+ """
+
+ def GenerateIndexPage(self):
+ """Generate doxygen index page. Inherited class should implement it."""
+ return None
+
+ def RegisterCallbackDoxygenProcess(self, callback):
+ self._doxygenCallback = callback
+
+ def RegisterCallbackCHMProcess(self, callback):
+ self._chmCallback = callback
+
+class PlatformDocumentAction(DoxygenAction):
+ """Generate platform doxygen document, will be implement at future."""
+
+class PackageDocumentAction(DoxygenAction):
+ """Generate package reference document"""
+
+ def __init__(self, doxPath, chmPath, outputPath, pObj, mode='html', log=None, arch=None, tooltag=None,
+ macros=[], onlyInclude=False, verbose=False):
+ DoxygenAction.__init__(self, doxPath, chmPath, outputPath, pObj.GetName(), mode, log, verbose)
+ self._pObj = pObj
+ self._arch = arch
+ self._tooltag = tooltag
+ self._macros = macros
+ self._onlyIncludeDocument = onlyInclude
+
+ def InitializeConfigFile(self):
+ if self._arch == 'IA32':
+ self._configFile.AddPreDefined('MDE_CPU_IA32')
+ elif self._arch == 'X64':
+ self._configFile.AddPreDefined('MDE_CPU_X64')
+ elif self._arch == 'IPF':
+ self._configFile.AddPreDefined('MDE_CPU_IPF')
+ elif self._arch == 'EBC':
+ self._configFile.AddPreDefined('MDE_CPU_EBC')
+ else:
+ self._arch = None
+ self._configFile.AddPreDefined('MDE_CPU_IA32')
+ self._configFile.AddPreDefined('MDE_CPU_X64')
+ self._configFile.AddPreDefined('MDE_CPU_IPF')
+ self._configFile.AddPreDefined('MDE_CPU_EBC')
+ self._configFile.AddPreDefined('MDE_CPU_ARM')
+
+ for macro in self._macros:
+ self._configFile.AddPreDefined(macro)
+
+ namestr = self._pObj.GetName()
+ if self._arch is not None:
+ namestr += '[%s]' % self._arch
+ if self._tooltag is not None:
+ namestr += '[%s]' % self._tooltag
+ self._configFile.SetProjectName(namestr)
+ self._configFile.SetStripPath(self._pObj.GetWorkspace())
+ self._configFile.SetProjectVersion(self._pObj.GetFileObj().GetVersion())
+ self._configFile.AddPattern('*.decdoxygen')
+
+ if self._tooltag.lower() == 'msft':
+ self._configFile.AddPreDefined('_MSC_EXTENSIONS')
+ elif self._tooltag.lower() == 'gnu':
+ self._configFile.AddPreDefined('__GNUC__')
+ elif self._tooltag.lower() == 'intel':
+ self._configFile.AddPreDefined('__INTEL_COMPILER')
+ else:
+ self._tooltag = None
+ self._configFile.AddPreDefined('_MSC_EXTENSIONS')
+ self._configFile.AddPreDefined('__GNUC__')
+ self._configFile.AddPreDefined('__INTEL_COMPILER')
+
+ self._configFile.AddPreDefined('ASM_PFX= ')
+ self._configFile.AddPreDefined('OPTIONAL= ')
+
+ def GenerateIndexPage(self):
+ """Generate doxygen index page. Inherited class should implement it."""
+ fObj = self._pObj.GetFileObj()
+ pdObj = doxygen.DoxygenFile('%s Package Document' % self._pObj.GetName(),
+ '%s.decdoxygen' % self._pObj.GetFilename())
+ self._configFile.AddFile(pdObj.GetFilename())
+ pdObj.AddDescription(fObj.GetFileHeader())
+
+ defSection = fObj.GetSectionByName('defines')[0]
+ baseSection = doxygen.Section('PackageBasicInformation', 'Package Basic Information')
+ descr = '<TABLE>'
+ for obj in defSection.GetObjects():
+ if obj.GetKey() in _dec_key_description_mapping_table.keys():
+ descr += '<TR>'
+ descr += '<TD><B>%s</B></TD>' % _dec_key_description_mapping_table[obj.GetKey()]
+ descr += '<TD>%s</TD>' % obj.GetValue()
+ descr += '</TR>'
+ descr += '</TABLE><br>'
+ baseSection.AddDescription(descr)
+ pdObj.AddSection(baseSection)
+
+ knownIssueSection = doxygen.Section('Known_Issue_section', 'Known Issue')
+ knownIssueSection.AddDescription('<ul>')
+ knownIssueSection.AddDescription('<li> OPTIONAL macro for function parameter can not be dealed with doxygen, so it disapear in this document! </li>')
+ knownIssueSection.AddDescription('</ul>')
+ pdObj.AddSection(knownIssueSection)
+
+ self.AddAllIncludeFiles(self._pObj, self._configFile)
+ pages = self.GenerateIncludesSubPage(self._pObj, self._configFile)
+ if len(pages) != 0:
+ pdObj.AddPages(pages)
+ pages = self.GenerateLibraryClassesSubPage(self._pObj, self._configFile)
+ if len(pages) != 0:
+ pdObj.AddPages(pages)
+ pages = self.GeneratePcdSubPages(self._pObj, self._configFile)
+ if len(pages) != 0:
+ pdObj.AddPages(pages)
+ pages = self.GenerateGuidSubPages(self._pObj, self._configFile)
+ if len(pages) != 0:
+ pdObj.AddPages(pages)
+ pages = self.GeneratePpiSubPages(self._pObj, self._configFile)
+ if len(pages) != 0:
+ pdObj.AddPages(pages)
+ pages = self.GenerateProtocolSubPages(self._pObj, self._configFile)
+ if len(pages) != 0:
+ pdObj.AddPages(pages)
+ if not self._onlyIncludeDocument:
+ pdObj.AddPages(self.GenerateModulePages(self._pObj, self._configFile))
+
+ pdObj.Save()
+ return pdObj.GetFilename()
+
+ def GenerateIncludesSubPage(self, pObj, configFile):
+ # by default add following path as include path to config file
+ pkpath = pObj.GetFileObj().GetPackageRootPath()
+ configFile.AddIncludePath(os.path.join(pkpath, 'Include'))
+ configFile.AddIncludePath(os.path.join(pkpath, 'Include', 'Library'))
+ configFile.AddIncludePath(os.path.join(pkpath, 'Include', 'Protocol'))
+ configFile.AddIncludePath(os.path.join(pkpath, 'Include', 'Ppi'))
+ configFile.AddIncludePath(os.path.join(pkpath, 'Include', 'Guid'))
+ configFile.AddIncludePath(os.path.join(pkpath, 'Include', 'IndustryStandard'))
+
+ rootArray = []
+ pageRoot = doxygen.Page("Public Includes", "%s_public_includes" % pObj.GetName())
+ objs = pObj.GetFileObj().GetSectionObjectsByName('includes')
+ if len(objs) == 0: return []
+
+ for obj in objs:
+ # Add path to include path
+ path = os.path.join(pObj.GetFileObj().GetPackageRootPath(), obj.GetPath())
+ configFile.AddIncludePath(path)
+
+ # only list common folder's include file
+ if obj.GetArch().lower() != 'common':
+ continue
+
+ bNeedAddIncludePage = False
+ topPage = doxygen.Page(self._ConvertPathToDoxygen(path, pObj), 'public_include_top')
+
+ topPage.AddDescription('<ul>\n')
+ for file in os.listdir(path):
+ if file.lower() in _ignore_dir: continue
+ fullpath = os.path.join(path, file)
+ if os.path.isfile(fullpath):
+ self.ProcessSourceFileForInclude(fullpath, pObj, configFile)
+ topPage.AddDescription('<li> \link %s\endlink </li>\n' % self._ConvertPathToDoxygen(fullpath, pObj))
+ else:
+ if file.lower() in ['library', 'protocol', 'guid', 'ppi', 'ia32', 'x64', 'ipf', 'ebc', 'arm', 'pi', 'uefi', 'aarch64']:
+ continue
+ bNeedAddSubPage = False
+ subpage = doxygen.Page(self._ConvertPathToDoxygen(fullpath, pObj), 'public_include_%s' % file)
+ subpage.AddDescription('<ul>\n')
+ for subfile in os.listdir(fullpath):
+ if subfile.lower() in _ignore_dir: continue
+ bNeedAddSubPage = True
+ subfullpath = os.path.join(fullpath, subfile)
+ self.ProcessSourceFileForInclude(subfullpath, pObj, configFile)
+ subpage.AddDescription('<li> \link %s \endlink </li>\n' % self._ConvertPathToDoxygen(subfullpath, pObj))
+ subpage.AddDescription('</ul>\n')
+ if bNeedAddSubPage:
+ bNeedAddIncludePage = True
+ pageRoot.AddPage(subpage)
+ topPage.AddDescription('</ul>\n')
+ if bNeedAddIncludePage:
+ pageRoot.AddPage(topPage)
+
+ if pageRoot.GetSubpageCount() != 0:
+ return [pageRoot]
+ else:
+ return []
+
+ def GenerateLibraryClassesSubPage(self, pObj, configFile):
+ """
+ Generate sub page for library class for package.
+ One DEC file maybe contains many library class sections
+ for different architecture.
+
+ @param fObj DEC file object.
+ """
+ rootArray = []
+ pageRoot = doxygen.Page("Library Class", "%s_libraryclass" % pObj.GetName())
+ objs = pObj.GetFileObj().GetSectionObjectsByName('libraryclass', self._arch)
+ if len(objs) == 0: return []
+
+ if self._arch is not None:
+ for obj in objs:
+ classPage = doxygen.Page(obj.GetClassName(),
+ "lc_%s" % obj.GetClassName())
+ comments = obj.GetComment()
+ if len(comments) != 0:
+ classPage.AddDescription('<br>\n'.join(comments) + '<br>\n')
+ pageRoot.AddPage(classPage)
+ path = os.path.join(pObj.GetFileObj().GetPackageRootPath(), obj.GetHeaderFile())
+ path = path[len(pObj.GetWorkspace()) + 1:]
+ if len(comments) == 0:
+ classPage.AddDescription('\copydoc %s<p>' % obj.GetHeaderFile())
+ section = doxygen.Section('ref', 'Refer to Header File')
+ section.AddDescription('\link %s\n' % obj.GetHeaderFile())
+ section.AddDescription(' \endlink<p>\n')
+ classPage.AddSection(section)
+ fullPath = os.path.join(pObj.GetFileObj().GetPackageRootPath(), obj.GetHeaderFile())
+ self.ProcessSourceFileForInclude(fullPath, pObj, configFile)
+ else:
+ archPageDict = {}
+ for obj in objs:
+ if obj.GetArch() not in archPageDict.keys():
+ archPageDict[obj.GetArch()] = doxygen.Page(obj.GetArch(),
+ 'lc_%s' % obj.GetArch())
+ pageRoot.AddPage(archPageDict[obj.GetArch()])
+ subArchRoot = archPageDict[obj.GetArch()]
+ classPage = doxygen.Page(obj.GetClassName(),
+ "lc_%s" % obj.GetClassName())
+ comments = obj.GetComment()
+ if len(comments) != 0:
+ classPage.AddDescription('<br>\n'.join(comments) + '<br>\n')
+ subArchRoot.AddPage(classPage)
+ path = os.path.join(pObj.GetFileObj().GetPackageRootPath(), obj.GetHeaderFile())
+ path = path[len(pObj.GetWorkspace()) + 1:]
+ if len(comments) == 0:
+ classPage.AddDescription('\copydoc %s<p>' % obj.GetHeaderFile())
+ section = doxygen.Section('ref', 'Refer to Header File')
+ section.AddDescription('\link %s\n' % obj.GetHeaderFile())
+ section.AddDescription(' \endlink<p>\n')
+ classPage.AddSection(section)
+ fullPath = os.path.join(pObj.GetFileObj().GetPackageRootPath(), obj.GetHeaderFile())
+
+ self.ProcessSourceFileForInclude(fullPath, pObj, configFile)
+ rootArray.append(pageRoot)
+ return rootArray
+
+ def ProcessSourceFileForInclude(self, path, pObj, configFile, infObj=None):
+ """
+ @param path the analysising file full path
+ @param pObj package object
+ @param configFile doxygen config file.
+ """
+
+ if gInGui:
+ wx.Yield()
+ if not os.path.exists(path):
+ ErrorMsg('Source file path %s does not exist!' % path)
+ return
+
+ if configFile.FileExists(path):
+ return
+
+ try:
+ f = open(path, 'r')
+ lines = f.readlines()
+ f.close()
+ except IOError:
+ ErrorMsg('Fail to open file %s' % path)
+ return
+
+ configFile.AddFile(path)
+ return
+ no = 0
+ for no in range(len(lines)):
+ if len(lines[no].strip()) == 0:
+ continue
+ if lines[no].strip()[:2] in ['##', '//', '/*', '*/']:
+ continue
+ index = lines[no].lower().find('include')
+ #mo = IncludePattern.finditer(lines[no].lower())
+ mo = re.match(r"^#\s*include\s+[<\"]([\\/\w.]+)[>\"]$", lines[no].strip().lower())
+ if not mo:
+ continue
+ mo = re.match(r"^[#\w\s]+[<\"]([\\/\w.]+)[>\"]$", lines[no].strip())
+ filePath = mo.groups()[0]
+
+ if filePath is None or len(filePath) == 0:
+ continue
+
+ # find header file in module's path firstly.
+ fullPath = None
+
+ if os.path.exists(os.path.join(os.path.dirname(path), filePath)):
+ # Find the file in current directory
+ fullPath = os.path.join(os.path.dirname(path), filePath).replace('\\', '/')
+ else:
+ # find in depedent package's include path
+ incObjs = pObj.GetFileObj().GetSectionObjectsByName('includes')
+ for incObj in incObjs:
+ incPath = os.path.join(pObj.GetFileObj().GetPackageRootPath(), incObj.GetPath()).strip()
+ incPath = os.path.realpath(os.path.join(incPath, filePath))
+ if os.path.exists(incPath):
+ fullPath = incPath
+ break
+ if infObj is not None:
+ pkgInfObjs = infObj.GetSectionObjectsByName('packages')
+ for obj in pkgInfObjs:
+ decObj = dec.DECFile(os.path.join(pObj.GetWorkspace(), obj.GetPath()))
+ if not decObj:
+ ErrorMsg ('Fail to create pacakge object for %s' % obj.GetPackageName())
+ continue
+ if not decObj.Parse():
+ ErrorMsg ('Fail to load package object for %s' % obj.GetPackageName())
+ continue
+ incObjs = decObj.GetSectionObjectsByName('includes')
+ for incObj in incObjs:
+ incPath = os.path.join(decObj.GetPackageRootPath(), incObj.GetPath()).replace('\\', '/')
+ if os.path.exists(os.path.join(incPath, filePath)):
+ fullPath = os.path.join(os.path.join(incPath, filePath))
+ break
+ if fullPath is not None:
+ break
+
+ if fullPath is None and self.IsVerbose():
+ self.Log('Can not resolve header file %s for file %s in package %s\n' % (filePath, path, pObj.GetFileObj().GetFilename()), 'error')
+ return
+ else:
+ fullPath = fullPath.replace('\\', '/')
+ if self.IsVerbose():
+ self.Log('Preprocessing: Add include file %s for file %s\n' % (fullPath, path))
+ #LogMsg ('Preprocessing: Add include file %s for file %s' % (fullPath, path))
+ self.ProcessSourceFileForInclude(fullPath, pObj, configFile, infObj)
+
+ def AddAllIncludeFiles(self, pObj, configFile):
+ objs = pObj.GetFileObj().GetSectionObjectsByName('includes')
+ for obj in objs:
+ incPath = os.path.join(pObj.GetFileObj().GetPackageRootPath(), obj.GetPath())
+ for root, dirs, files in os.walk(incPath):
+ for dir in dirs:
+ if dir.lower() in _ignore_dir:
+ dirs.remove(dir)
+ for file in files:
+ path = os.path.normpath(os.path.join(root, file))
+ configFile.AddFile(path.replace('/', '\\'))
+
+ def GeneratePcdSubPages(self, pObj, configFile):
+ """
+ Generate sub pages for package's PCD definition.
+ @param pObj package object
+ @param configFile config file object
+ """
+ rootArray = []
+ objs = pObj.GetFileObj().GetSectionObjectsByName('pcd')
+ if len(objs) == 0:
+ return []
+
+ pcdRootPage = doxygen.Page('PCD', 'pcd_root_page')
+ typeRootPageDict = {}
+ typeArchRootPageDict = {}
+ for obj in objs:
+ if obj.GetPcdType() not in typeRootPageDict.keys():
+ typeRootPageDict[obj.GetPcdType()] = doxygen.Page(obj.GetPcdType(), 'pcd_%s_root_page' % obj.GetPcdType())
+ pcdRootPage.AddPage(typeRootPageDict[obj.GetPcdType()])
+ typeRoot = typeRootPageDict[obj.GetPcdType()]
+ if self._arch is not None:
+ pcdPage = doxygen.Page('%s' % obj.GetPcdName(),
+ 'pcd_%s_%s_%s' % (obj.GetPcdType(), obj.GetArch(), obj.GetPcdName().split('.')[1]))
+ pcdPage.AddDescription('<br>\n'.join(obj.GetComment()) + '<br>\n')
+ section = doxygen.Section('PCDinformation', 'PCD Information')
+ desc = '<TABLE>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>Name</CAPTION></TD>'
+ desc += '<TD><CAPTION>Token Space</CAPTION></TD>'
+ desc += '<TD><CAPTION>Token number</CAPTION></TD>'
+ desc += '<TD><CAPTION>Data Type</CAPTION></TD>'
+ desc += '<TD><CAPTION>Default Value</CAPTION></TD>'
+ desc += '</TR>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdName().split('.')[1]
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdName().split('.')[0]
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdToken()
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdDataType()
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdValue()
+ desc += '</TR>'
+ desc += '</TABLE>'
+ section.AddDescription(desc)
+ pcdPage.AddSection(section)
+ typeRoot.AddPage(pcdPage)
+ else:
+ keystr = obj.GetPcdType() + obj.GetArch()
+ if keystr not in typeArchRootPageDict.keys():
+ typeArchRootPage = doxygen.Page(obj.GetArch(), 'pcd_%s_%s_root_page' % (obj.GetPcdType(), obj.GetArch()))
+ typeArchRootPageDict[keystr] = typeArchRootPage
+ typeRoot.AddPage(typeArchRootPage)
+ typeArchRoot = typeArchRootPageDict[keystr]
+ pcdPage = doxygen.Page('%s' % obj.GetPcdName(),
+ 'pcd_%s_%s_%s' % (obj.GetPcdType(), obj.GetArch(), obj.GetPcdName().split('.')[1]))
+ pcdPage.AddDescription('<br>\n'.join(obj.GetComment()) + '<br>\n')
+ section = doxygen.Section('PCDinformation', 'PCD Information')
+ desc = '<TABLE>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>Name</CAPTION></TD>'
+ desc += '<TD><CAPTION>Token Space</CAPTION></TD>'
+ desc += '<TD><CAPTION>Token number</CAPTION></TD>'
+ desc += '<TD><CAPTION>Data Type</CAPTION></TD>'
+ desc += '<TD><CAPTION>Default Value</CAPTION></TD>'
+ desc += '</TR>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdName().split('.')[1]
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdName().split('.')[0]
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdToken()
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdDataType()
+ desc += '<TD><CAPTION>%s</CAPTION></TD>' % obj.GetPcdValue()
+ desc += '</TR>'
+ desc += '</TABLE>'
+ section.AddDescription(desc)
+ pcdPage.AddSection(section)
+ typeArchRoot.AddPage(pcdPage)
+ return [pcdRootPage]
+
+ def _GenerateGuidSubPage(self, pObj, obj, configFile):
+ guidPage = doxygen.Page('%s' % obj.GetName(),
+ 'guid_%s_%s' % (obj.GetArch(), obj.GetName()))
+ comments = obj.GetComment()
+ if len(comments) != 0:
+ guidPage.AddDescription('<br>'.join(obj.GetComment()) + '<br>')
+ section = doxygen.Section('BasicGuidInfo', 'GUID Information')
+ desc = '<TABLE>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>GUID\'s Guid Name</CAPTION></TD><TD><CAPTION>GUID\'s Guid</CAPTION></TD>'
+ desc += '</TR>'
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % obj.GetName()
+ desc += '<TD>%s</TD>' % obj.GetGuid()
+ desc += '</TR>'
+ desc += '</TABLE>'
+ section.AddDescription(desc)
+ guidPage.AddSection(section)
+ refFile = self.FindHeaderFileForGuid(pObj, obj.GetName(), configFile)
+ if refFile:
+ relPath = refFile[len(pObj.GetWorkspace()) + 1:]
+ if len(comments) == 0:
+ guidPage.AddDescription(' \\copydoc %s <br>' % relPath)
+
+ section = doxygen.Section('ref', 'Refer to Header File')
+ section.AddDescription('\link %s\n' % relPath)
+ section.AddDescription('\endlink\n')
+ self.ProcessSourceFileForInclude(refFile, pObj, configFile)
+ guidPage.AddSection(section)
+ return guidPage
+
+ def GenerateGuidSubPages(self, pObj, configFile):
+ """
+ Generate sub pages for package's GUID definition.
+ @param pObj package object
+ @param configFilf doxygen config file object
+ """
+ pageRoot = doxygen.Page('GUID', 'guid_root_page')
+ objs = pObj.GetFileObj().GetSectionObjectsByName('guids', self._arch)
+ if len(objs) == 0: return []
+ if self._arch is not None:
+ for obj in objs:
+ pageRoot.AddPage(self._GenerateGuidSubPage(pObj, obj, configFile))
+ else:
+ guidArchRootPageDict = {}
+ for obj in objs:
+ if obj.GetArch() not in guidArchRootPageDict.keys():
+ guidArchRoot = doxygen.Page(obj.GetArch(), 'guid_arch_root_%s' % obj.GetArch())
+ pageRoot.AddPage(guidArchRoot)
+ guidArchRootPageDict[obj.GetArch()] = guidArchRoot
+ guidArchRoot = guidArchRootPageDict[obj.GetArch()]
+ guidArchRoot.AddPage(self._GenerateGuidSubPage(pObj, obj, configFile))
+ return [pageRoot]
+
+ def _GeneratePpiSubPage(self, pObj, obj, configFile):
+ guidPage = doxygen.Page(obj.GetName(), 'ppi_page_%s' % obj.GetName())
+ comments = obj.GetComment()
+ if len(comments) != 0:
+ guidPage.AddDescription('<br>'.join(obj.GetComment()) + '<br>')
+ section = doxygen.Section('BasicPpiInfo', 'PPI Information')
+ desc = '<TABLE>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>PPI\'s Guid Name</CAPTION></TD><TD><CAPTION>PPI\'s Guid</CAPTION></TD>'
+ desc += '</TR>'
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % obj.GetName()
+ desc += '<TD>%s</TD>' % obj.GetGuid()
+ desc += '</TR>'
+ desc += '</TABLE>'
+ section.AddDescription(desc)
+ guidPage.AddSection(section)
+ refFile = self.FindHeaderFileForGuid(pObj, obj.GetName(), configFile)
+ if refFile:
+ relPath = refFile[len(pObj.GetWorkspace()) + 1:]
+ if len(comments) == 0:
+ guidPage.AddDescription(' \\copydoc %s <br>' % relPath)
+ section = doxygen.Section('ref', 'Refer to Header File')
+ section.AddDescription('\link %s\n' % relPath)
+ section.AddDescription('\endlink\n')
+ self.ProcessSourceFileForInclude(refFile, pObj, configFile)
+ guidPage.AddSection(section)
+
+ return guidPage
+
+ def GeneratePpiSubPages(self, pObj, configFile):
+ """
+ Generate sub pages for package's GUID definition.
+ @param pObj package object
+ @param configFilf doxygen config file object
+ """
+ pageRoot = doxygen.Page('PPI', 'ppi_root_page')
+ objs = pObj.GetFileObj().GetSectionObjectsByName('ppis', self._arch)
+ if len(objs) == 0: return []
+ if self._arch is not None:
+ for obj in objs:
+ pageRoot.AddPage(self._GeneratePpiSubPage(pObj, obj, configFile))
+ else:
+ guidArchRootPageDict = {}
+ for obj in objs:
+ if obj.GetArch() not in guidArchRootPageDict.keys():
+ guidArchRoot = doxygen.Page(obj.GetArch(), 'ppi_arch_root_%s' % obj.GetArch())
+ pageRoot.AddPage(guidArchRoot)
+ guidArchRootPageDict[obj.GetArch()] = guidArchRoot
+ guidArchRoot = guidArchRootPageDict[obj.GetArch()]
+ guidArchRoot.AddPage(self._GeneratePpiSubPage(pObj, obj, configFile))
+ return [pageRoot]
+
+ def _GenerateProtocolSubPage(self, pObj, obj, configFile):
+ guidPage = doxygen.Page(obj.GetName(), 'protocol_page_%s' % obj.GetName())
+ comments = obj.GetComment()
+ if len(comments) != 0:
+ guidPage.AddDescription('<br>'.join(obj.GetComment()) + '<br>')
+ section = doxygen.Section('BasicProtocolInfo', 'PROTOCOL Information')
+ desc = '<TABLE>'
+ desc += '<TR>'
+ desc += '<TD><CAPTION>PROTOCOL\'s Guid Name</CAPTION></TD><TD><CAPTION>PROTOCOL\'s Guid</CAPTION></TD>'
+ desc += '</TR>'
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % obj.GetName()
+ desc += '<TD>%s</TD>' % obj.GetGuid()
+ desc += '</TR>'
+ desc += '</TABLE>'
+ section.AddDescription(desc)
+ guidPage.AddSection(section)
+
+ refFile = self.FindHeaderFileForGuid(pObj, obj.GetName(), configFile)
+ if refFile:
+ relPath = refFile[len(pObj.GetWorkspace()) + 1:]
+ if len(comments) == 0:
+ guidPage.AddDescription(' \\copydoc %s <br>' % relPath)
+ section = doxygen.Section('ref', 'Refer to Header File')
+ section.AddDescription('\link %s\n' % relPath)
+ section.AddDescription('\endlink\n')
+ self.ProcessSourceFileForInclude(refFile, pObj, configFile)
+ guidPage.AddSection(section)
+
+ return guidPage
+
+ def GenerateProtocolSubPages(self, pObj, configFile):
+ """
+ Generate sub pages for package's GUID definition.
+ @param pObj package object
+ @param configFilf doxygen config file object
+ """
+ pageRoot = doxygen.Page('PROTOCOL', 'protocol_root_page')
+ objs = pObj.GetFileObj().GetSectionObjectsByName('protocols', self._arch)
+ if len(objs) == 0: return []
+ if self._arch is not None:
+ for obj in objs:
+ pageRoot.AddPage(self._GenerateProtocolSubPage(pObj, obj, configFile))
+ else:
+ guidArchRootPageDict = {}
+ for obj in objs:
+ if obj.GetArch() not in guidArchRootPageDict.keys():
+ guidArchRoot = doxygen.Page(obj.GetArch(), 'protocol_arch_root_%s' % obj.GetArch())
+ pageRoot.AddPage(guidArchRoot)
+ guidArchRootPageDict[obj.GetArch()] = guidArchRoot
+ guidArchRoot = guidArchRootPageDict[obj.GetArch()]
+ guidArchRoot.AddPage(self._GenerateProtocolSubPage(pObj, obj, configFile))
+ return [pageRoot]
+
+ def FindHeaderFileForGuid(self, pObj, name, configFile):
+ """
+ For declaration header file for GUID/PPI/Protocol.
+
+ @param pObj package object
+ @param name guid/ppi/protocol's name
+ @param configFile config file object
+
+ @return full path of header file and None if not found.
+ """
+ startPath = pObj.GetFileObj().GetPackageRootPath()
+ incPath = os.path.join(startPath, 'Include').replace('\\', '/')
+ # if <PackagePath>/include exist, then search header under it.
+ if os.path.exists(incPath):
+ startPath = incPath
+
+ for root, dirs, files in os.walk(startPath):
+ for dir in dirs:
+ if dir.lower() in _ignore_dir:
+ dirs.remove(dir)
+ for file in files:
+ fPath = os.path.join(root, file)
+ if not IsCHeaderFile(fPath):
+ continue
+ try:
+ f = open(fPath, 'r')
+ lines = f.readlines()
+ f.close()
+ except IOError:
+ self.Log('Fail to open file %s\n' % fPath)
+ continue
+ for line in lines:
+ if line.find(name) != -1 and \
+ line.find('extern') != -1:
+ return fPath.replace('\\', '/')
+ return None
+
+ def GetPackageModuleList(self, pObj):
+ """
+ Get all module's INF path under package's root path
+ @param pObj package object
+ @return arrary of INF full path
+ """
+ mArray = []
+ packPath = pObj.GetFileObj().GetPackageRootPath()
+ if not os.path.exists:
+ return None
+ for root, dirs, files in os.walk(packPath):
+ for dir in dirs:
+ if dir.lower() in _ignore_dir:
+ dirs.remove(dir)
+ for file in files:
+ if CheckPathPostfix(file, 'inf'):
+ fPath = os.path.join(root, file).replace('\\', '/')
+ mArray.append(fPath)
+ return mArray
+
+ def GenerateModulePages(self, pObj, configFile):
+ """
+ Generate sub pages for package's module which is under the package
+ root directory.
+
+ @param pObj package object
+ @param configFilf doxygen config file object
+ """
+ infList = self.GetPackageModuleList(pObj)
+ rootPages = []
+ libObjs = []
+ modObjs = []
+ for infpath in infList:
+ infObj = inf.INFFile(infpath)
+ #infObj = INFFileObject.INFFile (pObj.GetWorkspacePath(),
+ # inf)
+ if not infObj:
+ self.Log('Fail create INF object for %s' % inf)
+ continue
+ if not infObj.Parse():
+ self.Log('Fail to load INF file %s' % inf)
+ continue
+ if infObj.GetProduceLibraryClass() is not None:
+ libObjs.append(infObj)
+ else:
+ modObjs.append(infObj)
+
+ if len(libObjs) != 0:
+ libRootPage = doxygen.Page('Libraries', 'lib_root_page')
+ rootPages.append(libRootPage)
+ for libInf in libObjs:
+ libRootPage.AddPage(self.GenerateModulePage(pObj, libInf, configFile, True))
+
+ if len(modObjs) != 0:
+ modRootPage = doxygen.Page('Modules', 'module_root_page')
+ rootPages.append(modRootPage)
+ for modInf in modObjs:
+ modRootPage.AddPage(self.GenerateModulePage(pObj, modInf, configFile, False))
+
+ return rootPages
+
+ def GenerateModulePage(self, pObj, infObj, configFile, isLib):
+ """
+ Generate page for a module/library.
+ @param infObj INF file object for module/library
+ @param configFile doxygen config file object
+ @param isLib Whether this module is library
+
+ @param module doxygen page object
+ """
+ workspace = pObj.GetWorkspace()
+ refDecObjs = []
+ for obj in infObj.GetSectionObjectsByName('packages'):
+ decObj = dec.DECFile(os.path.join(workspace, obj.GetPath()))
+ if not decObj:
+ ErrorMsg ('Fail to create pacakge object for %s' % obj.GetPackageName())
+ continue
+ if not decObj.Parse():
+ ErrorMsg ('Fail to load package object for %s' % obj.GetPackageName())
+ continue
+ refDecObjs.append(decObj)
+
+ modPage = doxygen.Page('%s' % infObj.GetBaseName(),
+ 'module_%s' % infObj.GetBaseName())
+ modPage.AddDescription(infObj.GetFileHeader())
+
+ basicInfSection = doxygen.Section('BasicModuleInformation', 'Basic Module Information')
+ desc = "<TABLE>"
+ for obj in infObj.GetSectionObjectsByName('defines'):
+ key = obj.GetKey()
+ value = obj.GetValue()
+ if key not in _inf_key_description_mapping_table.keys(): continue
+ if key == 'LIBRARY_CLASS' and value.find('|') != -1:
+ clsname, types = value.split('|')
+ desc += '<TR>'
+ desc += '<TD><B>%s</B></TD>' % _inf_key_description_mapping_table[key]
+ desc += '<TD>%s</TD>' % clsname
+ desc += '</TR>'
+
+ desc += '<TR>'
+ desc += '<TD><B>Supported Module Types</B></TD>'
+ desc += '<TD>%s</TD>' % types
+ desc += '</TR>'
+ else:
+ desc += '<TR>'
+ desc += '<TD><B>%s</B></TD>' % _inf_key_description_mapping_table[key]
+ if key == 'EFI_SPECIFICATION_VERSION' and value == '0x00020000':
+ value = '2.0'
+ desc += '<TD>%s</TD>' % value
+ desc += '</TR>'
+ desc += '</TABLE>'
+ basicInfSection.AddDescription(desc)
+ modPage.AddSection(basicInfSection)
+
+ # Add protocol section
+ data = []
+ for obj in infObj.GetSectionObjectsByName('pcd', self._arch):
+ data.append(obj.GetPcdName().strip())
+ if len(data) != 0:
+ s = doxygen.Section('Pcds', 'Pcds')
+ desc = "<TABLE>"
+ desc += '<TR><TD><B>PCD Name</B></TD><TD><B>TokenSpace</B></TD><TD><B>Package</B></TD></TR>'
+ for item in data:
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % item.split('.')[1]
+ desc += '<TD>%s</TD>' % item.split('.')[0]
+ pkgbasename = self.SearchPcdPackage(item, workspace, refDecObjs)
+ desc += '<TD>%s</TD>' % pkgbasename
+ desc += '</TR>'
+ desc += "</TABLE>"
+ s.AddDescription(desc)
+ modPage.AddSection(s)
+
+ # Add protocol section
+ #sects = infObj.GetSectionByString('protocol')
+ data = []
+ #for sect in sects:
+ for obj in infObj.GetSectionObjectsByName('protocol', self._arch):
+ data.append(obj.GetName().strip())
+ if len(data) != 0:
+ s = doxygen.Section('Protocols', 'Protocols')
+ desc = "<TABLE>"
+ desc += '<TR><TD><B>Name</B></TD><TD><B>Package</B></TD></TR>'
+ for item in data:
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % item
+ pkgbasename = self.SearchProtocolPackage(item, workspace, refDecObjs)
+ desc += '<TD>%s</TD>' % pkgbasename
+ desc += '</TR>'
+ desc += "</TABLE>"
+ s.AddDescription(desc)
+ modPage.AddSection(s)
+
+ # Add ppi section
+ #sects = infObj.GetSectionByString('ppi')
+ data = []
+ #for sect in sects:
+ for obj in infObj.GetSectionObjectsByName('ppi', self._arch):
+ data.append(obj.GetName().strip())
+ if len(data) != 0:
+ s = doxygen.Section('Ppis', 'Ppis')
+ desc = "<TABLE>"
+ desc += '<TR><TD><B>Name</B></TD><TD><B>Package</B></TD></TR>'
+ for item in data:
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % item
+ pkgbasename = self.SearchPpiPackage(item, workspace, refDecObjs)
+ desc += '<TD>%s</TD>' % pkgbasename
+ desc += '</TR>'
+ desc += "</TABLE>"
+ s.AddDescription(desc)
+ modPage.AddSection(s)
+
+ # Add guid section
+ #sects = infObj.GetSectionByString('guid')
+ data = []
+ #for sect in sects:
+ for obj in infObj.GetSectionObjectsByName('guid', self._arch):
+ data.append(obj.GetName().strip())
+ if len(data) != 0:
+ s = doxygen.Section('Guids', 'Guids')
+ desc = "<TABLE>"
+ desc += '<TR><TD><B>Name</B></TD><TD><B>Package</B></TD></TR>'
+ for item in data:
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % item
+ pkgbasename = self.SearchGuidPackage(item, workspace, refDecObjs)
+ desc += '<TD>%s</TD>' % pkgbasename
+ desc += '</TR>'
+ desc += "</TABLE>"
+ s.AddDescription(desc)
+ modPage.AddSection(s)
+
+ section = doxygen.Section('LibraryClasses', 'Library Classes')
+ desc = "<TABLE>"
+ desc += '<TR><TD><B>Name</B></TD><TD><B>Type</B></TD><TD><B>Package</B></TD><TD><B>Header File</B></TD></TR>'
+ if isLib:
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % infObj.GetProduceLibraryClass()
+ desc += '<TD>Produce</TD>'
+ try:
+ pkgname, hPath = self.SearchLibraryClassHeaderFile(infObj.GetProduceLibraryClass(),
+ workspace,
+ refDecObjs)
+ except:
+ self.Log ('fail to get package header file for lib class %s' % infObj.GetProduceLibraryClass())
+ pkgname = 'NULL'
+ hPath = 'NULL'
+ desc += '<TD>%s</TD>' % pkgname
+ if hPath != "NULL":
+ #desc += '<TD>\link %s \endlink</TD>' % hPath
+ desc += '<TD>%s</TD>' % hPath
+ else:
+ desc += '<TD>%s</TD>' % hPath
+ desc += '</TR>'
+ for lcObj in infObj.GetSectionObjectsByName('libraryclasses', self._arch):
+ desc += '<TR>'
+ desc += '<TD>%s</TD>' % lcObj.GetClass()
+ retarr = self.SearchLibraryClassHeaderFile(lcObj.GetClass(),
+ workspace,
+ refDecObjs)
+ if retarr is not None:
+ pkgname, hPath = retarr
+ else:
+ self.Log('Fail find the library class %s definition from module %s dependent package!' % (lcObj.GetClass(), infObj.GetFilename()), 'error')
+ pkgname = 'NULL'
+ hPath = 'NULL'
+ desc += '<TD>Consume</TD>'
+ desc += '<TD>%s</TD>' % pkgname
+ desc += '<TD>%s</TD>' % hPath
+ desc += '</TR>'
+ desc += "</TABLE>"
+ section.AddDescription(desc)
+ modPage.AddSection(section)
+
+ section = doxygen.Section('SourceFiles', 'Source Files')
+ section.AddDescription('<ul>\n')
+ for obj in infObj.GetSourceObjects(self._arch, self._tooltag):
+ sPath = infObj.GetModuleRootPath()
+ sPath = os.path.join(sPath, obj.GetSourcePath()).replace('\\', '/').strip()
+ if sPath.lower().endswith('.uni') or sPath.lower().endswith('.s') or sPath.lower().endswith('.asm') or sPath.lower().endswith('.nasm'):
+ newPath = self.TranslateUniFile(sPath)
+ configFile.AddFile(newPath)
+ newPath = newPath[len(pObj.GetWorkspace()) + 1:]
+ section.AddDescription('<li> \link %s \endlink </li>' % newPath)
+ else:
+ self.ProcessSourceFileForInclude(sPath, pObj, configFile, infObj)
+ sPath = sPath[len(pObj.GetWorkspace()) + 1:]
+ section.AddDescription('<li>\link %s \endlink </li>' % sPath)
+ section.AddDescription('</ul>\n')
+ modPage.AddSection(section)
+
+ #sects = infObj.GetSectionByString('depex')
+ data = []
+ #for sect in sects:
+ for obj in infObj.GetSectionObjectsByName('depex'):
+ data.append(str(obj))
+ if len(data) != 0:
+ s = doxygen.Section('DependentSection', 'Module Dependencies')
+ s.AddDescription('<br>'.join(data))
+ modPage.AddSection(s)
+
+ return modPage
+
+ def TranslateUniFile(self, path):
+ newpath = path + '.dox'
+ #import core.textfile as textfile
+ #file = textfile.TextFile(path)
+
+ try:
+ file = open(path, 'r')
+ except (IOError, OSError) as msg:
+ return None
+
+ t = file.read()
+ file.close()
+
+ output = '/** @file \n'
+ #output = '<html><body>'
+ arr = t.split('\r\n')
+ for line in arr:
+ if line.find('@file') != -1:
+ continue
+ if line.find('*/') != -1:
+ continue
+ line = line.strip()
+ if line.strip().startswith('/'):
+ arr = line.split(' ')
+ if len(arr) > 1:
+ line = ' '.join(arr[1:])
+ else:
+ continue
+ output += '%s<br>\n' % line
+ output += '**/'
+
+ if os.path.exists(newpath):
+ os.remove(newpath)
+
+ file = open(newpath, "w")
+ file.write(output)
+ file.close()
+ return newpath
+
+ def SearchPcdPackage(self, pcdname, workspace, decObjs):
+ for decObj in decObjs:
+ for pcd in decObj.GetSectionObjectsByName('pcd'):
+ if pcdname == pcd.GetPcdName():
+ return decObj.GetBaseName()
+ return None
+
+ def SearchProtocolPackage(self, protname, workspace, decObjs):
+ for decObj in decObjs:
+ for proto in decObj.GetSectionObjectsByName('protocol'):
+ if protname == proto.GetName():
+ return decObj.GetBaseName()
+ return None
+
+ def SearchPpiPackage(self, ppiname, workspace, decObjs):
+ for decObj in decObjs:
+ for ppi in decObj.GetSectionObjectsByName('ppi'):
+ if ppiname == ppi.GetName():
+ return decObj.GetBaseName()
+ return None
+
+ def SearchGuidPackage(self, guidname, workspace, decObjs):
+ for decObj in decObjs:
+ for guid in decObj.GetSectionObjectsByName('guid'):
+ if guidname == guid.GetName():
+ return decObj.GetBaseName()
+ return None
+
+ def SearchLibraryClassHeaderFile(self, className, workspace, decObjs):
+ for decObj in decObjs:
+ for cls in decObj.GetSectionObjectsByName('libraryclasses'):
+ if cls.GetClassName().strip() == className:
+ path = cls.GetHeaderFile().strip()
+ path = os.path.join(decObj.GetPackageRootPath(), path)
+ path = path[len(workspace) + 1:]
+ return decObj.GetBaseName(), path.replace('\\', '/')
+
+ return None
+
+ def _ConvertPathToDoxygen(self, path, pObj):
+ pRootPath = pObj.GetWorkspace()
+ path = path[len(pRootPath) + 1:]
+ return path.replace('\\', '/')
+
+def IsCHeaderFile(path):
+ return CheckPathPostfix(path, 'h')
+
+def CheckPathPostfix(path, str):
+ index = path.rfind('.')
+ if index == -1:
+ return False
+ if path[index + 1:].lower() == str.lower():
+ return True
+ return False
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dsc.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dsc.py
new file mode 100644
index 000000000..a2d23a773
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dsc.py
@@ -0,0 +1,195 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from plugins.EdkPlugins.basemodel import ini
+import re, os
+from plugins.EdkPlugins.basemodel.message import *
+
+class DSCFile(ini.BaseINIFile):
+ def GetSectionInstance(self, parent, name, isCombined=False):
+ return DSCSection(parent, name, isCombined)
+
+ def GetComponents(self):
+ return self.GetSectionObjectsByName('Components')
+
+class DSCSection(ini.BaseINISection):
+ def GetSectionINIObject(self, parent):
+ type = self.GetType()
+
+ if type.lower() == 'components':
+ return DSCComponentObject(self)
+ if type.lower() == 'libraryclasses':
+ return DSCLibraryClassObject(self)
+ if type.lower() == 'defines':
+ return ini.BaseINISectionObject(self)
+ if type.lower() == 'pcdsfeatureflag' or \
+ type.lower() == 'pcdsfixedatbuild' or \
+ type.lower() == 'pcdspatchableinmodule' or\
+ type.lower() == 'pcdsdynamicdefault' or \
+ type.lower() == 'pcdsdynamicex' or \
+ type.lower() == 'pcdsdynamichii' or \
+ type.lower() == 'pcdsdynamicvpd':
+ return DSCPcdObject(self)
+
+ return DSCSectionObject(self)
+
+ def GetType(self):
+ arr = self._name.split('.')
+ return arr[0].strip()
+
+ def GetArch(self):
+ arr = self._name.split('.')
+ if len(arr) == 1:
+ return 'common'
+ return arr[1]
+
+ def GetModuleType(self):
+ arr = self._name.split('.')
+ if len(arr) < 3:
+ return 'common'
+ return arr[2]
+
+class DSCSectionObject(ini.BaseINISectionObject):
+ def GetArch(self):
+ return self.GetParent().GetArch()
+
+class DSCPcdObject(DSCSectionObject):
+
+ def __init__(self, parent):
+ ini.BaseINISectionObject.__init__(self, parent)
+ self._name = None
+
+ def Parse(self):
+ line = self.GetLineByOffset(self._start).strip().split('#')[0]
+ self._name = line.split('|')[0]
+ self._value = line.split('|')[1]
+ return True
+
+ def GetPcdName(self):
+ return self._name
+
+ def GetPcdType(self):
+ return self.GetParent().GetType()
+
+ def GetPcdValue(self):
+ return self._value
+
+class DSCLibraryClassObject(DSCSectionObject):
+ def __init__(self, parent):
+ ini.BaseINISectionObject.__init__(self, parent)
+
+ def GetClass(self):
+ line = self.GetLineByOffset(self._start)
+ return line.split('#')[0].split('|')[0].strip()
+
+ def GetInstance(self):
+ line = self.GetLineByOffset(self._start)
+ return line.split('#')[0].split('|')[1].strip()
+
+ def GetArch(self):
+ return self.GetParent().GetArch()
+
+ def GetModuleType(self):
+ return self.GetParent().GetModuleType()
+
+class DSCComponentObject(DSCSectionObject):
+
+ def __init__(self, parent):
+ ini.BaseINISectionObject.__init__(self, parent)
+ self._OveridePcds = {}
+ self._OverideLibraries = {}
+ self._Filename = ''
+
+ def __del__(self):
+ self._OverideLibraries.clear()
+ self._OverideLibraries.clear()
+ ini.BaseINISectionObject.__del__(self)
+
+ def AddOverideLib(self, libclass, libinstPath):
+ if libclass not in self._OverideLibraries.keys():
+ self._OverideLibraries[libclass] = libinstPath
+
+ def AddOveridePcd(self, name, type, value=None):
+ if type not in self._OveridePcds.keys():
+ self._OveridePcds[type] = []
+ self._OveridePcds[type].append((name, value))
+
+ def GetOverideLibs(self):
+ return self._OverideLibraries
+
+ def GetArch(self):
+ return self.GetParent().GetArch()
+
+ def GetOveridePcds(self):
+ return self._OveridePcds
+
+ def GetFilename(self):
+ return self.GetLineByOffset(self._start).split('#')[0].split('{')[0].strip()
+
+ def SetFilename(self, fName):
+ self._Filename = fName
+
+ def Parse(self):
+ if (self._start < self._end):
+ #
+ # The first line is inf path and could be ignored
+ # The end line is '}' and could be ignored
+ #
+ curr = self._start + 1
+ end = self._end - 1
+ OverideName = ''
+ while (curr <= end):
+ line = self.GetLineByOffset(curr).strip()
+ if len(line) > 0 and line[0] != '#':
+ line = line.split('#')[0].strip()
+ if line[0] == '<':
+ OverideName = line[1:len(line)-1]
+ elif OverideName.lower() == 'libraryclasses':
+ arr = line.split('|')
+ self._OverideLibraries[arr[0].strip()] = arr[1].strip()
+ elif OverideName.lower() == 'pcds':
+ ErrorMsg('EDES does not support PCD overide',
+ self.GetFileName(),
+ self.GetParent().GetLinenumberByOffset(curr))
+ curr = curr + 1
+ return True
+
+ def GenerateLines(self):
+ lines = []
+ hasLib = False
+ hasPcd = False
+ if len(self._OverideLibraries) != 0:
+ hasLib = True
+ if len(self._OveridePcds) != 0:
+ hasPcd = True
+
+ if hasLib or hasPcd:
+ lines.append((' %s {\n' % self._Filename))
+ else:
+ lines.append((' %s \n' % self._Filename))
+ return lines
+
+ if hasLib:
+ lines.append(' <LibraryClasses>\n')
+ for libKey in self._OverideLibraries.keys():
+ lines.append(' %s|%s\n' % (libKey, self._OverideLibraries[libKey]))
+
+ if hasPcd:
+ for key in self._OveridePcds.keys():
+ lines.append(' <%s>\n' % key)
+
+ for name, value in self._OveridePcds[key]:
+ if value is not None:
+ lines.append(' %s|%s\n' % (name, value))
+ else:
+ lines.append(' %s\n' % name)
+
+ if hasLib or hasPcd:
+ lines.append(' }\n')
+
+ return lines
+
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py
new file mode 100644
index 000000000..430e71af2
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py
@@ -0,0 +1,335 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from plugins.EdkPlugins.basemodel import ini
+import re, os
+from plugins.EdkPlugins.basemodel.message import *
+
+class INFFile(ini.BaseINIFile):
+ _libobjs = {}
+
+ def GetSectionInstance(self, parent, name, isCombined=False):
+ return INFSection(parent, name, isCombined)
+
+ def GetProduceLibraryClass(self):
+ obj = self.GetDefine("LIBRARY_CLASS")
+ if obj is None: return None
+
+ return obj.split('|')[0].strip()
+
+ def GetSectionObjectsByName(self, name, arch=None):
+ arr = []
+ sects = self.GetSectionByName(name)
+ for sect in sects:
+ # skip unmatched archtecture content
+ if not sect.IsArchMatch(arch):
+ continue
+
+ for obj in sect.GetObjects():
+ arr.append(obj)
+
+ return arr
+
+ def GetSourceObjects(self, arch=None, tool=None):
+ arr = []
+ sects = self.GetSectionByName('sources')
+ for sect in sects:
+ # skip unmatched archtecture content
+ if not sect.IsArchMatch(arch):
+ continue
+
+ for obj in sect.GetObjects():
+ if not obj.IsMatchFamily(tool):
+ continue
+ arr.append(obj)
+
+ return arr
+
+ def Parse(self):
+ if not ini.BaseINIFile.Parse(self):
+ return False
+ classname = self.GetProduceLibraryClass()
+ if classname is not None:
+ libobjdict = INFFile._libobjs
+ if classname in libobjdict:
+ if self not in libobjdict[classname]:
+ libobjdict[classname].append(self)
+ else:
+ libobjdict[classname] = [self]
+
+ return True
+
+ def GetBaseName(self):
+ return self.GetDefine("BASE_NAME").strip()
+
+ def GetModuleRootPath(self):
+ return os.path.dirname(self.GetFilename())
+
+ def Clear(self):
+ classname = self.GetProduceLibraryClass()
+ if classname is not None:
+ libobjdict = INFFile._libobjs
+ libobjdict[classname].remove(self)
+ if len(libobjdict[classname]) == 0:
+ del libobjdict[classname]
+ ini.BaseINIFile.Clear(self)
+
+
+class INFSection(ini.BaseINISection):
+ def GetSectionINIObject(self, parent):
+ type = self.GetType()
+
+ if type.lower() == 'libraryclasses':
+ return INFLibraryClassObject(self)
+ if type.lower() == 'sources':
+ return INFSourceObject(self)
+ if type.lower().find('pcd') != -1:
+ return INFPcdObject(self)
+ if type.lower() == 'packages':
+ return INFDependentPackageObject(self)
+ if type.lower() in ['guids', 'protocols', 'ppis']:
+ return INFGuidObject(self)
+ if type.lower() == 'defines':
+ return INFDefineSectionObject(self)
+ return INFSectionObject(self)
+
+ def GetType(self):
+ arr = self._name.split('.')
+ return arr[0].strip()
+
+ def GetArch(self):
+ arr = self._name.split('.')
+ if len(arr) == 1:
+ return 'common'
+ return arr[1]
+
+ def IsArchMatch(self, arch):
+ if arch is None or self.GetArch() == 'common':
+ return True
+
+ if self.GetArch().lower() != arch.lower():
+ return False
+
+ return True
+
+class INFSectionObject(ini.BaseINISectionObject):
+ def GetArch(self):
+ return self.GetParent().GetArch()
+
+class INFDefineSectionObject(INFSectionObject):
+ def __init__(self, parent):
+ INFSectionObject.__init__(self, parent)
+ self._key = None
+ self._value = None
+
+ def Parse(self):
+ assert (self._start == self._end), 'The object in define section must be in single line'
+
+ line = self.GetLineByOffset(self._start).strip()
+
+ line = line.split('#')[0]
+ arr = line.split('=')
+ if len(arr) != 2:
+ ErrorMsg('Invalid define section object',
+ self.GetFilename(),
+ self._start
+ )
+ return False
+
+ self._key = arr[0].strip()
+ self._value = arr[1].strip()
+
+ return True
+
+ def GetKey(self):
+ return self._key
+
+ def GetValue(self):
+ return self._value
+
+class INFLibraryClassObject(INFSectionObject):
+ _objs = {}
+ def __init__(self, parent):
+ INFSectionObject.__init__(self, parent)
+ self._classname = None
+
+ def GetClass(self):
+ return self._classname
+
+ def Parse(self):
+ self._classname = self.GetLineByOffset(self._start).split('#')[0].strip()
+ objdict = INFLibraryClassObject._objs
+ if self._classname in objdict:
+ objdict[self._classname].append(self)
+ else:
+ objdict[self._classname] = [self]
+ return True
+
+ def Destroy(self):
+ objdict = INFLibraryClassObject._objs
+ objdict[self._classname].remove(self)
+ if len(objdict[self._classname]) == 0:
+ del objdict[self._classname]
+
+ def GetName(self):
+ return self._classname
+
+ @staticmethod
+ def GetObjectDict():
+ return INFLibraryClassObject._objs
+
+class INFDependentPackageObject(INFSectionObject):
+ def GetPath(self):
+ return self.GetLineByOffset(self._start).split('#')[0].strip()
+
+class INFSourceObject(INFSectionObject):
+ _objs = {}
+ def __init__(self, parent):
+ INFSectionObject.__init__(self, parent)
+
+ self.mSourcename = None
+ self.mToolCode = None
+ self.mFamily = None
+ self.mTagName = None
+ self.mFeaturePcd = None
+ self.mFilename = None
+
+ def GetSourcePath(self):
+ return self.mSourcename
+
+ def GetSourceFullPath(self):
+ path = os.path.dirname(self.GetFilename())
+ path = os.path.join(path, self.GetSourcePath())
+ return os.path.normpath(path)
+
+ def GetToolCode(self):
+ return self.mToolCode
+
+ def GetFamily(self):
+ return self.mFamily
+
+ def GetTagName(self):
+ return self.mTagName
+
+ def GetFeaturePcd(self):
+ return self.mFeaturePcd
+
+ def Parse(self):
+ line = self.GetLineByOffset(self._start).strip().split('#')[0]
+
+ arr = line.split('|')
+
+ self.mSourcename = arr[0].strip()
+ if len(arr) >= 2:
+ self.mFamily = arr[1].strip()
+ if len(arr) >= 3:
+ self.mTagName = arr[2].strip()
+ if len(arr) >= 4:
+ self.mToolCode = arr[3].strip()
+ if len(arr) >= 5:
+ self.mFeaturePcd = arr[4].strip()
+
+ self.mFilename = os.path.basename(self.GetSourceFullPath())
+ objdict = INFSourceObject._objs
+ if self.mFilename not in objdict:
+ objdict[self.mFilename] = [self]
+ else:
+ objdict[self.mFilename].append(self)
+
+ return True
+
+ def GetName(self):
+ return self.mFilename
+
+ def Destroy(self):
+ objdict = INFSourceObject._objs
+ objdict[self.mFilename].remove(self)
+ if len(objdict[self.mFilename]) == 0:
+ del objdict[self.mFilename]
+
+ def IsMatchFamily(self, family):
+ if family is None:
+ return True
+ if self.mFamily is not None:
+ if family.strip().lower() == self.mFamily.lower():
+ return True
+ else:
+ return False
+ else:
+ fname = self.GetSourcePath()
+ if fname.endswith('.S') and family.lower() != 'gcc':
+ return False
+ if fname.endswith('.s') and (self.GetArch().lower() != 'ipf' and self.GetArch().lower() != 'common'):
+ return False
+ if fname.lower().endswith('.asm') and (family.lower() != 'msft' and family.lower() != 'intel'):
+ return False
+ return True
+
+ @staticmethod
+ def GetObjectDict():
+ return INFSourceObject._objs
+
+class INFPcdObject(INFSectionObject):
+ _objs = {}
+
+ def __init__(self, parent):
+ INFSectionObject.__init__(self, parent)
+
+ self.mPcdType = None
+ self.mDefaultValue = None
+ self.mPcdName = None
+
+ @staticmethod
+ def GetObjectDict():
+ return INFPcdObject._objs
+
+ def Parse(self):
+ line = self.GetLineByOffset(self._start).strip().split('#')[0]
+
+ arr = line.split('|')
+ self.mPcdName = arr[0].strip()
+
+ if len(arr) >= 2:
+ self.mDefaultValue = arr[1].strip()
+
+ objdict = INFPcdObject._objs
+ if self.GetName() in objdict:
+ if self not in objdict[self.GetName()]:
+ objdict[self.GetName()].append(self)
+ else:
+ objdict[self.GetName()] = [self]
+ return True
+
+ def GetPcdName(self):
+ return self.mPcdName
+
+ def GetPcdType(self):
+ return self.GetParent().GetType()
+
+ def GetName(self):
+ return self.mPcdName.split('.')[1]
+
+ def Destroy(self):
+ objdict = INFPcdObject._objs
+ objdict[self.GetName()].remove(self)
+ if len(objdict[self.GetName()]) == 0:
+ del objdict[self.GetName()]
+
+class INFGuidObject(INFSectionObject):
+ def __init__(self, parent):
+ INFSectionObject.__init__(self, parent)
+ self._name = None
+
+ def Parse(self):
+ line = self.GetLineByOffset(self._start).strip().split('#')[0].split("|")[0]
+ self._name = line.strip()
+ return True
+
+ def GetName(self):
+ return self._name
+
+
diff --git a/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/__init__.py b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/__init__.py
new file mode 100644
index 000000000..57dfebde5
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PackageDocumentTools/plugins/__init__.py
@@ -0,0 +1,6 @@
+## @file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Scripts/PatchCheck.py b/roms/edk2/BaseTools/Scripts/PatchCheck.py
new file mode 100755
index 000000000..68c984ed0
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/PatchCheck.py
@@ -0,0 +1,769 @@
+## @file
+# Check a patch for various format issues
+#
+# Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (C) 2020, Red Hat, Inc.<BR>
+# Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import print_function
+
+VersionNumber = '0.1'
+__copyright__ = "Copyright (c) 2015 - 2016, Intel Corporation All rights reserved."
+
+import email
+import argparse
+import os
+import re
+import subprocess
+import sys
+
+import email.header
+
+class Verbose:
+ SILENT, ONELINE, NORMAL = range(3)
+ level = NORMAL
+
+class EmailAddressCheck:
+ """Checks an email address."""
+
+ def __init__(self, email, description):
+ self.ok = True
+
+ if email is None:
+ self.error('Email address is missing!')
+ return
+ if description is None:
+ self.error('Email description is missing!')
+ return
+
+ self.description = "'" + description + "'"
+ self.check_email_address(email)
+
+ def error(self, *err):
+ if self.ok and Verbose.level > Verbose.ONELINE:
+ print('The ' + self.description + ' email address is not valid:')
+ self.ok = False
+ if Verbose.level < Verbose.NORMAL:
+ return
+ count = 0
+ for line in err:
+ prefix = (' *', ' ')[count > 0]
+ print(prefix, line)
+ count += 1
+
+ email_re1 = re.compile(r'(?:\s*)(.*?)(\s*)<(.+)>\s*$',
+ re.MULTILINE|re.IGNORECASE)
+
+ def check_email_address(self, email):
+ email = email.strip()
+ mo = self.email_re1.match(email)
+ if mo is None:
+ self.error("Email format is invalid: " + email.strip())
+ return
+
+ name = mo.group(1).strip()
+ if name == '':
+ self.error("Name is not provided with email address: " +
+ email)
+ else:
+ quoted = len(name) > 2 and name[0] == '"' and name[-1] == '"'
+ if name.find(',') >= 0 and not quoted:
+ self.error('Add quotes (") around name with a comma: ' +
+ name)
+
+ if mo.group(2) == '':
+ self.error("There should be a space between the name and " +
+ "email address: " + email)
+
+ if mo.group(3).find(' ') >= 0:
+ self.error("The email address cannot contain a space: " +
+ mo.group(3))
+
+ if ' via Groups.Io' in name and mo.group(3).endswith('@groups.io'):
+ self.error("Email rewritten by lists DMARC / DKIM / SPF: " +
+ email)
+
+class CommitMessageCheck:
+ """Checks the contents of a git commit message."""
+
+ def __init__(self, subject, message):
+ self.ok = True
+
+ if subject is None and message is None:
+ self.error('Commit message is missing!')
+ return
+
+ self.subject = subject
+ self.msg = message
+
+ print (subject)
+
+ self.check_contributed_under()
+ self.check_signed_off_by()
+ self.check_misc_signatures()
+ self.check_overall_format()
+ self.report_message_result()
+
+ url = 'https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format'
+
+ def report_message_result(self):
+ if Verbose.level < Verbose.NORMAL:
+ return
+ if self.ok:
+ # All checks passed
+ return_code = 0
+ print('The commit message format passed all checks.')
+ else:
+ return_code = 1
+ if not self.ok:
+ print(self.url)
+
+ def error(self, *err):
+ if self.ok and Verbose.level > Verbose.ONELINE:
+ print('The commit message format is not valid:')
+ self.ok = False
+ if Verbose.level < Verbose.NORMAL:
+ return
+ count = 0
+ for line in err:
+ prefix = (' *', ' ')[count > 0]
+ print(prefix, line)
+ count += 1
+
+ # Find 'contributed-under:' at the start of a line ignoring case and
+ # requires ':' to be present. Matches if there is white space before
+ # the tag or between the tag and the ':'.
+ contributed_under_re = \
+ re.compile(r'^\s*contributed-under\s*:', re.MULTILINE|re.IGNORECASE)
+
+ def check_contributed_under(self):
+ match = self.contributed_under_re.search(self.msg)
+ if match is not None:
+ self.error('Contributed-under! (Note: this must be ' +
+ 'removed by the code contributor!)')
+
+ @staticmethod
+ def make_signature_re(sig, re_input=False):
+ if re_input:
+ sub_re = sig
+ else:
+ sub_re = sig.replace('-', r'[-\s]+')
+ re_str = (r'^(?P<tag>' + sub_re +
+ r')(\s*):(\s*)(?P<value>\S.*?)(?:\s*)$')
+ try:
+ return re.compile(re_str, re.MULTILINE|re.IGNORECASE)
+ except Exception:
+ print("Tried to compile re:", re_str)
+ raise
+
+ sig_block_re = \
+ re.compile(r'''^
+ (?: (?P<tag>[^:]+) \s* : \s*
+ (?P<value>\S.*?) )
+ |
+ (?: \[ (?P<updater>[^:]+) \s* : \s*
+ (?P<note>.+?) \s* \] )
+ \s* $''',
+ re.VERBOSE | re.MULTILINE)
+
+ def find_signatures(self, sig):
+ if not sig.endswith('-by') and sig != 'Cc':
+ sig += '-by'
+ regex = self.make_signature_re(sig)
+
+ sigs = regex.findall(self.msg)
+
+ bad_case_sigs = filter(lambda m: m[0] != sig, sigs)
+ for s in bad_case_sigs:
+ self.error("'" +s[0] + "' should be '" + sig + "'")
+
+ for s in sigs:
+ if s[1] != '':
+ self.error('There should be no spaces between ' + sig +
+ " and the ':'")
+ if s[2] != ' ':
+ self.error("There should be a space after '" + sig + ":'")
+
+ EmailAddressCheck(s[3], sig)
+
+ return sigs
+
+ def check_signed_off_by(self):
+ sob='Signed-off-by'
+ if self.msg.find(sob) < 0:
+ self.error('Missing Signed-off-by! (Note: this must be ' +
+ 'added by the code contributor!)')
+ return
+
+ sobs = self.find_signatures('Signed-off')
+
+ if len(sobs) == 0:
+ self.error('Invalid Signed-off-by format!')
+ return
+
+ sig_types = (
+ 'Reviewed',
+ 'Reported',
+ 'Tested',
+ 'Suggested',
+ 'Acked',
+ 'Cc'
+ )
+
+ def check_misc_signatures(self):
+ for sig in self.sig_types:
+ self.find_signatures(sig)
+
+ cve_re = re.compile('CVE-[0-9]{4}-[0-9]{5}[^0-9]')
+
+ def check_overall_format(self):
+ lines = self.msg.splitlines()
+
+ if len(lines) >= 1 and lines[0].endswith('\r\n'):
+ empty_line = '\r\n'
+ else:
+ empty_line = '\n'
+
+ lines.insert(0, empty_line)
+ lines.insert(0, self.subject + empty_line)
+
+ count = len(lines)
+
+ if count <= 0:
+ self.error('Empty commit message!')
+ return
+
+ if count >= 1 and re.search(self.cve_re, lines[0]):
+ #
+ # If CVE-xxxx-xxxxx is present in subject line, then limit length of
+ # subject line to 92 characters
+ #
+ if len(lines[0].rstrip()) >= 93:
+ self.error(
+ 'First line of commit message (subject line) is too long (%d >= 93).' %
+ (len(lines[0].rstrip()))
+ )
+ else:
+ #
+ # If CVE-xxxx-xxxxx is not present in subject line, then limit
+ # length of subject line to 75 characters
+ #
+ if len(lines[0].rstrip()) >= 76:
+ self.error(
+ 'First line of commit message (subject line) is too long (%d >= 76).' %
+ (len(lines[0].rstrip()))
+ )
+
+ if count >= 1 and len(lines[0].strip()) == 0:
+ self.error('First line of commit message (subject line) ' +
+ 'is empty.')
+
+ if count >= 2 and lines[1].strip() != '':
+ self.error('Second line of commit message should be ' +
+ 'empty.')
+
+ for i in range(2, count):
+ if (len(lines[i]) >= 76 and
+ len(lines[i].split()) > 1 and
+ not lines[i].startswith('git-svn-id:') and
+ not lines[i].startswith('Reviewed-by') and
+ not lines[i].startswith('Acked-by:') and
+ not lines[i].startswith('Tested-by:') and
+ not lines[i].startswith('Reported-by:') and
+ not lines[i].startswith('Suggested-by:') and
+ not lines[i].startswith('Signed-off-by:') and
+ not lines[i].startswith('Cc:')):
+ #
+ # Print a warning if body line is longer than 75 characters
+ #
+ print(
+ 'WARNING - Line %d of commit message is too long (%d >= 76).' %
+ (i + 1, len(lines[i]))
+ )
+ print(lines[i])
+
+ last_sig_line = None
+ for i in range(count - 1, 0, -1):
+ line = lines[i]
+ mo = self.sig_block_re.match(line)
+ if mo is None:
+ if line.strip() == '':
+ break
+ elif last_sig_line is not None:
+ err2 = 'Add empty line before "%s"?' % last_sig_line
+ self.error('The line before the signature block ' +
+ 'should be empty', err2)
+ else:
+ self.error('The signature block was not found')
+ break
+ last_sig_line = line.strip()
+
+(START, PRE_PATCH, PATCH) = range(3)
+
+class GitDiffCheck:
+ """Checks the contents of a git diff."""
+
+ def __init__(self, diff):
+ self.ok = True
+ self.format_ok = True
+ self.lines = diff.splitlines(True)
+ self.count = len(self.lines)
+ self.line_num = 0
+ self.state = START
+ self.new_bin = []
+ while self.line_num < self.count and self.format_ok:
+ line_num = self.line_num
+ self.run()
+ assert(self.line_num > line_num)
+ self.report_message_result()
+
+ def report_message_result(self):
+ if Verbose.level < Verbose.NORMAL:
+ return
+ if self.ok:
+ print('The code passed all checks.')
+ if self.new_bin:
+ print('\nWARNING - The following binary files will be added ' +
+ 'into the repository:')
+ for binary in self.new_bin:
+ print(' ' + binary)
+
+ def run(self):
+ line = self.lines[self.line_num]
+
+ if self.state in (PRE_PATCH, PATCH):
+ if line.startswith('diff --git'):
+ self.state = START
+ if self.state == PATCH:
+ if line.startswith('@@ '):
+ self.state = PRE_PATCH
+ elif len(line) >= 1 and line[0] not in ' -+' and \
+ not line.startswith('\r\n') and \
+ not line.startswith(r'\ No newline ') and not self.binary:
+ for line in self.lines[self.line_num + 1:]:
+ if line.startswith('diff --git'):
+ self.format_error('diff found after end of patch')
+ break
+ self.line_num = self.count
+ return
+
+ if self.state == START:
+ if line.startswith('diff --git'):
+ self.state = PRE_PATCH
+ self.filename = line[13:].split(' ', 1)[0]
+ self.is_newfile = False
+ self.force_crlf = True
+ self.force_notabs = True
+ if self.filename.endswith('.sh') or \
+ self.filename.startswith('BaseTools/BinWrappers/PosixLike/') or \
+ self.filename.startswith('BaseTools/Bin/CYGWIN_NT-5.1-i686/') or \
+ self.filename == 'BaseTools/BuildEnv':
+ #
+ # Do not enforce CR/LF line endings for linux shell scripts.
+ # Some linux shell scripts don't end with the ".sh" extension,
+ # they are identified by their path.
+ #
+ self.force_crlf = False
+ if self.filename == '.gitmodules' or \
+ self.filename == 'BaseTools/Conf/diff.order':
+ #
+ # .gitmodules and diff orderfiles are used internally by git
+ # use tabs and LF line endings. Do not enforce no tabs and
+ # do not enforce CR/LF line endings.
+ #
+ self.force_crlf = False
+ self.force_notabs = False
+ elif len(line.rstrip()) != 0:
+ self.format_error("didn't find diff command")
+ self.line_num += 1
+ elif self.state == PRE_PATCH:
+ if line.startswith('@@ '):
+ self.state = PATCH
+ self.binary = False
+ elif line.startswith('GIT binary patch') or \
+ line.startswith('Binary files'):
+ self.state = PATCH
+ self.binary = True
+ if self.is_newfile:
+ self.new_bin.append(self.filename)
+ elif line.startswith('new file mode 160000'):
+ #
+ # New submodule. Do not enforce CR/LF line endings
+ #
+ self.force_crlf = False
+ else:
+ ok = False
+ self.is_newfile = self.newfile_prefix_re.match(line)
+ for pfx in self.pre_patch_prefixes:
+ if line.startswith(pfx):
+ ok = True
+ if not ok:
+ self.format_error("didn't find diff hunk marker (@@)")
+ self.line_num += 1
+ elif self.state == PATCH:
+ if self.binary:
+ pass
+ elif line.startswith('-'):
+ pass
+ elif line.startswith('+'):
+ self.check_added_line(line[1:])
+ elif line.startswith('\r\n'):
+ pass
+ elif line.startswith(r'\ No newline '):
+ pass
+ elif not line.startswith(' '):
+ self.format_error("unexpected patch line")
+ self.line_num += 1
+
+ pre_patch_prefixes = (
+ '--- ',
+ '+++ ',
+ 'index ',
+ 'new file ',
+ 'deleted file ',
+ 'old mode ',
+ 'new mode ',
+ 'similarity index ',
+ 'copy from ',
+ 'copy to ',
+ 'rename ',
+ )
+
+ line_endings = ('\r\n', '\n\r', '\n', '\r')
+
+ newfile_prefix_re = \
+ re.compile(r'''^
+ index\ 0+\.\.
+ ''',
+ re.VERBOSE)
+
+ def added_line_error(self, msg, line):
+ lines = [ msg ]
+ if self.filename is not None:
+ lines.append('File: ' + self.filename)
+ lines.append('Line: ' + line)
+
+ self.error(*lines)
+
+ old_debug_re = \
+ re.compile(r'''
+ DEBUG \s* \( \s* \( \s*
+ (?: DEBUG_[A-Z_]+ \s* \| \s*)*
+ EFI_D_ ([A-Z_]+)
+ ''',
+ re.VERBOSE)
+
+ def check_added_line(self, line):
+ eol = ''
+ for an_eol in self.line_endings:
+ if line.endswith(an_eol):
+ eol = an_eol
+ line = line[:-len(eol)]
+
+ stripped = line.rstrip()
+
+ if self.force_crlf and eol != '\r\n' and (line.find('Subproject commit') == -1):
+ self.added_line_error('Line ending (%s) is not CRLF' % repr(eol),
+ line)
+ if self.force_notabs and '\t' in line:
+ self.added_line_error('Tab character used', line)
+ if len(stripped) < len(line):
+ self.added_line_error('Trailing whitespace found', line)
+
+ mo = self.old_debug_re.search(line)
+ if mo is not None:
+ self.added_line_error('EFI_D_' + mo.group(1) + ' was used, '
+ 'but DEBUG_' + mo.group(1) +
+ ' is now recommended', line)
+
+ split_diff_re = re.compile(r'''
+ (?P<cmd>
+ ^ diff \s+ --git \s+ a/.+ \s+ b/.+ $
+ )
+ (?P<index>
+ ^ index \s+ .+ $
+ )
+ ''',
+ re.IGNORECASE | re.VERBOSE | re.MULTILINE)
+
+ def format_error(self, err):
+ self.format_ok = False
+ err = 'Patch format error: ' + err
+ err2 = 'Line: ' + self.lines[self.line_num].rstrip()
+ self.error(err, err2)
+
+ def error(self, *err):
+ if self.ok and Verbose.level > Verbose.ONELINE:
+ print('Code format is not valid:')
+ self.ok = False
+ if Verbose.level < Verbose.NORMAL:
+ return
+ count = 0
+ for line in err:
+ prefix = (' *', ' ')[count > 0]
+ print(prefix, line)
+ count += 1
+
+class CheckOnePatch:
+ """Checks the contents of a git email formatted patch.
+
+ Various checks are performed on both the commit message and the
+ patch content.
+ """
+
+ def __init__(self, name, patch):
+ self.patch = patch
+ self.find_patch_pieces()
+
+ email_check = EmailAddressCheck(self.author_email, 'Author')
+ email_ok = email_check.ok
+
+ msg_check = CommitMessageCheck(self.commit_subject, self.commit_msg)
+ msg_ok = msg_check.ok
+
+ diff_ok = True
+ if self.diff is not None:
+ diff_check = GitDiffCheck(self.diff)
+ diff_ok = diff_check.ok
+
+ self.ok = email_ok and msg_ok and diff_ok
+
+ if Verbose.level == Verbose.ONELINE:
+ if self.ok:
+ result = 'ok'
+ else:
+ result = list()
+ if not msg_ok:
+ result.append('commit message')
+ if not diff_ok:
+ result.append('diff content')
+ result = 'bad ' + ' and '.join(result)
+ print(name, result)
+
+
+ git_diff_re = re.compile(r'''
+ ^ diff \s+ --git \s+ a/.+ \s+ b/.+ $
+ ''',
+ re.IGNORECASE | re.VERBOSE | re.MULTILINE)
+
+ stat_re = \
+ re.compile(r'''
+ (?P<commit_message> [\s\S\r\n]* )
+ (?P<stat>
+ ^ --- $ [\r\n]+
+ (?: ^ \s+ .+ \s+ \| \s+ \d+ \s+ \+* \-*
+ $ [\r\n]+ )+
+ [\s\S\r\n]+
+ )
+ ''',
+ re.IGNORECASE | re.VERBOSE | re.MULTILINE)
+
+ subject_prefix_re = \
+ re.compile(r'''^
+ \s* (\[
+ [^\[\]]* # Allow all non-brackets
+ \])* \s*
+ ''',
+ re.VERBOSE)
+
+ def find_patch_pieces(self):
+ if sys.version_info < (3, 0):
+ patch = self.patch.encode('ascii', 'ignore')
+ else:
+ patch = self.patch
+
+ self.commit_msg = None
+ self.stat = None
+ self.commit_subject = None
+ self.commit_prefix = None
+ self.diff = None
+
+ if patch.startswith('diff --git'):
+ self.diff = patch
+ return
+
+ pmail = email.message_from_string(patch)
+ parts = list(pmail.walk())
+ assert(len(parts) == 1)
+ assert(parts[0].get_content_type() == 'text/plain')
+ content = parts[0].get_payload(decode=True).decode('utf-8', 'ignore')
+
+ mo = self.git_diff_re.search(content)
+ if mo is not None:
+ self.diff = content[mo.start():]
+ content = content[:mo.start()]
+
+ mo = self.stat_re.search(content)
+ if mo is None:
+ self.commit_msg = content
+ else:
+ self.stat = mo.group('stat')
+ self.commit_msg = mo.group('commit_message')
+ #
+ # Parse subject line from email header. The subject line may be
+ # composed of multiple parts with different encodings. Decode and
+ # combine all the parts to produce a single string with the contents of
+ # the decoded subject line.
+ #
+ parts = email.header.decode_header(pmail.get('subject'))
+ subject = ''
+ for (part, encoding) in parts:
+ if encoding:
+ part = part.decode(encoding)
+ else:
+ try:
+ part = part.decode()
+ except:
+ pass
+ subject = subject + part
+
+ self.commit_subject = subject.replace('\r\n', '')
+ self.commit_subject = self.commit_subject.replace('\n', '')
+ self.commit_subject = self.subject_prefix_re.sub('', self.commit_subject, 1)
+
+ self.author_email = pmail['from']
+
+class CheckGitCommits:
+ """Reads patches from git based on the specified git revision range.
+
+ The patches are read from git, and then checked.
+ """
+
+ def __init__(self, rev_spec, max_count):
+ commits = self.read_commit_list_from_git(rev_spec, max_count)
+ if len(commits) == 1 and Verbose.level > Verbose.ONELINE:
+ commits = [ rev_spec ]
+ self.ok = True
+ blank_line = False
+ for commit in commits:
+ if Verbose.level > Verbose.ONELINE:
+ if blank_line:
+ print()
+ else:
+ blank_line = True
+ print('Checking git commit:', commit)
+ email = self.read_committer_email_address_from_git(commit)
+ self.ok &= EmailAddressCheck(email, 'Committer').ok
+ patch = self.read_patch_from_git(commit)
+ self.ok &= CheckOnePatch(commit, patch).ok
+ if not commits:
+ print("Couldn't find commit matching: '{}'".format(rev_spec))
+
+ def read_commit_list_from_git(self, rev_spec, max_count):
+ # Run git to get the commit patch
+ cmd = [ 'rev-list', '--abbrev-commit', '--no-walk' ]
+ if max_count is not None:
+ cmd.append('--max-count=' + str(max_count))
+ cmd.append(rev_spec)
+ out = self.run_git(*cmd)
+ return out.split() if out else []
+
+ def read_patch_from_git(self, commit):
+ # Run git to get the commit patch
+ return self.run_git('show', '--pretty=email', '--no-textconv',
+ '--no-use-mailmap', commit)
+
+ def read_committer_email_address_from_git(self, commit):
+ # Run git to get the committer email
+ return self.run_git('show', '--pretty=%cn <%ce>', '--no-patch',
+ '--no-use-mailmap', commit)
+
+ def run_git(self, *args):
+ cmd = [ 'git' ]
+ cmd += args
+ p = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+ Result = p.communicate()
+ return Result[0].decode('utf-8', 'ignore') if Result[0] and Result[0].find(b"fatal")!=0 else None
+
+class CheckOnePatchFile:
+ """Performs a patch check for a single file.
+
+ stdin is used when the filename is '-'.
+ """
+
+ def __init__(self, patch_filename):
+ if patch_filename == '-':
+ patch = sys.stdin.read()
+ patch_filename = 'stdin'
+ else:
+ f = open(patch_filename, 'rb')
+ patch = f.read().decode('utf-8', 'ignore')
+ f.close()
+ if Verbose.level > Verbose.ONELINE:
+ print('Checking patch file:', patch_filename)
+ self.ok = CheckOnePatch(patch_filename, patch).ok
+
+class CheckOneArg:
+ """Performs a patch check for a single command line argument.
+
+ The argument will be handed off to a file or git-commit based
+ checker.
+ """
+
+ def __init__(self, param, max_count=None):
+ self.ok = True
+ if param == '-' or os.path.exists(param):
+ checker = CheckOnePatchFile(param)
+ else:
+ checker = CheckGitCommits(param, max_count)
+ self.ok = checker.ok
+
+class PatchCheckApp:
+ """Checks patches based on the command line arguments."""
+
+ def __init__(self):
+ self.parse_options()
+ patches = self.args.patches
+
+ if len(patches) == 0:
+ patches = [ 'HEAD' ]
+
+ self.ok = True
+ self.count = None
+ for patch in patches:
+ self.process_one_arg(patch)
+
+ if self.count is not None:
+ self.process_one_arg('HEAD')
+
+ if self.ok:
+ self.retval = 0
+ else:
+ self.retval = -1
+
+ def process_one_arg(self, arg):
+ if len(arg) >= 2 and arg[0] == '-':
+ try:
+ self.count = int(arg[1:])
+ return
+ except ValueError:
+ pass
+ self.ok &= CheckOneArg(arg, self.count).ok
+ self.count = None
+
+ def parse_options(self):
+ parser = argparse.ArgumentParser(description=__copyright__)
+ parser.add_argument('--version', action='version',
+ version='%(prog)s ' + VersionNumber)
+ parser.add_argument('patches', nargs='*',
+ help='[patch file | git rev list]')
+ group = parser.add_mutually_exclusive_group()
+ group.add_argument("--oneline",
+ action="store_true",
+ help="Print one result per line")
+ group.add_argument("--silent",
+ action="store_true",
+ help="Print nothing")
+ self.args = parser.parse_args()
+ if self.args.oneline:
+ Verbose.level = Verbose.ONELINE
+ if self.args.silent:
+ Verbose.level = Verbose.SILENT
+
+if __name__ == "__main__":
+ sys.exit(PatchCheckApp().retval)
diff --git a/roms/edk2/BaseTools/Scripts/RunMakefile.py b/roms/edk2/BaseTools/Scripts/RunMakefile.py
new file mode 100644
index 000000000..0e0a0114f
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/RunMakefile.py
@@ -0,0 +1,172 @@
+## @file
+# Run a makefile as part of a PREBUILD or POSTBUILD action.
+#
+# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+RunMakefile.py
+'''
+
+import os
+import sys
+import argparse
+import subprocess
+
+#
+# Globals for help information
+#
+__prog__ = 'RunMakefile'
+__version__ = '%s Version %s' % (__prog__, '1.0')
+__copyright__ = 'Copyright (c) 2017, Intel Corporation. All rights reserved.'
+__description__ = 'Run a makefile as part of a PREBUILD or POSTBUILD action.\n'
+
+#
+# Globals
+#
+gArgs = None
+
+def Log(Message):
+ if not gArgs.Verbose:
+ return
+ sys.stdout.write (__prog__ + ': ' + Message + '\n')
+
+def Error(Message, ExitValue=1):
+ sys.stderr.write (__prog__ + ': ERROR: ' + Message + '\n')
+ sys.exit (ExitValue)
+
+def RelativePath(target):
+ return os.path.relpath (target, gWorkspace)
+
+def NormalizePath(target):
+ if isinstance(target, tuple):
+ return os.path.normpath (os.path.join (*target))
+ else:
+ return os.path.normpath (target)
+
+if __name__ == '__main__':
+ #
+ # Create command line argument parser object
+ #
+ parser = argparse.ArgumentParser (
+ prog = __prog__,
+ version = __version__,
+ description = __description__ + __copyright__,
+ conflict_handler = 'resolve'
+ )
+ parser.add_argument (
+ '-a', '--arch', dest = 'Arch', nargs = '+', action = 'append',
+ required = True,
+ help = '''ARCHS is one of list: IA32, X64, IPF, ARM, AARCH64 or EBC,
+ which overrides target.txt's TARGET_ARCH definition. To
+ specify more archs, please repeat this option.'''
+ )
+ parser.add_argument (
+ '-t', '--tagname', dest = 'ToolChain', required = True,
+ help = '''Using the Tool Chain Tagname to build the platform,
+ overriding target.txt's TOOL_CHAIN_TAG definition.'''
+ )
+ parser.add_argument (
+ '-p', '--platform', dest = 'PlatformFile', required = True,
+ help = '''Build the platform specified by the DSC file name argument,
+ overriding target.txt's ACTIVE_PLATFORM definition.'''
+ )
+ parser.add_argument (
+ '-b', '--buildtarget', dest = 'BuildTarget', required = True,
+ help = '''Using the TARGET to build the platform, overriding
+ target.txt's TARGET definition.'''
+ )
+ parser.add_argument (
+ '--conf=', dest = 'ConfDirectory', required = True,
+ help = '''Specify the customized Conf directory.'''
+ )
+ parser.add_argument (
+ '-D', '--define', dest = 'Define', nargs='*', action = 'append',
+ help = '''Macro: "Name [= Value]".'''
+ )
+ parser.add_argument (
+ '--makefile', dest = 'Makefile', required = True,
+ help = '''Makefile to run passing in arguments as makefile defines.'''
+ )
+ parser.add_argument (
+ '-v', '--verbose', dest = 'Verbose', action = 'store_true',
+ help = '''Turn on verbose output with informational messages printed'''
+ )
+
+ #
+ # Parse command line arguments
+ #
+ gArgs, remaining = parser.parse_known_args()
+ gArgs.BuildType = 'all'
+ for BuildType in ['all', 'fds', 'genc', 'genmake', 'clean', 'cleanall', 'modules', 'libraries', 'run']:
+ if BuildType in remaining:
+ gArgs.BuildType = BuildType
+ remaining.remove(BuildType)
+ break
+ gArgs.Remaining = ' '.join(remaining)
+
+ #
+ # Start
+ #
+ Log ('Start')
+
+ #
+ # Find makefile in WORKSPACE or PACKAGES_PATH
+ #
+ PathList = ['']
+ try:
+ PathList.append(os.environ['WORKSPACE'])
+ except:
+ Error ('WORKSPACE environment variable not set')
+ try:
+ PathList += os.environ['PACKAGES_PATH'].split(os.pathsep)
+ except:
+ pass
+ for Path in PathList:
+ Makefile = NormalizePath((Path, gArgs.Makefile))
+ if os.path.exists (Makefile):
+ break
+ if not os.path.exists(Makefile):
+ Error ('makefile %s not found' % (gArgs.Makefile))
+
+ #
+ # Build command line arguments converting build arguments to makefile defines
+ #
+ CommandLine = [Makefile]
+ CommandLine.append('TARGET_ARCH="%s"' % (' '.join([Item[0] for Item in gArgs.Arch])))
+ CommandLine.append('TOOL_CHAIN_TAG="%s"' % (gArgs.ToolChain))
+ CommandLine.append('TARGET="%s"' % (gArgs.BuildTarget))
+ CommandLine.append('ACTIVE_PLATFORM="%s"' % (gArgs.PlatformFile))
+ CommandLine.append('CONF_DIRECTORY="%s"' % (gArgs.ConfDirectory))
+ if gArgs.Define:
+ for Item in gArgs.Define:
+ if '=' not in Item[0]:
+ continue
+ Item = Item[0].split('=', 1)
+ CommandLine.append('%s="%s"' % (Item[0], Item[1]))
+ CommandLine.append('EXTRA_FLAGS="%s"' % (gArgs.Remaining))
+ CommandLine.append(gArgs.BuildType)
+ if sys.platform == "win32":
+ CommandLine = 'nmake /f %s' % (' '.join(CommandLine))
+ else:
+ CommandLine = 'make -f %s' % (' '.join(CommandLine))
+
+ #
+ # Run the makefile
+ #
+ try:
+ Process = subprocess.Popen(CommandLine, shell=True)
+ except:
+ Error ('make command not available. Please verify PATH')
+ Process.communicate()
+
+ #
+ # Done
+ #
+ Log ('Done')
+
+ #
+ # Return status from running the makefile
+ #
+ sys.exit(Process.returncode)
diff --git a/roms/edk2/BaseTools/Scripts/RunMakefileSample.mak b/roms/edk2/BaseTools/Scripts/RunMakefileSample.mak
new file mode 100644
index 000000000..f144c74fc
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/RunMakefileSample.mak
@@ -0,0 +1,37 @@
+## @file
+# Sample makefile for PREBUILD or POSTBUILD action.
+#
+# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+all: show
+ @echo $@
+genc: show
+ @echo $@
+genmake: show
+ @echo $@
+modules: show
+ @echo $@
+libraries: show
+ @echo $@
+fds: show
+ @echo $@
+clean: show
+ @echo $@
+cleanall: show
+ @echo $@
+cleanlib: show
+ @echo $@
+run: show
+ @echo $@
+
+show:
+ @echo WORKSPACE........ $(WORKSPACE)
+ @echo PACKAGES_PATH.... $(PACKAGES_PATH)
+ @echo ACTIVE_PLATFORM.. $(ACTIVE_PLATFORM)
+ @echo TARGET_ARCH...... $(TARGET_ARCH)
+ @echo TOOL_CHAIN_TAG... $(TOOL_CHAIN_TAG)
+ @echo CONF_DIRECTORY... $(CONF_DIRECTORY)
+ @echo TARGET........... $(TARGET)
+ @echo EXTRA_FLAGS...... $(EXTRA_FLAGS)
diff --git a/roms/edk2/BaseTools/Scripts/Rvct-Align32.sct b/roms/edk2/BaseTools/Scripts/Rvct-Align32.sct
new file mode 100644
index 000000000..d0969a1a9
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/Rvct-Align32.sct
@@ -0,0 +1,19 @@
+/** @file
+
+ Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+REGION 0x220 RELOC {
+ ER_RO +0 ALIGN 32 {
+ * (+RO)
+ }
+ ER_RW +0 ALIGN 32 {
+ * (+RW)
+ }
+ ER_ZI +0 {
+ * (+ZI)
+ }
+}
diff --git a/roms/edk2/BaseTools/Scripts/Rvct-Align4K.sct b/roms/edk2/BaseTools/Scripts/Rvct-Align4K.sct
new file mode 100644
index 000000000..bf3738ac1
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/Rvct-Align4K.sct
@@ -0,0 +1,19 @@
+/** @file
+
+ Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+REGION 0x1000 RELOC {
+ ER_RO +0 ALIGN 4096 {
+ * (+RO)
+ }
+ ER_RW +0 ALIGN 4096 {
+ * (+RW)
+ }
+ ER_ZI +0 {
+ * (+ZI)
+ }
+}
diff --git a/roms/edk2/BaseTools/Scripts/SetVisualStudio.bat b/roms/edk2/BaseTools/Scripts/SetVisualStudio.bat
new file mode 100755
index 000000000..60d493a41
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/SetVisualStudio.bat
@@ -0,0 +1,102 @@
+@REM @file
+@REM Windows batch file to set up the Microsoft Visual Studio environment
+@REM
+@REM This script is used to set up one of the Microsoft Visual Studio
+@REM environments, VS2008x86, VS2010x86, VS2012x86 or VS2013x86 for
+@REM building the Nt32Pkg/Nt32Pkg.dsc emulation environment to run on
+@REM an X64 version of Windows.
+@REM The system environment variables in this script are set by the
+@rem Edk2Setup.bat script (that will be renamed to edksetup.bat).
+@REM
+@REM This script can also be used to build the Win32 binaries
+@REM
+@REM Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+@REM SPDX-License-Identifier: BSD-2-Clause-Patent
+@REM
+@echo off
+@if defined NT32_X64 @goto CheckLatest
+@if "%REBUILD_TOOLS%"=="TRUE" @goto RebuildTools
+
+:CheckLatest
+echo.
+@if defined VS140COMNTOOLS (
+ @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64"
+ @goto SetVs
+)
+
+@if defined VS120COMNTOOLS (
+ @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64"
+ @goto SetVs
+)
+
+@if defined VS110COMNTOOLS (
+ @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64"
+ @goto SetVs
+)
+
+@if defined VS100COMNTOOLS (
+ @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64"
+ @goto SetVs
+)
+
+@if defined VS90COMNTOOLS (
+ @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\x86_amd64"
+ @goto SetVs
+)
+@echo.
+@echo No version of Microsoft Visual Studio was found on this system
+@echo.
+@exit /B 1
+
+@REM Set up the X64 environment for building Nt32Pkg/Nt32Pkg.dsc to run on an X64 platform
+:SetVs
+if exist "%COMMONTOOLSx64%\vcvarsx86_amd64.bat" (
+ @call "%COMMONTOOLSx64%\vcvarsx86_amd64.bat"
+ @if errorlevel 1 (
+ @echo. ERROR setting Microsoft Visual Studio %1
+ @set COMMONTOOLSx64=
+ @exit /B 1
+ )
+)
+if not exist "%COMMONTOOLSx64%\vcvarsx86_amd64.bat" (
+ @echo ERROR : This script does not exist: "%COMMONTOOLSx64%\vcvarsx86_amd64.bat"
+ @set COMMONTOOLSx64=
+ @exit /B 1
+)
+@set COMMONTOOLSx64=
+@goto End
+
+:RebuildTools
+@call python "%BASE_TOOLS_PATH%\Scripts\UpdateBuildVersions.py"
+@set "BIN_DIR=%EDK_TOOLS_PATH%\Bin\Win32"
+if not exist "%BIN_DIR%" @mkdir "%BIN_DIR%"
+@echo Removing temporary and binary files
+@cd "%BASE_TOOLS_PATH%"
+@call nmake cleanall
+@echo Rebuilding the EDK II BaseTools
+@cd "%BASE_TOOLS_PATH%\Source\C"
+@call nmake -nologo -a -f Makefile
+@if errorlevel 1 (
+@echo Error building the C-based BaseTools
+@cd "%WORKSPACE%"
+@exit /B1
+)
+@cd %BASE_TOOLS_PATH%\Source\Python
+@call nmake -nologo -a -f Makefile
+@if errorlevel 1 (
+@echo Error building the Python-based BaseTools
+@cd %WORKSPACE%
+@exit /B1
+)
+@cd %WORKSPACE%
+
+@goto End
+
+:VersionNotFound
+@echo.
+@echo This Microsoft Visual Studio version is in not installed on this system: %1
+@echo.
+@exit /B 1
+
+:End
+@exit /B 0
diff --git a/roms/edk2/BaseTools/Scripts/SetupGit.py b/roms/edk2/BaseTools/Scripts/SetupGit.py
new file mode 100644
index 000000000..4416111ac
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/SetupGit.py
@@ -0,0 +1,213 @@
+## @file
+# Set up the git configuration for contributing to TianoCore projects
+#
+# Copyright (c) 2019, Linaro Ltd. All rights reserved.<BR>
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import print_function
+import argparse
+import os.path
+import re
+import sys
+
+try:
+ import git
+except ImportError:
+ print('Unable to load gitpython module - please install and try again.')
+ sys.exit(1)
+
+try:
+ # Try Python 2 'ConfigParser' module first since helpful lib2to3 will
+ # otherwise automagically load it with the name 'configparser'
+ import ConfigParser
+except ImportError:
+ # Otherwise, try loading the Python 3 'configparser' under an alias
+ try:
+ import configparser as ConfigParser
+ except ImportError:
+ print("Unable to load configparser/ConfigParser module - please install and try again!")
+ sys.exit(1)
+
+
+# Assumptions: Script is in edk2/BaseTools/Scripts,
+# templates in edk2/BaseTools/Conf
+CONFDIR = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
+ 'Conf')
+
+UPSTREAMS = [
+ {'name': 'edk2',
+ 'repo': 'https://github.com/tianocore/edk2.git',
+ 'list': 'devel@edk2.groups.io'},
+ {'name': 'edk2-platforms',
+ 'repo': 'https://github.com/tianocore/edk2-platforms.git',
+ 'list': 'devel@edk2.groups.io', 'prefix': 'edk2-platforms'},
+ {'name': 'edk2-non-osi',
+ 'repo': 'https://github.com/tianocore/edk2-non-osi.git',
+ 'list': 'devel@edk2.groups.io', 'prefix': 'edk2-non-osi'}
+ ]
+
+# The minimum version required for all of the below options to work
+MIN_GIT_VERSION = (1, 9, 0)
+
+# Set of options to be set identically for all repositories
+OPTIONS = [
+ {'section': 'am', 'option': 'keepcr', 'value': True},
+ {'section': 'am', 'option': 'signoff', 'value': True},
+ {'section': 'cherry-pick', 'option': 'signoff', 'value': True},
+ {'section': 'color', 'option': 'diff', 'value': True},
+ {'section': 'color', 'option': 'grep', 'value': 'auto'},
+ {'section': 'commit', 'option': 'signoff', 'value': True},
+ {'section': 'core', 'option': 'abbrev', 'value': 12},
+ {'section': 'core', 'option': 'attributesFile',
+ 'value': os.path.join(CONFDIR, 'gitattributes').replace('\\', '/')},
+ {'section': 'core', 'option': 'whitespace', 'value': 'cr-at-eol'},
+ {'section': 'diff', 'option': 'algorithm', 'value': 'patience'},
+ {'section': 'diff', 'option': 'orderFile',
+ 'value': os.path.join(CONFDIR, 'diff.order').replace('\\', '/')},
+ {'section': 'diff', 'option': 'renames', 'value': 'copies'},
+ {'section': 'diff', 'option': 'statGraphWidth', 'value': '20'},
+ {'section': 'diff "ini"', 'option': 'xfuncname',
+ 'value': '^\\\\[[A-Za-z0-9_., ]+]'},
+ {'section': 'format', 'option': 'coverLetter', 'value': True},
+ {'section': 'format', 'option': 'numbered', 'value': True},
+ {'section': 'format', 'option': 'signoff', 'value': False},
+ {'section': 'log', 'option': 'mailmap', 'value': True},
+ {'section': 'notes', 'option': 'rewriteRef', 'value': 'refs/notes/commits'},
+ {'section': 'sendemail', 'option': 'chainreplyto', 'value': False},
+ {'section': 'sendemail', 'option': 'thread', 'value': True},
+ {'section': 'sendemail', 'option': 'transferEncoding', 'value': '8bit'},
+ ]
+
+
+def locate_repo():
+ """Opens a Repo object for the current tree, searching upwards in the directory hierarchy."""
+ try:
+ repo = git.Repo(path='.', search_parent_directories=True)
+ except (git.InvalidGitRepositoryError, git.NoSuchPathError):
+ print("It doesn't look like we're inside a git repository - aborting.")
+ sys.exit(2)
+ return repo
+
+
+def fuzzy_match_repo_url(one, other):
+ """Compares two repository URLs, ignoring protocol and optional trailing '.git'."""
+ oneresult = re.match(r'.*://(?P<oneresult>.*?)(\.git)*$', one)
+ otherresult = re.match(r'.*://(?P<otherresult>.*?)(\.git)*$', other)
+
+ if oneresult and otherresult:
+ onestring = oneresult.group('oneresult')
+ otherstring = otherresult.group('otherresult')
+ if onestring == otherstring:
+ return True
+
+ return False
+
+
+def get_upstream(url, name):
+ """Extracts the dict for the current repo origin."""
+ for upstream in UPSTREAMS:
+ if (fuzzy_match_repo_url(upstream['repo'], url) or
+ upstream['name'] == name):
+ return upstream
+ print("Unknown upstream '%s' - aborting!" % url)
+ sys.exit(3)
+
+
+def check_versions():
+ """Checks versions of dependencies."""
+ version = git.cmd.Git().version_info
+
+ if version < MIN_GIT_VERSION:
+ print('Need git version %d.%d or later!' % (version[0], version[1]))
+ sys.exit(4)
+
+
+def write_config_value(repo, section, option, data):
+ """."""
+ with repo.config_writer(config_level='repository') as configwriter:
+ configwriter.set_value(section, option, data)
+
+
+if __name__ == '__main__':
+ check_versions()
+
+ PARSER = argparse.ArgumentParser(
+ description='Sets up a git repository according to TianoCore rules.')
+ PARSER.add_argument('-c', '--check',
+ help='check current config only, printing what would be changed',
+ action='store_true',
+ required=False)
+ PARSER.add_argument('-f', '--force',
+ help='overwrite existing settings conflicting with program defaults',
+ action='store_true',
+ required=False)
+ PARSER.add_argument('-n', '--name', type=str, metavar='repo',
+ choices=['edk2', 'edk2-platforms', 'edk2-non-osi'],
+ help='set the repo name to configure for, if not '
+ 'detected automatically',
+ required=False)
+ PARSER.add_argument('-v', '--verbose',
+ help='enable more detailed output',
+ action='store_true',
+ required=False)
+ ARGS = PARSER.parse_args()
+
+ REPO = locate_repo()
+ if REPO.bare:
+ print('Bare repo - please check out an upstream one!')
+ sys.exit(6)
+
+ URL = REPO.remotes.origin.url
+
+ UPSTREAM = get_upstream(URL, ARGS.name)
+ if not UPSTREAM:
+ print("Upstream '%s' unknown, aborting!" % URL)
+ sys.exit(7)
+
+ # Set a list email address if our upstream wants it
+ if 'list' in UPSTREAM:
+ OPTIONS.append({'section': 'sendemail', 'option': 'to',
+ 'value': UPSTREAM['list']})
+ # Append a subject prefix entry to OPTIONS if our upstream wants it
+ if 'prefix' in UPSTREAM:
+ OPTIONS.append({'section': 'format', 'option': 'subjectPrefix',
+ 'value': "PATCH " + UPSTREAM['prefix']})
+
+ CONFIG = REPO.config_reader(config_level='repository')
+
+ for entry in OPTIONS:
+ exists = False
+ try:
+ # Make sure to read boolean/int settings as real type rather than strings
+ if isinstance(entry['value'], bool):
+ value = CONFIG.getboolean(entry['section'], entry['option'])
+ elif isinstance(entry['value'], int):
+ value = CONFIG.getint(entry['section'], entry['option'])
+ else:
+ value = CONFIG.get(entry['section'], entry['option'])
+
+ exists = True
+ # Don't bail out from options not already being set
+ except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
+ pass
+
+ if exists:
+ if value == entry['value']:
+ if ARGS.verbose:
+ print("%s.%s already set (to '%s')" % (entry['section'],
+ entry['option'], value))
+ else:
+ if ARGS.force:
+ write_config_value(REPO, entry['section'], entry['option'], entry['value'])
+ else:
+ print("Not overwriting existing %s.%s value:" % (entry['section'],
+ entry['option']))
+ print(" '%s' != '%s'" % (value, entry['value']))
+ print(" add '-f' to command line to force overwriting existing settings")
+ else:
+ print("%s.%s => '%s'" % (entry['section'], entry['option'], entry['value']))
+ if not ARGS.check:
+ write_config_value(REPO, entry['section'], entry['option'], entry['value'])
diff --git a/roms/edk2/BaseTools/Scripts/ShowEnvironment.bat b/roms/edk2/BaseTools/Scripts/ShowEnvironment.bat
new file mode 100755
index 000000000..b91886b6a
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/ShowEnvironment.bat
@@ -0,0 +1,213 @@
+@REM @file
+@REM Windows batch file to display the Windows environment
+@REM
+@REM This script will be used to show the current EDK II build environment.
+@REM it may be called by the Edk2Setup.bat (that will be renamed to edksetup.bat) or
+@REM run as stand-alone application.
+@REM
+@REM Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+@REM SPDX-License-Identifier: BSD-2-Clause-Patent
+@REM
+@echo off
+@set SE_SVN_REVISION=$Revision: 8 $
+@set SE_VERSION=0.7.0.
+@if "%SCRIPT%"=="EDKSETUP_BAT" goto SkipCmdlineArgumentCheck
+
+:parse_cmd_line
+@if /I "%1"=="-h" @goto Usage
+@if /I "%1"=="--help" @goto Usage
+@if /I "%1"=="/?" @goto Usage
+@if /I "%1"=="-v" @goto Version
+@if /I "%1"=="--version" @goto Version
+
+:Usage
+@echo Usage: ShowEnvironment.bat [Options]
+@echo Copyright(c) 2014, Intel Corporation. All rights reserved.
+@echo.
+@echo Options:
+@echo --help, -h Print this help screen and exit
+@echo --version, -v Print this tool's version and exit
+@echo.
+@goto End
+
+:Version
+@echo ShowEnvironment.bat Version: %SE_VERSION%%SE_SVN_REVISION:~11,-1%
+@echo Copyright(c) 2014, Intel Corporation. All rights reserved.
+
+:SkipCmdlineArgumentCheck
+if defined SRC_CONF @goto SetEnv
+
+@echo.
+@echo #############################################################################
+@if defined WORKSPACE @echo WORKSPACE = %WORKSPACE%
+@if not defined WORKSPACE @echo WORKSPACE = Not Set
+@if defined PACKAGES_PATH @echo PACKAGES_PATH = %PACKAGES_PATH%
+@if defined EDK_TOOLS_PATH @echo EDK_TOOLS_PATH = %EDK_TOOLS_PATH%
+@if not defined EDK_TOOLS_PATH @echo EDK_TOOLS_PATH = Not Set
+@if defined BASE_TOOLS_PATH @echo BASE_TOOLS_PATH = %BASE_TOOLS_PATH%
+@if defined EDK_TOOLS_BIN @echo EDK_TOOLS_BIN = %EDK_TOOLS_BIN%
+@if "%NT32PKG%"=="TRUE" (
+ @echo.
+ @echo NOTE: Please configure your build to use the following TOOL_CHAIN_TAG
+ @echo when building NT32Pkg/Nt32Pkg.dsc
+ @if defined VCINSTALLDIR @call :CheckVsVer
+ @set TEST_VS=
+)
+@if defined HIDE_PATH goto End
+
+
+@echo ############################## PATH #########################################
+@setlocal DisableDelayedExpansion
+@set "var=%PATH%"
+@set "var=%var:"=""%"
+@set "var=%var:^=^^%"
+@set "var=%var:&=^&%"
+@set "var=%var:|=^|%"
+@set "var=%var:<=^<%"
+@set "var=%var:>=^>%"
+@set "var=%var:;=^;^;%"
+@set var=%var:""="%
+@set "var=%var:"=""Q%"
+@set "var=%var:;;="S"S%"
+@set "var=%var:^;^;=;%"
+@set "var=%var:""="%"
+@setlocal EnableDelayedExpansion
+@set "var=!var:"Q=!"
+@for %%a in ("!var:"S"S=";"!") do (
+ @if "!!"=="" endlocal
+ @if %%a neq "" echo %%~a
+)
+@goto End
+
+:CheckVsVer
+@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 9.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2008x86
+ @goto :EOF
+)
+@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 9.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2008
+ @goto :EOF
+)
+
+@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2010x86
+ @goto :EOF
+)
+@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 10.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2010
+ @goto :EOF
+)
+
+@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2012x86
+ @goto :EOF
+)
+@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 11.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2012
+ @goto :EOF
+)
+
+@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2013x86
+ @goto :EOF
+)
+@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 12.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2013
+ @goto :EOF
+)
+
+@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2015x86
+ @goto :EOF
+)
+@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 14.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2015
+ @goto :EOF
+)
+@goto :EOF
+
+:SetEnv
+@set FIRST_COPY=FALSE
+@set MISSING_TARGET_TEMPLATE=FALSE
+@set MISSING_TOOLS_DEF_TEMPLATE=FALSE
+@set MISSING_BUILD_RULE_TEMPLATE=FALSE
+@if not exist "%SRC_CONF%\target.template" @set MISSING_TARGET_TEMPLATE=TRUE
+@if not exist "%SRC_CONF%\tools_def.template" @set MISSING_TOOLS_DEF_TEMPLATE=TRUE
+@if not exist "%SRC_CONF%\build_rule.template" @set MISSING_BUILD_RULE_TEMPLATE=TRUE
+
+@if not exist "%WORKSPACE%\Conf\target.txt" (
+ @if "%MISSING_TARGET_TEMPLATE%"=="TRUE" @goto MissingTemplates
+ @echo copying ... target.template to %WORKSPACE%\Conf\target.txt
+ @copy /Y "%SRC_CONF%\target.template" "%WORKSPACE%\Conf\target.txt" > nul
+ @set FIRST_COPY=TRUE
+)
+@if not exist "%WORKSPACE%\Conf\tools_def.txt" (
+ @if "%MISSING_TOOLS_DEF_TEMPLATE%"=="TRUE" @goto MissingTemplates
+ @echo copying ... tools_def.template to %WORKSPACE%\Conf\tools_def.txt
+ @copy /Y "%SRC_CONF%\tools_def.template" "%WORKSPACE%\Conf\tools_def.txt" > nul
+ @set FIRST_COPY=TRUE
+)
+@if not exist "%WORKSPACE%\Conf\build_rule.txt" (
+ @if "%MISSING_BUILD_RULE_TEMPLATE%"=="TRUE" @goto MissingTemplates
+ @echo copying ... build_rule.template to %WORKSPACE%\Conf\build_rule.txt
+ @copy /Y "%SRC_CONF%\build_rule.template" "%WORKSPACE%\Conf\build_rule.txt" > nul
+ @set FIRST_COPY=TRUE
+)
+
+@if "%FIRST_COPY%"=="TRUE" @goto End
+@if not "%RECONFIG%"=="TRUE" @goto End
+
+@if "%RECONFIG%"=="TRUE" (
+ @echo.
+ @echo Over-writing the files in the WORKSPACE\Conf directory
+ @echo using the default template files
+ @echo.
+ @if "%MISSING_TARGET_TEMPLATE%"=="TRUE" @goto MissingTemplates
+ @echo over-write ... target.template to %WORKSPACE%\Conf\target.txt
+ @copy /Y "%SRC_CONF%\target.template" "%WORKSPACE%\Conf\target.txt" > nul
+
+ @if "%MISSING_TOOLS_DEF_TEMPLATE%"=="TRUE" @goto MissingTemplates
+ @echo over-write ... tools_def.template to %WORKSPACE%\Conf\tools_def.txt
+ @copy /Y "%SRC_CONF%\tools_def.template" "%WORKSPACE%\Conf\tools_def.txt" > nul
+
+ @if "%MISSING_BUILD_RULE_TEMPLATE%"=="TRUE" @goto MissingTemplates
+ @echo over-write ... build_rule.template to %WORKSPACE%\Conf\build_rule.txt
+ @copy /Y "%SRC_CONF%\build_rule.template" "%WORKSPACE%\Conf\build_rule.txt" > nul
+ @goto End
+)
+
+:MissingTemplates
+@echo.
+@if "%RECONFIG%"=="TRUE" @echo ERROR : Reconfig failed
+@if "%MISSING_TARGET_TEMPLATE%"=="TRUE" @echo ERROR : Unable to locate: "%SRC_CONF%\target.template"
+@if "%MISSING_TOOLS_DEF_TEMPLATE%"=="TRUE" @echo ERROR : Unable to locate: "%SRC_CONF%\tools_def.template"
+@if "%MISSING_BUILD_RULE_TEMPLATE%"=="TRUE" @echo ERROR : Unable to locate: "%SRC_CONF%\build_rule.template"
+@echo.
+@set MISSING_TARGET_TEMPLATE=
+@set MISSING_TOOLS_DEF_TEMPLATE=
+@set MISSING_BUILD_RULE_TEMPLATE=
+@set FIRST_COPY=
+@set SE_VERSION=
+@set SE_SVN_REVISION=
+@if not "%SCRIPT%"=="EDKSETUP_BAT" @echo on
+exit /B 1
+
+:End
+@set MISSING_TARGET_TEMPLATE=
+@set MISSING_TOOLS_DEF_TEMPLATE=
+@set MISSING_BUILD_RULE_TEMPLATE=
+@set FIRST_COPY=
+@set SE_VERSION=
+@set SE_SVN_REVISION=
+@if not "%SCRIPT%"=="EDKSETUP_BAT" @echo on
+exit /B 0
diff --git a/roms/edk2/BaseTools/Scripts/SmiHandlerProfileSymbolGen.py b/roms/edk2/BaseTools/Scripts/SmiHandlerProfileSymbolGen.py
new file mode 100644
index 000000000..1e2e7fd10
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/SmiHandlerProfileSymbolGen.py
@@ -0,0 +1,307 @@
+##
+# Generate symbal for SMI handler profile info.
+#
+# This tool depends on DIA2Dump.exe (VS) or nm (gcc) to parse debug entry.
+#
+# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+from __future__ import print_function
+import os
+import re
+import sys
+from optparse import OptionParser
+
+from xml.dom.minidom import parse
+import xml.dom.minidom
+
+versionNumber = "1.1"
+__copyright__ = "Copyright (c) 2016, Intel Corporation. All rights reserved."
+
+class Symbols:
+ def __init__(self):
+ self.listLineAddress = []
+ self.pdbName = ""
+ # Cache for function
+ self.functionName = ""
+ # Cache for line
+ self.sourceName = ""
+
+
+ def getSymbol (self, rva):
+ index = 0
+ lineName = 0
+ sourceName = "??"
+ while index + 1 < self.lineCount :
+ if self.listLineAddress[index][0] <= rva and self.listLineAddress[index + 1][0] > rva :
+ offset = rva - self.listLineAddress[index][0]
+ functionName = self.listLineAddress[index][1]
+ lineName = self.listLineAddress[index][2]
+ sourceName = self.listLineAddress[index][3]
+ if lineName == 0 :
+ return [functionName]
+ else :
+ return [functionName, sourceName, lineName]
+ index += 1
+
+ return []
+
+ def parse_debug_file(self, driverName, pdbName):
+ if cmp (pdbName, "") == 0 :
+ return
+ self.pdbName = pdbName;
+
+ try:
+ nmCommand = "nm"
+ nmLineOption = "-l"
+ print("parsing (debug) - " + pdbName)
+ os.system ('%s %s %s > nmDump.line.log' % (nmCommand, nmLineOption, pdbName))
+ except :
+ print('ERROR: nm command not available. Please verify PATH')
+ return
+
+ #
+ # parse line
+ #
+ linefile = open("nmDump.line.log")
+ reportLines = linefile.readlines()
+ linefile.close()
+
+ # 000113ca T AllocatePool c:\home\edk-ii\MdePkg\Library\UefiMemoryAllocationLib\MemoryAllocationLib.c:399
+ patchLineFileMatchString = "([0-9a-fA-F]*)\s+[T|D|t|d]\s+(\w+)\s*((?:[a-zA-Z]:)?[\w+\-./_a-zA-Z0-9\\\\]*):?([0-9]*)"
+
+ for reportLine in reportLines:
+ match = re.match(patchLineFileMatchString, reportLine)
+ if match is not None:
+ rva = int (match.group(1), 16)
+ functionName = match.group(2)
+ sourceName = match.group(3)
+ if cmp (match.group(4), "") != 0 :
+ lineName = int (match.group(4))
+ else :
+ lineName = 0
+ self.listLineAddress.append ([rva, functionName, lineName, sourceName])
+
+ self.lineCount = len (self.listLineAddress)
+
+ self.listLineAddress = sorted(self.listLineAddress, key=lambda symbolAddress:symbolAddress[0])
+
+ def parse_pdb_file(self, driverName, pdbName):
+ if cmp (pdbName, "") == 0 :
+ return
+ self.pdbName = pdbName;
+
+ try:
+ #DIA2DumpCommand = "\"C:\\Program Files (x86)\Microsoft Visual Studio 14.0\\DIA SDK\\Samples\\DIA2Dump\\x64\\Debug\\Dia2Dump.exe\""
+ DIA2DumpCommand = "Dia2Dump.exe"
+ #DIA2SymbolOption = "-p"
+ DIA2LinesOption = "-l"
+ print("parsing (pdb) - " + pdbName)
+ #os.system ('%s %s %s > DIA2Dump.symbol.log' % (DIA2DumpCommand, DIA2SymbolOption, pdbName))
+ os.system ('%s %s %s > DIA2Dump.line.log' % (DIA2DumpCommand, DIA2LinesOption, pdbName))
+ except :
+ print('ERROR: DIA2Dump command not available. Please verify PATH')
+ return
+
+ #
+ # parse line
+ #
+ linefile = open("DIA2Dump.line.log")
+ reportLines = linefile.readlines()
+ linefile.close()
+
+ # ** GetDebugPrintErrorLevel
+ # line 32 at [0000C790][0001:0000B790], len = 0x3 c:\home\edk-ii\mdepkg\library\basedebugprinterrorlevellib\basedebugprinterrorlevellib.c (MD5: 687C0AE564079D35D56ED5D84A6164CC)
+ # line 36 at [0000C793][0001:0000B793], len = 0x5
+ # line 37 at [0000C798][0001:0000B798], len = 0x2
+
+ patchLineFileMatchString = "\s+line ([0-9]+) at \[([0-9a-fA-F]{8})\]\[[0-9a-fA-F]{4}\:[0-9a-fA-F]{8}\], len = 0x[0-9a-fA-F]+\s*([\w+\-\:./_a-zA-Z0-9\\\\]*)\s*"
+ patchLineFileMatchStringFunc = "\*\*\s+(\w+)\s*"
+
+ for reportLine in reportLines:
+ match = re.match(patchLineFileMatchString, reportLine)
+ if match is not None:
+ if cmp (match.group(3), "") != 0 :
+ self.sourceName = match.group(3)
+ sourceName = self.sourceName
+ functionName = self.functionName
+
+ rva = int (match.group(2), 16)
+ lineName = int (match.group(1))
+ self.listLineAddress.append ([rva, functionName, lineName, sourceName])
+ else :
+ match = re.match(patchLineFileMatchStringFunc, reportLine)
+ if match is not None:
+ self.functionName = match.group(1)
+
+ self.lineCount = len (self.listLineAddress)
+ self.listLineAddress = sorted(self.listLineAddress, key=lambda symbolAddress:symbolAddress[0])
+
+class SymbolsFile:
+ def __init__(self):
+ self.symbolsTable = {}
+
+symbolsFile = ""
+
+driverName = ""
+rvaName = ""
+symbolName = ""
+
+def getSymbolName(driverName, rva):
+ global symbolsFile
+
+ try :
+ symbolList = symbolsFile.symbolsTable[driverName]
+ if symbolList is not None:
+ return symbolList.getSymbol (rva)
+ else:
+ return []
+ except Exception:
+ return []
+
+def myOptionParser():
+ usage = "%prog [--version] [-h] [--help] [-i inputfile [-o outputfile] [-g guidreffile]]"
+ Parser = OptionParser(usage=usage, description=__copyright__, version="%prog " + str(versionNumber))
+ Parser.add_option("-i", "--inputfile", dest="inputfilename", type="string", help="The input memory profile info file output from MemoryProfileInfo application in MdeModulePkg")
+ Parser.add_option("-o", "--outputfile", dest="outputfilename", type="string", help="The output memory profile info file with symbol, MemoryProfileInfoSymbol.txt will be used if it is not specified")
+ Parser.add_option("-g", "--guidref", dest="guidreffilename", type="string", help="The input guid ref file output from build")
+
+ (Options, args) = Parser.parse_args()
+ if Options.inputfilename is None:
+ Parser.error("no input file specified")
+ if Options.outputfilename is None:
+ Options.outputfilename = "SmiHandlerProfileInfoSymbol.xml"
+ return Options
+
+dictGuid = {
+ '00000000-0000-0000-0000-000000000000':'gZeroGuid',
+ '2A571201-4966-47F6-8B86-F31E41F32F10':'gEfiEventLegacyBootGuid',
+ '27ABF055-B1B8-4C26-8048-748F37BAA2DF':'gEfiEventExitBootServicesGuid',
+ '7CE88FB3-4BD7-4679-87A8-A8D8DEE50D2B':'gEfiEventReadyToBootGuid',
+ '02CE967A-DD7E-4FFC-9EE7-810CF0470880':'gEfiEndOfDxeEventGroupGuid',
+ '60FF8964-E906-41D0-AFED-F241E974E08E':'gEfiDxeSmmReadyToLockProtocolGuid',
+ '18A3C6DC-5EEA-48C8-A1C1-B53389F98999':'gEfiSmmSwDispatch2ProtocolGuid',
+ '456D2859-A84B-4E47-A2EE-3276D886997D':'gEfiSmmSxDispatch2ProtocolGuid',
+ '4CEC368E-8E8E-4D71-8BE1-958C45FC8A53':'gEfiSmmPeriodicTimerDispatch2ProtocolGuid',
+ 'EE9B8D90-C5A6-40A2-BDE2-52558D33CCA1':'gEfiSmmUsbDispatch2ProtocolGuid',
+ '25566B03-B577-4CBF-958C-ED663EA24380':'gEfiSmmGpiDispatch2ProtocolGuid',
+ '7300C4A1-43F2-4017-A51B-C81A7F40585B':'gEfiSmmStandbyButtonDispatch2ProtocolGuid',
+ '1B1183FA-1823-46A7-8872-9C578755409D':'gEfiSmmPowerButtonDispatch2ProtocolGuid',
+ '58DC368D-7BFA-4E77-ABBC-0E29418DF930':'gEfiSmmIoTrapDispatch2ProtocolGuid',
+ }
+
+def genGuidString(guidreffile):
+ guidLines = guidreffile.readlines()
+ for guidLine in guidLines:
+ guidLineList = guidLine.split(" ")
+ if len(guidLineList) == 2:
+ guid = guidLineList[0]
+ guidName = guidLineList[1]
+ if guid not in dictGuid :
+ dictGuid[guid] = guidName
+
+def createSym(symbolName):
+ SymbolNode = xml.dom.minidom.Document().createElement("Symbol")
+ SymbolFunction = xml.dom.minidom.Document().createElement("Function")
+ SymbolFunctionData = xml.dom.minidom.Document().createTextNode(symbolName[0])
+ SymbolFunction.appendChild(SymbolFunctionData)
+ SymbolNode.appendChild(SymbolFunction)
+ if (len(symbolName)) >= 2:
+ SymbolSourceFile = xml.dom.minidom.Document().createElement("SourceFile")
+ SymbolSourceFileData = xml.dom.minidom.Document().createTextNode(symbolName[1])
+ SymbolSourceFile.appendChild(SymbolSourceFileData)
+ SymbolNode.appendChild(SymbolSourceFile)
+ if (len(symbolName)) >= 3:
+ SymbolLineNumber = xml.dom.minidom.Document().createElement("LineNumber")
+ SymbolLineNumberData = xml.dom.minidom.Document().createTextNode(str(symbolName[2]))
+ SymbolLineNumber.appendChild(SymbolLineNumberData)
+ SymbolNode.appendChild(SymbolLineNumber)
+ return SymbolNode
+
+def main():
+ global symbolsFile
+ global Options
+ Options = myOptionParser()
+
+ symbolsFile = SymbolsFile()
+
+ try :
+ DOMTree = xml.dom.minidom.parse(Options.inputfilename)
+ except Exception:
+ print("fail to open input " + Options.inputfilename)
+ return 1
+
+ if Options.guidreffilename is not None:
+ try :
+ guidreffile = open(Options.guidreffilename)
+ except Exception:
+ print("fail to open guidref" + Options.guidreffilename)
+ return 1
+ genGuidString(guidreffile)
+ guidreffile.close()
+
+ SmiHandlerProfile = DOMTree.documentElement
+
+ SmiHandlerDatabase = SmiHandlerProfile.getElementsByTagName("SmiHandlerDatabase")
+ SmiHandlerCategory = SmiHandlerDatabase[0].getElementsByTagName("SmiHandlerCategory")
+ for smiHandlerCategory in SmiHandlerCategory:
+ SmiEntry = smiHandlerCategory.getElementsByTagName("SmiEntry")
+ for smiEntry in SmiEntry:
+ if smiEntry.hasAttribute("HandlerType"):
+ guidValue = smiEntry.getAttribute("HandlerType")
+ if guidValue in dictGuid:
+ smiEntry.setAttribute("HandlerType", dictGuid[guidValue])
+ SmiHandler = smiEntry.getElementsByTagName("SmiHandler")
+ for smiHandler in SmiHandler:
+ Module = smiHandler.getElementsByTagName("Module")
+ Pdb = Module[0].getElementsByTagName("Pdb")
+ if (len(Pdb)) >= 1:
+ driverName = Module[0].getAttribute("Name")
+ pdbName = Pdb[0].childNodes[0].data
+
+ Module[0].removeChild(Pdb[0])
+
+ symbolsFile.symbolsTable[driverName] = Symbols()
+
+ if cmp (pdbName[-3:], "pdb") == 0 :
+ symbolsFile.symbolsTable[driverName].parse_pdb_file (driverName, pdbName)
+ else :
+ symbolsFile.symbolsTable[driverName].parse_debug_file (driverName, pdbName)
+
+ Handler = smiHandler.getElementsByTagName("Handler")
+ RVA = Handler[0].getElementsByTagName("RVA")
+ print(" Handler RVA: %s" % RVA[0].childNodes[0].data)
+
+ if (len(RVA)) >= 1:
+ rvaName = RVA[0].childNodes[0].data
+ symbolName = getSymbolName (driverName, int(rvaName, 16))
+
+ if (len(symbolName)) >= 1:
+ SymbolNode = createSym(symbolName)
+ Handler[0].appendChild(SymbolNode)
+
+ Caller = smiHandler.getElementsByTagName("Caller")
+ RVA = Caller[0].getElementsByTagName("RVA")
+ print(" Caller RVA: %s" % RVA[0].childNodes[0].data)
+
+ if (len(RVA)) >= 1:
+ rvaName = RVA[0].childNodes[0].data
+ symbolName = getSymbolName (driverName, int(rvaName, 16))
+
+ if (len(symbolName)) >= 1:
+ SymbolNode = createSym(symbolName)
+ Caller[0].appendChild(SymbolNode)
+
+ try :
+ newfile = open(Options.outputfilename, "w")
+ except Exception:
+ print("fail to open output" + Options.outputfilename)
+ return 1
+
+ newfile.write(DOMTree.toprettyxml(indent = "\t", newl = "\n", encoding = "utf-8"))
+ newfile.close()
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/roms/edk2/BaseTools/Scripts/UpdateBuildVersions.py b/roms/edk2/BaseTools/Scripts/UpdateBuildVersions.py
new file mode 100755
index 000000000..0f019f25c
--- /dev/null
+++ b/roms/edk2/BaseTools/Scripts/UpdateBuildVersions.py
@@ -0,0 +1,398 @@
+## @file
+# Update build revisions of the tools when performing a developer build
+#
+# This script will modife the C/Include/Common/BuildVersion.h file and the two
+# Python scripts, Python/Common/BuildVersion.py and Python/UPT/BuildVersion.py.
+# If SVN is available, the tool will obtain the current checked out version of
+# the source tree for including the --version commands.
+
+# Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+""" This program will update the BuildVersion.py and BuildVersion.h files used to set a tool's version value """
+from __future__ import absolute_import
+
+import os
+import shlex
+import subprocess
+import sys
+
+from argparse import ArgumentParser, SUPPRESS
+from tempfile import NamedTemporaryFile
+from types import IntType, ListType
+
+
+SYS_ENV_ERR = "ERROR : %s system environment variable must be set prior to running this tool.\n"
+
+__execname__ = "UpdateBuildVersions.py"
+SVN_REVISION = "$LastChangedRevision: 3 $"
+SVN_REVISION = SVN_REVISION.replace("$LastChangedRevision:", "").replace("$", "").strip()
+__copyright__ = "Copyright (c) 2014, Intel Corporation. All rights reserved."
+VERSION_NUMBER = "0.7.0"
+__version__ = "Version %s.%s" % (VERSION_NUMBER, SVN_REVISION)
+
+
+def ParseOptions():
+ """
+ Parse the command-line options.
+ The options for this tool will be passed along to the MkBinPkg tool.
+ """
+ parser = ArgumentParser(
+ usage=("%s [options]" % __execname__),
+ description=__copyright__,
+ conflict_handler='resolve')
+
+ # Standard Tool Options
+ parser.add_argument("--version", action="version",
+ version=__execname__ + " " + __version__)
+ parser.add_argument("-s", "--silent", action="store_true",
+ dest="silent",
+ help="All output will be disabled, pass/fail determined by the exit code")
+ parser.add_argument("-v", "--verbose", action="store_true",
+ dest="verbose",
+ help="Enable verbose output")
+ # Tool specific options
+ parser.add_argument("--revert", action="store_true",
+ dest="REVERT", default=False,
+ help="Revert the BuildVersion files only")
+ parser.add_argument("--svn-test", action="store_true",
+ dest="TEST_SVN", default=False,
+ help="Test if the svn command is available")
+ parser.add_argument("--svnFlag", action="store_true",
+ dest="HAVE_SVN", default=False,
+ help=SUPPRESS)
+
+ return(parser.parse_args())
+
+
+def ShellCommandResults(CmdLine, Opt):
+ """ Execute the command, returning the output content """
+ file_list = NamedTemporaryFile(delete=False)
+ filename = file_list.name
+ Results = []
+
+ returnValue = 0
+ try:
+ subprocess.check_call(args=shlex.split(CmdLine), stderr=subprocess.STDOUT, stdout=file_list)
+ except subprocess.CalledProcessError as err_val:
+ file_list.close()
+ if not Opt.silent:
+ sys.stderr.write("ERROR : %d : %s\n" % (err_val.returncode, err_val.__str__()))
+ if os.path.exists(filename):
+ sys.stderr.write(" : Partial results may be in this file: %s\n" % filename)
+ sys.stderr.flush()
+ returnValue = err_val.returncode
+
+ except IOError as err_val:
+ (errno, strerror) = err_val.args
+ file_list.close()
+ if not Opt.silent:
+ sys.stderr.write("I/O ERROR : %s : %s\n" % (str(errno), strerror))
+ sys.stderr.write("ERROR : this command failed : %s\n" % CmdLine)
+ if os.path.exists(filename):
+ sys.stderr.write(" : Partial results may be in this file: %s\n" % filename)
+ sys.stderr.flush()
+ returnValue = errno
+
+ except OSError as err_val:
+ (errno, strerror) = err_val.args
+ file_list.close()
+ if not Opt.silent:
+ sys.stderr.write("OS ERROR : %s : %s\n" % (str(errno), strerror))
+ sys.stderr.write("ERROR : this command failed : %s\n" % CmdLine)
+ if os.path.exists(filename):
+ sys.stderr.write(" : Partial results may be in this file: %s\n" % filename)
+ sys.stderr.flush()
+ returnValue = errno
+
+ except KeyboardInterrupt:
+ file_list.close()
+ if not Opt.silent:
+ sys.stderr.write("ERROR : Command terminated by user : %s\n" % CmdLine)
+ if os.path.exists(filename):
+ sys.stderr.write(" : Partial results may be in this file: %s\n" % filename)
+ sys.stderr.flush()
+ returnValue = 1
+
+ finally:
+ if not file_list.closed:
+ file_list.flush()
+ os.fsync(file_list.fileno())
+ file_list.close()
+
+ if os.path.exists(filename):
+ fd_ = open(filename, 'r')
+ Results = fd_.readlines()
+ fd_.close()
+ os.unlink(filename)
+
+ if returnValue > 0:
+ return returnValue
+
+ return Results
+
+
+def UpdateBuildVersionPython(Rev, UserModified, opts):
+ """ This routine will update the BuildVersion.h files in the C source tree """
+ for SubDir in ["Common", "UPT"]:
+ PyPath = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source", "Python", SubDir)
+ BuildVersionPy = os.path.join(PyPath, "BuildVersion.py")
+ fd_ = open(os.path.normpath(BuildVersionPy), 'r')
+ contents = fd_.readlines()
+ fd_.close()
+ if opts.HAVE_SVN is False:
+ BuildVersionOrig = os.path.join(PyPath, "orig_BuildVersion.py")
+ fd_ = open (BuildVersionOrig, 'w')
+ for line in contents:
+ fd_.write(line)
+ fd_.flush()
+ fd_.close()
+ new_content = []
+ for line in contents:
+ if line.strip().startswith("gBUILD_VERSION"):
+ new_line = "gBUILD_VERSION = \"Developer Build based on Revision: %s\"" % Rev
+ if UserModified:
+ new_line = "gBUILD_VERSION = \"Developer Build based on Revision: %s with Modified Sources\"" % Rev
+ new_content.append(new_line)
+ continue
+ new_content.append(line)
+
+ fd_ = open(os.path.normpath(BuildVersionPy), 'w')
+ for line in new_content:
+ fd_.write(line)
+ fd_.close()
+
+
+def UpdateBuildVersionH(Rev, UserModified, opts):
+ """ This routine will update the BuildVersion.h files in the C source tree """
+ CPath = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source", "C", "Include", "Common")
+ BuildVersionH = os.path.join(CPath, "BuildVersion.h")
+ fd_ = open(os.path.normpath(BuildVersionH), 'r')
+ contents = fd_.readlines()
+ fd_.close()
+ if opts.HAVE_SVN is False:
+ BuildVersionOrig = os.path.join(CPath, "orig_BuildVersion.h")
+ fd_ = open(BuildVersionOrig, 'w')
+ for line in contents:
+ fd_.write(line)
+ fd_.flush()
+ fd_.close()
+
+ new_content = []
+ for line in contents:
+ if line.strip().startswith("#define"):
+ new_line = "#define __BUILD_VERSION \"Developer Build based on Revision: %s\"" % Rev
+ if UserModified:
+ new_line = "#define __BUILD_VERSION \"Developer Build based on Revision: %s with Modified Sources\"" % \
+ Rev
+ new_content.append(new_line)
+ continue
+ new_content.append(line)
+
+ fd_ = open(os.path.normpath(BuildVersionH), 'w')
+ for line in new_content:
+ fd_.write(line)
+ fd_.close()
+
+
+def RevertCmd(Filename, Opt):
+ """ This is the shell command that does the SVN revert """
+ CmdLine = "svn revert %s" % Filename.replace("\\", "/").strip()
+ try:
+ subprocess.check_output(args=shlex.split(CmdLine))
+ except subprocess.CalledProcessError as err_val:
+ if not Opt.silent:
+ sys.stderr.write("Subprocess ERROR : %s\n" % err_val)
+ sys.stderr.flush()
+
+ except IOError as err_val:
+ (errno, strerror) = err_val.args
+ if not Opt.silent:
+ sys.stderr.write("I/O ERROR : %d : %s\n" % (str(errno), strerror))
+ sys.stderr.write("ERROR : this command failed : %s\n" % CmdLine)
+ sys.stderr.flush()
+
+ except OSError as err_val:
+ (errno, strerror) = err_val.args
+ if not Opt.silent:
+ sys.stderr.write("OS ERROR : %d : %s\n" % (str(errno), strerror))
+ sys.stderr.write("ERROR : this command failed : %s\n" % CmdLine)
+ sys.stderr.flush()
+
+ except KeyboardInterrupt:
+ if not Opt.silent:
+ sys.stderr.write("ERROR : Command terminated by user : %s\n" % CmdLine)
+ sys.stderr.flush()
+
+ if Opt.verbose:
+ sys.stdout.write("Reverted this file: %s\n" % Filename)
+ sys.stdout.flush()
+
+
+def GetSvnRevision(opts):
+ """ Get the current revision of the BaseTools/Source tree, and check if any of the files have been modified """
+ Revision = "Unknown"
+ Modified = False
+
+ if opts.HAVE_SVN is False:
+ sys.stderr.write("WARNING: the svn command-line tool is not available.\n")
+ return (Revision, Modified)
+
+ SrcPath = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source")
+ # Check if there are modified files.
+ Cwd = os.getcwd()
+ os.chdir(SrcPath)
+
+ StatusCmd = "svn st -v --depth infinity --non-interactive"
+ contents = ShellCommandResults(StatusCmd, opts)
+ os.chdir(Cwd)
+ if isinstance(contents, ListType):
+ for line in contents:
+ if line.startswith("M "):
+ Modified = True
+ break
+
+ # Get the repository revision of BaseTools/Source
+ InfoCmd = "svn info %s" % SrcPath.replace("\\", "/").strip()
+ Revision = 0
+ contents = ShellCommandResults(InfoCmd, opts)
+ if isinstance(contents, IntType):
+ return 0, Modified
+ for line in contents:
+ line = line.strip()
+ if line.startswith("Revision:"):
+ Revision = line.replace("Revision:", "").strip()
+ break
+
+ return (Revision, Modified)
+
+
+def CheckSvn(opts):
+ """
+ This routine will return True if an svn --version command succeeds, or False if it fails.
+ If it failed, SVN is not available.
+ """
+ OriginalSilent = opts.silent
+ opts.silent = True
+ VerCmd = "svn --version"
+ contents = ShellCommandResults(VerCmd, opts)
+ opts.silent = OriginalSilent
+ if isinstance(contents, IntType):
+ if opts.verbose:
+ sys.stdout.write("SVN does not appear to be available.\n")
+ sys.stdout.flush()
+ return False
+
+ if opts.verbose:
+ sys.stdout.write("Found %s" % contents[0])
+ sys.stdout.flush()
+ return True
+
+
+def CopyOrig(Src, Dest, Opt):
+ """ Overwrite the Dest File with the Src File content """
+ try:
+ fd_ = open(Src, 'r')
+ contents = fd_.readlines()
+ fd_.close()
+ fd_ = open(Dest, 'w')
+ for line in contents:
+ fd_.write(line)
+ fd_.flush()
+ fd_.close()
+ except IOError:
+ if not Opt.silent:
+ sys.stderr.write("Unable to restore this file: %s\n" % Dest)
+ sys.stderr.flush()
+ return 1
+
+ os.remove(Src)
+ if Opt.verbose:
+ sys.stdout.write("Restored this file: %s\n" % Src)
+ sys.stdout.flush()
+
+ return 0
+
+
+def CheckOriginals(Opts):
+ """
+ If SVN was not available, then the tools may have made copies of the original BuildVersion.* files using
+ orig_BuildVersion.* for the name. If they exist, replace the existing BuildVersion.* file with the corresponding
+ orig_BuildVersion.* file.
+ Returns 0 if this succeeds, or 1 if the copy function fails. It will also return 0 if the orig_BuildVersion.* file
+ does not exist.
+ """
+ CPath = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source", "C", "Include", "Common")
+ BuildVersionH = os.path.join(CPath, "BuildVersion.h")
+ OrigBuildVersionH = os.path.join(CPath, "orig_BuildVersion.h")
+ if not os.path.exists(OrigBuildVersionH):
+ return 0
+ if CopyOrig(OrigBuildVersionH, BuildVersionH, Opts):
+ return 1
+ for SubDir in ["Common", "UPT"]:
+ PyPath = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source", "Python", SubDir)
+ BuildVersionPy = os.path.join(PyPath, "BuildVersion.h")
+ OrigBuildVersionPy = os.path.join(PyPath, "orig_BuildVersion.h")
+ if not os.path.exists(OrigBuildVersionPy):
+ return 0
+ if CopyOrig(OrigBuildVersionPy, BuildVersionPy, Opts):
+ return 1
+
+ return 0
+
+
+def RevertBuildVersionFiles(opts):
+ """
+ This routine will attempt to perform an SVN --revert on each of the BuildVersion.* files
+ """
+ if not opts.HAVE_SVN:
+ if CheckOriginals(opts):
+ return 1
+ return 0
+ # SVN is available
+ BuildVersionH = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source", "C", "Include", "Common", "BuildVersion.h")
+ RevertCmd(BuildVersionH, opts)
+ for SubDir in ["Common", "UPT"]:
+ BuildVersionPy = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source", "Python", SubDir, "BuildVersion.py")
+ RevertCmd(BuildVersionPy, opts)
+
+def UpdateRevisionFiles():
+ """ Main routine that will update the BuildVersion.py and BuildVersion.h files."""
+ options = ParseOptions()
+ # Check the working environment
+ if "WORKSPACE" not in os.environ.keys():
+ sys.stderr.write(SYS_ENV_ERR % 'WORKSPACE')
+ return 1
+ if 'BASE_TOOLS_PATH' not in os.environ.keys():
+ sys.stderr.write(SYS_ENV_ERR % 'BASE_TOOLS_PATH')
+ return 1
+ if not os.path.exists(os.environ['BASE_TOOLS_PATH']):
+ sys.stderr.write("Unable to locate the %s directory." % os.environ['BASE_TOOLS_PATH'])
+ return 1
+
+
+ options.HAVE_SVN = CheckSvn(options)
+ if options.TEST_SVN:
+ return (not options.HAVE_SVN)
+ # done processing the option, now use the option.HAVE_SVN as a flag. True = Have it, False = Don't have it.
+ if options.REVERT:
+ # Just revert the tools an exit
+ RevertBuildVersionFiles(options)
+ else:
+ # Revert any changes in the BuildVersion.* files before setting them again.
+ RevertBuildVersionFiles(options)
+ Revision, Modified = GetSvnRevision(options)
+ if options.verbose:
+ sys.stdout.write("Revision: %s is Modified: %s\n" % (Revision, Modified))
+ sys.stdout.flush()
+ UpdateBuildVersionH(Revision, Modified, options)
+ UpdateBuildVersionPython(Revision, Modified, options)
+
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(UpdateRevisionFiles())
+
+
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/GNUmakefile b/roms/edk2/BaseTools/Source/C/BrotliCompress/GNUmakefile
new file mode 100644
index 000000000..954483726
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/GNUmakefile
@@ -0,0 +1,41 @@
+## @file
+# GNU/Linux makefile for 'Brotli' module build.
+#
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+MAKEROOT ?= ..
+
+APPNAME = Brotli
+
+OBJECTS = \
+ brotli/c/tools/brotli.o \
+ brotli/c/common/dictionary.o \
+ brotli/c/common/transform.o \
+ brotli/c/dec/bit_reader.o \
+ brotli/c/dec/decode.o \
+ brotli/c/dec/huffman.o \
+ brotli/c/dec/state.o \
+ brotli/c/enc/backward_references.o \
+ brotli/c/enc/backward_references_hq.o \
+ brotli/c/enc/bit_cost.o \
+ brotli/c/enc/block_splitter.o \
+ brotli/c/enc/brotli_bit_stream.o \
+ brotli/c/enc/cluster.o \
+ brotli/c/enc/compress_fragment.o \
+ brotli/c/enc/compress_fragment_two_pass.o \
+ brotli/c/enc/dictionary_hash.o \
+ brotli/c/enc/encode.o \
+ brotli/c/enc/encoder_dict.o \
+ brotli/c/enc/entropy_encode.o \
+ brotli/c/enc/histogram.o \
+ brotli/c/enc/literal_cost.o \
+ brotli/c/enc/memory.o \
+ brotli/c/enc/metablock.o \
+ brotli/c/enc/static_dict.o \
+ brotli/c/enc/utf8_util.o
+
+include $(MAKEROOT)/Makefiles/app.makefile
+
+TOOL_INCLUDE = -I ./brotli/c/include
+LIBS += -lm
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/Makefile b/roms/edk2/BaseTools/Source/C/BrotliCompress/Makefile
new file mode 100644
index 000000000..b805ff1e5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/Makefile
@@ -0,0 +1,48 @@
+## @file
+# Windows makefile for 'Brotli' module build.
+#
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+INC = -I .\brotli\c\include $(INC)
+CFLAGS = $(CFLAGS) /W2
+
+APPNAME = Brotli
+
+#LIBS = $(LIB_PATH)\Common.lib
+
+COMMON_OBJ = brotli\c\common\dictionary.obj brotli\c\common\transform.obj
+DEC_OBJ = \
+ brotli\c\dec\bit_reader.obj \
+ brotli\c\dec\decode.obj \
+ brotli\c\dec\huffman.obj \
+ brotli\c\dec\state.obj
+ENC_OBJ = \
+ brotli\c\enc\backward_references.obj \
+ brotli\c\enc\backward_references_hq.obj \
+ brotli\c\enc\bit_cost.obj \
+ brotli\c\enc\block_splitter.obj \
+ brotli\c\enc\brotli_bit_stream.obj \
+ brotli\c\enc\cluster.obj \
+ brotli\c\enc\compress_fragment.obj \
+ brotli\c\enc\compress_fragment_two_pass.obj \
+ brotli\c\enc\dictionary_hash.obj \
+ brotli\c\enc\encode.obj \
+ brotli\c\enc\encoder_dict.obj \
+ brotli\c\enc\entropy_encode.obj \
+ brotli\c\enc\histogram.obj \
+ brotli\c\enc\literal_cost.obj \
+ brotli\c\enc\memory.obj \
+ brotli\c\enc\metablock.obj \
+ brotli\c\enc\static_dict.obj \
+ brotli\c\enc\utf8_util.obj
+
+OBJECTS = \
+ brotli\c\tools\brotli.obj \
+ $(COMMON_OBJ) \
+ $(DEC_OBJ) \
+ $(ENC_OBJ)
+
+!INCLUDE ..\Makefiles\ms.app
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.editorconfig b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.editorconfig
new file mode 100644
index 000000000..17ed3c197
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.editorconfig
@@ -0,0 +1,40 @@
+# http://editorconfig.org
+# Consistent coding style across different editors.
+
+# Top-most file
+root = true
+
+# Global styles:
+# - indent 2 spaces
+# - add final new line
+# - trim trailing whitespace
+[*]
+charset = utf-8
+end_of_line = lf
+indent_size = 2
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+# BUILD:
+# - indent 4 spaces
+[BUILD]
+indent_size = 4
+
+# Makefile:
+# - indent 1 tab
+[Makefile]
+indent_size = tab
+indent_style = tab
+
+# Markdown:
+# - indent 4 spaces
+# - trailing whitespace is significant
+[*.md]
+indent_size = 4
+trim_trailing_whitespace = false
+
+# Python
+# - indent 4 spaces
+[*.py]
+indent_size = 4
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.gitattributes b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.gitattributes
new file mode 100644
index 000000000..a1665dacc
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.gitattributes
@@ -0,0 +1 @@
+tests/testdata/* binary
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.gitignore b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.gitignore
new file mode 100644
index 000000000..e3a69e62c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.gitignore
@@ -0,0 +1,18 @@
+# C
+*.o
+bin/
+buildfiles/
+**/obj/
+dist/
+**/bazel-*
+
+# Python
+__pycache__/
+*.py[cod]
+*.so
+*.egg-info/
+
+# Tests
+*.txt.uncompressed
+*.br
+*.unbr
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.gitmodules b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.gitmodules
new file mode 100644
index 000000000..3ec8760a5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "research/esaxx"]
+ path = research/esaxx
+ url = https://github.com/hillbig/esaxx
+[submodule "research/libdivsufsort"]
+ path = research/libdivsufsort
+ url = https://github.com/y-256/libdivsufsort.git
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.travis.yml b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.travis.yml
new file mode 100644
index 000000000..930bd6346
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/.travis.yml
@@ -0,0 +1,229 @@
+language: c
+sudo: false
+branches:
+ only:
+ - master
+matrix:
+ include:
+ ###
+ ## Linux builds using various versions of GCC.
+ ###
+ - os: linux
+ env: BUILD_SYSTEM=cmake C_COMPILER=gcc-7 CXX_COMPILER=g++-7
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - gcc-7
+ - g++-7
+ - os: linux
+ env: BUILD_SYSTEM=cmake C_COMPILER=gcc-4.4 CXX_COMPILER=g++-4.4
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - gcc-4.4
+ - g++-4.4
+
+ ###
+ ## Test that Autotools build works.
+ ###
+ - os: linux
+ env: BUILD_SYSTEM=autotools C_COMPILER=gcc-5 CXX_COMPILER=g++-5
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - gcc-5
+ - g++-5
+
+ ###
+ ## Test that fuzzer is compiling / working.
+ ###
+ - os: linux
+ env: BUILD_SYSTEM=fuzz C_COMPILER=clang-7 CXX_COMPILER=clang++-7 ASAN_OPTIONS=detect_leaks=0
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-xenial-7
+ packages:
+ - clang-7
+
+ ###
+ ## clang on Linux
+ ###
+ - os: linux
+ env: BUILD_SYSTEM=cmake C_COMPILER=clang-7 CXX_COMPILER=clang++-7
+ addons:
+ apt:
+ sources:
+ - llvm-toolchain-xenial-7
+ - ubuntu-toolchain-r-test
+ packages:
+ - clang-7
+ - os: linux
+ env: BUILD_SYSTEM=cmake C_COMPILER=clang-3.5 CXX_COMPILER=clang++-3.5
+ addons:
+ apt:
+ sources:
+ - llvm-toolchain-trusty-3.5
+ - ubuntu-toolchain-r-test
+ packages:
+ - clang-3.5
+
+ ###
+ ## testing arm via qemu on Linux
+ ###
+ - os: linux
+ env: BUILD_SYSTEM=cmake C_COMPILER=arm-linux-gnueabihf-gcc CXX_COMPILER=arm-linux-gnueabihf-g++ CFLAGS="-march=armv7-a -mfloat-abi=hard -mfpu=neon"
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - qemu
+ - gcc-arm-linux-gnueabihf
+ - libc6-dev-armhf-cross
+
+ ###
+ ## PGI Community Edition on Linux
+ ###
+ - os: linux
+ env: BUILD_SYSTEM=cmake C_COMPILER=pgcc CXX_COMPILER=pgc++
+
+ ###
+ ## Python 2.7 and 3.6 builds on Linux
+ ###
+ - os: linux
+ language: python
+ python: 2.7
+ env: BUILD_SYSTEM=python C_COMPILER=gcc-5 CXX_COMPILER=g++-5
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - gcc-5
+ - g++-5
+ - os: linux
+ language: python
+ python: 3.6
+ env: BUILD_SYSTEM=python C_COMPILER=gcc-5 CXX_COMPILER=g++-5
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - gcc-5
+ - g++-5
+
+ ###
+ ## CMake on OS X
+ ##
+ ## These all work, but it seems unnecessary to actually build them
+ ## all since we already test all these versions of GCC on Linux.
+ ## We'll just test 4.4 and the most recent version.
+ ###
+ - os: osx
+ env: BUILD_SYSTEM=cmake C_COMPILER=gcc CXX_COMPILER=g++
+ - os: osx
+ env: BUILD_SYSTEM=cmake C_COMPILER=gcc-4.9 CXX_COMPILER=g++-4.9
+ - os: osx
+ env: BUILD_SYSTEM=cmake
+
+ ###
+ ## Python 2.7 OS X build (using the system /usr/bin/python)
+ ###
+ - os: osx
+ env: BUILD_SYSTEM=python C_COMPILER=gcc CXX_COMPILER=g++
+
+ ###
+ ## Sanitizers
+ ###
+ - os: linux
+ env: BUILD_SYSTEM=cmake C_COMPILER=clang-7 CXX_COMPILER=clang++-7 SANITIZER=address ASAN_OPTIONS=detect_leaks=0
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-xenial-7
+ packages:
+ - clang-7
+ - os: linux
+ env: BUILD_SYSTEM=cmake C_COMPILER=clang-7 CXX_COMPILER=clang++-7 SANITIZER=thread
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-xenial-7
+ packages:
+ - clang-7
+ - os: linux
+ env: BUILD_SYSTEM=cmake C_COMPILER=clang-7 CXX_COMPILER=clang++-7 SANITIZER=undefined CFLAGS="-fno-sanitize-recover=undefined,integer"
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-xenial-7
+ packages:
+ - clang-7
+
+ - os: linux
+ env: BUILD_SYSTEM=maven
+ jdk:
+ # maven + jdk11 + javadoc == trouble
+ - openjdk10
+ language: java
+
+ - os: linux
+ sudo: required
+ language: java
+ jdk: oraclejdk9
+ env: BUILD_SYSTEM=bazel
+ addons:
+ apt:
+ sources:
+ - sourceline: "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8"
+ key_url: "https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg"
+ - ubuntu-toolchain-r-test
+ packages:
+ - bazel
+
+ - os: osx
+ env: BUILD_SYSTEM=bazel
+ # Latest image with Java 1.8 (required to install Bazel).
+ osx_image: xcode9.3
+ language: java
+
+before_install:
+###
+## If we use the matrix to set CC/CXX Travis, overwrites the values,
+## so instead we use C/CXX_COMPILER, then copy the values to CC/CXX
+## here (after Travis has set CC/CXX).
+###
+- if [ -n "${C_COMPILER}" ]; then export CC="${C_COMPILER}"; fi
+- if [ -n "${CXX_COMPILER}" ]; then export CXX="${CXX_COMPILER}"; fi
+- scripts/.travis.sh before_install
+install:
+- scripts/.travis.sh install
+script:
+- scripts/.travis.sh script
+after_success:
+- scripts/.travis.sh after_success
+
+before_deploy:
+- scripts/.travis.sh before_deploy
+
+deploy:
+- provider: bintray
+ file: "scripts/.bintray.json"
+ user: "eustas"
+ key:
+ secure: "Kbam/lTAdz72fZivbs6riJT+Y4PbuKP7r6t5PAWxJxAAykjwnYTRe3zF472g9HCE14KYMsdB+KSYSgg6TGJnqGC9gL9xhhGU9U/WmA+vbMWS/MSnMWpK9IRpp77pM2i2NKZD4v33JuEwKFCBJP3Vj6QQ5Qd1NKdobuXJyznhgnw="
+ on:
+ condition: "${BUILD_SYSTEM} = bazel"
+ skip_cleanup: true
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/BUILD b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/BUILD
new file mode 100644
index 000000000..4c9b57ac9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/BUILD
@@ -0,0 +1,144 @@
+# Description:
+# Brotli is a generic-purpose lossless compression algorithm.
+
+package(
+ default_visibility = ["//visibility:public"],
+)
+
+licenses(["notice"]) # MIT
+
+exports_files(["LICENSE"])
+
+config_setting(
+ name = "darwin",
+ values = {"cpu": "darwin"},
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "darwin_x86_64",
+ values = {"cpu": "darwin_x86_64"},
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "windows",
+ values = {"cpu": "x64_windows"},
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "windows_msvc",
+ values = {"cpu": "x64_windows_msvc"},
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "windows_msys",
+ values = {"cpu": "x64_windows_msys"},
+ visibility = ["//visibility:public"],
+)
+
+load(":compiler_config_setting.bzl", "create_msvc_config")
+
+create_msvc_config()
+
+STRICT_C_OPTIONS = select({
+ ":msvc": [],
+ "//conditions:default": [
+ "--pedantic-errors",
+ "-Wall",
+ "-Wconversion",
+ "-Werror",
+ "-Wextra",
+ "-Wlong-long",
+ "-Wmissing-declarations",
+ "-Wmissing-prototypes",
+ "-Wno-strict-aliasing",
+ "-Wshadow",
+ "-Wsign-compare",
+ ],
+})
+
+filegroup(
+ name = "public_headers",
+ srcs = glob(["c/include/brotli/*.h"]),
+)
+
+filegroup(
+ name = "common_headers",
+ srcs = glob(["c/common/*.h"]),
+)
+
+filegroup(
+ name = "common_sources",
+ srcs = glob(["c/common/*.c"]),
+)
+
+filegroup(
+ name = "dec_headers",
+ srcs = glob(["c/dec/*.h"]),
+)
+
+filegroup(
+ name = "dec_sources",
+ srcs = glob(["c/dec/*.c"]),
+)
+
+filegroup(
+ name = "enc_headers",
+ srcs = glob(["c/enc/*.h"]),
+)
+
+filegroup(
+ name = "enc_sources",
+ srcs = glob(["c/enc/*.c"]),
+)
+
+cc_library(
+ name = "brotli_inc",
+ hdrs = [":public_headers"],
+ copts = STRICT_C_OPTIONS,
+ strip_include_prefix = "c/include",
+)
+
+cc_library(
+ name = "brotlicommon",
+ srcs = [":common_sources"],
+ hdrs = [":common_headers"],
+ copts = STRICT_C_OPTIONS,
+ deps = [":brotli_inc"],
+)
+
+cc_library(
+ name = "brotlidec",
+ srcs = [":dec_sources"],
+ hdrs = [":dec_headers"],
+ copts = STRICT_C_OPTIONS,
+ deps = [":brotlicommon"],
+)
+
+cc_library(
+ name = "brotlienc",
+ srcs = [":enc_sources"],
+ hdrs = [":enc_headers"],
+ copts = STRICT_C_OPTIONS,
+ linkopts = ["-lm"],
+ deps = [":brotlicommon"],
+)
+
+cc_binary(
+ name = "brotli",
+ srcs = ["c/tools/brotli.c"],
+ copts = STRICT_C_OPTIONS,
+ linkstatic = 1,
+ deps = [
+ ":brotlidec",
+ ":brotlienc",
+ ],
+)
+
+filegroup(
+ name = "dictionary",
+ srcs = ["c/common/dictionary.bin"],
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/CMakeLists.txt b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/CMakeLists.txt
new file mode 100644
index 000000000..a8ea87231
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/CMakeLists.txt
@@ -0,0 +1,407 @@
+# Ubuntu 12.04 LTS has CMake 2.8.7, and is an important target since
+# several CI services, such as Travis and Drone, use it. Solaris 11
+# has 2.8.6, and it's not difficult to support if you already have to
+# support 2.8.7.
+cmake_minimum_required(VERSION 2.8.6)
+
+project(brotli C)
+
+include(CheckCSourceCompiles)
+check_c_source_compiles(
+ "#if defined(__EMSCRIPTEN__)
+ int main() {return 0;}
+ #endif"
+ BROTLI_EMSCRIPTEN
+)
+if (BROTLI_EMSCRIPTEN)
+ message("-- Compiler is EMSCRIPTEN")
+else()
+ message("-- Compiler is not EMSCRIPTEN")
+endif()
+
+# If Brotli is being bundled in another project, we don't want to
+# install anything. However, we want to let people override this, so
+# we'll use the BROTLI_BUNDLED_MODE variable to let them do that; just
+# set it to OFF in your project before you add_subdirectory(brotli).
+get_directory_property(BROTLI_PARENT_DIRECTORY PARENT_DIRECTORY)
+if(NOT DEFINED BROTLI_BUNDLED_MODE)
+ # Bundled mode hasn't been set one way or the other, set the default
+ # depending on whether or not we are the top-level project.
+ if(BROTLI_PARENT_DIRECTORY)
+ set(BROTLI_BUNDLED_MODE ON)
+ else()
+ set(BROTLI_BUNDLED_MODE OFF)
+ endif()
+endif()
+mark_as_advanced(BROTLI_BUNDLED_MODE)
+
+include(GNUInstallDirs)
+
+# Parse version information from common/version.h. Normally we would
+# define these values here and write them out to configuration file(s)
+# (i.e., config.h), but in this case we parse them from
+# common/version.h to be less intrusive.
+function(hex_to_dec HEXADECIMAL DECIMAL)
+ string(TOUPPER "${HEXADECIMAL}" _tail)
+ set(_decimal 0)
+ string(LENGTH "${_tail}" _tail_length)
+ while (_tail_length GREATER 0)
+ math(EXPR _decimal "${_decimal} * 16")
+ string(SUBSTRING "${_tail}" 0 1 _digit)
+ string(SUBSTRING "${_tail}" 1 -1 _tail)
+ if (_digit STREQUAL "A")
+ math(EXPR _decimal "${_decimal} + 10")
+ elseif (_digit STREQUAL "B")
+ math(EXPR _decimal "${_decimal} + 11")
+ elseif (_digit STREQUAL "C")
+ math(EXPR _decimal "${_decimal} + 12")
+ elseif (_digit STREQUAL "D")
+ math(EXPR _decimal "${_decimal} + 13")
+ elseif (_digit STREQUAL "E")
+ math(EXPR _decimal "${_decimal} + 14")
+ elseif (_digit STREQUAL "F")
+ math(EXPR _decimal "${_decimal} + 15")
+ else()
+ math(EXPR _decimal "${_decimal} + ${_digit}")
+ endif()
+ string(LENGTH "${_tail}" _tail_length)
+ endwhile()
+ set(${DECIMAL} ${_decimal} PARENT_SCOPE)
+endfunction(hex_to_dec)
+
+# Version information
+file(STRINGS "c/common/version.h" _brotli_version_line REGEX "^#define BROTLI_VERSION (0x[0-9a-fA-F]+)$")
+string(REGEX REPLACE "^#define BROTLI_VERSION 0x([0-9a-fA-F]+)$" "\\1" _brotli_version_hex "${_brotli_version_line}")
+hex_to_dec("${_brotli_version_hex}" _brotli_version)
+math(EXPR BROTLI_VERSION_MAJOR "${_brotli_version} >> 24")
+math(EXPR BROTLI_VERSION_MINOR "(${_brotli_version} >> 12) & 4095")
+math(EXPR BROTLI_VERSION_PATCH "${_brotli_version} & 4095")
+set(BROTLI_VERSION "${BROTLI_VERSION_MAJOR}.${BROTLI_VERSION_MINOR}.${BROTLI_VERSION_PATCH}")
+mark_as_advanced(BROTLI_VERSION BROTLI_VERSION_MAJOR BROTLI_VERSION_MINOR BROTLI_VERSION_PATCH)
+
+# ABI Version information
+file(STRINGS "c/common/version.h" _brotli_abi_info_line REGEX "^#define BROTLI_ABI_VERSION (0x[0-9a-fA-F]+)$")
+string(REGEX REPLACE "^#define BROTLI_ABI_VERSION 0x([0-9a-fA-F]+)$" "\\1" _brotli_abi_info_hex "${_brotli_abi_info_line}")
+hex_to_dec("${_brotli_abi_info_hex}" _brotli_abi_info)
+math(EXPR BROTLI_ABI_CURRENT "${_brotli_abi_info} >> 24")
+math(EXPR BROTLI_ABI_REVISION "(${_brotli_abi_info} >> 12) & 4095")
+math(EXPR BROTLI_ABI_AGE "${_brotli_abi_info} & 4095")
+math(EXPR BROTLI_ABI_COMPATIBILITY "${BROTLI_ABI_CURRENT} - ${BROTLI_ABI_AGE}")
+mark_as_advanced(BROTLI_ABI_CURRENT BROTLI_ABI_REVISION BROTLI_ABI_AGE BROTLI_ABI_COMPATIBILITY)
+
+if (ENABLE_SANITIZER)
+ set(CMAKE_C_FLAGS " ${CMAKE_C_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
+ set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
+
+ # By default, brotli depends on undefined behavior, but setting
+ # BROTLI_BUILD_PORTABLE should result in a build which does not.
+ if(ENABLE_SANITIZER STREQUAL "undefined")
+ add_definitions(-DBROTLI_BUILD_PORTABLE)
+ endif()
+endif ()
+
+include(CheckFunctionExists)
+set(LIBM_LIBRARY)
+CHECK_FUNCTION_EXISTS(log2 LOG2_RES)
+if(NOT LOG2_RES)
+ set(orig_req_libs "${CMAKE_REQUIRED_LIBRARIES}")
+ set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};m")
+ CHECK_FUNCTION_EXISTS(log2 LOG2_LIBM_RES)
+ if(LOG2_LIBM_RES)
+ set(LIBM_LIBRARY "m")
+ else()
+ message(FATAL_ERROR "log2() not found")
+ endif()
+
+ set(CMAKE_REQUIRED_LIBRARIES "${orig_req_libs}")
+ unset(LOG2_LIBM_RES)
+ unset(orig_req_libs)
+endif()
+unset(LOG2_RES)
+
+set(BROTLI_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/c/include")
+mark_as_advanced(BROTLI_INCLUDE_DIRS)
+
+set(BROTLI_LIBRARIES_CORE brotlienc brotlidec brotlicommon)
+set(BROTLI_LIBRARIES ${BROTLI_LIBRARIES_CORE} ${LIBM_LIBRARY})
+mark_as_advanced(BROTLI_LIBRARIES)
+
+set(BROTLI_LIBRARIES_CORE_STATIC brotlienc-static brotlidec-static brotlicommon-static)
+set(BROTLI_LIBRARIES_STATIC ${BROTLI_LIBRARIES_CORE_STATIC} ${LIBM_LIBRARY})
+mark_as_advanced(BROTLI_LIBRARIES_STATIC)
+
+if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ add_definitions(-DOS_LINUX)
+elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+ add_definitions(-DOS_FREEBSD)
+elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ add_definitions(-DOS_MACOSX)
+endif()
+
+function(transform_sources_list INPUT_FILE OUTPUT_FILE)
+ file(READ ${INPUT_FILE} TEXT)
+ string(REGEX REPLACE "\\\\\n" "~continuation~" TEXT ${TEXT})
+ string(REGEX REPLACE "([a-zA-Z_][a-zA-Z0-9_]*)[\t ]*=[\t ]*([^\n]*)" "SET(\\1 \\2)" TEXT ${TEXT})
+ string(REPLACE "~continuation~" "\n" TEXT ${TEXT})
+ file(WRITE ${OUTPUT_FILE} ${TEXT})
+endfunction()
+
+transform_sources_list("scripts/sources.lst" "${CMAKE_CURRENT_BINARY_DIR}/sources.lst.cmake")
+include("${CMAKE_CURRENT_BINARY_DIR}/sources.lst.cmake")
+
+if(BROTLI_EMSCRIPTEN)
+ set(BROTLI_SHARED_LIBS "")
+else()
+ set(BROTLI_SHARED_LIBS brotlicommon brotlidec brotlienc)
+ add_library(brotlicommon SHARED ${BROTLI_COMMON_C})
+ add_library(brotlidec SHARED ${BROTLI_DEC_C})
+ add_library(brotlienc SHARED ${BROTLI_ENC_C})
+endif()
+
+set(BROTLI_STATIC_LIBS brotlicommon-static brotlidec-static brotlienc-static)
+add_library(brotlicommon-static STATIC ${BROTLI_COMMON_C})
+add_library(brotlidec-static STATIC ${BROTLI_DEC_C})
+add_library(brotlienc-static STATIC ${BROTLI_ENC_C})
+
+# Older CMake versions does not understand INCLUDE_DIRECTORIES property.
+include_directories(${BROTLI_INCLUDE_DIRS})
+
+foreach(lib IN LISTS BROTLI_SHARED_LIBS)
+ target_compile_definitions(${lib} PUBLIC "BROTLI_SHARED_COMPILATION" )
+ string(TOUPPER "${lib}" LIB)
+ set_target_properties (${lib} PROPERTIES DEFINE_SYMBOL "${LIB}_SHARED_COMPILATION")
+endforeach()
+
+foreach(lib IN LISTS BROTLI_SHARED_LIBS BROTLI_STATIC_LIBS)
+ target_link_libraries(${lib} ${LIBM_LIBRARY})
+ set_property(TARGET ${lib} APPEND PROPERTY INCLUDE_DIRECTORIES ${BROTLI_INCLUDE_DIRS})
+ set_target_properties(${lib} PROPERTIES
+ VERSION "${BROTLI_ABI_COMPATIBILITY}.${BROTLI_ABI_AGE}.${BROTLI_ABI_REVISION}"
+ SOVERSION "${BROTLI_ABI_COMPATIBILITY}")
+ if(NOT BROTLI_EMSCRIPTEN)
+ set_target_properties(${lib} PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
+ endif()
+ set_property(TARGET ${lib} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIRS}")
+endforeach()
+
+if(NOT BROTLI_EMSCRIPTEN)
+target_link_libraries(brotlidec brotlicommon)
+target_link_libraries(brotlienc brotlicommon)
+endif()
+
+target_link_libraries(brotlidec-static brotlicommon-static)
+target_link_libraries(brotlienc-static brotlicommon-static)
+
+# For projects stuck on older versions of CMake, this will set the
+# BROTLI_INCLUDE_DIRS and BROTLI_LIBRARIES variables so they still
+# have a relatively easy way to use Brotli:
+#
+# include_directories(${BROTLI_INCLUDE_DIRS})
+# target_link_libraries(foo ${BROTLI_LIBRARIES})
+if(BROTLI_PARENT_DIRECTORY)
+ set(BROTLI_INCLUDE_DIRS "${BROTLI_INCLUDE_DIRS}" PARENT_SCOPE)
+ set(BROTLI_LIBRARIES "${BROTLI_LIBRARIES}" PARENT_SCOPE)
+endif()
+
+# Build the brotli executable
+add_executable(brotli ${BROTLI_CLI_C})
+target_link_libraries(brotli ${BROTLI_LIBRARIES_STATIC})
+
+# Installation
+if(NOT BROTLI_EMSCRIPTEN)
+if(NOT BROTLI_BUNDLED_MODE)
+ install(
+ TARGETS brotli
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ )
+
+ install(
+ TARGETS ${BROTLI_LIBRARIES_CORE}
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ )
+
+ install(
+ TARGETS ${BROTLI_LIBRARIES_CORE_STATIC}
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ )
+
+ install(
+ DIRECTORY ${BROTLI_INCLUDE_DIRS}/brotli
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+ )
+endif() # BROTLI_BUNDLED_MODE
+endif() # BROTLI_EMSCRIPTEN
+
+# Tests
+
+# If we're targeting Windows but not running on Windows, we need Wine
+# to run the tests...
+if(NOT BROTLI_DISABLE_TESTS)
+ if(WIN32 AND NOT CMAKE_HOST_WIN32)
+ find_program(BROTLI_WRAPPER NAMES wine)
+
+ if(NOT BROTLI_WRAPPER)
+ message(STATUS "wine not found, disabling tests")
+ set(BROTLI_DISABLE_TESTS TRUE)
+ endif()
+ endif()
+endif()
+
+# If our compiler is a cross-compiler that we know about (arm/aarch64),
+# then we need to use qemu to execute the tests.
+if(NOT BROTLI_DISABLE_TESTS)
+ if ("${CMAKE_C_COMPILER}" MATCHES "^.*/arm-linux-gnueabihf-.*$")
+ message(STATUS "Detected arm-linux-gnueabihf cross-compilation")
+ set(BROTLI_WRAPPER "qemu-arm")
+ set(BROTLI_WRAPPER_LD_PREFIX "/usr/arm-linux-gnueabihf")
+ endif()
+
+ if ("${CMAKE_C_COMPILER}" MATCHES "^.*/arm-linux-gnueabi-.*$")
+ message(STATUS "Detected arm-linux-gnueabi cross-compilation")
+ set(BROTLI_WRAPPER "qemu-arm")
+ set(BROTLI_WRAPPER_LD_PREFIX "/usr/arm-linux-gnueabi")
+ endif()
+
+ if ("${CMAKE_C_COMPILER}" MATCHES "^.*/aarch64-linux-gnu-.*$")
+ message(STATUS "Detected aarch64-linux-gnu cross-compilation")
+ set(BROTLI_WRAPPER "qemu-aarch64")
+ set(BROTLI_WRAPPER_LD_PREFIX "/usr/aarch64-linux-gnu")
+ endif()
+endif()
+
+if(NOT BROTLI_DISABLE_TESTS)
+ include(CTest)
+ enable_testing()
+
+ set(ROUNDTRIP_INPUTS
+ tests/testdata/alice29.txt
+ tests/testdata/asyoulik.txt
+ tests/testdata/lcet10.txt
+ tests/testdata/plrabn12.txt
+ c/enc/encode.c
+ c/common/dictionary.h
+ c/dec/decode.c)
+
+ foreach(INPUT ${ROUNDTRIP_INPUTS})
+ get_filename_component(OUTPUT_NAME "${INPUT}" NAME)
+
+ set(OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME}")
+ set(INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${INPUT}")
+
+ foreach(quality 1 6 9 11)
+ add_test(NAME "${BROTLI_TEST_PREFIX}roundtrip/${INPUT}/${quality}"
+ COMMAND "${CMAKE_COMMAND}"
+ -DBROTLI_WRAPPER=${BROTLI_WRAPPER}
+ -DBROTLI_WRAPPER_LD_PREFIX=${BROTLI_WRAPPER_LD_PREFIX}
+ -DBROTLI_CLI=$<TARGET_FILE:brotli>
+ -DQUALITY=${quality}
+ -DINPUT=${INPUT_FILE}
+ -DOUTPUT=${OUTPUT_FILE}.${quality}
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/tests/run-roundtrip-test.cmake)
+ endforeach()
+ endforeach()
+
+ file(GLOB_RECURSE
+ COMPATIBILITY_INPUTS
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ tests/testdata/*.compressed*)
+
+ foreach(INPUT ${COMPATIBILITY_INPUTS})
+ add_test(NAME "${BROTLI_TEST_PREFIX}compatibility/${INPUT}"
+ COMMAND "${CMAKE_COMMAND}"
+ -DBROTLI_WRAPPER=${BROTLI_WRAPPER}
+ -DBROTLI_WRAPPER_LD_PREFIX=${BROTLI_WRAPPER_LD_PREFIX}
+ -DBROTLI_CLI=$<TARGET_FILE:brotli>
+ -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/${INPUT}
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/tests/run-compatibility-test.cmake)
+ endforeach()
+endif()
+
+# Generate a pkg-config files
+
+function(generate_pkg_config_path outvar path)
+ string(LENGTH "${path}" path_length)
+
+ set(path_args ${ARGV})
+ list(REMOVE_AT path_args 0 1)
+ list(LENGTH path_args path_args_remaining)
+
+ set("${outvar}" "${path}")
+
+ while(path_args_remaining GREATER 1)
+ list(GET path_args 0 name)
+ list(GET path_args 1 value)
+
+ get_filename_component(value_full "${value}" ABSOLUTE)
+ string(LENGTH "${value}" value_length)
+
+ if(path_length EQUAL value_length AND path STREQUAL value)
+ set("${outvar}" "\${${name}}")
+ break()
+ elseif(path_length GREATER value_length)
+ # We might be in a subdirectory of the value, but we have to be
+ # careful about a prefix matching but not being a subdirectory
+ # (for example, /usr/lib64 is not a subdirectory of /usr/lib).
+ # We'll do this by making sure the next character is a directory
+ # separator.
+ string(SUBSTRING "${path}" ${value_length} 1 sep)
+ if(sep STREQUAL "/")
+ string(SUBSTRING "${path}" 0 ${value_length} s)
+ if(s STREQUAL value)
+ string(SUBSTRING "${path}" "${value_length}" -1 suffix)
+ set("${outvar}" "\${${name}}${suffix}")
+ break()
+ endif()
+ endif()
+ endif()
+
+ list(REMOVE_AT path_args 0 1)
+ list(LENGTH path_args path_args_remaining)
+ endwhile()
+
+ set("${outvar}" "${${outvar}}" PARENT_SCOPE)
+endfunction(generate_pkg_config_path)
+
+function(transform_pc_file INPUT_FILE OUTPUT_FILE VERSION)
+ file(READ ${INPUT_FILE} TEXT)
+
+ set(PREFIX "${CMAKE_INSTALL_PREFIX}")
+ string(REGEX REPLACE "@prefix@" "${PREFIX}" TEXT ${TEXT})
+ string(REGEX REPLACE "@exec_prefix@" "${PREFIX}" TEXT ${TEXT})
+
+ generate_pkg_config_path(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}" prefix "${PREFIX}")
+ string(REGEX REPLACE "@libdir@" "${LIBDIR}" TEXT ${TEXT})
+
+ generate_pkg_config_path(INCLUDEDIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}" prefix "${PREFIX}")
+ string(REGEX REPLACE "@includedir@" "${INCLUDEDIR}" TEXT ${TEXT})
+
+ string(REGEX REPLACE "@PACKAGE_VERSION@" "${VERSION}" TEXT ${TEXT})
+
+ file(WRITE ${OUTPUT_FILE} ${TEXT})
+endfunction()
+
+transform_pc_file("scripts/libbrotlicommon.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libbrotlicommon.pc" "${BROTLI_VERSION}")
+
+transform_pc_file("scripts/libbrotlidec.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libbrotlidec.pc" "${BROTLI_VERSION}")
+
+transform_pc_file("scripts/libbrotlienc.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libbrotlienc.pc" "${BROTLI_VERSION}")
+
+if(NOT BROTLI_EMSCRIPTEN)
+if(NOT BROTLI_BUNDLED_MODE)
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libbrotlicommon.pc"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libbrotlidec.pc"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libbrotlienc.pc"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+endif() # BROTLI_BUNDLED_MODE
+endif() # BROTLI_EMSCRIPTEN
+
+if (ENABLE_COVERAGE STREQUAL "yes")
+ SETUP_TARGET_FOR_COVERAGE(coverage test coverage)
+endif ()
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/CONTRIBUTING.md b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/CONTRIBUTING.md
new file mode 100644
index 000000000..a00e37d17
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/CONTRIBUTING.md
@@ -0,0 +1,27 @@
+Want to contribute? Great! First, read this page (including the small print at
+the end).
+
+### Before you contribute
+Before we can use your code, you must sign the
+[Google Individual Contributor License Agreement]
+(https://cla.developers.google.com/about/google-individual)
+(CLA), which you can do online. The CLA is necessary mainly because you own the
+copyright to your changes, even after your contribution becomes part of our
+codebase, so we need your permission to use and distribute your code. We also
+need to be sure of various other things—for instance that you'll tell us if you
+know that your code infringes on other people's patents. You don't have to sign
+the CLA until after you've submitted your code for review and a member has
+approved it, but you must do it before we can put your code into our codebase.
+Before you start working on a larger contribution, you should get in touch with
+us first through the issue tracker with your idea so that we can help out and
+possibly guide you. Coordinating up front makes it much easier to avoid
+frustration later on.
+
+### Code reviews
+All submissions, including submissions by project members, require review. We
+use Github pull requests for this purpose.
+
+### The small print
+Contributions made by corporations are covered by a different agreement than
+the one above, the [Software Grant and Corporate Contributor License Agreement]
+(https://cla.developers.google.com/about/google-corporate).
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/LICENSE b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/LICENSE
new file mode 100644
index 000000000..33b7cdd2d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/MANIFEST.in b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/MANIFEST.in
new file mode 100644
index 000000000..b7b8e7244
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/MANIFEST.in
@@ -0,0 +1,17 @@
+include CONTRIBUTING.md
+include c/common/*.c
+include c/common/*.h
+include c/dec/*.c
+include c/dec/*.h
+include c/enc/*.c
+include c/enc/*.h
+include c/include/brotli/*.h
+include LICENSE
+include MANIFEST.in
+include python/_brotli.cc
+include python/bro.py
+include python/brotli.py
+include python/README.md
+include README.md
+include setup.py
+include c/tools/brotli.c
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/Makefile b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/Makefile
new file mode 100644
index 000000000..489094090
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/Makefile
@@ -0,0 +1,55 @@
+OS := $(shell uname)
+LIBSOURCES = $(wildcard c/common/*.c) $(wildcard c/dec/*.c) \
+ $(wildcard c/enc/*.c)
+SOURCES = $(LIBSOURCES) c/tools/brotli.c
+BINDIR = bin
+OBJDIR = $(BINDIR)/obj
+LIBOBJECTS = $(addprefix $(OBJDIR)/, $(LIBSOURCES:.c=.o))
+OBJECTS = $(addprefix $(OBJDIR)/, $(SOURCES:.c=.o))
+LIB_A = libbrotli.a
+EXECUTABLE = brotli
+DIRS = $(OBJDIR)/c/common $(OBJDIR)/c/dec $(OBJDIR)/c/enc \
+ $(OBJDIR)/c/tools $(BINDIR)/tmp
+CFLAGS += -O2
+ifeq ($(os), Darwin)
+ CPPFLAGS += -DOS_MACOSX
+endif
+
+ifneq ($(strip $(CROSS_COMPILE)), )
+ CC=$(CROSS_COMPILE)-gcc
+ ARCH=$(firstword $(subst -, ,$(CROSS_COMPILE)))
+ BROTLI_WRAPPER="qemu-$(ARCH) -L /usr/$(CROSS_COMPILE)"
+endif
+
+# The arm-linux-gnueabi compiler defaults to Armv5. Since we only support Armv7
+# and beyond, we need to select Armv7 explicitly with march.
+ifeq ($(ARCH), arm)
+ CFLAGS += -march=armv7-a -mfloat-abi=hard -mfpu=neon
+endif
+
+all: test
+ @:
+
+.PHONY: all clean test
+
+$(DIRS):
+ mkdir -p $@
+
+$(EXECUTABLE): $(OBJECTS)
+ $(CC) $(LDFLAGS) $(OBJECTS) -lm -o $(BINDIR)/$(EXECUTABLE)
+
+lib: $(LIBOBJECTS)
+ rm -f $(LIB_A)
+ ar -crs $(LIB_A) $(LIBOBJECTS)
+
+test: $(EXECUTABLE)
+ tests/compatibility_test.sh $(BROTLI_WRAPPER)
+ tests/roundtrip_test.sh $(BROTLI_WRAPPER)
+
+clean:
+ rm -rf $(BINDIR) $(LIB_A)
+
+.SECONDEXPANSION:
+$(OBJECTS): $$(patsubst %.o,%.c,$$(patsubst $$(OBJDIR)/%,%,$$@)) | $(DIRS)
+ $(CC) $(CFLAGS) $(CPPFLAGS) -Ic/include \
+ -c $(patsubst %.o,%.c,$(patsubst $(OBJDIR)/%,%,$@)) -o $@
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/Makefile.am b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/Makefile.am
new file mode 100644
index 000000000..ace7a8506
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/Makefile.am
@@ -0,0 +1,38 @@
+AUTOMAKE_OPTIONS = foreign nostdinc subdir-objects
+
+ACLOCAL_AMFLAGS = -I m4
+
+# Actual ABI version is substituted by bootstrap
+LIBBROTLI_VERSION_INFO = -version-info 0:0:0
+
+bin_PROGRAMS = brotli
+lib_LTLIBRARIES = libbrotlicommon.la libbrotlidec.la libbrotlienc.la
+
+include scripts/sources.lst
+
+brotliincludedir = $(includedir)/brotli
+brotliinclude_HEADERS = $(BROTLI_INCLUDE)
+
+AM_CFLAGS = -I$(top_srcdir)/c/include
+
+brotli_SOURCES = $(BROTLI_CLI_C)
+brotli_LDADD = libbrotlidec.la libbrotlienc.la libbrotlicommon.la -lm
+#brotli_LDFLAGS = -static
+
+libbrotlicommon_la_SOURCES = $(BROTLI_COMMON_C) $(BROTLI_COMMON_H)
+libbrotlicommon_la_LDFLAGS = $(AM_LDFLAGS) $(LIBBROTLI_VERSION_INFO) $(LDFLAGS)
+libbrotlidec_la_SOURCES = $(BROTLI_DEC_C) $(BROTLI_DEC_H)
+libbrotlidec_la_LDFLAGS = $(AM_LDFLAGS) $(LIBBROTLI_VERSION_INFO) $(LDFLAGS)
+libbrotlidec_la_LIBADD = libbrotlicommon.la -lm
+libbrotlienc_la_SOURCES = $(BROTLI_ENC_C) $(BROTLI_ENC_H)
+libbrotlienc_la_LDFLAGS = $(AM_LDFLAGS) $(LIBBROTLI_VERSION_INFO) $(LDFLAGS)
+libbrotlienc_la_LIBADD = libbrotlicommon.la -lm
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = \
+ scripts/libbrotlicommon.pc \
+ scripts/libbrotlidec.pc \
+ scripts/libbrotlienc.pc
+pkgincludedir= $(brotliincludedir)
+
+dist_doc_DATA = README
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/README b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/README
new file mode 100644
index 000000000..dea729130
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/README
@@ -0,0 +1,15 @@
+BROTLI DATA COMPRESSION LIBRARY
+
+Brotli is a generic-purpose lossless compression algorithm that compresses data
+using a combination of a modern variant of the LZ77 algorithm, Huffman coding
+and 2nd order context modeling, with a compression ratio comparable to the best
+currently available general-purpose compression methods. It is similar in speed
+with deflate but offers more dense compression.
+
+The specification of the Brotli Compressed Data Format is defined in RFC 7932
+https://tools.ietf.org/html/rfc7932
+
+Brotli is open-sourced under the MIT License, see the LICENSE file.
+
+Brotli mailing list:
+https://groups.google.com/forum/#!forum/brotli
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/README.md b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/README.md
new file mode 100644
index 000000000..017173c4e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/README.md
@@ -0,0 +1,98 @@
+<p align="center"><img src="https://brotli.org/brotli.svg" alt="Brotli" width="64"></p>
+
+### Introduction
+
+Brotli is a generic-purpose lossless compression algorithm that compresses data
+using a combination of a modern variant of the LZ77 algorithm, Huffman coding
+and 2nd order context modeling, with a compression ratio comparable to the best
+currently available general-purpose compression methods. It is similar in speed
+with deflate but offers more dense compression.
+
+The specification of the Brotli Compressed Data Format is defined in [RFC 7932](https://tools.ietf.org/html/rfc7932).
+
+Brotli is open-sourced under the MIT License, see the LICENSE file.
+
+Brotli mailing list:
+https://groups.google.com/forum/#!forum/brotli
+
+[![TravisCI Build Status](https://travis-ci.org/google/brotli.svg?branch=master)](https://travis-ci.org/google/brotli)
+[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/google/brotli?branch=master&svg=true)](https://ci.appveyor.com/project/szabadka/brotli)
+[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/brotli.svg)](https://oss-fuzz-build-logs.storage.googleapis.com/index.html#brotli)
+
+### Build instructions
+
+#### Vcpkg
+
+You can download and install brotli using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:
+
+ git clone https://github.com/Microsoft/vcpkg.git
+ cd vcpkg
+ ./bootstrap-vcpkg.sh
+ ./vcpkg integrate install
+ vcpkg install brotli
+
+The brotli port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
+
+#### Autotools-style CMake
+
+[configure-cmake](https://github.com/nemequ/configure-cmake) is an
+autotools-style configure script for CMake-based projects (not supported on Windows).
+
+The basic commands to build, test and install brotli are:
+
+ $ mkdir out && cd out
+ $ ../configure-cmake
+ $ make
+ $ make test
+ $ make install
+
+By default, debug binaries are built. To generate "release" `Makefile` specify `--disable-debug` option to `configure-cmake`.
+
+#### Bazel
+
+See [Bazel](http://www.bazel.build/)
+
+#### CMake
+
+The basic commands to build and install brotli are:
+
+ $ mkdir out && cd out
+ $ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed ..
+ $ cmake --build . --config Release --target install
+
+You can use other [CMake](https://cmake.org/) configuration.
+
+#### Premake5
+
+See [Premake5](https://premake.github.io/)
+
+#### Python
+
+To install the latest release of the Python module, run the following:
+
+ $ pip install brotli
+
+To install the tip-of-the-tree version, run:
+
+ $ pip install --upgrade git+https://github.com/google/brotli
+
+See the [Python readme](python/README.md) for more details on installing
+from source, development, and testing.
+
+### Benchmarks
+* [Squash Compression Benchmark](https://quixdb.github.io/squash-benchmark/) / [Unstable Squash Compression Benchmark](https://quixdb.github.io/squash-benchmark/unstable/)
+* [Large Text Compression Benchmark](http://mattmahoney.net/dc/text.html)
+* [Lzturbo Benchmark](https://sites.google.com/site/powturbo/home/benchmark)
+
+### Related projects
+> **Disclaimer:** Brotli authors take no responsibility for the third party projects mentioned in this section.
+
+Independent [decoder](https://github.com/madler/brotli) implementation by Mark Adler, based entirely on format specification.
+
+JavaScript port of brotli [decoder](https://github.com/devongovett/brotli.js). Could be used directly via `npm install brotli`
+
+Hand ported [decoder / encoder](https://github.com/dominikhlbg/BrotliHaxe) in haxe by Dominik Homberger. Output source code: JavaScript, PHP, Python, Java and C#
+
+7Zip [plugin](https://github.com/mcmilk/7-Zip-Zstd)
+
+Dart [native bindings](https://github.com/thosakwe/brotli)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/WORKSPACE b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/WORKSPACE
new file mode 100644
index 000000000..75f376828
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/WORKSPACE
@@ -0,0 +1,21 @@
+workspace(name = "org_brotli")
+
+local_repository(
+ name = "ignore_org_brotli_go",
+ path = "go",
+)
+
+local_repository(
+ name = "ignore_org_brotli_java",
+ path = "java",
+)
+
+local_repository(
+ name = "ignore_org_brotli_js",
+ path = "js",
+)
+
+local_repository(
+ name = "ignore_org_brotli_research",
+ path = "research",
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/bootstrap b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/bootstrap
new file mode 100755
index 000000000..64aca2c40
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/bootstrap
@@ -0,0 +1,31 @@
+# !/bin/sh -e
+
+REQUIRED='is required, but not installed.'
+bc -v >/dev/null 2>&1 || { echo >&2 "'bc' $REQUIRED"; exit 1; }
+if [ `uname -s` != "FreeBSD" ]; then
+sed --version >/dev/null 2>&1 || { echo >&2 "'sed' $REQUIRED"; exit 1; }
+fi
+autoreconf --version >/dev/null 2>&1 || { echo >&2 "'autoconf' $REQUIRED"; exit 1; }
+
+# If libtool is not installed -> "error: Libtool library used but 'LIBTOOL' is undefined"
+
+mkdir m4 2>/dev/null
+
+BROTLI_ABI_HEX=`sed -n 's/#define BROTLI_ABI_VERSION 0x//p' c/common/version.h`
+BROTLI_ABI_INT=`echo "ibase=16;$BROTLI_ABI_HEX" | bc`
+BROTLI_ABI_CURRENT=`expr $BROTLI_ABI_INT / 16777216`
+BROTLI_ABI_REVISION=`expr $BROTLI_ABI_INT / 4096 % 4096`
+BROTLI_ABI_AGE=`expr $BROTLI_ABI_INT % 4096`
+BROTLI_ABI_INFO="$BROTLI_ABI_CURRENT:$BROTLI_ABI_REVISION:$BROTLI_ABI_AGE"
+
+BROTLI_VERSION_HEX=`sed -n 's/#define BROTLI_VERSION 0x//p' c/common/version.h`
+BROTLI_VERSION_INT=`echo "ibase=16;$BROTLI_VERSION_HEX" | bc`
+BROTLI_VERSION_MAJOR=`expr $BROTLI_VERSION_INT / 16777216`
+BROTLI_VERSION_MINOR=`expr $BROTLI_VERSION_INT / 4096 % 4096`
+BROTLI_VERSION_PATCH=`expr $BROTLI_VERSION_INT % 4096`
+BROTLI_VERSION="$BROTLI_VERSION_MAJOR.$BROTLI_VERSION_MINOR.$BROTLI_VERSION_PATCH"
+
+sed -i.bak -r "s/[0-9]+:[0-9]+:[0-9]+/$BROTLI_ABI_INFO/" Makefile.am
+sed -i.bak -r "s/\[[0-9]+\.[0-9]+\.[0-9]+\]/[$BROTLI_VERSION]/" configure.ac
+
+autoreconf --install --force --symlink || exit $
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/constants.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/constants.h
new file mode 100644
index 000000000..f6e44dc7b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/constants.h
@@ -0,0 +1,184 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/**
+ * @file
+ * Common constants used in decoder and encoder API.
+ */
+
+#ifndef BROTLI_COMMON_CONSTANTS_H_
+#define BROTLI_COMMON_CONSTANTS_H_
+
+#include "./platform.h"
+#include <brotli/types.h>
+
+/* Specification: 7.3. Encoding of the context map */
+#define BROTLI_CONTEXT_MAP_MAX_RLE 16
+
+/* Specification: 2. Compressed representation overview */
+#define BROTLI_MAX_NUMBER_OF_BLOCK_TYPES 256
+
+/* Specification: 3.3. Alphabet sizes: insert-and-copy length */
+#define BROTLI_NUM_LITERAL_SYMBOLS 256
+#define BROTLI_NUM_COMMAND_SYMBOLS 704
+#define BROTLI_NUM_BLOCK_LEN_SYMBOLS 26
+#define BROTLI_MAX_CONTEXT_MAP_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + \
+ BROTLI_CONTEXT_MAP_MAX_RLE)
+#define BROTLI_MAX_BLOCK_TYPE_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + 2)
+
+/* Specification: 3.5. Complex prefix codes */
+#define BROTLI_REPEAT_PREVIOUS_CODE_LENGTH 16
+#define BROTLI_REPEAT_ZERO_CODE_LENGTH 17
+#define BROTLI_CODE_LENGTH_CODES (BROTLI_REPEAT_ZERO_CODE_LENGTH + 1)
+/* "code length of 8 is repeated" */
+#define BROTLI_INITIAL_REPEATED_CODE_LENGTH 8
+
+/* "Large Window Brotli" */
+
+/**
+ * The theoretical maximum number of distance bits specified for large window
+ * brotli, for 64-bit encoders and decoders. Even when in practice 32-bit
+ * encoders and decoders only support up to 30 max distance bits, the value is
+ * set to 62 because it affects the large window brotli file format.
+ * Specifically, it affects the encoding of simple huffman tree for distances,
+ * see Specification RFC 7932 chapter 3.4.
+ */
+#define BROTLI_LARGE_MAX_DISTANCE_BITS 62U
+#define BROTLI_LARGE_MIN_WBITS 10
+/**
+ * The maximum supported large brotli window bits by the encoder and decoder.
+ * Large window brotli allows up to 62 bits, however the current encoder and
+ * decoder, designed for 32-bit integers, only support up to 30 bits maximum.
+ */
+#define BROTLI_LARGE_MAX_WBITS 30
+
+/* Specification: 4. Encoding of distances */
+#define BROTLI_NUM_DISTANCE_SHORT_CODES 16
+/**
+ * Maximal number of "postfix" bits.
+ *
+ * Number of "postfix" bits is stored as 2 bits in meta-block header.
+ */
+#define BROTLI_MAX_NPOSTFIX 3
+#define BROTLI_MAX_NDIRECT 120
+#define BROTLI_MAX_DISTANCE_BITS 24U
+#define BROTLI_DISTANCE_ALPHABET_SIZE(NPOSTFIX, NDIRECT, MAXNBITS) ( \
+ BROTLI_NUM_DISTANCE_SHORT_CODES + (NDIRECT) + \
+ ((MAXNBITS) << ((NPOSTFIX) + 1)))
+/* BROTLI_NUM_DISTANCE_SYMBOLS == 1128 */
+#define BROTLI_NUM_DISTANCE_SYMBOLS \
+ BROTLI_DISTANCE_ALPHABET_SIZE( \
+ BROTLI_MAX_NDIRECT, BROTLI_MAX_NPOSTFIX, BROTLI_LARGE_MAX_DISTANCE_BITS)
+
+/* ((1 << 26) - 4) is the maximal distance that can be expressed in RFC 7932
+ brotli stream using NPOSTFIX = 0 and NDIRECT = 0. With other NPOSTFIX and
+ NDIRECT values distances up to ((1 << 29) + 88) could be expressed. */
+#define BROTLI_MAX_DISTANCE 0x3FFFFFC
+
+/* ((1 << 31) - 4) is the safe distance limit. Using this number as a limit
+ allows safe distance calculation without overflows, given the distance
+ alphabet size is limited to corresponding size
+ (see kLargeWindowDistanceCodeLimits). */
+#define BROTLI_MAX_ALLOWED_DISTANCE 0x7FFFFFFC
+
+/* 7.1. Context modes and context ID lookup for literals */
+/* "context IDs for literals are in the range of 0..63" */
+#define BROTLI_LITERAL_CONTEXT_BITS 6
+
+/* 7.2. Context ID for distances */
+#define BROTLI_DISTANCE_CONTEXT_BITS 2
+
+/* 9.1. Format of the Stream Header */
+/* Number of slack bytes for window size. Don't confuse
+ with BROTLI_NUM_DISTANCE_SHORT_CODES. */
+#define BROTLI_WINDOW_GAP 16
+#define BROTLI_MAX_BACKWARD_LIMIT(W) (((size_t)1 << (W)) - BROTLI_WINDOW_GAP)
+
+typedef struct BrotliDistanceCodeLimit {
+ uint32_t max_alphabet_size;
+ uint32_t max_distance;
+} BrotliDistanceCodeLimit;
+
+/* This function calculates maximal size of distance alphabet, such that the
+ distances greater than the given values can not be represented.
+
+ This limits are designed to support fast and safe 32-bit decoders.
+ "32-bit" means that signed integer values up to ((1 << 31) - 1) could be
+ safely expressed.
+
+ Brotli distance alphabet symbols do not represent consecutive distance
+ ranges. Each distance alphabet symbol (excluding direct distances and short
+ codes), represent interleaved (for NPOSTFIX > 0) range of distances.
+ A "group" of consecutive (1 << NPOSTFIX) symbols represent non-interleaved
+ range. Two consecutive groups require the same amount of "extra bits".
+
+ It is important that distance alphabet represents complete "groups".
+ To avoid complex logic on encoder side about interleaved ranges
+ it was decided to restrict both sides to complete distance code "groups".
+ */
+BROTLI_UNUSED_FUNCTION BrotliDistanceCodeLimit BrotliCalculateDistanceCodeLimit(
+ uint32_t max_distance, uint32_t npostfix, uint32_t ndirect) {
+ BrotliDistanceCodeLimit result;
+ /* Marking this function as unused, because not all files
+ including "constants.h" use it -> compiler warns about that. */
+ BROTLI_UNUSED(&BrotliCalculateDistanceCodeLimit);
+ if (max_distance <= ndirect) {
+ /* This case never happens / exists only for the sake of completeness. */
+ result.max_alphabet_size = max_distance + BROTLI_NUM_DISTANCE_SHORT_CODES;
+ result.max_distance = max_distance;
+ return result;
+ } else {
+ /* The first prohibited value. */
+ uint32_t forbidden_distance = max_distance + 1;
+ /* Subtract "directly" encoded region. */
+ uint32_t offset = forbidden_distance - ndirect - 1;
+ uint32_t ndistbits = 0;
+ uint32_t tmp;
+ uint32_t half;
+ uint32_t group;
+ /* Postfix for the last dcode in the group. */
+ uint32_t postfix = (1u << npostfix) - 1;
+ uint32_t extra;
+ uint32_t start;
+ /* Remove postfix and "head-start". */
+ offset = (offset >> npostfix) + 4;
+ /* Calculate the number of distance bits. */
+ tmp = offset / 2;
+ /* Poor-man's log2floor, to avoid extra dependencies. */
+ while (tmp != 0) {ndistbits++; tmp = tmp >> 1;}
+ /* One bit is covered with subrange addressing ("half"). */
+ ndistbits--;
+ /* Find subrange. */
+ half = (offset >> ndistbits) & 1;
+ /* Calculate the "group" part of dcode. */
+ group = ((ndistbits - 1) << 1) | half;
+ /* Calculated "group" covers the prohibited distance value. */
+ if (group == 0) {
+ /* This case is added for correctness; does not occur for limit > 128. */
+ result.max_alphabet_size = ndirect + BROTLI_NUM_DISTANCE_SHORT_CODES;
+ result.max_distance = ndirect;
+ return result;
+ }
+ /* Decrement "group", so it is the last permitted "group". */
+ group--;
+ /* After group was decremented, ndistbits and half must be recalculated. */
+ ndistbits = (group >> 1) + 1;
+ /* The last available distance in the subrange has all extra bits set. */
+ extra = (1u << ndistbits) - 1;
+ /* Calculate region start. NB: ndistbits >= 1. */
+ start = (1u << (ndistbits + 1)) - 4;
+ /* Move to subregion. */
+ start += (group & 1) << ndistbits;
+ /* Calculate the alphabet size. */
+ result.max_alphabet_size = ((group << npostfix) | postfix) + ndirect +
+ BROTLI_NUM_DISTANCE_SHORT_CODES + 1;
+ /* Calculate the maximal distance representable by alphabet. */
+ result.max_distance = ((start + extra) << npostfix) + postfix + ndirect + 1;
+ return result;
+ }
+}
+
+#endif /* BROTLI_COMMON_CONSTANTS_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/context.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/context.h
new file mode 100755
index 000000000..24b3eb48f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/context.h
@@ -0,0 +1,261 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Lookup table to map the previous two bytes to a context id.
+
+ There are four different context modeling modes defined here:
+ CONTEXT_LSB6: context id is the least significant 6 bits of the last byte,
+ CONTEXT_MSB6: context id is the most significant 6 bits of the last byte,
+ CONTEXT_UTF8: second-order context model tuned for UTF8-encoded text,
+ CONTEXT_SIGNED: second-order context model tuned for signed integers.
+
+ If |p1| and |p2| are the previous two bytes, and |mode| is current context
+ mode, we calculate the context as:
+
+ context = ContextLut(mode)[p1] | ContextLut(mode)[p2 + 256].
+
+ For CONTEXT_UTF8 mode, if the previous two bytes are ASCII characters
+ (i.e. < 128), this will be equivalent to
+
+ context = 4 * context1(p1) + context2(p2),
+
+ where context1 is based on the previous byte in the following way:
+
+ 0 : non-ASCII control
+ 1 : \t, \n, \r
+ 2 : space
+ 3 : other punctuation
+ 4 : " '
+ 5 : %
+ 6 : ( < [ {
+ 7 : ) > ] }
+ 8 : , ; :
+ 9 : .
+ 10 : =
+ 11 : number
+ 12 : upper-case vowel
+ 13 : upper-case consonant
+ 14 : lower-case vowel
+ 15 : lower-case consonant
+
+ and context2 is based on the second last byte:
+
+ 0 : control, space
+ 1 : punctuation
+ 2 : upper-case letter, number
+ 3 : lower-case letter
+
+ If the last byte is ASCII, and the second last byte is not (in a valid UTF8
+ stream it will be a continuation byte, value between 128 and 191), the
+ context is the same as if the second last byte was an ASCII control or space.
+
+ If the last byte is a UTF8 lead byte (value >= 192), then the next byte will
+ be a continuation byte and the context id is 2 or 3 depending on the LSB of
+ the last byte and to a lesser extent on the second last byte if it is ASCII.
+
+ If the last byte is a UTF8 continuation byte, the second last byte can be:
+ - continuation byte: the next byte is probably ASCII or lead byte (assuming
+ 4-byte UTF8 characters are rare) and the context id is 0 or 1.
+ - lead byte (192 - 207): next byte is ASCII or lead byte, context is 0 or 1
+ - lead byte (208 - 255): next byte is continuation byte, context is 2 or 3
+
+ The possible value combinations of the previous two bytes, the range of
+ context ids and the type of the next byte is summarized in the table below:
+
+ |--------\-----------------------------------------------------------------|
+ | \ Last byte |
+ | Second \---------------------------------------------------------------|
+ | last byte \ ASCII | cont. byte | lead byte |
+ | \ (0-127) | (128-191) | (192-) |
+ |=============|===================|=====================|==================|
+ | ASCII | next: ASCII/lead | not valid | next: cont. |
+ | (0-127) | context: 4 - 63 | | context: 2 - 3 |
+ |-------------|-------------------|---------------------|------------------|
+ | cont. byte | next: ASCII/lead | next: ASCII/lead | next: cont. |
+ | (128-191) | context: 4 - 63 | context: 0 - 1 | context: 2 - 3 |
+ |-------------|-------------------|---------------------|------------------|
+ | lead byte | not valid | next: ASCII/lead | not valid |
+ | (192-207) | | context: 0 - 1 | |
+ |-------------|-------------------|---------------------|------------------|
+ | lead byte | not valid | next: cont. | not valid |
+ | (208-) | | context: 2 - 3 | |
+ |-------------|-------------------|---------------------|------------------|
+*/
+
+#ifndef BROTLI_COMMON_CONTEXT_H_
+#define BROTLI_COMMON_CONTEXT_H_
+
+#include <brotli/types.h>
+
+typedef enum ContextType {
+ CONTEXT_LSB6 = 0,
+ CONTEXT_MSB6 = 1,
+ CONTEXT_UTF8 = 2,
+ CONTEXT_SIGNED = 3
+} ContextType;
+
+/* Common context lookup table for all context modes. */
+static const uint8_t kContextLookup[2048] = {
+ /* CONTEXT_LSB6, last byte. */
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+
+ /* CONTEXT_LSB6, second last byte, */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+ /* CONTEXT_MSB6, last byte. */
+ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
+ 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
+ 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11,
+ 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15,
+ 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19,
+ 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23,
+ 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27,
+ 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31,
+ 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35,
+ 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39,
+ 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43,
+ 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47,
+ 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51,
+ 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55,
+ 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59,
+ 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63,
+
+ /* CONTEXT_MSB6, second last byte, */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+ /* CONTEXT_UTF8, last byte. */
+ /* ASCII range. */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 8, 12, 16, 12, 12, 20, 12, 16, 24, 28, 12, 12, 32, 12, 36, 12,
+ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 32, 32, 24, 40, 28, 12,
+ 12, 48, 52, 52, 52, 48, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48,
+ 52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 24, 12, 28, 12, 12,
+ 12, 56, 60, 60, 60, 56, 60, 60, 60, 56, 60, 60, 60, 60, 60, 56,
+ 60, 60, 60, 60, 60, 56, 60, 60, 60, 60, 60, 24, 12, 28, 12, 0,
+ /* UTF8 continuation byte range. */
+ 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
+ 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
+ 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
+ 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
+ /* UTF8 lead byte range. */
+ 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
+ 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
+ 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
+ 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
+
+ /* CONTEXT_UTF8 second last byte. */
+ /* ASCII range. */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
+ 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,
+ 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0,
+ /* UTF8 continuation byte range. */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ /* UTF8 lead byte range. */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+
+ /* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */
+ 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 56,
+
+ /* CONTEXT_SIGNED, second last byte. */
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7,
+};
+
+typedef const uint8_t* ContextLut;
+
+/* typeof(MODE) == ContextType; returns ContextLut */
+#define BROTLI_CONTEXT_LUT(MODE) (&kContextLookup[(MODE) << 9])
+
+/* typeof(LUT) == ContextLut */
+#define BROTLI_CONTEXT(P1, P2, LUT) ((LUT)[P1] | ((LUT) + 256)[P2])
+
+#endif /* BROTLI_COMMON_CONTEXT_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/dictionary.bin b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/dictionary.bin
new file mode 100644
index 000000000..a585c0e29
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/dictionary.bin
@@ -0,0 +1,432 @@
+timedownlifeleftbackcodedatashowonlysitecityopenjustlikefreeworktextyearoverbodyloveformbookplaylivelinehelphomesidemorewordlongthemviewfindpagedaysfullheadtermeachareafromtruemarkableuponhighdatelandnewsevennextcasebothpostusedmadehandherewhatnameLinkblogsizebaseheldmakemainuser') +holdendswithNewsreadweresigntakehavegameseencallpathwellplusmenufilmpartjointhislistgoodneedwayswestjobsmindalsologorichuseslastteamarmyfoodkingwilleastwardbestfirePageknowaway.pngmovethanloadgiveselfnotemuchfeedmanyrockicononcelookhidediedHomerulehostajaxinfoclublawslesshalfsomesuchzone100%onescareTimeracebluefourweekfacehopegavehardlostwhenparkkeptpassshiproomHTMLplanTypedonesavekeepflaglinksoldfivetookratetownjumpthusdarkcardfilefearstaykillthatfallautoever.comtalkshopvotedeepmoderestturnbornbandfellroseurl(skinrolecomeactsagesmeetgold.jpgitemvaryfeltthensenddropViewcopy1.0"</a>stopelseliestourpack.gifpastcss?graymean&gt;rideshotlatesaidroadvar feeljohnrickportfast'UA-dead</b>poorbilltypeU.S.woodmust2px;Inforankwidewantwalllead[0];paulwavesure$('#waitmassarmsgoesgainlangpaid!-- lockunitrootwalkfirmwifexml"songtest20pxkindrowstoolfontmailsafestarmapscorerainflowbabyspansays4px;6px;artsfootrealwikiheatsteptriporg/lakeweaktoldFormcastfansbankveryrunsjulytask1px;goalgrewslowedgeid="sets5px;.js?40pxif (soonseatnonetubezerosentreedfactintogiftharm18pxcamehillboldzoomvoideasyringfillpeakinitcost3px;jacktagsbitsrolleditknewnear<!--growJSONdutyNamesaleyou lotspainjazzcoldeyesfishwww.risktabsprev10pxrise25pxBlueding300,ballfordearnwildbox.fairlackverspairjunetechif(!pickevil$("#warmlorddoespull,000ideadrawhugespotfundburnhrefcellkeystickhourlossfuel12pxsuitdealRSS"agedgreyGET"easeaimsgirlaids8px;navygridtips#999warsladycars); }php?helltallwhomzh:å*/
+ 100hall.
+
+A7px;pushchat0px;crew*/</hash75pxflatrare && tellcampontolaidmissskiptentfinemalegetsplot400,
+
+coolfeet.php<br>ericmostguidbelldeschairmathatom/img&#82luckcent000;tinygonehtmlselldrugFREEnodenick?id=losenullvastwindRSS wearrelybeensamedukenasacapewishgulfT23:hitsslotgatekickblurthey15px''););">msiewinsbirdsortbetaseekT18:ordstreemall60pxfarm’sboys[0].');"POSTbearkids);}}marytend(UK)quadzh:æ-siz----prop'); liftT19:viceandydebt>RSSpoolneckblowT16:doorevalT17:letsfailoralpollnovacolsgene —softrometillross<h3>pourfadepink<tr>mini)|!(minezh:èbarshear00);milk -->ironfreddiskwentsoilputs/js/holyT22:ISBNT20:adamsees<h2>json', 'contT21: RSSloopasiamoon</p>soulLINEfortcartT14:<h1>80px!--<9px;T04:mike:46ZniceinchYorkricezh:ä'));puremageparatonebond:37Z_of_']);000,zh:çtankyardbowlbush:56ZJava30px
+|}
+%C3%:34ZjeffEXPIcashvisagolfsnowzh:équer.csssickmeatmin.binddellhirepicsrent:36ZHTTP-201fotowolfEND xbox:54ZBODYdick;
+}
+exit:35Zvarsbeat'});diet999;anne}}</[i].Langkm²wiretoysaddssealalex;
+ }echonine.org005)tonyjewssandlegsroof000) 200winegeardogsbootgarycutstyletemption.xmlcockgang$('.50pxPh.Dmiscalanloandeskmileryanunixdisc);}
+dustclip).
+
+70px-200DVDs7]><tapedemoi++)wageeurophiloptsholeFAQsasin-26TlabspetsURL bulkcook;}
+HEAD[0])abbrjuan(198leshtwin</i>sonyguysfuckpipe|-
+!002)ndow[1];[];
+Log salt
+ bangtrimbath){
+00px
+});ko:ìfeesad> s:// [];tollplug(){
+{
+ .js'200pdualboat.JPG);
+}quot);
+
+');
+
+} 201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037201320122011201020092008200720062005200420032002200120001999199819971996199519941993199219911990198919881987198619851984198319821981198019791978197719761975197419731972197119701969196819671966196519641963196219611960195919581957195619551954195319521951195010001024139400009999comomásesteestaperotodohacecadaañobiendíaasívidacasootroforosolootracualdijosidograntipotemadebealgoquéestonadatrespococasabajotodasinoaguapuesunosantediceluisellamayozonaamorpisoobraclicellodioshoracasiзанаомрарутанепоотизнодотожеонихÐаеебымыВыÑовывоÐообПолиниРФÐеМытыОнимдаЗаДаÐуОбтеИзейнуммТыужÙيأنمامعكلأوردياÙىهولملكاولهبسالإنهيأيقدهلثمبهلوليبلايبكشيامأمنتبيلنحبهممشوشfirstvideolightworldmediawhitecloseblackrightsmallbooksplacemusicfieldorderpointvalueleveltableboardhousegroupworksyearsstatetodaywaterstartstyledeathpowerphonenighterrorinputabouttermstitletoolseventlocaltimeslargewordsgamesshortspacefocusclearmodelblockguideradiosharewomenagainmoneyimagenamesyounglineslatercolorgreenfront&amp;watchforcepricerulesbeginaftervisitissueareasbelowindextotalhourslabelprintpressbuiltlinksspeedstudytradefoundsenseundershownformsrangeaddedstillmovedtakenaboveflashfixedoftenotherviewschecklegalriveritemsquickshapehumanexistgoingmoviethirdbasicpeacestagewidthloginideaswrotepagesusersdrivestorebreaksouthvoicesitesmonthwherebuildwhichearthforumthreesportpartyClicklowerlivesclasslayerentrystoryusagesoundcourtyour birthpopuptypesapplyImagebeinguppernoteseveryshowsmeansextramatchtrackknownearlybegansuperpapernorthlearngivennamedendedTermspartsGroupbrandusingwomanfalsereadyaudiotakeswhile.com/livedcasesdailychildgreatjudgethoseunitsneverbroadcoastcoverapplefilescyclesceneplansclickwritequeenpieceemailframeolderphotolimitcachecivilscaleenterthemetheretouchboundroyalaskedwholesincestock namefaithheartemptyofferscopeownedmightalbumthinkbloodarraymajortrustcanonunioncountvalidstoneStyleLoginhappyoccurleft:freshquitefilmsgradeneedsurbanfightbasishoverauto;route.htmlmixedfinalYour slidetopicbrownalonedrawnsplitreachRightdatesmarchquotegoodsLinksdoubtasyncthumballowchiefyouthnovel10px;serveuntilhandsCheckSpacequeryjamesequaltwice0,000Startpanelsongsroundeightshiftworthpostsleadsweeksavoidthesemilesplanesmartalphaplantmarksratesplaysclaimsalestextsstarswrong</h3>thing.org/multiheardPowerstandtokensolid(thisbringshipsstafftriedcallsfullyfactsagentThis //-->adminegyptEvent15px;Emailtrue"crossspentblogsbox">notedleavechinasizesguest</h4>robotheavytrue,sevengrandcrimesignsawaredancephase><!--en_US&#39;200px_namelatinenjoyajax.ationsmithU.S. holdspeterindianav">chainscorecomesdoingpriorShare1990sromanlistsjapanfallstrialowneragree</h2>abusealertopera"-//WcardshillsteamsPhototruthclean.php?saintmetallouismeantproofbriefrow">genretrucklooksValueFrame.net/-->
+<try {
+var makescostsplainadultquesttrainlaborhelpscausemagicmotortheir250pxleaststepsCountcouldglasssidesfundshotelawardmouthmovesparisgivesdutchtexasfruitnull,||[];top">
+<!--POST"ocean<br/>floorspeakdepth sizebankscatchchart20px;aligndealswould50px;url="parksmouseMost ...</amongbrainbody none;basedcarrydraftreferpage_home.meterdelaydreamprovejoint</tr>drugs<!-- aprilidealallenexactforthcodeslogicView seemsblankports (200saved_linkgoalsgrantgreekhomesringsrated30px;whoseparse();" Blocklinuxjonespixel');">);if(-leftdavidhorseFocusraiseboxesTrackement</em>bar">.src=toweralt="cablehenry24px;setupitalysharpminortastewantsthis.resetwheelgirls/css/100%;clubsstuffbiblevotes 1000korea});
+bandsqueue= {};80px;cking{
+ aheadclockirishlike ratiostatsForm"yahoo)[0];Aboutfinds</h1>debugtasksURL =cells})();12px;primetellsturns0x600.jpg"spainbeachtaxesmicroangel--></giftssteve-linkbody.});
+ mount (199FAQ</rogerfrankClass28px;feeds<h1><scotttests22px;drink) || lewisshall#039; for lovedwaste00px;ja:ã‚simon<fontreplymeetsuntercheaptightBrand) != dressclipsroomsonkeymobilmain.Name platefunnytreescom/"1.jpgwmodeparamSTARTleft idden, 201);
+}
+form.viruschairtransworstPagesitionpatch<!--
+o-cacfirmstours,000 asiani++){adobe')[0]id=10both;menu .2.mi.png"kevincoachChildbruce2.jpgURL)+.jpg|suitesliceharry120" sweettr>
+name=diegopage swiss-->
+
+#fff;">Log.com"treatsheet) && 14px;sleepntentfiledja:ãƒid="cName"worseshots-box-delta
+&lt;bears:48Z<data-rural</a> spendbakershops= "";php">ction13px;brianhellosize=o=%2F joinmaybe<img img">, fjsimg" ")[0]MTopBType"newlyDanskczechtrailknows</h5>faq">zh-cn10);
+-1");type=bluestrulydavis.js';>
+<!steel you h2>
+form jesus100% menu.
+
+walesrisksumentddingb-likteachgif" vegasdanskeestishqipsuomisobredesdeentretodospuedeañosestátienehastaotrospartedondenuevohacerformamismomejormundoaquídíassóloayudafechatodastantomenosdatosotrassitiomuchoahoralugarmayorestoshorastenerantesfotosestaspaísnuevasaludforosmedioquienmesespoderchileserávecesdecirjoséestarventagrupohechoellostengoamigocosasnivelgentemismaairesjuliotemashaciafavorjuniolibrepuntobuenoautorabrilbuenatextomarzosaberlistaluegocómoenerojuegoperúhaberestoynuncamujervalorfueralibrogustaigualvotoscasosguíapuedosomosavisousteddebennochebuscafaltaeurosseriedichocursoclavecasasleónplazolargoobrasvistaapoyojuntotratavistocrearcampohemoscincocargopisosordenhacenáreadiscopedrocercapuedapapelmenorútilclarojorgecalleponertardenadiemarcasigueellassiglocochemotosmadreclaserestoniñoquedapasarbancohijosviajepabloéstevienereinodejarfondocanalnorteletracausatomarmanoslunesautosvillavendopesartipostengamarcollevapadreunidovamoszonasambosbandamariaabusomuchasubirriojavivirgradochicaallíjovendichaestantalessalirsuelopesosfinesllamabuscoéstalleganegroplazahumorpagarjuntadobleislasbolsabañohablaluchaÃreadicenjugarnotasvalleallácargadolorabajoestégustomentemariofirmacostofichaplatahogarartesleyesaquelmuseobasespocosmitadcielochicomiedoganarsantoetapadebesplayaredessietecortecoreadudasdeseoviejodeseaaguas&quot;domaincommonstatuseventsmastersystemactionbannerremovescrollupdateglobalmediumfilternumberchangeresultpublicscreenchoosenormaltravelissuessourcetargetspringmodulemobileswitchphotosborderregionitselfsocialactivecolumnrecordfollowtitle>eitherlengthfamilyfriendlayoutauthorcreatereviewsummerserverplayedplayerexpandpolicyformatdoublepointsseriespersonlivingdesignmonthsforcesuniqueweightpeopleenergynaturesearchfigurehavingcustomoffsetletterwindowsubmitrendergroupsuploadhealthmethodvideosschoolfutureshadowdebatevaluesObjectothersrightsleaguechromesimplenoticesharedendingseasonreportonlinesquarebuttonimagesenablemovinglatestwinterFranceperiodstrongrepeatLondondetailformeddemandsecurepassedtoggleplacesdevicestaticcitiesstreamyellowattackstreetflighthiddeninfo">openedusefulvalleycausesleadersecretseconddamagesportsexceptratingsignedthingseffectfieldsstatesofficevisualeditorvolumeReportmuseummoviesparentaccessmostlymother" id="marketgroundchancesurveybeforesymbolmomentspeechmotioninsidematterCenterobjectexistsmiddleEuropegrowthlegacymannerenoughcareeransweroriginportalclientselectrandomclosedtopicscomingfatheroptionsimplyraisedescapechosenchurchdefinereasoncorneroutputmemoryiframepolicemodelsNumberduringoffersstyleskilledlistedcalledsilvermargindeletebetterbrowselimitsGlobalsinglewidgetcenterbudgetnowrapcreditclaimsenginesafetychoicespirit-stylespreadmakingneededrussiapleaseextentScriptbrokenallowschargedividefactormember-basedtheoryconfigaroundworkedhelpedChurchimpactshouldalwayslogo" bottomlist">){var prefixorangeHeader.push(couplegardenbridgelaunchReviewtakingvisionlittledatingButtonbeautythemesforgotSearchanchoralmostloadedChangereturnstringreloadMobileincomesupplySourceordersviewed&nbsp;courseAbout island<html cookiename="amazonmodernadvicein</a>: The dialoghousesBEGIN MexicostartscentreheightaddingIslandassetsEmpireSchooleffortdirectnearlymanualSelect.
+
+Onejoinedmenu">PhilipawardshandleimportOfficeregardskillsnationSportsdegreeweekly (e.g.behinddoctorloggedunited</b></beginsplantsassistartistissued300px|canadaagencyschemeremainBrazilsamplelogo">beyond-scaleacceptservedmarineFootercamera</h1>
+_form"leavesstress" />
+.gif" onloadloaderOxfordsistersurvivlistenfemaleDesignsize="appealtext">levelsthankshigherforcedanimalanyoneAfricaagreedrecentPeople<br />wonderpricesturned|| {};main">inlinesundaywrap">failedcensusminutebeaconquotes150px|estateremoteemail"linkedright;signalformal1.htmlsignupprincefloat:.png" forum.AccesspaperssoundsextendHeightsliderUTF-8"&amp; Before. WithstudioownersmanageprofitjQueryannualparamsboughtfamousgooglelongeri++) {israelsayingdecidehome">headerensurebranchpiecesblock;statedtop"><racingresize--&gt;pacitysexualbureau.jpg" 10,000obtaintitlesamount, Inc.comedymenu" lyricstoday.indeedcounty_logo.FamilylookedMarketlse ifPlayerturkey);var forestgivingerrorsDomain}else{insertBlog</footerlogin.fasteragents<body 10px 0pragmafridayjuniordollarplacedcoversplugin5,000 page">boston.test(avatartested_countforumsschemaindex,filledsharesreaderalert(appearSubmitline">body">
+* TheThoughseeingjerseyNews</verifyexpertinjurywidth=CookieSTART across_imagethreadnativepocketbox">
+System DavidcancertablesprovedApril reallydriveritem">more">boardscolorscampusfirst || [];media.guitarfinishwidth:showedOther .php" assumelayerswilsonstoresreliefswedenCustomeasily your String
+
+Whiltaylorclear:resortfrenchthough") + "<body>buyingbrandsMembername">oppingsector5px;">vspacepostermajor coffeemartinmaturehappen</nav>kansaslink">Images=falsewhile hspace0&amp;
+
+In powerPolski-colorjordanBottomStart -count2.htmlnews">01.jpgOnline-rightmillerseniorISBN 00,000 guidesvalue)ectionrepair.xml" rights.html-blockregExp:hoverwithinvirginphones</tr> using
+ var >');
+ </td>
+</tr>
+bahasabrasilgalegomagyarpolskisrpskiردو中文简体ç¹é«”ä¿¡æ¯ä¸­å›½æˆ‘们一个公å¸ç®¡ç†è®ºå›å¯ä»¥æœåŠ¡æ—¶é—´ä¸ªäººäº§å“自己ä¼ä¸šæŸ¥çœ‹å·¥ä½œè”系没有网站所有评论中心文章用户首页作者技术问题相关下载æœç´¢ä½¿ç”¨è½¯ä»¶åœ¨çº¿ä¸»é¢˜èµ„料视频回å¤æ³¨å†Œç½‘络收è—内容推è市场消æ¯ç©ºé—´å‘布什么好å‹ç”Ÿæ´»å›¾ç‰‡å‘展如果手机新闻最新方å¼åŒ—京æ供关于更多这个系统知é“游æˆå¹¿å‘Šå…¶ä»–å‘表安全第一会员进行点击版æƒç”µå­ä¸–界设计å…费教育加入活动他们商å“åšå®¢çŽ°åœ¨ä¸Šæµ·å¦‚何已ç»ç•™è¨€è¯¦ç»†ç¤¾åŒºç™»å½•æœ¬ç«™éœ€è¦ä»·æ ¼æ”¯æŒå›½é™…链接国家建设朋å‹é˜…读法律ä½ç½®ç»æµŽé€‰æ‹©è¿™æ ·å½“å‰åˆ†ç±»æŽ’行因为交易最åŽéŸ³ä¹ä¸èƒ½é€šè¿‡è¡Œä¸šç§‘技å¯èƒ½è®¾å¤‡åˆä½œå¤§å®¶ç¤¾ä¼šç ”究专业全部项目这里还是开始情况电脑文件å“牌帮助文化资æºå¤§å­¦å­¦ä¹ åœ°å€æµè§ˆæŠ•èµ„工程è¦æ±‚怎么时候功能主è¦ç›®å‰èµ„讯城市方法电影招è˜å£°æ˜Žä»»ä½•å¥åº·æ•°æ®ç¾Žå›½æ±½è½¦ä»‹ç»ä½†æ˜¯äº¤æµç”Ÿäº§æ‰€ä»¥ç”µè¯æ˜¾ç¤ºä¸€äº›å•ä½äººå‘˜åˆ†æžåœ°å›¾æ—…游工具学生系列网å‹å¸–å­å¯†ç é¢‘é“控制地区基本全国网上é‡è¦ç¬¬äºŒå–œæ¬¢è¿›å…¥å‹æƒ…这些考试å‘现培训以上政府æˆä¸ºçŽ¯å¢ƒé¦™æ¸¯åŒæ—¶å¨±ä¹å‘é€ä¸€å®šå¼€å‘作å“标准欢迎解决地方一下以åŠè´£ä»»æˆ–者客户代表积分女人数ç é”€å”®å‡ºçŽ°ç¦»çº¿åº”用列表ä¸åŒç¼–辑统计查询ä¸è¦æœ‰å…³æœºæž„很多播放组织政策直接能力æ¥æºæ™‚間看到热门关键专区éžå¸¸è‹±è¯­ç™¾åº¦å¸Œæœ›ç¾Žå¥³æ¯”较知识规定建议部门æ„è§ç²¾å½©æ—¥æœ¬æ高å‘言方é¢åŸºé‡‘处ç†æƒé™å½±ç‰‡é“¶è¡Œè¿˜æœ‰åˆ†äº«ç‰©å“ç»è¥æ·»åŠ ä¸“家这ç§è¯é¢˜èµ·æ¥ä¸šåŠ¡å…¬å‘Šè®°å½•ç®€ä»‹è´¨é‡ç”·äººå½±å“引用报告部分快速咨询时尚注æ„申请学校应该历å²åªæ˜¯è¿”回购买å称为了æˆåŠŸè¯´æ˜Žä¾›åº”å­©å­ä¸“题程åºä¸€èˆ¬æœƒå“¡åªæœ‰å…¶å®ƒä¿æŠ¤è€Œä¸”今天窗å£åŠ¨æ€çŠ¶æ€ç‰¹åˆ«è®¤ä¸ºå¿…须更新å°è¯´æˆ‘們作为媒体包括那么一样国内是å¦æ ¹æ®ç”µè§†å­¦é™¢å…·æœ‰è¿‡ç¨‹ç”±äºŽäººæ‰å‡ºæ¥ä¸è¿‡æ­£åœ¨æ˜Žæ˜Ÿæ•…事关系标题商务输入一直基础教学了解建筑结果全çƒé€šçŸ¥è®¡åˆ’对于艺术相册å‘生真的建立等级类型ç»éªŒå®žçŽ°åˆ¶ä½œæ¥è‡ªæ ‡ç­¾ä»¥ä¸‹åŽŸåˆ›æ— æ³•å…¶ä¸­å€‹äººä¸€åˆ‡æŒ‡å—关闭集团第三关注因此照片深圳商业广州日期高级最近综åˆè¡¨ç¤ºä¸“辑行为交通评价觉得精åŽå®¶åº­å®Œæˆæ„Ÿè§‰å®‰è£…得到邮件制度食å“虽然转载报价记者方案行政人民用å“东西æ出酒店然åŽä»˜æ¬¾çƒ­ç‚¹ä»¥å‰å®Œå…¨å‘帖设置领导工业医院看看ç»å…¸åŽŸå› å¹³å°å„ç§å¢žåŠ æ料新增之åŽèŒä¸šæ•ˆæžœä»Šå¹´è®ºæ–‡æˆ‘国告诉版主修改å‚与打å°å¿«ä¹æœºæ¢°è§‚点存在精神获得利用继续你们这么模å¼è¯­è¨€èƒ½å¤Ÿé›…虎æ“作风格一起科学体育短信æ¡ä»¶æ²»ç–—è¿åŠ¨äº§ä¸šä¼šè®®å¯¼èˆªå…ˆç”Ÿè”盟å¯æ˜¯å•é¡Œç»“构作用调查資料自动负责农业访问实施接å—讨论那个å馈加强女性范围æœå‹™ä¼‘闲今日客æœè§€çœ‹å‚加的è¯ä¸€ç‚¹ä¿è¯å›¾ä¹¦æœ‰æ•ˆæµ‹è¯•ç§»åŠ¨æ‰èƒ½å†³å®šè‚¡ç¥¨ä¸æ–­éœ€æ±‚ä¸å¾—办法之间采用è¥é”€æŠ•è¯‰ç›®æ ‡çˆ±æƒ…摄影有些複製文学机会数字装修购物农æ‘å…¨é¢ç²¾å“其实事情水平æ示上市谢谢普通教师上传类别歌曲拥有创新é…件åªè¦æ—¶ä»£è³‡è¨Šè¾¾åˆ°äººç”Ÿè®¢é˜…è€å¸ˆå±•ç¤ºå¿ƒç†è´´å­ç¶²ç«™ä¸»é¡Œè‡ªç„¶çº§åˆ«ç®€å•æ”¹é©é‚£äº›æ¥è¯´æ‰“开代ç åˆ é™¤è¯åˆ¸èŠ‚ç›®é‡ç‚¹æ¬¡æ•¸å¤šå°‘规划资金找到以åŽå¤§å…¨ä¸»é¡µæœ€ä½³å›žç­”天下ä¿éšœçŽ°ä»£æ£€æŸ¥æŠ•ç¥¨å°æ—¶æ²’有正常甚至代ç†ç›®å½•å…¬å¼€å¤åˆ¶é‡‘èžå¹¸ç¦ç‰ˆæœ¬å½¢æˆå‡†å¤‡è¡Œæƒ…回到æ€æƒ³æ€Žæ ·å议认è¯æœ€å¥½äº§ç”ŸæŒ‰ç…§æœè£…广东动漫采购新手组图é¢æ¿å‚考政治容易天地努力人们å‡çº§é€Ÿåº¦äººç‰©è°ƒæ•´æµè¡Œé€ æˆæ–‡å­—韩国贸易开展相關表现影视如此美容大å°æŠ¥é“æ¡æ¬¾å¿ƒæƒ…许多法规家居书店连接立å³ä¸¾æŠ¥æŠ€å·§å¥¥è¿ç™»å…¥ä»¥æ¥ç†è®ºäº‹ä»¶è‡ªç”±ä¸­åŽåŠžå…¬å¦ˆå¦ˆçœŸæ­£ä¸é”™å…¨æ–‡åˆåŒä»·å€¼åˆ«äººç›‘ç£å…·ä½“世纪团队创业承担增长有人ä¿æŒå•†å®¶ç»´ä¿®å°æ¹¾å·¦å³è‚¡ä»½ç­”案实际电信ç»ç†ç”Ÿå‘½å®£ä¼ ä»»åŠ¡æ­£å¼ç‰¹è‰²ä¸‹æ¥å会åªèƒ½å½“然é‡æ–°å…§å®¹æŒ‡å¯¼è¿è¡Œæ—¥å¿—賣家超过土地浙江支付推出站长æ­å·žæ‰§è¡Œåˆ¶é€ ä¹‹ä¸€æŽ¨å¹¿çŽ°åœºæè¿°å˜åŒ–传统歌手ä¿é™©è¯¾ç¨‹åŒ»ç–—ç»è¿‡è¿‡åŽ»ä¹‹å‰æ”¶å…¥å¹´åº¦æ‚志美丽最高登陆未æ¥åŠ å·¥å…责教程版å—身体é‡åº†å‡ºå”®æˆæœ¬å½¢å¼åœŸè±†å‡ºåƒ¹ä¸œæ–¹é‚®ç®±å—京求èŒå–å¾—èŒä½ç›¸ä¿¡é¡µé¢åˆ†é’Ÿç½‘页确定图例网å€ç§¯æžé”™è¯¯ç›®çš„å®è´æœºå…³é£Žé™©æŽˆæƒç—…毒宠物除了評論疾病åŠæ—¶æ±‚购站点儿童æ¯å¤©ä¸­å¤®è®¤è¯†æ¯ä¸ªå¤©æ´¥å­—体å°ç£ç»´æŠ¤æœ¬é¡µä¸ªæ€§å®˜æ–¹å¸¸è§ç›¸æœºæˆ˜ç•¥åº”当律师方便校园股市房屋æ ç›®å‘˜å·¥å¯¼è‡´çªç„¶é“具本网结åˆæ¡£æ¡ˆåŠ³åŠ¨å¦å¤–美元引起改å˜ç¬¬å››ä¼šè®¡èªªæ˜Žéšç§å®å®è§„范消费共åŒå¿˜è®°ä½“系带æ¥å字發表开放加盟å—到二手大é‡æˆäººæ•°é‡å…±äº«åŒºåŸŸå¥³å­©åŽŸåˆ™æ‰€åœ¨ç»“æŸé€šä¿¡è¶…级é…置当时优秀性感房产éŠæˆ²å‡ºå£æ交就业ä¿å¥ç¨‹åº¦å‚数事业整个山东情感特殊分類æœå°‹å±žäºŽé—¨æˆ·è´¢åŠ¡å£°éŸ³åŠå…¶è´¢ç»åšæŒå¹²éƒ¨æˆç«‹åˆ©ç›Šè€ƒè™‘æˆéƒ½åŒ…装用戶比赛文明招商完整真是眼ç›ä¼™ä¼´å¨æœ›é¢†åŸŸå«ç”Ÿä¼˜æƒ è«–壇公共良好充分符åˆé™„件特点ä¸å¯è‹±æ–‡èµ„产根本明显密碼公众民æ—更加享å—åŒå­¦å¯åŠ¨é€‚åˆåŽŸæ¥é—®ç­”本文美食绿色稳定终于生物供求æœç‹åŠ›é‡ä¸¥é‡æ°¸è¿œå†™çœŸæœ‰é™ç«žäº‰å¯¹è±¡è´¹ç”¨ä¸å¥½ç»å¯¹å分促进点评影音优势ä¸å°‘欣èµå¹¶ä¸”有点方å‘全新信用设施形象资格çªç ´éšç€é‡å¤§äºŽæ˜¯æ¯•ä¸šæ™ºèƒ½åŒ–工完美商城统一出版打造產å“概况用于ä¿ç•™å› ç´ ä¸­åœ‹å­˜å‚¨è´´å›¾æœ€æ„›é•¿æœŸå£ä»·ç†è´¢åŸºåœ°å®‰æŽ’武汉里é¢åˆ›å»ºå¤©ç©ºé¦–先完善驱动下é¢ä¸å†è¯šä¿¡æ„义阳光英国漂亮军事玩家群众农民å³å¯å稱家具动画想到注明å°å­¦æ€§èƒ½è€ƒç ”硬件观看清楚æžç¬‘首é é»„金适用江è‹çœŸå®žä¸»ç®¡é˜¶æ®µè¨»å†Šç¿»è¯‘æƒåˆ©åšå¥½ä¼¼ä¹Žé€šè®¯æ–½å·¥ç‹€æ…‹ä¹Ÿè®¸çŽ¯ä¿åŸ¹å…»æ¦‚念大型机票ç†è§£åŒ¿åcuandoenviarmadridbuscariniciotiempoporquecuentaestadopuedenjuegoscontraestánnombretienenperfilmaneraamigosciudadcentroaunquepuedesdentroprimerpreciosegúnbuenosvolverpuntossemanahabíaagostonuevosunidoscarlosequiponiñosmuchosalgunacorreoimagenpartirarribamaríahombreempleoverdadcambiomuchasfueronpasadolíneaparecenuevascursosestabaquierolibroscuantoaccesomiguelvarioscuatrotienesgruposseráneuropamediosfrenteacercademásofertacochesmodeloitalialetrasalgúncompracualesexistecuerposiendoprensallegarviajesdineromurciapodrápuestodiariopuebloquieremanuelpropiocrisisciertoseguromuertefuentecerrargrandeefectopartesmedidapropiaofrecetierrae-mailvariasformasfuturoobjetoseguirriesgonormasmismosúnicocaminositiosrazóndebidopruebatoledoteníajesúsesperococinaorigentiendacientocádizhablarseríalatinafuerzaestiloguerraentraréxitolópezagendavídeoevitarpaginametrosjavierpadresfácilcabezaáreassalidaenvíojapónabusosbienestextosllevarpuedanfuertecomúnclaseshumanotenidobilbaounidadestáseditarcreadoдлÑчтокакилиÑтовÑеегопритакещеужеКакбезбылониВÑеподЭтотомчемнетлетразонагдемнеДлÑПринаÑнихтемктогодвоттамСШÐмаÑЧтоваÑвамемуТакдванамÑтиÑтуВамтехпротутнадднÑВоттринейВаÑнимÑамтотрубОнимирнееОООлицÑтаОнанемдоммойдвеоноÑудकेहैकीसेकाकोऔरपरनेà¤à¤•à¤•à¤¿à¤­à¥€à¤‡à¤¸à¤•à¤°à¤¤à¥‹à¤¹à¥‹à¤†à¤ªà¤¹à¥€à¤¯à¤¹à¤¯à¤¾à¤¤à¤•à¤¥à¤¾jagranआजजोअबदोगईजागà¤à¤¹à¤®à¤‡à¤¨à¤µà¤¹à¤¯à¥‡à¤¥à¥‡à¤¥à¥€à¤˜à¤°à¤œà¤¬à¤¦à¥€à¤•à¤ˆà¤œà¥€à¤µà¥‡à¤¨à¤ˆà¤¨à¤à¤¹à¤°à¤‰à¤¸à¤®à¥‡à¤•à¤®à¤µà¥‹à¤²à¥‡à¤¸à¤¬à¤®à¤ˆà¤¦à¥‡à¤“रआमबसभरबनचलमनआगसीलीعلىإلىهذاآخرعددالىهذهصورغيركانولابينعرضذلكهنايومقالعليانالكنحتىقبلوحةاخرÙقطعبدركنإذاكمااحدإلاÙيهبعضكيÙبحثومنوهوأناجدالهاسلمعندليسعبرصلىمنذبهاأنهمثلكنتالاحيثمصرشرححولوÙياذالكلمرةانتالÙأبوخاصأنتانهاليعضووقدابنخيربنتلكمشاءوهيابوقصصومارقمأحدنحنعدمرأياحةكتبدونيجبمنهتحتجهةسنةيتمكرةغزةنÙسبيتللهلناتلكقلبلماعنهأولشيءنورأماÙيكبكلذاترتببأنهمسانكبيعÙقدحسنلهمشعرأهلشهرقطرطلبprofileservicedefaulthimselfdetailscontentsupportstartedmessagesuccessfashion<title>countryaccountcreatedstoriesresultsrunningprocesswritingobjectsvisiblewelcomearticleunknownnetworkcompanydynamicbrowserprivacyproblemServicerespectdisplayrequestreservewebsitehistoryfriendsoptionsworkingversionmillionchannelwindow.addressvisitedweathercorrectproductedirectforwardyou canremovedsubjectcontrolarchivecurrentreadinglibrarylimitedmanagerfurthersummarymachineminutesprivatecontextprogramsocietynumberswrittenenabledtriggersourcesloadingelementpartnerfinallyperfectmeaningsystemskeepingculture&quot;,journalprojectsurfaces&quot;expiresreviewsbalanceEnglishContentthroughPlease opinioncontactaverageprimaryvillageSpanishgallerydeclinemeetingmissionpopularqualitymeasuregeneralspeciessessionsectionwriterscounterinitialreportsfiguresmembersholdingdisputeearlierexpressdigitalpictureAnothermarriedtrafficleadingchangedcentralvictoryimages/reasonsstudiesfeaturelistingmust beschoolsVersionusuallyepisodeplayinggrowingobviousoverlaypresentactions</ul>
+wrapperalreadycertainrealitystorageanotherdesktopofferedpatternunusualDigitalcapitalWebsitefailureconnectreducedAndroiddecadesregular &amp; animalsreleaseAutomatgettingmethodsnothingPopularcaptionletterscapturesciencelicensechangesEngland=1&amp;History = new CentralupdatedSpecialNetworkrequirecommentwarningCollegetoolbarremainsbecauseelectedDeutschfinanceworkersquicklybetweenexactlysettingdiseaseSocietyweaponsexhibit&lt;!--Controlclassescoveredoutlineattacksdevices(windowpurposetitle="Mobile killingshowingItaliandroppedheavilyeffects-1']);
+confirmCurrentadvancesharingopeningdrawingbillionorderedGermanyrelated</form>includewhetherdefinedSciencecatalogArticlebuttonslargestuniformjourneysidebarChicagoholidayGeneralpassage,&quot;animatefeelingarrivedpassingnaturalroughly.
+
+The but notdensityBritainChineselack oftributeIreland" data-factorsreceivethat isLibraryhusbandin factaffairsCharlesradicalbroughtfindinglanding:lang="return leadersplannedpremiumpackageAmericaEdition]&quot;Messageneed tovalue="complexlookingstationbelievesmaller-mobilerecordswant tokind ofFirefoxyou aresimilarstudiedmaximumheadingrapidlyclimatekingdomemergedamountsfoundedpioneerformuladynastyhow to SupportrevenueeconomyResultsbrothersoldierlargelycalling.&quot;AccountEdward segmentRobert effortsPacificlearnedup withheight:we haveAngelesnations_searchappliedacquiremassivegranted: falsetreatedbiggestbenefitdrivingStudiesminimumperhapsmorningsellingis usedreversevariant role="missingachievepromotestudentsomeoneextremerestorebottom:evolvedall thesitemapenglishway to AugustsymbolsCompanymattersmusicalagainstserving})();
+paymenttroubleconceptcompareparentsplayersregionsmonitor ''The winningexploreadaptedGalleryproduceabilityenhancecareers). The collectSearch ancientexistedfooter handlerprintedconsoleEasternexportswindowsChannelillegalneutralsuggest_headersigning.html">settledwesterncausing-webkitclaimedJusticechaptervictimsThomas mozillapromisepartieseditionoutside:false,hundredOlympic_buttonauthorsreachedchronicdemandssecondsprotectadoptedprepareneithergreatlygreateroverallimprovecommandspecialsearch.worshipfundingthoughthighestinsteadutilityquarterCulturetestingclearlyexposedBrowserliberal} catchProjectexamplehide();FloridaanswersallowedEmperordefenseseriousfreedomSeveral-buttonFurtherout of != nulltrainedDenmarkvoid(0)/all.jspreventRequestStephen
+
+When observe</h2>
+Modern provide" alt="borders.
+
+For
+
+Many artistspoweredperformfictiontype ofmedicalticketsopposedCouncilwitnessjusticeGeorge Belgium...</a>twitternotablywaitingwarfare Other rankingphrasesmentionsurvivescholar</p>
+ Countryignoredloss ofjust asGeorgiastrange<head><stopped1']);
+islandsnotableborder:list ofcarried100,000</h3>
+ severalbecomesselect wedding00.htmlmonarchoff theteacherhighly biologylife ofor evenrise of&raquo;plusonehunting(thoughDouglasjoiningcirclesFor theAncientVietnamvehiclesuch ascrystalvalue =Windowsenjoyeda smallassumed<a id="foreign All rihow theDisplayretiredhoweverhidden;battlesseekingcabinetwas notlook atconductget theJanuaryhappensturninga:hoverOnline French lackingtypicalextractenemieseven ifgeneratdecidedare not/searchbeliefs-image:locatedstatic.login">convertviolententeredfirst">circuitFinlandchemistshe was10px;">as suchdivided</span>will beline ofa greatmystery/index.fallingdue to railwaycollegemonsterdescentit withnuclearJewish protestBritishflowerspredictreformsbutton who waslectureinstantsuicidegenericperiodsmarketsSocial fishingcombinegraphicwinners<br /><by the NaturalPrivacycookiesoutcomeresolveSwedishbrieflyPersianso muchCenturydepictscolumnshousingscriptsnext tobearingmappingrevisedjQuery(-width:title">tooltipSectiondesignsTurkishyounger.match(})();
+
+burningoperatedegreessource=Richardcloselyplasticentries</tr>
+color:#ul id="possessrollingphysicsfailingexecutecontestlink toDefault<br />
+: true,chartertourismclassicproceedexplain</h1>
+online.?xml vehelpingdiamonduse theairlineend -->).attr(readershosting#ffffffrealizeVincentsignals src="/ProductdespitediversetellingPublic held inJoseph theatreaffects<style>a largedoesn'tlater, ElementfaviconcreatorHungaryAirportsee theso thatMichaelSystemsPrograms, and width=e&quot;tradingleft">
+personsGolden Affairsgrammarformingdestroyidea ofcase ofoldest this is.src = cartoonregistrCommonsMuslimsWhat isin manymarkingrevealsIndeed,equally/show_aoutdoorescape(Austriageneticsystem,In the sittingHe alsoIslandsAcademy
+ <!--Daniel bindingblock">imposedutilizeAbraham(except{width:putting).html(|| [];
+DATA[ *kitchenmountedactual dialectmainly _blank'installexpertsif(typeIt also&copy; ">Termsborn inOptionseasterntalkingconcerngained ongoingjustifycriticsfactoryits ownassaultinvitedlastinghis ownhref="/" rel="developconcertdiagramdollarsclusterphp?id=alcohol);})();using a><span>vesselsrevivalAddressamateurandroidallegedillnesswalkingcentersqualifymatchesunifiedextinctDefensedied in
+ <!-- customslinkingLittle Book ofeveningmin.js?are thekontakttoday's.html" target=wearingAll Rig;
+})();raising Also, crucialabout">declare-->
+<scfirefoxas muchappliesindex, s, but type =
+
+<!--towardsRecordsPrivateForeignPremierchoicesVirtualreturnsCommentPoweredinline;povertychamberLiving volumesAnthonylogin" RelatedEconomyreachescuttinggravitylife inChapter-shadowNotable</td>
+ returnstadiumwidgetsvaryingtravelsheld bywho arework infacultyangularwho hadairporttown of
+
+Some 'click'chargeskeywordit willcity of(this);Andrew unique checkedor more300px; return;rsion="pluginswithin herselfStationFederalventurepublishsent totensionactresscome tofingersDuke ofpeople,exploitwhat isharmonya major":"httpin his menu">
+monthlyofficercouncilgainingeven inSummarydate ofloyaltyfitnessand wasemperorsupremeSecond hearingRussianlongestAlbertalateralset of small">.appenddo withfederalbank ofbeneathDespiteCapitalgrounds), and percentit fromclosingcontainInsteadfifteenas well.yahoo.respondfighterobscurereflectorganic= Math.editingonline paddinga wholeonerroryear ofend of barrierwhen itheader home ofresumedrenamedstrong>heatingretainscloudfrway of March 1knowingin partBetweenlessonsclosestvirtuallinks">crossedEND -->famous awardedLicenseHealth fairly wealthyminimalAfricancompetelabel">singingfarmersBrasil)discussreplaceGregoryfont copursuedappearsmake uproundedboth ofblockedsaw theofficescoloursif(docuwhen heenforcepush(fuAugust UTF-8">Fantasyin mostinjuredUsuallyfarmingclosureobject defenceuse of Medical<body>
+evidentbe usedkeyCodesixteenIslamic#000000entire widely active (typeofone cancolor =speakerextendsPhysicsterrain<tbody>funeralviewingmiddle cricketprophetshifteddoctorsRussell targetcompactalgebrasocial-bulk ofman and</td>
+ he left).val()false);logicalbankinghome tonaming Arizonacredits);
+});
+founderin turnCollinsbefore But thechargedTitle">CaptainspelledgoddessTag -->Adding:but wasRecent patientback in=false&Lincolnwe knowCounterJudaismscript altered']);
+ has theunclearEvent',both innot all
+
+<!-- placinghard to centersort ofclientsstreetsBernardassertstend tofantasydown inharbourFreedomjewelry/about..searchlegendsis mademodern only ononly toimage" linear painterand notrarely acronymdelivershorter00&amp;as manywidth="/* <![Ctitle =of the lowest picked escapeduses ofpeoples PublicMatthewtacticsdamagedway forlaws ofeasy to windowstrong simple}catch(seventhinfoboxwent topaintedcitizenI don'tretreat. Some ww.");
+bombingmailto:made in. Many carries||{};wiwork ofsynonymdefeatsfavoredopticalpageTraunless sendingleft"><comScorAll thejQuery.touristClassicfalse" Wilhelmsuburbsgenuinebishops.split(global followsbody ofnominalContactsecularleft tochiefly-hidden-banner</li>
+
+. When in bothdismissExplorealways via thespañolwelfareruling arrangecaptainhis sonrule ofhe tookitself,=0&amp;(calledsamplesto makecom/pagMartin Kennedyacceptsfull ofhandledBesides//--></able totargetsessencehim to its by common.mineralto takeways tos.org/ladvisedpenaltysimple:if theyLettersa shortHerbertstrikes groups.lengthflightsoverlapslowly lesser social </p>
+ it intoranked rate oful>
+ attemptpair ofmake itKontaktAntoniohaving ratings activestreamstrapped").css(hostilelead tolittle groups,Picture-->
+
+ rows=" objectinverse<footerCustomV><\/scrsolvingChamberslaverywoundedwhereas!= 'undfor allpartly -right:Arabianbacked centuryunit ofmobile-Europe,is homerisk ofdesiredClintoncost ofage of become none ofp&quot;Middle ead')[0Criticsstudios>&copy;group">assemblmaking pressedwidget.ps:" ? rebuiltby someFormer editorsdelayedCanonichad thepushingclass="but arepartialBabylonbottom carrierCommandits useAs withcoursesa thirddenotesalso inHouston20px;">accuseddouble goal ofFamous ).bind(priests Onlinein Julyst + "gconsultdecimalhelpfulrevivedis veryr'+'iptlosing femalesis alsostringsdays ofarrivalfuture <objectforcingString(" />
+ here isencoded. The balloondone by/commonbgcolorlaw of Indianaavoidedbut the2px 3pxjquery.after apolicy.men andfooter-= true;for usescreen.Indian image =family,http:// &nbsp;driverseternalsame asnoticedviewers})();
+ is moreseasonsformer the newis justconsent Searchwas thewhy theshippedbr><br>width: height=made ofcuisineis thata very Admiral fixed;normal MissionPress, ontariocharsettry to invaded="true"spacingis mosta more totallyfall of});
+ immensetime inset outsatisfyto finddown tolot of Playersin Junequantumnot thetime todistantFinnishsrc = (single help ofGerman law andlabeledforestscookingspace">header-well asStanleybridges/globalCroatia About [0];
+ it, andgroupedbeing a){throwhe madelighterethicalFFFFFF"bottom"like a employslive inas seenprintermost ofub-linkrejectsand useimage">succeedfeedingNuclearinformato helpWomen'sNeitherMexicanprotein<table by manyhealthylawsuitdevised.push({sellerssimply Through.cookie Image(older">us.js"> Since universlarger open to!-- endlies in']);
+ marketwho is ("DOMComanagedone fortypeof Kingdomprofitsproposeto showcenter;made itdressedwere inmixtureprecisearisingsrc = 'make a securedBaptistvoting
+ var March 2grew upClimate.removeskilledway the</head>face ofacting right">to workreduceshas haderectedshow();action=book ofan area== "htt<header
+<html>conformfacing cookie.rely onhosted .customhe wentbut forspread Family a meansout theforums.footage">MobilClements" id="as highintense--><!--female is seenimpliedset thea stateand hisfastestbesidesbutton_bounded"><img Infoboxevents,a youngand areNative cheaperTimeoutand hasengineswon the(mostlyright: find a -bottomPrince area ofmore ofsearch_nature,legallyperiod,land ofor withinducedprovingmissilelocallyAgainstthe wayk&quot;px;">
+pushed abandonnumeralCertainIn thismore inor somename isand, incrownedISBN 0-createsOctobermay notcenter late inDefenceenactedwish tobroadlycoolingonload=it. TherecoverMembersheight assumes<html>
+people.in one =windowfooter_a good reklamaothers,to this_cookiepanel">London,definescrushedbaptismcoastalstatus title" move tolost inbetter impliesrivalryservers SystemPerhapses and contendflowinglasted rise inGenesisview ofrising seem tobut in backinghe willgiven agiving cities.flow of Later all butHighwayonly bysign ofhe doesdiffersbattery&amp;lasinglesthreatsintegertake onrefusedcalled =US&ampSee thenativesby thissystem.head of:hover,lesbiansurnameand allcommon/header__paramsHarvard/pixel.removalso longrole ofjointlyskyscraUnicodebr />
+AtlantanucleusCounty,purely count">easily build aonclicka givenpointerh&quot;events else {
+ditionsnow the, with man whoorg/Webone andcavalryHe diedseattle00,000 {windowhave toif(windand itssolely m&quot;renewedDetroitamongsteither them inSenatorUs</a><King ofFrancis-produche usedart andhim andused byscoringat hometo haverelatesibilityfactionBuffalolink"><what hefree toCity ofcome insectorscountedone daynervoussquare };if(goin whatimg" alis onlysearch/tuesdaylooselySolomonsexual - <a hrmedium"DO NOT France,with a war andsecond take a >
+
+
+market.highwaydone inctivity"last">obligedrise to"undefimade to Early praisedin its for hisathleteJupiterYahoo! termed so manyreally s. The a woman?value=direct right" bicycleacing="day andstatingRather,higher Office are nowtimes, when a pay foron this-link">;borderaround annual the Newput the.com" takin toa brief(in thegroups.; widthenzymessimple in late{returntherapya pointbanninginks">
+();" rea place\u003Caabout atr>
+ ccount gives a<SCRIPTRailwaythemes/toolboxById("xhumans,watchesin some if (wicoming formats Under but hashanded made bythan infear ofdenoted/iframeleft involtagein eacha&quot;base ofIn manyundergoregimesaction </p>
+<ustomVa;&gt;</importsor thatmostly &amp;re size="</a></ha classpassiveHost = WhetherfertileVarious=[];(fucameras/></td>acts asIn some>
+
+<!organis <br />Beijingcatalàdeutscheuropeueuskaragaeilgesvenskaespañamensajeusuariotrabajoméxicopáginasiempresistemaoctubreduranteañadirempresamomentonuestroprimeratravésgraciasnuestraprocesoestadoscalidadpersonanúmeroacuerdomúsicamiembroofertasalgunospaísesejemploderechoademásprivadoagregarenlacesposiblehotelessevillaprimeroúltimoeventosarchivoculturamujeresentradaanuncioembargomercadograndesestudiomejoresfebrerodiseñoturismocódigoportadaespaciofamiliaantoniopermiteguardaralgunaspreciosalguiensentidovisitastítuloconocersegundoconsejofranciaminutossegundatenemosefectosmálagasesiónrevistagranadacompraringresogarcíaacciónecuadorquienesinclusodeberámateriahombresmuestrapodríamañanaúltimaestamosoficialtambienningúnsaludospodemosmejorarpositionbusinesshomepagesecuritylanguagestandardcampaignfeaturescategoryexternalchildrenreservedresearchexchangefavoritetemplatemilitaryindustryservicesmaterialproductsz-index:commentssoftwarecompletecalendarplatformarticlesrequiredmovementquestionbuildingpoliticspossiblereligionphysicalfeedbackregisterpicturesdisabledprotocolaudiencesettingsactivityelementslearninganythingabstractprogressoverviewmagazineeconomictrainingpressurevarious <strong>propertyshoppingtogetheradvancedbehaviordownloadfeaturedfootballselectedLanguagedistanceremembertrackingpasswordmodifiedstudentsdirectlyfightingnortherndatabasefestivalbreakinglocationinternetdropdownpracticeevidencefunctionmarriageresponseproblemsnegativeprogramsanalysisreleasedbanner">purchasepoliciesregionalcreativeargumentbookmarkreferrerchemicaldivisioncallbackseparateprojectsconflicthardwareinterestdeliverymountainobtained= false;for(var acceptedcapacitycomputeridentityaircraftemployedproposeddomesticincludesprovidedhospitalverticalcollapseapproachpartnerslogo"><adaughterauthor" culturalfamilies/images/assemblypowerfulteachingfinisheddistrictcriticalcgi-bin/purposesrequireselectionbecomingprovidesacademicexerciseactuallymedicineconstantaccidentMagazinedocumentstartingbottom">observed: &quot;extendedpreviousSoftwarecustomerdecisionstrengthdetailedslightlyplanningtextareacurrencyeveryonestraighttransferpositiveproducedheritageshippingabsolutereceivedrelevantbutton" violenceanywherebenefitslaunchedrecentlyalliancefollowedmultiplebulletinincludedoccurredinternal$(this).republic><tr><tdcongressrecordedultimatesolution<ul id="discoverHome</a>websitesnetworksalthoughentirelymemorialmessagescontinueactive">somewhatvictoriaWestern title="LocationcontractvisitorsDownloadwithout right">
+measureswidth = variableinvolvedvirginianormallyhappenedaccountsstandingnationalRegisterpreparedcontrolsaccuratebirthdaystrategyofficialgraphicscriminalpossiblyconsumerPersonalspeakingvalidateachieved.jpg" />machines</h2>
+ keywordsfriendlybrotherscombinedoriginalcomposedexpectedadequatepakistanfollow" valuable</label>relativebringingincreasegovernorplugins/List of Header">" name=" (&quot;graduate</head>
+commercemalaysiadirectormaintain;height:schedulechangingback to catholicpatternscolor: #greatestsuppliesreliable</ul>
+ <select citizensclothingwatching<li id="specificcarryingsentence<center>contrastthinkingcatch(e)southernMichael merchantcarouselpadding:interior.split("lizationOctober ){returnimproved--&gt;
+
+coveragechairman.png" />subjectsRichard whateverprobablyrecoverybaseballjudgmentconnect..css" /> websitereporteddefault"/></a>
+electricscotlandcreationquantity. ISBN 0did not instance-search-" lang="speakersComputercontainsarchivesministerreactiondiscountItalianocriteriastrongly: 'http:'script'coveringofferingappearedBritish identifyFacebooknumerousvehiclesconcernsAmericanhandlingdiv id="William provider_contentaccuracysection andersonflexibleCategorylawrence<script>layout="approved maximumheader"></table>Serviceshamiltoncurrent canadianchannels/themes//articleoptionalportugalvalue=""intervalwirelessentitledagenciesSearch" measuredthousandspending&hellip;new Date" size="pageNamemiddle" " /></a>hidden">sequencepersonaloverflowopinionsillinoislinks">
+ <title>versionssaturdayterminalitempropengineersectionsdesignerproposal="false"Españolreleasessubmit" er&quot;additionsymptomsorientedresourceright"><pleasurestationshistory.leaving border=contentscenter">.
+
+Some directedsuitablebulgaria.show();designedGeneral conceptsExampleswilliamsOriginal"><span>search">operatorrequestsa &quot;allowingDocumentrevision.
+
+The yourselfContact michiganEnglish columbiapriorityprintingdrinkingfacilityreturnedContent officersRussian generate-8859-1"indicatefamiliar qualitymargin:0 contentviewportcontacts-title">portable.length eligibleinvolvesatlanticonload="default.suppliedpaymentsglossary
+
+After guidance</td><tdencodingmiddle">came to displaysscottishjonathanmajoritywidgets.clinicalthailandteachers<head>
+ affectedsupportspointer;toString</small>oklahomawill be investor0" alt="holidaysResourcelicensed (which . After considervisitingexplorerprimary search" android"quickly meetingsestimate;return ;color:# height=approval, &quot; checked.min.js"magnetic></a></hforecast. While thursdaydvertise&eacute;hasClassevaluateorderingexistingpatients Online coloradoOptions"campbell<!-- end</span><<br />
+_popups|sciences,&quot; quality Windows assignedheight: <b classle&quot; value=" Companyexamples<iframe believespresentsmarshallpart of properly).
+
+The taxonomymuch of </span>
+" data-srtuguêsscrollTo project<head>
+attorneyemphasissponsorsfancyboxworld's wildlifechecked=sessionsprogrammpx;font- Projectjournalsbelievedvacationthompsonlightingand the special border=0checking</tbody><button Completeclearfix
+<head>
+article <sectionfindingsrole in popular Octoberwebsite exposureused to changesoperatedclickingenteringcommandsinformed numbers </div>creatingonSubmitmarylandcollegesanalyticlistingscontact.loggedInadvisorysiblingscontent"s&quot;)s. This packagescheckboxsuggestspregnanttomorrowspacing=icon.pngjapanesecodebasebutton">gamblingsuch as , while </span> missourisportingtop:1px .</span>tensionswidth="2lazyloadnovemberused in height="cript">
+&nbsp;</<tr><td height:2/productcountry include footer" &lt;!-- title"></jquery.</form>
+(简体)(ç¹é«”)hrvatskiitalianoromânătürkçeاردوtambiénnoticiasmensajespersonasderechosnacionalserviciocontactousuariosprogramagobiernoempresasanunciosvalenciacolombiadespuésdeportesproyectoproductopúbliconosotroshistoriapresentemillonesmediantepreguntaanteriorrecursosproblemasantiagonuestrosopiniónimprimirmientrasaméricavendedorsociedadrespectorealizarregistropalabrasinterésentoncesespecialmiembrosrealidadcórdobazaragozapáginassocialesbloqueargestiónalquilersistemascienciascompletoversióncompletaestudiospúblicaobjetivoalicantebuscadorcantidadentradasaccionesarchivossuperiormayoríaalemaniafunciónúltimoshaciendoaquellosediciónfernandoambientefacebooknuestrasclientesprocesosbastantepresentareportarcongresopublicarcomerciocontratojóvenesdistritotécnicaconjuntoenergíatrabajarasturiasrecienteutilizarboletínsalvadorcorrectatrabajosprimerosnegocioslibertaddetallespantallapróximoalmeríaanimalesquiénescorazónsecciónbuscandoopcionesexteriorconceptotodavíagaleríaescribirmedicinalicenciaconsultaaspectoscríticadólaresjusticiadeberánperíodonecesitamantenerpequeñorecibidatribunaltenerifecancióncanariasdescargadiversosmallorcarequieretécnicodeberíaviviendafinanzasadelantefuncionaconsejosdifícilciudadesantiguasavanzadatérminounidadessánchezcampañasoftonicrevistascontienesectoresmomentosfacultadcréditodiversassupuestofactoressegundospequeñaгодаеÑлиеÑтьбылобытьÑтомЕÑлитогоменÑвÑехÑтойдажебылигодуденьÑтотбылаÑебÑодинÑебенадоÑайтфотонегоÑвоиÑвойигрытожевÑемÑвоюлишьÑтихпокаднейдомамиралиботемухотÑдвухÑетилюдиделомиретебÑÑвоевидечегоÑтимÑчеттемыценыÑталведьтемеводытебевышенамитипатомуправлицаоднагодызнаюмогудругвÑейидеткиноодноделаделеÑрокиюнÑвеÑьЕÑтьразанашиاللهالتيجميعخاصةالذيعليهجديدالآنالردتحكمصÙحةكانتاللييكونشبكةÙيهابناتحواءأكثرخلالالحبدليلدروساضغطتكونهناكساحةناديالطبعليكشكرايمكنمنهاشركةرئيسنشيطماذاالÙنشبابتعبررحمةكاÙةيقولمركزكلمةأحمدقلبييعنيصورةطريقشاركجوالأخرىمعناابحثعروضبشكلمسجلبنانخالدكتابكليةبدونأيضايوجدÙريقكتبتأÙضلمطبخاكثرباركاÙضلاحلىنÙسهأيامردودأنهاديناالانمعرضتعلمداخلممكن
+ 
+ ÿÿÿÿ
+statementattentionBiography} else {
+solutionswhen the Analyticstemplatesdangeroussatellitedocumentspublisherimportantprototypeinfluence&raquo;</effectivegenerallytransformbeautifultransportorganizedpublishedprominentuntil thethumbnailNational .focus();over the migrationannouncedfooter">
+exceptionless thanexpensiveformationframeworkterritoryndicationcurrentlyclassNamecriticismtraditionelsewhereAlexanderappointedmaterialsbroadcastmentionedaffiliate</option>treatmentdifferent/default.Presidentonclick="biographyotherwisepermanentFrançaisHollywoodexpansionstandards</style>
+reductionDecember preferredCambridgeopponentsBusiness confusion>
+<title>presentedexplaineddoes not worldwideinterfacepositionsnewspaper</table>
+mountainslike the essentialfinancialselectionaction="/abandonedEducationparseInt(stabilityunable to</title>
+relationsNote thatefficientperformedtwo yearsSince thethereforewrapper">alternateincreasedBattle ofperceivedtrying tonecessaryportrayedelectionsElizabeth</iframe>discoveryinsurances.length;legendaryGeographycandidatecorporatesometimesservices.inherited</strong>CommunityreligiouslocationsCommitteebuildingsthe worldno longerbeginningreferencecannot befrequencytypicallyinto the relative;recordingpresidentinitiallytechniquethe otherit can beexistenceunderlinethis timetelephoneitemscopepracticesadvantage);return For otherprovidingdemocracyboth the extensivesufferingsupportedcomputers functionpracticalsaid thatit may beEnglish</from the scheduleddownloads</label>
+suspectedmargin: 0spiritual</head>
+
+microsoftgraduallydiscussedhe becameexecutivejquery.jshouseholdconfirmedpurchasedliterallydestroyedup to thevariationremainingit is notcenturiesJapanese among thecompletedalgorithminterestsrebellionundefinedencourageresizableinvolvingsensitiveuniversalprovision(althoughfeaturingconducted), which continued-header">February numerous overflow:componentfragmentsexcellentcolspan="technicalnear the Advanced source ofexpressedHong Kong Facebookmultiple mechanismelevationoffensive</form>
+ sponsoreddocument.or &quot;there arethose whomovementsprocessesdifficultsubmittedrecommendconvincedpromoting" width=".replace(classicalcoalitionhis firstdecisionsassistantindicatedevolution-wrapper"enough toalong thedelivered-->
+<!--American protectedNovember </style><furnitureInternet onblur="suspendedrecipientbased on Moreover,abolishedcollectedwere madeemotionalemergencynarrativeadvocatespx;bordercommitteddir="ltr"employeesresearch. selectedsuccessorcustomersdisplayedSeptemberaddClass(Facebook suggestedand lateroperatingelaborateSometimesInstitutecertainlyinstalledfollowersJerusalemthey havecomputinggeneratedprovincesguaranteearbitraryrecognizewanted topx;width:theory ofbehaviourWhile theestimatedbegan to it becamemagnitudemust havemore thanDirectoryextensionsecretarynaturallyoccurringvariablesgiven theplatform.</label><failed tocompoundskinds of societiesalongside --&gt;
+
+southwestthe rightradiationmay have unescape(spoken in" href="/programmeonly the come fromdirectoryburied ina similarthey were</font></Norwegianspecifiedproducingpassenger(new DatetemporaryfictionalAfter theequationsdownload.regularlydeveloperabove thelinked tophenomenaperiod oftooltip">substanceautomaticaspect ofAmong theconnectedestimatesAir Forcesystem ofobjectiveimmediatemaking itpaintingsconqueredare stillproceduregrowth ofheaded byEuropean divisionsmoleculesfranchiseintentionattractedchildhoodalso useddedicatedsingaporedegree offather ofconflicts</a></p>
+came fromwere usednote thatreceivingExecutiveeven moreaccess tocommanderPoliticalmusiciansdeliciousprisonersadvent ofUTF-8" /><![CDATA[">ContactSouthern bgcolor="series of. It was in Europepermittedvalidate.appearingofficialsseriously-languageinitiatedextendinglong-terminflationsuch thatgetCookiemarked by</button>implementbut it isincreasesdown the requiringdependent-->
+<!-- interviewWith the copies ofconsensuswas builtVenezuela(formerlythe statepersonnelstrategicfavour ofinventionWikipediacontinentvirtuallywhich wasprincipleComplete identicalshow thatprimitiveaway frommolecularpreciselydissolvedUnder theversion=">&nbsp;</It is the This is will haveorganismssome timeFriedrichwas firstthe only fact thatform id="precedingTechnicalphysicistoccurs innavigatorsection">span id="sought tobelow thesurviving}</style>his deathas in thecaused bypartiallyexisting using thewas givena list oflevels ofnotion ofOfficial dismissedscientistresemblesduplicateexplosiverecoveredall othergalleries{padding:people ofregion ofaddressesassociateimg alt="in modernshould bemethod ofreportingtimestampneeded tothe Greatregardingseemed toviewed asimpact onidea thatthe Worldheight ofexpandingThese arecurrent">carefullymaintainscharge ofClassicaladdressedpredictedownership<div id="right">
+residenceleave thecontent">are often })();
+probably Professor-button" respondedsays thathad to beplaced inHungarianstatus ofserves asUniversalexecutionaggregatefor whichinfectionagreed tohowever, popular">placed onconstructelectoralsymbol ofincludingreturn toarchitectChristianprevious living ineasier toprofessor
+&lt;!-- effect ofanalyticswas takenwhere thetook overbelief inAfrikaansas far aspreventedwork witha special<fieldsetChristmasRetrieved
+
+In the back intonortheastmagazines><strong>committeegoverninggroups ofstored inestablisha generalits firsttheir ownpopulatedan objectCaribbeanallow thedistrictswisconsinlocation.; width: inhabitedSocialistJanuary 1</footer>similarlychoice ofthe same specific business The first.length; desire todeal withsince theuserAgentconceivedindex.phpas &quot;engage inrecently,few yearswere also
+<head>
+<edited byare knowncities inaccesskeycondemnedalso haveservices,family ofSchool ofconvertednature of languageministers</object>there is a popularsequencesadvocatedThey wereany otherlocation=enter themuch morereflectedwas namedoriginal a typicalwhen theyengineerscould notresidentswednesdaythe third productsJanuary 2what theya certainreactionsprocessorafter histhe last contained"></div>
+</a></td>depend onsearch">
+pieces ofcompetingReferencetennesseewhich has version=</span> <</header>gives thehistorianvalue="">padding:0view thattogether,the most was foundsubset ofattack onchildren,points ofpersonal position:allegedlyClevelandwas laterand afterare givenwas stillscrollingdesign ofmakes themuch lessAmericans.
+
+After , but theMuseum oflouisiana(from theminnesotaparticlesa processDominicanvolume ofreturningdefensive00px|righmade frommouseover" style="states of(which iscontinuesFranciscobuilding without awith somewho woulda form ofa part ofbefore itknown as Serviceslocation and oftenmeasuringand it ispaperbackvalues of
+<title>= window.determineer&quot; played byand early</center>from thisthe threepower andof &quot;innerHTML<a href="y:inline;Church ofthe eventvery highofficial -height: content="/cgi-bin/to createafrikaansesperantofrançaislatvieÅ¡ulietuviųČeÅ¡tinaÄeÅ¡tinaไทย日本語简体字ç¹é«”字한국어为什么计算机笔记本討論å€æœåŠ¡å™¨äº’è”网房地产俱ä¹éƒ¨å‡ºç‰ˆç¤¾æŽ’行榜部è½æ ¼è¿›ä¸€æ­¥æ”¯ä»˜å®éªŒè¯ç å§”员会数æ®åº“消费者办公室讨论区深圳市播放器北京市大学生越æ¥è¶Šç®¡ç†å‘˜ä¿¡æ¯ç½‘serviciosartículoargentinabarcelonacualquierpublicadoproductospolíticarespuestawikipediasiguientebúsquedacomunidadseguridadprincipalpreguntascontenidorespondervenezuelaproblemasdiciembrerelaciónnoviembresimilaresproyectosprogramasinstitutoactividadencuentraeconomíaimágenescontactardescargarnecesarioatenciónteléfonocomisióncancionescapacidadencontraranálisisfavoritostérminosprovinciaetiquetaselementosfuncionesresultadocarácterpropiedadprincipionecesidadmunicipalcreacióndescargaspresenciacomercialopinionesejercicioeditorialsalamancagonzálezdocumentopelícularecientesgeneralestarragonaprácticanovedadespropuestapacientestécnicasobjetivoscontactosमेंलिà¤à¤¹à¥ˆà¤‚गयासाथà¤à¤µà¤‚रहेकोईकà¥à¤›à¤°à¤¹à¤¾à¤¬à¤¾à¤¦à¤•à¤¹à¤¾à¤¸à¤­à¥€à¤¹à¥à¤à¤°à¤¹à¥€à¤®à¥ˆà¤‚दिनबातdiplodocsसमयरूपनामपताफिरऔसततरहलोगहà¥à¤†à¤¬à¤¾à¤°à¤¦à¥‡à¤¶à¤¹à¥à¤ˆà¤–ेलयदिकामवेबतीनबीचमौतसाललेखजॉबमददतथानहीशहरअलगकभीनगरपासरातकिà¤à¤‰à¤¸à¥‡à¤—यीहूà¤à¤†à¤—ेटीमखोजकारअभीगयेतà¥à¤®à¤µà¥‹à¤Ÿà¤¦à¥‡à¤‚अगरà¤à¤¸à¥‡à¤®à¥‡à¤²à¤²à¤—ाहालऊपरचारà¤à¤¸à¤¾à¤¦à¥‡à¤°à¤œà¤¿à¤¸à¤¦à¤¿à¤²à¤¬à¤‚दबनाहूंलाखजीतबटनमिलइसेआनेनयाकà¥à¤²à¤²à¥‰à¤—भागरेलजगहरामलगेपेजहाथइसीसहीकलाठीकहाà¤à¤¦à¥‚रतहतसातयादआयापाककौनशामदेखयहीरायखà¥à¤¦à¤²à¤—ीcategoriesexperience</title>
+Copyright javascriptconditionseverything<p class="technologybackground<a class="management&copy; 201javaScriptcharactersbreadcrumbthemselveshorizontalgovernmentCaliforniaactivitiesdiscoveredNavigationtransitionconnectionnavigationappearance</title><mcheckbox" techniquesprotectionapparentlyas well asunt', 'UA-resolutionoperationstelevisiontranslatedWashingtonnavigator. = window.impression&lt;br&gt;literaturepopulationbgcolor="#especially content="productionnewsletterpropertiesdefinitionleadershipTechnologyParliamentcomparisonul class=".indexOf("conclusiondiscussioncomponentsbiologicalRevolution_containerunderstoodnoscript><permissioneach otheratmosphere onfocus="<form id="processingthis.valuegenerationConferencesubsequentwell-knownvariationsreputationphenomenondisciplinelogo.png" (document,boundariesexpressionsettlementBackgroundout of theenterprise("https:" unescape("password" democratic<a href="/wrapper">
+membershiplinguisticpx;paddingphilosophyassistanceuniversityfacilitiesrecognizedpreferenceif (typeofmaintainedvocabularyhypothesis.submit();&amp;nbsp;annotationbehind theFoundationpublisher"assumptionintroducedcorruptionscientistsexplicitlyinstead ofdimensions onClick="considereddepartmentoccupationsoon afterinvestmentpronouncedidentifiedexperimentManagementgeographic" height="link rel=".replace(/depressionconferencepunishmenteliminatedresistanceadaptationoppositionwell knownsupplementdeterminedh1 class="0px;marginmechanicalstatisticscelebratedGovernment
+
+During tdevelopersartificialequivalentoriginatedCommissionattachment<span id="there wereNederlandsbeyond theregisteredjournalistfrequentlyall of thelang="en" </style>
+absolute; supportingextremely mainstream</strong> popularityemployment</table>
+ colspan="</form>
+ conversionabout the </p></div>integrated" lang="enPortuguesesubstituteindividualimpossiblemultimediaalmost allpx solid #apart fromsubject toin Englishcriticizedexcept forguidelinesoriginallyremarkablethe secondh2 class="<a title="(includingparametersprohibited= "http://dictionaryperceptionrevolutionfoundationpx;height:successfulsupportersmillenniumhis fatherthe &quot;no-repeat;commercialindustrialencouragedamount of unofficialefficiencyReferencescoordinatedisclaimerexpeditiondevelopingcalculatedsimplifiedlegitimatesubstring(0" class="completelyillustratefive yearsinstrumentPublishing1" class="psychologyconfidencenumber of absence offocused onjoined thestructurespreviously></iframe>once againbut ratherimmigrantsof course,a group ofLiteratureUnlike the</a>&nbsp;
+function it was theConventionautomobileProtestantaggressiveafter the Similarly," /></div>collection
+functionvisibilitythe use ofvolunteersattractionunder the threatened*<![CDATA[importancein generalthe latter</form>
+</.indexOf('i = 0; i <differencedevoted totraditionssearch forultimatelytournamentattributesso-called }
+</style>evaluationemphasizedaccessible</section>successionalong withMeanwhile,industries</a><br />has becomeaspects ofTelevisionsufficientbasketballboth sidescontinuingan article<img alt="adventureshis mothermanchesterprinciplesparticularcommentaryeffects ofdecided to"><strong>publishersJournal ofdifficultyfacilitateacceptablestyle.css" function innovation>Copyrightsituationswould havebusinessesDictionarystatementsoften usedpersistentin Januarycomprising</title>
+ diplomaticcontainingperformingextensionsmay not beconcept of onclick="It is alsofinancial making theLuxembourgadditionalare calledengaged in"script");but it waselectroniconsubmit="
+<!-- End electricalofficiallysuggestiontop of theunlike theAustralianOriginallyreferences
+</head>
+recognisedinitializelimited toAlexandriaretirementAdventuresfour years
+
+&lt;!-- increasingdecorationh3 class="origins ofobligationregulationclassified(function(advantagesbeing the historians<base hrefrepeatedlywilling tocomparabledesignatednominationfunctionalinside therevelationend of thes for the authorizedrefused totake placeautonomouscompromisepolitical restauranttwo of theFebruary 2quality ofswfobject.understandnearly allwritten byinterviews" width="1withdrawalfloat:leftis usuallycandidatesnewspapersmysteriousDepartmentbest knownparliamentsuppressedconvenientremembereddifferent systematichas led topropagandacontrolledinfluencesceremonialproclaimedProtectionli class="Scientificclass="no-trademarksmore than widespreadLiberationtook placeday of theas long asimprisonedAdditional
+<head>
+<mLaboratoryNovember 2exceptionsIndustrialvariety offloat: lefDuring theassessmenthave been deals withStatisticsoccurrence/ul></div>clearfix">the publicmany yearswhich wereover time,synonymouscontent">
+presumablyhis familyuserAgent.unexpectedincluding challengeda minorityundefined"belongs totaken fromin Octoberposition: said to bereligious Federation rowspan="only a fewmeant thatled to the-->
+<div <fieldset>Archbishop class="nobeing usedapproachesprivilegesnoscript>
+results inmay be theEaster eggmechanismsreasonablePopulationCollectionselected">noscript> /index.phparrival of-jssdk'));managed toincompletecasualtiescompletionChristiansSeptember arithmeticproceduresmight haveProductionit appearsPhilosophyfriendshipleading togiving thetoward theguaranteeddocumentedcolor:#000video gamecommissionreflectingchange theassociatedsans-serifonkeypress; padding:He was theunderlyingtypically , and the srcElementsuccessivesince the should be networkingaccountinguse of thelower thanshows that</span>
+ complaintscontinuousquantitiesastronomerhe did notdue to itsapplied toan averageefforts tothe futureattempt toTherefore,capabilityRepublicanwas formedElectronickilometerschallengespublishingthe formerindigenousdirectionssubsidiaryconspiracydetails ofand in theaffordablesubstancesreason forconventionitemtype="absolutelysupposedlyremained aattractivetravellingseparatelyfocuses onelementaryapplicablefound thatstylesheetmanuscriptstands for no-repeat(sometimesCommercialin Americaundertakenquarter ofan examplepersonallyindex.php?</button>
+percentagebest-knowncreating a" dir="ltrLieutenant
+<div id="they wouldability ofmade up ofnoted thatclear thatargue thatto anotherchildren'spurpose offormulatedbased uponthe regionsubject ofpassengerspossession.
+
+In the Before theafterwardscurrently across thescientificcommunity.capitalismin Germanyright-wingthe systemSociety ofpoliticiandirection:went on toremoval of New York apartmentsindicationduring theunless thehistoricalhad been adefinitiveingredientattendanceCenter forprominencereadyStatestrategiesbut in theas part ofconstituteclaim thatlaboratorycompatiblefailure of, such as began withusing the to providefeature offrom which/" class="geologicalseveral ofdeliberateimportant holds thating&quot; valign=topthe Germanoutside ofnegotiatedhis careerseparationid="searchwas calledthe fourthrecreationother thanpreventionwhile the education,connectingaccuratelywere builtwas killedagreementsmuch more Due to thewidth: 100some otherKingdom ofthe entirefamous forto connectobjectivesthe Frenchpeople andfeatured">is said tostructuralreferendummost oftena separate->
+<div id Official worldwide.aria-labelthe planetand it wasd" value="looking atbeneficialare in themonitoringreportedlythe modernworking onallowed towhere the innovative</a></div>soundtracksearchFormtend to beinput id="opening ofrestrictedadopted byaddressingtheologianmethods ofvariant ofChristian very largeautomotiveby far therange frompursuit offollow thebrought toin Englandagree thataccused ofcomes frompreventingdiv style=his or hertremendousfreedom ofconcerning0 1em 1em;Basketball/style.cssan earliereven after/" title=".com/indextaking thepittsburghcontent"> <script>(fturned outhaving the</span>
+ occasionalbecause itstarted tophysically></div>
+ created byCurrently, bgcolor="tabindex="disastrousAnalytics also has a><div id="</style>
+<called forsinger and.src = "//violationsthis pointconstantlyis locatedrecordingsd from thenederlandsportuguêsעבריתÙارسیdesarrollocomentarioeducaciónseptiembreregistradodirecciónubicaciónpublicidadrespuestasresultadosimportantereservadosartículosdiferentessiguientesrepúblicasituaciónministerioprivacidaddirectorioformaciónpoblaciónpresidentecontenidosaccesoriostechnoratipersonalescategoríaespecialesdisponibleactualidadreferenciavalladolidbibliotecarelacionescalendariopolíticasanterioresdocumentosnaturalezamaterialesdiferenciaeconómicatransporterodríguezparticiparencuentrandiscusiónestructurafundaciónfrecuentespermanentetotalmenteможнобудетможетвремÑтакжечтобыболееоченьÑтогокогдапоÑлевÑегоÑайтечерезмогутÑайтажизнимеждубудутПоиÑкздеÑьвидеоÑвÑзинужноÑвоейлюдейпорномногодетейÑвоихправатакоймеÑтоимеетжизньоднойлучшепередчаÑтичаÑтьработновыхправоÑобойпотомменеечиÑленовыеуÑлугоколоназадтакоетогдапочтиПоÑлетакиеновыйÑтоиттакихÑразуСанктфорумКогдакнигиÑлованашейнайтиÑвоимÑвÑзьлюбойчаÑтоÑредиКромеФорумрынкеÑталипоиÑктыÑÑчмеÑÑццентртрудаÑамыхрынкаÐовыйчаÑовмеÑтафильммартаÑтранмеÑтетекÑтнашихминутимениимеютномергородÑамомÑтомуконцеÑвоемкакойÐрхивمنتدىإرسالرسالةالعامكتبهابرامجاليومالصورجديدةالعضوإضاÙةالقسمالعابتحميلملÙاتملتقىتعديلالشعرأخبارتطويرعليكمإرÙاقطلباتاللغةترتيبالناسالشيخمنتديالعربالقصصاÙلامعليهاتحديثاللهمالعملمكتبةيمكنكالطÙÙ„ÙيديوإدارةتاريخالصحةتسجيلالوقتعندمامدينةتصميمأرشيÙالذينعربيةبوابةألعابالسÙرمشاكلتعالىالأولالسنةجامعةالصحÙالدينكلماتالخاصالملÙأعضاءكتابةالخيررسائلالقلبالأدبمقاطعمراسلمنطقةالكتبالرجلاشتركالقدميعطيكsByTagName(.jpg" alt="1px solid #.gif" alt="transparentinformationapplication" onclick="establishedadvertising.png" alt="environmentperformanceappropriate&amp;mdash;immediately</strong></rather thantemperaturedevelopmentcompetitionplaceholdervisibility:copyright">0" height="even thoughreplacementdestinationCorporation<ul class="AssociationindividualsperspectivesetTimeout(url(http://mathematicsmargin-top:eventually description) no-repeatcollections.JPG|thumb|participate/head><bodyfloat:left;<li class="hundreds of
+
+However, compositionclear:both;cooperationwithin the label for="border-top:New Zealandrecommendedphotographyinteresting&lt;sup&gt;controversyNetherlandsalternativemaxlength="switzerlandDevelopmentessentially
+
+Although </textarea>thunderbirdrepresented&amp;ndash;speculationcommunitieslegislationelectronics
+ <div id="illustratedengineeringterritoriesauthoritiesdistributed6" height="sans-serif;capable of disappearedinteractivelooking forit would beAfghanistanwas createdMath.floor(surroundingcan also beobservationmaintenanceencountered<h2 class="more recentit has beeninvasion of).getTime()fundamentalDespite the"><div id="inspirationexaminationpreparationexplanation<input id="</a></span>versions ofinstrumentsbefore the = 'http://Descriptionrelatively .substring(each of theexperimentsinfluentialintegrationmany peopledue to the combinationdo not haveMiddle East<noscript><copyright" perhaps theinstitutionin Decemberarrangementmost famouspersonalitycreation oflimitationsexclusivelysovereignty-content">
+<td class="undergroundparallel todoctrine ofoccupied byterminologyRenaissancea number ofsupport forexplorationrecognitionpredecessor<img src="/<h1 class="publicationmay also bespecialized</fieldset>progressivemillions ofstates thatenforcementaround the one another.parentNodeagricultureAlternativeresearcherstowards theMost of themany other (especially<td width=";width:100%independent<h3 class=" onchange=").addClass(interactionOne of the daughter ofaccessoriesbranches of
+<div id="the largestdeclarationregulationsInformationtranslationdocumentaryin order to">
+<head>
+<" height="1across the orientation);</script>implementedcan be seenthere was ademonstratecontainer">connectionsthe Britishwas written!important;px; margin-followed byability to complicatedduring the immigrationalso called<h4 class="distinctionreplaced bygovernmentslocation ofin Novemberwhether the</p>
+</div>acquisitioncalled the persecutiondesignation{font-size:appeared ininvestigateexperiencedmost likelywidely useddiscussionspresence of (document.extensivelyIt has beenit does notcontrary toinhabitantsimprovementscholarshipconsumptioninstructionfor exampleone or morepx; paddingthe currenta series ofare usuallyrole in thepreviously derivativesevidence ofexperiencescolorschemestated thatcertificate</a></div>
+ selected="high schoolresponse tocomfortableadoption ofthree yearsthe countryin Februaryso that thepeople who provided by<param nameaffected byin terms ofappointmentISO-8859-1"was born inhistorical regarded asmeasurementis based on and other : function(significantcelebrationtransmitted/js/jquery.is known astheoretical tabindex="it could be<noscript>
+having been
+<head>
+< &quot;The compilationhe had beenproduced byphilosopherconstructedintended toamong othercompared toto say thatEngineeringa differentreferred todifferencesbelief thatphotographsidentifyingHistory of Republic ofnecessarilyprobabilitytechnicallyleaving thespectacularfraction ofelectricityhead of therestaurantspartnershipemphasis onmost recentshare with saying thatfilled withdesigned toit is often"></iframe>as follows:merged withthrough thecommercial pointed outopportunityview of therequirementdivision ofprogramminghe receivedsetInterval"></span></in New Yorkadditional compression
+
+<div id="incorporate;</script><attachEventbecame the " target="_carried outSome of thescience andthe time ofContainer">maintainingChristopherMuch of thewritings of" height="2size of theversion of mixture of between theExamples ofeducationalcompetitive onsubmit="director ofdistinctive/DTD XHTML relating totendency toprovince ofwhich woulddespite thescientific legislature.innerHTML allegationsAgriculturewas used inapproach tointelligentyears later,sans-serifdeterminingPerformanceappearances, which is foundationsabbreviatedhigher thans from the individual composed ofsupposed toclaims thatattributionfont-size:1elements ofHistorical his brotherat the timeanniversarygoverned byrelated to ultimately innovationsit is stillcan only bedefinitionstoGMTStringA number ofimg class="Eventually,was changedoccurred inneighboringdistinguishwhen he wasintroducingterrestrialMany of theargues thatan Americanconquest ofwidespread were killedscreen and In order toexpected todescendantsare locatedlegislativegenerations backgroundmost peopleyears afterthere is nothe highestfrequently they do notargued thatshowed thatpredominanttheologicalby the timeconsideringshort-lived</span></a>can be usedvery littleone of the had alreadyinterpretedcommunicatefeatures ofgovernment,</noscript>entered the" height="3Independentpopulationslarge-scale. Although used in thedestructionpossibilitystarting intwo or moreexpressionssubordinatelarger thanhistory and</option>
+Continentaleliminatingwill not bepractice ofin front ofsite of theensure thatto create amississippipotentiallyoutstandingbetter thanwhat is nowsituated inmeta name="TraditionalsuggestionsTranslationthe form ofatmosphericideologicalenterprisescalculatingeast of theremnants ofpluginspage/index.php?remained intransformedHe was alsowas alreadystatisticalin favor ofMinistry ofmovement offormulationis required<link rel="This is the <a href="/popularizedinvolved inare used toand severalmade by theseems to belikely thatPalestiniannamed afterit had beenmost commonto refer tobut this isconsecutivetemporarilyIn general,conventionstakes placesubdivisionterritorialoperationalpermanentlywas largelyoutbreak ofin the pastfollowing a xmlns:og="><a class="class="textConversion may be usedmanufactureafter beingclearfix">
+question ofwas electedto become abecause of some peopleinspired bysuccessful a time whenmore commonamongst thean officialwidth:100%;technology,was adoptedto keep thesettlementslive birthsindex.html"Connecticutassigned to&amp;times;account foralign=rightthe companyalways beenreturned toinvolvementBecause thethis period" name="q" confined toa result ofvalue="" />is actuallyEnvironment
+</head>
+Conversely,>
+<div id="0" width="1is probablyhave becomecontrollingthe problemcitizens ofpoliticiansreached theas early as:none; over<table cellvalidity ofdirectly toonmousedownwhere it iswhen it wasmembers of relation toaccommodatealong with In the latethe Englishdelicious">this is notthe presentif they areand finallya matter of
+ </div>
+
+</script>faster thanmajority ofafter whichcomparativeto maintainimprove theawarded theer" class="frameborderrestorationin the sameanalysis oftheir firstDuring the continentalsequence offunction(){font-size: work on the</script>
+<begins withjavascript:constituentwas foundedequilibriumassume thatis given byneeds to becoordinatesthe variousare part ofonly in thesections ofis a commontheories ofdiscoveriesassociationedge of thestrength ofposition inpresent-dayuniversallyto form thebut insteadcorporationattached tois commonlyreasons for &quot;the can be madewas able towhich meansbut did notonMouseOveras possibleoperated bycoming fromthe primaryaddition offor severaltransferreda period ofare able tohowever, itshould havemuch larger
+ </script>adopted theproperty ofdirected byeffectivelywas broughtchildren ofProgramminglonger thanmanuscriptswar againstby means ofand most ofsimilar to proprietaryoriginatingprestigiousgrammaticalexperience.to make theIt was alsois found incompetitorsin the U.S.replace thebrought thecalculationfall of thethe generalpracticallyin honor ofreleased inresidentialand some ofking of thereaction to1st Earl ofculture andprincipally</title>
+ they can beback to thesome of hisexposure toare similarform of theaddFavoritecitizenshippart in thepeople within practiceto continue&amp;minus;approved by the first allowed theand for thefunctioningplaying thesolution toheight="0" in his bookmore than afollows thecreated thepresence in&nbsp;</td>nationalistthe idea ofa characterwere forced class="btndays of thefeatured inshowing theinterest inin place ofturn of thethe head ofLord of thepoliticallyhas its ownEducationalapproval ofsome of theeach other,behavior ofand becauseand anotherappeared onrecorded inblack&quot;may includethe world'scan lead torefers to aborder="0" government winning theresulted in while the Washington,the subjectcity in the></div>
+ reflect theto completebecame moreradioactiverejected bywithout anyhis father,which couldcopy of theto indicatea politicalaccounts ofconstitutesworked wither</a></li>of his lifeaccompaniedclientWidthprevent theLegislativedifferentlytogether inhas severalfor anothertext of thefounded thee with the is used forchanged theusually theplace wherewhereas the> <a href=""><a href="themselves,although hethat can betraditionalrole of theas a resultremoveChilddesigned bywest of theSome peopleproduction,side of thenewslettersused by thedown to theaccepted bylive in theattempts tooutside thefrequenciesHowever, inprogrammersat least inapproximatealthough itwas part ofand variousGovernor ofthe articleturned into><a href="/the economyis the mostmost widelywould laterand perhapsrise to theoccurs whenunder whichconditions.the westerntheory thatis producedthe city ofin which heseen in thethe centralbuilding ofmany of hisarea of theis the onlymost of themany of thethe WesternThere is noextended toStatisticalcolspan=2 |short storypossible totopologicalcritical ofreported toa Christiandecision tois equal toproblems ofThis can bemerchandisefor most ofno evidenceeditions ofelements in&quot;. Thecom/images/which makesthe processremains theliterature,is a memberthe popularthe ancientproblems intime of thedefeated bybody of thea few yearsmuch of thethe work ofCalifornia,served as agovernment.concepts ofmovement in <div id="it" value="language ofas they areproduced inis that theexplain thediv></div>
+However thelead to the <a href="/was grantedpeople havecontinuallywas seen asand relatedthe role ofproposed byof the besteach other.Constantinepeople fromdialects ofto revisionwas renameda source ofthe initiallaunched inprovide theto the westwhere thereand similarbetween twois also theEnglish andconditions,that it wasentitled tothemselves.quantity ofransparencythe same asto join thecountry andthis is theThis led toa statementcontrast tolastIndexOfthrough hisis designedthe term isis providedprotect theng</a></li>The currentthe site ofsubstantialexperience,in the Westthey shouldslovenÄinacomentariosuniversidadcondicionesactividadesexperienciatecnologíaproducciónpuntuaciónaplicacióncontraseñacategoríasregistrarseprofesionaltratamientoregístratesecretaríaprincipalesprotecciónimportantesimportanciaposibilidadinteresantecrecimientonecesidadessuscribirseasociacióndisponiblesevaluaciónestudiantesresponsableresoluciónguadalajararegistradosoportunidadcomercialesfotografíaautoridadesingenieríatelevisióncompetenciaoperacionesestablecidosimplementeactualmentenavegaciónconformidadline-height:font-family:" : "http://applicationslink" href="specifically//<![CDATA[
+Organizationdistribution0px; height:relationshipdevice-width<div class="<label for="registration</noscript>
+/index.html"window.open( !important;application/independence//www.googleorganizationautocompleterequirementsconservative<form name="intellectualmargin-left:18th centuryan importantinstitutionsabbreviation<img class="organisationcivilization19th centuryarchitectureincorporated20th century-container">most notably/></a></div>notification'undefined')Furthermore,believe thatinnerHTML = prior to thedramaticallyreferring tonegotiationsheadquartersSouth AfricaunsuccessfulPennsylvaniaAs a result,<html lang="&lt;/sup&gt;dealing withphiladelphiahistorically);</script>
+padding-top:experimentalgetAttributeinstructionstechnologiespart of the =function(){subscriptionl.dtd">
+<htgeographicalConstitution', function(supported byagriculturalconstructionpublicationsfont-size: 1a variety of<div style="Encyclopediaiframe src="demonstratedaccomplisheduniversitiesDemographics);</script><dedicated toknowledge ofsatisfactionparticularly</div></div>English (US)appendChild(transmissions. However, intelligence" tabindex="float:right;Commonwealthranging fromin which theat least onereproductionencyclopedia;font-size:1jurisdictionat that time"><a class="In addition,description+conversationcontact withis generallyr" content="representing&lt;math&gt;presentationoccasionally<img width="navigation">compensationchampionshipmedia="all" violation ofreference toreturn true;Strict//EN" transactionsinterventionverificationInformation difficultiesChampionshipcapabilities<![endif]-->}
+</script>
+Christianityfor example,Professionalrestrictionssuggest thatwas released(such as theremoveClass(unemploymentthe Americanstructure of/index.html published inspan class=""><a href="/introductionbelonging toclaimed thatconsequences<meta name="Guide to theoverwhelmingagainst the concentrated,
+.nontouch observations</a>
+</div>
+f (document.border: 1px {font-size:1treatment of0" height="1modificationIndependencedivided intogreater thanachievementsestablishingJavaScript" neverthelesssignificanceBroadcasting>&nbsp;</td>container">
+such as the influence ofa particularsrc='http://navigation" half of the substantial &nbsp;</div>advantage ofdiscovery offundamental metropolitanthe opposite" xml:lang="deliberatelyalign=centerevolution ofpreservationimprovementsbeginning inJesus ChristPublicationsdisagreementtext-align:r, function()similaritiesbody></html>is currentlyalphabeticalis sometimestype="image/many of the flow:hidden;available indescribe theexistence ofall over thethe Internet <ul class="installationneighborhoodarmed forcesreducing thecontinues toNonetheless,temperatures
+ <a href="close to theexamples of is about the(see below)." id="searchprofessionalis availablethe official </script>
+
+ <div id="accelerationthrough the Hall of Famedescriptionstranslationsinterference type='text/recent yearsin the worldvery popular{background:traditional some of the connected toexploitationemergence ofconstitutionA History ofsignificant manufacturedexpectations><noscript><can be foundbecause the has not beenneighbouringwithout the added to the <li class="instrumentalSoviet Unionacknowledgedwhich can bename for theattention toattempts to developmentsIn fact, the<li class="aimplicationssuitable formuch of the colonizationpresidentialcancelBubble Informationmost of the is describedrest of the more or lessin SeptemberIntelligencesrc="http://px; height: available tomanufacturerhuman rightslink href="/availabilityproportionaloutside the astronomicalhuman beingsname of the are found inare based onsmaller thana person whoexpansion ofarguing thatnow known asIn the earlyintermediatederived fromScandinavian</a></div>
+consider thean estimatedthe National<div id="pagresulting incommissionedanalogous toare required/ul>
+</div>
+was based onand became a&nbsp;&nbsp;t" value="" was capturedno more thanrespectivelycontinue to >
+<head>
+<were createdmore generalinformation used for theindependent the Imperialcomponent ofto the northinclude the Constructionside of the would not befor instanceinvention ofmore complexcollectivelybackground: text-align: its originalinto accountthis processan extensivehowever, thethey are notrejected thecriticism ofduring whichprobably thethis article(function(){It should bean agreementaccidentallydiffers fromArchitecturebetter knownarrangementsinfluence onattended theidentical tosouth of thepass throughxml" title="weight:bold;creating thedisplay:nonereplaced the<img src="/ihttps://www.World War IItestimonialsfound in therequired to and that thebetween the was designedconsists of considerablypublished bythe languageConservationconsisted ofrefer to theback to the css" media="People from available onproved to besuggestions"was known asvarieties oflikely to becomprised ofsupport the hands of thecoupled withconnect and border:none;performancesbefore beinglater becamecalculationsoften calledresidents ofmeaning that><li class="evidence forexplanationsenvironments"></a></div>which allowsIntroductiondeveloped bya wide rangeon behalf ofvalign="top"principle ofat the time,</noscript> said to havein the firstwhile othershypotheticalphilosopherspower of thecontained inperformed byinability towere writtenspan style="input name="the questionintended forrejection ofimplies thatinvented thethe standardwas probablylink betweenprofessor ofinteractionschanging theIndian Ocean class="lastworking with'http://www.years beforeThis was therecreationalentering themeasurementsan extremelyvalue of thestart of the
+</script>
+
+an effort toincrease theto the southspacing="0">sufficientlythe Europeanconverted toclearTimeoutdid not haveconsequentlyfor the nextextension ofeconomic andalthough theare producedand with theinsufficientgiven by thestating thatexpenditures</span></a>
+thought thaton the basiscellpadding=image of thereturning toinformation,separated byassassinateds" content="authority ofnorthwestern</div>
+<div "></div>
+ consultationcommunity ofthe nationalit should beparticipants align="leftthe greatestselection ofsupernaturaldependent onis mentionedallowing thewas inventedaccompanyinghis personalavailable atstudy of theon the otherexecution ofHuman Rightsterms of theassociationsresearch andsucceeded bydefeated theand from thebut they arecommander ofstate of theyears of agethe study of<ul class="splace in thewhere he was<li class="fthere are nowhich becamehe publishedexpressed into which thecommissionerfont-weight:territory ofextensions">Roman Empireequal to theIn contrast,however, andis typicallyand his wife(also called><ul class="effectively evolved intoseem to havewhich is thethere was noan excellentall of thesedescribed byIn practice,broadcastingcharged withreflected insubjected tomilitary andto the pointeconomicallysetTargetingare actuallyvictory over();</script>continuouslyrequired forevolutionaryan effectivenorth of the, which was front of theor otherwisesome form ofhad not beengenerated byinformation.permitted toincludes thedevelopment,entered intothe previousconsistentlyare known asthe field ofthis type ofgiven to thethe title ofcontains theinstances ofin the northdue to theirare designedcorporationswas that theone of thesemore popularsucceeded insupport fromin differentdominated bydesigned forownership ofand possiblystandardizedresponseTextwas intendedreceived theassumed thatareas of theprimarily inthe basis ofin the senseaccounts fordestroyed byat least twowas declaredcould not beSecretary ofappear to bemargin-top:1/^\s+|\s+$/ge){throw e};the start oftwo separatelanguage andwho had beenoperation ofdeath of thereal numbers <link rel="provided thethe story ofcompetitionsenglish (UK)english (US)МонголСрпÑкиÑрпÑкиÑрпÑкоلعربية正體中文简体中文ç¹ä½“中文有é™å…¬å¸äººæ°‘政府阿里巴巴社会主义æ“作系统政策法规informaciónherramientaselectrónicodescripciónclasificadosconocimientopublicaciónrelacionadasinformáticarelacionadosdepartamentotrabajadoresdirectamenteayuntamientomercadoLibrecontáctenoshabitacionescumplimientorestaurantesdisposiciónconsecuenciaelectrónicaaplicacionesdesconectadoinstalaciónrealizaciónutilizaciónenciclopediaenfermedadesinstrumentosexperienciasinstituciónparticularessubcategoriaтолькоРоÑÑииработыбольшепроÑтоможетедругихÑлучаеÑейчаÑвÑегдаРоÑÑиÑМоÑкведругиегородавопроÑданныхдолжныименноМоÑквырублейМоÑкваÑтраныничегоработедолженуÑлугитеперьОднакопотомуработуапрелÑвообщеодногоÑвоегоÑтатьидругойфорумехорошопротивÑÑылкакаждыйвлаÑтигруппывмеÑтеработаÑказалпервыйделатьденьгипериодбизнеÑоÑновемоменткупитьдолжнарамкахначалоРаботаТолькоÑовÑемвторойначалаÑпиÑокÑлужбыÑиÑтемпечатиновогопомощиÑайтовпочемупомощьдолжноÑÑылкибыÑтроданныемногиепроектСейчаÑмоделитакогоонлайнгородеверÑиÑÑтранефильмыуровнÑразныхиÑкатьнеделюÑнварÑменьшемногихданнойзначитнельзÑфорумаТеперьмеÑÑцазащитыЛучшиеनहींकरनेअपनेकियाकरेंअनà¥à¤¯à¤•à¥à¤¯à¤¾à¤—ाइडबारेकिसीदियापहलेसिंहभारतअपनीवालेसेवाकरतेमेरेहोनेसकतेबहà¥à¤¤à¤¸à¤¾à¤‡à¤Ÿà¤¹à¥‹à¤—ाजानेमिनटकरताकरनाउनकेयहाà¤à¤¸à¤¬à¤¸à¥‡à¤­à¤¾à¤·à¤¾à¤†à¤ªà¤•à¥‡à¤²à¤¿à¤¯à¥‡à¤¶à¥à¤°à¥‚इसकेघंटेमेरीसकतामेरालेकरअधिकअपनासमाजमà¥à¤à¥‡à¤•à¤¾à¤°à¤£à¤¹à¥‹à¤¤à¤¾à¤•à¤¡à¤¼à¥€à¤¯à¤¹à¤¾à¤‚होटलशबà¥à¤¦à¤²à¤¿à¤¯à¤¾à¤œà¥€à¤µà¤¨à¤œà¤¾à¤¤à¤¾à¤•à¥ˆà¤¸à¥‡à¤†à¤ªà¤•à¤¾à¤µà¤¾à¤²à¥€à¤¦à¥‡à¤¨à¥‡à¤ªà¥‚रीपानीउसकेहोगीबैठकआपकीवरà¥à¤·à¤—ांवआपकोजिलाजानासहमतहमेंउनकीयाहूदरà¥à¤œà¤¸à¥‚चीपसंदसवालहोनाहोतीजैसेवापसजनतानेताजारीघायलजिलेनीचेजांचपतà¥à¤°à¤—ूगलजातेबाहरआपनेवाहनइसकासà¥à¤¬à¤¹à¤°à¤¹à¤¨à¥‡à¤‡à¤¸à¤¸à¥‡à¤¸à¤¹à¤¿à¤¤à¤¬à¤¡à¤¼à¥‡à¤˜à¤Ÿà¤¨à¤¾à¤¤à¤²à¤¾à¤¶à¤ªà¤¾à¤‚चशà¥à¤°à¥€à¤¬à¤¡à¤¼à¥€à¤¹à¥‹à¤¤à¥‡à¤¸à¤¾à¤ˆà¤Ÿà¤¶à¤¾à¤¯à¤¦à¤¸à¤•à¤¤à¥€à¤œà¤¾à¤¤à¥€à¤µà¤¾à¤²à¤¾à¤¹à¤œà¤¾à¤°à¤ªà¤Ÿà¤¨à¤¾à¤°à¤–नेसड़कमिलाउसकीकेवललगताखानाअरà¥à¤¥à¤œà¤¹à¤¾à¤‚देखापहलीनियमबिनाबैंककहींकहनादेताहमलेकाफीजबकितà¥à¤°à¤¤à¤®à¤¾à¤‚गवहींरोज़मिलीआरोपसेनायादवलेनेखाताकरीबउनकाजवाबपूराबड़ासौदाशेयरकियेकहांअकसरबनाà¤à¤µà¤¹à¤¾à¤‚सà¥à¤¥à¤²à¤®à¤¿à¤²à¥‡à¤²à¥‡à¤–कविषयकà¥à¤°à¤‚समूहथानाتستطيعمشاركةبواسطةالصÙحةمواضيعالخاصةالمزيدالعامةالكاتبالردودبرنامجالدولةالعالمالموقعالعربيالسريعالجوالالذهابالحياةالحقوقالكريمالعراقمحÙوظةالثانيمشاهدةالمرأةالقرآنالشبابالحوارالجديدالأسرةالعلوممجموعةالرحمنالنقاطÙلسطينالكويتالدنيابركاتهالرياضتحياتيبتوقيتالأولىالبريدالكلامالرابطالشخصيسياراتالثالثالصلاةالحديثالزوارالخليجالجميعالعامهالجمالالساعةمشاهدهالرئيسالدخولالÙنيةالكتابالدوريالدروساستغرقتصاميمالبناتالعظيمentertainmentunderstanding = function().jpg" width="configuration.png" width="<body class="Math.random()contemporary United Statescircumstances.appendChild(organizations<span class=""><img src="/distinguishedthousands of communicationclear"></div>investigationfavicon.ico" margin-right:based on the Massachusettstable border=internationalalso known aspronunciationbackground:#fpadding-left:For example, miscellaneous&lt;/math&gt;psychologicalin particularearch" type="form method="as opposed toSupreme Courtoccasionally Additionally,North Americapx;backgroundopportunitiesEntertainment.toLowerCase(manufacturingprofessional combined withFor instance,consisting of" maxlength="return false;consciousnessMediterraneanextraordinaryassassinationsubsequently button type="the number ofthe original comprehensiverefers to the</ul>
+</div>
+philosophicallocation.hrefwas publishedSan Francisco(function(){
+<div id="mainsophisticatedmathematical /head>
+<bodysuggests thatdocumentationconcentrationrelationshipsmay have been(for example,This article in some casesparts of the definition ofGreat Britain cellpadding=equivalent toplaceholder="; font-size: justificationbelieved thatsuffered fromattempted to leader of thecript" src="/(function() {are available
+ <link rel=" src='http://interested inconventional " alt="" /></are generallyhas also beenmost popular correspondingcredited withtyle="border:</a></span></.gif" width="<iframe src="table class="inline-block;according to together withapproximatelyparliamentarymore and moredisplay:none;traditionallypredominantly&nbsp;|&nbsp;&nbsp;</span> cellspacing=<input name="or" content="controversialproperty="og:/x-shockwave-demonstrationsurrounded byNevertheless,was the firstconsiderable Although the collaborationshould not beproportion of<span style="known as the shortly afterfor instance,described as /head>
+<body starting withincreasingly the fact thatdiscussion ofmiddle of thean individualdifficult to point of viewhomosexualityacceptance of</span></div>manufacturersorigin of thecommonly usedimportance ofdenominationsbackground: #length of thedeterminationa significant" border="0">revolutionaryprinciples ofis consideredwas developedIndo-Europeanvulnerable toproponents ofare sometimescloser to theNew York City name="searchattributed tocourse of themathematicianby the end ofat the end of" border="0" technological.removeClass(branch of theevidence that![endif]-->
+Institute of into a singlerespectively.and thereforeproperties ofis located insome of whichThere is alsocontinued to appearance of &amp;ndash; describes theconsiderationauthor of theindependentlyequipped withdoes not have</a><a href="confused with<link href="/at the age ofappear in theThese includeregardless ofcould be used style=&quot;several timesrepresent thebody>
+</html>thought to bepopulation ofpossibilitiespercentage ofaccess to thean attempt toproduction ofjquery/jquerytwo differentbelong to theestablishmentreplacing thedescription" determine theavailable forAccording to wide range of <div class="more commonlyorganisationsfunctionalitywas completed &amp;mdash; participationthe characteran additionalappears to befact that thean example ofsignificantlyonmouseover="because they async = true;problems withseems to havethe result of src="http://familiar withpossession offunction () {took place inand sometimessubstantially<span></span>is often usedin an attemptgreat deal ofEnvironmentalsuccessfully virtually all20th century,professionalsnecessary to determined bycompatibilitybecause it isDictionary ofmodificationsThe followingmay refer to:Consequently,Internationalalthough somethat would beworld's firstclassified asbottom of the(particularlyalign="left" most commonlybasis for thefoundation ofcontributionspopularity ofcenter of theto reduce thejurisdictionsapproximation onmouseout="New Testamentcollection of</span></a></in the Unitedfilm director-strict.dtd">has been usedreturn to thealthough thischange in theseveral otherbut there areunprecedentedis similar toespecially inweight: bold;is called thecomputationalindicate thatrestricted to <meta name="are typicallyconflict withHowever, the An example ofcompared withquantities ofrather than aconstellationnecessary forreported thatspecificationpolitical and&nbsp;&nbsp;<references tothe same yearGovernment ofgeneration ofhave not beenseveral yearscommitment to <ul class="visualization19th century,practitionersthat he wouldand continuedoccupation ofis defined ascentre of thethe amount of><div style="equivalent ofdifferentiatebrought aboutmargin-left: automaticallythought of asSome of these
+<div class="input class="replaced withis one of theeducation andinfluenced byreputation as
+<meta name="accommodation</div>
+</div>large part ofInstitute forthe so-called against the In this case,was appointedclaimed to beHowever, thisDepartment ofthe remainingeffect on theparticularly deal with the
+<div style="almost alwaysare currentlyexpression ofphilosophy offor more thancivilizationson the islandselectedIndexcan result in" value="" />the structure /></a></div>Many of thesecaused by theof the Unitedspan class="mcan be tracedis related tobecame one ofis frequentlyliving in thetheoreticallyFollowing theRevolutionarygovernment inis determinedthe politicalintroduced insufficient todescription">short storiesseparation ofas to whetherknown for itswas initiallydisplay:blockis an examplethe principalconsists of arecognized as/body></html>a substantialreconstructedhead of stateresistance toundergraduateThere are twogravitationalare describedintentionallyserved as theclass="headeropposition tofundamentallydominated theand the otheralliance withwas forced torespectively,and politicalin support ofpeople in the20th century.and publishedloadChartbeatto understandmember statesenvironmentalfirst half ofcountries andarchitecturalbe consideredcharacterizedclearIntervalauthoritativeFederation ofwas succeededand there area consequencethe Presidentalso includedfree softwaresuccession ofdeveloped thewas destroyedaway from the;
+</script>
+<although theyfollowed by amore powerfulresulted in aUniversity ofHowever, manythe presidentHowever, someis thought tountil the endwas announcedare importantalso includes><input type=the center of DO NOT ALTERused to referthemes/?sort=that had beenthe basis forhas developedin the summercomparativelydescribed thesuch as thosethe resultingis impossiblevarious otherSouth Africanhave the sameeffectivenessin which case; text-align:structure and; background:regarding thesupported theis also knownstyle="marginincluding thebahasa Melayunorsk bokmÃ¥lnorsk nynorskslovenÅ¡Äinainternacionalcalificacióncomunicaciónconstrucción"><div class="disambiguationDomainName', 'administrationsimultaneouslytransportationInternational margin-bottom:responsibility<![endif]-->
+</><meta name="implementationinfrastructurerepresentationborder-bottom:</head>
+<body>=http%3A%2F%2F<form method="method="post" /favicon.ico" });
+</script>
+.setAttribute(Administration= new Array();<![endif]-->
+display:block;Unfortunately,">&nbsp;</div>/favicon.ico">='stylesheet' identification, for example,<li><a href="/an alternativeas a result ofpt"></script>
+type="submit"
+(function() {recommendationform action="/transformationreconstruction.style.display According to hidden" name="along with thedocument.body.approximately Communicationspost" action="meaning &quot;--<![endif]-->Prime Ministercharacteristic</a> <a class=the history of onmouseover="the governmenthref="https://was originallywas introducedclassificationrepresentativeare considered<![endif]-->
+
+depends on theUniversity of in contrast to placeholder="in the case ofinternational constitutionalstyle="border-: function() {Because of the-strict.dtd">
+<table class="accompanied byaccount of the<script src="/nature of the the people in in addition tos); js.id = id" width="100%"regarding the Roman Catholican independentfollowing the .gif" width="1the following discriminationarchaeologicalprime minister.js"></script>combination of marginwidth="createElement(w.attachEvent(</a></td></tr>src="https://aIn particular, align="left" Czech RepublicUnited Kingdomcorrespondenceconcluded that.html" title="(function () {comes from theapplication of<span class="sbelieved to beement('script'</a>
+</li>
+<livery different><span class="option value="(also known as <li><a href="><input name="separated fromreferred to as valign="top">founder of theattempting to carbon dioxide
+
+<div class="class="search-/body>
+</html>opportunity tocommunications</head>
+<body style="width:Tiếng Việtchanges in theborder-color:#0" border="0" </span></div><was discovered" type="text" );
+</script>
+
+Department of ecclesiasticalthere has beenresulting from</body></html>has never beenthe first timein response toautomatically </div>
+
+<div iwas consideredpercent of the" /></a></div>collection of descended fromsection of theaccept-charsetto be confusedmember of the padding-right:translation ofinterpretation href='http://whether or notThere are alsothere are manya small numberother parts ofimpossible to class="buttonlocated in the. However, theand eventuallyAt the end of because of itsrepresents the<form action=" method="post"it is possiblemore likely toan increase inhave also beencorresponds toannounced thatalign="right">many countriesfor many yearsearliest knownbecause it waspt"></script> valign="top" inhabitants offollowing year
+<div class="million peoplecontroversial concerning theargue that thegovernment anda reference totransferred todescribing the style="color:although therebest known forsubmit" name="multiplicationmore than one recognition ofCouncil of theedition of the <meta name="Entertainment away from the ;margin-right:at the time ofinvestigationsconnected withand many otheralthough it isbeginning with <span class="descendants of<span class="i align="right"</head>
+<body aspects of thehas since beenEuropean Unionreminiscent ofmore difficultVice Presidentcomposition ofpassed throughmore importantfont-size:11pxexplanation ofthe concept ofwritten in the <span class="is one of the resemblance toon the groundswhich containsincluding the defined by thepublication ofmeans that theoutside of thesupport of the<input class="<span class="t(Math.random()most prominentdescription ofConstantinoplewere published<div class="seappears in the1" height="1" most importantwhich includeswhich had beendestruction ofthe population
+ <div class="possibility ofsometimes usedappear to havesuccess of theintended to bepresent in thestyle="clear:b
+</script>
+<was founded ininterview with_id" content="capital of the
+<link rel="srelease of thepoint out thatxMLHttpRequestand subsequentsecond largestvery importantspecificationssurface of theapplied to theforeign policy_setDomainNameestablished inis believed toIn addition tomeaning of theis named afterto protect theis representedDeclaration ofmore efficientClassificationother forms ofhe returned to<span class="cperformance of(function() { if and only ifregions of theleading to therelations withUnited Nationsstyle="height:other than theype" content="Association of
+</head>
+<bodylocated on theis referred to(including theconcentrationsthe individualamong the mostthan any other/>
+<link rel=" return false;the purpose ofthe ability to;color:#fff}
+.
+<span class="the subject ofdefinitions of>
+<link rel="claim that thehave developed<table width="celebration ofFollowing the to distinguish<span class="btakes place inunder the namenoted that the><![endif]-->
+style="margin-instead of theintroduced thethe process ofincreasing thedifferences inestimated thatespecially the/div><div id="was eventuallythroughout histhe differencesomething thatspan></span></significantly ></script>
+
+environmental to prevent thehave been usedespecially forunderstand theis essentiallywere the firstis the largesthave been made" src="http://interpreted assecond half ofcrolling="no" is composed ofII, Holy Romanis expected tohave their owndefined as thetraditionally have differentare often usedto ensure thatagreement withcontaining theare frequentlyinformation onexample is theresulting in a</a></li></ul> class="footerand especiallytype="button" </span></span>which included>
+<meta name="considered thecarried out byHowever, it isbecame part ofin relation topopular in thethe capital ofwas officiallywhich has beenthe History ofalternative todifferent fromto support thesuggested thatin the process <div class="the foundationbecause of hisconcerned withthe universityopposed to thethe context of<span class="ptext" name="q" <div class="the scientificrepresented bymathematicianselected by thethat have been><div class="cdiv id="headerin particular,converted into);
+</script>
+<philosophical srpskohrvatskitiếng ViệtРуÑÑкийруÑÑкийinvestigaciónparticipaciónкоторыеоблаÑтикоторыйчеловекÑиÑтемыÐовоÑтикоторыхоблаÑтьвременикотораÑÑегоднÑÑкачатьновоÑтиУкраинывопроÑыкоторойÑделатьпомощьюÑредÑтвобразомÑтороныучаÑтиетечениеГлавнаÑиÑторииÑиÑтемарешениÑСкачатьпоÑтомуÑледуетÑказатьтоваровконечнорешениекотороеоргановкоторомРекламаالمنتدىمنتدياتالموضوعالبرامجالمواقعالرسائلمشاركاتالأعضاءالرياضةالتصميمالاعضاءالنتائجالألعابالتسجيلالأقسامالضغطاتالÙيديوالترحيبالجديدةالتعليمالأخبارالاÙلامالأÙلامالتاريخالتقنيةالالعابالخواطرالمجتمعالديكورالسياحةعبداللهالتربيةالروابطالأدبيةالاخبارالمتحدةالاغانيcursor:pointer;</title>
+<meta " href="http://"><span class="members of the window.locationvertical-align:/a> | <a href="<!doctype html>media="screen" <option value="favicon.ico" />
+ <div class="characteristics" method="get" /body>
+</html>
+shortcut icon" document.write(padding-bottom:representativessubmit" value="align="center" throughout the science fiction
+ <div class="submit" class="one of the most valign="top"><was established);
+</script>
+return false;">).style.displaybecause of the document.cookie<form action="/}body{margin:0;Encyclopedia ofversion of the .createElement(name" content="</div>
+</div>
+
+administrative </body>
+</html>history of the "><input type="portion of the as part of the &nbsp;<a href="other countries">
+<div class="</span></span><In other words,display: block;control of the introduction of/>
+<meta name="as well as the in recent years
+ <div class="</div>
+ </div>
+inspired by thethe end of the compatible withbecame known as style="margin:.js"></script>< International there have beenGerman language style="color:#Communist Partyconsistent withborder="0" cell marginheight="the majority of" align="centerrelated to the many different Orthodox Churchsimilar to the />
+<link rel="swas one of the until his death})();
+</script>other languagescompared to theportions of thethe Netherlandsthe most commonbackground:url(argued that thescrolling="no" included in theNorth American the name of theinterpretationsthe traditionaldevelopment of frequently useda collection ofvery similar tosurrounding theexample of thisalign="center">would have beenimage_caption =attached to thesuggesting thatin the form of involved in theis derived fromnamed after theIntroduction torestrictions on style="width: can be used to the creation ofmost important information andresulted in thecollapse of theThis means thatelements of thewas replaced byanalysis of theinspiration forregarded as themost successfulknown as &quot;a comprehensiveHistory of the were consideredreturned to theare referred toUnsourced image>
+ <div class="consists of thestopPropagationinterest in theavailability ofappears to haveelectromagneticenableServices(function of theIt is important</script></div>function(){var relative to theas a result of the position ofFor example, in method="post" was followed by&amp;mdash; thethe applicationjs"></script>
+ul></div></div>after the deathwith respect tostyle="padding:is particularlydisplay:inline; type="submit" is divided into中文 (简体)responsabilidadadministracióninternacionalescorrespondienteउपयोगपूरà¥à¤µà¤¹à¤®à¤¾à¤°à¥‡à¤²à¥‹à¤—ोंचà¥à¤¨à¤¾à¤µà¤²à¥‡à¤•à¤¿à¤¨à¤¸à¤°à¤•à¤¾à¤°à¤ªà¥à¤²à¤¿à¤¸à¤–ोजेंचाहिà¤à¤­à¥‡à¤œà¥‡à¤‚शामिलहमारीजागरणबनानेकà¥à¤®à¤¾à¤°à¤¬à¥à¤²à¥‰à¤—मालिकमहिलापृषà¥à¤ à¤¬à¤¢à¤¼à¤¤à¥‡à¤­à¤¾à¤œà¤ªà¤¾à¤•à¥à¤²à¤¿à¤•à¤Ÿà¥à¤°à¥‡à¤¨à¤–िलाफदौरानमामलेमतदानबाजारविकासकà¥à¤¯à¥‹à¤‚चाहतेपहà¥à¤à¤šà¤¬à¤¤à¤¾à¤¯à¤¾à¤¸à¤‚वाददेखनेपिछलेविशेषराजà¥à¤¯à¤‰à¤¤à¥à¤¤à¤°à¤®à¥à¤‚बईदोनोंउपकरणपढ़ेंसà¥à¤¥à¤¿à¤¤à¤«à¤¿à¤²à¥à¤®à¤®à¥à¤–à¥à¤¯à¤…चà¥à¤›à¤¾à¤›à¥‚टतीसंगीतजाà¤à¤—ाविभागघणà¥à¤Ÿà¥‡à¤¦à¥‚सरेदिनोंहतà¥à¤¯à¤¾à¤¸à¥‡à¤•à¥à¤¸à¤—ांधीविशà¥à¤µà¤°à¤¾à¤¤à¥‡à¤‚दैटà¥à¤¸à¤¨à¤•à¥à¤¶à¤¾à¤¸à¤¾à¤®à¤¨à¥‡à¤…दालतबिजलीपà¥à¤°à¥‚षहिंदीमितà¥à¤°à¤•à¤µà¤¿à¤¤à¤¾à¤°à¥à¤ªà¤¯à¥‡à¤¸à¥à¤¥à¤¾à¤¨à¤•à¤°à¥‹à¤¡à¤¼à¤®à¥à¤•à¥à¤¤à¤¯à¥‹à¤œà¤¨à¤¾à¤•à¥ƒà¤ªà¤¯à¤¾à¤ªà¥‹à¤¸à¥à¤Ÿà¤˜à¤°à¥‡à¤²à¥‚कारà¥à¤¯à¤µà¤¿à¤šà¤¾à¤°à¤¸à¥‚चनामूलà¥à¤¯à¤¦à¥‡à¤–ेंहमेशासà¥à¤•à¥‚लमैंनेतैयारजिसकेrss+xml" title="-type" content="title" content="at the same time.js"></script>
+<" method="post" </span></a></li>vertical-align:t/jquery.min.js">.click(function( style="padding-})();
+</script>
+</span><a href="<a href="http://); return false;text-decoration: scrolling="no" border-collapse:associated with Bahasa IndonesiaEnglish language<text xml:space=.gif" border="0"</body>
+</html>
+overflow:hidden;img src="http://addEventListenerresponsible for s.js"></script>
+/favicon.ico" />operating system" style="width:1target="_blank">State Universitytext-align:left;
+document.write(, including the around the world);
+</script>
+<" style="height:;overflow:hiddenmore informationan internationala member of the one of the firstcan be found in </div>
+ </div>
+display: none;">" />
+<link rel="
+ (function() {the 15th century.preventDefault(large number of Byzantine Empire.jpg|thumb|left|vast majority ofmajority of the align="center">University Pressdominated by theSecond World Wardistribution of style="position:the rest of the characterized by rel="nofollow">derives from therather than the a combination ofstyle="width:100English-speakingcomputer scienceborder="0" alt="the existence ofDemocratic Party" style="margin-For this reason,.js"></script>
+ sByTagName(s)[0]js"></script>
+<.js"></script>
+link rel="icon" ' alt='' class='formation of theversions of the </a></div></div>/page>
+ <page>
+<div class="contbecame the firstbahasa Indonesiaenglish (simple)ΕλληνικάхрватÑкикомпанииÑвлÑетÑÑДобавитьчеловекаразвитиÑИнтернетОтветитьнапримеринтернеткоторогоÑтраницыкачеÑтвеуÑловиÑхпроблемыполучитьÑвлÑÑŽÑ‚ÑÑнаиболеекомпаниÑвниманиеÑредÑтваالمواضيعالرئيسيةالانتقالمشاركاتكالسياراتالمكتوبةالسعوديةاحصائياتالعالميةالصوتياتالانترنتالتصاميمالإسلاميالمشاركةالمرئياتrobots" content="<div id="footer">the United States<img src="http://.jpg|right|thumb|.js"></script>
+<location.protocolframeborder="0" s" />
+<meta name="</a></div></div><font-weight:bold;&quot; and &quot;depending on the margin:0;padding:" rel="nofollow" President of the twentieth centuryevision>
+ </pageInternet Explorera.async = true;
+information about<div id="header">" action="http://<a href="https://<div id="content"</div>
+</div>
+<derived from the <img src='http://according to the
+</body>
+</html>
+style="font-size:script language="Arial, Helvetica,</a><span class="</script><script political partiestd></tr></table><href="http://www.interpretation ofrel="stylesheet" document.write('<charset="utf-8">
+beginning of the revealed that thetelevision series" rel="nofollow"> target="_blank">claiming that thehttp%3A%2F%2Fwww.manifestations ofPrime Minister ofinfluenced by theclass="clearfix">/div>
+</div>
+
+three-dimensionalChurch of Englandof North Carolinasquare kilometres.addEventListenerdistinct from thecommonly known asPhonetic Alphabetdeclared that thecontrolled by theBenjamin Franklinrole-playing gamethe University ofin Western Europepersonal computerProject Gutenbergregardless of thehas been proposedtogether with the></li><li class="in some countriesmin.js"></script>of the populationofficial language<img src="images/identified by thenatural resourcesclassification ofcan be consideredquantum mechanicsNevertheless, themillion years ago</body>
+</html> Ελληνικά
+take advantage ofand, according toattributed to theMicrosoft Windowsthe first centuryunder the controldiv class="headershortly after thenotable exceptiontens of thousandsseveral differentaround the world.reaching militaryisolated from theopposition to thethe Old TestamentAfrican Americansinserted into theseparate from themetropolitan areamakes it possibleacknowledged thatarguably the mosttype="text/css">
+the InternationalAccording to the pe="text/css" />
+coincide with thetwo-thirds of theDuring this time,during the periodannounced that hethe internationaland more recentlybelieved that theconsciousness andformerly known assurrounded by thefirst appeared inoccasionally usedposition:absolute;" target="_blank" position:relative;text-align:center;jax/libs/jquery/1.background-color:#type="application/anguage" content="<meta http-equiv="Privacy Policy</a>e("%3Cscript src='" target="_blank">On the other hand,.jpg|thumb|right|2</div><div class="<div style="float:nineteenth century</body>
+</html>
+<img src="http://s;text-align:centerfont-weight: bold; According to the difference between" frameborder="0" " style="position:link href="http://html4/loose.dtd">
+during this period</td></tr></table>closely related tofor the first time;font-weight:bold;input type="text" <span style="font-onreadystatechange <div class="cleardocument.location. For example, the a wide variety of <!DOCTYPE html>
+<&nbsp;&nbsp;&nbsp;"><a href="http://style="float:left;concerned with the=http%3A%2F%2Fwww.in popular culturetype="text/css" />it is possible to Harvard Universitytylesheet" href="/the main characterOxford University name="keywords" cstyle="text-align:the United Kingdomfederal government<div style="margin depending on the description of the<div class="header.min.js"></script>destruction of theslightly differentin accordance withtelecommunicationsindicates that theshortly thereafterespecially in the European countriesHowever, there aresrc="http://staticsuggested that the" src="http://www.a large number of Telecommunications" rel="nofollow" tHoly Roman Emperoralmost exclusively" border="0" alt="Secretary of Stateculminating in theCIA World Factbookthe most importantanniversary of thestyle="background-<li><em><a href="/the Atlantic Oceanstrictly speaking,shortly before thedifferent types ofthe Ottoman Empire><img src="http://An Introduction toconsequence of thedeparture from theConfederate Statesindigenous peoplesProceedings of theinformation on thetheories have beeninvolvement in thedivided into threeadjacent countriesis responsible fordissolution of thecollaboration withwidely regarded ashis contemporariesfounding member ofDominican Republicgenerally acceptedthe possibility ofare also availableunder constructionrestoration of thethe general publicis almost entirelypasses through thehas been suggestedcomputer and videoGermanic languages according to the different from theshortly afterwardshref="https://www.recent developmentBoard of Directors<div class="search| <a href="http://In particular, theMultiple footnotesor other substancethousands of yearstranslation of the</div>
+</div>
+
+<a href="index.phpwas established inmin.js"></script>
+participate in thea strong influencestyle="margin-top:represented by thegraduated from theTraditionally, theElement("script");However, since the/div>
+</div>
+<div left; margin-left:protection against0; vertical-align:Unfortunately, thetype="image/x-icon/div>
+<div class=" class="clearfix"><div class="footer </div>
+ </div>
+the motion pictureБългарÑкибългарÑкиФедерациинеÑколькоÑообщениеÑообщениÑпрограммыОтправитьбеÑплатноматериалыпозволÑетпоÑледниеразличныхпродукциипрограммаполноÑтьюнаходитÑÑизбранноенаÑелениÑизменениÑкатегорииÐлекÑандрदà¥à¤µà¤¾à¤°à¤¾à¤®à¥ˆà¤¨à¥à¤…लपà¥à¤°à¤¦à¤¾à¤¨à¤­à¤¾à¤°à¤¤à¥€à¤¯à¤…नà¥à¤¦à¥‡à¤¶à¤¹à¤¿à¤¨à¥à¤¦à¥€à¤‡à¤‚डियादिलà¥à¤²à¥€à¤…धिकारवीडियोचिटà¥à¤ à¥‡à¤¸à¤®à¤¾à¤šà¤¾à¤°à¤œà¤‚कà¥à¤¶à¤¨à¤¦à¥à¤¨à¤¿à¤¯à¤¾à¤ªà¥à¤°à¤¯à¥‹à¤—अनà¥à¤¸à¤¾à¤°à¤‘नलाइनपारà¥à¤Ÿà¥€à¤¶à¤°à¥à¤¤à¥‹à¤‚लोकसभाफ़à¥à¤²à¥ˆà¤¶à¤¶à¤°à¥à¤¤à¥‡à¤‚पà¥à¤°à¤¦à¥‡à¤¶à¤ªà¥à¤²à¥‡à¤¯à¤°à¤•à¥‡à¤‚दà¥à¤°à¤¸à¥à¤¥à¤¿à¤¤à¤¿à¤‰à¤¤à¥à¤ªà¤¾à¤¦à¤‰à¤¨à¥à¤¹à¥‡à¤‚चिटà¥à¤ à¤¾à¤¯à¤¾à¤¤à¥à¤°à¤¾à¤œà¥à¤¯à¤¾à¤¦à¤¾à¤ªà¥à¤°à¤¾à¤¨à¥‡à¤œà¥‹à¤¡à¤¼à¥‡à¤‚अनà¥à¤µà¤¾à¤¦à¤¶à¥à¤°à¥‡à¤£à¥€à¤¶à¤¿à¤•à¥à¤·à¤¾à¤¸à¤°à¤•à¤¾à¤°à¥€à¤¸à¤‚गà¥à¤°à¤¹à¤ªà¤°à¤¿à¤£à¤¾à¤®à¤¬à¥à¤°à¤¾à¤‚डबचà¥à¤šà¥‹à¤‚उपलबà¥à¤§à¤®à¤‚तà¥à¤°à¥€à¤¸à¤‚परà¥à¤•à¤‰à¤®à¥à¤®à¥€à¤¦à¤®à¤¾à¤§à¥à¤¯à¤®à¤¸à¤¹à¤¾à¤¯à¤¤à¤¾à¤¶à¤¬à¥à¤¦à¥‹à¤‚मीडियाआईपीà¤à¤²à¤®à¥‹à¤¬à¤¾à¤‡à¤²à¤¸à¤‚खà¥à¤¯à¤¾à¤†à¤ªà¤°à¥‡à¤¶à¤¨à¤…नà¥à¤¬à¤‚धबाज़ारनवीनतमपà¥à¤°à¤®à¥à¤–पà¥à¤°à¤¶à¥à¤¨à¤ªà¤°à¤¿à¤µà¤¾à¤°à¤¨à¥à¤•à¤¸à¤¾à¤¨à¤¸à¤®à¤°à¥à¤¥à¤¨à¤†à¤¯à¥‹à¤œà¤¿à¤¤à¤¸à¥‹à¤®à¤µà¤¾à¤°Ø§Ù„مشاركاتالمنتدياتالكمبيوترالمشاهداتعددالزوارعددالردودالإسلاميةالÙوتوشوبالمسابقاتالمعلوماتالمسلسلاتالجراÙيكسالاسلاميةالاتصالاتkeywords" content="w3.org/1999/xhtml"><a target="_blank" text/html; charset=" target="_blank"><table cellpadding="autocomplete="off" text-align: center;to last version by background-color: #" href="http://www./div></div><div id=<a href="#" class=""><img src="http://cript" src="http://
+<script language="//EN" "http://www.wencodeURIComponent(" href="javascript:<div class="contentdocument.write('<scposition: absolute;script src="http:// style="margin-top:.min.js"></script>
+</div>
+<div class="w3.org/1999/xhtml"
+
+</body>
+</html>distinction between/" target="_blank"><link href="http://encoding="utf-8"?>
+w.addEventListener?action="http://www.icon" href="http:// style="background:type="text/css" />
+meta property="og:t<input type="text" style="text-align:the development of tylesheet" type="tehtml; charset=utf-8is considered to betable width="100%" In addition to the contributed to the differences betweendevelopment of the It is important to </script>
+
+<script style="font-size:1></span><span id=gbLibrary of Congress<img src="http://imEnglish translationAcademy of Sciencesdiv style="display:construction of the.getElementById(id)in conjunction withElement('script'); <meta property="og:БългарÑки
+ type="text" name=">Privacy Policy</a>administered by theenableSingleRequeststyle=&quot;margin:</div></div></div><><img src="http://i style=&quot;float:referred to as the total population ofin Washington, D.C. style="background-among other things,organization of theparticipated in thethe introduction ofidentified with thefictional character Oxford University misunderstanding ofThere are, however,stylesheet" href="/Columbia Universityexpanded to includeusually referred toindicating that thehave suggested thataffiliated with thecorrelation betweennumber of different></td></tr></table>Republic of Ireland
+</script>
+<script under the influencecontribution to theOfficial website ofheadquarters of thecentered around theimplications of thehave been developedFederal Republic ofbecame increasinglycontinuation of theNote, however, thatsimilar to that of capabilities of theaccordance with theparticipants in thefurther developmentunder the directionis often consideredhis younger brother</td></tr></table><a http-equiv="X-UA-physical propertiesof British Columbiahas been criticized(with the exceptionquestions about thepassing through the0" cellpadding="0" thousands of peopleredirects here. Forhave children under%3E%3C/script%3E"));<a href="http://www.<li><a href="http://site_name" content="text-decoration:nonestyle="display: none<meta http-equiv="X-new Date().getTime() type="image/x-icon"</span><span class="language="javascriptwindow.location.href<a href="javascript:-->
+<script type="t<a href='http://www.hortcut icon" href="</div>
+<div class="<script src="http://" rel="stylesheet" t</div>
+<script type=/a> <a href="http:// allowTransparency="X-UA-Compatible" conrelationship between
+</script>
+<script </a></li></ul></div>associated with the programming language</a><a href="http://</a></li><li class="form action="http://<div style="display:type="text" name="q"<table width="100%" background-position:" border="0" width="rel="shortcut icon" h6><ul><li><a href=" <meta http-equiv="css" media="screen" responsible for the " type="application/" style="background-html; charset=utf-8" allowtransparency="stylesheet" type="te
+<meta http-equiv="></span><span class="0" cellspacing="0">;
+</script>
+<script sometimes called thedoes not necessarilyFor more informationat the beginning of <!DOCTYPE html><htmlparticularly in the type="hidden" name="javascript:void(0);"effectiveness of the autocomplete="off" generally considered><input type="text" "></script>
+<scriptthroughout the worldcommon misconceptionassociation with the</div>
+</div>
+<div cduring his lifetime,corresponding to thetype="image/x-icon" an increasing numberdiplomatic relationsare often consideredmeta charset="utf-8" <input type="text" examples include the"><img src="http://iparticipation in thethe establishment of
+</div>
+<div class="&amp;nbsp;&amp;nbsp;to determine whetherquite different frommarked the beginningdistance between thecontributions to theconflict between thewidely considered towas one of the firstwith varying degreeshave speculated that(document.getElementparticipating in theoriginally developedeta charset="utf-8"> type="text/css" />
+interchangeably withmore closely relatedsocial and politicalthat would otherwiseperpendicular to thestyle type="text/csstype="submit" name="families residing indeveloping countriescomputer programmingeconomic developmentdetermination of thefor more informationon several occasionsportuguês (Europeu)УкраїнÑькаукраїнÑькаРоÑÑийÑкойматериаловинформацииуправлениÑнеобходимоинформациÑИнформациÑРеÑпубликиколичеÑтвоинформациютерриториидоÑтаточноالمتواجدونالاشتراكاتالاقتراحاتhtml; charset=UTF-8" setTimeout(function()display:inline-block;<input type="submit" type = 'text/javascri<img src="http://www." "http://www.w3.org/shortcut icon" href="" autocomplete="off" </a></div><div class=</a></li>
+<li class="css" type="text/css" <form action="http://xt/css" href="http://link rel="alternate"
+<script type="text/ onclick="javascript:(new Date).getTime()}height="1" width="1" People's Republic of <a href="http://www.text-decoration:underthe beginning of the </div>
+</div>
+</div>
+establishment of the </div></div></div></d#viewport{min-height:
+<script src="http://option><option value=often referred to as /option>
+<option valu<!DOCTYPE html>
+<!--[International Airport>
+<a href="http://www</a><a href="http://wภาษาไทยქáƒáƒ áƒ—ული正體中文 (ç¹é«”)निरà¥à¤¦à¥‡à¤¶à¤¡à¤¾à¤‰à¤¨à¤²à¥‹à¤¡à¤•à¥à¤·à¥‡à¤¤à¥à¤°à¤œà¤¾à¤¨à¤•à¤¾à¤°à¥€à¤¸à¤‚बंधितसà¥à¤¥à¤¾à¤ªà¤¨à¤¾à¤¸à¥à¤µà¥€à¤•à¤¾à¤°à¤¸à¤‚सà¥à¤•à¤°à¤£à¤¸à¤¾à¤®à¤—à¥à¤°à¥€à¤šà¤¿à¤Ÿà¥à¤ à¥‹à¤‚विजà¥à¤žà¤¾à¤¨à¤…मेरिकाविभिनà¥à¤¨à¤—ाडियाà¤à¤•à¥à¤¯à¥‹à¤‚किसà¥à¤°à¤•à¥à¤·à¤¾à¤ªà¤¹à¥à¤à¤šà¤¤à¥€à¤ªà¥à¤°à¤¬à¤‚धनटिपà¥à¤ªà¤£à¥€à¤•à¥à¤°à¤¿à¤•à¥‡à¤Ÿà¤ªà¥à¤°à¤¾à¤°à¤‚भपà¥à¤°à¤¾à¤ªà¥à¤¤à¤®à¤¾à¤²à¤¿à¤•à¥‹à¤‚रफ़à¥à¤¤à¤¾à¤°à¤¨à¤¿à¤°à¥à¤®à¤¾à¤£à¤²à¤¿à¤®à¤¿à¤Ÿà¥‡à¤¡description" content="document.location.prot.getElementsByTagName(<!DOCTYPE html>
+<html <meta charset="utf-8">:url" content="http://.css" rel="stylesheet"style type="text/css">type="text/css" href="w3.org/1999/xhtml" xmltype="text/javascript" method="get" action="link rel="stylesheet" = document.getElementtype="image/x-icon" />cellpadding="0" cellsp.css" type="text/css" </a></li><li><a href="" width="1" height="1""><a href="http://www.style="display:none;">alternate" type="appli-//W3C//DTD XHTML 1.0 ellspacing="0" cellpad type="hidden" value="/a>&nbsp;<span role="s
+<input type="hidden" language="JavaScript" document.getElementsBg="0" cellspacing="0" ype="text/css" media="type='text/javascript'with the exception of ype="text/css" rel="st height="1" width="1" ='+encodeURIComponent(<link rel="alternate"
+body, tr, input, textmeta name="robots" conmethod="post" action=">
+<a href="http://www.css" rel="stylesheet" </div></div><div classlanguage="javascript">aria-hidden="true">·<ript" type="text/javasl=0;})();
+(function(){background-image: url(/a></li><li><a href="h <li><a href="http://ator" aria-hidden="tru> <a href="http://www.language="javascript" /option>
+<option value/div></div><div class=rator" aria-hidden="tre=(new Date).getTime()português (do Brasil)организациивозможноÑтьобразованиÑрегиÑтрациивозможноÑтиобÑзательна<!DOCTYPE html PUBLIC "nt-Type" content="text/<meta http-equiv="Conteransitional//EN" "http:<html xmlns="http://www-//W3C//DTD XHTML 1.0 TDTD/xhtml1-transitional//www.w3.org/TR/xhtml1/pe = 'text/javascript';<meta name="descriptionparentNode.insertBefore<input type="hidden" najs" type="text/javascri(document).ready(functiscript type="text/javasimage" content="http://UA-Compatible" content=tml; charset=utf-8" />
+link rel="shortcut icon<link rel="stylesheet" </script>
+<script type== document.createElemen<a target="_blank" href= document.getElementsBinput type="text" name=a.type = 'text/javascrinput type="hidden" namehtml; charset=utf-8" />dtd">
+<html xmlns="http-//W3C//DTD HTML 4.01 TentsByTagName('script')input type="hidden" nam<script type="text/javas" style="display:none;">document.getElementById(=document.createElement(' type='text/javascript'input type="text" name="d.getElementsByTagName(snical" href="http://www.C//DTD HTML 4.01 Transit<style type="text/css">
+
+<style type="text/css">ional.dtd">
+<html xmlns=http-equiv="Content-Typeding="0" cellspacing="0"html; charset=utf-8" />
+ style="display:none;"><<li><a href="http://www. type='text/javascript'>деÑтельноÑтиÑоответÑтвиипроизводÑтвабезопаÑноÑтиपà¥à¤¸à¥à¤¤à¤¿à¤•à¤¾à¤•à¤¾à¤‚गà¥à¤°à¥‡à¤¸à¤‰à¤¨à¥à¤¹à¥‹à¤‚नेविधानसभाफिकà¥à¤¸à¤¿à¤‚गसà¥à¤°à¤•à¥à¤·à¤¿à¤¤à¤•à¥‰à¤ªà¥€à¤°à¤¾à¤‡à¤Ÿà¤µà¤¿à¤œà¥à¤žà¤¾à¤ªà¤¨à¤•à¤¾à¤°à¥à¤°à¤µà¤¾à¤ˆà¤¸à¤•à¥à¤°à¤¿à¤¯à¤¤à¤¾ \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/dictionary.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/dictionary.c
new file mode 100644
index 000000000..f9e30417c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/dictionary.c
@@ -0,0 +1,5914 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+#include "./dictionary.h"
+#include "./platform.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#if !defined(BROTLI_EXTERNAL_DICTIONARY_DATA)
+static const uint8_t kBrotliDictionaryData[] =
+{
+116,105,109,101,100,111,119,110,108,105,102,101,108,101,102,116,98,97,99,107,99,
+111,100,101,100,97,116,97,115,104,111,119,111,110,108,121,115,105,116,101,99,105
+,116,121,111,112,101,110,106,117,115,116,108,105,107,101,102,114,101,101,119,111
+,114,107,116,101,120,116,121,101,97,114,111,118,101,114,98,111,100,121,108,111,
+118,101,102,111,114,109,98,111,111,107,112,108,97,121,108,105,118,101,108,105,
+110,101,104,101,108,112,104,111,109,101,115,105,100,101,109,111,114,101,119,111,
+114,100,108,111,110,103,116,104,101,109,118,105,101,119,102,105,110,100,112,97,
+103,101,100,97,121,115,102,117,108,108,104,101,97,100,116,101,114,109,101,97,99,
+104,97,114,101,97,102,114,111,109,116,114,117,101,109,97,114,107,97,98,108,101,
+117,112,111,110,104,105,103,104,100,97,116,101,108,97,110,100,110,101,119,115,
+101,118,101,110,110,101,120,116,99,97,115,101,98,111,116,104,112,111,115,116,117
+,115,101,100,109,97,100,101,104,97,110,100,104,101,114,101,119,104,97,116,110,97
+,109,101,76,105,110,107,98,108,111,103,115,105,122,101,98,97,115,101,104,101,108
+,100,109,97,107,101,109,97,105,110,117,115,101,114,39,41,32,43,104,111,108,100,
+101,110,100,115,119,105,116,104,78,101,119,115,114,101,97,100,119,101,114,101,
+115,105,103,110,116,97,107,101,104,97,118,101,103,97,109,101,115,101,101,110,99,
+97,108,108,112,97,116,104,119,101,108,108,112,108,117,115,109,101,110,117,102,
+105,108,109,112,97,114,116,106,111,105,110,116,104,105,115,108,105,115,116,103,
+111,111,100,110,101,101,100,119,97,121,115,119,101,115,116,106,111,98,115,109,
+105,110,100,97,108,115,111,108,111,103,111,114,105,99,104,117,115,101,115,108,97
+,115,116,116,101,97,109,97,114,109,121,102,111,111,100,107,105,110,103,119,105,
+108,108,101,97,115,116,119,97,114,100,98,101,115,116,102,105,114,101,80,97,103,
+101,107,110,111,119,97,119,97,121,46,112,110,103,109,111,118,101,116,104,97,110,
+108,111,97,100,103,105,118,101,115,101,108,102,110,111,116,101,109,117,99,104,
+102,101,101,100,109,97,110,121,114,111,99,107,105,99,111,110,111,110,99,101,108,
+111,111,107,104,105,100,101,100,105,101,100,72,111,109,101,114,117,108,101,104,
+111,115,116,97,106,97,120,105,110,102,111,99,108,117,98,108,97,119,115,108,101,
+115,115,104,97,108,102,115,111,109,101,115,117,99,104,122,111,110,101,49,48,48,
+37,111,110,101,115,99,97,114,101,84,105,109,101,114,97,99,101,98,108,117,101,102
+,111,117,114,119,101,101,107,102,97,99,101,104,111,112,101,103,97,118,101,104,97
+,114,100,108,111,115,116,119,104,101,110,112,97,114,107,107,101,112,116,112,97,
+115,115,115,104,105,112,114,111,111,109,72,84,77,76,112,108,97,110,84,121,112,
+101,100,111,110,101,115,97,118,101,107,101,101,112,102,108,97,103,108,105,110,
+107,115,111,108,100,102,105,118,101,116,111,111,107,114,97,116,101,116,111,119,
+110,106,117,109,112,116,104,117,115,100,97,114,107,99,97,114,100,102,105,108,101
+,102,101,97,114,115,116,97,121,107,105,108,108,116,104,97,116,102,97,108,108,97,
+117,116,111,101,118,101,114,46,99,111,109,116,97,108,107,115,104,111,112,118,111
+,116,101,100,101,101,112,109,111,100,101,114,101,115,116,116,117,114,110,98,111,
+114,110,98,97,110,100,102,101,108,108,114,111,115,101,117,114,108,40,115,107,105
+,110,114,111,108,101,99,111,109,101,97,99,116,115,97,103,101,115,109,101,101,116
+,103,111,108,100,46,106,112,103,105,116,101,109,118,97,114,121,102,101,108,116,
+116,104,101,110,115,101,110,100,100,114,111,112,86,105,101,119,99,111,112,121,49
+,46,48,34,60,47,97,62,115,116,111,112,101,108,115,101,108,105,101,115,116,111,
+117,114,112,97,99,107,46,103,105,102,112,97,115,116,99,115,115,63,103,114,97,121
+,109,101,97,110,38,103,116,59,114,105,100,101,115,104,111,116,108,97,116,101,115
+,97,105,100,114,111,97,100,118,97,114,32,102,101,101,108,106,111,104,110,114,105
+,99,107,112,111,114,116,102,97,115,116,39,85,65,45,100,101,97,100,60,47,98,62,
+112,111,111,114,98,105,108,108,116,121,112,101,85,46,83,46,119,111,111,100,109,
+117,115,116,50,112,120,59,73,110,102,111,114,97,110,107,119,105,100,101,119,97,
+110,116,119,97,108,108,108,101,97,100,91,48,93,59,112,97,117,108,119,97,118,101,
+115,117,114,101,36,40,39,35,119,97,105,116,109,97,115,115,97,114,109,115,103,111
+,101,115,103,97,105,110,108,97,110,103,112,97,105,100,33,45,45,32,108,111,99,107
+,117,110,105,116,114,111,111,116,119,97,108,107,102,105,114,109,119,105,102,101,
+120,109,108,34,115,111,110,103,116,101,115,116,50,48,112,120,107,105,110,100,114
+,111,119,115,116,111,111,108,102,111,110,116,109,97,105,108,115,97,102,101,115,
+116,97,114,109,97,112,115,99,111,114,101,114,97,105,110,102,108,111,119,98,97,98
+,121,115,112,97,110,115,97,121,115,52,112,120,59,54,112,120,59,97,114,116,115,
+102,111,111,116,114,101,97,108,119,105,107,105,104,101,97,116,115,116,101,112,
+116,114,105,112,111,114,103,47,108,97,107,101,119,101,97,107,116,111,108,100,70,
+111,114,109,99,97,115,116,102,97,110,115,98,97,110,107,118,101,114,121,114,117,
+110,115,106,117,108,121,116,97,115,107,49,112,120,59,103,111,97,108,103,114,101,
+119,115,108,111,119,101,100,103,101,105,100,61,34,115,101,116,115,53,112,120,59,
+46,106,115,63,52,48,112,120,105,102,32,40,115,111,111,110,115,101,97,116,110,111
+,110,101,116,117,98,101,122,101,114,111,115,101,110,116,114,101,101,100,102,97,
+99,116,105,110,116,111,103,105,102,116,104,97,114,109,49,56,112,120,99,97,109,
+101,104,105,108,108,98,111,108,100,122,111,111,109,118,111,105,100,101,97,115,
+121,114,105,110,103,102,105,108,108,112,101,97,107,105,110,105,116,99,111,115,
+116,51,112,120,59,106,97,99,107,116,97,103,115,98,105,116,115,114,111,108,108,
+101,100,105,116,107,110,101,119,110,101,97,114,60,33,45,45,103,114,111,119,74,83
+,79,78,100,117,116,121,78,97,109,101,115,97,108,101,121,111,117,32,108,111,116,
+115,112,97,105,110,106,97,122,122,99,111,108,100,101,121,101,115,102,105,115,104
+,119,119,119,46,114,105,115,107,116,97,98,115,112,114,101,118,49,48,112,120,114,
+105,115,101,50,53,112,120,66,108,117,101,100,105,110,103,51,48,48,44,98,97,108,
+108,102,111,114,100,101,97,114,110,119,105,108,100,98,111,120,46,102,97,105,114,
+108,97,99,107,118,101,114,115,112,97,105,114,106,117,110,101,116,101,99,104,105,
+102,40,33,112,105,99,107,101,118,105,108,36,40,34,35,119,97,114,109,108,111,114,
+100,100,111,101,115,112,117,108,108,44,48,48,48,105,100,101,97,100,114,97,119,
+104,117,103,101,115,112,111,116,102,117,110,100,98,117,114,110,104,114,101,102,
+99,101,108,108,107,101,121,115,116,105,99,107,104,111,117,114,108,111,115,115,
+102,117,101,108,49,50,112,120,115,117,105,116,100,101,97,108,82,83,83,34,97,103,
+101,100,103,114,101,121,71,69,84,34,101,97,115,101,97,105,109,115,103,105,114,
+108,97,105,100,115,56,112,120,59,110,97,118,121,103,114,105,100,116,105,112,115,
+35,57,57,57,119,97,114,115,108,97,100,121,99,97,114,115,41,59,32,125,112,104,112
+,63,104,101,108,108,116,97,108,108,119,104,111,109,122,104,58,229,42,47,13,10,32
+,49,48,48,104,97,108,108,46,10,10,65,55,112,120,59,112,117,115,104,99,104,97,116
+,48,112,120,59,99,114,101,119,42,47,60,47,104,97,115,104,55,53,112,120,102,108,
+97,116,114,97,114,101,32,38,38,32,116,101,108,108,99,97,109,112,111,110,116,111,
+108,97,105,100,109,105,115,115,115,107,105,112,116,101,110,116,102,105,110,101,
+109,97,108,101,103,101,116,115,112,108,111,116,52,48,48,44,13,10,13,10,99,111,
+111,108,102,101,101,116,46,112,104,112,60,98,114,62,101,114,105,99,109,111,115,
+116,103,117,105,100,98,101,108,108,100,101,115,99,104,97,105,114,109,97,116,104,
+97,116,111,109,47,105,109,103,38,35,56,50,108,117,99,107,99,101,110,116,48,48,48
+,59,116,105,110,121,103,111,110,101,104,116,109,108,115,101,108,108,100,114,117,
+103,70,82,69,69,110,111,100,101,110,105,99,107,63,105,100,61,108,111,115,101,110
+,117,108,108,118,97,115,116,119,105,110,100,82,83,83,32,119,101,97,114,114,101,
+108,121,98,101,101,110,115,97,109,101,100,117,107,101,110,97,115,97,99,97,112,
+101,119,105,115,104,103,117,108,102,84,50,51,58,104,105,116,115,115,108,111,116,
+103,97,116,101,107,105,99,107,98,108,117,114,116,104,101,121,49,53,112,120,39,39
+,41,59,41,59,34,62,109,115,105,101,119,105,110,115,98,105,114,100,115,111,114,
+116,98,101,116,97,115,101,101,107,84,49,56,58,111,114,100,115,116,114,101,101,
+109,97,108,108,54,48,112,120,102,97,114,109,226,128,153,115,98,111,121,115,91,48
+,93,46,39,41,59,34,80,79,83,84,98,101,97,114,107,105,100,115,41,59,125,125,109,
+97,114,121,116,101,110,100,40,85,75,41,113,117,97,100,122,104,58,230,45,115,105,
+122,45,45,45,45,112,114,111,112,39,41,59,13,108,105,102,116,84,49,57,58,118,105,
+99,101,97,110,100,121,100,101,98,116,62,82,83,83,112,111,111,108,110,101,99,107,
+98,108,111,119,84,49,54,58,100,111,111,114,101,118,97,108,84,49,55,58,108,101,
+116,115,102,97,105,108,111,114,97,108,112,111,108,108,110,111,118,97,99,111,108,
+115,103,101,110,101,32,226,128,148,115,111,102,116,114,111,109,101,116,105,108,
+108,114,111,115,115,60,104,51,62,112,111,117,114,102,97,100,101,112,105,110,107,
+60,116,114,62,109,105,110,105,41,124,33,40,109,105,110,101,122,104,58,232,98,97,
+114,115,104,101,97,114,48,48,41,59,109,105,108,107,32,45,45,62,105,114,111,110,
+102,114,101,100,100,105,115,107,119,101,110,116,115,111,105,108,112,117,116,115,
+47,106,115,47,104,111,108,121,84,50,50,58,73,83,66,78,84,50,48,58,97,100,97,109,
+115,101,101,115,60,104,50,62,106,115,111,110,39,44,32,39,99,111,110,116,84,50,49
+,58,32,82,83,83,108,111,111,112,97,115,105,97,109,111,111,110,60,47,112,62,115,
+111,117,108,76,73,78,69,102,111,114,116,99,97,114,116,84,49,52,58,60,104,49,62,
+56,48,112,120,33,45,45,60,57,112,120,59,84,48,52,58,109,105,107,101,58,52,54,90,
+110,105,99,101,105,110,99,104,89,111,114,107,114,105,99,101,122,104,58,228,39,41
+,41,59,112,117,114,101,109,97,103,101,112,97,114,97,116,111,110,101,98,111,110,
+100,58,51,55,90,95,111,102,95,39,93,41,59,48,48,48,44,122,104,58,231,116,97,110,
+107,121,97,114,100,98,111,119,108,98,117,115,104,58,53,54,90,74,97,118,97,51,48,
+112,120,10,124,125,10,37,67,51,37,58,51,52,90,106,101,102,102,69,88,80,73,99,97,
+115,104,118,105,115,97,103,111,108,102,115,110,111,119,122,104,58,233,113,117,
+101,114,46,99,115,115,115,105,99,107,109,101,97,116,109,105,110,46,98,105,110,
+100,100,101,108,108,104,105,114,101,112,105,99,115,114,101,110,116,58,51,54,90,
+72,84,84,80,45,50,48,49,102,111,116,111,119,111,108,102,69,78,68,32,120,98,111,
+120,58,53,52,90,66,79,68,89,100,105,99,107,59,10,125,10,101,120,105,116,58,51,53
+,90,118,97,114,115,98,101,97,116,39,125,41,59,100,105,101,116,57,57,57,59,97,110
+,110,101,125,125,60,47,91,105,93,46,76,97,110,103,107,109,194,178,119,105,114,
+101,116,111,121,115,97,100,100,115,115,101,97,108,97,108,101,120,59,10,9,125,101
+,99,104,111,110,105,110,101,46,111,114,103,48,48,53,41,116,111,110,121,106,101,
+119,115,115,97,110,100,108,101,103,115,114,111,111,102,48,48,48,41,32,50,48,48,
+119,105,110,101,103,101,97,114,100,111,103,115,98,111,111,116,103,97,114,121,99,
+117,116,115,116,121,108,101,116,101,109,112,116,105,111,110,46,120,109,108,99,
+111,99,107,103,97,110,103,36,40,39,46,53,48,112,120,80,104,46,68,109,105,115,99,
+97,108,97,110,108,111,97,110,100,101,115,107,109,105,108,101,114,121,97,110,117,
+110,105,120,100,105,115,99,41,59,125,10,100,117,115,116,99,108,105,112,41,46,10,
+10,55,48,112,120,45,50,48,48,68,86,68,115,55,93,62,60,116,97,112,101,100,101,109
+,111,105,43,43,41,119,97,103,101,101,117,114,111,112,104,105,108,111,112,116,115
+,104,111,108,101,70,65,81,115,97,115,105,110,45,50,54,84,108,97,98,115,112,101,
+116,115,85,82,76,32,98,117,108,107,99,111,111,107,59,125,13,10,72,69,65,68,91,48
+,93,41,97,98,98,114,106,117,97,110,40,49,57,56,108,101,115,104,116,119,105,110,
+60,47,105,62,115,111,110,121,103,117,121,115,102,117,99,107,112,105,112,101,124,
+45,10,33,48,48,50,41,110,100,111,119,91,49,93,59,91,93,59,10,76,111,103,32,115,
+97,108,116,13,10,9,9,98,97,110,103,116,114,105,109,98,97,116,104,41,123,13,10,48
+,48,112,120,10,125,41,59,107,111,58,236,102,101,101,115,97,100,62,13,115,58,47,
+47,32,91,93,59,116,111,108,108,112,108,117,103,40,41,123,10,123,13,10,32,46,106,
+115,39,50,48,48,112,100,117,97,108,98,111,97,116,46,74,80,71,41,59,10,125,113,
+117,111,116,41,59,10,10,39,41,59,10,13,10,125,13,50,48,49,52,50,48,49,53,50,48,
+49,54,50,48,49,55,50,48,49,56,50,48,49,57,50,48,50,48,50,48,50,49,50,48,50,50,50
+,48,50,51,50,48,50,52,50,48,50,53,50,48,50,54,50,48,50,55,50,48,50,56,50,48,50,
+57,50,48,51,48,50,48,51,49,50,48,51,50,50,48,51,51,50,48,51,52,50,48,51,53,50,48
+,51,54,50,48,51,55,50,48,49,51,50,48,49,50,50,48,49,49,50,48,49,48,50,48,48,57,
+50,48,48,56,50,48,48,55,50,48,48,54,50,48,48,53,50,48,48,52,50,48,48,51,50,48,48
+,50,50,48,48,49,50,48,48,48,49,57,57,57,49,57,57,56,49,57,57,55,49,57,57,54,49,
+57,57,53,49,57,57,52,49,57,57,51,49,57,57,50,49,57,57,49,49,57,57,48,49,57,56,57
+,49,57,56,56,49,57,56,55,49,57,56,54,49,57,56,53,49,57,56,52,49,57,56,51,49,57,
+56,50,49,57,56,49,49,57,56,48,49,57,55,57,49,57,55,56,49,57,55,55,49,57,55,54,49
+,57,55,53,49,57,55,52,49,57,55,51,49,57,55,50,49,57,55,49,49,57,55,48,49,57,54,
+57,49,57,54,56,49,57,54,55,49,57,54,54,49,57,54,53,49,57,54,52,49,57,54,51,49,57
+,54,50,49,57,54,49,49,57,54,48,49,57,53,57,49,57,53,56,49,57,53,55,49,57,53,54,
+49,57,53,53,49,57,53,52,49,57,53,51,49,57,53,50,49,57,53,49,49,57,53,48,49,48,48
+,48,49,48,50,52,49,51,57,52,48,48,48,48,57,57,57,57,99,111,109,111,109,195,161,
+115,101,115,116,101,101,115,116,97,112,101,114,111,116,111,100,111,104,97,99,101
+,99,97,100,97,97,195,177,111,98,105,101,110,100,195,173,97,97,115,195,173,118,
+105,100,97,99,97,115,111,111,116,114,111,102,111,114,111,115,111,108,111,111,116
+,114,97,99,117,97,108,100,105,106,111,115,105,100,111,103,114,97,110,116,105,112
+,111,116,101,109,97,100,101,98,101,97,108,103,111,113,117,195,169,101,115,116,
+111,110,97,100,97,116,114,101,115,112,111,99,111,99,97,115,97,98,97,106,111,116,
+111,100,97,115,105,110,111,97,103,117,97,112,117,101,115,117,110,111,115,97,110,
+116,101,100,105,99,101,108,117,105,115,101,108,108,97,109,97,121,111,122,111,110
+,97,97,109,111,114,112,105,115,111,111,98,114,97,99,108,105,99,101,108,108,111,
+100,105,111,115,104,111,114,97,99,97,115,105,208,183,208,176,208,189,208,176,208
+,190,208,188,209,128,208,176,209,128,209,131,209,130,208,176,208,189,208,181,208
+,191,208,190,208,190,209,130,208,184,208,183,208,189,208,190,208,180,208,190,209
+,130,208,190,208,182,208,181,208,190,208,189,208,184,209,133,208,157,208,176,208
+,181,208,181,208,177,209,139,208,188,209,139,208,146,209,139,209,129,208,190,208
+,178,209,139,208,178,208,190,208,157,208,190,208,190,208,177,208,159,208,190,208
+,187,208,184,208,189,208,184,208,160,208,164,208,157,208,181,208,156,209,139,209
+,130,209,139,208,158,208,189,208,184,208,188,208,180,208,176,208,151,208,176,208
+,148,208,176,208,157,209,131,208,158,208,177,209,130,208,181,208,152,208,183,208
+,181,208,185,208,189,209,131,208,188,208,188,208,162,209,139,209,131,208,182,217
+,129,217,138,216,163,217,134,217,133,216,167,217,133,216,185,217,131,217,132,216
+,163,217,136,216,177,216,175,217,138,216,167,217,129,217,137,217,135,217,136,217
+,132,217,133,217,132,217,131,216,167,217,136,217,132,217,135,216,168,216,179,216
+,167,217,132,216,165,217,134,217,135,217,138,216,163,217,138,217,130,216,175,217
+,135,217,132,216,171,217,133,216,168,217,135,217,132,217,136,217,132,217,138,216
+,168,217,132,216,167,217,138,216,168,217,131,216,180,217,138,216,167,217,133,216
+,163,217,133,217,134,216,170,216,168,217,138,217,132,217,134,216,173,216,168,217
+,135,217,133,217,133,216,180,217,136,216,180,102,105,114,115,116,118,105,100,101
+,111,108,105,103,104,116,119,111,114,108,100,109,101,100,105,97,119,104,105,116,
+101,99,108,111,115,101,98,108,97,99,107,114,105,103,104,116,115,109,97,108,108,
+98,111,111,107,115,112,108,97,99,101,109,117,115,105,99,102,105,101,108,100,111,
+114,100,101,114,112,111,105,110,116,118,97,108,117,101,108,101,118,101,108,116,
+97,98,108,101,98,111,97,114,100,104,111,117,115,101,103,114,111,117,112,119,111,
+114,107,115,121,101,97,114,115,115,116,97,116,101,116,111,100,97,121,119,97,116,
+101,114,115,116,97,114,116,115,116,121,108,101,100,101,97,116,104,112,111,119,
+101,114,112,104,111,110,101,110,105,103,104,116,101,114,114,111,114,105,110,112,
+117,116,97,98,111,117,116,116,101,114,109,115,116,105,116,108,101,116,111,111,
+108,115,101,118,101,110,116,108,111,99,97,108,116,105,109,101,115,108,97,114,103
+,101,119,111,114,100,115,103,97,109,101,115,115,104,111,114,116,115,112,97,99,
+101,102,111,99,117,115,99,108,101,97,114,109,111,100,101,108,98,108,111,99,107,
+103,117,105,100,101,114,97,100,105,111,115,104,97,114,101,119,111,109,101,110,97
+,103,97,105,110,109,111,110,101,121,105,109,97,103,101,110,97,109,101,115,121,
+111,117,110,103,108,105,110,101,115,108,97,116,101,114,99,111,108,111,114,103,
+114,101,101,110,102,114,111,110,116,38,97,109,112,59,119,97,116,99,104,102,111,
+114,99,101,112,114,105,99,101,114,117,108,101,115,98,101,103,105,110,97,102,116,
+101,114,118,105,115,105,116,105,115,115,117,101,97,114,101,97,115,98,101,108,111
+,119,105,110,100,101,120,116,111,116,97,108,104,111,117,114,115,108,97,98,101,
+108,112,114,105,110,116,112,114,101,115,115,98,117,105,108,116,108,105,110,107,
+115,115,112,101,101,100,115,116,117,100,121,116,114,97,100,101,102,111,117,110,
+100,115,101,110,115,101,117,110,100,101,114,115,104,111,119,110,102,111,114,109,
+115,114,97,110,103,101,97,100,100,101,100,115,116,105,108,108,109,111,118,101,
+100,116,97,107,101,110,97,98,111,118,101,102,108,97,115,104,102,105,120,101,100,
+111,102,116,101,110,111,116,104,101,114,118,105,101,119,115,99,104,101,99,107,
+108,101,103,97,108,114,105,118,101,114,105,116,101,109,115,113,117,105,99,107,
+115,104,97,112,101,104,117,109,97,110,101,120,105,115,116,103,111,105,110,103,
+109,111,118,105,101,116,104,105,114,100,98,97,115,105,99,112,101,97,99,101,115,
+116,97,103,101,119,105,100,116,104,108,111,103,105,110,105,100,101,97,115,119,
+114,111,116,101,112,97,103,101,115,117,115,101,114,115,100,114,105,118,101,115,
+116,111,114,101,98,114,101,97,107,115,111,117,116,104,118,111,105,99,101,115,105
+,116,101,115,109,111,110,116,104,119,104,101,114,101,98,117,105,108,100,119,104,
+105,99,104,101,97,114,116,104,102,111,114,117,109,116,104,114,101,101,115,112,
+111,114,116,112,97,114,116,121,67,108,105,99,107,108,111,119,101,114,108,105,118
+,101,115,99,108,97,115,115,108,97,121,101,114,101,110,116,114,121,115,116,111,
+114,121,117,115,97,103,101,115,111,117,110,100,99,111,117,114,116,121,111,117,
+114,32,98,105,114,116,104,112,111,112,117,112,116,121,112,101,115,97,112,112,108
+,121,73,109,97,103,101,98,101,105,110,103,117,112,112,101,114,110,111,116,101,
+115,101,118,101,114,121,115,104,111,119,115,109,101,97,110,115,101,120,116,114,
+97,109,97,116,99,104,116,114,97,99,107,107,110,111,119,110,101,97,114,108,121,98
+,101,103,97,110,115,117,112,101,114,112,97,112,101,114,110,111,114,116,104,108,
+101,97,114,110,103,105,118,101,110,110,97,109,101,100,101,110,100,101,100,84,101
+,114,109,115,112,97,114,116,115,71,114,111,117,112,98,114,97,110,100,117,115,105
+,110,103,119,111,109,97,110,102,97,108,115,101,114,101,97,100,121,97,117,100,105
+,111,116,97,107,101,115,119,104,105,108,101,46,99,111,109,47,108,105,118,101,100
+,99,97,115,101,115,100,97,105,108,121,99,104,105,108,100,103,114,101,97,116,106,
+117,100,103,101,116,104,111,115,101,117,110,105,116,115,110,101,118,101,114,98,
+114,111,97,100,99,111,97,115,116,99,111,118,101,114,97,112,112,108,101,102,105,
+108,101,115,99,121,99,108,101,115,99,101,110,101,112,108,97,110,115,99,108,105,
+99,107,119,114,105,116,101,113,117,101,101,110,112,105,101,99,101,101,109,97,105
+,108,102,114,97,109,101,111,108,100,101,114,112,104,111,116,111,108,105,109,105,
+116,99,97,99,104,101,99,105,118,105,108,115,99,97,108,101,101,110,116,101,114,
+116,104,101,109,101,116,104,101,114,101,116,111,117,99,104,98,111,117,110,100,
+114,111,121,97,108,97,115,107,101,100,119,104,111,108,101,115,105,110,99,101,115
+,116,111,99,107,32,110,97,109,101,102,97,105,116,104,104,101,97,114,116,101,109,
+112,116,121,111,102,102,101,114,115,99,111,112,101,111,119,110,101,100,109,105,
+103,104,116,97,108,98,117,109,116,104,105,110,107,98,108,111,111,100,97,114,114,
+97,121,109,97,106,111,114,116,114,117,115,116,99,97,110,111,110,117,110,105,111,
+110,99,111,117,110,116,118,97,108,105,100,115,116,111,110,101,83,116,121,108,101
+,76,111,103,105,110,104,97,112,112,121,111,99,99,117,114,108,101,102,116,58,102,
+114,101,115,104,113,117,105,116,101,102,105,108,109,115,103,114,97,100,101,110,
+101,101,100,115,117,114,98,97,110,102,105,103,104,116,98,97,115,105,115,104,111,
+118,101,114,97,117,116,111,59,114,111,117,116,101,46,104,116,109,108,109,105,120
+,101,100,102,105,110,97,108,89,111,117,114,32,115,108,105,100,101,116,111,112,
+105,99,98,114,111,119,110,97,108,111,110,101,100,114,97,119,110,115,112,108,105,
+116,114,101,97,99,104,82,105,103,104,116,100,97,116,101,115,109,97,114,99,104,
+113,117,111,116,101,103,111,111,100,115,76,105,110,107,115,100,111,117,98,116,97
+,115,121,110,99,116,104,117,109,98,97,108,108,111,119,99,104,105,101,102,121,111
+,117,116,104,110,111,118,101,108,49,48,112,120,59,115,101,114,118,101,117,110,
+116,105,108,104,97,110,100,115,67,104,101,99,107,83,112,97,99,101,113,117,101,
+114,121,106,97,109,101,115,101,113,117,97,108,116,119,105,99,101,48,44,48,48,48,
+83,116,97,114,116,112,97,110,101,108,115,111,110,103,115,114,111,117,110,100,101
+,105,103,104,116,115,104,105,102,116,119,111,114,116,104,112,111,115,116,115,108
+,101,97,100,115,119,101,101,107,115,97,118,111,105,100,116,104,101,115,101,109,
+105,108,101,115,112,108,97,110,101,115,109,97,114,116,97,108,112,104,97,112,108,
+97,110,116,109,97,114,107,115,114,97,116,101,115,112,108,97,121,115,99,108,97,
+105,109,115,97,108,101,115,116,101,120,116,115,115,116,97,114,115,119,114,111,
+110,103,60,47,104,51,62,116,104,105,110,103,46,111,114,103,47,109,117,108,116,
+105,104,101,97,114,100,80,111,119,101,114,115,116,97,110,100,116,111,107,101,110
+,115,111,108,105,100,40,116,104,105,115,98,114,105,110,103,115,104,105,112,115,
+115,116,97,102,102,116,114,105,101,100,99,97,108,108,115,102,117,108,108,121,102
+,97,99,116,115,97,103,101,110,116,84,104,105,115,32,47,47,45,45,62,97,100,109,
+105,110,101,103,121,112,116,69,118,101,110,116,49,53,112,120,59,69,109,97,105,
+108,116,114,117,101,34,99,114,111,115,115,115,112,101,110,116,98,108,111,103,115
+,98,111,120,34,62,110,111,116,101,100,108,101,97,118,101,99,104,105,110,97,115,
+105,122,101,115,103,117,101,115,116,60,47,104,52,62,114,111,98,111,116,104,101,
+97,118,121,116,114,117,101,44,115,101,118,101,110,103,114,97,110,100,99,114,105,
+109,101,115,105,103,110,115,97,119,97,114,101,100,97,110,99,101,112,104,97,115,
+101,62,60,33,45,45,101,110,95,85,83,38,35,51,57,59,50,48,48,112,120,95,110,97,
+109,101,108,97,116,105,110,101,110,106,111,121,97,106,97,120,46,97,116,105,111,
+110,115,109,105,116,104,85,46,83,46,32,104,111,108,100,115,112,101,116,101,114,
+105,110,100,105,97,110,97,118,34,62,99,104,97,105,110,115,99,111,114,101,99,111,
+109,101,115,100,111,105,110,103,112,114,105,111,114,83,104,97,114,101,49,57,57,
+48,115,114,111,109,97,110,108,105,115,116,115,106,97,112,97,110,102,97,108,108,
+115,116,114,105,97,108,111,119,110,101,114,97,103,114,101,101,60,47,104,50,62,97
+,98,117,115,101,97,108,101,114,116,111,112,101,114,97,34,45,47,47,87,99,97,114,
+100,115,104,105,108,108,115,116,101,97,109,115,80,104,111,116,111,116,114,117,
+116,104,99,108,101,97,110,46,112,104,112,63,115,97,105,110,116,109,101,116,97,
+108,108,111,117,105,115,109,101,97,110,116,112,114,111,111,102,98,114,105,101,
+102,114,111,119,34,62,103,101,110,114,101,116,114,117,99,107,108,111,111,107,115
+,86,97,108,117,101,70,114,97,109,101,46,110,101,116,47,45,45,62,10,60,116,114,
+121,32,123,10,118,97,114,32,109,97,107,101,115,99,111,115,116,115,112,108,97,105
+,110,97,100,117,108,116,113,117,101,115,116,116,114,97,105,110,108,97,98,111,114
+,104,101,108,112,115,99,97,117,115,101,109,97,103,105,99,109,111,116,111,114,116
+,104,101,105,114,50,53,48,112,120,108,101,97,115,116,115,116,101,112,115,67,111,
+117,110,116,99,111,117,108,100,103,108,97,115,115,115,105,100,101,115,102,117,
+110,100,115,104,111,116,101,108,97,119,97,114,100,109,111,117,116,104,109,111,
+118,101,115,112,97,114,105,115,103,105,118,101,115,100,117,116,99,104,116,101,
+120,97,115,102,114,117,105,116,110,117,108,108,44,124,124,91,93,59,116,111,112,
+34,62,10,60,33,45,45,80,79,83,84,34,111,99,101,97,110,60,98,114,47,62,102,108,
+111,111,114,115,112,101,97,107,100,101,112,116,104,32,115,105,122,101,98,97,110,
+107,115,99,97,116,99,104,99,104,97,114,116,50,48,112,120,59,97,108,105,103,110,
+100,101,97,108,115,119,111,117,108,100,53,48,112,120,59,117,114,108,61,34,112,97
+,114,107,115,109,111,117,115,101,77,111,115,116,32,46,46,46,60,47,97,109,111,110
+,103,98,114,97,105,110,98,111,100,121,32,110,111,110,101,59,98,97,115,101,100,99
+,97,114,114,121,100,114,97,102,116,114,101,102,101,114,112,97,103,101,95,104,111
+,109,101,46,109,101,116,101,114,100,101,108,97,121,100,114,101,97,109,112,114,
+111,118,101,106,111,105,110,116,60,47,116,114,62,100,114,117,103,115,60,33,45,45
+,32,97,112,114,105,108,105,100,101,97,108,97,108,108,101,110,101,120,97,99,116,
+102,111,114,116,104,99,111,100,101,115,108,111,103,105,99,86,105,101,119,32,115,
+101,101,109,115,98,108,97,110,107,112,111,114,116,115,32,40,50,48,48,115,97,118,
+101,100,95,108,105,110,107,103,111,97,108,115,103,114,97,110,116,103,114,101,101
+,107,104,111,109,101,115,114,105,110,103,115,114,97,116,101,100,51,48,112,120,59
+,119,104,111,115,101,112,97,114,115,101,40,41,59,34,32,66,108,111,99,107,108,105
+,110,117,120,106,111,110,101,115,112,105,120,101,108,39,41,59,34,62,41,59,105,
+102,40,45,108,101,102,116,100,97,118,105,100,104,111,114,115,101,70,111,99,117,
+115,114,97,105,115,101,98,111,120,101,115,84,114,97,99,107,101,109,101,110,116,
+60,47,101,109,62,98,97,114,34,62,46,115,114,99,61,116,111,119,101,114,97,108,116
+,61,34,99,97,98,108,101,104,101,110,114,121,50,52,112,120,59,115,101,116,117,112
+,105,116,97,108,121,115,104,97,114,112,109,105,110,111,114,116,97,115,116,101,
+119,97,110,116,115,116,104,105,115,46,114,101,115,101,116,119,104,101,101,108,
+103,105,114,108,115,47,99,115,115,47,49,48,48,37,59,99,108,117,98,115,115,116,
+117,102,102,98,105,98,108,101,118,111,116,101,115,32,49,48,48,48,107,111,114,101
+,97,125,41,59,13,10,98,97,110,100,115,113,117,101,117,101,61,32,123,125,59,56,48
+,112,120,59,99,107,105,110,103,123,13,10,9,9,97,104,101,97,100,99,108,111,99,107
+,105,114,105,115,104,108,105,107,101,32,114,97,116,105,111,115,116,97,116,115,70
+,111,114,109,34,121,97,104,111,111,41,91,48,93,59,65,98,111,117,116,102,105,110,
+100,115,60,47,104,49,62,100,101,98,117,103,116,97,115,107,115,85,82,76,32,61,99,
+101,108,108,115,125,41,40,41,59,49,50,112,120,59,112,114,105,109,101,116,101,108
+,108,115,116,117,114,110,115,48,120,54,48,48,46,106,112,103,34,115,112,97,105,
+110,98,101,97,99,104,116,97,120,101,115,109,105,99,114,111,97,110,103,101,108,45
+,45,62,60,47,103,105,102,116,115,115,116,101,118,101,45,108,105,110,107,98,111,
+100,121,46,125,41,59,10,9,109,111,117,110,116,32,40,49,57,57,70,65,81,60,47,114,
+111,103,101,114,102,114,97,110,107,67,108,97,115,115,50,56,112,120,59,102,101,
+101,100,115,60,104,49,62,60,115,99,111,116,116,116,101,115,116,115,50,50,112,120
+,59,100,114,105,110,107,41,32,124,124,32,108,101,119,105,115,115,104,97,108,108,
+35,48,51,57,59,32,102,111,114,32,108,111,118,101,100,119,97,115,116,101,48,48,
+112,120,59,106,97,58,227,130,115,105,109,111,110,60,102,111,110,116,114,101,112,
+108,121,109,101,101,116,115,117,110,116,101,114,99,104,101,97,112,116,105,103,
+104,116,66,114,97,110,100,41,32,33,61,32,100,114,101,115,115,99,108,105,112,115,
+114,111,111,109,115,111,110,107,101,121,109,111,98,105,108,109,97,105,110,46,78,
+97,109,101,32,112,108,97,116,101,102,117,110,110,121,116,114,101,101,115,99,111,
+109,47,34,49,46,106,112,103,119,109,111,100,101,112,97,114,97,109,83,84,65,82,84
+,108,101,102,116,32,105,100,100,101,110,44,32,50,48,49,41,59,10,125,10,102,111,
+114,109,46,118,105,114,117,115,99,104,97,105,114,116,114,97,110,115,119,111,114,
+115,116,80,97,103,101,115,105,116,105,111,110,112,97,116,99,104,60,33,45,45,10,
+111,45,99,97,99,102,105,114,109,115,116,111,117,114,115,44,48,48,48,32,97,115,
+105,97,110,105,43,43,41,123,97,100,111,98,101,39,41,91,48,93,105,100,61,49,48,98
+,111,116,104,59,109,101,110,117,32,46,50,46,109,105,46,112,110,103,34,107,101,
+118,105,110,99,111,97,99,104,67,104,105,108,100,98,114,117,99,101,50,46,106,112,
+103,85,82,76,41,43,46,106,112,103,124,115,117,105,116,101,115,108,105,99,101,104
+,97,114,114,121,49,50,48,34,32,115,119,101,101,116,116,114,62,13,10,110,97,109,
+101,61,100,105,101,103,111,112,97,103,101,32,115,119,105,115,115,45,45,62,10,10,
+35,102,102,102,59,34,62,76,111,103,46,99,111,109,34,116,114,101,97,116,115,104,
+101,101,116,41,32,38,38,32,49,52,112,120,59,115,108,101,101,112,110,116,101,110,
+116,102,105,108,101,100,106,97,58,227,131,105,100,61,34,99,78,97,109,101,34,119,
+111,114,115,101,115,104,111,116,115,45,98,111,120,45,100,101,108,116,97,10,38,
+108,116,59,98,101,97,114,115,58,52,56,90,60,100,97,116,97,45,114,117,114,97,108,
+60,47,97,62,32,115,112,101,110,100,98,97,107,101,114,115,104,111,112,115,61,32,
+34,34,59,112,104,112,34,62,99,116,105,111,110,49,51,112,120,59,98,114,105,97,110
+,104,101,108,108,111,115,105,122,101,61,111,61,37,50,70,32,106,111,105,110,109,
+97,121,98,101,60,105,109,103,32,105,109,103,34,62,44,32,102,106,115,105,109,103,
+34,32,34,41,91,48,93,77,84,111,112,66,84,121,112,101,34,110,101,119,108,121,68,
+97,110,115,107,99,122,101,99,104,116,114,97,105,108,107,110,111,119,115,60,47,
+104,53,62,102,97,113,34,62,122,104,45,99,110,49,48,41,59,10,45,49,34,41,59,116,
+121,112,101,61,98,108,117,101,115,116,114,117,108,121,100,97,118,105,115,46,106,
+115,39,59,62,13,10,60,33,115,116,101,101,108,32,121,111,117,32,104,50,62,13,10,
+102,111,114,109,32,106,101,115,117,115,49,48,48,37,32,109,101,110,117,46,13,10,9
+,13,10,119,97,108,101,115,114,105,115,107,115,117,109,101,110,116,100,100,105,
+110,103,98,45,108,105,107,116,101,97,99,104,103,105,102,34,32,118,101,103,97,115
+,100,97,110,115,107,101,101,115,116,105,115,104,113,105,112,115,117,111,109,105,
+115,111,98,114,101,100,101,115,100,101,101,110,116,114,101,116,111,100,111,115,
+112,117,101,100,101,97,195,177,111,115,101,115,116,195,161,116,105,101,110,101,
+104,97,115,116,97,111,116,114,111,115,112,97,114,116,101,100,111,110,100,101,110
+,117,101,118,111,104,97,99,101,114,102,111,114,109,97,109,105,115,109,111,109,
+101,106,111,114,109,117,110,100,111,97,113,117,195,173,100,195,173,97,115,115,
+195,179,108,111,97,121,117,100,97,102,101,99,104,97,116,111,100,97,115,116,97,
+110,116,111,109,101,110,111,115,100,97,116,111,115,111,116,114,97,115,115,105,
+116,105,111,109,117,99,104,111,97,104,111,114,97,108,117,103,97,114,109,97,121,
+111,114,101,115,116,111,115,104,111,114,97,115,116,101,110,101,114,97,110,116,
+101,115,102,111,116,111,115,101,115,116,97,115,112,97,195,173,115,110,117,101,
+118,97,115,97,108,117,100,102,111,114,111,115,109,101,100,105,111,113,117,105,
+101,110,109,101,115,101,115,112,111,100,101,114,99,104,105,108,101,115,101,114,
+195,161,118,101,99,101,115,100,101,99,105,114,106,111,115,195,169,101,115,116,97
+,114,118,101,110,116,97,103,114,117,112,111,104,101,99,104,111,101,108,108,111,
+115,116,101,110,103,111,97,109,105,103,111,99,111,115,97,115,110,105,118,101,108
+,103,101,110,116,101,109,105,115,109,97,97,105,114,101,115,106,117,108,105,111,
+116,101,109,97,115,104,97,99,105,97,102,97,118,111,114,106,117,110,105,111,108,
+105,98,114,101,112,117,110,116,111,98,117,101,110,111,97,117,116,111,114,97,98,
+114,105,108,98,117,101,110,97,116,101,120,116,111,109,97,114,122,111,115,97,98,
+101,114,108,105,115,116,97,108,117,101,103,111,99,195,179,109,111,101,110,101,
+114,111,106,117,101,103,111,112,101,114,195,186,104,97,98,101,114,101,115,116,
+111,121,110,117,110,99,97,109,117,106,101,114,118,97,108,111,114,102,117,101,114
+,97,108,105,98,114,111,103,117,115,116,97,105,103,117,97,108,118,111,116,111,115
+,99,97,115,111,115,103,117,195,173,97,112,117,101,100,111,115,111,109,111,115,97
+,118,105,115,111,117,115,116,101,100,100,101,98,101,110,110,111,99,104,101,98,
+117,115,99,97,102,97,108,116,97,101,117,114,111,115,115,101,114,105,101,100,105,
+99,104,111,99,117,114,115,111,99,108,97,118,101,99,97,115,97,115,108,101,195,179
+,110,112,108,97,122,111,108,97,114,103,111,111,98,114,97,115,118,105,115,116,97,
+97,112,111,121,111,106,117,110,116,111,116,114,97,116,97,118,105,115,116,111,99,
+114,101,97,114,99,97,109,112,111,104,101,109,111,115,99,105,110,99,111,99,97,114
+,103,111,112,105,115,111,115,111,114,100,101,110,104,97,99,101,110,195,161,114,
+101,97,100,105,115,99,111,112,101,100,114,111,99,101,114,99,97,112,117,101,100,
+97,112,97,112,101,108,109,101,110,111,114,195,186,116,105,108,99,108,97,114,111,
+106,111,114,103,101,99,97,108,108,101,112,111,110,101,114,116,97,114,100,101,110
+,97,100,105,101,109,97,114,99,97,115,105,103,117,101,101,108,108,97,115,115,105,
+103,108,111,99,111,99,104,101,109,111,116,111,115,109,97,100,114,101,99,108,97,
+115,101,114,101,115,116,111,110,105,195,177,111,113,117,101,100,97,112,97,115,97
+,114,98,97,110,99,111,104,105,106,111,115,118,105,97,106,101,112,97,98,108,111,
+195,169,115,116,101,118,105,101,110,101,114,101,105,110,111,100,101,106,97,114,
+102,111,110,100,111,99,97,110,97,108,110,111,114,116,101,108,101,116,114,97,99,
+97,117,115,97,116,111,109,97,114,109,97,110,111,115,108,117,110,101,115,97,117,
+116,111,115,118,105,108,108,97,118,101,110,100,111,112,101,115,97,114,116,105,
+112,111,115,116,101,110,103,97,109,97,114,99,111,108,108,101,118,97,112,97,100,
+114,101,117,110,105,100,111,118,97,109,111,115,122,111,110,97,115,97,109,98,111,
+115,98,97,110,100,97,109,97,114,105,97,97,98,117,115,111,109,117,99,104,97,115,
+117,98,105,114,114,105,111,106,97,118,105,118,105,114,103,114,97,100,111,99,104,
+105,99,97,97,108,108,195,173,106,111,118,101,110,100,105,99,104,97,101,115,116,
+97,110,116,97,108,101,115,115,97,108,105,114,115,117,101,108,111,112,101,115,111
+,115,102,105,110,101,115,108,108,97,109,97,98,117,115,99,111,195,169,115,116,97,
+108,108,101,103,97,110,101,103,114,111,112,108,97,122,97,104,117,109,111,114,112
+,97,103,97,114,106,117,110,116,97,100,111,98,108,101,105,115,108,97,115,98,111,
+108,115,97,98,97,195,177,111,104,97,98,108,97,108,117,99,104,97,195,129,114,101,
+97,100,105,99,101,110,106,117,103,97,114,110,111,116,97,115,118,97,108,108,101,
+97,108,108,195,161,99,97,114,103,97,100,111,108,111,114,97,98,97,106,111,101,115
+,116,195,169,103,117,115,116,111,109,101,110,116,101,109,97,114,105,111,102,105,
+114,109,97,99,111,115,116,111,102,105,99,104,97,112,108,97,116,97,104,111,103,97
+,114,97,114,116,101,115,108,101,121,101,115,97,113,117,101,108,109,117,115,101,
+111,98,97,115,101,115,112,111,99,111,115,109,105,116,97,100,99,105,101,108,111,
+99,104,105,99,111,109,105,101,100,111,103,97,110,97,114,115,97,110,116,111,101,
+116,97,112,97,100,101,98,101,115,112,108,97,121,97,114,101,100,101,115,115,105,
+101,116,101,99,111,114,116,101,99,111,114,101,97,100,117,100,97,115,100,101,115,
+101,111,118,105,101,106,111,100,101,115,101,97,97,103,117,97,115,38,113,117,111,
+116,59,100,111,109,97,105,110,99,111,109,109,111,110,115,116,97,116,117,115,101,
+118,101,110,116,115,109,97,115,116,101,114,115,121,115,116,101,109,97,99,116,105
+,111,110,98,97,110,110,101,114,114,101,109,111,118,101,115,99,114,111,108,108,
+117,112,100,97,116,101,103,108,111,98,97,108,109,101,100,105,117,109,102,105,108
+,116,101,114,110,117,109,98,101,114,99,104,97,110,103,101,114,101,115,117,108,
+116,112,117,98,108,105,99,115,99,114,101,101,110,99,104,111,111,115,101,110,111,
+114,109,97,108,116,114,97,118,101,108,105,115,115,117,101,115,115,111,117,114,99
+,101,116,97,114,103,101,116,115,112,114,105,110,103,109,111,100,117,108,101,109,
+111,98,105,108,101,115,119,105,116,99,104,112,104,111,116,111,115,98,111,114,100
+,101,114,114,101,103,105,111,110,105,116,115,101,108,102,115,111,99,105,97,108,
+97,99,116,105,118,101,99,111,108,117,109,110,114,101,99,111,114,100,102,111,108,
+108,111,119,116,105,116,108,101,62,101,105,116,104,101,114,108,101,110,103,116,
+104,102,97,109,105,108,121,102,114,105,101,110,100,108,97,121,111,117,116,97,117
+,116,104,111,114,99,114,101,97,116,101,114,101,118,105,101,119,115,117,109,109,
+101,114,115,101,114,118,101,114,112,108,97,121,101,100,112,108,97,121,101,114,
+101,120,112,97,110,100,112,111,108,105,99,121,102,111,114,109,97,116,100,111,117
+,98,108,101,112,111,105,110,116,115,115,101,114,105,101,115,112,101,114,115,111,
+110,108,105,118,105,110,103,100,101,115,105,103,110,109,111,110,116,104,115,102,
+111,114,99,101,115,117,110,105,113,117,101,119,101,105,103,104,116,112,101,111,
+112,108,101,101,110,101,114,103,121,110,97,116,117,114,101,115,101,97,114,99,104
+,102,105,103,117,114,101,104,97,118,105,110,103,99,117,115,116,111,109,111,102,
+102,115,101,116,108,101,116,116,101,114,119,105,110,100,111,119,115,117,98,109,
+105,116,114,101,110,100,101,114,103,114,111,117,112,115,117,112,108,111,97,100,
+104,101,97,108,116,104,109,101,116,104,111,100,118,105,100,101,111,115,115,99,
+104,111,111,108,102,117,116,117,114,101,115,104,97,100,111,119,100,101,98,97,116
+,101,118,97,108,117,101,115,79,98,106,101,99,116,111,116,104,101,114,115,114,105
+,103,104,116,115,108,101,97,103,117,101,99,104,114,111,109,101,115,105,109,112,
+108,101,110,111,116,105,99,101,115,104,97,114,101,100,101,110,100,105,110,103,
+115,101,97,115,111,110,114,101,112,111,114,116,111,110,108,105,110,101,115,113,
+117,97,114,101,98,117,116,116,111,110,105,109,97,103,101,115,101,110,97,98,108,
+101,109,111,118,105,110,103,108,97,116,101,115,116,119,105,110,116,101,114,70,
+114,97,110,99,101,112,101,114,105,111,100,115,116,114,111,110,103,114,101,112,
+101,97,116,76,111,110,100,111,110,100,101,116,97,105,108,102,111,114,109,101,100
+,100,101,109,97,110,100,115,101,99,117,114,101,112,97,115,115,101,100,116,111,
+103,103,108,101,112,108,97,99,101,115,100,101,118,105,99,101,115,116,97,116,105,
+99,99,105,116,105,101,115,115,116,114,101,97,109,121,101,108,108,111,119,97,116,
+116,97,99,107,115,116,114,101,101,116,102,108,105,103,104,116,104,105,100,100,
+101,110,105,110,102,111,34,62,111,112,101,110,101,100,117,115,101,102,117,108,
+118,97,108,108,101,121,99,97,117,115,101,115,108,101,97,100,101,114,115,101,99,
+114,101,116,115,101,99,111,110,100,100,97,109,97,103,101,115,112,111,114,116,115
+,101,120,99,101,112,116,114,97,116,105,110,103,115,105,103,110,101,100,116,104,
+105,110,103,115,101,102,102,101,99,116,102,105,101,108,100,115,115,116,97,116,
+101,115,111,102,102,105,99,101,118,105,115,117,97,108,101,100,105,116,111,114,
+118,111,108,117,109,101,82,101,112,111,114,116,109,117,115,101,117,109,109,111,
+118,105,101,115,112,97,114,101,110,116,97,99,99,101,115,115,109,111,115,116,108,
+121,109,111,116,104,101,114,34,32,105,100,61,34,109,97,114,107,101,116,103,114,
+111,117,110,100,99,104,97,110,99,101,115,117,114,118,101,121,98,101,102,111,114,
+101,115,121,109,98,111,108,109,111,109,101,110,116,115,112,101,101,99,104,109,
+111,116,105,111,110,105,110,115,105,100,101,109,97,116,116,101,114,67,101,110,
+116,101,114,111,98,106,101,99,116,101,120,105,115,116,115,109,105,100,100,108,
+101,69,117,114,111,112,101,103,114,111,119,116,104,108,101,103,97,99,121,109,97,
+110,110,101,114,101,110,111,117,103,104,99,97,114,101,101,114,97,110,115,119,101
+,114,111,114,105,103,105,110,112,111,114,116,97,108,99,108,105,101,110,116,115,
+101,108,101,99,116,114,97,110,100,111,109,99,108,111,115,101,100,116,111,112,105
+,99,115,99,111,109,105,110,103,102,97,116,104,101,114,111,112,116,105,111,110,
+115,105,109,112,108,121,114,97,105,115,101,100,101,115,99,97,112,101,99,104,111,
+115,101,110,99,104,117,114,99,104,100,101,102,105,110,101,114,101,97,115,111,110
+,99,111,114,110,101,114,111,117,116,112,117,116,109,101,109,111,114,121,105,102,
+114,97,109,101,112,111,108,105,99,101,109,111,100,101,108,115,78,117,109,98,101,
+114,100,117,114,105,110,103,111,102,102,101,114,115,115,116,121,108,101,115,107,
+105,108,108,101,100,108,105,115,116,101,100,99,97,108,108,101,100,115,105,108,
+118,101,114,109,97,114,103,105,110,100,101,108,101,116,101,98,101,116,116,101,
+114,98,114,111,119,115,101,108,105,109,105,116,115,71,108,111,98,97,108,115,105,
+110,103,108,101,119,105,100,103,101,116,99,101,110,116,101,114,98,117,100,103,
+101,116,110,111,119,114,97,112,99,114,101,100,105,116,99,108,97,105,109,115,101,
+110,103,105,110,101,115,97,102,101,116,121,99,104,111,105,99,101,115,112,105,114
+,105,116,45,115,116,121,108,101,115,112,114,101,97,100,109,97,107,105,110,103,
+110,101,101,100,101,100,114,117,115,115,105,97,112,108,101,97,115,101,101,120,
+116,101,110,116,83,99,114,105,112,116,98,114,111,107,101,110,97,108,108,111,119,
+115,99,104,97,114,103,101,100,105,118,105,100,101,102,97,99,116,111,114,109,101,
+109,98,101,114,45,98,97,115,101,100,116,104,101,111,114,121,99,111,110,102,105,
+103,97,114,111,117,110,100,119,111,114,107,101,100,104,101,108,112,101,100,67,
+104,117,114,99,104,105,109,112,97,99,116,115,104,111,117,108,100,97,108,119,97,
+121,115,108,111,103,111,34,32,98,111,116,116,111,109,108,105,115,116,34,62,41,
+123,118,97,114,32,112,114,101,102,105,120,111,114,97,110,103,101,72,101,97,100,
+101,114,46,112,117,115,104,40,99,111,117,112,108,101,103,97,114,100,101,110,98,
+114,105,100,103,101,108,97,117,110,99,104,82,101,118,105,101,119,116,97,107,105,
+110,103,118,105,115,105,111,110,108,105,116,116,108,101,100,97,116,105,110,103,
+66,117,116,116,111,110,98,101,97,117,116,121,116,104,101,109,101,115,102,111,114
+,103,111,116,83,101,97,114,99,104,97,110,99,104,111,114,97,108,109,111,115,116,
+108,111,97,100,101,100,67,104,97,110,103,101,114,101,116,117,114,110,115,116,114
+,105,110,103,114,101,108,111,97,100,77,111,98,105,108,101,105,110,99,111,109,101
+,115,117,112,112,108,121,83,111,117,114,99,101,111,114,100,101,114,115,118,105,
+101,119,101,100,38,110,98,115,112,59,99,111,117,114,115,101,65,98,111,117,116,32
+,105,115,108,97,110,100,60,104,116,109,108,32,99,111,111,107,105,101,110,97,109,
+101,61,34,97,109,97,122,111,110,109,111,100,101,114,110,97,100,118,105,99,101,
+105,110,60,47,97,62,58,32,84,104,101,32,100,105,97,108,111,103,104,111,117,115,
+101,115,66,69,71,73,78,32,77,101,120,105,99,111,115,116,97,114,116,115,99,101,
+110,116,114,101,104,101,105,103,104,116,97,100,100,105,110,103,73,115,108,97,110
+,100,97,115,115,101,116,115,69,109,112,105,114,101,83,99,104,111,111,108,101,102
+,102,111,114,116,100,105,114,101,99,116,110,101,97,114,108,121,109,97,110,117,97
+,108,83,101,108,101,99,116,46,10,10,79,110,101,106,111,105,110,101,100,109,101,
+110,117,34,62,80,104,105,108,105,112,97,119,97,114,100,115,104,97,110,100,108,
+101,105,109,112,111,114,116,79,102,102,105,99,101,114,101,103,97,114,100,115,107
+,105,108,108,115,110,97,116,105,111,110,83,112,111,114,116,115,100,101,103,114,
+101,101,119,101,101,107,108,121,32,40,101,46,103,46,98,101,104,105,110,100,100,
+111,99,116,111,114,108,111,103,103,101,100,117,110,105,116,101,100,60,47,98,62,
+60,47,98,101,103,105,110,115,112,108,97,110,116,115,97,115,115,105,115,116,97,
+114,116,105,115,116,105,115,115,117,101,100,51,48,48,112,120,124,99,97,110,97,
+100,97,97,103,101,110,99,121,115,99,104,101,109,101,114,101,109,97,105,110,66,
+114,97,122,105,108,115,97,109,112,108,101,108,111,103,111,34,62,98,101,121,111,
+110,100,45,115,99,97,108,101,97,99,99,101,112,116,115,101,114,118,101,100,109,97
+,114,105,110,101,70,111,111,116,101,114,99,97,109,101,114,97,60,47,104,49,62,10,
+95,102,111,114,109,34,108,101,97,118,101,115,115,116,114,101,115,115,34,32,47,62
+,13,10,46,103,105,102,34,32,111,110,108,111,97,100,108,111,97,100,101,114,79,120
+,102,111,114,100,115,105,115,116,101,114,115,117,114,118,105,118,108,105,115,116
+,101,110,102,101,109,97,108,101,68,101,115,105,103,110,115,105,122,101,61,34,97,
+112,112,101,97,108,116,101,120,116,34,62,108,101,118,101,108,115,116,104,97,110,
+107,115,104,105,103,104,101,114,102,111,114,99,101,100,97,110,105,109,97,108,97,
+110,121,111,110,101,65,102,114,105,99,97,97,103,114,101,101,100,114,101,99,101,
+110,116,80,101,111,112,108,101,60,98,114,32,47,62,119,111,110,100,101,114,112,
+114,105,99,101,115,116,117,114,110,101,100,124,124,32,123,125,59,109,97,105,110,
+34,62,105,110,108,105,110,101,115,117,110,100,97,121,119,114,97,112,34,62,102,97
+,105,108,101,100,99,101,110,115,117,115,109,105,110,117,116,101,98,101,97,99,111
+,110,113,117,111,116,101,115,49,53,48,112,120,124,101,115,116,97,116,101,114,101
+,109,111,116,101,101,109,97,105,108,34,108,105,110,107,101,100,114,105,103,104,
+116,59,115,105,103,110,97,108,102,111,114,109,97,108,49,46,104,116,109,108,115,
+105,103,110,117,112,112,114,105,110,99,101,102,108,111,97,116,58,46,112,110,103,
+34,32,102,111,114,117,109,46,65,99,99,101,115,115,112,97,112,101,114,115,115,111
+,117,110,100,115,101,120,116,101,110,100,72,101,105,103,104,116,115,108,105,100,
+101,114,85,84,70,45,56,34,38,97,109,112,59,32,66,101,102,111,114,101,46,32,87,
+105,116,104,115,116,117,100,105,111,111,119,110,101,114,115,109,97,110,97,103,
+101,112,114,111,102,105,116,106,81,117,101,114,121,97,110,110,117,97,108,112,97,
+114,97,109,115,98,111,117,103,104,116,102,97,109,111,117,115,103,111,111,103,108
+,101,108,111,110,103,101,114,105,43,43,41,32,123,105,115,114,97,101,108,115,97,
+121,105,110,103,100,101,99,105,100,101,104,111,109,101,34,62,104,101,97,100,101,
+114,101,110,115,117,114,101,98,114,97,110,99,104,112,105,101,99,101,115,98,108,
+111,99,107,59,115,116,97,116,101,100,116,111,112,34,62,60,114,97,99,105,110,103,
+114,101,115,105,122,101,45,45,38,103,116,59,112,97,99,105,116,121,115,101,120,
+117,97,108,98,117,114,101,97,117,46,106,112,103,34,32,49,48,44,48,48,48,111,98,
+116,97,105,110,116,105,116,108,101,115,97,109,111,117,110,116,44,32,73,110,99,46
+,99,111,109,101,100,121,109,101,110,117,34,32,108,121,114,105,99,115,116,111,100
+,97,121,46,105,110,100,101,101,100,99,111,117,110,116,121,95,108,111,103,111,46,
+70,97,109,105,108,121,108,111,111,107,101,100,77,97,114,107,101,116,108,115,101,
+32,105,102,80,108,97,121,101,114,116,117,114,107,101,121,41,59,118,97,114,32,102
+,111,114,101,115,116,103,105,118,105,110,103,101,114,114,111,114,115,68,111,109,
+97,105,110,125,101,108,115,101,123,105,110,115,101,114,116,66,108,111,103,60,47,
+102,111,111,116,101,114,108,111,103,105,110,46,102,97,115,116,101,114,97,103,101
+,110,116,115,60,98,111,100,121,32,49,48,112,120,32,48,112,114,97,103,109,97,102,
+114,105,100,97,121,106,117,110,105,111,114,100,111,108,108,97,114,112,108,97,99,
+101,100,99,111,118,101,114,115,112,108,117,103,105,110,53,44,48,48,48,32,112,97,
+103,101,34,62,98,111,115,116,111,110,46,116,101,115,116,40,97,118,97,116,97,114,
+116,101,115,116,101,100,95,99,111,117,110,116,102,111,114,117,109,115,115,99,104
+,101,109,97,105,110,100,101,120,44,102,105,108,108,101,100,115,104,97,114,101,
+115,114,101,97,100,101,114,97,108,101,114,116,40,97,112,112,101,97,114,83,117,98
+,109,105,116,108,105,110,101,34,62,98,111,100,121,34,62,10,42,32,84,104,101,84,
+104,111,117,103,104,115,101,101,105,110,103,106,101,114,115,101,121,78,101,119,
+115,60,47,118,101,114,105,102,121,101,120,112,101,114,116,105,110,106,117,114,
+121,119,105,100,116,104,61,67,111,111,107,105,101,83,84,65,82,84,32,97,99,114,
+111,115,115,95,105,109,97,103,101,116,104,114,101,97,100,110,97,116,105,118,101,
+112,111,99,107,101,116,98,111,120,34,62,10,83,121,115,116,101,109,32,68,97,118,
+105,100,99,97,110,99,101,114,116,97,98,108,101,115,112,114,111,118,101,100,65,
+112,114,105,108,32,114,101,97,108,108,121,100,114,105,118,101,114,105,116,101,
+109,34,62,109,111,114,101,34,62,98,111,97,114,100,115,99,111,108,111,114,115,99,
+97,109,112,117,115,102,105,114,115,116,32,124,124,32,91,93,59,109,101,100,105,97
+,46,103,117,105,116,97,114,102,105,110,105,115,104,119,105,100,116,104,58,115,
+104,111,119,101,100,79,116,104,101,114,32,46,112,104,112,34,32,97,115,115,117,
+109,101,108,97,121,101,114,115,119,105,108,115,111,110,115,116,111,114,101,115,
+114,101,108,105,101,102,115,119,101,100,101,110,67,117,115,116,111,109,101,97,
+115,105,108,121,32,121,111,117,114,32,83,116,114,105,110,103,10,10,87,104,105,
+108,116,97,121,108,111,114,99,108,101,97,114,58,114,101,115,111,114,116,102,114,
+101,110,99,104,116,104,111,117,103,104,34,41,32,43,32,34,60,98,111,100,121,62,98
+,117,121,105,110,103,98,114,97,110,100,115,77,101,109,98,101,114,110,97,109,101,
+34,62,111,112,112,105,110,103,115,101,99,116,111,114,53,112,120,59,34,62,118,115
+,112,97,99,101,112,111,115,116,101,114,109,97,106,111,114,32,99,111,102,102,101,
+101,109,97,114,116,105,110,109,97,116,117,114,101,104,97,112,112,101,110,60,47,
+110,97,118,62,107,97,110,115,97,115,108,105,110,107,34,62,73,109,97,103,101,115,
+61,102,97,108,115,101,119,104,105,108,101,32,104,115,112,97,99,101,48,38,97,109,
+112,59,32,10,10,73,110,32,32,112,111,119,101,114,80,111,108,115,107,105,45,99,
+111,108,111,114,106,111,114,100,97,110,66,111,116,116,111,109,83,116,97,114,116,
+32,45,99,111,117,110,116,50,46,104,116,109,108,110,101,119,115,34,62,48,49,46,
+106,112,103,79,110,108,105,110,101,45,114,105,103,104,116,109,105,108,108,101,
+114,115,101,110,105,111,114,73,83,66,78,32,48,48,44,48,48,48,32,103,117,105,100,
+101,115,118,97,108,117,101,41,101,99,116,105,111,110,114,101,112,97,105,114,46,
+120,109,108,34,32,32,114,105,103,104,116,115,46,104,116,109,108,45,98,108,111,99
+,107,114,101,103,69,120,112,58,104,111,118,101,114,119,105,116,104,105,110,118,
+105,114,103,105,110,112,104,111,110,101,115,60,47,116,114,62,13,117,115,105,110,
+103,32,10,9,118,97,114,32,62,39,41,59,10,9,60,47,116,100,62,10,60,47,116,114,62,
+10,98,97,104,97,115,97,98,114,97,115,105,108,103,97,108,101,103,111,109,97,103,
+121,97,114,112,111,108,115,107,105,115,114,112,115,107,105,216,177,216,175,217,
+136,228,184,173,230,150,135,231,174,128,228,189,147,231,185,129,233,171,148,228,
+191,161,230,129,175,228,184,173,229,155,189,230,136,145,228,187,172,228,184,128,
+228,184,170,229,133,172,229,143,184,231,174,161,231,144,134,232,174,186,229,157,
+155,229,143,175,228,187,165,230,156,141,229,138,161,230,151,182,233,151,180,228,
+184,170,228,186,186,228,186,167,229,147,129,232,135,170,229,183,177,228,188,129,
+228,184,154,230,159,165,231,156,139,229,183,165,228,189,156,232,129,148,231,179,
+187,230,178,161,230,156,137,231,189,145,231,171,153,230,137,128,230,156,137,232,
+175,132,232,174,186,228,184,173,229,191,131,230,150,135,231,171,160,231,148,168,
+230,136,183,233,166,150,233,161,181,228,189,156,232,128,133,230,138,128,230,156,
+175,233,151,174,233,162,152,231,155,184,229,133,179,228,184,139,232,189,189,230,
+144,156,231,180,162,228,189,191,231,148,168,232,189,175,228,187,182,229,156,168,
+231,186,191,228,184,187,233,162,152,232,181,132,230,150,153,232,167,134,233,162,
+145,229,155,158,229,164,141,230,179,168,229,134,140,231,189,145,231,187,156,230,
+148,182,232,151,143,229,134,133,229,174,185,230,142,168,232,141,144,229,184,130,
+229,156,186,230,182,136,230,129,175,231,169,186,233,151,180,229,143,145,229,184,
+131,228,187,128,228,185,136,229,165,189,229,143,139,231,148,159,230,180,187,229,
+155,190,231,137,135,229,143,145,229,177,149,229,166,130,230,158,156,230,137,139,
+230,156,186,230,150,176,233,151,187,230,156,128,230,150,176,230,150,185,229,188,
+143,229,140,151,228,186,172,230,143,144,228,190,155,229,133,179,228,186,142,230,
+155,180,229,164,154,232,191,153,228,184,170,231,179,187,231,187,159,231,159,165,
+233,129,147,230,184,184,230,136,143,229,185,191,229,145,138,229,133,182,228,187,
+150,229,143,145,232,161,168,229,174,137,229,133,168,231,172,172,228,184,128,228,
+188,154,229,145,152,232,191,155,232,161,140,231,130,185,229,135,187,231,137,136,
+230,157,131,231,148,181,229,173,144,228,184,150,231,149,140,232,174,190,232,174,
+161,229,133,141,232,180,185,230,149,153,232,130,178,229,138,160,229,133,165,230,
+180,187,229,138,168,228,187,150,228,187,172,229,149,134,229,147,129,229,141,154,
+229,174,162,231,142,176,229,156,168,228,184,138,230,181,183,229,166,130,228,189,
+149,229,183,178,231,187,143,231,149,153,232,168,128,232,175,166,231,187,134,231,
+164,190,229,140,186,231,153,187,229,189,149,230,156,172,231,171,153,233,156,128,
+232,166,129,228,187,183,230,160,188,230,148,175,230,140,129,229,155,189,233,153,
+133,233,147,190,230,142,165,229,155,189,229,174,182,229,187,186,232,174,190,230,
+156,139,229,143,139,233,152,133,232,175,187,230,179,149,229,190,139,228,189,141,
+231,189,174,231,187,143,230,181,142,233,128,137,230,139,169,232,191,153,230,160,
+183,229,189,147,229,137,141,229,136,134,231,177,187,230,142,146,232,161,140,229,
+155,160,228,184,186,228,186,164,230,152,147,230,156,128,229,144,142,233,159,179,
+228,185,144,228,184,141,232,131,189,233,128,154,232,191,135,232,161,140,228,184,
+154,231,167,145,230,138,128,229,143,175,232,131,189,232,174,190,229,164,135,229,
+144,136,228,189,156,229,164,167,229,174,182,231,164,190,228,188,154,231,160,148,
+231,169,182,228,184,147,228,184,154,229,133,168,233,131,168,233,161,185,231,155,
+174,232,191,153,233,135,140,232,191,152,230,152,175,229,188,128,229,167,139,230,
+131,133,229,134,181,231,148,181,232,132,145,230,150,135,228,187,182,229,147,129,
+231,137,140,229,184,174,229,138,169,230,150,135,229,140,150,232,181,132,230,186,
+144,229,164,167,229,173,166,229,173,166,228,185,160,229,156,176,229,157,128,230,
+181,143,232,167,136,230,138,149,232,181,132,229,183,165,231,168,139,232,166,129,
+230,177,130,230,128,142,228,185,136,230,151,182,229,128,153,229,138,159,232,131,
+189,228,184,187,232,166,129,231,155,174,229,137,141,232,181,132,232,174,175,229,
+159,142,229,184,130,230,150,185,230,179,149,231,148,181,229,189,177,230,139,155,
+232,129,152,229,163,176,230,152,142,228,187,187,228,189,149,229,129,165,229,186,
+183,230,149,176,230,141,174,231,190,142,229,155,189,230,177,189,232,189,166,228,
+187,139,231,187,141,228,189,134,230,152,175,228,186,164,230,181,129,231,148,159,
+228,186,167,230,137,128,228,187,165,231,148,181,232,175,157,230,152,190,231,164,
+186,228,184,128,228,186,155,229,141,149,228,189,141,228,186,186,229,145,152,229,
+136,134,230,158,144,229,156,176,229,155,190,230,151,133,230,184,184,229,183,165,
+229,133,183,229,173,166,231,148,159,231,179,187,229,136,151,231,189,145,229,143,
+139,229,184,150,229,173,144,229,175,134,231,160,129,233,162,145,233,129,147,230,
+142,167,229,136,182,229,156,176,229,140,186,229,159,186,230,156,172,229,133,168,
+229,155,189,231,189,145,228,184,138,233,135,141,232,166,129,231,172,172,228,186,
+140,229,150,156,230,172,162,232,191,155,229,133,165,229,143,139,230,131,133,232,
+191,153,228,186,155,232,128,131,232,175,149,229,143,145,231,142,176,229,159,185,
+232,174,173,228,187,165,228,184,138,230,148,191,229,186,156,230,136,144,228,184,
+186,231,142,175,229,162,131,233,166,153,230,184,175,229,144,140,230,151,182,229,
+168,177,228,185,144,229,143,145,233,128,129,228,184,128,229,174,154,229,188,128,
+229,143,145,228,189,156,229,147,129,230,160,135,229,135,134,230,172,162,232,191,
+142,232,167,163,229,134,179,229,156,176,230,150,185,228,184,128,228,184,139,228,
+187,165,229,143,138,232,180,163,228,187,187,230,136,150,232,128,133,229,174,162,
+230,136,183,228,187,163,232,161,168,231,167,175,229,136,134,229,165,179,228,186,
+186,230,149,176,231,160,129,233,148,128,229,148,174,229,135,186,231,142,176,231,
+166,187,231,186,191,229,186,148,231,148,168,229,136,151,232,161,168,228,184,141,
+229,144,140,231,188,150,232,190,145,231,187,159,232,174,161,230,159,165,232,175,
+162,228,184,141,232,166,129,230,156,137,229,133,179,230,156,186,230,158,132,229,
+190,136,229,164,154,230,146,173,230,148,190,231,187,132,231,187,135,230,148,191,
+231,173,150,231,155,180,230,142,165,232,131,189,229,138,155,230,157,165,230,186,
+144,230,153,130,233,150,147,231,156,139,229,136,176,231,131,173,233,151,168,229,
+133,179,233,148,174,228,184,147,229,140,186,233,157,158,229,184,184,232,139,177,
+232,175,173,231,153,190,229,186,166,229,184,140,230,156,155,231,190,142,229,165,
+179,230,175,148,232,190,131,231,159,165,232,175,134,232,167,132,229,174,154,229,
+187,186,232,174,174,233,131,168,233,151,168,230,132,143,232,167,129,231,178,190,
+229,189,169,230,151,165,230,156,172,230,143,144,233,171,152,229,143,145,232,168,
+128,230,150,185,233,157,162,229,159,186,233,135,145,229,164,132,231,144,134,230,
+157,131,233,153,144,229,189,177,231,137,135,233,147,182,232,161,140,232,191,152,
+230,156,137,229,136,134,228,186,171,231,137,169,229,147,129,231,187,143,232,144,
+165,230,183,187,229,138,160,228,184,147,229,174,182,232,191,153,231,167,141,232,
+175,157,233,162,152,232,181,183,230,157,165,228,184,154,229,138,161,229,133,172,
+229,145,138,232,174,176,229,189,149,231,174,128,228,187,139,232,180,168,233,135,
+143,231,148,183,228,186,186,229,189,177,229,147,141,229,188,149,231,148,168,230,
+138,165,229,145,138,233,131,168,229,136,134,229,191,171,233,128,159,229,146,168,
+232,175,162,230,151,182,229,176,154,230,179,168,230,132,143,231,148,179,232,175,
+183,229,173,166,230,160,161,229,186,148,232,175,165,229,142,134,229,143,178,229,
+143,170,230,152,175,232,191,148,229,155,158,232,180,173,228,185,176,229,144,141,
+231,167,176,228,184,186,228,186,134,230,136,144,229,138,159,232,175,180,230,152,
+142,228,190,155,229,186,148,229,173,169,229,173,144,228,184,147,233,162,152,231,
+168,139,229,186,143,228,184,128,232,136,172,230,156,131,229,147,161,229,143,170,
+230,156,137,229,133,182,229,174,131,228,191,157,230,138,164,232,128,140,228,184,
+148,228,187,138,229,164,169,231,170,151,229,143,163,229,138,168,230,128,129,231,
+138,182,230,128,129,231,137,185,229,136,171,232,174,164,228,184,186,229,191,133,
+233,161,187,230,155,180,230,150,176,229,176,143,232,175,180,230,136,145,229,128,
+145,228,189,156,228,184,186,229,170,146,228,189,147,229,140,133,230,139,172,233,
+130,163,228,185,136,228,184,128,230,160,183,229,155,189,229,134,133,230,152,175,
+229,144,166,230,160,185,230,141,174,231,148,181,232,167,134,229,173,166,233,153,
+162,229,133,183,230,156,137,232,191,135,231,168,139,231,148,177,228,186,142,228,
+186,186,230,137,141,229,135,186,230,157,165,228,184,141,232,191,135,230,173,163,
+229,156,168,230,152,142,230,152,159,230,149,133,228,186,139,229,133,179,231,179,
+187,230,160,135,233,162,152,229,149,134,229,138,161,232,190,147,229,133,165,228,
+184,128,231,155,180,229,159,186,231,161,128,230,149,153,229,173,166,228,186,134,
+232,167,163,229,187,186,231,173,145,231,187,147,230,158,156,229,133,168,231,144,
+131,233,128,154,231,159,165,232,174,161,229,136,146,229,175,185,228,186,142,232,
+137,186,230,156,175,231,155,184,229,134,140,229,143,145,231,148,159,231,156,159,
+231,154,132,229,187,186,231,171,139,231,173,137,231,186,167,231,177,187,229,158,
+139,231,187,143,233,170,140,229,174,158,231,142,176,229,136,182,228,189,156,230,
+157,165,232,135,170,230,160,135,231,173,190,228,187,165,228,184,139,229,142,159,
+229,136,155,230,151,160,230,179,149,229,133,182,228,184,173,229,128,139,228,186,
+186,228,184,128,229,136,135,230,140,135,229,141,151,229,133,179,233,151,173,233,
+155,134,229,155,162,231,172,172,228,184,137,229,133,179,230,179,168,229,155,160,
+230,173,164,231,133,167,231,137,135,230,183,177,229,156,179,229,149,134,228,184,
+154,229,185,191,229,183,158,230,151,165,230,156,159,233,171,152,231,186,167,230,
+156,128,232,191,145,231,187,188,229,144,136,232,161,168,231,164,186,228,184,147,
+232,190,145,232,161,140,228,184,186,228,186,164,233,128,154,232,175,132,228,187,
+183,232,167,137,229,190,151,231,178,190,229,141,142,229,174,182,229,186,173,229,
+174,140,230,136,144,230,132,159,232,167,137,229,174,137,232,163,133,229,190,151,
+229,136,176,233,130,174,228,187,182,229,136,182,229,186,166,233,163,159,229,147,
+129,232,153,189,231,132,182,232,189,172,232,189,189,230,138,165,228,187,183,232,
+174,176,232,128,133,230,150,185,230,161,136,232,161,140,230,148,191,228,186,186,
+230,176,145,231,148,168,229,147,129,228,184,156,232,165,191,230,143,144,229,135,
+186,233,133,146,229,186,151,231,132,182,229,144,142,228,187,152,230,172,190,231,
+131,173,231,130,185,228,187,165,229,137,141,229,174,140,229,133,168,229,143,145,
+229,184,150,232,174,190,231,189,174,233,162,134,229,175,188,229,183,165,228,184,
+154,229,140,187,233,153,162,231,156,139,231,156,139,231,187,143,229,133,184,229,
+142,159,229,155,160,229,185,179,229,143,176,229,144,132,231,167,141,229,162,158,
+229,138,160,230,157,144,230,150,153,230,150,176,229,162,158,228,185,139,229,144,
+142,232,129,140,228,184,154,230,149,136,230,158,156,228,187,138,229,185,180,232,
+174,186,230,150,135,230,136,145,229,155,189,229,145,138,232,175,137,231,137,136,
+228,184,187,228,191,174,230,148,185,229,143,130,228,184,142,230,137,147,229,141,
+176,229,191,171,228,185,144,230,156,186,230,162,176,232,167,130,231,130,185,229,
+173,152,229,156,168,231,178,190,231,165,158,232,142,183,229,190,151,229,136,169,
+231,148,168,231,187,167,231,187,173,228,189,160,228,187,172,232,191,153,228,185,
+136,230,168,161,229,188,143,232,175,173,232,168,128,232,131,189,229,164,159,233,
+155,133,232,153,142,230,147,141,228,189,156,233,163,142,230,160,188,228,184,128,
+232,181,183,231,167,145,229,173,166,228,189,147,232,130,178,231,159,173,228,191,
+161,230,157,161,228,187,182,230,178,187,231,150,151,232,191,144,229,138,168,228,
+186,167,228,184,154,228,188,154,232,174,174,229,175,188,232,136,170,229,133,136,
+231,148,159,232,129,148,231,155,159,229,143,175,230,152,175,229,149,143,233,161,
+140,231,187,147,230,158,132,228,189,156,231,148,168,232,176,131,230,159,165,232,
+179,135,230,150,153,232,135,170,229,138,168,232,180,159,232,180,163,229,134,156,
+228,184,154,232,174,191,233,151,174,229,174,158,230,150,189,230,142,165,229,143,
+151,232,174,168,232,174,186,233,130,163,228,184,170,229,143,141,233,166,136,229,
+138,160,229,188,186,229,165,179,230,128,167,232,140,131,229,155,180,230,156,141,
+229,139,153,228,188,145,233,151,178,228,187,138,230,151,165,229,174,162,230,156,
+141,232,167,128,231,156,139,229,143,130,229,138,160,231,154,132,232,175,157,228,
+184,128,231,130,185,228,191,157,232,175,129,229,155,190,228,185,166,230,156,137,
+230,149,136,230,181,139,232,175,149,231,167,187,229,138,168,230,137,141,232,131,
+189,229,134,179,229,174,154,232,130,161,231,165,168,228,184,141,230,150,173,233,
+156,128,230,177,130,228,184,141,229,190,151,229,138,158,230,179,149,228,185,139,
+233,151,180,233,135,135,231,148,168,232,144,165,233,148,128,230,138,149,232,175,
+137,231,155,174,230,160,135,231,136,177,230,131,133,230,145,132,229,189,177,230,
+156,137,228,186,155,232,164,135,232,163,189,230,150,135,229,173,166,230,156,186,
+228,188,154,230,149,176,229,173,151,232,163,133,228,191,174,232,180,173,231,137,
+169,229,134,156,230,157,145,229,133,168,233,157,162,231,178,190,229,147,129,229,
+133,182,229,174,158,228,186,139,230,131,133,230,176,180,229,185,179,230,143,144,
+231,164,186,228,184,138,229,184,130,232,176,162,232,176,162,230,153,174,233,128,
+154,230,149,153,229,184,136,228,184,138,228,188,160,231,177,187,229,136,171,230,
+173,140,230,155,178,230,139,165,230,156,137,229,136,155,230,150,176,233,133,141,
+228,187,182,229,143,170,232,166,129,230,151,182,228,187,163,232,179,135,232,168,
+138,232,190,190,229,136,176,228,186,186,231,148,159,232,174,162,233,152,133,232,
+128,129,229,184,136,229,177,149,231,164,186,229,191,131,231,144,134,232,180,180,
+229,173,144,231,182,178,231,171,153,228,184,187,233,161,140,232,135,170,231,132,
+182,231,186,167,229,136,171,231,174,128,229,141,149,230,148,185,233,157,169,233,
+130,163,228,186,155,230,157,165,232,175,180,230,137,147,229,188,128,228,187,163,
+231,160,129,229,136,160,233,153,164,232,175,129,229,136,184,232,138,130,231,155,
+174,233,135,141,231,130,185,230,172,161,230,149,184,229,164,154,229,176,145,232,
+167,132,229,136,146,232,181,132,233,135,145,230,137,190,229,136,176,228,187,165,
+229,144,142,229,164,167,229,133,168,228,184,187,233,161,181,230,156,128,228,189,
+179,229,155,158,231,173,148,229,164,169,228,184,139,228,191,157,233,154,156,231,
+142,176,228,187,163,230,163,128,230,159,165,230,138,149,231,165,168,229,176,143,
+230,151,182,230,178,146,230,156,137,230,173,163,229,184,184,231,148,154,232,135,
+179,228,187,163,231,144,134,231,155,174,229,189,149,229,133,172,229,188,128,229,
+164,141,229,136,182,233,135,145,232,158,141,229,185,184,231,166,143,231,137,136,
+230,156,172,229,189,162,230,136,144,229,135,134,229,164,135,232,161,140,230,131,
+133,229,155,158,229,136,176,230,128,157,230,131,179,230,128,142,230,160,183,229,
+141,143,232,174,174,232,174,164,232,175,129,230,156,128,229,165,189,228,186,167,
+231,148,159,230,140,137,231,133,167,230,156,141,232,163,133,229,185,191,228,184,
+156,229,138,168,230,188,171,233,135,135,232,180,173,230,150,176,230,137,139,231,
+187,132,229,155,190,233,157,162,230,157,191,229,143,130,232,128,131,230,148,191,
+230,178,187,229,174,185,230,152,147,229,164,169,229,156,176,229,138,170,229,138,
+155,228,186,186,228,187,172,229,141,135,231,186,167,233,128,159,229,186,166,228,
+186,186,231,137,169,232,176,131,230,149,180,230,181,129,232,161,140,233,128,160,
+230,136,144,230,150,135,229,173,151,233,159,169,229,155,189,232,180,184,230,152,
+147,229,188,128,229,177,149,231,155,184,233,151,156,232,161,168,231,142,176,229,
+189,177,232,167,134,229,166,130,230,173,164,231,190,142,229,174,185,229,164,167,
+229,176,143,230,138,165,233,129,147,230,157,161,230,172,190,229,191,131,230,131,
+133,232,174,184,229,164,154,230,179,149,232,167,132,229,174,182,229,177,133,228,
+185,166,229,186,151,232,191,158,230,142,165,231,171,139,229,141,179,228,184,190,
+230,138,165,230,138,128,229,183,167,229,165,165,232,191,144,231,153,187,229,133,
+165,228,187,165,230,157,165,231,144,134,232,174,186,228,186,139,228,187,182,232,
+135,170,231,148,177,228,184,173,229,141,142,229,138,158,229,133,172,229,166,136,
+229,166,136,231,156,159,230,173,163,228,184,141,233,148,153,229,133,168,230,150,
+135,229,144,136,229,144,140,228,187,183,229,128,188,229,136,171,228,186,186,231,
+155,145,231,157,163,229,133,183,228,189,147,228,184,150,231,186,170,229,155,162,
+233,152,159,229,136,155,228,184,154,230,137,191,230,139,133,229,162,158,233,149,
+191,230,156,137,228,186,186,228,191,157,230,140,129,229,149,134,229,174,182,231,
+187,180,228,191,174,229,143,176,230,185,190,229,183,166,229,143,179,232,130,161,
+228,187,189,231,173,148,230,161,136,229,174,158,233,153,133,231,148,181,228,191,
+161,231,187,143,231,144,134,231,148,159,229,145,189,229,174,163,228,188,160,228,
+187,187,229,138,161,230,173,163,229,188,143,231,137,185,232,137,178,228,184,139,
+230,157,165,229,141,143,228,188,154,229,143,170,232,131,189,229,189,147,231,132,
+182,233,135,141,230,150,176,229,133,167,229,174,185,230,140,135,229,175,188,232,
+191,144,232,161,140,230,151,165,229,191,151,232,179,163,229,174,182,232,182,133,
+232,191,135,229,156,159,229,156,176,230,181,153,230,177,159,230,148,175,228,187,
+152,230,142,168,229,135,186,231,171,153,233,149,191,230,157,173,229,183,158,230,
+137,167,232,161,140,229,136,182,233,128,160,228,185,139,228,184,128,230,142,168,
+229,185,191,231,142,176,229,156,186,230,143,143,232,191,176,229,143,152,229,140,
+150,228,188,160,231,187,159,230,173,140,230,137,139,228,191,157,233,153,169,232,
+175,190,231,168,139,229,140,187,231,150,151,231,187,143,232,191,135,232,191,135,
+229,142,187,228,185,139,229,137,141,230,148,182,229,133,165,229,185,180,229,186,
+166,230,157,130,229,191,151,231,190,142,228,184,189,230,156,128,233,171,152,231,
+153,187,233,153,134,230,156,170,230,157,165,229,138,160,229,183,165,229,133,141,
+232,180,163,230,149,153,231,168,139,231,137,136,229,157,151,232,186,171,228,189,
+147,233,135,141,229,186,134,229,135,186,229,148,174,230,136,144,230,156,172,229,
+189,162,229,188,143,229,156,159,232,177,134,229,135,186,229,131,185,228,184,156,
+230,150,185,233,130,174,231,174,177,229,141,151,228,186,172,230,177,130,232,129,
+140,229,143,150,229,190,151,232,129,140,228,189,141,231,155,184,228,191,161,233,
+161,181,233,157,162,229,136,134,233,146,159,231,189,145,233,161,181,231,161,174,
+229,174,154,229,155,190,228,190,139,231,189,145,229,157,128,231,167,175,230,158,
+129,233,148,153,232,175,175,231,155,174,231,154,132,229,174,157,232,180,157,230,
+156,186,229,133,179,233,163,142,233,153,169,230,142,136,230,157,131,231,151,133,
+230,175,146,229,174,160,231,137,169,233,153,164,228,186,134,232,169,149,232,171,
+150,231,150,190,231,151,133,229,143,138,230,151,182,230,177,130,232,180,173,231,
+171,153,231,130,185,229,132,191,231,171,165,230,175,143,229,164,169,228,184,173,
+229,164,174,232,174,164,232,175,134,230,175,143,228,184,170,229,164,169,230,180,
+165,229,173,151,228,189,147,229,143,176,231,129,163,231,187,180,230,138,164,230,
+156,172,233,161,181,228,184,170,230,128,167,229,174,152,230,150,185,229,184,184,
+232,167,129,231,155,184,230,156,186,230,136,152,231,149,165,229,186,148,229,189,
+147,229,190,139,229,184,136,230,150,185,228,190,191,230,160,161,229,155,173,232,
+130,161,229,184,130,230,136,191,229,177,139,230,160,143,231,155,174,229,145,152,
+229,183,165,229,175,188,232,135,180,231,170,129,231,132,182,233,129,147,229,133,
+183,230,156,172,231,189,145,231,187,147,229,144,136,230,161,163,230,161,136,229,
+138,179,229,138,168,229,143,166,229,164,150,231,190,142,229,133,131,229,188,149,
+232,181,183,230,148,185,229,143,152,231,172,172,229,155,155,228,188,154,232,174,
+161,232,170,170,230,152,142,233,154,144,231,167,129,229,174,157,229,174,157,232,
+167,132,232,140,131,230,182,136,232,180,185,229,133,177,229,144,140,229,191,152,
+232,174,176,228,189,147,231,179,187,229,184,166,230,157,165,229,144,141,229,173,
+151,231,153,188,232,161,168,229,188,128,230,148,190,229,138,160,231,155,159,229,
+143,151,229,136,176,228,186,140,230,137,139,229,164,167,233,135,143,230,136,144,
+228,186,186,230,149,176,233,135,143,229,133,177,228,186,171,229,140,186,229,159,
+159,229,165,179,229,173,169,229,142,159,229,136,153,230,137,128,229,156,168,231,
+187,147,230,157,159,233,128,154,228,191,161,232,182,133,231,186,167,233,133,141,
+231,189,174,229,189,147,230,151,182,228,188,152,231,167,128,230,128,167,230,132,
+159,230,136,191,228,186,167,233,129,138,230,136,178,229,135,186,229,143,163,230,
+143,144,228,186,164,229,176,177,228,184,154,228,191,157,229,129,165,231,168,139,
+229,186,166,229,143,130,230,149,176,228,186,139,228,184,154,230,149,180,228,184,
+170,229,177,177,228,184,156,230,131,133,230,132,159,231,137,185,230,174,138,229,
+136,134,233,161,158,230,144,156,229,176,139,229,177,158,228,186,142,233,151,168,
+230,136,183,232,180,162,229,138,161,229,163,176,233,159,179,229,143,138,229,133,
+182,232,180,162,231,187,143,229,157,154,230,140,129,229,185,178,233,131,168,230,
+136,144,231,171,139,229,136,169,231,155,138,232,128,131,232,153,145,230,136,144,
+233,131,189,229,140,133,232,163,133,231,148,168,230,136,182,230,175,148,232,181,
+155,230,150,135,230,152,142,230,139,155,229,149,134,229,174,140,230,149,180,231,
+156,159,230,152,175,231,156,188,231,157,155,228,188,153,228,188,180,229,168,129,
+230,156,155,233,162,134,229,159,159,229,141,171,231,148,159,228,188,152,230,131,
+160,232,171,150,229,163,135,229,133,172,229,133,177,232,137,175,229,165,189,229,
+133,133,229,136,134,231,172,166,229,144,136,233,153,132,228,187,182,231,137,185,
+231,130,185,228,184,141,229,143,175,232,139,177,230,150,135,232,181,132,228,186,
+167,230,160,185,230,156,172,230,152,142,230,152,190,229,175,134,231,162,188,229,
+133,172,228,188,151,230,176,145,230,151,143,230,155,180,229,138,160,228,186,171,
+229,143,151,229,144,140,229,173,166,229,144,175,229,138,168,233,128,130,229,144,
+136,229,142,159,230,157,165,233,151,174,231,173,148,230,156,172,230,150,135,231,
+190,142,233,163,159,231,187,191,232,137,178,231,168,179,229,174,154,231,187,136,
+228,186,142,231,148,159,231,137,169,228,190,155,230,177,130,230,144,156,231,139,
+144,229,138,155,233,135,143,228,184,165,233,135,141,230,176,184,232,191,156,229,
+134,153,231,156,159,230,156,137,233,153,144,231,171,158,228,186,137,229,175,185,
+232,177,161,232,180,185,231,148,168,228,184,141,229,165,189,231,187,157,229,175,
+185,229,141,129,229,136,134,228,191,131,232,191,155,231,130,185,232,175,132,229,
+189,177,233,159,179,228,188,152,229,138,191,228,184,141,229,176,145,230,172,163,
+232,181,143,229,185,182,228,184,148,230,156,137,231,130,185,230,150,185,229,144,
+145,229,133,168,230,150,176,228,191,161,231,148,168,232,174,190,230,150,189,229,
+189,162,232,177,161,232,181,132,230,160,188,231,170,129,231,160,180,233,154,143,
+231,157,128,233,135,141,229,164,167,228,186,142,230,152,175,230,175,149,228,184,
+154,230,153,186,232,131,189,229,140,150,229,183,165,229,174,140,231,190,142,229,
+149,134,229,159,142,231,187,159,228,184,128,229,135,186,231,137,136,230,137,147,
+233,128,160,231,148,162,229,147,129,230,166,130,229,134,181,231,148,168,228,186,
+142,228,191,157,231,149,153,229,155,160,231,180,160,228,184,173,229,156,139,229,
+173,152,229,130,168,232,180,180,229,155,190,230,156,128,230,132,155,233,149,191,
+230,156,159,229,143,163,228,187,183,231,144,134,232,180,162,229,159,186,229,156,
+176,229,174,137,230,142,146,230,173,166,230,177,137,233,135,140,233,157,162,229,
+136,155,229,187,186,229,164,169,231,169,186,233,166,150,229,133,136,229,174,140,
+229,150,132,233,169,177,229,138,168,228,184,139,233,157,162,228,184,141,229,134,
+141,232,175,154,228,191,161,230,132,143,228,185,137,233,152,179,229,133,137,232,
+139,177,229,155,189,230,188,130,228,186,174,229,134,155,228,186,139,231,142,169,
+229,174,182,231,190,164,228,188,151,229,134,156,230,176,145,229,141,179,229,143,
+175,229,144,141,231,168,177,229,174,182,229,133,183,229,138,168,231,148,187,230,
+131,179,229,136,176,230,179,168,230,152,142,229,176,143,229,173,166,230,128,167,
+232,131,189,232,128,131,231,160,148,231,161,172,228,187,182,232,167,130,231,156,
+139,230,184,133,230,165,154,230,144,158,231,172,145,233,166,150,233,160,129,233,
+187,132,233,135,145,233,128,130,231,148,168,230,177,159,232,139,143,231,156,159,
+229,174,158,228,184,187,231,174,161,233,152,182,230,174,181,232,168,187,229,134,
+138,231,191,187,232,175,145,230,157,131,229,136,169,229,129,154,229,165,189,228,
+188,188,228,185,142,233,128,154,232,174,175,230,150,189,229,183,165,231,139,128,
+230,133,139,228,185,159,232,174,184,231,142,175,228,191,157,229,159,185,229,133,
+187,230,166,130,229,191,181,229,164,167,229,158,139,230,156,186,231,165,168,231,
+144,134,232,167,163,229,140,191,229,144,141,99,117,97,110,100,111,101,110,118,
+105,97,114,109,97,100,114,105,100,98,117,115,99,97,114,105,110,105,99,105,111,
+116,105,101,109,112,111,112,111,114,113,117,101,99,117,101,110,116,97,101,115,
+116,97,100,111,112,117,101,100,101,110,106,117,101,103,111,115,99,111,110,116,
+114,97,101,115,116,195,161,110,110,111,109,98,114,101,116,105,101,110,101,110,
+112,101,114,102,105,108,109,97,110,101,114,97,97,109,105,103,111,115,99,105,117,
+100,97,100,99,101,110,116,114,111,97,117,110,113,117,101,112,117,101,100,101,115
+,100,101,110,116,114,111,112,114,105,109,101,114,112,114,101,99,105,111,115,101,
+103,195,186,110,98,117,101,110,111,115,118,111,108,118,101,114,112,117,110,116,
+111,115,115,101,109,97,110,97,104,97,98,195,173,97,97,103,111,115,116,111,110,
+117,101,118,111,115,117,110,105,100,111,115,99,97,114,108,111,115,101,113,117,
+105,112,111,110,105,195,177,111,115,109,117,99,104,111,115,97,108,103,117,110,97
+,99,111,114,114,101,111,105,109,97,103,101,110,112,97,114,116,105,114,97,114,114
+,105,98,97,109,97,114,195,173,97,104,111,109,98,114,101,101,109,112,108,101,111,
+118,101,114,100,97,100,99,97,109,98,105,111,109,117,99,104,97,115,102,117,101,
+114,111,110,112,97,115,97,100,111,108,195,173,110,101,97,112,97,114,101,99,101,
+110,117,101,118,97,115,99,117,114,115,111,115,101,115,116,97,98,97,113,117,105,
+101,114,111,108,105,98,114,111,115,99,117,97,110,116,111,97,99,99,101,115,111,
+109,105,103,117,101,108,118,97,114,105,111,115,99,117,97,116,114,111,116,105,101
+,110,101,115,103,114,117,112,111,115,115,101,114,195,161,110,101,117,114,111,112
+,97,109,101,100,105,111,115,102,114,101,110,116,101,97,99,101,114,99,97,100,101,
+109,195,161,115,111,102,101,114,116,97,99,111,99,104,101,115,109,111,100,101,108
+,111,105,116,97,108,105,97,108,101,116,114,97,115,97,108,103,195,186,110,99,111,
+109,112,114,97,99,117,97,108,101,115,101,120,105,115,116,101,99,117,101,114,112,
+111,115,105,101,110,100,111,112,114,101,110,115,97,108,108,101,103,97,114,118,
+105,97,106,101,115,100,105,110,101,114,111,109,117,114,99,105,97,112,111,100,114
+,195,161,112,117,101,115,116,111,100,105,97,114,105,111,112,117,101,98,108,111,
+113,117,105,101,114,101,109,97,110,117,101,108,112,114,111,112,105,111,99,114,
+105,115,105,115,99,105,101,114,116,111,115,101,103,117,114,111,109,117,101,114,
+116,101,102,117,101,110,116,101,99,101,114,114,97,114,103,114,97,110,100,101,101
+,102,101,99,116,111,112,97,114,116,101,115,109,101,100,105,100,97,112,114,111,
+112,105,97,111,102,114,101,99,101,116,105,101,114,114,97,101,45,109,97,105,108,
+118,97,114,105,97,115,102,111,114,109,97,115,102,117,116,117,114,111,111,98,106,
+101,116,111,115,101,103,117,105,114,114,105,101,115,103,111,110,111,114,109,97,
+115,109,105,115,109,111,115,195,186,110,105,99,111,99,97,109,105,110,111,115,105
+,116,105,111,115,114,97,122,195,179,110,100,101,98,105,100,111,112,114,117,101,
+98,97,116,111,108,101,100,111,116,101,110,195,173,97,106,101,115,195,186,115,101
+,115,112,101,114,111,99,111,99,105,110,97,111,114,105,103,101,110,116,105,101,
+110,100,97,99,105,101,110,116,111,99,195,161,100,105,122,104,97,98,108,97,114,
+115,101,114,195,173,97,108,97,116,105,110,97,102,117,101,114,122,97,101,115,116,
+105,108,111,103,117,101,114,114,97,101,110,116,114,97,114,195,169,120,105,116,
+111,108,195,179,112,101,122,97,103,101,110,100,97,118,195,173,100,101,111,101,
+118,105,116,97,114,112,97,103,105,110,97,109,101,116,114,111,115,106,97,118,105,
+101,114,112,97,100,114,101,115,102,195,161,99,105,108,99,97,98,101,122,97,195,
+161,114,101,97,115,115,97,108,105,100,97,101,110,118,195,173,111,106,97,112,195,
+179,110,97,98,117,115,111,115,98,105,101,110,101,115,116,101,120,116,111,115,108
+,108,101,118,97,114,112,117,101,100,97,110,102,117,101,114,116,101,99,111,109,
+195,186,110,99,108,97,115,101,115,104,117,109,97,110,111,116,101,110,105,100,111
+,98,105,108,98,97,111,117,110,105,100,97,100,101,115,116,195,161,115,101,100,105
+,116,97,114,99,114,101,97,100,111,208,180,208,187,209,143,209,135,209,130,208,
+190,208,186,208,176,208,186,208,184,208,187,208,184,209,141,209,130,208,190,208,
+178,209,129,208,181,208,181,208,179,208,190,208,191,209,128,208,184,209,130,208,
+176,208,186,208,181,209,137,208,181,209,131,208,182,208,181,208,154,208,176,208,
+186,208,177,208,181,208,183,208,177,209,139,208,187,208,190,208,189,208,184,208,
+146,209,129,208,181,208,191,208,190,208,180,208,173,209,130,208,190,209,130,208,
+190,208,188,209,135,208,181,208,188,208,189,208,181,209,130,208,187,208,181,209,
+130,209,128,208,176,208,183,208,190,208,189,208,176,208,179,208,180,208,181,208,
+188,208,189,208,181,208,148,208,187,209,143,208,159,209,128,208,184,208,189,208,
+176,209,129,208,189,208,184,209,133,209,130,208,181,208,188,208,186,209,130,208,
+190,208,179,208,190,208,180,208,178,208,190,209,130,209,130,208,176,208,188,208,
+161,208,168,208,144,208,188,208,176,209,143,208,167,209,130,208,190,208,178,208,
+176,209,129,208,178,208,176,208,188,208,181,208,188,209,131,208,162,208,176,208,
+186,208,180,208,178,208,176,208,189,208,176,208,188,209,141,209,130,208,184,209,
+141,209,130,209,131,208,146,208,176,208,188,209,130,208,181,209,133,208,191,209,
+128,208,190,209,130,209,131,209,130,208,189,208,176,208,180,208,180,208,189,209,
+143,208,146,208,190,209,130,209,130,209,128,208,184,208,189,208,181,208,185,208,
+146,208,176,209,129,208,189,208,184,208,188,209,129,208,176,208,188,209,130,208,
+190,209,130,209,128,209,131,208,177,208,158,208,189,208,184,208,188,208,184,209,
+128,208,189,208,181,208,181,208,158,208,158,208,158,208,187,208,184,209,134,209,
+141,209,130,208,176,208,158,208,189,208,176,208,189,208,181,208,188,208,180,208,
+190,208,188,208,188,208,190,208,185,208,180,208,178,208,181,208,190,208,189,208,
+190,209,129,209,131,208,180,224,164,149,224,165,135,224,164,185,224,165,136,224,
+164,149,224,165,128,224,164,184,224,165,135,224,164,149,224,164,190,224,164,149,
+224,165,139,224,164,148,224,164,176,224,164,170,224,164,176,224,164,168,224,165,
+135,224,164,143,224,164,149,224,164,149,224,164,191,224,164,173,224,165,128,224,
+164,135,224,164,184,224,164,149,224,164,176,224,164,164,224,165,139,224,164,185,
+224,165,139,224,164,134,224,164,170,224,164,185,224,165,128,224,164,175,224,164,
+185,224,164,175,224,164,190,224,164,164,224,164,149,224,164,165,224,164,190,106,
+97,103,114,97,110,224,164,134,224,164,156,224,164,156,224,165,139,224,164,133,
+224,164,172,224,164,166,224,165,139,224,164,151,224,164,136,224,164,156,224,164,
+190,224,164,151,224,164,143,224,164,185,224,164,174,224,164,135,224,164,168,224,
+164,181,224,164,185,224,164,175,224,165,135,224,164,165,224,165,135,224,164,165,
+224,165,128,224,164,152,224,164,176,224,164,156,224,164,172,224,164,166,224,165,
+128,224,164,149,224,164,136,224,164,156,224,165,128,224,164,181,224,165,135,224,
+164,168,224,164,136,224,164,168,224,164,143,224,164,185,224,164,176,224,164,137,
+224,164,184,224,164,174,224,165,135,224,164,149,224,164,174,224,164,181,224,165,
+139,224,164,178,224,165,135,224,164,184,224,164,172,224,164,174,224,164,136,224,
+164,166,224,165,135,224,164,147,224,164,176,224,164,134,224,164,174,224,164,172,
+224,164,184,224,164,173,224,164,176,224,164,172,224,164,168,224,164,154,224,164,
+178,224,164,174,224,164,168,224,164,134,224,164,151,224,164,184,224,165,128,224,
+164,178,224,165,128,216,185,217,132,217,137,216,165,217,132,217,137,217,135,216,
+176,216,167,216,162,216,174,216,177,216,185,216,175,216,175,216,167,217,132,217,
+137,217,135,216,176,217,135,216,181,217,136,216,177,216,186,217,138,216,177,217,
+131,216,167,217,134,217,136,217,132,216,167,216,168,217,138,217,134,216,185,216,
+177,216,182,216,176,217,132,217,131,217,135,217,134,216,167,217,138,217,136,217,
+133,217,130,216,167,217,132,216,185,217,132,217,138,216,167,217,134,216,167,217,
+132,217,131,217,134,216,173,216,170,217,137,217,130,216,168,217,132,217,136,216,
+173,216,169,216,167,216,174,216,177,217,129,217,130,216,183,216,185,216,168,216,
+175,216,177,217,131,217,134,216,165,216,176,216,167,217,131,217,133,216,167,216,
+167,216,173,216,175,216,165,217,132,216,167,217,129,217,138,217,135,216,168,216,
+185,216,182,217,131,217,138,217,129,216,168,216,173,216,171,217,136,217,133,217,
+134,217,136,217,135,217,136,216,163,217,134,216,167,216,172,216,175,216,167,217,
+132,217,135,216,167,216,179,217,132,217,133,216,185,217,134,216,175,217,132,217,
+138,216,179,216,185,216,168,216,177,216,181,217,132,217,137,217,133,217,134,216,
+176,216,168,217,135,216,167,216,163,217,134,217,135,217,133,216,171,217,132,217,
+131,217,134,216,170,216,167,217,132,216,167,216,173,217,138,216,171,217,133,216,
+181,216,177,216,180,216,177,216,173,216,173,217,136,217,132,217,136,217,129,217,
+138,216,167,216,176,216,167,217,132,217,131,217,132,217,133,216,177,216,169,216,
+167,217,134,216,170,216,167,217,132,217,129,216,163,216,168,217,136,216,174,216,
+167,216,181,216,163,217,134,216,170,216,167,217,134,217,135,216,167,217,132,217,
+138,216,185,216,182,217,136,217,136,217,130,216,175,216,167,216,168,217,134,216,
+174,217,138,216,177,216,168,217,134,216,170,217,132,217,131,217,133,216,180,216,
+167,216,161,217,136,217,135,217,138,216,167,216,168,217,136,217,130,216,181,216,
+181,217,136,217,133,216,167,216,177,217,130,217,133,216,163,216,173,216,175,217,
+134,216,173,217,134,216,185,216,175,217,133,216,177,216,163,217,138,216,167,216,
+173,216,169,217,131,216,170,216,168,216,175,217,136,217,134,217,138,216,172,216,
+168,217,133,217,134,217,135,216,170,216,173,216,170,216,172,217,135,216,169,216,
+179,217,134,216,169,217,138,216,170,217,133,217,131,216,177,216,169,216,186,216,
+178,216,169,217,134,217,129,216,179,216,168,217,138,216,170,217,132,217,132,217,
+135,217,132,217,134,216,167,216,170,217,132,217,131,217,130,217,132,216,168,217,
+132,217,133,216,167,216,185,217,134,217,135,216,163,217,136,217,132,216,180,217,
+138,216,161,217,134,217,136,216,177,216,163,217,133,216,167,217,129,217,138,217,
+131,216,168,217,131,217,132,216,176,216,167,216,170,216,177,216,170,216,168,216,
+168,216,163,217,134,217,135,217,133,216,179,216,167,217,134,217,131,216,168,217,
+138,216,185,217,129,217,130,216,175,216,173,216,179,217,134,217,132,217,135,217,
+133,216,180,216,185,216,177,216,163,217,135,217,132,216,180,217,135,216,177,217,
+130,216,183,216,177,216,183,217,132,216,168,112,114,111,102,105,108,101,115,101,
+114,118,105,99,101,100,101,102,97,117,108,116,104,105,109,115,101,108,102,100,
+101,116,97,105,108,115,99,111,110,116,101,110,116,115,117,112,112,111,114,116,
+115,116,97,114,116,101,100,109,101,115,115,97,103,101,115,117,99,99,101,115,115,
+102,97,115,104,105,111,110,60,116,105,116,108,101,62,99,111,117,110,116,114,121,
+97,99,99,111,117,110,116,99,114,101,97,116,101,100,115,116,111,114,105,101,115,
+114,101,115,117,108,116,115,114,117,110,110,105,110,103,112,114,111,99,101,115,
+115,119,114,105,116,105,110,103,111,98,106,101,99,116,115,118,105,115,105,98,108
+,101,119,101,108,99,111,109,101,97,114,116,105,99,108,101,117,110,107,110,111,
+119,110,110,101,116,119,111,114,107,99,111,109,112,97,110,121,100,121,110,97,109
+,105,99,98,114,111,119,115,101,114,112,114,105,118,97,99,121,112,114,111,98,108,
+101,109,83,101,114,118,105,99,101,114,101,115,112,101,99,116,100,105,115,112,108
+,97,121,114,101,113,117,101,115,116,114,101,115,101,114,118,101,119,101,98,115,
+105,116,101,104,105,115,116,111,114,121,102,114,105,101,110,100,115,111,112,116,
+105,111,110,115,119,111,114,107,105,110,103,118,101,114,115,105,111,110,109,105,
+108,108,105,111,110,99,104,97,110,110,101,108,119,105,110,100,111,119,46,97,100,
+100,114,101,115,115,118,105,115,105,116,101,100,119,101,97,116,104,101,114,99,
+111,114,114,101,99,116,112,114,111,100,117,99,116,101,100,105,114,101,99,116,102
+,111,114,119,97,114,100,121,111,117,32,99,97,110,114,101,109,111,118,101,100,115
+,117,98,106,101,99,116,99,111,110,116,114,111,108,97,114,99,104,105,118,101,99,
+117,114,114,101,110,116,114,101,97,100,105,110,103,108,105,98,114,97,114,121,108
+,105,109,105,116,101,100,109,97,110,97,103,101,114,102,117,114,116,104,101,114,
+115,117,109,109,97,114,121,109,97,99,104,105,110,101,109,105,110,117,116,101,115
+,112,114,105,118,97,116,101,99,111,110,116,101,120,116,112,114,111,103,114,97,
+109,115,111,99,105,101,116,121,110,117,109,98,101,114,115,119,114,105,116,116,
+101,110,101,110,97,98,108,101,100,116,114,105,103,103,101,114,115,111,117,114,99
+,101,115,108,111,97,100,105,110,103,101,108,101,109,101,110,116,112,97,114,116,
+110,101,114,102,105,110,97,108,108,121,112,101,114,102,101,99,116,109,101,97,110
+,105,110,103,115,121,115,116,101,109,115,107,101,101,112,105,110,103,99,117,108,
+116,117,114,101,38,113,117,111,116,59,44,106,111,117,114,110,97,108,112,114,111,
+106,101,99,116,115,117,114,102,97,99,101,115,38,113,117,111,116,59,101,120,112,
+105,114,101,115,114,101,118,105,101,119,115,98,97,108,97,110,99,101,69,110,103,
+108,105,115,104,67,111,110,116,101,110,116,116,104,114,111,117,103,104,80,108,
+101,97,115,101,32,111,112,105,110,105,111,110,99,111,110,116,97,99,116,97,118,
+101,114,97,103,101,112,114,105,109,97,114,121,118,105,108,108,97,103,101,83,112,
+97,110,105,115,104,103,97,108,108,101,114,121,100,101,99,108,105,110,101,109,101
+,101,116,105,110,103,109,105,115,115,105,111,110,112,111,112,117,108,97,114,113,
+117,97,108,105,116,121,109,101,97,115,117,114,101,103,101,110,101,114,97,108,115
+,112,101,99,105,101,115,115,101,115,115,105,111,110,115,101,99,116,105,111,110,
+119,114,105,116,101,114,115,99,111,117,110,116,101,114,105,110,105,116,105,97,
+108,114,101,112,111,114,116,115,102,105,103,117,114,101,115,109,101,109,98,101,
+114,115,104,111,108,100,105,110,103,100,105,115,112,117,116,101,101,97,114,108,
+105,101,114,101,120,112,114,101,115,115,100,105,103,105,116,97,108,112,105,99,
+116,117,114,101,65,110,111,116,104,101,114,109,97,114,114,105,101,100,116,114,97
+,102,102,105,99,108,101,97,100,105,110,103,99,104,97,110,103,101,100,99,101,110,
+116,114,97,108,118,105,99,116,111,114,121,105,109,97,103,101,115,47,114,101,97,
+115,111,110,115,115,116,117,100,105,101,115,102,101,97,116,117,114,101,108,105,
+115,116,105,110,103,109,117,115,116,32,98,101,115,99,104,111,111,108,115,86,101,
+114,115,105,111,110,117,115,117,97,108,108,121,101,112,105,115,111,100,101,112,
+108,97,121,105,110,103,103,114,111,119,105,110,103,111,98,118,105,111,117,115,
+111,118,101,114,108,97,121,112,114,101,115,101,110,116,97,99,116,105,111,110,115
+,60,47,117,108,62,13,10,119,114,97,112,112,101,114,97,108,114,101,97,100,121,99,
+101,114,116,97,105,110,114,101,97,108,105,116,121,115,116,111,114,97,103,101,97,
+110,111,116,104,101,114,100,101,115,107,116,111,112,111,102,102,101,114,101,100,
+112,97,116,116,101,114,110,117,110,117,115,117,97,108,68,105,103,105,116,97,108,
+99,97,112,105,116,97,108,87,101,98,115,105,116,101,102,97,105,108,117,114,101,99
+,111,110,110,101,99,116,114,101,100,117,99,101,100,65,110,100,114,111,105,100,
+100,101,99,97,100,101,115,114,101,103,117,108,97,114,32,38,97,109,112,59,32,97,
+110,105,109,97,108,115,114,101,108,101,97,115,101,65,117,116,111,109,97,116,103,
+101,116,116,105,110,103,109,101,116,104,111,100,115,110,111,116,104,105,110,103,
+80,111,112,117,108,97,114,99,97,112,116,105,111,110,108,101,116,116,101,114,115,
+99,97,112,116,117,114,101,115,99,105,101,110,99,101,108,105,99,101,110,115,101,
+99,104,97,110,103,101,115,69,110,103,108,97,110,100,61,49,38,97,109,112,59,72,
+105,115,116,111,114,121,32,61,32,110,101,119,32,67,101,110,116,114,97,108,117,
+112,100,97,116,101,100,83,112,101,99,105,97,108,78,101,116,119,111,114,107,114,
+101,113,117,105,114,101,99,111,109,109,101,110,116,119,97,114,110,105,110,103,67
+,111,108,108,101,103,101,116,111,111,108,98,97,114,114,101,109,97,105,110,115,98
+,101,99,97,117,115,101,101,108,101,99,116,101,100,68,101,117,116,115,99,104,102,
+105,110,97,110,99,101,119,111,114,107,101,114,115,113,117,105,99,107,108,121,98,
+101,116,119,101,101,110,101,120,97,99,116,108,121,115,101,116,116,105,110,103,
+100,105,115,101,97,115,101,83,111,99,105,101,116,121,119,101,97,112,111,110,115,
+101,120,104,105,98,105,116,38,108,116,59,33,45,45,67,111,110,116,114,111,108,99,
+108,97,115,115,101,115,99,111,118,101,114,101,100,111,117,116,108,105,110,101,97
+,116,116,97,99,107,115,100,101,118,105,99,101,115,40,119,105,110,100,111,119,112
+,117,114,112,111,115,101,116,105,116,108,101,61,34,77,111,98,105,108,101,32,107,
+105,108,108,105,110,103,115,104,111,119,105,110,103,73,116,97,108,105,97,110,100
+,114,111,112,112,101,100,104,101,97,118,105,108,121,101,102,102,101,99,116,115,
+45,49,39,93,41,59,10,99,111,110,102,105,114,109,67,117,114,114,101,110,116,97,
+100,118,97,110,99,101,115,104,97,114,105,110,103,111,112,101,110,105,110,103,100
+,114,97,119,105,110,103,98,105,108,108,105,111,110,111,114,100,101,114,101,100,
+71,101,114,109,97,110,121,114,101,108,97,116,101,100,60,47,102,111,114,109,62,
+105,110,99,108,117,100,101,119,104,101,116,104,101,114,100,101,102,105,110,101,
+100,83,99,105,101,110,99,101,99,97,116,97,108,111,103,65,114,116,105,99,108,101,
+98,117,116,116,111,110,115,108,97,114,103,101,115,116,117,110,105,102,111,114,
+109,106,111,117,114,110,101,121,115,105,100,101,98,97,114,67,104,105,99,97,103,
+111,104,111,108,105,100,97,121,71,101,110,101,114,97,108,112,97,115,115,97,103,
+101,44,38,113,117,111,116,59,97,110,105,109,97,116,101,102,101,101,108,105,110,
+103,97,114,114,105,118,101,100,112,97,115,115,105,110,103,110,97,116,117,114,97,
+108,114,111,117,103,104,108,121,46,10,10,84,104,101,32,98,117,116,32,110,111,116
+,100,101,110,115,105,116,121,66,114,105,116,97,105,110,67,104,105,110,101,115,
+101,108,97,99,107,32,111,102,116,114,105,98,117,116,101,73,114,101,108,97,110,
+100,34,32,100,97,116,97,45,102,97,99,116,111,114,115,114,101,99,101,105,118,101,
+116,104,97,116,32,105,115,76,105,98,114,97,114,121,104,117,115,98,97,110,100,105
+,110,32,102,97,99,116,97,102,102,97,105,114,115,67,104,97,114,108,101,115,114,97
+,100,105,99,97,108,98,114,111,117,103,104,116,102,105,110,100,105,110,103,108,97
+,110,100,105,110,103,58,108,97,110,103,61,34,114,101,116,117,114,110,32,108,101,
+97,100,101,114,115,112,108,97,110,110,101,100,112,114,101,109,105,117,109,112,97
+,99,107,97,103,101,65,109,101,114,105,99,97,69,100,105,116,105,111,110,93,38,113
+,117,111,116,59,77,101,115,115,97,103,101,110,101,101,100,32,116,111,118,97,108,
+117,101,61,34,99,111,109,112,108,101,120,108,111,111,107,105,110,103,115,116,97,
+116,105,111,110,98,101,108,105,101,118,101,115,109,97,108,108,101,114,45,109,111
+,98,105,108,101,114,101,99,111,114,100,115,119,97,110,116,32,116,111,107,105,110
+,100,32,111,102,70,105,114,101,102,111,120,121,111,117,32,97,114,101,115,105,109
+,105,108,97,114,115,116,117,100,105,101,100,109,97,120,105,109,117,109,104,101,
+97,100,105,110,103,114,97,112,105,100,108,121,99,108,105,109,97,116,101,107,105,
+110,103,100,111,109,101,109,101,114,103,101,100,97,109,111,117,110,116,115,102,
+111,117,110,100,101,100,112,105,111,110,101,101,114,102,111,114,109,117,108,97,
+100,121,110,97,115,116,121,104,111,119,32,116,111,32,83,117,112,112,111,114,116,
+114,101,118,101,110,117,101,101,99,111,110,111,109,121,82,101,115,117,108,116,
+115,98,114,111,116,104,101,114,115,111,108,100,105,101,114,108,97,114,103,101,
+108,121,99,97,108,108,105,110,103,46,38,113,117,111,116,59,65,99,99,111,117,110,
+116,69,100,119,97,114,100,32,115,101,103,109,101,110,116,82,111,98,101,114,116,
+32,101,102,102,111,114,116,115,80,97,99,105,102,105,99,108,101,97,114,110,101,
+100,117,112,32,119,105,116,104,104,101,105,103,104,116,58,119,101,32,104,97,118,
+101,65,110,103,101,108,101,115,110,97,116,105,111,110,115,95,115,101,97,114,99,
+104,97,112,112,108,105,101,100,97,99,113,117,105,114,101,109,97,115,115,105,118,
+101,103,114,97,110,116,101,100,58,32,102,97,108,115,101,116,114,101,97,116,101,
+100,98,105,103,103,101,115,116,98,101,110,101,102,105,116,100,114,105,118,105,
+110,103,83,116,117,100,105,101,115,109,105,110,105,109,117,109,112,101,114,104,
+97,112,115,109,111,114,110,105,110,103,115,101,108,108,105,110,103,105,115,32,
+117,115,101,100,114,101,118,101,114,115,101,118,97,114,105,97,110,116,32,114,111
+,108,101,61,34,109,105,115,115,105,110,103,97,99,104,105,101,118,101,112,114,111
+,109,111,116,101,115,116,117,100,101,110,116,115,111,109,101,111,110,101,101,120
+,116,114,101,109,101,114,101,115,116,111,114,101,98,111,116,116,111,109,58,101,
+118,111,108,118,101,100,97,108,108,32,116,104,101,115,105,116,101,109,97,112,101
+,110,103,108,105,115,104,119,97,121,32,116,111,32,32,65,117,103,117,115,116,115,
+121,109,98,111,108,115,67,111,109,112,97,110,121,109,97,116,116,101,114,115,109,
+117,115,105,99,97,108,97,103,97,105,110,115,116,115,101,114,118,105,110,103,125,
+41,40,41,59,13,10,112,97,121,109,101,110,116,116,114,111,117,98,108,101,99,111,
+110,99,101,112,116,99,111,109,112,97,114,101,112,97,114,101,110,116,115,112,108,
+97,121,101,114,115,114,101,103,105,111,110,115,109,111,110,105,116,111,114,32,39
+,39,84,104,101,32,119,105,110,110,105,110,103,101,120,112,108,111,114,101,97,100
+,97,112,116,101,100,71,97,108,108,101,114,121,112,114,111,100,117,99,101,97,98,
+105,108,105,116,121,101,110,104,97,110,99,101,99,97,114,101,101,114,115,41,46,32
+,84,104,101,32,99,111,108,108,101,99,116,83,101,97,114,99,104,32,97,110,99,105,
+101,110,116,101,120,105,115,116,101,100,102,111,111,116,101,114,32,104,97,110,
+100,108,101,114,112,114,105,110,116,101,100,99,111,110,115,111,108,101,69,97,115
+,116,101,114,110,101,120,112,111,114,116,115,119,105,110,100,111,119,115,67,104,
+97,110,110,101,108,105,108,108,101,103,97,108,110,101,117,116,114,97,108,115,117
+,103,103,101,115,116,95,104,101,97,100,101,114,115,105,103,110,105,110,103,46,
+104,116,109,108,34,62,115,101,116,116,108,101,100,119,101,115,116,101,114,110,99
+,97,117,115,105,110,103,45,119,101,98,107,105,116,99,108,97,105,109,101,100,74,
+117,115,116,105,99,101,99,104,97,112,116,101,114,118,105,99,116,105,109,115,84,
+104,111,109,97,115,32,109,111,122,105,108,108,97,112,114,111,109,105,115,101,112
+,97,114,116,105,101,115,101,100,105,116,105,111,110,111,117,116,115,105,100,101,
+58,102,97,108,115,101,44,104,117,110,100,114,101,100,79,108,121,109,112,105,99,
+95,98,117,116,116,111,110,97,117,116,104,111,114,115,114,101,97,99,104,101,100,
+99,104,114,111,110,105,99,100,101,109,97,110,100,115,115,101,99,111,110,100,115,
+112,114,111,116,101,99,116,97,100,111,112,116,101,100,112,114,101,112,97,114,101
+,110,101,105,116,104,101,114,103,114,101,97,116,108,121,103,114,101,97,116,101,
+114,111,118,101,114,97,108,108,105,109,112,114,111,118,101,99,111,109,109,97,110
+,100,115,112,101,99,105,97,108,115,101,97,114,99,104,46,119,111,114,115,104,105,
+112,102,117,110,100,105,110,103,116,104,111,117,103,104,116,104,105,103,104,101,
+115,116,105,110,115,116,101,97,100,117,116,105,108,105,116,121,113,117,97,114,
+116,101,114,67,117,108,116,117,114,101,116,101,115,116,105,110,103,99,108,101,97
+,114,108,121,101,120,112,111,115,101,100,66,114,111,119,115,101,114,108,105,98,
+101,114,97,108,125,32,99,97,116,99,104,80,114,111,106,101,99,116,101,120,97,109,
+112,108,101,104,105,100,101,40,41,59,70,108,111,114,105,100,97,97,110,115,119,
+101,114,115,97,108,108,111,119,101,100,69,109,112,101,114,111,114,100,101,102,
+101,110,115,101,115,101,114,105,111,117,115,102,114,101,101,100,111,109,83,101,
+118,101,114,97,108,45,98,117,116,116,111,110,70,117,114,116,104,101,114,111,117,
+116,32,111,102,32,33,61,32,110,117,108,108,116,114,97,105,110,101,100,68,101,110
+,109,97,114,107,118,111,105,100,40,48,41,47,97,108,108,46,106,115,112,114,101,
+118,101,110,116,82,101,113,117,101,115,116,83,116,101,112,104,101,110,10,10,87,
+104,101,110,32,111,98,115,101,114,118,101,60,47,104,50,62,13,10,77,111,100,101,
+114,110,32,112,114,111,118,105,100,101,34,32,97,108,116,61,34,98,111,114,100,101
+,114,115,46,10,10,70,111,114,32,10,10,77,97,110,121,32,97,114,116,105,115,116,
+115,112,111,119,101,114,101,100,112,101,114,102,111,114,109,102,105,99,116,105,
+111,110,116,121,112,101,32,111,102,109,101,100,105,99,97,108,116,105,99,107,101,
+116,115,111,112,112,111,115,101,100,67,111,117,110,99,105,108,119,105,116,110,
+101,115,115,106,117,115,116,105,99,101,71,101,111,114,103,101,32,66,101,108,103,
+105,117,109,46,46,46,60,47,97,62,116,119,105,116,116,101,114,110,111,116,97,98,
+108,121,119,97,105,116,105,110,103,119,97,114,102,97,114,101,32,79,116,104,101,
+114,32,114,97,110,107,105,110,103,112,104,114,97,115,101,115,109,101,110,116,105
+,111,110,115,117,114,118,105,118,101,115,99,104,111,108,97,114,60,47,112,62,13,
+10,32,67,111,117,110,116,114,121,105,103,110,111,114,101,100,108,111,115,115,32,
+111,102,106,117,115,116,32,97,115,71,101,111,114,103,105,97,115,116,114,97,110,
+103,101,60,104,101,97,100,62,60,115,116,111,112,112,101,100,49,39,93,41,59,13,10
+,105,115,108,97,110,100,115,110,111,116,97,98,108,101,98,111,114,100,101,114,58,
+108,105,115,116,32,111,102,99,97,114,114,105,101,100,49,48,48,44,48,48,48,60,47,
+104,51,62,10,32,115,101,118,101,114,97,108,98,101,99,111,109,101,115,115,101,108
+,101,99,116,32,119,101,100,100,105,110,103,48,48,46,104,116,109,108,109,111,110,
+97,114,99,104,111,102,102,32,116,104,101,116,101,97,99,104,101,114,104,105,103,
+104,108,121,32,98,105,111,108,111,103,121,108,105,102,101,32,111,102,111,114,32,
+101,118,101,110,114,105,115,101,32,111,102,38,114,97,113,117,111,59,112,108,117,
+115,111,110,101,104,117,110,116,105,110,103,40,116,104,111,117,103,104,68,111,
+117,103,108,97,115,106,111,105,110,105,110,103,99,105,114,99,108,101,115,70,111,
+114,32,116,104,101,65,110,99,105,101,110,116,86,105,101,116,110,97,109,118,101,
+104,105,99,108,101,115,117,99,104,32,97,115,99,114,121,115,116,97,108,118,97,108
+,117,101,32,61,87,105,110,100,111,119,115,101,110,106,111,121,101,100,97,32,115,
+109,97,108,108,97,115,115,117,109,101,100,60,97,32,105,100,61,34,102,111,114,101
+,105,103,110,32,65,108,108,32,114,105,104,111,119,32,116,104,101,68,105,115,112,
+108,97,121,114,101,116,105,114,101,100,104,111,119,101,118,101,114,104,105,100,
+100,101,110,59,98,97,116,116,108,101,115,115,101,101,107,105,110,103,99,97,98,
+105,110,101,116,119,97,115,32,110,111,116,108,111,111,107,32,97,116,99,111,110,
+100,117,99,116,103,101,116,32,116,104,101,74,97,110,117,97,114,121,104,97,112,
+112,101,110,115,116,117,114,110,105,110,103,97,58,104,111,118,101,114,79,110,108
+,105,110,101,32,70,114,101,110,99,104,32,108,97,99,107,105,110,103,116,121,112,
+105,99,97,108,101,120,116,114,97,99,116,101,110,101,109,105,101,115,101,118,101,
+110,32,105,102,103,101,110,101,114,97,116,100,101,99,105,100,101,100,97,114,101,
+32,110,111,116,47,115,101,97,114,99,104,98,101,108,105,101,102,115,45,105,109,97
+,103,101,58,108,111,99,97,116,101,100,115,116,97,116,105,99,46,108,111,103,105,
+110,34,62,99,111,110,118,101,114,116,118,105,111,108,101,110,116,101,110,116,101
+,114,101,100,102,105,114,115,116,34,62,99,105,114,99,117,105,116,70,105,110,108,
+97,110,100,99,104,101,109,105,115,116,115,104,101,32,119,97,115,49,48,112,120,59
+,34,62,97,115,32,115,117,99,104,100,105,118,105,100,101,100,60,47,115,112,97,110
+,62,119,105,108,108,32,98,101,108,105,110,101,32,111,102,97,32,103,114,101,97,
+116,109,121,115,116,101,114,121,47,105,110,100,101,120,46,102,97,108,108,105,110
+,103,100,117,101,32,116,111,32,114,97,105,108,119,97,121,99,111,108,108,101,103,
+101,109,111,110,115,116,101,114,100,101,115,99,101,110,116,105,116,32,119,105,
+116,104,110,117,99,108,101,97,114,74,101,119,105,115,104,32,112,114,111,116,101,
+115,116,66,114,105,116,105,115,104,102,108,111,119,101,114,115,112,114,101,100,
+105,99,116,114,101,102,111,114,109,115,98,117,116,116,111,110,32,119,104,111,32,
+119,97,115,108,101,99,116,117,114,101,105,110,115,116,97,110,116,115,117,105,99,
+105,100,101,103,101,110,101,114,105,99,112,101,114,105,111,100,115,109,97,114,
+107,101,116,115,83,111,99,105,97,108,32,102,105,115,104,105,110,103,99,111,109,
+98,105,110,101,103,114,97,112,104,105,99,119,105,110,110,101,114,115,60,98,114,
+32,47,62,60,98,121,32,116,104,101,32,78,97,116,117,114,97,108,80,114,105,118,97,
+99,121,99,111,111,107,105,101,115,111,117,116,99,111,109,101,114,101,115,111,108
+,118,101,83,119,101,100,105,115,104,98,114,105,101,102,108,121,80,101,114,115,
+105,97,110,115,111,32,109,117,99,104,67,101,110,116,117,114,121,100,101,112,105,
+99,116,115,99,111,108,117,109,110,115,104,111,117,115,105,110,103,115,99,114,105
+,112,116,115,110,101,120,116,32,116,111,98,101,97,114,105,110,103,109,97,112,112
+,105,110,103,114,101,118,105,115,101,100,106,81,117,101,114,121,40,45,119,105,
+100,116,104,58,116,105,116,108,101,34,62,116,111,111,108,116,105,112,83,101,99,
+116,105,111,110,100,101,115,105,103,110,115,84,117,114,107,105,115,104,121,111,
+117,110,103,101,114,46,109,97,116,99,104,40,125,41,40,41,59,10,10,98,117,114,110
+,105,110,103,111,112,101,114,97,116,101,100,101,103,114,101,101,115,115,111,117,
+114,99,101,61,82,105,99,104,97,114,100,99,108,111,115,101,108,121,112,108,97,115
+,116,105,99,101,110,116,114,105,101,115,60,47,116,114,62,13,10,99,111,108,111,
+114,58,35,117,108,32,105,100,61,34,112,111,115,115,101,115,115,114,111,108,108,
+105,110,103,112,104,121,115,105,99,115,102,97,105,108,105,110,103,101,120,101,99
+,117,116,101,99,111,110,116,101,115,116,108,105,110,107,32,116,111,68,101,102,97
+,117,108,116,60,98,114,32,47,62,10,58,32,116,114,117,101,44,99,104,97,114,116,
+101,114,116,111,117,114,105,115,109,99,108,97,115,115,105,99,112,114,111,99,101,
+101,100,101,120,112,108,97,105,110,60,47,104,49,62,13,10,111,110,108,105,110,101
+,46,63,120,109,108,32,118,101,104,101,108,112,105,110,103,100,105,97,109,111,110
+,100,117,115,101,32,116,104,101,97,105,114,108,105,110,101,101,110,100,32,45,45,
+62,41,46,97,116,116,114,40,114,101,97,100,101,114,115,104,111,115,116,105,110,
+103,35,102,102,102,102,102,102,114,101,97,108,105,122,101,86,105,110,99,101,110,
+116,115,105,103,110,97,108,115,32,115,114,99,61,34,47,80,114,111,100,117,99,116,
+100,101,115,112,105,116,101,100,105,118,101,114,115,101,116,101,108,108,105,110,
+103,80,117,98,108,105,99,32,104,101,108,100,32,105,110,74,111,115,101,112,104,32
+,116,104,101,97,116,114,101,97,102,102,101,99,116,115,60,115,116,121,108,101,62,
+97,32,108,97,114,103,101,100,111,101,115,110,39,116,108,97,116,101,114,44,32,69,
+108,101,109,101,110,116,102,97,118,105,99,111,110,99,114,101,97,116,111,114,72,
+117,110,103,97,114,121,65,105,114,112,111,114,116,115,101,101,32,116,104,101,115
+,111,32,116,104,97,116,77,105,99,104,97,101,108,83,121,115,116,101,109,115,80,
+114,111,103,114,97,109,115,44,32,97,110,100,32,32,119,105,100,116,104,61,101,38,
+113,117,111,116,59,116,114,97,100,105,110,103,108,101,102,116,34,62,10,112,101,
+114,115,111,110,115,71,111,108,100,101,110,32,65,102,102,97,105,114,115,103,114,
+97,109,109,97,114,102,111,114,109,105,110,103,100,101,115,116,114,111,121,105,
+100,101,97,32,111,102,99,97,115,101,32,111,102,111,108,100,101,115,116,32,116,
+104,105,115,32,105,115,46,115,114,99,32,61,32,99,97,114,116,111,111,110,114,101,
+103,105,115,116,114,67,111,109,109,111,110,115,77,117,115,108,105,109,115,87,104
+,97,116,32,105,115,105,110,32,109,97,110,121,109,97,114,107,105,110,103,114,101,
+118,101,97,108,115,73,110,100,101,101,100,44,101,113,117,97,108,108,121,47,115,
+104,111,119,95,97,111,117,116,100,111,111,114,101,115,99,97,112,101,40,65,117,
+115,116,114,105,97,103,101,110,101,116,105,99,115,121,115,116,101,109,44,73,110,
+32,116,104,101,32,115,105,116,116,105,110,103,72,101,32,97,108,115,111,73,115,
+108,97,110,100,115,65,99,97,100,101,109,121,10,9,9,60,33,45,45,68,97,110,105,101
+,108,32,98,105,110,100,105,110,103,98,108,111,99,107,34,62,105,109,112,111,115,
+101,100,117,116,105,108,105,122,101,65,98,114,97,104,97,109,40,101,120,99,101,
+112,116,123,119,105,100,116,104,58,112,117,116,116,105,110,103,41,46,104,116,109
+,108,40,124,124,32,91,93,59,10,68,65,84,65,91,32,42,107,105,116,99,104,101,110,
+109,111,117,110,116,101,100,97,99,116,117,97,108,32,100,105,97,108,101,99,116,
+109,97,105,110,108,121,32,95,98,108,97,110,107,39,105,110,115,116,97,108,108,101
+,120,112,101,114,116,115,105,102,40,116,121,112,101,73,116,32,97,108,115,111,38,
+99,111,112,121,59,32,34,62,84,101,114,109,115,98,111,114,110,32,105,110,79,112,
+116,105,111,110,115,101,97,115,116,101,114,110,116,97,108,107,105,110,103,99,111
+,110,99,101,114,110,103,97,105,110,101,100,32,111,110,103,111,105,110,103,106,
+117,115,116,105,102,121,99,114,105,116,105,99,115,102,97,99,116,111,114,121,105,
+116,115,32,111,119,110,97,115,115,97,117,108,116,105,110,118,105,116,101,100,108
+,97,115,116,105,110,103,104,105,115,32,111,119,110,104,114,101,102,61,34,47,34,
+32,114,101,108,61,34,100,101,118,101,108,111,112,99,111,110,99,101,114,116,100,
+105,97,103,114,97,109,100,111,108,108,97,114,115,99,108,117,115,116,101,114,112,
+104,112,63,105,100,61,97,108,99,111,104,111,108,41,59,125,41,40,41,59,117,115,
+105,110,103,32,97,62,60,115,112,97,110,62,118,101,115,115,101,108,115,114,101,
+118,105,118,97,108,65,100,100,114,101,115,115,97,109,97,116,101,117,114,97,110,
+100,114,111,105,100,97,108,108,101,103,101,100,105,108,108,110,101,115,115,119,
+97,108,107,105,110,103,99,101,110,116,101,114,115,113,117,97,108,105,102,121,109
+,97,116,99,104,101,115,117,110,105,102,105,101,100,101,120,116,105,110,99,116,68
+,101,102,101,110,115,101,100,105,101,100,32,105,110,10,9,60,33,45,45,32,99,117,
+115,116,111,109,115,108,105,110,107,105,110,103,76,105,116,116,108,101,32,66,111
+,111,107,32,111,102,101,118,101,110,105,110,103,109,105,110,46,106,115,63,97,114
+,101,32,116,104,101,107,111,110,116,97,107,116,116,111,100,97,121,39,115,46,104,
+116,109,108,34,32,116,97,114,103,101,116,61,119,101,97,114,105,110,103,65,108,
+108,32,82,105,103,59,10,125,41,40,41,59,114,97,105,115,105,110,103,32,65,108,115
+,111,44,32,99,114,117,99,105,97,108,97,98,111,117,116,34,62,100,101,99,108,97,
+114,101,45,45,62,10,60,115,99,102,105,114,101,102,111,120,97,115,32,109,117,99,
+104,97,112,112,108,105,101,115,105,110,100,101,120,44,32,115,44,32,98,117,116,32
+,116,121,112,101,32,61,32,10,13,10,60,33,45,45,116,111,119,97,114,100,115,82,101
+,99,111,114,100,115,80,114,105,118,97,116,101,70,111,114,101,105,103,110,80,114,
+101,109,105,101,114,99,104,111,105,99,101,115,86,105,114,116,117,97,108,114,101,
+116,117,114,110,115,67,111,109,109,101,110,116,80,111,119,101,114,101,100,105,
+110,108,105,110,101,59,112,111,118,101,114,116,121,99,104,97,109,98,101,114,76,
+105,118,105,110,103,32,118,111,108,117,109,101,115,65,110,116,104,111,110,121,
+108,111,103,105,110,34,32,82,101,108,97,116,101,100,69,99,111,110,111,109,121,
+114,101,97,99,104,101,115,99,117,116,116,105,110,103,103,114,97,118,105,116,121,
+108,105,102,101,32,105,110,67,104,97,112,116,101,114,45,115,104,97,100,111,119,
+78,111,116,97,98,108,101,60,47,116,100,62,13,10,32,114,101,116,117,114,110,115,
+116,97,100,105,117,109,119,105,100,103,101,116,115,118,97,114,121,105,110,103,
+116,114,97,118,101,108,115,104,101,108,100,32,98,121,119,104,111,32,97,114,101,
+119,111,114,107,32,105,110,102,97,99,117,108,116,121,97,110,103,117,108,97,114,
+119,104,111,32,104,97,100,97,105,114,112,111,114,116,116,111,119,110,32,111,102,
+10,10,83,111,109,101,32,39,99,108,105,99,107,39,99,104,97,114,103,101,115,107,
+101,121,119,111,114,100,105,116,32,119,105,108,108,99,105,116,121,32,111,102,40,
+116,104,105,115,41,59,65,110,100,114,101,119,32,117,110,105,113,117,101,32,99,
+104,101,99,107,101,100,111,114,32,109,111,114,101,51,48,48,112,120,59,32,114,101
+,116,117,114,110,59,114,115,105,111,110,61,34,112,108,117,103,105,110,115,119,
+105,116,104,105,110,32,104,101,114,115,101,108,102,83,116,97,116,105,111,110,70,
+101,100,101,114,97,108,118,101,110,116,117,114,101,112,117,98,108,105,115,104,
+115,101,110,116,32,116,111,116,101,110,115,105,111,110,97,99,116,114,101,115,115
+,99,111,109,101,32,116,111,102,105,110,103,101,114,115,68,117,107,101,32,111,102
+,112,101,111,112,108,101,44,101,120,112,108,111,105,116,119,104,97,116,32,105,
+115,104,97,114,109,111,110,121,97,32,109,97,106,111,114,34,58,34,104,116,116,112
+,105,110,32,104,105,115,32,109,101,110,117,34,62,10,109,111,110,116,104,108,121,
+111,102,102,105,99,101,114,99,111,117,110,99,105,108,103,97,105,110,105,110,103,
+101,118,101,110,32,105,110,83,117,109,109,97,114,121,100,97,116,101,32,111,102,
+108,111,121,97,108,116,121,102,105,116,110,101,115,115,97,110,100,32,119,97,115,
+101,109,112,101,114,111,114,115,117,112,114,101,109,101,83,101,99,111,110,100,32
+,104,101,97,114,105,110,103,82,117,115,115,105,97,110,108,111,110,103,101,115,
+116,65,108,98,101,114,116,97,108,97,116,101,114,97,108,115,101,116,32,111,102,32
+,115,109,97,108,108,34,62,46,97,112,112,101,110,100,100,111,32,119,105,116,104,
+102,101,100,101,114,97,108,98,97,110,107,32,111,102,98,101,110,101,97,116,104,68
+,101,115,112,105,116,101,67,97,112,105,116,97,108,103,114,111,117,110,100,115,41
+,44,32,97,110,100,32,112,101,114,99,101,110,116,105,116,32,102,114,111,109,99,
+108,111,115,105,110,103,99,111,110,116,97,105,110,73,110,115,116,101,97,100,102,
+105,102,116,101,101,110,97,115,32,119,101,108,108,46,121,97,104,111,111,46,114,
+101,115,112,111,110,100,102,105,103,104,116,101,114,111,98,115,99,117,114,101,
+114,101,102,108,101,99,116,111,114,103,97,110,105,99,61,32,77,97,116,104,46,101,
+100,105,116,105,110,103,111,110,108,105,110,101,32,112,97,100,100,105,110,103,97
+,32,119,104,111,108,101,111,110,101,114,114,111,114,121,101,97,114,32,111,102,
+101,110,100,32,111,102,32,98,97,114,114,105,101,114,119,104,101,110,32,105,116,
+104,101,97,100,101,114,32,104,111,109,101,32,111,102,114,101,115,117,109,101,100
+,114,101,110,97,109,101,100,115,116,114,111,110,103,62,104,101,97,116,105,110,
+103,114,101,116,97,105,110,115,99,108,111,117,100,102,114,119,97,121,32,111,102,
+32,77,97,114,99,104,32,49,107,110,111,119,105,110,103,105,110,32,112,97,114,116,
+66,101,116,119,101,101,110,108,101,115,115,111,110,115,99,108,111,115,101,115,
+116,118,105,114,116,117,97,108,108,105,110,107,115,34,62,99,114,111,115,115,101,
+100,69,78,68,32,45,45,62,102,97,109,111,117,115,32,97,119,97,114,100,101,100,76,
+105,99,101,110,115,101,72,101,97,108,116,104,32,102,97,105,114,108,121,32,119,
+101,97,108,116,104,121,109,105,110,105,109,97,108,65,102,114,105,99,97,110,99,
+111,109,112,101,116,101,108,97,98,101,108,34,62,115,105,110,103,105,110,103,102,
+97,114,109,101,114,115,66,114,97,115,105,108,41,100,105,115,99,117,115,115,114,
+101,112,108,97,99,101,71,114,101,103,111,114,121,102,111,110,116,32,99,111,112,
+117,114,115,117,101,100,97,112,112,101,97,114,115,109,97,107,101,32,117,112,114,
+111,117,110,100,101,100,98,111,116,104,32,111,102,98,108,111,99,107,101,100,115,
+97,119,32,116,104,101,111,102,102,105,99,101,115,99,111,108,111,117,114,115,105,
+102,40,100,111,99,117,119,104,101,110,32,104,101,101,110,102,111,114,99,101,112,
+117,115,104,40,102,117,65,117,103,117,115,116,32,85,84,70,45,56,34,62,70,97,110,
+116,97,115,121,105,110,32,109,111,115,116,105,110,106,117,114,101,100,85,115,117
+,97,108,108,121,102,97,114,109,105,110,103,99,108,111,115,117,114,101,111,98,106
+,101,99,116,32,100,101,102,101,110,99,101,117,115,101,32,111,102,32,77,101,100,
+105,99,97,108,60,98,111,100,121,62,10,101,118,105,100,101,110,116,98,101,32,117,
+115,101,100,107,101,121,67,111,100,101,115,105,120,116,101,101,110,73,115,108,97
+,109,105,99,35,48,48,48,48,48,48,101,110,116,105,114,101,32,119,105,100,101,108,
+121,32,97,99,116,105,118,101,32,40,116,121,112,101,111,102,111,110,101,32,99,97,
+110,99,111,108,111,114,32,61,115,112,101,97,107,101,114,101,120,116,101,110,100,
+115,80,104,121,115,105,99,115,116,101,114,114,97,105,110,60,116,98,111,100,121,
+62,102,117,110,101,114,97,108,118,105,101,119,105,110,103,109,105,100,100,108,
+101,32,99,114,105,99,107,101,116,112,114,111,112,104,101,116,115,104,105,102,116
+,101,100,100,111,99,116,111,114,115,82,117,115,115,101,108,108,32,116,97,114,103
+,101,116,99,111,109,112,97,99,116,97,108,103,101,98,114,97,115,111,99,105,97,108
+,45,98,117,108,107,32,111,102,109,97,110,32,97,110,100,60,47,116,100,62,10,32,
+104,101,32,108,101,102,116,41,46,118,97,108,40,41,102,97,108,115,101,41,59,108,
+111,103,105,99,97,108,98,97,110,107,105,110,103,104,111,109,101,32,116,111,110,
+97,109,105,110,103,32,65,114,105,122,111,110,97,99,114,101,100,105,116,115,41,59
+,10,125,41,59,10,102,111,117,110,100,101,114,105,110,32,116,117,114,110,67,111,
+108,108,105,110,115,98,101,102,111,114,101,32,66,117,116,32,116,104,101,99,104,
+97,114,103,101,100,84,105,116,108,101,34,62,67,97,112,116,97,105,110,115,112,101
+,108,108,101,100,103,111,100,100,101,115,115,84,97,103,32,45,45,62,65,100,100,
+105,110,103,58,98,117,116,32,119,97,115,82,101,99,101,110,116,32,112,97,116,105,
+101,110,116,98,97,99,107,32,105,110,61,102,97,108,115,101,38,76,105,110,99,111,
+108,110,119,101,32,107,110,111,119,67,111,117,110,116,101,114,74,117,100,97,105,
+115,109,115,99,114,105,112,116,32,97,108,116,101,114,101,100,39,93,41,59,10,32,
+32,104,97,115,32,116,104,101,117,110,99,108,101,97,114,69,118,101,110,116,39,44,
+98,111,116,104,32,105,110,110,111,116,32,97,108,108,10,10,60,33,45,45,32,112,108
+,97,99,105,110,103,104,97,114,100,32,116,111,32,99,101,110,116,101,114,115,111,
+114,116,32,111,102,99,108,105,101,110,116,115,115,116,114,101,101,116,115,66,101
+,114,110,97,114,100,97,115,115,101,114,116,115,116,101,110,100,32,116,111,102,97
+,110,116,97,115,121,100,111,119,110,32,105,110,104,97,114,98,111,117,114,70,114,
+101,101,100,111,109,106,101,119,101,108,114,121,47,97,98,111,117,116,46,46,115,
+101,97,114,99,104,108,101,103,101,110,100,115,105,115,32,109,97,100,101,109,111,
+100,101,114,110,32,111,110,108,121,32,111,110,111,110,108,121,32,116,111,105,109
+,97,103,101,34,32,108,105,110,101,97,114,32,112,97,105,110,116,101,114,97,110,
+100,32,110,111,116,114,97,114,101,108,121,32,97,99,114,111,110,121,109,100,101,
+108,105,118,101,114,115,104,111,114,116,101,114,48,48,38,97,109,112,59,97,115,32
+,109,97,110,121,119,105,100,116,104,61,34,47,42,32,60,33,91,67,116,105,116,108,
+101,32,61,111,102,32,116,104,101,32,108,111,119,101,115,116,32,112,105,99,107,
+101,100,32,101,115,99,97,112,101,100,117,115,101,115,32,111,102,112,101,111,112,
+108,101,115,32,80,117,98,108,105,99,77,97,116,116,104,101,119,116,97,99,116,105,
+99,115,100,97,109,97,103,101,100,119,97,121,32,102,111,114,108,97,119,115,32,111
+,102,101,97,115,121,32,116,111,32,119,105,110,100,111,119,115,116,114,111,110,
+103,32,32,115,105,109,112,108,101,125,99,97,116,99,104,40,115,101,118,101,110,
+116,104,105,110,102,111,98,111,120,119,101,110,116,32,116,111,112,97,105,110,116
+,101,100,99,105,116,105,122,101,110,73,32,100,111,110,39,116,114,101,116,114,101
+,97,116,46,32,83,111,109,101,32,119,119,46,34,41,59,10,98,111,109,98,105,110,103
+,109,97,105,108,116,111,58,109,97,100,101,32,105,110,46,32,77,97,110,121,32,99,
+97,114,114,105,101,115,124,124,123,125,59,119,105,119,111,114,107,32,111,102,115
+,121,110,111,110,121,109,100,101,102,101,97,116,115,102,97,118,111,114,101,100,
+111,112,116,105,99,97,108,112,97,103,101,84,114,97,117,110,108,101,115,115,32,
+115,101,110,100,105,110,103,108,101,102,116,34,62,60,99,111,109,83,99,111,114,65
+,108,108,32,116,104,101,106,81,117,101,114,121,46,116,111,117,114,105,115,116,67
+,108,97,115,115,105,99,102,97,108,115,101,34,32,87,105,108,104,101,108,109,115,
+117,98,117,114,98,115,103,101,110,117,105,110,101,98,105,115,104,111,112,115,46,
+115,112,108,105,116,40,103,108,111,98,97,108,32,102,111,108,108,111,119,115,98,
+111,100,121,32,111,102,110,111,109,105,110,97,108,67,111,110,116,97,99,116,115,
+101,99,117,108,97,114,108,101,102,116,32,116,111,99,104,105,101,102,108,121,45,
+104,105,100,100,101,110,45,98,97,110,110,101,114,60,47,108,105,62,10,10,46,32,87
+,104,101,110,32,105,110,32,98,111,116,104,100,105,115,109,105,115,115,69,120,112
+,108,111,114,101,97,108,119,97,121,115,32,118,105,97,32,116,104,101,115,112,97,
+195,177,111,108,119,101,108,102,97,114,101,114,117,108,105,110,103,32,97,114,114
+,97,110,103,101,99,97,112,116,97,105,110,104,105,115,32,115,111,110,114,117,108,
+101,32,111,102,104,101,32,116,111,111,107,105,116,115,101,108,102,44,61,48,38,97
+,109,112,59,40,99,97,108,108,101,100,115,97,109,112,108,101,115,116,111,32,109,
+97,107,101,99,111,109,47,112,97,103,77,97,114,116,105,110,32,75,101,110,110,101,
+100,121,97,99,99,101,112,116,115,102,117,108,108,32,111,102,104,97,110,100,108,
+101,100,66,101,115,105,100,101,115,47,47,45,45,62,60,47,97,98,108,101,32,116,111
+,116,97,114,103,101,116,115,101,115,115,101,110,99,101,104,105,109,32,116,111,32
+,105,116,115,32,98,121,32,99,111,109,109,111,110,46,109,105,110,101,114,97,108,
+116,111,32,116,97,107,101,119,97,121,115,32,116,111,115,46,111,114,103,47,108,97
+,100,118,105,115,101,100,112,101,110,97,108,116,121,115,105,109,112,108,101,58,
+105,102,32,116,104,101,121,76,101,116,116,101,114,115,97,32,115,104,111,114,116,
+72,101,114,98,101,114,116,115,116,114,105,107,101,115,32,103,114,111,117,112,115
+,46,108,101,110,103,116,104,102,108,105,103,104,116,115,111,118,101,114,108,97,
+112,115,108,111,119,108,121,32,108,101,115,115,101,114,32,115,111,99,105,97,108,
+32,60,47,112,62,10,9,9,105,116,32,105,110,116,111,114,97,110,107,101,100,32,114,
+97,116,101,32,111,102,117,108,62,13,10,32,32,97,116,116,101,109,112,116,112,97,
+105,114,32,111,102,109,97,107,101,32,105,116,75,111,110,116,97,107,116,65,110,
+116,111,110,105,111,104,97,118,105,110,103,32,114,97,116,105,110,103,115,32,97,
+99,116,105,118,101,115,116,114,101,97,109,115,116,114,97,112,112,101,100,34,41,
+46,99,115,115,40,104,111,115,116,105,108,101,108,101,97,100,32,116,111,108,105,
+116,116,108,101,32,103,114,111,117,112,115,44,80,105,99,116,117,114,101,45,45,62
+,13,10,13,10,32,114,111,119,115,61,34,32,111,98,106,101,99,116,105,110,118,101,
+114,115,101,60,102,111,111,116,101,114,67,117,115,116,111,109,86,62,60,92,47,115
+,99,114,115,111,108,118,105,110,103,67,104,97,109,98,101,114,115,108,97,118,101,
+114,121,119,111,117,110,100,101,100,119,104,101,114,101,97,115,33,61,32,39,117,
+110,100,102,111,114,32,97,108,108,112,97,114,116,108,121,32,45,114,105,103,104,
+116,58,65,114,97,98,105,97,110,98,97,99,107,101,100,32,99,101,110,116,117,114,
+121,117,110,105,116,32,111,102,109,111,98,105,108,101,45,69,117,114,111,112,101,
+44,105,115,32,104,111,109,101,114,105,115,107,32,111,102,100,101,115,105,114,101
+,100,67,108,105,110,116,111,110,99,111,115,116,32,111,102,97,103,101,32,111,102,
+32,98,101,99,111,109,101,32,110,111,110,101,32,111,102,112,38,113,117,111,116,59
+,77,105,100,100,108,101,32,101,97,100,39,41,91,48,67,114,105,116,105,99,115,115,
+116,117,100,105,111,115,62,38,99,111,112,121,59,103,114,111,117,112,34,62,97,115
+,115,101,109,98,108,109,97,107,105,110,103,32,112,114,101,115,115,101,100,119,
+105,100,103,101,116,46,112,115,58,34,32,63,32,114,101,98,117,105,108,116,98,121,
+32,115,111,109,101,70,111,114,109,101,114,32,101,100,105,116,111,114,115,100,101
+,108,97,121,101,100,67,97,110,111,110,105,99,104,97,100,32,116,104,101,112,117,
+115,104,105,110,103,99,108,97,115,115,61,34,98,117,116,32,97,114,101,112,97,114,
+116,105,97,108,66,97,98,121,108,111,110,98,111,116,116,111,109,32,99,97,114,114,
+105,101,114,67,111,109,109,97,110,100,105,116,115,32,117,115,101,65,115,32,119,
+105,116,104,99,111,117,114,115,101,115,97,32,116,104,105,114,100,100,101,110,111
+,116,101,115,97,108,115,111,32,105,110,72,111,117,115,116,111,110,50,48,112,120,
+59,34,62,97,99,99,117,115,101,100,100,111,117,98,108,101,32,103,111,97,108,32,
+111,102,70,97,109,111,117,115,32,41,46,98,105,110,100,40,112,114,105,101,115,116
+,115,32,79,110,108,105,110,101,105,110,32,74,117,108,121,115,116,32,43,32,34,103
+,99,111,110,115,117,108,116,100,101,99,105,109,97,108,104,101,108,112,102,117,
+108,114,101,118,105,118,101,100,105,115,32,118,101,114,121,114,39,43,39,105,112,
+116,108,111,115,105,110,103,32,102,101,109,97,108,101,115,105,115,32,97,108,115,
+111,115,116,114,105,110,103,115,100,97,121,115,32,111,102,97,114,114,105,118,97,
+108,102,117,116,117,114,101,32,60,111,98,106,101,99,116,102,111,114,99,105,110,
+103,83,116,114,105,110,103,40,34,32,47,62,10,9,9,104,101,114,101,32,105,115,101,
+110,99,111,100,101,100,46,32,32,84,104,101,32,98,97,108,108,111,111,110,100,111,
+110,101,32,98,121,47,99,111,109,109,111,110,98,103,99,111,108,111,114,108,97,119
+,32,111,102,32,73,110,100,105,97,110,97,97,118,111,105,100,101,100,98,117,116,32
+,116,104,101,50,112,120,32,51,112,120,106,113,117,101,114,121,46,97,102,116,101,
+114,32,97,112,111,108,105,99,121,46,109,101,110,32,97,110,100,102,111,111,116,
+101,114,45,61,32,116,114,117,101,59,102,111,114,32,117,115,101,115,99,114,101,
+101,110,46,73,110,100,105,97,110,32,105,109,97,103,101,32,61,102,97,109,105,108,
+121,44,104,116,116,112,58,47,47,32,38,110,98,115,112,59,100,114,105,118,101,114,
+115,101,116,101,114,110,97,108,115,97,109,101,32,97,115,110,111,116,105,99,101,
+100,118,105,101,119,101,114,115,125,41,40,41,59,10,32,105,115,32,109,111,114,101
+,115,101,97,115,111,110,115,102,111,114,109,101,114,32,116,104,101,32,110,101,
+119,105,115,32,106,117,115,116,99,111,110,115,101,110,116,32,83,101,97,114,99,
+104,119,97,115,32,116,104,101,119,104,121,32,116,104,101,115,104,105,112,112,101
+,100,98,114,62,60,98,114,62,119,105,100,116,104,58,32,104,101,105,103,104,116,61
+,109,97,100,101,32,111,102,99,117,105,115,105,110,101,105,115,32,116,104,97,116,
+97,32,118,101,114,121,32,65,100,109,105,114,97,108,32,102,105,120,101,100,59,110
+,111,114,109,97,108,32,77,105,115,115,105,111,110,80,114,101,115,115,44,32,111,
+110,116,97,114,105,111,99,104,97,114,115,101,116,116,114,121,32,116,111,32,105,
+110,118,97,100,101,100,61,34,116,114,117,101,34,115,112,97,99,105,110,103,105,
+115,32,109,111,115,116,97,32,109,111,114,101,32,116,111,116,97,108,108,121,102,
+97,108,108,32,111,102,125,41,59,13,10,32,32,105,109,109,101,110,115,101,116,105,
+109,101,32,105,110,115,101,116,32,111,117,116,115,97,116,105,115,102,121,116,111
+,32,102,105,110,100,100,111,119,110,32,116,111,108,111,116,32,111,102,32,80,108,
+97,121,101,114,115,105,110,32,74,117,110,101,113,117,97,110,116,117,109,110,111,
+116,32,116,104,101,116,105,109,101,32,116,111,100,105,115,116,97,110,116,70,105,
+110,110,105,115,104,115,114,99,32,61,32,40,115,105,110,103,108,101,32,104,101,
+108,112,32,111,102,71,101,114,109,97,110,32,108,97,119,32,97,110,100,108,97,98,
+101,108,101,100,102,111,114,101,115,116,115,99,111,111,107,105,110,103,115,112,
+97,99,101,34,62,104,101,97,100,101,114,45,119,101,108,108,32,97,115,83,116,97,
+110,108,101,121,98,114,105,100,103,101,115,47,103,108,111,98,97,108,67,114,111,
+97,116,105,97,32,65,98,111,117,116,32,91,48,93,59,10,32,32,105,116,44,32,97,110,
+100,103,114,111,117,112,101,100,98,101,105,110,103,32,97,41,123,116,104,114,111,
+119,104,101,32,109,97,100,101,108,105,103,104,116,101,114,101,116,104,105,99,97,
+108,70,70,70,70,70,70,34,98,111,116,116,111,109,34,108,105,107,101,32,97,32,101,
+109,112,108,111,121,115,108,105,118,101,32,105,110,97,115,32,115,101,101,110,112
+,114,105,110,116,101,114,109,111,115,116,32,111,102,117,98,45,108,105,110,107,
+114,101,106,101,99,116,115,97,110,100,32,117,115,101,105,109,97,103,101,34,62,
+115,117,99,99,101,101,100,102,101,101,100,105,110,103,78,117,99,108,101,97,114,
+105,110,102,111,114,109,97,116,111,32,104,101,108,112,87,111,109,101,110,39,115,
+78,101,105,116,104,101,114,77,101,120,105,99,97,110,112,114,111,116,101,105,110,
+60,116,97,98,108,101,32,98,121,32,109,97,110,121,104,101,97,108,116,104,121,108,
+97,119,115,117,105,116,100,101,118,105,115,101,100,46,112,117,115,104,40,123,115
+,101,108,108,101,114,115,115,105,109,112,108,121,32,84,104,114,111,117,103,104,
+46,99,111,111,107,105,101,32,73,109,97,103,101,40,111,108,100,101,114,34,62,117,
+115,46,106,115,34,62,32,83,105,110,99,101,32,117,110,105,118,101,114,115,108,97,
+114,103,101,114,32,111,112,101,110,32,116,111,33,45,45,32,101,110,100,108,105,
+101,115,32,105,110,39,93,41,59,13,10,32,32,109,97,114,107,101,116,119,104,111,32
+,105,115,32,40,34,68,79,77,67,111,109,97,110,97,103,101,100,111,110,101,32,102,
+111,114,116,121,112,101,111,102,32,75,105,110,103,100,111,109,112,114,111,102,
+105,116,115,112,114,111,112,111,115,101,116,111,32,115,104,111,119,99,101,110,
+116,101,114,59,109,97,100,101,32,105,116,100,114,101,115,115,101,100,119,101,114
+,101,32,105,110,109,105,120,116,117,114,101,112,114,101,99,105,115,101,97,114,
+105,115,105,110,103,115,114,99,32,61,32,39,109,97,107,101,32,97,32,115,101,99,
+117,114,101,100,66,97,112,116,105,115,116,118,111,116,105,110,103,32,10,9,9,118,
+97,114,32,77,97,114,99,104,32,50,103,114,101,119,32,117,112,67,108,105,109,97,
+116,101,46,114,101,109,111,118,101,115,107,105,108,108,101,100,119,97,121,32,116
+,104,101,60,47,104,101,97,100,62,102,97,99,101,32,111,102,97,99,116,105,110,103,
+32,114,105,103,104,116,34,62,116,111,32,119,111,114,107,114,101,100,117,99,101,
+115,104,97,115,32,104,97,100,101,114,101,99,116,101,100,115,104,111,119,40,41,59
+,97,99,116,105,111,110,61,98,111,111,107,32,111,102,97,110,32,97,114,101,97,61,
+61,32,34,104,116,116,60,104,101,97,100,101,114,10,60,104,116,109,108,62,99,111,
+110,102,111,114,109,102,97,99,105,110,103,32,99,111,111,107,105,101,46,114,101,
+108,121,32,111,110,104,111,115,116,101,100,32,46,99,117,115,116,111,109,104,101,
+32,119,101,110,116,98,117,116,32,102,111,114,115,112,114,101,97,100,32,70,97,109
+,105,108,121,32,97,32,109,101,97,110,115,111,117,116,32,116,104,101,102,111,114,
+117,109,115,46,102,111,111,116,97,103,101,34,62,77,111,98,105,108,67,108,101,109
+,101,110,116,115,34,32,105,100,61,34,97,115,32,104,105,103,104,105,110,116,101,
+110,115,101,45,45,62,60,33,45,45,102,101,109,97,108,101,32,105,115,32,115,101,
+101,110,105,109,112,108,105,101,100,115,101,116,32,116,104,101,97,32,115,116,97,
+116,101,97,110,100,32,104,105,115,102,97,115,116,101,115,116,98,101,115,105,100,
+101,115,98,117,116,116,111,110,95,98,111,117,110,100,101,100,34,62,60,105,109,
+103,32,73,110,102,111,98,111,120,101,118,101,110,116,115,44,97,32,121,111,117,
+110,103,97,110,100,32,97,114,101,78,97,116,105,118,101,32,99,104,101,97,112,101,
+114,84,105,109,101,111,117,116,97,110,100,32,104,97,115,101,110,103,105,110,101,
+115,119,111,110,32,116,104,101,40,109,111,115,116,108,121,114,105,103,104,116,58
+,32,102,105,110,100,32,97,32,45,98,111,116,116,111,109,80,114,105,110,99,101,32,
+97,114,101,97,32,111,102,109,111,114,101,32,111,102,115,101,97,114,99,104,95,110
+,97,116,117,114,101,44,108,101,103,97,108,108,121,112,101,114,105,111,100,44,108
+,97,110,100,32,111,102,111,114,32,119,105,116,104,105,110,100,117,99,101,100,112
+,114,111,118,105,110,103,109,105,115,115,105,108,101,108,111,99,97,108,108,121,
+65,103,97,105,110,115,116,116,104,101,32,119,97,121,107,38,113,117,111,116,59,
+112,120,59,34,62,13,10,112,117,115,104,101,100,32,97,98,97,110,100,111,110,110,
+117,109,101,114,97,108,67,101,114,116,97,105,110,73,110,32,116,104,105,115,109,
+111,114,101,32,105,110,111,114,32,115,111,109,101,110,97,109,101,32,105,115,97,
+110,100,44,32,105,110,99,114,111,119,110,101,100,73,83,66,78,32,48,45,99,114,101
+,97,116,101,115,79,99,116,111,98,101,114,109,97,121,32,110,111,116,99,101,110,
+116,101,114,32,108,97,116,101,32,105,110,68,101,102,101,110,99,101,101,110,97,99
+,116,101,100,119,105,115,104,32,116,111,98,114,111,97,100,108,121,99,111,111,108
+,105,110,103,111,110,108,111,97,100,61,105,116,46,32,84,104,101,114,101,99,111,
+118,101,114,77,101,109,98,101,114,115,104,101,105,103,104,116,32,97,115,115,117,
+109,101,115,60,104,116,109,108,62,10,112,101,111,112,108,101,46,105,110,32,111,
+110,101,32,61,119,105,110,100,111,119,102,111,111,116,101,114,95,97,32,103,111,
+111,100,32,114,101,107,108,97,109,97,111,116,104,101,114,115,44,116,111,32,116,
+104,105,115,95,99,111,111,107,105,101,112,97,110,101,108,34,62,76,111,110,100,
+111,110,44,100,101,102,105,110,101,115,99,114,117,115,104,101,100,98,97,112,116,
+105,115,109,99,111,97,115,116,97,108,115,116,97,116,117,115,32,116,105,116,108,
+101,34,32,109,111,118,101,32,116,111,108,111,115,116,32,105,110,98,101,116,116,
+101,114,32,105,109,112,108,105,101,115,114,105,118,97,108,114,121,115,101,114,
+118,101,114,115,32,83,121,115,116,101,109,80,101,114,104,97,112,115,101,115,32,
+97,110,100,32,99,111,110,116,101,110,100,102,108,111,119,105,110,103,108,97,115,
+116,101,100,32,114,105,115,101,32,105,110,71,101,110,101,115,105,115,118,105,101
+,119,32,111,102,114,105,115,105,110,103,32,115,101,101,109,32,116,111,98,117,116
+,32,105,110,32,98,97,99,107,105,110,103,104,101,32,119,105,108,108,103,105,118,
+101,110,32,97,103,105,118,105,110,103,32,99,105,116,105,101,115,46,102,108,111,
+119,32,111,102,32,76,97,116,101,114,32,97,108,108,32,98,117,116,72,105,103,104,
+119,97,121,111,110,108,121,32,98,121,115,105,103,110,32,111,102,104,101,32,100,
+111,101,115,100,105,102,102,101,114,115,98,97,116,116,101,114,121,38,97,109,112,
+59,108,97,115,105,110,103,108,101,115,116,104,114,101,97,116,115,105,110,116,101
+,103,101,114,116,97,107,101,32,111,110,114,101,102,117,115,101,100,99,97,108,108
+,101,100,32,61,85,83,38,97,109,112,83,101,101,32,116,104,101,110,97,116,105,118,
+101,115,98,121,32,116,104,105,115,115,121,115,116,101,109,46,104,101,97,100,32,
+111,102,58,104,111,118,101,114,44,108,101,115,98,105,97,110,115,117,114,110,97,
+109,101,97,110,100,32,97,108,108,99,111,109,109,111,110,47,104,101,97,100,101,
+114,95,95,112,97,114,97,109,115,72,97,114,118,97,114,100,47,112,105,120,101,108,
+46,114,101,109,111,118,97,108,115,111,32,108,111,110,103,114,111,108,101,32,111,
+102,106,111,105,110,116,108,121,115,107,121,115,99,114,97,85,110,105,99,111,100,
+101,98,114,32,47,62,13,10,65,116,108,97,110,116,97,110,117,99,108,101,117,115,67
+,111,117,110,116,121,44,112,117,114,101,108,121,32,99,111,117,110,116,34,62,101,
+97,115,105,108,121,32,98,117,105,108,100,32,97,111,110,99,108,105,99,107,97,32,
+103,105,118,101,110,112,111,105,110,116,101,114,104,38,113,117,111,116,59,101,
+118,101,110,116,115,32,101,108,115,101,32,123,10,100,105,116,105,111,110,115,110
+,111,119,32,116,104,101,44,32,119,105,116,104,32,109,97,110,32,119,104,111,111,
+114,103,47,87,101,98,111,110,101,32,97,110,100,99,97,118,97,108,114,121,72,101,
+32,100,105,101,100,115,101,97,116,116,108,101,48,48,44,48,48,48,32,123,119,105,
+110,100,111,119,104,97,118,101,32,116,111,105,102,40,119,105,110,100,97,110,100,
+32,105,116,115,115,111,108,101,108,121,32,109,38,113,117,111,116,59,114,101,110,
+101,119,101,100,68,101,116,114,111,105,116,97,109,111,110,103,115,116,101,105,
+116,104,101,114,32,116,104,101,109,32,105,110,83,101,110,97,116,111,114,85,115,
+60,47,97,62,60,75,105,110,103,32,111,102,70,114,97,110,99,105,115,45,112,114,111
+,100,117,99,104,101,32,117,115,101,100,97,114,116,32,97,110,100,104,105,109,32,
+97,110,100,117,115,101,100,32,98,121,115,99,111,114,105,110,103,97,116,32,104,
+111,109,101,116,111,32,104,97,118,101,114,101,108,97,116,101,115,105,98,105,108,
+105,116,121,102,97,99,116,105,111,110,66,117,102,102,97,108,111,108,105,110,107,
+34,62,60,119,104,97,116,32,104,101,102,114,101,101,32,116,111,67,105,116,121,32,
+111,102,99,111,109,101,32,105,110,115,101,99,116,111,114,115,99,111,117,110,116,
+101,100,111,110,101,32,100,97,121,110,101,114,118,111,117,115,115,113,117,97,114
+,101,32,125,59,105,102,40,103,111,105,110,32,119,104,97,116,105,109,103,34,32,97
+,108,105,115,32,111,110,108,121,115,101,97,114,99,104,47,116,117,101,115,100,97,
+121,108,111,111,115,101,108,121,83,111,108,111,109,111,110,115,101,120,117,97,
+108,32,45,32,60,97,32,104,114,109,101,100,105,117,109,34,68,79,32,78,79,84,32,70
+,114,97,110,99,101,44,119,105,116,104,32,97,32,119,97,114,32,97,110,100,115,101,
+99,111,110,100,32,116,97,107,101,32,97,32,62,13,10,13,10,13,10,109,97,114,107,
+101,116,46,104,105,103,104,119,97,121,100,111,110,101,32,105,110,99,116,105,118,
+105,116,121,34,108,97,115,116,34,62,111,98,108,105,103,101,100,114,105,115,101,
+32,116,111,34,117,110,100,101,102,105,109,97,100,101,32,116,111,32,69,97,114,108
+,121,32,112,114,97,105,115,101,100,105,110,32,105,116,115,32,102,111,114,32,104,
+105,115,97,116,104,108,101,116,101,74,117,112,105,116,101,114,89,97,104,111,111,
+33,32,116,101,114,109,101,100,32,115,111,32,109,97,110,121,114,101,97,108,108,
+121,32,115,46,32,84,104,101,32,97,32,119,111,109,97,110,63,118,97,108,117,101,61
+,100,105,114,101,99,116,32,114,105,103,104,116,34,32,98,105,99,121,99,108,101,97
+,99,105,110,103,61,34,100,97,121,32,97,110,100,115,116,97,116,105,110,103,82,97,
+116,104,101,114,44,104,105,103,104,101,114,32,79,102,102,105,99,101,32,97,114,
+101,32,110,111,119,116,105,109,101,115,44,32,119,104,101,110,32,97,32,112,97,121
+,32,102,111,114,111,110,32,116,104,105,115,45,108,105,110,107,34,62,59,98,111,
+114,100,101,114,97,114,111,117,110,100,32,97,110,110,117,97,108,32,116,104,101,
+32,78,101,119,112,117,116,32,116,104,101,46,99,111,109,34,32,116,97,107,105,110,
+32,116,111,97,32,98,114,105,101,102,40,105,110,32,116,104,101,103,114,111,117,
+112,115,46,59,32,119,105,100,116,104,101,110,122,121,109,101,115,115,105,109,112
+,108,101,32,105,110,32,108,97,116,101,123,114,101,116,117,114,110,116,104,101,
+114,97,112,121,97,32,112,111,105,110,116,98,97,110,110,105,110,103,105,110,107,
+115,34,62,10,40,41,59,34,32,114,101,97,32,112,108,97,99,101,92,117,48,48,51,67,
+97,97,98,111,117,116,32,97,116,114,62,13,10,9,9,99,99,111,117,110,116,32,103,105
+,118,101,115,32,97,60,83,67,82,73,80,84,82,97,105,108,119,97,121,116,104,101,109
+,101,115,47,116,111,111,108,98,111,120,66,121,73,100,40,34,120,104,117,109,97,
+110,115,44,119,97,116,99,104,101,115,105,110,32,115,111,109,101,32,105,102,32,40
+,119,105,99,111,109,105,110,103,32,102,111,114,109,97,116,115,32,85,110,100,101,
+114,32,98,117,116,32,104,97,115,104,97,110,100,101,100,32,109,97,100,101,32,98,
+121,116,104,97,110,32,105,110,102,101,97,114,32,111,102,100,101,110,111,116,101,
+100,47,105,102,114,97,109,101,108,101,102,116,32,105,110,118,111,108,116,97,103,
+101,105,110,32,101,97,99,104,97,38,113,117,111,116,59,98,97,115,101,32,111,102,
+73,110,32,109,97,110,121,117,110,100,101,114,103,111,114,101,103,105,109,101,115
+,97,99,116,105,111,110,32,60,47,112,62,13,10,60,117,115,116,111,109,86,97,59,38,
+103,116,59,60,47,105,109,112,111,114,116,115,111,114,32,116,104,97,116,109,111,
+115,116,108,121,32,38,97,109,112,59,114,101,32,115,105,122,101,61,34,60,47,97,62
+,60,47,104,97,32,99,108,97,115,115,112,97,115,115,105,118,101,72,111,115,116,32,
+61,32,87,104,101,116,104,101,114,102,101,114,116,105,108,101,86,97,114,105,111,
+117,115,61,91,93,59,40,102,117,99,97,109,101,114,97,115,47,62,60,47,116,100,62,
+97,99,116,115,32,97,115,73,110,32,115,111,109,101,62,13,10,13,10,60,33,111,114,
+103,97,110,105,115,32,60,98,114,32,47,62,66,101,105,106,105,110,103,99,97,116,97
+,108,195,160,100,101,117,116,115,99,104,101,117,114,111,112,101,117,101,117,115,
+107,97,114,97,103,97,101,105,108,103,101,115,118,101,110,115,107,97,101,115,112,
+97,195,177,97,109,101,110,115,97,106,101,117,115,117,97,114,105,111,116,114,97,
+98,97,106,111,109,195,169,120,105,99,111,112,195,161,103,105,110,97,115,105,101,
+109,112,114,101,115,105,115,116,101,109,97,111,99,116,117,98,114,101,100,117,114
+,97,110,116,101,97,195,177,97,100,105,114,101,109,112,114,101,115,97,109,111,109
+,101,110,116,111,110,117,101,115,116,114,111,112,114,105,109,101,114,97,116,114,
+97,118,195,169,115,103,114,97,99,105,97,115,110,117,101,115,116,114,97,112,114,
+111,99,101,115,111,101,115,116,97,100,111,115,99,97,108,105,100,97,100,112,101,
+114,115,111,110,97,110,195,186,109,101,114,111,97,99,117,101,114,100,111,109,195
+,186,115,105,99,97,109,105,101,109,98,114,111,111,102,101,114,116,97,115,97,108,
+103,117,110,111,115,112,97,195,173,115,101,115,101,106,101,109,112,108,111,100,
+101,114,101,99,104,111,97,100,101,109,195,161,115,112,114,105,118,97,100,111,97,
+103,114,101,103,97,114,101,110,108,97,99,101,115,112,111,115,105,98,108,101,104,
+111,116,101,108,101,115,115,101,118,105,108,108,97,112,114,105,109,101,114,111,
+195,186,108,116,105,109,111,101,118,101,110,116,111,115,97,114,99,104,105,118,
+111,99,117,108,116,117,114,97,109,117,106,101,114,101,115,101,110,116,114,97,100
+,97,97,110,117,110,99,105,111,101,109,98,97,114,103,111,109,101,114,99,97,100,
+111,103,114,97,110,100,101,115,101,115,116,117,100,105,111,109,101,106,111,114,
+101,115,102,101,98,114,101,114,111,100,105,115,101,195,177,111,116,117,114,105,
+115,109,111,99,195,179,100,105,103,111,112,111,114,116,97,100,97,101,115,112,97,
+99,105,111,102,97,109,105,108,105,97,97,110,116,111,110,105,111,112,101,114,109,
+105,116,101,103,117,97,114,100,97,114,97,108,103,117,110,97,115,112,114,101,99,
+105,111,115,97,108,103,117,105,101,110,115,101,110,116,105,100,111,118,105,115,
+105,116,97,115,116,195,173,116,117,108,111,99,111,110,111,99,101,114,115,101,103
+,117,110,100,111,99,111,110,115,101,106,111,102,114,97,110,99,105,97,109,105,110
+,117,116,111,115,115,101,103,117,110,100,97,116,101,110,101,109,111,115,101,102,
+101,99,116,111,115,109,195,161,108,97,103,97,115,101,115,105,195,179,110,114,101
+,118,105,115,116,97,103,114,97,110,97,100,97,99,111,109,112,114,97,114,105,110,
+103,114,101,115,111,103,97,114,99,195,173,97,97,99,99,105,195,179,110,101,99,117
+,97,100,111,114,113,117,105,101,110,101,115,105,110,99,108,117,115,111,100,101,
+98,101,114,195,161,109,97,116,101,114,105,97,104,111,109,98,114,101,115,109,117,
+101,115,116,114,97,112,111,100,114,195,173,97,109,97,195,177,97,110,97,195,186,
+108,116,105,109,97,101,115,116,97,109,111,115,111,102,105,99,105,97,108,116,97,
+109,98,105,101,110,110,105,110,103,195,186,110,115,97,108,117,100,111,115,112,
+111,100,101,109,111,115,109,101,106,111,114,97,114,112,111,115,105,116,105,111,
+110,98,117,115,105,110,101,115,115,104,111,109,101,112,97,103,101,115,101,99,117
+,114,105,116,121,108,97,110,103,117,97,103,101,115,116,97,110,100,97,114,100,99,
+97,109,112,97,105,103,110,102,101,97,116,117,114,101,115,99,97,116,101,103,111,
+114,121,101,120,116,101,114,110,97,108,99,104,105,108,100,114,101,110,114,101,
+115,101,114,118,101,100,114,101,115,101,97,114,99,104,101,120,99,104,97,110,103,
+101,102,97,118,111,114,105,116,101,116,101,109,112,108,97,116,101,109,105,108,
+105,116,97,114,121,105,110,100,117,115,116,114,121,115,101,114,118,105,99,101,
+115,109,97,116,101,114,105,97,108,112,114,111,100,117,99,116,115,122,45,105,110,
+100,101,120,58,99,111,109,109,101,110,116,115,115,111,102,116,119,97,114,101,99,
+111,109,112,108,101,116,101,99,97,108,101,110,100,97,114,112,108,97,116,102,111,
+114,109,97,114,116,105,99,108,101,115,114,101,113,117,105,114,101,100,109,111,
+118,101,109,101,110,116,113,117,101,115,116,105,111,110,98,117,105,108,100,105,
+110,103,112,111,108,105,116,105,99,115,112,111,115,115,105,98,108,101,114,101,
+108,105,103,105,111,110,112,104,121,115,105,99,97,108,102,101,101,100,98,97,99,
+107,114,101,103,105,115,116,101,114,112,105,99,116,117,114,101,115,100,105,115,
+97,98,108,101,100,112,114,111,116,111,99,111,108,97,117,100,105,101,110,99,101,
+115,101,116,116,105,110,103,115,97,99,116,105,118,105,116,121,101,108,101,109,
+101,110,116,115,108,101,97,114,110,105,110,103,97,110,121,116,104,105,110,103,97
+,98,115,116,114,97,99,116,112,114,111,103,114,101,115,115,111,118,101,114,118,
+105,101,119,109,97,103,97,122,105,110,101,101,99,111,110,111,109,105,99,116,114,
+97,105,110,105,110,103,112,114,101,115,115,117,114,101,118,97,114,105,111,117,
+115,32,60,115,116,114,111,110,103,62,112,114,111,112,101,114,116,121,115,104,111
+,112,112,105,110,103,116,111,103,101,116,104,101,114,97,100,118,97,110,99,101,
+100,98,101,104,97,118,105,111,114,100,111,119,110,108,111,97,100,102,101,97,116,
+117,114,101,100,102,111,111,116,98,97,108,108,115,101,108,101,99,116,101,100,76,
+97,110,103,117,97,103,101,100,105,115,116,97,110,99,101,114,101,109,101,109,98,
+101,114,116,114,97,99,107,105,110,103,112,97,115,115,119,111,114,100,109,111,100
+,105,102,105,101,100,115,116,117,100,101,110,116,115,100,105,114,101,99,116,108,
+121,102,105,103,104,116,105,110,103,110,111,114,116,104,101,114,110,100,97,116,
+97,98,97,115,101,102,101,115,116,105,118,97,108,98,114,101,97,107,105,110,103,
+108,111,99,97,116,105,111,110,105,110,116,101,114,110,101,116,100,114,111,112,
+100,111,119,110,112,114,97,99,116,105,99,101,101,118,105,100,101,110,99,101,102,
+117,110,99,116,105,111,110,109,97,114,114,105,97,103,101,114,101,115,112,111,110
+,115,101,112,114,111,98,108,101,109,115,110,101,103,97,116,105,118,101,112,114,
+111,103,114,97,109,115,97,110,97,108,121,115,105,115,114,101,108,101,97,115,101,
+100,98,97,110,110,101,114,34,62,112,117,114,99,104,97,115,101,112,111,108,105,99
+,105,101,115,114,101,103,105,111,110,97,108,99,114,101,97,116,105,118,101,97,114
+,103,117,109,101,110,116,98,111,111,107,109,97,114,107,114,101,102,101,114,114,
+101,114,99,104,101,109,105,99,97,108,100,105,118,105,115,105,111,110,99,97,108,
+108,98,97,99,107,115,101,112,97,114,97,116,101,112,114,111,106,101,99,116,115,99
+,111,110,102,108,105,99,116,104,97,114,100,119,97,114,101,105,110,116,101,114,
+101,115,116,100,101,108,105,118,101,114,121,109,111,117,110,116,97,105,110,111,
+98,116,97,105,110,101,100,61,32,102,97,108,115,101,59,102,111,114,40,118,97,114,
+32,97,99,99,101,112,116,101,100,99,97,112,97,99,105,116,121,99,111,109,112,117,
+116,101,114,105,100,101,110,116,105,116,121,97,105,114,99,114,97,102,116,101,109
+,112,108,111,121,101,100,112,114,111,112,111,115,101,100,100,111,109,101,115,116
+,105,99,105,110,99,108,117,100,101,115,112,114,111,118,105,100,101,100,104,111,
+115,112,105,116,97,108,118,101,114,116,105,99,97,108,99,111,108,108,97,112,115,
+101,97,112,112,114,111,97,99,104,112,97,114,116,110,101,114,115,108,111,103,111,
+34,62,60,97,100,97,117,103,104,116,101,114,97,117,116,104,111,114,34,32,99,117,
+108,116,117,114,97,108,102,97,109,105,108,105,101,115,47,105,109,97,103,101,115,
+47,97,115,115,101,109,98,108,121,112,111,119,101,114,102,117,108,116,101,97,99,
+104,105,110,103,102,105,110,105,115,104,101,100,100,105,115,116,114,105,99,116,
+99,114,105,116,105,99,97,108,99,103,105,45,98,105,110,47,112,117,114,112,111,115
+,101,115,114,101,113,117,105,114,101,115,101,108,101,99,116,105,111,110,98,101,
+99,111,109,105,110,103,112,114,111,118,105,100,101,115,97,99,97,100,101,109,105,
+99,101,120,101,114,99,105,115,101,97,99,116,117,97,108,108,121,109,101,100,105,
+99,105,110,101,99,111,110,115,116,97,110,116,97,99,99,105,100,101,110,116,77,97,
+103,97,122,105,110,101,100,111,99,117,109,101,110,116,115,116,97,114,116,105,110
+,103,98,111,116,116,111,109,34,62,111,98,115,101,114,118,101,100,58,32,38,113,
+117,111,116,59,101,120,116,101,110,100,101,100,112,114,101,118,105,111,117,115,
+83,111,102,116,119,97,114,101,99,117,115,116,111,109,101,114,100,101,99,105,115,
+105,111,110,115,116,114,101,110,103,116,104,100,101,116,97,105,108,101,100,115,
+108,105,103,104,116,108,121,112,108,97,110,110,105,110,103,116,101,120,116,97,
+114,101,97,99,117,114,114,101,110,99,121,101,118,101,114,121,111,110,101,115,116
+,114,97,105,103,104,116,116,114,97,110,115,102,101,114,112,111,115,105,116,105,
+118,101,112,114,111,100,117,99,101,100,104,101,114,105,116,97,103,101,115,104,
+105,112,112,105,110,103,97,98,115,111,108,117,116,101,114,101,99,101,105,118,101
+,100,114,101,108,101,118,97,110,116,98,117,116,116,111,110,34,32,118,105,111,108
+,101,110,99,101,97,110,121,119,104,101,114,101,98,101,110,101,102,105,116,115,
+108,97,117,110,99,104,101,100,114,101,99,101,110,116,108,121,97,108,108,105,97,
+110,99,101,102,111,108,108,111,119,101,100,109,117,108,116,105,112,108,101,98,
+117,108,108,101,116,105,110,105,110,99,108,117,100,101,100,111,99,99,117,114,114
+,101,100,105,110,116,101,114,110,97,108,36,40,116,104,105,115,41,46,114,101,112,
+117,98,108,105,99,62,60,116,114,62,60,116,100,99,111,110,103,114,101,115,115,114
+,101,99,111,114,100,101,100,117,108,116,105,109,97,116,101,115,111,108,117,116,
+105,111,110,60,117,108,32,105,100,61,34,100,105,115,99,111,118,101,114,72,111,
+109,101,60,47,97,62,119,101,98,115,105,116,101,115,110,101,116,119,111,114,107,
+115,97,108,116,104,111,117,103,104,101,110,116,105,114,101,108,121,109,101,109,
+111,114,105,97,108,109,101,115,115,97,103,101,115,99,111,110,116,105,110,117,101
+,97,99,116,105,118,101,34,62,115,111,109,101,119,104,97,116,118,105,99,116,111,
+114,105,97,87,101,115,116,101,114,110,32,32,116,105,116,108,101,61,34,76,111,99,
+97,116,105,111,110,99,111,110,116,114,97,99,116,118,105,115,105,116,111,114,115,
+68,111,119,110,108,111,97,100,119,105,116,104,111,117,116,32,114,105,103,104,116
+,34,62,10,109,101,97,115,117,114,101,115,119,105,100,116,104,32,61,32,118,97,114
+,105,97,98,108,101,105,110,118,111,108,118,101,100,118,105,114,103,105,110,105,
+97,110,111,114,109,97,108,108,121,104,97,112,112,101,110,101,100,97,99,99,111,
+117,110,116,115,115,116,97,110,100,105,110,103,110,97,116,105,111,110,97,108,82,
+101,103,105,115,116,101,114,112,114,101,112,97,114,101,100,99,111,110,116,114,
+111,108,115,97,99,99,117,114,97,116,101,98,105,114,116,104,100,97,121,115,116,
+114,97,116,101,103,121,111,102,102,105,99,105,97,108,103,114,97,112,104,105,99,
+115,99,114,105,109,105,110,97,108,112,111,115,115,105,98,108,121,99,111,110,115,
+117,109,101,114,80,101,114,115,111,110,97,108,115,112,101,97,107,105,110,103,118
+,97,108,105,100,97,116,101,97,99,104,105,101,118,101,100,46,106,112,103,34,32,47
+,62,109,97,99,104,105,110,101,115,60,47,104,50,62,10,32,32,107,101,121,119,111,
+114,100,115,102,114,105,101,110,100,108,121,98,114,111,116,104,101,114,115,99,
+111,109,98,105,110,101,100,111,114,105,103,105,110,97,108,99,111,109,112,111,115
+,101,100,101,120,112,101,99,116,101,100,97,100,101,113,117,97,116,101,112,97,107
+,105,115,116,97,110,102,111,108,108,111,119,34,32,118,97,108,117,97,98,108,101,
+60,47,108,97,98,101,108,62,114,101,108,97,116,105,118,101,98,114,105,110,103,105
+,110,103,105,110,99,114,101,97,115,101,103,111,118,101,114,110,111,114,112,108,
+117,103,105,110,115,47,76,105,115,116,32,111,102,32,72,101,97,100,101,114,34,62,
+34,32,110,97,109,101,61,34,32,40,38,113,117,111,116,59,103,114,97,100,117,97,116
+,101,60,47,104,101,97,100,62,10,99,111,109,109,101,114,99,101,109,97,108,97,121,
+115,105,97,100,105,114,101,99,116,111,114,109,97,105,110,116,97,105,110,59,104,
+101,105,103,104,116,58,115,99,104,101,100,117,108,101,99,104,97,110,103,105,110,
+103,98,97,99,107,32,116,111,32,99,97,116,104,111,108,105,99,112,97,116,116,101,
+114,110,115,99,111,108,111,114,58,32,35,103,114,101,97,116,101,115,116,115,117,
+112,112,108,105,101,115,114,101,108,105,97,98,108,101,60,47,117,108,62,10,9,9,60
+,115,101,108,101,99,116,32,99,105,116,105,122,101,110,115,99,108,111,116,104,105
+,110,103,119,97,116,99,104,105,110,103,60,108,105,32,105,100,61,34,115,112,101,
+99,105,102,105,99,99,97,114,114,121,105,110,103,115,101,110,116,101,110,99,101,
+60,99,101,110,116,101,114,62,99,111,110,116,114,97,115,116,116,104,105,110,107,
+105,110,103,99,97,116,99,104,40,101,41,115,111,117,116,104,101,114,110,77,105,99
+,104,97,101,108,32,109,101,114,99,104,97,110,116,99,97,114,111,117,115,101,108,
+112,97,100,100,105,110,103,58,105,110,116,101,114,105,111,114,46,115,112,108,105
+,116,40,34,108,105,122,97,116,105,111,110,79,99,116,111,98,101,114,32,41,123,114
+,101,116,117,114,110,105,109,112,114,111,118,101,100,45,45,38,103,116,59,10,10,
+99,111,118,101,114,97,103,101,99,104,97,105,114,109,97,110,46,112,110,103,34,32,
+47,62,115,117,98,106,101,99,116,115,82,105,99,104,97,114,100,32,119,104,97,116,
+101,118,101,114,112,114,111,98,97,98,108,121,114,101,99,111,118,101,114,121,98,
+97,115,101,98,97,108,108,106,117,100,103,109,101,110,116,99,111,110,110,101,99,
+116,46,46,99,115,115,34,32,47,62,32,119,101,98,115,105,116,101,114,101,112,111,
+114,116,101,100,100,101,102,97,117,108,116,34,47,62,60,47,97,62,13,10,101,108,
+101,99,116,114,105,99,115,99,111,116,108,97,110,100,99,114,101,97,116,105,111,
+110,113,117,97,110,116,105,116,121,46,32,73,83,66,78,32,48,100,105,100,32,110,
+111,116,32,105,110,115,116,97,110,99,101,45,115,101,97,114,99,104,45,34,32,108,
+97,110,103,61,34,115,112,101,97,107,101,114,115,67,111,109,112,117,116,101,114,
+99,111,110,116,97,105,110,115,97,114,99,104,105,118,101,115,109,105,110,105,115,
+116,101,114,114,101,97,99,116,105,111,110,100,105,115,99,111,117,110,116,73,116,
+97,108,105,97,110,111,99,114,105,116,101,114,105,97,115,116,114,111,110,103,108,
+121,58,32,39,104,116,116,112,58,39,115,99,114,105,112,116,39,99,111,118,101,114,
+105,110,103,111,102,102,101,114,105,110,103,97,112,112,101,97,114,101,100,66,114
+,105,116,105,115,104,32,105,100,101,110,116,105,102,121,70,97,99,101,98,111,111,
+107,110,117,109,101,114,111,117,115,118,101,104,105,99,108,101,115,99,111,110,99
+,101,114,110,115,65,109,101,114,105,99,97,110,104,97,110,100,108,105,110,103,100
+,105,118,32,105,100,61,34,87,105,108,108,105,97,109,32,112,114,111,118,105,100,
+101,114,95,99,111,110,116,101,110,116,97,99,99,117,114,97,99,121,115,101,99,116,
+105,111,110,32,97,110,100,101,114,115,111,110,102,108,101,120,105,98,108,101,67,
+97,116,101,103,111,114,121,108,97,119,114,101,110,99,101,60,115,99,114,105,112,
+116,62,108,97,121,111,117,116,61,34,97,112,112,114,111,118,101,100,32,109,97,120
+,105,109,117,109,104,101,97,100,101,114,34,62,60,47,116,97,98,108,101,62,83,101,
+114,118,105,99,101,115,104,97,109,105,108,116,111,110,99,117,114,114,101,110,116
+,32,99,97,110,97,100,105,97,110,99,104,97,110,110,101,108,115,47,116,104,101,109
+,101,115,47,47,97,114,116,105,99,108,101,111,112,116,105,111,110,97,108,112,111,
+114,116,117,103,97,108,118,97,108,117,101,61,34,34,105,110,116,101,114,118,97,
+108,119,105,114,101,108,101,115,115,101,110,116,105,116,108,101,100,97,103,101,
+110,99,105,101,115,83,101,97,114,99,104,34,32,109,101,97,115,117,114,101,100,116
+,104,111,117,115,97,110,100,115,112,101,110,100,105,110,103,38,104,101,108,108,
+105,112,59,110,101,119,32,68,97,116,101,34,32,115,105,122,101,61,34,112,97,103,
+101,78,97,109,101,109,105,100,100,108,101,34,32,34,32,47,62,60,47,97,62,104,105,
+100,100,101,110,34,62,115,101,113,117,101,110,99,101,112,101,114,115,111,110,97,
+108,111,118,101,114,102,108,111,119,111,112,105,110,105,111,110,115,105,108,108,
+105,110,111,105,115,108,105,110,107,115,34,62,10,9,60,116,105,116,108,101,62,118
+,101,114,115,105,111,110,115,115,97,116,117,114,100,97,121,116,101,114,109,105,
+110,97,108,105,116,101,109,112,114,111,112,101,110,103,105,110,101,101,114,115,
+101,99,116,105,111,110,115,100,101,115,105,103,110,101,114,112,114,111,112,111,
+115,97,108,61,34,102,97,108,115,101,34,69,115,112,97,195,177,111,108,114,101,108
+,101,97,115,101,115,115,117,98,109,105,116,34,32,101,114,38,113,117,111,116,59,
+97,100,100,105,116,105,111,110,115,121,109,112,116,111,109,115,111,114,105,101,
+110,116,101,100,114,101,115,111,117,114,99,101,114,105,103,104,116,34,62,60,112,
+108,101,97,115,117,114,101,115,116,97,116,105,111,110,115,104,105,115,116,111,
+114,121,46,108,101,97,118,105,110,103,32,32,98,111,114,100,101,114,61,99,111,110
+,116,101,110,116,115,99,101,110,116,101,114,34,62,46,10,10,83,111,109,101,32,100
+,105,114,101,99,116,101,100,115,117,105,116,97,98,108,101,98,117,108,103,97,114,
+105,97,46,115,104,111,119,40,41,59,100,101,115,105,103,110,101,100,71,101,110,
+101,114,97,108,32,99,111,110,99,101,112,116,115,69,120,97,109,112,108,101,115,
+119,105,108,108,105,97,109,115,79,114,105,103,105,110,97,108,34,62,60,115,112,97
+,110,62,115,101,97,114,99,104,34,62,111,112,101,114,97,116,111,114,114,101,113,
+117,101,115,116,115,97,32,38,113,117,111,116,59,97,108,108,111,119,105,110,103,
+68,111,99,117,109,101,110,116,114,101,118,105,115,105,111,110,46,32,10,10,84,104
+,101,32,121,111,117,114,115,101,108,102,67,111,110,116,97,99,116,32,109,105,99,
+104,105,103,97,110,69,110,103,108,105,115,104,32,99,111,108,117,109,98,105,97,
+112,114,105,111,114,105,116,121,112,114,105,110,116,105,110,103,100,114,105,110,
+107,105,110,103,102,97,99,105,108,105,116,121,114,101,116,117,114,110,101,100,67
+,111,110,116,101,110,116,32,111,102,102,105,99,101,114,115,82,117,115,115,105,97
+,110,32,103,101,110,101,114,97,116,101,45,56,56,53,57,45,49,34,105,110,100,105,
+99,97,116,101,102,97,109,105,108,105,97,114,32,113,117,97,108,105,116,121,109,97
+,114,103,105,110,58,48,32,99,111,110,116,101,110,116,118,105,101,119,112,111,114
+,116,99,111,110,116,97,99,116,115,45,116,105,116,108,101,34,62,112,111,114,116,
+97,98,108,101,46,108,101,110,103,116,104,32,101,108,105,103,105,98,108,101,105,
+110,118,111,108,118,101,115,97,116,108,97,110,116,105,99,111,110,108,111,97,100,
+61,34,100,101,102,97,117,108,116,46,115,117,112,112,108,105,101,100,112,97,121,
+109,101,110,116,115,103,108,111,115,115,97,114,121,10,10,65,102,116,101,114,32,
+103,117,105,100,97,110,99,101,60,47,116,100,62,60,116,100,101,110,99,111,100,105
+,110,103,109,105,100,100,108,101,34,62,99,97,109,101,32,116,111,32,100,105,115,
+112,108,97,121,115,115,99,111,116,116,105,115,104,106,111,110,97,116,104,97,110,
+109,97,106,111,114,105,116,121,119,105,100,103,101,116,115,46,99,108,105,110,105
+,99,97,108,116,104,97,105,108,97,110,100,116,101,97,99,104,101,114,115,60,104,
+101,97,100,62,10,9,97,102,102,101,99,116,101,100,115,117,112,112,111,114,116,115
+,112,111,105,110,116,101,114,59,116,111,83,116,114,105,110,103,60,47,115,109,97,
+108,108,62,111,107,108,97,104,111,109,97,119,105,108,108,32,98,101,32,105,110,
+118,101,115,116,111,114,48,34,32,97,108,116,61,34,104,111,108,105,100,97,121,115
+,82,101,115,111,117,114,99,101,108,105,99,101,110,115,101,100,32,40,119,104,105,
+99,104,32,46,32,65,102,116,101,114,32,99,111,110,115,105,100,101,114,118,105,115
+,105,116,105,110,103,101,120,112,108,111,114,101,114,112,114,105,109,97,114,121,
+32,115,101,97,114,99,104,34,32,97,110,100,114,111,105,100,34,113,117,105,99,107,
+108,121,32,109,101,101,116,105,110,103,115,101,115,116,105,109,97,116,101,59,114
+,101,116,117,114,110,32,59,99,111,108,111,114,58,35,32,104,101,105,103,104,116,
+61,97,112,112,114,111,118,97,108,44,32,38,113,117,111,116,59,32,99,104,101,99,
+107,101,100,46,109,105,110,46,106,115,34,109,97,103,110,101,116,105,99,62,60,47,
+97,62,60,47,104,102,111,114,101,99,97,115,116,46,32,87,104,105,108,101,32,116,
+104,117,114,115,100,97,121,100,118,101,114,116,105,115,101,38,101,97,99,117,116,
+101,59,104,97,115,67,108,97,115,115,101,118,97,108,117,97,116,101,111,114,100,
+101,114,105,110,103,101,120,105,115,116,105,110,103,112,97,116,105,101,110,116,
+115,32,79,110,108,105,110,101,32,99,111,108,111,114,97,100,111,79,112,116,105,
+111,110,115,34,99,97,109,112,98,101,108,108,60,33,45,45,32,101,110,100,60,47,115
+,112,97,110,62,60,60,98,114,32,47,62,13,10,95,112,111,112,117,112,115,124,115,99
+,105,101,110,99,101,115,44,38,113,117,111,116,59,32,113,117,97,108,105,116,121,
+32,87,105,110,100,111,119,115,32,97,115,115,105,103,110,101,100,104,101,105,103,
+104,116,58,32,60,98,32,99,108,97,115,115,108,101,38,113,117,111,116,59,32,118,97
+,108,117,101,61,34,32,67,111,109,112,97,110,121,101,120,97,109,112,108,101,115,
+60,105,102,114,97,109,101,32,98,101,108,105,101,118,101,115,112,114,101,115,101,
+110,116,115,109,97,114,115,104,97,108,108,112,97,114,116,32,111,102,32,112,114,
+111,112,101,114,108,121,41,46,10,10,84,104,101,32,116,97,120,111,110,111,109,121
+,109,117,99,104,32,111,102,32,60,47,115,112,97,110,62,10,34,32,100,97,116,97,45,
+115,114,116,117,103,117,195,170,115,115,99,114,111,108,108,84,111,32,112,114,111
+,106,101,99,116,60,104,101,97,100,62,13,10,97,116,116,111,114,110,101,121,101,
+109,112,104,97,115,105,115,115,112,111,110,115,111,114,115,102,97,110,99,121,98,
+111,120,119,111,114,108,100,39,115,32,119,105,108,100,108,105,102,101,99,104,101
+,99,107,101,100,61,115,101,115,115,105,111,110,115,112,114,111,103,114,97,109,
+109,112,120,59,102,111,110,116,45,32,80,114,111,106,101,99,116,106,111,117,114,
+110,97,108,115,98,101,108,105,101,118,101,100,118,97,99,97,116,105,111,110,116,
+104,111,109,112,115,111,110,108,105,103,104,116,105,110,103,97,110,100,32,116,
+104,101,32,115,112,101,99,105,97,108,32,98,111,114,100,101,114,61,48,99,104,101,
+99,107,105,110,103,60,47,116,98,111,100,121,62,60,98,117,116,116,111,110,32,67,
+111,109,112,108,101,116,101,99,108,101,97,114,102,105,120,10,60,104,101,97,100,
+62,10,97,114,116,105,99,108,101,32,60,115,101,99,116,105,111,110,102,105,110,100
+,105,110,103,115,114,111,108,101,32,105,110,32,112,111,112,117,108,97,114,32,32,
+79,99,116,111,98,101,114,119,101,98,115,105,116,101,32,101,120,112,111,115,117,
+114,101,117,115,101,100,32,116,111,32,32,99,104,97,110,103,101,115,111,112,101,
+114,97,116,101,100,99,108,105,99,107,105,110,103,101,110,116,101,114,105,110,103
+,99,111,109,109,97,110,100,115,105,110,102,111,114,109,101,100,32,110,117,109,98
+,101,114,115,32,32,60,47,100,105,118,62,99,114,101,97,116,105,110,103,111,110,83
+,117,98,109,105,116,109,97,114,121,108,97,110,100,99,111,108,108,101,103,101,115
+,97,110,97,108,121,116,105,99,108,105,115,116,105,110,103,115,99,111,110,116,97,
+99,116,46,108,111,103,103,101,100,73,110,97,100,118,105,115,111,114,121,115,105,
+98,108,105,110,103,115,99,111,110,116,101,110,116,34,115,38,113,117,111,116,59,
+41,115,46,32,84,104,105,115,32,112,97,99,107,97,103,101,115,99,104,101,99,107,98
+,111,120,115,117,103,103,101,115,116,115,112,114,101,103,110,97,110,116,116,111,
+109,111,114,114,111,119,115,112,97,99,105,110,103,61,105,99,111,110,46,112,110,
+103,106,97,112,97,110,101,115,101,99,111,100,101,98,97,115,101,98,117,116,116,
+111,110,34,62,103,97,109,98,108,105,110,103,115,117,99,104,32,97,115,32,44,32,
+119,104,105,108,101,32,60,47,115,112,97,110,62,32,109,105,115,115,111,117,114,
+105,115,112,111,114,116,105,110,103,116,111,112,58,49,112,120,32,46,60,47,115,
+112,97,110,62,116,101,110,115,105,111,110,115,119,105,100,116,104,61,34,50,108,
+97,122,121,108,111,97,100,110,111,118,101,109,98,101,114,117,115,101,100,32,105,
+110,32,104,101,105,103,104,116,61,34,99,114,105,112,116,34,62,10,38,110,98,115,
+112,59,60,47,60,116,114,62,60,116,100,32,104,101,105,103,104,116,58,50,47,112,
+114,111,100,117,99,116,99,111,117,110,116,114,121,32,105,110,99,108,117,100,101,
+32,102,111,111,116,101,114,34,32,38,108,116,59,33,45,45,32,116,105,116,108,101,
+34,62,60,47,106,113,117,101,114,121,46,60,47,102,111,114,109,62,10,40,231,174,
+128,228,189,147,41,40,231,185,129,233,171,148,41,104,114,118,97,116,115,107,105,
+105,116,97,108,105,97,110,111,114,111,109,195,162,110,196,131,116,195,188,114,
+107,195,167,101,216,167,216,177,216,175,217,136,116,97,109,98,105,195,169,110,
+110,111,116,105,99,105,97,115,109,101,110,115,97,106,101,115,112,101,114,115,111
+,110,97,115,100,101,114,101,99,104,111,115,110,97,99,105,111,110,97,108,115,101,
+114,118,105,99,105,111,99,111,110,116,97,99,116,111,117,115,117,97,114,105,111,
+115,112,114,111,103,114,97,109,97,103,111,98,105,101,114,110,111,101,109,112,114
+,101,115,97,115,97,110,117,110,99,105,111,115,118,97,108,101,110,99,105,97,99,
+111,108,111,109,98,105,97,100,101,115,112,117,195,169,115,100,101,112,111,114,
+116,101,115,112,114,111,121,101,99,116,111,112,114,111,100,117,99,116,111,112,
+195,186,98,108,105,99,111,110,111,115,111,116,114,111,115,104,105,115,116,111,
+114,105,97,112,114,101,115,101,110,116,101,109,105,108,108,111,110,101,115,109,
+101,100,105,97,110,116,101,112,114,101,103,117,110,116,97,97,110,116,101,114,105
+,111,114,114,101,99,117,114,115,111,115,112,114,111,98,108,101,109,97,115,97,110
+,116,105,97,103,111,110,117,101,115,116,114,111,115,111,112,105,110,105,195,179,
+110,105,109,112,114,105,109,105,114,109,105,101,110,116,114,97,115,97,109,195,
+169,114,105,99,97,118,101,110,100,101,100,111,114,115,111,99,105,101,100,97,100,
+114,101,115,112,101,99,116,111,114,101,97,108,105,122,97,114,114,101,103,105,115
+,116,114,111,112,97,108,97,98,114,97,115,105,110,116,101,114,195,169,115,101,110
+,116,111,110,99,101,115,101,115,112,101,99,105,97,108,109,105,101,109,98,114,111
+,115,114,101,97,108,105,100,97,100,99,195,179,114,100,111,98,97,122,97,114,97,
+103,111,122,97,112,195,161,103,105,110,97,115,115,111,99,105,97,108,101,115,98,
+108,111,113,117,101,97,114,103,101,115,116,105,195,179,110,97,108,113,117,105,
+108,101,114,115,105,115,116,101,109,97,115,99,105,101,110,99,105,97,115,99,111,
+109,112,108,101,116,111,118,101,114,115,105,195,179,110,99,111,109,112,108,101,
+116,97,101,115,116,117,100,105,111,115,112,195,186,98,108,105,99,97,111,98,106,
+101,116,105,118,111,97,108,105,99,97,110,116,101,98,117,115,99,97,100,111,114,99
+,97,110,116,105,100,97,100,101,110,116,114,97,100,97,115,97,99,99,105,111,110,
+101,115,97,114,99,104,105,118,111,115,115,117,112,101,114,105,111,114,109,97,121
+,111,114,195,173,97,97,108,101,109,97,110,105,97,102,117,110,99,105,195,179,110,
+195,186,108,116,105,109,111,115,104,97,99,105,101,110,100,111,97,113,117,101,108
+,108,111,115,101,100,105,99,105,195,179,110,102,101,114,110,97,110,100,111,97,
+109,98,105,101,110,116,101,102,97,99,101,98,111,111,107,110,117,101,115,116,114,
+97,115,99,108,105,101,110,116,101,115,112,114,111,99,101,115,111,115,98,97,115,
+116,97,110,116,101,112,114,101,115,101,110,116,97,114,101,112,111,114,116,97,114
+,99,111,110,103,114,101,115,111,112,117,98,108,105,99,97,114,99,111,109,101,114,
+99,105,111,99,111,110,116,114,97,116,111,106,195,179,118,101,110,101,115,100,105
+,115,116,114,105,116,111,116,195,169,99,110,105,99,97,99,111,110,106,117,110,116
+,111,101,110,101,114,103,195,173,97,116,114,97,98,97,106,97,114,97,115,116,117,
+114,105,97,115,114,101,99,105,101,110,116,101,117,116,105,108,105,122,97,114,98,
+111,108,101,116,195,173,110,115,97,108,118,97,100,111,114,99,111,114,114,101,99,
+116,97,116,114,97,98,97,106,111,115,112,114,105,109,101,114,111,115,110,101,103,
+111,99,105,111,115,108,105,98,101,114,116,97,100,100,101,116,97,108,108,101,115,
+112,97,110,116,97,108,108,97,112,114,195,179,120,105,109,111,97,108,109,101,114,
+195,173,97,97,110,105,109,97,108,101,115,113,117,105,195,169,110,101,115,99,111,
+114,97,122,195,179,110,115,101,99,99,105,195,179,110,98,117,115,99,97,110,100,
+111,111,112,99,105,111,110,101,115,101,120,116,101,114,105,111,114,99,111,110,99
+,101,112,116,111,116,111,100,97,118,195,173,97,103,97,108,101,114,195,173,97,101
+,115,99,114,105,98,105,114,109,101,100,105,99,105,110,97,108,105,99,101,110,99,
+105,97,99,111,110,115,117,108,116,97,97,115,112,101,99,116,111,115,99,114,195,
+173,116,105,99,97,100,195,179,108,97,114,101,115,106,117,115,116,105,99,105,97,
+100,101,98,101,114,195,161,110,112,101,114,195,173,111,100,111,110,101,99,101,
+115,105,116,97,109,97,110,116,101,110,101,114,112,101,113,117,101,195,177,111,
+114,101,99,105,98,105,100,97,116,114,105,98,117,110,97,108,116,101,110,101,114,
+105,102,101,99,97,110,99,105,195,179,110,99,97,110,97,114,105,97,115,100,101,115
+,99,97,114,103,97,100,105,118,101,114,115,111,115,109,97,108,108,111,114,99,97,
+114,101,113,117,105,101,114,101,116,195,169,99,110,105,99,111,100,101,98,101,114
+,195,173,97,118,105,118,105,101,110,100,97,102,105,110,97,110,122,97,115,97,100,
+101,108,97,110,116,101,102,117,110,99,105,111,110,97,99,111,110,115,101,106,111,
+115,100,105,102,195,173,99,105,108,99,105,117,100,97,100,101,115,97,110,116,105,
+103,117,97,115,97,118,97,110,122,97,100,97,116,195,169,114,109,105,110,111,117,
+110,105,100,97,100,101,115,115,195,161,110,99,104,101,122,99,97,109,112,97,195,
+177,97,115,111,102,116,111,110,105,99,114,101,118,105,115,116,97,115,99,111,110,
+116,105,101,110,101,115,101,99,116,111,114,101,115,109,111,109,101,110,116,111,
+115,102,97,99,117,108,116,97,100,99,114,195,169,100,105,116,111,100,105,118,101,
+114,115,97,115,115,117,112,117,101,115,116,111,102,97,99,116,111,114,101,115,115
+,101,103,117,110,100,111,115,112,101,113,117,101,195,177,97,208,179,208,190,208,
+180,208,176,208,181,209,129,208,187,208,184,208,181,209,129,209,130,209,140,208,
+177,209,139,208,187,208,190,208,177,209,139,209,130,209,140,209,141,209,130,208,
+190,208,188,208,149,209,129,208,187,208,184,209,130,208,190,208,179,208,190,208,
+188,208,181,208,189,209,143,208,178,209,129,208,181,209,133,209,141,209,130,208,
+190,208,185,208,180,208,176,208,182,208,181,208,177,209,139,208,187,208,184,208,
+179,208,190,208,180,209,131,208,180,208,181,208,189,209,140,209,141,209,130,208,
+190,209,130,208,177,209,139,208,187,208,176,209,129,208,181,208,177,209,143,208,
+190,208,180,208,184,208,189,209,129,208,181,208,177,208,181,208,189,208,176,208,
+180,208,190,209,129,208,176,208,185,209,130,209,132,208,190,209,130,208,190,208,
+189,208,181,208,179,208,190,209,129,208,178,208,190,208,184,209,129,208,178,208,
+190,208,185,208,184,208,179,209,128,209,139,209,130,208,190,208,182,208,181,208,
+178,209,129,208,181,208,188,209,129,208,178,208,190,209,142,208,187,208,184,209,
+136,209,140,209,141,209,130,208,184,209,133,208,191,208,190,208,186,208,176,208,
+180,208,189,208,181,208,185,208,180,208,190,208,188,208,176,208,188,208,184,209,
+128,208,176,208,187,208,184,208,177,208,190,209,130,208,181,208,188,209,131,209,
+133,208,190,209,130,209,143,208,180,208,178,209,131,209,133,209,129,208,181,209,
+130,208,184,208,187,209,142,208,180,208,184,208,180,208,181,208,187,208,190,208,
+188,208,184,209,128,208,181,209,130,208,181,208,177,209,143,209,129,208,178,208,
+190,208,181,208,178,208,184,208,180,208,181,209,135,208,181,208,179,208,190,209,
+141,209,130,208,184,208,188,209,129,209,135,208,181,209,130,209,130,208,181,208,
+188,209,139,209,134,208,181,208,189,209,139,209,129,209,130,208,176,208,187,208,
+178,208,181,208,180,209,140,209,130,208,181,208,188,208,181,208,178,208,190,208,
+180,209,139,209,130,208,181,208,177,208,181,208,178,209,139,209,136,208,181,208,
+189,208,176,208,188,208,184,209,130,208,184,208,191,208,176,209,130,208,190,208,
+188,209,131,208,191,209,128,208,176,208,178,208,187,208,184,209,134,208,176,208,
+190,208,180,208,189,208,176,208,179,208,190,208,180,209,139,208,183,208,189,208,
+176,209,142,208,188,208,190,208,179,209,131,208,180,209,128,209,131,208,179,208,
+178,209,129,208,181,208,185,208,184,208,180,208,181,209,130,208,186,208,184,208,
+189,208,190,208,190,208,180,208,189,208,190,208,180,208,181,208,187,208,176,208,
+180,208,181,208,187,208,181,209,129,209,128,208,190,208,186,208,184,209,142,208,
+189,209,143,208,178,208,181,209,129,209,140,208,149,209,129,209,130,209,140,209,
+128,208,176,208,183,208,176,208,189,208,176,209,136,208,184,216,167,217,132,217,
+132,217,135,216,167,217,132,216,170,217,138,216,172,217,133,217,138,216,185,216,
+174,216,167,216,181,216,169,216,167,217,132,216,176,217,138,216,185,217,132,217,
+138,217,135,216,172,216,175,217,138,216,175,216,167,217,132,216,162,217,134,216,
+167,217,132,216,177,216,175,216,170,216,173,217,131,217,133,216,181,217,129,216,
+173,216,169,217,131,216,167,217,134,216,170,216,167,217,132,217,132,217,138,217,
+138,217,131,217,136,217,134,216,180,216,168,217,131,216,169,217,129,217,138,217,
+135,216,167,216,168,217,134,216,167,216,170,216,173,217,136,216,167,216,161,216,
+163,217,131,216,171,216,177,216,174,217,132,216,167,217,132,216,167,217,132,216,
+173,216,168,216,175,217,132,217,138,217,132,216,175,216,177,217,136,216,179,216,
+167,216,182,216,186,216,183,216,170,217,131,217,136,217,134,217,135,217,134,216,
+167,217,131,216,179,216,167,216,173,216,169,217,134,216,167,216,175,217,138,216,
+167,217,132,216,183,216,168,216,185,217,132,217,138,217,131,216,180,217,131,216,
+177,216,167,217,138,217,133,217,131,217,134,217,133,217,134,217,135,216,167,216,
+180,216,177,217,131,216,169,216,177,216,166,217,138,216,179,217,134,216,180,217,
+138,216,183,217,133,216,167,216,176,216,167,216,167,217,132,217,129,217,134,216,
+180,216,168,216,167,216,168,216,170,216,185,216,168,216,177,216,177,216,173,217,
+133,216,169,217,131,216,167,217,129,216,169,217,138,217,130,217,136,217,132,217,
+133,216,177,217,131,216,178,217,131,217,132,217,133,216,169,216,163,216,173,217,
+133,216,175,217,130,217,132,216,168,217,138,217,138,216,185,217,134,217,138,216,
+181,217,136,216,177,216,169,216,183,216,177,217,138,217,130,216,180,216,167,216,
+177,217,131,216,172,217,136,216,167,217,132,216,163,216,174,216,177,217,137,217,
+133,216,185,217,134,216,167,216,167,216,168,216,173,216,171,216,185,216,177,217,
+136,216,182,216,168,216,180,217,131,217,132,217,133,216,179,216,172,217,132,216,
+168,217,134,216,167,217,134,216,174,216,167,217,132,216,175,217,131,216,170,216,
+167,216,168,217,131,217,132,217,138,216,169,216,168,216,175,217,136,217,134,216,
+163,217,138,216,182,216,167,217,138,217,136,216,172,216,175,217,129,216,177,217,
+138,217,130,217,131,216,170,216,168,216,170,216,163,217,129,216,182,217,132,217,
+133,216,183,216,168,216,174,216,167,217,131,216,171,216,177,216,168,216,167,216,
+177,217,131,216,167,217,129,216,182,217,132,216,167,216,173,217,132,217,137,217,
+134,217,129,216,179,217,135,216,163,217,138,216,167,217,133,216,177,216,175,217,
+136,216,175,216,163,217,134,217,135,216,167,216,175,217,138,217,134,216,167,216,
+167,217,132,216,167,217,134,217,133,216,185,216,177,216,182,216,170,216,185,217,
+132,217,133,216,175,216,167,216,174,217,132,217,133,217,133,217,131,217,134,0,0,
+0,0,0,0,0,0,1,0,1,0,1,0,1,0,2,0,2,0,2,0,2,0,4,0,4,0,4,0,4,0,0,1,2,3,4,5,6,7,7,6,
+5,4,3,2,1,0,8,9,10,11,12,13,14,15,15,14,13,12,11,10,9,8,16,17,18,19,20,21,22,23,
+23,22,21,20,19,18,17,16,24,25,26,27,28,29,30,31,31,30,29,28,27,26,25,24,255,255,
+255,255,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,2,0,0,0,2,0,0,0,1,0,0,0,1,0,0,0,
+3,0,0,0,255,255,0,1,0,0,0,1,0,0,255,255,0,1,0,0,0,8,0,8,0,8,0,8,0,0,0,1,0,2,0,3,
+0,4,0,5,0,6,0,7,114,101,115,111,117,114,99,101,115,99,111,117,110,116,114,105,
+101,115,113,117,101,115,116,105,111,110,115,101,113,117,105,112,109,101,110,116,
+99,111,109,109,117,110,105,116,121,97,118,97,105,108,97,98,108,101,104,105,103,
+104,108,105,103,104,116,68,84,68,47,120,104,116,109,108,109,97,114,107,101,116,
+105,110,103,107,110,111,119,108,101,100,103,101,115,111,109,101,116,104,105,110,
+103,99,111,110,116,97,105,110,101,114,100,105,114,101,99,116,105,111,110,115,117
+,98,115,99,114,105,98,101,97,100,118,101,114,116,105,115,101,99,104,97,114,97,99
+,116,101,114,34,32,118,97,108,117,101,61,34,60,47,115,101,108,101,99,116,62,65,
+117,115,116,114,97,108,105,97,34,32,99,108,97,115,115,61,34,115,105,116,117,97,
+116,105,111,110,97,117,116,104,111,114,105,116,121,102,111,108,108,111,119,105,
+110,103,112,114,105,109,97,114,105,108,121,111,112,101,114,97,116,105,111,110,99
+,104,97,108,108,101,110,103,101,100,101,118,101,108,111,112,101,100,97,110,111,
+110,121,109,111,117,115,102,117,110,99,116,105,111,110,32,102,117,110,99,116,105
+,111,110,115,99,111,109,112,97,110,105,101,115,115,116,114,117,99,116,117,114,
+101,97,103,114,101,101,109,101,110,116,34,32,116,105,116,108,101,61,34,112,111,
+116,101,110,116,105,97,108,101,100,117,99,97,116,105,111,110,97,114,103,117,109,
+101,110,116,115,115,101,99,111,110,100,97,114,121,99,111,112,121,114,105,103,104
+,116,108,97,110,103,117,97,103,101,115,101,120,99,108,117,115,105,118,101,99,111
+,110,100,105,116,105,111,110,60,47,102,111,114,109,62,13,10,115,116,97,116,101,
+109,101,110,116,97,116,116,101,110,116,105,111,110,66,105,111,103,114,97,112,104
+,121,125,32,101,108,115,101,32,123,10,115,111,108,117,116,105,111,110,115,119,
+104,101,110,32,116,104,101,32,65,110,97,108,121,116,105,99,115,116,101,109,112,
+108,97,116,101,115,100,97,110,103,101,114,111,117,115,115,97,116,101,108,108,105
+,116,101,100,111,99,117,109,101,110,116,115,112,117,98,108,105,115,104,101,114,
+105,109,112,111,114,116,97,110,116,112,114,111,116,111,116,121,112,101,105,110,
+102,108,117,101,110,99,101,38,114,97,113,117,111,59,60,47,101,102,102,101,99,116
+,105,118,101,103,101,110,101,114,97,108,108,121,116,114,97,110,115,102,111,114,
+109,98,101,97,117,116,105,102,117,108,116,114,97,110,115,112,111,114,116,111,114
+,103,97,110,105,122,101,100,112,117,98,108,105,115,104,101,100,112,114,111,109,
+105,110,101,110,116,117,110,116,105,108,32,116,104,101,116,104,117,109,98,110,97
+,105,108,78,97,116,105,111,110,97,108,32,46,102,111,99,117,115,40,41,59,111,118,
+101,114,32,116,104,101,32,109,105,103,114,97,116,105,111,110,97,110,110,111,117,
+110,99,101,100,102,111,111,116,101,114,34,62,10,101,120,99,101,112,116,105,111,
+110,108,101,115,115,32,116,104,97,110,101,120,112,101,110,115,105,118,101,102,
+111,114,109,97,116,105,111,110,102,114,97,109,101,119,111,114,107,116,101,114,
+114,105,116,111,114,121,110,100,105,99,97,116,105,111,110,99,117,114,114,101,110
+,116,108,121,99,108,97,115,115,78,97,109,101,99,114,105,116,105,99,105,115,109,
+116,114,97,100,105,116,105,111,110,101,108,115,101,119,104,101,114,101,65,108,
+101,120,97,110,100,101,114,97,112,112,111,105,110,116,101,100,109,97,116,101,114
+,105,97,108,115,98,114,111,97,100,99,97,115,116,109,101,110,116,105,111,110,101,
+100,97,102,102,105,108,105,97,116,101,60,47,111,112,116,105,111,110,62,116,114,
+101,97,116,109,101,110,116,100,105,102,102,101,114,101,110,116,47,100,101,102,97
+,117,108,116,46,80,114,101,115,105,100,101,110,116,111,110,99,108,105,99,107,61,
+34,98,105,111,103,114,97,112,104,121,111,116,104,101,114,119,105,115,101,112,101
+,114,109,97,110,101,110,116,70,114,97,110,195,167,97,105,115,72,111,108,108,121,
+119,111,111,100,101,120,112,97,110,115,105,111,110,115,116,97,110,100,97,114,100
+,115,60,47,115,116,121,108,101,62,10,114,101,100,117,99,116,105,111,110,68,101,
+99,101,109,98,101,114,32,112,114,101,102,101,114,114,101,100,67,97,109,98,114,
+105,100,103,101,111,112,112,111,110,101,110,116,115,66,117,115,105,110,101,115,
+115,32,99,111,110,102,117,115,105,111,110,62,10,60,116,105,116,108,101,62,112,
+114,101,115,101,110,116,101,100,101,120,112,108,97,105,110,101,100,100,111,101,
+115,32,110,111,116,32,119,111,114,108,100,119,105,100,101,105,110,116,101,114,
+102,97,99,101,112,111,115,105,116,105,111,110,115,110,101,119,115,112,97,112,101
+,114,60,47,116,97,98,108,101,62,10,109,111,117,110,116,97,105,110,115,108,105,
+107,101,32,116,104,101,32,101,115,115,101,110,116,105,97,108,102,105,110,97,110,
+99,105,97,108,115,101,108,101,99,116,105,111,110,97,99,116,105,111,110,61,34,47,
+97,98,97,110,100,111,110,101,100,69,100,117,99,97,116,105,111,110,112,97,114,115
+,101,73,110,116,40,115,116,97,98,105,108,105,116,121,117,110,97,98,108,101,32,
+116,111,60,47,116,105,116,108,101,62,10,114,101,108,97,116,105,111,110,115,78,
+111,116,101,32,116,104,97,116,101,102,102,105,99,105,101,110,116,112,101,114,102
+,111,114,109,101,100,116,119,111,32,121,101,97,114,115,83,105,110,99,101,32,116,
+104,101,116,104,101,114,101,102,111,114,101,119,114,97,112,112,101,114,34,62,97,
+108,116,101,114,110,97,116,101,105,110,99,114,101,97,115,101,100,66,97,116,116,
+108,101,32,111,102,112,101,114,99,101,105,118,101,100,116,114,121,105,110,103,32
+,116,111,110,101,99,101,115,115,97,114,121,112,111,114,116,114,97,121,101,100,
+101,108,101,99,116,105,111,110,115,69,108,105,122,97,98,101,116,104,60,47,105,
+102,114,97,109,101,62,100,105,115,99,111,118,101,114,121,105,110,115,117,114,97,
+110,99,101,115,46,108,101,110,103,116,104,59,108,101,103,101,110,100,97,114,121,
+71,101,111,103,114,97,112,104,121,99,97,110,100,105,100,97,116,101,99,111,114,
+112,111,114,97,116,101,115,111,109,101,116,105,109,101,115,115,101,114,118,105,
+99,101,115,46,105,110,104,101,114,105,116,101,100,60,47,115,116,114,111,110,103,
+62,67,111,109,109,117,110,105,116,121,114,101,108,105,103,105,111,117,115,108,
+111,99,97,116,105,111,110,115,67,111,109,109,105,116,116,101,101,98,117,105,108,
+100,105,110,103,115,116,104,101,32,119,111,114,108,100,110,111,32,108,111,110,
+103,101,114,98,101,103,105,110,110,105,110,103,114,101,102,101,114,101,110,99,
+101,99,97,110,110,111,116,32,98,101,102,114,101,113,117,101,110,99,121,116,121,
+112,105,99,97,108,108,121,105,110,116,111,32,116,104,101,32,114,101,108,97,116,
+105,118,101,59,114,101,99,111,114,100,105,110,103,112,114,101,115,105,100,101,
+110,116,105,110,105,116,105,97,108,108,121,116,101,99,104,110,105,113,117,101,
+116,104,101,32,111,116,104,101,114,105,116,32,99,97,110,32,98,101,101,120,105,
+115,116,101,110,99,101,117,110,100,101,114,108,105,110,101,116,104,105,115,32,
+116,105,109,101,116,101,108,101,112,104,111,110,101,105,116,101,109,115,99,111,
+112,101,112,114,97,99,116,105,99,101,115,97,100,118,97,110,116,97,103,101,41,59,
+114,101,116,117,114,110,32,70,111,114,32,111,116,104,101,114,112,114,111,118,105
+,100,105,110,103,100,101,109,111,99,114,97,99,121,98,111,116,104,32,116,104,101,
+32,101,120,116,101,110,115,105,118,101,115,117,102,102,101,114,105,110,103,115,
+117,112,112,111,114,116,101,100,99,111,109,112,117,116,101,114,115,32,102,117,
+110,99,116,105,111,110,112,114,97,99,116,105,99,97,108,115,97,105,100,32,116,104
+,97,116,105,116,32,109,97,121,32,98,101,69,110,103,108,105,115,104,60,47,102,114
+,111,109,32,116,104,101,32,115,99,104,101,100,117,108,101,100,100,111,119,110,
+108,111,97,100,115,60,47,108,97,98,101,108,62,10,115,117,115,112,101,99,116,101,
+100,109,97,114,103,105,110,58,32,48,115,112,105,114,105,116,117,97,108,60,47,104
+,101,97,100,62,10,10,109,105,99,114,111,115,111,102,116,103,114,97,100,117,97,
+108,108,121,100,105,115,99,117,115,115,101,100,104,101,32,98,101,99,97,109,101,
+101,120,101,99,117,116,105,118,101,106,113,117,101,114,121,46,106,115,104,111,
+117,115,101,104,111,108,100,99,111,110,102,105,114,109,101,100,112,117,114,99,
+104,97,115,101,100,108,105,116,101,114,97,108,108,121,100,101,115,116,114,111,
+121,101,100,117,112,32,116,111,32,116,104,101,118,97,114,105,97,116,105,111,110,
+114,101,109,97,105,110,105,110,103,105,116,32,105,115,32,110,111,116,99,101,110,
+116,117,114,105,101,115,74,97,112,97,110,101,115,101,32,97,109,111,110,103,32,
+116,104,101,99,111,109,112,108,101,116,101,100,97,108,103,111,114,105,116,104,
+109,105,110,116,101,114,101,115,116,115,114,101,98,101,108,108,105,111,110,117,
+110,100,101,102,105,110,101,100,101,110,99,111,117,114,97,103,101,114,101,115,
+105,122,97,98,108,101,105,110,118,111,108,118,105,110,103,115,101,110,115,105,
+116,105,118,101,117,110,105,118,101,114,115,97,108,112,114,111,118,105,115,105,
+111,110,40,97,108,116,104,111,117,103,104,102,101,97,116,117,114,105,110,103,99,
+111,110,100,117,99,116,101,100,41,44,32,119,104,105,99,104,32,99,111,110,116,105
+,110,117,101,100,45,104,101,97,100,101,114,34,62,70,101,98,114,117,97,114,121,32
+,110,117,109,101,114,111,117,115,32,111,118,101,114,102,108,111,119,58,99,111,
+109,112,111,110,101,110,116,102,114,97,103,109,101,110,116,115,101,120,99,101,
+108,108,101,110,116,99,111,108,115,112,97,110,61,34,116,101,99,104,110,105,99,97
+,108,110,101,97,114,32,116,104,101,32,65,100,118,97,110,99,101,100,32,115,111,
+117,114,99,101,32,111,102,101,120,112,114,101,115,115,101,100,72,111,110,103,32,
+75,111,110,103,32,70,97,99,101,98,111,111,107,109,117,108,116,105,112,108,101,32
+,109,101,99,104,97,110,105,115,109,101,108,101,118,97,116,105,111,110,111,102,
+102,101,110,115,105,118,101,60,47,102,111,114,109,62,10,9,115,112,111,110,115,
+111,114,101,100,100,111,99,117,109,101,110,116,46,111,114,32,38,113,117,111,116,
+59,116,104,101,114,101,32,97,114,101,116,104,111,115,101,32,119,104,111,109,111,
+118,101,109,101,110,116,115,112,114,111,99,101,115,115,101,115,100,105,102,102,
+105,99,117,108,116,115,117,98,109,105,116,116,101,100,114,101,99,111,109,109,101
+,110,100,99,111,110,118,105,110,99,101,100,112,114,111,109,111,116,105,110,103,
+34,32,119,105,100,116,104,61,34,46,114,101,112,108,97,99,101,40,99,108,97,115,
+115,105,99,97,108,99,111,97,108,105,116,105,111,110,104,105,115,32,102,105,114,
+115,116,100,101,99,105,115,105,111,110,115,97,115,115,105,115,116,97,110,116,105
+,110,100,105,99,97,116,101,100,101,118,111,108,117,116,105,111,110,45,119,114,97
+,112,112,101,114,34,101,110,111,117,103,104,32,116,111,97,108,111,110,103,32,116
+,104,101,100,101,108,105,118,101,114,101,100,45,45,62,13,10,60,33,45,45,65,109,
+101,114,105,99,97,110,32,112,114,111,116,101,99,116,101,100,78,111,118,101,109,
+98,101,114,32,60,47,115,116,121,108,101,62,60,102,117,114,110,105,116,117,114,
+101,73,110,116,101,114,110,101,116,32,32,111,110,98,108,117,114,61,34,115,117,
+115,112,101,110,100,101,100,114,101,99,105,112,105,101,110,116,98,97,115,101,100
+,32,111,110,32,77,111,114,101,111,118,101,114,44,97,98,111,108,105,115,104,101,
+100,99,111,108,108,101,99,116,101,100,119,101,114,101,32,109,97,100,101,101,109,
+111,116,105,111,110,97,108,101,109,101,114,103,101,110,99,121,110,97,114,114,97,
+116,105,118,101,97,100,118,111,99,97,116,101,115,112,120,59,98,111,114,100,101,
+114,99,111,109,109,105,116,116,101,100,100,105,114,61,34,108,116,114,34,101,109,
+112,108,111,121,101,101,115,114,101,115,101,97,114,99,104,46,32,115,101,108,101,
+99,116,101,100,115,117,99,99,101,115,115,111,114,99,117,115,116,111,109,101,114,
+115,100,105,115,112,108,97,121,101,100,83,101,112,116,101,109,98,101,114,97,100,
+100,67,108,97,115,115,40,70,97,99,101,98,111,111,107,32,115,117,103,103,101,115,
+116,101,100,97,110,100,32,108,97,116,101,114,111,112,101,114,97,116,105,110,103,
+101,108,97,98,111,114,97,116,101,83,111,109,101,116,105,109,101,115,73,110,115,
+116,105,116,117,116,101,99,101,114,116,97,105,110,108,121,105,110,115,116,97,108
+,108,101,100,102,111,108,108,111,119,101,114,115,74,101,114,117,115,97,108,101,
+109,116,104,101,121,32,104,97,118,101,99,111,109,112,117,116,105,110,103,103,101
+,110,101,114,97,116,101,100,112,114,111,118,105,110,99,101,115,103,117,97,114,97
+,110,116,101,101,97,114,98,105,116,114,97,114,121,114,101,99,111,103,110,105,122
+,101,119,97,110,116,101,100,32,116,111,112,120,59,119,105,100,116,104,58,116,104
+,101,111,114,121,32,111,102,98,101,104,97,118,105,111,117,114,87,104,105,108,101
+,32,116,104,101,101,115,116,105,109,97,116,101,100,98,101,103,97,110,32,116,111,
+32,105,116,32,98,101,99,97,109,101,109,97,103,110,105,116,117,100,101,109,117,
+115,116,32,104,97,118,101,109,111,114,101,32,116,104,97,110,68,105,114,101,99,
+116,111,114,121,101,120,116,101,110,115,105,111,110,115,101,99,114,101,116,97,
+114,121,110,97,116,117,114,97,108,108,121,111,99,99,117,114,114,105,110,103,118,
+97,114,105,97,98,108,101,115,103,105,118,101,110,32,116,104,101,112,108,97,116,
+102,111,114,109,46,60,47,108,97,98,101,108,62,60,102,97,105,108,101,100,32,116,
+111,99,111,109,112,111,117,110,100,115,107,105,110,100,115,32,111,102,32,115,111
+,99,105,101,116,105,101,115,97,108,111,110,103,115,105,100,101,32,45,45,38,103,
+116,59,10,10,115,111,117,116,104,119,101,115,116,116,104,101,32,114,105,103,104,
+116,114,97,100,105,97,116,105,111,110,109,97,121,32,104,97,118,101,32,117,110,
+101,115,99,97,112,101,40,115,112,111,107,101,110,32,105,110,34,32,104,114,101,
+102,61,34,47,112,114,111,103,114,97,109,109,101,111,110,108,121,32,116,104,101,
+32,99,111,109,101,32,102,114,111,109,100,105,114,101,99,116,111,114,121,98,117,
+114,105,101,100,32,105,110,97,32,115,105,109,105,108,97,114,116,104,101,121,32,
+119,101,114,101,60,47,102,111,110,116,62,60,47,78,111,114,119,101,103,105,97,110
+,115,112,101,99,105,102,105,101,100,112,114,111,100,117,99,105,110,103,112,97,
+115,115,101,110,103,101,114,40,110,101,119,32,68,97,116,101,116,101,109,112,111,
+114,97,114,121,102,105,99,116,105,111,110,97,108,65,102,116,101,114,32,116,104,
+101,101,113,117,97,116,105,111,110,115,100,111,119,110,108,111,97,100,46,114,101
+,103,117,108,97,114,108,121,100,101,118,101,108,111,112,101,114,97,98,111,118,
+101,32,116,104,101,108,105,110,107,101,100,32,116,111,112,104,101,110,111,109,
+101,110,97,112,101,114,105,111,100,32,111,102,116,111,111,108,116,105,112,34,62,
+115,117,98,115,116,97,110,99,101,97,117,116,111,109,97,116,105,99,97,115,112,101
+,99,116,32,111,102,65,109,111,110,103,32,116,104,101,99,111,110,110,101,99,116,
+101,100,101,115,116,105,109,97,116,101,115,65,105,114,32,70,111,114,99,101,115,
+121,115,116,101,109,32,111,102,111,98,106,101,99,116,105,118,101,105,109,109,101
+,100,105,97,116,101,109,97,107,105,110,103,32,105,116,112,97,105,110,116,105,110
+,103,115,99,111,110,113,117,101,114,101,100,97,114,101,32,115,116,105,108,108,
+112,114,111,99,101,100,117,114,101,103,114,111,119,116,104,32,111,102,104,101,97
+,100,101,100,32,98,121,69,117,114,111,112,101,97,110,32,100,105,118,105,115,105,
+111,110,115,109,111,108,101,99,117,108,101,115,102,114,97,110,99,104,105,115,101
+,105,110,116,101,110,116,105,111,110,97,116,116,114,97,99,116,101,100,99,104,105
+,108,100,104,111,111,100,97,108,115,111,32,117,115,101,100,100,101,100,105,99,97
+,116,101,100,115,105,110,103,97,112,111,114,101,100,101,103,114,101,101,32,111,
+102,102,97,116,104,101,114,32,111,102,99,111,110,102,108,105,99,116,115,60,47,97
+,62,60,47,112,62,10,99,97,109,101,32,102,114,111,109,119,101,114,101,32,117,115,
+101,100,110,111,116,101,32,116,104,97,116,114,101,99,101,105,118,105,110,103,69,
+120,101,99,117,116,105,118,101,101,118,101,110,32,109,111,114,101,97,99,99,101,
+115,115,32,116,111,99,111,109,109,97,110,100,101,114,80,111,108,105,116,105,99,
+97,108,109,117,115,105,99,105,97,110,115,100,101,108,105,99,105,111,117,115,112,
+114,105,115,111,110,101,114,115,97,100,118,101,110,116,32,111,102,85,84,70,45,56
+,34,32,47,62,60,33,91,67,68,65,84,65,91,34,62,67,111,110,116,97,99,116,83,111,
+117,116,104,101,114,110,32,98,103,99,111,108,111,114,61,34,115,101,114,105,101,
+115,32,111,102,46,32,73,116,32,119,97,115,32,105,110,32,69,117,114,111,112,101,
+112,101,114,109,105,116,116,101,100,118,97,108,105,100,97,116,101,46,97,112,112,
+101,97,114,105,110,103,111,102,102,105,99,105,97,108,115,115,101,114,105,111,117
+,115,108,121,45,108,97,110,103,117,97,103,101,105,110,105,116,105,97,116,101,100
+,101,120,116,101,110,100,105,110,103,108,111,110,103,45,116,101,114,109,105,110,
+102,108,97,116,105,111,110,115,117,99,104,32,116,104,97,116,103,101,116,67,111,
+111,107,105,101,109,97,114,107,101,100,32,98,121,60,47,98,117,116,116,111,110,62
+,105,109,112,108,101,109,101,110,116,98,117,116,32,105,116,32,105,115,105,110,99
+,114,101,97,115,101,115,100,111,119,110,32,116,104,101,32,114,101,113,117,105,
+114,105,110,103,100,101,112,101,110,100,101,110,116,45,45,62,10,60,33,45,45,32,
+105,110,116,101,114,118,105,101,119,87,105,116,104,32,116,104,101,32,99,111,112,
+105,101,115,32,111,102,99,111,110,115,101,110,115,117,115,119,97,115,32,98,117,
+105,108,116,86,101,110,101,122,117,101,108,97,40,102,111,114,109,101,114,108,121
+,116,104,101,32,115,116,97,116,101,112,101,114,115,111,110,110,101,108,115,116,
+114,97,116,101,103,105,99,102,97,118,111,117,114,32,111,102,105,110,118,101,110,
+116,105,111,110,87,105,107,105,112,101,100,105,97,99,111,110,116,105,110,101,110
+,116,118,105,114,116,117,97,108,108,121,119,104,105,99,104,32,119,97,115,112,114
+,105,110,99,105,112,108,101,67,111,109,112,108,101,116,101,32,105,100,101,110,
+116,105,99,97,108,115,104,111,119,32,116,104,97,116,112,114,105,109,105,116,105,
+118,101,97,119,97,121,32,102,114,111,109,109,111,108,101,99,117,108,97,114,112,
+114,101,99,105,115,101,108,121,100,105,115,115,111,108,118,101,100,85,110,100,
+101,114,32,116,104,101,118,101,114,115,105,111,110,61,34,62,38,110,98,115,112,59
+,60,47,73,116,32,105,115,32,116,104,101,32,84,104,105,115,32,105,115,32,119,105,
+108,108,32,104,97,118,101,111,114,103,97,110,105,115,109,115,115,111,109,101,32,
+116,105,109,101,70,114,105,101,100,114,105,99,104,119,97,115,32,102,105,114,115,
+116,116,104,101,32,111,110,108,121,32,102,97,99,116,32,116,104,97,116,102,111,
+114,109,32,105,100,61,34,112,114,101,99,101,100,105,110,103,84,101,99,104,110,
+105,99,97,108,112,104,121,115,105,99,105,115,116,111,99,99,117,114,115,32,105,
+110,110,97,118,105,103,97,116,111,114,115,101,99,116,105,111,110,34,62,115,112,
+97,110,32,105,100,61,34,115,111,117,103,104,116,32,116,111,98,101,108,111,119,32
+,116,104,101,115,117,114,118,105,118,105,110,103,125,60,47,115,116,121,108,101,
+62,104,105,115,32,100,101,97,116,104,97,115,32,105,110,32,116,104,101,99,97,117,
+115,101,100,32,98,121,112,97,114,116,105,97,108,108,121,101,120,105,115,116,105,
+110,103,32,117,115,105,110,103,32,116,104,101,119,97,115,32,103,105,118,101,110,
+97,32,108,105,115,116,32,111,102,108,101,118,101,108,115,32,111,102,110,111,116,
+105,111,110,32,111,102,79,102,102,105,99,105,97,108,32,100,105,115,109,105,115,
+115,101,100,115,99,105,101,110,116,105,115,116,114,101,115,101,109,98,108,101,
+115,100,117,112,108,105,99,97,116,101,101,120,112,108,111,115,105,118,101,114,
+101,99,111,118,101,114,101,100,97,108,108,32,111,116,104,101,114,103,97,108,108,
+101,114,105,101,115,123,112,97,100,100,105,110,103,58,112,101,111,112,108,101,32
+,111,102,114,101,103,105,111,110,32,111,102,97,100,100,114,101,115,115,101,115,
+97,115,115,111,99,105,97,116,101,105,109,103,32,97,108,116,61,34,105,110,32,109,
+111,100,101,114,110,115,104,111,117,108,100,32,98,101,109,101,116,104,111,100,32
+,111,102,114,101,112,111,114,116,105,110,103,116,105,109,101,115,116,97,109,112,
+110,101,101,100,101,100,32,116,111,116,104,101,32,71,114,101,97,116,114,101,103,
+97,114,100,105,110,103,115,101,101,109,101,100,32,116,111,118,105,101,119,101,
+100,32,97,115,105,109,112,97,99,116,32,111,110,105,100,101,97,32,116,104,97,116,
+116,104,101,32,87,111,114,108,100,104,101,105,103,104,116,32,111,102,101,120,112
+,97,110,100,105,110,103,84,104,101,115,101,32,97,114,101,99,117,114,114,101,110,
+116,34,62,99,97,114,101,102,117,108,108,121,109,97,105,110,116,97,105,110,115,99
+,104,97,114,103,101,32,111,102,67,108,97,115,115,105,99,97,108,97,100,100,114,
+101,115,115,101,100,112,114,101,100,105,99,116,101,100,111,119,110,101,114,115,
+104,105,112,60,100,105,118,32,105,100,61,34,114,105,103,104,116,34,62,13,10,114,
+101,115,105,100,101,110,99,101,108,101,97,118,101,32,116,104,101,99,111,110,116,
+101,110,116,34,62,97,114,101,32,111,102,116,101,110,32,32,125,41,40,41,59,13,10,
+112,114,111,98,97,98,108,121,32,80,114,111,102,101,115,115,111,114,45,98,117,116
+,116,111,110,34,32,114,101,115,112,111,110,100,101,100,115,97,121,115,32,116,104
+,97,116,104,97,100,32,116,111,32,98,101,112,108,97,99,101,100,32,105,110,72,117,
+110,103,97,114,105,97,110,115,116,97,116,117,115,32,111,102,115,101,114,118,101,
+115,32,97,115,85,110,105,118,101,114,115,97,108,101,120,101,99,117,116,105,111,
+110,97,103,103,114,101,103,97,116,101,102,111,114,32,119,104,105,99,104,105,110,
+102,101,99,116,105,111,110,97,103,114,101,101,100,32,116,111,104,111,119,101,118
+,101,114,44,32,112,111,112,117,108,97,114,34,62,112,108,97,99,101,100,32,111,110
+,99,111,110,115,116,114,117,99,116,101,108,101,99,116,111,114,97,108,115,121,109
+,98,111,108,32,111,102,105,110,99,108,117,100,105,110,103,114,101,116,117,114,
+110,32,116,111,97,114,99,104,105,116,101,99,116,67,104,114,105,115,116,105,97,
+110,112,114,101,118,105,111,117,115,32,108,105,118,105,110,103,32,105,110,101,97
+,115,105,101,114,32,116,111,112,114,111,102,101,115,115,111,114,10,38,108,116,59
+,33,45,45,32,101,102,102,101,99,116,32,111,102,97,110,97,108,121,116,105,99,115,
+119,97,115,32,116,97,107,101,110,119,104,101,114,101,32,116,104,101,116,111,111,
+107,32,111,118,101,114,98,101,108,105,101,102,32,105,110,65,102,114,105,107,97,
+97,110,115,97,115,32,102,97,114,32,97,115,112,114,101,118,101,110,116,101,100,
+119,111,114,107,32,119,105,116,104,97,32,115,112,101,99,105,97,108,60,102,105,
+101,108,100,115,101,116,67,104,114,105,115,116,109,97,115,82,101,116,114,105,101
+,118,101,100,10,10,73,110,32,116,104,101,32,98,97,99,107,32,105,110,116,111,110,
+111,114,116,104,101,97,115,116,109,97,103,97,122,105,110,101,115,62,60,115,116,
+114,111,110,103,62,99,111,109,109,105,116,116,101,101,103,111,118,101,114,110,
+105,110,103,103,114,111,117,112,115,32,111,102,115,116,111,114,101,100,32,105,
+110,101,115,116,97,98,108,105,115,104,97,32,103,101,110,101,114,97,108,105,116,
+115,32,102,105,114,115,116,116,104,101,105,114,32,111,119,110,112,111,112,117,
+108,97,116,101,100,97,110,32,111,98,106,101,99,116,67,97,114,105,98,98,101,97,
+110,97,108,108,111,119,32,116,104,101,100,105,115,116,114,105,99,116,115,119,105
+,115,99,111,110,115,105,110,108,111,99,97,116,105,111,110,46,59,32,119,105,100,
+116,104,58,32,105,110,104,97,98,105,116,101,100,83,111,99,105,97,108,105,115,116
+,74,97,110,117,97,114,121,32,49,60,47,102,111,111,116,101,114,62,115,105,109,105
+,108,97,114,108,121,99,104,111,105,99,101,32,111,102,116,104,101,32,115,97,109,
+101,32,115,112,101,99,105,102,105,99,32,98,117,115,105,110,101,115,115,32,84,104
+,101,32,102,105,114,115,116,46,108,101,110,103,116,104,59,32,100,101,115,105,114
+,101,32,116,111,100,101,97,108,32,119,105,116,104,115,105,110,99,101,32,116,104,
+101,117,115,101,114,65,103,101,110,116,99,111,110,99,101,105,118,101,100,105,110
+,100,101,120,46,112,104,112,97,115,32,38,113,117,111,116,59,101,110,103,97,103,
+101,32,105,110,114,101,99,101,110,116,108,121,44,102,101,119,32,121,101,97,114,
+115,119,101,114,101,32,97,108,115,111,10,60,104,101,97,100,62,10,60,101,100,105,
+116,101,100,32,98,121,97,114,101,32,107,110,111,119,110,99,105,116,105,101,115,
+32,105,110,97,99,99,101,115,115,107,101,121,99,111,110,100,101,109,110,101,100,
+97,108,115,111,32,104,97,118,101,115,101,114,118,105,99,101,115,44,102,97,109,
+105,108,121,32,111,102,83,99,104,111,111,108,32,111,102,99,111,110,118,101,114,
+116,101,100,110,97,116,117,114,101,32,111,102,32,108,97,110,103,117,97,103,101,
+109,105,110,105,115,116,101,114,115,60,47,111,98,106,101,99,116,62,116,104,101,
+114,101,32,105,115,32,97,32,112,111,112,117,108,97,114,115,101,113,117,101,110,
+99,101,115,97,100,118,111,99,97,116,101,100,84,104,101,121,32,119,101,114,101,97
+,110,121,32,111,116,104,101,114,108,111,99,97,116,105,111,110,61,101,110,116,101
+,114,32,116,104,101,109,117,99,104,32,109,111,114,101,114,101,102,108,101,99,116
+,101,100,119,97,115,32,110,97,109,101,100,111,114,105,103,105,110,97,108,32,97,
+32,116,121,112,105,99,97,108,119,104,101,110,32,116,104,101,121,101,110,103,105,
+110,101,101,114,115,99,111,117,108,100,32,110,111,116,114,101,115,105,100,101,
+110,116,115,119,101,100,110,101,115,100,97,121,116,104,101,32,116,104,105,114,
+100,32,112,114,111,100,117,99,116,115,74,97,110,117,97,114,121,32,50,119,104,97,
+116,32,116,104,101,121,97,32,99,101,114,116,97,105,110,114,101,97,99,116,105,111
+,110,115,112,114,111,99,101,115,115,111,114,97,102,116,101,114,32,104,105,115,
+116,104,101,32,108,97,115,116,32,99,111,110,116,97,105,110,101,100,34,62,60,47,
+100,105,118,62,10,60,47,97,62,60,47,116,100,62,100,101,112,101,110,100,32,111,
+110,115,101,97,114,99,104,34,62,10,112,105,101,99,101,115,32,111,102,99,111,109,
+112,101,116,105,110,103,82,101,102,101,114,101,110,99,101,116,101,110,110,101,
+115,115,101,101,119,104,105,99,104,32,104,97,115,32,118,101,114,115,105,111,110,
+61,60,47,115,112,97,110,62,32,60,60,47,104,101,97,100,101,114,62,103,105,118,101
+,115,32,116,104,101,104,105,115,116,111,114,105,97,110,118,97,108,117,101,61,34,
+34,62,112,97,100,100,105,110,103,58,48,118,105,101,119,32,116,104,97,116,116,111
+,103,101,116,104,101,114,44,116,104,101,32,109,111,115,116,32,119,97,115,32,102,
+111,117,110,100,115,117,98,115,101,116,32,111,102,97,116,116,97,99,107,32,111,
+110,99,104,105,108,100,114,101,110,44,112,111,105,110,116,115,32,111,102,112,101
+,114,115,111,110,97,108,32,112,111,115,105,116,105,111,110,58,97,108,108,101,103
+,101,100,108,121,67,108,101,118,101,108,97,110,100,119,97,115,32,108,97,116,101,
+114,97,110,100,32,97,102,116,101,114,97,114,101,32,103,105,118,101,110,119,97,
+115,32,115,116,105,108,108,115,99,114,111,108,108,105,110,103,100,101,115,105,
+103,110,32,111,102,109,97,107,101,115,32,116,104,101,109,117,99,104,32,108,101,
+115,115,65,109,101,114,105,99,97,110,115,46,10,10,65,102,116,101,114,32,44,32,98
+,117,116,32,116,104,101,77,117,115,101,117,109,32,111,102,108,111,117,105,115,
+105,97,110,97,40,102,114,111,109,32,116,104,101,109,105,110,110,101,115,111,116,
+97,112,97,114,116,105,99,108,101,115,97,32,112,114,111,99,101,115,115,68,111,109
+,105,110,105,99,97,110,118,111,108,117,109,101,32,111,102,114,101,116,117,114,
+110,105,110,103,100,101,102,101,110,115,105,118,101,48,48,112,120,124,114,105,
+103,104,109,97,100,101,32,102,114,111,109,109,111,117,115,101,111,118,101,114,34
+,32,115,116,121,108,101,61,34,115,116,97,116,101,115,32,111,102,40,119,104,105,
+99,104,32,105,115,99,111,110,116,105,110,117,101,115,70,114,97,110,99,105,115,99
+,111,98,117,105,108,100,105,110,103,32,119,105,116,104,111,117,116,32,97,119,105
+,116,104,32,115,111,109,101,119,104,111,32,119,111,117,108,100,97,32,102,111,114
+,109,32,111,102,97,32,112,97,114,116,32,111,102,98,101,102,111,114,101,32,105,
+116,107,110,111,119,110,32,97,115,32,32,83,101,114,118,105,99,101,115,108,111,99
+,97,116,105,111,110,32,97,110,100,32,111,102,116,101,110,109,101,97,115,117,114,
+105,110,103,97,110,100,32,105,116,32,105,115,112,97,112,101,114,98,97,99,107,118
+,97,108,117,101,115,32,111,102,13,10,60,116,105,116,108,101,62,61,32,119,105,110
+,100,111,119,46,100,101,116,101,114,109,105,110,101,101,114,38,113,117,111,116,
+59,32,112,108,97,121,101,100,32,98,121,97,110,100,32,101,97,114,108,121,60,47,99
+,101,110,116,101,114,62,102,114,111,109,32,116,104,105,115,116,104,101,32,116,
+104,114,101,101,112,111,119,101,114,32,97,110,100,111,102,32,38,113,117,111,116,
+59,105,110,110,101,114,72,84,77,76,60,97,32,104,114,101,102,61,34,121,58,105,110
+,108,105,110,101,59,67,104,117,114,99,104,32,111,102,116,104,101,32,101,118,101,
+110,116,118,101,114,121,32,104,105,103,104,111,102,102,105,99,105,97,108,32,45,
+104,101,105,103,104,116,58,32,99,111,110,116,101,110,116,61,34,47,99,103,105,45,
+98,105,110,47,116,111,32,99,114,101,97,116,101,97,102,114,105,107,97,97,110,115,
+101,115,112,101,114,97,110,116,111,102,114,97,110,195,167,97,105,115,108,97,116,
+118,105,101,197,161,117,108,105,101,116,117,118,105,197,179,196,140,101,197,161,
+116,105,110,97,196,141,101,197,161,116,105,110,97,224,185,132,224,184,151,224,
+184,162,230,151,165,230,156,172,232,170,158,231,174,128,228,189,147,229,173,151,
+231,185,129,233,171,148,229,173,151,237,149,156,234,181,173,236,150,180,228,184,
+186,228,187,128,228,185,136,232,174,161,231,174,151,230,156,186,231,172,148,232,
+174,176,230,156,172,232,168,142,232,171,150,229,141,128,230,156,141,229,138,161,
+229,153,168,228,186,146,232,129,148,231,189,145,230,136,191,229,156,176,228,186,
+167,228,191,177,228,185,144,233,131,168,229,135,186,231,137,136,231,164,190,230,
+142,146,232,161,140,230,166,156,233,131,168,232,144,189,230,160,188,232,191,155,
+228,184,128,230,173,165,230,148,175,228,187,152,229,174,157,233,170,140,232,175,
+129,231,160,129,229,167,148,229,145,152,228,188,154,230,149,176,230,141,174,229,
+186,147,230,182,136,232,180,185,232,128,133,229,138,158,229,133,172,229,174,164,
+232,174,168,232,174,186,229,140,186,230,183,177,229,156,179,229,184,130,230,146,
+173,230,148,190,229,153,168,229,140,151,228,186,172,229,184,130,229,164,167,229,
+173,166,231,148,159,232,182,138,230,157,165,232,182,138,231,174,161,231,144,134,
+229,145,152,228,191,161,230,129,175,231,189,145,115,101,114,118,105,99,105,111,
+115,97,114,116,195,173,99,117,108,111,97,114,103,101,110,116,105,110,97,98,97,
+114,99,101,108,111,110,97,99,117,97,108,113,117,105,101,114,112,117,98,108,105,
+99,97,100,111,112,114,111,100,117,99,116,111,115,112,111,108,195,173,116,105,99,
+97,114,101,115,112,117,101,115,116,97,119,105,107,105,112,101,100,105,97,115,105
+,103,117,105,101,110,116,101,98,195,186,115,113,117,101,100,97,99,111,109,117,
+110,105,100,97,100,115,101,103,117,114,105,100,97,100,112,114,105,110,99,105,112
+,97,108,112,114,101,103,117,110,116,97,115,99,111,110,116,101,110,105,100,111,
+114,101,115,112,111,110,100,101,114,118,101,110,101,122,117,101,108,97,112,114,
+111,98,108,101,109,97,115,100,105,99,105,101,109,98,114,101,114,101,108,97,99,
+105,195,179,110,110,111,118,105,101,109,98,114,101,115,105,109,105,108,97,114,
+101,115,112,114,111,121,101,99,116,111,115,112,114,111,103,114,97,109,97,115,105
+,110,115,116,105,116,117,116,111,97,99,116,105,118,105,100,97,100,101,110,99,117
+,101,110,116,114,97,101,99,111,110,111,109,195,173,97,105,109,195,161,103,101,
+110,101,115,99,111,110,116,97,99,116,97,114,100,101,115,99,97,114,103,97,114,110
+,101,99,101,115,97,114,105,111,97,116,101,110,99,105,195,179,110,116,101,108,195
+,169,102,111,110,111,99,111,109,105,115,105,195,179,110,99,97,110,99,105,111,110
+,101,115,99,97,112,97,99,105,100,97,100,101,110,99,111,110,116,114,97,114,97,110
+,195,161,108,105,115,105,115,102,97,118,111,114,105,116,111,115,116,195,169,114,
+109,105,110,111,115,112,114,111,118,105,110,99,105,97,101,116,105,113,117,101,
+116,97,115,101,108,101,109,101,110,116,111,115,102,117,110,99,105,111,110,101,
+115,114,101,115,117,108,116,97,100,111,99,97,114,195,161,99,116,101,114,112,114,
+111,112,105,101,100,97,100,112,114,105,110,99,105,112,105,111,110,101,99,101,115
+,105,100,97,100,109,117,110,105,99,105,112,97,108,99,114,101,97,99,105,195,179,
+110,100,101,115,99,97,114,103,97,115,112,114,101,115,101,110,99,105,97,99,111,
+109,101,114,99,105,97,108,111,112,105,110,105,111,110,101,115,101,106,101,114,99
+,105,99,105,111,101,100,105,116,111,114,105,97,108,115,97,108,97,109,97,110,99,
+97,103,111,110,122,195,161,108,101,122,100,111,99,117,109,101,110,116,111,112,
+101,108,195,173,99,117,108,97,114,101,99,105,101,110,116,101,115,103,101,110,101
+,114,97,108,101,115,116,97,114,114,97,103,111,110,97,112,114,195,161,99,116,105,
+99,97,110,111,118,101,100,97,100,101,115,112,114,111,112,117,101,115,116,97,112,
+97,99,105,101,110,116,101,115,116,195,169,99,110,105,99,97,115,111,98,106,101,
+116,105,118,111,115,99,111,110,116,97,99,116,111,115,224,164,174,224,165,135,224
+,164,130,224,164,178,224,164,191,224,164,143,224,164,185,224,165,136,224,164,130
+,224,164,151,224,164,175,224,164,190,224,164,184,224,164,190,224,164,165,224,164
+,143,224,164,181,224,164,130,224,164,176,224,164,185,224,165,135,224,164,149,224
+,165,139,224,164,136,224,164,149,224,165,129,224,164,155,224,164,176,224,164,185
+,224,164,190,224,164,172,224,164,190,224,164,166,224,164,149,224,164,185,224,164
+,190,224,164,184,224,164,173,224,165,128,224,164,185,224,165,129,224,164,143,224
+,164,176,224,164,185,224,165,128,224,164,174,224,165,136,224,164,130,224,164,166
+,224,164,191,224,164,168,224,164,172,224,164,190,224,164,164,100,105,112,108,111
+,100,111,99,115,224,164,184,224,164,174,224,164,175,224,164,176,224,165,130,224,
+164,170,224,164,168,224,164,190,224,164,174,224,164,170,224,164,164,224,164,190,
+224,164,171,224,164,191,224,164,176,224,164,148,224,164,184,224,164,164,224,164,
+164,224,164,176,224,164,185,224,164,178,224,165,139,224,164,151,224,164,185,224,
+165,129,224,164,134,224,164,172,224,164,190,224,164,176,224,164,166,224,165,135,
+224,164,182,224,164,185,224,165,129,224,164,136,224,164,150,224,165,135,224,164,
+178,224,164,175,224,164,166,224,164,191,224,164,149,224,164,190,224,164,174,224,
+164,181,224,165,135,224,164,172,224,164,164,224,165,128,224,164,168,224,164,172,
+224,165,128,224,164,154,224,164,174,224,165,140,224,164,164,224,164,184,224,164,
+190,224,164,178,224,164,178,224,165,135,224,164,150,224,164,156,224,165,137,224,
+164,172,224,164,174,224,164,166,224,164,166,224,164,164,224,164,165,224,164,190,
+224,164,168,224,164,185,224,165,128,224,164,182,224,164,185,224,164,176,224,164,
+133,224,164,178,224,164,151,224,164,149,224,164,173,224,165,128,224,164,168,224,
+164,151,224,164,176,224,164,170,224,164,190,224,164,184,224,164,176,224,164,190,
+224,164,164,224,164,149,224,164,191,224,164,143,224,164,137,224,164,184,224,165,
+135,224,164,151,224,164,175,224,165,128,224,164,185,224,165,130,224,164,129,224,
+164,134,224,164,151,224,165,135,224,164,159,224,165,128,224,164,174,224,164,150,
+224,165,139,224,164,156,224,164,149,224,164,190,224,164,176,224,164,133,224,164,
+173,224,165,128,224,164,151,224,164,175,224,165,135,224,164,164,224,165,129,224,
+164,174,224,164,181,224,165,139,224,164,159,224,164,166,224,165,135,224,164,130,
+224,164,133,224,164,151,224,164,176,224,164,144,224,164,184,224,165,135,224,164,
+174,224,165,135,224,164,178,224,164,178,224,164,151,224,164,190,224,164,185,224,
+164,190,224,164,178,224,164,138,224,164,170,224,164,176,224,164,154,224,164,190,
+224,164,176,224,164,144,224,164,184,224,164,190,224,164,166,224,165,135,224,164,
+176,224,164,156,224,164,191,224,164,184,224,164,166,224,164,191,224,164,178,224,
+164,172,224,164,130,224,164,166,224,164,172,224,164,168,224,164,190,224,164,185,
+224,165,130,224,164,130,224,164,178,224,164,190,224,164,150,224,164,156,224,165,
+128,224,164,164,224,164,172,224,164,159,224,164,168,224,164,174,224,164,191,224,
+164,178,224,164,135,224,164,184,224,165,135,224,164,134,224,164,168,224,165,135,
+224,164,168,224,164,175,224,164,190,224,164,149,224,165,129,224,164,178,224,164,
+178,224,165,137,224,164,151,224,164,173,224,164,190,224,164,151,224,164,176,224,
+165,135,224,164,178,224,164,156,224,164,151,224,164,185,224,164,176,224,164,190,
+224,164,174,224,164,178,224,164,151,224,165,135,224,164,170,224,165,135,224,164,
+156,224,164,185,224,164,190,224,164,165,224,164,135,224,164,184,224,165,128,224,
+164,184,224,164,185,224,165,128,224,164,149,224,164,178,224,164,190,224,164,160,
+224,165,128,224,164,149,224,164,185,224,164,190,224,164,129,224,164,166,224,165,
+130,224,164,176,224,164,164,224,164,185,224,164,164,224,164,184,224,164,190,224,
+164,164,224,164,175,224,164,190,224,164,166,224,164,134,224,164,175,224,164,190,
+224,164,170,224,164,190,224,164,149,224,164,149,224,165,140,224,164,168,224,164,
+182,224,164,190,224,164,174,224,164,166,224,165,135,224,164,150,224,164,175,224,
+164,185,224,165,128,224,164,176,224,164,190,224,164,175,224,164,150,224,165,129,
+224,164,166,224,164,178,224,164,151,224,165,128,99,97,116,101,103,111,114,105,
+101,115,101,120,112,101,114,105,101,110,99,101,60,47,116,105,116,108,101,62,13,
+10,67,111,112,121,114,105,103,104,116,32,106,97,118,97,115,99,114,105,112,116,99
+,111,110,100,105,116,105,111,110,115,101,118,101,114,121,116,104,105,110,103,60,
+112,32,99,108,97,115,115,61,34,116,101,99,104,110,111,108,111,103,121,98,97,99,
+107,103,114,111,117,110,100,60,97,32,99,108,97,115,115,61,34,109,97,110,97,103,
+101,109,101,110,116,38,99,111,112,121,59,32,50,48,49,106,97,118,97,83,99,114,105
+,112,116,99,104,97,114,97,99,116,101,114,115,98,114,101,97,100,99,114,117,109,98
+,116,104,101,109,115,101,108,118,101,115,104,111,114,105,122,111,110,116,97,108,
+103,111,118,101,114,110,109,101,110,116,67,97,108,105,102,111,114,110,105,97,97,
+99,116,105,118,105,116,105,101,115,100,105,115,99,111,118,101,114,101,100,78,97,
+118,105,103,97,116,105,111,110,116,114,97,110,115,105,116,105,111,110,99,111,110
+,110,101,99,116,105,111,110,110,97,118,105,103,97,116,105,111,110,97,112,112,101
+,97,114,97,110,99,101,60,47,116,105,116,108,101,62,60,109,99,104,101,99,107,98,
+111,120,34,32,116,101,99,104,110,105,113,117,101,115,112,114,111,116,101,99,116,
+105,111,110,97,112,112,97,114,101,110,116,108,121,97,115,32,119,101,108,108,32,
+97,115,117,110,116,39,44,32,39,85,65,45,114,101,115,111,108,117,116,105,111,110,
+111,112,101,114,97,116,105,111,110,115,116,101,108,101,118,105,115,105,111,110,
+116,114,97,110,115,108,97,116,101,100,87,97,115,104,105,110,103,116,111,110,110,
+97,118,105,103,97,116,111,114,46,32,61,32,119,105,110,100,111,119,46,105,109,112
+,114,101,115,115,105,111,110,38,108,116,59,98,114,38,103,116,59,108,105,116,101,
+114,97,116,117,114,101,112,111,112,117,108,97,116,105,111,110,98,103,99,111,108,
+111,114,61,34,35,101,115,112,101,99,105,97,108,108,121,32,99,111,110,116,101,110
+,116,61,34,112,114,111,100,117,99,116,105,111,110,110,101,119,115,108,101,116,
+116,101,114,112,114,111,112,101,114,116,105,101,115,100,101,102,105,110,105,116,
+105,111,110,108,101,97,100,101,114,115,104,105,112,84,101,99,104,110,111,108,111
+,103,121,80,97,114,108,105,97,109,101,110,116,99,111,109,112,97,114,105,115,111,
+110,117,108,32,99,108,97,115,115,61,34,46,105,110,100,101,120,79,102,40,34,99,
+111,110,99,108,117,115,105,111,110,100,105,115,99,117,115,115,105,111,110,99,111
+,109,112,111,110,101,110,116,115,98,105,111,108,111,103,105,99,97,108,82,101,118
+,111,108,117,116,105,111,110,95,99,111,110,116,97,105,110,101,114,117,110,100,
+101,114,115,116,111,111,100,110,111,115,99,114,105,112,116,62,60,112,101,114,109
+,105,115,115,105,111,110,101,97,99,104,32,111,116,104,101,114,97,116,109,111,115
+,112,104,101,114,101,32,111,110,102,111,99,117,115,61,34,60,102,111,114,109,32,
+105,100,61,34,112,114,111,99,101,115,115,105,110,103,116,104,105,115,46,118,97,
+108,117,101,103,101,110,101,114,97,116,105,111,110,67,111,110,102,101,114,101,
+110,99,101,115,117,98,115,101,113,117,101,110,116,119,101,108,108,45,107,110,111
+,119,110,118,97,114,105,97,116,105,111,110,115,114,101,112,117,116,97,116,105,
+111,110,112,104,101,110,111,109,101,110,111,110,100,105,115,99,105,112,108,105,
+110,101,108,111,103,111,46,112,110,103,34,32,40,100,111,99,117,109,101,110,116,
+44,98,111,117,110,100,97,114,105,101,115,101,120,112,114,101,115,115,105,111,110
+,115,101,116,116,108,101,109,101,110,116,66,97,99,107,103,114,111,117,110,100,
+111,117,116,32,111,102,32,116,104,101,101,110,116,101,114,112,114,105,115,101,40
+,34,104,116,116,112,115,58,34,32,117,110,101,115,99,97,112,101,40,34,112,97,115,
+115,119,111,114,100,34,32,100,101,109,111,99,114,97,116,105,99,60,97,32,104,114,
+101,102,61,34,47,119,114,97,112,112,101,114,34,62,10,109,101,109,98,101,114,115,
+104,105,112,108,105,110,103,117,105,115,116,105,99,112,120,59,112,97,100,100,105
+,110,103,112,104,105,108,111,115,111,112,104,121,97,115,115,105,115,116,97,110,
+99,101,117,110,105,118,101,114,115,105,116,121,102,97,99,105,108,105,116,105,101
+,115,114,101,99,111,103,110,105,122,101,100,112,114,101,102,101,114,101,110,99,
+101,105,102,32,40,116,121,112,101,111,102,109,97,105,110,116,97,105,110,101,100,
+118,111,99,97,98,117,108,97,114,121,104,121,112,111,116,104,101,115,105,115,46,
+115,117,98,109,105,116,40,41,59,38,97,109,112,59,110,98,115,112,59,97,110,110,
+111,116,97,116,105,111,110,98,101,104,105,110,100,32,116,104,101,70,111,117,110,
+100,97,116,105,111,110,112,117,98,108,105,115,104,101,114,34,97,115,115,117,109,
+112,116,105,111,110,105,110,116,114,111,100,117,99,101,100,99,111,114,114,117,
+112,116,105,111,110,115,99,105,101,110,116,105,115,116,115,101,120,112,108,105,
+99,105,116,108,121,105,110,115,116,101,97,100,32,111,102,100,105,109,101,110,115
+,105,111,110,115,32,111,110,67,108,105,99,107,61,34,99,111,110,115,105,100,101,
+114,101,100,100,101,112,97,114,116,109,101,110,116,111,99,99,117,112,97,116,105,
+111,110,115,111,111,110,32,97,102,116,101,114,105,110,118,101,115,116,109,101,
+110,116,112,114,111,110,111,117,110,99,101,100,105,100,101,110,116,105,102,105,
+101,100,101,120,112,101,114,105,109,101,110,116,77,97,110,97,103,101,109,101,110
+,116,103,101,111,103,114,97,112,104,105,99,34,32,104,101,105,103,104,116,61,34,
+108,105,110,107,32,114,101,108,61,34,46,114,101,112,108,97,99,101,40,47,100,101,
+112,114,101,115,115,105,111,110,99,111,110,102,101,114,101,110,99,101,112,117,
+110,105,115,104,109,101,110,116,101,108,105,109,105,110,97,116,101,100,114,101,
+115,105,115,116,97,110,99,101,97,100,97,112,116,97,116,105,111,110,111,112,112,
+111,115,105,116,105,111,110,119,101,108,108,32,107,110,111,119,110,115,117,112,
+112,108,101,109,101,110,116,100,101,116,101,114,109,105,110,101,100,104,49,32,99
+,108,97,115,115,61,34,48,112,120,59,109,97,114,103,105,110,109,101,99,104,97,110
+,105,99,97,108,115,116,97,116,105,115,116,105,99,115,99,101,108,101,98,114,97,
+116,101,100,71,111,118,101,114,110,109,101,110,116,10,10,68,117,114,105,110,103,
+32,116,100,101,118,101,108,111,112,101,114,115,97,114,116,105,102,105,99,105,97,
+108,101,113,117,105,118,97,108,101,110,116,111,114,105,103,105,110,97,116,101,
+100,67,111,109,109,105,115,115,105,111,110,97,116,116,97,99,104,109,101,110,116,
+60,115,112,97,110,32,105,100,61,34,116,104,101,114,101,32,119,101,114,101,78,101
+,100,101,114,108,97,110,100,115,98,101,121,111,110,100,32,116,104,101,114,101,
+103,105,115,116,101,114,101,100,106,111,117,114,110,97,108,105,115,116,102,114,
+101,113,117,101,110,116,108,121,97,108,108,32,111,102,32,116,104,101,108,97,110,
+103,61,34,101,110,34,32,60,47,115,116,121,108,101,62,13,10,97,98,115,111,108,117
+,116,101,59,32,115,117,112,112,111,114,116,105,110,103,101,120,116,114,101,109,
+101,108,121,32,109,97,105,110,115,116,114,101,97,109,60,47,115,116,114,111,110,
+103,62,32,112,111,112,117,108,97,114,105,116,121,101,109,112,108,111,121,109,101
+,110,116,60,47,116,97,98,108,101,62,13,10,32,99,111,108,115,112,97,110,61,34,60,
+47,102,111,114,109,62,10,32,32,99,111,110,118,101,114,115,105,111,110,97,98,111,
+117,116,32,116,104,101,32,60,47,112,62,60,47,100,105,118,62,105,110,116,101,103,
+114,97,116,101,100,34,32,108,97,110,103,61,34,101,110,80,111,114,116,117,103,117
+,101,115,101,115,117,98,115,116,105,116,117,116,101,105,110,100,105,118,105,100,
+117,97,108,105,109,112,111,115,115,105,98,108,101,109,117,108,116,105,109,101,
+100,105,97,97,108,109,111,115,116,32,97,108,108,112,120,32,115,111,108,105,100,
+32,35,97,112,97,114,116,32,102,114,111,109,115,117,98,106,101,99,116,32,116,111,
+105,110,32,69,110,103,108,105,115,104,99,114,105,116,105,99,105,122,101,100,101,
+120,99,101,112,116,32,102,111,114,103,117,105,100,101,108,105,110,101,115,111,
+114,105,103,105,110,97,108,108,121,114,101,109,97,114,107,97,98,108,101,116,104,
+101,32,115,101,99,111,110,100,104,50,32,99,108,97,115,115,61,34,60,97,32,116,105
+,116,108,101,61,34,40,105,110,99,108,117,100,105,110,103,112,97,114,97,109,101,
+116,101,114,115,112,114,111,104,105,98,105,116,101,100,61,32,34,104,116,116,112,
+58,47,47,100,105,99,116,105,111,110,97,114,121,112,101,114,99,101,112,116,105,
+111,110,114,101,118,111,108,117,116,105,111,110,102,111,117,110,100,97,116,105,
+111,110,112,120,59,104,101,105,103,104,116,58,115,117,99,99,101,115,115,102,117,
+108,115,117,112,112,111,114,116,101,114,115,109,105,108,108,101,110,110,105,117,
+109,104,105,115,32,102,97,116,104,101,114,116,104,101,32,38,113,117,111,116,59,
+110,111,45,114,101,112,101,97,116,59,99,111,109,109,101,114,99,105,97,108,105,
+110,100,117,115,116,114,105,97,108,101,110,99,111,117,114,97,103,101,100,97,109,
+111,117,110,116,32,111,102,32,117,110,111,102,102,105,99,105,97,108,101,102,102,
+105,99,105,101,110,99,121,82,101,102,101,114,101,110,99,101,115,99,111,111,114,
+100,105,110,97,116,101,100,105,115,99,108,97,105,109,101,114,101,120,112,101,100
+,105,116,105,111,110,100,101,118,101,108,111,112,105,110,103,99,97,108,99,117,
+108,97,116,101,100,115,105,109,112,108,105,102,105,101,100,108,101,103,105,116,
+105,109,97,116,101,115,117,98,115,116,114,105,110,103,40,48,34,32,99,108,97,115,
+115,61,34,99,111,109,112,108,101,116,101,108,121,105,108,108,117,115,116,114,97,
+116,101,102,105,118,101,32,121,101,97,114,115,105,110,115,116,114,117,109,101,
+110,116,80,117,98,108,105,115,104,105,110,103,49,34,32,99,108,97,115,115,61,34,
+112,115,121,99,104,111,108,111,103,121,99,111,110,102,105,100,101,110,99,101,110
+,117,109,98,101,114,32,111,102,32,97,98,115,101,110,99,101,32,111,102,102,111,99
+,117,115,101,100,32,111,110,106,111,105,110,101,100,32,116,104,101,115,116,114,
+117,99,116,117,114,101,115,112,114,101,118,105,111,117,115,108,121,62,60,47,105,
+102,114,97,109,101,62,111,110,99,101,32,97,103,97,105,110,98,117,116,32,114,97,
+116,104,101,114,105,109,109,105,103,114,97,110,116,115,111,102,32,99,111,117,114
+,115,101,44,97,32,103,114,111,117,112,32,111,102,76,105,116,101,114,97,116,117,
+114,101,85,110,108,105,107,101,32,116,104,101,60,47,97,62,38,110,98,115,112,59,
+10,102,117,110,99,116,105,111,110,32,105,116,32,119,97,115,32,116,104,101,67,111
+,110,118,101,110,116,105,111,110,97,117,116,111,109,111,98,105,108,101,80,114,
+111,116,101,115,116,97,110,116,97,103,103,114,101,115,115,105,118,101,97,102,116
+,101,114,32,116,104,101,32,83,105,109,105,108,97,114,108,121,44,34,32,47,62,60,
+47,100,105,118,62,99,111,108,108,101,99,116,105,111,110,13,10,102,117,110,99,116
+,105,111,110,118,105,115,105,98,105,108,105,116,121,116,104,101,32,117,115,101,
+32,111,102,118,111,108,117,110,116,101,101,114,115,97,116,116,114,97,99,116,105,
+111,110,117,110,100,101,114,32,116,104,101,32,116,104,114,101,97,116,101,110,101
+,100,42,60,33,91,67,68,65,84,65,91,105,109,112,111,114,116,97,110,99,101,105,110
+,32,103,101,110,101,114,97,108,116,104,101,32,108,97,116,116,101,114,60,47,102,
+111,114,109,62,10,60,47,46,105,110,100,101,120,79,102,40,39,105,32,61,32,48,59,
+32,105,32,60,100,105,102,102,101,114,101,110,99,101,100,101,118,111,116,101,100,
+32,116,111,116,114,97,100,105,116,105,111,110,115,115,101,97,114,99,104,32,102,
+111,114,117,108,116,105,109,97,116,101,108,121,116,111,117,114,110,97,109,101,
+110,116,97,116,116,114,105,98,117,116,101,115,115,111,45,99,97,108,108,101,100,
+32,125,10,60,47,115,116,121,108,101,62,101,118,97,108,117,97,116,105,111,110,101
+,109,112,104,97,115,105,122,101,100,97,99,99,101,115,115,105,98,108,101,60,47,
+115,101,99,116,105,111,110,62,115,117,99,99,101,115,115,105,111,110,97,108,111,
+110,103,32,119,105,116,104,77,101,97,110,119,104,105,108,101,44,105,110,100,117,
+115,116,114,105,101,115,60,47,97,62,60,98,114,32,47,62,104,97,115,32,98,101,99,
+111,109,101,97,115,112,101,99,116,115,32,111,102,84,101,108,101,118,105,115,105,
+111,110,115,117,102,102,105,99,105,101,110,116,98,97,115,107,101,116,98,97,108,
+108,98,111,116,104,32,115,105,100,101,115,99,111,110,116,105,110,117,105,110,103
+,97,110,32,97,114,116,105,99,108,101,60,105,109,103,32,97,108,116,61,34,97,100,
+118,101,110,116,117,114,101,115,104,105,115,32,109,111,116,104,101,114,109,97,
+110,99,104,101,115,116,101,114,112,114,105,110,99,105,112,108,101,115,112,97,114
+,116,105,99,117,108,97,114,99,111,109,109,101,110,116,97,114,121,101,102,102,101
+,99,116,115,32,111,102,100,101,99,105,100,101,100,32,116,111,34,62,60,115,116,
+114,111,110,103,62,112,117,98,108,105,115,104,101,114,115,74,111,117,114,110,97,
+108,32,111,102,100,105,102,102,105,99,117,108,116,121,102,97,99,105,108,105,116,
+97,116,101,97,99,99,101,112,116,97,98,108,101,115,116,121,108,101,46,99,115,115,
+34,9,102,117,110,99,116,105,111,110,32,105,110,110,111,118,97,116,105,111,110,62
+,67,111,112,121,114,105,103,104,116,115,105,116,117,97,116,105,111,110,115,119,
+111,117,108,100,32,104,97,118,101,98,117,115,105,110,101,115,115,101,115,68,105,
+99,116,105,111,110,97,114,121,115,116,97,116,101,109,101,110,116,115,111,102,116
+,101,110,32,117,115,101,100,112,101,114,115,105,115,116,101,110,116,105,110,32,
+74,97,110,117,97,114,121,99,111,109,112,114,105,115,105,110,103,60,47,116,105,
+116,108,101,62,10,9,100,105,112,108,111,109,97,116,105,99,99,111,110,116,97,105,
+110,105,110,103,112,101,114,102,111,114,109,105,110,103,101,120,116,101,110,115,
+105,111,110,115,109,97,121,32,110,111,116,32,98,101,99,111,110,99,101,112,116,32
+,111,102,32,111,110,99,108,105,99,107,61,34,73,116,32,105,115,32,97,108,115,111,
+102,105,110,97,110,99,105,97,108,32,109,97,107,105,110,103,32,116,104,101,76,117
+,120,101,109,98,111,117,114,103,97,100,100,105,116,105,111,110,97,108,97,114,101
+,32,99,97,108,108,101,100,101,110,103,97,103,101,100,32,105,110,34,115,99,114,
+105,112,116,34,41,59,98,117,116,32,105,116,32,119,97,115,101,108,101,99,116,114,
+111,110,105,99,111,110,115,117,98,109,105,116,61,34,10,60,33,45,45,32,69,110,100
+,32,101,108,101,99,116,114,105,99,97,108,111,102,102,105,99,105,97,108,108,121,
+115,117,103,103,101,115,116,105,111,110,116,111,112,32,111,102,32,116,104,101,
+117,110,108,105,107,101,32,116,104,101,65,117,115,116,114,97,108,105,97,110,79,
+114,105,103,105,110,97,108,108,121,114,101,102,101,114,101,110,99,101,115,10,60,
+47,104,101,97,100,62,13,10,114,101,99,111,103,110,105,115,101,100,105,110,105,
+116,105,97,108,105,122,101,108,105,109,105,116,101,100,32,116,111,65,108,101,120
+,97,110,100,114,105,97,114,101,116,105,114,101,109,101,110,116,65,100,118,101,
+110,116,117,114,101,115,102,111,117,114,32,121,101,97,114,115,10,10,38,108,116,
+59,33,45,45,32,105,110,99,114,101,97,115,105,110,103,100,101,99,111,114,97,116,
+105,111,110,104,51,32,99,108,97,115,115,61,34,111,114,105,103,105,110,115,32,111
+,102,111,98,108,105,103,97,116,105,111,110,114,101,103,117,108,97,116,105,111,
+110,99,108,97,115,115,105,102,105,101,100,40,102,117,110,99,116,105,111,110,40,
+97,100,118,97,110,116,97,103,101,115,98,101,105,110,103,32,116,104,101,32,104,
+105,115,116,111,114,105,97,110,115,60,98,97,115,101,32,104,114,101,102,114,101,
+112,101,97,116,101,100,108,121,119,105,108,108,105,110,103,32,116,111,99,111,109
+,112,97,114,97,98,108,101,100,101,115,105,103,110,97,116,101,100,110,111,109,105
+,110,97,116,105,111,110,102,117,110,99,116,105,111,110,97,108,105,110,115,105,
+100,101,32,116,104,101,114,101,118,101,108,97,116,105,111,110,101,110,100,32,111
+,102,32,116,104,101,115,32,102,111,114,32,116,104,101,32,97,117,116,104,111,114,
+105,122,101,100,114,101,102,117,115,101,100,32,116,111,116,97,107,101,32,112,108
+,97,99,101,97,117,116,111,110,111,109,111,117,115,99,111,109,112,114,111,109,105
+,115,101,112,111,108,105,116,105,99,97,108,32,114,101,115,116,97,117,114,97,110,
+116,116,119,111,32,111,102,32,116,104,101,70,101,98,114,117,97,114,121,32,50,113
+,117,97,108,105,116,121,32,111,102,115,119,102,111,98,106,101,99,116,46,117,110,
+100,101,114,115,116,97,110,100,110,101,97,114,108,121,32,97,108,108,119,114,105,
+116,116,101,110,32,98,121,105,110,116,101,114,118,105,101,119,115,34,32,119,105,
+100,116,104,61,34,49,119,105,116,104,100,114,97,119,97,108,102,108,111,97,116,58
+,108,101,102,116,105,115,32,117,115,117,97,108,108,121,99,97,110,100,105,100,97,
+116,101,115,110,101,119,115,112,97,112,101,114,115,109,121,115,116,101,114,105,
+111,117,115,68,101,112,97,114,116,109,101,110,116,98,101,115,116,32,107,110,111,
+119,110,112,97,114,108,105,97,109,101,110,116,115,117,112,112,114,101,115,115,
+101,100,99,111,110,118,101,110,105,101,110,116,114,101,109,101,109,98,101,114,
+101,100,100,105,102,102,101,114,101,110,116,32,115,121,115,116,101,109,97,116,
+105,99,104,97,115,32,108,101,100,32,116,111,112,114,111,112,97,103,97,110,100,97
+,99,111,110,116,114,111,108,108,101,100,105,110,102,108,117,101,110,99,101,115,
+99,101,114,101,109,111,110,105,97,108,112,114,111,99,108,97,105,109,101,100,80,
+114,111,116,101,99,116,105,111,110,108,105,32,99,108,97,115,115,61,34,83,99,105,
+101,110,116,105,102,105,99,99,108,97,115,115,61,34,110,111,45,116,114,97,100,101
+,109,97,114,107,115,109,111,114,101,32,116,104,97,110,32,119,105,100,101,115,112
+,114,101,97,100,76,105,98,101,114,97,116,105,111,110,116,111,111,107,32,112,108,
+97,99,101,100,97,121,32,111,102,32,116,104,101,97,115,32,108,111,110,103,32,97,
+115,105,109,112,114,105,115,111,110,101,100,65,100,100,105,116,105,111,110,97,
+108,10,60,104,101,97,100,62,10,60,109,76,97,98,111,114,97,116,111,114,121,78,111
+,118,101,109,98,101,114,32,50,101,120,99,101,112,116,105,111,110,115,73,110,100,
+117,115,116,114,105,97,108,118,97,114,105,101,116,121,32,111,102,102,108,111,97,
+116,58,32,108,101,102,68,117,114,105,110,103,32,116,104,101,97,115,115,101,115,
+115,109,101,110,116,104,97,118,101,32,98,101,101,110,32,100,101,97,108,115,32,
+119,105,116,104,83,116,97,116,105,115,116,105,99,115,111,99,99,117,114,114,101,
+110,99,101,47,117,108,62,60,47,100,105,118,62,99,108,101,97,114,102,105,120,34,
+62,116,104,101,32,112,117,98,108,105,99,109,97,110,121,32,121,101,97,114,115,119
+,104,105,99,104,32,119,101,114,101,111,118,101,114,32,116,105,109,101,44,115,121
+,110,111,110,121,109,111,117,115,99,111,110,116,101,110,116,34,62,10,112,114,101
+,115,117,109,97,98,108,121,104,105,115,32,102,97,109,105,108,121,117,115,101,114
+,65,103,101,110,116,46,117,110,101,120,112,101,99,116,101,100,105,110,99,108,117
+,100,105,110,103,32,99,104,97,108,108,101,110,103,101,100,97,32,109,105,110,111,
+114,105,116,121,117,110,100,101,102,105,110,101,100,34,98,101,108,111,110,103,
+115,32,116,111,116,97,107,101,110,32,102,114,111,109,105,110,32,79,99,116,111,98
+,101,114,112,111,115,105,116,105,111,110,58,32,115,97,105,100,32,116,111,32,98,
+101,114,101,108,105,103,105,111,117,115,32,70,101,100,101,114,97,116,105,111,110
+,32,114,111,119,115,112,97,110,61,34,111,110,108,121,32,97,32,102,101,119,109,
+101,97,110,116,32,116,104,97,116,108,101,100,32,116,111,32,116,104,101,45,45,62,
+13,10,60,100,105,118,32,60,102,105,101,108,100,115,101,116,62,65,114,99,104,98,
+105,115,104,111,112,32,99,108,97,115,115,61,34,110,111,98,101,105,110,103,32,117
+,115,101,100,97,112,112,114,111,97,99,104,101,115,112,114,105,118,105,108,101,
+103,101,115,110,111,115,99,114,105,112,116,62,10,114,101,115,117,108,116,115,32,
+105,110,109,97,121,32,98,101,32,116,104,101,69,97,115,116,101,114,32,101,103,103
+,109,101,99,104,97,110,105,115,109,115,114,101,97,115,111,110,97,98,108,101,80,
+111,112,117,108,97,116,105,111,110,67,111,108,108,101,99,116,105,111,110,115,101
+,108,101,99,116,101,100,34,62,110,111,115,99,114,105,112,116,62,13,47,105,110,
+100,101,120,46,112,104,112,97,114,114,105,118,97,108,32,111,102,45,106,115,115,
+100,107,39,41,41,59,109,97,110,97,103,101,100,32,116,111,105,110,99,111,109,112,
+108,101,116,101,99,97,115,117,97,108,116,105,101,115,99,111,109,112,108,101,116,
+105,111,110,67,104,114,105,115,116,105,97,110,115,83,101,112,116,101,109,98,101,
+114,32,97,114,105,116,104,109,101,116,105,99,112,114,111,99,101,100,117,114,101,
+115,109,105,103,104,116,32,104,97,118,101,80,114,111,100,117,99,116,105,111,110,
+105,116,32,97,112,112,101,97,114,115,80,104,105,108,111,115,111,112,104,121,102,
+114,105,101,110,100,115,104,105,112,108,101,97,100,105,110,103,32,116,111,103,
+105,118,105,110,103,32,116,104,101,116,111,119,97,114,100,32,116,104,101,103,117
+,97,114,97,110,116,101,101,100,100,111,99,117,109,101,110,116,101,100,99,111,108
+,111,114,58,35,48,48,48,118,105,100,101,111,32,103,97,109,101,99,111,109,109,105
+,115,115,105,111,110,114,101,102,108,101,99,116,105,110,103,99,104,97,110,103,
+101,32,116,104,101,97,115,115,111,99,105,97,116,101,100,115,97,110,115,45,115,
+101,114,105,102,111,110,107,101,121,112,114,101,115,115,59,32,112,97,100,100,105
+,110,103,58,72,101,32,119,97,115,32,116,104,101,117,110,100,101,114,108,121,105,
+110,103,116,121,112,105,99,97,108,108,121,32,44,32,97,110,100,32,116,104,101,32,
+115,114,99,69,108,101,109,101,110,116,115,117,99,99,101,115,115,105,118,101,115,
+105,110,99,101,32,116,104,101,32,115,104,111,117,108,100,32,98,101,32,110,101,
+116,119,111,114,107,105,110,103,97,99,99,111,117,110,116,105,110,103,117,115,101
+,32,111,102,32,116,104,101,108,111,119,101,114,32,116,104,97,110,115,104,111,119
+,115,32,116,104,97,116,60,47,115,112,97,110,62,10,9,9,99,111,109,112,108,97,105,
+110,116,115,99,111,110,116,105,110,117,111,117,115,113,117,97,110,116,105,116,
+105,101,115,97,115,116,114,111,110,111,109,101,114,104,101,32,100,105,100,32,110
+,111,116,100,117,101,32,116,111,32,105,116,115,97,112,112,108,105,101,100,32,116
+,111,97,110,32,97,118,101,114,97,103,101,101,102,102,111,114,116,115,32,116,111,
+116,104,101,32,102,117,116,117,114,101,97,116,116,101,109,112,116,32,116,111,84,
+104,101,114,101,102,111,114,101,44,99,97,112,97,98,105,108,105,116,121,82,101,
+112,117,98,108,105,99,97,110,119,97,115,32,102,111,114,109,101,100,69,108,101,99
+,116,114,111,110,105,99,107,105,108,111,109,101,116,101,114,115,99,104,97,108,
+108,101,110,103,101,115,112,117,98,108,105,115,104,105,110,103,116,104,101,32,
+102,111,114,109,101,114,105,110,100,105,103,101,110,111,117,115,100,105,114,101,
+99,116,105,111,110,115,115,117,98,115,105,100,105,97,114,121,99,111,110,115,112,
+105,114,97,99,121,100,101,116,97,105,108,115,32,111,102,97,110,100,32,105,110,32
+,116,104,101,97,102,102,111,114,100,97,98,108,101,115,117,98,115,116,97,110,99,
+101,115,114,101,97,115,111,110,32,102,111,114,99,111,110,118,101,110,116,105,111
+,110,105,116,101,109,116,121,112,101,61,34,97,98,115,111,108,117,116,101,108,121
+,115,117,112,112,111,115,101,100,108,121,114,101,109,97,105,110,101,100,32,97,97
+,116,116,114,97,99,116,105,118,101,116,114,97,118,101,108,108,105,110,103,115,
+101,112,97,114,97,116,101,108,121,102,111,99,117,115,101,115,32,111,110,101,108,
+101,109,101,110,116,97,114,121,97,112,112,108,105,99,97,98,108,101,102,111,117,
+110,100,32,116,104,97,116,115,116,121,108,101,115,104,101,101,116,109,97,110,117
+,115,99,114,105,112,116,115,116,97,110,100,115,32,102,111,114,32,110,111,45,114,
+101,112,101,97,116,40,115,111,109,101,116,105,109,101,115,67,111,109,109,101,114
+,99,105,97,108,105,110,32,65,109,101,114,105,99,97,117,110,100,101,114,116,97,
+107,101,110,113,117,97,114,116,101,114,32,111,102,97,110,32,101,120,97,109,112,
+108,101,112,101,114,115,111,110,97,108,108,121,105,110,100,101,120,46,112,104,
+112,63,60,47,98,117,116,116,111,110,62,10,112,101,114,99,101,110,116,97,103,101,
+98,101,115,116,45,107,110,111,119,110,99,114,101,97,116,105,110,103,32,97,34,32,
+100,105,114,61,34,108,116,114,76,105,101,117,116,101,110,97,110,116,10,60,100,
+105,118,32,105,100,61,34,116,104,101,121,32,119,111,117,108,100,97,98,105,108,
+105,116,121,32,111,102,109,97,100,101,32,117,112,32,111,102,110,111,116,101,100,
+32,116,104,97,116,99,108,101,97,114,32,116,104,97,116,97,114,103,117,101,32,116,
+104,97,116,116,111,32,97,110,111,116,104,101,114,99,104,105,108,100,114,101,110,
+39,115,112,117,114,112,111,115,101,32,111,102,102,111,114,109,117,108,97,116,101
+,100,98,97,115,101,100,32,117,112,111,110,116,104,101,32,114,101,103,105,111,110
+,115,117,98,106,101,99,116,32,111,102,112,97,115,115,101,110,103,101,114,115,112
+,111,115,115,101,115,115,105,111,110,46,10,10,73,110,32,116,104,101,32,66,101,
+102,111,114,101,32,116,104,101,97,102,116,101,114,119,97,114,100,115,99,117,114,
+114,101,110,116,108,121,32,97,99,114,111,115,115,32,116,104,101,115,99,105,101,
+110,116,105,102,105,99,99,111,109,109,117,110,105,116,121,46,99,97,112,105,116,
+97,108,105,115,109,105,110,32,71,101,114,109,97,110,121,114,105,103,104,116,45,
+119,105,110,103,116,104,101,32,115,121,115,116,101,109,83,111,99,105,101,116,121
+,32,111,102,112,111,108,105,116,105,99,105,97,110,100,105,114,101,99,116,105,111
+,110,58,119,101,110,116,32,111,110,32,116,111,114,101,109,111,118,97,108,32,111,
+102,32,78,101,119,32,89,111,114,107,32,97,112,97,114,116,109,101,110,116,115,105
+,110,100,105,99,97,116,105,111,110,100,117,114,105,110,103,32,116,104,101,117,
+110,108,101,115,115,32,116,104,101,104,105,115,116,111,114,105,99,97,108,104,97,
+100,32,98,101,101,110,32,97,100,101,102,105,110,105,116,105,118,101,105,110,103,
+114,101,100,105,101,110,116,97,116,116,101,110,100,97,110,99,101,67,101,110,116,
+101,114,32,102,111,114,112,114,111,109,105,110,101,110,99,101,114,101,97,100,121
+,83,116,97,116,101,115,116,114,97,116,101,103,105,101,115,98,117,116,32,105,110,
+32,116,104,101,97,115,32,112,97,114,116,32,111,102,99,111,110,115,116,105,116,
+117,116,101,99,108,97,105,109,32,116,104,97,116,108,97,98,111,114,97,116,111,114
+,121,99,111,109,112,97,116,105,98,108,101,102,97,105,108,117,114,101,32,111,102,
+44,32,115,117,99,104,32,97,115,32,98,101,103,97,110,32,119,105,116,104,117,115,
+105,110,103,32,116,104,101,32,116,111,32,112,114,111,118,105,100,101,102,101,97,
+116,117,114,101,32,111,102,102,114,111,109,32,119,104,105,99,104,47,34,32,99,108
+,97,115,115,61,34,103,101,111,108,111,103,105,99,97,108,115,101,118,101,114,97,
+108,32,111,102,100,101,108,105,98,101,114,97,116,101,105,109,112,111,114,116,97,
+110,116,32,104,111,108,100,115,32,116,104,97,116,105,110,103,38,113,117,111,116,
+59,32,118,97,108,105,103,110,61,116,111,112,116,104,101,32,71,101,114,109,97,110
+,111,117,116,115,105,100,101,32,111,102,110,101,103,111,116,105,97,116,101,100,
+104,105,115,32,99,97,114,101,101,114,115,101,112,97,114,97,116,105,111,110,105,
+100,61,34,115,101,97,114,99,104,119,97,115,32,99,97,108,108,101,100,116,104,101,
+32,102,111,117,114,116,104,114,101,99,114,101,97,116,105,111,110,111,116,104,101
+,114,32,116,104,97,110,112,114,101,118,101,110,116,105,111,110,119,104,105,108,
+101,32,116,104,101,32,101,100,117,99,97,116,105,111,110,44,99,111,110,110,101,99
+,116,105,110,103,97,99,99,117,114,97,116,101,108,121,119,101,114,101,32,98,117,
+105,108,116,119,97,115,32,107,105,108,108,101,100,97,103,114,101,101,109,101,110
+,116,115,109,117,99,104,32,109,111,114,101,32,68,117,101,32,116,111,32,116,104,
+101,119,105,100,116,104,58,32,49,48,48,115,111,109,101,32,111,116,104,101,114,75
+,105,110,103,100,111,109,32,111,102,116,104,101,32,101,110,116,105,114,101,102,
+97,109,111,117,115,32,102,111,114,116,111,32,99,111,110,110,101,99,116,111,98,
+106,101,99,116,105,118,101,115,116,104,101,32,70,114,101,110,99,104,112,101,111,
+112,108,101,32,97,110,100,102,101,97,116,117,114,101,100,34,62,105,115,32,115,97
+,105,100,32,116,111,115,116,114,117,99,116,117,114,97,108,114,101,102,101,114,
+101,110,100,117,109,109,111,115,116,32,111,102,116,101,110,97,32,115,101,112,97,
+114,97,116,101,45,62,10,60,100,105,118,32,105,100,32,79,102,102,105,99,105,97,
+108,32,119,111,114,108,100,119,105,100,101,46,97,114,105,97,45,108,97,98,101,108
+,116,104,101,32,112,108,97,110,101,116,97,110,100,32,105,116,32,119,97,115,100,
+34,32,118,97,108,117,101,61,34,108,111,111,107,105,110,103,32,97,116,98,101,110,
+101,102,105,99,105,97,108,97,114,101,32,105,110,32,116,104,101,109,111,110,105,
+116,111,114,105,110,103,114,101,112,111,114,116,101,100,108,121,116,104,101,32,
+109,111,100,101,114,110,119,111,114,107,105,110,103,32,111,110,97,108,108,111,
+119,101,100,32,116,111,119,104,101,114,101,32,116,104,101,32,105,110,110,111,118
+,97,116,105,118,101,60,47,97,62,60,47,100,105,118,62,115,111,117,110,100,116,114
+,97,99,107,115,101,97,114,99,104,70,111,114,109,116,101,110,100,32,116,111,32,98
+,101,105,110,112,117,116,32,105,100,61,34,111,112,101,110,105,110,103,32,111,102
+,114,101,115,116,114,105,99,116,101,100,97,100,111,112,116,101,100,32,98,121,97,
+100,100,114,101,115,115,105,110,103,116,104,101,111,108,111,103,105,97,110,109,
+101,116,104,111,100,115,32,111,102,118,97,114,105,97,110,116,32,111,102,67,104,
+114,105,115,116,105,97,110,32,118,101,114,121,32,108,97,114,103,101,97,117,116,
+111,109,111,116,105,118,101,98,121,32,102,97,114,32,116,104,101,114,97,110,103,
+101,32,102,114,111,109,112,117,114,115,117,105,116,32,111,102,102,111,108,108,
+111,119,32,116,104,101,98,114,111,117,103,104,116,32,116,111,105,110,32,69,110,
+103,108,97,110,100,97,103,114,101,101,32,116,104,97,116,97,99,99,117,115,101,100
+,32,111,102,99,111,109,101,115,32,102,114,111,109,112,114,101,118,101,110,116,
+105,110,103,100,105,118,32,115,116,121,108,101,61,104,105,115,32,111,114,32,104,
+101,114,116,114,101,109,101,110,100,111,117,115,102,114,101,101,100,111,109,32,
+111,102,99,111,110,99,101,114,110,105,110,103,48,32,49,101,109,32,49,101,109,59,
+66,97,115,107,101,116,98,97,108,108,47,115,116,121,108,101,46,99,115,115,97,110,
+32,101,97,114,108,105,101,114,101,118,101,110,32,97,102,116,101,114,47,34,32,116
+,105,116,108,101,61,34,46,99,111,109,47,105,110,100,101,120,116,97,107,105,110,
+103,32,116,104,101,112,105,116,116,115,98,117,114,103,104,99,111,110,116,101,110
+,116,34,62,13,60,115,99,114,105,112,116,62,40,102,116,117,114,110,101,100,32,111
+,117,116,104,97,118,105,110,103,32,116,104,101,60,47,115,112,97,110,62,13,10,32,
+111,99,99,97,115,105,111,110,97,108,98,101,99,97,117,115,101,32,105,116,115,116,
+97,114,116,101,100,32,116,111,112,104,121,115,105,99,97,108,108,121,62,60,47,100
+,105,118,62,10,32,32,99,114,101,97,116,101,100,32,98,121,67,117,114,114,101,110,
+116,108,121,44,32,98,103,99,111,108,111,114,61,34,116,97,98,105,110,100,101,120,
+61,34,100,105,115,97,115,116,114,111,117,115,65,110,97,108,121,116,105,99,115,32
+,97,108,115,111,32,104,97,115,32,97,62,60,100,105,118,32,105,100,61,34,60,47,115
+,116,121,108,101,62,10,60,99,97,108,108,101,100,32,102,111,114,115,105,110,103,
+101,114,32,97,110,100,46,115,114,99,32,61,32,34,47,47,118,105,111,108,97,116,105
+,111,110,115,116,104,105,115,32,112,111,105,110,116,99,111,110,115,116,97,110,
+116,108,121,105,115,32,108,111,99,97,116,101,100,114,101,99,111,114,100,105,110,
+103,115,100,32,102,114,111,109,32,116,104,101,110,101,100,101,114,108,97,110,100
+,115,112,111,114,116,117,103,117,195,170,115,215,162,215,145,215,168,215,153,215
+,170,217,129,216,167,216,177,216,179,219,140,100,101,115,97,114,114,111,108,108,
+111,99,111,109,101,110,116,97,114,105,111,101,100,117,99,97,99,105,195,179,110,
+115,101,112,116,105,101,109,98,114,101,114,101,103,105,115,116,114,97,100,111,
+100,105,114,101,99,99,105,195,179,110,117,98,105,99,97,99,105,195,179,110,112,
+117,98,108,105,99,105,100,97,100,114,101,115,112,117,101,115,116,97,115,114,101,
+115,117,108,116,97,100,111,115,105,109,112,111,114,116,97,110,116,101,114,101,
+115,101,114,118,97,100,111,115,97,114,116,195,173,99,117,108,111,115,100,105,102
+,101,114,101,110,116,101,115,115,105,103,117,105,101,110,116,101,115,114,101,112
+,195,186,98,108,105,99,97,115,105,116,117,97,99,105,195,179,110,109,105,110,105,
+115,116,101,114,105,111,112,114,105,118,97,99,105,100,97,100,100,105,114,101,99,
+116,111,114,105,111,102,111,114,109,97,99,105,195,179,110,112,111,98,108,97,99,
+105,195,179,110,112,114,101,115,105,100,101,110,116,101,99,111,110,116,101,110,
+105,100,111,115,97,99,99,101,115,111,114,105,111,115,116,101,99,104,110,111,114,
+97,116,105,112,101,114,115,111,110,97,108,101,115,99,97,116,101,103,111,114,195,
+173,97,101,115,112,101,99,105,97,108,101,115,100,105,115,112,111,110,105,98,108,
+101,97,99,116,117,97,108,105,100,97,100,114,101,102,101,114,101,110,99,105,97,
+118,97,108,108,97,100,111,108,105,100,98,105,98,108,105,111,116,101,99,97,114,
+101,108,97,99,105,111,110,101,115,99,97,108,101,110,100,97,114,105,111,112,111,
+108,195,173,116,105,99,97,115,97,110,116,101,114,105,111,114,101,115,100,111,99,
+117,109,101,110,116,111,115,110,97,116,117,114,97,108,101,122,97,109,97,116,101,
+114,105,97,108,101,115,100,105,102,101,114,101,110,99,105,97,101,99,111,110,195,
+179,109,105,99,97,116,114,97,110,115,112,111,114,116,101,114,111,100,114,195,173
+,103,117,101,122,112,97,114,116,105,99,105,112,97,114,101,110,99,117,101,110,116
+,114,97,110,100,105,115,99,117,115,105,195,179,110,101,115,116,114,117,99,116,
+117,114,97,102,117,110,100,97,99,105,195,179,110,102,114,101,99,117,101,110,116,
+101,115,112,101,114,109,97,110,101,110,116,101,116,111,116,97,108,109,101,110,
+116,101,208,188,208,190,208,182,208,189,208,190,208,177,209,131,208,180,208,181,
+209,130,208,188,208,190,208,182,208,181,209,130,208,178,209,128,208,181,208,188,
+209,143,209,130,208,176,208,186,208,182,208,181,209,135,209,130,208,190,208,177,
+209,139,208,177,208,190,208,187,208,181,208,181,208,190,209,135,208,181,208,189,
+209,140,209,141,209,130,208,190,208,179,208,190,208,186,208,190,208,179,208,180,
+208,176,208,191,208,190,209,129,208,187,208,181,208,178,209,129,208,181,208,179,
+208,190,209,129,208,176,208,185,209,130,208,181,209,135,208,181,209,128,208,181,
+208,183,208,188,208,190,208,179,209,131,209,130,209,129,208,176,208,185,209,130,
+208,176,208,182,208,184,208,183,208,189,208,184,208,188,208,181,208,182,208,180,
+209,131,208,177,209,131,208,180,209,131,209,130,208,159,208,190,208,184,209,129,
+208,186,208,183,208,180,208,181,209,129,209,140,208,178,208,184,208,180,208,181,
+208,190,209,129,208,178,209,143,208,183,208,184,208,189,209,131,208,182,208,189,
+208,190,209,129,208,178,208,190,208,181,208,185,208,187,209,142,208,180,208,181,
+208,185,208,191,208,190,209,128,208,189,208,190,208,188,208,189,208,190,208,179,
+208,190,208,180,208,181,209,130,208,181,208,185,209,129,208,178,208,190,208,184,
+209,133,208,191,209,128,208,176,208,178,208,176,209,130,208,176,208,186,208,190,
+208,185,208,188,208,181,209,129,209,130,208,190,208,184,208,188,208,181,208,181,
+209,130,208,182,208,184,208,183,208,189,209,140,208,190,208,180,208,189,208,190,
+208,185,208,187,209,131,209,135,209,136,208,181,208,191,208,181,209,128,208,181,
+208,180,209,135,208,176,209,129,209,130,208,184,209,135,208,176,209,129,209,130,
+209,140,209,128,208,176,208,177,208,190,209,130,208,189,208,190,208,178,209,139,
+209,133,208,191,209,128,208,176,208,178,208,190,209,129,208,190,208,177,208,190,
+208,185,208,191,208,190,209,130,208,190,208,188,208,188,208,181,208,189,208,181,
+208,181,209,135,208,184,209,129,208,187,208,181,208,189,208,190,208,178,209,139,
+208,181,209,131,209,129,208,187,209,131,208,179,208,190,208,186,208,190,208,187,
+208,190,208,189,208,176,208,183,208,176,208,180,209,130,208,176,208,186,208,190,
+208,181,209,130,208,190,208,179,208,180,208,176,208,191,208,190,209,135,209,130,
+208,184,208,159,208,190,209,129,208,187,208,181,209,130,208,176,208,186,208,184,
+208,181,208,189,208,190,208,178,209,139,208,185,209,129,209,130,208,190,208,184,
+209,130,209,130,208,176,208,186,208,184,209,133,209,129,209,128,208,176,208,183,
+209,131,208,161,208,176,208,189,208,186,209,130,209,132,208,190,209,128,209,131,
+208,188,208,154,208,190,208,179,208,180,208,176,208,186,208,189,208,184,208,179,
+208,184,209,129,208,187,208,190,208,178,208,176,208,189,208,176,209,136,208,181,
+208,185,208,189,208,176,208,185,209,130,208,184,209,129,208,178,208,190,208,184,
+208,188,209,129,208,178,209,143,208,183,209,140,208,187,209,142,208,177,208,190,
+208,185,209,135,208,176,209,129,209,130,208,190,209,129,209,128,208,181,208,180,
+208,184,208,154,209,128,208,190,208,188,208,181,208,164,208,190,209,128,209,131,
+208,188,209,128,209,139,208,189,208,186,208,181,209,129,209,130,208,176,208,187,
+208,184,208,191,208,190,208,184,209,129,208,186,209,130,209,139,209,129,209,143,
+209,135,208,188,208,181,209,129,209,143,209,134,209,134,208,181,208,189,209,130,
+209,128,209,130,209,128,209,131,208,180,208,176,209,129,208,176,208,188,209,139,
+209,133,209,128,209,139,208,189,208,186,208,176,208,157,208,190,208,178,209,139,
+208,185,209,135,208,176,209,129,208,190,208,178,208,188,208,181,209,129,209,130,
+208,176,209,132,208,184,208,187,209,140,208,188,208,188,208,176,209,128,209,130,
+208,176,209,129,209,130,209,128,208,176,208,189,208,188,208,181,209,129,209,130,
+208,181,209,130,208,181,208,186,209,129,209,130,208,189,208,176,209,136,208,184,
+209,133,208,188,208,184,208,189,209,131,209,130,208,184,208,188,208,181,208,189,
+208,184,208,184,208,188,208,181,209,142,209,130,208,189,208,190,208,188,208,181,
+209,128,208,179,208,190,209,128,208,190,208,180,209,129,208,176,208,188,208,190,
+208,188,209,141,209,130,208,190,208,188,209,131,208,186,208,190,208,189,209,134,
+208,181,209,129,208,178,208,190,208,181,208,188,208,186,208,176,208,186,208,190,
+208,185,208,144,209,128,209,133,208,184,208,178,217,133,217,134,216,170,216,175,
+217,137,216,165,216,177,216,179,216,167,217,132,216,177,216,179,216,167,217,132,
+216,169,216,167,217,132,216,185,216,167,217,133,217,131,216,170,216,168,217,135,
+216,167,216,168,216,177,216,167,217,133,216,172,216,167,217,132,217,138,217,136,
+217,133,216,167,217,132,216,181,217,136,216,177,216,172,216,175,217,138,216,175,
+216,169,216,167,217,132,216,185,216,182,217,136,216,165,216,182,216,167,217,129,
+216,169,216,167,217,132,217,130,216,179,217,133,216,167,217,132,216,185,216,167,
+216,168,216,170,216,173,217,133,217,138,217,132,217,133,217,132,217,129,216,167,
+216,170,217,133,217,132,216,170,217,130,217,137,216,170,216,185,216,175,217,138,
+217,132,216,167,217,132,216,180,216,185,216,177,216,163,216,174,216,168,216,167,
+216,177,216,170,216,183,217,136,217,138,216,177,216,185,217,132,217,138,217,131,
+217,133,216,165,216,177,217,129,216,167,217,130,216,183,217,132,216,168,216,167,
+216,170,216,167,217,132,217,132,216,186,216,169,216,170,216,177,216,170,217,138,
+216,168,216,167,217,132,217,134,216,167,216,179,216,167,217,132,216,180,217,138,
+216,174,217,133,217,134,216,170,216,175,217,138,216,167,217,132,216,185,216,177,
+216,168,216,167,217,132,217,130,216,181,216,181,216,167,217,129,217,132,216,167,
+217,133,216,185,217,132,217,138,217,135,216,167,216,170,216,173,216,175,217,138,
+216,171,216,167,217,132,217,132,217,135,217,133,216,167,217,132,216,185,217,133,
+217,132,217,133,217,131,216,170,216,168,216,169,217,138,217,133,217,131,217,134,
+217,131,216,167,217,132,216,183,217,129,217,132,217,129,217,138,216,175,217,138,
+217,136,216,165,216,175,216,167,216,177,216,169,216,170,216,167,216,177,217,138,
+216,174,216,167,217,132,216,181,216,173,216,169,216,170,216,179,216,172,217,138,
+217,132,216,167,217,132,217,136,217,130,216,170,216,185,217,134,216,175,217,133,
+216,167,217,133,216,175,217,138,217,134,216,169,216,170,216,181,217,133,217,138,
+217,133,216,163,216,177,216,180,217,138,217,129,216,167,217,132,216,176,217,138,
+217,134,216,185,216,177,216,168,217,138,216,169,216,168,217,136,216,167,216,168,
+216,169,216,163,217,132,216,185,216,167,216,168,216,167,217,132,216,179,217,129,
+216,177,217,133,216,180,216,167,217,131,217,132,216,170,216,185,216,167,217,132,
+217,137,216,167,217,132,216,163,217,136,217,132,216,167,217,132,216,179,217,134,
+216,169,216,172,216,167,217,133,216,185,216,169,216,167,217,132,216,181,216,173,
+217,129,216,167,217,132,216,175,217,138,217,134,217,131,217,132,217,133,216,167,
+216,170,216,167,217,132,216,174,216,167,216,181,216,167,217,132,217,133,217,132,
+217,129,216,163,216,185,216,182,216,167,216,161,217,131,216,170,216,167,216,168,
+216,169,216,167,217,132,216,174,217,138,216,177,216,177,216,179,216,167,216,166,
+217,132,216,167,217,132,217,130,217,132,216,168,216,167,217,132,216,163,216,175,
+216,168,217,133,217,130,216,167,216,183,216,185,217,133,216,177,216,167,216,179,
+217,132,217,133,217,134,216,183,217,130,216,169,216,167,217,132,217,131,216,170,
+216,168,216,167,217,132,216,177,216,172,217,132,216,167,216,180,216,170,216,177,
+217,131,216,167,217,132,217,130,216,175,217,133,217,138,216,185,216,183,217,138,
+217,131,115,66,121,84,97,103,78,97,109,101,40,46,106,112,103,34,32,97,108,116,61
+,34,49,112,120,32,115,111,108,105,100,32,35,46,103,105,102,34,32,97,108,116,61,
+34,116,114,97,110,115,112,97,114,101,110,116,105,110,102,111,114,109,97,116,105,
+111,110,97,112,112,108,105,99,97,116,105,111,110,34,32,111,110,99,108,105,99,107
+,61,34,101,115,116,97,98,108,105,115,104,101,100,97,100,118,101,114,116,105,115,
+105,110,103,46,112,110,103,34,32,97,108,116,61,34,101,110,118,105,114,111,110,
+109,101,110,116,112,101,114,102,111,114,109,97,110,99,101,97,112,112,114,111,112
+,114,105,97,116,101,38,97,109,112,59,109,100,97,115,104,59,105,109,109,101,100,
+105,97,116,101,108,121,60,47,115,116,114,111,110,103,62,60,47,114,97,116,104,101
+,114,32,116,104,97,110,116,101,109,112,101,114,97,116,117,114,101,100,101,118,
+101,108,111,112,109,101,110,116,99,111,109,112,101,116,105,116,105,111,110,112,
+108,97,99,101,104,111,108,100,101,114,118,105,115,105,98,105,108,105,116,121,58,
+99,111,112,121,114,105,103,104,116,34,62,48,34,32,104,101,105,103,104,116,61,34,
+101,118,101,110,32,116,104,111,117,103,104,114,101,112,108,97,99,101,109,101,110
+,116,100,101,115,116,105,110,97,116,105,111,110,67,111,114,112,111,114,97,116,
+105,111,110,60,117,108,32,99,108,97,115,115,61,34,65,115,115,111,99,105,97,116,
+105,111,110,105,110,100,105,118,105,100,117,97,108,115,112,101,114,115,112,101,
+99,116,105,118,101,115,101,116,84,105,109,101,111,117,116,40,117,114,108,40,104,
+116,116,112,58,47,47,109,97,116,104,101,109,97,116,105,99,115,109,97,114,103,105
+,110,45,116,111,112,58,101,118,101,110,116,117,97,108,108,121,32,100,101,115,99,
+114,105,112,116,105,111,110,41,32,110,111,45,114,101,112,101,97,116,99,111,108,
+108,101,99,116,105,111,110,115,46,74,80,71,124,116,104,117,109,98,124,112,97,114
+,116,105,99,105,112,97,116,101,47,104,101,97,100,62,60,98,111,100,121,102,108,
+111,97,116,58,108,101,102,116,59,60,108,105,32,99,108,97,115,115,61,34,104,117,
+110,100,114,101,100,115,32,111,102,10,10,72,111,119,101,118,101,114,44,32,99,111
+,109,112,111,115,105,116,105,111,110,99,108,101,97,114,58,98,111,116,104,59,99,
+111,111,112,101,114,97,116,105,111,110,119,105,116,104,105,110,32,116,104,101,32
+,108,97,98,101,108,32,102,111,114,61,34,98,111,114,100,101,114,45,116,111,112,58
+,78,101,119,32,90,101,97,108,97,110,100,114,101,99,111,109,109,101,110,100,101,
+100,112,104,111,116,111,103,114,97,112,104,121,105,110,116,101,114,101,115,116,
+105,110,103,38,108,116,59,115,117,112,38,103,116,59,99,111,110,116,114,111,118,
+101,114,115,121,78,101,116,104,101,114,108,97,110,100,115,97,108,116,101,114,110
+,97,116,105,118,101,109,97,120,108,101,110,103,116,104,61,34,115,119,105,116,122
+,101,114,108,97,110,100,68,101,118,101,108,111,112,109,101,110,116,101,115,115,
+101,110,116,105,97,108,108,121,10,10,65,108,116,104,111,117,103,104,32,60,47,116
+,101,120,116,97,114,101,97,62,116,104,117,110,100,101,114,98,105,114,100,114,101
+,112,114,101,115,101,110,116,101,100,38,97,109,112,59,110,100,97,115,104,59,115,
+112,101,99,117,108,97,116,105,111,110,99,111,109,109,117,110,105,116,105,101,115
+,108,101,103,105,115,108,97,116,105,111,110,101,108,101,99,116,114,111,110,105,
+99,115,10,9,60,100,105,118,32,105,100,61,34,105,108,108,117,115,116,114,97,116,
+101,100,101,110,103,105,110,101,101,114,105,110,103,116,101,114,114,105,116,111,
+114,105,101,115,97,117,116,104,111,114,105,116,105,101,115,100,105,115,116,114,
+105,98,117,116,101,100,54,34,32,104,101,105,103,104,116,61,34,115,97,110,115,45,
+115,101,114,105,102,59,99,97,112,97,98,108,101,32,111,102,32,100,105,115,97,112,
+112,101,97,114,101,100,105,110,116,101,114,97,99,116,105,118,101,108,111,111,107
+,105,110,103,32,102,111,114,105,116,32,119,111,117,108,100,32,98,101,65,102,103,
+104,97,110,105,115,116,97,110,119,97,115,32,99,114,101,97,116,101,100,77,97,116,
+104,46,102,108,111,111,114,40,115,117,114,114,111,117,110,100,105,110,103,99,97,
+110,32,97,108,115,111,32,98,101,111,98,115,101,114,118,97,116,105,111,110,109,97
+,105,110,116,101,110,97,110,99,101,101,110,99,111,117,110,116,101,114,101,100,60
+,104,50,32,99,108,97,115,115,61,34,109,111,114,101,32,114,101,99,101,110,116,105
+,116,32,104,97,115,32,98,101,101,110,105,110,118,97,115,105,111,110,32,111,102,
+41,46,103,101,116,84,105,109,101,40,41,102,117,110,100,97,109,101,110,116,97,108
+,68,101,115,112,105,116,101,32,116,104,101,34,62,60,100,105,118,32,105,100,61,34
+,105,110,115,112,105,114,97,116,105,111,110,101,120,97,109,105,110,97,116,105,
+111,110,112,114,101,112,97,114,97,116,105,111,110,101,120,112,108,97,110,97,116,
+105,111,110,60,105,110,112,117,116,32,105,100,61,34,60,47,97,62,60,47,115,112,97
+,110,62,118,101,114,115,105,111,110,115,32,111,102,105,110,115,116,114,117,109,
+101,110,116,115,98,101,102,111,114,101,32,116,104,101,32,32,61,32,39,104,116,116
+,112,58,47,47,68,101,115,99,114,105,112,116,105,111,110,114,101,108,97,116,105,
+118,101,108,121,32,46,115,117,98,115,116,114,105,110,103,40,101,97,99,104,32,111
+,102,32,116,104,101,101,120,112,101,114,105,109,101,110,116,115,105,110,102,108,
+117,101,110,116,105,97,108,105,110,116,101,103,114,97,116,105,111,110,109,97,110
+,121,32,112,101,111,112,108,101,100,117,101,32,116,111,32,116,104,101,32,99,111,
+109,98,105,110,97,116,105,111,110,100,111,32,110,111,116,32,104,97,118,101,77,
+105,100,100,108,101,32,69,97,115,116,60,110,111,115,99,114,105,112,116,62,60,99,
+111,112,121,114,105,103,104,116,34,32,112,101,114,104,97,112,115,32,116,104,101,
+105,110,115,116,105,116,117,116,105,111,110,105,110,32,68,101,99,101,109,98,101,
+114,97,114,114,97,110,103,101,109,101,110,116,109,111,115,116,32,102,97,109,111,
+117,115,112,101,114,115,111,110,97,108,105,116,121,99,114,101,97,116,105,111,110
+,32,111,102,108,105,109,105,116,97,116,105,111,110,115,101,120,99,108,117,115,
+105,118,101,108,121,115,111,118,101,114,101,105,103,110,116,121,45,99,111,110,
+116,101,110,116,34,62,10,60,116,100,32,99,108,97,115,115,61,34,117,110,100,101,
+114,103,114,111,117,110,100,112,97,114,97,108,108,101,108,32,116,111,100,111,99,
+116,114,105,110,101,32,111,102,111,99,99,117,112,105,101,100,32,98,121,116,101,
+114,109,105,110,111,108,111,103,121,82,101,110,97,105,115,115,97,110,99,101,97,
+32,110,117,109,98,101,114,32,111,102,115,117,112,112,111,114,116,32,102,111,114,
+101,120,112,108,111,114,97,116,105,111,110,114,101,99,111,103,110,105,116,105,
+111,110,112,114,101,100,101,99,101,115,115,111,114,60,105,109,103,32,115,114,99,
+61,34,47,60,104,49,32,99,108,97,115,115,61,34,112,117,98,108,105,99,97,116,105,
+111,110,109,97,121,32,97,108,115,111,32,98,101,115,112,101,99,105,97,108,105,122
+,101,100,60,47,102,105,101,108,100,115,101,116,62,112,114,111,103,114,101,115,
+115,105,118,101,109,105,108,108,105,111,110,115,32,111,102,115,116,97,116,101,
+115,32,116,104,97,116,101,110,102,111,114,99,101,109,101,110,116,97,114,111,117,
+110,100,32,116,104,101,32,111,110,101,32,97,110,111,116,104,101,114,46,112,97,
+114,101,110,116,78,111,100,101,97,103,114,105,99,117,108,116,117,114,101,65,108,
+116,101,114,110,97,116,105,118,101,114,101,115,101,97,114,99,104,101,114,115,116
+,111,119,97,114,100,115,32,116,104,101,77,111,115,116,32,111,102,32,116,104,101,
+109,97,110,121,32,111,116,104,101,114,32,40,101,115,112,101,99,105,97,108,108,
+121,60,116,100,32,119,105,100,116,104,61,34,59,119,105,100,116,104,58,49,48,48,
+37,105,110,100,101,112,101,110,100,101,110,116,60,104,51,32,99,108,97,115,115,61
+,34,32,111,110,99,104,97,110,103,101,61,34,41,46,97,100,100,67,108,97,115,115,40
+,105,110,116,101,114,97,99,116,105,111,110,79,110,101,32,111,102,32,116,104,101,
+32,100,97,117,103,104,116,101,114,32,111,102,97,99,99,101,115,115,111,114,105,
+101,115,98,114,97,110,99,104,101,115,32,111,102,13,10,60,100,105,118,32,105,100,
+61,34,116,104,101,32,108,97,114,103,101,115,116,100,101,99,108,97,114,97,116,105
+,111,110,114,101,103,117,108,97,116,105,111,110,115,73,110,102,111,114,109,97,
+116,105,111,110,116,114,97,110,115,108,97,116,105,111,110,100,111,99,117,109,101
+,110,116,97,114,121,105,110,32,111,114,100,101,114,32,116,111,34,62,10,60,104,
+101,97,100,62,10,60,34,32,104,101,105,103,104,116,61,34,49,97,99,114,111,115,115
+,32,116,104,101,32,111,114,105,101,110,116,97,116,105,111,110,41,59,60,47,115,99
+,114,105,112,116,62,105,109,112,108,101,109,101,110,116,101,100,99,97,110,32,98,
+101,32,115,101,101,110,116,104,101,114,101,32,119,97,115,32,97,100,101,109,111,
+110,115,116,114,97,116,101,99,111,110,116,97,105,110,101,114,34,62,99,111,110,
+110,101,99,116,105,111,110,115,116,104,101,32,66,114,105,116,105,115,104,119,97,
+115,32,119,114,105,116,116,101,110,33,105,109,112,111,114,116,97,110,116,59,112,
+120,59,32,109,97,114,103,105,110,45,102,111,108,108,111,119,101,100,32,98,121,97
+,98,105,108,105,116,121,32,116,111,32,99,111,109,112,108,105,99,97,116,101,100,
+100,117,114,105,110,103,32,116,104,101,32,105,109,109,105,103,114,97,116,105,111
+,110,97,108,115,111,32,99,97,108,108,101,100,60,104,52,32,99,108,97,115,115,61,
+34,100,105,115,116,105,110,99,116,105,111,110,114,101,112,108,97,99,101,100,32,
+98,121,103,111,118,101,114,110,109,101,110,116,115,108,111,99,97,116,105,111,110
+,32,111,102,105,110,32,78,111,118,101,109,98,101,114,119,104,101,116,104,101,114
+,32,116,104,101,60,47,112,62,10,60,47,100,105,118,62,97,99,113,117,105,115,105,
+116,105,111,110,99,97,108,108,101,100,32,116,104,101,32,112,101,114,115,101,99,
+117,116,105,111,110,100,101,115,105,103,110,97,116,105,111,110,123,102,111,110,
+116,45,115,105,122,101,58,97,112,112,101,97,114,101,100,32,105,110,105,110,118,
+101,115,116,105,103,97,116,101,101,120,112,101,114,105,101,110,99,101,100,109,
+111,115,116,32,108,105,107,101,108,121,119,105,100,101,108,121,32,117,115,101,
+100,100,105,115,99,117,115,115,105,111,110,115,112,114,101,115,101,110,99,101,32
+,111,102,32,40,100,111,99,117,109,101,110,116,46,101,120,116,101,110,115,105,118
+,101,108,121,73,116,32,104,97,115,32,98,101,101,110,105,116,32,100,111,101,115,
+32,110,111,116,99,111,110,116,114,97,114,121,32,116,111,105,110,104,97,98,105,
+116,97,110,116,115,105,109,112,114,111,118,101,109,101,110,116,115,99,104,111,
+108,97,114,115,104,105,112,99,111,110,115,117,109,112,116,105,111,110,105,110,
+115,116,114,117,99,116,105,111,110,102,111,114,32,101,120,97,109,112,108,101,111
+,110,101,32,111,114,32,109,111,114,101,112,120,59,32,112,97,100,100,105,110,103,
+116,104,101,32,99,117,114,114,101,110,116,97,32,115,101,114,105,101,115,32,111,
+102,97,114,101,32,117,115,117,97,108,108,121,114,111,108,101,32,105,110,32,116,
+104,101,112,114,101,118,105,111,117,115,108,121,32,100,101,114,105,118,97,116,
+105,118,101,115,101,118,105,100,101,110,99,101,32,111,102,101,120,112,101,114,
+105,101,110,99,101,115,99,111,108,111,114,115,99,104,101,109,101,115,116,97,116,
+101,100,32,116,104,97,116,99,101,114,116,105,102,105,99,97,116,101,60,47,97,62,
+60,47,100,105,118,62,10,32,115,101,108,101,99,116,101,100,61,34,104,105,103,104,
+32,115,99,104,111,111,108,114,101,115,112,111,110,115,101,32,116,111,99,111,109,
+102,111,114,116,97,98,108,101,97,100,111,112,116,105,111,110,32,111,102,116,104,
+114,101,101,32,121,101,97,114,115,116,104,101,32,99,111,117,110,116,114,121,105,
+110,32,70,101,98,114,117,97,114,121,115,111,32,116,104,97,116,32,116,104,101,112
+,101,111,112,108,101,32,119,104,111,32,112,114,111,118,105,100,101,100,32,98,121
+,60,112,97,114,97,109,32,110,97,109,101,97,102,102,101,99,116,101,100,32,98,121,
+105,110,32,116,101,114,109,115,32,111,102,97,112,112,111,105,110,116,109,101,110
+,116,73,83,79,45,56,56,53,57,45,49,34,119,97,115,32,98,111,114,110,32,105,110,
+104,105,115,116,111,114,105,99,97,108,32,114,101,103,97,114,100,101,100,32,97,
+115,109,101,97,115,117,114,101,109,101,110,116,105,115,32,98,97,115,101,100,32,
+111,110,32,97,110,100,32,111,116,104,101,114,32,58,32,102,117,110,99,116,105,111
+,110,40,115,105,103,110,105,102,105,99,97,110,116,99,101,108,101,98,114,97,116,
+105,111,110,116,114,97,110,115,109,105,116,116,101,100,47,106,115,47,106,113,117
+,101,114,121,46,105,115,32,107,110,111,119,110,32,97,115,116,104,101,111,114,101
+,116,105,99,97,108,32,116,97,98,105,110,100,101,120,61,34,105,116,32,99,111,117,
+108,100,32,98,101,60,110,111,115,99,114,105,112,116,62,10,104,97,118,105,110,103
+,32,98,101,101,110,13,10,60,104,101,97,100,62,13,10,60,32,38,113,117,111,116,59,
+84,104,101,32,99,111,109,112,105,108,97,116,105,111,110,104,101,32,104,97,100,32
+,98,101,101,110,112,114,111,100,117,99,101,100,32,98,121,112,104,105,108,111,115
+,111,112,104,101,114,99,111,110,115,116,114,117,99,116,101,100,105,110,116,101,
+110,100,101,100,32,116,111,97,109,111,110,103,32,111,116,104,101,114,99,111,109,
+112,97,114,101,100,32,116,111,116,111,32,115,97,121,32,116,104,97,116,69,110,103
+,105,110,101,101,114,105,110,103,97,32,100,105,102,102,101,114,101,110,116,114,
+101,102,101,114,114,101,100,32,116,111,100,105,102,102,101,114,101,110,99,101,
+115,98,101,108,105,101,102,32,116,104,97,116,112,104,111,116,111,103,114,97,112,
+104,115,105,100,101,110,116,105,102,121,105,110,103,72,105,115,116,111,114,121,
+32,111,102,32,82,101,112,117,98,108,105,99,32,111,102,110,101,99,101,115,115,97,
+114,105,108,121,112,114,111,98,97,98,105,108,105,116,121,116,101,99,104,110,105,
+99,97,108,108,121,108,101,97,118,105,110,103,32,116,104,101,115,112,101,99,116,
+97,99,117,108,97,114,102,114,97,99,116,105,111,110,32,111,102,101,108,101,99,116
+,114,105,99,105,116,121,104,101,97,100,32,111,102,32,116,104,101,114,101,115,116
+,97,117,114,97,110,116,115,112,97,114,116,110,101,114,115,104,105,112,101,109,
+112,104,97,115,105,115,32,111,110,109,111,115,116,32,114,101,99,101,110,116,115,
+104,97,114,101,32,119,105,116,104,32,115,97,121,105,110,103,32,116,104,97,116,
+102,105,108,108,101,100,32,119,105,116,104,100,101,115,105,103,110,101,100,32,
+116,111,105,116,32,105,115,32,111,102,116,101,110,34,62,60,47,105,102,114,97,109
+,101,62,97,115,32,102,111,108,108,111,119,115,58,109,101,114,103,101,100,32,119,
+105,116,104,116,104,114,111,117,103,104,32,116,104,101,99,111,109,109,101,114,99
+,105,97,108,32,112,111,105,110,116,101,100,32,111,117,116,111,112,112,111,114,
+116,117,110,105,116,121,118,105,101,119,32,111,102,32,116,104,101,114,101,113,
+117,105,114,101,109,101,110,116,100,105,118,105,115,105,111,110,32,111,102,112,
+114,111,103,114,97,109,109,105,110,103,104,101,32,114,101,99,101,105,118,101,100
+,115,101,116,73,110,116,101,114,118,97,108,34,62,60,47,115,112,97,110,62,60,47,
+105,110,32,78,101,119,32,89,111,114,107,97,100,100,105,116,105,111,110,97,108,32
+,99,111,109,112,114,101,115,115,105,111,110,10,10,60,100,105,118,32,105,100,61,
+34,105,110,99,111,114,112,111,114,97,116,101,59,60,47,115,99,114,105,112,116,62,
+60,97,116,116,97,99,104,69,118,101,110,116,98,101,99,97,109,101,32,116,104,101,
+32,34,32,116,97,114,103,101,116,61,34,95,99,97,114,114,105,101,100,32,111,117,
+116,83,111,109,101,32,111,102,32,116,104,101,115,99,105,101,110,99,101,32,97,110
+,100,116,104,101,32,116,105,109,101,32,111,102,67,111,110,116,97,105,110,101,114
+,34,62,109,97,105,110,116,97,105,110,105,110,103,67,104,114,105,115,116,111,112,
+104,101,114,77,117,99,104,32,111,102,32,116,104,101,119,114,105,116,105,110,103,
+115,32,111,102,34,32,104,101,105,103,104,116,61,34,50,115,105,122,101,32,111,102
+,32,116,104,101,118,101,114,115,105,111,110,32,111,102,32,109,105,120,116,117,
+114,101,32,111,102,32,98,101,116,119,101,101,110,32,116,104,101,69,120,97,109,
+112,108,101,115,32,111,102,101,100,117,99,97,116,105,111,110,97,108,99,111,109,
+112,101,116,105,116,105,118,101,32,111,110,115,117,98,109,105,116,61,34,100,105,
+114,101,99,116,111,114,32,111,102,100,105,115,116,105,110,99,116,105,118,101,47,
+68,84,68,32,88,72,84,77,76,32,114,101,108,97,116,105,110,103,32,116,111,116,101,
+110,100,101,110,99,121,32,116,111,112,114,111,118,105,110,99,101,32,111,102,119,
+104,105,99,104,32,119,111,117,108,100,100,101,115,112,105,116,101,32,116,104,101
+,115,99,105,101,110,116,105,102,105,99,32,108,101,103,105,115,108,97,116,117,114
+,101,46,105,110,110,101,114,72,84,77,76,32,97,108,108,101,103,97,116,105,111,110
+,115,65,103,114,105,99,117,108,116,117,114,101,119,97,115,32,117,115,101,100,32,
+105,110,97,112,112,114,111,97,99,104,32,116,111,105,110,116,101,108,108,105,103,
+101,110,116,121,101,97,114,115,32,108,97,116,101,114,44,115,97,110,115,45,115,
+101,114,105,102,100,101,116,101,114,109,105,110,105,110,103,80,101,114,102,111,
+114,109,97,110,99,101,97,112,112,101,97,114,97,110,99,101,115,44,32,119,104,105,
+99,104,32,105,115,32,102,111,117,110,100,97,116,105,111,110,115,97,98,98,114,101
+,118,105,97,116,101,100,104,105,103,104,101,114,32,116,104,97,110,115,32,102,114
+,111,109,32,116,104,101,32,105,110,100,105,118,105,100,117,97,108,32,99,111,109,
+112,111,115,101,100,32,111,102,115,117,112,112,111,115,101,100,32,116,111,99,108
+,97,105,109,115,32,116,104,97,116,97,116,116,114,105,98,117,116,105,111,110,102,
+111,110,116,45,115,105,122,101,58,49,101,108,101,109,101,110,116,115,32,111,102,
+72,105,115,116,111,114,105,99,97,108,32,104,105,115,32,98,114,111,116,104,101,
+114,97,116,32,116,104,101,32,116,105,109,101,97,110,110,105,118,101,114,115,97,
+114,121,103,111,118,101,114,110,101,100,32,98,121,114,101,108,97,116,101,100,32,
+116,111,32,117,108,116,105,109,97,116,101,108,121,32,105,110,110,111,118,97,116,
+105,111,110,115,105,116,32,105,115,32,115,116,105,108,108,99,97,110,32,111,110,
+108,121,32,98,101,100,101,102,105,110,105,116,105,111,110,115,116,111,71,77,84,
+83,116,114,105,110,103,65,32,110,117,109,98,101,114,32,111,102,105,109,103,32,99
+,108,97,115,115,61,34,69,118,101,110,116,117,97,108,108,121,44,119,97,115,32,99,
+104,97,110,103,101,100,111,99,99,117,114,114,101,100,32,105,110,110,101,105,103,
+104,98,111,114,105,110,103,100,105,115,116,105,110,103,117,105,115,104,119,104,
+101,110,32,104,101,32,119,97,115,105,110,116,114,111,100,117,99,105,110,103,116,
+101,114,114,101,115,116,114,105,97,108,77,97,110,121,32,111,102,32,116,104,101,
+97,114,103,117,101,115,32,116,104,97,116,97,110,32,65,109,101,114,105,99,97,110,
+99,111,110,113,117,101,115,116,32,111,102,119,105,100,101,115,112,114,101,97,100
+,32,119,101,114,101,32,107,105,108,108,101,100,115,99,114,101,101,110,32,97,110,
+100,32,73,110,32,111,114,100,101,114,32,116,111,101,120,112,101,99,116,101,100,
+32,116,111,100,101,115,99,101,110,100,97,110,116,115,97,114,101,32,108,111,99,97
+,116,101,100,108,101,103,105,115,108,97,116,105,118,101,103,101,110,101,114,97,
+116,105,111,110,115,32,98,97,99,107,103,114,111,117,110,100,109,111,115,116,32,
+112,101,111,112,108,101,121,101,97,114,115,32,97,102,116,101,114,116,104,101,114
+,101,32,105,115,32,110,111,116,104,101,32,104,105,103,104,101,115,116,102,114,
+101,113,117,101,110,116,108,121,32,116,104,101,121,32,100,111,32,110,111,116,97,
+114,103,117,101,100,32,116,104,97,116,115,104,111,119,101,100,32,116,104,97,116,
+112,114,101,100,111,109,105,110,97,110,116,116,104,101,111,108,111,103,105,99,97
+,108,98,121,32,116,104,101,32,116,105,109,101,99,111,110,115,105,100,101,114,105
+,110,103,115,104,111,114,116,45,108,105,118,101,100,60,47,115,112,97,110,62,60,
+47,97,62,99,97,110,32,98,101,32,117,115,101,100,118,101,114,121,32,108,105,116,
+116,108,101,111,110,101,32,111,102,32,116,104,101,32,104,97,100,32,97,108,114,
+101,97,100,121,105,110,116,101,114,112,114,101,116,101,100,99,111,109,109,117,
+110,105,99,97,116,101,102,101,97,116,117,114,101,115,32,111,102,103,111,118,101,
+114,110,109,101,110,116,44,60,47,110,111,115,99,114,105,112,116,62,101,110,116,
+101,114,101,100,32,116,104,101,34,32,104,101,105,103,104,116,61,34,51,73,110,100
+,101,112,101,110,100,101,110,116,112,111,112,117,108,97,116,105,111,110,115,108,
+97,114,103,101,45,115,99,97,108,101,46,32,65,108,116,104,111,117,103,104,32,117,
+115,101,100,32,105,110,32,116,104,101,100,101,115,116,114,117,99,116,105,111,110
+,112,111,115,115,105,98,105,108,105,116,121,115,116,97,114,116,105,110,103,32,
+105,110,116,119,111,32,111,114,32,109,111,114,101,101,120,112,114,101,115,115,
+105,111,110,115,115,117,98,111,114,100,105,110,97,116,101,108,97,114,103,101,114
+,32,116,104,97,110,104,105,115,116,111,114,121,32,97,110,100,60,47,111,112,116,
+105,111,110,62,13,10,67,111,110,116,105,110,101,110,116,97,108,101,108,105,109,
+105,110,97,116,105,110,103,119,105,108,108,32,110,111,116,32,98,101,112,114,97,
+99,116,105,99,101,32,111,102,105,110,32,102,114,111,110,116,32,111,102,115,105,
+116,101,32,111,102,32,116,104,101,101,110,115,117,114,101,32,116,104,97,116,116,
+111,32,99,114,101,97,116,101,32,97,109,105,115,115,105,115,115,105,112,112,105,
+112,111,116,101,110,116,105,97,108,108,121,111,117,116,115,116,97,110,100,105,
+110,103,98,101,116,116,101,114,32,116,104,97,110,119,104,97,116,32,105,115,32,
+110,111,119,115,105,116,117,97,116,101,100,32,105,110,109,101,116,97,32,110,97,
+109,101,61,34,84,114,97,100,105,116,105,111,110,97,108,115,117,103,103,101,115,
+116,105,111,110,115,84,114,97,110,115,108,97,116,105,111,110,116,104,101,32,102,
+111,114,109,32,111,102,97,116,109,111,115,112,104,101,114,105,99,105,100,101,111
+,108,111,103,105,99,97,108,101,110,116,101,114,112,114,105,115,101,115,99,97,108
+,99,117,108,97,116,105,110,103,101,97,115,116,32,111,102,32,116,104,101,114,101,
+109,110,97,110,116,115,32,111,102,112,108,117,103,105,110,115,112,97,103,101,47,
+105,110,100,101,120,46,112,104,112,63,114,101,109,97,105,110,101,100,32,105,110,
+116,114,97,110,115,102,111,114,109,101,100,72,101,32,119,97,115,32,97,108,115,
+111,119,97,115,32,97,108,114,101,97,100,121,115,116,97,116,105,115,116,105,99,97
+,108,105,110,32,102,97,118,111,114,32,111,102,77,105,110,105,115,116,114,121,32,
+111,102,109,111,118,101,109,101,110,116,32,111,102,102,111,114,109,117,108,97,
+116,105,111,110,105,115,32,114,101,113,117,105,114,101,100,60,108,105,110,107,32
+,114,101,108,61,34,84,104,105,115,32,105,115,32,116,104,101,32,60,97,32,104,114,
+101,102,61,34,47,112,111,112,117,108,97,114,105,122,101,100,105,110,118,111,108,
+118,101,100,32,105,110,97,114,101,32,117,115,101,100,32,116,111,97,110,100,32,
+115,101,118,101,114,97,108,109,97,100,101,32,98,121,32,116,104,101,115,101,101,
+109,115,32,116,111,32,98,101,108,105,107,101,108,121,32,116,104,97,116,80,97,108
+,101,115,116,105,110,105,97,110,110,97,109,101,100,32,97,102,116,101,114,105,116
+,32,104,97,100,32,98,101,101,110,109,111,115,116,32,99,111,109,109,111,110,116,
+111,32,114,101,102,101,114,32,116,111,98,117,116,32,116,104,105,115,32,105,115,
+99,111,110,115,101,99,117,116,105,118,101,116,101,109,112,111,114,97,114,105,108
+,121,73,110,32,103,101,110,101,114,97,108,44,99,111,110,118,101,110,116,105,111,
+110,115,116,97,107,101,115,32,112,108,97,99,101,115,117,98,100,105,118,105,115,
+105,111,110,116,101,114,114,105,116,111,114,105,97,108,111,112,101,114,97,116,
+105,111,110,97,108,112,101,114,109,97,110,101,110,116,108,121,119,97,115,32,108,
+97,114,103,101,108,121,111,117,116,98,114,101,97,107,32,111,102,105,110,32,116,
+104,101,32,112,97,115,116,102,111,108,108,111,119,105,110,103,32,97,32,120,109,
+108,110,115,58,111,103,61,34,62,60,97,32,99,108,97,115,115,61,34,99,108,97,115,
+115,61,34,116,101,120,116,67,111,110,118,101,114,115,105,111,110,32,109,97,121,
+32,98,101,32,117,115,101,100,109,97,110,117,102,97,99,116,117,114,101,97,102,116
+,101,114,32,98,101,105,110,103,99,108,101,97,114,102,105,120,34,62,10,113,117,
+101,115,116,105,111,110,32,111,102,119,97,115,32,101,108,101,99,116,101,100,116,
+111,32,98,101,99,111,109,101,32,97,98,101,99,97,117,115,101,32,111,102,32,115,
+111,109,101,32,112,101,111,112,108,101,105,110,115,112,105,114,101,100,32,98,121
+,115,117,99,99,101,115,115,102,117,108,32,97,32,116,105,109,101,32,119,104,101,
+110,109,111,114,101,32,99,111,109,109,111,110,97,109,111,110,103,115,116,32,116,
+104,101,97,110,32,111,102,102,105,99,105,97,108,119,105,100,116,104,58,49,48,48,
+37,59,116,101,99,104,110,111,108,111,103,121,44,119,97,115,32,97,100,111,112,116
+,101,100,116,111,32,107,101,101,112,32,116,104,101,115,101,116,116,108,101,109,
+101,110,116,115,108,105,118,101,32,98,105,114,116,104,115,105,110,100,101,120,46
+,104,116,109,108,34,67,111,110,110,101,99,116,105,99,117,116,97,115,115,105,103,
+110,101,100,32,116,111,38,97,109,112,59,116,105,109,101,115,59,97,99,99,111,117,
+110,116,32,102,111,114,97,108,105,103,110,61,114,105,103,104,116,116,104,101,32,
+99,111,109,112,97,110,121,97,108,119,97,121,115,32,98,101,101,110,114,101,116,
+117,114,110,101,100,32,116,111,105,110,118,111,108,118,101,109,101,110,116,66,
+101,99,97,117,115,101,32,116,104,101,116,104,105,115,32,112,101,114,105,111,100,
+34,32,110,97,109,101,61,34,113,34,32,99,111,110,102,105,110,101,100,32,116,111,
+97,32,114,101,115,117,108,116,32,111,102,118,97,108,117,101,61,34,34,32,47,62,
+105,115,32,97,99,116,117,97,108,108,121,69,110,118,105,114,111,110,109,101,110,
+116,13,10,60,47,104,101,97,100,62,13,10,67,111,110,118,101,114,115,101,108,121,
+44,62,10,60,100,105,118,32,105,100,61,34,48,34,32,119,105,100,116,104,61,34,49,
+105,115,32,112,114,111,98,97,98,108,121,104,97,118,101,32,98,101,99,111,109,101,
+99,111,110,116,114,111,108,108,105,110,103,116,104,101,32,112,114,111,98,108,101
+,109,99,105,116,105,122,101,110,115,32,111,102,112,111,108,105,116,105,99,105,97
+,110,115,114,101,97,99,104,101,100,32,116,104,101,97,115,32,101,97,114,108,121,
+32,97,115,58,110,111,110,101,59,32,111,118,101,114,60,116,97,98,108,101,32,99,
+101,108,108,118,97,108,105,100,105,116,121,32,111,102,100,105,114,101,99,116,108
+,121,32,116,111,111,110,109,111,117,115,101,100,111,119,110,119,104,101,114,101,
+32,105,116,32,105,115,119,104,101,110,32,105,116,32,119,97,115,109,101,109,98,
+101,114,115,32,111,102,32,114,101,108,97,116,105,111,110,32,116,111,97,99,99,111
+,109,109,111,100,97,116,101,97,108,111,110,103,32,119,105,116,104,32,73,110,32,
+116,104,101,32,108,97,116,101,116,104,101,32,69,110,103,108,105,115,104,100,101,
+108,105,99,105,111,117,115,34,62,116,104,105,115,32,105,115,32,110,111,116,116,
+104,101,32,112,114,101,115,101,110,116,105,102,32,116,104,101,121,32,97,114,101,
+97,110,100,32,102,105,110,97,108,108,121,97,32,109,97,116,116,101,114,32,111,102
+,13,10,9,60,47,100,105,118,62,13,10,13,10,60,47,115,99,114,105,112,116,62,102,97
+,115,116,101,114,32,116,104,97,110,109,97,106,111,114,105,116,121,32,111,102,97,
+102,116,101,114,32,119,104,105,99,104,99,111,109,112,97,114,97,116,105,118,101,
+116,111,32,109,97,105,110,116,97,105,110,105,109,112,114,111,118,101,32,116,104,
+101,97,119,97,114,100,101,100,32,116,104,101,101,114,34,32,99,108,97,115,115,61,
+34,102,114,97,109,101,98,111,114,100,101,114,114,101,115,116,111,114,97,116,105,
+111,110,105,110,32,116,104,101,32,115,97,109,101,97,110,97,108,121,115,105,115,
+32,111,102,116,104,101,105,114,32,102,105,114,115,116,68,117,114,105,110,103,32,
+116,104,101,32,99,111,110,116,105,110,101,110,116,97,108,115,101,113,117,101,110
+,99,101,32,111,102,102,117,110,99,116,105,111,110,40,41,123,102,111,110,116,45,
+115,105,122,101,58,32,119,111,114,107,32,111,110,32,116,104,101,60,47,115,99,114
+,105,112,116,62,10,60,98,101,103,105,110,115,32,119,105,116,104,106,97,118,97,
+115,99,114,105,112,116,58,99,111,110,115,116,105,116,117,101,110,116,119,97,115,
+32,102,111,117,110,100,101,100,101,113,117,105,108,105,98,114,105,117,109,97,115
+,115,117,109,101,32,116,104,97,116,105,115,32,103,105,118,101,110,32,98,121,110,
+101,101,100,115,32,116,111,32,98,101,99,111,111,114,100,105,110,97,116,101,115,
+116,104,101,32,118,97,114,105,111,117,115,97,114,101,32,112,97,114,116,32,111,
+102,111,110,108,121,32,105,110,32,116,104,101,115,101,99,116,105,111,110,115,32,
+111,102,105,115,32,97,32,99,111,109,109,111,110,116,104,101,111,114,105,101,115,
+32,111,102,100,105,115,99,111,118,101,114,105,101,115,97,115,115,111,99,105,97,
+116,105,111,110,101,100,103,101,32,111,102,32,116,104,101,115,116,114,101,110,
+103,116,104,32,111,102,112,111,115,105,116,105,111,110,32,105,110,112,114,101,
+115,101,110,116,45,100,97,121,117,110,105,118,101,114,115,97,108,108,121,116,111
+,32,102,111,114,109,32,116,104,101,98,117,116,32,105,110,115,116,101,97,100,99,
+111,114,112,111,114,97,116,105,111,110,97,116,116,97,99,104,101,100,32,116,111,
+105,115,32,99,111,109,109,111,110,108,121,114,101,97,115,111,110,115,32,102,111,
+114,32,38,113,117,111,116,59,116,104,101,32,99,97,110,32,98,101,32,109,97,100,
+101,119,97,115,32,97,98,108,101,32,116,111,119,104,105,99,104,32,109,101,97,110,
+115,98,117,116,32,100,105,100,32,110,111,116,111,110,77,111,117,115,101,79,118,
+101,114,97,115,32,112,111,115,115,105,98,108,101,111,112,101,114,97,116,101,100,
+32,98,121,99,111,109,105,110,103,32,102,114,111,109,116,104,101,32,112,114,105,
+109,97,114,121,97,100,100,105,116,105,111,110,32,111,102,102,111,114,32,115,101,
+118,101,114,97,108,116,114,97,110,115,102,101,114,114,101,100,97,32,112,101,114,
+105,111,100,32,111,102,97,114,101,32,97,98,108,101,32,116,111,104,111,119,101,
+118,101,114,44,32,105,116,115,104,111,117,108,100,32,104,97,118,101,109,117,99,
+104,32,108,97,114,103,101,114,10,9,60,47,115,99,114,105,112,116,62,97,100,111,
+112,116,101,100,32,116,104,101,112,114,111,112,101,114,116,121,32,111,102,100,
+105,114,101,99,116,101,100,32,98,121,101,102,102,101,99,116,105,118,101,108,121,
+119,97,115,32,98,114,111,117,103,104,116,99,104,105,108,100,114,101,110,32,111,
+102,80,114,111,103,114,97,109,109,105,110,103,108,111,110,103,101,114,32,116,104
+,97,110,109,97,110,117,115,99,114,105,112,116,115,119,97,114,32,97,103,97,105,
+110,115,116,98,121,32,109,101,97,110,115,32,111,102,97,110,100,32,109,111,115,
+116,32,111,102,115,105,109,105,108,97,114,32,116,111,32,112,114,111,112,114,105,
+101,116,97,114,121,111,114,105,103,105,110,97,116,105,110,103,112,114,101,115,
+116,105,103,105,111,117,115,103,114,97,109,109,97,116,105,99,97,108,101,120,112,
+101,114,105,101,110,99,101,46,116,111,32,109,97,107,101,32,116,104,101,73,116,32
+,119,97,115,32,97,108,115,111,105,115,32,102,111,117,110,100,32,105,110,99,111,
+109,112,101,116,105,116,111,114,115,105,110,32,116,104,101,32,85,46,83,46,114,
+101,112,108,97,99,101,32,116,104,101,98,114,111,117,103,104,116,32,116,104,101,
+99,97,108,99,117,108,97,116,105,111,110,102,97,108,108,32,111,102,32,116,104,101
+,116,104,101,32,103,101,110,101,114,97,108,112,114,97,99,116,105,99,97,108,108,
+121,105,110,32,104,111,110,111,114,32,111,102,114,101,108,101,97,115,101,100,32,
+105,110,114,101,115,105,100,101,110,116,105,97,108,97,110,100,32,115,111,109,101
+,32,111,102,107,105,110,103,32,111,102,32,116,104,101,114,101,97,99,116,105,111,
+110,32,116,111,49,115,116,32,69,97,114,108,32,111,102,99,117,108,116,117,114,101
+,32,97,110,100,112,114,105,110,99,105,112,97,108,108,121,60,47,116,105,116,108,
+101,62,10,32,32,116,104,101,121,32,99,97,110,32,98,101,98,97,99,107,32,116,111,
+32,116,104,101,115,111,109,101,32,111,102,32,104,105,115,101,120,112,111,115,117
+,114,101,32,116,111,97,114,101,32,115,105,109,105,108,97,114,102,111,114,109,32,
+111,102,32,116,104,101,97,100,100,70,97,118,111,114,105,116,101,99,105,116,105,
+122,101,110,115,104,105,112,112,97,114,116,32,105,110,32,116,104,101,112,101,111
+,112,108,101,32,119,105,116,104,105,110,32,112,114,97,99,116,105,99,101,116,111,
+32,99,111,110,116,105,110,117,101,38,97,109,112,59,109,105,110,117,115,59,97,112
+,112,114,111,118,101,100,32,98,121,32,116,104,101,32,102,105,114,115,116,32,97,
+108,108,111,119,101,100,32,116,104,101,97,110,100,32,102,111,114,32,116,104,101,
+102,117,110,99,116,105,111,110,105,110,103,112,108,97,121,105,110,103,32,116,104
+,101,115,111,108,117,116,105,111,110,32,116,111,104,101,105,103,104,116,61,34,48
+,34,32,105,110,32,104,105,115,32,98,111,111,107,109,111,114,101,32,116,104,97,
+110,32,97,102,111,108,108,111,119,115,32,116,104,101,99,114,101,97,116,101,100,
+32,116,104,101,112,114,101,115,101,110,99,101,32,105,110,38,110,98,115,112,59,60
+,47,116,100,62,110,97,116,105,111,110,97,108,105,115,116,116,104,101,32,105,100,
+101,97,32,111,102,97,32,99,104,97,114,97,99,116,101,114,119,101,114,101,32,102,
+111,114,99,101,100,32,99,108,97,115,115,61,34,98,116,110,100,97,121,115,32,111,
+102,32,116,104,101,102,101,97,116,117,114,101,100,32,105,110,115,104,111,119,105
+,110,103,32,116,104,101,105,110,116,101,114,101,115,116,32,105,110,105,110,32,
+112,108,97,99,101,32,111,102,116,117,114,110,32,111,102,32,116,104,101,116,104,
+101,32,104,101,97,100,32,111,102,76,111,114,100,32,111,102,32,116,104,101,112,
+111,108,105,116,105,99,97,108,108,121,104,97,115,32,105,116,115,32,111,119,110,
+69,100,117,99,97,116,105,111,110,97,108,97,112,112,114,111,118,97,108,32,111,102
+,115,111,109,101,32,111,102,32,116,104,101,101,97,99,104,32,111,116,104,101,114,
+44,98,101,104,97,118,105,111,114,32,111,102,97,110,100,32,98,101,99,97,117,115,
+101,97,110,100,32,97,110,111,116,104,101,114,97,112,112,101,97,114,101,100,32,
+111,110,114,101,99,111,114,100,101,100,32,105,110,98,108,97,99,107,38,113,117,
+111,116,59,109,97,121,32,105,110,99,108,117,100,101,116,104,101,32,119,111,114,
+108,100,39,115,99,97,110,32,108,101,97,100,32,116,111,114,101,102,101,114,115,32
+,116,111,32,97,98,111,114,100,101,114,61,34,48,34,32,103,111,118,101,114,110,109
+,101,110,116,32,119,105,110,110,105,110,103,32,116,104,101,114,101,115,117,108,
+116,101,100,32,105,110,32,119,104,105,108,101,32,116,104,101,32,87,97,115,104,
+105,110,103,116,111,110,44,116,104,101,32,115,117,98,106,101,99,116,99,105,116,
+121,32,105,110,32,116,104,101,62,60,47,100,105,118,62,13,10,9,9,114,101,102,108,
+101,99,116,32,116,104,101,116,111,32,99,111,109,112,108,101,116,101,98,101,99,97
+,109,101,32,109,111,114,101,114,97,100,105,111,97,99,116,105,118,101,114,101,106
+,101,99,116,101,100,32,98,121,119,105,116,104,111,117,116,32,97,110,121,104,105,
+115,32,102,97,116,104,101,114,44,119,104,105,99,104,32,99,111,117,108,100,99,111
+,112,121,32,111,102,32,116,104,101,116,111,32,105,110,100,105,99,97,116,101,97,
+32,112,111,108,105,116,105,99,97,108,97,99,99,111,117,110,116,115,32,111,102,99,
+111,110,115,116,105,116,117,116,101,115,119,111,114,107,101,100,32,119,105,116,
+104,101,114,60,47,97,62,60,47,108,105,62,111,102,32,104,105,115,32,108,105,102,
+101,97,99,99,111,109,112,97,110,105,101,100,99,108,105,101,110,116,87,105,100,
+116,104,112,114,101,118,101,110,116,32,116,104,101,76,101,103,105,115,108,97,116
+,105,118,101,100,105,102,102,101,114,101,110,116,108,121,116,111,103,101,116,104
+,101,114,32,105,110,104,97,115,32,115,101,118,101,114,97,108,102,111,114,32,97,
+110,111,116,104,101,114,116,101,120,116,32,111,102,32,116,104,101,102,111,117,
+110,100,101,100,32,116,104,101,101,32,119,105,116,104,32,116,104,101,32,105,115,
+32,117,115,101,100,32,102,111,114,99,104,97,110,103,101,100,32,116,104,101,117,
+115,117,97,108,108,121,32,116,104,101,112,108,97,99,101,32,119,104,101,114,101,
+119,104,101,114,101,97,115,32,116,104,101,62,32,60,97,32,104,114,101,102,61,34,
+34,62,60,97,32,104,114,101,102,61,34,116,104,101,109,115,101,108,118,101,115,44,
+97,108,116,104,111,117,103,104,32,104,101,116,104,97,116,32,99,97,110,32,98,101,
+116,114,97,100,105,116,105,111,110,97,108,114,111,108,101,32,111,102,32,116,104,
+101,97,115,32,97,32,114,101,115,117,108,116,114,101,109,111,118,101,67,104,105,
+108,100,100,101,115,105,103,110,101,100,32,98,121,119,101,115,116,32,111,102,32,
+116,104,101,83,111,109,101,32,112,101,111,112,108,101,112,114,111,100,117,99,116
+,105,111,110,44,115,105,100,101,32,111,102,32,116,104,101,110,101,119,115,108,
+101,116,116,101,114,115,117,115,101,100,32,98,121,32,116,104,101,100,111,119,110
+,32,116,111,32,116,104,101,97,99,99,101,112,116,101,100,32,98,121,108,105,118,
+101,32,105,110,32,116,104,101,97,116,116,101,109,112,116,115,32,116,111,111,117,
+116,115,105,100,101,32,116,104,101,102,114,101,113,117,101,110,99,105,101,115,72
+,111,119,101,118,101,114,44,32,105,110,112,114,111,103,114,97,109,109,101,114,
+115,97,116,32,108,101,97,115,116,32,105,110,97,112,112,114,111,120,105,109,97,
+116,101,97,108,116,104,111,117,103,104,32,105,116,119,97,115,32,112,97,114,116,
+32,111,102,97,110,100,32,118,97,114,105,111,117,115,71,111,118,101,114,110,111,
+114,32,111,102,116,104,101,32,97,114,116,105,99,108,101,116,117,114,110,101,100,
+32,105,110,116,111,62,60,97,32,104,114,101,102,61,34,47,116,104,101,32,101,99,
+111,110,111,109,121,105,115,32,116,104,101,32,109,111,115,116,109,111,115,116,32
+,119,105,100,101,108,121,119,111,117,108,100,32,108,97,116,101,114,97,110,100,32
+,112,101,114,104,97,112,115,114,105,115,101,32,116,111,32,116,104,101,111,99,99,
+117,114,115,32,119,104,101,110,117,110,100,101,114,32,119,104,105,99,104,99,111,
+110,100,105,116,105,111,110,115,46,116,104,101,32,119,101,115,116,101,114,110,
+116,104,101,111,114,121,32,116,104,97,116,105,115,32,112,114,111,100,117,99,101,
+100,116,104,101,32,99,105,116,121,32,111,102,105,110,32,119,104,105,99,104,32,
+104,101,115,101,101,110,32,105,110,32,116,104,101,116,104,101,32,99,101,110,116,
+114,97,108,98,117,105,108,100,105,110,103,32,111,102,109,97,110,121,32,111,102,
+32,104,105,115,97,114,101,97,32,111,102,32,116,104,101,105,115,32,116,104,101,32
+,111,110,108,121,109,111,115,116,32,111,102,32,116,104,101,109,97,110,121,32,111
+,102,32,116,104,101,116,104,101,32,87,101,115,116,101,114,110,84,104,101,114,101
+,32,105,115,32,110,111,101,120,116,101,110,100,101,100,32,116,111,83,116,97,116,
+105,115,116,105,99,97,108,99,111,108,115,112,97,110,61,50,32,124,115,104,111,114
+,116,32,115,116,111,114,121,112,111,115,115,105,98,108,101,32,116,111,116,111,
+112,111,108,111,103,105,99,97,108,99,114,105,116,105,99,97,108,32,111,102,114,
+101,112,111,114,116,101,100,32,116,111,97,32,67,104,114,105,115,116,105,97,110,
+100,101,99,105,115,105,111,110,32,116,111,105,115,32,101,113,117,97,108,32,116,
+111,112,114,111,98,108,101,109,115,32,111,102,84,104,105,115,32,99,97,110,32,98,
+101,109,101,114,99,104,97,110,100,105,115,101,102,111,114,32,109,111,115,116,32,
+111,102,110,111,32,101,118,105,100,101,110,99,101,101,100,105,116,105,111,110,
+115,32,111,102,101,108,101,109,101,110,116,115,32,105,110,38,113,117,111,116,59,
+46,32,84,104,101,99,111,109,47,105,109,97,103,101,115,47,119,104,105,99,104,32,
+109,97,107,101,115,116,104,101,32,112,114,111,99,101,115,115,114,101,109,97,105,
+110,115,32,116,104,101,108,105,116,101,114,97,116,117,114,101,44,105,115,32,97,
+32,109,101,109,98,101,114,116,104,101,32,112,111,112,117,108,97,114,116,104,101,
+32,97,110,99,105,101,110,116,112,114,111,98,108,101,109,115,32,105,110,116,105,
+109,101,32,111,102,32,116,104,101,100,101,102,101,97,116,101,100,32,98,121,98,
+111,100,121,32,111,102,32,116,104,101,97,32,102,101,119,32,121,101,97,114,115,
+109,117,99,104,32,111,102,32,116,104,101,116,104,101,32,119,111,114,107,32,111,
+102,67,97,108,105,102,111,114,110,105,97,44,115,101,114,118,101,100,32,97,115,32
+,97,103,111,118,101,114,110,109,101,110,116,46,99,111,110,99,101,112,116,115,32,
+111,102,109,111,118,101,109,101,110,116,32,105,110,9,9,60,100,105,118,32,105,100
+,61,34,105,116,34,32,118,97,108,117,101,61,34,108,97,110,103,117,97,103,101,32,
+111,102,97,115,32,116,104,101,121,32,97,114,101,112,114,111,100,117,99,101,100,
+32,105,110,105,115,32,116,104,97,116,32,116,104,101,101,120,112,108,97,105,110,
+32,116,104,101,100,105,118,62,60,47,100,105,118,62,10,72,111,119,101,118,101,114
+,32,116,104,101,108,101,97,100,32,116,111,32,116,104,101,9,60,97,32,104,114,101,
+102,61,34,47,119,97,115,32,103,114,97,110,116,101,100,112,101,111,112,108,101,32
+,104,97,118,101,99,111,110,116,105,110,117,97,108,108,121,119,97,115,32,115,101,
+101,110,32,97,115,97,110,100,32,114,101,108,97,116,101,100,116,104,101,32,114,
+111,108,101,32,111,102,112,114,111,112,111,115,101,100,32,98,121,111,102,32,116,
+104,101,32,98,101,115,116,101,97,99,104,32,111,116,104,101,114,46,67,111,110,115
+,116,97,110,116,105,110,101,112,101,111,112,108,101,32,102,114,111,109,100,105,
+97,108,101,99,116,115,32,111,102,116,111,32,114,101,118,105,115,105,111,110,119,
+97,115,32,114,101,110,97,109,101,100,97,32,115,111,117,114,99,101,32,111,102,116
+,104,101,32,105,110,105,116,105,97,108,108,97,117,110,99,104,101,100,32,105,110,
+112,114,111,118,105,100,101,32,116,104,101,116,111,32,116,104,101,32,119,101,115
+,116,119,104,101,114,101,32,116,104,101,114,101,97,110,100,32,115,105,109,105,
+108,97,114,98,101,116,119,101,101,110,32,116,119,111,105,115,32,97,108,115,111,
+32,116,104,101,69,110,103,108,105,115,104,32,97,110,100,99,111,110,100,105,116,
+105,111,110,115,44,116,104,97,116,32,105,116,32,119,97,115,101,110,116,105,116,
+108,101,100,32,116,111,116,104,101,109,115,101,108,118,101,115,46,113,117,97,110
+,116,105,116,121,32,111,102,114,97,110,115,112,97,114,101,110,99,121,116,104,101
+,32,115,97,109,101,32,97,115,116,111,32,106,111,105,110,32,116,104,101,99,111,
+117,110,116,114,121,32,97,110,100,116,104,105,115,32,105,115,32,116,104,101,84,
+104,105,115,32,108,101,100,32,116,111,97,32,115,116,97,116,101,109,101,110,116,
+99,111,110,116,114,97,115,116,32,116,111,108,97,115,116,73,110,100,101,120,79,
+102,116,104,114,111,117,103,104,32,104,105,115,105,115,32,100,101,115,105,103,
+110,101,100,116,104,101,32,116,101,114,109,32,105,115,105,115,32,112,114,111,118
+,105,100,101,100,112,114,111,116,101,99,116,32,116,104,101,110,103,60,47,97,62,
+60,47,108,105,62,84,104,101,32,99,117,114,114,101,110,116,116,104,101,32,115,105
+,116,101,32,111,102,115,117,98,115,116,97,110,116,105,97,108,101,120,112,101,114
+,105,101,110,99,101,44,105,110,32,116,104,101,32,87,101,115,116,116,104,101,121,
+32,115,104,111,117,108,100,115,108,111,118,101,110,196,141,105,110,97,99,111,109
+,101,110,116,97,114,105,111,115,117,110,105,118,101,114,115,105,100,97,100,99,
+111,110,100,105,99,105,111,110,101,115,97,99,116,105,118,105,100,97,100,101,115,
+101,120,112,101,114,105,101,110,99,105,97,116,101,99,110,111,108,111,103,195,173
+,97,112,114,111,100,117,99,99,105,195,179,110,112,117,110,116,117,97,99,105,195,
+179,110,97,112,108,105,99,97,99,105,195,179,110,99,111,110,116,114,97,115,101,
+195,177,97,99,97,116,101,103,111,114,195,173,97,115,114,101,103,105,115,116,114,
+97,114,115,101,112,114,111,102,101,115,105,111,110,97,108,116,114,97,116,97,109,
+105,101,110,116,111,114,101,103,195,173,115,116,114,97,116,101,115,101,99,114,
+101,116,97,114,195,173,97,112,114,105,110,99,105,112,97,108,101,115,112,114,111,
+116,101,99,99,105,195,179,110,105,109,112,111,114,116,97,110,116,101,115,105,109
+,112,111,114,116,97,110,99,105,97,112,111,115,105,98,105,108,105,100,97,100,105,
+110,116,101,114,101,115,97,110,116,101,99,114,101,99,105,109,105,101,110,116,111
+,110,101,99,101,115,105,100,97,100,101,115,115,117,115,99,114,105,98,105,114,115
+,101,97,115,111,99,105,97,99,105,195,179,110,100,105,115,112,111,110,105,98,108,
+101,115,101,118,97,108,117,97,99,105,195,179,110,101,115,116,117,100,105,97,110,
+116,101,115,114,101,115,112,111,110,115,97,98,108,101,114,101,115,111,108,117,99
+,105,195,179,110,103,117,97,100,97,108,97,106,97,114,97,114,101,103,105,115,116,
+114,97,100,111,115,111,112,111,114,116,117,110,105,100,97,100,99,111,109,101,114
+,99,105,97,108,101,115,102,111,116,111,103,114,97,102,195,173,97,97,117,116,111,
+114,105,100,97,100,101,115,105,110,103,101,110,105,101,114,195,173,97,116,101,
+108,101,118,105,115,105,195,179,110,99,111,109,112,101,116,101,110,99,105,97,111
+,112,101,114,97,99,105,111,110,101,115,101,115,116,97,98,108,101,99,105,100,111,
+115,105,109,112,108,101,109,101,110,116,101,97,99,116,117,97,108,109,101,110,116
+,101,110,97,118,101,103,97,99,105,195,179,110,99,111,110,102,111,114,109,105,100
+,97,100,108,105,110,101,45,104,101,105,103,104,116,58,102,111,110,116,45,102,97,
+109,105,108,121,58,34,32,58,32,34,104,116,116,112,58,47,47,97,112,112,108,105,99
+,97,116,105,111,110,115,108,105,110,107,34,32,104,114,101,102,61,34,115,112,101,
+99,105,102,105,99,97,108,108,121,47,47,60,33,91,67,68,65,84,65,91,10,79,114,103,
+97,110,105,122,97,116,105,111,110,100,105,115,116,114,105,98,117,116,105,111,110
+,48,112,120,59,32,104,101,105,103,104,116,58,114,101,108,97,116,105,111,110,115,
+104,105,112,100,101,118,105,99,101,45,119,105,100,116,104,60,100,105,118,32,99,
+108,97,115,115,61,34,60,108,97,98,101,108,32,102,111,114,61,34,114,101,103,105,
+115,116,114,97,116,105,111,110,60,47,110,111,115,99,114,105,112,116,62,10,47,105
+,110,100,101,120,46,104,116,109,108,34,119,105,110,100,111,119,46,111,112,101,
+110,40,32,33,105,109,112,111,114,116,97,110,116,59,97,112,112,108,105,99,97,116,
+105,111,110,47,105,110,100,101,112,101,110,100,101,110,99,101,47,47,119,119,119,
+46,103,111,111,103,108,101,111,114,103,97,110,105,122,97,116,105,111,110,97,117,
+116,111,99,111,109,112,108,101,116,101,114,101,113,117,105,114,101,109,101,110,
+116,115,99,111,110,115,101,114,118,97,116,105,118,101,60,102,111,114,109,32,110,
+97,109,101,61,34,105,110,116,101,108,108,101,99,116,117,97,108,109,97,114,103,
+105,110,45,108,101,102,116,58,49,56,116,104,32,99,101,110,116,117,114,121,97,110
+,32,105,109,112,111,114,116,97,110,116,105,110,115,116,105,116,117,116,105,111,
+110,115,97,98,98,114,101,118,105,97,116,105,111,110,60,105,109,103,32,99,108,97,
+115,115,61,34,111,114,103,97,110,105,115,97,116,105,111,110,99,105,118,105,108,
+105,122,97,116,105,111,110,49,57,116,104,32,99,101,110,116,117,114,121,97,114,99
+,104,105,116,101,99,116,117,114,101,105,110,99,111,114,112,111,114,97,116,101,
+100,50,48,116,104,32,99,101,110,116,117,114,121,45,99,111,110,116,97,105,110,101
+,114,34,62,109,111,115,116,32,110,111,116,97,98,108,121,47,62,60,47,97,62,60,47,
+100,105,118,62,110,111,116,105,102,105,99,97,116,105,111,110,39,117,110,100,101,
+102,105,110,101,100,39,41,70,117,114,116,104,101,114,109,111,114,101,44,98,101,
+108,105,101,118,101,32,116,104,97,116,105,110,110,101,114,72,84,77,76,32,61,32,
+112,114,105,111,114,32,116,111,32,116,104,101,100,114,97,109,97,116,105,99,97,
+108,108,121,114,101,102,101,114,114,105,110,103,32,116,111,110,101,103,111,116,
+105,97,116,105,111,110,115,104,101,97,100,113,117,97,114,116,101,114,115,83,111,
+117,116,104,32,65,102,114,105,99,97,117,110,115,117,99,99,101,115,115,102,117,
+108,80,101,110,110,115,121,108,118,97,110,105,97,65,115,32,97,32,114,101,115,117
+,108,116,44,60,104,116,109,108,32,108,97,110,103,61,34,38,108,116,59,47,115,117,
+112,38,103,116,59,100,101,97,108,105,110,103,32,119,105,116,104,112,104,105,108,
+97,100,101,108,112,104,105,97,104,105,115,116,111,114,105,99,97,108,108,121,41,
+59,60,47,115,99,114,105,112,116,62,10,112,97,100,100,105,110,103,45,116,111,112,
+58,101,120,112,101,114,105,109,101,110,116,97,108,103,101,116,65,116,116,114,105
+,98,117,116,101,105,110,115,116,114,117,99,116,105,111,110,115,116,101,99,104,
+110,111,108,111,103,105,101,115,112,97,114,116,32,111,102,32,116,104,101,32,61,
+102,117,110,99,116,105,111,110,40,41,123,115,117,98,115,99,114,105,112,116,105,
+111,110,108,46,100,116,100,34,62,13,10,60,104,116,103,101,111,103,114,97,112,104
+,105,99,97,108,67,111,110,115,116,105,116,117,116,105,111,110,39,44,32,102,117,
+110,99,116,105,111,110,40,115,117,112,112,111,114,116,101,100,32,98,121,97,103,
+114,105,99,117,108,116,117,114,97,108,99,111,110,115,116,114,117,99,116,105,111,
+110,112,117,98,108,105,99,97,116,105,111,110,115,102,111,110,116,45,115,105,122,
+101,58,32,49,97,32,118,97,114,105,101,116,121,32,111,102,60,100,105,118,32,115,
+116,121,108,101,61,34,69,110,99,121,99,108,111,112,101,100,105,97,105,102,114,97
+,109,101,32,115,114,99,61,34,100,101,109,111,110,115,116,114,97,116,101,100,97,
+99,99,111,109,112,108,105,115,104,101,100,117,110,105,118,101,114,115,105,116,
+105,101,115,68,101,109,111,103,114,97,112,104,105,99,115,41,59,60,47,115,99,114,
+105,112,116,62,60,100,101,100,105,99,97,116,101,100,32,116,111,107,110,111,119,
+108,101,100,103,101,32,111,102,115,97,116,105,115,102,97,99,116,105,111,110,112,
+97,114,116,105,99,117,108,97,114,108,121,60,47,100,105,118,62,60,47,100,105,118,
+62,69,110,103,108,105,115,104,32,40,85,83,41,97,112,112,101,110,100,67,104,105,
+108,100,40,116,114,97,110,115,109,105,115,115,105,111,110,115,46,32,72,111,119,
+101,118,101,114,44,32,105,110,116,101,108,108,105,103,101,110,99,101,34,32,116,
+97,98,105,110,100,101,120,61,34,102,108,111,97,116,58,114,105,103,104,116,59,67,
+111,109,109,111,110,119,101,97,108,116,104,114,97,110,103,105,110,103,32,102,114
+,111,109,105,110,32,119,104,105,99,104,32,116,104,101,97,116,32,108,101,97,115,
+116,32,111,110,101,114,101,112,114,111,100,117,99,116,105,111,110,101,110,99,121
+,99,108,111,112,101,100,105,97,59,102,111,110,116,45,115,105,122,101,58,49,106,
+117,114,105,115,100,105,99,116,105,111,110,97,116,32,116,104,97,116,32,116,105,
+109,101,34,62,60,97,32,99,108,97,115,115,61,34,73,110,32,97,100,100,105,116,105,
+111,110,44,100,101,115,99,114,105,112,116,105,111,110,43,99,111,110,118,101,114,
+115,97,116,105,111,110,99,111,110,116,97,99,116,32,119,105,116,104,105,115,32,
+103,101,110,101,114,97,108,108,121,114,34,32,99,111,110,116,101,110,116,61,34,
+114,101,112,114,101,115,101,110,116,105,110,103,38,108,116,59,109,97,116,104,38,
+103,116,59,112,114,101,115,101,110,116,97,116,105,111,110,111,99,99,97,115,105,
+111,110,97,108,108,121,60,105,109,103,32,119,105,100,116,104,61,34,110,97,118,
+105,103,97,116,105,111,110,34,62,99,111,109,112,101,110,115,97,116,105,111,110,
+99,104,97,109,112,105,111,110,115,104,105,112,109,101,100,105,97,61,34,97,108,
+108,34,32,118,105,111,108,97,116,105,111,110,32,111,102,114,101,102,101,114,101,
+110,99,101,32,116,111,114,101,116,117,114,110,32,116,114,117,101,59,83,116,114,
+105,99,116,47,47,69,78,34,32,116,114,97,110,115,97,99,116,105,111,110,115,105,
+110,116,101,114,118,101,110,116,105,111,110,118,101,114,105,102,105,99,97,116,
+105,111,110,73,110,102,111,114,109,97,116,105,111,110,32,100,105,102,102,105,99,
+117,108,116,105,101,115,67,104,97,109,112,105,111,110,115,104,105,112,99,97,112,
+97,98,105,108,105,116,105,101,115,60,33,91,101,110,100,105,102,93,45,45,62,125,
+10,60,47,115,99,114,105,112,116,62,10,67,104,114,105,115,116,105,97,110,105,116,
+121,102,111,114,32,101,120,97,109,112,108,101,44,80,114,111,102,101,115,115,105,
+111,110,97,108,114,101,115,116,114,105,99,116,105,111,110,115,115,117,103,103,
+101,115,116,32,116,104,97,116,119,97,115,32,114,101,108,101,97,115,101,100,40,
+115,117,99,104,32,97,115,32,116,104,101,114,101,109,111,118,101,67,108,97,115,
+115,40,117,110,101,109,112,108,111,121,109,101,110,116,116,104,101,32,65,109,101
+,114,105,99,97,110,115,116,114,117,99,116,117,114,101,32,111,102,47,105,110,100,
+101,120,46,104,116,109,108,32,112,117,98,108,105,115,104,101,100,32,105,110,115,
+112,97,110,32,99,108,97,115,115,61,34,34,62,60,97,32,104,114,101,102,61,34,47,
+105,110,116,114,111,100,117,99,116,105,111,110,98,101,108,111,110,103,105,110,
+103,32,116,111,99,108,97,105,109,101,100,32,116,104,97,116,99,111,110,115,101,
+113,117,101,110,99,101,115,60,109,101,116,97,32,110,97,109,101,61,34,71,117,105,
+100,101,32,116,111,32,116,104,101,111,118,101,114,119,104,101,108,109,105,110,
+103,97,103,97,105,110,115,116,32,116,104,101,32,99,111,110,99,101,110,116,114,97
+,116,101,100,44,10,46,110,111,110,116,111,117,99,104,32,111,98,115,101,114,118,
+97,116,105,111,110,115,60,47,97,62,10,60,47,100,105,118,62,10,102,32,40,100,111,
+99,117,109,101,110,116,46,98,111,114,100,101,114,58,32,49,112,120,32,123,102,111
+,110,116,45,115,105,122,101,58,49,116,114,101,97,116,109,101,110,116,32,111,102,
+48,34,32,104,101,105,103,104,116,61,34,49,109,111,100,105,102,105,99,97,116,105,
+111,110,73,110,100,101,112,101,110,100,101,110,99,101,100,105,118,105,100,101,
+100,32,105,110,116,111,103,114,101,97,116,101,114,32,116,104,97,110,97,99,104,
+105,101,118,101,109,101,110,116,115,101,115,116,97,98,108,105,115,104,105,110,
+103,74,97,118,97,83,99,114,105,112,116,34,32,110,101,118,101,114,116,104,101,108
+,101,115,115,115,105,103,110,105,102,105,99,97,110,99,101,66,114,111,97,100,99,
+97,115,116,105,110,103,62,38,110,98,115,112,59,60,47,116,100,62,99,111,110,116,
+97,105,110,101,114,34,62,10,115,117,99,104,32,97,115,32,116,104,101,32,105,110,
+102,108,117,101,110,99,101,32,111,102,97,32,112,97,114,116,105,99,117,108,97,114
+,115,114,99,61,39,104,116,116,112,58,47,47,110,97,118,105,103,97,116,105,111,110
+,34,32,104,97,108,102,32,111,102,32,116,104,101,32,115,117,98,115,116,97,110,116
+,105,97,108,32,38,110,98,115,112,59,60,47,100,105,118,62,97,100,118,97,110,116,
+97,103,101,32,111,102,100,105,115,99,111,118,101,114,121,32,111,102,102,117,110,
+100,97,109,101,110,116,97,108,32,109,101,116,114,111,112,111,108,105,116,97,110,
+116,104,101,32,111,112,112,111,115,105,116,101,34,32,120,109,108,58,108,97,110,
+103,61,34,100,101,108,105,98,101,114,97,116,101,108,121,97,108,105,103,110,61,99
+,101,110,116,101,114,101,118,111,108,117,116,105,111,110,32,111,102,112,114,101,
+115,101,114,118,97,116,105,111,110,105,109,112,114,111,118,101,109,101,110,116,
+115,98,101,103,105,110,110,105,110,103,32,105,110,74,101,115,117,115,32,67,104,
+114,105,115,116,80,117,98,108,105,99,97,116,105,111,110,115,100,105,115,97,103,
+114,101,101,109,101,110,116,116,101,120,116,45,97,108,105,103,110,58,114,44,32,
+102,117,110,99,116,105,111,110,40,41,115,105,109,105,108,97,114,105,116,105,101,
+115,98,111,100,121,62,60,47,104,116,109,108,62,105,115,32,99,117,114,114,101,110
+,116,108,121,97,108,112,104,97,98,101,116,105,99,97,108,105,115,32,115,111,109,
+101,116,105,109,101,115,116,121,112,101,61,34,105,109,97,103,101,47,109,97,110,
+121,32,111,102,32,116,104,101,32,102,108,111,119,58,104,105,100,100,101,110,59,
+97,118,97,105,108,97,98,108,101,32,105,110,100,101,115,99,114,105,98,101,32,116,
+104,101,101,120,105,115,116,101,110,99,101,32,111,102,97,108,108,32,111,118,101,
+114,32,116,104,101,116,104,101,32,73,110,116,101,114,110,101,116,9,60,117,108,32
+,99,108,97,115,115,61,34,105,110,115,116,97,108,108,97,116,105,111,110,110,101,
+105,103,104,98,111,114,104,111,111,100,97,114,109,101,100,32,102,111,114,99,101,
+115,114,101,100,117,99,105,110,103,32,116,104,101,99,111,110,116,105,110,117,101
+,115,32,116,111,78,111,110,101,116,104,101,108,101,115,115,44,116,101,109,112,
+101,114,97,116,117,114,101,115,10,9,9,60,97,32,104,114,101,102,61,34,99,108,111,
+115,101,32,116,111,32,116,104,101,101,120,97,109,112,108,101,115,32,111,102,32,
+105,115,32,97,98,111,117,116,32,116,104,101,40,115,101,101,32,98,101,108,111,119
+,41,46,34,32,105,100,61,34,115,101,97,114,99,104,112,114,111,102,101,115,115,105
+,111,110,97,108,105,115,32,97,118,97,105,108,97,98,108,101,116,104,101,32,111,
+102,102,105,99,105,97,108,9,9,60,47,115,99,114,105,112,116,62,10,10,9,9,60,100,
+105,118,32,105,100,61,34,97,99,99,101,108,101,114,97,116,105,111,110,116,104,114
+,111,117,103,104,32,116,104,101,32,72,97,108,108,32,111,102,32,70,97,109,101,100
+,101,115,99,114,105,112,116,105,111,110,115,116,114,97,110,115,108,97,116,105,
+111,110,115,105,110,116,101,114,102,101,114,101,110,99,101,32,116,121,112,101,61
+,39,116,101,120,116,47,114,101,99,101,110,116,32,121,101,97,114,115,105,110,32,
+116,104,101,32,119,111,114,108,100,118,101,114,121,32,112,111,112,117,108,97,114
+,123,98,97,99,107,103,114,111,117,110,100,58,116,114,97,100,105,116,105,111,110,
+97,108,32,115,111,109,101,32,111,102,32,116,104,101,32,99,111,110,110,101,99,116
+,101,100,32,116,111,101,120,112,108,111,105,116,97,116,105,111,110,101,109,101,
+114,103,101,110,99,101,32,111,102,99,111,110,115,116,105,116,117,116,105,111,110
+,65,32,72,105,115,116,111,114,121,32,111,102,115,105,103,110,105,102,105,99,97,
+110,116,32,109,97,110,117,102,97,99,116,117,114,101,100,101,120,112,101,99,116,
+97,116,105,111,110,115,62,60,110,111,115,99,114,105,112,116,62,60,99,97,110,32,
+98,101,32,102,111,117,110,100,98,101,99,97,117,115,101,32,116,104,101,32,104,97,
+115,32,110,111,116,32,98,101,101,110,110,101,105,103,104,98,111,117,114,105,110,
+103,119,105,116,104,111,117,116,32,116,104,101,32,97,100,100,101,100,32,116,111,
+32,116,104,101,9,60,108,105,32,99,108,97,115,115,61,34,105,110,115,116,114,117,
+109,101,110,116,97,108,83,111,118,105,101,116,32,85,110,105,111,110,97,99,107,
+110,111,119,108,101,100,103,101,100,119,104,105,99,104,32,99,97,110,32,98,101,
+110,97,109,101,32,102,111,114,32,116,104,101,97,116,116,101,110,116,105,111,110,
+32,116,111,97,116,116,101,109,112,116,115,32,116,111,32,100,101,118,101,108,111,
+112,109,101,110,116,115,73,110,32,102,97,99,116,44,32,116,104,101,60,108,105,32,
+99,108,97,115,115,61,34,97,105,109,112,108,105,99,97,116,105,111,110,115,115,117
+,105,116,97,98,108,101,32,102,111,114,109,117,99,104,32,111,102,32,116,104,101,
+32,99,111,108,111,110,105,122,97,116,105,111,110,112,114,101,115,105,100,101,110
+,116,105,97,108,99,97,110,99,101,108,66,117,98,98,108,101,32,73,110,102,111,114,
+109,97,116,105,111,110,109,111,115,116,32,111,102,32,116,104,101,32,105,115,32,
+100,101,115,99,114,105,98,101,100,114,101,115,116,32,111,102,32,116,104,101,32,
+109,111,114,101,32,111,114,32,108,101,115,115,105,110,32,83,101,112,116,101,109,
+98,101,114,73,110,116,101,108,108,105,103,101,110,99,101,115,114,99,61,34,104,
+116,116,112,58,47,47,112,120,59,32,104,101,105,103,104,116,58,32,97,118,97,105,
+108,97,98,108,101,32,116,111,109,97,110,117,102,97,99,116,117,114,101,114,104,
+117,109,97,110,32,114,105,103,104,116,115,108,105,110,107,32,104,114,101,102,61,
+34,47,97,118,97,105,108,97,98,105,108,105,116,121,112,114,111,112,111,114,116,
+105,111,110,97,108,111,117,116,115,105,100,101,32,116,104,101,32,97,115,116,114,
+111,110,111,109,105,99,97,108,104,117,109,97,110,32,98,101,105,110,103,115,110,
+97,109,101,32,111,102,32,116,104,101,32,97,114,101,32,102,111,117,110,100,32,105
+,110,97,114,101,32,98,97,115,101,100,32,111,110,115,109,97,108,108,101,114,32,
+116,104,97,110,97,32,112,101,114,115,111,110,32,119,104,111,101,120,112,97,110,
+115,105,111,110,32,111,102,97,114,103,117,105,110,103,32,116,104,97,116,110,111,
+119,32,107,110,111,119,110,32,97,115,73,110,32,116,104,101,32,101,97,114,108,121
+,105,110,116,101,114,109,101,100,105,97,116,101,100,101,114,105,118,101,100,32,
+102,114,111,109,83,99,97,110,100,105,110,97,118,105,97,110,60,47,97,62,60,47,100
+,105,118,62,13,10,99,111,110,115,105,100,101,114,32,116,104,101,97,110,32,101,
+115,116,105,109,97,116,101,100,116,104,101,32,78,97,116,105,111,110,97,108,60,
+100,105,118,32,105,100,61,34,112,97,103,114,101,115,117,108,116,105,110,103,32,
+105,110,99,111,109,109,105,115,115,105,111,110,101,100,97,110,97,108,111,103,111
+,117,115,32,116,111,97,114,101,32,114,101,113,117,105,114,101,100,47,117,108,62,
+10,60,47,100,105,118,62,10,119,97,115,32,98,97,115,101,100,32,111,110,97,110,100
+,32,98,101,99,97,109,101,32,97,38,110,98,115,112,59,38,110,98,115,112,59,116,34,
+32,118,97,108,117,101,61,34,34,32,119,97,115,32,99,97,112,116,117,114,101,100,
+110,111,32,109,111,114,101,32,116,104,97,110,114,101,115,112,101,99,116,105,118,
+101,108,121,99,111,110,116,105,110,117,101,32,116,111,32,62,13,10,60,104,101,97,
+100,62,13,10,60,119,101,114,101,32,99,114,101,97,116,101,100,109,111,114,101,32,
+103,101,110,101,114,97,108,105,110,102,111,114,109,97,116,105,111,110,32,117,115
+,101,100,32,102,111,114,32,116,104,101,105,110,100,101,112,101,110,100,101,110,
+116,32,116,104,101,32,73,109,112,101,114,105,97,108,99,111,109,112,111,110,101,
+110,116,32,111,102,116,111,32,116,104,101,32,110,111,114,116,104,105,110,99,108,
+117,100,101,32,116,104,101,32,67,111,110,115,116,114,117,99,116,105,111,110,115,
+105,100,101,32,111,102,32,116,104,101,32,119,111,117,108,100,32,110,111,116,32,
+98,101,102,111,114,32,105,110,115,116,97,110,99,101,105,110,118,101,110,116,105,
+111,110,32,111,102,109,111,114,101,32,99,111,109,112,108,101,120,99,111,108,108,
+101,99,116,105,118,101,108,121,98,97,99,107,103,114,111,117,110,100,58,32,116,
+101,120,116,45,97,108,105,103,110,58,32,105,116,115,32,111,114,105,103,105,110,
+97,108,105,110,116,111,32,97,99,99,111,117,110,116,116,104,105,115,32,112,114,
+111,99,101,115,115,97,110,32,101,120,116,101,110,115,105,118,101,104,111,119,101
+,118,101,114,44,32,116,104,101,116,104,101,121,32,97,114,101,32,110,111,116,114,
+101,106,101,99,116,101,100,32,116,104,101,99,114,105,116,105,99,105,115,109,32,
+111,102,100,117,114,105,110,103,32,119,104,105,99,104,112,114,111,98,97,98,108,
+121,32,116,104,101,116,104,105,115,32,97,114,116,105,99,108,101,40,102,117,110,
+99,116,105,111,110,40,41,123,73,116,32,115,104,111,117,108,100,32,98,101,97,110,
+32,97,103,114,101,101,109,101,110,116,97,99,99,105,100,101,110,116,97,108,108,
+121,100,105,102,102,101,114,115,32,102,114,111,109,65,114,99,104,105,116,101,99,
+116,117,114,101,98,101,116,116,101,114,32,107,110,111,119,110,97,114,114,97,110,
+103,101,109,101,110,116,115,105,110,102,108,117,101,110,99,101,32,111,110,97,116
+,116,101,110,100,101,100,32,116,104,101,105,100,101,110,116,105,99,97,108,32,116
+,111,115,111,117,116,104,32,111,102,32,116,104,101,112,97,115,115,32,116,104,114
+,111,117,103,104,120,109,108,34,32,116,105,116,108,101,61,34,119,101,105,103,104
+,116,58,98,111,108,100,59,99,114,101,97,116,105,110,103,32,116,104,101,100,105,
+115,112,108,97,121,58,110,111,110,101,114,101,112,108,97,99,101,100,32,116,104,
+101,60,105,109,103,32,115,114,99,61,34,47,105,104,116,116,112,115,58,47,47,119,
+119,119,46,87,111,114,108,100,32,87,97,114,32,73,73,116,101,115,116,105,109,111,
+110,105,97,108,115,102,111,117,110,100,32,105,110,32,116,104,101,114,101,113,117
+,105,114,101,100,32,116,111,32,97,110,100,32,116,104,97,116,32,116,104,101,98,
+101,116,119,101,101,110,32,116,104,101,32,119,97,115,32,100,101,115,105,103,110,
+101,100,99,111,110,115,105,115,116,115,32,111,102,32,99,111,110,115,105,100,101,
+114,97,98,108,121,112,117,98,108,105,115,104,101,100,32,98,121,116,104,101,32,
+108,97,110,103,117,97,103,101,67,111,110,115,101,114,118,97,116,105,111,110,99,
+111,110,115,105,115,116,101,100,32,111,102,114,101,102,101,114,32,116,111,32,116
+,104,101,98,97,99,107,32,116,111,32,116,104,101,32,99,115,115,34,32,109,101,100,
+105,97,61,34,80,101,111,112,108,101,32,102,114,111,109,32,97,118,97,105,108,97,
+98,108,101,32,111,110,112,114,111,118,101,100,32,116,111,32,98,101,115,117,103,
+103,101,115,116,105,111,110,115,34,119,97,115,32,107,110,111,119,110,32,97,115,
+118,97,114,105,101,116,105,101,115,32,111,102,108,105,107,101,108,121,32,116,111
+,32,98,101,99,111,109,112,114,105,115,101,100,32,111,102,115,117,112,112,111,114
+,116,32,116,104,101,32,104,97,110,100,115,32,111,102,32,116,104,101,99,111,117,
+112,108,101,100,32,119,105,116,104,99,111,110,110,101,99,116,32,97,110,100,32,98
+,111,114,100,101,114,58,110,111,110,101,59,112,101,114,102,111,114,109,97,110,99
+,101,115,98,101,102,111,114,101,32,98,101,105,110,103,108,97,116,101,114,32,98,
+101,99,97,109,101,99,97,108,99,117,108,97,116,105,111,110,115,111,102,116,101,
+110,32,99,97,108,108,101,100,114,101,115,105,100,101,110,116,115,32,111,102,109,
+101,97,110,105,110,103,32,116,104,97,116,62,60,108,105,32,99,108,97,115,115,61,
+34,101,118,105,100,101,110,99,101,32,102,111,114,101,120,112,108,97,110,97,116,
+105,111,110,115,101,110,118,105,114,111,110,109,101,110,116,115,34,62,60,47,97,
+62,60,47,100,105,118,62,119,104,105,99,104,32,97,108,108,111,119,115,73,110,116,
+114,111,100,117,99,116,105,111,110,100,101,118,101,108,111,112,101,100,32,98,121
+,97,32,119,105,100,101,32,114,97,110,103,101,111,110,32,98,101,104,97,108,102,32
+,111,102,118,97,108,105,103,110,61,34,116,111,112,34,112,114,105,110,99,105,112,
+108,101,32,111,102,97,116,32,116,104,101,32,116,105,109,101,44,60,47,110,111,115
+,99,114,105,112,116,62,13,115,97,105,100,32,116,111,32,104,97,118,101,105,110,32
+,116,104,101,32,102,105,114,115,116,119,104,105,108,101,32,111,116,104,101,114,
+115,104,121,112,111,116,104,101,116,105,99,97,108,112,104,105,108,111,115,111,
+112,104,101,114,115,112,111,119,101,114,32,111,102,32,116,104,101,99,111,110,116
+,97,105,110,101,100,32,105,110,112,101,114,102,111,114,109,101,100,32,98,121,105
+,110,97,98,105,108,105,116,121,32,116,111,119,101,114,101,32,119,114,105,116,116
+,101,110,115,112,97,110,32,115,116,121,108,101,61,34,105,110,112,117,116,32,110,
+97,109,101,61,34,116,104,101,32,113,117,101,115,116,105,111,110,105,110,116,101,
+110,100,101,100,32,102,111,114,114,101,106,101,99,116,105,111,110,32,111,102,105
+,109,112,108,105,101,115,32,116,104,97,116,105,110,118,101,110,116,101,100,32,
+116,104,101,116,104,101,32,115,116,97,110,100,97,114,100,119,97,115,32,112,114,
+111,98,97,98,108,121,108,105,110,107,32,98,101,116,119,101,101,110,112,114,111,
+102,101,115,115,111,114,32,111,102,105,110,116,101,114,97,99,116,105,111,110,115
+,99,104,97,110,103,105,110,103,32,116,104,101,73,110,100,105,97,110,32,79,99,101
+,97,110,32,99,108,97,115,115,61,34,108,97,115,116,119,111,114,107,105,110,103,32
+,119,105,116,104,39,104,116,116,112,58,47,47,119,119,119,46,121,101,97,114,115,
+32,98,101,102,111,114,101,84,104,105,115,32,119,97,115,32,116,104,101,114,101,99
+,114,101,97,116,105,111,110,97,108,101,110,116,101,114,105,110,103,32,116,104,
+101,109,101,97,115,117,114,101,109,101,110,116,115,97,110,32,101,120,116,114,101
+,109,101,108,121,118,97,108,117,101,32,111,102,32,116,104,101,115,116,97,114,116
+,32,111,102,32,116,104,101,10,60,47,115,99,114,105,112,116,62,10,10,97,110,32,
+101,102,102,111,114,116,32,116,111,105,110,99,114,101,97,115,101,32,116,104,101,
+116,111,32,116,104,101,32,115,111,117,116,104,115,112,97,99,105,110,103,61,34,48
+,34,62,115,117,102,102,105,99,105,101,110,116,108,121,116,104,101,32,69,117,114,
+111,112,101,97,110,99,111,110,118,101,114,116,101,100,32,116,111,99,108,101,97,
+114,84,105,109,101,111,117,116,100,105,100,32,110,111,116,32,104,97,118,101,99,
+111,110,115,101,113,117,101,110,116,108,121,102,111,114,32,116,104,101,32,110,
+101,120,116,101,120,116,101,110,115,105,111,110,32,111,102,101,99,111,110,111,
+109,105,99,32,97,110,100,97,108,116,104,111,117,103,104,32,116,104,101,97,114,
+101,32,112,114,111,100,117,99,101,100,97,110,100,32,119,105,116,104,32,116,104,
+101,105,110,115,117,102,102,105,99,105,101,110,116,103,105,118,101,110,32,98,121
+,32,116,104,101,115,116,97,116,105,110,103,32,116,104,97,116,101,120,112,101,110
+,100,105,116,117,114,101,115,60,47,115,112,97,110,62,60,47,97,62,10,116,104,111,
+117,103,104,116,32,116,104,97,116,111,110,32,116,104,101,32,98,97,115,105,115,99
+,101,108,108,112,97,100,100,105,110,103,61,105,109,97,103,101,32,111,102,32,116,
+104,101,114,101,116,117,114,110,105,110,103,32,116,111,105,110,102,111,114,109,
+97,116,105,111,110,44,115,101,112,97,114,97,116,101,100,32,98,121,97,115,115,97,
+115,115,105,110,97,116,101,100,115,34,32,99,111,110,116,101,110,116,61,34,97,117
+,116,104,111,114,105,116,121,32,111,102,110,111,114,116,104,119,101,115,116,101,
+114,110,60,47,100,105,118,62,10,60,100,105,118,32,34,62,60,47,100,105,118,62,13,
+10,32,32,99,111,110,115,117,108,116,97,116,105,111,110,99,111,109,109,117,110,
+105,116,121,32,111,102,116,104,101,32,110,97,116,105,111,110,97,108,105,116,32,
+115,104,111,117,108,100,32,98,101,112,97,114,116,105,99,105,112,97,110,116,115,
+32,97,108,105,103,110,61,34,108,101,102,116,116,104,101,32,103,114,101,97,116,
+101,115,116,115,101,108,101,99,116,105,111,110,32,111,102,115,117,112,101,114,
+110,97,116,117,114,97,108,100,101,112,101,110,100,101,110,116,32,111,110,105,115
+,32,109,101,110,116,105,111,110,101,100,97,108,108,111,119,105,110,103,32,116,
+104,101,119,97,115,32,105,110,118,101,110,116,101,100,97,99,99,111,109,112,97,
+110,121,105,110,103,104,105,115,32,112,101,114,115,111,110,97,108,97,118,97,105,
+108,97,98,108,101,32,97,116,115,116,117,100,121,32,111,102,32,116,104,101,111,
+110,32,116,104,101,32,111,116,104,101,114,101,120,101,99,117,116,105,111,110,32,
+111,102,72,117,109,97,110,32,82,105,103,104,116,115,116,101,114,109,115,32,111,
+102,32,116,104,101,97,115,115,111,99,105,97,116,105,111,110,115,114,101,115,101,
+97,114,99,104,32,97,110,100,115,117,99,99,101,101,100,101,100,32,98,121,100,101,
+102,101,97,116,101,100,32,116,104,101,97,110,100,32,102,114,111,109,32,116,104,
+101,98,117,116,32,116,104,101,121,32,97,114,101,99,111,109,109,97,110,100,101,
+114,32,111,102,115,116,97,116,101,32,111,102,32,116,104,101,121,101,97,114,115,
+32,111,102,32,97,103,101,116,104,101,32,115,116,117,100,121,32,111,102,60,117,
+108,32,99,108,97,115,115,61,34,115,112,108,97,99,101,32,105,110,32,116,104,101,
+119,104,101,114,101,32,104,101,32,119,97,115,60,108,105,32,99,108,97,115,115,61,
+34,102,116,104,101,114,101,32,97,114,101,32,110,111,119,104,105,99,104,32,98,101
+,99,97,109,101,104,101,32,112,117,98,108,105,115,104,101,100,101,120,112,114,101
+,115,115,101,100,32,105,110,116,111,32,119,104,105,99,104,32,116,104,101,99,111,
+109,109,105,115,115,105,111,110,101,114,102,111,110,116,45,119,101,105,103,104,
+116,58,116,101,114,114,105,116,111,114,121,32,111,102,101,120,116,101,110,115,
+105,111,110,115,34,62,82,111,109,97,110,32,69,109,112,105,114,101,101,113,117,97
+,108,32,116,111,32,116,104,101,73,110,32,99,111,110,116,114,97,115,116,44,104,
+111,119,101,118,101,114,44,32,97,110,100,105,115,32,116,121,112,105,99,97,108,
+108,121,97,110,100,32,104,105,115,32,119,105,102,101,40,97,108,115,111,32,99,97,
+108,108,101,100,62,60,117,108,32,99,108,97,115,115,61,34,101,102,102,101,99,116,
+105,118,101,108,121,32,101,118,111,108,118,101,100,32,105,110,116,111,115,101,
+101,109,32,116,111,32,104,97,118,101,119,104,105,99,104,32,105,115,32,116,104,
+101,116,104,101,114,101,32,119,97,115,32,110,111,97,110,32,101,120,99,101,108,
+108,101,110,116,97,108,108,32,111,102,32,116,104,101,115,101,100,101,115,99,114,
+105,98,101,100,32,98,121,73,110,32,112,114,97,99,116,105,99,101,44,98,114,111,97
+,100,99,97,115,116,105,110,103,99,104,97,114,103,101,100,32,119,105,116,104,114,
+101,102,108,101,99,116,101,100,32,105,110,115,117,98,106,101,99,116,101,100,32,
+116,111,109,105,108,105,116,97,114,121,32,97,110,100,116,111,32,116,104,101,32,
+112,111,105,110,116,101,99,111,110,111,109,105,99,97,108,108,121,115,101,116,84,
+97,114,103,101,116,105,110,103,97,114,101,32,97,99,116,117,97,108,108,121,118,
+105,99,116,111,114,121,32,111,118,101,114,40,41,59,60,47,115,99,114,105,112,116,
+62,99,111,110,116,105,110,117,111,117,115,108,121,114,101,113,117,105,114,101,
+100,32,102,111,114,101,118,111,108,117,116,105,111,110,97,114,121,97,110,32,101,
+102,102,101,99,116,105,118,101,110,111,114,116,104,32,111,102,32,116,104,101,44,
+32,119,104,105,99,104,32,119,97,115,32,102,114,111,110,116,32,111,102,32,116,104
+,101,111,114,32,111,116,104,101,114,119,105,115,101,115,111,109,101,32,102,111,
+114,109,32,111,102,104,97,100,32,110,111,116,32,98,101,101,110,103,101,110,101,
+114,97,116,101,100,32,98,121,105,110,102,111,114,109,97,116,105,111,110,46,112,
+101,114,109,105,116,116,101,100,32,116,111,105,110,99,108,117,100,101,115,32,116
+,104,101,100,101,118,101,108,111,112,109,101,110,116,44,101,110,116,101,114,101,
+100,32,105,110,116,111,116,104,101,32,112,114,101,118,105,111,117,115,99,111,110
+,115,105,115,116,101,110,116,108,121,97,114,101,32,107,110,111,119,110,32,97,115
+,116,104,101,32,102,105,101,108,100,32,111,102,116,104,105,115,32,116,121,112,
+101,32,111,102,103,105,118,101,110,32,116,111,32,116,104,101,116,104,101,32,116,
+105,116,108,101,32,111,102,99,111,110,116,97,105,110,115,32,116,104,101,105,110,
+115,116,97,110,99,101,115,32,111,102,105,110,32,116,104,101,32,110,111,114,116,
+104,100,117,101,32,116,111,32,116,104,101,105,114,97,114,101,32,100,101,115,105,
+103,110,101,100,99,111,114,112,111,114,97,116,105,111,110,115,119,97,115,32,116,
+104,97,116,32,116,104,101,111,110,101,32,111,102,32,116,104,101,115,101,109,111,
+114,101,32,112,111,112,117,108,97,114,115,117,99,99,101,101,100,101,100,32,105,
+110,115,117,112,112,111,114,116,32,102,114,111,109,105,110,32,100,105,102,102,
+101,114,101,110,116,100,111,109,105,110,97,116,101,100,32,98,121,100,101,115,105
+,103,110,101,100,32,102,111,114,111,119,110,101,114,115,104,105,112,32,111,102,
+97,110,100,32,112,111,115,115,105,98,108,121,115,116,97,110,100,97,114,100,105,
+122,101,100,114,101,115,112,111,110,115,101,84,101,120,116,119,97,115,32,105,110
+,116,101,110,100,101,100,114,101,99,101,105,118,101,100,32,116,104,101,97,115,
+115,117,109,101,100,32,116,104,97,116,97,114,101,97,115,32,111,102,32,116,104,
+101,112,114,105,109,97,114,105,108,121,32,105,110,116,104,101,32,98,97,115,105,
+115,32,111,102,105,110,32,116,104,101,32,115,101,110,115,101,97,99,99,111,117,
+110,116,115,32,102,111,114,100,101,115,116,114,111,121,101,100,32,98,121,97,116,
+32,108,101,97,115,116,32,116,119,111,119,97,115,32,100,101,99,108,97,114,101,100
+,99,111,117,108,100,32,110,111,116,32,98,101,83,101,99,114,101,116,97,114,121,32
+,111,102,97,112,112,101,97,114,32,116,111,32,98,101,109,97,114,103,105,110,45,
+116,111,112,58,49,47,94,92,115,43,124,92,115,43,36,47,103,101,41,123,116,104,114
+,111,119,32,101,125,59,116,104,101,32,115,116,97,114,116,32,111,102,116,119,111,
+32,115,101,112,97,114,97,116,101,108,97,110,103,117,97,103,101,32,97,110,100,119
+,104,111,32,104,97,100,32,98,101,101,110,111,112,101,114,97,116,105,111,110,32,
+111,102,100,101,97,116,104,32,111,102,32,116,104,101,114,101,97,108,32,110,117,
+109,98,101,114,115,9,60,108,105,110,107,32,114,101,108,61,34,112,114,111,118,105
+,100,101,100,32,116,104,101,116,104,101,32,115,116,111,114,121,32,111,102,99,111
+,109,112,101,116,105,116,105,111,110,115,101,110,103,108,105,115,104,32,40,85,75
+,41,101,110,103,108,105,115,104,32,40,85,83,41,208,156,208,190,208,189,208,179,
+208,190,208,187,208,161,209,128,208,191,209,129,208,186,208,184,209,129,209,128,
+208,191,209,129,208,186,208,184,209,129,209,128,208,191,209,129,208,186,208,190,
+217,132,216,185,216,177,216,168,217,138,216,169,230,173,163,233,171,148,228,184,
+173,230,150,135,231,174,128,228,189,147,228,184,173,230,150,135,231,185,129,228,
+189,147,228,184,173,230,150,135,230,156,137,233,153,144,229,133,172,229,143,184,
+228,186,186,230,176,145,230,148,191,229,186,156,233,152,191,233,135,140,229,183,
+180,229,183,180,231,164,190,228,188,154,228,184,187,228,185,137,230,147,141,228,
+189,156,231,179,187,231,187,159,230,148,191,231,173,150,230,179,149,232,167,132,
+105,110,102,111,114,109,97,99,105,195,179,110,104,101,114,114,97,109,105,101,110
+,116,97,115,101,108,101,99,116,114,195,179,110,105,99,111,100,101,115,99,114,105
+,112,99,105,195,179,110,99,108,97,115,105,102,105,99,97,100,111,115,99,111,110,
+111,99,105,109,105,101,110,116,111,112,117,98,108,105,99,97,99,105,195,179,110,
+114,101,108,97,99,105,111,110,97,100,97,115,105,110,102,111,114,109,195,161,116,
+105,99,97,114,101,108,97,99,105,111,110,97,100,111,115,100,101,112,97,114,116,97
+,109,101,110,116,111,116,114,97,98,97,106,97,100,111,114,101,115,100,105,114,101
+,99,116,97,109,101,110,116,101,97,121,117,110,116,97,109,105,101,110,116,111,109
+,101,114,99,97,100,111,76,105,98,114,101,99,111,110,116,195,161,99,116,101,110,
+111,115,104,97,98,105,116,97,99,105,111,110,101,115,99,117,109,112,108,105,109,
+105,101,110,116,111,114,101,115,116,97,117,114,97,110,116,101,115,100,105,115,
+112,111,115,105,99,105,195,179,110,99,111,110,115,101,99,117,101,110,99,105,97,
+101,108,101,99,116,114,195,179,110,105,99,97,97,112,108,105,99,97,99,105,111,110
+,101,115,100,101,115,99,111,110,101,99,116,97,100,111,105,110,115,116,97,108,97,
+99,105,195,179,110,114,101,97,108,105,122,97,99,105,195,179,110,117,116,105,108,
+105,122,97,99,105,195,179,110,101,110,99,105,99,108,111,112,101,100,105,97,101,
+110,102,101,114,109,101,100,97,100,101,115,105,110,115,116,114,117,109,101,110,
+116,111,115,101,120,112,101,114,105,101,110,99,105,97,115,105,110,115,116,105,
+116,117,99,105,195,179,110,112,97,114,116,105,99,117,108,97,114,101,115,115,117,
+98,99,97,116,101,103,111,114,105,97,209,130,208,190,208,187,209,140,208,186,208,
+190,208,160,208,190,209,129,209,129,208,184,208,184,209,128,208,176,208,177,208,
+190,209,130,209,139,208,177,208,190,208,187,209,140,209,136,208,181,208,191,209,
+128,208,190,209,129,209,130,208,190,208,188,208,190,208,182,208,181,209,130,208,
+181,208,180,209,128,209,131,208,179,208,184,209,133,209,129,208,187,209,131,209,
+135,208,176,208,181,209,129,208,181,208,185,209,135,208,176,209,129,208,178,209,
+129,208,181,208,179,208,180,208,176,208,160,208,190,209,129,209,129,208,184,209,
+143,208,156,208,190,209,129,208,186,208,178,208,181,208,180,209,128,209,131,208,
+179,208,184,208,181,208,179,208,190,209,128,208,190,208,180,208,176,208,178,208,
+190,208,191,209,128,208,190,209,129,208,180,208,176,208,189,208,189,209,139,209,
+133,208,180,208,190,208,187,208,182,208,189,209,139,208,184,208,188,208,181,208,
+189,208,189,208,190,208,156,208,190,209,129,208,186,208,178,209,139,209,128,209,
+131,208,177,208,187,208,181,208,185,208,156,208,190,209,129,208,186,208,178,208,
+176,209,129,209,130,209,128,208,176,208,189,209,139,208,189,208,184,209,135,208,
+181,208,179,208,190,209,128,208,176,208,177,208,190,209,130,208,181,208,180,208,
+190,208,187,208,182,208,181,208,189,209,131,209,129,208,187,209,131,208,179,208,
+184,209,130,208,181,208,191,208,181,209,128,209,140,208,158,208,180,208,189,208,
+176,208,186,208,190,208,191,208,190,209,130,208,190,208,188,209,131,209,128,208,
+176,208,177,208,190,209,130,209,131,208,176,208,191,209,128,208,181,208,187,209,
+143,208,178,208,190,208,190,208,177,209,137,208,181,208,190,208,180,208,189,208,
+190,208,179,208,190,209,129,208,178,208,190,208,181,208,179,208,190,209,129,209,
+130,208,176,209,130,209,140,208,184,208,180,209,128,209,131,208,179,208,190,208,
+185,209,132,208,190,209,128,209,131,208,188,208,181,209,133,208,190,209,128,208,
+190,209,136,208,190,208,191,209,128,208,190,209,130,208,184,208,178,209,129,209,
+129,209,139,208,187,208,186,208,176,208,186,208,176,208,182,208,180,209,139,208,
+185,208,178,208,187,208,176,209,129,209,130,208,184,208,179,209,128,209,131,208,
+191,208,191,209,139,208,178,208,188,208,181,209,129,209,130,208,181,209,128,208,
+176,208,177,208,190,209,130,208,176,209,129,208,186,208,176,208,183,208,176,208,
+187,208,191,208,181,209,128,208,178,209,139,208,185,208,180,208,181,208,187,208,
+176,209,130,209,140,208,180,208,181,208,189,209,140,208,179,208,184,208,191,208,
+181,209,128,208,184,208,190,208,180,208,177,208,184,208,183,208,189,208,181,209,
+129,208,190,209,129,208,189,208,190,208,178,208,181,208,188,208,190,208,188,208,
+181,208,189,209,130,208,186,209,131,208,191,208,184,209,130,209,140,208,180,208,
+190,208,187,208,182,208,189,208,176,209,128,208,176,208,188,208,186,208,176,209,
+133,208,189,208,176,209,135,208,176,208,187,208,190,208,160,208,176,208,177,208,
+190,209,130,208,176,208,162,208,190,208,187,209,140,208,186,208,190,209,129,208,
+190,208,178,209,129,208,181,208,188,208,178,209,130,208,190,209,128,208,190,208,
+185,208,189,208,176,209,135,208,176,208,187,208,176,209,129,208,191,208,184,209,
+129,208,190,208,186,209,129,208,187,209,131,208,182,208,177,209,139,209,129,208,
+184,209,129,209,130,208,181,208,188,208,191,208,181,209,135,208,176,209,130,208,
+184,208,189,208,190,208,178,208,190,208,179,208,190,208,191,208,190,208,188,208,
+190,209,137,208,184,209,129,208,176,208,185,209,130,208,190,208,178,208,191,208,
+190,209,135,208,181,208,188,209,131,208,191,208,190,208,188,208,190,209,137,209,
+140,208,180,208,190,208,187,208,182,208,189,208,190,209,129,209,129,209,139,208,
+187,208,186,208,184,208,177,209,139,209,129,209,130,209,128,208,190,208,180,208,
+176,208,189,208,189,209,139,208,181,208,188,208,189,208,190,208,179,208,184,208,
+181,208,191,209,128,208,190,208,181,208,186,209,130,208,161,208,181,208,185,209,
+135,208,176,209,129,208,188,208,190,208,180,208,181,208,187,208,184,209,130,208,
+176,208,186,208,190,208,179,208,190,208,190,208,189,208,187,208,176,208,185,208,
+189,208,179,208,190,209,128,208,190,208,180,208,181,208,178,208,181,209,128,209,
+129,208,184,209,143,209,129,209,130,209,128,208,176,208,189,208,181,209,132,208,
+184,208,187,209,140,208,188,209,139,209,131,209,128,208,190,208,178,208,189,209,
+143,209,128,208,176,208,183,208,189,209,139,209,133,208,184,209,129,208,186,208,
+176,209,130,209,140,208,189,208,181,208,180,208,181,208,187,209,142,209,143,208,
+189,208,178,208,176,209,128,209,143,208,188,208,181,208,189,209,140,209,136,208,
+181,208,188,208,189,208,190,208,179,208,184,209,133,208,180,208,176,208,189,208,
+189,208,190,208,185,208,183,208,189,208,176,209,135,208,184,209,130,208,189,208,
+181,208,187,209,140,208,183,209,143,209,132,208,190,209,128,209,131,208,188,208,
+176,208,162,208,181,208,191,208,181,209,128,209,140,208,188,208,181,209,129,209,
+143,209,134,208,176,208,183,208,176,209,137,208,184,209,130,209,139,208,155,209,
+131,209,135,209,136,208,184,208,181,224,164,168,224,164,185,224,165,128,224,164,
+130,224,164,149,224,164,176,224,164,168,224,165,135,224,164,133,224,164,170,224,
+164,168,224,165,135,224,164,149,224,164,191,224,164,175,224,164,190,224,164,149,
+224,164,176,224,165,135,224,164,130,224,164,133,224,164,168,224,165,141,224,164,
+175,224,164,149,224,165,141,224,164,175,224,164,190,224,164,151,224,164,190,224,
+164,135,224,164,161,224,164,172,224,164,190,224,164,176,224,165,135,224,164,149,
+224,164,191,224,164,184,224,165,128,224,164,166,224,164,191,224,164,175,224,164,
+190,224,164,170,224,164,185,224,164,178,224,165,135,224,164,184,224,164,191,224,
+164,130,224,164,185,224,164,173,224,164,190,224,164,176,224,164,164,224,164,133,
+224,164,170,224,164,168,224,165,128,224,164,181,224,164,190,224,164,178,224,165,
+135,224,164,184,224,165,135,224,164,181,224,164,190,224,164,149,224,164,176,224,
+164,164,224,165,135,224,164,174,224,165,135,224,164,176,224,165,135,224,164,185,
+224,165,139,224,164,168,224,165,135,224,164,184,224,164,149,224,164,164,224,165,
+135,224,164,172,224,164,185,224,165,129,224,164,164,224,164,184,224,164,190,224,
+164,135,224,164,159,224,164,185,224,165,139,224,164,151,224,164,190,224,164,156,
+224,164,190,224,164,168,224,165,135,224,164,174,224,164,191,224,164,168,224,164,
+159,224,164,149,224,164,176,224,164,164,224,164,190,224,164,149,224,164,176,224,
+164,168,224,164,190,224,164,137,224,164,168,224,164,149,224,165,135,224,164,175,
+224,164,185,224,164,190,224,164,129,224,164,184,224,164,172,224,164,184,224,165,
+135,224,164,173,224,164,190,224,164,183,224,164,190,224,164,134,224,164,170,224,
+164,149,224,165,135,224,164,178,224,164,191,224,164,175,224,165,135,224,164,182,
+224,165,129,224,164,176,224,165,130,224,164,135,224,164,184,224,164,149,224,165,
+135,224,164,152,224,164,130,224,164,159,224,165,135,224,164,174,224,165,135,224,
+164,176,224,165,128,224,164,184,224,164,149,224,164,164,224,164,190,224,164,174,
+224,165,135,224,164,176,224,164,190,224,164,178,224,165,135,224,164,149,224,164,
+176,224,164,133,224,164,167,224,164,191,224,164,149,224,164,133,224,164,170,224,
+164,168,224,164,190,224,164,184,224,164,174,224,164,190,224,164,156,224,164,174,
+224,165,129,224,164,157,224,165,135,224,164,149,224,164,190,224,164,176,224,164,
+163,224,164,185,224,165,139,224,164,164,224,164,190,224,164,149,224,164,161,224,
+164,188,224,165,128,224,164,175,224,164,185,224,164,190,224,164,130,224,164,185,
+224,165,139,224,164,159,224,164,178,224,164,182,224,164,172,224,165,141,224,164,
+166,224,164,178,224,164,191,224,164,175,224,164,190,224,164,156,224,165,128,224,
+164,181,224,164,168,224,164,156,224,164,190,224,164,164,224,164,190,224,164,149,
+224,165,136,224,164,184,224,165,135,224,164,134,224,164,170,224,164,149,224,164,
+190,224,164,181,224,164,190,224,164,178,224,165,128,224,164,166,224,165,135,224,
+164,168,224,165,135,224,164,170,224,165,130,224,164,176,224,165,128,224,164,170,
+224,164,190,224,164,168,224,165,128,224,164,137,224,164,184,224,164,149,224,165,
+135,224,164,185,224,165,139,224,164,151,224,165,128,224,164,172,224,165,136,224,
+164,160,224,164,149,224,164,134,224,164,170,224,164,149,224,165,128,224,164,181,
+224,164,176,224,165,141,224,164,183,224,164,151,224,164,190,224,164,130,224,164,
+181,224,164,134,224,164,170,224,164,149,224,165,139,224,164,156,224,164,191,224,
+164,178,224,164,190,224,164,156,224,164,190,224,164,168,224,164,190,224,164,184,
+224,164,185,224,164,174,224,164,164,224,164,185,224,164,174,224,165,135,224,164,
+130,224,164,137,224,164,168,224,164,149,224,165,128,224,164,175,224,164,190,224,
+164,185,224,165,130,224,164,166,224,164,176,224,165,141,224,164,156,224,164,184,
+224,165,130,224,164,154,224,165,128,224,164,170,224,164,184,224,164,130,224,164,
+166,224,164,184,224,164,181,224,164,190,224,164,178,224,164,185,224,165,139,224,
+164,168,224,164,190,224,164,185,224,165,139,224,164,164,224,165,128,224,164,156,
+224,165,136,224,164,184,224,165,135,224,164,181,224,164,190,224,164,170,224,164,
+184,224,164,156,224,164,168,224,164,164,224,164,190,224,164,168,224,165,135,224,
+164,164,224,164,190,224,164,156,224,164,190,224,164,176,224,165,128,224,164,152,
+224,164,190,224,164,175,224,164,178,224,164,156,224,164,191,224,164,178,224,165,
+135,224,164,168,224,165,128,224,164,154,224,165,135,224,164,156,224,164,190,224,
+164,130,224,164,154,224,164,170,224,164,164,224,165,141,224,164,176,224,164,151,
+224,165,130,224,164,151,224,164,178,224,164,156,224,164,190,224,164,164,224,165,
+135,224,164,172,224,164,190,224,164,185,224,164,176,224,164,134,224,164,170,224,
+164,168,224,165,135,224,164,181,224,164,190,224,164,185,224,164,168,224,164,135,
+224,164,184,224,164,149,224,164,190,224,164,184,224,165,129,224,164,172,224,164,
+185,224,164,176,224,164,185,224,164,168,224,165,135,224,164,135,224,164,184,224,
+164,184,224,165,135,224,164,184,224,164,185,224,164,191,224,164,164,224,164,172,
+224,164,161,224,164,188,224,165,135,224,164,152,224,164,159,224,164,168,224,164,
+190,224,164,164,224,164,178,224,164,190,224,164,182,224,164,170,224,164,190,224,
+164,130,224,164,154,224,164,182,224,165,141,224,164,176,224,165,128,224,164,172,
+224,164,161,224,164,188,224,165,128,224,164,185,224,165,139,224,164,164,224,165,
+135,224,164,184,224,164,190,224,164,136,224,164,159,224,164,182,224,164,190,224,
+164,175,224,164,166,224,164,184,224,164,149,224,164,164,224,165,128,224,164,156,
+224,164,190,224,164,164,224,165,128,224,164,181,224,164,190,224,164,178,224,164,
+190,224,164,185,224,164,156,224,164,190,224,164,176,224,164,170,224,164,159,224,
+164,168,224,164,190,224,164,176,224,164,150,224,164,168,224,165,135,224,164,184,
+224,164,161,224,164,188,224,164,149,224,164,174,224,164,191,224,164,178,224,164,
+190,224,164,137,224,164,184,224,164,149,224,165,128,224,164,149,224,165,135,224,
+164,181,224,164,178,224,164,178,224,164,151,224,164,164,224,164,190,224,164,150,
+224,164,190,224,164,168,224,164,190,224,164,133,224,164,176,224,165,141,224,164,
+165,224,164,156,224,164,185,224,164,190,224,164,130,224,164,166,224,165,135,224,
+164,150,224,164,190,224,164,170,224,164,185,224,164,178,224,165,128,224,164,168,
+224,164,191,224,164,175,224,164,174,224,164,172,224,164,191,224,164,168,224,164,
+190,224,164,172,224,165,136,224,164,130,224,164,149,224,164,149,224,164,185,224,
+165,128,224,164,130,224,164,149,224,164,185,224,164,168,224,164,190,224,164,166,
+224,165,135,224,164,164,224,164,190,224,164,185,224,164,174,224,164,178,224,165,
+135,224,164,149,224,164,190,224,164,171,224,165,128,224,164,156,224,164,172,224,
+164,149,224,164,191,224,164,164,224,165,129,224,164,176,224,164,164,224,164,174,
+224,164,190,224,164,130,224,164,151,224,164,181,224,164,185,224,165,128,224,164,
+130,224,164,176,224,165,139,224,164,156,224,164,188,224,164,174,224,164,191,224,
+164,178,224,165,128,224,164,134,224,164,176,224,165,139,224,164,170,224,164,184,
+224,165,135,224,164,168,224,164,190,224,164,175,224,164,190,224,164,166,224,164,
+181,224,164,178,224,165,135,224,164,168,224,165,135,224,164,150,224,164,190,224,
+164,164,224,164,190,224,164,149,224,164,176,224,165,128,224,164,172,224,164,137,
+224,164,168,224,164,149,224,164,190,224,164,156,224,164,181,224,164,190,224,164,
+172,224,164,170,224,165,130,224,164,176,224,164,190,224,164,172,224,164,161,224,
+164,188,224,164,190,224,164,184,224,165,140,224,164,166,224,164,190,224,164,182,
+224,165,135,224,164,175,224,164,176,224,164,149,224,164,191,224,164,175,224,165,
+135,224,164,149,224,164,185,224,164,190,224,164,130,224,164,133,224,164,149,224,
+164,184,224,164,176,224,164,172,224,164,168,224,164,190,224,164,143,224,164,181,
+224,164,185,224,164,190,224,164,130,224,164,184,224,165,141,224,164,165,224,164,
+178,224,164,174,224,164,191,224,164,178,224,165,135,224,164,178,224,165,135,224,
+164,150,224,164,149,224,164,181,224,164,191,224,164,183,224,164,175,224,164,149,
+224,165,141,224,164,176,224,164,130,224,164,184,224,164,174,224,165,130,224,164,
+185,224,164,165,224,164,190,224,164,168,224,164,190,216,170,216,179,216,170,216,
+183,217,138,216,185,217,133,216,180,216,167,216,177,217,131,216,169,216,168,217,
+136,216,167,216,179,216,183,216,169,216,167,217,132,216,181,217,129,216,173,216,
+169,217,133,217,136,216,167,216,182,217,138,216,185,216,167,217,132,216,174,216,
+167,216,181,216,169,216,167,217,132,217,133,216,178,217,138,216,175,216,167,217,
+132,216,185,216,167,217,133,216,169,216,167,217,132,217,131,216,167,216,170,216,
+168,216,167,217,132,216,177,216,175,217,136,216,175,216,168,216,177,217,134,216,
+167,217,133,216,172,216,167,217,132,216,175,217,136,217,132,216,169,216,167,217,
+132,216,185,216,167,217,132,217,133,216,167,217,132,217,133,217,136,217,130,216,
+185,216,167,217,132,216,185,216,177,216,168,217,138,216,167,217,132,216,179,216,
+177,217,138,216,185,216,167,217,132,216,172,217,136,216,167,217,132,216,167,217,
+132,216,176,217,135,216,167,216,168,216,167,217,132,216,173,217,138,216,167,216,
+169,216,167,217,132,216,173,217,130,217,136,217,130,216,167,217,132,217,131,216,
+177,217,138,217,133,216,167,217,132,216,185,216,177,216,167,217,130,217,133,216,
+173,217,129,217,136,216,184,216,169,216,167,217,132,216,171,216,167,217,134,217,
+138,217,133,216,180,216,167,217,135,216,175,216,169,216,167,217,132,217,133,216,
+177,216,163,216,169,216,167,217,132,217,130,216,177,216,162,217,134,216,167,217,
+132,216,180,216,168,216,167,216,168,216,167,217,132,216,173,217,136,216,167,216,
+177,216,167,217,132,216,172,216,175,217,138,216,175,216,167,217,132,216,163,216,
+179,216,177,216,169,216,167,217,132,216,185,217,132,217,136,217,133,217,133,216,
+172,217,133,217,136,216,185,216,169,216,167,217,132,216,177,216,173,217,133,217,
+134,216,167,217,132,217,134,217,130,216,167,216,183,217,129,217,132,216,179,216,
+183,217,138,217,134,216,167,217,132,217,131,217,136,217,138,216,170,216,167,217,
+132,216,175,217,134,217,138,216,167,216,168,216,177,217,131,216,167,216,170,217,
+135,216,167,217,132,216,177,217,138,216,167,216,182,216,170,216,173,217,138,216,
+167,216,170,217,138,216,168,216,170,217,136,217,130,217,138,216,170,216,167,217,
+132,216,163,217,136,217,132,217,137,216,167,217,132,216,168,216,177,217,138,216,
+175,216,167,217,132,217,131,217,132,216,167,217,133,216,167,217,132,216,177,216,
+167,216,168,216,183,216,167,217,132,216,180,216,174,216,181,217,138,216,179,217,
+138,216,167,216,177,216,167,216,170,216,167,217,132,216,171,216,167,217,132,216,
+171,216,167,217,132,216,181,217,132,216,167,216,169,216,167,217,132,216,173,216,
+175,217,138,216,171,216,167,217,132,216,178,217,136,216,167,216,177,216,167,217,
+132,216,174,217,132,217,138,216,172,216,167,217,132,216,172,217,133,217,138,216,
+185,216,167,217,132,216,185,216,167,217,133,217,135,216,167,217,132,216,172,217,
+133,216,167,217,132,216,167,217,132,216,179,216,167,216,185,216,169,217,133,216,
+180,216,167,217,135,216,175,217,135,216,167,217,132,216,177,216,166,217,138,216,
+179,216,167,217,132,216,175,216,174,217,136,217,132,216,167,217,132,217,129,217,
+134,217,138,216,169,216,167,217,132,217,131,216,170,216,167,216,168,216,167,217,
+132,216,175,217,136,216,177,217,138,216,167,217,132,216,175,216,177,217,136,216,
+179,216,167,216,179,216,170,216,186,216,177,217,130,216,170,216,181,216,167,217,
+133,217,138,217,133,216,167,217,132,216,168,217,134,216,167,216,170,216,167,217,
+132,216,185,216,184,217,138,217,133,101,110,116,101,114,116,97,105,110,109,101,
+110,116,117,110,100,101,114,115,116,97,110,100,105,110,103,32,61,32,102,117,110,
+99,116,105,111,110,40,41,46,106,112,103,34,32,119,105,100,116,104,61,34,99,111,
+110,102,105,103,117,114,97,116,105,111,110,46,112,110,103,34,32,119,105,100,116,
+104,61,34,60,98,111,100,121,32,99,108,97,115,115,61,34,77,97,116,104,46,114,97,
+110,100,111,109,40,41,99,111,110,116,101,109,112,111,114,97,114,121,32,85,110,
+105,116,101,100,32,83,116,97,116,101,115,99,105,114,99,117,109,115,116,97,110,99
+,101,115,46,97,112,112,101,110,100,67,104,105,108,100,40,111,114,103,97,110,105,
+122,97,116,105,111,110,115,60,115,112,97,110,32,99,108,97,115,115,61,34,34,62,60
+,105,109,103,32,115,114,99,61,34,47,100,105,115,116,105,110,103,117,105,115,104,
+101,100,116,104,111,117,115,97,110,100,115,32,111,102,32,99,111,109,109,117,110,
+105,99,97,116,105,111,110,99,108,101,97,114,34,62,60,47,100,105,118,62,105,110,
+118,101,115,116,105,103,97,116,105,111,110,102,97,118,105,99,111,110,46,105,99,
+111,34,32,109,97,114,103,105,110,45,114,105,103,104,116,58,98,97,115,101,100,32,
+111,110,32,116,104,101,32,77,97,115,115,97,99,104,117,115,101,116,116,115,116,97
+,98,108,101,32,98,111,114,100,101,114,61,105,110,116,101,114,110,97,116,105,111,
+110,97,108,97,108,115,111,32,107,110,111,119,110,32,97,115,112,114,111,110,117,
+110,99,105,97,116,105,111,110,98,97,99,107,103,114,111,117,110,100,58,35,102,112
+,97,100,100,105,110,103,45,108,101,102,116,58,70,111,114,32,101,120,97,109,112,
+108,101,44,32,109,105,115,99,101,108,108,97,110,101,111,117,115,38,108,116,59,47
+,109,97,116,104,38,103,116,59,112,115,121,99,104,111,108,111,103,105,99,97,108,
+105,110,32,112,97,114,116,105,99,117,108,97,114,101,97,114,99,104,34,32,116,121,
+112,101,61,34,102,111,114,109,32,109,101,116,104,111,100,61,34,97,115,32,111,112
+,112,111,115,101,100,32,116,111,83,117,112,114,101,109,101,32,67,111,117,114,116
+,111,99,99,97,115,105,111,110,97,108,108,121,32,65,100,100,105,116,105,111,110,
+97,108,108,121,44,78,111,114,116,104,32,65,109,101,114,105,99,97,112,120,59,98,
+97,99,107,103,114,111,117,110,100,111,112,112,111,114,116,117,110,105,116,105,
+101,115,69,110,116,101,114,116,97,105,110,109,101,110,116,46,116,111,76,111,119,
+101,114,67,97,115,101,40,109,97,110,117,102,97,99,116,117,114,105,110,103,112,
+114,111,102,101,115,115,105,111,110,97,108,32,99,111,109,98,105,110,101,100,32,
+119,105,116,104,70,111,114,32,105,110,115,116,97,110,99,101,44,99,111,110,115,
+105,115,116,105,110,103,32,111,102,34,32,109,97,120,108,101,110,103,116,104,61,
+34,114,101,116,117,114,110,32,102,97,108,115,101,59,99,111,110,115,99,105,111,
+117,115,110,101,115,115,77,101,100,105,116,101,114,114,97,110,101,97,110,101,120
+,116,114,97,111,114,100,105,110,97,114,121,97,115,115,97,115,115,105,110,97,116,
+105,111,110,115,117,98,115,101,113,117,101,110,116,108,121,32,98,117,116,116,111
+,110,32,116,121,112,101,61,34,116,104,101,32,110,117,109,98,101,114,32,111,102,
+116,104,101,32,111,114,105,103,105,110,97,108,32,99,111,109,112,114,101,104,101,
+110,115,105,118,101,114,101,102,101,114,115,32,116,111,32,116,104,101,60,47,117,
+108,62,10,60,47,100,105,118,62,10,112,104,105,108,111,115,111,112,104,105,99,97,
+108,108,111,99,97,116,105,111,110,46,104,114,101,102,119,97,115,32,112,117,98,
+108,105,115,104,101,100,83,97,110,32,70,114,97,110,99,105,115,99,111,40,102,117,
+110,99,116,105,111,110,40,41,123,10,60,100,105,118,32,105,100,61,34,109,97,105,
+110,115,111,112,104,105,115,116,105,99,97,116,101,100,109,97,116,104,101,109,97,
+116,105,99,97,108,32,47,104,101,97,100,62,13,10,60,98,111,100,121,115,117,103,
+103,101,115,116,115,32,116,104,97,116,100,111,99,117,109,101,110,116,97,116,105,
+111,110,99,111,110,99,101,110,116,114,97,116,105,111,110,114,101,108,97,116,105,
+111,110,115,104,105,112,115,109,97,121,32,104,97,118,101,32,98,101,101,110,40,
+102,111,114,32,101,120,97,109,112,108,101,44,84,104,105,115,32,97,114,116,105,99
+,108,101,32,105,110,32,115,111,109,101,32,99,97,115,101,115,112,97,114,116,115,
+32,111,102,32,116,104,101,32,100,101,102,105,110,105,116,105,111,110,32,111,102,
+71,114,101,97,116,32,66,114,105,116,97,105,110,32,99,101,108,108,112,97,100,100,
+105,110,103,61,101,113,117,105,118,97,108,101,110,116,32,116,111,112,108,97,99,
+101,104,111,108,100,101,114,61,34,59,32,102,111,110,116,45,115,105,122,101,58,32
+,106,117,115,116,105,102,105,99,97,116,105,111,110,98,101,108,105,101,118,101,
+100,32,116,104,97,116,115,117,102,102,101,114,101,100,32,102,114,111,109,97,116,
+116,101,109,112,116,101,100,32,116,111,32,108,101,97,100,101,114,32,111,102,32,
+116,104,101,99,114,105,112,116,34,32,115,114,99,61,34,47,40,102,117,110,99,116,
+105,111,110,40,41,32,123,97,114,101,32,97,118,97,105,108,97,98,108,101,10,9,60,
+108,105,110,107,32,114,101,108,61,34,32,115,114,99,61,39,104,116,116,112,58,47,
+47,105,110,116,101,114,101,115,116,101,100,32,105,110,99,111,110,118,101,110,116
+,105,111,110,97,108,32,34,32,97,108,116,61,34,34,32,47,62,60,47,97,114,101,32,
+103,101,110,101,114,97,108,108,121,104,97,115,32,97,108,115,111,32,98,101,101,
+110,109,111,115,116,32,112,111,112,117,108,97,114,32,99,111,114,114,101,115,112,
+111,110,100,105,110,103,99,114,101,100,105,116,101,100,32,119,105,116,104,116,
+121,108,101,61,34,98,111,114,100,101,114,58,60,47,97,62,60,47,115,112,97,110,62,
+60,47,46,103,105,102,34,32,119,105,100,116,104,61,34,60,105,102,114,97,109,101,
+32,115,114,99,61,34,116,97,98,108,101,32,99,108,97,115,115,61,34,105,110,108,105
+,110,101,45,98,108,111,99,107,59,97,99,99,111,114,100,105,110,103,32,116,111,32,
+116,111,103,101,116,104,101,114,32,119,105,116,104,97,112,112,114,111,120,105,
+109,97,116,101,108,121,112,97,114,108,105,97,109,101,110,116,97,114,121,109,111,
+114,101,32,97,110,100,32,109,111,114,101,100,105,115,112,108,97,121,58,110,111,
+110,101,59,116,114,97,100,105,116,105,111,110,97,108,108,121,112,114,101,100,111
+,109,105,110,97,110,116,108,121,38,110,98,115,112,59,124,38,110,98,115,112,59,38
+,110,98,115,112,59,60,47,115,112,97,110,62,32,99,101,108,108,115,112,97,99,105,
+110,103,61,60,105,110,112,117,116,32,110,97,109,101,61,34,111,114,34,32,99,111,
+110,116,101,110,116,61,34,99,111,110,116,114,111,118,101,114,115,105,97,108,112,
+114,111,112,101,114,116,121,61,34,111,103,58,47,120,45,115,104,111,99,107,119,97
+,118,101,45,100,101,109,111,110,115,116,114,97,116,105,111,110,115,117,114,114,
+111,117,110,100,101,100,32,98,121,78,101,118,101,114,116,104,101,108,101,115,115
+,44,119,97,115,32,116,104,101,32,102,105,114,115,116,99,111,110,115,105,100,101,
+114,97,98,108,101,32,65,108,116,104,111,117,103,104,32,116,104,101,32,99,111,108
+,108,97,98,111,114,97,116,105,111,110,115,104,111,117,108,100,32,110,111,116,32,
+98,101,112,114,111,112,111,114,116,105,111,110,32,111,102,60,115,112,97,110,32,
+115,116,121,108,101,61,34,107,110,111,119,110,32,97,115,32,116,104,101,32,115,
+104,111,114,116,108,121,32,97,102,116,101,114,102,111,114,32,105,110,115,116,97,
+110,99,101,44,100,101,115,99,114,105,98,101,100,32,97,115,32,47,104,101,97,100,
+62,10,60,98,111,100,121,32,115,116,97,114,116,105,110,103,32,119,105,116,104,105
+,110,99,114,101,97,115,105,110,103,108,121,32,116,104,101,32,102,97,99,116,32,
+116,104,97,116,100,105,115,99,117,115,115,105,111,110,32,111,102,109,105,100,100
+,108,101,32,111,102,32,116,104,101,97,110,32,105,110,100,105,118,105,100,117,97,
+108,100,105,102,102,105,99,117,108,116,32,116,111,32,112,111,105,110,116,32,111,
+102,32,118,105,101,119,104,111,109,111,115,101,120,117,97,108,105,116,121,97,99,
+99,101,112,116,97,110,99,101,32,111,102,60,47,115,112,97,110,62,60,47,100,105,
+118,62,109,97,110,117,102,97,99,116,117,114,101,114,115,111,114,105,103,105,110,
+32,111,102,32,116,104,101,99,111,109,109,111,110,108,121,32,117,115,101,100,105,
+109,112,111,114,116,97,110,99,101,32,111,102,100,101,110,111,109,105,110,97,116,
+105,111,110,115,98,97,99,107,103,114,111,117,110,100,58,32,35,108,101,110,103,
+116,104,32,111,102,32,116,104,101,100,101,116,101,114,109,105,110,97,116,105,111
+,110,97,32,115,105,103,110,105,102,105,99,97,110,116,34,32,98,111,114,100,101,
+114,61,34,48,34,62,114,101,118,111,108,117,116,105,111,110,97,114,121,112,114,
+105,110,99,105,112,108,101,115,32,111,102,105,115,32,99,111,110,115,105,100,101,
+114,101,100,119,97,115,32,100,101,118,101,108,111,112,101,100,73,110,100,111,45,
+69,117,114,111,112,101,97,110,118,117,108,110,101,114,97,98,108,101,32,116,111,
+112,114,111,112,111,110,101,110,116,115,32,111,102,97,114,101,32,115,111,109,101
+,116,105,109,101,115,99,108,111,115,101,114,32,116,111,32,116,104,101,78,101,119
+,32,89,111,114,107,32,67,105,116,121,32,110,97,109,101,61,34,115,101,97,114,99,
+104,97,116,116,114,105,98,117,116,101,100,32,116,111,99,111,117,114,115,101,32,
+111,102,32,116,104,101,109,97,116,104,101,109,97,116,105,99,105,97,110,98,121,32
+,116,104,101,32,101,110,100,32,111,102,97,116,32,116,104,101,32,101,110,100,32,
+111,102,34,32,98,111,114,100,101,114,61,34,48,34,32,116,101,99,104,110,111,108,
+111,103,105,99,97,108,46,114,101,109,111,118,101,67,108,97,115,115,40,98,114,97,
+110,99,104,32,111,102,32,116,104,101,101,118,105,100,101,110,99,101,32,116,104,
+97,116,33,91,101,110,100,105,102,93,45,45,62,13,10,73,110,115,116,105,116,117,
+116,101,32,111,102,32,105,110,116,111,32,97,32,115,105,110,103,108,101,114,101,
+115,112,101,99,116,105,118,101,108,121,46,97,110,100,32,116,104,101,114,101,102,
+111,114,101,112,114,111,112,101,114,116,105,101,115,32,111,102,105,115,32,108,
+111,99,97,116,101,100,32,105,110,115,111,109,101,32,111,102,32,119,104,105,99,
+104,84,104,101,114,101,32,105,115,32,97,108,115,111,99,111,110,116,105,110,117,
+101,100,32,116,111,32,97,112,112,101,97,114,97,110,99,101,32,111,102,32,38,97,
+109,112,59,110,100,97,115,104,59,32,100,101,115,99,114,105,98,101,115,32,116,104
+,101,99,111,110,115,105,100,101,114,97,116,105,111,110,97,117,116,104,111,114,32
+,111,102,32,116,104,101,105,110,100,101,112,101,110,100,101,110,116,108,121,101,
+113,117,105,112,112,101,100,32,119,105,116,104,100,111,101,115,32,110,111,116,32
+,104,97,118,101,60,47,97,62,60,97,32,104,114,101,102,61,34,99,111,110,102,117,
+115,101,100,32,119,105,116,104,60,108,105,110,107,32,104,114,101,102,61,34,47,97
+,116,32,116,104,101,32,97,103,101,32,111,102,97,112,112,101,97,114,32,105,110,32
+,116,104,101,84,104,101,115,101,32,105,110,99,108,117,100,101,114,101,103,97,114
+,100,108,101,115,115,32,111,102,99,111,117,108,100,32,98,101,32,117,115,101,100,
+32,115,116,121,108,101,61,38,113,117,111,116,59,115,101,118,101,114,97,108,32,
+116,105,109,101,115,114,101,112,114,101,115,101,110,116,32,116,104,101,98,111,
+100,121,62,10,60,47,104,116,109,108,62,116,104,111,117,103,104,116,32,116,111,32
+,98,101,112,111,112,117,108,97,116,105,111,110,32,111,102,112,111,115,115,105,98
+,105,108,105,116,105,101,115,112,101,114,99,101,110,116,97,103,101,32,111,102,97
+,99,99,101,115,115,32,116,111,32,116,104,101,97,110,32,97,116,116,101,109,112,
+116,32,116,111,112,114,111,100,117,99,116,105,111,110,32,111,102,106,113,117,101
+,114,121,47,106,113,117,101,114,121,116,119,111,32,100,105,102,102,101,114,101,
+110,116,98,101,108,111,110,103,32,116,111,32,116,104,101,101,115,116,97,98,108,
+105,115,104,109,101,110,116,114,101,112,108,97,99,105,110,103,32,116,104,101,100
+,101,115,99,114,105,112,116,105,111,110,34,32,100,101,116,101,114,109,105,110,
+101,32,116,104,101,97,118,97,105,108,97,98,108,101,32,102,111,114,65,99,99,111,
+114,100,105,110,103,32,116,111,32,119,105,100,101,32,114,97,110,103,101,32,111,
+102,9,60,100,105,118,32,99,108,97,115,115,61,34,109,111,114,101,32,99,111,109,
+109,111,110,108,121,111,114,103,97,110,105,115,97,116,105,111,110,115,102,117,
+110,99,116,105,111,110,97,108,105,116,121,119,97,115,32,99,111,109,112,108,101,
+116,101,100,32,38,97,109,112,59,109,100,97,115,104,59,32,112,97,114,116,105,99,
+105,112,97,116,105,111,110,116,104,101,32,99,104,97,114,97,99,116,101,114,97,110
+,32,97,100,100,105,116,105,111,110,97,108,97,112,112,101,97,114,115,32,116,111,
+32,98,101,102,97,99,116,32,116,104,97,116,32,116,104,101,97,110,32,101,120,97,
+109,112,108,101,32,111,102,115,105,103,110,105,102,105,99,97,110,116,108,121,111
+,110,109,111,117,115,101,111,118,101,114,61,34,98,101,99,97,117,115,101,32,116,
+104,101,121,32,97,115,121,110,99,32,61,32,116,114,117,101,59,112,114,111,98,108,
+101,109,115,32,119,105,116,104,115,101,101,109,115,32,116,111,32,104,97,118,101,
+116,104,101,32,114,101,115,117,108,116,32,111,102,32,115,114,99,61,34,104,116,
+116,112,58,47,47,102,97,109,105,108,105,97,114,32,119,105,116,104,112,111,115,
+115,101,115,115,105,111,110,32,111,102,102,117,110,99,116,105,111,110,32,40,41,
+32,123,116,111,111,107,32,112,108,97,99,101,32,105,110,97,110,100,32,115,111,109
+,101,116,105,109,101,115,115,117,98,115,116,97,110,116,105,97,108,108,121,60,115
+,112,97,110,62,60,47,115,112,97,110,62,105,115,32,111,102,116,101,110,32,117,115
+,101,100,105,110,32,97,110,32,97,116,116,101,109,112,116,103,114,101,97,116,32,
+100,101,97,108,32,111,102,69,110,118,105,114,111,110,109,101,110,116,97,108,115,
+117,99,99,101,115,115,102,117,108,108,121,32,118,105,114,116,117,97,108,108,121,
+32,97,108,108,50,48,116,104,32,99,101,110,116,117,114,121,44,112,114,111,102,101
+,115,115,105,111,110,97,108,115,110,101,99,101,115,115,97,114,121,32,116,111,32,
+100,101,116,101,114,109,105,110,101,100,32,98,121,99,111,109,112,97,116,105,98,
+105,108,105,116,121,98,101,99,97,117,115,101,32,105,116,32,105,115,68,105,99,116
+,105,111,110,97,114,121,32,111,102,109,111,100,105,102,105,99,97,116,105,111,110
+,115,84,104,101,32,102,111,108,108,111,119,105,110,103,109,97,121,32,114,101,102
+,101,114,32,116,111,58,67,111,110,115,101,113,117,101,110,116,108,121,44,73,110,
+116,101,114,110,97,116,105,111,110,97,108,97,108,116,104,111,117,103,104,32,115,
+111,109,101,116,104,97,116,32,119,111,117,108,100,32,98,101,119,111,114,108,100,
+39,115,32,102,105,114,115,116,99,108,97,115,115,105,102,105,101,100,32,97,115,98
+,111,116,116,111,109,32,111,102,32,116,104,101,40,112,97,114,116,105,99,117,108,
+97,114,108,121,97,108,105,103,110,61,34,108,101,102,116,34,32,109,111,115,116,32
+,99,111,109,109,111,110,108,121,98,97,115,105,115,32,102,111,114,32,116,104,101,
+102,111,117,110,100,97,116,105,111,110,32,111,102,99,111,110,116,114,105,98,117,
+116,105,111,110,115,112,111,112,117,108,97,114,105,116,121,32,111,102,99,101,110
+,116,101,114,32,111,102,32,116,104,101,116,111,32,114,101,100,117,99,101,32,116,
+104,101,106,117,114,105,115,100,105,99,116,105,111,110,115,97,112,112,114,111,
+120,105,109,97,116,105,111,110,32,111,110,109,111,117,115,101,111,117,116,61,34,
+78,101,119,32,84,101,115,116,97,109,101,110,116,99,111,108,108,101,99,116,105,
+111,110,32,111,102,60,47,115,112,97,110,62,60,47,97,62,60,47,105,110,32,116,104,
+101,32,85,110,105,116,101,100,102,105,108,109,32,100,105,114,101,99,116,111,114,
+45,115,116,114,105,99,116,46,100,116,100,34,62,104,97,115,32,98,101,101,110,32,
+117,115,101,100,114,101,116,117,114,110,32,116,111,32,116,104,101,97,108,116,104
+,111,117,103,104,32,116,104,105,115,99,104,97,110,103,101,32,105,110,32,116,104,
+101,115,101,118,101,114,97,108,32,111,116,104,101,114,98,117,116,32,116,104,101,
+114,101,32,97,114,101,117,110,112,114,101,99,101,100,101,110,116,101,100,105,115
+,32,115,105,109,105,108,97,114,32,116,111,101,115,112,101,99,105,97,108,108,121,
+32,105,110,119,101,105,103,104,116,58,32,98,111,108,100,59,105,115,32,99,97,108,
+108,101,100,32,116,104,101,99,111,109,112,117,116,97,116,105,111,110,97,108,105,
+110,100,105,99,97,116,101,32,116,104,97,116,114,101,115,116,114,105,99,116,101,
+100,32,116,111,9,60,109,101,116,97,32,110,97,109,101,61,34,97,114,101,32,116,121
+,112,105,99,97,108,108,121,99,111,110,102,108,105,99,116,32,119,105,116,104,72,
+111,119,101,118,101,114,44,32,116,104,101,32,65,110,32,101,120,97,109,112,108,
+101,32,111,102,99,111,109,112,97,114,101,100,32,119,105,116,104,113,117,97,110,
+116,105,116,105,101,115,32,111,102,114,97,116,104,101,114,32,116,104,97,110,32,
+97,99,111,110,115,116,101,108,108,97,116,105,111,110,110,101,99,101,115,115,97,
+114,121,32,102,111,114,114,101,112,111,114,116,101,100,32,116,104,97,116,115,112
+,101,99,105,102,105,99,97,116,105,111,110,112,111,108,105,116,105,99,97,108,32,
+97,110,100,38,110,98,115,112,59,38,110,98,115,112,59,60,114,101,102,101,114,101,
+110,99,101,115,32,116,111,116,104,101,32,115,97,109,101,32,121,101,97,114,71,111
+,118,101,114,110,109,101,110,116,32,111,102,103,101,110,101,114,97,116,105,111,
+110,32,111,102,104,97,118,101,32,110,111,116,32,98,101,101,110,115,101,118,101,
+114,97,108,32,121,101,97,114,115,99,111,109,109,105,116,109,101,110,116,32,116,
+111,9,9,60,117,108,32,99,108,97,115,115,61,34,118,105,115,117,97,108,105,122,97,
+116,105,111,110,49,57,116,104,32,99,101,110,116,117,114,121,44,112,114,97,99,116
+,105,116,105,111,110,101,114,115,116,104,97,116,32,104,101,32,119,111,117,108,
+100,97,110,100,32,99,111,110,116,105,110,117,101,100,111,99,99,117,112,97,116,
+105,111,110,32,111,102,105,115,32,100,101,102,105,110,101,100,32,97,115,99,101,
+110,116,114,101,32,111,102,32,116,104,101,116,104,101,32,97,109,111,117,110,116,
+32,111,102,62,60,100,105,118,32,115,116,121,108,101,61,34,101,113,117,105,118,97
+,108,101,110,116,32,111,102,100,105,102,102,101,114,101,110,116,105,97,116,101,
+98,114,111,117,103,104,116,32,97,98,111,117,116,109,97,114,103,105,110,45,108,
+101,102,116,58,32,97,117,116,111,109,97,116,105,99,97,108,108,121,116,104,111,
+117,103,104,116,32,111,102,32,97,115,83,111,109,101,32,111,102,32,116,104,101,
+115,101,10,60,100,105,118,32,99,108,97,115,115,61,34,105,110,112,117,116,32,99,
+108,97,115,115,61,34,114,101,112,108,97,99,101,100,32,119,105,116,104,105,115,32
+,111,110,101,32,111,102,32,116,104,101,101,100,117,99,97,116,105,111,110,32,97,
+110,100,105,110,102,108,117,101,110,99,101,100,32,98,121,114,101,112,117,116,97,
+116,105,111,110,32,97,115,10,60,109,101,116,97,32,110,97,109,101,61,34,97,99,99,
+111,109,109,111,100,97,116,105,111,110,60,47,100,105,118,62,10,60,47,100,105,118
+,62,108,97,114,103,101,32,112,97,114,116,32,111,102,73,110,115,116,105,116,117,
+116,101,32,102,111,114,116,104,101,32,115,111,45,99,97,108,108,101,100,32,97,103
+,97,105,110,115,116,32,116,104,101,32,73,110,32,116,104,105,115,32,99,97,115,101
+,44,119,97,115,32,97,112,112,111,105,110,116,101,100,99,108,97,105,109,101,100,
+32,116,111,32,98,101,72,111,119,101,118,101,114,44,32,116,104,105,115,68,101,112
+,97,114,116,109,101,110,116,32,111,102,116,104,101,32,114,101,109,97,105,110,105
+,110,103,101,102,102,101,99,116,32,111,110,32,116,104,101,112,97,114,116,105,99,
+117,108,97,114,108,121,32,100,101,97,108,32,119,105,116,104,32,116,104,101,10,60
+,100,105,118,32,115,116,121,108,101,61,34,97,108,109,111,115,116,32,97,108,119,
+97,121,115,97,114,101,32,99,117,114,114,101,110,116,108,121,101,120,112,114,101,
+115,115,105,111,110,32,111,102,112,104,105,108,111,115,111,112,104,121,32,111,
+102,102,111,114,32,109,111,114,101,32,116,104,97,110,99,105,118,105,108,105,122,
+97,116,105,111,110,115,111,110,32,116,104,101,32,105,115,108,97,110,100,115,101,
+108,101,99,116,101,100,73,110,100,101,120,99,97,110,32,114,101,115,117,108,116,
+32,105,110,34,32,118,97,108,117,101,61,34,34,32,47,62,116,104,101,32,115,116,114
+,117,99,116,117,114,101,32,47,62,60,47,97,62,60,47,100,105,118,62,77,97,110,121,
+32,111,102,32,116,104,101,115,101,99,97,117,115,101,100,32,98,121,32,116,104,101
+,111,102,32,116,104,101,32,85,110,105,116,101,100,115,112,97,110,32,99,108,97,
+115,115,61,34,109,99,97,110,32,98,101,32,116,114,97,99,101,100,105,115,32,114,
+101,108,97,116,101,100,32,116,111,98,101,99,97,109,101,32,111,110,101,32,111,102
+,105,115,32,102,114,101,113,117,101,110,116,108,121,108,105,118,105,110,103,32,
+105,110,32,116,104,101,116,104,101,111,114,101,116,105,99,97,108,108,121,70,111,
+108,108,111,119,105,110,103,32,116,104,101,82,101,118,111,108,117,116,105,111,
+110,97,114,121,103,111,118,101,114,110,109,101,110,116,32,105,110,105,115,32,100
+,101,116,101,114,109,105,110,101,100,116,104,101,32,112,111,108,105,116,105,99,
+97,108,105,110,116,114,111,100,117,99,101,100,32,105,110,115,117,102,102,105,99,
+105,101,110,116,32,116,111,100,101,115,99,114,105,112,116,105,111,110,34,62,115,
+104,111,114,116,32,115,116,111,114,105,101,115,115,101,112,97,114,97,116,105,111
+,110,32,111,102,97,115,32,116,111,32,119,104,101,116,104,101,114,107,110,111,119
+,110,32,102,111,114,32,105,116,115,119,97,115,32,105,110,105,116,105,97,108,108,
+121,100,105,115,112,108,97,121,58,98,108,111,99,107,105,115,32,97,110,32,101,120
+,97,109,112,108,101,116,104,101,32,112,114,105,110,99,105,112,97,108,99,111,110,
+115,105,115,116,115,32,111,102,32,97,114,101,99,111,103,110,105,122,101,100,32,
+97,115,47,98,111,100,121,62,60,47,104,116,109,108,62,97,32,115,117,98,115,116,97
+,110,116,105,97,108,114,101,99,111,110,115,116,114,117,99,116,101,100,104,101,97
+,100,32,111,102,32,115,116,97,116,101,114,101,115,105,115,116,97,110,99,101,32,
+116,111,117,110,100,101,114,103,114,97,100,117,97,116,101,84,104,101,114,101,32,
+97,114,101,32,116,119,111,103,114,97,118,105,116,97,116,105,111,110,97,108,97,
+114,101,32,100,101,115,99,114,105,98,101,100,105,110,116,101,110,116,105,111,110
+,97,108,108,121,115,101,114,118,101,100,32,97,115,32,116,104,101,99,108,97,115,
+115,61,34,104,101,97,100,101,114,111,112,112,111,115,105,116,105,111,110,32,116,
+111,102,117,110,100,97,109,101,110,116,97,108,108,121,100,111,109,105,110,97,116
+,101,100,32,116,104,101,97,110,100,32,116,104,101,32,111,116,104,101,114,97,108,
+108,105,97,110,99,101,32,119,105,116,104,119,97,115,32,102,111,114,99,101,100,32
+,116,111,114,101,115,112,101,99,116,105,118,101,108,121,44,97,110,100,32,112,111
+,108,105,116,105,99,97,108,105,110,32,115,117,112,112,111,114,116,32,111,102,112
+,101,111,112,108,101,32,105,110,32,116,104,101,50,48,116,104,32,99,101,110,116,
+117,114,121,46,97,110,100,32,112,117,98,108,105,115,104,101,100,108,111,97,100,
+67,104,97,114,116,98,101,97,116,116,111,32,117,110,100,101,114,115,116,97,110,
+100,109,101,109,98,101,114,32,115,116,97,116,101,115,101,110,118,105,114,111,110
+,109,101,110,116,97,108,102,105,114,115,116,32,104,97,108,102,32,111,102,99,111,
+117,110,116,114,105,101,115,32,97,110,100,97,114,99,104,105,116,101,99,116,117,
+114,97,108,98,101,32,99,111,110,115,105,100,101,114,101,100,99,104,97,114,97,99,
+116,101,114,105,122,101,100,99,108,101,97,114,73,110,116,101,114,118,97,108,97,
+117,116,104,111,114,105,116,97,116,105,118,101,70,101,100,101,114,97,116,105,111
+,110,32,111,102,119,97,115,32,115,117,99,99,101,101,100,101,100,97,110,100,32,
+116,104,101,114,101,32,97,114,101,97,32,99,111,110,115,101,113,117,101,110,99,
+101,116,104,101,32,80,114,101,115,105,100,101,110,116,97,108,115,111,32,105,110,
+99,108,117,100,101,100,102,114,101,101,32,115,111,102,116,119,97,114,101,115,117
+,99,99,101,115,115,105,111,110,32,111,102,100,101,118,101,108,111,112,101,100,32
+,116,104,101,119,97,115,32,100,101,115,116,114,111,121,101,100,97,119,97,121,32,
+102,114,111,109,32,116,104,101,59,10,60,47,115,99,114,105,112,116,62,10,60,97,
+108,116,104,111,117,103,104,32,116,104,101,121,102,111,108,108,111,119,101,100,
+32,98,121,32,97,109,111,114,101,32,112,111,119,101,114,102,117,108,114,101,115,
+117,108,116,101,100,32,105,110,32,97,85,110,105,118,101,114,115,105,116,121,32,
+111,102,72,111,119,101,118,101,114,44,32,109,97,110,121,116,104,101,32,112,114,
+101,115,105,100,101,110,116,72,111,119,101,118,101,114,44,32,115,111,109,101,105
+,115,32,116,104,111,117,103,104,116,32,116,111,117,110,116,105,108,32,116,104,
+101,32,101,110,100,119,97,115,32,97,110,110,111,117,110,99,101,100,97,114,101,32
+,105,109,112,111,114,116,97,110,116,97,108,115,111,32,105,110,99,108,117,100,101
+,115,62,60,105,110,112,117,116,32,116,121,112,101,61,116,104,101,32,99,101,110,
+116,101,114,32,111,102,32,68,79,32,78,79,84,32,65,76,84,69,82,117,115,101,100,32
+,116,111,32,114,101,102,101,114,116,104,101,109,101,115,47,63,115,111,114,116,61
+,116,104,97,116,32,104,97,100,32,98,101,101,110,116,104,101,32,98,97,115,105,115
+,32,102,111,114,104,97,115,32,100,101,118,101,108,111,112,101,100,105,110,32,116
+,104,101,32,115,117,109,109,101,114,99,111,109,112,97,114,97,116,105,118,101,108
+,121,100,101,115,99,114,105,98,101,100,32,116,104,101,115,117,99,104,32,97,115,
+32,116,104,111,115,101,116,104,101,32,114,101,115,117,108,116,105,110,103,105,
+115,32,105,109,112,111,115,115,105,98,108,101,118,97,114,105,111,117,115,32,111,
+116,104,101,114,83,111,117,116,104,32,65,102,114,105,99,97,110,104,97,118,101,32
+,116,104,101,32,115,97,109,101,101,102,102,101,99,116,105,118,101,110,101,115,
+115,105,110,32,119,104,105,99,104,32,99,97,115,101,59,32,116,101,120,116,45,97,
+108,105,103,110,58,115,116,114,117,99,116,117,114,101,32,97,110,100,59,32,98,97,
+99,107,103,114,111,117,110,100,58,114,101,103,97,114,100,105,110,103,32,116,104,
+101,115,117,112,112,111,114,116,101,100,32,116,104,101,105,115,32,97,108,115,111
+,32,107,110,111,119,110,115,116,121,108,101,61,34,109,97,114,103,105,110,105,110
+,99,108,117,100,105,110,103,32,116,104,101,98,97,104,97,115,97,32,77,101,108,97,
+121,117,110,111,114,115,107,32,98,111,107,109,195,165,108,110,111,114,115,107,32
+,110,121,110,111,114,115,107,115,108,111,118,101,110,197,161,196,141,105,110,97,
+105,110,116,101,114,110,97,99,105,111,110,97,108,99,97,108,105,102,105,99,97,99,
+105,195,179,110,99,111,109,117,110,105,99,97,99,105,195,179,110,99,111,110,115,
+116,114,117,99,99,105,195,179,110,34,62,60,100,105,118,32,99,108,97,115,115,61,
+34,100,105,115,97,109,98,105,103,117,97,116,105,111,110,68,111,109,97,105,110,78
+,97,109,101,39,44,32,39,97,100,109,105,110,105,115,116,114,97,116,105,111,110,
+115,105,109,117,108,116,97,110,101,111,117,115,108,121,116,114,97,110,115,112,
+111,114,116,97,116,105,111,110,73,110,116,101,114,110,97,116,105,111,110,97,108,
+32,109,97,114,103,105,110,45,98,111,116,116,111,109,58,114,101,115,112,111,110,
+115,105,98,105,108,105,116,121,60,33,91,101,110,100,105,102,93,45,45,62,10,60,47
+,62,60,109,101,116,97,32,110,97,109,101,61,34,105,109,112,108,101,109,101,110,
+116,97,116,105,111,110,105,110,102,114,97,115,116,114,117,99,116,117,114,101,114
+,101,112,114,101,115,101,110,116,97,116,105,111,110,98,111,114,100,101,114,45,98
+,111,116,116,111,109,58,60,47,104,101,97,100,62,10,60,98,111,100,121,62,61,104,
+116,116,112,37,51,65,37,50,70,37,50,70,60,102,111,114,109,32,109,101,116,104,111
+,100,61,34,109,101,116,104,111,100,61,34,112,111,115,116,34,32,47,102,97,118,105
+,99,111,110,46,105,99,111,34,32,125,41,59,10,60,47,115,99,114,105,112,116,62,10,
+46,115,101,116,65,116,116,114,105,98,117,116,101,40,65,100,109,105,110,105,115,
+116,114,97,116,105,111,110,61,32,110,101,119,32,65,114,114,97,121,40,41,59,60,33
+,91,101,110,100,105,102,93,45,45,62,13,10,100,105,115,112,108,97,121,58,98,108,
+111,99,107,59,85,110,102,111,114,116,117,110,97,116,101,108,121,44,34,62,38,110,
+98,115,112,59,60,47,100,105,118,62,47,102,97,118,105,99,111,110,46,105,99,111,34
+,62,61,39,115,116,121,108,101,115,104,101,101,116,39,32,105,100,101,110,116,105,
+102,105,99,97,116,105,111,110,44,32,102,111,114,32,101,120,97,109,112,108,101,44
+,60,108,105,62,60,97,32,104,114,101,102,61,34,47,97,110,32,97,108,116,101,114,
+110,97,116,105,118,101,97,115,32,97,32,114,101,115,117,108,116,32,111,102,112,
+116,34,62,60,47,115,99,114,105,112,116,62,10,116,121,112,101,61,34,115,117,98,
+109,105,116,34,32,10,40,102,117,110,99,116,105,111,110,40,41,32,123,114,101,99,
+111,109,109,101,110,100,97,116,105,111,110,102,111,114,109,32,97,99,116,105,111,
+110,61,34,47,116,114,97,110,115,102,111,114,109,97,116,105,111,110,114,101,99,
+111,110,115,116,114,117,99,116,105,111,110,46,115,116,121,108,101,46,100,105,115
+,112,108,97,121,32,65,99,99,111,114,100,105,110,103,32,116,111,32,104,105,100,
+100,101,110,34,32,110,97,109,101,61,34,97,108,111,110,103,32,119,105,116,104,32,
+116,104,101,100,111,99,117,109,101,110,116,46,98,111,100,121,46,97,112,112,114,
+111,120,105,109,97,116,101,108,121,32,67,111,109,109,117,110,105,99,97,116,105,
+111,110,115,112,111,115,116,34,32,97,99,116,105,111,110,61,34,109,101,97,110,105
+,110,103,32,38,113,117,111,116,59,45,45,60,33,91,101,110,100,105,102,93,45,45,62
+,80,114,105,109,101,32,77,105,110,105,115,116,101,114,99,104,97,114,97,99,116,
+101,114,105,115,116,105,99,60,47,97,62,32,60,97,32,99,108,97,115,115,61,116,104,
+101,32,104,105,115,116,111,114,121,32,111,102,32,111,110,109,111,117,115,101,111
+,118,101,114,61,34,116,104,101,32,103,111,118,101,114,110,109,101,110,116,104,
+114,101,102,61,34,104,116,116,112,115,58,47,47,119,97,115,32,111,114,105,103,105
+,110,97,108,108,121,119,97,115,32,105,110,116,114,111,100,117,99,101,100,99,108,
+97,115,115,105,102,105,99,97,116,105,111,110,114,101,112,114,101,115,101,110,116
+,97,116,105,118,101,97,114,101,32,99,111,110,115,105,100,101,114,101,100,60,33,
+91,101,110,100,105,102,93,45,45,62,10,10,100,101,112,101,110,100,115,32,111,110,
+32,116,104,101,85,110,105,118,101,114,115,105,116,121,32,111,102,32,105,110,32,
+99,111,110,116,114,97,115,116,32,116,111,32,112,108,97,99,101,104,111,108,100,
+101,114,61,34,105,110,32,116,104,101,32,99,97,115,101,32,111,102,105,110,116,101
+,114,110,97,116,105,111,110,97,108,32,99,111,110,115,116,105,116,117,116,105,111
+,110,97,108,115,116,121,108,101,61,34,98,111,114,100,101,114,45,58,32,102,117,
+110,99,116,105,111,110,40,41,32,123,66,101,99,97,117,115,101,32,111,102,32,116,
+104,101,45,115,116,114,105,99,116,46,100,116,100,34,62,10,60,116,97,98,108,101,
+32,99,108,97,115,115,61,34,97,99,99,111,109,112,97,110,105,101,100,32,98,121,97,
+99,99,111,117,110,116,32,111,102,32,116,104,101,60,115,99,114,105,112,116,32,115
+,114,99,61,34,47,110,97,116,117,114,101,32,111,102,32,116,104,101,32,116,104,101
+,32,112,101,111,112,108,101,32,105,110,32,105,110,32,97,100,100,105,116,105,111,
+110,32,116,111,115,41,59,32,106,115,46,105,100,32,61,32,105,100,34,32,119,105,
+100,116,104,61,34,49,48,48,37,34,114,101,103,97,114,100,105,110,103,32,116,104,
+101,32,82,111,109,97,110,32,67,97,116,104,111,108,105,99,97,110,32,105,110,100,
+101,112,101,110,100,101,110,116,102,111,108,108,111,119,105,110,103,32,116,104,
+101,32,46,103,105,102,34,32,119,105,100,116,104,61,34,49,116,104,101,32,102,111,
+108,108,111,119,105,110,103,32,100,105,115,99,114,105,109,105,110,97,116,105,111
+,110,97,114,99,104,97,101,111,108,111,103,105,99,97,108,112,114,105,109,101,32,
+109,105,110,105,115,116,101,114,46,106,115,34,62,60,47,115,99,114,105,112,116,62
+,99,111,109,98,105,110,97,116,105,111,110,32,111,102,32,109,97,114,103,105,110,
+119,105,100,116,104,61,34,99,114,101,97,116,101,69,108,101,109,101,110,116,40,
+119,46,97,116,116,97,99,104,69,118,101,110,116,40,60,47,97,62,60,47,116,100,62,
+60,47,116,114,62,115,114,99,61,34,104,116,116,112,115,58,47,47,97,73,110,32,112,
+97,114,116,105,99,117,108,97,114,44,32,97,108,105,103,110,61,34,108,101,102,116,
+34,32,67,122,101,99,104,32,82,101,112,117,98,108,105,99,85,110,105,116,101,100,
+32,75,105,110,103,100,111,109,99,111,114,114,101,115,112,111,110,100,101,110,99,
+101,99,111,110,99,108,117,100,101,100,32,116,104,97,116,46,104,116,109,108,34,32
+,116,105,116,108,101,61,34,40,102,117,110,99,116,105,111,110,32,40,41,32,123,99,
+111,109,101,115,32,102,114,111,109,32,116,104,101,97,112,112,108,105,99,97,116,
+105,111,110,32,111,102,60,115,112,97,110,32,99,108,97,115,115,61,34,115,98,101,
+108,105,101,118,101,100,32,116,111,32,98,101,101,109,101,110,116,40,39,115,99,
+114,105,112,116,39,60,47,97,62,10,60,47,108,105,62,10,60,108,105,118,101,114,121
+,32,100,105,102,102,101,114,101,110,116,62,60,115,112,97,110,32,99,108,97,115,
+115,61,34,111,112,116,105,111,110,32,118,97,108,117,101,61,34,40,97,108,115,111,
+32,107,110,111,119,110,32,97,115,9,60,108,105,62,60,97,32,104,114,101,102,61,34,
+62,60,105,110,112,117,116,32,110,97,109,101,61,34,115,101,112,97,114,97,116,101,
+100,32,102,114,111,109,114,101,102,101,114,114,101,100,32,116,111,32,97,115,32,
+118,97,108,105,103,110,61,34,116,111,112,34,62,102,111,117,110,100,101,114,32,
+111,102,32,116,104,101,97,116,116,101,109,112,116,105,110,103,32,116,111,32,99,
+97,114,98,111,110,32,100,105,111,120,105,100,101,10,10,60,100,105,118,32,99,108,
+97,115,115,61,34,99,108,97,115,115,61,34,115,101,97,114,99,104,45,47,98,111,100,
+121,62,10,60,47,104,116,109,108,62,111,112,112,111,114,116,117,110,105,116,121,
+32,116,111,99,111,109,109,117,110,105,99,97,116,105,111,110,115,60,47,104,101,97
+,100,62,13,10,60,98,111,100,121,32,115,116,121,108,101,61,34,119,105,100,116,104
+,58,84,105,225,186,191,110,103,32,86,105,225,187,135,116,99,104,97,110,103,101,
+115,32,105,110,32,116,104,101,98,111,114,100,101,114,45,99,111,108,111,114,58,35
+,48,34,32,98,111,114,100,101,114,61,34,48,34,32,60,47,115,112,97,110,62,60,47,
+100,105,118,62,60,119,97,115,32,100,105,115,99,111,118,101,114,101,100,34,32,116
+,121,112,101,61,34,116,101,120,116,34,32,41,59,10,60,47,115,99,114,105,112,116,
+62,10,10,68,101,112,97,114,116,109,101,110,116,32,111,102,32,101,99,99,108,101,
+115,105,97,115,116,105,99,97,108,116,104,101,114,101,32,104,97,115,32,98,101,101
+,110,114,101,115,117,108,116,105,110,103,32,102,114,111,109,60,47,98,111,100,121
+,62,60,47,104,116,109,108,62,104,97,115,32,110,101,118,101,114,32,98,101,101,110
+,116,104,101,32,102,105,114,115,116,32,116,105,109,101,105,110,32,114,101,115,
+112,111,110,115,101,32,116,111,97,117,116,111,109,97,116,105,99,97,108,108,121,
+32,60,47,100,105,118,62,10,10,60,100,105,118,32,105,119,97,115,32,99,111,110,115
+,105,100,101,114,101,100,112,101,114,99,101,110,116,32,111,102,32,116,104,101,34
+,32,47,62,60,47,97,62,60,47,100,105,118,62,99,111,108,108,101,99,116,105,111,110
+,32,111,102,32,100,101,115,99,101,110,100,101,100,32,102,114,111,109,115,101,99,
+116,105,111,110,32,111,102,32,116,104,101,97,99,99,101,112,116,45,99,104,97,114,
+115,101,116,116,111,32,98,101,32,99,111,110,102,117,115,101,100,109,101,109,98,
+101,114,32,111,102,32,116,104,101,32,112,97,100,100,105,110,103,45,114,105,103,
+104,116,58,116,114,97,110,115,108,97,116,105,111,110,32,111,102,105,110,116,101,
+114,112,114,101,116,97,116,105,111,110,32,104,114,101,102,61,39,104,116,116,112,
+58,47,47,119,104,101,116,104,101,114,32,111,114,32,110,111,116,84,104,101,114,
+101,32,97,114,101,32,97,108,115,111,116,104,101,114,101,32,97,114,101,32,109,97,
+110,121,97,32,115,109,97,108,108,32,110,117,109,98,101,114,111,116,104,101,114,
+32,112,97,114,116,115,32,111,102,105,109,112,111,115,115,105,98,108,101,32,116,
+111,32,32,99,108,97,115,115,61,34,98,117,116,116,111,110,108,111,99,97,116,101,
+100,32,105,110,32,116,104,101,46,32,72,111,119,101,118,101,114,44,32,116,104,101
+,97,110,100,32,101,118,101,110,116,117,97,108,108,121,65,116,32,116,104,101,32,
+101,110,100,32,111,102,32,98,101,99,97,117,115,101,32,111,102,32,105,116,115,114
+,101,112,114,101,115,101,110,116,115,32,116,104,101,60,102,111,114,109,32,97,99,
+116,105,111,110,61,34,32,109,101,116,104,111,100,61,34,112,111,115,116,34,105,
+116,32,105,115,32,112,111,115,115,105,98,108,101,109,111,114,101,32,108,105,107,
+101,108,121,32,116,111,97,110,32,105,110,99,114,101,97,115,101,32,105,110,104,97
+,118,101,32,97,108,115,111,32,98,101,101,110,99,111,114,114,101,115,112,111,110,
+100,115,32,116,111,97,110,110,111,117,110,99,101,100,32,116,104,97,116,97,108,
+105,103,110,61,34,114,105,103,104,116,34,62,109,97,110,121,32,99,111,117,110,116
+,114,105,101,115,102,111,114,32,109,97,110,121,32,121,101,97,114,115,101,97,114,
+108,105,101,115,116,32,107,110,111,119,110,98,101,99,97,117,115,101,32,105,116,
+32,119,97,115,112,116,34,62,60,47,115,99,114,105,112,116,62,13,32,118,97,108,105
+,103,110,61,34,116,111,112,34,32,105,110,104,97,98,105,116,97,110,116,115,32,111
+,102,102,111,108,108,111,119,105,110,103,32,121,101,97,114,13,10,60,100,105,118,
+32,99,108,97,115,115,61,34,109,105,108,108,105,111,110,32,112,101,111,112,108,
+101,99,111,110,116,114,111,118,101,114,115,105,97,108,32,99,111,110,99,101,114,
+110,105,110,103,32,116,104,101,97,114,103,117,101,32,116,104,97,116,32,116,104,
+101,103,111,118,101,114,110,109,101,110,116,32,97,110,100,97,32,114,101,102,101,
+114,101,110,99,101,32,116,111,116,114,97,110,115,102,101,114,114,101,100,32,116,
+111,100,101,115,99,114,105,98,105,110,103,32,116,104,101,32,115,116,121,108,101,
+61,34,99,111,108,111,114,58,97,108,116,104,111,117,103,104,32,116,104,101,114,
+101,98,101,115,116,32,107,110,111,119,110,32,102,111,114,115,117,98,109,105,116,
+34,32,110,97,109,101,61,34,109,117,108,116,105,112,108,105,99,97,116,105,111,110
+,109,111,114,101,32,116,104,97,110,32,111,110,101,32,114,101,99,111,103,110,105,
+116,105,111,110,32,111,102,67,111,117,110,99,105,108,32,111,102,32,116,104,101,
+101,100,105,116,105,111,110,32,111,102,32,116,104,101,32,32,60,109,101,116,97,32
+,110,97,109,101,61,34,69,110,116,101,114,116,97,105,110,109,101,110,116,32,97,
+119,97,121,32,102,114,111,109,32,116,104,101,32,59,109,97,114,103,105,110,45,114
+,105,103,104,116,58,97,116,32,116,104,101,32,116,105,109,101,32,111,102,105,110,
+118,101,115,116,105,103,97,116,105,111,110,115,99,111,110,110,101,99,116,101,100
+,32,119,105,116,104,97,110,100,32,109,97,110,121,32,111,116,104,101,114,97,108,
+116,104,111,117,103,104,32,105,116,32,105,115,98,101,103,105,110,110,105,110,103
+,32,119,105,116,104,32,60,115,112,97,110,32,99,108,97,115,115,61,34,100,101,115,
+99,101,110,100,97,110,116,115,32,111,102,60,115,112,97,110,32,99,108,97,115,115,
+61,34,105,32,97,108,105,103,110,61,34,114,105,103,104,116,34,60,47,104,101,97,
+100,62,10,60,98,111,100,121,32,97,115,112,101,99,116,115,32,111,102,32,116,104,
+101,104,97,115,32,115,105,110,99,101,32,98,101,101,110,69,117,114,111,112,101,97
+,110,32,85,110,105,111,110,114,101,109,105,110,105,115,99,101,110,116,32,111,102
+,109,111,114,101,32,100,105,102,102,105,99,117,108,116,86,105,99,101,32,80,114,
+101,115,105,100,101,110,116,99,111,109,112,111,115,105,116,105,111,110,32,111,
+102,112,97,115,115,101,100,32,116,104,114,111,117,103,104,109,111,114,101,32,105
+,109,112,111,114,116,97,110,116,102,111,110,116,45,115,105,122,101,58,49,49,112,
+120,101,120,112,108,97,110,97,116,105,111,110,32,111,102,116,104,101,32,99,111,
+110,99,101,112,116,32,111,102,119,114,105,116,116,101,110,32,105,110,32,116,104,
+101,9,60,115,112,97,110,32,99,108,97,115,115,61,34,105,115,32,111,110,101,32,111
+,102,32,116,104,101,32,114,101,115,101,109,98,108,97,110,99,101,32,116,111,111,
+110,32,116,104,101,32,103,114,111,117,110,100,115,119,104,105,99,104,32,99,111,
+110,116,97,105,110,115,105,110,99,108,117,100,105,110,103,32,116,104,101,32,100,
+101,102,105,110,101,100,32,98,121,32,116,104,101,112,117,98,108,105,99,97,116,
+105,111,110,32,111,102,109,101,97,110,115,32,116,104,97,116,32,116,104,101,111,
+117,116,115,105,100,101,32,111,102,32,116,104,101,115,117,112,112,111,114,116,32
+,111,102,32,116,104,101,60,105,110,112,117,116,32,99,108,97,115,115,61,34,60,115
+,112,97,110,32,99,108,97,115,115,61,34,116,40,77,97,116,104,46,114,97,110,100,
+111,109,40,41,109,111,115,116,32,112,114,111,109,105,110,101,110,116,100,101,115
+,99,114,105,112,116,105,111,110,32,111,102,67,111,110,115,116,97,110,116,105,110
+,111,112,108,101,119,101,114,101,32,112,117,98,108,105,115,104,101,100,60,100,
+105,118,32,99,108,97,115,115,61,34,115,101,97,112,112,101,97,114,115,32,105,110,
+32,116,104,101,49,34,32,104,101,105,103,104,116,61,34,49,34,32,109,111,115,116,
+32,105,109,112,111,114,116,97,110,116,119,104,105,99,104,32,105,110,99,108,117,
+100,101,115,119,104,105,99,104,32,104,97,100,32,98,101,101,110,100,101,115,116,
+114,117,99,116,105,111,110,32,111,102,116,104,101,32,112,111,112,117,108,97,116,
+105,111,110,10,9,60,100,105,118,32,99,108,97,115,115,61,34,112,111,115,115,105,
+98,105,108,105,116,121,32,111,102,115,111,109,101,116,105,109,101,115,32,117,115
+,101,100,97,112,112,101,97,114,32,116,111,32,104,97,118,101,115,117,99,99,101,
+115,115,32,111,102,32,116,104,101,105,110,116,101,110,100,101,100,32,116,111,32,
+98,101,112,114,101,115,101,110,116,32,105,110,32,116,104,101,115,116,121,108,101
+,61,34,99,108,101,97,114,58,98,13,10,60,47,115,99,114,105,112,116,62,13,10,60,
+119,97,115,32,102,111,117,110,100,101,100,32,105,110,105,110,116,101,114,118,105
+,101,119,32,119,105,116,104,95,105,100,34,32,99,111,110,116,101,110,116,61,34,99
+,97,112,105,116,97,108,32,111,102,32,116,104,101,13,10,60,108,105,110,107,32,114
+,101,108,61,34,115,114,101,108,101,97,115,101,32,111,102,32,116,104,101,112,111,
+105,110,116,32,111,117,116,32,116,104,97,116,120,77,76,72,116,116,112,82,101,113
+,117,101,115,116,97,110,100,32,115,117,98,115,101,113,117,101,110,116,115,101,99
+,111,110,100,32,108,97,114,103,101,115,116,118,101,114,121,32,105,109,112,111,
+114,116,97,110,116,115,112,101,99,105,102,105,99,97,116,105,111,110,115,115,117,
+114,102,97,99,101,32,111,102,32,116,104,101,97,112,112,108,105,101,100,32,116,
+111,32,116,104,101,102,111,114,101,105,103,110,32,112,111,108,105,99,121,95,115,
+101,116,68,111,109,97,105,110,78,97,109,101,101,115,116,97,98,108,105,115,104,
+101,100,32,105,110,105,115,32,98,101,108,105,101,118,101,100,32,116,111,73,110,
+32,97,100,100,105,116,105,111,110,32,116,111,109,101,97,110,105,110,103,32,111,
+102,32,116,104,101,105,115,32,110,97,109,101,100,32,97,102,116,101,114,116,111,
+32,112,114,111,116,101,99,116,32,116,104,101,105,115,32,114,101,112,114,101,115,
+101,110,116,101,100,68,101,99,108,97,114,97,116,105,111,110,32,111,102,109,111,
+114,101,32,101,102,102,105,99,105,101,110,116,67,108,97,115,115,105,102,105,99,
+97,116,105,111,110,111,116,104,101,114,32,102,111,114,109,115,32,111,102,104,101
+,32,114,101,116,117,114,110,101,100,32,116,111,60,115,112,97,110,32,99,108,97,
+115,115,61,34,99,112,101,114,102,111,114,109,97,110,99,101,32,111,102,40,102,117
+,110,99,116,105,111,110,40,41,32,123,13,105,102,32,97,110,100,32,111,110,108,121
+,32,105,102,114,101,103,105,111,110,115,32,111,102,32,116,104,101,108,101,97,100
+,105,110,103,32,116,111,32,116,104,101,114,101,108,97,116,105,111,110,115,32,119
+,105,116,104,85,110,105,116,101,100,32,78,97,116,105,111,110,115,115,116,121,108
+,101,61,34,104,101,105,103,104,116,58,111,116,104,101,114,32,116,104,97,110,32,
+116,104,101,121,112,101,34,32,99,111,110,116,101,110,116,61,34,65,115,115,111,99
+,105,97,116,105,111,110,32,111,102,10,60,47,104,101,97,100,62,10,60,98,111,100,
+121,108,111,99,97,116,101,100,32,111,110,32,116,104,101,105,115,32,114,101,102,
+101,114,114,101,100,32,116,111,40,105,110,99,108,117,100,105,110,103,32,116,104,
+101,99,111,110,99,101,110,116,114,97,116,105,111,110,115,116,104,101,32,105,110,
+100,105,118,105,100,117,97,108,97,109,111,110,103,32,116,104,101,32,109,111,115,
+116,116,104,97,110,32,97,110,121,32,111,116,104,101,114,47,62,10,60,108,105,110,
+107,32,114,101,108,61,34,32,114,101,116,117,114,110,32,102,97,108,115,101,59,116
+,104,101,32,112,117,114,112,111,115,101,32,111,102,116,104,101,32,97,98,105,108,
+105,116,121,32,116,111,59,99,111,108,111,114,58,35,102,102,102,125,10,46,10,60,
+115,112,97,110,32,99,108,97,115,115,61,34,116,104,101,32,115,117,98,106,101,99,
+116,32,111,102,100,101,102,105,110,105,116,105,111,110,115,32,111,102,62,13,10,
+60,108,105,110,107,32,114,101,108,61,34,99,108,97,105,109,32,116,104,97,116,32,
+116,104,101,104,97,118,101,32,100,101,118,101,108,111,112,101,100,60,116,97,98,
+108,101,32,119,105,100,116,104,61,34,99,101,108,101,98,114,97,116,105,111,110,32
+,111,102,70,111,108,108,111,119,105,110,103,32,116,104,101,32,116,111,32,100,105
+,115,116,105,110,103,117,105,115,104,60,115,112,97,110,32,99,108,97,115,115,61,
+34,98,116,97,107,101,115,32,112,108,97,99,101,32,105,110,117,110,100,101,114,32,
+116,104,101,32,110,97,109,101,110,111,116,101,100,32,116,104,97,116,32,116,104,
+101,62,60,33,91,101,110,100,105,102,93,45,45,62,10,115,116,121,108,101,61,34,109
+,97,114,103,105,110,45,105,110,115,116,101,97,100,32,111,102,32,116,104,101,105,
+110,116,114,111,100,117,99,101,100,32,116,104,101,116,104,101,32,112,114,111,99,
+101,115,115,32,111,102,105,110,99,114,101,97,115,105,110,103,32,116,104,101,100,
+105,102,102,101,114,101,110,99,101,115,32,105,110,101,115,116,105,109,97,116,101
+,100,32,116,104,97,116,101,115,112,101,99,105,97,108,108,121,32,116,104,101,47,
+100,105,118,62,60,100,105,118,32,105,100,61,34,119,97,115,32,101,118,101,110,116
+,117,97,108,108,121,116,104,114,111,117,103,104,111,117,116,32,104,105,115,116,
+104,101,32,100,105,102,102,101,114,101,110,99,101,115,111,109,101,116,104,105,
+110,103,32,116,104,97,116,115,112,97,110,62,60,47,115,112,97,110,62,60,47,115,
+105,103,110,105,102,105,99,97,110,116,108,121,32,62,60,47,115,99,114,105,112,116
+,62,13,10,13,10,101,110,118,105,114,111,110,109,101,110,116,97,108,32,116,111,32
+,112,114,101,118,101,110,116,32,116,104,101,104,97,118,101,32,98,101,101,110,32,
+117,115,101,100,101,115,112,101,99,105,97,108,108,121,32,102,111,114,117,110,100
+,101,114,115,116,97,110,100,32,116,104,101,105,115,32,101,115,115,101,110,116,
+105,97,108,108,121,119,101,114,101,32,116,104,101,32,102,105,114,115,116,105,115
+,32,116,104,101,32,108,97,114,103,101,115,116,104,97,118,101,32,98,101,101,110,
+32,109,97,100,101,34,32,115,114,99,61,34,104,116,116,112,58,47,47,105,110,116,
+101,114,112,114,101,116,101,100,32,97,115,115,101,99,111,110,100,32,104,97,108,
+102,32,111,102,99,114,111,108,108,105,110,103,61,34,110,111,34,32,105,115,32,99,
+111,109,112,111,115,101,100,32,111,102,73,73,44,32,72,111,108,121,32,82,111,109,
+97,110,105,115,32,101,120,112,101,99,116,101,100,32,116,111,104,97,118,101,32,
+116,104,101,105,114,32,111,119,110,100,101,102,105,110,101,100,32,97,115,32,116,
+104,101,116,114,97,100,105,116,105,111,110,97,108,108,121,32,104,97,118,101,32,
+100,105,102,102,101,114,101,110,116,97,114,101,32,111,102,116,101,110,32,117,115
+,101,100,116,111,32,101,110,115,117,114,101,32,116,104,97,116,97,103,114,101,101
+,109,101,110,116,32,119,105,116,104,99,111,110,116,97,105,110,105,110,103,32,116
+,104,101,97,114,101,32,102,114,101,113,117,101,110,116,108,121,105,110,102,111,
+114,109,97,116,105,111,110,32,111,110,101,120,97,109,112,108,101,32,105,115,32,
+116,104,101,114,101,115,117,108,116,105,110,103,32,105,110,32,97,60,47,97,62,60,
+47,108,105,62,60,47,117,108,62,32,99,108,97,115,115,61,34,102,111,111,116,101,
+114,97,110,100,32,101,115,112,101,99,105,97,108,108,121,116,121,112,101,61,34,98
+,117,116,116,111,110,34,32,60,47,115,112,97,110,62,60,47,115,112,97,110,62,119,
+104,105,99,104,32,105,110,99,108,117,100,101,100,62,10,60,109,101,116,97,32,110,
+97,109,101,61,34,99,111,110,115,105,100,101,114,101,100,32,116,104,101,99,97,114
+,114,105,101,100,32,111,117,116,32,98,121,72,111,119,101,118,101,114,44,32,105,
+116,32,105,115,98,101,99,97,109,101,32,112,97,114,116,32,111,102,105,110,32,114,
+101,108,97,116,105,111,110,32,116,111,112,111,112,117,108,97,114,32,105,110,32,
+116,104,101,116,104,101,32,99,97,112,105,116,97,108,32,111,102,119,97,115,32,111
+,102,102,105,99,105,97,108,108,121,119,104,105,99,104,32,104,97,115,32,98,101,
+101,110,116,104,101,32,72,105,115,116,111,114,121,32,111,102,97,108,116,101,114,
+110,97,116,105,118,101,32,116,111,100,105,102,102,101,114,101,110,116,32,102,114
+,111,109,116,111,32,115,117,112,112,111,114,116,32,116,104,101,115,117,103,103,
+101,115,116,101,100,32,116,104,97,116,105,110,32,116,104,101,32,112,114,111,99,
+101,115,115,32,32,60,100,105,118,32,99,108,97,115,115,61,34,116,104,101,32,102,
+111,117,110,100,97,116,105,111,110,98,101,99,97,117,115,101,32,111,102,32,104,
+105,115,99,111,110,99,101,114,110,101,100,32,119,105,116,104,116,104,101,32,117,
+110,105,118,101,114,115,105,116,121,111,112,112,111,115,101,100,32,116,111,32,
+116,104,101,116,104,101,32,99,111,110,116,101,120,116,32,111,102,60,115,112,97,
+110,32,99,108,97,115,115,61,34,112,116,101,120,116,34,32,110,97,109,101,61,34,
+113,34,9,9,60,100,105,118,32,99,108,97,115,115,61,34,116,104,101,32,115,99,105,
+101,110,116,105,102,105,99,114,101,112,114,101,115,101,110,116,101,100,32,98,121
+,109,97,116,104,101,109,97,116,105,99,105,97,110,115,101,108,101,99,116,101,100,
+32,98,121,32,116,104,101,116,104,97,116,32,104,97,118,101,32,98,101,101,110,62,
+60,100,105,118,32,99,108,97,115,115,61,34,99,100,105,118,32,105,100,61,34,104,
+101,97,100,101,114,105,110,32,112,97,114,116,105,99,117,108,97,114,44,99,111,110
+,118,101,114,116,101,100,32,105,110,116,111,41,59,10,60,47,115,99,114,105,112,
+116,62,10,60,112,104,105,108,111,115,111,112,104,105,99,97,108,32,115,114,112,
+115,107,111,104,114,118,97,116,115,107,105,116,105,225,186,191,110,103,32,86,105
+,225,187,135,116,208,160,209,131,209,129,209,129,208,186,208,184,208,185,209,128
+,209,131,209,129,209,129,208,186,208,184,208,185,105,110,118,101,115,116,105,103
+,97,99,105,195,179,110,112,97,114,116,105,99,105,112,97,99,105,195,179,110,208,
+186,208,190,209,130,208,190,209,128,209,139,208,181,208,190,208,177,208,187,208,
+176,209,129,209,130,208,184,208,186,208,190,209,130,208,190,209,128,209,139,208,
+185,209,135,208,181,208,187,208,190,208,178,208,181,208,186,209,129,208,184,209,
+129,209,130,208,181,208,188,209,139,208,157,208,190,208,178,208,190,209,129,209,
+130,208,184,208,186,208,190,209,130,208,190,209,128,209,139,209,133,208,190,208,
+177,208,187,208,176,209,129,209,130,209,140,208,178,209,128,208,181,208,188,208,
+181,208,189,208,184,208,186,208,190,209,130,208,190,209,128,208,176,209,143,209,
+129,208,181,208,179,208,190,208,180,208,189,209,143,209,129,208,186,208,176,209,
+135,208,176,209,130,209,140,208,189,208,190,208,178,208,190,209,129,209,130,208,
+184,208,163,208,186,209,128,208,176,208,184,208,189,209,139,208,178,208,190,208,
+191,209,128,208,190,209,129,209,139,208,186,208,190,209,130,208,190,209,128,208,
+190,208,185,209,129,208,180,208,181,208,187,208,176,209,130,209,140,208,191,208,
+190,208,188,208,190,209,137,209,140,209,142,209,129,209,128,208,181,208,180,209,
+129,209,130,208,178,208,190,208,177,209,128,208,176,208,183,208,190,208,188,209,
+129,209,130,208,190,209,128,208,190,208,189,209,139,209,131,209,135,208,176,209,
+129,209,130,208,184,208,181,209,130,208,181,209,135,208,181,208,189,208,184,208,
+181,208,147,208,187,208,176,208,178,208,189,208,176,209,143,208,184,209,129,209,
+130,208,190,209,128,208,184,208,184,209,129,208,184,209,129,209,130,208,181,208,
+188,208,176,209,128,208,181,209,136,208,181,208,189,208,184,209,143,208,161,208,
+186,208,176,209,135,208,176,209,130,209,140,208,191,208,190,209,141,209,130,208,
+190,208,188,209,131,209,129,208,187,208,181,208,180,209,131,208,181,209,130,209,
+129,208,186,208,176,208,183,208,176,209,130,209,140,209,130,208,190,208,178,208,
+176,209,128,208,190,208,178,208,186,208,190,208,189,208,181,209,135,208,189,208,
+190,209,128,208,181,209,136,208,181,208,189,208,184,208,181,208,186,208,190,209,
+130,208,190,209,128,208,190,208,181,208,190,209,128,208,179,208,176,208,189,208,
+190,208,178,208,186,208,190,209,130,208,190,209,128,208,190,208,188,208,160,208,
+181,208,186,208,187,208,176,208,188,208,176,216,167,217,132,217,133,217,134,216,
+170,216,175,217,137,217,133,217,134,216,170,216,175,217,138,216,167,216,170,216,
+167,217,132,217,133,217,136,216,182,217,136,216,185,216,167,217,132,216,168,216,
+177,216,167,217,133,216,172,216,167,217,132,217,133,217,136,216,167,217,130,216,
+185,216,167,217,132,216,177,216,179,216,167,216,166,217,132,217,133,216,180,216,
+167,216,177,217,131,216,167,216,170,216,167,217,132,216,163,216,185,216,182,216,
+167,216,161,216,167,217,132,216,177,217,138,216,167,216,182,216,169,216,167,217,
+132,216,170,216,181,217,133,217,138,217,133,216,167,217,132,216,167,216,185,216,
+182,216,167,216,161,216,167,217,132,217,134,216,170,216,167,216,166,216,172,216,
+167,217,132,216,163,217,132,216,185,216,167,216,168,216,167,217,132,216,170,216,
+179,216,172,217,138,217,132,216,167,217,132,216,163,217,130,216,179,216,167,217,
+133,216,167,217,132,216,182,216,186,216,183,216,167,216,170,216,167,217,132,217,
+129,217,138,216,175,217,138,217,136,216,167,217,132,216,170,216,177,216,173,217,
+138,216,168,216,167,217,132,216,172,216,175,217,138,216,175,216,169,216,167,217,
+132,216,170,216,185,217,132,217,138,217,133,216,167,217,132,216,163,216,174,216,
+168,216,167,216,177,216,167,217,132,216,167,217,129,217,132,216,167,217,133,216,
+167,217,132,216,163,217,129,217,132,216,167,217,133,216,167,217,132,216,170,216,
+167,216,177,217,138,216,174,216,167,217,132,216,170,217,130,217,134,217,138,216,
+169,216,167,217,132,216,167,217,132,216,185,216,167,216,168,216,167,217,132,216,
+174,217,136,216,167,216,183,216,177,216,167,217,132,217,133,216,172,216,170,217,
+133,216,185,216,167,217,132,216,175,217,138,217,131,217,136,216,177,216,167,217,
+132,216,179,217,138,216,167,216,173,216,169,216,185,216,168,216,175,216,167,217,
+132,217,132,217,135,216,167,217,132,216,170,216,177,216,168,217,138,216,169,216,
+167,217,132,216,177,217,136,216,167,216,168,216,183,216,167,217,132,216,163,216,
+175,216,168,217,138,216,169,216,167,217,132,216,167,216,174,216,168,216,167,216,
+177,216,167,217,132,217,133,216,170,216,173,216,175,216,169,216,167,217,132,216,
+167,216,186,216,167,217,134,217,138,99,117,114,115,111,114,58,112,111,105,110,
+116,101,114,59,60,47,116,105,116,108,101,62,10,60,109,101,116,97,32,34,32,104,
+114,101,102,61,34,104,116,116,112,58,47,47,34,62,60,115,112,97,110,32,99,108,97,
+115,115,61,34,109,101,109,98,101,114,115,32,111,102,32,116,104,101,32,119,105,
+110,100,111,119,46,108,111,99,97,116,105,111,110,118,101,114,116,105,99,97,108,
+45,97,108,105,103,110,58,47,97,62,32,124,32,60,97,32,104,114,101,102,61,34,60,33
+,100,111,99,116,121,112,101,32,104,116,109,108,62,109,101,100,105,97,61,34,115,
+99,114,101,101,110,34,32,60,111,112,116,105,111,110,32,118,97,108,117,101,61,34,
+102,97,118,105,99,111,110,46,105,99,111,34,32,47,62,10,9,9,60,100,105,118,32,99,
+108,97,115,115,61,34,99,104,97,114,97,99,116,101,114,105,115,116,105,99,115,34,
+32,109,101,116,104,111,100,61,34,103,101,116,34,32,47,98,111,100,121,62,10,60,47
+,104,116,109,108,62,10,115,104,111,114,116,99,117,116,32,105,99,111,110,34,32,
+100,111,99,117,109,101,110,116,46,119,114,105,116,101,40,112,97,100,100,105,110,
+103,45,98,111,116,116,111,109,58,114,101,112,114,101,115,101,110,116,97,116,105,
+118,101,115,115,117,98,109,105,116,34,32,118,97,108,117,101,61,34,97,108,105,103
+,110,61,34,99,101,110,116,101,114,34,32,116,104,114,111,117,103,104,111,117,116,
+32,116,104,101,32,115,99,105,101,110,99,101,32,102,105,99,116,105,111,110,10,32,
+32,60,100,105,118,32,99,108,97,115,115,61,34,115,117,98,109,105,116,34,32,99,108
+,97,115,115,61,34,111,110,101,32,111,102,32,116,104,101,32,109,111,115,116,32,
+118,97,108,105,103,110,61,34,116,111,112,34,62,60,119,97,115,32,101,115,116,97,
+98,108,105,115,104,101,100,41,59,13,10,60,47,115,99,114,105,112,116,62,13,10,114
+,101,116,117,114,110,32,102,97,108,115,101,59,34,62,41,46,115,116,121,108,101,46
+,100,105,115,112,108,97,121,98,101,99,97,117,115,101,32,111,102,32,116,104,101,
+32,100,111,99,117,109,101,110,116,46,99,111,111,107,105,101,60,102,111,114,109,
+32,97,99,116,105,111,110,61,34,47,125,98,111,100,121,123,109,97,114,103,105,110,
+58,48,59,69,110,99,121,99,108,111,112,101,100,105,97,32,111,102,118,101,114,115,
+105,111,110,32,111,102,32,116,104,101,32,46,99,114,101,97,116,101,69,108,101,109
+,101,110,116,40,110,97,109,101,34,32,99,111,110,116,101,110,116,61,34,60,47,100,
+105,118,62,10,60,47,100,105,118,62,10,10,97,100,109,105,110,105,115,116,114,97,
+116,105,118,101,32,60,47,98,111,100,121,62,10,60,47,104,116,109,108,62,104,105,
+115,116,111,114,121,32,111,102,32,116,104,101,32,34,62,60,105,110,112,117,116,32
+,116,121,112,101,61,34,112,111,114,116,105,111,110,32,111,102,32,116,104,101,32,
+97,115,32,112,97,114,116,32,111,102,32,116,104,101,32,38,110,98,115,112,59,60,97
+,32,104,114,101,102,61,34,111,116,104,101,114,32,99,111,117,110,116,114,105,101,
+115,34,62,10,60,100,105,118,32,99,108,97,115,115,61,34,60,47,115,112,97,110,62,
+60,47,115,112,97,110,62,60,73,110,32,111,116,104,101,114,32,119,111,114,100,115,
+44,100,105,115,112,108,97,121,58,32,98,108,111,99,107,59,99,111,110,116,114,111,
+108,32,111,102,32,116,104,101,32,105,110,116,114,111,100,117,99,116,105,111,110,
+32,111,102,47,62,10,60,109,101,116,97,32,110,97,109,101,61,34,97,115,32,119,101,
+108,108,32,97,115,32,116,104,101,32,105,110,32,114,101,99,101,110,116,32,121,101
+,97,114,115,13,10,9,60,100,105,118,32,99,108,97,115,115,61,34,60,47,100,105,118,
+62,10,9,60,47,100,105,118,62,10,105,110,115,112,105,114,101,100,32,98,121,32,116
+,104,101,116,104,101,32,101,110,100,32,111,102,32,116,104,101,32,99,111,109,112,
+97,116,105,98,108,101,32,119,105,116,104,98,101,99,97,109,101,32,107,110,111,119
+,110,32,97,115,32,115,116,121,108,101,61,34,109,97,114,103,105,110,58,46,106,115
+,34,62,60,47,115,99,114,105,112,116,62,60,32,73,110,116,101,114,110,97,116,105,
+111,110,97,108,32,116,104,101,114,101,32,104,97,118,101,32,98,101,101,110,71,101
+,114,109,97,110,32,108,97,110,103,117,97,103,101,32,115,116,121,108,101,61,34,99
+,111,108,111,114,58,35,67,111,109,109,117,110,105,115,116,32,80,97,114,116,121,
+99,111,110,115,105,115,116,101,110,116,32,119,105,116,104,98,111,114,100,101,114
+,61,34,48,34,32,99,101,108,108,32,109,97,114,103,105,110,104,101,105,103,104,116
+,61,34,116,104,101,32,109,97,106,111,114,105,116,121,32,111,102,34,32,97,108,105
+,103,110,61,34,99,101,110,116,101,114,114,101,108,97,116,101,100,32,116,111,32,
+116,104,101,32,109,97,110,121,32,100,105,102,102,101,114,101,110,116,32,79,114,
+116,104,111,100,111,120,32,67,104,117,114,99,104,115,105,109,105,108,97,114,32,
+116,111,32,116,104,101,32,47,62,10,60,108,105,110,107,32,114,101,108,61,34,115,
+119,97,115,32,111,110,101,32,111,102,32,116,104,101,32,117,110,116,105,108,32,
+104,105,115,32,100,101,97,116,104,125,41,40,41,59,10,60,47,115,99,114,105,112,
+116,62,111,116,104,101,114,32,108,97,110,103,117,97,103,101,115,99,111,109,112,
+97,114,101,100,32,116,111,32,116,104,101,112,111,114,116,105,111,110,115,32,111,
+102,32,116,104,101,116,104,101,32,78,101,116,104,101,114,108,97,110,100,115,116,
+104,101,32,109,111,115,116,32,99,111,109,109,111,110,98,97,99,107,103,114,111,
+117,110,100,58,117,114,108,40,97,114,103,117,101,100,32,116,104,97,116,32,116,
+104,101,115,99,114,111,108,108,105,110,103,61,34,110,111,34,32,105,110,99,108,
+117,100,101,100,32,105,110,32,116,104,101,78,111,114,116,104,32,65,109,101,114,
+105,99,97,110,32,116,104,101,32,110,97,109,101,32,111,102,32,116,104,101,105,110
+,116,101,114,112,114,101,116,97,116,105,111,110,115,116,104,101,32,116,114,97,
+100,105,116,105,111,110,97,108,100,101,118,101,108,111,112,109,101,110,116,32,
+111,102,32,102,114,101,113,117,101,110,116,108,121,32,117,115,101,100,97,32,99,
+111,108,108,101,99,116,105,111,110,32,111,102,118,101,114,121,32,115,105,109,105
+,108,97,114,32,116,111,115,117,114,114,111,117,110,100,105,110,103,32,116,104,
+101,101,120,97,109,112,108,101,32,111,102,32,116,104,105,115,97,108,105,103,110,
+61,34,99,101,110,116,101,114,34,62,119,111,117,108,100,32,104,97,118,101,32,98,
+101,101,110,105,109,97,103,101,95,99,97,112,116,105,111,110,32,61,97,116,116,97,
+99,104,101,100,32,116,111,32,116,104,101,115,117,103,103,101,115,116,105,110,103
+,32,116,104,97,116,105,110,32,116,104,101,32,102,111,114,109,32,111,102,32,105,
+110,118,111,108,118,101,100,32,105,110,32,116,104,101,105,115,32,100,101,114,105
+,118,101,100,32,102,114,111,109,110,97,109,101,100,32,97,102,116,101,114,32,116,
+104,101,73,110,116,114,111,100,117,99,116,105,111,110,32,116,111,114,101,115,116
+,114,105,99,116,105,111,110,115,32,111,110,32,115,116,121,108,101,61,34,119,105,
+100,116,104,58,32,99,97,110,32,98,101,32,117,115,101,100,32,116,111,32,116,104,
+101,32,99,114,101,97,116,105,111,110,32,111,102,109,111,115,116,32,105,109,112,
+111,114,116,97,110,116,32,105,110,102,111,114,109,97,116,105,111,110,32,97,110,
+100,114,101,115,117,108,116,101,100,32,105,110,32,116,104,101,99,111,108,108,97,
+112,115,101,32,111,102,32,116,104,101,84,104,105,115,32,109,101,97,110,115,32,
+116,104,97,116,101,108,101,109,101,110,116,115,32,111,102,32,116,104,101,119,97,
+115,32,114,101,112,108,97,99,101,100,32,98,121,97,110,97,108,121,115,105,115,32,
+111,102,32,116,104,101,105,110,115,112,105,114,97,116,105,111,110,32,102,111,114
+,114,101,103,97,114,100,101,100,32,97,115,32,116,104,101,109,111,115,116,32,115,
+117,99,99,101,115,115,102,117,108,107,110,111,119,110,32,97,115,32,38,113,117,
+111,116,59,97,32,99,111,109,112,114,101,104,101,110,115,105,118,101,72,105,115,
+116,111,114,121,32,111,102,32,116,104,101,32,119,101,114,101,32,99,111,110,115,
+105,100,101,114,101,100,114,101,116,117,114,110,101,100,32,116,111,32,116,104,
+101,97,114,101,32,114,101,102,101,114,114,101,100,32,116,111,85,110,115,111,117,
+114,99,101,100,32,105,109,97,103,101,62,10,9,60,100,105,118,32,99,108,97,115,115
+,61,34,99,111,110,115,105,115,116,115,32,111,102,32,116,104,101,115,116,111,112,
+80,114,111,112,97,103,97,116,105,111,110,105,110,116,101,114,101,115,116,32,105,
+110,32,116,104,101,97,118,97,105,108,97,98,105,108,105,116,121,32,111,102,97,112
+,112,101,97,114,115,32,116,111,32,104,97,118,101,101,108,101,99,116,114,111,109,
+97,103,110,101,116,105,99,101,110,97,98,108,101,83,101,114,118,105,99,101,115,40
+,102,117,110,99,116,105,111,110,32,111,102,32,116,104,101,73,116,32,105,115,32,
+105,109,112,111,114,116,97,110,116,60,47,115,99,114,105,112,116,62,60,47,100,105
+,118,62,102,117,110,99,116,105,111,110,40,41,123,118,97,114,32,114,101,108,97,
+116,105,118,101,32,116,111,32,116,104,101,97,115,32,97,32,114,101,115,117,108,
+116,32,111,102,32,116,104,101,32,112,111,115,105,116,105,111,110,32,111,102,70,
+111,114,32,101,120,97,109,112,108,101,44,32,105,110,32,109,101,116,104,111,100,
+61,34,112,111,115,116,34,32,119,97,115,32,102,111,108,108,111,119,101,100,32,98,
+121,38,97,109,112,59,109,100,97,115,104,59,32,116,104,101,116,104,101,32,97,112,
+112,108,105,99,97,116,105,111,110,106,115,34,62,60,47,115,99,114,105,112,116,62,
+13,10,117,108,62,60,47,100,105,118,62,60,47,100,105,118,62,97,102,116,101,114,32
+,116,104,101,32,100,101,97,116,104,119,105,116,104,32,114,101,115,112,101,99,116
+,32,116,111,115,116,121,108,101,61,34,112,97,100,100,105,110,103,58,105,115,32,
+112,97,114,116,105,99,117,108,97,114,108,121,100,105,115,112,108,97,121,58,105,
+110,108,105,110,101,59,32,116,121,112,101,61,34,115,117,98,109,105,116,34,32,105
+,115,32,100,105,118,105,100,101,100,32,105,110,116,111,228,184,173,230,150,135,
+32,40,231,174,128,228,189,147,41,114,101,115,112,111,110,115,97,98,105,108,105,
+100,97,100,97,100,109,105,110,105,115,116,114,97,99,105,195,179,110,105,110,116,
+101,114,110,97,99,105,111,110,97,108,101,115,99,111,114,114,101,115,112,111,110,
+100,105,101,110,116,101,224,164,137,224,164,170,224,164,175,224,165,139,224,164,
+151,224,164,170,224,165,130,224,164,176,224,165,141,224,164,181,224,164,185,224,
+164,174,224,164,190,224,164,176,224,165,135,224,164,178,224,165,139,224,164,151,
+224,165,139,224,164,130,224,164,154,224,165,129,224,164,168,224,164,190,224,164,
+181,224,164,178,224,165,135,224,164,149,224,164,191,224,164,168,224,164,184,224,
+164,176,224,164,149,224,164,190,224,164,176,224,164,170,224,165,129,224,164,178,
+224,164,191,224,164,184,224,164,150,224,165,139,224,164,156,224,165,135,224,164,
+130,224,164,154,224,164,190,224,164,185,224,164,191,224,164,143,224,164,173,224,
+165,135,224,164,156,224,165,135,224,164,130,224,164,182,224,164,190,224,164,174,
+224,164,191,224,164,178,224,164,185,224,164,174,224,164,190,224,164,176,224,165,
+128,224,164,156,224,164,190,224,164,151,224,164,176,224,164,163,224,164,172,224,
+164,168,224,164,190,224,164,168,224,165,135,224,164,149,224,165,129,224,164,174,
+224,164,190,224,164,176,224,164,172,224,165,141,224,164,178,224,165,137,224,164,
+151,224,164,174,224,164,190,224,164,178,224,164,191,224,164,149,224,164,174,224,
+164,185,224,164,191,224,164,178,224,164,190,224,164,170,224,165,131,224,164,183,
+224,165,141,224,164,160,224,164,172,224,164,162,224,164,188,224,164,164,224,165,
+135,224,164,173,224,164,190,224,164,156,224,164,170,224,164,190,224,164,149,224,
+165,141,224,164,178,224,164,191,224,164,149,224,164,159,224,165,141,224,164,176,
+224,165,135,224,164,168,224,164,150,224,164,191,224,164,178,224,164,190,224,164,
+171,224,164,166,224,165,140,224,164,176,224,164,190,224,164,168,224,164,174,224,
+164,190,224,164,174,224,164,178,224,165,135,224,164,174,224,164,164,224,164,166,
+224,164,190,224,164,168,224,164,172,224,164,190,224,164,156,224,164,190,224,164,
+176,224,164,181,224,164,191,224,164,149,224,164,190,224,164,184,224,164,149,224,
+165,141,224,164,175,224,165,139,224,164,130,224,164,154,224,164,190,224,164,185,
+224,164,164,224,165,135,224,164,170,224,164,185,224,165,129,224,164,129,224,164,
+154,224,164,172,224,164,164,224,164,190,224,164,175,224,164,190,224,164,184,224,
+164,130,224,164,181,224,164,190,224,164,166,224,164,166,224,165,135,224,164,150,
+224,164,168,224,165,135,224,164,170,224,164,191,224,164,155,224,164,178,224,165,
+135,224,164,181,224,164,191,224,164,182,224,165,135,224,164,183,224,164,176,224,
+164,190,224,164,156,224,165,141,224,164,175,224,164,137,224,164,164,224,165,141,
+224,164,164,224,164,176,224,164,174,224,165,129,224,164,130,224,164,172,224,164,
+136,224,164,166,224,165,139,224,164,168,224,165,139,224,164,130,224,164,137,224,
+164,170,224,164,149,224,164,176,224,164,163,224,164,170,224,164,162,224,164,188,
+224,165,135,224,164,130,224,164,184,224,165,141,224,164,165,224,164,191,224,164,
+164,224,164,171,224,164,191,224,164,178,224,165,141,224,164,174,224,164,174,224,
+165,129,224,164,150,224,165,141,224,164,175,224,164,133,224,164,154,224,165,141,
+224,164,155,224,164,190,224,164,155,224,165,130,224,164,159,224,164,164,224,165,
+128,224,164,184,224,164,130,224,164,151,224,165,128,224,164,164,224,164,156,224,
+164,190,224,164,143,224,164,151,224,164,190,224,164,181,224,164,191,224,164,173,
+224,164,190,224,164,151,224,164,152,224,164,163,224,165,141,224,164,159,224,165,
+135,224,164,166,224,165,130,224,164,184,224,164,176,224,165,135,224,164,166,224,
+164,191,224,164,168,224,165,139,224,164,130,224,164,185,224,164,164,224,165,141,
+224,164,175,224,164,190,224,164,184,224,165,135,224,164,149,224,165,141,224,164,
+184,224,164,151,224,164,190,224,164,130,224,164,167,224,165,128,224,164,181,224,
+164,191,224,164,182,224,165,141,224,164,181,224,164,176,224,164,190,224,164,164,
+224,165,135,224,164,130,224,164,166,224,165,136,224,164,159,224,165,141,224,164,
+184,224,164,168,224,164,149,224,165,141,224,164,182,224,164,190,224,164,184,224,
+164,190,224,164,174,224,164,168,224,165,135,224,164,133,224,164,166,224,164,190,
+224,164,178,224,164,164,224,164,172,224,164,191,224,164,156,224,164,178,224,165,
+128,224,164,170,224,165,129,224,164,176,224,165,130,224,164,183,224,164,185,224,
+164,191,224,164,130,224,164,166,224,165,128,224,164,174,224,164,191,224,164,164,
+224,165,141,224,164,176,224,164,149,224,164,181,224,164,191,224,164,164,224,164,
+190,224,164,176,224,165,129,224,164,170,224,164,175,224,165,135,224,164,184,224,
+165,141,224,164,165,224,164,190,224,164,168,224,164,149,224,164,176,224,165,139,
+224,164,161,224,164,188,224,164,174,224,165,129,224,164,149,224,165,141,224,164,
+164,224,164,175,224,165,139,224,164,156,224,164,168,224,164,190,224,164,149,224,
+165,131,224,164,170,224,164,175,224,164,190,224,164,170,224,165,139,224,164,184,
+224,165,141,224,164,159,224,164,152,224,164,176,224,165,135,224,164,178,224,165,
+130,224,164,149,224,164,190,224,164,176,224,165,141,224,164,175,224,164,181,224,
+164,191,224,164,154,224,164,190,224,164,176,224,164,184,224,165,130,224,164,154,
+224,164,168,224,164,190,224,164,174,224,165,130,224,164,178,224,165,141,224,164,
+175,224,164,166,224,165,135,224,164,150,224,165,135,224,164,130,224,164,185,224,
+164,174,224,165,135,224,164,182,224,164,190,224,164,184,224,165,141,224,164,149,
+224,165,130,224,164,178,224,164,174,224,165,136,224,164,130,224,164,168,224,165,
+135,224,164,164,224,165,136,224,164,175,224,164,190,224,164,176,224,164,156,224,
+164,191,224,164,184,224,164,149,224,165,135,114,115,115,43,120,109,108,34,32,116
+,105,116,108,101,61,34,45,116,121,112,101,34,32,99,111,110,116,101,110,116,61,34
+,116,105,116,108,101,34,32,99,111,110,116,101,110,116,61,34,97,116,32,116,104,
+101,32,115,97,109,101,32,116,105,109,101,46,106,115,34,62,60,47,115,99,114,105,
+112,116,62,10,60,34,32,109,101,116,104,111,100,61,34,112,111,115,116,34,32,60,47
+,115,112,97,110,62,60,47,97,62,60,47,108,105,62,118,101,114,116,105,99,97,108,45
+,97,108,105,103,110,58,116,47,106,113,117,101,114,121,46,109,105,110,46,106,115,
+34,62,46,99,108,105,99,107,40,102,117,110,99,116,105,111,110,40,32,115,116,121,
+108,101,61,34,112,97,100,100,105,110,103,45,125,41,40,41,59,10,60,47,115,99,114,
+105,112,116,62,10,60,47,115,112,97,110,62,60,97,32,104,114,101,102,61,34,60,97,
+32,104,114,101,102,61,34,104,116,116,112,58,47,47,41,59,32,114,101,116,117,114,
+110,32,102,97,108,115,101,59,116,101,120,116,45,100,101,99,111,114,97,116,105,
+111,110,58,32,115,99,114,111,108,108,105,110,103,61,34,110,111,34,32,98,111,114,
+100,101,114,45,99,111,108,108,97,112,115,101,58,97,115,115,111,99,105,97,116,101
+,100,32,119,105,116,104,32,66,97,104,97,115,97,32,73,110,100,111,110,101,115,105
+,97,69,110,103,108,105,115,104,32,108,97,110,103,117,97,103,101,60,116,101,120,
+116,32,120,109,108,58,115,112,97,99,101,61,46,103,105,102,34,32,98,111,114,100,
+101,114,61,34,48,34,60,47,98,111,100,121,62,10,60,47,104,116,109,108,62,10,111,
+118,101,114,102,108,111,119,58,104,105,100,100,101,110,59,105,109,103,32,115,114
+,99,61,34,104,116,116,112,58,47,47,97,100,100,69,118,101,110,116,76,105,115,116,
+101,110,101,114,114,101,115,112,111,110,115,105,98,108,101,32,102,111,114,32,115
+,46,106,115,34,62,60,47,115,99,114,105,112,116,62,10,47,102,97,118,105,99,111,
+110,46,105,99,111,34,32,47,62,111,112,101,114,97,116,105,110,103,32,115,121,115,
+116,101,109,34,32,115,116,121,108,101,61,34,119,105,100,116,104,58,49,116,97,114
+,103,101,116,61,34,95,98,108,97,110,107,34,62,83,116,97,116,101,32,85,110,105,
+118,101,114,115,105,116,121,116,101,120,116,45,97,108,105,103,110,58,108,101,102
+,116,59,10,100,111,99,117,109,101,110,116,46,119,114,105,116,101,40,44,32,105,
+110,99,108,117,100,105,110,103,32,116,104,101,32,97,114,111,117,110,100,32,116,
+104,101,32,119,111,114,108,100,41,59,13,10,60,47,115,99,114,105,112,116,62,13,10
+,60,34,32,115,116,121,108,101,61,34,104,101,105,103,104,116,58,59,111,118,101,
+114,102,108,111,119,58,104,105,100,100,101,110,109,111,114,101,32,105,110,102,
+111,114,109,97,116,105,111,110,97,110,32,105,110,116,101,114,110,97,116,105,111,
+110,97,108,97,32,109,101,109,98,101,114,32,111,102,32,116,104,101,32,111,110,101
+,32,111,102,32,116,104,101,32,102,105,114,115,116,99,97,110,32,98,101,32,102,111
+,117,110,100,32,105,110,32,60,47,100,105,118,62,10,9,9,60,47,100,105,118,62,10,
+100,105,115,112,108,97,121,58,32,110,111,110,101,59,34,62,34,32,47,62,10,60,108,
+105,110,107,32,114,101,108,61,34,10,32,32,40,102,117,110,99,116,105,111,110,40,
+41,32,123,116,104,101,32,49,53,116,104,32,99,101,110,116,117,114,121,46,112,114,
+101,118,101,110,116,68,101,102,97,117,108,116,40,108,97,114,103,101,32,110,117,
+109,98,101,114,32,111,102,32,66,121,122,97,110,116,105,110,101,32,69,109,112,105
+,114,101,46,106,112,103,124,116,104,117,109,98,124,108,101,102,116,124,118,97,
+115,116,32,109,97,106,111,114,105,116,121,32,111,102,109,97,106,111,114,105,116,
+121,32,111,102,32,116,104,101,32,32,97,108,105,103,110,61,34,99,101,110,116,101,
+114,34,62,85,110,105,118,101,114,115,105,116,121,32,80,114,101,115,115,100,111,
+109,105,110,97,116,101,100,32,98,121,32,116,104,101,83,101,99,111,110,100,32,87,
+111,114,108,100,32,87,97,114,100,105,115,116,114,105,98,117,116,105,111,110,32,
+111,102,32,115,116,121,108,101,61,34,112,111,115,105,116,105,111,110,58,116,104,
+101,32,114,101,115,116,32,111,102,32,116,104,101,32,99,104,97,114,97,99,116,101,
+114,105,122,101,100,32,98,121,32,114,101,108,61,34,110,111,102,111,108,108,111,
+119,34,62,100,101,114,105,118,101,115,32,102,114,111,109,32,116,104,101,114,97,
+116,104,101,114,32,116,104,97,110,32,116,104,101,32,97,32,99,111,109,98,105,110,
+97,116,105,111,110,32,111,102,115,116,121,108,101,61,34,119,105,100,116,104,58,
+49,48,48,69,110,103,108,105,115,104,45,115,112,101,97,107,105,110,103,99,111,109
+,112,117,116,101,114,32,115,99,105,101,110,99,101,98,111,114,100,101,114,61,34,
+48,34,32,97,108,116,61,34,116,104,101,32,101,120,105,115,116,101,110,99,101,32,
+111,102,68,101,109,111,99,114,97,116,105,99,32,80,97,114,116,121,34,32,115,116,
+121,108,101,61,34,109,97,114,103,105,110,45,70,111,114,32,116,104,105,115,32,114
+,101,97,115,111,110,44,46,106,115,34,62,60,47,115,99,114,105,112,116,62,10,9,115
+,66,121,84,97,103,78,97,109,101,40,115,41,91,48,93,106,115,34,62,60,47,115,99,
+114,105,112,116,62,13,10,60,46,106,115,34,62,60,47,115,99,114,105,112,116,62,13,
+10,108,105,110,107,32,114,101,108,61,34,105,99,111,110,34,32,39,32,97,108,116,61
+,39,39,32,99,108,97,115,115,61,39,102,111,114,109,97,116,105,111,110,32,111,102,
+32,116,104,101,118,101,114,115,105,111,110,115,32,111,102,32,116,104,101,32,60,
+47,97,62,60,47,100,105,118,62,60,47,100,105,118,62,47,112,97,103,101,62,10,32,32
+,60,112,97,103,101,62,10,60,100,105,118,32,99,108,97,115,115,61,34,99,111,110,
+116,98,101,99,97,109,101,32,116,104,101,32,102,105,114,115,116,98,97,104,97,115,
+97,32,73,110,100,111,110,101,115,105,97,101,110,103,108,105,115,104,32,40,115,
+105,109,112,108,101,41,206,149,206,187,206,187,206,183,206,189,206,185,206,186,
+206,172,209,133,209,128,208,178,208,176,209,130,209,129,208,186,208,184,208,186,
+208,190,208,188,208,191,208,176,208,189,208,184,208,184,209,143,208,178,208,187,
+209,143,208,181,209,130,209,129,209,143,208,148,208,190,208,177,208,176,208,178,
+208,184,209,130,209,140,209,135,208,181,208,187,208,190,208,178,208,181,208,186,
+208,176,209,128,208,176,208,183,208,178,208,184,209,130,208,184,209,143,208,152,
+208,189,209,130,208,181,209,128,208,189,208,181,209,130,208,158,209,130,208,178,
+208,181,209,130,208,184,209,130,209,140,208,189,208,176,208,191,209,128,208,184,
+208,188,208,181,209,128,208,184,208,189,209,130,208,181,209,128,208,189,208,181,
+209,130,208,186,208,190,209,130,208,190,209,128,208,190,208,179,208,190,209,129,
+209,130,209,128,208,176,208,189,208,184,209,134,209,139,208,186,208,176,209,135,
+208,181,209,129,209,130,208,178,208,181,209,131,209,129,208,187,208,190,208,178,
+208,184,209,143,209,133,208,191,209,128,208,190,208,177,208,187,208,181,208,188,
+209,139,208,191,208,190,208,187,209,131,209,135,208,184,209,130,209,140,209,143,
+208,178,208,187,209,143,209,142,209,130,209,129,209,143,208,189,208,176,208,184,
+208,177,208,190,208,187,208,181,208,181,208,186,208,190,208,188,208,191,208,176,
+208,189,208,184,209,143,208,178,208,189,208,184,208,188,208,176,208,189,208,184,
+208,181,209,129,209,128,208,181,208,180,209,129,209,130,208,178,208,176,216,167,
+217,132,217,133,217,136,216,167,216,182,217,138,216,185,216,167,217,132,216,177,
+216,166,217,138,216,179,217,138,216,169,216,167,217,132,216,167,217,134,216,170,
+217,130,216,167,217,132,217,133,216,180,216,167,216,177,217,131,216,167,216,170,
+217,131,216,167,217,132,216,179,217,138,216,167,216,177,216,167,216,170,216,167,
+217,132,217,133,217,131,216,170,217,136,216,168,216,169,216,167,217,132,216,179,
+216,185,217,136,216,175,217,138,216,169,216,167,216,173,216,181,216,167,216,166,
+217,138,216,167,216,170,216,167,217,132,216,185,216,167,217,132,217,133,217,138,
+216,169,216,167,217,132,216,181,217,136,216,170,217,138,216,167,216,170,216,167,
+217,132,216,167,217,134,216,170,216,177,217,134,216,170,216,167,217,132,216,170,
+216,181,216,167,217,133,217,138,217,133,216,167,217,132,216,165,216,179,217,132,
+216,167,217,133,217,138,216,167,217,132,217,133,216,180,216,167,216,177,217,131,
+216,169,216,167,217,132,217,133,216,177,216,166,217,138,216,167,216,170,114,111,
+98,111,116,115,34,32,99,111,110,116,101,110,116,61,34,60,100,105,118,32,105,100,
+61,34,102,111,111,116,101,114,34,62,116,104,101,32,85,110,105,116,101,100,32,83,
+116,97,116,101,115,60,105,109,103,32,115,114,99,61,34,104,116,116,112,58,47,47,
+46,106,112,103,124,114,105,103,104,116,124,116,104,117,109,98,124,46,106,115,34,
+62,60,47,115,99,114,105,112,116,62,13,10,60,108,111,99,97,116,105,111,110,46,112
+,114,111,116,111,99,111,108,102,114,97,109,101,98,111,114,100,101,114,61,34,48,
+34,32,115,34,32,47,62,10,60,109,101,116,97,32,110,97,109,101,61,34,60,47,97,62,
+60,47,100,105,118,62,60,47,100,105,118,62,60,102,111,110,116,45,119,101,105,103,
+104,116,58,98,111,108,100,59,38,113,117,111,116,59,32,97,110,100,32,38,113,117,
+111,116,59,100,101,112,101,110,100,105,110,103,32,111,110,32,116,104,101,32,109,
+97,114,103,105,110,58,48,59,112,97,100,100,105,110,103,58,34,32,114,101,108,61,
+34,110,111,102,111,108,108,111,119,34,32,80,114,101,115,105,100,101,110,116,32,
+111,102,32,116,104,101,32,116,119,101,110,116,105,101,116,104,32,99,101,110,116,
+117,114,121,101,118,105,115,105,111,110,62,10,32,32,60,47,112,97,103,101,73,110,
+116,101,114,110,101,116,32,69,120,112,108,111,114,101,114,97,46,97,115,121,110,
+99,32,61,32,116,114,117,101,59,13,10,105,110,102,111,114,109,97,116,105,111,110,
+32,97,98,111,117,116,60,100,105,118,32,105,100,61,34,104,101,97,100,101,114,34,
+62,34,32,97,99,116,105,111,110,61,34,104,116,116,112,58,47,47,60,97,32,104,114,
+101,102,61,34,104,116,116,112,115,58,47,47,60,100,105,118,32,105,100,61,34,99,
+111,110,116,101,110,116,34,60,47,100,105,118,62,13,10,60,47,100,105,118,62,13,10
+,60,100,101,114,105,118,101,100,32,102,114,111,109,32,116,104,101,32,60,105,109,
+103,32,115,114,99,61,39,104,116,116,112,58,47,47,97,99,99,111,114,100,105,110,
+103,32,116,111,32,116,104,101,32,10,60,47,98,111,100,121,62,10,60,47,104,116,109
+,108,62,10,115,116,121,108,101,61,34,102,111,110,116,45,115,105,122,101,58,115,
+99,114,105,112,116,32,108,97,110,103,117,97,103,101,61,34,65,114,105,97,108,44,
+32,72,101,108,118,101,116,105,99,97,44,60,47,97,62,60,115,112,97,110,32,99,108,
+97,115,115,61,34,60,47,115,99,114,105,112,116,62,60,115,99,114,105,112,116,32,
+112,111,108,105,116,105,99,97,108,32,112,97,114,116,105,101,115,116,100,62,60,47
+,116,114,62,60,47,116,97,98,108,101,62,60,104,114,101,102,61,34,104,116,116,112,
+58,47,47,119,119,119,46,105,110,116,101,114,112,114,101,116,97,116,105,111,110,
+32,111,102,114,101,108,61,34,115,116,121,108,101,115,104,101,101,116,34,32,100,
+111,99,117,109,101,110,116,46,119,114,105,116,101,40,39,60,99,104,97,114,115,101
+,116,61,34,117,116,102,45,56,34,62,10,98,101,103,105,110,110,105,110,103,32,111,
+102,32,116,104,101,32,114,101,118,101,97,108,101,100,32,116,104,97,116,32,116,
+104,101,116,101,108,101,118,105,115,105,111,110,32,115,101,114,105,101,115,34,32
+,114,101,108,61,34,110,111,102,111,108,108,111,119,34,62,32,116,97,114,103,101,
+116,61,34,95,98,108,97,110,107,34,62,99,108,97,105,109,105,110,103,32,116,104,97
+,116,32,116,104,101,104,116,116,112,37,51,65,37,50,70,37,50,70,119,119,119,46,
+109,97,110,105,102,101,115,116,97,116,105,111,110,115,32,111,102,80,114,105,109,
+101,32,77,105,110,105,115,116,101,114,32,111,102,105,110,102,108,117,101,110,99,
+101,100,32,98,121,32,116,104,101,99,108,97,115,115,61,34,99,108,101,97,114,102,
+105,120,34,62,47,100,105,118,62,13,10,60,47,100,105,118,62,13,10,13,10,116,104,
+114,101,101,45,100,105,109,101,110,115,105,111,110,97,108,67,104,117,114,99,104,
+32,111,102,32,69,110,103,108,97,110,100,111,102,32,78,111,114,116,104,32,67,97,
+114,111,108,105,110,97,115,113,117,97,114,101,32,107,105,108,111,109,101,116,114
+,101,115,46,97,100,100,69,118,101,110,116,76,105,115,116,101,110,101,114,100,105
+,115,116,105,110,99,116,32,102,114,111,109,32,116,104,101,99,111,109,109,111,110
+,108,121,32,107,110,111,119,110,32,97,115,80,104,111,110,101,116,105,99,32,65,
+108,112,104,97,98,101,116,100,101,99,108,97,114,101,100,32,116,104,97,116,32,116
+,104,101,99,111,110,116,114,111,108,108,101,100,32,98,121,32,116,104,101,66,101,
+110,106,97,109,105,110,32,70,114,97,110,107,108,105,110,114,111,108,101,45,112,
+108,97,121,105,110,103,32,103,97,109,101,116,104,101,32,85,110,105,118,101,114,
+115,105,116,121,32,111,102,105,110,32,87,101,115,116,101,114,110,32,69,117,114,
+111,112,101,112,101,114,115,111,110,97,108,32,99,111,109,112,117,116,101,114,80,
+114,111,106,101,99,116,32,71,117,116,101,110,98,101,114,103,114,101,103,97,114,
+100,108,101,115,115,32,111,102,32,116,104,101,104,97,115,32,98,101,101,110,32,
+112,114,111,112,111,115,101,100,116,111,103,101,116,104,101,114,32,119,105,116,
+104,32,116,104,101,62,60,47,108,105,62,60,108,105,32,99,108,97,115,115,61,34,105
+,110,32,115,111,109,101,32,99,111,117,110,116,114,105,101,115,109,105,110,46,106
+,115,34,62,60,47,115,99,114,105,112,116,62,111,102,32,116,104,101,32,112,111,112
+,117,108,97,116,105,111,110,111,102,102,105,99,105,97,108,32,108,97,110,103,117,
+97,103,101,60,105,109,103,32,115,114,99,61,34,105,109,97,103,101,115,47,105,100,
+101,110,116,105,102,105,101,100,32,98,121,32,116,104,101,110,97,116,117,114,97,
+108,32,114,101,115,111,117,114,99,101,115,99,108,97,115,115,105,102,105,99,97,
+116,105,111,110,32,111,102,99,97,110,32,98,101,32,99,111,110,115,105,100,101,114
+,101,100,113,117,97,110,116,117,109,32,109,101,99,104,97,110,105,99,115,78,101,
+118,101,114,116,104,101,108,101,115,115,44,32,116,104,101,109,105,108,108,105,
+111,110,32,121,101,97,114,115,32,97,103,111,60,47,98,111,100,121,62,13,10,60,47,
+104,116,109,108,62,13,206,149,206,187,206,187,206,183,206,189,206,185,206,186,
+206,172,10,116,97,107,101,32,97,100,118,97,110,116,97,103,101,32,111,102,97,110,
+100,44,32,97,99,99,111,114,100,105,110,103,32,116,111,97,116,116,114,105,98,117,
+116,101,100,32,116,111,32,116,104,101,77,105,99,114,111,115,111,102,116,32,87,
+105,110,100,111,119,115,116,104,101,32,102,105,114,115,116,32,99,101,110,116,117
+,114,121,117,110,100,101,114,32,116,104,101,32,99,111,110,116,114,111,108,100,
+105,118,32,99,108,97,115,115,61,34,104,101,97,100,101,114,115,104,111,114,116,
+108,121,32,97,102,116,101,114,32,116,104,101,110,111,116,97,98,108,101,32,101,
+120,99,101,112,116,105,111,110,116,101,110,115,32,111,102,32,116,104,111,117,115
+,97,110,100,115,115,101,118,101,114,97,108,32,100,105,102,102,101,114,101,110,
+116,97,114,111,117,110,100,32,116,104,101,32,119,111,114,108,100,46,114,101,97,
+99,104,105,110,103,32,109,105,108,105,116,97,114,121,105,115,111,108,97,116,101,
+100,32,102,114,111,109,32,116,104,101,111,112,112,111,115,105,116,105,111,110,32
+,116,111,32,116,104,101,116,104,101,32,79,108,100,32,84,101,115,116,97,109,101,
+110,116,65,102,114,105,99,97,110,32,65,109,101,114,105,99,97,110,115,105,110,115
+,101,114,116,101,100,32,105,110,116,111,32,116,104,101,115,101,112,97,114,97,116
+,101,32,102,114,111,109,32,116,104,101,109,101,116,114,111,112,111,108,105,116,
+97,110,32,97,114,101,97,109,97,107,101,115,32,105,116,32,112,111,115,115,105,98,
+108,101,97,99,107,110,111,119,108,101,100,103,101,100,32,116,104,97,116,97,114,
+103,117,97,98,108,121,32,116,104,101,32,109,111,115,116,116,121,112,101,61,34,
+116,101,120,116,47,99,115,115,34,62,10,116,104,101,32,73,110,116,101,114,110,97,
+116,105,111,110,97,108,65,99,99,111,114,100,105,110,103,32,116,111,32,116,104,
+101,32,112,101,61,34,116,101,120,116,47,99,115,115,34,32,47,62,10,99,111,105,110
+,99,105,100,101,32,119,105,116,104,32,116,104,101,116,119,111,45,116,104,105,114
+,100,115,32,111,102,32,116,104,101,68,117,114,105,110,103,32,116,104,105,115,32,
+116,105,109,101,44,100,117,114,105,110,103,32,116,104,101,32,112,101,114,105,111
+,100,97,110,110,111,117,110,99,101,100,32,116,104,97,116,32,104,101,116,104,101,
+32,105,110,116,101,114,110,97,116,105,111,110,97,108,97,110,100,32,109,111,114,
+101,32,114,101,99,101,110,116,108,121,98,101,108,105,101,118,101,100,32,116,104,
+97,116,32,116,104,101,99,111,110,115,99,105,111,117,115,110,101,115,115,32,97,
+110,100,102,111,114,109,101,114,108,121,32,107,110,111,119,110,32,97,115,115,117
+,114,114,111,117,110,100,101,100,32,98,121,32,116,104,101,102,105,114,115,116,32
+,97,112,112,101,97,114,101,100,32,105,110,111,99,99,97,115,105,111,110,97,108,
+108,121,32,117,115,101,100,112,111,115,105,116,105,111,110,58,97,98,115,111,108,
+117,116,101,59,34,32,116,97,114,103,101,116,61,34,95,98,108,97,110,107,34,32,112
+,111,115,105,116,105,111,110,58,114,101,108,97,116,105,118,101,59,116,101,120,
+116,45,97,108,105,103,110,58,99,101,110,116,101,114,59,106,97,120,47,108,105,98,
+115,47,106,113,117,101,114,121,47,49,46,98,97,99,107,103,114,111,117,110,100,45,
+99,111,108,111,114,58,35,116,121,112,101,61,34,97,112,112,108,105,99,97,116,105,
+111,110,47,97,110,103,117,97,103,101,34,32,99,111,110,116,101,110,116,61,34,60,
+109,101,116,97,32,104,116,116,112,45,101,113,117,105,118,61,34,80,114,105,118,97
+,99,121,32,80,111,108,105,99,121,60,47,97,62,101,40,34,37,51,67,115,99,114,105,
+112,116,32,115,114,99,61,39,34,32,116,97,114,103,101,116,61,34,95,98,108,97,110,
+107,34,62,79,110,32,116,104,101,32,111,116,104,101,114,32,104,97,110,100,44,46,
+106,112,103,124,116,104,117,109,98,124,114,105,103,104,116,124,50,60,47,100,105,
+118,62,60,100,105,118,32,99,108,97,115,115,61,34,60,100,105,118,32,115,116,121,
+108,101,61,34,102,108,111,97,116,58,110,105,110,101,116,101,101,110,116,104,32,
+99,101,110,116,117,114,121,60,47,98,111,100,121,62,13,10,60,47,104,116,109,108,
+62,13,10,60,105,109,103,32,115,114,99,61,34,104,116,116,112,58,47,47,115,59,116,
+101,120,116,45,97,108,105,103,110,58,99,101,110,116,101,114,102,111,110,116,45,
+119,101,105,103,104,116,58,32,98,111,108,100,59,32,65,99,99,111,114,100,105,110,
+103,32,116,111,32,116,104,101,32,100,105,102,102,101,114,101,110,99,101,32,98,
+101,116,119,101,101,110,34,32,102,114,97,109,101,98,111,114,100,101,114,61,34,48
+,34,32,34,32,115,116,121,108,101,61,34,112,111,115,105,116,105,111,110,58,108,
+105,110,107,32,104,114,101,102,61,34,104,116,116,112,58,47,47,104,116,109,108,52
+,47,108,111,111,115,101,46,100,116,100,34,62,10,100,117,114,105,110,103,32,116,
+104,105,115,32,112,101,114,105,111,100,60,47,116,100,62,60,47,116,114,62,60,47,
+116,97,98,108,101,62,99,108,111,115,101,108,121,32,114,101,108,97,116,101,100,32
+,116,111,102,111,114,32,116,104,101,32,102,105,114,115,116,32,116,105,109,101,59
+,102,111,110,116,45,119,101,105,103,104,116,58,98,111,108,100,59,105,110,112,117
+,116,32,116,121,112,101,61,34,116,101,120,116,34,32,60,115,112,97,110,32,115,116
+,121,108,101,61,34,102,111,110,116,45,111,110,114,101,97,100,121,115,116,97,116,
+101,99,104,97,110,103,101,9,60,100,105,118,32,99,108,97,115,115,61,34,99,108,101
+,97,114,100,111,99,117,109,101,110,116,46,108,111,99,97,116,105,111,110,46,32,70
+,111,114,32,101,120,97,109,112,108,101,44,32,116,104,101,32,97,32,119,105,100,
+101,32,118,97,114,105,101,116,121,32,111,102,32,60,33,68,79,67,84,89,80,69,32,
+104,116,109,108,62,13,10,60,38,110,98,115,112,59,38,110,98,115,112,59,38,110,98,
+115,112,59,34,62,60,97,32,104,114,101,102,61,34,104,116,116,112,58,47,47,115,116
+,121,108,101,61,34,102,108,111,97,116,58,108,101,102,116,59,99,111,110,99,101,
+114,110,101,100,32,119,105,116,104,32,116,104,101,61,104,116,116,112,37,51,65,37
+,50,70,37,50,70,119,119,119,46,105,110,32,112,111,112,117,108,97,114,32,99,117,
+108,116,117,114,101,116,121,112,101,61,34,116,101,120,116,47,99,115,115,34,32,47
+,62,105,116,32,105,115,32,112,111,115,115,105,98,108,101,32,116,111,32,72,97,114
+,118,97,114,100,32,85,110,105,118,101,114,115,105,116,121,116,121,108,101,115,
+104,101,101,116,34,32,104,114,101,102,61,34,47,116,104,101,32,109,97,105,110,32,
+99,104,97,114,97,99,116,101,114,79,120,102,111,114,100,32,85,110,105,118,101,114
+,115,105,116,121,32,32,110,97,109,101,61,34,107,101,121,119,111,114,100,115,34,
+32,99,115,116,121,108,101,61,34,116,101,120,116,45,97,108,105,103,110,58,116,104
+,101,32,85,110,105,116,101,100,32,75,105,110,103,100,111,109,102,101,100,101,114
+,97,108,32,103,111,118,101,114,110,109,101,110,116,60,100,105,118,32,115,116,121
+,108,101,61,34,109,97,114,103,105,110,32,100,101,112,101,110,100,105,110,103,32,
+111,110,32,116,104,101,32,100,101,115,99,114,105,112,116,105,111,110,32,111,102,
+32,116,104,101,60,100,105,118,32,99,108,97,115,115,61,34,104,101,97,100,101,114,
+46,109,105,110,46,106,115,34,62,60,47,115,99,114,105,112,116,62,100,101,115,116,
+114,117,99,116,105,111,110,32,111,102,32,116,104,101,115,108,105,103,104,116,108
+,121,32,100,105,102,102,101,114,101,110,116,105,110,32,97,99,99,111,114,100,97,
+110,99,101,32,119,105,116,104,116,101,108,101,99,111,109,109,117,110,105,99,97,
+116,105,111,110,115,105,110,100,105,99,97,116,101,115,32,116,104,97,116,32,116,
+104,101,115,104,111,114,116,108,121,32,116,104,101,114,101,97,102,116,101,114,
+101,115,112,101,99,105,97,108,108,121,32,105,110,32,116,104,101,32,69,117,114,
+111,112,101,97,110,32,99,111,117,110,116,114,105,101,115,72,111,119,101,118,101,
+114,44,32,116,104,101,114,101,32,97,114,101,115,114,99,61,34,104,116,116,112,58,
+47,47,115,116,97,116,105,99,115,117,103,103,101,115,116,101,100,32,116,104,97,
+116,32,116,104,101,34,32,115,114,99,61,34,104,116,116,112,58,47,47,119,119,119,
+46,97,32,108,97,114,103,101,32,110,117,109,98,101,114,32,111,102,32,84,101,108,
+101,99,111,109,109,117,110,105,99,97,116,105,111,110,115,34,32,114,101,108,61,34
+,110,111,102,111,108,108,111,119,34,32,116,72,111,108,121,32,82,111,109,97,110,
+32,69,109,112,101,114,111,114,97,108,109,111,115,116,32,101,120,99,108,117,115,
+105,118,101,108,121,34,32,98,111,114,100,101,114,61,34,48,34,32,97,108,116,61,34
+,83,101,99,114,101,116,97,114,121,32,111,102,32,83,116,97,116,101,99,117,108,109
+,105,110,97,116,105,110,103,32,105,110,32,116,104,101,67,73,65,32,87,111,114,108
+,100,32,70,97,99,116,98,111,111,107,116,104,101,32,109,111,115,116,32,105,109,
+112,111,114,116,97,110,116,97,110,110,105,118,101,114,115,97,114,121,32,111,102,
+32,116,104,101,115,116,121,108,101,61,34,98,97,99,107,103,114,111,117,110,100,45
+,60,108,105,62,60,101,109,62,60,97,32,104,114,101,102,61,34,47,116,104,101,32,65
+,116,108,97,110,116,105,99,32,79,99,101,97,110,115,116,114,105,99,116,108,121,32
+,115,112,101,97,107,105,110,103,44,115,104,111,114,116,108,121,32,98,101,102,111
+,114,101,32,116,104,101,100,105,102,102,101,114,101,110,116,32,116,121,112,101,
+115,32,111,102,116,104,101,32,79,116,116,111,109,97,110,32,69,109,112,105,114,
+101,62,60,105,109,103,32,115,114,99,61,34,104,116,116,112,58,47,47,65,110,32,73,
+110,116,114,111,100,117,99,116,105,111,110,32,116,111,99,111,110,115,101,113,117
+,101,110,99,101,32,111,102,32,116,104,101,100,101,112,97,114,116,117,114,101,32,
+102,114,111,109,32,116,104,101,67,111,110,102,101,100,101,114,97,116,101,32,83,
+116,97,116,101,115,105,110,100,105,103,101,110,111,117,115,32,112,101,111,112,
+108,101,115,80,114,111,99,101,101,100,105,110,103,115,32,111,102,32,116,104,101,
+105,110,102,111,114,109,97,116,105,111,110,32,111,110,32,116,104,101,116,104,101
+,111,114,105,101,115,32,104,97,118,101,32,98,101,101,110,105,110,118,111,108,118
+,101,109,101,110,116,32,105,110,32,116,104,101,100,105,118,105,100,101,100,32,
+105,110,116,111,32,116,104,114,101,101,97,100,106,97,99,101,110,116,32,99,111,
+117,110,116,114,105,101,115,105,115,32,114,101,115,112,111,110,115,105,98,108,
+101,32,102,111,114,100,105,115,115,111,108,117,116,105,111,110,32,111,102,32,116
+,104,101,99,111,108,108,97,98,111,114,97,116,105,111,110,32,119,105,116,104,119,
+105,100,101,108,121,32,114,101,103,97,114,100,101,100,32,97,115,104,105,115,32,
+99,111,110,116,101,109,112,111,114,97,114,105,101,115,102,111,117,110,100,105,
+110,103,32,109,101,109,98,101,114,32,111,102,68,111,109,105,110,105,99,97,110,32
+,82,101,112,117,98,108,105,99,103,101,110,101,114,97,108,108,121,32,97,99,99,101
+,112,116,101,100,116,104,101,32,112,111,115,115,105,98,105,108,105,116,121,32,
+111,102,97,114,101,32,97,108,115,111,32,97,118,97,105,108,97,98,108,101,117,110,
+100,101,114,32,99,111,110,115,116,114,117,99,116,105,111,110,114,101,115,116,111
+,114,97,116,105,111,110,32,111,102,32,116,104,101,116,104,101,32,103,101,110,101
+,114,97,108,32,112,117,98,108,105,99,105,115,32,97,108,109,111,115,116,32,101,
+110,116,105,114,101,108,121,112,97,115,115,101,115,32,116,104,114,111,117,103,
+104,32,116,104,101,104,97,115,32,98,101,101,110,32,115,117,103,103,101,115,116,
+101,100,99,111,109,112,117,116,101,114,32,97,110,100,32,118,105,100,101,111,71,
+101,114,109,97,110,105,99,32,108,97,110,103,117,97,103,101,115,32,97,99,99,111,
+114,100,105,110,103,32,116,111,32,116,104,101,32,100,105,102,102,101,114,101,110
+,116,32,102,114,111,109,32,116,104,101,115,104,111,114,116,108,121,32,97,102,116
+,101,114,119,97,114,100,115,104,114,101,102,61,34,104,116,116,112,115,58,47,47,
+119,119,119,46,114,101,99,101,110,116,32,100,101,118,101,108,111,112,109,101,110
+,116,66,111,97,114,100,32,111,102,32,68,105,114,101,99,116,111,114,115,60,100,
+105,118,32,99,108,97,115,115,61,34,115,101,97,114,99,104,124,32,60,97,32,104,114
+,101,102,61,34,104,116,116,112,58,47,47,73,110,32,112,97,114,116,105,99,117,108,
+97,114,44,32,116,104,101,77,117,108,116,105,112,108,101,32,102,111,111,116,110,
+111,116,101,115,111,114,32,111,116,104,101,114,32,115,117,98,115,116,97,110,99,
+101,116,104,111,117,115,97,110,100,115,32,111,102,32,121,101,97,114,115,116,114,
+97,110,115,108,97,116,105,111,110,32,111,102,32,116,104,101,60,47,100,105,118,62
+,13,10,60,47,100,105,118,62,13,10,13,10,60,97,32,104,114,101,102,61,34,105,110,
+100,101,120,46,112,104,112,119,97,115,32,101,115,116,97,98,108,105,115,104,101,
+100,32,105,110,109,105,110,46,106,115,34,62,60,47,115,99,114,105,112,116,62,10,
+112,97,114,116,105,99,105,112,97,116,101,32,105,110,32,116,104,101,97,32,115,116
+,114,111,110,103,32,105,110,102,108,117,101,110,99,101,115,116,121,108,101,61,34
+,109,97,114,103,105,110,45,116,111,112,58,114,101,112,114,101,115,101,110,116,
+101,100,32,98,121,32,116,104,101,103,114,97,100,117,97,116,101,100,32,102,114,
+111,109,32,116,104,101,84,114,97,100,105,116,105,111,110,97,108,108,121,44,32,
+116,104,101,69,108,101,109,101,110,116,40,34,115,99,114,105,112,116,34,41,59,72,
+111,119,101,118,101,114,44,32,115,105,110,99,101,32,116,104,101,47,100,105,118,
+62,10,60,47,100,105,118,62,10,60,100,105,118,32,108,101,102,116,59,32,109,97,114
+,103,105,110,45,108,101,102,116,58,112,114,111,116,101,99,116,105,111,110,32,97,
+103,97,105,110,115,116,48,59,32,118,101,114,116,105,99,97,108,45,97,108,105,103,
+110,58,85,110,102,111,114,116,117,110,97,116,101,108,121,44,32,116,104,101,116,
+121,112,101,61,34,105,109,97,103,101,47,120,45,105,99,111,110,47,100,105,118,62,
+10,60,100,105,118,32,99,108,97,115,115,61,34,32,99,108,97,115,115,61,34,99,108,
+101,97,114,102,105,120,34,62,60,100,105,118,32,99,108,97,115,115,61,34,102,111,
+111,116,101,114,9,9,60,47,100,105,118,62,10,9,9,60,47,100,105,118,62,10,116,104,
+101,32,109,111,116,105,111,110,32,112,105,99,116,117,114,101,208,145,209,138,208
+,187,208,179,208,176,209,128,209,129,208,186,208,184,208,177,209,138,208,187,208
+,179,208,176,209,128,209,129,208,186,208,184,208,164,208,181,208,180,208,181,209
+,128,208,176,209,134,208,184,208,184,208,189,208,181,209,129,208,186,208,190,208
+,187,209,140,208,186,208,190,209,129,208,190,208,190,208,177,209,137,208,181,208
+,189,208,184,208,181,209,129,208,190,208,190,208,177,209,137,208,181,208,189,208
+,184,209,143,208,191,209,128,208,190,208,179,209,128,208,176,208,188,208,188,209
+,139,208,158,209,130,208,191,209,128,208,176,208,178,208,184,209,130,209,140,208
+,177,208,181,209,129,208,191,208,187,208,176,209,130,208,189,208,190,208,188,208
+,176,209,130,208,181,209,128,208,184,208,176,208,187,209,139,208,191,208,190,208
+,183,208,178,208,190,208,187,209,143,208,181,209,130,208,191,208,190,209,129,208
+,187,208,181,208,180,208,189,208,184,208,181,209,128,208,176,208,183,208,187,208
+,184,209,135,208,189,209,139,209,133,208,191,209,128,208,190,208,180,209,131,208
+,186,209,134,208,184,208,184,208,191,209,128,208,190,208,179,209,128,208,176,208
+,188,208,188,208,176,208,191,208,190,208,187,208,189,208,190,209,129,209,130,209
+,140,209,142,208,189,208,176,209,133,208,190,208,180,208,184,209,130,209,129,209
+,143,208,184,208,183,208,177,209,128,208,176,208,189,208,189,208,190,208,181,208
+,189,208,176,209,129,208,181,208,187,208,181,208,189,208,184,209,143,208,184,208
+,183,208,188,208,181,208,189,208,181,208,189,208,184,209,143,208,186,208,176,209
+,130,208,181,208,179,208,190,209,128,208,184,208,184,208,144,208,187,208,181,208
+,186,209,129,208,176,208,189,208,180,209,128,224,164,166,224,165,141,224,164,181
+,224,164,190,224,164,176,224,164,190,224,164,174,224,165,136,224,164,168,224,165
+,129,224,164,133,224,164,178,224,164,170,224,165,141,224,164,176,224,164,166,224
+,164,190,224,164,168,224,164,173,224,164,190,224,164,176,224,164,164,224,165,128
+,224,164,175,224,164,133,224,164,168,224,165,129,224,164,166,224,165,135,224,164
+,182,224,164,185,224,164,191,224,164,168,224,165,141,224,164,166,224,165,128,224
+,164,135,224,164,130,224,164,161,224,164,191,224,164,175,224,164,190,224,164,166
+,224,164,191,224,164,178,224,165,141,224,164,178,224,165,128,224,164,133,224,164
+,167,224,164,191,224,164,149,224,164,190,224,164,176,224,164,181,224,165,128,224
+,164,161,224,164,191,224,164,175,224,165,139,224,164,154,224,164,191,224,164,159
+,224,165,141,224,164,160,224,165,135,224,164,184,224,164,174,224,164,190,224,164
+,154,224,164,190,224,164,176,224,164,156,224,164,130,224,164,149,224,165,141,224
+,164,182,224,164,168,224,164,166,224,165,129,224,164,168,224,164,191,224,164,175
+,224,164,190,224,164,170,224,165,141,224,164,176,224,164,175,224,165,139,224,164
+,151,224,164,133,224,164,168,224,165,129,224,164,184,224,164,190,224,164,176,224
+,164,145,224,164,168,224,164,178,224,164,190,224,164,135,224,164,168,224,164,170
+,224,164,190,224,164,176,224,165,141,224,164,159,224,165,128,224,164,182,224,164
+,176,224,165,141,224,164,164,224,165,139,224,164,130,224,164,178,224,165,139,224
+,164,149,224,164,184,224,164,173,224,164,190,224,164,171,224,164,188,224,165,141
+,224,164,178,224,165,136,224,164,182,224,164,182,224,164,176,224,165,141,224,164
+,164,224,165,135,224,164,130,224,164,170,224,165,141,224,164,176,224,164,166,224
+,165,135,224,164,182,224,164,170,224,165,141,224,164,178,224,165,135,224,164,175
+,224,164,176,224,164,149,224,165,135,224,164,130,224,164,166,224,165,141,224,164
+,176,224,164,184,224,165,141,224,164,165,224,164,191,224,164,164,224,164,191,224
+,164,137,224,164,164,224,165,141,224,164,170,224,164,190,224,164,166,224,164,137
+,224,164,168,224,165,141,224,164,185,224,165,135,224,164,130,224,164,154,224,164
+,191,224,164,159,224,165,141,224,164,160,224,164,190,224,164,175,224,164,190,224
+,164,164,224,165,141,224,164,176,224,164,190,224,164,156,224,165,141,224,164,175
+,224,164,190,224,164,166,224,164,190,224,164,170,224,165,129,224,164,176,224,164
+,190,224,164,168,224,165,135,224,164,156,224,165,139,224,164,161,224,164,188,224
+,165,135,224,164,130,224,164,133,224,164,168,224,165,129,224,164,181,224,164,190
+,224,164,166,224,164,182,224,165,141,224,164,176,224,165,135,224,164,163,224,165
+,128,224,164,182,224,164,191,224,164,149,224,165,141,224,164,183,224,164,190,224
+,164,184,224,164,176,224,164,149,224,164,190,224,164,176,224,165,128,224,164,184
+,224,164,130,224,164,151,224,165,141,224,164,176,224,164,185,224,164,170,224,164
+,176,224,164,191,224,164,163,224,164,190,224,164,174,224,164,172,224,165,141,224
+,164,176,224,164,190,224,164,130,224,164,161,224,164,172,224,164,154,224,165,141
+,224,164,154,224,165,139,224,164,130,224,164,137,224,164,170,224,164,178,224,164
+,172,224,165,141,224,164,167,224,164,174,224,164,130,224,164,164,224,165,141,224
+,164,176,224,165,128,224,164,184,224,164,130,224,164,170,224,164,176,224,165,141
+,224,164,149,224,164,137,224,164,174,224,165,141,224,164,174,224,165,128,224,164
+,166,224,164,174,224,164,190,224,164,167,224,165,141,224,164,175,224,164,174,224
+,164,184,224,164,185,224,164,190,224,164,175,224,164,164,224,164,190,224,164,182
+,224,164,172,224,165,141,224,164,166,224,165,139,224,164,130,224,164,174,224,165
+,128,224,164,161,224,164,191,224,164,175,224,164,190,224,164,134,224,164,136,224
+,164,170,224,165,128,224,164,143,224,164,178,224,164,174,224,165,139,224,164,172
+,224,164,190,224,164,135,224,164,178,224,164,184,224,164,130,224,164,150,224,165
+,141,224,164,175,224,164,190,224,164,134,224,164,170,224,164,176,224,165,135,224
+,164,182,224,164,168,224,164,133,224,164,168,224,165,129,224,164,172,224,164,130
+,224,164,167,224,164,172,224,164,190,224,164,156,224,164,188,224,164,190,224,164
+,176,224,164,168,224,164,181,224,165,128,224,164,168,224,164,164,224,164,174,224
+,164,170,224,165,141,224,164,176,224,164,174,224,165,129,224,164,150,224,164,170
+,224,165,141,224,164,176,224,164,182,224,165,141,224,164,168,224,164,170,224,164
+,176,224,164,191,224,164,181,224,164,190,224,164,176,224,164,168,224,165,129,224
+,164,149,224,164,184,224,164,190,224,164,168,224,164,184,224,164,174,224,164,176
+,224,165,141,224,164,165,224,164,168,224,164,134,224,164,175,224,165,139,224,164
+,156,224,164,191,224,164,164,224,164,184,224,165,139,224,164,174,224,164,181,224
+,164,190,224,164,176,216,167,217,132,217,133,216,180,216,167,216,177,217,131,216
+,167,216,170,216,167,217,132,217,133,217,134,216,170,216,175,217,138,216,167,216
+,170,216,167,217,132,217,131,217,133,216,168,217,138,217,136,216,170,216,177,216
+,167,217,132,217,133,216,180,216,167,217,135,216,175,216,167,216,170,216,185,216
+,175,216,175,216,167,217,132,216,178,217,136,216,167,216,177,216,185,216,175,216
+,175,216,167,217,132,216,177,216,175,217,136,216,175,216,167,217,132,216,165,216
+,179,217,132,216,167,217,133,217,138,216,169,216,167,217,132,217,129,217,136,216
+,170,217,136,216,180,217,136,216,168,216,167,217,132,217,133,216,179,216,167,216
+,168,217,130,216,167,216,170,216,167,217,132,217,133,216,185,217,132,217,136,217
+,133,216,167,216,170,216,167,217,132,217,133,216,179,217,132,216,179,217,132,216
+,167,216,170,216,167,217,132,216,172,216,177,216,167,217,129,217,138,217,131,216
+,179,216,167,217,132,216,167,216,179,217,132,216,167,217,133,217,138,216,169,216
+,167,217,132,216,167,216,170,216,181,216,167,217,132,216,167,216,170,107,101,121
+,119,111,114,100,115,34,32,99,111,110,116,101,110,116,61,34,119,51,46,111,114,
+103,47,49,57,57,57,47,120,104,116,109,108,34,62,60,97,32,116,97,114,103,101,116,
+61,34,95,98,108,97,110,107,34,32,116,101,120,116,47,104,116,109,108,59,32,99,104
+,97,114,115,101,116,61,34,32,116,97,114,103,101,116,61,34,95,98,108,97,110,107,
+34,62,60,116,97,98,108,101,32,99,101,108,108,112,97,100,100,105,110,103,61,34,97
+,117,116,111,99,111,109,112,108,101,116,101,61,34,111,102,102,34,32,116,101,120,
+116,45,97,108,105,103,110,58,32,99,101,110,116,101,114,59,116,111,32,108,97,115,
+116,32,118,101,114,115,105,111,110,32,98,121,32,98,97,99,107,103,114,111,117,110
+,100,45,99,111,108,111,114,58,32,35,34,32,104,114,101,102,61,34,104,116,116,112,
+58,47,47,119,119,119,46,47,100,105,118,62,60,47,100,105,118,62,60,100,105,118,32
+,105,100,61,60,97,32,104,114,101,102,61,34,35,34,32,99,108,97,115,115,61,34,34,
+62,60,105,109,103,32,115,114,99,61,34,104,116,116,112,58,47,47,99,114,105,112,
+116,34,32,115,114,99,61,34,104,116,116,112,58,47,47,10,60,115,99,114,105,112,116
+,32,108,97,110,103,117,97,103,101,61,34,47,47,69,78,34,32,34,104,116,116,112,58,
+47,47,119,119,119,46,119,101,110,99,111,100,101,85,82,73,67,111,109,112,111,110,
+101,110,116,40,34,32,104,114,101,102,61,34,106,97,118,97,115,99,114,105,112,116,
+58,60,100,105,118,32,99,108,97,115,115,61,34,99,111,110,116,101,110,116,100,111,
+99,117,109,101,110,116,46,119,114,105,116,101,40,39,60,115,99,112,111,115,105,
+116,105,111,110,58,32,97,98,115,111,108,117,116,101,59,115,99,114,105,112,116,32
+,115,114,99,61,34,104,116,116,112,58,47,47,32,115,116,121,108,101,61,34,109,97,
+114,103,105,110,45,116,111,112,58,46,109,105,110,46,106,115,34,62,60,47,115,99,
+114,105,112,116,62,10,60,47,100,105,118,62,10,60,100,105,118,32,99,108,97,115,
+115,61,34,119,51,46,111,114,103,47,49,57,57,57,47,120,104,116,109,108,34,32,10,
+13,10,60,47,98,111,100,121,62,13,10,60,47,104,116,109,108,62,100,105,115,116,105
+,110,99,116,105,111,110,32,98,101,116,119,101,101,110,47,34,32,116,97,114,103,
+101,116,61,34,95,98,108,97,110,107,34,62,60,108,105,110,107,32,104,114,101,102,
+61,34,104,116,116,112,58,47,47,101,110,99,111,100,105,110,103,61,34,117,116,102,
+45,56,34,63,62,10,119,46,97,100,100,69,118,101,110,116,76,105,115,116,101,110,
+101,114,63,97,99,116,105,111,110,61,34,104,116,116,112,58,47,47,119,119,119,46,
+105,99,111,110,34,32,104,114,101,102,61,34,104,116,116,112,58,47,47,32,115,116,
+121,108,101,61,34,98,97,99,107,103,114,111,117,110,100,58,116,121,112,101,61,34,
+116,101,120,116,47,99,115,115,34,32,47,62,10,109,101,116,97,32,112,114,111,112,
+101,114,116,121,61,34,111,103,58,116,60,105,110,112,117,116,32,116,121,112,101,
+61,34,116,101,120,116,34,32,32,115,116,121,108,101,61,34,116,101,120,116,45,97,
+108,105,103,110,58,116,104,101,32,100,101,118,101,108,111,112,109,101,110,116,32
+,111,102,32,116,121,108,101,115,104,101,101,116,34,32,116,121,112,101,61,34,116,
+101,104,116,109,108,59,32,99,104,97,114,115,101,116,61,117,116,102,45,56,105,115
+,32,99,111,110,115,105,100,101,114,101,100,32,116,111,32,98,101,116,97,98,108,
+101,32,119,105,100,116,104,61,34,49,48,48,37,34,32,73,110,32,97,100,100,105,116,
+105,111,110,32,116,111,32,116,104,101,32,99,111,110,116,114,105,98,117,116,101,
+100,32,116,111,32,116,104,101,32,100,105,102,102,101,114,101,110,99,101,115,32,
+98,101,116,119,101,101,110,100,101,118,101,108,111,112,109,101,110,116,32,111,
+102,32,116,104,101,32,73,116,32,105,115,32,105,109,112,111,114,116,97,110,116,32
+,116,111,32,60,47,115,99,114,105,112,116,62,10,10,60,115,99,114,105,112,116,32,
+32,115,116,121,108,101,61,34,102,111,110,116,45,115,105,122,101,58,49,62,60,47,
+115,112,97,110,62,60,115,112,97,110,32,105,100,61,103,98,76,105,98,114,97,114,
+121,32,111,102,32,67,111,110,103,114,101,115,115,60,105,109,103,32,115,114,99,61
+,34,104,116,116,112,58,47,47,105,109,69,110,103,108,105,115,104,32,116,114,97,
+110,115,108,97,116,105,111,110,65,99,97,100,101,109,121,32,111,102,32,83,99,105,
+101,110,99,101,115,100,105,118,32,115,116,121,108,101,61,34,100,105,115,112,108,
+97,121,58,99,111,110,115,116,114,117,99,116,105,111,110,32,111,102,32,116,104,
+101,46,103,101,116,69,108,101,109,101,110,116,66,121,73,100,40,105,100,41,105,
+110,32,99,111,110,106,117,110,99,116,105,111,110,32,119,105,116,104,69,108,101,
+109,101,110,116,40,39,115,99,114,105,112,116,39,41,59,32,60,109,101,116,97,32,
+112,114,111,112,101,114,116,121,61,34,111,103,58,208,145,209,138,208,187,208,179
+,208,176,209,128,209,129,208,186,208,184,10,32,116,121,112,101,61,34,116,101,120
+,116,34,32,110,97,109,101,61,34,62,80,114,105,118,97,99,121,32,80,111,108,105,99
+,121,60,47,97,62,97,100,109,105,110,105,115,116,101,114,101,100,32,98,121,32,116
+,104,101,101,110,97,98,108,101,83,105,110,103,108,101,82,101,113,117,101,115,116
+,115,116,121,108,101,61,38,113,117,111,116,59,109,97,114,103,105,110,58,60,47,
+100,105,118,62,60,47,100,105,118,62,60,47,100,105,118,62,60,62,60,105,109,103,32
+,115,114,99,61,34,104,116,116,112,58,47,47,105,32,115,116,121,108,101,61,38,113,
+117,111,116,59,102,108,111,97,116,58,114,101,102,101,114,114,101,100,32,116,111,
+32,97,115,32,116,104,101,32,116,111,116,97,108,32,112,111,112,117,108,97,116,105
+,111,110,32,111,102,105,110,32,87,97,115,104,105,110,103,116,111,110,44,32,68,46
+,67,46,32,115,116,121,108,101,61,34,98,97,99,107,103,114,111,117,110,100,45,97,
+109,111,110,103,32,111,116,104,101,114,32,116,104,105,110,103,115,44,111,114,103
+,97,110,105,122,97,116,105,111,110,32,111,102,32,116,104,101,112,97,114,116,105,
+99,105,112,97,116,101,100,32,105,110,32,116,104,101,116,104,101,32,105,110,116,
+114,111,100,117,99,116,105,111,110,32,111,102,105,100,101,110,116,105,102,105,
+101,100,32,119,105,116,104,32,116,104,101,102,105,99,116,105,111,110,97,108,32,
+99,104,97,114,97,99,116,101,114,32,79,120,102,111,114,100,32,85,110,105,118,101,
+114,115,105,116,121,32,109,105,115,117,110,100,101,114,115,116,97,110,100,105,
+110,103,32,111,102,84,104,101,114,101,32,97,114,101,44,32,104,111,119,101,118,
+101,114,44,115,116,121,108,101,115,104,101,101,116,34,32,104,114,101,102,61,34,
+47,67,111,108,117,109,98,105,97,32,85,110,105,118,101,114,115,105,116,121,101,
+120,112,97,110,100,101,100,32,116,111,32,105,110,99,108,117,100,101,117,115,117,
+97,108,108,121,32,114,101,102,101,114,114,101,100,32,116,111,105,110,100,105,99,
+97,116,105,110,103,32,116,104,97,116,32,116,104,101,104,97,118,101,32,115,117,
+103,103,101,115,116,101,100,32,116,104,97,116,97,102,102,105,108,105,97,116,101,
+100,32,119,105,116,104,32,116,104,101,99,111,114,114,101,108,97,116,105,111,110,
+32,98,101,116,119,101,101,110,110,117,109,98,101,114,32,111,102,32,100,105,102,
+102,101,114,101,110,116,62,60,47,116,100,62,60,47,116,114,62,60,47,116,97,98,108
+,101,62,82,101,112,117,98,108,105,99,32,111,102,32,73,114,101,108,97,110,100,10,
+60,47,115,99,114,105,112,116,62,10,60,115,99,114,105,112,116,32,117,110,100,101,
+114,32,116,104,101,32,105,110,102,108,117,101,110,99,101,99,111,110,116,114,105,
+98,117,116,105,111,110,32,116,111,32,116,104,101,79,102,102,105,99,105,97,108,32
+,119,101,98,115,105,116,101,32,111,102,104,101,97,100,113,117,97,114,116,101,114
+,115,32,111,102,32,116,104,101,99,101,110,116,101,114,101,100,32,97,114,111,117,
+110,100,32,116,104,101,105,109,112,108,105,99,97,116,105,111,110,115,32,111,102,
+32,116,104,101,104,97,118,101,32,98,101,101,110,32,100,101,118,101,108,111,112,
+101,100,70,101,100,101,114,97,108,32,82,101,112,117,98,108,105,99,32,111,102,98,
+101,99,97,109,101,32,105,110,99,114,101,97,115,105,110,103,108,121,99,111,110,
+116,105,110,117,97,116,105,111,110,32,111,102,32,116,104,101,78,111,116,101,44,
+32,104,111,119,101,118,101,114,44,32,116,104,97,116,115,105,109,105,108,97,114,
+32,116,111,32,116,104,97,116,32,111,102,32,99,97,112,97,98,105,108,105,116,105,
+101,115,32,111,102,32,116,104,101,97,99,99,111,114,100,97,110,99,101,32,119,105,
+116,104,32,116,104,101,112,97,114,116,105,99,105,112,97,110,116,115,32,105,110,
+32,116,104,101,102,117,114,116,104,101,114,32,100,101,118,101,108,111,112,109,
+101,110,116,117,110,100,101,114,32,116,104,101,32,100,105,114,101,99,116,105,111
+,110,105,115,32,111,102,116,101,110,32,99,111,110,115,105,100,101,114,101,100,
+104,105,115,32,121,111,117,110,103,101,114,32,98,114,111,116,104,101,114,60,47,
+116,100,62,60,47,116,114,62,60,47,116,97,98,108,101,62,60,97,32,104,116,116,112,
+45,101,113,117,105,118,61,34,88,45,85,65,45,112,104,121,115,105,99,97,108,32,112
+,114,111,112,101,114,116,105,101,115,111,102,32,66,114,105,116,105,115,104,32,67
+,111,108,117,109,98,105,97,104,97,115,32,98,101,101,110,32,99,114,105,116,105,99
+,105,122,101,100,40,119,105,116,104,32,116,104,101,32,101,120,99,101,112,116,105
+,111,110,113,117,101,115,116,105,111,110,115,32,97,98,111,117,116,32,116,104,101
+,112,97,115,115,105,110,103,32,116,104,114,111,117,103,104,32,116,104,101,48,34,
+32,99,101,108,108,112,97,100,100,105,110,103,61,34,48,34,32,116,104,111,117,115,
+97,110,100,115,32,111,102,32,112,101,111,112,108,101,114,101,100,105,114,101,99,
+116,115,32,104,101,114,101,46,32,70,111,114,104,97,118,101,32,99,104,105,108,100
+,114,101,110,32,117,110,100,101,114,37,51,69,37,51,67,47,115,99,114,105,112,116,
+37,51,69,34,41,41,59,60,97,32,104,114,101,102,61,34,104,116,116,112,58,47,47,119
+,119,119,46,60,108,105,62,60,97,32,104,114,101,102,61,34,104,116,116,112,58,47,
+47,115,105,116,101,95,110,97,109,101,34,32,99,111,110,116,101,110,116,61,34,116,
+101,120,116,45,100,101,99,111,114,97,116,105,111,110,58,110,111,110,101,115,116,
+121,108,101,61,34,100,105,115,112,108,97,121,58,32,110,111,110,101,60,109,101,
+116,97,32,104,116,116,112,45,101,113,117,105,118,61,34,88,45,110,101,119,32,68,
+97,116,101,40,41,46,103,101,116,84,105,109,101,40,41,32,116,121,112,101,61,34,
+105,109,97,103,101,47,120,45,105,99,111,110,34,60,47,115,112,97,110,62,60,115,
+112,97,110,32,99,108,97,115,115,61,34,108,97,110,103,117,97,103,101,61,34,106,97
+,118,97,115,99,114,105,112,116,119,105,110,100,111,119,46,108,111,99,97,116,105,
+111,110,46,104,114,101,102,60,97,32,104,114,101,102,61,34,106,97,118,97,115,99,
+114,105,112,116,58,45,45,62,13,10,60,115,99,114,105,112,116,32,116,121,112,101,
+61,34,116,60,97,32,104,114,101,102,61,39,104,116,116,112,58,47,47,119,119,119,46
+,104,111,114,116,99,117,116,32,105,99,111,110,34,32,104,114,101,102,61,34,60,47,
+100,105,118,62,13,10,60,100,105,118,32,99,108,97,115,115,61,34,60,115,99,114,105
+,112,116,32,115,114,99,61,34,104,116,116,112,58,47,47,34,32,114,101,108,61,34,
+115,116,121,108,101,115,104,101,101,116,34,32,116,60,47,100,105,118,62,10,60,115
+,99,114,105,112,116,32,116,121,112,101,61,47,97,62,32,60,97,32,104,114,101,102,
+61,34,104,116,116,112,58,47,47,32,97,108,108,111,119,84,114,97,110,115,112,97,
+114,101,110,99,121,61,34,88,45,85,65,45,67,111,109,112,97,116,105,98,108,101,34,
+32,99,111,110,114,101,108,97,116,105,111,110,115,104,105,112,32,98,101,116,119,
+101,101,110,10,60,47,115,99,114,105,112,116,62,13,10,60,115,99,114,105,112,116,
+32,60,47,97,62,60,47,108,105,62,60,47,117,108,62,60,47,100,105,118,62,97,115,115
+,111,99,105,97,116,101,100,32,119,105,116,104,32,116,104,101,32,112,114,111,103,
+114,97,109,109,105,110,103,32,108,97,110,103,117,97,103,101,60,47,97,62,60,97,32
+,104,114,101,102,61,34,104,116,116,112,58,47,47,60,47,97,62,60,47,108,105,62,60,
+108,105,32,99,108,97,115,115,61,34,102,111,114,109,32,97,99,116,105,111,110,61,
+34,104,116,116,112,58,47,47,60,100,105,118,32,115,116,121,108,101,61,34,100,105,
+115,112,108,97,121,58,116,121,112,101,61,34,116,101,120,116,34,32,110,97,109,101
+,61,34,113,34,60,116,97,98,108,101,32,119,105,100,116,104,61,34,49,48,48,37,34,
+32,98,97,99,107,103,114,111,117,110,100,45,112,111,115,105,116,105,111,110,58,34
+,32,98,111,114,100,101,114,61,34,48,34,32,119,105,100,116,104,61,34,114,101,108,
+61,34,115,104,111,114,116,99,117,116,32,105,99,111,110,34,32,104,54,62,60,117,
+108,62,60,108,105,62,60,97,32,104,114,101,102,61,34,32,32,60,109,101,116,97,32,
+104,116,116,112,45,101,113,117,105,118,61,34,99,115,115,34,32,109,101,100,105,97
+,61,34,115,99,114,101,101,110,34,32,114,101,115,112,111,110,115,105,98,108,101,
+32,102,111,114,32,116,104,101,32,34,32,116,121,112,101,61,34,97,112,112,108,105,
+99,97,116,105,111,110,47,34,32,115,116,121,108,101,61,34,98,97,99,107,103,114,
+111,117,110,100,45,104,116,109,108,59,32,99,104,97,114,115,101,116,61,117,116,
+102,45,56,34,32,97,108,108,111,119,116,114,97,110,115,112,97,114,101,110,99,121,
+61,34,115,116,121,108,101,115,104,101,101,116,34,32,116,121,112,101,61,34,116,
+101,13,10,60,109,101,116,97,32,104,116,116,112,45,101,113,117,105,118,61,34,62,
+60,47,115,112,97,110,62,60,115,112,97,110,32,99,108,97,115,115,61,34,48,34,32,99
+,101,108,108,115,112,97,99,105,110,103,61,34,48,34,62,59,10,60,47,115,99,114,105
+,112,116,62,10,60,115,99,114,105,112,116,32,115,111,109,101,116,105,109,101,115,
+32,99,97,108,108,101,100,32,116,104,101,100,111,101,115,32,110,111,116,32,110,
+101,99,101,115,115,97,114,105,108,121,70,111,114,32,109,111,114,101,32,105,110,
+102,111,114,109,97,116,105,111,110,97,116,32,116,104,101,32,98,101,103,105,110,
+110,105,110,103,32,111,102,32,60,33,68,79,67,84,89,80,69,32,104,116,109,108,62,
+60,104,116,109,108,112,97,114,116,105,99,117,108,97,114,108,121,32,105,110,32,
+116,104,101,32,116,121,112,101,61,34,104,105,100,100,101,110,34,32,110,97,109,
+101,61,34,106,97,118,97,115,99,114,105,112,116,58,118,111,105,100,40,48,41,59,34
+,101,102,102,101,99,116,105,118,101,110,101,115,115,32,111,102,32,116,104,101,32
+,97,117,116,111,99,111,109,112,108,101,116,101,61,34,111,102,102,34,32,103,101,
+110,101,114,97,108,108,121,32,99,111,110,115,105,100,101,114,101,100,62,60,105,
+110,112,117,116,32,116,121,112,101,61,34,116,101,120,116,34,32,34,62,60,47,115,
+99,114,105,112,116,62,13,10,60,115,99,114,105,112,116,116,104,114,111,117,103,
+104,111,117,116,32,116,104,101,32,119,111,114,108,100,99,111,109,109,111,110,32,
+109,105,115,99,111,110,99,101,112,116,105,111,110,97,115,115,111,99,105,97,116,
+105,111,110,32,119,105,116,104,32,116,104,101,60,47,100,105,118,62,10,60,47,100,
+105,118,62,10,60,100,105,118,32,99,100,117,114,105,110,103,32,104,105,115,32,108
+,105,102,101,116,105,109,101,44,99,111,114,114,101,115,112,111,110,100,105,110,
+103,32,116,111,32,116,104,101,116,121,112,101,61,34,105,109,97,103,101,47,120,45
+,105,99,111,110,34,32,97,110,32,105,110,99,114,101,97,115,105,110,103,32,110,117
+,109,98,101,114,100,105,112,108,111,109,97,116,105,99,32,114,101,108,97,116,105,
+111,110,115,97,114,101,32,111,102,116,101,110,32,99,111,110,115,105,100,101,114,
+101,100,109,101,116,97,32,99,104,97,114,115,101,116,61,34,117,116,102,45,56,34,
+32,60,105,110,112,117,116,32,116,121,112,101,61,34,116,101,120,116,34,32,101,120
+,97,109,112,108,101,115,32,105,110,99,108,117,100,101,32,116,104,101,34,62,60,
+105,109,103,32,115,114,99,61,34,104,116,116,112,58,47,47,105,112,97,114,116,105,
+99,105,112,97,116,105,111,110,32,105,110,32,116,104,101,116,104,101,32,101,115,
+116,97,98,108,105,115,104,109,101,110,116,32,111,102,10,60,47,100,105,118,62,10,
+60,100,105,118,32,99,108,97,115,115,61,34,38,97,109,112,59,110,98,115,112,59,38,
+97,109,112,59,110,98,115,112,59,116,111,32,100,101,116,101,114,109,105,110,101,
+32,119,104,101,116,104,101,114,113,117,105,116,101,32,100,105,102,102,101,114,
+101,110,116,32,102,114,111,109,109,97,114,107,101,100,32,116,104,101,32,98,101,
+103,105,110,110,105,110,103,100,105,115,116,97,110,99,101,32,98,101,116,119,101,
+101,110,32,116,104,101,99,111,110,116,114,105,98,117,116,105,111,110,115,32,116,
+111,32,116,104,101,99,111,110,102,108,105,99,116,32,98,101,116,119,101,101,110,
+32,116,104,101,119,105,100,101,108,121,32,99,111,110,115,105,100,101,114,101,100
+,32,116,111,119,97,115,32,111,110,101,32,111,102,32,116,104,101,32,102,105,114,
+115,116,119,105,116,104,32,118,97,114,121,105,110,103,32,100,101,103,114,101,101
+,115,104,97,118,101,32,115,112,101,99,117,108,97,116,101,100,32,116,104,97,116,
+40,100,111,99,117,109,101,110,116,46,103,101,116,69,108,101,109,101,110,116,112,
+97,114,116,105,99,105,112,97,116,105,110,103,32,105,110,32,116,104,101,111,114,
+105,103,105,110,97,108,108,121,32,100,101,118,101,108,111,112,101,100,101,116,97
+,32,99,104,97,114,115,101,116,61,34,117,116,102,45,56,34,62,32,116,121,112,101,
+61,34,116,101,120,116,47,99,115,115,34,32,47,62,10,105,110,116,101,114,99,104,97
+,110,103,101,97,98,108,121,32,119,105,116,104,109,111,114,101,32,99,108,111,115,
+101,108,121,32,114,101,108,97,116,101,100,115,111,99,105,97,108,32,97,110,100,32
+,112,111,108,105,116,105,99,97,108,116,104,97,116,32,119,111,117,108,100,32,111,
+116,104,101,114,119,105,115,101,112,101,114,112,101,110,100,105,99,117,108,97,
+114,32,116,111,32,116,104,101,115,116,121,108,101,32,116,121,112,101,61,34,116,
+101,120,116,47,99,115,115,116,121,112,101,61,34,115,117,98,109,105,116,34,32,110
+,97,109,101,61,34,102,97,109,105,108,105,101,115,32,114,101,115,105,100,105,110,
+103,32,105,110,100,101,118,101,108,111,112,105,110,103,32,99,111,117,110,116,114
+,105,101,115,99,111,109,112,117,116,101,114,32,112,114,111,103,114,97,109,109,
+105,110,103,101,99,111,110,111,109,105,99,32,100,101,118,101,108,111,112,109,101
+,110,116,100,101,116,101,114,109,105,110,97,116,105,111,110,32,111,102,32,116,
+104,101,102,111,114,32,109,111,114,101,32,105,110,102,111,114,109,97,116,105,111
+,110,111,110,32,115,101,118,101,114,97,108,32,111,99,99,97,115,105,111,110,115,
+112,111,114,116,117,103,117,195,170,115,32,40,69,117,114,111,112,101,117,41,208,
+163,208,186,209,128,208,176,209,151,208,189,209,129,209,140,208,186,208,176,209,
+131,208,186,209,128,208,176,209,151,208,189,209,129,209,140,208,186,208,176,208,
+160,208,190,209,129,209,129,208,184,208,185,209,129,208,186,208,190,208,185,208,
+188,208,176,209,130,208,181,209,128,208,184,208,176,208,187,208,190,208,178,208,
+184,208,189,209,132,208,190,209,128,208,188,208,176,209,134,208,184,208,184,209,
+131,208,191,209,128,208,176,208,178,208,187,208,181,208,189,208,184,209,143,208,
+189,208,181,208,190,208,177,209,133,208,190,208,180,208,184,208,188,208,190,208,
+184,208,189,209,132,208,190,209,128,208,188,208,176,209,134,208,184,209,143,208,
+152,208,189,209,132,208,190,209,128,208,188,208,176,209,134,208,184,209,143,208,
+160,208,181,209,129,208,191,209,131,208,177,208,187,208,184,208,186,208,184,208,
+186,208,190,208,187,208,184,209,135,208,181,209,129,209,130,208,178,208,190,208,
+184,208,189,209,132,208,190,209,128,208,188,208,176,209,134,208,184,209,142,209,
+130,208,181,209,128,209,128,208,184,209,130,208,190,209,128,208,184,208,184,208,
+180,208,190,209,129,209,130,208,176,209,130,208,190,209,135,208,189,208,190,216,
+167,217,132,217,133,216,170,217,136,216,167,216,172,216,175,217,136,217,134,216,
+167,217,132,216,167,216,180,216,170,216,177,216,167,217,131,216,167,216,170,216,
+167,217,132,216,167,217,130,216,170,216,177,216,167,216,173,216,167,216,170,104,
+116,109,108,59,32,99,104,97,114,115,101,116,61,85,84,70,45,56,34,32,115,101,116,
+84,105,109,101,111,117,116,40,102,117,110,99,116,105,111,110,40,41,100,105,115,
+112,108,97,121,58,105,110,108,105,110,101,45,98,108,111,99,107,59,60,105,110,112
+,117,116,32,116,121,112,101,61,34,115,117,98,109,105,116,34,32,116,121,112,101,
+32,61,32,39,116,101,120,116,47,106,97,118,97,115,99,114,105,60,105,109,103,32,
+115,114,99,61,34,104,116,116,112,58,47,47,119,119,119,46,34,32,34,104,116,116,
+112,58,47,47,119,119,119,46,119,51,46,111,114,103,47,115,104,111,114,116,99,117,
+116,32,105,99,111,110,34,32,104,114,101,102,61,34,34,32,97,117,116,111,99,111,
+109,112,108,101,116,101,61,34,111,102,102,34,32,60,47,97,62,60,47,100,105,118,62
+,60,100,105,118,32,99,108,97,115,115,61,60,47,97,62,60,47,108,105,62,10,60,108,
+105,32,99,108,97,115,115,61,34,99,115,115,34,32,116,121,112,101,61,34,116,101,
+120,116,47,99,115,115,34,32,60,102,111,114,109,32,97,99,116,105,111,110,61,34,
+104,116,116,112,58,47,47,120,116,47,99,115,115,34,32,104,114,101,102,61,34,104,
+116,116,112,58,47,47,108,105,110,107,32,114,101,108,61,34,97,108,116,101,114,110
+,97,116,101,34,32,13,10,60,115,99,114,105,112,116,32,116,121,112,101,61,34,116,
+101,120,116,47,32,111,110,99,108,105,99,107,61,34,106,97,118,97,115,99,114,105,
+112,116,58,40,110,101,119,32,68,97,116,101,41,46,103,101,116,84,105,109,101,40,
+41,125,104,101,105,103,104,116,61,34,49,34,32,119,105,100,116,104,61,34,49,34,32
+,80,101,111,112,108,101,39,115,32,82,101,112,117,98,108,105,99,32,111,102,32,32,
+60,97,32,104,114,101,102,61,34,104,116,116,112,58,47,47,119,119,119,46,116,101,
+120,116,45,100,101,99,111,114,97,116,105,111,110,58,117,110,100,101,114,116,104,
+101,32,98,101,103,105,110,110,105,110,103,32,111,102,32,116,104,101,32,60,47,100
+,105,118,62,10,60,47,100,105,118,62,10,60,47,100,105,118,62,10,101,115,116,97,98
+,108,105,115,104,109,101,110,116,32,111,102,32,116,104,101,32,60,47,100,105,118,
+62,60,47,100,105,118,62,60,47,100,105,118,62,60,47,100,35,118,105,101,119,112,
+111,114,116,123,109,105,110,45,104,101,105,103,104,116,58,10,60,115,99,114,105,
+112,116,32,115,114,99,61,34,104,116,116,112,58,47,47,111,112,116,105,111,110,62,
+60,111,112,116,105,111,110,32,118,97,108,117,101,61,111,102,116,101,110,32,114,
+101,102,101,114,114,101,100,32,116,111,32,97,115,32,47,111,112,116,105,111,110,
+62,10,60,111,112,116,105,111,110,32,118,97,108,117,60,33,68,79,67,84,89,80,69,32
+,104,116,109,108,62,10,60,33,45,45,91,73,110,116,101,114,110,97,116,105,111,110,
+97,108,32,65,105,114,112,111,114,116,62,10,60,97,32,104,114,101,102,61,34,104,
+116,116,112,58,47,47,119,119,119,60,47,97,62,60,97,32,104,114,101,102,61,34,104,
+116,116,112,58,47,47,119,224,184,160,224,184,178,224,184,169,224,184,178,224,185
+,132,224,184,151,224,184,162,225,131,165,225,131,144,225,131,160,225,131,151,225
+,131,163,225,131,154,225,131,152,230,173,163,233,171,148,228,184,173,230,150,135
+,32,40,231,185,129,233,171,148,41,224,164,168,224,164,191,224,164,176,224,165,
+141,224,164,166,224,165,135,224,164,182,224,164,161,224,164,190,224,164,137,224,
+164,168,224,164,178,224,165,139,224,164,161,224,164,149,224,165,141,224,164,183,
+224,165,135,224,164,164,224,165,141,224,164,176,224,164,156,224,164,190,224,164,
+168,224,164,149,224,164,190,224,164,176,224,165,128,224,164,184,224,164,130,224,
+164,172,224,164,130,224,164,167,224,164,191,224,164,164,224,164,184,224,165,141,
+224,164,165,224,164,190,224,164,170,224,164,168,224,164,190,224,164,184,224,165,
+141,224,164,181,224,165,128,224,164,149,224,164,190,224,164,176,224,164,184,224,
+164,130,224,164,184,224,165,141,224,164,149,224,164,176,224,164,163,224,164,184,
+224,164,190,224,164,174,224,164,151,224,165,141,224,164,176,224,165,128,224,164,
+154,224,164,191,224,164,159,224,165,141,224,164,160,224,165,139,224,164,130,224,
+164,181,224,164,191,224,164,156,224,165,141,224,164,158,224,164,190,224,164,168,
+224,164,133,224,164,174,224,165,135,224,164,176,224,164,191,224,164,149,224,164,
+190,224,164,181,224,164,191,224,164,173,224,164,191,224,164,168,224,165,141,224,
+164,168,224,164,151,224,164,190,224,164,161,224,164,191,224,164,175,224,164,190,
+224,164,129,224,164,149,224,165,141,224,164,175,224,165,139,224,164,130,224,164,
+149,224,164,191,224,164,184,224,165,129,224,164,176,224,164,149,224,165,141,224,
+164,183,224,164,190,224,164,170,224,164,185,224,165,129,224,164,129,224,164,154,
+224,164,164,224,165,128,224,164,170,224,165,141,224,164,176,224,164,172,224,164,
+130,224,164,167,224,164,168,224,164,159,224,164,191,224,164,170,224,165,141,224,
+164,170,224,164,163,224,165,128,224,164,149,224,165,141,224,164,176,224,164,191,
+224,164,149,224,165,135,224,164,159,224,164,170,224,165,141,224,164,176,224,164,
+190,224,164,176,224,164,130,224,164,173,224,164,170,224,165,141,224,164,176,224,
+164,190,224,164,170,224,165,141,224,164,164,224,164,174,224,164,190,224,164,178,
+224,164,191,224,164,149,224,165,139,224,164,130,224,164,176,224,164,171,224,164,
+188,224,165,141,224,164,164,224,164,190,224,164,176,224,164,168,224,164,191,224,
+164,176,224,165,141,224,164,174,224,164,190,224,164,163,224,164,178,224,164,191,
+224,164,174,224,164,191,224,164,159,224,165,135,224,164,161,100,101,115,99,114,
+105,112,116,105,111,110,34,32,99,111,110,116,101,110,116,61,34,100,111,99,117,
+109,101,110,116,46,108,111,99,97,116,105,111,110,46,112,114,111,116,46,103,101,
+116,69,108,101,109,101,110,116,115,66,121,84,97,103,78,97,109,101,40,60,33,68,79
+,67,84,89,80,69,32,104,116,109,108,62,10,60,104,116,109,108,32,60,109,101,116,97
+,32,99,104,97,114,115,101,116,61,34,117,116,102,45,56,34,62,58,117,114,108,34,32
+,99,111,110,116,101,110,116,61,34,104,116,116,112,58,47,47,46,99,115,115,34,32,
+114,101,108,61,34,115,116,121,108,101,115,104,101,101,116,34,115,116,121,108,101
+,32,116,121,112,101,61,34,116,101,120,116,47,99,115,115,34,62,116,121,112,101,61
+,34,116,101,120,116,47,99,115,115,34,32,104,114,101,102,61,34,119,51,46,111,114,
+103,47,49,57,57,57,47,120,104,116,109,108,34,32,120,109,108,116,121,112,101,61,
+34,116,101,120,116,47,106,97,118,97,115,99,114,105,112,116,34,32,109,101,116,104
+,111,100,61,34,103,101,116,34,32,97,99,116,105,111,110,61,34,108,105,110,107,32,
+114,101,108,61,34,115,116,121,108,101,115,104,101,101,116,34,32,32,61,32,100,111
+,99,117,109,101,110,116,46,103,101,116,69,108,101,109,101,110,116,116,121,112,
+101,61,34,105,109,97,103,101,47,120,45,105,99,111,110,34,32,47,62,99,101,108,108
+,112,97,100,100,105,110,103,61,34,48,34,32,99,101,108,108,115,112,46,99,115,115,
+34,32,116,121,112,101,61,34,116,101,120,116,47,99,115,115,34,32,60,47,97,62,60,
+47,108,105,62,60,108,105,62,60,97,32,104,114,101,102,61,34,34,32,119,105,100,116
+,104,61,34,49,34,32,104,101,105,103,104,116,61,34,49,34,34,62,60,97,32,104,114,
+101,102,61,34,104,116,116,112,58,47,47,119,119,119,46,115,116,121,108,101,61,34,
+100,105,115,112,108,97,121,58,110,111,110,101,59,34,62,97,108,116,101,114,110,97
+,116,101,34,32,116,121,112,101,61,34,97,112,112,108,105,45,47,47,87,51,67,47,47,
+68,84,68,32,88,72,84,77,76,32,49,46,48,32,101,108,108,115,112,97,99,105,110,103,
+61,34,48,34,32,99,101,108,108,112,97,100,32,116,121,112,101,61,34,104,105,100,
+100,101,110,34,32,118,97,108,117,101,61,34,47,97,62,38,110,98,115,112,59,60,115,
+112,97,110,32,114,111,108,101,61,34,115,10,60,105,110,112,117,116,32,116,121,112
+,101,61,34,104,105,100,100,101,110,34,32,108,97,110,103,117,97,103,101,61,34,74,
+97,118,97,83,99,114,105,112,116,34,32,32,100,111,99,117,109,101,110,116,46,103,
+101,116,69,108,101,109,101,110,116,115,66,103,61,34,48,34,32,99,101,108,108,115,
+112,97,99,105,110,103,61,34,48,34,32,121,112,101,61,34,116,101,120,116,47,99,115
+,115,34,32,109,101,100,105,97,61,34,116,121,112,101,61,39,116,101,120,116,47,106
+,97,118,97,115,99,114,105,112,116,39,119,105,116,104,32,116,104,101,32,101,120,
+99,101,112,116,105,111,110,32,111,102,32,121,112,101,61,34,116,101,120,116,47,99
+,115,115,34,32,114,101,108,61,34,115,116,32,104,101,105,103,104,116,61,34,49,34,
+32,119,105,100,116,104,61,34,49,34,32,61,39,43,101,110,99,111,100,101,85,82,73,
+67,111,109,112,111,110,101,110,116,40,60,108,105,110,107,32,114,101,108,61,34,97
+,108,116,101,114,110,97,116,101,34,32,10,98,111,100,121,44,32,116,114,44,32,105,
+110,112,117,116,44,32,116,101,120,116,109,101,116,97,32,110,97,109,101,61,34,114
+,111,98,111,116,115,34,32,99,111,110,109,101,116,104,111,100,61,34,112,111,115,
+116,34,32,97,99,116,105,111,110,61,34,62,10,60,97,32,104,114,101,102,61,34,104,
+116,116,112,58,47,47,119,119,119,46,99,115,115,34,32,114,101,108,61,34,115,116,
+121,108,101,115,104,101,101,116,34,32,60,47,100,105,118,62,60,47,100,105,118,62,
+60,100,105,118,32,99,108,97,115,115,108,97,110,103,117,97,103,101,61,34,106,97,
+118,97,115,99,114,105,112,116,34,62,97,114,105,97,45,104,105,100,100,101,110,61,
+34,116,114,117,101,34,62,194,183,60,114,105,112,116,34,32,116,121,112,101,61,34,
+116,101,120,116,47,106,97,118,97,115,108,61,48,59,125,41,40,41,59,10,40,102,117,
+110,99,116,105,111,110,40,41,123,98,97,99,107,103,114,111,117,110,100,45,105,109
+,97,103,101,58,32,117,114,108,40,47,97,62,60,47,108,105,62,60,108,105,62,60,97,
+32,104,114,101,102,61,34,104,9,9,60,108,105,62,60,97,32,104,114,101,102,61,34,
+104,116,116,112,58,47,47,97,116,111,114,34,32,97,114,105,97,45,104,105,100,100,
+101,110,61,34,116,114,117,62,32,60,97,32,104,114,101,102,61,34,104,116,116,112,
+58,47,47,119,119,119,46,108,97,110,103,117,97,103,101,61,34,106,97,118,97,115,99
+,114,105,112,116,34,32,47,111,112,116,105,111,110,62,10,60,111,112,116,105,111,
+110,32,118,97,108,117,101,47,100,105,118,62,60,47,100,105,118,62,60,100,105,118,
+32,99,108,97,115,115,61,114,97,116,111,114,34,32,97,114,105,97,45,104,105,100,
+100,101,110,61,34,116,114,101,61,40,110,101,119,32,68,97,116,101,41,46,103,101,
+116,84,105,109,101,40,41,112,111,114,116,117,103,117,195,170,115,32,40,100,111,
+32,66,114,97,115,105,108,41,208,190,209,128,208,179,208,176,208,189,208,184,208,
+183,208,176,209,134,208,184,208,184,208,178,208,190,208,183,208,188,208,190,208,
+182,208,189,208,190,209,129,209,130,209,140,208,190,208,177,209,128,208,176,208,
+183,208,190,208,178,208,176,208,189,208,184,209,143,209,128,208,181,208,179,208,
+184,209,129,209,130,209,128,208,176,209,134,208,184,208,184,208,178,208,190,208,
+183,208,188,208,190,208,182,208,189,208,190,209,129,209,130,208,184,208,190,208,
+177,209,143,208,183,208,176,209,130,208,181,208,187,209,140,208,189,208,176,60,
+33,68,79,67,84,89,80,69,32,104,116,109,108,32,80,85,66,76,73,67,32,34,110,116,45
+,84,121,112,101,34,32,99,111,110,116,101,110,116,61,34,116,101,120,116,47,60,109
+,101,116,97,32,104,116,116,112,45,101,113,117,105,118,61,34,67,111,110,116,101,
+114,97,110,115,105,116,105,111,110,97,108,47,47,69,78,34,32,34,104,116,116,112,
+58,60,104,116,109,108,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,119,
+119,119,45,47,47,87,51,67,47,47,68,84,68,32,88,72,84,77,76,32,49,46,48,32,84,68,
+84,68,47,120,104,116,109,108,49,45,116,114,97,110,115,105,116,105,111,110,97,108
+,47,47,119,119,119,46,119,51,46,111,114,103,47,84,82,47,120,104,116,109,108,49,
+47,112,101,32,61,32,39,116,101,120,116,47,106,97,118,97,115,99,114,105,112,116,
+39,59,60,109,101,116,97,32,110,97,109,101,61,34,100,101,115,99,114,105,112,116,
+105,111,110,112,97,114,101,110,116,78,111,100,101,46,105,110,115,101,114,116,66,
+101,102,111,114,101,60,105,110,112,117,116,32,116,121,112,101,61,34,104,105,100,
+100,101,110,34,32,110,97,106,115,34,32,116,121,112,101,61,34,116,101,120,116,47,
+106,97,118,97,115,99,114,105,40,100,111,99,117,109,101,110,116,41,46,114,101,97,
+100,121,40,102,117,110,99,116,105,115,99,114,105,112,116,32,116,121,112,101,61,
+34,116,101,120,116,47,106,97,118,97,115,105,109,97,103,101,34,32,99,111,110,116,
+101,110,116,61,34,104,116,116,112,58,47,47,85,65,45,67,111,109,112,97,116,105,98
+,108,101,34,32,99,111,110,116,101,110,116,61,116,109,108,59,32,99,104,97,114,115
+,101,116,61,117,116,102,45,56,34,32,47,62,10,108,105,110,107,32,114,101,108,61,
+34,115,104,111,114,116,99,117,116,32,105,99,111,110,60,108,105,110,107,32,114,
+101,108,61,34,115,116,121,108,101,115,104,101,101,116,34,32,60,47,115,99,114,105
+,112,116,62,10,60,115,99,114,105,112,116,32,116,121,112,101,61,61,32,100,111,99,
+117,109,101,110,116,46,99,114,101,97,116,101,69,108,101,109,101,110,60,97,32,116
+,97,114,103,101,116,61,34,95,98,108,97,110,107,34,32,104,114,101,102,61,32,100,
+111,99,117,109,101,110,116,46,103,101,116,69,108,101,109,101,110,116,115,66,105,
+110,112,117,116,32,116,121,112,101,61,34,116,101,120,116,34,32,110,97,109,101,61
+,97,46,116,121,112,101,32,61,32,39,116,101,120,116,47,106,97,118,97,115,99,114,
+105,110,112,117,116,32,116,121,112,101,61,34,104,105,100,100,101,110,34,32,110,
+97,109,101,104,116,109,108,59,32,99,104,97,114,115,101,116,61,117,116,102,45,56,
+34,32,47,62,100,116,100,34,62,10,60,104,116,109,108,32,120,109,108,110,115,61,34
+,104,116,116,112,45,47,47,87,51,67,47,47,68,84,68,32,72,84,77,76,32,52,46,48,49,
+32,84,101,110,116,115,66,121,84,97,103,78,97,109,101,40,39,115,99,114,105,112,
+116,39,41,105,110,112,117,116,32,116,121,112,101,61,34,104,105,100,100,101,110,
+34,32,110,97,109,60,115,99,114,105,112,116,32,116,121,112,101,61,34,116,101,120,
+116,47,106,97,118,97,115,34,32,115,116,121,108,101,61,34,100,105,115,112,108,97,
+121,58,110,111,110,101,59,34,62,100,111,99,117,109,101,110,116,46,103,101,116,69
+,108,101,109,101,110,116,66,121,73,100,40,61,100,111,99,117,109,101,110,116,46,
+99,114,101,97,116,101,69,108,101,109,101,110,116,40,39,32,116,121,112,101,61,39,
+116,101,120,116,47,106,97,118,97,115,99,114,105,112,116,39,105,110,112,117,116,
+32,116,121,112,101,61,34,116,101,120,116,34,32,110,97,109,101,61,34,100,46,103,
+101,116,69,108,101,109,101,110,116,115,66,121,84,97,103,78,97,109,101,40,115,110
+,105,99,97,108,34,32,104,114,101,102,61,34,104,116,116,112,58,47,47,119,119,119,
+46,67,47,47,68,84,68,32,72,84,77,76,32,52,46,48,49,32,84,114,97,110,115,105,116,
+60,115,116,121,108,101,32,116,121,112,101,61,34,116,101,120,116,47,99,115,115,34
+,62,10,10,60,115,116,121,108,101,32,116,121,112,101,61,34,116,101,120,116,47,99,
+115,115,34,62,105,111,110,97,108,46,100,116,100,34,62,10,60,104,116,109,108,32,
+120,109,108,110,115,61,104,116,116,112,45,101,113,117,105,118,61,34,67,111,110,
+116,101,110,116,45,84,121,112,101,100,105,110,103,61,34,48,34,32,99,101,108,108,
+115,112,97,99,105,110,103,61,34,48,34,104,116,109,108,59,32,99,104,97,114,115,
+101,116,61,117,116,102,45,56,34,32,47,62,10,32,115,116,121,108,101,61,34,100,105
+,115,112,108,97,121,58,110,111,110,101,59,34,62,60,60,108,105,62,60,97,32,104,
+114,101,102,61,34,104,116,116,112,58,47,47,119,119,119,46,32,116,121,112,101,61,
+39,116,101,120,116,47,106,97,118,97,115,99,114,105,112,116,39,62,208,180,208,181
+,209,143,209,130,208,181,208,187,209,140,208,189,208,190,209,129,209,130,208,184
+,209,129,208,190,208,190,209,130,208,178,208,181,209,130,209,129,209,130,208,178
+,208,184,208,184,208,191,209,128,208,190,208,184,208,183,208,178,208,190,208,180
+,209,129,209,130,208,178,208,176,208,177,208,181,208,183,208,190,208,191,208,176
+,209,129,208,189,208,190,209,129,209,130,208,184,224,164,170,224,165,129,224,164
+,184,224,165,141,224,164,164,224,164,191,224,164,149,224,164,190,224,164,149,224
+,164,190,224,164,130,224,164,151,224,165,141,224,164,176,224,165,135,224,164,184
+,224,164,137,224,164,168,224,165,141,224,164,185,224,165,139,224,164,130,224,164
+,168,224,165,135,224,164,181,224,164,191,224,164,167,224,164,190,224,164,168,224
+,164,184,224,164,173,224,164,190,224,164,171,224,164,191,224,164,149,224,165,141
+,224,164,184,224,164,191,224,164,130,224,164,151,224,164,184,224,165,129,224,164
+,176,224,164,149,224,165,141,224,164,183,224,164,191,224,164,164,224,164,149,224
+,165,137,224,164,170,224,165,128,224,164,176,224,164,190,224,164,135,224,164,159
+,224,164,181,224,164,191,224,164,156,224,165,141,224,164,158,224,164,190,224,164
+,170,224,164,168,224,164,149,224,164,190,224,164,176,224,165,141,224,164,176,224
+,164,181,224,164,190,224,164,136,224,164,184,224,164,149,224,165,141,224,164,176
+,224,164,191,224,164,175,224,164,164,224,164,190
+}
+;
+#endif /* !BROTLI_EXTERNAL_DICTIONARY_DATA */
+
+#if !defined(BROTLI_EXTERNAL_DICTIONARY_DATA)
+static const BrotliDictionary kBrotliDictionary = {
+#else
+static BrotliDictionary kBrotliDictionary = {
+#endif
+ /* size_bits_by_length */
+ {
+ 0, 0, 0, 0, 10, 10, 11, 11,
+ 10, 10, 10, 10, 10, 9, 9, 8,
+ 7, 7, 8, 7, 7, 6, 6, 5,
+ 5, 0, 0, 0, 0, 0, 0, 0
+ },
+
+ /* offsets_by_length */
+ {
+ 0, 0, 0, 0, 0, 4096, 9216, 21504,
+ 35840, 44032, 53248, 63488, 74752, 87040, 93696, 100864,
+ 104704, 106752, 108928, 113536, 115968, 118528, 119872, 121280,
+ 122016, 122784, 122784, 122784, 122784, 122784, 122784, 122784
+ },
+
+ /* data_size == sizeof(kBrotliDictionaryData) */
+ 122784,
+
+ /* data */
+#if defined(BROTLI_EXTERNAL_DICTIONARY_DATA)
+ NULL
+#else
+ kBrotliDictionaryData
+#endif
+};
+
+const BrotliDictionary* BrotliGetDictionary() {
+ return &kBrotliDictionary;
+}
+
+void BrotliSetDictionaryData(const uint8_t* data) {
+#if defined(BROTLI_EXTERNAL_DICTIONARY_DATA)
+ if (!!data && !kBrotliDictionary.data) {
+ kBrotliDictionary.data = data;
+ }
+#else
+ BROTLI_UNUSED(data); // Appease -Werror=unused-parameter
+#endif
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/dictionary.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/dictionary.h
new file mode 100644
index 000000000..b1c6f7f58
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/dictionary.h
@@ -0,0 +1,64 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Collection of static dictionary words. */
+
+#ifndef BROTLI_COMMON_DICTIONARY_H_
+#define BROTLI_COMMON_DICTIONARY_H_
+
+#include <brotli/port.h>
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+typedef struct BrotliDictionary {
+ /**
+ * Number of bits to encode index of dictionary word in a bucket.
+ *
+ * Specification: Appendix A. Static Dictionary Data
+ *
+ * Words in a dictionary are bucketed by length.
+ * @c 0 means that there are no words of a given length.
+ * Dictionary consists of words with length of [4..24] bytes.
+ * Values at [0..3] and [25..31] indices should not be addressed.
+ */
+ uint8_t size_bits_by_length[32];
+
+ /* assert(offset[i + 1] == offset[i] + (bits[i] ? (i << bits[i]) : 0)) */
+ uint32_t offsets_by_length[32];
+
+ /* assert(data_size == offsets_by_length[31]) */
+ size_t data_size;
+
+ /* Data array is not bound, and should obey to size_bits_by_length values.
+ Specified size matches default (RFC 7932) dictionary. Its size is
+ defined by data_size */
+ const uint8_t* data;
+} BrotliDictionary;
+
+BROTLI_COMMON_API const BrotliDictionary* BrotliGetDictionary(void);
+
+/**
+ * Sets dictionary data.
+ *
+ * When dictionary data is already set / present, this method is no-op.
+ *
+ * Dictionary data MUST be provided before BrotliGetDictionary is invoked.
+ * This method is used ONLY in multi-client environment (e.g. C + Java),
+ * to reduce storage by sharing single dictionary between implementations.
+ */
+BROTLI_COMMON_API void BrotliSetDictionaryData(const uint8_t* data);
+
+#define BROTLI_MIN_DICTIONARY_WORD_LENGTH 4
+#define BROTLI_MAX_DICTIONARY_WORD_LENGTH 24
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_COMMON_DICTIONARY_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/platform.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/platform.h
new file mode 100755
index 000000000..2633e0405
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/platform.h
@@ -0,0 +1,567 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Macros for compiler / platform specific features and build options.
+
+ Build options are:
+ * BROTLI_BUILD_32_BIT disables 64-bit optimizations
+ * BROTLI_BUILD_64_BIT forces to use 64-bit optimizations
+ * BROTLI_BUILD_BIG_ENDIAN forces to use big-endian optimizations
+ * BROTLI_BUILD_ENDIAN_NEUTRAL disables endian-aware optimizations
+ * BROTLI_BUILD_LITTLE_ENDIAN forces to use little-endian optimizations
+ * BROTLI_BUILD_PORTABLE disables dangerous optimizations, like unaligned
+ read and overlapping memcpy; this reduces decompression speed by 5%
+ * BROTLI_BUILD_NO_RBIT disables "rbit" optimization for ARM CPUs
+ * BROTLI_DEBUG dumps file name and line number when decoder detects stream
+ or memory error
+ * BROTLI_ENABLE_LOG enables asserts and dumps various state information
+*/
+
+#ifndef BROTLI_COMMON_PLATFORM_H_
+#define BROTLI_COMMON_PLATFORM_H_
+
+#include <string.h> /* memcpy */
+#include <stdlib.h> /* malloc, free */
+
+#include <brotli/port.h>
+#include <brotli/types.h>
+
+#if defined(OS_LINUX) || defined(OS_CYGWIN) || defined(__EMSCRIPTEN__)
+#include <endian.h>
+#elif defined(OS_FREEBSD)
+#include <machine/endian.h>
+#elif defined(OS_MACOSX)
+#include <machine/endian.h>
+/* Let's try and follow the Linux convention */
+#define BROTLI_X_BYTE_ORDER BYTE_ORDER
+#define BROTLI_X_LITTLE_ENDIAN LITTLE_ENDIAN
+#define BROTLI_X_BIG_ENDIAN BIG_ENDIAN
+#endif
+
+#if defined(BROTLI_ENABLE_LOG) || defined(BROTLI_DEBUG)
+#include <assert.h>
+#include <stdio.h>
+#endif
+
+/* The following macros were borrowed from https://github.com/nemequ/hedley
+ * with permission of original author - Evan Nemerson <evan@nemerson.com> */
+
+/* >>> >>> >>> hedley macros */
+
+/* Define "BROTLI_PREDICT_TRUE" and "BROTLI_PREDICT_FALSE" macros for capable
+ compilers.
+
+To apply compiler hint, enclose the branching condition into macros, like this:
+
+ if (BROTLI_PREDICT_TRUE(zero == 0)) {
+ // main execution path
+ } else {
+ // compiler should place this code outside of main execution path
+ }
+
+OR:
+
+ if (BROTLI_PREDICT_FALSE(something_rare_or_unexpected_happens)) {
+ // compiler should place this code outside of main execution path
+ }
+
+*/
+#if BROTLI_GNUC_HAS_BUILTIN(__builtin_expect, 3, 0, 0) || \
+ BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \
+ BROTLI_SUNPRO_VERSION_CHECK(5, 15, 0) || \
+ BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \
+ BROTLI_IBM_VERSION_CHECK(10, 1, 0) || \
+ BROTLI_TI_VERSION_CHECK(7, 3, 0) || \
+ BROTLI_TINYC_VERSION_CHECK(0, 9, 27)
+#define BROTLI_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
+#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
+#else
+#define BROTLI_PREDICT_FALSE(x) (x)
+#define BROTLI_PREDICT_TRUE(x) (x)
+#endif
+
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
+ !defined(__cplusplus)
+#define BROTLI_RESTRICT restrict
+#elif BROTLI_GNUC_VERSION_CHECK(3, 1, 0) || \
+ BROTLI_MSVC_VERSION_CHECK(14, 0, 0) || \
+ BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \
+ BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \
+ BROTLI_IBM_VERSION_CHECK(10, 1, 0) || \
+ BROTLI_PGI_VERSION_CHECK(17, 10, 0) || \
+ BROTLI_TI_VERSION_CHECK(8, 0, 0) || \
+ BROTLI_IAR_VERSION_CHECK(8, 0, 0) || \
+ (BROTLI_SUNPRO_VERSION_CHECK(5, 14, 0) && defined(__cplusplus))
+#define BROTLI_RESTRICT __restrict
+#elif BROTLI_SUNPRO_VERSION_CHECK(5, 3, 0) && !defined(__cplusplus)
+#define BROTLI_RESTRICT _Restrict
+#else
+#define BROTLI_RESTRICT
+#endif
+
+#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
+ (defined(__cplusplus) && (__cplusplus >= 199711L))
+#define BROTLI_MAYBE_INLINE inline
+#elif defined(__GNUC_STDC_INLINE__) || defined(__GNUC_GNU_INLINE__) || \
+ BROTLI_ARM_VERSION_CHECK(6, 2, 0)
+#define BROTLI_MAYBE_INLINE __inline__
+#elif BROTLI_MSVC_VERSION_CHECK(12, 0, 0) || \
+ BROTLI_ARM_VERSION_CHECK(4, 1, 0) || BROTLI_TI_VERSION_CHECK(8, 0, 0)
+#define BROTLI_MAYBE_INLINE __inline
+#else
+#define BROTLI_MAYBE_INLINE
+#endif
+
+#if BROTLI_GNUC_HAS_ATTRIBUTE(always_inline, 4, 0, 0) || \
+ BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \
+ BROTLI_SUNPRO_VERSION_CHECK(5, 11, 0) || \
+ BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \
+ BROTLI_IBM_VERSION_CHECK(10, 1, 0) || \
+ BROTLI_TI_VERSION_CHECK(8, 0, 0) || \
+ (BROTLI_TI_VERSION_CHECK(7, 3, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__))
+#define BROTLI_INLINE BROTLI_MAYBE_INLINE __attribute__((__always_inline__))
+#elif BROTLI_MSVC_VERSION_CHECK(12, 0, 0)
+#define BROTLI_INLINE BROTLI_MAYBE_INLINE __forceinline
+#elif BROTLI_TI_VERSION_CHECK(7, 0, 0) && defined(__cplusplus)
+#define BROTLI_INLINE BROTLI_MAYBE_INLINE _Pragma("FUNC_ALWAYS_INLINE;")
+#elif BROTLI_IAR_VERSION_CHECK(8, 0, 0)
+#define BROTLI_INLINE BROTLI_MAYBE_INLINE _Pragma("inline=forced")
+#else
+#define BROTLI_INLINE BROTLI_MAYBE_INLINE
+#endif
+
+#if BROTLI_GNUC_HAS_ATTRIBUTE(noinline, 4, 0, 0) || \
+ BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \
+ BROTLI_SUNPRO_VERSION_CHECK(5, 11, 0) || \
+ BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \
+ BROTLI_IBM_VERSION_CHECK(10, 1, 0) || \
+ BROTLI_TI_VERSION_CHECK(8, 0, 0) || \
+ (BROTLI_TI_VERSION_CHECK(7, 3, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__))
+#define BROTLI_NOINLINE __attribute__((__noinline__))
+#elif BROTLI_MSVC_VERSION_CHECK(13, 10, 0)
+#define BROTLI_NOINLINE __declspec(noinline)
+#elif BROTLI_PGI_VERSION_CHECK(10, 2, 0)
+#define BROTLI_NOINLINE _Pragma("noinline")
+#elif BROTLI_TI_VERSION_CHECK(6, 0, 0) && defined(__cplusplus)
+#define BROTLI_NOINLINE _Pragma("FUNC_CANNOT_INLINE;")
+#elif BROTLI_IAR_VERSION_CHECK(8, 0, 0)
+#define BROTLI_NOINLINE _Pragma("inline=never")
+#else
+#define BROTLI_NOINLINE
+#endif
+
+/* BROTLI_INTERNAL could be defined to override visibility, e.g. for tests. */
+#if !defined(BROTLI_INTERNAL)
+#if defined(_WIN32) || defined(__CYGWIN__)
+#define BROTLI_INTERNAL
+#elif BROTLI_GNUC_VERSION_CHECK(3, 3, 0) || \
+ BROTLI_TI_VERSION_CHECK(8, 0, 0) || \
+ BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \
+ BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \
+ BROTLI_IBM_VERSION_CHECK(13, 1, 0) || \
+ BROTLI_SUNPRO_VERSION_CHECK(5, 11, 0) || \
+ (BROTLI_TI_VERSION_CHECK(7, 3, 0) && \
+ defined(__TI_GNU_ATTRIBUTE_SUPPORT__) && defined(__TI_EABI__))
+#define BROTLI_INTERNAL __attribute__ ((visibility ("hidden")))
+#else
+#define BROTLI_INTERNAL
+#endif
+#endif
+
+/* <<< <<< <<< end of hedley macros. */
+
+#if BROTLI_GNUC_HAS_ATTRIBUTE(unused, 2, 7, 0) || \
+ BROTLI_INTEL_VERSION_CHECK(16, 0, 0)
+#define BROTLI_UNUSED_FUNCTION static BROTLI_INLINE __attribute__ ((unused))
+#else
+#define BROTLI_UNUSED_FUNCTION static BROTLI_INLINE
+#endif
+
+#if BROTLI_GNUC_HAS_ATTRIBUTE(aligned, 2, 7, 0)
+#define BROTLI_ALIGNED(N) __attribute__((aligned(N)))
+#else
+#define BROTLI_ALIGNED(N)
+#endif
+
+#if (defined(__ARM_ARCH) && (__ARM_ARCH == 7)) || \
+ (defined(M_ARM) && (M_ARM == 7))
+#define BROTLI_TARGET_ARMV7
+#endif /* ARMv7 */
+
+#if (defined(__ARM_ARCH) && (__ARM_ARCH == 8)) || \
+ defined(__aarch64__) || defined(__ARM64_ARCH_8__)
+#define BROTLI_TARGET_ARMV8_ANY
+
+#if defined(__ARM_32BIT_STATE)
+#define BROTLI_TARGET_ARMV8_32
+#elif defined(__ARM_64BIT_STATE)
+#define BROTLI_TARGET_ARMV8_64
+#endif
+
+#endif /* ARMv8 */
+
+#if defined(__ARM_NEON__) || defined(__ARM_NEON)
+#define BROTLI_TARGET_NEON
+#endif
+
+#if defined(__i386) || defined(_M_IX86)
+#define BROTLI_TARGET_X86
+#endif
+
+#if defined(__x86_64__) || defined(_M_X64)
+#define BROTLI_TARGET_X64
+#endif
+
+#if defined(__PPC64__)
+#define BROTLI_TARGET_POWERPC64
+#endif
+
+#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
+#define BROTLI_TARGET_RISCV64
+#endif
+
+#if defined(BROTLI_BUILD_64_BIT)
+#define BROTLI_64_BITS 1
+#elif defined(BROTLI_BUILD_32_BIT)
+#define BROTLI_64_BITS 0
+#elif defined(BROTLI_TARGET_X64) || defined(BROTLI_TARGET_ARMV8_64) || \
+ defined(BROTLI_TARGET_POWERPC64) || defined(BROTLI_TARGET_RISCV64)
+#define BROTLI_64_BITS 1
+#else
+#define BROTLI_64_BITS 0
+#endif
+
+#if (BROTLI_64_BITS)
+#define brotli_reg_t uint64_t
+#else
+#define brotli_reg_t uint32_t
+#endif
+
+#if defined(BROTLI_BUILD_BIG_ENDIAN)
+#define BROTLI_BIG_ENDIAN 1
+#elif defined(BROTLI_BUILD_LITTLE_ENDIAN)
+#define BROTLI_LITTLE_ENDIAN 1
+#elif defined(BROTLI_BUILD_ENDIAN_NEUTRAL)
+/* Just break elif chain. */
+#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
+#define BROTLI_LITTLE_ENDIAN 1
+#elif defined(_WIN32) || defined(BROTLI_TARGET_X64)
+/* Win32 & x64 can currently always be assumed to be little endian */
+#define BROTLI_LITTLE_ENDIAN 1
+#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
+#define BROTLI_BIG_ENDIAN 1
+#elif defined(BROTLI_X_BYTE_ORDER)
+#if BROTLI_X_BYTE_ORDER == BROTLI_X_LITTLE_ENDIAN
+#define BROTLI_LITTLE_ENDIAN 1
+#elif BROTLI_X_BYTE_ORDER == BROTLI_X_BIG_ENDIAN
+#define BROTLI_BIG_ENDIAN 1
+#endif
+#endif /* BROTLI_X_BYTE_ORDER */
+
+#if !defined(BROTLI_LITTLE_ENDIAN)
+#define BROTLI_LITTLE_ENDIAN 0
+#endif
+
+#if !defined(BROTLI_BIG_ENDIAN)
+#define BROTLI_BIG_ENDIAN 0
+#endif
+
+#if defined(BROTLI_X_BYTE_ORDER)
+#undef BROTLI_X_BYTE_ORDER
+#undef BROTLI_X_LITTLE_ENDIAN
+#undef BROTLI_X_BIG_ENDIAN
+#endif
+
+#if defined(BROTLI_BUILD_PORTABLE)
+#define BROTLI_ALIGNED_READ (!!1)
+#elif defined(BROTLI_TARGET_X86) || defined(BROTLI_TARGET_X64) || \
+ defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_ANY) || \
+ defined(BROTLI_TARGET_RISCV64)
+/* Allow unaligned read only for white-listed CPUs. */
+#define BROTLI_ALIGNED_READ (!!0)
+#else
+#define BROTLI_ALIGNED_READ (!!1)
+#endif
+
+#if BROTLI_ALIGNED_READ
+/* Portable unaligned memory access: read / write values via memcpy. */
+static BROTLI_INLINE uint16_t BrotliUnalignedRead16(const void* p) {
+ uint16_t t;
+ memcpy(&t, p, sizeof t);
+ return t;
+}
+static BROTLI_INLINE uint32_t BrotliUnalignedRead32(const void* p) {
+ uint32_t t;
+ memcpy(&t, p, sizeof t);
+ return t;
+}
+static BROTLI_INLINE uint64_t BrotliUnalignedRead64(const void* p) {
+ uint64_t t;
+ memcpy(&t, p, sizeof t);
+ return t;
+}
+static BROTLI_INLINE void BrotliUnalignedWrite64(void* p, uint64_t v) {
+ memcpy(p, &v, sizeof v);
+}
+#else /* BROTLI_ALIGNED_READ */
+/* Unaligned memory access is allowed: just cast pointer to requested type. */
+#if BROTLI_SANITIZED
+/* Consider we have an unaligned load/store of 4 bytes from address 0x...05.
+ AddressSanitizer will treat it as a 3-byte access to the range 05:07 and
+ will miss a bug if 08 is the first unaddressable byte.
+ ThreadSanitizer will also treat this as a 3-byte access to 05:07 and will
+ miss a race between this access and some other accesses to 08.
+ MemorySanitizer will correctly propagate the shadow on unaligned stores
+ and correctly report bugs on unaligned loads, but it may not properly
+ update and report the origin of the uninitialized memory.
+ For all three tools, replacing an unaligned access with a tool-specific
+ callback solves the problem. */
+#if defined(__cplusplus)
+extern "C" {
+#endif /* __cplusplus */
+ uint16_t __sanitizer_unaligned_load16(const void* p);
+ uint32_t __sanitizer_unaligned_load32(const void* p);
+ uint64_t __sanitizer_unaligned_load64(const void* p);
+ void __sanitizer_unaligned_store64(void* p, uint64_t v);
+#if defined(__cplusplus)
+} /* extern "C" */
+#endif /* __cplusplus */
+#define BrotliUnalignedRead16 __sanitizer_unaligned_load16
+#define BrotliUnalignedRead32 __sanitizer_unaligned_load32
+#define BrotliUnalignedRead64 __sanitizer_unaligned_load64
+#define BrotliUnalignedWrite64 __sanitizer_unaligned_store64
+#else /* BROTLI_SANITIZED */
+static BROTLI_INLINE uint16_t BrotliUnalignedRead16(const void* p) {
+ return *(const uint16_t*)p;
+}
+static BROTLI_INLINE uint32_t BrotliUnalignedRead32(const void* p) {
+ return *(const uint32_t*)p;
+}
+#if (BROTLI_64_BITS)
+static BROTLI_INLINE uint64_t BrotliUnalignedRead64(const void* p) {
+ return *(const uint64_t*)p;
+}
+static BROTLI_INLINE void BrotliUnalignedWrite64(void* p, uint64_t v) {
+ *(uint64_t*)p = v;
+}
+#else /* BROTLI_64_BITS */
+/* Avoid emitting LDRD / STRD, which require properly aligned address. */
+/* If __attribute__(aligned) is available, use that. Otherwise, memcpy. */
+
+#if BROTLI_GNUC_HAS_ATTRIBUTE(aligned, 2, 7, 0)
+typedef BROTLI_ALIGNED(1) uint64_t brotli_unaligned_uint64_t;
+
+static BROTLI_INLINE uint64_t BrotliUnalignedRead64(const void* p) {
+ return (uint64_t) ((brotli_unaligned_uint64_t*) p)[0];
+}
+static BROTLI_INLINE void BrotliUnalignedWrite64(void* p, uint64_t v) {
+ brotli_unaligned_uint64_t* dwords = (brotli_unaligned_uint64_t*) p;
+ dwords[0] = (brotli_unaligned_uint64_t) v;
+}
+#else /* BROTLI_GNUC_HAS_ATTRIBUTE(aligned, 2, 7, 0) */
+static BROTLI_INLINE uint64_t BrotliUnalignedRead64(const void* p) {
+ uint64_t v;
+ memcpy(&v, p, sizeof(uint64_t));
+ return v;
+}
+
+static BROTLI_INLINE void BrotliUnalignedWrite64(void* p, uint64_t v) {
+ memcpy(p, &v, sizeof(uint64_t));
+}
+#endif /* BROTLI_GNUC_HAS_ATTRIBUTE(aligned, 2, 7, 0) */
+#endif /* BROTLI_64_BITS */
+#endif /* BROTLI_SANITIZED */
+#endif /* BROTLI_ALIGNED_READ */
+
+#if BROTLI_LITTLE_ENDIAN
+/* Straight endianness. Just read / write values. */
+#define BROTLI_UNALIGNED_LOAD16LE BrotliUnalignedRead16
+#define BROTLI_UNALIGNED_LOAD32LE BrotliUnalignedRead32
+#define BROTLI_UNALIGNED_LOAD64LE BrotliUnalignedRead64
+#define BROTLI_UNALIGNED_STORE64LE BrotliUnalignedWrite64
+#elif BROTLI_BIG_ENDIAN /* BROTLI_LITTLE_ENDIAN */
+/* Explain compiler to byte-swap values. */
+#define BROTLI_BSWAP16_(V) ((uint16_t)( \
+ (((V) & 0xFFU) << 8) | \
+ (((V) >> 8) & 0xFFU)))
+static BROTLI_INLINE uint16_t BROTLI_UNALIGNED_LOAD16LE(const void* p) {
+ uint16_t value = BrotliUnalignedRead16(p);
+ return BROTLI_BSWAP16_(value);
+}
+#define BROTLI_BSWAP32_(V) ( \
+ (((V) & 0xFFU) << 24) | (((V) & 0xFF00U) << 8) | \
+ (((V) >> 8) & 0xFF00U) | (((V) >> 24) & 0xFFU))
+static BROTLI_INLINE uint32_t BROTLI_UNALIGNED_LOAD32LE(const void* p) {
+ uint32_t value = BrotliUnalignedRead32(p);
+ return BROTLI_BSWAP32_(value);
+}
+#define BROTLI_BSWAP64_(V) ( \
+ (((V) & 0xFFU) << 56) | (((V) & 0xFF00U) << 40) | \
+ (((V) & 0xFF0000U) << 24) | (((V) & 0xFF000000U) << 8) | \
+ (((V) >> 8) & 0xFF000000U) | (((V) >> 24) & 0xFF0000U) | \
+ (((V) >> 40) & 0xFF00U) | (((V) >> 56) & 0xFFU))
+static BROTLI_INLINE uint64_t BROTLI_UNALIGNED_LOAD64LE(const void* p) {
+ uint64_t value = BrotliUnalignedRead64(p);
+ return BROTLI_BSWAP64_(value);
+}
+static BROTLI_INLINE void BROTLI_UNALIGNED_STORE64LE(void* p, uint64_t v) {
+ uint64_t value = BROTLI_BSWAP64_(v);
+ BrotliUnalignedWrite64(p, value);
+}
+#else /* BROTLI_LITTLE_ENDIAN */
+/* Read / store values byte-wise; hopefully compiler will understand. */
+static BROTLI_INLINE uint16_t BROTLI_UNALIGNED_LOAD16LE(const void* p) {
+ const uint8_t* in = (const uint8_t*)p;
+ return (uint16_t)(in[0] | (in[1] << 8));
+}
+static BROTLI_INLINE uint32_t BROTLI_UNALIGNED_LOAD32LE(const void* p) {
+ const uint8_t* in = (const uint8_t*)p;
+ uint32_t value = (uint32_t)(in[0]);
+ value |= (uint32_t)(in[1]) << 8;
+ value |= (uint32_t)(in[2]) << 16;
+ value |= (uint32_t)(in[3]) << 24;
+ return value;
+}
+static BROTLI_INLINE uint64_t BROTLI_UNALIGNED_LOAD64LE(const void* p) {
+ const uint8_t* in = (const uint8_t*)p;
+ uint64_t value = (uint64_t)(in[0]);
+ value |= (uint64_t)(in[1]) << 8;
+ value |= (uint64_t)(in[2]) << 16;
+ value |= (uint64_t)(in[3]) << 24;
+ value |= (uint64_t)(in[4]) << 32;
+ value |= (uint64_t)(in[5]) << 40;
+ value |= (uint64_t)(in[6]) << 48;
+ value |= (uint64_t)(in[7]) << 56;
+ return value;
+}
+static BROTLI_INLINE void BROTLI_UNALIGNED_STORE64LE(void* p, uint64_t v) {
+ uint8_t* out = (uint8_t*)p;
+ out[0] = (uint8_t)v;
+ out[1] = (uint8_t)(v >> 8);
+ out[2] = (uint8_t)(v >> 16);
+ out[3] = (uint8_t)(v >> 24);
+ out[4] = (uint8_t)(v >> 32);
+ out[5] = (uint8_t)(v >> 40);
+ out[6] = (uint8_t)(v >> 48);
+ out[7] = (uint8_t)(v >> 56);
+}
+#endif /* BROTLI_LITTLE_ENDIAN */
+
+/* BROTLI_IS_CONSTANT macros returns true for compile-time constants. */
+#if BROTLI_GNUC_HAS_BUILTIN(__builtin_constant_p, 3, 0, 1) || \
+ BROTLI_INTEL_VERSION_CHECK(16, 0, 0)
+#define BROTLI_IS_CONSTANT(x) (!!__builtin_constant_p(x))
+#else
+#define BROTLI_IS_CONSTANT(x) (!!0)
+#endif
+
+#if defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_ANY)
+#define BROTLI_HAS_UBFX (!!1)
+#else
+#define BROTLI_HAS_UBFX (!!0)
+#endif
+
+#if defined(BROTLI_ENABLE_LOG)
+#define BROTLI_LOG(x) printf x
+#else
+#define BROTLI_LOG(x)
+#endif
+
+#if defined(BROTLI_DEBUG) || defined(BROTLI_ENABLE_LOG)
+#define BROTLI_DCHECK(x) assert(x)
+static BROTLI_INLINE void BrotliDump(const char* f, int l, const char* fn) {
+ fprintf(stderr, "%s:%d (%s)\n", f, l, fn);
+ fflush(stderr);
+}
+#define BROTLI_DUMP() BrotliDump(__FILE__, __LINE__, __FUNCTION__)
+#else
+#define BROTLI_DCHECK(x)
+#define BROTLI_DUMP() (void)(0)
+#endif
+
+/* TODO: add appropriate icc/sunpro/arm/ibm/ti checks. */
+#if (BROTLI_GNUC_VERSION_CHECK(3, 0, 0) || defined(__llvm__)) && \
+ !defined(BROTLI_BUILD_NO_RBIT)
+#if defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_ANY)
+/* TODO: detect ARMv6T2 and enable this code for it. */
+static BROTLI_INLINE brotli_reg_t BrotliRBit(brotli_reg_t input) {
+ brotli_reg_t output;
+ __asm__("rbit %0, %1\n" : "=r"(output) : "r"(input));
+ return output;
+}
+#define BROTLI_RBIT(x) BrotliRBit(x)
+#endif /* armv7 / armv8 */
+#endif /* gcc || clang */
+#if !defined(BROTLI_RBIT)
+static BROTLI_INLINE void BrotliRBit(void) { /* Should break build if used. */ }
+#endif /* BROTLI_RBIT */
+
+#define BROTLI_REPEAT(N, X) { \
+ if ((N & 1) != 0) {X;} \
+ if ((N & 2) != 0) {X; X;} \
+ if ((N & 4) != 0) {X; X; X; X;} \
+}
+
+#define BROTLI_UNUSED(X) (void)(X)
+
+#define BROTLI_MIN_MAX(T) \
+ static BROTLI_INLINE T brotli_min_ ## T (T a, T b) { return a < b ? a : b; } \
+ static BROTLI_INLINE T brotli_max_ ## T (T a, T b) { return a > b ? a : b; }
+BROTLI_MIN_MAX(double) BROTLI_MIN_MAX(float) BROTLI_MIN_MAX(int)
+BROTLI_MIN_MAX(size_t) BROTLI_MIN_MAX(uint32_t) BROTLI_MIN_MAX(uint8_t)
+#undef BROTLI_MIN_MAX
+#define BROTLI_MIN(T, A, B) (brotli_min_ ## T((A), (B)))
+#define BROTLI_MAX(T, A, B) (brotli_max_ ## T((A), (B)))
+
+#define BROTLI_SWAP(T, A, I, J) { \
+ T __brotli_swap_tmp = (A)[(I)]; \
+ (A)[(I)] = (A)[(J)]; \
+ (A)[(J)] = __brotli_swap_tmp; \
+}
+
+/* Default brotli_alloc_func */
+static void* BrotliDefaultAllocFunc(void* opaque, size_t size) {
+ BROTLI_UNUSED(opaque);
+ return malloc(size);
+}
+
+/* Default brotli_free_func */
+static void BrotliDefaultFreeFunc(void* opaque, void* address) {
+ BROTLI_UNUSED(opaque);
+ free(address);
+}
+
+BROTLI_UNUSED_FUNCTION void BrotliSuppressUnusedFunctions(void) {
+ BROTLI_UNUSED(&BrotliSuppressUnusedFunctions);
+ BROTLI_UNUSED(&BrotliUnalignedRead16);
+ BROTLI_UNUSED(&BrotliUnalignedRead32);
+ BROTLI_UNUSED(&BrotliUnalignedRead64);
+ BROTLI_UNUSED(&BrotliUnalignedWrite64);
+ BROTLI_UNUSED(&BROTLI_UNALIGNED_LOAD16LE);
+ BROTLI_UNUSED(&BROTLI_UNALIGNED_LOAD32LE);
+ BROTLI_UNUSED(&BROTLI_UNALIGNED_LOAD64LE);
+ BROTLI_UNUSED(&BROTLI_UNALIGNED_STORE64LE);
+ BROTLI_UNUSED(&BrotliRBit);
+ BROTLI_UNUSED(&brotli_min_double);
+ BROTLI_UNUSED(&brotli_max_double);
+ BROTLI_UNUSED(&brotli_min_float);
+ BROTLI_UNUSED(&brotli_max_float);
+ BROTLI_UNUSED(&brotli_min_int);
+ BROTLI_UNUSED(&brotli_max_int);
+ BROTLI_UNUSED(&brotli_min_size_t);
+ BROTLI_UNUSED(&brotli_max_size_t);
+ BROTLI_UNUSED(&brotli_min_uint32_t);
+ BROTLI_UNUSED(&brotli_max_uint32_t);
+ BROTLI_UNUSED(&brotli_min_uint8_t);
+ BROTLI_UNUSED(&brotli_max_uint8_t);
+ BROTLI_UNUSED(&BrotliDefaultAllocFunc);
+ BROTLI_UNUSED(&BrotliDefaultFreeFunc);
+#if defined(BROTLI_DEBUG) || defined(BROTLI_ENABLE_LOG)
+ BROTLI_UNUSED(&BrotliDump);
+#endif
+}
+
+#endif /* BROTLI_COMMON_PLATFORM_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/transform.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/transform.c
new file mode 100755
index 000000000..f8fa4335e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/transform.c
@@ -0,0 +1,291 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+#include "./transform.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* RFC 7932 transforms string data */
+static const char kPrefixSuffix[217] =
+ "\1 \2, \10 of the \4 of \2s \1.\5 and \4 "
+/* 0x _0 _2 __5 _E _3 _6 _8 _E */
+ "in \1\"\4 to \2\">\1\n\2. \1]\5 for \3 a \6 "
+/* 2x _3_ _5 _A_ _D_ _F _2 _4 _A _E */
+ "that \1\'\6 with \6 from \4 by \1(\6. T"
+/* 4x _5_ _7 _E _5 _A _C */
+ "he \4 on \4 as \4 is \4ing \2\n\t\1:\3ed "
+/* 6x _3 _8 _D _2 _7_ _ _A _C */
+ "\2=\"\4 at \3ly \1,\2=\'\5.com/\7. This \5"
+/* 8x _0 _ _3 _8 _C _E _ _1 _7 _F */
+ " not \3er \3al \4ful \4ive \5less \4es"
+/* Ax _5 _9 _D _2 _7 _D */
+ "t \4ize \2\xc2\xa0\4ous \5 the \2e "; /* \0 - implicit trailing zero. */
+/* Cx _2 _7___ ___ _A _F _5 _8 */
+
+static const uint16_t kPrefixSuffixMap[50] = {
+ 0x00, 0x02, 0x05, 0x0E, 0x13, 0x16, 0x18, 0x1E, 0x23, 0x25,
+ 0x2A, 0x2D, 0x2F, 0x32, 0x34, 0x3A, 0x3E, 0x45, 0x47, 0x4E,
+ 0x55, 0x5A, 0x5C, 0x63, 0x68, 0x6D, 0x72, 0x77, 0x7A, 0x7C,
+ 0x80, 0x83, 0x88, 0x8C, 0x8E, 0x91, 0x97, 0x9F, 0xA5, 0xA9,
+ 0xAD, 0xB2, 0xB7, 0xBD, 0xC2, 0xC7, 0xCA, 0xCF, 0xD5, 0xD8
+};
+
+/* RFC 7932 transforms */
+static const uint8_t kTransformsData[] = {
+ 49, BROTLI_TRANSFORM_IDENTITY, 49,
+ 49, BROTLI_TRANSFORM_IDENTITY, 0,
+ 0, BROTLI_TRANSFORM_IDENTITY, 0,
+ 49, BROTLI_TRANSFORM_OMIT_FIRST_1, 49,
+ 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 0,
+ 49, BROTLI_TRANSFORM_IDENTITY, 47,
+ 0, BROTLI_TRANSFORM_IDENTITY, 49,
+ 4, BROTLI_TRANSFORM_IDENTITY, 0,
+ 49, BROTLI_TRANSFORM_IDENTITY, 3,
+ 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 49,
+ 49, BROTLI_TRANSFORM_IDENTITY, 6,
+ 49, BROTLI_TRANSFORM_OMIT_FIRST_2, 49,
+ 49, BROTLI_TRANSFORM_OMIT_LAST_1, 49,
+ 1, BROTLI_TRANSFORM_IDENTITY, 0,
+ 49, BROTLI_TRANSFORM_IDENTITY, 1,
+ 0, BROTLI_TRANSFORM_UPPERCASE_FIRST, 0,
+ 49, BROTLI_TRANSFORM_IDENTITY, 7,
+ 49, BROTLI_TRANSFORM_IDENTITY, 9,
+ 48, BROTLI_TRANSFORM_IDENTITY, 0,
+ 49, BROTLI_TRANSFORM_IDENTITY, 8,
+ 49, BROTLI_TRANSFORM_IDENTITY, 5,
+ 49, BROTLI_TRANSFORM_IDENTITY, 10,
+ 49, BROTLI_TRANSFORM_IDENTITY, 11,
+ 49, BROTLI_TRANSFORM_OMIT_LAST_3, 49,
+ 49, BROTLI_TRANSFORM_IDENTITY, 13,
+ 49, BROTLI_TRANSFORM_IDENTITY, 14,
+ 49, BROTLI_TRANSFORM_OMIT_FIRST_3, 49,
+ 49, BROTLI_TRANSFORM_OMIT_LAST_2, 49,
+ 49, BROTLI_TRANSFORM_IDENTITY, 15,
+ 49, BROTLI_TRANSFORM_IDENTITY, 16,
+ 0, BROTLI_TRANSFORM_UPPERCASE_FIRST, 49,
+ 49, BROTLI_TRANSFORM_IDENTITY, 12,
+ 5, BROTLI_TRANSFORM_IDENTITY, 49,
+ 0, BROTLI_TRANSFORM_IDENTITY, 1,
+ 49, BROTLI_TRANSFORM_OMIT_FIRST_4, 49,
+ 49, BROTLI_TRANSFORM_IDENTITY, 18,
+ 49, BROTLI_TRANSFORM_IDENTITY, 17,
+ 49, BROTLI_TRANSFORM_IDENTITY, 19,
+ 49, BROTLI_TRANSFORM_IDENTITY, 20,
+ 49, BROTLI_TRANSFORM_OMIT_FIRST_5, 49,
+ 49, BROTLI_TRANSFORM_OMIT_FIRST_6, 49,
+ 47, BROTLI_TRANSFORM_IDENTITY, 49,
+ 49, BROTLI_TRANSFORM_OMIT_LAST_4, 49,
+ 49, BROTLI_TRANSFORM_IDENTITY, 22,
+ 49, BROTLI_TRANSFORM_UPPERCASE_ALL, 49,
+ 49, BROTLI_TRANSFORM_IDENTITY, 23,
+ 49, BROTLI_TRANSFORM_IDENTITY, 24,
+ 49, BROTLI_TRANSFORM_IDENTITY, 25,
+ 49, BROTLI_TRANSFORM_OMIT_LAST_7, 49,
+ 49, BROTLI_TRANSFORM_OMIT_LAST_1, 26,
+ 49, BROTLI_TRANSFORM_IDENTITY, 27,
+ 49, BROTLI_TRANSFORM_IDENTITY, 28,
+ 0, BROTLI_TRANSFORM_IDENTITY, 12,
+ 49, BROTLI_TRANSFORM_IDENTITY, 29,
+ 49, BROTLI_TRANSFORM_OMIT_FIRST_9, 49,
+ 49, BROTLI_TRANSFORM_OMIT_FIRST_7, 49,
+ 49, BROTLI_TRANSFORM_OMIT_LAST_6, 49,
+ 49, BROTLI_TRANSFORM_IDENTITY, 21,
+ 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 1,
+ 49, BROTLI_TRANSFORM_OMIT_LAST_8, 49,
+ 49, BROTLI_TRANSFORM_IDENTITY, 31,
+ 49, BROTLI_TRANSFORM_IDENTITY, 32,
+ 47, BROTLI_TRANSFORM_IDENTITY, 3,
+ 49, BROTLI_TRANSFORM_OMIT_LAST_5, 49,
+ 49, BROTLI_TRANSFORM_OMIT_LAST_9, 49,
+ 0, BROTLI_TRANSFORM_UPPERCASE_FIRST, 1,
+ 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 8,
+ 5, BROTLI_TRANSFORM_IDENTITY, 21,
+ 49, BROTLI_TRANSFORM_UPPERCASE_ALL, 0,
+ 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 10,
+ 49, BROTLI_TRANSFORM_IDENTITY, 30,
+ 0, BROTLI_TRANSFORM_IDENTITY, 5,
+ 35, BROTLI_TRANSFORM_IDENTITY, 49,
+ 47, BROTLI_TRANSFORM_IDENTITY, 2,
+ 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 17,
+ 49, BROTLI_TRANSFORM_IDENTITY, 36,
+ 49, BROTLI_TRANSFORM_IDENTITY, 33,
+ 5, BROTLI_TRANSFORM_IDENTITY, 0,
+ 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 21,
+ 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 5,
+ 49, BROTLI_TRANSFORM_IDENTITY, 37,
+ 0, BROTLI_TRANSFORM_IDENTITY, 30,
+ 49, BROTLI_TRANSFORM_IDENTITY, 38,
+ 0, BROTLI_TRANSFORM_UPPERCASE_ALL, 0,
+ 49, BROTLI_TRANSFORM_IDENTITY, 39,
+ 0, BROTLI_TRANSFORM_UPPERCASE_ALL, 49,
+ 49, BROTLI_TRANSFORM_IDENTITY, 34,
+ 49, BROTLI_TRANSFORM_UPPERCASE_ALL, 8,
+ 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 12,
+ 0, BROTLI_TRANSFORM_IDENTITY, 21,
+ 49, BROTLI_TRANSFORM_IDENTITY, 40,
+ 0, BROTLI_TRANSFORM_UPPERCASE_FIRST, 12,
+ 49, BROTLI_TRANSFORM_IDENTITY, 41,
+ 49, BROTLI_TRANSFORM_IDENTITY, 42,
+ 49, BROTLI_TRANSFORM_UPPERCASE_ALL, 17,
+ 49, BROTLI_TRANSFORM_IDENTITY, 43,
+ 0, BROTLI_TRANSFORM_UPPERCASE_FIRST, 5,
+ 49, BROTLI_TRANSFORM_UPPERCASE_ALL, 10,
+ 0, BROTLI_TRANSFORM_IDENTITY, 34,
+ 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 33,
+ 49, BROTLI_TRANSFORM_IDENTITY, 44,
+ 49, BROTLI_TRANSFORM_UPPERCASE_ALL, 5,
+ 45, BROTLI_TRANSFORM_IDENTITY, 49,
+ 0, BROTLI_TRANSFORM_IDENTITY, 33,
+ 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 30,
+ 49, BROTLI_TRANSFORM_UPPERCASE_ALL, 30,
+ 49, BROTLI_TRANSFORM_IDENTITY, 46,
+ 49, BROTLI_TRANSFORM_UPPERCASE_ALL, 1,
+ 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 34,
+ 0, BROTLI_TRANSFORM_UPPERCASE_FIRST, 33,
+ 0, BROTLI_TRANSFORM_UPPERCASE_ALL, 30,
+ 0, BROTLI_TRANSFORM_UPPERCASE_ALL, 1,
+ 49, BROTLI_TRANSFORM_UPPERCASE_ALL, 33,
+ 49, BROTLI_TRANSFORM_UPPERCASE_ALL, 21,
+ 49, BROTLI_TRANSFORM_UPPERCASE_ALL, 12,
+ 0, BROTLI_TRANSFORM_UPPERCASE_ALL, 5,
+ 49, BROTLI_TRANSFORM_UPPERCASE_ALL, 34,
+ 0, BROTLI_TRANSFORM_UPPERCASE_ALL, 12,
+ 0, BROTLI_TRANSFORM_UPPERCASE_FIRST, 30,
+ 0, BROTLI_TRANSFORM_UPPERCASE_ALL, 34,
+ 0, BROTLI_TRANSFORM_UPPERCASE_FIRST, 34,
+};
+
+static const BrotliTransforms kBrotliTransforms = {
+ sizeof(kPrefixSuffix),
+ (const uint8_t*)kPrefixSuffix,
+ kPrefixSuffixMap,
+ sizeof(kTransformsData) / (3 * sizeof(kTransformsData[0])),
+ kTransformsData,
+ NULL, /* no extra parameters */
+ {0, 12, 27, 23, 42, 63, 56, 48, 59, 64}
+};
+
+const BrotliTransforms* BrotliGetTransforms(void) {
+ return &kBrotliTransforms;
+}
+
+static int ToUpperCase(uint8_t* p) {
+ if (p[0] < 0xC0) {
+ if (p[0] >= 'a' && p[0] <= 'z') {
+ p[0] ^= 32;
+ }
+ return 1;
+ }
+ /* An overly simplified uppercasing model for UTF-8. */
+ if (p[0] < 0xE0) {
+ p[1] ^= 32;
+ return 2;
+ }
+ /* An arbitrary transform for three byte characters. */
+ p[2] ^= 5;
+ return 3;
+}
+
+static int Shift(uint8_t* word, int word_len, uint16_t parameter) {
+ /* Limited sign extension: scalar < (1 << 24). */
+ uint32_t scalar =
+ (parameter & 0x7FFFu) + (0x1000000u - (parameter & 0x8000u));
+ if (word[0] < 0x80) {
+ /* 1-byte rune / 0sssssss / 7 bit scalar (ASCII). */
+ scalar += (uint32_t)word[0];
+ word[0] = (uint8_t)(scalar & 0x7Fu);
+ return 1;
+ } else if (word[0] < 0xC0) {
+ /* Continuation / 10AAAAAA. */
+ return 1;
+ } else if (word[0] < 0xE0) {
+ /* 2-byte rune / 110sssss AAssssss / 11 bit scalar. */
+ if (word_len < 2) return 1;
+ scalar += (uint32_t)((word[1] & 0x3Fu) | ((word[0] & 0x1Fu) << 6u));
+ word[0] = (uint8_t)(0xC0 | ((scalar >> 6u) & 0x1F));
+ word[1] = (uint8_t)((word[1] & 0xC0) | (scalar & 0x3F));
+ return 2;
+ } else if (word[0] < 0xF0) {
+ /* 3-byte rune / 1110ssss AAssssss BBssssss / 16 bit scalar. */
+ if (word_len < 3) return word_len;
+ scalar += (uint32_t)((word[2] & 0x3Fu) | ((word[1] & 0x3Fu) << 6u) |
+ ((word[0] & 0x0Fu) << 12u));
+ word[0] = (uint8_t)(0xE0 | ((scalar >> 12u) & 0x0F));
+ word[1] = (uint8_t)((word[1] & 0xC0) | ((scalar >> 6u) & 0x3F));
+ word[2] = (uint8_t)((word[2] & 0xC0) | (scalar & 0x3F));
+ return 3;
+ } else if (word[0] < 0xF8) {
+ /* 4-byte rune / 11110sss AAssssss BBssssss CCssssss / 21 bit scalar. */
+ if (word_len < 4) return word_len;
+ scalar += (uint32_t)((word[3] & 0x3Fu) | ((word[2] & 0x3Fu) << 6u) |
+ ((word[1] & 0x3Fu) << 12u) | ((word[0] & 0x07u) << 18u));
+ word[0] = (uint8_t)(0xF0 | ((scalar >> 18u) & 0x07));
+ word[1] = (uint8_t)((word[1] & 0xC0) | ((scalar >> 12u) & 0x3F));
+ word[2] = (uint8_t)((word[2] & 0xC0) | ((scalar >> 6u) & 0x3F));
+ word[3] = (uint8_t)((word[3] & 0xC0) | (scalar & 0x3F));
+ return 4;
+ }
+ return 1;
+}
+
+int BrotliTransformDictionaryWord(uint8_t* dst, const uint8_t* word, int len,
+ const BrotliTransforms* transforms, int transform_idx) {
+ int idx = 0;
+ const uint8_t* prefix = BROTLI_TRANSFORM_PREFIX(transforms, transform_idx);
+ uint8_t type = BROTLI_TRANSFORM_TYPE(transforms, transform_idx);
+ const uint8_t* suffix = BROTLI_TRANSFORM_SUFFIX(transforms, transform_idx);
+ {
+ int prefix_len = *prefix++;
+ while (prefix_len--) { dst[idx++] = *prefix++; }
+ }
+ {
+ const int t = type;
+ int i = 0;
+ if (t <= BROTLI_TRANSFORM_OMIT_LAST_9) {
+ len -= t;
+ } else if (t >= BROTLI_TRANSFORM_OMIT_FIRST_1
+ && t <= BROTLI_TRANSFORM_OMIT_FIRST_9) {
+ int skip = t - (BROTLI_TRANSFORM_OMIT_FIRST_1 - 1);
+ word += skip;
+ len -= skip;
+ }
+ while (i < len) { dst[idx++] = word[i++]; }
+ if (t == BROTLI_TRANSFORM_UPPERCASE_FIRST) {
+ ToUpperCase(&dst[idx - len]);
+ } else if (t == BROTLI_TRANSFORM_UPPERCASE_ALL) {
+ uint8_t* uppercase = &dst[idx - len];
+ while (len > 0) {
+ int step = ToUpperCase(uppercase);
+ uppercase += step;
+ len -= step;
+ }
+ } else if (t == BROTLI_TRANSFORM_SHIFT_FIRST) {
+ uint16_t param = (uint16_t)(transforms->params[transform_idx * 2]
+ + (transforms->params[transform_idx * 2 + 1] << 8u));
+ Shift(&dst[idx - len], len, param);
+ } else if (t == BROTLI_TRANSFORM_SHIFT_ALL) {
+ uint16_t param = (uint16_t)(transforms->params[transform_idx * 2]
+ + (transforms->params[transform_idx * 2 + 1] << 8u));
+ uint8_t* shift = &dst[idx - len];
+ while (len > 0) {
+ int step = Shift(shift, len, param);
+ shift += step;
+ len -= step;
+ }
+ }
+ }
+ {
+ int suffix_len = *suffix++;
+ while (suffix_len--) { dst[idx++] = *suffix++; }
+ return idx;
+ }
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/transform.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/transform.h
new file mode 100755
index 000000000..b6f86cc7d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/transform.h
@@ -0,0 +1,85 @@
+/* transforms is a part of ABI, but not API.
+
+ It means that there are some functions that are supposed to be in "common"
+ library, but header itself is not placed into include/brotli. This way,
+ aforementioned functions will be available only to brotli internals.
+ */
+
+#ifndef BROTLI_COMMON_TRANSFORM_H_
+#define BROTLI_COMMON_TRANSFORM_H_
+
+#include <brotli/port.h>
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+enum BrotliWordTransformType {
+ BROTLI_TRANSFORM_IDENTITY = 0,
+ BROTLI_TRANSFORM_OMIT_LAST_1 = 1,
+ BROTLI_TRANSFORM_OMIT_LAST_2 = 2,
+ BROTLI_TRANSFORM_OMIT_LAST_3 = 3,
+ BROTLI_TRANSFORM_OMIT_LAST_4 = 4,
+ BROTLI_TRANSFORM_OMIT_LAST_5 = 5,
+ BROTLI_TRANSFORM_OMIT_LAST_6 = 6,
+ BROTLI_TRANSFORM_OMIT_LAST_7 = 7,
+ BROTLI_TRANSFORM_OMIT_LAST_8 = 8,
+ BROTLI_TRANSFORM_OMIT_LAST_9 = 9,
+ BROTLI_TRANSFORM_UPPERCASE_FIRST = 10,
+ BROTLI_TRANSFORM_UPPERCASE_ALL = 11,
+ BROTLI_TRANSFORM_OMIT_FIRST_1 = 12,
+ BROTLI_TRANSFORM_OMIT_FIRST_2 = 13,
+ BROTLI_TRANSFORM_OMIT_FIRST_3 = 14,
+ BROTLI_TRANSFORM_OMIT_FIRST_4 = 15,
+ BROTLI_TRANSFORM_OMIT_FIRST_5 = 16,
+ BROTLI_TRANSFORM_OMIT_FIRST_6 = 17,
+ BROTLI_TRANSFORM_OMIT_FIRST_7 = 18,
+ BROTLI_TRANSFORM_OMIT_FIRST_8 = 19,
+ BROTLI_TRANSFORM_OMIT_FIRST_9 = 20,
+ BROTLI_TRANSFORM_SHIFT_FIRST = 21,
+ BROTLI_TRANSFORM_SHIFT_ALL = 22,
+ BROTLI_NUM_TRANSFORM_TYPES /* Counts transforms, not a transform itself. */
+};
+
+#define BROTLI_TRANSFORMS_MAX_CUT_OFF BROTLI_TRANSFORM_OMIT_LAST_9
+
+typedef struct BrotliTransforms {
+ uint16_t prefix_suffix_size;
+ /* Last character must be null, so prefix_suffix_size must be at least 1. */
+ const uint8_t* prefix_suffix;
+ const uint16_t* prefix_suffix_map;
+ uint32_t num_transforms;
+ /* Each entry is a [prefix_id, transform, suffix_id] triplet. */
+ const uint8_t* transforms;
+ /* Shift for BROTLI_TRANSFORM_SHIFT_FIRST and BROTLI_TRANSFORM_SHIFT_ALL,
+ must be NULL if and only if no such transforms are present. */
+ const uint8_t* params;
+ /* Indices of transforms like ["", BROTLI_TRANSFORM_OMIT_LAST_#, ""].
+ 0-th element corresponds to ["", BROTLI_TRANSFORM_IDENTITY, ""].
+ -1, if cut-off transform does not exist. */
+ int16_t cutOffTransforms[BROTLI_TRANSFORMS_MAX_CUT_OFF + 1];
+} BrotliTransforms;
+
+/* T is BrotliTransforms*; result is uint8_t. */
+#define BROTLI_TRANSFORM_PREFIX_ID(T, I) ((T)->transforms[((I) * 3) + 0])
+#define BROTLI_TRANSFORM_TYPE(T, I) ((T)->transforms[((I) * 3) + 1])
+#define BROTLI_TRANSFORM_SUFFIX_ID(T, I) ((T)->transforms[((I) * 3) + 2])
+
+/* T is BrotliTransforms*; result is const uint8_t*. */
+#define BROTLI_TRANSFORM_PREFIX(T, I) (&(T)->prefix_suffix[ \
+ (T)->prefix_suffix_map[BROTLI_TRANSFORM_PREFIX_ID(T, I)]])
+#define BROTLI_TRANSFORM_SUFFIX(T, I) (&(T)->prefix_suffix[ \
+ (T)->prefix_suffix_map[BROTLI_TRANSFORM_SUFFIX_ID(T, I)]])
+
+BROTLI_COMMON_API const BrotliTransforms* BrotliGetTransforms(void);
+
+BROTLI_COMMON_API int BrotliTransformDictionaryWord(
+ uint8_t* dst, const uint8_t* word, int len,
+ const BrotliTransforms* transforms, int transform_idx);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_COMMON_TRANSFORM_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/version.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/version.h
new file mode 100644
index 000000000..0d0d0c796
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/common/version.h
@@ -0,0 +1,26 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Version definition. */
+
+#ifndef BROTLI_COMMON_VERSION_H_
+#define BROTLI_COMMON_VERSION_H_
+
+/* This macro should only be used when library is compiled together with client.
+ If library is dynamically linked, use BrotliDecoderVersion and
+ BrotliEncoderVersion methods. */
+
+/* Semantic version, calculated as (MAJOR << 24) | (MINOR << 12) | PATCH */
+#define BROTLI_VERSION 0x1000007
+
+/* This macro is used by build system to produce Libtool-friendly soname. See
+ https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
+ */
+
+/* ABI version, calculated as (CURRENT << 24) | (REVISION << 12) | AGE */
+#define BROTLI_ABI_VERSION 0x1007000
+
+#endif /* BROTLI_COMMON_VERSION_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/bit_reader.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/bit_reader.c
new file mode 100644
index 000000000..41cd0504f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/bit_reader.c
@@ -0,0 +1,65 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Bit reading helpers */
+
+#include "./bit_reader.h"
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+void BrotliInitBitReader(BrotliBitReader* const br) {
+ br->val_ = 0;
+ br->bit_pos_ = sizeof(br->val_) << 3;
+}
+
+BROTLI_BOOL BrotliWarmupBitReader(BrotliBitReader* const br) {
+ size_t aligned_read_mask = (sizeof(br->val_) >> 1) - 1;
+ /* Fixing alignment after unaligned BrotliFillWindow would result accumulator
+ overflow. If unalignment is caused by BrotliSafeReadBits, then there is
+ enough space in accumulator to fix alignment. */
+ if (!BROTLI_ALIGNED_READ) {
+ aligned_read_mask = 0;
+ }
+ if (BrotliGetAvailableBits(br) == 0) {
+ if (!BrotliPullByte(br)) {
+ return BROTLI_FALSE;
+ }
+ }
+
+ while ((((size_t)br->next_in) & aligned_read_mask) != 0) {
+ if (!BrotliPullByte(br)) {
+ /* If we consumed all the input, we don't care about the alignment. */
+ return BROTLI_TRUE;
+ }
+ }
+ return BROTLI_TRUE;
+}
+
+BROTLI_BOOL BrotliSafeReadBits32Slow(BrotliBitReader* const br,
+ uint32_t n_bits, uint32_t* val) {
+ uint32_t low_val;
+ uint32_t high_val;
+ BrotliBitReaderState memento;
+ BROTLI_DCHECK(n_bits <= 32);
+ BROTLI_DCHECK(n_bits > 24);
+ BrotliBitReaderSaveState(br, &memento);
+ if (!BrotliSafeReadBits(br, 16, &low_val) ||
+ !BrotliSafeReadBits(br, n_bits - 16, &high_val)) {
+ BrotliBitReaderRestoreState(br, &memento);
+ return BROTLI_FALSE;
+ }
+ *val = low_val | (high_val << 16);
+ return BROTLI_TRUE;
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/bit_reader.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/bit_reader.h
new file mode 100644
index 000000000..f94a717ea
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/bit_reader.h
@@ -0,0 +1,356 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Bit reading helpers */
+
+#ifndef BROTLI_DEC_BIT_READER_H_
+#define BROTLI_DEC_BIT_READER_H_
+
+#include <string.h> /* memcpy */
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#define BROTLI_SHORT_FILL_BIT_WINDOW_READ (sizeof(brotli_reg_t) >> 1)
+
+static const uint32_t kBitMask[33] = { 0x00000000,
+ 0x00000001, 0x00000003, 0x00000007, 0x0000000F,
+ 0x0000001F, 0x0000003F, 0x0000007F, 0x000000FF,
+ 0x000001FF, 0x000003FF, 0x000007FF, 0x00000FFF,
+ 0x00001FFF, 0x00003FFF, 0x00007FFF, 0x0000FFFF,
+ 0x0001FFFF, 0x0003FFFF, 0x0007FFFF, 0x000FFFFF,
+ 0x001FFFFF, 0x003FFFFF, 0x007FFFFF, 0x00FFFFFF,
+ 0x01FFFFFF, 0x03FFFFFF, 0x07FFFFFF, 0x0FFFFFFF,
+ 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF, 0xFFFFFFFF
+};
+
+static BROTLI_INLINE uint32_t BitMask(uint32_t n) {
+ if (BROTLI_IS_CONSTANT(n) || BROTLI_HAS_UBFX) {
+ /* Masking with this expression turns to a single
+ "Unsigned Bit Field Extract" UBFX instruction on ARM. */
+ return ~((0xFFFFFFFFu) << n);
+ } else {
+ return kBitMask[n];
+ }
+}
+
+typedef struct {
+ brotli_reg_t val_; /* pre-fetched bits */
+ uint32_t bit_pos_; /* current bit-reading position in val_ */
+ const uint8_t* next_in; /* the byte we're reading from */
+ size_t avail_in;
+} BrotliBitReader;
+
+typedef struct {
+ brotli_reg_t val_;
+ uint32_t bit_pos_;
+ const uint8_t* next_in;
+ size_t avail_in;
+} BrotliBitReaderState;
+
+/* Initializes the BrotliBitReader fields. */
+BROTLI_INTERNAL void BrotliInitBitReader(BrotliBitReader* const br);
+
+/* Ensures that accumulator is not empty.
+ May consume up to sizeof(brotli_reg_t) - 1 bytes of input.
+ Returns BROTLI_FALSE if data is required but there is no input available.
+ For BROTLI_ALIGNED_READ this function also prepares bit reader for aligned
+ reading. */
+BROTLI_INTERNAL BROTLI_BOOL BrotliWarmupBitReader(BrotliBitReader* const br);
+
+/* Fallback for BrotliSafeReadBits32. Extracted as noninlined method to unburden
+ the main code-path. Never called for RFC brotli streams, required only for
+ "large-window" mode and other extensions. */
+BROTLI_INTERNAL BROTLI_NOINLINE BROTLI_BOOL BrotliSafeReadBits32Slow(
+ BrotliBitReader* const br, uint32_t n_bits, uint32_t* val);
+
+static BROTLI_INLINE void BrotliBitReaderSaveState(
+ BrotliBitReader* const from, BrotliBitReaderState* to) {
+ to->val_ = from->val_;
+ to->bit_pos_ = from->bit_pos_;
+ to->next_in = from->next_in;
+ to->avail_in = from->avail_in;
+}
+
+static BROTLI_INLINE void BrotliBitReaderRestoreState(
+ BrotliBitReader* const to, BrotliBitReaderState* from) {
+ to->val_ = from->val_;
+ to->bit_pos_ = from->bit_pos_;
+ to->next_in = from->next_in;
+ to->avail_in = from->avail_in;
+}
+
+static BROTLI_INLINE uint32_t BrotliGetAvailableBits(
+ const BrotliBitReader* br) {
+ return (BROTLI_64_BITS ? 64 : 32) - br->bit_pos_;
+}
+
+/* Returns amount of unread bytes the bit reader still has buffered from the
+ BrotliInput, including whole bytes in br->val_. */
+static BROTLI_INLINE size_t BrotliGetRemainingBytes(BrotliBitReader* br) {
+ return br->avail_in + (BrotliGetAvailableBits(br) >> 3);
+}
+
+/* Checks if there is at least |num| bytes left in the input ring-buffer
+ (excluding the bits remaining in br->val_). */
+static BROTLI_INLINE BROTLI_BOOL BrotliCheckInputAmount(
+ BrotliBitReader* const br, size_t num) {
+ return TO_BROTLI_BOOL(br->avail_in >= num);
+}
+
+/* Guarantees that there are at least |n_bits| + 1 bits in accumulator.
+ Precondition: accumulator contains at least 1 bit.
+ |n_bits| should be in the range [1..24] for regular build. For portable
+ non-64-bit little-endian build only 16 bits are safe to request. */
+static BROTLI_INLINE void BrotliFillBitWindow(
+ BrotliBitReader* const br, uint32_t n_bits) {
+#if (BROTLI_64_BITS)
+ if (!BROTLI_ALIGNED_READ && BROTLI_IS_CONSTANT(n_bits) && (n_bits <= 8)) {
+ if (br->bit_pos_ >= 56) {
+ br->val_ >>= 56;
+ br->bit_pos_ ^= 56; /* here same as -= 56 because of the if condition */
+ br->val_ |= BROTLI_UNALIGNED_LOAD64LE(br->next_in) << 8;
+ br->avail_in -= 7;
+ br->next_in += 7;
+ }
+ } else if (
+ !BROTLI_ALIGNED_READ && BROTLI_IS_CONSTANT(n_bits) && (n_bits <= 16)) {
+ if (br->bit_pos_ >= 48) {
+ br->val_ >>= 48;
+ br->bit_pos_ ^= 48; /* here same as -= 48 because of the if condition */
+ br->val_ |= BROTLI_UNALIGNED_LOAD64LE(br->next_in) << 16;
+ br->avail_in -= 6;
+ br->next_in += 6;
+ }
+ } else {
+ if (br->bit_pos_ >= 32) {
+ br->val_ >>= 32;
+ br->bit_pos_ ^= 32; /* here same as -= 32 because of the if condition */
+ br->val_ |= ((uint64_t)BROTLI_UNALIGNED_LOAD32LE(br->next_in)) << 32;
+ br->avail_in -= BROTLI_SHORT_FILL_BIT_WINDOW_READ;
+ br->next_in += BROTLI_SHORT_FILL_BIT_WINDOW_READ;
+ }
+ }
+#else
+ if (!BROTLI_ALIGNED_READ && BROTLI_IS_CONSTANT(n_bits) && (n_bits <= 8)) {
+ if (br->bit_pos_ >= 24) {
+ br->val_ >>= 24;
+ br->bit_pos_ ^= 24; /* here same as -= 24 because of the if condition */
+ br->val_ |= BROTLI_UNALIGNED_LOAD32LE(br->next_in) << 8;
+ br->avail_in -= 3;
+ br->next_in += 3;
+ }
+ } else {
+ if (br->bit_pos_ >= 16) {
+ br->val_ >>= 16;
+ br->bit_pos_ ^= 16; /* here same as -= 16 because of the if condition */
+ br->val_ |= ((uint32_t)BROTLI_UNALIGNED_LOAD16LE(br->next_in)) << 16;
+ br->avail_in -= BROTLI_SHORT_FILL_BIT_WINDOW_READ;
+ br->next_in += BROTLI_SHORT_FILL_BIT_WINDOW_READ;
+ }
+ }
+#endif
+}
+
+/* Mostly like BrotliFillBitWindow, but guarantees only 16 bits and reads no
+ more than BROTLI_SHORT_FILL_BIT_WINDOW_READ bytes of input. */
+static BROTLI_INLINE void BrotliFillBitWindow16(BrotliBitReader* const br) {
+ BrotliFillBitWindow(br, 17);
+}
+
+/* Tries to pull one byte of input to accumulator.
+ Returns BROTLI_FALSE if there is no input available. */
+static BROTLI_INLINE BROTLI_BOOL BrotliPullByte(BrotliBitReader* const br) {
+ if (br->avail_in == 0) {
+ return BROTLI_FALSE;
+ }
+ br->val_ >>= 8;
+#if (BROTLI_64_BITS)
+ br->val_ |= ((uint64_t)*br->next_in) << 56;
+#else
+ br->val_ |= ((uint32_t)*br->next_in) << 24;
+#endif
+ br->bit_pos_ -= 8;
+ --br->avail_in;
+ ++br->next_in;
+ return BROTLI_TRUE;
+}
+
+/* Returns currently available bits.
+ The number of valid bits could be calculated by BrotliGetAvailableBits. */
+static BROTLI_INLINE brotli_reg_t BrotliGetBitsUnmasked(
+ BrotliBitReader* const br) {
+ return br->val_ >> br->bit_pos_;
+}
+
+/* Like BrotliGetBits, but does not mask the result.
+ The result contains at least 16 valid bits. */
+static BROTLI_INLINE uint32_t BrotliGet16BitsUnmasked(
+ BrotliBitReader* const br) {
+ BrotliFillBitWindow(br, 16);
+ return (uint32_t)BrotliGetBitsUnmasked(br);
+}
+
+/* Returns the specified number of bits from |br| without advancing bit
+ position. */
+static BROTLI_INLINE uint32_t BrotliGetBits(
+ BrotliBitReader* const br, uint32_t n_bits) {
+ BrotliFillBitWindow(br, n_bits);
+ return (uint32_t)BrotliGetBitsUnmasked(br) & BitMask(n_bits);
+}
+
+/* Tries to peek the specified amount of bits. Returns BROTLI_FALSE, if there
+ is not enough input. */
+static BROTLI_INLINE BROTLI_BOOL BrotliSafeGetBits(
+ BrotliBitReader* const br, uint32_t n_bits, uint32_t* val) {
+ while (BrotliGetAvailableBits(br) < n_bits) {
+ if (!BrotliPullByte(br)) {
+ return BROTLI_FALSE;
+ }
+ }
+ *val = (uint32_t)BrotliGetBitsUnmasked(br) & BitMask(n_bits);
+ return BROTLI_TRUE;
+}
+
+/* Advances the bit pos by |n_bits|. */
+static BROTLI_INLINE void BrotliDropBits(
+ BrotliBitReader* const br, uint32_t n_bits) {
+ br->bit_pos_ += n_bits;
+}
+
+static BROTLI_INLINE void BrotliBitReaderUnload(BrotliBitReader* br) {
+ uint32_t unused_bytes = BrotliGetAvailableBits(br) >> 3;
+ uint32_t unused_bits = unused_bytes << 3;
+ br->avail_in += unused_bytes;
+ br->next_in -= unused_bytes;
+ if (unused_bits == sizeof(br->val_) << 3) {
+ br->val_ = 0;
+ } else {
+ br->val_ <<= unused_bits;
+ }
+ br->bit_pos_ += unused_bits;
+}
+
+/* Reads the specified number of bits from |br| and advances the bit pos.
+ Precondition: accumulator MUST contain at least |n_bits|. */
+static BROTLI_INLINE void BrotliTakeBits(
+ BrotliBitReader* const br, uint32_t n_bits, uint32_t* val) {
+ *val = (uint32_t)BrotliGetBitsUnmasked(br) & BitMask(n_bits);
+ BROTLI_LOG(("[BrotliTakeBits] %d %d %d val: %6x\n",
+ (int)br->avail_in, (int)br->bit_pos_, (int)n_bits, (int)*val));
+ BrotliDropBits(br, n_bits);
+}
+
+/* Reads the specified number of bits from |br| and advances the bit pos.
+ Assumes that there is enough input to perform BrotliFillBitWindow.
+ Up to 24 bits are allowed to be requested from this method. */
+static BROTLI_INLINE uint32_t BrotliReadBits24(
+ BrotliBitReader* const br, uint32_t n_bits) {
+ BROTLI_DCHECK(n_bits <= 24);
+ if (BROTLI_64_BITS || (n_bits <= 16)) {
+ uint32_t val;
+ BrotliFillBitWindow(br, n_bits);
+ BrotliTakeBits(br, n_bits, &val);
+ return val;
+ } else {
+ uint32_t low_val;
+ uint32_t high_val;
+ BrotliFillBitWindow(br, 16);
+ BrotliTakeBits(br, 16, &low_val);
+ BrotliFillBitWindow(br, 8);
+ BrotliTakeBits(br, n_bits - 16, &high_val);
+ return low_val | (high_val << 16);
+ }
+}
+
+/* Same as BrotliReadBits24, but allows reading up to 32 bits. */
+static BROTLI_INLINE uint32_t BrotliReadBits32(
+ BrotliBitReader* const br, uint32_t n_bits) {
+ BROTLI_DCHECK(n_bits <= 32);
+ if (BROTLI_64_BITS || (n_bits <= 16)) {
+ uint32_t val;
+ BrotliFillBitWindow(br, n_bits);
+ BrotliTakeBits(br, n_bits, &val);
+ return val;
+ } else {
+ uint32_t low_val;
+ uint32_t high_val;
+ BrotliFillBitWindow(br, 16);
+ BrotliTakeBits(br, 16, &low_val);
+ BrotliFillBitWindow(br, 16);
+ BrotliTakeBits(br, n_bits - 16, &high_val);
+ return low_val | (high_val << 16);
+ }
+}
+
+/* Tries to read the specified amount of bits. Returns BROTLI_FALSE, if there
+ is not enough input. |n_bits| MUST be positive.
+ Up to 24 bits are allowed to be requested from this method. */
+static BROTLI_INLINE BROTLI_BOOL BrotliSafeReadBits(
+ BrotliBitReader* const br, uint32_t n_bits, uint32_t* val) {
+ BROTLI_DCHECK(n_bits <= 24);
+ while (BrotliGetAvailableBits(br) < n_bits) {
+ if (!BrotliPullByte(br)) {
+ return BROTLI_FALSE;
+ }
+ }
+ BrotliTakeBits(br, n_bits, val);
+ return BROTLI_TRUE;
+}
+
+/* Same as BrotliSafeReadBits, but allows reading up to 32 bits. */
+static BROTLI_INLINE BROTLI_BOOL BrotliSafeReadBits32(
+ BrotliBitReader* const br, uint32_t n_bits, uint32_t* val) {
+ BROTLI_DCHECK(n_bits <= 32);
+ if (BROTLI_64_BITS || (n_bits <= 24)) {
+ while (BrotliGetAvailableBits(br) < n_bits) {
+ if (!BrotliPullByte(br)) {
+ return BROTLI_FALSE;
+ }
+ }
+ BrotliTakeBits(br, n_bits, val);
+ return BROTLI_TRUE;
+ } else {
+ return BrotliSafeReadBits32Slow(br, n_bits, val);
+ }
+}
+
+/* Advances the bit reader position to the next byte boundary and verifies
+ that any skipped bits are set to zero. */
+static BROTLI_INLINE BROTLI_BOOL BrotliJumpToByteBoundary(BrotliBitReader* br) {
+ uint32_t pad_bits_count = BrotliGetAvailableBits(br) & 0x7;
+ uint32_t pad_bits = 0;
+ if (pad_bits_count != 0) {
+ BrotliTakeBits(br, pad_bits_count, &pad_bits);
+ }
+ return TO_BROTLI_BOOL(pad_bits == 0);
+}
+
+/* Copies remaining input bytes stored in the bit reader to the output. Value
+ |num| may not be larger than BrotliGetRemainingBytes. The bit reader must be
+ warmed up again after this. */
+static BROTLI_INLINE void BrotliCopyBytes(uint8_t* dest,
+ BrotliBitReader* br, size_t num) {
+ while (BrotliGetAvailableBits(br) >= 8 && num > 0) {
+ *dest = (uint8_t)BrotliGetBitsUnmasked(br);
+ BrotliDropBits(br, 8);
+ ++dest;
+ --num;
+ }
+ memcpy(dest, br->next_in, num);
+ br->avail_in -= num;
+ br->next_in += num;
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_DEC_BIT_READER_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c
new file mode 100644
index 000000000..114c5057d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c
@@ -0,0 +1,2605 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+#include <brotli/decode.h>
+
+#include <stdlib.h> /* free, malloc */
+#include <string.h> /* memcpy, memset */
+
+#include "../common/constants.h"
+#include "../common/context.h"
+#include "../common/dictionary.h"
+#include "../common/platform.h"
+#include "../common/transform.h"
+#include "../common/version.h"
+#include "./bit_reader.h"
+#include "./huffman.h"
+#include "./prefix.h"
+#include "./state.h"
+
+#if defined(BROTLI_TARGET_NEON)
+#include <arm_neon.h>
+#endif
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
+
+#define BROTLI_LOG_UINT(name) \
+ BROTLI_LOG(("[%s] %s = %lu\n", __func__, #name, (unsigned long)(name)))
+#define BROTLI_LOG_ARRAY_INDEX(array_name, idx) \
+ BROTLI_LOG(("[%s] %s[%lu] = %lu\n", __func__, #array_name, \
+ (unsigned long)(idx), (unsigned long)array_name[idx]))
+
+#define HUFFMAN_TABLE_BITS 8U
+#define HUFFMAN_TABLE_MASK 0xFF
+
+/* We need the slack region for the following reasons:
+ - doing up to two 16-byte copies for fast backward copying
+ - inserting transformed dictionary word:
+ 5 prefix + 24 base + 8 suffix */
+static const uint32_t kRingBufferWriteAheadSlack = 42;
+
+static const uint8_t kCodeLengthCodeOrder[BROTLI_CODE_LENGTH_CODES] = {
+ 1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+};
+
+/* Static prefix code for the complex code length code lengths. */
+static const uint8_t kCodeLengthPrefixLength[16] = {
+ 2, 2, 2, 3, 2, 2, 2, 4, 2, 2, 2, 3, 2, 2, 2, 4,
+};
+
+static const uint8_t kCodeLengthPrefixValue[16] = {
+ 0, 4, 3, 2, 0, 4, 3, 1, 0, 4, 3, 2, 0, 4, 3, 5,
+};
+
+BROTLI_BOOL BrotliDecoderSetParameter(
+ BrotliDecoderState* state, BrotliDecoderParameter p, uint32_t value) {
+ if (state->state != BROTLI_STATE_UNINITED) return BROTLI_FALSE;
+ switch (p) {
+ case BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:
+ state->canny_ringbuffer_allocation = !!value ? 0 : 1;
+ return BROTLI_TRUE;
+
+ case BROTLI_DECODER_PARAM_LARGE_WINDOW:
+ state->large_window = TO_BROTLI_BOOL(!!value);
+ return BROTLI_TRUE;
+
+ default: return BROTLI_FALSE;
+ }
+}
+
+BrotliDecoderState* BrotliDecoderCreateInstance(
+ brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque) {
+ BrotliDecoderState* state = 0;
+ if (!alloc_func && !free_func) {
+ state = (BrotliDecoderState*)malloc(sizeof(BrotliDecoderState));
+ } else if (alloc_func && free_func) {
+ state = (BrotliDecoderState*)alloc_func(opaque, sizeof(BrotliDecoderState));
+ }
+ if (state == 0) {
+ BROTLI_DUMP();
+ return 0;
+ }
+ if (!BrotliDecoderStateInit(state, alloc_func, free_func, opaque)) {
+ BROTLI_DUMP();
+ if (!alloc_func && !free_func) {
+ free(state);
+ } else if (alloc_func && free_func) {
+ free_func(opaque, state);
+ }
+ return 0;
+ }
+ return state;
+}
+
+/* Deinitializes and frees BrotliDecoderState instance. */
+void BrotliDecoderDestroyInstance(BrotliDecoderState* state) {
+ if (!state) {
+ return;
+ } else {
+ brotli_free_func free_func = state->free_func;
+ void* opaque = state->memory_manager_opaque;
+ BrotliDecoderStateCleanup(state);
+ free_func(opaque, state);
+ }
+}
+
+/* Saves error code and converts it to BrotliDecoderResult. */
+static BROTLI_NOINLINE BrotliDecoderResult SaveErrorCode(
+ BrotliDecoderState* s, BrotliDecoderErrorCode e) {
+ s->error_code = (int)e;
+ switch (e) {
+ case BROTLI_DECODER_SUCCESS:
+ return BROTLI_DECODER_RESULT_SUCCESS;
+
+ case BROTLI_DECODER_NEEDS_MORE_INPUT:
+ return BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT;
+
+ case BROTLI_DECODER_NEEDS_MORE_OUTPUT:
+ return BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT;
+
+ default:
+ return BROTLI_DECODER_RESULT_ERROR;
+ }
+}
+
+/* Decodes WBITS by reading 1 - 7 bits, or 0x11 for "Large Window Brotli".
+ Precondition: bit-reader accumulator has at least 8 bits. */
+static BrotliDecoderErrorCode DecodeWindowBits(BrotliDecoderState* s,
+ BrotliBitReader* br) {
+ uint32_t n;
+ BROTLI_BOOL large_window = s->large_window;
+ s->large_window = BROTLI_FALSE;
+ BrotliTakeBits(br, 1, &n);
+ if (n == 0) {
+ s->window_bits = 16;
+ return BROTLI_DECODER_SUCCESS;
+ }
+ BrotliTakeBits(br, 3, &n);
+ if (n != 0) {
+ s->window_bits = 17 + n;
+ return BROTLI_DECODER_SUCCESS;
+ }
+ BrotliTakeBits(br, 3, &n);
+ if (n == 1) {
+ if (large_window) {
+ BrotliTakeBits(br, 1, &n);
+ if (n == 1) {
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS);
+ }
+ s->large_window = BROTLI_TRUE;
+ return BROTLI_DECODER_SUCCESS;
+ } else {
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS);
+ }
+ }
+ if (n != 0) {
+ s->window_bits = 8 + n;
+ return BROTLI_DECODER_SUCCESS;
+ }
+ s->window_bits = 17;
+ return BROTLI_DECODER_SUCCESS;
+}
+
+static BROTLI_INLINE void memmove16(uint8_t* dst, uint8_t* src) {
+#if defined(BROTLI_TARGET_NEON)
+ vst1q_u8(dst, vld1q_u8(src));
+#else
+ uint32_t buffer[4];
+ memcpy(buffer, src, 16);
+ memcpy(dst, buffer, 16);
+#endif
+}
+
+/* Decodes a number in the range [0..255], by reading 1 - 11 bits. */
+static BROTLI_NOINLINE BrotliDecoderErrorCode DecodeVarLenUint8(
+ BrotliDecoderState* s, BrotliBitReader* br, uint32_t* value) {
+ uint32_t bits;
+ switch (s->substate_decode_uint8) {
+ case BROTLI_STATE_DECODE_UINT8_NONE:
+ if (BROTLI_PREDICT_FALSE(!BrotliSafeReadBits(br, 1, &bits))) {
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ if (bits == 0) {
+ *value = 0;
+ return BROTLI_DECODER_SUCCESS;
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_DECODE_UINT8_SHORT:
+ if (BROTLI_PREDICT_FALSE(!BrotliSafeReadBits(br, 3, &bits))) {
+ s->substate_decode_uint8 = BROTLI_STATE_DECODE_UINT8_SHORT;
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ if (bits == 0) {
+ *value = 1;
+ s->substate_decode_uint8 = BROTLI_STATE_DECODE_UINT8_NONE;
+ return BROTLI_DECODER_SUCCESS;
+ }
+ /* Use output value as a temporary storage. It MUST be persisted. */
+ *value = bits;
+ /* Fall through. */
+
+ case BROTLI_STATE_DECODE_UINT8_LONG:
+ if (BROTLI_PREDICT_FALSE(!BrotliSafeReadBits(br, *value, &bits))) {
+ s->substate_decode_uint8 = BROTLI_STATE_DECODE_UINT8_LONG;
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ *value = (1U << *value) + bits;
+ s->substate_decode_uint8 = BROTLI_STATE_DECODE_UINT8_NONE;
+ return BROTLI_DECODER_SUCCESS;
+
+ default:
+ return
+ BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE);
+ }
+}
+
+/* Decodes a metablock length and flags by reading 2 - 31 bits. */
+static BrotliDecoderErrorCode BROTLI_NOINLINE DecodeMetaBlockLength(
+ BrotliDecoderState* s, BrotliBitReader* br) {
+ uint32_t bits;
+ int i;
+ for (;;) {
+ switch (s->substate_metablock_header) {
+ case BROTLI_STATE_METABLOCK_HEADER_NONE:
+ if (!BrotliSafeReadBits(br, 1, &bits)) {
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ s->is_last_metablock = bits ? 1 : 0;
+ s->meta_block_remaining_len = 0;
+ s->is_uncompressed = 0;
+ s->is_metadata = 0;
+ if (!s->is_last_metablock) {
+ s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NIBBLES;
+ break;
+ }
+ s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_EMPTY;
+ /* Fall through. */
+
+ case BROTLI_STATE_METABLOCK_HEADER_EMPTY:
+ if (!BrotliSafeReadBits(br, 1, &bits)) {
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ if (bits) {
+ s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NONE;
+ return BROTLI_DECODER_SUCCESS;
+ }
+ s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NIBBLES;
+ /* Fall through. */
+
+ case BROTLI_STATE_METABLOCK_HEADER_NIBBLES:
+ if (!BrotliSafeReadBits(br, 2, &bits)) {
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ s->size_nibbles = (uint8_t)(bits + 4);
+ s->loop_counter = 0;
+ if (bits == 3) {
+ s->is_metadata = 1;
+ s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_RESERVED;
+ break;
+ }
+ s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_SIZE;
+ /* Fall through. */
+
+ case BROTLI_STATE_METABLOCK_HEADER_SIZE:
+ i = s->loop_counter;
+ for (; i < (int)s->size_nibbles; ++i) {
+ if (!BrotliSafeReadBits(br, 4, &bits)) {
+ s->loop_counter = i;
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ if (i + 1 == (int)s->size_nibbles && s->size_nibbles > 4 && bits == 0) {
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE);
+ }
+ s->meta_block_remaining_len |= (int)(bits << (i * 4));
+ }
+ s->substate_metablock_header =
+ BROTLI_STATE_METABLOCK_HEADER_UNCOMPRESSED;
+ /* Fall through. */
+
+ case BROTLI_STATE_METABLOCK_HEADER_UNCOMPRESSED:
+ if (!s->is_last_metablock) {
+ if (!BrotliSafeReadBits(br, 1, &bits)) {
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ s->is_uncompressed = bits ? 1 : 0;
+ }
+ ++s->meta_block_remaining_len;
+ s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NONE;
+ return BROTLI_DECODER_SUCCESS;
+
+ case BROTLI_STATE_METABLOCK_HEADER_RESERVED:
+ if (!BrotliSafeReadBits(br, 1, &bits)) {
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ if (bits != 0) {
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_RESERVED);
+ }
+ s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_BYTES;
+ /* Fall through. */
+
+ case BROTLI_STATE_METABLOCK_HEADER_BYTES:
+ if (!BrotliSafeReadBits(br, 2, &bits)) {
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ if (bits == 0) {
+ s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NONE;
+ return BROTLI_DECODER_SUCCESS;
+ }
+ s->size_nibbles = (uint8_t)bits;
+ s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_METADATA;
+ /* Fall through. */
+
+ case BROTLI_STATE_METABLOCK_HEADER_METADATA:
+ i = s->loop_counter;
+ for (; i < (int)s->size_nibbles; ++i) {
+ if (!BrotliSafeReadBits(br, 8, &bits)) {
+ s->loop_counter = i;
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ if (i + 1 == (int)s->size_nibbles && s->size_nibbles > 1 && bits == 0) {
+ return BROTLI_FAILURE(
+ BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE);
+ }
+ s->meta_block_remaining_len |= (int)(bits << (i * 8));
+ }
+ ++s->meta_block_remaining_len;
+ s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NONE;
+ return BROTLI_DECODER_SUCCESS;
+
+ default:
+ return
+ BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE);
+ }
+ }
+}
+
+/* Decodes the Huffman code.
+ This method doesn't read data from the bit reader, BUT drops the amount of
+ bits that correspond to the decoded symbol.
+ bits MUST contain at least 15 (BROTLI_HUFFMAN_MAX_CODE_LENGTH) valid bits. */
+static BROTLI_INLINE uint32_t DecodeSymbol(uint32_t bits,
+ const HuffmanCode* table,
+ BrotliBitReader* br) {
+ BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(table);
+ BROTLI_HC_ADJUST_TABLE_INDEX(table, bits & HUFFMAN_TABLE_MASK);
+ if (BROTLI_HC_FAST_LOAD_BITS(table) > HUFFMAN_TABLE_BITS) {
+ uint32_t nbits = BROTLI_HC_FAST_LOAD_BITS(table) - HUFFMAN_TABLE_BITS;
+ BrotliDropBits(br, HUFFMAN_TABLE_BITS);
+ BROTLI_HC_ADJUST_TABLE_INDEX(table,
+ BROTLI_HC_FAST_LOAD_VALUE(table) +
+ ((bits >> HUFFMAN_TABLE_BITS) & BitMask(nbits)));
+ }
+ BrotliDropBits(br, BROTLI_HC_FAST_LOAD_BITS(table));
+ return BROTLI_HC_FAST_LOAD_VALUE(table);
+}
+
+/* Reads and decodes the next Huffman code from bit-stream.
+ This method peeks 16 bits of input and drops 0 - 15 of them. */
+static BROTLI_INLINE uint32_t ReadSymbol(const HuffmanCode* table,
+ BrotliBitReader* br) {
+ return DecodeSymbol(BrotliGet16BitsUnmasked(br), table, br);
+}
+
+/* Same as DecodeSymbol, but it is known that there is less than 15 bits of
+ input are currently available. */
+static BROTLI_NOINLINE BROTLI_BOOL SafeDecodeSymbol(
+ const HuffmanCode* table, BrotliBitReader* br, uint32_t* result) {
+ uint32_t val;
+ uint32_t available_bits = BrotliGetAvailableBits(br);
+ BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(table);
+ if (available_bits == 0) {
+ if (BROTLI_HC_FAST_LOAD_BITS(table) == 0) {
+ *result = BROTLI_HC_FAST_LOAD_VALUE(table);
+ return BROTLI_TRUE;
+ }
+ return BROTLI_FALSE; /* No valid bits at all. */
+ }
+ val = (uint32_t)BrotliGetBitsUnmasked(br);
+ BROTLI_HC_ADJUST_TABLE_INDEX(table, val & HUFFMAN_TABLE_MASK);
+ if (BROTLI_HC_FAST_LOAD_BITS(table) <= HUFFMAN_TABLE_BITS) {
+ if (BROTLI_HC_FAST_LOAD_BITS(table) <= available_bits) {
+ BrotliDropBits(br, BROTLI_HC_FAST_LOAD_BITS(table));
+ *result = BROTLI_HC_FAST_LOAD_VALUE(table);
+ return BROTLI_TRUE;
+ } else {
+ return BROTLI_FALSE; /* Not enough bits for the first level. */
+ }
+ }
+ if (available_bits <= HUFFMAN_TABLE_BITS) {
+ return BROTLI_FALSE; /* Not enough bits to move to the second level. */
+ }
+
+ /* Speculatively drop HUFFMAN_TABLE_BITS. */
+ val = (val & BitMask(BROTLI_HC_FAST_LOAD_BITS(table))) >> HUFFMAN_TABLE_BITS;
+ available_bits -= HUFFMAN_TABLE_BITS;
+ BROTLI_HC_ADJUST_TABLE_INDEX(table, BROTLI_HC_FAST_LOAD_VALUE(table) + val);
+ if (available_bits < BROTLI_HC_FAST_LOAD_BITS(table)) {
+ return BROTLI_FALSE; /* Not enough bits for the second level. */
+ }
+
+ BrotliDropBits(br, HUFFMAN_TABLE_BITS + BROTLI_HC_FAST_LOAD_BITS(table));
+ *result = BROTLI_HC_FAST_LOAD_VALUE(table);
+ return BROTLI_TRUE;
+}
+
+static BROTLI_INLINE BROTLI_BOOL SafeReadSymbol(
+ const HuffmanCode* table, BrotliBitReader* br, uint32_t* result) {
+ uint32_t val;
+ if (BROTLI_PREDICT_TRUE(BrotliSafeGetBits(br, 15, &val))) {
+ *result = DecodeSymbol(val, table, br);
+ return BROTLI_TRUE;
+ }
+ return SafeDecodeSymbol(table, br, result);
+}
+
+/* Makes a look-up in first level Huffman table. Peeks 8 bits. */
+static BROTLI_INLINE void PreloadSymbol(int safe,
+ const HuffmanCode* table,
+ BrotliBitReader* br,
+ uint32_t* bits,
+ uint32_t* value) {
+ if (safe) {
+ return;
+ }
+ BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(table);
+ BROTLI_HC_ADJUST_TABLE_INDEX(table, BrotliGetBits(br, HUFFMAN_TABLE_BITS));
+ *bits = BROTLI_HC_FAST_LOAD_BITS(table);
+ *value = BROTLI_HC_FAST_LOAD_VALUE(table);
+}
+
+/* Decodes the next Huffman code using data prepared by PreloadSymbol.
+ Reads 0 - 15 bits. Also peeks 8 following bits. */
+static BROTLI_INLINE uint32_t ReadPreloadedSymbol(const HuffmanCode* table,
+ BrotliBitReader* br,
+ uint32_t* bits,
+ uint32_t* value) {
+ uint32_t result = *value;
+ if (BROTLI_PREDICT_FALSE(*bits > HUFFMAN_TABLE_BITS)) {
+ uint32_t val = BrotliGet16BitsUnmasked(br);
+ const HuffmanCode* ext = table + (val & HUFFMAN_TABLE_MASK) + *value;
+ uint32_t mask = BitMask((*bits - HUFFMAN_TABLE_BITS));
+ BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(ext);
+ BrotliDropBits(br, HUFFMAN_TABLE_BITS);
+ BROTLI_HC_ADJUST_TABLE_INDEX(ext, (val >> HUFFMAN_TABLE_BITS) & mask);
+ BrotliDropBits(br, BROTLI_HC_FAST_LOAD_BITS(ext));
+ result = BROTLI_HC_FAST_LOAD_VALUE(ext);
+ } else {
+ BrotliDropBits(br, *bits);
+ }
+ PreloadSymbol(0, table, br, bits, value);
+ return result;
+}
+
+static BROTLI_INLINE uint32_t Log2Floor(uint32_t x) {
+ uint32_t result = 0;
+ while (x) {
+ x >>= 1;
+ ++result;
+ }
+ return result;
+}
+
+/* Reads (s->symbol + 1) symbols.
+ Totally 1..4 symbols are read, 1..11 bits each.
+ The list of symbols MUST NOT contain duplicates. */
+static BrotliDecoderErrorCode ReadSimpleHuffmanSymbols(
+ uint32_t alphabet_size_max, uint32_t alphabet_size_limit,
+ BrotliDecoderState* s) {
+ /* max_bits == 1..11; symbol == 0..3; 1..44 bits will be read. */
+ BrotliBitReader* br = &s->br;
+ BrotliMetablockHeaderArena* h = &s->arena.header;
+ uint32_t max_bits = Log2Floor(alphabet_size_max - 1);
+ uint32_t i = h->sub_loop_counter;
+ uint32_t num_symbols = h->symbol;
+ while (i <= num_symbols) {
+ uint32_t v;
+ if (BROTLI_PREDICT_FALSE(!BrotliSafeReadBits(br, max_bits, &v))) {
+ h->sub_loop_counter = i;
+ h->substate_huffman = BROTLI_STATE_HUFFMAN_SIMPLE_READ;
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ if (v >= alphabet_size_limit) {
+ return
+ BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET);
+ }
+ h->symbols_lists_array[i] = (uint16_t)v;
+ BROTLI_LOG_UINT(h->symbols_lists_array[i]);
+ ++i;
+ }
+
+ for (i = 0; i < num_symbols; ++i) {
+ uint32_t k = i + 1;
+ for (; k <= num_symbols; ++k) {
+ if (h->symbols_lists_array[i] == h->symbols_lists_array[k]) {
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME);
+ }
+ }
+ }
+
+ return BROTLI_DECODER_SUCCESS;
+}
+
+/* Process single decoded symbol code length:
+ A) reset the repeat variable
+ B) remember code length (if it is not 0)
+ C) extend corresponding index-chain
+ D) reduce the Huffman space
+ E) update the histogram */
+static BROTLI_INLINE void ProcessSingleCodeLength(uint32_t code_len,
+ uint32_t* symbol, uint32_t* repeat, uint32_t* space,
+ uint32_t* prev_code_len, uint16_t* symbol_lists,
+ uint16_t* code_length_histo, int* next_symbol) {
+ *repeat = 0;
+ if (code_len != 0) { /* code_len == 1..15 */
+ symbol_lists[next_symbol[code_len]] = (uint16_t)(*symbol);
+ next_symbol[code_len] = (int)(*symbol);
+ *prev_code_len = code_len;
+ *space -= 32768U >> code_len;
+ code_length_histo[code_len]++;
+ BROTLI_LOG(("[ReadHuffmanCode] code_length[%d] = %d\n",
+ (int)*symbol, (int)code_len));
+ }
+ (*symbol)++;
+}
+
+/* Process repeated symbol code length.
+ A) Check if it is the extension of previous repeat sequence; if the decoded
+ value is not BROTLI_REPEAT_PREVIOUS_CODE_LENGTH, then it is a new
+ symbol-skip
+ B) Update repeat variable
+ C) Check if operation is feasible (fits alphabet)
+ D) For each symbol do the same operations as in ProcessSingleCodeLength
+
+ PRECONDITION: code_len == BROTLI_REPEAT_PREVIOUS_CODE_LENGTH or
+ code_len == BROTLI_REPEAT_ZERO_CODE_LENGTH */
+static BROTLI_INLINE void ProcessRepeatedCodeLength(uint32_t code_len,
+ uint32_t repeat_delta, uint32_t alphabet_size, uint32_t* symbol,
+ uint32_t* repeat, uint32_t* space, uint32_t* prev_code_len,
+ uint32_t* repeat_code_len, uint16_t* symbol_lists,
+ uint16_t* code_length_histo, int* next_symbol) {
+ uint32_t old_repeat;
+ uint32_t extra_bits = 3; /* for BROTLI_REPEAT_ZERO_CODE_LENGTH */
+ uint32_t new_len = 0; /* for BROTLI_REPEAT_ZERO_CODE_LENGTH */
+ if (code_len == BROTLI_REPEAT_PREVIOUS_CODE_LENGTH) {
+ new_len = *prev_code_len;
+ extra_bits = 2;
+ }
+ if (*repeat_code_len != new_len) {
+ *repeat = 0;
+ *repeat_code_len = new_len;
+ }
+ old_repeat = *repeat;
+ if (*repeat > 0) {
+ *repeat -= 2;
+ *repeat <<= extra_bits;
+ }
+ *repeat += repeat_delta + 3U;
+ repeat_delta = *repeat - old_repeat;
+ if (*symbol + repeat_delta > alphabet_size) {
+ BROTLI_DUMP();
+ *symbol = alphabet_size;
+ *space = 0xFFFFF;
+ return;
+ }
+ BROTLI_LOG(("[ReadHuffmanCode] code_length[%d..%d] = %d\n",
+ (int)*symbol, (int)(*symbol + repeat_delta - 1), (int)*repeat_code_len));
+ if (*repeat_code_len != 0) {
+ unsigned last = *symbol + repeat_delta;
+ int next = next_symbol[*repeat_code_len];
+ do {
+ symbol_lists[next] = (uint16_t)*symbol;
+ next = (int)*symbol;
+ } while (++(*symbol) != last);
+ next_symbol[*repeat_code_len] = next;
+ *space -= repeat_delta << (15 - *repeat_code_len);
+ code_length_histo[*repeat_code_len] =
+ (uint16_t)(code_length_histo[*repeat_code_len] + repeat_delta);
+ } else {
+ *symbol += repeat_delta;
+ }
+}
+
+/* Reads and decodes symbol codelengths. */
+static BrotliDecoderErrorCode ReadSymbolCodeLengths(
+ uint32_t alphabet_size, BrotliDecoderState* s) {
+ BrotliBitReader* br = &s->br;
+ BrotliMetablockHeaderArena* h = &s->arena.header;
+ uint32_t symbol = h->symbol;
+ uint32_t repeat = h->repeat;
+ uint32_t space = h->space;
+ uint32_t prev_code_len = h->prev_code_len;
+ uint32_t repeat_code_len = h->repeat_code_len;
+ uint16_t* symbol_lists = h->symbol_lists;
+ uint16_t* code_length_histo = h->code_length_histo;
+ int* next_symbol = h->next_symbol;
+ if (!BrotliWarmupBitReader(br)) {
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ while (symbol < alphabet_size && space > 0) {
+ const HuffmanCode* p = h->table;
+ uint32_t code_len;
+ BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(p);
+ if (!BrotliCheckInputAmount(br, BROTLI_SHORT_FILL_BIT_WINDOW_READ)) {
+ h->symbol = symbol;
+ h->repeat = repeat;
+ h->prev_code_len = prev_code_len;
+ h->repeat_code_len = repeat_code_len;
+ h->space = space;
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ BrotliFillBitWindow16(br);
+ BROTLI_HC_ADJUST_TABLE_INDEX(p, BrotliGetBitsUnmasked(br) &
+ BitMask(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH));
+ BrotliDropBits(br, BROTLI_HC_FAST_LOAD_BITS(p)); /* Use 1..5 bits. */
+ code_len = BROTLI_HC_FAST_LOAD_VALUE(p); /* code_len == 0..17 */
+ if (code_len < BROTLI_REPEAT_PREVIOUS_CODE_LENGTH) {
+ ProcessSingleCodeLength(code_len, &symbol, &repeat, &space,
+ &prev_code_len, symbol_lists, code_length_histo, next_symbol);
+ } else { /* code_len == 16..17, extra_bits == 2..3 */
+ uint32_t extra_bits =
+ (code_len == BROTLI_REPEAT_PREVIOUS_CODE_LENGTH) ? 2 : 3;
+ uint32_t repeat_delta =
+ (uint32_t)BrotliGetBitsUnmasked(br) & BitMask(extra_bits);
+ BrotliDropBits(br, extra_bits);
+ ProcessRepeatedCodeLength(code_len, repeat_delta, alphabet_size,
+ &symbol, &repeat, &space, &prev_code_len, &repeat_code_len,
+ symbol_lists, code_length_histo, next_symbol);
+ }
+ }
+ h->space = space;
+ return BROTLI_DECODER_SUCCESS;
+}
+
+static BrotliDecoderErrorCode SafeReadSymbolCodeLengths(
+ uint32_t alphabet_size, BrotliDecoderState* s) {
+ BrotliBitReader* br = &s->br;
+ BrotliMetablockHeaderArena* h = &s->arena.header;
+ BROTLI_BOOL get_byte = BROTLI_FALSE;
+ while (h->symbol < alphabet_size && h->space > 0) {
+ const HuffmanCode* p = h->table;
+ uint32_t code_len;
+ uint32_t available_bits;
+ uint32_t bits = 0;
+ BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(p);
+ if (get_byte && !BrotliPullByte(br)) return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ get_byte = BROTLI_FALSE;
+ available_bits = BrotliGetAvailableBits(br);
+ if (available_bits != 0) {
+ bits = (uint32_t)BrotliGetBitsUnmasked(br);
+ }
+ BROTLI_HC_ADJUST_TABLE_INDEX(p,
+ bits & BitMask(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH));
+ if (BROTLI_HC_FAST_LOAD_BITS(p) > available_bits) {
+ get_byte = BROTLI_TRUE;
+ continue;
+ }
+ code_len = BROTLI_HC_FAST_LOAD_VALUE(p); /* code_len == 0..17 */
+ if (code_len < BROTLI_REPEAT_PREVIOUS_CODE_LENGTH) {
+ BrotliDropBits(br, BROTLI_HC_FAST_LOAD_BITS(p));
+ ProcessSingleCodeLength(code_len, &h->symbol, &h->repeat, &h->space,
+ &h->prev_code_len, h->symbol_lists, h->code_length_histo,
+ h->next_symbol);
+ } else { /* code_len == 16..17, extra_bits == 2..3 */
+ uint32_t extra_bits = code_len - 14U;
+ uint32_t repeat_delta = (bits >> BROTLI_HC_FAST_LOAD_BITS(p)) &
+ BitMask(extra_bits);
+ if (available_bits < BROTLI_HC_FAST_LOAD_BITS(p) + extra_bits) {
+ get_byte = BROTLI_TRUE;
+ continue;
+ }
+ BrotliDropBits(br, BROTLI_HC_FAST_LOAD_BITS(p) + extra_bits);
+ ProcessRepeatedCodeLength(code_len, repeat_delta, alphabet_size,
+ &h->symbol, &h->repeat, &h->space, &h->prev_code_len,
+ &h->repeat_code_len, h->symbol_lists, h->code_length_histo,
+ h->next_symbol);
+ }
+ }
+ return BROTLI_DECODER_SUCCESS;
+}
+
+/* Reads and decodes 15..18 codes using static prefix code.
+ Each code is 2..4 bits long. In total 30..72 bits are used. */
+static BrotliDecoderErrorCode ReadCodeLengthCodeLengths(BrotliDecoderState* s) {
+ BrotliBitReader* br = &s->br;
+ BrotliMetablockHeaderArena* h = &s->arena.header;
+ uint32_t num_codes = h->repeat;
+ unsigned space = h->space;
+ uint32_t i = h->sub_loop_counter;
+ for (; i < BROTLI_CODE_LENGTH_CODES; ++i) {
+ const uint8_t code_len_idx = kCodeLengthCodeOrder[i];
+ uint32_t ix;
+ uint32_t v;
+ if (BROTLI_PREDICT_FALSE(!BrotliSafeGetBits(br, 4, &ix))) {
+ uint32_t available_bits = BrotliGetAvailableBits(br);
+ if (available_bits != 0) {
+ ix = BrotliGetBitsUnmasked(br) & 0xF;
+ } else {
+ ix = 0;
+ }
+ if (kCodeLengthPrefixLength[ix] > available_bits) {
+ h->sub_loop_counter = i;
+ h->repeat = num_codes;
+ h->space = space;
+ h->substate_huffman = BROTLI_STATE_HUFFMAN_COMPLEX;
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ }
+ v = kCodeLengthPrefixValue[ix];
+ BrotliDropBits(br, kCodeLengthPrefixLength[ix]);
+ h->code_length_code_lengths[code_len_idx] = (uint8_t)v;
+ BROTLI_LOG_ARRAY_INDEX(h->code_length_code_lengths, code_len_idx);
+ if (v != 0) {
+ space = space - (32U >> v);
+ ++num_codes;
+ ++h->code_length_histo[v];
+ if (space - 1U >= 32U) {
+ /* space is 0 or wrapped around. */
+ break;
+ }
+ }
+ }
+ if (!(num_codes == 1 || space == 0)) {
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_CL_SPACE);
+ }
+ return BROTLI_DECODER_SUCCESS;
+}
+
+/* Decodes the Huffman tables.
+ There are 2 scenarios:
+ A) Huffman code contains only few symbols (1..4). Those symbols are read
+ directly; their code lengths are defined by the number of symbols.
+ For this scenario 4 - 49 bits will be read.
+
+ B) 2-phase decoding:
+ B.1) Small Huffman table is decoded; it is specified with code lengths
+ encoded with predefined entropy code. 32 - 74 bits are used.
+ B.2) Decoded table is used to decode code lengths of symbols in resulting
+ Huffman table. In worst case 3520 bits are read. */
+static BrotliDecoderErrorCode ReadHuffmanCode(uint32_t alphabet_size_max,
+ uint32_t alphabet_size_limit,
+ HuffmanCode* table,
+ uint32_t* opt_table_size,
+ BrotliDecoderState* s) {
+ BrotliBitReader* br = &s->br;
+ BrotliMetablockHeaderArena* h = &s->arena.header;
+ /* State machine. */
+ for (;;) {
+ switch (h->substate_huffman) {
+ case BROTLI_STATE_HUFFMAN_NONE:
+ if (!BrotliSafeReadBits(br, 2, &h->sub_loop_counter)) {
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ BROTLI_LOG_UINT(h->sub_loop_counter);
+ /* The value is used as follows:
+ 1 for simple code;
+ 0 for no skipping, 2 skips 2 code lengths, 3 skips 3 code lengths */
+ if (h->sub_loop_counter != 1) {
+ h->space = 32;
+ h->repeat = 0; /* num_codes */
+ memset(&h->code_length_histo[0], 0, sizeof(h->code_length_histo[0]) *
+ (BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH + 1));
+ memset(&h->code_length_code_lengths[0], 0,
+ sizeof(h->code_length_code_lengths));
+ h->substate_huffman = BROTLI_STATE_HUFFMAN_COMPLEX;
+ continue;
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_HUFFMAN_SIMPLE_SIZE:
+ /* Read symbols, codes & code lengths directly. */
+ if (!BrotliSafeReadBits(br, 2, &h->symbol)) { /* num_symbols */
+ h->substate_huffman = BROTLI_STATE_HUFFMAN_SIMPLE_SIZE;
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ h->sub_loop_counter = 0;
+ /* Fall through. */
+
+ case BROTLI_STATE_HUFFMAN_SIMPLE_READ: {
+ BrotliDecoderErrorCode result =
+ ReadSimpleHuffmanSymbols(alphabet_size_max, alphabet_size_limit, s);
+ if (result != BROTLI_DECODER_SUCCESS) {
+ return result;
+ }
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_HUFFMAN_SIMPLE_BUILD: {
+ uint32_t table_size;
+ if (h->symbol == 3) {
+ uint32_t bits;
+ if (!BrotliSafeReadBits(br, 1, &bits)) {
+ h->substate_huffman = BROTLI_STATE_HUFFMAN_SIMPLE_BUILD;
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ h->symbol += bits;
+ }
+ BROTLI_LOG_UINT(h->symbol);
+ table_size = BrotliBuildSimpleHuffmanTable(
+ table, HUFFMAN_TABLE_BITS, h->symbols_lists_array, h->symbol);
+ if (opt_table_size) {
+ *opt_table_size = table_size;
+ }
+ h->substate_huffman = BROTLI_STATE_HUFFMAN_NONE;
+ return BROTLI_DECODER_SUCCESS;
+ }
+
+ /* Decode Huffman-coded code lengths. */
+ case BROTLI_STATE_HUFFMAN_COMPLEX: {
+ uint32_t i;
+ BrotliDecoderErrorCode result = ReadCodeLengthCodeLengths(s);
+ if (result != BROTLI_DECODER_SUCCESS) {
+ return result;
+ }
+ BrotliBuildCodeLengthsHuffmanTable(h->table,
+ h->code_length_code_lengths,
+ h->code_length_histo);
+ memset(&h->code_length_histo[0], 0, sizeof(h->code_length_histo));
+ for (i = 0; i <= BROTLI_HUFFMAN_MAX_CODE_LENGTH; ++i) {
+ h->next_symbol[i] = (int)i - (BROTLI_HUFFMAN_MAX_CODE_LENGTH + 1);
+ h->symbol_lists[h->next_symbol[i]] = 0xFFFF;
+ }
+
+ h->symbol = 0;
+ h->prev_code_len = BROTLI_INITIAL_REPEATED_CODE_LENGTH;
+ h->repeat = 0;
+ h->repeat_code_len = 0;
+ h->space = 32768;
+ h->substate_huffman = BROTLI_STATE_HUFFMAN_LENGTH_SYMBOLS;
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_HUFFMAN_LENGTH_SYMBOLS: {
+ uint32_t table_size;
+ BrotliDecoderErrorCode result = ReadSymbolCodeLengths(
+ alphabet_size_limit, s);
+ if (result == BROTLI_DECODER_NEEDS_MORE_INPUT) {
+ result = SafeReadSymbolCodeLengths(alphabet_size_limit, s);
+ }
+ if (result != BROTLI_DECODER_SUCCESS) {
+ return result;
+ }
+
+ if (h->space != 0) {
+ BROTLI_LOG(("[ReadHuffmanCode] space = %d\n", (int)h->space));
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE);
+ }
+ table_size = BrotliBuildHuffmanTable(
+ table, HUFFMAN_TABLE_BITS, h->symbol_lists, h->code_length_histo);
+ if (opt_table_size) {
+ *opt_table_size = table_size;
+ }
+ h->substate_huffman = BROTLI_STATE_HUFFMAN_NONE;
+ return BROTLI_DECODER_SUCCESS;
+ }
+
+ default:
+ return
+ BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE);
+ }
+ }
+}
+
+/* Decodes a block length by reading 3..39 bits. */
+static BROTLI_INLINE uint32_t ReadBlockLength(const HuffmanCode* table,
+ BrotliBitReader* br) {
+ uint32_t code;
+ uint32_t nbits;
+ code = ReadSymbol(table, br);
+ nbits = kBlockLengthPrefixCode[code].nbits; /* nbits == 2..24 */
+ return kBlockLengthPrefixCode[code].offset + BrotliReadBits24(br, nbits);
+}
+
+/* WARNING: if state is not BROTLI_STATE_READ_BLOCK_LENGTH_NONE, then
+ reading can't be continued with ReadBlockLength. */
+static BROTLI_INLINE BROTLI_BOOL SafeReadBlockLength(
+ BrotliDecoderState* s, uint32_t* result, const HuffmanCode* table,
+ BrotliBitReader* br) {
+ uint32_t index;
+ if (s->substate_read_block_length == BROTLI_STATE_READ_BLOCK_LENGTH_NONE) {
+ if (!SafeReadSymbol(table, br, &index)) {
+ return BROTLI_FALSE;
+ }
+ } else {
+ index = s->block_length_index;
+ }
+ {
+ uint32_t bits;
+ uint32_t nbits = kBlockLengthPrefixCode[index].nbits; /* nbits == 2..24 */
+ if (!BrotliSafeReadBits(br, nbits, &bits)) {
+ s->block_length_index = index;
+ s->substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_SUFFIX;
+ return BROTLI_FALSE;
+ }
+ *result = kBlockLengthPrefixCode[index].offset + bits;
+ s->substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_NONE;
+ return BROTLI_TRUE;
+ }
+}
+
+/* Transform:
+ 1) initialize list L with values 0, 1,... 255
+ 2) For each input element X:
+ 2.1) let Y = L[X]
+ 2.2) remove X-th element from L
+ 2.3) prepend Y to L
+ 2.4) append Y to output
+
+ In most cases max(Y) <= 7, so most of L remains intact.
+ To reduce the cost of initialization, we reuse L, remember the upper bound
+ of Y values, and reinitialize only first elements in L.
+
+ Most of input values are 0 and 1. To reduce number of branches, we replace
+ inner for loop with do-while. */
+static BROTLI_NOINLINE void InverseMoveToFrontTransform(
+ uint8_t* v, uint32_t v_len, BrotliDecoderState* state) {
+ /* Reinitialize elements that could have been changed. */
+ uint32_t i = 1;
+ uint32_t upper_bound = state->mtf_upper_bound;
+ uint32_t* mtf = &state->mtf[1]; /* Make mtf[-1] addressable. */
+ uint8_t* mtf_u8 = (uint8_t*)mtf;
+ /* Load endian-aware constant. */
+ const uint8_t b0123[4] = {0, 1, 2, 3};
+ uint32_t pattern;
+ memcpy(&pattern, &b0123, 4);
+
+ /* Initialize list using 4 consequent values pattern. */
+ mtf[0] = pattern;
+ do {
+ pattern += 0x04040404; /* Advance all 4 values by 4. */
+ mtf[i] = pattern;
+ i++;
+ } while (i <= upper_bound);
+
+ /* Transform the input. */
+ upper_bound = 0;
+ for (i = 0; i < v_len; ++i) {
+ int index = v[i];
+ uint8_t value = mtf_u8[index];
+ upper_bound |= v[i];
+ v[i] = value;
+ mtf_u8[-1] = value;
+ do {
+ index--;
+ mtf_u8[index + 1] = mtf_u8[index];
+ } while (index >= 0);
+ }
+ /* Remember amount of elements to be reinitialized. */
+ state->mtf_upper_bound = upper_bound >> 2;
+}
+
+/* Decodes a series of Huffman table using ReadHuffmanCode function. */
+static BrotliDecoderErrorCode HuffmanTreeGroupDecode(
+ HuffmanTreeGroup* group, BrotliDecoderState* s) {
+ BrotliMetablockHeaderArena* h = &s->arena.header;
+ if (h->substate_tree_group != BROTLI_STATE_TREE_GROUP_LOOP) {
+ h->next = group->codes;
+ h->htree_index = 0;
+ h->substate_tree_group = BROTLI_STATE_TREE_GROUP_LOOP;
+ }
+ while (h->htree_index < group->num_htrees) {
+ uint32_t table_size;
+ BrotliDecoderErrorCode result = ReadHuffmanCode(group->alphabet_size_max,
+ group->alphabet_size_limit, h->next, &table_size, s);
+ if (result != BROTLI_DECODER_SUCCESS) return result;
+ group->htrees[h->htree_index] = h->next;
+ h->next += table_size;
+ ++h->htree_index;
+ }
+ h->substate_tree_group = BROTLI_STATE_TREE_GROUP_NONE;
+ return BROTLI_DECODER_SUCCESS;
+}
+
+/* Decodes a context map.
+ Decoding is done in 4 phases:
+ 1) Read auxiliary information (6..16 bits) and allocate memory.
+ In case of trivial context map, decoding is finished at this phase.
+ 2) Decode Huffman table using ReadHuffmanCode function.
+ This table will be used for reading context map items.
+ 3) Read context map items; "0" values could be run-length encoded.
+ 4) Optionally, apply InverseMoveToFront transform to the resulting map. */
+static BrotliDecoderErrorCode DecodeContextMap(uint32_t context_map_size,
+ uint32_t* num_htrees,
+ uint8_t** context_map_arg,
+ BrotliDecoderState* s) {
+ BrotliBitReader* br = &s->br;
+ BrotliDecoderErrorCode result = BROTLI_DECODER_SUCCESS;
+ BrotliMetablockHeaderArena* h = &s->arena.header;
+
+ switch ((int)h->substate_context_map) {
+ case BROTLI_STATE_CONTEXT_MAP_NONE:
+ result = DecodeVarLenUint8(s, br, num_htrees);
+ if (result != BROTLI_DECODER_SUCCESS) {
+ return result;
+ }
+ (*num_htrees)++;
+ h->context_index = 0;
+ BROTLI_LOG_UINT(context_map_size);
+ BROTLI_LOG_UINT(*num_htrees);
+ *context_map_arg =
+ (uint8_t*)BROTLI_DECODER_ALLOC(s, (size_t)context_map_size);
+ if (*context_map_arg == 0) {
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP);
+ }
+ if (*num_htrees <= 1) {
+ memset(*context_map_arg, 0, (size_t)context_map_size);
+ return BROTLI_DECODER_SUCCESS;
+ }
+ h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_READ_PREFIX;
+ /* Fall through. */
+
+ case BROTLI_STATE_CONTEXT_MAP_READ_PREFIX: {
+ uint32_t bits;
+ /* In next stage ReadHuffmanCode uses at least 4 bits, so it is safe
+ to peek 4 bits ahead. */
+ if (!BrotliSafeGetBits(br, 5, &bits)) {
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ if ((bits & 1) != 0) { /* Use RLE for zeros. */
+ h->max_run_length_prefix = (bits >> 1) + 1;
+ BrotliDropBits(br, 5);
+ } else {
+ h->max_run_length_prefix = 0;
+ BrotliDropBits(br, 1);
+ }
+ BROTLI_LOG_UINT(h->max_run_length_prefix);
+ h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_HUFFMAN;
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_CONTEXT_MAP_HUFFMAN: {
+ uint32_t alphabet_size = *num_htrees + h->max_run_length_prefix;
+ result = ReadHuffmanCode(alphabet_size, alphabet_size,
+ h->context_map_table, NULL, s);
+ if (result != BROTLI_DECODER_SUCCESS) return result;
+ h->code = 0xFFFF;
+ h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_DECODE;
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_CONTEXT_MAP_DECODE: {
+ uint32_t context_index = h->context_index;
+ uint32_t max_run_length_prefix = h->max_run_length_prefix;
+ uint8_t* context_map = *context_map_arg;
+ uint32_t code = h->code;
+ BROTLI_BOOL skip_preamble = (code != 0xFFFF);
+ while (context_index < context_map_size || skip_preamble) {
+ if (!skip_preamble) {
+ if (!SafeReadSymbol(h->context_map_table, br, &code)) {
+ h->code = 0xFFFF;
+ h->context_index = context_index;
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ BROTLI_LOG_UINT(code);
+
+ if (code == 0) {
+ context_map[context_index++] = 0;
+ continue;
+ }
+ if (code > max_run_length_prefix) {
+ context_map[context_index++] =
+ (uint8_t)(code - max_run_length_prefix);
+ continue;
+ }
+ } else {
+ skip_preamble = BROTLI_FALSE;
+ }
+ /* RLE sub-stage. */
+ {
+ uint32_t reps;
+ if (!BrotliSafeReadBits(br, code, &reps)) {
+ h->code = code;
+ h->context_index = context_index;
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ reps += 1U << code;
+ BROTLI_LOG_UINT(reps);
+ if (context_index + reps > context_map_size) {
+ return
+ BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT);
+ }
+ do {
+ context_map[context_index++] = 0;
+ } while (--reps);
+ }
+ }
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_CONTEXT_MAP_TRANSFORM: {
+ uint32_t bits;
+ if (!BrotliSafeReadBits(br, 1, &bits)) {
+ h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_TRANSFORM;
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ if (bits != 0) {
+ InverseMoveToFrontTransform(*context_map_arg, context_map_size, s);
+ }
+ h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_NONE;
+ return BROTLI_DECODER_SUCCESS;
+ }
+
+ default:
+ return
+ BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE);
+ }
+}
+
+/* Decodes a command or literal and updates block type ring-buffer.
+ Reads 3..54 bits. */
+static BROTLI_INLINE BROTLI_BOOL DecodeBlockTypeAndLength(
+ int safe, BrotliDecoderState* s, int tree_type) {
+ uint32_t max_block_type = s->num_block_types[tree_type];
+ const HuffmanCode* type_tree = &s->block_type_trees[
+ tree_type * BROTLI_HUFFMAN_MAX_SIZE_258];
+ const HuffmanCode* len_tree = &s->block_len_trees[
+ tree_type * BROTLI_HUFFMAN_MAX_SIZE_26];
+ BrotliBitReader* br = &s->br;
+ uint32_t* ringbuffer = &s->block_type_rb[tree_type * 2];
+ uint32_t block_type;
+ if (max_block_type <= 1) {
+ return BROTLI_FALSE;
+ }
+
+ /* Read 0..15 + 3..39 bits. */
+ if (!safe) {
+ block_type = ReadSymbol(type_tree, br);
+ s->block_length[tree_type] = ReadBlockLength(len_tree, br);
+ } else {
+ BrotliBitReaderState memento;
+ BrotliBitReaderSaveState(br, &memento);
+ if (!SafeReadSymbol(type_tree, br, &block_type)) return BROTLI_FALSE;
+ if (!SafeReadBlockLength(s, &s->block_length[tree_type], len_tree, br)) {
+ s->substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_NONE;
+ BrotliBitReaderRestoreState(br, &memento);
+ return BROTLI_FALSE;
+ }
+ }
+
+ if (block_type == 1) {
+ block_type = ringbuffer[1] + 1;
+ } else if (block_type == 0) {
+ block_type = ringbuffer[0];
+ } else {
+ block_type -= 2;
+ }
+ if (block_type >= max_block_type) {
+ block_type -= max_block_type;
+ }
+ ringbuffer[0] = ringbuffer[1];
+ ringbuffer[1] = block_type;
+ return BROTLI_TRUE;
+}
+
+static BROTLI_INLINE void DetectTrivialLiteralBlockTypes(
+ BrotliDecoderState* s) {
+ size_t i;
+ for (i = 0; i < 8; ++i) s->trivial_literal_contexts[i] = 0;
+ for (i = 0; i < s->num_block_types[0]; i++) {
+ size_t offset = i << BROTLI_LITERAL_CONTEXT_BITS;
+ size_t error = 0;
+ size_t sample = s->context_map[offset];
+ size_t j;
+ for (j = 0; j < (1u << BROTLI_LITERAL_CONTEXT_BITS);) {
+ BROTLI_REPEAT(4, error |= s->context_map[offset + j++] ^ sample;)
+ }
+ if (error == 0) {
+ s->trivial_literal_contexts[i >> 5] |= 1u << (i & 31);
+ }
+ }
+}
+
+static BROTLI_INLINE void PrepareLiteralDecoding(BrotliDecoderState* s) {
+ uint8_t context_mode;
+ size_t trivial;
+ uint32_t block_type = s->block_type_rb[1];
+ uint32_t context_offset = block_type << BROTLI_LITERAL_CONTEXT_BITS;
+ s->context_map_slice = s->context_map + context_offset;
+ trivial = s->trivial_literal_contexts[block_type >> 5];
+ s->trivial_literal_context = (trivial >> (block_type & 31)) & 1;
+ s->literal_htree = s->literal_hgroup.htrees[s->context_map_slice[0]];
+ context_mode = s->context_modes[block_type] & 3;
+ s->context_lookup = BROTLI_CONTEXT_LUT(context_mode);
+}
+
+/* Decodes the block type and updates the state for literal context.
+ Reads 3..54 bits. */
+static BROTLI_INLINE BROTLI_BOOL DecodeLiteralBlockSwitchInternal(
+ int safe, BrotliDecoderState* s) {
+ if (!DecodeBlockTypeAndLength(safe, s, 0)) {
+ return BROTLI_FALSE;
+ }
+ PrepareLiteralDecoding(s);
+ return BROTLI_TRUE;
+}
+
+static void BROTLI_NOINLINE DecodeLiteralBlockSwitch(BrotliDecoderState* s) {
+ DecodeLiteralBlockSwitchInternal(0, s);
+}
+
+static BROTLI_BOOL BROTLI_NOINLINE SafeDecodeLiteralBlockSwitch(
+ BrotliDecoderState* s) {
+ return DecodeLiteralBlockSwitchInternal(1, s);
+}
+
+/* Block switch for insert/copy length.
+ Reads 3..54 bits. */
+static BROTLI_INLINE BROTLI_BOOL DecodeCommandBlockSwitchInternal(
+ int safe, BrotliDecoderState* s) {
+ if (!DecodeBlockTypeAndLength(safe, s, 1)) {
+ return BROTLI_FALSE;
+ }
+ s->htree_command = s->insert_copy_hgroup.htrees[s->block_type_rb[3]];
+ return BROTLI_TRUE;
+}
+
+static void BROTLI_NOINLINE DecodeCommandBlockSwitch(BrotliDecoderState* s) {
+ DecodeCommandBlockSwitchInternal(0, s);
+}
+
+static BROTLI_BOOL BROTLI_NOINLINE SafeDecodeCommandBlockSwitch(
+ BrotliDecoderState* s) {
+ return DecodeCommandBlockSwitchInternal(1, s);
+}
+
+/* Block switch for distance codes.
+ Reads 3..54 bits. */
+static BROTLI_INLINE BROTLI_BOOL DecodeDistanceBlockSwitchInternal(
+ int safe, BrotliDecoderState* s) {
+ if (!DecodeBlockTypeAndLength(safe, s, 2)) {
+ return BROTLI_FALSE;
+ }
+ s->dist_context_map_slice = s->dist_context_map +
+ (s->block_type_rb[5] << BROTLI_DISTANCE_CONTEXT_BITS);
+ s->dist_htree_index = s->dist_context_map_slice[s->distance_context];
+ return BROTLI_TRUE;
+}
+
+static void BROTLI_NOINLINE DecodeDistanceBlockSwitch(BrotliDecoderState* s) {
+ DecodeDistanceBlockSwitchInternal(0, s);
+}
+
+static BROTLI_BOOL BROTLI_NOINLINE SafeDecodeDistanceBlockSwitch(
+ BrotliDecoderState* s) {
+ return DecodeDistanceBlockSwitchInternal(1, s);
+}
+
+static size_t UnwrittenBytes(const BrotliDecoderState* s, BROTLI_BOOL wrap) {
+ size_t pos = wrap && s->pos > s->ringbuffer_size ?
+ (size_t)s->ringbuffer_size : (size_t)(s->pos);
+ size_t partial_pos_rb = (s->rb_roundtrips * (size_t)s->ringbuffer_size) + pos;
+ return partial_pos_rb - s->partial_pos_out;
+}
+
+/* Dumps output.
+ Returns BROTLI_DECODER_NEEDS_MORE_OUTPUT only if there is more output to push
+ and either ring-buffer is as big as window size, or |force| is true. */
+static BrotliDecoderErrorCode BROTLI_NOINLINE WriteRingBuffer(
+ BrotliDecoderState* s, size_t* available_out, uint8_t** next_out,
+ size_t* total_out, BROTLI_BOOL force) {
+ uint8_t* start =
+ s->ringbuffer + (s->partial_pos_out & (size_t)s->ringbuffer_mask);
+ size_t to_write = UnwrittenBytes(s, BROTLI_TRUE);
+ size_t num_written = *available_out;
+ if (num_written > to_write) {
+ num_written = to_write;
+ }
+ if (s->meta_block_remaining_len < 0) {
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1);
+ }
+ if (next_out && !*next_out) {
+ *next_out = start;
+ } else {
+ if (next_out) {
+ memcpy(*next_out, start, num_written);
+ *next_out += num_written;
+ }
+ }
+ *available_out -= num_written;
+ BROTLI_LOG_UINT(to_write);
+ BROTLI_LOG_UINT(num_written);
+ s->partial_pos_out += num_written;
+ if (total_out) {
+ *total_out = s->partial_pos_out;
+ }
+ if (num_written < to_write) {
+ if (s->ringbuffer_size == (1 << s->window_bits) || force) {
+ return BROTLI_DECODER_NEEDS_MORE_OUTPUT;
+ } else {
+ return BROTLI_DECODER_SUCCESS;
+ }
+ }
+ /* Wrap ring buffer only if it has reached its maximal size. */
+ if (s->ringbuffer_size == (1 << s->window_bits) &&
+ s->pos >= s->ringbuffer_size) {
+ s->pos -= s->ringbuffer_size;
+ s->rb_roundtrips++;
+ s->should_wrap_ringbuffer = (size_t)s->pos != 0 ? 1 : 0;
+ }
+ return BROTLI_DECODER_SUCCESS;
+}
+
+static void BROTLI_NOINLINE WrapRingBuffer(BrotliDecoderState* s) {
+ if (s->should_wrap_ringbuffer) {
+ memcpy(s->ringbuffer, s->ringbuffer_end, (size_t)s->pos);
+ s->should_wrap_ringbuffer = 0;
+ }
+}
+
+/* Allocates ring-buffer.
+
+ s->ringbuffer_size MUST be updated by BrotliCalculateRingBufferSize before
+ this function is called.
+
+ Last two bytes of ring-buffer are initialized to 0, so context calculation
+ could be done uniformly for the first two and all other positions. */
+static BROTLI_BOOL BROTLI_NOINLINE BrotliEnsureRingBuffer(
+ BrotliDecoderState* s) {
+ uint8_t* old_ringbuffer = s->ringbuffer;
+ if (s->ringbuffer_size == s->new_ringbuffer_size) {
+ return BROTLI_TRUE;
+ }
+
+ s->ringbuffer = (uint8_t*)BROTLI_DECODER_ALLOC(s,
+ (size_t)(s->new_ringbuffer_size) + kRingBufferWriteAheadSlack);
+ if (s->ringbuffer == 0) {
+ /* Restore previous value. */
+ s->ringbuffer = old_ringbuffer;
+ return BROTLI_FALSE;
+ }
+ s->ringbuffer[s->new_ringbuffer_size - 2] = 0;
+ s->ringbuffer[s->new_ringbuffer_size - 1] = 0;
+
+ if (!!old_ringbuffer) {
+ memcpy(s->ringbuffer, old_ringbuffer, (size_t)s->pos);
+ BROTLI_DECODER_FREE(s, old_ringbuffer);
+ }
+
+ s->ringbuffer_size = s->new_ringbuffer_size;
+ s->ringbuffer_mask = s->new_ringbuffer_size - 1;
+ s->ringbuffer_end = s->ringbuffer + s->ringbuffer_size;
+
+ return BROTLI_TRUE;
+}
+
+static BrotliDecoderErrorCode BROTLI_NOINLINE CopyUncompressedBlockToOutput(
+ size_t* available_out, uint8_t** next_out, size_t* total_out,
+ BrotliDecoderState* s) {
+ /* TODO: avoid allocation for single uncompressed block. */
+ if (!BrotliEnsureRingBuffer(s)) {
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1);
+ }
+
+ /* State machine */
+ for (;;) {
+ switch (s->substate_uncompressed) {
+ case BROTLI_STATE_UNCOMPRESSED_NONE: {
+ int nbytes = (int)BrotliGetRemainingBytes(&s->br);
+ if (nbytes > s->meta_block_remaining_len) {
+ nbytes = s->meta_block_remaining_len;
+ }
+ if (s->pos + nbytes > s->ringbuffer_size) {
+ nbytes = s->ringbuffer_size - s->pos;
+ }
+ /* Copy remaining bytes from s->br.buf_ to ring-buffer. */
+ BrotliCopyBytes(&s->ringbuffer[s->pos], &s->br, (size_t)nbytes);
+ s->pos += nbytes;
+ s->meta_block_remaining_len -= nbytes;
+ if (s->pos < 1 << s->window_bits) {
+ if (s->meta_block_remaining_len == 0) {
+ return BROTLI_DECODER_SUCCESS;
+ }
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ s->substate_uncompressed = BROTLI_STATE_UNCOMPRESSED_WRITE;
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_UNCOMPRESSED_WRITE: {
+ BrotliDecoderErrorCode result;
+ result = WriteRingBuffer(
+ s, available_out, next_out, total_out, BROTLI_FALSE);
+ if (result != BROTLI_DECODER_SUCCESS) {
+ return result;
+ }
+ if (s->ringbuffer_size == 1 << s->window_bits) {
+ s->max_distance = s->max_backward_distance;
+ }
+ s->substate_uncompressed = BROTLI_STATE_UNCOMPRESSED_NONE;
+ break;
+ }
+ }
+ }
+ BROTLI_DCHECK(0); /* Unreachable */
+}
+
+/* Calculates the smallest feasible ring buffer.
+
+ If we know the data size is small, do not allocate more ring buffer
+ size than needed to reduce memory usage.
+
+ When this method is called, metablock size and flags MUST be decoded. */
+static void BROTLI_NOINLINE BrotliCalculateRingBufferSize(
+ BrotliDecoderState* s) {
+ int window_size = 1 << s->window_bits;
+ int new_ringbuffer_size = window_size;
+ /* We need at least 2 bytes of ring buffer size to get the last two
+ bytes for context from there */
+ int min_size = s->ringbuffer_size ? s->ringbuffer_size : 1024;
+ int output_size;
+
+ /* If maximum is already reached, no further extension is retired. */
+ if (s->ringbuffer_size == window_size) {
+ return;
+ }
+
+ /* Metadata blocks does not touch ring buffer. */
+ if (s->is_metadata) {
+ return;
+ }
+
+ if (!s->ringbuffer) {
+ output_size = 0;
+ } else {
+ output_size = s->pos;
+ }
+ output_size += s->meta_block_remaining_len;
+ min_size = min_size < output_size ? output_size : min_size;
+
+ if (!!s->canny_ringbuffer_allocation) {
+ /* Reduce ring buffer size to save memory when server is unscrupulous.
+ In worst case memory usage might be 1.5x bigger for a short period of
+ ring buffer reallocation. */
+ while ((new_ringbuffer_size >> 1) >= min_size) {
+ new_ringbuffer_size >>= 1;
+ }
+ }
+
+ s->new_ringbuffer_size = new_ringbuffer_size;
+}
+
+/* Reads 1..256 2-bit context modes. */
+static BrotliDecoderErrorCode ReadContextModes(BrotliDecoderState* s) {
+ BrotliBitReader* br = &s->br;
+ int i = s->loop_counter;
+
+ while (i < (int)s->num_block_types[0]) {
+ uint32_t bits;
+ if (!BrotliSafeReadBits(br, 2, &bits)) {
+ s->loop_counter = i;
+ return BROTLI_DECODER_NEEDS_MORE_INPUT;
+ }
+ s->context_modes[i] = (uint8_t)bits;
+ BROTLI_LOG_ARRAY_INDEX(s->context_modes, i);
+ i++;
+ }
+ return BROTLI_DECODER_SUCCESS;
+}
+
+static BROTLI_INLINE void TakeDistanceFromRingBuffer(BrotliDecoderState* s) {
+ int offset = s->distance_code - 3;
+ if (s->distance_code <= 3) {
+ /* Compensate double distance-ring-buffer roll for dictionary items. */
+ s->distance_context = 1 >> s->distance_code;
+ s->distance_code = s->dist_rb[(s->dist_rb_idx - offset) & 3];
+ s->dist_rb_idx -= s->distance_context;
+ } else {
+ int index_delta = 3;
+ int delta;
+ int base = s->distance_code - 10;
+ if (s->distance_code < 10) {
+ base = s->distance_code - 4;
+ } else {
+ index_delta = 2;
+ }
+ /* Unpack one of six 4-bit values. */
+ delta = ((0x605142 >> (4 * base)) & 0xF) - 3;
+ s->distance_code = s->dist_rb[(s->dist_rb_idx + index_delta) & 0x3] + delta;
+ if (s->distance_code <= 0) {
+ /* A huge distance will cause a BROTLI_FAILURE() soon.
+ This is a little faster than failing here. */
+ s->distance_code = 0x7FFFFFFF;
+ }
+ }
+}
+
+static BROTLI_INLINE BROTLI_BOOL SafeReadBits(
+ BrotliBitReader* const br, uint32_t n_bits, uint32_t* val) {
+ if (n_bits != 0) {
+ return BrotliSafeReadBits(br, n_bits, val);
+ } else {
+ *val = 0;
+ return BROTLI_TRUE;
+ }
+}
+
+static BROTLI_INLINE BROTLI_BOOL SafeReadBits32(
+ BrotliBitReader* const br, uint32_t n_bits, uint32_t* val) {
+ if (n_bits != 0) {
+ return BrotliSafeReadBits32(br, n_bits, val);
+ } else {
+ *val = 0;
+ return BROTLI_TRUE;
+ }
+}
+
+/*
+ RFC 7932 Section 4 with "..." shortenings and "[]" emendations.
+
+ Each distance ... is represented with a pair <distance code, extra bits>...
+ The distance code is encoded using a prefix code... The number of extra bits
+ can be 0..24... Two additional parameters: NPOSTFIX (0..3), and ...
+ NDIRECT (0..120) ... are encoded in the meta-block header...
+
+ The first 16 distance symbols ... reference past distances... ring buffer ...
+ Next NDIRECT distance symbols ... represent distances from 1 to NDIRECT...
+ [For] distance symbols 16 + NDIRECT and greater ... the number of extra bits
+ ... is given by the following formula:
+
+ [ xcode = dcode - NDIRECT - 16 ]
+ ndistbits = 1 + [ xcode ] >> (NPOSTFIX + 1)
+
+ ...
+*/
+
+/*
+ RFC 7932 Section 9.2 with "..." shortenings and "[]" emendations.
+
+ ... to get the actual value of the parameter NDIRECT, left-shift this
+ four-bit number by NPOSTFIX bits ...
+*/
+
+/* Remaining formulas from RFC 7932 Section 4 could be rewritten as following:
+
+ alphabet_size = 16 + NDIRECT + (max_distbits << (NPOSTFIX + 1))
+
+ half = ((xcode >> NPOSTFIX) & 1) << ndistbits
+ postfix = xcode & ((1 << NPOSTFIX) - 1)
+ range_start = 2 * (1 << ndistbits - 1 - 1)
+
+ distance = (range_start + half + extra) << NPOSTFIX + postfix + NDIRECT + 1
+
+ NB: ndistbits >= 1 -> range_start >= 0
+ NB: range_start has factor 2, as the range is covered by 2 "halves"
+ NB: extra -1 offset in range_start formula covers the absence of
+ ndistbits = 0 case
+ NB: when NPOSTFIX = 0, NDIRECT is not greater than 15
+
+ In other words, xcode has the following binary structure - XXXHPPP:
+ - XXX represent the number of extra distance bits
+ - H selects upper / lower range of distances
+ - PPP represent "postfix"
+
+ "Regular" distance encoding has NPOSTFIX = 0; omitting the postfix part
+ simplifies distance calculation.
+
+ Using NPOSTFIX > 0 allows cheaper encoding of regular structures, e.g. where
+ most of distances have the same reminder of division by 2/4/8. For example,
+ the table of int32_t values that come from different sources; if it is likely
+ that 3 highest bytes of values from the same source are the same, then
+ copy distance often looks like 4x + y.
+
+ Distance calculation could be rewritten to:
+
+ ndistbits = NDISTBITS(NDIRECT, NPOSTFIX)[dcode]
+ distance = OFFSET(NDIRECT, NPOSTFIX)[dcode] + extra << NPOSTFIX
+
+ NDISTBITS and OFFSET could be pre-calculated, as NDIRECT and NPOSTFIX could
+ change only once per meta-block.
+*/
+
+/* Calculates distance lookup table.
+ NB: it is possible to have all 64 tables precalculated. */
+static void CalculateDistanceLut(BrotliDecoderState* s) {
+ BrotliMetablockBodyArena* b = &s->arena.body;
+ uint32_t npostfix = s->distance_postfix_bits;
+ uint32_t ndirect = s->num_direct_distance_codes;
+ uint32_t alphabet_size_limit = s->distance_hgroup.alphabet_size_limit;
+ uint32_t postfix = 1u << npostfix;
+ uint32_t j;
+ uint32_t bits = 1;
+ uint32_t half = 0;
+
+ /* Skip short codes. */
+ uint32_t i = BROTLI_NUM_DISTANCE_SHORT_CODES;
+
+ /* Fill direct codes. */
+ for (j = 0; j < ndirect; ++j) {
+ b->dist_extra_bits[i] = 0;
+ b->dist_offset[i] = j + 1;
+ ++i;
+ }
+
+ /* Fill regular distance codes. */
+ while (i < alphabet_size_limit) {
+ uint32_t base = ndirect + ((((2 + half) << bits) - 4) << npostfix) + 1;
+ /* Always fill the complete group. */
+ for (j = 0; j < postfix; ++j) {
+ b->dist_extra_bits[i] = (uint8_t)bits;
+ b->dist_offset[i] = base + j;
+ ++i;
+ }
+ bits = bits + half;
+ half = half ^ 1;
+ }
+}
+
+/* Precondition: s->distance_code < 0. */
+static BROTLI_INLINE BROTLI_BOOL ReadDistanceInternal(
+ int safe, BrotliDecoderState* s, BrotliBitReader* br) {
+ BrotliMetablockBodyArena* b = &s->arena.body;
+ uint32_t code;
+ uint32_t bits;
+ BrotliBitReaderState memento;
+ HuffmanCode* distance_tree = s->distance_hgroup.htrees[s->dist_htree_index];
+ if (!safe) {
+ code = ReadSymbol(distance_tree, br);
+ } else {
+ BrotliBitReaderSaveState(br, &memento);
+ if (!SafeReadSymbol(distance_tree, br, &code)) {
+ return BROTLI_FALSE;
+ }
+ }
+ --s->block_length[2];
+ /* Convert the distance code to the actual distance by possibly
+ looking up past distances from the s->dist_rb. */
+ s->distance_context = 0;
+ if ((code & ~0xFu) == 0) {
+ s->distance_code = (int)code;
+ TakeDistanceFromRingBuffer(s);
+ return BROTLI_TRUE;
+ }
+ if (!safe) {
+ bits = BrotliReadBits32(br, b->dist_extra_bits[code]);
+ } else {
+ if (!SafeReadBits32(br, b->dist_extra_bits[code], &bits)) {
+ ++s->block_length[2];
+ BrotliBitReaderRestoreState(br, &memento);
+ return BROTLI_FALSE;
+ }
+ }
+ s->distance_code =
+ (int)(b->dist_offset[code] + (bits << s->distance_postfix_bits));
+ return BROTLI_TRUE;
+}
+
+static BROTLI_INLINE void ReadDistance(
+ BrotliDecoderState* s, BrotliBitReader* br) {
+ ReadDistanceInternal(0, s, br);
+}
+
+static BROTLI_INLINE BROTLI_BOOL SafeReadDistance(
+ BrotliDecoderState* s, BrotliBitReader* br) {
+ return ReadDistanceInternal(1, s, br);
+}
+
+static BROTLI_INLINE BROTLI_BOOL ReadCommandInternal(
+ int safe, BrotliDecoderState* s, BrotliBitReader* br, int* insert_length) {
+ uint32_t cmd_code;
+ uint32_t insert_len_extra = 0;
+ uint32_t copy_length;
+ CmdLutElement v;
+ BrotliBitReaderState memento;
+ if (!safe) {
+ cmd_code = ReadSymbol(s->htree_command, br);
+ } else {
+ BrotliBitReaderSaveState(br, &memento);
+ if (!SafeReadSymbol(s->htree_command, br, &cmd_code)) {
+ return BROTLI_FALSE;
+ }
+ }
+ v = kCmdLut[cmd_code];
+ s->distance_code = v.distance_code;
+ s->distance_context = v.context;
+ s->dist_htree_index = s->dist_context_map_slice[s->distance_context];
+ *insert_length = v.insert_len_offset;
+ if (!safe) {
+ if (BROTLI_PREDICT_FALSE(v.insert_len_extra_bits != 0)) {
+ insert_len_extra = BrotliReadBits24(br, v.insert_len_extra_bits);
+ }
+ copy_length = BrotliReadBits24(br, v.copy_len_extra_bits);
+ } else {
+ if (!SafeReadBits(br, v.insert_len_extra_bits, &insert_len_extra) ||
+ !SafeReadBits(br, v.copy_len_extra_bits, &copy_length)) {
+ BrotliBitReaderRestoreState(br, &memento);
+ return BROTLI_FALSE;
+ }
+ }
+ s->copy_length = (int)copy_length + v.copy_len_offset;
+ --s->block_length[1];
+ *insert_length += (int)insert_len_extra;
+ return BROTLI_TRUE;
+}
+
+static BROTLI_INLINE void ReadCommand(
+ BrotliDecoderState* s, BrotliBitReader* br, int* insert_length) {
+ ReadCommandInternal(0, s, br, insert_length);
+}
+
+static BROTLI_INLINE BROTLI_BOOL SafeReadCommand(
+ BrotliDecoderState* s, BrotliBitReader* br, int* insert_length) {
+ return ReadCommandInternal(1, s, br, insert_length);
+}
+
+static BROTLI_INLINE BROTLI_BOOL CheckInputAmount(
+ int safe, BrotliBitReader* const br, size_t num) {
+ if (safe) {
+ return BROTLI_TRUE;
+ }
+ return BrotliCheckInputAmount(br, num);
+}
+
+#define BROTLI_SAFE(METHOD) \
+ { \
+ if (safe) { \
+ if (!Safe##METHOD) { \
+ result = BROTLI_DECODER_NEEDS_MORE_INPUT; \
+ goto saveStateAndReturn; \
+ } \
+ } else { \
+ METHOD; \
+ } \
+ }
+
+static BROTLI_INLINE BrotliDecoderErrorCode ProcessCommandsInternal(
+ int safe, BrotliDecoderState* s) {
+ int pos = s->pos;
+ int i = s->loop_counter;
+ BrotliDecoderErrorCode result = BROTLI_DECODER_SUCCESS;
+ BrotliBitReader* br = &s->br;
+
+ if (!CheckInputAmount(safe, br, 28)) {
+ result = BROTLI_DECODER_NEEDS_MORE_INPUT;
+ goto saveStateAndReturn;
+ }
+ if (!safe) {
+ BROTLI_UNUSED(BrotliWarmupBitReader(br));
+ }
+
+ /* Jump into state machine. */
+ if (s->state == BROTLI_STATE_COMMAND_BEGIN) {
+ goto CommandBegin;
+ } else if (s->state == BROTLI_STATE_COMMAND_INNER) {
+ goto CommandInner;
+ } else if (s->state == BROTLI_STATE_COMMAND_POST_DECODE_LITERALS) {
+ goto CommandPostDecodeLiterals;
+ } else if (s->state == BROTLI_STATE_COMMAND_POST_WRAP_COPY) {
+ goto CommandPostWrapCopy;
+ } else {
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE);
+ }
+
+CommandBegin:
+ if (safe) {
+ s->state = BROTLI_STATE_COMMAND_BEGIN;
+ }
+ if (!CheckInputAmount(safe, br, 28)) { /* 156 bits + 7 bytes */
+ s->state = BROTLI_STATE_COMMAND_BEGIN;
+ result = BROTLI_DECODER_NEEDS_MORE_INPUT;
+ goto saveStateAndReturn;
+ }
+ if (BROTLI_PREDICT_FALSE(s->block_length[1] == 0)) {
+ BROTLI_SAFE(DecodeCommandBlockSwitch(s));
+ goto CommandBegin;
+ }
+ /* Read the insert/copy length in the command. */
+ BROTLI_SAFE(ReadCommand(s, br, &i));
+ BROTLI_LOG(("[ProcessCommandsInternal] pos = %d insert = %d copy = %d\n",
+ pos, i, s->copy_length));
+ if (i == 0) {
+ goto CommandPostDecodeLiterals;
+ }
+ s->meta_block_remaining_len -= i;
+
+CommandInner:
+ if (safe) {
+ s->state = BROTLI_STATE_COMMAND_INNER;
+ }
+ /* Read the literals in the command. */
+ if (s->trivial_literal_context) {
+ uint32_t bits;
+ uint32_t value;
+ PreloadSymbol(safe, s->literal_htree, br, &bits, &value);
+ do {
+ if (!CheckInputAmount(safe, br, 28)) { /* 162 bits + 7 bytes */
+ s->state = BROTLI_STATE_COMMAND_INNER;
+ result = BROTLI_DECODER_NEEDS_MORE_INPUT;
+ goto saveStateAndReturn;
+ }
+ if (BROTLI_PREDICT_FALSE(s->block_length[0] == 0)) {
+ BROTLI_SAFE(DecodeLiteralBlockSwitch(s));
+ PreloadSymbol(safe, s->literal_htree, br, &bits, &value);
+ if (!s->trivial_literal_context) goto CommandInner;
+ }
+ if (!safe) {
+ s->ringbuffer[pos] =
+ (uint8_t)ReadPreloadedSymbol(s->literal_htree, br, &bits, &value);
+ } else {
+ uint32_t literal;
+ if (!SafeReadSymbol(s->literal_htree, br, &literal)) {
+ result = BROTLI_DECODER_NEEDS_MORE_INPUT;
+ goto saveStateAndReturn;
+ }
+ s->ringbuffer[pos] = (uint8_t)literal;
+ }
+ --s->block_length[0];
+ BROTLI_LOG_ARRAY_INDEX(s->ringbuffer, pos);
+ ++pos;
+ if (BROTLI_PREDICT_FALSE(pos == s->ringbuffer_size)) {
+ s->state = BROTLI_STATE_COMMAND_INNER_WRITE;
+ --i;
+ goto saveStateAndReturn;
+ }
+ } while (--i != 0);
+ } else {
+ uint8_t p1 = s->ringbuffer[(pos - 1) & s->ringbuffer_mask];
+ uint8_t p2 = s->ringbuffer[(pos - 2) & s->ringbuffer_mask];
+ do {
+ const HuffmanCode* hc;
+ uint8_t context;
+ if (!CheckInputAmount(safe, br, 28)) { /* 162 bits + 7 bytes */
+ s->state = BROTLI_STATE_COMMAND_INNER;
+ result = BROTLI_DECODER_NEEDS_MORE_INPUT;
+ goto saveStateAndReturn;
+ }
+ if (BROTLI_PREDICT_FALSE(s->block_length[0] == 0)) {
+ BROTLI_SAFE(DecodeLiteralBlockSwitch(s));
+ if (s->trivial_literal_context) goto CommandInner;
+ }
+ context = BROTLI_CONTEXT(p1, p2, s->context_lookup);
+ BROTLI_LOG_UINT(context);
+ hc = s->literal_hgroup.htrees[s->context_map_slice[context]];
+ p2 = p1;
+ if (!safe) {
+ p1 = (uint8_t)ReadSymbol(hc, br);
+ } else {
+ uint32_t literal;
+ if (!SafeReadSymbol(hc, br, &literal)) {
+ result = BROTLI_DECODER_NEEDS_MORE_INPUT;
+ goto saveStateAndReturn;
+ }
+ p1 = (uint8_t)literal;
+ }
+ s->ringbuffer[pos] = p1;
+ --s->block_length[0];
+ BROTLI_LOG_UINT(s->context_map_slice[context]);
+ BROTLI_LOG_ARRAY_INDEX(s->ringbuffer, pos & s->ringbuffer_mask);
+ ++pos;
+ if (BROTLI_PREDICT_FALSE(pos == s->ringbuffer_size)) {
+ s->state = BROTLI_STATE_COMMAND_INNER_WRITE;
+ --i;
+ goto saveStateAndReturn;
+ }
+ } while (--i != 0);
+ }
+ BROTLI_LOG_UINT(s->meta_block_remaining_len);
+ if (BROTLI_PREDICT_FALSE(s->meta_block_remaining_len <= 0)) {
+ s->state = BROTLI_STATE_METABLOCK_DONE;
+ goto saveStateAndReturn;
+ }
+
+CommandPostDecodeLiterals:
+ if (safe) {
+ s->state = BROTLI_STATE_COMMAND_POST_DECODE_LITERALS;
+ }
+ if (s->distance_code >= 0) {
+ /* Implicit distance case. */
+ s->distance_context = s->distance_code ? 0 : 1;
+ --s->dist_rb_idx;
+ s->distance_code = s->dist_rb[s->dist_rb_idx & 3];
+ } else {
+ /* Read distance code in the command, unless it was implicitly zero. */
+ if (BROTLI_PREDICT_FALSE(s->block_length[2] == 0)) {
+ BROTLI_SAFE(DecodeDistanceBlockSwitch(s));
+ }
+ BROTLI_SAFE(ReadDistance(s, br));
+ }
+ BROTLI_LOG(("[ProcessCommandsInternal] pos = %d distance = %d\n",
+ pos, s->distance_code));
+ if (s->max_distance != s->max_backward_distance) {
+ s->max_distance =
+ (pos < s->max_backward_distance) ? pos : s->max_backward_distance;
+ }
+ i = s->copy_length;
+ /* Apply copy of LZ77 back-reference, or static dictionary reference if
+ the distance is larger than the max LZ77 distance */
+ if (s->distance_code > s->max_distance) {
+ /* The maximum allowed distance is BROTLI_MAX_ALLOWED_DISTANCE = 0x7FFFFFFC.
+ With this choice, no signed overflow can occur after decoding
+ a special distance code (e.g., after adding 3 to the last distance). */
+ if (s->distance_code > BROTLI_MAX_ALLOWED_DISTANCE) {
+ BROTLI_LOG(("Invalid backward reference. pos: %d distance: %d "
+ "len: %d bytes left: %d\n",
+ pos, s->distance_code, i, s->meta_block_remaining_len));
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_DISTANCE);
+ }
+ if (i >= BROTLI_MIN_DICTIONARY_WORD_LENGTH &&
+ i <= BROTLI_MAX_DICTIONARY_WORD_LENGTH) {
+ int address = s->distance_code - s->max_distance - 1;
+ const BrotliDictionary* words = s->dictionary;
+ const BrotliTransforms* transforms = s->transforms;
+ int offset = (int)s->dictionary->offsets_by_length[i];
+ uint32_t shift = s->dictionary->size_bits_by_length[i];
+
+ int mask = (int)BitMask(shift);
+ int word_idx = address & mask;
+ int transform_idx = address >> shift;
+ /* Compensate double distance-ring-buffer roll. */
+ s->dist_rb_idx += s->distance_context;
+ offset += word_idx * i;
+ if (BROTLI_PREDICT_FALSE(!words->data)) {
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET);
+ }
+ if (transform_idx < (int)transforms->num_transforms) {
+ const uint8_t* word = &words->data[offset];
+ int len = i;
+ if (transform_idx == transforms->cutOffTransforms[0]) {
+ memcpy(&s->ringbuffer[pos], word, (size_t)len);
+ BROTLI_LOG(("[ProcessCommandsInternal] dictionary word: [%.*s]\n",
+ len, word));
+ } else {
+ len = BrotliTransformDictionaryWord(&s->ringbuffer[pos], word, len,
+ transforms, transform_idx);
+ BROTLI_LOG(("[ProcessCommandsInternal] dictionary word: [%.*s],"
+ " transform_idx = %d, transformed: [%.*s]\n",
+ i, word, transform_idx, len, &s->ringbuffer[pos]));
+ }
+ pos += len;
+ s->meta_block_remaining_len -= len;
+ if (pos >= s->ringbuffer_size) {
+ s->state = BROTLI_STATE_COMMAND_POST_WRITE_1;
+ goto saveStateAndReturn;
+ }
+ } else {
+ BROTLI_LOG(("Invalid backward reference. pos: %d distance: %d "
+ "len: %d bytes left: %d\n",
+ pos, s->distance_code, i, s->meta_block_remaining_len));
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_TRANSFORM);
+ }
+ } else {
+ BROTLI_LOG(("Invalid backward reference. pos: %d distance: %d "
+ "len: %d bytes left: %d\n",
+ pos, s->distance_code, i, s->meta_block_remaining_len));
+ return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_DICTIONARY);
+ }
+ } else {
+ int src_start = (pos - s->distance_code) & s->ringbuffer_mask;
+ uint8_t* copy_dst = &s->ringbuffer[pos];
+ uint8_t* copy_src = &s->ringbuffer[src_start];
+ int dst_end = pos + i;
+ int src_end = src_start + i;
+ /* Update the recent distances cache. */
+ s->dist_rb[s->dist_rb_idx & 3] = s->distance_code;
+ ++s->dist_rb_idx;
+ s->meta_block_remaining_len -= i;
+ /* There are 32+ bytes of slack in the ring-buffer allocation.
+ Also, we have 16 short codes, that make these 16 bytes irrelevant
+ in the ring-buffer. Let's copy over them as a first guess. */
+ memmove16(copy_dst, copy_src);
+ if (src_end > pos && dst_end > src_start) {
+ /* Regions intersect. */
+ goto CommandPostWrapCopy;
+ }
+ if (dst_end >= s->ringbuffer_size || src_end >= s->ringbuffer_size) {
+ /* At least one region wraps. */
+ goto CommandPostWrapCopy;
+ }
+ pos += i;
+ if (i > 16) {
+ if (i > 32) {
+ memcpy(copy_dst + 16, copy_src + 16, (size_t)(i - 16));
+ } else {
+ /* This branch covers about 45% cases.
+ Fixed size short copy allows more compiler optimizations. */
+ memmove16(copy_dst + 16, copy_src + 16);
+ }
+ }
+ }
+ BROTLI_LOG_UINT(s->meta_block_remaining_len);
+ if (s->meta_block_remaining_len <= 0) {
+ /* Next metablock, if any. */
+ s->state = BROTLI_STATE_METABLOCK_DONE;
+ goto saveStateAndReturn;
+ } else {
+ goto CommandBegin;
+ }
+CommandPostWrapCopy:
+ {
+ int wrap_guard = s->ringbuffer_size - pos;
+ while (--i >= 0) {
+ s->ringbuffer[pos] =
+ s->ringbuffer[(pos - s->distance_code) & s->ringbuffer_mask];
+ ++pos;
+ if (BROTLI_PREDICT_FALSE(--wrap_guard == 0)) {
+ s->state = BROTLI_STATE_COMMAND_POST_WRITE_2;
+ goto saveStateAndReturn;
+ }
+ }
+ }
+ if (s->meta_block_remaining_len <= 0) {
+ /* Next metablock, if any. */
+ s->state = BROTLI_STATE_METABLOCK_DONE;
+ goto saveStateAndReturn;
+ } else {
+ goto CommandBegin;
+ }
+
+saveStateAndReturn:
+ s->pos = pos;
+ s->loop_counter = i;
+ return result;
+}
+
+#undef BROTLI_SAFE
+
+static BROTLI_NOINLINE BrotliDecoderErrorCode ProcessCommands(
+ BrotliDecoderState* s) {
+ return ProcessCommandsInternal(0, s);
+}
+
+static BROTLI_NOINLINE BrotliDecoderErrorCode SafeProcessCommands(
+ BrotliDecoderState* s) {
+ return ProcessCommandsInternal(1, s);
+}
+
+BrotliDecoderResult BrotliDecoderDecompress(
+ size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size,
+ uint8_t* decoded_buffer) {
+ BrotliDecoderState s;
+ BrotliDecoderResult result;
+ size_t total_out = 0;
+ size_t available_in = encoded_size;
+ const uint8_t* next_in = encoded_buffer;
+ size_t available_out = *decoded_size;
+ uint8_t* next_out = decoded_buffer;
+ if (!BrotliDecoderStateInit(&s, 0, 0, 0)) {
+ return BROTLI_DECODER_RESULT_ERROR;
+ }
+ result = BrotliDecoderDecompressStream(
+ &s, &available_in, &next_in, &available_out, &next_out, &total_out);
+ *decoded_size = total_out;
+ BrotliDecoderStateCleanup(&s);
+ if (result != BROTLI_DECODER_RESULT_SUCCESS) {
+ result = BROTLI_DECODER_RESULT_ERROR;
+ }
+ return result;
+}
+
+/* Invariant: input stream is never overconsumed:
+ - invalid input implies that the whole stream is invalid -> any amount of
+ input could be read and discarded
+ - when result is "needs more input", then at least one more byte is REQUIRED
+ to complete decoding; all input data MUST be consumed by decoder, so
+ client could swap the input buffer
+ - when result is "needs more output" decoder MUST ensure that it doesn't
+ hold more than 7 bits in bit reader; this saves client from swapping input
+ buffer ahead of time
+ - when result is "success" decoder MUST return all unused data back to input
+ buffer; this is possible because the invariant is held on enter */
+BrotliDecoderResult BrotliDecoderDecompressStream(
+ BrotliDecoderState* s, size_t* available_in, const uint8_t** next_in,
+ size_t* available_out, uint8_t** next_out, size_t* total_out) {
+ BrotliDecoderErrorCode result = BROTLI_DECODER_SUCCESS;
+ BrotliBitReader* br = &s->br;
+ /* Ensure that |total_out| is set, even if no data will ever be pushed out. */
+ if (total_out) {
+ *total_out = s->partial_pos_out;
+ }
+ /* Do not try to process further in a case of unrecoverable error. */
+ if ((int)s->error_code < 0) {
+ return BROTLI_DECODER_RESULT_ERROR;
+ }
+ if (*available_out && (!next_out || !*next_out)) {
+ return SaveErrorCode(
+ s, BROTLI_FAILURE(BROTLI_DECODER_ERROR_INVALID_ARGUMENTS));
+ }
+ if (!*available_out) next_out = 0;
+ if (s->buffer_length == 0) { /* Just connect bit reader to input stream. */
+ br->avail_in = *available_in;
+ br->next_in = *next_in;
+ } else {
+ /* At least one byte of input is required. More than one byte of input may
+ be required to complete the transaction -> reading more data must be
+ done in a loop -> do it in a main loop. */
+ result = BROTLI_DECODER_NEEDS_MORE_INPUT;
+ br->next_in = &s->buffer.u8[0];
+ }
+ /* State machine */
+ for (;;) {
+ if (result != BROTLI_DECODER_SUCCESS) {
+ /* Error, needs more input/output. */
+ if (result == BROTLI_DECODER_NEEDS_MORE_INPUT) {
+ if (s->ringbuffer != 0) { /* Pro-actively push output. */
+ BrotliDecoderErrorCode intermediate_result = WriteRingBuffer(s,
+ available_out, next_out, total_out, BROTLI_TRUE);
+ /* WriteRingBuffer checks s->meta_block_remaining_len validity. */
+ if ((int)intermediate_result < 0) {
+ result = intermediate_result;
+ break;
+ }
+ }
+ if (s->buffer_length != 0) { /* Used with internal buffer. */
+ if (br->avail_in == 0) {
+ /* Successfully finished read transaction.
+ Accumulator contains less than 8 bits, because internal buffer
+ is expanded byte-by-byte until it is enough to complete read. */
+ s->buffer_length = 0;
+ /* Switch to input stream and restart. */
+ result = BROTLI_DECODER_SUCCESS;
+ br->avail_in = *available_in;
+ br->next_in = *next_in;
+ continue;
+ } else if (*available_in != 0) {
+ /* Not enough data in buffer, but can take one more byte from
+ input stream. */
+ result = BROTLI_DECODER_SUCCESS;
+ s->buffer.u8[s->buffer_length] = **next_in;
+ s->buffer_length++;
+ br->avail_in = s->buffer_length;
+ (*next_in)++;
+ (*available_in)--;
+ /* Retry with more data in buffer. */
+ continue;
+ }
+ /* Can't finish reading and no more input. */
+ break;
+ } else { /* Input stream doesn't contain enough input. */
+ /* Copy tail to internal buffer and return. */
+ *next_in = br->next_in;
+ *available_in = br->avail_in;
+ while (*available_in) {
+ s->buffer.u8[s->buffer_length] = **next_in;
+ s->buffer_length++;
+ (*next_in)++;
+ (*available_in)--;
+ }
+ break;
+ }
+ /* Unreachable. */
+ }
+
+ /* Fail or needs more output. */
+
+ if (s->buffer_length != 0) {
+ /* Just consumed the buffered input and produced some output. Otherwise
+ it would result in "needs more input". Reset internal buffer. */
+ s->buffer_length = 0;
+ } else {
+ /* Using input stream in last iteration. When decoder switches to input
+ stream it has less than 8 bits in accumulator, so it is safe to
+ return unused accumulator bits there. */
+ BrotliBitReaderUnload(br);
+ *available_in = br->avail_in;
+ *next_in = br->next_in;
+ }
+ break;
+ }
+ switch (s->state) {
+ case BROTLI_STATE_UNINITED:
+ /* Prepare to the first read. */
+ if (!BrotliWarmupBitReader(br)) {
+ result = BROTLI_DECODER_NEEDS_MORE_INPUT;
+ break;
+ }
+ /* Decode window size. */
+ result = DecodeWindowBits(s, br); /* Reads 1..8 bits. */
+ if (result != BROTLI_DECODER_SUCCESS) {
+ break;
+ }
+ if (s->large_window) {
+ s->state = BROTLI_STATE_LARGE_WINDOW_BITS;
+ break;
+ }
+ s->state = BROTLI_STATE_INITIALIZE;
+ break;
+
+ case BROTLI_STATE_LARGE_WINDOW_BITS:
+ if (!BrotliSafeReadBits(br, 6, &s->window_bits)) {
+ result = BROTLI_DECODER_NEEDS_MORE_INPUT;
+ break;
+ }
+ if (s->window_bits < BROTLI_LARGE_MIN_WBITS ||
+ s->window_bits > BROTLI_LARGE_MAX_WBITS) {
+ result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS);
+ break;
+ }
+ s->state = BROTLI_STATE_INITIALIZE;
+ /* Fall through. */
+
+ case BROTLI_STATE_INITIALIZE:
+ BROTLI_LOG_UINT(s->window_bits);
+ /* Maximum distance, see section 9.1. of the spec. */
+ s->max_backward_distance = (1 << s->window_bits) - BROTLI_WINDOW_GAP;
+
+ /* Allocate memory for both block_type_trees and block_len_trees. */
+ s->block_type_trees = (HuffmanCode*)BROTLI_DECODER_ALLOC(s,
+ sizeof(HuffmanCode) * 3 *
+ (BROTLI_HUFFMAN_MAX_SIZE_258 + BROTLI_HUFFMAN_MAX_SIZE_26));
+ if (s->block_type_trees == 0) {
+ result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES);
+ break;
+ }
+ s->block_len_trees =
+ s->block_type_trees + 3 * BROTLI_HUFFMAN_MAX_SIZE_258;
+
+ s->state = BROTLI_STATE_METABLOCK_BEGIN;
+ /* Fall through. */
+
+ case BROTLI_STATE_METABLOCK_BEGIN:
+ BrotliDecoderStateMetablockBegin(s);
+ BROTLI_LOG_UINT(s->pos);
+ s->state = BROTLI_STATE_METABLOCK_HEADER;
+ /* Fall through. */
+
+ case BROTLI_STATE_METABLOCK_HEADER:
+ result = DecodeMetaBlockLength(s, br); /* Reads 2 - 31 bits. */
+ if (result != BROTLI_DECODER_SUCCESS) {
+ break;
+ }
+ BROTLI_LOG_UINT(s->is_last_metablock);
+ BROTLI_LOG_UINT(s->meta_block_remaining_len);
+ BROTLI_LOG_UINT(s->is_metadata);
+ BROTLI_LOG_UINT(s->is_uncompressed);
+ if (s->is_metadata || s->is_uncompressed) {
+ if (!BrotliJumpToByteBoundary(br)) {
+ result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_PADDING_1);
+ break;
+ }
+ }
+ if (s->is_metadata) {
+ s->state = BROTLI_STATE_METADATA;
+ break;
+ }
+ if (s->meta_block_remaining_len == 0) {
+ s->state = BROTLI_STATE_METABLOCK_DONE;
+ break;
+ }
+ BrotliCalculateRingBufferSize(s);
+ if (s->is_uncompressed) {
+ s->state = BROTLI_STATE_UNCOMPRESSED;
+ break;
+ }
+ s->state = BROTLI_STATE_BEFORE_COMPRESSED_METABLOCK_HEADER;
+ /* Fall through. */
+
+ case BROTLI_STATE_BEFORE_COMPRESSED_METABLOCK_HEADER: {
+ BrotliMetablockHeaderArena* h = &s->arena.header;
+ s->loop_counter = 0;
+ /* Initialize compressed metablock header arena. */
+ h->sub_loop_counter = 0;
+ /* Make small negative indexes addressable. */
+ h->symbol_lists =
+ &h->symbols_lists_array[BROTLI_HUFFMAN_MAX_CODE_LENGTH + 1];
+ h->substate_huffman = BROTLI_STATE_HUFFMAN_NONE;
+ h->substate_tree_group = BROTLI_STATE_TREE_GROUP_NONE;
+ h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_NONE;
+ s->state = BROTLI_STATE_HUFFMAN_CODE_0;
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_HUFFMAN_CODE_0:
+ if (s->loop_counter >= 3) {
+ s->state = BROTLI_STATE_METABLOCK_HEADER_2;
+ break;
+ }
+ /* Reads 1..11 bits. */
+ result = DecodeVarLenUint8(s, br, &s->num_block_types[s->loop_counter]);
+ if (result != BROTLI_DECODER_SUCCESS) {
+ break;
+ }
+ s->num_block_types[s->loop_counter]++;
+ BROTLI_LOG_UINT(s->num_block_types[s->loop_counter]);
+ if (s->num_block_types[s->loop_counter] < 2) {
+ s->loop_counter++;
+ break;
+ }
+ s->state = BROTLI_STATE_HUFFMAN_CODE_1;
+ /* Fall through. */
+
+ case BROTLI_STATE_HUFFMAN_CODE_1: {
+ uint32_t alphabet_size = s->num_block_types[s->loop_counter] + 2;
+ int tree_offset = s->loop_counter * BROTLI_HUFFMAN_MAX_SIZE_258;
+ result = ReadHuffmanCode(alphabet_size, alphabet_size,
+ &s->block_type_trees[tree_offset], NULL, s);
+ if (result != BROTLI_DECODER_SUCCESS) break;
+ s->state = BROTLI_STATE_HUFFMAN_CODE_2;
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_HUFFMAN_CODE_2: {
+ uint32_t alphabet_size = BROTLI_NUM_BLOCK_LEN_SYMBOLS;
+ int tree_offset = s->loop_counter * BROTLI_HUFFMAN_MAX_SIZE_26;
+ result = ReadHuffmanCode(alphabet_size, alphabet_size,
+ &s->block_len_trees[tree_offset], NULL, s);
+ if (result != BROTLI_DECODER_SUCCESS) break;
+ s->state = BROTLI_STATE_HUFFMAN_CODE_3;
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_HUFFMAN_CODE_3: {
+ int tree_offset = s->loop_counter * BROTLI_HUFFMAN_MAX_SIZE_26;
+ if (!SafeReadBlockLength(s, &s->block_length[s->loop_counter],
+ &s->block_len_trees[tree_offset], br)) {
+ result = BROTLI_DECODER_NEEDS_MORE_INPUT;
+ break;
+ }
+ BROTLI_LOG_UINT(s->block_length[s->loop_counter]);
+ s->loop_counter++;
+ s->state = BROTLI_STATE_HUFFMAN_CODE_0;
+ break;
+ }
+
+ case BROTLI_STATE_UNCOMPRESSED: {
+ result = CopyUncompressedBlockToOutput(
+ available_out, next_out, total_out, s);
+ if (result != BROTLI_DECODER_SUCCESS) {
+ break;
+ }
+ s->state = BROTLI_STATE_METABLOCK_DONE;
+ break;
+ }
+
+ case BROTLI_STATE_METADATA:
+ for (; s->meta_block_remaining_len > 0; --s->meta_block_remaining_len) {
+ uint32_t bits;
+ /* Read one byte and ignore it. */
+ if (!BrotliSafeReadBits(br, 8, &bits)) {
+ result = BROTLI_DECODER_NEEDS_MORE_INPUT;
+ break;
+ }
+ }
+ if (result == BROTLI_DECODER_SUCCESS) {
+ s->state = BROTLI_STATE_METABLOCK_DONE;
+ }
+ break;
+
+ case BROTLI_STATE_METABLOCK_HEADER_2: {
+ uint32_t bits;
+ if (!BrotliSafeReadBits(br, 6, &bits)) {
+ result = BROTLI_DECODER_NEEDS_MORE_INPUT;
+ break;
+ }
+ s->distance_postfix_bits = bits & BitMask(2);
+ bits >>= 2;
+ s->num_direct_distance_codes = bits << s->distance_postfix_bits;
+ BROTLI_LOG_UINT(s->num_direct_distance_codes);
+ BROTLI_LOG_UINT(s->distance_postfix_bits);
+ s->context_modes =
+ (uint8_t*)BROTLI_DECODER_ALLOC(s, (size_t)s->num_block_types[0]);
+ if (s->context_modes == 0) {
+ result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES);
+ break;
+ }
+ s->loop_counter = 0;
+ s->state = BROTLI_STATE_CONTEXT_MODES;
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_CONTEXT_MODES:
+ result = ReadContextModes(s);
+ if (result != BROTLI_DECODER_SUCCESS) {
+ break;
+ }
+ s->state = BROTLI_STATE_CONTEXT_MAP_1;
+ /* Fall through. */
+
+ case BROTLI_STATE_CONTEXT_MAP_1:
+ result = DecodeContextMap(
+ s->num_block_types[0] << BROTLI_LITERAL_CONTEXT_BITS,
+ &s->num_literal_htrees, &s->context_map, s);
+ if (result != BROTLI_DECODER_SUCCESS) {
+ break;
+ }
+ DetectTrivialLiteralBlockTypes(s);
+ s->state = BROTLI_STATE_CONTEXT_MAP_2;
+ /* Fall through. */
+
+ case BROTLI_STATE_CONTEXT_MAP_2: {
+ uint32_t npostfix = s->distance_postfix_bits;
+ uint32_t ndirect = s->num_direct_distance_codes;
+ uint32_t distance_alphabet_size_max = BROTLI_DISTANCE_ALPHABET_SIZE(
+ npostfix, ndirect, BROTLI_MAX_DISTANCE_BITS);
+ uint32_t distance_alphabet_size_limit = distance_alphabet_size_max;
+ BROTLI_BOOL allocation_success = BROTLI_TRUE;
+ if (s->large_window) {
+ BrotliDistanceCodeLimit limit = BrotliCalculateDistanceCodeLimit(
+ BROTLI_MAX_ALLOWED_DISTANCE, npostfix, ndirect);
+ distance_alphabet_size_max = BROTLI_DISTANCE_ALPHABET_SIZE(
+ npostfix, ndirect, BROTLI_LARGE_MAX_DISTANCE_BITS);
+ distance_alphabet_size_limit = limit.max_alphabet_size;
+ }
+ result = DecodeContextMap(
+ s->num_block_types[2] << BROTLI_DISTANCE_CONTEXT_BITS,
+ &s->num_dist_htrees, &s->dist_context_map, s);
+ if (result != BROTLI_DECODER_SUCCESS) {
+ break;
+ }
+ allocation_success &= BrotliDecoderHuffmanTreeGroupInit(
+ s, &s->literal_hgroup, BROTLI_NUM_LITERAL_SYMBOLS,
+ BROTLI_NUM_LITERAL_SYMBOLS, s->num_literal_htrees);
+ allocation_success &= BrotliDecoderHuffmanTreeGroupInit(
+ s, &s->insert_copy_hgroup, BROTLI_NUM_COMMAND_SYMBOLS,
+ BROTLI_NUM_COMMAND_SYMBOLS, s->num_block_types[1]);
+ allocation_success &= BrotliDecoderHuffmanTreeGroupInit(
+ s, &s->distance_hgroup, distance_alphabet_size_max,
+ distance_alphabet_size_limit, s->num_dist_htrees);
+ if (!allocation_success) {
+ return SaveErrorCode(s,
+ BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS));
+ }
+ s->loop_counter = 0;
+ s->state = BROTLI_STATE_TREE_GROUP;
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_TREE_GROUP: {
+ HuffmanTreeGroup* hgroup = NULL;
+ switch (s->loop_counter) {
+ case 0: hgroup = &s->literal_hgroup; break;
+ case 1: hgroup = &s->insert_copy_hgroup; break;
+ case 2: hgroup = &s->distance_hgroup; break;
+ default: return SaveErrorCode(s, BROTLI_FAILURE(
+ BROTLI_DECODER_ERROR_UNREACHABLE));
+ }
+ result = HuffmanTreeGroupDecode(hgroup, s);
+ if (result != BROTLI_DECODER_SUCCESS) break;
+ s->loop_counter++;
+ if (s->loop_counter < 3) {
+ break;
+ }
+ s->state = BROTLI_STATE_BEFORE_COMPRESSED_METABLOCK_BODY;
+ }
+ /* Fall through. */
+
+ case BROTLI_STATE_BEFORE_COMPRESSED_METABLOCK_BODY:
+ PrepareLiteralDecoding(s);
+ s->dist_context_map_slice = s->dist_context_map;
+ s->htree_command = s->insert_copy_hgroup.htrees[0];
+ if (!BrotliEnsureRingBuffer(s)) {
+ result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2);
+ break;
+ }
+ CalculateDistanceLut(s);
+ s->state = BROTLI_STATE_COMMAND_BEGIN;
+ /* Fall through. */
+
+ case BROTLI_STATE_COMMAND_BEGIN:
+ /* Fall through. */
+ case BROTLI_STATE_COMMAND_INNER:
+ /* Fall through. */
+ case BROTLI_STATE_COMMAND_POST_DECODE_LITERALS:
+ /* Fall through. */
+ case BROTLI_STATE_COMMAND_POST_WRAP_COPY:
+ result = ProcessCommands(s);
+ if (result == BROTLI_DECODER_NEEDS_MORE_INPUT) {
+ result = SafeProcessCommands(s);
+ }
+ break;
+
+ case BROTLI_STATE_COMMAND_INNER_WRITE:
+ /* Fall through. */
+ case BROTLI_STATE_COMMAND_POST_WRITE_1:
+ /* Fall through. */
+ case BROTLI_STATE_COMMAND_POST_WRITE_2:
+ result = WriteRingBuffer(
+ s, available_out, next_out, total_out, BROTLI_FALSE);
+ if (result != BROTLI_DECODER_SUCCESS) {
+ break;
+ }
+ WrapRingBuffer(s);
+ if (s->ringbuffer_size == 1 << s->window_bits) {
+ s->max_distance = s->max_backward_distance;
+ }
+ if (s->state == BROTLI_STATE_COMMAND_POST_WRITE_1) {
+ if (s->meta_block_remaining_len == 0) {
+ /* Next metablock, if any. */
+ s->state = BROTLI_STATE_METABLOCK_DONE;
+ } else {
+ s->state = BROTLI_STATE_COMMAND_BEGIN;
+ }
+ break;
+ } else if (s->state == BROTLI_STATE_COMMAND_POST_WRITE_2) {
+ s->state = BROTLI_STATE_COMMAND_POST_WRAP_COPY;
+ } else { /* BROTLI_STATE_COMMAND_INNER_WRITE */
+ if (s->loop_counter == 0) {
+ if (s->meta_block_remaining_len == 0) {
+ s->state = BROTLI_STATE_METABLOCK_DONE;
+ } else {
+ s->state = BROTLI_STATE_COMMAND_POST_DECODE_LITERALS;
+ }
+ break;
+ }
+ s->state = BROTLI_STATE_COMMAND_INNER;
+ }
+ break;
+
+ case BROTLI_STATE_METABLOCK_DONE:
+ if (s->meta_block_remaining_len < 0) {
+ result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2);
+ break;
+ }
+ BrotliDecoderStateCleanupAfterMetablock(s);
+ if (!s->is_last_metablock) {
+ s->state = BROTLI_STATE_METABLOCK_BEGIN;
+ break;
+ }
+ if (!BrotliJumpToByteBoundary(br)) {
+ result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_PADDING_2);
+ break;
+ }
+ if (s->buffer_length == 0) {
+ BrotliBitReaderUnload(br);
+ *available_in = br->avail_in;
+ *next_in = br->next_in;
+ }
+ s->state = BROTLI_STATE_DONE;
+ /* Fall through. */
+
+ case BROTLI_STATE_DONE:
+ if (s->ringbuffer != 0) {
+ result = WriteRingBuffer(
+ s, available_out, next_out, total_out, BROTLI_TRUE);
+ if (result != BROTLI_DECODER_SUCCESS) {
+ break;
+ }
+ }
+ return SaveErrorCode(s, result);
+ }
+ }
+ return SaveErrorCode(s, result);
+}
+
+BROTLI_BOOL BrotliDecoderHasMoreOutput(const BrotliDecoderState* s) {
+ /* After unrecoverable error remaining output is considered nonsensical. */
+ if ((int)s->error_code < 0) {
+ return BROTLI_FALSE;
+ }
+ return TO_BROTLI_BOOL(
+ s->ringbuffer != 0 && UnwrittenBytes(s, BROTLI_FALSE) != 0);
+}
+
+const uint8_t* BrotliDecoderTakeOutput(BrotliDecoderState* s, size_t* size) {
+ uint8_t* result = 0;
+ size_t available_out = *size ? *size : 1u << 24;
+ size_t requested_out = available_out;
+ BrotliDecoderErrorCode status;
+ if ((s->ringbuffer == 0) || ((int)s->error_code < 0)) {
+ *size = 0;
+ return 0;
+ }
+ WrapRingBuffer(s);
+ status = WriteRingBuffer(s, &available_out, &result, 0, BROTLI_TRUE);
+ /* Either WriteRingBuffer returns those "success" codes... */
+ if (status == BROTLI_DECODER_SUCCESS ||
+ status == BROTLI_DECODER_NEEDS_MORE_OUTPUT) {
+ *size = requested_out - available_out;
+ } else {
+ /* ... or stream is broken. Normally this should be caught by
+ BrotliDecoderDecompressStream, this is just a safeguard. */
+ if ((int)status < 0) SaveErrorCode(s, status);
+ *size = 0;
+ result = 0;
+ }
+ return result;
+}
+
+BROTLI_BOOL BrotliDecoderIsUsed(const BrotliDecoderState* s) {
+ return TO_BROTLI_BOOL(s->state != BROTLI_STATE_UNINITED ||
+ BrotliGetAvailableBits(&s->br) != 0);
+}
+
+BROTLI_BOOL BrotliDecoderIsFinished(const BrotliDecoderState* s) {
+ return TO_BROTLI_BOOL(s->state == BROTLI_STATE_DONE) &&
+ !BrotliDecoderHasMoreOutput(s);
+}
+
+BrotliDecoderErrorCode BrotliDecoderGetErrorCode(const BrotliDecoderState* s) {
+ return (BrotliDecoderErrorCode)s->error_code;
+}
+
+const char* BrotliDecoderErrorString(BrotliDecoderErrorCode c) {
+ switch (c) {
+#define BROTLI_ERROR_CODE_CASE_(PREFIX, NAME, CODE) \
+ case BROTLI_DECODER ## PREFIX ## NAME: return #NAME;
+#define BROTLI_NOTHING_
+ BROTLI_DECODER_ERROR_CODES_LIST(BROTLI_ERROR_CODE_CASE_, BROTLI_NOTHING_)
+#undef BROTLI_ERROR_CODE_CASE_
+#undef BROTLI_NOTHING_
+ default: return "INVALID";
+ }
+}
+
+uint32_t BrotliDecoderVersion() {
+ return BROTLI_VERSION;
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/huffman.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/huffman.c
new file mode 100644
index 000000000..30c40d33f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/huffman.c
@@ -0,0 +1,339 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Utilities for building Huffman decoding tables. */
+
+#include "./huffman.h"
+
+#include <string.h> /* memcpy, memset */
+
+#include "../common/constants.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#define BROTLI_REVERSE_BITS_MAX 8
+
+#if defined(BROTLI_RBIT)
+#define BROTLI_REVERSE_BITS_BASE \
+ ((sizeof(brotli_reg_t) << 3) - BROTLI_REVERSE_BITS_MAX)
+#else
+#define BROTLI_REVERSE_BITS_BASE 0
+static uint8_t kReverseBits[1 << BROTLI_REVERSE_BITS_MAX] = {
+ 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
+ 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
+ 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
+ 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
+ 0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4,
+ 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
+ 0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC,
+ 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
+ 0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2,
+ 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
+ 0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA,
+ 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
+ 0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6,
+ 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
+ 0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE,
+ 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE,
+ 0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1,
+ 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
+ 0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9,
+ 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9,
+ 0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5,
+ 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5,
+ 0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED,
+ 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
+ 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3,
+ 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3,
+ 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB,
+ 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
+ 0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7,
+ 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
+ 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF,
+ 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
+};
+#endif /* BROTLI_RBIT */
+
+#define BROTLI_REVERSE_BITS_LOWEST \
+ ((brotli_reg_t)1 << (BROTLI_REVERSE_BITS_MAX - 1 + BROTLI_REVERSE_BITS_BASE))
+
+/* Returns reverse(num >> BROTLI_REVERSE_BITS_BASE, BROTLI_REVERSE_BITS_MAX),
+ where reverse(value, len) is the bit-wise reversal of the len least
+ significant bits of value. */
+static BROTLI_INLINE brotli_reg_t BrotliReverseBits(brotli_reg_t num) {
+#if defined(BROTLI_RBIT)
+ return BROTLI_RBIT(num);
+#else
+ return kReverseBits[num];
+#endif
+}
+
+/* Stores code in table[0], table[step], table[2*step], ..., table[end] */
+/* Assumes that end is an integer multiple of step */
+static BROTLI_INLINE void ReplicateValue(HuffmanCode* table,
+ int step, int end,
+ HuffmanCode code) {
+ do {
+ end -= step;
+ table[end] = code;
+ } while (end > 0);
+}
+
+/* Returns the table width of the next 2nd level table. |count| is the histogram
+ of bit lengths for the remaining symbols, |len| is the code length of the
+ next processed symbol. */
+static BROTLI_INLINE int NextTableBitSize(const uint16_t* const count,
+ int len, int root_bits) {
+ int left = 1 << (len - root_bits);
+ while (len < BROTLI_HUFFMAN_MAX_CODE_LENGTH) {
+ left -= count[len];
+ if (left <= 0) break;
+ ++len;
+ left <<= 1;
+ }
+ return len - root_bits;
+}
+
+void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode* table,
+ const uint8_t* const code_lengths,
+ uint16_t* count) {
+ HuffmanCode code; /* current table entry */
+ int symbol; /* symbol index in original or sorted table */
+ brotli_reg_t key; /* prefix code */
+ brotli_reg_t key_step; /* prefix code addend */
+ int step; /* step size to replicate values in current table */
+ int table_size; /* size of current table */
+ int sorted[BROTLI_CODE_LENGTH_CODES]; /* symbols sorted by code length */
+ /* offsets in sorted table for each length */
+ int offset[BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH + 1];
+ int bits;
+ int bits_count;
+ BROTLI_DCHECK(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH <=
+ BROTLI_REVERSE_BITS_MAX);
+
+ /* Generate offsets into sorted symbol table by code length. */
+ symbol = -1;
+ bits = 1;
+ BROTLI_REPEAT(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH, {
+ symbol += count[bits];
+ offset[bits] = symbol;
+ bits++;
+ });
+ /* Symbols with code length 0 are placed after all other symbols. */
+ offset[0] = BROTLI_CODE_LENGTH_CODES - 1;
+
+ /* Sort symbols by length, by symbol order within each length. */
+ symbol = BROTLI_CODE_LENGTH_CODES;
+ do {
+ BROTLI_REPEAT(6, {
+ symbol--;
+ sorted[offset[code_lengths[symbol]]--] = symbol;
+ });
+ } while (symbol != 0);
+
+ table_size = 1 << BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH;
+
+ /* Special case: all symbols but one have 0 code length. */
+ if (offset[0] == 0) {
+ code = ConstructHuffmanCode(0, (uint16_t)sorted[0]);
+ for (key = 0; key < (brotli_reg_t)table_size; ++key) {
+ table[key] = code;
+ }
+ return;
+ }
+
+ /* Fill in table. */
+ key = 0;
+ key_step = BROTLI_REVERSE_BITS_LOWEST;
+ symbol = 0;
+ bits = 1;
+ step = 2;
+ do {
+ for (bits_count = count[bits]; bits_count != 0; --bits_count) {
+ code = ConstructHuffmanCode((uint8_t)bits, (uint16_t)sorted[symbol++]);
+ ReplicateValue(&table[BrotliReverseBits(key)], step, table_size, code);
+ key += key_step;
+ }
+ step <<= 1;
+ key_step >>= 1;
+ } while (++bits <= BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH);
+}
+
+uint32_t BrotliBuildHuffmanTable(HuffmanCode* root_table,
+ int root_bits,
+ const uint16_t* const symbol_lists,
+ uint16_t* count) {
+ HuffmanCode code; /* current table entry */
+ HuffmanCode* table; /* next available space in table */
+ int len; /* current code length */
+ int symbol; /* symbol index in original or sorted table */
+ brotli_reg_t key; /* prefix code */
+ brotli_reg_t key_step; /* prefix code addend */
+ brotli_reg_t sub_key; /* 2nd level table prefix code */
+ brotli_reg_t sub_key_step; /* 2nd level table prefix code addend */
+ int step; /* step size to replicate values in current table */
+ int table_bits; /* key length of current table */
+ int table_size; /* size of current table */
+ int total_size; /* sum of root table size and 2nd level table sizes */
+ int max_length = -1;
+ int bits;
+ int bits_count;
+
+ BROTLI_DCHECK(root_bits <= BROTLI_REVERSE_BITS_MAX);
+ BROTLI_DCHECK(BROTLI_HUFFMAN_MAX_CODE_LENGTH - root_bits <=
+ BROTLI_REVERSE_BITS_MAX);
+
+ while (symbol_lists[max_length] == 0xFFFF) max_length--;
+ max_length += BROTLI_HUFFMAN_MAX_CODE_LENGTH + 1;
+
+ table = root_table;
+ table_bits = root_bits;
+ table_size = 1 << table_bits;
+ total_size = table_size;
+
+ /* Fill in the root table. Reduce the table size to if possible,
+ and create the repetitions by memcpy. */
+ if (table_bits > max_length) {
+ table_bits = max_length;
+ table_size = 1 << table_bits;
+ }
+ key = 0;
+ key_step = BROTLI_REVERSE_BITS_LOWEST;
+ bits = 1;
+ step = 2;
+ do {
+ symbol = bits - (BROTLI_HUFFMAN_MAX_CODE_LENGTH + 1);
+ for (bits_count = count[bits]; bits_count != 0; --bits_count) {
+ symbol = symbol_lists[symbol];
+ code = ConstructHuffmanCode((uint8_t)bits, (uint16_t)symbol);
+ ReplicateValue(&table[BrotliReverseBits(key)], step, table_size, code);
+ key += key_step;
+ }
+ step <<= 1;
+ key_step >>= 1;
+ } while (++bits <= table_bits);
+
+ /* If root_bits != table_bits then replicate to fill the remaining slots. */
+ while (total_size != table_size) {
+ memcpy(&table[table_size], &table[0],
+ (size_t)table_size * sizeof(table[0]));
+ table_size <<= 1;
+ }
+
+ /* Fill in 2nd level tables and add pointers to root table. */
+ key_step = BROTLI_REVERSE_BITS_LOWEST >> (root_bits - 1);
+ sub_key = (BROTLI_REVERSE_BITS_LOWEST << 1);
+ sub_key_step = BROTLI_REVERSE_BITS_LOWEST;
+ for (len = root_bits + 1, step = 2; len <= max_length; ++len) {
+ symbol = len - (BROTLI_HUFFMAN_MAX_CODE_LENGTH + 1);
+ for (; count[len] != 0; --count[len]) {
+ if (sub_key == (BROTLI_REVERSE_BITS_LOWEST << 1U)) {
+ table += table_size;
+ table_bits = NextTableBitSize(count, len, root_bits);
+ table_size = 1 << table_bits;
+ total_size += table_size;
+ sub_key = BrotliReverseBits(key);
+ key += key_step;
+ root_table[sub_key] = ConstructHuffmanCode(
+ (uint8_t)(table_bits + root_bits),
+ (uint16_t)(((size_t)(table - root_table)) - sub_key));
+ sub_key = 0;
+ }
+ symbol = symbol_lists[symbol];
+ code = ConstructHuffmanCode((uint8_t)(len - root_bits), (uint16_t)symbol);
+ ReplicateValue(
+ &table[BrotliReverseBits(sub_key)], step, table_size, code);
+ sub_key += sub_key_step;
+ }
+ step <<= 1;
+ sub_key_step >>= 1;
+ }
+ return (uint32_t)total_size;
+}
+
+uint32_t BrotliBuildSimpleHuffmanTable(HuffmanCode* table,
+ int root_bits,
+ uint16_t* val,
+ uint32_t num_symbols) {
+ uint32_t table_size = 1;
+ const uint32_t goal_size = 1U << root_bits;
+ switch (num_symbols) {
+ case 0:
+ table[0] = ConstructHuffmanCode(0, val[0]);
+ break;
+ case 1:
+ if (val[1] > val[0]) {
+ table[0] = ConstructHuffmanCode(1, val[0]);
+ table[1] = ConstructHuffmanCode(1, val[1]);
+ } else {
+ table[0] = ConstructHuffmanCode(1, val[1]);
+ table[1] = ConstructHuffmanCode(1, val[0]);
+ }
+ table_size = 2;
+ break;
+ case 2:
+ table[0] = ConstructHuffmanCode(1, val[0]);
+ table[2] = ConstructHuffmanCode(1, val[0]);
+ if (val[2] > val[1]) {
+ table[1] = ConstructHuffmanCode(2, val[1]);
+ table[3] = ConstructHuffmanCode(2, val[2]);
+ } else {
+ table[1] = ConstructHuffmanCode(2, val[2]);
+ table[3] = ConstructHuffmanCode(2, val[1]);
+ }
+ table_size = 4;
+ break;
+ case 3: {
+ int i, k;
+ for (i = 0; i < 3; ++i) {
+ for (k = i + 1; k < 4; ++k) {
+ if (val[k] < val[i]) {
+ uint16_t t = val[k];
+ val[k] = val[i];
+ val[i] = t;
+ }
+ }
+ }
+ table[0] = ConstructHuffmanCode(2, val[0]);
+ table[2] = ConstructHuffmanCode(2, val[1]);
+ table[1] = ConstructHuffmanCode(2, val[2]);
+ table[3] = ConstructHuffmanCode(2, val[3]);
+ table_size = 4;
+ break;
+ }
+ case 4: {
+ if (val[3] < val[2]) {
+ uint16_t t = val[3];
+ val[3] = val[2];
+ val[2] = t;
+ }
+ table[0] = ConstructHuffmanCode(1, val[0]);
+ table[1] = ConstructHuffmanCode(2, val[1]);
+ table[2] = ConstructHuffmanCode(1, val[0]);
+ table[3] = ConstructHuffmanCode(3, val[2]);
+ table[4] = ConstructHuffmanCode(1, val[0]);
+ table[5] = ConstructHuffmanCode(2, val[1]);
+ table[6] = ConstructHuffmanCode(1, val[0]);
+ table[7] = ConstructHuffmanCode(3, val[3]);
+ table_size = 8;
+ break;
+ }
+ }
+ while (table_size != goal_size) {
+ memcpy(&table[table_size], &table[0],
+ (size_t)table_size * sizeof(table[0]));
+ table_size <<= 1;
+ }
+ return goal_size;
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/huffman.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/huffman.h
new file mode 100644
index 000000000..70e8469e3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/huffman.h
@@ -0,0 +1,128 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Utilities for building Huffman decoding tables. */
+
+#ifndef BROTLI_DEC_HUFFMAN_H_
+#define BROTLI_DEC_HUFFMAN_H_
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15
+
+/* Maximum possible Huffman table size for an alphabet size of (index * 32),
+ max code length 15 and root table bits 8. This table describes table sizes
+ for alphabets containing up to 1152 = 36 * 32 symbols. */
+static const uint16_t kMaxHuffmanTableSize[] = {
+ 256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822,
+ 854, 886, 920, 952, 984, 1016, 1048, 1080, 1112, 1144, 1176, 1208, 1240, 1272,
+ 1304, 1336, 1368, 1400, 1432, 1464, 1496, 1528};
+/* BROTLI_NUM_BLOCK_LEN_SYMBOLS == 26 */
+#define BROTLI_HUFFMAN_MAX_SIZE_26 396
+/* BROTLI_MAX_BLOCK_TYPE_SYMBOLS == 258 */
+#define BROTLI_HUFFMAN_MAX_SIZE_258 632
+/* BROTLI_MAX_CONTEXT_MAP_SYMBOLS == 272 */
+#define BROTLI_HUFFMAN_MAX_SIZE_272 646
+
+#define BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH 5
+
+#if ((defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_32)) && \
+ BROTLI_GNUC_HAS_ATTRIBUTE(aligned, 2, 7, 0))
+#define BROTLI_HUFFMAN_CODE_FAST_LOAD
+#endif
+
+#if !defined(BROTLI_HUFFMAN_CODE_FAST_LOAD)
+/* Do not create this struct directly - use the ConstructHuffmanCode
+ * constructor below! */
+typedef struct {
+ uint8_t bits; /* number of bits used for this symbol */
+ uint16_t value; /* symbol value or table offset */
+} HuffmanCode;
+
+static BROTLI_INLINE HuffmanCode ConstructHuffmanCode(const uint8_t bits,
+ const uint16_t value) {
+ HuffmanCode h;
+ h.bits = bits;
+ h.value = value;
+ return h;
+}
+
+/* Please use the following macros to optimize HuffmanCode accesses in hot
+ * paths.
+ *
+ * For example, assuming |table| contains a HuffmanCode pointer:
+ *
+ * BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(table);
+ * BROTLI_HC_ADJUST_TABLE_INDEX(table, index_into_table);
+ * *bits = BROTLI_HC_GET_BITS(table);
+ * *value = BROTLI_HC_GET_VALUE(table);
+ * BROTLI_HC_ADJUST_TABLE_INDEX(table, offset);
+ * *bits2 = BROTLI_HC_GET_BITS(table);
+ * *value2 = BROTLI_HC_GET_VALUE(table);
+ *
+ */
+
+#define BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(H)
+#define BROTLI_HC_ADJUST_TABLE_INDEX(H, V) H += (V)
+
+/* These must be given a HuffmanCode pointer! */
+#define BROTLI_HC_FAST_LOAD_BITS(H) (H->bits)
+#define BROTLI_HC_FAST_LOAD_VALUE(H) (H->value)
+
+#else /* BROTLI_HUFFMAN_CODE_FAST_LOAD */
+
+typedef BROTLI_ALIGNED(4) uint32_t HuffmanCode;
+
+static BROTLI_INLINE HuffmanCode ConstructHuffmanCode(const uint8_t bits,
+ const uint16_t value) {
+ return ((value & 0xFFFF) << 16) | (bits & 0xFF);
+}
+
+#define BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(H) uint32_t __fastload_##H = (*H)
+#define BROTLI_HC_ADJUST_TABLE_INDEX(H, V) H += (V); __fastload_##H = (*H)
+
+/* These must be given a HuffmanCode pointer! */
+#define BROTLI_HC_FAST_LOAD_BITS(H) ((__fastload_##H) & 0xFF)
+#define BROTLI_HC_FAST_LOAD_VALUE(H) ((__fastload_##H) >> 16)
+#endif /* BROTLI_HUFFMAN_CODE_FAST_LOAD */
+
+/* Builds Huffman lookup table assuming code lengths are in symbol order. */
+BROTLI_INTERNAL void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode* root_table,
+ const uint8_t* const code_lengths, uint16_t* count);
+
+/* Builds Huffman lookup table assuming code lengths are in symbol order.
+ Returns size of resulting table. */
+BROTLI_INTERNAL uint32_t BrotliBuildHuffmanTable(HuffmanCode* root_table,
+ int root_bits, const uint16_t* const symbol_lists, uint16_t* count_arg);
+
+/* Builds a simple Huffman table. The |num_symbols| parameter is to be
+ interpreted as follows: 0 means 1 symbol, 1 means 2 symbols,
+ 2 means 3 symbols, 3 means 4 symbols with lengths [2, 2, 2, 2],
+ 4 means 4 symbols with lengths [1, 2, 3, 3]. */
+BROTLI_INTERNAL uint32_t BrotliBuildSimpleHuffmanTable(HuffmanCode* table,
+ int root_bits, uint16_t* symbols, uint32_t num_symbols);
+
+/* Contains a collection of Huffman trees with the same alphabet size. */
+/* alphabet_size_limit is needed due to simple codes, since
+ log2(alphabet_size_max) could be greater than log2(alphabet_size_limit). */
+typedef struct {
+ HuffmanCode** htrees;
+ HuffmanCode* codes;
+ uint16_t alphabet_size_max;
+ uint16_t alphabet_size_limit;
+ uint16_t num_htrees;
+} HuffmanTreeGroup;
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_DEC_HUFFMAN_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/prefix.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/prefix.h
new file mode 100644
index 000000000..3ea062d84
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/prefix.h
@@ -0,0 +1,750 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Lookup tables to map prefix codes to value ranges. This is used during
+ decoding of the block lengths, literal insertion lengths and copy lengths. */
+
+#ifndef BROTLI_DEC_PREFIX_H_
+#define BROTLI_DEC_PREFIX_H_
+
+#include "../common/constants.h"
+#include <brotli/types.h>
+
+/* Represents the range of values belonging to a prefix code:
+ [offset, offset + 2^nbits) */
+struct PrefixCodeRange {
+ uint16_t offset;
+ uint8_t nbits;
+};
+
+static const struct PrefixCodeRange
+ kBlockLengthPrefixCode[BROTLI_NUM_BLOCK_LEN_SYMBOLS] = {
+ { 1, 2}, { 5, 2}, { 9, 2}, { 13, 2},
+ { 17, 3}, { 25, 3}, { 33, 3}, { 41, 3},
+ { 49, 4}, { 65, 4}, { 81, 4}, { 97, 4},
+ { 113, 5}, { 145, 5}, { 177, 5}, { 209, 5},
+ { 241, 6}, { 305, 6}, { 369, 7}, { 497, 8},
+ { 753, 9}, { 1265, 10}, {2289, 11}, {4337, 12},
+ {8433, 13}, {16625, 24}
+};
+
+typedef struct CmdLutElement {
+ uint8_t insert_len_extra_bits;
+ uint8_t copy_len_extra_bits;
+ int8_t distance_code;
+ uint8_t context;
+ uint16_t insert_len_offset;
+ uint16_t copy_len_offset;
+} CmdLutElement;
+
+static const CmdLutElement kCmdLut[BROTLI_NUM_COMMAND_SYMBOLS] = {
+ { 0x00, 0x00, 0, 0x00, 0x0000, 0x0002 },
+ { 0x00, 0x00, 0, 0x01, 0x0000, 0x0003 },
+ { 0x00, 0x00, 0, 0x02, 0x0000, 0x0004 },
+ { 0x00, 0x00, 0, 0x03, 0x0000, 0x0005 },
+ { 0x00, 0x00, 0, 0x03, 0x0000, 0x0006 },
+ { 0x00, 0x00, 0, 0x03, 0x0000, 0x0007 },
+ { 0x00, 0x00, 0, 0x03, 0x0000, 0x0008 },
+ { 0x00, 0x00, 0, 0x03, 0x0000, 0x0009 },
+ { 0x00, 0x00, 0, 0x00, 0x0001, 0x0002 },
+ { 0x00, 0x00, 0, 0x01, 0x0001, 0x0003 },
+ { 0x00, 0x00, 0, 0x02, 0x0001, 0x0004 },
+ { 0x00, 0x00, 0, 0x03, 0x0001, 0x0005 },
+ { 0x00, 0x00, 0, 0x03, 0x0001, 0x0006 },
+ { 0x00, 0x00, 0, 0x03, 0x0001, 0x0007 },
+ { 0x00, 0x00, 0, 0x03, 0x0001, 0x0008 },
+ { 0x00, 0x00, 0, 0x03, 0x0001, 0x0009 },
+ { 0x00, 0x00, 0, 0x00, 0x0002, 0x0002 },
+ { 0x00, 0x00, 0, 0x01, 0x0002, 0x0003 },
+ { 0x00, 0x00, 0, 0x02, 0x0002, 0x0004 },
+ { 0x00, 0x00, 0, 0x03, 0x0002, 0x0005 },
+ { 0x00, 0x00, 0, 0x03, 0x0002, 0x0006 },
+ { 0x00, 0x00, 0, 0x03, 0x0002, 0x0007 },
+ { 0x00, 0x00, 0, 0x03, 0x0002, 0x0008 },
+ { 0x00, 0x00, 0, 0x03, 0x0002, 0x0009 },
+ { 0x00, 0x00, 0, 0x00, 0x0003, 0x0002 },
+ { 0x00, 0x00, 0, 0x01, 0x0003, 0x0003 },
+ { 0x00, 0x00, 0, 0x02, 0x0003, 0x0004 },
+ { 0x00, 0x00, 0, 0x03, 0x0003, 0x0005 },
+ { 0x00, 0x00, 0, 0x03, 0x0003, 0x0006 },
+ { 0x00, 0x00, 0, 0x03, 0x0003, 0x0007 },
+ { 0x00, 0x00, 0, 0x03, 0x0003, 0x0008 },
+ { 0x00, 0x00, 0, 0x03, 0x0003, 0x0009 },
+ { 0x00, 0x00, 0, 0x00, 0x0004, 0x0002 },
+ { 0x00, 0x00, 0, 0x01, 0x0004, 0x0003 },
+ { 0x00, 0x00, 0, 0x02, 0x0004, 0x0004 },
+ { 0x00, 0x00, 0, 0x03, 0x0004, 0x0005 },
+ { 0x00, 0x00, 0, 0x03, 0x0004, 0x0006 },
+ { 0x00, 0x00, 0, 0x03, 0x0004, 0x0007 },
+ { 0x00, 0x00, 0, 0x03, 0x0004, 0x0008 },
+ { 0x00, 0x00, 0, 0x03, 0x0004, 0x0009 },
+ { 0x00, 0x00, 0, 0x00, 0x0005, 0x0002 },
+ { 0x00, 0x00, 0, 0x01, 0x0005, 0x0003 },
+ { 0x00, 0x00, 0, 0x02, 0x0005, 0x0004 },
+ { 0x00, 0x00, 0, 0x03, 0x0005, 0x0005 },
+ { 0x00, 0x00, 0, 0x03, 0x0005, 0x0006 },
+ { 0x00, 0x00, 0, 0x03, 0x0005, 0x0007 },
+ { 0x00, 0x00, 0, 0x03, 0x0005, 0x0008 },
+ { 0x00, 0x00, 0, 0x03, 0x0005, 0x0009 },
+ { 0x01, 0x00, 0, 0x00, 0x0006, 0x0002 },
+ { 0x01, 0x00, 0, 0x01, 0x0006, 0x0003 },
+ { 0x01, 0x00, 0, 0x02, 0x0006, 0x0004 },
+ { 0x01, 0x00, 0, 0x03, 0x0006, 0x0005 },
+ { 0x01, 0x00, 0, 0x03, 0x0006, 0x0006 },
+ { 0x01, 0x00, 0, 0x03, 0x0006, 0x0007 },
+ { 0x01, 0x00, 0, 0x03, 0x0006, 0x0008 },
+ { 0x01, 0x00, 0, 0x03, 0x0006, 0x0009 },
+ { 0x01, 0x00, 0, 0x00, 0x0008, 0x0002 },
+ { 0x01, 0x00, 0, 0x01, 0x0008, 0x0003 },
+ { 0x01, 0x00, 0, 0x02, 0x0008, 0x0004 },
+ { 0x01, 0x00, 0, 0x03, 0x0008, 0x0005 },
+ { 0x01, 0x00, 0, 0x03, 0x0008, 0x0006 },
+ { 0x01, 0x00, 0, 0x03, 0x0008, 0x0007 },
+ { 0x01, 0x00, 0, 0x03, 0x0008, 0x0008 },
+ { 0x01, 0x00, 0, 0x03, 0x0008, 0x0009 },
+ { 0x00, 0x01, 0, 0x03, 0x0000, 0x000a },
+ { 0x00, 0x01, 0, 0x03, 0x0000, 0x000c },
+ { 0x00, 0x02, 0, 0x03, 0x0000, 0x000e },
+ { 0x00, 0x02, 0, 0x03, 0x0000, 0x0012 },
+ { 0x00, 0x03, 0, 0x03, 0x0000, 0x0016 },
+ { 0x00, 0x03, 0, 0x03, 0x0000, 0x001e },
+ { 0x00, 0x04, 0, 0x03, 0x0000, 0x0026 },
+ { 0x00, 0x04, 0, 0x03, 0x0000, 0x0036 },
+ { 0x00, 0x01, 0, 0x03, 0x0001, 0x000a },
+ { 0x00, 0x01, 0, 0x03, 0x0001, 0x000c },
+ { 0x00, 0x02, 0, 0x03, 0x0001, 0x000e },
+ { 0x00, 0x02, 0, 0x03, 0x0001, 0x0012 },
+ { 0x00, 0x03, 0, 0x03, 0x0001, 0x0016 },
+ { 0x00, 0x03, 0, 0x03, 0x0001, 0x001e },
+ { 0x00, 0x04, 0, 0x03, 0x0001, 0x0026 },
+ { 0x00, 0x04, 0, 0x03, 0x0001, 0x0036 },
+ { 0x00, 0x01, 0, 0x03, 0x0002, 0x000a },
+ { 0x00, 0x01, 0, 0x03, 0x0002, 0x000c },
+ { 0x00, 0x02, 0, 0x03, 0x0002, 0x000e },
+ { 0x00, 0x02, 0, 0x03, 0x0002, 0x0012 },
+ { 0x00, 0x03, 0, 0x03, 0x0002, 0x0016 },
+ { 0x00, 0x03, 0, 0x03, 0x0002, 0x001e },
+ { 0x00, 0x04, 0, 0x03, 0x0002, 0x0026 },
+ { 0x00, 0x04, 0, 0x03, 0x0002, 0x0036 },
+ { 0x00, 0x01, 0, 0x03, 0x0003, 0x000a },
+ { 0x00, 0x01, 0, 0x03, 0x0003, 0x000c },
+ { 0x00, 0x02, 0, 0x03, 0x0003, 0x000e },
+ { 0x00, 0x02, 0, 0x03, 0x0003, 0x0012 },
+ { 0x00, 0x03, 0, 0x03, 0x0003, 0x0016 },
+ { 0x00, 0x03, 0, 0x03, 0x0003, 0x001e },
+ { 0x00, 0x04, 0, 0x03, 0x0003, 0x0026 },
+ { 0x00, 0x04, 0, 0x03, 0x0003, 0x0036 },
+ { 0x00, 0x01, 0, 0x03, 0x0004, 0x000a },
+ { 0x00, 0x01, 0, 0x03, 0x0004, 0x000c },
+ { 0x00, 0x02, 0, 0x03, 0x0004, 0x000e },
+ { 0x00, 0x02, 0, 0x03, 0x0004, 0x0012 },
+ { 0x00, 0x03, 0, 0x03, 0x0004, 0x0016 },
+ { 0x00, 0x03, 0, 0x03, 0x0004, 0x001e },
+ { 0x00, 0x04, 0, 0x03, 0x0004, 0x0026 },
+ { 0x00, 0x04, 0, 0x03, 0x0004, 0x0036 },
+ { 0x00, 0x01, 0, 0x03, 0x0005, 0x000a },
+ { 0x00, 0x01, 0, 0x03, 0x0005, 0x000c },
+ { 0x00, 0x02, 0, 0x03, 0x0005, 0x000e },
+ { 0x00, 0x02, 0, 0x03, 0x0005, 0x0012 },
+ { 0x00, 0x03, 0, 0x03, 0x0005, 0x0016 },
+ { 0x00, 0x03, 0, 0x03, 0x0005, 0x001e },
+ { 0x00, 0x04, 0, 0x03, 0x0005, 0x0026 },
+ { 0x00, 0x04, 0, 0x03, 0x0005, 0x0036 },
+ { 0x01, 0x01, 0, 0x03, 0x0006, 0x000a },
+ { 0x01, 0x01, 0, 0x03, 0x0006, 0x000c },
+ { 0x01, 0x02, 0, 0x03, 0x0006, 0x000e },
+ { 0x01, 0x02, 0, 0x03, 0x0006, 0x0012 },
+ { 0x01, 0x03, 0, 0x03, 0x0006, 0x0016 },
+ { 0x01, 0x03, 0, 0x03, 0x0006, 0x001e },
+ { 0x01, 0x04, 0, 0x03, 0x0006, 0x0026 },
+ { 0x01, 0x04, 0, 0x03, 0x0006, 0x0036 },
+ { 0x01, 0x01, 0, 0x03, 0x0008, 0x000a },
+ { 0x01, 0x01, 0, 0x03, 0x0008, 0x000c },
+ { 0x01, 0x02, 0, 0x03, 0x0008, 0x000e },
+ { 0x01, 0x02, 0, 0x03, 0x0008, 0x0012 },
+ { 0x01, 0x03, 0, 0x03, 0x0008, 0x0016 },
+ { 0x01, 0x03, 0, 0x03, 0x0008, 0x001e },
+ { 0x01, 0x04, 0, 0x03, 0x0008, 0x0026 },
+ { 0x01, 0x04, 0, 0x03, 0x0008, 0x0036 },
+ { 0x00, 0x00, -1, 0x00, 0x0000, 0x0002 },
+ { 0x00, 0x00, -1, 0x01, 0x0000, 0x0003 },
+ { 0x00, 0x00, -1, 0x02, 0x0000, 0x0004 },
+ { 0x00, 0x00, -1, 0x03, 0x0000, 0x0005 },
+ { 0x00, 0x00, -1, 0x03, 0x0000, 0x0006 },
+ { 0x00, 0x00, -1, 0x03, 0x0000, 0x0007 },
+ { 0x00, 0x00, -1, 0x03, 0x0000, 0x0008 },
+ { 0x00, 0x00, -1, 0x03, 0x0000, 0x0009 },
+ { 0x00, 0x00, -1, 0x00, 0x0001, 0x0002 },
+ { 0x00, 0x00, -1, 0x01, 0x0001, 0x0003 },
+ { 0x00, 0x00, -1, 0x02, 0x0001, 0x0004 },
+ { 0x00, 0x00, -1, 0x03, 0x0001, 0x0005 },
+ { 0x00, 0x00, -1, 0x03, 0x0001, 0x0006 },
+ { 0x00, 0x00, -1, 0x03, 0x0001, 0x0007 },
+ { 0x00, 0x00, -1, 0x03, 0x0001, 0x0008 },
+ { 0x00, 0x00, -1, 0x03, 0x0001, 0x0009 },
+ { 0x00, 0x00, -1, 0x00, 0x0002, 0x0002 },
+ { 0x00, 0x00, -1, 0x01, 0x0002, 0x0003 },
+ { 0x00, 0x00, -1, 0x02, 0x0002, 0x0004 },
+ { 0x00, 0x00, -1, 0x03, 0x0002, 0x0005 },
+ { 0x00, 0x00, -1, 0x03, 0x0002, 0x0006 },
+ { 0x00, 0x00, -1, 0x03, 0x0002, 0x0007 },
+ { 0x00, 0x00, -1, 0x03, 0x0002, 0x0008 },
+ { 0x00, 0x00, -1, 0x03, 0x0002, 0x0009 },
+ { 0x00, 0x00, -1, 0x00, 0x0003, 0x0002 },
+ { 0x00, 0x00, -1, 0x01, 0x0003, 0x0003 },
+ { 0x00, 0x00, -1, 0x02, 0x0003, 0x0004 },
+ { 0x00, 0x00, -1, 0x03, 0x0003, 0x0005 },
+ { 0x00, 0x00, -1, 0x03, 0x0003, 0x0006 },
+ { 0x00, 0x00, -1, 0x03, 0x0003, 0x0007 },
+ { 0x00, 0x00, -1, 0x03, 0x0003, 0x0008 },
+ { 0x00, 0x00, -1, 0x03, 0x0003, 0x0009 },
+ { 0x00, 0x00, -1, 0x00, 0x0004, 0x0002 },
+ { 0x00, 0x00, -1, 0x01, 0x0004, 0x0003 },
+ { 0x00, 0x00, -1, 0x02, 0x0004, 0x0004 },
+ { 0x00, 0x00, -1, 0x03, 0x0004, 0x0005 },
+ { 0x00, 0x00, -1, 0x03, 0x0004, 0x0006 },
+ { 0x00, 0x00, -1, 0x03, 0x0004, 0x0007 },
+ { 0x00, 0x00, -1, 0x03, 0x0004, 0x0008 },
+ { 0x00, 0x00, -1, 0x03, 0x0004, 0x0009 },
+ { 0x00, 0x00, -1, 0x00, 0x0005, 0x0002 },
+ { 0x00, 0x00, -1, 0x01, 0x0005, 0x0003 },
+ { 0x00, 0x00, -1, 0x02, 0x0005, 0x0004 },
+ { 0x00, 0x00, -1, 0x03, 0x0005, 0x0005 },
+ { 0x00, 0x00, -1, 0x03, 0x0005, 0x0006 },
+ { 0x00, 0x00, -1, 0x03, 0x0005, 0x0007 },
+ { 0x00, 0x00, -1, 0x03, 0x0005, 0x0008 },
+ { 0x00, 0x00, -1, 0x03, 0x0005, 0x0009 },
+ { 0x01, 0x00, -1, 0x00, 0x0006, 0x0002 },
+ { 0x01, 0x00, -1, 0x01, 0x0006, 0x0003 },
+ { 0x01, 0x00, -1, 0x02, 0x0006, 0x0004 },
+ { 0x01, 0x00, -1, 0x03, 0x0006, 0x0005 },
+ { 0x01, 0x00, -1, 0x03, 0x0006, 0x0006 },
+ { 0x01, 0x00, -1, 0x03, 0x0006, 0x0007 },
+ { 0x01, 0x00, -1, 0x03, 0x0006, 0x0008 },
+ { 0x01, 0x00, -1, 0x03, 0x0006, 0x0009 },
+ { 0x01, 0x00, -1, 0x00, 0x0008, 0x0002 },
+ { 0x01, 0x00, -1, 0x01, 0x0008, 0x0003 },
+ { 0x01, 0x00, -1, 0x02, 0x0008, 0x0004 },
+ { 0x01, 0x00, -1, 0x03, 0x0008, 0x0005 },
+ { 0x01, 0x00, -1, 0x03, 0x0008, 0x0006 },
+ { 0x01, 0x00, -1, 0x03, 0x0008, 0x0007 },
+ { 0x01, 0x00, -1, 0x03, 0x0008, 0x0008 },
+ { 0x01, 0x00, -1, 0x03, 0x0008, 0x0009 },
+ { 0x00, 0x01, -1, 0x03, 0x0000, 0x000a },
+ { 0x00, 0x01, -1, 0x03, 0x0000, 0x000c },
+ { 0x00, 0x02, -1, 0x03, 0x0000, 0x000e },
+ { 0x00, 0x02, -1, 0x03, 0x0000, 0x0012 },
+ { 0x00, 0x03, -1, 0x03, 0x0000, 0x0016 },
+ { 0x00, 0x03, -1, 0x03, 0x0000, 0x001e },
+ { 0x00, 0x04, -1, 0x03, 0x0000, 0x0026 },
+ { 0x00, 0x04, -1, 0x03, 0x0000, 0x0036 },
+ { 0x00, 0x01, -1, 0x03, 0x0001, 0x000a },
+ { 0x00, 0x01, -1, 0x03, 0x0001, 0x000c },
+ { 0x00, 0x02, -1, 0x03, 0x0001, 0x000e },
+ { 0x00, 0x02, -1, 0x03, 0x0001, 0x0012 },
+ { 0x00, 0x03, -1, 0x03, 0x0001, 0x0016 },
+ { 0x00, 0x03, -1, 0x03, 0x0001, 0x001e },
+ { 0x00, 0x04, -1, 0x03, 0x0001, 0x0026 },
+ { 0x00, 0x04, -1, 0x03, 0x0001, 0x0036 },
+ { 0x00, 0x01, -1, 0x03, 0x0002, 0x000a },
+ { 0x00, 0x01, -1, 0x03, 0x0002, 0x000c },
+ { 0x00, 0x02, -1, 0x03, 0x0002, 0x000e },
+ { 0x00, 0x02, -1, 0x03, 0x0002, 0x0012 },
+ { 0x00, 0x03, -1, 0x03, 0x0002, 0x0016 },
+ { 0x00, 0x03, -1, 0x03, 0x0002, 0x001e },
+ { 0x00, 0x04, -1, 0x03, 0x0002, 0x0026 },
+ { 0x00, 0x04, -1, 0x03, 0x0002, 0x0036 },
+ { 0x00, 0x01, -1, 0x03, 0x0003, 0x000a },
+ { 0x00, 0x01, -1, 0x03, 0x0003, 0x000c },
+ { 0x00, 0x02, -1, 0x03, 0x0003, 0x000e },
+ { 0x00, 0x02, -1, 0x03, 0x0003, 0x0012 },
+ { 0x00, 0x03, -1, 0x03, 0x0003, 0x0016 },
+ { 0x00, 0x03, -1, 0x03, 0x0003, 0x001e },
+ { 0x00, 0x04, -1, 0x03, 0x0003, 0x0026 },
+ { 0x00, 0x04, -1, 0x03, 0x0003, 0x0036 },
+ { 0x00, 0x01, -1, 0x03, 0x0004, 0x000a },
+ { 0x00, 0x01, -1, 0x03, 0x0004, 0x000c },
+ { 0x00, 0x02, -1, 0x03, 0x0004, 0x000e },
+ { 0x00, 0x02, -1, 0x03, 0x0004, 0x0012 },
+ { 0x00, 0x03, -1, 0x03, 0x0004, 0x0016 },
+ { 0x00, 0x03, -1, 0x03, 0x0004, 0x001e },
+ { 0x00, 0x04, -1, 0x03, 0x0004, 0x0026 },
+ { 0x00, 0x04, -1, 0x03, 0x0004, 0x0036 },
+ { 0x00, 0x01, -1, 0x03, 0x0005, 0x000a },
+ { 0x00, 0x01, -1, 0x03, 0x0005, 0x000c },
+ { 0x00, 0x02, -1, 0x03, 0x0005, 0x000e },
+ { 0x00, 0x02, -1, 0x03, 0x0005, 0x0012 },
+ { 0x00, 0x03, -1, 0x03, 0x0005, 0x0016 },
+ { 0x00, 0x03, -1, 0x03, 0x0005, 0x001e },
+ { 0x00, 0x04, -1, 0x03, 0x0005, 0x0026 },
+ { 0x00, 0x04, -1, 0x03, 0x0005, 0x0036 },
+ { 0x01, 0x01, -1, 0x03, 0x0006, 0x000a },
+ { 0x01, 0x01, -1, 0x03, 0x0006, 0x000c },
+ { 0x01, 0x02, -1, 0x03, 0x0006, 0x000e },
+ { 0x01, 0x02, -1, 0x03, 0x0006, 0x0012 },
+ { 0x01, 0x03, -1, 0x03, 0x0006, 0x0016 },
+ { 0x01, 0x03, -1, 0x03, 0x0006, 0x001e },
+ { 0x01, 0x04, -1, 0x03, 0x0006, 0x0026 },
+ { 0x01, 0x04, -1, 0x03, 0x0006, 0x0036 },
+ { 0x01, 0x01, -1, 0x03, 0x0008, 0x000a },
+ { 0x01, 0x01, -1, 0x03, 0x0008, 0x000c },
+ { 0x01, 0x02, -1, 0x03, 0x0008, 0x000e },
+ { 0x01, 0x02, -1, 0x03, 0x0008, 0x0012 },
+ { 0x01, 0x03, -1, 0x03, 0x0008, 0x0016 },
+ { 0x01, 0x03, -1, 0x03, 0x0008, 0x001e },
+ { 0x01, 0x04, -1, 0x03, 0x0008, 0x0026 },
+ { 0x01, 0x04, -1, 0x03, 0x0008, 0x0036 },
+ { 0x02, 0x00, -1, 0x00, 0x000a, 0x0002 },
+ { 0x02, 0x00, -1, 0x01, 0x000a, 0x0003 },
+ { 0x02, 0x00, -1, 0x02, 0x000a, 0x0004 },
+ { 0x02, 0x00, -1, 0x03, 0x000a, 0x0005 },
+ { 0x02, 0x00, -1, 0x03, 0x000a, 0x0006 },
+ { 0x02, 0x00, -1, 0x03, 0x000a, 0x0007 },
+ { 0x02, 0x00, -1, 0x03, 0x000a, 0x0008 },
+ { 0x02, 0x00, -1, 0x03, 0x000a, 0x0009 },
+ { 0x02, 0x00, -1, 0x00, 0x000e, 0x0002 },
+ { 0x02, 0x00, -1, 0x01, 0x000e, 0x0003 },
+ { 0x02, 0x00, -1, 0x02, 0x000e, 0x0004 },
+ { 0x02, 0x00, -1, 0x03, 0x000e, 0x0005 },
+ { 0x02, 0x00, -1, 0x03, 0x000e, 0x0006 },
+ { 0x02, 0x00, -1, 0x03, 0x000e, 0x0007 },
+ { 0x02, 0x00, -1, 0x03, 0x000e, 0x0008 },
+ { 0x02, 0x00, -1, 0x03, 0x000e, 0x0009 },
+ { 0x03, 0x00, -1, 0x00, 0x0012, 0x0002 },
+ { 0x03, 0x00, -1, 0x01, 0x0012, 0x0003 },
+ { 0x03, 0x00, -1, 0x02, 0x0012, 0x0004 },
+ { 0x03, 0x00, -1, 0x03, 0x0012, 0x0005 },
+ { 0x03, 0x00, -1, 0x03, 0x0012, 0x0006 },
+ { 0x03, 0x00, -1, 0x03, 0x0012, 0x0007 },
+ { 0x03, 0x00, -1, 0x03, 0x0012, 0x0008 },
+ { 0x03, 0x00, -1, 0x03, 0x0012, 0x0009 },
+ { 0x03, 0x00, -1, 0x00, 0x001a, 0x0002 },
+ { 0x03, 0x00, -1, 0x01, 0x001a, 0x0003 },
+ { 0x03, 0x00, -1, 0x02, 0x001a, 0x0004 },
+ { 0x03, 0x00, -1, 0x03, 0x001a, 0x0005 },
+ { 0x03, 0x00, -1, 0x03, 0x001a, 0x0006 },
+ { 0x03, 0x00, -1, 0x03, 0x001a, 0x0007 },
+ { 0x03, 0x00, -1, 0x03, 0x001a, 0x0008 },
+ { 0x03, 0x00, -1, 0x03, 0x001a, 0x0009 },
+ { 0x04, 0x00, -1, 0x00, 0x0022, 0x0002 },
+ { 0x04, 0x00, -1, 0x01, 0x0022, 0x0003 },
+ { 0x04, 0x00, -1, 0x02, 0x0022, 0x0004 },
+ { 0x04, 0x00, -1, 0x03, 0x0022, 0x0005 },
+ { 0x04, 0x00, -1, 0x03, 0x0022, 0x0006 },
+ { 0x04, 0x00, -1, 0x03, 0x0022, 0x0007 },
+ { 0x04, 0x00, -1, 0x03, 0x0022, 0x0008 },
+ { 0x04, 0x00, -1, 0x03, 0x0022, 0x0009 },
+ { 0x04, 0x00, -1, 0x00, 0x0032, 0x0002 },
+ { 0x04, 0x00, -1, 0x01, 0x0032, 0x0003 },
+ { 0x04, 0x00, -1, 0x02, 0x0032, 0x0004 },
+ { 0x04, 0x00, -1, 0x03, 0x0032, 0x0005 },
+ { 0x04, 0x00, -1, 0x03, 0x0032, 0x0006 },
+ { 0x04, 0x00, -1, 0x03, 0x0032, 0x0007 },
+ { 0x04, 0x00, -1, 0x03, 0x0032, 0x0008 },
+ { 0x04, 0x00, -1, 0x03, 0x0032, 0x0009 },
+ { 0x05, 0x00, -1, 0x00, 0x0042, 0x0002 },
+ { 0x05, 0x00, -1, 0x01, 0x0042, 0x0003 },
+ { 0x05, 0x00, -1, 0x02, 0x0042, 0x0004 },
+ { 0x05, 0x00, -1, 0x03, 0x0042, 0x0005 },
+ { 0x05, 0x00, -1, 0x03, 0x0042, 0x0006 },
+ { 0x05, 0x00, -1, 0x03, 0x0042, 0x0007 },
+ { 0x05, 0x00, -1, 0x03, 0x0042, 0x0008 },
+ { 0x05, 0x00, -1, 0x03, 0x0042, 0x0009 },
+ { 0x05, 0x00, -1, 0x00, 0x0062, 0x0002 },
+ { 0x05, 0x00, -1, 0x01, 0x0062, 0x0003 },
+ { 0x05, 0x00, -1, 0x02, 0x0062, 0x0004 },
+ { 0x05, 0x00, -1, 0x03, 0x0062, 0x0005 },
+ { 0x05, 0x00, -1, 0x03, 0x0062, 0x0006 },
+ { 0x05, 0x00, -1, 0x03, 0x0062, 0x0007 },
+ { 0x05, 0x00, -1, 0x03, 0x0062, 0x0008 },
+ { 0x05, 0x00, -1, 0x03, 0x0062, 0x0009 },
+ { 0x02, 0x01, -1, 0x03, 0x000a, 0x000a },
+ { 0x02, 0x01, -1, 0x03, 0x000a, 0x000c },
+ { 0x02, 0x02, -1, 0x03, 0x000a, 0x000e },
+ { 0x02, 0x02, -1, 0x03, 0x000a, 0x0012 },
+ { 0x02, 0x03, -1, 0x03, 0x000a, 0x0016 },
+ { 0x02, 0x03, -1, 0x03, 0x000a, 0x001e },
+ { 0x02, 0x04, -1, 0x03, 0x000a, 0x0026 },
+ { 0x02, 0x04, -1, 0x03, 0x000a, 0x0036 },
+ { 0x02, 0x01, -1, 0x03, 0x000e, 0x000a },
+ { 0x02, 0x01, -1, 0x03, 0x000e, 0x000c },
+ { 0x02, 0x02, -1, 0x03, 0x000e, 0x000e },
+ { 0x02, 0x02, -1, 0x03, 0x000e, 0x0012 },
+ { 0x02, 0x03, -1, 0x03, 0x000e, 0x0016 },
+ { 0x02, 0x03, -1, 0x03, 0x000e, 0x001e },
+ { 0x02, 0x04, -1, 0x03, 0x000e, 0x0026 },
+ { 0x02, 0x04, -1, 0x03, 0x000e, 0x0036 },
+ { 0x03, 0x01, -1, 0x03, 0x0012, 0x000a },
+ { 0x03, 0x01, -1, 0x03, 0x0012, 0x000c },
+ { 0x03, 0x02, -1, 0x03, 0x0012, 0x000e },
+ { 0x03, 0x02, -1, 0x03, 0x0012, 0x0012 },
+ { 0x03, 0x03, -1, 0x03, 0x0012, 0x0016 },
+ { 0x03, 0x03, -1, 0x03, 0x0012, 0x001e },
+ { 0x03, 0x04, -1, 0x03, 0x0012, 0x0026 },
+ { 0x03, 0x04, -1, 0x03, 0x0012, 0x0036 },
+ { 0x03, 0x01, -1, 0x03, 0x001a, 0x000a },
+ { 0x03, 0x01, -1, 0x03, 0x001a, 0x000c },
+ { 0x03, 0x02, -1, 0x03, 0x001a, 0x000e },
+ { 0x03, 0x02, -1, 0x03, 0x001a, 0x0012 },
+ { 0x03, 0x03, -1, 0x03, 0x001a, 0x0016 },
+ { 0x03, 0x03, -1, 0x03, 0x001a, 0x001e },
+ { 0x03, 0x04, -1, 0x03, 0x001a, 0x0026 },
+ { 0x03, 0x04, -1, 0x03, 0x001a, 0x0036 },
+ { 0x04, 0x01, -1, 0x03, 0x0022, 0x000a },
+ { 0x04, 0x01, -1, 0x03, 0x0022, 0x000c },
+ { 0x04, 0x02, -1, 0x03, 0x0022, 0x000e },
+ { 0x04, 0x02, -1, 0x03, 0x0022, 0x0012 },
+ { 0x04, 0x03, -1, 0x03, 0x0022, 0x0016 },
+ { 0x04, 0x03, -1, 0x03, 0x0022, 0x001e },
+ { 0x04, 0x04, -1, 0x03, 0x0022, 0x0026 },
+ { 0x04, 0x04, -1, 0x03, 0x0022, 0x0036 },
+ { 0x04, 0x01, -1, 0x03, 0x0032, 0x000a },
+ { 0x04, 0x01, -1, 0x03, 0x0032, 0x000c },
+ { 0x04, 0x02, -1, 0x03, 0x0032, 0x000e },
+ { 0x04, 0x02, -1, 0x03, 0x0032, 0x0012 },
+ { 0x04, 0x03, -1, 0x03, 0x0032, 0x0016 },
+ { 0x04, 0x03, -1, 0x03, 0x0032, 0x001e },
+ { 0x04, 0x04, -1, 0x03, 0x0032, 0x0026 },
+ { 0x04, 0x04, -1, 0x03, 0x0032, 0x0036 },
+ { 0x05, 0x01, -1, 0x03, 0x0042, 0x000a },
+ { 0x05, 0x01, -1, 0x03, 0x0042, 0x000c },
+ { 0x05, 0x02, -1, 0x03, 0x0042, 0x000e },
+ { 0x05, 0x02, -1, 0x03, 0x0042, 0x0012 },
+ { 0x05, 0x03, -1, 0x03, 0x0042, 0x0016 },
+ { 0x05, 0x03, -1, 0x03, 0x0042, 0x001e },
+ { 0x05, 0x04, -1, 0x03, 0x0042, 0x0026 },
+ { 0x05, 0x04, -1, 0x03, 0x0042, 0x0036 },
+ { 0x05, 0x01, -1, 0x03, 0x0062, 0x000a },
+ { 0x05, 0x01, -1, 0x03, 0x0062, 0x000c },
+ { 0x05, 0x02, -1, 0x03, 0x0062, 0x000e },
+ { 0x05, 0x02, -1, 0x03, 0x0062, 0x0012 },
+ { 0x05, 0x03, -1, 0x03, 0x0062, 0x0016 },
+ { 0x05, 0x03, -1, 0x03, 0x0062, 0x001e },
+ { 0x05, 0x04, -1, 0x03, 0x0062, 0x0026 },
+ { 0x05, 0x04, -1, 0x03, 0x0062, 0x0036 },
+ { 0x00, 0x05, -1, 0x03, 0x0000, 0x0046 },
+ { 0x00, 0x05, -1, 0x03, 0x0000, 0x0066 },
+ { 0x00, 0x06, -1, 0x03, 0x0000, 0x0086 },
+ { 0x00, 0x07, -1, 0x03, 0x0000, 0x00c6 },
+ { 0x00, 0x08, -1, 0x03, 0x0000, 0x0146 },
+ { 0x00, 0x09, -1, 0x03, 0x0000, 0x0246 },
+ { 0x00, 0x0a, -1, 0x03, 0x0000, 0x0446 },
+ { 0x00, 0x18, -1, 0x03, 0x0000, 0x0846 },
+ { 0x00, 0x05, -1, 0x03, 0x0001, 0x0046 },
+ { 0x00, 0x05, -1, 0x03, 0x0001, 0x0066 },
+ { 0x00, 0x06, -1, 0x03, 0x0001, 0x0086 },
+ { 0x00, 0x07, -1, 0x03, 0x0001, 0x00c6 },
+ { 0x00, 0x08, -1, 0x03, 0x0001, 0x0146 },
+ { 0x00, 0x09, -1, 0x03, 0x0001, 0x0246 },
+ { 0x00, 0x0a, -1, 0x03, 0x0001, 0x0446 },
+ { 0x00, 0x18, -1, 0x03, 0x0001, 0x0846 },
+ { 0x00, 0x05, -1, 0x03, 0x0002, 0x0046 },
+ { 0x00, 0x05, -1, 0x03, 0x0002, 0x0066 },
+ { 0x00, 0x06, -1, 0x03, 0x0002, 0x0086 },
+ { 0x00, 0x07, -1, 0x03, 0x0002, 0x00c6 },
+ { 0x00, 0x08, -1, 0x03, 0x0002, 0x0146 },
+ { 0x00, 0x09, -1, 0x03, 0x0002, 0x0246 },
+ { 0x00, 0x0a, -1, 0x03, 0x0002, 0x0446 },
+ { 0x00, 0x18, -1, 0x03, 0x0002, 0x0846 },
+ { 0x00, 0x05, -1, 0x03, 0x0003, 0x0046 },
+ { 0x00, 0x05, -1, 0x03, 0x0003, 0x0066 },
+ { 0x00, 0x06, -1, 0x03, 0x0003, 0x0086 },
+ { 0x00, 0x07, -1, 0x03, 0x0003, 0x00c6 },
+ { 0x00, 0x08, -1, 0x03, 0x0003, 0x0146 },
+ { 0x00, 0x09, -1, 0x03, 0x0003, 0x0246 },
+ { 0x00, 0x0a, -1, 0x03, 0x0003, 0x0446 },
+ { 0x00, 0x18, -1, 0x03, 0x0003, 0x0846 },
+ { 0x00, 0x05, -1, 0x03, 0x0004, 0x0046 },
+ { 0x00, 0x05, -1, 0x03, 0x0004, 0x0066 },
+ { 0x00, 0x06, -1, 0x03, 0x0004, 0x0086 },
+ { 0x00, 0x07, -1, 0x03, 0x0004, 0x00c6 },
+ { 0x00, 0x08, -1, 0x03, 0x0004, 0x0146 },
+ { 0x00, 0x09, -1, 0x03, 0x0004, 0x0246 },
+ { 0x00, 0x0a, -1, 0x03, 0x0004, 0x0446 },
+ { 0x00, 0x18, -1, 0x03, 0x0004, 0x0846 },
+ { 0x00, 0x05, -1, 0x03, 0x0005, 0x0046 },
+ { 0x00, 0x05, -1, 0x03, 0x0005, 0x0066 },
+ { 0x00, 0x06, -1, 0x03, 0x0005, 0x0086 },
+ { 0x00, 0x07, -1, 0x03, 0x0005, 0x00c6 },
+ { 0x00, 0x08, -1, 0x03, 0x0005, 0x0146 },
+ { 0x00, 0x09, -1, 0x03, 0x0005, 0x0246 },
+ { 0x00, 0x0a, -1, 0x03, 0x0005, 0x0446 },
+ { 0x00, 0x18, -1, 0x03, 0x0005, 0x0846 },
+ { 0x01, 0x05, -1, 0x03, 0x0006, 0x0046 },
+ { 0x01, 0x05, -1, 0x03, 0x0006, 0x0066 },
+ { 0x01, 0x06, -1, 0x03, 0x0006, 0x0086 },
+ { 0x01, 0x07, -1, 0x03, 0x0006, 0x00c6 },
+ { 0x01, 0x08, -1, 0x03, 0x0006, 0x0146 },
+ { 0x01, 0x09, -1, 0x03, 0x0006, 0x0246 },
+ { 0x01, 0x0a, -1, 0x03, 0x0006, 0x0446 },
+ { 0x01, 0x18, -1, 0x03, 0x0006, 0x0846 },
+ { 0x01, 0x05, -1, 0x03, 0x0008, 0x0046 },
+ { 0x01, 0x05, -1, 0x03, 0x0008, 0x0066 },
+ { 0x01, 0x06, -1, 0x03, 0x0008, 0x0086 },
+ { 0x01, 0x07, -1, 0x03, 0x0008, 0x00c6 },
+ { 0x01, 0x08, -1, 0x03, 0x0008, 0x0146 },
+ { 0x01, 0x09, -1, 0x03, 0x0008, 0x0246 },
+ { 0x01, 0x0a, -1, 0x03, 0x0008, 0x0446 },
+ { 0x01, 0x18, -1, 0x03, 0x0008, 0x0846 },
+ { 0x06, 0x00, -1, 0x00, 0x0082, 0x0002 },
+ { 0x06, 0x00, -1, 0x01, 0x0082, 0x0003 },
+ { 0x06, 0x00, -1, 0x02, 0x0082, 0x0004 },
+ { 0x06, 0x00, -1, 0x03, 0x0082, 0x0005 },
+ { 0x06, 0x00, -1, 0x03, 0x0082, 0x0006 },
+ { 0x06, 0x00, -1, 0x03, 0x0082, 0x0007 },
+ { 0x06, 0x00, -1, 0x03, 0x0082, 0x0008 },
+ { 0x06, 0x00, -1, 0x03, 0x0082, 0x0009 },
+ { 0x07, 0x00, -1, 0x00, 0x00c2, 0x0002 },
+ { 0x07, 0x00, -1, 0x01, 0x00c2, 0x0003 },
+ { 0x07, 0x00, -1, 0x02, 0x00c2, 0x0004 },
+ { 0x07, 0x00, -1, 0x03, 0x00c2, 0x0005 },
+ { 0x07, 0x00, -1, 0x03, 0x00c2, 0x0006 },
+ { 0x07, 0x00, -1, 0x03, 0x00c2, 0x0007 },
+ { 0x07, 0x00, -1, 0x03, 0x00c2, 0x0008 },
+ { 0x07, 0x00, -1, 0x03, 0x00c2, 0x0009 },
+ { 0x08, 0x00, -1, 0x00, 0x0142, 0x0002 },
+ { 0x08, 0x00, -1, 0x01, 0x0142, 0x0003 },
+ { 0x08, 0x00, -1, 0x02, 0x0142, 0x0004 },
+ { 0x08, 0x00, -1, 0x03, 0x0142, 0x0005 },
+ { 0x08, 0x00, -1, 0x03, 0x0142, 0x0006 },
+ { 0x08, 0x00, -1, 0x03, 0x0142, 0x0007 },
+ { 0x08, 0x00, -1, 0x03, 0x0142, 0x0008 },
+ { 0x08, 0x00, -1, 0x03, 0x0142, 0x0009 },
+ { 0x09, 0x00, -1, 0x00, 0x0242, 0x0002 },
+ { 0x09, 0x00, -1, 0x01, 0x0242, 0x0003 },
+ { 0x09, 0x00, -1, 0x02, 0x0242, 0x0004 },
+ { 0x09, 0x00, -1, 0x03, 0x0242, 0x0005 },
+ { 0x09, 0x00, -1, 0x03, 0x0242, 0x0006 },
+ { 0x09, 0x00, -1, 0x03, 0x0242, 0x0007 },
+ { 0x09, 0x00, -1, 0x03, 0x0242, 0x0008 },
+ { 0x09, 0x00, -1, 0x03, 0x0242, 0x0009 },
+ { 0x0a, 0x00, -1, 0x00, 0x0442, 0x0002 },
+ { 0x0a, 0x00, -1, 0x01, 0x0442, 0x0003 },
+ { 0x0a, 0x00, -1, 0x02, 0x0442, 0x0004 },
+ { 0x0a, 0x00, -1, 0x03, 0x0442, 0x0005 },
+ { 0x0a, 0x00, -1, 0x03, 0x0442, 0x0006 },
+ { 0x0a, 0x00, -1, 0x03, 0x0442, 0x0007 },
+ { 0x0a, 0x00, -1, 0x03, 0x0442, 0x0008 },
+ { 0x0a, 0x00, -1, 0x03, 0x0442, 0x0009 },
+ { 0x0c, 0x00, -1, 0x00, 0x0842, 0x0002 },
+ { 0x0c, 0x00, -1, 0x01, 0x0842, 0x0003 },
+ { 0x0c, 0x00, -1, 0x02, 0x0842, 0x0004 },
+ { 0x0c, 0x00, -1, 0x03, 0x0842, 0x0005 },
+ { 0x0c, 0x00, -1, 0x03, 0x0842, 0x0006 },
+ { 0x0c, 0x00, -1, 0x03, 0x0842, 0x0007 },
+ { 0x0c, 0x00, -1, 0x03, 0x0842, 0x0008 },
+ { 0x0c, 0x00, -1, 0x03, 0x0842, 0x0009 },
+ { 0x0e, 0x00, -1, 0x00, 0x1842, 0x0002 },
+ { 0x0e, 0x00, -1, 0x01, 0x1842, 0x0003 },
+ { 0x0e, 0x00, -1, 0x02, 0x1842, 0x0004 },
+ { 0x0e, 0x00, -1, 0x03, 0x1842, 0x0005 },
+ { 0x0e, 0x00, -1, 0x03, 0x1842, 0x0006 },
+ { 0x0e, 0x00, -1, 0x03, 0x1842, 0x0007 },
+ { 0x0e, 0x00, -1, 0x03, 0x1842, 0x0008 },
+ { 0x0e, 0x00, -1, 0x03, 0x1842, 0x0009 },
+ { 0x18, 0x00, -1, 0x00, 0x5842, 0x0002 },
+ { 0x18, 0x00, -1, 0x01, 0x5842, 0x0003 },
+ { 0x18, 0x00, -1, 0x02, 0x5842, 0x0004 },
+ { 0x18, 0x00, -1, 0x03, 0x5842, 0x0005 },
+ { 0x18, 0x00, -1, 0x03, 0x5842, 0x0006 },
+ { 0x18, 0x00, -1, 0x03, 0x5842, 0x0007 },
+ { 0x18, 0x00, -1, 0x03, 0x5842, 0x0008 },
+ { 0x18, 0x00, -1, 0x03, 0x5842, 0x0009 },
+ { 0x02, 0x05, -1, 0x03, 0x000a, 0x0046 },
+ { 0x02, 0x05, -1, 0x03, 0x000a, 0x0066 },
+ { 0x02, 0x06, -1, 0x03, 0x000a, 0x0086 },
+ { 0x02, 0x07, -1, 0x03, 0x000a, 0x00c6 },
+ { 0x02, 0x08, -1, 0x03, 0x000a, 0x0146 },
+ { 0x02, 0x09, -1, 0x03, 0x000a, 0x0246 },
+ { 0x02, 0x0a, -1, 0x03, 0x000a, 0x0446 },
+ { 0x02, 0x18, -1, 0x03, 0x000a, 0x0846 },
+ { 0x02, 0x05, -1, 0x03, 0x000e, 0x0046 },
+ { 0x02, 0x05, -1, 0x03, 0x000e, 0x0066 },
+ { 0x02, 0x06, -1, 0x03, 0x000e, 0x0086 },
+ { 0x02, 0x07, -1, 0x03, 0x000e, 0x00c6 },
+ { 0x02, 0x08, -1, 0x03, 0x000e, 0x0146 },
+ { 0x02, 0x09, -1, 0x03, 0x000e, 0x0246 },
+ { 0x02, 0x0a, -1, 0x03, 0x000e, 0x0446 },
+ { 0x02, 0x18, -1, 0x03, 0x000e, 0x0846 },
+ { 0x03, 0x05, -1, 0x03, 0x0012, 0x0046 },
+ { 0x03, 0x05, -1, 0x03, 0x0012, 0x0066 },
+ { 0x03, 0x06, -1, 0x03, 0x0012, 0x0086 },
+ { 0x03, 0x07, -1, 0x03, 0x0012, 0x00c6 },
+ { 0x03, 0x08, -1, 0x03, 0x0012, 0x0146 },
+ { 0x03, 0x09, -1, 0x03, 0x0012, 0x0246 },
+ { 0x03, 0x0a, -1, 0x03, 0x0012, 0x0446 },
+ { 0x03, 0x18, -1, 0x03, 0x0012, 0x0846 },
+ { 0x03, 0x05, -1, 0x03, 0x001a, 0x0046 },
+ { 0x03, 0x05, -1, 0x03, 0x001a, 0x0066 },
+ { 0x03, 0x06, -1, 0x03, 0x001a, 0x0086 },
+ { 0x03, 0x07, -1, 0x03, 0x001a, 0x00c6 },
+ { 0x03, 0x08, -1, 0x03, 0x001a, 0x0146 },
+ { 0x03, 0x09, -1, 0x03, 0x001a, 0x0246 },
+ { 0x03, 0x0a, -1, 0x03, 0x001a, 0x0446 },
+ { 0x03, 0x18, -1, 0x03, 0x001a, 0x0846 },
+ { 0x04, 0x05, -1, 0x03, 0x0022, 0x0046 },
+ { 0x04, 0x05, -1, 0x03, 0x0022, 0x0066 },
+ { 0x04, 0x06, -1, 0x03, 0x0022, 0x0086 },
+ { 0x04, 0x07, -1, 0x03, 0x0022, 0x00c6 },
+ { 0x04, 0x08, -1, 0x03, 0x0022, 0x0146 },
+ { 0x04, 0x09, -1, 0x03, 0x0022, 0x0246 },
+ { 0x04, 0x0a, -1, 0x03, 0x0022, 0x0446 },
+ { 0x04, 0x18, -1, 0x03, 0x0022, 0x0846 },
+ { 0x04, 0x05, -1, 0x03, 0x0032, 0x0046 },
+ { 0x04, 0x05, -1, 0x03, 0x0032, 0x0066 },
+ { 0x04, 0x06, -1, 0x03, 0x0032, 0x0086 },
+ { 0x04, 0x07, -1, 0x03, 0x0032, 0x00c6 },
+ { 0x04, 0x08, -1, 0x03, 0x0032, 0x0146 },
+ { 0x04, 0x09, -1, 0x03, 0x0032, 0x0246 },
+ { 0x04, 0x0a, -1, 0x03, 0x0032, 0x0446 },
+ { 0x04, 0x18, -1, 0x03, 0x0032, 0x0846 },
+ { 0x05, 0x05, -1, 0x03, 0x0042, 0x0046 },
+ { 0x05, 0x05, -1, 0x03, 0x0042, 0x0066 },
+ { 0x05, 0x06, -1, 0x03, 0x0042, 0x0086 },
+ { 0x05, 0x07, -1, 0x03, 0x0042, 0x00c6 },
+ { 0x05, 0x08, -1, 0x03, 0x0042, 0x0146 },
+ { 0x05, 0x09, -1, 0x03, 0x0042, 0x0246 },
+ { 0x05, 0x0a, -1, 0x03, 0x0042, 0x0446 },
+ { 0x05, 0x18, -1, 0x03, 0x0042, 0x0846 },
+ { 0x05, 0x05, -1, 0x03, 0x0062, 0x0046 },
+ { 0x05, 0x05, -1, 0x03, 0x0062, 0x0066 },
+ { 0x05, 0x06, -1, 0x03, 0x0062, 0x0086 },
+ { 0x05, 0x07, -1, 0x03, 0x0062, 0x00c6 },
+ { 0x05, 0x08, -1, 0x03, 0x0062, 0x0146 },
+ { 0x05, 0x09, -1, 0x03, 0x0062, 0x0246 },
+ { 0x05, 0x0a, -1, 0x03, 0x0062, 0x0446 },
+ { 0x05, 0x18, -1, 0x03, 0x0062, 0x0846 },
+ { 0x06, 0x01, -1, 0x03, 0x0082, 0x000a },
+ { 0x06, 0x01, -1, 0x03, 0x0082, 0x000c },
+ { 0x06, 0x02, -1, 0x03, 0x0082, 0x000e },
+ { 0x06, 0x02, -1, 0x03, 0x0082, 0x0012 },
+ { 0x06, 0x03, -1, 0x03, 0x0082, 0x0016 },
+ { 0x06, 0x03, -1, 0x03, 0x0082, 0x001e },
+ { 0x06, 0x04, -1, 0x03, 0x0082, 0x0026 },
+ { 0x06, 0x04, -1, 0x03, 0x0082, 0x0036 },
+ { 0x07, 0x01, -1, 0x03, 0x00c2, 0x000a },
+ { 0x07, 0x01, -1, 0x03, 0x00c2, 0x000c },
+ { 0x07, 0x02, -1, 0x03, 0x00c2, 0x000e },
+ { 0x07, 0x02, -1, 0x03, 0x00c2, 0x0012 },
+ { 0x07, 0x03, -1, 0x03, 0x00c2, 0x0016 },
+ { 0x07, 0x03, -1, 0x03, 0x00c2, 0x001e },
+ { 0x07, 0x04, -1, 0x03, 0x00c2, 0x0026 },
+ { 0x07, 0x04, -1, 0x03, 0x00c2, 0x0036 },
+ { 0x08, 0x01, -1, 0x03, 0x0142, 0x000a },
+ { 0x08, 0x01, -1, 0x03, 0x0142, 0x000c },
+ { 0x08, 0x02, -1, 0x03, 0x0142, 0x000e },
+ { 0x08, 0x02, -1, 0x03, 0x0142, 0x0012 },
+ { 0x08, 0x03, -1, 0x03, 0x0142, 0x0016 },
+ { 0x08, 0x03, -1, 0x03, 0x0142, 0x001e },
+ { 0x08, 0x04, -1, 0x03, 0x0142, 0x0026 },
+ { 0x08, 0x04, -1, 0x03, 0x0142, 0x0036 },
+ { 0x09, 0x01, -1, 0x03, 0x0242, 0x000a },
+ { 0x09, 0x01, -1, 0x03, 0x0242, 0x000c },
+ { 0x09, 0x02, -1, 0x03, 0x0242, 0x000e },
+ { 0x09, 0x02, -1, 0x03, 0x0242, 0x0012 },
+ { 0x09, 0x03, -1, 0x03, 0x0242, 0x0016 },
+ { 0x09, 0x03, -1, 0x03, 0x0242, 0x001e },
+ { 0x09, 0x04, -1, 0x03, 0x0242, 0x0026 },
+ { 0x09, 0x04, -1, 0x03, 0x0242, 0x0036 },
+ { 0x0a, 0x01, -1, 0x03, 0x0442, 0x000a },
+ { 0x0a, 0x01, -1, 0x03, 0x0442, 0x000c },
+ { 0x0a, 0x02, -1, 0x03, 0x0442, 0x000e },
+ { 0x0a, 0x02, -1, 0x03, 0x0442, 0x0012 },
+ { 0x0a, 0x03, -1, 0x03, 0x0442, 0x0016 },
+ { 0x0a, 0x03, -1, 0x03, 0x0442, 0x001e },
+ { 0x0a, 0x04, -1, 0x03, 0x0442, 0x0026 },
+ { 0x0a, 0x04, -1, 0x03, 0x0442, 0x0036 },
+ { 0x0c, 0x01, -1, 0x03, 0x0842, 0x000a },
+ { 0x0c, 0x01, -1, 0x03, 0x0842, 0x000c },
+ { 0x0c, 0x02, -1, 0x03, 0x0842, 0x000e },
+ { 0x0c, 0x02, -1, 0x03, 0x0842, 0x0012 },
+ { 0x0c, 0x03, -1, 0x03, 0x0842, 0x0016 },
+ { 0x0c, 0x03, -1, 0x03, 0x0842, 0x001e },
+ { 0x0c, 0x04, -1, 0x03, 0x0842, 0x0026 },
+ { 0x0c, 0x04, -1, 0x03, 0x0842, 0x0036 },
+ { 0x0e, 0x01, -1, 0x03, 0x1842, 0x000a },
+ { 0x0e, 0x01, -1, 0x03, 0x1842, 0x000c },
+ { 0x0e, 0x02, -1, 0x03, 0x1842, 0x000e },
+ { 0x0e, 0x02, -1, 0x03, 0x1842, 0x0012 },
+ { 0x0e, 0x03, -1, 0x03, 0x1842, 0x0016 },
+ { 0x0e, 0x03, -1, 0x03, 0x1842, 0x001e },
+ { 0x0e, 0x04, -1, 0x03, 0x1842, 0x0026 },
+ { 0x0e, 0x04, -1, 0x03, 0x1842, 0x0036 },
+ { 0x18, 0x01, -1, 0x03, 0x5842, 0x000a },
+ { 0x18, 0x01, -1, 0x03, 0x5842, 0x000c },
+ { 0x18, 0x02, -1, 0x03, 0x5842, 0x000e },
+ { 0x18, 0x02, -1, 0x03, 0x5842, 0x0012 },
+ { 0x18, 0x03, -1, 0x03, 0x5842, 0x0016 },
+ { 0x18, 0x03, -1, 0x03, 0x5842, 0x001e },
+ { 0x18, 0x04, -1, 0x03, 0x5842, 0x0026 },
+ { 0x18, 0x04, -1, 0x03, 0x5842, 0x0036 },
+ { 0x06, 0x05, -1, 0x03, 0x0082, 0x0046 },
+ { 0x06, 0x05, -1, 0x03, 0x0082, 0x0066 },
+ { 0x06, 0x06, -1, 0x03, 0x0082, 0x0086 },
+ { 0x06, 0x07, -1, 0x03, 0x0082, 0x00c6 },
+ { 0x06, 0x08, -1, 0x03, 0x0082, 0x0146 },
+ { 0x06, 0x09, -1, 0x03, 0x0082, 0x0246 },
+ { 0x06, 0x0a, -1, 0x03, 0x0082, 0x0446 },
+ { 0x06, 0x18, -1, 0x03, 0x0082, 0x0846 },
+ { 0x07, 0x05, -1, 0x03, 0x00c2, 0x0046 },
+ { 0x07, 0x05, -1, 0x03, 0x00c2, 0x0066 },
+ { 0x07, 0x06, -1, 0x03, 0x00c2, 0x0086 },
+ { 0x07, 0x07, -1, 0x03, 0x00c2, 0x00c6 },
+ { 0x07, 0x08, -1, 0x03, 0x00c2, 0x0146 },
+ { 0x07, 0x09, -1, 0x03, 0x00c2, 0x0246 },
+ { 0x07, 0x0a, -1, 0x03, 0x00c2, 0x0446 },
+ { 0x07, 0x18, -1, 0x03, 0x00c2, 0x0846 },
+ { 0x08, 0x05, -1, 0x03, 0x0142, 0x0046 },
+ { 0x08, 0x05, -1, 0x03, 0x0142, 0x0066 },
+ { 0x08, 0x06, -1, 0x03, 0x0142, 0x0086 },
+ { 0x08, 0x07, -1, 0x03, 0x0142, 0x00c6 },
+ { 0x08, 0x08, -1, 0x03, 0x0142, 0x0146 },
+ { 0x08, 0x09, -1, 0x03, 0x0142, 0x0246 },
+ { 0x08, 0x0a, -1, 0x03, 0x0142, 0x0446 },
+ { 0x08, 0x18, -1, 0x03, 0x0142, 0x0846 },
+ { 0x09, 0x05, -1, 0x03, 0x0242, 0x0046 },
+ { 0x09, 0x05, -1, 0x03, 0x0242, 0x0066 },
+ { 0x09, 0x06, -1, 0x03, 0x0242, 0x0086 },
+ { 0x09, 0x07, -1, 0x03, 0x0242, 0x00c6 },
+ { 0x09, 0x08, -1, 0x03, 0x0242, 0x0146 },
+ { 0x09, 0x09, -1, 0x03, 0x0242, 0x0246 },
+ { 0x09, 0x0a, -1, 0x03, 0x0242, 0x0446 },
+ { 0x09, 0x18, -1, 0x03, 0x0242, 0x0846 },
+ { 0x0a, 0x05, -1, 0x03, 0x0442, 0x0046 },
+ { 0x0a, 0x05, -1, 0x03, 0x0442, 0x0066 },
+ { 0x0a, 0x06, -1, 0x03, 0x0442, 0x0086 },
+ { 0x0a, 0x07, -1, 0x03, 0x0442, 0x00c6 },
+ { 0x0a, 0x08, -1, 0x03, 0x0442, 0x0146 },
+ { 0x0a, 0x09, -1, 0x03, 0x0442, 0x0246 },
+ { 0x0a, 0x0a, -1, 0x03, 0x0442, 0x0446 },
+ { 0x0a, 0x18, -1, 0x03, 0x0442, 0x0846 },
+ { 0x0c, 0x05, -1, 0x03, 0x0842, 0x0046 },
+ { 0x0c, 0x05, -1, 0x03, 0x0842, 0x0066 },
+ { 0x0c, 0x06, -1, 0x03, 0x0842, 0x0086 },
+ { 0x0c, 0x07, -1, 0x03, 0x0842, 0x00c6 },
+ { 0x0c, 0x08, -1, 0x03, 0x0842, 0x0146 },
+ { 0x0c, 0x09, -1, 0x03, 0x0842, 0x0246 },
+ { 0x0c, 0x0a, -1, 0x03, 0x0842, 0x0446 },
+ { 0x0c, 0x18, -1, 0x03, 0x0842, 0x0846 },
+ { 0x0e, 0x05, -1, 0x03, 0x1842, 0x0046 },
+ { 0x0e, 0x05, -1, 0x03, 0x1842, 0x0066 },
+ { 0x0e, 0x06, -1, 0x03, 0x1842, 0x0086 },
+ { 0x0e, 0x07, -1, 0x03, 0x1842, 0x00c6 },
+ { 0x0e, 0x08, -1, 0x03, 0x1842, 0x0146 },
+ { 0x0e, 0x09, -1, 0x03, 0x1842, 0x0246 },
+ { 0x0e, 0x0a, -1, 0x03, 0x1842, 0x0446 },
+ { 0x0e, 0x18, -1, 0x03, 0x1842, 0x0846 },
+ { 0x18, 0x05, -1, 0x03, 0x5842, 0x0046 },
+ { 0x18, 0x05, -1, 0x03, 0x5842, 0x0066 },
+ { 0x18, 0x06, -1, 0x03, 0x5842, 0x0086 },
+ { 0x18, 0x07, -1, 0x03, 0x5842, 0x00c6 },
+ { 0x18, 0x08, -1, 0x03, 0x5842, 0x0146 },
+ { 0x18, 0x09, -1, 0x03, 0x5842, 0x0246 },
+ { 0x18, 0x0a, -1, 0x03, 0x5842, 0x0446 },
+ { 0x18, 0x18, -1, 0x03, 0x5842, 0x0846 },
+};
+
+#endif /* BROTLI_DEC_PREFIX_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/state.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/state.c
new file mode 100644
index 000000000..6cf2476c7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/state.c
@@ -0,0 +1,157 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+#include "./state.h"
+
+#include <stdlib.h> /* free, malloc */
+
+#include <brotli/types.h>
+#include "./huffman.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+BROTLI_BOOL BrotliDecoderStateInit(BrotliDecoderState* s,
+ brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque) {
+ if (!alloc_func) {
+ s->alloc_func = BrotliDefaultAllocFunc;
+ s->free_func = BrotliDefaultFreeFunc;
+ s->memory_manager_opaque = 0;
+ } else {
+ s->alloc_func = alloc_func;
+ s->free_func = free_func;
+ s->memory_manager_opaque = opaque;
+ }
+
+ s->error_code = 0; /* BROTLI_DECODER_NO_ERROR */
+
+ BrotliInitBitReader(&s->br);
+ s->state = BROTLI_STATE_UNINITED;
+ s->large_window = 0;
+ s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NONE;
+ s->substate_uncompressed = BROTLI_STATE_UNCOMPRESSED_NONE;
+ s->substate_decode_uint8 = BROTLI_STATE_DECODE_UINT8_NONE;
+ s->substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_NONE;
+
+ s->buffer_length = 0;
+ s->loop_counter = 0;
+ s->pos = 0;
+ s->rb_roundtrips = 0;
+ s->partial_pos_out = 0;
+
+ s->block_type_trees = NULL;
+ s->block_len_trees = NULL;
+ s->ringbuffer = NULL;
+ s->ringbuffer_size = 0;
+ s->new_ringbuffer_size = 0;
+ s->ringbuffer_mask = 0;
+
+ s->context_map = NULL;
+ s->context_modes = NULL;
+ s->dist_context_map = NULL;
+ s->context_map_slice = NULL;
+ s->dist_context_map_slice = NULL;
+
+ s->literal_hgroup.codes = NULL;
+ s->literal_hgroup.htrees = NULL;
+ s->insert_copy_hgroup.codes = NULL;
+ s->insert_copy_hgroup.htrees = NULL;
+ s->distance_hgroup.codes = NULL;
+ s->distance_hgroup.htrees = NULL;
+
+ s->is_last_metablock = 0;
+ s->is_uncompressed = 0;
+ s->is_metadata = 0;
+ s->should_wrap_ringbuffer = 0;
+ s->canny_ringbuffer_allocation = 1;
+
+ s->window_bits = 0;
+ s->max_distance = 0;
+ s->dist_rb[0] = 16;
+ s->dist_rb[1] = 15;
+ s->dist_rb[2] = 11;
+ s->dist_rb[3] = 4;
+ s->dist_rb_idx = 0;
+ s->block_type_trees = NULL;
+ s->block_len_trees = NULL;
+
+ s->mtf_upper_bound = 63;
+
+ s->dictionary = BrotliGetDictionary();
+ s->transforms = BrotliGetTransforms();
+
+ return BROTLI_TRUE;
+}
+
+void BrotliDecoderStateMetablockBegin(BrotliDecoderState* s) {
+ s->meta_block_remaining_len = 0;
+ s->block_length[0] = 1U << 24;
+ s->block_length[1] = 1U << 24;
+ s->block_length[2] = 1U << 24;
+ s->num_block_types[0] = 1;
+ s->num_block_types[1] = 1;
+ s->num_block_types[2] = 1;
+ s->block_type_rb[0] = 1;
+ s->block_type_rb[1] = 0;
+ s->block_type_rb[2] = 1;
+ s->block_type_rb[3] = 0;
+ s->block_type_rb[4] = 1;
+ s->block_type_rb[5] = 0;
+ s->context_map = NULL;
+ s->context_modes = NULL;
+ s->dist_context_map = NULL;
+ s->context_map_slice = NULL;
+ s->literal_htree = NULL;
+ s->dist_context_map_slice = NULL;
+ s->dist_htree_index = 0;
+ s->context_lookup = NULL;
+ s->literal_hgroup.codes = NULL;
+ s->literal_hgroup.htrees = NULL;
+ s->insert_copy_hgroup.codes = NULL;
+ s->insert_copy_hgroup.htrees = NULL;
+ s->distance_hgroup.codes = NULL;
+ s->distance_hgroup.htrees = NULL;
+}
+
+void BrotliDecoderStateCleanupAfterMetablock(BrotliDecoderState* s) {
+ BROTLI_DECODER_FREE(s, s->context_modes);
+ BROTLI_DECODER_FREE(s, s->context_map);
+ BROTLI_DECODER_FREE(s, s->dist_context_map);
+ BROTLI_DECODER_FREE(s, s->literal_hgroup.htrees);
+ BROTLI_DECODER_FREE(s, s->insert_copy_hgroup.htrees);
+ BROTLI_DECODER_FREE(s, s->distance_hgroup.htrees);
+}
+
+void BrotliDecoderStateCleanup(BrotliDecoderState* s) {
+ BrotliDecoderStateCleanupAfterMetablock(s);
+
+ BROTLI_DECODER_FREE(s, s->ringbuffer);
+ BROTLI_DECODER_FREE(s, s->block_type_trees);
+}
+
+BROTLI_BOOL BrotliDecoderHuffmanTreeGroupInit(BrotliDecoderState* s,
+ HuffmanTreeGroup* group, uint32_t alphabet_size_max,
+ uint32_t alphabet_size_limit, uint32_t ntrees) {
+ /* Pack two allocations into one */
+ const size_t max_table_size =
+ kMaxHuffmanTableSize[(alphabet_size_limit + 31) >> 5];
+ const size_t code_size = sizeof(HuffmanCode) * ntrees * max_table_size;
+ const size_t htree_size = sizeof(HuffmanCode*) * ntrees;
+ /* Pointer alignment is, hopefully, wider than sizeof(HuffmanCode). */
+ HuffmanCode** p = (HuffmanCode**)BROTLI_DECODER_ALLOC(s,
+ code_size + htree_size);
+ group->alphabet_size_max = (uint16_t)alphabet_size_max;
+ group->alphabet_size_limit = (uint16_t)alphabet_size_limit;
+ group->num_htrees = (uint16_t)ntrees;
+ group->htrees = p;
+ group->codes = (HuffmanCode*)(&p[ntrees]);
+ return !!p;
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/state.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/state.h
new file mode 100644
index 000000000..54dab698b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/dec/state.h
@@ -0,0 +1,365 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Brotli state for partial streaming decoding. */
+
+#ifndef BROTLI_DEC_STATE_H_
+#define BROTLI_DEC_STATE_H_
+
+#include "../common/constants.h"
+#include "../common/dictionary.h"
+#include "../common/platform.h"
+#include "../common/transform.h"
+#include <brotli/types.h>
+#include "./bit_reader.h"
+#include "./huffman.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* Graphviz diagram that describes state transitions:
+
+digraph States {
+ graph [compound=true]
+ concentrate=true
+ node [shape="box"]
+
+ UNINITED -> {LARGE_WINDOW_BITS -> INITIALIZE}
+ subgraph cluster_metablock_workflow {
+ style="rounded"
+ label=< <B>METABLOCK CYCLE</B> >
+ METABLOCK_BEGIN -> METABLOCK_HEADER
+ METABLOCK_HEADER:sw -> METADATA
+ METABLOCK_HEADER:s -> UNCOMPRESSED
+ METABLOCK_HEADER:se -> METABLOCK_DONE:ne
+ METADATA:s -> METABLOCK_DONE:w
+ UNCOMPRESSED:s -> METABLOCK_DONE:n
+ METABLOCK_DONE:e -> METABLOCK_BEGIN:e [constraint="false"]
+ }
+ INITIALIZE -> METABLOCK_BEGIN
+ METABLOCK_DONE -> DONE
+
+ subgraph cluster_compressed_metablock {
+ style="rounded"
+ label=< <B>COMPRESSED METABLOCK</B> >
+
+ subgraph cluster_command {
+ style="rounded"
+ label=< <B>HOT LOOP</B> >
+
+ _METABLOCK_DONE_PORT_ [shape=point style=invis]
+
+ {
+ // Set different shape for nodes returning from "compressed metablock".
+ node [shape=invhouse]; CMD_INNER CMD_POST_DECODE_LITERALS;
+ CMD_POST_WRAP_COPY; CMD_INNER_WRITE; CMD_POST_WRITE_1;
+ }
+
+ CMD_BEGIN -> CMD_INNER -> CMD_POST_DECODE_LITERALS -> CMD_POST_WRAP_COPY
+
+ // IO ("write") nodes are not in the hot loop!
+ CMD_INNER_WRITE [style=dashed]
+ CMD_INNER -> CMD_INNER_WRITE
+ CMD_POST_WRITE_1 [style=dashed]
+ CMD_POST_DECODE_LITERALS -> CMD_POST_WRITE_1
+ CMD_POST_WRITE_2 [style=dashed]
+ CMD_POST_WRAP_COPY -> CMD_POST_WRITE_2
+
+ CMD_POST_WRITE_1 -> CMD_BEGIN:s [constraint="false"]
+ CMD_INNER_WRITE -> {CMD_INNER CMD_POST_DECODE_LITERALS}
+ [constraint="false"]
+ CMD_BEGIN:ne -> CMD_POST_DECODE_LITERALS [constraint="false"]
+ CMD_POST_WRAP_COPY -> CMD_BEGIN [constraint="false"]
+ CMD_POST_DECODE_LITERALS -> CMD_BEGIN:ne [constraint="false"]
+ CMD_POST_WRITE_2 -> CMD_POST_WRAP_COPY [constraint="false"]
+ {rank=same; CMD_BEGIN; CMD_INNER; CMD_POST_DECODE_LITERALS;
+ CMD_POST_WRAP_COPY}
+ {rank=same; CMD_INNER_WRITE; CMD_POST_WRITE_1; CMD_POST_WRITE_2}
+
+ {CMD_INNER CMD_POST_DECODE_LITERALS CMD_POST_WRAP_COPY} ->
+ _METABLOCK_DONE_PORT_ [style=invis]
+ {CMD_INNER_WRITE CMD_POST_WRITE_1} -> _METABLOCK_DONE_PORT_
+ [constraint="false" style=invis]
+ }
+
+ BEFORE_COMPRESSED_METABLOCK_HEADER:s -> HUFFMAN_CODE_0:n
+ HUFFMAN_CODE_0 -> HUFFMAN_CODE_1 -> HUFFMAN_CODE_2 -> HUFFMAN_CODE_3
+ HUFFMAN_CODE_0 -> METABLOCK_HEADER_2 -> CONTEXT_MODES -> CONTEXT_MAP_1
+ CONTEXT_MAP_1 -> CONTEXT_MAP_2 -> TREE_GROUP
+ TREE_GROUP -> BEFORE_COMPRESSED_METABLOCK_BODY:e
+ BEFORE_COMPRESSED_METABLOCK_BODY:s -> CMD_BEGIN:n
+
+ HUFFMAN_CODE_3:e -> HUFFMAN_CODE_0:ne [constraint="false"]
+ {rank=same; HUFFMAN_CODE_0; HUFFMAN_CODE_1; HUFFMAN_CODE_2; HUFFMAN_CODE_3}
+ {rank=same; METABLOCK_HEADER_2; CONTEXT_MODES; CONTEXT_MAP_1; CONTEXT_MAP_2;
+ TREE_GROUP}
+ }
+ METABLOCK_HEADER:e -> BEFORE_COMPRESSED_METABLOCK_HEADER:n
+
+ _METABLOCK_DONE_PORT_ -> METABLOCK_DONE:se
+ [constraint="false" ltail=cluster_command]
+
+ UNINITED [shape=Mdiamond];
+ DONE [shape=Msquare];
+}
+
+
+ */
+
+typedef enum {
+ BROTLI_STATE_UNINITED,
+ BROTLI_STATE_LARGE_WINDOW_BITS,
+ BROTLI_STATE_INITIALIZE,
+ BROTLI_STATE_METABLOCK_BEGIN,
+ BROTLI_STATE_METABLOCK_HEADER,
+ BROTLI_STATE_METABLOCK_HEADER_2,
+ BROTLI_STATE_CONTEXT_MODES,
+ BROTLI_STATE_COMMAND_BEGIN,
+ BROTLI_STATE_COMMAND_INNER,
+ BROTLI_STATE_COMMAND_POST_DECODE_LITERALS,
+ BROTLI_STATE_COMMAND_POST_WRAP_COPY,
+ BROTLI_STATE_UNCOMPRESSED,
+ BROTLI_STATE_METADATA,
+ BROTLI_STATE_COMMAND_INNER_WRITE,
+ BROTLI_STATE_METABLOCK_DONE,
+ BROTLI_STATE_COMMAND_POST_WRITE_1,
+ BROTLI_STATE_COMMAND_POST_WRITE_2,
+ BROTLI_STATE_BEFORE_COMPRESSED_METABLOCK_HEADER,
+ BROTLI_STATE_HUFFMAN_CODE_0,
+ BROTLI_STATE_HUFFMAN_CODE_1,
+ BROTLI_STATE_HUFFMAN_CODE_2,
+ BROTLI_STATE_HUFFMAN_CODE_3,
+ BROTLI_STATE_CONTEXT_MAP_1,
+ BROTLI_STATE_CONTEXT_MAP_2,
+ BROTLI_STATE_TREE_GROUP,
+ BROTLI_STATE_BEFORE_COMPRESSED_METABLOCK_BODY,
+ BROTLI_STATE_DONE
+} BrotliRunningState;
+
+typedef enum {
+ BROTLI_STATE_METABLOCK_HEADER_NONE,
+ BROTLI_STATE_METABLOCK_HEADER_EMPTY,
+ BROTLI_STATE_METABLOCK_HEADER_NIBBLES,
+ BROTLI_STATE_METABLOCK_HEADER_SIZE,
+ BROTLI_STATE_METABLOCK_HEADER_UNCOMPRESSED,
+ BROTLI_STATE_METABLOCK_HEADER_RESERVED,
+ BROTLI_STATE_METABLOCK_HEADER_BYTES,
+ BROTLI_STATE_METABLOCK_HEADER_METADATA
+} BrotliRunningMetablockHeaderState;
+
+typedef enum {
+ BROTLI_STATE_UNCOMPRESSED_NONE,
+ BROTLI_STATE_UNCOMPRESSED_WRITE
+} BrotliRunningUncompressedState;
+
+typedef enum {
+ BROTLI_STATE_TREE_GROUP_NONE,
+ BROTLI_STATE_TREE_GROUP_LOOP
+} BrotliRunningTreeGroupState;
+
+typedef enum {
+ BROTLI_STATE_CONTEXT_MAP_NONE,
+ BROTLI_STATE_CONTEXT_MAP_READ_PREFIX,
+ BROTLI_STATE_CONTEXT_MAP_HUFFMAN,
+ BROTLI_STATE_CONTEXT_MAP_DECODE,
+ BROTLI_STATE_CONTEXT_MAP_TRANSFORM
+} BrotliRunningContextMapState;
+
+typedef enum {
+ BROTLI_STATE_HUFFMAN_NONE,
+ BROTLI_STATE_HUFFMAN_SIMPLE_SIZE,
+ BROTLI_STATE_HUFFMAN_SIMPLE_READ,
+ BROTLI_STATE_HUFFMAN_SIMPLE_BUILD,
+ BROTLI_STATE_HUFFMAN_COMPLEX,
+ BROTLI_STATE_HUFFMAN_LENGTH_SYMBOLS
+} BrotliRunningHuffmanState;
+
+typedef enum {
+ BROTLI_STATE_DECODE_UINT8_NONE,
+ BROTLI_STATE_DECODE_UINT8_SHORT,
+ BROTLI_STATE_DECODE_UINT8_LONG
+} BrotliRunningDecodeUint8State;
+
+typedef enum {
+ BROTLI_STATE_READ_BLOCK_LENGTH_NONE,
+ BROTLI_STATE_READ_BLOCK_LENGTH_SUFFIX
+} BrotliRunningReadBlockLengthState;
+
+typedef struct BrotliMetablockHeaderArena {
+ BrotliRunningTreeGroupState substate_tree_group;
+ BrotliRunningContextMapState substate_context_map;
+ BrotliRunningHuffmanState substate_huffman;
+
+ uint32_t sub_loop_counter;
+
+ uint32_t repeat_code_len;
+ uint32_t prev_code_len;
+
+ /* For ReadHuffmanCode. */
+ uint32_t symbol;
+ uint32_t repeat;
+ uint32_t space;
+
+ /* Huffman table for "histograms". */
+ HuffmanCode table[32];
+ /* List of heads of symbol chains. */
+ uint16_t* symbol_lists;
+ /* Storage from symbol_lists. */
+ uint16_t symbols_lists_array[BROTLI_HUFFMAN_MAX_CODE_LENGTH + 1 +
+ BROTLI_NUM_COMMAND_SYMBOLS];
+ /* Tails of symbol chains. */
+ int next_symbol[32];
+ uint8_t code_length_code_lengths[BROTLI_CODE_LENGTH_CODES];
+ /* Population counts for the code lengths. */
+ uint16_t code_length_histo[16];
+
+ /* For HuffmanTreeGroupDecode. */
+ int htree_index;
+ HuffmanCode* next;
+
+ /* For DecodeContextMap. */
+ uint32_t context_index;
+ uint32_t max_run_length_prefix;
+ uint32_t code;
+ HuffmanCode context_map_table[BROTLI_HUFFMAN_MAX_SIZE_272];
+} BrotliMetablockHeaderArena;
+
+typedef struct BrotliMetablockBodyArena {
+ uint8_t dist_extra_bits[544];
+ uint32_t dist_offset[544];
+} BrotliMetablockBodyArena;
+
+struct BrotliDecoderStateStruct {
+ BrotliRunningState state;
+
+ /* This counter is reused for several disjoint loops. */
+ int loop_counter;
+
+ BrotliBitReader br;
+
+ brotli_alloc_func alloc_func;
+ brotli_free_func free_func;
+ void* memory_manager_opaque;
+
+ /* Temporary storage for remaining input. Brotli stream format is designed in
+ a way, that 64 bits are enough to make progress in decoding. */
+ union {
+ uint64_t u64;
+ uint8_t u8[8];
+ } buffer;
+ uint32_t buffer_length;
+
+ int pos;
+ int max_backward_distance;
+ int max_distance;
+ int ringbuffer_size;
+ int ringbuffer_mask;
+ int dist_rb_idx;
+ int dist_rb[4];
+ int error_code;
+ uint8_t* ringbuffer;
+ uint8_t* ringbuffer_end;
+ HuffmanCode* htree_command;
+ const uint8_t* context_lookup;
+ uint8_t* context_map_slice;
+ uint8_t* dist_context_map_slice;
+
+ /* This ring buffer holds a few past copy distances that will be used by
+ some special distance codes. */
+ HuffmanTreeGroup literal_hgroup;
+ HuffmanTreeGroup insert_copy_hgroup;
+ HuffmanTreeGroup distance_hgroup;
+ HuffmanCode* block_type_trees;
+ HuffmanCode* block_len_trees;
+ /* This is true if the literal context map histogram type always matches the
+ block type. It is then not needed to keep the context (faster decoding). */
+ int trivial_literal_context;
+ /* Distance context is actual after command is decoded and before distance is
+ computed. After distance computation it is used as a temporary variable. */
+ int distance_context;
+ int meta_block_remaining_len;
+ uint32_t block_length_index;
+ uint32_t block_length[3];
+ uint32_t num_block_types[3];
+ uint32_t block_type_rb[6];
+ uint32_t distance_postfix_bits;
+ uint32_t num_direct_distance_codes;
+ uint32_t num_dist_htrees;
+ uint8_t* dist_context_map;
+ HuffmanCode* literal_htree;
+ uint8_t dist_htree_index;
+
+ int copy_length;
+ int distance_code;
+
+ /* For partial write operations. */
+ size_t rb_roundtrips; /* how many times we went around the ring-buffer */
+ size_t partial_pos_out; /* how much output to the user in total */
+
+ /* For InverseMoveToFrontTransform. */
+ uint32_t mtf_upper_bound;
+ uint32_t mtf[64 + 1];
+
+ /* Less used attributes are at the end of this struct. */
+
+ /* States inside function calls. */
+ BrotliRunningMetablockHeaderState substate_metablock_header;
+ BrotliRunningUncompressedState substate_uncompressed;
+ BrotliRunningDecodeUint8State substate_decode_uint8;
+ BrotliRunningReadBlockLengthState substate_read_block_length;
+
+ unsigned int is_last_metablock : 1;
+ unsigned int is_uncompressed : 1;
+ unsigned int is_metadata : 1;
+ unsigned int should_wrap_ringbuffer : 1;
+ unsigned int canny_ringbuffer_allocation : 1;
+ unsigned int large_window : 1;
+ unsigned int size_nibbles : 8;
+ uint32_t window_bits;
+
+ int new_ringbuffer_size;
+
+ uint32_t num_literal_htrees;
+ uint8_t* context_map;
+ uint8_t* context_modes;
+
+ const BrotliDictionary* dictionary;
+ const BrotliTransforms* transforms;
+
+ uint32_t trivial_literal_contexts[8]; /* 256 bits */
+
+ union {
+ BrotliMetablockHeaderArena header;
+ BrotliMetablockBodyArena body;
+ } arena;
+};
+
+typedef struct BrotliDecoderStateStruct BrotliDecoderStateInternal;
+#define BrotliDecoderState BrotliDecoderStateInternal
+
+BROTLI_INTERNAL BROTLI_BOOL BrotliDecoderStateInit(BrotliDecoderState* s,
+ brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque);
+BROTLI_INTERNAL void BrotliDecoderStateCleanup(BrotliDecoderState* s);
+BROTLI_INTERNAL void BrotliDecoderStateMetablockBegin(BrotliDecoderState* s);
+BROTLI_INTERNAL void BrotliDecoderStateCleanupAfterMetablock(
+ BrotliDecoderState* s);
+BROTLI_INTERNAL BROTLI_BOOL BrotliDecoderHuffmanTreeGroupInit(
+ BrotliDecoderState* s, HuffmanTreeGroup* group, uint32_t alphabet_size_max,
+ uint32_t alphabet_size_limit, uint32_t ntrees);
+
+#define BROTLI_DECODER_ALLOC(S, L) S->alloc_func(S->memory_manager_opaque, L)
+
+#define BROTLI_DECODER_FREE(S, X) { \
+ S->free_func(S->memory_manager_opaque, X); \
+ X = NULL; \
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_DEC_STATE_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references.c
new file mode 100644
index 000000000..a07a617a0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references.c
@@ -0,0 +1,145 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Function to find backward reference copies. */
+
+#include "./backward_references.h"
+
+#include "../common/constants.h"
+#include "../common/context.h"
+#include "../common/dictionary.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./command.h"
+#include "./dictionary_hash.h"
+#include "./memory.h"
+#include "./quality.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+static BROTLI_INLINE size_t ComputeDistanceCode(size_t distance,
+ size_t max_distance,
+ const int* dist_cache) {
+ if (distance <= max_distance) {
+ size_t distance_plus_3 = distance + 3;
+ size_t offset0 = distance_plus_3 - (size_t)dist_cache[0];
+ size_t offset1 = distance_plus_3 - (size_t)dist_cache[1];
+ if (distance == (size_t)dist_cache[0]) {
+ return 0;
+ } else if (distance == (size_t)dist_cache[1]) {
+ return 1;
+ } else if (offset0 < 7) {
+ return (0x9750468 >> (4 * offset0)) & 0xF;
+ } else if (offset1 < 7) {
+ return (0xFDB1ACE >> (4 * offset1)) & 0xF;
+ } else if (distance == (size_t)dist_cache[2]) {
+ return 2;
+ } else if (distance == (size_t)dist_cache[3]) {
+ return 3;
+ }
+ }
+ return distance + BROTLI_NUM_DISTANCE_SHORT_CODES - 1;
+}
+
+#define EXPAND_CAT(a, b) CAT(a, b)
+#define CAT(a, b) a ## b
+#define FN(X) EXPAND_CAT(X, HASHER())
+#define EXPORT_FN(X) EXPAND_CAT(X, EXPAND_CAT(PREFIX(), HASHER()))
+
+#define PREFIX() N
+
+#define HASHER() H2
+/* NOLINTNEXTLINE(build/include) */
+#include "./backward_references_inc.h"
+#undef HASHER
+
+#define HASHER() H3
+/* NOLINTNEXTLINE(build/include) */
+#include "./backward_references_inc.h"
+#undef HASHER
+
+#define HASHER() H4
+/* NOLINTNEXTLINE(build/include) */
+#include "./backward_references_inc.h"
+#undef HASHER
+
+#define HASHER() H5
+/* NOLINTNEXTLINE(build/include) */
+#include "./backward_references_inc.h"
+#undef HASHER
+
+#define HASHER() H6
+/* NOLINTNEXTLINE(build/include) */
+#include "./backward_references_inc.h"
+#undef HASHER
+
+#define HASHER() H40
+/* NOLINTNEXTLINE(build/include) */
+#include "./backward_references_inc.h"
+#undef HASHER
+
+#define HASHER() H41
+/* NOLINTNEXTLINE(build/include) */
+#include "./backward_references_inc.h"
+#undef HASHER
+
+#define HASHER() H42
+/* NOLINTNEXTLINE(build/include) */
+#include "./backward_references_inc.h"
+#undef HASHER
+
+#define HASHER() H54
+/* NOLINTNEXTLINE(build/include) */
+#include "./backward_references_inc.h"
+#undef HASHER
+
+#define HASHER() H35
+/* NOLINTNEXTLINE(build/include) */
+#include "./backward_references_inc.h"
+#undef HASHER
+
+#define HASHER() H55
+/* NOLINTNEXTLINE(build/include) */
+#include "./backward_references_inc.h"
+#undef HASHER
+
+#define HASHER() H65
+/* NOLINTNEXTLINE(build/include) */
+#include "./backward_references_inc.h"
+#undef HASHER
+
+#undef PREFIX
+
+#undef EXPORT_FN
+#undef FN
+#undef CAT
+#undef EXPAND_CAT
+
+void BrotliCreateBackwardReferences(size_t num_bytes,
+ size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ ContextLut literal_context_lut, const BrotliEncoderParams* params,
+ Hasher* hasher, int* dist_cache, size_t* last_insert_len,
+ Command* commands, size_t* num_commands, size_t* num_literals) {
+ switch (params->hasher.type) {
+#define CASE_(N) \
+ case N: \
+ CreateBackwardReferencesNH ## N(num_bytes, \
+ position, ringbuffer, ringbuffer_mask, \
+ literal_context_lut, params, hasher, dist_cache, \
+ last_insert_len, commands, num_commands, num_literals); \
+ return;
+ FOR_GENERIC_HASHERS(CASE_)
+#undef CASE_
+ default:
+ break;
+ }
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references.h
new file mode 100644
index 000000000..9589cc154
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references.h
@@ -0,0 +1,39 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Function to find backward reference copies. */
+
+#ifndef BROTLI_ENC_BACKWARD_REFERENCES_H_
+#define BROTLI_ENC_BACKWARD_REFERENCES_H_
+
+#include "../common/constants.h"
+#include "../common/context.h"
+#include "../common/dictionary.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./command.h"
+#include "./hash.h"
+#include "./quality.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* "commands" points to the next output command to write to, "*num_commands" is
+ initially the total amount of commands output by previous
+ CreateBackwardReferences calls, and must be incremented by the amount written
+ by this call. */
+BROTLI_INTERNAL void BrotliCreateBackwardReferences(size_t num_bytes,
+ size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ ContextLut literal_context_lut, const BrotliEncoderParams* params,
+ Hasher* hasher, int* dist_cache, size_t* last_insert_len,
+ Command* commands, size_t* num_commands, size_t* num_literals);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_BACKWARD_REFERENCES_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references_hq.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references_hq.c
new file mode 100644
index 000000000..5651caeb7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references_hq.c
@@ -0,0 +1,843 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Function to find backward reference copies. */
+
+#include "./backward_references_hq.h"
+
+#include <string.h> /* memcpy, memset */
+
+#include "../common/constants.h"
+#include "../common/context.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./command.h"
+#include "./fast_log.h"
+#include "./find_match_length.h"
+#include "./literal_cost.h"
+#include "./memory.h"
+#include "./params.h"
+#include "./prefix.h"
+#include "./quality.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* BrotliCalculateDistanceCodeLimit(BROTLI_MAX_ALLOWED_DISTANCE, 3, 120). */
+#define BROTLI_MAX_EFFECTIVE_DISTANCE_ALPHABET_SIZE 544
+
+static const float kInfinity = 1.7e38f; /* ~= 2 ^ 127 */
+
+static const uint32_t kDistanceCacheIndex[] = {
+ 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
+};
+static const int kDistanceCacheOffset[] = {
+ 0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3
+};
+
+void BrotliInitZopfliNodes(ZopfliNode* array, size_t length) {
+ ZopfliNode stub;
+ size_t i;
+ stub.length = 1;
+ stub.distance = 0;
+ stub.dcode_insert_length = 0;
+ stub.u.cost = kInfinity;
+ for (i = 0; i < length; ++i) array[i] = stub;
+}
+
+static BROTLI_INLINE uint32_t ZopfliNodeCopyLength(const ZopfliNode* self) {
+ return self->length & 0x1FFFFFF;
+}
+
+static BROTLI_INLINE uint32_t ZopfliNodeLengthCode(const ZopfliNode* self) {
+ const uint32_t modifier = self->length >> 25;
+ return ZopfliNodeCopyLength(self) + 9u - modifier;
+}
+
+static BROTLI_INLINE uint32_t ZopfliNodeCopyDistance(const ZopfliNode* self) {
+ return self->distance;
+}
+
+static BROTLI_INLINE uint32_t ZopfliNodeDistanceCode(const ZopfliNode* self) {
+ const uint32_t short_code = self->dcode_insert_length >> 27;
+ return short_code == 0 ?
+ ZopfliNodeCopyDistance(self) + BROTLI_NUM_DISTANCE_SHORT_CODES - 1 :
+ short_code - 1;
+}
+
+static BROTLI_INLINE uint32_t ZopfliNodeCommandLength(const ZopfliNode* self) {
+ return ZopfliNodeCopyLength(self) + (self->dcode_insert_length & 0x7FFFFFF);
+}
+
+/* Histogram based cost model for zopflification. */
+typedef struct ZopfliCostModel {
+ /* The insert and copy length symbols. */
+ float cost_cmd_[BROTLI_NUM_COMMAND_SYMBOLS];
+ float* cost_dist_;
+ uint32_t distance_histogram_size;
+ /* Cumulative costs of literals per position in the stream. */
+ float* literal_costs_;
+ float min_cost_cmd_;
+ size_t num_bytes_;
+} ZopfliCostModel;
+
+static void InitZopfliCostModel(
+ MemoryManager* m, ZopfliCostModel* self, const BrotliDistanceParams* dist,
+ size_t num_bytes) {
+ self->num_bytes_ = num_bytes;
+ self->literal_costs_ = BROTLI_ALLOC(m, float, num_bytes + 2);
+ self->cost_dist_ = BROTLI_ALLOC(m, float, dist->alphabet_size_limit);
+ self->distance_histogram_size = dist->alphabet_size_limit;
+ if (BROTLI_IS_OOM(m)) return;
+}
+
+static void CleanupZopfliCostModel(MemoryManager* m, ZopfliCostModel* self) {
+ BROTLI_FREE(m, self->literal_costs_);
+ BROTLI_FREE(m, self->cost_dist_);
+}
+
+static void SetCost(const uint32_t* histogram, size_t histogram_size,
+ BROTLI_BOOL literal_histogram, float* cost) {
+ size_t sum = 0;
+ size_t missing_symbol_sum;
+ float log2sum;
+ float missing_symbol_cost;
+ size_t i;
+ for (i = 0; i < histogram_size; i++) {
+ sum += histogram[i];
+ }
+ log2sum = (float)FastLog2(sum);
+ missing_symbol_sum = sum;
+ if (!literal_histogram) {
+ for (i = 0; i < histogram_size; i++) {
+ if (histogram[i] == 0) missing_symbol_sum++;
+ }
+ }
+ missing_symbol_cost = (float)FastLog2(missing_symbol_sum) + 2;
+ for (i = 0; i < histogram_size; i++) {
+ if (histogram[i] == 0) {
+ cost[i] = missing_symbol_cost;
+ continue;
+ }
+
+ /* Shannon bits for this symbol. */
+ cost[i] = log2sum - (float)FastLog2(histogram[i]);
+
+ /* Cannot be coded with less than 1 bit */
+ if (cost[i] < 1) cost[i] = 1;
+ }
+}
+
+static void ZopfliCostModelSetFromCommands(ZopfliCostModel* self,
+ size_t position,
+ const uint8_t* ringbuffer,
+ size_t ringbuffer_mask,
+ const Command* commands,
+ size_t num_commands,
+ size_t last_insert_len) {
+ uint32_t histogram_literal[BROTLI_NUM_LITERAL_SYMBOLS];
+ uint32_t histogram_cmd[BROTLI_NUM_COMMAND_SYMBOLS];
+ uint32_t histogram_dist[BROTLI_MAX_EFFECTIVE_DISTANCE_ALPHABET_SIZE];
+ float cost_literal[BROTLI_NUM_LITERAL_SYMBOLS];
+ size_t pos = position - last_insert_len;
+ float min_cost_cmd = kInfinity;
+ size_t i;
+ float* cost_cmd = self->cost_cmd_;
+
+ memset(histogram_literal, 0, sizeof(histogram_literal));
+ memset(histogram_cmd, 0, sizeof(histogram_cmd));
+ memset(histogram_dist, 0, sizeof(histogram_dist));
+
+ for (i = 0; i < num_commands; i++) {
+ size_t inslength = commands[i].insert_len_;
+ size_t copylength = CommandCopyLen(&commands[i]);
+ size_t distcode = commands[i].dist_prefix_ & 0x3FF;
+ size_t cmdcode = commands[i].cmd_prefix_;
+ size_t j;
+
+ histogram_cmd[cmdcode]++;
+ if (cmdcode >= 128) histogram_dist[distcode]++;
+
+ for (j = 0; j < inslength; j++) {
+ histogram_literal[ringbuffer[(pos + j) & ringbuffer_mask]]++;
+ }
+
+ pos += inslength + copylength;
+ }
+
+ SetCost(histogram_literal, BROTLI_NUM_LITERAL_SYMBOLS, BROTLI_TRUE,
+ cost_literal);
+ SetCost(histogram_cmd, BROTLI_NUM_COMMAND_SYMBOLS, BROTLI_FALSE,
+ cost_cmd);
+ SetCost(histogram_dist, self->distance_histogram_size, BROTLI_FALSE,
+ self->cost_dist_);
+
+ for (i = 0; i < BROTLI_NUM_COMMAND_SYMBOLS; ++i) {
+ min_cost_cmd = BROTLI_MIN(float, min_cost_cmd, cost_cmd[i]);
+ }
+ self->min_cost_cmd_ = min_cost_cmd;
+
+ {
+ float* literal_costs = self->literal_costs_;
+ float literal_carry = 0.0;
+ size_t num_bytes = self->num_bytes_;
+ literal_costs[0] = 0.0;
+ for (i = 0; i < num_bytes; ++i) {
+ literal_carry +=
+ cost_literal[ringbuffer[(position + i) & ringbuffer_mask]];
+ literal_costs[i + 1] = literal_costs[i] + literal_carry;
+ literal_carry -= literal_costs[i + 1] - literal_costs[i];
+ }
+ }
+}
+
+static void ZopfliCostModelSetFromLiteralCosts(ZopfliCostModel* self,
+ size_t position,
+ const uint8_t* ringbuffer,
+ size_t ringbuffer_mask) {
+ float* literal_costs = self->literal_costs_;
+ float literal_carry = 0.0;
+ float* cost_dist = self->cost_dist_;
+ float* cost_cmd = self->cost_cmd_;
+ size_t num_bytes = self->num_bytes_;
+ size_t i;
+ BrotliEstimateBitCostsForLiterals(position, num_bytes, ringbuffer_mask,
+ ringbuffer, &literal_costs[1]);
+ literal_costs[0] = 0.0;
+ for (i = 0; i < num_bytes; ++i) {
+ literal_carry += literal_costs[i + 1];
+ literal_costs[i + 1] = literal_costs[i] + literal_carry;
+ literal_carry -= literal_costs[i + 1] - literal_costs[i];
+ }
+ for (i = 0; i < BROTLI_NUM_COMMAND_SYMBOLS; ++i) {
+ cost_cmd[i] = (float)FastLog2(11 + (uint32_t)i);
+ }
+ for (i = 0; i < self->distance_histogram_size; ++i) {
+ cost_dist[i] = (float)FastLog2(20 + (uint32_t)i);
+ }
+ self->min_cost_cmd_ = (float)FastLog2(11);
+}
+
+static BROTLI_INLINE float ZopfliCostModelGetCommandCost(
+ const ZopfliCostModel* self, uint16_t cmdcode) {
+ return self->cost_cmd_[cmdcode];
+}
+
+static BROTLI_INLINE float ZopfliCostModelGetDistanceCost(
+ const ZopfliCostModel* self, size_t distcode) {
+ return self->cost_dist_[distcode];
+}
+
+static BROTLI_INLINE float ZopfliCostModelGetLiteralCosts(
+ const ZopfliCostModel* self, size_t from, size_t to) {
+ return self->literal_costs_[to] - self->literal_costs_[from];
+}
+
+static BROTLI_INLINE float ZopfliCostModelGetMinCostCmd(
+ const ZopfliCostModel* self) {
+ return self->min_cost_cmd_;
+}
+
+/* REQUIRES: len >= 2, start_pos <= pos */
+/* REQUIRES: cost < kInfinity, nodes[start_pos].cost < kInfinity */
+/* Maintains the "ZopfliNode array invariant". */
+static BROTLI_INLINE void UpdateZopfliNode(ZopfliNode* nodes, size_t pos,
+ size_t start_pos, size_t len, size_t len_code, size_t dist,
+ size_t short_code, float cost) {
+ ZopfliNode* next = &nodes[pos + len];
+ next->length = (uint32_t)(len | ((len + 9u - len_code) << 25));
+ next->distance = (uint32_t)dist;
+ next->dcode_insert_length = (uint32_t)(
+ (short_code << 27) | (pos - start_pos));
+ next->u.cost = cost;
+}
+
+typedef struct PosData {
+ size_t pos;
+ int distance_cache[4];
+ float costdiff;
+ float cost;
+} PosData;
+
+/* Maintains the smallest 8 cost difference together with their positions */
+typedef struct StartPosQueue {
+ PosData q_[8];
+ size_t idx_;
+} StartPosQueue;
+
+static BROTLI_INLINE void InitStartPosQueue(StartPosQueue* self) {
+ self->idx_ = 0;
+}
+
+static size_t StartPosQueueSize(const StartPosQueue* self) {
+ return BROTLI_MIN(size_t, self->idx_, 8);
+}
+
+static void StartPosQueuePush(StartPosQueue* self, const PosData* posdata) {
+ size_t offset = ~(self->idx_++) & 7;
+ size_t len = StartPosQueueSize(self);
+ size_t i;
+ PosData* q = self->q_;
+ q[offset] = *posdata;
+ /* Restore the sorted order. In the list of |len| items at most |len - 1|
+ adjacent element comparisons / swaps are required. */
+ for (i = 1; i < len; ++i) {
+ if (q[offset & 7].costdiff > q[(offset + 1) & 7].costdiff) {
+ BROTLI_SWAP(PosData, q, offset & 7, (offset + 1) & 7);
+ }
+ ++offset;
+ }
+}
+
+static const PosData* StartPosQueueAt(const StartPosQueue* self, size_t k) {
+ return &self->q_[(k - self->idx_) & 7];
+}
+
+/* Returns the minimum possible copy length that can improve the cost of any */
+/* future position. */
+static size_t ComputeMinimumCopyLength(const float start_cost,
+ const ZopfliNode* nodes,
+ const size_t num_bytes,
+ const size_t pos) {
+ /* Compute the minimum possible cost of reaching any future position. */
+ float min_cost = start_cost;
+ size_t len = 2;
+ size_t next_len_bucket = 4;
+ size_t next_len_offset = 10;
+ while (pos + len <= num_bytes && nodes[pos + len].u.cost <= min_cost) {
+ /* We already reached (pos + len) with no more cost than the minimum
+ possible cost of reaching anything from this pos, so there is no point in
+ looking for lengths <= len. */
+ ++len;
+ if (len == next_len_offset) {
+ /* We reached the next copy length code bucket, so we add one more
+ extra bit to the minimum cost. */
+ min_cost += 1.0f;
+ next_len_offset += next_len_bucket;
+ next_len_bucket *= 2;
+ }
+ }
+ return len;
+}
+
+/* REQUIRES: nodes[pos].cost < kInfinity
+ REQUIRES: nodes[0..pos] satisfies that "ZopfliNode array invariant". */
+static uint32_t ComputeDistanceShortcut(const size_t block_start,
+ const size_t pos,
+ const size_t max_backward_limit,
+ const size_t gap,
+ const ZopfliNode* nodes) {
+ const size_t clen = ZopfliNodeCopyLength(&nodes[pos]);
+ const size_t ilen = nodes[pos].dcode_insert_length & 0x7FFFFFF;
+ const size_t dist = ZopfliNodeCopyDistance(&nodes[pos]);
+ /* Since |block_start + pos| is the end position of the command, the copy part
+ starts from |block_start + pos - clen|. Distances that are greater than
+ this or greater than |max_backward_limit| + |gap| are static dictionary
+ references, and do not update the last distances.
+ Also distance code 0 (last distance) does not update the last distances. */
+ if (pos == 0) {
+ return 0;
+ } else if (dist + clen <= block_start + pos + gap &&
+ dist <= max_backward_limit + gap &&
+ ZopfliNodeDistanceCode(&nodes[pos]) > 0) {
+ return (uint32_t)pos;
+ } else {
+ return nodes[pos - clen - ilen].u.shortcut;
+ }
+}
+
+/* Fills in dist_cache[0..3] with the last four distances (as defined by
+ Section 4. of the Spec) that would be used at (block_start + pos) if we
+ used the shortest path of commands from block_start, computed from
+ nodes[0..pos]. The last four distances at block_start are in
+ starting_dist_cache[0..3].
+ REQUIRES: nodes[pos].cost < kInfinity
+ REQUIRES: nodes[0..pos] satisfies that "ZopfliNode array invariant". */
+static void ComputeDistanceCache(const size_t pos,
+ const int* starting_dist_cache,
+ const ZopfliNode* nodes,
+ int* dist_cache) {
+ int idx = 0;
+ size_t p = nodes[pos].u.shortcut;
+ while (idx < 4 && p > 0) {
+ const size_t ilen = nodes[p].dcode_insert_length & 0x7FFFFFF;
+ const size_t clen = ZopfliNodeCopyLength(&nodes[p]);
+ const size_t dist = ZopfliNodeCopyDistance(&nodes[p]);
+ dist_cache[idx++] = (int)dist;
+ /* Because of prerequisite, p >= clen + ilen >= 2. */
+ p = nodes[p - clen - ilen].u.shortcut;
+ }
+ for (; idx < 4; ++idx) {
+ dist_cache[idx] = *starting_dist_cache++;
+ }
+}
+
+/* Maintains "ZopfliNode array invariant" and pushes node to the queue, if it
+ is eligible. */
+static void EvaluateNode(
+ const size_t block_start, const size_t pos, const size_t max_backward_limit,
+ const size_t gap, const int* starting_dist_cache,
+ const ZopfliCostModel* model, StartPosQueue* queue, ZopfliNode* nodes) {
+ /* Save cost, because ComputeDistanceCache invalidates it. */
+ float node_cost = nodes[pos].u.cost;
+ nodes[pos].u.shortcut = ComputeDistanceShortcut(
+ block_start, pos, max_backward_limit, gap, nodes);
+ if (node_cost <= ZopfliCostModelGetLiteralCosts(model, 0, pos)) {
+ PosData posdata;
+ posdata.pos = pos;
+ posdata.cost = node_cost;
+ posdata.costdiff = node_cost -
+ ZopfliCostModelGetLiteralCosts(model, 0, pos);
+ ComputeDistanceCache(
+ pos, starting_dist_cache, nodes, posdata.distance_cache);
+ StartPosQueuePush(queue, &posdata);
+ }
+}
+
+/* Returns longest copy length. */
+static size_t UpdateNodes(
+ const size_t num_bytes, const size_t block_start, const size_t pos,
+ const uint8_t* ringbuffer, const size_t ringbuffer_mask,
+ const BrotliEncoderParams* params, const size_t max_backward_limit,
+ const int* starting_dist_cache, const size_t num_matches,
+ const BackwardMatch* matches, const ZopfliCostModel* model,
+ StartPosQueue* queue, ZopfliNode* nodes) {
+ const size_t stream_offset = params->stream_offset;
+ const size_t cur_ix = block_start + pos;
+ const size_t cur_ix_masked = cur_ix & ringbuffer_mask;
+ const size_t max_distance = BROTLI_MIN(size_t, cur_ix, max_backward_limit);
+ const size_t dictionary_start = BROTLI_MIN(size_t,
+ cur_ix + stream_offset, max_backward_limit);
+ const size_t max_len = num_bytes - pos;
+ const size_t max_zopfli_len = MaxZopfliLen(params);
+ const size_t max_iters = MaxZopfliCandidates(params);
+ size_t min_len;
+ size_t result = 0;
+ size_t k;
+ size_t gap = 0;
+
+ EvaluateNode(block_start + stream_offset, pos, max_backward_limit, gap,
+ starting_dist_cache, model, queue, nodes);
+
+ {
+ const PosData* posdata = StartPosQueueAt(queue, 0);
+ float min_cost = (posdata->cost + ZopfliCostModelGetMinCostCmd(model) +
+ ZopfliCostModelGetLiteralCosts(model, posdata->pos, pos));
+ min_len = ComputeMinimumCopyLength(min_cost, nodes, num_bytes, pos);
+ }
+
+ /* Go over the command starting positions in order of increasing cost
+ difference. */
+ for (k = 0; k < max_iters && k < StartPosQueueSize(queue); ++k) {
+ const PosData* posdata = StartPosQueueAt(queue, k);
+ const size_t start = posdata->pos;
+ const uint16_t inscode = GetInsertLengthCode(pos - start);
+ const float start_costdiff = posdata->costdiff;
+ const float base_cost = start_costdiff + (float)GetInsertExtra(inscode) +
+ ZopfliCostModelGetLiteralCosts(model, 0, pos);
+
+ /* Look for last distance matches using the distance cache from this
+ starting position. */
+ size_t best_len = min_len - 1;
+ size_t j = 0;
+ for (; j < BROTLI_NUM_DISTANCE_SHORT_CODES && best_len < max_len; ++j) {
+ const size_t idx = kDistanceCacheIndex[j];
+ const size_t backward =
+ (size_t)(posdata->distance_cache[idx] + kDistanceCacheOffset[j]);
+ size_t prev_ix = cur_ix - backward;
+ size_t len = 0;
+ uint8_t continuation = ringbuffer[cur_ix_masked + best_len];
+ if (cur_ix_masked + best_len > ringbuffer_mask) {
+ break;
+ }
+ if (BROTLI_PREDICT_FALSE(backward > dictionary_start + gap)) {
+ /* Word dictionary -> ignore. */
+ continue;
+ }
+ if (backward <= max_distance) {
+ /* Regular backward reference. */
+ if (prev_ix >= cur_ix) {
+ continue;
+ }
+
+ prev_ix &= ringbuffer_mask;
+ if (prev_ix + best_len > ringbuffer_mask ||
+ continuation != ringbuffer[prev_ix + best_len]) {
+ continue;
+ }
+ len = FindMatchLengthWithLimit(&ringbuffer[prev_ix],
+ &ringbuffer[cur_ix_masked],
+ max_len);
+ } else {
+ /* "Gray" area. It is addressable by decoder, but this encoder
+ instance does not have that data -> should not touch it. */
+ continue;
+ }
+ {
+ const float dist_cost = base_cost +
+ ZopfliCostModelGetDistanceCost(model, j);
+ size_t l;
+ for (l = best_len + 1; l <= len; ++l) {
+ const uint16_t copycode = GetCopyLengthCode(l);
+ const uint16_t cmdcode =
+ CombineLengthCodes(inscode, copycode, j == 0);
+ const float cost = (cmdcode < 128 ? base_cost : dist_cost) +
+ (float)GetCopyExtra(copycode) +
+ ZopfliCostModelGetCommandCost(model, cmdcode);
+ if (cost < nodes[pos + l].u.cost) {
+ UpdateZopfliNode(nodes, pos, start, l, l, backward, j + 1, cost);
+ result = BROTLI_MAX(size_t, result, l);
+ }
+ best_len = l;
+ }
+ }
+ }
+
+ /* At higher iterations look only for new last distance matches, since
+ looking only for new command start positions with the same distances
+ does not help much. */
+ if (k >= 2) continue;
+
+ {
+ /* Loop through all possible copy lengths at this position. */
+ size_t len = min_len;
+ for (j = 0; j < num_matches; ++j) {
+ BackwardMatch match = matches[j];
+ size_t dist = match.distance;
+ BROTLI_BOOL is_dictionary_match =
+ TO_BROTLI_BOOL(dist > dictionary_start + gap);
+ /* We already tried all possible last distance matches, so we can use
+ normal distance code here. */
+ size_t dist_code = dist + BROTLI_NUM_DISTANCE_SHORT_CODES - 1;
+ uint16_t dist_symbol;
+ uint32_t distextra;
+ uint32_t distnumextra;
+ float dist_cost;
+ size_t max_match_len;
+ PrefixEncodeCopyDistance(
+ dist_code, params->dist.num_direct_distance_codes,
+ params->dist.distance_postfix_bits, &dist_symbol, &distextra);
+ distnumextra = dist_symbol >> 10;
+ dist_cost = base_cost + (float)distnumextra +
+ ZopfliCostModelGetDistanceCost(model, dist_symbol & 0x3FF);
+
+ /* Try all copy lengths up until the maximum copy length corresponding
+ to this distance. If the distance refers to the static dictionary, or
+ the maximum length is long enough, try only one maximum length. */
+ max_match_len = BackwardMatchLength(&match);
+ if (len < max_match_len &&
+ (is_dictionary_match || max_match_len > max_zopfli_len)) {
+ len = max_match_len;
+ }
+ for (; len <= max_match_len; ++len) {
+ const size_t len_code =
+ is_dictionary_match ? BackwardMatchLengthCode(&match) : len;
+ const uint16_t copycode = GetCopyLengthCode(len_code);
+ const uint16_t cmdcode = CombineLengthCodes(inscode, copycode, 0);
+ const float cost = dist_cost + (float)GetCopyExtra(copycode) +
+ ZopfliCostModelGetCommandCost(model, cmdcode);
+ if (cost < nodes[pos + len].u.cost) {
+ UpdateZopfliNode(nodes, pos, start, len, len_code, dist, 0, cost);
+ result = BROTLI_MAX(size_t, result, len);
+ }
+ }
+ }
+ }
+ }
+ return result;
+}
+
+static size_t ComputeShortestPathFromNodes(size_t num_bytes,
+ ZopfliNode* nodes) {
+ size_t index = num_bytes;
+ size_t num_commands = 0;
+ while ((nodes[index].dcode_insert_length & 0x7FFFFFF) == 0 &&
+ nodes[index].length == 1) --index;
+ nodes[index].u.next = BROTLI_UINT32_MAX;
+ while (index != 0) {
+ size_t len = ZopfliNodeCommandLength(&nodes[index]);
+ index -= len;
+ nodes[index].u.next = (uint32_t)len;
+ num_commands++;
+ }
+ return num_commands;
+}
+
+/* REQUIRES: nodes != NULL and len(nodes) >= num_bytes + 1 */
+void BrotliZopfliCreateCommands(const size_t num_bytes,
+ const size_t block_start, const ZopfliNode* nodes, int* dist_cache,
+ size_t* last_insert_len, const BrotliEncoderParams* params,
+ Command* commands, size_t* num_literals) {
+ const size_t stream_offset = params->stream_offset;
+ const size_t max_backward_limit = BROTLI_MAX_BACKWARD_LIMIT(params->lgwin);
+ size_t pos = 0;
+ uint32_t offset = nodes[0].u.next;
+ size_t i;
+ size_t gap = 0;
+ for (i = 0; offset != BROTLI_UINT32_MAX; i++) {
+ const ZopfliNode* next = &nodes[pos + offset];
+ size_t copy_length = ZopfliNodeCopyLength(next);
+ size_t insert_length = next->dcode_insert_length & 0x7FFFFFF;
+ pos += insert_length;
+ offset = next->u.next;
+ if (i == 0) {
+ insert_length += *last_insert_len;
+ *last_insert_len = 0;
+ }
+ {
+ size_t distance = ZopfliNodeCopyDistance(next);
+ size_t len_code = ZopfliNodeLengthCode(next);
+ size_t dictionary_start = BROTLI_MIN(size_t,
+ block_start + pos + stream_offset, max_backward_limit);
+ BROTLI_BOOL is_dictionary =
+ TO_BROTLI_BOOL(distance > dictionary_start + gap);
+ size_t dist_code = ZopfliNodeDistanceCode(next);
+ InitCommand(&commands[i], &params->dist, insert_length,
+ copy_length, (int)len_code - (int)copy_length, dist_code);
+
+ if (!is_dictionary && dist_code > 0) {
+ dist_cache[3] = dist_cache[2];
+ dist_cache[2] = dist_cache[1];
+ dist_cache[1] = dist_cache[0];
+ dist_cache[0] = (int)distance;
+ }
+ }
+
+ *num_literals += insert_length;
+ pos += copy_length;
+ }
+ *last_insert_len += num_bytes - pos;
+}
+
+static size_t ZopfliIterate(size_t num_bytes, size_t position,
+ const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ const BrotliEncoderParams* params, const size_t gap, const int* dist_cache,
+ const ZopfliCostModel* model, const uint32_t* num_matches,
+ const BackwardMatch* matches, ZopfliNode* nodes) {
+ const size_t stream_offset = params->stream_offset;
+ const size_t max_backward_limit = BROTLI_MAX_BACKWARD_LIMIT(params->lgwin);
+ const size_t max_zopfli_len = MaxZopfliLen(params);
+ StartPosQueue queue;
+ size_t cur_match_pos = 0;
+ size_t i;
+ nodes[0].length = 0;
+ nodes[0].u.cost = 0;
+ InitStartPosQueue(&queue);
+ for (i = 0; i + 3 < num_bytes; i++) {
+ size_t skip = UpdateNodes(num_bytes, position, i, ringbuffer,
+ ringbuffer_mask, params, max_backward_limit, dist_cache,
+ num_matches[i], &matches[cur_match_pos], model, &queue, nodes);
+ if (skip < BROTLI_LONG_COPY_QUICK_STEP) skip = 0;
+ cur_match_pos += num_matches[i];
+ if (num_matches[i] == 1 &&
+ BackwardMatchLength(&matches[cur_match_pos - 1]) > max_zopfli_len) {
+ skip = BROTLI_MAX(size_t,
+ BackwardMatchLength(&matches[cur_match_pos - 1]), skip);
+ }
+ if (skip > 1) {
+ skip--;
+ while (skip) {
+ i++;
+ if (i + 3 >= num_bytes) break;
+ EvaluateNode(position + stream_offset, i, max_backward_limit, gap,
+ dist_cache, model, &queue, nodes);
+ cur_match_pos += num_matches[i];
+ skip--;
+ }
+ }
+ }
+ return ComputeShortestPathFromNodes(num_bytes, nodes);
+}
+
+/* REQUIRES: nodes != NULL and len(nodes) >= num_bytes + 1 */
+size_t BrotliZopfliComputeShortestPath(MemoryManager* m, size_t num_bytes,
+ size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ ContextLut literal_context_lut, const BrotliEncoderParams* params,
+ const int* dist_cache, Hasher* hasher, ZopfliNode* nodes) {
+ const size_t stream_offset = params->stream_offset;
+ const size_t max_backward_limit = BROTLI_MAX_BACKWARD_LIMIT(params->lgwin);
+ const size_t max_zopfli_len = MaxZopfliLen(params);
+ ZopfliCostModel model;
+ StartPosQueue queue;
+ BackwardMatch matches[2 * (MAX_NUM_MATCHES_H10 + 64)];
+ const size_t store_end = num_bytes >= StoreLookaheadH10() ?
+ position + num_bytes - StoreLookaheadH10() + 1 : position;
+ size_t i;
+ size_t gap = 0;
+ size_t lz_matches_offset = 0;
+ BROTLI_UNUSED(literal_context_lut);
+ nodes[0].length = 0;
+ nodes[0].u.cost = 0;
+ InitZopfliCostModel(m, &model, &params->dist, num_bytes);
+ if (BROTLI_IS_OOM(m)) return 0;
+ ZopfliCostModelSetFromLiteralCosts(
+ &model, position, ringbuffer, ringbuffer_mask);
+ InitStartPosQueue(&queue);
+ for (i = 0; i + HashTypeLengthH10() - 1 < num_bytes; i++) {
+ const size_t pos = position + i;
+ const size_t max_distance = BROTLI_MIN(size_t, pos, max_backward_limit);
+ const size_t dictionary_start = BROTLI_MIN(size_t,
+ pos + stream_offset, max_backward_limit);
+ size_t skip;
+ size_t num_matches;
+ num_matches = FindAllMatchesH10(&hasher->privat._H10,
+ &params->dictionary,
+ ringbuffer, ringbuffer_mask, pos, num_bytes - i, max_distance,
+ dictionary_start + gap, params, &matches[lz_matches_offset]);
+ if (num_matches > 0 &&
+ BackwardMatchLength(&matches[num_matches - 1]) > max_zopfli_len) {
+ matches[0] = matches[num_matches - 1];
+ num_matches = 1;
+ }
+ skip = UpdateNodes(num_bytes, position, i, ringbuffer, ringbuffer_mask,
+ params, max_backward_limit, dist_cache, num_matches, matches, &model,
+ &queue, nodes);
+ if (skip < BROTLI_LONG_COPY_QUICK_STEP) skip = 0;
+ if (num_matches == 1 && BackwardMatchLength(&matches[0]) > max_zopfli_len) {
+ skip = BROTLI_MAX(size_t, BackwardMatchLength(&matches[0]), skip);
+ }
+ if (skip > 1) {
+ /* Add the tail of the copy to the hasher. */
+ StoreRangeH10(&hasher->privat._H10,
+ ringbuffer, ringbuffer_mask, pos + 1, BROTLI_MIN(
+ size_t, pos + skip, store_end));
+ skip--;
+ while (skip) {
+ i++;
+ if (i + HashTypeLengthH10() - 1 >= num_bytes) break;
+ EvaluateNode(position + stream_offset, i, max_backward_limit, gap,
+ dist_cache, &model, &queue, nodes);
+ skip--;
+ }
+ }
+ }
+ CleanupZopfliCostModel(m, &model);
+ return ComputeShortestPathFromNodes(num_bytes, nodes);
+}
+
+void BrotliCreateZopfliBackwardReferences(MemoryManager* m, size_t num_bytes,
+ size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ ContextLut literal_context_lut, const BrotliEncoderParams* params,
+ Hasher* hasher, int* dist_cache, size_t* last_insert_len,
+ Command* commands, size_t* num_commands, size_t* num_literals) {
+ ZopfliNode* nodes = BROTLI_ALLOC(m, ZopfliNode, num_bytes + 1);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(nodes)) return;
+ BrotliInitZopfliNodes(nodes, num_bytes + 1);
+ *num_commands += BrotliZopfliComputeShortestPath(m, num_bytes,
+ position, ringbuffer, ringbuffer_mask, literal_context_lut, params,
+ dist_cache, hasher, nodes);
+ if (BROTLI_IS_OOM(m)) return;
+ BrotliZopfliCreateCommands(num_bytes, position, nodes, dist_cache,
+ last_insert_len, params, commands, num_literals);
+ BROTLI_FREE(m, nodes);
+}
+
+void BrotliCreateHqZopfliBackwardReferences(MemoryManager* m, size_t num_bytes,
+ size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ ContextLut literal_context_lut, const BrotliEncoderParams* params,
+ Hasher* hasher, int* dist_cache, size_t* last_insert_len,
+ Command* commands, size_t* num_commands, size_t* num_literals) {
+ const size_t stream_offset = params->stream_offset;
+ const size_t max_backward_limit = BROTLI_MAX_BACKWARD_LIMIT(params->lgwin);
+ uint32_t* num_matches = BROTLI_ALLOC(m, uint32_t, num_bytes);
+ size_t matches_size = 4 * num_bytes;
+ const size_t store_end = num_bytes >= StoreLookaheadH10() ?
+ position + num_bytes - StoreLookaheadH10() + 1 : position;
+ size_t cur_match_pos = 0;
+ size_t i;
+ size_t orig_num_literals;
+ size_t orig_last_insert_len;
+ int orig_dist_cache[4];
+ size_t orig_num_commands;
+ ZopfliCostModel model;
+ ZopfliNode* nodes;
+ BackwardMatch* matches = BROTLI_ALLOC(m, BackwardMatch, matches_size);
+ size_t gap = 0;
+ size_t shadow_matches = 0;
+ BROTLI_UNUSED(literal_context_lut);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(num_matches) ||
+ BROTLI_IS_NULL(matches)) {
+ return;
+ }
+ for (i = 0; i + HashTypeLengthH10() - 1 < num_bytes; ++i) {
+ const size_t pos = position + i;
+ size_t max_distance = BROTLI_MIN(size_t, pos, max_backward_limit);
+ size_t dictionary_start = BROTLI_MIN(size_t,
+ pos + stream_offset, max_backward_limit);
+ size_t max_length = num_bytes - i;
+ size_t num_found_matches;
+ size_t cur_match_end;
+ size_t j;
+ /* Ensure that we have enough free slots. */
+ BROTLI_ENSURE_CAPACITY(m, BackwardMatch, matches, matches_size,
+ cur_match_pos + MAX_NUM_MATCHES_H10 + shadow_matches);
+ if (BROTLI_IS_OOM(m)) return;
+ num_found_matches = FindAllMatchesH10(&hasher->privat._H10,
+ &params->dictionary,
+ ringbuffer, ringbuffer_mask, pos, max_length,
+ max_distance, dictionary_start + gap, params,
+ &matches[cur_match_pos + shadow_matches]);
+ cur_match_end = cur_match_pos + num_found_matches;
+ for (j = cur_match_pos; j + 1 < cur_match_end; ++j) {
+ BROTLI_DCHECK(BackwardMatchLength(&matches[j]) <=
+ BackwardMatchLength(&matches[j + 1]));
+ }
+ num_matches[i] = (uint32_t)num_found_matches;
+ if (num_found_matches > 0) {
+ const size_t match_len = BackwardMatchLength(&matches[cur_match_end - 1]);
+ if (match_len > MAX_ZOPFLI_LEN_QUALITY_11) {
+ const size_t skip = match_len - 1;
+ matches[cur_match_pos++] = matches[cur_match_end - 1];
+ num_matches[i] = 1;
+ /* Add the tail of the copy to the hasher. */
+ StoreRangeH10(&hasher->privat._H10,
+ ringbuffer, ringbuffer_mask, pos + 1,
+ BROTLI_MIN(size_t, pos + match_len, store_end));
+ memset(&num_matches[i + 1], 0, skip * sizeof(num_matches[0]));
+ i += skip;
+ } else {
+ cur_match_pos = cur_match_end;
+ }
+ }
+ }
+ orig_num_literals = *num_literals;
+ orig_last_insert_len = *last_insert_len;
+ memcpy(orig_dist_cache, dist_cache, 4 * sizeof(dist_cache[0]));
+ orig_num_commands = *num_commands;
+ nodes = BROTLI_ALLOC(m, ZopfliNode, num_bytes + 1);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(nodes)) return;
+ InitZopfliCostModel(m, &model, &params->dist, num_bytes);
+ if (BROTLI_IS_OOM(m)) return;
+ for (i = 0; i < 2; i++) {
+ BrotliInitZopfliNodes(nodes, num_bytes + 1);
+ if (i == 0) {
+ ZopfliCostModelSetFromLiteralCosts(
+ &model, position, ringbuffer, ringbuffer_mask);
+ } else {
+ ZopfliCostModelSetFromCommands(&model, position, ringbuffer,
+ ringbuffer_mask, commands, *num_commands - orig_num_commands,
+ orig_last_insert_len);
+ }
+ *num_commands = orig_num_commands;
+ *num_literals = orig_num_literals;
+ *last_insert_len = orig_last_insert_len;
+ memcpy(dist_cache, orig_dist_cache, 4 * sizeof(dist_cache[0]));
+ *num_commands += ZopfliIterate(num_bytes, position, ringbuffer,
+ ringbuffer_mask, params, gap, dist_cache, &model, num_matches, matches,
+ nodes);
+ BrotliZopfliCreateCommands(num_bytes, position, nodes, dist_cache,
+ last_insert_len, params, commands, num_literals);
+ }
+ CleanupZopfliCostModel(m, &model);
+ BROTLI_FREE(m, nodes);
+ BROTLI_FREE(m, matches);
+ BROTLI_FREE(m, num_matches);
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references_hq.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references_hq.h
new file mode 100644
index 000000000..36b75f250
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references_hq.h
@@ -0,0 +1,95 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Function to find backward reference copies. */
+
+#ifndef BROTLI_ENC_BACKWARD_REFERENCES_HQ_H_
+#define BROTLI_ENC_BACKWARD_REFERENCES_HQ_H_
+
+#include "../common/constants.h"
+#include "../common/context.h"
+#include "../common/dictionary.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./command.h"
+#include "./hash.h"
+#include "./memory.h"
+#include "./quality.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+BROTLI_INTERNAL void BrotliCreateZopfliBackwardReferences(MemoryManager* m,
+ size_t num_bytes,
+ size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ ContextLut literal_context_lut, const BrotliEncoderParams* params,
+ Hasher* hasher, int* dist_cache, size_t* last_insert_len,
+ Command* commands, size_t* num_commands, size_t* num_literals);
+
+BROTLI_INTERNAL void BrotliCreateHqZopfliBackwardReferences(MemoryManager* m,
+ size_t num_bytes,
+ size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ ContextLut literal_context_lut, const BrotliEncoderParams* params,
+ Hasher* hasher, int* dist_cache, size_t* last_insert_len,
+ Command* commands, size_t* num_commands, size_t* num_literals);
+
+typedef struct ZopfliNode {
+ /* Best length to get up to this byte (not including this byte itself)
+ highest 7 bit is used to reconstruct the length code. */
+ uint32_t length;
+ /* Distance associated with the length. */
+ uint32_t distance;
+ /* Number of literal inserts before this copy; highest 5 bits contain
+ distance short code + 1 (or zero if no short code). */
+ uint32_t dcode_insert_length;
+
+ /* This union holds information used by dynamic-programming. During forward
+ pass |cost| it used to store the goal function. When node is processed its
+ |cost| is invalidated in favor of |shortcut|. On path back-tracing pass
+ |next| is assigned the offset to next node on the path. */
+ union {
+ /* Smallest cost to get to this byte from the beginning, as found so far. */
+ float cost;
+ /* Offset to the next node on the path. Equals to command_length() of the
+ next node on the path. For last node equals to BROTLI_UINT32_MAX */
+ uint32_t next;
+ /* Node position that provides next distance for distance cache. */
+ uint32_t shortcut;
+ } u;
+} ZopfliNode;
+
+BROTLI_INTERNAL void BrotliInitZopfliNodes(ZopfliNode* array, size_t length);
+
+/* Computes the shortest path of commands from position to at most
+ position + num_bytes.
+
+ On return, path->size() is the number of commands found and path[i] is the
+ length of the i-th command (copy length plus insert length).
+ Note that the sum of the lengths of all commands can be less than num_bytes.
+
+ On return, the nodes[0..num_bytes] array will have the following
+ "ZopfliNode array invariant":
+ For each i in [1..num_bytes], if nodes[i].cost < kInfinity, then
+ (1) nodes[i].copy_length() >= 2
+ (2) nodes[i].command_length() <= i and
+ (3) nodes[i - nodes[i].command_length()].cost < kInfinity */
+BROTLI_INTERNAL size_t BrotliZopfliComputeShortestPath(
+ MemoryManager* m, size_t num_bytes,
+ size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ ContextLut literal_context_lut, const BrotliEncoderParams* params,
+ const int* dist_cache, Hasher* hasher, ZopfliNode* nodes);
+
+BROTLI_INTERNAL void BrotliZopfliCreateCommands(
+ const size_t num_bytes, const size_t block_start, const ZopfliNode* nodes,
+ int* dist_cache, size_t* last_insert_len, const BrotliEncoderParams* params,
+ Command* commands, size_t* num_literals);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_BACKWARD_REFERENCES_HQ_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references_inc.h
new file mode 100644
index 000000000..766bf91ff
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/backward_references_inc.h
@@ -0,0 +1,163 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: EXPORT_FN, FN */
+
+static BROTLI_NOINLINE void EXPORT_FN(CreateBackwardReferences)(
+ size_t num_bytes, size_t position,
+ const uint8_t* ringbuffer, size_t ringbuffer_mask,
+ ContextLut literal_context_lut, const BrotliEncoderParams* params,
+ Hasher* hasher, int* dist_cache, size_t* last_insert_len,
+ Command* commands, size_t* num_commands, size_t* num_literals) {
+ HASHER()* privat = &hasher->privat.FN(_);
+ /* Set maximum distance, see section 9.1. of the spec. */
+ const size_t max_backward_limit = BROTLI_MAX_BACKWARD_LIMIT(params->lgwin);
+ const size_t position_offset = params->stream_offset;
+
+ const Command* const orig_commands = commands;
+ size_t insert_length = *last_insert_len;
+ const size_t pos_end = position + num_bytes;
+ const size_t store_end = num_bytes >= FN(StoreLookahead)() ?
+ position + num_bytes - FN(StoreLookahead)() + 1 : position;
+
+ /* For speed up heuristics for random data. */
+ const size_t random_heuristics_window_size =
+ LiteralSpreeLengthForSparseSearch(params);
+ size_t apply_random_heuristics = position + random_heuristics_window_size;
+ const size_t gap = 0;
+
+ /* Minimum score to accept a backward reference. */
+ const score_t kMinScore = BROTLI_SCORE_BASE + 100;
+
+ BROTLI_UNUSED(literal_context_lut);
+
+ FN(PrepareDistanceCache)(privat, dist_cache);
+
+ while (position + FN(HashTypeLength)() < pos_end) {
+ size_t max_length = pos_end - position;
+ size_t max_distance = BROTLI_MIN(size_t, position, max_backward_limit);
+ size_t dictionary_start = BROTLI_MIN(size_t,
+ position + position_offset, max_backward_limit);
+ HasherSearchResult sr;
+ sr.len = 0;
+ sr.len_code_delta = 0;
+ sr.distance = 0;
+ sr.score = kMinScore;
+ FN(FindLongestMatch)(privat, &params->dictionary,
+ ringbuffer, ringbuffer_mask, dist_cache, position, max_length,
+ max_distance, dictionary_start + gap, params->dist.max_distance, &sr);
+ if (sr.score > kMinScore) {
+ /* Found a match. Let's look for something even better ahead. */
+ int delayed_backward_references_in_row = 0;
+ --max_length;
+ for (;; --max_length) {
+ const score_t cost_diff_lazy = 175;
+ HasherSearchResult sr2;
+ sr2.len = params->quality < MIN_QUALITY_FOR_EXTENSIVE_REFERENCE_SEARCH ?
+ BROTLI_MIN(size_t, sr.len - 1, max_length) : 0;
+ sr2.len_code_delta = 0;
+ sr2.distance = 0;
+ sr2.score = kMinScore;
+ max_distance = BROTLI_MIN(size_t, position + 1, max_backward_limit);
+ dictionary_start = BROTLI_MIN(size_t,
+ position + 1 + position_offset, max_backward_limit);
+ FN(FindLongestMatch)(privat,
+ &params->dictionary,
+ ringbuffer, ringbuffer_mask, dist_cache, position + 1, max_length,
+ max_distance, dictionary_start + gap, params->dist.max_distance,
+ &sr2);
+ if (sr2.score >= sr.score + cost_diff_lazy) {
+ /* Ok, let's just write one byte for now and start a match from the
+ next byte. */
+ ++position;
+ ++insert_length;
+ sr = sr2;
+ if (++delayed_backward_references_in_row < 4 &&
+ position + FN(HashTypeLength)() < pos_end) {
+ continue;
+ }
+ }
+ break;
+ }
+ apply_random_heuristics =
+ position + 2 * sr.len + random_heuristics_window_size;
+ dictionary_start = BROTLI_MIN(size_t,
+ position + position_offset, max_backward_limit);
+ {
+ /* The first 16 codes are special short-codes,
+ and the minimum offset is 1. */
+ size_t distance_code = ComputeDistanceCode(
+ sr.distance, dictionary_start + gap, dist_cache);
+ if ((sr.distance <= (dictionary_start + gap)) && distance_code > 0) {
+ dist_cache[3] = dist_cache[2];
+ dist_cache[2] = dist_cache[1];
+ dist_cache[1] = dist_cache[0];
+ dist_cache[0] = (int)sr.distance;
+ FN(PrepareDistanceCache)(privat, dist_cache);
+ }
+ InitCommand(commands++, &params->dist, insert_length,
+ sr.len, sr.len_code_delta, distance_code);
+ }
+ *num_literals += insert_length;
+ insert_length = 0;
+ /* Put the hash keys into the table, if there are enough bytes left.
+ Depending on the hasher implementation, it can push all positions
+ in the given range or only a subset of them.
+ Avoid hash poisoning with RLE data. */
+ {
+ size_t range_start = position + 2;
+ size_t range_end = BROTLI_MIN(size_t, position + sr.len, store_end);
+ if (sr.distance < (sr.len >> 2)) {
+ range_start = BROTLI_MIN(size_t, range_end, BROTLI_MAX(size_t,
+ range_start, position + sr.len - (sr.distance << 2)));
+ }
+ FN(StoreRange)(privat, ringbuffer, ringbuffer_mask, range_start,
+ range_end);
+ }
+ position += sr.len;
+ } else {
+ ++insert_length;
+ ++position;
+ /* If we have not seen matches for a long time, we can skip some
+ match lookups. Unsuccessful match lookups are very very expensive
+ and this kind of a heuristic speeds up compression quite
+ a lot. */
+ if (position > apply_random_heuristics) {
+ /* Going through uncompressible data, jump. */
+ if (position >
+ apply_random_heuristics + 4 * random_heuristics_window_size) {
+ /* It is quite a long time since we saw a copy, so we assume
+ that this data is not compressible, and store hashes less
+ often. Hashes of non compressible data are less likely to
+ turn out to be useful in the future, too, so we store less of
+ them to not to flood out the hash table of good compressible
+ data. */
+ const size_t kMargin =
+ BROTLI_MAX(size_t, FN(StoreLookahead)() - 1, 4);
+ size_t pos_jump =
+ BROTLI_MIN(size_t, position + 16, pos_end - kMargin);
+ for (; position < pos_jump; position += 4) {
+ FN(Store)(privat, ringbuffer, ringbuffer_mask, position);
+ insert_length += 4;
+ }
+ } else {
+ const size_t kMargin =
+ BROTLI_MAX(size_t, FN(StoreLookahead)() - 1, 2);
+ size_t pos_jump =
+ BROTLI_MIN(size_t, position + 8, pos_end - kMargin);
+ for (; position < pos_jump; position += 2) {
+ FN(Store)(privat, ringbuffer, ringbuffer_mask, position);
+ insert_length += 2;
+ }
+ }
+ }
+ }
+ }
+ insert_length += pos_end - position;
+ *last_insert_len = insert_length;
+ *num_commands += (size_t)(commands - orig_commands);
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/bit_cost.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/bit_cost.c
new file mode 100644
index 000000000..1f3f7ad5c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/bit_cost.c
@@ -0,0 +1,35 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Functions to estimate the bit cost of Huffman trees. */
+
+#include "./bit_cost.h"
+
+#include "../common/constants.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./fast_log.h"
+#include "./histogram.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#define FN(X) X ## Literal
+#include "./bit_cost_inc.h" /* NOLINT(build/include) */
+#undef FN
+
+#define FN(X) X ## Command
+#include "./bit_cost_inc.h" /* NOLINT(build/include) */
+#undef FN
+
+#define FN(X) X ## Distance
+#include "./bit_cost_inc.h" /* NOLINT(build/include) */
+#undef FN
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/bit_cost.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/bit_cost.h
new file mode 100644
index 000000000..6586469e6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/bit_cost.h
@@ -0,0 +1,63 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Functions to estimate the bit cost of Huffman trees. */
+
+#ifndef BROTLI_ENC_BIT_COST_H_
+#define BROTLI_ENC_BIT_COST_H_
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./fast_log.h"
+#include "./histogram.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+static BROTLI_INLINE double ShannonEntropy(
+ const uint32_t* population, size_t size, size_t* total) {
+ size_t sum = 0;
+ double retval = 0;
+ const uint32_t* population_end = population + size;
+ size_t p;
+ if (size & 1) {
+ goto odd_number_of_elements_left;
+ }
+ while (population < population_end) {
+ p = *population++;
+ sum += p;
+ retval -= (double)p * FastLog2(p);
+ odd_number_of_elements_left:
+ p = *population++;
+ sum += p;
+ retval -= (double)p * FastLog2(p);
+ }
+ if (sum) retval += (double)sum * FastLog2(sum);
+ *total = sum;
+ return retval;
+}
+
+static BROTLI_INLINE double BitsEntropy(
+ const uint32_t* population, size_t size) {
+ size_t sum;
+ double retval = ShannonEntropy(population, size, &sum);
+ if (retval < sum) {
+ /* At least one bit per literal is needed. */
+ retval = (double)sum;
+ }
+ return retval;
+}
+
+BROTLI_INTERNAL double BrotliPopulationCostLiteral(const HistogramLiteral*);
+BROTLI_INTERNAL double BrotliPopulationCostCommand(const HistogramCommand*);
+BROTLI_INTERNAL double BrotliPopulationCostDistance(const HistogramDistance*);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_BIT_COST_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/bit_cost_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/bit_cost_inc.h
new file mode 100644
index 000000000..453c22604
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/bit_cost_inc.h
@@ -0,0 +1,127 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: FN */
+
+#define HistogramType FN(Histogram)
+
+double FN(BrotliPopulationCost)(const HistogramType* histogram) {
+ static const double kOneSymbolHistogramCost = 12;
+ static const double kTwoSymbolHistogramCost = 20;
+ static const double kThreeSymbolHistogramCost = 28;
+ static const double kFourSymbolHistogramCost = 37;
+ const size_t data_size = FN(HistogramDataSize)();
+ int count = 0;
+ size_t s[5];
+ double bits = 0.0;
+ size_t i;
+ if (histogram->total_count_ == 0) {
+ return kOneSymbolHistogramCost;
+ }
+ for (i = 0; i < data_size; ++i) {
+ if (histogram->data_[i] > 0) {
+ s[count] = i;
+ ++count;
+ if (count > 4) break;
+ }
+ }
+ if (count == 1) {
+ return kOneSymbolHistogramCost;
+ }
+ if (count == 2) {
+ return (kTwoSymbolHistogramCost + (double)histogram->total_count_);
+ }
+ if (count == 3) {
+ const uint32_t histo0 = histogram->data_[s[0]];
+ const uint32_t histo1 = histogram->data_[s[1]];
+ const uint32_t histo2 = histogram->data_[s[2]];
+ const uint32_t histomax =
+ BROTLI_MAX(uint32_t, histo0, BROTLI_MAX(uint32_t, histo1, histo2));
+ return (kThreeSymbolHistogramCost +
+ 2 * (histo0 + histo1 + histo2) - histomax);
+ }
+ if (count == 4) {
+ uint32_t histo[4];
+ uint32_t h23;
+ uint32_t histomax;
+ for (i = 0; i < 4; ++i) {
+ histo[i] = histogram->data_[s[i]];
+ }
+ /* Sort */
+ for (i = 0; i < 4; ++i) {
+ size_t j;
+ for (j = i + 1; j < 4; ++j) {
+ if (histo[j] > histo[i]) {
+ BROTLI_SWAP(uint32_t, histo, j, i);
+ }
+ }
+ }
+ h23 = histo[2] + histo[3];
+ histomax = BROTLI_MAX(uint32_t, h23, histo[0]);
+ return (kFourSymbolHistogramCost +
+ 3 * h23 + 2 * (histo[0] + histo[1]) - histomax);
+ }
+
+ {
+ /* In this loop we compute the entropy of the histogram and simultaneously
+ build a simplified histogram of the code length codes where we use the
+ zero repeat code 17, but we don't use the non-zero repeat code 16. */
+ size_t max_depth = 1;
+ uint32_t depth_histo[BROTLI_CODE_LENGTH_CODES] = { 0 };
+ const double log2total = FastLog2(histogram->total_count_);
+ for (i = 0; i < data_size;) {
+ if (histogram->data_[i] > 0) {
+ /* Compute -log2(P(symbol)) = -log2(count(symbol)/total_count) =
+ = log2(total_count) - log2(count(symbol)) */
+ double log2p = log2total - FastLog2(histogram->data_[i]);
+ /* Approximate the bit depth by round(-log2(P(symbol))) */
+ size_t depth = (size_t)(log2p + 0.5);
+ bits += histogram->data_[i] * log2p;
+ if (depth > 15) {
+ depth = 15;
+ }
+ if (depth > max_depth) {
+ max_depth = depth;
+ }
+ ++depth_histo[depth];
+ ++i;
+ } else {
+ /* Compute the run length of zeros and add the appropriate number of 0
+ and 17 code length codes to the code length code histogram. */
+ uint32_t reps = 1;
+ size_t k;
+ for (k = i + 1; k < data_size && histogram->data_[k] == 0; ++k) {
+ ++reps;
+ }
+ i += reps;
+ if (i == data_size) {
+ /* Don't add any cost for the last zero run, since these are encoded
+ only implicitly. */
+ break;
+ }
+ if (reps < 3) {
+ depth_histo[0] += reps;
+ } else {
+ reps -= 2;
+ while (reps > 0) {
+ ++depth_histo[BROTLI_REPEAT_ZERO_CODE_LENGTH];
+ /* Add the 3 extra bits for the 17 code length code. */
+ bits += 3;
+ reps >>= 3;
+ }
+ }
+ }
+ }
+ /* Add the estimated encoding cost of the code length code histogram. */
+ bits += (double)(18 + 2 * max_depth);
+ /* Add the entropy of the code length code histogram. */
+ bits += BitsEntropy(depth_histo, BROTLI_CODE_LENGTH_CODES);
+ }
+ return bits;
+}
+
+#undef HistogramType
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_encoder_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_encoder_inc.h
new file mode 100644
index 000000000..8cbd5eac6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_encoder_inc.h
@@ -0,0 +1,34 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2014 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: FN */
+
+#define HistogramType FN(Histogram)
+
+/* Creates entropy codes for all block types and stores them to the bit
+ stream. */
+static void FN(BuildAndStoreEntropyCodes)(MemoryManager* m, BlockEncoder* self,
+ const HistogramType* histograms, const size_t histograms_size,
+ const size_t alphabet_size, HuffmanTree* tree,
+ size_t* storage_ix, uint8_t* storage) {
+ const size_t table_size = histograms_size * self->histogram_length_;
+ self->depths_ = BROTLI_ALLOC(m, uint8_t, table_size);
+ self->bits_ = BROTLI_ALLOC(m, uint16_t, table_size);
+ if (BROTLI_IS_OOM(m)) return;
+
+ {
+ size_t i;
+ for (i = 0; i < histograms_size; ++i) {
+ size_t ix = i * self->histogram_length_;
+ BuildAndStoreHuffmanTree(&histograms[i].data_[0], self->histogram_length_,
+ alphabet_size, tree, &self->depths_[ix], &self->bits_[ix],
+ storage_ix, storage);
+ }
+ }
+}
+
+#undef HistogramType
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_splitter.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_splitter.c
new file mode 100644
index 000000000..deb7c2e15
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_splitter.c
@@ -0,0 +1,194 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Block split point selection utilities. */
+
+#include "./block_splitter.h"
+
+#include <string.h> /* memcpy, memset */
+
+#include "../common/platform.h"
+#include "./bit_cost.h"
+#include "./cluster.h"
+#include "./command.h"
+#include "./fast_log.h"
+#include "./histogram.h"
+#include "./memory.h"
+#include "./quality.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+static const size_t kMaxLiteralHistograms = 100;
+static const size_t kMaxCommandHistograms = 50;
+static const double kLiteralBlockSwitchCost = 28.1;
+static const double kCommandBlockSwitchCost = 13.5;
+static const double kDistanceBlockSwitchCost = 14.6;
+static const size_t kLiteralStrideLength = 70;
+static const size_t kCommandStrideLength = 40;
+static const size_t kSymbolsPerLiteralHistogram = 544;
+static const size_t kSymbolsPerCommandHistogram = 530;
+static const size_t kSymbolsPerDistanceHistogram = 544;
+static const size_t kMinLengthForBlockSplitting = 128;
+static const size_t kIterMulForRefining = 2;
+static const size_t kMinItersForRefining = 100;
+
+static size_t CountLiterals(const Command* cmds, const size_t num_commands) {
+ /* Count how many we have. */
+ size_t total_length = 0;
+ size_t i;
+ for (i = 0; i < num_commands; ++i) {
+ total_length += cmds[i].insert_len_;
+ }
+ return total_length;
+}
+
+static void CopyLiteralsToByteArray(const Command* cmds,
+ const size_t num_commands,
+ const uint8_t* data,
+ const size_t offset,
+ const size_t mask,
+ uint8_t* literals) {
+ size_t pos = 0;
+ size_t from_pos = offset & mask;
+ size_t i;
+ for (i = 0; i < num_commands; ++i) {
+ size_t insert_len = cmds[i].insert_len_;
+ if (from_pos + insert_len > mask) {
+ size_t head_size = mask + 1 - from_pos;
+ memcpy(literals + pos, data + from_pos, head_size);
+ from_pos = 0;
+ pos += head_size;
+ insert_len -= head_size;
+ }
+ if (insert_len > 0) {
+ memcpy(literals + pos, data + from_pos, insert_len);
+ pos += insert_len;
+ }
+ from_pos = (from_pos + insert_len + CommandCopyLen(&cmds[i])) & mask;
+ }
+}
+
+static BROTLI_INLINE uint32_t MyRand(uint32_t* seed) {
+ /* Initial seed should be 7. In this case, loop length is (1 << 29). */
+ *seed *= 16807U;
+ return *seed;
+}
+
+static BROTLI_INLINE double BitCost(size_t count) {
+ return count == 0 ? -2.0 : FastLog2(count);
+}
+
+#define HISTOGRAMS_PER_BATCH 64
+#define CLUSTERS_PER_BATCH 16
+
+#define FN(X) X ## Literal
+#define DataType uint8_t
+/* NOLINTNEXTLINE(build/include) */
+#include "./block_splitter_inc.h"
+#undef DataType
+#undef FN
+
+#define FN(X) X ## Command
+#define DataType uint16_t
+/* NOLINTNEXTLINE(build/include) */
+#include "./block_splitter_inc.h"
+#undef FN
+
+#define FN(X) X ## Distance
+/* NOLINTNEXTLINE(build/include) */
+#include "./block_splitter_inc.h"
+#undef DataType
+#undef FN
+
+void BrotliInitBlockSplit(BlockSplit* self) {
+ self->num_types = 0;
+ self->num_blocks = 0;
+ self->types = 0;
+ self->lengths = 0;
+ self->types_alloc_size = 0;
+ self->lengths_alloc_size = 0;
+}
+
+void BrotliDestroyBlockSplit(MemoryManager* m, BlockSplit* self) {
+ BROTLI_FREE(m, self->types);
+ BROTLI_FREE(m, self->lengths);
+}
+
+void BrotliSplitBlock(MemoryManager* m,
+ const Command* cmds,
+ const size_t num_commands,
+ const uint8_t* data,
+ const size_t pos,
+ const size_t mask,
+ const BrotliEncoderParams* params,
+ BlockSplit* literal_split,
+ BlockSplit* insert_and_copy_split,
+ BlockSplit* dist_split) {
+ {
+ size_t literals_count = CountLiterals(cmds, num_commands);
+ uint8_t* literals = BROTLI_ALLOC(m, uint8_t, literals_count);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(literals)) return;
+ /* Create a continuous array of literals. */
+ CopyLiteralsToByteArray(cmds, num_commands, data, pos, mask, literals);
+ /* Create the block split on the array of literals.
+ Literal histograms have alphabet size 256. */
+ SplitByteVectorLiteral(
+ m, literals, literals_count,
+ kSymbolsPerLiteralHistogram, kMaxLiteralHistograms,
+ kLiteralStrideLength, kLiteralBlockSwitchCost, params,
+ literal_split);
+ if (BROTLI_IS_OOM(m)) return;
+ BROTLI_FREE(m, literals);
+ }
+
+ {
+ /* Compute prefix codes for commands. */
+ uint16_t* insert_and_copy_codes = BROTLI_ALLOC(m, uint16_t, num_commands);
+ size_t i;
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(insert_and_copy_codes)) return;
+ for (i = 0; i < num_commands; ++i) {
+ insert_and_copy_codes[i] = cmds[i].cmd_prefix_;
+ }
+ /* Create the block split on the array of command prefixes. */
+ SplitByteVectorCommand(
+ m, insert_and_copy_codes, num_commands,
+ kSymbolsPerCommandHistogram, kMaxCommandHistograms,
+ kCommandStrideLength, kCommandBlockSwitchCost, params,
+ insert_and_copy_split);
+ if (BROTLI_IS_OOM(m)) return;
+ /* TODO: reuse for distances? */
+ BROTLI_FREE(m, insert_and_copy_codes);
+ }
+
+ {
+ /* Create a continuous array of distance prefixes. */
+ uint16_t* distance_prefixes = BROTLI_ALLOC(m, uint16_t, num_commands);
+ size_t j = 0;
+ size_t i;
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(distance_prefixes)) return;
+ for (i = 0; i < num_commands; ++i) {
+ const Command* cmd = &cmds[i];
+ if (CommandCopyLen(cmd) && cmd->cmd_prefix_ >= 128) {
+ distance_prefixes[j++] = cmd->dist_prefix_ & 0x3FF;
+ }
+ }
+ /* Create the block split on the array of distance prefixes. */
+ SplitByteVectorDistance(
+ m, distance_prefixes, j,
+ kSymbolsPerDistanceHistogram, kMaxCommandHistograms,
+ kCommandStrideLength, kDistanceBlockSwitchCost, params,
+ dist_split);
+ if (BROTLI_IS_OOM(m)) return;
+ BROTLI_FREE(m, distance_prefixes);
+ }
+}
+
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_splitter.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_splitter.h
new file mode 100644
index 000000000..a5e006c4b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_splitter.h
@@ -0,0 +1,51 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Block split point selection utilities. */
+
+#ifndef BROTLI_ENC_BLOCK_SPLITTER_H_
+#define BROTLI_ENC_BLOCK_SPLITTER_H_
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./command.h"
+#include "./memory.h"
+#include "./quality.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+typedef struct BlockSplit {
+ size_t num_types; /* Amount of distinct types */
+ size_t num_blocks; /* Amount of values in types and length */
+ uint8_t* types;
+ uint32_t* lengths;
+
+ size_t types_alloc_size;
+ size_t lengths_alloc_size;
+} BlockSplit;
+
+BROTLI_INTERNAL void BrotliInitBlockSplit(BlockSplit* self);
+BROTLI_INTERNAL void BrotliDestroyBlockSplit(MemoryManager* m,
+ BlockSplit* self);
+
+BROTLI_INTERNAL void BrotliSplitBlock(MemoryManager* m,
+ const Command* cmds,
+ const size_t num_commands,
+ const uint8_t* data,
+ const size_t offset,
+ const size_t mask,
+ const BrotliEncoderParams* params,
+ BlockSplit* literal_split,
+ BlockSplit* insert_and_copy_split,
+ BlockSplit* dist_split);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_BLOCK_SPLITTER_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_splitter_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_splitter_inc.h
new file mode 100644
index 000000000..e612d6a37
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/block_splitter_inc.h
@@ -0,0 +1,440 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: FN, DataType */
+
+#define HistogramType FN(Histogram)
+
+static void FN(InitialEntropyCodes)(const DataType* data, size_t length,
+ size_t stride,
+ size_t num_histograms,
+ HistogramType* histograms) {
+ uint32_t seed = 7;
+ size_t block_length = length / num_histograms;
+ size_t i;
+ FN(ClearHistograms)(histograms, num_histograms);
+ for (i = 0; i < num_histograms; ++i) {
+ size_t pos = length * i / num_histograms;
+ if (i != 0) {
+ pos += MyRand(&seed) % block_length;
+ }
+ if (pos + stride >= length) {
+ pos = length - stride - 1;
+ }
+ FN(HistogramAddVector)(&histograms[i], data + pos, stride);
+ }
+}
+
+static void FN(RandomSample)(uint32_t* seed,
+ const DataType* data,
+ size_t length,
+ size_t stride,
+ HistogramType* sample) {
+ size_t pos = 0;
+ if (stride >= length) {
+ stride = length;
+ } else {
+ pos = MyRand(seed) % (length - stride + 1);
+ }
+ FN(HistogramAddVector)(sample, data + pos, stride);
+}
+
+static void FN(RefineEntropyCodes)(const DataType* data, size_t length,
+ size_t stride,
+ size_t num_histograms,
+ HistogramType* histograms) {
+ size_t iters =
+ kIterMulForRefining * length / stride + kMinItersForRefining;
+ uint32_t seed = 7;
+ size_t iter;
+ iters = ((iters + num_histograms - 1) / num_histograms) * num_histograms;
+ for (iter = 0; iter < iters; ++iter) {
+ HistogramType sample;
+ FN(HistogramClear)(&sample);
+ FN(RandomSample)(&seed, data, length, stride, &sample);
+ FN(HistogramAddHistogram)(&histograms[iter % num_histograms], &sample);
+ }
+}
+
+/* Assigns a block id from the range [0, num_histograms) to each data element
+ in data[0..length) and fills in block_id[0..length) with the assigned values.
+ Returns the number of blocks, i.e. one plus the number of block switches. */
+static size_t FN(FindBlocks)(const DataType* data, const size_t length,
+ const double block_switch_bitcost,
+ const size_t num_histograms,
+ const HistogramType* histograms,
+ double* insert_cost,
+ double* cost,
+ uint8_t* switch_signal,
+ uint8_t* block_id) {
+ const size_t data_size = FN(HistogramDataSize)();
+ const size_t bitmaplen = (num_histograms + 7) >> 3;
+ size_t num_blocks = 1;
+ size_t i;
+ size_t j;
+ BROTLI_DCHECK(num_histograms <= 256);
+ if (num_histograms <= 1) {
+ for (i = 0; i < length; ++i) {
+ block_id[i] = 0;
+ }
+ return 1;
+ }
+ memset(insert_cost, 0, sizeof(insert_cost[0]) * data_size * num_histograms);
+ for (i = 0; i < num_histograms; ++i) {
+ insert_cost[i] = FastLog2((uint32_t)histograms[i].total_count_);
+ }
+ for (i = data_size; i != 0;) {
+ --i;
+ for (j = 0; j < num_histograms; ++j) {
+ insert_cost[i * num_histograms + j] =
+ insert_cost[j] - BitCost(histograms[j].data_[i]);
+ }
+ }
+ memset(cost, 0, sizeof(cost[0]) * num_histograms);
+ memset(switch_signal, 0, sizeof(switch_signal[0]) * length * bitmaplen);
+ /* After each iteration of this loop, cost[k] will contain the difference
+ between the minimum cost of arriving at the current byte position using
+ entropy code k, and the minimum cost of arriving at the current byte
+ position. This difference is capped at the block switch cost, and if it
+ reaches block switch cost, it means that when we trace back from the last
+ position, we need to switch here. */
+ for (i = 0; i < length; ++i) {
+ const size_t byte_ix = i;
+ size_t ix = byte_ix * bitmaplen;
+ size_t insert_cost_ix = data[byte_ix] * num_histograms;
+ double min_cost = 1e99;
+ double block_switch_cost = block_switch_bitcost;
+ size_t k;
+ for (k = 0; k < num_histograms; ++k) {
+ /* We are coding the symbol in data[byte_ix] with entropy code k. */
+ cost[k] += insert_cost[insert_cost_ix + k];
+ if (cost[k] < min_cost) {
+ min_cost = cost[k];
+ block_id[byte_ix] = (uint8_t)k;
+ }
+ }
+ /* More blocks for the beginning. */
+ if (byte_ix < 2000) {
+ block_switch_cost *= 0.77 + 0.07 * (double)byte_ix / 2000;
+ }
+ for (k = 0; k < num_histograms; ++k) {
+ cost[k] -= min_cost;
+ if (cost[k] >= block_switch_cost) {
+ const uint8_t mask = (uint8_t)(1u << (k & 7));
+ cost[k] = block_switch_cost;
+ BROTLI_DCHECK((k >> 3) < bitmaplen);
+ switch_signal[ix + (k >> 3)] |= mask;
+ }
+ }
+ }
+ { /* Trace back from the last position and switch at the marked places. */
+ size_t byte_ix = length - 1;
+ size_t ix = byte_ix * bitmaplen;
+ uint8_t cur_id = block_id[byte_ix];
+ while (byte_ix > 0) {
+ const uint8_t mask = (uint8_t)(1u << (cur_id & 7));
+ BROTLI_DCHECK(((size_t)cur_id >> 3) < bitmaplen);
+ --byte_ix;
+ ix -= bitmaplen;
+ if (switch_signal[ix + (cur_id >> 3)] & mask) {
+ if (cur_id != block_id[byte_ix]) {
+ cur_id = block_id[byte_ix];
+ ++num_blocks;
+ }
+ }
+ block_id[byte_ix] = cur_id;
+ }
+ }
+ return num_blocks;
+}
+
+static size_t FN(RemapBlockIds)(uint8_t* block_ids, const size_t length,
+ uint16_t* new_id, const size_t num_histograms) {
+ static const uint16_t kInvalidId = 256;
+ uint16_t next_id = 0;
+ size_t i;
+ for (i = 0; i < num_histograms; ++i) {
+ new_id[i] = kInvalidId;
+ }
+ for (i = 0; i < length; ++i) {
+ BROTLI_DCHECK(block_ids[i] < num_histograms);
+ if (new_id[block_ids[i]] == kInvalidId) {
+ new_id[block_ids[i]] = next_id++;
+ }
+ }
+ for (i = 0; i < length; ++i) {
+ block_ids[i] = (uint8_t)new_id[block_ids[i]];
+ BROTLI_DCHECK(block_ids[i] < num_histograms);
+ }
+ BROTLI_DCHECK(next_id <= num_histograms);
+ return next_id;
+}
+
+static void FN(BuildBlockHistograms)(const DataType* data, const size_t length,
+ const uint8_t* block_ids,
+ const size_t num_histograms,
+ HistogramType* histograms) {
+ size_t i;
+ FN(ClearHistograms)(histograms, num_histograms);
+ for (i = 0; i < length; ++i) {
+ FN(HistogramAdd)(&histograms[block_ids[i]], data[i]);
+ }
+}
+
+static void FN(ClusterBlocks)(MemoryManager* m,
+ const DataType* data, const size_t length,
+ const size_t num_blocks,
+ uint8_t* block_ids,
+ BlockSplit* split) {
+ uint32_t* histogram_symbols = BROTLI_ALLOC(m, uint32_t, num_blocks);
+ uint32_t* block_lengths = BROTLI_ALLOC(m, uint32_t, num_blocks);
+ const size_t expected_num_clusters = CLUSTERS_PER_BATCH *
+ (num_blocks + HISTOGRAMS_PER_BATCH - 1) / HISTOGRAMS_PER_BATCH;
+ size_t all_histograms_size = 0;
+ size_t all_histograms_capacity = expected_num_clusters;
+ HistogramType* all_histograms =
+ BROTLI_ALLOC(m, HistogramType, all_histograms_capacity);
+ size_t cluster_size_size = 0;
+ size_t cluster_size_capacity = expected_num_clusters;
+ uint32_t* cluster_size = BROTLI_ALLOC(m, uint32_t, cluster_size_capacity);
+ size_t num_clusters = 0;
+ HistogramType* histograms = BROTLI_ALLOC(m, HistogramType,
+ BROTLI_MIN(size_t, num_blocks, HISTOGRAMS_PER_BATCH));
+ size_t max_num_pairs =
+ HISTOGRAMS_PER_BATCH * HISTOGRAMS_PER_BATCH / 2;
+ size_t pairs_capacity = max_num_pairs + 1;
+ HistogramPair* pairs = BROTLI_ALLOC(m, HistogramPair, pairs_capacity);
+ size_t pos = 0;
+ uint32_t* clusters;
+ size_t num_final_clusters;
+ static const uint32_t kInvalidIndex = BROTLI_UINT32_MAX;
+ uint32_t* new_index;
+ size_t i;
+ uint32_t sizes[HISTOGRAMS_PER_BATCH] = { 0 };
+ uint32_t new_clusters[HISTOGRAMS_PER_BATCH] = { 0 };
+ uint32_t symbols[HISTOGRAMS_PER_BATCH] = { 0 };
+ uint32_t remap[HISTOGRAMS_PER_BATCH] = { 0 };
+
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(histogram_symbols) ||
+ BROTLI_IS_NULL(block_lengths) || BROTLI_IS_NULL(all_histograms) ||
+ BROTLI_IS_NULL(cluster_size) || BROTLI_IS_NULL(histograms) ||
+ BROTLI_IS_NULL(pairs)) {
+ return;
+ }
+
+ memset(block_lengths, 0, num_blocks * sizeof(uint32_t));
+
+ {
+ size_t block_idx = 0;
+ for (i = 0; i < length; ++i) {
+ BROTLI_DCHECK(block_idx < num_blocks);
+ ++block_lengths[block_idx];
+ if (i + 1 == length || block_ids[i] != block_ids[i + 1]) {
+ ++block_idx;
+ }
+ }
+ BROTLI_DCHECK(block_idx == num_blocks);
+ }
+
+ for (i = 0; i < num_blocks; i += HISTOGRAMS_PER_BATCH) {
+ const size_t num_to_combine =
+ BROTLI_MIN(size_t, num_blocks - i, HISTOGRAMS_PER_BATCH);
+ size_t num_new_clusters;
+ size_t j;
+ for (j = 0; j < num_to_combine; ++j) {
+ size_t k;
+ FN(HistogramClear)(&histograms[j]);
+ for (k = 0; k < block_lengths[i + j]; ++k) {
+ FN(HistogramAdd)(&histograms[j], data[pos++]);
+ }
+ histograms[j].bit_cost_ = FN(BrotliPopulationCost)(&histograms[j]);
+ new_clusters[j] = (uint32_t)j;
+ symbols[j] = (uint32_t)j;
+ sizes[j] = 1;
+ }
+ num_new_clusters = FN(BrotliHistogramCombine)(
+ histograms, sizes, symbols, new_clusters, pairs, num_to_combine,
+ num_to_combine, HISTOGRAMS_PER_BATCH, max_num_pairs);
+ BROTLI_ENSURE_CAPACITY(m, HistogramType, all_histograms,
+ all_histograms_capacity, all_histograms_size + num_new_clusters);
+ BROTLI_ENSURE_CAPACITY(m, uint32_t, cluster_size,
+ cluster_size_capacity, cluster_size_size + num_new_clusters);
+ if (BROTLI_IS_OOM(m)) return;
+ for (j = 0; j < num_new_clusters; ++j) {
+ all_histograms[all_histograms_size++] = histograms[new_clusters[j]];
+ cluster_size[cluster_size_size++] = sizes[new_clusters[j]];
+ remap[new_clusters[j]] = (uint32_t)j;
+ }
+ for (j = 0; j < num_to_combine; ++j) {
+ histogram_symbols[i + j] = (uint32_t)num_clusters + remap[symbols[j]];
+ }
+ num_clusters += num_new_clusters;
+ BROTLI_DCHECK(num_clusters == cluster_size_size);
+ BROTLI_DCHECK(num_clusters == all_histograms_size);
+ }
+ BROTLI_FREE(m, histograms);
+
+ max_num_pairs =
+ BROTLI_MIN(size_t, 64 * num_clusters, (num_clusters / 2) * num_clusters);
+ if (pairs_capacity < max_num_pairs + 1) {
+ BROTLI_FREE(m, pairs);
+ pairs = BROTLI_ALLOC(m, HistogramPair, max_num_pairs + 1);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(pairs)) return;
+ }
+
+ clusters = BROTLI_ALLOC(m, uint32_t, num_clusters);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(clusters)) return;
+ for (i = 0; i < num_clusters; ++i) {
+ clusters[i] = (uint32_t)i;
+ }
+ num_final_clusters = FN(BrotliHistogramCombine)(
+ all_histograms, cluster_size, histogram_symbols, clusters, pairs,
+ num_clusters, num_blocks, BROTLI_MAX_NUMBER_OF_BLOCK_TYPES,
+ max_num_pairs);
+ BROTLI_FREE(m, pairs);
+ BROTLI_FREE(m, cluster_size);
+
+ new_index = BROTLI_ALLOC(m, uint32_t, num_clusters);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(new_index)) return;
+ for (i = 0; i < num_clusters; ++i) new_index[i] = kInvalidIndex;
+ pos = 0;
+ {
+ uint32_t next_index = 0;
+ for (i = 0; i < num_blocks; ++i) {
+ HistogramType histo;
+ size_t j;
+ uint32_t best_out;
+ double best_bits;
+ FN(HistogramClear)(&histo);
+ for (j = 0; j < block_lengths[i]; ++j) {
+ FN(HistogramAdd)(&histo, data[pos++]);
+ }
+ best_out = (i == 0) ? histogram_symbols[0] : histogram_symbols[i - 1];
+ best_bits =
+ FN(BrotliHistogramBitCostDistance)(&histo, &all_histograms[best_out]);
+ for (j = 0; j < num_final_clusters; ++j) {
+ const double cur_bits = FN(BrotliHistogramBitCostDistance)(
+ &histo, &all_histograms[clusters[j]]);
+ if (cur_bits < best_bits) {
+ best_bits = cur_bits;
+ best_out = clusters[j];
+ }
+ }
+ histogram_symbols[i] = best_out;
+ if (new_index[best_out] == kInvalidIndex) {
+ new_index[best_out] = next_index++;
+ }
+ }
+ }
+ BROTLI_FREE(m, clusters);
+ BROTLI_FREE(m, all_histograms);
+ BROTLI_ENSURE_CAPACITY(
+ m, uint8_t, split->types, split->types_alloc_size, num_blocks);
+ BROTLI_ENSURE_CAPACITY(
+ m, uint32_t, split->lengths, split->lengths_alloc_size, num_blocks);
+ if (BROTLI_IS_OOM(m)) return;
+ {
+ uint32_t cur_length = 0;
+ size_t block_idx = 0;
+ uint8_t max_type = 0;
+ for (i = 0; i < num_blocks; ++i) {
+ cur_length += block_lengths[i];
+ if (i + 1 == num_blocks ||
+ histogram_symbols[i] != histogram_symbols[i + 1]) {
+ const uint8_t id = (uint8_t)new_index[histogram_symbols[i]];
+ split->types[block_idx] = id;
+ split->lengths[block_idx] = cur_length;
+ max_type = BROTLI_MAX(uint8_t, max_type, id);
+ cur_length = 0;
+ ++block_idx;
+ }
+ }
+ split->num_blocks = block_idx;
+ split->num_types = (size_t)max_type + 1;
+ }
+ BROTLI_FREE(m, new_index);
+ BROTLI_FREE(m, block_lengths);
+ BROTLI_FREE(m, histogram_symbols);
+}
+
+static void FN(SplitByteVector)(MemoryManager* m,
+ const DataType* data, const size_t length,
+ const size_t literals_per_histogram,
+ const size_t max_histograms,
+ const size_t sampling_stride_length,
+ const double block_switch_cost,
+ const BrotliEncoderParams* params,
+ BlockSplit* split) {
+ const size_t data_size = FN(HistogramDataSize)();
+ size_t num_histograms = length / literals_per_histogram + 1;
+ HistogramType* histograms;
+ if (num_histograms > max_histograms) {
+ num_histograms = max_histograms;
+ }
+ if (length == 0) {
+ split->num_types = 1;
+ return;
+ } else if (length < kMinLengthForBlockSplitting) {
+ BROTLI_ENSURE_CAPACITY(m, uint8_t,
+ split->types, split->types_alloc_size, split->num_blocks + 1);
+ BROTLI_ENSURE_CAPACITY(m, uint32_t,
+ split->lengths, split->lengths_alloc_size, split->num_blocks + 1);
+ if (BROTLI_IS_OOM(m)) return;
+ split->num_types = 1;
+ split->types[split->num_blocks] = 0;
+ split->lengths[split->num_blocks] = (uint32_t)length;
+ split->num_blocks++;
+ return;
+ }
+ histograms = BROTLI_ALLOC(m, HistogramType, num_histograms);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(histograms)) return;
+ /* Find good entropy codes. */
+ FN(InitialEntropyCodes)(data, length,
+ sampling_stride_length,
+ num_histograms, histograms);
+ FN(RefineEntropyCodes)(data, length,
+ sampling_stride_length,
+ num_histograms, histograms);
+ {
+ /* Find a good path through literals with the good entropy codes. */
+ uint8_t* block_ids = BROTLI_ALLOC(m, uint8_t, length);
+ size_t num_blocks = 0;
+ const size_t bitmaplen = (num_histograms + 7) >> 3;
+ double* insert_cost = BROTLI_ALLOC(m, double, data_size * num_histograms);
+ double* cost = BROTLI_ALLOC(m, double, num_histograms);
+ uint8_t* switch_signal = BROTLI_ALLOC(m, uint8_t, length * bitmaplen);
+ uint16_t* new_id = BROTLI_ALLOC(m, uint16_t, num_histograms);
+ const size_t iters = params->quality < HQ_ZOPFLIFICATION_QUALITY ? 3 : 10;
+ size_t i;
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(block_ids) ||
+ BROTLI_IS_NULL(insert_cost) || BROTLI_IS_NULL(cost) ||
+ BROTLI_IS_NULL(switch_signal) || BROTLI_IS_NULL(new_id)) {
+ return;
+ }
+ for (i = 0; i < iters; ++i) {
+ num_blocks = FN(FindBlocks)(data, length,
+ block_switch_cost,
+ num_histograms, histograms,
+ insert_cost, cost, switch_signal,
+ block_ids);
+ num_histograms = FN(RemapBlockIds)(block_ids, length,
+ new_id, num_histograms);
+ FN(BuildBlockHistograms)(data, length, block_ids,
+ num_histograms, histograms);
+ }
+ BROTLI_FREE(m, insert_cost);
+ BROTLI_FREE(m, cost);
+ BROTLI_FREE(m, switch_signal);
+ BROTLI_FREE(m, new_id);
+ BROTLI_FREE(m, histograms);
+ FN(ClusterBlocks)(m, data, length, num_blocks, block_ids, split);
+ if (BROTLI_IS_OOM(m)) return;
+ BROTLI_FREE(m, block_ids);
+ }
+}
+
+#undef HistogramType
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/brotli_bit_stream.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/brotli_bit_stream.c
new file mode 100644
index 000000000..6391454f9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/brotli_bit_stream.c
@@ -0,0 +1,1329 @@
+/* Copyright 2014 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Brotli bit stream functions to support the low level format. There are no
+ compression algorithms here, just the right ordering of bits to match the
+ specs. */
+
+#include "./brotli_bit_stream.h"
+
+#include <string.h> /* memcpy, memset */
+
+#include "../common/constants.h"
+#include "../common/context.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./entropy_encode.h"
+#include "./entropy_encode_static.h"
+#include "./fast_log.h"
+#include "./histogram.h"
+#include "./memory.h"
+#include "./write_bits.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#define MAX_HUFFMAN_TREE_SIZE (2 * BROTLI_NUM_COMMAND_SYMBOLS + 1)
+/* The maximum size of Huffman dictionary for distances assuming that
+ NPOSTFIX = 0 and NDIRECT = 0. */
+#define MAX_SIMPLE_DISTANCE_ALPHABET_SIZE \
+ BROTLI_DISTANCE_ALPHABET_SIZE(0, 0, BROTLI_LARGE_MAX_DISTANCE_BITS)
+/* MAX_SIMPLE_DISTANCE_ALPHABET_SIZE == 140 */
+
+/* Represents the range of values belonging to a prefix code:
+ [offset, offset + 2^nbits) */
+typedef struct PrefixCodeRange {
+ uint32_t offset;
+ uint32_t nbits;
+} PrefixCodeRange;
+
+static const PrefixCodeRange
+ kBlockLengthPrefixCode[BROTLI_NUM_BLOCK_LEN_SYMBOLS] = {
+ { 1, 2}, { 5, 2}, { 9, 2}, {13, 2}, {17, 3}, { 25, 3}, { 33, 3},
+ {41, 3}, {49, 4}, {65, 4}, {81, 4}, {97, 4}, {113, 5}, {145, 5},
+ {177, 5}, { 209, 5}, { 241, 6}, { 305, 6}, { 369, 7}, { 497, 8},
+ {753, 9}, {1265, 10}, {2289, 11}, {4337, 12}, {8433, 13}, {16625, 24}
+};
+
+static BROTLI_INLINE uint32_t BlockLengthPrefixCode(uint32_t len) {
+ uint32_t code = (len >= 177) ? (len >= 753 ? 20 : 14) : (len >= 41 ? 7 : 0);
+ while (code < (BROTLI_NUM_BLOCK_LEN_SYMBOLS - 1) &&
+ len >= kBlockLengthPrefixCode[code + 1].offset) ++code;
+ return code;
+}
+
+static BROTLI_INLINE void GetBlockLengthPrefixCode(uint32_t len, size_t* code,
+ uint32_t* n_extra, uint32_t* extra) {
+ *code = BlockLengthPrefixCode(len);
+ *n_extra = kBlockLengthPrefixCode[*code].nbits;
+ *extra = len - kBlockLengthPrefixCode[*code].offset;
+}
+
+typedef struct BlockTypeCodeCalculator {
+ size_t last_type;
+ size_t second_last_type;
+} BlockTypeCodeCalculator;
+
+static void InitBlockTypeCodeCalculator(BlockTypeCodeCalculator* self) {
+ self->last_type = 1;
+ self->second_last_type = 0;
+}
+
+static BROTLI_INLINE size_t NextBlockTypeCode(
+ BlockTypeCodeCalculator* calculator, uint8_t type) {
+ size_t type_code = (type == calculator->last_type + 1) ? 1u :
+ (type == calculator->second_last_type) ? 0u : type + 2u;
+ calculator->second_last_type = calculator->last_type;
+ calculator->last_type = type;
+ return type_code;
+}
+
+/* |nibblesbits| represents the 2 bits to encode MNIBBLES (0-3)
+ REQUIRES: length > 0
+ REQUIRES: length <= (1 << 24) */
+static void BrotliEncodeMlen(size_t length, uint64_t* bits,
+ size_t* numbits, uint64_t* nibblesbits) {
+ size_t lg = (length == 1) ? 1 : Log2FloorNonZero((uint32_t)(length - 1)) + 1;
+ size_t mnibbles = (lg < 16 ? 16 : (lg + 3)) / 4;
+ BROTLI_DCHECK(length > 0);
+ BROTLI_DCHECK(length <= (1 << 24));
+ BROTLI_DCHECK(lg <= 24);
+ *nibblesbits = mnibbles - 4;
+ *numbits = mnibbles * 4;
+ *bits = length - 1;
+}
+
+static BROTLI_INLINE void StoreCommandExtra(
+ const Command* cmd, size_t* storage_ix, uint8_t* storage) {
+ uint32_t copylen_code = CommandCopyLenCode(cmd);
+ uint16_t inscode = GetInsertLengthCode(cmd->insert_len_);
+ uint16_t copycode = GetCopyLengthCode(copylen_code);
+ uint32_t insnumextra = GetInsertExtra(inscode);
+ uint64_t insextraval = cmd->insert_len_ - GetInsertBase(inscode);
+ uint64_t copyextraval = copylen_code - GetCopyBase(copycode);
+ uint64_t bits = (copyextraval << insnumextra) | insextraval;
+ BrotliWriteBits(
+ insnumextra + GetCopyExtra(copycode), bits, storage_ix, storage);
+}
+
+/* Data structure that stores almost everything that is needed to encode each
+ block switch command. */
+typedef struct BlockSplitCode {
+ BlockTypeCodeCalculator type_code_calculator;
+ uint8_t type_depths[BROTLI_MAX_BLOCK_TYPE_SYMBOLS];
+ uint16_t type_bits[BROTLI_MAX_BLOCK_TYPE_SYMBOLS];
+ uint8_t length_depths[BROTLI_NUM_BLOCK_LEN_SYMBOLS];
+ uint16_t length_bits[BROTLI_NUM_BLOCK_LEN_SYMBOLS];
+} BlockSplitCode;
+
+/* Stores a number between 0 and 255. */
+static void StoreVarLenUint8(size_t n, size_t* storage_ix, uint8_t* storage) {
+ if (n == 0) {
+ BrotliWriteBits(1, 0, storage_ix, storage);
+ } else {
+ size_t nbits = Log2FloorNonZero(n);
+ BrotliWriteBits(1, 1, storage_ix, storage);
+ BrotliWriteBits(3, nbits, storage_ix, storage);
+ BrotliWriteBits(nbits, n - ((size_t)1 << nbits), storage_ix, storage);
+ }
+}
+
+/* Stores the compressed meta-block header.
+ REQUIRES: length > 0
+ REQUIRES: length <= (1 << 24) */
+static void StoreCompressedMetaBlockHeader(BROTLI_BOOL is_final_block,
+ size_t length,
+ size_t* storage_ix,
+ uint8_t* storage) {
+ uint64_t lenbits;
+ size_t nlenbits;
+ uint64_t nibblesbits;
+
+ /* Write ISLAST bit. */
+ BrotliWriteBits(1, (uint64_t)is_final_block, storage_ix, storage);
+ /* Write ISEMPTY bit. */
+ if (is_final_block) {
+ BrotliWriteBits(1, 0, storage_ix, storage);
+ }
+
+ BrotliEncodeMlen(length, &lenbits, &nlenbits, &nibblesbits);
+ BrotliWriteBits(2, nibblesbits, storage_ix, storage);
+ BrotliWriteBits(nlenbits, lenbits, storage_ix, storage);
+
+ if (!is_final_block) {
+ /* Write ISUNCOMPRESSED bit. */
+ BrotliWriteBits(1, 0, storage_ix, storage);
+ }
+}
+
+/* Stores the uncompressed meta-block header.
+ REQUIRES: length > 0
+ REQUIRES: length <= (1 << 24) */
+static void BrotliStoreUncompressedMetaBlockHeader(size_t length,
+ size_t* storage_ix,
+ uint8_t* storage) {
+ uint64_t lenbits;
+ size_t nlenbits;
+ uint64_t nibblesbits;
+
+ /* Write ISLAST bit.
+ Uncompressed block cannot be the last one, so set to 0. */
+ BrotliWriteBits(1, 0, storage_ix, storage);
+ BrotliEncodeMlen(length, &lenbits, &nlenbits, &nibblesbits);
+ BrotliWriteBits(2, nibblesbits, storage_ix, storage);
+ BrotliWriteBits(nlenbits, lenbits, storage_ix, storage);
+ /* Write ISUNCOMPRESSED bit. */
+ BrotliWriteBits(1, 1, storage_ix, storage);
+}
+
+static void BrotliStoreHuffmanTreeOfHuffmanTreeToBitMask(
+ const int num_codes, const uint8_t* code_length_bitdepth,
+ size_t* storage_ix, uint8_t* storage) {
+ static const uint8_t kStorageOrder[BROTLI_CODE_LENGTH_CODES] = {
+ 1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15
+ };
+ /* The bit lengths of the Huffman code over the code length alphabet
+ are compressed with the following static Huffman code:
+ Symbol Code
+ ------ ----
+ 0 00
+ 1 1110
+ 2 110
+ 3 01
+ 4 10
+ 5 1111 */
+ static const uint8_t kHuffmanBitLengthHuffmanCodeSymbols[6] = {
+ 0, 7, 3, 2, 1, 15
+ };
+ static const uint8_t kHuffmanBitLengthHuffmanCodeBitLengths[6] = {
+ 2, 4, 3, 2, 2, 4
+ };
+
+ size_t skip_some = 0; /* skips none. */
+
+ /* Throw away trailing zeros: */
+ size_t codes_to_store = BROTLI_CODE_LENGTH_CODES;
+ if (num_codes > 1) {
+ for (; codes_to_store > 0; --codes_to_store) {
+ if (code_length_bitdepth[kStorageOrder[codes_to_store - 1]] != 0) {
+ break;
+ }
+ }
+ }
+ if (code_length_bitdepth[kStorageOrder[0]] == 0 &&
+ code_length_bitdepth[kStorageOrder[1]] == 0) {
+ skip_some = 2; /* skips two. */
+ if (code_length_bitdepth[kStorageOrder[2]] == 0) {
+ skip_some = 3; /* skips three. */
+ }
+ }
+ BrotliWriteBits(2, skip_some, storage_ix, storage);
+ {
+ size_t i;
+ for (i = skip_some; i < codes_to_store; ++i) {
+ size_t l = code_length_bitdepth[kStorageOrder[i]];
+ BrotliWriteBits(kHuffmanBitLengthHuffmanCodeBitLengths[l],
+ kHuffmanBitLengthHuffmanCodeSymbols[l], storage_ix, storage);
+ }
+ }
+}
+
+static void BrotliStoreHuffmanTreeToBitMask(
+ const size_t huffman_tree_size, const uint8_t* huffman_tree,
+ const uint8_t* huffman_tree_extra_bits, const uint8_t* code_length_bitdepth,
+ const uint16_t* code_length_bitdepth_symbols,
+ size_t* BROTLI_RESTRICT storage_ix, uint8_t* BROTLI_RESTRICT storage) {
+ size_t i;
+ for (i = 0; i < huffman_tree_size; ++i) {
+ size_t ix = huffman_tree[i];
+ BrotliWriteBits(code_length_bitdepth[ix], code_length_bitdepth_symbols[ix],
+ storage_ix, storage);
+ /* Extra bits */
+ switch (ix) {
+ case BROTLI_REPEAT_PREVIOUS_CODE_LENGTH:
+ BrotliWriteBits(2, huffman_tree_extra_bits[i], storage_ix, storage);
+ break;
+ case BROTLI_REPEAT_ZERO_CODE_LENGTH:
+ BrotliWriteBits(3, huffman_tree_extra_bits[i], storage_ix, storage);
+ break;
+ }
+ }
+}
+
+static void StoreSimpleHuffmanTree(const uint8_t* depths,
+ size_t symbols[4],
+ size_t num_symbols,
+ size_t max_bits,
+ size_t* storage_ix, uint8_t* storage) {
+ /* value of 1 indicates a simple Huffman code */
+ BrotliWriteBits(2, 1, storage_ix, storage);
+ BrotliWriteBits(2, num_symbols - 1, storage_ix, storage); /* NSYM - 1 */
+
+ {
+ /* Sort */
+ size_t i;
+ for (i = 0; i < num_symbols; i++) {
+ size_t j;
+ for (j = i + 1; j < num_symbols; j++) {
+ if (depths[symbols[j]] < depths[symbols[i]]) {
+ BROTLI_SWAP(size_t, symbols, j, i);
+ }
+ }
+ }
+ }
+
+ if (num_symbols == 2) {
+ BrotliWriteBits(max_bits, symbols[0], storage_ix, storage);
+ BrotliWriteBits(max_bits, symbols[1], storage_ix, storage);
+ } else if (num_symbols == 3) {
+ BrotliWriteBits(max_bits, symbols[0], storage_ix, storage);
+ BrotliWriteBits(max_bits, symbols[1], storage_ix, storage);
+ BrotliWriteBits(max_bits, symbols[2], storage_ix, storage);
+ } else {
+ BrotliWriteBits(max_bits, symbols[0], storage_ix, storage);
+ BrotliWriteBits(max_bits, symbols[1], storage_ix, storage);
+ BrotliWriteBits(max_bits, symbols[2], storage_ix, storage);
+ BrotliWriteBits(max_bits, symbols[3], storage_ix, storage);
+ /* tree-select */
+ BrotliWriteBits(1, depths[symbols[0]] == 1 ? 1 : 0, storage_ix, storage);
+ }
+}
+
+/* num = alphabet size
+ depths = symbol depths */
+void BrotliStoreHuffmanTree(const uint8_t* depths, size_t num,
+ HuffmanTree* tree,
+ size_t* storage_ix, uint8_t* storage) {
+ /* Write the Huffman tree into the brotli-representation.
+ The command alphabet is the largest, so this allocation will fit all
+ alphabets. */
+ uint8_t huffman_tree[BROTLI_NUM_COMMAND_SYMBOLS];
+ uint8_t huffman_tree_extra_bits[BROTLI_NUM_COMMAND_SYMBOLS];
+ size_t huffman_tree_size = 0;
+ uint8_t code_length_bitdepth[BROTLI_CODE_LENGTH_CODES] = { 0 };
+ uint16_t code_length_bitdepth_symbols[BROTLI_CODE_LENGTH_CODES];
+ uint32_t huffman_tree_histogram[BROTLI_CODE_LENGTH_CODES] = { 0 };
+ size_t i;
+ int num_codes = 0;
+ size_t code = 0;
+
+ BROTLI_DCHECK(num <= BROTLI_NUM_COMMAND_SYMBOLS);
+
+ BrotliWriteHuffmanTree(depths, num, &huffman_tree_size, huffman_tree,
+ huffman_tree_extra_bits);
+
+ /* Calculate the statistics of the Huffman tree in brotli-representation. */
+ for (i = 0; i < huffman_tree_size; ++i) {
+ ++huffman_tree_histogram[huffman_tree[i]];
+ }
+
+ for (i = 0; i < BROTLI_CODE_LENGTH_CODES; ++i) {
+ if (huffman_tree_histogram[i]) {
+ if (num_codes == 0) {
+ code = i;
+ num_codes = 1;
+ } else if (num_codes == 1) {
+ num_codes = 2;
+ break;
+ }
+ }
+ }
+
+ /* Calculate another Huffman tree to use for compressing both the
+ earlier Huffman tree with. */
+ BrotliCreateHuffmanTree(huffman_tree_histogram, BROTLI_CODE_LENGTH_CODES,
+ 5, tree, code_length_bitdepth);
+ BrotliConvertBitDepthsToSymbols(code_length_bitdepth,
+ BROTLI_CODE_LENGTH_CODES,
+ code_length_bitdepth_symbols);
+
+ /* Now, we have all the data, let's start storing it */
+ BrotliStoreHuffmanTreeOfHuffmanTreeToBitMask(num_codes, code_length_bitdepth,
+ storage_ix, storage);
+
+ if (num_codes == 1) {
+ code_length_bitdepth[code] = 0;
+ }
+
+ /* Store the real Huffman tree now. */
+ BrotliStoreHuffmanTreeToBitMask(huffman_tree_size,
+ huffman_tree,
+ huffman_tree_extra_bits,
+ code_length_bitdepth,
+ code_length_bitdepth_symbols,
+ storage_ix, storage);
+}
+
+/* Builds a Huffman tree from histogram[0:length] into depth[0:length] and
+ bits[0:length] and stores the encoded tree to the bit stream. */
+static void BuildAndStoreHuffmanTree(const uint32_t* histogram,
+ const size_t histogram_length,
+ const size_t alphabet_size,
+ HuffmanTree* tree,
+ uint8_t* depth,
+ uint16_t* bits,
+ size_t* storage_ix,
+ uint8_t* storage) {
+ size_t count = 0;
+ size_t s4[4] = { 0 };
+ size_t i;
+ size_t max_bits = 0;
+ for (i = 0; i < histogram_length; i++) {
+ if (histogram[i]) {
+ if (count < 4) {
+ s4[count] = i;
+ } else if (count > 4) {
+ break;
+ }
+ count++;
+ }
+ }
+
+ {
+ size_t max_bits_counter = alphabet_size - 1;
+ while (max_bits_counter) {
+ max_bits_counter >>= 1;
+ ++max_bits;
+ }
+ }
+
+ if (count <= 1) {
+ BrotliWriteBits(4, 1, storage_ix, storage);
+ BrotliWriteBits(max_bits, s4[0], storage_ix, storage);
+ depth[s4[0]] = 0;
+ bits[s4[0]] = 0;
+ return;
+ }
+
+ memset(depth, 0, histogram_length * sizeof(depth[0]));
+ BrotliCreateHuffmanTree(histogram, histogram_length, 15, tree, depth);
+ BrotliConvertBitDepthsToSymbols(depth, histogram_length, bits);
+
+ if (count <= 4) {
+ StoreSimpleHuffmanTree(depth, s4, count, max_bits, storage_ix, storage);
+ } else {
+ BrotliStoreHuffmanTree(depth, histogram_length, tree, storage_ix, storage);
+ }
+}
+
+static BROTLI_INLINE BROTLI_BOOL SortHuffmanTree(
+ const HuffmanTree* v0, const HuffmanTree* v1) {
+ return TO_BROTLI_BOOL(v0->total_count_ < v1->total_count_);
+}
+
+void BrotliBuildAndStoreHuffmanTreeFast(MemoryManager* m,
+ const uint32_t* histogram,
+ const size_t histogram_total,
+ const size_t max_bits,
+ uint8_t* depth, uint16_t* bits,
+ size_t* storage_ix,
+ uint8_t* storage) {
+ size_t count = 0;
+ size_t symbols[4] = { 0 };
+ size_t length = 0;
+ size_t total = histogram_total;
+ while (total != 0) {
+ if (histogram[length]) {
+ if (count < 4) {
+ symbols[count] = length;
+ }
+ ++count;
+ total -= histogram[length];
+ }
+ ++length;
+ }
+
+ if (count <= 1) {
+ BrotliWriteBits(4, 1, storage_ix, storage);
+ BrotliWriteBits(max_bits, symbols[0], storage_ix, storage);
+ depth[symbols[0]] = 0;
+ bits[symbols[0]] = 0;
+ return;
+ }
+
+ memset(depth, 0, length * sizeof(depth[0]));
+ {
+ const size_t max_tree_size = 2 * length + 1;
+ HuffmanTree* tree = BROTLI_ALLOC(m, HuffmanTree, max_tree_size);
+ uint32_t count_limit;
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(tree)) return;
+ for (count_limit = 1; ; count_limit *= 2) {
+ HuffmanTree* node = tree;
+ size_t l;
+ for (l = length; l != 0;) {
+ --l;
+ if (histogram[l]) {
+ if (BROTLI_PREDICT_TRUE(histogram[l] >= count_limit)) {
+ InitHuffmanTree(node, histogram[l], -1, (int16_t)l);
+ } else {
+ InitHuffmanTree(node, count_limit, -1, (int16_t)l);
+ }
+ ++node;
+ }
+ }
+ {
+ const int n = (int)(node - tree);
+ HuffmanTree sentinel;
+ int i = 0; /* Points to the next leaf node. */
+ int j = n + 1; /* Points to the next non-leaf node. */
+ int k;
+
+ SortHuffmanTreeItems(tree, (size_t)n, SortHuffmanTree);
+ /* The nodes are:
+ [0, n): the sorted leaf nodes that we start with.
+ [n]: we add a sentinel here.
+ [n + 1, 2n): new parent nodes are added here, starting from
+ (n+1). These are naturally in ascending order.
+ [2n]: we add a sentinel at the end as well.
+ There will be (2n+1) elements at the end. */
+ InitHuffmanTree(&sentinel, BROTLI_UINT32_MAX, -1, -1);
+ *node++ = sentinel;
+ *node++ = sentinel;
+
+ for (k = n - 1; k > 0; --k) {
+ int left, right;
+ if (tree[i].total_count_ <= tree[j].total_count_) {
+ left = i;
+ ++i;
+ } else {
+ left = j;
+ ++j;
+ }
+ if (tree[i].total_count_ <= tree[j].total_count_) {
+ right = i;
+ ++i;
+ } else {
+ right = j;
+ ++j;
+ }
+ /* The sentinel node becomes the parent node. */
+ node[-1].total_count_ =
+ tree[left].total_count_ + tree[right].total_count_;
+ node[-1].index_left_ = (int16_t)left;
+ node[-1].index_right_or_value_ = (int16_t)right;
+ /* Add back the last sentinel node. */
+ *node++ = sentinel;
+ }
+ if (BrotliSetDepth(2 * n - 1, tree, depth, 14)) {
+ /* We need to pack the Huffman tree in 14 bits. If this was not
+ successful, add fake entities to the lowest values and retry. */
+ break;
+ }
+ }
+ }
+ BROTLI_FREE(m, tree);
+ }
+ BrotliConvertBitDepthsToSymbols(depth, length, bits);
+ if (count <= 4) {
+ size_t i;
+ /* value of 1 indicates a simple Huffman code */
+ BrotliWriteBits(2, 1, storage_ix, storage);
+ BrotliWriteBits(2, count - 1, storage_ix, storage); /* NSYM - 1 */
+
+ /* Sort */
+ for (i = 0; i < count; i++) {
+ size_t j;
+ for (j = i + 1; j < count; j++) {
+ if (depth[symbols[j]] < depth[symbols[i]]) {
+ BROTLI_SWAP(size_t, symbols, j, i);
+ }
+ }
+ }
+
+ if (count == 2) {
+ BrotliWriteBits(max_bits, symbols[0], storage_ix, storage);
+ BrotliWriteBits(max_bits, symbols[1], storage_ix, storage);
+ } else if (count == 3) {
+ BrotliWriteBits(max_bits, symbols[0], storage_ix, storage);
+ BrotliWriteBits(max_bits, symbols[1], storage_ix, storage);
+ BrotliWriteBits(max_bits, symbols[2], storage_ix, storage);
+ } else {
+ BrotliWriteBits(max_bits, symbols[0], storage_ix, storage);
+ BrotliWriteBits(max_bits, symbols[1], storage_ix, storage);
+ BrotliWriteBits(max_bits, symbols[2], storage_ix, storage);
+ BrotliWriteBits(max_bits, symbols[3], storage_ix, storage);
+ /* tree-select */
+ BrotliWriteBits(1, depth[symbols[0]] == 1 ? 1 : 0, storage_ix, storage);
+ }
+ } else {
+ uint8_t previous_value = 8;
+ size_t i;
+ /* Complex Huffman Tree */
+ StoreStaticCodeLengthCode(storage_ix, storage);
+
+ /* Actual RLE coding. */
+ for (i = 0; i < length;) {
+ const uint8_t value = depth[i];
+ size_t reps = 1;
+ size_t k;
+ for (k = i + 1; k < length && depth[k] == value; ++k) {
+ ++reps;
+ }
+ i += reps;
+ if (value == 0) {
+ BrotliWriteBits(kZeroRepsDepth[reps], kZeroRepsBits[reps],
+ storage_ix, storage);
+ } else {
+ if (previous_value != value) {
+ BrotliWriteBits(kCodeLengthDepth[value], kCodeLengthBits[value],
+ storage_ix, storage);
+ --reps;
+ }
+ if (reps < 3) {
+ while (reps != 0) {
+ reps--;
+ BrotliWriteBits(kCodeLengthDepth[value], kCodeLengthBits[value],
+ storage_ix, storage);
+ }
+ } else {
+ reps -= 3;
+ BrotliWriteBits(kNonZeroRepsDepth[reps], kNonZeroRepsBits[reps],
+ storage_ix, storage);
+ }
+ previous_value = value;
+ }
+ }
+ }
+}
+
+static size_t IndexOf(const uint8_t* v, size_t v_size, uint8_t value) {
+ size_t i = 0;
+ for (; i < v_size; ++i) {
+ if (v[i] == value) return i;
+ }
+ return i;
+}
+
+static void MoveToFront(uint8_t* v, size_t index) {
+ uint8_t value = v[index];
+ size_t i;
+ for (i = index; i != 0; --i) {
+ v[i] = v[i - 1];
+ }
+ v[0] = value;
+}
+
+static void MoveToFrontTransform(const uint32_t* BROTLI_RESTRICT v_in,
+ const size_t v_size,
+ uint32_t* v_out) {
+ size_t i;
+ uint8_t mtf[256];
+ uint32_t max_value;
+ if (v_size == 0) {
+ return;
+ }
+ max_value = v_in[0];
+ for (i = 1; i < v_size; ++i) {
+ if (v_in[i] > max_value) max_value = v_in[i];
+ }
+ BROTLI_DCHECK(max_value < 256u);
+ for (i = 0; i <= max_value; ++i) {
+ mtf[i] = (uint8_t)i;
+ }
+ {
+ size_t mtf_size = max_value + 1;
+ for (i = 0; i < v_size; ++i) {
+ size_t index = IndexOf(mtf, mtf_size, (uint8_t)v_in[i]);
+ BROTLI_DCHECK(index < mtf_size);
+ v_out[i] = (uint32_t)index;
+ MoveToFront(mtf, index);
+ }
+ }
+}
+
+/* Finds runs of zeros in v[0..in_size) and replaces them with a prefix code of
+ the run length plus extra bits (lower 9 bits is the prefix code and the rest
+ are the extra bits). Non-zero values in v[] are shifted by
+ *max_length_prefix. Will not create prefix codes bigger than the initial
+ value of *max_run_length_prefix. The prefix code of run length L is simply
+ Log2Floor(L) and the number of extra bits is the same as the prefix code. */
+static void RunLengthCodeZeros(const size_t in_size,
+ uint32_t* BROTLI_RESTRICT v, size_t* BROTLI_RESTRICT out_size,
+ uint32_t* BROTLI_RESTRICT max_run_length_prefix) {
+ uint32_t max_reps = 0;
+ size_t i;
+ uint32_t max_prefix;
+ for (i = 0; i < in_size;) {
+ uint32_t reps = 0;
+ for (; i < in_size && v[i] != 0; ++i) ;
+ for (; i < in_size && v[i] == 0; ++i) {
+ ++reps;
+ }
+ max_reps = BROTLI_MAX(uint32_t, reps, max_reps);
+ }
+ max_prefix = max_reps > 0 ? Log2FloorNonZero(max_reps) : 0;
+ max_prefix = BROTLI_MIN(uint32_t, max_prefix, *max_run_length_prefix);
+ *max_run_length_prefix = max_prefix;
+ *out_size = 0;
+ for (i = 0; i < in_size;) {
+ BROTLI_DCHECK(*out_size <= i);
+ if (v[i] != 0) {
+ v[*out_size] = v[i] + *max_run_length_prefix;
+ ++i;
+ ++(*out_size);
+ } else {
+ uint32_t reps = 1;
+ size_t k;
+ for (k = i + 1; k < in_size && v[k] == 0; ++k) {
+ ++reps;
+ }
+ i += reps;
+ while (reps != 0) {
+ if (reps < (2u << max_prefix)) {
+ uint32_t run_length_prefix = Log2FloorNonZero(reps);
+ const uint32_t extra_bits = reps - (1u << run_length_prefix);
+ v[*out_size] = run_length_prefix + (extra_bits << 9);
+ ++(*out_size);
+ break;
+ } else {
+ const uint32_t extra_bits = (1u << max_prefix) - 1u;
+ v[*out_size] = max_prefix + (extra_bits << 9);
+ reps -= (2u << max_prefix) - 1u;
+ ++(*out_size);
+ }
+ }
+ }
+ }
+}
+
+#define SYMBOL_BITS 9
+
+static void EncodeContextMap(MemoryManager* m,
+ const uint32_t* context_map,
+ size_t context_map_size,
+ size_t num_clusters,
+ HuffmanTree* tree,
+ size_t* storage_ix, uint8_t* storage) {
+ size_t i;
+ uint32_t* rle_symbols;
+ uint32_t max_run_length_prefix = 6;
+ size_t num_rle_symbols = 0;
+ uint32_t histogram[BROTLI_MAX_CONTEXT_MAP_SYMBOLS];
+ static const uint32_t kSymbolMask = (1u << SYMBOL_BITS) - 1u;
+ uint8_t depths[BROTLI_MAX_CONTEXT_MAP_SYMBOLS];
+ uint16_t bits[BROTLI_MAX_CONTEXT_MAP_SYMBOLS];
+
+ StoreVarLenUint8(num_clusters - 1, storage_ix, storage);
+
+ if (num_clusters == 1) {
+ return;
+ }
+
+ rle_symbols = BROTLI_ALLOC(m, uint32_t, context_map_size);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(rle_symbols)) return;
+ MoveToFrontTransform(context_map, context_map_size, rle_symbols);
+ RunLengthCodeZeros(context_map_size, rle_symbols,
+ &num_rle_symbols, &max_run_length_prefix);
+ memset(histogram, 0, sizeof(histogram));
+ for (i = 0; i < num_rle_symbols; ++i) {
+ ++histogram[rle_symbols[i] & kSymbolMask];
+ }
+ {
+ BROTLI_BOOL use_rle = TO_BROTLI_BOOL(max_run_length_prefix > 0);
+ BrotliWriteBits(1, (uint64_t)use_rle, storage_ix, storage);
+ if (use_rle) {
+ BrotliWriteBits(4, max_run_length_prefix - 1, storage_ix, storage);
+ }
+ }
+ BuildAndStoreHuffmanTree(histogram, num_clusters + max_run_length_prefix,
+ num_clusters + max_run_length_prefix,
+ tree, depths, bits, storage_ix, storage);
+ for (i = 0; i < num_rle_symbols; ++i) {
+ const uint32_t rle_symbol = rle_symbols[i] & kSymbolMask;
+ const uint32_t extra_bits_val = rle_symbols[i] >> SYMBOL_BITS;
+ BrotliWriteBits(depths[rle_symbol], bits[rle_symbol], storage_ix, storage);
+ if (rle_symbol > 0 && rle_symbol <= max_run_length_prefix) {
+ BrotliWriteBits(rle_symbol, extra_bits_val, storage_ix, storage);
+ }
+ }
+ BrotliWriteBits(1, 1, storage_ix, storage); /* use move-to-front */
+ BROTLI_FREE(m, rle_symbols);
+}
+
+/* Stores the block switch command with index block_ix to the bit stream. */
+static BROTLI_INLINE void StoreBlockSwitch(BlockSplitCode* code,
+ const uint32_t block_len,
+ const uint8_t block_type,
+ BROTLI_BOOL is_first_block,
+ size_t* storage_ix,
+ uint8_t* storage) {
+ size_t typecode = NextBlockTypeCode(&code->type_code_calculator, block_type);
+ size_t lencode;
+ uint32_t len_nextra;
+ uint32_t len_extra;
+ if (!is_first_block) {
+ BrotliWriteBits(code->type_depths[typecode], code->type_bits[typecode],
+ storage_ix, storage);
+ }
+ GetBlockLengthPrefixCode(block_len, &lencode, &len_nextra, &len_extra);
+
+ BrotliWriteBits(code->length_depths[lencode], code->length_bits[lencode],
+ storage_ix, storage);
+ BrotliWriteBits(len_nextra, len_extra, storage_ix, storage);
+}
+
+/* Builds a BlockSplitCode data structure from the block split given by the
+ vector of block types and block lengths and stores it to the bit stream. */
+static void BuildAndStoreBlockSplitCode(const uint8_t* types,
+ const uint32_t* lengths,
+ const size_t num_blocks,
+ const size_t num_types,
+ HuffmanTree* tree,
+ BlockSplitCode* code,
+ size_t* storage_ix,
+ uint8_t* storage) {
+ uint32_t type_histo[BROTLI_MAX_BLOCK_TYPE_SYMBOLS];
+ uint32_t length_histo[BROTLI_NUM_BLOCK_LEN_SYMBOLS];
+ size_t i;
+ BlockTypeCodeCalculator type_code_calculator;
+ memset(type_histo, 0, (num_types + 2) * sizeof(type_histo[0]));
+ memset(length_histo, 0, sizeof(length_histo));
+ InitBlockTypeCodeCalculator(&type_code_calculator);
+ for (i = 0; i < num_blocks; ++i) {
+ size_t type_code = NextBlockTypeCode(&type_code_calculator, types[i]);
+ if (i != 0) ++type_histo[type_code];
+ ++length_histo[BlockLengthPrefixCode(lengths[i])];
+ }
+ StoreVarLenUint8(num_types - 1, storage_ix, storage);
+ if (num_types > 1) { /* TODO: else? could StoreBlockSwitch occur? */
+ BuildAndStoreHuffmanTree(&type_histo[0], num_types + 2, num_types + 2, tree,
+ &code->type_depths[0], &code->type_bits[0],
+ storage_ix, storage);
+ BuildAndStoreHuffmanTree(&length_histo[0], BROTLI_NUM_BLOCK_LEN_SYMBOLS,
+ BROTLI_NUM_BLOCK_LEN_SYMBOLS,
+ tree, &code->length_depths[0],
+ &code->length_bits[0], storage_ix, storage);
+ StoreBlockSwitch(code, lengths[0], types[0], 1, storage_ix, storage);
+ }
+}
+
+/* Stores a context map where the histogram type is always the block type. */
+static void StoreTrivialContextMap(size_t num_types,
+ size_t context_bits,
+ HuffmanTree* tree,
+ size_t* storage_ix,
+ uint8_t* storage) {
+ StoreVarLenUint8(num_types - 1, storage_ix, storage);
+ if (num_types > 1) {
+ size_t repeat_code = context_bits - 1u;
+ size_t repeat_bits = (1u << repeat_code) - 1u;
+ size_t alphabet_size = num_types + repeat_code;
+ uint32_t histogram[BROTLI_MAX_CONTEXT_MAP_SYMBOLS];
+ uint8_t depths[BROTLI_MAX_CONTEXT_MAP_SYMBOLS];
+ uint16_t bits[BROTLI_MAX_CONTEXT_MAP_SYMBOLS];
+ size_t i;
+ memset(histogram, 0, alphabet_size * sizeof(histogram[0]));
+ /* Write RLEMAX. */
+ BrotliWriteBits(1, 1, storage_ix, storage);
+ BrotliWriteBits(4, repeat_code - 1, storage_ix, storage);
+ histogram[repeat_code] = (uint32_t)num_types;
+ histogram[0] = 1;
+ for (i = context_bits; i < alphabet_size; ++i) {
+ histogram[i] = 1;
+ }
+ BuildAndStoreHuffmanTree(histogram, alphabet_size, alphabet_size,
+ tree, depths, bits, storage_ix, storage);
+ for (i = 0; i < num_types; ++i) {
+ size_t code = (i == 0 ? 0 : i + context_bits - 1);
+ BrotliWriteBits(depths[code], bits[code], storage_ix, storage);
+ BrotliWriteBits(
+ depths[repeat_code], bits[repeat_code], storage_ix, storage);
+ BrotliWriteBits(repeat_code, repeat_bits, storage_ix, storage);
+ }
+ /* Write IMTF (inverse-move-to-front) bit. */
+ BrotliWriteBits(1, 1, storage_ix, storage);
+ }
+}
+
+/* Manages the encoding of one block category (literal, command or distance). */
+typedef struct BlockEncoder {
+ size_t histogram_length_;
+ size_t num_block_types_;
+ const uint8_t* block_types_; /* Not owned. */
+ const uint32_t* block_lengths_; /* Not owned. */
+ size_t num_blocks_;
+ BlockSplitCode block_split_code_;
+ size_t block_ix_;
+ size_t block_len_;
+ size_t entropy_ix_;
+ uint8_t* depths_;
+ uint16_t* bits_;
+} BlockEncoder;
+
+static void InitBlockEncoder(BlockEncoder* self, size_t histogram_length,
+ size_t num_block_types, const uint8_t* block_types,
+ const uint32_t* block_lengths, const size_t num_blocks) {
+ self->histogram_length_ = histogram_length;
+ self->num_block_types_ = num_block_types;
+ self->block_types_ = block_types;
+ self->block_lengths_ = block_lengths;
+ self->num_blocks_ = num_blocks;
+ InitBlockTypeCodeCalculator(&self->block_split_code_.type_code_calculator);
+ self->block_ix_ = 0;
+ self->block_len_ = num_blocks == 0 ? 0 : block_lengths[0];
+ self->entropy_ix_ = 0;
+ self->depths_ = 0;
+ self->bits_ = 0;
+}
+
+static void CleanupBlockEncoder(MemoryManager* m, BlockEncoder* self) {
+ BROTLI_FREE(m, self->depths_);
+ BROTLI_FREE(m, self->bits_);
+}
+
+/* Creates entropy codes of block lengths and block types and stores them
+ to the bit stream. */
+static void BuildAndStoreBlockSwitchEntropyCodes(BlockEncoder* self,
+ HuffmanTree* tree, size_t* storage_ix, uint8_t* storage) {
+ BuildAndStoreBlockSplitCode(self->block_types_, self->block_lengths_,
+ self->num_blocks_, self->num_block_types_, tree, &self->block_split_code_,
+ storage_ix, storage);
+}
+
+/* Stores the next symbol with the entropy code of the current block type.
+ Updates the block type and block length at block boundaries. */
+static void StoreSymbol(BlockEncoder* self, size_t symbol, size_t* storage_ix,
+ uint8_t* storage) {
+ if (self->block_len_ == 0) {
+ size_t block_ix = ++self->block_ix_;
+ uint32_t block_len = self->block_lengths_[block_ix];
+ uint8_t block_type = self->block_types_[block_ix];
+ self->block_len_ = block_len;
+ self->entropy_ix_ = block_type * self->histogram_length_;
+ StoreBlockSwitch(&self->block_split_code_, block_len, block_type, 0,
+ storage_ix, storage);
+ }
+ --self->block_len_;
+ {
+ size_t ix = self->entropy_ix_ + symbol;
+ BrotliWriteBits(self->depths_[ix], self->bits_[ix], storage_ix, storage);
+ }
+}
+
+/* Stores the next symbol with the entropy code of the current block type and
+ context value.
+ Updates the block type and block length at block boundaries. */
+static void StoreSymbolWithContext(BlockEncoder* self, size_t symbol,
+ size_t context, const uint32_t* context_map, size_t* storage_ix,
+ uint8_t* storage, const size_t context_bits) {
+ if (self->block_len_ == 0) {
+ size_t block_ix = ++self->block_ix_;
+ uint32_t block_len = self->block_lengths_[block_ix];
+ uint8_t block_type = self->block_types_[block_ix];
+ self->block_len_ = block_len;
+ self->entropy_ix_ = (size_t)block_type << context_bits;
+ StoreBlockSwitch(&self->block_split_code_, block_len, block_type, 0,
+ storage_ix, storage);
+ }
+ --self->block_len_;
+ {
+ size_t histo_ix = context_map[self->entropy_ix_ + context];
+ size_t ix = histo_ix * self->histogram_length_ + symbol;
+ BrotliWriteBits(self->depths_[ix], self->bits_[ix], storage_ix, storage);
+ }
+}
+
+#define FN(X) X ## Literal
+/* NOLINTNEXTLINE(build/include) */
+#include "./block_encoder_inc.h"
+#undef FN
+
+#define FN(X) X ## Command
+/* NOLINTNEXTLINE(build/include) */
+#include "./block_encoder_inc.h"
+#undef FN
+
+#define FN(X) X ## Distance
+/* NOLINTNEXTLINE(build/include) */
+#include "./block_encoder_inc.h"
+#undef FN
+
+static void JumpToByteBoundary(size_t* storage_ix, uint8_t* storage) {
+ *storage_ix = (*storage_ix + 7u) & ~7u;
+ storage[*storage_ix >> 3] = 0;
+}
+
+void BrotliStoreMetaBlock(MemoryManager* m,
+ const uint8_t* input, size_t start_pos, size_t length, size_t mask,
+ uint8_t prev_byte, uint8_t prev_byte2, BROTLI_BOOL is_last,
+ const BrotliEncoderParams* params, ContextType literal_context_mode,
+ const Command* commands, size_t n_commands, const MetaBlockSplit* mb,
+ size_t* storage_ix, uint8_t* storage) {
+
+ size_t pos = start_pos;
+ size_t i;
+ uint32_t num_distance_symbols = params->dist.alphabet_size_max;
+ uint32_t num_effective_distance_symbols = params->dist.alphabet_size_limit;
+ HuffmanTree* tree;
+ ContextLut literal_context_lut = BROTLI_CONTEXT_LUT(literal_context_mode);
+ BlockEncoder literal_enc;
+ BlockEncoder command_enc;
+ BlockEncoder distance_enc;
+ const BrotliDistanceParams* dist = &params->dist;
+ BROTLI_DCHECK(
+ num_effective_distance_symbols <= BROTLI_NUM_HISTOGRAM_DISTANCE_SYMBOLS);
+
+ StoreCompressedMetaBlockHeader(is_last, length, storage_ix, storage);
+
+ tree = BROTLI_ALLOC(m, HuffmanTree, MAX_HUFFMAN_TREE_SIZE);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(tree)) return;
+ InitBlockEncoder(&literal_enc, BROTLI_NUM_LITERAL_SYMBOLS,
+ mb->literal_split.num_types, mb->literal_split.types,
+ mb->literal_split.lengths, mb->literal_split.num_blocks);
+ InitBlockEncoder(&command_enc, BROTLI_NUM_COMMAND_SYMBOLS,
+ mb->command_split.num_types, mb->command_split.types,
+ mb->command_split.lengths, mb->command_split.num_blocks);
+ InitBlockEncoder(&distance_enc, num_effective_distance_symbols,
+ mb->distance_split.num_types, mb->distance_split.types,
+ mb->distance_split.lengths, mb->distance_split.num_blocks);
+
+ BuildAndStoreBlockSwitchEntropyCodes(&literal_enc, tree, storage_ix, storage);
+ BuildAndStoreBlockSwitchEntropyCodes(&command_enc, tree, storage_ix, storage);
+ BuildAndStoreBlockSwitchEntropyCodes(
+ &distance_enc, tree, storage_ix, storage);
+
+ BrotliWriteBits(2, dist->distance_postfix_bits, storage_ix, storage);
+ BrotliWriteBits(
+ 4, dist->num_direct_distance_codes >> dist->distance_postfix_bits,
+ storage_ix, storage);
+ for (i = 0; i < mb->literal_split.num_types; ++i) {
+ BrotliWriteBits(2, literal_context_mode, storage_ix, storage);
+ }
+
+ if (mb->literal_context_map_size == 0) {
+ StoreTrivialContextMap(mb->literal_histograms_size,
+ BROTLI_LITERAL_CONTEXT_BITS, tree, storage_ix, storage);
+ } else {
+ EncodeContextMap(m,
+ mb->literal_context_map, mb->literal_context_map_size,
+ mb->literal_histograms_size, tree, storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ }
+
+ if (mb->distance_context_map_size == 0) {
+ StoreTrivialContextMap(mb->distance_histograms_size,
+ BROTLI_DISTANCE_CONTEXT_BITS, tree, storage_ix, storage);
+ } else {
+ EncodeContextMap(m,
+ mb->distance_context_map, mb->distance_context_map_size,
+ mb->distance_histograms_size, tree, storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ }
+
+ BuildAndStoreEntropyCodesLiteral(m, &literal_enc, mb->literal_histograms,
+ mb->literal_histograms_size, BROTLI_NUM_LITERAL_SYMBOLS, tree,
+ storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ BuildAndStoreEntropyCodesCommand(m, &command_enc, mb->command_histograms,
+ mb->command_histograms_size, BROTLI_NUM_COMMAND_SYMBOLS, tree,
+ storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ BuildAndStoreEntropyCodesDistance(m, &distance_enc, mb->distance_histograms,
+ mb->distance_histograms_size, num_distance_symbols, tree,
+ storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ BROTLI_FREE(m, tree);
+
+ for (i = 0; i < n_commands; ++i) {
+ const Command cmd = commands[i];
+ size_t cmd_code = cmd.cmd_prefix_;
+ StoreSymbol(&command_enc, cmd_code, storage_ix, storage);
+ StoreCommandExtra(&cmd, storage_ix, storage);
+ if (mb->literal_context_map_size == 0) {
+ size_t j;
+ for (j = cmd.insert_len_; j != 0; --j) {
+ StoreSymbol(&literal_enc, input[pos & mask], storage_ix, storage);
+ ++pos;
+ }
+ } else {
+ size_t j;
+ for (j = cmd.insert_len_; j != 0; --j) {
+ size_t context =
+ BROTLI_CONTEXT(prev_byte, prev_byte2, literal_context_lut);
+ uint8_t literal = input[pos & mask];
+ StoreSymbolWithContext(&literal_enc, literal, context,
+ mb->literal_context_map, storage_ix, storage,
+ BROTLI_LITERAL_CONTEXT_BITS);
+ prev_byte2 = prev_byte;
+ prev_byte = literal;
+ ++pos;
+ }
+ }
+ pos += CommandCopyLen(&cmd);
+ if (CommandCopyLen(&cmd)) {
+ prev_byte2 = input[(pos - 2) & mask];
+ prev_byte = input[(pos - 1) & mask];
+ if (cmd.cmd_prefix_ >= 128) {
+ size_t dist_code = cmd.dist_prefix_ & 0x3FF;
+ uint32_t distnumextra = cmd.dist_prefix_ >> 10;
+ uint64_t distextra = cmd.dist_extra_;
+ if (mb->distance_context_map_size == 0) {
+ StoreSymbol(&distance_enc, dist_code, storage_ix, storage);
+ } else {
+ size_t context = CommandDistanceContext(&cmd);
+ StoreSymbolWithContext(&distance_enc, dist_code, context,
+ mb->distance_context_map, storage_ix, storage,
+ BROTLI_DISTANCE_CONTEXT_BITS);
+ }
+ BrotliWriteBits(distnumextra, distextra, storage_ix, storage);
+ }
+ }
+ }
+ CleanupBlockEncoder(m, &distance_enc);
+ CleanupBlockEncoder(m, &command_enc);
+ CleanupBlockEncoder(m, &literal_enc);
+ if (is_last) {
+ JumpToByteBoundary(storage_ix, storage);
+ }
+}
+
+static void BuildHistograms(const uint8_t* input,
+ size_t start_pos,
+ size_t mask,
+ const Command* commands,
+ size_t n_commands,
+ HistogramLiteral* lit_histo,
+ HistogramCommand* cmd_histo,
+ HistogramDistance* dist_histo) {
+ size_t pos = start_pos;
+ size_t i;
+ for (i = 0; i < n_commands; ++i) {
+ const Command cmd = commands[i];
+ size_t j;
+ HistogramAddCommand(cmd_histo, cmd.cmd_prefix_);
+ for (j = cmd.insert_len_; j != 0; --j) {
+ HistogramAddLiteral(lit_histo, input[pos & mask]);
+ ++pos;
+ }
+ pos += CommandCopyLen(&cmd);
+ if (CommandCopyLen(&cmd) && cmd.cmd_prefix_ >= 128) {
+ HistogramAddDistance(dist_histo, cmd.dist_prefix_ & 0x3FF);
+ }
+ }
+}
+
+static void StoreDataWithHuffmanCodes(const uint8_t* input,
+ size_t start_pos,
+ size_t mask,
+ const Command* commands,
+ size_t n_commands,
+ const uint8_t* lit_depth,
+ const uint16_t* lit_bits,
+ const uint8_t* cmd_depth,
+ const uint16_t* cmd_bits,
+ const uint8_t* dist_depth,
+ const uint16_t* dist_bits,
+ size_t* storage_ix,
+ uint8_t* storage) {
+ size_t pos = start_pos;
+ size_t i;
+ for (i = 0; i < n_commands; ++i) {
+ const Command cmd = commands[i];
+ const size_t cmd_code = cmd.cmd_prefix_;
+ size_t j;
+ BrotliWriteBits(
+ cmd_depth[cmd_code], cmd_bits[cmd_code], storage_ix, storage);
+ StoreCommandExtra(&cmd, storage_ix, storage);
+ for (j = cmd.insert_len_; j != 0; --j) {
+ const uint8_t literal = input[pos & mask];
+ BrotliWriteBits(
+ lit_depth[literal], lit_bits[literal], storage_ix, storage);
+ ++pos;
+ }
+ pos += CommandCopyLen(&cmd);
+ if (CommandCopyLen(&cmd) && cmd.cmd_prefix_ >= 128) {
+ const size_t dist_code = cmd.dist_prefix_ & 0x3FF;
+ const uint32_t distnumextra = cmd.dist_prefix_ >> 10;
+ const uint32_t distextra = cmd.dist_extra_;
+ BrotliWriteBits(dist_depth[dist_code], dist_bits[dist_code],
+ storage_ix, storage);
+ BrotliWriteBits(distnumextra, distextra, storage_ix, storage);
+ }
+ }
+}
+
+void BrotliStoreMetaBlockTrivial(MemoryManager* m,
+ const uint8_t* input, size_t start_pos, size_t length, size_t mask,
+ BROTLI_BOOL is_last, const BrotliEncoderParams* params,
+ const Command* commands, size_t n_commands,
+ size_t* storage_ix, uint8_t* storage) {
+ HistogramLiteral lit_histo;
+ HistogramCommand cmd_histo;
+ HistogramDistance dist_histo;
+ uint8_t lit_depth[BROTLI_NUM_LITERAL_SYMBOLS];
+ uint16_t lit_bits[BROTLI_NUM_LITERAL_SYMBOLS];
+ uint8_t cmd_depth[BROTLI_NUM_COMMAND_SYMBOLS];
+ uint16_t cmd_bits[BROTLI_NUM_COMMAND_SYMBOLS];
+ uint8_t dist_depth[MAX_SIMPLE_DISTANCE_ALPHABET_SIZE];
+ uint16_t dist_bits[MAX_SIMPLE_DISTANCE_ALPHABET_SIZE];
+ HuffmanTree* tree;
+ uint32_t num_distance_symbols = params->dist.alphabet_size_max;
+
+ StoreCompressedMetaBlockHeader(is_last, length, storage_ix, storage);
+
+ HistogramClearLiteral(&lit_histo);
+ HistogramClearCommand(&cmd_histo);
+ HistogramClearDistance(&dist_histo);
+
+ BuildHistograms(input, start_pos, mask, commands, n_commands,
+ &lit_histo, &cmd_histo, &dist_histo);
+
+ BrotliWriteBits(13, 0, storage_ix, storage);
+
+ tree = BROTLI_ALLOC(m, HuffmanTree, MAX_HUFFMAN_TREE_SIZE);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(tree)) return;
+ BuildAndStoreHuffmanTree(lit_histo.data_, BROTLI_NUM_LITERAL_SYMBOLS,
+ BROTLI_NUM_LITERAL_SYMBOLS, tree,
+ lit_depth, lit_bits,
+ storage_ix, storage);
+ BuildAndStoreHuffmanTree(cmd_histo.data_, BROTLI_NUM_COMMAND_SYMBOLS,
+ BROTLI_NUM_COMMAND_SYMBOLS, tree,
+ cmd_depth, cmd_bits,
+ storage_ix, storage);
+ BuildAndStoreHuffmanTree(dist_histo.data_, MAX_SIMPLE_DISTANCE_ALPHABET_SIZE,
+ num_distance_symbols, tree,
+ dist_depth, dist_bits,
+ storage_ix, storage);
+ BROTLI_FREE(m, tree);
+ StoreDataWithHuffmanCodes(input, start_pos, mask, commands,
+ n_commands, lit_depth, lit_bits,
+ cmd_depth, cmd_bits,
+ dist_depth, dist_bits,
+ storage_ix, storage);
+ if (is_last) {
+ JumpToByteBoundary(storage_ix, storage);
+ }
+}
+
+void BrotliStoreMetaBlockFast(MemoryManager* m,
+ const uint8_t* input, size_t start_pos, size_t length, size_t mask,
+ BROTLI_BOOL is_last, const BrotliEncoderParams* params,
+ const Command* commands, size_t n_commands,
+ size_t* storage_ix, uint8_t* storage) {
+ uint32_t num_distance_symbols = params->dist.alphabet_size_max;
+ uint32_t distance_alphabet_bits =
+ Log2FloorNonZero(num_distance_symbols - 1) + 1;
+
+ StoreCompressedMetaBlockHeader(is_last, length, storage_ix, storage);
+
+ BrotliWriteBits(13, 0, storage_ix, storage);
+
+ if (n_commands <= 128) {
+ uint32_t histogram[BROTLI_NUM_LITERAL_SYMBOLS] = { 0 };
+ size_t pos = start_pos;
+ size_t num_literals = 0;
+ size_t i;
+ uint8_t lit_depth[BROTLI_NUM_LITERAL_SYMBOLS];
+ uint16_t lit_bits[BROTLI_NUM_LITERAL_SYMBOLS];
+ for (i = 0; i < n_commands; ++i) {
+ const Command cmd = commands[i];
+ size_t j;
+ for (j = cmd.insert_len_; j != 0; --j) {
+ ++histogram[input[pos & mask]];
+ ++pos;
+ }
+ num_literals += cmd.insert_len_;
+ pos += CommandCopyLen(&cmd);
+ }
+ BrotliBuildAndStoreHuffmanTreeFast(m, histogram, num_literals,
+ /* max_bits = */ 8,
+ lit_depth, lit_bits,
+ storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ StoreStaticCommandHuffmanTree(storage_ix, storage);
+ StoreStaticDistanceHuffmanTree(storage_ix, storage);
+ StoreDataWithHuffmanCodes(input, start_pos, mask, commands,
+ n_commands, lit_depth, lit_bits,
+ kStaticCommandCodeDepth,
+ kStaticCommandCodeBits,
+ kStaticDistanceCodeDepth,
+ kStaticDistanceCodeBits,
+ storage_ix, storage);
+ } else {
+ HistogramLiteral lit_histo;
+ HistogramCommand cmd_histo;
+ HistogramDistance dist_histo;
+ uint8_t lit_depth[BROTLI_NUM_LITERAL_SYMBOLS];
+ uint16_t lit_bits[BROTLI_NUM_LITERAL_SYMBOLS];
+ uint8_t cmd_depth[BROTLI_NUM_COMMAND_SYMBOLS];
+ uint16_t cmd_bits[BROTLI_NUM_COMMAND_SYMBOLS];
+ uint8_t dist_depth[MAX_SIMPLE_DISTANCE_ALPHABET_SIZE];
+ uint16_t dist_bits[MAX_SIMPLE_DISTANCE_ALPHABET_SIZE];
+ HistogramClearLiteral(&lit_histo);
+ HistogramClearCommand(&cmd_histo);
+ HistogramClearDistance(&dist_histo);
+ BuildHistograms(input, start_pos, mask, commands, n_commands,
+ &lit_histo, &cmd_histo, &dist_histo);
+ BrotliBuildAndStoreHuffmanTreeFast(m, lit_histo.data_,
+ lit_histo.total_count_,
+ /* max_bits = */ 8,
+ lit_depth, lit_bits,
+ storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ BrotliBuildAndStoreHuffmanTreeFast(m, cmd_histo.data_,
+ cmd_histo.total_count_,
+ /* max_bits = */ 10,
+ cmd_depth, cmd_bits,
+ storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ BrotliBuildAndStoreHuffmanTreeFast(m, dist_histo.data_,
+ dist_histo.total_count_,
+ /* max_bits = */
+ distance_alphabet_bits,
+ dist_depth, dist_bits,
+ storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ StoreDataWithHuffmanCodes(input, start_pos, mask, commands,
+ n_commands, lit_depth, lit_bits,
+ cmd_depth, cmd_bits,
+ dist_depth, dist_bits,
+ storage_ix, storage);
+ }
+
+ if (is_last) {
+ JumpToByteBoundary(storage_ix, storage);
+ }
+}
+
+/* This is for storing uncompressed blocks (simple raw storage of
+ bytes-as-bytes). */
+void BrotliStoreUncompressedMetaBlock(BROTLI_BOOL is_final_block,
+ const uint8_t* BROTLI_RESTRICT input,
+ size_t position, size_t mask,
+ size_t len,
+ size_t* BROTLI_RESTRICT storage_ix,
+ uint8_t* BROTLI_RESTRICT storage) {
+ size_t masked_pos = position & mask;
+ BrotliStoreUncompressedMetaBlockHeader(len, storage_ix, storage);
+ JumpToByteBoundary(storage_ix, storage);
+
+ if (masked_pos + len > mask + 1) {
+ size_t len1 = mask + 1 - masked_pos;
+ memcpy(&storage[*storage_ix >> 3], &input[masked_pos], len1);
+ *storage_ix += len1 << 3;
+ len -= len1;
+ masked_pos = 0;
+ }
+ memcpy(&storage[*storage_ix >> 3], &input[masked_pos], len);
+ *storage_ix += len << 3;
+
+ /* We need to clear the next 4 bytes to continue to be
+ compatible with BrotliWriteBits. */
+ BrotliWriteBitsPrepareStorage(*storage_ix, storage);
+
+ /* Since the uncompressed block itself may not be the final block, add an
+ empty one after this. */
+ if (is_final_block) {
+ BrotliWriteBits(1, 1, storage_ix, storage); /* islast */
+ BrotliWriteBits(1, 1, storage_ix, storage); /* isempty */
+ JumpToByteBoundary(storage_ix, storage);
+ }
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/brotli_bit_stream.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/brotli_bit_stream.h
new file mode 100644
index 000000000..2ed703bf7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/brotli_bit_stream.h
@@ -0,0 +1,84 @@
+/* Copyright 2014 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Functions to convert brotli-related data structures into the
+ brotli bit stream. The functions here operate under
+ assumption that there is enough space in the storage, i.e., there are
+ no out-of-range checks anywhere.
+
+ These functions do bit addressing into a byte array. The byte array
+ is called "storage" and the index to the bit is called storage_ix
+ in function arguments. */
+
+#ifndef BROTLI_ENC_BROTLI_BIT_STREAM_H_
+#define BROTLI_ENC_BROTLI_BIT_STREAM_H_
+
+#include "../common/context.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./command.h"
+#include "./entropy_encode.h"
+#include "./memory.h"
+#include "./metablock.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* All Store functions here will use a storage_ix, which is always the bit
+ position for the current storage. */
+
+BROTLI_INTERNAL void BrotliStoreHuffmanTree(const uint8_t* depths, size_t num,
+ HuffmanTree* tree, size_t* storage_ix, uint8_t* storage);
+
+BROTLI_INTERNAL void BrotliBuildAndStoreHuffmanTreeFast(
+ MemoryManager* m, const uint32_t* histogram, const size_t histogram_total,
+ const size_t max_bits, uint8_t* depth, uint16_t* bits, size_t* storage_ix,
+ uint8_t* storage);
+
+/* REQUIRES: length > 0 */
+/* REQUIRES: length <= (1 << 24) */
+BROTLI_INTERNAL void BrotliStoreMetaBlock(MemoryManager* m,
+ const uint8_t* input, size_t start_pos, size_t length, size_t mask,
+ uint8_t prev_byte, uint8_t prev_byte2, BROTLI_BOOL is_last,
+ const BrotliEncoderParams* params, ContextType literal_context_mode,
+ const Command* commands, size_t n_commands, const MetaBlockSplit* mb,
+ size_t* storage_ix, uint8_t* storage);
+
+/* Stores the meta-block without doing any block splitting, just collects
+ one histogram per block category and uses that for entropy coding.
+ REQUIRES: length > 0
+ REQUIRES: length <= (1 << 24) */
+BROTLI_INTERNAL void BrotliStoreMetaBlockTrivial(MemoryManager* m,
+ const uint8_t* input, size_t start_pos, size_t length, size_t mask,
+ BROTLI_BOOL is_last, const BrotliEncoderParams* params,
+ const Command* commands, size_t n_commands,
+ size_t* storage_ix, uint8_t* storage);
+
+/* Same as above, but uses static prefix codes for histograms with a only a few
+ symbols, and uses static code length prefix codes for all other histograms.
+ REQUIRES: length > 0
+ REQUIRES: length <= (1 << 24) */
+BROTLI_INTERNAL void BrotliStoreMetaBlockFast(MemoryManager* m,
+ const uint8_t* input, size_t start_pos, size_t length, size_t mask,
+ BROTLI_BOOL is_last, const BrotliEncoderParams* params,
+ const Command* commands, size_t n_commands,
+ size_t* storage_ix, uint8_t* storage);
+
+/* This is for storing uncompressed blocks (simple raw storage of
+ bytes-as-bytes).
+ REQUIRES: length > 0
+ REQUIRES: length <= (1 << 24) */
+BROTLI_INTERNAL void BrotliStoreUncompressedMetaBlock(
+ BROTLI_BOOL is_final_block, const uint8_t* BROTLI_RESTRICT input,
+ size_t position, size_t mask, size_t len,
+ size_t* BROTLI_RESTRICT storage_ix, uint8_t* BROTLI_RESTRICT storage);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_BROTLI_BIT_STREAM_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/cluster.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/cluster.c
new file mode 100644
index 000000000..a20dfd385
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/cluster.c
@@ -0,0 +1,56 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Functions for clustering similar histograms together. */
+
+#include "./cluster.h"
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./bit_cost.h" /* BrotliPopulationCost */
+#include "./fast_log.h"
+#include "./histogram.h"
+#include "./memory.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+static BROTLI_INLINE BROTLI_BOOL HistogramPairIsLess(
+ const HistogramPair* p1, const HistogramPair* p2) {
+ if (p1->cost_diff != p2->cost_diff) {
+ return TO_BROTLI_BOOL(p1->cost_diff > p2->cost_diff);
+ }
+ return TO_BROTLI_BOOL((p1->idx2 - p1->idx1) > (p2->idx2 - p2->idx1));
+}
+
+/* Returns entropy reduction of the context map when we combine two clusters. */
+static BROTLI_INLINE double ClusterCostDiff(size_t size_a, size_t size_b) {
+ size_t size_c = size_a + size_b;
+ return (double)size_a * FastLog2(size_a) +
+ (double)size_b * FastLog2(size_b) -
+ (double)size_c * FastLog2(size_c);
+}
+
+#define CODE(X) X
+
+#define FN(X) X ## Literal
+#include "./cluster_inc.h" /* NOLINT(build/include) */
+#undef FN
+
+#define FN(X) X ## Command
+#include "./cluster_inc.h" /* NOLINT(build/include) */
+#undef FN
+
+#define FN(X) X ## Distance
+#include "./cluster_inc.h" /* NOLINT(build/include) */
+#undef FN
+
+#undef CODE
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/cluster.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/cluster.h
new file mode 100644
index 000000000..bb26124d2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/cluster.h
@@ -0,0 +1,48 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Functions for clustering similar histograms together. */
+
+#ifndef BROTLI_ENC_CLUSTER_H_
+#define BROTLI_ENC_CLUSTER_H_
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./histogram.h"
+#include "./memory.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+typedef struct HistogramPair {
+ uint32_t idx1;
+ uint32_t idx2;
+ double cost_combo;
+ double cost_diff;
+} HistogramPair;
+
+#define CODE(X) /* Declaration */;
+
+#define FN(X) X ## Literal
+#include "./cluster_inc.h" /* NOLINT(build/include) */
+#undef FN
+
+#define FN(X) X ## Command
+#include "./cluster_inc.h" /* NOLINT(build/include) */
+#undef FN
+
+#define FN(X) X ## Distance
+#include "./cluster_inc.h" /* NOLINT(build/include) */
+#undef FN
+
+#undef CODE
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_CLUSTER_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/cluster_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/cluster_inc.h
new file mode 100644
index 000000000..3d4f40e60
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/cluster_inc.h
@@ -0,0 +1,320 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: FN, CODE */
+
+#define HistogramType FN(Histogram)
+
+/* Computes the bit cost reduction by combining out[idx1] and out[idx2] and if
+ it is below a threshold, stores the pair (idx1, idx2) in the *pairs queue. */
+BROTLI_INTERNAL void FN(BrotliCompareAndPushToQueue)(
+ const HistogramType* out, const uint32_t* cluster_size, uint32_t idx1,
+ uint32_t idx2, size_t max_num_pairs, HistogramPair* pairs,
+ size_t* num_pairs) CODE({
+ BROTLI_BOOL is_good_pair = BROTLI_FALSE;
+ HistogramPair p;
+ p.idx1 = p.idx2 = 0;
+ p.cost_diff = p.cost_combo = 0;
+ if (idx1 == idx2) {
+ return;
+ }
+ if (idx2 < idx1) {
+ uint32_t t = idx2;
+ idx2 = idx1;
+ idx1 = t;
+ }
+ p.idx1 = idx1;
+ p.idx2 = idx2;
+ p.cost_diff = 0.5 * ClusterCostDiff(cluster_size[idx1], cluster_size[idx2]);
+ p.cost_diff -= out[idx1].bit_cost_;
+ p.cost_diff -= out[idx2].bit_cost_;
+
+ if (out[idx1].total_count_ == 0) {
+ p.cost_combo = out[idx2].bit_cost_;
+ is_good_pair = BROTLI_TRUE;
+ } else if (out[idx2].total_count_ == 0) {
+ p.cost_combo = out[idx1].bit_cost_;
+ is_good_pair = BROTLI_TRUE;
+ } else {
+ double threshold = *num_pairs == 0 ? 1e99 :
+ BROTLI_MAX(double, 0.0, pairs[0].cost_diff);
+ HistogramType combo = out[idx1];
+ double cost_combo;
+ FN(HistogramAddHistogram)(&combo, &out[idx2]);
+ cost_combo = FN(BrotliPopulationCost)(&combo);
+ if (cost_combo < threshold - p.cost_diff) {
+ p.cost_combo = cost_combo;
+ is_good_pair = BROTLI_TRUE;
+ }
+ }
+ if (is_good_pair) {
+ p.cost_diff += p.cost_combo;
+ if (*num_pairs > 0 && HistogramPairIsLess(&pairs[0], &p)) {
+ /* Replace the top of the queue if needed. */
+ if (*num_pairs < max_num_pairs) {
+ pairs[*num_pairs] = pairs[0];
+ ++(*num_pairs);
+ }
+ pairs[0] = p;
+ } else if (*num_pairs < max_num_pairs) {
+ pairs[*num_pairs] = p;
+ ++(*num_pairs);
+ }
+ }
+})
+
+BROTLI_INTERNAL size_t FN(BrotliHistogramCombine)(HistogramType* out,
+ uint32_t* cluster_size,
+ uint32_t* symbols,
+ uint32_t* clusters,
+ HistogramPair* pairs,
+ size_t num_clusters,
+ size_t symbols_size,
+ size_t max_clusters,
+ size_t max_num_pairs) CODE({
+ double cost_diff_threshold = 0.0;
+ size_t min_cluster_size = 1;
+ size_t num_pairs = 0;
+
+ {
+ /* We maintain a vector of histogram pairs, with the property that the pair
+ with the maximum bit cost reduction is the first. */
+ size_t idx1;
+ for (idx1 = 0; idx1 < num_clusters; ++idx1) {
+ size_t idx2;
+ for (idx2 = idx1 + 1; idx2 < num_clusters; ++idx2) {
+ FN(BrotliCompareAndPushToQueue)(out, cluster_size, clusters[idx1],
+ clusters[idx2], max_num_pairs, &pairs[0], &num_pairs);
+ }
+ }
+ }
+
+ while (num_clusters > min_cluster_size) {
+ uint32_t best_idx1;
+ uint32_t best_idx2;
+ size_t i;
+ if (pairs[0].cost_diff >= cost_diff_threshold) {
+ cost_diff_threshold = 1e99;
+ min_cluster_size = max_clusters;
+ continue;
+ }
+ /* Take the best pair from the top of heap. */
+ best_idx1 = pairs[0].idx1;
+ best_idx2 = pairs[0].idx2;
+ FN(HistogramAddHistogram)(&out[best_idx1], &out[best_idx2]);
+ out[best_idx1].bit_cost_ = pairs[0].cost_combo;
+ cluster_size[best_idx1] += cluster_size[best_idx2];
+ for (i = 0; i < symbols_size; ++i) {
+ if (symbols[i] == best_idx2) {
+ symbols[i] = best_idx1;
+ }
+ }
+ for (i = 0; i < num_clusters; ++i) {
+ if (clusters[i] == best_idx2) {
+ memmove(&clusters[i], &clusters[i + 1],
+ (num_clusters - i - 1) * sizeof(clusters[0]));
+ break;
+ }
+ }
+ --num_clusters;
+ {
+ /* Remove pairs intersecting the just combined best pair. */
+ size_t copy_to_idx = 0;
+ for (i = 0; i < num_pairs; ++i) {
+ HistogramPair* p = &pairs[i];
+ if (p->idx1 == best_idx1 || p->idx2 == best_idx1 ||
+ p->idx1 == best_idx2 || p->idx2 == best_idx2) {
+ /* Remove invalid pair from the queue. */
+ continue;
+ }
+ if (HistogramPairIsLess(&pairs[0], p)) {
+ /* Replace the top of the queue if needed. */
+ HistogramPair front = pairs[0];
+ pairs[0] = *p;
+ pairs[copy_to_idx] = front;
+ } else {
+ pairs[copy_to_idx] = *p;
+ }
+ ++copy_to_idx;
+ }
+ num_pairs = copy_to_idx;
+ }
+
+ /* Push new pairs formed with the combined histogram to the heap. */
+ for (i = 0; i < num_clusters; ++i) {
+ FN(BrotliCompareAndPushToQueue)(out, cluster_size, best_idx1, clusters[i],
+ max_num_pairs, &pairs[0], &num_pairs);
+ }
+ }
+ return num_clusters;
+})
+
+/* What is the bit cost of moving histogram from cur_symbol to candidate. */
+BROTLI_INTERNAL double FN(BrotliHistogramBitCostDistance)(
+ const HistogramType* histogram, const HistogramType* candidate) CODE({
+ if (histogram->total_count_ == 0) {
+ return 0.0;
+ } else {
+ HistogramType tmp = *histogram;
+ FN(HistogramAddHistogram)(&tmp, candidate);
+ return FN(BrotliPopulationCost)(&tmp) - candidate->bit_cost_;
+ }
+})
+
+/* Find the best 'out' histogram for each of the 'in' histograms.
+ When called, clusters[0..num_clusters) contains the unique values from
+ symbols[0..in_size), but this property is not preserved in this function.
+ Note: we assume that out[]->bit_cost_ is already up-to-date. */
+BROTLI_INTERNAL void FN(BrotliHistogramRemap)(const HistogramType* in,
+ size_t in_size, const uint32_t* clusters, size_t num_clusters,
+ HistogramType* out, uint32_t* symbols) CODE({
+ size_t i;
+ for (i = 0; i < in_size; ++i) {
+ uint32_t best_out = i == 0 ? symbols[0] : symbols[i - 1];
+ double best_bits =
+ FN(BrotliHistogramBitCostDistance)(&in[i], &out[best_out]);
+ size_t j;
+ for (j = 0; j < num_clusters; ++j) {
+ const double cur_bits =
+ FN(BrotliHistogramBitCostDistance)(&in[i], &out[clusters[j]]);
+ if (cur_bits < best_bits) {
+ best_bits = cur_bits;
+ best_out = clusters[j];
+ }
+ }
+ symbols[i] = best_out;
+ }
+
+ /* Recompute each out based on raw and symbols. */
+ for (i = 0; i < num_clusters; ++i) {
+ FN(HistogramClear)(&out[clusters[i]]);
+ }
+ for (i = 0; i < in_size; ++i) {
+ FN(HistogramAddHistogram)(&out[symbols[i]], &in[i]);
+ }
+})
+
+/* Reorders elements of the out[0..length) array and changes values in
+ symbols[0..length) array in the following way:
+ * when called, symbols[] contains indexes into out[], and has N unique
+ values (possibly N < length)
+ * on return, symbols'[i] = f(symbols[i]) and
+ out'[symbols'[i]] = out[symbols[i]], for each 0 <= i < length,
+ where f is a bijection between the range of symbols[] and [0..N), and
+ the first occurrences of values in symbols'[i] come in consecutive
+ increasing order.
+ Returns N, the number of unique values in symbols[]. */
+BROTLI_INTERNAL size_t FN(BrotliHistogramReindex)(MemoryManager* m,
+ HistogramType* out, uint32_t* symbols, size_t length) CODE({
+ static const uint32_t kInvalidIndex = BROTLI_UINT32_MAX;
+ uint32_t* new_index = BROTLI_ALLOC(m, uint32_t, length);
+ uint32_t next_index;
+ HistogramType* tmp;
+ size_t i;
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(new_index)) return 0;
+ for (i = 0; i < length; ++i) {
+ new_index[i] = kInvalidIndex;
+ }
+ next_index = 0;
+ for (i = 0; i < length; ++i) {
+ if (new_index[symbols[i]] == kInvalidIndex) {
+ new_index[symbols[i]] = next_index;
+ ++next_index;
+ }
+ }
+ /* TODO: by using idea of "cycle-sort" we can avoid allocation of
+ tmp and reduce the number of copying by the factor of 2. */
+ tmp = BROTLI_ALLOC(m, HistogramType, next_index);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(tmp)) return 0;
+ next_index = 0;
+ for (i = 0; i < length; ++i) {
+ if (new_index[symbols[i]] == next_index) {
+ tmp[next_index] = out[symbols[i]];
+ ++next_index;
+ }
+ symbols[i] = new_index[symbols[i]];
+ }
+ BROTLI_FREE(m, new_index);
+ for (i = 0; i < next_index; ++i) {
+ out[i] = tmp[i];
+ }
+ BROTLI_FREE(m, tmp);
+ return next_index;
+})
+
+BROTLI_INTERNAL void FN(BrotliClusterHistograms)(
+ MemoryManager* m, const HistogramType* in, const size_t in_size,
+ size_t max_histograms, HistogramType* out, size_t* out_size,
+ uint32_t* histogram_symbols) CODE({
+ uint32_t* cluster_size = BROTLI_ALLOC(m, uint32_t, in_size);
+ uint32_t* clusters = BROTLI_ALLOC(m, uint32_t, in_size);
+ size_t num_clusters = 0;
+ const size_t max_input_histograms = 64;
+ size_t pairs_capacity = max_input_histograms * max_input_histograms / 2;
+ /* For the first pass of clustering, we allow all pairs. */
+ HistogramPair* pairs = BROTLI_ALLOC(m, HistogramPair, pairs_capacity + 1);
+ size_t i;
+
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(cluster_size) ||
+ BROTLI_IS_NULL(clusters) || BROTLI_IS_NULL(pairs)) {
+ return;
+ }
+
+ for (i = 0; i < in_size; ++i) {
+ cluster_size[i] = 1;
+ }
+
+ for (i = 0; i < in_size; ++i) {
+ out[i] = in[i];
+ out[i].bit_cost_ = FN(BrotliPopulationCost)(&in[i]);
+ histogram_symbols[i] = (uint32_t)i;
+ }
+
+ for (i = 0; i < in_size; i += max_input_histograms) {
+ size_t num_to_combine =
+ BROTLI_MIN(size_t, in_size - i, max_input_histograms);
+ size_t num_new_clusters;
+ size_t j;
+ for (j = 0; j < num_to_combine; ++j) {
+ clusters[num_clusters + j] = (uint32_t)(i + j);
+ }
+ num_new_clusters =
+ FN(BrotliHistogramCombine)(out, cluster_size,
+ &histogram_symbols[i],
+ &clusters[num_clusters], pairs,
+ num_to_combine, num_to_combine,
+ max_histograms, pairs_capacity);
+ num_clusters += num_new_clusters;
+ }
+
+ {
+ /* For the second pass, we limit the total number of histogram pairs.
+ After this limit is reached, we only keep searching for the best pair. */
+ size_t max_num_pairs = BROTLI_MIN(size_t,
+ 64 * num_clusters, (num_clusters / 2) * num_clusters);
+ BROTLI_ENSURE_CAPACITY(
+ m, HistogramPair, pairs, pairs_capacity, max_num_pairs + 1);
+ if (BROTLI_IS_OOM(m)) return;
+
+ /* Collapse similar histograms. */
+ num_clusters = FN(BrotliHistogramCombine)(out, cluster_size,
+ histogram_symbols, clusters,
+ pairs, num_clusters, in_size,
+ max_histograms, max_num_pairs);
+ }
+ BROTLI_FREE(m, pairs);
+ BROTLI_FREE(m, cluster_size);
+ /* Find the optimal map from original histograms to the final ones. */
+ FN(BrotliHistogramRemap)(in, in_size, clusters, num_clusters,
+ out, histogram_symbols);
+ BROTLI_FREE(m, clusters);
+ /* Convert the context map to a canonical form. */
+ *out_size = FN(BrotliHistogramReindex)(m, out, histogram_symbols, in_size);
+ if (BROTLI_IS_OOM(m)) return;
+})
+
+#undef HistogramType
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/command.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/command.h
new file mode 100644
index 000000000..1aac85689
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/command.h
@@ -0,0 +1,190 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* This class models a sequence of literals and a backward reference copy. */
+
+#ifndef BROTLI_ENC_COMMAND_H_
+#define BROTLI_ENC_COMMAND_H_
+
+#include "../common/constants.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./fast_log.h"
+#include "./params.h"
+#include "./prefix.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+static uint32_t kInsBase[] = { 0, 1, 2, 3, 4, 5, 6, 8, 10, 14, 18, 26, 34, 50,
+ 66, 98, 130, 194, 322, 578, 1090, 2114, 6210, 22594 };
+static uint32_t kInsExtra[] = { 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4,
+ 5, 5, 6, 7, 8, 9, 10, 12, 14, 24 };
+static uint32_t kCopyBase[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 18, 22, 30,
+ 38, 54, 70, 102, 134, 198, 326, 582, 1094, 2118 };
+static uint32_t kCopyExtra[] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3,
+ 4, 4, 5, 5, 6, 7, 8, 9, 10, 24 };
+
+static BROTLI_INLINE uint16_t GetInsertLengthCode(size_t insertlen) {
+ if (insertlen < 6) {
+ return (uint16_t)insertlen;
+ } else if (insertlen < 130) {
+ uint32_t nbits = Log2FloorNonZero(insertlen - 2) - 1u;
+ return (uint16_t)((nbits << 1) + ((insertlen - 2) >> nbits) + 2);
+ } else if (insertlen < 2114) {
+ return (uint16_t)(Log2FloorNonZero(insertlen - 66) + 10);
+ } else if (insertlen < 6210) {
+ return 21u;
+ } else if (insertlen < 22594) {
+ return 22u;
+ } else {
+ return 23u;
+ }
+}
+
+static BROTLI_INLINE uint16_t GetCopyLengthCode(size_t copylen) {
+ if (copylen < 10) {
+ return (uint16_t)(copylen - 2);
+ } else if (copylen < 134) {
+ uint32_t nbits = Log2FloorNonZero(copylen - 6) - 1u;
+ return (uint16_t)((nbits << 1) + ((copylen - 6) >> nbits) + 4);
+ } else if (copylen < 2118) {
+ return (uint16_t)(Log2FloorNonZero(copylen - 70) + 12);
+ } else {
+ return 23u;
+ }
+}
+
+static BROTLI_INLINE uint16_t CombineLengthCodes(
+ uint16_t inscode, uint16_t copycode, BROTLI_BOOL use_last_distance) {
+ uint16_t bits64 =
+ (uint16_t)((copycode & 0x7u) | ((inscode & 0x7u) << 3u));
+ if (use_last_distance && inscode < 8u && copycode < 16u) {
+ return (copycode < 8u) ? bits64 : (bits64 | 64u);
+ } else {
+ /* Specification: 5 Encoding of ... (last table) */
+ /* offset = 2 * index, where index is in range [0..8] */
+ uint32_t offset = 2u * ((copycode >> 3u) + 3u * (inscode >> 3u));
+ /* All values in specification are K * 64,
+ where K = [2, 3, 6, 4, 5, 8, 7, 9, 10],
+ i + 1 = [1, 2, 3, 4, 5, 6, 7, 8, 9],
+ K - i - 1 = [1, 1, 3, 0, 0, 2, 0, 1, 2] = D.
+ All values in D require only 2 bits to encode.
+ Magic constant is shifted 6 bits left, to avoid final multiplication. */
+ offset = (offset << 5u) + 0x40u + ((0x520D40u >> offset) & 0xC0u);
+ return (uint16_t)(offset | bits64);
+ }
+}
+
+static BROTLI_INLINE void GetLengthCode(size_t insertlen, size_t copylen,
+ BROTLI_BOOL use_last_distance,
+ uint16_t* code) {
+ uint16_t inscode = GetInsertLengthCode(insertlen);
+ uint16_t copycode = GetCopyLengthCode(copylen);
+ *code = CombineLengthCodes(inscode, copycode, use_last_distance);
+}
+
+static BROTLI_INLINE uint32_t GetInsertBase(uint16_t inscode) {
+ return kInsBase[inscode];
+}
+
+static BROTLI_INLINE uint32_t GetInsertExtra(uint16_t inscode) {
+ return kInsExtra[inscode];
+}
+
+static BROTLI_INLINE uint32_t GetCopyBase(uint16_t copycode) {
+ return kCopyBase[copycode];
+}
+
+static BROTLI_INLINE uint32_t GetCopyExtra(uint16_t copycode) {
+ return kCopyExtra[copycode];
+}
+
+typedef struct Command {
+ uint32_t insert_len_;
+ /* Stores copy_len in low 25 bits and copy_code - copy_len in high 7 bit. */
+ uint32_t copy_len_;
+ /* Stores distance extra bits. */
+ uint32_t dist_extra_;
+ uint16_t cmd_prefix_;
+ /* Stores distance code in low 10 bits
+ and number of extra bits in high 6 bits. */
+ uint16_t dist_prefix_;
+} Command;
+
+/* distance_code is e.g. 0 for same-as-last short code, or 16 for offset 1. */
+static BROTLI_INLINE void InitCommand(Command* self,
+ const BrotliDistanceParams* dist, size_t insertlen,
+ size_t copylen, int copylen_code_delta, size_t distance_code) {
+ /* Don't rely on signed int representation, use honest casts. */
+ uint32_t delta = (uint8_t)((int8_t)copylen_code_delta);
+ self->insert_len_ = (uint32_t)insertlen;
+ self->copy_len_ = (uint32_t)(copylen | (delta << 25));
+ /* The distance prefix and extra bits are stored in this Command as if
+ npostfix and ndirect were 0, they are only recomputed later after the
+ clustering if needed. */
+ PrefixEncodeCopyDistance(
+ distance_code, dist->num_direct_distance_codes,
+ dist->distance_postfix_bits, &self->dist_prefix_, &self->dist_extra_);
+ GetLengthCode(
+ insertlen, (size_t)((int)copylen + copylen_code_delta),
+ TO_BROTLI_BOOL((self->dist_prefix_ & 0x3FF) == 0), &self->cmd_prefix_);
+}
+
+static BROTLI_INLINE void InitInsertCommand(Command* self, size_t insertlen) {
+ self->insert_len_ = (uint32_t)insertlen;
+ self->copy_len_ = 4 << 25;
+ self->dist_extra_ = 0;
+ self->dist_prefix_ = BROTLI_NUM_DISTANCE_SHORT_CODES;
+ GetLengthCode(insertlen, 4, BROTLI_FALSE, &self->cmd_prefix_);
+}
+
+static BROTLI_INLINE uint32_t CommandRestoreDistanceCode(
+ const Command* self, const BrotliDistanceParams* dist) {
+ if ((self->dist_prefix_ & 0x3FFu) <
+ BROTLI_NUM_DISTANCE_SHORT_CODES + dist->num_direct_distance_codes) {
+ return self->dist_prefix_ & 0x3FFu;
+ } else {
+ uint32_t dcode = self->dist_prefix_ & 0x3FFu;
+ uint32_t nbits = self->dist_prefix_ >> 10;
+ uint32_t extra = self->dist_extra_;
+ uint32_t postfix_mask = (1U << dist->distance_postfix_bits) - 1U;
+ uint32_t hcode = (dcode - dist->num_direct_distance_codes -
+ BROTLI_NUM_DISTANCE_SHORT_CODES) >>
+ dist->distance_postfix_bits;
+ uint32_t lcode = (dcode - dist->num_direct_distance_codes -
+ BROTLI_NUM_DISTANCE_SHORT_CODES) & postfix_mask;
+ uint32_t offset = ((2U + (hcode & 1U)) << nbits) - 4U;
+ return ((offset + extra) << dist->distance_postfix_bits) + lcode +
+ dist->num_direct_distance_codes + BROTLI_NUM_DISTANCE_SHORT_CODES;
+ }
+}
+
+static BROTLI_INLINE uint32_t CommandDistanceContext(const Command* self) {
+ uint32_t r = self->cmd_prefix_ >> 6;
+ uint32_t c = self->cmd_prefix_ & 7;
+ if ((r == 0 || r == 2 || r == 4 || r == 7) && (c <= 2)) {
+ return c;
+ }
+ return 3;
+}
+
+static BROTLI_INLINE uint32_t CommandCopyLen(const Command* self) {
+ return self->copy_len_ & 0x1FFFFFF;
+}
+
+static BROTLI_INLINE uint32_t CommandCopyLenCode(const Command* self) {
+ uint32_t modifier = self->copy_len_ >> 25;
+ int32_t delta = (int8_t)((uint8_t)(modifier | ((modifier & 0x40) << 1)));
+ return (uint32_t)((int32_t)(self->copy_len_ & 0x1FFFFFF) + delta);
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_COMMAND_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment.c
new file mode 100644
index 000000000..9e50b2098
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment.c
@@ -0,0 +1,790 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Function for fast encoding of an input fragment, independently from the input
+ history. This function uses one-pass processing: when we find a backward
+ match, we immediately emit the corresponding command and literal codes to
+ the bit stream.
+
+ Adapted from the CompressFragment() function in
+ https://github.com/google/snappy/blob/master/snappy.cc */
+
+#include "./compress_fragment.h"
+
+#include <string.h> /* memcmp, memcpy, memset */
+
+#include "../common/constants.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./brotli_bit_stream.h"
+#include "./entropy_encode.h"
+#include "./fast_log.h"
+#include "./find_match_length.h"
+#include "./memory.h"
+#include "./write_bits.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#define MAX_DISTANCE (long)BROTLI_MAX_BACKWARD_LIMIT(18)
+
+/* kHashMul32 multiplier has these properties:
+ * The multiplier must be odd. Otherwise we may lose the highest bit.
+ * No long streaks of ones or zeros.
+ * There is no effort to ensure that it is a prime, the oddity is enough
+ for this use.
+ * The number has been tuned heuristically against compression benchmarks. */
+static const uint32_t kHashMul32 = 0x1E35A7BD;
+
+static BROTLI_INLINE uint32_t Hash(const uint8_t* p, size_t shift) {
+ const uint64_t h = (BROTLI_UNALIGNED_LOAD64LE(p) << 24) * kHashMul32;
+ return (uint32_t)(h >> shift);
+}
+
+static BROTLI_INLINE uint32_t HashBytesAtOffset(
+ uint64_t v, int offset, size_t shift) {
+ BROTLI_DCHECK(offset >= 0);
+ BROTLI_DCHECK(offset <= 3);
+ {
+ const uint64_t h = ((v >> (8 * offset)) << 24) * kHashMul32;
+ return (uint32_t)(h >> shift);
+ }
+}
+
+static BROTLI_INLINE BROTLI_BOOL IsMatch(const uint8_t* p1, const uint8_t* p2) {
+ return TO_BROTLI_BOOL(
+ BrotliUnalignedRead32(p1) == BrotliUnalignedRead32(p2) &&
+ p1[4] == p2[4]);
+}
+
+/* Builds a literal prefix code into "depths" and "bits" based on the statistics
+ of the "input" string and stores it into the bit stream.
+ Note that the prefix code here is built from the pre-LZ77 input, therefore
+ we can only approximate the statistics of the actual literal stream.
+ Moreover, for long inputs we build a histogram from a sample of the input
+ and thus have to assign a non-zero depth for each literal.
+ Returns estimated compression ratio millibytes/char for encoding given input
+ with generated code. */
+static size_t BuildAndStoreLiteralPrefixCode(MemoryManager* m,
+ const uint8_t* input,
+ const size_t input_size,
+ uint8_t depths[256],
+ uint16_t bits[256],
+ size_t* storage_ix,
+ uint8_t* storage) {
+ uint32_t histogram[256] = { 0 };
+ size_t histogram_total;
+ size_t i;
+ if (input_size < (1 << 15)) {
+ for (i = 0; i < input_size; ++i) {
+ ++histogram[input[i]];
+ }
+ histogram_total = input_size;
+ for (i = 0; i < 256; ++i) {
+ /* We weigh the first 11 samples with weight 3 to account for the
+ balancing effect of the LZ77 phase on the histogram. */
+ const uint32_t adjust = 2 * BROTLI_MIN(uint32_t, histogram[i], 11u);
+ histogram[i] += adjust;
+ histogram_total += adjust;
+ }
+ } else {
+ static const size_t kSampleRate = 29;
+ for (i = 0; i < input_size; i += kSampleRate) {
+ ++histogram[input[i]];
+ }
+ histogram_total = (input_size + kSampleRate - 1) / kSampleRate;
+ for (i = 0; i < 256; ++i) {
+ /* We add 1 to each population count to avoid 0 bit depths (since this is
+ only a sample and we don't know if the symbol appears or not), and we
+ weigh the first 11 samples with weight 3 to account for the balancing
+ effect of the LZ77 phase on the histogram (more frequent symbols are
+ more likely to be in backward references instead as literals). */
+ const uint32_t adjust = 1 + 2 * BROTLI_MIN(uint32_t, histogram[i], 11u);
+ histogram[i] += adjust;
+ histogram_total += adjust;
+ }
+ }
+ BrotliBuildAndStoreHuffmanTreeFast(m, histogram, histogram_total,
+ /* max_bits = */ 8,
+ depths, bits, storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return 0;
+ {
+ size_t literal_ratio = 0;
+ for (i = 0; i < 256; ++i) {
+ if (histogram[i]) literal_ratio += histogram[i] * depths[i];
+ }
+ /* Estimated encoding ratio, millibytes per symbol. */
+ return (literal_ratio * 125) / histogram_total;
+ }
+}
+
+/* Builds a command and distance prefix code (each 64 symbols) into "depth" and
+ "bits" based on "histogram" and stores it into the bit stream. */
+static void BuildAndStoreCommandPrefixCode(const uint32_t histogram[128],
+ uint8_t depth[128], uint16_t bits[128], size_t* storage_ix,
+ uint8_t* storage) {
+ /* Tree size for building a tree over 64 symbols is 2 * 64 + 1. */
+ HuffmanTree tree[129];
+ uint8_t cmd_depth[BROTLI_NUM_COMMAND_SYMBOLS] = { 0 };
+ uint16_t cmd_bits[64];
+
+ BrotliCreateHuffmanTree(histogram, 64, 15, tree, depth);
+ BrotliCreateHuffmanTree(&histogram[64], 64, 14, tree, &depth[64]);
+ /* We have to jump through a few hoops here in order to compute
+ the command bits because the symbols are in a different order than in
+ the full alphabet. This looks complicated, but having the symbols
+ in this order in the command bits saves a few branches in the Emit*
+ functions. */
+ memcpy(cmd_depth, depth, 24);
+ memcpy(cmd_depth + 24, depth + 40, 8);
+ memcpy(cmd_depth + 32, depth + 24, 8);
+ memcpy(cmd_depth + 40, depth + 48, 8);
+ memcpy(cmd_depth + 48, depth + 32, 8);
+ memcpy(cmd_depth + 56, depth + 56, 8);
+ BrotliConvertBitDepthsToSymbols(cmd_depth, 64, cmd_bits);
+ memcpy(bits, cmd_bits, 48);
+ memcpy(bits + 24, cmd_bits + 32, 16);
+ memcpy(bits + 32, cmd_bits + 48, 16);
+ memcpy(bits + 40, cmd_bits + 24, 16);
+ memcpy(bits + 48, cmd_bits + 40, 16);
+ memcpy(bits + 56, cmd_bits + 56, 16);
+ BrotliConvertBitDepthsToSymbols(&depth[64], 64, &bits[64]);
+ {
+ /* Create the bit length array for the full command alphabet. */
+ size_t i;
+ memset(cmd_depth, 0, 64); /* only 64 first values were used */
+ memcpy(cmd_depth, depth, 8);
+ memcpy(cmd_depth + 64, depth + 8, 8);
+ memcpy(cmd_depth + 128, depth + 16, 8);
+ memcpy(cmd_depth + 192, depth + 24, 8);
+ memcpy(cmd_depth + 384, depth + 32, 8);
+ for (i = 0; i < 8; ++i) {
+ cmd_depth[128 + 8 * i] = depth[40 + i];
+ cmd_depth[256 + 8 * i] = depth[48 + i];
+ cmd_depth[448 + 8 * i] = depth[56 + i];
+ }
+ BrotliStoreHuffmanTree(
+ cmd_depth, BROTLI_NUM_COMMAND_SYMBOLS, tree, storage_ix, storage);
+ }
+ BrotliStoreHuffmanTree(&depth[64], 64, tree, storage_ix, storage);
+}
+
+/* REQUIRES: insertlen < 6210 */
+static BROTLI_INLINE void EmitInsertLen(size_t insertlen,
+ const uint8_t depth[128],
+ const uint16_t bits[128],
+ uint32_t histo[128],
+ size_t* storage_ix,
+ uint8_t* storage) {
+ if (insertlen < 6) {
+ const size_t code = insertlen + 40;
+ BrotliWriteBits(depth[code], bits[code], storage_ix, storage);
+ ++histo[code];
+ } else if (insertlen < 130) {
+ const size_t tail = insertlen - 2;
+ const uint32_t nbits = Log2FloorNonZero(tail) - 1u;
+ const size_t prefix = tail >> nbits;
+ const size_t inscode = (nbits << 1) + prefix + 42;
+ BrotliWriteBits(depth[inscode], bits[inscode], storage_ix, storage);
+ BrotliWriteBits(nbits, tail - (prefix << nbits), storage_ix, storage);
+ ++histo[inscode];
+ } else if (insertlen < 2114) {
+ const size_t tail = insertlen - 66;
+ const uint32_t nbits = Log2FloorNonZero(tail);
+ const size_t code = nbits + 50;
+ BrotliWriteBits(depth[code], bits[code], storage_ix, storage);
+ BrotliWriteBits(nbits, tail - ((size_t)1 << nbits), storage_ix, storage);
+ ++histo[code];
+ } else {
+ BrotliWriteBits(depth[61], bits[61], storage_ix, storage);
+ BrotliWriteBits(12, insertlen - 2114, storage_ix, storage);
+ ++histo[61];
+ }
+}
+
+static BROTLI_INLINE void EmitLongInsertLen(size_t insertlen,
+ const uint8_t depth[128],
+ const uint16_t bits[128],
+ uint32_t histo[128],
+ size_t* storage_ix,
+ uint8_t* storage) {
+ if (insertlen < 22594) {
+ BrotliWriteBits(depth[62], bits[62], storage_ix, storage);
+ BrotliWriteBits(14, insertlen - 6210, storage_ix, storage);
+ ++histo[62];
+ } else {
+ BrotliWriteBits(depth[63], bits[63], storage_ix, storage);
+ BrotliWriteBits(24, insertlen - 22594, storage_ix, storage);
+ ++histo[63];
+ }
+}
+
+static BROTLI_INLINE void EmitCopyLen(size_t copylen,
+ const uint8_t depth[128],
+ const uint16_t bits[128],
+ uint32_t histo[128],
+ size_t* storage_ix,
+ uint8_t* storage) {
+ if (copylen < 10) {
+ BrotliWriteBits(
+ depth[copylen + 14], bits[copylen + 14], storage_ix, storage);
+ ++histo[copylen + 14];
+ } else if (copylen < 134) {
+ const size_t tail = copylen - 6;
+ const uint32_t nbits = Log2FloorNonZero(tail) - 1u;
+ const size_t prefix = tail >> nbits;
+ const size_t code = (nbits << 1) + prefix + 20;
+ BrotliWriteBits(depth[code], bits[code], storage_ix, storage);
+ BrotliWriteBits(nbits, tail - (prefix << nbits), storage_ix, storage);
+ ++histo[code];
+ } else if (copylen < 2118) {
+ const size_t tail = copylen - 70;
+ const uint32_t nbits = Log2FloorNonZero(tail);
+ const size_t code = nbits + 28;
+ BrotliWriteBits(depth[code], bits[code], storage_ix, storage);
+ BrotliWriteBits(nbits, tail - ((size_t)1 << nbits), storage_ix, storage);
+ ++histo[code];
+ } else {
+ BrotliWriteBits(depth[39], bits[39], storage_ix, storage);
+ BrotliWriteBits(24, copylen - 2118, storage_ix, storage);
+ ++histo[39];
+ }
+}
+
+static BROTLI_INLINE void EmitCopyLenLastDistance(size_t copylen,
+ const uint8_t depth[128],
+ const uint16_t bits[128],
+ uint32_t histo[128],
+ size_t* storage_ix,
+ uint8_t* storage) {
+ if (copylen < 12) {
+ BrotliWriteBits(depth[copylen - 4], bits[copylen - 4], storage_ix, storage);
+ ++histo[copylen - 4];
+ } else if (copylen < 72) {
+ const size_t tail = copylen - 8;
+ const uint32_t nbits = Log2FloorNonZero(tail) - 1;
+ const size_t prefix = tail >> nbits;
+ const size_t code = (nbits << 1) + prefix + 4;
+ BrotliWriteBits(depth[code], bits[code], storage_ix, storage);
+ BrotliWriteBits(nbits, tail - (prefix << nbits), storage_ix, storage);
+ ++histo[code];
+ } else if (copylen < 136) {
+ const size_t tail = copylen - 8;
+ const size_t code = (tail >> 5) + 30;
+ BrotliWriteBits(depth[code], bits[code], storage_ix, storage);
+ BrotliWriteBits(5, tail & 31, storage_ix, storage);
+ BrotliWriteBits(depth[64], bits[64], storage_ix, storage);
+ ++histo[code];
+ ++histo[64];
+ } else if (copylen < 2120) {
+ const size_t tail = copylen - 72;
+ const uint32_t nbits = Log2FloorNonZero(tail);
+ const size_t code = nbits + 28;
+ BrotliWriteBits(depth[code], bits[code], storage_ix, storage);
+ BrotliWriteBits(nbits, tail - ((size_t)1 << nbits), storage_ix, storage);
+ BrotliWriteBits(depth[64], bits[64], storage_ix, storage);
+ ++histo[code];
+ ++histo[64];
+ } else {
+ BrotliWriteBits(depth[39], bits[39], storage_ix, storage);
+ BrotliWriteBits(24, copylen - 2120, storage_ix, storage);
+ BrotliWriteBits(depth[64], bits[64], storage_ix, storage);
+ ++histo[39];
+ ++histo[64];
+ }
+}
+
+static BROTLI_INLINE void EmitDistance(size_t distance,
+ const uint8_t depth[128],
+ const uint16_t bits[128],
+ uint32_t histo[128],
+ size_t* storage_ix, uint8_t* storage) {
+ const size_t d = distance + 3;
+ const uint32_t nbits = Log2FloorNonZero(d) - 1u;
+ const size_t prefix = (d >> nbits) & 1;
+ const size_t offset = (2 + prefix) << nbits;
+ const size_t distcode = 2 * (nbits - 1) + prefix + 80;
+ BrotliWriteBits(depth[distcode], bits[distcode], storage_ix, storage);
+ BrotliWriteBits(nbits, d - offset, storage_ix, storage);
+ ++histo[distcode];
+}
+
+static BROTLI_INLINE void EmitLiterals(const uint8_t* input, const size_t len,
+ const uint8_t depth[256],
+ const uint16_t bits[256],
+ size_t* storage_ix, uint8_t* storage) {
+ size_t j;
+ for (j = 0; j < len; j++) {
+ const uint8_t lit = input[j];
+ BrotliWriteBits(depth[lit], bits[lit], storage_ix, storage);
+ }
+}
+
+/* REQUIRES: len <= 1 << 24. */
+static void BrotliStoreMetaBlockHeader(
+ size_t len, BROTLI_BOOL is_uncompressed, size_t* storage_ix,
+ uint8_t* storage) {
+ size_t nibbles = 6;
+ /* ISLAST */
+ BrotliWriteBits(1, 0, storage_ix, storage);
+ if (len <= (1U << 16)) {
+ nibbles = 4;
+ } else if (len <= (1U << 20)) {
+ nibbles = 5;
+ }
+ BrotliWriteBits(2, nibbles - 4, storage_ix, storage);
+ BrotliWriteBits(nibbles * 4, len - 1, storage_ix, storage);
+ /* ISUNCOMPRESSED */
+ BrotliWriteBits(1, (uint64_t)is_uncompressed, storage_ix, storage);
+}
+
+static void UpdateBits(size_t n_bits, uint32_t bits, size_t pos,
+ uint8_t* array) {
+ while (n_bits > 0) {
+ size_t byte_pos = pos >> 3;
+ size_t n_unchanged_bits = pos & 7;
+ size_t n_changed_bits = BROTLI_MIN(size_t, n_bits, 8 - n_unchanged_bits);
+ size_t total_bits = n_unchanged_bits + n_changed_bits;
+ uint32_t mask =
+ (~((1u << total_bits) - 1u)) | ((1u << n_unchanged_bits) - 1u);
+ uint32_t unchanged_bits = array[byte_pos] & mask;
+ uint32_t changed_bits = bits & ((1u << n_changed_bits) - 1u);
+ array[byte_pos] =
+ (uint8_t)((changed_bits << n_unchanged_bits) | unchanged_bits);
+ n_bits -= n_changed_bits;
+ bits >>= n_changed_bits;
+ pos += n_changed_bits;
+ }
+}
+
+static void RewindBitPosition(const size_t new_storage_ix,
+ size_t* storage_ix, uint8_t* storage) {
+ const size_t bitpos = new_storage_ix & 7;
+ const size_t mask = (1u << bitpos) - 1;
+ storage[new_storage_ix >> 3] &= (uint8_t)mask;
+ *storage_ix = new_storage_ix;
+}
+
+static BROTLI_BOOL ShouldMergeBlock(
+ const uint8_t* data, size_t len, const uint8_t* depths) {
+ size_t histo[256] = { 0 };
+ static const size_t kSampleRate = 43;
+ size_t i;
+ for (i = 0; i < len; i += kSampleRate) {
+ ++histo[data[i]];
+ }
+ {
+ const size_t total = (len + kSampleRate - 1) / kSampleRate;
+ double r = (FastLog2(total) + 0.5) * (double)total + 200;
+ for (i = 0; i < 256; ++i) {
+ r -= (double)histo[i] * (depths[i] + FastLog2(histo[i]));
+ }
+ return TO_BROTLI_BOOL(r >= 0.0);
+ }
+}
+
+/* Acceptable loss for uncompressible speedup is 2% */
+#define MIN_RATIO 980
+
+static BROTLI_INLINE BROTLI_BOOL ShouldUseUncompressedMode(
+ const uint8_t* metablock_start, const uint8_t* next_emit,
+ const size_t insertlen, const size_t literal_ratio) {
+ const size_t compressed = (size_t)(next_emit - metablock_start);
+ if (compressed * 50 > insertlen) {
+ return BROTLI_FALSE;
+ } else {
+ return TO_BROTLI_BOOL(literal_ratio > MIN_RATIO);
+ }
+}
+
+static void EmitUncompressedMetaBlock(const uint8_t* begin, const uint8_t* end,
+ const size_t storage_ix_start,
+ size_t* storage_ix, uint8_t* storage) {
+ const size_t len = (size_t)(end - begin);
+ RewindBitPosition(storage_ix_start, storage_ix, storage);
+ BrotliStoreMetaBlockHeader(len, 1, storage_ix, storage);
+ *storage_ix = (*storage_ix + 7u) & ~7u;
+ memcpy(&storage[*storage_ix >> 3], begin, len);
+ *storage_ix += len << 3;
+ storage[*storage_ix >> 3] = 0;
+}
+
+static uint32_t kCmdHistoSeed[128] = {
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 0, 0, 0,
+};
+
+static BROTLI_INLINE void BrotliCompressFragmentFastImpl(
+ MemoryManager* m, const uint8_t* input, size_t input_size,
+ BROTLI_BOOL is_last, int* table, size_t table_bits, uint8_t cmd_depth[128],
+ uint16_t cmd_bits[128], size_t* cmd_code_numbits, uint8_t* cmd_code,
+ size_t* storage_ix, uint8_t* storage) {
+ uint32_t cmd_histo[128];
+ const uint8_t* ip_end;
+
+ /* "next_emit" is a pointer to the first byte that is not covered by a
+ previous copy. Bytes between "next_emit" and the start of the next copy or
+ the end of the input will be emitted as literal bytes. */
+ const uint8_t* next_emit = input;
+ /* Save the start of the first block for position and distance computations.
+ */
+ const uint8_t* base_ip = input;
+
+ static const size_t kFirstBlockSize = 3 << 15;
+ static const size_t kMergeBlockSize = 1 << 16;
+
+ const size_t kInputMarginBytes = BROTLI_WINDOW_GAP;
+ const size_t kMinMatchLen = 5;
+
+ const uint8_t* metablock_start = input;
+ size_t block_size = BROTLI_MIN(size_t, input_size, kFirstBlockSize);
+ size_t total_block_size = block_size;
+ /* Save the bit position of the MLEN field of the meta-block header, so that
+ we can update it later if we decide to extend this meta-block. */
+ size_t mlen_storage_ix = *storage_ix + 3;
+
+ uint8_t lit_depth[256];
+ uint16_t lit_bits[256];
+
+ size_t literal_ratio;
+
+ const uint8_t* ip;
+ int last_distance;
+
+ const size_t shift = 64u - table_bits;
+
+ BrotliStoreMetaBlockHeader(block_size, 0, storage_ix, storage);
+ /* No block splits, no contexts. */
+ BrotliWriteBits(13, 0, storage_ix, storage);
+
+ literal_ratio = BuildAndStoreLiteralPrefixCode(
+ m, input, block_size, lit_depth, lit_bits, storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+
+ {
+ /* Store the pre-compressed command and distance prefix codes. */
+ size_t i;
+ for (i = 0; i + 7 < *cmd_code_numbits; i += 8) {
+ BrotliWriteBits(8, cmd_code[i >> 3], storage_ix, storage);
+ }
+ }
+ BrotliWriteBits(*cmd_code_numbits & 7, cmd_code[*cmd_code_numbits >> 3],
+ storage_ix, storage);
+
+ emit_commands:
+ /* Initialize the command and distance histograms. We will gather
+ statistics of command and distance codes during the processing
+ of this block and use it to update the command and distance
+ prefix codes for the next block. */
+ memcpy(cmd_histo, kCmdHistoSeed, sizeof(kCmdHistoSeed));
+
+ /* "ip" is the input pointer. */
+ ip = input;
+ last_distance = -1;
+ ip_end = input + block_size;
+
+ if (BROTLI_PREDICT_TRUE(block_size >= kInputMarginBytes)) {
+ /* For the last block, we need to keep a 16 bytes margin so that we can be
+ sure that all distances are at most window size - 16.
+ For all other blocks, we only need to keep a margin of 5 bytes so that
+ we don't go over the block size with a copy. */
+ const size_t len_limit = BROTLI_MIN(size_t, block_size - kMinMatchLen,
+ input_size - kInputMarginBytes);
+ const uint8_t* ip_limit = input + len_limit;
+
+ uint32_t next_hash;
+ for (next_hash = Hash(++ip, shift); ; ) {
+ /* Step 1: Scan forward in the input looking for a 5-byte-long match.
+ If we get close to exhausting the input then goto emit_remainder.
+
+ Heuristic match skipping: If 32 bytes are scanned with no matches
+ found, start looking only at every other byte. If 32 more bytes are
+ scanned, look at every third byte, etc.. When a match is found,
+ immediately go back to looking at every byte. This is a small loss
+ (~5% performance, ~0.1% density) for compressible data due to more
+ bookkeeping, but for non-compressible data (such as JPEG) it's a huge
+ win since the compressor quickly "realizes" the data is incompressible
+ and doesn't bother looking for matches everywhere.
+
+ The "skip" variable keeps track of how many bytes there are since the
+ last match; dividing it by 32 (i.e. right-shifting by five) gives the
+ number of bytes to move ahead for each iteration. */
+ uint32_t skip = 32;
+
+ const uint8_t* next_ip = ip;
+ const uint8_t* candidate;
+ BROTLI_DCHECK(next_emit < ip);
+trawl:
+ do {
+ uint32_t hash = next_hash;
+ uint32_t bytes_between_hash_lookups = skip++ >> 5;
+ BROTLI_DCHECK(hash == Hash(next_ip, shift));
+ ip = next_ip;
+ next_ip = ip + bytes_between_hash_lookups;
+ if (BROTLI_PREDICT_FALSE(next_ip > ip_limit)) {
+ goto emit_remainder;
+ }
+ next_hash = Hash(next_ip, shift);
+ candidate = ip - last_distance;
+ if (IsMatch(ip, candidate)) {
+ if (BROTLI_PREDICT_TRUE(candidate < ip)) {
+ table[hash] = (int)(ip - base_ip);
+ break;
+ }
+ }
+ candidate = base_ip + table[hash];
+ BROTLI_DCHECK(candidate >= base_ip);
+ BROTLI_DCHECK(candidate < ip);
+
+ table[hash] = (int)(ip - base_ip);
+ } while (BROTLI_PREDICT_TRUE(!IsMatch(ip, candidate)));
+
+ /* Check copy distance. If candidate is not feasible, continue search.
+ Checking is done outside of hot loop to reduce overhead. */
+ if (ip - candidate > MAX_DISTANCE) goto trawl;
+
+ /* Step 2: Emit the found match together with the literal bytes from
+ "next_emit" to the bit stream, and then see if we can find a next match
+ immediately afterwards. Repeat until we find no match for the input
+ without emitting some literal bytes. */
+
+ {
+ /* We have a 5-byte match at ip, and we need to emit bytes in
+ [next_emit, ip). */
+ const uint8_t* base = ip;
+ size_t matched = 5 + FindMatchLengthWithLimit(
+ candidate + 5, ip + 5, (size_t)(ip_end - ip) - 5);
+ int distance = (int)(base - candidate); /* > 0 */
+ size_t insert = (size_t)(base - next_emit);
+ ip += matched;
+ BROTLI_DCHECK(0 == memcmp(base, candidate, matched));
+ if (BROTLI_PREDICT_TRUE(insert < 6210)) {
+ EmitInsertLen(insert, cmd_depth, cmd_bits, cmd_histo,
+ storage_ix, storage);
+ } else if (ShouldUseUncompressedMode(metablock_start, next_emit, insert,
+ literal_ratio)) {
+ EmitUncompressedMetaBlock(metablock_start, base, mlen_storage_ix - 3,
+ storage_ix, storage);
+ input_size -= (size_t)(base - input);
+ input = base;
+ next_emit = input;
+ goto next_block;
+ } else {
+ EmitLongInsertLen(insert, cmd_depth, cmd_bits, cmd_histo,
+ storage_ix, storage);
+ }
+ EmitLiterals(next_emit, insert, lit_depth, lit_bits,
+ storage_ix, storage);
+ if (distance == last_distance) {
+ BrotliWriteBits(cmd_depth[64], cmd_bits[64], storage_ix, storage);
+ ++cmd_histo[64];
+ } else {
+ EmitDistance((size_t)distance, cmd_depth, cmd_bits,
+ cmd_histo, storage_ix, storage);
+ last_distance = distance;
+ }
+ EmitCopyLenLastDistance(matched, cmd_depth, cmd_bits, cmd_histo,
+ storage_ix, storage);
+
+ next_emit = ip;
+ if (BROTLI_PREDICT_FALSE(ip >= ip_limit)) {
+ goto emit_remainder;
+ }
+ /* We could immediately start working at ip now, but to improve
+ compression we first update "table" with the hashes of some positions
+ within the last copy. */
+ {
+ uint64_t input_bytes = BROTLI_UNALIGNED_LOAD64LE(ip - 3);
+ uint32_t prev_hash = HashBytesAtOffset(input_bytes, 0, shift);
+ uint32_t cur_hash = HashBytesAtOffset(input_bytes, 3, shift);
+ table[prev_hash] = (int)(ip - base_ip - 3);
+ prev_hash = HashBytesAtOffset(input_bytes, 1, shift);
+ table[prev_hash] = (int)(ip - base_ip - 2);
+ prev_hash = HashBytesAtOffset(input_bytes, 2, shift);
+ table[prev_hash] = (int)(ip - base_ip - 1);
+
+ candidate = base_ip + table[cur_hash];
+ table[cur_hash] = (int)(ip - base_ip);
+ }
+ }
+
+ while (IsMatch(ip, candidate)) {
+ /* We have a 5-byte match at ip, and no need to emit any literal bytes
+ prior to ip. */
+ const uint8_t* base = ip;
+ size_t matched = 5 + FindMatchLengthWithLimit(
+ candidate + 5, ip + 5, (size_t)(ip_end - ip) - 5);
+ if (ip - candidate > MAX_DISTANCE) break;
+ ip += matched;
+ last_distance = (int)(base - candidate); /* > 0 */
+ BROTLI_DCHECK(0 == memcmp(base, candidate, matched));
+ EmitCopyLen(matched, cmd_depth, cmd_bits, cmd_histo,
+ storage_ix, storage);
+ EmitDistance((size_t)last_distance, cmd_depth, cmd_bits,
+ cmd_histo, storage_ix, storage);
+
+ next_emit = ip;
+ if (BROTLI_PREDICT_FALSE(ip >= ip_limit)) {
+ goto emit_remainder;
+ }
+ /* We could immediately start working at ip now, but to improve
+ compression we first update "table" with the hashes of some positions
+ within the last copy. */
+ {
+ uint64_t input_bytes = BROTLI_UNALIGNED_LOAD64LE(ip - 3);
+ uint32_t prev_hash = HashBytesAtOffset(input_bytes, 0, shift);
+ uint32_t cur_hash = HashBytesAtOffset(input_bytes, 3, shift);
+ table[prev_hash] = (int)(ip - base_ip - 3);
+ prev_hash = HashBytesAtOffset(input_bytes, 1, shift);
+ table[prev_hash] = (int)(ip - base_ip - 2);
+ prev_hash = HashBytesAtOffset(input_bytes, 2, shift);
+ table[prev_hash] = (int)(ip - base_ip - 1);
+
+ candidate = base_ip + table[cur_hash];
+ table[cur_hash] = (int)(ip - base_ip);
+ }
+ }
+
+ next_hash = Hash(++ip, shift);
+ }
+ }
+
+ emit_remainder:
+ BROTLI_DCHECK(next_emit <= ip_end);
+ input += block_size;
+ input_size -= block_size;
+ block_size = BROTLI_MIN(size_t, input_size, kMergeBlockSize);
+
+ /* Decide if we want to continue this meta-block instead of emitting the
+ last insert-only command. */
+ if (input_size > 0 &&
+ total_block_size + block_size <= (1 << 20) &&
+ ShouldMergeBlock(input, block_size, lit_depth)) {
+ BROTLI_DCHECK(total_block_size > (1 << 16));
+ /* Update the size of the current meta-block and continue emitting commands.
+ We can do this because the current size and the new size both have 5
+ nibbles. */
+ total_block_size += block_size;
+ UpdateBits(20, (uint32_t)(total_block_size - 1), mlen_storage_ix, storage);
+ goto emit_commands;
+ }
+
+ /* Emit the remaining bytes as literals. */
+ if (next_emit < ip_end) {
+ const size_t insert = (size_t)(ip_end - next_emit);
+ if (BROTLI_PREDICT_TRUE(insert < 6210)) {
+ EmitInsertLen(insert, cmd_depth, cmd_bits, cmd_histo,
+ storage_ix, storage);
+ EmitLiterals(next_emit, insert, lit_depth, lit_bits, storage_ix, storage);
+ } else if (ShouldUseUncompressedMode(metablock_start, next_emit, insert,
+ literal_ratio)) {
+ EmitUncompressedMetaBlock(metablock_start, ip_end, mlen_storage_ix - 3,
+ storage_ix, storage);
+ } else {
+ EmitLongInsertLen(insert, cmd_depth, cmd_bits, cmd_histo,
+ storage_ix, storage);
+ EmitLiterals(next_emit, insert, lit_depth, lit_bits,
+ storage_ix, storage);
+ }
+ }
+ next_emit = ip_end;
+
+next_block:
+ /* If we have more data, write a new meta-block header and prefix codes and
+ then continue emitting commands. */
+ if (input_size > 0) {
+ metablock_start = input;
+ block_size = BROTLI_MIN(size_t, input_size, kFirstBlockSize);
+ total_block_size = block_size;
+ /* Save the bit position of the MLEN field of the meta-block header, so that
+ we can update it later if we decide to extend this meta-block. */
+ mlen_storage_ix = *storage_ix + 3;
+ BrotliStoreMetaBlockHeader(block_size, 0, storage_ix, storage);
+ /* No block splits, no contexts. */
+ BrotliWriteBits(13, 0, storage_ix, storage);
+ literal_ratio = BuildAndStoreLiteralPrefixCode(
+ m, input, block_size, lit_depth, lit_bits, storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ BuildAndStoreCommandPrefixCode(cmd_histo, cmd_depth, cmd_bits,
+ storage_ix, storage);
+ goto emit_commands;
+ }
+
+ if (!is_last) {
+ /* If this is not the last block, update the command and distance prefix
+ codes for the next block and store the compressed forms. */
+ cmd_code[0] = 0;
+ *cmd_code_numbits = 0;
+ BuildAndStoreCommandPrefixCode(cmd_histo, cmd_depth, cmd_bits,
+ cmd_code_numbits, cmd_code);
+ }
+}
+
+#define FOR_TABLE_BITS_(X) X(9) X(11) X(13) X(15)
+
+#define BAKE_METHOD_PARAM_(B) \
+static BROTLI_NOINLINE void BrotliCompressFragmentFastImpl ## B( \
+ MemoryManager* m, const uint8_t* input, size_t input_size, \
+ BROTLI_BOOL is_last, int* table, uint8_t cmd_depth[128], \
+ uint16_t cmd_bits[128], size_t* cmd_code_numbits, uint8_t* cmd_code, \
+ size_t* storage_ix, uint8_t* storage) { \
+ BrotliCompressFragmentFastImpl(m, input, input_size, is_last, table, B, \
+ cmd_depth, cmd_bits, cmd_code_numbits, cmd_code, storage_ix, storage); \
+}
+FOR_TABLE_BITS_(BAKE_METHOD_PARAM_)
+#undef BAKE_METHOD_PARAM_
+
+void BrotliCompressFragmentFast(
+ MemoryManager* m, const uint8_t* input, size_t input_size,
+ BROTLI_BOOL is_last, int* table, size_t table_size, uint8_t cmd_depth[128],
+ uint16_t cmd_bits[128], size_t* cmd_code_numbits, uint8_t* cmd_code,
+ size_t* storage_ix, uint8_t* storage) {
+ const size_t initial_storage_ix = *storage_ix;
+ const size_t table_bits = Log2FloorNonZero(table_size);
+
+ if (input_size == 0) {
+ BROTLI_DCHECK(is_last);
+ BrotliWriteBits(1, 1, storage_ix, storage); /* islast */
+ BrotliWriteBits(1, 1, storage_ix, storage); /* isempty */
+ *storage_ix = (*storage_ix + 7u) & ~7u;
+ return;
+ }
+
+ switch (table_bits) {
+#define CASE_(B) \
+ case B: \
+ BrotliCompressFragmentFastImpl ## B( \
+ m, input, input_size, is_last, table, cmd_depth, cmd_bits, \
+ cmd_code_numbits, cmd_code, storage_ix, storage); \
+ break;
+ FOR_TABLE_BITS_(CASE_)
+#undef CASE_
+ default: BROTLI_DCHECK(0); break;
+ }
+
+ /* If output is larger than single uncompressed block, rewrite it. */
+ if (*storage_ix - initial_storage_ix > 31 + (input_size << 3)) {
+ EmitUncompressedMetaBlock(input, input + input_size, initial_storage_ix,
+ storage_ix, storage);
+ }
+
+ if (is_last) {
+ BrotliWriteBits(1, 1, storage_ix, storage); /* islast */
+ BrotliWriteBits(1, 1, storage_ix, storage); /* isempty */
+ *storage_ix = (*storage_ix + 7u) & ~7u;
+ }
+}
+
+#undef FOR_TABLE_BITS_
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment.h
new file mode 100644
index 000000000..80007f5dc
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment.h
@@ -0,0 +1,61 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Function for fast encoding of an input fragment, independently from the input
+ history. This function uses one-pass processing: when we find a backward
+ match, we immediately emit the corresponding command and literal codes to
+ the bit stream. */
+
+#ifndef BROTLI_ENC_COMPRESS_FRAGMENT_H_
+#define BROTLI_ENC_COMPRESS_FRAGMENT_H_
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./memory.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* Compresses "input" string to the "*storage" buffer as one or more complete
+ meta-blocks, and updates the "*storage_ix" bit position.
+
+ If "is_last" is 1, emits an additional empty last meta-block.
+
+ "cmd_depth" and "cmd_bits" contain the command and distance prefix codes
+ (see comment in encode.h) used for the encoding of this input fragment.
+ If "is_last" is 0, they are updated to reflect the statistics
+ of this input fragment, to be used for the encoding of the next fragment.
+
+ "*cmd_code_numbits" is the number of bits of the compressed representation
+ of the command and distance prefix codes, and "cmd_code" is an array of
+ at least "(*cmd_code_numbits + 7) >> 3" size that contains the compressed
+ command and distance prefix codes. If "is_last" is 0, these are also
+ updated to represent the updated "cmd_depth" and "cmd_bits".
+
+ REQUIRES: "input_size" is greater than zero, or "is_last" is 1.
+ REQUIRES: "input_size" is less or equal to maximal metablock size (1 << 24).
+ REQUIRES: All elements in "table[0..table_size-1]" are initialized to zero.
+ REQUIRES: "table_size" is an odd (9, 11, 13, 15) power of two
+ OUTPUT: maximal copy distance <= |input_size|
+ OUTPUT: maximal copy distance <= BROTLI_MAX_BACKWARD_LIMIT(18) */
+BROTLI_INTERNAL void BrotliCompressFragmentFast(MemoryManager* m,
+ const uint8_t* input,
+ size_t input_size,
+ BROTLI_BOOL is_last,
+ int* table, size_t table_size,
+ uint8_t cmd_depth[128],
+ uint16_t cmd_bits[128],
+ size_t* cmd_code_numbits,
+ uint8_t* cmd_code,
+ size_t* storage_ix,
+ uint8_t* storage);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_COMPRESS_FRAGMENT_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment_two_pass.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment_two_pass.c
new file mode 100644
index 000000000..f8a560638
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment_two_pass.c
@@ -0,0 +1,645 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Function for fast encoding of an input fragment, independently from the input
+ history. This function uses two-pass processing: in the first pass we save
+ the found backward matches and literal bytes into a buffer, and in the
+ second pass we emit them into the bit stream using prefix codes built based
+ on the actual command and literal byte histograms. */
+
+#include "./compress_fragment_two_pass.h"
+
+#include <string.h> /* memcmp, memcpy, memset */
+
+#include "../common/constants.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./bit_cost.h"
+#include "./brotli_bit_stream.h"
+#include "./entropy_encode.h"
+#include "./fast_log.h"
+#include "./find_match_length.h"
+#include "./memory.h"
+#include "./write_bits.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#define MAX_DISTANCE (long)BROTLI_MAX_BACKWARD_LIMIT(18)
+
+/* kHashMul32 multiplier has these properties:
+ * The multiplier must be odd. Otherwise we may lose the highest bit.
+ * No long streaks of ones or zeros.
+ * There is no effort to ensure that it is a prime, the oddity is enough
+ for this use.
+ * The number has been tuned heuristically against compression benchmarks. */
+static const uint32_t kHashMul32 = 0x1E35A7BD;
+
+static BROTLI_INLINE uint32_t Hash(const uint8_t* p,
+ size_t shift, size_t length) {
+ const uint64_t h =
+ (BROTLI_UNALIGNED_LOAD64LE(p) << ((8 - length) * 8)) * kHashMul32;
+ return (uint32_t)(h >> shift);
+}
+
+static BROTLI_INLINE uint32_t HashBytesAtOffset(uint64_t v, size_t offset,
+ size_t shift, size_t length) {
+ BROTLI_DCHECK(offset <= 8 - length);
+ {
+ const uint64_t h = ((v >> (8 * offset)) << ((8 - length) * 8)) * kHashMul32;
+ return (uint32_t)(h >> shift);
+ }
+}
+
+static BROTLI_INLINE BROTLI_BOOL IsMatch(const uint8_t* p1, const uint8_t* p2,
+ size_t length) {
+ if (BrotliUnalignedRead32(p1) == BrotliUnalignedRead32(p2)) {
+ if (length == 4) return BROTLI_TRUE;
+ return TO_BROTLI_BOOL(p1[4] == p2[4] && p1[5] == p2[5]);
+ }
+ return BROTLI_FALSE;
+}
+
+/* Builds a command and distance prefix code (each 64 symbols) into "depth" and
+ "bits" based on "histogram" and stores it into the bit stream. */
+static void BuildAndStoreCommandPrefixCode(
+ const uint32_t histogram[128],
+ uint8_t depth[128], uint16_t bits[128],
+ size_t* storage_ix, uint8_t* storage) {
+ /* Tree size for building a tree over 64 symbols is 2 * 64 + 1. */
+ HuffmanTree tree[129];
+ uint8_t cmd_depth[BROTLI_NUM_COMMAND_SYMBOLS] = { 0 };
+ uint16_t cmd_bits[64];
+ BrotliCreateHuffmanTree(histogram, 64, 15, tree, depth);
+ BrotliCreateHuffmanTree(&histogram[64], 64, 14, tree, &depth[64]);
+ /* We have to jump through a few hoops here in order to compute
+ the command bits because the symbols are in a different order than in
+ the full alphabet. This looks complicated, but having the symbols
+ in this order in the command bits saves a few branches in the Emit*
+ functions. */
+ memcpy(cmd_depth, depth + 24, 24);
+ memcpy(cmd_depth + 24, depth, 8);
+ memcpy(cmd_depth + 32, depth + 48, 8);
+ memcpy(cmd_depth + 40, depth + 8, 8);
+ memcpy(cmd_depth + 48, depth + 56, 8);
+ memcpy(cmd_depth + 56, depth + 16, 8);
+ BrotliConvertBitDepthsToSymbols(cmd_depth, 64, cmd_bits);
+ memcpy(bits, cmd_bits + 24, 16);
+ memcpy(bits + 8, cmd_bits + 40, 16);
+ memcpy(bits + 16, cmd_bits + 56, 16);
+ memcpy(bits + 24, cmd_bits, 48);
+ memcpy(bits + 48, cmd_bits + 32, 16);
+ memcpy(bits + 56, cmd_bits + 48, 16);
+ BrotliConvertBitDepthsToSymbols(&depth[64], 64, &bits[64]);
+ {
+ /* Create the bit length array for the full command alphabet. */
+ size_t i;
+ memset(cmd_depth, 0, 64); /* only 64 first values were used */
+ memcpy(cmd_depth, depth + 24, 8);
+ memcpy(cmd_depth + 64, depth + 32, 8);
+ memcpy(cmd_depth + 128, depth + 40, 8);
+ memcpy(cmd_depth + 192, depth + 48, 8);
+ memcpy(cmd_depth + 384, depth + 56, 8);
+ for (i = 0; i < 8; ++i) {
+ cmd_depth[128 + 8 * i] = depth[i];
+ cmd_depth[256 + 8 * i] = depth[8 + i];
+ cmd_depth[448 + 8 * i] = depth[16 + i];
+ }
+ BrotliStoreHuffmanTree(
+ cmd_depth, BROTLI_NUM_COMMAND_SYMBOLS, tree, storage_ix, storage);
+ }
+ BrotliStoreHuffmanTree(&depth[64], 64, tree, storage_ix, storage);
+}
+
+static BROTLI_INLINE void EmitInsertLen(
+ uint32_t insertlen, uint32_t** commands) {
+ if (insertlen < 6) {
+ **commands = insertlen;
+ } else if (insertlen < 130) {
+ const uint32_t tail = insertlen - 2;
+ const uint32_t nbits = Log2FloorNonZero(tail) - 1u;
+ const uint32_t prefix = tail >> nbits;
+ const uint32_t inscode = (nbits << 1) + prefix + 2;
+ const uint32_t extra = tail - (prefix << nbits);
+ **commands = inscode | (extra << 8);
+ } else if (insertlen < 2114) {
+ const uint32_t tail = insertlen - 66;
+ const uint32_t nbits = Log2FloorNonZero(tail);
+ const uint32_t code = nbits + 10;
+ const uint32_t extra = tail - (1u << nbits);
+ **commands = code | (extra << 8);
+ } else if (insertlen < 6210) {
+ const uint32_t extra = insertlen - 2114;
+ **commands = 21 | (extra << 8);
+ } else if (insertlen < 22594) {
+ const uint32_t extra = insertlen - 6210;
+ **commands = 22 | (extra << 8);
+ } else {
+ const uint32_t extra = insertlen - 22594;
+ **commands = 23 | (extra << 8);
+ }
+ ++(*commands);
+}
+
+static BROTLI_INLINE void EmitCopyLen(size_t copylen, uint32_t** commands) {
+ if (copylen < 10) {
+ **commands = (uint32_t)(copylen + 38);
+ } else if (copylen < 134) {
+ const size_t tail = copylen - 6;
+ const size_t nbits = Log2FloorNonZero(tail) - 1;
+ const size_t prefix = tail >> nbits;
+ const size_t code = (nbits << 1) + prefix + 44;
+ const size_t extra = tail - (prefix << nbits);
+ **commands = (uint32_t)(code | (extra << 8));
+ } else if (copylen < 2118) {
+ const size_t tail = copylen - 70;
+ const size_t nbits = Log2FloorNonZero(tail);
+ const size_t code = nbits + 52;
+ const size_t extra = tail - ((size_t)1 << nbits);
+ **commands = (uint32_t)(code | (extra << 8));
+ } else {
+ const size_t extra = copylen - 2118;
+ **commands = (uint32_t)(63 | (extra << 8));
+ }
+ ++(*commands);
+}
+
+static BROTLI_INLINE void EmitCopyLenLastDistance(
+ size_t copylen, uint32_t** commands) {
+ if (copylen < 12) {
+ **commands = (uint32_t)(copylen + 20);
+ ++(*commands);
+ } else if (copylen < 72) {
+ const size_t tail = copylen - 8;
+ const size_t nbits = Log2FloorNonZero(tail) - 1;
+ const size_t prefix = tail >> nbits;
+ const size_t code = (nbits << 1) + prefix + 28;
+ const size_t extra = tail - (prefix << nbits);
+ **commands = (uint32_t)(code | (extra << 8));
+ ++(*commands);
+ } else if (copylen < 136) {
+ const size_t tail = copylen - 8;
+ const size_t code = (tail >> 5) + 54;
+ const size_t extra = tail & 31;
+ **commands = (uint32_t)(code | (extra << 8));
+ ++(*commands);
+ **commands = 64;
+ ++(*commands);
+ } else if (copylen < 2120) {
+ const size_t tail = copylen - 72;
+ const size_t nbits = Log2FloorNonZero(tail);
+ const size_t code = nbits + 52;
+ const size_t extra = tail - ((size_t)1 << nbits);
+ **commands = (uint32_t)(code | (extra << 8));
+ ++(*commands);
+ **commands = 64;
+ ++(*commands);
+ } else {
+ const size_t extra = copylen - 2120;
+ **commands = (uint32_t)(63 | (extra << 8));
+ ++(*commands);
+ **commands = 64;
+ ++(*commands);
+ }
+}
+
+static BROTLI_INLINE void EmitDistance(uint32_t distance, uint32_t** commands) {
+ uint32_t d = distance + 3;
+ uint32_t nbits = Log2FloorNonZero(d) - 1;
+ const uint32_t prefix = (d >> nbits) & 1;
+ const uint32_t offset = (2 + prefix) << nbits;
+ const uint32_t distcode = 2 * (nbits - 1) + prefix + 80;
+ uint32_t extra = d - offset;
+ **commands = distcode | (extra << 8);
+ ++(*commands);
+}
+
+/* REQUIRES: len <= 1 << 24. */
+static void BrotliStoreMetaBlockHeader(
+ size_t len, BROTLI_BOOL is_uncompressed, size_t* storage_ix,
+ uint8_t* storage) {
+ size_t nibbles = 6;
+ /* ISLAST */
+ BrotliWriteBits(1, 0, storage_ix, storage);
+ if (len <= (1U << 16)) {
+ nibbles = 4;
+ } else if (len <= (1U << 20)) {
+ nibbles = 5;
+ }
+ BrotliWriteBits(2, nibbles - 4, storage_ix, storage);
+ BrotliWriteBits(nibbles * 4, len - 1, storage_ix, storage);
+ /* ISUNCOMPRESSED */
+ BrotliWriteBits(1, (uint64_t)is_uncompressed, storage_ix, storage);
+}
+
+static BROTLI_INLINE void CreateCommands(const uint8_t* input,
+ size_t block_size, size_t input_size, const uint8_t* base_ip, int* table,
+ size_t table_bits, size_t min_match,
+ uint8_t** literals, uint32_t** commands) {
+ /* "ip" is the input pointer. */
+ const uint8_t* ip = input;
+ const size_t shift = 64u - table_bits;
+ const uint8_t* ip_end = input + block_size;
+ /* "next_emit" is a pointer to the first byte that is not covered by a
+ previous copy. Bytes between "next_emit" and the start of the next copy or
+ the end of the input will be emitted as literal bytes. */
+ const uint8_t* next_emit = input;
+
+ int last_distance = -1;
+ const size_t kInputMarginBytes = BROTLI_WINDOW_GAP;
+
+ if (BROTLI_PREDICT_TRUE(block_size >= kInputMarginBytes)) {
+ /* For the last block, we need to keep a 16 bytes margin so that we can be
+ sure that all distances are at most window size - 16.
+ For all other blocks, we only need to keep a margin of 5 bytes so that
+ we don't go over the block size with a copy. */
+ const size_t len_limit = BROTLI_MIN(size_t, block_size - min_match,
+ input_size - kInputMarginBytes);
+ const uint8_t* ip_limit = input + len_limit;
+
+ uint32_t next_hash;
+ for (next_hash = Hash(++ip, shift, min_match); ; ) {
+ /* Step 1: Scan forward in the input looking for a 6-byte-long match.
+ If we get close to exhausting the input then goto emit_remainder.
+
+ Heuristic match skipping: If 32 bytes are scanned with no matches
+ found, start looking only at every other byte. If 32 more bytes are
+ scanned, look at every third byte, etc.. When a match is found,
+ immediately go back to looking at every byte. This is a small loss
+ (~5% performance, ~0.1% density) for compressible data due to more
+ bookkeeping, but for non-compressible data (such as JPEG) it's a huge
+ win since the compressor quickly "realizes" the data is incompressible
+ and doesn't bother looking for matches everywhere.
+
+ The "skip" variable keeps track of how many bytes there are since the
+ last match; dividing it by 32 (ie. right-shifting by five) gives the
+ number of bytes to move ahead for each iteration. */
+ uint32_t skip = 32;
+
+ const uint8_t* next_ip = ip;
+ const uint8_t* candidate;
+
+ BROTLI_DCHECK(next_emit < ip);
+trawl:
+ do {
+ uint32_t hash = next_hash;
+ uint32_t bytes_between_hash_lookups = skip++ >> 5;
+ ip = next_ip;
+ BROTLI_DCHECK(hash == Hash(ip, shift, min_match));
+ next_ip = ip + bytes_between_hash_lookups;
+ if (BROTLI_PREDICT_FALSE(next_ip > ip_limit)) {
+ goto emit_remainder;
+ }
+ next_hash = Hash(next_ip, shift, min_match);
+ candidate = ip - last_distance;
+ if (IsMatch(ip, candidate, min_match)) {
+ if (BROTLI_PREDICT_TRUE(candidate < ip)) {
+ table[hash] = (int)(ip - base_ip);
+ break;
+ }
+ }
+ candidate = base_ip + table[hash];
+ BROTLI_DCHECK(candidate >= base_ip);
+ BROTLI_DCHECK(candidate < ip);
+
+ table[hash] = (int)(ip - base_ip);
+ } while (BROTLI_PREDICT_TRUE(!IsMatch(ip, candidate, min_match)));
+
+ /* Check copy distance. If candidate is not feasible, continue search.
+ Checking is done outside of hot loop to reduce overhead. */
+ if (ip - candidate > MAX_DISTANCE) goto trawl;
+
+ /* Step 2: Emit the found match together with the literal bytes from
+ "next_emit", and then see if we can find a next match immediately
+ afterwards. Repeat until we find no match for the input
+ without emitting some literal bytes. */
+
+ {
+ /* We have a 6-byte match at ip, and we need to emit bytes in
+ [next_emit, ip). */
+ const uint8_t* base = ip;
+ size_t matched = min_match + FindMatchLengthWithLimit(
+ candidate + min_match, ip + min_match,
+ (size_t)(ip_end - ip) - min_match);
+ int distance = (int)(base - candidate); /* > 0 */
+ int insert = (int)(base - next_emit);
+ ip += matched;
+ BROTLI_DCHECK(0 == memcmp(base, candidate, matched));
+ EmitInsertLen((uint32_t)insert, commands);
+ memcpy(*literals, next_emit, (size_t)insert);
+ *literals += insert;
+ if (distance == last_distance) {
+ **commands = 64;
+ ++(*commands);
+ } else {
+ EmitDistance((uint32_t)distance, commands);
+ last_distance = distance;
+ }
+ EmitCopyLenLastDistance(matched, commands);
+
+ next_emit = ip;
+ if (BROTLI_PREDICT_FALSE(ip >= ip_limit)) {
+ goto emit_remainder;
+ }
+ {
+ /* We could immediately start working at ip now, but to improve
+ compression we first update "table" with the hashes of some
+ positions within the last copy. */
+ uint64_t input_bytes;
+ uint32_t cur_hash;
+ uint32_t prev_hash;
+ if (min_match == 4) {
+ input_bytes = BROTLI_UNALIGNED_LOAD64LE(ip - 3);
+ cur_hash = HashBytesAtOffset(input_bytes, 3, shift, min_match);
+ prev_hash = HashBytesAtOffset(input_bytes, 0, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 3);
+ prev_hash = HashBytesAtOffset(input_bytes, 1, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 2);
+ prev_hash = HashBytesAtOffset(input_bytes, 0, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 1);
+ } else {
+ input_bytes = BROTLI_UNALIGNED_LOAD64LE(ip - 5);
+ prev_hash = HashBytesAtOffset(input_bytes, 0, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 5);
+ prev_hash = HashBytesAtOffset(input_bytes, 1, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 4);
+ prev_hash = HashBytesAtOffset(input_bytes, 2, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 3);
+ input_bytes = BROTLI_UNALIGNED_LOAD64LE(ip - 2);
+ cur_hash = HashBytesAtOffset(input_bytes, 2, shift, min_match);
+ prev_hash = HashBytesAtOffset(input_bytes, 0, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 2);
+ prev_hash = HashBytesAtOffset(input_bytes, 1, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 1);
+ }
+
+ candidate = base_ip + table[cur_hash];
+ table[cur_hash] = (int)(ip - base_ip);
+ }
+ }
+
+ while (ip - candidate <= MAX_DISTANCE &&
+ IsMatch(ip, candidate, min_match)) {
+ /* We have a 6-byte match at ip, and no need to emit any
+ literal bytes prior to ip. */
+ const uint8_t* base = ip;
+ size_t matched = min_match + FindMatchLengthWithLimit(
+ candidate + min_match, ip + min_match,
+ (size_t)(ip_end - ip) - min_match);
+ ip += matched;
+ last_distance = (int)(base - candidate); /* > 0 */
+ BROTLI_DCHECK(0 == memcmp(base, candidate, matched));
+ EmitCopyLen(matched, commands);
+ EmitDistance((uint32_t)last_distance, commands);
+
+ next_emit = ip;
+ if (BROTLI_PREDICT_FALSE(ip >= ip_limit)) {
+ goto emit_remainder;
+ }
+ {
+ /* We could immediately start working at ip now, but to improve
+ compression we first update "table" with the hashes of some
+ positions within the last copy. */
+ uint64_t input_bytes;
+ uint32_t cur_hash;
+ uint32_t prev_hash;
+ if (min_match == 4) {
+ input_bytes = BROTLI_UNALIGNED_LOAD64LE(ip - 3);
+ cur_hash = HashBytesAtOffset(input_bytes, 3, shift, min_match);
+ prev_hash = HashBytesAtOffset(input_bytes, 0, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 3);
+ prev_hash = HashBytesAtOffset(input_bytes, 1, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 2);
+ prev_hash = HashBytesAtOffset(input_bytes, 2, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 1);
+ } else {
+ input_bytes = BROTLI_UNALIGNED_LOAD64LE(ip - 5);
+ prev_hash = HashBytesAtOffset(input_bytes, 0, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 5);
+ prev_hash = HashBytesAtOffset(input_bytes, 1, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 4);
+ prev_hash = HashBytesAtOffset(input_bytes, 2, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 3);
+ input_bytes = BROTLI_UNALIGNED_LOAD64LE(ip - 2);
+ cur_hash = HashBytesAtOffset(input_bytes, 2, shift, min_match);
+ prev_hash = HashBytesAtOffset(input_bytes, 0, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 2);
+ prev_hash = HashBytesAtOffset(input_bytes, 1, shift, min_match);
+ table[prev_hash] = (int)(ip - base_ip - 1);
+ }
+
+ candidate = base_ip + table[cur_hash];
+ table[cur_hash] = (int)(ip - base_ip);
+ }
+ }
+
+ next_hash = Hash(++ip, shift, min_match);
+ }
+ }
+
+emit_remainder:
+ BROTLI_DCHECK(next_emit <= ip_end);
+ /* Emit the remaining bytes as literals. */
+ if (next_emit < ip_end) {
+ const uint32_t insert = (uint32_t)(ip_end - next_emit);
+ EmitInsertLen(insert, commands);
+ memcpy(*literals, next_emit, insert);
+ *literals += insert;
+ }
+}
+
+static void StoreCommands(MemoryManager* m,
+ const uint8_t* literals, const size_t num_literals,
+ const uint32_t* commands, const size_t num_commands,
+ size_t* storage_ix, uint8_t* storage) {
+ static const uint32_t kNumExtraBits[128] = {
+ 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 12, 14, 24,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 24,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8,
+ 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16,
+ 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24,
+ };
+ static const uint32_t kInsertOffset[24] = {
+ 0, 1, 2, 3, 4, 5, 6, 8, 10, 14, 18, 26, 34, 50, 66, 98, 130, 194, 322, 578,
+ 1090, 2114, 6210, 22594,
+ };
+
+ uint8_t lit_depths[256];
+ uint16_t lit_bits[256];
+ uint32_t lit_histo[256] = { 0 };
+ uint8_t cmd_depths[128] = { 0 };
+ uint16_t cmd_bits[128] = { 0 };
+ uint32_t cmd_histo[128] = { 0 };
+ size_t i;
+ for (i = 0; i < num_literals; ++i) {
+ ++lit_histo[literals[i]];
+ }
+ BrotliBuildAndStoreHuffmanTreeFast(m, lit_histo, num_literals,
+ /* max_bits = */ 8,
+ lit_depths, lit_bits,
+ storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+
+ for (i = 0; i < num_commands; ++i) {
+ const uint32_t code = commands[i] & 0xFF;
+ BROTLI_DCHECK(code < 128);
+ ++cmd_histo[code];
+ }
+ cmd_histo[1] += 1;
+ cmd_histo[2] += 1;
+ cmd_histo[64] += 1;
+ cmd_histo[84] += 1;
+ BuildAndStoreCommandPrefixCode(cmd_histo, cmd_depths, cmd_bits,
+ storage_ix, storage);
+
+ for (i = 0; i < num_commands; ++i) {
+ const uint32_t cmd = commands[i];
+ const uint32_t code = cmd & 0xFF;
+ const uint32_t extra = cmd >> 8;
+ BROTLI_DCHECK(code < 128);
+ BrotliWriteBits(cmd_depths[code], cmd_bits[code], storage_ix, storage);
+ BrotliWriteBits(kNumExtraBits[code], extra, storage_ix, storage);
+ if (code < 24) {
+ const uint32_t insert = kInsertOffset[code] + extra;
+ uint32_t j;
+ for (j = 0; j < insert; ++j) {
+ const uint8_t lit = *literals;
+ BrotliWriteBits(lit_depths[lit], lit_bits[lit], storage_ix, storage);
+ ++literals;
+ }
+ }
+ }
+}
+
+/* Acceptable loss for uncompressible speedup is 2% */
+#define MIN_RATIO 0.98
+#define SAMPLE_RATE 43
+
+static BROTLI_BOOL ShouldCompress(
+ const uint8_t* input, size_t input_size, size_t num_literals) {
+ double corpus_size = (double)input_size;
+ if (num_literals < MIN_RATIO * corpus_size) {
+ return BROTLI_TRUE;
+ } else {
+ uint32_t literal_histo[256] = { 0 };
+ const double max_total_bit_cost = corpus_size * 8 * MIN_RATIO / SAMPLE_RATE;
+ size_t i;
+ for (i = 0; i < input_size; i += SAMPLE_RATE) {
+ ++literal_histo[input[i]];
+ }
+ return TO_BROTLI_BOOL(BitsEntropy(literal_histo, 256) < max_total_bit_cost);
+ }
+}
+
+static void RewindBitPosition(const size_t new_storage_ix,
+ size_t* storage_ix, uint8_t* storage) {
+ const size_t bitpos = new_storage_ix & 7;
+ const size_t mask = (1u << bitpos) - 1;
+ storage[new_storage_ix >> 3] &= (uint8_t)mask;
+ *storage_ix = new_storage_ix;
+}
+
+static void EmitUncompressedMetaBlock(const uint8_t* input, size_t input_size,
+ size_t* storage_ix, uint8_t* storage) {
+ BrotliStoreMetaBlockHeader(input_size, 1, storage_ix, storage);
+ *storage_ix = (*storage_ix + 7u) & ~7u;
+ memcpy(&storage[*storage_ix >> 3], input, input_size);
+ *storage_ix += input_size << 3;
+ storage[*storage_ix >> 3] = 0;
+}
+
+static BROTLI_INLINE void BrotliCompressFragmentTwoPassImpl(
+ MemoryManager* m, const uint8_t* input, size_t input_size,
+ BROTLI_BOOL is_last, uint32_t* command_buf, uint8_t* literal_buf,
+ int* table, size_t table_bits, size_t min_match,
+ size_t* storage_ix, uint8_t* storage) {
+ /* Save the start of the first block for position and distance computations.
+ */
+ const uint8_t* base_ip = input;
+ BROTLI_UNUSED(is_last);
+
+ while (input_size > 0) {
+ size_t block_size =
+ BROTLI_MIN(size_t, input_size, kCompressFragmentTwoPassBlockSize);
+ uint32_t* commands = command_buf;
+ uint8_t* literals = literal_buf;
+ size_t num_literals;
+ CreateCommands(input, block_size, input_size, base_ip, table,
+ table_bits, min_match, &literals, &commands);
+ num_literals = (size_t)(literals - literal_buf);
+ if (ShouldCompress(input, block_size, num_literals)) {
+ const size_t num_commands = (size_t)(commands - command_buf);
+ BrotliStoreMetaBlockHeader(block_size, 0, storage_ix, storage);
+ /* No block splits, no contexts. */
+ BrotliWriteBits(13, 0, storage_ix, storage);
+ StoreCommands(m, literal_buf, num_literals, command_buf, num_commands,
+ storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ } else {
+ /* Since we did not find many backward references and the entropy of
+ the data is close to 8 bits, we can simply emit an uncompressed block.
+ This makes compression speed of uncompressible data about 3x faster. */
+ EmitUncompressedMetaBlock(input, block_size, storage_ix, storage);
+ }
+ input += block_size;
+ input_size -= block_size;
+ }
+}
+
+#define FOR_TABLE_BITS_(X) \
+ X(8) X(9) X(10) X(11) X(12) X(13) X(14) X(15) X(16) X(17)
+
+#define BAKE_METHOD_PARAM_(B) \
+static BROTLI_NOINLINE void BrotliCompressFragmentTwoPassImpl ## B( \
+ MemoryManager* m, const uint8_t* input, size_t input_size, \
+ BROTLI_BOOL is_last, uint32_t* command_buf, uint8_t* literal_buf, \
+ int* table, size_t* storage_ix, uint8_t* storage) { \
+ size_t min_match = (B <= 15) ? 4 : 6; \
+ BrotliCompressFragmentTwoPassImpl(m, input, input_size, is_last, command_buf,\
+ literal_buf, table, B, min_match, storage_ix, storage); \
+}
+FOR_TABLE_BITS_(BAKE_METHOD_PARAM_)
+#undef BAKE_METHOD_PARAM_
+
+void BrotliCompressFragmentTwoPass(
+ MemoryManager* m, const uint8_t* input, size_t input_size,
+ BROTLI_BOOL is_last, uint32_t* command_buf, uint8_t* literal_buf,
+ int* table, size_t table_size, size_t* storage_ix, uint8_t* storage) {
+ const size_t initial_storage_ix = *storage_ix;
+ const size_t table_bits = Log2FloorNonZero(table_size);
+ switch (table_bits) {
+#define CASE_(B) \
+ case B: \
+ BrotliCompressFragmentTwoPassImpl ## B( \
+ m, input, input_size, is_last, command_buf, \
+ literal_buf, table, storage_ix, storage); \
+ break;
+ FOR_TABLE_BITS_(CASE_)
+#undef CASE_
+ default: BROTLI_DCHECK(0); break;
+ }
+
+ /* If output is larger than single uncompressed block, rewrite it. */
+ if (*storage_ix - initial_storage_ix > 31 + (input_size << 3)) {
+ RewindBitPosition(initial_storage_ix, storage_ix, storage);
+ EmitUncompressedMetaBlock(input, input_size, storage_ix, storage);
+ }
+
+ if (is_last) {
+ BrotliWriteBits(1, 1, storage_ix, storage); /* islast */
+ BrotliWriteBits(1, 1, storage_ix, storage); /* isempty */
+ *storage_ix = (*storage_ix + 7u) & ~7u;
+ }
+}
+
+#undef FOR_TABLE_BITS_
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment_two_pass.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment_two_pass.h
new file mode 100644
index 000000000..928677df4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/compress_fragment_two_pass.h
@@ -0,0 +1,54 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Function for fast encoding of an input fragment, independently from the input
+ history. This function uses two-pass processing: in the first pass we save
+ the found backward matches and literal bytes into a buffer, and in the
+ second pass we emit them into the bit stream using prefix codes built based
+ on the actual command and literal byte histograms. */
+
+#ifndef BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_
+#define BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./memory.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+static const size_t kCompressFragmentTwoPassBlockSize = 1 << 17;
+
+/* Compresses "input" string to the "*storage" buffer as one or more complete
+ meta-blocks, and updates the "*storage_ix" bit position.
+
+ If "is_last" is 1, emits an additional empty last meta-block.
+
+ REQUIRES: "input_size" is greater than zero, or "is_last" is 1.
+ REQUIRES: "input_size" is less or equal to maximal metablock size (1 << 24).
+ REQUIRES: "command_buf" and "literal_buf" point to at least
+ kCompressFragmentTwoPassBlockSize long arrays.
+ REQUIRES: All elements in "table[0..table_size-1]" are initialized to zero.
+ REQUIRES: "table_size" is a power of two
+ OUTPUT: maximal copy distance <= |input_size|
+ OUTPUT: maximal copy distance <= BROTLI_MAX_BACKWARD_LIMIT(18) */
+BROTLI_INTERNAL void BrotliCompressFragmentTwoPass(MemoryManager* m,
+ const uint8_t* input,
+ size_t input_size,
+ BROTLI_BOOL is_last,
+ uint32_t* command_buf,
+ uint8_t* literal_buf,
+ int* table,
+ size_t table_size,
+ size_t* storage_ix,
+ uint8_t* storage);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/dictionary_hash.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/dictionary_hash.c
new file mode 100644
index 000000000..16d853fe5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/dictionary_hash.c
@@ -0,0 +1,1846 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Hash table on the 4-byte prefixes of static dictionary words. */
+
+#include "../common/platform.h"
+#include "./dictionary_hash.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+BROTLI_INTERNAL const uint16_t kStaticDictionaryHashWords[32768] = {
+1002,0,0,0,0,0,0,0,0,683,0,0,0,0,0,0,0,1265,0,0,0,0,0,1431,0,0,0,0,0,0,40,0,0,0,
+0,155,8,741,0,624,0,0,0,0,0,0,0,0,0,0,0,0,66,503,0,0,0,451,0,0,0,0,0,0,0,835,70,
+0,0,539,0,0,0,0,0,0,0,0,0,113,0,0,0,0,718,0,0,0,0,0,0,520,0,1070,0,0,0,0,0,1515,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,610,0,0,750,0,0,0,307,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,964,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,999,0,0,0,0,0,0,0,0,
+645,75,0,649,52,282,0,200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1621,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,211,225,0,0,687,718,0,0,110,0,58,0,0,0,0,0,0,345,0,0,301,0,0,
+0,203,0,0,1154,674,1949,0,0,0,0,0,0,0,0,0,259,0,0,0,0,0,0,0,1275,0,0,0,1231,254,
+0,0,0,0,0,0,0,277,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,0,0,800,0,0,0,29,
+116,100,490,0,0,0,0,0,1641,0,543,0,0,0,0,41,181,0,657,0,0,202,25,0,0,0,0,0,0,0,
+0,0,0,423,0,0,0,113,0,0,0,927,963,0,976,0,206,0,0,0,0,0,0,0,0,0,2002,0,0,0,0,0,
+0,0,0,0,0,0,696,0,1170,0,0,0,0,226,13,0,769,678,551,0,0,0,0,0,0,57,0,0,0,10,188,
+0,0,0,624,0,0,0,0,0,0,0,0,0,1941,130,0,0,0,0,378,269,0,0,528,0,1146,0,0,0,1105,
+0,1616,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,656,0,1940,0,0,0,0,0,173,0,0,0,0,0,0,0,0,0,
+0,0,457,342,810,0,0,0,0,620,0,0,0,0,0,0,0,967,95,447,406,0,0,0,477,0,1268,944,
+1941,0,0,0,629,0,0,0,0,0,375,0,0,0,1636,0,0,0,0,774,0,1,1034,0,0,0,0,0,824,0,0,
+0,0,0,118,0,0,560,296,0,0,0,0,0,0,0,0,1009,894,0,0,0,0,0,0,0,0,0,0,0,0,0,1474,
+366,0,0,0,0,0,0,0,0,0,79,1723,0,0,200,0,0,0,0,0,0,0,0,1759,372,0,16,0,943,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,258,0,0,900,1839,707,30,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,2004,0,0,10,115,0,50,0,0,0,0,0,0,0,0,0,0,520,1,0,738,98,482,0,0,0,0,
+0,0,0,0,0,0,701,2,0,0,0,0,0,0,0,0,557,0,0,0,0,0,0,0,0,0,347,0,0,0,0,572,0,0,0,0,
+0,0,0,0,0,832,0,0,797,809,0,0,0,0,0,0,0,0,0,0,0,528,0,0,0,861,0,0,294,0,0,0,109,
+0,0,0,0,0,0,0,0,1187,290,266,0,0,0,0,49,50,748,0,0,466,399,0,0,0,0,0,0,0,378,0,
+519,0,0,0,0,0,0,0,0,0,0,0,0,667,351,902,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,180,
+0,0,869,0,0,0,0,0,0,0,260,0,0,0,0,0,0,0,0,0,0,523,36,0,0,587,510,809,29,260,0,0,
+0,0,0,0,0,0,570,0,565,0,1464,0,0,0,0,0,0,10,0,0,787,399,380,200,0,0,0,0,516,0,
+844,887,0,0,0,0,0,0,0,44,0,0,0,305,1655,0,0,0,0,0,0,0,0,0,0,0,0,0,0,786,10,0,0,
+0,0,0,0,0,0,0,2031,0,0,0,0,0,684,0,0,0,0,0,1480,0,0,0,27,0,0,0,395,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,813,511,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,0,0,0,206,
+496,0,0,0,0,0,909,0,891,0,0,0,0,0,0,0,0,0,687,0,0,0,1342,0,0,0,0,0,0,0,0,0,0,
+160,41,0,0,0,0,0,0,0,0,0,0,0,1718,778,0,0,0,0,0,0,0,0,0,0,1610,0,0,0,0,0,115,0,
+0,0,0,314,294,0,0,0,983,178,193,0,0,0,0,0,0,0,0,0,174,0,0,0,0,0,0,0,0,0,0,848,
+1796,0,0,0,0,0,0,221,0,687,1660,0,0,0,0,262,0,0,179,0,0,0,0,0,66,0,773,0,352,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,0,152,0,0,1197,0,0,0,0,0,0,0,0,0,0,0,0,560,0,0,
+564,0,0,0,797,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,556,0,819,0,0,0,0,0,0,0,0,719,544,
+637,5,0,0,0,0,0,0,0,0,0,0,0,101,0,1441,0,0,0,893,0,0,0,0,0,0,0,0,0,238,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,1296,0,0,969,1729,314,60,0,0,0,0,0,1144,0,1147,0,0,0,0,0,
+0,0,0,0,0,437,1853,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,828,0,176,0,0,0,0,0,0,434,39,0,
+0,0,0,0,159,0,0,0,902,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,270,0,0,0,0,801,556,0,0,
+0,0,0,0,0,416,19,197,369,0,0,0,0,0,0,0,0,0,28,34,0,757,0,0,898,1553,0,721,0,0,0,
+0,1012,0,0,0,0,1102,0,898,183,0,0,0,0,0,0,0,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,247,277,0,0,0,435,0,0,0,0,0,1311,0,0,0,0,
+0,0,211,437,0,0,0,28,0,0,750,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2012,0,702,
+0,808,0,0,0,0,739,166,0,0,0,0,0,0,719,170,500,0,0,0,0,0,0,0,0,1500,327,0,0,450,
+0,0,0,1318,0,0,0,1602,0,0,331,754,0,0,0,0,0,1368,0,0,557,0,0,0,799,850,0,0,0,0,
+0,0,0,0,908,0,0,0,0,0,19,62,459,0,0,0,0,0,0,0,0,0,0,0,0,1802,0,0,0,0,0,0,0,0,0,
+1397,0,0,0,0,120,238,0,0,0,0,0,0,0,0,0,0,0,1324,0,0,0,0,0,0,0,0,602,201,0,0,164,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,615,0,0,0,0,0,0,0,0,0,0,0,0,0,1243,0,0,0,0,968,0,0,
+0,0,0,0,882,0,0,0,907,329,100,0,0,0,0,0,0,0,0,0,0,0,176,26,9,0,0,265,256,0,0,0,
+0,0,0,0,0,0,643,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,610,0,0,0,0,973,2001,0,
+0,0,0,0,0,522,0,0,0,0,0,0,0,0,0,0,0,553,0,0,0,0,0,0,1582,0,1578,0,0,0,0,0,0,0,0,
+0,0,0,795,0,0,0,432,0,0,0,0,0,0,84,126,0,0,0,0,790,0,377,64,0,1529,0,0,0,0,530,
+1857,539,1104,0,0,0,0,0,0,0,0,0,0,0,0,977,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,24,26,
+0,0,918,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,183,379,0,0,0,0,0,0,0,792,
+0,0,0,0,0,0,0,0,0,1920,0,0,0,0,0,0,0,0,0,771,0,0,0,1979,0,901,254,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,140,0,0,0,0,0,440,37,0,
+508,0,0,0,513,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,533,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,752,920,0,1048,0,153,0,
+0,391,0,0,1952,0,0,0,0,0,0,0,0,0,0,126,0,0,0,0,640,0,483,69,1616,0,0,0,0,0,734,
+0,0,0,0,0,0,480,0,495,0,472,0,0,0,0,0,0,0,0,874,229,0,0,0,0,948,0,0,0,0,0,0,0,0,
+1009,748,0,555,0,0,0,0,0,0,193,0,653,0,0,0,0,0,0,0,0,0,0,984,0,0,0,172,0,0,0,0,
+0,0,0,0,83,1568,0,0,384,0,0,0,0,0,0,0,164,880,0,0,0,0,0,0,0,0,0,0,0,367,121,0,0,
+828,0,0,0,0,0,0,0,1541,0,0,0,0,0,0,0,343,0,0,0,0,0,0,0,0,561,57,0,0,0,0,0,0,0,
+926,0,0,0,0,827,0,194,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,0,0,0,0,0,0,0,
+0,0,0,896,1249,0,0,0,0,0,1614,0,0,0,860,0,0,0,0,0,0,0,0,964,102,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,899,0,569,0,0,0,0,795,2045,0,0,0,
+0,0,0,104,52,0,0,0,0,0,604,0,0,0,0,779,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,
+494,0,677,0,0,0,0,0,0,0,508,0,0,0,0,0,0,0,0,0,1014,0,957,0,0,630,310,0,0,0,570,
+0,0,449,0,64,537,0,0,0,0,0,0,0,244,0,0,0,0,0,0,0,0,0,0,0,0,0,0,702,1650,49,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,338,0,0,0,0,1279,0,0,0,0,0,0,0,896,0,0,
+178,0,0,0,0,0,0,0,0,0,0,0,0,0,808,695,0,0,0,0,539,1117,0,0,0,0,0,0,0,0,257,0,
+1003,0,0,0,1,448,0,516,0,0,960,0,125,4,0,1268,30,748,0,0,852,0,0,0,6,0,0,848,
+236,1385,862,1811,0,0,0,0,698,803,0,0,0,0,0,0,0,610,992,0,0,878,0,1847,0,0,0,0,
+0,0,0,383,0,1404,0,0,0,0,986,0,347,0,0,0,0,0,0,0,0,0,0,0,592,572,0,1411,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,606,0,0,0,0,0,0,
+0,0,0,0,0,0,0,1829,0,0,0,0,0,0,0,0,0,0,0,0,700,748,0,0,0,0,0,0,365,0,0,127,0,0,
+83,198,0,0,0,0,0,0,864,55,0,0,0,0,726,1752,0,0,0,0,0,0,0,0,0,0,0,0,0,1066,0,764,
+0,0,0,0,683,0,550,309,0,0,874,1212,0,0,0,1364,0,986,381,723,0,0,0,1573,0,0,0,0,
+0,1025,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1559,0,0,0,0,493,133,0,0,0,0,148,
+119,0,0,0,0,0,0,537,14,541,0,635,126,0,0,0,495,0,0,0,0,861,998,1009,0,0,0,0,0,0,
+0,359,368,0,0,0,0,304,1577,0,0,0,0,0,1107,0,0,0,0,0,929,0,0,0,1142,0,0,0,0,289,
+175,0,432,0,219,0,0,0,0,0,785,0,0,595,0,0,0,0,0,0,0,0,0,0,0,0,0,80,0,0,0,0,0,0,
+931,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1323,0,0,0,0,290,0,559,1751,127,0,0,0,
+934,1167,0,963,0,260,0,0,0,573,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+580,1689,0,0,0,0,0,0,0,0,0,1164,0,0,982,1922,0,63,0,0,0,0,0,793,0,0,0,0,0,0,0,0,
+0,0,0,0,0,67,790,0,0,0,0,0,0,0,0,0,0,391,443,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,271,0,0,0,0,0,0,0,0,0,0,0,1140,0,0,0,0,340,300,0,897,0,0,0,0,0,0,
+0,0,0,0,890,0,0,0,0,818,321,53,0,0,0,0,0,0,0,0,0,468,0,243,0,870,0,0,0,1765,121,
+0,0,0,180,518,0,822,419,634,0,0,0,0,0,0,0,0,0,898,0,0,0,0,454,36,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,806,0,0,0,0,0,0,0,0,0,0,0,0,1326,0,104,0,0,0,0,0,0,0,
+0,0,260,0,0,0,0,0,0,0,0,0,0,0,0,542,45,0,0,263,1516,42,0,0,0,0,0,468,0,1005,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,288,87,0,0,0,0,0,0,0,0,502,988,133,0,0,0,0,0,0,
+141,0,0,872,1842,0,0,0,0,0,0,0,0,261,619,0,0,0,0,189,246,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,678,0,0,0,0,0,0,0,0,0,0,0,0,285,35,0,517,0,0,0,0,0,0,0,0,0,0,
+540,214,667,0,74,0,0,125,0,0,0,0,0,761,131,0,0,0,0,0,0,0,0,0,0,0,0,0,333,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1338,94,0,0,0,0,0,0,0,0,0,0,0,0,449,0,646,103,
+86,641,2028,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,869,87,277,117,39,0,0,0,0,0,0,0,0,938,
+297,0,0,0,0,558,464,0,0,0,0,0,0,0,0,0,0,731,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1608,0,
+0,0,0,0,0,0,1429,0,0,733,1010,0,0,338,1656,0,0,0,1038,979,2010,0,0,0,0,0,0,0,
+1005,0,0,121,0,0,0,219,20,0,0,0,0,0,0,872,1440,0,0,0,683,0,1070,0,0,522,0,0,0,0,
+439,669,0,0,0,0,0,0,0,0,1245,0,0,0,0,0,1218,0,0,547,233,0,0,0,0,0,0,0,0,0,482,0,
+0,0,0,0,0,0,886,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,795,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,371,0,0,0,0,0,0,0,0,0,0,0,0,0,622,0,625,0,0,0,339,29,0,0,338,0,0,0,
+0,130,0,0,0,0,0,0,0,0,0,307,0,0,0,0,0,0,0,0,0,0,2044,0,0,0,0,0,0,0,0,308,770,0,
+0,0,0,0,1266,0,0,0,0,0,0,0,0,0,400,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,690,739,0,0,
+0,0,0,0,0,990,0,0,0,1831,0,0,0,0,0,0,0,0,0,0,0,0,0,613,0,0,0,0,0,0,0,0,0,0,0,0,
+0,763,0,878,0,0,0,977,0,100,0,0,0,0,0,0,0,0,0,463,0,0,0,0,623,318,0,0,296,463,
+137,0,0,454,0,0,0,1527,58,0,0,0,0,0,0,0,18,48,0,0,0,0,0,729,0,0,0,442,0,0,0,0,
+40,449,0,853,0,0,0,0,0,0,227,0,0,0,0,0,0,1491,0,0,0,0,0,0,0,0,0,0,161,55,0,450,
+0,1174,62,0,207,0,0,0,0,0,0,0,0,869,0,0,0,0,80,213,0,0,0,0,0,0,0,0,0,0,354,820,
+0,0,747,0,0,0,954,0,0,1073,0,556,0,0,0,692,0,191,0,804,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,831,162,0,0,35,0,0,0,0,0,0,0,0,1235,0,0,0,0,0,1234,0,0,
+0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,149,0,0,0,902,204,0,0,833,0,287,366,0,0,0,0,0,
+0,992,2020,0,0,0,0,0,0,0,0,0,0,0,356,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,784,0,0,567,
+630,0,0,0,539,0,0,27,0,0,0,0,0,0,0,0,0,0,755,0,0,0,0,0,0,0,0,0,0,0,0,814,0,0,0,
+0,0,0,0,0,0,0,0,0,0,987,0,0,255,761,194,0,1086,0,0,0,0,0,0,1016,0,0,1396,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,562,271,913,0,0,0,0,0,0,0,0,320,153,45,475,0,0,
+0,0,0,0,0,713,0,327,0,0,0,0,0,0,604,552,3,359,0,0,0,0,853,80,0,0,0,0,0,0,0,2016,
+6,887,0,0,0,0,975,0,961,0,0,0,0,0,916,1891,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,100,101,390,708,0,0,0,587,983,512,0,0,0,0,0,0,0,0,0,0,0,645,0,0,0,851,0,0,0,
+0,0,498,140,217,0,0,0,1448,0,0,0,0,0,0,0,0,0,905,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+643,105,0,792,0,0,0,0,0,0,0,0,0,0,0,0,56,0,0,0,0,0,0,0,0,0,0,535,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1748,0,0,0,0,0,754,0,0,0,0,0,0,0,0,0,0,0,0,91,0,0,1565,0,91,792,
+939,3,370,0,0,0,0,95,0,0,0,0,551,7,619,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1150,0,
+0,0,0,0,0,0,0,0,0,0,0,0,671,0,0,0,0,0,888,368,149,0,0,105,1134,0,983,0,0,458,31,
+0,643,0,0,0,312,0,740,0,0,0,1642,0,0,0,0,0,0,0,236,0,0,0,0,0,0,0,59,68,0,0,0,0,
+0,867,795,0,0,0,0,970,1977,0,0,0,0,0,0,0,1148,0,775,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,970,0,0,0,0,0,0,0,0,0,665,71,0,0,0,0,827,0,0,0,0,0,0,0,0,0,
+0,479,0,0,0,0,0,0,0,0,99,607,0,0,0,0,0,0,0,1960,0,0,0,793,0,0,871,41,0,0,241,94,
+0,0,0,0,209,0,0,1497,0,0,0,0,0,0,0,0,0,98,0,0,0,463,0,0,0,0,291,0,0,0,0,0,0,0,0,
+0,0,984,0,0,0,0,0,205,0,0,0,0,0,0,205,42,0,801,0,0,0,0,0,635,0,0,533,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,371,0,1282,0,0,0,825,0,0,0,0,0,0,0,0,0,357,879,467,0,317,0,0,
+0,0,0,0,0,924,0,0,0,0,849,1795,0,0,0,0,895,1799,43,0,0,0,0,0,0,0,0,0,0,1820,0,0,
+0,0,0,0,0,525,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,0,493,0,174,417,0,0,
+0,0,0,583,733,0,0,0,0,0,0,481,215,0,0,0,0,477,0,0,0,0,0,0,0,0,308,0,0,0,0,0,0,0,
+0,297,126,0,0,361,1551,0,0,0,0,0,0,871,1807,0,0,0,0,0,1307,0,685,0,0,0,0,0,0,0,
+797,0,858,0,565,0,0,0,0,0,0,0,0,0,0,0,0,434,252,826,0,0,0,0,0,0,791,0,0,0,0,509,
+231,178,601,0,0,0,0,0,0,0,0,43,1591,0,0,0,0,0,1683,0,0,0,0,45,0,0,0,0,0,0,0,0,0,
+0,1120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,556,494,0,398,0,0,0,1030,0,0,0,0,0,0,
+168,0,0,0,0,0,0,0,0,0,0,973,0,642,0,0,0,0,0,0,0,0,0,1615,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,378,594,0,1093,0,679,112,0,0,0,0,1492,540,1374,714,
+1486,0,0,0,0,825,1511,0,0,0,0,0,0,0,0,0,0,0,0,0,952,0,0,736,143,0,700,0,1540,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1557,0,0,0,860,990,0,0,0,807,0,0,0,0,0,131,
+515,0,646,0,0,0,0,117,728,508,121,0,0,0,0,0,0,357,0,0,0,0,0,0,237,0,0,0,0,0,0,0,
+0,0,1784,0,0,0,0,0,0,0,0,0,0,0,713,348,1536,0,738,0,0,0,0,0,0,0,434,0,0,0,0,0,0,
+366,1877,39,0,0,0,0,0,0,580,0,0,0,0,0,0,0,0,0,0,0,0,0,0,873,0,0,0,0,171,0,625,
+550,107,343,943,0,0,0,0,0,0,0,768,0,0,0,0,0,0,0,799,0,0,0,894,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1673,0,0,0,0,0,0,0,0,0,0,0,1052,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+272,0,441,0,0,3,9,0,0,0,1182,0,1346,0,0,0,0,0,0,0,0,682,0,0,1004,24,0,0,968,0,0,
+0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,185,0,0,0,578,
+474,0,0,0,0,0,0,0,0,0,0,0,0,0,0,113,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,556,0,0,0,0,0,0,16,1317,0,0,97,0,0,0,703,0,0,0,0,0,0,0,0,892,0,0,0,1571,0,0,
+426,186,0,1101,0,0,0,0,0,0,0,0,937,585,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,644,291,
+0,0,0,0,749,0,162,0,0,381,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,762,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,628,21,0,0,0,0,0,0,0,0,919,0,0,0,0,0,0,0,0,0,
+633,0,0,0,0,332,0,0,0,0,0,0,0,0,0,1489,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,832,398,0,645,0,0,0,13,0,0,0,0,0,0,0,0,0,0,20,0,800,0,0,0,0,0,0,0,0,0,
+0,0,0,0,1993,0,0,0,0,769,0,0,0,665,0,0,0,0,0,0,0,0,0,0,1426,0,0,0,0,60,0,0,0,
+641,1874,0,644,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1757,0,0,0,0,0,937,0,1652,0,654,0,
+0,0,0,0,0,0,527,0,0,0,0,0,0,0,0,0,0,0,0,0,226,0,0,0,0,0,1486,0,0,0,0,0,0,0,0,0,
+0,0,325,0,0,0,0,0,0,0,1345,0,0,91,0,404,0,0,0,0,0,0,0,0,0,0,0,0,973,0,0,0,0,0,0,
+0,1176,0,549,0,0,0,0,0,0,0,0,0,0,976,0,0,0,0,0,21,0,0,0,0,0,51,0,0,0,0,314,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,198,6,0,1093,0,0,0,0,0,0,0,0,0,
+0,0,0,0,1776,0,0,0,0,0,1528,0,419,0,0,0,0,0,0,0,0,76,138,0,0,0,0,638,29,0,0,0,0,
+0,0,0,1418,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1710,0,0,0,0,0,
+0,0,0,0,0,0,0,532,23,0,0,0,0,0,0,0,862,0,0,946,592,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,70,0,0,0,0,0,0,0,0,0,812,0,0,0,76,0,0,988,0,442,0,0,0,896,0,0,0,0,0,0,
+483,0,0,0,0,1709,0,0,0,0,0,0,119,0,0,0,117,0,309,0,0,0,0,0,596,976,0,0,0,0,0,0,
+0,0,0,0,0,768,0,0,0,0,0,0,0,0,0,518,0,0,0,0,0,0,0,0,0,0,0,0,0,0,863,0,0,0,24,
+145,1020,0,0,1984,0,0,0,0,0,0,0,658,0,0,0,0,0,0,0,0,0,0,106,1827,0,1010,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,582,87,0,0,0,0,0,0,0,267,0,0,0,703,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,496,0,0,0,0,1121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,249,561,0,0,0,0,0,
+0,0,760,0,0,154,0,0,0,255,0,419,323,0,0,0,0,0,368,0,0,0,0,0,0,0,0,0,0,522,0,0,0,
+0,0,0,0,551,562,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,0,0,0,0,
+0,0,0,284,525,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,958,0,0,594,0,0,0,0,0,0,6,479,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,61,0,0,0,0,0,0,0,820,1641,0,1556,0,0,0,0,0,0,0,302,0,0,
+0,0,0,148,0,0,676,0,0,0,0,0,0,1674,0,0,0,0,0,0,178,0,0,0,0,0,0,0,94,389,0,0,0,0,
+91,8,0,0,0,0,0,0,0,0,0,0,112,0,0,0,0,0,0,0,0,0,0,747,0,0,0,0,0,0,0,1746,0,0,0,0,
+0,24,0,1352,158,1530,0,0,718,130,280,1401,0,0,0,0,0,1946,8,0,0,0,0,1607,0,0,0,0,
+0,0,882,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,417,0,0,0,1597,633,433,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,234,0,0,0,0,0,0,0,0,680,1950,0,0,0,0,249,5,0,0,0,
+0,0,0,0,0,0,1216,0,1773,0,0,0,0,0,0,0,0,0,0,0,0,0,0,509,180,0,0,0,0,0,0,0,1002,
+0,0,0,0,0,0,0,0,0,0,0,0,0,931,0,0,0,0,0,0,0,0,747,943,0,1837,0,0,0,0,0,0,0,641,
+0,0,0,0,280,0,0,0,5,0,0,0,0,0,72,545,0,0,0,0,0,0,0,0,0,742,0,0,254,151,872,0,0,
+0,0,0,0,0,0,0,0,0,0,921,0,0,517,833,0,1680,0,0,436,251,584,0,0,0,0,0,0,0,0,0,0,
+0,24,500,0,0,0,0,0,0,0,0,195,1775,514,389,0,0,0,0,0,0,0,743,0,0,0,0,0,0,292,0,0,
+0,227,1283,774,1805,0,0,0,0,0,0,0,0,0,0,119,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,913,
+1910,0,0,0,1826,490,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1162,700,30,
+0,0,0,721,839,0,0,0,617,0,0,0,0,0,0,0,0,0,169,428,0,0,0,0,0,1648,637,1205,0,0,0,
+1596,0,0,4,266,0,0,0,0,0,0,0,0,0,0,0,862,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,
+0,279,157,391,604,0,0,713,945,877,973,0,0,0,0,0,0,0,0,0,0,0,0,0,0,859,567,628,
+1846,0,0,0,0,0,0,0,0,0,762,0,0,191,0,0,0,0,298,0,0,767,909,0,0,0,0,0,0,0,795,0,
+0,301,0,0,1970,0,0,0,0,0,0,0,0,0,1236,0,0,0,0,0,0,644,369,15,0,160,71,0,0,0,0,0,
+1447,0,0,0,0,0,0,0,0,735,1255,76,0,0,0,0,0,0,0,0,0,0,474,0,0,0,0,0,0,0,0,0,0,
+841,0,0,0,0,0,0,0,0,0,0,836,0,0,0,0,0,1622,0,0,735,0,0,0,0,1601,804,1390,394,0,
+0,0,0,0,0,96,0,289,0,0,35,688,0,0,0,667,0,513,0,0,0,0,0,0,0,2034,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,704,0,1524,0,1078,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,306,
+0,0,0,0,0,0,0,431,0,1196,0,0,54,0,15,1448,0,1418,0,0,0,0,0,0,0,0,0,907,0,0,0,0,
+0,0,194,1767,0,0,0,0,0,840,0,900,0,0,0,0,0,0,0,0,0,0,0,1436,0,0,0,0,642,1560,0,
+0,0,0,0,0,94,386,0,0,0,0,0,0,0,0,0,0,830,416,0,0,20,731,0,0,0,0,0,0,0,0,697,0,0,
+662,0,0,0,0,0,0,0,0,0,861,0,0,0,0,0,0,0,871,671,864,0,928,7,0,332,0,0,0,0,1055,
+0,0,0,0,0,0,986,0,0,0,0,0,44,76,0,0,0,0,0,0,0,0,0,0,300,0,0,0,0,0,0,0,175,518,
+831,1108,0,0,0,836,0,1852,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,843,1804,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,246,0,0,0,610,202,0,0,36,0,0,0,240,654,13,0,0,0,0,0,0,0,
+0,391,0,403,0,0,0,0,0,0,0,0,0,0,75,0,366,815,0,0,631,0,0,0,0,0,0,0,0,345,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,952,0,0,0,0,0,0,0,0,0,0,0,673,35,662,0,287,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,5,34,0,0,0,0,0,0,0,0,151,0,427,0,0,382,0,0,0,329,0,0,279,0,0,0,
+0,0,0,0,0,0,0,906,0,0,366,843,0,1443,0,1372,992,0,36,123,0,649,0,0,0,0,0,767,0,
+1018,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,995,0,0,0,0,0,0,0,72,368,0,0,1345,0,0,0,
+589,0,0,0,0,0,0,0,0,0,1988,0,0,220,541,0,0,0,686,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,32,196,0,0,0,0,0,0,0,0,0,0,0,0,0,381,0,0,0,0,0,0,0,0,0,1452,0,
+0,0,616,0,0,0,0,0,0,0,0,0,1229,0,0,0,0,0,0,0,0,0,0,667,120,0,0,0,0,0,0,0,1146,0,
+0,0,0,0,0,0,0,0,0,0,352,0,0,0,0,0,293,0,0,0,0,0,0,0,0,0,0,0,0,0,935,0,1050,0,
+147,88,0,0,923,0,0,0,0,0,934,0,0,0,0,0,0,0,0,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,341,222,0,0,0,0,0,0,0,0,0,0,293,0,0,0,0,0,0,0,0,0,0,0,0,
+637,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1159,0,0,0,847,0,0,0,0,0,0,683,0,867,944,0,0,
+0,0,0,1809,0,0,0,0,0,0,0,0,0,0,395,170,0,0,0,0,0,0,0,0,0,0,618,535,0,1625,0,0,0,
+0,0,0,0,0,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,778,0,0,0,0,0,46,0,2032,0,0,37,
+1458,0,938,363,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,314,0,0,0,0,0,0,889,0,0,0,0,0,0,0,
+0,0,0,0,462,0,0,0,0,525,0,0,23,0,0,0,0,0,0,0,0,0,0,0,676,0,0,0,0,0,0,0,0,0,0,0,
+0,498,725,0,0,0,0,7,0,0,0,0,773,0,0,0,164,0,0,0,0,0,0,0,0,936,583,659,1462,0,
+220,0,0,0,0,803,0,0,544,119,0,0,0,0,0,0,0,0,0,0,0,181,176,0,1192,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,1878,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,0,0,0,0,0,0,
+944,0,0,0,0,0,0,0,273,0,0,0,0,0,855,0,0,0,0,5,127,0,0,0,0,0,0,0,0,752,230,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,162,0,654,48,156,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,
+0,0,0,0,0,0,0,963,0,0,0,0,0,0,0,0,0,0,858,0,0,0,0,0,0,0,0,0,0,676,1978,0,0,102,
+972,0,0,0,0,0,0,0,361,0,461,0,0,0,472,0,0,0,0,0,0,0,0,0,0,0,0,0,0,747,905,0,0,0,
+155,0,0,0,0,0,0,0,0,0,0,319,163,0,0,0,0,0,0,0,0,0,848,0,0,36,631,0,0,0,0,0,1769,
+0,0,0,0,0,144,0,0,0,0,0,0,0,0,0,0,369,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,555,247,0,0,
+996,0,0,189,0,0,0,0,0,0,0,0,0,0,280,0,0,0,0,0,0,0,0,0,0,0,526,746,0,0,345,0,0,0,
+1017,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,651,428,0,0,0,1162,230,327,546,792,0,0,0,
+1203,0,0,0,0,0,0,0,0,0,672,189,0,0,0,0,0,0,99,0,0,0,298,0,0,0,0,0,0,555,397,0,0,
+0,0,0,1157,0,0,0,0,0,0,0,0,0,0,398,1523,0,366,0,0,787,0,0,0,282,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,157,0,941,0,0,0,0,0,1336,0,0,116,0,0,0,0,0,0,787,0,0,0,0,0,0,0,0,0,
+0,170,160,0,1815,0,0,0,0,0,866,0,0,0,0,0,0,0,0,0,689,0,0,0,0,820,0,498,108,0,0,
+0,1119,0,0,0,244,609,1005,0,581,0,0,0,0,0,895,0,0,0,1898,0,0,0,0,0,926,0,0,0,0,
+0,0,0,0,0,0,0,0,0,538,496,294,301,0,0,0,18,0,0,757,0,0,0,0,0,1263,0,820,0,722,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2028,0,0,0,0,124,1875,0,0,0,881,0,0,0,1348,
+0,0,0,0,0,0,0,911,0,954,0,0,0,0,414,0,0,0,0,517,0,0,0,0,0,816,0,0,0,0,0,0,0,0,
+713,0,0,0,0,0,0,0,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,593,150,0,0,0,0,
+0,553,0,0,0,0,0,0,0,0,0,0,108,0,0,0,0,420,0,0,0,0,0,0,0,0,0,0,0,1777,0,0,55,493,
+0,0,81,0,321,980,0,0,0,0,0,0,0,0,0,0,0,0,0,0,362,112,0,74,0,0,0,0,0,0,0,625,0,0,
+0,0,0,0,377,16,0,0,61,281,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,1031,0,0,0,0,0,0,51,0,
+0,0,0,0,0,0,211,309,15,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,789,173,0,439,9,648,
+0,0,294,0,0,0,0,0,0,0,374,8,0,1099,0,0,0,0,0,0,0,575,0,0,0,518,0,0,0,702,0,0,0,
+0,0,0,87,0,0,0,438,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,464,122,0,0,0,1802,0,0,0,0,
+0,0,499,0,0,0,87,476,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,840,283,0,0,0,0,1620,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,609,1160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,600,
+323,372,0,0,0,0,471,722,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,
+477,1304,0,1774,0,0,88,0,438,12,0,0,0,0,0,0,0,0,671,997,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,639,22,0,0,782,681,0,0,0,0,0,0,0,0,0,0,1013,664,0,942,0,1349,0,0,0,0,0,0,0,
+0,0,0,0,0,356,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,215,289,0,1975,
+109,450,0,0,0,0,0,0,0,0,0,0,705,0,0,664,0,0,0,0,0,0,0,1238,0,0,318,0,0,0,0,0,0,
+0,0,0,0,0,0,0,960,1872,0,0,0,0,0,0,0,0,0,0,0,0,0,0,103,0,0,0,0,0,0,0,0,0,239,
+777,0,26,0,0,0,0,0,0,0,0,0,0,0,0,375,414,0,17,0,0,0,1350,0,955,0,0,0,0,0,0,0,0,
+887,960,0,0,0,0,0,0,0,0,0,0,708,710,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,919,0,0,0,
+0,502,280,7,45,0,0,0,0,777,0,0,0,0,410,0,1110,0,0,0,0,0,0,414,341,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,787,0,0,0,436,0,0,0,0,0,0,0,1707,613,377,96,0,0,0,0,451,
+0,0,0,0,0,0,0,0,0,0,0,0,0,680,0,483,916,0,0,0,0,0,0,937,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,739,0,0,0,0,0,0,0,0,82,0,0,663,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,128,0,0,0,0,0,0,0,0,1087,0,0,0,0,0,0,0,503,0,0,0,0,0,0,9,113,104,324,0,460,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,935,702,434,485,1014,949,423,0,900,
+0,0,0,0,0,0,0,2018,574,0,0,0,0,0,0,0,0,0,0,0,0,1206,0,0,0,0,0,0,0,0,38,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1022,0,0,0,0,143,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,2029,0,0,0,0,0,0,0,0,0,0,0,0,523,0,0,0,0,0,0,625,0,0,425,37,0,0,0,1943,0,0,0,
+0,0,765,0,0,0,0,0,0,0,0,0,0,551,0,0,0,0,0,0,0,0,0,0,0,0,168,0,0,1010,0,0,1994,0,
+0,0,91,0,0,0,0,532,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1884,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,240,15,0,0,0,1227,0,1534,0,0,0,0,0,0,0,0,0,0,0,0,0,0,392,0,
+0,0,0,0,0,0,0,0,0,0,0,655,562,395,0,0,0,501,1019,0,0,0,0,509,267,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1099,0,0,0,0,0,0,948,0,0,0,0,0,0,0,
+462,114,0,0,258,404,0,1717,0,0,0,0,82,1061,0,724,0,0,0,0,0,1133,0,0,0,0,0,0,
+1021,841,0,1021,0,0,0,0,0,0,0,0,0,0,488,373,37,0,0,0,0,564,0,0,0,0,0,513,0,0,0,
+825,0,0,899,0,0,778,0,0,12,1417,0,1116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,545,0,5,
+0,0,0,0,0,0,0,192,0,0,763,0,0,0,0,0,0,0,755,759,0,0,0,0,0,0,0,0,0,370,0,1237,0,
+0,0,0,0,0,298,87,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,
+0,0,0,0,814,991,0,757,57,0,0,0,0,0,0,0,0,0,540,0,0,0,0,608,0,0,0,0,0,0,0,0,1014,
+0,0,0,902,0,0,0,0,553,1668,0,0,0,0,0,0,0,0,0,559,60,0,0,0,0,0,511,0,0,675,0,0,
+156,0,0,0,0,0,0,709,0,698,0,0,0,1745,0,0,0,0,0,0,0,0,0,714,0,0,0,0,0,0,0,0,206,
+8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,776,0,0,0,0,0,0,0,0,0,1272,0,0,
+0,0,0,1059,0,0,0,0,0,0,406,0,0,0,0,0,0,0,0,0,0,947,0,0,0,0,0,0,168,0,0,0,0,0,0,
+870,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,554,0,0,0,0,784,908,0,0,0,0,0,0,
+0,396,358,0,0,0,0,0,0,0,0,2,228,0,0,0,0,0,0,0,0,0,0,0,845,14,0,716,1820,594,0,
+81,1428,0,161,0,782,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,998,0,
+0,0,0,0,0,0,0,0,0,0,0,1043,0,1496,0,0,0,0,0,0,0,0,781,0,0,0,0,0,0,0,817,1114,0,
+1814,958,0,0,0,0,812,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,236,643,0,0,0,0,0,0,0,0,0,1172,0,0,0,0,0,0,0,0,0,1338,0,0,0,
+0,0,0,0,0,0,0,0,54,0,0,0,256,0,0,351,0,955,1885,0,469,0,0,0,1270,0,744,0,313,0,
+0,0,0,0,0,0,0,402,969,0,0,0,0,0,0,50,0,0,0,0,572,0,0,0,0,847,0,0,0,0,0,0,0,248,
+43,0,369,0,0,0,0,0,0,0,0,0,0,0,0,0,766,0,363,0,0,0,0,0,0,0,0,0,0,0,678,0,0,409,
+258,82,249,0,0,0,0,0,0,0,0,0,0,0,0,32,393,0,788,0,0,0,1281,509,1968,0,0,0,0,39,
+291,0,0,0,589,0,0,54,1059,0,0,0,0,0,0,824,0,0,0,0,0,0,0,0,0,0,1005,0,1598,0,0,0,
+0,0,919,0,0,0,0,0,0,0,0,52,132,0,0,0,0,0,328,0,0,0,0,173,0,0,0,0,0,65,1411,0,0,
+0,0,0,0,0,0,0,0,442,0,842,0,0,0,0,0,0,0,0,0,534,0,0,0,0,0,0,0,0,0,0,0,0,0,845,
+210,0,0,0,0,0,0,0,0,892,0,0,223,0,0,0,0,529,0,0,0,807,0,137,218,0,1444,0,0,0,0,
+0,332,661,0,0,0,0,0,0,0,76,1517,0,0,0,0,0,0,0,0,0,0,0,418,0,0,0,0,0,0,0,0,481,
+379,0,0,0,0,0,149,18,0,0,0,0,0,0,0,0,742,304,142,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,799,925,195,51,0,0,0,0,688,0,0,0,0,697,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1169,751,0,0,0,452,929,0,221,0,1437,0,0,0,0,955,1251,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,0,132,0,0,0,0,0,865,0,0,0,0,0,0,0,767,
+672,42,0,0,0,1050,0,0,0,0,0,0,0,0,368,44,0,0,0,0,0,0,0,570,29,0,0,0,0,0,0,227,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,522,0,0,0,0,0,0,0,1529,0,0,0,0,0,0,739,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1667,0,0,0,0,0,0,132,511,0,138,208,1020,0,0,23,565,0,344,0,0,0,
+0,0,922,0,0,0,0,0,0,0,240,0,0,415,171,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,402,0,0,754,31,716,0,982,731,0,0,0,0,0,0,0,888,0,0,0,803,847,0,0,823,
+0,0,0,0,0,0,785,0,0,2,0,0,0,0,0,0,0,532,0,0,681,0,0,314,0,384,684,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,649,447,0,1818,1007,0,321,0,66,360,0,0,0,385,0,0,0,0,0,0,
+0,900,73,254,0,0,0,0,683,1959,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,86,0,0,725,0,0,0,0,0,196,0,0,0,0,0,831,0,0,0,0,723,0,0,0,0,0,994,627,0,0,
+0,0,0,0,0,0,0,0,764,66,0,0,0,0,205,36,0,0,0,0,0,0,0,950,0,0,0,887,111,0,0,831,
+388,165,0,0,0,0,0,155,0,0,0,0,0,0,0,0,0,0,0,0,0,0,780,755,0,0,0,0,898,146,0,0,0,
+0,0,0,0,45,7,0,0,0,0,0,0,0,0,607,0,0,0,0,0,0,65,0,0,0,0,0,0,0,0,0,88,0,0,0,0,0,
+621,600,0,367,0,0,0,0,0,0,0,561,0,559,0,585,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+287,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,672,157,0,0,0,0,714,0,0,0,
+0,0,456,0,925,0,0,0,0,0,0,0,0,19,0,0,0,0,1473,0,0,0,0,0,0,0,0,0,0,113,0,0,0,0,0,
+0,0,0,0,0,0,0,0,69,463,0,0,82,193,2,471,0,0,0,0,633,0,0,0,0,0,0,1148,129,1392,
+542,803,0,0,0,0,0,0,0,0,0,0,0,0,438,0,0,0,0,0,0,875,0,0,0,0,0,237,0,0,0,0,0,0,0,
+65,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,563,0,0,0,9,444,0,0,43,1260,0,0,0,0,0,0,
+971,0,0,699,0,0,0,0,0,1116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,829,242,0,
+0,593,0,0,0,0,0,0,0,0,201,36,224,0,0,0,0,0,0,1430,0,1806,0,523,0,0,212,1889,0,0,
+0,827,0,0,0,0,0,2043,136,242,0,0,0,0,0,0,284,148,10,0,0,0,0,0,0,1249,0,0,0,807,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,0,0,0,494,0,0,0,0,0,0,0,0,1510,0,0,0,0,0,
+0,0,0,0,0,505,1306,0,0,764,268,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,384,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1703,0,0,0,0,159,964,583,0,0,0,
+0,0,0,515,0,0,854,0,0,0,0,0,0,0,0,0,0,0,0,1123,0,0,0,0,0,0,0,136,0,0,0,0,0,1782,
+0,0,44,1287,0,0,0,0,0,732,0,0,0,0,313,679,0,0,316,0,0,0,0,595,0,0,0,0,0,0,753,
+147,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,137,0,0,0,0,414,0,1762,0,0,0,0,0,0,0,0,
+0,0,0,599,0,0,0,0,0,0,0,0,0,1749,0,0,0,1627,0,488,0,0,0,0,0,83,0,0,0,0,676,0,0,
+1639,0,0,0,0,0,0,0,0,0,278,0,0,0,0,0,0,97,0,14,1085,0,0,0,0,0,0,781,388,0,849,
+59,229,0,0,0,0,0,1115,0,0,0,0,108,0,0,0,0,700,0,0,0,0,0,0,0,0,0,1414,0,0,0,0,0,
+0,0,0,0,0,0,0,0,660,737,1035,0,0,0,0,0,0,521,690,0,0,0,0,0,0,0,0,0,0,0,0,272,0,
+0,0,0,0,0,0,0,0,0,1744,0,0,0,0,0,0,128,733,0,0,277,0,0,0,0,0,0,0,0,0,4,0,0,0,0,
+0,0,0,0,0,0,0,0,0,936,1981,40,0,0,0,0,0,0,0,0,775,0,0,0,0,0,0,0,0,0,306,0,0,0,0,
+0,0,0,979,0,0,0,0,0,611,0,0,0,0,0,178,0,0,0,1969,0,0,0,0,0,0,0,664,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,390,0,0,0,1510,0,0,0,0,0,0,0,0,0,0,0,493,0,0,37,0,0,0,0,724,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,1537,0,0,168,473,0,0,0,105,0,0,0,0,
+627,438,0,0,0,0,0,0,0,0,0,0,11,1256,0,0,0,1626,0,779,0,0,0,0,25,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,308,0,0,0,0,0,741,0,671,0,0,0,0,649,150,0,0,99,521,0,0,3,339,0,0,0,
+543,0,0,0,0,0,0,0,0,0,1358,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,234,155,
+0,0,0,0,0,0,0,1628,0,766,0,0,0,0,0,0,0,0,0,0,0,0,0,829,0,0,0,1445,0,0,0,486,0,0,
+0,0,2,1635,0,0,0,0,558,0,0,0,0,0,0,0,0,0,0,1461,0,0,0,0,0,599,0,0,0,0,0,0,0,0,0,
+1376,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,0,0,0,0,0,0,447,0,0,66,1432,0,0,0,0,
+0,0,307,0,413,609,0,0,0,930,0,0,0,0,21,939,0,0,0,0,0,962,4,651,0,0,0,0,15,579,0,
+0,0,0,0,597,0,0,0,0,0,981,0,0,0,545,0,0,0,0,0,0,0,1558,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,800,17,0,0,17,0,907,0,0,0,110,0,0,0,53,458,0,1983,0,0,0,0,0,0,0,0,0,0,443,0,
+0,0,0,0,0,0,0,0,0,0,924,1844,0,1232,0,0,0,0,70,519,0,993,0,0,0,0,0,0,14,530,0,
+907,0,0,0,0,0,733,0,0,0,0,0,0,0,0,55,0,188,531,56,0,0,1693,0,0,0,0,0,0,0,0,441,
+0,192,928,0,0,0,0,0,241,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1525,0,259,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,512,185,0,464,1603,0,0,0,0,0,0,0,0,0,0,0,1113,
+284,720,0,0,722,0,0,0,0,0,13,0,0,0,0,0,0,0,4,289,43,0,0,0,0,0,0,1694,0,0,0,0,
+193,0,0,0,0,409,0,0,0,0,0,0,0,0,0,0,0,0,308,0,0,1863,0,0,0,0,0,0,0,0,0,790,0,0,
+745,1002,0,0,0,0,0,0,0,0,0,289,68,477,13,0,0,0,0,0,0,0,0,0,0,609,0,0,0,0,0,0,0,
+0,0,0,0,367,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,528,0,0,0,0,0,0,0,0,0,694,58,
+548,0,0,0,0,0,0,687,0,0,0,0,1749,0,0,0,0,0,0,0,0,1004,661,0,0,0,0,0,0,445,0,0,0,
+74,0,0,0,0,213,0,0,0,0,0,0,0,0,0,0,0,0,0,834,0,0,189,1672,0,0,0,0,0,0,0,1548,
+192,0,0,0,0,0,0,0,0,0,0,0,0,0,32,751,0,78,0,0,0,0,0,0,544,1602,105,473,0,0,0,0,
+0,0,156,1949,0,1779,0,0,0,0,0,0,0,0,0,0,0,763,0,0,0,0,0,0,0,0,29,0,0,0,0,0,0,0,
+0,0,0,883,0,0,0,0,0,0,0,488,0,617,0,0,50,0,694,1518,785,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,546,0,0,0,0,0,0,0,0,0,0,22,0,0,0,0,1016,0,0,0,577,0,0,0,0,0,0,
+184,935,114,720,0,0,100,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,95,14,0,969,0,0,0,0,0,0,0,
+727,0,1021,0,0,0,0,0,1190,0,0,0,0,0,0,0,0,0,0,0,0,0,153,0,0,0,0,0,0,0,0,0,798,0,
+587,0,0,695,42,0,1929,141,957,0,465,7,908,0,0,450,148,0,0,0,1166,0,0,0,0,0,0,0,
+0,0,0,0,0,253,0,1003,0,0,0,0,0,0,0,0,0,0,0,46,0,0,879,0,806,0,1868,0,0,0,0,0,
+1846,0,0,0,730,0,0,0,0,0,0,0,965,0,0,0,0,506,0,0,0,10,0,0,0,22,0,0,0,0,0,0,0,0,
+0,0,0,0,0,960,296,0,0,0,0,0,0,0,0,0,0,0,587,0,0,0,0,20,0,0,0,32,982,0,0,0,0,0,0,
+0,0,0,0,941,0,0,0,0,435,0,0,0,0,0,0,71,419,0,0,0,0,0,0,688,740,94,345,0,0,679,
+582,0,0,0,0,0,0,0,945,0,0,0,0,0,0,0,0,0,0,0,0,539,0,684,1993,0,0,0,659,0,583,0,
+803,0,704,0,0,0,0,0,198,181,347,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,481,405,203,0,0,99,826,0,0,0,0,0,0,0,492,0,408,0,0,0,0,0,0,0,0,0,0,4,0,0,
+0,0,665,349,137,0,0,0,0,612,1270,0,0,0,0,0,371,0,0,0,826,0,0,0,0,21,1535,858,
+374,0,0,0,0,0,0,311,0,0,0,991,1968,0,0,0,0,494,1647,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,769,0,0,0,0,0,642,0,0,157,123,0,0,0,1435,0,0,0,0,0,0,0,0,0,0,79,0,0,0,
+0,0,0,1425,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,106,393,486,1690,0,0,0,0,
+0,0,0,0,0,0,0,0,756,184,0,0,0,1382,0,0,0,175,0,1493,0,1007,0,0,0,0,0,0,0,0,0,0,
+0,219,0,0,0,0,515,99,0,851,0,0,0,0,0,1278,0,0,0,0,0,0,0,1000,982,0,762,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,910,1819,0,0,0,0,0,0,906,0,0,0,0,0,0,0,0,0,0,1730,0,0,
+0,0,0,0,0,0,0,0,0,1185,0,0,0,0,0,0,0,0,40,0,0,0,147,0,0,0,0,0,0,0,0,0,0,0,0,0,
+650,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,30,0,553,0,0,20,597,0,1614,0,0,0,0,0,327,
+49,0,0,0,0,0,0,0,78,0,0,786,134,0,0,0,12,496,0,0,0,0,0,0,0,0,0,0,42,204,0,614,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,147,247,0,0,0,0,942,0,0,2023,0,0,0,0,
+0,0,67,285,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1309,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,532,0,0,0,0,0,0,0,
+1692,0,0,0,0,55,1704,0,0,0,0,988,0,0,0,223,0,0,0,0,0,0,0,57,1123,0,0,0,0,0,1764,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2015,0,0,0,1599,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,129,0,0,0,0,0,0,0,0,0,0,0,534,0,0,0,0,0,0,0,0,0,0,0,
+0,0,504,621,1248,321,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1397,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,441,75,0,0,0,0,0,0,0,0,0,0,841,0,0,0,0,0,693,0,650,314,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,913,0,0,0,0,0,0,0,0,0,0,0,0,0,0,880,0,475,0,
+0,1016,179,602,111,329,0,0,0,1864,0,0,0,0,846,1888,0,0,780,0,0,0,82,0,0,0,0,821,
+0,0,0,0,0,0,0,0,0,0,0,956,112,0,0,0,261,455,0,0,0,0,0,0,337,385,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,184,1865,0,0,721,16,0,486,0,0,0,265,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,621,0,0,0,0,0,0,0,0,234,0,0,815,0,0,743,
+1987,205,197,0,0,0,0,0,0,0,0,0,314,0,0,0,0,0,0,0,0,0,0,0,0,0,0,219,452,589,0,
+176,333,0,0,0,0,0,0,0,1110,47,0,0,0,0,0,0,0,0,0,0,0,864,0,0,300,0,1237,0,0,0,0,
+0,0,0,0,0,0,0,1685,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,135,395,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,631,0,0,0,0,0,0,835,0,0,0,606,459,0,979,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,612,0,0,0,0,0,0,0,0,158,372,0,854,0,0,0,0,0,
+0,0,1492,0,0,0,833,0,0,0,0,0,0,0,1739,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+195,0,0,0,0,0,0,0,0,730,1997,0,0,0,0,0,0,0,0,61,0,0,0,0,0,0,0,266,751,0,0,0,0,0,
+0,0,821,0,0,0,715,0,0,0,868,0,959,0,0,0,0,0,0,0,0,0,0,0,1053,0,0,0,950,0,1081,0,
+1595,0,0,0,0,59,0,0,0,0,0,0,0,0,0,0,47,684,0,0,0,0,0,0,1606,0,777,0,1020,0,0,0,
+1094,0,0,0,0,0,0,0,350,0,0,0,0,0,0,242,1812,0,0,0,967,0,0,0,473,286,0,0,0,0,0,0,
+798,629,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,513,337,306,0,0,0,0,0,0,0,0,0,
+146,0,0,1646,0,0,0,0,0,465,0,0,0,525,0,0,0,0,0,0,299,165,0,0,0,0,0,0,0,1064,0,0,
+0,0,0,596,0,0,0,0,0,0,0,0,0,0,0,0,0,0,238,1741,0,1233,451,1824,0,0,0,0,733,495,
+0,0,0,0,0,1204,0,0,0,559,341,0,224,21,0,0,0,0,0,0,0,0,97,1446,0,0,0,0,0,0,0,729,
+0,0,565,727,0,1948,0,0,0,519,0,0,0,0,0,0,0,0,0,1193,0,0,0,0,0,0,790,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,323,2,201,0,0,59,0,0,34,0,896,961,0,1285,0,0,46,0,479,0,0,
+0,0,549,0,663,0,0,0,0,0,783,65,682,0,0,0,0,0,11,0,0,0,0,0,522,0,0,0,52,0,0,0,0,
+0,383,0,0,0,0,0,0,0,0,127,0,0,0,0,0,397,194,0,0,635,0,0,0,0,0,0,0,0,0,0,975,0,0,
+0,0,0,0,0,0,0,0,116,0,51,0,0,858,0,1075,535,448,0,0,0,0,0,610,0,0,0,0,0,0,0,0,0,
+0,191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,267,673,319,94,92,0,551,0,0,218,
+1406,69,256,0,0,952,1980,0,833,0,0,0,0,0,0,0,0,0,0,0,0,39,0,0,0,0,0,0,0,81,0,0,
+0,352,634,0,0,0,0,0,618,0,0,0,0,0,0,73,339,0,0,0,0,0,0,0,0,0,0,0,0,0,0,169,759,
+0,0,0,0,0,0,0,0,0,0,0,0,0,1075,0,0,0,0,0,0,482,649,0,0,0,0,0,0,0,0,386,336,0,0,
+0,1035,0,0,0,0,0,0,0,0,0,0,0,924,0,73,0,0,0,0,0,1971,0,0,0,0,0,0,0,0,0,1344,0,
+501,0,0,0,0,0,0,0,0,46,799,0,0,0,0,0,0,0,276,0,0,0,0,0,0,0,770,0,0,0,0,0,0,0,0,
+0,0,0,0,0,158,0,0,0,0,0,1432,0,0,0,0,0,0,0,0,0,0,25,0,0,2001,0,0,0,0,0,0,0,0,0,
+0,0,0,0,478,0,0,0,0,0,0,91,1461,211,602,0,0,0,0,0,0,0,0,0,1068,0,0,124,567,0,0,
+0,1006,0,0,0,0,0,0,0,0,0,735,812,0,0,323,0,0,0,304,0,0,0,0,0,0,0,0,0,148,0,0,0,
+0,0,0,0,0,0,523,0,0,144,730,0,0,981,0,0,111,0,0,132,0,0,0,0,0,0,890,0,0,0,0,0,
+444,0,1787,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,2041,932,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,937,0,995,0,0,255,0,0,138,863,965,0,0,631,0,0,0,0,1394,16,652,0,0,0,0,0,0,
+0,0,0,0,0,0,0,897,0,321,0,0,0,0,0,922,0,619,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,844,0,0,0,0,0,0,1659,0,1100,0,0,0,1173,0,1930,268,251,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,390,711,0,0,0,0,0,0,0,0,0,0,0,0,0,744,0,0,0,0,0,0,0,0,0,624,0,0,0,
+1998,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1125,0,0,0,594,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,268,0,0,0,0,0,0,0,563,0,0,0,0,0,0,0,0,2,39,0,0,0,1332,0,0,0,0,0,
+0,0,508,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,796,0,0,0,0,527,0,0,0,0,98,0,0,576,0,
+0,0,0,0,122,0,276,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,645,0,0,0,0,
+0,0,0,0,0,0,0,290,0,0,762,1292,0,0,0,1315,0,1955,0,0,0,0,0,0,0,0,0,0,210,131,0,
+0,0,0,797,0,38,0,11,488,0,936,0,441,0,0,0,0,0,595,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+991,0,0,0,0,0,0,0,0,0,0,0,653,0,523,0,0,0,903,0,0,0,0,0,0,0,0,0,0,0,0,80,0,0,0,
+0,0,0,0,0,0,432,0,0,314,0,0,0,0,232,1368,534,0,0,0,0,0,27,0,0,0,12,0,0,0,0,0,0,
+0,0,0,264,736,0,1657,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1117,0,127,0,0,0,1208,0,1294,
+0,0,0,0,364,0,0,0,0,0,125,1334,0,0,0,0,0,0,0,0,0,0,0,0,0,0,792,0,0,0,0,0,0,0,
+849,699,0,0,0,0,0,968,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1446,
+124,397,0,0,0,0,0,0,0,0,0,0,0,641,0,0,0,0,0,0,0,0,0,0,0,0,127,346,0,0,517,75,0,
+0,0,0,0,0,0,0,83,0,0,0,0,0,0,1031,0,0,0,0,0,0,0,1470,0,954,0,0,345,304,410,0,0,
+0,0,734,0,0,0,0,0,1822,0,0,0,1798,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,161,
+1865,69,0,0,0,0,0,0,922,0,0,0,0,0,0,0,0,0,0,0,541,0,627,0,0,0,0,0,0,0,0,0,166,0,
+0,0,0,0,0,0,0,0,849,0,0,0,0,0,0,0,717,0,0,0,0,0,0,0,0,0,0,0,0,0,0,600,0,0,0,0,0,
+0,654,0,0,188,273,0,0,0,543,0,410,87,0,0,941,0,0,186,250,0,1785,0,0,0,0,0,1339,
+462,961,0,780,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,0,0,0,0,0,0,474,1276,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,24,948,0,0,0,0,657,753,0,0,0,0,941,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,706,985,837,0,1861,0,0,0,0,0,0,0,0,0,0,0,0,0,0,292,933,0,0,0,0,0,
+0,0,0,0,767,0,0,0,0,0,0,0,641,0,0,0,1233,114,0,883,0,274,2008,0,1794,285,0,0,
+571,0,0,0,0,0,0,0,0,0,0,823,960,16,617,0,431,0,0,0,0,0,0,0,0,0,0,567,0,401,0,2,
+781,424,33,0,2006,0,0,274,0,0,1882,0,794,0,0,0,1848,0,0,0,0,0,0,448,47,0,0,0,
+1199,0,0,0,0,0,0,0,0,417,0,0,0,0,0,0,0,0,0,0,295,0,0,0,0,0,0,0,1019,0,0,0,0,0,0,
+0,0,0,0,0,0,0,620,0,0,0,0,464,0,0,0,0,208,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,442,0,930,0,0,0,0,0,516,68,0,0,0,0,0,1128,104,0,0,0,0,0,0,0,0,787,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,491,0,0,0,0,0,0,711,0,0,9,0,101,441,0,0,0,0,0,0,0,0,
+0,0,160,396,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,679,326,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,1128,0,0,0,0,0,737,0,1796,0,0,0,0,0,0,0,0,0,0,0,0,338,574,0,0,
+0,0,0,1096,491,405,0,0,0,0,0,1081,0,0,0,0,0,0,0,0,0,0,0,0,0,1676,0,1207,0,0,0,0,
+0,0,969,354,0,0,0,0,598,0,297,0,0,0,0,0,0,0,0,1772,751,0,37,0,0,1828,0,0,0,0,0,
+0,0,0,0,257,191,582,0,0,0,0,0,0,790,0,0,0,0,0,47,0,0,0,0,0,0,0,449,306,1011,0,0,
+0,0,0,299,0,0,0,0,0,0,837,0,0,0,0,0,0,10,329,0,0,0,0,0,1320,0,0,0,0,0,0,158,657,
+0,1191,0,0,0,0,0,0,7,0,974,1939,0,1665,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,288,
+66,0,0,0,0,494,175,0,1643,0,0,0,0,0,0,0,0,570,750,719,0,0,0,0,0,0,0,0,0,0,0,0,0,
+13,0,0,1247,0,0,221,356,0,0,0,0,0,0,0,0,0,0,694,1809,0,0,0,0,0,0,0,411,0,44,31,
+0,0,0,0,669,0,673,0,0,0,0,0,0,0,0,0,1303,704,299,0,0,0,275,0,0,216,1761,0,0,0,0,
+0,0,0,0,0,0,0,1319,0,0,428,0,0,0,0,0,0,0,0,0,0,514,0,0,0,0,0,0,49,55,102,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,364,0,0,0,0,379,0,921,971,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1258,0,0,0,1058,0,0,0,0,0,656,0,0,0,0,0,144,0,0,0,0,0,0,0,0,0,0,
+0,1373,10,605,0,0,0,0,0,0,0,838,0,1012,0,0,0,0,0,0,0,0,0,0,0,0,0,0,154,365,0,0,
+0,0,0,0,0,0,0,340,0,0,0,0,0,810,0,0,0,0,0,0,495,0,0,0,0,0,0,0,0,0,261,0,535,248,
+0,358,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,567,445,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,697,0,0,0,1336,0,0,0,0,0,0,0,0,917,174,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,972,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,351,0,0,0,0,0,0,0,0,0,0,
+0,0,0,286,0,0,56,438,0,0,0,0,0,1950,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,738,0,0,0,0,0,
+0,0,0,0,0,969,2047,0,0,0,0,0,0,0,818,0,0,0,0,0,0,0,866,0,0,0,0,0,0,0,1467,0,0,0,
+0,0,0,0,0,0,0,0,0,0,972,0,355,0,0,0,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,267,189,104,0,0,0,0,1613,0,0,0,0,0,0,0,116,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,886,0,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,0,0,863,0,0,0,0,0,
+0,0,1953,450,1773,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,381,0,0,0,0,0,0,0,
+0,0,0,0,0,1142,0,1189,0,0,0,663,0,0,0,0,0,0,0,846,0,0,528,0,393,378,0,0,0,0,0,0,
+325,899,680,1880,0,1770,0,0,0,0,0,648,0,0,0,0,0,0,185,167,0,2046,0,0,0,0,0,0,
+249,1645,0,152,0,0,0,1733,0,0,0,0,0,1006,0,0,0,0,0,420,0,0,0,832,0,0,0,0,0,351,
+0,0,0,0,6,40,0,0,60,0,0,0,0,1354,745,724,0,0,0,0,0,0,0,0,772,1951,275,108,639,0,
+0,0,0,0,0,0,0,0,500,1758,0,0,0,0,0,0,0,0,0,0,0,1886,711,205,0,0,965,865,0,0,0,
+534,0,0,0,0,691,0,0,0,237,443,0,878,0,0,0,0,0,1410,0,0,0,0,0,0,0,0,0,0,0,0,0,
+995,0,0,0,0,0,0,0,0,0,0,0,0,0,578,0,0,0,0,881,0,0,0,0,0,0,0,0,822,0,923,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,924,0,0,0,665,0,0,0,0,0,1901,0,0,0,0,0,950,498,93,
+0,0,0,1451,0,0,0,0,0,747,828,788,400,184,0,198,0,0,0,0,0,0,0,0,0,0,0,994,0,0,0,
+0,0,0,0,0,615,320,0,0,0,978,843,905,0,0,0,0,0,0,0,0,850,974,0,0,0,0,6,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,509,0,0,0,0,0,273,0,0,0,0,0,0,0,0,0,0,0,0,0,
+201,0,0,0,1041,0,0,0,1040,0,0,0,0,0,0,0,0,0,693,234,774,0,336,0,1399,22,0,805,
+802,777,167,789,0,0,1705,0,0,0,0,0,0,0,0,0,0,0,10,13,11,0,0,204,264,0,0,56,0,0,
+1917,0,470,0,0,0,0,0,0,0,0,0,0,0,1198,0,0,0,0,0,0,0,0,0,0,1015,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,715,0,0,1002,0,0,0,298,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,867,0,0,724,0,0,0,0,0,0,0,0,0,0,0,0,768,0,0,0,0,0,1066,0,0,0,0,67,0,174,948,
+0,0,0,0,0,0,0,0,0,0,0,0,0,764,0,0,0,0,75,137,0,756,0,0,0,0,0,0,1008,842,643,0,0,
+0,67,0,0,0,0,0,0,0,0,0,0,0,135,821,0,0,0,0,0,0,0,0,736,0,389,355,0,0,786,0,0,0,
+0,0,0,2044,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1030,0,0,0,1083,0,0,0,0,0,
+1226,0,0,0,0,356,319,8,389,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,474,0,0,0,427,
+0,413,0,730,0,0,0,0,0,373,0,0,0,0,0,0,0,0,0,799,0,0,0,1793,0,0,0,322,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,290,2,0,0,0,0,0,0,0,0,0,0,672,
+699,1860,0,0,0,737,0,0,0,1612,0,0,0,0,0,0,0,0,0,0,0,145,124,884,0,0,0,0,0,387,0,
+0,0,0,0,0,0,0,0,0,0,679,0,550,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1305,0,0,0,0,0,0,0,
+576,0,0,0,0,0,0,0,686,0,607,0,0,37,0,0,0,0,0,0,0,0,0,101,1726,0,0,0,0,0,958,0,0,
+0,903,0,0,0,0,147,0,0,0,0,0,0,0,0,0,0,0,367,0,0,0,0,690,0,705,273,0,0,887,0,0,0,
+0,0,0,0,0,0,0,0,90,0,0,0,0,0,0,0,908,0,0,0,0,0,0,0,1261,0,0,497,1235,0,429,0,0,
+0,0,904,0,12,125,0,0,0,841,0,0,0,0,0,860,946,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,768,0,770,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,271,0,0,0,0,0,0,0,719,0,699,581,0,0,0,0,0,0,0,0,0,0,862,304,0,631,0,0,0,0,880,
+1513,0,0,0,0,0,981,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,434,0,0,0,0,0,550,0,0,476,930,
+824,553,0,0,452,0,151,0,0,0,0,0,0,772,0,292,135,0,0,0,0,0,0,0,504,0,0,1089,0,0,
+0,0,0,0,0,0,0,0,0,783,0,0,0,0,0,0,206,393,0,0,0,0,0,0,0,0,232,912,0,0,0,0,0,977,
+0,0,716,98,0,0,0,0,0,733,0,0,0,0,0,0,0,0,19,0,0,0,0,668,0,360,0,0,0,0,0,0,656,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,726,0,0,0,0,0,0,0,0,0,0,0,0,72,0,0,1269,0,0,463,0,
+0,0,0,0,0,1454,0,1287,245,0,989,0,0,0,0,0,0,0,0,0,107,164,0,0,0,0,0,0,0,1061,0,
+0,0,0,2,484,0,0,0,0,0,0,0,1127,0,0,0,0,0,0,0,460,0,0,0,0,0,932,0,0,0,0,0,0,0,
+588,625,0,0,0,0,76,92,0,0,0,0,0,0,0,0,0,0,0,0,0,104,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+763,0,622,0,0,0,253,0,546,0,0,110,0,256,916,0,0,35,212,0,0,746,0,0,0,150,0,0,
+1466,0,0,0,1299,0,0,0,0,0,0,0,0,0,1518,0,0,0,0,0,0,0,0,0,0,0,0,0,1229,0,0,0,816,
+0,0,0,0,0,0,159,0,0,0,0,0,734,869,126,1716,0,0,0,0,0,0,202,232,0,0,0,0,212,0,0,
+0,0,0,111,1003,0,0,0,0,0,0,0,0,0,0,0,1712,0,0,216,0,0,0,0,516,0,0,0,0,0,650,0,0,
+0,0,57,99,0,0,0,0,300,574,0,0,0,0,1023,0,0,302,0,1871,0,728,252,0,0,461,0,0,0,
+323,0,0,0,0,0,0,775,461,0,0,0,0,0,0,172,0,0,464,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,73,727,0,1023,0,0,0,0,0,0,0,0,0,0,577,0,0,0,0,0,0,0,0,1037,0,0,0,0,0,0,
+0,0,280,677,0,0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,159,0,446,1730,0,0,0,0,0,0,0,0,0,
+395,0,0,0,0,145,0,0,0,0,0,0,0,20,0,0,426,608,0,0,0,0,0,977,0,250,0,0,0,0,0,100,
+0,0,0,0,1982,0,0,0,0,0,476,0,0,0,0,0,0,594,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,447,0,0,0,0,526,0,0,14,1124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,188,0,0,0,0,0,0,0,0,362,301,0,0,0,1743,0,178,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,872,0,831,0,0,208,202,0,0,0,0,0,0,0,1954,0,
+0,0,0,516,872,0,0,313,224,0,0,24,0,11,546,0,0,0,1937,242,241,46,0,0,0,830,1273,
+0,0,0,0,0,0,0,825,327,1006,0,0,0,0,0,1580,516,366,0,0,0,0,0,1736,0,0,0,0,0,0,0,
+0,0,0,0,1935,0,826,0,0,0,0,139,331,0,0,0,0,0,0,0,0,0,0,0,288,0,916,0,0,0,0,0,
+1888,0,0,0,0,0,0,0,1471,0,1570,0,394,0,0,0,0,0,0,0,1931,0,1719,0,658,228,0,0,0,
+0,0,374,0,0,0,0,735,0,0,0,0,0,0,323,498,0,1063,0,0,0,0,155,0,0,0,0,0,0,0,0,906,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1139,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,616,
+902,0,0,0,0,0,692,0,0,0,0,0,0,823,0,0,0,305,0,0,0,0,0,0,0,681,0,0,0,0,0,214,
+1004,0,0,0,0,0,0,0,23,0,0,1703,0,0,0,0,0,0,0,0,0,1443,0,0,19,714,0,0,0,0,64,737,
+0,0,345,1758,0,0,579,47,0,0,539,139,0,0,0,0,388,0,0,0,0,253,0,0,0,0,0,0,252,0,
+745,0,0,0,0,0,0,0,0,0,0,0,504,107,0,871,0,0,0,229,0,0,0,0,0,903,0,0,71,0,0,549,
+6,47,0,0,0,0,0,0,0,0,0,980,865,705,0,0,0,161,0,0,0,0,143,1331,0,0,0,1388,33,724,
+0,0,0,19,0,0,0,395,0,0,0,0,0,846,210,0,0,0,122,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,695,937,497,0,0,0,0,0,718,0,0,0,0,0,0,0,1581,0,
+0,0,0,0,0,161,49,0,0,0,0,0,0,0,0,0,597,0,0,0,1094,0,0,0,811,908,0,0,0,0,0,0,0,0,
+0,0,1471,0,0,0,0,0,0,0,0,0,0,42,1935,0,0,0,2014,66,2007,0,0,586,0,0,0,0,0,0,0,0,
+0,28,1077,0,0,0,1221,0,0,62,0,0,0,0,0,0,0,0,0,0,1766,0,0,0,0,0,0,0,0,0,0,0,0,25,
+0,499,1388,0,0,97,10,0,0,0,0,0,481,0,0,0,0,0,0,0,0,0,0,37,134,155,486,0,1442,0,
+0,0,0,0,591,0,0,0,0,0,0,310,1173,0,0,0,0,409,1156,0,0,0,482,0,0,263,926,0,0,0,0,
+0,0,0,0,0,0,0,0,0,804,0,0,0,0,0,0,0,0,0,0,0,0,0,1265,0,415,0,348,0,0,0,1012,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,165,1803,0,0,0,0,0,0,0,408,
+0,0,0,0,0,0,257,1321,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1138,0,0,0,249,0,
+0,0,576,0,0,0,0,231,0,0,0,288,0,0,0,0,0,0,0,0,0,433,1487,569,1678,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,0,0,0,0,0,779,538,0,0,0,413,0,0,0,
+0,0,0,0,0,0,0,495,0,0,0,0,0,191,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,530,567,
+0,0,0,0,0,1484,0,0,0,0,0,0,815,609,0,0,0,0,0,484,0,0,0,0,0,0,0,0,0,0,900,0,0,0,
+0,1335,0,1724,0,0,0,0,0,0,0,0,0,0,0,640,0,0,0,0,0,0,0,0,0,0,0,1831,0,0,0,0,0,0,
+0,0,0,0,0,0,0,474,0,0,0,0,0,0,0,0,0,1103,0,1504,655,1034,0,0,0,0,0,305,0,0,0,0,
+0,0,0,0,0,1236,0,0,429,217,0,0,0,0,739,278,0,0,0,0,0,0,0,708,0,0,0,0,0,1840,233,
+0,0,0,0,0,0,0,0,2017,0,0,0,0,0,1488,0,0,0,1590,0,0,0,0,0,1800,28,0,0,0,0,0,0,0,
+0,0,45,0,36,0,22,1442,378,0,0,0,0,0,0,1507,0,0,0,0,0,0,0,0,0,0,39,0,0,1054,725,
+1955,0,2036,0,0,0,0,0,0,0,0,0,0,896,1871,0,0,0,0,0,0,0,0,0,0,805,0,0,0,0,2046,0,
+0,0,0,17,712,0,617,55,320,271,0,0,0,0,0,0,0,0,0,445,0,184,103,0,0,0,0,0,0,0,0,
+659,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,676,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+337,0,0,0,506,0,0,0,0,0,843,77,0,458,0,0,0,0,0,1420,382,109,142,330,0,0,0,0,0,0,
+0,0,0,0,0,0,87,0,0,0,492,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1239,0,0,0,0,0,0,
+211,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1049,0,321,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,1985,0,0,122,0,0,234,0,0,0,1098,0,0,0,0,0,0,549,253,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,522,131,0,0,149,0,0,0,0,0,0,0,0,0,0,0,0,0,0,507,0,0,0,0,811,630,0,0,0,343,
+0,0,0,0,0,448,591,455,0,1381,0,0,0,0,0,0,0,575,0,0,0,0,0,1175,0,0,0,0,0,0,0,0,0,
+653,0,0,0,1761,0,1198,0,0,0,0,297,1127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,678,0,0,
+164,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,0,45,0,0,0,0,0,121,0,0,0,0,0,0,
+0,0,125,0,0,0,1622,0,0,0,0,0,721,145,0,0,0,970,792,0,0,0,715,0,0,0,0,0,1999,0,0,
+74,531,0,0,65,0,0,0,105,220,0,0,0,0,0,0,0,960,0,0,0,0,0,0,428,19,0,0,401,96,0,0,
+0,0,0,1595,116,0,1021,0,0,0,0,0,750,1961,0,0,148,0,0,0,0,0,0,0,0,0,0,0,0,0,75,0,
+0,1383,0,0,0,0,0,0,0,0,0,0,0,0,0,0,779,0,0,0,0,0,0,0,0,598,0,424,0,0,0,0,0,0,0,
+1222,0,0,0,876,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,0,0,0,0,187,0,8,0,0,0,0,0,
+0,0,429,0,685,0,0,0,0,0,0,0,0,0,0,0,132,472,0,0,0,0,0,0,0,0,0,938,0,0,874,0,0,0,
+0,0,774,0,0,0,0,0,92,0,0,0,0,0,0,830,701,0,0,0,0,0,426,350,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,603,59,0,0,0,0,0,0,0,0,0,0,293,0,0,0,0,0,0,0,0,0,0,0,0,0,0,441,163,4,0,
+0,0,0,0,0,0,0,0,806,0,0,0,0,0,0,233,0,0,0,0,1994,0,1739,0,0,393,0,47,1038,0,0,0,
+309,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,363,0,0,0,175,0,0,0,0,0,0,0,666,
+0,0,1675,0,1600,0,0,0,808,0,0,0,0,0,0,0,0,0,0,0,280,54,0,0,0,0,0,0,0,0,421,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,249,0,0,103,254,0,262,1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,805,0,0,0,0,0,0,0,0,0,1630,0,0,0,0,0,0,0,0,0,0,0,0,0,671,972,989,0,0,
+0,0,0,0,0,889,0,0,0,1382,0,0,0,0,0,0,0,775,0,0,0,0,0,0,0,0,0,0,388,202,0,0,0,0,
+16,560,0,0,0,841,0,0,566,0,0,0,938,0,0,0,0,0,0,0,0,0,0,912,0,0,0,1361,0,0,0,0,0,
+0,618,236,0,1854,0,0,318,190,0,1376,0,0,0,0,0,0,0,349,0,0,0,0,951,1972,0,0,0,0,
+0,0,344,0,0,0,0,0,0,0,0,850,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,910,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,163,85,0,487,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,145,0,83,0,0,1013,0,0,0,1922,0,0,169,557,66,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,1193,82,0,352,454,57,0,0,1333,396,107,0,370,0,0,0,0,0,0,0,0,0,204,0,0,0,
+0,0,1706,0,0,0,0,0,0,0,0,0,0,0,0,394,1204,0,0,0,0,0,1007,0,0,0,1696,0,1519,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,981,0,0,0,0,1072,0,0,0,712,0,1629,0,0,0,0,0,0,0,728,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1271,0,0,0,1608,16,0,0,0,0,485,0,0,0,0,0,0,
+153,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1991,0,0,0,0,0,0,0,0,52,0,21,0,
+0,0,0,0,0,0,0,0,819,0,0,0,0,0,917,0,0,0,0,784,0,0,0,0,135,0,0,0,0,0,454,0,0,0,0,
+0,0,0,0,0,852,1719,0,0,0,0,0,852,0,0,0,0,0,952,0,0,0,0,568,0,0,0,0,0,448,0,0,0,
+67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1826,657,0,729,666,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+669,0,0,0,0,0,0,0,402,0,0,152,0,0,0,0,912,0,0,0,0,0,0,51,320,0,445,0,0,0,0,308,
+0,0,0,0,0,386,0,0,239,0,0,130,83,0,143,0,348,0,0,0,0,0,0,0,958,0,0,0,0,0,210,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,430,0,0,0,0,0,0,0,0,0,0,0,0,7,213,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,801,0,0,0,0,0,0,0,0,0,936,0,108,0,0,
+0,0,0,0,0,0,0,885,587,219,398,364,0,1165,0,0,342,241,303,0,0,0,0,0,0,0,0,0,0,
+1454,0,0,0,0,0,0,0,0,0,0,254,562,0,786,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1294,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,493,216,0,0,0,0,219,341,0,0,0,0,0,
+0,0,0,0,0,130,1734,154,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,701,604,0,0,879,0,195,
+666,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1669,0,0,0,1791,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1228,0,0,0,0,0,623,0,0,0,0,0,0,0,798,0,0,0,0,0,0,0,0,0,0,0,0,84,
+122,0,0,0,837,0,0,0,0,0,0,1013,0,0,577,0,0,0,460,932,0,0,0,0,0,0,0,0,0,0,0,31,
+131,0,0,0,605,0,0,0,1246,0,0,0,0,68,278,165,307,781,0,0,0,0,0,0,33,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,1113,0,0,720,1953,203,0,0,0,0,0,0,0,425,326,0,0,0,0,0,
+0,0,0,0,0,241,1316,0,0,0,0,0,416,0,0,0,1300,0,847,0,0,662,358,0,0,0,0,839,1823,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,654,1522,0,0,0,0,0,0,163,0,0,0,0,0,314,978,0,0,0,
+601,0,0,0,0,0,946,434,0,0,0,402,411,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,1467,
+410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,483,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,677,0,0,0,0,0,0,0,0,0,0,0,0,70,0,0,0,0,1405,0,0,0,0,0,0,108,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,777,0,0,0,0,0,747,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,505,0,326,0,0,164,628,654,0,0,0,
+37,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,668,152,0,0,0,0,0,0,0,0,0,0,0,581,
+0,0,0,0,44,126,89,0,0,0,0,0,0,0,0,1531,0,0,0,0,0,0,0,0,203,1167,0,0,0,0,0,0,0,0,
+531,1232,0,0,0,0,0,943,0,670,231,880,0,1617,0,0,0,1957,0,0,0,0,0,0,0,975,0,0,0,
+0,0,0,0,0,0,0,0,242,0,0,0,0,0,0,0,0,0,421,0,0,14,834,0,0,0,0,0,0,0,0,0,0,0,0,
+465,0,0,0,0,0,834,688,413,855,0,0,0,590,0,0,0,0,0,0,0,0,114,0,0,0,0,0,0,0,0,0,0,
+0,45,169,0,0,0,0,0,0,0,0,0,0,0,198,0,0,565,585,0,0,0,0,0,0,0,0,0,0,0,0,0,691,0,
+0,0,593,0,0,0,0,0,0,0,0,0,913,116,0,0,0,0,1360,0,0,0,802,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,673,308,0,709,1006,1895,0,228,0,0,0,1840,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,608,0,0,0,0,0,0,0,0,0,1573,0,2039,136,540,0,0,0,0,0,0,0,
+897,0,0,938,1878,0,0,0,0,0,0,0,0,0,1469,0,999,0,299,0,0,0,0,0,0,0,578,0,0,0,0,0,
+456,0,0,0,1679,163,693,0,0,0,0,0,0,48,755,0,0,0,0,0,0,0,0,0,0,0,0,338,0,0,0,0,
+1091,0,0,0,0,695,0,0,1464,0,0,0,0,0,975,0,0,335,0,0,1979,0,0,0,0,269,1566,630,
+396,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1815,634,0,0,0,966,0,0,0,0,0,0,0,9,
+412,0,958,0,0,579,382,0,212,0,0,0,0,965,681,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,655,
+0,0,0,0,67,0,0,0,0,0,0,751,0,0,0,0,423,231,0,0,1016,300,0,0,0,0,100,237,0,0,0,
+1370,0,0,0,1208,0,0,0,0,0,1219,129,0,0,0,0,0,0,0,0,0,0,0,0,0,0,199,0,0,427,0,0,
+0,0,949,665,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,712,0,0,0,0,0,1186,0,0,0,0,0,0,0,0,0,0,295,312,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+151,0,0,0,0,588,4,0,0,0,0,0,414,104,0,0,757,263,0,561,0,0,0,320,0,0,0,0,0,0,0,0,
+0,0,0,225,0,0,0,0,37,817,0,974,0,0,0,0,0,0,0,0,0,0,0,0,0,2026,131,235,16,0,590,
+1157,0,0,0,0,0,0,0,0,221,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,140,390,0,0,0,0,
+0,0,0,1144,0,0,0,464,0,0,0,0,0,0,0,0,0,0,0,0,204,407,303,1218,0,0,0,0,5,325,0,0,
+0,0,12,800,0,1783,0,0,0,0,0,0,0,0,0,0,504,621,0,0,0,0,0,0,0,0,0,920,0,376,0,0,0,
+0,0,218,580,0,768,454,0,0,0,0,0,0,0,0,0,0,0,0,676,0,0,0,0,0,0,164,0,0,0,0,0,0,0,
+0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,120,285,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,226,343,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,0,0,1812,0,0,8,0,0,0,21,1125,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,1327,0,0,0,0,575,1598,0,0,0,0,0,0,0,0,0,895,0,0,0,959,0,0,
+0,0,0,1759,173,0,0,0,0,266,261,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1427,0,0,300,1033,0,0,0,0,0,0,0,0,0,0,0,584,0,0,0,0,52,734,
+0,0,217,239,0,1129,0,0,0,0,0,0,0,0,732,20,0,0,0,0,0,0,0,0,0,0,0,418,0,0,0,613,0,
+0,0,0,0,0,0,0,0,632,0,0,85,984,0,0,0,0,909,694,7,1109,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,167,0,0,0,0,280,62,0,0,33,0,0,359,186,980,0,0,0,0,0,0,0,0,0,0,0,585,0,0,0,
+211,0,0,336,145,0,1130,0,873,0,0,840,263,0,0,0,0,0,0,0,0,0,916,0,0,0,0,0,0,0,0,
+0,0,155,0,0,0,461,97,0,0,0,0,0,1356,0,0,0,0,0,0,0,593,0,0,0,0,0,1392,0,0,0,0,
+126,0,0,0,0,1179,0,0,0,0,0,162,0,0,0,0,0,765,0,187,0,1286,0,0,0,0,0,0,0,0,0,635,
+0,0,23,215,0,0,0,1306,0,0,97,716,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,657,0,
+0,0,0,0,0,0,0,299,0,0,0,0,0,0,134,0,0,0,0,0,0,0,0,0,0,0,658,1082,0,0,0,0,0,2002,
+0,0,0,0,0,0,833,248,0,0,0,0,0,1654,0,0,531,0,0,0,0,0,0,634,0,0,0,0,0,0,0,0,0,
+853,573,249,0,0,0,0,0,0,0,0,527,0,0,0,0,1419,0,0,0,0,0,0,20,49,0,0,0,992,0,0,0,
+728,0,0,0,0,0,0,0,0,0,0,0,0,497,1579,0,0,0,0,62,268,0,0,0,0,0,0,0,1201,0,0,0,0,
+0,0,0,0,0,0,0,0,495,193,0,0,0,0,106,0,0,859,0,0,23,0,0,0,0,0,0,0,813,925,0,0,
+223,613,953,0,0,0,0,0,0,0,0,666,0,0,0,0,0,0,0,0,0,670,0,0,40,216,0,0,0,0,0,0,
+259,0,0,0,440,1114,0,0,0,0,0,0,0,0,74,475,0,0,188,139,0,797,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,1572,0,0,0,0,39,0,0,0,0,0,0,0,0,0,0,0,0,1594,0,0,0,0,0,0,0,290,0,232,
+0,0,887,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,521,14,0,0,0,0,0,741,0,0,0,992,0,
+0,0,0,0,0,0,0,111,0,0,425,0,0,0,0,0,789,0,0,0,1593,0,1768,0,0,233,0,0,0,0,943,0,
+0,0,0,0,0,0,955,225,245,0,0,0,0,0,0,241,0,0,0,0,1943,0,0,0,1284,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,709,0,0,0,0,0,0,554,0,0,0,0,0,0,0,0,1564,0,0,0,
+443,0,0,0,0,0,0,280,0,0,0,0,0,0,0,0,729,0,0,0,348,0,0,0,0,0,0,0,758,848,298,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,829,1422,189,121,0,0,632,812,0,0,556,0,0,0,0,0,436,172,
+530,844,232,984,0,0,0,0,0,0,0,0,0,0,147,0,0,0,0,0,0,0,0,537,0,0,0,0,0,859,0,0,
+842,0,0,0,0,0,0,0,0,0,0,1291,0,0,0,0,0,0,0,0,0,0,0,1482,612,392,0,0,0,262,31,0,
+0,0,0,0,0,0,0,0,0,753,549,0,0,0,0,0,0,696,0,0,0,0,0,0,0,834,0,0,0,0,0,771,0,0,0,
+0,0,0,0,0,0,0,0,0,0,921,0,0,0,674,0,0,0,0,0,0,0,0,0,0,308,444,0,0,0,0,0,0,805,
+180,0,0,278,271,0,0,214,505,0,1215,0,0,0,0,0,0,387,271,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,1645,42,92,0,459,0,0,330,1557,0,0,0,0,0,0,0,0,113,18,0,0,0,
+1742,0,0,0,965,0,0,0,0,0,0,0,0,0,0,0,0,0,182,0,0,65,0,0,0,0,0,0,0,0,0,0,0,0,973,
+0,0,0,0,0,328,0,0,588,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1786,
+0,0,962,1985,0,0,0,308,508,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,588,0,0,0,0,0,0,614,793,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,290,0,0,0,0,0,0,0,0,0,0,1136,0,0,0,0,0,0,0,0,0,0,796,719,0,0,
+326,210,0,0,0,701,758,472,0,0,0,1947,278,1079,0,0,0,0,0,0,497,41,0,0,634,46,961,
+0,810,524,0,0,33,0,0,0,0,0,0,0,0,0,0,0,0,532,0,997,0,0,0,0,0,0,0,0,0,0,0,1301,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1298,0,671,0,0,0,306,0,0,0,0,0,0,0,0,0,0,
+693,1823,0,0,0,759,0,0,0,0,0,1932,0,0,0,0,0,0,0,0,0,0,0,0,0,0,88,182,0,0,0,1964,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,521,0,0,0,0,0,0,424,857,0,0,0,0,671,328,0,
+529,0,0,0,0,0,716,0,1509,80,67,0,0,0,0,59,141,0,0,0,0,0,0,783,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1498,0,0,0,0,343,430,803,1183,677,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1357,53,0,0,0,0,590,0,0,0,0,0,0,0,0,0,0,
+0,0,0,329,0,0,0,0,0,0,0,469,0,0,0,0,0,0,0,0,0,0,460,0,0,1743,0,0,963,340,0,0,0,
+0,0,1603,0,0,250,0,0,0,0,0,646,218,0,1794,0,0,0,571,0,455,0,0,0,1012,0,0,0,0,0,
+0,0,0,0,0,0,0,597,161,0,349,0,524,0,0,0,0,0,0,0,0,0,0,0,0,322,432,0,0,0,0,0,0,
+325,223,0,0,0,0,0,566,0,0,0,1394,481,436,0,48,457,610,756,618,0,0,0,755,0,1217,
+0,0,0,0,0,197,0,0,0,0,0,0,0,0,0,0,0,0,0,0,544,492,107,414,0,0,0,0,0,0,0,0,0,0,0,
+1007,0,0,0,0,5,0,0,1580,0,0,0,0,0,0,0,0,0,0,0,0,0,673,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,1843,0,0,0,0,0,0,0,0,0,165,0,0,0,0,0,0,809,885,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,498,0,0,0,306,9,0,0,0,0,0,0,0,437,721,146,0,0,0,0,0,0,0,0,0,0,0,177,0,0,0,0,
+0,0,0,1377,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,200,0,959,0,0,0,1928,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1435,0,481,0,0,0,0,0,0,142,84,0,0,0,0,0,
+1015,0,0,0,315,0,0,0,0,0,0,759,0,0,0,0,0,0,0,0,712,0,0,0,1722,0,0,0,0,0,0,0,0,0,
+0,0,0,222,0,985,1414,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1273,
+538,706,0,0,0,0,0,0,0,0,115,0,0,0,0,0,0,0,0,0,0,1781,0,0,0,0,0,431,97,665,42,
+237,0,0,0,264,0,0,213,0,0,0,0,0,0,0,455,0,0,0,906,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+624,0,574,0,0,0,0,0,0,0,0,0,0,0,0,354,0,0,0,1558,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,
+235,723,1813,0,0,0,957,0,830,0,0,0,0,0,0,0,0,0,0,0,0,23,0,0,496,0,0,0,0,0,0,0,
+547,239,88,0,0,0,0,0,0,0,0,0,1310,0,0,0,0,0,0,0,0,80,1076,0,0,118,0,0,0,479,274,
+0,0,0,0,0,0,0,0,0,0,0,497,0,0,669,261,0,0,0,0,13,0,0,0,0,0,0,791,250,642,0,0,0,
+1429,939,949,0,0,0,0,0,0,0,0,0,0,0,0,0,818,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,982,330,0,0,0,0,545,0,0,0,0,0,0,947,0,1188,0,0,0,0,0,904,0,0,0,0,0,1372,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,693,377,0,0,0,0,0,0,0,0,0,0,0,0,0,0,695,0,0,
+713,386,0,0,0,0,128,1575,0,0,0,0,0,0,424,893,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,904,0,0,0,0,0,552,322,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,1808,49,0,0,0,0,
+1832,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,421,0,0,442,415,0,0,289,
+0,0,0,0,0,206,110,0,0,0,0,0,205,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+19,1539,0,0,0,0,0,1340,0,1194,0,0,0,0,0,0,0,0,549,0,0,0,0,0,0,0,0,1720,0,0,0,0,
+0,0,0,0,0,319,0,0,0,0,112,1180,0,0,0,0,0,0,0,0,0,0,0,967,0,0,0,0,0,0,0,0,0,1940,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,735,0,0,0,0,0,0,0,0,0,897,132,0,0,0,0,0,0,0,
+0,0,0,38,838,0,0,0,379,218,8,660,1017,0,0,0,0,0,0,111,387,647,877,0,0,53,790,0,
+0,0,0,0,0,0,0,458,0,0,0,0,0,0,954,0,0,0,394,0,1367,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,882,0,0,0,0,0,0,0,1409,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,124,342,199,0,0,0,0,
+0,0,0,0,0,0,724,628,0,0,0,0,804,266,0,0,0,0,0,208,0,79,0,0,0,0,0,0,0,0,741,0,0,
+0,0,0,0,0,0,0,0,606,0,1494,821,1553,0,0,135,405,0,0,178,100,0,0,0,0,0,0,0,0,0,0,
+0,0,0,481,0,0,0,1378,0,0,0,0,0,0,0,0,0,0,0,0,0,791,33,1227,857,0,467,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,447,0,0,0,0,0,0,86,128,0,0,0,0,0,0,587,0,0,0,692,1018,0,
+195,0,0,0,0,0,0,0,1546,0,0,0,0,0,0,0,0,0,0,0,684,0,0,345,0,0,0,0,0,0,365,0,1683,
+0,0,472,0,433,0,0,0,0,0,0,0,28,0,0,0,997,0,705,3,0,0,0,0,0,0,0,0,0,229,0,0,0,0,
+102,0,0,0,0,866,1022,0,0,0,0,0,0,0,0,0,55,0,115,0,0,0,0,933,0,0,0,0,0,0,0,702,0,
+0,0,0,0,0,0,1728,26,484,0,0,0,185,618,417,0,803,0,0,0,0,0,0,0,0,0,0,0,1262,0,0,
+0,0,0,0,0,0,0,0,0,0,0,633,0,0,0,0,0,0,0,0,0,0,0,0,0,479,262,0,0,0,0,0,0,830,0,0,
+0,0,26,70,0,0,0,0,0,0,0,0,217,0,640,51,0,0,360,1586,0,0,0,0,0,652,0,0,0,0,0,766,
+0,0,0,0,298,737,0,0,0,0,0,0,0,0,0,0,655,222,906,0,0,1013,991,2009,0,0,0,0,503,0,
+0,0,216,154,0,0,0,716,0,844,0,0,0,0,621,252,0,0,0,0,748,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,103,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,576,0,0,0,648,0,0,0,331,0,0,0,
+0,0,0,0,0,0,0,0,0,632,0,0,0,518,107,0,0,0,0,0,0,0,0,851,0,0,0,0,504,0,0,0,0,0,0,
+0,0,0,0,0,0,7,883,0,0,0,0,0,0,0,922,0,0,0,0,0,0,0,0,91,993,0,0,0,0,0,0,200,131,
+10,0,0,0,0,0,0,0,0,0,0,0,0,0,365,1433,0,0,0,0,28,103,0,0,798,1013,0,0,0,0,0,0,0,
+0,39,1925,0,853,0,0,271,519,0,0,0,0,338,0,0,300,470,419,0,0,0,0,0,0,836,0,0,0,0,
+0,0,1937,0,0,0,0,0,393,0,0,357,0,0,0,0,0,703,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,387,0,0,0,0,0,0,75,708,453,1351,0,303,0,0,772,0,0,0,0,0,0,0,0,749,0,0,
+0,0,0,0,0,0,0,0,0,0,0,1065,0,0,717,226,0,0,0,0,0,890,431,626,0,0,0,0,706,0,0,0,
+51,698,0,0,0,0,0,0,0,0,0,0,0,828,0,0,17,0,0,0,0,1929,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,871,498,0,101,1793,0,0,0,0,0,0,435,0,
+0,0,0,0,966,0,129,1644,0,0,0,0,0,0,0,0,0,0,0,0,0,997,502,0,0,0,0,0,0,0,0,0,0,0,
+0,823,0,1927,0,0,0,0,98,1756,0,0,0,0,0,0,0,0,0,0,0,0,8,0,160,1046,0,492,0,0,0,0,
+0,0,129,45,0,0,0,0,0,0,353,558,0,0,0,0,0,785,0,0,0,1145,189,0,0,0,26,353,0,0,0,
+0,0,2024,0,0,0,606,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,855,0,0,0,0,0,0,0,0,0,0,0,
+0,0,2011,0,0,5,4,0,0,461,764,0,0,0,1449,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1445,0,0,
+0,1168,0,0,0,233,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,216,0,0,0,286,0,0,0,
+3,0,0,0,723,536,0,0,0,0,0,285,0,0,0,560,0,0,0,0,0,690,0,0,0,0,0,1246,0,0,63,0,
+33,0,0,0,0,0,520,1862,0,0,0,0,0,0,0,0,0,0,0,0,630,0,0,0,0,554,0,0,0,0,0,1001,0,
+0,0,0,0,446,0,0,0,0,0,0,0,1313,0,0,837,636,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,278,
+0,0,0,0,0,0,0,0,868,0,0,0,0,1010,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+1231,0,304,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,0,93,1408,794,
+843,704,0,285,114,485,898,145,0,19,2035,0,0,0,1933,0,0,0,0,0,0,0,1728,0,0,0,0,0,
+0,0,0,746,0,0,0,0,0,0,0,995,1964,0,0,0,0,0,0,0,0,0,0,0,1550,0,874,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,1018,0,0,0,814,126,0,0,1264,0,0,814,955,0,0,0,0,0,0,
+0,981,0,0,0,0,0,0,0,0,915,56,0,0,100,0,0,0,0,0,0,0,0,0,638,0,0,0,0,738,0,0,0,0,
+0,0,0,0,0,758,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1112,0,0,214,0,0,0,133,0,196,
+168,0,0,0,0,0,1152,0,1245,0,0,538,169,871,1816,0,0,413,133,0,0,0,978,0,0,43,93,
+371,0,0,0,0,0,0,526,25,0,754,335,0,0,0,0,182,0,0,0,0,0,0,0,0,0,0,0,39,601,0,0,0,
+0,0,0,0,181,370,0,0,1652,358,0,0,0,0,0,0,0,0,0,176,286,0,788,0,0,0,0,0,1223,780,
+254,1003,896,0,0,0,1447,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,744,0,0,0,0,0,126,0,
+41,788,0,0,0,629,0,0,0,0,0,0,0,0,0,0,0,293,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,420,37,1900,0,0,0,0,542,1570,957,0,0,0,0,0,0,
+0,373,31,0,0,0,0,125,325,0,0,0,0,0,0,323,0,0,1547,0,0,0,0,0,0,0,0,0,0,0,0,0,
+1216,0,0,0,0,0,0,198,1905,629,15,0,0,0,0,0,0,20,75,543,1353,0,0,0,533,0,0,6,0,0,
+0,0,0,0,538,0,0,0,0,0,0,0,0,0,0,0,338,0,0,0,0,11,0,0,0,284,659,0,989,0,0,0,0,0,
+0,0,0,0,848,0,0,507,0,0,0,0,0,0,0,0,188,991,884,0,0,0,0,60,959,0,0,0,0,0,1653,0,
+0,922,337,0,638,0,0,500,0,0,0,0,0,0,0,0,0,0,0,166,0,0,0,0,0,0,0,0,0,0,0,0,418,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,760,0,0,0,0,0,0,1277,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,770,0,0,0,0,0,0,0,243,89,0,0,0,0,0,0,0,0,0,1396,0,
+560,0,0,3,1658,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,586,0,0,1271,0,0,0,505,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,637,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1947,
+41,445,0,0,0,0,0,0,0,0,57,189,0,0,371,0,0,0,0,552,0,883,0,923,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,875,0,0,0,1788,49,0,0,0,0,0,
+0,0,0,0,0,0,661,0,0,1945,0,0,0,0,0,794,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,1135,0,0,0,745,0,0,0,0,0,0,0,84,0,0,0,0,0,0,0,410,0,976,0,0,0,0,0,703,0,0,
+0,0,0,0,187,322,0,0,0,227,0,0,0,0,560,0,31,1395,0,0,0,0,0,466,0,0,0,0,643,167,0,
+0,0,1428,0,412,0,0,0,0,0,0,0,0,0,1118,562,0,0,0,0,0,256,0,0,0,0,0,0,1771,0,0,0,
+0,0,1190,132,0,66,0,0,0,0,0,0,0,0,0,0,317,0,0,0,63,0,0,0,0,0,0,0,1475,0,0,0,0,0,
+0,0,288,0,0,0,0,608,0,0,0,0,0,0,0,0,1225,0,1189,0,0,0,0,0,0,0,1468,0,0,0,0,0,
+689,120,0,0,0,0,0,0,0,1,0,329,0,0,0,0,226,0,0,0,0,0,1855,0,0,461,0,0,0,0,1346,0,
+0,0,0,0,85,0,0,299,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1171,0,0,
+0,980,0,0,0,0,0,0,0,0,637,279,0,0,0,0,0,293,0,0,0,0,528,17,0,0,0,0,5,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,601,0,0,0,0,0,0,779,0,
+196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1322,737,752,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,412,192,80,0,0,8,1470,0,0,0,0,0,0,0,0,0,873,0,0,0,0,0,835,0,0,0,0,256,
+38,986,0,0,0,0,0,0,0,0,0,91,257,278,911,0,0,0,0,0,0,0,0,749,151,0,0,0,0,0,0,0,0,
+0,0,0,0,989,0,0,990,0,0,90,194,0,0,0,0,0,425,0,0,0,0,0,774,0,0,0,0,0,0,0,0,0,0,
+646,827,752,0,0,0,662,0,22,21,0,0,0,0,0,0,95,239,0,0,0,431,0,0,0,0,0,874,0,0,
+265,65,0,0,0,1350,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1887,0,0,0,0,0,0,0,809,
+0,696,0,1074,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,630,0,0,802,0,0,0,56,776,0,
+970,0,0,797,0,0,0,0,0,400,0,0,1951,0,0,41,0,11,118,0,0,0,0,0,0,0,0,251,615,0,0,
+0,1044,0,0,0,0,0,0,0,0,0,0,0,225,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,370,0,0,0,0,
+104,48,209,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,930,0,0,0,0,
+0,0,0,0,0,0,0,1286,0,759,0,120,385,0,0,0,429,0,0,0,0,0,0,0,0,820,0,0,0,0,0,0,
+199,0,10,151,0,0,0,761,365,0,0,0,0,0,0,0,0,0,46,1086,0,0,0,0,11,1624,58,344,0,0,
+1008,1868,0,0,0,888,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,711,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,440,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,914,1913,0,958,0,885,0,0,0,0,0,0,0,0,0,0,0,
+0,0,847,276,0,302,65,0,0,0,510,0,1514,0,0,0,0,0,0,152,291,0,0,0,0,0,0,0,0,0,0,0,
+0,282,589,0,0,0,0,0,0,0,0,0,0,0,0,0,130,0,0,463,42,0,0,0,0,0,372,0,0,0,0,0,0,0,
+0,0,680,0,0,0,0,0,0,0,0,977,1997,0,0,0,810,0,0,0,0,0,0,0,0,0,1390,0,0,0,644,0,0,
+867,982,0,0,0,0,0,0,0,540,0,123,0,0,0,1978,0,0,0,0,789,623,0,1723,0,1220,0,0,0,
+0,0,0,0,480,0,0,0,0,0,0,0,0,0,0,0,888,0,0,0,0,0,0,0,0,0,0,0,0,299,1995,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,788,179,0,0,0,0,0,0,431,156,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1373,39,80,196,0,0,507,0,0,0,646,0,0,0,0,
+0,1214,0,0,0,0,926,0,0,0,1,114,0,0,0,0,0,446,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,490,0,0,0,491,0,1584,0,0,507,250,0,0,0,158,
+10,362,1,0,0,0,0,0,0,0,0,0,408,228,860,480,0,779,0,0,0,557,0,0,142,197,0,0,0,0,
+0,0,0,0,0,0,0,1490,11,378,316,1057,0,0,18,579,299,1546,0,177,0,0,0,0,0,0,0,0,0,
+411,0,0,0,0,727,439,0,0,0,0,0,1528,0,0,0,0,0,0,58,0,482,0,0,0,505,1952,0,0,0,0,
+0,0,0,0,0,0,0,242,0,0,0,0,0,0,0,953,0,0,0,0,802,0,0,0,0,0,0,0,0,0,0,290,0,0,791,
+52,0,0,0,0,0,0,0,0,0,0,0,112,0,0,0,0,0,1028,0,0,138,0,0,0,0,1811,0,0,0,0,0,0,
+934,1821,0,0,0,0,371,38,0,0,0,1296,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,723,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1330,0,0,0,0,0,0,0,1255,296,109,0,0,0,0,0,660,0,0,0,0,270,591,0,
+0,0,0,0,0,0,1090,81,0,0,0,0,391,0,0,0,0,249,322,0,0,0,0,0,0,0,1412,0,0,0,0,0,0,
+0,0,0,0,526,632,0,0,0,0,0,0,235,144,0,0,0,0,0,940,0,0,0,52,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,309,196,0,0,0,0,0,1912,0,1290,0,686,0,0,625,0,0,0,0,0,0,0,0,0,0,0,412,0,
+0,0,0,43,0,0,0,0,11,967,758,0,0,0,0,0,0,0,0,0,0,0,0,0,0,220,0,0,0,0,0,0,0,0,0,0,
+873,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,890,0,0,2,0,0,0,0,0,0,0,0,1774,
+393,263,0,0,0,0,0,0,818,456,0,0,251,178,393,97,0,0,0,0,0,674,168,0,0,0,0,0,0,0,
+159,1639,0,0,0,0,0,0,0,0,59,934,0,191,0,0,0,0,346,165,0,877,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,128,0,0,0,0,0,0,1297,0,0,0,0,0,0,164,0,0,0,15,132,241,1073,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,228,324,53,0,0,910,0,0,0,0,0,0,0,0,734,705,
+217,73,0,0,0,0,0,0,0,0,636,389,0,1409,0,0,0,0,0,893,0,0,0,0,21,0,0,0,0,0,0,0,0,
+0,0,0,0,0,721,0,0,0,959,0,0,0,0,1433,0,0,0,0,0,0,0,0,0,0,0,0,174,189,0,0,0,0,0,
+0,0,0,0,0,22,2,0,0,815,354,0,0,0,0,425,0,411,60,13,1611,0,0,0,0,0,0,0,0,0,0,0,0,
+0,1478,596,0,0,398,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,1159,0,0,0,0,0,
+592,223,0,0,0,0,0,0,0,245,64,0,0,0,0,278,0,604,0,0,1502,265,0,0,0,0,0,0,0,310,
+1763,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,129,0,0,0,0,0,0,0,0,0,1356,0,0,0,0,0,0,0,
+0,505,0,0,0,0,0,0,0,1000,0,0,966,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,839,0,0,0,0,0,0,
+0,0,0,0,0,0,0,637,0,0,0,0,0,0,0,0,0,0,0,0,0,0,590,0,0,0,0,280,0,0,0,1386,0,0,0,
+281,0,1064,0,0,0,0,0,917,0,0,15,555,0,0,1014,1883,0,0,0,965,0,0,117,33,0,0,0,
+801,0,0,0,0,0,877,0,824,0,0,0,0,0,0,0,0,0,0,0,365,0,0,0,0,0,0,774,7,0,430,0,0,
+231,360,0,0,0,0,0,0,0,0,822,740,0,0,929,1485,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,852,0,0,0,0,17,0,0,0,0,0,0,1001,0,0,0,0,35,831,0,0,384,457,0,0,0,1351,0,27,
+0,0,984,0,264,552,0,401,0,0,0,710,0,1211,0,0,11,205,0,0,0,0,0,0,0,0,0,0,0,0,5,
+579,0,717,0,0,1011,0,0,0,0,0,0,0,0,0,0,0,0,0,0,805,0,0,0,0,0,0,0,0,0,0,0,489,0,
+0,0,1024,0,0,0,0,0,0,0,0,0,892,0,0,0,0,0,0,0,0,0,0,0,0,473,0,0,0,659,864,0,0,0,
+0,0,0,152,819,0,51,0,0,0,0,0,0,0,0,0,0,130,0,0,0,0,0,229,0,0,0,0,674,0,0,0,0,0,
+0,0,0,0,770,52,79,0,0,0,1666,0,409,0,0,0,0,0,0,0,195,0,688,0,0,0,0,0,0,0,0,0,0,
+0,889,174,160,0,0,0,0,0,0,0,0,0,0,0,0,0,872,0,918,569,268,0,0,0,1224,0,1361,0,0,
+0,0,0,0,0,0,0,374,0,0,0,0,0,731,0,0,0,0,190,0,0,0,0,0,0,0,202,506,444,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,835,0,17,1526,0,0,0,0,0,477,0,0,
+994,1374,76,0,0,0,0,0,0,0,355,287,0,1389,0,0,0,0,0,0,455,384,0,0,0,264,0,0,0,0,
+0,0,0,0,0,0,0,0,1001,0,0,0,0,0,0,0,0,0,0,0,0,28,0,0,0,851,175,359,0,0,0,0,0,0,0,
+0,287,740,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,857,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+819,1402,0,0,0,0,0,0,174,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1649,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,655,573,0,0,0,0,0,0,0,0,128,351,0,0,0,0,0,0,
+0,0,0,0,0,918,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,687,0,0,0,0,0,0,0,0,0,1525,
+0,0,0,1009,0,0,0,0,0,0,0,340,0,0,0,0,0,0,0,0,0,0,861,0,176,0,0,0,0,0,0,0,0,0,96,
+985,0,615,0,0,0,0,0,0,0,1919,0,0,0,0,0,1131,0,0,0,0,0,0,0,247,0,0,0,0,27,23,0,0,
+0,0,0,0,0,0,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1015,0,0,0,0,0,1088,0,0,
+0,0,0,1585,0,0,0,0,227,0,0,0,478,360,0,0,0,95,0,0,0,0,0,0,699,0,0,0,26,0,0,0,0,
+1119,0,0,0,739,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,741,67,0,0,0,0,0,0,464,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,0,96,0,0,0,26,342,0,0,0,0,0,0,203,0,0,449,0,
+0,0,0,0,0,0,0,0,0,256,311,0,0,0,0,0,0,758,0,0,0,0,0,0,0,0,827,0,0,0,0,581,64,0,
+1047,0,0,0,0,0,288,0,0,0,0,0,1375,0,0,0,0,0,0,0,0,0,0,0,1309,0,0,0,0,0,0,0,0,
+376,12,0,0,0,0,0,154,0,1520,0,1753,95,502,0,0,0,0,0,0,0,269,291,1197,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,1341,0,1017,0,0,0,0,0,0,0,
+0,857,1810,533,0,0,1453,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,836,211,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,19,0,156,0,0,0,0,1009,0,0,0,0,0,0,0,0,0,0,0,0,0,820,0,0,
+0,0,0,0,0,0,0,228,0,0,0,1131,0,1276,0,0,0,0,0,0,0,0,0,0,0,0,849,1792,0,0,389,
+291,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,525,0,0,
+0,453,0,0,0,0,666,0,0,0,422,0,355,0,0,0,0,165,0,260,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,865,0,0,0,0,0,0,0,1625,0,0,0,234,0,1383,0,0,0,0,0,0,0,0,306,0,0,0,802,1921,
+0,0,0,0,0,0,180,0,0,0,0,1312,814,0,0,0,0,0,0,0,0,0,0,707,0,0,0,1493,11,61,733,0,
+0,0,341,0,0,0,98,0,0,0,0,0,0,0,0,0,0,0,1014,0,0,0,0,0,0,0,142,102,0,0,30,0,0,
+823,0,1045,0,0,0,1930,0,1512,0,0,0,0,0,0,0,87,0,1243,245,0,0,0,0,0,0,0,48,68,0,
+0,0,0,0,0,0,0,126,77,625,938,0,0,351,0,0,0,174,1668,0,707,0,0,0,0,0,0,0,0,0,0,0,
+403,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,282,0,0,0,0,0,0,8,44,0,0,363,115,0,0,0,0,0,0,
+0,0,0,0,0,0,545,761,0,0,835,1254,0,0,0,0,930,1936,0,0,0,0,0,0,0,0,653,0,0,0,0,0,
+344,0,0,1483,673,185,0,0,460,93,753,478,0,0,0,0,0,1020,0,0,0,0,0,0,0,103,0,0,0,
+499,0,0,0,0,0,0,207,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,968,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,3,0,0,0,0,399,0,0,0,0,224,563,0,0,0,0,0,704,0,0,0,0,0,0,0,0,0,0,0,
+1559,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,861,0,0,0,0,946,333,746,0,0,0,0,0,
+0,0,910,0,0,0,0,0,0,0,0,0,0,0,0,0,652,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+1393,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1514,0,0,0,0,201,0,510,717,0,0,528,0,0,0,0,
+20,0,0,0,1251,0,0,0,1163,0,0,0,307,0,0,0,0,0,1091,0,0,0,0,0,0,0,0,0,0,0,429,0,0,
+0,881,0,0,0,0,0,621,0,0,0,0,0,0,0,736,0,348,0,868,0,0,0,0,433,0,0,0,771,1495,0,
+0,0,0,215,0,0,0,0,0,124,0,0,0,0,0,0,0,0,0,0,0,55,0,0,0,0,0,0,0,112,62,0,856,270,
+0,572,0,0,0,0,939,0,0,0,0,0,0,0,352,0,0,0,0,0,0,0,0,0,647,0,0,0,0,10,0,0,0,0,0,
+0,0,220,0,0,0,0,0,0,0,0,0,0,0,0,0,464,0,0,109,0,0,0,1746,0,0,0,515,0,0,0,566,0,
+0,0,0,0,0,67,40,0,0,722,992,0,0,923,0,0,0,0,0,0,1145,0,0,0,0,0,0,0,0,0,0,0,568,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,247,0,0,0,0,645,0,0,328,0,0,0,0,0,0,0,0,0,0,0,0,
+1363,0,0,0,0,0,1280,0,0,0,0,0,0,0,0,0,0,7,28,360,162,0,0,0,0,0,0,0,0,0,0,0,764,
+0,0,833,862,0,856,0,0,0,0,0,0,736,92,0,0,948,1944,0,1479,63,590,0,0,0,1521,0,0,
+0,709,0,0,61,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,483,0,0,0,0,1213,
+0,0,0,0,29,1022,0,1712,0,466,0,0,0,0,0,0,0,0,0,0,0,0,0,731,0,0,0,0,0,0,171,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,241,0,0,0,0,0,0,0,0,0,0,0,964,2005,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1100,0,0,0,954,0,0,0,0,0,0,0,0,0,1958,0,0,34,549,994,0,0,449,
+137,850,0,0,670,146,0,0,0,0,518,159,0,0,0,0,0,0,0,0,151,0,0,1027,0,0,0,0,0,0,0,
+0,0,0,983,0,0,0,0,993,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,501,0,0,0,
+0,0,0,0,0,0,452,0,0,0,0,0,0,0,0,0,0,233,149,0,0,0,0,0,0,0,0,582,0,0,0,801,0,0,0,
+0,0,0,70,0,0,369,0,36,0,0,0,0,0,0,0,204,721,430,241,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1817,16,1078,1021,0,0,
+406,0,0,0,0,0,69,0,0,0,0,0,1830,0,0,0,824,0,0,0,0,0,0,0,0,0,826,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,816,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1000,717,1845,0,423,0,0,
+0,0,0,0,0,0,510,0,0,1048,0,0,0,618,0,0,0,520,0,0,0,0,990,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,321,0,0,0,0,0,0,0,1135,0,0,921,0,0,0,24,397,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,856,0,0,0,139,282,981,0,288,0,0,0,1890,651,56,0,0,0,0,0,0,0,
+0,261,0,0,0,0,0,0,0,0,0,0,0,617,1403,0,1205,0,0,563,0,0,0,0,0,0,0,0,333,0,0,0,0,
+0,369,0,0,0,0,0,0,0,0,0,622,0,0,0,1407,0,0,0,0,0,0,0,0,0,0,0,0,624,160,0,363,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,619,0,174,292,0,0,656,616,0,0,0,685,0,0,0,0,0,0,0,0,0,0,0,0,0,647,0,0,0,631,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1267,0,0,0,1797,0,0,0,1684,0,0,469,0,531,
+1230,73,0,0,0,0,0,0,0,0,0,268,0,0,0,0,0,102,558,109,65,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,595,0,0,0,0,0,374,1832,0,0,0,0,0,0,16,0,405,6,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,881,0,1495,0,0,0,0,0,0,0,0,0,142,0,0,0,0,0,0,0,0,0,0,21,466,23,
+257,0,0,0,0,0,0,77,404,0,0,0,0,0,0,712,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,860,
+1848,0,0,652,629,0,0,0,0,13,377,0,1842,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1501,0,
+0,0,1906,0,0,0,0,0,0,0,0,0,0,0,0,0,491,234,171,0,0,0,0,631,1186,0,0,0,0,0,0,0,0,
+0,0,0,0,931,0,170,0,0,0,0,0,0,0,0,0,0,1587,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+765,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,424,0,0,714,0,0,0,0,685,0,0,0,0,0,
+0,285,0,0,0,0,0,0,429,0,0,0,0,0,0,0,0,0,0,71,18,0,0,0,0,0,0,0,0,0,0,116,828,0,0,
+0,0,0,0,289,0,0,0,0,0,0,0,0,675,0,0,0,1424,0,0,0,0,0,647,0,0,0,1334,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,36,209,0,0,0,0,0,0,0,342,0,0,0,928,0,0,0,0,0,1838,118,856,654,
+318,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,915,895,454,0,0,513,1425,0,0,
+0,0,0,0,791,0,153,0,0,0,0,0,0,796,909,445,345,0,0,0,0,0,0,0,0,578,0,0,0,1387,0,
+0,0,555,0,0,0,0,0,0,766,0,0,0,0,0,0,0,0,0,0,541,0,0,0,0,0,0,0,0,0,0,0,0,0,880,0,
+0,0,0,0,1506,0,0,983,0,768,0,0,0,0,584,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,737,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,226,30,426,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,462,0,0,0,385,0,398,0,0,0,0,0,0,
+0,0,0,347,0,0,0,0,125,1259,644,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,469,0,0,0,0,0,
+1367,0,0,0,0,0,0,0,0,0,0,0,719,0,0,0,0,0,0,0,0,0,0,0,0,0,1423,0,0,0,0,0,0,0,0,0,
+749,0,0,0,0,546,645,0,0,0,0,0,0,277,0,0,1275,0,0,0,0,0,0,0,453,536,555,0,0,987,
+1107,0,0,90,0,0,0,0,0,0,0,0,860,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+257,0,1768,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1071,0,0,0,0,0,0,0,0,0,0,0,0,0,83,
+0,835,0,0,0,0,0,0,0,2006,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,696,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,95,1718,0,0,0,0,0,0,0,26,0,550,0,0,0,0,0,901,0,0,0,0,0,
+0,822,0,0,122,0,0,0,807,0,0,0,0,0,262,0,620,601,34,0,0,170,0,0,0,0,537,0,0,0,0,
+0,0,0,0,0,332,0,0,208,1909,182,261,0,0,0,1721,0,0,0,0,0,933,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,1609,0,895,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,812,0,0,942,1916,0,0,0,0,
+0,0,0,778,0,0,0,137,0,1314,0,0,0,0,0,0,0,1661,0,0,0,0,0,0,0,1591,0,0,0,0,0,0,
+820,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,185,89,0,1160,230,6,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,63,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1740,0,0,177,
+170,0,1961,0,0,0,0,0,0,0,0,0,0,0,0,91,0,17,44,0,0,0,0,0,0,0,0,0,270,0,296,0,0,0,
+0,0,0,0,1523,0,0,0,0,0,0,0,0,0,0,757,7,0,0,0,0,0,0,0,0,0,0,530,588,0,0,0,0,0,0,
+0,0,0,786,0,0,0,0,0,580,627,88,447,57,0,0,0,0,0,0,0,0,845,735,0,0,0,0,0,31,15,0,
+460,521,12,424,0,0,0,1302,0,0,0,0,0,0,0,595,0,0,0,13,548,97,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,1472,452,1767,0,0,0,0,0,0,0,0,0,0,115,0,0,0,0,0,0,1543,0,1111,0,0,0,0,
+1,0,359,488,0,267,0,0,0,1983,0,0,0,0,0,0,0,1155,0,1575,0,1438,31,0,0,377,101,0,
+0,0,0,0,0,0,0,0,0,0,0,0,476,0,0,0,0,0,0,0,0,2023,0,0,0,0,0,1836,0,0,0,0,35,843,
+0,0,0,0,0,0,0,554,0,0,0,536,625,207,0,1371,0,0,0,424,785,336,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,896,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,750,0,0,0,0,238,0,0,
+0,0,0,383,0,0,0,0,0,0,0,0,603,725,11,0,0,0,0,0,0,0,0,0,476,0,0,0,0,0,1552,0,0,0,
+0,0,0,0,680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,435,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+1431,0,0,13,112,0,0,356,0,0,0,0,0,0,0,0,0,0,1963,0,0,0,1244,18,0,0,0,0,0,0,867,
+0,0,0,0,0,0,50,708,73,592,0,502,0,0,0,0,0,0,161,347,0,0,0,0,470,33,0,246,571,10,
+0,465,614,0,237,0,0,0,0,0,24,18,0,506,0,0,0,0,0,0,33,309,0,0,0,0,0,0,0,0,0,0,
+140,0,0,0,0,1056,0,0,0,1704,0,0,0,0,0,0,0,1036,0,0,0,0,0,0,0,0,0,1315,432,86,
+264,524,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,107,0,0,0,0,0,123,927,0,0,957,1149,0,0,
+0,0,0,778,0,502,196,0,0,0,0,1312,0,0,0,0,0,0,0,855,0,0,0,0,0,0,0,0,0,0,45,1400,
+0,0,0,1003,0,0,0,0,0,1097,0,0,0,0,0,0,0,0,545,612,0,0,0,0,0,0,0,0,0,0,0,0,54,0,
+0,0,0,172,0,0,0,1029,0,0,0,0,0,0,0,0,0,568,0,0,0,732,617,0,0,974,94,989,733,0,0,
+0,0,0,0,1789,0,0,665,2015,0,0,0,0,0,0,806,287,0,0,0,0,0,1539,0,0,0,0,0,0,0,0,0,
+0,182,1563,0,0,0,0,0,0,0,0,0,484,0,0,0,0,0,1623,0,0,0,0,0,0,0,0,878,1833,0,1569,
+0,0,0,0,0,0,0,0,93,0,715,994,0,0,0,0,0,63,0,591,0,0,0,0,0,0,0,749,0,0,0,0,547,
+366,0,0,0,1747,0,0,0,0,0,0,0,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1463,0,772,
+893,0,0,0,48,0,0,941,0,0,690,1785,106,440,0,0,0,0,0,0,0,0,0,0,32,0,332,216,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,852,0,
+0,416,564,0,918,0,1764,0,0,3,0,0,274,0,0,0,0,501,0,0,0,0,0,0,0,851,743,0,49,0,
+879,0,0,47,0,0,0,0,0,0,865,0,1202,0,0,0,0,0,0,47,272,0,0,0,0,0,0,0,0,0,0,0,1455,
+0,0,0,0,891,1911,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,761,0,0,0,0,0,0,0,0,0,407,0,
+183,0,0,490,0,0,0,0,0,0,0,35,731,0,0,0,0,0,0,0,819,0,0,0,0,0,0,0,0,0,0,0,0,0,
+575,0,0,0,0,45,818,0,0,77,222,0,0,0,0,849,1880,0,0,0,633,0,1308,0,0,0,0,0,0,0,0,
+0,0,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,817,0,0,0,0,0,0,0,0,0,882,0,0,0,914,0,0,0,0,
+0,0,0,0,0,0,865,0,0,426,399,58,0,0,0,0,0,0,538,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,876,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139,566,0,63,12,0,0,0,
+0,0,0,0,0,0,0,0,0,0,3,114,0,0,0,0,0,0,0,0,576,0,0,0,0,0,0,0,0,933,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,692,0,0,0,0,0,0,0,0,0,0,0,0,752,0,0,0,0,
+0,0,0,0,375,0,1011,0,0,96,0,0,0,0,0,0,0,0,0,148,0,0,0,0,0,0,0,0,0,0,0,337,56,
+666,0,246,394,0,0,0,0,0,0,0,0,437,0,0,0,506,0,0,0,0,1003,0,1163,0,328,0,0,0,0,0,
+0,0,0,1000,0,0,0,0,0,744,101,0,0,0,0,0,726,0,0,176,0,146,9,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,839,0,0,0,0,0,0,223,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,246,1931,29,0,0,1771,0,0,0,0,0,846,6,157,0,0,0,0,0,0,0,0,0,875,0,0,477,
+773,177,639,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1747,0,0,0,0,158,873,0,659,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,391,0,0,0,0,0,0,0,0,0,0,0,0,668,883,0,78,628,0,0,0,
+0,0,0,0,0,0,0,0,0,1460,0,962,0,0,0,0,0,460,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,199,0,
+0,0,388,474,0,271,0,333,608,0,0,0,0,0,0,49,0,988,0,707,617,0,0,0,0,0,0,0,756,0,
+0,0,0,0,1583,0,0,0,0,0,0,0,0,0,0,285,0,0,0,0,0,0,0,0,0,0,0,0,0,0,344,0,0,0,0,0,
+0,0,0,515,1709,0,0,0,0,0,0,0,0,404,0,0,0,0,500,0,0,0,0,0,0,0,0,0,68,216,0,0,0,0,
+0,0,0,488,353,0,0,177,236,0,0,458,490,0,0,0,0,0,0,756,1504,0,757,0,1735,0,0,108,
+598,0,0,0,0};
+BROTLI_INTERNAL const uint8_t kStaticDictionaryHashLengths[32768] = {
+8,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,0,12,0,0,0,0,4,22,5,0,
+4,0,0,0,0,0,0,0,0,0,0,0,0,14,6,0,0,0,5,0,0,0,0,0,0,0,7,13,0,0,4,0,0,0,0,0,0,0,0,
+0,6,0,0,0,0,8,0,0,0,0,0,0,7,0,7,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,4,0,0,0,4,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,10,4,0,5,13,7,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,6,0,0,8,7,0,0,9,0,8,0,0,0,0,0,0,6,0,
+0,9,0,0,0,11,0,0,6,8,7,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,7,0,0,0,6,8,0,0,0,0,0,
+0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,9,0,0,0,8,4,13,7,0,0,0,0,0,
+7,0,5,0,0,0,0,8,5,0,5,0,0,8,7,0,0,0,0,0,0,0,0,0,0,9,0,0,0,8,0,0,0,10,4,0,5,0,4,
+0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,6,0,6,0,0,0,0,8,7,0,4,9,4,0,0,0,0,0,0,
+9,0,0,0,8,5,0,0,0,6,0,0,0,0,0,0,0,0,0,7,18,0,0,0,0,4,9,0,0,4,0,6,0,0,0,6,0,6,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,6,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,5,8,7,0,0,0,
+0,9,0,0,0,0,0,0,0,8,6,10,6,0,0,0,4,0,6,8,6,0,0,0,4,0,0,0,0,0,5,0,0,0,6,0,0,0,0,
+10,0,12,7,0,0,0,0,0,4,0,0,0,0,0,5,0,0,8,7,0,0,0,0,0,0,0,0,9,5,0,0,0,0,0,0,0,0,0,
+0,0,0,0,6,11,0,0,0,0,0,0,0,0,0,8,7,0,0,10,0,0,0,0,0,0,0,0,6,10,0,17,0,8,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,8,6,9,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+7,0,0,11,4,0,5,0,0,0,0,0,0,0,0,0,0,10,5,0,6,8,5,0,0,0,0,0,0,0,0,0,0,11,5,0,0,0,
+0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,9,0,0,0,0,5,0,0,0,0,0,0,0,0,0,6,0,0,8,7,0,0,0,0,0,
+0,0,0,0,0,0,5,0,0,0,6,0,0,10,0,0,0,20,0,0,0,0,0,0,0,0,6,9,5,0,0,0,0,10,4,8,0,0,
+4,13,0,0,0,0,0,0,0,9,0,9,0,0,0,0,0,0,0,0,0,0,0,0,4,8,6,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,12,0,0,4,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,12,5,0,0,10,4,10,7,13,
+0,0,0,0,0,0,0,0,6,0,6,0,6,0,0,0,0,0,0,19,0,0,4,12,6,9,0,0,0,0,4,0,4,11,0,0,0,0,
+0,0,0,12,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,4,0,0,0,0,0,0,0,0,0,6,0,0,0,0,
+0,5,0,0,0,0,0,6,0,0,0,6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,9,6,0,0,0,0,0,4,0,4,0,0,0,0,0,0,0,0,0,4,0,0,0,
+6,0,0,0,0,0,0,0,0,0,0,13,6,0,0,0,0,0,0,0,0,0,0,0,6,8,0,0,0,0,0,0,0,0,0,0,6,0,0,
+0,0,0,5,0,0,0,0,14,4,0,0,0,4,12,5,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,8,6,0,
+0,0,0,0,0,12,0,9,6,0,0,0,0,13,0,0,5,0,0,0,0,0,4,0,6,0,7,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,13,0,9,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,5,0,0,0,6,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,6,0,6,0,0,0,0,0,0,0,0,8,7,8,4,0,0,0,0,0,0,0,0,0,0,0,7,0,7,0,0,0,4,0,
+0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,8,6,8,4,0,0,0,0,0,6,0,7,0,
+0,0,0,0,0,0,0,0,0,10,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,7,0,0,0,0,0,0,9,5,0,0,
+0,0,0,7,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,9,4,0,0,0,0,0,0,0,4,
+12,5,11,0,0,0,0,0,0,0,0,0,8,7,0,5,0,0,8,7,0,5,0,0,0,0,8,0,0,0,0,7,0,4,10,0,0,0,
+0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+13,5,0,0,0,4,0,0,0,0,0,6,0,0,0,0,0,0,14,5,0,0,0,7,0,0,10,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,6,0,4,0,5,0,0,0,0,8,5,0,0,0,0,0,0,9,5,9,0,0,0,0,0,0,0,0,6,9,0,
+0,4,0,0,0,7,0,0,0,6,0,0,10,4,0,0,0,0,0,6,0,0,10,0,0,0,8,5,0,0,0,0,0,0,0,0,10,0,
+0,0,0,0,18,4,12,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,6,0,0,0,0,8,7,0,0,0,
+0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,8,4,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,
+0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,8,0,0,0,0,0,0,6,0,0,0,4,10,5,0,0,0,0,0,0,0,0,0,0,
+0,4,8,7,0,0,8,6,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,6,0,
+0,0,0,8,6,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,6,0,7,0,0,0,0,0,0,
+0,0,0,0,0,6,0,0,0,7,0,0,0,0,0,0,8,7,0,0,0,0,8,0,12,6,0,6,0,0,0,0,9,7,11,7,0,0,0,
+0,0,0,0,0,0,0,0,0,11,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,8,7,0,0,10,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,
+0,0,0,6,0,0,0,7,0,4,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,14,0,0,0,0,0,8,4,0,4,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,20,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,12,5,0,7,0,5,0,0,10,0,0,7,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,6,0,4,9,7,0,0,0,
+0,0,7,0,0,0,0,0,0,10,0,9,0,9,0,0,0,0,0,0,0,0,4,9,0,0,0,0,6,0,0,0,0,0,0,0,0,11,4,
+0,6,0,0,0,0,0,0,8,0,8,0,0,0,0,0,0,0,0,0,0,4,0,0,0,5,0,0,0,0,0,0,0,0,13,6,0,0,11,
+0,0,0,0,0,0,0,9,7,0,0,0,0,0,0,0,0,0,0,0,6,18,0,0,4,0,0,0,0,0,0,0,6,0,0,0,0,0,0,
+0,5,0,0,0,0,0,0,0,0,9,7,0,0,0,0,0,0,0,6,0,0,0,0,9,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,11,7,0,0,0,0,0,6,0,0,0,7,0,0,0,0,0,0,0,0,11,
+4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,4,0,0,0,0,8,
+6,0,0,0,0,0,0,9,6,0,0,0,0,0,4,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,
+0,6,0,6,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,6,0,6,0,0,10,6,0,0,0,7,0,0,8,0,8,7,0,
+0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,6,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,9,0,0,0,0,6,0,0,0,0,0,0,0,5,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,9,6,0,
+0,0,0,8,7,0,0,0,0,0,0,0,0,12,0,12,0,0,0,11,6,0,5,0,0,12,0,12,5,0,7,11,6,0,0,11,
+0,0,0,12,0,0,4,12,7,8,6,0,0,0,0,8,5,0,0,0,0,0,0,0,4,11,0,0,6,0,7,0,0,0,0,0,0,0,
+5,0,6,0,0,0,0,8,0,10,0,0,0,0,0,0,0,0,0,0,0,9,7,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,
+0,0,0,0,0,0,0,0,0,11,7,0,0,0,0,0,0,10,0,0,5,0,0,12,6,0,0,0,0,0,0,10,6,0,0,0,0,8,
+6,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,5,0,0,0,0,11,0,10,6,0,0,8,6,0,0,0,6,0,7,10,6,0,
+0,0,7,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,10,7,0,0,0,0,
+10,6,0,0,0,0,0,0,8,5,11,0,8,4,0,0,0,4,0,0,0,0,9,4,8,0,0,0,0,0,0,0,11,6,0,0,0,0,
+10,7,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,7,0,0,0,0,9,6,0,5,0,7,0,0,0,0,0,7,0,0,11,0,0,
+0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,
+0,0,0,0,13,0,8,6,13,0,0,0,11,7,0,7,0,6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,9,6,0,0,0,0,0,0,0,0,0,6,0,0,9,6,0,6,0,0,0,0,0,5,0,0,0,0,0,0,0,0,
+0,0,0,0,0,5,9,0,0,0,0,0,0,0,0,0,0,4,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,9,7,0,7,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,
+5,11,5,0,0,0,0,0,0,0,0,0,4,0,7,0,6,0,0,0,6,20,0,0,0,10,7,0,5,14,4,0,0,0,0,0,0,0,
+0,0,6,0,0,0,0,8,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,
+0,0,6,0,4,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,9,7,0,0,11,6,15,0,0,0,0,0,
+10,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,7,0,0,0,0,0,0,0,0,9,7,13,0,0,0,0,0,
+0,7,0,0,8,6,0,0,0,0,0,0,0,0,9,4,0,0,0,0,8,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,5,0,0,0,0,0,0,0,0,0,0,0,0,8,5,0,4,0,0,0,0,0,0,0,0,0,0,12,6,8,0,12,0,0,7,0,0,0,
+0,0,5,10,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,
+14,0,0,0,0,0,0,0,0,0,0,0,0,5,0,5,8,7,10,7,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,6,18,6,
+14,7,0,0,0,0,0,0,0,0,11,6,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,6,0,0,0,0,0,0,0,6,0,0,11,7,0,0,10,7,0,0,0,6,8,6,0,0,0,0,0,0,0,6,0,0,
+19,0,0,0,9,5,0,0,0,0,0,0,11,7,0,0,0,7,0,6,0,0,11,0,0,0,0,4,8,0,0,0,0,0,0,0,0,6,
+0,0,0,0,0,6,0,0,8,4,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,7,
+0,7,0,0,0,7,15,0,0,5,0,0,0,0,10,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,7,0,0,
+0,0,0,0,0,0,9,6,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+11,7,0,0,0,0,0,0,0,6,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,
+0,0,5,0,4,0,0,0,4,0,4,0,0,0,0,0,0,0,0,0,6,0,0,0,0,11,6,0,0,8,5,14,0,0,4,0,0,0,7,
+17,0,0,0,0,0,0,0,13,5,0,0,0,0,0,5,0,0,0,5,0,0,0,0,16,6,0,4,0,0,0,0,0,0,12,0,0,0,
+0,0,0,6,0,0,0,0,0,0,0,0,0,0,12,5,0,5,0,6,10,0,12,0,0,0,0,0,0,0,0,7,0,0,0,0,8,4,
+0,0,0,0,0,0,0,0,0,0,8,7,0,0,8,0,0,0,8,0,0,6,0,7,0,0,0,5,0,6,0,4,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,22,0,0,0,0,0,0,0,0,7,0,0,0,0,0,6,0,0,0,
+0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,18,0,0,0,9,4,0,0,8,0,9,7,0,0,0,0,0,0,8,6,0,0,0,0,
+0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,9,7,0,0,0,6,0,0,14,0,0,0,0,
+0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,7,10,4,
+0,6,0,0,0,0,0,0,8,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,9,6,0,0,0,0,0,0,
+0,0,11,6,12,7,0,0,0,0,0,0,0,6,0,5,0,0,0,0,0,0,9,6,11,6,0,0,0,0,9,5,0,0,0,0,0,0,
+0,6,8,5,0,0,0,0,8,0,10,0,0,0,0,0,9,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,
+5,10,7,0,0,0,5,8,7,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0,0,0,0,0,4,8,7,0,0,0,6,0,0,
+0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,7,0,6,0,0,0,0,0,0,0,0,0,0,0,0,22,
+0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,5,0,0,0,0,0,0,0,
+0,0,0,0,0,17,0,0,6,0,6,12,4,19,6,0,0,0,0,16,0,0,0,0,7,15,7,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,4,10,4,0,0,8,7,0,7,0,0,9,
+4,0,6,0,0,0,4,0,5,0,0,0,7,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,7,10,0,0,0,0,0,11,7,0,0,
+0,0,12,6,0,0,0,0,0,0,0,6,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,
+0,0,0,0,0,0,0,0,0,10,4,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,8,7,0,0,
+0,0,0,0,0,6,0,0,0,4,0,0,11,4,0,0,12,7,0,0,0,0,9,0,0,6,0,0,0,0,0,0,0,0,0,5,0,0,0,
+4,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,0,9,4,0,6,0,0,0,0,0,4,
+0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,6,0,0,0,5,0,0,0,0,0,0,0,0,0,7,9,6,0,7,0,
+0,0,0,0,0,0,6,0,0,0,0,8,6,0,0,0,0,10,6,11,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,5,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,5,0,4,8,0,0,0,0,0,9,7,0,0,0,0,0,0,
+13,5,0,0,0,0,8,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,8,5,0,0,11,7,0,0,0,0,0,0,8,6,0,
+0,0,0,0,7,0,4,0,0,0,0,0,0,0,5,0,6,0,5,0,0,0,0,0,0,0,0,0,0,0,0,10,4,9,0,0,0,0,0,
+0,4,0,0,0,0,10,5,10,7,0,0,0,0,0,0,0,0,16,7,0,0,0,0,0,7,0,0,0,0,11,0,0,0,0,0,0,0,
+0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,5,0,4,0,0,0,7,0,0,0,0,0,0,13,0,0,
+0,0,0,0,0,0,0,0,7,0,4,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,13,7,0,7,0,4,16,0,0,0,0,6,8,7,9,7,0,0,0,0,8,6,0,0,0,0,0,0,0,0,0,0,0,0,
+0,6,0,0,8,5,0,4,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,5,11,7,0,0,11,
+0,0,0,0,0,9,5,0,4,0,0,0,0,9,7,8,6,0,0,0,0,0,0,10,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,
+0,7,0,0,0,0,0,0,0,0,0,0,0,4,10,6,0,7,0,0,0,0,0,0,0,5,0,0,0,0,0,0,10,7,10,0,0,0,
+0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,7,0,6,8,7,12,4,0,0,0,0,0,0,0,5,14,
+0,0,0,0,0,0,4,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,
+6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,4,0,0,20,4,0,0,0,7,0,6,0,0,0,0,0,0,0,0,8,0,
+0,6,15,0,0,6,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,12,0,0,0,9,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,5,0,0,0,0,0,0,8,6,0,0,18,0,0,0,10,0,0,0,0,0,0,0,0,6,0,0,0,6,0,0,9,6,0,
+6,0,0,0,0,0,0,0,0,9,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,7,0,0,0,0,9,0,9,0,0,4,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,9,5,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,10,0,0,0,0,7,0,0,0,0,0,0,0,0,0,7,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,0,8,0,0,0,16,0,0,0,0,0,0,0,
+0,0,0,6,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,8,0,0,0,11,0,0,0,0,0,0,0,0,0,0,
+6,0,0,0,0,11,0,0,0,9,7,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,7,0,7,0,6,
+0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,6,
+0,0,0,0,0,0,0,6,0,0,18,0,8,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,7,0,4,0,0,0,
+0,0,0,0,0,0,0,8,0,0,0,0,0,16,0,0,0,0,0,16,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,18,0,0,0,0,0,0,0,0,0,9,7,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,6,0,4,0,
+0,0,0,0,0,0,0,9,4,0,0,0,0,12,5,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,12,5,0,0,0,0,0,0,0,5,0,0,10,6,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,9,0,0,0,11,0,0,6,0,6,0,0,
+0,7,0,0,0,0,0,0,8,0,0,0,0,6,0,0,0,0,0,0,19,0,0,0,12,0,9,0,0,0,0,0,10,7,0,0,0,0,
+0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,16,7,12,
+0,0,6,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,12,6,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,10,5,0,0,0,0,0,0,0,4,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,7,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,4,0,0,0,0,0,0,0,4,0,0,9,0,0,0,8,0,12,4,0,0,0,0,
+0,4,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,12,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,5,0,
+0,0,0,0,0,13,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,8,6,0,6,0,0,0,0,0,0,
+0,4,0,0,0,0,0,6,0,0,9,0,0,0,0,0,0,6,0,0,0,0,0,0,11,0,0,0,0,0,0,0,10,6,0,0,0,0,8,
+6,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,7,0,0,0,0,0,7,0,6,
+10,7,0,0,10,5,11,6,0,0,0,0,0,7,16,0,0,0,0,6,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,5,0,0,0,7,9,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,6,0,0,0,
+0,0,0,0,0,8,7,0,0,0,0,11,6,0,0,0,0,0,0,0,0,0,6,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+8,7,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,12,7,0,7,0,0,0,
+0,0,0,0,6,0,0,0,0,9,0,0,0,23,0,0,0,0,0,10,5,0,0,0,0,0,0,0,0,0,4,0,0,11,7,10,0,0,
+0,0,0,0,0,0,0,0,0,0,6,0,0,8,7,0,7,0,0,8,7,8,0,0,0,0,0,0,0,0,0,0,0,14,5,0,0,0,0,
+0,0,0,0,18,6,8,7,0,0,0,0,0,0,0,4,0,0,0,0,0,0,11,0,0,0,9,7,12,6,0,0,0,0,0,0,0,0,
+0,0,12,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,6,0,0,0,7,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,6,8,7,0,0,0,6,10,0,0,0,9,0,0,0,0,0,0,0,0,0,8,6,0,0,0,0,0,6,
+10,7,0,0,0,7,0,0,8,4,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,
+0,0,0,8,7,8,6,0,0,11,7,10,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,4,8,7,0,0,0,0,0,0,0,0,
+0,5,0,0,13,0,0,0,0,5,0,0,9,7,0,0,0,0,0,0,0,4,0,0,11,0,0,7,0,0,0,0,0,0,0,0,0,6,0,
+0,0,0,0,0,12,7,19,0,8,6,0,0,0,0,0,6,0,0,0,0,0,0,0,0,10,6,8,0,0,0,0,0,0,0,0,0,0,
+6,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,7,0,0,12,0,0,0,0,6,9,6,
+14,0,0,0,0,0,0,6,0,5,0,0,8,7,0,0,0,6,0,4,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,4,0,6,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,5,0,
+7,0,0,10,0,9,7,0,6,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,12,6,0,0,0,0,0,5,0,6,0,0,0,0,
+0,0,0,0,0,0,0,6,0,0,0,0,9,7,0,0,0,0,0,0,11,6,0,0,0,0,0,0,0,0,0,0,11,7,0,0,13,7,
+0,0,0,0,0,0,0,0,12,0,0,4,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,6,11,5,0,5,13,0,8,0,
+0,0,0,6,0,0,0,0,0,0,11,0,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,11,5,
+9,6,0,0,0,4,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,10,0,0,0,8,5,0,0,9,0,0,0,8,7,9,0,0,0,0,0,0,0,0,7,0,6,0,0,0,0,0,0,0,0,0,
+0,11,0,13,6,0,0,9,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,
+0,0,0,0,0,5,21,6,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,5,0,0,0,0,0,0,0,0,10,0,8,0,
+0,6,0,0,0,4,0,0,9,0,0,0,0,0,0,0,0,0,0,4,0,0,8,6,0,6,0,7,10,0,8,4,0,4,0,0,0,0,0,
+5,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,6,12,0,0,7,0,0,0,5,0,0,
+0,0,0,0,0,0,0,6,0,0,8,6,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+15,7,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,6,0,0,24,7,0,0,0,0,0,0,0,0,0,
+7,0,0,0,0,0,0,0,0,0,0,9,6,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,6,0,
+0,0,0,0,0,0,0,0,0,0,0,0,6,0,6,0,4,12,0,0,7,0,0,0,0,0,5,0,0,0,0,0,0,0,0,15,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,8,0,0,0,
+0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0,0,0,0,0,0,9,0,9,6,
+0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,8,6,0,0,0,0,0,0,0,0,0,0,8,4,0,7,0,0,0,0,0,0,0,0,
+22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,4,0,7,0,0,21,7,0,7,9,6,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,8,0,0,6,
+0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,8,7,0,0,0,0,23,0,0,0,0,7,0,0,0,
+4,0,0,0,0,0,0,0,0,9,4,11,7,0,5,0,0,0,0,11,0,0,4,20,0,0,0,0,0,0,0,0,0,0,0,11,5,0,
+7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+21,0,0,0,0,0,0,7,0,0,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,11,6,0,0,0,0,0,0,0,0,9,6,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,5,0,4,9,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,
+0,0,0,10,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,8,7,0,0,11,7,0,0,0,0,0,0,0,4,
+0,4,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,6,0,0,0,5,0,0,0,0,0,0,0,0,0,0,8,7,0,
+0,0,0,0,0,0,0,0,6,0,0,21,6,0,0,0,0,0,6,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,14,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,9,6,0,0,8,0,0,7,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,
+0,0,0,8,7,0,0,11,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,5,0,0,0,7,13,7,10,4,0,
+0,0,6,0,0,0,0,0,0,0,0,0,5,10,0,0,0,0,0,0,5,0,0,0,7,0,0,0,0,0,0,8,4,0,0,0,0,0,6,
+0,0,0,0,0,0,0,0,0,0,12,7,0,6,0,0,10,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,6,0,
+0,0,0,0,7,0,0,8,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,10,5,0,6,0,0,0,0,0,4,0,0,0,0,
+0,0,0,0,0,4,0,0,0,0,9,0,11,4,0,0,0,6,0,0,0,5,12,7,0,5,0,0,0,0,0,4,0,0,0,7,0,0,0,
+0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4,13,6,10,0,0,0,17,0,0,4,0,0,0,0,0,6,0,4,0,5,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,11,7,0,0,0,7,0,0,0,6,0,0,0,0,0,0,
+0,6,0,4,0,0,0,0,8,0,0,0,0,5,0,0,0,0,0,4,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,9,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,5,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,12,0,0,
+0,0,7,0,0,0,0,0,0,0,0,0,0,0,7,0,0,16,4,0,0,11,0,8,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+8,7,0,4,0,0,0,0,0,0,0,4,0,0,0,0,0,0,8,6,0,0,8,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,
+7,0,0,0,0,0,0,9,0,0,0,0,0,0,0,12,5,10,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,5,0,
+5,18,7,0,0,14,0,0,0,0,0,0,0,9,4,0,7,0,0,0,0,0,0,0,5,0,0,0,6,0,0,0,6,0,0,0,0,0,0,
+8,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,5,0,0,0,7,0,0,0,0,0,0,11,0,0,0,
+10,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,14,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+11,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,14,6,0,0,0,0,11,4,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,10,7,0,6,0,0,9,0,9,5,0,0,0,0,0,
+0,0,0,10,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,8,5,0,0,0,0,0,0,0,0,0,0,11,4,0,6,
+0,6,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,12,4,0,6,8,6,0,0,0,0,0,0,0,0,0,0,8,0,0,5,0,0,0,0,0,0,0,7,0,0,13,0,0,0,0,0,0,0,
+0,0,0,0,0,0,9,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,12,7,0,6,0,0,0,
+0,0,0,0,0,0,0,0,0,13,4,0,7,0,0,0,7,0,7,0,0,0,0,0,0,0,0,10,4,0,0,0,0,0,0,0,0,0,0,
+9,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,10,6,21,5,0,0,0,0,8,0,0,0,0,4,0,
+7,0,0,0,0,0,0,11,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,4,0,0,0,0,0,0,
+0,7,9,6,11,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,7,10,0,0,0,0,0,0,6,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,19,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,18,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,7,0,0,0,0,0,0,9,4,10,4,0,7,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,9,7,9,7,10,4,0,7,0,0,0,0,0,0,0,6,12,0,
+0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,
+0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,8,0,
+0,0,0,0,0,5,0,0,8,7,0,0,0,7,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,
+0,0,0,0,4,0,0,8,0,0,6,0,0,0,7,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,6,0,0,0,6,0,6,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,7,9,7,0,0,0,4,8,0,0,0,0,6,11,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,10,0,0,0,0,0,0,0,13,4,0,0,
+12,6,0,6,0,0,0,0,8,7,0,7,0,0,0,0,0,6,0,0,0,0,0,0,12,6,0,4,0,0,0,0,0,0,0,0,0,0,9,
+7,22,0,0,0,0,4,0,0,0,0,0,6,0,0,0,4,0,0,9,0,0,6,0,0,24,7,0,7,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,10,6,0,5,0,0,0,0,0,0,0,7,0,0,8,0,0,0,0,0,0,0,10,5,0,0,0,0,0,0,0,0,0,7,0,
+7,0,0,0,0,0,0,13,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,
+0,0,0,0,0,7,12,0,9,4,0,0,0,0,0,0,0,0,0,4,0,0,0,0,8,0,0,0,0,0,0,0,0,4,0,0,0,7,0,
+0,0,0,8,7,0,0,0,0,0,0,0,0,0,4,18,0,0,0,0,0,10,0,0,5,0,0,11,0,0,0,0,0,0,5,0,6,0,
+0,0,6,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,6,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,
+4,0,0,0,0,0,0,10,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,
+0,0,0,5,8,0,0,0,0,0,0,0,8,6,0,0,0,0,0,0,0,0,20,7,0,0,0,0,0,0,0,0,0,0,0,4,9,0,12,
+6,8,0,14,7,0,5,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,10,0,0,
+0,0,0,0,0,0,0,0,0,0,6,0,6,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,9,6,0,7,12,0,0,0,0,4,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,7,
+0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,4,0,0,9,0,
+12,6,0,5,0,0,0,6,0,4,0,6,0,0,0,0,0,0,0,0,10,7,0,0,0,0,0,0,8,0,0,0,0,4,0,0,0,0,
+10,0,0,0,0,0,0,0,8,6,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,5,0,0,0,0,0,0,0,0,0,0,0,
+6,0,0,12,6,20,5,0,0,0,0,0,0,0,0,0,0,0,0,9,5,0,5,0,0,0,6,13,7,0,0,0,0,15,6,0,0,0,
+6,0,0,13,7,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,5,0,7,0,0,0,0,0,4,0,0,0,0,0,0,0,0,
+10,6,0,0,0,0,0,6,0,0,0,0,9,0,0,0,0,0,19,6,0,0,0,0,0,0,0,0,0,0,13,0,11,0,0,0,0,0,
+0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,10,6,0,0,0,0,0,0,0,0,10,0,0,6,0,0,0,0,8,0,0,
+0,9,0,15,4,0,6,0,0,0,0,0,6,12,0,0,0,0,0,0,0,14,7,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,
+0,0,0,0,0,8,7,0,0,0,0,0,6,10,0,0,0,0,0,0,0,0,7,8,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,7,10,5,0,0,0,0,8,0,0,0,0,4,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,6,12,0,0,0,10,7,0,5,0,6,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,6,0,4,0,0,0,0,0,7,0,0,0,0,0,0,0,4,9,6,0,0,0,7,0,0,0,0,0,0,0,0,8,6,0,0,
+0,0,0,0,0,4,12,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,7,0,
+0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,12,6,0,6,9,4,0,0,8,4,0,6,
+0,0,0,0,0,4,0,0,0,0,0,0,0,6,0,0,9,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,8,0,0,6,13,4,0,5,8,0,0,0,0,0,0,0,8,0,0,0,10,5,0,0,9,0,0,0,0,0,0,6,0,0,
+24,0,0,0,0,0,0,0,8,0,0,7,0,0,12,0,8,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,7,0,
+6,8,0,10,0,9,7,0,0,0,5,0,0,0,0,0,0,0,4,8,5,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,4,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,8,0,0,
+0,0,0,8,6,0,0,0,0,0,0,0,0,0,0,8,6,0,0,0,0,10,4,0,0,0,0,0,0,0,6,0,0,0,4,20,0,0,7,
+10,6,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,7,0,0,0,0,9,6,0,0,0,0,0,0,0,4,
+12,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,9,4,0,5,0,0,
+0,0,0,0,0,6,0,6,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,6,9,0,0,0,0,7,0,0,0,0,0,6,0,5,0,0,0,0,0,0,0,0,9,0,0,0,
+0,6,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,17,7,0,0,13,6,14,6,0,0,0,0,
+8,0,0,0,0,0,0,7,12,7,8,7,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,4,0,0,0,0,0,4,0,
+0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,12,4,0,0,10,7,0,0,0,
+0,0,0,10,0,0,6,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,12,0,0,6,
+0,0,0,0,0,0,0,0,8,7,12,0,0,0,0,0,0,6,0,6,0,4,0,0,18,6,0,0,0,6,0,0,0,0,0,6,10,6,
+0,0,0,0,0,0,8,7,14,0,0,0,0,0,0,6,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
+0,0,0,8,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,8,7,0,0,10,5,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,
+0,0,9,4,8,0,0,0,0,0,0,4,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,4,0,0,0,0,
+0,6,0,0,9,7,0,0,0,0,0,5,0,0,0,0,8,7,0,0,14,0,0,0,0,6,0,0,0,0,0,0,9,6,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,5,0,7,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,
+0,0,0,6,0,0,0,6,0,4,0,0,0,0,0,4,0,0,0,0,12,0,0,7,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,
+0,12,0,16,6,0,0,0,0,0,0,11,7,0,4,8,7,0,0,0,0,0,6,0,0,0,0,16,0,0,0,0,6,0,0,0,0,0,
+0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,4,10,7,0,0,0,0,0,0,12,7,0,0,0,0,0,0,0,0,0,0,
+0,0,10,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,13,4,0,0,10,0,0,0,0,0,0,0,0,0,19,0,0,0,
+0,0,0,0,0,0,0,0,0,0,8,6,22,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,
+5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,6,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+4,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,7,0,0,18,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,14,7,0,0,11,5,0,0,0,5,0,0,0,0,12,5,0,0,0,0,0,0,0,0,0,0,24,6,0,0,
+0,7,0,4,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,7,0,4,0,0,0,0,8,7,0,0,
+9,6,0,0,14,5,0,0,0,6,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,12,6,0,0,0,0,0,0,0,6,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,0,5,0,0,
+0,0,12,7,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,6,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,6,0,0,13,7,0,0,0,0,0,0,14,0,11,4,0,
+0,0,4,0,0,0,0,14,5,0,0,0,0,0,5,11,5,0,0,0,0,22,5,0,0,0,0,0,7,0,0,0,0,0,4,0,0,0,
+4,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,6,0,0,17,0,10,0,0,0,8,0,0,0,19,
+5,18,7,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,10,6,0,6,0,0,0,0,10,4,0,4,0,
+0,0,0,0,0,14,7,0,5,0,0,0,0,0,6,0,0,0,0,0,0,0,0,8,0,9,6,12,0,0,6,0,0,0,0,0,0,0,0,
+12,0,10,6,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,4,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,5,13,0,9,7,0,0,0,0,0,0,0,0,0,0,0,7,9,7,0,0,8,0,0,0,0,0,
+22,0,0,0,0,0,0,0,23,6,14,0,0,0,0,0,0,7,0,0,0,0,11,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,
+0,0,10,0,0,6,0,0,0,0,0,0,0,0,0,6,0,0,8,5,0,0,0,0,0,0,0,0,0,7,11,6,21,0,0,0,0,0,
+0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,
+0,0,0,0,0,0,0,4,9,7,0,0,0,0,0,0,12,0,0,0,0,7,0,0,0,0,0,0,0,0,10,4,0,0,0,0,0,0,9,
+0,0,0,20,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,11,7,0,0,0,0,0,0,0,6,15,0,0,
+0,0,0,0,0,0,0,0,0,0,0,12,4,0,5,0,0,0,0,0,0,11,7,17,6,0,0,0,0,0,0,15,6,0,7,0,0,0,
+0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,6,0,5,
+0,0,11,0,11,7,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,
+17,0,0,0,0,6,0,0,0,5,0,0,0,0,0,0,8,7,9,6,0,0,14,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,
+8,7,0,4,0,0,0,0,0,0,0,6,0,5,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,
+0,0,0,5,0,4,0,0,8,7,0,6,12,5,0,7,18,7,0,0,8,5,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,
+10,0,11,0,0,0,0,0,0,0,0,0,0,0,9,0,0,4,0,6,0,7,0,0,0,0,0,6,0,0,0,6,0,0,0,0,0,0,0,
+7,0,0,0,0,8,0,0,0,15,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,10,6,0,0,0,0,0,0,0,0,0,
+0,0,6,0,0,0,0,23,0,0,0,10,7,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,5,0,0,0,0,0,0,8,6,0,0,
+0,0,0,0,12,7,9,7,0,0,10,6,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,9,0,8,7,0,0,0,
+6,0,6,0,4,0,5,0,0,0,0,0,5,8,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,7,10,5,0,0,11,6,0,0,0,0,0,0,0,6,0,6,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,4,9,7,0,
+0,0,0,11,7,0,0,0,0,0,5,0,0,0,7,0,0,0,0,23,6,11,4,0,0,0,0,0,0,9,0,0,0,10,6,0,0,0,
+0,9,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,10,6,0,0,0,7,0,0,
+0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,
+6,11,7,0,0,0,0,0,0,0,0,0,0,0,0,10,5,0,0,0,6,0,0,0,5,0,6,0,6,0,0,0,0,0,0,0,0,0,0,
+0,6,0,0,0,0,8,7,0,5,0,0,0,0,0,6,0,0,0,0,0,0,0,4,10,0,8,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,10,6,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,6,0,0,
+0,0,0,0,0,0,10,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,11,6,0,4,0,0,14,5,0,7,0,0,0,0,0,6,16,0,0,0,0,0,0,0,10,0,0,7,15,0,0,0,11,7,0,0,
+0,0,0,0,0,0,0,0,8,7,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,5,0,0,0,
+0,8,0,0,6,0,0,0,0,0,0,9,5,0,0,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,6,0,
+0,0,0,0,0,0,7,0,0,0,0,15,7,0,0,0,0,8,0,0,0,14,0,0,0,0,0,0,0,16,7,0,0,0,0,0,7,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,12,6,11,7,
+9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,
+7,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,12,0,10,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,8,0,0,5,8,7,10,6,0,0,0,7,0,0,0,0,12,6,
+0,0,9,0,0,0,12,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,4,10,0,0,0,10,5,0,0,0,0,0,0,9,6,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,6,0,0,9,5,0,4,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,9,0,0,5,0,0,8,7,8,
+6,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,6,10,0,9,4,0,0,0,0,0,0,0,6,
+11,0,0,0,0,0,0,0,0,0,0,0,8,0,0,6,0,6,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,8,7,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,
+0,0,0,10,0,0,0,8,7,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,
+0,0,8,4,0,5,0,0,0,0,0,0,0,7,0,0,0,6,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,8,7,0,0,0,0,0,0,0,0,22,0,0,0,0,0,0,0,8,5,0,0,0,
+0,0,0,0,7,0,0,0,6,0,0,0,6,0,6,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,5,0,6,0,7,0,0,0,0,
+20,0,0,0,0,0,0,0,0,0,0,7,9,0,0,0,0,0,0,6,0,6,0,7,0,0,0,7,0,0,0,0,0,0,0,4,0,0,0,
+0,0,0,14,7,0,0,0,5,0,0,22,4,10,0,0,0,0,0,0,4,8,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,11,5,13,0,0,0,0,0,0,0,0,0,8,0,0,7,0,0,0,0,0,4,0,0,0,4,0,0,0,0,0,0,10,7,0,
+0,0,0,0,0,0,6,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,7,0,7,14,6,0,0,0,0,9,5,
+0,0,0,0,0,6,0,0,0,5,10,0,8,6,0,0,0,0,0,0,0,0,9,7,0,0,0,0,0,0,0,6,0,0,8,4,0,6,0,
+0,0,5,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,7,
+14,0,0,5,0,0,18,0,8,4,0,6,0,0,20,0,13,0,0,0,0,7,0,4,0,0,0,0,0,4,8,4,0,0,0,0,0,6,
+0,0,0,0,0,4,0,0,0,4,0,0,0,0,0,4,0,0,0,0,0,0,0,0,14,0,0,0,0,0,9,7,0,0,9,0,0,0,0,
+0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,20,0,14,0,0,4,0,6,8,5,0,0,0,0,0,7,0,0,0,0,0,0,
+0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,10,4,12,7,0,6,0,0,9,7,10,5,
+0,0,8,6,0,4,0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,18,0,0,0,14,7,0,0,0,0,0,4,
+0,0,0,0,0,0,17,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,4,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,
+0,0,0,0,0,8,6,0,0,0,0,0,0,0,0,8,5,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,5,0,7,0,0,0,0,0,
+7,0,0,0,0,0,0,0,0,0,7,0,6,0,0,0,0,0,0,0,0,8,5,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,5,0,
+0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,23,0,0,7,0,0,0,0,0,0,
+0,0,0,0,0,0,0,4,0,0,0,0,0,0,12,7,8,4,0,0,0,0,0,0,0,0,0,6,0,0,9,5,0,0,0,7,0,0,0,
+0,0,0,0,0,0,4,10,0,0,7,0,0,0,5,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,5,0,0,18,7,
+0,0,8,0,0,5,0,0,10,0,0,0,0,0,0,6,0,0,0,0,0,5,0,7,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,
+6,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,6,0,0,10,0,0,5,10,4,0,0,12,0,0,0,0,
+6,22,4,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,5,0,0,0,0,0,7,0,5,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,6,0,7,0,0,0,6,0,6,8,5,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,8,5,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,5,0,0,0,7,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,
+0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,16,6,0,0,0,6,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,12,7,0,0,0,0,9,0,0,0,0,6,0,0,11,0,0,0,0,0,13,0,9,6,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,4,0,0,10,7,0,0,0,7,0,6,0,
+0,0,0,0,0,0,0,0,0,8,7,0,0,0,0,11,0,15,0,22,7,0,4,0,6,0,0,0,0,0,7,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,4,0,7,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,
+18,0,0,0,0,0,0,0,0,0,14,0,0,4,0,0,0,0,8,7,9,0,0,0,0,0,9,0,0,0,14,0,0,0,0,0,0,0,
+0,0,11,7,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,7,0,0,0,6,0,6,0,0,0,0,8,0,0,0,0,
+0,11,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,9,4,0,0,0,0,0,4,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,8,7,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,
+0,0,0,0,0,0,8,6,0,0,9,5,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,6,0,0,0,0,0,0,0,6,0,5,0,
+0,10,6,9,0,0,0,0,6,0,0,0,0,0,6,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,
+11,7,12,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,4,0,5,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,
+0,0,0,0,6,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,5,0,0,10,6,
+0,0,0,4,0,7,13,0,0,4,0,0,11,4,0,6,0,0,0,0,0,6,8,7,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,5,0,0,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,5,0,0,0,0,12,6,0,0,0,0,
+11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,11,5,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,
+7,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,4,0,0,0,6,17,0,9,0,10,6,0,6,12,0,0,4,0,0,0,
+0,0,0,0,0,0,0,8,5,12,7,0,4,0,0,0,0,0,0,0,0,0,0,11,0,9,0,10,6,11,5,0,7,0,0,8,0,0,
+7,0,4,0,0,0,7,0,0,0,0,0,0,8,6,0,0,0,6,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,6,0,
+0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,11,0,0,0,0,6,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,10,0,0,0,0,0,8,6,0,0,0,0,0,6,12,0,0,0,0,0,
+0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,6,0,0,16,0,11,5,0,0,0,0,0,
+0,0,0,0,0,10,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,9,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,6,0,7,0,0,0,0,0,0,0,0,0,0,0,0,8,4,0,0,0,0,0,6,10,
+7,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,6,0,0,0,0,0,0,9,5,0,0,0,0,8,0,9,0,0,
+0,0,0,0,0,0,7,10,0,13,0,0,6,0,0,0,0,0,0,0,0,0,6,9,4,0,0,0,0,0,0,10,0,0,0,0,0,10,
+0,0,0,0,0,0,0,10,6,11,0,0,0,0,0,9,0,0,0,0,0,0,4,0,0,0,0,0,0,10,5,0,0,0,0,0,6,0,
+0,0,0,0,0,18,4,0,7,0,0,0,0,0,0,24,0,8,6,0,7,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,
+0,8,5,0,0,0,0,10,7,0,6,0,0,0,0,0,0,0,0,8,5,10,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,
+6,0,0,8,7,0,0,0,0,0,0,0,0,0,0,12,6,0,0,0,0,0,0,0,4,0,5,15,0,0,0,0,7,0,7,0,0,0,0,
+0,0,0,0,0,6,10,5,0,0,0,6,0,0,8,7,0,0,0,0,0,0,0,0,0,0,0,7,0,0,12,0,0,0,0,0,0,0,0,
+0,0,5,0,0,0,0,0,0,14,4,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,11,0,10,4,9,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0,0,0,0,0,4,0,0,0,0,0,7,0,0,0,
+0,0,0,0,0,0,0,0,7,13,7,0,0,0,0,0,0,0,5,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,7,0,0,
+0,0,0,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,8,0,10,6,0,4,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,6,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0,
+0,0,0,0,0,0,0,10,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,9,7,0,0,0,0,0,6,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,10,6,0,0,0,0,0,0,0,6,0,0,0,
+0,0,0,0,5,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,6,0,0,0,5,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,11,0,0,0,0,6,0,0,0,0,0,0,0,6,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,0,0,
+6,0,0,0,0,0,0,0,6,10,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,
+0,0,0,0,0,0,0,6,0,6,0,0,0,5,0,0,0,0,0,0,0,5,0,0,10,0,11,5,0,0,0,0,0,0,14,7,9,7,
+0,6,0,0,0,0,0,4,0,0,0,0,0,0,11,7,0,6,0,0,0,0,0,0,9,7,0,4,0,0,0,7,0,0,0,0,0,5,0,
+0,0,0,0,5,0,0,0,7,0,0,0,0,0,5,0,0,0,0,17,5,0,0,8,0,0,0,0,6,9,4,0,0,0,0,0,0,0,0,
+8,7,11,7,9,0,0,0,0,0,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,0,6,9,5,0,0,8,6,0,0,0,5,0,
+0,0,0,9,0,0,0,9,6,0,7,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,
+0,0,0,0,4,0,0,0,0,10,0,0,0,0,0,0,0,0,4,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,4,0,0,0,5,0,0,0,0,0,7,0,0,0,0,0,7,13,5,0,0,0,7,0,0,0,0,0,7,9,6,11,7,0,7,0,0,0,
+0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,8,5,0,0,0,5,9,4,0,0,0,0,0,0,0,0,8,4,0,0,0,0,
+24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,
+0,0,0,0,6,0,0,0,7,0,0,0,6,0,0,0,0,0,0,0,0,0,5,11,6,0,4,0,7,20,0,8,5,9,5,9,0,0,6,
+0,0,0,0,0,0,0,0,0,0,0,7,23,5,0,0,8,4,0,0,10,0,0,6,0,5,0,0,0,0,0,0,0,0,0,0,0,7,0,
+0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,9,0,0,0,
+10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,
+6,0,0,0,0,14,0,18,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,9,6,0,4,0,0,0,0,0,0,8,4,
+11,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,8,4,0,0,0,0,0,0,0,0,12,0,10,7,0,0,10,0,0,0,0,
+0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0,0,0,0,0,6,0,0,0,0,8,
+6,10,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,4,0,6,0,4,0,0,0,0,0,5,0,0,
+0,0,0,0,0,0,0,7,0,0,0,7,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,17,7,11,0,0,0,0,0,0,0,0,0,0,4,12,6,0,0,0,5,0,0,0,6,0,0,0,0,0,0,0,0,0,0,
+0,5,12,7,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,6,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+7,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,6,0,6,0,0,20,0,0,0,0,0,0,0,0,0,8,7,0,0,0,0,0,4,
+0,0,0,5,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,6,0,4,13,0,0,7,0,0,0,0,0,0,
+0,0,0,0,0,6,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,6,0,0,12,6,0,7,0,0,0,0,10,0,23,6,0,0,
+0,4,0,0,0,0,0,6,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+10,0,9,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,11,0,9,7,0,0,
+0,0,0,0,0,0,0,0,9,7,0,4,0,0,0,0,8,7,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
+0,0,0,0,0,6,0,0,10,7,10,5,0,0,8,0,8,0,0,0,0,0,0,4,0,5,10,0,0,0,0,0,0,0,9,0,0,6,
+0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,11,7,0,0,0,0,0,0,0,0,9,4,0,0,0,0,0,6,0,0,8,
+7,0,0,0,0,0,5,0,0,0,0,0,0,0,0,10,0,0,0,0,5,0,4,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,24,7,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,6,0,0,9,0,0,0,0,0,0,7,0,6,13,0,8,
+0,0,0,0,0,0,0,0,0,9,7,0,0,0,0,0,0,0,6,0,0,0,0,8,5,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,
+4,0,0,0,0,0,4,0,0,0,0,0,0,0,6,8,0,0,0,0,6,8,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,4,0,4,0,0,0,5,0,7,0,0,10,0,10,7,0,0,12,5,0,0,9,0,0,0,10,0,
+0,6,0,0,0,6,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,5,0,0,0,0,0,0,
+12,0,0,0,0,0,8,5,13,6,0,0,0,0,0,0,9,4,0,0,0,0,8,0,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,
+0,0,6,0,0,14,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,17,6,0,0,0,0,12,6,0,0,0,0,8,0,0,7,0,
+7,0,4,9,0,0,6,0,0,0,6,0,0,0,0,0,0,8,7,0,0,0,0,0,0,11,0,0,4,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,18,7,0,4,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,6,0,0,0,0,0,
+0,0,0,12,5,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,8,0,11,7,0,0,0,0,0,0,0,0,0,4,0,0,0,0,
+11,0,0,0,0,0,0,0,21,0,0,6,10,0,0,0,0,0,9,0,10,0,0,0,0,0,11,0,0,0,0,6,0,0,0,0,0,
+5,0,0,0,0,0,0,10,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,4,0,0,23,7,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,9,7,0,0,0,7,
+0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,6,0,0,
+11,6,0,0,0,0,0,0,0,6,0,0,0,0,10,7,0,0,9,4,0,0,11,0,8,5,0,0,0,7,8,5,22,0,0,0,9,6,
+0,0,0,0,0,0,0,6,10,4,0,0,0,0,0,7,9,4,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,6,0,4,0,
+0,0,0,11,6,0,0,0,0,0,0,0,0,0,0,0,7,0,6,0,0,0,0,0,7,0,0,0,0,0,0,0,6,0,6,0,4,0,0,
+0,0,0,0,0,7,0,7,0,4,13,0,0,0,0,0,8,0,0,0,0,7,0,0,0,0,0,0,11,6,0,7,0,0,0,0,9,0,0,
+0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,4,8,0,0,0,0,0,8,0,0,0,0,0,0,6,0,0,0,4,0,0,0,0,0,0,0,6,0,0,0,0,13,5,8,0,0,
+0,0,0,0,0,14,0,0,6,0,0,0,0,0,0,0,0,0,7,0,0,17,6,0,0,0,0,13,4,0,0,9,6,0,0,10,5,0,
+0,10,5,0,0,0,0,13,0,0,0,0,6,0,0,0,0,0,0,10,0,12,0,0,0,0,0,0,0,0,0,0,0,8,4,0,4,0,
+0,0,4,0,0,0,0,0,4,0,0,12,0,0,5,9,4,0,0,0,0,0,0,0,0,0,5,8,5,0,0,0,7,0,0,0,0,8,7,
+0,0,0,6,12,5,0,0,0,5,0,0,0,5,0,0,0,0,0,4,12,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,7,0,0,0,0,0,6,0,0,0,0,0,0,0,6,0,0,0,0,0,
+0,9,6,0,0,0,0,0,0,0,0,0,4,0,0,0,6,0,0,0,4,11,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,
+0,0,0,0,12,7,0,0,0,7,10,7,0,0,11,0,0,0,0,0,0,0,0,0,11,7,0,0,0,6,0,0,11,0,0,0,0,
+0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,22,0,10,7,0,0,8,5,0,0,0,0,0,5,0,0,0,0,0,0,
+0,0,0,0,9,6,8,7,0,6,0,0,0,0,0,5,0,0,0,0,0,0,8,7,0,0,0,0,9,7,0,0,0,6,0,0,8,7,0,0,
+0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,4,0,5,0,0,0,4,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,6,0,0,0,0,0,0,0,4,0,0,0,0,0,0,9,
+6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,4,0,0,0,5,0,0,0,0,14,0,0,0,
+9,0,0,0,0,0,0,0,0,0,9,7,12,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,12,0,0,0,0,0,12,7,0,0,0,5,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,10,7,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,8,7,0,0,0,0,0,6,0,0,0,0,0,0,9,6,0,0,0,0,0,6,0,0,0,0,0,
+0,0,0,0,0,9,0,0,0,0,7,0,6,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,
+0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,6,0,7,12,6,0,0,0,0,0,5,0,0,0,0,0,0,0,0,
+0,7,0,0,8,6,0,0,0,0,10,7,0,0,0,0,0,0,0,6,0,0,0,0,0,6,12,0,0,0,0,0,0,0,0,6,0,0,0,
+0,0,6,0,0,0,6,0,0,0,0,0,6,16,0,0,0,0,0,0,0,0,0,9,0,17,0,14,7,8,0,0,0,0,0,0,6,0,
+0,0,0,0,0,0,0,0,0,11,0,0,6,8,7,0,6,0,0,0,0,0,0,0,0,0,0,12,6,0,0,0,0,0,0,0,0,0,0,
+9,0,0,0,0,7,0,0,0,0,11,5,0,4,9,6,8,0,0,0,0,0,0,0,0,0,10,0,11,7,0,0,0,0,0,0,0,0,
+9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,
+0,0,0,12,0,0,0,0,0,10,5,0,4,0,0,0,0,0,7,10,6,11,6,0,0,0,0,0,0,0,0,0,0,0,0,17,0,
+0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,6,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,8,0,0,4,0,0,0,6,0,0,0,
+0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,6,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,4,0,0,0,0,9,6,0,0,0,4,0,0,0,0,0,4,10,7,0,7,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
+0,0,0,0,0,0,6,0,0,0,6,0,6,0,0,0,0,10,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,18,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,13,0,0,0,0,0,10,0,0,0,0,0,0,0,0,4,
+0,0,0,6,0,0,0,0,0,4,8,0,0,0,11,7,0,0,0,4,0,0,0,0,0,7,0,0,8,5,0,0,16,0,0,0,13,6,
+0,0,0,0,0,0,0,6,0,0,0,0,20,0,11,6,0,0,8,7,0,0,0,0,0,6,17,0,8,0,0,0,0,0,8,7,0,0,
+9,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,
+0,0,4,0,7,0,0,0,0,0,0,0,6,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,8,
+0,8,0,0,0,0,0,0,0,11,0,8,0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,0,0,0,0,0,0,0,6,0,0,9,0,
+0,0,0,0,8,0,0,0,0,0,18,0,0,0,0,0,0,4,9,0,0,0,0,0,8,5,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,9,6,0,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,8,7,0,0,0,0,0,0,0,0,
+0,4,0,0,0,0,0,0,14,0,0,0,0,7,0,6,0,0,8,0,20,7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,8,0,0,0,14,0,0,0,0,0,0,0,8,0,0,7,0,6,0,0,0,7,0,0,0,0,0,0,0,0,
+0,0,0,4,12,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,10,6,0,
+5,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,
+0,0,0,5,8,4,0,0,0,0,0,0,0,4,0,0,0,7,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,12,7,0,
+0,0,0,13,6,0,0,0,7,0,0,8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,5,0,0,0,7,0,0,0,0,0,0,11,5,
+0,6,0,0,8,5,0,7,0,0,0,0,0,0,0,7,0,0,0,0,8,6,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,4,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+14,0,10,7,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,19,0,0,4,0,0,0,7,
+0,0,11,5,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,16,0,10,5,18,0,0,7,9,6,0,5,0,0,0,0,0,
+0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,8,7,0,0,0,0,0,5,0,0,0,7,0,6,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,6,0,0,0,4,0,6,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,6,0,0,0,7,23,0,0,0,0,5,0,0,0,0,0,0,8,5,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,14,0,20,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,
+11,0,0,0,0,7,0,0,0,0,15,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,9,6,0,0,0,0,0,7,0,0,0,0,
+0,4,0,0,0,0,10,0,0,0,0,0,9,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,10,0,11,6,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,5,0,0,11,0,0,0,0,7,0,0,0,0,0,0,8,7,0,
+4,0,0,0,0,11,0,0,0,0,0,11,0,0,5,0,0,8,7,0,4,0,7,0,0,0,0,0,0,0,6,0,0,0,0,0,4,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,10,5,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,6,0,5,0,0,0,0,0,0,0,
+0,0,4,11,5,10,7,0,7,0,0,9,6,9,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,9,4,0,4,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,8,6,0,0,0,0,11,7,0,0,0,0,0,0,0,0,0,0,11,7,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,8,5,0,0,8,0,9,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,4,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,
+10,7,0,0,0,6,0,0,0,0,0,0,8,0,0,6,0,0,0,6,10,0,0,0,0,0,0,0,0,0,0,0,8,5,0,0,0,6,0,
+0,0,6,0,0,0,0,9,5,8,5,8,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,
+0,8,7,10,0,0,0,0,0,0,0,9,6,0,0,0,0,0,0,0,0,0,0,11,7,0,0,0,0,0,5,0,0,0,6,0,7,0,0,
+10,5,0,0,0,0,8,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,6,0,0,0,0,0,0,11,0,0,0,0,0,13,4,
+0,0,0,4,0,0,0,0,0,5,8,0,0,0,12,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,7,14,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,7,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,4,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,5,0,0,15,6,10,0,0,0,8,6,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,9,6,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,14,6,10,0,0,0,0,0,0,0,0,6,0,
+0,0,0,0,0,0,0,12,6,0,0,0,0,0,0,0,0,9,7,0,0,0,0,0,6,0,5,11,4,0,6,0,0,0,7,0,0,0,0,
+0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,5,0,0,8,5,0,0,0,0,0,0,0,0,0,0,
+0,0,10,0,0,0,0,0,9,6,9,4,0,0,0,4,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,8,5,0,
+0,0,0,0,0,0,0,0,0,0,4,0,0,11,5,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,5,0,0,0,0,0,0,
+0,0,0,7,12,0,0,0,0,6,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,6,0,
+4,9,6,0,4,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,6,0,
+7,8,6,0,0,0,0,0,0,0,4,0,0,9,6,0,0,0,0,0,0,0,0,0,6,0,5,0,4,0,0,0,0,0,0,0,5,0,0,0,
+0,0,5,0,0,0,7,12,7,0,0,0,0,0,0,18,4,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,6,0,0,0,
+0,12,0,0,7,0,0,0,0,0,7,0,0,13,0,0,6,0,0,0,0,8,7,9,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,7,10,5,0,0,8,0,0,0,0,0,0,0,8,6,0,7,0,0,8,4,0,4,0,0,0,0,10,4,0,0,14,0,
+0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,17,0,0,0,0,0,0,6,0,0,0,0,8,6,0,0,10,5,0,0,0,0,8,
+6,0,0,0,6,0,0,0,7,0,0,0,0,0,6,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,12,0,0,0,0,6,
+8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,
+0,0,0,6,0,0,0,0,0,0,0,0,0,0,12,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,4,24,0,0,
+0,0,0,12,6,0,0,10,6,0,5,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,17,7,0,5,0,0,0,
+0,0,0,0,0,0,0,0,0,0,6,11,5,9,0,8,7,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,10,7,0,0,0,0,0,0,0,7,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,11,5,8,7,0,0,0,
+0,8,5,0,0,0,0,10,7,0,7,0,0,0,0,0,0,0,0,0,0,13,6,0,0,0,0,0,0,0,0,0,6,0,4,0,0,0,0,
+0,6,12,0,8,7,0,0,0,0,0,0,0,0,0,0,16,0,10,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,22,0,0,0,
+0,0,0,0,0,0,0,0,0,0,13,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,6,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,22,0,0,6,0,0,21,0,0,0,22,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+6,0,0,0,0,9,6,0,0,0,0,0,0,0,0,0,6,0,0,0,5,0,0,0,0,0,7,8,0,0,0,0,6,14,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,8,6,0,0,0,0,0,0,
+0,0,0,0,0,6,0,0,0,0,8,5,0,0,11,7,0,6,0,0,0,0,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,0,
+6,0,0,0,5,0,0,0,0,0,0,0,0,0,4,0,0,8,7,0,0,0,0,8,5,11,7,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,4,0,0,0,0,8,5,0,0,10,0,0,4,13,7,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,5,0,0,13,6,
+0,6,0,7,0,0,8,4,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,15,0,0,0,10,7,0,0,0,0,0,
+7,0,0,0,0,0,0,0,4,0,0,0,0,0,6,0,0,0,0,19,0,0,0,0,6,0,0,0,0,0,4,0,0,0,0,0,6,0,5,
+0,7,0,0,0,0,0,0,0,0,0,6,0,0,11,4,0,0,0,6,0,0,13,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,8,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,12,6,0,0,0,0,
+0,7,0,0,0,0,0,0,11,7,0,0,0,0,0,6,0,0,10,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,5,11,6,
+0,0,0,0,0,0,0,0,10,0,0,0,0,6,0,0,0,0,0,0,8,7,0,0,0,5,0,0,0,5,0,0,0,0,0,0,0,0,0,
+0,0,0,8,7,0,0,0,0,9,6,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,10,7,0,0,0,0,10,0,
+0,6,0,0,13,0,0,0,0,0,0,0,9,6,0,0,8,6,8,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,4,0,
+0,9,7,0,0,0,0,0,0,11,0,0,0,10,7,0,0,0,0,0,0,0,0,9,6,0,0,12,4,0,4,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,6,0,0,0,0,21,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,6,0,5,0,0,
+9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,4,0,0,0,0,0,6,0,0,0,6,0,0,0,0,0,0,0,0,
+16,0,0,4,0,0,0,0,0,7,0,0,0,6,0,6,0,0,11,0,0,0,0,5,0,0,0,0,0,0,0,4,8,5,0,0,0,0,0,
+0,14,0,0,0,0,6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,
+0,0,8,0,0,0,0,0,0,0,0,6,0,0,0,4,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,4,0,0,0,4,0,0,0,
+0,0,0,0,6,9,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,6,14,7,0,0,9,7,0,0,11,0,0,0,0,0,10,
+4,11,5,13,6,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,5,0,0,0,0,0,4,0,0,9,0,0,0,0,
+0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,6,12,5,0,0,0,6,14,0,0,0,0,0,0,0,0,0,0,4,9,4,
+0,0,0,0,0,5,0,0,0,0,0,0,0,4,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,5,0,0,
+0,0,0,0,0,0,0,0,8,6,0,0,0,0,0,0,11,6,0,0,13,7,0,0,13,6,0,7,0,0,0,0,0,0,8,6,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,10,6,0,4,0,0,12,6,0,0,0,0,0,0,0,0,10,6,
+0,0,0,6,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,6,0,
+0,0,0,0,7,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,8,6,0,
+0,0,7,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,
+0,0,0,5,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,
+0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,8,7,0,0,8,5,0,0,0,4,9,5,0,0,0,7,10,6,0,0,
+0,0,0,0,9,7,0,0,8,5,8,0,8,4,0,0,13,0,0,0,0,0,0,0,0,0,0,0,0,5,0,5,0,0,0,0,0,0,0,
+0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,6,0,0,0,4,0,0,0,0,0,0,0,0,0,
+0,11,7,0,0,0,7,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,5,0,0,0,7,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,9,7,0,0,0,0,8,5,0,4,0,0,0,0,0,6,0,6,14,
+6,0,0,0,0,9,6,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,6,0,0,0,0,14,7,9,7,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,16,
+0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,14,0,
+0,6,0,0,8,6,0,0,0,0,0,6,0,0,12,0,0,0,0,0,8,5,0,7,11,0,0,5,0,4,0,0,0,6,0,0,0,0,0,
+0,0,0,0,0,0,0,9,6,0,4,0,6,0,0,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,0,0,0,10,5,0,0,0,0,
+0,4,0,0,0,7,11,6,0,4,8,5,9,5,0,0,0,5,0,7,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,8,5,14,7,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,16,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,9,6,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,9,0,0,0,12,5,0,0,0,0,0,0,0,4,10,5,0,0,0,0,0,0,0,0,0,0,0,6,0,
+0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,4,0,0,0,6,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,6,0,0,0,0,0,0,10,4,0,0,0,0,0,5,0,0,0,4,
+0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,8,0,10,7,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,10,7,0,0,0,0,0,0,0,0,15,0,0,0,
+0,0,0,0,0,0,0,7,0,0,0,0,0,7,10,7,9,7,0,0,0,7,0,0,8,0,0,0,0,0,0,0,9,0,0,0,8,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,8,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,7,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,15,7,12,6,0,0,0,7,0,5,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,5,0,0,0,0,
+0,0,0,6,9,5,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,9,7,0,0,14,0,0,0,11,7,0,0,0,0,0,
+0,0,0,0,0,0,4,0,0,11,7,0,0,0,0,8,0,0,0,0,0,0,6,8,7,0,0,0,7,10,4,0,0,0,0,0,0,0,0,
+0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,7,0,0,0,0,10,0,0,0,0,0,0,
+6,0,6,0,0,0,0,0,4,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,11,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,7,0,0,10,7,0,0,0,0,9,7,0,0,0,0,0,0,13,7,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,9,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,6,12,0,
+0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,9,6,0,0,11,0,0,
+0,0,0,14,4,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,7,0,0,
+0,0,0,6,0,7,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,5,0,0,0,0,20,
+7,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,8,0,0,0,0,0,0,0,0,0,11,5,0,0,0,0,0,0,0,0,0,0,10,4,0,0,0,5,8,5,10,4,0,0,0,0,0,
+0,13,6,9,7,0,0,10,7,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,6,0,0,0,7,0,6,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,7,10,7,0,0,
+0,0,0,0,0,0,0,0,12,4,0,0,0,0,8,7,0,0,0,0,0,7,0,6,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,
+0,0,0,0,6,0,6,9,6,0,0,12,5,0,0,8,6,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,6,0,0,0,0,
+0,0,0,0,0,0,0,0,0,5,8,7,9,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,11,
+4,0,0,0,0,0,0,8,0,0,0,10,7,0,4,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,6,0,0,8,0,
+0,0,0,0,0,5,0,6,0,0,10,0,14,0,0,0,0,0,0,0,23,0,0,0,12,0,10,5,0,0,0,0,0,0,0,0,0,
+5,0,0,0,0,8,0,0,0,0,6,8,0,0,0,0,0,0,0,0,0,22,0,8,0,0,0,0,6,0,0,0,0,0,0,0,5,0,0,
+0,0,0,0,0,6,18,4,0,0,0,7,10,6,0,6,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,
+0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,7,10,0,0,0,0,0,0,6,0,0,0,0,11,5,0,0,0,0,0,0,0,0,
+15,0,8,6,0,0,13,7,0,0,0,0,0,7,0,0,0,0,0,7,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,9,5,9,
+0,0,6,8,6,0,0,0,0,10,0,0,0,18,5,0,0,0,5,0,7,0,0,0,0,8,6,0,0,0,0,9,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,14,0,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,6,0,0,0,5,0,
+0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,8,5,0,0,0,0,0,0,0,0,9,0,0,0,0,4,0,0,0,0,0,0,0,0,
+0,0,0,0,20,5,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,9,5,0,0,0,0,0,0,8,4,24,0,0,0,0,0,0,
+0,0,0,0,0,0,0,9,7,0,0,0,0,10,5,0,0,8,5,0,0,0,0,0,0,0,0,12,7,0,6,0,0,10,6,0,0,0,
+0,14,0,0,4,9,5,0,0,0,0,0,0,9,0,0,0,0,0,0,6,0,0,0,0,0,4,0,0,8,0,0,0,0,0,11,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,8,5,11,7,0,4,0,0,10,0,0,0,0,
+0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,11,6,0,0,0,0,0,5,14,6,0,0,0,0,10,0,0,
+0,13,4,0,0,0,0,0,0,0,0,0,0,0,6,0,0,10,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,7,12,0,10,6,0,0,0,0,0,0,10,0,0,0,0,0,10,0,9,
+7,0,0,0,0,0,0,0,0,0,0,0,0,0,7,8,0,0,0,0,0,0,0,0,0,0,0,0,4,0,7,0,0,0,0,9,7,0,0,0,
+0,0,0,0,0,0,0,0,0,24,0,11,7,0,7,0,0,0,0,0,0,8,6,0,0,0,0,0,0,8,7,0,0,0,0,0,5,0,0,
+0,6,9,0,0,0,23,5,0,0,0,0,0,6,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,7,0,0,0,
+0,0,0,0,0,0,0,0,0,0,6,0,0,18,4,0,0,11,7,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,
+0,0,0,6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,9,0,0,0,11,0,0,0,23,0,0,
+0,10,4,0,0,0,0,0,7,0,0,0,7,0,0,0,0,0,4,0,0,0,0,0,7,0,0,19,0,11,0,0,0,0,0,12,7,0,
+0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,0,0,0,6,0,0,
+9,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,4,0,0,0,0,10,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,4,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,22,0,8,7,10,4,11,0,13,5,8,7,9,0,8,7,0,0,0,7,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,
+0,8,0,0,0,0,0,0,0,8,6,0,0,0,0,0,0,0,0,0,0,0,6,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,4,0,0,0,4,11,0,0,6,0,0,8,5,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,8,5,0,0,
+20,0,0,0,0,0,0,0,0,0,11,0,0,0,0,5,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,7,0,0,14,0,0,0,9,0,13,7,0,0,0,0,0,6,0,7,0,0,8,6,10,6,0,0,8,6,0,0,0,6,0,
+0,12,6,9,0,0,0,0,0,0,5,9,0,12,4,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,8,5,0,0,0,0,0,
+0,0,4,8,0,0,6,8,0,0,0,0,0,0,0,0,0,13,6,0,7,0,0,0,0,0,6,8,7,8,6,0,0,0,7,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,18,0,11,4,0,0,0,5,0,0,0,0,0,0,0,0,0,0,
+0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,14,
+6,0,0,0,0,12,7,8,0,0,0,0,0,0,0,8,7,0,0,0,0,10,4,0,0,0,0,0,0,10,0,0,6,0,0,0,0,0,
+0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,15,6,9,7,0,0,0,0,0,0,15,6,11,7,0,0,0,7,0,0,21,0,0,
+0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,17,6,0,0,10,5,0,5,0,0,0,0,0,0,0,0,0,7,
+0,0,10,0,0,0,0,0,0,0,0,4,11,5,0,0,0,0,16,7,0,0,0,0,0,6,0,0,8,7,0,4,0,0,10,0,0,0,
+0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,8,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,
+0,0,0,10,4,0,0,0,0,0,0,0,0,0,6,0,5,0,0,9,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,
+0,7,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,6,10,7,0,0,0,0,0,0,0,0,8,4,0,0,10,0,0,0,0,4,0,6,0,6,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,17,0,0,0,0,0,
+0,0,0,0,0,0,10,0,0,7,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+6,0,0,0,5,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,5,0,4,0,0,0,0,0,6,0,0,0,0,0,0,10,5,0,0,
+0,5,0,0,0,0,9,0,19,7,0,0,0,0,0,7,0,0,0,0,10,6,0,0,0,6,0,5,0,0,0,0,0,0,0,0,0,6,8,
+0,0,0,0,0,11,0,0,0,0,0,0,6,0,0,0,0,0,7,9,0,15,0,0,0,0,0,0,0,0,0,0,4,0,0,0,5,0,0,
+0,0,0,0,0,6,0,0,0,0,0,0,0,4,0,0,0,0,9,0,0,0,0,0,0,0,0,6,0,7,0,0,0,0,0,0,0,6,0,0,
+0,0,0,6,10,0,0,0,0,0,0,0,23,0,14,0,0,0,0,7,0,0,0,0,0,7,0,0,9,0,0,0,0,7,0,0,0,0,
+0,6,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,4,0,0,0,
+0,0,0,0,0,9,5,0,0,0,0,0,4,0,0,0,0,9,5,0,0,0,0,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,22,0,0,0,0,0,0,0,10,0,0,0,0,0,0,5,0,4,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,6,11,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,14,7,0,0,12,7,0,0,0,
+0,0,0,0,0,0,4,0,0,0,0,0,6,0,0,0,0,8,6,10,0,0,0,0,0,0,0,0,0,10,7,8,5,0,0,0,0,0,0,
+0,0,8,4,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,5,0,0,9,5,0,0,0,0,0,5,0,0,0,0,0,4,0,0,0,
+0,0,0,0,0,0,0,12,4,11,0,0,0,9,0,11,7,0,0,0,0,0,0,10,6,0,0,0,6,0,0,0,0,15,5,0,0,
+11,6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,4,0,4,0,6,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,8,0,0,0,19,7,0,4,0,0,9,0,0,0,0,0,10,0,
+0,6,0,0,13,0,12,6,0,0,0,0,0,0,0,0,10,7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,13,7,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,6,0,6,0,4,9,0,0,0,10,0,0,0,0,0,0,0,
+0,5,0,0,0,0,0,0,10,0,23,6,0,0,0,6,8,0,0,0,0,0,0,0,0,0,17,7,0,0,0,0,11,6,22,5,0,
+0,9,6,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,9,6,0,5,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,4,11,0,9,4,0,0,
+0,7,0,7,0,0,0,0,0,0,12,4,0,0,0,0,0,0,0,0,0,0,0,0,11,4,0,0,0,0,0,0,0,0,0,0,0,0,0,
+4,0,0,11,5,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,8,6,0,0,0,4,0,0,0,0,
+0,0,0,0,0,7,0,0,0,4,0,0,10,4,0,0,0,0,0,0,0,7,0,7,0,0,0,6,0,0,0,0,8,6,0,6,0,6,0,
+0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,8,7,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,6,0,0,0,0,0,0,9,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,6,22,6,12,0,0,6,0,0,0,6,0,0,0,0,0,7,0,0,0,0,11,0,0,0,
+9,7,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,6,0,0,0,6,0,6,0,0,8,7,0,0,0,4,9,7,19,0,0,0,0,0,0,0,0,0,9,6,10,6,0,6,0,0,0,
+4,0,0,8,7,0,0,0,0,0,0,0,0,0,0,0,6,16,7,10,6,0,0,23,6,11,7,0,4,0,0,0,0,0,0,0,0,0,
+5,0,0,0,0,10,7,0,0,0,0,0,7,0,0,0,0,0,0,15,0,10,0,0,0,14,6,0,0,0,0,0,0,0,0,0,0,0,
+5,0,0,0,0,0,0,0,5,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,5,0,0,11,5,0,0,0,0,0,0,0,0,0,0,
+0,4,0,0,0,0,0,6,0,0,10,0,0,0,0,7,0,0,0,0,0,0,10,6,0,0,0,0,8,4,0,0,0,7,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,7,12,5,0,0,0,0,
+0,6,0,0,0,0,9,6,0,0,0,0,0,0,0,6,9,0,0,0,0,6,0,0,0,0,8,7,0,0,0,0,0,0,0,6,0,0,0,0,
+0,0,0,0,0,0,10,5,0,0,0,0,0,0,8,6,0,0,0,0,0,6,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,8,5,0,0,0,0,0,7,0,7,0,4,0,0,10,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,5,0,0,0,0,13,
+7,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,7,0,0,13,0,0,0,0,0,0,0,0,7,10,5,0,0,0,0,0,0,9,7,0,0,8,6,9,
+5,0,0,0,0,0,6,12,0,0,0,0,0,0,0,18,6,0,0,0,0,0,0,0,0,19,7,0,4,0,0,0,0,9,5,0,5,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,7,0,0,0,0,0,0,14,0,0,0,23,7,8,7,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,22,0,0,7,0,0,0,0,0,0,0,0,9,7,8,4,0,
+0,0,0,0,0,0,0,8,5,0,6,0,0,0,0,0,6,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,
+8,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,12,5,0,0,0,0,0,0,0,0,0,0,8,6,0,0,11,7,0,0,0,
+0,12,0,8,6,19,7,0,0,0,0,0,0,0,0,0,0,0,0,0,6,11,0,0,6,0,7,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,11,7,0,0,0,0,0,4,10,0,0,0,0,0,0,0,8,7,0,0,0,0,14,0,8,0,0,6,10,0,0,
+0,0,0,0,0,12,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,6,0,0,0,0,
+0,0,0,0,13,0,0,0,0,0,0,0,11,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,
+0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,5,0,0,0,6,0,0,0,5,0,7,0,0,0,
+0,0,6,0,0,21,7,0,0,9,6,0,0,0,6,0,0,13,7,0,0,0,5,0,0,0,0,0,4,0,6,0,0,0,0,0,0,0,0,
+0,0,0,4,0,0,0,0,0,0,11,5,0,6,0,0,10,5,0,0,0,0,0,0,0,0,9,6,0,0,8,7,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,9,0,0,0,0,0,0,6,0,0,0,0,15,4,0,0,12,7,0,0,0,6,
+0,7,0,0,8,0,9,5,0,4,0,0,0,6,0,6,0,0,23,4,0,0,0,0,0,0,0,0,0,0,0,0,10,7,0,4,0,0,8,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,6,0,0,0,0,0,0,0,0,0,
+7,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,12,6,0,0,0,0,0,0,10,7,0,7,0,0,0,0,0,0,0,0,0,0,
+9,0,0,0,0,0,8,0,0,0,0,4,0,0,0,0,0,0,0,0,0,4,11,5,0,0,0,6,0,6,0,0,0,0,0,0,0,6,0,
+4,0,0,0,0,0,0,0,0,0,0,0,5,8,4,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,6,8,7,0,0,0,6,0,6,0,
+0,0,0,0,0,0,0,0,5,0,0,0,0,0,5,0,0,0,0,11,0,0,0,0,0,0,0,10,5,9,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,23,7,0,0,0,0,0,7,0,0,10,6,18,0,0,0,
+0,0,0,0,8,7,0,6,0,0,0,0,0,0,8,5,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,
+0,0,0,0,0,6,0,0,0,4,12,7,0,0,0,0,0,0,0,0,10,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,6,0,0,0,0,0,0,13,5,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,4,0,0,0,0,0,0,0,0,
+11,7,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,
+0,0,0,0,6,0,0,0,4,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,10,0,11,0,0,0,0,0,0,0,0,0,
+17,5,0,4,0,0,0,0,0,0,0,7,0,0,0,0,0,6,0,0,0,0,0,0,0,4,0,0,0,0,8,7,0,0,0,0,0,0,0,
+0,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,
+10,0,0,0,8,6,0,0,0,7,0,0,0,0,0,0,8,0,0,0,14,0,0,0,0,7,0,0,0,4,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,9,4,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,
+10,0,0,0,16,5,0,0,0,0,0,0,8,0,0,4,0,0,0,0,0,0,0,0,0,0,9,6,0,0,0,0,0,0,10,0,0,0,
+0,0,0,0,0,5,0,0,0,0,12,5,0,7,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,7,0,
+0,0,0,0,0,0,0,12,6,0,0,0,0,0,7,0,6,0,6,12,6,0,0,0,0,0,0,0,4,8,7,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,6,0,6,0,0,0,0,0,0,0,0,10,6,8,0,0,
+6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+16,0,8,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,23,5,0,0,0,7,0,6,0,
+0,0,0,0,0,0,0,0,0,0,0,10,6,0,0,9,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,14,0,0,0,0,7,0,0,0,4,17,5,0,0,0,0,11,0,9,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,6,0,0,0,5,0,7,0,0,0,0,0,0,0,0,8,0,0,0,
+12,6,0,0,0,0,0,0,13,0,0,0,0,7,9,0,0,0,0,0,0,0,0,0,0,5,0,0,0,7,10,7,12,0,0,0,9,0,
+0,0,14,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,15,6,0,0,23,0,0,7,0,6,0,0,0,7,0,6,
+0,0,0,0,0,0,0,6,0,6,9,0,0,0,0,0,0,0,8,7,0,0,0,0,0,0,0,0,8,7,9,4,0,0,10,0,0,0,10,
+6,0,7,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,23,0,0,6,0,0,0,0,0,0,9,4,
+0,0,10,7,0,0,0,0,0,0,0,0,0,0,0,0,9,7,0,0,9,6,0,0,0,0,8,6,0,0,0,0,0,0,0,0,12,0,0,
+0,0,0,8,0,0,6,11,6,0,0,8,7,8,5,0,0,0,0,0,5,0,0,0,0,0,0,0,4,0,0,0,4,0,0,0,0,0,0,
+10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,
+7,0,0,0,0,9,6,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,8,0,0,0,0,6,12,5,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,10,0,10,
+7,0,0,8,0,0,0,0,4,0,0,0,6,0,0,0,6,0,0,0,6,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,5,0,
+0,0,4,0,0,0,0,0,4,0,0,0,0,0,0,0,6,0,6,0,5,0,0,0,0,8,0,0,0,10,7,0,0,0,0,10,0,0,0,
+0,0,13,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,19,7,0,4,12,0,8,0,0,0,0,6,0,0,0,0,
+0,0,0,6,0,0,0,0,0,0,0,0,0,4,0,0,0,0,18,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,
+0,14,0,0,4,0,0,0,6,0,0,0,6,0,0,0,7,0,0,0,0,0,0,10,4,0,0,9,7,0,0,11,0,0,0,0,0,0,
+7,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,4,0,0,12,0,0,0,
+0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,22,5,9,7,0,0,0,0,0,0,0,0,0,
+0,0,6,0,0,9,6,0,5,0,0,0,0,0,0,10,5,0,0,8,6,0,6,10,5,0,0,0,6,0,0,0,6,0,0,20,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,6,0,0,0,0,17,4,0,7,0,6,
+0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,
+0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,7,0,0,0,0,0,0,0,
+0,0,7,0,0,8,6,12,0,0,7,18,7,0,0,8,4,0,0,0,0,9,6,0,0,0,0,0,0,0,0,13,0,0,6,0,0,0,
+0,0,0,0,0,0,0,10,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,7,0,0,
+0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,8,5,0,0,0,0,0,0,0,0,12,0,0,0,8,0,0,0,0,0,0,
+4,0,0,10,0,16,0,0,0,0,0,0,0,12,7,10,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,16,6,10,0,0,5,0,0,0,0,0,6,0,0,0,0,
+0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,5,8,7,0,7,0,0,0,0,0,0,0,0,8,0,0,6,0,0,0,6,0,0,0,4,0,0,0,0,
+8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,7,0,0,8,0,0,0,
+9,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,7,13,5,0,5,0,0,0,7,8,4,0,0,0,0,0,0,0,
+0,12,0,0,0,0,0,0,0,0,0,0,0,8,6,0,6,0,0,11,0,0,0,0,0,0,0,0,6,0,0,0,0,0,4,0,0,0,0,
+0,0,0,0,0,6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,10,7,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,11,6,0,0,10,6,0,0,
+0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,
+0,0,0,6,0,0,0,7,0,0,9,0,8,7,11,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,9,6,10,5,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,10,7,0,0,0,0,0,0,11,0,9,6,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,5,0,6,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,15,5,12,5,
+0,0,0,0,0,0,12,7,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,12,6,0,
+0,0,0,24,4,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,7,0,0,0,0,0,0,0,0,0,0,
+0,0,0,4,10,4,0,0,0,0,10,7,0,0,0,0,0,0,0,0,0,0,0,0,9,0,11,0,0,0,0,0,0,0,0,0,0,6,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
+0,0,8,0,0,0,0,7,0,0,0,0,0,0,10,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,10,7,0,0,0,0,0,
+0,0,0,0,0,14,7,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,4,0,0,0,6,0,0,0,0,0,6,0,0,0,6,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,0,0,0,0,4,0,0,0,4,0,0,0,0,0,7,20,7,11,4,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,7,9,6,0,0,12,7,0,0,0,0,0,0,10,0,12,0,
+0,0,0,0,0,4,9,6,13,0,0,0,0,0,0,0,0,6,0,0,0,6,0,0,0,5,0,0,0,0,0,0,8,0,0,0,0,0,0,
+0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,11,0,9,0,0,0,0,4,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,5,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,
+0,4,0,5,0,0,0,0,0,0,0,0,0,4,0,0,0,0,9,7,8,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,
+0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,6,
+0,0,0,0,8,7,0,0,0,0,0,0,12,0,0,6,0,0,0,0,0,0,0,6,8,4,0,0,10,7,0,0,10,0,0,0,0,0,
+0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,7,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,4,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,7,0,0,0,0,0,0,0,5,
+0,4,0,0,0,0,0,6,0,0,0,0,0,0,8,0,0,6,0,0,0,6,0,0,0,0,0,7,0,5,8,4,0,0,9,0,0,0,0,4,
+0,0,0,0,0,0,0,0,0,5,0,0,15,6,8,6,0,0,0,6,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,6,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,9,6,0,0,0,0,0,0,0,7,0,0,0,4,0,
+6,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,6,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,9,5,0,6,12,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,8,7,0,6,0,0,0,0,0,0,0,0,0,0,0,0,11,0,12,7,0,0,0,0,
+0,0,0,0,0,5,0,5,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,11,4,0,0,0,0,0,0,0,0,0,0,10,
+7,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,7,8,7,9,6,0,0,0,0,0,0,0,0,8,6,0,0,0,0,0,5,12,0,
+10,5,12,6,0,0,0,7,0,0,0,0,0,0,0,5,0,0,0,5,9,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,
+11,7,0,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,0,6,0,7,0,0,0,0,8,0,8,5,0,6,0,0,0,6,0,0,0,
+0,0,0,0,6,0,6,0,6,9,0,0,5,17,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,7,0,0,
+0,0,0,7,0,0,0,0,16,5,0,0,0,0,0,0,0,4,0,0,0,5,11,5,0,7,0,0,0,4,8,7,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,7,0,0,0,0,12,0,0,0,
+0,0,12,0,0,0,0,0,0,0,0,4,10,4,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,6,0,0,0,0,0,0,0,4,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,20,5,0,0,
+10,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,12,0,0,0,0,0,0,6,0,0,0,0,0,0,9,4,10,7,0,4,0,0,
+0,0,0,0,10,6,0,0,0,0,8,4,0,7,8,6,0,6,8,0,10,0,0,0,0,0,13,5,0,6,0,0,0,0,0,0,22,4,
+0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,6,0,0,0,6,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,6,10,
+5,8,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,10,4,0,0,10,7,0,0,0,0,0,5,0,
+5,8,0,0,0,0,6,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,10,7,0,0,0,4,0,0,0,0,0,6,0,0,
+0,0,0,0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,7,0,0,0,6,0,0,0,0,0,0,0,0,0,
+4,0,0,0,4,10,0,0,6,13,7,8,0,0,0,0,0,0,7,0,0,12,7,0,0,0,0,0,0,10,5,0,0,0,0,0,6,0,
+0,0,0,0,0,0,0,0,0,13,7,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,6,0,0,0,0,0,0,0,0,8,6,0,6,
+0,0,0,0,0,0,0,0,12,0,8,4,0,0,0,0,0,4,0,4,0,0,0,0,0,0,0,5,0,0,0,0,12,5,0,0,0,7,0,
+0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,6,10,0,0,0,20,0,0,5,0,0,10,
+7,11,7,0,0,0,0,0,0,0,0,0,0,17,0,9,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,10,7,0,4,0,6,0,0,24,0,0,5,0,0,0,0,8,0,0,
+0,0,0,0,0,10,5,0,4,0,6,0,0,8,0,0,0,0,0,0,4,0,6,0,0,0,0,0,0,9,5,0,0,0,0,0,0,0,0,
+0,0,0,6,0,0,0,0,9,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,4,0,7,
+0,0,13,0,0,0,0,0,0,0,11,6,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,
+17,7,0,0,11,6,0,0,0,0,12,6,0,0,0,6,0,6,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,5,0,0,0,6,0,0,0,0,0,0,0,0,0,0,10,0,0,4,8,6,0,0,0,
+0,0,0,9,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,9,5,0,7,18,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,0,0,0,0,0,0,8,0,0,0,
+0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,
+0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,4,0,6,0,0,9,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,
+0,0,0,8,7,10,0,8,5,0,0,0,0,0,0,0,0,9,0,0,0,10,0,0,0,0,6,0,7,0,4,0,0,0,0,0,0,0,0,
+8,0,0,0,0,0,8,4,0,0,0,0,0,5,0,0,10,0,12,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+4,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,6,11,0,0,
+7,0,0,0,0,0,6,10,5,0,0,0,0,0,0,0,0,0,5,0,0,9,5,12,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,6,0,0,0,0,13,6,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,
+0,0,0,8,4,0,6,12,0,0,0,0,0,0,0,0,0,0,0,0,6,0,6,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,11,4,0,0,0,6,14,0,11,0,9,6,0,0,0,0,0,0,22,0,12,0,8,6,0,0,0,0,0,0,0,6,0,
+0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,
+10,7,0,0,0,0,0,0,0,0,9,0,0,0,0,4,0,0,0,0,0,0,0,0,0,5,11,0,0,0,0,0,0,0,8,6,0,0,9,
+7,0,0,12,4,0,0,0,0,0,0,12,6,0,6,0,7,0,0,8,5,0,0,0,0};
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/dictionary_hash.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/dictionary_hash.h
new file mode 100644
index 000000000..e553ea5d4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/dictionary_hash.h
@@ -0,0 +1,25 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Hash table on the 4-byte prefixes of static dictionary words. */
+
+#ifndef BROTLI_ENC_DICTIONARY_HASH_H_
+#define BROTLI_ENC_DICTIONARY_HASH_H_
+
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+extern const uint16_t kStaticDictionaryHashWords[32768];
+extern const uint8_t kStaticDictionaryHashLengths[32768];
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_DICTIONARY_HASH_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c
new file mode 100644
index 000000000..68548ef55
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c
@@ -0,0 +1,1925 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Implementation of Brotli compressor. */
+
+#include <brotli/encode.h>
+
+#include <stdlib.h> /* free, malloc */
+#include <string.h> /* memcpy, memset */
+
+#include "../common/constants.h"
+#include "../common/context.h"
+#include "../common/platform.h"
+#include "../common/version.h"
+#include "./backward_references.h"
+#include "./backward_references_hq.h"
+#include "./bit_cost.h"
+#include "./brotli_bit_stream.h"
+#include "./compress_fragment.h"
+#include "./compress_fragment_two_pass.h"
+#include "./encoder_dict.h"
+#include "./entropy_encode.h"
+#include "./fast_log.h"
+#include "./hash.h"
+#include "./histogram.h"
+#include "./memory.h"
+#include "./metablock.h"
+#include "./prefix.h"
+#include "./quality.h"
+#include "./ringbuffer.h"
+#include "./utf8_util.h"
+#include "./write_bits.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#define COPY_ARRAY(dst, src) memcpy(dst, src, sizeof(src));
+
+typedef enum BrotliEncoderStreamState {
+ /* Default state. */
+ BROTLI_STREAM_PROCESSING = 0,
+ /* Intermediate state; after next block is emitted, byte-padding should be
+ performed before getting back to default state. */
+ BROTLI_STREAM_FLUSH_REQUESTED = 1,
+ /* Last metablock was produced; no more input is acceptable. */
+ BROTLI_STREAM_FINISHED = 2,
+ /* Flushing compressed block and writing meta-data block header. */
+ BROTLI_STREAM_METADATA_HEAD = 3,
+ /* Writing metadata block body. */
+ BROTLI_STREAM_METADATA_BODY = 4
+} BrotliEncoderStreamState;
+
+typedef enum BrotliEncoderFlintState {
+ BROTLI_FLINT_NEEDS_2_BYTES = 2,
+ BROTLI_FLINT_NEEDS_1_BYTE = 1,
+ BROTLI_FLINT_WAITING_FOR_PROCESSING = 0,
+ BROTLI_FLINT_WAITING_FOR_FLUSHING = -1,
+ BROTLI_FLINT_DONE = -2
+} BrotliEncoderFlintState;
+
+typedef struct BrotliEncoderStateStruct {
+ BrotliEncoderParams params;
+
+ MemoryManager memory_manager_;
+
+ uint64_t input_pos_;
+ RingBuffer ringbuffer_;
+ size_t cmd_alloc_size_;
+ Command* commands_;
+ size_t num_commands_;
+ size_t num_literals_;
+ size_t last_insert_len_;
+ uint64_t last_flush_pos_;
+ uint64_t last_processed_pos_;
+ int dist_cache_[BROTLI_NUM_DISTANCE_SHORT_CODES];
+ int saved_dist_cache_[4];
+ uint16_t last_bytes_;
+ uint8_t last_bytes_bits_;
+ /* "Flint" is a tiny uncompressed block emitted before the continuation
+ block to unwire literal context from previous data. Despite being int8_t,
+ field is actually BrotliEncoderFlintState enum. */
+ int8_t flint_;
+ uint8_t prev_byte_;
+ uint8_t prev_byte2_;
+ size_t storage_size_;
+ uint8_t* storage_;
+
+ Hasher hasher_;
+
+ /* Hash table for FAST_ONE_PASS_COMPRESSION_QUALITY mode. */
+ int small_table_[1 << 10]; /* 4KiB */
+ int* large_table_; /* Allocated only when needed */
+ size_t large_table_size_;
+ /* Command and distance prefix codes (each 64 symbols, stored back-to-back)
+ used for the next block in FAST_ONE_PASS_COMPRESSION_QUALITY. The command
+ prefix code is over a smaller alphabet with the following 64 symbols:
+ 0 - 15: insert length code 0, copy length code 0 - 15, same distance
+ 16 - 39: insert length code 0, copy length code 0 - 23
+ 40 - 63: insert length code 0 - 23, copy length code 0
+ Note that symbols 16 and 40 represent the same code in the full alphabet,
+ but we do not use either of them in FAST_ONE_PASS_COMPRESSION_QUALITY. */
+ uint8_t cmd_depths_[128];
+ uint16_t cmd_bits_[128];
+ /* The compressed form of the command and distance prefix codes for the next
+ block in FAST_ONE_PASS_COMPRESSION_QUALITY. */
+ uint8_t cmd_code_[512];
+ size_t cmd_code_numbits_;
+ /* Command and literal buffers for FAST_TWO_PASS_COMPRESSION_QUALITY. */
+ uint32_t* command_buf_;
+ uint8_t* literal_buf_;
+
+ uint8_t* next_out_;
+ size_t available_out_;
+ size_t total_out_;
+ /* Temporary buffer for padding flush bits or metadata block header / body. */
+ union {
+ uint64_t u64[2];
+ uint8_t u8[16];
+ } tiny_buf_;
+ uint32_t remaining_metadata_bytes_;
+ BrotliEncoderStreamState stream_state_;
+
+ BROTLI_BOOL is_last_block_emitted_;
+ BROTLI_BOOL is_initialized_;
+} BrotliEncoderStateStruct;
+
+static size_t InputBlockSize(BrotliEncoderState* s) {
+ return (size_t)1 << s->params.lgblock;
+}
+
+static uint64_t UnprocessedInputSize(BrotliEncoderState* s) {
+ return s->input_pos_ - s->last_processed_pos_;
+}
+
+static size_t RemainingInputBlockSize(BrotliEncoderState* s) {
+ const uint64_t delta = UnprocessedInputSize(s);
+ size_t block_size = InputBlockSize(s);
+ if (delta >= block_size) return 0;
+ return block_size - (size_t)delta;
+}
+
+BROTLI_BOOL BrotliEncoderSetParameter(
+ BrotliEncoderState* state, BrotliEncoderParameter p, uint32_t value) {
+ /* Changing parameters on the fly is not implemented yet. */
+ if (state->is_initialized_) return BROTLI_FALSE;
+ /* TODO: Validate/clamp parameters here. */
+ switch (p) {
+ case BROTLI_PARAM_MODE:
+ state->params.mode = (BrotliEncoderMode)value;
+ return BROTLI_TRUE;
+
+ case BROTLI_PARAM_QUALITY:
+ state->params.quality = (int)value;
+ return BROTLI_TRUE;
+
+ case BROTLI_PARAM_LGWIN:
+ state->params.lgwin = (int)value;
+ return BROTLI_TRUE;
+
+ case BROTLI_PARAM_LGBLOCK:
+ state->params.lgblock = (int)value;
+ return BROTLI_TRUE;
+
+ case BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:
+ if ((value != 0) && (value != 1)) return BROTLI_FALSE;
+ state->params.disable_literal_context_modeling = TO_BROTLI_BOOL(!!value);
+ return BROTLI_TRUE;
+
+ case BROTLI_PARAM_SIZE_HINT:
+ state->params.size_hint = value;
+ return BROTLI_TRUE;
+
+ case BROTLI_PARAM_LARGE_WINDOW:
+ state->params.large_window = TO_BROTLI_BOOL(!!value);
+ return BROTLI_TRUE;
+
+ case BROTLI_PARAM_NPOSTFIX:
+ state->params.dist.distance_postfix_bits = value;
+ return BROTLI_TRUE;
+
+ case BROTLI_PARAM_NDIRECT:
+ state->params.dist.num_direct_distance_codes = value;
+ return BROTLI_TRUE;
+
+ case BROTLI_PARAM_STREAM_OFFSET:
+ if (value > (1u << 30)) return BROTLI_FALSE;
+ state->params.stream_offset = value;
+ return BROTLI_TRUE;
+
+ default: return BROTLI_FALSE;
+ }
+}
+
+/* Wraps 64-bit input position to 32-bit ring-buffer position preserving
+ "not-a-first-lap" feature. */
+static uint32_t WrapPosition(uint64_t position) {
+ uint32_t result = (uint32_t)position;
+ uint64_t gb = position >> 30;
+ if (gb > 2) {
+ /* Wrap every 2GiB; The first 3GB are continuous. */
+ result = (result & ((1u << 30) - 1)) | ((uint32_t)((gb - 1) & 1) + 1) << 30;
+ }
+ return result;
+}
+
+static uint8_t* GetBrotliStorage(BrotliEncoderState* s, size_t size) {
+ MemoryManager* m = &s->memory_manager_;
+ if (s->storage_size_ < size) {
+ BROTLI_FREE(m, s->storage_);
+ s->storage_ = BROTLI_ALLOC(m, uint8_t, size);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(s->storage_)) return NULL;
+ s->storage_size_ = size;
+ }
+ return s->storage_;
+}
+
+static size_t HashTableSize(size_t max_table_size, size_t input_size) {
+ size_t htsize = 256;
+ while (htsize < max_table_size && htsize < input_size) {
+ htsize <<= 1;
+ }
+ return htsize;
+}
+
+static int* GetHashTable(BrotliEncoderState* s, int quality,
+ size_t input_size, size_t* table_size) {
+ /* Use smaller hash table when input.size() is smaller, since we
+ fill the table, incurring O(hash table size) overhead for
+ compression, and if the input is short, we won't need that
+ many hash table entries anyway. */
+ MemoryManager* m = &s->memory_manager_;
+ const size_t max_table_size = MaxHashTableSize(quality);
+ size_t htsize = HashTableSize(max_table_size, input_size);
+ int* table;
+ BROTLI_DCHECK(max_table_size >= 256);
+ if (quality == FAST_ONE_PASS_COMPRESSION_QUALITY) {
+ /* Only odd shifts are supported by fast-one-pass. */
+ if ((htsize & 0xAAAAA) == 0) {
+ htsize <<= 1;
+ }
+ }
+
+ if (htsize <= sizeof(s->small_table_) / sizeof(s->small_table_[0])) {
+ table = s->small_table_;
+ } else {
+ if (htsize > s->large_table_size_) {
+ s->large_table_size_ = htsize;
+ BROTLI_FREE(m, s->large_table_);
+ s->large_table_ = BROTLI_ALLOC(m, int, htsize);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(s->large_table_)) return 0;
+ }
+ table = s->large_table_;
+ }
+
+ *table_size = htsize;
+ memset(table, 0, htsize * sizeof(*table));
+ return table;
+}
+
+static void EncodeWindowBits(int lgwin, BROTLI_BOOL large_window,
+ uint16_t* last_bytes, uint8_t* last_bytes_bits) {
+ if (large_window) {
+ *last_bytes = (uint16_t)(((lgwin & 0x3F) << 8) | 0x11);
+ *last_bytes_bits = 14;
+ } else {
+ if (lgwin == 16) {
+ *last_bytes = 0;
+ *last_bytes_bits = 1;
+ } else if (lgwin == 17) {
+ *last_bytes = 1;
+ *last_bytes_bits = 7;
+ } else if (lgwin > 17) {
+ *last_bytes = (uint16_t)(((lgwin - 17) << 1) | 0x01);
+ *last_bytes_bits = 4;
+ } else {
+ *last_bytes = (uint16_t)(((lgwin - 8) << 4) | 0x01);
+ *last_bytes_bits = 7;
+ }
+ }
+}
+
+/* Initializes the command and distance prefix codes for the first block. */
+static void InitCommandPrefixCodes(uint8_t cmd_depths[128],
+ uint16_t cmd_bits[128],
+ uint8_t cmd_code[512],
+ size_t* cmd_code_numbits) {
+ static const uint8_t kDefaultCommandDepths[128] = {
+ 0, 4, 4, 5, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8,
+ 0, 0, 0, 4, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7,
+ 7, 7, 10, 10, 10, 10, 10, 10, 0, 4, 4, 5, 5, 5, 6, 6,
+ 7, 8, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4,
+ 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 7, 7, 7, 8, 10,
+ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ };
+ static const uint16_t kDefaultCommandBits[128] = {
+ 0, 0, 8, 9, 3, 35, 7, 71,
+ 39, 103, 23, 47, 175, 111, 239, 31,
+ 0, 0, 0, 4, 12, 2, 10, 6,
+ 13, 29, 11, 43, 27, 59, 87, 55,
+ 15, 79, 319, 831, 191, 703, 447, 959,
+ 0, 14, 1, 25, 5, 21, 19, 51,
+ 119, 159, 95, 223, 479, 991, 63, 575,
+ 127, 639, 383, 895, 255, 767, 511, 1023,
+ 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 27, 59, 7, 39, 23, 55, 30, 1, 17, 9, 25, 5, 0, 8, 4, 12,
+ 2, 10, 6, 21, 13, 29, 3, 19, 11, 15, 47, 31, 95, 63, 127, 255,
+ 767, 2815, 1791, 3839, 511, 2559, 1535, 3583, 1023, 3071, 2047, 4095,
+ };
+ static const uint8_t kDefaultCommandCode[] = {
+ 0xff, 0x77, 0xd5, 0xbf, 0xe7, 0xde, 0xea, 0x9e, 0x51, 0x5d, 0xde, 0xc6,
+ 0x70, 0x57, 0xbc, 0x58, 0x58, 0x58, 0xd8, 0xd8, 0x58, 0xd5, 0xcb, 0x8c,
+ 0xea, 0xe0, 0xc3, 0x87, 0x1f, 0x83, 0xc1, 0x60, 0x1c, 0x67, 0xb2, 0xaa,
+ 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, 0xcc, 0xa1, 0xce, 0x88, 0x54, 0x94,
+ 0x46, 0xe1, 0xb0, 0xd0, 0x4e, 0xb2, 0xf7, 0x04, 0x00,
+ };
+ static const size_t kDefaultCommandCodeNumBits = 448;
+ COPY_ARRAY(cmd_depths, kDefaultCommandDepths);
+ COPY_ARRAY(cmd_bits, kDefaultCommandBits);
+
+ /* Initialize the pre-compressed form of the command and distance prefix
+ codes. */
+ COPY_ARRAY(cmd_code, kDefaultCommandCode);
+ *cmd_code_numbits = kDefaultCommandCodeNumBits;
+}
+
+/* Decide about the context map based on the ability of the prediction
+ ability of the previous byte UTF8-prefix on the next byte. The
+ prediction ability is calculated as Shannon entropy. Here we need
+ Shannon entropy instead of 'BitsEntropy' since the prefix will be
+ encoded with the remaining 6 bits of the following byte, and
+ BitsEntropy will assume that symbol to be stored alone using Huffman
+ coding. */
+static void ChooseContextMap(int quality,
+ uint32_t* bigram_histo,
+ size_t* num_literal_contexts,
+ const uint32_t** literal_context_map) {
+ static const uint32_t kStaticContextMapContinuation[64] = {
+ 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ };
+ static const uint32_t kStaticContextMapSimpleUTF8[64] = {
+ 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ };
+
+ uint32_t monogram_histo[3] = { 0 };
+ uint32_t two_prefix_histo[6] = { 0 };
+ size_t total;
+ size_t i;
+ size_t dummy;
+ double entropy[4];
+ for (i = 0; i < 9; ++i) {
+ monogram_histo[i % 3] += bigram_histo[i];
+ two_prefix_histo[i % 6] += bigram_histo[i];
+ }
+ entropy[1] = ShannonEntropy(monogram_histo, 3, &dummy);
+ entropy[2] = (ShannonEntropy(two_prefix_histo, 3, &dummy) +
+ ShannonEntropy(two_prefix_histo + 3, 3, &dummy));
+ entropy[3] = 0;
+ for (i = 0; i < 3; ++i) {
+ entropy[3] += ShannonEntropy(bigram_histo + 3 * i, 3, &dummy);
+ }
+
+ total = monogram_histo[0] + monogram_histo[1] + monogram_histo[2];
+ BROTLI_DCHECK(total != 0);
+ entropy[0] = 1.0 / (double)total;
+ entropy[1] *= entropy[0];
+ entropy[2] *= entropy[0];
+ entropy[3] *= entropy[0];
+
+ if (quality < MIN_QUALITY_FOR_HQ_CONTEXT_MODELING) {
+ /* 3 context models is a bit slower, don't use it at lower qualities. */
+ entropy[3] = entropy[1] * 10;
+ }
+ /* If expected savings by symbol are less than 0.2 bits, skip the
+ context modeling -- in exchange for faster decoding speed. */
+ if (entropy[1] - entropy[2] < 0.2 &&
+ entropy[1] - entropy[3] < 0.2) {
+ *num_literal_contexts = 1;
+ } else if (entropy[2] - entropy[3] < 0.02) {
+ *num_literal_contexts = 2;
+ *literal_context_map = kStaticContextMapSimpleUTF8;
+ } else {
+ *num_literal_contexts = 3;
+ *literal_context_map = kStaticContextMapContinuation;
+ }
+}
+
+/* Decide if we want to use a more complex static context map containing 13
+ context values, based on the entropy reduction of histograms over the
+ first 5 bits of literals. */
+static BROTLI_BOOL ShouldUseComplexStaticContextMap(const uint8_t* input,
+ size_t start_pos, size_t length, size_t mask, int quality, size_t size_hint,
+ size_t* num_literal_contexts, const uint32_t** literal_context_map) {
+ static const uint32_t kStaticContextMapComplexUTF8[64] = {
+ 11, 11, 12, 12, /* 0 special */
+ 0, 0, 0, 0, /* 4 lf */
+ 1, 1, 9, 9, /* 8 space */
+ 2, 2, 2, 2, /* !, first after space/lf and after something else. */
+ 1, 1, 1, 1, /* " */
+ 8, 3, 3, 3, /* % */
+ 1, 1, 1, 1, /* ({[ */
+ 2, 2, 2, 2, /* }]) */
+ 8, 4, 4, 4, /* :; */
+ 8, 7, 4, 4, /* . */
+ 8, 0, 0, 0, /* > */
+ 3, 3, 3, 3, /* [0..9] */
+ 5, 5, 10, 5, /* [A-Z] */
+ 5, 5, 10, 5,
+ 6, 6, 6, 6, /* [a-z] */
+ 6, 6, 6, 6,
+ };
+ BROTLI_UNUSED(quality);
+ /* Try the more complex static context map only for long data. */
+ if (size_hint < (1 << 20)) {
+ return BROTLI_FALSE;
+ } else {
+ const size_t end_pos = start_pos + length;
+ /* To make entropy calculations faster and to fit on the stack, we collect
+ histograms over the 5 most significant bits of literals. One histogram
+ without context and 13 additional histograms for each context value. */
+ uint32_t combined_histo[32] = { 0 };
+ uint32_t context_histo[13][32] = { { 0 } };
+ uint32_t total = 0;
+ double entropy[3];
+ size_t dummy;
+ size_t i;
+ ContextLut utf8_lut = BROTLI_CONTEXT_LUT(CONTEXT_UTF8);
+ for (; start_pos + 64 <= end_pos; start_pos += 4096) {
+ const size_t stride_end_pos = start_pos + 64;
+ uint8_t prev2 = input[start_pos & mask];
+ uint8_t prev1 = input[(start_pos + 1) & mask];
+ size_t pos;
+ /* To make the analysis of the data faster we only examine 64 byte long
+ strides at every 4kB intervals. */
+ for (pos = start_pos + 2; pos < stride_end_pos; ++pos) {
+ const uint8_t literal = input[pos & mask];
+ const uint8_t context = (uint8_t)kStaticContextMapComplexUTF8[
+ BROTLI_CONTEXT(prev1, prev2, utf8_lut)];
+ ++total;
+ ++combined_histo[literal >> 3];
+ ++context_histo[context][literal >> 3];
+ prev2 = prev1;
+ prev1 = literal;
+ }
+ }
+ entropy[1] = ShannonEntropy(combined_histo, 32, &dummy);
+ entropy[2] = 0;
+ for (i = 0; i < 13; ++i) {
+ entropy[2] += ShannonEntropy(&context_histo[i][0], 32, &dummy);
+ }
+ entropy[0] = 1.0 / (double)total;
+ entropy[1] *= entropy[0];
+ entropy[2] *= entropy[0];
+ /* The triggering heuristics below were tuned by compressing the individual
+ files of the silesia corpus. If we skip this kind of context modeling
+ for not very well compressible input (i.e. entropy using context modeling
+ is 60% of maximal entropy) or if expected savings by symbol are less
+ than 0.2 bits, then in every case when it triggers, the final compression
+ ratio is improved. Note however that this heuristics might be too strict
+ for some cases and could be tuned further. */
+ if (entropy[2] > 3.0 || entropy[1] - entropy[2] < 0.2) {
+ return BROTLI_FALSE;
+ } else {
+ *num_literal_contexts = 13;
+ *literal_context_map = kStaticContextMapComplexUTF8;
+ return BROTLI_TRUE;
+ }
+ }
+}
+
+static void DecideOverLiteralContextModeling(const uint8_t* input,
+ size_t start_pos, size_t length, size_t mask, int quality, size_t size_hint,
+ size_t* num_literal_contexts, const uint32_t** literal_context_map) {
+ if (quality < MIN_QUALITY_FOR_CONTEXT_MODELING || length < 64) {
+ return;
+ } else if (ShouldUseComplexStaticContextMap(
+ input, start_pos, length, mask, quality, size_hint,
+ num_literal_contexts, literal_context_map)) {
+ /* Context map was already set, nothing else to do. */
+ } else {
+ /* Gather bi-gram data of the UTF8 byte prefixes. To make the analysis of
+ UTF8 data faster we only examine 64 byte long strides at every 4kB
+ intervals. */
+ const size_t end_pos = start_pos + length;
+ uint32_t bigram_prefix_histo[9] = { 0 };
+ for (; start_pos + 64 <= end_pos; start_pos += 4096) {
+ static const int lut[4] = { 0, 0, 1, 2 };
+ const size_t stride_end_pos = start_pos + 64;
+ int prev = lut[input[start_pos & mask] >> 6] * 3;
+ size_t pos;
+ for (pos = start_pos + 1; pos < stride_end_pos; ++pos) {
+ const uint8_t literal = input[pos & mask];
+ ++bigram_prefix_histo[prev + lut[literal >> 6]];
+ prev = lut[literal >> 6] * 3;
+ }
+ }
+ ChooseContextMap(quality, &bigram_prefix_histo[0], num_literal_contexts,
+ literal_context_map);
+ }
+}
+
+static BROTLI_BOOL ShouldCompress(
+ const uint8_t* data, const size_t mask, const uint64_t last_flush_pos,
+ const size_t bytes, const size_t num_literals, const size_t num_commands) {
+ /* TODO: find more precise minimal block overhead. */
+ if (bytes <= 2) return BROTLI_FALSE;
+ if (num_commands < (bytes >> 8) + 2) {
+ if (num_literals > 0.99 * (double)bytes) {
+ uint32_t literal_histo[256] = { 0 };
+ static const uint32_t kSampleRate = 13;
+ static const double kMinEntropy = 7.92;
+ const double bit_cost_threshold =
+ (double)bytes * kMinEntropy / kSampleRate;
+ size_t t = (bytes + kSampleRate - 1) / kSampleRate;
+ uint32_t pos = (uint32_t)last_flush_pos;
+ size_t i;
+ for (i = 0; i < t; i++) {
+ ++literal_histo[data[pos & mask]];
+ pos += kSampleRate;
+ }
+ if (BitsEntropy(literal_histo, 256) > bit_cost_threshold) {
+ return BROTLI_FALSE;
+ }
+ }
+ }
+ return BROTLI_TRUE;
+}
+
+/* Chooses the literal context mode for a metablock */
+static ContextType ChooseContextMode(const BrotliEncoderParams* params,
+ const uint8_t* data, const size_t pos, const size_t mask,
+ const size_t length) {
+ /* We only do the computation for the option of something else than
+ CONTEXT_UTF8 for the highest qualities */
+ if (params->quality >= MIN_QUALITY_FOR_HQ_BLOCK_SPLITTING &&
+ !BrotliIsMostlyUTF8(data, pos, mask, length, kMinUTF8Ratio)) {
+ return CONTEXT_SIGNED;
+ }
+ return CONTEXT_UTF8;
+}
+
+static void WriteMetaBlockInternal(MemoryManager* m,
+ const uint8_t* data,
+ const size_t mask,
+ const uint64_t last_flush_pos,
+ const size_t bytes,
+ const BROTLI_BOOL is_last,
+ ContextType literal_context_mode,
+ const BrotliEncoderParams* params,
+ const uint8_t prev_byte,
+ const uint8_t prev_byte2,
+ const size_t num_literals,
+ const size_t num_commands,
+ Command* commands,
+ const int* saved_dist_cache,
+ int* dist_cache,
+ size_t* storage_ix,
+ uint8_t* storage) {
+ const uint32_t wrapped_last_flush_pos = WrapPosition(last_flush_pos);
+ uint16_t last_bytes;
+ uint8_t last_bytes_bits;
+ ContextLut literal_context_lut = BROTLI_CONTEXT_LUT(literal_context_mode);
+ BrotliEncoderParams block_params = *params;
+
+ if (bytes == 0) {
+ /* Write the ISLAST and ISEMPTY bits. */
+ BrotliWriteBits(2, 3, storage_ix, storage);
+ *storage_ix = (*storage_ix + 7u) & ~7u;
+ return;
+ }
+
+ if (!ShouldCompress(data, mask, last_flush_pos, bytes,
+ num_literals, num_commands)) {
+ /* Restore the distance cache, as its last update by
+ CreateBackwardReferences is now unused. */
+ memcpy(dist_cache, saved_dist_cache, 4 * sizeof(dist_cache[0]));
+ BrotliStoreUncompressedMetaBlock(is_last, data,
+ wrapped_last_flush_pos, mask, bytes,
+ storage_ix, storage);
+ return;
+ }
+
+ BROTLI_DCHECK(*storage_ix <= 14);
+ last_bytes = (uint16_t)((storage[1] << 8) | storage[0]);
+ last_bytes_bits = (uint8_t)(*storage_ix);
+ if (params->quality <= MAX_QUALITY_FOR_STATIC_ENTROPY_CODES) {
+ BrotliStoreMetaBlockFast(m, data, wrapped_last_flush_pos,
+ bytes, mask, is_last, params,
+ commands, num_commands,
+ storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ } else if (params->quality < MIN_QUALITY_FOR_BLOCK_SPLIT) {
+ BrotliStoreMetaBlockTrivial(m, data, wrapped_last_flush_pos,
+ bytes, mask, is_last, params,
+ commands, num_commands,
+ storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ } else {
+ MetaBlockSplit mb;
+ InitMetaBlockSplit(&mb);
+ if (params->quality < MIN_QUALITY_FOR_HQ_BLOCK_SPLITTING) {
+ size_t num_literal_contexts = 1;
+ const uint32_t* literal_context_map = NULL;
+ if (!params->disable_literal_context_modeling) {
+ DecideOverLiteralContextModeling(
+ data, wrapped_last_flush_pos, bytes, mask, params->quality,
+ params->size_hint, &num_literal_contexts,
+ &literal_context_map);
+ }
+ BrotliBuildMetaBlockGreedy(m, data, wrapped_last_flush_pos, mask,
+ prev_byte, prev_byte2, literal_context_lut, num_literal_contexts,
+ literal_context_map, commands, num_commands, &mb);
+ if (BROTLI_IS_OOM(m)) return;
+ } else {
+ BrotliBuildMetaBlock(m, data, wrapped_last_flush_pos, mask, &block_params,
+ prev_byte, prev_byte2,
+ commands, num_commands,
+ literal_context_mode,
+ &mb);
+ if (BROTLI_IS_OOM(m)) return;
+ }
+ if (params->quality >= MIN_QUALITY_FOR_OPTIMIZE_HISTOGRAMS) {
+ /* The number of distance symbols effectively used for distance
+ histograms. It might be less than distance alphabet size
+ for "Large Window Brotli" (32-bit). */
+ BrotliOptimizeHistograms(block_params.dist.alphabet_size_limit, &mb);
+ }
+ BrotliStoreMetaBlock(m, data, wrapped_last_flush_pos, bytes, mask,
+ prev_byte, prev_byte2,
+ is_last,
+ &block_params,
+ literal_context_mode,
+ commands, num_commands,
+ &mb,
+ storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return;
+ DestroyMetaBlockSplit(m, &mb);
+ }
+ if (bytes + 4 < (*storage_ix >> 3)) {
+ /* Restore the distance cache and last byte. */
+ memcpy(dist_cache, saved_dist_cache, 4 * sizeof(dist_cache[0]));
+ storage[0] = (uint8_t)last_bytes;
+ storage[1] = (uint8_t)(last_bytes >> 8);
+ *storage_ix = last_bytes_bits;
+ BrotliStoreUncompressedMetaBlock(is_last, data,
+ wrapped_last_flush_pos, mask,
+ bytes, storage_ix, storage);
+ }
+}
+
+static void ChooseDistanceParams(BrotliEncoderParams* params) {
+ uint32_t distance_postfix_bits = 0;
+ uint32_t num_direct_distance_codes = 0;
+
+ if (params->quality >= MIN_QUALITY_FOR_NONZERO_DISTANCE_PARAMS) {
+ uint32_t ndirect_msb;
+ if (params->mode == BROTLI_MODE_FONT) {
+ distance_postfix_bits = 1;
+ num_direct_distance_codes = 12;
+ } else {
+ distance_postfix_bits = params->dist.distance_postfix_bits;
+ num_direct_distance_codes = params->dist.num_direct_distance_codes;
+ }
+ ndirect_msb = (num_direct_distance_codes >> distance_postfix_bits) & 0x0F;
+ if (distance_postfix_bits > BROTLI_MAX_NPOSTFIX ||
+ num_direct_distance_codes > BROTLI_MAX_NDIRECT ||
+ (ndirect_msb << distance_postfix_bits) != num_direct_distance_codes) {
+ distance_postfix_bits = 0;
+ num_direct_distance_codes = 0;
+ }
+ }
+
+ BrotliInitDistanceParams(
+ params, distance_postfix_bits, num_direct_distance_codes);
+}
+
+static BROTLI_BOOL EnsureInitialized(BrotliEncoderState* s) {
+ if (BROTLI_IS_OOM(&s->memory_manager_)) return BROTLI_FALSE;
+ if (s->is_initialized_) return BROTLI_TRUE;
+
+ s->last_bytes_bits_ = 0;
+ s->last_bytes_ = 0;
+ s->flint_ = BROTLI_FLINT_DONE;
+ s->remaining_metadata_bytes_ = BROTLI_UINT32_MAX;
+
+ SanitizeParams(&s->params);
+ s->params.lgblock = ComputeLgBlock(&s->params);
+ ChooseDistanceParams(&s->params);
+
+ if (s->params.stream_offset != 0) {
+ s->flint_ = BROTLI_FLINT_NEEDS_2_BYTES;
+ /* Poison the distance cache. -16 +- 3 is still less than zero (invalid). */
+ s->dist_cache_[0] = -16;
+ s->dist_cache_[1] = -16;
+ s->dist_cache_[2] = -16;
+ s->dist_cache_[3] = -16;
+ memcpy(s->saved_dist_cache_, s->dist_cache_, sizeof(s->saved_dist_cache_));
+ }
+
+ RingBufferSetup(&s->params, &s->ringbuffer_);
+
+ /* Initialize last byte with stream header. */
+ {
+ int lgwin = s->params.lgwin;
+ if (s->params.quality == FAST_ONE_PASS_COMPRESSION_QUALITY ||
+ s->params.quality == FAST_TWO_PASS_COMPRESSION_QUALITY) {
+ lgwin = BROTLI_MAX(int, lgwin, 18);
+ }
+ if (s->params.stream_offset == 0) {
+ EncodeWindowBits(lgwin, s->params.large_window,
+ &s->last_bytes_, &s->last_bytes_bits_);
+ } else {
+ /* Bigger values have the same effect, but could cause overflows. */
+ s->params.stream_offset = BROTLI_MIN(size_t,
+ s->params.stream_offset, BROTLI_MAX_BACKWARD_LIMIT(lgwin));
+ }
+ }
+
+ if (s->params.quality == FAST_ONE_PASS_COMPRESSION_QUALITY) {
+ InitCommandPrefixCodes(s->cmd_depths_, s->cmd_bits_,
+ s->cmd_code_, &s->cmd_code_numbits_);
+ }
+
+ s->is_initialized_ = BROTLI_TRUE;
+ return BROTLI_TRUE;
+}
+
+static void BrotliEncoderInitParams(BrotliEncoderParams* params) {
+ params->mode = BROTLI_DEFAULT_MODE;
+ params->large_window = BROTLI_FALSE;
+ params->quality = BROTLI_DEFAULT_QUALITY;
+ params->lgwin = BROTLI_DEFAULT_WINDOW;
+ params->lgblock = 0;
+ params->stream_offset = 0;
+ params->size_hint = 0;
+ params->disable_literal_context_modeling = BROTLI_FALSE;
+ BrotliInitEncoderDictionary(&params->dictionary);
+ params->dist.distance_postfix_bits = 0;
+ params->dist.num_direct_distance_codes = 0;
+ params->dist.alphabet_size_max =
+ BROTLI_DISTANCE_ALPHABET_SIZE(0, 0, BROTLI_MAX_DISTANCE_BITS);
+ params->dist.alphabet_size_limit = params->dist.alphabet_size_max;
+ params->dist.max_distance = BROTLI_MAX_DISTANCE;
+}
+
+static void BrotliEncoderInitState(BrotliEncoderState* s) {
+ BrotliEncoderInitParams(&s->params);
+ s->input_pos_ = 0;
+ s->num_commands_ = 0;
+ s->num_literals_ = 0;
+ s->last_insert_len_ = 0;
+ s->last_flush_pos_ = 0;
+ s->last_processed_pos_ = 0;
+ s->prev_byte_ = 0;
+ s->prev_byte2_ = 0;
+ s->storage_size_ = 0;
+ s->storage_ = 0;
+ HasherInit(&s->hasher_);
+ s->large_table_ = NULL;
+ s->large_table_size_ = 0;
+ s->cmd_code_numbits_ = 0;
+ s->command_buf_ = NULL;
+ s->literal_buf_ = NULL;
+ s->next_out_ = NULL;
+ s->available_out_ = 0;
+ s->total_out_ = 0;
+ s->stream_state_ = BROTLI_STREAM_PROCESSING;
+ s->is_last_block_emitted_ = BROTLI_FALSE;
+ s->is_initialized_ = BROTLI_FALSE;
+
+ RingBufferInit(&s->ringbuffer_);
+
+ s->commands_ = 0;
+ s->cmd_alloc_size_ = 0;
+
+ /* Initialize distance cache. */
+ s->dist_cache_[0] = 4;
+ s->dist_cache_[1] = 11;
+ s->dist_cache_[2] = 15;
+ s->dist_cache_[3] = 16;
+ /* Save the state of the distance cache in case we need to restore it for
+ emitting an uncompressed block. */
+ memcpy(s->saved_dist_cache_, s->dist_cache_, sizeof(s->saved_dist_cache_));
+}
+
+BrotliEncoderState* BrotliEncoderCreateInstance(
+ brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque) {
+ BrotliEncoderState* state = 0;
+ if (!alloc_func && !free_func) {
+ state = (BrotliEncoderState*)malloc(sizeof(BrotliEncoderState));
+ } else if (alloc_func && free_func) {
+ state = (BrotliEncoderState*)alloc_func(opaque, sizeof(BrotliEncoderState));
+ }
+ if (state == 0) {
+ /* BROTLI_DUMP(); */
+ return 0;
+ }
+ BrotliInitMemoryManager(
+ &state->memory_manager_, alloc_func, free_func, opaque);
+ BrotliEncoderInitState(state);
+ return state;
+}
+
+static void BrotliEncoderCleanupState(BrotliEncoderState* s) {
+ MemoryManager* m = &s->memory_manager_;
+ if (BROTLI_IS_OOM(m)) {
+ BrotliWipeOutMemoryManager(m);
+ return;
+ }
+ BROTLI_FREE(m, s->storage_);
+ BROTLI_FREE(m, s->commands_);
+ RingBufferFree(m, &s->ringbuffer_);
+ DestroyHasher(m, &s->hasher_);
+ BROTLI_FREE(m, s->large_table_);
+ BROTLI_FREE(m, s->command_buf_);
+ BROTLI_FREE(m, s->literal_buf_);
+}
+
+/* Deinitializes and frees BrotliEncoderState instance. */
+void BrotliEncoderDestroyInstance(BrotliEncoderState* state) {
+ if (!state) {
+ return;
+ } else {
+ MemoryManager* m = &state->memory_manager_;
+ brotli_free_func free_func = m->free_func;
+ void* opaque = m->opaque;
+ BrotliEncoderCleanupState(state);
+ free_func(opaque, state);
+ }
+}
+
+/*
+ Copies the given input data to the internal ring buffer of the compressor.
+ No processing of the data occurs at this time and this function can be
+ called multiple times before calling WriteBrotliData() to process the
+ accumulated input. At most input_block_size() bytes of input data can be
+ copied to the ring buffer, otherwise the next WriteBrotliData() will fail.
+ */
+static void CopyInputToRingBuffer(BrotliEncoderState* s,
+ const size_t input_size,
+ const uint8_t* input_buffer) {
+ RingBuffer* ringbuffer_ = &s->ringbuffer_;
+ MemoryManager* m = &s->memory_manager_;
+ RingBufferWrite(m, input_buffer, input_size, ringbuffer_);
+ if (BROTLI_IS_OOM(m)) return;
+ s->input_pos_ += input_size;
+
+ /* TL;DR: If needed, initialize 7 more bytes in the ring buffer to make the
+ hashing not depend on uninitialized data. This makes compression
+ deterministic and it prevents uninitialized memory warnings in Valgrind.
+ Even without erasing, the output would be valid (but nondeterministic).
+
+ Background information: The compressor stores short (at most 8 bytes)
+ substrings of the input already read in a hash table, and detects
+ repetitions by looking up such substrings in the hash table. If it
+ can find a substring, it checks whether the substring is really there
+ in the ring buffer (or it's just a hash collision). Should the hash
+ table become corrupt, this check makes sure that the output is
+ still valid, albeit the compression ratio would be bad.
+
+ The compressor populates the hash table from the ring buffer as it's
+ reading new bytes from the input. However, at the last few indexes of
+ the ring buffer, there are not enough bytes to build full-length
+ substrings from. Since the hash table always contains full-length
+ substrings, we erase with dummy zeros here to make sure that those
+ substrings will contain zeros at the end instead of uninitialized
+ data.
+
+ Please note that erasing is not necessary (because the
+ memory region is already initialized since he ring buffer
+ has a `tail' that holds a copy of the beginning,) so we
+ skip erasing if we have already gone around at least once in
+ the ring buffer.
+
+ Only clear during the first round of ring-buffer writes. On
+ subsequent rounds data in the ring-buffer would be affected. */
+ if (ringbuffer_->pos_ <= ringbuffer_->mask_) {
+ /* This is the first time when the ring buffer is being written.
+ We clear 7 bytes just after the bytes that have been copied from
+ the input buffer.
+
+ The ring-buffer has a "tail" that holds a copy of the beginning,
+ but only once the ring buffer has been fully written once, i.e.,
+ pos <= mask. For the first time, we need to write values
+ in this tail (where index may be larger than mask), so that
+ we have exactly defined behavior and don't read uninitialized
+ memory. Due to performance reasons, hashing reads data using a
+ LOAD64, which can go 7 bytes beyond the bytes written in the
+ ring-buffer. */
+ memset(ringbuffer_->buffer_ + ringbuffer_->pos_, 0, 7);
+ }
+}
+
+/* Marks all input as processed.
+ Returns true if position wrapping occurs. */
+static BROTLI_BOOL UpdateLastProcessedPos(BrotliEncoderState* s) {
+ uint32_t wrapped_last_processed_pos = WrapPosition(s->last_processed_pos_);
+ uint32_t wrapped_input_pos = WrapPosition(s->input_pos_);
+ s->last_processed_pos_ = s->input_pos_;
+ return TO_BROTLI_BOOL(wrapped_input_pos < wrapped_last_processed_pos);
+}
+
+static void ExtendLastCommand(BrotliEncoderState* s, uint32_t* bytes,
+ uint32_t* wrapped_last_processed_pos) {
+ Command* last_command = &s->commands_[s->num_commands_ - 1];
+ const uint8_t* data = s->ringbuffer_.buffer_;
+ const uint32_t mask = s->ringbuffer_.mask_;
+ uint64_t max_backward_distance =
+ (((uint64_t)1) << s->params.lgwin) - BROTLI_WINDOW_GAP;
+ uint64_t last_copy_len = last_command->copy_len_ & 0x1FFFFFF;
+ uint64_t last_processed_pos = s->last_processed_pos_ - last_copy_len;
+ uint64_t max_distance = last_processed_pos < max_backward_distance ?
+ last_processed_pos : max_backward_distance;
+ uint64_t cmd_dist = (uint64_t)s->dist_cache_[0];
+ uint32_t distance_code = CommandRestoreDistanceCode(last_command,
+ &s->params.dist);
+ if (distance_code < BROTLI_NUM_DISTANCE_SHORT_CODES ||
+ distance_code - (BROTLI_NUM_DISTANCE_SHORT_CODES - 1) == cmd_dist) {
+ if (cmd_dist <= max_distance) {
+ while (*bytes != 0 && data[*wrapped_last_processed_pos & mask] ==
+ data[(*wrapped_last_processed_pos - cmd_dist) & mask]) {
+ last_command->copy_len_++;
+ (*bytes)--;
+ (*wrapped_last_processed_pos)++;
+ }
+ } else {
+ }
+ /* The copy length is at most the metablock size, and thus expressible. */
+ GetLengthCode(last_command->insert_len_,
+ (size_t)((int)(last_command->copy_len_ & 0x1FFFFFF) +
+ (int)(last_command->copy_len_ >> 25)),
+ TO_BROTLI_BOOL((last_command->dist_prefix_ & 0x3FF) == 0),
+ &last_command->cmd_prefix_);
+ }
+}
+
+/*
+ Processes the accumulated input data and sets |*out_size| to the length of
+ the new output meta-block, or to zero if no new output meta-block has been
+ created (in this case the processed input data is buffered internally).
+ If |*out_size| is positive, |*output| points to the start of the output
+ data. If |is_last| or |force_flush| is BROTLI_TRUE, an output meta-block is
+ always created. However, until |is_last| is BROTLI_TRUE encoder may retain up
+ to 7 bits of the last byte of output. To force encoder to dump the remaining
+ bits use WriteMetadata() to append an empty meta-data block.
+ Returns BROTLI_FALSE if the size of the input data is larger than
+ input_block_size().
+ */
+static BROTLI_BOOL EncodeData(
+ BrotliEncoderState* s, const BROTLI_BOOL is_last,
+ const BROTLI_BOOL force_flush, size_t* out_size, uint8_t** output) {
+ const uint64_t delta = UnprocessedInputSize(s);
+ uint32_t bytes = (uint32_t)delta;
+ uint32_t wrapped_last_processed_pos = WrapPosition(s->last_processed_pos_);
+ uint8_t* data;
+ uint32_t mask;
+ MemoryManager* m = &s->memory_manager_;
+ ContextType literal_context_mode;
+ ContextLut literal_context_lut;
+
+ data = s->ringbuffer_.buffer_;
+ mask = s->ringbuffer_.mask_;
+
+ /* Adding more blocks after "last" block is forbidden. */
+ if (s->is_last_block_emitted_) return BROTLI_FALSE;
+ if (is_last) s->is_last_block_emitted_ = BROTLI_TRUE;
+
+ if (delta > InputBlockSize(s)) {
+ return BROTLI_FALSE;
+ }
+ if (s->params.quality == FAST_TWO_PASS_COMPRESSION_QUALITY &&
+ !s->command_buf_) {
+ s->command_buf_ =
+ BROTLI_ALLOC(m, uint32_t, kCompressFragmentTwoPassBlockSize);
+ s->literal_buf_ =
+ BROTLI_ALLOC(m, uint8_t, kCompressFragmentTwoPassBlockSize);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(s->command_buf_) ||
+ BROTLI_IS_NULL(s->literal_buf_)) {
+ return BROTLI_FALSE;
+ }
+ }
+
+ if (s->params.quality == FAST_ONE_PASS_COMPRESSION_QUALITY ||
+ s->params.quality == FAST_TWO_PASS_COMPRESSION_QUALITY) {
+ uint8_t* storage;
+ size_t storage_ix = s->last_bytes_bits_;
+ size_t table_size;
+ int* table;
+
+ if (delta == 0 && !is_last) {
+ /* We have no new input data and we don't have to finish the stream, so
+ nothing to do. */
+ *out_size = 0;
+ return BROTLI_TRUE;
+ }
+ storage = GetBrotliStorage(s, 2 * bytes + 503);
+ if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
+ storage[0] = (uint8_t)s->last_bytes_;
+ storage[1] = (uint8_t)(s->last_bytes_ >> 8);
+ table = GetHashTable(s, s->params.quality, bytes, &table_size);
+ if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
+ if (s->params.quality == FAST_ONE_PASS_COMPRESSION_QUALITY) {
+ BrotliCompressFragmentFast(
+ m, &data[wrapped_last_processed_pos & mask],
+ bytes, is_last,
+ table, table_size,
+ s->cmd_depths_, s->cmd_bits_,
+ &s->cmd_code_numbits_, s->cmd_code_,
+ &storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
+ } else {
+ BrotliCompressFragmentTwoPass(
+ m, &data[wrapped_last_processed_pos & mask],
+ bytes, is_last,
+ s->command_buf_, s->literal_buf_,
+ table, table_size,
+ &storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
+ }
+ s->last_bytes_ = (uint16_t)(storage[storage_ix >> 3]);
+ s->last_bytes_bits_ = storage_ix & 7u;
+ UpdateLastProcessedPos(s);
+ *output = &storage[0];
+ *out_size = storage_ix >> 3;
+ return BROTLI_TRUE;
+ }
+
+ {
+ /* Theoretical max number of commands is 1 per 2 bytes. */
+ size_t newsize = s->num_commands_ + bytes / 2 + 1;
+ if (newsize > s->cmd_alloc_size_) {
+ Command* new_commands;
+ /* Reserve a bit more memory to allow merging with a next block
+ without reallocation: that would impact speed. */
+ newsize += (bytes / 4) + 16;
+ s->cmd_alloc_size_ = newsize;
+ new_commands = BROTLI_ALLOC(m, Command, newsize);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(new_commands)) return BROTLI_FALSE;
+ if (s->commands_) {
+ memcpy(new_commands, s->commands_, sizeof(Command) * s->num_commands_);
+ BROTLI_FREE(m, s->commands_);
+ }
+ s->commands_ = new_commands;
+ }
+ }
+
+ InitOrStitchToPreviousBlock(m, &s->hasher_, data, mask, &s->params,
+ wrapped_last_processed_pos, bytes, is_last);
+
+ literal_context_mode = ChooseContextMode(
+ &s->params, data, WrapPosition(s->last_flush_pos_),
+ mask, (size_t)(s->input_pos_ - s->last_flush_pos_));
+ literal_context_lut = BROTLI_CONTEXT_LUT(literal_context_mode);
+
+ if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
+
+ if (s->num_commands_ && s->last_insert_len_ == 0) {
+ ExtendLastCommand(s, &bytes, &wrapped_last_processed_pos);
+ }
+
+ if (s->params.quality == ZOPFLIFICATION_QUALITY) {
+ BROTLI_DCHECK(s->params.hasher.type == 10);
+ BrotliCreateZopfliBackwardReferences(m, bytes, wrapped_last_processed_pos,
+ data, mask, literal_context_lut, &s->params,
+ &s->hasher_, s->dist_cache_,
+ &s->last_insert_len_, &s->commands_[s->num_commands_],
+ &s->num_commands_, &s->num_literals_);
+ if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
+ } else if (s->params.quality == HQ_ZOPFLIFICATION_QUALITY) {
+ BROTLI_DCHECK(s->params.hasher.type == 10);
+ BrotliCreateHqZopfliBackwardReferences(m, bytes, wrapped_last_processed_pos,
+ data, mask, literal_context_lut, &s->params,
+ &s->hasher_, s->dist_cache_,
+ &s->last_insert_len_, &s->commands_[s->num_commands_],
+ &s->num_commands_, &s->num_literals_);
+ if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
+ } else {
+ BrotliCreateBackwardReferences(bytes, wrapped_last_processed_pos,
+ data, mask, literal_context_lut, &s->params,
+ &s->hasher_, s->dist_cache_,
+ &s->last_insert_len_, &s->commands_[s->num_commands_],
+ &s->num_commands_, &s->num_literals_);
+ }
+
+ {
+ const size_t max_length = MaxMetablockSize(&s->params);
+ const size_t max_literals = max_length / 8;
+ const size_t max_commands = max_length / 8;
+ const size_t processed_bytes = (size_t)(s->input_pos_ - s->last_flush_pos_);
+ /* If maximal possible additional block doesn't fit metablock, flush now. */
+ /* TODO: Postpone decision until next block arrives? */
+ const BROTLI_BOOL next_input_fits_metablock = TO_BROTLI_BOOL(
+ processed_bytes + InputBlockSize(s) <= max_length);
+ /* If block splitting is not used, then flush as soon as there is some
+ amount of commands / literals produced. */
+ const BROTLI_BOOL should_flush = TO_BROTLI_BOOL(
+ s->params.quality < MIN_QUALITY_FOR_BLOCK_SPLIT &&
+ s->num_literals_ + s->num_commands_ >= MAX_NUM_DELAYED_SYMBOLS);
+ if (!is_last && !force_flush && !should_flush &&
+ next_input_fits_metablock &&
+ s->num_literals_ < max_literals &&
+ s->num_commands_ < max_commands) {
+ /* Merge with next input block. Everything will happen later. */
+ if (UpdateLastProcessedPos(s)) {
+ HasherReset(&s->hasher_);
+ }
+ *out_size = 0;
+ return BROTLI_TRUE;
+ }
+ }
+
+ /* Create the last insert-only command. */
+ if (s->last_insert_len_ > 0) {
+ InitInsertCommand(&s->commands_[s->num_commands_++], s->last_insert_len_);
+ s->num_literals_ += s->last_insert_len_;
+ s->last_insert_len_ = 0;
+ }
+
+ if (!is_last && s->input_pos_ == s->last_flush_pos_) {
+ /* We have no new input data and we don't have to finish the stream, so
+ nothing to do. */
+ *out_size = 0;
+ return BROTLI_TRUE;
+ }
+ BROTLI_DCHECK(s->input_pos_ >= s->last_flush_pos_);
+ BROTLI_DCHECK(s->input_pos_ > s->last_flush_pos_ || is_last);
+ BROTLI_DCHECK(s->input_pos_ - s->last_flush_pos_ <= 1u << 24);
+ {
+ const uint32_t metablock_size =
+ (uint32_t)(s->input_pos_ - s->last_flush_pos_);
+ uint8_t* storage = GetBrotliStorage(s, 2 * metablock_size + 503);
+ size_t storage_ix = s->last_bytes_bits_;
+ if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
+ storage[0] = (uint8_t)s->last_bytes_;
+ storage[1] = (uint8_t)(s->last_bytes_ >> 8);
+ WriteMetaBlockInternal(
+ m, data, mask, s->last_flush_pos_, metablock_size, is_last,
+ literal_context_mode, &s->params, s->prev_byte_, s->prev_byte2_,
+ s->num_literals_, s->num_commands_, s->commands_, s->saved_dist_cache_,
+ s->dist_cache_, &storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
+ s->last_bytes_ = (uint16_t)(storage[storage_ix >> 3]);
+ s->last_bytes_bits_ = storage_ix & 7u;
+ s->last_flush_pos_ = s->input_pos_;
+ if (UpdateLastProcessedPos(s)) {
+ HasherReset(&s->hasher_);
+ }
+ if (s->last_flush_pos_ > 0) {
+ s->prev_byte_ = data[((uint32_t)s->last_flush_pos_ - 1) & mask];
+ }
+ if (s->last_flush_pos_ > 1) {
+ s->prev_byte2_ = data[(uint32_t)(s->last_flush_pos_ - 2) & mask];
+ }
+ s->num_commands_ = 0;
+ s->num_literals_ = 0;
+ /* Save the state of the distance cache in case we need to restore it for
+ emitting an uncompressed block. */
+ memcpy(s->saved_dist_cache_, s->dist_cache_, sizeof(s->saved_dist_cache_));
+ *output = &storage[0];
+ *out_size = storage_ix >> 3;
+ return BROTLI_TRUE;
+ }
+}
+
+/* Dumps remaining output bits and metadata header to |header|.
+ Returns number of produced bytes.
+ REQUIRED: |header| should be 8-byte aligned and at least 16 bytes long.
+ REQUIRED: |block_size| <= (1 << 24). */
+static size_t WriteMetadataHeader(
+ BrotliEncoderState* s, const size_t block_size, uint8_t* header) {
+ size_t storage_ix;
+ storage_ix = s->last_bytes_bits_;
+ header[0] = (uint8_t)s->last_bytes_;
+ header[1] = (uint8_t)(s->last_bytes_ >> 8);
+ s->last_bytes_ = 0;
+ s->last_bytes_bits_ = 0;
+
+ BrotliWriteBits(1, 0, &storage_ix, header);
+ BrotliWriteBits(2, 3, &storage_ix, header);
+ BrotliWriteBits(1, 0, &storage_ix, header);
+ if (block_size == 0) {
+ BrotliWriteBits(2, 0, &storage_ix, header);
+ } else {
+ uint32_t nbits = (block_size == 1) ? 0 :
+ (Log2FloorNonZero((uint32_t)block_size - 1) + 1);
+ uint32_t nbytes = (nbits + 7) / 8;
+ BrotliWriteBits(2, nbytes, &storage_ix, header);
+ BrotliWriteBits(8 * nbytes, block_size - 1, &storage_ix, header);
+ }
+ return (storage_ix + 7u) >> 3;
+}
+
+static BROTLI_BOOL BrotliCompressBufferQuality10(
+ int lgwin, size_t input_size, const uint8_t* input_buffer,
+ size_t* encoded_size, uint8_t* encoded_buffer) {
+ MemoryManager memory_manager;
+ MemoryManager* m = &memory_manager;
+
+ const size_t mask = BROTLI_SIZE_MAX >> 1;
+ int dist_cache[4] = { 4, 11, 15, 16 };
+ int saved_dist_cache[4] = { 4, 11, 15, 16 };
+ BROTLI_BOOL ok = BROTLI_TRUE;
+ const size_t max_out_size = *encoded_size;
+ size_t total_out_size = 0;
+ uint16_t last_bytes;
+ uint8_t last_bytes_bits;
+
+ const size_t hasher_eff_size = BROTLI_MIN(size_t,
+ input_size, BROTLI_MAX_BACKWARD_LIMIT(lgwin) + BROTLI_WINDOW_GAP);
+
+ BrotliEncoderParams params;
+
+ const int lgmetablock = BROTLI_MIN(int, 24, lgwin + 1);
+ size_t max_block_size;
+ const size_t max_metablock_size = (size_t)1 << lgmetablock;
+ const size_t max_literals_per_metablock = max_metablock_size / 8;
+ const size_t max_commands_per_metablock = max_metablock_size / 8;
+ size_t metablock_start = 0;
+ uint8_t prev_byte = 0;
+ uint8_t prev_byte2 = 0;
+
+ Hasher hasher;
+ HasherInit(&hasher);
+
+ BrotliEncoderInitParams(&params);
+ params.quality = 10;
+ params.lgwin = lgwin;
+ if (lgwin > BROTLI_MAX_WINDOW_BITS) {
+ params.large_window = BROTLI_TRUE;
+ }
+ SanitizeParams(&params);
+ params.lgblock = ComputeLgBlock(&params);
+ ChooseDistanceParams(&params);
+ max_block_size = (size_t)1 << params.lgblock;
+
+ BrotliInitMemoryManager(m, 0, 0, 0);
+
+ BROTLI_DCHECK(input_size <= mask + 1);
+ EncodeWindowBits(lgwin, params.large_window, &last_bytes, &last_bytes_bits);
+ InitOrStitchToPreviousBlock(m, &hasher, input_buffer, mask, &params,
+ 0, hasher_eff_size, BROTLI_TRUE);
+ if (BROTLI_IS_OOM(m)) goto oom;
+
+ while (ok && metablock_start < input_size) {
+ const size_t metablock_end =
+ BROTLI_MIN(size_t, input_size, metablock_start + max_metablock_size);
+ const size_t expected_num_commands =
+ (metablock_end - metablock_start) / 12 + 16;
+ Command* commands = 0;
+ size_t num_commands = 0;
+ size_t last_insert_len = 0;
+ size_t num_literals = 0;
+ size_t metablock_size = 0;
+ size_t cmd_alloc_size = 0;
+ BROTLI_BOOL is_last;
+ uint8_t* storage;
+ size_t storage_ix;
+
+ ContextType literal_context_mode = ChooseContextMode(&params,
+ input_buffer, metablock_start, mask, metablock_end - metablock_start);
+ ContextLut literal_context_lut = BROTLI_CONTEXT_LUT(literal_context_mode);
+
+ size_t block_start;
+ for (block_start = metablock_start; block_start < metablock_end; ) {
+ size_t block_size =
+ BROTLI_MIN(size_t, metablock_end - block_start, max_block_size);
+ ZopfliNode* nodes = BROTLI_ALLOC(m, ZopfliNode, block_size + 1);
+ size_t path_size;
+ size_t new_cmd_alloc_size;
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(nodes)) goto oom;
+ BrotliInitZopfliNodes(nodes, block_size + 1);
+ StitchToPreviousBlockH10(&hasher.privat._H10, block_size, block_start,
+ input_buffer, mask);
+ path_size = BrotliZopfliComputeShortestPath(m, block_size, block_start,
+ input_buffer, mask, literal_context_lut, &params, dist_cache, &hasher,
+ nodes);
+ if (BROTLI_IS_OOM(m)) goto oom;
+ /* We allocate a command buffer in the first iteration of this loop that
+ will be likely big enough for the whole metablock, so that for most
+ inputs we will not have to reallocate in later iterations. We do the
+ allocation here and not before the loop, because if the input is small,
+ this will be allocated after the Zopfli cost model is freed, so this
+ will not increase peak memory usage.
+ TODO: If the first allocation is too small, increase command
+ buffer size exponentially. */
+ new_cmd_alloc_size = BROTLI_MAX(size_t, expected_num_commands,
+ num_commands + path_size + 1);
+ if (cmd_alloc_size != new_cmd_alloc_size) {
+ Command* new_commands = BROTLI_ALLOC(m, Command, new_cmd_alloc_size);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(new_commands)) goto oom;
+ cmd_alloc_size = new_cmd_alloc_size;
+ if (commands) {
+ memcpy(new_commands, commands, sizeof(Command) * num_commands);
+ BROTLI_FREE(m, commands);
+ }
+ commands = new_commands;
+ }
+ BrotliZopfliCreateCommands(block_size, block_start, &nodes[0], dist_cache,
+ &last_insert_len, &params, &commands[num_commands], &num_literals);
+ num_commands += path_size;
+ block_start += block_size;
+ metablock_size += block_size;
+ BROTLI_FREE(m, nodes);
+ if (num_literals > max_literals_per_metablock ||
+ num_commands > max_commands_per_metablock) {
+ break;
+ }
+ }
+
+ if (last_insert_len > 0) {
+ InitInsertCommand(&commands[num_commands++], last_insert_len);
+ num_literals += last_insert_len;
+ }
+
+ is_last = TO_BROTLI_BOOL(metablock_start + metablock_size == input_size);
+ storage = NULL;
+ storage_ix = last_bytes_bits;
+
+ if (metablock_size == 0) {
+ /* Write the ISLAST and ISEMPTY bits. */
+ storage = BROTLI_ALLOC(m, uint8_t, 16);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(storage)) goto oom;
+ storage[0] = (uint8_t)last_bytes;
+ storage[1] = (uint8_t)(last_bytes >> 8);
+ BrotliWriteBits(2, 3, &storage_ix, storage);
+ storage_ix = (storage_ix + 7u) & ~7u;
+ } else if (!ShouldCompress(input_buffer, mask, metablock_start,
+ metablock_size, num_literals, num_commands)) {
+ /* Restore the distance cache, as its last update by
+ CreateBackwardReferences is now unused. */
+ memcpy(dist_cache, saved_dist_cache, 4 * sizeof(dist_cache[0]));
+ storage = BROTLI_ALLOC(m, uint8_t, metablock_size + 16);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(storage)) goto oom;
+ storage[0] = (uint8_t)last_bytes;
+ storage[1] = (uint8_t)(last_bytes >> 8);
+ BrotliStoreUncompressedMetaBlock(is_last, input_buffer,
+ metablock_start, mask, metablock_size,
+ &storage_ix, storage);
+ } else {
+ MetaBlockSplit mb;
+ BrotliEncoderParams block_params = params;
+ InitMetaBlockSplit(&mb);
+ BrotliBuildMetaBlock(m, input_buffer, metablock_start, mask,
+ &block_params,
+ prev_byte, prev_byte2,
+ commands, num_commands,
+ literal_context_mode,
+ &mb);
+ if (BROTLI_IS_OOM(m)) goto oom;
+ {
+ /* The number of distance symbols effectively used for distance
+ histograms. It might be less than distance alphabet size
+ for "Large Window Brotli" (32-bit). */
+ BrotliOptimizeHistograms(block_params.dist.alphabet_size_limit, &mb);
+ }
+ storage = BROTLI_ALLOC(m, uint8_t, 2 * metablock_size + 503);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(storage)) goto oom;
+ storage[0] = (uint8_t)last_bytes;
+ storage[1] = (uint8_t)(last_bytes >> 8);
+ BrotliStoreMetaBlock(m, input_buffer, metablock_start, metablock_size,
+ mask, prev_byte, prev_byte2,
+ is_last,
+ &block_params,
+ literal_context_mode,
+ commands, num_commands,
+ &mb,
+ &storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) goto oom;
+ if (metablock_size + 4 < (storage_ix >> 3)) {
+ /* Restore the distance cache and last byte. */
+ memcpy(dist_cache, saved_dist_cache, 4 * sizeof(dist_cache[0]));
+ storage[0] = (uint8_t)last_bytes;
+ storage[1] = (uint8_t)(last_bytes >> 8);
+ storage_ix = last_bytes_bits;
+ BrotliStoreUncompressedMetaBlock(is_last, input_buffer,
+ metablock_start, mask,
+ metablock_size, &storage_ix, storage);
+ }
+ DestroyMetaBlockSplit(m, &mb);
+ }
+ last_bytes = (uint16_t)(storage[storage_ix >> 3]);
+ last_bytes_bits = storage_ix & 7u;
+ metablock_start += metablock_size;
+ if (metablock_start < input_size) {
+ prev_byte = input_buffer[metablock_start - 1];
+ prev_byte2 = input_buffer[metablock_start - 2];
+ }
+ /* Save the state of the distance cache in case we need to restore it for
+ emitting an uncompressed block. */
+ memcpy(saved_dist_cache, dist_cache, 4 * sizeof(dist_cache[0]));
+
+ {
+ const size_t out_size = storage_ix >> 3;
+ total_out_size += out_size;
+ if (total_out_size <= max_out_size) {
+ memcpy(encoded_buffer, storage, out_size);
+ encoded_buffer += out_size;
+ } else {
+ ok = BROTLI_FALSE;
+ }
+ }
+ BROTLI_FREE(m, storage);
+ BROTLI_FREE(m, commands);
+ }
+
+ *encoded_size = total_out_size;
+ DestroyHasher(m, &hasher);
+ return ok;
+
+oom:
+ BrotliWipeOutMemoryManager(m);
+ return BROTLI_FALSE;
+}
+
+size_t BrotliEncoderMaxCompressedSize(size_t input_size) {
+ /* [window bits / empty metadata] + N * [uncompressed] + [last empty] */
+ size_t num_large_blocks = input_size >> 14;
+ size_t overhead = 2 + (4 * num_large_blocks) + 3 + 1;
+ size_t result = input_size + overhead;
+ if (input_size == 0) return 2;
+ return (result < input_size) ? 0 : result;
+}
+
+/* Wraps data to uncompressed brotli stream with minimal window size.
+ |output| should point at region with at least BrotliEncoderMaxCompressedSize
+ addressable bytes.
+ Returns the length of stream. */
+static size_t MakeUncompressedStream(
+ const uint8_t* input, size_t input_size, uint8_t* output) {
+ size_t size = input_size;
+ size_t result = 0;
+ size_t offset = 0;
+ if (input_size == 0) {
+ output[0] = 6;
+ return 1;
+ }
+ output[result++] = 0x21; /* window bits = 10, is_last = false */
+ output[result++] = 0x03; /* empty metadata, padding */
+ while (size > 0) {
+ uint32_t nibbles = 0;
+ uint32_t chunk_size;
+ uint32_t bits;
+ chunk_size = (size > (1u << 24)) ? (1u << 24) : (uint32_t)size;
+ if (chunk_size > (1u << 16)) nibbles = (chunk_size > (1u << 20)) ? 2 : 1;
+ bits =
+ (nibbles << 1) | ((chunk_size - 1) << 3) | (1u << (19 + 4 * nibbles));
+ output[result++] = (uint8_t)bits;
+ output[result++] = (uint8_t)(bits >> 8);
+ output[result++] = (uint8_t)(bits >> 16);
+ if (nibbles == 2) output[result++] = (uint8_t)(bits >> 24);
+ memcpy(&output[result], &input[offset], chunk_size);
+ result += chunk_size;
+ offset += chunk_size;
+ size -= chunk_size;
+ }
+ output[result++] = 3;
+ return result;
+}
+
+BROTLI_BOOL BrotliEncoderCompress(
+ int quality, int lgwin, BrotliEncoderMode mode, size_t input_size,
+ const uint8_t* input_buffer, size_t* encoded_size,
+ uint8_t* encoded_buffer) {
+ BrotliEncoderState* s;
+ size_t out_size = *encoded_size;
+ const uint8_t* input_start = input_buffer;
+ uint8_t* output_start = encoded_buffer;
+ size_t max_out_size = BrotliEncoderMaxCompressedSize(input_size);
+ if (out_size == 0) {
+ /* Output buffer needs at least one byte. */
+ return BROTLI_FALSE;
+ }
+ if (input_size == 0) {
+ /* Handle the special case of empty input. */
+ *encoded_size = 1;
+ *encoded_buffer = 6;
+ return BROTLI_TRUE;
+ }
+ if (quality == 10) {
+ /* TODO: Implement this direct path for all quality levels. */
+ const int lg_win = BROTLI_MIN(int, BROTLI_LARGE_MAX_WINDOW_BITS,
+ BROTLI_MAX(int, 16, lgwin));
+ int ok = BrotliCompressBufferQuality10(lg_win, input_size, input_buffer,
+ encoded_size, encoded_buffer);
+ if (!ok || (max_out_size && *encoded_size > max_out_size)) {
+ goto fallback;
+ }
+ return BROTLI_TRUE;
+ }
+
+ s = BrotliEncoderCreateInstance(0, 0, 0);
+ if (!s) {
+ return BROTLI_FALSE;
+ } else {
+ size_t available_in = input_size;
+ const uint8_t* next_in = input_buffer;
+ size_t available_out = *encoded_size;
+ uint8_t* next_out = encoded_buffer;
+ size_t total_out = 0;
+ BROTLI_BOOL result = BROTLI_FALSE;
+ BrotliEncoderSetParameter(s, BROTLI_PARAM_QUALITY, (uint32_t)quality);
+ BrotliEncoderSetParameter(s, BROTLI_PARAM_LGWIN, (uint32_t)lgwin);
+ BrotliEncoderSetParameter(s, BROTLI_PARAM_MODE, (uint32_t)mode);
+ BrotliEncoderSetParameter(s, BROTLI_PARAM_SIZE_HINT, (uint32_t)input_size);
+ if (lgwin > BROTLI_MAX_WINDOW_BITS) {
+ BrotliEncoderSetParameter(s, BROTLI_PARAM_LARGE_WINDOW, BROTLI_TRUE);
+ }
+ result = BrotliEncoderCompressStream(s, BROTLI_OPERATION_FINISH,
+ &available_in, &next_in, &available_out, &next_out, &total_out);
+ if (!BrotliEncoderIsFinished(s)) result = 0;
+ *encoded_size = total_out;
+ BrotliEncoderDestroyInstance(s);
+ if (!result || (max_out_size && *encoded_size > max_out_size)) {
+ goto fallback;
+ }
+ return BROTLI_TRUE;
+ }
+fallback:
+ *encoded_size = 0;
+ if (!max_out_size) return BROTLI_FALSE;
+ if (out_size >= max_out_size) {
+ *encoded_size =
+ MakeUncompressedStream(input_start, input_size, output_start);
+ return BROTLI_TRUE;
+ }
+ return BROTLI_FALSE;
+}
+
+static void InjectBytePaddingBlock(BrotliEncoderState* s) {
+ uint32_t seal = s->last_bytes_;
+ size_t seal_bits = s->last_bytes_bits_;
+ uint8_t* destination;
+ s->last_bytes_ = 0;
+ s->last_bytes_bits_ = 0;
+ /* is_last = 0, data_nibbles = 11, reserved = 0, meta_nibbles = 00 */
+ seal |= 0x6u << seal_bits;
+ seal_bits += 6;
+ /* If we have already created storage, then append to it.
+ Storage is valid until next block is being compressed. */
+ if (s->next_out_) {
+ destination = s->next_out_ + s->available_out_;
+ } else {
+ destination = s->tiny_buf_.u8;
+ s->next_out_ = destination;
+ }
+ destination[0] = (uint8_t)seal;
+ if (seal_bits > 8) destination[1] = (uint8_t)(seal >> 8);
+ if (seal_bits > 16) destination[2] = (uint8_t)(seal >> 16);
+ s->available_out_ += (seal_bits + 7) >> 3;
+}
+
+/* Injects padding bits or pushes compressed data to output.
+ Returns false if nothing is done. */
+static BROTLI_BOOL InjectFlushOrPushOutput(BrotliEncoderState* s,
+ size_t* available_out, uint8_t** next_out, size_t* total_out) {
+ if (s->stream_state_ == BROTLI_STREAM_FLUSH_REQUESTED &&
+ s->last_bytes_bits_ != 0) {
+ InjectBytePaddingBlock(s);
+ return BROTLI_TRUE;
+ }
+
+ if (s->available_out_ != 0 && *available_out != 0) {
+ size_t copy_output_size =
+ BROTLI_MIN(size_t, s->available_out_, *available_out);
+ memcpy(*next_out, s->next_out_, copy_output_size);
+ *next_out += copy_output_size;
+ *available_out -= copy_output_size;
+ s->next_out_ += copy_output_size;
+ s->available_out_ -= copy_output_size;
+ s->total_out_ += copy_output_size;
+ if (total_out) *total_out = s->total_out_;
+ return BROTLI_TRUE;
+ }
+
+ return BROTLI_FALSE;
+}
+
+static void CheckFlushComplete(BrotliEncoderState* s) {
+ if (s->stream_state_ == BROTLI_STREAM_FLUSH_REQUESTED &&
+ s->available_out_ == 0) {
+ s->stream_state_ = BROTLI_STREAM_PROCESSING;
+ s->next_out_ = 0;
+ }
+}
+
+static BROTLI_BOOL BrotliEncoderCompressStreamFast(
+ BrotliEncoderState* s, BrotliEncoderOperation op, size_t* available_in,
+ const uint8_t** next_in, size_t* available_out, uint8_t** next_out,
+ size_t* total_out) {
+ const size_t block_size_limit = (size_t)1 << s->params.lgwin;
+ const size_t buf_size = BROTLI_MIN(size_t, kCompressFragmentTwoPassBlockSize,
+ BROTLI_MIN(size_t, *available_in, block_size_limit));
+ uint32_t* tmp_command_buf = NULL;
+ uint32_t* command_buf = NULL;
+ uint8_t* tmp_literal_buf = NULL;
+ uint8_t* literal_buf = NULL;
+ MemoryManager* m = &s->memory_manager_;
+ if (s->params.quality != FAST_ONE_PASS_COMPRESSION_QUALITY &&
+ s->params.quality != FAST_TWO_PASS_COMPRESSION_QUALITY) {
+ return BROTLI_FALSE;
+ }
+ if (s->params.quality == FAST_TWO_PASS_COMPRESSION_QUALITY) {
+ if (!s->command_buf_ && buf_size == kCompressFragmentTwoPassBlockSize) {
+ s->command_buf_ =
+ BROTLI_ALLOC(m, uint32_t, kCompressFragmentTwoPassBlockSize);
+ s->literal_buf_ =
+ BROTLI_ALLOC(m, uint8_t, kCompressFragmentTwoPassBlockSize);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(s->command_buf_) ||
+ BROTLI_IS_NULL(s->literal_buf_)) {
+ return BROTLI_FALSE;
+ }
+ }
+ if (s->command_buf_) {
+ command_buf = s->command_buf_;
+ literal_buf = s->literal_buf_;
+ } else {
+ tmp_command_buf = BROTLI_ALLOC(m, uint32_t, buf_size);
+ tmp_literal_buf = BROTLI_ALLOC(m, uint8_t, buf_size);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(tmp_command_buf) ||
+ BROTLI_IS_NULL(tmp_literal_buf)) {
+ return BROTLI_FALSE;
+ }
+ command_buf = tmp_command_buf;
+ literal_buf = tmp_literal_buf;
+ }
+ }
+
+ while (BROTLI_TRUE) {
+ if (InjectFlushOrPushOutput(s, available_out, next_out, total_out)) {
+ continue;
+ }
+
+ /* Compress block only when internal output buffer is empty, stream is not
+ finished, there is no pending flush request, and there is either
+ additional input or pending operation. */
+ if (s->available_out_ == 0 &&
+ s->stream_state_ == BROTLI_STREAM_PROCESSING &&
+ (*available_in != 0 || op != BROTLI_OPERATION_PROCESS)) {
+ size_t block_size = BROTLI_MIN(size_t, block_size_limit, *available_in);
+ BROTLI_BOOL is_last =
+ (*available_in == block_size) && (op == BROTLI_OPERATION_FINISH);
+ BROTLI_BOOL force_flush =
+ (*available_in == block_size) && (op == BROTLI_OPERATION_FLUSH);
+ size_t max_out_size = 2 * block_size + 503;
+ BROTLI_BOOL inplace = BROTLI_TRUE;
+ uint8_t* storage = NULL;
+ size_t storage_ix = s->last_bytes_bits_;
+ size_t table_size;
+ int* table;
+
+ if (force_flush && block_size == 0) {
+ s->stream_state_ = BROTLI_STREAM_FLUSH_REQUESTED;
+ continue;
+ }
+ if (max_out_size <= *available_out) {
+ storage = *next_out;
+ } else {
+ inplace = BROTLI_FALSE;
+ storage = GetBrotliStorage(s, max_out_size);
+ if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
+ }
+ storage[0] = (uint8_t)s->last_bytes_;
+ storage[1] = (uint8_t)(s->last_bytes_ >> 8);
+ table = GetHashTable(s, s->params.quality, block_size, &table_size);
+ if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
+
+ if (s->params.quality == FAST_ONE_PASS_COMPRESSION_QUALITY) {
+ BrotliCompressFragmentFast(m, *next_in, block_size, is_last, table,
+ table_size, s->cmd_depths_, s->cmd_bits_, &s->cmd_code_numbits_,
+ s->cmd_code_, &storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
+ } else {
+ BrotliCompressFragmentTwoPass(m, *next_in, block_size, is_last,
+ command_buf, literal_buf, table, table_size,
+ &storage_ix, storage);
+ if (BROTLI_IS_OOM(m)) return BROTLI_FALSE;
+ }
+ *next_in += block_size;
+ *available_in -= block_size;
+ if (inplace) {
+ size_t out_bytes = storage_ix >> 3;
+ BROTLI_DCHECK(out_bytes <= *available_out);
+ BROTLI_DCHECK((storage_ix & 7) == 0 || out_bytes < *available_out);
+ *next_out += out_bytes;
+ *available_out -= out_bytes;
+ s->total_out_ += out_bytes;
+ if (total_out) *total_out = s->total_out_;
+ } else {
+ size_t out_bytes = storage_ix >> 3;
+ s->next_out_ = storage;
+ s->available_out_ = out_bytes;
+ }
+ s->last_bytes_ = (uint16_t)(storage[storage_ix >> 3]);
+ s->last_bytes_bits_ = storage_ix & 7u;
+
+ if (force_flush) s->stream_state_ = BROTLI_STREAM_FLUSH_REQUESTED;
+ if (is_last) s->stream_state_ = BROTLI_STREAM_FINISHED;
+ continue;
+ }
+ break;
+ }
+ BROTLI_FREE(m, tmp_command_buf);
+ BROTLI_FREE(m, tmp_literal_buf);
+ CheckFlushComplete(s);
+ return BROTLI_TRUE;
+}
+
+static BROTLI_BOOL ProcessMetadata(
+ BrotliEncoderState* s, size_t* available_in, const uint8_t** next_in,
+ size_t* available_out, uint8_t** next_out, size_t* total_out) {
+ if (*available_in > (1u << 24)) return BROTLI_FALSE;
+ /* Switch to metadata block workflow, if required. */
+ if (s->stream_state_ == BROTLI_STREAM_PROCESSING) {
+ s->remaining_metadata_bytes_ = (uint32_t)*available_in;
+ s->stream_state_ = BROTLI_STREAM_METADATA_HEAD;
+ }
+ if (s->stream_state_ != BROTLI_STREAM_METADATA_HEAD &&
+ s->stream_state_ != BROTLI_STREAM_METADATA_BODY) {
+ return BROTLI_FALSE;
+ }
+
+ while (BROTLI_TRUE) {
+ if (InjectFlushOrPushOutput(s, available_out, next_out, total_out)) {
+ continue;
+ }
+ if (s->available_out_ != 0) break;
+
+ if (s->input_pos_ != s->last_flush_pos_) {
+ BROTLI_BOOL result = EncodeData(s, BROTLI_FALSE, BROTLI_TRUE,
+ &s->available_out_, &s->next_out_);
+ if (!result) return BROTLI_FALSE;
+ continue;
+ }
+
+ if (s->stream_state_ == BROTLI_STREAM_METADATA_HEAD) {
+ s->next_out_ = s->tiny_buf_.u8;
+ s->available_out_ =
+ WriteMetadataHeader(s, s->remaining_metadata_bytes_, s->next_out_);
+ s->stream_state_ = BROTLI_STREAM_METADATA_BODY;
+ continue;
+ } else {
+ /* Exit workflow only when there is no more input and no more output.
+ Otherwise client may continue producing empty metadata blocks. */
+ if (s->remaining_metadata_bytes_ == 0) {
+ s->remaining_metadata_bytes_ = BROTLI_UINT32_MAX;
+ s->stream_state_ = BROTLI_STREAM_PROCESSING;
+ break;
+ }
+ if (*available_out) {
+ /* Directly copy input to output. */
+ uint32_t copy = (uint32_t)BROTLI_MIN(
+ size_t, s->remaining_metadata_bytes_, *available_out);
+ memcpy(*next_out, *next_in, copy);
+ *next_in += copy;
+ *available_in -= copy;
+ s->remaining_metadata_bytes_ -= copy;
+ *next_out += copy;
+ *available_out -= copy;
+ } else {
+ /* This guarantees progress in "TakeOutput" workflow. */
+ uint32_t copy = BROTLI_MIN(uint32_t, s->remaining_metadata_bytes_, 16);
+ s->next_out_ = s->tiny_buf_.u8;
+ memcpy(s->next_out_, *next_in, copy);
+ *next_in += copy;
+ *available_in -= copy;
+ s->remaining_metadata_bytes_ -= copy;
+ s->available_out_ = copy;
+ }
+ continue;
+ }
+ }
+
+ return BROTLI_TRUE;
+}
+
+static void UpdateSizeHint(BrotliEncoderState* s, size_t available_in) {
+ if (s->params.size_hint == 0) {
+ uint64_t delta = UnprocessedInputSize(s);
+ uint64_t tail = available_in;
+ uint32_t limit = 1u << 30;
+ uint32_t total;
+ if ((delta >= limit) || (tail >= limit) || ((delta + tail) >= limit)) {
+ total = limit;
+ } else {
+ total = (uint32_t)(delta + tail);
+ }
+ s->params.size_hint = total;
+ }
+}
+
+BROTLI_BOOL BrotliEncoderCompressStream(
+ BrotliEncoderState* s, BrotliEncoderOperation op, size_t* available_in,
+ const uint8_t** next_in, size_t* available_out,uint8_t** next_out,
+ size_t* total_out) {
+ if (!EnsureInitialized(s)) return BROTLI_FALSE;
+
+ /* Unfinished metadata block; check requirements. */
+ if (s->remaining_metadata_bytes_ != BROTLI_UINT32_MAX) {
+ if (*available_in != s->remaining_metadata_bytes_) return BROTLI_FALSE;
+ if (op != BROTLI_OPERATION_EMIT_METADATA) return BROTLI_FALSE;
+ }
+
+ if (op == BROTLI_OPERATION_EMIT_METADATA) {
+ UpdateSizeHint(s, 0); /* First data metablock might be emitted here. */
+ return ProcessMetadata(
+ s, available_in, next_in, available_out, next_out, total_out);
+ }
+
+ if (s->stream_state_ == BROTLI_STREAM_METADATA_HEAD ||
+ s->stream_state_ == BROTLI_STREAM_METADATA_BODY) {
+ return BROTLI_FALSE;
+ }
+
+ if (s->stream_state_ != BROTLI_STREAM_PROCESSING && *available_in != 0) {
+ return BROTLI_FALSE;
+ }
+ if (s->params.quality == FAST_ONE_PASS_COMPRESSION_QUALITY ||
+ s->params.quality == FAST_TWO_PASS_COMPRESSION_QUALITY) {
+ return BrotliEncoderCompressStreamFast(s, op, available_in, next_in,
+ available_out, next_out, total_out);
+ }
+ while (BROTLI_TRUE) {
+ size_t remaining_block_size = RemainingInputBlockSize(s);
+ /* Shorten input to flint size. */
+ if (s->flint_ >= 0 && remaining_block_size > (size_t)s->flint_) {
+ remaining_block_size = (size_t)s->flint_;
+ }
+
+ if (remaining_block_size != 0 && *available_in != 0) {
+ size_t copy_input_size =
+ BROTLI_MIN(size_t, remaining_block_size, *available_in);
+ CopyInputToRingBuffer(s, copy_input_size, *next_in);
+ *next_in += copy_input_size;
+ *available_in -= copy_input_size;
+ if (s->flint_ > 0) s->flint_ = (int8_t)(s->flint_ - (int)copy_input_size);
+ continue;
+ }
+
+ if (InjectFlushOrPushOutput(s, available_out, next_out, total_out)) {
+ /* Exit the "emit flint" workflow. */
+ if (s->flint_ == BROTLI_FLINT_WAITING_FOR_FLUSHING) {
+ CheckFlushComplete(s);
+ if (s->stream_state_ == BROTLI_STREAM_PROCESSING) {
+ s->flint_ = BROTLI_FLINT_DONE;
+ }
+ }
+ continue;
+ }
+
+ /* Compress data only when internal output buffer is empty, stream is not
+ finished and there is no pending flush request. */
+ if (s->available_out_ == 0 &&
+ s->stream_state_ == BROTLI_STREAM_PROCESSING) {
+ if (remaining_block_size == 0 || op != BROTLI_OPERATION_PROCESS) {
+ BROTLI_BOOL is_last = TO_BROTLI_BOOL(
+ (*available_in == 0) && op == BROTLI_OPERATION_FINISH);
+ BROTLI_BOOL force_flush = TO_BROTLI_BOOL(
+ (*available_in == 0) && op == BROTLI_OPERATION_FLUSH);
+ BROTLI_BOOL result;
+ /* Force emitting (uncompressed) piece containing flint. */
+ if (!is_last && s->flint_ == 0) {
+ s->flint_ = BROTLI_FLINT_WAITING_FOR_FLUSHING;
+ force_flush = BROTLI_TRUE;
+ }
+ UpdateSizeHint(s, *available_in);
+ result = EncodeData(s, is_last, force_flush,
+ &s->available_out_, &s->next_out_);
+ if (!result) return BROTLI_FALSE;
+ if (force_flush) s->stream_state_ = BROTLI_STREAM_FLUSH_REQUESTED;
+ if (is_last) s->stream_state_ = BROTLI_STREAM_FINISHED;
+ continue;
+ }
+ }
+ break;
+ }
+ CheckFlushComplete(s);
+ return BROTLI_TRUE;
+}
+
+BROTLI_BOOL BrotliEncoderIsFinished(BrotliEncoderState* s) {
+ return TO_BROTLI_BOOL(s->stream_state_ == BROTLI_STREAM_FINISHED &&
+ !BrotliEncoderHasMoreOutput(s));
+}
+
+BROTLI_BOOL BrotliEncoderHasMoreOutput(BrotliEncoderState* s) {
+ return TO_BROTLI_BOOL(s->available_out_ != 0);
+}
+
+const uint8_t* BrotliEncoderTakeOutput(BrotliEncoderState* s, size_t* size) {
+ size_t consumed_size = s->available_out_;
+ uint8_t* result = s->next_out_;
+ if (*size) {
+ consumed_size = BROTLI_MIN(size_t, *size, s->available_out_);
+ }
+ if (consumed_size) {
+ s->next_out_ += consumed_size;
+ s->available_out_ -= consumed_size;
+ s->total_out_ += consumed_size;
+ CheckFlushComplete(s);
+ *size = consumed_size;
+ } else {
+ *size = 0;
+ result = 0;
+ }
+ return result;
+}
+
+uint32_t BrotliEncoderVersion(void) {
+ return BROTLI_VERSION;
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encoder_dict.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encoder_dict.c
new file mode 100755
index 000000000..c9e963b89
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encoder_dict.c
@@ -0,0 +1,33 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+#include "./encoder_dict.h"
+
+#include "../common/dictionary.h"
+#include "../common/transform.h"
+#include "./dictionary_hash.h"
+#include "./hash.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+void BrotliInitEncoderDictionary(BrotliEncoderDictionary* dict) {
+ dict->words = BrotliGetDictionary();
+ dict->num_transforms = (uint32_t)BrotliGetTransforms()->num_transforms;
+
+ dict->hash_table_words = kStaticDictionaryHashWords;
+ dict->hash_table_lengths = kStaticDictionaryHashLengths;
+ dict->buckets = kStaticDictionaryBuckets;
+ dict->dict_words = kStaticDictionaryWords;
+
+ dict->cutoffTransformsCount = kCutoffTransformsCount;
+ dict->cutoffTransforms = kCutoffTransforms;
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encoder_dict.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encoder_dict.h
new file mode 100755
index 000000000..a1c329fbf
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encoder_dict.h
@@ -0,0 +1,43 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+#ifndef BROTLI_ENC_ENCODER_DICT_H_
+#define BROTLI_ENC_ENCODER_DICT_H_
+
+#include "../common/dictionary.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./static_dict_lut.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* Dictionary data (words and transforms) for 1 possible context */
+typedef struct BrotliEncoderDictionary {
+ const BrotliDictionary* words;
+ uint32_t num_transforms;
+
+ /* cut off for fast encoder */
+ uint32_t cutoffTransformsCount;
+ uint64_t cutoffTransforms;
+
+ /* from dictionary_hash.h, for fast encoder */
+ const uint16_t* hash_table_words;
+ const uint8_t* hash_table_lengths;
+
+ /* from static_dict_lut.h, for slow encoder */
+ const uint16_t* buckets;
+ const DictWord* dict_words;
+} BrotliEncoderDictionary;
+
+BROTLI_INTERNAL void BrotliInitEncoderDictionary(BrotliEncoderDictionary* dict);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_ENCODER_DICT_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/entropy_encode.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/entropy_encode.c
new file mode 100644
index 000000000..97f9dfb82
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/entropy_encode.c
@@ -0,0 +1,501 @@
+/* Copyright 2010 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Entropy encoding (Huffman) utilities. */
+
+#include "./entropy_encode.h"
+
+#include <string.h> /* memset */
+
+#include "../common/constants.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+BROTLI_BOOL BrotliSetDepth(
+ int p0, HuffmanTree* pool, uint8_t* depth, int max_depth) {
+ int stack[16];
+ int level = 0;
+ int p = p0;
+ BROTLI_DCHECK(max_depth <= 15);
+ stack[0] = -1;
+ while (BROTLI_TRUE) {
+ if (pool[p].index_left_ >= 0) {
+ level++;
+ if (level > max_depth) return BROTLI_FALSE;
+ stack[level] = pool[p].index_right_or_value_;
+ p = pool[p].index_left_;
+ continue;
+ } else {
+ depth[pool[p].index_right_or_value_] = (uint8_t)level;
+ }
+ while (level >= 0 && stack[level] == -1) level--;
+ if (level < 0) return BROTLI_TRUE;
+ p = stack[level];
+ stack[level] = -1;
+ }
+}
+
+/* Sort the root nodes, least popular first. */
+static BROTLI_INLINE BROTLI_BOOL SortHuffmanTree(
+ const HuffmanTree* v0, const HuffmanTree* v1) {
+ if (v0->total_count_ != v1->total_count_) {
+ return TO_BROTLI_BOOL(v0->total_count_ < v1->total_count_);
+ }
+ return TO_BROTLI_BOOL(v0->index_right_or_value_ > v1->index_right_or_value_);
+}
+
+/* This function will create a Huffman tree.
+
+ The catch here is that the tree cannot be arbitrarily deep.
+ Brotli specifies a maximum depth of 15 bits for "code trees"
+ and 7 bits for "code length code trees."
+
+ count_limit is the value that is to be faked as the minimum value
+ and this minimum value is raised until the tree matches the
+ maximum length requirement.
+
+ This algorithm is not of excellent performance for very long data blocks,
+ especially when population counts are longer than 2**tree_limit, but
+ we are not planning to use this with extremely long blocks.
+
+ See http://en.wikipedia.org/wiki/Huffman_coding */
+void BrotliCreateHuffmanTree(const uint32_t* data,
+ const size_t length,
+ const int tree_limit,
+ HuffmanTree* tree,
+ uint8_t* depth) {
+ uint32_t count_limit;
+ HuffmanTree sentinel;
+ InitHuffmanTree(&sentinel, BROTLI_UINT32_MAX, -1, -1);
+ /* For block sizes below 64 kB, we never need to do a second iteration
+ of this loop. Probably all of our block sizes will be smaller than
+ that, so this loop is mostly of academic interest. If we actually
+ would need this, we would be better off with the Katajainen algorithm. */
+ for (count_limit = 1; ; count_limit *= 2) {
+ size_t n = 0;
+ size_t i;
+ size_t j;
+ size_t k;
+ for (i = length; i != 0;) {
+ --i;
+ if (data[i]) {
+ const uint32_t count = BROTLI_MAX(uint32_t, data[i], count_limit);
+ InitHuffmanTree(&tree[n++], count, -1, (int16_t)i);
+ }
+ }
+
+ if (n == 1) {
+ depth[tree[0].index_right_or_value_] = 1; /* Only one element. */
+ break;
+ }
+
+ SortHuffmanTreeItems(tree, n, SortHuffmanTree);
+
+ /* The nodes are:
+ [0, n): the sorted leaf nodes that we start with.
+ [n]: we add a sentinel here.
+ [n + 1, 2n): new parent nodes are added here, starting from
+ (n+1). These are naturally in ascending order.
+ [2n]: we add a sentinel at the end as well.
+ There will be (2n+1) elements at the end. */
+ tree[n] = sentinel;
+ tree[n + 1] = sentinel;
+
+ i = 0; /* Points to the next leaf node. */
+ j = n + 1; /* Points to the next non-leaf node. */
+ for (k = n - 1; k != 0; --k) {
+ size_t left, right;
+ if (tree[i].total_count_ <= tree[j].total_count_) {
+ left = i;
+ ++i;
+ } else {
+ left = j;
+ ++j;
+ }
+ if (tree[i].total_count_ <= tree[j].total_count_) {
+ right = i;
+ ++i;
+ } else {
+ right = j;
+ ++j;
+ }
+
+ {
+ /* The sentinel node becomes the parent node. */
+ size_t j_end = 2 * n - k;
+ tree[j_end].total_count_ =
+ tree[left].total_count_ + tree[right].total_count_;
+ tree[j_end].index_left_ = (int16_t)left;
+ tree[j_end].index_right_or_value_ = (int16_t)right;
+
+ /* Add back the last sentinel node. */
+ tree[j_end + 1] = sentinel;
+ }
+ }
+ if (BrotliSetDepth((int)(2 * n - 1), &tree[0], depth, tree_limit)) {
+ /* We need to pack the Huffman tree in tree_limit bits. If this was not
+ successful, add fake entities to the lowest values and retry. */
+ break;
+ }
+ }
+}
+
+static void Reverse(uint8_t* v, size_t start, size_t end) {
+ --end;
+ while (start < end) {
+ uint8_t tmp = v[start];
+ v[start] = v[end];
+ v[end] = tmp;
+ ++start;
+ --end;
+ }
+}
+
+static void BrotliWriteHuffmanTreeRepetitions(
+ const uint8_t previous_value,
+ const uint8_t value,
+ size_t repetitions,
+ size_t* tree_size,
+ uint8_t* tree,
+ uint8_t* extra_bits_data) {
+ BROTLI_DCHECK(repetitions > 0);
+ if (previous_value != value) {
+ tree[*tree_size] = value;
+ extra_bits_data[*tree_size] = 0;
+ ++(*tree_size);
+ --repetitions;
+ }
+ if (repetitions == 7) {
+ tree[*tree_size] = value;
+ extra_bits_data[*tree_size] = 0;
+ ++(*tree_size);
+ --repetitions;
+ }
+ if (repetitions < 3) {
+ size_t i;
+ for (i = 0; i < repetitions; ++i) {
+ tree[*tree_size] = value;
+ extra_bits_data[*tree_size] = 0;
+ ++(*tree_size);
+ }
+ } else {
+ size_t start = *tree_size;
+ repetitions -= 3;
+ while (BROTLI_TRUE) {
+ tree[*tree_size] = BROTLI_REPEAT_PREVIOUS_CODE_LENGTH;
+ extra_bits_data[*tree_size] = repetitions & 0x3;
+ ++(*tree_size);
+ repetitions >>= 2;
+ if (repetitions == 0) {
+ break;
+ }
+ --repetitions;
+ }
+ Reverse(tree, start, *tree_size);
+ Reverse(extra_bits_data, start, *tree_size);
+ }
+}
+
+static void BrotliWriteHuffmanTreeRepetitionsZeros(
+ size_t repetitions,
+ size_t* tree_size,
+ uint8_t* tree,
+ uint8_t* extra_bits_data) {
+ if (repetitions == 11) {
+ tree[*tree_size] = 0;
+ extra_bits_data[*tree_size] = 0;
+ ++(*tree_size);
+ --repetitions;
+ }
+ if (repetitions < 3) {
+ size_t i;
+ for (i = 0; i < repetitions; ++i) {
+ tree[*tree_size] = 0;
+ extra_bits_data[*tree_size] = 0;
+ ++(*tree_size);
+ }
+ } else {
+ size_t start = *tree_size;
+ repetitions -= 3;
+ while (BROTLI_TRUE) {
+ tree[*tree_size] = BROTLI_REPEAT_ZERO_CODE_LENGTH;
+ extra_bits_data[*tree_size] = repetitions & 0x7;
+ ++(*tree_size);
+ repetitions >>= 3;
+ if (repetitions == 0) {
+ break;
+ }
+ --repetitions;
+ }
+ Reverse(tree, start, *tree_size);
+ Reverse(extra_bits_data, start, *tree_size);
+ }
+}
+
+void BrotliOptimizeHuffmanCountsForRle(size_t length, uint32_t* counts,
+ uint8_t* good_for_rle) {
+ size_t nonzero_count = 0;
+ size_t stride;
+ size_t limit;
+ size_t sum;
+ const size_t streak_limit = 1240;
+ /* Let's make the Huffman code more compatible with RLE encoding. */
+ size_t i;
+ for (i = 0; i < length; i++) {
+ if (counts[i]) {
+ ++nonzero_count;
+ }
+ }
+ if (nonzero_count < 16) {
+ return;
+ }
+ while (length != 0 && counts[length - 1] == 0) {
+ --length;
+ }
+ if (length == 0) {
+ return; /* All zeros. */
+ }
+ /* Now counts[0..length - 1] does not have trailing zeros. */
+ {
+ size_t nonzeros = 0;
+ uint32_t smallest_nonzero = 1 << 30;
+ for (i = 0; i < length; ++i) {
+ if (counts[i] != 0) {
+ ++nonzeros;
+ if (smallest_nonzero > counts[i]) {
+ smallest_nonzero = counts[i];
+ }
+ }
+ }
+ if (nonzeros < 5) {
+ /* Small histogram will model it well. */
+ return;
+ }
+ if (smallest_nonzero < 4) {
+ size_t zeros = length - nonzeros;
+ if (zeros < 6) {
+ for (i = 1; i < length - 1; ++i) {
+ if (counts[i - 1] != 0 && counts[i] == 0 && counts[i + 1] != 0) {
+ counts[i] = 1;
+ }
+ }
+ }
+ }
+ if (nonzeros < 28) {
+ return;
+ }
+ }
+ /* 2) Let's mark all population counts that already can be encoded
+ with an RLE code. */
+ memset(good_for_rle, 0, length);
+ {
+ /* Let's not spoil any of the existing good RLE codes.
+ Mark any seq of 0's that is longer as 5 as a good_for_rle.
+ Mark any seq of non-0's that is longer as 7 as a good_for_rle. */
+ uint32_t symbol = counts[0];
+ size_t step = 0;
+ for (i = 0; i <= length; ++i) {
+ if (i == length || counts[i] != symbol) {
+ if ((symbol == 0 && step >= 5) ||
+ (symbol != 0 && step >= 7)) {
+ size_t k;
+ for (k = 0; k < step; ++k) {
+ good_for_rle[i - k - 1] = 1;
+ }
+ }
+ step = 1;
+ if (i != length) {
+ symbol = counts[i];
+ }
+ } else {
+ ++step;
+ }
+ }
+ }
+ /* 3) Let's replace those population counts that lead to more RLE codes.
+ Math here is in 24.8 fixed point representation. */
+ stride = 0;
+ limit = 256 * (counts[0] + counts[1] + counts[2]) / 3 + 420;
+ sum = 0;
+ for (i = 0; i <= length; ++i) {
+ if (i == length || good_for_rle[i] ||
+ (i != 0 && good_for_rle[i - 1]) ||
+ (256 * counts[i] - limit + streak_limit) >= 2 * streak_limit) {
+ if (stride >= 4 || (stride >= 3 && sum == 0)) {
+ size_t k;
+ /* The stride must end, collapse what we have, if we have enough (4). */
+ size_t count = (sum + stride / 2) / stride;
+ if (count == 0) {
+ count = 1;
+ }
+ if (sum == 0) {
+ /* Don't make an all zeros stride to be upgraded to ones. */
+ count = 0;
+ }
+ for (k = 0; k < stride; ++k) {
+ /* We don't want to change value at counts[i],
+ that is already belonging to the next stride. Thus - 1. */
+ counts[i - k - 1] = (uint32_t)count;
+ }
+ }
+ stride = 0;
+ sum = 0;
+ if (i < length - 2) {
+ /* All interesting strides have a count of at least 4, */
+ /* at least when non-zeros. */
+ limit = 256 * (counts[i] + counts[i + 1] + counts[i + 2]) / 3 + 420;
+ } else if (i < length) {
+ limit = 256 * counts[i];
+ } else {
+ limit = 0;
+ }
+ }
+ ++stride;
+ if (i != length) {
+ sum += counts[i];
+ if (stride >= 4) {
+ limit = (256 * sum + stride / 2) / stride;
+ }
+ if (stride == 4) {
+ limit += 120;
+ }
+ }
+ }
+}
+
+static void DecideOverRleUse(const uint8_t* depth, const size_t length,
+ BROTLI_BOOL* use_rle_for_non_zero,
+ BROTLI_BOOL* use_rle_for_zero) {
+ size_t total_reps_zero = 0;
+ size_t total_reps_non_zero = 0;
+ size_t count_reps_zero = 1;
+ size_t count_reps_non_zero = 1;
+ size_t i;
+ for (i = 0; i < length;) {
+ const uint8_t value = depth[i];
+ size_t reps = 1;
+ size_t k;
+ for (k = i + 1; k < length && depth[k] == value; ++k) {
+ ++reps;
+ }
+ if (reps >= 3 && value == 0) {
+ total_reps_zero += reps;
+ ++count_reps_zero;
+ }
+ if (reps >= 4 && value != 0) {
+ total_reps_non_zero += reps;
+ ++count_reps_non_zero;
+ }
+ i += reps;
+ }
+ *use_rle_for_non_zero =
+ TO_BROTLI_BOOL(total_reps_non_zero > count_reps_non_zero * 2);
+ *use_rle_for_zero = TO_BROTLI_BOOL(total_reps_zero > count_reps_zero * 2);
+}
+
+void BrotliWriteHuffmanTree(const uint8_t* depth,
+ size_t length,
+ size_t* tree_size,
+ uint8_t* tree,
+ uint8_t* extra_bits_data) {
+ uint8_t previous_value = BROTLI_INITIAL_REPEATED_CODE_LENGTH;
+ size_t i;
+ BROTLI_BOOL use_rle_for_non_zero = BROTLI_FALSE;
+ BROTLI_BOOL use_rle_for_zero = BROTLI_FALSE;
+
+ /* Throw away trailing zeros. */
+ size_t new_length = length;
+ for (i = 0; i < length; ++i) {
+ if (depth[length - i - 1] == 0) {
+ --new_length;
+ } else {
+ break;
+ }
+ }
+
+ /* First gather statistics on if it is a good idea to do RLE. */
+ if (length > 50) {
+ /* Find RLE coding for longer codes.
+ Shorter codes seem not to benefit from RLE. */
+ DecideOverRleUse(depth, new_length,
+ &use_rle_for_non_zero, &use_rle_for_zero);
+ }
+
+ /* Actual RLE coding. */
+ for (i = 0; i < new_length;) {
+ const uint8_t value = depth[i];
+ size_t reps = 1;
+ if ((value != 0 && use_rle_for_non_zero) ||
+ (value == 0 && use_rle_for_zero)) {
+ size_t k;
+ for (k = i + 1; k < new_length && depth[k] == value; ++k) {
+ ++reps;
+ }
+ }
+ if (value == 0) {
+ BrotliWriteHuffmanTreeRepetitionsZeros(
+ reps, tree_size, tree, extra_bits_data);
+ } else {
+ BrotliWriteHuffmanTreeRepetitions(previous_value,
+ value, reps, tree_size,
+ tree, extra_bits_data);
+ previous_value = value;
+ }
+ i += reps;
+ }
+}
+
+static uint16_t BrotliReverseBits(size_t num_bits, uint16_t bits) {
+ static const size_t kLut[16] = { /* Pre-reversed 4-bit values. */
+ 0x00, 0x08, 0x04, 0x0C, 0x02, 0x0A, 0x06, 0x0E,
+ 0x01, 0x09, 0x05, 0x0D, 0x03, 0x0B, 0x07, 0x0F
+ };
+ size_t retval = kLut[bits & 0x0F];
+ size_t i;
+ for (i = 4; i < num_bits; i += 4) {
+ retval <<= 4;
+ bits = (uint16_t)(bits >> 4);
+ retval |= kLut[bits & 0x0F];
+ }
+ retval >>= ((0 - num_bits) & 0x03);
+ return (uint16_t)retval;
+}
+
+/* 0..15 are values for bits */
+#define MAX_HUFFMAN_BITS 16
+
+void BrotliConvertBitDepthsToSymbols(const uint8_t* depth,
+ size_t len,
+ uint16_t* bits) {
+ /* In Brotli, all bit depths are [1..15]
+ 0 bit depth means that the symbol does not exist. */
+ uint16_t bl_count[MAX_HUFFMAN_BITS] = { 0 };
+ uint16_t next_code[MAX_HUFFMAN_BITS];
+ size_t i;
+ int code = 0;
+ for (i = 0; i < len; ++i) {
+ ++bl_count[depth[i]];
+ }
+ bl_count[0] = 0;
+ next_code[0] = 0;
+ for (i = 1; i < MAX_HUFFMAN_BITS; ++i) {
+ code = (code + bl_count[i - 1]) << 1;
+ next_code[i] = (uint16_t)code;
+ }
+ for (i = 0; i < len; ++i) {
+ if (depth[i]) {
+ bits[i] = BrotliReverseBits(depth[i], next_code[depth[i]]++);
+ }
+ }
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/entropy_encode.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/entropy_encode.h
new file mode 100644
index 000000000..f23d9c379
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/entropy_encode.h
@@ -0,0 +1,122 @@
+/* Copyright 2010 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Entropy encoding (Huffman) utilities. */
+
+#ifndef BROTLI_ENC_ENTROPY_ENCODE_H_
+#define BROTLI_ENC_ENTROPY_ENCODE_H_
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* A node of a Huffman tree. */
+typedef struct HuffmanTree {
+ uint32_t total_count_;
+ int16_t index_left_;
+ int16_t index_right_or_value_;
+} HuffmanTree;
+
+static BROTLI_INLINE void InitHuffmanTree(HuffmanTree* self, uint32_t count,
+ int16_t left, int16_t right) {
+ self->total_count_ = count;
+ self->index_left_ = left;
+ self->index_right_or_value_ = right;
+}
+
+/* Returns 1 is assignment of depths succeeded, otherwise 0. */
+BROTLI_INTERNAL BROTLI_BOOL BrotliSetDepth(
+ int p, HuffmanTree* pool, uint8_t* depth, int max_depth);
+
+/* This function will create a Huffman tree.
+
+ The (data,length) contains the population counts.
+ The tree_limit is the maximum bit depth of the Huffman codes.
+
+ The depth contains the tree, i.e., how many bits are used for
+ the symbol.
+
+ The actual Huffman tree is constructed in the tree[] array, which has to
+ be at least 2 * length + 1 long.
+
+ See http://en.wikipedia.org/wiki/Huffman_coding */
+BROTLI_INTERNAL void BrotliCreateHuffmanTree(const uint32_t* data,
+ const size_t length,
+ const int tree_limit,
+ HuffmanTree* tree,
+ uint8_t* depth);
+
+/* Change the population counts in a way that the consequent
+ Huffman tree compression, especially its RLE-part will be more
+ likely to compress this data more efficiently.
+
+ length contains the size of the histogram.
+ counts contains the population counts.
+ good_for_rle is a buffer of at least length size */
+BROTLI_INTERNAL void BrotliOptimizeHuffmanCountsForRle(
+ size_t length, uint32_t* counts, uint8_t* good_for_rle);
+
+/* Write a Huffman tree from bit depths into the bit-stream representation
+ of a Huffman tree. The generated Huffman tree is to be compressed once
+ more using a Huffman tree */
+BROTLI_INTERNAL void BrotliWriteHuffmanTree(const uint8_t* depth,
+ size_t num,
+ size_t* tree_size,
+ uint8_t* tree,
+ uint8_t* extra_bits_data);
+
+/* Get the actual bit values for a tree of bit depths. */
+BROTLI_INTERNAL void BrotliConvertBitDepthsToSymbols(const uint8_t* depth,
+ size_t len,
+ uint16_t* bits);
+
+/* Input size optimized Shell sort. */
+typedef BROTLI_BOOL (*HuffmanTreeComparator)(
+ const HuffmanTree*, const HuffmanTree*);
+static BROTLI_INLINE void SortHuffmanTreeItems(HuffmanTree* items,
+ const size_t n, HuffmanTreeComparator comparator) {
+ static const size_t gaps[] = {132, 57, 23, 10, 4, 1};
+ if (n < 13) {
+ /* Insertion sort. */
+ size_t i;
+ for (i = 1; i < n; ++i) {
+ HuffmanTree tmp = items[i];
+ size_t k = i;
+ size_t j = i - 1;
+ while (comparator(&tmp, &items[j])) {
+ items[k] = items[j];
+ k = j;
+ if (!j--) break;
+ }
+ items[k] = tmp;
+ }
+ return;
+ } else {
+ /* Shell sort. */
+ int g = n < 57 ? 2 : 0;
+ for (; g < 6; ++g) {
+ size_t gap = gaps[g];
+ size_t i;
+ for (i = gap; i < n; ++i) {
+ size_t j = i;
+ HuffmanTree tmp = items[i];
+ for (; j >= gap && comparator(&tmp, &items[j - gap]); j -= gap) {
+ items[j] = items[j - gap];
+ }
+ items[j] = tmp;
+ }
+ }
+ }
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_ENTROPY_ENCODE_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/entropy_encode_static.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/entropy_encode_static.h
new file mode 100644
index 000000000..62b99a954
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/entropy_encode_static.h
@@ -0,0 +1,539 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Static entropy codes used for faster meta-block encoding. */
+
+#ifndef BROTLI_ENC_ENTROPY_ENCODE_STATIC_H_
+#define BROTLI_ENC_ENTROPY_ENCODE_STATIC_H_
+
+#include "../common/constants.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./write_bits.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+static const uint8_t kCodeLengthDepth[18] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 0, 4, 4,
+};
+
+static const uint8_t kStaticCommandCodeDepth[BROTLI_NUM_COMMAND_SYMBOLS] = {
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+};
+
+static const uint8_t kStaticDistanceCodeDepth[64] = {
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+};
+
+static const uint32_t kCodeLengthBits[18] = {
+ 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 15, 31, 0, 11, 7,
+};
+
+static BROTLI_INLINE void StoreStaticCodeLengthCode(
+ size_t* storage_ix, uint8_t* storage) {
+ BrotliWriteBits(
+ 40, BROTLI_MAKE_UINT64_T(0x0000FFu, 0x55555554u), storage_ix, storage);
+}
+
+static const uint64_t kZeroRepsBits[BROTLI_NUM_COMMAND_SYMBOLS] = {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000017, 0x00000027,
+ 0x00000037, 0x00000047, 0x00000057, 0x00000067, 0x00000077, 0x00000770,
+ 0x00000b87, 0x00001387, 0x00001b87, 0x00002387, 0x00002b87, 0x00003387,
+ 0x00003b87, 0x00000397, 0x00000b97, 0x00001397, 0x00001b97, 0x00002397,
+ 0x00002b97, 0x00003397, 0x00003b97, 0x000003a7, 0x00000ba7, 0x000013a7,
+ 0x00001ba7, 0x000023a7, 0x00002ba7, 0x000033a7, 0x00003ba7, 0x000003b7,
+ 0x00000bb7, 0x000013b7, 0x00001bb7, 0x000023b7, 0x00002bb7, 0x000033b7,
+ 0x00003bb7, 0x000003c7, 0x00000bc7, 0x000013c7, 0x00001bc7, 0x000023c7,
+ 0x00002bc7, 0x000033c7, 0x00003bc7, 0x000003d7, 0x00000bd7, 0x000013d7,
+ 0x00001bd7, 0x000023d7, 0x00002bd7, 0x000033d7, 0x00003bd7, 0x000003e7,
+ 0x00000be7, 0x000013e7, 0x00001be7, 0x000023e7, 0x00002be7, 0x000033e7,
+ 0x00003be7, 0x000003f7, 0x00000bf7, 0x000013f7, 0x00001bf7, 0x000023f7,
+ 0x00002bf7, 0x000033f7, 0x00003bf7, 0x0001c387, 0x0005c387, 0x0009c387,
+ 0x000dc387, 0x0011c387, 0x0015c387, 0x0019c387, 0x001dc387, 0x0001cb87,
+ 0x0005cb87, 0x0009cb87, 0x000dcb87, 0x0011cb87, 0x0015cb87, 0x0019cb87,
+ 0x001dcb87, 0x0001d387, 0x0005d387, 0x0009d387, 0x000dd387, 0x0011d387,
+ 0x0015d387, 0x0019d387, 0x001dd387, 0x0001db87, 0x0005db87, 0x0009db87,
+ 0x000ddb87, 0x0011db87, 0x0015db87, 0x0019db87, 0x001ddb87, 0x0001e387,
+ 0x0005e387, 0x0009e387, 0x000de387, 0x0011e387, 0x0015e387, 0x0019e387,
+ 0x001de387, 0x0001eb87, 0x0005eb87, 0x0009eb87, 0x000deb87, 0x0011eb87,
+ 0x0015eb87, 0x0019eb87, 0x001deb87, 0x0001f387, 0x0005f387, 0x0009f387,
+ 0x000df387, 0x0011f387, 0x0015f387, 0x0019f387, 0x001df387, 0x0001fb87,
+ 0x0005fb87, 0x0009fb87, 0x000dfb87, 0x0011fb87, 0x0015fb87, 0x0019fb87,
+ 0x001dfb87, 0x0001c397, 0x0005c397, 0x0009c397, 0x000dc397, 0x0011c397,
+ 0x0015c397, 0x0019c397, 0x001dc397, 0x0001cb97, 0x0005cb97, 0x0009cb97,
+ 0x000dcb97, 0x0011cb97, 0x0015cb97, 0x0019cb97, 0x001dcb97, 0x0001d397,
+ 0x0005d397, 0x0009d397, 0x000dd397, 0x0011d397, 0x0015d397, 0x0019d397,
+ 0x001dd397, 0x0001db97, 0x0005db97, 0x0009db97, 0x000ddb97, 0x0011db97,
+ 0x0015db97, 0x0019db97, 0x001ddb97, 0x0001e397, 0x0005e397, 0x0009e397,
+ 0x000de397, 0x0011e397, 0x0015e397, 0x0019e397, 0x001de397, 0x0001eb97,
+ 0x0005eb97, 0x0009eb97, 0x000deb97, 0x0011eb97, 0x0015eb97, 0x0019eb97,
+ 0x001deb97, 0x0001f397, 0x0005f397, 0x0009f397, 0x000df397, 0x0011f397,
+ 0x0015f397, 0x0019f397, 0x001df397, 0x0001fb97, 0x0005fb97, 0x0009fb97,
+ 0x000dfb97, 0x0011fb97, 0x0015fb97, 0x0019fb97, 0x001dfb97, 0x0001c3a7,
+ 0x0005c3a7, 0x0009c3a7, 0x000dc3a7, 0x0011c3a7, 0x0015c3a7, 0x0019c3a7,
+ 0x001dc3a7, 0x0001cba7, 0x0005cba7, 0x0009cba7, 0x000dcba7, 0x0011cba7,
+ 0x0015cba7, 0x0019cba7, 0x001dcba7, 0x0001d3a7, 0x0005d3a7, 0x0009d3a7,
+ 0x000dd3a7, 0x0011d3a7, 0x0015d3a7, 0x0019d3a7, 0x001dd3a7, 0x0001dba7,
+ 0x0005dba7, 0x0009dba7, 0x000ddba7, 0x0011dba7, 0x0015dba7, 0x0019dba7,
+ 0x001ddba7, 0x0001e3a7, 0x0005e3a7, 0x0009e3a7, 0x000de3a7, 0x0011e3a7,
+ 0x0015e3a7, 0x0019e3a7, 0x001de3a7, 0x0001eba7, 0x0005eba7, 0x0009eba7,
+ 0x000deba7, 0x0011eba7, 0x0015eba7, 0x0019eba7, 0x001deba7, 0x0001f3a7,
+ 0x0005f3a7, 0x0009f3a7, 0x000df3a7, 0x0011f3a7, 0x0015f3a7, 0x0019f3a7,
+ 0x001df3a7, 0x0001fba7, 0x0005fba7, 0x0009fba7, 0x000dfba7, 0x0011fba7,
+ 0x0015fba7, 0x0019fba7, 0x001dfba7, 0x0001c3b7, 0x0005c3b7, 0x0009c3b7,
+ 0x000dc3b7, 0x0011c3b7, 0x0015c3b7, 0x0019c3b7, 0x001dc3b7, 0x0001cbb7,
+ 0x0005cbb7, 0x0009cbb7, 0x000dcbb7, 0x0011cbb7, 0x0015cbb7, 0x0019cbb7,
+ 0x001dcbb7, 0x0001d3b7, 0x0005d3b7, 0x0009d3b7, 0x000dd3b7, 0x0011d3b7,
+ 0x0015d3b7, 0x0019d3b7, 0x001dd3b7, 0x0001dbb7, 0x0005dbb7, 0x0009dbb7,
+ 0x000ddbb7, 0x0011dbb7, 0x0015dbb7, 0x0019dbb7, 0x001ddbb7, 0x0001e3b7,
+ 0x0005e3b7, 0x0009e3b7, 0x000de3b7, 0x0011e3b7, 0x0015e3b7, 0x0019e3b7,
+ 0x001de3b7, 0x0001ebb7, 0x0005ebb7, 0x0009ebb7, 0x000debb7, 0x0011ebb7,
+ 0x0015ebb7, 0x0019ebb7, 0x001debb7, 0x0001f3b7, 0x0005f3b7, 0x0009f3b7,
+ 0x000df3b7, 0x0011f3b7, 0x0015f3b7, 0x0019f3b7, 0x001df3b7, 0x0001fbb7,
+ 0x0005fbb7, 0x0009fbb7, 0x000dfbb7, 0x0011fbb7, 0x0015fbb7, 0x0019fbb7,
+ 0x001dfbb7, 0x0001c3c7, 0x0005c3c7, 0x0009c3c7, 0x000dc3c7, 0x0011c3c7,
+ 0x0015c3c7, 0x0019c3c7, 0x001dc3c7, 0x0001cbc7, 0x0005cbc7, 0x0009cbc7,
+ 0x000dcbc7, 0x0011cbc7, 0x0015cbc7, 0x0019cbc7, 0x001dcbc7, 0x0001d3c7,
+ 0x0005d3c7, 0x0009d3c7, 0x000dd3c7, 0x0011d3c7, 0x0015d3c7, 0x0019d3c7,
+ 0x001dd3c7, 0x0001dbc7, 0x0005dbc7, 0x0009dbc7, 0x000ddbc7, 0x0011dbc7,
+ 0x0015dbc7, 0x0019dbc7, 0x001ddbc7, 0x0001e3c7, 0x0005e3c7, 0x0009e3c7,
+ 0x000de3c7, 0x0011e3c7, 0x0015e3c7, 0x0019e3c7, 0x001de3c7, 0x0001ebc7,
+ 0x0005ebc7, 0x0009ebc7, 0x000debc7, 0x0011ebc7, 0x0015ebc7, 0x0019ebc7,
+ 0x001debc7, 0x0001f3c7, 0x0005f3c7, 0x0009f3c7, 0x000df3c7, 0x0011f3c7,
+ 0x0015f3c7, 0x0019f3c7, 0x001df3c7, 0x0001fbc7, 0x0005fbc7, 0x0009fbc7,
+ 0x000dfbc7, 0x0011fbc7, 0x0015fbc7, 0x0019fbc7, 0x001dfbc7, 0x0001c3d7,
+ 0x0005c3d7, 0x0009c3d7, 0x000dc3d7, 0x0011c3d7, 0x0015c3d7, 0x0019c3d7,
+ 0x001dc3d7, 0x0001cbd7, 0x0005cbd7, 0x0009cbd7, 0x000dcbd7, 0x0011cbd7,
+ 0x0015cbd7, 0x0019cbd7, 0x001dcbd7, 0x0001d3d7, 0x0005d3d7, 0x0009d3d7,
+ 0x000dd3d7, 0x0011d3d7, 0x0015d3d7, 0x0019d3d7, 0x001dd3d7, 0x0001dbd7,
+ 0x0005dbd7, 0x0009dbd7, 0x000ddbd7, 0x0011dbd7, 0x0015dbd7, 0x0019dbd7,
+ 0x001ddbd7, 0x0001e3d7, 0x0005e3d7, 0x0009e3d7, 0x000de3d7, 0x0011e3d7,
+ 0x0015e3d7, 0x0019e3d7, 0x001de3d7, 0x0001ebd7, 0x0005ebd7, 0x0009ebd7,
+ 0x000debd7, 0x0011ebd7, 0x0015ebd7, 0x0019ebd7, 0x001debd7, 0x0001f3d7,
+ 0x0005f3d7, 0x0009f3d7, 0x000df3d7, 0x0011f3d7, 0x0015f3d7, 0x0019f3d7,
+ 0x001df3d7, 0x0001fbd7, 0x0005fbd7, 0x0009fbd7, 0x000dfbd7, 0x0011fbd7,
+ 0x0015fbd7, 0x0019fbd7, 0x001dfbd7, 0x0001c3e7, 0x0005c3e7, 0x0009c3e7,
+ 0x000dc3e7, 0x0011c3e7, 0x0015c3e7, 0x0019c3e7, 0x001dc3e7, 0x0001cbe7,
+ 0x0005cbe7, 0x0009cbe7, 0x000dcbe7, 0x0011cbe7, 0x0015cbe7, 0x0019cbe7,
+ 0x001dcbe7, 0x0001d3e7, 0x0005d3e7, 0x0009d3e7, 0x000dd3e7, 0x0011d3e7,
+ 0x0015d3e7, 0x0019d3e7, 0x001dd3e7, 0x0001dbe7, 0x0005dbe7, 0x0009dbe7,
+ 0x000ddbe7, 0x0011dbe7, 0x0015dbe7, 0x0019dbe7, 0x001ddbe7, 0x0001e3e7,
+ 0x0005e3e7, 0x0009e3e7, 0x000de3e7, 0x0011e3e7, 0x0015e3e7, 0x0019e3e7,
+ 0x001de3e7, 0x0001ebe7, 0x0005ebe7, 0x0009ebe7, 0x000debe7, 0x0011ebe7,
+ 0x0015ebe7, 0x0019ebe7, 0x001debe7, 0x0001f3e7, 0x0005f3e7, 0x0009f3e7,
+ 0x000df3e7, 0x0011f3e7, 0x0015f3e7, 0x0019f3e7, 0x001df3e7, 0x0001fbe7,
+ 0x0005fbe7, 0x0009fbe7, 0x000dfbe7, 0x0011fbe7, 0x0015fbe7, 0x0019fbe7,
+ 0x001dfbe7, 0x0001c3f7, 0x0005c3f7, 0x0009c3f7, 0x000dc3f7, 0x0011c3f7,
+ 0x0015c3f7, 0x0019c3f7, 0x001dc3f7, 0x0001cbf7, 0x0005cbf7, 0x0009cbf7,
+ 0x000dcbf7, 0x0011cbf7, 0x0015cbf7, 0x0019cbf7, 0x001dcbf7, 0x0001d3f7,
+ 0x0005d3f7, 0x0009d3f7, 0x000dd3f7, 0x0011d3f7, 0x0015d3f7, 0x0019d3f7,
+ 0x001dd3f7, 0x0001dbf7, 0x0005dbf7, 0x0009dbf7, 0x000ddbf7, 0x0011dbf7,
+ 0x0015dbf7, 0x0019dbf7, 0x001ddbf7, 0x0001e3f7, 0x0005e3f7, 0x0009e3f7,
+ 0x000de3f7, 0x0011e3f7, 0x0015e3f7, 0x0019e3f7, 0x001de3f7, 0x0001ebf7,
+ 0x0005ebf7, 0x0009ebf7, 0x000debf7, 0x0011ebf7, 0x0015ebf7, 0x0019ebf7,
+ 0x001debf7, 0x0001f3f7, 0x0005f3f7, 0x0009f3f7, 0x000df3f7, 0x0011f3f7,
+ 0x0015f3f7, 0x0019f3f7, 0x001df3f7, 0x0001fbf7, 0x0005fbf7, 0x0009fbf7,
+ 0x000dfbf7, 0x0011fbf7, 0x0015fbf7, 0x0019fbf7, 0x001dfbf7, 0x00e1c387,
+ 0x02e1c387, 0x04e1c387, 0x06e1c387, 0x08e1c387, 0x0ae1c387, 0x0ce1c387,
+ 0x0ee1c387, 0x00e5c387, 0x02e5c387, 0x04e5c387, 0x06e5c387, 0x08e5c387,
+ 0x0ae5c387, 0x0ce5c387, 0x0ee5c387, 0x00e9c387, 0x02e9c387, 0x04e9c387,
+ 0x06e9c387, 0x08e9c387, 0x0ae9c387, 0x0ce9c387, 0x0ee9c387, 0x00edc387,
+ 0x02edc387, 0x04edc387, 0x06edc387, 0x08edc387, 0x0aedc387, 0x0cedc387,
+ 0x0eedc387, 0x00f1c387, 0x02f1c387, 0x04f1c387, 0x06f1c387, 0x08f1c387,
+ 0x0af1c387, 0x0cf1c387, 0x0ef1c387, 0x00f5c387, 0x02f5c387, 0x04f5c387,
+ 0x06f5c387, 0x08f5c387, 0x0af5c387, 0x0cf5c387, 0x0ef5c387, 0x00f9c387,
+ 0x02f9c387, 0x04f9c387, 0x06f9c387, 0x08f9c387, 0x0af9c387, 0x0cf9c387,
+ 0x0ef9c387, 0x00fdc387, 0x02fdc387, 0x04fdc387, 0x06fdc387, 0x08fdc387,
+ 0x0afdc387, 0x0cfdc387, 0x0efdc387, 0x00e1cb87, 0x02e1cb87, 0x04e1cb87,
+ 0x06e1cb87, 0x08e1cb87, 0x0ae1cb87, 0x0ce1cb87, 0x0ee1cb87, 0x00e5cb87,
+ 0x02e5cb87, 0x04e5cb87, 0x06e5cb87, 0x08e5cb87, 0x0ae5cb87, 0x0ce5cb87,
+ 0x0ee5cb87, 0x00e9cb87, 0x02e9cb87, 0x04e9cb87, 0x06e9cb87, 0x08e9cb87,
+ 0x0ae9cb87, 0x0ce9cb87, 0x0ee9cb87, 0x00edcb87, 0x02edcb87, 0x04edcb87,
+ 0x06edcb87, 0x08edcb87, 0x0aedcb87, 0x0cedcb87, 0x0eedcb87, 0x00f1cb87,
+ 0x02f1cb87, 0x04f1cb87, 0x06f1cb87, 0x08f1cb87, 0x0af1cb87, 0x0cf1cb87,
+ 0x0ef1cb87, 0x00f5cb87, 0x02f5cb87, 0x04f5cb87, 0x06f5cb87, 0x08f5cb87,
+ 0x0af5cb87, 0x0cf5cb87, 0x0ef5cb87, 0x00f9cb87, 0x02f9cb87, 0x04f9cb87,
+ 0x06f9cb87, 0x08f9cb87,
+};
+
+static const uint32_t kZeroRepsDepth[BROTLI_NUM_COMMAND_SYMBOLS] = {
+ 0, 4, 8, 7, 7, 7, 7, 7, 7, 7, 7, 11, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+};
+
+static const uint64_t kNonZeroRepsBits[BROTLI_NUM_COMMAND_SYMBOLS] = {
+ 0x0000000b, 0x0000001b, 0x0000002b, 0x0000003b, 0x000002cb, 0x000006cb,
+ 0x00000acb, 0x00000ecb, 0x000002db, 0x000006db, 0x00000adb, 0x00000edb,
+ 0x000002eb, 0x000006eb, 0x00000aeb, 0x00000eeb, 0x000002fb, 0x000006fb,
+ 0x00000afb, 0x00000efb, 0x0000b2cb, 0x0001b2cb, 0x0002b2cb, 0x0003b2cb,
+ 0x0000b6cb, 0x0001b6cb, 0x0002b6cb, 0x0003b6cb, 0x0000bacb, 0x0001bacb,
+ 0x0002bacb, 0x0003bacb, 0x0000becb, 0x0001becb, 0x0002becb, 0x0003becb,
+ 0x0000b2db, 0x0001b2db, 0x0002b2db, 0x0003b2db, 0x0000b6db, 0x0001b6db,
+ 0x0002b6db, 0x0003b6db, 0x0000badb, 0x0001badb, 0x0002badb, 0x0003badb,
+ 0x0000bedb, 0x0001bedb, 0x0002bedb, 0x0003bedb, 0x0000b2eb, 0x0001b2eb,
+ 0x0002b2eb, 0x0003b2eb, 0x0000b6eb, 0x0001b6eb, 0x0002b6eb, 0x0003b6eb,
+ 0x0000baeb, 0x0001baeb, 0x0002baeb, 0x0003baeb, 0x0000beeb, 0x0001beeb,
+ 0x0002beeb, 0x0003beeb, 0x0000b2fb, 0x0001b2fb, 0x0002b2fb, 0x0003b2fb,
+ 0x0000b6fb, 0x0001b6fb, 0x0002b6fb, 0x0003b6fb, 0x0000bafb, 0x0001bafb,
+ 0x0002bafb, 0x0003bafb, 0x0000befb, 0x0001befb, 0x0002befb, 0x0003befb,
+ 0x002cb2cb, 0x006cb2cb, 0x00acb2cb, 0x00ecb2cb, 0x002db2cb, 0x006db2cb,
+ 0x00adb2cb, 0x00edb2cb, 0x002eb2cb, 0x006eb2cb, 0x00aeb2cb, 0x00eeb2cb,
+ 0x002fb2cb, 0x006fb2cb, 0x00afb2cb, 0x00efb2cb, 0x002cb6cb, 0x006cb6cb,
+ 0x00acb6cb, 0x00ecb6cb, 0x002db6cb, 0x006db6cb, 0x00adb6cb, 0x00edb6cb,
+ 0x002eb6cb, 0x006eb6cb, 0x00aeb6cb, 0x00eeb6cb, 0x002fb6cb, 0x006fb6cb,
+ 0x00afb6cb, 0x00efb6cb, 0x002cbacb, 0x006cbacb, 0x00acbacb, 0x00ecbacb,
+ 0x002dbacb, 0x006dbacb, 0x00adbacb, 0x00edbacb, 0x002ebacb, 0x006ebacb,
+ 0x00aebacb, 0x00eebacb, 0x002fbacb, 0x006fbacb, 0x00afbacb, 0x00efbacb,
+ 0x002cbecb, 0x006cbecb, 0x00acbecb, 0x00ecbecb, 0x002dbecb, 0x006dbecb,
+ 0x00adbecb, 0x00edbecb, 0x002ebecb, 0x006ebecb, 0x00aebecb, 0x00eebecb,
+ 0x002fbecb, 0x006fbecb, 0x00afbecb, 0x00efbecb, 0x002cb2db, 0x006cb2db,
+ 0x00acb2db, 0x00ecb2db, 0x002db2db, 0x006db2db, 0x00adb2db, 0x00edb2db,
+ 0x002eb2db, 0x006eb2db, 0x00aeb2db, 0x00eeb2db, 0x002fb2db, 0x006fb2db,
+ 0x00afb2db, 0x00efb2db, 0x002cb6db, 0x006cb6db, 0x00acb6db, 0x00ecb6db,
+ 0x002db6db, 0x006db6db, 0x00adb6db, 0x00edb6db, 0x002eb6db, 0x006eb6db,
+ 0x00aeb6db, 0x00eeb6db, 0x002fb6db, 0x006fb6db, 0x00afb6db, 0x00efb6db,
+ 0x002cbadb, 0x006cbadb, 0x00acbadb, 0x00ecbadb, 0x002dbadb, 0x006dbadb,
+ 0x00adbadb, 0x00edbadb, 0x002ebadb, 0x006ebadb, 0x00aebadb, 0x00eebadb,
+ 0x002fbadb, 0x006fbadb, 0x00afbadb, 0x00efbadb, 0x002cbedb, 0x006cbedb,
+ 0x00acbedb, 0x00ecbedb, 0x002dbedb, 0x006dbedb, 0x00adbedb, 0x00edbedb,
+ 0x002ebedb, 0x006ebedb, 0x00aebedb, 0x00eebedb, 0x002fbedb, 0x006fbedb,
+ 0x00afbedb, 0x00efbedb, 0x002cb2eb, 0x006cb2eb, 0x00acb2eb, 0x00ecb2eb,
+ 0x002db2eb, 0x006db2eb, 0x00adb2eb, 0x00edb2eb, 0x002eb2eb, 0x006eb2eb,
+ 0x00aeb2eb, 0x00eeb2eb, 0x002fb2eb, 0x006fb2eb, 0x00afb2eb, 0x00efb2eb,
+ 0x002cb6eb, 0x006cb6eb, 0x00acb6eb, 0x00ecb6eb, 0x002db6eb, 0x006db6eb,
+ 0x00adb6eb, 0x00edb6eb, 0x002eb6eb, 0x006eb6eb, 0x00aeb6eb, 0x00eeb6eb,
+ 0x002fb6eb, 0x006fb6eb, 0x00afb6eb, 0x00efb6eb, 0x002cbaeb, 0x006cbaeb,
+ 0x00acbaeb, 0x00ecbaeb, 0x002dbaeb, 0x006dbaeb, 0x00adbaeb, 0x00edbaeb,
+ 0x002ebaeb, 0x006ebaeb, 0x00aebaeb, 0x00eebaeb, 0x002fbaeb, 0x006fbaeb,
+ 0x00afbaeb, 0x00efbaeb, 0x002cbeeb, 0x006cbeeb, 0x00acbeeb, 0x00ecbeeb,
+ 0x002dbeeb, 0x006dbeeb, 0x00adbeeb, 0x00edbeeb, 0x002ebeeb, 0x006ebeeb,
+ 0x00aebeeb, 0x00eebeeb, 0x002fbeeb, 0x006fbeeb, 0x00afbeeb, 0x00efbeeb,
+ 0x002cb2fb, 0x006cb2fb, 0x00acb2fb, 0x00ecb2fb, 0x002db2fb, 0x006db2fb,
+ 0x00adb2fb, 0x00edb2fb, 0x002eb2fb, 0x006eb2fb, 0x00aeb2fb, 0x00eeb2fb,
+ 0x002fb2fb, 0x006fb2fb, 0x00afb2fb, 0x00efb2fb, 0x002cb6fb, 0x006cb6fb,
+ 0x00acb6fb, 0x00ecb6fb, 0x002db6fb, 0x006db6fb, 0x00adb6fb, 0x00edb6fb,
+ 0x002eb6fb, 0x006eb6fb, 0x00aeb6fb, 0x00eeb6fb, 0x002fb6fb, 0x006fb6fb,
+ 0x00afb6fb, 0x00efb6fb, 0x002cbafb, 0x006cbafb, 0x00acbafb, 0x00ecbafb,
+ 0x002dbafb, 0x006dbafb, 0x00adbafb, 0x00edbafb, 0x002ebafb, 0x006ebafb,
+ 0x00aebafb, 0x00eebafb, 0x002fbafb, 0x006fbafb, 0x00afbafb, 0x00efbafb,
+ 0x002cbefb, 0x006cbefb, 0x00acbefb, 0x00ecbefb, 0x002dbefb, 0x006dbefb,
+ 0x00adbefb, 0x00edbefb, 0x002ebefb, 0x006ebefb, 0x00aebefb, 0x00eebefb,
+ 0x002fbefb, 0x006fbefb, 0x00afbefb, 0x00efbefb, 0x0b2cb2cb, 0x1b2cb2cb,
+ 0x2b2cb2cb, 0x3b2cb2cb, 0x0b6cb2cb, 0x1b6cb2cb, 0x2b6cb2cb, 0x3b6cb2cb,
+ 0x0bacb2cb, 0x1bacb2cb, 0x2bacb2cb, 0x3bacb2cb, 0x0becb2cb, 0x1becb2cb,
+ 0x2becb2cb, 0x3becb2cb, 0x0b2db2cb, 0x1b2db2cb, 0x2b2db2cb, 0x3b2db2cb,
+ 0x0b6db2cb, 0x1b6db2cb, 0x2b6db2cb, 0x3b6db2cb, 0x0badb2cb, 0x1badb2cb,
+ 0x2badb2cb, 0x3badb2cb, 0x0bedb2cb, 0x1bedb2cb, 0x2bedb2cb, 0x3bedb2cb,
+ 0x0b2eb2cb, 0x1b2eb2cb, 0x2b2eb2cb, 0x3b2eb2cb, 0x0b6eb2cb, 0x1b6eb2cb,
+ 0x2b6eb2cb, 0x3b6eb2cb, 0x0baeb2cb, 0x1baeb2cb, 0x2baeb2cb, 0x3baeb2cb,
+ 0x0beeb2cb, 0x1beeb2cb, 0x2beeb2cb, 0x3beeb2cb, 0x0b2fb2cb, 0x1b2fb2cb,
+ 0x2b2fb2cb, 0x3b2fb2cb, 0x0b6fb2cb, 0x1b6fb2cb, 0x2b6fb2cb, 0x3b6fb2cb,
+ 0x0bafb2cb, 0x1bafb2cb, 0x2bafb2cb, 0x3bafb2cb, 0x0befb2cb, 0x1befb2cb,
+ 0x2befb2cb, 0x3befb2cb, 0x0b2cb6cb, 0x1b2cb6cb, 0x2b2cb6cb, 0x3b2cb6cb,
+ 0x0b6cb6cb, 0x1b6cb6cb, 0x2b6cb6cb, 0x3b6cb6cb, 0x0bacb6cb, 0x1bacb6cb,
+ 0x2bacb6cb, 0x3bacb6cb, 0x0becb6cb, 0x1becb6cb, 0x2becb6cb, 0x3becb6cb,
+ 0x0b2db6cb, 0x1b2db6cb, 0x2b2db6cb, 0x3b2db6cb, 0x0b6db6cb, 0x1b6db6cb,
+ 0x2b6db6cb, 0x3b6db6cb, 0x0badb6cb, 0x1badb6cb, 0x2badb6cb, 0x3badb6cb,
+ 0x0bedb6cb, 0x1bedb6cb, 0x2bedb6cb, 0x3bedb6cb, 0x0b2eb6cb, 0x1b2eb6cb,
+ 0x2b2eb6cb, 0x3b2eb6cb, 0x0b6eb6cb, 0x1b6eb6cb, 0x2b6eb6cb, 0x3b6eb6cb,
+ 0x0baeb6cb, 0x1baeb6cb, 0x2baeb6cb, 0x3baeb6cb, 0x0beeb6cb, 0x1beeb6cb,
+ 0x2beeb6cb, 0x3beeb6cb, 0x0b2fb6cb, 0x1b2fb6cb, 0x2b2fb6cb, 0x3b2fb6cb,
+ 0x0b6fb6cb, 0x1b6fb6cb, 0x2b6fb6cb, 0x3b6fb6cb, 0x0bafb6cb, 0x1bafb6cb,
+ 0x2bafb6cb, 0x3bafb6cb, 0x0befb6cb, 0x1befb6cb, 0x2befb6cb, 0x3befb6cb,
+ 0x0b2cbacb, 0x1b2cbacb, 0x2b2cbacb, 0x3b2cbacb, 0x0b6cbacb, 0x1b6cbacb,
+ 0x2b6cbacb, 0x3b6cbacb, 0x0bacbacb, 0x1bacbacb, 0x2bacbacb, 0x3bacbacb,
+ 0x0becbacb, 0x1becbacb, 0x2becbacb, 0x3becbacb, 0x0b2dbacb, 0x1b2dbacb,
+ 0x2b2dbacb, 0x3b2dbacb, 0x0b6dbacb, 0x1b6dbacb, 0x2b6dbacb, 0x3b6dbacb,
+ 0x0badbacb, 0x1badbacb, 0x2badbacb, 0x3badbacb, 0x0bedbacb, 0x1bedbacb,
+ 0x2bedbacb, 0x3bedbacb, 0x0b2ebacb, 0x1b2ebacb, 0x2b2ebacb, 0x3b2ebacb,
+ 0x0b6ebacb, 0x1b6ebacb, 0x2b6ebacb, 0x3b6ebacb, 0x0baebacb, 0x1baebacb,
+ 0x2baebacb, 0x3baebacb, 0x0beebacb, 0x1beebacb, 0x2beebacb, 0x3beebacb,
+ 0x0b2fbacb, 0x1b2fbacb, 0x2b2fbacb, 0x3b2fbacb, 0x0b6fbacb, 0x1b6fbacb,
+ 0x2b6fbacb, 0x3b6fbacb, 0x0bafbacb, 0x1bafbacb, 0x2bafbacb, 0x3bafbacb,
+ 0x0befbacb, 0x1befbacb, 0x2befbacb, 0x3befbacb, 0x0b2cbecb, 0x1b2cbecb,
+ 0x2b2cbecb, 0x3b2cbecb, 0x0b6cbecb, 0x1b6cbecb, 0x2b6cbecb, 0x3b6cbecb,
+ 0x0bacbecb, 0x1bacbecb, 0x2bacbecb, 0x3bacbecb, 0x0becbecb, 0x1becbecb,
+ 0x2becbecb, 0x3becbecb, 0x0b2dbecb, 0x1b2dbecb, 0x2b2dbecb, 0x3b2dbecb,
+ 0x0b6dbecb, 0x1b6dbecb, 0x2b6dbecb, 0x3b6dbecb, 0x0badbecb, 0x1badbecb,
+ 0x2badbecb, 0x3badbecb, 0x0bedbecb, 0x1bedbecb, 0x2bedbecb, 0x3bedbecb,
+ 0x0b2ebecb, 0x1b2ebecb, 0x2b2ebecb, 0x3b2ebecb, 0x0b6ebecb, 0x1b6ebecb,
+ 0x2b6ebecb, 0x3b6ebecb, 0x0baebecb, 0x1baebecb, 0x2baebecb, 0x3baebecb,
+ 0x0beebecb, 0x1beebecb, 0x2beebecb, 0x3beebecb, 0x0b2fbecb, 0x1b2fbecb,
+ 0x2b2fbecb, 0x3b2fbecb, 0x0b6fbecb, 0x1b6fbecb, 0x2b6fbecb, 0x3b6fbecb,
+ 0x0bafbecb, 0x1bafbecb, 0x2bafbecb, 0x3bafbecb, 0x0befbecb, 0x1befbecb,
+ 0x2befbecb, 0x3befbecb, 0x0b2cb2db, 0x1b2cb2db, 0x2b2cb2db, 0x3b2cb2db,
+ 0x0b6cb2db, 0x1b6cb2db, 0x2b6cb2db, 0x3b6cb2db, 0x0bacb2db, 0x1bacb2db,
+ 0x2bacb2db, 0x3bacb2db, 0x0becb2db, 0x1becb2db, 0x2becb2db, 0x3becb2db,
+ 0x0b2db2db, 0x1b2db2db, 0x2b2db2db, 0x3b2db2db, 0x0b6db2db, 0x1b6db2db,
+ 0x2b6db2db, 0x3b6db2db, 0x0badb2db, 0x1badb2db, 0x2badb2db, 0x3badb2db,
+ 0x0bedb2db, 0x1bedb2db, 0x2bedb2db, 0x3bedb2db, 0x0b2eb2db, 0x1b2eb2db,
+ 0x2b2eb2db, 0x3b2eb2db, 0x0b6eb2db, 0x1b6eb2db, 0x2b6eb2db, 0x3b6eb2db,
+ 0x0baeb2db, 0x1baeb2db, 0x2baeb2db, 0x3baeb2db, 0x0beeb2db, 0x1beeb2db,
+ 0x2beeb2db, 0x3beeb2db, 0x0b2fb2db, 0x1b2fb2db, 0x2b2fb2db, 0x3b2fb2db,
+ 0x0b6fb2db, 0x1b6fb2db, 0x2b6fb2db, 0x3b6fb2db, 0x0bafb2db, 0x1bafb2db,
+ 0x2bafb2db, 0x3bafb2db, 0x0befb2db, 0x1befb2db, 0x2befb2db, 0x3befb2db,
+ 0x0b2cb6db, 0x1b2cb6db, 0x2b2cb6db, 0x3b2cb6db, 0x0b6cb6db, 0x1b6cb6db,
+ 0x2b6cb6db, 0x3b6cb6db, 0x0bacb6db, 0x1bacb6db, 0x2bacb6db, 0x3bacb6db,
+ 0x0becb6db, 0x1becb6db, 0x2becb6db, 0x3becb6db, 0x0b2db6db, 0x1b2db6db,
+ 0x2b2db6db, 0x3b2db6db, 0x0b6db6db, 0x1b6db6db, 0x2b6db6db, 0x3b6db6db,
+ 0x0badb6db, 0x1badb6db, 0x2badb6db, 0x3badb6db, 0x0bedb6db, 0x1bedb6db,
+ 0x2bedb6db, 0x3bedb6db, 0x0b2eb6db, 0x1b2eb6db, 0x2b2eb6db, 0x3b2eb6db,
+ 0x0b6eb6db, 0x1b6eb6db, 0x2b6eb6db, 0x3b6eb6db, 0x0baeb6db, 0x1baeb6db,
+ 0x2baeb6db, 0x3baeb6db,
+};
+
+static const uint32_t kNonZeroRepsDepth[BROTLI_NUM_COMMAND_SYMBOLS] = {
+ 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+};
+
+static const uint16_t kStaticCommandCodeBits[BROTLI_NUM_COMMAND_SYMBOLS] = {
+ 0, 256, 128, 384, 64, 320, 192, 448,
+ 32, 288, 160, 416, 96, 352, 224, 480,
+ 16, 272, 144, 400, 80, 336, 208, 464,
+ 48, 304, 176, 432, 112, 368, 240, 496,
+ 8, 264, 136, 392, 72, 328, 200, 456,
+ 40, 296, 168, 424, 104, 360, 232, 488,
+ 24, 280, 152, 408, 88, 344, 216, 472,
+ 56, 312, 184, 440, 120, 376, 248, 504,
+ 4, 260, 132, 388, 68, 324, 196, 452,
+ 36, 292, 164, 420, 100, 356, 228, 484,
+ 20, 276, 148, 404, 84, 340, 212, 468,
+ 52, 308, 180, 436, 116, 372, 244, 500,
+ 12, 268, 140, 396, 76, 332, 204, 460,
+ 44, 300, 172, 428, 108, 364, 236, 492,
+ 28, 284, 156, 412, 92, 348, 220, 476,
+ 60, 316, 188, 444, 124, 380, 252, 508,
+ 2, 258, 130, 386, 66, 322, 194, 450,
+ 34, 290, 162, 418, 98, 354, 226, 482,
+ 18, 274, 146, 402, 82, 338, 210, 466,
+ 50, 306, 178, 434, 114, 370, 242, 498,
+ 10, 266, 138, 394, 74, 330, 202, 458,
+ 42, 298, 170, 426, 106, 362, 234, 490,
+ 26, 282, 154, 410, 90, 346, 218, 474,
+ 58, 314, 186, 442, 122, 378, 250, 506,
+ 6, 262, 134, 390, 70, 326, 198, 454,
+ 38, 294, 166, 422, 102, 358, 230, 486,
+ 22, 278, 150, 406, 86, 342, 214, 470,
+ 54, 310, 182, 438, 118, 374, 246, 502,
+ 14, 270, 142, 398, 78, 334, 206, 462,
+ 46, 302, 174, 430, 110, 366, 238, 494,
+ 30, 286, 158, 414, 94, 350, 222, 478,
+ 62, 318, 190, 446, 126, 382, 254, 510,
+ 1, 257, 129, 385, 65, 321, 193, 449,
+ 33, 289, 161, 417, 97, 353, 225, 481,
+ 17, 273, 145, 401, 81, 337, 209, 465,
+ 49, 305, 177, 433, 113, 369, 241, 497,
+ 9, 265, 137, 393, 73, 329, 201, 457,
+ 41, 297, 169, 425, 105, 361, 233, 489,
+ 25, 281, 153, 409, 89, 345, 217, 473,
+ 57, 313, 185, 441, 121, 377, 249, 505,
+ 5, 261, 133, 389, 69, 325, 197, 453,
+ 37, 293, 165, 421, 101, 357, 229, 485,
+ 21, 277, 149, 405, 85, 341, 213, 469,
+ 53, 309, 181, 437, 117, 373, 245, 501,
+ 13, 269, 141, 397, 77, 333, 205, 461,
+ 45, 301, 173, 429, 109, 365, 237, 493,
+ 29, 285, 157, 413, 93, 349, 221, 477,
+ 61, 317, 189, 445, 125, 381, 253, 509,
+ 3, 259, 131, 387, 67, 323, 195, 451,
+ 35, 291, 163, 419, 99, 355, 227, 483,
+ 19, 275, 147, 403, 83, 339, 211, 467,
+ 51, 307, 179, 435, 115, 371, 243, 499,
+ 11, 267, 139, 395, 75, 331, 203, 459,
+ 43, 299, 171, 427, 107, 363, 235, 491,
+ 27, 283, 155, 411, 91, 347, 219, 475,
+ 59, 315, 187, 443, 123, 379, 251, 507,
+ 7, 1031, 519, 1543, 263, 1287, 775, 1799,
+ 135, 1159, 647, 1671, 391, 1415, 903, 1927,
+ 71, 1095, 583, 1607, 327, 1351, 839, 1863,
+ 199, 1223, 711, 1735, 455, 1479, 967, 1991,
+ 39, 1063, 551, 1575, 295, 1319, 807, 1831,
+ 167, 1191, 679, 1703, 423, 1447, 935, 1959,
+ 103, 1127, 615, 1639, 359, 1383, 871, 1895,
+ 231, 1255, 743, 1767, 487, 1511, 999, 2023,
+ 23, 1047, 535, 1559, 279, 1303, 791, 1815,
+ 151, 1175, 663, 1687, 407, 1431, 919, 1943,
+ 87, 1111, 599, 1623, 343, 1367, 855, 1879,
+ 215, 1239, 727, 1751, 471, 1495, 983, 2007,
+ 55, 1079, 567, 1591, 311, 1335, 823, 1847,
+ 183, 1207, 695, 1719, 439, 1463, 951, 1975,
+ 119, 1143, 631, 1655, 375, 1399, 887, 1911,
+ 247, 1271, 759, 1783, 503, 1527, 1015, 2039,
+ 15, 1039, 527, 1551, 271, 1295, 783, 1807,
+ 143, 1167, 655, 1679, 399, 1423, 911, 1935,
+ 79, 1103, 591, 1615, 335, 1359, 847, 1871,
+ 207, 1231, 719, 1743, 463, 1487, 975, 1999,
+ 47, 1071, 559, 1583, 303, 1327, 815, 1839,
+ 175, 1199, 687, 1711, 431, 1455, 943, 1967,
+ 111, 1135, 623, 1647, 367, 1391, 879, 1903,
+ 239, 1263, 751, 1775, 495, 1519, 1007, 2031,
+ 31, 1055, 543, 1567, 287, 1311, 799, 1823,
+ 159, 1183, 671, 1695, 415, 1439, 927, 1951,
+ 95, 1119, 607, 1631, 351, 1375, 863, 1887,
+ 223, 1247, 735, 1759, 479, 1503, 991, 2015,
+ 63, 1087, 575, 1599, 319, 1343, 831, 1855,
+ 191, 1215, 703, 1727, 447, 1471, 959, 1983,
+ 127, 1151, 639, 1663, 383, 1407, 895, 1919,
+ 255, 1279, 767, 1791, 511, 1535, 1023, 2047,
+};
+
+static BROTLI_INLINE void StoreStaticCommandHuffmanTree(
+ size_t* storage_ix, uint8_t* storage) {
+ BrotliWriteBits(
+ 56, BROTLI_MAKE_UINT64_T(0x926244U, 0x16307003U), storage_ix, storage);
+ BrotliWriteBits(3, 0x00000000U, storage_ix, storage);
+}
+
+static const uint16_t kStaticDistanceCodeBits[64] = {
+ 0, 32, 16, 48, 8, 40, 24, 56, 4, 36, 20, 52, 12, 44, 28, 60,
+ 2, 34, 18, 50, 10, 42, 26, 58, 6, 38, 22, 54, 14, 46, 30, 62,
+ 1, 33, 17, 49, 9, 41, 25, 57, 5, 37, 21, 53, 13, 45, 29, 61,
+ 3, 35, 19, 51, 11, 43, 27, 59, 7, 39, 23, 55, 15, 47, 31, 63,
+};
+
+static BROTLI_INLINE void StoreStaticDistanceHuffmanTree(
+ size_t* storage_ix, uint8_t* storage) {
+ BrotliWriteBits(28, 0x0369DC03u, storage_ix, storage);
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_ENTROPY_ENCODE_STATIC_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/fast_log.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/fast_log.h
new file mode 100644
index 000000000..cade1235a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/fast_log.h
@@ -0,0 +1,147 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Utilities for fast computation of logarithms. */
+
+#ifndef BROTLI_ENC_FAST_LOG_H_
+#define BROTLI_ENC_FAST_LOG_H_
+
+#include <math.h>
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+static BROTLI_INLINE uint32_t Log2FloorNonZero(size_t n) {
+ /* TODO: generalize and move to platform.h */
+#if BROTLI_GNUC_HAS_BUILTIN(__builtin_clz, 3, 4, 0) || \
+ BROTLI_INTEL_VERSION_CHECK(16, 0, 0)
+ return 31u ^ (uint32_t)__builtin_clz((uint32_t)n);
+#else
+ uint32_t result = 0;
+ while (n >>= 1) result++;
+ return result;
+#endif
+}
+
+/* A lookup table for small values of log2(int) to be used in entropy
+ computation.
+
+ ", ".join(["%.16ff" % x for x in [0.0]+[log2(x) for x in range(1, 256)]]) */
+static const float kLog2Table[] = {
+ 0.0000000000000000f, 0.0000000000000000f, 1.0000000000000000f,
+ 1.5849625007211563f, 2.0000000000000000f, 2.3219280948873622f,
+ 2.5849625007211561f, 2.8073549220576042f, 3.0000000000000000f,
+ 3.1699250014423126f, 3.3219280948873626f, 3.4594316186372978f,
+ 3.5849625007211565f, 3.7004397181410922f, 3.8073549220576037f,
+ 3.9068905956085187f, 4.0000000000000000f, 4.0874628412503400f,
+ 4.1699250014423122f, 4.2479275134435852f, 4.3219280948873626f,
+ 4.3923174227787607f, 4.4594316186372973f, 4.5235619560570131f,
+ 4.5849625007211570f, 4.6438561897747244f, 4.7004397181410926f,
+ 4.7548875021634691f, 4.8073549220576037f, 4.8579809951275728f,
+ 4.9068905956085187f, 4.9541963103868758f, 5.0000000000000000f,
+ 5.0443941193584534f, 5.0874628412503400f, 5.1292830169449664f,
+ 5.1699250014423122f, 5.2094533656289501f, 5.2479275134435852f,
+ 5.2854022188622487f, 5.3219280948873626f, 5.3575520046180838f,
+ 5.3923174227787607f, 5.4262647547020979f, 5.4594316186372973f,
+ 5.4918530963296748f, 5.5235619560570131f, 5.5545888516776376f,
+ 5.5849625007211570f, 5.6147098441152083f, 5.6438561897747244f,
+ 5.6724253419714961f, 5.7004397181410926f, 5.7279204545631996f,
+ 5.7548875021634691f, 5.7813597135246599f, 5.8073549220576046f,
+ 5.8328900141647422f, 5.8579809951275719f, 5.8826430493618416f,
+ 5.9068905956085187f, 5.9307373375628867f, 5.9541963103868758f,
+ 5.9772799234999168f, 6.0000000000000000f, 6.0223678130284544f,
+ 6.0443941193584534f, 6.0660891904577721f, 6.0874628412503400f,
+ 6.1085244567781700f, 6.1292830169449672f, 6.1497471195046822f,
+ 6.1699250014423122f, 6.1898245588800176f, 6.2094533656289510f,
+ 6.2288186904958804f, 6.2479275134435861f, 6.2667865406949019f,
+ 6.2854022188622487f, 6.3037807481771031f, 6.3219280948873617f,
+ 6.3398500028846252f, 6.3575520046180847f, 6.3750394313469254f,
+ 6.3923174227787598f, 6.4093909361377026f, 6.4262647547020979f,
+ 6.4429434958487288f, 6.4594316186372982f, 6.4757334309663976f,
+ 6.4918530963296748f, 6.5077946401986964f, 6.5235619560570131f,
+ 6.5391588111080319f, 6.5545888516776376f, 6.5698556083309478f,
+ 6.5849625007211561f, 6.5999128421871278f, 6.6147098441152092f,
+ 6.6293566200796095f, 6.6438561897747253f, 6.6582114827517955f,
+ 6.6724253419714952f, 6.6865005271832185f, 6.7004397181410917f,
+ 6.7142455176661224f, 6.7279204545631988f, 6.7414669864011465f,
+ 6.7548875021634691f, 6.7681843247769260f, 6.7813597135246599f,
+ 6.7944158663501062f, 6.8073549220576037f, 6.8201789624151887f,
+ 6.8328900141647422f, 6.8454900509443757f, 6.8579809951275719f,
+ 6.8703647195834048f, 6.8826430493618416f, 6.8948177633079437f,
+ 6.9068905956085187f, 6.9188632372745955f, 6.9307373375628867f,
+ 6.9425145053392399f, 6.9541963103868758f, 6.9657842846620879f,
+ 6.9772799234999168f, 6.9886846867721664f, 7.0000000000000000f,
+ 7.0112272554232540f, 7.0223678130284544f, 7.0334230015374501f,
+ 7.0443941193584534f, 7.0552824355011898f, 7.0660891904577721f,
+ 7.0768155970508317f, 7.0874628412503400f, 7.0980320829605272f,
+ 7.1085244567781700f, 7.1189410727235076f, 7.1292830169449664f,
+ 7.1395513523987937f, 7.1497471195046822f, 7.1598713367783891f,
+ 7.1699250014423130f, 7.1799090900149345f, 7.1898245588800176f,
+ 7.1996723448363644f, 7.2094533656289492f, 7.2191685204621621f,
+ 7.2288186904958804f, 7.2384047393250794f, 7.2479275134435861f,
+ 7.2573878426926521f, 7.2667865406949019f, 7.2761244052742384f,
+ 7.2854022188622487f, 7.2946207488916270f, 7.3037807481771031f,
+ 7.3128829552843557f, 7.3219280948873617f, 7.3309168781146177f,
+ 7.3398500028846243f, 7.3487281542310781f, 7.3575520046180847f,
+ 7.3663222142458151f, 7.3750394313469254f, 7.3837042924740528f,
+ 7.3923174227787607f, 7.4008794362821844f, 7.4093909361377026f,
+ 7.4178525148858991f, 7.4262647547020979f, 7.4346282276367255f,
+ 7.4429434958487288f, 7.4512111118323299f, 7.4594316186372973f,
+ 7.4676055500829976f, 7.4757334309663976f, 7.4838157772642564f,
+ 7.4918530963296748f, 7.4998458870832057f, 7.5077946401986964f,
+ 7.5156998382840436f, 7.5235619560570131f, 7.5313814605163119f,
+ 7.5391588111080319f, 7.5468944598876373f, 7.5545888516776376f,
+ 7.5622424242210728f, 7.5698556083309478f, 7.5774288280357487f,
+ 7.5849625007211561f, 7.5924570372680806f, 7.5999128421871278f,
+ 7.6073303137496113f, 7.6147098441152075f, 7.6220518194563764f,
+ 7.6293566200796095f, 7.6366246205436488f, 7.6438561897747244f,
+ 7.6510516911789290f, 7.6582114827517955f, 7.6653359171851765f,
+ 7.6724253419714952f, 7.6794800995054464f, 7.6865005271832185f,
+ 7.6934869574993252f, 7.7004397181410926f, 7.7073591320808825f,
+ 7.7142455176661224f, 7.7210991887071856f, 7.7279204545631996f,
+ 7.7347096202258392f, 7.7414669864011465f, 7.7481928495894596f,
+ 7.7548875021634691f, 7.7615512324444795f, 7.7681843247769260f,
+ 7.7747870596011737f, 7.7813597135246608f, 7.7879025593914317f,
+ 7.7944158663501062f, 7.8008998999203047f, 7.8073549220576037f,
+ 7.8137811912170374f, 7.8201789624151887f, 7.8265484872909159f,
+ 7.8328900141647422f, 7.8392037880969445f, 7.8454900509443757f,
+ 7.8517490414160571f, 7.8579809951275719f, 7.8641861446542798f,
+ 7.8703647195834048f, 7.8765169465650002f, 7.8826430493618425f,
+ 7.8887432488982601f, 7.8948177633079446f, 7.9008668079807496f,
+ 7.9068905956085187f, 7.9128893362299619f, 7.9188632372745955f,
+ 7.9248125036057813f, 7.9307373375628867f, 7.9366379390025719f,
+ 7.9425145053392399f, 7.9483672315846778f, 7.9541963103868758f,
+ 7.9600019320680806f, 7.9657842846620870f, 7.9715435539507720f,
+ 7.9772799234999168f, 7.9829935746943104f, 7.9886846867721664f,
+ 7.9943534368588578f
+};
+
+#define LOG_2_INV 1.4426950408889634
+
+/* Faster logarithm for small integers, with the property of log2(0) == 0. */
+static BROTLI_INLINE double FastLog2(size_t v) {
+ if (v < sizeof(kLog2Table) / sizeof(kLog2Table[0])) {
+ return kLog2Table[v];
+ }
+#if (defined(_MSC_VER) && _MSC_VER <= 1700) || \
+ (defined(__ANDROID_API__) && __ANDROID_API__ < 18)
+ /* Visual Studio 2012 and Android API levels < 18 do not have the log2()
+ * function defined, so we use log() and a multiplication instead. */
+ return log((double)v) * LOG_2_INV;
+#else
+ return log2((double)v);
+#endif
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_FAST_LOG_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/find_match_length.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/find_match_length.h
new file mode 100644
index 000000000..bc428cffd
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/find_match_length.h
@@ -0,0 +1,80 @@
+/* Copyright 2010 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Function to find maximal matching prefixes of strings. */
+
+#ifndef BROTLI_ENC_FIND_MATCH_LENGTH_H_
+#define BROTLI_ENC_FIND_MATCH_LENGTH_H_
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* Separate implementation for little-endian 64-bit targets, for speed. */
+#if defined(__GNUC__) && defined(_LP64) && defined(BROTLI_LITTLE_ENDIAN)
+
+static BROTLI_INLINE size_t FindMatchLengthWithLimit(const uint8_t* s1,
+ const uint8_t* s2,
+ size_t limit) {
+ size_t matched = 0;
+ size_t limit2 = (limit >> 3) + 1; /* + 1 is for pre-decrement in while */
+ while (BROTLI_PREDICT_TRUE(--limit2)) {
+ if (BROTLI_PREDICT_FALSE(BROTLI_UNALIGNED_LOAD64LE(s2) ==
+ BROTLI_UNALIGNED_LOAD64LE(s1 + matched))) {
+ s2 += 8;
+ matched += 8;
+ } else {
+ uint64_t x = BROTLI_UNALIGNED_LOAD64LE(s2) ^
+ BROTLI_UNALIGNED_LOAD64LE(s1 + matched);
+ size_t matching_bits = (size_t)__builtin_ctzll(x);
+ matched += matching_bits >> 3;
+ return matched;
+ }
+ }
+ limit = (limit & 7) + 1; /* + 1 is for pre-decrement in while */
+ while (--limit) {
+ if (BROTLI_PREDICT_TRUE(s1[matched] == *s2)) {
+ ++s2;
+ ++matched;
+ } else {
+ return matched;
+ }
+ }
+ return matched;
+}
+#else
+static BROTLI_INLINE size_t FindMatchLengthWithLimit(const uint8_t* s1,
+ const uint8_t* s2,
+ size_t limit) {
+ size_t matched = 0;
+ const uint8_t* s2_limit = s2 + limit;
+ const uint8_t* s2_ptr = s2;
+ /* Find out how long the match is. We loop over the data 32 bits at a
+ time until we find a 32-bit block that doesn't match; then we find
+ the first non-matching bit and use that to calculate the total
+ length of the match. */
+ while (s2_ptr <= s2_limit - 4 &&
+ BrotliUnalignedRead32(s2_ptr) ==
+ BrotliUnalignedRead32(s1 + matched)) {
+ s2_ptr += 4;
+ matched += 4;
+ }
+ while ((s2_ptr < s2_limit) && (s1[matched] == *s2_ptr)) {
+ ++s2_ptr;
+ ++matched;
+ }
+ return matched;
+}
+#endif
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_FIND_MATCH_LENGTH_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash.h
new file mode 100644
index 000000000..6362f69b9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash.h
@@ -0,0 +1,488 @@
+/* Copyright 2010 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* A (forgetful) hash table to the data seen by the compressor, to
+ help create backward references to previous data. */
+
+#ifndef BROTLI_ENC_HASH_H_
+#define BROTLI_ENC_HASH_H_
+
+#include <string.h> /* memcmp, memset */
+
+#include "../common/constants.h"
+#include "../common/dictionary.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./encoder_dict.h"
+#include "./fast_log.h"
+#include "./find_match_length.h"
+#include "./memory.h"
+#include "./quality.h"
+#include "./static_dict.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+typedef struct {
+ /* Dynamically allocated area; first member for quickest access. */
+ void* extra;
+
+ size_t dict_num_lookups;
+ size_t dict_num_matches;
+
+ BrotliHasherParams params;
+
+ /* False if hasher needs to be "prepared" before use. */
+ BROTLI_BOOL is_prepared_;
+} HasherCommon;
+
+#define score_t size_t
+
+static const uint32_t kCutoffTransformsCount = 10;
+/* 0, 12, 27, 23, 42, 63, 56, 48, 59, 64 */
+/* 0+0, 4+8, 8+19, 12+11, 16+26, 20+43, 24+32, 28+20, 32+27, 36+28 */
+static const uint64_t kCutoffTransforms =
+ BROTLI_MAKE_UINT64_T(0x071B520A, 0xDA2D3200);
+
+typedef struct HasherSearchResult {
+ size_t len;
+ size_t distance;
+ score_t score;
+ int len_code_delta; /* == len_code - len */
+} HasherSearchResult;
+
+/* kHashMul32 multiplier has these properties:
+ * The multiplier must be odd. Otherwise we may lose the highest bit.
+ * No long streaks of ones or zeros.
+ * There is no effort to ensure that it is a prime, the oddity is enough
+ for this use.
+ * The number has been tuned heuristically against compression benchmarks. */
+static const uint32_t kHashMul32 = 0x1E35A7BD;
+static const uint64_t kHashMul64 = BROTLI_MAKE_UINT64_T(0x1E35A7BD, 0x1E35A7BD);
+static const uint64_t kHashMul64Long =
+ BROTLI_MAKE_UINT64_T(0x1FE35A7Bu, 0xD3579BD3u);
+
+static BROTLI_INLINE uint32_t Hash14(const uint8_t* data) {
+ uint32_t h = BROTLI_UNALIGNED_LOAD32LE(data) * kHashMul32;
+ /* The higher bits contain more mixture from the multiplication,
+ so we take our results from there. */
+ return h >> (32 - 14);
+}
+
+static BROTLI_INLINE void PrepareDistanceCache(
+ int* BROTLI_RESTRICT distance_cache, const int num_distances) {
+ if (num_distances > 4) {
+ int last_distance = distance_cache[0];
+ distance_cache[4] = last_distance - 1;
+ distance_cache[5] = last_distance + 1;
+ distance_cache[6] = last_distance - 2;
+ distance_cache[7] = last_distance + 2;
+ distance_cache[8] = last_distance - 3;
+ distance_cache[9] = last_distance + 3;
+ if (num_distances > 10) {
+ int next_last_distance = distance_cache[1];
+ distance_cache[10] = next_last_distance - 1;
+ distance_cache[11] = next_last_distance + 1;
+ distance_cache[12] = next_last_distance - 2;
+ distance_cache[13] = next_last_distance + 2;
+ distance_cache[14] = next_last_distance - 3;
+ distance_cache[15] = next_last_distance + 3;
+ }
+ }
+}
+
+#define BROTLI_LITERAL_BYTE_SCORE 135
+#define BROTLI_DISTANCE_BIT_PENALTY 30
+/* Score must be positive after applying maximal penalty. */
+#define BROTLI_SCORE_BASE (BROTLI_DISTANCE_BIT_PENALTY * 8 * sizeof(size_t))
+
+/* Usually, we always choose the longest backward reference. This function
+ allows for the exception of that rule.
+
+ If we choose a backward reference that is further away, it will
+ usually be coded with more bits. We approximate this by assuming
+ log2(distance). If the distance can be expressed in terms of the
+ last four distances, we use some heuristic constants to estimate
+ the bits cost. For the first up to four literals we use the bit
+ cost of the literals from the literal cost model, after that we
+ use the average bit cost of the cost model.
+
+ This function is used to sometimes discard a longer backward reference
+ when it is not much longer and the bit cost for encoding it is more
+ than the saved literals.
+
+ backward_reference_offset MUST be positive. */
+static BROTLI_INLINE score_t BackwardReferenceScore(
+ size_t copy_length, size_t backward_reference_offset) {
+ return BROTLI_SCORE_BASE + BROTLI_LITERAL_BYTE_SCORE * (score_t)copy_length -
+ BROTLI_DISTANCE_BIT_PENALTY * Log2FloorNonZero(backward_reference_offset);
+}
+
+static BROTLI_INLINE score_t BackwardReferenceScoreUsingLastDistance(
+ size_t copy_length) {
+ return BROTLI_LITERAL_BYTE_SCORE * (score_t)copy_length +
+ BROTLI_SCORE_BASE + 15;
+}
+
+static BROTLI_INLINE score_t BackwardReferencePenaltyUsingLastDistance(
+ size_t distance_short_code) {
+ return (score_t)39 + ((0x1CA10 >> (distance_short_code & 0xE)) & 0xE);
+}
+
+static BROTLI_INLINE BROTLI_BOOL TestStaticDictionaryItem(
+ const BrotliEncoderDictionary* dictionary, size_t len, size_t word_idx,
+ const uint8_t* data, size_t max_length, size_t max_backward,
+ size_t max_distance, HasherSearchResult* out) {
+ size_t offset;
+ size_t matchlen;
+ size_t backward;
+ score_t score;
+ offset = dictionary->words->offsets_by_length[len] + len * word_idx;
+ if (len > max_length) {
+ return BROTLI_FALSE;
+ }
+
+ matchlen =
+ FindMatchLengthWithLimit(data, &dictionary->words->data[offset], len);
+ if (matchlen + dictionary->cutoffTransformsCount <= len || matchlen == 0) {
+ return BROTLI_FALSE;
+ }
+ {
+ size_t cut = len - matchlen;
+ size_t transform_id = (cut << 2) +
+ (size_t)((dictionary->cutoffTransforms >> (cut * 6)) & 0x3F);
+ backward = max_backward + 1 + word_idx +
+ (transform_id << dictionary->words->size_bits_by_length[len]);
+ }
+ if (backward > max_distance) {
+ return BROTLI_FALSE;
+ }
+ score = BackwardReferenceScore(matchlen, backward);
+ if (score < out->score) {
+ return BROTLI_FALSE;
+ }
+ out->len = matchlen;
+ out->len_code_delta = (int)len - (int)matchlen;
+ out->distance = backward;
+ out->score = score;
+ return BROTLI_TRUE;
+}
+
+static BROTLI_INLINE void SearchInStaticDictionary(
+ const BrotliEncoderDictionary* dictionary,
+ HasherCommon* common, const uint8_t* data, size_t max_length,
+ size_t max_backward, size_t max_distance,
+ HasherSearchResult* out, BROTLI_BOOL shallow) {
+ size_t key;
+ size_t i;
+ if (common->dict_num_matches < (common->dict_num_lookups >> 7)) {
+ return;
+ }
+ key = Hash14(data) << 1;
+ for (i = 0; i < (shallow ? 1u : 2u); ++i, ++key) {
+ common->dict_num_lookups++;
+ if (dictionary->hash_table_lengths[key] != 0) {
+ BROTLI_BOOL item_matches = TestStaticDictionaryItem(
+ dictionary, dictionary->hash_table_lengths[key],
+ dictionary->hash_table_words[key], data,
+ max_length, max_backward, max_distance, out);
+ if (item_matches) {
+ common->dict_num_matches++;
+ }
+ }
+ }
+}
+
+typedef struct BackwardMatch {
+ uint32_t distance;
+ uint32_t length_and_code;
+} BackwardMatch;
+
+static BROTLI_INLINE void InitBackwardMatch(BackwardMatch* self,
+ size_t dist, size_t len) {
+ self->distance = (uint32_t)dist;
+ self->length_and_code = (uint32_t)(len << 5);
+}
+
+static BROTLI_INLINE void InitDictionaryBackwardMatch(BackwardMatch* self,
+ size_t dist, size_t len, size_t len_code) {
+ self->distance = (uint32_t)dist;
+ self->length_and_code =
+ (uint32_t)((len << 5) | (len == len_code ? 0 : len_code));
+}
+
+static BROTLI_INLINE size_t BackwardMatchLength(const BackwardMatch* self) {
+ return self->length_and_code >> 5;
+}
+
+static BROTLI_INLINE size_t BackwardMatchLengthCode(const BackwardMatch* self) {
+ size_t code = self->length_and_code & 31;
+ return code ? code : BackwardMatchLength(self);
+}
+
+#define EXPAND_CAT(a, b) CAT(a, b)
+#define CAT(a, b) a ## b
+#define FN(X) EXPAND_CAT(X, HASHER())
+
+#define HASHER() H10
+#define BUCKET_BITS 17
+#define MAX_TREE_SEARCH_DEPTH 64
+#define MAX_TREE_COMP_LENGTH 128
+#include "./hash_to_binary_tree_inc.h" /* NOLINT(build/include) */
+#undef MAX_TREE_SEARCH_DEPTH
+#undef MAX_TREE_COMP_LENGTH
+#undef BUCKET_BITS
+#undef HASHER
+/* MAX_NUM_MATCHES == 64 + MAX_TREE_SEARCH_DEPTH */
+#define MAX_NUM_MATCHES_H10 128
+
+/* For BUCKET_SWEEP_BITS == 0, enabling the dictionary lookup makes compression
+ a little faster (0.5% - 1%) and it compresses 0.15% better on small text
+ and HTML inputs. */
+
+#define HASHER() H2
+#define BUCKET_BITS 16
+#define BUCKET_SWEEP_BITS 0
+#define HASH_LEN 5
+#define USE_DICTIONARY 1
+#include "./hash_longest_match_quickly_inc.h" /* NOLINT(build/include) */
+#undef BUCKET_SWEEP_BITS
+#undef USE_DICTIONARY
+#undef HASHER
+
+#define HASHER() H3
+#define BUCKET_SWEEP_BITS 1
+#define USE_DICTIONARY 0
+#include "./hash_longest_match_quickly_inc.h" /* NOLINT(build/include) */
+#undef USE_DICTIONARY
+#undef BUCKET_SWEEP_BITS
+#undef BUCKET_BITS
+#undef HASHER
+
+#define HASHER() H4
+#define BUCKET_BITS 17
+#define BUCKET_SWEEP_BITS 2
+#define USE_DICTIONARY 1
+#include "./hash_longest_match_quickly_inc.h" /* NOLINT(build/include) */
+#undef USE_DICTIONARY
+#undef HASH_LEN
+#undef BUCKET_SWEEP_BITS
+#undef BUCKET_BITS
+#undef HASHER
+
+#define HASHER() H5
+#include "./hash_longest_match_inc.h" /* NOLINT(build/include) */
+#undef HASHER
+
+#define HASHER() H6
+#include "./hash_longest_match64_inc.h" /* NOLINT(build/include) */
+#undef HASHER
+
+#define BUCKET_BITS 15
+
+#define NUM_LAST_DISTANCES_TO_CHECK 4
+#define NUM_BANKS 1
+#define BANK_BITS 16
+#define HASHER() H40
+#include "./hash_forgetful_chain_inc.h" /* NOLINT(build/include) */
+#undef HASHER
+#undef NUM_LAST_DISTANCES_TO_CHECK
+
+#define NUM_LAST_DISTANCES_TO_CHECK 10
+#define HASHER() H41
+#include "./hash_forgetful_chain_inc.h" /* NOLINT(build/include) */
+#undef HASHER
+#undef NUM_LAST_DISTANCES_TO_CHECK
+#undef NUM_BANKS
+#undef BANK_BITS
+
+#define NUM_LAST_DISTANCES_TO_CHECK 16
+#define NUM_BANKS 512
+#define BANK_BITS 9
+#define HASHER() H42
+#include "./hash_forgetful_chain_inc.h" /* NOLINT(build/include) */
+#undef HASHER
+#undef NUM_LAST_DISTANCES_TO_CHECK
+#undef NUM_BANKS
+#undef BANK_BITS
+
+#undef BUCKET_BITS
+
+#define HASHER() H54
+#define BUCKET_BITS 20
+#define BUCKET_SWEEP_BITS 2
+#define HASH_LEN 7
+#define USE_DICTIONARY 0
+#include "./hash_longest_match_quickly_inc.h" /* NOLINT(build/include) */
+#undef USE_DICTIONARY
+#undef HASH_LEN
+#undef BUCKET_SWEEP_BITS
+#undef BUCKET_BITS
+#undef HASHER
+
+/* fast large window hashers */
+
+#define HASHER() HROLLING_FAST
+#define CHUNKLEN 32
+#define JUMP 4
+#define NUMBUCKETS 16777216
+#define MASK ((NUMBUCKETS * 64) - 1)
+#include "./hash_rolling_inc.h" /* NOLINT(build/include) */
+#undef JUMP
+#undef HASHER
+
+
+#define HASHER() HROLLING
+#define JUMP 1
+#include "./hash_rolling_inc.h" /* NOLINT(build/include) */
+#undef MASK
+#undef NUMBUCKETS
+#undef JUMP
+#undef CHUNKLEN
+#undef HASHER
+
+#define HASHER() H35
+#define HASHER_A H3
+#define HASHER_B HROLLING_FAST
+#include "./hash_composite_inc.h" /* NOLINT(build/include) */
+#undef HASHER_A
+#undef HASHER_B
+#undef HASHER
+
+#define HASHER() H55
+#define HASHER_A H54
+#define HASHER_B HROLLING_FAST
+#include "./hash_composite_inc.h" /* NOLINT(build/include) */
+#undef HASHER_A
+#undef HASHER_B
+#undef HASHER
+
+#define HASHER() H65
+#define HASHER_A H6
+#define HASHER_B HROLLING
+#include "./hash_composite_inc.h" /* NOLINT(build/include) */
+#undef HASHER_A
+#undef HASHER_B
+#undef HASHER
+
+#undef FN
+#undef CAT
+#undef EXPAND_CAT
+
+#define FOR_SIMPLE_HASHERS(H) H(2) H(3) H(4) H(5) H(6) H(40) H(41) H(42) H(54)
+#define FOR_COMPOSITE_HASHERS(H) H(35) H(55) H(65)
+#define FOR_GENERIC_HASHERS(H) FOR_SIMPLE_HASHERS(H) FOR_COMPOSITE_HASHERS(H)
+#define FOR_ALL_HASHERS(H) FOR_GENERIC_HASHERS(H) H(10)
+
+typedef struct {
+ HasherCommon common;
+
+ union {
+#define MEMBER_(N) \
+ H ## N _H ## N;
+ FOR_ALL_HASHERS(MEMBER_)
+#undef MEMBER_
+ } privat;
+} Hasher;
+
+/* MUST be invoked before any other method. */
+static BROTLI_INLINE void HasherInit(Hasher* hasher) {
+ hasher->common.extra = NULL;
+}
+
+static BROTLI_INLINE void DestroyHasher(MemoryManager* m, Hasher* hasher) {
+ if (hasher->common.extra == NULL) return;
+ BROTLI_FREE(m, hasher->common.extra);
+}
+
+static BROTLI_INLINE void HasherReset(Hasher* hasher) {
+ hasher->common.is_prepared_ = BROTLI_FALSE;
+}
+
+static BROTLI_INLINE size_t HasherSize(const BrotliEncoderParams* params,
+ BROTLI_BOOL one_shot, const size_t input_size) {
+ switch (params->hasher.type) {
+#define SIZE_(N) \
+ case N: \
+ return HashMemAllocInBytesH ## N(params, one_shot, input_size);
+ FOR_ALL_HASHERS(SIZE_)
+#undef SIZE_
+ default:
+ break;
+ }
+ return 0; /* Default case. */
+}
+
+static BROTLI_INLINE void HasherSetup(MemoryManager* m, Hasher* hasher,
+ BrotliEncoderParams* params, const uint8_t* data, size_t position,
+ size_t input_size, BROTLI_BOOL is_last) {
+ BROTLI_BOOL one_shot = (position == 0 && is_last);
+ if (hasher->common.extra == NULL) {
+ size_t alloc_size;
+ ChooseHasher(params, &params->hasher);
+ alloc_size = HasherSize(params, one_shot, input_size);
+ hasher->common.extra = BROTLI_ALLOC(m, uint8_t, alloc_size);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(hasher->common.extra)) return;
+ hasher->common.params = params->hasher;
+ switch (hasher->common.params.type) {
+#define INITIALIZE_(N) \
+ case N: \
+ InitializeH ## N(&hasher->common, \
+ &hasher->privat._H ## N, params); \
+ break;
+ FOR_ALL_HASHERS(INITIALIZE_);
+#undef INITIALIZE_
+ default:
+ break;
+ }
+ HasherReset(hasher);
+ }
+
+ if (!hasher->common.is_prepared_) {
+ switch (hasher->common.params.type) {
+#define PREPARE_(N) \
+ case N: \
+ PrepareH ## N( \
+ &hasher->privat._H ## N, \
+ one_shot, input_size, data); \
+ break;
+ FOR_ALL_HASHERS(PREPARE_)
+#undef PREPARE_
+ default: break;
+ }
+ if (position == 0) {
+ hasher->common.dict_num_lookups = 0;
+ hasher->common.dict_num_matches = 0;
+ }
+ hasher->common.is_prepared_ = BROTLI_TRUE;
+ }
+}
+
+static BROTLI_INLINE void InitOrStitchToPreviousBlock(
+ MemoryManager* m, Hasher* hasher, const uint8_t* data, size_t mask,
+ BrotliEncoderParams* params, size_t position, size_t input_size,
+ BROTLI_BOOL is_last) {
+ HasherSetup(m, hasher, params, data, position, input_size, is_last);
+ if (BROTLI_IS_OOM(m)) return;
+ switch (hasher->common.params.type) {
+#define INIT_(N) \
+ case N: \
+ StitchToPreviousBlockH ## N( \
+ &hasher->privat._H ## N, \
+ input_size, position, data, mask); \
+ break;
+ FOR_ALL_HASHERS(INIT_)
+#undef INIT_
+ default: break;
+ }
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_HASH_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_composite_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_composite_inc.h
new file mode 100755
index 000000000..cba156c0e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_composite_inc.h
@@ -0,0 +1,125 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2018 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: FN, HASHER_A, HASHER_B */
+
+/* Composite hasher: This hasher allows to combine two other hashers, HASHER_A
+ and HASHER_B. */
+
+#define HashComposite HASHER()
+
+#define FN_A(X) EXPAND_CAT(X, HASHER_A)
+#define FN_B(X) EXPAND_CAT(X, HASHER_B)
+
+static BROTLI_INLINE size_t FN(HashTypeLength)(void) {
+ size_t a = FN_A(HashTypeLength)();
+ size_t b = FN_B(HashTypeLength)();
+ return a > b ? a : b;
+}
+
+static BROTLI_INLINE size_t FN(StoreLookahead)(void) {
+ size_t a = FN_A(StoreLookahead)();
+ size_t b = FN_B(StoreLookahead)();
+ return a > b ? a : b;
+}
+
+typedef struct HashComposite {
+ HASHER_A ha;
+ HASHER_B hb;
+ HasherCommon hb_common;
+
+ /* Shortcuts. */
+ void* extra;
+ HasherCommon* common;
+
+ BROTLI_BOOL fresh;
+ const BrotliEncoderParams* params;
+} HashComposite;
+
+static void FN(Initialize)(HasherCommon* common,
+ HashComposite* BROTLI_RESTRICT self, const BrotliEncoderParams* params) {
+ self->common = common;
+ self->extra = common->extra;
+
+ self->hb_common = *self->common;
+ self->fresh = BROTLI_TRUE;
+ self->params = params;
+ /* TODO: Initialize of the hashers is defered to Prepare (and params
+ remembered here) because we don't get the one_shot and input_size params
+ here that are needed to know the memory size of them. Instead provide
+ those params to all hashers FN(Initialize) */
+}
+
+static void FN(Prepare)(
+ HashComposite* BROTLI_RESTRICT self, BROTLI_BOOL one_shot,
+ size_t input_size, const uint8_t* BROTLI_RESTRICT data) {
+ if (self->fresh) {
+ self->fresh = BROTLI_FALSE;
+ self->hb_common.extra = (uint8_t*)self->extra +
+ FN_A(HashMemAllocInBytes)(self->params, one_shot, input_size);
+
+ FN_A(Initialize)(self->common, &self->ha, self->params);
+ FN_B(Initialize)(&self->hb_common, &self->hb, self->params);
+ }
+ FN_A(Prepare)(&self->ha, one_shot, input_size, data);
+ FN_B(Prepare)(&self->hb, one_shot, input_size, data);
+}
+
+static BROTLI_INLINE size_t FN(HashMemAllocInBytes)(
+ const BrotliEncoderParams* params, BROTLI_BOOL one_shot,
+ size_t input_size) {
+ return FN_A(HashMemAllocInBytes)(params, one_shot, input_size) +
+ FN_B(HashMemAllocInBytes)(params, one_shot, input_size);
+}
+
+static BROTLI_INLINE void FN(Store)(HashComposite* BROTLI_RESTRICT self,
+ const uint8_t* BROTLI_RESTRICT data, const size_t mask, const size_t ix) {
+ FN_A(Store)(&self->ha, data, mask, ix);
+ FN_B(Store)(&self->hb, data, mask, ix);
+}
+
+static BROTLI_INLINE void FN(StoreRange)(
+ HashComposite* BROTLI_RESTRICT self, const uint8_t* BROTLI_RESTRICT data,
+ const size_t mask, const size_t ix_start,
+ const size_t ix_end) {
+ FN_A(StoreRange)(&self->ha, data, mask, ix_start, ix_end);
+ FN_B(StoreRange)(&self->hb, data, mask, ix_start, ix_end);
+}
+
+static BROTLI_INLINE void FN(StitchToPreviousBlock)(
+ HashComposite* BROTLI_RESTRICT self,
+ size_t num_bytes, size_t position, const uint8_t* ringbuffer,
+ size_t ring_buffer_mask) {
+ FN_A(StitchToPreviousBlock)(&self->ha, num_bytes, position,
+ ringbuffer, ring_buffer_mask);
+ FN_B(StitchToPreviousBlock)(&self->hb, num_bytes, position,
+ ringbuffer, ring_buffer_mask);
+}
+
+static BROTLI_INLINE void FN(PrepareDistanceCache)(
+ HashComposite* BROTLI_RESTRICT self, int* BROTLI_RESTRICT distance_cache) {
+ FN_A(PrepareDistanceCache)(&self->ha, distance_cache);
+ FN_B(PrepareDistanceCache)(&self->hb, distance_cache);
+}
+
+static BROTLI_INLINE void FN(FindLongestMatch)(
+ HashComposite* BROTLI_RESTRICT self,
+ const BrotliEncoderDictionary* dictionary,
+ const uint8_t* BROTLI_RESTRICT data, const size_t ring_buffer_mask,
+ const int* BROTLI_RESTRICT distance_cache, const size_t cur_ix,
+ const size_t max_length, const size_t max_backward,
+ const size_t dictionary_distance, const size_t max_distance,
+ HasherSearchResult* BROTLI_RESTRICT out) {
+ FN_A(FindLongestMatch)(&self->ha, dictionary, data, ring_buffer_mask,
+ distance_cache, cur_ix, max_length, max_backward, dictionary_distance,
+ max_distance, out);
+ FN_B(FindLongestMatch)(&self->hb, dictionary, data, ring_buffer_mask,
+ distance_cache, cur_ix, max_length, max_backward, dictionary_distance,
+ max_distance, out);
+}
+
+#undef HashComposite
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_forgetful_chain_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_forgetful_chain_inc.h
new file mode 100644
index 000000000..bfae6ba6a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_forgetful_chain_inc.h
@@ -0,0 +1,293 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: FN, BUCKET_BITS, NUM_BANKS, BANK_BITS,
+ NUM_LAST_DISTANCES_TO_CHECK */
+
+/* A (forgetful) hash table to the data seen by the compressor, to
+ help create backward references to previous data.
+
+ Hashes are stored in chains which are bucketed to groups. Group of chains
+ share a storage "bank". When more than "bank size" chain nodes are added,
+ oldest nodes are replaced; this way several chains may share a tail. */
+
+#define HashForgetfulChain HASHER()
+
+#define BANK_SIZE (1 << BANK_BITS)
+
+/* Number of hash buckets. */
+#define BUCKET_SIZE (1 << BUCKET_BITS)
+
+#define CAPPED_CHAINS 0
+
+static BROTLI_INLINE size_t FN(HashTypeLength)(void) { return 4; }
+static BROTLI_INLINE size_t FN(StoreLookahead)(void) { return 4; }
+
+/* HashBytes is the function that chooses the bucket to place the address in.*/
+static BROTLI_INLINE size_t FN(HashBytes)(const uint8_t* BROTLI_RESTRICT data) {
+ const uint32_t h = BROTLI_UNALIGNED_LOAD32LE(data) * kHashMul32;
+ /* The higher bits contain more mixture from the multiplication,
+ so we take our results from there. */
+ return h >> (32 - BUCKET_BITS);
+}
+
+typedef struct FN(Slot) {
+ uint16_t delta;
+ uint16_t next;
+} FN(Slot);
+
+typedef struct FN(Bank) {
+ FN(Slot) slots[BANK_SIZE];
+} FN(Bank);
+
+typedef struct HashForgetfulChain {
+ uint16_t free_slot_idx[NUM_BANKS]; /* Up to 1KiB. Move to dynamic? */
+ size_t max_hops;
+
+ /* Shortcuts. */
+ void* extra;
+ HasherCommon* common;
+
+ /* --- Dynamic size members --- */
+
+ /* uint32_t addr[BUCKET_SIZE]; */
+
+ /* uint16_t head[BUCKET_SIZE]; */
+
+ /* Truncated hash used for quick rejection of "distance cache" candidates. */
+ /* uint8_t tiny_hash[65536];*/
+
+ /* FN(Bank) banks[NUM_BANKS]; */
+} HashForgetfulChain;
+
+static uint32_t* FN(Addr)(void* extra) {
+ return (uint32_t*)extra;
+}
+
+static uint16_t* FN(Head)(void* extra) {
+ return (uint16_t*)(&FN(Addr)(extra)[BUCKET_SIZE]);
+}
+
+static uint8_t* FN(TinyHash)(void* extra) {
+ return (uint8_t*)(&FN(Head)(extra)[BUCKET_SIZE]);
+}
+
+static FN(Bank)* FN(Banks)(void* extra) {
+ return (FN(Bank)*)(&FN(TinyHash)(extra)[65536]);
+}
+
+static void FN(Initialize)(
+ HasherCommon* common, HashForgetfulChain* BROTLI_RESTRICT self,
+ const BrotliEncoderParams* params) {
+ self->common = common;
+ self->extra = common->extra;
+
+ self->max_hops = (params->quality > 6 ? 7u : 8u) << (params->quality - 4);
+}
+
+static void FN(Prepare)(
+ HashForgetfulChain* BROTLI_RESTRICT self, BROTLI_BOOL one_shot,
+ size_t input_size, const uint8_t* BROTLI_RESTRICT data) {
+ uint32_t* BROTLI_RESTRICT addr = FN(Addr)(self->extra);
+ uint16_t* BROTLI_RESTRICT head = FN(Head)(self->extra);
+ uint8_t* BROTLI_RESTRICT tiny_hash = FN(TinyHash)(self->extra);
+ /* Partial preparation is 100 times slower (per socket). */
+ size_t partial_prepare_threshold = BUCKET_SIZE >> 6;
+ if (one_shot && input_size <= partial_prepare_threshold) {
+ size_t i;
+ for (i = 0; i < input_size; ++i) {
+ size_t bucket = FN(HashBytes)(&data[i]);
+ /* See InitEmpty comment. */
+ addr[bucket] = 0xCCCCCCCC;
+ head[bucket] = 0xCCCC;
+ }
+ } else {
+ /* Fill |addr| array with 0xCCCCCCCC value. Because of wrapping, position
+ processed by hasher never reaches 3GB + 64M; this makes all new chains
+ to be terminated after the first node. */
+ memset(addr, 0xCC, sizeof(uint32_t) * BUCKET_SIZE);
+ memset(head, 0, sizeof(uint16_t) * BUCKET_SIZE);
+ }
+ memset(tiny_hash, 0, sizeof(uint8_t) * 65536);
+ memset(self->free_slot_idx, 0, sizeof(self->free_slot_idx));
+}
+
+static BROTLI_INLINE size_t FN(HashMemAllocInBytes)(
+ const BrotliEncoderParams* params, BROTLI_BOOL one_shot,
+ size_t input_size) {
+ BROTLI_UNUSED(params);
+ BROTLI_UNUSED(one_shot);
+ BROTLI_UNUSED(input_size);
+ return sizeof(uint32_t) * BUCKET_SIZE + sizeof(uint16_t) * BUCKET_SIZE +
+ sizeof(uint8_t) * 65536 + sizeof(FN(Bank)) * NUM_BANKS;
+}
+
+/* Look at 4 bytes at &data[ix & mask]. Compute a hash from these, and prepend
+ node to corresponding chain; also update tiny_hash for current position. */
+static BROTLI_INLINE void FN(Store)(HashForgetfulChain* BROTLI_RESTRICT self,
+ const uint8_t* BROTLI_RESTRICT data, const size_t mask, const size_t ix) {
+ uint32_t* BROTLI_RESTRICT addr = FN(Addr)(self->extra);
+ uint16_t* BROTLI_RESTRICT head = FN(Head)(self->extra);
+ uint8_t* BROTLI_RESTRICT tiny_hash = FN(TinyHash)(self->extra);
+ FN(Bank)* BROTLI_RESTRICT banks = FN(Banks)(self->extra);
+ const size_t key = FN(HashBytes)(&data[ix & mask]);
+ const size_t bank = key & (NUM_BANKS - 1);
+ const size_t idx = self->free_slot_idx[bank]++ & (BANK_SIZE - 1);
+ size_t delta = ix - addr[key];
+ tiny_hash[(uint16_t)ix] = (uint8_t)key;
+ if (delta > 0xFFFF) delta = CAPPED_CHAINS ? 0 : 0xFFFF;
+ banks[bank].slots[idx].delta = (uint16_t)delta;
+ banks[bank].slots[idx].next = head[key];
+ addr[key] = (uint32_t)ix;
+ head[key] = (uint16_t)idx;
+}
+
+static BROTLI_INLINE void FN(StoreRange)(
+ HashForgetfulChain* BROTLI_RESTRICT self,
+ const uint8_t* BROTLI_RESTRICT data, const size_t mask,
+ const size_t ix_start, const size_t ix_end) {
+ size_t i;
+ for (i = ix_start; i < ix_end; ++i) {
+ FN(Store)(self, data, mask, i);
+ }
+}
+
+static BROTLI_INLINE void FN(StitchToPreviousBlock)(
+ HashForgetfulChain* BROTLI_RESTRICT self,
+ size_t num_bytes, size_t position, const uint8_t* ringbuffer,
+ size_t ring_buffer_mask) {
+ if (num_bytes >= FN(HashTypeLength)() - 1 && position >= 3) {
+ /* Prepare the hashes for three last bytes of the last write.
+ These could not be calculated before, since they require knowledge
+ of both the previous and the current block. */
+ FN(Store)(self, ringbuffer, ring_buffer_mask, position - 3);
+ FN(Store)(self, ringbuffer, ring_buffer_mask, position - 2);
+ FN(Store)(self, ringbuffer, ring_buffer_mask, position - 1);
+ }
+}
+
+static BROTLI_INLINE void FN(PrepareDistanceCache)(
+ HashForgetfulChain* BROTLI_RESTRICT self,
+ int* BROTLI_RESTRICT distance_cache) {
+ BROTLI_UNUSED(self);
+ PrepareDistanceCache(distance_cache, NUM_LAST_DISTANCES_TO_CHECK);
+}
+
+/* Find a longest backward match of &data[cur_ix] up to the length of
+ max_length and stores the position cur_ix in the hash table.
+
+ REQUIRES: FN(PrepareDistanceCache) must be invoked for current distance cache
+ values; if this method is invoked repeatedly with the same distance
+ cache values, it is enough to invoke FN(PrepareDistanceCache) once.
+
+ Does not look for matches longer than max_length.
+ Does not look for matches further away than max_backward.
+ Writes the best match into |out|.
+ |out|->score is updated only if a better match is found. */
+static BROTLI_INLINE void FN(FindLongestMatch)(
+ HashForgetfulChain* BROTLI_RESTRICT self,
+ const BrotliEncoderDictionary* dictionary,
+ const uint8_t* BROTLI_RESTRICT data, const size_t ring_buffer_mask,
+ const int* BROTLI_RESTRICT distance_cache,
+ const size_t cur_ix, const size_t max_length, const size_t max_backward,
+ const size_t dictionary_distance, const size_t max_distance,
+ HasherSearchResult* BROTLI_RESTRICT out) {
+ uint32_t* BROTLI_RESTRICT addr = FN(Addr)(self->extra);
+ uint16_t* BROTLI_RESTRICT head = FN(Head)(self->extra);
+ uint8_t* BROTLI_RESTRICT tiny_hashes = FN(TinyHash)(self->extra);
+ FN(Bank)* BROTLI_RESTRICT banks = FN(Banks)(self->extra);
+ const size_t cur_ix_masked = cur_ix & ring_buffer_mask;
+ /* Don't accept a short copy from far away. */
+ score_t min_score = out->score;
+ score_t best_score = out->score;
+ size_t best_len = out->len;
+ size_t i;
+ const size_t key = FN(HashBytes)(&data[cur_ix_masked]);
+ const uint8_t tiny_hash = (uint8_t)(key);
+ out->len = 0;
+ out->len_code_delta = 0;
+ /* Try last distance first. */
+ for (i = 0; i < NUM_LAST_DISTANCES_TO_CHECK; ++i) {
+ const size_t backward = (size_t)distance_cache[i];
+ size_t prev_ix = (cur_ix - backward);
+ /* For distance code 0 we want to consider 2-byte matches. */
+ if (i > 0 && tiny_hashes[(uint16_t)prev_ix] != tiny_hash) continue;
+ if (prev_ix >= cur_ix || backward > max_backward) {
+ continue;
+ }
+ prev_ix &= ring_buffer_mask;
+ {
+ const size_t len = FindMatchLengthWithLimit(&data[prev_ix],
+ &data[cur_ix_masked],
+ max_length);
+ if (len >= 2) {
+ score_t score = BackwardReferenceScoreUsingLastDistance(len);
+ if (best_score < score) {
+ if (i != 0) score -= BackwardReferencePenaltyUsingLastDistance(i);
+ if (best_score < score) {
+ best_score = score;
+ best_len = len;
+ out->len = best_len;
+ out->distance = backward;
+ out->score = best_score;
+ }
+ }
+ }
+ }
+ }
+ {
+ const size_t bank = key & (NUM_BANKS - 1);
+ size_t backward = 0;
+ size_t hops = self->max_hops;
+ size_t delta = cur_ix - addr[key];
+ size_t slot = head[key];
+ while (hops--) {
+ size_t prev_ix;
+ size_t last = slot;
+ backward += delta;
+ if (backward > max_backward || (CAPPED_CHAINS && !delta)) break;
+ prev_ix = (cur_ix - backward) & ring_buffer_mask;
+ slot = banks[bank].slots[last].next;
+ delta = banks[bank].slots[last].delta;
+ if (cur_ix_masked + best_len > ring_buffer_mask ||
+ prev_ix + best_len > ring_buffer_mask ||
+ data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
+ continue;
+ }
+ {
+ const size_t len = FindMatchLengthWithLimit(&data[prev_ix],
+ &data[cur_ix_masked],
+ max_length);
+ if (len >= 4) {
+ /* Comparing for >= 3 does not change the semantics, but just saves
+ for a few unnecessary binary logarithms in backward reference
+ score, since we are not interested in such short matches. */
+ score_t score = BackwardReferenceScore(len, backward);
+ if (best_score < score) {
+ best_score = score;
+ best_len = len;
+ out->len = best_len;
+ out->distance = backward;
+ out->score = best_score;
+ }
+ }
+ }
+ }
+ FN(Store)(self, data, ring_buffer_mask, cur_ix);
+ }
+ if (out->score == min_score) {
+ SearchInStaticDictionary(dictionary,
+ self->common, &data[cur_ix_masked], max_length, dictionary_distance,
+ max_distance, out, BROTLI_FALSE);
+ }
+}
+
+#undef BANK_SIZE
+#undef BUCKET_SIZE
+#undef CAPPED_CHAINS
+
+#undef HashForgetfulChain
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_longest_match64_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_longest_match64_inc.h
new file mode 100644
index 000000000..bdee7e41b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_longest_match64_inc.h
@@ -0,0 +1,267 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2010 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: FN */
+
+/* A (forgetful) hash table to the data seen by the compressor, to
+ help create backward references to previous data.
+
+ This is a hash map of fixed size (bucket_size_) to a ring buffer of
+ fixed size (block_size_). The ring buffer contains the last block_size_
+ index positions of the given hash key in the compressed data. */
+
+#define HashLongestMatch HASHER()
+
+static BROTLI_INLINE size_t FN(HashTypeLength)(void) { return 8; }
+static BROTLI_INLINE size_t FN(StoreLookahead)(void) { return 8; }
+
+/* HashBytes is the function that chooses the bucket to place the address in. */
+static BROTLI_INLINE uint32_t FN(HashBytes)(const uint8_t* BROTLI_RESTRICT data,
+ const uint64_t mask,
+ const int shift) {
+ const uint64_t h = (BROTLI_UNALIGNED_LOAD64LE(data) & mask) * kHashMul64Long;
+ /* The higher bits contain more mixture from the multiplication,
+ so we take our results from there. */
+ return (uint32_t)(h >> shift);
+}
+
+typedef struct HashLongestMatch {
+ /* Number of hash buckets. */
+ size_t bucket_size_;
+ /* Only block_size_ newest backward references are kept,
+ and the older are forgotten. */
+ size_t block_size_;
+ /* Left-shift for computing hash bucket index from hash value. */
+ int hash_shift_;
+ /* Mask for selecting the next 4-8 bytes of input */
+ uint64_t hash_mask_;
+ /* Mask for accessing entries in a block (in a ring-buffer manner). */
+ uint32_t block_mask_;
+
+ int block_bits_;
+ int num_last_distances_to_check_;
+
+ /* Shortcuts. */
+ HasherCommon* common_;
+
+ /* --- Dynamic size members --- */
+
+ /* Number of entries in a particular bucket. */
+ uint16_t* num_; /* uint16_t[bucket_size]; */
+
+ /* Buckets containing block_size_ of backward references. */
+ uint32_t* buckets_; /* uint32_t[bucket_size * block_size]; */
+} HashLongestMatch;
+
+static void FN(Initialize)(
+ HasherCommon* common, HashLongestMatch* BROTLI_RESTRICT self,
+ const BrotliEncoderParams* params) {
+ self->common_ = common;
+
+ BROTLI_UNUSED(params);
+ self->hash_shift_ = 64 - common->params.bucket_bits;
+ self->hash_mask_ = (~((uint64_t)0U)) >> (64 - 8 * common->params.hash_len);
+ self->bucket_size_ = (size_t)1 << common->params.bucket_bits;
+ self->block_bits_ = common->params.block_bits;
+ self->block_size_ = (size_t)1 << common->params.block_bits;
+ self->block_mask_ = (uint32_t)(self->block_size_ - 1);
+ self->num_last_distances_to_check_ =
+ common->params.num_last_distances_to_check;
+ self->num_ = (uint16_t*)common->extra;
+ self->buckets_ = (uint32_t*)&self->num_[self->bucket_size_];
+}
+
+static void FN(Prepare)(
+ HashLongestMatch* BROTLI_RESTRICT self, BROTLI_BOOL one_shot,
+ size_t input_size, const uint8_t* BROTLI_RESTRICT data) {
+ uint16_t* BROTLI_RESTRICT num = self->num_;
+ /* Partial preparation is 100 times slower (per socket). */
+ size_t partial_prepare_threshold = self->bucket_size_ >> 6;
+ if (one_shot && input_size <= partial_prepare_threshold) {
+ size_t i;
+ for (i = 0; i < input_size; ++i) {
+ const uint32_t key = FN(HashBytes)(&data[i], self->hash_mask_,
+ self->hash_shift_);
+ num[key] = 0;
+ }
+ } else {
+ memset(num, 0, self->bucket_size_ * sizeof(num[0]));
+ }
+}
+
+static BROTLI_INLINE size_t FN(HashMemAllocInBytes)(
+ const BrotliEncoderParams* params, BROTLI_BOOL one_shot,
+ size_t input_size) {
+ size_t bucket_size = (size_t)1 << params->hasher.bucket_bits;
+ size_t block_size = (size_t)1 << params->hasher.block_bits;
+ BROTLI_UNUSED(one_shot);
+ BROTLI_UNUSED(input_size);
+ return sizeof(uint16_t) * bucket_size +
+ sizeof(uint32_t) * bucket_size * block_size;
+}
+
+/* Look at 4 bytes at &data[ix & mask].
+ Compute a hash from these, and store the value of ix at that position. */
+static BROTLI_INLINE void FN(Store)(
+ HashLongestMatch* BROTLI_RESTRICT self, const uint8_t* BROTLI_RESTRICT data,
+ const size_t mask, const size_t ix) {
+ uint16_t* BROTLI_RESTRICT num = self->num_;
+ uint32_t* BROTLI_RESTRICT buckets = self->buckets_;
+ const uint32_t key = FN(HashBytes)(&data[ix & mask], self->hash_mask_,
+ self->hash_shift_);
+ const size_t minor_ix = num[key] & self->block_mask_;
+ const size_t offset = minor_ix + (key << self->block_bits_);
+ buckets[offset] = (uint32_t)ix;
+ ++num[key];
+}
+
+static BROTLI_INLINE void FN(StoreRange)(HashLongestMatch* BROTLI_RESTRICT self,
+ const uint8_t* BROTLI_RESTRICT data, const size_t mask,
+ const size_t ix_start, const size_t ix_end) {
+ size_t i;
+ for (i = ix_start; i < ix_end; ++i) {
+ FN(Store)(self, data, mask, i);
+ }
+}
+
+static BROTLI_INLINE void FN(StitchToPreviousBlock)(
+ HashLongestMatch* BROTLI_RESTRICT self,
+ size_t num_bytes, size_t position, const uint8_t* ringbuffer,
+ size_t ringbuffer_mask) {
+ if (num_bytes >= FN(HashTypeLength)() - 1 && position >= 3) {
+ /* Prepare the hashes for three last bytes of the last write.
+ These could not be calculated before, since they require knowledge
+ of both the previous and the current block. */
+ FN(Store)(self, ringbuffer, ringbuffer_mask, position - 3);
+ FN(Store)(self, ringbuffer, ringbuffer_mask, position - 2);
+ FN(Store)(self, ringbuffer, ringbuffer_mask, position - 1);
+ }
+}
+
+static BROTLI_INLINE void FN(PrepareDistanceCache)(
+ HashLongestMatch* BROTLI_RESTRICT self,
+ int* BROTLI_RESTRICT distance_cache) {
+ PrepareDistanceCache(distance_cache, self->num_last_distances_to_check_);
+}
+
+/* Find a longest backward match of &data[cur_ix] up to the length of
+ max_length and stores the position cur_ix in the hash table.
+
+ REQUIRES: FN(PrepareDistanceCache) must be invoked for current distance cache
+ values; if this method is invoked repeatedly with the same distance
+ cache values, it is enough to invoke FN(PrepareDistanceCache) once.
+
+ Does not look for matches longer than max_length.
+ Does not look for matches further away than max_backward.
+ Writes the best match into |out|.
+ |out|->score is updated only if a better match is found. */
+static BROTLI_INLINE void FN(FindLongestMatch)(
+ HashLongestMatch* BROTLI_RESTRICT self,
+ const BrotliEncoderDictionary* dictionary,
+ const uint8_t* BROTLI_RESTRICT data, const size_t ring_buffer_mask,
+ const int* BROTLI_RESTRICT distance_cache, const size_t cur_ix,
+ const size_t max_length, const size_t max_backward,
+ const size_t dictionary_distance, const size_t max_distance,
+ HasherSearchResult* BROTLI_RESTRICT out) {
+ uint16_t* BROTLI_RESTRICT num = self->num_;
+ uint32_t* BROTLI_RESTRICT buckets = self->buckets_;
+ const size_t cur_ix_masked = cur_ix & ring_buffer_mask;
+ /* Don't accept a short copy from far away. */
+ score_t min_score = out->score;
+ score_t best_score = out->score;
+ size_t best_len = out->len;
+ size_t i;
+ out->len = 0;
+ out->len_code_delta = 0;
+ /* Try last distance first. */
+ for (i = 0; i < (size_t)self->num_last_distances_to_check_; ++i) {
+ const size_t backward = (size_t)distance_cache[i];
+ size_t prev_ix = (size_t)(cur_ix - backward);
+ if (prev_ix >= cur_ix) {
+ continue;
+ }
+ if (BROTLI_PREDICT_FALSE(backward > max_backward)) {
+ continue;
+ }
+ prev_ix &= ring_buffer_mask;
+
+ if (cur_ix_masked + best_len > ring_buffer_mask ||
+ prev_ix + best_len > ring_buffer_mask ||
+ data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
+ continue;
+ }
+ {
+ const size_t len = FindMatchLengthWithLimit(&data[prev_ix],
+ &data[cur_ix_masked],
+ max_length);
+ if (len >= 3 || (len == 2 && i < 2)) {
+ /* Comparing for >= 2 does not change the semantics, but just saves for
+ a few unnecessary binary logarithms in backward reference score,
+ since we are not interested in such short matches. */
+ score_t score = BackwardReferenceScoreUsingLastDistance(len);
+ if (best_score < score) {
+ if (i != 0) score -= BackwardReferencePenaltyUsingLastDistance(i);
+ if (best_score < score) {
+ best_score = score;
+ best_len = len;
+ out->len = best_len;
+ out->distance = backward;
+ out->score = best_score;
+ }
+ }
+ }
+ }
+ }
+ {
+ const uint32_t key = FN(HashBytes)(
+ &data[cur_ix_masked], self->hash_mask_, self->hash_shift_);
+ uint32_t* BROTLI_RESTRICT bucket = &buckets[key << self->block_bits_];
+ const size_t down =
+ (num[key] > self->block_size_) ?
+ (num[key] - self->block_size_) : 0u;
+ for (i = num[key]; i > down;) {
+ size_t prev_ix = bucket[--i & self->block_mask_];
+ const size_t backward = cur_ix - prev_ix;
+ if (BROTLI_PREDICT_FALSE(backward > max_backward)) {
+ break;
+ }
+ prev_ix &= ring_buffer_mask;
+ if (cur_ix_masked + best_len > ring_buffer_mask ||
+ prev_ix + best_len > ring_buffer_mask ||
+ data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
+ continue;
+ }
+ {
+ const size_t len = FindMatchLengthWithLimit(&data[prev_ix],
+ &data[cur_ix_masked],
+ max_length);
+ if (len >= 4) {
+ /* Comparing for >= 3 does not change the semantics, but just saves
+ for a few unnecessary binary logarithms in backward reference
+ score, since we are not interested in such short matches. */
+ score_t score = BackwardReferenceScore(len, backward);
+ if (best_score < score) {
+ best_score = score;
+ best_len = len;
+ out->len = best_len;
+ out->distance = backward;
+ out->score = best_score;
+ }
+ }
+ }
+ }
+ bucket[num[key] & self->block_mask_] = (uint32_t)cur_ix;
+ ++num[key];
+ }
+ if (min_score == out->score) {
+ SearchInStaticDictionary(dictionary,
+ self->common_, &data[cur_ix_masked], max_length, dictionary_distance,
+ max_distance, out, BROTLI_FALSE);
+ }
+}
+
+#undef HashLongestMatch
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_longest_match_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_longest_match_inc.h
new file mode 100644
index 000000000..27f4463d7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_longest_match_inc.h
@@ -0,0 +1,262 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2010 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: FN */
+
+/* A (forgetful) hash table to the data seen by the compressor, to
+ help create backward references to previous data.
+
+ This is a hash map of fixed size (bucket_size_) to a ring buffer of
+ fixed size (block_size_). The ring buffer contains the last block_size_
+ index positions of the given hash key in the compressed data. */
+
+#define HashLongestMatch HASHER()
+
+static BROTLI_INLINE size_t FN(HashTypeLength)(void) { return 4; }
+static BROTLI_INLINE size_t FN(StoreLookahead)(void) { return 4; }
+
+/* HashBytes is the function that chooses the bucket to place the address in. */
+static uint32_t FN(HashBytes)(
+ const uint8_t* BROTLI_RESTRICT data, const int shift) {
+ uint32_t h = BROTLI_UNALIGNED_LOAD32LE(data) * kHashMul32;
+ /* The higher bits contain more mixture from the multiplication,
+ so we take our results from there. */
+ return (uint32_t)(h >> shift);
+}
+
+typedef struct HashLongestMatch {
+ /* Number of hash buckets. */
+ size_t bucket_size_;
+ /* Only block_size_ newest backward references are kept,
+ and the older are forgotten. */
+ size_t block_size_;
+ /* Left-shift for computing hash bucket index from hash value. */
+ int hash_shift_;
+ /* Mask for accessing entries in a block (in a ring-buffer manner). */
+ uint32_t block_mask_;
+
+ int block_bits_;
+ int num_last_distances_to_check_;
+
+ /* Shortcuts. */
+ HasherCommon* common_;
+
+ /* --- Dynamic size members --- */
+
+ /* Number of entries in a particular bucket. */
+ uint16_t* num_; /* uint16_t[bucket_size]; */
+
+ /* Buckets containing block_size_ of backward references. */
+ uint32_t* buckets_; /* uint32_t[bucket_size * block_size]; */
+} HashLongestMatch;
+
+static BROTLI_INLINE uint16_t* FN(Num)(void* extra) {
+ return (uint16_t*)extra;
+}
+
+static void FN(Initialize)(
+ HasherCommon* common, HashLongestMatch* BROTLI_RESTRICT self,
+ const BrotliEncoderParams* params) {
+ self->common_ = common;
+
+ BROTLI_UNUSED(params);
+ self->hash_shift_ = 32 - common->params.bucket_bits;
+ self->bucket_size_ = (size_t)1 << common->params.bucket_bits;
+ self->block_size_ = (size_t)1 << common->params.block_bits;
+ self->block_mask_ = (uint32_t)(self->block_size_ - 1);
+ self->num_ = (uint16_t*)common->extra;
+ self->buckets_ = (uint32_t*)(&self->num_[self->bucket_size_]);
+ self->block_bits_ = common->params.block_bits;
+ self->num_last_distances_to_check_ =
+ common->params.num_last_distances_to_check;
+}
+
+static void FN(Prepare)(
+ HashLongestMatch* BROTLI_RESTRICT self, BROTLI_BOOL one_shot,
+ size_t input_size, const uint8_t* BROTLI_RESTRICT data) {
+ uint16_t* BROTLI_RESTRICT num = self->num_;
+ /* Partial preparation is 100 times slower (per socket). */
+ size_t partial_prepare_threshold = self->bucket_size_ >> 6;
+ if (one_shot && input_size <= partial_prepare_threshold) {
+ size_t i;
+ for (i = 0; i < input_size; ++i) {
+ const uint32_t key = FN(HashBytes)(&data[i], self->hash_shift_);
+ num[key] = 0;
+ }
+ } else {
+ memset(num, 0, self->bucket_size_ * sizeof(num[0]));
+ }
+}
+
+static BROTLI_INLINE size_t FN(HashMemAllocInBytes)(
+ const BrotliEncoderParams* params, BROTLI_BOOL one_shot,
+ size_t input_size) {
+ size_t bucket_size = (size_t)1 << params->hasher.bucket_bits;
+ size_t block_size = (size_t)1 << params->hasher.block_bits;
+ BROTLI_UNUSED(one_shot);
+ BROTLI_UNUSED(input_size);
+ return sizeof(uint16_t) * bucket_size +
+ sizeof(uint32_t) * bucket_size * block_size;
+}
+
+/* Look at 4 bytes at &data[ix & mask].
+ Compute a hash from these, and store the value of ix at that position. */
+static BROTLI_INLINE void FN(Store)(
+ HashLongestMatch* BROTLI_RESTRICT self, const uint8_t* BROTLI_RESTRICT data,
+ const size_t mask, const size_t ix) {
+ const uint32_t key = FN(HashBytes)(&data[ix & mask], self->hash_shift_);
+ const size_t minor_ix = self->num_[key] & self->block_mask_;
+ const size_t offset = minor_ix + (key << self->block_bits_);
+ self->buckets_[offset] = (uint32_t)ix;
+ ++self->num_[key];
+}
+
+static BROTLI_INLINE void FN(StoreRange)(HashLongestMatch* BROTLI_RESTRICT self,
+ const uint8_t* BROTLI_RESTRICT data, const size_t mask,
+ const size_t ix_start, const size_t ix_end) {
+ size_t i;
+ for (i = ix_start; i < ix_end; ++i) {
+ FN(Store)(self, data, mask, i);
+ }
+}
+
+static BROTLI_INLINE void FN(StitchToPreviousBlock)(
+ HashLongestMatch* BROTLI_RESTRICT self,
+ size_t num_bytes, size_t position, const uint8_t* ringbuffer,
+ size_t ringbuffer_mask) {
+ if (num_bytes >= FN(HashTypeLength)() - 1 && position >= 3) {
+ /* Prepare the hashes for three last bytes of the last write.
+ These could not be calculated before, since they require knowledge
+ of both the previous and the current block. */
+ FN(Store)(self, ringbuffer, ringbuffer_mask, position - 3);
+ FN(Store)(self, ringbuffer, ringbuffer_mask, position - 2);
+ FN(Store)(self, ringbuffer, ringbuffer_mask, position - 1);
+ }
+}
+
+static BROTLI_INLINE void FN(PrepareDistanceCache)(
+ HashLongestMatch* BROTLI_RESTRICT self,
+ int* BROTLI_RESTRICT distance_cache) {
+ PrepareDistanceCache(distance_cache, self->num_last_distances_to_check_);
+}
+
+/* Find a longest backward match of &data[cur_ix] up to the length of
+ max_length and stores the position cur_ix in the hash table.
+
+ REQUIRES: FN(PrepareDistanceCache) must be invoked for current distance cache
+ values; if this method is invoked repeatedly with the same distance
+ cache values, it is enough to invoke FN(PrepareDistanceCache) once.
+
+ Does not look for matches longer than max_length.
+ Does not look for matches further away than max_backward.
+ Writes the best match into |out|.
+ |out|->score is updated only if a better match is found. */
+static BROTLI_INLINE void FN(FindLongestMatch)(
+ HashLongestMatch* BROTLI_RESTRICT self,
+ const BrotliEncoderDictionary* dictionary,
+ const uint8_t* BROTLI_RESTRICT data, const size_t ring_buffer_mask,
+ const int* BROTLI_RESTRICT distance_cache, const size_t cur_ix,
+ const size_t max_length, const size_t max_backward,
+ const size_t dictionary_distance, const size_t max_distance,
+ HasherSearchResult* BROTLI_RESTRICT out) {
+ uint16_t* BROTLI_RESTRICT num = self->num_;
+ uint32_t* BROTLI_RESTRICT buckets = self->buckets_;
+ const size_t cur_ix_masked = cur_ix & ring_buffer_mask;
+ /* Don't accept a short copy from far away. */
+ score_t min_score = out->score;
+ score_t best_score = out->score;
+ size_t best_len = out->len;
+ size_t i;
+ out->len = 0;
+ out->len_code_delta = 0;
+ /* Try last distance first. */
+ for (i = 0; i < (size_t)self->num_last_distances_to_check_; ++i) {
+ const size_t backward = (size_t)distance_cache[i];
+ size_t prev_ix = (size_t)(cur_ix - backward);
+ if (prev_ix >= cur_ix) {
+ continue;
+ }
+ if (BROTLI_PREDICT_FALSE(backward > max_backward)) {
+ continue;
+ }
+ prev_ix &= ring_buffer_mask;
+
+ if (cur_ix_masked + best_len > ring_buffer_mask ||
+ prev_ix + best_len > ring_buffer_mask ||
+ data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
+ continue;
+ }
+ {
+ const size_t len = FindMatchLengthWithLimit(&data[prev_ix],
+ &data[cur_ix_masked],
+ max_length);
+ if (len >= 3 || (len == 2 && i < 2)) {
+ /* Comparing for >= 2 does not change the semantics, but just saves for
+ a few unnecessary binary logarithms in backward reference score,
+ since we are not interested in such short matches. */
+ score_t score = BackwardReferenceScoreUsingLastDistance(len);
+ if (best_score < score) {
+ if (i != 0) score -= BackwardReferencePenaltyUsingLastDistance(i);
+ if (best_score < score) {
+ best_score = score;
+ best_len = len;
+ out->len = best_len;
+ out->distance = backward;
+ out->score = best_score;
+ }
+ }
+ }
+ }
+ }
+ {
+ const uint32_t key =
+ FN(HashBytes)(&data[cur_ix_masked], self->hash_shift_);
+ uint32_t* BROTLI_RESTRICT bucket = &buckets[key << self->block_bits_];
+ const size_t down =
+ (num[key] > self->block_size_) ? (num[key] - self->block_size_) : 0u;
+ for (i = num[key]; i > down;) {
+ size_t prev_ix = bucket[--i & self->block_mask_];
+ const size_t backward = cur_ix - prev_ix;
+ if (BROTLI_PREDICT_FALSE(backward > max_backward)) {
+ break;
+ }
+ prev_ix &= ring_buffer_mask;
+ if (cur_ix_masked + best_len > ring_buffer_mask ||
+ prev_ix + best_len > ring_buffer_mask ||
+ data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
+ continue;
+ }
+ {
+ const size_t len = FindMatchLengthWithLimit(&data[prev_ix],
+ &data[cur_ix_masked],
+ max_length);
+ if (len >= 4) {
+ /* Comparing for >= 3 does not change the semantics, but just saves
+ for a few unnecessary binary logarithms in backward reference
+ score, since we are not interested in such short matches. */
+ score_t score = BackwardReferenceScore(len, backward);
+ if (best_score < score) {
+ best_score = score;
+ best_len = len;
+ out->len = best_len;
+ out->distance = backward;
+ out->score = best_score;
+ }
+ }
+ }
+ }
+ bucket[num[key] & self->block_mask_] = (uint32_t)cur_ix;
+ ++num[key];
+ }
+ if (min_score == out->score) {
+ SearchInStaticDictionary(dictionary,
+ self->common_, &data[cur_ix_masked], max_length, dictionary_distance,
+ max_distance, out, BROTLI_FALSE);
+ }
+}
+
+#undef HashLongestMatch
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_longest_match_quickly_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_longest_match_quickly_inc.h
new file mode 100644
index 000000000..e5ba840ab
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_longest_match_quickly_inc.h
@@ -0,0 +1,266 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2010 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: FN, BUCKET_BITS, BUCKET_SWEEP_BITS, HASH_LEN,
+ USE_DICTIONARY
+ */
+
+#define HashLongestMatchQuickly HASHER()
+
+#define BUCKET_SIZE (1 << BUCKET_BITS)
+#define BUCKET_MASK (BUCKET_SIZE - 1)
+#define BUCKET_SWEEP (1 << BUCKET_SWEEP_BITS)
+#define BUCKET_SWEEP_MASK ((BUCKET_SWEEP - 1) << 3)
+
+static BROTLI_INLINE size_t FN(HashTypeLength)(void) { return 8; }
+static BROTLI_INLINE size_t FN(StoreLookahead)(void) { return 8; }
+
+/* HashBytes is the function that chooses the bucket to place
+ the address in. The HashLongestMatch and HashLongestMatchQuickly
+ classes have separate, different implementations of hashing. */
+static uint32_t FN(HashBytes)(const uint8_t* data) {
+ const uint64_t h = ((BROTLI_UNALIGNED_LOAD64LE(data) << (64 - 8 * HASH_LEN)) *
+ kHashMul64);
+ /* The higher bits contain more mixture from the multiplication,
+ so we take our results from there. */
+ return (uint32_t)(h >> (64 - BUCKET_BITS));
+}
+
+/* A (forgetful) hash table to the data seen by the compressor, to
+ help create backward references to previous data.
+
+ This is a hash map of fixed size (BUCKET_SIZE). */
+typedef struct HashLongestMatchQuickly {
+ /* Shortcuts. */
+ HasherCommon* common;
+
+ /* --- Dynamic size members --- */
+
+ uint32_t* buckets_; /* uint32_t[BUCKET_SIZE]; */
+} HashLongestMatchQuickly;
+
+static void FN(Initialize)(
+ HasherCommon* common, HashLongestMatchQuickly* BROTLI_RESTRICT self,
+ const BrotliEncoderParams* params) {
+ self->common = common;
+
+ BROTLI_UNUSED(params);
+ self->buckets_ = (uint32_t*)common->extra;
+}
+
+static void FN(Prepare)(
+ HashLongestMatchQuickly* BROTLI_RESTRICT self, BROTLI_BOOL one_shot,
+ size_t input_size, const uint8_t* BROTLI_RESTRICT data) {
+ uint32_t* BROTLI_RESTRICT buckets = self->buckets_;
+ /* Partial preparation is 100 times slower (per socket). */
+ size_t partial_prepare_threshold = BUCKET_SIZE >> 5;
+ if (one_shot && input_size <= partial_prepare_threshold) {
+ size_t i;
+ for (i = 0; i < input_size; ++i) {
+ const uint32_t key = FN(HashBytes)(&data[i]);
+ if (BUCKET_SWEEP == 1) {
+ buckets[key] = 0;
+ } else {
+ uint32_t j;
+ for (j = 0; j < BUCKET_SWEEP; ++j) {
+ buckets[(key + (j << 3)) & BUCKET_MASK] = 0;
+ }
+ }
+ }
+ } else {
+ /* It is not strictly necessary to fill this buffer here, but
+ not filling will make the results of the compression stochastic
+ (but correct). This is because random data would cause the
+ system to find accidentally good backward references here and there. */
+ memset(buckets, 0, sizeof(uint32_t) * BUCKET_SIZE);
+ }
+}
+
+static BROTLI_INLINE size_t FN(HashMemAllocInBytes)(
+ const BrotliEncoderParams* params, BROTLI_BOOL one_shot,
+ size_t input_size) {
+ BROTLI_UNUSED(params);
+ BROTLI_UNUSED(one_shot);
+ BROTLI_UNUSED(input_size);
+ return sizeof(uint32_t) * BUCKET_SIZE;
+}
+
+/* Look at 5 bytes at &data[ix & mask].
+ Compute a hash from these, and store the value somewhere within
+ [ix .. ix+3]. */
+static BROTLI_INLINE void FN(Store)(
+ HashLongestMatchQuickly* BROTLI_RESTRICT self,
+ const uint8_t* BROTLI_RESTRICT data, const size_t mask, const size_t ix) {
+ const uint32_t key = FN(HashBytes)(&data[ix & mask]);
+ if (BUCKET_SWEEP == 1) {
+ self->buckets_[key] = (uint32_t)ix;
+ } else {
+ /* Wiggle the value with the bucket sweep range. */
+ const uint32_t off = ix & BUCKET_SWEEP_MASK;
+ self->buckets_[(key + off) & BUCKET_MASK] = (uint32_t)ix;
+ }
+}
+
+static BROTLI_INLINE void FN(StoreRange)(
+ HashLongestMatchQuickly* BROTLI_RESTRICT self,
+ const uint8_t* BROTLI_RESTRICT data, const size_t mask,
+ const size_t ix_start, const size_t ix_end) {
+ size_t i;
+ for (i = ix_start; i < ix_end; ++i) {
+ FN(Store)(self, data, mask, i);
+ }
+}
+
+static BROTLI_INLINE void FN(StitchToPreviousBlock)(
+ HashLongestMatchQuickly* BROTLI_RESTRICT self,
+ size_t num_bytes, size_t position,
+ const uint8_t* ringbuffer, size_t ringbuffer_mask) {
+ if (num_bytes >= FN(HashTypeLength)() - 1 && position >= 3) {
+ /* Prepare the hashes for three last bytes of the last write.
+ These could not be calculated before, since they require knowledge
+ of both the previous and the current block. */
+ FN(Store)(self, ringbuffer, ringbuffer_mask, position - 3);
+ FN(Store)(self, ringbuffer, ringbuffer_mask, position - 2);
+ FN(Store)(self, ringbuffer, ringbuffer_mask, position - 1);
+ }
+}
+
+static BROTLI_INLINE void FN(PrepareDistanceCache)(
+ HashLongestMatchQuickly* BROTLI_RESTRICT self,
+ int* BROTLI_RESTRICT distance_cache) {
+ BROTLI_UNUSED(self);
+ BROTLI_UNUSED(distance_cache);
+}
+
+/* Find a longest backward match of &data[cur_ix & ring_buffer_mask]
+ up to the length of max_length and stores the position cur_ix in the
+ hash table.
+
+ Does not look for matches longer than max_length.
+ Does not look for matches further away than max_backward.
+ Writes the best match into |out|.
+ |out|->score is updated only if a better match is found. */
+static BROTLI_INLINE void FN(FindLongestMatch)(
+ HashLongestMatchQuickly* BROTLI_RESTRICT self,
+ const BrotliEncoderDictionary* dictionary,
+ const uint8_t* BROTLI_RESTRICT data,
+ const size_t ring_buffer_mask, const int* BROTLI_RESTRICT distance_cache,
+ const size_t cur_ix, const size_t max_length, const size_t max_backward,
+ const size_t dictionary_distance, const size_t max_distance,
+ HasherSearchResult* BROTLI_RESTRICT out) {
+ uint32_t* BROTLI_RESTRICT buckets = self->buckets_;
+ const size_t best_len_in = out->len;
+ const size_t cur_ix_masked = cur_ix & ring_buffer_mask;
+ int compare_char = data[cur_ix_masked + best_len_in];
+ size_t key = FN(HashBytes)(&data[cur_ix_masked]);
+ size_t key_out;
+ score_t min_score = out->score;
+ score_t best_score = out->score;
+ size_t best_len = best_len_in;
+ size_t cached_backward = (size_t)distance_cache[0];
+ size_t prev_ix = cur_ix - cached_backward;
+ out->len_code_delta = 0;
+ if (prev_ix < cur_ix) {
+ prev_ix &= (uint32_t)ring_buffer_mask;
+ if (compare_char == data[prev_ix + best_len]) {
+ const size_t len = FindMatchLengthWithLimit(
+ &data[prev_ix], &data[cur_ix_masked], max_length);
+ if (len >= 4) {
+ const score_t score = BackwardReferenceScoreUsingLastDistance(len);
+ if (best_score < score) {
+ out->len = len;
+ out->distance = cached_backward;
+ out->score = score;
+ if (BUCKET_SWEEP == 1) {
+ buckets[key] = (uint32_t)cur_ix;
+ return;
+ } else {
+ best_len = len;
+ best_score = score;
+ compare_char = data[cur_ix_masked + len];
+ }
+ }
+ }
+ }
+ }
+ if (BUCKET_SWEEP == 1) {
+ size_t backward;
+ size_t len;
+ /* Only one to look for, don't bother to prepare for a loop. */
+ prev_ix = buckets[key];
+ buckets[key] = (uint32_t)cur_ix;
+ backward = cur_ix - prev_ix;
+ prev_ix &= (uint32_t)ring_buffer_mask;
+ if (compare_char != data[prev_ix + best_len_in]) {
+ return;
+ }
+ if (BROTLI_PREDICT_FALSE(backward == 0 || backward > max_backward)) {
+ return;
+ }
+ len = FindMatchLengthWithLimit(&data[prev_ix],
+ &data[cur_ix_masked],
+ max_length);
+ if (len >= 4) {
+ const score_t score = BackwardReferenceScore(len, backward);
+ if (best_score < score) {
+ out->len = len;
+ out->distance = backward;
+ out->score = score;
+ return;
+ }
+ }
+ } else {
+ size_t keys[BUCKET_SWEEP];
+ size_t i;
+ for (i = 0; i < BUCKET_SWEEP; ++i) {
+ keys[i] = (key + (i << 3)) & BUCKET_MASK;
+ }
+ key_out = keys[(cur_ix & BUCKET_SWEEP_MASK) >> 3];
+ for (i = 0; i < BUCKET_SWEEP; ++i) {
+ size_t len;
+ size_t backward;
+ prev_ix = buckets[keys[i]];
+ backward = cur_ix - prev_ix;
+ prev_ix &= (uint32_t)ring_buffer_mask;
+ if (compare_char != data[prev_ix + best_len]) {
+ continue;
+ }
+ if (BROTLI_PREDICT_FALSE(backward == 0 || backward > max_backward)) {
+ continue;
+ }
+ len = FindMatchLengthWithLimit(&data[prev_ix],
+ &data[cur_ix_masked],
+ max_length);
+ if (len >= 4) {
+ const score_t score = BackwardReferenceScore(len, backward);
+ if (best_score < score) {
+ best_len = len;
+ out->len = len;
+ compare_char = data[cur_ix_masked + len];
+ best_score = score;
+ out->score = score;
+ out->distance = backward;
+ }
+ }
+ }
+ }
+ if (USE_DICTIONARY && min_score == out->score) {
+ SearchInStaticDictionary(dictionary,
+ self->common, &data[cur_ix_masked], max_length, dictionary_distance,
+ max_distance, out, BROTLI_TRUE);
+ }
+ if (BUCKET_SWEEP != 1) {
+ buckets[key_out] = (uint32_t)cur_ix;
+ }
+}
+
+#undef BUCKET_SWEEP_MASK
+#undef BUCKET_SWEEP
+#undef BUCKET_MASK
+#undef BUCKET_SIZE
+
+#undef HashLongestMatchQuickly
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_rolling_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_rolling_inc.h
new file mode 100755
index 000000000..586ae7385
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_rolling_inc.h
@@ -0,0 +1,212 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2018 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: FN, JUMP, NUMBUCKETS, MASK, CHUNKLEN */
+/* NUMBUCKETS / (MASK + 1) = probability of storing and using hash code. */
+/* JUMP = skip bytes for speedup */
+
+/* Rolling hash for long distance long string matches. Stores one position
+ per bucket, bucket key is computed over a long region. */
+
+#define HashRolling HASHER()
+
+static const uint32_t FN(kRollingHashMul32) = 69069;
+static const uint32_t FN(kInvalidPos) = 0xffffffff;
+
+/* This hasher uses a longer forward length, but returning a higher value here
+ will hurt compression by the main hasher when combined with a composite
+ hasher. The hasher tests for forward itself instead. */
+static BROTLI_INLINE size_t FN(HashTypeLength)(void) { return 4; }
+static BROTLI_INLINE size_t FN(StoreLookahead)(void) { return 4; }
+
+/* Computes a code from a single byte. A lookup table of 256 values could be
+ used, but simply adding 1 works about as good. */
+static uint32_t FN(HashByte)(uint8_t byte) {
+ return (uint32_t)byte + 1u;
+}
+
+static uint32_t FN(HashRollingFunctionInitial)(uint32_t state, uint8_t add,
+ uint32_t factor) {
+ return (uint32_t)(factor * state + FN(HashByte)(add));
+}
+
+static uint32_t FN(HashRollingFunction)(uint32_t state, uint8_t add,
+ uint8_t rem, uint32_t factor,
+ uint32_t factor_remove) {
+ return (uint32_t)(factor * state +
+ FN(HashByte)(add) - factor_remove * FN(HashByte)(rem));
+}
+
+typedef struct HashRolling {
+ uint32_t state;
+ uint32_t* table;
+ size_t next_ix;
+
+ uint32_t chunk_len;
+ uint32_t factor;
+ uint32_t factor_remove;
+} HashRolling;
+
+static void FN(Initialize)(
+ HasherCommon* common, HashRolling* BROTLI_RESTRICT self,
+ const BrotliEncoderParams* params) {
+ size_t i;
+ self->state = 0;
+ self->next_ix = 0;
+
+ self->factor = FN(kRollingHashMul32);
+
+ /* Compute the factor of the oldest byte to remove: factor**steps modulo
+ 0xffffffff (the multiplications rely on 32-bit overflow) */
+ self->factor_remove = 1;
+ for (i = 0; i < CHUNKLEN; i += JUMP) {
+ self->factor_remove *= self->factor;
+ }
+
+ self->table = (uint32_t*)common->extra;
+ for (i = 0; i < NUMBUCKETS; i++) {
+ self->table[i] = FN(kInvalidPos);
+ }
+
+ BROTLI_UNUSED(params);
+}
+
+static void FN(Prepare)(HashRolling* BROTLI_RESTRICT self, BROTLI_BOOL one_shot,
+ size_t input_size, const uint8_t* BROTLI_RESTRICT data) {
+ size_t i;
+ /* Too small size, cannot use this hasher. */
+ if (input_size < CHUNKLEN) return;
+ self->state = 0;
+ for (i = 0; i < CHUNKLEN; i += JUMP) {
+ self->state = FN(HashRollingFunctionInitial)(
+ self->state, data[i], self->factor);
+ }
+ BROTLI_UNUSED(one_shot);
+}
+
+static BROTLI_INLINE size_t FN(HashMemAllocInBytes)(
+ const BrotliEncoderParams* params, BROTLI_BOOL one_shot,
+ size_t input_size) {
+ return NUMBUCKETS * sizeof(uint32_t);
+ BROTLI_UNUSED(params);
+ BROTLI_UNUSED(one_shot);
+ BROTLI_UNUSED(input_size);
+}
+
+static BROTLI_INLINE void FN(Store)(HashRolling* BROTLI_RESTRICT self,
+ const uint8_t* BROTLI_RESTRICT data, const size_t mask, const size_t ix) {
+ BROTLI_UNUSED(self);
+ BROTLI_UNUSED(data);
+ BROTLI_UNUSED(mask);
+ BROTLI_UNUSED(ix);
+}
+
+static BROTLI_INLINE void FN(StoreRange)(HashRolling* BROTLI_RESTRICT self,
+ const uint8_t* BROTLI_RESTRICT data, const size_t mask,
+ const size_t ix_start, const size_t ix_end) {
+ BROTLI_UNUSED(self);
+ BROTLI_UNUSED(data);
+ BROTLI_UNUSED(mask);
+ BROTLI_UNUSED(ix_start);
+ BROTLI_UNUSED(ix_end);
+}
+
+static BROTLI_INLINE void FN(StitchToPreviousBlock)(
+ HashRolling* BROTLI_RESTRICT self,
+ size_t num_bytes, size_t position, const uint8_t* ringbuffer,
+ size_t ring_buffer_mask) {
+ /* In this case we must re-initialize the hasher from scratch from the
+ current position. */
+ size_t position_masked;
+ size_t available = num_bytes;
+ if ((position & (JUMP - 1)) != 0) {
+ size_t diff = JUMP - (position & (JUMP - 1));
+ available = (diff > available) ? 0 : (available - diff);
+ position += diff;
+ }
+ position_masked = position & ring_buffer_mask;
+ /* wrapping around ringbuffer not handled. */
+ if (available > ring_buffer_mask - position_masked) {
+ available = ring_buffer_mask - position_masked;
+ }
+
+ FN(Prepare)(self, BROTLI_FALSE, available,
+ ringbuffer + (position & ring_buffer_mask));
+ self->next_ix = position;
+ BROTLI_UNUSED(num_bytes);
+}
+
+static BROTLI_INLINE void FN(PrepareDistanceCache)(
+ HashRolling* BROTLI_RESTRICT self,
+ int* BROTLI_RESTRICT distance_cache) {
+ BROTLI_UNUSED(self);
+ BROTLI_UNUSED(distance_cache);
+}
+
+static BROTLI_INLINE void FN(FindLongestMatch)(
+ HashRolling* BROTLI_RESTRICT self,
+ const BrotliEncoderDictionary* dictionary,
+ const uint8_t* BROTLI_RESTRICT data, const size_t ring_buffer_mask,
+ const int* BROTLI_RESTRICT distance_cache, const size_t cur_ix,
+ const size_t max_length, const size_t max_backward,
+ const size_t dictionary_distance, const size_t max_distance,
+ HasherSearchResult* BROTLI_RESTRICT out) {
+ const size_t cur_ix_masked = cur_ix & ring_buffer_mask;
+ size_t pos;
+
+ if ((cur_ix & (JUMP - 1)) != 0) return;
+
+ /* Not enough lookahead */
+ if (max_length < CHUNKLEN) return;
+
+ for (pos = self->next_ix; pos <= cur_ix; pos += JUMP) {
+ uint32_t code = self->state & MASK;
+
+ uint8_t rem = data[pos & ring_buffer_mask];
+ uint8_t add = data[(pos + CHUNKLEN) & ring_buffer_mask];
+ size_t found_ix = FN(kInvalidPos);
+
+ self->state = FN(HashRollingFunction)(
+ self->state, add, rem, self->factor, self->factor_remove);
+
+ if (code < NUMBUCKETS) {
+ found_ix = self->table[code];
+ self->table[code] = (uint32_t)pos;
+ if (pos == cur_ix && found_ix != FN(kInvalidPos)) {
+ /* The cast to 32-bit makes backward distances up to 4GB work even
+ if cur_ix is above 4GB, despite using 32-bit values in the table. */
+ size_t backward = (uint32_t)(cur_ix - found_ix);
+ if (backward <= max_backward) {
+ const size_t found_ix_masked = found_ix & ring_buffer_mask;
+ const size_t len = FindMatchLengthWithLimit(&data[found_ix_masked],
+ &data[cur_ix_masked],
+ max_length);
+ if (len >= 4 && len > out->len) {
+ score_t score = BackwardReferenceScore(len, backward);
+ if (score > out->score) {
+ out->len = len;
+ out->distance = backward;
+ out->score = score;
+ out->len_code_delta = 0;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ self->next_ix = cur_ix + JUMP;
+
+ /* NOTE: this hasher does not search in the dictionary. It is used as
+ backup-hasher, the main hasher already searches in it. */
+ BROTLI_UNUSED(dictionary);
+ BROTLI_UNUSED(distance_cache);
+ BROTLI_UNUSED(dictionary_distance);
+ BROTLI_UNUSED(max_distance);
+}
+
+#undef HashRolling
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_to_binary_tree_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_to_binary_tree_inc.h
new file mode 100644
index 000000000..9880e0aef
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/hash_to_binary_tree_inc.h
@@ -0,0 +1,329 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: FN, BUCKET_BITS, MAX_TREE_COMP_LENGTH,
+ MAX_TREE_SEARCH_DEPTH */
+
+/* A (forgetful) hash table where each hash bucket contains a binary tree of
+ sequences whose first 4 bytes share the same hash code.
+ Each sequence is MAX_TREE_COMP_LENGTH long and is identified by its starting
+ position in the input data. The binary tree is sorted by the lexicographic
+ order of the sequences, and it is also a max-heap with respect to the
+ starting positions. */
+
+#define HashToBinaryTree HASHER()
+
+#define BUCKET_SIZE (1 << BUCKET_BITS)
+
+static BROTLI_INLINE size_t FN(HashTypeLength)(void) { return 4; }
+static BROTLI_INLINE size_t FN(StoreLookahead)(void) {
+ return MAX_TREE_COMP_LENGTH;
+}
+
+static uint32_t FN(HashBytes)(const uint8_t* BROTLI_RESTRICT data) {
+ uint32_t h = BROTLI_UNALIGNED_LOAD32LE(data) * kHashMul32;
+ /* The higher bits contain more mixture from the multiplication,
+ so we take our results from there. */
+ return h >> (32 - BUCKET_BITS);
+}
+
+typedef struct HashToBinaryTree {
+ /* The window size minus 1 */
+ size_t window_mask_;
+
+ /* Hash table that maps the 4-byte hashes of the sequence to the last
+ position where this hash was found, which is the root of the binary
+ tree of sequences that share this hash bucket. */
+ uint32_t* buckets_; /* uint32_t[BUCKET_SIZE]; */
+
+ /* A position used to mark a non-existent sequence, i.e. a tree is empty if
+ its root is at invalid_pos_ and a node is a leaf if both its children
+ are at invalid_pos_. */
+ uint32_t invalid_pos_;
+
+ /* --- Dynamic size members --- */
+
+ /* The union of the binary trees of each hash bucket. The root of the tree
+ corresponding to a hash is a sequence starting at buckets_[hash] and
+ the left and right children of a sequence starting at pos are
+ forest_[2 * pos] and forest_[2 * pos + 1]. */
+ uint32_t* forest_; /* uint32_t[2 * num_nodes] */
+} HashToBinaryTree;
+
+static void FN(Initialize)(
+ HasherCommon* common, HashToBinaryTree* BROTLI_RESTRICT self,
+ const BrotliEncoderParams* params) {
+ self->buckets_ = (uint32_t*)common->extra;
+ self->forest_ = &self->buckets_[BUCKET_SIZE];
+
+ self->window_mask_ = (1u << params->lgwin) - 1u;
+ self->invalid_pos_ = (uint32_t)(0 - self->window_mask_);
+}
+
+static void FN(Prepare)
+ (HashToBinaryTree* BROTLI_RESTRICT self, BROTLI_BOOL one_shot,
+ size_t input_size, const uint8_t* BROTLI_RESTRICT data) {
+ uint32_t invalid_pos = self->invalid_pos_;
+ uint32_t i;
+ uint32_t* BROTLI_RESTRICT buckets = self->buckets_;
+ BROTLI_UNUSED(data);
+ BROTLI_UNUSED(one_shot);
+ BROTLI_UNUSED(input_size);
+ for (i = 0; i < BUCKET_SIZE; i++) {
+ buckets[i] = invalid_pos;
+ }
+}
+
+static BROTLI_INLINE size_t FN(HashMemAllocInBytes)(
+ const BrotliEncoderParams* params, BROTLI_BOOL one_shot,
+ size_t input_size) {
+ size_t num_nodes = (size_t)1 << params->lgwin;
+ if (one_shot && input_size < num_nodes) {
+ num_nodes = input_size;
+ }
+ return sizeof(uint32_t) * BUCKET_SIZE + 2 * sizeof(uint32_t) * num_nodes;
+}
+
+static BROTLI_INLINE size_t FN(LeftChildIndex)(
+ HashToBinaryTree* BROTLI_RESTRICT self,
+ const size_t pos) {
+ return 2 * (pos & self->window_mask_);
+}
+
+static BROTLI_INLINE size_t FN(RightChildIndex)(
+ HashToBinaryTree* BROTLI_RESTRICT self,
+ const size_t pos) {
+ return 2 * (pos & self->window_mask_) + 1;
+}
+
+/* Stores the hash of the next 4 bytes and in a single tree-traversal, the
+ hash bucket's binary tree is searched for matches and is re-rooted at the
+ current position.
+
+ If less than MAX_TREE_COMP_LENGTH data is available, the hash bucket of the
+ current position is searched for matches, but the state of the hash table
+ is not changed, since we can not know the final sorting order of the
+ current (incomplete) sequence.
+
+ This function must be called with increasing cur_ix positions. */
+static BROTLI_INLINE BackwardMatch* FN(StoreAndFindMatches)(
+ HashToBinaryTree* BROTLI_RESTRICT self, const uint8_t* BROTLI_RESTRICT data,
+ const size_t cur_ix, const size_t ring_buffer_mask, const size_t max_length,
+ const size_t max_backward, size_t* const BROTLI_RESTRICT best_len,
+ BackwardMatch* BROTLI_RESTRICT matches) {
+ const size_t cur_ix_masked = cur_ix & ring_buffer_mask;
+ const size_t max_comp_len =
+ BROTLI_MIN(size_t, max_length, MAX_TREE_COMP_LENGTH);
+ const BROTLI_BOOL should_reroot_tree =
+ TO_BROTLI_BOOL(max_length >= MAX_TREE_COMP_LENGTH);
+ const uint32_t key = FN(HashBytes)(&data[cur_ix_masked]);
+ uint32_t* BROTLI_RESTRICT buckets = self->buckets_;
+ uint32_t* BROTLI_RESTRICT forest = self->forest_;
+ size_t prev_ix = buckets[key];
+ /* The forest index of the rightmost node of the left subtree of the new
+ root, updated as we traverse and re-root the tree of the hash bucket. */
+ size_t node_left = FN(LeftChildIndex)(self, cur_ix);
+ /* The forest index of the leftmost node of the right subtree of the new
+ root, updated as we traverse and re-root the tree of the hash bucket. */
+ size_t node_right = FN(RightChildIndex)(self, cur_ix);
+ /* The match length of the rightmost node of the left subtree of the new
+ root, updated as we traverse and re-root the tree of the hash bucket. */
+ size_t best_len_left = 0;
+ /* The match length of the leftmost node of the right subtree of the new
+ root, updated as we traverse and re-root the tree of the hash bucket. */
+ size_t best_len_right = 0;
+ size_t depth_remaining;
+ if (should_reroot_tree) {
+ buckets[key] = (uint32_t)cur_ix;
+ }
+ for (depth_remaining = MAX_TREE_SEARCH_DEPTH; ; --depth_remaining) {
+ const size_t backward = cur_ix - prev_ix;
+ const size_t prev_ix_masked = prev_ix & ring_buffer_mask;
+ if (backward == 0 || backward > max_backward || depth_remaining == 0) {
+ if (should_reroot_tree) {
+ forest[node_left] = self->invalid_pos_;
+ forest[node_right] = self->invalid_pos_;
+ }
+ break;
+ }
+ {
+ const size_t cur_len = BROTLI_MIN(size_t, best_len_left, best_len_right);
+ size_t len;
+ BROTLI_DCHECK(cur_len <= MAX_TREE_COMP_LENGTH);
+ len = cur_len +
+ FindMatchLengthWithLimit(&data[cur_ix_masked + cur_len],
+ &data[prev_ix_masked + cur_len],
+ max_length - cur_len);
+ BROTLI_DCHECK(
+ 0 == memcmp(&data[cur_ix_masked], &data[prev_ix_masked], len));
+ if (matches && len > *best_len) {
+ *best_len = len;
+ InitBackwardMatch(matches++, backward, len);
+ }
+ if (len >= max_comp_len) {
+ if (should_reroot_tree) {
+ forest[node_left] = forest[FN(LeftChildIndex)(self, prev_ix)];
+ forest[node_right] = forest[FN(RightChildIndex)(self, prev_ix)];
+ }
+ break;
+ }
+ if (data[cur_ix_masked + len] > data[prev_ix_masked + len]) {
+ best_len_left = len;
+ if (should_reroot_tree) {
+ forest[node_left] = (uint32_t)prev_ix;
+ }
+ node_left = FN(RightChildIndex)(self, prev_ix);
+ prev_ix = forest[node_left];
+ } else {
+ best_len_right = len;
+ if (should_reroot_tree) {
+ forest[node_right] = (uint32_t)prev_ix;
+ }
+ node_right = FN(LeftChildIndex)(self, prev_ix);
+ prev_ix = forest[node_right];
+ }
+ }
+ }
+ return matches;
+}
+
+/* Finds all backward matches of &data[cur_ix & ring_buffer_mask] up to the
+ length of max_length and stores the position cur_ix in the hash table.
+
+ Sets *num_matches to the number of matches found, and stores the found
+ matches in matches[0] to matches[*num_matches - 1]. The matches will be
+ sorted by strictly increasing length and (non-strictly) increasing
+ distance. */
+static BROTLI_INLINE size_t FN(FindAllMatches)(
+ HashToBinaryTree* BROTLI_RESTRICT self,
+ const BrotliEncoderDictionary* dictionary,
+ const uint8_t* BROTLI_RESTRICT data,
+ const size_t ring_buffer_mask, const size_t cur_ix,
+ const size_t max_length, const size_t max_backward,
+ const size_t dictionary_distance, const BrotliEncoderParams* params,
+ BackwardMatch* matches) {
+ BackwardMatch* const orig_matches = matches;
+ const size_t cur_ix_masked = cur_ix & ring_buffer_mask;
+ size_t best_len = 1;
+ const size_t short_match_max_backward =
+ params->quality != HQ_ZOPFLIFICATION_QUALITY ? 16 : 64;
+ size_t stop = cur_ix - short_match_max_backward;
+ uint32_t dict_matches[BROTLI_MAX_STATIC_DICTIONARY_MATCH_LEN + 1];
+ size_t i;
+ if (cur_ix < short_match_max_backward) { stop = 0; }
+ for (i = cur_ix - 1; i > stop && best_len <= 2; --i) {
+ size_t prev_ix = i;
+ const size_t backward = cur_ix - prev_ix;
+ if (BROTLI_PREDICT_FALSE(backward > max_backward)) {
+ break;
+ }
+ prev_ix &= ring_buffer_mask;
+ if (data[cur_ix_masked] != data[prev_ix] ||
+ data[cur_ix_masked + 1] != data[prev_ix + 1]) {
+ continue;
+ }
+ {
+ const size_t len =
+ FindMatchLengthWithLimit(&data[prev_ix], &data[cur_ix_masked],
+ max_length);
+ if (len > best_len) {
+ best_len = len;
+ InitBackwardMatch(matches++, backward, len);
+ }
+ }
+ }
+ if (best_len < max_length) {
+ matches = FN(StoreAndFindMatches)(self, data, cur_ix,
+ ring_buffer_mask, max_length, max_backward, &best_len, matches);
+ }
+ for (i = 0; i <= BROTLI_MAX_STATIC_DICTIONARY_MATCH_LEN; ++i) {
+ dict_matches[i] = kInvalidMatch;
+ }
+ {
+ size_t minlen = BROTLI_MAX(size_t, 4, best_len + 1);
+ if (BrotliFindAllStaticDictionaryMatches(dictionary,
+ &data[cur_ix_masked], minlen, max_length, &dict_matches[0])) {
+ size_t maxlen = BROTLI_MIN(
+ size_t, BROTLI_MAX_STATIC_DICTIONARY_MATCH_LEN, max_length);
+ size_t l;
+ for (l = minlen; l <= maxlen; ++l) {
+ uint32_t dict_id = dict_matches[l];
+ if (dict_id < kInvalidMatch) {
+ size_t distance = dictionary_distance + (dict_id >> 5) + 1;
+ if (distance <= params->dist.max_distance) {
+ InitDictionaryBackwardMatch(matches++, distance, l, dict_id & 31);
+ }
+ }
+ }
+ }
+ }
+ return (size_t)(matches - orig_matches);
+}
+
+/* Stores the hash of the next 4 bytes and re-roots the binary tree at the
+ current sequence, without returning any matches.
+ REQUIRES: ix + MAX_TREE_COMP_LENGTH <= end-of-current-block */
+static BROTLI_INLINE void FN(Store)(HashToBinaryTree* BROTLI_RESTRICT self,
+ const uint8_t* BROTLI_RESTRICT data,
+ const size_t mask, const size_t ix) {
+ /* Maximum distance is window size - 16, see section 9.1. of the spec. */
+ const size_t max_backward = self->window_mask_ - BROTLI_WINDOW_GAP + 1;
+ FN(StoreAndFindMatches)(self, data, ix, mask, MAX_TREE_COMP_LENGTH,
+ max_backward, NULL, NULL);
+}
+
+static BROTLI_INLINE void FN(StoreRange)(HashToBinaryTree* BROTLI_RESTRICT self,
+ const uint8_t* BROTLI_RESTRICT data, const size_t mask,
+ const size_t ix_start, const size_t ix_end) {
+ size_t i = ix_start;
+ size_t j = ix_start;
+ if (ix_start + 63 <= ix_end) {
+ i = ix_end - 63;
+ }
+ if (ix_start + 512 <= i) {
+ for (; j < i; j += 8) {
+ FN(Store)(self, data, mask, j);
+ }
+ }
+ for (; i < ix_end; ++i) {
+ FN(Store)(self, data, mask, i);
+ }
+}
+
+static BROTLI_INLINE void FN(StitchToPreviousBlock)(
+ HashToBinaryTree* BROTLI_RESTRICT self,
+ size_t num_bytes, size_t position, const uint8_t* ringbuffer,
+ size_t ringbuffer_mask) {
+ if (num_bytes >= FN(HashTypeLength)() - 1 &&
+ position >= MAX_TREE_COMP_LENGTH) {
+ /* Store the last `MAX_TREE_COMP_LENGTH - 1` positions in the hasher.
+ These could not be calculated before, since they require knowledge
+ of both the previous and the current block. */
+ const size_t i_start = position - MAX_TREE_COMP_LENGTH + 1;
+ const size_t i_end = BROTLI_MIN(size_t, position, i_start + num_bytes);
+ size_t i;
+ for (i = i_start; i < i_end; ++i) {
+ /* Maximum distance is window size - 16, see section 9.1. of the spec.
+ Furthermore, we have to make sure that we don't look further back
+ from the start of the next block than the window size, otherwise we
+ could access already overwritten areas of the ring-buffer. */
+ const size_t max_backward =
+ self->window_mask_ - BROTLI_MAX(size_t,
+ BROTLI_WINDOW_GAP - 1,
+ position - i);
+ /* We know that i + MAX_TREE_COMP_LENGTH <= position + num_bytes, i.e. the
+ end of the current block and that we have at least
+ MAX_TREE_COMP_LENGTH tail in the ring-buffer. */
+ FN(StoreAndFindMatches)(self, ringbuffer, i, ringbuffer_mask,
+ MAX_TREE_COMP_LENGTH, max_backward, NULL, NULL);
+ }
+ }
+}
+
+#undef BUCKET_SIZE
+
+#undef HashToBinaryTree
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/histogram.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/histogram.c
new file mode 100644
index 000000000..6da2ff6bb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/histogram.c
@@ -0,0 +1,100 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Build per-context histograms of literals, commands and distance codes. */
+
+#include "./histogram.h"
+
+#include "../common/context.h"
+#include "./block_splitter.h"
+#include "./command.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+typedef struct BlockSplitIterator {
+ const BlockSplit* split_; /* Not owned. */
+ size_t idx_;
+ size_t type_;
+ size_t length_;
+} BlockSplitIterator;
+
+static void InitBlockSplitIterator(BlockSplitIterator* self,
+ const BlockSplit* split) {
+ self->split_ = split;
+ self->idx_ = 0;
+ self->type_ = 0;
+ self->length_ = split->lengths ? split->lengths[0] : 0;
+}
+
+static void BlockSplitIteratorNext(BlockSplitIterator* self) {
+ if (self->length_ == 0) {
+ ++self->idx_;
+ self->type_ = self->split_->types[self->idx_];
+ self->length_ = self->split_->lengths[self->idx_];
+ }
+ --self->length_;
+}
+
+void BrotliBuildHistogramsWithContext(
+ const Command* cmds, const size_t num_commands,
+ const BlockSplit* literal_split, const BlockSplit* insert_and_copy_split,
+ const BlockSplit* dist_split, const uint8_t* ringbuffer, size_t start_pos,
+ size_t mask, uint8_t prev_byte, uint8_t prev_byte2,
+ const ContextType* context_modes, HistogramLiteral* literal_histograms,
+ HistogramCommand* insert_and_copy_histograms,
+ HistogramDistance* copy_dist_histograms) {
+ size_t pos = start_pos;
+ BlockSplitIterator literal_it;
+ BlockSplitIterator insert_and_copy_it;
+ BlockSplitIterator dist_it;
+ size_t i;
+
+ InitBlockSplitIterator(&literal_it, literal_split);
+ InitBlockSplitIterator(&insert_and_copy_it, insert_and_copy_split);
+ InitBlockSplitIterator(&dist_it, dist_split);
+ for (i = 0; i < num_commands; ++i) {
+ const Command* cmd = &cmds[i];
+ size_t j;
+ BlockSplitIteratorNext(&insert_and_copy_it);
+ HistogramAddCommand(&insert_and_copy_histograms[insert_and_copy_it.type_],
+ cmd->cmd_prefix_);
+ /* TODO: unwrap iterator blocks. */
+ for (j = cmd->insert_len_; j != 0; --j) {
+ size_t context;
+ BlockSplitIteratorNext(&literal_it);
+ context = literal_it.type_;
+ if (context_modes) {
+ ContextLut lut = BROTLI_CONTEXT_LUT(context_modes[context]);
+ context = (context << BROTLI_LITERAL_CONTEXT_BITS) +
+ BROTLI_CONTEXT(prev_byte, prev_byte2, lut);
+ }
+ HistogramAddLiteral(&literal_histograms[context],
+ ringbuffer[pos & mask]);
+ prev_byte2 = prev_byte;
+ prev_byte = ringbuffer[pos & mask];
+ ++pos;
+ }
+ pos += CommandCopyLen(cmd);
+ if (CommandCopyLen(cmd)) {
+ prev_byte2 = ringbuffer[(pos - 2) & mask];
+ prev_byte = ringbuffer[(pos - 1) & mask];
+ if (cmd->cmd_prefix_ >= 128) {
+ size_t context;
+ BlockSplitIteratorNext(&dist_it);
+ context = (dist_it.type_ << BROTLI_DISTANCE_CONTEXT_BITS) +
+ CommandDistanceContext(cmd);
+ HistogramAddDistance(&copy_dist_histograms[context],
+ cmd->dist_prefix_ & 0x3FF);
+ }
+ }
+ }
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/histogram.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/histogram.h
new file mode 100644
index 000000000..42af3c3f9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/histogram.h
@@ -0,0 +1,63 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Models the histograms of literals, commands and distance codes. */
+
+#ifndef BROTLI_ENC_HISTOGRAM_H_
+#define BROTLI_ENC_HISTOGRAM_H_
+
+#include <string.h> /* memset */
+
+#include "../common/constants.h"
+#include "../common/context.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./block_splitter.h"
+#include "./command.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* The distance symbols effectively used by "Large Window Brotli" (32-bit). */
+#define BROTLI_NUM_HISTOGRAM_DISTANCE_SYMBOLS 544
+
+#define FN(X) X ## Literal
+#define DATA_SIZE BROTLI_NUM_LITERAL_SYMBOLS
+#define DataType uint8_t
+#include "./histogram_inc.h" /* NOLINT(build/include) */
+#undef DataType
+#undef DATA_SIZE
+#undef FN
+
+#define FN(X) X ## Command
+#define DataType uint16_t
+#define DATA_SIZE BROTLI_NUM_COMMAND_SYMBOLS
+#include "./histogram_inc.h" /* NOLINT(build/include) */
+#undef DATA_SIZE
+#undef FN
+
+#define FN(X) X ## Distance
+#define DATA_SIZE BROTLI_NUM_HISTOGRAM_DISTANCE_SYMBOLS
+#include "./histogram_inc.h" /* NOLINT(build/include) */
+#undef DataType
+#undef DATA_SIZE
+#undef FN
+
+BROTLI_INTERNAL void BrotliBuildHistogramsWithContext(
+ const Command* cmds, const size_t num_commands,
+ const BlockSplit* literal_split, const BlockSplit* insert_and_copy_split,
+ const BlockSplit* dist_split, const uint8_t* ringbuffer, size_t pos,
+ size_t mask, uint8_t prev_byte, uint8_t prev_byte2,
+ const ContextType* context_modes, HistogramLiteral* literal_histograms,
+ HistogramCommand* insert_and_copy_histograms,
+ HistogramDistance* copy_dist_histograms);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_HISTOGRAM_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/histogram_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/histogram_inc.h
new file mode 100644
index 000000000..50eaf7468
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/histogram_inc.h
@@ -0,0 +1,51 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: Histogram, DATA_SIZE, DataType */
+
+/* A simple container for histograms of data in blocks. */
+
+typedef struct FN(Histogram) {
+ uint32_t data_[DATA_SIZE];
+ size_t total_count_;
+ double bit_cost_;
+} FN(Histogram);
+
+static BROTLI_INLINE void FN(HistogramClear)(FN(Histogram)* self) {
+ memset(self->data_, 0, sizeof(self->data_));
+ self->total_count_ = 0;
+ self->bit_cost_ = HUGE_VAL;
+}
+
+static BROTLI_INLINE void FN(ClearHistograms)(
+ FN(Histogram)* array, size_t length) {
+ size_t i;
+ for (i = 0; i < length; ++i) FN(HistogramClear)(array + i);
+}
+
+static BROTLI_INLINE void FN(HistogramAdd)(FN(Histogram)* self, size_t val) {
+ ++self->data_[val];
+ ++self->total_count_;
+}
+
+static BROTLI_INLINE void FN(HistogramAddVector)(FN(Histogram)* self,
+ const DataType* p, size_t n) {
+ self->total_count_ += n;
+ n += 1;
+ while (--n) ++self->data_[*p++];
+}
+
+static BROTLI_INLINE void FN(HistogramAddHistogram)(FN(Histogram)* self,
+ const FN(Histogram)* v) {
+ size_t i;
+ self->total_count_ += v->total_count_;
+ for (i = 0; i < DATA_SIZE; ++i) {
+ self->data_[i] += v->data_[i];
+ }
+}
+
+static BROTLI_INLINE size_t FN(HistogramDataSize)(void) { return DATA_SIZE; }
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/literal_cost.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/literal_cost.c
new file mode 100644
index 000000000..c231100e3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/literal_cost.c
@@ -0,0 +1,175 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Literal cost model to allow backward reference replacement to be efficient.
+*/
+
+#include "./literal_cost.h"
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./fast_log.h"
+#include "./utf8_util.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+static size_t UTF8Position(size_t last, size_t c, size_t clamp) {
+ if (c < 128) {
+ return 0; /* Next one is the 'Byte 1' again. */
+ } else if (c >= 192) { /* Next one is the 'Byte 2' of utf-8 encoding. */
+ return BROTLI_MIN(size_t, 1, clamp);
+ } else {
+ /* Let's decide over the last byte if this ends the sequence. */
+ if (last < 0xE0) {
+ return 0; /* Completed two or three byte coding. */
+ } else { /* Next one is the 'Byte 3' of utf-8 encoding. */
+ return BROTLI_MIN(size_t, 2, clamp);
+ }
+ }
+}
+
+static size_t DecideMultiByteStatsLevel(size_t pos, size_t len, size_t mask,
+ const uint8_t* data) {
+ size_t counts[3] = { 0 };
+ size_t max_utf8 = 1; /* should be 2, but 1 compresses better. */
+ size_t last_c = 0;
+ size_t i;
+ for (i = 0; i < len; ++i) {
+ size_t c = data[(pos + i) & mask];
+ ++counts[UTF8Position(last_c, c, 2)];
+ last_c = c;
+ }
+ if (counts[2] < 500) {
+ max_utf8 = 1;
+ }
+ if (counts[1] + counts[2] < 25) {
+ max_utf8 = 0;
+ }
+ return max_utf8;
+}
+
+static void EstimateBitCostsForLiteralsUTF8(size_t pos, size_t len, size_t mask,
+ const uint8_t* data, float* cost) {
+ /* max_utf8 is 0 (normal ASCII single byte modeling),
+ 1 (for 2-byte UTF-8 modeling), or 2 (for 3-byte UTF-8 modeling). */
+ const size_t max_utf8 = DecideMultiByteStatsLevel(pos, len, mask, data);
+ size_t histogram[3][256] = { { 0 } };
+ size_t window_half = 495;
+ size_t in_window = BROTLI_MIN(size_t, window_half, len);
+ size_t in_window_utf8[3] = { 0 };
+
+ size_t i;
+ { /* Bootstrap histograms. */
+ size_t last_c = 0;
+ size_t utf8_pos = 0;
+ for (i = 0; i < in_window; ++i) {
+ size_t c = data[(pos + i) & mask];
+ ++histogram[utf8_pos][c];
+ ++in_window_utf8[utf8_pos];
+ utf8_pos = UTF8Position(last_c, c, max_utf8);
+ last_c = c;
+ }
+ }
+
+ /* Compute bit costs with sliding window. */
+ for (i = 0; i < len; ++i) {
+ if (i >= window_half) {
+ /* Remove a byte in the past. */
+ size_t c =
+ i < window_half + 1 ? 0 : data[(pos + i - window_half - 1) & mask];
+ size_t last_c =
+ i < window_half + 2 ? 0 : data[(pos + i - window_half - 2) & mask];
+ size_t utf8_pos2 = UTF8Position(last_c, c, max_utf8);
+ --histogram[utf8_pos2][data[(pos + i - window_half) & mask]];
+ --in_window_utf8[utf8_pos2];
+ }
+ if (i + window_half < len) {
+ /* Add a byte in the future. */
+ size_t c = data[(pos + i + window_half - 1) & mask];
+ size_t last_c = data[(pos + i + window_half - 2) & mask];
+ size_t utf8_pos2 = UTF8Position(last_c, c, max_utf8);
+ ++histogram[utf8_pos2][data[(pos + i + window_half) & mask]];
+ ++in_window_utf8[utf8_pos2];
+ }
+ {
+ size_t c = i < 1 ? 0 : data[(pos + i - 1) & mask];
+ size_t last_c = i < 2 ? 0 : data[(pos + i - 2) & mask];
+ size_t utf8_pos = UTF8Position(last_c, c, max_utf8);
+ size_t masked_pos = (pos + i) & mask;
+ size_t histo = histogram[utf8_pos][data[masked_pos]];
+ double lit_cost;
+ if (histo == 0) {
+ histo = 1;
+ }
+ lit_cost = FastLog2(in_window_utf8[utf8_pos]) - FastLog2(histo);
+ lit_cost += 0.02905;
+ if (lit_cost < 1.0) {
+ lit_cost *= 0.5;
+ lit_cost += 0.5;
+ }
+ /* Make the first bytes more expensive -- seems to help, not sure why.
+ Perhaps because the entropy source is changing its properties
+ rapidly in the beginning of the file, perhaps because the beginning
+ of the data is a statistical "anomaly". */
+ if (i < 2000) {
+ lit_cost += 0.7 - ((double)(2000 - i) / 2000.0 * 0.35);
+ }
+ cost[i] = (float)lit_cost;
+ }
+ }
+}
+
+void BrotliEstimateBitCostsForLiterals(size_t pos, size_t len, size_t mask,
+ const uint8_t* data, float* cost) {
+ if (BrotliIsMostlyUTF8(data, pos, mask, len, kMinUTF8Ratio)) {
+ EstimateBitCostsForLiteralsUTF8(pos, len, mask, data, cost);
+ return;
+ } else {
+ size_t histogram[256] = { 0 };
+ size_t window_half = 2000;
+ size_t in_window = BROTLI_MIN(size_t, window_half, len);
+
+ /* Bootstrap histogram. */
+ size_t i;
+ for (i = 0; i < in_window; ++i) {
+ ++histogram[data[(pos + i) & mask]];
+ }
+
+ /* Compute bit costs with sliding window. */
+ for (i = 0; i < len; ++i) {
+ size_t histo;
+ if (i >= window_half) {
+ /* Remove a byte in the past. */
+ --histogram[data[(pos + i - window_half) & mask]];
+ --in_window;
+ }
+ if (i + window_half < len) {
+ /* Add a byte in the future. */
+ ++histogram[data[(pos + i + window_half) & mask]];
+ ++in_window;
+ }
+ histo = histogram[data[(pos + i) & mask]];
+ if (histo == 0) {
+ histo = 1;
+ }
+ {
+ double lit_cost = FastLog2(in_window) - FastLog2(histo);
+ lit_cost += 0.029;
+ if (lit_cost < 1.0) {
+ lit_cost *= 0.5;
+ lit_cost += 0.5;
+ }
+ cost[i] = (float)lit_cost;
+ }
+ }
+ }
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/literal_cost.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/literal_cost.h
new file mode 100644
index 000000000..8f53f39d3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/literal_cost.h
@@ -0,0 +1,30 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Literal cost model to allow backward reference replacement to be efficient.
+*/
+
+#ifndef BROTLI_ENC_LITERAL_COST_H_
+#define BROTLI_ENC_LITERAL_COST_H_
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* Estimates how many bits the literals in the interval [pos, pos + len) in the
+ ring-buffer (data, mask) will take entropy coded and writes these estimates
+ to the cost[0..len) array. */
+BROTLI_INTERNAL void BrotliEstimateBitCostsForLiterals(
+ size_t pos, size_t len, size_t mask, const uint8_t* data, float* cost);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_LITERAL_COST_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/memory.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/memory.c
new file mode 100644
index 000000000..f6ed7e3cb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/memory.c
@@ -0,0 +1,170 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Algorithms for distributing the literals and commands of a metablock between
+ block types and contexts. */
+
+#include "./memory.h"
+
+#include <stdlib.h> /* exit, free, malloc */
+#include <string.h> /* memcpy */
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#define MAX_PERM_ALLOCATED 128
+#define MAX_NEW_ALLOCATED 64
+#define MAX_NEW_FREED 64
+
+#define PERM_ALLOCATED_OFFSET 0
+#define NEW_ALLOCATED_OFFSET MAX_PERM_ALLOCATED
+#define NEW_FREED_OFFSET (MAX_PERM_ALLOCATED + MAX_NEW_ALLOCATED)
+
+void BrotliInitMemoryManager(
+ MemoryManager* m, brotli_alloc_func alloc_func, brotli_free_func free_func,
+ void* opaque) {
+ if (!alloc_func) {
+ m->alloc_func = BrotliDefaultAllocFunc;
+ m->free_func = BrotliDefaultFreeFunc;
+ m->opaque = 0;
+ } else {
+ m->alloc_func = alloc_func;
+ m->free_func = free_func;
+ m->opaque = opaque;
+ }
+#if !defined(BROTLI_ENCODER_EXIT_ON_OOM)
+ m->is_oom = BROTLI_FALSE;
+ m->perm_allocated = 0;
+ m->new_allocated = 0;
+ m->new_freed = 0;
+#endif /* BROTLI_ENCODER_EXIT_ON_OOM */
+}
+
+#if defined(BROTLI_ENCODER_EXIT_ON_OOM)
+
+void* BrotliAllocate(MemoryManager* m, size_t n) {
+ void* result = m->alloc_func(m->opaque, n);
+ if (!result) exit(EXIT_FAILURE);
+ return result;
+}
+
+void BrotliFree(MemoryManager* m, void* p) {
+ m->free_func(m->opaque, p);
+}
+
+void BrotliWipeOutMemoryManager(MemoryManager* m) {
+ BROTLI_UNUSED(m);
+}
+
+#else /* BROTLI_ENCODER_EXIT_ON_OOM */
+
+static void SortPointers(void** items, const size_t n) {
+ /* Shell sort. */
+ static const size_t gaps[] = {23, 10, 4, 1};
+ int g = 0;
+ for (; g < 4; ++g) {
+ size_t gap = gaps[g];
+ size_t i;
+ for (i = gap; i < n; ++i) {
+ size_t j = i;
+ void* tmp = items[i];
+ for (; j >= gap && tmp < items[j - gap]; j -= gap) {
+ items[j] = items[j - gap];
+ }
+ items[j] = tmp;
+ }
+ }
+}
+
+static size_t Annihilate(void** a, size_t a_len, void** b, size_t b_len) {
+ size_t a_read_index = 0;
+ size_t b_read_index = 0;
+ size_t a_write_index = 0;
+ size_t b_write_index = 0;
+ size_t annihilated = 0;
+ while (a_read_index < a_len && b_read_index < b_len) {
+ if (a[a_read_index] == b[b_read_index]) {
+ a_read_index++;
+ b_read_index++;
+ annihilated++;
+ } else if (a[a_read_index] < b[b_read_index]) {
+ a[a_write_index++] = a[a_read_index++];
+ } else {
+ b[b_write_index++] = b[b_read_index++];
+ }
+ }
+ while (a_read_index < a_len) a[a_write_index++] = a[a_read_index++];
+ while (b_read_index < b_len) b[b_write_index++] = b[b_read_index++];
+ return annihilated;
+}
+
+static void CollectGarbagePointers(MemoryManager* m) {
+ size_t annihilated;
+ SortPointers(m->pointers + NEW_ALLOCATED_OFFSET, m->new_allocated);
+ SortPointers(m->pointers + NEW_FREED_OFFSET, m->new_freed);
+ annihilated = Annihilate(
+ m->pointers + NEW_ALLOCATED_OFFSET, m->new_allocated,
+ m->pointers + NEW_FREED_OFFSET, m->new_freed);
+ m->new_allocated -= annihilated;
+ m->new_freed -= annihilated;
+
+ if (m->new_freed != 0) {
+ annihilated = Annihilate(
+ m->pointers + PERM_ALLOCATED_OFFSET, m->perm_allocated,
+ m->pointers + NEW_FREED_OFFSET, m->new_freed);
+ m->perm_allocated -= annihilated;
+ m->new_freed -= annihilated;
+ BROTLI_DCHECK(m->new_freed == 0);
+ }
+
+ if (m->new_allocated != 0) {
+ BROTLI_DCHECK(m->perm_allocated + m->new_allocated <= MAX_PERM_ALLOCATED);
+ memcpy(m->pointers + PERM_ALLOCATED_OFFSET + m->perm_allocated,
+ m->pointers + NEW_ALLOCATED_OFFSET,
+ sizeof(void*) * m->new_allocated);
+ m->perm_allocated += m->new_allocated;
+ m->new_allocated = 0;
+ SortPointers(m->pointers + PERM_ALLOCATED_OFFSET, m->perm_allocated);
+ }
+}
+
+void* BrotliAllocate(MemoryManager* m, size_t n) {
+ void* result = m->alloc_func(m->opaque, n);
+ if (!result) {
+ m->is_oom = BROTLI_TRUE;
+ return NULL;
+ }
+ if (m->new_allocated == MAX_NEW_ALLOCATED) CollectGarbagePointers(m);
+ m->pointers[NEW_ALLOCATED_OFFSET + (m->new_allocated++)] = result;
+ return result;
+}
+
+void BrotliFree(MemoryManager* m, void* p) {
+ if (!p) return;
+ m->free_func(m->opaque, p);
+ if (m->new_freed == MAX_NEW_FREED) CollectGarbagePointers(m);
+ m->pointers[NEW_FREED_OFFSET + (m->new_freed++)] = p;
+}
+
+void BrotliWipeOutMemoryManager(MemoryManager* m) {
+ size_t i;
+ CollectGarbagePointers(m);
+ /* Now all unfreed pointers are in perm-allocated list. */
+ for (i = 0; i < m->perm_allocated; ++i) {
+ m->free_func(m->opaque, m->pointers[PERM_ALLOCATED_OFFSET + i]);
+ }
+ m->perm_allocated = 0;
+}
+
+#endif /* BROTLI_ENCODER_EXIT_ON_OOM */
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/memory.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/memory.h
new file mode 100644
index 000000000..832e7b2b6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/memory.h
@@ -0,0 +1,114 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Macros for memory management. */
+
+#ifndef BROTLI_ENC_MEMORY_H_
+#define BROTLI_ENC_MEMORY_H_
+
+#include <string.h> /* memcpy */
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#if !defined(BROTLI_ENCODER_CLEANUP_ON_OOM) && \
+ !defined(BROTLI_ENCODER_EXIT_ON_OOM)
+#define BROTLI_ENCODER_EXIT_ON_OOM
+#endif
+
+typedef struct MemoryManager {
+ brotli_alloc_func alloc_func;
+ brotli_free_func free_func;
+ void* opaque;
+#if !defined(BROTLI_ENCODER_EXIT_ON_OOM)
+ BROTLI_BOOL is_oom;
+ size_t perm_allocated;
+ size_t new_allocated;
+ size_t new_freed;
+ void* pointers[256];
+#endif /* BROTLI_ENCODER_EXIT_ON_OOM */
+} MemoryManager;
+
+BROTLI_INTERNAL void BrotliInitMemoryManager(
+ MemoryManager* m, brotli_alloc_func alloc_func, brotli_free_func free_func,
+ void* opaque);
+
+BROTLI_INTERNAL void* BrotliAllocate(MemoryManager* m, size_t n);
+#define BROTLI_ALLOC(M, T, N) \
+ ((N) > 0 ? ((T*)BrotliAllocate((M), (N) * sizeof(T))) : NULL)
+
+BROTLI_INTERNAL void BrotliFree(MemoryManager* m, void* p);
+#define BROTLI_FREE(M, P) { \
+ BrotliFree((M), (P)); \
+ P = NULL; \
+}
+
+#if defined(BROTLI_ENCODER_EXIT_ON_OOM)
+#define BROTLI_IS_OOM(M) (!!0)
+#else /* BROTLI_ENCODER_EXIT_ON_OOM */
+#define BROTLI_IS_OOM(M) (!!(M)->is_oom)
+#endif /* BROTLI_ENCODER_EXIT_ON_OOM */
+
+/*
+BROTLI_IS_NULL is a fake check, BROTLI_IS_OOM does the heavy lifting.
+The only purpose of it is to explain static analyzers the state of things.
+NB: use ONLY together with BROTLI_IS_OOM
+ AND ONLY for allocations in the current scope.
+ */
+#if defined(__clang_analyzer__) && !defined(BROTLI_ENCODER_EXIT_ON_OOM)
+#define BROTLI_IS_NULL(A) ((A) == nullptr)
+#else /* defined(__clang_analyzer__) */
+#define BROTLI_IS_NULL(A) (!!0)
+#endif /* defined(__clang_analyzer__) */
+
+BROTLI_INTERNAL void BrotliWipeOutMemoryManager(MemoryManager* m);
+
+/*
+Dynamically grows array capacity to at least the requested size
+M: MemoryManager
+T: data type
+A: array
+C: capacity
+R: requested size
+*/
+#define BROTLI_ENSURE_CAPACITY(M, T, A, C, R) { \
+ if (C < (R)) { \
+ size_t _new_size = (C == 0) ? (R) : C; \
+ T* new_array; \
+ while (_new_size < (R)) _new_size *= 2; \
+ new_array = BROTLI_ALLOC((M), T, _new_size); \
+ if (!BROTLI_IS_OOM(M) && !BROTLI_IS_NULL(new_array) && C != 0) \
+ memcpy(new_array, A, C * sizeof(T)); \
+ BROTLI_FREE((M), A); \
+ A = new_array; \
+ C = _new_size; \
+ } \
+}
+
+/*
+Appends value and dynamically grows array capacity when needed
+M: MemoryManager
+T: data type
+A: array
+C: array capacity
+S: array size
+V: value to append
+*/
+#define BROTLI_ENSURE_CAPACITY_APPEND(M, T, A, C, S, V) { \
+ (S)++; \
+ BROTLI_ENSURE_CAPACITY(M, T, A, C, S); \
+ A[(S) - 1] = (V); \
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_MEMORY_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/metablock.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/metablock.c
new file mode 100644
index 000000000..5aa4d4f17
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/metablock.c
@@ -0,0 +1,663 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Algorithms for distributing the literals and commands of a metablock between
+ block types and contexts. */
+
+#include "./metablock.h"
+
+#include "../common/constants.h"
+#include "../common/context.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./bit_cost.h"
+#include "./block_splitter.h"
+#include "./cluster.h"
+#include "./entropy_encode.h"
+#include "./histogram.h"
+#include "./memory.h"
+#include "./quality.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+void BrotliInitDistanceParams(BrotliEncoderParams* params,
+ uint32_t npostfix, uint32_t ndirect) {
+ BrotliDistanceParams* dist_params = &params->dist;
+ uint32_t alphabet_size_max;
+ uint32_t alphabet_size_limit;
+ uint32_t max_distance;
+
+ dist_params->distance_postfix_bits = npostfix;
+ dist_params->num_direct_distance_codes = ndirect;
+
+ alphabet_size_max = BROTLI_DISTANCE_ALPHABET_SIZE(
+ npostfix, ndirect, BROTLI_MAX_DISTANCE_BITS);
+ alphabet_size_limit = alphabet_size_max;
+ max_distance = ndirect + (1U << (BROTLI_MAX_DISTANCE_BITS + npostfix + 2)) -
+ (1U << (npostfix + 2));
+
+ if (params->large_window) {
+ BrotliDistanceCodeLimit limit = BrotliCalculateDistanceCodeLimit(
+ BROTLI_MAX_ALLOWED_DISTANCE, npostfix, ndirect);
+ alphabet_size_max = BROTLI_DISTANCE_ALPHABET_SIZE(
+ npostfix, ndirect, BROTLI_LARGE_MAX_DISTANCE_BITS);
+ alphabet_size_limit = limit.max_alphabet_size;
+ max_distance = limit.max_distance;
+ }
+
+ dist_params->alphabet_size_max = alphabet_size_max;
+ dist_params->alphabet_size_limit = alphabet_size_limit;
+ dist_params->max_distance = max_distance;
+}
+
+static void RecomputeDistancePrefixes(Command* cmds,
+ size_t num_commands,
+ const BrotliDistanceParams* orig_params,
+ const BrotliDistanceParams* new_params) {
+ size_t i;
+
+ if (orig_params->distance_postfix_bits == new_params->distance_postfix_bits &&
+ orig_params->num_direct_distance_codes ==
+ new_params->num_direct_distance_codes) {
+ return;
+ }
+
+ for (i = 0; i < num_commands; ++i) {
+ Command* cmd = &cmds[i];
+ if (CommandCopyLen(cmd) && cmd->cmd_prefix_ >= 128) {
+ PrefixEncodeCopyDistance(CommandRestoreDistanceCode(cmd, orig_params),
+ new_params->num_direct_distance_codes,
+ new_params->distance_postfix_bits,
+ &cmd->dist_prefix_,
+ &cmd->dist_extra_);
+ }
+ }
+}
+
+static BROTLI_BOOL ComputeDistanceCost(const Command* cmds,
+ size_t num_commands,
+ const BrotliDistanceParams* orig_params,
+ const BrotliDistanceParams* new_params,
+ double* cost) {
+ size_t i;
+ BROTLI_BOOL equal_params = BROTLI_FALSE;
+ uint16_t dist_prefix;
+ uint32_t dist_extra;
+ double extra_bits = 0.0;
+ HistogramDistance histo;
+ HistogramClearDistance(&histo);
+
+ if (orig_params->distance_postfix_bits == new_params->distance_postfix_bits &&
+ orig_params->num_direct_distance_codes ==
+ new_params->num_direct_distance_codes) {
+ equal_params = BROTLI_TRUE;
+ }
+
+ for (i = 0; i < num_commands; i++) {
+ const Command* cmd = &cmds[i];
+ if (CommandCopyLen(cmd) && cmd->cmd_prefix_ >= 128) {
+ if (equal_params) {
+ dist_prefix = cmd->dist_prefix_;
+ } else {
+ uint32_t distance = CommandRestoreDistanceCode(cmd, orig_params);
+ if (distance > new_params->max_distance) {
+ return BROTLI_FALSE;
+ }
+ PrefixEncodeCopyDistance(distance,
+ new_params->num_direct_distance_codes,
+ new_params->distance_postfix_bits,
+ &dist_prefix,
+ &dist_extra);
+ }
+ HistogramAddDistance(&histo, dist_prefix & 0x3FF);
+ extra_bits += dist_prefix >> 10;
+ }
+ }
+
+ *cost = BrotliPopulationCostDistance(&histo) + extra_bits;
+ return BROTLI_TRUE;
+}
+
+void BrotliBuildMetaBlock(MemoryManager* m,
+ const uint8_t* ringbuffer,
+ const size_t pos,
+ const size_t mask,
+ BrotliEncoderParams* params,
+ uint8_t prev_byte,
+ uint8_t prev_byte2,
+ Command* cmds,
+ size_t num_commands,
+ ContextType literal_context_mode,
+ MetaBlockSplit* mb) {
+ /* Histogram ids need to fit in one byte. */
+ static const size_t kMaxNumberOfHistograms = 256;
+ HistogramDistance* distance_histograms;
+ HistogramLiteral* literal_histograms;
+ ContextType* literal_context_modes = NULL;
+ size_t literal_histograms_size;
+ size_t distance_histograms_size;
+ size_t i;
+ size_t literal_context_multiplier = 1;
+ uint32_t npostfix;
+ uint32_t ndirect_msb = 0;
+ BROTLI_BOOL check_orig = BROTLI_TRUE;
+ double best_dist_cost = 1e99;
+ BrotliEncoderParams orig_params = *params;
+ BrotliEncoderParams new_params = *params;
+
+ for (npostfix = 0; npostfix <= BROTLI_MAX_NPOSTFIX; npostfix++) {
+ for (; ndirect_msb < 16; ndirect_msb++) {
+ uint32_t ndirect = ndirect_msb << npostfix;
+ BROTLI_BOOL skip;
+ double dist_cost;
+ BrotliInitDistanceParams(&new_params, npostfix, ndirect);
+ if (npostfix == orig_params.dist.distance_postfix_bits &&
+ ndirect == orig_params.dist.num_direct_distance_codes) {
+ check_orig = BROTLI_FALSE;
+ }
+ skip = !ComputeDistanceCost(
+ cmds, num_commands,
+ &orig_params.dist, &new_params.dist, &dist_cost);
+ if (skip || (dist_cost > best_dist_cost)) {
+ break;
+ }
+ best_dist_cost = dist_cost;
+ params->dist = new_params.dist;
+ }
+ if (ndirect_msb > 0) ndirect_msb--;
+ ndirect_msb /= 2;
+ }
+ if (check_orig) {
+ double dist_cost;
+ ComputeDistanceCost(cmds, num_commands,
+ &orig_params.dist, &orig_params.dist, &dist_cost);
+ if (dist_cost < best_dist_cost) {
+ /* NB: currently unused; uncomment when more param tuning is added. */
+ /* best_dist_cost = dist_cost; */
+ params->dist = orig_params.dist;
+ }
+ }
+ RecomputeDistancePrefixes(cmds, num_commands,
+ &orig_params.dist, &params->dist);
+
+ BrotliSplitBlock(m, cmds, num_commands,
+ ringbuffer, pos, mask, params,
+ &mb->literal_split,
+ &mb->command_split,
+ &mb->distance_split);
+ if (BROTLI_IS_OOM(m)) return;
+
+ if (!params->disable_literal_context_modeling) {
+ literal_context_multiplier = 1 << BROTLI_LITERAL_CONTEXT_BITS;
+ literal_context_modes =
+ BROTLI_ALLOC(m, ContextType, mb->literal_split.num_types);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(literal_context_modes)) return;
+ for (i = 0; i < mb->literal_split.num_types; ++i) {
+ literal_context_modes[i] = literal_context_mode;
+ }
+ }
+
+ literal_histograms_size =
+ mb->literal_split.num_types * literal_context_multiplier;
+ literal_histograms =
+ BROTLI_ALLOC(m, HistogramLiteral, literal_histograms_size);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(literal_histograms)) return;
+ ClearHistogramsLiteral(literal_histograms, literal_histograms_size);
+
+ distance_histograms_size =
+ mb->distance_split.num_types << BROTLI_DISTANCE_CONTEXT_BITS;
+ distance_histograms =
+ BROTLI_ALLOC(m, HistogramDistance, distance_histograms_size);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(distance_histograms)) return;
+ ClearHistogramsDistance(distance_histograms, distance_histograms_size);
+
+ BROTLI_DCHECK(mb->command_histograms == 0);
+ mb->command_histograms_size = mb->command_split.num_types;
+ mb->command_histograms =
+ BROTLI_ALLOC(m, HistogramCommand, mb->command_histograms_size);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(mb->command_histograms)) return;
+ ClearHistogramsCommand(mb->command_histograms, mb->command_histograms_size);
+
+ BrotliBuildHistogramsWithContext(cmds, num_commands,
+ &mb->literal_split, &mb->command_split, &mb->distance_split,
+ ringbuffer, pos, mask, prev_byte, prev_byte2, literal_context_modes,
+ literal_histograms, mb->command_histograms, distance_histograms);
+ BROTLI_FREE(m, literal_context_modes);
+
+ BROTLI_DCHECK(mb->literal_context_map == 0);
+ mb->literal_context_map_size =
+ mb->literal_split.num_types << BROTLI_LITERAL_CONTEXT_BITS;
+ mb->literal_context_map =
+ BROTLI_ALLOC(m, uint32_t, mb->literal_context_map_size);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(mb->literal_context_map)) return;
+
+ BROTLI_DCHECK(mb->literal_histograms == 0);
+ mb->literal_histograms_size = mb->literal_context_map_size;
+ mb->literal_histograms =
+ BROTLI_ALLOC(m, HistogramLiteral, mb->literal_histograms_size);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(mb->literal_histograms)) return;
+
+ BrotliClusterHistogramsLiteral(m, literal_histograms, literal_histograms_size,
+ kMaxNumberOfHistograms, mb->literal_histograms,
+ &mb->literal_histograms_size, mb->literal_context_map);
+ if (BROTLI_IS_OOM(m)) return;
+ BROTLI_FREE(m, literal_histograms);
+
+ if (params->disable_literal_context_modeling) {
+ /* Distribute assignment to all contexts. */
+ for (i = mb->literal_split.num_types; i != 0;) {
+ size_t j = 0;
+ i--;
+ for (; j < (1 << BROTLI_LITERAL_CONTEXT_BITS); j++) {
+ mb->literal_context_map[(i << BROTLI_LITERAL_CONTEXT_BITS) + j] =
+ mb->literal_context_map[i];
+ }
+ }
+ }
+
+ BROTLI_DCHECK(mb->distance_context_map == 0);
+ mb->distance_context_map_size =
+ mb->distance_split.num_types << BROTLI_DISTANCE_CONTEXT_BITS;
+ mb->distance_context_map =
+ BROTLI_ALLOC(m, uint32_t, mb->distance_context_map_size);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(mb->distance_context_map)) return;
+
+ BROTLI_DCHECK(mb->distance_histograms == 0);
+ mb->distance_histograms_size = mb->distance_context_map_size;
+ mb->distance_histograms =
+ BROTLI_ALLOC(m, HistogramDistance, mb->distance_histograms_size);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(mb->distance_histograms)) return;
+
+ BrotliClusterHistogramsDistance(m, distance_histograms,
+ mb->distance_context_map_size,
+ kMaxNumberOfHistograms,
+ mb->distance_histograms,
+ &mb->distance_histograms_size,
+ mb->distance_context_map);
+ if (BROTLI_IS_OOM(m)) return;
+ BROTLI_FREE(m, distance_histograms);
+}
+
+#define FN(X) X ## Literal
+#include "./metablock_inc.h" /* NOLINT(build/include) */
+#undef FN
+
+#define FN(X) X ## Command
+#include "./metablock_inc.h" /* NOLINT(build/include) */
+#undef FN
+
+#define FN(X) X ## Distance
+#include "./metablock_inc.h" /* NOLINT(build/include) */
+#undef FN
+
+#define BROTLI_MAX_STATIC_CONTEXTS 13
+
+/* Greedy block splitter for one block category (literal, command or distance).
+ Gathers histograms for all context buckets. */
+typedef struct ContextBlockSplitter {
+ /* Alphabet size of particular block category. */
+ size_t alphabet_size_;
+ size_t num_contexts_;
+ size_t max_block_types_;
+ /* We collect at least this many symbols for each block. */
+ size_t min_block_size_;
+ /* We merge histograms A and B if
+ entropy(A+B) < entropy(A) + entropy(B) + split_threshold_,
+ where A is the current histogram and B is the histogram of the last or the
+ second last block type. */
+ double split_threshold_;
+
+ size_t num_blocks_;
+ BlockSplit* split_; /* not owned */
+ HistogramLiteral* histograms_; /* not owned */
+ size_t* histograms_size_; /* not owned */
+
+ /* The number of symbols that we want to collect before deciding on whether
+ or not to merge the block with a previous one or emit a new block. */
+ size_t target_block_size_;
+ /* The number of symbols in the current histogram. */
+ size_t block_size_;
+ /* Offset of the current histogram. */
+ size_t curr_histogram_ix_;
+ /* Offset of the histograms of the previous two block types. */
+ size_t last_histogram_ix_[2];
+ /* Entropy of the previous two block types. */
+ double last_entropy_[2 * BROTLI_MAX_STATIC_CONTEXTS];
+ /* The number of times we merged the current block with the last one. */
+ size_t merge_last_count_;
+} ContextBlockSplitter;
+
+static void InitContextBlockSplitter(
+ MemoryManager* m, ContextBlockSplitter* self, size_t alphabet_size,
+ size_t num_contexts, size_t min_block_size, double split_threshold,
+ size_t num_symbols, BlockSplit* split, HistogramLiteral** histograms,
+ size_t* histograms_size) {
+ size_t max_num_blocks = num_symbols / min_block_size + 1;
+ size_t max_num_types;
+ BROTLI_DCHECK(num_contexts <= BROTLI_MAX_STATIC_CONTEXTS);
+
+ self->alphabet_size_ = alphabet_size;
+ self->num_contexts_ = num_contexts;
+ self->max_block_types_ = BROTLI_MAX_NUMBER_OF_BLOCK_TYPES / num_contexts;
+ self->min_block_size_ = min_block_size;
+ self->split_threshold_ = split_threshold;
+ self->num_blocks_ = 0;
+ self->split_ = split;
+ self->histograms_size_ = histograms_size;
+ self->target_block_size_ = min_block_size;
+ self->block_size_ = 0;
+ self->curr_histogram_ix_ = 0;
+ self->merge_last_count_ = 0;
+
+ /* We have to allocate one more histogram than the maximum number of block
+ types for the current histogram when the meta-block is too big. */
+ max_num_types =
+ BROTLI_MIN(size_t, max_num_blocks, self->max_block_types_ + 1);
+ BROTLI_ENSURE_CAPACITY(m, uint8_t,
+ split->types, split->types_alloc_size, max_num_blocks);
+ BROTLI_ENSURE_CAPACITY(m, uint32_t,
+ split->lengths, split->lengths_alloc_size, max_num_blocks);
+ if (BROTLI_IS_OOM(m)) return;
+ split->num_blocks = max_num_blocks;
+ if (BROTLI_IS_OOM(m)) return;
+ BROTLI_DCHECK(*histograms == 0);
+ *histograms_size = max_num_types * num_contexts;
+ *histograms = BROTLI_ALLOC(m, HistogramLiteral, *histograms_size);
+ self->histograms_ = *histograms;
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(*histograms)) return;
+ /* Clear only current histogram. */
+ ClearHistogramsLiteral(&self->histograms_[0], num_contexts);
+ self->last_histogram_ix_[0] = self->last_histogram_ix_[1] = 0;
+}
+
+/* Does either of three things:
+ (1) emits the current block with a new block type;
+ (2) emits the current block with the type of the second last block;
+ (3) merges the current block with the last block. */
+static void ContextBlockSplitterFinishBlock(
+ ContextBlockSplitter* self, MemoryManager* m, BROTLI_BOOL is_final) {
+ BlockSplit* split = self->split_;
+ const size_t num_contexts = self->num_contexts_;
+ double* last_entropy = self->last_entropy_;
+ HistogramLiteral* histograms = self->histograms_;
+
+ if (self->block_size_ < self->min_block_size_) {
+ self->block_size_ = self->min_block_size_;
+ }
+ if (self->num_blocks_ == 0) {
+ size_t i;
+ /* Create first block. */
+ split->lengths[0] = (uint32_t)self->block_size_;
+ split->types[0] = 0;
+
+ for (i = 0; i < num_contexts; ++i) {
+ last_entropy[i] =
+ BitsEntropy(histograms[i].data_, self->alphabet_size_);
+ last_entropy[num_contexts + i] = last_entropy[i];
+ }
+ ++self->num_blocks_;
+ ++split->num_types;
+ self->curr_histogram_ix_ += num_contexts;
+ if (self->curr_histogram_ix_ < *self->histograms_size_) {
+ ClearHistogramsLiteral(
+ &self->histograms_[self->curr_histogram_ix_], self->num_contexts_);
+ }
+ self->block_size_ = 0;
+ } else if (self->block_size_ > 0) {
+ /* Try merging the set of histograms for the current block type with the
+ respective set of histograms for the last and second last block types.
+ Decide over the split based on the total reduction of entropy across
+ all contexts. */
+ double entropy[BROTLI_MAX_STATIC_CONTEXTS];
+ HistogramLiteral* combined_histo =
+ BROTLI_ALLOC(m, HistogramLiteral, 2 * num_contexts);
+ double combined_entropy[2 * BROTLI_MAX_STATIC_CONTEXTS];
+ double diff[2] = { 0.0 };
+ size_t i;
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(combined_histo)) return;
+ for (i = 0; i < num_contexts; ++i) {
+ size_t curr_histo_ix = self->curr_histogram_ix_ + i;
+ size_t j;
+ entropy[i] = BitsEntropy(histograms[curr_histo_ix].data_,
+ self->alphabet_size_);
+ for (j = 0; j < 2; ++j) {
+ size_t jx = j * num_contexts + i;
+ size_t last_histogram_ix = self->last_histogram_ix_[j] + i;
+ combined_histo[jx] = histograms[curr_histo_ix];
+ HistogramAddHistogramLiteral(&combined_histo[jx],
+ &histograms[last_histogram_ix]);
+ combined_entropy[jx] = BitsEntropy(
+ &combined_histo[jx].data_[0], self->alphabet_size_);
+ diff[j] += combined_entropy[jx] - entropy[i] - last_entropy[jx];
+ }
+ }
+
+ if (split->num_types < self->max_block_types_ &&
+ diff[0] > self->split_threshold_ &&
+ diff[1] > self->split_threshold_) {
+ /* Create new block. */
+ split->lengths[self->num_blocks_] = (uint32_t)self->block_size_;
+ split->types[self->num_blocks_] = (uint8_t)split->num_types;
+ self->last_histogram_ix_[1] = self->last_histogram_ix_[0];
+ self->last_histogram_ix_[0] = split->num_types * num_contexts;
+ for (i = 0; i < num_contexts; ++i) {
+ last_entropy[num_contexts + i] = last_entropy[i];
+ last_entropy[i] = entropy[i];
+ }
+ ++self->num_blocks_;
+ ++split->num_types;
+ self->curr_histogram_ix_ += num_contexts;
+ if (self->curr_histogram_ix_ < *self->histograms_size_) {
+ ClearHistogramsLiteral(
+ &self->histograms_[self->curr_histogram_ix_], self->num_contexts_);
+ }
+ self->block_size_ = 0;
+ self->merge_last_count_ = 0;
+ self->target_block_size_ = self->min_block_size_;
+ } else if (diff[1] < diff[0] - 20.0) {
+ /* Combine this block with second last block. */
+ split->lengths[self->num_blocks_] = (uint32_t)self->block_size_;
+ split->types[self->num_blocks_] = split->types[self->num_blocks_ - 2];
+ BROTLI_SWAP(size_t, self->last_histogram_ix_, 0, 1);
+ for (i = 0; i < num_contexts; ++i) {
+ histograms[self->last_histogram_ix_[0] + i] =
+ combined_histo[num_contexts + i];
+ last_entropy[num_contexts + i] = last_entropy[i];
+ last_entropy[i] = combined_entropy[num_contexts + i];
+ HistogramClearLiteral(&histograms[self->curr_histogram_ix_ + i]);
+ }
+ ++self->num_blocks_;
+ self->block_size_ = 0;
+ self->merge_last_count_ = 0;
+ self->target_block_size_ = self->min_block_size_;
+ } else {
+ /* Combine this block with last block. */
+ split->lengths[self->num_blocks_ - 1] += (uint32_t)self->block_size_;
+ for (i = 0; i < num_contexts; ++i) {
+ histograms[self->last_histogram_ix_[0] + i] = combined_histo[i];
+ last_entropy[i] = combined_entropy[i];
+ if (split->num_types == 1) {
+ last_entropy[num_contexts + i] = last_entropy[i];
+ }
+ HistogramClearLiteral(&histograms[self->curr_histogram_ix_ + i]);
+ }
+ self->block_size_ = 0;
+ if (++self->merge_last_count_ > 1) {
+ self->target_block_size_ += self->min_block_size_;
+ }
+ }
+ BROTLI_FREE(m, combined_histo);
+ }
+ if (is_final) {
+ *self->histograms_size_ = split->num_types * num_contexts;
+ split->num_blocks = self->num_blocks_;
+ }
+}
+
+/* Adds the next symbol to the current block type and context. When the
+ current block reaches the target size, decides on merging the block. */
+static void ContextBlockSplitterAddSymbol(
+ ContextBlockSplitter* self, MemoryManager* m,
+ size_t symbol, size_t context) {
+ HistogramAddLiteral(&self->histograms_[self->curr_histogram_ix_ + context],
+ symbol);
+ ++self->block_size_;
+ if (self->block_size_ == self->target_block_size_) {
+ ContextBlockSplitterFinishBlock(self, m, /* is_final = */ BROTLI_FALSE);
+ if (BROTLI_IS_OOM(m)) return;
+ }
+}
+
+static void MapStaticContexts(MemoryManager* m,
+ size_t num_contexts,
+ const uint32_t* static_context_map,
+ MetaBlockSplit* mb) {
+ size_t i;
+ BROTLI_DCHECK(mb->literal_context_map == 0);
+ mb->literal_context_map_size =
+ mb->literal_split.num_types << BROTLI_LITERAL_CONTEXT_BITS;
+ mb->literal_context_map =
+ BROTLI_ALLOC(m, uint32_t, mb->literal_context_map_size);
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(mb->literal_context_map)) return;
+
+ for (i = 0; i < mb->literal_split.num_types; ++i) {
+ uint32_t offset = (uint32_t)(i * num_contexts);
+ size_t j;
+ for (j = 0; j < (1u << BROTLI_LITERAL_CONTEXT_BITS); ++j) {
+ mb->literal_context_map[(i << BROTLI_LITERAL_CONTEXT_BITS) + j] =
+ offset + static_context_map[j];
+ }
+ }
+}
+
+static BROTLI_INLINE void BrotliBuildMetaBlockGreedyInternal(
+ MemoryManager* m, const uint8_t* ringbuffer, size_t pos, size_t mask,
+ uint8_t prev_byte, uint8_t prev_byte2, ContextLut literal_context_lut,
+ const size_t num_contexts, const uint32_t* static_context_map,
+ const Command* commands, size_t n_commands, MetaBlockSplit* mb) {
+ union {
+ BlockSplitterLiteral plain;
+ ContextBlockSplitter ctx;
+ } lit_blocks;
+ BlockSplitterCommand cmd_blocks;
+ BlockSplitterDistance dist_blocks;
+ size_t num_literals = 0;
+ size_t i;
+ for (i = 0; i < n_commands; ++i) {
+ num_literals += commands[i].insert_len_;
+ }
+
+ if (num_contexts == 1) {
+ InitBlockSplitterLiteral(m, &lit_blocks.plain, 256, 512, 400.0,
+ num_literals, &mb->literal_split, &mb->literal_histograms,
+ &mb->literal_histograms_size);
+ } else {
+ InitContextBlockSplitter(m, &lit_blocks.ctx, 256, num_contexts, 512, 400.0,
+ num_literals, &mb->literal_split, &mb->literal_histograms,
+ &mb->literal_histograms_size);
+ }
+ if (BROTLI_IS_OOM(m)) return;
+ InitBlockSplitterCommand(m, &cmd_blocks, BROTLI_NUM_COMMAND_SYMBOLS, 1024,
+ 500.0, n_commands, &mb->command_split, &mb->command_histograms,
+ &mb->command_histograms_size);
+ if (BROTLI_IS_OOM(m)) return;
+ InitBlockSplitterDistance(m, &dist_blocks, 64, 512, 100.0, n_commands,
+ &mb->distance_split, &mb->distance_histograms,
+ &mb->distance_histograms_size);
+ if (BROTLI_IS_OOM(m)) return;
+
+ for (i = 0; i < n_commands; ++i) {
+ const Command cmd = commands[i];
+ size_t j;
+ BlockSplitterAddSymbolCommand(&cmd_blocks, cmd.cmd_prefix_);
+ for (j = cmd.insert_len_; j != 0; --j) {
+ uint8_t literal = ringbuffer[pos & mask];
+ if (num_contexts == 1) {
+ BlockSplitterAddSymbolLiteral(&lit_blocks.plain, literal);
+ } else {
+ size_t context =
+ BROTLI_CONTEXT(prev_byte, prev_byte2, literal_context_lut);
+ ContextBlockSplitterAddSymbol(&lit_blocks.ctx, m, literal,
+ static_context_map[context]);
+ if (BROTLI_IS_OOM(m)) return;
+ }
+ prev_byte2 = prev_byte;
+ prev_byte = literal;
+ ++pos;
+ }
+ pos += CommandCopyLen(&cmd);
+ if (CommandCopyLen(&cmd)) {
+ prev_byte2 = ringbuffer[(pos - 2) & mask];
+ prev_byte = ringbuffer[(pos - 1) & mask];
+ if (cmd.cmd_prefix_ >= 128) {
+ BlockSplitterAddSymbolDistance(&dist_blocks, cmd.dist_prefix_ & 0x3FF);
+ }
+ }
+ }
+
+ if (num_contexts == 1) {
+ BlockSplitterFinishBlockLiteral(
+ &lit_blocks.plain, /* is_final = */ BROTLI_TRUE);
+ } else {
+ ContextBlockSplitterFinishBlock(
+ &lit_blocks.ctx, m, /* is_final = */ BROTLI_TRUE);
+ if (BROTLI_IS_OOM(m)) return;
+ }
+ BlockSplitterFinishBlockCommand(&cmd_blocks, /* is_final = */ BROTLI_TRUE);
+ BlockSplitterFinishBlockDistance(&dist_blocks, /* is_final = */ BROTLI_TRUE);
+
+ if (num_contexts > 1) {
+ MapStaticContexts(m, num_contexts, static_context_map, mb);
+ }
+}
+
+void BrotliBuildMetaBlockGreedy(MemoryManager* m,
+ const uint8_t* ringbuffer,
+ size_t pos,
+ size_t mask,
+ uint8_t prev_byte,
+ uint8_t prev_byte2,
+ ContextLut literal_context_lut,
+ size_t num_contexts,
+ const uint32_t* static_context_map,
+ const Command* commands,
+ size_t n_commands,
+ MetaBlockSplit* mb) {
+ if (num_contexts == 1) {
+ BrotliBuildMetaBlockGreedyInternal(m, ringbuffer, pos, mask, prev_byte,
+ prev_byte2, literal_context_lut, 1, NULL, commands, n_commands, mb);
+ } else {
+ BrotliBuildMetaBlockGreedyInternal(m, ringbuffer, pos, mask, prev_byte,
+ prev_byte2, literal_context_lut, num_contexts, static_context_map,
+ commands, n_commands, mb);
+ }
+}
+
+void BrotliOptimizeHistograms(uint32_t num_distance_codes,
+ MetaBlockSplit* mb) {
+ uint8_t good_for_rle[BROTLI_NUM_COMMAND_SYMBOLS];
+ size_t i;
+ for (i = 0; i < mb->literal_histograms_size; ++i) {
+ BrotliOptimizeHuffmanCountsForRle(256, mb->literal_histograms[i].data_,
+ good_for_rle);
+ }
+ for (i = 0; i < mb->command_histograms_size; ++i) {
+ BrotliOptimizeHuffmanCountsForRle(BROTLI_NUM_COMMAND_SYMBOLS,
+ mb->command_histograms[i].data_,
+ good_for_rle);
+ }
+ for (i = 0; i < mb->distance_histograms_size; ++i) {
+ BrotliOptimizeHuffmanCountsForRle(num_distance_codes,
+ mb->distance_histograms[i].data_,
+ good_for_rle);
+ }
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/metablock.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/metablock.h
new file mode 100644
index 000000000..334a79a44
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/metablock.h
@@ -0,0 +1,105 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Algorithms for distributing the literals and commands of a metablock between
+ block types and contexts. */
+
+#ifndef BROTLI_ENC_METABLOCK_H_
+#define BROTLI_ENC_METABLOCK_H_
+
+#include "../common/context.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./block_splitter.h"
+#include "./command.h"
+#include "./histogram.h"
+#include "./memory.h"
+#include "./quality.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+typedef struct MetaBlockSplit {
+ BlockSplit literal_split;
+ BlockSplit command_split;
+ BlockSplit distance_split;
+ uint32_t* literal_context_map;
+ size_t literal_context_map_size;
+ uint32_t* distance_context_map;
+ size_t distance_context_map_size;
+ HistogramLiteral* literal_histograms;
+ size_t literal_histograms_size;
+ HistogramCommand* command_histograms;
+ size_t command_histograms_size;
+ HistogramDistance* distance_histograms;
+ size_t distance_histograms_size;
+} MetaBlockSplit;
+
+static BROTLI_INLINE void InitMetaBlockSplit(MetaBlockSplit* mb) {
+ BrotliInitBlockSplit(&mb->literal_split);
+ BrotliInitBlockSplit(&mb->command_split);
+ BrotliInitBlockSplit(&mb->distance_split);
+ mb->literal_context_map = 0;
+ mb->literal_context_map_size = 0;
+ mb->distance_context_map = 0;
+ mb->distance_context_map_size = 0;
+ mb->literal_histograms = 0;
+ mb->literal_histograms_size = 0;
+ mb->command_histograms = 0;
+ mb->command_histograms_size = 0;
+ mb->distance_histograms = 0;
+ mb->distance_histograms_size = 0;
+}
+
+static BROTLI_INLINE void DestroyMetaBlockSplit(
+ MemoryManager* m, MetaBlockSplit* mb) {
+ BrotliDestroyBlockSplit(m, &mb->literal_split);
+ BrotliDestroyBlockSplit(m, &mb->command_split);
+ BrotliDestroyBlockSplit(m, &mb->distance_split);
+ BROTLI_FREE(m, mb->literal_context_map);
+ BROTLI_FREE(m, mb->distance_context_map);
+ BROTLI_FREE(m, mb->literal_histograms);
+ BROTLI_FREE(m, mb->command_histograms);
+ BROTLI_FREE(m, mb->distance_histograms);
+}
+
+/* Uses the slow shortest-path block splitter and does context clustering.
+ The distance parameters are dynamically selected based on the commands
+ which get recomputed under the new distance parameters. The new distance
+ parameters are stored into *params. */
+BROTLI_INTERNAL void BrotliBuildMetaBlock(MemoryManager* m,
+ const uint8_t* ringbuffer,
+ const size_t pos,
+ const size_t mask,
+ BrotliEncoderParams* params,
+ uint8_t prev_byte,
+ uint8_t prev_byte2,
+ Command* cmds,
+ size_t num_commands,
+ ContextType literal_context_mode,
+ MetaBlockSplit* mb);
+
+/* Uses a fast greedy block splitter that tries to merge current block with the
+ last or the second last block and uses a static context clustering which
+ is the same for all block types. */
+BROTLI_INTERNAL void BrotliBuildMetaBlockGreedy(
+ MemoryManager* m, const uint8_t* ringbuffer, size_t pos, size_t mask,
+ uint8_t prev_byte, uint8_t prev_byte2, ContextLut literal_context_lut,
+ size_t num_contexts, const uint32_t* static_context_map,
+ const Command* commands, size_t n_commands, MetaBlockSplit* mb);
+
+BROTLI_INTERNAL void BrotliOptimizeHistograms(uint32_t num_distance_codes,
+ MetaBlockSplit* mb);
+
+BROTLI_INTERNAL void BrotliInitDistanceParams(BrotliEncoderParams* params,
+ uint32_t npostfix, uint32_t ndirect);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_METABLOCK_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/metablock_inc.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/metablock_inc.h
new file mode 100644
index 000000000..ed507ef5e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/metablock_inc.h
@@ -0,0 +1,183 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: FN */
+
+#define HistogramType FN(Histogram)
+
+/* Greedy block splitter for one block category (literal, command or distance).
+*/
+typedef struct FN(BlockSplitter) {
+ /* Alphabet size of particular block category. */
+ size_t alphabet_size_;
+ /* We collect at least this many symbols for each block. */
+ size_t min_block_size_;
+ /* We merge histograms A and B if
+ entropy(A+B) < entropy(A) + entropy(B) + split_threshold_,
+ where A is the current histogram and B is the histogram of the last or the
+ second last block type. */
+ double split_threshold_;
+
+ size_t num_blocks_;
+ BlockSplit* split_; /* not owned */
+ HistogramType* histograms_; /* not owned */
+ size_t* histograms_size_; /* not owned */
+
+ /* The number of symbols that we want to collect before deciding on whether
+ or not to merge the block with a previous one or emit a new block. */
+ size_t target_block_size_;
+ /* The number of symbols in the current histogram. */
+ size_t block_size_;
+ /* Offset of the current histogram. */
+ size_t curr_histogram_ix_;
+ /* Offset of the histograms of the previous two block types. */
+ size_t last_histogram_ix_[2];
+ /* Entropy of the previous two block types. */
+ double last_entropy_[2];
+ /* The number of times we merged the current block with the last one. */
+ size_t merge_last_count_;
+} FN(BlockSplitter);
+
+static void FN(InitBlockSplitter)(
+ MemoryManager* m, FN(BlockSplitter)* self, size_t alphabet_size,
+ size_t min_block_size, double split_threshold, size_t num_symbols,
+ BlockSplit* split, HistogramType** histograms, size_t* histograms_size) {
+ size_t max_num_blocks = num_symbols / min_block_size + 1;
+ /* We have to allocate one more histogram than the maximum number of block
+ types for the current histogram when the meta-block is too big. */
+ size_t max_num_types =
+ BROTLI_MIN(size_t, max_num_blocks, BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + 1);
+ self->alphabet_size_ = alphabet_size;
+ self->min_block_size_ = min_block_size;
+ self->split_threshold_ = split_threshold;
+ self->num_blocks_ = 0;
+ self->split_ = split;
+ self->histograms_size_ = histograms_size;
+ self->target_block_size_ = min_block_size;
+ self->block_size_ = 0;
+ self->curr_histogram_ix_ = 0;
+ self->merge_last_count_ = 0;
+ BROTLI_ENSURE_CAPACITY(m, uint8_t,
+ split->types, split->types_alloc_size, max_num_blocks);
+ BROTLI_ENSURE_CAPACITY(m, uint32_t,
+ split->lengths, split->lengths_alloc_size, max_num_blocks);
+ if (BROTLI_IS_OOM(m)) return;
+ self->split_->num_blocks = max_num_blocks;
+ BROTLI_DCHECK(*histograms == 0);
+ *histograms_size = max_num_types;
+ *histograms = BROTLI_ALLOC(m, HistogramType, *histograms_size);
+ self->histograms_ = *histograms;
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(*histograms)) return;
+ /* Clear only current histogram. */
+ FN(HistogramClear)(&self->histograms_[0]);
+ self->last_histogram_ix_[0] = self->last_histogram_ix_[1] = 0;
+}
+
+/* Does either of three things:
+ (1) emits the current block with a new block type;
+ (2) emits the current block with the type of the second last block;
+ (3) merges the current block with the last block. */
+static void FN(BlockSplitterFinishBlock)(
+ FN(BlockSplitter)* self, BROTLI_BOOL is_final) {
+ BlockSplit* split = self->split_;
+ double* last_entropy = self->last_entropy_;
+ HistogramType* histograms = self->histograms_;
+ self->block_size_ =
+ BROTLI_MAX(size_t, self->block_size_, self->min_block_size_);
+ if (self->num_blocks_ == 0) {
+ /* Create first block. */
+ split->lengths[0] = (uint32_t)self->block_size_;
+ split->types[0] = 0;
+ last_entropy[0] =
+ BitsEntropy(histograms[0].data_, self->alphabet_size_);
+ last_entropy[1] = last_entropy[0];
+ ++self->num_blocks_;
+ ++split->num_types;
+ ++self->curr_histogram_ix_;
+ if (self->curr_histogram_ix_ < *self->histograms_size_)
+ FN(HistogramClear)(&histograms[self->curr_histogram_ix_]);
+ self->block_size_ = 0;
+ } else if (self->block_size_ > 0) {
+ double entropy = BitsEntropy(histograms[self->curr_histogram_ix_].data_,
+ self->alphabet_size_);
+ HistogramType combined_histo[2];
+ double combined_entropy[2];
+ double diff[2];
+ size_t j;
+ for (j = 0; j < 2; ++j) {
+ size_t last_histogram_ix = self->last_histogram_ix_[j];
+ combined_histo[j] = histograms[self->curr_histogram_ix_];
+ FN(HistogramAddHistogram)(&combined_histo[j],
+ &histograms[last_histogram_ix]);
+ combined_entropy[j] = BitsEntropy(
+ &combined_histo[j].data_[0], self->alphabet_size_);
+ diff[j] = combined_entropy[j] - entropy - last_entropy[j];
+ }
+
+ if (split->num_types < BROTLI_MAX_NUMBER_OF_BLOCK_TYPES &&
+ diff[0] > self->split_threshold_ &&
+ diff[1] > self->split_threshold_) {
+ /* Create new block. */
+ split->lengths[self->num_blocks_] = (uint32_t)self->block_size_;
+ split->types[self->num_blocks_] = (uint8_t)split->num_types;
+ self->last_histogram_ix_[1] = self->last_histogram_ix_[0];
+ self->last_histogram_ix_[0] = (uint8_t)split->num_types;
+ last_entropy[1] = last_entropy[0];
+ last_entropy[0] = entropy;
+ ++self->num_blocks_;
+ ++split->num_types;
+ ++self->curr_histogram_ix_;
+ if (self->curr_histogram_ix_ < *self->histograms_size_)
+ FN(HistogramClear)(&histograms[self->curr_histogram_ix_]);
+ self->block_size_ = 0;
+ self->merge_last_count_ = 0;
+ self->target_block_size_ = self->min_block_size_;
+ } else if (diff[1] < diff[0] - 20.0) {
+ /* Combine this block with second last block. */
+ split->lengths[self->num_blocks_] = (uint32_t)self->block_size_;
+ split->types[self->num_blocks_] = split->types[self->num_blocks_ - 2];
+ BROTLI_SWAP(size_t, self->last_histogram_ix_, 0, 1);
+ histograms[self->last_histogram_ix_[0]] = combined_histo[1];
+ last_entropy[1] = last_entropy[0];
+ last_entropy[0] = combined_entropy[1];
+ ++self->num_blocks_;
+ self->block_size_ = 0;
+ FN(HistogramClear)(&histograms[self->curr_histogram_ix_]);
+ self->merge_last_count_ = 0;
+ self->target_block_size_ = self->min_block_size_;
+ } else {
+ /* Combine this block with last block. */
+ split->lengths[self->num_blocks_ - 1] += (uint32_t)self->block_size_;
+ histograms[self->last_histogram_ix_[0]] = combined_histo[0];
+ last_entropy[0] = combined_entropy[0];
+ if (split->num_types == 1) {
+ last_entropy[1] = last_entropy[0];
+ }
+ self->block_size_ = 0;
+ FN(HistogramClear)(&histograms[self->curr_histogram_ix_]);
+ if (++self->merge_last_count_ > 1) {
+ self->target_block_size_ += self->min_block_size_;
+ }
+ }
+ }
+ if (is_final) {
+ *self->histograms_size_ = split->num_types;
+ split->num_blocks = self->num_blocks_;
+ }
+}
+
+/* Adds the next symbol to the current histogram. When the current histogram
+ reaches the target size, decides on merging the block. */
+static void FN(BlockSplitterAddSymbol)(FN(BlockSplitter)* self, size_t symbol) {
+ FN(HistogramAdd)(&self->histograms_[self->curr_histogram_ix_], symbol);
+ ++self->block_size_;
+ if (self->block_size_ == self->target_block_size_) {
+ FN(BlockSplitterFinishBlock)(self, /* is_final = */ BROTLI_FALSE);
+ }
+}
+
+#undef HistogramType
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/params.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/params.h
new file mode 100755
index 000000000..54a7f0073
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/params.h
@@ -0,0 +1,46 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Parameters for the Brotli encoder with chosen quality levels. */
+
+#ifndef BROTLI_ENC_PARAMS_H_
+#define BROTLI_ENC_PARAMS_H_
+
+#include <brotli/encode.h>
+#include "./encoder_dict.h"
+
+typedef struct BrotliHasherParams {
+ int type;
+ int bucket_bits;
+ int block_bits;
+ int hash_len;
+ int num_last_distances_to_check;
+} BrotliHasherParams;
+
+typedef struct BrotliDistanceParams {
+ uint32_t distance_postfix_bits;
+ uint32_t num_direct_distance_codes;
+ uint32_t alphabet_size_max;
+ uint32_t alphabet_size_limit;
+ size_t max_distance;
+} BrotliDistanceParams;
+
+/* Encoding parameters */
+typedef struct BrotliEncoderParams {
+ BrotliEncoderMode mode;
+ int quality;
+ int lgwin;
+ int lgblock;
+ size_t stream_offset;
+ size_t size_hint;
+ BROTLI_BOOL disable_literal_context_modeling;
+ BROTLI_BOOL large_window;
+ BrotliHasherParams hasher;
+ BrotliDistanceParams dist;
+ BrotliEncoderDictionary dictionary;
+} BrotliEncoderParams;
+
+#endif /* BROTLI_ENC_PARAMS_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/prefix.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/prefix.h
new file mode 100644
index 000000000..fd359a478
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/prefix.h
@@ -0,0 +1,53 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Functions for encoding of integers into prefix codes the amount of extra
+ bits, and the actual values of the extra bits. */
+
+#ifndef BROTLI_ENC_PREFIX_H_
+#define BROTLI_ENC_PREFIX_H_
+
+#include "../common/constants.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./fast_log.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* Here distance_code is an intermediate code, i.e. one of the special codes or
+ the actual distance increased by BROTLI_NUM_DISTANCE_SHORT_CODES - 1. */
+static BROTLI_INLINE void PrefixEncodeCopyDistance(size_t distance_code,
+ size_t num_direct_codes,
+ size_t postfix_bits,
+ uint16_t* code,
+ uint32_t* extra_bits) {
+ if (distance_code < BROTLI_NUM_DISTANCE_SHORT_CODES + num_direct_codes) {
+ *code = (uint16_t)distance_code;
+ *extra_bits = 0;
+ return;
+ } else {
+ size_t dist = ((size_t)1 << (postfix_bits + 2u)) +
+ (distance_code - BROTLI_NUM_DISTANCE_SHORT_CODES - num_direct_codes);
+ size_t bucket = Log2FloorNonZero(dist) - 1;
+ size_t postfix_mask = (1u << postfix_bits) - 1;
+ size_t postfix = dist & postfix_mask;
+ size_t prefix = (dist >> bucket) & 1;
+ size_t offset = (2 + prefix) << bucket;
+ size_t nbits = bucket - postfix_bits;
+ *code = (uint16_t)((nbits << 10) |
+ (BROTLI_NUM_DISTANCE_SHORT_CODES + num_direct_codes +
+ ((2 * (nbits - 1) + prefix) << postfix_bits) + postfix));
+ *extra_bits = (uint32_t)((dist - offset) >> postfix_bits);
+ }
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_PREFIX_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/quality.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/quality.h
new file mode 100644
index 000000000..5f4d03450
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/quality.h
@@ -0,0 +1,165 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Constants and formulas that affect speed-ratio trade-offs and thus define
+ quality levels. */
+
+#ifndef BROTLI_ENC_QUALITY_H_
+#define BROTLI_ENC_QUALITY_H_
+
+#include "../common/platform.h"
+#include <brotli/encode.h>
+#include "./params.h"
+
+#define FAST_ONE_PASS_COMPRESSION_QUALITY 0
+#define FAST_TWO_PASS_COMPRESSION_QUALITY 1
+#define ZOPFLIFICATION_QUALITY 10
+#define HQ_ZOPFLIFICATION_QUALITY 11
+
+#define MAX_QUALITY_FOR_STATIC_ENTROPY_CODES 2
+#define MIN_QUALITY_FOR_BLOCK_SPLIT 4
+#define MIN_QUALITY_FOR_NONZERO_DISTANCE_PARAMS 4
+#define MIN_QUALITY_FOR_OPTIMIZE_HISTOGRAMS 4
+#define MIN_QUALITY_FOR_EXTENSIVE_REFERENCE_SEARCH 5
+#define MIN_QUALITY_FOR_CONTEXT_MODELING 5
+#define MIN_QUALITY_FOR_HQ_CONTEXT_MODELING 7
+#define MIN_QUALITY_FOR_HQ_BLOCK_SPLITTING 10
+
+/* For quality below MIN_QUALITY_FOR_BLOCK_SPLIT there is no block splitting,
+ so we buffer at most this much literals and commands. */
+#define MAX_NUM_DELAYED_SYMBOLS 0x2FFF
+
+/* Returns hash-table size for quality levels 0 and 1. */
+static BROTLI_INLINE size_t MaxHashTableSize(int quality) {
+ return quality == FAST_ONE_PASS_COMPRESSION_QUALITY ? 1 << 15 : 1 << 17;
+}
+
+/* The maximum length for which the zopflification uses distinct distances. */
+#define MAX_ZOPFLI_LEN_QUALITY_10 150
+#define MAX_ZOPFLI_LEN_QUALITY_11 325
+
+/* Do not thoroughly search when a long copy is found. */
+#define BROTLI_LONG_COPY_QUICK_STEP 16384
+
+static BROTLI_INLINE size_t MaxZopfliLen(const BrotliEncoderParams* params) {
+ return params->quality <= 10 ?
+ MAX_ZOPFLI_LEN_QUALITY_10 :
+ MAX_ZOPFLI_LEN_QUALITY_11;
+}
+
+/* Number of best candidates to evaluate to expand Zopfli chain. */
+static BROTLI_INLINE size_t MaxZopfliCandidates(
+ const BrotliEncoderParams* params) {
+ return params->quality <= 10 ? 1 : 5;
+}
+
+static BROTLI_INLINE void SanitizeParams(BrotliEncoderParams* params) {
+ params->quality = BROTLI_MIN(int, BROTLI_MAX_QUALITY,
+ BROTLI_MAX(int, BROTLI_MIN_QUALITY, params->quality));
+ if (params->quality <= MAX_QUALITY_FOR_STATIC_ENTROPY_CODES) {
+ params->large_window = BROTLI_FALSE;
+ }
+ if (params->lgwin < BROTLI_MIN_WINDOW_BITS) {
+ params->lgwin = BROTLI_MIN_WINDOW_BITS;
+ } else {
+ int max_lgwin = params->large_window ? BROTLI_LARGE_MAX_WINDOW_BITS :
+ BROTLI_MAX_WINDOW_BITS;
+ if (params->lgwin > max_lgwin) params->lgwin = max_lgwin;
+ }
+}
+
+/* Returns optimized lg_block value. */
+static BROTLI_INLINE int ComputeLgBlock(const BrotliEncoderParams* params) {
+ int lgblock = params->lgblock;
+ if (params->quality == FAST_ONE_PASS_COMPRESSION_QUALITY ||
+ params->quality == FAST_TWO_PASS_COMPRESSION_QUALITY) {
+ lgblock = params->lgwin;
+ } else if (params->quality < MIN_QUALITY_FOR_BLOCK_SPLIT) {
+ lgblock = 14;
+ } else if (lgblock == 0) {
+ lgblock = 16;
+ if (params->quality >= 9 && params->lgwin > lgblock) {
+ lgblock = BROTLI_MIN(int, 18, params->lgwin);
+ }
+ } else {
+ lgblock = BROTLI_MIN(int, BROTLI_MAX_INPUT_BLOCK_BITS,
+ BROTLI_MAX(int, BROTLI_MIN_INPUT_BLOCK_BITS, lgblock));
+ }
+ return lgblock;
+}
+
+/* Returns log2 of the size of main ring buffer area.
+ Allocate at least lgwin + 1 bits for the ring buffer so that the newly
+ added block fits there completely and we still get lgwin bits and at least
+ read_block_size_bits + 1 bits because the copy tail length needs to be
+ smaller than ring-buffer size. */
+static BROTLI_INLINE int ComputeRbBits(const BrotliEncoderParams* params) {
+ return 1 + BROTLI_MAX(int, params->lgwin, params->lgblock);
+}
+
+static BROTLI_INLINE size_t MaxMetablockSize(
+ const BrotliEncoderParams* params) {
+ int bits =
+ BROTLI_MIN(int, ComputeRbBits(params), BROTLI_MAX_INPUT_BLOCK_BITS);
+ return (size_t)1 << bits;
+}
+
+/* When searching for backward references and have not seen matches for a long
+ time, we can skip some match lookups. Unsuccessful match lookups are very
+ expensive and this kind of a heuristic speeds up compression quite a lot.
+ At first 8 byte strides are taken and every second byte is put to hasher.
+ After 4x more literals stride by 16 bytes, every put 4-th byte to hasher.
+ Applied only to qualities 2 to 9. */
+static BROTLI_INLINE size_t LiteralSpreeLengthForSparseSearch(
+ const BrotliEncoderParams* params) {
+ return params->quality < 9 ? 64 : 512;
+}
+
+static BROTLI_INLINE void ChooseHasher(const BrotliEncoderParams* params,
+ BrotliHasherParams* hparams) {
+ if (params->quality > 9) {
+ hparams->type = 10;
+ } else if (params->quality == 4 && params->size_hint >= (1 << 20)) {
+ hparams->type = 54;
+ } else if (params->quality < 5) {
+ hparams->type = params->quality;
+ } else if (params->lgwin <= 16) {
+ hparams->type = params->quality < 7 ? 40 : params->quality < 9 ? 41 : 42;
+ } else if (params->size_hint >= (1 << 20) && params->lgwin >= 19) {
+ hparams->type = 6;
+ hparams->block_bits = params->quality - 1;
+ hparams->bucket_bits = 15;
+ hparams->hash_len = 5;
+ hparams->num_last_distances_to_check =
+ params->quality < 7 ? 4 : params->quality < 9 ? 10 : 16;
+ } else {
+ hparams->type = 5;
+ hparams->block_bits = params->quality - 1;
+ hparams->bucket_bits = params->quality < 7 ? 14 : 15;
+ hparams->num_last_distances_to_check =
+ params->quality < 7 ? 4 : params->quality < 9 ? 10 : 16;
+ }
+
+ if (params->lgwin > 24) {
+ /* Different hashers for large window brotli: not for qualities <= 2,
+ these are too fast for large window. Not for qualities >= 10: their
+ hasher already works well with large window. So the changes are:
+ H3 --> H35: for quality 3.
+ H54 --> H55: for quality 4 with size hint > 1MB
+ H6 --> H65: for qualities 5, 6, 7, 8, 9. */
+ if (hparams->type == 3) {
+ hparams->type = 35;
+ }
+ if (hparams->type == 54) {
+ hparams->type = 55;
+ }
+ if (hparams->type == 6) {
+ hparams->type = 65;
+ }
+ }
+}
+
+#endif /* BROTLI_ENC_QUALITY_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/ringbuffer.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/ringbuffer.h
new file mode 100644
index 000000000..8dce14803
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/ringbuffer.h
@@ -0,0 +1,167 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Sliding window over the input data. */
+
+#ifndef BROTLI_ENC_RINGBUFFER_H_
+#define BROTLI_ENC_RINGBUFFER_H_
+
+#include <string.h> /* memcpy */
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./memory.h"
+#include "./quality.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* A RingBuffer(window_bits, tail_bits) contains `1 << window_bits' bytes of
+ data in a circular manner: writing a byte writes it to:
+ `position() % (1 << window_bits)'.
+ For convenience, the RingBuffer array contains another copy of the
+ first `1 << tail_bits' bytes:
+ buffer_[i] == buffer_[i + (1 << window_bits)], if i < (1 << tail_bits),
+ and another copy of the last two bytes:
+ buffer_[-1] == buffer_[(1 << window_bits) - 1] and
+ buffer_[-2] == buffer_[(1 << window_bits) - 2]. */
+typedef struct RingBuffer {
+ /* Size of the ring-buffer is (1 << window_bits) + tail_size_. */
+ const uint32_t size_;
+ const uint32_t mask_;
+ const uint32_t tail_size_;
+ const uint32_t total_size_;
+
+ uint32_t cur_size_;
+ /* Position to write in the ring buffer. */
+ uint32_t pos_;
+ /* The actual ring buffer containing the copy of the last two bytes, the data,
+ and the copy of the beginning as a tail. */
+ uint8_t* data_;
+ /* The start of the ring-buffer. */
+ uint8_t* buffer_;
+} RingBuffer;
+
+static BROTLI_INLINE void RingBufferInit(RingBuffer* rb) {
+ rb->cur_size_ = 0;
+ rb->pos_ = 0;
+ rb->data_ = 0;
+ rb->buffer_ = 0;
+}
+
+static BROTLI_INLINE void RingBufferSetup(
+ const BrotliEncoderParams* params, RingBuffer* rb) {
+ int window_bits = ComputeRbBits(params);
+ int tail_bits = params->lgblock;
+ *(uint32_t*)&rb->size_ = 1u << window_bits;
+ *(uint32_t*)&rb->mask_ = (1u << window_bits) - 1;
+ *(uint32_t*)&rb->tail_size_ = 1u << tail_bits;
+ *(uint32_t*)&rb->total_size_ = rb->size_ + rb->tail_size_;
+}
+
+static BROTLI_INLINE void RingBufferFree(MemoryManager* m, RingBuffer* rb) {
+ BROTLI_FREE(m, rb->data_);
+}
+
+/* Allocates or re-allocates data_ to the given length + plus some slack
+ region before and after. Fills the slack regions with zeros. */
+static BROTLI_INLINE void RingBufferInitBuffer(
+ MemoryManager* m, const uint32_t buflen, RingBuffer* rb) {
+ static const size_t kSlackForEightByteHashingEverywhere = 7;
+ uint8_t* new_data = BROTLI_ALLOC(
+ m, uint8_t, 2 + buflen + kSlackForEightByteHashingEverywhere);
+ size_t i;
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(new_data)) return;
+ if (rb->data_) {
+ memcpy(new_data, rb->data_,
+ 2 + rb->cur_size_ + kSlackForEightByteHashingEverywhere);
+ BROTLI_FREE(m, rb->data_);
+ }
+ rb->data_ = new_data;
+ rb->cur_size_ = buflen;
+ rb->buffer_ = rb->data_ + 2;
+ rb->buffer_[-2] = rb->buffer_[-1] = 0;
+ for (i = 0; i < kSlackForEightByteHashingEverywhere; ++i) {
+ rb->buffer_[rb->cur_size_ + i] = 0;
+ }
+}
+
+static BROTLI_INLINE void RingBufferWriteTail(
+ const uint8_t* bytes, size_t n, RingBuffer* rb) {
+ const size_t masked_pos = rb->pos_ & rb->mask_;
+ if (BROTLI_PREDICT_FALSE(masked_pos < rb->tail_size_)) {
+ /* Just fill the tail buffer with the beginning data. */
+ const size_t p = rb->size_ + masked_pos;
+ memcpy(&rb->buffer_[p], bytes,
+ BROTLI_MIN(size_t, n, rb->tail_size_ - masked_pos));
+ }
+}
+
+/* Push bytes into the ring buffer. */
+static BROTLI_INLINE void RingBufferWrite(
+ MemoryManager* m, const uint8_t* bytes, size_t n, RingBuffer* rb) {
+ if (rb->pos_ == 0 && n < rb->tail_size_) {
+ /* Special case for the first write: to process the first block, we don't
+ need to allocate the whole ring-buffer and we don't need the tail
+ either. However, we do this memory usage optimization only if the
+ first write is less than the tail size, which is also the input block
+ size, otherwise it is likely that other blocks will follow and we
+ will need to reallocate to the full size anyway. */
+ rb->pos_ = (uint32_t)n;
+ RingBufferInitBuffer(m, rb->pos_, rb);
+ if (BROTLI_IS_OOM(m)) return;
+ memcpy(rb->buffer_, bytes, n);
+ return;
+ }
+ if (rb->cur_size_ < rb->total_size_) {
+ /* Lazily allocate the full buffer. */
+ RingBufferInitBuffer(m, rb->total_size_, rb);
+ if (BROTLI_IS_OOM(m)) return;
+ /* Initialize the last two bytes to zero, so that we don't have to worry
+ later when we copy the last two bytes to the first two positions. */
+ rb->buffer_[rb->size_ - 2] = 0;
+ rb->buffer_[rb->size_ - 1] = 0;
+ /* Initialize tail; might be touched by "best_len++" optimization when
+ ring buffer is "full". */
+ rb->buffer_[rb->size_] = 241;
+ }
+ {
+ const size_t masked_pos = rb->pos_ & rb->mask_;
+ /* The length of the writes is limited so that we do not need to worry
+ about a write */
+ RingBufferWriteTail(bytes, n, rb);
+ if (BROTLI_PREDICT_TRUE(masked_pos + n <= rb->size_)) {
+ /* A single write fits. */
+ memcpy(&rb->buffer_[masked_pos], bytes, n);
+ } else {
+ /* Split into two writes.
+ Copy into the end of the buffer, including the tail buffer. */
+ memcpy(&rb->buffer_[masked_pos], bytes,
+ BROTLI_MIN(size_t, n, rb->total_size_ - masked_pos));
+ /* Copy into the beginning of the buffer */
+ memcpy(&rb->buffer_[0], bytes + (rb->size_ - masked_pos),
+ n - (rb->size_ - masked_pos));
+ }
+ }
+ {
+ BROTLI_BOOL not_first_lap = (rb->pos_ & (1u << 31)) != 0;
+ uint32_t rb_pos_mask = (1u << 31) - 1;
+ rb->buffer_[-2] = rb->buffer_[rb->size_ - 2];
+ rb->buffer_[-1] = rb->buffer_[rb->size_ - 1];
+ rb->pos_ = (rb->pos_ & rb_pos_mask) + (uint32_t)(n & rb_pos_mask);
+ if (not_first_lap) {
+ /* Wrap, but preserve not-a-first-lap feature. */
+ rb->pos_ |= 1u << 31;
+ }
+ }
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_RINGBUFFER_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/static_dict.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/static_dict.c
new file mode 100644
index 000000000..7299ab720
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/static_dict.c
@@ -0,0 +1,486 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+#include "./static_dict.h"
+
+#include "../common/dictionary.h"
+#include "../common/platform.h"
+#include "../common/transform.h"
+#include "./encoder_dict.h"
+#include "./find_match_length.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+static BROTLI_INLINE uint32_t Hash(const uint8_t* data) {
+ uint32_t h = BROTLI_UNALIGNED_LOAD32LE(data) * kDictHashMul32;
+ /* The higher bits contain more mixture from the multiplication,
+ so we take our results from there. */
+ return h >> (32 - kDictNumBits);
+}
+
+static BROTLI_INLINE void AddMatch(size_t distance, size_t len, size_t len_code,
+ uint32_t* matches) {
+ uint32_t match = (uint32_t)((distance << 5) + len_code);
+ matches[len] = BROTLI_MIN(uint32_t, matches[len], match);
+}
+
+static BROTLI_INLINE size_t DictMatchLength(const BrotliDictionary* dictionary,
+ const uint8_t* data,
+ size_t id,
+ size_t len,
+ size_t maxlen) {
+ const size_t offset = dictionary->offsets_by_length[len] + len * id;
+ return FindMatchLengthWithLimit(&dictionary->data[offset], data,
+ BROTLI_MIN(size_t, len, maxlen));
+}
+
+static BROTLI_INLINE BROTLI_BOOL IsMatch(const BrotliDictionary* dictionary,
+ DictWord w, const uint8_t* data, size_t max_length) {
+ if (w.len > max_length) {
+ return BROTLI_FALSE;
+ } else {
+ const size_t offset = dictionary->offsets_by_length[w.len] +
+ (size_t)w.len * (size_t)w.idx;
+ const uint8_t* dict = &dictionary->data[offset];
+ if (w.transform == 0) {
+ /* Match against base dictionary word. */
+ return
+ TO_BROTLI_BOOL(FindMatchLengthWithLimit(dict, data, w.len) == w.len);
+ } else if (w.transform == 10) {
+ /* Match against uppercase first transform.
+ Note that there are only ASCII uppercase words in the lookup table. */
+ return TO_BROTLI_BOOL(dict[0] >= 'a' && dict[0] <= 'z' &&
+ (dict[0] ^ 32) == data[0] &&
+ FindMatchLengthWithLimit(&dict[1], &data[1], w.len - 1u) ==
+ w.len - 1u);
+ } else {
+ /* Match against uppercase all transform.
+ Note that there are only ASCII uppercase words in the lookup table. */
+ size_t i;
+ for (i = 0; i < w.len; ++i) {
+ if (dict[i] >= 'a' && dict[i] <= 'z') {
+ if ((dict[i] ^ 32) != data[i]) return BROTLI_FALSE;
+ } else {
+ if (dict[i] != data[i]) return BROTLI_FALSE;
+ }
+ }
+ return BROTLI_TRUE;
+ }
+ }
+}
+
+BROTLI_BOOL BrotliFindAllStaticDictionaryMatches(
+ const BrotliEncoderDictionary* dictionary, const uint8_t* data,
+ size_t min_length, size_t max_length, uint32_t* matches) {
+ BROTLI_BOOL has_found_match = BROTLI_FALSE;
+ {
+ size_t offset = dictionary->buckets[Hash(data)];
+ BROTLI_BOOL end = !offset;
+ while (!end) {
+ DictWord w = dictionary->dict_words[offset++];
+ const size_t l = w.len & 0x1F;
+ const size_t n = (size_t)1 << dictionary->words->size_bits_by_length[l];
+ const size_t id = w.idx;
+ end = !!(w.len & 0x80);
+ w.len = (uint8_t)l;
+ if (w.transform == 0) {
+ const size_t matchlen =
+ DictMatchLength(dictionary->words, data, id, l, max_length);
+ const uint8_t* s;
+ size_t minlen;
+ size_t maxlen;
+ size_t len;
+ /* Transform "" + BROTLI_TRANSFORM_IDENTITY + "" */
+ if (matchlen == l) {
+ AddMatch(id, l, l, matches);
+ has_found_match = BROTLI_TRUE;
+ }
+ /* Transforms "" + BROTLI_TRANSFORM_OMIT_LAST_1 + "" and
+ "" + BROTLI_TRANSFORM_OMIT_LAST_1 + "ing " */
+ if (matchlen >= l - 1) {
+ AddMatch(id + 12 * n, l - 1, l, matches);
+ if (l + 2 < max_length &&
+ data[l - 1] == 'i' && data[l] == 'n' && data[l + 1] == 'g' &&
+ data[l + 2] == ' ') {
+ AddMatch(id + 49 * n, l + 3, l, matches);
+ }
+ has_found_match = BROTLI_TRUE;
+ }
+ /* Transform "" + BROTLI_TRANSFORM_OMIT_LAST_# + "" (# = 2 .. 9) */
+ minlen = min_length;
+ if (l > 9) minlen = BROTLI_MAX(size_t, minlen, l - 9);
+ maxlen = BROTLI_MIN(size_t, matchlen, l - 2);
+ for (len = minlen; len <= maxlen; ++len) {
+ size_t cut = l - len;
+ size_t transform_id = (cut << 2) +
+ (size_t)((dictionary->cutoffTransforms >> (cut * 6)) & 0x3F);
+ AddMatch(id + transform_id * n, len, l, matches);
+ has_found_match = BROTLI_TRUE;
+ }
+ if (matchlen < l || l + 6 >= max_length) {
+ continue;
+ }
+ s = &data[l];
+ /* Transforms "" + BROTLI_TRANSFORM_IDENTITY + <suffix> */
+ if (s[0] == ' ') {
+ AddMatch(id + n, l + 1, l, matches);
+ if (s[1] == 'a') {
+ if (s[2] == ' ') {
+ AddMatch(id + 28 * n, l + 3, l, matches);
+ } else if (s[2] == 's') {
+ if (s[3] == ' ') AddMatch(id + 46 * n, l + 4, l, matches);
+ } else if (s[2] == 't') {
+ if (s[3] == ' ') AddMatch(id + 60 * n, l + 4, l, matches);
+ } else if (s[2] == 'n') {
+ if (s[3] == 'd' && s[4] == ' ') {
+ AddMatch(id + 10 * n, l + 5, l, matches);
+ }
+ }
+ } else if (s[1] == 'b') {
+ if (s[2] == 'y' && s[3] == ' ') {
+ AddMatch(id + 38 * n, l + 4, l, matches);
+ }
+ } else if (s[1] == 'i') {
+ if (s[2] == 'n') {
+ if (s[3] == ' ') AddMatch(id + 16 * n, l + 4, l, matches);
+ } else if (s[2] == 's') {
+ if (s[3] == ' ') AddMatch(id + 47 * n, l + 4, l, matches);
+ }
+ } else if (s[1] == 'f') {
+ if (s[2] == 'o') {
+ if (s[3] == 'r' && s[4] == ' ') {
+ AddMatch(id + 25 * n, l + 5, l, matches);
+ }
+ } else if (s[2] == 'r') {
+ if (s[3] == 'o' && s[4] == 'm' && s[5] == ' ') {
+ AddMatch(id + 37 * n, l + 6, l, matches);
+ }
+ }
+ } else if (s[1] == 'o') {
+ if (s[2] == 'f') {
+ if (s[3] == ' ') AddMatch(id + 8 * n, l + 4, l, matches);
+ } else if (s[2] == 'n') {
+ if (s[3] == ' ') AddMatch(id + 45 * n, l + 4, l, matches);
+ }
+ } else if (s[1] == 'n') {
+ if (s[2] == 'o' && s[3] == 't' && s[4] == ' ') {
+ AddMatch(id + 80 * n, l + 5, l, matches);
+ }
+ } else if (s[1] == 't') {
+ if (s[2] == 'h') {
+ if (s[3] == 'e') {
+ if (s[4] == ' ') AddMatch(id + 5 * n, l + 5, l, matches);
+ } else if (s[3] == 'a') {
+ if (s[4] == 't' && s[5] == ' ') {
+ AddMatch(id + 29 * n, l + 6, l, matches);
+ }
+ }
+ } else if (s[2] == 'o') {
+ if (s[3] == ' ') AddMatch(id + 17 * n, l + 4, l, matches);
+ }
+ } else if (s[1] == 'w') {
+ if (s[2] == 'i' && s[3] == 't' && s[4] == 'h' && s[5] == ' ') {
+ AddMatch(id + 35 * n, l + 6, l, matches);
+ }
+ }
+ } else if (s[0] == '"') {
+ AddMatch(id + 19 * n, l + 1, l, matches);
+ if (s[1] == '>') {
+ AddMatch(id + 21 * n, l + 2, l, matches);
+ }
+ } else if (s[0] == '.') {
+ AddMatch(id + 20 * n, l + 1, l, matches);
+ if (s[1] == ' ') {
+ AddMatch(id + 31 * n, l + 2, l, matches);
+ if (s[2] == 'T' && s[3] == 'h') {
+ if (s[4] == 'e') {
+ if (s[5] == ' ') AddMatch(id + 43 * n, l + 6, l, matches);
+ } else if (s[4] == 'i') {
+ if (s[5] == 's' && s[6] == ' ') {
+ AddMatch(id + 75 * n, l + 7, l, matches);
+ }
+ }
+ }
+ }
+ } else if (s[0] == ',') {
+ AddMatch(id + 76 * n, l + 1, l, matches);
+ if (s[1] == ' ') {
+ AddMatch(id + 14 * n, l + 2, l, matches);
+ }
+ } else if (s[0] == '\n') {
+ AddMatch(id + 22 * n, l + 1, l, matches);
+ if (s[1] == '\t') {
+ AddMatch(id + 50 * n, l + 2, l, matches);
+ }
+ } else if (s[0] == ']') {
+ AddMatch(id + 24 * n, l + 1, l, matches);
+ } else if (s[0] == '\'') {
+ AddMatch(id + 36 * n, l + 1, l, matches);
+ } else if (s[0] == ':') {
+ AddMatch(id + 51 * n, l + 1, l, matches);
+ } else if (s[0] == '(') {
+ AddMatch(id + 57 * n, l + 1, l, matches);
+ } else if (s[0] == '=') {
+ if (s[1] == '"') {
+ AddMatch(id + 70 * n, l + 2, l, matches);
+ } else if (s[1] == '\'') {
+ AddMatch(id + 86 * n, l + 2, l, matches);
+ }
+ } else if (s[0] == 'a') {
+ if (s[1] == 'l' && s[2] == ' ') {
+ AddMatch(id + 84 * n, l + 3, l, matches);
+ }
+ } else if (s[0] == 'e') {
+ if (s[1] == 'd') {
+ if (s[2] == ' ') AddMatch(id + 53 * n, l + 3, l, matches);
+ } else if (s[1] == 'r') {
+ if (s[2] == ' ') AddMatch(id + 82 * n, l + 3, l, matches);
+ } else if (s[1] == 's') {
+ if (s[2] == 't' && s[3] == ' ') {
+ AddMatch(id + 95 * n, l + 4, l, matches);
+ }
+ }
+ } else if (s[0] == 'f') {
+ if (s[1] == 'u' && s[2] == 'l' && s[3] == ' ') {
+ AddMatch(id + 90 * n, l + 4, l, matches);
+ }
+ } else if (s[0] == 'i') {
+ if (s[1] == 'v') {
+ if (s[2] == 'e' && s[3] == ' ') {
+ AddMatch(id + 92 * n, l + 4, l, matches);
+ }
+ } else if (s[1] == 'z') {
+ if (s[2] == 'e' && s[3] == ' ') {
+ AddMatch(id + 100 * n, l + 4, l, matches);
+ }
+ }
+ } else if (s[0] == 'l') {
+ if (s[1] == 'e') {
+ if (s[2] == 's' && s[3] == 's' && s[4] == ' ') {
+ AddMatch(id + 93 * n, l + 5, l, matches);
+ }
+ } else if (s[1] == 'y') {
+ if (s[2] == ' ') AddMatch(id + 61 * n, l + 3, l, matches);
+ }
+ } else if (s[0] == 'o') {
+ if (s[1] == 'u' && s[2] == 's' && s[3] == ' ') {
+ AddMatch(id + 106 * n, l + 4, l, matches);
+ }
+ }
+ } else {
+ /* Set is_all_caps=0 for BROTLI_TRANSFORM_UPPERCASE_FIRST and
+ is_all_caps=1 otherwise (BROTLI_TRANSFORM_UPPERCASE_ALL)
+ transform. */
+ const BROTLI_BOOL is_all_caps =
+ TO_BROTLI_BOOL(w.transform != BROTLI_TRANSFORM_UPPERCASE_FIRST);
+ const uint8_t* s;
+ if (!IsMatch(dictionary->words, w, data, max_length)) {
+ continue;
+ }
+ /* Transform "" + kUppercase{First,All} + "" */
+ AddMatch(id + (is_all_caps ? 44 : 9) * n, l, l, matches);
+ has_found_match = BROTLI_TRUE;
+ if (l + 1 >= max_length) {
+ continue;
+ }
+ /* Transforms "" + kUppercase{First,All} + <suffix> */
+ s = &data[l];
+ if (s[0] == ' ') {
+ AddMatch(id + (is_all_caps ? 68 : 4) * n, l + 1, l, matches);
+ } else if (s[0] == '"') {
+ AddMatch(id + (is_all_caps ? 87 : 66) * n, l + 1, l, matches);
+ if (s[1] == '>') {
+ AddMatch(id + (is_all_caps ? 97 : 69) * n, l + 2, l, matches);
+ }
+ } else if (s[0] == '.') {
+ AddMatch(id + (is_all_caps ? 101 : 79) * n, l + 1, l, matches);
+ if (s[1] == ' ') {
+ AddMatch(id + (is_all_caps ? 114 : 88) * n, l + 2, l, matches);
+ }
+ } else if (s[0] == ',') {
+ AddMatch(id + (is_all_caps ? 112 : 99) * n, l + 1, l, matches);
+ if (s[1] == ' ') {
+ AddMatch(id + (is_all_caps ? 107 : 58) * n, l + 2, l, matches);
+ }
+ } else if (s[0] == '\'') {
+ AddMatch(id + (is_all_caps ? 94 : 74) * n, l + 1, l, matches);
+ } else if (s[0] == '(') {
+ AddMatch(id + (is_all_caps ? 113 : 78) * n, l + 1, l, matches);
+ } else if (s[0] == '=') {
+ if (s[1] == '"') {
+ AddMatch(id + (is_all_caps ? 105 : 104) * n, l + 2, l, matches);
+ } else if (s[1] == '\'') {
+ AddMatch(id + (is_all_caps ? 116 : 108) * n, l + 2, l, matches);
+ }
+ }
+ }
+ }
+ }
+ /* Transforms with prefixes " " and "." */
+ if (max_length >= 5 && (data[0] == ' ' || data[0] == '.')) {
+ BROTLI_BOOL is_space = TO_BROTLI_BOOL(data[0] == ' ');
+ size_t offset = dictionary->buckets[Hash(&data[1])];
+ BROTLI_BOOL end = !offset;
+ while (!end) {
+ DictWord w = dictionary->dict_words[offset++];
+ const size_t l = w.len & 0x1F;
+ const size_t n = (size_t)1 << dictionary->words->size_bits_by_length[l];
+ const size_t id = w.idx;
+ end = !!(w.len & 0x80);
+ w.len = (uint8_t)l;
+ if (w.transform == 0) {
+ const uint8_t* s;
+ if (!IsMatch(dictionary->words, w, &data[1], max_length - 1)) {
+ continue;
+ }
+ /* Transforms " " + BROTLI_TRANSFORM_IDENTITY + "" and
+ "." + BROTLI_TRANSFORM_IDENTITY + "" */
+ AddMatch(id + (is_space ? 6 : 32) * n, l + 1, l, matches);
+ has_found_match = BROTLI_TRUE;
+ if (l + 2 >= max_length) {
+ continue;
+ }
+ /* Transforms " " + BROTLI_TRANSFORM_IDENTITY + <suffix> and
+ "." + BROTLI_TRANSFORM_IDENTITY + <suffix>
+ */
+ s = &data[l + 1];
+ if (s[0] == ' ') {
+ AddMatch(id + (is_space ? 2 : 77) * n, l + 2, l, matches);
+ } else if (s[0] == '(') {
+ AddMatch(id + (is_space ? 89 : 67) * n, l + 2, l, matches);
+ } else if (is_space) {
+ if (s[0] == ',') {
+ AddMatch(id + 103 * n, l + 2, l, matches);
+ if (s[1] == ' ') {
+ AddMatch(id + 33 * n, l + 3, l, matches);
+ }
+ } else if (s[0] == '.') {
+ AddMatch(id + 71 * n, l + 2, l, matches);
+ if (s[1] == ' ') {
+ AddMatch(id + 52 * n, l + 3, l, matches);
+ }
+ } else if (s[0] == '=') {
+ if (s[1] == '"') {
+ AddMatch(id + 81 * n, l + 3, l, matches);
+ } else if (s[1] == '\'') {
+ AddMatch(id + 98 * n, l + 3, l, matches);
+ }
+ }
+ }
+ } else if (is_space) {
+ /* Set is_all_caps=0 for BROTLI_TRANSFORM_UPPERCASE_FIRST and
+ is_all_caps=1 otherwise (BROTLI_TRANSFORM_UPPERCASE_ALL)
+ transform. */
+ const BROTLI_BOOL is_all_caps =
+ TO_BROTLI_BOOL(w.transform != BROTLI_TRANSFORM_UPPERCASE_FIRST);
+ const uint8_t* s;
+ if (!IsMatch(dictionary->words, w, &data[1], max_length - 1)) {
+ continue;
+ }
+ /* Transforms " " + kUppercase{First,All} + "" */
+ AddMatch(id + (is_all_caps ? 85 : 30) * n, l + 1, l, matches);
+ has_found_match = BROTLI_TRUE;
+ if (l + 2 >= max_length) {
+ continue;
+ }
+ /* Transforms " " + kUppercase{First,All} + <suffix> */
+ s = &data[l + 1];
+ if (s[0] == ' ') {
+ AddMatch(id + (is_all_caps ? 83 : 15) * n, l + 2, l, matches);
+ } else if (s[0] == ',') {
+ if (!is_all_caps) {
+ AddMatch(id + 109 * n, l + 2, l, matches);
+ }
+ if (s[1] == ' ') {
+ AddMatch(id + (is_all_caps ? 111 : 65) * n, l + 3, l, matches);
+ }
+ } else if (s[0] == '.') {
+ AddMatch(id + (is_all_caps ? 115 : 96) * n, l + 2, l, matches);
+ if (s[1] == ' ') {
+ AddMatch(id + (is_all_caps ? 117 : 91) * n, l + 3, l, matches);
+ }
+ } else if (s[0] == '=') {
+ if (s[1] == '"') {
+ AddMatch(id + (is_all_caps ? 110 : 118) * n, l + 3, l, matches);
+ } else if (s[1] == '\'') {
+ AddMatch(id + (is_all_caps ? 119 : 120) * n, l + 3, l, matches);
+ }
+ }
+ }
+ }
+ }
+ if (max_length >= 6) {
+ /* Transforms with prefixes "e ", "s ", ", " and "\xC2\xA0" */
+ if ((data[1] == ' ' &&
+ (data[0] == 'e' || data[0] == 's' || data[0] == ',')) ||
+ (data[0] == 0xC2 && data[1] == 0xA0)) {
+ size_t offset = dictionary->buckets[Hash(&data[2])];
+ BROTLI_BOOL end = !offset;
+ while (!end) {
+ DictWord w = dictionary->dict_words[offset++];
+ const size_t l = w.len & 0x1F;
+ const size_t n = (size_t)1 << dictionary->words->size_bits_by_length[l];
+ const size_t id = w.idx;
+ end = !!(w.len & 0x80);
+ w.len = (uint8_t)l;
+ if (w.transform == 0 &&
+ IsMatch(dictionary->words, w, &data[2], max_length - 2)) {
+ if (data[0] == 0xC2) {
+ AddMatch(id + 102 * n, l + 2, l, matches);
+ has_found_match = BROTLI_TRUE;
+ } else if (l + 2 < max_length && data[l + 2] == ' ') {
+ size_t t = data[0] == 'e' ? 18 : (data[0] == 's' ? 7 : 13);
+ AddMatch(id + t * n, l + 3, l, matches);
+ has_found_match = BROTLI_TRUE;
+ }
+ }
+ }
+ }
+ }
+ if (max_length >= 9) {
+ /* Transforms with prefixes " the " and ".com/" */
+ if ((data[0] == ' ' && data[1] == 't' && data[2] == 'h' &&
+ data[3] == 'e' && data[4] == ' ') ||
+ (data[0] == '.' && data[1] == 'c' && data[2] == 'o' &&
+ data[3] == 'm' && data[4] == '/')) {
+ size_t offset = dictionary->buckets[Hash(&data[5])];
+ BROTLI_BOOL end = !offset;
+ while (!end) {
+ DictWord w = dictionary->dict_words[offset++];
+ const size_t l = w.len & 0x1F;
+ const size_t n = (size_t)1 << dictionary->words->size_bits_by_length[l];
+ const size_t id = w.idx;
+ end = !!(w.len & 0x80);
+ w.len = (uint8_t)l;
+ if (w.transform == 0 &&
+ IsMatch(dictionary->words, w, &data[5], max_length - 5)) {
+ AddMatch(id + (data[0] == ' ' ? 41 : 72) * n, l + 5, l, matches);
+ has_found_match = BROTLI_TRUE;
+ if (l + 5 < max_length) {
+ const uint8_t* s = &data[l + 5];
+ if (data[0] == ' ') {
+ if (l + 8 < max_length &&
+ s[0] == ' ' && s[1] == 'o' && s[2] == 'f' && s[3] == ' ') {
+ AddMatch(id + 62 * n, l + 9, l, matches);
+ if (l + 12 < max_length &&
+ s[4] == 't' && s[5] == 'h' && s[6] == 'e' && s[7] == ' ') {
+ AddMatch(id + 73 * n, l + 13, l, matches);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return has_found_match;
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/static_dict.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/static_dict.h
new file mode 100644
index 000000000..6b5d4eb0c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/static_dict.h
@@ -0,0 +1,40 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Class to model the static dictionary. */
+
+#ifndef BROTLI_ENC_STATIC_DICT_H_
+#define BROTLI_ENC_STATIC_DICT_H_
+
+#include "../common/dictionary.h"
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./encoder_dict.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#define BROTLI_MAX_STATIC_DICTIONARY_MATCH_LEN 37
+static const uint32_t kInvalidMatch = 0xFFFFFFF;
+
+/* Matches data against static dictionary words, and for each length l,
+ for which a match is found, updates matches[l] to be the minimum possible
+ (distance << 5) + len_code.
+ Returns 1 if matches have been found, otherwise 0.
+ Prerequisites:
+ matches array is at least BROTLI_MAX_STATIC_DICTIONARY_MATCH_LEN + 1 long
+ all elements are initialized to kInvalidMatch */
+BROTLI_INTERNAL BROTLI_BOOL BrotliFindAllStaticDictionaryMatches(
+ const BrotliEncoderDictionary* dictionary,
+ const uint8_t* data, size_t min_length, size_t max_length,
+ uint32_t* matches);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_STATIC_DICT_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/static_dict_lut.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/static_dict_lut.h
new file mode 100644
index 000000000..e299cda6d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/static_dict_lut.h
@@ -0,0 +1,5864 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Lookup table for static dictionary and transforms. */
+
+#ifndef BROTLI_ENC_STATIC_DICT_LUT_H_
+#define BROTLI_ENC_STATIC_DICT_LUT_H_
+
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+typedef struct DictWord {
+ /* Highest bit is used to indicate end of bucket. */
+ uint8_t len;
+ uint8_t transform;
+ uint16_t idx;
+} DictWord;
+
+static const int kDictNumBits = 15;
+static const uint32_t kDictHashMul32 = 0x1E35A7BD;
+
+static const uint16_t kStaticDictionaryBuckets[32768] = {
+1,0,0,0,0,0,0,0,0,3,6,0,0,0,0,0,20,0,0,0,21,0,22,0,0,0,0,0,0,0,0,23,0,0,25,0,29,
+0,53,0,0,0,0,0,0,55,0,0,0,0,0,0,61,76,0,0,0,94,0,0,0,0,0,0,96,0,97,0,98,0,0,0,0,
+0,0,0,99,101,106,108,0,0,0,0,0,110,0,111,112,0,113,118,124,0,0,0,0,0,125,128,0,0
+,0,0,129,0,0,131,0,0,0,0,0,0,132,0,0,135,0,0,0,137,0,0,0,0,0,138,139,0,0,0,0,0,0
+,0,142,143,144,0,0,0,0,0,145,0,0,0,146,149,151,152,0,0,153,0,0,0,0,0,0,0,0,0,0,0
+,0,0,0,0,154,0,0,0,0,0,0,155,0,0,0,0,160,182,0,0,0,0,0,0,183,0,0,0,188,189,0,0,
+192,0,0,0,0,0,0,194,0,0,0,0,0,0,0,0,197,202,209,0,0,210,0,224,0,0,0,225,0,0,0,0,
+0,0,0,0,0,0,231,0,0,0,232,0,240,0,0,242,0,0,0,0,0,0,0,0,0,0,0,244,0,0,0,246,0,0,
+249,251,253,0,0,0,0,0,258,0,0,261,263,0,0,0,267,0,0,268,0,269,0,0,0,0,0,0,0,0,0,
+271,0,0,0,0,0,0,272,0,273,0,277,0,278,286,0,0,0,0,287,0,289,290,291,0,0,0,295,0,
+0,296,297,0,0,0,0,0,0,0,0,0,0,298,0,0,0,299,0,0,305,0,324,0,0,0,0,0,327,0,328,
+329,0,0,0,0,336,0,0,340,0,341,342,343,0,0,346,0,348,0,0,0,0,0,0,349,351,0,0,355,
+0,363,0,364,0,368,369,0,370,0,0,0,0,0,0,0,372,0,0,0,0,0,0,0,0,0,0,0,373,0,375,0,
+0,0,0,376,377,0,0,394,395,396,0,0,398,0,0,0,0,400,0,0,408,0,0,0,0,420,0,0,0,0,0,
+0,421,0,0,422,423,0,0,429,435,436,442,0,0,443,0,444,445,453,456,0,457,0,0,0,0,0,
+458,0,0,0,459,0,0,0,460,0,462,463,465,0,0,0,0,0,0,466,469,0,0,0,0,0,0,470,0,0,0,
+474,0,476,0,0,0,0,483,0,485,0,0,0,486,0,0,488,491,492,0,0,497,499,500,0,501,0,0,
+0,505,0,0,506,0,0,0,507,0,0,0,509,0,0,0,0,511,512,519,0,0,0,0,0,0,529,530,0,0,0,
+534,0,0,0,0,543,0,0,0,0,0,0,0,0,0,553,0,0,0,0,557,560,0,0,0,0,0,0,561,0,564,0,0,
+0,0,0,0,565,566,0,575,0,619,0,620,0,0,623,624,0,0,0,625,0,0,626,627,0,0,628,0,0,
+0,0,630,0,631,0,0,0,0,0,0,0,0,0,641,0,0,0,0,643,656,668,0,0,0,673,0,0,0,674,0,0,
+0,0,0,0,0,0,682,0,687,0,690,0,693,699,700,0,0,0,0,0,0,704,705,0,0,0,0,707,710,0,
+711,0,0,0,0,726,0,0,729,0,0,0,730,731,0,0,0,0,0,752,0,0,0,762,0,763,0,0,767,0,0,
+0,770,774,0,0,775,0,0,0,0,0,0,0,0,0,0,776,0,0,0,777,783,0,0,0,785,788,0,0,0,0,
+790,0,0,0,793,0,0,0,0,794,0,0,804,819,821,0,827,0,0,0,834,0,0,835,0,0,0,841,0,
+844,0,850,851,859,0,860,0,0,0,0,0,0,0,874,0,876,0,877,890,0,0,0,0,0,0,0,0,893,
+894,898,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,899,0,0,0,900,904,906,0,0,0,907,0,908,909,
+0,910,0,0,0,0,911,0,0,0,0,0,916,0,0,0,922,925,0,930,0,934,0,0,0,0,0,943,0,0,944,
+0,953,954,0,0,0,0,0,0,955,0,962,963,0,0,976,0,0,977,978,979,980,0,981,0,0,0,0,
+984,0,0,985,0,0,987,989,991,0,0,0,0,0,0,0,0,0,992,0,0,0,993,0,0,0,0,0,0,996,0,0,
+0,1000,0,0,0,0,0,1002,0,0,0,0,1005,1007,0,0,0,1009,0,0,0,1010,0,0,0,0,0,0,1011,0
+,1012,0,0,0,0,1014,1016,0,0,0,1020,0,1021,0,0,0,0,1022,0,0,0,1024,0,0,0,0,0,0,
+1025,0,0,1026,1027,0,0,0,0,0,1031,0,1033,0,0,0,0,1034,0,0,0,1037,1040,0,0,0,1042
+,1043,0,0,1053,0,1054,0,0,1057,0,0,0,1058,0,0,1060,0,0,0,0,0,0,0,1061,0,0,1062,0
+,0,0,0,1063,0,0,0,0,1064,0,0,0,0,0,1065,0,0,0,0,1066,1067,0,0,0,1069,1070,1072,0
+,0,0,0,0,0,1073,0,1075,0,0,0,0,0,0,1080,1084,0,0,0,0,1088,0,0,0,0,0,0,1094,0,
+1095,0,1107,0,0,0,1112,1114,0,1119,0,1122,0,0,1126,0,1129,0,1130,0,0,0,0,0,1132,
+0,0,0,0,0,0,1144,0,0,1145,1146,0,1148,1149,0,0,1150,1151,0,0,0,0,1152,0,1153,0,0
+,0,0,0,1154,0,1163,0,0,0,1164,0,0,0,0,0,1165,0,1167,0,1170,0,0,0,0,0,1171,1172,0
+,0,0,0,0,0,0,0,1173,1175,1177,0,1186,0,0,0,0,0,0,0,0,0,0,1195,0,0,1221,0,0,1224,
+0,0,1227,0,0,0,0,0,1228,1229,0,0,1230,0,0,0,0,0,0,0,0,0,1231,0,0,0,1233,0,0,1243
+,1244,1246,1248,0,0,0,0,1254,1255,1258,1259,0,0,0,1260,0,0,1261,0,0,0,1262,1264,
+0,0,1265,0,0,0,0,0,0,0,0,0,0,0,0,1266,0,1267,0,0,0,0,1273,1274,1276,1289,0,0,
+1291,1292,1293,0,0,1294,1295,1296,0,0,0,0,1302,0,1304,0,0,0,0,0,0,0,0,0,1311,
+1312,0,1314,0,1316,1320,1321,0,0,0,0,0,0,0,1322,1323,1324,0,1335,0,1336,0,0,0,0,
+1341,1342,0,1346,0,1357,0,0,0,1358,1360,0,0,0,0,0,0,1361,0,0,0,1362,1365,0,1366,
+0,0,0,0,0,0,0,1379,0,0,0,0,0,0,0,0,0,0,0,0,1386,0,1388,0,0,0,0,0,0,0,0,0,0,0,0,0
+,0,1395,0,0,0,0,1403,0,1405,0,0,1407,0,0,0,0,0,1408,1409,0,1410,0,0,0,1412,1413,
+1416,0,0,1429,1451,0,0,1454,0,0,0,0,0,0,0,1455,0,0,0,0,0,0,0,1456,0,0,0,0,1459,
+1460,1461,1475,0,0,0,0,0,0,1477,0,1480,0,1481,0,0,1486,0,0,1495,0,0,0,1496,0,0,
+1498,1499,1501,1520,1521,0,0,0,1526,0,0,0,0,1528,1529,0,1533,1536,0,0,0,1537,
+1538,1549,0,1550,1558,1559,1572,0,1573,0,0,0,0,0,0,0,0,0,1575,0,0,0,0,0,1579,0,
+1599,0,1603,0,1604,0,1605,0,0,0,0,0,1608,1610,0,0,0,0,1611,0,1615,0,1616,1618,0,
+1619,0,0,1622,0,0,0,0,1634,0,0,0,1635,0,0,0,1641,0,0,0,0,0,0,0,0,0,1643,0,0,0,
+1650,0,0,1652,0,0,0,0,0,1653,0,0,0,1654,0,0,0,0,1655,0,1662,0,0,1663,1664,0,0,
+1668,0,0,1669,1670,0,1672,1673,0,0,0,0,0,1674,0,0,0,1675,1676,1680,0,1682,0,0,
+1687,0,0,0,0,0,1704,0,0,1705,0,0,1721,0,0,0,0,1734,1735,0,0,0,0,1737,0,0,0,0,
+1739,0,0,1740,0,0,0,0,0,0,0,0,0,0,1741,1743,0,0,0,0,1745,0,0,0,1749,0,0,0,1751,0
+,0,0,0,0,0,1760,0,0,0,0,1765,0,0,0,0,0,1784,0,1785,1787,0,0,0,0,1788,1789,0,0,0,
+0,1790,1791,1793,0,1798,1799,0,0,0,0,1801,0,1803,1805,0,0,0,1806,1811,0,1812,
+1814,0,1821,0,0,0,0,0,1822,1833,0,0,0,0,0,0,1848,0,0,0,0,0,0,1857,0,0,0,1859,0,0
+,0,0,1861,0,0,0,0,0,0,0,1866,0,1921,1925,0,0,0,1929,1930,0,0,0,0,0,0,0,0,0,1931,
+0,0,0,0,1932,0,0,0,1934,0,0,0,0,0,0,0,0,1946,0,0,1948,0,0,0,0,1950,0,1957,0,1958
+,0,0,0,0,0,1965,1967,0,0,0,0,1968,0,1969,0,1971,1972,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+,0,1973,0,0,0,0,1975,0,0,0,0,1976,1979,0,1982,0,0,0,0,1984,1988,0,0,0,0,1990,
+2004,2008,0,0,0,2012,2013,0,0,0,0,0,0,0,0,0,0,2015,0,2016,2017,0,0,0,0,2021,0,0,
+2025,0,0,0,0,0,2029,2036,2040,0,2042,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2043,0,0,0,0,0,
+2045,0,0,0,0,0,0,0,2046,2047,0,2048,2049,0,2059,0,0,2063,0,2064,2065,0,0,2066,0,
+0,0,0,0,0,2069,0,0,0,0,2070,0,2071,0,2072,0,0,0,0,2080,2082,2083,0,0,0,0,0,2085,
+0,2086,2088,2089,2105,0,0,0,0,2107,0,0,2116,2117,0,2120,0,0,2122,0,0,0,0,0,2123,
+0,0,2125,2127,2128,0,0,0,2130,0,0,0,2137,2139,2140,2141,0,0,0,0,0,0,0,0,0,2144,
+2145,0,0,2146,2149,0,0,0,0,2150,0,0,2151,2158,0,2159,0,2160,0,0,0,0,0,0,2161,
+2162,0,0,2194,2202,0,0,0,0,0,0,2205,2217,0,2220,0,2221,0,2222,2224,0,0,0,0,2237,
+0,0,0,0,0,2238,0,2239,2241,0,0,2242,0,0,0,0,0,2243,0,0,0,0,0,0,2252,0,0,2253,0,0
+,0,2257,2258,0,0,0,2260,0,0,0,0,0,0,0,2262,0,2264,0,0,0,0,0,2269,2270,0,0,0,0,0,
+0,0,0,0,2271,0,2273,0,0,0,0,2277,0,0,0,0,2278,0,0,0,0,2279,0,2280,0,2283,0,0,0,0
+,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2287,0,0,0,0,0,0,0,2289,2290,0,0,0,0,2291,0,2292,0,
+0,0,2293,2295,2296,0,0,0,0,0,0,0,2298,0,0,0,0,0,2303,0,2305,0,0,2306,0,2307,0,0,
+0,0,0,0,0,0,0,0,0,0,2313,2314,2315,2316,0,0,2318,0,2319,0,2322,0,0,2323,0,2324,0
+,2326,0,0,0,0,0,0,0,2335,0,2336,2338,2339,0,2340,0,0,0,2355,0,2375,0,2382,2386,0
+,2387,0,0,2394,0,0,0,0,2395,0,2397,0,0,0,0,0,2398,0,0,0,0,0,0,0,2399,2402,2404,
+2408,2411,0,0,0,2413,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2415,0,0,2416,2417,2419,0,2420,
+0,0,0,0,0,2425,0,0,0,2426,0,0,0,0,0,0,0,0,0,0,0,0,2427,2428,0,2429,0,0,2430,2434
+,0,2436,0,0,0,0,0,0,2441,2442,0,2445,0,0,2446,2457,0,2459,0,0,2462,0,2464,0,2477
+,0,2478,2486,0,0,0,2491,0,0,2493,0,0,2494,0,2495,0,2513,2523,0,0,0,0,2524,0,0,0,
+0,0,0,2528,2529,2530,0,0,2531,0,2533,0,0,2534,2535,0,2536,2537,0,2538,0,2539,
+2540,0,0,0,2545,2546,0,0,0,0,0,0,0,2548,0,0,2549,0,2550,2555,0,0,0,0,0,2557,0,
+2560,0,0,0,0,0,0,0,0,0,0,0,2561,0,2576,0,0,0,0,0,0,0,0,0,2577,2578,0,0,0,2579,0,
+0,0,0,0,0,0,2580,0,0,0,0,2581,0,0,0,0,2583,0,2584,0,2588,2590,0,0,0,2591,0,0,0,0
+,2593,2594,0,2595,0,2601,2602,0,0,2603,0,2605,0,0,0,2606,2607,2611,0,2615,0,0,0,
+2617,0,0,0,0,0,0,0,0,0,0,0,0,0,2619,0,0,2620,0,0,0,2621,0,2623,0,2625,0,0,2628,
+2629,0,0,2635,2636,2637,0,0,2639,0,0,0,2642,0,0,0,0,2643,0,2644,0,2649,0,0,0,0,0
+,0,2655,2656,0,0,2657,0,0,0,0,0,2658,0,0,0,0,0,2659,0,0,0,0,2664,2685,0,2687,0,
+2688,0,0,2689,0,0,2694,0,2695,0,0,2698,0,2701,2706,0,0,0,2707,0,2709,2710,2711,0
+,0,0,2720,2730,2735,0,0,0,0,2738,2740,0,0,0,0,2747,0,0,0,0,0,0,2748,0,0,2749,0,0
+,0,0,0,2750,0,0,2752,2754,0,0,0,0,0,2758,0,0,0,0,2762,0,0,0,0,2763,0,0,0,0,0,0,0
+,2764,2767,0,0,0,0,2768,0,0,2770,0,0,0,0,0,0,0,2771,0,0,0,0,0,0,0,0,0,2772,0,0,0
+,0,0,2773,2776,0,0,2783,0,0,2784,0,2789,0,2790,0,0,0,2792,0,0,0,0,0,0,0,0,0,0,
+2793,2795,0,0,0,0,0,0,2796,0,0,0,0,0,0,2797,2799,0,0,0,0,2803,0,0,0,0,2806,0,
+2807,2808,2817,2819,0,0,0,0,0,2821,0,0,0,0,2822,2823,0,0,0,0,0,0,0,2824,0,0,2828
+,0,2834,0,0,0,0,0,0,2836,0,2838,0,0,2839,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2841,
+0,0,0,2842,0,0,0,0,0,2843,2844,0,0,0,0,2846,0,0,2847,0,2849,0,2853,0,0,0,0,0,
+2857,0,0,0,0,2858,0,2859,0,0,2860,0,2862,2868,0,0,0,0,2875,0,2876,0,0,2877,2878,
+2884,2889,2890,0,0,2891,0,0,2892,0,0,0,2906,2912,0,2913,0,0,0,0,0,0,0,0,2916,0,
+2934,0,0,0,0,0,2935,0,0,0,0,2939,0,2940,0,0,0,0,0,0,0,2941,0,0,0,2946,0,2949,0,0
+,2950,2954,2955,0,0,0,2959,2961,0,0,2962,0,2963,0,0,0,0,0,0,2964,2965,2966,2967,
+0,0,0,0,0,0,0,2969,0,0,0,0,0,2970,2975,0,2982,2983,2984,0,0,0,0,0,2989,0,0,2990,
+0,0,0,0,0,0,0,2991,0,0,0,0,0,0,0,0,2998,0,3000,3001,0,0,3002,0,0,0,3003,0,0,3012
+,0,0,3022,0,0,3024,0,0,3025,3027,0,0,0,3030,0,0,0,0,3034,3035,0,0,3036,0,3039,0,
+3049,0,0,3050,0,0,0,0,0,0,3051,0,3053,0,0,0,0,3057,0,3058,0,0,0,0,0,0,0,0,3063,0
+,0,3073,3074,3078,3079,0,3080,3086,0,0,0,0,0,0,0,0,3087,0,3092,0,3095,0,3099,0,0
+,0,3100,0,3101,3102,0,3122,0,0,0,3124,0,3125,0,0,0,0,0,0,3132,3134,0,0,3136,0,0,
+0,0,0,0,0,3147,0,0,3149,0,0,0,0,0,3150,3151,3152,0,0,0,0,3158,0,0,3160,0,0,3161,
+0,0,3162,0,3163,3166,3168,0,0,3169,3170,0,0,3171,0,0,0,0,0,0,0,3182,0,3184,0,0,
+3188,0,0,3194,0,0,0,0,0,0,3204,0,0,0,0,3209,0,0,0,0,0,0,0,0,0,0,0,3216,3217,0,0,
+0,0,0,0,0,3219,0,0,3220,3222,0,3223,0,0,0,0,3224,0,3225,3226,0,3228,3233,0,3239,
+3241,3242,0,0,3251,3252,3253,3255,0,0,0,0,0,0,0,0,3260,0,0,3261,0,0,0,3267,0,0,0
+,0,0,0,0,0,3271,0,0,0,3278,0,3282,0,0,0,3284,0,0,0,3285,3286,0,0,0,0,0,0,0,3287,
+3292,0,0,0,0,3294,3296,0,0,3299,3300,3301,0,3302,0,0,0,0,0,3304,3306,0,0,0,0,0,0
+,3308,0,0,0,0,0,0,0,0,0,3311,0,0,0,0,0,0,0,0,3312,3314,3315,0,3318,0,0,0,0,0,0,0
+,0,3319,0,0,0,0,0,3321,0,0,0,0,0,0,0,0,0,3322,0,0,3324,3325,0,0,3326,0,0,3328,
+3329,3331,0,0,3335,0,0,3337,0,3338,0,0,0,0,3343,3347,0,0,0,3348,0,0,3351,0,0,0,0
+,0,0,3354,0,0,0,0,0,0,0,0,0,0,3355,0,0,3365,3366,3367,0,0,0,0,0,0,3368,3369,0,
+3370,0,0,3373,0,0,3376,0,0,3377,0,3379,3387,0,0,0,0,0,3390,0,0,0,0,0,0,0,3402,0,
+3403,3436,3437,3439,0,0,3441,0,0,0,3442,0,0,3449,0,0,0,3450,0,0,0,0,0,0,0,3451,0
+,0,3452,0,3453,3456,0,3457,0,0,3458,0,3459,0,0,0,0,0,0,0,0,0,3460,0,0,3469,3470,
+0,0,3475,0,0,0,3480,3487,3489,0,3490,0,0,3491,3499,0,3500,0,0,3501,0,0,0,3502,0,
+3514,0,0,0,3516,3517,0,0,0,3518,0,0,0,0,3520,3521,3522,0,0,3526,3530,0,0,0,0,
+3531,0,0,0,0,3536,0,0,0,0,0,0,0,3539,3541,0,0,3542,3544,0,3547,3548,0,0,3550,0,
+3553,0,0,0,0,0,0,0,3554,0,3555,0,3558,0,3559,0,0,0,0,0,0,0,0,3563,0,3581,0,0,0,
+3599,0,0,0,3600,0,3601,0,3602,3603,0,0,3606,3608,0,3610,3611,0,0,0,0,0,0,0,0,0,
+3612,3616,3619,0,0,0,0,0,0,0,0,0,0,0,0,0,3624,3628,0,3629,3634,3635,0,0,0,0,0,0,
+3636,0,3637,0,0,3638,3651,0,0,0,0,0,0,3652,3653,0,0,0,0,3656,3657,0,0,0,0,0,3658
+,0,0,0,0,3659,0,3661,3663,3664,0,3665,0,3692,0,0,0,3694,3696,0,0,0,0,0,0,0,0,0,0
+,0,0,3698,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3700,0,0,3701,0,0,0,3708,3709,0,0,0,3711
+,3712,0,0,0,0,0,3723,0,3724,3725,0,0,3726,0,0,0,0,0,0,3728,3729,0,3734,3735,3737
+,0,0,0,3743,0,3745,0,0,3746,0,0,3747,3748,0,3757,0,3759,3766,3767,0,3768,0,0,0,0
+,3769,0,0,3771,0,3774,0,0,0,0,0,0,3775,0,0,0,0,0,0,3776,0,3777,3786,0,3788,3789,
+0,0,0,0,0,0,0,0,0,3791,0,3811,0,0,0,0,0,3814,3815,3816,3820,0,0,0,0,0,0,0,3821,0
+,0,3825,0,0,0,0,3835,0,0,3848,3849,0,0,0,0,3850,3851,3853,0,0,0,0,3859,0,3860,
+3862,0,0,0,0,0,3863,0,0,0,0,0,0,0,0,3873,0,3874,0,3875,3886,0,3887,0,0,0,0,3892,
+3913,0,3914,0,0,0,3925,3931,0,0,0,0,3934,3941,3942,0,0,0,0,3943,0,0,0,3944,0,0,0
+,0,0,3945,0,3947,0,0,0,3956,3957,0,0,0,0,0,0,0,0,0,3958,0,3959,3965,0,0,0,0,3966
+,0,0,0,3967,0,0,0,3968,3974,0,0,0,0,0,3975,3977,3978,0,0,0,0,3980,0,3985,0,0,0,0
+,0,0,0,0,3986,4011,0,0,4017,0,0,0,0,0,0,0,0,0,0,0,4018,0,0,0,0,4019,0,4023,0,0,0
+,4027,4028,0,0,0,0,0,0,0,0,4031,4034,0,0,4035,4037,4039,4040,0,0,0,0,0,4059,0,
+4060,4061,0,4062,4063,4066,0,0,4072,0,0,0,0,0,0,0,0,0,0,0,0,0,4088,0,0,0,0,0,
+4091,0,0,0,0,4094,4095,0,0,4096,0,0,0,0,0,4098,4099,0,0,0,4101,0,4104,0,0,0,4105
+,4108,0,4113,0,0,4115,4116,0,4126,0,0,4127,0,0,0,0,0,0,0,4128,4132,4133,0,4134,0
+,0,0,4137,0,0,4141,0,0,0,0,4144,4146,4147,0,0,0,0,4148,0,0,4311,0,0,0,4314,4329,
+0,4331,4332,0,4333,0,4334,0,0,0,4335,0,4336,0,0,0,4337,0,0,0,4342,4345,4346,4350
+,0,4351,4352,0,4354,4355,0,0,4364,0,0,0,0,4369,0,0,0,4373,0,4374,0,0,0,0,4377,0,
+0,0,0,4378,0,0,0,4380,0,0,0,4381,4382,0,0,0,0,0,0,0,4384,0,0,0,0,4385,0,0,0,4386
+,0,0,0,4391,4398,0,0,0,0,4407,4409,0,0,0,0,4410,0,0,4411,0,4414,4415,4418,0,4427
+,4428,4430,0,4431,0,4448,0,0,0,0,0,4449,0,0,0,4451,4452,0,4453,4454,0,4456,0,0,0
+,0,0,0,0,4459,0,4463,0,0,0,0,0,4466,0,4467,0,4469,0,0,0,0,0,0,0,0,0,0,0,0,0,4470
+,4471,0,4473,0,0,4475,0,0,0,0,4477,4478,0,0,0,4479,4481,0,4482,0,4484,0,0,0,0,0,
+0,0,4486,0,0,4488,0,0,4497,0,4508,0,0,4510,4511,0,4520,4523,0,4524,0,4525,0,4527
+,0,0,4528,0,0,0,0,4530,0,4531,0,0,4532,0,0,0,4533,0,0,0,0,0,4535,0,0,0,4536,0,0,
+0,0,0,4541,4543,4544,4545,4547,0,4548,0,0,0,0,4550,4551,0,4553,0,0,0,0,4562,0,0,
+4571,0,0,0,4574,0,0,0,4575,0,4576,0,4577,0,0,0,4581,0,0,0,0,0,4582,0,0,4586,0,0,
+0,4588,0,0,4597,0,4598,0,0,0,0,4616,4617,0,4618,0,0,0,0,4619,0,4620,0,0,4621,0,
+4624,0,0,0,0,0,4625,0,0,0,0,4657,0,4659,0,4667,0,0,0,4668,4670,0,4672,0,0,0,0,0,
+4673,4676,0,0,0,0,4687,0,0,0,0,4697,0,0,0,0,4699,0,4701,0,0,0,0,4702,0,0,4706,0,
+0,4713,0,0,0,4714,4715,4716,0,0,0,0,0,0,0,0,0,0,0,0,4717,0,0,4720,0,4721,4729,
+4735,0,0,0,4737,0,0,0,4739,0,0,0,4740,0,0,0,4741,0,0,0,0,0,4742,0,4745,4746,4747
+,0,0,0,0,0,0,0,0,4748,0,0,0,4749,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4751,
+4786,0,4787,0,4788,4796,0,0,4797,4798,0,4799,4806,4807,0,0,0,0,4809,4810,0,0,0,0
+,0,0,4811,0,0,0,0,0,4812,0,4813,0,0,4815,0,4821,4822,0,0,0,0,4823,0,0,0,0,0,0,0,
+0,0,0,4824,0,0,0,0,4826,0,0,0,4828,0,4829,0,0,0,4843,0,0,4847,0,4853,4855,4858,0
+,0,0,0,0,4859,0,4864,0,0,4879,0,0,0,0,4880,0,0,0,0,4881,0,4882,0,0,0,0,0,0,0,0,0
+,4883,0,0,0,0,4884,0,0,0,0,0,4886,4887,4888,4894,4896,0,4902,0,0,4905,0,0,4915,0
+,0,0,0,0,0,0,4916,4917,4919,4921,0,0,0,0,0,4926,0,0,0,0,4927,0,0,0,0,0,0,0,0,
+4929,0,4930,4931,0,4938,0,4952,0,4953,4957,4960,4964,0,0,0,0,0,0,0,5019,5020,
+5022,0,0,0,0,0,5023,0,0,0,5024,0,0,0,5025,0,0,0,0,5028,0,0,0,0,5029,5030,5031,0,
+5033,0,0,0,0,0,0,0,0,0,5034,5035,0,5036,0,0,5037,0,0,0,0,5038,0,0,5039,0,0,0,
+5041,5042,0,0,0,0,5044,5049,5054,0,5055,0,5057,0,0,0,5060,0,0,0,0,0,5063,0,5064,
+5065,0,5067,0,0,0,5068,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5076,0,0,0,0,0,0,
+0,5077,0,0,5078,5080,0,0,5083,0,0,0,0,0,0,0,0,5085,0,0,0,0,0,0,5098,5099,5101,
+5105,5107,0,5108,0,5109,0,0,0,0,0,0,0,5110,0,0,0,0,0,5117,5118,0,5121,0,5122,0,0
+,5130,0,0,0,5137,0,0,0,5148,0,0,0,0,0,0,0,5151,5154,0,0,0,5155,0,0,5156,5159,
+5161,0,0,0,0,5162,0,0,0,0,5163,5164,0,5166,0,0,0,0,0,0,0,0,0,0,5167,0,0,0,5172,0
+,0,0,0,0,0,5178,5179,0,0,5190,0,0,5191,5192,5194,0,0,5198,5201,0,0,0,0,0,5203,0,
+5206,5209,0,0,0,0,0,0,5213,0,5214,5216,0,0,0,0,0,5217,0,0,0,0,0,0,0,0,5218,5219,
+0,5231,0,0,5244,5249,0,5254,0,5255,0,0,5257,0,0,0,0,0,5258,0,5260,5270,0,5277,0,
+0,0,0,0,0,5280,5281,5282,5283,0,0,0,0,0,5284,0,5285,0,0,0,0,0,5287,5288,0,0,0,0,
+0,0,0,0,0,0,5289,5291,0,0,5294,0,0,5295,0,0,0,0,0,0,0,5304,0,0,5306,5307,5308,0,
+5309,0,0,5310,0,0,0,0,5311,5312,0,5313,0,0,0,0,0,5316,0,0,0,5317,0,0,0,0,0,0,0,0
+,0,5325,0,0,0,0,0,0,5326,0,5327,5329,0,5332,0,0,0,0,5338,0,0,0,0,0,0,0,0,5340,0,
+0,5341,0,0,0,5342,0,5343,5344,0,0,5345,0,0,0,0,0,0,5347,5348,0,0,0,0,0,0,0,0,0,
+5349,0,5350,0,5354,0,0,0,0,5358,0,0,5359,0,0,5361,0,0,5365,0,5367,0,5373,0,0,0,
+5379,0,0,0,5380,0,0,0,5382,0,5384,0,0,0,0,0,0,5385,0,0,0,0,5387,0,0,0,0,0,0,5388
+,5390,5393,0,0,0,0,0,0,0,0,0,0,0,5396,0,0,0,0,5397,5402,0,0,0,0,0,5403,0,0,0,
+5404,5405,0,0,0,0,0,0,0,0,0,0,0,0,5406,0,0,0,0,5410,0,0,5411,0,5415,0,0,0,0,5416
+,5434,0,0,0,0,0,0,0,0,0,0,0,5438,0,5440,0,0,0,0,0,0,5441,5442,0,0,0,5443,5444,
+5447,0,0,5448,5449,5451,0,0,0,5456,5457,0,0,0,5459,0,0,0,5461,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,5464,0,5466,0,0,5467,0,5470,0,0,5473,0,0,5474,0,0,5476,0,0,0,0,0,0,0,0
+,0,0,0,5477,0,0,0,0,0,0,0,5484,0,0,5485,5486,0,0,0,0,0,5488,0,0,0,0,0,0,0,5489,0
+,0,0,0,0,5507,0,0,0,5510,0,5511,0,0,5512,0,0,0,5513,0,5515,0,0,5516,5517,0,5518,
+0,0,5522,0,0,0,0,0,5534,5535,0,0,5536,0,5538,0,0,5543,0,5544,0,0,5545,0,5547,0,
+5557,0,0,5558,0,5560,5567,0,0,0,0,5568,0,0,0,5571,5573,0,5574,0,5575,0,0,0,0,
+5577,0,0,5598,0,0,0,0,0,0,0,0,0,5600,5609,0,0,0,0,5610,0,0,5612,0,5624,0,5625,0,
+0,0,5629,0,5641,0,5642,5643,0,0,0,0,0,0,5651,0,0,0,5652,5653,0,5661,5662,5678,0,
+5679,0,0,0,0,5685,5686,0,0,0,0,0,5690,5692,0,5703,0,0,0,0,0,5706,0,0,0,0,5707,0,
+0,0,0,0,0,5708,0,0,5709,0,5710,0,0,0,5712,0,5733,0,5734,5735,0,0,5744,5751,0,0,0
+,0,0,0,0,0,0,0,0,0,5752,0,5754,0,0,0,0,0,0,5757,5758,0,5760,5761,0,0,0,0,5763,
+5764,5765,0,5766,0,5767,5768,0,5770,0,0,0,0,5776,5780,0,0,0,0,5782,0,0,0,0,5784,
+0,0,5788,0,0,0,0,0,0,0,0,0,0,0,5797,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5799,0,0,5801,
+0,0,0,5811,0,0,0,0,0,0,5816,0,0,5827,0,0,0,0,0,0,0,0,5830,5831,0,0,5832,0,0,5833
+,0,5835,5844,5845,0,5846,0,0,0,0,0,5850,0,0,0,0,0,5852,0,5855,5857,0,0,5859,0,
+5861,0,0,5863,0,5865,0,0,0,5873,5875,0,0,0,5877,0,5879,0,0,0,5888,0,0,5889,5891,
+0,5894,0,0,0,0,0,0,5895,0,5897,0,0,0,0,0,0,5907,0,5911,0,0,5912,0,5913,5922,5924
+,0,5927,5928,0,0,0,0,5929,5930,0,5933,0,0,0,0,5949,0,0,5951,0,0,0,0,0,0,0,0,5953
+,0,0,5954,0,5959,5960,5961,0,5964,0,0,0,5976,5978,5987,5990,0,0,0,0,0,5991,0,
+5992,0,0,0,5994,5995,0,0,5996,0,0,6001,6003,0,0,0,0,6007,0,0,0,0,0,6008,0,0,6009
+,0,6010,0,0,0,6011,6015,0,6017,0,6019,0,6023,0,0,0,0,0,0,0,6025,0,0,0,0,0,0,0,0,
+0,0,6026,0,6030,0,0,6032,0,0,0,6033,6038,6040,0,0,0,6041,6045,0,0,6046,0,0,6053,
+0,0,6054,0,6055,0,0,0,0,0,0,6057,0,6063,0,0,0,6064,0,6066,6071,6072,0,0,0,0,0,0,
+6075,6076,0,0,6077,0,0,0,0,0,0,0,0,0,6078,6079,0,0,0,0,0,0,0,0,6080,0,6083,0,0,0
+,0,0,6084,0,0,6088,0,6089,0,0,6093,6105,0,0,6107,0,6110,0,0,0,6111,6125,6126,0,0
+,0,6129,0,0,0,0,6130,0,0,0,6131,6134,0,0,0,0,0,0,6142,0,0,0,0,0,6144,0,0,6146,
+6151,6153,0,6156,0,6163,0,6180,6181,0,0,0,0,0,6182,0,0,0,0,6184,6195,0,0,6206,0,
+6208,0,0,6212,6213,6214,0,6215,0,0,0,6228,0,0,0,6234,0,0,0,0,0,0,6235,6240,0,
+6242,6243,6244,0,6250,6255,0,0,0,0,0,6257,0,0,0,6258,6278,0,6284,0,0,0,6285,0,0,
+0,0,0,0,0,0,6286,0,0,0,6320,0,0,6322,6332,0,0,0,0,0,0,0,0,6334,0,0,0,0,0,0,0,
+6335,0,0,6337,0,6338,0,6339,6340,0,0,6356,6357,6369,0,0,0,6370,6371,6372,0,6373,
+0,0,0,0,0,6376,0,0,0,0,0,6382,6383,6384,0,0,0,0,6386,0,6389,6397,6400,6411,0,
+6414,0,0,0,0,0,0,0,6415,6416,0,0,0,0,0,0,6417,0,0,0,0,6418,0,0,0,0,0,0,0,6420,0,
+6421,6423,6425,0,6429,6430,0,6433,6438,0,0,0,0,0,0,0,0,0,0,6439,6440,0,0,6441,0,
+0,6444,0,0,0,0,6446,0,0,0,0,6447,6448,0,0,6450,0,0,0,6454,0,0,6455,0,6461,0,0,0,
+0,0,0,6462,0,0,6463,0,6464,0,6465,6467,0,0,0,6468,0,6479,6480,0,0,0,0,0,0,0,6481
+,0,0,6485,6487,0,0,0,0,0,0,6493,0,0,0,0,0,0,0,0,6494,6495,6496,0,0,0,0,0,6498,0,
+0,0,6507,6508,0,0,0,0,0,0,0,0,0,0,6511,6512,0,0,0,0,6513,0,0,0,6514,0,0,0,0,0,
+6516,0,0,6517,6518,0,0,0,6519,6520,6521,0,6523,0,0,0,0,6524,6528,0,6530,0,0,6532
+,0,6578,0,0,0,6583,0,6584,0,0,0,6587,0,0,0,6590,0,6591,0,0,0,0,0,6592,0,0,0,0,
+6593,6594,0,0,0,0,0,6599,6600,0,0,6601,6602,6604,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+6608,0,0,0,0,0,0,0,0,6610,6611,0,6615,0,6616,6618,6620,0,6637,0,0,0,0,6639,0,0,0
+,0,6641,0,6642,0,0,0,6647,0,6660,6663,0,6664,0,6666,6669,0,6675,6676,6677,0,0,0,
+0,0,0,0,0,0,6678,0,0,0,6679,0,6680,0,0,0,0,0,0,0,6693,0,0,0,0,0,0,0,0,0,6704,
+6705,6706,0,0,6711,6713,0,0,0,0,0,6716,0,0,0,6717,0,6719,6724,0,0,0,0,0,0,0,0,
+6725,6726,0,0,0,0,0,6728,6729,6735,0,6737,6742,0,0,6743,6750,0,6751,0,0,6752,
+6753,0,0,0,0,0,0,6754,0,0,0,0,0,6756,0,0,0,0,0,0,6763,0,0,6764,6765,0,0,0,6770,0
+,0,0,6776,6780,0,6781,0,0,0,6783,0,6784,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+6785,0,0,0,6792,0,0,0,6793,0,0,6802,0,0,0,0,0,6803,0,0,0,6804,0,0,0,6812,0,0,
+6823,0,6824,6839,0,0,0,0,6852,0,0,6854,0,6856,6857,0,0,0,0,0,0,0,0,0,6867,0,6868
+,6870,6872,0,0,0,6873,6874,0,0,0,0,0,6875,0,0,6877,0,0,0,0,0,0,0,6878,0,0,0,6879
+,0,6880,0,0,0,0,0,0,0,0,0,0,6887,0,6888,6891,6893,0,6895,0,0,0,0,0,0,0,0,6899,0,
+0,0,0,6901,0,0,0,0,6910,0,6911,0,0,6912,0,0,6913,6914,0,0,0,6915,0,0,0,6916,6919
+,0,0,0,0,0,0,6924,0,6925,0,0,0,6926,6927,6928,0,6929,0,6930,0,0,6931,6935,0,6936
+,0,0,0,0,6939,6940,6941,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6942,6948,6949,0,0,0,0,0,0
+,0,6952,6954,6963,6965,6966,0,0,6967,6968,0,0,0,0,0,0,0,0,0,6969,0,0,6970,6979,0
+,0,6980,0,0,6983,0,0,0,0,0,6984,0,0,0,0,0,0,0,6988,6990,6992,0,0,0,0,0,0,0,6995,
+0,0,0,7012,0,0,0,0,0,0,0,0,0,7019,0,0,0,0,0,0,0,0,7021,0,0,7022,7023,7028,0,7030
+,7033,0,0,0,0,0,0,7038,0,0,0,0,0,0,0,0,0,0,7039,0,0,0,0,0,7046,0,7047,0,0,0,0,0,
+0,0,0,0,0,0,7048,7052,0,0,0,0,0,7054,0,7060,0,0,0,0,7061,0,7065,0,0,0,0,7067,
+7069,0,7070,7071,7072,0,0,7078,0,7080,7081,0,7083,0,0,0,7084,7087,7088,0,0,7090,
+0,7093,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7107,0,0,7108,0,0,0,0,0,0,0,0,7110,0,7114,0
+,0,0,0,0,0,0,7115,0,7116,0,0,0,0,0,7117,0,0,7118,0,0,7124,0,7125,0,0,7126,0,0,0,
+0,7128,0,0,0,0,0,7129,0,7130,0,7132,7133,0,0,7134,0,0,7139,0,7148,7150,0,0,0,0,
+7152,0,0,0,7153,7156,7157,0,0,0,0,0,7158,0,0,0,0,0,0,0,0,0,0,7163,7165,7169,0,
+7171,0,0,0,0,0,0,0,0,0,7172,0,7173,7181,0,0,0,0,0,7182,7185,0,0,0,0,7187,0,7201,
+7204,0,0,0,0,0,7206,7207,0,0,0,0,7211,7216,0,7218,0,0,0,0,7226,7228,7230,7232,
+7233,7235,7237,0,0,0,0,7238,7241,0,7242,0,0,7247,0,0,0,7266,0,0,0,0,0,0,0,7289,0
+,0,7290,7291,0,0,7292,0,7297,0,0,0,0,0,0,0,0,0,0,7300,0,7301,0,0,0,0,0,0,0,0,0,0
+,0,0,7302,0,0,0,0,7305,0,0,0,0,7307,0,7308,0,7310,0,7335,0,0,0,0,0,0,0,7337,0,
+7343,7347,0,0,0,0,0,7348,0,7349,7350,7352,7354,0,0,0,0,7357,0,7358,7366,0,7367,
+7368,0,0,7373,0,0,0,7374,0,0,0,0,0,0,0,7376,0,0,0,7377,0,0,0,0,0,7378,0,7379,
+7380,0,0,0,0,0,7383,0,0,7386,0,0,0,0,7398,0,0,0,7399,7400,0,7401,0,0,0,0,0,0,0,
+7402,0,0,0,0,0,7405,0,0,0,0,0,7406,0,0,0,0,0,0,0,0,7421,7427,7429,0,0,0,7435,0,0
+,7436,0,0,0,7437,0,0,0,0,0,0,7438,7443,0,7446,0,7448,0,0,0,0,0,0,0,0,0,0,7456,0,
+0,0,0,0,7457,0,0,7461,0,0,0,0,0,7462,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7463,7466,7472,
+0,7476,0,0,7490,0,7491,0,0,7493,0,0,0,7498,7499,0,0,7508,0,0,0,0,0,7512,0,0,0,
+7513,7514,7516,0,0,0,0,7518,0,0,7519,7521,7522,0,0,0,7526,0,0,7529,0,0,7531,0,
+7536,0,7538,0,7539,0,0,7541,7542,7546,0,0,0,0,0,7547,0,7548,0,0,0,0,0,7550,0,0,
+7552,7553,0,0,0,0,0,0,0,0,0,0,7554,7563,0,7573,0,0,0,0,0,0,7574,7576,0,7578,7581
+,7583,0,0,0,7584,0,7587,0,0,0,0,0,7589,0,0,0,7594,0,0,7595,0,0,7600,7602,7610,0,
+0,0,0,0,7612,0,7613,7614,0,0,7615,0,0,7616,0,7620,0,7621,7622,0,7623,0,0,0,0,
+7626,0,0,0,0,7627,7629,7631,0,0,7633,0,0,0,0,0,7639,0,7640,7642,0,0,7643,0,0,0,0
+,7644,0,0,0,0,0,0,0,7645,0,0,0,0,0,7661,7662,7663,7665,0,7666,0,7667,0,7684,7688
+,7690,0,7691,0,0,0,0,0,0,7692,0,0,7700,0,7707,0,7708,0,7709,0,7721,0,0,0,7722,0,
+7724,0,0,0,0,0,0,7729,7731,0,7732,0,7733,7735,0,0,0,0,0,0,0,7739,0,0,7741,7745,0
+,7748,0,0,0,7751,0,0,0,7752,0,0,0,0,0,0,0,7753,0,0,7756,0,7757,0,7759,0,7760,0,0
+,0,0,7761,7768,0,0,7769,0,0,7770,0,0,7771,0,0,7772,0,0,7773,0,0,0,0,0,7778,7783,
+0,0,0,0,0,7784,7785,0,7790,0,0,0,0,7792,0,7798,0,0,0,0,0,7799,0,7810,0,0,7813,0,
+7814,0,7816,0,7818,7824,7825,7826,0,7828,7830,0,0,0,7840,0,7842,0,7843,0,0,0,0,
+7844,0,0,0,0,0,0,0,7846,0,0,0,0,0,7856,7857,7858,7862,0,7865,0,0,7866,0,0,7913,0
+,0,0,0,7914,0,0,7915,7917,7918,7919,0,7920,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7921,
+7922,0,7924,0,0,7925,0,0,7927,0,7930,7935,0,0,7937,0,0,0,0,0,0,7939,0,7940,0,0,0
+,0,0,7941,0,0,0,0,7945,0,0,0,0,7949,0,0,0,0,0,0,0,0,7950,0,7953,0,0,0,0,0,0,0,
+7968,0,0,0,0,7969,7972,7992,0,7993,0,0,0,0,0,0,0,0,0,0,0,7994,0,0,0,0,8007,8008,
+0,0,0,0,0,0,0,0,0,0,0,0,8010,0,0,0,8012,0,0,0,0,0,0,0,0,8018,0,8028,8029,0,0,
+8030,0,0,8032,8033,0,0,8034,8036,0,0,0,0,0,0,0,0,0,0,8037,0,0,0,8043,8052,8059,
+8060,0,0,8061,0,0,0,8062,0,8063,0,8064,0,8066,8068,0,0,0,8080,8081,0,8089,0,0,0,
+0,0,8092,0,0,0,0,0,0,8093,8110,0,0,0,0,0,0,0,8111,0,0,0,0,0,8112,8115,0,8117,0,0
+,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8120,8121,8122,8128,8129,8130,8131,0,0,8139,0,0,
+8144,0,0,0,0,8145,8146,8153,0,0,0,0,0,0,0,0,8154,0,8157,8160,8162,0,8164,8165,0,
+0,0,0,8166,8167,0,0,8179,0,0,0,8185,0,0,0,8186,0,0,8187,0,0,0,8188,0,0,0,0,0,
+8204,0,0,0,0,8210,0,0,0,0,0,8213,0,8214,0,0,8215,0,0,0,0,0,0,8218,0,0,0,0,0,0,0,
+0,0,8219,0,8221,0,0,8222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8225,0,0,0,8233,0,0,
+8242,0,0,0,0,0,0,0,0,0,0,0,8247,0,8248,8252,0,8256,8257,0,0,8261,0,8264,8265,0,0
+,0,0,8267,0,0,0,8269,0,0,0,0,0,0,0,0,0,8270,0,0,0,8278,0,8279,8283,0,0,8285,8286
+,8289,8292,0,0,0,0,8293,8295,8299,8300,8301,0,0,0,0,0,0,8304,8307,0,0,0,0,0,0,0,
+8321,0,0,0,8322,8323,8325,8326,8327,0,0,8332,8338,0,0,8340,0,0,0,0,0,8350,0,0,
+8351,0,8354,8355,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8360,8372,0,0,0,0,0,0,0,0,8377,0,0,
+0,0,8380,0,0,0,8383,0,8384,0,0,0,0,8386,8392,0,0,8394,0,0,0,0,0,0,0,8396,8397,0,
+8398,0,8399,0,0,0,0,0,8400,0,8401,8410,8411,0,8412,8413,8422,0,0,0,0,8423,0,0,0,
+0,8424,0,0,8425,0,0,0,0,0,0,0,8441,8442,0,0,0,0,0,0,8443,0,0,8444,0,8447,0,0,0,0
+,8451,0,8458,0,8462,0,0,8468,0,8469,0,0,0,8470,0,8473,8479,8480,0,0,0,0,8481,
+8483,0,0,0,0,0,0,0,0,0,8484,0,0,8490,0,0,0,0,0,0,8491,8493,8494,0,8528,0,0,0,0,0
+,0,0,8530,0,0,0,0,0,0,0,0,8534,8538,8540,0,0,8541,0,0,8545,0,8557,0,0,8569,8570,
+0,0,8571,8574,8575,8579,0,8583,0,0,0,0,8591,0,0,0,0,0,0,0,0,8606,0,8607,0,0,0,0,
+0,0,0,0,0,8608,0,0,8609,0,0,0,8610,0,0,0,8611,0,0,8613,8617,8621,0,0,8622,0,8623
+,0,8624,8625,0,0,0,0,0,0,0,0,0,8637,8638,8639,8650,0,0,0,0,8652,8654,8655,0,0,0,
+0,0,0,0,0,0,0,8656,0,0,0,0,0,8657,0,0,0,0,0,0,0,0,0,8658,0,0,8659,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,8660,0,0,0,0,0,0,8661,8663,8664,0,0,0,0,8665,0,8669,0,
+0,0,0,0,0,0,8671,8674,0,8684,0,8686,0,0,0,8689,0,0,0,8690,0,8706,0,0,0,0,0,0,0,0
+,0,0,0,8710,0,8711,8713,8714,8724,8727,8728,8733,8736,0,8737,8739,0,0,0,0,8742,
+8743,8745,8754,0,0,0,0,8756,0,0,0,0,0,0,8757,8760,0,0,0,0,0,8762,8763,8764,0,
+8766,8769,8770,8773,0,8774,0,8779,0,0,0,0,8780,0,0,8781,0,0,8783,0,0,0,0,0,0,0,0
+,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8784,0,0,0,0,0,0,0,0,8785,0,0,0,0,8786,0,0,0,0,8788
+,8790,0,0,0,8803,0,8813,8814,0,0,0,0,0,8815,8816,0,0,0,0,8818,0,0,0,0,8822,8828,
+8829,0,8831,0,0,0,0,8833,0,0,0,8834,0,0,0,8835,0,8836,0,0,0,8837,0,0,0,0,0,0,
+8838,8839,0,0,0,0,0,0,0,0,0,0,0,8840,0,0,0,8841,0,8842,0,0,0,8846,0,0,0,0,0,0,0,
+8847,0,8848,0,0,8864,0,0,8866,0,0,8870,8872,0,0,8873,8874,0,0,0,0,0,0,8875,0,
+8876,0,0,0,0,8896,8900,0,0,0,0,8901,0,0,0,0,0,8904,0,8907,0,0,0,0,8911,8912,8913
+,0,0,0,8914,0,8915,0,0,0,0,0,0,0,0,0,0,0,0,8916,0,0,0,8929,0,0,0,0,0,0,0,0,0,0,
+8930,0,8932,0,8943,0,0,0,8945,8947,0,0,0,0,8949,0,8950,0,8954,8957,0,0,8970,0,0,
+0,0,8971,0,8996,0,0,0,0,8997,9000,0,0,0,0,9001,9002,0,9004,9009,9024,0,0,0,0,0,0
+,0,0,0,0,0,0,9027,9082,0,0,9083,9089,0,0,0,0,0,0,9090,0,0,0,9092,0,0,9093,0,9095
+,0,0,9096,9097,9101,9102,0,0,0,0,0,0,0,0,9112,0,0,0,0,0,0,9114,0,0,9120,0,9121,
+9122,0,0,0,9123,9124,0,0,9125,0,0,9126,0,9127,0,0,9129,9131,0,0,0,9132,0,0,9136,
+0,9144,0,0,9148,0,0,0,0,0,0,9149,0,9152,9163,0,0,9165,0,0,0,0,0,0,0,0,0,0,0,0,0,
+9166,0,9169,0,0,0,0,0,0,0,9170,0,0,0,0,9172,0,9174,9175,9176,0,9177,0,0,0,0,0,0,
+0,0,9186,0,9187,0,0,0,9188,9189,0,0,9190,0,0,0,0,9191,0,0,0,9193,0,0,0,0,9197,
+9198,0,0,0,9208,9211,0,0,0,0,9216,9217,0,9220,0,0,0,0,9221,9222,9223,0,9224,9225
+,0,0,9227,0,9228,9229,0,0,9230,0,9232,0,9233,0,0,0,0,0,9234,9235,0,0,9237,0,0,0,
+0,0,0,0,0,9238,9240,0,0,9241,0,0,0,0,9244,0,0,0,0,9247,0,0,0,0,0,0,0,0,0,0,9248,
+0,0,0,9249,0,0,0,0,0,9250,0,0,0,0,9251,0,0,9252,9255,0,0,0,9256,0,0,0,0,0,0,0,
+9257,0,0,9258,0,0,0,0,0,0,9259,0,0,0,0,0,9262,9263,0,0,9265,9266,0,0,0,0,0,0,0,0
+,9268,9271,0,0,0,0,0,0,0,0,0,9273,0,0,0,9276,9277,9279,0,0,0,0,0,0,0,9280,0,0,
+9293,0,0,0,0,0,9297,9301,0,0,0,0,0,0,0,0,0,0,0,9308,9309,9313,9321,9322,0,9326,
+9327,0,0,9477,0,9479,0,0,0,0,9482,0,0,0,9483,0,9484,0,0,0,0,0,0,0,0,0,9485,0,0,
+9486,0,0,0,9489,0,0,0,0,9490,9491,0,0,0,0,9493,0,9495,9496,0,0,0,0,0,0,0,0,9500,
+0,9502,0,0,0,0,0,9504,9507,0,9509,0,9511,0,0,9513,0,0,0,0,0,0,0,0,9515,0,0,0,0,0
+,0,9516,9517,0,0,0,0,9532,0,0,9533,0,0,9538,0,9539,9540,0,0,0,0,9541,0,0,0,9542,
+0,0,0,0,0,0,0,0,9544,9545,0,9546,0,0,0,0,0,0,9547,9548,0,0,0,9550,0,9557,0,9558,
+0,9561,0,9563,9570,0,9572,9574,9575,0,0,0,9577,9592,0,0,9596,0,0,0,9598,0,9600,0
+,9601,0,0,0,0,0,0,9608,0,9638,9639,0,0,0,0,0,0,0,9641,0,0,9643,9644,9645,9646,0,
+0,0,9648,0,0,0,0,0,0,0,9650,9654,0,0,0,0,0,0,0,0,9655,0,0,0,0,0,9656,0,9657,0,0,
+0,0,9658,0,0,9659,0,0,9664,0,0,9665,0,9667,9669,0,0,0,0,0,0,0,0,0,0,0,0,9671,0,
+9673,9681,0,0,0,0,9682,9683,9684,0,0,0,0,9686,9698,0,0,9700,9701,9702,0,9703,
+9717,0,0,0,0,9718,0,9726,0,0,0,0,9727,0,0,0,9728,0,9742,0,9744,0,0,0,9750,0,9754
+,9755,0,0,0,0,0,9756,0,9757,9768,0,9769,0,0,0,9770,9771,0,9773,0,9774,0,9775,0,0
+,0,9776,9777,9784,0,0,0,9786,0,9789,0,0,0,0,9793,9794,0,0,0,9808,0,0,0,0,0,9811,
+0,0,0,0,0,0,0,0,0,0,0,0,9812,0,9820,0,9823,0,9828,0,0,0,0,9830,0,0,9833,9836,0,0
+,0,9840,0,0,0,9841,0,0,9842,0,9845,0,0,0,9847,9848,0,0,9855,0,0,0,0,0,0,9856,
+9863,9865,0,0,0,0,0,0,0,0,9866,9867,9868,9873,9875,0,0,0,0,0,0,9880,0,9886,0,0,0
+,9887,0,0,9891,0,0,0,0,0,0,0,9906,9907,9908,0,0,0,9909,0,0,0,0,0,0,9910,0,0,0,0,
+9913,0,0,0,0,9914,0,0,0,0,0,9922,0,0,0,0,9923,9925,0,0,0,0,0,0,9930,0,0,0,9931,0
+,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9932,0,9939,0,0,9940,9962,9966,0,9969,9970,0,0,9974
+,0,9979,9981,9982,0,0,0,9985,0,0,0,0,0,0,9987,0,0,0,0,0,0,0,9988,9993,0,0,9994,0
+,0,0,9997,0,10004,0,0,0,0,0,10007,10019,10020,10022,0,0,0,10031,0,0,0,0,0,10032,
+0,0,10034,0,10036,0,0,0,0,10038,0,10039,10040,10041,10042,0,0,0,0,0,10043,0,0,0,
+0,0,10045,10054,0,0,0,0,10055,0,0,10057,10058,0,0,0,0,0,0,10059,0,0,0,0,0,0,0,
+10060,0,0,0,0,0,0,0,10063,0,10066,0,0,0,10070,0,10072,0,0,10076,10077,0,0,10084,
+0,10087,10090,10091,0,0,0,10094,10097,0,0,0,0,0,0,10098,0,0,0,0,0,0,10103,0,
+10104,0,10108,0,0,0,0,0,0,0,0,10120,0,0,0,10122,0,0,10125,0,0,0,0,10127,10128,0,
+0,10134,0,10135,10136,0,10137,0,0,10147,0,10149,10150,0,0,10156,0,10158,10159,
+10160,10168,0,0,10171,0,10173,0,0,0,10176,0,0,0,0,10177,0,0,0,0,10178,0,0,0,0,
+10194,0,10202,0,0,10203,10204,0,10205,10206,0,10207,0,0,0,0,10209,0,0,0,0,0,0,0,
+10213,0,0,0,0,0,0,10217,0,10229,0,10230,10231,0,0,10232,0,0,10237,10238,10244,0,
+0,0,0,0,10250,0,10252,0,0,0,0,0,0,10255,0,0,10257,0,0,0,0,0,0,10258,0,10259,0,0,
+0,0,0,0,0,0,10260,0,0,0,0,0,0,0,10284,10288,10289,0,0,0,10290,0,10296,0,0,0,0,0,
+10297,0,0,0,0,0,0,10298,0,0,0,0,10299,10303,0,0,0,0,0,10306,0,0,0,10307,0,10308,
+0,0,0,0,10311,0,0,0,0,0,0,0,10315,10317,0,0,0,10318,10319,0,10321,0,10326,0,
+10328,0,0,0,0,10329,0,0,10331,0,10332,0,0,0,0,0,0,10334,0,0,10335,10338,0,0,0,0,
+0,10339,10349,0,0,0,0,0,0,10351,0,10353,0,0,0,0,0,0,10362,0,10368,0,10369,0,0,0,
+10372,10373,0,0,0,0,0,10374,0,0,0,10375,0,10376,0,0,10386,10388,10390,0,0,0,0,0,
+0,0,10391,0,0,10392,10394,0,0,10396,0,10397,0,10403,0,0,0,0,0,0,0,0,10404,0,
+10405,10410,0,0,10411,0,10412,0,0,0,0,0,0,0,10421,10422,10423,0,0,0,0,0,0,0,0,0,
+10425,0,0,10427,0,0,10430,0,0,0,0,0,10432,0,10433,10434,0,0,0,0,10436,10437,0,
+10438,0,10439,0,10444,10446,0,0,0,0,0,10448,0,0,0,0,0,10449,0,0,0,0,0,0,0,10451,
+0,10453,0,0,0,10454,10457,0,0,10459,0,10469,0,0,0,0,0,10472,10481,0,0,0,0,0,
+10482,10483,0,10492,0,0,0,0,0,0,0,0,0,0,10499,0,0,0,10502,0,0,10510,0,10521,
+10524,0,0,10525,10526,10528,0,0,0,0,0,0,0,0,10530,0,0,0,0,10533,0,10534,0,0,0,0,
+0,0,0,0,0,0,10535,10536,0,0,10544,0,10553,10556,0,10557,10559,0,0,0,0,0,10562,
+10563,10564,0,10565,0,0,0,10566,0,10567,0,0,0,0,10575,0,0,10576,0,10578,0,0,0,0,
+0,0,0,0,0,0,10585,10586,10587,10589,0,10590,0,0,10594,0,0,0,0,0,10598,0,0,10601,
+0,0,0,10602,0,10603,0,10604,0,10605,0,0,10607,0,10626,0,10627,0,0,0,0,0,10629,
+10630,10631,0,0,0,10646,0,0,0,10647,0,10650,0,10651,0,0,0,10652,10653,10655,0,
+10658,0,0,10659,0,10667,0,0,0,0,10669,0,0,0,0,0,0,0,0,0,10670,0,0,0,10671,0,0,0,
+0,10672,10673,0,10674,0,0,0,10676,0,0,0,0,0,0,10678,0,10682,0,0,10692,0,10697,0,
+0,0,0,10698,0,0,0,10700,0,0,0,0,0,10703,0,10704,0,0,0,0,0,0,0,10705,0,10715,
+10718,10720,0,0,10722,0,0,0,0,0,0,0,0,10723,0,0,0,0,10726,0,0,0,0,0,10727,10730,
+10743,0,0,0,0,0,0,10744,0,0,10745,0,0,0,0,0,0,10748,0,0,0,0,10750,0,0,10752,
+10753,0,0,0,10756,0,0,0,0,0,0,10758,0,0,0,10759,0,10769,0,0,10772,0,0,0,0,0,0,
+10773,0,0,0,10777,0,0,10779,0,0,0,0,0,0,0,0,10780,10784,0,0,0,10789,0,0,0,10791,
+0,0,0,0,0,0,0,0,0,10795,0,0,10796,0,10808,0,10809,0,0,0,10810,0,0,0,10812,0,0,
+10814,0,0,0,0,0,0,0,0,0,10815,0,0,0,0,10816,10817,0,0,0,0,10819,0,10820,0,0,0,0,
+10821,10822,10823,0,10826,10849,0,0,0,0,10850,0,0,10852,0,10853,0,0,10856,0,0,
+10857,10858,10859,10860,0,0,0,0,0,0,10863,0,10866,10867,10872,10890,0,0,10891,
+10892,0,0,0,0,0,10893,0,0,0,10896,10899,0,0,10900,10902,0,0,0,0,0,10903,0,0,0,0,
+0,0,0,0,0,0,0,0,10905,0,10906,0,0,0,0,10908,10911,0,10912,0,0,10916,0,0,0,0,0,
+10917,0,10918,0,0,0,10923,0,0,0,0,0,10924,0,0,10928,10929,0,0,10930,0,0,0,10932,
+0,0,0,0,10939,0,0,10945,0,0,0,10947,0,0,10948,0,0,0,0,0,0,0,0,0,0,0,0,10958,0,
+10960,10962,0,0,10964,0,0,0,10966,0,0,0,0,0,0,0,0,0,0,10967,0,0,0,10968,0,0,0,
+10973,0,0,0,0,0,10975,0,0,0,10976,10978,0,0,10982,10984,10987,0,0,10988,0,10989,
+0,0,10991,0,0,0,0,10992,0,0,0,10993,0,10995,0,0,0,10996,10997,0,0,0,10998,0,
+10999,0,11001,0,0,0,0,0,0,11010,11012,0,11013,11016,11017,0,0,11019,11020,11021,
+0,0,0,0,0,0,0,0,0,0,0,0,11022,0,0,11023,11029,0,0,0,0,11031,0,0,0,11034,0,0,0,0,
+11055,0,0,0,0,0,11056,11060,0,0,0,0,0,0,11061,0,0,11064,11065,0,11066,0,11069,0,
+11085,0,0,0,0,0,11086,0,0,0,11088,0,0,0,11094,0,0,0,11095,11096,0,0,0,0,0,0,
+11097,11098,0,0,0,0,0,0,11099,0,0,11102,11108,0,0,0,11109,0,11114,11119,0,11131,
+0,0,0,11142,0,0,11143,0,11146,0,11147,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11148,0,
+11149,11152,11153,11154,0,11156,0,11157,0,0,0,11158,0,0,11159,11160,0,0,0,0,0,0,
+0,0,0,0,0,0,11163,0,0,11164,11166,0,0,0,11172,11174,0,0,0,11176,0,0,0,0,0,11182,
+11183,0,0,0,11184,11187,0,0,11188,11189,0,0,0,0,0,0,11194,0,0,0,0,0,0,0,11200,
+11202,0,0,0,0,0,0,11203,0,11204,0,0,0,0,0,11205,0,0,0,11206,0,11207,0,0,11209,0,
+11211,0,11214,0,0,11231,0,0,0,11293,11295,0,0,11296,11297,11302,0,0,0,11307,0,0,
+0,0,11309,11310,0,11311,0,0,0,11313,0,11314,0,0,0,0,11334,0,11338,0,0,0,11339,0,
+0,0,0,0,11340,0,11341,11342,0,11344,0,11345,0,0,0,11348,11349,0,0,11350,0,0,0,
+11355,0,0,0,0,0,0,11356,0,11357,11370,0,0,11371,0,11374,11376,0,0,0,11377,0,0,
+11378,11383,0,11386,11399,0,11400,11406,0,0,0,11408,0,0,11409,11412,0,0,0,0,
+11417,0,0,0,11418,0,11421,0,11426,11429,0,0,0,0,0,11430,0,11437,0,11438,0,0,0,0,
+0,11440,11453,0,0,0,0,0,0,11454,0,0,0,0,11455,0,0,11456,11460,11461,11463,0,
+11469,0,11473,0,0,0,0,11474,0,0,0,11475,0,11476,11477,11480,0,0,0,0,11481,0,0,
+11484,0,0,11487,0,0,0,0,0,0,0,0,0,0,11497,0,0,11502,0,11509,0,0,11510,11511,
+11513,0,0,0,0,0,0,0,0,0,0,11515,0,0,0,0,11516,0,11520,11521,0,0,0,0,0,0,0,0,0,0,
+0,11529,11530,11531,11534,0,0,11543,0,0,0,0,0,11547,0,11548,0,0,0,0,0,11552,
+11556,0,11557,0,0,11559,0,11560,0,0,0,0,0,0,11561,0,0,11563,11564,0,11565,0,0,0,
+0,11567,0,0,0,11569,0,11574,0,11575,0,0,0,11577,0,11578,0,0,0,11580,11581,0,0,0,
+11582,11584,0,0,0,0,0,0,0,11587,0,11588,11591,0,11595,0,0,0,0,0,0,0,0,11596,0,
+11597,0,0,0,0,11598,11601,0,0,0,11602,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11603,
+11604,0,11606,0,0,11608,0,0,0,0,11610,0,0,11611,0,0,0,0,11613,0,11622,0,0,0,
+11623,0,0,0,0,11625,0,0,11626,11627,11628,11630,0,0,0,0,0,0,11639,0,0,11646,0,
+11648,11649,0,11650,0,0,0,0,0,0,0,0,0,11651,0,0,11652,11653,11656,0,0,11677,
+11679,0,0,0,0,11680,0,0,11681,0,11685,0,0,0,0,0,0,0,0,11688,0,0,0,11716,0,11719,
+0,0,0,0,0,11721,0,0,11724,11743,0,0,0,0,0,0,0,0,11745,11748,11750,0,0,0,0,0,
+11751,0,0,0,11752,11754,0,11755,0,0,0,0,0,0,0,11759,0,0,0,0,0,0,11760,0,0,0,
+11761,0,0,0,0,0,0,11766,11767,0,11772,11773,0,11774,0,0,11775,0,11777,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,11778,11780,0,0,0,0,0,0,0,11783,0,11784,0,0,0,11785,
+0,0,0,11786,0,0,0,0,11788,0,0,11789,11791,11792,0,0,0,0,11795,11834,11835,11836,
+0,0,11837,0,0,0,11838,0,0,11846,11851,0,11852,0,11869,0,0,0,11871,0,0,0,11872,
+11874,0,0,0,0,0,0,11875,0,11876,11877,0,0,0,0,0,0,0,0,0,0,11883,0,0,0,0,0,0,0,
+11884,0,11885,0,11886,0,0,11887,0,11894,11895,11897,11909,11910,0,11912,11918,0,
+0,11920,0,11922,11924,11927,11928,0,0,0,0,11929,0,11934,0,0,0,0,0,11941,11943,
+11944,0,11945,0,0,0,0,11948,11949,0,0,0,0,11953,0,11954,0,11955,0,11956,0,0,0,0,
+0,11957,0,0,11959,0,0,0,0,0,0,0,0,11961,0,0,0,0,0,11978,0,0,0,11979,11980,11986,
+11987,0,11992,0,0,0,0,0,11993,0,0,0,11994,0,11999,12004,12005,12006,0,0,0,0,0,
+12011,0,0,12012,12014,0,0,12015,0,0,12019,12028,0,0,12029,0,0,12032,12033,0,0,0,
+0,12034,0,12041,12043,0,0,12044,0,0,0,0,0,0,0,12046,0,0,0,0,0,0,0,12054,12055,0,
+12056,0,0,0,12060,12064,0,0,0,0,0,12065,12067,12068,0,0,0,0,0,0,0,0,12074,0,0,0,
+12075,12076,0,0,0,12079,0,12081,12086,12087,0,0,12088,0,0,0,0,12089,0,12092,0,0,
+0,0,12097,0,0,0,0,0,0,0,0,12098,0,0,0,0,0,0,0,0,0,0,0,0,0,12102,12103,12104,
+12111,0,0,12114,12116,0,0,0,12118,0,0,0,12119,12120,12128,0,0,0,0,12130,0,0,0,0,
+0,0,12131,0,0,0,12132,12134,0,0,0,0,12137,0,12139,0,12141,0,0,12142,0,0,0,12144,
+0,0,0,0,0,12145,0,12148,0,12153,0,0,0,0,12154,12171,12173,0,0,0,12175,0,0,0,0,
+12178,0,0,0,0,0,0,0,12183,0,0,0,0,0,0,0,0,12184,0,0,0,12186,0,0,0,0,0,12187,
+12188,0,0,12189,0,12196,0,12197,0,0,12198,0,12201,0,0,0,0,12203,0,12209,0,0,0,0,
+12210,12211,12212,12213,0,12217,12218,0,0,0,0,0,0,0,0,0,12222,0,0,0,0,0,0,0,
+12223,0,0,12229,0,0,0,0,12233,0,0,0,0,12234,0,0,12236,12242,0,0,0,12243,0,0,0,
+12244,12253,0,12254,12256,0,12257,0,0,12275,0,0,0,0,0,12277,0,0,0,0,0,12278,0,
+12289,0,0,12290,0,12292,12293,0,0,12294,0,12295,0,0,12296,0,12297,0,12298,0,0,0,
+0,12301,0,0,0,0,0,0,0,0,0,0,0,0,0,12309,0,12338,12340,0,0,0,0,12341,0,0,0,0,0,0,
+0,0,12342,12343,0,12344,0,0,0,0,0,0,0,0,0,12345,0,0,0,0,0,0,0,0,12346,0,0,0,0,
+12348,0,0,0,0,0,0,0,0,0,0,0,0,12350,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12351,0,12355,
+12356,12357,0,0,12367,12370,12371,0,0,0,0,0,12372,12376,0,0,0,0,0,0,0,0,12379,0,
+12382,0,12383,0,0,12384,0,0,0,0,12393,0,0,12394,0,0,0,0,12398,12403,0,0,12404,0,
+0,0,0,0,0,0,0,0,0,0,0,0,12410,0,0,0,12411,0,0,0,12412,0,0,0,0,12420,0,12421,0,0,
+0,0,0,12423,0,12425,12429,0,0,0,12431,12432,0,0,0,0,0,0,0,0,0,0,0,0,12434,0,0,0,
+0,0,12435,12436,0,0,0,0,0,0,0,0,12437,0,0,0,0,0,12438,0,0,0,0,0,0,0,0,12445,0,0,
+0,12450,12451,0,0,0,0,0,0,0,0,12452,12475,0,0,12493,12494,0,0,0,12495,0,0,0,0,
+12496,12502,12509,0,0,0,0,12510,0,12512,12513,0,0,0,0,12514,0,0,0,12515,0,12520,
+0,0,0,12524,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12527,0,0,0,12528,0,0,0,12529,0,0,0,
+0,0,12530,0,12535,0,0,12536,0,12538,0,0,0,0,0,0,0,0,0,0,0,0,12540,0,12548,0,0,0,
+0,0,12550,0,0,0,12551,12552,0,0,0,12554,0,0,0,0,0,0,0,0,12555,0,0,12562,0,12565,
+0,12566,0,0,0,0,0,0,0,0,0,0,0,0,12569,0,0,0,12571,12574,0,0,0,0,0,0,0,12577,0,0,
+0,0,0,0,0,12578,12579,12603,0,12608,0,0,12611,0,12612,0,12615,0,12625,0,0,0,0,
+12627,12646,0,12648,0,0,12657,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12670,0,0,12671,0,
+12673,12677,0,0,0,0,0,0,0,0,0,0,0,12679,0,12681,0,12682,12693,0,12694,0,12697,0,
+12701,0,0,0,12703,12704,0,0,0,0,12707,12737,0,0,12739,0,0,12740,0,0,12742,12743,
+0,0,0,0,0,0,0,0,0,12745,0,12746,12747,0,12748,0,0,12759,12767,0,0,0,0,12773,0,
+12774,12778,0,0,0,0,0,0,0,12779,0,0,0,0,0,12780,12793,0,12824,0,12825,0,12836,0,
+0,0,0,12839,0,12842,0,0,0,0,0,0,0,0,0,0,0,0,12843,12845,0,12846,0,0,0,0,12847,0,
+0,12850,12852,12853,0,0,0,12854,0,0,0,12855,0,12856,0,12858,0,0,12859,0,12862,0,
+12863,0,0,12866,0,12869,12872,12873,0,0,0,0,0,0,0,0,0,12875,0,12877,0,0,12878,0,
+0,0,0,0,0,0,0,0,12884,12885,12888,0,12889,0,0,0,0,12893,0,0,0,12895,12896,12898,
+0,0,0,0,0,0,0,12902,0,12909,12910,0,12926,0,12928,0,0,0,12929,0,12930,0,0,0,0,
+12931,0,12932,12933,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12934,0,12942,0,0,0,0,12944,
+0,0,0,0,0,0,0,0,12946,0,0,12948,0,0,12949,0,0,0,0,12950,0,0,0,0,12951,0,12952,0,
+12953,0,0,0,12954,12958,12959,0,0,0,0,0,12960,12964,0,0,0,0,0,12966,0,0,0,0,0,0,
+0,0,12970,0,12971,0,0,0,0,0,0,12972,0,0,12982,0,0,0,12984,12985,0,12986,12996,
+12997,13001,13002,0,0,0,0,13004,0,0,13005,0,0,13007,13009,0,13017,0,0,0,13020,0,
+13021,0,0,0,0,0,0,0,0,0,0,13022,0,0,0,0,0,0,0,0,13024,13027,0,0,0,0,0,13028,0,0,
+13029,0,0,0,0,0,0,0,13032,0,13037,0,0,0,0,0,0,13040,0,0,13041,0,0,0,13043,13044,
+13046,0,0,0,0,13047,0,0,0,0,0,0,0,13049,13054,0,13056,0,0,13060,13061,0,0,0,0,0,
+13067,0,0,13068,0,13071,0,0,0,0,0,13077,13078,0,0,0,0,0,13079,13080,13081,0,
+13082,0,0,0,13085,0,0,0,0,0,0,0,13086,0,13087,13088,0,0,0,0,0,13094,0,13099,0,
+13100,0,0,0,13101,0,13125,13126,13128,13129,0,0,13130,0,13131,0,0,0,0,0,0,13134,
+0,0,0,0,0,0,0,0,0,0,0,13150,0,13168,0,0,0,0,0,0,0,0,0,13169,0,0,13170,0,0,0,0,
+13174,0,0,0,13176,0,0,0,0,0,13177,0,13178,13183,13187,0,0,0,13189,0,0,13190,0,0,
+13191,0,0,13206,0,0,0,13207,0,0,0,0,0,0,0,0,0,0,13212,0,0,13219,13232,0,0,0,
+13241,0,13249,13253,0,0,0,0,0,13255,13259,0,13260,13261,0,13262,0,13272,0,0,0,0,
+13276,0,0,0,0,13277,13299,0,0,13301,13302,0,0,13303,0,0,13305,0,13310,0,0,0,
+13311,0,0,0,0,13325,0,13328,0,0,0,13329,0,0,0,0,0,0,13330,0,0,13331,0,13335,0,0,
+13342,0,0,0,0,0,13343,0,13354,0,13362,0,13366,13367,13369,0,0,13371,13372,0,
+13373,13374,0,13376,0,13380,13381,13386,0,13387,13388,0,13389,13391,13395,0,0,0,
+0,0,13401,13409,0,13410,0,0,0,0,13420,0,0,0,0,0,13422,0,0,0,0,13423,0,0,0,0,
+13425,0,0,0,0,0,13427,0,0,0,13428,0,0,13430,13438,0,13439,0,13445,0,13448,13449,
+0,0,0,0,0,0,13451,0,13457,0,0,0,0,13458,13459,0,13460,0,0,0,0,13464,13465,13466,
+13470,0,13471,13472,13474,13475,0,13476,0,0,13478,13479,0,13481,0,0,0,0,13487,0,
+13490,0,13493,0,0,13494,0,0,13495,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13496,13497,0,
+13500,0,0,13516,13522,0,0,13525,13528,0,0,0,13530,13535,0,13537,13539,0,13540,0,
+13543,0,13544,0,0,0,0,0,0,13545,0,0,0,0,0,0,13547,0,0,0,13549,13555,0,0,0,13556,
+13557,0,0,0,0,0,0,0,13558,0,13563,0,0,0,0,13564,0,0,0,0,0,0,0,0,13566,0,0,0,0,0,
+0,13569,0,0,13571,0,0,0,0,13573,0,0,0,0,0,0,13578,0,0,0,0,0,0,0,0,0,0,13581,0,
+13586,0,13595,0,13600,0,0,0,0,0,0,0,0,13601,13603,0,13604,13605,13606,13607,0,0,
+13617,13618,0,0,0,0,0,0,0,13623,0,13625,13627,0,0,0,0,0,0,0,0,13629,0,0,0,13634,
+0,0,0,13638,0,0,0,0,0,0,0,0,13654,0,0,0,0,0,0,0,0,0,0,13656,0,13659,0,0,13660,0,
+0,13662,0,0,0,13663,0,13664,0,0,0,0,0,13668,0,13669,13671,0,0,13672,0,0,0,0,0,0,
+13675,13685,0,13686,0,0,0,13687,0,0,0,13692,13694,13697,0,0,0,13702,0,0,0,0,0,
+13705,0,0,0,0,13707,0,0,0,13714,0,0,0,0,0,0,0,0,0,13715,0,13716,13717,0,0,13719,
+13724,13730,13731,0,0,0,0,0,0,0,0,13732,0,0,0,0,0,0,0,13734,0,13736,0,0,13737,
+13738,13747,0,13751,0,0,13752,0,0,0,13753,0,13757,0,0,13762,13763,0,13764,13765,
+0,13766,0,0,13767,0,0,0,13768,0,0,0,0,0,0,0,13769,0,0,13772,0,13775,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,13776,13778,13787,0,0,0,13797,0,13798,0,13801,0,13804,
+13806,0,0,0,0,13816,13817,0,0,0,0,0,0,0,0,0,0,0,0,0,13834,0,13836,0,0,13838,0,0,
+13839,0,13840,0,0,0,0,13842,0,0,0,0,0,0,13843,0,0,0,0,0,0,0,0,0,13845,0,0,0,0,0,
+13858,0,0,13860,0,0,13861,0,0,13862,13863,0,13868,0,13869,13870,0,0,0,0,0,0,0,0,
+0,0,13872,0,0,0,0,13873,13878,0,0,0,0,0,0,0,0,0,0,13886,0,13888,13889,13890,0,0,
+13891,13894,0,13897,13899,13900,13904,0,0,13906,0,0,0,13909,0,0,0,13910,0,0,0,
+13911,0,0,0,0,0,13912,13917,0,0,0,0,13918,0,13919,0,0,13920,0,0,0,13921,0,0,
+13922,0,0,0,0,0,0,0,13924,0,13927,0,0,0,0,0,13932,0,13933,0,13934,0,0,13935,0,
+13944,0,0,0,13954,0,0,13955,0,0,0,0,13956,0,13957,0,13967,13969,0,0,0,0,0,0,0,0,
+0,0,0,0,13970,13990,0,13991,13994,0,13995,0,0,0,0,13996,0,0,13999,0,0,0,14018,0,
+14019,0,14021,0,0,0,0,0,0,14041,0,0,0,0,0,0,0,0,14043,0,0,0,0,14046,0,0,0,14048,
+14049,0,0,0,0,0,0,0,0,0,0,14051,0,0,14052,14056,0,14063,0,14064,14066,0,0,14067,
+0,0,0,0,0,0,0,0,0,14068,0,0,0,14072,0,14074,14075,0,14076,14079,14085,14086,
+14087,14093,0,0,0,0,14095,0,0,0,0,0,0,14096,14097,0,0,0,0,0,0,0,14098,0,14102,0,
+0,0,0,0,14103,0,0,0,14104,0,0,14105,0,0,0,14107,14108,0,0,14109,0,0,0,0,0,0,0,0,
+14117,0,0,0,0,14118,0,0,0,0,14119,0,0,14120,0,0,14121,0,14122,14127,0,14128,
+14136,0,0,14138,0,14140,0,0,0,14141,14142,0,0,0,0,14146,0,0,14149,0,14151,0,0,0,
+14152,0,0,14153,0,0,0,0,0,0,0,0,0,14154,0,14156,14157,0,0,14159,0,14161,0,0,0,0,
+14162,0,0,0,0,0,0,14163,0,0,14173,0,0,0,0,0,0,14174,0,0,14176,0,0,14178,0,0,
+14179,14181,0,0,14182,14185,14187,0,14190,0,0,14197,0,0,0,0,0,0,0,0,0,0,0,0,
+14198,0,0,0,0,0,0,14199,14200,0,0,0,14204,0,0,14208,0,0,0,0,0,0,0,0,0,0,0,14231,
+0,0,0,0,0,0,0,0,0,14234,0,0,14235,0,0,0,14240,14241,0,0,0,14246,0,0,0,14247,0,
+14250,0,0,14251,0,0,14254,0,0,14256,0,0,0,14260,0,14261,0,0,0,0,14262,14267,
+14269,0,0,14277,0,0,14278,0,14279,14282,0,0,0,14283,0,0,0,14284,14285,0,0,0,0,
+14286,0,0,0,14288,0,0,0,14289,0,14290,0,14293,14301,14302,14304,14305,0,14307,0,
+14308,14309,0,0,0,0,0,0,0,0,0,0,0,14311,14312,0,0,14317,0,0,0,0,0,0,0,14318,0,0,
+0,0,14320,0,0,0,0,14321,14322,0,0,0,0,0,14326,14329,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+14330,14331,0,0,0,0,14332,0,0,0,14333,0,0,14337,14340,0,14341,0,0,14342,0,14345,
+14346,0,0,14347,0,14362,0,0,0,0,0,14364,14365,14371,0,14373,0,0,14374,0,14379,0,
+14400,0,0,0,0,0,14401,0,0,14405,0,14406,0,14408,14409,0,0,0,14417,0,0,14424,0,0,
+0,0,0,0,0,0,0,14430,0,0,0,14431,0,0,14435,0,14440,0,0,0,0,0,0,14442,0,0,14443,0,
+0,0,0,0,14446,0,0,0,0,0,0,0,14454,0,14457,0,14460,0,0,14466,0,0,0,0,0,14467,0,0,
+0,0,0,0,14469,0,14477,0,0,0,0,0,0,14478,14482,0,0,0,14483,0,0,0,14485,14486,0,0,
+0,14487,14488,14489,14492,14493,14494,14495,14496,14497,0,14499,0,14501,0,0,0,0,
+0,0,0,0,0,0,14502,0,14507,14512,14513,14514,0,0,0,0,0,0,0,0,0,0,0,14515,14526,
+14530,0,14537,0,14544,0,14547,0,0,14548,14550,14551,0,0,14552,0,0,0,14553,0,
+14554,0,0,0,0,14556,14564,0,0,14565,14566,0,0,0,0,0,0,14568,0,0,14569,0,0,0,
+14571,14576,0,0,14577,14578,14579,0,0,14580,0,0,0,0,14582,0,0,0,0,0,0,0,0,0,0,0,
+0,14583,0,0,0,0,0,14587,0,14588,0,0,14600,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,14601,0,0,14604,14605,14611,0,14613,0,0,0,0,14615,0,0,0,0,0,0,14627,0,14628,0,
+0,0,0,14631,0,14633,14634,0,0,0,0,14635,0,0,0,0,0,0,0,0,14636,0,0,14639,14642,0,
+0,0,0,14644,0,0,0,0,14645,14646,0,14653,0,0,14654,0,14658,0,14661,0,0,0,14665,0,
+0,0,14668,0,0,0,0,0,0,0,0,0,14669,0,0,14670,0,0,0,14680,0,0,14681,0,0,0,0,0,
+14682,14683,0,0,0,0,14686,0,0,0,0,14687,14697,0,0,0,0,14699,14705,14711,0,0,0,0,
+0,0,0,0,0,0,14712,0,0,0,14713,0,0,0,0,14719,0,14720,14721,14726,0,0,0,14728,
+14729,0,0,0,0,14731,0,0,0,0,0,0,0,14733,14736,14737,0,0,14740,14742,0,0,0,14744,
+14753,0,0,0,0,14755,14758,14760,0,0,0,0,0,14761,14762,14765,14771,0,14772,0,
+14773,14774,0,0,14775,0,0,14776,0,0,0,0,14777,0,14779,0,0,14782,0,0,14785,14786,
+14788,0,0,0,0,0,14795,0,0,0,0,0,0,14798,0,14803,14804,14806,0,0,0,14809,0,0,0,0,
+0,0,14810,0,0,0,0,14811,0,14812,0,0,0,0,0,14815,0,0,0,0,0,0,0,0,14816,0,14818,0,
+0,0,0,0,0,14819,0,14820,0,14823,0,0,0,14824,0,0,14826,14827,0,0,0,0,0,0,0,0,0,0,
+0,0,14830,0,0,0,0,0,14833,0,14845,0,0,0,0,0,14846,0,0,14847,14871,0,14873,0,
+14876,0,14877,14878,14880,0,0,0,0,0,14881,0,14882,14894,0,0,0,0,14895,0,14907,0,
+14908,0,0,0,0,0,0,0,14911,0,0,0,0,14920,0,0,14931,0,14932,14934,14935,0,0,14936,
+0,14945,0,0,0,0,0,0,0,14947,0,0,14948,14949,14951,0,0,14952,0,0,0,14964,14973,0,
+0,14990,0,0,0,0,14995,0,0,14998,15001,0,0,15002,15020,0,0,0,0,0,0,15021,0,15022,
+0,0,0,0,15023,0,0,15025,15029,15033,0,0,0,15034,0,0,0,15035,0,0,0,0,0,15043,
+15044,0,0,0,15045,15046,15048,15050,0,15065,0,0,0,0,15066,0,0,15075,15082,15084,
+0,0,15085,15086,0,0,0,0,0,0,0,0,15088,0,0,0,15089,0,0,0,0,15094,0,15096,0,15097,
+0,15100,0,0,15102,0,0,0,0,0,0,0,0,15105,0,0,15106,0,15109,15113,0,0,0,15115,0,
+15118,0,0,0,0,0,0,15119,0,0,15120,0,0,0,0,0,15123,15129,0,0,0,15130,0,15131,0,0,
+15134,0,15135,0,0,0,15137,15138,0,0,0,0,0,0,15139,0,0,0,0,0,15140,0,0,15154,
+15162,0,15169,15170,0,15175,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15177,0,15178,15179,0,
+0,0,0,0,15183,0,0,0,0,0,0,0,0,0,0,0,0,15185,15187,0,15194,15195,15196,0,0,0,0,0,
+0,0,15204,0,0,0,0,15206,0,0,0,0,0,15207,0,0,0,0,0,0,0,0,0,15213,0,15214,0,0,0,0,
+0,0,0,15232,0,0,0,0,15234,0,15238,15240,0,15248,0,0,0,0,15250,15251,0,0,0,0,0,0,
+0,15252,0,0,0,15255,15262,15266,0,0,0,15267,0,0,0,15277,15279,0,0,0,15280,15281,
+15282,0,0,0,0,0,15285,0,0,0,0,15289,0,0,15291,0,0,0,0,0,0,0,15296,15297,0,0,
+15304,0,0,0,0,15306,0,0,0,0,0,0,15307,15308,0,15309,0,0,15311,0,0,15312,15313,0,
+0,0,0,0,0,0,0,0,0,0,0,15314,15317,0,0,0,15318,15319,0,0,0,0,15320,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,15321,0,0,0,0,0,15324,0,15325,15326,0,15330,0,0,0,0,15334,0,
+15335,0,15341,0,0,15342,0,0,15343,15344,0,0,0,0,15345,0,0,0,0,15347,0,0,15348,
+15349,15350,0,15356,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15357,0,15358,0,0,0,0,0,0,0,
+15359,15360,15364,0,15380,0,0,0,0,0,15392,0,0,15393,0,15395,0,0,0,0,0,0,0,0,
+15396,0,0,15397,15398,0,0,0,0,0,0,0,0,0,15399,0,15400,0,0,0,15402,0,15405,15410,
+0,0,0,0,15411,0,0,0,15412,0,15416,0,0,0,0,0,0,0,15428,0,15435,0,0,15438,0,0,0,0,
+15439,0,0,0,15440,0,0,0,15441,15449,15451,0,0,0,0,0,0,0,15452,0,0,15455,0,0,0,
+15456,0,0,15458,0,15460,15461,0,0,0,0,0,15462,15464,0,15465,0,0,15466,0,0,15467,
+0,0,0,0,0,15468,0,0,0,0,15481,0,0,15484,0,15485,15486,0,0,0,15487,0,0,0,0,0,
+15488,0,15492,15498,0,0,0,15499,0,0,0,15500,0,15501,0,0,15512,0,15522,0,0,0,
+15524,0,15525,15526,0,0,15527,0,0,15545,15546,0,15548,15552,0,15553,0,0,0,15554,
+0,15555,0,15557,15565,15573,15577,15578,0,15582,0,15583,0,0,0,0,0,0,0,0,0,0,0,0,
+0,15586,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15588,0,0,0,0,0,15589,0,0,0,0,0,0,0,15593,
+15594,0,0,0,0,15595,0,0,0,0,0,0,15596,0,0,0,15597,0,0,0,0,15600,0,0,15601,0,0,0,
+0,15602,15603,0,0,0,0,0,0,15604,0,15609,0,0,15612,0,0,15613,0,0,15615,15617,
+15618,0,0,15620,0,15636,15637,0,0,15649,0,0,0,0,0,0,0,15650,0,0,15651,0,0,0,
+15656,0,15658,0,0,0,15664,0,0,15665,0,0,15668,0,0,0,0,0,15669,0,0,15674,0,0,
+15675,0,0,0,0,15676,0,0,0,0,0,0,0,0,0,0,0,15677,0,0,0,0,15678,0,0,0,0,0,15679,0,
+0,15681,0,15686,0,0,0,0,15687,0,15688,0,0,15690,0,0,0,15697,0,15699,15700,0,0,0,
+0,0,0,0,0,0,15701,0,15702,15703,0,15704,0,15705,0,15707,0,15709,0,15712,15716,0,
+15717,0,15718,15720,0,0,0,0,0,15724,0,0,0,15725,0,15726,0,0,0,15740,0,15745,
+15746,0,0,15747,0,15748,0,0,0,0,0,15749,0,0,0,15752,0,15753,0,0,0,0,0,0,15759,0,
+0,0,15765,0,0,0,0,0,0,0,0,0,15767,0,0,0,15771,0,0,15784,0,0,0,0,15785,15790,
+15791,0,0,15792,0,0,0,15807,0,15811,0,0,0,0,0,0,0,0,0,0,0,0,15818,0,0,0,15819,0,
+0,0,0,15821,0,0,0,0,0,15822,15824,0,0,15827,0,0,15829,15831,0,15832,0,0,15833,0,
+15835,15838,15839,15843,0,0,0,0,0,0,0,0,0,0,0,15844,0,0,0,0,15845,15851,15856,0,
+0,0,0,0,0,0,15858,15860,0,15861,0,0,0,15864,0,0,0,0,15865,0,0,0,0,0,0,15866,0,
+15872,0,0,15876,0,0,0,0,15877,15878,15883,15885,0,0,15888,0,0,0,0,0,15889,15890,
+0,0,0,0,0,0,0,0,15892,0,0,0,0,0,0,0,15893,0,0,15894,0,0,0,15895,0,15896,15897,0,
+15898,15901,15902,0,15911,15915,0,15916,0,15924,15935,0,15937,0,0,0,0,0,15950,0,
+0,0,0,0,0,0,15958,0,0,0,15961,0,0,15966,0,15967,0,0,15977,0,0,15978,0,0,15981,
+15982,15983,0,0,0,0,0,0,0,15986,0,0,0,15990,0,15991,15995,15998,0,15999,0,16000,
+0,0,0,0,16008,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16009,16011,0,16013,0,0,0,0,
+0,0,0,0,16014,0,0,16015,16023,16024,16025,0,0,16026,0,16030,0,16032,0,16033,0,0,
+0,0,0,0,16035,16036,16037,0,0,0,0,0,16039,0,0,0,0,16041,0,0,0,0,0,16043,16044,0,
+0,16047,0,0,0,16048,0,0,16049,16050,16052,0,0,0,0,0,16055,0,0,0,0,0,0,0,0,16056,
+0,0,0,0,0,0,0,16058,16060,16061,0,0,16063,0,0,16064,0,0,0,16067,16068,0,0,16069,
+16078,0,0,0,16079,0,0,0,16080,0,16081,0,0,0,16088,0,0,0,0,0,0,0,0,0,0,0,16089,
+16093,0,16097,0,16103,0,16104,16105,0,0,16256,0,0,16259,0,0,0,0,0,0,0,16260,
+16261,0,0,16262,0,0,16263,0,16268,0,0,0,0,0,0,0,16269,0,0,16270,16273,0,16274,0,
+0,0,0,16275,16276,16277,16280,0,0,0,16281,16284,0,0,0,16286,0,16289,0,0,0,0,0,0,
+0,0,0,16290,0,0,0,0,16291,0,0,0,0,0,0,0,16292,0,0,0,0,0,0,0,0,16293,16295,16297,
+0,16302,0,16304,0,16305,0,16306,0,0,0,0,0,0,0,0,0,0,0,0,16307,16308,16312,0,0,0,
+0,0,0,16313,16315,0,16318,0,0,0,16321,0,0,0,0,0,0,0,16326,16333,16336,0,0,0,0,
+16337,16340,0,0,0,0,0,16345,0,0,16346,0,0,0,0,0,0,0,0,0,16347,0,0,16348,0,0,0,0,
+16349,0,0,0,16350,0,16357,0,0,0,0,16359,16360,0,0,0,0,16362,16363,16364,16365,0,
+0,16366,0,0,0,0,16367,16368,0,16369,16374,0,0,0,0,0,0,0,16376,0,0,0,0,16378,
+16379,0,16380,0,0,0,16381,16383,0,0,0,0,0,16390,0,0,0,16399,0,16402,16404,16406,
+16407,0,0,0,16409,16411,0,0,0,0,16412,0,16413,16415,16423,0,0,0,0,0,16424,0,0,0,
+16428,16434,16435,16449,0,16450,16451,0,0,0,16453,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+16454,0,0,16456,16458,0,0,16459,0,0,16460,0,0,0,0,16462,0,16463,0,0,16466,0,0,0,
+0,0,16479,0,0,16480,0,16481,16484,0,0,0,0,0,0,0,0,0,0,16485,0,0,0,0,0,0,16489,0,
+0,0,0,0,16491,0,0,16498,0,0,16503,0,16505,0,0,0,0,0,0,0,0,16506,0,0,0,16508,
+16509,0,0,0,0,0,0,0,0,16511,16513,0,0,0,16516,0,16517,0,16519,0,16529,0,0,16531,
+0,0,0,0,0,0,16534,0,0,16541,16542,0,0,0,0,0,0,0,0,0,16543,16547,16548,0,0,0,
+16551,0,16552,0,0,0,16553,0,0,16558,0,0,16562,16565,0,0,0,16570,0,0,0,16573,
+16585,0,0,0,16586,16587,16595,0,16596,0,16598,0,0,0,16600,0,0,0,0,0,0,0,0,0,0,0,
+0,0,16601,0,0,0,0,16603,0,0,0,0,0,0,0,16604,16612,0,0,0,0,16613,0,16618,0,0,0,
+16640,0,0,16641,0,0,0,0,0,0,16645,0,0,0,0,16646,0,0,0,0,0,0,16651,0,0,0,0,16653,
+16654,0,0,0,16655,0,0,16656,16667,0,0,0,0,16671,0,16672,0,0,0,16673,0,0,0,0,0,
+16676,0,16686,0,0,0,0,16689,0,16690,0,16692,0,16693,0,16694,0,16696,0,0,0,16705,
+0,0,0,0,0,0,16707,0,0,0,16709,0,0,0,0,16711,0,16712,16713,0,0,0,16715,0,0,0,0,
+16716,0,0,0,0,0,0,0,0,0,16718,16724,0,0,16726,16727,0,0,0,0,0,0,0,16728,0,16729,
+0,0,16730,0,0,0,0,0,16731,0,0,0,16732,0,0,0,0,16734,16738,0,0,0,0,0,0,0,0,16743,
+0,0,16745,0,0,0,0,0,16749,0,16752,0,0,0,0,16756,0,0,16758,0,16759,0,0,0,0,0,
+16760,0,0,0,0,0,0,0,16762,0,16769,0,16770,0,16772,0,0,0,16777,16780,0,0,0,0,0,0,
+16781,0,0,16782,0,16784,0,0,16785,16787,16792,0,0,16794,0,0,0,16798,0,0,16809,0,
+0,16814,16816,16817,0,16819,0,0,0,0,0,0,0,0,0,0,16820,0,0,16836,16839,0,0,16841,
+16851,16857,0,0,16858,16859,0,0,16860,0,0,0,0,0,0,0,0,16862,0,16863,0,0,0,0,0,0,
+0,16864,0,0,0,0,0,0,0,16876,0,16881,16882,0,16885,16886,0,16887,0,0,0,16889,
+16891,0,0,0,0,0,16894,16895,0,0,0,0,0,0,0,0,0,0,0,16897,0,16898,0,0,0,0,0,16913,
+0,0,16924,16925,16926,0,0,16927,0,0,0,16937,16938,0,0,0,16940,16941,0,0,0,16942,
+16945,0,16946,16949,16950,0,0,0,16952,16955,0,0,0,16965,0,16969,0,0,16975,0,0,
+16976,0,0,0,0,16978,0,0,16981,0,16983,16989,0,0,0,0,16990,0,0,16991,0,0,0,16993,
+0,16994,16996,17000,0,0,0,0,0,17002,17004,0,17006,0,0,17007,0,0,0,0,17008,17013,
+17014,0,0,0,0,0,0,0,0,0,17021,0,17031,0,0,0,0,0,17033,17036,0,17038,0,0,17039,0,
+17045,0,0,17046,17047,0,0,0,0,17048,0,17049,17050,0,17051,17053,0,17054,0,17055,
+0,0,0,0,0,17063,0,0,17064,0,0,0,0,0,0,0,17065,0,0,17068,0,0,0,0,0,17072,0,0,0,0,
+0,0,17073,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17074,0,17080,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,17081,17083,17084,0,0,0,17085,0,0,0,0,17092,0,0,0,0,0,0,0,
+0,0,17093,0,17095,17102,0,0,0,0,0,0,17103,0,0,17105,0,17107,0,0,0,0,17114,0,0,0,
+0,0,17115,17125,17127,0,0,17128,0,0,0,17129,17130,0,17131,0,0,0,0,0,17132,17135,
+17145,0,0,0,0,0,0,0,0,17146,0,17147,0,17148,0,0,0,0,0,0,17149,17150,0,17151,
+17153,0,17155,0,0,0,0,17163,17171,0,17174,0,0,0,0,17179,0,0,17182,17185,0,0,0,0,
+0,17186,0,0,17188,0,0,0,0,0,0,0,17189,17191,0,17194,0,0,0,0,0,0,0,0,0,17195,
+17196,17203,17204,0,0,17205,17217,0,0,0,0,0,17218,0,0,0,0,17219,0,17220,0,17221,
+0,0,17230,0,0,0,0,0,17236,0,17238,17239,0,0,0,17241,17244,0,0,17245,0,17248,0,0,
+17251,0,17252,0,0,17264,0,17266,0,0,0,17268,0,0,0,0,17271,17272,0,17273,0,17295,
+0,17302,0,17305,0,0,0,17306,0,0,0,0,0,0,0,17308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+17309,0,17310,17313,0,0,0,0,17314,17315,0,17317,0,0,0,0,17318,0,0,0,0,0,0,0,
+17320,0,0,0,0,0,0,17334,0,17344,17348,0,0,0,17350,17351,0,0,17353,0,0,17354,0,0,
+0,0,0,0,0,0,0,17355,0,0,0,0,0,0,17356,17357,0,0,17359,0,0,0,17371,0,17372,0,0,0,
+17393,0,0,0,0,17394,0,0,0,0,0,17395,0,0,17399,0,0,0,17401,17417,0,17418,0,17419,
+0,0,0,0,0,17422,17423,0,0,0,0,0,17424,0,0,0,0,0,17428,17429,17433,0,0,0,17437,0,
+0,17441,0,0,17442,0,0,17453,0,0,0,0,0,0,0,0,17454,17456,17462,0,0,17466,0,0,
+17468,0,0,17469,0,0,0,0,17470,0,17475,0,0,0,0,0,17479,0,0,0,17483,17484,0,17485,
+0,17486,0,17491,17492,0,0,17493,0,17494,17495,0,0,0,17496,0,0,0,17497,0,0,0,
+17502,0,0,0,0,0,17503,0,17505,0,17507,0,0,0,17512,17513,17514,0,0,17515,0,0,0,
+17519,0,0,0,17522,0,0,17523,0,0,0,0,0,0,0,0,0,17527,0,0,0,17528,0,0,0,17534,0,0,
+0,0,17536,0,0,0,17539,0,17540,17543,17549,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17556,
+0,0,17558,0,17559,0,0,17560,0,0,0,17563,0,0,0,0,0,0,17564,0,0,17565,17566,0,
+17567,0,0,0,0,0,0,17569,17570,0,17575,0,0,0,0,0,0,0,0,0,0,0,17581,0,0,0,17582,
+17583,0,17586,0,0,17587,0,0,0,0,0,0,0,17588,0,0,0,0,17596,17597,0,0,17598,17600,
+0,0,0,0,0,0,17601,0,0,0,17604,0,0,17605,0,0,17607,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,17612,0,0,17618,0,17621,17622,0,0,0,0,17623,0,0,17624,0,0,17630,0,0,
+17631,17633,17634,0,0,0,0,0,0,0,17635,0,0,17636,0,0,17637,0,17638,0,17640,0,0,0,
+0,0,0,0,0,0,0,17641,0,0,0,0,0,0,0,0,0,0,17643,0,0,0,0,17645,0,0,0,0,0,0,0,0,
+17646,17662,0,0,0,0,0,0,0,0,0,17663,17664,0,17665,17666,0,0,0,17669,17671,17673,
+0,17679,0,0,0,0,0,0,0,17684,0,0,0,17686,0,17714,0,0,17720,17722,17726,0,0,17728,
+0,0,17729,0,0,0,17732,0,17733,0,17734,0,0,0,17735,0,0,0,0,17737,0,0,0,0,17739,0,
+0,0,17741,17742,0,0,0,0,17743,17744,17745,0,0,0,17749,0,17750,17751,17752,17754,
+17761,17762,0,17763,0,17766,0,17772,0,0,0,0,0,17775,0,0,0,0,0,0,0,17776,0,0,
+17777,0,0,17778,17779,0,17782,17783,0,0,0,0,0,0,0,0,0,0,17784,0,0,0,0,0,0,0,
+17821,0,0,0,17822,0,0,0,17823,17825,0,0,0,0,0,17826,17831,17832,17833,0,0,17845,
+0,0,0,17846,0,0,0,17848,17850,17854,0,17855,0,0,17859,0,0,0,0,0,0,17860,17861,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17870,17871,0,0,0,0,0,0,17872,0,0,0,17879,0,
+0,0,17881,17883,0,17884,0,17885,0,0,17886,0,0,17887,17891,17953,0,0,0,0,17954,0,
+0,17955,0,17968,0,0,17972,0,0,0,0,0,17974,0,0,0,0,17976,17978,0,0,17983,0,0,0,0,
+18003,0,0,0,0,0,18007,0,0,0,0,0,18009,0,0,0,0,0,0,0,18010,0,0,0,0,0,0,18012,0,0,
+18014,0,0,0,18015,0,0,0,18016,0,18017,0,0,0,18030,0,0,0,0,0,0,0,18031,0,0,18036,
+18037,18038,0,0,18049,18056,0,18057,18058,0,18059,0,0,0,0,0,0,0,0,18062,0,0,0,0,
+18064,0,0,0,0,0,0,0,0,18067,0,0,0,18068,0,0,18075,0,0,18078,18093,18094,0,0,0,0,
+0,0,0,0,18097,0,0,0,0,0,18098,18100,0,0,0,18108,0,18111,0,0,18112,0,18113,0,0,
+18115,18116,0,18118,0,0,0,0,18121,0,0,0,0,18123,0,0,0,0,0,0,0,0,0,18124,0,0,0,0,
+18125,18126,0,18127,0,0,18128,18135,0,0,0,0,0,0,0,0,0,18150,0,0,0,0,0,18151,
+18152,0,0,18156,18164,0,18166,18171,0,0,0,0,0,0,0,0,0,18172,18183,0,18184,0,0,0,
+0,18185,0,18187,0,0,0,0,0,18188,0,0,0,0,0,0,0,0,18189,0,0,18190,0,0,18191,18192,
+0,0,18194,18195,18196,0,0,0,18197,0,18203,0,18204,0,0,0,0,18205,0,0,0,18207,
+18208,0,0,18214,0,0,0,18215,18216,0,0,0,18220,0,0,18222,0,0,0,0,0,18223,0,18225,
+18231,0,18234,0,18235,0,0,0,0,18240,0,0,18241,18242,0,0,0,0,0,18243,18251,0,
+18253,0,18254,0,0,0,18266,0,0,0,0,0,0,18269,18270,18271,18273,18281,0,0,0,0,0,0,
+0,0,0,0,0,0,18282,0,18283,0,18284,0,0,0,0,0,0,18285,0,18287,18289,0,0,18290,0,0,
+0,0,18308,0,0,0,18310,0,0,0,0,0,0,0,0,0,0,0,0,18311,0,18312,18313,0,18315,0,0,
+18316,18320,0,18331,0,18332,0,18336,0,0,0,0,18337,0,18340,0,0,0,0,0,0,0,0,0,
+18341,0,18344,18345,0,18346,0,0,0,0,0,18348,0,18351,0,0,18356,0,0,0,0,0,0,18357,
+0,0,0,0,0,18367,0,0,0,18368,0,18369,0,18370,18371,0,0,0,18437,18444,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,18445,18450,0,0,0,0,18451,0,18452,0,0,0,18453,0,0,0,0,0,18455,0,
+0,0,18456,0,18457,0,18460,0,0,18461,0,0,0,0,0,0,0,0,18466,0,0,18467,0,0,0,0,
+18473,0,0,0,18476,0,18477,0,0,0,18478,18479,18480,0,0,0,18485,0,0,0,18486,0,0,0,
+0,0,0,18488,18490,0,0,0,0,0,0,18491,0,0,0,0,0,18495,0,0,18496,0,0,0,0,0,0,18505,
+0,18521,0,18522,18523,0,0,0,18525,18526,0,0,0,0,0,18527,0,0,0,0,18532,18533,0,
+18534,0,0,0,0,0,0,18535,18537,0,18538,0,0,0,0,0,0,18540,18541,18542,18543,0,
+18546,0,0,0,0,18553,18556,0,0,18558,0,0,18569,18571,0,0,0,18572,0,18574,0,0,0,0,
+18586,0,0,0,0,0,18588,0,0,18589,0,0,0,0,0,0,18590,0,18592,0,0,0,0,18594,0,0,0,
+18596,0,0,18597,18598,0,0,18601,0,0,0,0,18602,0,0,0,18603,18604,0,18605,0,0,0,0,
+18608,0,0,18611,0,0,0,0,0,0,0,0,0,18612,0,18616,0,0,18617,18619,0,0,0,18628,0,0,
+0,18629,0,0,18630,0,0,0,0,0,0,0,18631,0,18632,0,0,18635,18637,0,0,0,0,0,0,18641,
+18643,18648,0,18652,0,0,18653,0,18655,18656,0,0,0,18657,0,0,18666,18674,0,0,0,0,
+18677,18684,18685,0,0,18686,0,0,18690,0,0,0,0,0,0,0,18695,18696,0,0,0,0,0,0,0,0,
+0,0,18697,0,0,18700,0,0,0,0,0,0,18702,0,18708,0,0,18709,0,18710,0,0,18711,0,
+18714,0,0,18718,0,0,0,0,0,0,18719,0,0,18722,0,18726,0,0,0,0,0,0,0,0,0,0,0,0,0,
+18731,0,0,0,0,0,18739,18741,0,0,18742,0,18743,18744,18746,18748,0,18752,18753,0,
+0,18754,18763,0,18765,0,0,0,18766,0,0,0,18769,0,0,0,0,0,18773,18778,18779,18781,
+0,0,18784,18787,0,18788,0,18793,0,0,0,0,0,0,18795,0,0,18800,0,0,0,0,0,18801,
+18804,0,0,0,0,0,0,0,18806,0,0,0,18811,18815,18816,0,0,0,0,18825,0,0,18827,18829,
+0,0,18830,0,0,0,0,18831,0,0,18832,0,0,0,0,18833,0,18840,0,18841,0,18842,0,0,0,0,
+18843,0,18844,0,0,0,0,0,0,18845,18846,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+18848,0,0,0,18853,18860,0,0,18862,18866,0,0,18867,18869,0,0,18874,18881,18891,0,
+0,0,0,0,0,0,0,0,0,18892,0,0,0,0,0,0,0,0,18895,0,18896,0,0,0,18900,0,0,0,18901,0,
+18902,18915,18916,0,0,0,0,0,0,0,0,18919,0,0,0,0,0,18920,0,0,0,18921,18929,0,0,0,
+0,18930,0,0,0,0,0,0,18932,0,0,0,0,18934,18942,0,0,0,18951,18957,0,0,0,0,18958,0,
+0,0,0,18959,18960,0,0,18961,0,0,18962,0,0,0,0,18963,18964,0,0,0,18965,0,18967,0,
+0,0,0,0,0,0,0,0,18968,0,18969,0,18970,18973,18976,0,0,0,0,0,0,18977,0,0,0,18981,
+0,0,0,18990,0,18998,0,0,0,0,0,18999,19003,0,0,19005,0,0,0,19006,0,0,0,0,0,0,
+19008,19011,0,0,19018,0,0,19019,0,19024,0,19031,19032,0,19039,0,19041,19050,0,0,
+0,19051,19055,19056,0,19059,19063,19064,0,0,19088,0,0,0,19093,19094,0,0,0,0,
+19095,0,19096,0,0,0,19097,0,0,19098,0,19099,19100,0,0,19103,0,0,0,0,0,0,0,19111,
+0,0,0,0,0,0,19112,0,0,0,19116,19117,0,19121,19122,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,19123,19124,0,0,0,0,0,0,0,19125,19126,0,19128,0,0,0,0,0,0,0,0,0,0,
+19129,19130,19131,19132,0,0,19146,0,0,19147,19156,19158,0,0,0,0,0,0,0,0,19182,
+19185,0,0,19187,0,0,0,19193,0,0,0,0,0,19194,0,19197,0,0,0,0,19198,0,0,0,0,0,0,0,
+0,0,0,19202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19203,0,19205,19210,
+0,0,0,19213,0,19218,0,0,0,19223,19229,0,0,19230,0,0,19231,19232,19233,19239,0,0,
+0,0,0,19240,0,19248,19249,0,0,0,0,19254,0,19256,19258,19259,0,0,19261,0,19266,0,
+0,0,19272,0,19278,19281,19282,0,0,0,0,0,0,0,0,0,0,0,0,19283,0,0,19284,0,0,19285,
+19287,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19288,19291,0,19292,0,0,0,0,19297,0,19298,0,0,
+0,0,19302,19303,0,0,0,0,19304,19305,0,0,0,0,19314,0,0,19315,0,0,19321,0,0,0,0,0,
+0,0,19322,0,19333,0,19334,19335,0,19336,19337,0,0,0,0,0,0,0,0,0,0,0,19346,0,0,
+19353,0,19354,19362,0,19366,19367,0,0,19369,0,19375,0,19377,19380,19388,0,0,0,0,
+0,19389,19390,0,0,0,0,19392,0,0,0,0,0,19402,0,0,0,0,0,0,0,0,19412,0,0,19413,
+19422,0,19424,0,0,0,19425,0,0,0,19428,0,0,0,0,19431,0,0,0,0,0,19432,0,0,0,0,0,
+19448,19459,0,0,19461,0,19462,19463,0,19467,19474,19482,0,0,0,0,19494,0,0,0,0,
+19501,0,0,0,0,0,0,0,0,0,0,19502,19504,0,0,0,0,0,0,0,19505,0,0,0,0,19506,19507,0,
+0,0,19508,0,0,19511,0,0,19514,0,19515,0,19516,0,19518,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,19530,0,19537,19538,0,19543,19546,0,19547,19551,0,0,0,0,0,0,19552,
+19553,0,0,0,0,0,0,0,0,0,0,0,0,19555,0,0,19556,0,0,0,0,0,0,0,0,0,0,0,0,19560,
+19561,0,0,19562,0,0,0,0,0,0,19565,19567,0,19568,0,0,0,19569,19570,0,19578,0,0,0,
+0,19580,0,0,0,0,19581,19584,0,0,0,0,0,0,0,19585,19586,0,0,0,19587,19588,0,19589,
+0,0,0,0,0,0,19592,19593,19599,0,19600,0,0,19604,0,0,19605,0,19606,19608,19610,0,
+19613,19614,0,0,0,0,0,0,19616,19617,0,0,19618,0,0,19619,0,0,0,19620,19621,19631,
+0,0,19632,19634,19636,0,19643,0,0,19644,19658,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,19659,0,0,0,0,0,0,0,0,0,0,0,19675,19677,0,0,0,0,19679,0,19683,0,19684,0,0,
+0,0,0,0,19687,0,0,0,0,0,0,0,0,19688,19689,19692,0,0,0,0,0,0,0,19695,19697,0,0,0,
+0,0,19698,19699,0,0,19700,0,19702,0,0,19703,0,0,0,0,0,0,19704,19708,0,19710,0,
+19713,0,0,0,19715,0,0,0,0,19718,0,0,0,0,0,0,0,19720,0,19722,0,0,19725,0,0,0,0,0,
+0,0,0,0,0,0,0,0,19730,0,0,0,0,0,19731,0,19734,19735,19739,0,0,19740,0,19741,0,0,
+0,19746,0,0,19747,0,19771,0,0,0,0,0,0,0,0,19772,19775,0,0,0,0,0,0,19778,0,0,0,0,
+0,19779,0,0,19780,19790,0,19791,0,0,19792,0,0,0,19793,0,0,19796,19797,0,0,0,
+19799,0,0,0,19801,0,0,0,0,19803,0,19804,0,19805,0,0,19807,0,0,0,19808,0,0,0,0,0,
+0,19809,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19816,0,19821,0,19822,19830,19831,0,0,
+0,19833,0,0,0,0,0,0,0,0,0,0,19838,0,0,0,0,19839,0,0,19843,0,0,0,0,19845,0,0,0,0,
+19847,0,0,19848,0,19849,0,0,0,0,0,0,0,19851,0,0,0,19854,0,0,0,0,0,0,0,0,0,19864,
+0,19865,0,19866,0,0,0,0,0,0,0,19868,0,0,19870,0,0,19871,0,0,19872,19873,19875,0,
+19880,19882,19884,0,0,19885,19886,19888,0,0,0,0,0,0,0,0,0,0,0,0,19890,19892,
+19893,0,0,19894,0,0,0,19895,0,19896,19902,0,0,19903,0,0,19905,0,0,0,19906,0,
+19908,0,19909,19911,0,0,0,19913,19920,0,19938,19939,19940,0,0,0,0,0,0,0,19942,0,
+19943,0,19945,0,0,0,19951,19952,19954,19960,0,19965,0,19971,0,0,0,0,0,19975,0,
+19976,0,19990,0,0,19991,0,19993,0,19995,0,0,0,19998,19999,20001,0,20003,20005,0,
+20011,20012,0,0,0,0,0,0,20014,0,20020,0,0,0,0,20021,0,0,0,0,0,20023,20024,0,0,0,
+0,0,20025,0,0,20027,0,0,20029,0,0,20032,0,0,0,0,20044,20045,0,20048,20049,0,0,
+20050,0,20052,0,0,20054,20057,0,0,0,0,0,0,0,0,0,20059,0,0,20061,0,20062,0,20064,
+0,0,20066,0,0,20067,0,0,0,0,20069,0,0,0,0,0,0,20070,20071,0,0,0,0,0,0,0,0,0,0,0,
+20072,0,0,20073,20074,0,0,0,0,0,20075,0,20078,0,0,0,0,20080,0,20081,0,0,0,0,0,0,
+20095,0,20098,0,0,0,0,0,0,0,20107,0,0,0,0,0,0,0,0,20112,0,0,0,20113,20114,0,0,0,
+20115,20123,20124,0,0,0,20131,20133,20134,0,0,0,0,20136,0,0,20137,20138,20150,0,
+20152,0,0,0,20153,0,0,20154,0,0,0,20158,0,20163,0,0,20164,0,0,0,0,0,0,0,20166,0,
+20168,0,20170,0,20175,0,0,20178,0,0,0,0,20223,0,0,0,0,20224,0,20226,0,0,20230,0,
+20231,0,0,0,0,20232,0,0,20233,20234,0,20244,0,20247,0,0,0,0,0,0,20249,0,0,0,
+20250,0,0,0,0,20251,0,20253,0,20254,0,0,0,0,20256,0,0,20264,0,0,0,0,20266,0,0,0,
+20278,0,0,20279,20282,0,0,0,0,0,20283,0,20284,0,20285,0,20287,20290,0,0,0,0,
+20292,0,0,0,0,20293,20297,0,0,0,0,0,0,20299,0,20300,20303,0,0,0,0,0,0,20307,0,0,
+20308,0,20309,0,20310,0,0,0,0,0,0,20312,0,0,0,20314,0,0,0,0,20315,20316,0,20322,
+0,0,0,0,0,0,20339,0,0,0,20342,0,0,0,0,20352,0,0,0,0,0,0,0,0,0,0,20362,0,0,20365,
+0,20375,20377,0,0,0,0,0,0,0,0,0,0,0,20378,20379,0,20380,0,0,20381,0,20382,0,
+20383,0,20388,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20390,20392,20393,0,0,20395,0,0,0,0,0,
+20396,0,0,0,0,0,0,0,0,20398,20415,0,0,0,20417,0,0,20420,0,0,20426,20428,0,20431,
+0,0,20432,0,20433,20434,20435,0,0,0,0,20440,0,0,0,0,0,20442,0,20443,0,20446,0,0,
+0,0,20448,0,20451,0,0,0,0,0,0,0,0,0,20452,20453,0,0,20454,0,0,0,0,0,0,20457,0,
+20458,0,0,0,20465,0,0,0,0,0,20469,0,0,0,20473,0,20476,0,0,0,0,0,0,0,0,20477,0,0,
+20485,0,0,20486,0,0,20487,0,20496,0,20497,0,0,20498,0,0,0,0,0,0,0,0,0,0,20499,
+20500,0,20501,0,0,0,0,0,20520,20527,0,20529,0,0,0,0,20539,0,0,20540,0,0,0,20543,
+0,0,0,20546,0,0,0,0,0,20548,0,0,20563,0,0,20564,0,20566,0,0,0,0,0,20589,0,0,0,0,
+20590,0,0,20593,20594,0,0,0,0,20595,0,20597,20598,0,0,0,20618,20620,0,0,0,0,
+20621,0,0,0,0,20627,0,0,0,0,0,20628,0,0,0,20629,0,20630,0,0,20639,0,0,0,0,0,
+20707,0,0,20709,0,0,0,20713,20714,0,0,0,0,0,20724,20725,0,0,0,0,20726,20728,
+20729,0,20733,0,20734,0,20735,20736,0,20737,0,0,20744,0,20745,0,20748,0,0,20749,
+0,0,0,0,0,0,0,0,20750,0,0,0,0,20754,0,0,0,20761,0,0,20763,0,0,0,0,0,0,0,20766,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,20767,0,0,0,0,20768,0,20769,20777,0,0,0,0,0,0,20785,0,
+0,0,20786,20795,20801,0,20802,0,20807,0,0,20808,0,0,20810,0,0,20811,0,20812,0,0,
+0,0,0,20813,0,0,20818,20820,20821,0,0,0,20822,0,20823,0,0,0,20826,0,0,0,0,0,0,0,
+20829,20830,20831,0,20832,20836,0,0,20839,0,0,20840,20842,0,20843,0,20844,0,
+20854,0,0,0,20855,0,0,0,0,20856,0,0,0,20869,0,0,20871,0,0,0,0,0,0,0,20873,0,0,0,
+0,0,20876,0,0,0,0,0,20880,0,0,20882,0,0,0,0,20883,20884,0,0,20890,0,0,0,0,0,0,0,
+0,0,20891,0,0,0,0,0,20905,0,20906,20910,0,0,20912,20915,0,0,0,0,0,20916,0,20917,
+0,20919,20920,20922,0,20927,0,20928,20929,20930,0,0,20935,0,0,20939,0,0,20941,0,
+0,0,20943,0,0,0,20946,20947,0,0,0,0,0,20950,0,20954,0,0,20955,20964,0,0,20967,0,
+0,0,0,0,20973,20975,0,0,0,20984,0,20987,20988,0,0,0,0,0,20989,0,0,0,20995,0,
+20998,0,20999,0,0,0,0,21000,21001,0,0,0,0,21008,0,21010,0,21016,0,0,0,21017,
+21018,0,0,0,0,0,21021,21026,21027,21028,0,0,21029,0,0,0,0,0,21030,0,0,0,0,0,0,0,
+0,0,0,0,0,0,21031,21032,0,0,0,0,0,21037,0,0,21038,0,0,0,0,0,0,0,0,0,21039,0,
+21041,0,21046,21047,0,0,0,21049,21053,0,0,21057,21064,21065,0,0,21066,21067,0,0,
+0,21069,0,0,0,21071,21072,0,0,21073,0,21074,0,0,21078,0,0,0,0,21079,0,0,21080,
+21081,0,0,21086,21087,0,21089,0,0,0,0,0,0,0,21091,0,21093,0,21094,0,0,0,0,0,0,0,
+0,21095,0,0,0,0,0,21096,0,21098,0,0,0,0,0,0,0,21099,0,0,21100,21101,21102,0,0,0,
+0,0,21103,0,21104,0,0,0,0,0,21105,21108,21109,0,0,21112,21113,0,0,0,0,0,0,21115,
+21122,21123,0,0,0,0,0,21125,0,0,0,0,0,0,0,0,21129,21131,0,0,21134,0,0,0,21137,
+21142,0,21143,0,0,21144,0,21145,21146,0,21152,21154,21155,21156,0,0,0,21160,0,0,
+0,0,0,0,21161,0,21164,0,21166,0,0,0,0,21170,0,0,0,0,21171,0,0,21172,0,21174,0,
+21175,0,0,0,0,0,21176,21179,21188,0,0,0,21189,0,0,21190,0,0,0,21192,0,0,21193,0,
+0,0,21198,0,21212,0,0,21213,0,0,0,0,0,0,21215,21216,0,0,21223,21225,0,21226,0,0,
+0,0,21227,21228,0,0,21229,0,0,0,0,21230,21236,0,0,0,0,0,0,0,0,0,0,0,0,0,21237,0,
+0,21238,21239,0,0,0,0,21256,0,0,0,0,0,21257,0,0,0,0,0,0,0,21259,0,0,0,21263,0,
+21272,0,21274,0,21282,0,0,0,0,0,0,0,0,21283,0,0,0,0,0,0,0,0,21294,0,0,21297,0,0,
+0,0,21298,0,0,0,21299,0,21300,21302,0,21316,0,21318,21322,21323,0,21324,0,21326,
+0,0,0,21327,21328,0,0,0,21352,0,0,21354,21361,0,0,0,0,0,0,0,0,0,0,0,0,0,21362,0,
+0,0,21363,0,0,0,0,0,0,0,0,0,21366,0,0,21367,21372,21374,0,0,0,21375,21377,0,
+21378,0,0,0,21380,0,0,0,0,0,0,0,0,0,0,21381,0,0,0,0,0,0,21382,0,21383,0,0,21384,
+0,0,21385,0,0,0,0,21389,21390,0,0,0,0,0,0,0,0,0,0,0,0,0,21397,21398,0,0,0,0,0,0,
+0,0,0,0,21399,0,21400,0,0,0,0,21402,0,0,0,21403,21404,0,21405,21406,0,0,0,21407,
+0,0,0,0,0,0,0,0,0,0,0,0,21408,0,0,0,0,21409,0,21421,0,21422,0,0,0,21425,21428,0,
+0,0,0,21429,0,0,0,0,0,21433,0,0,0,0,0,0,0,0,0,0,21434,0,21443,0,21444,21449,0,
+21452,0,21453,21454,0,0,0,21457,0,0,21458,0,0,0,21460,21461,0,0,21464,0,0,0,
+21473,21478,0,0,21479,0,0,21481,21483,0,0,0,0,0,0,0,0,21484,0,0,21485,21486,0,0,
+21488,0,0,0,0,0,0,21523,0,0,21525,0,0,0,0,0,0,0,21526,0,0,0,0,0,0,21529,21530,0,
+0,21531,0,0,21533,0,0,21539,21564,0,21567,0,0,0,0,0,0,0,0,21575,0,0,0,0,21577,0,
+0,0,0,0,21591,0,0,21604,0,0,0,0,0,0,0,0,0,21605,0,21606,0,0,21617,21618,21619,
+21620,0,0,0,0,0,0,0,0,0,0,0,0,0,21623,0,0,0,0,21631,0,21635,0,0,0,0,21639,21646,
+21653,21662,0,0,21663,21664,0,21666,0,0,21667,0,21670,21672,21673,0,21674,21683,
+0,0,0,0,0,21684,0,21694,0,0,0,0,21695,21700,0,21703,0,21704,0,0,21709,0,0,0,
+21710,0,0,0,0,0,0,0,0,21711,0,0,0,21712,0,21717,0,21730,0,0,0,21731,21733,0,0,0,
+0,21737,21741,21742,0,21747,0,0,0,21749,0,0,0,0,0,0,0,0,0,0,0,0,0,21750,0,0,0,0,
+0,21752,0,0,0,0,21753,0,0,0,0,0,0,21755,21756,0,21757,0,0,0,0,0,0,21760,0,0,
+21763,0,0,0,0,0,0,0,0,0,21764,0,0,21766,0,0,21767,0,0,0,0,0,0,0,0,0,21773,0,
+21774,0,0,21775,0,0,0,0,21776,0,0,21777,0,0,0,0,0,0,0,0,0,21780,21787,21788,
+21791,0,0,0,21797,0,0,0,0,0,21805,0,0,0,0,21806,0,21807,21809,0,21810,21811,0,
+21817,21819,21820,0,21823,0,21824,0,0,21825,0,0,21826,21832,0,0,0,0,0,21833,
+21848,21849,0,0,21867,21870,21871,21873,0,0,0,21874,0,0,0,0,0,0,0,0,0,21875,0,
+21878,0,0,0,21879,0,21881,21886,0,0,0,0,21887,0,0,21888,21894,21895,21897,0,
+21901,0,21904,0,0,21906,0,0,0,21909,21910,21911,0,0,21912,0,0,21913,21914,21915,
+0,21919,0,0,0,0,0,0,0,21921,0,0,21922,21933,21939,0,0,0,0,0,0,0,0,0,0,0,21944,0,
+0,0,0,0,21945,0,21947,0,0,0,0,0,0,0,0,0,0,21949,0,0,0,21950,0,0,0,0,0,0,0,0,0,0,
+0,0,0,21951,0,21952,0,0,0,0,0,0,0,0,0,21954,21957,0,0,0,0,21958,0,21959,0,0,0,0,
+0,0,21962,21963,0,0,0,0,0,0,0,0,21964,21965,0,0,21969,21970,0,0,0,21974,0,0,
+21980,21981,0,21982,0,0,0,0,0,21985,0,21988,0,21992,0,21999,0,0,0,0,0,0,22001,0,
+22002,0,0,0,0,0,0,22003,0,0,0,0,0,22004,0,0,0,22008,0,22009,22015,0,0,22016,0,0,
+0,22017,22019,0,0,0,0,0,0,0,0,0,22020,0,0,0,0,0,0,0,0,0,0,22021,22037,0,22039,0,
+0,0,22040,0,0,0,22048,22049,0,0,22053,22055,22056,22059,0,0,22060,22061,0,0,
+22064,0,0,0,0,22066,0,0,0,0,0,0,0,22073,0,0,0,22074,22075,0,0,0,0,0,0,0,22076,0,
+0,0,0,22077,22084,22099,0,0,0,0,0,0,0,22104,0,0,22107,0,22108,0,22109,0,22110,0,
+0,0,0,0,0,0,22111,22119,0,22120,22122,0,0,0,0,22125,0,0,0,22128,22129,0,0,0,0,0,
+0,22141,0,0,0,22142,0,0,22144,22146,0,22148,22149,22151,22154,0,0,0,22162,0,0,0,
+0,22164,22177,0,0,0,0,22179,0,22182,22183,0,0,22184,22188,0,0,0,0,0,0,0,0,22190,
+0,22194,22201,0,0,22208,0,22209,0,22212,0,0,22215,0,22223,22231,0,0,22232,0,
+22234,0,0,22235,22236,0,22237,0,22240,0,0,0,0,0,22241,0,0,0,22242,22246,22247,0,
+0,0,22259,22268,0,22269,0,0,0,0,0,0,0,22270,0,0,0,0,22271,0,22272,0,22277,0,0,0,
+0,0,22278,22280,22283,22286,0,0,22287,22289,0,0,22290,0,22293,0,0,0,0,0,0,0,0,0,
+0,22295,0,22301,22302,0,0,0,22305,0,22308,0,0,0,0,0,0,0,0,0,0,22315,0,0,0,22317,
+0,22334,0,0,0,22335,0,0,0,0,0,22336,0,22338,22344,0,22347,22349,0,22350,0,0,0,0,
+0,0,0,22357,0,0,0,0,0,22358,0,0,0,0,0,0,0,0,0,0,22359,22360,0,0,0,0,0,0,0,0,
+22361,22366,0,0,22369,0,22370,22373,0,0,0,0,0,22375,0,22377,0,0,0,0,0,22378,0,0,
+0,0,22381,0,0,0,0,22382,0,22383,0,0,0,0,0,0,0,0,0,22391,0,0,22392,22395,22396,
+22402,0,0,0,0,0,0,0,0,0,0,0,0,0,22405,0,0,22406,0,0,22408,0,0,22409,22410,0,0,0,
+0,0,0,22424,0,0,0,0,22426,0,0,0,22427,0,22428,0,22432,0,22435,22442,22443,0,0,0,
+0,22444,0,0,0,0,0,22446,0,22454,0,22455,0,0,0,22465,0,22470,0,22471,0,0,0,0,
+22472,22473,0,22487,0,0,0,22488,0,0,0,0,22489,0,0,22499,0,0,0,0,0,0,22514,0,0,
+22515,0,0,0,0,0,0,0,22516,0,0,0,22517,22520,0,0,0,22534,0,0,22535,0,0,22536,0,
+22540,22553,0,22555,0,0,0,0,22561,0,0,22562,0,0,0,0,0,0,0,0,0,0,0,22566,0,0,0,0,
+22567,22568,0,0,22575,0,22579,0,22582,22583,22585,0,0,0,0,0,22586,0,0,22587,0,0,
+22590,0,0,0,0,0,22591,0,22592,0,0,0,0,0,22593,0,22602,0,0,22604,0,0,22609,0,0,
+22618,0,0,0,0,0,0,22619,0,22624,22625,0,0,22638,0,0,0,0,0,22639,0,0,22640,0,0,0,
+0,0,0,0,22644,0,22645,22647,0,0,0,0,22652,22653,0,0,0,22654,0,22655,0,0,0,22656,
+0,0,0,0,0,0,0,0,0,0,22673,22675,22676,0,0,22678,22679,0,22691,0,0,0,0,0,0,0,
+22693,0,0,22696,0,22699,22707,22708,0,0,0,0,0,0,0,0,22718,0,22719,0,0,0,0,22723,
+0,0,0,22724,22725,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22726,22728,0,0,0,0,0,0,0,0,22729,
+0,0,22731,0,0,0,0,22732,22735,22736,0,0,0,0,22739,0,22749,0,0,22751,0,0,0,0,0,0,
+0,0,0,0,0,22758,0,0,0,0,0,22760,0,0,0,0,0,22764,22765,22766,0,22768,0,0,0,0,0,
+22769,22770,0,0,0,0,0,0,22771,0,0,22772,22775,0,22776,22777,22780,0,0,22782,
+22784,0,22787,0,22789,22796,0,0,0,0,0,22798,0,0,0,0,0,0,22802,0,22803,22804,0,0,
+0,0,0,0,0,0,0,0,22805,0,0,22810,22811,22814,22816,0,22825,22826,0,22831,22833,0,
+0,0,0,0,0,0,0,0,22834,0,22836,22838,0,22839,0,0,0,0,0,22840,0,22847,0,0,0,0,0,
+22856,22857,0,22858,22859,0,0,22862,0,0,22864,0,0,0,0,22865,0,0,0,0,0,0,0,0,0,0,
+0,22866,0,22867,22868,0,0,0,0,22869,0,22871,0,22872,0,22873,22881,22882,22884,
+22885,0,0,0,0,0,0,0,22886,22887,0,22894,0,22895,0,0,0,22900,0,22901,0,0,0,0,
+22904,0,0,0,0,22905,22907,0,0,0,22915,22917,0,0,22918,0,0,0,22920,0,0,0,22929,
+22930,0,0,0,22941,22942,0,0,0,22943,0,0,0,22944,0,0,0,0,0,0,0,22946,0,22947,0,0,
+22954,0,22956,0,0,22962,0,0,0,0,0,0,0,22963,0,0,22964,0,0,0,0,0,0,0,22965,0,
+22968,0,0,0,22969,0,0,0,0,0,22970,0,22971,0,0,0,0,0,22978,0,0,22979,0,22987,0,0,
+22989,0,0,0,0,0,0,22990,0,23005,0,0,0,0,0,0,0,23006,23007,23008,0,0,23023,23024,
+23029,0,0,0,0,23030,0,0,0,0,0,23032,0,0,0,0,0,23035,0,0,0,0,23038,0,0,0,23048,0,
+23049,23052,23053,23060,23061,0,23063,0,0,0,0,23067,23068,0,0,0,23069,23073,0,0,
+0,23127,0,23128,0,0,0,0,0,23129,0,23138,23141,0,23149,0,0,23150,0,0,0,23152,0,0,
+0,0,0,0,0,0,23154,0,0,0,0,23157,23159,23160,0,0,0,0,0,0,0,0,0,0,0,0,23180,0,0,0,
+0,23181,0,0,23188,0,23189,0,0,0,0,0,0,0,0,0,0,0,0,23195,0,0,23196,23199,0,0,0,0,
+0,0,0,0,0,23202,0,23204,0,23207,0,23209,23210,0,0,0,0,0,0,23227,23229,0,0,23230,
+23234,23238,0,0,0,23245,23246,23248,0,0,0,0,23249,23254,0,0,0,23265,0,0,0,0,0,0,
+0,23268,0,23276,0,0,0,0,23277,0,23297,0,23298,0,0,0,0,23299,0,23302,0,0,23303,
+23312,0,0,23314,0,23320,0,0,0,0,23324,0,23325,0,23328,0,23334,0,0,0,23337,0,0,0,
+0,23343,23344,23346,0,23348,0,0,0,0,0,0,0,0,23353,0,0,0,0,23355,0,23356,23358,0,
+0,0,23359,23360,0,23361,0,23367,0,23369,0,0,23373,0,23378,23379,0,23382,23383,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,23387,0,0,0,0,0,0,23388,23390,0,0,23393,23398,0,0,0,
+23399,0,0,0,23400,0,0,0,0,23401,0,0,0,23415,0,0,0,0,0,0,0,0,23416,0,23422,0,
+23443,23444,0,0,0,0,23448,0,23454,0,0,0,0,0,0,23456,0,0,23458,23464,0,0,0,0,0,0,
+23465,0,0,0,23470,23471,0,0,23472,0,0,0,23473,23496,0,0,0,0,0,0,0,0,23497,0,
+23499,0,0,23502,0,0,23503,0,0,23513,0,0,23515,0,0,0,23517,0,0,0,0,23518,23519,
+23521,23524,0,23525,23528,23539,0,0,0,0,0,23541,0,0,23544,0,0,23556,0,0,23557,0,
+0,0,0,0,0,0,0,0,0,0,0,0,23559,0,23560,0,0,23561,0,0,23566,0,0,0,0,0,23568,23569,
+23570,0,0,0,0,23571,0,23574,0,0,0,0,0,0,0,0,0,0,0,23575,0,23579,0,0,23581,0,0,0,
+0,0,0,23587,0,0,0,0,0,0,0,23596,23598,0,0,0,0,23602,23606,0,0,23607,0,23608,0,0,
+0,23614,23616,0,0,0,0,0,23618,0,0,23619,0,0,0,0,23621,23626,0,23627,0,0,0,0,0,0,
+0,23629,0,23630,0,0,0,0,23634,0,23636,0,0,0,0,0,0,23638,0,0,0,0,23640,23667,0,
+23669,0,0,0,23681,0,0,0,0,0,0,0,23682,0,23683,0,0,0,0,0,23684,0,0,0,23685,23689,
+0,23693,23694,23700,0,23702,0,23709,0,0,0,0,0,0,0,23712,0,0,0,0,0,23714,0,0,
+23715,0,0,0,0,23718,0,0,23720,0,0,0,0,23722,0,0,0,23726,23729,0,23741,23746,0,
+23748,0,0,0,0,23749,0,0,0,0,0,23750,0,0,0,0,23751,0,23753,0,0,0,0,23757,23765,0,
+0,0,23770,0,0,0,0,0,0,0,23771,0,23772,23781,0,0,23796,0,0,0,0,23798,0,23799,0,0,
+0,23802,0,0,23806,0,23807,0,0,23808,0,23809,0,23819,0,0,0,23821,0,23827,0,0,0,
+23829,0,0,0,0,0,0,0,23830,0,0,0,0,0,0,23832,23833,23834,23835,0,0,0,0,23837,
+23838,0,0,0,0,0,23846,0,0,0,0,0,0,23847,0,0,0,0,0,23879,23881,0,0,23882,23883,
+23895,0,23899,0,0,0,0,23901,0,0,0,0,0,0,23902,0,0,0,0,0,23903,23905,0,23906,0,
+23907,23918,23919,23920,0,23922,0,23924,0,23927,0,23934,0,23937,23941,0,23942,
+23946,0,0,0,0,0,23955,23956,23958,0,0,0,0,0,0,23959,0,23962,23965,0,23966,0,0,0,
+0,23967,23968,0,0,23973,0,0,23974,0,0,0,0,23975,0,23976,0,0,0,0,0,0,0,0,0,0,0,0,
+0,23977,0,0,0,0,0,0,0,0,23980,0,0,23984,0,23985,0,0,23987,0,0,23988,23990,23991,
+0,0,0,0,0,0,23992,0,0,0,0,0,0,0,0,23994,0,0,0,23998,0,0,0,0,0,0,0,0,0,23999,0,0,
+24003,0,24004,0,24006,0,0,0,24007,0,0,24008,0,0,0,0,0,0,0,24009,0,0,24010,0,0,
+24011,0,0,24013,24014,0,0,24015,24016,24027,0,24028,24029,0,24030,0,0,0,0,0,
+24033,24034,0,24035,0,0,24036,0,0,24044,0,24048,24049,24063,24067,0,24068,24070,
+0,0,24071,24078,24087,0,24090,0,0,0,24095,0,24098,24101,24104,24106,0,24107,0,0,
+0,24108,0,0,0,0,24110,24111,0,24113,0,0,24115,24120,0,0,0,0,0,0,24124,0,24125,0,
+24126,0,24127,0,0,0,0,0,24135,0,0,24136,0,24137,24142,0,0,0,24146,0,0,24147,
+24149,24154,0,24163,0,0,0,24165,24166,24167,0,0,0,0,0,0,0,0,0,0,24169,24170,
+24175,0,0,0,24178,0,0,24179,0,0,24181,0,24184,24197,0,24201,24204,0,0,0,0,0,0,
+24206,24212,24220,0,0,0,24224,0,0,0,0,0,0,0,0,24226,0,24234,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,24235,0,24236,0,0,0,0,0,24239,24240,24241,0,0,24248,0,0,24249,0,
+24251,0,0,0,0,0,0,24253,0,24268,0,0,0,24269,0,24271,24272,0,0,0,0,24273,0,0,
+24274,0,0,24279,0,0,0,0,0,0,0,24280,0,24293,24294,0,0,0,0,0,0,24296,0,0,24323,0,
+0,0,24329,24330,24331,24339,0,24351,0,0,24369,24370,0,0,0,24371,0,0,0,0,24372,
+24373,24374,0,0,0,0,0,24378,0,0,0,0,24379,0,24381,0,24383,24389,0,24390,0,0,
+24394,24395,24400,0,0,0,24401,24402,0,24406,0,0,0,24411,0,0,0,24415,0,24416,0,0,
+0,0,0,24417,0,24419,0,24422,0,24423,24428,0,24435,0,0,0,24439,0,0,0,24440,24442,
+24446,0,0,0,24447,24448,24449,24452,0,0,0,0,24453,24457,0,0,24458,24459,24460,0,
+24465,0,0,0,0,0,0,0,24470,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24471,0,24473,
+24474,24475,24476,0,24478,0,0,0,0,24480,0,0,0,0,0,0,0,0,0,0,24481,0,0,0,0,0,0,0,
+0,0,0,24482,24485,0,0,0,0,24486,0,0,0,24488,0,0,0,24494,0,0,0,0,24497,0,0,24498,
+0,0,0,24499,24506,0,0,0,24507,0,0,24511,0,0,24513,24514,0,0,0,0,0,24517,0,24518,
+0,24520,0,24521,24524,24525,0,0,0,0,0,24527,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24528,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24537,24539,0,24540,0,0,0,24548,0,0,0,0,0,24549,
+24550,0,0,0,24553,24554,0,24555,0,24556,0,24558,0,0,0,0,0,24560,0,0,0,24561,0,0,
+0,0,0,24562,0,0,0,0,0,0,0,0,0,0,0,0,0,24567,0,0,0,0,0,24569,0,0,0,24574,0,24575,
+0,0,0,0,0,0,0,0,0,0,0,24577,24581,0,24584,0,0,0,0,0,24585,0,0,0,0,0,24586,0,0,
+24587,0,24588,0,0,0,0,0,0,0,0,0,0,24590,24591,0,0,0,0,24592,0,0,0,0,0,0,0,24594,
+0,0,0,0,0,0,0,24596,24597,0,0,0,0,24602,24603,0,0,0,0,24604,0,0,24605,0,24610,0,
+0,24611,0,0,0,0,24612,24615,24616,24624,0,0,0,24627,0,24638,24639,0,0,0,0,24640,
+0,0,0,24655,24656,24657,0,0,0,0,0,0,0,0,24662,0,24663,24664,0,0,0,0,0,24665,0,0,
+0,0,24667,0,0,0,0,0,0,24668,24669,0,24670,24674,0,0,0,24675,0,24678,0,0,24679,0,
+0,0,24681,0,24683,0,0,0,0,24684,0,24685,0,0,24686,0,0,24688,24689,0,0,0,0,24690,
+24691,0,0,0,0,0,0,0,24697,0,24698,0,0,0,0,0,0,0,0,24709,0,0,0,0,0,24710,0,24712,
+0,0,0,0,0,0,24713,24714,0,24715,0,24716,24718,0,24719,0,0,0,0,24720,0,0,24725,0,
+0,24738,0,24749,24750,0,0,0,24752,0,0,0,24753,0,0,0,24758,0,0,0,0,0,24762,0,
+24763,0,0,0,0,0,0,0,24764,0,0,0,0,0,24765,24767,24768,0,24772,0,0,0,0,24773,0,0,
+0,0,24777,0,0,0,0,0,24785,0,24786,24788,0,0,0,24789,0,0,0,0,24794,24798,0,24799,
+24800,0,0,0,24803,0,24804,24806,0,24807,0,0,0,24810,0,0,0,0,0,0,24827,24828,0,
+24835,0,0,0,0,0,0,24836,0,0,0,0,0,24839,0,24843,24844,0,0,0,0,0,0,0,0,0,0,24847,
+0,0,24848,0,0,0,0,0,0,24849,0,24850,24851,0,0,0,24852,0,24853,0,0,0,0,0,0,0,0,0,
+24854,0,24855,0,0,24868,0,0,0,24883,0,0,0,24884,0,24895,24897,0,0,0,0,0,24899,0,
+0,0,0,0,24900,0,24913,0,0,0,0,0,0,24914,0,0,24917,24930,24931,0,0,0,24932,0,0,
+24939,0,0,24942,0,0,0,0,0,0,0,0,0,24945,24950,0,24951,0,0,24953,0,0,0,24954,0,
+24959,0,0,0,24961,0,0,24962,0,24964,24968,24970,24972,0,0,0,0,0,24976,0,0,0,
+24977,0,24982,0,0,24983,0,0,24984,0,0,0,24993,0,0,0,24994,0,0,25001,0,0,0,25003,
+0,0,25018,0,0,25023,0,0,0,25034,0,0,25035,25036,0,25037,0,0,0,0,0,0,0,25039,0,0,
+0,0,0,25040,0,0,0,0,0,0,0,25042,0,0,25043,25045,0,0,0,0,0,0,25049,0,0,25051,0,
+25052,25053,0,0,25054,0,0,0,25055,0,0,0,0,25057,25059,0,0,25060,25064,0,25065,
+25069,25070,0,0,0,0,25072,0,25073,0,25090,0,0,25092,25093,25101,0,0,0,0,0,0,
+25105,25108,0,0,25113,0,0,25115,25116,0,0,0,0,0,0,25117,0,0,0,25120,25121,0,0,0,
+0,0,0,0,25125,0,0,0,25126,0,25130,25134,0,25139,0,25143,0,0,0,25151,0,25161,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25163,0,0,0,0,0,0,0,25174,0,25175,0,25207,0,0,
+0,25209,0,0,0,0,25213,0,25219,0,25223,0,25225,0,0,0,25227,0,0,0,25228,0,0,0,
+25229,0,0,0,0,0,0,0,25231,25233,0,0,0,0,25237,25239,0,0,0,25243,0,0,0,25252,0,
+25257,25258,0,0,0,0,25260,25265,0,25268,0,0,25273,25324,0,25325,0,25326,0,0,0,0,
+0,0,0,0,25327,0,0,0,0,0,25328,0,0,0,0,0,0,25332,0,0,0,25333,0,0,0,25336,25337,
+25338,0,0,25343,0,25350,0,0,0,0,0,0,0,25352,0,25354,0,25375,0,25379,0,0,0,0,
+25384,0,0,0,0,0,0,0,0,0,25386,0,25388,0,25390,0,0,25399,0,0,25401,0,0,0,25402,0,
+0,0,25407,0,0,0,0,0,0,0,0,0,0,0,25413,25415,0,0,25417,0,0,0,0,0,0,0,25419,0,0,0,
+25421,0,0,0,25424,0,0,0,0,25433,0,0,0,0,0,0,0,0,0,25435,0,0,0,0,0,0,25436,0,0,0,
+25437,0,0,25440,0,0,0,0,0,0,25442,0,0,25443,0,25446,0,0,25449,0,0,0,25450,0,0,0,
+0,25452,0,25453,25454,25455,0,0,0,25456,0,25457,0,0,0,25459,0,25461,0,25468,0,0,
+0,0,0,0,0,0,25469,0,0,0,0,0,25471,0,0,0,0,0,25474,0,0,0,0,0,0,0,0,25475,0,0,0,0,
+25477,0,0,0,0,25483,0,0,0,0,0,25484,0,0,0,0,0,0,0,0,0,0,0,0,25485,0,25497,0,0,
+25498,0,25504,0,25510,0,25512,0,0,25513,25514,0,0,0,0,0,0,25517,25518,25519,0,
+25520,0,0,0,0,0,0,0,25521,0,25522,25527,25534,0,25536,0,25537,0,0,25548,25550,0,
+0,25551,0,25552,0,0,0,0,0,25554,0,25555,0,25556,25557,25568,0,0,0,25570,25571,0,
+0,0,0,0,0,25574,0,0,0,0,25579,0,0,0,25581,0,0,0,25582,0,0,0,0,0,0,0,0,0,25588,0,
+0,0,0,25589,0,0,0,0,25590,0,25591,25592,25593,0,25594,0,0,0,25596,0,25597,25615,
+0,0,0,0,0,25618,0,0,0,0,25619,25623,0,0,25629,0,0,25631,0,0,0,25635,25636,0,0,
+25649,0,0,0,0,25654,0,0,0,25661,25663,0,0,25671,0,0,25678,25698,0,25699,25702,
+25703,0,0,0,0,0,0,0,0,25704,0,0,0,0,0,25706,0,0,25710,0,25711,0,25712,0,25715,
+25716,25717,0,0,25718,25728,25732,0,0,0,25734,0,0,0,0,0,0,0,0,0,25737,0,0,25739,
+0,0,0,25740,0,25741,25745,0,25746,0,25748,25772,25778,0,0,0,0,0,25780,0,0,0,0,
+25781,0,25782,25784,25785,0,0,0,25789,0,0,0,0,0,0,25797,25801,0,0,0,25808,25809,
+0,0,25811,25814,25815,0,0,25817,0,0,0,0,0,0,0,0,25820,0,0,0,0,25832,25833,0,0,0,
+25846,0,0,0,25847,25848,0,0,0,0,0,0,0,0,0,25849,25850,0,0,25851,0,0,25852,0,
+25862,0,0,0,25863,25865,0,0,0,0,0,0,0,25867,25868,0,25869,25874,0,25875,0,25876,
+25877,0,0,0,0,25878,25902,0,0,0,0,0,0,0,25903,25904,25905,0,0,0,25908,25909,0,0,
+0,0,25910,0,0,0,0,0,0,0,25912,0,25913,0,0,0,0,0,0,0,0,25914,0,0,25916,0,0,0,0,0,
+25917,25927,0,0,0,0,25928,0,0,25930,0,0,0,25933,0,0,25938,25942,0,0,0,0,0,0,0,
+25945,0,25950,0,25956,0,0,25961,25962,0,0,25963,0,25964,25965,25966,0,0,0,0,0,
+25967,0,0,0,0,25968,0,0,0,25969,25971,0,0,0,0,0,25973,25975,0,0,0,0,0,0,0,25978,
+0,25981,0,0,0,25982,0,0,0,25984,0,0,0,0,0,0,0,25993,0,0,0,0,0,0,0,0,0,0,0,0,0,
+26002,0,0,0,26005,0,0,0,26006,26007,0,0,26014,26015,26016,0,0,0,0,0,0,26017,
+26018,26020,0,26022,26023,0,0,0,26024,26028,0,26029,26033,26034,26044,0,0,0,0,0,
+26046,0,0,26047,0,0,26049,0,26050,0,26051,0,0,0,0,0,26053,0,0,0,0,26054,26059,0,
+0,0,0,0,0,26060,0,26066,0,0,0,0,0,0,0,0,0,0,0,0,26067,0,26069,0,0,26071,0,0,0,
+26073,0,26074,26077,0,0,0,0,26078,0,0,0,26079,0,26090,0,0,26094,0,0,0,0,0,0,0,0,
+26095,0,0,0,0,0,0,0,0,0,0,0,26096,26101,0,26107,26122,0,26124,0,0,26125,0,0,0,0,
+0,0,26136,26141,26155,0,0,0,0,0,0,0,0,0,26164,26166,0,0,0,26167,0,26170,26171,0,
+0,26172,0,0,26174,0,0,0,0,0,0,0,0,0,0,0,0,0,26175,0,0,0,26176,26177,0,26321,
+26322,0,26323,0,0,26324,0,0,0,0,0,0,0,26325,0,26331,0,0,0,0,0,0,26335,0,0,0,
+26350,0,0,0,26379,0,0,26382,26383,26385,0,0,26392,26406,0,0,0,0,26411,0,0,0,0,0,
+26412,0,0,26420,0,0,26423,0,26424,26426,26432,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+26435,0,26436,0,0,0,0,0,26441,0,26444,0,0,0,26446,0,0,0,0,26447,0,0,0,0,26449,0,
+26450,26452,0,26453,26454,0,0,0,26455,0,0,0,26456,0,0,26458,0,0,26460,0,26463,0,
+0,0,0,0,0,0,0,26464,26470,0,0,0,0,0,0,0,0,0,26473,0,0,26474,0,0,0,0,0,0,0,26475,
+0,0,0,0,0,0,0,26477,0,26485,0,0,26486,0,26487,0,0,26488,26493,26494,0,0,26495,0,
+26497,26504,26506,0,0,0,0,0,26507,0,0,0,0,0,26509,0,0,26510,0,0,0,0,0,0,0,0,0,0,
+0,0,0,26512,0,26513,26515,0,0,0,26518,0,0,0,26519,0,26524,26526,0,0,0,26527,0,
+26532,0,26533,26537,26558,0,0,0,26559,0,0,0,26571,0,0,26573,0,26588,0,26593,0,0,
+0,0,0,0,26603,0,26604,0,0,0,0,0,0,0,0,0,0,26606,0,0,0,0,0,0,0,26607,26609,26611,
+26614,0,0,0,26616,26620,0,26621,0,0,0,0,0,26627,0,26629,0,0,26630,0,0,26632,
+26643,0,0,0,26644,0,0,0,0,0,0,0,0,0,26646,26647,0,0,0,26650,0,0,26656,0,0,0,0,
+26663,26670,26671,0,0,0,26685,26686,26687,0,26689,0,0,0,0,26744,0,26745,0,26747,
+26748,0,26749,26750,26751,0,0,0,0,26752,26755,0,0,0,26756,26769,0,0,0,26774,0,0,
+0,0,0,26775,0,26777,26778,0,26786,0,0,0,26787,0,0,0,0,0,0,0,0,0,0,0,0,0,26788,0,
+0,26789,0,0,0,0,0,26791,0,26792,26793,0,0,0,26794,0,26797,26798,0,0,0,26800,0,0,
+26803,0,26804,0,0,0,0,0,0,0,0,0,26805,0,0,26808,0,0,26809,0,0,0,0,0,0,0,26812,0,
+26825,0,0,0,0,0,0,0,26826,0,0,26827,26829,26834,0,0,0,0,26835,0,0,26849,0,26851,
+0,0,0,0,0,0,0,0,0,26852,0,26853,26857,0,26858,0,26859,0,0,0,0,0,0,0,26876,0,
+26878,26882,26883,0,0,0,0,26890,26894,0,0,0,0,26895,26896,0,0,0,0,0,26900,0,0,0,
+0,0,0,0,26911,26913,26914,26915,26916,26919,0,0,0,26921,26922,0,0,26925,0,0,0,
+26928,0,0,26929,26930,0,0,0,26931,0,26932,0,0,0,0,0,26933,0,0,0,0,0,0,26937,0,0,
+26943,0,0,26944,0,0,0,26946,0,0,0,0,0,0,0,26956,0,26958,0,0,26963,0,0,0,0,0,0,0,
+26965,0,26969,26970,26972,0,0,0,0,0,26973,0,26974,0,26978,0,26980,0,0,0,0,0,0,
+26982,0,26986,26987,0,26990,0,0,0,0,27003,27006,0,0,27007,27010,27012,27013,0,0,
+0,0,0,0,0,0,27014,27015,27018,0,27019,0,0,0,0,0,27025,0,0,0,27026,0,0,0,0,27029,
+27030,27031,27034,0,0,27036,27037,0,0,0,27038,27042,0,0,0,27044,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,27045,0,0,0,0,0,0,0,27046,0,0,0,0,0,0,0,27047,27049,0,27050,0,0,0,
+27051,27052,0,27055,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27056,27058,27059,0,
+27061,0,27064,0,0,0,0,0,27069,0,0,27070,0,0,0,0,0,0,0,27072,0,0,0,0,0,0,0,0,
+27076,0,0,0,0,0,27078,0,27079,0,0,0,27081,0,0,0,0,0,0,27082,0,27083,27086,0,0,0,
+0,27087,0,0,0,0,0,27088,27090,0,27094,0,0,27095,0,27099,27102,0,0,0,27103,0,0,0,
+0,27105,0,0,0,27106,0,0,0,0,0,0,27107,0,0,0,0,27108,27117,0,0,0,0,27118,0,0,
+27124,0,27126,0,0,27130,27131,0,0,0,0,0,0,27147,0,0,0,0,27148,27149,0,0,0,0,
+27150,27151,0,27152,0,27159,0,0,0,27164,0,0,0,0,0,0,0,27175,0,27189,0,0,27191,0,
+27193,0,27195,0,27198,0,0,0,0,0,27200,0,0,0,0,27202,0,0,0,0,27203,0,0,27204,0,0,
+27206,0,27207,0,0,0,0,27209,0,0,0,27213,0,0,27216,27219,27220,27222,27223,0,
+27224,0,27225,27226,0,0,27233,0,0,0,0,27235,0,27237,0,27238,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,27239,0,27242,27243,0,27250,0,0,0,27251,0,27253,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,27254,27255,27258,0,0,0,27259,0,0,0,0,0,0,27267,0,27276,27278,
+0,0,0,0,0,0,0,0,0,27296,27297,27301,0,0,0,0,0,0,27302,0,0,0,0,0,0,27312,27313,0,
+0,0,0,0,27318,0,27320,0,27329,0,27330,27331,0,27332,0,0,0,0,27340,0,0,0,27348,0,
+0,0,0,0,0,27350,0,27351,0,0,0,0,27355,0,0,27358,27359,27361,0,0,0,27365,0,27367,
+0,27376,27378,0,0,27379,0,0,0,0,0,0,27396,0,27397,27404,0,0,0,0,0,27408,0,0,0,0,
+27453,0,0,0,27456,0,0,0,27458,0,0,0,0,0,0,0,27459,0,0,0,27460,0,0,27461,0,27465,
+27467,0,0,27469,0,27470,0,27471,0,27477,27482,0,0,0,0,0,0,27484,0,0,0,0,0,0,
+27485,0,0,0,0,0,27493,0,27494,27502,0,0,0,0,0,0,0,0,0,0,0,0,27511,27532,0,0,0,
+27533,27545,0,0,0,27546,0,0,0,0,0,0,0,0,0,0,27547,0,0,27549,27550,0,27551,0,0,0,
+0,0,0,0,27555,0,0,27571,0,27573,27574,27575,27577,0,27578,0,0,27579,27585,0,0,0,
+0,0,27586,0,0,27588,27589,0,0,0,0,27596,0,0,27600,0,0,0,0,0,0,0,0,0,0,0,27608,0,
+0,0,0,0,0,0,0,0,0,0,27610,0,0,0,27618,0,0,27620,0,0,0,27631,0,0,27632,27634,0,
+27636,27638,0,0,0,27643,0,27644,27649,0,0,0,0,0,0,0,0,0,0,0,0,0,27651,27660,0,
+27661,0,0,0,0,0,0,0,27662,0,0,27664,0,27665,0,0,0,27669,0,27671,0,0,0,27673,
+27674,0,0,0,27682,0,0,0,27711,0,27712,27713,27719,27720,0,0,27728,0,27729,0,0,0,
+0,0,0,0,0,0,27731,0,0,27732,0,27733,0,27738,0,0,0,27742,0,0,0,27743,27744,0,0,0,
+0,0,0,27745,27746,0,0,0,27747,27748,27751,27752,0,0,0,27768,27770,0,0,0,27774,
+27775,0,27776,27777,0,0,27781,0,27784,0,27786,0,0,27791,0,27792,27793,27804,0,
+27812,27813,0,0,0,0,0,0,0,0,27814,0,27825,0,27827,0,0,0,0,27828,27861,27862,0,0,
+0,27864,0,0,0,27865,27884,0,27889,0,0,0,0,0,27890,0,27891,0,0,0,27892,0,0,0,0,0,
+27897,27898,0,0,27899,0,0,0,27901,27905,0,0,27920,0,0,27921,0,27922,0,0,0,27931,
+27934,0,0,0,0,0,0,0,0,0,0,27941,0,27942,0,27945,0,27947,27954,0,0,0,0,27960,
+27963,0,0,0,0,0,0,0,0,27964,27965,0,0,0,27967,0,27969,27975,0,27976,27977,0,
+27981,0,27983,28051,28052,0,0,0,0,0,28056,0,0,0,0,0,0,28058,28059,0,0,28061,0,0,
+0,0,0,0,0,28063,0,0,0,0,0,0,28066,0,0,0,0,0,0,28069,28070,28072,0,28073,0,0,
+28074,0,0,0,0,28075,0,0,0,0,0,0,0,28078,0,0,0,0,28085,0,0,0,0,28086,0,0,0,0,0,0,
+28088,0,0,0,0,0,0,0,0,28090,0,28097,28114,28115,0,0,0,0,0,0,0,28116,0,0,0,0,0,
+28118,0,28129,0,28131,0,0,28135,0,0,0,28140,28141,0,0,0,28146,0,0,0,0,28152,0,0,
+0,0,28155,28157,28161,0,0,0,0,28166,0,28167,0,0,0,0,0,0,0,0,0,0,0,28172,0,0,0,0,
+0,0,28173,0,0,28175,0,0,0,0,0,0,0,0,0,28178,28188,0,28190,0,0,0,0,0,28191,0,
+28193,28206,0,0,28207,28209,0,28211,0,28213,0,0,0,28215,28216,28217,0,28222,0,
+28223,28225,0,0,0,28226,0,28227,28229,28232,0,0,0,0,0,0,0,0,0,28235,0,28241,0,0,
+28242,0,0,0,0,28243,0,0,0,28245,0,0,0,28248,28250,0,28251,28252,0,0,0,0,0,0,
+28253,0,0,28254,28255,0,0,28256,0,0,28258,0,0,0,0,0,28259,0,0,28260,0,0,28261,0,
+0,0,0,28262,28263,0,0,28264,0,0,0,28266,0,28268,28269,0,28270,28272,28274,0,
+28277,28278,0,0,0,28279,0,28280,28281,28283,0,28292,0,28294,0,28297,0,0,0,0,
+28299,0,0,0,0,0,28300,0,0,0,0,0,0,0,28301,0,0,0,0,0,0,0,0,0,0,0,0,0,28302,28303,
+0,0,0,0,28304,0,0,28305,0,28312,0,28313,28314,0,0,0,0,0,0,28315,0,0,0,28320,
+28321,0,0,28328,0,0,0,28329,28338,0,28339,0,0,28344,0,0,0,0,0,0,0,0,28347,0,0,0,
+0,0,0,0,0,28348,0,0,0,0,0,28411,0,28412,28413,0,28416,0,0,0,28420,0,0,0,0,0,
+28421,0,0,0,0,28423,0,0,0,28424,0,0,28428,0,0,0,0,0,28429,0,0,0,28431,28434,0,
+28458,0,0,0,0,0,0,0,0,0,0,0,28464,0,0,0,0,28465,0,28467,0,0,0,0,0,0,28471,0,0,0,
+0,28474,0,28480,0,28481,0,0,28485,0,0,0,0,28486,28488,0,0,28489,0,0,0,0,28492,0,
+0,0,28495,0,28497,0,28499,0,0,0,0,28500,0,0,28502,28503,0,0,0,28508,0,0,0,28510,
+0,0,28512,28513,28514,28521,0,28526,0,28527,28528,0,0,0,0,28529,0,0,28532,0,0,
+28537,28538,0,0,0,28539,0,28548,0,28553,28554,0,0,0,0,0,0,0,0,0,0,0,0,28560,
+28563,0,0,28564,0,0,0,0,28565,0,0,0,0,0,0,0,28566,28568,0,0,0,0,0,0,28569,0,0,0,
+28570,0,28572,28573,0,0,0,0,28575,0,0,0,0,28576,28581,28588,0,0,28589,0,0,0,
+28590,28595,0,28598,0,0,28601,0,0,28605,0,0,0,0,28614,28615,28619,0,0,0,0,0,0,
+28620,0,28626,0,0,28628,0,28631,0,28632,0,0,0,0,0,0,28635,0,0,0,28637,28638,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28639,0,28643,0,0,28652,0,0,0,28662,0,
+28670,28671,0,0,0,0,0,0,0,0,0,28672,28673,28675,28676,0,0,0,0,0,0,0,28691,0,0,0,
+28695,0,0,0,28696,0,28697,28698,0,28705,0,28707,28708,28710,0,0,0,0,0,0,0,28711,
+28728,0,0,0,28736,0,0,0,28737,0,0,0,0,0,0,0,0,0,28738,0,28739,0,28741,0,0,28742,
+0,0,0,0,0,0,0,0,0,0,0,28745,0,0,0,0,0,0,28749,28750,28752,28754,28756,0,28757,0,
+0,0,0,28759,28760,0,0,0,0,0,0,28762,0,0,0,28764,0,0,0,0,0,0,28766,0,28767,28768,
+0,0,0,0,28769,28770,0,0,0,0,0,0,0,0,0,0,0,0,0,28771,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,28772,0,28773,0,28782,0,0,0,0,0,0,28784,0,28785,0,28786,0,0,0,28787,0,0,0,
+28797,0,0,0,0,0,0,28799,0,0,28801,0,0,0,0,28802,0,28805,0,0,28806,0,0,28807,0,0,
+0,0,0,0,0,28808,0,0,0,0,0,28810,28812,0,0,28816,28819,0,0,28821,0,28826,0,0,0,
+28842,28852,0,0,28853,0,28854,28855,0,0,0,28857,0,0,0,28858,0,28867,28868,28869,
+0,0,0,28874,28880,28882,28890,28892,0,0,0,0,0,0,0,28895,0,0,0,28898,28899,0,0,0,
+28900,0,0,28904,0,28906,0,0,0,0,28907,0,0,0,0,0,0,28908,0,0,0,28910,0,28914,0,0,
+0,0,0,0,0,28915,28916,28919,0,0,28920,0,28921,0,0,0,0,0,0,0,0,28924,0,0,0,0,
+28926,28929,0,0,0,28930,0,28936,0,28939,0,0,0,0,28942,0,0,0,0,0,0,28956,0,0,0,
+28966,0,0,0,0,28967,0,0,0,0,0,0,0,0,0,28968,0,28971,0,28975,28976,0,28982,28983,
+0,0,28984,28989,28996,28997,28998,0,0,0,0,0,0,28999,0,0,0,0,0,29000,0,29001,0,0,
+0,29009,0,0,29011,0,0,29021,0,0,0,0,29024,0,29025,0,0,0,0,0,29026,0,0,0,29036,0,
+0,0,29037,0,0,0,0,29038,0,29045,0,29047,0,0,0,0,0,0,0,0,0,29051,0,0,0,29054,
+29056,29062,0,29070,29082,0,0,0,29083,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29084,0,0,
+0,0,29085,29088,0,0,0,0,0,0,0,29090,29097,0,0,0,29103,0,0,0,0,0,0,0,0,29105,0,0,
+0,0,0,29107,0,29109,0,0,0,29115,0,0,29120,0,0,29138,29140,0,0,0,0,0,0,0,0,0,
+29152,0,29160,29174,0,29176,0,0,29180,0,29181,0,0,0,0,0,0,0,0,29228,0,0,29229,0,
+0,29230,0,0,0,0,0,0,0,0,0,0,29234,0,0,0,29241,0,29245,0,29248,0,29250,29256,
+29280,0,29282,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29285,0,0,29286,29291,29292,0,0,0,0,
+29294,0,29295,0,0,0,0,0,29296,29297,29298,29300,0,29302,0,0,29304,29307,0,29312,
+0,0,0,29322,0,0,29323,0,0,29324,29326,29328,0,29335,0,0,0,0,0,0,0,29338,29339,0,
+0,0,0,0,29341,29343,0,0,0,0,29344,0,0,0,0,0,29345,0,0,0,0,29346,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,29347,29348,29349,0,0,29354,0,0,29355,0,0,0,0,0,0,0,0,29357,0,0,
+0,0,29364,0,29365,0,0,0,0,0,0,0,29366,0,0,29368,0,0,0,0,0,0,0,0,29378,0,29381,0,
+0,0,0,0,0,0,0,29386,0,0,0,0,0,0,29389,0,0,0,29390,0,0,29391,29397,0,29398,29412,
+29414,29418,29419,0,0,0,0,0,0,0,29420,0,0,0,0,0,0,0,29423,0,0,0,29435,0,0,0,
+29437,0,0,29439,0,29441,0,0,0,0,29443,0,29446,29450,29452,0,0,0,0,0,29456,0,0,0,
+0,0,29461,0,0,0,29464,0,0,0,0,0,0,0,0,29468,0,29473,0,0,0,29486,0,0,0,29490,0,0,
+0,29491,29492,0,0,29497,0,0,0,29498,0,29499,0,29502,29505,0,29509,0,0,0,29510,0,
+0,0,29512,0,0,0,29516,0,0,0,0,0,0,0,0,29518,0,29519,0,0,0,0,0,29520,29521,29529,
+0,0,0,0,0,0,0,0,29530,0,0,29531,29538,0,29540,0,0,0,29542,0,29543,29544,29547,0,
+0,29548,0,0,0,29549,0,0,0,29550,0,0,29552,0,0,0,0,29558,29561,0,29562,29564,0,0,
+29565,0,0,29566,0,0,0,0,0,0,0,0,0,0,29578,29584,29586,29591,0,0,0,0,29593,29594,
+0,0,29597,0,0,29613,0,29614,0,29615,0,0,0,0,29616,29617,0,0,29625,0,0,0,29632,0,
+0,0,0,0,0,0,29633,0,0,0,0,0,29634,29635,29637,0,29638,0,29641,29643,0,0,0,0,0,0,
+29644,0,29645,0,29649,0,0,0,29650,0,29653,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29656,
+29659,0,0,29660,0,0,0,29661,0,0,0,0,0,29664,0,0,0,29671,29673,0,0,0,0,0,0,0,
+29675,0,29677,29679,0,0,29684,0,0,0,0,0,29685,0,0,0,29687,0,0,0,29688,0,29689,
+29690,29700,0,29701,0,0,0,29702,0,29706,0,0,0,0,0,0,0,29720,0,29721,0,29727,0,
+29733,29734,0,29750,29761,0,29763,0,0,0,0,0,29764,0,0,29765,0,0,0,29771,0,0,0,0,
+0,0,0,0,0,0,0,0,29772,0,0,0,29773,29774,29775,0,0,0,0,0,0,0,0,0,0,0,29822,0,0,0,
+29824,0,29825,0,0,0,0,0,29827,0,0,0,0,0,0,0,0,29829,0,29832,29834,0,0,29835,0,0,
+29837,29838,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29843,0,0,0,0,29844,29845,0,0,0,
+0,0,0,0,0,0,29849,0,0,29869,29872,29890,29905,0,0,0,0,0,29907,29921,0,29922,0,0,
+29923,29926,29944,29946,0,0,0,0,0,0,0,29947,29948,0,0,0,29951,0,0,0,0,0,29953,0,
+0,29956,0,29957,0,0,29962,0,0,0,0,29971,0,0,0,29972,0,0,0,0,0,29978,0,29979,
+29992,30007,30008,30010,0,0,0,30013,0,0,0,0,30014,30016,0,0,0,0,0,0,0,0,0,0,0,
+30017,0,0,0,0,0,30023,30031,0,0,30033,0,0,0,0,0,0,0,0,0,0,30034,0,30038,0,30039,
+0,30040,0,0,0,0,0,0,30067,30068,0,0,0,30069,0,30072,0,0,0,30073,0,0,0,0,30075,0,
+0,0,0,0,0,30079,0,0,30080,0,0,0,0,0,30082,0,0,0,0,0,0,0,0,0,0,0,30084,30090,0,0,
+30091,0,0,0,0,30098,30118,0,30119,0,30121,30130,0,0,0,0,0,0,0,0,0,0,0,0,0,30131,
+30132,30133,0,0,0,0,0,0,30135,0,0,0,0,0,0,0,0,0,0,0,30136,0,0,30137,30138,0,0,0,
+30139,30146,0,0,0,0,0,30147,0,0,30148,30151,0,0,0,30168,0,30172,30173,0,0,0,0,0,
+0,0,0,30180,30181,0,30192,0,0,0,0,0,0,0,30194,30196,0,0,30199,0,0,30202,0,0,0,0,
+30203,0,0,0,0,0,0,0,0,0,0,30213,0,0,0,30216,0,0,30217,0,0,0,30218,0,0,0,0,30219,
+0,30220,0,30222,30227,0,0,0,0,0,30231,0,0,30233,30235,0,0,0,0,30238,0,30240,
+30243,30245,0,30250,30252,0,0,0,30269,0,0,30271,30272,0,0,0,30278,30280,0,0,
+30282,0,30284,0,30294,0,0,0,0,30295,30296,0,0,0,0,0,30298,30299,30302,30304,
+30306,0,0,0,0,0,0,30316,30317,0,0,0,30318,0,0,0,30319,0,30320,30322,30326,0,0,0,
+0,0,30327,0,30332,30348,30349,0,0,30356,0,0,0,0,0,0,0,0,30357,0,30358,0,30359,
+30360,0,0,30365,30366,30378,0,0,0,0,30379,0,0,30381,0,30385,0,30388,30397,0,0,0,
+30401,0,0,0,0,30403,0,0,0,0,0,30404,0,0,30405,0,30406,30408,0,30409,0,30410,0,0,
+0,30417,0,0,30418,30419,0,30420,0,30424,0,0,0,30427,30430,30432,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,30433,0,0,0,0,0,0,0,30436,0,30437,30438,0,30441,30442,0,0,
+0,30445,0,0,0,0,30452,30456,30457,0,0,0,30458,0,30464,0,0,0,0,0,0,30467,0,30469,
+0,0,0,0,0,30477,0,0,30484,0,0,0,0,0,30485,0,0,0,0,0,30486,30487,30497,30498,0,0,
+0,0,0,0,0,0,0,0,30505,0,30508,0,0,0,30509,30510,0,30514,30516,0,0,0,0,0,0,0,0,0,
+0,0,30523,0,30524,0,30525,0,0,0,0,30537,0,0,30538,0,0,0,0,0,30553,0,0,30555,
+30556,30558,30559,30560,0,0,30561,0,30562,0,0,0,0,0,0,0,0,30563,30570,30571,0,
+30586,30587,0,0,30590,0,0,30594,0,0,0,0,30611,30612,30623,30634,0,0,30636,30640,
+30655,30656,0,30657,0,0,30658,30669,0,30670,0,30676,30678,0,0,0,0,0,0,0,30679,0,
+0,0,0,0,0,0,0,0,0,0,30695,0,0,30698,0,0,0,0,30700,0,0,0,0,30701,0,30702,30703,0,
+0,0,0,30707,0,0,0,30709,0,0,30710,30719,30729,0,0,0,0,0,0,0,0,0,30731,0,0,30733,
+0,0,0,30734,0,0,0,0,0,30736,30737,0,0,0,30740,0,0,0,30743,0,30746,0,30747,30748,
+0,0,30751,30752,30753,0,0,0,30754,0,0,30760,0,0,0,0,0,0,0,30763,0,30764,0,0,
+30766,0,30769,30770,30771,30774,30777,0,0,30779,30780,30781,0,0,0,0,30790,0,0,0,
+30792,0,0,0,0,30810,0,0,0,0,0,0,0,30812,30819,0,0,30823,30824,0,30825,0,30827,0,
+0,0,0,0,0,30828,0,0,30830,0,0,0,30834,0,30835,0,30837,30838,0,30845,0,0,0,0,0,
+30846,30847,0,0,30849,0,30851,0,0,0,0,0,30852,30858,0,0,30859,0,30865,0,0,30866,
+0,0,30868,0,0,30869,0,0,0,30881,30883,0,0,0,0,0,30889,0,30891,0,0,0,0,30894,0,
+30895,0,30897,0,30898,0,0,0,30904,30906,0,30909,0,0,0,0,0,0,30910,0,0,0,30915,
+30933,30942,0,0,0,0,30943,0,0,30945,0,0,0,0,0,0,30946,0,0,30947,0,0,30955,30956,
+0,0,30960,0,0,30961,30962,30966,0,0,30969,30974,0,0,0,30976,0,0,30977,0,30978,
+30982,0,0,0,0,0,0,0,30994,30995,30998,0,31000,0,0,31001,0,0,31003,31005,0,0,
+31006,31011,0,0,31014,0,31016,0,0,0,0,31018,0,0,31020,31023,31024,31025,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,31027,31028,31029,0,0,0,0,0,0,31032,0,0,0,0,0,0,0,0,0,0,0,
+31036,31037,31038,0,0,0,31041,31043,31045,0,31047,0,0,0,31048,0,31049,0,0,0,
+31053,31054,31055,0,0,31063,0,0,0,0,0,31066,0,31068,31071,0,0,0,31072,31073,0,0,
+0,0,31075,0,0,31076,0,0,0,31077,31079,0,31080,0,0,0,0,0,0,0,0,0,0,31087,0,31142,
+0,31144,0,0,31145,31146,31147,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31149,0,31151,31152,0,
+0,0,0,0,0,0,31162,31171,31174,31175,0,0,0,31176,0,0,0,0,0,0,0,31179,0,0,0,31186,
+0,0,0,31192,31195,0,0,31196,0,0,0,0,0,0,0,0,31198,0,0,0,0,0,31199,0,0,0,31205,0,
+0,0,0,31211,31215,0,0,0,0,31231,0,31232,0,0,0,0,0,0,0,0,0,0,31233,31236,31253,0,
+31254,0,0,0,0,0,0,31255,0,0,31257,0,0,0,0,0,0,0,0,0,31258,31259,0,0,31260,0,
+31261,0,0,0,0,0,31262,31263,0,0,31264,0,31266,0,31267,0,0,0,0,0,31281,0,31282,0,
+31284,0,0,31285,31287,31288,0,0,31290,0,0,0,31292,31295,0,31299,0,31300,0,0,0,0,
+0,31302,0,0,0,0,31303,0,0,0,0,0,0,31304,0,0,0,0,0,31305,31308,31309,31315,0,
+31317,0,0,0,0,0,31323,0,31324,0,0,0,0,0,31325,31327,0,0,31331,0,0,0,0,0,31333,0,
+0,0,0,0,31336,0,0,31337,0,0,0,0,0,0,31338,0,0,0,0,0,0,0,0,0,0,0,0,31339,0,0,0,0,
+0,0,0,31342,0,0,0,0,31345,0,0,0,0,0,0,0,0,31347,0,0,0,0,0,0,31348,0,0,31350,
+31351,0,31352,0,0,31354,0,0,0,0,31355,0,0,31356,0,0,0,0,0,0,0,0,0,0,31363,0,
+31372,0,0,31373,0,0,0,0,0,0,0,0,0,31376,0,31388,0,31389,0,31392,0,31401,0,31405,
+31407,31408,0,31409,0,0,0,0,0,0,31413,31415,0,0,0,31416,31418,0,0,0,0,0,0,31422,
+31423,0,0,31424,0,31425,31432,0,0,0,0,0,0,0,0,0,31433,0,0,0,0,0,0,0,0,31434,0,0,
+0,0,0,0,31435,0,0,0,0,31438,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31442,0,31444,0,
+31448,0,0,31451,0,0,0,0,31452,0,31461,31465,0,0,31466,0,0,31467,0,0,31468,0,0,0,
+31469,31473,0,31476,0,0,0,0,31489,31490,0,0,0,0,0,0,0,31492,31493,31494,0,0,0,0,
+31501,31504,31505,0,0,0,0,0,0,0,0,0,31509,0,0,0,0,31510,0,0,31511,0,0,31513,0,0,
+0,0,0,0,0,0,0,31514,0,31522,31536,31539,31540,0,31541,0,0,0,0,0,0,31546,31553,
+31559,0,0,0,31560,31561,31562,0,0,31564,31567,0,31569,0,0,0,31570,0,0,0,0,31571,
+0,0,0,0,0,0,31572,31574,31580,31581,0,0,31582,31584,31585,31586,31595,0,31596,0,
+0,0,0,31597,0,31599,0,31600,31601,0,0,31603,31604,0,0,31608,31610,0,0,0,31611,0,
+31615,0,0,0,0,31616,0,0,0,0,0,0,31617,0,0,0,0,0,31618,0,0,0,0,0,0,31621,0,0,0,0,
+0,0,0,0,0,31622,31625,0,0,0,0,31627,0,31641,0,0,31642,0,0,31643,0,0,0,0,0,0,0,0,
+0,31644,0,31646,0,0,0,0,31648,0,0,0,31652,0,0,0,31657,0,0,31676,0,0,0,0,0,0,0,
+31689,31691,31692,0,31694,0,0,0,31696,0,31702,0,31703,0};
+
+static const DictWord kStaticDictionaryWords[31705] = {
+{0,0,0},{8,0,1002},{136,0,1015},{4,0,683},{4,10,325},{138,10,125},{7,11,572},{9,
+11,592},{11,11,680},{11,11,842},{11,11,924},{12,11,356},{12,11,550},{13,11,317},
+{13,11,370},{13,11,469},{13,11,471},{14,11,397},{18,11,69},{146,11,145},{134,0,
+1265},{136,11,534},{134,0,1431},{11,0,138},{140,0,40},{4,0,155},{7,0,1689},{4,10
+,718},{135,10,1216},{4,0,245},{5,0,151},{5,0,741},{6,0,1147},{7,0,498},{7,0,870}
+,{7,0,1542},{12,0,213},{14,0,36},{14,0,391},{17,0,111},{18,0,6},{18,0,46},{18,0,
+151},{19,0,36},{20,0,32},{20,0,56},{20,0,69},{20,0,102},{21,0,4},{22,0,8},{22,0,
+10},{22,0,14},{150,0,31},{4,0,624},{135,0,1752},{5,10,124},{5,10,144},{6,10,548}
+,{7,10,15},{7,10,153},{137,10,629},{6,0,503},{9,0,586},{13,0,468},{14,0,66},{16,
+0,58},{7,10,1531},{8,10,416},{9,10,275},{10,10,100},{11,10,658},{11,10,979},{12,
+10,86},{14,10,207},{15,10,20},{143,10,25},{5,0,603},{7,0,1212},{9,0,565},{14,0,
+301},{5,10,915},{6,10,1783},{7,10,211},{7,10,1353},{9,10,83},{10,10,376},{10,10,
+431},{11,10,543},{12,10,664},{13,10,280},{13,10,428},{14,10,128},{17,10,52},{145
+,10,81},{4,0,492},{133,0,451},{135,0,835},{141,0,70},{132,0,539},{7,11,748},{139
+,11,700},{7,11,1517},{11,11,597},{14,11,76},{14,11,335},{148,11,33},{6,0,113},{
+135,0,436},{4,10,338},{133,10,400},{136,0,718},{133,11,127},{133,11,418},{6,0,
+1505},{7,0,520},{6,11,198},{11,10,892},{140,11,83},{4,10,221},{5,10,659},{5,10,
+989},{7,10,697},{7,10,1211},{138,10,284},{135,0,1070},{5,11,276},{6,11,55},{135,
+11,1369},{134,0,1515},{6,11,1752},{136,11,726},{138,10,507},{15,0,78},{4,10,188}
+,{135,10,805},{5,10,884},{139,10,991},{133,11,764},{134,10,1653},{6,11,309},{7,
+11,331},{138,11,550},{135,11,1861},{132,11,348},{135,11,986},{135,11,1573},{12,0
+,610},{13,0,431},{144,0,59},{9,11,799},{140,10,166},{134,0,1530},{132,0,750},{
+132,0,307},{133,0,964},{6,11,194},{7,11,133},{10,11,493},{10,11,570},{139,11,664
+},{5,11,24},{5,11,569},{6,11,3},{6,11,119},{6,11,143},{6,11,440},{7,11,295},{7,
+11,599},{7,11,1686},{7,11,1854},{8,11,424},{9,11,43},{9,11,584},{9,11,760},{10,
+11,148},{10,11,328},{11,11,159},{11,11,253},{11,11,506},{12,11,487},{12,11,531},
+{144,11,33},{136,10,760},{5,11,14},{5,11,892},{6,11,283},{7,11,234},{136,11,537}
+,{135,11,1251},{4,11,126},{8,11,635},{147,11,34},{4,11,316},{135,11,1561},{6,0,
+999},{6,0,1310},{137,11,861},{4,11,64},{5,11,352},{5,11,720},{6,11,368},{139,11,
+359},{4,0,75},{5,0,180},{6,0,500},{7,0,58},{7,0,710},{10,0,645},{136,10,770},{
+133,0,649},{6,0,276},{7,0,282},{7,0,879},{7,0,924},{8,0,459},{9,0,599},{9,0,754}
+,{11,0,574},{12,0,128},{12,0,494},{13,0,52},{13,0,301},{15,0,30},{143,0,132},{
+132,0,200},{4,10,89},{5,10,489},{6,10,315},{7,10,553},{7,10,1745},{138,10,243},{
+135,11,1050},{7,0,1621},{6,10,1658},{9,10,3},{10,10,154},{11,10,641},{13,10,85},
+{13,10,201},{141,10,346},{6,11,175},{137,11,289},{5,11,432},{133,11,913},{6,0,
+225},{137,0,211},{7,0,718},{8,0,687},{139,0,374},{4,10,166},{133,10,505},{9,0,
+110},{134,10,1670},{8,0,58},{9,0,724},{11,0,809},{13,0,113},{145,0,72},{6,0,345}
+,{7,0,1247},{144,11,82},{5,11,931},{134,11,1698},{8,0,767},{8,0,803},{9,0,301},{
+137,0,903},{139,0,203},{134,0,1154},{7,0,1949},{136,0,674},{134,0,259},{135,0,
+1275},{5,11,774},{6,11,1637},{6,11,1686},{134,11,1751},{134,0,1231},{7,10,445},{
+8,10,307},{8,10,704},{10,10,41},{10,10,439},{11,10,237},{11,10,622},{140,10,201}
+,{136,0,254},{6,11,260},{135,11,1484},{139,0,277},{135,10,1977},{4,10,189},{5,10
+,713},{6,11,573},{136,10,57},{138,10,371},{132,10,552},{134,11,344},{133,0,248},
+{9,0,800},{10,0,693},{11,0,482},{11,0,734},{11,0,789},{134,11,240},{4,0,116},{5,
+0,95},{5,0,445},{7,0,1688},{8,0,29},{9,0,272},{11,0,509},{11,0,915},{4,11,292},{
+4,11,736},{5,11,871},{6,11,171},{6,11,1689},{7,11,1324},{7,11,1944},{9,11,415},{
+9,11,580},{14,11,230},{146,11,68},{7,0,490},{13,0,100},{143,0,75},{135,0,1641},{
+133,0,543},{7,11,209},{8,11,661},{10,11,42},{11,11,58},{12,11,58},{12,11,118},{
+141,11,32},{5,0,181},{8,0,41},{6,11,63},{135,11,920},{133,0,657},{133,11,793},{
+138,0,709},{7,0,25},{8,0,202},{138,0,536},{5,11,665},{135,10,1788},{145,10,49},{
+9,0,423},{140,0,89},{5,11,67},{6,11,62},{6,11,374},{135,11,1391},{8,0,113},{9,0,
+877},{10,0,554},{11,0,83},{12,0,136},{19,0,109},{9,11,790},{140,11,47},{138,10,
+661},{4,0,963},{10,0,927},{14,0,442},{135,10,1945},{133,0,976},{132,0,206},{4,11
+,391},{135,11,1169},{134,0,2002},{6,0,696},{134,0,1008},{134,0,1170},{132,11,271
+},{7,0,13},{8,0,226},{10,0,537},{11,0,570},{11,0,605},{11,0,799},{11,0,804},{12,
+0,85},{12,0,516},{12,0,623},{13,0,112},{13,0,361},{14,0,77},{14,0,78},{17,0,28},
+{19,0,110},{140,11,314},{132,0,769},{134,0,1544},{4,0,551},{137,0,678},{5,10,84}
+,{134,10,163},{9,0,57},{9,0,459},{10,0,425},{11,0,119},{12,0,184},{12,0,371},{13
+,0,358},{145,0,51},{5,0,188},{5,0,814},{8,0,10},{9,0,421},{9,0,729},{10,0,609},{
+11,0,689},{4,11,253},{5,10,410},{5,11,544},{7,11,300},{137,11,340},{134,0,624},{
+138,11,321},{135,0,1941},{18,0,130},{5,10,322},{8,10,186},{9,10,262},{10,10,187}
+,{142,10,208},{5,11,53},{5,11,541},{6,11,94},{6,11,499},{7,11,230},{139,11,321},
+{133,10,227},{4,0,378},{4,11,920},{5,11,25},{5,11,790},{6,11,457},{135,11,853},{
+137,0,269},{132,0,528},{134,0,1146},{7,10,1395},{8,10,486},{9,10,236},{9,10,878}
+,{10,10,218},{11,10,95},{19,10,17},{147,10,31},{7,10,2043},{8,10,672},{141,10,
+448},{134,0,1105},{134,0,1616},{134,11,1765},{140,11,163},{5,10,412},{133,11,822
+},{132,11,634},{6,0,656},{134,11,1730},{134,0,1940},{5,0,104},{6,0,173},{135,0,
+1631},{136,10,562},{6,11,36},{7,11,658},{8,11,454},{147,11,86},{5,0,457},{134,10
+,1771},{7,0,810},{8,0,138},{8,0,342},{9,0,84},{10,0,193},{11,0,883},{140,0,359},
+{9,0,620},{135,10,1190},{137,10,132},{7,11,975},{137,11,789},{6,0,95},{6,0,1934}
+,{136,0,967},{141,11,335},{6,0,406},{10,0,409},{10,0,447},{11,0,44},{140,0,100},
+{4,10,317},{135,10,1279},{132,0,477},{134,0,1268},{6,0,1941},{8,0,944},{5,10,63}
+,{133,10,509},{132,0,629},{132,11,104},{4,0,246},{133,0,375},{6,0,1636},{132,10,
+288},{135,11,1614},{9,0,49},{10,0,774},{8,10,89},{8,10,620},{11,10,628},{12,10,
+322},{143,10,124},{4,0,282},{7,0,1034},{11,0,398},{11,0,634},{12,0,1},{12,0,79},
+{12,0,544},{14,0,237},{17,0,10},{146,0,20},{132,0,824},{7,11,45},{9,11,542},{9,
+11,566},{138,11,728},{5,0,118},{5,0,499},{6,0,476},{6,0,665},{6,0,1176},{6,0,
+1196},{7,0,600},{7,0,888},{135,0,1096},{7,0,296},{7,0,596},{8,0,560},{8,0,586},{
+9,0,612},{11,0,304},{12,0,46},{13,0,89},{14,0,112},{145,0,122},{5,0,894},{6,0,
+1772},{9,0,1009},{138,10,120},{5,11,533},{7,11,755},{138,11,780},{151,10,1},{6,0
+,1474},{7,11,87},{142,11,288},{139,0,366},{137,10,461},{7,11,988},{7,11,1939},{9
+,11,64},{9,11,502},{12,11,7},{12,11,34},{13,11,12},{13,11,234},{147,11,77},{7,0,
+1599},{7,0,1723},{8,0,79},{8,0,106},{8,0,190},{8,0,302},{8,0,383},{8,0,713},{9,0
+,119},{9,0,233},{9,0,419},{9,0,471},{10,0,181},{10,0,406},{11,0,57},{11,0,85},{
+11,0,120},{11,0,177},{11,0,296},{11,0,382},{11,0,454},{11,0,758},{11,0,999},{12,
+0,27},{12,0,98},{12,0,131},{12,0,245},{12,0,312},{12,0,446},{12,0,454},{13,0,25}
+,{13,0,98},{13,0,426},{13,0,508},{14,0,70},{14,0,163},{14,0,272},{14,0,277},{14,
+0,370},{15,0,95},{15,0,138},{15,0,167},{17,0,38},{148,0,96},{135,10,1346},{10,0,
+200},{19,0,2},{151,0,22},{135,11,141},{134,10,85},{134,0,1759},{138,0,372},{145,
+0,16},{8,0,943},{132,11,619},{139,11,88},{5,11,246},{8,11,189},{9,11,355},{9,11,
+512},{10,11,124},{10,11,453},{11,11,143},{11,11,416},{11,11,859},{141,11,341},{5
+,0,258},{134,0,719},{6,0,1798},{6,0,1839},{8,0,900},{10,0,874},{10,0,886},{12,0,
+698},{12,0,732},{12,0,770},{16,0,106},{18,0,163},{18,0,170},{18,0,171},{152,0,20
+},{9,0,707},{11,0,326},{11,0,339},{12,0,423},{12,0,502},{20,0,62},{9,11,707},{11
+,11,326},{11,11,339},{12,11,423},{12,11,502},{148,11,62},{5,0,30},{7,0,495},{8,0
+,134},{9,0,788},{140,0,438},{133,11,678},{5,10,279},{6,10,235},{7,10,468},{8,10,
+446},{9,10,637},{10,10,717},{11,10,738},{140,10,514},{5,11,35},{6,11,287},{7,11,
+862},{7,11,1886},{138,11,179},{7,0,1948},{7,0,2004},{132,11,517},{5,10,17},{6,10
+,371},{137,10,528},{4,0,115},{5,0,669},{6,0,407},{8,0,311},{11,0,10},{141,0,5},{
+137,0,381},{5,0,50},{6,0,439},{7,0,780},{135,0,1040},{136,11,667},{11,11,403},{
+146,11,83},{5,0,1},{6,0,81},{138,0,520},{134,0,738},{5,0,482},{8,0,98},{9,0,172}
+,{10,0,360},{10,0,700},{10,0,822},{11,0,302},{11,0,778},{12,0,50},{12,0,127},{12
+,0,396},{13,0,62},{13,0,328},{14,0,122},{147,0,72},{9,11,157},{10,11,131},{140,
+11,72},{135,11,714},{135,11,539},{5,0,2},{6,0,512},{7,0,797},{7,0,1494},{8,0,253
+},{8,0,589},{9,0,77},{10,0,1},{10,0,129},{10,0,225},{11,0,118},{11,0,226},{11,0,
+251},{11,0,430},{11,0,701},{11,0,974},{11,0,982},{12,0,64},{12,0,260},{12,0,488}
+,{140,0,690},{5,11,394},{7,11,367},{7,11,487},{7,11,857},{7,11,1713},{8,11,246},
+{9,11,537},{10,11,165},{12,11,219},{140,11,561},{136,0,557},{5,10,779},{5,10,807
+},{6,10,1655},{134,10,1676},{4,10,196},{5,10,558},{133,10,949},{11,11,827},{12,
+11,56},{14,11,34},{143,11,148},{137,0,347},{133,0,572},{134,0,832},{4,0,12},{7,0
+,504},{7,0,522},{7,0,809},{8,0,797},{141,0,88},{4,10,752},{133,11,449},{7,11,86}
+,{8,11,103},{145,11,69},{7,11,2028},{138,11,641},{5,0,528},{6,11,1},{142,11,2},{
+134,0,861},{10,0,294},{4,10,227},{5,10,159},{5,10,409},{7,10,80},{10,10,479},{12
+,10,418},{14,10,50},{14,10,249},{142,10,295},{7,10,1470},{8,10,66},{8,10,137},{8
+,10,761},{9,10,638},{11,10,80},{11,10,212},{11,10,368},{11,10,418},{12,10,8},{13
+,10,15},{16,10,61},{17,10,59},{19,10,28},{148,10,84},{20,0,109},{135,11,1148},{6
+,11,277},{7,11,1274},{7,11,1386},{7,11,1392},{12,11,129},{146,11,87},{6,11,187},
+{7,11,39},{7,11,1203},{8,11,380},{8,11,542},{14,11,117},{149,11,28},{134,0,1187}
+,{5,0,266},{9,0,290},{9,0,364},{10,0,293},{11,0,606},{142,0,45},{6,11,297},{7,11
+,793},{139,11,938},{4,0,50},{6,0,594},{9,0,121},{10,0,49},{10,0,412},{139,0,834}
+,{136,0,748},{7,11,464},{8,11,438},{11,11,105},{11,11,363},{12,11,231},{14,11,
+386},{15,11,102},{148,11,75},{132,0,466},{13,0,399},{14,0,337},{6,10,38},{7,10,
+1220},{8,10,185},{8,10,256},{9,10,22},{9,10,331},{10,10,738},{11,10,205},{11,10,
+540},{11,10,746},{13,10,465},{142,10,194},{9,0,378},{141,0,162},{137,0,519},{4,
+10,159},{6,10,115},{7,10,252},{7,10,257},{7,10,1928},{8,10,69},{9,10,384},{10,10
+,91},{10,10,615},{12,10,375},{14,10,235},{18,10,117},{147,10,123},{5,11,604},{5,
+10,911},{136,10,278},{132,0,667},{8,0,351},{9,0,322},{4,10,151},{135,10,1567},{
+134,0,902},{133,10,990},{12,0,180},{5,10,194},{7,10,1662},{137,10,90},{4,0,869},
+{134,0,1996},{134,0,813},{133,10,425},{137,11,761},{132,0,260},{133,10,971},{5,
+11,20},{6,11,298},{7,11,659},{7,11,1366},{137,11,219},{4,0,39},{5,0,36},{7,0,
+1843},{8,0,407},{11,0,144},{140,0,523},{4,0,510},{10,0,587},{139,10,752},{7,0,29
+},{7,0,66},{7,0,1980},{10,0,487},{138,0,809},{13,0,260},{14,0,82},{18,0,63},{137
+,10,662},{5,10,72},{6,10,264},{7,10,21},{7,10,46},{7,10,2013},{8,10,215},{8,10,
+513},{10,10,266},{139,10,22},{134,0,570},{6,0,565},{7,0,1667},{4,11,439},{10,10,
+95},{11,10,603},{12,11,242},{13,10,443},{14,10,160},{143,10,4},{134,0,1464},{134
+,10,431},{9,0,372},{15,0,2},{19,0,10},{19,0,18},{5,10,874},{6,10,1677},{143,10,0
+},{132,0,787},{6,0,380},{12,0,399},{21,0,19},{7,10,939},{7,10,1172},{7,10,1671},
+{9,10,540},{10,10,696},{11,10,265},{11,10,732},{11,10,928},{11,10,937},{141,10,
+438},{137,0,200},{132,11,233},{132,0,516},{134,11,577},{132,0,844},{11,0,887},{
+14,0,365},{142,0,375},{132,11,482},{8,0,821},{140,0,44},{7,0,1655},{136,0,305},{
+5,10,682},{135,10,1887},{135,11,346},{132,10,696},{4,0,10},{7,0,917},{139,0,786}
+,{5,11,795},{6,11,1741},{8,11,417},{137,11,782},{4,0,1016},{134,0,2031},{5,0,684
+},{4,10,726},{133,10,630},{6,0,1021},{134,0,1480},{8,10,802},{136,10,838},{134,0
+,27},{134,0,395},{135,11,622},{7,11,625},{135,11,1750},{4,11,203},{135,11,1936},
+{6,10,118},{7,10,215},{7,10,1521},{140,10,11},{132,0,813},{136,0,511},{7,10,615}
+,{138,10,251},{135,10,1044},{145,0,56},{133,10,225},{6,0,342},{6,0,496},{8,0,275
+},{137,0,206},{4,0,909},{133,0,940},{132,0,891},{7,11,311},{9,11,308},{140,11,
+255},{4,10,370},{5,10,756},{135,10,1326},{4,0,687},{134,0,1596},{134,0,1342},{6,
+10,1662},{7,10,48},{8,10,771},{10,10,116},{13,10,104},{14,10,105},{14,10,184},{
+15,10,168},{19,10,92},{148,10,68},{138,10,209},{4,11,400},{5,11,267},{135,11,232
+},{151,11,12},{6,0,41},{141,0,160},{141,11,314},{134,0,1718},{136,0,778},{142,11
+,261},{134,0,1610},{133,0,115},{132,0,294},{14,0,314},{132,10,120},{132,0,983},{
+5,0,193},{140,0,178},{138,10,429},{5,10,820},{135,10,931},{6,0,994},{6,0,1051},{
+6,0,1439},{7,0,174},{133,11,732},{4,11,100},{7,11,679},{8,11,313},{138,10,199},{
+6,10,151},{6,10,1675},{7,10,383},{151,10,10},{6,0,1796},{8,0,848},{8,0,867},{8,0
+,907},{10,0,855},{140,0,703},{140,0,221},{4,0,122},{5,0,796},{5,0,952},{6,0,1660
+},{6,0,1671},{8,0,567},{9,0,687},{9,0,742},{10,0,686},{11,0,682},{11,0,909},{140
+,0,281},{5,11,362},{5,11,443},{6,11,318},{7,11,1019},{139,11,623},{5,11,463},{
+136,11,296},{11,0,583},{13,0,262},{6,10,1624},{12,10,422},{142,10,360},{5,0,179}
+,{7,0,1095},{135,0,1213},{4,10,43},{4,11,454},{5,10,344},{133,10,357},{4,0,66},{
+7,0,722},{135,0,904},{134,0,773},{7,0,352},{133,10,888},{5,11,48},{5,11,404},{6,
+11,557},{7,11,458},{8,11,597},{10,11,455},{10,11,606},{11,11,49},{11,11,548},{12
+,11,476},{13,11,18},{141,11,450},{134,11,418},{132,10,711},{5,11,442},{135,11,
+1984},{141,0,35},{137,0,152},{134,0,1197},{135,11,1093},{137,11,203},{137,10,440
+},{10,0,592},{10,0,753},{12,0,317},{12,0,355},{12,0,465},{12,0,469},{12,0,560},{
+12,0,578},{141,0,243},{133,0,564},{134,0,797},{5,10,958},{133,10,987},{5,11,55},
+{7,11,376},{140,11,161},{133,11,450},{134,0,556},{134,0,819},{11,10,276},{142,10
+,293},{7,0,544},{138,0,61},{8,0,719},{4,10,65},{5,10,479},{5,10,1004},{7,10,1913
+},{8,10,317},{9,10,302},{10,10,612},{141,10,22},{4,0,5},{5,0,498},{8,0,637},{9,0
+,521},{4,11,213},{4,10,261},{7,11,223},{7,10,510},{136,11,80},{5,0,927},{7,0,101
+},{4,10,291},{7,11,381},{7,11,806},{7,11,820},{8,11,354},{8,11,437},{8,11,787},{
+9,10,515},{9,11,657},{10,11,58},{10,11,339},{10,11,749},{11,11,914},{12,10,152},
+{12,11,162},{12,10,443},{13,11,75},{13,10,392},{14,11,106},{14,11,198},{14,11,
+320},{14,10,357},{14,11,413},{146,11,43},{6,0,1153},{7,0,1441},{136,11,747},{4,0
+,893},{5,0,780},{133,0,893},{138,11,654},{133,11,692},{133,0,238},{134,11,191},{
+4,10,130},{135,10,843},{6,0,1296},{5,10,42},{5,10,879},{7,10,245},{7,10,324},{7,
+10,1532},{11,10,463},{11,10,472},{13,10,363},{144,10,52},{134,0,1729},{6,0,1999}
+,{136,0,969},{4,10,134},{133,10,372},{4,0,60},{7,0,941},{7,0,1800},{8,0,314},{9,
+0,700},{139,0,487},{134,0,1144},{6,11,162},{7,11,1960},{136,11,831},{132,11,706}
+,{135,0,1147},{138,11,426},{138,11,89},{7,0,1853},{138,0,437},{136,0,419},{135,
+10,1634},{133,0,828},{5,0,806},{7,0,176},{7,0,178},{7,0,1240},{7,0,1976},{132,10
+,644},{135,11,1877},{5,11,420},{135,11,1449},{4,0,51},{5,0,39},{6,0,4},{7,0,591}
+,{7,0,849},{7,0,951},{7,0,1613},{7,0,1760},{7,0,1988},{9,0,434},{10,0,754},{11,0
+,25},{139,0,37},{10,11,57},{138,11,277},{135,10,540},{132,11,204},{135,0,159},{
+139,11,231},{133,0,902},{7,0,928},{7,11,366},{9,11,287},{12,11,199},{12,11,556},
+{140,11,577},{6,10,623},{136,10,789},{4,10,908},{5,10,359},{5,10,508},{6,10,1723
+},{7,10,343},{7,10,1996},{135,10,2026},{134,0,270},{4,10,341},{135,10,480},{5,11
+,356},{135,11,224},{11,11,588},{11,11,864},{11,11,968},{143,11,160},{132,0,556},
+{137,0,801},{132,0,416},{142,0,372},{5,0,152},{5,0,197},{7,0,340},{7,0,867},{10,
+0,548},{10,0,581},{11,0,6},{12,0,3},{12,0,19},{14,0,110},{142,0,289},{139,0,369}
+,{7,11,630},{9,11,567},{11,11,150},{11,11,444},{141,11,119},{134,11,539},{7,10,
+1995},{8,10,299},{11,10,890},{140,10,674},{7,0,34},{7,0,190},{8,0,28},{8,0,141},
+{8,0,444},{8,0,811},{9,0,468},{11,0,334},{12,0,24},{12,0,386},{140,0,576},{133,0
+,757},{7,0,1553},{136,0,898},{133,0,721},{136,0,1012},{4,0,789},{5,0,647},{135,0
+,1102},{132,0,898},{10,0,183},{4,10,238},{5,10,503},{6,10,179},{7,10,2003},{8,10
+,381},{8,10,473},{9,10,149},{10,10,788},{15,10,45},{15,10,86},{20,10,110},{150,
+10,57},{9,0,136},{19,0,107},{4,10,121},{5,10,156},{5,10,349},{10,10,605},{142,10
+,342},{4,11,235},{135,11,255},{4,11,194},{5,11,584},{6,11,384},{7,11,583},{10,11
+,761},{11,11,760},{139,11,851},{6,10,80},{6,10,1694},{7,10,173},{7,10,1974},{9,
+10,547},{10,10,730},{14,10,18},{150,10,39},{4,10,923},{134,10,1711},{5,0,277},{
+141,0,247},{132,0,435},{133,11,562},{134,0,1311},{5,11,191},{137,11,271},{132,10
+,595},{7,11,1537},{14,11,96},{143,11,73},{5,0,437},{7,0,502},{7,0,519},{7,0,1122
+},{7,0,1751},{14,0,211},{6,10,459},{7,10,1753},{7,10,1805},{8,10,658},{9,10,1},{
+11,10,959},{141,10,446},{6,0,814},{4,11,470},{5,11,473},{6,11,153},{7,11,1503},{
+7,11,1923},{10,11,701},{11,11,132},{11,11,168},{11,11,227},{11,11,320},{11,11,
+436},{11,11,525},{11,11,855},{12,11,41},{12,11,286},{13,11,103},{13,11,284},{14,
+11,255},{14,11,262},{15,11,117},{143,11,127},{5,0,265},{6,0,212},{135,0,28},{138
+,0,750},{133,11,327},{6,11,552},{7,11,1754},{137,11,604},{134,0,2012},{132,0,702
+},{5,11,80},{6,11,405},{7,11,403},{7,11,1502},{7,11,1626},{8,11,456},{9,11,487},
+{9,11,853},{9,11,889},{10,11,309},{11,11,721},{11,11,994},{12,11,430},{141,11,
+165},{5,0,808},{135,0,2045},{5,0,166},{8,0,739},{140,0,511},{134,10,490},{4,11,
+453},{5,11,887},{6,11,535},{8,11,6},{136,11,543},{4,0,119},{5,0,170},{5,0,447},{
+7,0,1708},{7,0,1889},{9,0,357},{9,0,719},{12,0,486},{140,0,596},{137,0,500},{7,
+10,250},{136,10,507},{132,10,158},{6,0,809},{134,0,1500},{9,0,327},{11,0,350},{
+11,0,831},{13,0,352},{4,10,140},{7,10,362},{8,10,209},{9,10,10},{9,10,503},{9,10
+,614},{10,10,689},{11,10,327},{11,10,725},{12,10,252},{12,10,583},{13,10,192},{
+14,10,269},{14,10,356},{148,10,50},{135,11,741},{4,0,450},{7,0,1158},{19,10,1},{
+19,10,26},{150,10,9},{6,0,597},{135,0,1318},{134,0,1602},{6,10,228},{7,10,1341},
+{9,10,408},{138,10,343},{7,0,1375},{7,0,1466},{138,0,331},{132,0,754},{132,10,
+557},{5,11,101},{6,11,88},{6,11,543},{7,11,1677},{9,11,100},{10,11,677},{14,11,
+169},{14,11,302},{14,11,313},{15,11,48},{143,11,84},{134,0,1368},{4,11,310},{9,
+11,795},{10,11,733},{11,11,451},{12,11,249},{14,11,115},{14,11,286},{143,11,100}
+,{132,10,548},{10,0,557},{7,10,197},{8,10,142},{8,10,325},{9,10,150},{9,10,596},
+{10,10,353},{11,10,74},{11,10,315},{12,10,662},{12,10,681},{14,10,423},{143,10,
+141},{133,11,587},{5,0,850},{136,0,799},{10,0,908},{12,0,701},{12,0,757},{142,0,
+466},{4,0,62},{5,0,275},{18,0,19},{6,10,399},{6,10,579},{7,10,692},{7,10,846},{7
+,10,1015},{7,10,1799},{8,10,403},{9,10,394},{10,10,133},{12,10,4},{12,10,297},{
+12,10,452},{16,10,81},{18,10,25},{21,10,14},{22,10,12},{151,10,18},{12,0,459},{7
+,10,1546},{11,10,299},{142,10,407},{132,10,177},{132,11,498},{7,11,217},{8,11,
+140},{138,11,610},{5,10,411},{135,10,653},{134,0,1802},{7,10,439},{10,10,727},{
+11,10,260},{139,10,684},{133,11,905},{11,11,580},{142,11,201},{134,0,1397},{5,10
+,208},{7,10,753},{135,10,1528},{7,0,238},{7,0,2033},{8,0,120},{8,0,188},{8,0,659
+},{9,0,598},{10,0,466},{12,0,342},{12,0,588},{13,0,503},{14,0,246},{143,0,92},{
+135,11,1041},{4,11,456},{7,11,105},{7,11,358},{7,11,1637},{8,11,643},{139,11,483
+},{6,0,1318},{134,0,1324},{4,0,201},{7,0,1744},{8,0,602},{11,0,247},{11,0,826},{
+17,0,65},{133,10,242},{8,0,164},{146,0,62},{133,10,953},{139,10,802},{133,0,615}
+,{7,11,1566},{8,11,269},{9,11,212},{9,11,718},{14,11,15},{14,11,132},{142,11,227
+},{133,10,290},{132,10,380},{5,10,52},{7,10,277},{9,10,368},{139,10,791},{135,0,
+1243},{133,11,539},{11,11,919},{141,11,409},{136,0,968},{133,11,470},{134,0,882}
+,{132,0,907},{5,0,100},{10,0,329},{12,0,416},{149,0,29},{10,10,138},{139,10,476}
+,{5,10,725},{5,10,727},{6,11,91},{7,11,435},{135,10,1811},{4,11,16},{5,11,316},{
+5,11,842},{6,11,370},{6,11,1778},{8,11,166},{11,11,812},{12,11,206},{12,11,351},
+{14,11,418},{16,11,15},{16,11,34},{18,11,3},{19,11,3},{19,11,7},{20,11,4},{149,
+11,21},{132,0,176},{5,0,636},{5,0,998},{7,0,9},{7,0,1508},{8,0,26},{9,0,317},{9,
+0,358},{10,0,210},{10,0,292},{10,0,533},{11,0,555},{12,0,526},{12,0,607},{13,0,
+263},{13,0,459},{142,0,271},{6,0,256},{8,0,265},{4,10,38},{7,10,307},{7,10,999},
+{7,10,1481},{7,10,1732},{7,10,1738},{9,10,414},{11,10,316},{12,10,52},{13,10,420
+},{147,10,100},{135,10,1296},{4,11,611},{133,11,606},{4,0,643},{142,11,21},{133,
+11,715},{133,10,723},{6,0,610},{135,11,597},{10,0,127},{141,0,27},{6,0,1995},{6,
+0,2001},{8,0,119},{136,0,973},{4,11,149},{138,11,368},{12,0,522},{4,11,154},{5,
+10,109},{6,10,1784},{7,11,1134},{7,10,1895},{8,11,105},{12,10,296},{140,10,302},
+{4,11,31},{6,11,429},{7,11,962},{9,11,458},{139,11,691},{10,0,553},{11,0,876},{
+13,0,193},{13,0,423},{14,0,166},{19,0,84},{4,11,312},{5,10,216},{7,10,1879},{9,
+10,141},{9,10,270},{9,10,679},{10,10,159},{11,10,197},{12,10,538},{12,10,559},{
+14,10,144},{14,10,167},{143,10,67},{134,0,1582},{7,0,1578},{135,11,1578},{137,10
+,81},{132,11,236},{134,10,391},{134,0,795},{7,10,322},{136,10,249},{5,11,836},{5
+,11,857},{6,11,1680},{7,11,59},{147,11,53},{135,0,432},{10,11,68},{139,11,494},{
+4,11,81},{139,11,867},{7,0,126},{136,0,84},{142,11,280},{5,11,282},{8,11,650},{9
+,11,295},{9,11,907},{138,11,443},{136,0,790},{5,10,632},{138,10,526},{6,0,64},{
+12,0,377},{13,0,309},{14,0,141},{14,0,429},{14,11,141},{142,11,429},{134,0,1529}
+,{6,0,321},{7,0,1857},{9,0,530},{19,0,99},{7,10,948},{7,10,1042},{8,10,235},{8,
+10,461},{9,10,453},{10,10,354},{145,10,77},{7,0,1104},{11,0,269},{11,0,539},{11,
+0,627},{11,0,706},{11,0,975},{12,0,248},{12,0,434},{12,0,600},{12,0,622},{13,0,
+297},{13,0,485},{14,0,69},{14,0,409},{143,0,108},{4,10,362},{7,10,52},{7,10,303}
+,{10,11,70},{12,11,26},{14,11,17},{14,11,178},{15,11,34},{149,11,12},{11,0,977},
+{141,0,507},{9,0,34},{139,0,484},{5,10,196},{6,10,486},{7,10,212},{8,10,309},{
+136,10,346},{6,0,1700},{7,0,26},{7,0,293},{7,0,382},{7,0,1026},{7,0,1087},{7,0,
+2027},{8,0,24},{8,0,114},{8,0,252},{8,0,727},{8,0,729},{9,0,30},{9,0,199},{9,0,
+231},{9,0,251},{9,0,334},{9,0,361},{9,0,712},{10,0,55},{10,0,60},{10,0,232},{10,
+0,332},{10,0,384},{10,0,396},{10,0,504},{10,0,542},{10,0,652},{11,0,20},{11,0,48
+},{11,0,207},{11,0,291},{11,0,298},{11,0,342},{11,0,365},{11,0,394},{11,0,620},{
+11,0,705},{11,0,1017},{12,0,123},{12,0,340},{12,0,406},{12,0,643},{13,0,61},{13,
+0,269},{13,0,311},{13,0,319},{13,0,486},{14,0,234},{15,0,62},{15,0,85},{16,0,71}
+,{18,0,119},{20,0,105},{135,10,1912},{4,11,71},{5,11,376},{7,11,119},{138,11,665
+},{10,0,918},{10,0,926},{4,10,686},{136,11,55},{138,10,625},{136,10,706},{132,11
+,479},{4,10,30},{133,10,43},{6,0,379},{7,0,270},{8,0,176},{8,0,183},{9,0,432},{9
+,0,661},{12,0,247},{12,0,617},{18,0,125},{7,11,607},{8,11,99},{152,11,4},{5,0,
+792},{133,0,900},{4,11,612},{133,11,561},{4,11,41},{4,10,220},{5,11,74},{7,10,
+1535},{7,11,1627},{11,11,871},{140,11,619},{135,0,1920},{7,11,94},{11,11,329},{
+11,11,965},{12,11,241},{14,11,354},{15,11,22},{148,11,63},{9,11,209},{137,11,300
+},{134,0,771},{135,0,1979},{4,0,901},{133,0,776},{142,0,254},{133,11,98},{9,11,
+16},{141,11,386},{133,11,984},{4,11,182},{6,11,205},{135,11,220},{7,10,1725},{7,
+10,1774},{138,10,393},{5,10,263},{134,10,414},{4,11,42},{9,11,205},{9,11,786},{
+138,11,659},{14,0,140},{148,0,41},{8,0,440},{10,0,359},{6,10,178},{6,11,289},{6,
+10,1750},{7,11,1670},{9,10,690},{10,10,155},{10,10,373},{11,10,698},{12,11,57},{
+13,10,155},{20,10,93},{151,11,4},{4,0,37},{5,0,334},{7,0,1253},{151,11,25},{4,0,
+508},{4,11,635},{5,10,97},{137,10,393},{139,11,533},{4,0,640},{133,0,513},{134,
+10,1639},{132,11,371},{4,11,272},{7,11,836},{7,11,1651},{145,11,89},{5,11,825},{
+6,11,444},{6,11,1640},{136,11,308},{4,10,191},{7,10,934},{8,10,647},{145,10,97},
+{12,0,246},{15,0,162},{19,0,64},{20,0,8},{20,0,95},{22,0,24},{152,0,17},{4,0,533
+},{5,10,165},{9,10,346},{138,10,655},{5,11,737},{139,10,885},{133,10,877},{8,10,
+128},{139,10,179},{137,11,307},{140,0,752},{133,0,920},{135,0,1048},{5,0,153},{6
+,0,580},{6,10,1663},{7,10,132},{7,10,1154},{7,10,1415},{7,10,1507},{12,10,493},{
+15,10,105},{151,10,15},{5,10,459},{7,10,1073},{8,10,241},{136,10,334},{138,0,391
+},{135,0,1952},{133,11,525},{8,11,641},{11,11,388},{140,11,580},{142,0,126},{134
+,0,640},{132,0,483},{7,0,1616},{9,0,69},{6,10,324},{6,10,520},{7,10,338},{7,10,
+1729},{8,10,228},{139,10,750},{5,11,493},{134,11,528},{135,0,734},{4,11,174},{
+135,11,911},{138,0,480},{9,0,495},{146,0,104},{135,10,705},{9,0,472},{4,10,73},{
+6,10,612},{7,10,927},{7,10,1330},{7,10,1822},{8,10,217},{9,10,765},{9,10,766},{
+10,10,408},{11,10,51},{11,10,793},{12,10,266},{15,10,158},{20,10,89},{150,10,32}
+,{7,11,548},{137,11,58},{4,11,32},{5,11,215},{6,11,269},{7,11,1782},{7,11,1892},
+{10,11,16},{11,11,822},{11,11,954},{141,11,481},{132,0,874},{9,0,229},{5,10,389}
+,{136,10,636},{7,11,1749},{136,11,477},{134,0,948},{5,11,308},{135,11,1088},{4,0
+,748},{139,0,1009},{136,10,21},{6,0,555},{135,0,485},{5,11,126},{8,11,297},{9,11
+,366},{9,11,445},{12,11,53},{12,11,374},{141,11,492},{7,11,1551},{139,11,361},{
+136,0,193},{136,0,472},{8,0,653},{13,0,93},{147,0,14},{132,0,984},{132,11,175},{
+5,0,172},{6,0,1971},{132,11,685},{149,11,8},{133,11,797},{13,0,83},{5,10,189},{7
+,10,442},{7,10,443},{8,10,281},{12,10,174},{141,10,261},{134,0,1568},{133,11,565
+},{139,0,384},{133,0,260},{7,0,758},{7,0,880},{7,0,1359},{9,0,164},{9,0,167},{10
+,0,156},{10,0,588},{12,0,101},{14,0,48},{15,0,70},{6,10,2},{7,10,1262},{7,10,
+1737},{8,10,22},{8,10,270},{8,10,612},{9,10,312},{9,10,436},{10,10,311},{10,10,
+623},{11,10,72},{11,10,330},{11,10,455},{12,10,321},{12,10,504},{12,10,530},{12,
+10,543},{13,10,17},{13,10,156},{13,10,334},{17,10,60},{148,10,64},{4,11,252},{7,
+11,1068},{10,11,434},{11,11,228},{11,11,426},{13,11,231},{18,11,106},{148,11,87}
+,{7,10,354},{10,10,410},{139,10,815},{6,0,367},{7,10,670},{7,10,1327},{8,10,411}
+,{8,10,435},{9,10,653},{9,10,740},{10,10,385},{11,10,222},{11,10,324},{11,10,829
+},{140,10,611},{7,0,1174},{6,10,166},{135,10,374},{146,0,121},{132,0,828},{5,11,
+231},{138,11,509},{7,11,601},{9,11,277},{9,11,674},{10,11,178},{10,11,257},{10,
+11,418},{11,11,531},{11,11,544},{11,11,585},{12,11,113},{12,11,475},{13,11,99},{
+142,11,428},{134,0,1541},{135,11,1779},{5,0,343},{134,10,398},{135,10,50},{135,
+11,1683},{4,0,440},{7,0,57},{8,0,167},{8,0,375},{9,0,82},{9,0,561},{9,0,744},{10
+,0,620},{137,11,744},{134,0,926},{6,10,517},{7,10,1159},{10,10,621},{139,10,192}
+,{137,0,827},{8,0,194},{136,0,756},{10,10,223},{139,10,645},{7,10,64},{136,10,
+245},{4,11,399},{5,11,119},{5,11,494},{7,11,751},{137,11,556},{132,0,808},{135,0
+,22},{7,10,1763},{140,10,310},{5,0,639},{7,0,1249},{11,0,896},{134,11,584},{134,
+0,1614},{135,0,860},{135,11,1121},{5,10,129},{6,10,61},{135,10,947},{4,0,102},{7
+,0,815},{7,0,1699},{139,0,964},{13,10,505},{141,10,506},{139,10,1000},{132,11,
+679},{132,0,899},{132,0,569},{5,11,694},{137,11,714},{136,0,795},{6,0,2045},{139
+,11,7},{6,0,52},{9,0,104},{9,0,559},{12,0,308},{147,0,87},{4,0,301},{132,0,604},
+{133,10,637},{136,0,779},{5,11,143},{5,11,769},{6,11,1760},{7,11,682},{7,11,1992
+},{136,11,736},{137,10,590},{147,0,32},{137,11,527},{5,10,280},{135,10,1226},{
+134,0,494},{6,0,677},{6,0,682},{134,0,1044},{133,10,281},{135,10,1064},{7,0,508}
+,{133,11,860},{6,11,422},{7,11,0},{7,11,1544},{9,11,577},{11,11,990},{12,11,141}
+,{12,11,453},{13,11,47},{141,11,266},{134,0,1014},{5,11,515},{137,11,131},{134,0
+,957},{132,11,646},{6,0,310},{7,0,1849},{8,0,72},{8,0,272},{8,0,431},{9,0,12},{9
+,0,376},{10,0,563},{10,0,630},{10,0,796},{10,0,810},{11,0,367},{11,0,599},{11,0,
+686},{140,0,672},{7,0,570},{4,11,396},{7,10,120},{7,11,728},{8,10,489},{9,11,117
+},{9,10,319},{10,10,820},{11,10,1004},{12,10,379},{12,10,679},{13,10,117},{13,11
+,202},{13,10,412},{14,10,25},{15,10,52},{15,10,161},{16,10,47},{20,11,51},{149,
+10,2},{6,11,121},{6,11,124},{6,11,357},{7,11,1138},{7,11,1295},{8,11,162},{139,
+11,655},{8,0,449},{4,10,937},{5,10,801},{136,11,449},{139,11,958},{6,0,181},{7,0
+,537},{8,0,64},{9,0,127},{10,0,496},{12,0,510},{141,0,384},{138,11,253},{4,0,244
+},{135,0,233},{133,11,237},{132,10,365},{6,0,1650},{10,0,702},{139,0,245},{5,10,
+7},{139,10,774},{13,0,463},{20,0,49},{13,11,463},{148,11,49},{4,10,734},{5,10,
+662},{134,10,430},{4,10,746},{135,10,1090},{5,10,360},{136,10,237},{137,0,338},{
+143,11,10},{7,11,571},{138,11,366},{134,0,1279},{9,11,513},{10,11,22},{10,11,39}
+,{12,11,122},{140,11,187},{133,0,896},{146,0,178},{134,0,695},{137,0,808},{134,
+11,587},{7,11,107},{7,11,838},{8,11,550},{138,11,401},{7,0,1117},{136,0,539},{4,
+10,277},{5,10,608},{6,10,493},{7,10,457},{140,10,384},{133,11,768},{12,0,257},{7
+,10,27},{135,10,316},{140,0,1003},{4,0,207},{5,0,586},{5,0,676},{6,0,448},{8,0,
+244},{11,0,1},{13,0,3},{16,0,54},{17,0,4},{18,0,13},{133,10,552},{4,10,401},{137
+,10,264},{5,0,516},{7,0,1883},{135,11,1883},{12,0,960},{132,11,894},{5,0,4},{5,0
+,810},{6,0,13},{6,0,538},{6,0,1690},{6,0,1726},{7,0,499},{7,0,1819},{8,0,148},{8
+,0,696},{8,0,791},{12,0,125},{143,0,9},{135,0,1268},{11,0,30},{14,0,315},{9,10,
+543},{10,10,524},{12,10,524},{16,10,18},{20,10,26},{148,10,65},{6,0,748},{4,10,
+205},{5,10,623},{7,10,104},{136,10,519},{11,0,542},{139,0,852},{140,0,6},{132,0,
+848},{7,0,1385},{11,0,582},{11,0,650},{11,0,901},{11,0,949},{12,0,232},{12,0,236
+},{13,0,413},{13,0,501},{18,0,116},{7,10,579},{9,10,41},{9,10,244},{9,10,669},{
+10,10,5},{11,10,861},{11,10,951},{139,10,980},{4,0,945},{6,0,1811},{6,0,1845},{6
+,0,1853},{6,0,1858},{8,0,862},{12,0,782},{12,0,788},{18,0,160},{148,0,117},{132,
+10,717},{4,0,925},{5,0,803},{8,0,698},{138,0,828},{134,0,1416},{132,0,610},{139,
+0,992},{6,0,878},{134,0,1477},{135,0,1847},{138,11,531},{137,11,539},{134,11,272
+},{133,0,383},{134,0,1404},{132,10,489},{4,11,9},{5,11,128},{7,11,368},{11,11,
+480},{148,11,3},{136,0,986},{9,0,660},{138,0,347},{135,10,892},{136,11,682},{7,0
+,572},{9,0,592},{11,0,680},{12,0,356},{140,0,550},{7,0,1411},{138,11,527},{4,11,
+2},{7,11,545},{135,11,894},{137,10,473},{11,0,64},{7,11,481},{7,10,819},{9,10,26
+},{9,10,392},{9,11,792},{10,10,152},{10,10,226},{12,10,276},{12,10,426},{12,10,
+589},{13,10,460},{15,10,97},{19,10,48},{148,10,104},{135,10,51},{136,11,445},{
+136,11,646},{135,0,606},{132,10,674},{6,0,1829},{134,0,1830},{132,10,770},{5,10,
+79},{7,10,1027},{7,10,1477},{139,10,52},{5,11,530},{142,11,113},{134,10,1666},{7
+,0,748},{139,0,700},{134,10,195},{133,10,789},{9,0,87},{10,0,365},{4,10,251},{4,
+10,688},{7,10,513},{135,10,1284},{136,11,111},{133,0,127},{6,0,198},{140,0,83},{
+133,11,556},{133,10,889},{4,10,160},{5,10,330},{7,10,1434},{136,10,174},{5,0,276
+},{6,0,55},{7,0,1369},{138,0,864},{8,11,16},{140,11,568},{6,0,1752},{136,0,726},
+{135,0,1066},{133,0,764},{6,11,186},{137,11,426},{11,0,683},{139,11,683},{6,0,
+309},{7,0,331},{138,0,550},{133,10,374},{6,0,1212},{6,0,1852},{7,0,1062},{8,0,
+874},{8,0,882},{138,0,936},{132,11,585},{134,0,1364},{7,0,986},{133,10,731},{6,0
+,723},{6,0,1408},{138,0,381},{135,0,1573},{134,0,1025},{4,10,626},{5,10,642},{6,
+10,425},{10,10,202},{139,10,141},{4,11,93},{5,11,252},{6,11,229},{7,11,291},{9,
+11,550},{139,11,644},{137,11,749},{137,11,162},{132,11,381},{135,0,1559},{6,0,
+194},{7,0,133},{10,0,493},{10,0,570},{139,0,664},{5,0,24},{5,0,569},{6,0,3},{6,0
+,119},{6,0,143},{6,0,440},{7,0,295},{7,0,599},{7,0,1686},{7,0,1854},{8,0,424},{9
+,0,43},{9,0,584},{9,0,760},{10,0,148},{10,0,328},{11,0,159},{11,0,253},{11,0,506
+},{12,0,487},{140,0,531},{6,0,661},{134,0,1517},{136,10,835},{151,10,17},{5,0,14
+},{5,0,892},{6,0,283},{7,0,234},{136,0,537},{139,0,541},{4,0,126},{8,0,635},{147
+,0,34},{4,0,316},{4,0,495},{135,0,1561},{4,11,187},{5,11,184},{5,11,690},{7,11,
+1869},{138,11,756},{139,11,783},{4,0,998},{137,0,861},{136,0,1009},{139,11,292},
+{5,11,21},{6,11,77},{6,11,157},{7,11,974},{7,11,1301},{7,11,1339},{7,11,1490},{7
+,11,1873},{137,11,628},{7,11,1283},{9,11,227},{9,11,499},{10,11,341},{11,11,325}
+,{11,11,408},{14,11,180},{15,11,144},{18,11,47},{147,11,49},{4,0,64},{5,0,352},{
+5,0,720},{6,0,368},{139,0,359},{5,10,384},{8,10,455},{140,10,48},{5,10,264},{134
+,10,184},{7,0,1577},{10,0,304},{10,0,549},{12,0,365},{13,0,220},{13,0,240},{142,
+0,33},{134,0,1107},{134,0,929},{135,0,1142},{6,0,175},{137,0,289},{5,0,432},{133
+,0,913},{6,0,279},{7,0,219},{5,10,633},{135,10,1323},{7,0,785},{7,10,359},{8,10,
+243},{140,10,175},{139,0,595},{132,10,105},{8,11,398},{9,11,681},{139,11,632},{
+140,0,80},{5,0,931},{134,0,1698},{142,11,241},{134,11,20},{134,0,1323},{11,0,526
+},{11,0,939},{141,0,290},{5,0,774},{6,0,780},{6,0,1637},{6,0,1686},{6,0,1751},{8
+,0,559},{141,0,109},{141,0,127},{7,0,1167},{11,0,934},{13,0,391},{17,0,76},{135,
+11,709},{135,0,963},{6,0,260},{135,0,1484},{134,0,573},{4,10,758},{139,11,941},{
+135,10,1649},{145,11,36},{4,0,292},{137,0,580},{4,0,736},{5,0,871},{6,0,1689},{
+135,0,1944},{7,11,945},{11,11,713},{139,11,744},{134,0,1164},{135,11,937},{6,0,
+1922},{9,0,982},{15,0,173},{15,0,178},{15,0,200},{18,0,189},{18,0,207},{21,0,47}
+,{135,11,1652},{7,0,1695},{139,10,128},{6,0,63},{135,0,920},{133,0,793},{143,11,
+134},{133,10,918},{5,0,67},{6,0,62},{6,0,374},{135,0,1391},{9,0,790},{12,0,47},{
+4,11,579},{5,11,226},{5,11,323},{135,11,960},{10,11,784},{141,11,191},{4,0,391},
+{135,0,1169},{137,0,443},{13,11,232},{146,11,35},{132,10,340},{132,0,271},{137,
+11,313},{5,11,973},{137,11,659},{134,0,1140},{6,11,135},{135,11,1176},{4,0,253},
+{5,0,544},{7,0,300},{137,0,340},{7,0,897},{5,10,985},{7,10,509},{145,10,96},{138
+,11,735},{135,10,1919},{138,0,890},{5,0,818},{134,0,1122},{5,0,53},{5,0,541},{6,
+0,94},{6,0,499},{7,0,230},{139,0,321},{4,0,920},{5,0,25},{5,0,790},{6,0,457},{7,
+0,853},{8,0,788},{142,11,31},{132,10,247},{135,11,314},{132,0,468},{7,0,243},{6,
+10,337},{7,10,494},{8,10,27},{8,10,599},{138,10,153},{4,10,184},{5,10,390},{7,10
+,618},{7,10,1456},{139,10,710},{134,0,870},{134,0,1238},{134,0,1765},{10,0,853},
+{10,0,943},{14,0,437},{14,0,439},{14,0,443},{14,0,446},{14,0,452},{14,0,469},{14
+,0,471},{14,0,473},{16,0,93},{16,0,102},{16,0,110},{148,0,121},{4,0,605},{7,0,
+518},{7,0,1282},{7,0,1918},{10,0,180},{139,0,218},{133,0,822},{4,0,634},{11,0,
+916},{142,0,419},{6,11,281},{7,11,6},{8,11,282},{8,11,480},{8,11,499},{9,11,198}
+,{10,11,143},{10,11,169},{10,11,211},{10,11,417},{10,11,574},{11,11,147},{11,11,
+395},{12,11,75},{12,11,407},{12,11,608},{13,11,500},{142,11,251},{134,0,898},{6,
+0,36},{7,0,658},{8,0,454},{150,11,48},{133,11,674},{135,11,1776},{4,11,419},{10,
+10,227},{11,10,497},{11,10,709},{140,10,415},{6,10,360},{7,10,1664},{136,10,478}
+,{137,0,806},{12,11,508},{14,11,102},{14,11,226},{144,11,57},{135,11,1123},{4,11
+,138},{7,11,1012},{7,11,1280},{137,11,76},{5,11,29},{140,11,638},{136,10,699},{
+134,0,1326},{132,0,104},{135,11,735},{132,10,739},{134,0,1331},{7,0,260},{135,11
+,260},{135,11,1063},{7,0,45},{9,0,542},{9,0,566},{10,0,728},{137,10,869},{4,10,
+67},{5,10,422},{7,10,1037},{7,10,1289},{7,10,1555},{9,10,741},{145,10,108},{139,
+0,263},{134,0,1516},{14,0,146},{15,0,42},{16,0,23},{17,0,86},{146,0,17},{138,0,
+468},{136,0,1005},{4,11,17},{5,11,23},{7,11,995},{11,11,383},{11,11,437},{12,11,
+460},{140,11,532},{7,0,87},{142,0,288},{138,10,96},{135,11,626},{144,10,26},{7,0
+,988},{7,0,1939},{9,0,64},{9,0,502},{12,0,22},{12,0,34},{13,0,12},{13,0,234},{
+147,0,77},{13,0,133},{8,10,203},{11,10,823},{11,10,846},{12,10,482},{13,10,277},
+{13,10,302},{13,10,464},{14,10,205},{142,10,221},{4,10,449},{133,10,718},{135,0,
+141},{6,0,1842},{136,0,872},{8,11,70},{12,11,171},{141,11,272},{4,10,355},{6,10,
+311},{9,10,256},{138,10,404},{132,0,619},{137,0,261},{10,11,233},{10,10,758},{
+139,11,76},{5,0,246},{8,0,189},{9,0,355},{9,0,512},{10,0,124},{10,0,453},{11,0,
+143},{11,0,416},{11,0,859},{141,0,341},{134,11,442},{133,10,827},{5,10,64},{140,
+10,581},{4,10,442},{7,10,1047},{7,10,1352},{135,10,1643},{134,11,1709},{5,0,678}
+,{6,0,305},{7,0,775},{7,0,1065},{133,10,977},{11,11,69},{12,11,105},{12,11,117},
+{13,11,213},{14,11,13},{14,11,62},{14,11,177},{14,11,421},{15,11,19},{146,11,141
+},{137,11,309},{5,0,35},{7,0,862},{7,0,1886},{138,0,179},{136,0,285},{132,0,517}
+,{7,11,976},{9,11,146},{10,11,206},{10,11,596},{13,11,218},{142,11,153},{132,10,
+254},{6,0,214},{12,0,540},{4,10,275},{7,10,1219},{140,10,376},{8,0,667},{11,0,
+403},{146,0,83},{12,0,74},{10,11,648},{11,11,671},{143,11,46},{135,0,125},{134,
+10,1753},{133,0,761},{6,0,912},{4,11,518},{6,10,369},{6,10,502},{7,10,1036},{7,
+11,1136},{8,10,348},{9,10,452},{10,10,26},{11,10,224},{11,10,387},{11,10,772},{
+12,10,95},{12,10,629},{13,10,195},{13,10,207},{13,10,241},{14,10,260},{14,10,270
+},{143,10,140},{10,0,131},{140,0,72},{132,10,269},{5,10,480},{7,10,532},{7,10,
+1197},{7,10,1358},{8,10,291},{11,10,349},{142,10,396},{8,11,689},{137,11,863},{8
+,0,333},{138,0,182},{4,11,18},{7,11,145},{7,11,444},{7,11,1278},{8,11,49},{8,11,
+400},{9,11,71},{9,11,250},{10,11,459},{12,11,160},{144,11,24},{14,11,35},{142,11
+,191},{135,11,1864},{135,0,1338},{148,10,15},{14,0,94},{15,0,65},{16,0,4},{16,0,
+77},{16,0,80},{145,0,5},{12,11,82},{143,11,36},{133,11,1010},{133,0,449},{133,0,
+646},{7,0,86},{8,0,103},{135,10,657},{7,0,2028},{138,0,641},{136,10,533},{134,0,
+1},{139,11,970},{5,11,87},{7,11,313},{7,11,1103},{10,11,112},{10,11,582},{11,11,
+389},{11,11,813},{12,11,385},{13,11,286},{14,11,124},{146,11,108},{6,0,869},{132
+,11,267},{6,0,277},{7,0,1274},{7,0,1386},{146,0,87},{6,0,187},{7,0,39},{7,0,1203
+},{8,0,380},{14,0,117},{149,0,28},{4,10,211},{4,10,332},{5,10,335},{6,10,238},{7
+,10,269},{7,10,811},{7,10,1797},{8,10,836},{9,10,507},{141,10,242},{4,0,785},{5,
+0,368},{6,0,297},{7,0,793},{139,0,938},{7,0,464},{8,0,558},{11,0,105},{12,0,231}
+,{14,0,386},{15,0,102},{148,0,75},{133,10,1009},{8,0,877},{140,0,731},{139,11,
+289},{10,11,249},{139,11,209},{132,11,561},{134,0,1608},{132,11,760},{134,0,1429
+},{9,11,154},{140,11,485},{5,10,228},{6,10,203},{7,10,156},{8,10,347},{137,10,
+265},{7,0,1010},{11,0,733},{11,0,759},{13,0,34},{14,0,427},{146,0,45},{7,10,1131
+},{135,10,1468},{136,11,255},{7,0,1656},{9,0,369},{10,0,338},{10,0,490},{11,0,
+154},{11,0,545},{11,0,775},{13,0,77},{141,0,274},{133,11,621},{134,0,1038},{4,11
+,368},{135,11,641},{6,0,2010},{8,0,979},{8,0,985},{10,0,951},{138,0,1011},{134,0
+,1005},{19,0,121},{5,10,291},{5,10,318},{7,10,765},{9,10,389},{140,10,548},{5,0,
+20},{6,0,298},{7,0,659},{137,0,219},{7,0,1440},{11,0,854},{11,0,872},{11,0,921},
+{12,0,551},{13,0,472},{142,0,367},{5,0,490},{6,0,615},{6,0,620},{135,0,683},{6,0
+,1070},{134,0,1597},{139,0,522},{132,0,439},{136,0,669},{6,0,766},{6,0,1143},{6,
+0,1245},{10,10,525},{139,10,82},{9,11,92},{147,11,91},{6,0,668},{134,0,1218},{6,
+11,525},{9,11,876},{140,11,284},{132,0,233},{136,0,547},{132,10,422},{5,10,355},
+{145,10,0},{6,11,300},{135,11,1515},{4,0,482},{137,10,905},{4,0,886},{7,0,346},{
+133,11,594},{133,10,865},{5,10,914},{134,10,1625},{135,0,334},{5,0,795},{6,0,
+1741},{133,10,234},{135,10,1383},{6,11,1641},{136,11,820},{135,0,371},{7,11,1313
+},{138,11,660},{135,10,1312},{135,0,622},{7,0,625},{135,0,1750},{135,0,339},{4,0
+,203},{135,0,1936},{15,0,29},{16,0,38},{15,11,29},{144,11,38},{5,0,338},{135,0,
+1256},{135,10,1493},{10,0,130},{6,10,421},{7,10,61},{7,10,1540},{138,10,501},{6,
+11,389},{7,11,149},{9,11,142},{138,11,94},{137,10,341},{11,0,678},{12,0,307},{
+142,10,98},{6,11,8},{7,11,1881},{136,11,91},{135,0,2044},{6,0,770},{6,0,802},{6,
+0,812},{7,0,311},{9,0,308},{12,0,255},{6,10,102},{7,10,72},{15,10,142},{147,10,
+67},{151,10,30},{135,10,823},{135,0,1266},{135,11,1746},{135,10,1870},{4,0,400},
+{5,0,267},{135,0,232},{7,11,24},{11,11,542},{139,11,852},{135,11,1739},{4,11,503
+},{135,11,1661},{5,11,130},{7,11,1314},{9,11,610},{10,11,718},{11,11,601},{11,11
+,819},{11,11,946},{140,11,536},{10,11,149},{11,11,280},{142,11,336},{7,0,739},{
+11,0,690},{7,11,1946},{8,10,48},{8,10,88},{8,10,582},{8,10,681},{9,10,373},{9,10
+,864},{11,10,157},{11,10,843},{148,10,27},{134,0,990},{4,10,88},{5,10,137},{5,10
+,174},{5,10,777},{6,10,1664},{6,10,1725},{7,10,77},{7,10,426},{7,10,1317},{7,10,
+1355},{8,10,126},{8,10,563},{9,10,523},{9,10,750},{10,10,310},{10,10,836},{11,10
+,42},{11,10,318},{11,10,731},{12,10,68},{12,10,92},{12,10,507},{12,10,692},{13,
+10,81},{13,10,238},{13,10,374},{14,10,436},{18,10,138},{19,10,78},{19,10,111},{
+20,10,55},{20,10,77},{148,10,92},{141,10,418},{7,0,1831},{132,10,938},{6,0,776},
+{134,0,915},{138,10,351},{5,11,348},{6,11,522},{6,10,1668},{7,10,1499},{8,10,117
+},{9,10,314},{138,10,174},{135,10,707},{132,0,613},{133,10,403},{132,11,392},{5,
+11,433},{9,11,633},{139,11,629},{133,0,763},{132,0,878},{132,0,977},{132,0,100},
+{6,0,463},{4,10,44},{5,10,311},{7,10,639},{7,10,762},{7,10,1827},{9,10,8},{9,10,
+462},{148,10,83},{134,11,234},{4,10,346},{7,10,115},{9,10,180},{9,10,456},{138,
+10,363},{5,0,362},{5,0,443},{6,0,318},{7,0,1019},{139,0,623},{5,0,463},{8,0,296}
+,{7,11,140},{7,11,1950},{8,11,680},{11,11,817},{147,11,88},{7,11,1222},{138,11,
+386},{142,0,137},{132,0,454},{7,0,1914},{6,11,5},{7,10,1051},{9,10,545},{11,11,
+249},{12,11,313},{16,11,66},{145,11,26},{135,0,1527},{145,0,58},{148,11,59},{5,0
+,48},{5,0,404},{6,0,557},{7,0,458},{8,0,597},{10,0,455},{10,0,606},{11,0,49},{11
+,0,548},{12,0,476},{13,0,18},{141,0,450},{5,11,963},{134,11,1773},{133,0,729},{
+138,11,586},{5,0,442},{135,0,1984},{134,0,449},{144,0,40},{4,0,853},{7,11,180},{
+8,11,509},{136,11,792},{6,10,185},{7,10,1899},{9,10,875},{139,10,673},{134,11,
+524},{12,0,227},{4,10,327},{5,10,478},{7,10,1332},{136,10,753},{6,0,1491},{5,10,
+1020},{133,10,1022},{4,10,103},{133,10,401},{132,11,931},{4,10,499},{135,10,1421
+},{5,0,55},{7,0,376},{140,0,161},{133,0,450},{6,0,1174},{134,0,1562},{10,0,62},{
+13,0,400},{135,11,1837},{140,0,207},{135,0,869},{4,11,773},{5,11,618},{137,11,
+756},{132,10,96},{4,0,213},{7,0,223},{8,0,80},{135,10,968},{4,11,90},{5,11,337},
+{5,11,545},{7,11,754},{9,11,186},{10,11,72},{10,11,782},{11,11,513},{11,11,577},
+{11,11,610},{11,11,889},{11,11,961},{12,11,354},{12,11,362},{12,11,461},{12,11,
+595},{13,11,79},{143,11,121},{7,0,381},{7,0,806},{7,0,820},{8,0,354},{8,0,437},{
+8,0,787},{9,0,657},{10,0,58},{10,0,339},{10,0,749},{11,0,914},{12,0,162},{13,0,
+75},{14,0,106},{14,0,198},{14,0,320},{14,0,413},{146,0,43},{136,0,747},{136,0,
+954},{134,0,1073},{135,0,556},{7,11,151},{9,11,329},{139,11,254},{5,0,692},{134,
+0,1395},{6,10,563},{137,10,224},{134,0,191},{132,0,804},{9,11,187},{10,11,36},{
+17,11,44},{146,11,64},{7,11,165},{7,11,919},{136,11,517},{4,11,506},{5,11,295},{
+7,11,1680},{15,11,14},{144,11,5},{4,0,706},{6,0,162},{7,0,1960},{136,0,831},{135
+,11,1376},{7,11,987},{9,11,688},{10,11,522},{11,11,788},{140,11,566},{150,0,35},
+{138,0,426},{135,0,1235},{135,11,1741},{7,11,389},{7,11,700},{7,11,940},{8,11,
+514},{9,11,116},{9,11,535},{10,11,118},{11,11,107},{11,11,148},{11,11,922},{12,
+11,254},{12,11,421},{142,11,238},{134,0,1234},{132,11,743},{4,10,910},{5,10,832}
+,{135,11,1335},{141,0,96},{135,11,185},{146,0,149},{4,0,204},{137,0,902},{4,11,
+784},{133,11,745},{136,0,833},{136,0,949},{7,0,366},{9,0,287},{12,0,199},{12,0,
+556},{12,0,577},{5,11,81},{7,11,146},{7,11,1342},{7,11,1446},{8,11,53},{8,11,561
+},{8,11,694},{8,11,754},{9,11,97},{9,11,115},{9,11,894},{10,11,462},{10,11,813},
+{11,11,230},{11,11,657},{11,11,699},{11,11,748},{12,11,119},{12,11,200},{12,11,
+283},{14,11,273},{145,11,15},{5,11,408},{137,11,747},{9,11,498},{140,11,181},{6,
+0,2020},{136,0,992},{5,0,356},{135,0,224},{134,0,784},{7,0,630},{9,0,567},{11,0,
+150},{11,0,444},{13,0,119},{8,10,528},{137,10,348},{134,0,539},{4,10,20},{133,10
+,616},{142,0,27},{7,11,30},{8,11,86},{8,11,315},{8,11,700},{9,11,576},{9,11,858}
+,{11,11,310},{11,11,888},{11,11,904},{12,11,361},{141,11,248},{138,11,839},{134,
+0,755},{134,0,1063},{7,10,1091},{135,10,1765},{134,11,428},{7,11,524},{8,11,169}
+,{8,11,234},{9,11,480},{138,11,646},{139,0,814},{7,11,1462},{139,11,659},{4,10,
+26},{5,10,429},{6,10,245},{7,10,704},{7,10,1379},{135,10,1474},{7,11,1205},{138,
+11,637},{139,11,803},{132,10,621},{136,0,987},{4,11,266},{8,11,4},{9,11,39},{10,
+11,166},{11,11,918},{12,11,635},{20,11,10},{22,11,27},{150,11,43},{4,0,235},{135
+,0,255},{4,0,194},{5,0,584},{6,0,384},{7,0,583},{10,0,761},{11,0,760},{139,0,851
+},{133,10,542},{134,0,1086},{133,10,868},{8,0,1016},{136,0,1018},{7,0,1396},{7,
+11,1396},{136,10,433},{135,10,1495},{138,10,215},{141,10,124},{7,11,157},{8,11,
+279},{9,11,759},{16,11,31},{16,11,39},{16,11,75},{18,11,24},{20,11,42},{152,11,1
+},{5,0,562},{134,11,604},{134,0,913},{5,0,191},{137,0,271},{4,0,470},{6,0,153},{
+7,0,1503},{7,0,1923},{10,0,701},{11,0,132},{11,0,227},{11,0,320},{11,0,436},{11,
+0,525},{11,0,855},{11,0,873},{12,0,41},{12,0,286},{13,0,103},{13,0,284},{14,0,
+255},{14,0,262},{15,0,117},{143,0,127},{7,0,475},{12,0,45},{147,10,112},{132,11,
+567},{137,11,859},{6,0,713},{6,0,969},{6,0,1290},{134,0,1551},{133,0,327},{6,0,
+552},{6,0,1292},{7,0,1754},{137,0,604},{4,0,223},{6,0,359},{11,0,3},{13,0,108},{
+14,0,89},{16,0,22},{5,11,762},{7,11,1880},{9,11,680},{139,11,798},{5,0,80},{6,0,
+405},{7,0,403},{7,0,1502},{8,0,456},{9,0,487},{9,0,853},{9,0,889},{10,0,309},{11
+,0,721},{11,0,994},{12,0,430},{141,0,165},{133,11,298},{132,10,647},{134,0,2016}
+,{18,10,10},{146,11,10},{4,0,453},{5,0,887},{6,0,535},{8,0,6},{8,0,543},{136,0,
+826},{136,0,975},{10,0,961},{138,0,962},{138,10,220},{6,0,1891},{6,0,1893},{9,0,
+916},{9,0,965},{9,0,972},{12,0,801},{12,0,859},{12,0,883},{15,0,226},{149,0,51},
+{132,10,109},{135,11,267},{7,11,92},{7,11,182},{8,11,453},{9,11,204},{11,11,950}
+,{12,11,94},{12,11,644},{16,11,20},{16,11,70},{16,11,90},{147,11,55},{134,10,
+1746},{6,11,71},{7,11,845},{7,11,1308},{8,11,160},{137,11,318},{5,0,101},{6,0,88
+},{7,0,263},{7,0,628},{7,0,1677},{8,0,349},{9,0,100},{10,0,677},{14,0,169},{14,0
+,302},{14,0,313},{15,0,48},{15,0,84},{7,11,237},{8,11,664},{9,11,42},{9,11,266},
+{9,11,380},{9,11,645},{10,11,177},{138,11,276},{138,11,69},{4,0,310},{7,0,708},{
+7,0,996},{9,0,795},{10,0,390},{10,0,733},{11,0,451},{12,0,249},{14,0,115},{14,0,
+286},{143,0,100},{5,0,587},{4,10,40},{10,10,67},{11,10,117},{11,10,768},{139,10,
+935},{6,0,1942},{7,0,512},{136,0,983},{7,10,992},{8,10,301},{9,10,722},{12,10,63
+},{13,10,29},{14,10,161},{143,10,18},{136,11,76},{139,10,923},{134,0,645},{134,0
+,851},{4,0,498},{132,11,293},{7,0,217},{8,0,140},{10,0,610},{14,11,352},{17,11,
+53},{18,11,146},{18,11,152},{19,11,11},{150,11,54},{134,0,1448},{138,11,841},{
+133,0,905},{4,11,605},{7,11,518},{7,11,1282},{7,11,1918},{10,11,180},{139,11,218
+},{139,11,917},{135,10,825},{140,10,328},{4,0,456},{7,0,105},{7,0,358},{7,0,1637
+},{8,0,643},{139,0,483},{134,0,792},{6,11,96},{135,11,1426},{137,11,691},{4,11,
+651},{133,11,289},{7,11,688},{8,11,35},{9,11,511},{10,11,767},{147,11,118},{150,
+0,56},{5,0,243},{5,0,535},{6,10,204},{10,10,320},{10,10,583},{13,10,502},{14,10,
+72},{14,10,274},{14,10,312},{14,10,344},{15,10,159},{16,10,62},{16,10,69},{17,10
+,30},{18,10,42},{18,10,53},{18,10,84},{18,10,140},{19,10,68},{19,10,85},{20,10,5
+},{20,10,45},{20,10,101},{22,10,7},{150,10,20},{4,10,558},{6,10,390},{7,10,162},
+{7,10,689},{9,10,360},{138,10,653},{146,11,23},{135,0,1748},{5,10,856},{6,10,
+1672},{6,10,1757},{134,10,1781},{5,0,539},{5,0,754},{6,0,876},{132,11,704},{135,
+11,1078},{5,10,92},{10,10,736},{140,10,102},{17,0,91},{5,10,590},{137,10,213},{
+134,0,1565},{6,0,91},{135,0,435},{4,0,939},{140,0,792},{134,0,1399},{4,0,16},{5,
+0,316},{5,0,842},{6,0,370},{6,0,1778},{8,0,166},{11,0,812},{12,0,206},{12,0,351}
+,{14,0,418},{16,0,15},{16,0,34},{18,0,3},{19,0,3},{19,0,7},{20,0,4},{21,0,21},{4
+,11,720},{133,11,306},{144,0,95},{133,11,431},{132,11,234},{135,0,551},{4,0,999}
+,{6,0,1966},{134,0,2042},{7,0,619},{10,0,547},{11,0,122},{12,0,601},{15,0,7},{
+148,0,20},{5,11,464},{6,11,236},{7,11,276},{7,11,696},{7,11,914},{7,11,1108},{7,
+11,1448},{9,11,15},{9,11,564},{10,11,14},{12,11,565},{13,11,449},{14,11,53},{15,
+11,13},{16,11,64},{145,11,41},{6,0,884},{6,0,1019},{134,0,1150},{6,11,1767},{12,
+11,194},{145,11,107},{136,10,503},{133,11,840},{7,0,671},{134,10,466},{132,0,888
+},{4,0,149},{138,0,368},{4,0,154},{7,0,1134},{136,0,105},{135,0,983},{9,11,642},
+{11,11,236},{142,11,193},{4,0,31},{6,0,429},{7,0,962},{9,0,458},{139,0,691},{6,0
+,643},{134,0,1102},{132,0,312},{4,11,68},{5,11,634},{6,11,386},{7,11,794},{8,11,
+273},{9,11,563},{10,11,105},{10,11,171},{11,11,94},{139,11,354},{133,0,740},{135
+,0,1642},{4,11,95},{7,11,416},{8,11,211},{139,11,830},{132,0,236},{138,10,241},{
+7,11,731},{13,11,20},{143,11,11},{5,0,836},{5,0,857},{6,0,1680},{135,0,59},{10,0
+,68},{11,0,494},{152,11,6},{4,0,81},{139,0,867},{135,0,795},{133,11,689},{4,0,
+1001},{5,0,282},{6,0,1932},{6,0,1977},{6,0,1987},{6,0,1992},{8,0,650},{8,0,919},
+{8,0,920},{8,0,923},{8,0,926},{8,0,927},{8,0,931},{8,0,939},{8,0,947},{8,0,956},
+{8,0,997},{9,0,907},{10,0,950},{10,0,953},{10,0,954},{10,0,956},{10,0,958},{10,0
+,959},{10,0,964},{10,0,970},{10,0,972},{10,0,973},{10,0,975},{10,0,976},{10,0,
+980},{10,0,981},{10,0,984},{10,0,988},{10,0,990},{10,0,995},{10,0,999},{10,0,
+1002},{10,0,1003},{10,0,1005},{10,0,1006},{10,0,1008},{10,0,1009},{10,0,1012},{
+10,0,1014},{10,0,1015},{10,0,1019},{10,0,1020},{10,0,1022},{12,0,959},{12,0,961}
+,{12,0,962},{12,0,963},{12,0,964},{12,0,965},{12,0,967},{12,0,968},{12,0,969},{
+12,0,970},{12,0,971},{12,0,972},{12,0,973},{12,0,974},{12,0,975},{12,0,976},{12,
+0,977},{12,0,979},{12,0,981},{12,0,982},{12,0,983},{12,0,984},{12,0,985},{12,0,
+986},{12,0,987},{12,0,989},{12,0,990},{12,0,992},{12,0,993},{12,0,995},{12,0,998
+},{12,0,999},{12,0,1000},{12,0,1001},{12,0,1002},{12,0,1004},{12,0,1005},{12,0,
+1006},{12,0,1007},{12,0,1008},{12,0,1009},{12,0,1010},{12,0,1011},{12,0,1012},{
+12,0,1014},{12,0,1015},{12,0,1016},{12,0,1017},{12,0,1018},{12,0,1019},{12,0,
+1022},{12,0,1023},{14,0,475},{14,0,477},{14,0,478},{14,0,479},{14,0,480},{14,0,
+482},{14,0,483},{14,0,484},{14,0,485},{14,0,486},{14,0,487},{14,0,488},{14,0,489
+},{14,0,490},{14,0,491},{14,0,492},{14,0,493},{14,0,494},{14,0,495},{14,0,496},{
+14,0,497},{14,0,498},{14,0,499},{14,0,500},{14,0,501},{14,0,502},{14,0,503},{14,
+0,504},{14,0,506},{14,0,507},{14,0,508},{14,0,509},{14,0,510},{14,0,511},{16,0,
+113},{16,0,114},{16,0,115},{16,0,117},{16,0,118},{16,0,119},{16,0,121},{16,0,122
+},{16,0,123},{16,0,124},{16,0,125},{16,0,126},{16,0,127},{18,0,242},{18,0,243},{
+18,0,244},{18,0,245},{18,0,248},{18,0,249},{18,0,250},{18,0,251},{18,0,252},{18,
+0,253},{18,0,254},{18,0,255},{20,0,125},{20,0,126},{148,0,127},{7,11,1717},{7,11
+,1769},{138,11,546},{7,11,1127},{7,11,1572},{10,11,297},{10,11,422},{11,11,764},
+{11,11,810},{12,11,264},{13,11,102},{13,11,300},{13,11,484},{14,11,147},{14,11,
+229},{17,11,71},{18,11,118},{147,11,120},{6,0,1148},{134,0,1586},{132,0,775},{
+135,10,954},{133,11,864},{133,11,928},{138,11,189},{135,10,1958},{6,10,549},{8,
+10,34},{8,10,283},{9,10,165},{138,10,475},{5,10,652},{5,10,701},{135,10,449},{
+135,11,695},{4,10,655},{7,10,850},{17,10,75},{146,10,137},{140,11,682},{133,11,
+523},{8,0,970},{136,10,670},{136,11,555},{7,11,76},{8,11,44},{9,11,884},{10,11,
+580},{11,11,399},{11,11,894},{15,11,122},{18,11,144},{147,11,61},{6,10,159},{6,
+10,364},{7,10,516},{7,10,1439},{137,10,518},{4,0,71},{5,0,376},{7,0,119},{138,0,
+665},{141,10,151},{11,0,827},{14,0,34},{143,0,148},{133,11,518},{4,0,479},{135,
+11,1787},{135,11,1852},{135,10,993},{7,0,607},{136,0,99},{134,0,1960},{132,0,793
+},{4,0,41},{5,0,74},{7,0,1627},{11,0,871},{140,0,619},{7,0,94},{11,0,329},{11,0,
+965},{12,0,241},{14,0,354},{15,0,22},{148,0,63},{7,10,501},{9,10,111},{10,10,141
+},{11,10,332},{13,10,43},{13,10,429},{14,10,130},{14,10,415},{145,10,102},{9,0,
+209},{137,0,300},{134,0,1497},{138,11,255},{4,11,934},{5,11,138},{136,11,610},{
+133,0,98},{6,0,1316},{10,11,804},{138,11,832},{8,11,96},{9,11,36},{10,11,607},{
+11,11,423},{11,11,442},{12,11,309},{14,11,199},{15,11,90},{145,11,110},{132,0,
+463},{5,10,149},{136,10,233},{133,10,935},{4,11,652},{8,11,320},{9,11,13},{9,11,
+398},{9,11,727},{10,11,75},{10,11,184},{10,11,230},{10,11,564},{10,11,569},{11,
+11,973},{12,11,70},{12,11,189},{13,11,57},{13,11,257},{22,11,6},{150,11,16},{142
+,0,291},{12,10,582},{146,10,131},{136,10,801},{133,0,984},{145,11,116},{4,11,692
+},{133,11,321},{4,0,182},{6,0,205},{135,0,220},{4,0,42},{9,0,205},{9,0,786},{138
+,0,659},{6,0,801},{11,11,130},{140,11,609},{132,0,635},{5,11,345},{135,11,1016},
+{139,0,533},{132,0,371},{4,0,272},{135,0,836},{6,0,1282},{135,11,1100},{5,0,825}
+,{134,0,1640},{135,11,1325},{133,11,673},{4,11,287},{133,11,1018},{135,0,357},{6
+,0,467},{137,0,879},{7,0,317},{135,0,569},{6,0,924},{134,0,1588},{5,11,34},{5,10
+,406},{10,11,724},{12,11,444},{13,11,354},{18,11,32},{23,11,24},{23,11,31},{152,
+11,5},{6,0,1795},{6,0,1835},{6,0,1836},{6,0,1856},{8,0,844},{8,0,849},{8,0,854},
+{8,0,870},{8,0,887},{10,0,852},{138,0,942},{6,10,69},{135,10,117},{137,0,307},{4
+,0,944},{6,0,1799},{6,0,1825},{10,0,848},{10,0,875},{10,0,895},{10,0,899},{10,0,
+902},{140,0,773},{11,0,43},{13,0,72},{141,0,142},{135,10,1830},{134,11,382},{4,
+10,432},{135,10,824},{132,11,329},{7,0,1820},{139,11,124},{133,10,826},{133,0,
+525},{132,11,906},{7,11,1940},{136,11,366},{138,11,10},{4,11,123},{4,11,649},{5,
+11,605},{7,11,1509},{136,11,36},{6,0,110},{135,0,1681},{133,0,493},{133,11,767},
+{4,0,174},{135,0,911},{138,11,786},{8,0,417},{137,0,782},{133,10,1000},{7,0,733}
+,{137,0,583},{4,10,297},{6,10,529},{7,10,152},{7,10,713},{7,10,1845},{8,10,710},
+{8,10,717},{12,10,639},{140,10,685},{4,0,32},{5,0,215},{6,0,269},{7,0,1782},{7,0
+,1892},{10,0,16},{11,0,822},{11,0,954},{141,0,481},{4,11,273},{5,11,658},{133,11
+,995},{136,0,477},{134,11,72},{135,11,1345},{5,0,308},{7,0,1088},{4,10,520},{135
+,10,575},{133,11,589},{5,0,126},{8,0,297},{9,0,366},{140,0,374},{7,0,1551},{139,
+0,361},{5,11,117},{6,11,514},{6,11,541},{7,11,1164},{7,11,1436},{8,11,220},{8,11
+,648},{10,11,688},{139,11,560},{133,11,686},{4,0,946},{6,0,1807},{8,0,871},{10,0
+,854},{10,0,870},{10,0,888},{10,0,897},{10,0,920},{12,0,722},{12,0,761},{12,0,
+763},{12,0,764},{14,0,454},{14,0,465},{16,0,107},{18,0,167},{18,0,168},{146,0,
+172},{132,0,175},{135,0,1307},{132,0,685},{135,11,1834},{133,0,797},{6,0,745},{6
+,0,858},{134,0,963},{133,0,565},{5,10,397},{6,10,154},{7,11,196},{7,10,676},{8,
+10,443},{8,10,609},{9,10,24},{9,10,325},{10,10,35},{10,11,765},{11,11,347},{11,
+10,535},{11,11,552},{11,11,576},{11,10,672},{11,11,790},{11,10,1018},{12,11,263}
+,{12,10,637},{13,11,246},{13,11,270},{13,11,395},{14,11,74},{14,11,176},{14,11,
+190},{14,11,398},{14,11,412},{15,11,32},{15,11,63},{16,10,30},{16,11,88},{147,11
+,105},{13,11,84},{141,11,122},{4,0,252},{7,0,1068},{10,0,434},{11,0,228},{11,0,
+426},{13,0,231},{18,0,106},{148,0,87},{137,0,826},{4,11,589},{139,11,282},{5,11,
+381},{135,11,1792},{132,0,791},{5,0,231},{10,0,509},{133,10,981},{7,0,601},{9,0,
+277},{9,0,674},{10,0,178},{10,0,418},{10,0,571},{11,0,531},{12,0,113},{12,0,475}
+,{13,0,99},{142,0,428},{4,10,56},{7,11,616},{7,10,1791},{8,10,607},{8,10,651},{
+10,11,413},{11,10,465},{11,10,835},{12,10,337},{141,10,480},{7,0,1591},{144,0,43
+},{9,10,158},{138,10,411},{135,0,1683},{8,0,289},{11,0,45},{12,0,278},{140,0,537
+},{6,11,120},{7,11,1188},{7,11,1710},{8,11,286},{9,11,667},{11,11,592},{139,11,
+730},{136,10,617},{135,0,1120},{135,11,1146},{139,10,563},{4,11,352},{4,10,369},
+{135,11,687},{143,11,38},{4,0,399},{5,0,119},{5,0,494},{7,0,751},{9,0,556},{14,
+11,179},{15,11,151},{150,11,11},{4,11,192},{5,11,49},{6,11,200},{6,11,293},{6,11
+,1696},{135,11,488},{4,0,398},{133,0,660},{7,0,1030},{134,10,622},{135,11,595},{
+141,0,168},{132,11,147},{7,0,973},{10,10,624},{142,10,279},{132,10,363},{132,0,
+642},{133,11,934},{134,0,1615},{7,11,505},{135,11,523},{7,0,594},{7,0,851},{7,0,
+1858},{9,0,411},{9,0,574},{9,0,666},{9,0,737},{10,0,346},{10,0,712},{11,0,246},{
+11,0,432},{11,0,517},{11,0,647},{11,0,679},{11,0,727},{12,0,304},{12,0,305},{12,
+0,323},{12,0,483},{12,0,572},{12,0,593},{12,0,602},{13,0,95},{13,0,101},{13,0,
+171},{13,0,315},{13,0,378},{13,0,425},{13,0,475},{14,0,63},{14,0,380},{14,0,384}
+,{15,0,133},{18,0,112},{148,0,72},{135,0,1093},{132,0,679},{8,0,913},{10,0,903},
+{10,0,915},{12,0,648},{12,0,649},{14,0,455},{16,0,112},{138,11,438},{137,0,203},
+{134,10,292},{134,0,1492},{7,0,1374},{8,0,540},{5,10,177},{6,10,616},{7,10,827},
+{9,10,525},{138,10,656},{135,0,1486},{9,0,714},{138,10,31},{136,0,825},{134,0,
+1511},{132,11,637},{134,0,952},{4,10,161},{133,10,631},{5,0,143},{5,0,769},{6,0,
+1760},{7,0,682},{7,0,1992},{136,0,736},{132,0,700},{134,0,1540},{132,11,777},{9,
+11,867},{138,11,837},{7,0,1557},{135,10,1684},{133,0,860},{6,0,422},{7,0,0},{7,0
+,1544},{9,0,605},{11,0,990},{12,0,235},{12,0,453},{13,0,47},{13,0,266},{9,10,469
+},{9,10,709},{12,10,512},{14,10,65},{145,10,12},{11,0,807},{10,10,229},{11,10,73
+},{139,10,376},{6,11,170},{7,11,1080},{8,11,395},{8,11,487},{11,11,125},{141,11,
+147},{5,0,515},{137,0,131},{7,0,1605},{11,0,962},{146,0,139},{132,0,646},{4,0,
+396},{7,0,728},{9,0,117},{13,0,202},{148,0,51},{6,0,121},{6,0,124},{6,0,357},{7,
+0,1138},{7,0,1295},{8,0,162},{8,0,508},{11,0,655},{4,11,535},{6,10,558},{7,10,
+651},{8,11,618},{9,10,0},{10,10,34},{139,10,1008},{135,11,1245},{138,0,357},{150
+,11,23},{133,0,237},{135,0,1784},{7,10,1832},{138,10,374},{132,0,713},{132,11,46
+},{6,0,1536},{10,0,348},{5,11,811},{6,11,1679},{6,11,1714},{135,11,2032},{11,11,
+182},{142,11,195},{6,0,523},{7,0,738},{7,10,771},{7,10,1731},{9,10,405},{138,10,
+421},{7,11,1458},{9,11,407},{139,11,15},{6,11,34},{7,11,69},{7,11,640},{7,11,
+1089},{8,11,708},{8,11,721},{9,11,363},{9,11,643},{10,11,628},{148,11,98},{133,0
+,434},{135,0,1877},{7,0,571},{138,0,366},{5,10,881},{133,10,885},{9,0,513},{10,0
+,25},{10,0,39},{12,0,122},{140,0,187},{132,0,580},{5,10,142},{134,10,546},{132,
+11,462},{137,0,873},{5,10,466},{11,10,571},{12,10,198},{13,10,283},{14,10,186},{
+15,10,21},{143,10,103},{7,0,171},{4,10,185},{5,10,257},{5,10,839},{5,10,936},{9,
+10,399},{10,10,258},{10,10,395},{10,10,734},{11,10,1014},{12,10,23},{13,10,350},
+{14,10,150},{147,10,6},{134,0,625},{7,0,107},{7,0,838},{8,0,550},{138,0,401},{5,
+11,73},{6,11,23},{134,11,338},{4,0,943},{6,0,1850},{12,0,713},{142,0,434},{11,0,
+588},{11,0,864},{11,0,936},{11,0,968},{12,0,73},{12,0,343},{12,0,394},{13,0,275}
+,{14,0,257},{15,0,160},{7,10,404},{7,10,1377},{7,10,1430},{7,10,2017},{8,10,149}
+,{8,10,239},{8,10,512},{8,10,793},{8,10,818},{9,10,474},{9,10,595},{10,10,122},{
+10,10,565},{10,10,649},{10,10,783},{11,10,239},{11,10,295},{11,10,447},{11,10,
+528},{11,10,639},{11,10,800},{12,10,25},{12,10,157},{12,10,316},{12,10,390},{12,
+10,391},{12,10,395},{12,10,478},{12,10,503},{12,10,592},{12,10,680},{13,10,50},{
+13,10,53},{13,10,132},{13,10,198},{13,10,322},{13,10,415},{13,10,511},{14,10,71}
+,{14,10,395},{15,10,71},{15,10,136},{17,10,123},{18,10,93},{147,10,58},{133,0,
+768},{11,0,103},{142,0,0},{136,10,712},{132,0,799},{132,0,894},{7,11,725},{8,11,
+498},{139,11,268},{135,11,1798},{135,11,773},{141,11,360},{4,10,377},{152,10,13}
+,{135,0,1673},{132,11,583},{134,0,1052},{133,11,220},{140,11,69},{132,11,544},{4
+,10,180},{135,10,1906},{134,0,272},{4,0,441},{134,0,1421},{4,0,9},{5,0,128},{7,0
+,368},{11,0,480},{148,0,3},{5,11,176},{6,11,437},{6,11,564},{11,11,181},{141,11,
+183},{132,10,491},{7,0,1182},{141,11,67},{6,0,1346},{4,10,171},{138,10,234},{4,
+10,586},{7,10,1186},{138,10,631},{136,0,682},{134,0,1004},{15,0,24},{143,11,24},
+{134,0,968},{4,0,2},{6,0,742},{6,0,793},{7,0,545},{7,0,894},{9,10,931},{10,10,
+334},{148,10,71},{136,11,600},{133,10,765},{9,0,769},{140,0,185},{4,11,790},{5,
+11,273},{134,11,394},{7,0,474},{137,0,578},{4,11,135},{6,11,127},{7,11,1185},{7,
+11,1511},{8,11,613},{11,11,5},{12,11,133},{12,11,495},{12,11,586},{14,11,385},{
+15,11,118},{17,11,20},{146,11,98},{133,10,424},{5,0,530},{142,0,113},{6,11,230},
+{7,11,961},{7,11,1085},{136,11,462},{7,11,1954},{137,11,636},{136,10,714},{149,
+11,6},{135,10,685},{9,10,420},{10,10,269},{10,10,285},{10,10,576},{11,10,397},{
+13,10,175},{145,10,90},{132,10,429},{5,0,556},{5,11,162},{136,11,68},{132,11,654
+},{4,11,156},{7,11,998},{7,11,1045},{7,11,1860},{9,11,48},{9,11,692},{11,11,419}
+,{139,11,602},{6,0,1317},{8,0,16},{9,0,825},{12,0,568},{7,11,1276},{8,11,474},{
+137,11,652},{18,0,97},{7,10,18},{7,10,699},{7,10,1966},{8,10,752},{9,10,273},{9,
+10,412},{9,10,703},{10,10,71},{10,10,427},{138,10,508},{10,0,703},{7,11,1454},{
+138,11,703},{4,10,53},{5,10,186},{135,10,752},{134,0,892},{134,0,1571},{8,10,575
+},{10,10,289},{139,10,319},{6,0,186},{137,0,426},{134,0,1101},{132,10,675},{132,
+0,585},{6,0,1870},{137,0,937},{152,11,10},{9,11,197},{10,11,300},{12,11,473},{13
+,11,90},{141,11,405},{4,0,93},{5,0,252},{6,0,229},{7,0,291},{9,0,550},{139,0,644
+},{137,0,749},{9,0,162},{6,10,209},{8,10,468},{9,10,210},{11,10,36},{12,10,28},{
+12,10,630},{13,10,21},{13,10,349},{14,10,7},{145,10,13},{132,0,381},{132,11,606}
+,{4,10,342},{135,10,1179},{7,11,1587},{7,11,1707},{10,11,528},{139,11,504},{12,
+11,39},{13,11,265},{141,11,439},{4,10,928},{133,10,910},{7,10,1838},{7,11,1978},
+{136,11,676},{6,0,762},{6,0,796},{134,0,956},{4,10,318},{4,10,496},{7,10,856},{
+139,10,654},{137,11,242},{4,11,361},{133,11,315},{132,11,461},{132,11,472},{132,
+0,857},{5,0,21},{6,0,77},{6,0,157},{7,0,974},{7,0,1301},{7,0,1339},{7,0,1490},{7
+,0,1873},{9,0,628},{7,10,915},{8,10,247},{147,10,0},{4,10,202},{5,10,382},{6,10,
+454},{7,10,936},{7,10,1803},{8,10,758},{9,10,375},{9,10,895},{10,10,743},{10,10,
+792},{11,10,978},{11,10,1012},{142,10,109},{7,11,617},{10,11,498},{11,11,501},{
+12,11,16},{140,11,150},{7,10,1150},{7,10,1425},{7,10,1453},{10,11,747},{140,10,
+513},{133,11,155},{11,0,919},{141,0,409},{138,10,791},{10,0,633},{139,11,729},{7
+,11,163},{8,11,319},{9,11,402},{10,11,24},{10,11,681},{11,11,200},{11,11,567},{
+12,11,253},{12,11,410},{142,11,219},{5,11,475},{7,11,1780},{9,11,230},{11,11,297
+},{11,11,558},{14,11,322},{147,11,76},{7,0,332},{6,10,445},{137,10,909},{135,11,
+1956},{136,11,274},{134,10,578},{135,0,1489},{135,11,1848},{5,11,944},{134,11,
+1769},{132,11,144},{136,10,766},{4,0,832},{135,10,541},{8,0,398},{9,0,681},{139,
+0,632},{136,0,645},{9,0,791},{10,0,93},{16,0,13},{17,0,23},{18,0,135},{19,0,12},
+{20,0,1},{20,0,12},{148,0,14},{6,11,247},{137,11,555},{134,0,20},{132,0,800},{
+135,0,1841},{139,10,983},{137,10,768},{132,10,584},{141,11,51},{6,0,1993},{4,11,
+620},{138,11,280},{136,0,769},{11,0,290},{11,0,665},{7,11,1810},{11,11,866},{12,
+11,103},{13,11,495},{17,11,67},{147,11,74},{134,0,1426},{139,0,60},{4,10,326},{
+135,10,1770},{7,0,1874},{9,0,641},{132,10,226},{6,0,644},{5,10,426},{8,10,30},{9
+,10,2},{11,10,549},{147,10,122},{5,11,428},{138,11,442},{135,11,1871},{135,0,
+1757},{147,10,117},{135,0,937},{135,0,1652},{6,0,654},{134,0,1476},{133,11,99},{
+135,0,527},{132,10,345},{4,10,385},{4,11,397},{7,10,265},{135,10,587},{4,0,579},
+{5,0,226},{5,0,323},{135,0,960},{134,0,1486},{8,11,502},{144,11,9},{4,10,347},{5
+,10,423},{5,10,996},{135,10,1329},{7,11,727},{146,11,73},{4,11,485},{7,11,353},{
+7,10,1259},{7,11,1523},{9,10,125},{139,10,65},{6,0,325},{5,10,136},{6,11,366},{7
+,11,1384},{7,11,1601},{136,10,644},{138,11,160},{6,0,1345},{137,11,282},{18,0,91
+},{147,0,70},{136,0,404},{4,11,157},{133,11,471},{133,0,973},{6,0,135},{135,0,
+1176},{8,11,116},{11,11,551},{142,11,159},{4,0,549},{4,10,433},{133,10,719},{136
+,0,976},{5,11,160},{7,11,363},{7,11,589},{10,11,170},{141,11,55},{144,0,21},{144
+,0,51},{135,0,314},{135,10,1363},{4,11,108},{7,11,405},{10,11,491},{139,11,498},
+{146,0,4},{4,10,555},{8,10,536},{10,10,288},{139,10,1005},{135,11,1005},{6,0,281
+},{7,0,6},{8,0,282},{8,0,480},{8,0,499},{9,0,198},{10,0,143},{10,0,169},{10,0,
+211},{10,0,417},{10,0,574},{11,0,147},{11,0,395},{12,0,75},{12,0,407},{12,0,608}
+,{13,0,500},{142,0,251},{6,0,1093},{6,0,1405},{9,10,370},{138,10,90},{4,11,926},
+{133,11,983},{135,0,1776},{134,0,1528},{132,0,419},{132,11,538},{6,11,294},{7,11
+,1267},{136,11,624},{135,11,1772},{138,11,301},{4,10,257},{135,10,2031},{4,0,138
+},{7,0,1012},{7,0,1280},{9,0,76},{135,10,1768},{132,11,757},{5,0,29},{140,0,638}
+,{7,11,655},{135,11,1844},{7,0,1418},{6,11,257},{135,11,1522},{8,11,469},{138,11
+,47},{142,11,278},{6,10,83},{6,10,1733},{135,10,1389},{11,11,204},{11,11,243},{
+140,11,293},{135,11,1875},{6,0,1710},{135,0,2038},{137,11,299},{4,0,17},{5,0,23}
+,{7,0,995},{11,0,383},{11,0,437},{12,0,460},{140,0,532},{133,0,862},{137,10,696}
+,{6,0,592},{138,0,946},{138,11,599},{7,10,1718},{9,10,95},{9,10,274},{10,10,279}
+,{10,10,317},{10,10,420},{11,10,303},{11,10,808},{12,10,134},{12,10,367},{13,10,
+149},{13,10,347},{14,10,349},{14,10,406},{18,10,22},{18,10,89},{18,10,122},{147,
+10,47},{8,0,70},{12,0,171},{141,0,272},{133,10,26},{132,10,550},{137,0,812},{10,
+0,233},{139,0,76},{134,0,988},{134,0,442},{136,10,822},{7,0,896},{4,10,902},{5,
+10,809},{134,10,122},{5,11,150},{7,11,106},{8,11,603},{9,11,593},{9,11,634},{10,
+11,44},{10,11,173},{11,11,462},{11,11,515},{13,11,216},{13,11,288},{142,11,400},
+{136,0,483},{135,10,262},{6,0,1709},{133,10,620},{4,10,34},{5,10,574},{7,10,279}
+,{7,10,1624},{136,10,601},{137,10,170},{147,0,119},{12,11,108},{141,11,291},{11,
+0,69},{12,0,105},{12,0,117},{13,0,213},{14,0,13},{14,0,62},{14,0,177},{14,0,421}
+,{15,0,19},{146,0,141},{137,0,309},{11,11,278},{142,11,73},{7,0,608},{7,0,976},{
+9,0,146},{10,0,206},{10,0,596},{13,0,218},{142,0,153},{133,10,332},{6,10,261},{8
+,10,182},{139,10,943},{4,11,493},{144,11,55},{134,10,1721},{132,0,768},{4,10,933
+},{133,10,880},{7,11,555},{7,11,1316},{7,11,1412},{7,11,1839},{9,11,192},{9,11,
+589},{11,11,241},{11,11,676},{11,11,811},{11,11,891},{12,11,140},{12,11,346},{12
+,11,479},{13,11,30},{13,11,49},{13,11,381},{14,11,188},{15,11,150},{16,11,76},{
+18,11,30},{148,11,52},{4,0,518},{135,0,1136},{6,11,568},{7,11,112},{7,11,1804},{
+8,11,362},{8,11,410},{8,11,830},{9,11,514},{11,11,649},{142,11,157},{135,11,673}
+,{8,0,689},{137,0,863},{4,0,18},{7,0,145},{7,0,444},{7,0,1278},{8,0,49},{8,0,400
+},{9,0,71},{9,0,250},{10,0,459},{12,0,160},{16,0,24},{132,11,625},{140,0,1020},{
+4,0,997},{6,0,1946},{6,0,1984},{134,0,1998},{6,11,16},{6,11,158},{7,11,43},{7,11
+,129},{7,11,181},{8,11,276},{8,11,377},{10,11,523},{11,11,816},{12,11,455},{13,
+11,303},{142,11,135},{133,10,812},{134,0,658},{4,11,1},{7,11,1143},{7,11,1463},{
+8,11,61},{9,11,207},{9,11,390},{9,11,467},{139,11,836},{150,11,26},{140,0,106},{
+6,0,1827},{10,0,931},{18,0,166},{20,0,114},{4,10,137},{7,10,1178},{7,11,1319},{
+135,10,1520},{133,0,1010},{4,11,723},{5,11,895},{7,11,1031},{8,11,199},{8,11,340
+},{9,11,153},{9,11,215},{10,11,21},{10,11,59},{10,11,80},{10,11,224},{11,11,229}
+,{11,11,652},{12,11,192},{13,11,146},{142,11,91},{132,11,295},{6,11,619},{7,11,
+898},{7,11,1092},{8,11,485},{18,11,28},{147,11,116},{137,11,51},{6,10,1661},{7,
+10,1975},{7,10,2009},{135,10,2011},{5,11,309},{140,11,211},{5,0,87},{7,0,313},{7
+,0,1103},{10,0,208},{10,0,582},{11,0,389},{11,0,813},{12,0,385},{13,0,286},{14,0
+,124},{146,0,108},{5,11,125},{8,11,77},{138,11,15},{132,0,267},{133,0,703},{137,
+11,155},{133,11,439},{11,11,164},{140,11,76},{9,0,496},{5,10,89},{7,10,1915},{9,
+10,185},{9,10,235},{10,10,64},{10,10,270},{10,10,403},{10,10,469},{10,10,529},{
+10,10,590},{11,10,140},{11,10,860},{13,10,1},{13,10,422},{14,10,341},{14,10,364}
+,{17,10,93},{18,10,113},{19,10,97},{147,10,113},{133,10,695},{135,0,1121},{5,10,
+6},{6,10,183},{7,10,680},{7,10,978},{7,10,1013},{7,10,1055},{12,10,230},{13,10,
+172},{146,10,29},{4,11,8},{7,11,1152},{7,11,1153},{7,11,1715},{9,11,374},{10,11,
+478},{139,11,648},{135,11,1099},{6,10,29},{139,10,63},{4,0,561},{10,0,249},{139,
+0,209},{132,0,760},{7,11,799},{138,11,511},{136,11,87},{9,0,154},{140,0,485},{
+136,0,255},{132,0,323},{140,0,419},{132,10,311},{134,10,1740},{4,0,368},{135,0,
+641},{7,10,170},{8,10,90},{8,10,177},{8,10,415},{11,10,714},{142,10,281},{4,11,
+69},{5,11,122},{9,11,656},{138,11,464},{5,11,849},{134,11,1633},{8,0,522},{142,0
+,328},{11,10,91},{13,10,129},{15,10,101},{145,10,125},{7,0,562},{8,0,551},{4,10,
+494},{6,10,74},{7,10,44},{11,11,499},{12,10,17},{15,10,5},{148,10,11},{4,10,276}
+,{133,10,296},{9,0,92},{147,0,91},{4,10,7},{5,10,90},{5,10,158},{6,10,542},{7,10
+,221},{7,10,1574},{9,10,490},{10,10,540},{11,10,443},{139,10,757},{6,0,525},{6,0
+,1976},{8,0,806},{9,0,876},{140,0,284},{5,11,859},{7,10,588},{7,11,1160},{8,11,
+107},{9,10,175},{9,11,291},{9,11,439},{10,10,530},{10,11,663},{11,11,609},{140,
+11,197},{7,11,168},{13,11,196},{141,11,237},{139,0,958},{133,0,594},{135,10,580}
+,{7,10,88},{136,10,627},{6,0,479},{6,0,562},{7,0,1060},{13,0,6},{5,10,872},{6,10
+,57},{7,10,471},{9,10,447},{137,10,454},{136,11,413},{145,11,19},{4,11,117},{6,
+11,372},{7,11,1905},{142,11,323},{4,11,722},{139,11,471},{17,0,61},{5,10,31},{
+134,10,614},{8,10,330},{140,10,477},{7,10,1200},{138,10,460},{6,10,424},{135,10,
+1866},{6,0,1641},{136,0,820},{6,0,1556},{134,0,1618},{9,11,5},{12,11,216},{12,11
+,294},{12,11,298},{12,11,400},{12,11,518},{13,11,229},{143,11,139},{15,11,155},{
+144,11,79},{4,0,302},{135,0,1766},{5,10,13},{134,10,142},{6,0,148},{7,0,1313},{7
+,10,116},{8,10,322},{8,10,755},{9,10,548},{10,10,714},{11,10,884},{141,10,324},{
+137,0,676},{9,11,88},{139,11,270},{5,11,12},{7,11,375},{137,11,438},{134,0,1674}
+,{7,10,1472},{135,10,1554},{11,0,178},{7,10,1071},{7,10,1541},{7,10,1767},{7,10,
+1806},{11,10,162},{11,10,242},{12,10,605},{15,10,26},{144,10,44},{6,0,389},{7,0,
+149},{9,0,142},{138,0,94},{140,11,71},{145,10,115},{6,0,8},{7,0,1881},{8,0,91},{
+11,11,966},{12,11,287},{13,11,342},{13,11,402},{15,11,110},{143,11,163},{4,11,
+258},{136,11,639},{6,11,22},{7,11,903},{138,11,577},{133,11,681},{135,10,1111},{
+135,11,1286},{9,0,112},{8,10,1},{138,10,326},{5,10,488},{6,10,527},{7,10,489},{7
+,10,1636},{8,10,121},{8,10,144},{8,10,359},{9,10,193},{9,10,241},{9,10,336},{9,
+10,882},{11,10,266},{11,10,372},{11,10,944},{12,10,401},{140,10,641},{4,11,664},
+{133,11,804},{6,0,747},{134,0,1015},{135,0,1746},{9,10,31},{10,10,244},{10,10,
+699},{12,10,149},{141,10,497},{133,10,377},{135,0,24},{6,0,1352},{5,11,32},{145,
+10,101},{7,0,1530},{10,0,158},{13,0,13},{13,0,137},{13,0,258},{14,0,111},{14,0,
+225},{14,0,253},{14,0,304},{14,0,339},{14,0,417},{146,0,33},{4,0,503},{135,0,
+1661},{5,0,130},{6,0,845},{7,0,1314},{9,0,610},{10,0,718},{11,0,601},{11,0,819},
+{11,0,946},{140,0,536},{10,0,149},{11,0,280},{142,0,336},{134,0,1401},{135,0,
+1946},{8,0,663},{144,0,8},{134,0,1607},{135,10,2023},{4,11,289},{7,11,629},{7,11
+,1698},{7,11,1711},{140,11,215},{6,11,450},{136,11,109},{10,0,882},{10,0,883},{
+10,0,914},{138,0,928},{133,10,843},{136,11,705},{132,10,554},{133,10,536},{5,0,
+417},{9,10,79},{11,10,625},{145,10,7},{7,11,1238},{142,11,37},{4,0,392},{135,0,
+1597},{5,0,433},{9,0,633},{11,0,629},{132,10,424},{7,10,336},{136,10,785},{134,
+11,355},{6,0,234},{7,0,769},{9,0,18},{138,0,358},{4,10,896},{134,10,1777},{138,
+11,323},{7,0,140},{7,0,1950},{8,0,680},{11,0,817},{147,0,88},{7,0,1222},{138,0,
+386},{139,11,908},{11,0,249},{12,0,313},{16,0,66},{145,0,26},{134,0,5},{7,10,750
+},{9,10,223},{11,10,27},{11,10,466},{12,10,624},{14,10,265},{146,10,61},{134,11,
+26},{134,0,1216},{5,0,963},{134,0,1773},{4,11,414},{5,11,467},{9,11,654},{10,11,
+451},{12,11,59},{141,11,375},{135,11,17},{4,10,603},{133,10,661},{4,10,11},{6,10
+,128},{7,10,231},{7,10,1533},{138,10,725},{135,11,955},{7,0,180},{8,0,509},{136,
+0,792},{132,10,476},{132,0,1002},{133,11,538},{135,10,1807},{132,0,931},{7,0,943
+},{11,0,614},{140,0,747},{135,0,1837},{9,10,20},{10,10,324},{10,10,807},{139,10,
+488},{134,0,641},{6,11,280},{10,11,502},{11,11,344},{140,11,38},{5,11,45},{7,11,
+1161},{11,11,448},{11,11,880},{13,11,139},{13,11,407},{15,11,16},{17,11,95},{18,
+11,66},{18,11,88},{18,11,123},{149,11,7},{9,0,280},{138,0,134},{22,0,22},{23,0,5
+},{151,0,29},{136,11,777},{4,0,90},{5,0,545},{7,0,754},{9,0,186},{10,0,72},{10,0
+,782},{11,0,577},{11,0,610},{11,0,960},{12,0,354},{12,0,362},{12,0,595},{4,11,
+410},{135,11,521},{135,11,1778},{5,10,112},{6,10,103},{134,10,150},{138,10,356},
+{132,0,742},{7,0,151},{9,0,329},{139,0,254},{8,0,853},{8,0,881},{8,0,911},{8,0,
+912},{10,0,872},{12,0,741},{12,0,742},{152,0,18},{4,11,573},{136,11,655},{6,0,
+921},{134,0,934},{9,0,187},{10,0,36},{11,0,1016},{17,0,44},{146,0,64},{7,0,833},
+{136,0,517},{4,0,506},{5,0,295},{135,0,1680},{4,10,708},{8,10,15},{9,10,50},{9,
+10,386},{11,10,18},{11,10,529},{140,10,228},{7,0,251},{7,0,1701},{8,0,436},{4,10
+,563},{7,10,592},{7,10,637},{7,10,770},{8,10,463},{9,10,60},{9,10,335},{9,10,904
+},{10,10,73},{11,10,434},{12,10,585},{13,10,331},{18,10,110},{148,10,60},{132,10
+,502},{136,0,584},{6,10,347},{138,10,161},{7,0,987},{9,0,688},{10,0,522},{11,0,
+788},{12,0,137},{12,0,566},{14,0,9},{14,0,24},{14,0,64},{7,11,899},{142,11,325},
+{4,0,214},{5,0,500},{5,10,102},{6,10,284},{7,10,1079},{7,10,1423},{7,10,1702},{8
+,10,470},{9,10,554},{9,10,723},{139,10,333},{7,10,246},{135,10,840},{6,10,10},{8
+,10,571},{9,10,739},{143,10,91},{133,10,626},{146,0,195},{134,0,1775},{7,0,389},
+{7,0,700},{7,0,940},{8,0,514},{9,0,116},{9,0,535},{10,0,118},{11,0,107},{11,0,
+148},{11,0,922},{12,0,254},{12,0,421},{142,0,238},{5,10,18},{6,10,526},{13,10,24
+},{13,10,110},{19,10,5},{147,10,44},{132,0,743},{11,0,292},{4,10,309},{5,10,462}
+,{7,10,970},{135,10,1097},{22,10,30},{150,10,33},{139,11,338},{135,11,1598},{7,0
+,1283},{9,0,227},{11,0,325},{11,0,408},{14,0,180},{146,0,47},{4,0,953},{6,0,1805
+},{6,0,1814},{6,0,1862},{140,0,774},{6,11,611},{135,11,1733},{135,11,1464},{5,0,
+81},{7,0,146},{7,0,1342},{8,0,53},{8,0,561},{8,0,694},{8,0,754},{9,0,115},{9,0,
+179},{9,0,894},{10,0,462},{10,0,813},{11,0,230},{11,0,657},{11,0,699},{11,0,748}
+,{12,0,119},{12,0,200},{12,0,283},{142,0,273},{5,0,408},{6,0,789},{6,0,877},{6,0
+,1253},{6,0,1413},{137,0,747},{134,10,1704},{135,11,663},{6,0,1910},{6,0,1915},{
+6,0,1923},{9,0,913},{9,0,928},{9,0,950},{9,0,954},{9,0,978},{9,0,993},{12,0,812}
+,{12,0,819},{12,0,831},{12,0,833},{12,0,838},{12,0,909},{12,0,928},{12,0,931},{
+12,0,950},{15,0,186},{15,0,187},{15,0,195},{15,0,196},{15,0,209},{15,0,215},{15,
+0,236},{15,0,241},{15,0,249},{15,0,253},{18,0,180},{18,0,221},{18,0,224},{18,0,
+227},{18,0,229},{149,0,60},{7,0,1826},{135,0,1938},{11,0,490},{18,0,143},{5,10,
+86},{7,10,743},{9,10,85},{10,10,281},{10,10,432},{12,10,251},{13,10,118},{142,10
+,378},{5,10,524},{133,10,744},{141,11,442},{10,10,107},{140,10,436},{135,11,503}
+,{134,0,1162},{132,10,927},{7,0,30},{8,0,86},{8,0,315},{8,0,700},{9,0,576},{9,0,
+858},{10,0,414},{11,0,310},{11,0,888},{11,0,904},{12,0,361},{13,0,248},{13,0,371
+},{14,0,142},{12,10,670},{146,10,94},{134,0,721},{4,11,113},{5,11,163},{5,11,735
+},{7,11,1009},{7,10,1149},{9,11,9},{9,10,156},{9,11,771},{12,11,90},{13,11,138},
+{13,11,410},{143,11,128},{138,0,839},{133,10,778},{137,0,617},{133,10,502},{8,10
+,196},{10,10,283},{139,10,406},{6,0,428},{7,0,524},{8,0,169},{8,0,234},{9,0,480}
+,{138,0,646},{133,10,855},{134,0,1648},{7,0,1205},{138,0,637},{7,0,1596},{4,11,
+935},{133,11,823},{5,11,269},{7,11,434},{7,11,891},{8,11,339},{9,11,702},{11,11,
+594},{11,11,718},{145,11,100},{7,11,878},{9,11,485},{141,11,264},{4,0,266},{8,0,
+4},{9,0,39},{10,0,166},{11,0,918},{12,0,635},{20,0,10},{22,0,27},{22,0,43},{22,0
+,52},{134,11,1713},{7,10,1400},{9,10,446},{138,10,45},{135,11,900},{132,0,862},{
+134,0,1554},{135,11,1033},{19,0,16},{147,11,16},{135,11,1208},{7,0,157},{136,0,
+279},{6,0,604},{136,0,391},{13,10,455},{15,10,99},{15,10,129},{144,10,68},{135,
+10,172},{7,0,945},{11,0,713},{139,0,744},{4,0,973},{10,0,877},{10,0,937},{10,0,
+938},{140,0,711},{139,0,1022},{132,10,568},{142,11,143},{4,0,567},{9,0,859},{132
+,10,732},{7,0,1846},{136,0,628},{136,10,733},{133,0,762},{4,10,428},{135,10,1789
+},{10,0,784},{13,0,191},{7,10,2015},{140,10,665},{133,0,298},{7,0,633},{7,0,905}
+,{7,0,909},{7,0,1538},{9,0,767},{140,0,636},{138,10,806},{132,0,795},{139,0,301}
+,{135,0,1970},{5,11,625},{135,11,1617},{135,11,275},{7,11,37},{8,11,425},{8,11,
+693},{9,11,720},{10,11,380},{10,11,638},{11,11,273},{11,11,307},{11,11,473},{12,
+11,61},{143,11,43},{135,11,198},{134,0,1236},{7,0,369},{12,0,644},{12,0,645},{
+144,0,90},{19,0,15},{149,0,27},{6,0,71},{7,0,845},{8,0,160},{9,0,318},{6,10,1623
+},{134,10,1681},{134,0,1447},{134,0,1255},{138,0,735},{8,0,76},{132,11,168},{6,
+10,1748},{8,10,715},{9,10,802},{10,10,46},{10,10,819},{13,10,308},{14,10,351},{
+14,10,363},{146,10,67},{135,11,91},{6,0,474},{4,10,63},{133,10,347},{133,10,749}
+,{138,0,841},{133,10,366},{6,0,836},{132,11,225},{135,0,1622},{135,10,89},{140,0
+,735},{134,0,1601},{138,11,145},{6,0,1390},{137,0,804},{142,0,394},{6,11,15},{7,
+11,70},{10,11,240},{147,11,93},{6,0,96},{135,0,1426},{4,0,651},{133,0,289},{7,11
+,956},{7,10,977},{7,11,1157},{7,11,1506},{7,11,1606},{7,11,1615},{7,11,1619},{7,
+11,1736},{7,11,1775},{8,11,590},{9,11,324},{9,11,736},{9,11,774},{9,11,776},{9,
+11,784},{10,11,567},{10,11,708},{11,11,518},{11,11,613},{11,11,695},{11,11,716},
+{11,11,739},{11,11,770},{11,11,771},{11,11,848},{11,11,857},{11,11,931},{11,11,
+947},{12,11,326},{12,11,387},{12,11,484},{12,11,528},{12,11,552},{12,11,613},{13
+,11,189},{13,11,256},{13,11,340},{13,11,432},{13,11,436},{13,11,440},{13,11,454}
+,{14,11,174},{14,11,220},{14,11,284},{14,11,390},{145,11,121},{7,0,688},{8,0,35}
+,{9,0,511},{10,0,767},{147,0,118},{134,0,667},{4,0,513},{5,10,824},{133,10,941},
+{7,10,440},{8,10,230},{139,10,106},{134,0,2034},{135,11,1399},{143,11,66},{135,
+11,1529},{4,11,145},{6,11,176},{7,11,395},{9,11,562},{144,11,28},{132,11,501},{
+132,0,704},{134,0,1524},{7,0,1078},{134,11,464},{6,11,509},{10,11,82},{20,11,91}
+,{151,11,13},{4,0,720},{133,0,306},{133,0,431},{7,0,1196},{4,10,914},{5,10,800},
+{133,10,852},{135,11,1189},{10,0,54},{141,10,115},{7,10,564},{142,10,168},{5,0,
+464},{6,0,236},{7,0,696},{7,0,914},{7,0,1108},{7,0,1448},{9,0,15},{9,0,564},{10,
+0,14},{12,0,565},{13,0,449},{14,0,53},{15,0,13},{16,0,64},{17,0,41},{4,10,918},{
+133,10,876},{6,0,1418},{134,10,1764},{4,10,92},{133,10,274},{134,0,907},{4,11,
+114},{8,10,501},{9,11,492},{13,11,462},{142,11,215},{4,11,77},{5,11,361},{6,11,
+139},{6,11,401},{6,11,404},{7,11,413},{7,11,715},{7,11,1716},{11,11,279},{12,11,
+179},{12,11,258},{13,11,244},{142,11,358},{6,0,1767},{12,0,194},{145,0,107},{134
+,11,1717},{5,10,743},{142,11,329},{4,10,49},{7,10,280},{135,10,1633},{5,0,840},{
+7,11,1061},{8,11,82},{11,11,250},{12,11,420},{141,11,184},{135,11,724},{134,0,
+900},{136,10,47},{134,0,1436},{144,11,0},{6,0,675},{7,0,1008},{7,0,1560},{9,0,
+642},{11,0,236},{14,0,193},{5,10,272},{5,10,908},{5,10,942},{8,10,197},{9,10,47}
+,{11,10,538},{139,10,742},{4,0,68},{5,0,628},{5,0,634},{6,0,386},{7,0,794},{8,0,
+273},{9,0,563},{10,0,105},{10,0,171},{11,0,94},{139,0,354},{135,10,1911},{137,10
+,891},{4,0,95},{6,0,1297},{6,0,1604},{7,0,416},{139,0,830},{6,11,513},{135,11,
+1052},{7,0,731},{13,0,20},{143,0,11},{137,11,899},{10,0,850},{140,0,697},{4,0,
+662},{7,11,1417},{12,11,382},{17,11,48},{152,11,12},{133,0,736},{132,0,861},{4,
+10,407},{132,10,560},{141,10,490},{6,11,545},{7,11,565},{7,11,1669},{10,11,114},
+{11,11,642},{140,11,618},{6,0,871},{134,0,1000},{5,0,864},{10,0,648},{11,0,671},
+{15,0,46},{133,11,5},{133,0,928},{11,0,90},{13,0,7},{4,10,475},{11,10,35},{13,10
+,71},{13,10,177},{142,10,422},{136,0,332},{135,11,192},{134,0,1055},{136,11,763}
+,{11,0,986},{140,0,682},{7,0,76},{8,0,44},{9,0,884},{10,0,580},{11,0,399},{11,0,
+894},{143,0,122},{135,11,1237},{135,10,636},{11,0,300},{6,10,222},{7,10,1620},{8
+,10,409},{137,10,693},{4,11,87},{5,11,250},{10,11,601},{13,11,298},{13,11,353},{
+141,11,376},{5,0,518},{10,0,340},{11,0,175},{149,0,16},{140,0,771},{6,0,1108},{
+137,0,831},{132,0,836},{135,0,1852},{4,0,957},{6,0,1804},{8,0,842},{8,0,843},{8,
+0,851},{8,0,855},{140,0,767},{135,11,814},{4,11,57},{7,11,1195},{7,11,1438},{7,
+11,1548},{7,11,1835},{7,11,1904},{9,11,757},{10,11,604},{139,11,519},{133,10,882
+},{138,0,246},{4,0,934},{5,0,202},{8,0,610},{7,11,1897},{12,11,290},{13,11,80},{
+13,11,437},{145,11,74},{8,0,96},{9,0,36},{10,0,607},{10,0,804},{10,0,832},{11,0,
+423},{11,0,442},{12,0,309},{14,0,199},{15,0,90},{145,0,110},{132,10,426},{7,0,
+654},{8,0,240},{6,10,58},{7,10,745},{7,10,1969},{8,10,675},{9,10,479},{9,10,731}
+,{10,10,330},{10,10,593},{10,10,817},{11,10,32},{11,10,133},{11,10,221},{145,10,
+68},{9,0,13},{9,0,398},{9,0,727},{10,0,75},{10,0,184},{10,0,230},{10,0,564},{10,
+0,569},{11,0,973},{12,0,70},{12,0,189},{13,0,57},{141,0,257},{4,11,209},{135,11,
+902},{7,0,391},{137,10,538},{134,0,403},{6,11,303},{7,11,335},{7,11,1437},{7,11,
+1668},{8,11,553},{8,11,652},{8,11,656},{9,11,558},{11,11,743},{149,11,18},{132,
+11,559},{11,0,75},{142,0,267},{6,0,815},{141,11,2},{141,0,366},{137,0,631},{133,
+11,1017},{5,0,345},{135,0,1016},{133,11,709},{134,11,1745},{133,10,566},{7,0,952
+},{6,10,48},{9,10,139},{10,10,399},{11,10,469},{12,10,634},{141,10,223},{133,0,
+673},{9,0,850},{7,11,8},{136,11,206},{6,0,662},{149,0,35},{4,0,287},{133,0,1018}
+,{6,10,114},{7,10,1224},{7,10,1556},{136,10,3},{8,10,576},{137,10,267},{4,0,884}
+,{5,0,34},{10,0,724},{12,0,444},{13,0,354},{18,0,32},{23,0,24},{23,0,31},{152,0,
+5},{133,10,933},{132,11,776},{138,0,151},{136,0,427},{134,0,382},{132,0,329},{9,
+0,846},{10,0,827},{138,11,33},{9,0,279},{10,0,407},{14,0,84},{22,0,18},{135,11,
+1297},{136,11,406},{132,0,906},{136,0,366},{134,0,843},{134,0,1443},{135,0,1372}
+,{138,0,992},{4,0,123},{5,0,605},{7,0,1509},{136,0,36},{132,0,649},{8,11,175},{
+10,11,168},{138,11,573},{133,0,767},{134,0,1018},{135,11,1305},{12,10,30},{13,10
+,148},{14,10,87},{14,10,182},{16,10,42},{148,10,70},{134,11,607},{4,0,273},{5,0,
+658},{133,0,995},{6,0,72},{139,11,174},{10,0,483},{12,0,368},{7,10,56},{7,10,
+1989},{8,10,337},{8,10,738},{9,10,600},{13,10,447},{142,10,92},{5,11,784},{138,
+10,666},{135,0,1345},{139,11,882},{134,0,1293},{133,0,589},{134,0,1988},{5,0,117
+},{6,0,514},{6,0,541},{7,0,1164},{7,0,1436},{8,0,220},{8,0,648},{10,0,688},{139,
+0,560},{136,0,379},{5,0,686},{7,10,866},{135,10,1163},{132,10,328},{9,11,14},{9,
+11,441},{10,11,306},{139,11,9},{4,10,101},{135,10,1171},{5,10,833},{136,10,744},
+{5,11,161},{7,11,839},{135,11,887},{7,0,196},{10,0,765},{11,0,347},{11,0,552},{
+11,0,790},{12,0,263},{13,0,246},{13,0,270},{13,0,395},{14,0,176},{14,0,190},{14,
+0,398},{14,0,412},{15,0,32},{15,0,63},{16,0,88},{147,0,105},{6,10,9},{6,10,397},
+{7,10,53},{7,10,1742},{10,10,632},{11,10,828},{140,10,146},{5,0,381},{135,0,1792
+},{134,0,1452},{135,11,429},{8,0,367},{10,0,760},{14,0,79},{20,0,17},{152,0,0},{
+7,0,616},{138,0,413},{11,10,417},{12,10,223},{140,10,265},{7,11,1611},{13,11,14}
+,{15,11,44},{19,11,13},{148,11,76},{135,0,1229},{6,0,120},{7,0,1188},{7,0,1710},
+{8,0,286},{9,0,667},{11,0,592},{139,0,730},{135,11,1814},{135,0,1146},{4,10,186}
+,{5,10,157},{8,10,168},{138,10,6},{4,0,352},{135,0,687},{4,0,192},{5,0,49},{6,0,
+200},{6,0,293},{6,0,1696},{135,0,1151},{133,10,875},{5,10,773},{5,10,991},{6,10,
+1635},{134,10,1788},{7,10,111},{136,10,581},{6,0,935},{134,0,1151},{134,0,1050},
+{132,0,650},{132,0,147},{11,0,194},{12,0,62},{12,0,88},{11,11,194},{12,11,62},{
+140,11,88},{6,0,339},{135,0,923},{134,10,1747},{7,11,643},{136,11,236},{133,0,
+934},{7,10,1364},{7,10,1907},{141,10,158},{132,10,659},{4,10,404},{135,10,675},{
+7,11,581},{9,11,644},{137,11,699},{13,0,211},{14,0,133},{14,0,204},{15,0,64},{15
+,0,69},{15,0,114},{16,0,10},{19,0,23},{19,0,35},{19,0,39},{19,0,51},{19,0,71},{
+19,0,75},{152,0,15},{133,10,391},{5,11,54},{135,11,1513},{7,0,222},{8,0,341},{5,
+10,540},{134,10,1697},{134,10,78},{132,11,744},{136,0,293},{137,11,701},{7,11,
+930},{10,11,402},{10,11,476},{13,11,452},{18,11,55},{147,11,104},{132,0,637},{
+133,10,460},{8,11,50},{137,11,624},{132,11,572},{134,0,1159},{4,10,199},{139,10,
+34},{134,0,847},{134,10,388},{6,11,43},{7,11,38},{8,11,248},{9,11,504},{138,11,
+513},{9,0,683},{4,10,511},{6,10,608},{9,10,333},{10,10,602},{11,10,441},{11,10,
+723},{11,10,976},{140,10,357},{9,0,867},{138,0,837},{6,0,944},{135,11,326},{135,
+0,1809},{5,10,938},{7,11,783},{136,10,707},{133,11,766},{133,11,363},{6,0,170},{
+7,0,1080},{8,0,395},{8,0,487},{141,0,147},{6,11,258},{140,11,409},{4,0,535},{8,0
+,618},{5,11,249},{148,11,82},{6,0,1379},{149,11,15},{135,0,1625},{150,0,23},{5,
+11,393},{6,11,378},{7,11,1981},{9,11,32},{9,11,591},{10,11,685},{10,11,741},{142
+,11,382},{133,11,788},{7,11,1968},{10,11,19},{139,11,911},{7,11,1401},{135,11,
+1476},{4,11,61},{5,11,58},{5,11,171},{5,11,635},{5,11,683},{5,11,700},{6,11,291}
+,{6,11,566},{7,11,1650},{11,11,523},{12,11,273},{12,11,303},{15,11,39},{143,11,
+111},{6,10,469},{7,10,1709},{138,10,515},{4,0,778},{134,11,589},{132,0,46},{5,0,
+811},{6,0,1679},{6,0,1714},{135,0,2032},{7,0,1458},{9,0,407},{11,0,15},{12,0,651
+},{149,0,37},{7,0,938},{132,10,500},{6,0,34},{7,0,69},{7,0,1089},{7,0,1281},{8,0
+,708},{8,0,721},{9,0,363},{148,0,98},{10,11,231},{147,11,124},{7,11,726},{152,11
+,9},{5,10,68},{134,10,383},{136,11,583},{4,11,917},{133,11,1005},{11,10,216},{
+139,10,340},{135,11,1675},{8,0,441},{10,0,314},{143,0,3},{132,11,919},{4,10,337}
+,{6,10,353},{7,10,1934},{8,10,488},{137,10,429},{7,0,889},{7,10,1795},{8,10,259}
+,{9,10,135},{9,10,177},{9,10,860},{10,10,825},{11,10,115},{11,10,370},{11,10,405
+},{11,10,604},{12,10,10},{12,10,667},{12,10,669},{13,10,76},{14,10,310},{15,10,
+76},{15,10,147},{148,10,23},{4,10,15},{4,11,255},{5,10,22},{5,11,302},{6,11,132}
+,{6,10,244},{7,10,40},{7,11,128},{7,10,200},{7,11,283},{7,10,906},{7,10,1199},{7
+,11,1299},{9,10,616},{10,11,52},{10,11,514},{10,10,716},{11,10,635},{11,10,801},
+{11,11,925},{12,10,458},{13,11,92},{142,11,309},{132,0,462},{137,11,173},{135,10
+,1735},{8,0,525},{5,10,598},{7,10,791},{8,10,108},{137,10,123},{5,0,73},{6,0,23}
+,{134,0,338},{132,0,676},{132,10,683},{7,0,725},{8,0,498},{139,0,268},{12,0,21},
+{151,0,7},{135,0,773},{4,10,155},{135,10,1689},{4,0,164},{5,0,730},{5,10,151},{5
+,10,741},{6,11,210},{7,10,498},{7,10,870},{7,10,1542},{12,10,213},{14,10,36},{14
+,10,391},{17,10,111},{18,10,6},{18,10,46},{18,10,151},{19,10,36},{20,10,32},{20,
+10,56},{20,10,69},{20,10,102},{21,10,4},{22,10,8},{22,10,10},{22,10,14},{150,10,
+31},{4,10,624},{135,10,1752},{4,0,583},{9,0,936},{15,0,214},{18,0,199},{24,0,26}
+,{134,11,588},{7,0,1462},{11,0,659},{4,11,284},{134,11,223},{133,0,220},{139,0,
+803},{132,0,544},{4,10,492},{133,10,451},{16,0,98},{148,0,119},{4,11,218},{7,11,
+526},{143,11,137},{135,10,835},{4,11,270},{5,11,192},{6,11,332},{7,11,1322},{13,
+11,9},{13,10,70},{14,11,104},{142,11,311},{132,10,539},{140,11,661},{5,0,176},{6
+,0,437},{6,0,564},{11,0,181},{141,0,183},{135,0,1192},{6,10,113},{135,10,436},{
+136,10,718},{135,10,520},{135,0,1878},{140,11,196},{7,11,379},{8,11,481},{137,11
+,377},{5,11,1003},{6,11,149},{137,11,746},{8,11,262},{9,11,627},{10,11,18},{11,
+11,214},{11,11,404},{11,11,457},{11,11,780},{11,11,849},{11,11,913},{13,11,330},
+{13,11,401},{142,11,200},{149,0,26},{136,11,304},{132,11,142},{135,0,944},{4,0,
+790},{5,0,273},{134,0,394},{134,0,855},{4,0,135},{6,0,127},{7,0,1185},{7,0,1511}
+,{8,0,613},{11,0,5},{12,0,336},{12,0,495},{12,0,586},{12,0,660},{12,0,668},{14,0
+,385},{15,0,118},{17,0,20},{146,0,98},{6,0,230},{9,0,752},{18,0,109},{12,10,610}
+,{13,10,431},{144,10,59},{7,0,1954},{135,11,925},{4,11,471},{5,11,51},{6,11,602}
+,{8,11,484},{10,11,195},{140,11,159},{132,10,307},{136,11,688},{132,11,697},{7,
+11,812},{7,11,1261},{7,11,1360},{9,11,632},{140,11,352},{5,0,162},{8,0,68},{133,
+10,964},{4,0,654},{136,11,212},{4,0,156},{7,0,998},{7,0,1045},{7,0,1860},{9,0,48
+},{9,0,692},{11,0,419},{139,0,602},{133,11,221},{4,11,373},{5,11,283},{6,11,480}
+,{135,11,609},{142,11,216},{132,0,240},{6,11,192},{9,11,793},{145,11,55},{4,10,
+75},{5,10,180},{6,10,500},{7,10,58},{7,10,710},{138,10,645},{4,11,132},{5,11,69}
+,{5,10,649},{135,11,1242},{6,10,276},{7,10,282},{7,10,879},{7,10,924},{8,10,459}
+,{9,10,599},{9,10,754},{11,10,574},{12,10,128},{12,10,494},{13,10,52},{13,10,301
+},{15,10,30},{143,10,132},{132,10,200},{4,11,111},{135,11,302},{9,0,197},{10,0,
+300},{12,0,473},{13,0,90},{141,0,405},{132,11,767},{6,11,42},{7,11,1416},{7,11,
+1590},{7,11,2005},{8,11,131},{8,11,466},{9,11,672},{13,11,252},{148,11,103},{8,0
+,958},{8,0,999},{10,0,963},{138,0,1001},{135,10,1621},{135,0,858},{4,0,606},{137
+,11,444},{6,11,44},{136,11,368},{139,11,172},{4,11,570},{133,11,120},{139,11,624
+},{7,0,1978},{8,0,676},{6,10,225},{137,10,211},{7,0,972},{11,0,102},{136,10,687}
+,{6,11,227},{135,11,1589},{8,10,58},{9,10,724},{11,10,809},{13,10,113},{145,10,
+72},{4,0,361},{133,0,315},{132,0,461},{6,10,345},{135,10,1247},{132,0,472},{8,10
+,767},{8,10,803},{9,10,301},{137,10,903},{135,11,1333},{135,11,477},{7,10,1949},
+{136,10,674},{6,0,905},{138,0,747},{133,0,155},{134,10,259},{7,0,163},{8,0,319},
+{9,0,402},{10,0,24},{10,0,681},{11,0,200},{12,0,253},{12,0,410},{142,0,219},{5,0
+,475},{7,0,1780},{9,0,230},{11,0,297},{11,0,558},{14,0,322},{19,0,76},{6,11,1667
+},{7,11,2036},{138,11,600},{136,10,254},{6,0,848},{135,0,1956},{6,11,511},{140,
+11,132},{5,11,568},{6,11,138},{135,11,1293},{6,0,631},{137,0,838},{149,0,36},{4,
+11,565},{8,11,23},{136,11,827},{5,0,944},{134,0,1769},{4,0,144},{6,0,842},{6,0,
+1400},{4,11,922},{133,11,1023},{133,10,248},{9,10,800},{10,10,693},{11,10,482},{
+11,10,734},{139,10,789},{7,11,1002},{139,11,145},{4,10,116},{5,10,95},{5,10,445}
+,{7,10,1688},{8,10,29},{9,10,272},{11,10,509},{139,10,915},{14,0,369},{146,0,72}
+,{135,10,1641},{132,11,740},{133,10,543},{140,11,116},{6,0,247},{9,0,555},{5,10,
+181},{136,10,41},{133,10,657},{136,0,996},{138,10,709},{7,0,189},{8,10,202},{138
+,10,536},{136,11,402},{4,11,716},{141,11,31},{10,0,280},{138,0,797},{9,10,423},{
+140,10,89},{8,10,113},{9,10,877},{10,10,554},{11,10,83},{12,10,136},{147,10,109}
+,{133,10,976},{7,0,746},{132,10,206},{136,0,526},{139,0,345},{136,0,1017},{8,11,
+152},{9,11,53},{9,11,268},{9,11,901},{10,11,518},{10,11,829},{11,11,188},{13,11,
+74},{14,11,46},{15,11,17},{15,11,33},{17,11,40},{18,11,36},{19,11,20},{22,11,1},
+{152,11,2},{133,11,736},{136,11,532},{5,0,428},{138,0,651},{135,11,681},{135,0,
+1162},{7,0,327},{13,0,230},{17,0,113},{8,10,226},{10,10,537},{11,10,570},{11,10,
+605},{11,10,799},{11,10,804},{12,10,85},{12,10,516},{12,10,623},{12,11,677},{13,
+10,361},{14,10,77},{14,10,78},{147,10,110},{4,0,792},{7,0,1717},{10,0,546},{132,
+10,769},{4,11,684},{136,11,384},{132,10,551},{134,0,1203},{9,10,57},{9,10,459},{
+10,10,425},{11,10,119},{12,10,184},{12,10,371},{13,10,358},{145,10,51},{5,0,672}
+,{5,10,814},{8,10,10},{9,10,421},{9,10,729},{10,10,609},{139,10,689},{138,0,189}
+,{134,10,624},{7,11,110},{7,11,188},{8,11,290},{8,11,591},{9,11,382},{9,11,649},
+{11,11,71},{11,11,155},{11,11,313},{12,11,5},{13,11,325},{142,11,287},{133,0,99}
+,{6,0,1053},{135,0,298},{7,11,360},{7,11,425},{9,11,66},{9,11,278},{138,11,644},
+{4,0,397},{136,0,555},{137,10,269},{132,10,528},{4,11,900},{133,11,861},{6,0,
+1157},{5,11,254},{7,11,985},{136,11,73},{7,11,1959},{136,11,683},{12,0,398},{20,
+0,39},{21,0,11},{150,0,41},{4,0,485},{7,0,353},{135,0,1523},{6,0,366},{7,0,1384}
+,{135,0,1601},{138,0,787},{137,0,282},{5,10,104},{6,10,173},{135,10,1631},{139,
+11,146},{4,0,157},{133,0,471},{134,0,941},{132,11,725},{7,0,1336},{8,10,138},{8,
+10,342},{9,10,84},{10,10,193},{11,10,883},{140,10,359},{134,11,196},{136,0,116},
+{133,11,831},{134,0,787},{134,10,95},{6,10,406},{10,10,409},{10,10,447},{11,10,
+44},{140,10,100},{5,0,160},{7,0,363},{7,0,589},{10,0,170},{141,0,55},{134,0,1815
+},{132,0,866},{6,0,889},{6,0,1067},{6,0,1183},{4,11,321},{134,11,569},{5,11,848}
+,{134,11,66},{4,11,36},{6,10,1636},{7,11,1387},{10,11,205},{11,11,755},{141,11,
+271},{132,0,689},{9,0,820},{4,10,282},{7,10,1034},{11,10,398},{11,10,634},{12,10
+,1},{12,10,79},{12,10,544},{14,10,237},{17,10,10},{146,10,20},{4,0,108},{7,0,804
+},{139,0,498},{132,11,887},{6,0,1119},{135,11,620},{6,11,165},{138,11,388},{5,0,
+244},{5,10,499},{6,10,476},{7,10,600},{7,10,888},{135,10,1096},{140,0,609},{135,
+0,1005},{4,0,412},{133,0,581},{4,11,719},{135,11,155},{7,10,296},{7,10,596},{8,
+10,560},{8,10,586},{9,10,612},{11,10,304},{12,10,46},{13,10,89},{14,10,112},{145
+,10,122},{4,0,895},{133,0,772},{142,11,307},{135,0,1898},{4,0,926},{133,0,983},{
+4,11,353},{6,11,146},{6,11,1789},{7,11,288},{7,11,990},{7,11,1348},{9,11,665},{9
+,11,898},{11,11,893},{142,11,212},{132,0,538},{133,11,532},{6,0,294},{7,0,1267},
+{8,0,624},{141,0,496},{7,0,1325},{4,11,45},{135,11,1257},{138,0,301},{9,0,298},{
+12,0,291},{13,0,276},{14,0,6},{17,0,18},{21,0,32},{7,10,1599},{7,10,1723},{8,10,
+79},{8,10,106},{8,10,190},{8,10,302},{8,10,383},{8,10,713},{9,10,119},{9,10,233}
+,{9,10,419},{9,10,471},{10,10,181},{10,10,406},{11,10,57},{11,10,85},{11,10,120}
+,{11,10,177},{11,10,296},{11,10,382},{11,10,454},{11,10,758},{11,10,999},{12,10,
+27},{12,10,131},{12,10,245},{12,10,312},{12,10,446},{12,10,454},{13,10,98},{13,
+10,426},{13,10,508},{14,10,163},{14,10,272},{14,10,277},{14,10,370},{15,10,95},{
+15,10,138},{15,10,167},{17,10,38},{148,10,96},{132,0,757},{134,0,1263},{4,0,820}
+,{134,10,1759},{133,0,722},{136,11,816},{138,10,372},{145,10,16},{134,0,1039},{4
+,0,991},{134,0,2028},{133,10,258},{7,0,1875},{139,0,124},{6,11,559},{6,11,1691},
+{135,11,586},{5,0,324},{7,0,881},{8,10,134},{9,10,788},{140,10,438},{7,11,1823},
+{139,11,693},{6,0,1348},{134,0,1545},{134,0,911},{132,0,954},{8,0,329},{8,0,414}
+,{7,10,1948},{135,10,2004},{5,0,517},{6,10,439},{7,10,780},{135,10,1040},{132,0,
+816},{5,10,1},{6,10,81},{138,10,520},{9,0,713},{10,0,222},{5,10,482},{8,10,98},{
+10,10,700},{10,10,822},{11,10,302},{11,10,778},{12,10,50},{12,10,127},{12,10,396
+},{13,10,62},{13,10,328},{14,10,122},{147,10,72},{137,0,33},{5,10,2},{7,10,1494}
+,{136,10,589},{6,10,512},{7,10,797},{8,10,253},{9,10,77},{10,10,1},{10,11,108},{
+10,10,129},{10,10,225},{11,11,116},{11,10,118},{11,10,226},{11,10,251},{11,10,
+430},{11,10,701},{11,10,974},{11,10,982},{12,10,64},{12,10,260},{12,10,488},{140
+,10,690},{134,11,456},{133,11,925},{5,0,150},{7,0,106},{7,0,774},{8,0,603},{9,0,
+593},{9,0,634},{10,0,44},{10,0,173},{11,0,462},{11,0,515},{13,0,216},{13,0,288},
+{142,0,400},{137,10,347},{5,0,748},{134,0,553},{12,0,108},{141,0,291},{7,0,420},
+{4,10,12},{7,10,522},{7,10,809},{8,10,797},{141,10,88},{6,11,193},{7,11,240},{7,
+11,1682},{10,11,51},{10,11,640},{11,11,410},{13,11,82},{14,11,247},{14,11,331},{
+142,11,377},{133,10,528},{135,0,1777},{4,0,493},{144,0,55},{136,11,633},{139,0,
+81},{6,0,980},{136,0,321},{148,10,109},{5,10,266},{9,10,290},{9,10,364},{10,10,
+293},{11,10,606},{142,10,45},{6,0,568},{7,0,112},{7,0,1804},{8,0,362},{8,0,410},
+{8,0,830},{9,0,514},{11,0,649},{142,0,157},{4,0,74},{6,0,510},{6,10,594},{9,10,
+121},{10,10,49},{10,10,412},{139,10,834},{134,0,838},{136,10,748},{132,10,466},{
+132,0,625},{135,11,1443},{4,11,237},{135,11,514},{9,10,378},{141,10,162},{6,0,16
+},{6,0,158},{7,0,43},{7,0,129},{7,0,181},{8,0,276},{8,0,377},{10,0,523},{11,0,
+816},{12,0,455},{13,0,303},{142,0,135},{135,0,281},{4,0,1},{7,0,1143},{7,0,1463}
+,{8,0,61},{9,0,207},{9,0,390},{9,0,467},{139,0,836},{6,11,392},{7,11,65},{135,11
+,2019},{132,10,667},{4,0,723},{5,0,895},{7,0,1031},{8,0,199},{8,0,340},{9,0,153}
+,{9,0,215},{10,0,21},{10,0,59},{10,0,80},{10,0,224},{10,0,838},{11,0,229},{11,0,
+652},{12,0,192},{13,0,146},{142,0,91},{132,0,295},{137,0,51},{9,11,222},{10,11,
+43},{139,11,900},{5,0,309},{140,0,211},{5,0,125},{8,0,77},{138,0,15},{136,11,604
+},{138,0,789},{5,0,173},{4,10,39},{7,10,1843},{8,10,407},{11,10,144},{140,10,523
+},{138,11,265},{133,0,439},{132,10,510},{7,0,648},{7,0,874},{11,0,164},{12,0,76}
+,{18,0,9},{7,10,1980},{10,10,487},{138,10,809},{12,0,111},{14,0,294},{19,0,45},{
+13,10,260},{146,10,63},{133,11,549},{134,10,570},{4,0,8},{7,0,1152},{7,0,1153},{
+7,0,1715},{9,0,374},{10,0,478},{139,0,648},{135,0,1099},{5,0,575},{6,0,354},{135
+,0,701},{7,11,36},{8,11,201},{136,11,605},{4,10,787},{136,11,156},{6,0,518},{149
+,11,13},{140,11,224},{134,0,702},{132,10,516},{5,11,724},{10,11,305},{11,11,151}
+,{12,11,33},{12,11,121},{12,11,381},{17,11,3},{17,11,27},{17,11,78},{18,11,18},{
+19,11,54},{149,11,5},{8,0,87},{4,11,523},{5,11,638},{11,10,887},{14,10,365},{142
+,10,375},{138,0,438},{136,10,821},{135,11,1908},{6,11,242},{7,11,227},{7,11,1581
+},{8,11,104},{9,11,113},{9,11,220},{9,11,427},{10,11,74},{10,11,239},{11,11,579}
+,{11,11,1023},{13,11,4},{13,11,204},{13,11,316},{18,11,95},{148,11,86},{4,0,69},
+{5,0,122},{5,0,849},{6,0,1633},{9,0,656},{138,0,464},{7,0,1802},{4,10,10},{139,
+10,786},{135,11,861},{139,0,499},{7,0,476},{7,0,1592},{138,0,87},{133,10,684},{4
+,0,840},{134,10,27},{142,0,283},{6,0,1620},{7,11,1328},{136,11,494},{5,0,859},{7
+,0,1160},{8,0,107},{9,0,291},{9,0,439},{10,0,663},{11,0,609},{140,0,197},{7,11,
+1306},{8,11,505},{9,11,482},{10,11,126},{11,11,225},{12,11,347},{12,11,449},{13,
+11,19},{142,11,218},{5,11,268},{10,11,764},{12,11,120},{13,11,39},{145,11,127},{
+145,10,56},{7,11,1672},{10,11,472},{11,11,189},{143,11,51},{6,10,342},{6,10,496}
+,{8,10,275},{137,10,206},{133,0,600},{4,0,117},{6,0,372},{7,0,1905},{142,0,323},
+{4,10,909},{5,10,940},{135,11,1471},{132,10,891},{4,0,722},{139,0,471},{4,11,384
+},{135,11,1022},{132,10,687},{9,0,5},{12,0,216},{12,0,294},{12,0,298},{12,0,400}
+,{12,0,518},{13,0,229},{143,0,139},{135,11,1703},{7,11,1602},{10,11,698},{12,11,
+212},{141,11,307},{6,10,41},{141,10,160},{135,11,1077},{9,11,159},{11,11,28},{
+140,11,603},{4,0,514},{7,0,1304},{138,0,477},{134,0,1774},{9,0,88},{139,0,270},{
+5,0,12},{7,0,375},{9,0,438},{134,10,1718},{132,11,515},{136,10,778},{8,11,632},{
+8,11,697},{137,11,854},{6,0,362},{6,0,997},{146,0,51},{7,0,816},{7,0,1241},{9,0,
+283},{9,0,520},{10,0,213},{10,0,307},{10,0,463},{10,0,671},{10,0,746},{11,0,401}
+,{11,0,794},{12,0,517},{18,0,107},{147,0,115},{133,10,115},{150,11,28},{4,11,136
+},{133,11,551},{142,10,314},{132,0,258},{6,0,22},{7,0,903},{7,0,1963},{8,0,639},
+{138,0,577},{5,0,681},{8,0,782},{13,0,130},{17,0,84},{5,10,193},{140,10,178},{9,
+11,17},{138,11,291},{7,11,1287},{9,11,44},{10,11,552},{10,11,642},{11,11,839},{
+12,11,274},{12,11,275},{12,11,372},{13,11,91},{142,11,125},{135,10,174},{4,0,664
+},{5,0,804},{139,0,1013},{134,0,942},{6,0,1349},{6,0,1353},{6,0,1450},{7,11,1518
+},{139,11,694},{11,0,356},{4,10,122},{5,10,796},{5,10,952},{6,10,1660},{6,10,
+1671},{8,10,567},{9,10,687},{9,10,742},{10,10,686},{11,10,682},{140,10,281},{5,0
+,32},{6,11,147},{7,11,886},{9,11,753},{138,11,268},{5,10,179},{7,10,1095},{135,
+10,1213},{4,10,66},{7,10,722},{135,10,904},{135,10,352},{9,11,245},{138,11,137},
+{4,0,289},{7,0,629},{7,0,1698},{7,0,1711},{12,0,215},{133,11,414},{6,0,1975},{
+135,11,1762},{6,0,450},{136,0,109},{141,10,35},{134,11,599},{136,0,705},{133,0,
+664},{134,11,1749},{11,11,402},{12,11,109},{12,11,431},{13,11,179},{13,11,206},{
+14,11,175},{14,11,217},{16,11,3},{148,11,53},{135,0,1238},{134,11,1627},{132,11,
+488},{13,0,318},{10,10,592},{10,10,753},{12,10,317},{12,10,355},{12,10,465},{12,
+10,469},{12,10,560},{140,10,578},{133,10,564},{132,11,83},{140,11,676},{6,0,1872
+},{6,0,1906},{6,0,1907},{9,0,934},{9,0,956},{9,0,960},{9,0,996},{12,0,794},{12,0
+,876},{12,0,880},{12,0,918},{15,0,230},{18,0,234},{18,0,238},{21,0,38},{149,0,62
+},{134,10,556},{134,11,278},{137,0,103},{7,10,544},{8,10,719},{138,10,61},{4,10,
+5},{5,10,498},{8,10,637},{137,10,521},{7,0,777},{12,0,229},{12,0,239},{15,0,12},
+{12,11,229},{12,11,239},{143,11,12},{6,0,26},{7,11,388},{7,11,644},{139,11,781},
+{7,11,229},{8,11,59},{9,11,190},{9,11,257},{10,11,378},{140,11,191},{133,10,927}
+,{135,10,1441},{4,10,893},{5,10,780},{133,10,893},{4,0,414},{5,0,467},{9,0,654},
+{10,0,451},{12,0,59},{141,0,375},{142,0,173},{135,0,17},{7,0,1350},{133,10,238},
+{135,0,955},{4,0,960},{10,0,887},{12,0,753},{18,0,161},{18,0,162},{152,0,19},{
+136,11,344},{6,10,1729},{137,11,288},{132,11,660},{4,0,217},{5,0,710},{7,0,760},
+{7,0,1926},{9,0,428},{9,0,708},{10,0,254},{10,0,296},{10,0,720},{11,0,109},{11,0
+,255},{12,0,165},{12,0,315},{13,0,107},{13,0,203},{14,0,54},{14,0,99},{14,0,114}
+,{14,0,388},{16,0,85},{17,0,9},{17,0,33},{20,0,25},{20,0,28},{20,0,29},{21,0,9},
+{21,0,10},{21,0,34},{22,0,17},{4,10,60},{7,10,1800},{8,10,314},{9,10,700},{139,
+10,487},{7,11,1035},{138,11,737},{7,11,690},{9,11,217},{9,11,587},{140,11,521},{
+6,0,919},{7,11,706},{7,11,1058},{138,11,538},{7,10,1853},{138,10,437},{136,10,
+419},{6,0,280},{10,0,502},{11,0,344},{140,0,38},{5,0,45},{7,0,1161},{11,0,448},{
+11,0,880},{13,0,139},{13,0,407},{15,0,16},{17,0,95},{18,0,66},{18,0,88},{18,0,
+123},{149,0,7},{11,11,92},{11,11,196},{11,11,409},{11,11,450},{11,11,666},{11,11
+,777},{12,11,262},{13,11,385},{13,11,393},{15,11,115},{16,11,45},{145,11,82},{
+136,0,777},{134,11,1744},{4,0,410},{7,0,521},{133,10,828},{134,0,673},{7,0,1110}
+,{7,0,1778},{7,10,176},{135,10,178},{5,10,806},{7,11,268},{7,10,1976},{136,11,
+569},{4,11,733},{9,11,194},{10,11,92},{11,11,198},{12,11,84},{12,11,87},{13,11,
+128},{144,11,74},{5,0,341},{7,0,1129},{11,0,414},{4,10,51},{6,10,4},{7,10,591},{
+7,10,849},{7,10,951},{7,10,1613},{7,10,1760},{7,10,1988},{9,10,434},{10,10,754},
+{11,10,25},{139,10,37},{133,10,902},{135,10,928},{135,0,787},{132,0,436},{134,10
+,270},{7,0,1587},{135,0,1707},{6,0,377},{7,0,1025},{9,0,613},{145,0,104},{7,11,
+982},{7,11,1361},{10,11,32},{143,11,56},{139,0,96},{132,0,451},{132,10,416},{142
+,10,372},{5,10,152},{5,10,197},{7,11,306},{7,10,340},{7,10,867},{10,10,548},{10,
+10,581},{11,10,6},{12,10,3},{12,10,19},{14,10,110},{142,10,289},{134,0,680},{134
+,11,609},{7,0,483},{7,10,190},{8,10,28},{8,10,141},{8,10,444},{8,10,811},{9,10,
+468},{11,10,334},{12,10,24},{12,10,386},{140,10,576},{10,0,916},{133,10,757},{5,
+10,721},{135,10,1553},{133,11,178},{134,0,937},{132,10,898},{133,0,739},{147,0,
+82},{135,0,663},{146,0,128},{5,10,277},{141,10,247},{134,0,1087},{132,10,435},{6
+,11,381},{7,11,645},{7,11,694},{136,11,546},{7,0,503},{135,0,1885},{6,0,1965},{8
+,0,925},{138,0,955},{4,0,113},{5,0,163},{5,0,735},{7,0,1009},{9,0,9},{9,0,771},{
+12,0,90},{13,0,138},{13,0,410},{143,0,128},{4,0,324},{138,0,104},{7,0,460},{5,10
+,265},{134,10,212},{133,11,105},{7,11,261},{7,11,1107},{7,11,1115},{7,11,1354},{
+7,11,1588},{7,11,1705},{7,11,1902},{9,11,465},{10,11,248},{10,11,349},{10,11,647
+},{11,11,527},{11,11,660},{11,11,669},{12,11,529},{141,11,305},{5,11,438},{9,11,
+694},{12,11,627},{141,11,210},{152,11,11},{4,0,935},{133,0,823},{132,10,702},{5,
+0,269},{7,0,434},{7,0,891},{8,0,339},{9,0,702},{11,0,594},{11,0,718},{17,0,100},
+{5,10,808},{135,10,2045},{7,0,1014},{9,0,485},{141,0,264},{134,0,1713},{7,0,1810
+},{11,0,866},{12,0,103},{13,0,495},{140,11,233},{4,0,423},{10,0,949},{138,0,1013
+},{135,0,900},{8,11,25},{138,11,826},{5,10,166},{8,10,739},{140,10,511},{134,0,
+2018},{7,11,1270},{139,11,612},{4,10,119},{5,10,170},{5,10,447},{7,10,1708},{7,
+10,1889},{9,10,357},{9,10,719},{12,10,486},{140,10,596},{12,0,574},{140,11,574},
+{132,11,308},{6,0,964},{6,0,1206},{134,0,1302},{4,10,450},{135,10,1158},{135,11,
+150},{136,11,649},{14,0,213},{148,0,38},{9,11,45},{9,11,311},{141,11,42},{134,11
+,521},{7,10,1375},{7,10,1466},{138,10,331},{132,10,754},{5,11,339},{7,11,1442},{
+14,11,3},{15,11,41},{147,11,66},{136,11,378},{134,0,1022},{5,10,850},{136,10,799
+},{142,0,143},{135,0,2029},{134,11,1628},{8,0,523},{150,0,34},{5,0,625},{135,0,
+1617},{7,0,275},{7,10,238},{7,10,2033},{8,10,120},{8,10,188},{8,10,659},{9,10,
+598},{10,10,466},{12,10,342},{12,10,588},{13,10,503},{14,10,246},{143,10,92},{7,
+0,37},{8,0,425},{8,0,693},{9,0,720},{10,0,380},{10,0,638},{11,0,273},{11,0,473},
+{12,0,61},{143,0,43},{135,11,829},{135,0,1943},{132,0,765},{5,11,486},{135,11,
+1349},{7,11,1635},{8,11,17},{10,11,217},{138,11,295},{4,10,201},{7,10,1744},{8,
+10,602},{11,10,247},{11,10,826},{145,10,65},{138,11,558},{11,0,551},{142,0,159},
+{8,10,164},{146,10,62},{139,11,176},{132,0,168},{136,0,1010},{134,0,1994},{135,0
+,91},{138,0,532},{135,10,1243},{135,0,1884},{132,10,907},{5,10,100},{10,10,329},
+{12,10,416},{149,10,29},{134,11,447},{132,10,176},{5,10,636},{5,10,998},{7,10,9}
+,{7,10,1508},{8,10,26},{9,10,317},{9,10,358},{10,10,210},{10,10,292},{10,10,533}
+,{11,10,555},{12,10,526},{12,10,607},{13,10,263},{13,10,459},{142,10,271},{4,11,
+609},{135,11,756},{6,0,15},{7,0,70},{10,0,240},{147,0,93},{4,11,930},{133,11,947
+},{134,0,1227},{134,0,1534},{133,11,939},{133,11,962},{5,11,651},{8,11,170},{9,
+11,61},{9,11,63},{10,11,23},{10,11,37},{10,11,834},{11,11,4},{11,11,187},{11,11,
+281},{11,11,503},{11,11,677},{12,11,96},{12,11,130},{12,11,244},{14,11,5},{14,11
+,40},{14,11,162},{14,11,202},{146,11,133},{4,11,406},{5,11,579},{12,11,492},{150
+,11,15},{139,0,392},{6,10,610},{10,10,127},{141,10,27},{7,0,655},{7,0,1844},{136
+,10,119},{4,0,145},{6,0,176},{7,0,395},{137,0,562},{132,0,501},{140,11,145},{136
+,0,1019},{134,0,509},{139,0,267},{6,11,17},{7,11,16},{7,11,1001},{7,11,1982},{9,
+11,886},{10,11,489},{10,11,800},{11,11,782},{12,11,320},{13,11,467},{14,11,145},
+{14,11,387},{143,11,119},{145,11,17},{6,0,1099},{133,11,458},{7,11,1983},{8,11,0
+},{8,11,171},{9,11,120},{9,11,732},{10,11,473},{11,11,656},{11,11,998},{18,11,0}
+,{18,11,2},{147,11,21},{12,11,427},{146,11,38},{10,0,948},{138,0,968},{7,10,126}
+,{136,10,84},{136,10,790},{4,0,114},{9,0,492},{13,0,462},{142,0,215},{6,10,64},{
+12,10,377},{141,10,309},{4,0,77},{5,0,361},{6,0,139},{6,0,401},{6,0,404},{7,0,
+413},{7,0,715},{7,0,1716},{11,0,279},{12,0,179},{12,0,258},{13,0,244},{142,0,358
+},{134,0,1717},{7,0,772},{7,0,1061},{7,0,1647},{8,0,82},{11,0,250},{11,0,607},{
+12,0,311},{12,0,420},{13,0,184},{13,0,367},{7,10,1104},{11,10,269},{11,10,539},{
+11,10,627},{11,10,706},{11,10,975},{12,10,248},{12,10,434},{12,10,600},{12,10,
+622},{13,10,297},{13,10,485},{14,10,69},{14,10,409},{143,10,108},{135,0,724},{4,
+11,512},{4,11,519},{133,11,342},{134,0,1133},{145,11,29},{11,10,977},{141,10,507
+},{6,0,841},{6,0,1042},{6,0,1194},{10,0,993},{140,0,1021},{6,11,31},{7,11,491},{
+7,11,530},{8,11,592},{9,10,34},{11,11,53},{11,10,484},{11,11,779},{12,11,167},{
+12,11,411},{14,11,14},{14,11,136},{15,11,72},{16,11,17},{144,11,72},{4,0,1021},{
+6,0,2037},{133,11,907},{7,0,373},{8,0,335},{8,0,596},{9,0,488},{6,10,1700},{7,10
+,293},{7,10,382},{7,10,1026},{7,10,1087},{7,10,2027},{8,10,252},{8,10,727},{8,10
+,729},{9,10,30},{9,10,199},{9,10,231},{9,10,251},{9,10,334},{9,10,361},{9,10,712
+},{10,10,55},{10,10,60},{10,10,232},{10,10,332},{10,10,384},{10,10,396},{10,10,
+504},{10,10,542},{10,10,652},{11,10,20},{11,10,48},{11,10,207},{11,10,291},{11,
+10,298},{11,10,342},{11,10,365},{11,10,394},{11,10,620},{11,10,705},{11,10,1017}
+,{12,10,123},{12,10,340},{12,10,406},{12,10,643},{13,10,61},{13,10,269},{13,10,
+311},{13,10,319},{13,10,486},{14,10,234},{15,10,62},{15,10,85},{16,10,71},{18,10
+,119},{148,10,105},{150,0,37},{4,11,208},{5,11,106},{6,11,531},{8,11,408},{9,11,
+188},{138,11,572},{132,0,564},{6,0,513},{135,0,1052},{132,0,825},{9,0,899},{140,
+11,441},{134,0,778},{133,11,379},{7,0,1417},{12,0,382},{17,0,48},{152,0,12},{132
+,11,241},{7,0,1116},{6,10,379},{7,10,270},{8,10,176},{8,10,183},{9,10,432},{9,10
+,661},{12,10,247},{12,10,617},{146,10,125},{5,10,792},{133,10,900},{6,0,545},{7,
+0,565},{7,0,1669},{10,0,114},{11,0,642},{140,0,618},{133,0,5},{138,11,7},{132,11
+,259},{135,0,192},{134,0,701},{136,0,763},{135,10,1979},{4,10,901},{133,10,776},
+{10,0,755},{147,0,29},{133,0,759},{4,11,173},{5,11,312},{5,11,512},{135,11,1285}
+,{7,11,1603},{7,11,1691},{9,11,464},{11,11,195},{12,11,279},{12,11,448},{14,11,
+11},{147,11,102},{7,0,370},{7,0,1007},{7,0,1177},{135,0,1565},{135,0,1237},{4,0,
+87},{5,0,250},{141,0,298},{4,11,452},{5,11,583},{5,11,817},{6,11,433},{7,11,593}
+,{7,11,720},{7,11,1378},{8,11,161},{9,11,284},{10,11,313},{139,11,886},{4,11,547
+},{135,11,1409},{136,11,722},{4,10,37},{5,10,334},{135,10,1253},{132,10,508},{12
+,0,107},{146,0,31},{8,11,420},{139,11,193},{135,0,814},{135,11,409},{140,0,991},
+{4,0,57},{7,0,1195},{7,0,1438},{7,0,1548},{7,0,1835},{7,0,1904},{9,0,757},{10,0,
+604},{139,0,519},{132,0,540},{138,11,308},{132,10,533},{136,0,608},{144,11,65},{
+4,0,1014},{134,0,2029},{4,0,209},{7,0,902},{5,11,1002},{136,11,745},{134,0,2030}
+,{6,0,303},{7,0,335},{7,0,1437},{7,0,1668},{8,0,553},{8,0,652},{8,0,656},{9,0,
+558},{11,0,743},{149,0,18},{5,11,575},{6,11,354},{135,11,701},{4,11,239},{6,11,
+477},{7,11,1607},{11,11,68},{139,11,617},{132,0,559},{8,0,527},{18,0,60},{147,0,
+24},{133,10,920},{138,0,511},{133,0,1017},{133,0,675},{138,10,391},{11,0,156},{
+135,10,1952},{138,11,369},{132,11,367},{133,0,709},{6,0,698},{134,0,887},{142,10
+,126},{134,0,1745},{132,10,483},{13,11,299},{142,11,75},{133,0,714},{7,0,8},{136
+,0,206},{138,10,480},{4,11,694},{9,10,495},{146,10,104},{7,11,1248},{11,11,621},
+{139,11,702},{140,11,687},{132,0,776},{139,10,1009},{135,0,1272},{134,0,1059},{8
+,10,653},{13,10,93},{147,10,14},{135,11,213},{136,0,406},{133,10,172},{132,0,947
+},{8,0,175},{10,0,168},{138,0,573},{132,0,870},{6,0,1567},{151,11,28},{134,11,
+472},{5,10,260},{136,11,132},{4,11,751},{11,11,390},{140,11,32},{4,11,409},{133,
+11,78},{12,0,554},{6,11,473},{145,11,105},{133,0,784},{8,0,908},{136,11,306},{
+139,0,882},{6,0,358},{7,0,1393},{8,0,396},{10,0,263},{14,0,154},{16,0,48},{17,0,
+8},{7,11,1759},{8,11,396},{10,11,263},{14,11,154},{16,11,48},{145,11,8},{13,11,
+163},{13,11,180},{18,11,78},{148,11,35},{14,0,32},{18,0,85},{20,0,2},{152,0,16},
+{7,0,228},{10,0,770},{8,10,167},{8,10,375},{9,10,82},{9,10,561},{138,10,620},{
+132,0,845},{9,0,14},{9,0,441},{10,0,306},{139,0,9},{11,0,966},{12,0,287},{13,0,
+342},{13,0,402},{15,0,110},{15,0,163},{8,10,194},{136,10,756},{134,0,1578},{4,0,
+967},{6,0,1820},{6,0,1847},{140,0,716},{136,0,594},{7,0,1428},{7,0,1640},{7,0,
+1867},{9,0,169},{9,0,182},{9,0,367},{9,0,478},{9,0,506},{9,0,551},{9,0,557},{9,0
+,648},{9,0,697},{9,0,705},{9,0,725},{9,0,787},{9,0,794},{10,0,198},{10,0,214},{
+10,0,267},{10,0,275},{10,0,456},{10,0,551},{10,0,561},{10,0,613},{10,0,627},{10,
+0,668},{10,0,675},{10,0,691},{10,0,695},{10,0,707},{10,0,715},{11,0,183},{11,0,
+201},{11,0,244},{11,0,262},{11,0,352},{11,0,439},{11,0,493},{11,0,572},{11,0,591
+},{11,0,608},{11,0,611},{11,0,646},{11,0,674},{11,0,711},{11,0,751},{11,0,761},{
+11,0,776},{11,0,785},{11,0,850},{11,0,853},{11,0,862},{11,0,865},{11,0,868},{11,
+0,875},{11,0,898},{11,0,902},{11,0,903},{11,0,910},{11,0,932},{11,0,942},{11,0,
+957},{11,0,967},{11,0,972},{12,0,148},{12,0,195},{12,0,220},{12,0,237},{12,0,318
+},{12,0,339},{12,0,393},{12,0,445},{12,0,450},{12,0,474},{12,0,505},{12,0,509},{
+12,0,533},{12,0,591},{12,0,594},{12,0,597},{12,0,621},{12,0,633},{12,0,642},{13,
+0,59},{13,0,60},{13,0,145},{13,0,239},{13,0,250},{13,0,329},{13,0,344},{13,0,365
+},{13,0,372},{13,0,387},{13,0,403},{13,0,414},{13,0,456},{13,0,470},{13,0,478},{
+13,0,483},{13,0,489},{14,0,55},{14,0,57},{14,0,81},{14,0,90},{14,0,148},{14,0,
+239},{14,0,266},{14,0,321},{14,0,326},{14,0,327},{14,0,330},{14,0,347},{14,0,355
+},{14,0,401},{14,0,404},{14,0,411},{14,0,414},{14,0,416},{14,0,420},{15,0,61},{
+15,0,74},{15,0,87},{15,0,88},{15,0,94},{15,0,96},{15,0,116},{15,0,149},{15,0,154
+},{16,0,50},{16,0,63},{16,0,73},{17,0,2},{17,0,66},{17,0,92},{17,0,103},{17,0,
+112},{17,0,120},{18,0,50},{18,0,54},{18,0,82},{18,0,86},{18,0,90},{18,0,111},{18
+,0,115},{18,0,156},{19,0,40},{19,0,79},{20,0,78},{21,0,22},{135,11,883},{5,0,161
+},{135,0,839},{4,0,782},{13,11,293},{142,11,56},{133,11,617},{139,11,50},{135,10
+,22},{145,0,64},{5,10,639},{7,10,1249},{139,10,896},{138,0,998},{135,11,2042},{4
+,11,546},{142,11,233},{6,0,1043},{134,0,1574},{134,0,1496},{4,10,102},{7,10,815}
+,{7,10,1699},{139,10,964},{12,0,781},{142,0,461},{4,11,313},{133,11,577},{6,0,
+639},{6,0,1114},{137,0,817},{8,11,184},{141,11,433},{7,0,1814},{135,11,935},{10,
+0,997},{140,0,958},{4,0,812},{137,11,625},{132,10,899},{136,10,795},{5,11,886},{
+6,11,46},{6,11,1790},{7,11,14},{7,11,732},{7,11,1654},{8,11,95},{8,11,327},{8,11
+,616},{10,11,598},{10,11,769},{11,11,134},{11,11,747},{12,11,378},{142,11,97},{
+136,0,139},{6,10,52},{9,10,104},{9,10,559},{12,10,308},{147,10,87},{133,11,1021}
+,{132,10,604},{132,10,301},{136,10,779},{7,0,643},{136,0,236},{132,11,153},{134,
+0,1172},{147,10,32},{133,11,798},{6,0,1338},{132,11,587},{6,11,598},{7,11,42},{8
+,11,695},{10,11,212},{11,11,158},{14,11,196},{145,11,85},{135,10,508},{5,11,957}
+,{5,11,1008},{135,11,249},{4,11,129},{135,11,465},{5,0,54},{7,11,470},{7,11,1057
+},{7,11,1201},{9,11,755},{11,11,906},{140,11,527},{7,11,908},{146,11,7},{5,11,
+148},{136,11,450},{144,11,1},{4,0,256},{135,0,1488},{9,0,351},{6,10,310},{7,10,
+1849},{8,10,72},{8,10,272},{8,10,431},{9,10,12},{10,10,563},{10,10,630},{10,10,
+796},{10,10,810},{11,10,367},{11,10,599},{11,10,686},{140,10,672},{6,0,1885},{6,
+0,1898},{6,0,1899},{140,0,955},{4,0,714},{133,0,469},{6,0,1270},{134,0,1456},{
+132,0,744},{6,0,313},{7,10,537},{8,10,64},{9,10,127},{10,10,496},{12,10,510},{
+141,10,384},{4,11,217},{4,10,244},{5,11,710},{7,10,233},{7,11,1926},{9,11,428},{
+9,11,708},{10,11,254},{10,11,296},{10,11,720},{11,11,109},{11,11,255},{12,11,165
+},{12,11,315},{13,11,107},{13,11,203},{14,11,54},{14,11,99},{14,11,114},{14,11,
+388},{16,11,85},{17,11,9},{17,11,33},{20,11,25},{20,11,28},{20,11,29},{21,11,9},
+{21,11,10},{21,11,34},{150,11,17},{138,0,402},{7,0,969},{146,0,55},{8,0,50},{137
+,0,624},{134,0,1355},{132,0,572},{134,10,1650},{10,10,702},{139,10,245},{10,0,
+847},{142,0,445},{6,0,43},{7,0,38},{8,0,248},{138,0,513},{133,0,369},{137,10,338
+},{133,0,766},{133,0,363},{133,10,896},{8,11,392},{11,11,54},{13,11,173},{13,11,
+294},{148,11,7},{134,0,678},{7,11,1230},{136,11,531},{6,0,258},{140,0,409},{5,0,
+249},{148,0,82},{7,10,1117},{136,10,539},{5,0,393},{6,0,378},{7,0,1981},{9,0,32}
+,{9,0,591},{10,0,685},{10,0,741},{142,0,382},{133,0,788},{134,0,1281},{134,0,
+1295},{7,0,1968},{141,0,509},{4,0,61},{5,0,58},{5,0,171},{5,0,683},{6,0,291},{6,
+0,566},{7,0,1650},{11,0,523},{12,0,273},{12,0,303},{15,0,39},{143,0,111},{6,0,
+706},{134,0,1283},{134,0,589},{135,11,1433},{133,11,435},{7,0,1059},{13,0,54},{5
+,10,4},{5,10,810},{6,10,13},{6,10,538},{6,10,1690},{6,10,1726},{7,10,1819},{8,10
+,148},{8,10,696},{8,10,791},{12,10,125},{143,10,9},{135,10,1268},{5,11,85},{6,11
+,419},{7,11,134},{7,11,305},{7,11,361},{7,11,1337},{8,11,71},{140,11,519},{137,0
+,824},{140,11,688},{5,11,691},{7,11,345},{7,10,1385},{9,11,94},{11,10,582},{11,
+10,650},{11,10,901},{11,10,949},{12,11,169},{12,10,232},{12,10,236},{13,10,413},
+{13,10,501},{146,10,116},{4,0,917},{133,0,1005},{7,0,1598},{5,11,183},{6,11,582}
+,{9,11,344},{10,11,679},{140,11,435},{4,10,925},{5,10,803},{8,10,698},{138,10,
+828},{132,0,919},{135,11,511},{139,10,992},{4,0,255},{5,0,302},{6,0,132},{7,0,
+128},{7,0,283},{7,0,1299},{10,0,52},{10,0,514},{11,0,925},{13,0,92},{142,0,309},
+{134,0,1369},{135,10,1847},{134,0,328},{7,11,1993},{136,11,684},{133,10,383},{
+137,0,173},{134,11,583},{134,0,1411},{19,0,65},{5,11,704},{8,11,357},{10,11,745}
+,{14,11,426},{17,11,94},{147,11,57},{9,10,660},{138,10,347},{4,11,179},{5,11,198
+},{133,11,697},{7,11,347},{7,11,971},{8,11,181},{138,11,711},{141,0,442},{11,0,
+842},{11,0,924},{13,0,317},{13,0,370},{13,0,469},{13,0,471},{14,0,397},{18,0,69}
+,{18,0,145},{7,10,572},{9,10,592},{11,10,680},{12,10,356},{140,10,550},{14,11,19
+},{14,11,28},{144,11,29},{136,0,534},{4,11,243},{5,11,203},{7,11,19},{7,11,71},{
+7,11,113},{10,11,405},{11,11,357},{142,11,240},{6,0,210},{10,0,845},{138,0,862},
+{7,11,1351},{9,11,581},{10,11,639},{11,11,453},{140,11,584},{7,11,1450},{139,11,
+99},{10,0,892},{12,0,719},{144,0,105},{4,0,284},{6,0,223},{134,11,492},{5,11,134
+},{6,11,408},{6,11,495},{135,11,1593},{136,0,529},{137,0,807},{4,0,218},{7,0,526
+},{143,0,137},{6,0,1444},{142,11,4},{132,11,665},{4,0,270},{5,0,192},{6,0,332},{
+7,0,1322},{4,11,248},{7,11,137},{137,11,349},{140,0,661},{7,0,1517},{11,0,597},{
+14,0,76},{14,0,335},{20,0,33},{7,10,748},{139,10,700},{5,11,371},{135,11,563},{
+146,11,57},{133,10,127},{133,0,418},{4,11,374},{7,11,547},{7,11,1700},{7,11,1833
+},{139,11,858},{6,10,198},{140,10,83},{7,11,1812},{13,11,259},{13,11,356},{14,11
+,242},{147,11,114},{7,0,379},{8,0,481},{9,0,377},{5,10,276},{6,10,55},{135,10,
+1369},{138,11,286},{5,0,1003},{6,0,149},{6,10,1752},{136,10,726},{8,0,262},{9,0,
+627},{10,0,18},{11,0,214},{11,0,404},{11,0,457},{11,0,780},{11,0,913},{13,0,401}
+,{14,0,200},{6,11,1647},{7,11,1552},{7,11,2010},{9,11,494},{137,11,509},{135,0,
+742},{136,0,304},{132,0,142},{133,10,764},{6,10,309},{7,10,331},{138,10,550},{
+135,10,1062},{6,11,123},{7,11,214},{7,10,986},{9,11,728},{10,11,157},{11,11,346}
+,{11,11,662},{143,11,106},{135,10,1573},{7,0,925},{137,0,799},{4,0,471},{5,0,51}
+,{6,0,602},{8,0,484},{138,0,195},{136,0,688},{132,0,697},{6,0,1169},{6,0,1241},{
+6,10,194},{7,10,133},{10,10,493},{10,10,570},{139,10,664},{140,0,751},{7,0,929},
+{10,0,452},{11,0,878},{16,0,33},{5,10,24},{5,10,569},{6,10,3},{6,10,119},{6,10,
+143},{6,10,440},{7,10,599},{7,10,1686},{7,10,1854},{8,10,424},{9,10,43},{9,10,
+584},{9,10,760},{10,10,328},{11,10,159},{11,10,253},{12,10,487},{140,10,531},{4,
+11,707},{13,11,106},{18,11,49},{147,11,41},{5,0,221},{5,11,588},{134,11,393},{
+134,0,1437},{6,11,211},{7,11,1690},{11,11,486},{140,11,369},{5,10,14},{5,10,892}
+,{6,10,283},{7,10,234},{136,10,537},{4,0,988},{136,0,955},{135,0,1251},{4,10,126
+},{8,10,635},{147,10,34},{4,10,316},{135,10,1561},{137,10,861},{4,10,64},{5,10,
+352},{5,10,720},{6,10,368},{139,10,359},{134,0,192},{4,0,132},{5,0,69},{135,0,
+1242},{7,10,1577},{10,10,304},{10,10,549},{12,10,365},{13,10,220},{13,10,240},{
+142,10,33},{4,0,111},{7,0,865},{134,11,219},{5,11,582},{6,11,1646},{7,11,99},{7,
+11,1962},{7,11,1986},{8,11,515},{8,11,773},{9,11,23},{9,11,491},{12,11,620},{14,
+11,52},{145,11,50},{132,0,767},{7,11,568},{148,11,21},{6,0,42},{7,0,1416},{7,0,
+2005},{8,0,131},{8,0,466},{9,0,672},{13,0,252},{20,0,103},{133,11,851},{135,0,
+1050},{6,10,175},{137,10,289},{5,10,432},{133,10,913},{6,0,44},{136,0,368},{135,
+11,784},{132,0,570},{133,0,120},{139,10,595},{140,0,29},{6,0,227},{135,0,1589},{
+4,11,98},{7,11,1365},{9,11,422},{9,11,670},{10,11,775},{11,11,210},{13,11,26},{
+13,11,457},{141,11,476},{140,10,80},{5,10,931},{134,10,1698},{133,0,522},{134,0,
+1120},{135,0,1529},{12,0,739},{14,0,448},{142,0,467},{11,10,526},{11,10,939},{
+141,10,290},{5,10,774},{6,10,1637},{6,10,1686},{134,10,1751},{6,0,1667},{135,0,
+2036},{7,10,1167},{11,10,934},{13,10,391},{145,10,76},{137,11,147},{6,10,260},{7
+,10,1484},{11,11,821},{12,11,110},{12,11,153},{18,11,41},{150,11,19},{6,0,511},{
+12,0,132},{134,10,573},{5,0,568},{6,0,138},{135,0,1293},{132,0,1020},{8,0,258},{
+9,0,208},{137,0,359},{4,0,565},{8,0,23},{136,0,827},{134,0,344},{4,0,922},{5,0,
+1023},{13,11,477},{14,11,120},{148,11,61},{134,0,240},{5,11,209},{6,11,30},{11,
+11,56},{139,11,305},{6,0,171},{7,0,1002},{7,0,1324},{9,0,415},{14,0,230},{18,0,
+68},{4,10,292},{4,10,736},{5,10,871},{6,10,1689},{7,10,1944},{137,10,580},{9,11,
+635},{139,11,559},{4,11,150},{5,11,303},{134,11,327},{6,10,63},{135,10,920},{133
+,10,793},{8,11,192},{10,11,78},{10,11,555},{11,11,308},{13,11,359},{147,11,95},{
+135,11,786},{135,11,1712},{136,0,402},{6,0,754},{6,11,1638},{7,11,79},{7,11,496}
+,{9,11,138},{10,11,336},{11,11,12},{12,11,412},{12,11,440},{142,11,305},{4,0,716
+},{141,0,31},{133,0,982},{8,0,691},{8,0,731},{5,10,67},{6,10,62},{6,10,374},{135
+,10,1391},{9,10,790},{140,10,47},{139,11,556},{151,11,1},{7,11,204},{7,11,415},{
+8,11,42},{10,11,85},{11,11,33},{11,11,564},{12,11,571},{149,11,1},{8,0,888},{7,
+11,610},{135,11,1501},{4,10,391},{135,10,1169},{5,0,847},{9,0,840},{138,0,803},{
+137,0,823},{134,0,785},{8,0,152},{9,0,53},{9,0,268},{9,0,901},{10,0,518},{10,0,
+829},{11,0,188},{13,0,74},{14,0,46},{15,0,17},{15,0,33},{17,0,40},{18,0,36},{19,
+0,20},{22,0,1},{152,0,2},{4,11,3},{5,11,247},{5,11,644},{7,11,744},{7,11,1207},{
+7,11,1225},{7,11,1909},{146,11,147},{136,0,532},{135,0,681},{132,10,271},{140,0,
+314},{140,0,677},{4,0,684},{136,0,384},{5,11,285},{9,11,67},{13,11,473},{143,11,
+82},{4,10,253},{5,10,544},{7,10,300},{137,10,340},{7,0,110},{7,0,447},{8,0,290},
+{8,0,591},{9,0,382},{9,0,649},{11,0,71},{11,0,155},{11,0,313},{12,0,5},{13,0,325
+},{142,0,287},{134,0,1818},{136,0,1007},{138,0,321},{7,0,360},{7,0,425},{9,0,66}
+,{9,0,278},{138,0,644},{133,10,818},{5,0,385},{5,10,541},{6,10,94},{6,10,499},{7
+,10,230},{139,10,321},{4,10,920},{5,10,25},{5,10,790},{6,10,457},{7,10,853},{136
+,10,788},{4,0,900},{133,0,861},{5,0,254},{7,0,985},{136,0,73},{7,0,1959},{136,0,
+683},{134,10,1765},{133,10,822},{132,10,634},{4,11,29},{6,11,532},{7,11,1628},{7
+,11,1648},{9,11,303},{9,11,350},{10,11,433},{11,11,97},{11,11,557},{11,11,745},{
+12,11,289},{12,11,335},{12,11,348},{12,11,606},{13,11,116},{13,11,233},{13,11,
+466},{14,11,181},{14,11,209},{14,11,232},{14,11,236},{14,11,300},{16,11,41},{148
+,11,97},{19,0,86},{6,10,36},{7,10,658},{136,10,454},{135,11,1692},{132,0,725},{5
+,11,501},{7,11,1704},{9,11,553},{11,11,520},{12,11,557},{141,11,249},{134,0,196}
+,{133,0,831},{136,0,723},{7,0,1897},{13,0,80},{13,0,437},{145,0,74},{4,0,992},{6
+,0,627},{136,0,994},{135,11,1294},{132,10,104},{5,0,848},{6,0,66},{136,0,764},{4
+,0,36},{7,0,1387},{10,0,205},{139,0,755},{6,0,1046},{134,0,1485},{134,0,950},{
+132,0,887},{14,0,450},{148,0,111},{7,0,620},{7,0,831},{9,10,542},{9,10,566},{138
+,10,728},{6,0,165},{138,0,388},{139,10,263},{4,0,719},{135,0,155},{138,10,468},{
+6,11,453},{144,11,36},{134,11,129},{5,0,533},{7,0,755},{138,0,780},{134,0,1465},
+{4,0,353},{6,0,146},{6,0,1789},{7,0,427},{7,0,990},{7,0,1348},{9,0,665},{9,0,898
+},{11,0,893},{142,0,212},{7,10,87},{142,10,288},{4,0,45},{135,0,1257},{12,0,7},{
+7,10,988},{7,10,1939},{9,10,64},{9,10,502},{12,10,34},{13,10,12},{13,10,234},{
+147,10,77},{4,0,607},{5,11,60},{6,11,504},{7,11,614},{7,11,1155},{140,11,0},{135
+,10,141},{8,11,198},{11,11,29},{140,11,534},{140,0,65},{136,0,816},{132,10,619},
+{139,0,88},{5,10,246},{8,10,189},{9,10,355},{9,10,512},{10,10,124},{10,10,453},{
+11,10,143},{11,10,416},{11,10,859},{141,10,341},{4,11,379},{135,11,1397},{4,0,
+600},{137,0,621},{133,0,367},{134,0,561},{6,0,559},{134,0,1691},{6,0,585},{134,
+11,585},{135,11,1228},{4,11,118},{5,10,678},{6,11,274},{6,11,361},{7,11,75},{141
+,11,441},{135,11,1818},{137,11,841},{5,0,573},{6,0,287},{7,10,862},{7,10,1886},{
+138,10,179},{132,10,517},{140,11,693},{5,11,314},{6,11,221},{7,11,419},{10,11,
+650},{11,11,396},{12,11,156},{13,11,369},{14,11,333},{145,11,47},{140,10,540},{
+136,10,667},{11,10,403},{146,10,83},{6,0,672},{133,10,761},{9,0,157},{10,10,131}
+,{140,10,72},{7,0,714},{134,11,460},{134,0,456},{133,0,925},{5,11,682},{135,11,
+1887},{136,11,510},{136,11,475},{133,11,1016},{9,0,19},{7,11,602},{8,11,179},{10
+,11,781},{140,11,126},{6,11,329},{138,11,111},{6,0,822},{134,0,1473},{144,11,86}
+,{11,0,113},{139,11,113},{5,11,821},{134,11,1687},{133,10,449},{7,0,463},{17,0,
+69},{136,10,103},{7,10,2028},{138,10,641},{6,0,193},{7,0,240},{7,0,1682},{10,0,
+51},{10,0,640},{11,0,410},{13,0,82},{14,0,247},{14,0,331},{142,0,377},{6,0,471},
+{11,0,411},{142,0,2},{5,11,71},{7,11,1407},{9,11,388},{9,11,704},{10,11,261},{10
+,11,619},{11,11,547},{11,11,619},{143,11,157},{136,0,633},{135,0,1148},{6,0,554}
+,{7,0,1392},{12,0,129},{7,10,1274},{7,10,1386},{7,11,2008},{9,11,337},{10,11,517
+},{146,10,87},{7,0,803},{8,0,542},{6,10,187},{7,10,1203},{8,10,380},{14,10,117},
+{149,10,28},{6,10,297},{7,10,793},{139,10,938},{8,0,438},{11,0,363},{7,10,464},{
+11,10,105},{12,10,231},{14,10,386},{15,10,102},{148,10,75},{5,11,16},{6,11,86},{
+6,11,603},{7,11,292},{7,11,561},{8,11,257},{8,11,382},{9,11,721},{9,11,778},{11,
+11,581},{140,11,466},{6,0,717},{4,11,486},{133,11,491},{132,0,875},{132,11,72},{
+6,11,265},{135,11,847},{4,0,237},{135,0,514},{6,0,392},{7,0,65},{135,0,2019},{
+140,11,261},{135,11,922},{137,11,404},{12,0,563},{14,0,101},{18,0,129},{7,10,
+1010},{11,10,733},{11,10,759},{13,10,34},{146,10,45},{7,10,1656},{9,10,369},{10,
+10,338},{10,10,490},{11,10,154},{11,10,545},{11,10,775},{13,10,77},{141,10,274},
+{4,0,444},{10,0,146},{140,0,9},{139,11,163},{7,0,1260},{135,0,1790},{9,0,222},{
+10,0,43},{139,0,900},{137,11,234},{138,0,971},{137,0,761},{134,0,699},{136,11,
+434},{6,0,1116},{7,0,1366},{5,10,20},{6,11,197},{6,10,298},{7,10,659},{8,11,205}
+,{137,10,219},{132,11,490},{11,11,820},{150,11,51},{7,10,1440},{11,10,854},{11,
+10,872},{11,10,921},{12,10,551},{13,10,472},{142,10,367},{140,11,13},{132,0,829}
+,{12,0,242},{132,10,439},{136,10,669},{6,0,593},{6,11,452},{7,11,312},{138,11,
+219},{4,11,333},{9,11,176},{12,11,353},{141,11,187},{7,0,36},{8,0,201},{136,0,
+605},{140,0,224},{132,10,233},{134,0,1430},{134,0,1806},{4,0,523},{133,0,638},{6
+,0,1889},{9,0,958},{9,0,971},{9,0,976},{12,0,796},{12,0,799},{12,0,808},{12,0,
+835},{12,0,836},{12,0,914},{12,0,946},{15,0,216},{15,0,232},{18,0,183},{18,0,187
+},{18,0,194},{18,0,212},{18,0,232},{149,0,49},{132,10,482},{6,0,827},{134,0,1434
+},{135,10,346},{134,0,2043},{6,0,242},{7,0,227},{7,0,1581},{8,0,104},{9,0,113},{
+9,0,220},{9,0,427},{10,0,136},{10,0,239},{11,0,579},{11,0,1023},{13,0,4},{13,0,
+204},{13,0,316},{148,0,86},{134,11,1685},{7,0,148},{8,0,284},{141,0,63},{142,0,
+10},{135,11,584},{134,0,1249},{7,0,861},{135,10,334},{5,10,795},{6,10,1741},{137
+,11,70},{132,0,807},{7,11,135},{8,11,7},{8,11,62},{9,11,243},{10,11,658},{10,11,
+697},{11,11,456},{139,11,756},{9,11,395},{138,11,79},{137,11,108},{147,0,94},{
+136,0,494},{135,11,631},{135,10,622},{7,0,1510},{135,10,1750},{4,10,203},{135,10
+,1936},{7,11,406},{7,11,459},{8,11,606},{139,11,726},{7,0,1306},{8,0,505},{9,0,
+482},{10,0,126},{11,0,225},{12,0,347},{12,0,449},{13,0,19},{14,0,218},{142,0,435
+},{5,0,268},{10,0,764},{12,0,120},{13,0,39},{145,0,127},{142,11,68},{11,10,678},
+{140,10,307},{12,11,268},{12,11,640},{142,11,119},{135,10,2044},{133,11,612},{4,
+11,372},{7,11,482},{8,11,158},{9,11,602},{9,11,615},{10,11,245},{10,11,678},{10,
+11,744},{11,11,248},{139,11,806},{7,10,311},{9,10,308},{140,10,255},{4,0,384},{
+135,0,1022},{5,11,854},{135,11,1991},{135,10,1266},{4,10,400},{5,10,267},{135,10
+,232},{135,0,1703},{9,0,159},{11,0,661},{140,0,603},{4,0,964},{14,0,438},{14,0,
+444},{14,0,456},{22,0,60},{22,0,63},{9,11,106},{9,11,163},{9,11,296},{10,11,167}
+,{10,11,172},{10,11,777},{139,11,16},{136,0,583},{132,0,515},{8,0,632},{8,0,697}
+,{137,0,854},{5,11,195},{135,11,1685},{6,0,1123},{134,0,1365},{134,11,328},{7,11
+,1997},{8,11,730},{139,11,1006},{4,0,136},{133,0,551},{134,0,1782},{7,0,1287},{9
+,0,44},{10,0,552},{10,0,642},{11,0,839},{12,0,274},{12,0,275},{12,0,372},{13,0,
+91},{142,0,125},{5,11,751},{11,11,797},{140,11,203},{133,0,732},{7,0,679},{8,0,
+313},{4,10,100},{135,11,821},{10,0,361},{142,0,316},{134,0,595},{6,0,147},{7,0,
+886},{9,0,753},{138,0,268},{5,10,362},{5,10,443},{6,10,318},{7,10,1019},{139,10,
+623},{5,10,463},{136,10,296},{4,10,454},{5,11,950},{5,11,994},{134,11,351},{138,
+0,137},{5,10,48},{5,10,404},{6,10,557},{7,10,458},{8,10,597},{10,10,455},{10,10,
+606},{11,10,49},{11,10,548},{12,10,476},{13,10,18},{141,10,450},{133,0,414},{135
+,0,1762},{5,11,421},{135,11,47},{5,10,442},{135,10,1984},{134,0,599},{134,0,1749
+},{134,0,1627},{4,0,488},{132,11,350},{137,11,751},{132,0,83},{140,0,676},{133,
+11,967},{7,0,1639},{5,10,55},{140,10,161},{4,11,473},{7,11,623},{8,11,808},{9,11
+,871},{9,11,893},{11,11,38},{11,11,431},{12,11,112},{12,11,217},{12,11,243},{12,
+11,562},{12,11,683},{13,11,141},{13,11,197},{13,11,227},{13,11,406},{13,11,487},
+{14,11,156},{14,11,203},{14,11,224},{14,11,256},{18,11,58},{150,11,0},{133,10,
+450},{7,11,736},{139,11,264},{134,0,278},{4,11,222},{7,11,286},{136,11,629},{135
+,10,869},{140,0,97},{144,0,14},{134,0,1085},{4,10,213},{7,10,223},{136,10,80},{7
+,0,388},{7,0,644},{139,0,781},{132,0,849},{7,0,229},{8,0,59},{9,0,190},{10,0,378
+},{140,0,191},{7,10,381},{7,10,806},{7,10,820},{8,10,354},{8,10,437},{8,10,787},
+{9,10,657},{10,10,58},{10,10,339},{10,10,749},{11,10,914},{12,10,162},{13,10,75}
+,{14,10,106},{14,10,198},{14,10,320},{14,10,413},{146,10,43},{141,11,306},{136,
+10,747},{134,0,1115},{16,0,94},{16,0,108},{136,11,146},{6,0,700},{6,0,817},{134,
+0,1002},{133,10,692},{4,11,465},{135,11,1663},{134,10,191},{6,0,1414},{135,11,
+913},{132,0,660},{7,0,1035},{138,0,737},{6,10,162},{7,10,1960},{136,10,831},{132
+,10,706},{7,0,690},{9,0,217},{9,0,587},{140,0,521},{138,10,426},{135,10,1235},{6
+,11,82},{7,11,138},{7,11,517},{9,11,673},{139,11,238},{138,0,272},{5,11,495},{7,
+11,834},{9,11,733},{139,11,378},{134,0,1744},{132,0,1011},{7,11,828},{142,11,116
+},{4,0,733},{9,0,194},{10,0,92},{11,0,198},{12,0,84},{13,0,128},{133,11,559},{10
+,0,57},{10,0,277},{6,11,21},{6,11,1737},{7,11,1444},{136,11,224},{4,10,204},{137
+,10,902},{136,10,833},{11,0,348},{12,0,99},{18,0,1},{18,0,11},{19,0,4},{7,10,366
+},{9,10,287},{12,10,199},{12,10,556},{140,10,577},{6,0,1981},{136,0,936},{21,0,
+33},{150,0,40},{5,11,519},{138,11,204},{5,10,356},{135,10,224},{134,0,775},{135,
+0,306},{7,10,630},{9,10,567},{11,10,150},{11,10,444},{141,10,119},{5,0,979},{134
+,10,539},{133,0,611},{4,11,402},{135,11,1679},{5,0,178},{7,11,2},{8,11,323},{136
+,11,479},{5,11,59},{135,11,672},{4,0,1010},{6,0,1969},{138,11,237},{133,11,412},
+{146,11,34},{7,11,1740},{146,11,48},{134,0,664},{139,10,814},{4,11,85},{135,11,
+549},{133,11,94},{133,11,457},{132,0,390},{134,0,1510},{4,10,235},{135,10,255},{
+4,10,194},{5,10,584},{6,11,11},{6,10,384},{7,11,187},{7,10,583},{10,10,761},{11,
+10,760},{139,10,851},{4,11,522},{139,11,802},{135,0,493},{10,11,776},{13,11,345}
+,{142,11,425},{146,0,37},{4,11,52},{135,11,661},{134,0,724},{134,0,829},{133,11,
+520},{133,10,562},{4,11,281},{5,11,38},{7,11,194},{7,11,668},{7,11,1893},{137,11
+,397},{5,10,191},{137,10,271},{7,0,1537},{14,0,96},{143,0,73},{5,0,473},{11,0,
+168},{4,10,470},{6,10,153},{7,10,1503},{7,10,1923},{10,10,701},{11,10,132},{11,
+10,227},{11,10,320},{11,10,436},{11,10,525},{11,10,855},{12,10,41},{12,10,286},{
+13,10,103},{13,10,284},{14,10,255},{14,10,262},{15,10,117},{143,10,127},{133,0,
+105},{5,0,438},{9,0,694},{12,0,627},{141,0,210},{133,10,327},{6,10,552},{7,10,
+1754},{137,10,604},{134,0,1256},{152,0,11},{5,11,448},{11,11,98},{139,11,524},{7
+,0,1626},{5,10,80},{6,10,405},{7,10,403},{7,10,1502},{8,10,456},{9,10,487},{9,10
+,853},{9,10,889},{10,10,309},{11,10,721},{11,10,994},{12,10,430},{13,10,165},{14
+,11,16},{146,11,44},{132,0,779},{8,0,25},{138,0,826},{4,10,453},{5,10,887},{6,10
+,535},{8,10,6},{8,10,543},{136,10,826},{137,11,461},{140,11,632},{132,0,308},{
+135,0,741},{132,0,671},{7,0,150},{8,0,649},{136,0,1020},{9,0,99},{6,11,336},{8,
+11,552},{9,11,285},{10,11,99},{139,11,568},{134,0,521},{5,0,339},{14,0,3},{15,0,
+41},{15,0,166},{147,0,66},{6,11,423},{7,11,665},{7,11,1210},{9,11,218},{141,11,
+222},{6,0,543},{5,10,101},{5,11,256},{6,10,88},{7,10,1677},{9,10,100},{10,10,677
+},{14,10,169},{14,10,302},{14,10,313},{15,10,48},{143,10,84},{4,10,310},{7,10,
+708},{7,10,996},{9,10,795},{10,10,390},{10,10,733},{11,10,451},{12,10,249},{14,
+10,115},{14,10,286},{143,10,100},{133,10,587},{13,11,417},{14,11,129},{143,11,15
+},{134,0,1358},{136,11,554},{132,10,498},{7,10,217},{8,10,140},{138,10,610},{135
+,11,989},{135,11,634},{6,0,155},{140,0,234},{135,11,462},{132,11,618},{134,0,
+1628},{132,0,766},{4,11,339},{5,10,905},{135,11,259},{135,0,829},{4,11,759},{141
+,11,169},{7,0,1445},{4,10,456},{7,10,358},{7,10,1637},{8,10,643},{139,10,483},{5
+,0,486},{135,0,1349},{5,11,688},{135,11,712},{7,0,1635},{8,0,17},{10,0,217},{10,
+0,295},{12,0,2},{140,11,2},{138,0,558},{150,10,56},{4,11,278},{5,11,465},{135,11
+,1367},{136,11,482},{133,10,535},{6,0,1362},{6,0,1461},{10,11,274},{10,11,625},{
+139,11,530},{5,0,599},{5,11,336},{6,11,341},{6,11,478},{6,11,1763},{136,11,386},
+{7,10,1748},{137,11,151},{134,0,1376},{133,10,539},{135,11,73},{135,11,1971},{
+139,11,283},{9,0,93},{139,0,474},{6,10,91},{135,10,435},{6,0,447},{5,11,396},{
+134,11,501},{4,10,16},{5,10,316},{5,10,842},{6,10,370},{6,10,1778},{8,10,166},{
+11,10,812},{12,10,206},{12,10,351},{14,10,418},{16,10,15},{16,10,34},{18,10,3},{
+19,10,3},{19,10,7},{20,10,4},{149,10,21},{7,0,577},{7,0,1432},{9,0,475},{9,0,505
+},{9,0,526},{9,0,609},{9,0,689},{9,0,726},{9,0,735},{9,0,738},{10,0,556},{10,0,
+674},{10,0,684},{11,0,89},{11,0,202},{11,0,272},{11,0,380},{11,0,415},{11,0,505}
+,{11,0,537},{11,0,550},{11,0,562},{11,0,640},{11,0,667},{11,0,688},{11,0,847},{
+11,0,927},{11,0,930},{11,0,940},{12,0,144},{12,0,325},{12,0,329},{12,0,389},{12,
+0,403},{12,0,451},{12,0,515},{12,0,604},{12,0,616},{12,0,626},{13,0,66},{13,0,
+131},{13,0,167},{13,0,236},{13,0,368},{13,0,411},{13,0,434},{13,0,453},{13,0,461
+},{13,0,474},{14,0,59},{14,0,60},{14,0,139},{14,0,152},{14,0,276},{14,0,353},{14
+,0,402},{15,0,28},{15,0,81},{15,0,123},{15,0,152},{18,0,136},{148,0,88},{4,11,
+929},{133,11,799},{136,11,46},{142,0,307},{4,0,609},{7,0,756},{9,0,544},{11,0,
+413},{144,0,25},{10,0,687},{7,10,619},{10,10,547},{11,10,122},{140,10,601},{4,0,
+930},{133,0,947},{133,0,939},{142,0,21},{4,11,892},{133,11,770},{133,0,962},{5,0
+,651},{8,0,170},{9,0,61},{9,0,63},{10,0,23},{10,0,37},{10,0,834},{11,0,4},{11,0,
+187},{11,0,281},{11,0,503},{11,0,677},{12,0,96},{12,0,130},{12,0,244},{14,0,5},{
+14,0,40},{14,0,162},{14,0,202},{146,0,133},{4,0,406},{5,0,579},{12,0,492},{150,0
+,15},{135,11,158},{135,0,597},{132,0,981},{132,10,888},{4,10,149},{138,10,368},{
+132,0,545},{4,10,154},{7,10,1134},{136,10,105},{135,11,2001},{134,0,1558},{4,10,
+31},{6,10,429},{7,10,962},{9,10,458},{139,10,691},{132,10,312},{135,10,1642},{6,
+0,17},{6,0,1304},{7,0,16},{7,0,1001},{9,0,886},{10,0,489},{10,0,800},{11,0,782},
+{12,0,320},{13,0,467},{14,0,145},{14,0,387},{143,0,119},{135,0,1982},{17,0,17},{
+7,11,1461},{140,11,91},{4,10,236},{132,11,602},{138,0,907},{136,0,110},{7,0,272}
+,{19,0,53},{5,10,836},{5,10,857},{134,10,1680},{5,0,458},{7,11,1218},{136,11,303
+},{7,0,1983},{8,0,0},{8,0,171},{9,0,120},{9,0,732},{10,0,473},{11,0,656},{11,0,
+998},{18,0,0},{18,0,2},{19,0,21},{10,10,68},{139,10,494},{137,11,662},{4,11,13},
+{5,11,567},{7,11,1498},{9,11,124},{11,11,521},{140,11,405},{4,10,81},{139,10,867
+},{135,11,1006},{7,11,800},{7,11,1783},{138,11,12},{9,0,295},{10,0,443},{5,10,
+282},{8,10,650},{137,10,907},{132,11,735},{4,11,170},{4,10,775},{135,11,323},{6,
+0,1844},{10,0,924},{11,11,844},{12,11,104},{140,11,625},{5,11,304},{7,11,1403},{
+140,11,498},{134,0,1232},{4,0,519},{10,0,70},{12,0,26},{14,0,17},{14,0,178},{15,
+0,34},{149,0,12},{132,0,993},{4,11,148},{133,11,742},{6,0,31},{7,0,491},{7,0,530
+},{8,0,592},{11,0,53},{11,0,779},{12,0,167},{12,0,411},{14,0,14},{14,0,136},{15,
+0,72},{16,0,17},{144,0,72},{133,0,907},{134,0,733},{133,11,111},{4,10,71},{5,10,
+376},{7,10,119},{138,10,665},{136,0,55},{8,0,430},{136,11,430},{4,0,208},{5,0,
+106},{6,0,531},{8,0,408},{9,0,188},{138,0,572},{12,0,56},{11,10,827},{14,10,34},
+{143,10,148},{134,0,1693},{133,11,444},{132,10,479},{140,0,441},{9,0,449},{10,0,
+192},{138,0,740},{134,0,928},{4,0,241},{7,10,607},{136,10,99},{8,11,123},{15,11,
+6},{144,11,7},{6,11,285},{8,11,654},{11,11,749},{12,11,190},{12,11,327},{13,11,
+120},{13,11,121},{13,11,327},{15,11,47},{146,11,40},{4,10,41},{5,10,74},{7,10,
+1627},{11,10,871},{140,10,619},{7,0,1525},{11,10,329},{11,10,965},{12,10,241},{
+14,10,354},{15,10,22},{148,10,63},{132,0,259},{135,11,183},{9,10,209},{137,10,
+300},{5,11,937},{135,11,100},{133,10,98},{4,0,173},{5,0,312},{5,0,512},{135,0,
+1285},{141,0,185},{7,0,1603},{7,0,1691},{9,0,464},{11,0,195},{12,0,279},{12,0,
+448},{14,0,11},{147,0,102},{135,0,1113},{133,10,984},{4,0,452},{5,0,583},{135,0,
+720},{4,0,547},{5,0,817},{6,0,433},{7,0,593},{7,0,1378},{8,0,161},{9,0,284},{10,
+0,313},{139,0,886},{8,0,722},{4,10,182},{6,10,205},{135,10,220},{150,0,13},{4,10
+,42},{9,10,205},{9,10,786},{138,10,659},{6,0,289},{7,0,1670},{12,0,57},{151,0,4}
+,{132,10,635},{14,0,43},{146,0,21},{139,10,533},{135,0,1694},{8,0,420},{139,0,
+193},{135,0,409},{132,10,371},{4,10,272},{135,10,836},{5,10,825},{134,10,1640},{
+5,11,251},{5,11,956},{8,11,268},{9,11,214},{146,11,142},{138,0,308},{6,0,1863},{
+141,11,37},{137,10,879},{7,10,317},{135,10,569},{132,11,294},{134,0,790},{5,0,
+1002},{136,0,745},{5,11,346},{5,11,711},{136,11,390},{135,0,289},{5,0,504},{11,0
+,68},{137,10,307},{4,0,239},{6,0,477},{7,0,1607},{139,0,617},{149,0,13},{133,0,
+609},{133,11,624},{5,11,783},{7,11,1998},{135,11,2047},{133,10,525},{132,0,367},
+{132,11,594},{6,0,528},{133,10,493},{4,10,174},{135,10,911},{8,10,417},{137,10,
+782},{132,0,694},{7,0,548},{137,0,58},{4,10,32},{5,10,215},{6,10,269},{7,10,1782
+},{7,10,1892},{10,10,16},{11,10,822},{11,10,954},{141,10,481},{140,0,687},{7,0,
+1749},{136,10,477},{132,11,569},{133,10,308},{135,10,1088},{4,0,661},{138,0,1004
+},{5,11,37},{6,11,39},{6,11,451},{7,11,218},{7,11,667},{7,11,1166},{7,11,1687},{
+8,11,662},{144,11,2},{9,0,445},{12,0,53},{13,0,492},{5,10,126},{8,10,297},{9,10,
+366},{140,10,374},{7,10,1551},{139,10,361},{148,0,74},{134,11,508},{135,0,213},{
+132,10,175},{132,10,685},{6,0,760},{6,0,834},{134,0,1248},{7,11,453},{7,11,635},
+{7,11,796},{8,11,331},{9,11,328},{9,11,330},{9,11,865},{10,11,119},{10,11,235},{
+11,11,111},{11,11,129},{11,11,240},{12,11,31},{12,11,66},{12,11,222},{12,11,269}
+,{12,11,599},{12,11,689},{13,11,186},{13,11,364},{142,11,345},{7,0,1672},{139,0,
+189},{133,10,797},{133,10,565},{6,0,1548},{6,11,98},{7,11,585},{135,11,702},{9,0
+,968},{15,0,192},{149,0,56},{4,10,252},{6,11,37},{7,11,299},{7,10,1068},{7,11,
+1666},{8,11,195},{8,11,316},{9,11,178},{9,11,276},{9,11,339},{9,11,536},{10,11,
+102},{10,11,362},{10,10,434},{10,11,785},{11,11,55},{11,11,149},{11,10,228},{11,
+10,426},{11,11,773},{13,10,231},{13,11,416},{13,11,419},{14,11,38},{14,11,41},{
+14,11,210},{18,10,106},{148,10,87},{4,0,751},{11,0,390},{140,0,32},{4,0,409},{
+133,0,78},{11,11,458},{12,11,15},{140,11,432},{7,0,1602},{10,0,257},{10,0,698},{
+11,0,544},{11,0,585},{12,0,212},{13,0,307},{5,10,231},{7,10,601},{9,10,277},{9,
+10,674},{10,10,178},{10,10,418},{10,10,509},{11,10,531},{12,10,113},{12,10,475},
+{13,10,99},{142,10,428},{6,0,473},{145,0,105},{6,0,1949},{15,0,156},{133,11,645}
+,{7,10,1591},{144,10,43},{135,0,1779},{135,10,1683},{4,11,290},{135,11,1356},{
+134,0,763},{6,11,70},{7,11,1292},{10,11,762},{139,11,288},{142,0,29},{140,11,428
+},{7,0,883},{7,11,131},{7,11,422},{8,11,210},{140,11,573},{134,0,488},{4,10,399}
+,{5,10,119},{5,10,494},{7,10,751},{137,10,556},{133,0,617},{132,11,936},{139,0,
+50},{7,0,1518},{139,0,694},{137,0,785},{4,0,546},{135,0,2042},{7,11,716},{13,11,
+97},{141,11,251},{132,11,653},{145,0,22},{134,0,1016},{4,0,313},{133,0,577},{136
+,11,657},{8,0,184},{141,0,433},{135,0,935},{6,0,720},{9,0,114},{146,11,80},{12,0
+,186},{12,0,292},{14,0,100},{18,0,70},{7,10,594},{7,10,851},{7,10,1858},{9,10,
+411},{9,10,574},{9,10,666},{9,10,737},{10,10,346},{10,10,712},{11,10,246},{11,10
+,432},{11,10,517},{11,10,647},{11,10,679},{11,10,727},{12,10,304},{12,10,305},{
+12,10,323},{12,10,483},{12,10,572},{12,10,593},{12,10,602},{13,10,95},{13,10,101
+},{13,10,171},{13,10,315},{13,10,378},{13,10,425},{13,10,475},{14,10,63},{14,10,
+380},{14,10,384},{15,10,133},{18,10,112},{148,10,72},{135,10,1093},{135,11,1836}
+,{132,10,679},{137,10,203},{11,0,402},{12,0,109},{12,0,431},{13,0,179},{13,0,206
+},{14,0,217},{16,0,3},{148,0,53},{7,11,1368},{8,11,232},{8,11,361},{10,11,682},{
+138,11,742},{137,10,714},{5,0,886},{6,0,46},{6,0,1790},{7,0,14},{7,0,732},{7,0,
+1654},{8,0,95},{8,0,327},{8,0,616},{9,0,892},{10,0,598},{10,0,769},{11,0,134},{
+11,0,747},{12,0,378},{14,0,97},{137,11,534},{4,0,969},{136,10,825},{137,11,27},{
+6,0,727},{142,11,12},{133,0,1021},{134,0,1190},{134,11,1657},{5,10,143},{5,10,
+769},{6,10,1760},{7,10,682},{7,10,1992},{136,10,736},{132,0,153},{135,11,127},{
+133,0,798},{132,0,587},{6,0,598},{7,0,42},{8,0,695},{10,0,212},{11,0,158},{14,0,
+196},{145,0,85},{133,10,860},{6,0,1929},{134,0,1933},{5,0,957},{5,0,1008},{9,0,
+577},{12,0,141},{6,10,422},{7,10,0},{7,10,1544},{8,11,364},{11,10,990},{12,10,
+453},{13,10,47},{141,10,266},{134,0,1319},{4,0,129},{135,0,465},{7,0,470},{7,0,
+1057},{7,0,1201},{9,0,755},{11,0,906},{140,0,527},{7,0,908},{146,0,7},{5,0,148},
+{136,0,450},{5,10,515},{137,10,131},{7,10,1605},{11,10,962},{146,10,139},{132,10
+,646},{134,0,1166},{4,10,396},{7,10,728},{9,10,117},{13,10,202},{148,10,51},{6,
+10,121},{6,10,124},{6,10,357},{7,10,1138},{7,10,1295},{8,10,162},{139,10,655},{
+14,0,374},{142,11,374},{138,0,253},{139,0,1003},{5,11,909},{9,11,849},{138,11,
+805},{133,10,237},{7,11,525},{7,11,1579},{8,11,497},{136,11,573},{137,0,46},{132
+,0,879},{134,0,806},{135,0,1868},{6,0,1837},{134,0,1846},{6,0,730},{134,0,881},{
+7,0,965},{7,0,1460},{7,0,1604},{7,11,193},{7,11,397},{7,11,1105},{8,11,124},{8,
+11,619},{9,11,305},{10,11,264},{11,11,40},{12,11,349},{13,11,134},{13,11,295},{
+14,11,155},{15,11,120},{146,11,105},{136,0,506},{143,0,10},{4,11,262},{7,11,342}
+,{7,10,571},{7,10,1877},{10,10,366},{141,11,23},{133,11,641},{10,0,22},{9,10,513
+},{10,10,39},{12,10,122},{140,10,187},{135,11,1431},{150,11,49},{4,11,99},{6,11,
+250},{6,11,346},{8,11,127},{138,11,81},{6,0,2014},{8,0,928},{10,0,960},{10,0,979
+},{140,0,996},{134,0,296},{132,11,915},{5,11,75},{9,11,517},{10,11,470},{12,11,
+155},{141,11,224},{137,10,873},{4,0,854},{140,11,18},{134,0,587},{7,10,107},{7,
+10,838},{8,10,550},{138,10,401},{11,0,636},{15,0,145},{17,0,34},{19,0,50},{23,0,
+20},{11,10,588},{11,10,864},{11,10,968},{143,10,160},{135,11,216},{7,0,982},{10,
+0,32},{143,0,56},{133,10,768},{133,11,954},{6,11,304},{7,11,1114},{8,11,418},{10
+,11,345},{11,11,341},{11,11,675},{141,11,40},{9,11,410},{139,11,425},{136,0,941}
+,{5,0,435},{132,10,894},{5,0,85},{6,0,419},{7,0,134},{7,0,305},{7,0,361},{7,0,
+1337},{8,0,71},{140,0,519},{140,0,688},{135,0,740},{5,0,691},{7,0,345},{9,0,94},
+{140,0,169},{5,0,183},{6,0,582},{10,0,679},{140,0,435},{134,11,14},{6,0,945},{
+135,0,511},{134,11,1708},{5,11,113},{6,11,243},{7,11,1865},{11,11,161},{16,11,37
+},{145,11,99},{132,11,274},{137,0,539},{7,0,1993},{8,0,684},{134,10,272},{6,0,
+659},{134,0,982},{4,10,9},{5,10,128},{7,10,368},{11,10,480},{148,10,3},{134,0,
+583},{132,0,803},{133,0,704},{4,0,179},{5,0,198},{133,0,697},{7,0,347},{7,0,971}
+,{8,0,181},{10,0,711},{135,11,166},{136,10,682},{4,10,2},{7,10,545},{7,10,894},{
+136,11,521},{135,0,481},{132,0,243},{5,0,203},{7,0,19},{7,0,71},{7,0,113},{10,0,
+405},{11,0,357},{142,0,240},{5,11,725},{5,11,727},{135,11,1811},{6,0,826},{137,
+11,304},{7,0,1450},{139,0,99},{133,11,654},{134,0,492},{5,0,134},{6,0,408},{6,0,
+495},{7,0,1593},{6,11,273},{10,11,188},{13,11,377},{146,11,77},{9,10,769},{140,
+10,185},{135,11,410},{142,0,4},{4,0,665},{134,11,1785},{4,0,248},{7,0,137},{137,
+0,349},{5,10,530},{142,10,113},{7,0,1270},{139,0,612},{132,11,780},{5,0,371},{
+135,0,563},{135,0,826},{6,0,1535},{23,0,21},{151,0,23},{4,0,374},{7,0,547},{7,0,
+1700},{7,0,1833},{139,0,858},{133,10,556},{7,11,612},{8,11,545},{8,11,568},{8,11
+,642},{9,11,717},{10,11,541},{10,11,763},{11,11,449},{12,11,489},{13,11,153},{13
+,11,296},{14,11,138},{14,11,392},{15,11,50},{16,11,6},{16,11,12},{148,11,9},{9,0
+,311},{141,0,42},{8,10,16},{140,10,568},{6,0,1968},{6,0,2027},{138,0,991},{6,0,
+1647},{7,0,1552},{7,0,2010},{9,0,494},{137,0,509},{133,11,948},{6,10,186},{137,
+10,426},{134,0,769},{134,0,642},{132,10,585},{6,0,123},{7,0,214},{9,0,728},{10,0
+,157},{11,0,346},{11,0,662},{143,0,106},{142,11,381},{135,0,1435},{4,11,532},{5,
+11,706},{135,11,662},{5,11,837},{134,11,1651},{4,10,93},{5,10,252},{6,10,229},{7
+,10,291},{9,10,550},{139,10,644},{148,0,79},{137,10,749},{134,0,1425},{137,10,
+162},{4,11,362},{7,11,52},{7,11,303},{140,11,166},{132,10,381},{4,11,330},{7,11,
+933},{7,11,2012},{136,11,292},{135,11,767},{4,0,707},{5,0,588},{6,0,393},{13,0,
+106},{18,0,49},{147,0,41},{6,0,211},{7,0,1690},{11,0,486},{140,0,369},{137,11,
+883},{4,11,703},{135,11,207},{4,0,187},{5,0,184},{5,0,690},{7,0,1869},{10,0,756}
+,{139,0,783},{132,11,571},{134,0,1382},{5,0,175},{6,10,77},{6,10,157},{7,10,974}
+,{7,10,1301},{7,10,1339},{7,10,1490},{7,10,1873},{137,10,628},{134,0,1493},{5,11
+,873},{133,11,960},{134,0,1007},{12,11,93},{12,11,501},{13,11,362},{14,11,151},{
+15,11,40},{15,11,59},{16,11,46},{17,11,25},{18,11,14},{18,11,134},{19,11,25},{19
+,11,69},{20,11,16},{20,11,19},{20,11,66},{21,11,23},{21,11,25},{150,11,42},{11,
+10,919},{141,10,409},{134,0,219},{5,0,582},{6,0,1646},{7,0,99},{7,0,1962},{7,0,
+1986},{8,0,515},{8,0,773},{9,0,23},{9,0,491},{12,0,620},{142,0,93},{133,0,851},{
+5,11,33},{134,11,470},{135,11,1291},{134,0,1278},{135,11,1882},{135,10,1489},{
+132,0,1000},{138,0,982},{8,0,762},{8,0,812},{137,0,910},{6,11,47},{7,11,90},{7,
+11,664},{7,11,830},{7,11,1380},{7,11,2025},{8,11,448},{136,11,828},{4,0,98},{4,0
+,940},{6,0,1819},{6,0,1834},{6,0,1841},{7,0,1365},{8,0,859},{8,0,897},{8,0,918},
+{9,0,422},{9,0,670},{10,0,775},{10,0,894},{10,0,909},{10,0,910},{10,0,935},{11,0
+,210},{12,0,750},{12,0,755},{13,0,26},{13,0,457},{13,0,476},{16,0,100},{16,0,109
+},{18,0,173},{18,0,175},{8,10,398},{9,10,681},{139,10,632},{9,11,417},{137,11,
+493},{136,10,645},{138,0,906},{134,0,1730},{134,10,20},{133,11,1019},{134,0,1185
+},{10,0,40},{136,10,769},{9,0,147},{134,11,208},{140,0,650},{5,0,209},{6,0,30},{
+11,0,56},{139,0,305},{132,0,553},{138,11,344},{6,11,68},{7,11,398},{7,11,448},{7
+,11,1629},{7,11,1813},{8,11,387},{8,11,442},{9,11,710},{10,11,282},{138,11,722},
+{5,0,597},{14,0,20},{142,11,20},{135,0,1614},{135,10,1757},{4,0,150},{5,0,303},{
+6,0,327},{135,10,937},{16,0,49},{7,10,1652},{144,11,49},{8,0,192},{10,0,78},{141
+,0,359},{135,0,786},{143,0,134},{6,0,1638},{7,0,79},{7,0,496},{9,0,138},{10,0,
+336},{11,0,12},{12,0,412},{12,0,440},{142,0,305},{136,11,491},{4,10,579},{5,10,
+226},{5,10,323},{135,10,960},{7,0,204},{7,0,415},{8,0,42},{10,0,85},{139,0,564},
+{132,0,614},{4,11,403},{5,11,441},{7,11,450},{11,11,101},{12,11,193},{141,11,430
+},{135,11,1927},{135,11,1330},{4,0,3},{5,0,247},{5,0,644},{7,0,744},{7,0,1207},{
+7,0,1225},{7,0,1909},{146,0,147},{136,0,942},{4,0,1019},{134,0,2023},{5,11,679},
+{133,10,973},{5,0,285},{9,0,67},{13,0,473},{143,0,82},{7,11,328},{137,11,326},{
+151,0,8},{6,10,135},{135,10,1176},{135,11,1128},{134,0,1309},{135,11,1796},{135,
+10,314},{4,11,574},{7,11,350},{7,11,1024},{8,11,338},{9,11,677},{10,11,808},{139
+,11,508},{7,11,818},{17,11,14},{17,11,45},{18,11,75},{148,11,18},{146,10,4},{135
+,11,1081},{4,0,29},{6,0,532},{7,0,1628},{7,0,1648},{9,0,350},{10,0,433},{11,0,97
+},{11,0,557},{11,0,745},{12,0,289},{12,0,335},{12,0,348},{12,0,606},{13,0,116},{
+13,0,233},{13,0,466},{14,0,181},{14,0,209},{14,0,232},{14,0,236},{14,0,300},{16,
+0,41},{148,0,97},{7,0,318},{6,10,281},{8,10,282},{8,10,480},{8,10,499},{9,10,198
+},{10,10,143},{10,10,169},{10,10,211},{10,10,417},{10,10,574},{11,10,147},{11,10
+,395},{12,10,75},{12,10,407},{12,10,608},{13,10,500},{142,10,251},{135,11,1676},
+{135,11,2037},{135,0,1692},{5,0,501},{7,0,1704},{9,0,553},{11,0,520},{12,0,557},
+{141,0,249},{6,0,1527},{14,0,324},{15,0,55},{15,0,80},{14,11,324},{15,11,55},{
+143,11,80},{135,10,1776},{8,0,988},{137,11,297},{132,10,419},{142,0,223},{139,11
+,234},{7,0,1123},{12,0,508},{14,0,102},{14,0,226},{144,0,57},{4,10,138},{7,10,
+1012},{7,10,1280},{137,10,76},{7,0,1764},{5,10,29},{140,10,638},{134,0,2015},{
+134,0,1599},{138,11,56},{6,11,306},{7,11,1140},{7,11,1340},{8,11,133},{138,11,
+449},{139,11,1011},{6,10,1710},{135,10,2038},{7,11,1763},{140,11,310},{6,0,129},
+{4,10,17},{5,10,23},{7,10,995},{11,10,383},{11,10,437},{12,10,460},{140,10,532},
+{5,11,329},{136,11,260},{133,10,862},{132,0,534},{6,0,811},{135,0,626},{132,11,
+657},{4,0,25},{5,0,60},{6,0,504},{7,0,614},{7,0,1155},{12,0,0},{152,11,7},{7,0,
+1248},{11,0,621},{139,0,702},{137,0,321},{8,10,70},{12,10,171},{141,10,272},{10,
+10,233},{139,10,76},{4,0,379},{7,0,1397},{134,10,442},{5,11,66},{7,11,1896},{136
+,11,288},{134,11,1643},{134,10,1709},{4,11,21},{5,11,91},{5,11,570},{5,11,648},{
+5,11,750},{5,11,781},{6,11,54},{6,11,112},{6,11,402},{6,11,1732},{7,11,315},{7,
+11,749},{7,11,1347},{7,11,1900},{9,11,78},{9,11,508},{10,11,611},{11,11,510},{11
+,11,728},{13,11,36},{14,11,39},{16,11,83},{17,11,124},{148,11,30},{4,0,118},{6,0
+,274},{6,0,361},{7,0,75},{141,0,441},{10,11,322},{10,11,719},{139,11,407},{147,
+10,119},{12,11,549},{14,11,67},{147,11,60},{11,10,69},{12,10,105},{12,10,117},{
+13,10,213},{14,10,13},{14,10,62},{14,10,177},{14,10,421},{15,10,19},{146,10,141}
+,{9,0,841},{137,10,309},{7,10,608},{7,10,976},{8,11,125},{8,11,369},{8,11,524},{
+9,10,146},{10,10,206},{10,11,486},{10,10,596},{11,11,13},{11,11,381},{11,11,736}
+,{11,11,766},{11,11,845},{13,11,114},{13,10,218},{13,11,292},{14,11,47},{142,10,
+153},{12,0,693},{135,11,759},{5,0,314},{6,0,221},{7,0,419},{10,0,650},{11,0,396}
+,{12,0,156},{13,0,369},{14,0,333},{145,0,47},{6,11,1684},{6,11,1731},{7,11,356},
+{7,11,1932},{8,11,54},{8,11,221},{9,11,225},{9,11,356},{10,11,77},{10,11,446},{
+10,11,731},{12,11,404},{141,11,491},{132,11,375},{4,10,518},{135,10,1136},{4,0,
+913},{4,11,411},{11,11,643},{140,11,115},{4,11,80},{133,11,44},{8,10,689},{137,
+10,863},{138,0,880},{4,10,18},{7,10,145},{7,10,444},{7,10,1278},{8,10,49},{8,10,
+400},{9,10,71},{9,10,250},{10,10,459},{12,10,160},{144,10,24},{136,0,475},{5,0,
+1016},{5,11,299},{135,11,1083},{7,0,602},{8,0,179},{10,0,781},{140,0,126},{6,0,
+329},{138,0,111},{135,0,1864},{4,11,219},{7,11,1761},{137,11,86},{6,0,1888},{6,0
+,1892},{6,0,1901},{6,0,1904},{9,0,953},{9,0,985},{9,0,991},{9,0,1001},{12,0,818}
+,{12,0,846},{12,0,847},{12,0,861},{12,0,862},{12,0,873},{12,0,875},{12,0,877},{
+12,0,879},{12,0,881},{12,0,884},{12,0,903},{12,0,915},{12,0,926},{12,0,939},{15,
+0,182},{15,0,219},{15,0,255},{18,0,191},{18,0,209},{18,0,211},{149,0,41},{5,11,
+328},{135,11,918},{137,0,780},{12,0,82},{143,0,36},{133,10,1010},{5,0,821},{134,
+0,1687},{133,11,514},{132,0,956},{134,0,1180},{10,0,112},{5,10,87},{7,10,313},{7
+,10,1103},{10,10,582},{11,10,389},{11,10,813},{12,10,385},{13,10,286},{14,10,124
+},{146,10,108},{5,0,71},{7,0,1407},{9,0,704},{10,0,261},{10,0,619},{11,0,547},{
+11,0,619},{143,0,157},{4,0,531},{5,0,455},{5,11,301},{6,11,571},{14,11,49},{146,
+11,102},{132,10,267},{6,0,385},{7,0,2008},{9,0,337},{138,0,517},{133,11,726},{
+133,11,364},{4,11,76},{7,11,1550},{9,11,306},{9,11,430},{9,11,663},{10,11,683},{
+11,11,427},{11,11,753},{12,11,334},{12,11,442},{14,11,258},{14,11,366},{143,11,
+131},{6,0,1865},{6,0,1879},{6,0,1881},{6,0,1894},{6,0,1908},{9,0,915},{9,0,926},
+{9,0,940},{9,0,943},{9,0,966},{9,0,980},{9,0,989},{9,0,1005},{9,0,1010},{12,0,
+813},{12,0,817},{12,0,840},{12,0,843},{12,0,855},{12,0,864},{12,0,871},{12,0,872
+},{12,0,899},{12,0,905},{12,0,924},{15,0,171},{15,0,181},{15,0,224},{15,0,235},{
+15,0,251},{146,0,184},{137,11,52},{5,0,16},{6,0,86},{6,0,603},{7,0,292},{7,0,561
+},{8,0,257},{8,0,382},{9,0,721},{9,0,778},{11,0,581},{140,0,466},{4,0,486},{5,0,
+491},{135,10,1121},{4,0,72},{6,0,265},{135,0,1300},{135,11,1183},{10,10,249},{
+139,10,209},{132,10,561},{137,11,519},{4,11,656},{4,10,760},{135,11,779},{9,10,
+154},{140,10,485},{135,11,1793},{135,11,144},{136,10,255},{133,0,621},{4,10,368}
+,{135,10,641},{135,11,1373},{7,11,554},{7,11,605},{141,11,10},{137,0,234},{5,0,
+815},{6,0,1688},{134,0,1755},{5,11,838},{5,11,841},{134,11,1649},{7,0,1987},{7,0
+,2040},{136,0,743},{133,11,1012},{6,0,197},{136,0,205},{6,0,314},{134,11,314},{
+144,11,53},{6,11,251},{7,11,365},{7,11,1357},{7,11,1497},{8,11,154},{141,11,281}
+,{133,11,340},{6,0,452},{7,0,312},{138,0,219},{138,0,589},{4,0,333},{9,0,176},{
+12,0,353},{141,0,187},{9,10,92},{147,10,91},{134,0,1110},{11,0,47},{139,11,495},
+{6,10,525},{8,10,806},{9,10,876},{140,10,284},{8,11,261},{9,11,144},{9,11,466},{
+10,11,370},{12,11,470},{13,11,144},{142,11,348},{137,11,897},{8,0,863},{8,0,864}
+,{8,0,868},{8,0,884},{10,0,866},{10,0,868},{10,0,873},{10,0,911},{10,0,912},{10,
+0,944},{12,0,727},{6,11,248},{9,11,546},{10,11,535},{11,11,681},{141,11,135},{6,
+0,300},{135,0,1515},{134,0,1237},{139,10,958},{133,10,594},{140,11,250},{134,0,
+1685},{134,11,567},{7,0,135},{8,0,7},{8,0,62},{9,0,243},{10,0,658},{10,0,697},{
+11,0,456},{139,0,756},{9,0,395},{138,0,79},{6,10,1641},{136,10,820},{4,10,302},{
+135,10,1766},{134,11,174},{135,10,1313},{135,0,631},{134,10,1674},{134,11,395},{
+138,0,835},{7,0,406},{7,0,459},{8,0,606},{139,0,726},{134,11,617},{134,0,979},{6
+,10,389},{7,10,149},{9,10,142},{138,10,94},{5,11,878},{133,11,972},{6,10,8},{7,
+10,1881},{8,10,91},{136,11,511},{133,0,612},{132,11,351},{4,0,372},{7,0,482},{8,
+0,158},{9,0,602},{9,0,615},{10,0,245},{10,0,678},{10,0,744},{11,0,248},{139,0,
+806},{5,0,854},{135,0,1991},{132,11,286},{135,11,344},{7,11,438},{7,11,627},{7,
+11,1516},{8,11,40},{9,11,56},{9,11,294},{10,11,30},{10,11,259},{11,11,969},{146,
+11,148},{135,0,1492},{5,11,259},{7,11,414},{7,11,854},{142,11,107},{135,10,1746}
+,{6,0,833},{134,0,998},{135,10,24},{6,0,750},{135,0,1739},{4,10,503},{135,10,
+1661},{5,10,130},{7,10,1314},{9,10,610},{10,10,718},{11,10,601},{11,10,819},{11,
+10,946},{140,10,536},{10,10,149},{11,10,280},{142,10,336},{132,11,738},{135,10,
+1946},{5,0,195},{135,0,1685},{7,0,1997},{8,0,730},{139,0,1006},{151,11,17},{133,
+11,866},{14,0,463},{14,0,470},{150,0,61},{5,0,751},{8,0,266},{11,0,578},{4,10,
+392},{135,10,1597},{5,10,433},{9,10,633},{139,10,629},{135,0,821},{6,0,715},{134
+,0,1325},{133,11,116},{6,0,868},{132,11,457},{134,0,959},{6,10,234},{138,11,199}
+,{7,0,1053},{7,10,1950},{8,10,680},{11,10,817},{147,10,88},{7,10,1222},{138,10,
+386},{5,0,950},{5,0,994},{6,0,351},{134,0,1124},{134,0,1081},{7,0,1595},{6,10,5}
+,{11,10,249},{12,10,313},{16,10,66},{145,10,26},{148,0,59},{5,11,527},{6,11,189}
+,{135,11,859},{5,10,963},{6,10,1773},{11,11,104},{11,11,554},{15,11,60},{143,11,
+125},{135,0,47},{137,0,684},{134,11,116},{134,0,1606},{134,0,777},{7,0,1020},{8,
+10,509},{136,10,792},{135,0,1094},{132,0,350},{133,11,487},{4,11,86},{5,11,667},
+{5,11,753},{6,11,316},{6,11,455},{135,11,946},{7,0,1812},{13,0,259},{13,0,356},{
+14,0,242},{147,0,114},{132,10,931},{133,0,967},{4,0,473},{7,0,623},{8,0,808},{9,
+0,871},{9,0,893},{11,0,38},{11,0,431},{12,0,112},{12,0,217},{12,0,243},{12,0,562
+},{12,0,663},{12,0,683},{13,0,141},{13,0,197},{13,0,227},{13,0,406},{13,0,487},{
+14,0,156},{14,0,203},{14,0,224},{14,0,256},{18,0,58},{150,0,0},{138,0,286},{7,10
+,943},{139,10,614},{135,10,1837},{150,11,45},{132,0,798},{4,0,222},{7,0,286},{
+136,0,629},{4,11,79},{7,11,1773},{10,11,450},{11,11,589},{13,11,332},{13,11,493}
+,{14,11,183},{14,11,334},{14,11,362},{14,11,368},{14,11,376},{14,11,379},{19,11,
+90},{19,11,103},{19,11,127},{148,11,90},{5,0,337},{11,0,513},{11,0,889},{11,0,
+961},{12,0,461},{13,0,79},{15,0,121},{4,10,90},{5,10,545},{7,10,754},{9,10,186},
+{10,10,72},{10,10,782},{11,10,577},{11,10,610},{12,10,354},{12,10,362},{140,10,
+595},{141,0,306},{136,0,146},{7,0,1646},{9,10,329},{11,10,254},{141,11,124},{4,0
+,465},{135,0,1663},{132,0,525},{133,11,663},{10,0,299},{18,0,74},{9,10,187},{11,
+10,1016},{145,10,44},{7,0,165},{7,0,919},{4,10,506},{136,10,517},{5,10,295},{135
+,10,1680},{133,11,846},{134,0,1064},{5,11,378},{7,11,1402},{7,11,1414},{8,11,465
+},{9,11,286},{10,11,185},{10,11,562},{10,11,635},{11,11,31},{11,11,393},{12,11,
+456},{13,11,312},{18,11,65},{18,11,96},{147,11,89},{132,0,596},{7,10,987},{9,10,
+688},{10,10,522},{11,10,788},{140,10,566},{6,0,82},{7,0,138},{7,0,517},{7,0,1741
+},{11,0,238},{4,11,648},{134,10,1775},{7,0,1233},{7,10,700},{7,10,940},{8,10,514
+},{9,10,116},{9,10,535},{10,10,118},{11,10,107},{11,10,148},{11,10,922},{12,10,
+254},{12,10,421},{142,10,238},{4,0,962},{6,0,1824},{8,0,894},{12,0,708},{12,0,
+725},{14,0,451},{20,0,94},{22,0,59},{150,0,62},{5,11,945},{6,11,1656},{6,11,1787
+},{7,11,167},{8,11,824},{9,11,391},{10,11,375},{139,11,185},{5,0,495},{7,0,834},
+{9,0,733},{139,0,378},{4,10,743},{135,11,1273},{6,0,1204},{7,11,1645},{8,11,352}
+,{137,11,249},{139,10,292},{133,0,559},{132,11,152},{9,0,499},{10,0,341},{15,0,
+144},{19,0,49},{7,10,1283},{9,10,227},{11,10,325},{11,10,408},{14,10,180},{146,
+10,47},{6,0,21},{6,0,1737},{7,0,1444},{136,0,224},{133,11,1006},{7,0,1446},{9,0,
+97},{17,0,15},{5,10,81},{7,10,146},{7,10,1342},{8,10,53},{8,10,561},{8,10,694},{
+8,10,754},{9,10,115},{9,10,894},{10,10,462},{10,10,813},{11,10,230},{11,10,657},
+{11,10,699},{11,10,748},{12,10,119},{12,10,200},{12,10,283},{142,10,273},{5,10,
+408},{137,10,747},{135,11,431},{135,11,832},{6,0,729},{134,0,953},{4,0,727},{8,0
+,565},{5,11,351},{7,11,264},{136,11,565},{134,0,1948},{5,0,519},{5,11,40},{7,11,
+598},{7,11,1638},{8,11,78},{9,11,166},{9,11,640},{9,11,685},{9,11,773},{11,11,
+215},{13,11,65},{14,11,172},{14,11,317},{145,11,6},{8,11,60},{9,11,343},{139,11,
+769},{137,11,455},{134,0,1193},{140,0,790},{7,11,1951},{8,11,765},{8,11,772},{
+140,11,671},{7,11,108},{8,11,219},{8,11,388},{9,11,639},{9,11,775},{11,11,275},{
+140,11,464},{132,11,468},{7,10,30},{8,10,86},{8,10,315},{8,10,700},{9,10,576},{9
+,10,858},{11,10,310},{11,10,888},{11,10,904},{12,10,361},{141,10,248},{5,11,15},
+{6,11,56},{7,11,1758},{8,11,500},{9,11,730},{11,11,331},{13,11,150},{142,11,282}
+,{4,0,402},{7,0,2},{8,0,323},{136,0,479},{138,10,839},{11,0,580},{142,0,201},{5,
+0,59},{135,0,672},{137,10,617},{146,0,34},{134,11,1886},{4,0,961},{136,0,896},{6
+,0,1285},{5,11,205},{6,11,438},{137,11,711},{134,10,428},{7,10,524},{8,10,169},{
+8,10,234},{9,10,480},{138,10,646},{148,0,46},{141,0,479},{133,11,534},{6,0,2019}
+,{134,10,1648},{4,0,85},{7,0,549},{7,10,1205},{138,10,637},{4,0,663},{5,0,94},{7
+,11,235},{7,11,1475},{15,11,68},{146,11,120},{6,11,443},{9,11,237},{9,11,571},{9
+,11,695},{10,11,139},{11,11,715},{12,11,417},{141,11,421},{132,0,783},{4,0,682},
+{8,0,65},{9,10,39},{10,10,166},{11,10,918},{12,10,635},{20,10,10},{22,10,27},{22
+,10,43},{150,10,52},{6,0,11},{135,0,187},{132,0,522},{4,0,52},{135,0,661},{4,0,
+383},{133,0,520},{135,11,546},{11,0,343},{142,0,127},{4,11,578},{7,10,157},{7,11
+,624},{7,11,916},{8,10,279},{10,11,256},{11,11,87},{139,11,703},{134,10,604},{4,
+0,281},{5,0,38},{7,0,194},{7,0,668},{7,0,1893},{137,0,397},{7,10,945},{11,10,713
+},{139,10,744},{139,10,1022},{9,0,635},{139,0,559},{5,11,923},{7,11,490},{12,11,
+553},{13,11,100},{14,11,118},{143,11,75},{132,0,975},{132,10,567},{137,10,859},{
+7,10,1846},{7,11,1846},{8,10,628},{136,11,628},{148,0,116},{138,11,750},{14,0,51
+},{14,11,51},{15,11,7},{148,11,20},{132,0,858},{134,0,1075},{4,11,924},{133,10,
+762},{136,0,535},{133,0,448},{10,10,784},{141,10,191},{133,10,298},{7,0,610},{
+135,0,1501},{7,10,633},{7,10,905},{7,10,909},{7,10,1538},{9,10,767},{140,10,636}
+,{4,11,265},{7,11,807},{135,11,950},{5,11,93},{12,11,267},{144,11,26},{136,0,191
+},{139,10,301},{135,10,1970},{135,0,267},{4,0,319},{5,0,699},{138,0,673},{6,0,
+336},{7,0,92},{7,0,182},{8,0,453},{8,0,552},{9,0,204},{9,0,285},{10,0,99},{11,0,
+568},{11,0,950},{12,0,94},{16,0,20},{16,0,70},{19,0,55},{12,10,644},{144,10,90},
+{6,0,551},{7,0,1308},{7,10,845},{7,11,994},{8,10,160},{137,10,318},{19,11,1},{19
+,11,26},{150,11,9},{7,0,1406},{9,0,218},{141,0,222},{5,0,256},{138,0,69},{5,11,
+233},{5,11,320},{6,11,140},{7,11,330},{136,11,295},{6,0,1980},{136,0,952},{4,0,
+833},{137,11,678},{133,11,978},{4,11,905},{6,11,1701},{137,11,843},{138,10,735},
+{136,10,76},{17,0,39},{148,0,36},{18,0,81},{146,11,81},{14,0,352},{17,0,53},{18,
+0,146},{18,0,152},{19,0,11},{150,0,54},{135,0,634},{138,10,841},{132,0,618},{4,0
+,339},{7,0,259},{17,0,73},{4,11,275},{140,11,376},{132,11,509},{7,11,273},{139,
+11,377},{4,0,759},{13,0,169},{137,10,804},{6,10,96},{135,10,1426},{4,10,651},{
+133,10,289},{7,0,1075},{8,10,35},{9,10,511},{10,10,767},{147,10,118},{6,0,649},{
+6,0,670},{136,0,482},{5,0,336},{6,0,341},{6,0,478},{6,0,1763},{136,0,386},{5,11,
+802},{7,11,2021},{8,11,805},{14,11,94},{15,11,65},{16,11,4},{16,11,77},{16,11,80
+},{145,11,5},{6,0,1035},{5,11,167},{5,11,899},{6,11,410},{137,11,777},{134,11,
+1705},{5,0,924},{133,0,969},{132,10,704},{135,0,73},{135,11,10},{135,10,1078},{5
+,11,11},{6,11,117},{6,11,485},{7,11,1133},{9,11,582},{9,11,594},{11,11,21},{11,
+11,818},{12,11,535},{141,11,86},{135,0,1971},{4,11,264},{7,11,1067},{8,11,204},{
+8,11,385},{139,11,953},{6,0,1458},{135,0,1344},{5,0,396},{134,0,501},{4,10,720},
+{133,10,306},{4,0,929},{5,0,799},{8,0,46},{8,0,740},{133,10,431},{7,11,646},{7,
+11,1730},{11,11,446},{141,11,178},{7,0,276},{5,10,464},{6,10,236},{7,10,696},{7,
+10,914},{7,10,1108},{7,10,1448},{9,10,15},{9,10,564},{10,10,14},{12,10,565},{13,
+10,449},{14,10,53},{15,10,13},{16,10,64},{145,10,41},{4,0,892},{133,0,770},{6,10
+,1767},{12,10,194},{145,10,107},{135,0,158},{5,10,840},{138,11,608},{134,0,1432}
+,{138,11,250},{8,11,794},{9,11,400},{10,11,298},{142,11,228},{151,0,25},{7,11,
+1131},{135,11,1468},{135,0,2001},{9,10,642},{11,10,236},{142,10,193},{4,10,68},{
+5,10,634},{6,10,386},{7,10,794},{8,10,273},{9,10,563},{10,10,105},{10,10,171},{
+11,10,94},{139,10,354},{136,11,724},{132,0,478},{11,11,512},{13,11,205},{19,11,
+30},{22,11,36},{151,11,19},{7,0,1461},{140,0,91},{6,11,190},{7,11,768},{135,11,
+1170},{4,0,602},{8,0,211},{4,10,95},{7,10,416},{139,10,830},{7,10,731},{13,10,20
+},{143,10,11},{6,0,1068},{135,0,1872},{4,0,13},{5,0,567},{7,0,1498},{9,0,124},{
+11,0,521},{12,0,405},{135,11,1023},{135,0,1006},{132,0,735},{138,0,812},{4,0,170
+},{135,0,323},{6,11,137},{9,11,75},{9,11,253},{10,11,194},{138,11,444},{5,0,304}
+,{7,0,1403},{5,10,864},{10,10,648},{11,10,671},{143,10,46},{135,11,1180},{133,10
+,928},{4,0,148},{133,0,742},{11,10,986},{140,10,682},{133,0,523},{135,11,1743},{
+7,0,730},{18,0,144},{19,0,61},{8,10,44},{9,10,884},{10,10,580},{11,10,399},{11,
+10,894},{143,10,122},{5,11,760},{7,11,542},{8,11,135},{136,11,496},{136,0,981},{
+133,0,111},{10,0,132},{11,0,191},{11,0,358},{139,0,460},{7,11,319},{7,11,355},{7
+,11,763},{10,11,389},{145,11,43},{134,0,890},{134,0,1420},{136,11,557},{133,10,
+518},{133,0,444},{135,0,1787},{135,10,1852},{8,0,123},{15,0,6},{144,0,7},{6,0,
+2041},{10,11,38},{139,11,784},{136,0,932},{5,0,937},{135,0,100},{6,0,995},{4,11,
+58},{5,11,286},{6,11,319},{7,11,402},{7,11,1254},{7,11,1903},{8,11,356},{140,11,
+408},{4,11,389},{9,11,181},{9,11,255},{10,11,8},{10,11,29},{10,11,816},{11,11,
+311},{11,11,561},{12,11,67},{141,11,181},{138,0,255},{5,0,138},{4,10,934},{136,
+10,610},{4,0,965},{10,0,863},{138,0,898},{10,10,804},{138,10,832},{12,0,631},{8,
+10,96},{9,10,36},{10,10,607},{11,10,423},{11,10,442},{12,10,309},{14,10,199},{15
+,10,90},{145,10,110},{134,0,1394},{4,0,652},{8,0,320},{22,0,6},{22,0,16},{9,10,
+13},{9,10,398},{9,10,727},{10,10,75},{10,10,184},{10,10,230},{10,10,564},{10,10,
+569},{11,10,973},{12,10,70},{12,10,189},{13,10,57},{141,10,257},{6,0,897},{134,0
+,1333},{4,0,692},{133,0,321},{133,11,373},{135,0,922},{5,0,619},{133,0,698},{137
+,10,631},{5,10,345},{135,10,1016},{9,0,957},{9,0,1018},{12,0,828},{12,0,844},{12
+,0,897},{12,0,901},{12,0,943},{15,0,180},{18,0,197},{18,0,200},{18,0,213},{18,0,
+214},{146,0,226},{5,0,917},{134,0,1659},{135,0,1100},{134,0,1173},{134,0,1930},{
+5,0,251},{5,0,956},{8,0,268},{9,0,214},{146,0,142},{133,10,673},{137,10,850},{4,
+10,287},{133,10,1018},{132,11,672},{5,0,346},{5,0,711},{8,0,390},{11,11,752},{
+139,11,885},{5,10,34},{10,10,724},{12,10,444},{13,10,354},{18,10,32},{23,10,24},
+{23,10,31},{152,10,5},{4,11,710},{134,11,606},{134,0,744},{134,10,382},{133,11,
+145},{4,10,329},{7,11,884},{140,11,124},{4,11,467},{5,11,405},{134,11,544},{9,10
+,846},{138,10,827},{133,0,624},{9,11,372},{15,11,2},{19,11,10},{147,11,18},{4,11
+,387},{135,11,1288},{5,0,783},{7,0,1998},{135,0,2047},{132,10,906},{136,10,366},
+{135,11,550},{4,10,123},{4,10,649},{5,10,605},{7,10,1509},{136,10,36},{134,0,
+1125},{132,0,594},{133,10,767},{135,11,1227},{136,11,467},{4,11,576},{135,11,
+1263},{4,0,268},{7,0,1534},{135,11,1534},{4,10,273},{5,10,658},{5,11,919},{5,10,
+995},{134,11,1673},{133,0,563},{134,10,72},{135,10,1345},{4,11,82},{5,11,333},{5
+,11,904},{6,11,207},{7,11,325},{7,11,1726},{8,11,101},{10,11,778},{139,11,220},{
+5,0,37},{6,0,39},{6,0,451},{7,0,218},{7,0,667},{7,0,1166},{7,0,1687},{8,0,662},{
+16,0,2},{133,10,589},{134,0,1332},{133,11,903},{134,0,508},{5,10,117},{6,10,514}
+,{6,10,541},{7,10,1164},{7,10,1436},{8,10,220},{8,10,648},{10,10,688},{11,10,560
+},{140,11,147},{6,11,555},{135,11,485},{133,10,686},{7,0,453},{7,0,635},{7,0,796
+},{8,0,331},{9,0,330},{9,0,865},{10,0,119},{10,0,235},{11,0,111},{11,0,129},{11,
+0,240},{12,0,31},{12,0,66},{12,0,222},{12,0,269},{12,0,599},{12,0,684},{12,0,689
+},{12,0,691},{142,0,345},{135,0,1834},{4,11,705},{7,11,615},{138,11,251},{136,11
+,345},{137,0,527},{6,0,98},{7,0,702},{135,0,991},{11,0,576},{14,0,74},{7,10,196}
+,{10,10,765},{11,10,347},{11,10,552},{11,10,790},{12,10,263},{13,10,246},{13,10,
+270},{13,10,395},{14,10,176},{14,10,190},{14,10,398},{14,10,412},{15,10,32},{15,
+10,63},{16,10,88},{147,10,105},{134,11,90},{13,0,84},{141,0,122},{6,0,37},{7,0,
+299},{7,0,1666},{8,0,195},{8,0,316},{9,0,178},{9,0,276},{9,0,339},{9,0,536},{10,
+0,102},{10,0,362},{10,0,785},{11,0,55},{11,0,149},{11,0,773},{13,0,416},{13,0,
+419},{14,0,38},{14,0,41},{142,0,210},{5,10,381},{135,10,1792},{7,11,813},{12,11,
+497},{141,11,56},{7,10,616},{138,10,413},{133,0,645},{6,11,125},{135,11,1277},{
+132,0,290},{6,0,70},{7,0,1292},{10,0,762},{139,0,288},{6,10,120},{7,10,1188},{7,
+10,1710},{8,10,286},{9,10,667},{11,10,592},{139,10,730},{135,11,1784},{7,0,1315}
+,{135,11,1315},{134,0,1955},{135,10,1146},{7,0,131},{7,0,422},{8,0,210},{140,0,
+573},{4,10,352},{135,10,687},{139,0,797},{143,0,38},{14,0,179},{15,0,151},{150,0
+,11},{7,0,488},{4,10,192},{5,10,49},{6,10,200},{6,10,293},{134,10,1696},{132,0,
+936},{135,11,703},{6,11,160},{7,11,1106},{9,11,770},{10,11,618},{11,11,112},{140
+,11,413},{5,0,453},{134,0,441},{135,0,595},{132,10,650},{132,10,147},{6,0,991},{
+6,0,1182},{12,11,271},{145,11,109},{133,10,934},{140,11,221},{132,0,653},{7,0,
+505},{135,0,523},{134,0,903},{135,11,479},{7,11,304},{9,11,646},{9,11,862},{10,
+11,262},{11,11,696},{12,11,208},{15,11,79},{147,11,108},{146,0,80},{135,11,981},
+{142,0,432},{132,0,314},{137,11,152},{7,0,1368},{8,0,232},{8,0,361},{10,0,682},{
+138,0,742},{135,11,1586},{9,0,534},{4,11,434},{11,11,663},{12,11,210},{13,11,166
+},{13,11,310},{14,11,373},{147,11,43},{7,11,1091},{135,11,1765},{6,11,550},{135,
+11,652},{137,0,27},{142,0,12},{4,10,637},{5,11,553},{7,11,766},{138,11,824},{7,
+11,737},{8,11,298},{136,11,452},{7,0,736},{139,0,264},{134,0,1657},{133,11,292},
+{138,11,135},{6,0,844},{134,0,1117},{135,0,127},{9,10,867},{138,10,837},{6,0,
+1184},{134,0,1208},{134,0,1294},{136,0,364},{6,0,1415},{7,0,1334},{11,0,125},{6,
+10,170},{7,11,393},{8,10,395},{8,10,487},{10,11,603},{11,11,206},{141,10,147},{
+137,11,748},{4,11,912},{137,11,232},{4,10,535},{136,10,618},{137,0,792},{7,11,
+1973},{136,11,716},{135,11,98},{5,0,909},{9,0,849},{138,0,805},{4,0,630},{132,0,
+699},{5,11,733},{14,11,103},{150,10,23},{12,11,158},{18,11,8},{19,11,62},{20,11,
+6},{22,11,4},{23,11,2},{151,11,9},{132,0,968},{132,10,778},{132,10,46},{5,10,811
+},{6,10,1679},{6,10,1714},{135,10,2032},{6,0,1446},{7,10,1458},{9,10,407},{139,
+10,15},{7,0,206},{7,0,397},{7,0,621},{7,0,640},{8,0,124},{8,0,619},{9,0,305},{9,
+0,643},{10,0,264},{10,0,628},{11,0,40},{12,0,349},{13,0,134},{13,0,295},{14,0,
+155},{15,0,120},{18,0,105},{6,10,34},{7,10,1089},{8,10,708},{8,10,721},{9,10,363
+},{148,10,98},{4,0,262},{5,0,641},{135,0,342},{137,11,72},{4,0,99},{6,0,250},{6,
+0,346},{8,0,127},{138,0,81},{132,0,915},{5,0,75},{9,0,517},{10,0,470},{12,0,155}
+,{141,0,224},{132,10,462},{11,11,600},{11,11,670},{141,11,245},{142,0,83},{5,10,
+73},{6,10,23},{134,10,338},{6,0,1031},{139,11,923},{7,11,164},{7,11,1571},{9,11,
+107},{140,11,225},{134,0,1470},{133,0,954},{6,0,304},{8,0,418},{10,0,345},{11,0,
+341},{139,0,675},{9,0,410},{139,0,425},{4,11,27},{5,11,484},{5,11,510},{6,11,434
+},{7,11,1000},{7,11,1098},{8,11,2},{136,11,200},{134,0,734},{140,11,257},{7,10,
+725},{8,10,498},{139,10,268},{134,0,1822},{135,0,1798},{135,10,773},{132,11,460}
+,{4,11,932},{133,11,891},{134,0,14},{132,10,583},{7,10,1462},{8,11,625},{139,10,
+659},{5,0,113},{6,0,243},{6,0,1708},{7,0,1865},{11,0,161},{16,0,37},{17,0,99},{
+133,10,220},{134,11,76},{5,11,461},{135,11,1925},{140,0,69},{8,11,92},{137,11,
+221},{139,10,803},{132,10,544},{4,0,274},{134,0,922},{132,0,541},{5,0,627},{6,10
+,437},{6,10,564},{11,10,181},{141,10,183},{135,10,1192},{7,0,166},{132,11,763},{
+133,11,253},{134,0,849},{9,11,73},{10,11,110},{14,11,185},{145,11,119},{5,11,212
+},{12,11,35},{141,11,382},{133,0,717},{137,0,304},{136,0,600},{133,0,654},{6,0,
+273},{10,0,188},{13,0,377},{146,0,77},{4,10,790},{5,10,273},{134,10,394},{132,0,
+543},{135,0,410},{11,0,98},{11,0,524},{141,0,87},{132,0,941},{135,11,1175},{4,0,
+250},{7,0,1612},{11,0,186},{12,0,133},{6,10,127},{7,10,1511},{8,10,613},{12,10,
+495},{12,10,586},{12,10,660},{12,10,668},{14,10,385},{15,10,118},{17,10,20},{146
+,10,98},{6,0,1785},{133,11,816},{134,0,1339},{7,0,961},{7,0,1085},{7,0,1727},{8,
+0,462},{6,10,230},{135,11,1727},{9,0,636},{135,10,1954},{132,0,780},{5,11,869},{
+5,11,968},{6,11,1626},{8,11,734},{136,11,784},{4,11,542},{6,11,1716},{6,11,1727}
+,{7,11,1082},{7,11,1545},{8,11,56},{8,11,118},{8,11,412},{8,11,564},{9,11,888},{
+9,11,908},{10,11,50},{10,11,423},{11,11,685},{11,11,697},{11,11,933},{12,11,299}
+,{13,11,126},{13,11,136},{13,11,170},{141,11,190},{134,11,226},{4,11,232},{9,11,
+202},{10,11,474},{140,11,433},{137,11,500},{5,0,529},{136,10,68},{132,10,654},{4
+,10,156},{7,10,998},{7,10,1045},{7,10,1860},{9,10,48},{9,10,692},{11,10,419},{
+139,10,602},{7,0,1276},{8,0,474},{9,0,652},{6,11,108},{7,11,1003},{7,11,1181},{
+136,11,343},{7,11,1264},{7,11,1678},{11,11,945},{12,11,341},{12,11,471},{140,11,
+569},{134,11,1712},{5,0,948},{12,0,468},{19,0,96},{148,0,24},{4,11,133},{7,11,
+711},{7,11,1298},{7,11,1585},{135,11,1929},{6,0,753},{140,0,657},{139,0,941},{6,
+11,99},{7,11,1808},{145,11,57},{6,11,574},{7,11,428},{7,11,1250},{10,11,669},{11
+,11,485},{11,11,840},{12,11,300},{142,11,250},{4,0,532},{5,0,706},{135,0,662},{5
+,0,837},{6,0,1651},{139,0,985},{7,0,1861},{9,10,197},{10,10,300},{12,10,473},{13
+,10,90},{141,10,405},{137,11,252},{6,11,323},{135,11,1564},{4,0,330},{4,0,863},{
+7,0,933},{7,0,2012},{8,0,292},{7,11,461},{8,11,775},{138,11,435},{132,10,606},{4
+,11,655},{7,11,850},{17,11,75},{146,11,137},{135,0,767},{7,10,1978},{136,10,676}
+,{132,0,641},{135,11,1559},{134,0,1233},{137,0,242},{17,0,114},{4,10,361},{133,
+10,315},{137,0,883},{132,10,461},{138,0,274},{134,0,2008},{134,0,1794},{4,0,703}
+,{135,0,207},{12,0,285},{132,10,472},{132,0,571},{5,0,873},{5,0,960},{8,0,823},{
+9,0,881},{136,11,577},{7,0,617},{10,0,498},{11,0,501},{12,0,16},{140,0,150},{138
+,10,747},{132,0,431},{133,10,155},{11,0,283},{11,0,567},{7,10,163},{8,10,319},{9
+,10,402},{10,10,24},{10,10,681},{11,10,200},{12,10,253},{12,10,410},{142,10,219}
+,{4,11,413},{5,11,677},{8,11,432},{140,11,280},{9,0,401},{5,10,475},{7,10,1780},
+{11,10,297},{11,10,558},{14,10,322},{147,10,76},{6,0,781},{9,0,134},{10,0,2},{10
+,0,27},{10,0,333},{11,0,722},{143,0,1},{5,0,33},{6,0,470},{139,0,424},{135,0,
+2006},{12,0,783},{135,10,1956},{136,0,274},{135,0,1882},{132,0,794},{135,0,1848}
+,{5,10,944},{134,10,1769},{6,0,47},{7,0,90},{7,0,664},{7,0,830},{7,0,1380},{7,0,
+2025},{8,0,448},{136,0,828},{132,10,144},{134,0,1199},{4,11,395},{139,11,762},{
+135,11,1504},{9,0,417},{137,0,493},{9,11,174},{10,11,164},{11,11,440},{11,11,841
+},{143,11,98},{134,11,426},{139,11,1002},{134,0,295},{134,0,816},{6,10,247},{137
+,10,555},{133,0,1019},{4,0,620},{5,11,476},{10,10,280},{138,10,797},{139,0,464},
+{5,11,76},{6,11,458},{6,11,497},{7,11,764},{7,11,868},{9,11,658},{10,11,594},{11
+,11,173},{11,11,566},{12,11,20},{12,11,338},{141,11,200},{134,0,208},{4,11,526},
+{7,11,1029},{135,11,1054},{132,11,636},{6,11,233},{7,11,660},{7,11,1124},{17,11,
+31},{19,11,22},{151,11,14},{10,0,442},{133,10,428},{10,0,930},{140,0,778},{6,0,
+68},{7,0,448},{7,0,1629},{7,0,1769},{7,0,1813},{8,0,442},{8,0,516},{9,0,710},{10
+,0,282},{10,0,722},{7,10,1717},{138,10,546},{134,0,1128},{11,0,844},{12,0,104},{
+140,0,625},{4,11,432},{135,11,824},{138,10,189},{133,0,787},{133,10,99},{4,11,
+279},{7,11,301},{137,11,362},{8,0,491},{4,10,397},{136,10,555},{4,11,178},{133,
+11,399},{134,0,711},{144,0,9},{4,0,403},{5,0,441},{7,0,450},{10,0,840},{11,0,101
+},{12,0,193},{141,0,430},{135,11,1246},{12,10,398},{20,10,39},{21,10,11},{150,10
+,41},{4,10,485},{7,10,353},{135,10,1523},{6,10,366},{7,10,1384},{7,10,1601},{135
+,11,1912},{7,0,396},{10,0,160},{135,11,396},{137,10,282},{134,11,1692},{4,10,157
+},{5,10,471},{6,11,202},{10,11,448},{11,11,208},{12,11,360},{17,11,117},{17,11,
+118},{18,11,27},{148,11,67},{133,0,679},{137,0,326},{136,10,116},{7,11,872},{10,
+11,516},{139,11,167},{132,11,224},{5,11,546},{7,11,35},{8,11,11},{8,11,12},{9,11
+,315},{9,11,533},{10,11,802},{11,11,166},{12,11,525},{142,11,243},{7,0,1128},{
+135,11,1920},{5,11,241},{8,11,242},{9,11,451},{10,11,667},{11,11,598},{140,11,
+429},{6,0,737},{5,10,160},{7,10,363},{7,10,589},{10,10,170},{141,10,55},{135,0,
+1796},{142,11,254},{4,0,574},{7,0,350},{7,0,1024},{8,0,338},{9,0,677},{138,0,808
+},{134,0,1096},{137,11,516},{7,0,405},{10,0,491},{4,10,108},{4,11,366},{139,10,
+498},{11,11,337},{142,11,303},{134,11,1736},{7,0,1081},{140,11,364},{7,10,1005},
+{140,10,609},{7,0,1676},{4,10,895},{133,10,772},{135,0,2037},{6,0,1207},{11,11,
+916},{142,11,419},{14,11,140},{148,11,41},{6,11,331},{136,11,623},{9,0,944},{9,0
+,969},{9,0,1022},{12,0,913},{12,0,936},{15,0,177},{15,0,193},{4,10,926},{133,10,
+983},{5,0,354},{135,11,506},{8,0,598},{9,0,664},{138,0,441},{4,11,640},{133,11,
+513},{137,0,297},{132,10,538},{6,10,294},{7,10,1267},{136,10,624},{7,0,1772},{7,
+11,1888},{8,11,289},{11,11,45},{12,11,278},{140,11,537},{135,10,1325},{138,0,751
+},{141,0,37},{134,0,1828},{132,10,757},{132,11,394},{6,0,257},{135,0,1522},{4,0,
+582},{9,0,191},{135,11,1931},{7,11,574},{7,11,1719},{137,11,145},{132,11,658},{
+10,0,790},{132,11,369},{9,11,781},{10,11,144},{11,11,385},{13,11,161},{13,11,228
+},{13,11,268},{148,11,107},{8,0,469},{10,0,47},{136,11,374},{6,0,306},{7,0,1140}
+,{7,0,1340},{8,0,133},{138,0,449},{139,0,1011},{7,10,1875},{139,10,124},{4,11,
+344},{6,11,498},{139,11,323},{137,0,299},{132,0,837},{133,11,906},{5,0,329},{8,0
+,260},{138,0,10},{134,0,1320},{4,0,657},{146,0,158},{135,0,1191},{152,0,7},{6,0,
+1939},{8,0,974},{138,0,996},{135,0,1665},{11,11,126},{139,11,287},{143,0,8},{14,
+11,149},{14,11,399},{143,11,57},{5,0,66},{7,0,1896},{136,0,288},{7,0,175},{10,0,
+494},{5,10,150},{8,10,603},{9,10,593},{9,10,634},{10,10,173},{11,10,462},{11,10,
+515},{13,10,216},{13,10,288},{142,10,400},{134,0,1643},{136,11,21},{4,0,21},{5,0
+,91},{5,0,648},{5,0,750},{5,0,781},{6,0,54},{6,0,112},{6,0,402},{6,0,1732},{7,0,
+315},{7,0,749},{7,0,1427},{7,0,1900},{9,0,78},{9,0,508},{10,0,611},{10,0,811},{
+11,0,510},{11,0,728},{13,0,36},{14,0,39},{16,0,83},{17,0,124},{148,0,30},{4,0,
+668},{136,0,570},{10,0,322},{10,0,719},{139,0,407},{135,11,1381},{136,11,193},{
+12,10,108},{141,10,291},{132,11,616},{136,11,692},{8,0,125},{8,0,369},{8,0,524},
+{10,0,486},{11,0,13},{11,0,381},{11,0,736},{11,0,766},{11,0,845},{13,0,114},{13,
+0,292},{142,0,47},{134,0,1247},{6,0,1684},{6,0,1731},{7,0,356},{8,0,54},{8,0,221
+},{9,0,225},{9,0,356},{10,0,77},{10,0,446},{10,0,731},{12,0,404},{141,0,491},{
+135,10,1777},{4,11,305},{4,10,493},{144,10,55},{4,0,951},{6,0,1809},{6,0,1849},{
+8,0,846},{8,0,866},{8,0,899},{10,0,896},{12,0,694},{142,0,468},{5,11,214},{7,11,
+603},{8,11,611},{9,11,686},{10,11,88},{11,11,459},{11,11,496},{12,11,463},{12,11
+,590},{13,11,0},{142,11,214},{132,0,411},{4,0,80},{133,0,44},{140,11,74},{143,0,
+31},{7,0,669},{6,10,568},{7,10,1804},{8,10,362},{8,10,410},{8,10,830},{9,10,514}
+,{11,10,649},{142,10,157},{7,0,673},{134,11,1703},{132,10,625},{134,0,1303},{5,0
+,299},{135,0,1083},{138,0,704},{6,0,275},{7,0,408},{6,10,158},{7,10,129},{7,10,
+181},{8,10,276},{8,10,377},{10,10,523},{11,10,816},{12,10,455},{13,10,303},{142,
+10,135},{4,0,219},{7,0,367},{7,0,1713},{7,0,1761},{9,0,86},{9,0,537},{10,0,165},
+{12,0,219},{140,0,561},{8,0,216},{4,10,1},{4,11,737},{6,11,317},{7,10,1143},{7,
+10,1463},{9,10,207},{9,10,390},{9,10,467},{10,11,98},{11,11,294},{11,10,836},{12
+,11,60},{12,11,437},{13,11,64},{13,11,380},{142,11,430},{6,11,1758},{8,11,520},{
+9,11,345},{9,11,403},{142,11,350},{5,11,47},{10,11,242},{138,11,579},{5,11,139},
+{7,11,1168},{138,11,539},{135,0,1319},{4,10,295},{4,10,723},{5,10,895},{7,10,
+1031},{8,10,199},{8,10,340},{9,10,153},{9,10,215},{10,10,21},{10,10,59},{10,10,
+80},{10,10,224},{10,10,838},{11,10,229},{11,10,652},{12,10,192},{13,10,146},{142
+,10,91},{140,0,428},{137,10,51},{133,0,514},{5,10,309},{140,10,211},{6,0,1010},{
+5,10,125},{8,10,77},{138,10,15},{4,0,55},{5,0,301},{6,0,571},{142,0,49},{146,0,
+102},{136,11,370},{4,11,107},{7,11,613},{8,11,358},{8,11,439},{8,11,504},{9,11,
+501},{10,11,383},{139,11,477},{132,11,229},{133,0,364},{133,10,439},{4,11,903},{
+135,11,1816},{11,0,379},{140,10,76},{4,0,76},{4,0,971},{7,0,1550},{9,0,306},{9,0
+,430},{9,0,663},{10,0,683},{10,0,921},{11,0,427},{11,0,753},{12,0,334},{12,0,442
+},{14,0,258},{14,0,366},{143,0,131},{137,0,52},{4,11,47},{6,11,373},{7,11,452},{
+7,11,543},{7,11,1714},{7,11,1856},{9,11,6},{11,11,257},{139,11,391},{4,10,8},{7,
+10,1152},{7,10,1153},{7,10,1715},{9,10,374},{10,10,478},{139,10,648},{4,11,785},
+{133,11,368},{135,10,1099},{135,11,860},{5,11,980},{134,11,1754},{134,0,1258},{6
+,0,1058},{6,0,1359},{7,11,536},{7,11,1331},{136,11,143},{4,0,656},{135,0,779},{
+136,10,87},{5,11,19},{6,11,533},{146,11,126},{7,0,144},{138,10,438},{5,11,395},{
+5,11,951},{134,11,1776},{135,0,1373},{7,0,554},{7,0,605},{141,0,10},{4,10,69},{5
+,10,122},{9,10,656},{138,10,464},{5,10,849},{134,10,1633},{5,0,838},{5,0,841},{
+134,0,1649},{133,0,1012},{139,10,499},{7,10,476},{7,10,1592},{138,10,87},{6,0,
+251},{7,0,365},{7,0,1357},{7,0,1497},{8,0,154},{141,0,281},{132,11,441},{132,11,
+695},{7,11,497},{9,11,387},{147,11,81},{133,0,340},{14,10,283},{142,11,283},{134
+,0,810},{135,11,1894},{139,0,495},{5,11,284},{6,11,49},{6,11,350},{7,11,1},{7,11
+,377},{7,11,1693},{8,11,18},{8,11,678},{9,11,161},{9,11,585},{9,11,671},{9,11,
+839},{11,11,912},{141,11,427},{5,10,859},{7,10,1160},{8,10,107},{9,10,291},{9,10
+,439},{10,10,663},{11,10,609},{140,10,197},{8,0,261},{9,0,144},{9,0,466},{10,0,
+370},{12,0,470},{13,0,144},{142,0,348},{137,0,897},{6,0,248},{9,0,546},{10,0,535
+},{11,0,681},{141,0,135},{4,0,358},{135,0,1496},{134,0,567},{136,0,445},{4,10,
+117},{6,10,372},{7,10,1905},{142,10,323},{4,10,722},{139,10,471},{6,0,697},{134,
+0,996},{7,11,2007},{9,11,101},{9,11,450},{10,11,66},{10,11,842},{11,11,536},{140
+,11,587},{132,0,577},{134,0,1336},{9,10,5},{12,10,216},{12,10,294},{12,10,298},{
+12,10,400},{12,10,518},{13,10,229},{143,10,139},{6,0,174},{138,0,917},{134,10,
+1774},{5,10,12},{7,10,375},{9,10,88},{9,10,438},{11,11,62},{139,10,270},{134,11,
+1766},{6,11,0},{7,11,84},{7,10,816},{7,10,1241},{9,10,283},{9,10,520},{10,10,213
+},{10,10,307},{10,10,463},{10,10,671},{10,10,746},{11,10,401},{11,10,794},{11,11
+,895},{12,10,517},{17,11,11},{18,10,107},{147,10,115},{5,0,878},{133,0,972},{6,
+11,1665},{7,11,256},{7,11,1388},{138,11,499},{4,10,258},{136,10,639},{4,11,22},{
+5,11,10},{6,10,22},{7,11,848},{7,10,903},{7,10,1963},{8,11,97},{138,10,577},{5,
+10,681},{136,10,782},{133,11,481},{132,0,351},{4,10,664},{5,10,804},{139,10,1013
+},{6,11,134},{7,11,437},{7,11,959},{9,11,37},{14,11,285},{14,11,371},{144,11,60}
+,{7,11,486},{8,11,155},{11,11,93},{140,11,164},{132,0,286},{7,0,438},{7,0,627},{
+7,0,1516},{8,0,40},{9,0,56},{9,0,294},{10,0,30},{11,0,969},{11,0,995},{146,0,148
+},{5,11,591},{135,11,337},{134,0,1950},{133,10,32},{138,11,500},{5,11,380},{5,11
+,650},{136,11,310},{4,11,364},{7,11,1156},{7,11,1187},{137,11,409},{4,0,738},{
+134,11,482},{4,11,781},{6,11,487},{7,11,926},{8,11,263},{139,11,500},{135,11,418
+},{6,0,2047},{10,0,969},{4,10,289},{7,10,629},{7,10,1698},{7,10,1711},{140,10,
+215},{6,10,450},{136,10,109},{134,0,818},{136,10,705},{133,0,866},{4,11,94},{135
+,11,1265},{132,11,417},{134,0,1467},{135,10,1238},{4,0,972},{6,0,1851},{134,0,
+1857},{134,0,355},{133,0,116},{132,0,457},{135,11,1411},{4,11,408},{4,11,741},{
+135,11,500},{134,10,26},{142,11,137},{5,0,527},{6,0,189},{7,0,859},{136,0,267},{
+11,0,104},{11,0,554},{15,0,60},{143,0,125},{134,0,1613},{4,10,414},{5,10,467},{9
+,10,654},{10,10,451},{12,10,59},{141,10,375},{135,10,17},{134,0,116},{135,11,541
+},{135,10,955},{6,11,73},{135,11,177},{133,11,576},{134,0,886},{133,0,487},{4,0,
+86},{5,0,667},{5,0,753},{6,0,316},{6,0,455},{135,0,946},{142,11,231},{150,0,45},
+{134,0,863},{134,0,1953},{6,10,280},{10,10,502},{11,10,344},{140,10,38},{4,0,79}
+,{7,0,1773},{10,0,450},{11,0,589},{13,0,332},{13,0,493},{14,0,183},{14,0,334},{
+14,0,362},{14,0,368},{14,0,376},{14,0,379},{19,0,90},{19,0,103},{19,0,127},{148,
+0,90},{5,10,45},{7,10,1161},{11,10,448},{11,10,880},{13,10,139},{13,10,407},{15,
+10,16},{17,10,95},{18,10,66},{18,10,88},{18,10,123},{149,10,7},{136,10,777},{4,
+10,410},{135,10,521},{135,10,1778},{135,11,538},{142,0,381},{133,11,413},{134,0,
+1142},{6,0,1189},{136,11,495},{5,0,663},{6,0,1962},{134,0,2003},{7,11,54},{8,11,
+312},{10,11,191},{10,11,614},{140,11,567},{132,10,436},{133,0,846},{10,0,528},{
+11,0,504},{7,10,1587},{135,10,1707},{5,0,378},{8,0,465},{9,0,286},{10,0,185},{10
+,0,562},{10,0,635},{11,0,31},{11,0,393},{13,0,312},{18,0,65},{18,0,96},{147,0,89
+},{7,0,899},{14,0,325},{6,11,468},{7,11,567},{7,11,1478},{8,11,530},{142,11,290}
+,{7,0,1880},{9,0,680},{139,0,798},{134,0,1770},{132,0,648},{150,11,35},{5,0,945}
+,{6,0,1656},{6,0,1787},{7,0,167},{8,0,824},{9,0,391},{10,0,375},{139,0,185},{6,
+11,484},{135,11,822},{134,0,2046},{7,0,1645},{8,0,352},{137,0,249},{132,0,152},{
+6,0,611},{135,0,1733},{6,11,1724},{135,11,2022},{133,0,1006},{141,11,96},{5,0,
+420},{135,0,1449},{146,11,149},{135,0,832},{135,10,663},{133,0,351},{5,0,40},{7,
+0,598},{7,0,1638},{8,0,78},{9,0,166},{9,0,640},{9,0,685},{9,0,773},{11,0,215},{
+13,0,65},{14,0,172},{14,0,317},{145,0,6},{8,0,60},{9,0,343},{139,0,769},{134,0,
+1354},{132,0,724},{137,0,745},{132,11,474},{7,0,1951},{8,0,765},{8,0,772},{140,0
+,671},{7,0,108},{8,0,219},{8,0,388},{9,0,775},{11,0,275},{140,0,464},{137,0,639}
+,{135,10,503},{133,11,366},{5,0,15},{6,0,56},{7,0,1758},{8,0,500},{9,0,730},{11,
+0,331},{13,0,150},{14,0,282},{5,11,305},{9,11,560},{141,11,208},{4,10,113},{5,10
+,163},{5,10,735},{7,10,1009},{9,10,9},{9,10,771},{12,10,90},{13,10,138},{13,10,
+410},{143,10,128},{4,10,324},{138,10,104},{135,11,466},{142,11,27},{134,0,1886},
+{5,0,205},{6,0,438},{9,0,711},{4,11,480},{6,11,167},{6,11,302},{6,11,1642},{7,11
+,130},{7,11,656},{7,11,837},{7,11,1547},{7,11,1657},{8,11,429},{9,11,228},{10,11
+,643},{13,11,289},{13,11,343},{147,11,101},{134,0,865},{6,0,2025},{136,0,965},{7
+,11,278},{10,11,739},{11,11,708},{141,11,348},{133,0,534},{135,11,1922},{137,0,
+691},{4,10,935},{133,10,823},{6,0,443},{9,0,237},{9,0,571},{9,0,695},{10,0,139},
+{11,0,715},{12,0,417},{141,0,421},{5,10,269},{7,10,434},{7,10,891},{8,10,339},{9
+,10,702},{11,10,594},{11,10,718},{145,10,100},{6,0,1555},{7,0,878},{9,10,485},{
+141,10,264},{134,10,1713},{7,10,1810},{11,10,866},{12,10,103},{141,10,495},{135,
+10,900},{6,0,1410},{9,11,316},{139,11,256},{4,0,995},{135,0,1033},{132,0,578},{
+10,0,881},{12,0,740},{12,0,743},{140,0,759},{132,0,822},{133,0,923},{142,10,143}
+,{135,11,1696},{6,11,363},{7,11,1955},{136,11,725},{132,0,924},{133,0,665},{135,
+10,2029},{135,0,1901},{4,0,265},{6,0,1092},{6,0,1417},{7,0,807},{135,0,950},{5,0
+,93},{12,0,267},{141,0,498},{135,0,1451},{5,11,813},{135,11,2046},{5,10,625},{
+135,10,1617},{135,0,747},{6,0,788},{137,0,828},{7,0,184},{11,0,307},{11,0,400},{
+15,0,130},{5,11,712},{7,11,1855},{8,10,425},{8,10,693},{9,10,720},{10,10,380},{
+10,10,638},{11,11,17},{11,10,473},{12,10,61},{13,11,321},{144,11,67},{135,0,198}
+,{6,11,320},{7,11,781},{7,11,1921},{9,11,55},{10,11,186},{10,11,273},{10,11,664}
+,{10,11,801},{11,11,996},{11,11,997},{13,11,157},{142,11,170},{136,11,271},{135,
+0,994},{7,11,103},{7,11,863},{11,11,184},{14,11,299},{145,11,62},{11,10,551},{
+142,10,159},{5,0,233},{5,0,320},{6,0,140},{8,0,295},{8,0,615},{136,11,615},{133,
+0,978},{4,0,905},{6,0,1701},{137,0,843},{132,10,168},{4,0,974},{8,0,850},{12,0,
+709},{12,0,768},{140,0,786},{135,10,91},{152,0,6},{138,10,532},{135,10,1884},{
+132,0,509},{6,0,1307},{135,0,273},{5,11,77},{7,11,1455},{10,11,843},{19,11,73},{
+150,11,5},{132,11,458},{135,11,1420},{6,11,109},{138,11,382},{6,0,201},{6,11,330
+},{7,10,70},{7,11,1084},{10,10,240},{11,11,142},{147,10,93},{7,0,1041},{140,11,
+328},{133,11,354},{134,0,1040},{133,0,693},{134,0,774},{139,0,234},{132,0,336},{
+7,0,1399},{139,10,392},{20,0,22},{148,11,22},{5,0,802},{7,0,2021},{136,0,805},{5
+,0,167},{5,0,899},{6,0,410},{137,0,777},{137,0,789},{134,0,1705},{7,10,655},{135
+,10,1844},{4,10,145},{6,10,176},{7,10,395},{137,10,562},{132,10,501},{135,0,10},
+{5,0,11},{6,0,117},{6,0,485},{7,0,1133},{9,0,582},{9,0,594},{10,0,82},{11,0,21},
+{11,0,818},{12,0,535},{13,0,86},{20,0,91},{23,0,13},{134,10,509},{4,0,264},{7,0,
+1067},{8,0,204},{8,0,385},{139,0,953},{139,11,737},{138,0,56},{134,0,1917},{133,
+0,470},{10,11,657},{14,11,297},{142,11,361},{135,11,412},{7,0,1198},{7,11,1198},
+{8,11,556},{14,11,123},{14,11,192},{143,11,27},{7,11,1985},{14,11,146},{15,11,42
+},{16,11,23},{17,11,86},{146,11,17},{11,0,1015},{136,11,122},{4,10,114},{9,10,
+492},{13,10,462},{142,10,215},{4,10,77},{5,10,361},{6,10,139},{6,10,401},{6,10,
+404},{7,10,413},{7,10,715},{7,10,1716},{11,10,279},{12,10,179},{12,10,258},{13,
+10,244},{142,10,358},{134,10,1717},{7,10,1061},{8,10,82},{11,10,250},{12,10,420}
+,{141,10,184},{133,0,715},{135,10,724},{9,0,919},{9,0,922},{9,0,927},{9,0,933},{
+9,0,962},{9,0,1000},{9,0,1002},{9,0,1021},{12,0,890},{12,0,907},{12,0,930},{15,0
+,207},{15,0,228},{15,0,238},{149,0,61},{8,0,794},{9,0,400},{10,0,298},{142,0,228
+},{5,11,430},{5,11,932},{6,11,131},{7,11,417},{9,11,522},{11,11,314},{141,11,390
+},{132,0,867},{8,0,724},{132,11,507},{137,11,261},{4,11,343},{133,11,511},{6,0,
+190},{7,0,768},{135,0,1170},{6,10,513},{135,10,1052},{7,11,455},{138,11,591},{
+134,0,1066},{137,10,899},{14,0,67},{147,0,60},{4,0,948},{18,0,174},{146,0,176},{
+135,0,1023},{7,10,1417},{12,10,382},{17,10,48},{152,10,12},{134,11,575},{132,0,
+764},{6,10,545},{7,10,565},{7,10,1669},{10,10,114},{11,10,642},{140,10,618},{6,0
+,137},{9,0,75},{9,0,253},{10,0,194},{138,0,444},{4,0,756},{133,10,5},{8,0,1008},
+{135,10,192},{132,0,842},{11,0,643},{12,0,115},{136,10,763},{139,0,67},{133,10,
+759},{4,0,821},{5,0,760},{7,0,542},{8,0,135},{8,0,496},{135,11,580},{7,10,370},{
+7,10,1007},{7,10,1177},{135,10,1565},{135,10,1237},{140,0,736},{7,0,319},{7,0,
+355},{7,0,763},{10,0,389},{145,0,43},{8,11,333},{138,11,182},{4,10,87},{5,10,250
+},{141,10,298},{138,0,786},{134,0,2044},{8,11,330},{140,11,477},{135,11,1338},{
+132,11,125},{134,0,1030},{134,0,1083},{132,11,721},{135,10,814},{7,11,776},{8,11
+,145},{147,11,56},{134,0,1226},{4,10,57},{7,10,1195},{7,10,1438},{7,10,1548},{7,
+10,1835},{7,10,1904},{9,10,757},{10,10,604},{139,10,519},{7,11,792},{8,11,147},{
+10,11,821},{139,11,1021},{137,11,797},{4,0,58},{5,0,286},{6,0,319},{7,0,402},{7,
+0,1254},{7,0,1903},{8,0,356},{140,0,408},{4,0,389},{4,0,815},{9,0,181},{9,0,255}
+,{10,0,8},{10,0,29},{10,0,816},{11,0,311},{11,0,561},{12,0,67},{141,0,181},{7,11
+,1472},{135,11,1554},{7,11,1071},{7,11,1541},{7,11,1767},{7,11,1806},{7,11,1999}
+,{9,11,248},{10,11,400},{11,11,162},{11,11,178},{11,11,242},{12,11,605},{15,11,
+26},{144,11,44},{5,11,168},{5,11,930},{8,11,74},{9,11,623},{12,11,500},{12,11,
+579},{13,11,41},{143,11,93},{6,11,220},{7,11,1101},{141,11,105},{5,0,474},{7,0,
+507},{4,10,209},{7,11,507},{135,10,902},{132,0,427},{6,0,413},{7,10,335},{7,10,
+1437},{7,10,1668},{8,10,553},{8,10,652},{8,10,656},{9,10,558},{11,10,743},{149,
+10,18},{132,0,730},{6,11,19},{7,11,1413},{139,11,428},{133,0,373},{132,10,559},{
+7,11,96},{8,11,401},{137,11,896},{7,0,799},{7,0,1972},{5,10,1017},{138,10,511},{
+135,0,1793},{7,11,1961},{7,11,1965},{8,11,702},{136,11,750},{8,11,150},{8,11,737
+},{140,11,366},{132,0,322},{133,10,709},{8,11,800},{9,11,148},{9,11,872},{9,11,
+890},{11,11,309},{11,11,1001},{13,11,267},{141,11,323},{134,10,1745},{7,0,290},{
+136,10,206},{7,0,1651},{145,0,89},{139,0,2},{132,0,672},{6,0,1860},{8,0,905},{10
+,0,844},{10,0,846},{10,0,858},{12,0,699},{12,0,746},{140,0,772},{135,11,424},{
+133,11,547},{133,0,737},{5,11,490},{6,11,615},{6,11,620},{135,11,683},{6,0,746},
+{134,0,1612},{132,10,776},{9,11,385},{149,11,17},{133,0,145},{135,10,1272},{7,0,
+884},{140,0,124},{4,0,387},{135,0,1288},{5,11,133},{136,10,406},{136,11,187},{6,
+0,679},{8,11,8},{138,11,0},{135,0,550},{135,11,798},{136,11,685},{7,11,1086},{
+145,11,46},{8,10,175},{10,10,168},{138,10,573},{135,0,1305},{4,0,576},{135,0,
+1263},{6,0,686},{134,0,1563},{134,0,607},{5,0,919},{134,0,1673},{148,0,37},{8,11
+,774},{10,11,670},{140,11,51},{133,10,784},{139,10,882},{4,0,82},{5,0,333},{5,0,
+904},{6,0,207},{7,0,325},{7,0,1726},{8,0,101},{10,0,778},{139,0,220},{135,11,371
+},{132,0,958},{133,0,903},{4,11,127},{5,11,350},{6,11,356},{8,11,426},{9,11,572}
+,{10,11,247},{139,11,312},{140,0,147},{6,11,59},{7,11,885},{9,11,603},{141,11,
+397},{10,0,367},{9,10,14},{9,10,441},{139,10,9},{11,10,966},{12,10,287},{13,10,
+342},{13,10,402},{15,10,110},{143,10,163},{134,0,690},{132,0,705},{9,0,651},{11,
+0,971},{13,0,273},{7,10,1428},{7,10,1640},{7,10,1867},{9,10,169},{9,10,182},{9,
+10,367},{9,10,478},{9,10,506},{9,10,551},{9,10,557},{9,10,648},{9,10,697},{9,10,
+705},{9,10,725},{9,10,787},{9,10,794},{10,10,198},{10,10,214},{10,10,267},{10,10
+,275},{10,10,456},{10,10,551},{10,10,561},{10,10,613},{10,10,627},{10,10,668},{
+10,10,675},{10,10,691},{10,10,695},{10,10,707},{10,10,715},{11,10,183},{11,10,
+201},{11,10,262},{11,10,352},{11,10,439},{11,10,493},{11,10,572},{11,10,591},{11
+,10,608},{11,10,611},{11,10,646},{11,10,674},{11,10,711},{11,10,751},{11,10,761}
+,{11,10,776},{11,10,785},{11,10,850},{11,10,853},{11,10,862},{11,10,865},{11,10,
+868},{11,10,875},{11,10,898},{11,10,902},{11,10,903},{11,10,910},{11,10,932},{11
+,10,942},{11,10,957},{11,10,967},{11,10,972},{12,10,148},{12,10,195},{12,10,220}
+,{12,10,237},{12,10,318},{12,10,339},{12,10,393},{12,10,445},{12,10,450},{12,10,
+474},{12,10,505},{12,10,509},{12,10,533},{12,10,591},{12,10,594},{12,10,597},{12
+,10,621},{12,10,633},{12,10,642},{13,10,59},{13,10,60},{13,10,145},{13,10,239},{
+13,10,250},{13,10,329},{13,10,344},{13,10,365},{13,10,372},{13,10,387},{13,10,
+403},{13,10,414},{13,10,456},{13,10,470},{13,10,478},{13,10,483},{13,10,489},{14
+,10,55},{14,10,57},{14,10,81},{14,10,90},{14,10,148},{14,10,239},{14,10,266},{14
+,10,321},{14,10,326},{14,10,327},{14,10,330},{14,10,347},{14,10,355},{14,10,401}
+,{14,10,404},{14,10,411},{14,10,414},{14,10,416},{14,10,420},{15,10,61},{15,10,
+74},{15,10,87},{15,10,88},{15,10,94},{15,10,96},{15,10,116},{15,10,149},{15,10,
+154},{16,10,50},{16,10,63},{16,10,73},{17,10,2},{17,10,66},{17,10,92},{17,10,103
+},{17,10,112},{17,10,120},{18,10,50},{18,10,54},{18,10,82},{18,10,86},{18,10,90}
+,{18,10,111},{18,10,115},{18,10,156},{19,10,40},{19,10,79},{20,10,78},{149,10,22
+},{7,0,887},{5,10,161},{135,10,839},{142,11,98},{134,0,90},{138,11,356},{135,11,
+441},{6,11,111},{7,11,4},{8,11,163},{8,11,776},{138,11,566},{134,0,908},{134,0,
+1261},{7,0,813},{12,0,497},{141,0,56},{134,0,1235},{135,0,429},{135,11,1994},{
+138,0,904},{6,0,125},{7,0,1277},{137,0,772},{151,0,12},{4,0,841},{5,0,386},{133,
+11,386},{5,11,297},{135,11,1038},{6,0,860},{6,0,1069},{135,11,309},{136,0,946},{
+135,10,1814},{141,11,418},{136,11,363},{10,0,768},{139,0,787},{22,11,30},{150,11
+,33},{6,0,160},{7,0,1106},{9,0,770},{11,0,112},{140,0,413},{11,11,216},{139,11,
+340},{136,10,139},{135,11,1390},{135,11,808},{132,11,280},{12,0,271},{17,0,109},
+{7,10,643},{136,10,236},{140,11,54},{4,11,421},{133,11,548},{11,0,719},{12,0,36}
+,{141,0,337},{7,0,581},{9,0,644},{137,0,699},{11,11,511},{13,11,394},{14,11,298}
+,{14,11,318},{146,11,103},{7,0,304},{9,0,646},{9,0,862},{11,0,696},{12,0,208},{
+15,0,79},{147,0,108},{4,0,631},{7,0,1126},{135,0,1536},{135,11,1527},{8,0,880},{
+10,0,869},{138,0,913},{7,0,1513},{5,10,54},{6,11,254},{9,11,109},{138,11,103},{
+135,0,981},{133,11,729},{132,10,744},{132,0,434},{134,0,550},{7,0,930},{10,0,476
+},{13,0,452},{19,0,104},{6,11,1630},{10,10,402},{146,10,55},{5,0,553},{138,0,824
+},{136,0,452},{8,0,151},{137,10,624},{132,10,572},{132,0,772},{133,11,671},{133,
+0,292},{138,0,135},{132,11,889},{140,11,207},{9,0,504},{6,10,43},{7,10,38},{8,10
+,248},{138,10,513},{6,0,1089},{135,11,1910},{4,11,627},{133,11,775},{135,0,783},
+{133,10,766},{133,10,363},{7,0,387},{135,11,387},{7,0,393},{10,0,603},{11,0,206}
+,{7,11,202},{11,11,362},{11,11,948},{140,11,388},{6,11,507},{7,11,451},{8,11,389
+},{12,11,490},{13,11,16},{13,11,215},{13,11,351},{18,11,132},{147,11,125},{4,0,
+912},{9,0,232},{135,11,841},{6,10,258},{140,10,409},{5,10,249},{148,10,82},{136,
+11,566},{6,0,977},{135,11,1214},{7,0,1973},{136,0,716},{135,0,98},{133,0,733},{5
+,11,912},{134,11,1695},{5,10,393},{6,10,378},{7,10,1981},{9,10,32},{9,10,591},{
+10,10,685},{10,10,741},{142,10,382},{133,10,788},{10,0,19},{11,0,911},{7,10,1968
+},{141,10,509},{5,0,668},{5,11,236},{6,11,572},{8,11,492},{11,11,618},{144,11,56
+},{135,11,1789},{4,0,360},{5,0,635},{5,0,700},{5,10,58},{5,10,171},{5,10,683},{6
+,10,291},{6,10,566},{7,10,1650},{11,10,523},{12,10,273},{12,10,303},{15,10,39},{
+143,10,111},{133,0,901},{134,10,589},{5,11,190},{136,11,318},{140,0,656},{7,0,
+726},{152,0,9},{4,10,917},{133,10,1005},{135,10,1598},{134,11,491},{4,10,919},{
+133,11,434},{137,0,72},{6,0,1269},{6,0,1566},{134,0,1621},{9,0,463},{10,0,595},{
+4,10,255},{5,10,302},{6,10,132},{7,10,128},{7,10,283},{7,10,1299},{10,10,52},{10
+,10,514},{11,10,925},{13,10,92},{142,10,309},{135,0,1454},{134,0,1287},{11,0,600
+},{13,0,245},{137,10,173},{136,0,989},{7,0,164},{7,0,1571},{9,0,107},{140,0,225}
+,{6,0,1061},{141,10,442},{4,0,27},{5,0,484},{5,0,510},{6,0,434},{7,0,1000},{7,0,
+1098},{136,0,2},{7,11,85},{7,11,247},{8,11,585},{10,11,163},{138,11,316},{11,11,
+103},{142,11,0},{134,0,1127},{4,0,460},{134,0,852},{134,10,210},{4,0,932},{133,0
+,891},{6,0,588},{147,11,83},{8,0,625},{4,10,284},{134,10,223},{134,0,76},{8,0,92
+},{137,0,221},{4,11,124},{10,11,457},{11,11,121},{11,11,169},{11,11,422},{11,11,
+870},{12,11,214},{13,11,389},{14,11,187},{143,11,77},{9,11,618},{138,11,482},{4,
+10,218},{7,10,526},{143,10,137},{13,0,9},{14,0,104},{14,0,311},{4,10,270},{5,10,
+192},{6,10,332},{135,10,1322},{140,10,661},{135,11,1193},{6,11,107},{7,11,638},{
+7,11,1632},{137,11,396},{132,0,763},{4,0,622},{5,11,370},{134,11,1756},{133,0,
+253},{135,0,546},{9,0,73},{10,0,110},{14,0,185},{17,0,119},{133,11,204},{7,0,624
+},{7,0,916},{10,0,256},{139,0,87},{7,10,379},{8,10,481},{137,10,377},{5,0,212},{
+12,0,35},{13,0,382},{5,11,970},{134,11,1706},{9,0,746},{5,10,1003},{134,10,149},
+{10,0,150},{11,0,849},{13,0,330},{8,10,262},{9,10,627},{11,10,214},{11,10,404},{
+11,10,457},{11,10,780},{11,10,913},{13,10,401},{142,10,200},{134,0,1466},{135,11
+,3},{6,0,1299},{4,11,35},{5,11,121},{5,11,483},{5,11,685},{6,11,489},{7,11,1204}
+,{136,11,394},{135,10,742},{4,10,142},{136,10,304},{4,11,921},{133,11,1007},{134
+,0,1518},{6,0,1229},{135,0,1175},{133,0,816},{12,0,159},{4,10,471},{4,11,712},{5
+,10,51},{6,10,602},{7,10,925},{8,10,484},{138,10,195},{134,11,1629},{5,0,869},{5
+,0,968},{6,0,1626},{8,0,734},{136,0,784},{4,0,542},{6,0,1716},{6,0,1727},{7,0,
+1082},{7,0,1545},{8,0,56},{8,0,118},{8,0,412},{8,0,564},{9,0,888},{9,0,908},{10,
+0,50},{10,0,423},{11,0,685},{11,0,697},{11,0,933},{12,0,299},{13,0,126},{13,0,
+136},{13,0,170},{13,0,190},{136,10,688},{132,10,697},{4,0,232},{9,0,202},{10,0,
+474},{140,0,433},{136,0,212},{6,0,108},{7,0,1003},{7,0,1181},{8,0,111},{136,0,
+343},{5,10,221},{135,11,1255},{133,11,485},{134,0,1712},{142,0,216},{5,0,643},{6
+,0,516},{4,11,285},{5,11,317},{6,11,301},{7,11,7},{8,11,153},{10,11,766},{11,11,
+468},{12,11,467},{141,11,143},{4,0,133},{7,0,711},{7,0,1298},{135,0,1585},{134,0
+,650},{135,11,512},{6,0,99},{7,0,1808},{145,0,57},{6,0,246},{6,0,574},{7,0,428},
+{9,0,793},{10,0,669},{11,0,485},{11,0,840},{12,0,300},{14,0,250},{145,0,55},{4,
+10,132},{5,10,69},{135,10,1242},{136,0,1023},{7,0,302},{132,10,111},{135,0,1871}
+,{132,0,728},{9,0,252},{132,10,767},{6,0,461},{7,0,1590},{7,10,1416},{7,10,2005}
+,{8,10,131},{8,10,466},{9,10,672},{13,10,252},{148,10,103},{6,0,323},{135,0,1564
+},{7,0,461},{136,0,775},{6,10,44},{136,10,368},{139,0,172},{132,0,464},{4,10,570
+},{133,10,120},{137,11,269},{6,10,227},{135,10,1589},{6,11,1719},{6,11,1735},{7,
+11,2016},{7,11,2020},{8,11,837},{137,11,852},{7,0,727},{146,0,73},{132,0,1023},{
+135,11,852},{135,10,1529},{136,0,577},{138,11,568},{134,0,1037},{8,11,67},{138,
+11,419},{4,0,413},{5,0,677},{8,0,432},{140,0,280},{10,0,600},{6,10,1667},{7,11,
+967},{7,10,2036},{141,11,11},{6,10,511},{140,10,132},{6,0,799},{5,10,568},{6,10,
+138},{135,10,1293},{8,0,159},{4,10,565},{136,10,827},{7,0,646},{7,0,1730},{11,0,
+446},{141,0,178},{4,10,922},{133,10,1023},{135,11,11},{132,0,395},{11,0,145},{
+135,10,1002},{9,0,174},{10,0,164},{11,0,440},{11,0,514},{11,0,841},{15,0,98},{
+149,0,20},{134,0,426},{10,0,608},{139,0,1002},{7,11,320},{8,11,51},{12,11,481},{
+12,11,570},{148,11,106},{9,0,977},{9,0,983},{132,11,445},{138,0,250},{139,0,100}
+,{6,0,1982},{136,10,402},{133,11,239},{4,10,716},{141,10,31},{5,0,476},{7,11,83}
+,{7,11,1990},{8,11,130},{139,11,720},{8,10,691},{136,10,731},{5,11,123},{6,11,
+530},{7,11,348},{135,11,1419},{5,0,76},{6,0,458},{6,0,497},{7,0,868},{9,0,658},{
+10,0,594},{11,0,173},{11,0,566},{12,0,20},{12,0,338},{141,0,200},{9,11,139},{10,
+11,399},{11,11,469},{12,11,634},{141,11,223},{9,10,840},{138,10,803},{133,10,847
+},{11,11,223},{140,11,168},{132,11,210},{8,0,447},{9,10,53},{9,10,268},{9,10,901
+},{10,10,518},{10,10,829},{11,10,188},{13,10,74},{14,10,46},{15,10,17},{15,10,33
+},{17,10,40},{18,10,36},{19,10,20},{22,10,1},{152,10,2},{4,0,526},{7,0,1029},{
+135,0,1054},{19,11,59},{150,11,2},{4,0,636},{6,0,1875},{6,0,1920},{9,0,999},{12,
+0,807},{12,0,825},{15,0,179},{15,0,190},{18,0,182},{136,10,532},{6,0,1699},{7,0,
+660},{7,0,1124},{17,0,31},{19,0,22},{151,0,14},{135,10,681},{132,11,430},{140,10
+,677},{4,10,684},{136,10,384},{132,11,756},{133,11,213},{7,0,188},{7,10,110},{8,
+10,290},{8,10,591},{9,10,382},{9,10,649},{11,10,71},{11,10,155},{11,10,313},{12,
+10,5},{13,10,325},{142,10,287},{7,10,360},{7,10,425},{9,10,66},{9,10,278},{138,
+10,644},{142,11,164},{4,0,279},{7,0,301},{137,0,362},{134,11,586},{135,0,1743},{
+4,0,178},{133,0,399},{4,10,900},{133,10,861},{5,10,254},{7,10,985},{136,10,73},{
+133,11,108},{7,10,1959},{136,10,683},{133,11,219},{4,11,193},{5,11,916},{7,11,
+364},{10,11,398},{10,11,726},{11,11,317},{11,11,626},{12,11,142},{12,11,288},{12
+,11,678},{13,11,313},{15,11,113},{18,11,114},{21,11,30},{150,11,53},{6,11,241},{
+7,11,907},{8,11,832},{9,11,342},{10,11,729},{11,11,284},{11,11,445},{11,11,651},
+{11,11,863},{13,11,398},{146,11,99},{132,0,872},{134,0,831},{134,0,1692},{6,0,
+202},{6,0,1006},{9,0,832},{10,0,636},{11,0,208},{12,0,360},{17,0,118},{18,0,27},
+{20,0,67},{137,11,734},{132,10,725},{7,11,993},{138,11,666},{134,0,1954},{134,10
+,196},{7,0,872},{10,0,516},{139,0,167},{133,10,831},{4,11,562},{9,11,254},{139,
+11,879},{137,0,313},{4,0,224},{132,11,786},{11,0,24},{12,0,170},{136,10,723},{5,
+0,546},{7,0,35},{8,0,11},{8,0,12},{9,0,315},{9,0,533},{10,0,802},{11,0,166},{12,
+0,525},{142,0,243},{7,0,1937},{13,10,80},{13,10,437},{145,10,74},{5,0,241},{8,0,
+242},{9,0,451},{10,0,667},{11,0,598},{140,0,429},{150,0,46},{6,0,1273},{137,0,
+830},{5,10,848},{6,10,66},{136,10,764},{6,0,825},{134,0,993},{4,0,1006},{10,0,
+327},{13,0,271},{4,10,36},{7,10,1387},{139,10,755},{134,0,1023},{135,0,1580},{4,
+0,366},{137,0,516},{132,10,887},{6,0,1736},{135,0,1891},{6,11,216},{7,11,901},{7
+,11,1343},{136,11,493},{6,10,165},{138,10,388},{7,11,341},{139,11,219},{4,10,719
+},{135,10,155},{134,0,1935},{132,0,826},{6,0,331},{6,0,1605},{8,0,623},{11,0,139
+},{139,0,171},{135,11,1734},{10,11,115},{11,11,420},{12,11,154},{13,11,404},{14,
+11,346},{15,11,54},{143,11,112},{7,0,288},{4,10,353},{6,10,146},{6,10,1789},{7,
+10,990},{7,10,1348},{9,10,665},{9,10,898},{11,10,893},{142,10,212},{6,0,916},{
+134,0,1592},{7,0,1888},{4,10,45},{135,10,1257},{5,11,1011},{136,11,701},{139,11,
+596},{4,11,54},{5,11,666},{7,11,1039},{7,11,1130},{9,11,195},{138,11,302},{134,0
+,1471},{134,0,1570},{132,0,394},{140,10,65},{136,10,816},{135,0,1931},{7,0,574},
+{135,0,1719},{134,11,467},{132,0,658},{9,0,781},{10,0,144},{11,0,385},{13,0,161}
+,{13,0,228},{13,0,268},{20,0,107},{134,11,1669},{136,0,374},{135,0,735},{4,0,344
+},{6,0,498},{139,0,323},{7,0,586},{7,0,1063},{6,10,559},{134,10,1691},{137,0,155
+},{133,0,906},{7,11,122},{9,11,259},{10,11,84},{11,11,470},{12,11,541},{141,11,
+379},{134,0,1139},{10,0,108},{139,0,116},{134,10,456},{133,10,925},{5,11,82},{5,
+11,131},{7,11,1755},{8,11,31},{9,11,168},{9,11,764},{139,11,869},{134,11,605},{5
+,11,278},{137,11,68},{4,11,163},{5,11,201},{5,11,307},{5,11,310},{6,11,335},{7,
+11,284},{136,11,165},{135,11,1660},{6,11,33},{135,11,1244},{4,0,616},{136,11,483
+},{8,0,857},{8,0,902},{8,0,910},{10,0,879},{12,0,726},{4,11,199},{139,11,34},{
+136,0,692},{6,10,193},{7,10,240},{7,10,1682},{10,10,51},{10,10,640},{11,10,410},
+{13,10,82},{14,10,247},{14,10,331},{142,10,377},{6,0,823},{134,0,983},{139,10,
+411},{132,0,305},{136,10,633},{138,11,203},{134,0,681},{6,11,326},{7,11,677},{
+137,11,425},{5,0,214},{7,0,603},{8,0,611},{9,0,686},{10,0,88},{11,0,459},{11,0,
+496},{12,0,463},{12,0,590},{141,0,0},{136,0,1004},{142,0,23},{134,0,1703},{147,
+11,8},{145,11,56},{135,0,1443},{4,10,237},{135,10,514},{6,0,714},{145,0,19},{5,
+11,358},{7,11,473},{7,11,1184},{10,11,662},{13,11,212},{13,11,304},{13,11,333},{
+145,11,98},{4,0,737},{10,0,98},{11,0,294},{12,0,60},{12,0,437},{13,0,64},{13,0,
+380},{142,0,430},{6,10,392},{7,10,65},{135,10,2019},{6,0,1758},{8,0,520},{9,0,
+345},{9,0,403},{142,0,350},{5,0,47},{10,0,242},{138,0,579},{5,0,139},{7,0,1168},
+{138,0,539},{134,0,1459},{13,0,388},{141,11,388},{134,0,253},{7,10,1260},{135,10
+,1790},{10,0,252},{9,10,222},{139,10,900},{140,0,745},{133,11,946},{4,0,107},{7,
+0,613},{8,0,439},{8,0,504},{9,0,501},{10,0,383},{139,0,477},{135,11,1485},{132,0
+,871},{7,11,411},{7,11,590},{8,11,631},{9,11,323},{10,11,355},{11,11,491},{12,11
+,143},{12,11,402},{13,11,73},{14,11,408},{15,11,107},{146,11,71},{132,0,229},{
+132,0,903},{140,0,71},{133,0,549},{4,0,47},{6,0,373},{7,0,452},{7,0,543},{7,0,
+1828},{7,0,1856},{9,0,6},{11,0,257},{139,0,391},{7,11,1467},{8,11,328},{10,11,
+544},{11,11,955},{13,11,320},{145,11,83},{5,0,980},{134,0,1754},{136,0,865},{5,0
+,705},{137,0,606},{7,0,161},{8,10,201},{136,10,605},{143,11,35},{5,11,835},{6,11
+,483},{140,10,224},{7,0,536},{7,0,1331},{136,0,143},{134,0,1388},{5,0,724},{10,0
+,305},{11,0,151},{12,0,33},{12,0,121},{12,0,381},{17,0,3},{17,0,27},{17,0,78},{
+18,0,18},{19,0,54},{149,0,5},{4,10,523},{133,10,638},{5,0,19},{134,0,533},{5,0,
+395},{5,0,951},{134,0,1776},{135,0,1908},{132,0,846},{10,0,74},{11,0,663},{12,0,
+210},{13,0,166},{13,0,310},{14,0,373},{18,0,95},{19,0,43},{6,10,242},{7,10,227},
+{7,10,1581},{8,10,104},{9,10,113},{9,10,220},{9,10,427},{10,10,239},{11,10,579},
+{11,10,1023},{13,10,4},{13,10,204},{13,10,316},{148,10,86},{9,11,716},{11,11,108
+},{13,11,123},{14,11,252},{19,11,38},{21,11,3},{151,11,11},{8,0,372},{9,0,122},{
+138,0,175},{132,11,677},{7,11,1374},{136,11,540},{135,10,861},{132,0,695},{7,0,
+497},{9,0,387},{147,0,81},{136,0,937},{134,0,718},{7,0,1328},{136,10,494},{132,
+11,331},{6,0,1581},{133,11,747},{5,0,284},{6,0,49},{6,0,350},{7,0,1},{7,0,377},{
+7,0,1693},{8,0,18},{8,0,678},{9,0,161},{9,0,585},{9,0,671},{9,0,839},{11,0,912},
+{141,0,427},{7,10,1306},{8,10,505},{9,10,482},{10,10,126},{11,10,225},{12,10,347
+},{12,10,449},{13,10,19},{14,10,218},{142,10,435},{10,10,764},{12,10,120},{13,10
+,39},{145,10,127},{4,0,597},{133,10,268},{134,0,1094},{4,0,1008},{134,0,1973},{
+132,0,811},{139,0,908},{135,0,1471},{133,11,326},{4,10,384},{135,10,1022},{7,0,
+1935},{8,0,324},{12,0,42},{4,11,691},{7,11,1935},{8,11,324},{9,11,35},{10,11,680
+},{11,11,364},{12,11,42},{13,11,357},{146,11,16},{135,0,2014},{7,0,2007},{9,0,
+101},{9,0,450},{10,0,66},{10,0,842},{11,0,536},{12,0,587},{6,11,32},{7,11,385},{
+7,11,757},{7,11,1916},{8,11,37},{8,11,94},{8,11,711},{9,11,541},{10,11,162},{10,
+11,795},{11,11,989},{11,11,1010},{12,11,14},{142,11,308},{139,0,586},{135,10,
+1703},{7,0,1077},{11,0,28},{9,10,159},{140,10,603},{6,0,1221},{136,10,583},{6,11
+,152},{6,11,349},{6,11,1682},{7,11,1252},{8,11,112},{9,11,435},{9,11,668},{10,11
+,290},{10,11,319},{10,11,815},{11,11,180},{11,11,837},{12,11,240},{13,11,152},{
+13,11,219},{142,11,158},{139,0,62},{132,10,515},{8,10,632},{8,10,697},{137,10,
+854},{134,0,1766},{132,11,581},{6,11,126},{7,11,573},{8,11,397},{142,11,44},{150
+,0,28},{11,0,670},{22,0,25},{4,10,136},{133,10,551},{6,0,1665},{7,0,256},{7,0,
+1388},{138,0,499},{4,0,22},{5,0,10},{7,0,1576},{136,0,97},{134,10,1782},{5,0,481
+},{7,10,1287},{9,10,44},{10,10,552},{10,10,642},{11,10,839},{12,10,274},{12,10,
+275},{12,10,372},{13,10,91},{142,10,125},{133,11,926},{7,11,1232},{137,11,531},{
+6,0,134},{7,0,437},{7,0,1824},{9,0,37},{14,0,285},{142,0,371},{7,0,486},{8,0,155
+},{11,0,93},{140,0,164},{6,0,1391},{134,0,1442},{133,11,670},{133,0,591},{6,10,
+147},{7,10,886},{7,11,1957},{9,10,753},{138,10,268},{5,0,380},{5,0,650},{7,0,
+1173},{136,0,310},{4,0,364},{7,0,1156},{7,0,1187},{137,0,409},{135,11,1621},{134
+,0,482},{133,11,506},{4,0,781},{6,0,487},{7,0,926},{8,0,263},{139,0,500},{138,10
+,137},{135,11,242},{139,11,96},{133,10,414},{135,10,1762},{134,0,804},{5,11,834}
+,{7,11,1202},{8,11,14},{9,11,481},{137,11,880},{134,10,599},{4,0,94},{135,0,1265
+},{4,0,415},{132,0,417},{5,0,348},{6,0,522},{6,10,1749},{7,11,1526},{138,11,465}
+,{134,10,1627},{132,0,1012},{132,10,488},{4,11,357},{6,11,172},{7,11,143},{137,
+11,413},{4,10,83},{4,11,590},{146,11,76},{140,10,676},{7,11,287},{8,11,355},{9,
+11,293},{137,11,743},{134,10,278},{6,0,1803},{18,0,165},{24,0,21},{5,11,169},{7,
+11,333},{136,11,45},{12,10,97},{140,11,97},{4,0,408},{4,0,741},{135,0,500},{132,
+11,198},{7,10,388},{7,10,644},{139,10,781},{4,11,24},{5,11,140},{5,11,185},{7,11
+,1500},{11,11,565},{139,11,838},{6,0,1321},{9,0,257},{7,10,229},{8,10,59},{9,10,
+190},{10,10,378},{140,10,191},{4,11,334},{133,11,593},{135,11,1885},{134,0,1138}
+,{4,0,249},{6,0,73},{135,0,177},{133,0,576},{142,0,231},{137,0,288},{132,10,660}
+,{7,10,1035},{138,10,737},{135,0,1487},{6,0,989},{9,0,433},{7,10,690},{9,10,587}
+,{140,10,521},{7,0,1264},{7,0,1678},{11,0,945},{12,0,341},{12,0,471},{140,0,569}
+,{132,11,709},{133,11,897},{5,11,224},{13,11,174},{146,11,52},{135,11,1840},{134
+,10,1744},{12,0,87},{16,0,74},{4,10,733},{9,10,194},{10,10,92},{11,10,198},{12,
+10,84},{141,10,128},{140,0,779},{135,0,538},{4,11,608},{133,11,497},{133,0,413},
+{7,11,1375},{7,11,1466},{138,11,331},{136,0,495},{6,11,540},{136,11,136},{7,0,54
+},{8,0,312},{10,0,191},{10,0,614},{140,0,567},{6,0,468},{7,0,567},{7,0,1478},{8,
+0,530},{14,0,290},{133,11,999},{4,11,299},{7,10,306},{135,11,1004},{142,11,296},
+{134,0,1484},{133,10,979},{6,0,609},{9,0,815},{12,11,137},{14,11,9},{14,11,24},{
+142,11,64},{133,11,456},{6,0,484},{135,0,822},{133,10,178},{136,11,180},{132,11,
+755},{137,0,900},{135,0,1335},{6,0,1724},{135,0,2022},{135,11,1139},{5,0,640},{
+132,10,390},{6,0,1831},{138,11,633},{135,11,566},{4,11,890},{5,11,805},{5,11,819
+},{5,11,961},{6,11,396},{6,11,1631},{6,11,1678},{7,11,1967},{7,11,2041},{9,11,
+630},{11,11,8},{11,11,1019},{12,11,176},{13,11,225},{14,11,292},{149,11,24},{132
+,0,474},{134,0,1103},{135,0,1504},{134,0,1576},{6,0,961},{6,0,1034},{140,0,655},
+{11,11,514},{149,11,20},{5,0,305},{135,11,1815},{7,11,1505},{10,11,190},{10,11,
+634},{11,11,792},{12,11,358},{140,11,447},{5,11,0},{6,11,536},{7,11,604},{13,11,
+445},{145,11,126},{7,0,1236},{133,10,105},{4,0,480},{6,0,217},{6,0,302},{6,0,
+1642},{7,0,130},{7,0,837},{7,0,1321},{7,0,1547},{7,0,1657},{8,0,429},{9,0,228},{
+13,0,289},{13,0,343},{19,0,101},{6,11,232},{6,11,412},{7,11,1074},{8,11,9},{8,11
+,157},{8,11,786},{9,11,196},{9,11,352},{9,11,457},{10,11,337},{11,11,232},{11,11
+,877},{12,11,480},{140,11,546},{5,10,438},{7,11,958},{9,10,694},{12,10,627},{13,
+11,38},{141,10,210},{4,11,382},{136,11,579},{7,0,278},{10,0,739},{11,0,708},{141
+,0,348},{4,11,212},{135,11,1206},{135,11,1898},{6,0,708},{6,0,1344},{152,10,11},
+{137,11,768},{134,0,1840},{140,0,233},{8,10,25},{138,10,826},{6,0,2017},{133,11,
+655},{6,0,1488},{139,11,290},{132,10,308},{134,0,1590},{134,0,1800},{134,0,1259}
+,{16,0,28},{6,11,231},{7,11,95},{136,11,423},{133,11,300},{135,10,150},{136,10,
+649},{7,11,1874},{137,11,641},{6,11,237},{7,11,611},{8,11,100},{9,11,416},{11,11
+,335},{12,11,173},{146,11,101},{137,0,45},{134,10,521},{17,0,36},{14,11,26},{146
+,11,150},{7,0,1442},{14,0,22},{5,10,339},{15,10,41},{15,10,166},{147,10,66},{8,0
+,378},{6,11,581},{135,11,1119},{134,0,1507},{147,11,117},{139,0,39},{134,0,1054}
+,{6,0,363},{7,0,1955},{136,0,725},{134,0,2036},{133,11,199},{6,0,1871},{9,0,935}
+,{9,0,961},{9,0,1004},{9,0,1016},{12,0,805},{12,0,852},{12,0,853},{12,0,869},{12
+,0,882},{12,0,896},{12,0,906},{12,0,917},{12,0,940},{15,0,170},{15,0,176},{15,0,
+188},{15,0,201},{15,0,205},{15,0,212},{15,0,234},{15,0,244},{18,0,181},{18,0,193
+},{18,0,196},{18,0,201},{18,0,202},{18,0,210},{18,0,217},{18,0,235},{18,0,236},{
+18,0,237},{21,0,54},{21,0,55},{21,0,58},{21,0,59},{152,0,22},{134,10,1628},{137,
+0,805},{5,0,813},{135,0,2046},{142,11,42},{5,0,712},{6,0,1240},{11,0,17},{13,0,
+321},{144,0,67},{132,0,617},{135,10,829},{6,0,320},{7,0,781},{7,0,1921},{9,0,55}
+,{10,0,186},{10,0,273},{10,0,664},{10,0,801},{11,0,996},{11,0,997},{13,0,157},{
+142,0,170},{136,0,271},{5,10,486},{135,10,1349},{18,11,91},{147,11,70},{10,0,445
+},{7,10,1635},{8,10,17},{138,10,295},{136,11,404},{7,0,103},{7,0,863},{11,0,184}
+,{145,0,62},{138,10,558},{137,0,659},{6,11,312},{6,11,1715},{10,11,584},{11,11,
+546},{11,11,692},{12,11,259},{12,11,295},{13,11,46},{141,11,154},{134,0,676},{
+132,11,588},{4,11,231},{5,11,61},{6,11,104},{7,11,729},{7,11,964},{7,11,1658},{
+140,11,414},{6,11,263},{138,11,757},{11,0,337},{142,0,303},{135,11,1363},{132,11
+,320},{140,0,506},{134,10,447},{5,0,77},{7,0,1455},{10,0,843},{147,0,73},{7,10,
+577},{7,10,1432},{9,10,475},{9,10,505},{9,10,526},{9,10,609},{9,10,689},{9,10,
+726},{9,10,735},{9,10,738},{10,10,556},{10,10,674},{10,10,684},{11,10,89},{11,10
+,202},{11,10,272},{11,10,380},{11,10,415},{11,10,505},{11,10,537},{11,10,550},{
+11,10,562},{11,10,640},{11,10,667},{11,10,688},{11,10,847},{11,10,927},{11,10,
+930},{11,10,940},{12,10,144},{12,10,325},{12,10,329},{12,10,389},{12,10,403},{12
+,10,451},{12,10,515},{12,10,604},{12,10,616},{12,10,626},{13,10,66},{13,10,131},
+{13,10,167},{13,10,236},{13,10,368},{13,10,411},{13,10,434},{13,10,453},{13,10,
+461},{13,10,474},{14,10,59},{14,10,60},{14,10,139},{14,10,152},{14,10,276},{14,
+10,353},{14,10,402},{15,10,28},{15,10,81},{15,10,123},{15,10,152},{18,10,136},{
+148,10,88},{132,0,458},{135,0,1420},{6,0,109},{10,0,382},{4,11,405},{4,10,609},{
+7,10,756},{7,11,817},{9,10,544},{11,10,413},{14,11,58},{14,10,307},{16,10,25},{
+17,11,37},{146,11,124},{6,0,330},{7,0,1084},{11,0,142},{133,11,974},{4,10,930},{
+133,10,947},{5,10,939},{142,11,394},{16,0,91},{145,0,87},{5,11,235},{5,10,962},{
+7,11,1239},{11,11,131},{140,11,370},{11,0,492},{5,10,651},{8,10,170},{9,10,61},{
+9,10,63},{10,10,23},{10,10,37},{10,10,834},{11,10,4},{11,10,281},{11,10,503},{11
+,10,677},{12,10,96},{12,10,130},{12,10,244},{14,10,5},{14,10,40},{14,10,162},{14
+,10,202},{146,10,133},{4,10,406},{5,10,579},{12,10,492},{150,10,15},{9,11,137},{
+138,11,221},{134,0,1239},{11,0,211},{140,0,145},{7,11,390},{138,11,140},{135,11,
+1418},{135,11,1144},{134,0,1049},{7,0,321},{6,10,17},{7,10,1001},{7,10,1982},{9,
+10,886},{10,10,489},{10,10,800},{11,10,782},{12,10,320},{13,10,467},{14,10,145},
+{14,10,387},{143,10,119},{145,10,17},{5,11,407},{11,11,489},{19,11,37},{20,11,73
+},{150,11,38},{133,10,458},{135,0,1985},{7,10,1983},{8,10,0},{8,10,171},{9,10,
+120},{9,10,732},{10,10,473},{11,10,656},{11,10,998},{18,10,0},{18,10,2},{147,10,
+21},{5,11,325},{7,11,1483},{8,11,5},{8,11,227},{9,11,105},{10,11,585},{140,11,
+614},{136,0,122},{132,0,234},{135,11,1196},{6,0,976},{6,0,1098},{134,0,1441},{7,
+0,253},{136,0,549},{6,11,621},{13,11,504},{144,11,19},{132,10,519},{5,0,430},{5,
+0,932},{6,0,131},{7,0,417},{9,0,522},{11,0,314},{141,0,390},{14,0,149},{14,0,399
+},{143,0,57},{5,10,907},{6,10,31},{6,11,218},{7,10,491},{7,10,530},{8,10,592},{
+11,10,53},{11,10,779},{12,10,167},{12,10,411},{14,10,14},{14,10,136},{15,10,72},
+{16,10,17},{144,10,72},{140,11,330},{7,11,454},{7,11,782},{136,11,768},{132,0,
+507},{10,11,676},{140,11,462},{6,0,630},{9,0,811},{4,10,208},{5,10,106},{6,10,
+531},{8,10,408},{9,10,188},{138,10,572},{4,0,343},{5,0,511},{134,10,1693},{134,
+11,164},{132,0,448},{7,0,455},{138,0,591},{135,0,1381},{12,10,441},{150,11,50},{
+9,10,449},{10,10,192},{138,10,740},{6,0,575},{132,10,241},{134,0,1175},{134,0,
+653},{134,0,1761},{134,0,1198},{132,10,259},{6,11,343},{7,11,195},{9,11,226},{10
+,11,197},{10,11,575},{11,11,502},{139,11,899},{7,0,1127},{7,0,1572},{10,0,297},{
+10,0,422},{11,0,764},{11,0,810},{12,0,264},{13,0,102},{13,0,300},{13,0,484},{14,
+0,147},{14,0,229},{17,0,71},{18,0,118},{147,0,120},{135,11,666},{132,0,678},{4,
+10,173},{5,10,312},{5,10,512},{135,10,1285},{7,10,1603},{7,10,1691},{9,10,464},{
+11,10,195},{12,10,279},{12,10,448},{14,10,11},{147,10,102},{16,0,99},{146,0,164}
+,{7,11,1125},{9,11,143},{11,11,61},{14,11,405},{150,11,21},{137,11,260},{4,10,
+452},{5,10,583},{5,10,817},{6,10,433},{7,10,593},{7,10,720},{7,10,1378},{8,10,
+161},{9,10,284},{10,10,313},{139,10,886},{132,10,547},{136,10,722},{14,0,35},{
+142,0,191},{141,0,45},{138,0,121},{132,0,125},{134,0,1622},{133,11,959},{8,10,
+420},{139,10,193},{132,0,721},{135,10,409},{136,0,145},{7,0,792},{8,0,147},{10,0
+,821},{11,0,970},{11,0,1021},{136,11,173},{134,11,266},{132,0,715},{7,0,1999},{
+138,10,308},{133,0,531},{5,0,168},{5,0,930},{8,0,74},{9,0,623},{12,0,500},{140,0
+,579},{144,0,65},{138,11,246},{6,0,220},{7,0,1101},{13,0,105},{142,11,314},{5,10
+,1002},{136,10,745},{134,0,960},{20,0,0},{148,11,0},{4,0,1005},{4,10,239},{6,10,
+477},{7,10,1607},{11,10,68},{139,10,617},{6,0,19},{7,0,1413},{139,0,428},{149,10
+,13},{7,0,96},{8,0,401},{8,0,703},{9,0,896},{136,11,300},{134,0,1595},{145,0,116
+},{136,0,1021},{7,0,1961},{7,0,1965},{7,0,2030},{8,0,150},{8,0,702},{8,0,737},{8
+,0,750},{140,0,366},{11,11,75},{142,11,267},{132,10,367},{8,0,800},{9,0,148},{9,
+0,872},{9,0,890},{11,0,309},{11,0,1001},{13,0,267},{13,0,323},{5,11,427},{5,11,
+734},{7,11,478},{136,11,52},{7,11,239},{11,11,217},{142,11,165},{132,11,323},{
+140,11,419},{13,0,299},{142,0,75},{6,11,87},{6,11,1734},{7,11,20},{7,11,1056},{8
+,11,732},{9,11,406},{9,11,911},{138,11,694},{134,0,1383},{132,10,694},{133,11,
+613},{137,0,779},{4,0,598},{140,10,687},{6,0,970},{135,0,424},{133,0,547},{7,11,
+32},{7,11,984},{8,11,85},{8,11,709},{9,11,579},{9,11,847},{9,11,856},{10,11,799}
+,{11,11,258},{11,11,1007},{12,11,331},{12,11,615},{13,11,188},{13,11,435},{14,11
+,8},{15,11,165},{16,11,27},{148,11,40},{6,0,1222},{134,0,1385},{132,0,876},{138,
+11,151},{135,10,213},{4,11,167},{135,11,82},{133,0,133},{6,11,24},{7,11,74},{7,
+11,678},{137,11,258},{5,11,62},{6,11,534},{7,11,684},{7,11,1043},{7,11,1072},{8,
+11,280},{8,11,541},{8,11,686},{10,11,519},{11,11,252},{140,11,282},{136,0,187},{
+8,0,8},{10,0,0},{10,0,818},{139,0,988},{132,11,359},{11,0,429},{15,0,51},{135,10
+,1672},{136,0,685},{5,11,211},{7,11,88},{136,11,627},{134,0,472},{136,0,132},{6,
+11,145},{141,11,336},{4,10,751},{11,10,390},{140,10,32},{6,0,938},{6,0,1060},{4,
+11,263},{4,10,409},{133,10,78},{137,0,874},{8,0,774},{10,0,670},{12,0,51},{4,11,
+916},{6,10,473},{7,10,1602},{10,10,698},{12,10,212},{13,10,307},{145,10,105},{
+146,0,92},{143,10,156},{132,0,830},{137,0,701},{4,11,599},{6,11,1634},{7,11,5},{
+7,11,55},{7,11,67},{7,11,97},{7,11,691},{7,11,979},{7,11,1697},{8,11,207},{8,11,
+214},{8,11,231},{8,11,294},{8,11,336},{8,11,428},{8,11,451},{8,11,460},{8,11,471
+},{8,11,622},{8,11,626},{8,11,679},{8,11,759},{8,11,829},{9,11,11},{9,11,246},{9
+,11,484},{9,11,573},{9,11,706},{9,11,762},{9,11,798},{9,11,855},{9,11,870},{9,11
+,912},{10,11,303},{10,11,335},{10,11,424},{10,11,461},{10,11,543},{10,11,759},{
+10,11,814},{11,11,59},{11,11,199},{11,11,235},{11,11,475},{11,11,590},{11,11,929
+},{11,11,963},{12,11,114},{12,11,182},{12,11,226},{12,11,332},{12,11,439},{12,11
+,575},{12,11,598},{13,11,8},{13,11,125},{13,11,194},{13,11,287},{14,11,197},{14,
+11,383},{15,11,53},{17,11,63},{19,11,46},{19,11,98},{19,11,106},{148,11,85},{4,0
+,127},{5,0,350},{6,0,356},{8,0,426},{9,0,572},{10,0,247},{139,0,312},{134,0,1215
+},{6,0,59},{9,0,603},{13,0,397},{7,11,1853},{138,11,437},{134,0,1762},{147,11,
+126},{135,10,883},{13,0,293},{142,0,56},{133,10,617},{139,10,50},{5,11,187},{7,
+10,1518},{139,10,694},{135,0,441},{6,0,111},{7,0,4},{8,0,163},{8,0,776},{138,0,
+566},{132,0,806},{4,11,215},{9,11,38},{10,11,3},{11,11,23},{11,11,127},{139,11,
+796},{14,0,233},{4,10,546},{135,10,2042},{135,0,1994},{134,0,1739},{135,11,1530}
+,{136,0,393},{5,0,297},{7,0,1038},{14,0,359},{19,0,52},{148,0,47},{135,0,309},{4
+,10,313},{133,10,577},{8,10,184},{141,10,433},{135,10,935},{12,10,186},{12,10,
+292},{14,10,100},{146,10,70},{136,0,363},{14,0,175},{11,10,402},{12,10,109},{12,
+10,431},{13,10,179},{13,10,206},{14,10,217},{16,10,3},{148,10,53},{5,10,886},{6,
+10,46},{6,10,1790},{7,10,14},{7,10,732},{7,10,1654},{8,10,95},{8,10,327},{8,10,
+616},{9,10,892},{10,10,598},{10,10,769},{11,10,134},{11,10,747},{12,10,378},{142
+,10,97},{136,0,666},{135,0,1675},{6,0,655},{134,0,1600},{135,0,808},{133,10,1021
+},{4,11,28},{5,11,440},{7,11,248},{11,11,833},{140,11,344},{134,11,1654},{132,0,
+280},{140,0,54},{4,0,421},{133,0,548},{132,10,153},{6,11,339},{135,11,923},{133,
+11,853},{133,10,798},{132,10,587},{6,11,249},{7,11,1234},{139,11,573},{6,10,598}
+,{7,10,42},{8,10,695},{10,10,212},{11,10,158},{14,10,196},{145,10,85},{7,0,249},
+{5,10,957},{133,10,1008},{4,10,129},{135,10,465},{6,0,254},{7,0,842},{7,0,1659},
+{9,0,109},{10,0,103},{7,10,908},{7,10,1201},{9,10,755},{11,10,906},{12,10,527},{
+146,10,7},{5,0,262},{136,10,450},{144,0,1},{10,11,201},{142,11,319},{7,11,49},{7
+,11,392},{8,11,20},{8,11,172},{8,11,690},{9,11,383},{9,11,845},{10,11,48},{11,11
+,293},{11,11,832},{11,11,920},{141,11,221},{5,11,858},{133,11,992},{134,0,805},{
+139,10,1003},{6,0,1630},{134,11,307},{7,11,1512},{135,11,1794},{6,11,268},{137,
+11,62},{135,10,1868},{133,0,671},{4,0,989},{8,0,972},{136,0,998},{132,11,423},{
+132,0,889},{135,0,1382},{135,0,1910},{7,10,965},{7,10,1460},{135,10,1604},{4,0,
+627},{5,0,775},{138,11,106},{134,11,348},{7,0,202},{11,0,362},{11,0,948},{140,0,
+388},{138,11,771},{6,11,613},{136,11,223},{6,0,560},{7,0,451},{8,0,389},{12,0,
+490},{13,0,16},{13,0,215},{13,0,351},{18,0,132},{147,0,125},{135,0,841},{136,0,
+566},{136,0,938},{132,11,670},{5,0,912},{6,0,1695},{140,11,55},{9,11,40},{139,11
+,136},{7,0,1361},{7,10,982},{10,10,32},{143,10,56},{11,11,259},{140,11,270},{5,0
+,236},{6,0,572},{8,0,492},{11,0,618},{144,0,56},{8,11,572},{9,11,310},{9,11,682}
+,{137,11,698},{134,0,1854},{5,0,190},{136,0,318},{133,10,435},{135,0,1376},{4,11
+,296},{6,11,352},{7,11,401},{7,11,1410},{7,11,1594},{7,11,1674},{8,11,63},{8,11,
+660},{137,11,74},{7,0,349},{5,10,85},{6,10,419},{7,10,305},{7,10,361},{7,10,1337
+},{8,10,71},{140,10,519},{4,11,139},{4,11,388},{140,11,188},{6,0,1972},{6,0,2013
+},{8,0,951},{10,0,947},{10,0,974},{10,0,1018},{142,0,476},{140,10,688},{135,10,
+740},{5,10,691},{7,10,345},{9,10,94},{140,10,169},{9,0,344},{5,10,183},{6,10,582
+},{10,10,679},{140,10,435},{135,10,511},{132,0,850},{8,11,441},{10,11,314},{143,
+11,3},{7,10,1993},{136,10,684},{4,11,747},{6,11,290},{6,10,583},{7,11,649},{7,11
+,1479},{135,11,1583},{133,11,232},{133,10,704},{134,0,910},{4,10,179},{5,10,198}
+,{133,10,697},{7,10,347},{7,10,971},{8,10,181},{138,10,711},{136,11,525},{14,0,
+19},{14,0,28},{144,0,29},{7,0,85},{7,0,247},{8,0,585},{138,0,163},{4,0,487},{7,
+11,472},{7,11,1801},{10,11,748},{141,11,458},{4,10,243},{5,10,203},{7,10,19},{7,
+10,71},{7,10,113},{10,10,405},{11,10,357},{142,10,240},{7,10,1450},{139,10,99},{
+132,11,425},{138,0,145},{147,0,83},{6,10,492},{137,11,247},{4,0,1013},{134,0,
+2033},{5,10,134},{6,10,408},{6,10,495},{135,10,1593},{135,0,1922},{134,11,1768},
+{4,0,124},{10,0,457},{11,0,121},{11,0,169},{11,0,870},{11,0,874},{12,0,214},{14,
+0,187},{143,0,77},{5,0,557},{135,0,1457},{139,0,66},{5,11,943},{6,11,1779},{142,
+10,4},{4,10,248},{4,10,665},{7,10,137},{137,10,349},{7,0,1193},{5,11,245},{6,11,
+576},{7,11,582},{136,11,225},{144,0,82},{7,10,1270},{139,10,612},{5,0,454},{10,0
+,352},{138,11,352},{18,0,57},{5,10,371},{135,10,563},{135,0,1333},{6,0,107},{7,0
+,638},{7,0,1632},{9,0,396},{134,11,610},{5,0,370},{134,0,1756},{4,10,374},{7,10,
+547},{7,10,1700},{7,10,1833},{139,10,858},{133,0,204},{6,0,1305},{9,10,311},{141
+,10,42},{5,0,970},{134,0,1706},{6,10,1647},{7,10,1552},{7,10,2010},{9,10,494},{
+137,10,509},{13,11,455},{15,11,99},{15,11,129},{144,11,68},{135,0,3},{4,0,35},{5
+,0,121},{5,0,483},{5,0,685},{6,0,489},{6,0,782},{6,0,1032},{7,0,1204},{136,0,394
+},{4,0,921},{133,0,1007},{8,11,360},{138,11,63},{135,0,1696},{134,0,1519},{132,
+11,443},{135,11,944},{6,10,123},{7,10,214},{9,10,728},{10,10,157},{11,10,346},{
+11,10,662},{143,10,106},{137,0,981},{135,10,1435},{134,0,1072},{132,0,712},{134,
+0,1629},{134,0,728},{4,11,298},{137,11,483},{6,0,1177},{6,0,1271},{5,11,164},{7,
+11,121},{142,11,189},{7,0,1608},{4,10,707},{5,10,588},{6,10,393},{13,10,106},{18
+,10,49},{147,10,41},{23,0,16},{151,11,16},{6,10,211},{7,10,1690},{11,10,486},{
+140,10,369},{133,0,485},{19,11,15},{149,11,27},{4,11,172},{9,11,611},{10,11,436}
+,{12,11,673},{141,11,255},{5,11,844},{10,11,484},{11,11,754},{12,11,457},{14,11,
+171},{14,11,389},{146,11,153},{4,0,285},{5,0,27},{5,0,317},{6,0,301},{7,0,7},{8,
+0,153},{10,0,766},{11,0,468},{12,0,467},{141,0,143},{134,0,1462},{9,11,263},{10,
+11,147},{138,11,492},{133,11,537},{6,0,1945},{6,0,1986},{6,0,1991},{134,0,2038},
+{134,10,219},{137,11,842},{14,0,52},{17,0,50},{5,10,582},{6,10,1646},{7,10,99},{
+7,10,1962},{7,10,1986},{8,10,515},{8,10,773},{9,10,23},{9,10,491},{12,10,620},{
+142,10,93},{138,11,97},{20,0,21},{20,0,44},{133,10,851},{136,0,819},{139,0,917},
+{5,11,230},{5,11,392},{6,11,420},{8,10,762},{8,10,812},{9,11,568},{9,10,910},{
+140,11,612},{135,0,784},{15,0,135},{143,11,135},{10,0,454},{140,0,324},{4,11,0},
+{5,11,41},{7,11,1459},{7,11,1469},{7,11,1618},{7,11,1859},{9,11,549},{139,11,905
+},{4,10,98},{7,10,1365},{9,10,422},{9,10,670},{10,10,775},{11,10,210},{13,10,26}
+,{13,10,457},{141,10,476},{6,0,1719},{6,0,1735},{7,0,2016},{7,0,2020},{8,0,837},
+{137,0,852},{133,11,696},{135,0,852},{132,0,952},{134,10,1730},{132,11,771},{138
+,0,568},{137,0,448},{139,0,146},{8,0,67},{138,0,419},{133,11,921},{137,10,147},{
+134,0,1826},{10,0,657},{14,0,297},{142,0,361},{6,0,666},{6,0,767},{134,0,1542},{
+139,0,729},{6,11,180},{7,11,1137},{8,11,751},{139,11,805},{4,11,183},{7,11,271},
+{11,11,824},{11,11,952},{13,11,278},{13,11,339},{13,11,482},{14,11,424},{148,11,
+99},{4,0,669},{5,11,477},{5,11,596},{6,11,505},{7,11,1221},{11,11,907},{12,11,
+209},{141,11,214},{135,11,1215},{5,0,402},{6,10,30},{11,10,56},{139,10,305},{7,
+11,564},{142,11,168},{139,0,152},{7,0,912},{135,10,1614},{4,10,150},{5,10,303},{
+134,10,327},{7,0,320},{8,0,51},{9,0,868},{10,0,833},{12,0,481},{12,0,570},{148,0
+,106},{132,0,445},{7,11,274},{11,11,263},{11,11,479},{11,11,507},{140,11,277},{
+10,0,555},{11,0,308},{19,0,95},{6,11,1645},{8,10,192},{10,10,78},{141,10,359},{
+135,10,786},{6,11,92},{6,11,188},{7,11,1269},{7,11,1524},{7,11,1876},{10,11,228}
+,{139,11,1020},{4,11,459},{133,11,966},{11,0,386},{6,10,1638},{7,10,79},{7,10,
+496},{9,10,138},{10,10,336},{12,10,412},{12,10,440},{142,10,305},{133,0,239},{7,
+0,83},{7,0,1990},{8,0,130},{139,0,720},{138,11,709},{4,0,143},{5,0,550},{133,0,
+752},{5,0,123},{6,0,530},{7,0,348},{135,0,1419},{135,0,2024},{6,11,18},{7,11,179
+},{7,11,721},{7,11,932},{8,11,548},{8,11,757},{9,11,54},{9,11,65},{9,11,532},{9,
+11,844},{10,11,113},{10,11,117},{10,11,236},{10,11,315},{10,11,430},{10,11,798},
+{11,11,153},{11,11,351},{11,11,375},{12,11,78},{12,11,151},{12,11,392},{14,11,
+248},{143,11,23},{7,10,204},{7,10,415},{8,10,42},{10,10,85},{139,10,564},{134,0,
+958},{133,11,965},{132,0,210},{135,11,1429},{138,11,480},{134,11,182},{139,11,
+345},{10,11,65},{10,11,488},{138,11,497},{4,10,3},{5,10,247},{5,10,644},{7,10,
+744},{7,10,1207},{7,10,1225},{7,10,1909},{146,10,147},{132,0,430},{5,10,285},{9,
+10,67},{13,10,473},{143,10,82},{144,11,16},{7,11,1162},{9,11,588},{10,11,260},{
+151,10,8},{133,0,213},{138,0,7},{135,0,801},{134,11,1786},{135,11,308},{6,0,936}
+,{134,0,1289},{133,0,108},{132,0,885},{133,0,219},{139,0,587},{4,0,193},{5,0,916
+},{6,0,1041},{7,0,364},{10,0,398},{10,0,726},{11,0,317},{11,0,626},{12,0,142},{
+12,0,288},{12,0,678},{13,0,313},{15,0,113},{146,0,114},{135,0,1165},{6,0,241},{9
+,0,342},{10,0,729},{11,0,284},{11,0,445},{11,0,651},{11,0,863},{13,0,398},{146,0
+,99},{7,0,907},{136,0,832},{9,0,303},{4,10,29},{6,10,532},{7,10,1628},{7,10,1648
+},{9,10,350},{10,10,433},{11,10,97},{11,10,557},{11,10,745},{12,10,289},{12,10,
+335},{12,10,348},{12,10,606},{13,10,116},{13,10,233},{13,10,466},{14,10,181},{14
+,10,209},{14,10,232},{14,10,236},{14,10,300},{16,10,41},{148,10,97},{7,11,423},{
+7,10,1692},{136,11,588},{6,0,931},{134,0,1454},{5,10,501},{7,10,1704},{9,10,553}
+,{11,10,520},{12,10,557},{141,10,249},{136,11,287},{4,0,562},{9,0,254},{139,0,
+879},{132,0,786},{14,11,32},{18,11,85},{20,11,2},{152,11,16},{135,0,1294},{7,11,
+723},{135,11,1135},{6,0,216},{7,0,901},{7,0,1343},{8,0,493},{134,11,403},{7,11,
+719},{8,11,809},{136,11,834},{5,11,210},{6,11,213},{7,11,60},{10,11,364},{139,11
+,135},{7,0,341},{11,0,219},{5,11,607},{8,11,326},{136,11,490},{4,11,701},{5,11,
+472},{5,11,639},{7,11,1249},{9,11,758},{139,11,896},{135,11,380},{135,11,1947},{
+139,0,130},{135,0,1734},{10,0,115},{11,0,420},{12,0,154},{13,0,404},{14,0,346},{
+143,0,54},{134,10,129},{4,11,386},{7,11,41},{8,11,405},{9,11,497},{11,11,110},{
+11,11,360},{15,11,37},{144,11,84},{141,11,282},{5,11,46},{7,11,1452},{7,11,1480}
+,{8,11,634},{140,11,472},{4,11,524},{136,11,810},{10,11,238},{141,11,33},{133,0,
+604},{5,0,1011},{136,0,701},{8,0,856},{8,0,858},{8,0,879},{12,0,702},{142,0,447}
+,{4,0,54},{5,0,666},{7,0,1039},{7,0,1130},{9,0,195},{138,0,302},{4,10,25},{5,10,
+60},{6,10,504},{7,10,614},{7,10,1155},{140,10,0},{7,10,1248},{11,10,621},{139,10
+,702},{133,11,997},{137,10,321},{134,0,1669},{134,0,1791},{4,10,379},{135,10,
+1397},{138,11,372},{5,11,782},{5,11,829},{134,11,1738},{135,0,1228},{4,10,118},{
+6,10,274},{6,10,361},{7,10,75},{141,10,441},{132,0,623},{9,11,279},{10,11,407},{
+14,11,84},{150,11,18},{137,10,841},{135,0,798},{140,10,693},{5,10,314},{6,10,221
+},{7,10,419},{10,10,650},{11,10,396},{12,10,156},{13,10,369},{14,10,333},{145,10
+,47},{135,11,1372},{7,0,122},{9,0,259},{10,0,84},{11,0,470},{12,0,541},{141,0,
+379},{134,0,837},{8,0,1013},{4,11,78},{5,11,96},{5,11,182},{7,11,1724},{7,11,
+1825},{10,11,394},{10,11,471},{11,11,532},{14,11,340},{145,11,88},{134,0,577},{
+135,11,1964},{132,10,913},{134,0,460},{8,0,891},{10,0,901},{10,0,919},{10,0,932}
+,{12,0,715},{12,0,728},{12,0,777},{14,0,457},{144,0,103},{5,0,82},{5,0,131},{7,0
+,1755},{8,0,31},{9,0,168},{9,0,764},{139,0,869},{136,10,475},{6,0,605},{5,10,
+1016},{9,11,601},{9,11,619},{10,11,505},{10,11,732},{11,11,355},{140,11,139},{7,
+10,602},{8,10,179},{10,10,781},{140,10,126},{134,0,1246},{6,10,329},{138,10,111}
+,{6,11,215},{7,11,1028},{7,11,1473},{7,11,1721},{9,11,424},{138,11,779},{5,0,278
+},{137,0,68},{6,0,932},{6,0,1084},{144,0,86},{4,0,163},{5,0,201},{5,0,307},{5,0,
+310},{6,0,335},{7,0,284},{7,0,1660},{136,0,165},{136,0,781},{134,0,707},{6,0,33}
+,{135,0,1244},{5,10,821},{6,11,67},{6,10,1687},{7,11,258},{7,11,1630},{9,11,354}
+,{9,11,675},{10,11,830},{14,11,80},{145,11,80},{6,11,141},{7,11,225},{9,11,59},{
+9,11,607},{10,11,312},{11,11,687},{12,11,555},{13,11,373},{13,11,494},{148,11,58
+},{134,0,1113},{9,0,388},{5,10,71},{7,10,1407},{9,10,704},{10,10,261},{10,10,619
+},{11,10,547},{11,10,619},{143,10,157},{7,0,1953},{136,0,720},{138,0,203},{7,10,
+2008},{9,10,337},{138,10,517},{6,0,326},{7,0,677},{137,0,425},{139,11,81},{7,0,
+1316},{7,0,1412},{7,0,1839},{9,0,589},{11,0,241},{11,0,676},{11,0,811},{11,0,891
+},{12,0,140},{12,0,346},{12,0,479},{13,0,140},{13,0,381},{14,0,188},{18,0,30},{
+148,0,108},{5,0,416},{6,10,86},{6,10,603},{7,10,292},{7,10,561},{8,10,257},{8,10
+,382},{9,10,721},{9,10,778},{11,10,581},{140,10,466},{4,10,486},{133,10,491},{
+134,0,1300},{132,10,72},{7,0,847},{6,10,265},{7,11,430},{139,11,46},{5,11,602},{
+6,11,106},{7,11,1786},{7,11,1821},{7,11,2018},{9,11,418},{137,11,763},{5,0,358},
+{7,0,535},{7,0,1184},{10,0,662},{13,0,212},{13,0,304},{13,0,333},{145,0,98},{5,
+11,65},{6,11,416},{7,11,1720},{7,11,1924},{8,11,677},{10,11,109},{11,11,14},{11,
+11,70},{11,11,569},{11,11,735},{15,11,153},{148,11,80},{6,0,1823},{8,0,839},{8,0
+,852},{8,0,903},{10,0,940},{12,0,707},{140,0,775},{135,11,1229},{6,0,1522},{140,
+0,654},{136,11,595},{139,0,163},{141,0,314},{132,0,978},{4,0,601},{6,0,2035},{
+137,10,234},{5,10,815},{6,10,1688},{134,10,1755},{133,0,946},{136,0,434},{6,10,
+197},{136,10,205},{7,0,411},{7,0,590},{8,0,631},{9,0,323},{10,0,355},{11,0,491},
+{12,0,143},{12,0,402},{13,0,73},{14,0,408},{15,0,107},{146,0,71},{7,0,1467},{8,0
+,328},{10,0,544},{11,0,955},{12,0,13},{13,0,320},{145,0,83},{142,0,410},{11,0,
+511},{13,0,394},{14,0,298},{14,0,318},{146,0,103},{6,10,452},{7,10,312},{138,10,
+219},{138,10,589},{4,10,333},{9,10,176},{12,10,353},{141,10,187},{135,11,329},{
+132,11,469},{5,0,835},{134,0,483},{134,11,1743},{5,11,929},{6,11,340},{8,11,376}
+,{136,11,807},{134,10,1685},{132,0,677},{5,11,218},{7,11,1610},{138,11,83},{5,11
+,571},{135,11,1842},{132,11,455},{137,0,70},{135,0,1405},{7,10,135},{8,10,7},{8,
+10,62},{9,10,243},{10,10,658},{10,10,697},{11,10,456},{139,10,756},{9,10,395},{
+138,10,79},{137,0,108},{6,11,161},{7,11,372},{137,11,597},{132,11,349},{132,0,
+777},{132,0,331},{135,10,631},{133,0,747},{6,11,432},{6,11,608},{139,11,322},{
+138,10,835},{5,11,468},{7,11,1809},{10,11,325},{11,11,856},{12,11,345},{143,11,
+104},{133,11,223},{7,10,406},{7,10,459},{8,10,606},{139,10,726},{132,11,566},{
+142,0,68},{4,11,59},{135,11,1394},{6,11,436},{139,11,481},{4,11,48},{5,11,271},{
+135,11,953},{139,11,170},{5,11,610},{136,11,457},{133,11,755},{135,11,1217},{133
+,10,612},{132,11,197},{132,0,505},{4,10,372},{7,10,482},{8,10,158},{9,10,602},{9
+,10,615},{10,10,245},{10,10,678},{10,10,744},{11,10,248},{139,10,806},{133,0,326
+},{5,10,854},{135,10,1991},{4,0,691},{146,0,16},{6,0,628},{9,0,35},{10,0,680},{
+10,0,793},{11,0,364},{13,0,357},{143,0,164},{138,0,654},{6,0,32},{7,0,385},{7,0,
+757},{7,0,1916},{8,0,37},{8,0,94},{8,0,711},{9,0,541},{10,0,162},{10,0,795},{11,
+0,989},{11,0,1010},{12,0,14},{142,0,308},{133,11,217},{6,0,152},{6,0,349},{6,0,
+1682},{7,0,1252},{8,0,112},{9,0,435},{9,0,668},{10,0,290},{10,0,319},{10,0,815},
+{11,0,180},{11,0,837},{12,0,240},{13,0,152},{13,0,219},{142,0,158},{4,0,581},{
+134,0,726},{5,10,195},{135,10,1685},{6,0,126},{7,0,573},{8,0,397},{142,0,44},{
+138,0,89},{7,10,1997},{8,10,730},{139,10,1006},{134,0,1531},{134,0,1167},{5,0,
+926},{12,0,203},{133,10,751},{4,11,165},{7,11,1398},{135,11,1829},{7,0,1232},{
+137,0,531},{135,10,821},{134,0,943},{133,0,670},{4,0,880},{139,0,231},{134,0,
+1617},{135,0,1957},{5,11,9},{7,11,297},{7,11,966},{140,11,306},{6,0,975},{134,0,
+985},{5,10,950},{5,10,994},{134,10,351},{12,11,21},{151,11,7},{5,11,146},{6,11,
+411},{138,11,721},{7,0,242},{135,0,1942},{6,11,177},{135,11,467},{5,0,421},{7,10
+,47},{137,10,684},{5,0,834},{7,0,1202},{8,0,14},{9,0,481},{137,0,880},{138,0,465
+},{6,0,688},{9,0,834},{132,10,350},{132,0,855},{4,0,357},{6,0,172},{7,0,143},{
+137,0,413},{133,11,200},{132,0,590},{7,10,1812},{13,10,259},{13,10,356},{14,10,
+242},{147,10,114},{133,10,967},{11,0,114},{4,10,473},{7,10,623},{8,10,808},{9,10
+,871},{9,10,893},{11,10,431},{12,10,112},{12,10,217},{12,10,243},{12,10,562},{12
+,10,663},{12,10,683},{13,10,141},{13,10,197},{13,10,227},{13,10,406},{13,10,487}
+,{14,10,156},{14,10,203},{14,10,224},{14,10,256},{18,10,58},{150,10,0},{138,10,
+286},{4,10,222},{7,10,286},{136,10,629},{5,0,169},{7,0,333},{136,0,45},{134,11,
+481},{132,0,198},{4,0,24},{5,0,140},{5,0,185},{7,0,1500},{11,0,565},{11,0,838},{
+4,11,84},{7,11,1482},{10,11,76},{138,11,142},{133,0,585},{141,10,306},{133,11,
+1015},{4,11,315},{5,11,507},{135,11,1370},{136,10,146},{6,0,691},{134,0,1503},{4
+,0,334},{133,0,593},{4,10,465},{135,10,1663},{142,11,173},{135,0,913},{12,0,116}
+,{134,11,1722},{134,0,1360},{132,0,802},{8,11,222},{8,11,476},{9,11,238},{11,11,
+516},{11,11,575},{15,11,109},{146,11,100},{6,0,308},{9,0,673},{7,10,138},{7,10,
+517},{139,10,238},{132,0,709},{6,0,1876},{6,0,1895},{9,0,994},{9,0,1006},{12,0,
+829},{12,0,888},{12,0,891},{146,0,185},{148,10,94},{4,0,228},{133,0,897},{7,0,
+1840},{5,10,495},{7,10,834},{9,10,733},{139,10,378},{133,10,559},{6,10,21},{6,10
+,1737},{7,10,1444},{136,10,224},{4,0,608},{133,0,497},{6,11,40},{135,11,1781},{
+134,0,1573},{135,0,2039},{6,0,540},{136,0,136},{4,0,897},{5,0,786},{133,10,519},
+{6,0,1878},{6,0,1884},{9,0,938},{9,0,948},{9,0,955},{9,0,973},{9,0,1012},{12,0,
+895},{12,0,927},{143,0,254},{134,0,1469},{133,0,999},{4,0,299},{135,0,1004},{4,0
+,745},{133,0,578},{136,11,574},{133,0,456},{134,0,1457},{7,0,1679},{132,10,402},
+{7,0,693},{8,0,180},{12,0,163},{8,10,323},{136,10,479},{11,10,580},{142,10,201},
+{5,10,59},{135,10,672},{132,11,354},{146,10,34},{4,0,755},{135,11,1558},{7,0,
+1740},{146,0,48},{4,10,85},{135,10,549},{139,0,338},{133,10,94},{134,0,1091},{
+135,11,469},{12,0,695},{12,0,704},{20,0,113},{5,11,830},{14,11,338},{148,11,81},
+{135,0,1464},{6,10,11},{135,10,187},{135,0,975},{13,0,335},{132,10,522},{134,0,
+1979},{5,11,496},{135,11,203},{4,10,52},{135,10,661},{7,0,1566},{8,0,269},{9,0,
+212},{9,0,718},{14,0,15},{14,0,132},{142,0,227},{4,0,890},{5,0,805},{5,0,819},{5
+,0,961},{6,0,396},{6,0,1631},{6,0,1678},{7,0,1967},{7,0,2041},{9,0,630},{11,0,8}
+,{11,0,1019},{12,0,176},{13,0,225},{14,0,292},{21,0,24},{4,10,383},{133,10,520},
+{134,11,547},{135,11,1748},{5,11,88},{137,11,239},{146,11,128},{7,11,650},{135,
+11,1310},{4,10,281},{5,10,38},{7,10,194},{7,10,668},{7,10,1893},{137,10,397},{
+135,0,1815},{9,10,635},{139,10,559},{7,0,1505},{10,0,190},{10,0,634},{11,0,792},
+{12,0,358},{140,0,447},{5,0,0},{6,0,536},{7,0,604},{13,0,445},{145,0,126},{7,11,
+1076},{9,11,80},{11,11,78},{11,11,421},{11,11,534},{140,11,545},{8,0,966},{10,0,
+1023},{14,11,369},{146,11,72},{135,11,1641},{6,0,232},{6,0,412},{7,0,1074},{8,0,
+9},{8,0,157},{8,0,786},{9,0,196},{9,0,352},{9,0,457},{10,0,337},{11,0,232},{11,0
+,877},{12,0,480},{140,0,546},{135,0,958},{4,0,382},{136,0,579},{4,0,212},{135,0,
+1206},{4,11,497},{5,11,657},{135,11,1584},{132,0,681},{8,0,971},{138,0,965},{5,
+10,448},{136,10,535},{14,0,16},{146,0,44},{11,0,584},{11,0,616},{14,0,275},{11,
+11,584},{11,11,616},{142,11,275},{136,11,13},{7,10,610},{135,10,1501},{7,11,642}
+,{8,11,250},{11,11,123},{11,11,137},{13,11,48},{142,11,95},{133,0,655},{17,0,67}
+,{147,0,74},{134,0,751},{134,0,1967},{6,0,231},{136,0,423},{5,0,300},{138,0,1016
+},{4,10,319},{5,10,699},{138,10,673},{6,0,237},{7,0,611},{8,0,100},{9,0,416},{11
+,0,335},{12,0,173},{18,0,101},{6,10,336},{8,10,552},{9,10,285},{10,10,99},{139,
+10,568},{134,0,1370},{7,10,1406},{9,10,218},{141,10,222},{133,10,256},{135,0,
+1208},{14,11,213},{148,11,38},{6,0,1219},{135,11,1642},{13,0,417},{14,0,129},{
+143,0,15},{10,11,545},{140,11,301},{17,10,39},{148,10,36},{133,0,199},{4,11,904}
+,{133,11,794},{12,0,427},{146,0,38},{134,0,949},{8,0,665},{135,10,634},{132,10,
+618},{135,10,259},{132,10,339},{133,11,761},{141,10,169},{132,10,759},{5,0,688},
+{7,0,539},{135,0,712},{7,11,386},{138,11,713},{134,0,1186},{6,11,7},{6,11,35},{7
+,11,147},{7,11,1069},{7,11,1568},{7,11,1575},{7,11,1917},{8,11,43},{8,11,208},{9
+,11,128},{9,11,866},{10,11,20},{11,11,981},{147,11,33},{7,11,893},{8,10,482},{
+141,11,424},{6,0,312},{6,0,1715},{10,0,584},{11,0,546},{11,0,692},{12,0,259},{12
+,0,295},{13,0,46},{141,0,154},{5,10,336},{6,10,341},{6,10,478},{6,10,1763},{136,
+10,386},{137,0,151},{132,0,588},{152,0,4},{6,11,322},{9,11,552},{11,11,274},{13,
+11,209},{13,11,499},{14,11,85},{15,11,126},{145,11,70},{135,10,73},{4,0,231},{5,
+0,61},{6,0,104},{7,0,729},{7,0,964},{7,0,1658},{140,0,414},{6,0,263},{138,0,757}
+,{135,10,1971},{4,0,612},{133,0,561},{132,0,320},{135,10,1344},{8,11,83},{8,11,
+817},{9,11,28},{9,11,29},{9,11,885},{10,11,387},{11,11,633},{11,11,740},{13,11,
+235},{13,11,254},{15,11,143},{143,11,146},{5,10,396},{134,10,501},{140,11,49},{
+132,0,225},{4,10,929},{5,10,799},{8,10,46},{136,10,740},{4,0,405},{7,0,817},{14,
+0,58},{17,0,37},{146,0,124},{133,0,974},{4,11,412},{133,11,581},{4,10,892},{133,
+10,770},{4,0,996},{134,0,2026},{4,0,527},{5,0,235},{7,0,1239},{11,0,131},{140,0,
+370},{9,0,16},{13,0,386},{135,11,421},{7,0,956},{7,0,1157},{7,0,1506},{7,0,1606}
+,{7,0,1615},{7,0,1619},{7,0,1736},{7,0,1775},{8,0,590},{9,0,324},{9,0,736},{9,0,
+774},{9,0,776},{9,0,784},{10,0,567},{10,0,708},{11,0,518},{11,0,613},{11,0,695},
+{11,0,716},{11,0,739},{11,0,770},{11,0,771},{11,0,848},{11,0,857},{11,0,931},{11
+,0,947},{12,0,326},{12,0,387},{12,0,484},{12,0,528},{12,0,552},{12,0,613},{13,0,
+189},{13,0,256},{13,0,340},{13,0,432},{13,0,436},{13,0,440},{13,0,454},{14,0,174
+},{14,0,220},{14,0,284},{14,0,390},{145,0,121},{135,10,158},{9,0,137},{138,0,221
+},{4,11,110},{10,11,415},{10,11,597},{142,11,206},{141,11,496},{135,11,205},{151
+,10,25},{135,11,778},{7,11,1656},{7,10,2001},{9,11,369},{10,11,338},{10,11,490},
+{11,11,154},{11,11,545},{11,11,775},{13,11,77},{141,11,274},{4,11,444},{10,11,
+146},{140,11,9},{7,0,390},{138,0,140},{135,0,1144},{134,0,464},{7,10,1461},{140,
+10,91},{132,10,602},{4,11,283},{135,11,1194},{5,0,407},{11,0,204},{11,0,243},{11
+,0,489},{12,0,293},{19,0,37},{20,0,73},{150,0,38},{7,0,1218},{136,0,303},{5,0,
+325},{8,0,5},{8,0,227},{9,0,105},{10,0,585},{12,0,614},{4,10,13},{5,10,567},{7,
+10,1498},{9,10,124},{11,10,521},{140,10,405},{135,10,1006},{7,0,800},{10,0,12},{
+134,11,1720},{135,0,1783},{132,10,735},{138,10,812},{4,10,170},{135,10,323},{6,0
+,621},{13,0,504},{144,0,89},{5,10,304},{135,10,1403},{137,11,216},{6,0,920},{6,0
+,1104},{9,11,183},{139,11,286},{4,0,376},{133,10,742},{134,0,218},{8,0,641},{11,
+0,388},{140,0,580},{7,0,454},{7,0,782},{8,0,768},{140,0,686},{137,11,33},{133,10
+,111},{144,0,0},{10,0,676},{140,0,462},{6,0,164},{136,11,735},{133,10,444},{150,
+0,50},{7,11,1862},{12,11,491},{12,11,520},{13,11,383},{14,11,244},{146,11,12},{5
+,11,132},{9,11,486},{9,11,715},{10,11,458},{11,11,373},{11,11,668},{11,11,795},{
+11,11,897},{12,11,272},{12,11,424},{12,11,539},{12,11,558},{14,11,245},{14,11,
+263},{14,11,264},{14,11,393},{142,11,403},{8,10,123},{15,10,6},{144,10,7},{6,0,
+285},{8,0,654},{11,0,749},{12,0,190},{12,0,327},{13,0,120},{13,0,121},{13,0,327}
+,{15,0,47},{146,0,40},{5,11,8},{6,11,89},{6,11,400},{7,11,1569},{7,11,1623},{7,
+11,1850},{8,11,218},{8,11,422},{9,11,570},{138,11,626},{6,11,387},{7,11,882},{
+141,11,111},{6,0,343},{7,0,195},{9,0,226},{10,0,197},{10,0,575},{11,0,502},{11,0
+,899},{6,11,224},{7,11,877},{137,11,647},{5,10,937},{135,10,100},{135,11,790},{
+150,0,29},{147,0,8},{134,0,1812},{149,0,8},{135,11,394},{7,0,1125},{9,0,143},{11
+,0,61},{14,0,405},{150,0,21},{10,11,755},{147,11,29},{9,11,378},{141,11,162},{
+135,10,922},{5,10,619},{133,10,698},{134,0,1327},{6,0,1598},{137,0,575},{9,11,
+569},{12,11,12},{12,11,81},{12,11,319},{13,11,69},{14,11,259},{16,11,87},{17,11,
+1},{17,11,21},{17,11,24},{18,11,15},{18,11,56},{18,11,59},{18,11,127},{18,11,154
+},{19,11,19},{148,11,31},{6,0,895},{135,11,1231},{5,0,959},{7,11,124},{136,11,38
+},{5,11,261},{7,11,78},{7,11,199},{8,11,815},{9,11,126},{138,11,342},{5,10,917},
+{134,10,1659},{7,0,1759},{5,11,595},{135,11,1863},{136,0,173},{134,0,266},{142,0
+,261},{132,11,628},{5,10,251},{5,10,956},{8,10,268},{9,10,214},{146,10,142},{7,
+11,266},{136,11,804},{135,11,208},{6,11,79},{7,11,1021},{135,11,1519},{11,11,704
+},{141,11,396},{5,10,346},{5,10,711},{136,10,390},{136,11,741},{134,11,376},{134
+,0,1427},{6,0,1033},{6,0,1217},{136,0,300},{133,10,624},{6,11,100},{7,11,244},{7
+,11,632},{7,11,1609},{8,11,178},{8,11,638},{141,11,58},{6,0,584},{5,10,783},{7,
+10,1998},{135,10,2047},{5,0,427},{5,0,734},{7,0,478},{136,0,52},{7,0,239},{11,0,
+217},{142,0,165},{134,0,1129},{6,0,168},{6,0,1734},{7,0,20},{7,0,1056},{8,0,732}
+,{9,0,406},{9,0,911},{138,0,694},{132,10,594},{133,11,791},{7,11,686},{8,11,33},
+{8,11,238},{10,11,616},{11,11,467},{11,11,881},{13,11,217},{13,11,253},{142,11,
+268},{137,11,476},{134,0,418},{133,0,613},{132,0,632},{132,11,447},{7,0,32},{7,0
+,984},{8,0,85},{8,0,709},{9,0,579},{9,0,847},{9,0,856},{10,0,799},{11,0,258},{11
+,0,1007},{12,0,331},{12,0,615},{13,0,188},{13,0,435},{14,0,8},{15,0,165},{16,0,
+27},{20,0,40},{144,11,35},{4,11,128},{5,11,415},{6,11,462},{7,11,294},{7,11,578}
+,{10,11,710},{139,11,86},{5,0,694},{136,0,909},{7,0,1109},{11,0,7},{5,10,37},{6,
+10,39},{6,10,451},{7,10,218},{7,10,1166},{7,10,1687},{8,10,662},{144,10,2},{136,
+11,587},{6,11,427},{7,11,1018},{138,11,692},{4,11,195},{6,10,508},{135,11,802},{
+4,0,167},{135,0,82},{5,0,62},{6,0,24},{6,0,534},{7,0,74},{7,0,678},{7,0,684},{7,
+0,1043},{7,0,1072},{8,0,280},{8,0,541},{8,0,686},{9,0,258},{10,0,519},{11,0,252}
+,{140,0,282},{138,0,33},{4,0,359},{133,11,738},{7,0,980},{9,0,328},{13,0,186},{
+13,0,364},{7,10,635},{7,10,796},{8,10,331},{9,10,330},{9,10,865},{10,10,119},{10
+,10,235},{11,10,111},{11,10,129},{11,10,240},{12,10,31},{12,10,66},{12,10,222},{
+12,10,269},{12,10,599},{12,10,684},{12,10,689},{12,10,691},{142,10,345},{137,10,
+527},{6,0,596},{7,0,585},{135,10,702},{134,11,1683},{133,0,211},{6,0,145},{141,0
+,336},{134,0,1130},{7,0,873},{6,10,37},{7,10,1666},{8,10,195},{8,10,316},{9,10,
+178},{9,10,276},{9,10,339},{9,10,536},{10,10,102},{10,10,362},{10,10,785},{11,10
+,55},{11,10,149},{11,10,773},{13,10,416},{13,10,419},{14,10,38},{14,10,41},{142,
+10,210},{8,0,840},{136,0,841},{132,0,263},{5,11,3},{8,11,578},{9,11,118},{10,11,
+705},{12,11,383},{141,11,279},{132,0,916},{133,11,229},{133,10,645},{15,0,155},{
+16,0,79},{8,11,102},{10,11,578},{10,11,672},{12,11,496},{13,11,408},{14,11,121},
+{145,11,106},{4,0,599},{5,0,592},{6,0,1634},{7,0,5},{7,0,55},{7,0,67},{7,0,97},{
+7,0,691},{7,0,979},{7,0,1600},{7,0,1697},{8,0,207},{8,0,214},{8,0,231},{8,0,294}
+,{8,0,336},{8,0,428},{8,0,471},{8,0,622},{8,0,626},{8,0,679},{8,0,759},{8,0,829}
+,{9,0,11},{9,0,246},{9,0,484},{9,0,573},{9,0,706},{9,0,762},{9,0,798},{9,0,855},
+{9,0,870},{9,0,912},{10,0,303},{10,0,335},{10,0,424},{10,0,461},{10,0,543},{10,0
+,759},{10,0,814},{11,0,59},{11,0,199},{11,0,235},{11,0,590},{11,0,631},{11,0,929
+},{11,0,963},{11,0,987},{12,0,114},{12,0,182},{12,0,226},{12,0,332},{12,0,439},{
+12,0,575},{12,0,598},{12,0,675},{13,0,8},{13,0,125},{13,0,194},{13,0,287},{14,0,
+197},{14,0,383},{15,0,53},{17,0,63},{19,0,46},{19,0,98},{19,0,106},{148,0,85},{7
+,0,1356},{132,10,290},{6,10,70},{7,10,1292},{10,10,762},{139,10,288},{150,11,55}
+,{4,0,593},{8,11,115},{8,11,350},{9,11,489},{10,11,128},{11,11,306},{12,11,373},
+{14,11,30},{17,11,79},{147,11,80},{135,11,1235},{134,0,1392},{4,11,230},{133,11,
+702},{147,0,126},{7,10,131},{7,10,422},{8,10,210},{140,10,573},{134,0,1179},{139
+,11,435},{139,10,797},{134,11,1728},{4,0,162},{18,11,26},{19,11,42},{20,11,43},{
+21,11,0},{23,11,27},{152,11,14},{132,10,936},{6,0,765},{5,10,453},{134,10,441},{
+133,0,187},{135,0,1286},{6,0,635},{6,0,904},{6,0,1210},{134,0,1489},{4,0,215},{8
+,0,890},{9,0,38},{10,0,923},{11,0,23},{11,0,127},{139,0,796},{6,0,1165},{134,0,
+1306},{7,0,716},{13,0,97},{141,0,251},{132,10,653},{136,0,657},{146,10,80},{5,11
+,622},{7,11,1032},{11,11,26},{11,11,213},{11,11,707},{12,11,380},{13,11,226},{
+141,11,355},{6,0,299},{5,11,70},{6,11,334},{9,11,171},{11,11,637},{12,11,202},{
+14,11,222},{145,11,42},{142,0,134},{4,11,23},{5,11,313},{5,11,1014},{6,11,50},{6
+,11,51},{7,11,142},{7,11,384},{9,11,783},{139,11,741},{4,11,141},{7,11,559},{8,
+11,640},{9,11,460},{12,11,183},{141,11,488},{136,11,614},{7,10,1368},{8,10,232},
+{8,10,361},{10,10,682},{138,10,742},{137,10,534},{6,0,1082},{140,0,658},{137,10,
+27},{135,0,2002},{142,10,12},{4,0,28},{5,0,440},{7,0,248},{11,0,833},{140,0,344}
+,{7,10,736},{139,10,264},{134,10,1657},{134,0,1654},{138,0,531},{5,11,222},{9,11
+,140},{138,11,534},{6,0,634},{6,0,798},{134,0,840},{138,11,503},{135,10,127},{
+133,0,853},{5,11,154},{7,11,1491},{10,11,379},{138,11,485},{6,0,249},{7,0,1234},
+{139,0,573},{133,11,716},{7,11,1570},{140,11,542},{136,10,364},{138,0,527},{4,11
+,91},{5,11,388},{5,11,845},{6,11,206},{6,11,252},{6,11,365},{7,11,136},{7,11,531
+},{8,11,264},{136,11,621},{134,0,1419},{135,11,1441},{7,0,49},{7,0,392},{8,0,20}
+,{8,0,172},{8,0,690},{9,0,383},{9,0,845},{10,0,48},{11,0,293},{11,0,832},{11,0,
+920},{11,0,984},{141,0,221},{5,0,858},{133,0,992},{5,0,728},{137,10,792},{5,10,
+909},{9,10,849},{138,10,805},{7,0,525},{7,0,1579},{8,0,497},{136,0,573},{6,0,268
+},{137,0,62},{135,11,576},{134,0,1201},{5,11,771},{5,11,863},{5,11,898},{6,11,
+1632},{6,11,1644},{134,11,1780},{133,11,331},{7,0,193},{7,0,1105},{10,0,495},{7,
+10,397},{8,10,124},{8,10,619},{9,10,305},{11,10,40},{12,10,349},{13,10,134},{13,
+10,295},{14,10,155},{15,10,120},{146,10,105},{138,0,106},{6,0,859},{5,11,107},{7
+,11,201},{136,11,518},{6,11,446},{135,11,1817},{13,0,23},{4,10,262},{135,10,342}
+,{133,10,641},{137,11,851},{6,0,925},{137,0,813},{132,11,504},{6,0,613},{136,0,
+223},{4,10,99},{6,10,250},{6,10,346},{8,10,127},{138,10,81},{136,0,953},{132,10,
+915},{139,11,892},{5,10,75},{9,10,517},{10,10,470},{12,10,155},{141,10,224},{4,0
+,666},{7,0,1017},{7,11,996},{138,11,390},{5,11,883},{133,11,975},{14,10,83},{142
+,11,83},{4,0,670},{5,11,922},{134,11,1707},{135,0,216},{9,0,40},{11,0,136},{135,
+11,787},{5,10,954},{5,11,993},{7,11,515},{137,11,91},{139,0,259},{7,0,1114},{9,0
+,310},{9,0,682},{10,0,440},{13,0,40},{6,10,304},{8,10,418},{11,10,341},{139,10,
+675},{14,0,296},{9,10,410},{139,10,425},{10,11,377},{12,11,363},{13,11,68},{13,
+11,94},{14,11,108},{142,11,306},{7,0,1401},{135,0,1476},{4,0,296},{6,0,475},{7,0
+,401},{7,0,1410},{7,0,1594},{7,0,1674},{8,0,63},{8,0,660},{137,0,74},{4,0,139},{
+4,0,388},{140,0,188},{132,0,797},{132,11,766},{5,11,103},{7,11,921},{8,11,580},{
+8,11,593},{8,11,630},{138,11,28},{4,11,911},{5,11,867},{133,11,1013},{134,10,14}
+,{134,0,1572},{134,10,1708},{21,0,39},{5,10,113},{6,10,243},{7,10,1865},{11,10,
+161},{16,10,37},{145,10,99},{7,11,1563},{141,11,182},{5,11,135},{6,11,519},{7,11
+,1722},{10,11,271},{11,11,261},{145,11,54},{132,10,274},{134,0,1594},{4,11,300},
+{5,11,436},{135,11,484},{4,0,747},{6,0,290},{7,0,649},{7,0,1479},{135,0,1583},{
+133,11,535},{147,11,82},{133,0,232},{137,0,887},{135,10,166},{136,0,521},{4,0,14
+},{7,0,472},{7,0,1801},{10,0,748},{141,0,458},{134,0,741},{134,0,992},{16,0,111}
+,{137,10,304},{4,0,425},{5,11,387},{7,11,557},{12,11,547},{142,11,86},{135,11,
+1747},{5,10,654},{135,11,1489},{7,0,789},{4,11,6},{5,11,708},{136,11,75},{6,10,
+273},{10,10,188},{13,10,377},{146,10,77},{6,0,1593},{4,11,303},{7,11,619},{10,11
+,547},{10,11,687},{11,11,122},{140,11,601},{134,0,1768},{135,10,410},{138,11,772
+},{11,0,233},{139,10,524},{5,0,943},{134,0,1779},{134,10,1785},{136,11,529},{132
+,0,955},{5,0,245},{6,0,576},{7,0,582},{136,0,225},{132,10,780},{142,0,241},{134,
+0,1943},{4,11,106},{7,11,310},{7,11,1785},{10,11,690},{139,11,717},{134,0,1284},
+{5,11,890},{133,11,988},{6,11,626},{142,11,431},{10,11,706},{145,11,32},{137,11,
+332},{132,11,698},{135,0,709},{5,10,948},{138,11,17},{136,0,554},{134,0,1564},{
+139,10,941},{132,0,443},{134,0,909},{134,11,84},{142,0,280},{4,10,532},{5,10,706
+},{135,10,662},{132,0,729},{5,10,837},{6,10,1651},{139,10,985},{135,10,1861},{4,
+0,348},{152,11,3},{5,11,986},{6,11,130},{7,11,1582},{8,11,458},{10,11,101},{10,
+11,318},{138,11,823},{134,0,758},{4,0,298},{137,0,848},{4,10,330},{7,10,933},{7,
+10,2012},{136,10,292},{7,11,1644},{137,11,129},{6,0,1422},{9,0,829},{135,10,767}
+,{5,0,164},{7,0,121},{142,0,189},{7,0,812},{7,0,1261},{7,0,1360},{9,0,632},{140,
+0,352},{135,11,1788},{139,0,556},{135,11,997},{145,10,114},{4,0,172},{9,0,611},{
+10,0,436},{12,0,673},{13,0,255},{137,10,883},{11,0,530},{138,10,274},{133,0,844}
+,{134,0,984},{13,0,232},{18,0,35},{4,10,703},{135,10,207},{132,10,571},{9,0,263}
+,{10,0,147},{138,0,492},{7,11,1756},{137,11,98},{5,10,873},{5,10,960},{8,10,823}
+,{137,10,881},{133,0,537},{132,0,859},{7,11,1046},{139,11,160},{137,0,842},{139,
+10,283},{5,10,33},{6,10,470},{139,10,424},{6,11,45},{7,11,433},{8,11,129},{9,11,
+21},{10,11,392},{11,11,79},{12,11,499},{13,11,199},{141,11,451},{135,0,1291},{
+135,10,1882},{7,11,558},{136,11,353},{134,0,1482},{5,0,230},{5,0,392},{6,0,420},
+{9,0,568},{140,0,612},{6,0,262},{7,10,90},{7,10,664},{7,10,830},{7,10,1380},{7,
+10,2025},{8,11,81},{8,10,448},{8,10,828},{9,11,189},{9,11,201},{11,11,478},{11,
+11,712},{141,11,338},{142,0,31},{5,11,353},{151,11,26},{132,0,753},{4,0,0},{5,0,
+41},{7,0,1459},{7,0,1469},{7,0,1859},{9,0,549},{139,0,905},{9,10,417},{137,10,
+493},{135,11,1113},{133,0,696},{141,11,448},{134,10,295},{132,0,834},{4,0,771},{
+5,10,1019},{6,11,25},{7,11,855},{7,11,1258},{144,11,32},{134,0,1076},{133,0,921}
+,{133,0,674},{4,11,4},{7,11,1118},{7,11,1320},{7,11,1706},{8,11,277},{9,11,622},
+{10,11,9},{11,11,724},{12,11,350},{12,11,397},{13,11,28},{13,11,159},{15,11,89},
+{18,11,5},{19,11,9},{20,11,34},{150,11,47},{134,10,208},{6,0,444},{136,0,308},{6
+,0,180},{7,0,1137},{8,0,751},{139,0,805},{4,0,183},{7,0,271},{11,0,824},{11,0,
+952},{13,0,278},{13,0,339},{13,0,482},{14,0,424},{148,0,99},{7,11,317},{135,11,
+569},{4,0,19},{5,0,477},{5,0,596},{6,0,505},{7,0,1221},{11,0,907},{12,0,209},{
+141,0,214},{135,0,1215},{6,0,271},{7,0,398},{8,0,387},{10,0,344},{7,10,448},{7,
+10,1629},{7,10,1813},{8,10,442},{9,10,710},{10,10,282},{138,10,722},{11,10,844},
+{12,10,104},{140,10,625},{134,11,255},{133,10,787},{134,0,1645},{11,11,956},{151
+,11,3},{6,0,92},{6,0,188},{7,0,209},{7,0,1269},{7,0,1524},{7,0,1876},{8,0,661},{
+10,0,42},{10,0,228},{11,0,58},{11,0,1020},{12,0,58},{12,0,118},{141,0,32},{4,0,
+459},{133,0,966},{4,11,536},{7,11,1141},{10,11,723},{139,11,371},{140,0,330},{
+134,0,1557},{7,11,285},{135,11,876},{136,10,491},{135,11,560},{6,0,18},{7,0,179}
+,{7,0,932},{8,0,548},{8,0,757},{9,0,54},{9,0,65},{9,0,532},{9,0,844},{10,0,113},
+{10,0,117},{10,0,315},{10,0,560},{10,0,622},{10,0,798},{11,0,153},{11,0,351},{11
+,0,375},{12,0,78},{12,0,151},{12,0,392},{12,0,666},{14,0,248},{143,0,23},{6,0,
+1742},{132,11,690},{4,10,403},{5,10,441},{7,10,450},{10,10,840},{11,10,101},{12,
+10,193},{141,10,430},{133,0,965},{134,0,182},{10,0,65},{10,0,488},{138,0,497},{
+135,11,1346},{6,0,973},{6,0,1158},{10,11,200},{19,11,2},{151,11,22},{4,11,190},{
+133,11,554},{133,10,679},{7,0,328},{137,10,326},{133,11,1001},{9,0,588},{138,0,
+260},{133,11,446},{135,10,1128},{135,10,1796},{147,11,119},{134,0,1786},{6,0,
+1328},{6,0,1985},{8,0,962},{138,0,1017},{135,0,308},{11,0,508},{4,10,574},{7,10,
+350},{7,10,1024},{8,10,338},{9,10,677},{138,10,808},{138,11,752},{135,10,1081},{
+137,11,96},{7,10,1676},{135,10,2037},{136,0,588},{132,11,304},{133,0,614},{140,0
+,793},{136,0,287},{137,10,297},{141,10,37},{6,11,53},{6,11,199},{7,11,1408},{8,
+11,32},{8,11,93},{9,11,437},{10,11,397},{10,11,629},{11,11,593},{11,11,763},{13,
+11,326},{145,11,35},{134,11,105},{9,11,320},{10,11,506},{138,11,794},{5,11,114},
+{5,11,255},{141,11,285},{140,0,290},{7,11,2035},{8,11,19},{9,11,89},{138,11,831}
+,{134,0,1136},{7,0,719},{8,0,796},{8,0,809},{8,0,834},{6,10,306},{7,10,1140},{7,
+10,1340},{8,10,133},{138,10,449},{139,10,1011},{5,0,210},{6,0,213},{7,0,60},{10,
+0,364},{139,0,135},{5,0,607},{8,0,326},{136,0,490},{138,11,176},{132,0,701},{5,0
+,472},{7,0,380},{137,0,758},{135,0,1947},{6,0,1079},{138,0,278},{138,11,391},{5,
+10,329},{8,10,260},{139,11,156},{4,0,386},{7,0,41},{8,0,405},{8,0,728},{9,0,497}
+,{11,0,110},{11,0,360},{15,0,37},{144,0,84},{5,0,46},{7,0,1452},{7,0,1480},{8,0,
+634},{140,0,472},{136,0,961},{4,0,524},{136,0,810},{10,0,238},{141,0,33},{132,10
+,657},{152,10,7},{133,0,532},{5,0,997},{135,10,1665},{7,11,594},{7,11,851},{7,11
+,1858},{9,11,411},{9,11,574},{9,11,666},{9,11,737},{10,11,346},{10,11,712},{11,
+11,246},{11,11,432},{11,11,517},{11,11,647},{11,11,679},{11,11,727},{12,11,304},
+{12,11,305},{12,11,323},{12,11,483},{12,11,572},{12,11,593},{12,11,602},{13,11,
+95},{13,11,101},{13,11,171},{13,11,315},{13,11,378},{13,11,425},{13,11,475},{14,
+11,63},{14,11,380},{14,11,384},{15,11,133},{18,11,112},{148,11,72},{5,11,955},{
+136,11,814},{134,0,1301},{5,10,66},{7,10,1896},{136,10,288},{133,11,56},{134,10,
+1643},{6,0,1298},{148,11,100},{5,0,782},{5,0,829},{6,0,671},{6,0,1156},{6,0,1738
+},{137,11,621},{4,0,306},{5,0,570},{7,0,1347},{5,10,91},{5,10,648},{5,10,750},{5
+,10,781},{6,10,54},{6,10,112},{6,10,402},{6,10,1732},{7,10,315},{7,10,749},{7,10
+,1900},{9,10,78},{9,10,508},{10,10,611},{10,10,811},{11,10,510},{11,10,728},{13,
+10,36},{14,10,39},{16,10,83},{17,10,124},{148,10,30},{8,10,570},{9,11,477},{141,
+11,78},{4,11,639},{10,11,4},{10,10,322},{10,10,719},{11,10,407},{11,11,638},{12,
+11,177},{148,11,57},{7,0,1823},{139,0,693},{7,0,759},{5,11,758},{8,10,125},{8,10
+,369},{8,10,524},{10,10,486},{11,10,13},{11,10,381},{11,10,736},{11,10,766},{11,
+10,845},{13,10,114},{13,10,292},{142,10,47},{7,0,1932},{6,10,1684},{6,10,1731},{
+7,10,356},{8,10,54},{8,10,221},{9,10,225},{9,10,356},{10,10,77},{10,10,446},{10,
+10,731},{12,10,404},{141,10,491},{135,11,552},{135,11,1112},{4,0,78},{5,0,96},{5
+,0,182},{6,0,1257},{7,0,1724},{7,0,1825},{10,0,394},{10,0,471},{11,0,532},{14,0,
+340},{145,0,88},{139,11,328},{135,0,1964},{132,10,411},{4,10,80},{5,10,44},{137,
+11,133},{5,11,110},{6,11,169},{6,11,1702},{7,11,400},{8,11,538},{9,11,184},{9,11
+,524},{140,11,218},{4,0,521},{5,10,299},{7,10,1083},{140,11,554},{6,11,133},{9,
+11,353},{12,11,628},{146,11,79},{6,0,215},{7,0,584},{7,0,1028},{7,0,1473},{7,0,
+1721},{9,0,424},{138,0,779},{7,0,857},{7,0,1209},{7,10,1713},{9,10,537},{10,10,
+165},{12,10,219},{140,10,561},{4,10,219},{6,11,93},{7,11,1422},{7,10,1761},{7,11
+,1851},{8,11,673},{9,10,86},{9,11,529},{140,11,43},{137,11,371},{136,0,671},{5,0
+,328},{135,0,918},{132,0,529},{9,11,25},{10,11,467},{138,11,559},{4,11,335},{135
+,11,942},{134,0,716},{134,0,1509},{6,0,67},{7,0,258},{7,0,1630},{9,0,354},{9,0,
+675},{10,0,830},{14,0,80},{17,0,80},{140,10,428},{134,0,1112},{6,0,141},{7,0,225
+},{9,0,59},{9,0,607},{10,0,312},{11,0,687},{12,0,555},{13,0,373},{13,0,494},{148
+,0,58},{133,10,514},{8,11,39},{10,11,773},{11,11,84},{12,11,205},{142,11,1},{8,0
+,783},{5,11,601},{133,11,870},{136,11,594},{4,10,55},{5,10,301},{6,10,571},{14,
+10,49},{146,10,102},{132,11,181},{134,11,1652},{133,10,364},{4,11,97},{5,11,147}
+,{6,11,286},{7,11,1362},{141,11,176},{4,10,76},{7,10,1550},{9,10,306},{9,10,430}
+,{9,10,663},{10,10,683},{11,10,427},{11,10,753},{12,10,334},{12,10,442},{14,10,
+258},{14,10,366},{143,10,131},{137,10,52},{6,0,955},{134,0,1498},{6,11,375},{7,
+11,169},{7,11,254},{136,11,780},{7,0,430},{11,0,46},{14,0,343},{142,11,343},{135
+,0,1183},{5,0,602},{7,0,2018},{9,0,418},{9,0,803},{135,11,1447},{8,0,677},{135,
+11,1044},{139,11,285},{4,10,656},{135,10,779},{135,10,144},{5,11,629},{135,11,
+1549},{135,10,1373},{138,11,209},{7,10,554},{7,10,605},{141,10,10},{5,10,838},{5
+,10,841},{134,10,1649},{133,10,1012},{6,0,1357},{134,0,1380},{144,0,53},{6,0,590
+},{7,10,365},{7,10,1357},{7,10,1497},{8,10,154},{141,10,281},{133,10,340},{132,
+11,420},{135,0,329},{147,11,32},{4,0,469},{10,11,429},{139,10,495},{8,10,261},{9
+,10,144},{9,10,466},{10,10,370},{12,10,470},{13,10,144},{142,10,348},{142,0,460}
+,{4,11,325},{9,10,897},{138,11,125},{6,0,1743},{6,10,248},{9,10,546},{10,10,535}
+,{11,10,681},{141,10,135},{4,0,990},{5,0,929},{6,0,340},{8,0,376},{8,0,807},{8,0
+,963},{8,0,980},{138,0,1007},{134,0,1603},{140,0,250},{4,11,714},{133,11,469},{
+134,10,567},{136,10,445},{5,0,218},{7,0,1610},{8,0,646},{10,0,83},{11,11,138},{
+140,11,40},{7,0,1512},{135,0,1794},{135,11,1216},{11,0,0},{16,0,78},{132,11,718}
+,{133,0,571},{132,0,455},{134,0,1012},{5,11,124},{5,11,144},{6,11,548},{7,11,15}
+,{7,11,153},{137,11,629},{142,11,10},{6,11,75},{7,11,1531},{8,11,416},{9,11,240}
+,{9,11,275},{10,11,100},{11,11,658},{11,11,979},{12,11,86},{13,11,468},{14,11,66
+},{14,11,207},{15,11,20},{15,11,25},{144,11,58},{132,10,577},{5,11,141},{5,11,
+915},{6,11,1783},{7,11,211},{7,11,698},{7,11,1353},{9,11,83},{9,11,281},{10,11,
+376},{10,11,431},{11,11,543},{12,11,664},{13,11,280},{13,11,428},{14,11,61},{14,
+11,128},{17,11,52},{145,11,81},{6,0,161},{7,0,372},{137,0,597},{132,0,349},{10,
+11,702},{139,11,245},{134,0,524},{134,10,174},{6,0,432},{9,0,751},{139,0,322},{
+147,11,94},{4,11,338},{133,11,400},{5,0,468},{10,0,325},{11,0,856},{12,0,345},{
+143,0,104},{133,0,223},{132,0,566},{4,11,221},{5,11,659},{5,11,989},{7,11,697},{
+7,11,1211},{138,11,284},{135,11,1070},{4,0,59},{135,0,1394},{6,0,436},{11,0,481}
+,{5,10,878},{133,10,972},{4,0,48},{5,0,271},{135,0,953},{5,0,610},{136,0,457},{4
+,0,773},{5,0,618},{137,0,756},{133,0,755},{135,0,1217},{138,11,507},{132,10,351}
+,{132,0,197},{143,11,78},{4,11,188},{7,11,805},{11,11,276},{142,11,293},{5,11,
+884},{139,11,991},{132,10,286},{10,0,259},{10,0,428},{7,10,438},{7,10,627},{7,10
+,1516},{8,10,40},{9,10,56},{9,10,294},{11,10,969},{11,10,995},{146,10,148},{4,0,
+356},{5,0,217},{5,0,492},{5,0,656},{8,0,544},{136,11,544},{5,0,259},{6,0,1230},{
+7,0,414},{7,0,854},{142,0,107},{132,0,1007},{15,0,14},{144,0,5},{6,0,1580},{132,
+10,738},{132,11,596},{132,0,673},{133,10,866},{6,0,1843},{135,11,1847},{4,0,165}
+,{7,0,1398},{135,0,1829},{135,11,1634},{147,11,65},{6,0,885},{6,0,1009},{137,0,
+809},{133,10,116},{132,10,457},{136,11,770},{9,0,498},{12,0,181},{10,11,361},{
+142,11,316},{134,11,595},{5,0,9},{7,0,297},{7,0,966},{140,0,306},{4,11,89},{5,11
+,489},{6,11,315},{7,11,553},{7,11,1745},{138,11,243},{134,0,1487},{132,0,437},{5
+,0,146},{6,0,411},{138,0,721},{5,10,527},{6,10,189},{135,10,859},{11,10,104},{11
+,10,554},{15,10,60},{143,10,125},{6,11,1658},{9,11,3},{10,11,154},{11,11,641},{
+13,11,85},{13,11,201},{141,11,346},{6,0,177},{135,0,467},{134,0,1377},{134,10,
+116},{136,11,645},{4,11,166},{5,11,505},{6,11,1670},{137,11,110},{133,10,487},{4
+,10,86},{5,10,667},{5,10,753},{6,10,316},{6,10,455},{135,10,946},{133,0,200},{
+132,0,959},{6,0,1928},{134,0,1957},{139,11,203},{150,10,45},{4,10,79},{7,10,1773
+},{10,10,450},{11,10,589},{13,10,332},{13,10,493},{14,10,183},{14,10,334},{14,10
+,362},{14,10,368},{14,10,376},{14,10,379},{19,10,90},{19,10,103},{19,10,127},{
+148,10,90},{6,0,1435},{135,11,1275},{134,0,481},{7,11,445},{8,11,307},{8,11,704}
+,{10,11,41},{10,11,439},{11,11,237},{11,11,622},{140,11,201},{135,11,869},{4,0,
+84},{7,0,1482},{10,0,76},{138,0,142},{11,11,277},{144,11,14},{135,11,1977},{4,11
+,189},{5,11,713},{136,11,57},{133,0,1015},{138,11,371},{4,0,315},{5,0,507},{135,
+0,1370},{4,11,552},{142,10,381},{9,0,759},{16,0,31},{16,0,39},{16,0,75},{18,0,24
+},{20,0,42},{152,0,1},{134,0,712},{134,0,1722},{133,10,663},{133,10,846},{8,0,
+222},{8,0,476},{9,0,238},{11,0,516},{11,0,575},{15,0,109},{146,0,100},{7,0,1402}
+,{7,0,1414},{12,0,456},{5,10,378},{8,10,465},{9,10,286},{10,10,185},{10,10,562},
+{10,10,635},{11,10,31},{11,10,393},{13,10,312},{18,10,65},{18,10,96},{147,10,89}
+,{4,0,986},{6,0,1958},{6,0,2032},{8,0,934},{138,0,985},{7,10,1880},{9,10,680},{
+139,10,798},{134,10,1770},{145,11,49},{132,11,614},{132,10,648},{5,10,945},{6,10
+,1656},{6,10,1787},{7,10,167},{8,10,824},{9,10,391},{10,10,375},{139,10,185},{
+138,11,661},{7,0,1273},{135,11,1945},{7,0,706},{7,0,1058},{138,0,538},{7,10,1645
+},{8,10,352},{137,10,249},{132,10,152},{11,0,92},{11,0,196},{11,0,409},{11,0,450
+},{11,0,666},{11,0,777},{12,0,262},{13,0,385},{13,0,393},{15,0,115},{16,0,45},{
+145,0,82},{133,10,1006},{6,0,40},{135,0,1781},{9,11,614},{139,11,327},{5,10,420}
+,{135,10,1449},{135,0,431},{10,0,97},{135,10,832},{6,0,423},{7,0,665},{135,0,
+1210},{7,0,237},{8,0,664},{9,0,42},{9,0,266},{9,0,380},{9,0,645},{10,0,177},{138
+,0,276},{7,0,264},{133,10,351},{8,0,213},{5,10,40},{7,10,598},{7,10,1638},{9,10,
+166},{9,10,640},{9,10,685},{9,10,773},{11,10,215},{13,10,65},{14,10,172},{14,10,
+317},{145,10,6},{5,11,84},{134,11,163},{8,10,60},{9,10,343},{139,10,769},{137,0,
+455},{133,11,410},{8,0,906},{12,0,700},{12,0,706},{140,0,729},{21,11,33},{150,11
+,40},{7,10,1951},{8,10,765},{8,10,772},{140,10,671},{7,10,108},{8,10,219},{8,10,
+388},{9,10,639},{9,10,775},{11,10,275},{140,10,464},{5,11,322},{7,11,1941},{8,11
+,186},{9,11,262},{10,11,187},{14,11,208},{146,11,130},{139,0,624},{8,0,574},{5,
+11,227},{140,11,29},{7,11,1546},{11,11,299},{142,11,407},{5,10,15},{6,10,56},{7,
+10,1758},{8,10,500},{9,10,730},{11,10,331},{13,10,150},{142,10,282},{7,11,1395},
+{8,11,486},{9,11,236},{9,11,878},{10,11,218},{11,11,95},{19,11,17},{147,11,31},{
+135,11,2043},{4,0,354},{146,11,4},{140,11,80},{135,0,1558},{134,10,1886},{5,10,
+205},{6,10,438},{137,10,711},{133,11,522},{133,10,534},{7,0,235},{7,0,1475},{15,
+0,68},{146,0,120},{137,10,691},{4,0,942},{6,0,1813},{8,0,917},{10,0,884},{12,0,
+696},{12,0,717},{12,0,723},{12,0,738},{12,0,749},{12,0,780},{16,0,97},{146,0,169
+},{6,10,443},{8,11,562},{9,10,237},{9,10,571},{9,10,695},{10,10,139},{11,10,715}
+,{12,10,417},{141,10,421},{135,0,957},{133,0,830},{134,11,1771},{146,0,23},{5,0,
+496},{6,0,694},{7,0,203},{7,11,1190},{137,11,620},{137,11,132},{6,0,547},{134,0,
+1549},{8,11,258},{9,11,208},{137,11,359},{4,0,864},{5,0,88},{137,0,239},{135,11,
+493},{4,11,317},{135,11,1279},{132,11,477},{4,10,578},{5,11,63},{133,11,509},{7,
+0,650},{135,0,1310},{7,0,1076},{9,0,80},{11,0,78},{11,0,421},{11,0,534},{140,0,
+545},{132,11,288},{12,0,553},{14,0,118},{133,10,923},{7,0,274},{11,0,479},{139,0
+,507},{8,11,89},{8,11,620},{9,11,49},{10,11,774},{11,11,628},{12,11,322},{143,11
+,124},{4,0,497},{135,0,1584},{7,0,261},{7,0,1115},{7,0,1354},{7,0,1404},{7,0,
+1588},{7,0,1705},{7,0,1902},{9,0,465},{10,0,248},{10,0,349},{10,0,647},{11,0,527
+},{11,0,660},{11,0,669},{12,0,529},{13,0,305},{132,10,924},{133,10,665},{136,0,
+13},{6,0,791},{138,11,120},{7,0,642},{8,0,250},{11,0,123},{11,0,137},{13,0,48},{
+142,0,95},{4,10,265},{7,10,807},{135,10,950},{5,10,93},{140,10,267},{135,0,1429}
+,{4,0,949},{10,0,885},{10,0,891},{10,0,900},{10,0,939},{12,0,760},{142,0,449},{
+139,11,366},{132,0,818},{134,11,85},{135,10,994},{7,0,330},{5,10,233},{5,10,320}
+,{6,10,140},{136,10,295},{4,0,1004},{8,0,982},{136,0,993},{133,10,978},{4,10,905
+},{6,10,1701},{137,10,843},{10,0,545},{140,0,301},{6,0,947},{134,0,1062},{134,0,
+1188},{4,0,904},{5,0,794},{152,10,6},{134,0,1372},{135,11,608},{5,11,279},{6,11,
+235},{7,11,468},{8,11,446},{9,11,637},{10,11,717},{11,11,738},{140,11,514},{132,
+10,509},{5,11,17},{6,11,371},{137,11,528},{132,0,693},{4,11,115},{5,11,669},{6,
+11,407},{8,11,311},{11,11,10},{141,11,5},{11,0,377},{7,10,273},{137,11,381},{135
+,0,695},{7,0,386},{138,0,713},{135,10,1041},{134,0,1291},{6,0,7},{6,0,35},{7,0,
+147},{7,0,1069},{7,0,1568},{7,0,1575},{7,0,1917},{8,0,43},{8,0,208},{9,0,128},{9
+,0,866},{10,0,20},{11,0,981},{147,0,33},{7,0,893},{141,0,424},{139,10,234},{150,
+11,56},{5,11,779},{5,11,807},{6,11,1655},{134,11,1676},{5,10,802},{7,10,2021},{
+136,10,805},{4,11,196},{5,10,167},{5,11,558},{5,10,899},{5,11,949},{6,10,410},{
+137,10,777},{137,10,789},{134,10,1705},{8,0,904},{140,0,787},{6,0,322},{9,0,552}
+,{11,0,274},{13,0,209},{13,0,499},{14,0,85},{15,0,126},{145,0,70},{135,10,10},{5
+,10,11},{6,10,117},{6,10,485},{7,10,1133},{9,10,582},{9,10,594},{11,10,21},{11,
+10,818},{12,10,535},{141,10,86},{4,10,264},{7,10,1067},{8,10,204},{8,10,385},{
+139,10,953},{132,11,752},{138,10,56},{133,10,470},{6,0,1808},{8,0,83},{8,0,742},
+{8,0,817},{9,0,28},{9,0,29},{9,0,885},{10,0,387},{11,0,633},{11,0,740},{13,0,235
+},{13,0,254},{15,0,143},{143,0,146},{140,0,49},{134,0,1832},{4,11,227},{5,11,159
+},{5,11,409},{7,11,80},{10,11,294},{10,11,479},{12,11,418},{14,11,50},{14,11,249
+},{142,11,295},{7,11,1470},{8,11,66},{8,11,137},{8,11,761},{9,11,638},{11,11,80}
+,{11,11,212},{11,11,368},{11,11,418},{12,11,8},{13,11,15},{16,11,61},{17,11,59},
+{19,11,28},{148,11,84},{139,10,1015},{138,11,468},{135,0,421},{6,0,415},{7,0,
+1049},{137,0,442},{6,11,38},{7,11,1220},{8,11,185},{8,11,256},{9,11,22},{9,11,
+331},{10,11,738},{11,11,205},{11,11,540},{11,11,746},{13,11,399},{13,11,465},{14
+,11,88},{142,11,194},{139,0,289},{133,10,715},{4,0,110},{10,0,415},{10,0,597},{
+142,0,206},{4,11,159},{6,11,115},{7,11,252},{7,11,257},{7,11,1928},{8,11,69},{9,
+11,384},{10,11,91},{10,11,615},{12,11,375},{14,11,235},{18,11,117},{147,11,123},
+{5,11,911},{136,11,278},{7,0,205},{7,0,2000},{8,10,794},{9,10,400},{10,10,298},{
+142,10,228},{135,11,1774},{4,11,151},{7,11,1567},{8,11,351},{137,11,322},{136,10
+,724},{133,11,990},{7,0,1539},{11,0,512},{13,0,205},{19,0,30},{22,0,36},{23,0,19
+},{135,11,1539},{5,11,194},{7,11,1662},{9,11,90},{140,11,180},{6,10,190},{7,10,
+768},{135,10,1170},{134,0,1340},{4,0,283},{135,0,1194},{133,11,425},{133,11,971}
+,{12,0,549},{14,10,67},{147,10,60},{135,10,1023},{134,0,1720},{138,11,587},{5,11
+,72},{6,11,264},{7,11,21},{7,11,46},{7,11,2013},{8,11,215},{8,11,513},{10,11,266
+},{139,11,22},{5,0,319},{135,0,534},{6,10,137},{9,10,75},{9,10,253},{10,10,194},
+{138,10,444},{7,0,1180},{20,0,112},{6,11,239},{7,11,118},{10,11,95},{11,11,603},
+{13,11,443},{14,11,160},{143,11,4},{134,11,431},{5,11,874},{6,11,1677},{11,10,
+643},{12,10,115},{143,11,0},{134,0,967},{6,11,65},{7,11,939},{7,11,1172},{7,11,
+1671},{9,11,540},{10,11,696},{11,11,265},{11,11,732},{11,11,928},{11,11,937},{12
+,11,399},{13,11,438},{149,11,19},{137,11,200},{135,0,1940},{5,10,760},{7,10,542}
+,{8,10,135},{136,10,496},{140,11,44},{7,11,1655},{136,11,305},{7,10,319},{7,10,
+355},{7,10,763},{10,10,389},{145,10,43},{136,0,735},{138,10,786},{137,11,19},{
+132,11,696},{5,0,132},{9,0,486},{9,0,715},{10,0,458},{11,0,373},{11,0,668},{11,0
+,795},{11,0,897},{12,0,272},{12,0,424},{12,0,539},{12,0,558},{14,0,245},{14,0,
+263},{14,0,264},{14,0,393},{142,0,403},{10,0,38},{139,0,784},{132,0,838},{4,11,
+302},{135,11,1766},{133,0,379},{5,0,8},{6,0,89},{6,0,400},{7,0,1569},{7,0,1623},
+{7,0,1850},{8,0,218},{8,0,422},{9,0,570},{10,0,626},{4,11,726},{133,11,630},{4,0
+,1017},{138,0,660},{6,0,387},{7,0,882},{141,0,111},{6,0,224},{7,0,877},{137,0,
+647},{4,10,58},{5,10,286},{6,10,319},{7,10,402},{7,10,1254},{7,10,1903},{8,10,
+356},{140,10,408},{135,0,790},{9,0,510},{10,0,53},{4,10,389},{9,10,181},{10,10,
+29},{10,10,816},{11,10,311},{11,10,561},{12,10,67},{141,10,181},{142,0,458},{6,
+11,118},{7,11,215},{7,11,1521},{140,11,11},{134,0,954},{135,0,394},{134,0,1367},
+{5,11,225},{133,10,373},{132,0,882},{7,0,1409},{135,10,1972},{135,10,1793},{4,11
+,370},{5,11,756},{135,11,1326},{150,11,13},{7,11,354},{10,11,410},{139,11,815},{
+6,11,1662},{7,11,48},{8,11,771},{10,11,116},{13,11,104},{14,11,105},{14,11,184},
+{15,11,168},{19,11,92},{148,11,68},{7,0,124},{136,0,38},{5,0,261},{7,0,78},{7,0,
+199},{8,0,815},{9,0,126},{10,0,342},{140,0,647},{4,0,628},{140,0,724},{7,0,266},
+{8,0,804},{7,10,1651},{145,10,89},{135,0,208},{134,0,1178},{6,0,79},{135,0,1519}
+,{132,10,672},{133,10,737},{136,0,741},{132,11,120},{4,0,710},{6,0,376},{134,0,
+606},{134,0,1347},{134,0,1494},{6,0,850},{6,0,1553},{137,0,821},{5,10,145},{134,
+11,593},{7,0,1311},{140,0,135},{4,0,467},{5,0,405},{134,0,544},{5,11,820},{135,
+11,931},{6,0,100},{7,0,244},{7,0,632},{7,0,1609},{8,0,178},{8,0,638},{141,0,58},
+{4,10,387},{135,10,1288},{6,11,151},{6,11,1675},{7,11,383},{151,11,10},{132,0,
+481},{135,10,550},{134,0,1378},{6,11,1624},{11,11,11},{12,11,422},{13,11,262},{
+142,11,360},{133,0,791},{4,11,43},{5,11,344},{133,11,357},{7,0,1227},{140,0,978}
+,{7,0,686},{8,0,33},{8,0,238},{10,0,616},{11,0,467},{11,0,881},{13,0,217},{13,0,
+253},{142,0,268},{137,0,857},{8,0,467},{8,0,1006},{7,11,148},{8,11,284},{141,11,
+63},{4,10,576},{135,10,1263},{133,11,888},{5,10,919},{134,10,1673},{20,10,37},{
+148,11,37},{132,0,447},{132,11,711},{4,0,128},{5,0,415},{6,0,462},{7,0,294},{7,0
+,578},{10,0,710},{139,0,86},{4,10,82},{5,10,333},{5,10,904},{6,10,207},{7,10,325
+},{7,10,1726},{8,10,101},{10,10,778},{139,10,220},{136,0,587},{137,11,440},{133,
+10,903},{6,0,427},{7,0,1018},{138,0,692},{4,0,195},{135,0,802},{140,10,147},{134
+,0,1546},{134,0,684},{132,10,705},{136,0,345},{11,11,678},{140,11,307},{133,0,
+365},{134,0,1683},{4,11,65},{5,11,479},{5,11,1004},{7,11,1913},{8,11,317},{9,11,
+302},{10,11,612},{141,11,22},{138,0,472},{4,11,261},{135,11,510},{134,10,90},{
+142,0,433},{151,0,28},{4,11,291},{7,11,101},{9,11,515},{12,11,152},{12,11,443},{
+13,11,392},{142,11,357},{140,0,997},{5,0,3},{8,0,578},{9,0,118},{10,0,705},{141,
+0,279},{135,11,1266},{7,10,813},{12,10,497},{141,10,56},{133,0,229},{6,10,125},{
+135,10,1277},{8,0,102},{10,0,578},{10,0,672},{12,0,496},{13,0,408},{14,0,121},{
+17,0,106},{151,10,12},{6,0,866},{134,0,1080},{136,0,1022},{4,11,130},{135,11,843
+},{5,11,42},{5,11,879},{7,11,245},{7,11,324},{7,11,1532},{11,11,463},{11,11,472}
+,{13,11,363},{144,11,52},{150,0,55},{8,0,115},{8,0,350},{9,0,489},{10,0,128},{11
+,0,306},{12,0,373},{14,0,30},{17,0,79},{19,0,80},{4,11,134},{133,11,372},{134,0,
+657},{134,0,933},{135,11,1147},{4,0,230},{133,0,702},{134,0,1728},{4,0,484},{18,
+0,26},{19,0,42},{20,0,43},{21,0,0},{23,0,27},{152,0,14},{7,0,185},{135,0,703},{6
+,0,417},{10,0,618},{7,10,1106},{9,10,770},{11,10,112},{140,10,413},{134,0,803},{
+132,11,644},{134,0,1262},{7,11,540},{12,10,271},{145,10,109},{135,11,123},{132,0
+,633},{134,11,623},{4,11,908},{5,11,359},{5,11,508},{6,11,1723},{7,11,343},{7,11
+,1996},{135,11,2026},{135,0,479},{10,0,262},{7,10,304},{9,10,646},{9,10,862},{11
+,10,696},{12,10,208},{15,10,79},{147,10,108},{4,11,341},{135,11,480},{134,0,830}
+,{5,0,70},{5,0,622},{6,0,334},{7,0,1032},{9,0,171},{11,0,26},{11,0,213},{11,0,
+637},{11,0,707},{12,0,202},{12,0,380},{13,0,226},{13,0,355},{14,0,222},{145,0,42
+},{135,10,981},{143,0,217},{137,11,114},{4,0,23},{4,0,141},{5,0,313},{5,0,1014},
+{6,0,50},{6,0,51},{7,0,142},{7,0,384},{7,0,559},{8,0,640},{9,0,460},{9,0,783},{
+11,0,741},{12,0,183},{141,0,488},{141,0,360},{7,0,1586},{7,11,1995},{8,11,299},{
+11,11,890},{140,11,674},{132,10,434},{7,0,652},{134,10,550},{7,0,766},{5,10,553}
+,{138,10,824},{7,0,737},{8,0,298},{136,10,452},{4,11,238},{5,11,503},{6,11,179},
+{7,11,2003},{8,11,381},{8,11,473},{9,11,149},{10,11,183},{15,11,45},{143,11,86},
+{133,10,292},{5,0,222},{9,0,655},{138,0,534},{138,10,135},{4,11,121},{5,11,156},
+{5,11,349},{9,11,136},{10,11,605},{14,11,342},{147,11,107},{137,0,906},{6,0,1013
+},{134,0,1250},{6,0,1956},{6,0,2009},{8,0,991},{144,0,120},{135,11,1192},{138,0,
+503},{5,0,154},{7,0,1491},{10,0,379},{138,0,485},{6,0,1867},{6,0,1914},{6,0,1925
+},{9,0,917},{9,0,925},{9,0,932},{9,0,951},{9,0,1007},{9,0,1013},{12,0,806},{12,0
+,810},{12,0,814},{12,0,816},{12,0,824},{12,0,832},{12,0,837},{12,0,863},{12,0,
+868},{12,0,870},{12,0,889},{12,0,892},{12,0,900},{12,0,902},{12,0,908},{12,0,933
+},{12,0,942},{12,0,949},{12,0,954},{15,0,175},{15,0,203},{15,0,213},{15,0,218},{
+15,0,225},{15,0,231},{15,0,239},{15,0,248},{15,0,252},{18,0,190},{18,0,204},{18,
+0,215},{18,0,216},{18,0,222},{18,0,225},{18,0,230},{18,0,239},{18,0,241},{21,0,
+42},{21,0,43},{21,0,44},{21,0,45},{21,0,46},{21,0,53},{24,0,27},{152,0,31},{133,
+0,716},{135,0,844},{4,0,91},{5,0,388},{5,0,845},{6,0,206},{6,0,252},{6,0,365},{7
+,0,136},{7,0,531},{136,0,621},{7,10,393},{10,10,603},{139,10,206},{6,11,80},{6,
+11,1694},{7,11,173},{7,11,1974},{9,11,547},{10,11,730},{14,11,18},{150,11,39},{
+137,0,748},{4,11,923},{134,11,1711},{4,10,912},{137,10,232},{7,10,98},{7,10,1973
+},{136,10,716},{14,0,103},{133,10,733},{132,11,595},{12,0,158},{18,0,8},{19,0,62
+},{20,0,6},{22,0,4},{23,0,2},{23,0,9},{5,11,240},{6,11,459},{7,11,12},{7,11,114}
+,{7,11,502},{7,11,1751},{7,11,1753},{7,11,1805},{8,11,658},{9,11,1},{11,11,959},
+{13,11,446},{142,11,211},{135,0,576},{5,0,771},{5,0,863},{5,0,898},{6,0,648},{6,
+0,1632},{6,0,1644},{134,0,1780},{133,0,331},{7,11,633},{7,11,905},{7,11,909},{7,
+11,1538},{9,11,767},{140,11,636},{140,0,632},{5,0,107},{7,0,201},{136,0,518},{6,
+0,446},{7,0,1817},{134,11,490},{9,0,851},{141,0,510},{7,11,250},{8,11,506},{136,
+11,507},{4,0,504},{137,10,72},{132,11,158},{4,11,140},{7,11,362},{8,11,209},{9,
+11,10},{9,11,160},{9,11,503},{10,11,689},{11,11,350},{11,11,553},{11,11,725},{12
+,11,252},{12,11,583},{13,11,192},{13,11,352},{14,11,269},{14,11,356},{148,11,50}
+,{6,11,597},{135,11,1318},{135,10,1454},{5,0,883},{5,0,975},{8,0,392},{148,0,7},
+{6,11,228},{7,11,1341},{9,11,408},{138,11,343},{11,11,348},{11,10,600},{12,11,99
+},{13,10,245},{18,11,1},{18,11,11},{147,11,4},{134,11,296},{5,0,922},{134,0,1707
+},{132,11,557},{4,11,548},{7,10,164},{7,10,1571},{9,10,107},{140,10,225},{7,11,
+197},{8,11,142},{8,11,325},{9,11,150},{9,11,596},{10,11,350},{10,11,353},{11,11,
+74},{11,11,315},{14,11,423},{143,11,141},{5,0,993},{7,0,515},{137,0,91},{4,0,131
+},{8,0,200},{5,10,484},{5,10,510},{6,10,434},{7,10,1000},{7,10,1098},{136,10,2},
+{152,0,10},{4,11,62},{5,11,83},{6,11,399},{6,11,579},{7,11,692},{7,11,846},{7,11
+,1015},{7,11,1799},{8,11,403},{9,11,394},{10,11,133},{12,11,4},{12,11,297},{12,
+11,452},{16,11,81},{18,11,19},{18,11,25},{21,11,14},{22,11,12},{151,11,18},{140,
+11,459},{132,11,177},{7,0,1433},{9,0,365},{137,11,365},{132,10,460},{5,0,103},{6
+,0,2004},{7,0,921},{8,0,580},{8,0,593},{8,0,630},{10,0,28},{5,11,411},{135,11,
+653},{4,10,932},{133,10,891},{4,0,911},{5,0,867},{5,0,1013},{7,0,2034},{8,0,798}
+,{136,0,813},{7,11,439},{10,11,727},{11,11,260},{139,11,684},{136,10,625},{5,11,
+208},{7,11,753},{135,11,1528},{5,0,461},{7,0,1925},{12,0,39},{13,0,265},{13,0,
+439},{134,10,76},{6,0,853},{8,10,92},{137,10,221},{5,0,135},{6,0,519},{7,0,1722}
+,{10,0,271},{11,0,261},{145,0,54},{139,11,814},{14,0,338},{148,0,81},{4,0,300},{
+133,0,436},{5,0,419},{5,0,687},{7,0,864},{9,0,470},{135,11,864},{9,0,836},{133,
+11,242},{134,0,1937},{4,10,763},{133,11,953},{132,10,622},{132,0,393},{133,10,
+253},{8,0,357},{10,0,745},{14,0,426},{17,0,94},{19,0,57},{135,10,546},{5,11,615}
+,{146,11,37},{9,10,73},{10,10,110},{14,10,185},{145,10,119},{11,0,703},{7,10,624
+},{7,10,916},{10,10,256},{139,10,87},{133,11,290},{5,10,212},{12,10,35},{141,10,
+382},{132,11,380},{5,11,52},{7,11,277},{9,11,368},{139,11,791},{133,0,387},{10,
+11,138},{139,11,476},{4,0,6},{5,0,708},{136,0,75},{7,0,1351},{9,0,581},{10,0,639
+},{11,0,453},{140,0,584},{132,0,303},{138,0,772},{135,10,1175},{4,0,749},{5,10,
+816},{6,11,256},{7,11,307},{7,11,999},{7,11,1481},{7,11,1732},{7,11,1738},{8,11,
+265},{9,11,414},{11,11,316},{12,11,52},{13,11,420},{147,11,100},{135,11,1296},{6
+,0,1065},{5,10,869},{5,10,968},{6,10,1626},{8,10,734},{136,10,784},{4,10,542},{6
+,10,1716},{6,10,1727},{7,10,1082},{7,10,1545},{8,10,56},{8,10,118},{8,10,412},{8
+,10,564},{9,10,888},{9,10,908},{10,10,50},{10,10,423},{11,10,685},{11,10,697},{
+11,10,933},{12,10,299},{13,10,126},{13,10,136},{13,10,170},{141,10,190},{134,0,
+226},{4,0,106},{7,0,310},{11,0,717},{133,11,723},{5,0,890},{5,0,988},{4,10,232},
+{9,10,202},{10,10,474},{140,10,433},{6,0,626},{142,0,431},{10,0,706},{150,0,44},
+{13,0,51},{6,10,108},{7,10,1003},{7,10,1181},{8,10,111},{136,10,343},{132,0,698}
+,{5,11,109},{6,11,1784},{7,11,1895},{12,11,296},{140,11,302},{134,0,828},{134,10
+,1712},{138,0,17},{7,0,1929},{4,10,133},{5,11,216},{7,10,711},{7,10,1298},{7,10,
+1585},{7,11,1879},{9,11,141},{9,11,270},{9,11,679},{10,11,159},{10,11,553},{11,
+11,197},{11,11,438},{12,11,538},{12,11,559},{13,11,193},{13,11,423},{14,11,144},
+{14,11,166},{14,11,167},{15,11,67},{147,11,84},{141,11,127},{7,11,1872},{137,11,
+81},{6,10,99},{7,10,1808},{145,10,57},{134,11,391},{5,0,689},{6,0,84},{7,0,1250}
+,{6,10,574},{7,10,428},{10,10,669},{11,10,485},{11,10,840},{12,10,300},{142,10,
+250},{7,11,322},{136,11,249},{7,11,432},{135,11,1649},{135,10,1871},{137,10,252}
+,{6,11,155},{140,11,234},{7,0,871},{19,0,27},{147,11,27},{140,0,498},{5,0,986},{
+6,0,130},{138,0,823},{6,0,1793},{7,0,1582},{8,0,458},{10,0,101},{10,0,318},{10,0
+,945},{12,0,734},{16,0,104},{18,0,177},{6,10,323},{135,10,1564},{5,11,632},{138,
+11,526},{10,0,435},{7,10,461},{136,10,775},{6,11,144},{7,11,948},{7,11,1042},{7,
+11,1857},{8,11,235},{8,11,461},{9,11,453},{9,11,530},{10,11,354},{17,11,77},{19,
+11,99},{148,11,79},{138,0,966},{7,0,1644},{137,0,129},{135,0,997},{136,0,502},{5
+,11,196},{6,11,486},{7,11,212},{8,11,309},{136,11,346},{7,10,727},{146,10,73},{
+132,0,823},{132,11,686},{135,0,1927},{4,0,762},{7,0,1756},{137,0,98},{136,10,577
+},{24,0,8},{4,11,30},{5,11,43},{152,11,8},{7,0,1046},{139,0,160},{7,0,492},{4,10
+,413},{5,10,677},{7,11,492},{8,10,432},{140,10,280},{6,0,45},{7,0,433},{8,0,129}
+,{9,0,21},{10,0,392},{11,0,79},{12,0,499},{13,0,199},{141,0,451},{7,0,558},{136,
+0,353},{4,11,220},{7,11,1535},{9,11,93},{139,11,474},{7,10,646},{7,10,1730},{11,
+10,446},{141,10,178},{133,0,785},{134,0,1145},{8,0,81},{9,0,189},{9,0,201},{11,0
+,478},{11,0,712},{141,0,338},{5,0,353},{151,0,26},{11,0,762},{132,10,395},{134,0
+,2024},{4,0,611},{133,0,606},{9,10,174},{10,10,164},{11,10,440},{11,10,841},{143
+,10,98},{134,10,426},{10,10,608},{139,10,1002},{138,10,250},{6,0,25},{7,0,855},{
+7,0,1258},{144,0,32},{7,11,1725},{138,11,393},{5,11,263},{134,11,414},{6,0,2011}
+,{133,10,476},{4,0,4},{7,0,1118},{7,0,1320},{7,0,1706},{8,0,277},{9,0,622},{10,0
+,9},{11,0,724},{12,0,350},{12,0,397},{13,0,28},{13,0,159},{15,0,89},{18,0,5},{19
+,0,9},{20,0,34},{22,0,47},{6,11,178},{6,11,1750},{8,11,251},{9,11,690},{10,11,
+155},{10,11,196},{10,11,373},{11,11,698},{13,11,155},{148,11,93},{5,11,97},{137,
+11,393},{7,0,764},{11,0,461},{12,0,172},{5,10,76},{6,10,458},{6,10,497},{7,10,
+868},{9,10,658},{10,10,594},{11,10,566},{12,10,338},{141,10,200},{134,0,1449},{
+138,11,40},{134,11,1639},{134,0,1445},{6,0,1168},{4,10,526},{7,10,1029},{135,10,
+1054},{4,11,191},{7,11,934},{8,11,647},{145,11,97},{132,10,636},{6,0,233},{7,10,
+660},{7,10,1124},{17,10,31},{19,10,22},{151,10,14},{6,10,1699},{136,11,110},{12,
+11,246},{15,11,162},{19,11,64},{20,11,8},{20,11,95},{22,11,24},{152,11,17},{5,11
+,165},{9,11,346},{138,11,655},{5,11,319},{135,11,534},{134,0,255},{9,0,216},{8,
+11,128},{139,11,179},{9,0,183},{139,0,286},{11,0,956},{151,0,3},{4,0,536},{7,0,
+1141},{10,0,723},{139,0,371},{4,10,279},{7,10,301},{137,10,362},{7,0,285},{5,11,
+57},{6,11,101},{6,11,1663},{7,11,132},{7,11,1048},{7,11,1154},{7,11,1415},{7,11,
+1507},{12,11,493},{15,11,105},{151,11,15},{5,11,459},{7,11,1073},{7,10,1743},{8,
+11,241},{136,11,334},{4,10,178},{133,10,399},{135,0,560},{132,0,690},{135,0,1246
+},{18,0,157},{147,0,63},{10,0,599},{11,0,33},{12,0,571},{149,0,1},{6,11,324},{6,
+11,520},{7,11,338},{7,11,1616},{7,11,1729},{8,11,228},{9,11,69},{139,11,750},{7,
+0,1862},{12,0,491},{12,0,520},{13,0,383},{142,0,244},{135,11,734},{134,10,1692},
+{10,0,448},{11,0,630},{17,0,117},{6,10,202},{7,11,705},{12,10,360},{17,10,118},{
+18,10,27},{148,10,67},{4,11,73},{6,11,612},{7,11,927},{7,11,1822},{8,11,217},{9,
+11,472},{9,11,765},{9,11,766},{10,11,408},{11,11,51},{11,11,793},{12,11,266},{15
+,11,158},{20,11,89},{150,11,32},{4,0,190},{133,0,554},{133,0,1001},{5,11,389},{8
+,11,636},{137,11,229},{5,0,446},{7,10,872},{10,10,516},{139,10,167},{137,10,313}
+,{132,10,224},{134,0,1313},{5,10,546},{7,10,35},{8,10,11},{8,10,12},{9,10,315},{
+9,10,533},{10,10,802},{11,10,166},{12,10,525},{142,10,243},{6,0,636},{137,0,837}
+,{5,10,241},{8,10,242},{9,10,451},{10,10,667},{11,10,598},{140,10,429},{22,10,46
+},{150,11,46},{136,11,472},{11,0,278},{142,0,73},{141,11,185},{132,0,868},{134,0
+,972},{4,10,366},{137,10,516},{138,0,1010},{5,11,189},{6,10,1736},{7,11,442},{7,
+11,443},{8,11,281},{12,11,174},{13,11,83},{141,11,261},{139,11,384},{6,11,2},{7,
+11,191},{7,11,446},{7,11,758},{7,11,1262},{7,11,1737},{8,11,22},{8,11,270},{8,11
+,612},{9,11,4},{9,11,167},{9,11,312},{9,11,436},{10,11,156},{10,11,216},{10,11,
+311},{10,11,623},{11,11,72},{11,11,330},{11,11,455},{12,11,101},{12,11,321},{12,
+11,504},{12,11,530},{12,11,543},{13,11,17},{13,11,156},{13,11,334},{14,11,48},{
+15,11,70},{17,11,60},{148,11,64},{6,10,331},{136,10,623},{135,0,1231},{132,0,304
+},{6,11,60},{7,11,670},{7,11,1327},{8,11,411},{8,11,435},{9,11,653},{9,11,740},{
+10,11,385},{11,11,222},{11,11,324},{11,11,829},{140,11,611},{7,0,506},{6,11,166}
+,{7,11,374},{135,11,1174},{14,11,43},{146,11,21},{135,11,1694},{135,10,1888},{5,
+11,206},{134,11,398},{135,11,50},{150,0,26},{6,0,53},{6,0,199},{7,0,1408},{8,0,
+32},{8,0,93},{10,0,397},{10,0,629},{11,0,593},{11,0,763},{13,0,326},{145,0,35},{
+134,0,105},{132,10,394},{4,0,843},{138,0,794},{11,0,704},{141,0,396},{5,0,114},{
+5,0,255},{141,0,285},{6,0,619},{7,0,898},{7,0,1092},{8,0,485},{18,0,28},{19,0,
+116},{135,10,1931},{9,0,145},{7,10,574},{135,10,1719},{7,0,2035},{8,0,19},{9,0,
+89},{138,0,831},{132,10,658},{6,11,517},{7,11,1159},{10,11,621},{139,11,192},{7,
+0,1933},{7,11,1933},{9,10,781},{10,10,144},{11,10,385},{13,10,161},{13,10,228},{
+13,10,268},{148,10,107},{136,10,374},{10,11,223},{139,11,645},{135,0,1728},{7,11
+,64},{7,11,289},{136,11,245},{4,10,344},{6,10,498},{139,10,323},{136,0,746},{135
+,10,1063},{137,10,155},{4,0,987},{6,0,1964},{6,0,1974},{6,0,1990},{136,0,995},{
+133,11,609},{133,10,906},{134,0,1550},{134,0,874},{5,11,129},{6,11,61},{135,11,
+947},{4,0,1018},{6,0,1938},{6,0,2021},{134,0,2039},{132,0,814},{11,0,126},{139,0
+,287},{134,0,1264},{5,0,955},{136,0,814},{141,11,506},{132,11,314},{6,0,981},{
+139,11,1000},{5,0,56},{8,0,892},{8,0,915},{140,0,776},{148,0,100},{10,0,4},{10,0
+,13},{11,0,638},{148,0,57},{148,11,74},{5,0,738},{132,10,616},{133,11,637},{136,
+10,692},{133,0,758},{132,10,305},{137,11,590},{5,11,280},{135,11,1226},{134,11,
+494},{135,0,1112},{133,11,281},{13,0,44},{14,0,214},{5,10,214},{7,10,603},{8,10,
+611},{9,10,686},{10,10,88},{11,10,459},{11,10,496},{12,10,463},{140,10,590},{139
+,0,328},{135,11,1064},{137,0,133},{7,0,168},{13,0,196},{141,0,237},{134,10,1703}
+,{134,0,1152},{135,0,1245},{5,0,110},{6,0,169},{6,0,1702},{7,0,400},{8,0,538},{9
+,0,184},{9,0,524},{140,0,218},{6,0,1816},{10,0,871},{12,0,769},{140,0,785},{132,
+11,630},{7,11,33},{7,11,120},{8,11,489},{9,11,319},{10,11,820},{11,11,1004},{12,
+11,379},{13,11,117},{13,11,412},{14,11,25},{15,11,52},{15,11,161},{16,11,47},{
+149,11,2},{6,0,133},{8,0,413},{9,0,353},{139,0,993},{145,10,19},{4,11,937},{133,
+11,801},{134,0,978},{6,0,93},{6,0,1508},{7,0,1422},{7,0,1851},{8,0,673},{9,0,529
+},{140,0,43},{6,0,317},{10,0,512},{4,10,737},{11,10,294},{12,10,60},{12,10,437},
+{13,10,64},{13,10,380},{142,10,430},{9,0,371},{7,11,1591},{144,11,43},{6,10,1758
+},{8,10,520},{9,10,345},{9,10,403},{142,10,350},{5,0,526},{10,10,242},{138,10,
+579},{9,0,25},{10,0,467},{138,0,559},{5,10,139},{7,10,1168},{138,10,539},{4,0,
+335},{135,0,942},{140,0,754},{132,11,365},{11,0,182},{142,0,195},{142,11,29},{5,
+11,7},{139,11,774},{4,11,746},{135,11,1090},{8,0,39},{10,0,773},{11,0,84},{12,0,
+205},{142,0,1},{5,0,601},{5,0,870},{5,11,360},{136,11,237},{132,0,181},{136,0,
+370},{134,0,1652},{8,0,358},{4,10,107},{7,10,613},{8,10,439},{8,10,504},{9,10,
+501},{10,10,383},{139,10,477},{132,10,229},{137,11,785},{4,0,97},{5,0,147},{6,0,
+286},{7,0,1362},{141,0,176},{6,0,537},{7,0,788},{7,0,1816},{132,10,903},{140,10,
+71},{6,0,743},{134,0,1223},{6,0,375},{7,0,169},{7,0,254},{8,0,780},{135,11,1493}
+,{7,0,1714},{4,10,47},{6,10,373},{7,10,452},{7,10,543},{7,10,1856},{9,10,6},{11,
+10,257},{139,10,391},{6,0,896},{136,0,1003},{135,0,1447},{137,11,341},{5,10,980}
+,{134,10,1754},{145,11,22},{4,11,277},{5,11,608},{6,11,493},{7,11,457},{140,11,
+384},{7,10,536},{7,10,1331},{136,10,143},{140,0,744},{7,11,27},{135,11,316},{18,
+0,126},{5,10,19},{134,10,533},{4,0,788},{11,0,41},{5,11,552},{5,11,586},{5,11,
+676},{6,11,448},{8,11,244},{11,11,1},{11,11,41},{13,11,3},{16,11,54},{17,11,4},{
+146,11,13},{4,0,985},{6,0,1801},{4,11,401},{137,11,264},{5,10,395},{5,10,951},{
+134,10,1776},{5,0,629},{135,0,1549},{11,10,663},{12,10,210},{13,10,166},{13,10,
+310},{14,10,373},{147,10,43},{9,11,543},{10,11,524},{11,11,30},{12,11,524},{14,
+11,315},{16,11,18},{20,11,26},{148,11,65},{4,11,205},{5,11,623},{7,11,104},{136,
+11,519},{5,0,293},{134,0,601},{7,11,579},{9,11,41},{9,11,244},{9,11,669},{10,11,
+5},{11,11,861},{11,11,951},{139,11,980},{132,11,717},{132,10,695},{7,10,497},{9,
+10,387},{147,10,81},{132,0,420},{142,0,37},{6,0,1134},{6,0,1900},{12,0,830},{12,
+0,878},{12,0,894},{15,0,221},{143,0,245},{132,11,489},{7,0,1570},{140,0,542},{8,
+0,933},{136,0,957},{6,0,1371},{7,0,31},{8,0,373},{5,10,284},{6,10,49},{6,10,350}
+,{7,10,377},{7,10,1693},{8,10,678},{9,10,161},{9,10,585},{9,10,671},{9,10,839},{
+11,10,912},{141,10,427},{135,11,892},{4,0,325},{138,0,125},{139,11,47},{132,10,
+597},{138,0,323},{6,0,1547},{7,11,1605},{9,11,473},{11,11,962},{146,11,139},{139
+,10,908},{7,11,819},{9,11,26},{9,11,392},{10,11,152},{10,11,226},{11,11,19},{12,
+11,276},{12,11,426},{12,11,589},{13,11,460},{15,11,97},{19,11,48},{148,11,104},{
+135,11,51},{4,0,718},{135,0,1216},{6,0,1896},{6,0,1905},{6,0,1912},{9,0,947},{9,
+0,974},{12,0,809},{12,0,850},{12,0,858},{12,0,874},{12,0,887},{12,0,904},{12,0,
+929},{12,0,948},{12,0,952},{15,0,198},{15,0,206},{15,0,220},{15,0,227},{15,0,247
+},{18,0,188},{21,0,48},{21,0,50},{24,0,25},{24,0,29},{7,11,761},{7,11,1051},{137
+,11,545},{5,0,124},{5,0,144},{6,0,548},{7,0,15},{7,0,153},{137,0,629},{135,11,
+606},{135,10,2014},{7,10,2007},{9,11,46},{9,10,101},{9,10,450},{10,10,66},{10,10
+,842},{11,10,536},{140,10,587},{6,0,75},{7,0,1531},{8,0,416},{9,0,240},{9,0,275}
+,{10,0,100},{11,0,658},{11,0,979},{12,0,86},{14,0,207},{15,0,20},{143,0,25},{5,0
+,141},{5,0,915},{6,0,1783},{7,0,211},{7,0,698},{7,0,1353},{9,0,83},{9,0,281},{10
+,0,376},{10,0,431},{11,0,543},{12,0,664},{13,0,280},{13,0,428},{14,0,61},{14,0,
+128},{17,0,52},{145,0,81},{132,11,674},{135,0,533},{149,0,6},{132,11,770},{133,0
+,538},{5,11,79},{7,11,1027},{7,11,1477},{139,11,52},{139,10,62},{4,0,338},{133,0
+,400},{5,11,789},{134,11,195},{4,11,251},{4,11,688},{7,11,513},{7,11,1284},{9,11
+,87},{138,11,365},{134,10,1766},{6,0,0},{7,0,84},{11,0,895},{145,0,11},{139,0,
+892},{4,0,221},{5,0,659},{7,0,697},{7,0,1211},{138,0,284},{133,0,989},{133,11,
+889},{4,11,160},{5,11,330},{7,11,1434},{136,11,174},{6,10,1665},{7,10,256},{7,10
+,1388},{10,10,499},{139,10,670},{7,0,848},{4,10,22},{5,10,10},{136,10,97},{138,0
+,507},{133,10,481},{4,0,188},{135,0,805},{5,0,884},{6,0,732},{139,0,991},{135,11
+,968},{11,11,636},{15,11,145},{17,11,34},{19,11,50},{151,11,20},{7,0,959},{16,0,
+60},{6,10,134},{7,10,437},{9,10,37},{14,10,285},{142,10,371},{7,10,486},{8,10,
+155},{11,10,93},{140,10,164},{134,0,1653},{7,0,337},{133,10,591},{6,0,1989},{8,0
+,922},{8,0,978},{133,11,374},{132,0,638},{138,0,500},{133,11,731},{5,10,380},{5,
+10,650},{136,10,310},{138,11,381},{4,10,364},{7,10,1156},{7,10,1187},{137,10,409
+},{137,11,224},{140,0,166},{134,10,482},{4,11,626},{5,11,642},{6,11,425},{10,11,
+202},{139,11,141},{4,10,781},{6,10,487},{7,10,926},{8,10,263},{139,10,500},{135,
+0,418},{4,10,94},{135,10,1265},{136,0,760},{132,10,417},{136,11,835},{5,10,348},
+{134,10,522},{6,0,1277},{134,0,1538},{139,11,541},{135,11,1597},{5,11,384},{8,11
+,455},{140,11,48},{136,0,770},{5,11,264},{134,11,184},{4,0,89},{5,0,489},{6,0,
+315},{7,0,553},{7,0,1745},{138,0,243},{4,10,408},{4,10,741},{135,10,500},{134,0,
+1396},{133,0,560},{6,0,1658},{9,0,3},{10,0,154},{11,0,641},{13,0,85},{13,0,201},
+{141,0,346},{135,11,1595},{5,11,633},{6,11,28},{7,11,219},{135,11,1323},{9,11,
+769},{140,11,185},{135,11,785},{7,11,359},{8,11,243},{140,11,175},{138,0,586},{7
+,0,1271},{134,10,73},{132,11,105},{4,0,166},{5,0,505},{134,0,1670},{133,10,576},
+{4,11,324},{138,11,104},{142,10,231},{6,0,637},{7,10,1264},{7,10,1678},{11,10,
+945},{12,10,341},{12,10,471},{12,10,569},{23,11,21},{151,11,23},{8,11,559},{141,
+11,109},{134,0,1947},{7,0,445},{8,0,307},{8,0,704},{10,0,41},{10,0,439},{11,0,
+237},{11,0,622},{140,0,201},{135,11,963},{135,0,1977},{4,0,189},{5,0,713},{136,0
+,57},{138,0,371},{135,10,538},{132,0,552},{6,0,883},{133,10,413},{6,0,923},{132,
+11,758},{138,11,215},{136,10,495},{7,10,54},{8,10,312},{10,10,191},{10,10,614},{
+140,10,567},{7,11,351},{139,11,128},{7,0,875},{6,10,468},{7,10,1478},{8,10,530},
+{142,10,290},{135,0,1788},{17,0,49},{133,11,918},{12,11,398},{20,11,39},{21,11,
+11},{150,11,41},{10,0,661},{6,10,484},{135,10,822},{135,0,1945},{134,0,794},{137
+,10,900},{135,10,1335},{6,10,1724},{135,10,2022},{132,11,340},{134,0,1135},{4,0,
+784},{133,0,745},{5,0,84},{134,0,163},{133,0,410},{4,0,976},{5,11,985},{7,11,509
+},{7,11,529},{145,11,96},{132,10,474},{134,0,703},{135,11,1919},{5,0,322},{8,0,
+186},{9,0,262},{10,0,187},{142,0,208},{135,10,1504},{133,0,227},{9,0,560},{13,0,
+208},{133,10,305},{132,11,247},{7,0,1395},{8,0,486},{9,0,236},{9,0,878},{10,0,
+218},{11,0,95},{19,0,17},{147,0,31},{7,0,2043},{8,0,672},{141,0,448},{4,11,184},
+{5,11,390},{6,11,337},{7,11,23},{7,11,494},{7,11,618},{7,11,1456},{8,11,27},{8,
+11,599},{10,11,153},{139,11,710},{135,0,466},{135,10,1236},{6,0,167},{7,0,186},{
+7,0,656},{10,0,643},{4,10,480},{6,10,302},{6,10,1642},{7,10,837},{7,10,1547},{7,
+10,1657},{8,10,429},{9,10,228},{13,10,289},{13,10,343},{147,10,101},{134,0,1428}
+,{134,0,1440},{5,0,412},{7,10,278},{10,10,739},{11,10,708},{141,10,348},{134,0,
+1118},{136,0,562},{148,11,46},{9,0,316},{139,0,256},{134,0,1771},{135,0,1190},{
+137,0,132},{10,11,227},{11,11,497},{11,11,709},{140,11,415},{143,0,66},{6,11,360
+},{7,11,1664},{136,11,478},{144,10,28},{4,0,317},{135,0,1279},{5,0,63},{133,0,
+509},{136,11,699},{145,10,36},{134,0,1475},{11,11,343},{142,11,127},{132,11,739}
+,{132,0,288},{135,11,1757},{8,0,89},{8,0,620},{9,0,608},{11,0,628},{12,0,322},{
+143,0,124},{134,0,1225},{7,0,1189},{4,11,67},{5,11,422},{6,10,363},{7,11,1037},{
+7,11,1289},{7,11,1555},{7,10,1955},{8,10,725},{9,11,741},{145,11,108},{134,0,
+1468},{6,0,689},{134,0,1451},{138,0,120},{151,0,1},{137,10,805},{142,0,329},{5,
+10,813},{135,10,2046},{135,0,226},{138,11,96},{7,0,1855},{5,10,712},{11,10,17},{
+13,10,321},{144,10,67},{9,0,461},{6,10,320},{7,10,781},{7,10,1921},{9,10,55},{10
+,10,186},{10,10,273},{10,10,664},{10,10,801},{11,10,996},{11,10,997},{13,10,157}
+,{142,10,170},{8,11,203},{8,10,271},{11,11,823},{11,11,846},{12,11,482},{13,11,
+133},{13,11,277},{13,11,302},{13,11,464},{14,11,205},{142,11,221},{135,0,1346},{
+4,11,449},{133,11,718},{134,0,85},{14,0,299},{7,10,103},{7,10,863},{11,10,184},{
+145,10,62},{4,11,355},{6,11,311},{9,11,256},{138,11,404},{137,10,659},{138,11,
+758},{133,11,827},{5,11,64},{140,11,581},{134,0,1171},{4,11,442},{7,11,1047},{7,
+11,1352},{135,11,1643},{132,0,980},{5,11,977},{6,11,288},{7,11,528},{135,11,1065
+},{5,0,279},{6,0,235},{7,0,468},{8,0,446},{9,0,637},{10,0,717},{11,0,738},{140,0
+,514},{132,0,293},{11,10,337},{142,10,303},{136,11,285},{5,0,17},{6,0,371},{9,0,
+528},{12,0,364},{132,11,254},{5,10,77},{7,10,1455},{10,10,843},{147,10,73},{150,
+0,5},{132,10,458},{6,11,12},{7,11,1219},{145,11,73},{135,10,1420},{6,10,109},{
+138,10,382},{135,11,125},{6,10,330},{7,10,1084},{139,10,142},{6,11,369},{6,11,
+502},{7,11,1036},{8,11,348},{9,11,452},{10,11,26},{11,11,224},{11,11,387},{11,11
+,772},{12,11,95},{12,11,629},{13,11,195},{13,11,207},{13,11,241},{14,11,260},{14
+,11,270},{143,11,140},{132,11,269},{5,11,480},{7,11,532},{7,11,1197},{7,11,1358}
+,{8,11,291},{11,11,349},{142,11,396},{150,0,48},{10,0,601},{13,0,353},{141,0,376
+},{5,0,779},{5,0,807},{6,0,1655},{134,0,1676},{142,11,223},{4,0,196},{5,0,558},{
+133,0,949},{148,11,15},{135,11,1764},{134,0,1322},{132,0,752},{139,0,737},{135,
+11,657},{136,11,533},{135,0,412},{4,0,227},{5,0,159},{5,0,409},{7,0,80},{8,0,556
+},{10,0,479},{12,0,418},{14,0,50},{14,0,123},{14,0,192},{14,0,249},{14,0,295},{
+143,0,27},{7,0,1470},{8,0,66},{8,0,137},{8,0,761},{9,0,638},{11,0,80},{11,0,212}
+,{11,0,368},{11,0,418},{12,0,8},{13,0,15},{16,0,61},{17,0,59},{19,0,28},{148,0,
+84},{135,10,1985},{4,11,211},{4,11,332},{5,11,335},{6,11,238},{7,11,269},{7,11,
+811},{7,11,1797},{8,10,122},{8,11,836},{9,11,507},{141,11,242},{6,0,683},{134,0,
+1252},{4,0,873},{132,10,234},{134,0,835},{6,0,38},{7,0,1220},{8,0,185},{8,0,256}
+,{9,0,22},{9,0,331},{10,0,738},{11,0,205},{11,0,540},{11,0,746},{13,0,465},{14,0
+,88},{142,0,194},{138,0,986},{5,11,1009},{12,11,582},{146,11,131},{4,0,159},{6,0
+,115},{7,0,252},{7,0,257},{7,0,1928},{8,0,69},{9,0,384},{10,0,91},{10,0,615},{12
+,0,375},{14,0,235},{18,0,117},{147,0,123},{133,0,911},{136,0,278},{5,10,430},{5,
+10,932},{6,10,131},{7,10,417},{9,10,522},{11,10,314},{141,10,390},{14,10,149},{
+14,10,399},{143,10,57},{4,0,151},{7,0,1567},{136,0,749},{5,11,228},{6,11,203},{7
+,11,156},{8,11,347},{137,11,265},{132,10,507},{10,0,989},{140,0,956},{133,0,990}
+,{5,0,194},{6,0,927},{7,0,1662},{9,0,90},{140,0,564},{4,10,343},{133,10,511},{
+133,0,425},{7,10,455},{138,10,591},{4,0,774},{7,11,476},{7,11,1592},{138,11,87},
+{5,0,971},{135,10,1381},{5,11,318},{147,11,121},{5,11,291},{7,11,765},{9,11,389}
+,{140,11,548},{134,10,575},{4,0,827},{12,0,646},{12,0,705},{12,0,712},{140,0,714
+},{139,0,752},{137,0,662},{5,0,72},{6,0,264},{7,0,21},{7,0,46},{7,0,2013},{8,0,
+215},{8,0,513},{10,0,266},{139,0,22},{139,11,522},{6,0,239},{7,0,118},{10,0,95},
+{11,0,603},{13,0,443},{14,0,160},{143,0,4},{6,0,431},{134,0,669},{7,10,1127},{7,
+10,1572},{10,10,297},{10,10,422},{11,10,764},{11,10,810},{12,10,264},{13,10,102}
+,{13,10,300},{13,10,484},{14,10,147},{14,10,229},{17,10,71},{18,10,118},{147,10,
+120},{5,0,874},{6,0,1677},{15,0,0},{10,11,525},{139,11,82},{6,0,65},{7,0,939},{7
+,0,1172},{7,0,1671},{9,0,540},{10,0,696},{11,0,265},{11,0,732},{11,0,928},{11,0,
+937},{141,0,438},{134,0,1350},{136,11,547},{132,11,422},{5,11,355},{145,11,0},{
+137,11,905},{5,0,682},{135,0,1887},{132,0,809},{4,0,696},{133,11,865},{6,0,1074}
+,{6,0,1472},{14,10,35},{142,10,191},{5,11,914},{134,11,1625},{133,11,234},{135,
+11,1383},{137,11,780},{132,10,125},{4,0,726},{133,0,630},{8,0,802},{136,0,838},{
+132,10,721},{6,0,1337},{7,0,776},{19,0,56},{136,10,145},{132,0,970},{7,10,792},{
+8,10,147},{10,10,821},{139,10,1021},{139,10,970},{8,0,940},{137,0,797},{135,11,
+1312},{9,0,248},{10,0,400},{7,11,816},{7,11,1241},{7,10,1999},{9,11,283},{9,11,
+520},{10,11,213},{10,11,307},{10,11,463},{10,11,671},{10,11,746},{11,11,401},{11
+,11,794},{12,11,517},{18,11,107},{147,11,115},{6,0,1951},{134,0,2040},{135,11,
+339},{13,0,41},{15,0,93},{5,10,168},{5,10,930},{8,10,74},{9,10,623},{12,10,500},
+{140,10,579},{6,0,118},{7,0,215},{7,0,1521},{140,0,11},{6,10,220},{7,10,1101},{
+141,10,105},{6,11,421},{7,11,61},{7,11,1540},{10,11,11},{138,11,501},{7,0,615},{
+138,0,251},{140,11,631},{135,0,1044},{6,10,19},{7,10,1413},{139,10,428},{133,0,
+225},{7,10,96},{8,10,401},{8,10,703},{137,10,896},{145,10,116},{6,11,102},{7,11,
+72},{15,11,142},{147,11,67},{7,10,1961},{7,10,1965},{8,10,702},{136,10,750},{7,
+10,2030},{8,10,150},{8,10,737},{12,10,366},{151,11,30},{4,0,370},{5,0,756},{7,0,
+1326},{135,11,823},{8,10,800},{9,10,148},{9,10,872},{9,10,890},{11,10,309},{11,
+10,1001},{13,10,267},{141,10,323},{6,0,1662},{7,0,48},{8,0,771},{10,0,116},{13,0
+,104},{14,0,105},{14,0,184},{15,0,168},{19,0,92},{148,0,68},{10,0,209},{135,11,
+1870},{7,11,68},{8,11,48},{8,11,88},{8,11,582},{8,11,681},{9,11,373},{9,11,864},
+{11,11,157},{11,11,336},{11,11,843},{148,11,27},{134,0,930},{4,11,88},{5,11,137}
+,{5,11,174},{5,11,777},{6,11,1664},{6,11,1725},{7,11,77},{7,11,426},{7,11,1317},
+{7,11,1355},{8,11,126},{8,11,563},{9,11,523},{9,11,750},{10,11,310},{10,11,836},
+{11,11,42},{11,11,318},{11,11,731},{12,11,68},{12,11,92},{12,11,507},{12,11,692}
+,{13,11,81},{13,11,238},{13,11,374},{18,11,138},{19,11,78},{19,11,111},{20,11,55
+},{20,11,77},{148,11,92},{4,11,938},{135,11,1831},{5,10,547},{7,10,424},{8,11,
+617},{138,11,351},{6,0,1286},{6,11,1668},{7,11,1499},{8,11,117},{9,11,314},{138,
+11,174},{6,0,759},{6,0,894},{7,11,707},{139,11,563},{4,0,120},{135,0,1894},{9,0,
+385},{149,0,17},{138,0,429},{133,11,403},{5,0,820},{135,0,931},{10,0,199},{133,
+10,133},{6,0,151},{6,0,1675},{7,0,383},{151,0,10},{6,0,761},{136,10,187},{8,0,
+365},{10,10,0},{10,10,818},{139,10,988},{4,11,44},{5,11,311},{6,11,156},{7,11,
+639},{7,11,762},{7,11,1827},{9,11,8},{9,11,462},{148,11,83},{4,11,346},{7,11,115
+},{9,11,180},{9,11,456},{138,11,363},{136,10,685},{7,0,1086},{145,0,46},{6,0,
+1624},{11,0,11},{12,0,422},{13,0,444},{142,0,360},{6,0,1020},{6,0,1260},{134,0,
+1589},{4,0,43},{5,0,344},{5,0,357},{14,0,472},{150,0,58},{6,0,1864},{6,0,1866},{
+6,0,1868},{6,0,1869},{6,0,1874},{6,0,1877},{6,0,1903},{6,0,1911},{9,0,920},{9,0,
+921},{9,0,924},{9,0,946},{9,0,959},{9,0,963},{9,0,970},{9,0,997},{9,0,1008},{9,0
+,1017},{12,0,795},{12,0,797},{12,0,798},{12,0,800},{12,0,803},{12,0,811},{12,0,
+820},{12,0,821},{12,0,839},{12,0,841},{12,0,848},{12,0,911},{12,0,921},{12,0,922
+},{12,0,925},{12,0,937},{12,0,944},{12,0,945},{12,0,953},{15,0,184},{15,0,191},{
+15,0,199},{15,0,237},{15,0,240},{15,0,243},{15,0,246},{18,0,203},{21,0,40},{21,0
+,52},{21,0,57},{24,0,23},{24,0,28},{152,0,30},{134,0,725},{145,11,58},{133,0,888
+},{137,10,874},{4,0,711},{8,10,774},{10,10,670},{140,10,51},{144,11,40},{6,11,
+185},{7,11,1899},{139,11,673},{137,10,701},{137,0,440},{4,11,327},{5,11,478},{7,
+11,1332},{8,11,753},{140,11,227},{4,10,127},{5,10,350},{6,10,356},{8,10,426},{9,
+10,572},{10,10,247},{139,10,312},{5,11,1020},{133,11,1022},{4,11,103},{133,11,
+401},{6,0,1913},{6,0,1926},{6,0,1959},{9,0,914},{9,0,939},{9,0,952},{9,0,979},{9
+,0,990},{9,0,998},{9,0,1003},{9,0,1023},{12,0,827},{12,0,834},{12,0,845},{12,0,
+912},{12,0,935},{12,0,951},{15,0,172},{15,0,174},{18,0,198},{149,0,63},{5,0,958}
+,{5,0,987},{4,11,499},{135,11,1421},{7,0,885},{6,10,59},{6,10,1762},{9,10,603},{
+141,10,397},{10,11,62},{141,11,164},{4,0,847},{135,0,326},{11,0,276},{142,0,293}
+,{4,0,65},{5,0,479},{5,0,1004},{7,0,1913},{8,0,317},{9,0,302},{10,0,612},{13,0,
+22},{132,11,96},{4,0,261},{135,0,510},{135,0,1514},{6,10,111},{7,10,4},{8,10,163
+},{8,10,776},{138,10,566},{4,0,291},{9,0,515},{12,0,152},{12,0,443},{13,0,392},{
+142,0,357},{7,11,399},{135,11,1492},{4,0,589},{139,0,282},{6,11,563},{135,10,
+1994},{5,10,297},{135,10,1038},{4,0,130},{7,0,843},{135,0,1562},{5,0,42},{5,0,
+879},{7,0,245},{7,0,324},{7,0,1532},{11,0,463},{11,0,472},{13,0,363},{144,0,52},
+{4,0,134},{133,0,372},{133,0,680},{136,10,363},{6,0,1997},{8,0,935},{136,0,977},
+{4,0,810},{135,0,1634},{135,10,1675},{7,0,1390},{4,11,910},{133,11,832},{7,10,
+808},{8,11,266},{139,11,578},{132,0,644},{4,0,982},{138,0,867},{132,10,280},{135
+,0,540},{140,10,54},{135,0,123},{134,0,1978},{4,10,421},{133,10,548},{6,0,623},{
+136,0,789},{4,0,908},{5,0,359},{5,0,508},{6,0,1723},{7,0,343},{7,0,1996},{135,0,
+2026},{134,0,1220},{4,0,341},{135,0,480},{6,10,254},{9,10,109},{138,10,103},{134
+,0,888},{8,11,528},{137,11,348},{7,0,1995},{8,0,299},{11,0,890},{12,0,674},{4,11
+,20},{133,11,616},{135,11,1094},{134,10,1630},{4,0,238},{5,0,503},{6,0,179},{7,0
+,2003},{8,0,381},{8,0,473},{9,0,149},{10,0,788},{15,0,45},{15,0,86},{20,0,110},{
+150,0,57},{133,10,671},{4,11,26},{5,11,429},{6,11,245},{7,11,704},{7,11,1379},{
+135,11,1474},{4,0,121},{5,0,156},{5,0,349},{9,0,431},{10,0,605},{142,0,342},{7,
+11,943},{139,11,614},{132,10,889},{132,11,621},{7,10,1382},{7,11,1382},{135,10,
+1910},{132,10,627},{133,10,775},{133,11,542},{133,11,868},{136,11,433},{6,0,1373
+},{7,0,1011},{11,10,362},{11,10,948},{140,10,388},{6,0,80},{7,0,173},{9,0,547},{
+10,0,730},{14,0,18},{22,0,39},{135,11,1495},{6,0,1694},{135,0,1974},{140,0,196},
+{4,0,923},{6,0,507},{6,0,1711},{7,10,451},{8,10,389},{12,10,490},{13,10,16},{13,
+10,215},{13,10,351},{18,10,132},{147,10,125},{6,0,646},{134,0,1047},{135,10,841}
+,{136,10,566},{6,0,1611},{135,0,1214},{139,0,926},{132,11,525},{132,0,595},{5,0,
+240},{6,0,459},{7,0,12},{7,0,114},{7,0,949},{7,0,1753},{7,0,1805},{8,0,658},{9,0
+,1},{11,0,959},{141,0,446},{5,10,912},{134,10,1695},{132,0,446},{7,11,62},{12,11
+,45},{147,11,112},{5,10,236},{6,10,572},{8,10,492},{11,10,618},{144,10,56},{5,10
+,190},{136,10,318},{135,10,1376},{4,11,223},{6,11,359},{11,11,3},{13,11,108},{14
+,11,89},{144,11,22},{132,11,647},{134,0,490},{134,0,491},{134,0,1584},{135,11,
+685},{138,11,220},{7,0,250},{136,0,507},{132,0,158},{4,0,140},{7,0,362},{8,0,209
+},{9,0,10},{9,0,160},{9,0,503},{9,0,614},{10,0,689},{11,0,327},{11,0,553},{11,0,
+725},{11,0,767},{12,0,252},{12,0,583},{13,0,192},{14,0,269},{14,0,356},{148,0,50
+},{19,0,1},{19,0,26},{150,0,9},{132,11,109},{6,0,228},{7,0,1341},{9,0,408},{138,
+0,343},{4,0,373},{5,0,283},{6,0,480},{7,0,609},{10,0,860},{138,0,878},{6,0,779},
+{134,0,1209},{4,0,557},{7,11,263},{7,11,628},{136,11,349},{132,0,548},{7,0,197},
+{8,0,142},{8,0,325},{9,0,150},{9,0,596},{10,0,350},{10,0,353},{11,0,74},{11,0,
+315},{12,0,662},{12,0,681},{14,0,423},{143,0,141},{4,11,40},{10,11,67},{11,11,
+117},{11,11,768},{139,11,935},{7,11,992},{8,11,301},{9,11,722},{12,11,63},{13,11
+,29},{14,11,161},{143,11,18},{6,0,1490},{138,11,532},{5,0,580},{7,0,378},{7,0,
+674},{7,0,1424},{15,0,83},{16,0,11},{15,11,83},{144,11,11},{6,0,1057},{6,0,1335}
+,{10,0,316},{7,10,85},{7,10,247},{8,10,585},{138,10,163},{4,0,169},{5,0,83},{6,0
+,399},{6,0,579},{6,0,1513},{7,0,692},{7,0,846},{7,0,1015},{7,0,1799},{8,0,403},{
+9,0,394},{10,0,133},{12,0,4},{12,0,297},{12,0,452},{16,0,81},{18,0,25},{21,0,14}
+,{22,0,12},{151,0,18},{134,0,1106},{7,0,1546},{11,0,299},{142,0,407},{134,0,1192
+},{132,0,177},{5,0,411},{135,0,653},{7,0,439},{10,0,727},{11,0,260},{139,0,684},
+{138,10,145},{147,10,83},{5,0,208},{7,0,753},{135,0,1528},{137,11,617},{135,10,
+1922},{135,11,825},{11,0,422},{13,0,389},{4,10,124},{10,10,457},{11,10,121},{11,
+10,169},{11,10,870},{12,10,214},{14,10,187},{143,10,77},{11,0,615},{15,0,58},{11
+,11,615},{143,11,58},{9,0,618},{138,0,482},{6,0,1952},{6,0,1970},{142,0,505},{7,
+10,1193},{135,11,1838},{133,0,242},{135,10,1333},{6,10,107},{7,10,638},{7,10,
+1632},{137,10,396},{133,0,953},{5,10,370},{134,10,1756},{5,11,28},{6,11,204},{10
+,11,320},{10,11,583},{13,11,502},{14,11,72},{14,11,274},{14,11,312},{14,11,344},
+{15,11,159},{16,11,62},{16,11,69},{17,11,30},{18,11,42},{18,11,53},{18,11,84},{
+18,11,140},{19,11,68},{19,11,85},{20,11,5},{20,11,45},{20,11,101},{22,11,7},{150
+,11,20},{4,11,558},{6,11,390},{7,11,162},{7,11,689},{9,11,360},{138,11,653},{11,
+0,802},{141,0,67},{133,10,204},{133,0,290},{5,10,970},{134,10,1706},{132,0,380},
+{5,0,52},{7,0,277},{9,0,368},{139,0,791},{5,11,856},{6,11,1672},{6,11,1757},{6,
+11,1781},{7,11,1150},{7,11,1425},{7,11,1453},{140,11,513},{5,11,92},{7,10,3},{10
+,11,736},{140,11,102},{4,0,112},{5,0,653},{5,10,483},{5,10,685},{6,10,489},{7,10
+,1204},{136,10,394},{132,10,921},{6,0,1028},{133,10,1007},{5,11,590},{9,11,213},
+{145,11,91},{135,10,1696},{10,0,138},{139,0,476},{5,0,725},{5,0,727},{135,0,1811
+},{4,0,979},{6,0,1821},{6,0,1838},{8,0,876},{8,0,883},{8,0,889},{8,0,893},{8,0,
+895},{10,0,934},{12,0,720},{14,0,459},{148,0,123},{135,11,551},{4,0,38},{6,0,435
+},{7,0,307},{7,0,999},{7,0,1481},{7,0,1732},{7,0,1738},{8,0,371},{9,0,414},{11,0
+,316},{12,0,52},{13,0,420},{147,0,100},{135,0,1296},{132,10,712},{134,10,1629},{
+133,0,723},{134,0,651},{136,11,191},{9,11,791},{10,11,93},{11,11,301},{16,11,13}
+,{17,11,23},{18,11,135},{19,11,12},{20,11,1},{20,11,12},{148,11,14},{136,11,503}
+,{6,11,466},{135,11,671},{6,0,1200},{134,0,1330},{135,0,1255},{134,0,986},{5,0,
+109},{6,0,1784},{7,0,1895},{12,0,296},{140,0,302},{135,11,983},{133,10,485},{134
+,0,660},{134,0,800},{5,0,216},{5,0,294},{6,0,591},{7,0,1879},{9,0,141},{9,0,270}
+,{9,0,679},{10,0,159},{11,0,197},{11,0,438},{12,0,538},{12,0,559},{14,0,144},{14
+,0,167},{15,0,67},{4,10,285},{5,10,317},{6,10,301},{7,10,7},{8,10,153},{10,10,
+766},{11,10,468},{12,10,467},{141,10,143},{136,0,945},{134,0,1090},{137,0,81},{
+12,11,468},{19,11,96},{148,11,24},{134,0,391},{138,11,241},{7,0,322},{136,0,249}
+,{134,0,1412},{135,11,795},{5,0,632},{138,0,526},{136,10,819},{6,0,144},{7,0,948
+},{7,0,1042},{8,0,235},{8,0,461},{9,0,453},{9,0,796},{10,0,354},{17,0,77},{135,
+11,954},{139,10,917},{6,0,940},{134,0,1228},{4,0,362},{7,0,52},{135,0,303},{6,11
+,549},{8,11,34},{8,11,283},{9,11,165},{138,11,475},{7,11,370},{7,11,1007},{7,11,
+1177},{135,11,1565},{5,11,652},{5,11,701},{135,11,449},{5,0,196},{6,0,486},{7,0,
+212},{8,0,309},{136,0,346},{6,10,1719},{6,10,1735},{7,10,2016},{7,10,2020},{8,10
+,837},{137,10,852},{6,11,159},{6,11,364},{7,11,516},{7,11,1439},{137,11,518},{
+135,0,1912},{135,0,1290},{132,0,686},{141,11,151},{138,0,625},{136,0,706},{138,
+10,568},{139,0,412},{4,0,30},{133,0,43},{8,10,67},{138,10,419},{7,0,967},{141,0,
+11},{12,0,758},{14,0,441},{142,0,462},{10,10,657},{14,10,297},{142,10,361},{139,
+10,729},{4,0,220},{135,0,1535},{7,11,501},{9,11,111},{10,11,141},{11,11,332},{13
+,11,43},{13,11,429},{14,11,130},{14,11,415},{145,11,102},{4,0,950},{6,0,1859},{7
+,0,11},{8,0,873},{12,0,710},{12,0,718},{12,0,748},{12,0,765},{148,0,124},{5,11,
+149},{5,11,935},{136,11,233},{142,11,291},{134,0,1579},{7,0,890},{8,10,51},{9,10
+,868},{10,10,833},{12,10,481},{12,10,570},{148,10,106},{141,0,2},{132,10,445},{
+136,11,801},{135,0,1774},{7,0,1725},{138,0,393},{5,0,263},{134,0,414},{132,11,
+322},{133,10,239},{7,0,456},{7,10,1990},{8,10,130},{139,10,720},{137,0,818},{5,
+10,123},{6,10,530},{7,10,348},{135,10,1419},{135,10,2024},{6,0,178},{6,0,1750},{
+8,0,251},{9,0,690},{10,0,155},{10,0,196},{10,0,373},{11,0,698},{13,0,155},{148,0
+,93},{5,0,97},{137,0,393},{134,0,674},{11,0,223},{140,0,168},{132,10,210},{139,
+11,464},{6,0,1639},{146,0,159},{139,11,2},{7,0,934},{8,0,647},{17,0,97},{19,0,59
+},{150,0,2},{132,0,191},{5,0,165},{9,0,346},{10,0,655},{11,0,885},{4,10,430},{
+135,11,357},{133,0,877},{5,10,213},{133,11,406},{8,0,128},{139,0,179},{6,11,69},
+{135,11,117},{135,0,1297},{11,11,43},{13,11,72},{141,11,142},{135,11,1830},{142,
+0,164},{5,0,57},{6,0,101},{6,0,586},{6,0,1663},{7,0,132},{7,0,1154},{7,0,1415},{
+7,0,1507},{12,0,493},{15,0,105},{151,0,15},{5,0,459},{7,0,1073},{8,0,241},{136,0
+,334},{133,11,826},{133,10,108},{5,10,219},{10,11,132},{11,11,191},{11,11,358},{
+139,11,460},{6,0,324},{6,0,520},{7,0,338},{7,0,1729},{8,0,228},{139,0,750},{21,0
+,30},{22,0,53},{4,10,193},{5,10,916},{7,10,364},{10,10,398},{10,10,726},{11,10,
+317},{11,10,626},{12,10,142},{12,10,288},{12,10,678},{13,10,313},{15,10,113},{
+146,10,114},{6,11,110},{135,11,1681},{135,0,910},{6,10,241},{7,10,907},{8,10,832
+},{9,10,342},{10,10,729},{11,10,284},{11,10,445},{11,10,651},{11,10,863},{13,10,
+398},{146,10,99},{7,0,705},{9,0,734},{5,11,1000},{7,11,733},{137,11,583},{4,0,73
+},{6,0,612},{7,0,927},{7,0,1822},{8,0,217},{9,0,765},{9,0,766},{10,0,408},{11,0,
+51},{11,0,793},{12,0,266},{15,0,158},{20,0,89},{150,0,32},{7,0,1330},{4,11,297},
+{6,11,529},{7,11,152},{7,11,713},{7,11,1845},{8,11,710},{8,11,717},{140,11,639},
+{5,0,389},{136,0,636},{134,0,1409},{4,10,562},{9,10,254},{139,10,879},{134,0,893
+},{132,10,786},{4,11,520},{135,11,575},{136,0,21},{140,0,721},{136,0,959},{7,11,
+1428},{7,11,1640},{9,11,169},{9,11,182},{9,11,367},{9,11,478},{9,11,506},{9,11,
+551},{9,11,648},{9,11,651},{9,11,697},{9,11,705},{9,11,725},{9,11,787},{9,11,794
+},{10,11,198},{10,11,214},{10,11,267},{10,11,275},{10,11,456},{10,11,551},{10,11
+,561},{10,11,613},{10,11,627},{10,11,668},{10,11,675},{10,11,691},{10,11,695},{
+10,11,707},{10,11,715},{11,11,183},{11,11,201},{11,11,244},{11,11,262},{11,11,
+352},{11,11,439},{11,11,493},{11,11,572},{11,11,591},{11,11,608},{11,11,611},{11
+,11,646},{11,11,674},{11,11,711},{11,11,751},{11,11,761},{11,11,776},{11,11,785}
+,{11,11,850},{11,11,853},{11,11,862},{11,11,865},{11,11,868},{11,11,898},{11,11,
+902},{11,11,903},{11,11,910},{11,11,932},{11,11,942},{11,11,957},{11,11,967},{11
+,11,972},{12,11,148},{12,11,195},{12,11,220},{12,11,237},{12,11,318},{12,11,339}
+,{12,11,393},{12,11,445},{12,11,450},{12,11,474},{12,11,509},{12,11,533},{12,11,
+591},{12,11,594},{12,11,597},{12,11,621},{12,11,633},{12,11,642},{13,11,59},{13,
+11,60},{13,11,145},{13,11,239},{13,11,250},{13,11,273},{13,11,329},{13,11,344},{
+13,11,365},{13,11,372},{13,11,387},{13,11,403},{13,11,414},{13,11,456},{13,11,
+478},{13,11,483},{13,11,489},{14,11,55},{14,11,57},{14,11,81},{14,11,90},{14,11,
+148},{14,11,239},{14,11,266},{14,11,321},{14,11,326},{14,11,327},{14,11,330},{14
+,11,347},{14,11,355},{14,11,401},{14,11,411},{14,11,414},{14,11,416},{14,11,420}
+,{15,11,61},{15,11,74},{15,11,87},{15,11,88},{15,11,94},{15,11,96},{15,11,116},{
+15,11,149},{15,11,154},{16,11,50},{16,11,63},{16,11,73},{17,11,2},{17,11,66},{17
+,11,92},{17,11,103},{17,11,112},{18,11,50},{18,11,54},{18,11,82},{18,11,86},{18,
+11,90},{18,11,111},{18,11,115},{18,11,156},{19,11,40},{19,11,79},{20,11,78},{149
+,11,22},{137,11,170},{134,0,1433},{135,11,1307},{139,11,411},{5,0,189},{7,0,442}
+,{7,0,443},{8,0,281},{12,0,174},{141,0,261},{6,10,216},{7,10,901},{7,10,1343},{
+136,10,493},{5,11,397},{6,11,154},{7,10,341},{7,11,676},{8,11,443},{8,11,609},{9
+,11,24},{9,11,325},{10,11,35},{11,10,219},{11,11,535},{11,11,672},{11,11,1018},{
+12,11,637},{144,11,30},{6,0,2},{7,0,191},{7,0,446},{7,0,1262},{7,0,1737},{8,0,22
+},{8,0,270},{8,0,612},{9,0,4},{9,0,312},{9,0,436},{9,0,626},{10,0,216},{10,0,311
+},{10,0,521},{10,0,623},{11,0,72},{11,0,330},{11,0,455},{12,0,321},{12,0,504},{
+12,0,530},{12,0,543},{13,0,17},{13,0,156},{13,0,334},{14,0,131},{17,0,60},{148,0
+,64},{7,0,354},{10,0,410},{139,0,815},{139,10,130},{7,10,1734},{137,11,631},{12,
+0,425},{15,0,112},{10,10,115},{11,10,420},{13,10,404},{14,10,346},{143,10,54},{6
+,0,60},{6,0,166},{7,0,374},{7,0,670},{7,0,1327},{8,0,411},{8,0,435},{9,0,653},{9
+,0,740},{10,0,385},{11,0,222},{11,0,324},{11,0,829},{140,0,611},{7,0,1611},{13,0
+,14},{15,0,44},{19,0,13},{148,0,76},{133,11,981},{4,11,56},{7,11,1791},{8,11,607
+},{8,11,651},{11,11,465},{11,11,835},{12,11,337},{141,11,480},{6,0,1478},{5,10,
+1011},{136,10,701},{139,0,596},{5,0,206},{134,0,398},{4,10,54},{5,10,666},{7,10,
+1039},{7,10,1130},{9,10,195},{138,10,302},{7,0,50},{9,11,158},{138,11,411},{135,
+11,1120},{6,0,517},{7,0,1159},{10,0,621},{11,0,192},{134,10,1669},{4,0,592},{6,0
+,600},{135,0,1653},{10,0,223},{139,0,645},{136,11,139},{7,0,64},{136,0,245},{142
+,0,278},{6,11,622},{135,11,1030},{136,0,604},{134,0,1502},{138,0,265},{141,11,
+168},{7,0,1763},{140,0,310},{7,10,798},{139,11,719},{7,11,160},{10,11,624},{142,
+11,279},{132,11,363},{7,10,122},{9,10,259},{10,10,84},{11,10,470},{12,10,541},{
+141,10,379},{5,0,129},{6,0,61},{135,0,947},{134,0,1356},{135,11,1191},{13,0,505}
+,{141,0,506},{11,0,1000},{5,10,82},{5,10,131},{7,10,1755},{8,10,31},{9,10,168},{
+9,10,764},{139,10,869},{134,0,966},{134,10,605},{134,11,292},{5,11,177},{6,11,
+616},{7,11,827},{9,11,525},{138,11,656},{135,11,1486},{138,11,31},{5,10,278},{
+137,10,68},{4,10,163},{5,10,201},{5,10,307},{5,10,310},{6,10,335},{7,10,284},{
+136,10,165},{6,0,839},{135,10,1660},{136,10,781},{6,10,33},{135,10,1244},{133,0,
+637},{4,11,161},{133,11,631},{137,0,590},{7,10,1953},{136,10,720},{5,0,280},{7,0
+,1226},{138,10,203},{134,0,1386},{5,0,281},{6,0,1026},{6,10,326},{7,10,677},{137
+,10,425},{7,11,1557},{135,11,1684},{135,0,1064},{9,11,469},{9,11,709},{12,11,512
+},{14,11,65},{145,11,12},{134,0,917},{10,11,229},{11,11,73},{11,11,376},{139,11,
+433},{7,0,555},{9,0,192},{13,0,30},{13,0,49},{15,0,150},{16,0,76},{20,0,52},{7,
+10,1316},{7,10,1412},{7,10,1839},{9,10,589},{11,10,241},{11,10,676},{11,10,811},
+{11,10,891},{12,10,140},{12,10,346},{12,10,479},{13,10,381},{14,10,188},{146,10,
+30},{149,0,15},{6,0,1882},{6,0,1883},{6,0,1897},{9,0,945},{9,0,1014},{9,0,1020},
+{12,0,823},{12,0,842},{12,0,866},{12,0,934},{15,0,242},{146,0,208},{6,0,965},{
+134,0,1499},{7,0,33},{7,0,120},{8,0,489},{9,0,319},{10,0,820},{11,0,1004},{12,0,
+379},{12,0,679},{13,0,117},{13,0,412},{14,0,25},{15,0,52},{15,0,161},{16,0,47},{
+149,0,2},{6,11,558},{7,11,651},{8,11,421},{9,11,0},{138,11,34},{4,0,937},{5,0,
+801},{7,0,473},{5,10,358},{7,10,1184},{10,10,662},{13,10,212},{13,10,304},{13,10
+,333},{145,10,98},{132,0,877},{6,0,693},{134,0,824},{132,0,365},{7,11,1832},{138
+,11,374},{5,0,7},{139,0,774},{4,0,734},{5,0,662},{134,0,430},{4,0,746},{135,0,
+1090},{5,0,360},{8,0,237},{10,0,231},{147,0,124},{138,11,348},{6,11,6},{7,11,81}
+,{7,11,771},{7,11,1731},{9,11,405},{138,11,421},{6,0,740},{137,0,822},{133,10,
+946},{7,0,1485},{136,0,929},{7,10,411},{8,10,631},{9,10,323},{10,10,355},{11,10,
+491},{12,10,143},{12,10,402},{13,10,73},{14,10,408},{15,10,107},{146,10,71},{135
+,10,590},{5,11,881},{133,11,885},{150,11,25},{4,0,852},{5,11,142},{134,11,546},{
+7,10,1467},{8,10,328},{10,10,544},{11,10,955},{13,10,320},{145,10,83},{9,0,17},{
+10,0,291},{11,10,511},{13,10,394},{14,10,298},{14,10,318},{146,10,103},{5,11,466
+},{11,11,571},{12,11,198},{13,11,283},{14,11,186},{15,11,21},{143,11,103},{134,0
+,1001},{4,11,185},{5,11,257},{5,11,839},{5,11,936},{7,11,171},{9,11,399},{10,11,
+258},{10,11,395},{10,11,734},{11,11,1014},{12,11,23},{13,11,350},{14,11,150},{
+147,11,6},{143,0,35},{132,0,831},{5,10,835},{134,10,483},{4,0,277},{5,0,608},{6,
+0,493},{7,0,457},{12,0,384},{7,11,404},{7,11,1377},{7,11,1430},{7,11,2017},{8,11
+,149},{8,11,239},{8,11,512},{8,11,793},{8,11,818},{9,11,474},{9,11,595},{10,11,
+122},{10,11,565},{10,11,649},{10,11,783},{11,11,239},{11,11,295},{11,11,447},{11
+,11,528},{11,11,639},{11,11,800},{11,11,936},{12,11,25},{12,11,73},{12,11,77},{
+12,11,157},{12,11,316},{12,11,390},{12,11,391},{12,11,394},{12,11,395},{12,11,
+478},{12,11,503},{12,11,592},{12,11,680},{13,11,50},{13,11,53},{13,11,132},{13,
+11,198},{13,11,275},{13,11,322},{13,11,415},{14,11,71},{14,11,257},{14,11,395},{
+15,11,71},{15,11,136},{17,11,123},{18,11,93},{147,11,58},{134,0,1351},{7,0,27},{
+135,0,316},{136,11,712},{136,0,984},{133,0,552},{137,0,264},{132,0,401},{6,0,710
+},{6,0,1111},{134,0,1343},{134,0,1211},{9,0,543},{10,0,524},{11,0,108},{11,0,653
+},{12,0,524},{13,0,123},{14,0,252},{16,0,18},{19,0,38},{20,0,26},{20,0,65},{21,0
+,3},{151,0,11},{4,0,205},{5,0,623},{7,0,104},{8,0,519},{137,0,716},{132,10,677},
+{4,11,377},{152,11,13},{135,11,1673},{7,0,579},{9,0,41},{9,0,244},{9,0,669},{10,
+0,5},{11,0,861},{11,0,951},{139,0,980},{132,0,717},{136,0,1011},{132,0,805},{4,
+11,180},{135,11,1906},{132,10,777},{132,10,331},{132,0,489},{6,0,1024},{4,11,491
+},{133,10,747},{135,11,1182},{4,11,171},{138,11,234},{4,11,586},{7,11,1186},{138
+,11,631},{135,0,892},{135,11,336},{9,11,931},{10,11,334},{148,11,71},{137,0,473}
+,{6,0,864},{12,0,659},{139,11,926},{7,0,819},{9,0,26},{9,0,392},{10,0,152},{10,0
+,226},{11,0,19},{12,0,276},{12,0,426},{12,0,589},{13,0,460},{15,0,97},{19,0,48},
+{148,0,104},{135,0,51},{133,10,326},{4,10,691},{146,10,16},{9,0,130},{11,0,765},
+{10,10,680},{10,10,793},{141,10,357},{133,11,765},{8,0,229},{6,10,32},{7,10,385}
+,{7,10,757},{7,10,1916},{8,10,94},{8,10,711},{9,10,541},{10,10,162},{10,10,795},
+{11,10,989},{11,10,1010},{12,10,14},{142,10,308},{7,11,474},{137,11,578},{132,0,
+674},{132,0,770},{5,0,79},{7,0,1027},{7,0,1477},{139,0,52},{133,11,424},{134,0,
+1666},{6,0,409},{6,10,349},{6,10,1682},{7,10,1252},{8,10,112},{8,11,714},{9,10,
+435},{9,10,668},{10,10,290},{10,10,319},{10,10,815},{11,10,180},{11,10,837},{12,
+10,240},{13,10,152},{13,10,219},{142,10,158},{5,0,789},{134,0,195},{4,0,251},{4,
+0,688},{7,0,513},{135,0,1284},{132,10,581},{9,11,420},{10,11,269},{10,11,285},{
+10,11,576},{11,11,397},{13,11,175},{145,11,90},{6,10,126},{7,10,573},{8,10,397},
+{142,10,44},{132,11,429},{133,0,889},{4,0,160},{5,0,330},{7,0,1434},{136,0,174},
+{7,11,18},{7,11,699},{7,11,1966},{8,11,752},{9,11,273},{9,11,412},{9,11,703},{10
+,11,71},{10,11,427},{10,11,508},{146,11,97},{6,0,872},{134,0,899},{133,10,926},{
+134,0,1126},{134,0,918},{4,11,53},{5,11,186},{135,11,752},{7,0,268},{136,0,569},
+{134,0,1224},{6,0,1361},{7,10,1232},{137,10,531},{8,11,575},{10,11,289},{139,11,
+319},{133,10,670},{132,11,675},{133,0,374},{135,10,1957},{133,0,731},{11,0,190},
+{15,0,49},{11,11,190},{143,11,49},{4,0,626},{5,0,506},{5,0,642},{6,0,425},{10,0,
+202},{139,0,141},{137,0,444},{7,10,242},{135,10,1942},{6,11,209},{8,11,468},{9,
+11,210},{11,11,36},{12,11,28},{12,11,630},{13,11,21},{13,11,349},{14,11,7},{145,
+11,13},{4,11,342},{135,11,1179},{5,10,834},{7,10,1202},{8,10,14},{9,10,481},{137
+,10,880},{4,11,928},{133,11,910},{4,11,318},{4,11,496},{7,11,856},{139,11,654},{
+136,0,835},{7,0,1526},{138,10,465},{151,0,17},{135,0,477},{4,10,357},{6,10,172},
+{7,10,143},{137,10,413},{6,0,1374},{138,0,994},{18,0,76},{132,10,590},{7,0,287},
+{8,0,355},{9,0,293},{137,0,743},{134,0,1389},{7,11,915},{8,11,247},{147,11,0},{4
+,11,202},{5,11,382},{6,11,454},{7,11,936},{7,11,1803},{8,11,758},{9,11,375},{9,
+11,895},{10,11,743},{10,11,792},{11,11,978},{11,11,1012},{142,11,109},{5,0,384},
+{8,0,455},{140,0,48},{132,11,390},{5,10,169},{7,10,333},{136,10,45},{5,0,264},{
+134,0,184},{138,11,791},{133,11,717},{132,10,198},{6,11,445},{7,11,332},{137,11,
+909},{136,0,1001},{4,10,24},{5,10,140},{5,10,185},{7,10,1500},{11,10,565},{139,
+10,838},{134,11,578},{5,0,633},{6,0,28},{135,0,1323},{132,0,851},{136,11,267},{7
+,0,359},{8,0,243},{140,0,175},{4,10,334},{133,10,593},{141,11,87},{136,11,766},{
+10,0,287},{12,0,138},{10,11,287},{140,11,138},{4,0,105},{132,0,740},{140,10,116}
+,{134,0,857},{135,11,1841},{6,0,1402},{137,0,819},{132,11,584},{132,10,709},{133
+,10,897},{5,0,224},{13,0,174},{146,0,52},{135,10,1840},{4,10,608},{133,10,497},{
+139,11,60},{4,0,758},{135,0,1649},{4,11,226},{4,11,326},{135,11,1770},{5,11,426}
+,{8,11,30},{9,11,2},{11,11,549},{147,11,122},{135,10,2039},{6,10,540},{136,10,
+136},{4,0,573},{8,0,655},{4,10,897},{133,10,786},{7,0,351},{139,0,128},{133,10,
+999},{4,10,299},{135,10,1004},{133,0,918},{132,11,345},{4,11,385},{7,11,265},{
+135,11,587},{133,10,456},{136,10,180},{6,0,687},{134,0,1537},{4,11,347},{5,11,
+423},{5,11,996},{135,11,1329},{132,10,755},{7,11,1259},{9,11,125},{11,11,65},{
+140,11,285},{5,11,136},{6,11,136},{136,11,644},{134,0,1525},{4,0,1009},{135,0,
+1139},{139,10,338},{132,0,340},{135,10,1464},{8,0,847},{10,0,861},{10,0,876},{10
+,0,889},{10,0,922},{10,0,929},{10,0,933},{12,0,784},{140,0,791},{139,0,176},{9,
+11,134},{10,11,2},{10,11,27},{10,11,333},{11,11,722},{143,11,1},{4,11,433},{133,
+11,719},{5,0,985},{7,0,509},{7,0,529},{145,0,96},{132,0,615},{4,10,890},{5,10,
+805},{5,10,819},{5,10,961},{6,10,396},{6,10,1631},{6,10,1678},{7,10,1967},{7,10,
+2041},{9,10,630},{11,10,8},{11,10,1019},{12,10,176},{13,10,225},{14,10,292},{149
+,10,24},{135,0,1919},{134,0,1131},{144,11,21},{144,11,51},{135,10,1815},{4,0,247
+},{7,10,1505},{10,10,190},{10,10,634},{11,10,792},{12,10,358},{140,10,447},{5,10
+,0},{6,10,536},{7,10,604},{13,10,445},{145,10,126},{4,0,184},{5,0,390},{6,0,337}
+,{7,0,23},{7,0,494},{7,0,618},{7,0,1456},{8,0,27},{8,0,599},{10,0,153},{139,0,
+710},{6,10,232},{6,10,412},{7,10,1074},{8,10,9},{8,10,157},{8,10,786},{9,10,196}
+,{9,10,352},{9,10,457},{10,10,337},{11,10,232},{11,10,877},{12,10,480},{140,10,
+546},{13,0,38},{135,10,958},{4,10,382},{136,10,579},{4,10,212},{135,10,1206},{4,
+11,555},{8,11,536},{138,11,288},{11,11,139},{139,11,171},{9,11,370},{138,11,90},
+{132,0,1015},{134,0,1088},{5,10,655},{135,11,977},{134,0,1585},{17,10,67},{147,
+10,74},{10,0,227},{11,0,497},{11,0,709},{140,0,415},{6,0,360},{7,0,1664},{136,0,
+478},{7,0,95},{6,10,231},{136,10,423},{140,11,65},{4,11,257},{135,11,2031},{135,
+11,1768},{133,10,300},{139,11,211},{136,0,699},{6,10,237},{7,10,611},{8,10,100},
+{9,10,416},{11,10,335},{12,10,173},{146,10,101},{14,0,26},{146,0,150},{6,0,581},
+{135,0,1119},{135,10,1208},{132,0,739},{6,11,83},{6,11,1733},{135,11,1389},{137,
+0,869},{4,0,67},{5,0,422},{7,0,1037},{7,0,1289},{7,0,1555},{9,0,741},{145,0,108}
+,{133,10,199},{12,10,427},{146,10,38},{136,0,464},{142,0,42},{10,0,96},{8,11,501
+},{137,11,696},{134,11,592},{4,0,512},{4,0,966},{5,0,342},{6,0,1855},{8,0,869},{
+8,0,875},{8,0,901},{144,0,26},{8,0,203},{11,0,823},{11,0,846},{12,0,482},{13,0,
+277},{13,0,302},{13,0,464},{14,0,205},{142,0,221},{4,0,449},{133,0,718},{7,11,
+1718},{9,11,95},{9,11,274},{10,11,279},{10,11,317},{10,11,420},{11,11,303},{11,
+11,808},{12,11,134},{12,11,367},{13,11,149},{13,11,347},{14,11,349},{14,11,406},
+{18,11,22},{18,11,89},{18,11,122},{147,11,47},{133,11,26},{4,0,355},{6,0,311},{9
+,0,256},{138,0,404},{132,11,550},{10,0,758},{6,10,312},{6,10,1715},{10,10,584},{
+11,10,546},{11,10,692},{12,10,259},{12,10,295},{13,10,46},{141,10,154},{136,11,
+822},{5,0,827},{4,11,902},{5,11,809},{6,11,122},{135,11,896},{5,0,64},{140,0,581
+},{4,0,442},{6,0,739},{7,0,1047},{7,0,1352},{7,0,1643},{7,11,1911},{9,11,449},{
+10,11,192},{138,11,740},{135,11,262},{132,10,588},{133,11,620},{5,0,977},{6,0,
+288},{7,0,528},{4,11,34},{5,11,574},{7,11,279},{7,11,1624},{136,11,601},{6,0,
+1375},{4,10,231},{5,10,61},{6,10,104},{7,10,729},{7,10,964},{7,10,1658},{140,10,
+414},{6,10,263},{138,10,757},{132,10,320},{4,0,254},{7,0,1309},{5,11,332},{135,
+11,1309},{6,11,261},{8,11,182},{139,11,943},{132,10,225},{6,0,12},{135,0,1219},{
+4,0,275},{12,0,376},{6,11,1721},{141,11,490},{4,11,933},{133,11,880},{6,0,951},{
+6,0,1109},{6,0,1181},{7,0,154},{4,10,405},{7,10,817},{14,10,58},{17,10,37},{146,
+10,124},{6,0,1520},{133,10,974},{134,0,1753},{6,0,369},{6,0,502},{7,0,1036},{8,0
+,348},{9,0,452},{10,0,26},{11,0,224},{11,0,387},{11,0,772},{12,0,95},{12,0,629},
+{13,0,195},{13,0,207},{13,0,241},{14,0,260},{14,0,270},{143,0,140},{132,0,269},{
+5,0,480},{7,0,532},{7,0,1197},{7,0,1358},{8,0,291},{11,0,349},{142,0,396},{5,10,
+235},{7,10,1239},{11,10,131},{140,10,370},{7,10,956},{7,10,1157},{7,10,1506},{7,
+10,1606},{7,10,1615},{7,10,1619},{7,10,1736},{7,10,1775},{8,10,590},{9,10,324},{
+9,10,736},{9,10,774},{9,10,776},{9,10,784},{10,10,567},{10,10,708},{11,10,518},{
+11,10,613},{11,10,695},{11,10,716},{11,10,739},{11,10,770},{11,10,771},{11,10,
+848},{11,10,857},{11,10,931},{11,10,947},{12,10,326},{12,10,387},{12,10,484},{12
+,10,528},{12,10,552},{12,10,613},{13,10,189},{13,10,256},{13,10,340},{13,10,432}
+,{13,10,436},{13,10,440},{13,10,454},{14,10,174},{14,10,220},{14,10,284},{14,10,
+390},{145,10,121},{8,11,598},{9,11,664},{138,11,441},{9,10,137},{138,10,221},{
+133,11,812},{148,0,15},{134,0,1341},{6,0,1017},{4,11,137},{7,11,1178},{135,11,
+1520},{7,10,390},{138,10,140},{7,11,1260},{135,11,1790},{137,11,191},{135,10,
+1144},{6,0,1810},{7,0,657},{8,0,886},{10,0,857},{14,0,440},{144,0,96},{8,0,533},
+{6,11,1661},{7,11,1975},{7,11,2009},{135,11,2011},{6,0,1453},{134,10,464},{132,
+11,715},{5,10,407},{11,10,204},{11,10,243},{11,10,489},{12,10,293},{19,10,37},{
+20,10,73},{150,10,38},{133,11,703},{4,0,211},{7,0,1483},{5,10,325},{8,10,5},{8,
+10,227},{9,10,105},{10,10,585},{140,10,614},{4,0,332},{5,0,335},{6,0,238},{7,0,
+269},{7,0,811},{7,0,1797},{8,0,836},{9,0,507},{141,0,242},{5,11,89},{7,11,1915},
+{9,11,185},{9,11,235},{9,11,496},{10,11,64},{10,11,270},{10,11,403},{10,11,469},
+{10,11,529},{10,11,590},{11,11,140},{11,11,860},{13,11,1},{13,11,422},{14,11,341
+},{14,11,364},{17,11,93},{18,11,113},{19,11,97},{147,11,113},{133,11,695},{16,0,
+19},{5,11,6},{6,11,183},{6,10,621},{7,11,680},{7,11,978},{7,11,1013},{7,11,1055}
+,{12,11,230},{13,11,172},{13,10,504},{146,11,29},{136,0,156},{133,0,1009},{6,11,
+29},{139,11,63},{134,0,820},{134,10,218},{7,10,454},{7,10,782},{8,10,768},{140,
+10,686},{5,0,228},{6,0,203},{7,0,156},{8,0,347},{9,0,265},{18,0,39},{20,0,54},{
+21,0,31},{22,0,3},{23,0,0},{15,11,8},{18,11,39},{20,11,54},{21,11,31},{22,11,3},
+{151,11,0},{7,0,1131},{135,0,1468},{144,10,0},{134,0,1276},{10,10,676},{140,10,
+462},{132,11,311},{134,11,1740},{7,11,170},{8,11,90},{8,11,177},{8,11,415},{11,
+11,714},{142,11,281},{134,10,164},{6,0,1792},{138,0,849},{150,10,50},{5,0,291},{
+5,0,318},{7,0,765},{9,0,389},{12,0,548},{8,11,522},{142,11,328},{11,11,91},{13,
+11,129},{15,11,101},{145,11,125},{4,11,494},{6,11,74},{7,11,44},{7,11,407},{8,11
+,551},{12,11,17},{15,11,5},{148,11,11},{4,11,276},{133,11,296},{6,10,343},{7,10,
+195},{7,11,1777},{9,10,226},{10,10,197},{10,10,575},{11,10,502},{139,10,899},{10
+,0,525},{139,0,82},{14,0,453},{4,11,7},{5,11,90},{5,11,158},{6,11,542},{7,11,221
+},{7,11,1574},{9,11,490},{10,11,540},{11,11,443},{139,11,757},{135,0,666},{22,10
+,29},{150,11,29},{4,0,422},{147,10,8},{5,0,355},{145,0,0},{6,0,1873},{9,0,918},{
+7,11,588},{9,11,175},{138,11,530},{143,11,31},{11,0,165},{7,10,1125},{9,10,143},
+{14,10,405},{150,10,21},{9,0,260},{137,0,905},{5,11,872},{6,11,57},{6,11,479},{6
+,11,562},{7,11,471},{7,11,1060},{9,11,447},{9,11,454},{141,11,6},{138,11,704},{
+133,0,865},{5,0,914},{134,0,1625},{133,0,234},{7,0,1383},{5,11,31},{6,11,614},{
+145,11,61},{7,11,1200},{138,11,460},{6,11,424},{135,11,1866},{136,0,306},{5,10,
+959},{12,11,30},{13,11,148},{14,11,87},{14,11,182},{16,11,42},{18,11,92},{148,11
+,70},{6,0,1919},{6,0,1921},{9,0,923},{9,0,930},{9,0,941},{9,0,949},{9,0,987},{9,
+0,988},{9,0,992},{12,0,802},{12,0,815},{12,0,856},{12,0,885},{12,0,893},{12,0,
+898},{12,0,919},{12,0,920},{12,0,941},{12,0,947},{15,0,183},{15,0,185},{15,0,189
+},{15,0,197},{15,0,202},{15,0,233},{18,0,218},{18,0,219},{18,0,233},{143,11,156}
+,{135,10,1759},{136,10,173},{13,0,163},{13,0,180},{18,0,78},{20,0,35},{5,11,13},
+{134,11,142},{134,10,266},{6,11,97},{7,11,116},{8,11,322},{8,11,755},{9,11,548},
+{10,11,714},{11,11,884},{141,11,324},{135,0,1312},{9,0,814},{137,11,676},{133,0,
+707},{135,0,1493},{6,0,421},{7,0,61},{7,0,1540},{10,0,11},{138,0,501},{12,0,733}
+,{12,0,766},{7,11,866},{135,11,1163},{137,0,341},{142,0,98},{145,11,115},{135,11
+,1111},{136,10,300},{136,0,1014},{8,11,1},{9,11,112},{138,11,326},{132,11,730},{
+5,11,488},{6,11,527},{7,11,489},{7,11,1636},{8,11,121},{8,11,144},{8,11,359},{9,
+11,193},{9,11,241},{9,11,336},{9,11,882},{11,11,266},{11,11,372},{11,11,944},{12
+,11,401},{140,11,641},{6,0,971},{134,0,1121},{6,0,102},{7,0,72},{15,0,142},{147,
+0,67},{151,0,30},{135,0,823},{134,0,1045},{5,10,427},{5,10,734},{7,10,478},{136,
+10,52},{7,0,1930},{11,10,217},{142,10,165},{6,0,1512},{135,0,1870},{9,11,31},{10
+,11,244},{10,11,699},{12,11,149},{141,11,497},{133,11,377},{145,11,101},{10,11,
+158},{13,11,13},{13,11,137},{13,11,258},{14,11,111},{14,11,225},{14,11,253},{14,
+11,304},{14,11,339},{14,11,417},{146,11,33},{6,0,87},{6,10,1734},{7,10,20},{7,10
+,1056},{8,10,732},{9,10,406},{9,10,911},{138,10,694},{134,0,1243},{137,0,245},{7
+,0,68},{8,0,48},{8,0,88},{8,0,582},{8,0,681},{9,0,373},{9,0,864},{11,0,157},{11,
+0,336},{11,0,843},{148,0,27},{8,11,663},{144,11,8},{133,10,613},{4,0,88},{5,0,
+137},{5,0,174},{5,0,777},{6,0,1664},{6,0,1725},{7,0,77},{7,0,426},{7,0,1317},{7,
+0,1355},{8,0,126},{8,0,563},{9,0,523},{9,0,750},{10,0,310},{10,0,836},{11,0,42},
+{11,0,318},{11,0,731},{12,0,68},{12,0,92},{12,0,507},{12,0,692},{13,0,81},{13,0,
+238},{13,0,374},{14,0,436},{18,0,138},{19,0,78},{19,0,111},{20,0,55},{20,0,77},{
+148,0,92},{141,0,418},{4,0,938},{137,0,625},{138,0,351},{5,11,843},{7,10,32},{7,
+10,984},{8,10,85},{8,10,709},{9,10,579},{9,10,847},{9,10,856},{10,10,799},{11,10
+,258},{11,10,1007},{12,10,331},{12,10,615},{13,10,188},{13,10,435},{14,10,8},{15
+,10,165},{16,10,27},{148,10,40},{6,0,1668},{7,0,1499},{8,0,117},{9,0,314},{138,0
+,174},{135,0,707},{132,11,554},{133,11,536},{5,0,403},{5,11,207},{9,11,79},{11,
+11,625},{145,11,7},{132,11,424},{136,11,785},{4,10,167},{135,10,82},{9,0,7},{23,
+0,6},{9,11,7},{151,11,6},{6,0,282},{5,10,62},{6,10,534},{7,10,74},{7,10,678},{7,
+10,684},{7,10,1043},{7,10,1072},{8,10,280},{8,10,541},{8,10,686},{9,10,258},{10,
+10,519},{11,10,252},{140,10,282},{138,10,33},{132,10,359},{4,0,44},{5,0,311},{6,
+0,156},{7,0,639},{7,0,762},{7,0,1827},{9,0,8},{9,0,462},{148,0,83},{7,11,769},{9
+,11,18},{138,11,358},{4,0,346},{7,0,115},{9,0,180},{9,0,456},{10,0,363},{4,11,
+896},{134,11,1777},{133,10,211},{7,0,761},{7,0,1051},{137,0,545},{6,10,145},{141
+,10,336},{7,11,750},{9,11,223},{11,11,27},{11,11,466},{12,11,624},{14,11,265},{
+146,11,61},{6,0,752},{6,0,768},{6,0,1195},{6,0,1254},{6,0,1619},{137,0,835},{6,0
+,1936},{8,0,930},{136,0,960},{132,10,263},{132,11,249},{12,0,653},{132,10,916},{
+4,11,603},{133,11,661},{8,0,344},{4,11,11},{6,11,128},{7,11,231},{7,11,1533},{
+138,11,725},{134,0,1483},{134,0,875},{6,0,185},{7,0,1899},{9,0,875},{139,0,673},
+{15,10,155},{144,10,79},{7,0,93},{7,0,210},{7,0,1223},{8,0,451},{8,0,460},{11,0,
+353},{11,0,475},{4,10,599},{6,10,1634},{7,10,67},{7,10,691},{7,10,979},{7,10,
+1697},{8,10,207},{8,10,214},{8,10,231},{8,10,294},{8,10,336},{8,10,428},{8,10,
+471},{8,10,622},{8,10,626},{8,10,679},{8,10,759},{8,10,829},{9,10,11},{9,10,246}
+,{9,10,484},{9,10,573},{9,10,706},{9,10,762},{9,10,798},{9,10,855},{9,10,870},{9
+,10,912},{10,10,303},{10,10,335},{10,10,424},{10,10,461},{10,10,543},{10,10,759}
+,{10,10,814},{11,10,59},{11,10,235},{11,10,590},{11,10,929},{11,10,963},{11,10,
+987},{12,10,114},{12,10,182},{12,10,226},{12,10,332},{12,10,439},{12,10,575},{12
+,10,598},{12,10,675},{13,10,8},{13,10,125},{13,10,194},{13,10,287},{14,10,197},{
+14,10,383},{15,10,53},{17,10,63},{19,10,46},{19,10,98},{19,10,106},{148,10,85},{
+132,11,476},{4,0,327},{5,0,478},{7,0,1332},{136,0,753},{5,0,1020},{133,0,1022},{
+135,11,1807},{4,0,103},{133,0,401},{4,0,499},{135,0,1421},{10,0,207},{13,0,164},
+{147,10,126},{9,11,20},{10,11,324},{139,11,488},{132,0,96},{9,11,280},{138,11,
+134},{135,0,968},{133,10,187},{135,10,1286},{5,11,112},{6,11,103},{134,11,150},{
+8,0,914},{10,0,3},{4,10,215},{9,10,38},{11,10,23},{11,10,127},{139,10,796},{135,
+0,399},{6,0,563},{137,0,224},{6,0,704},{134,0,1214},{4,11,708},{8,11,15},{9,11,
+50},{9,11,386},{11,11,18},{11,11,529},{140,11,228},{4,11,563},{7,11,109},{7,11,
+592},{7,11,637},{7,11,770},{7,11,1701},{8,11,436},{8,11,463},{9,11,60},{9,11,335
+},{9,11,904},{10,11,73},{11,11,434},{12,11,585},{13,11,331},{18,11,110},{148,11,
+60},{134,0,1559},{132,11,502},{6,11,347},{138,11,161},{4,11,33},{5,11,102},{5,11
+,500},{6,11,284},{7,11,1079},{7,11,1423},{7,11,1702},{8,11,470},{9,11,554},{9,11
+,723},{139,11,333},{7,11,246},{135,11,840},{6,11,10},{8,11,571},{9,11,739},{143,
+11,91},{8,0,861},{10,0,905},{12,0,730},{12,0,789},{133,11,626},{134,0,946},{5,0,
+746},{12,0,333},{14,0,332},{12,11,333},{142,11,332},{5,11,18},{6,11,526},{13,11,
+24},{13,11,110},{19,11,5},{147,11,44},{4,0,910},{5,0,832},{135,10,2002},{10,11,
+768},{139,11,787},{4,11,309},{5,11,462},{7,11,970},{135,11,1097},{4,10,28},{5,10
+,440},{7,10,248},{11,10,833},{140,10,344},{134,10,1654},{6,0,632},{6,0,652},{6,0
+,1272},{6,0,1384},{134,0,1560},{134,11,1704},{6,0,1393},{133,10,853},{6,10,249},
+{7,10,1234},{139,10,573},{5,11,86},{7,11,743},{9,11,85},{10,11,281},{10,11,432},
+{11,11,490},{12,11,251},{13,11,118},{14,11,378},{146,11,143},{5,11,524},{133,11,
+744},{134,0,1514},{10,0,201},{142,0,319},{7,0,717},{10,0,510},{7,10,392},{8,10,
+20},{8,10,172},{8,10,690},{9,10,383},{9,10,845},{11,10,293},{11,10,832},{11,10,
+920},{11,10,984},{141,10,221},{134,0,1381},{5,10,858},{133,10,992},{8,0,528},{
+137,0,348},{10,11,107},{140,11,436},{4,0,20},{133,0,616},{134,0,1251},{132,11,
+927},{10,11,123},{12,11,670},{13,11,371},{14,11,142},{146,11,94},{134,0,1163},{7
+,11,1149},{137,11,156},{134,0,307},{133,11,778},{7,0,1091},{135,0,1765},{5,11,
+502},{6,10,268},{137,10,62},{8,11,196},{10,11,283},{139,11,406},{4,0,26},{5,0,
+429},{6,0,245},{7,0,704},{7,0,1379},{135,0,1474},{133,11,855},{132,0,881},{4,0,
+621},{135,11,1596},{7,11,1400},{9,11,446},{138,11,45},{6,0,736},{138,10,106},{
+133,0,542},{134,0,348},{133,0,868},{136,0,433},{135,0,1495},{138,0,771},{6,10,
+613},{136,10,223},{138,0,215},{141,0,124},{136,11,391},{135,11,172},{132,10,670}
+,{140,0,55},{9,10,40},{139,10,136},{7,0,62},{147,0,112},{132,0,856},{132,11,568}
+,{12,0,270},{139,10,259},{8,0,572},{137,0,698},{4,11,732},{9,10,310},{137,10,682
+},{142,10,296},{134,0,939},{136,11,733},{135,11,1435},{7,10,1401},{135,10,1476},
+{6,0,352},{4,10,296},{7,10,401},{7,10,1410},{7,10,1594},{7,10,1674},{8,10,63},{8
+,10,660},{137,10,74},{4,11,428},{133,11,668},{4,10,139},{4,10,388},{140,10,188},
+{7,11,2015},{140,11,665},{132,0,647},{146,0,10},{138,0,220},{142,0,464},{132,0,
+109},{134,0,1746},{6,0,515},{4,10,747},{6,11,1623},{6,11,1681},{7,10,649},{7,10,
+1479},{135,10,1583},{133,10,232},{135,0,566},{137,10,887},{4,0,40},{10,0,67},{11
+,0,117},{11,0,768},{139,0,935},{132,0,801},{7,0,992},{8,0,301},{9,0,722},{12,0,
+63},{13,0,29},{14,0,161},{143,0,18},{139,0,923},{6,11,1748},{8,11,715},{9,11,802
+},{10,11,46},{10,11,819},{13,11,308},{14,11,351},{14,11,363},{146,11,67},{137,11
+,745},{7,0,1145},{4,10,14},{7,10,1801},{10,10,748},{141,10,458},{4,11,63},{5,11,
+347},{134,11,474},{135,0,568},{4,10,425},{7,11,577},{7,11,1432},{9,11,475},{9,11
+,505},{9,11,526},{9,11,609},{9,11,689},{9,11,726},{9,11,735},{9,11,738},{10,11,
+556},{10,11,674},{10,11,684},{11,11,89},{11,11,202},{11,11,272},{11,11,380},{11,
+11,415},{11,11,505},{11,11,537},{11,11,550},{11,11,562},{11,11,640},{11,11,667},
+{11,11,688},{11,11,847},{11,11,927},{11,11,930},{11,11,940},{12,11,144},{12,11,
+325},{12,11,329},{12,11,389},{12,11,403},{12,11,451},{12,11,515},{12,11,604},{12
+,11,616},{12,11,626},{13,11,66},{13,11,131},{13,11,167},{13,11,236},{13,11,368},
+{13,11,411},{13,11,434},{13,11,453},{13,11,461},{13,11,474},{14,11,59},{14,11,60
+},{14,11,139},{14,11,152},{14,11,276},{14,11,353},{14,11,402},{15,11,28},{15,11,
+81},{15,11,123},{15,11,152},{18,11,136},{148,11,88},{137,0,247},{135,11,1622},{9
+,11,544},{11,11,413},{144,11,25},{4,0,645},{7,0,825},{6,10,1768},{135,11,89},{
+140,0,328},{5,10,943},{134,10,1779},{134,0,1363},{5,10,245},{6,10,576},{7,10,582
+},{136,10,225},{134,0,1280},{5,11,824},{133,11,941},{7,11,440},{8,11,230},{139,
+11,106},{5,0,28},{6,0,204},{10,0,320},{10,0,583},{13,0,502},{14,0,72},{14,0,274}
+,{14,0,312},{14,0,344},{15,0,159},{16,0,62},{16,0,69},{17,0,30},{18,0,42},{18,0,
+53},{18,0,84},{18,0,140},{19,0,68},{19,0,85},{20,0,5},{20,0,45},{20,0,101},{22,0
+,7},{150,0,20},{4,0,558},{6,0,390},{7,0,162},{7,0,689},{9,0,360},{138,0,653},{
+134,0,764},{6,0,862},{137,0,833},{5,0,856},{6,0,1672},{6,0,1757},{134,0,1781},{5
+,0,92},{10,0,736},{140,0,102},{6,0,1927},{6,0,1944},{8,0,924},{8,0,948},{10,0,
+967},{138,0,978},{134,0,1479},{5,0,590},{8,0,360},{9,0,213},{138,0,63},{134,0,
+1521},{6,0,709},{134,0,891},{132,10,443},{13,0,477},{14,0,120},{148,0,61},{4,11,
+914},{5,11,800},{133,11,852},{10,11,54},{141,11,115},{4,11,918},{133,11,876},{
+139,11,152},{4,11,92},{133,11,274},{135,11,1901},{9,11,800},{10,11,693},{11,11,
+482},{11,11,734},{139,11,789},{9,0,483},{132,10,298},{6,0,1213},{141,11,498},{
+135,11,1451},{133,11,743},{4,0,1022},{10,0,1000},{12,0,957},{12,0,980},{12,0,
+1013},{14,0,481},{144,0,116},{8,0,503},{17,0,29},{4,11,49},{7,11,280},{135,11,
+1633},{135,0,1712},{134,0,466},{136,11,47},{5,10,164},{7,10,121},{142,10,189},{7
+,10,812},{7,10,1261},{7,10,1360},{9,10,632},{140,10,352},{139,10,556},{132,0,731
+},{5,11,272},{5,11,908},{5,11,942},{7,11,1008},{7,11,1560},{8,11,197},{9,11,47},
+{11,11,538},{139,11,742},{4,10,172},{9,10,611},{10,10,436},{12,10,673},{141,10,
+255},{133,10,844},{10,0,484},{11,0,754},{12,0,457},{14,0,171},{14,0,389},{146,0,
+153},{9,10,263},{10,10,147},{138,10,492},{137,11,891},{138,0,241},{133,10,537},{
+6,0,2005},{136,0,964},{137,10,842},{151,11,8},{4,11,407},{132,11,560},{135,11,
+1884},{6,0,1100},{134,0,1242},{135,0,954},{5,10,230},{5,10,392},{6,10,420},{9,10
+,568},{140,10,612},{4,11,475},{11,11,35},{11,11,90},{13,11,7},{13,11,71},{13,11,
+177},{142,11,422},{136,11,332},{135,0,1958},{6,0,549},{8,0,34},{8,0,283},{9,0,
+165},{138,0,475},{10,0,952},{12,0,966},{140,0,994},{5,0,652},{5,0,701},{135,0,
+449},{4,0,655},{7,0,850},{17,0,75},{146,0,137},{4,0,146},{7,0,1618},{8,0,670},{5
+,10,41},{7,10,1459},{7,10,1469},{7,10,1859},{9,10,549},{139,10,905},{133,10,696}
+,{6,0,159},{6,0,364},{7,0,516},{137,0,518},{135,0,1439},{6,11,222},{7,11,636},{7
+,11,1620},{8,11,409},{9,11,693},{139,11,77},{13,0,151},{141,11,45},{6,0,1027},{4
+,11,336},{132,10,771},{139,11,392},{10,11,121},{11,11,175},{149,11,16},{8,0,950}
+,{138,0,983},{133,10,921},{135,0,993},{6,10,180},{7,10,1137},{8,10,751},{139,10,
+805},{7,0,501},{9,0,111},{10,0,141},{11,0,332},{13,0,43},{13,0,429},{14,0,130},{
+14,0,415},{145,0,102},{4,10,183},{5,11,882},{7,10,271},{11,10,824},{11,10,952},{
+13,10,278},{13,10,339},{13,10,482},{14,10,424},{148,10,99},{4,10,19},{5,10,477},
+{5,10,596},{6,10,505},{7,10,1221},{11,10,907},{12,10,209},{141,10,214},{135,10,
+1215},{133,0,452},{132,11,426},{5,0,149},{136,0,233},{133,0,935},{6,11,58},{7,11
+,654},{7,11,745},{7,11,1969},{8,11,240},{8,11,675},{9,11,479},{9,11,731},{10,11,
+330},{10,11,593},{10,11,817},{11,11,32},{11,11,133},{11,11,221},{145,11,68},{12,
+0,582},{18,0,131},{7,11,102},{137,11,538},{136,0,801},{134,10,1645},{132,0,70},{
+6,10,92},{6,10,188},{7,10,1269},{7,10,1524},{7,10,1876},{10,10,228},{139,10,1020
+},{4,10,459},{133,10,966},{138,0,369},{16,0,36},{140,10,330},{141,11,366},{7,0,
+721},{10,0,236},{12,0,204},{6,10,18},{7,10,932},{8,10,757},{9,10,54},{9,10,65},{
+9,10,844},{10,10,113},{10,10,315},{10,10,798},{11,10,153},{12,10,151},{12,10,392
+},{12,10,666},{142,10,248},{7,0,241},{10,0,430},{8,10,548},{9,10,532},{10,10,117
+},{11,10,351},{11,10,375},{143,10,23},{134,10,1742},{133,10,965},{133,11,566},{6
+,11,48},{135,11,63},{134,10,182},{10,10,65},{10,10,488},{138,10,497},{6,11,114},
+{7,11,1224},{7,11,1556},{136,11,3},{134,0,1817},{8,11,576},{137,11,267},{6,0,
+1078},{144,0,16},{9,10,588},{138,10,260},{138,0,1021},{5,0,406},{134,0,2022},{
+133,11,933},{6,0,69},{135,0,117},{7,0,1830},{136,11,427},{4,0,432},{135,0,824},{
+134,10,1786},{133,0,826},{139,11,67},{133,11,759},{135,10,308},{137,0,816},{133,
+0,1000},{4,0,297},{6,0,529},{7,0,152},{7,0,713},{7,0,1845},{8,0,710},{8,0,717},{
+12,0,639},{140,0,685},{7,0,423},{136,10,588},{136,10,287},{136,0,510},{134,0,
+1048},{6,0,618},{7,11,56},{7,11,1989},{8,11,337},{8,11,738},{9,11,600},{10,11,
+483},{12,11,37},{13,11,447},{142,11,92},{4,0,520},{135,0,575},{8,0,990},{138,0,
+977},{135,11,774},{9,11,347},{11,11,24},{140,11,170},{136,11,379},{140,10,290},{
+132,11,328},{4,0,321},{134,0,569},{4,11,101},{135,11,1171},{7,0,723},{7,0,1135},
+{5,11,833},{136,11,744},{7,10,719},{8,10,809},{136,10,834},{8,0,921},{136,10,796
+},{5,10,210},{6,10,213},{7,10,60},{10,10,364},{139,10,135},{5,0,397},{6,0,154},{
+7,0,676},{8,0,443},{8,0,609},{9,0,24},{9,0,325},{10,0,35},{11,0,535},{11,0,672},
+{11,0,1018},{12,0,637},{16,0,30},{5,10,607},{8,10,326},{136,10,490},{4,10,701},{
+5,10,472},{6,11,9},{6,11,397},{7,11,53},{7,11,1742},{9,10,758},{10,11,632},{11,
+11,828},{140,11,146},{135,10,380},{135,10,1947},{148,11,109},{10,10,278},{138,11
+,278},{134,0,856},{7,0,139},{4,10,386},{8,10,405},{8,10,728},{9,10,497},{11,10,
+110},{11,10,360},{15,10,37},{144,10,84},{141,0,282},{133,0,981},{5,0,288},{7,10,
+1452},{7,10,1480},{8,10,634},{140,10,472},{7,0,1890},{8,11,367},{10,11,760},{14,
+11,79},{20,11,17},{152,11,0},{4,10,524},{136,10,810},{4,0,56},{7,0,1791},{8,0,
+607},{8,0,651},{11,0,465},{11,0,835},{12,0,337},{141,0,480},{10,10,238},{141,10,
+33},{11,11,417},{12,11,223},{140,11,265},{9,0,158},{10,0,411},{140,0,261},{133,
+10,532},{133,10,997},{12,11,186},{12,11,292},{14,11,100},{146,11,70},{6,0,1403},
+{136,0,617},{134,0,1205},{139,0,563},{4,0,242},{134,0,333},{4,11,186},{5,11,157}
+,{8,11,168},{138,11,6},{132,0,369},{133,11,875},{5,10,782},{5,10,829},{134,10,
+1738},{134,0,622},{135,11,1272},{6,0,1407},{7,11,111},{136,11,581},{7,10,1823},{
+139,10,693},{7,0,160},{10,0,624},{142,0,279},{132,0,363},{10,11,589},{12,11,111}
+,{13,11,260},{14,11,82},{18,11,63},{147,11,45},{7,11,1364},{7,11,1907},{141,11,
+158},{4,11,404},{4,11,659},{135,11,675},{13,11,211},{14,11,133},{14,11,204},{15,
+11,64},{15,11,69},{15,11,114},{16,11,10},{19,11,23},{19,11,35},{19,11,39},{19,11
+,51},{19,11,71},{19,11,75},{152,11,15},{4,10,78},{5,10,96},{5,10,182},{7,10,1724
+},{7,10,1825},{10,10,394},{10,10,471},{11,10,532},{14,10,340},{145,10,88},{135,
+10,1964},{133,11,391},{11,11,887},{14,11,365},{142,11,375},{5,11,540},{6,11,1697
+},{7,11,222},{136,11,341},{134,11,78},{9,0,601},{9,0,619},{10,0,505},{10,0,732},
+{11,0,355},{140,0,139},{134,0,292},{139,0,174},{5,0,177},{6,0,616},{7,0,827},{9,
+0,525},{138,0,656},{10,0,31},{6,10,215},{7,10,1028},{7,10,1473},{7,10,1721},{9,
+10,424},{138,10,779},{135,10,584},{136,11,293},{134,0,685},{135,11,1868},{133,11
+,460},{7,0,647},{6,10,67},{7,10,1630},{9,10,354},{9,10,675},{10,10,830},{14,10,
+80},{145,10,80},{4,0,161},{133,0,631},{6,10,141},{7,10,225},{9,10,59},{9,10,607}
+,{10,10,312},{11,10,687},{12,10,555},{13,10,373},{13,10,494},{148,10,58},{7,11,
+965},{7,11,1460},{135,11,1604},{136,10,783},{134,11,388},{6,0,722},{6,0,1267},{4
+,11,511},{9,11,333},{9,11,379},{10,11,602},{11,11,441},{11,11,723},{11,11,976},{
+140,11,357},{134,0,1797},{135,0,1684},{9,0,469},{9,0,709},{12,0,512},{14,0,65},{
+17,0,12},{5,11,938},{136,11,707},{7,0,1230},{136,0,531},{10,0,229},{11,0,73},{11
+,0,376},{139,0,433},{12,0,268},{12,0,640},{142,0,119},{7,10,430},{139,10,46},{6,
+0,558},{7,0,651},{8,0,421},{9,0,0},{10,0,34},{139,0,1008},{6,0,106},{7,0,1786},{
+7,0,1821},{9,0,102},{9,0,763},{5,10,602},{7,10,2018},{137,10,418},{5,0,65},{6,0,
+416},{7,0,1720},{7,0,1924},{10,0,109},{11,0,14},{11,0,70},{11,0,569},{11,0,735},
+{15,0,153},{20,0,80},{136,10,677},{135,11,1625},{137,11,772},{136,0,595},{6,11,
+469},{7,11,1709},{138,11,515},{7,0,1832},{138,0,374},{9,0,106},{9,0,163},{9,0,
+296},{10,0,167},{10,0,172},{10,0,777},{139,0,16},{6,0,6},{7,0,81},{7,0,771},{7,0
+,1731},{9,0,405},{138,0,421},{4,11,500},{135,11,938},{5,11,68},{134,11,383},{5,0
+,881},{133,0,885},{6,0,854},{6,0,1132},{6,0,1495},{6,0,1526},{6,0,1533},{134,0,
+1577},{4,11,337},{6,11,353},{7,11,1934},{8,11,488},{137,11,429},{7,11,236},{7,11
+,1795},{8,11,259},{9,11,135},{9,11,177},{10,11,825},{11,11,115},{11,11,370},{11,
+11,405},{11,11,604},{12,11,10},{12,11,667},{12,11,669},{13,11,76},{14,11,310},{
+15,11,76},{15,11,147},{148,11,23},{5,0,142},{134,0,546},{4,11,15},{5,11,22},{6,
+11,244},{7,11,40},{7,11,200},{7,11,906},{7,11,1199},{9,11,616},{10,11,716},{11,
+11,635},{11,11,801},{140,11,458},{5,0,466},{11,0,571},{12,0,198},{13,0,283},{14,
+0,186},{15,0,21},{15,0,103},{135,10,329},{4,0,185},{5,0,257},{5,0,839},{5,0,936}
+,{9,0,399},{10,0,258},{10,0,395},{10,0,734},{11,0,1014},{12,0,23},{13,0,350},{14
+,0,150},{19,0,6},{135,11,1735},{12,11,36},{141,11,337},{5,11,598},{7,11,791},{8,
+11,108},{137,11,123},{132,10,469},{7,0,404},{7,0,1377},{7,0,1430},{7,0,2017},{8,
+0,149},{8,0,239},{8,0,512},{8,0,793},{8,0,818},{9,0,474},{9,0,595},{10,0,122},{
+10,0,565},{10,0,649},{10,0,783},{11,0,239},{11,0,295},{11,0,447},{11,0,528},{11,
+0,639},{11,0,800},{12,0,25},{12,0,77},{12,0,157},{12,0,256},{12,0,316},{12,0,390
+},{12,0,391},{12,0,395},{12,0,478},{12,0,503},{12,0,592},{12,0,680},{13,0,50},{
+13,0,53},{13,0,132},{13,0,198},{13,0,322},{13,0,415},{13,0,511},{14,0,71},{14,0,
+395},{15,0,71},{15,0,136},{17,0,123},{18,0,93},{147,0,58},{136,0,712},{134,10,
+1743},{5,10,929},{6,10,340},{8,10,376},{136,10,807},{6,0,1848},{8,0,860},{10,0,
+856},{10,0,859},{10,0,925},{10,0,941},{140,0,762},{6,0,629},{6,0,906},{9,0,810},
+{140,0,652},{5,10,218},{7,10,1610},{138,10,83},{7,10,1512},{135,10,1794},{4,0,
+377},{24,0,13},{4,11,155},{7,11,1689},{11,10,0},{144,10,78},{4,11,164},{5,11,151
+},{5,11,730},{5,11,741},{7,11,498},{7,11,870},{7,11,1542},{12,11,213},{14,11,36}
+,{14,11,391},{17,11,111},{18,11,6},{18,11,46},{18,11,151},{19,11,36},{20,11,32},
+{20,11,56},{20,11,69},{20,11,102},{21,11,4},{22,11,8},{22,11,10},{22,11,14},{150
+,11,31},{7,0,1842},{133,10,571},{4,10,455},{4,11,624},{135,11,1752},{134,0,1501}
+,{4,11,492},{5,11,451},{6,10,161},{7,10,372},{137,10,597},{132,10,349},{4,0,180}
+,{135,0,1906},{135,11,835},{141,11,70},{132,0,491},{137,10,751},{6,10,432},{139,
+10,322},{4,0,171},{138,0,234},{6,11,113},{135,11,436},{4,0,586},{7,0,1186},{138,
+0,631},{5,10,468},{10,10,325},{11,10,856},{12,10,345},{143,10,104},{5,10,223},{
+10,11,592},{10,11,753},{12,11,317},{12,11,355},{12,11,465},{12,11,469},{12,11,
+560},{12,11,578},{141,11,243},{132,10,566},{135,11,520},{4,10,59},{135,10,1394},
+{6,10,436},{139,10,481},{9,0,931},{10,0,334},{20,0,71},{4,10,48},{5,10,271},{7,
+10,953},{135,11,1878},{11,0,170},{5,10,610},{136,10,457},{133,10,755},{6,0,1587}
+,{135,10,1217},{4,10,197},{149,11,26},{133,11,585},{137,11,521},{133,0,765},{133
+,10,217},{139,11,586},{133,0,424},{9,11,752},{12,11,610},{13,11,431},{16,11,59},
+{146,11,109},{136,0,714},{7,0,685},{132,11,307},{9,0,420},{10,0,269},{10,0,285},
+{10,0,576},{11,0,397},{13,0,175},{145,0,90},{132,0,429},{133,11,964},{9,11,463},
+{138,11,595},{7,0,18},{7,0,699},{7,0,1966},{8,0,752},{9,0,273},{9,0,412},{9,0,
+703},{10,0,71},{10,0,427},{138,0,508},{4,10,165},{7,10,1398},{135,10,1829},{4,0,
+53},{5,0,186},{7,0,752},{7,0,828},{142,0,116},{8,0,575},{10,0,289},{139,0,319},{
+132,0,675},{134,0,1424},{4,11,75},{5,11,180},{6,11,500},{7,11,58},{7,11,710},{
+138,11,645},{133,11,649},{6,11,276},{7,11,282},{7,11,879},{7,11,924},{8,11,459},
+{9,11,599},{9,11,754},{11,11,574},{12,11,128},{12,11,494},{13,11,52},{13,11,301}
+,{15,11,30},{143,11,132},{6,0,647},{134,0,1095},{5,10,9},{7,10,297},{7,10,966},{
+140,10,306},{132,11,200},{134,0,1334},{5,10,146},{6,10,411},{138,10,721},{6,0,
+209},{6,0,1141},{6,0,1288},{8,0,468},{9,0,210},{11,0,36},{12,0,28},{12,0,630},{
+13,0,21},{13,0,349},{14,0,7},{145,0,13},{6,10,177},{135,10,467},{4,0,342},{135,0
+,1179},{10,11,454},{140,11,324},{4,0,928},{133,0,910},{7,0,1838},{6,11,225},{137
+,11,211},{16,0,101},{20,0,115},{20,0,118},{148,0,122},{4,0,496},{135,0,856},{4,0
+,318},{11,0,654},{7,11,718},{139,11,102},{8,11,58},{9,11,724},{11,11,809},{13,11
+,113},{145,11,72},{5,10,200},{6,11,345},{135,11,1247},{8,11,767},{8,11,803},{9,
+11,301},{137,11,903},{7,0,915},{8,0,247},{19,0,0},{7,11,1949},{136,11,674},{4,0,
+202},{5,0,382},{6,0,454},{7,0,936},{7,0,1803},{8,0,758},{9,0,375},{9,0,895},{10,
+0,743},{10,0,792},{11,0,978},{11,0,1012},{142,0,109},{7,0,1150},{7,0,1425},{7,0,
+1453},{140,0,513},{134,11,259},{138,0,791},{11,0,821},{12,0,110},{12,0,153},{18,
+0,41},{150,0,19},{134,10,481},{132,0,796},{6,0,445},{9,0,909},{136,11,254},{10,0
+,776},{13,0,345},{142,0,425},{4,10,84},{7,10,1482},{10,10,76},{138,10,142},{135,
+11,742},{6,0,578},{133,10,1015},{6,0,1387},{4,10,315},{5,10,507},{135,10,1370},{
+4,0,438},{133,0,555},{136,0,766},{133,11,248},{134,10,1722},{4,11,116},{5,11,95}
+,{5,11,445},{7,11,1688},{8,11,29},{9,11,272},{11,11,509},{139,11,915},{135,0,541
+},{133,11,543},{8,10,222},{8,10,476},{9,10,238},{11,10,516},{11,10,575},{15,10,
+109},{146,10,100},{6,0,880},{134,0,1191},{5,11,181},{136,11,41},{134,0,1506},{
+132,11,681},{7,11,25},{8,11,202},{138,11,536},{139,0,983},{137,0,768},{132,0,584
+},{9,11,423},{140,11,89},{8,11,113},{9,11,877},{10,11,554},{11,11,83},{12,11,136
+},{147,11,109},{7,10,706},{7,10,1058},{138,10,538},{133,11,976},{4,11,206},{135,
+11,746},{136,11,526},{140,0,737},{11,10,92},{11,10,196},{11,10,409},{11,10,450},
+{11,10,666},{11,10,777},{12,10,262},{13,10,385},{13,10,393},{15,10,115},{16,10,
+45},{145,10,82},{4,0,226},{4,0,326},{7,0,1770},{4,11,319},{5,11,699},{138,11,673
+},{6,10,40},{135,10,1781},{5,0,426},{8,0,30},{9,0,2},{11,0,549},{147,0,122},{6,0
+,1161},{134,0,1329},{138,10,97},{6,10,423},{7,10,665},{135,10,1210},{7,11,13},{8
+,11,226},{10,11,537},{11,11,570},{11,11,605},{11,11,799},{11,11,804},{12,11,85},
+{12,11,516},{12,11,623},{13,11,112},{13,11,361},{14,11,77},{14,11,78},{17,11,28}
+,{147,11,110},{132,11,769},{132,11,551},{132,11,728},{147,0,117},{9,11,57},{9,11
+,459},{10,11,425},{11,11,119},{12,11,184},{12,11,371},{13,11,358},{145,11,51},{5
+,11,188},{5,11,814},{8,11,10},{9,11,421},{9,11,729},{10,11,609},{139,11,689},{
+134,11,624},{135,11,298},{135,0,462},{4,0,345},{139,10,624},{136,10,574},{4,0,
+385},{7,0,265},{135,0,587},{6,0,808},{132,11,528},{133,0,398},{132,10,354},{4,0,
+347},{5,0,423},{5,0,996},{135,0,1329},{135,10,1558},{7,0,1259},{9,0,125},{139,0,
+65},{5,0,136},{6,0,136},{136,0,644},{5,11,104},{6,11,173},{135,11,1631},{135,0,
+469},{133,10,830},{4,0,278},{5,0,465},{135,0,1367},{7,11,810},{8,11,138},{8,11,
+342},{9,11,84},{10,11,193},{11,11,883},{140,11,359},{5,10,496},{135,10,203},{4,0
+,433},{133,0,719},{6,11,95},{134,10,547},{5,10,88},{137,10,239},{6,11,406},{10,
+11,409},{10,11,447},{11,11,44},{140,11,100},{134,0,1423},{7,10,650},{135,10,1310
+},{134,0,749},{135,11,1243},{135,0,1363},{6,0,381},{7,0,645},{7,0,694},{8,0,546}
+,{7,10,1076},{9,10,80},{11,10,78},{11,10,421},{11,10,534},{140,10,545},{134,11,
+1636},{135,11,1344},{12,0,277},{7,10,274},{11,10,479},{139,10,507},{6,0,705},{6,
+0,783},{6,0,1275},{6,0,1481},{4,11,282},{7,11,1034},{11,11,398},{11,11,634},{12,
+11,1},{12,11,79},{12,11,544},{14,11,237},{17,11,10},{146,11,20},{134,0,453},{4,0
+,555},{8,0,536},{10,0,288},{11,0,1005},{4,10,497},{135,10,1584},{5,11,118},{5,11
+,499},{6,11,476},{7,11,600},{7,11,888},{135,11,1096},{138,0,987},{7,0,1107},{7,
+10,261},{7,10,1115},{7,10,1354},{7,10,1588},{7,10,1705},{7,10,1902},{9,10,465},{
+10,10,248},{10,10,349},{10,10,647},{11,10,527},{11,10,660},{11,10,669},{12,10,
+529},{141,10,305},{7,11,296},{7,11,596},{8,11,560},{8,11,586},{9,11,612},{11,11,
+100},{11,11,304},{12,11,46},{13,11,89},{14,11,112},{145,11,122},{9,0,370},{138,0
+,90},{136,10,13},{132,0,860},{7,10,642},{8,10,250},{11,10,123},{11,10,137},{13,
+10,48},{142,10,95},{135,10,1429},{137,11,321},{132,0,257},{135,0,2031},{7,0,1768
+},{7,11,1599},{7,11,1723},{8,11,79},{8,11,106},{8,11,190},{8,11,302},{8,11,383},
+{9,11,119},{9,11,233},{9,11,298},{9,11,419},{9,11,471},{10,11,181},{10,11,406},{
+11,11,57},{11,11,85},{11,11,120},{11,11,177},{11,11,296},{11,11,382},{11,11,454}
+,{11,11,758},{11,11,999},{12,11,27},{12,11,98},{12,11,131},{12,11,245},{12,11,
+312},{12,11,446},{12,11,454},{13,11,25},{13,11,98},{13,11,426},{13,11,508},{14,
+11,6},{14,11,163},{14,11,272},{14,11,277},{14,11,370},{15,11,95},{15,11,138},{15
+,11,167},{17,11,18},{17,11,38},{20,11,96},{149,11,32},{5,11,722},{134,11,1759},{
+145,11,16},{6,0,1071},{134,0,1561},{10,10,545},{140,10,301},{6,0,83},{6,0,1733},
+{135,0,1389},{4,0,835},{135,0,1818},{133,11,258},{4,10,904},{133,10,794},{134,0,
+2006},{5,11,30},{7,11,495},{8,11,134},{9,11,788},{140,11,438},{135,11,2004},{137
+,0,696},{5,11,50},{6,11,439},{7,11,780},{135,11,1040},{7,11,772},{7,11,1104},{7,
+11,1647},{11,11,269},{11,11,539},{11,11,607},{11,11,627},{11,11,706},{11,11,975}
+,{12,11,248},{12,11,311},{12,11,434},{12,11,600},{12,11,622},{13,11,297},{13,11,
+367},{13,11,485},{14,11,69},{14,11,409},{143,11,108},{5,11,1},{6,11,81},{138,11,
+520},{7,0,1718},{9,0,95},{9,0,274},{10,0,279},{10,0,317},{10,0,420},{11,0,303},{
+11,0,808},{12,0,134},{12,0,367},{13,0,149},{13,0,347},{14,0,349},{14,0,406},{18,
+0,22},{18,0,89},{18,0,122},{147,0,47},{5,11,482},{8,11,98},{9,11,172},{10,11,222
+},{10,11,700},{10,11,822},{11,11,302},{11,11,778},{12,11,50},{12,11,127},{12,11,
+396},{13,11,62},{13,11,328},{14,11,122},{147,11,72},{7,10,386},{138,10,713},{6,
+10,7},{6,10,35},{7,10,147},{7,10,1069},{7,10,1568},{7,10,1575},{7,10,1917},{8,10
+,43},{8,10,208},{9,10,128},{9,10,866},{10,10,20},{11,10,981},{147,10,33},{133,0,
+26},{132,0,550},{5,11,2},{7,11,1494},{136,11,589},{6,11,512},{7,11,797},{8,11,
+253},{9,11,77},{10,11,1},{10,11,129},{10,11,225},{11,11,118},{11,11,226},{11,11,
+251},{11,11,430},{11,11,701},{11,11,974},{11,11,982},{12,11,64},{12,11,260},{12,
+11,488},{140,11,690},{7,10,893},{141,10,424},{134,0,901},{136,0,822},{4,0,902},{
+5,0,809},{134,0,122},{6,0,807},{134,0,1366},{7,0,262},{5,11,748},{134,11,553},{
+133,0,620},{4,0,34},{5,0,574},{7,0,279},{7,0,1624},{136,0,601},{9,0,170},{6,10,
+322},{9,10,552},{11,10,274},{13,10,209},{13,10,499},{14,10,85},{15,10,126},{145,
+10,70},{132,0,537},{4,11,12},{7,11,420},{7,11,522},{7,11,809},{8,11,797},{141,11
+,88},{133,0,332},{8,10,83},{8,10,742},{8,10,817},{9,10,28},{9,10,29},{9,10,885},
+{10,10,387},{11,10,633},{11,10,740},{13,10,235},{13,10,254},{15,10,143},{143,10,
+146},{6,0,1909},{9,0,964},{12,0,822},{12,0,854},{12,0,865},{12,0,910},{12,0,938}
+,{15,0,169},{15,0,208},{15,0,211},{18,0,205},{18,0,206},{18,0,220},{18,0,223},{
+152,0,24},{140,10,49},{5,11,528},{135,11,1580},{6,0,261},{8,0,182},{139,0,943},{
+134,0,1721},{4,0,933},{133,0,880},{136,11,321},{5,11,266},{9,11,290},{9,11,364},
+{10,11,293},{11,11,606},{142,11,45},{6,0,1609},{4,11,50},{6,11,510},{6,11,594},{
+9,11,121},{10,11,49},{10,11,412},{139,11,834},{7,0,895},{136,11,748},{132,11,466
+},{4,10,110},{10,10,415},{10,10,597},{142,10,206},{133,0,812},{135,11,281},{6,0,
+1890},{6,0,1902},{6,0,1916},{9,0,929},{9,0,942},{9,0,975},{9,0,984},{9,0,986},{9
+,0,1011},{9,0,1019},{12,0,804},{12,0,851},{12,0,867},{12,0,916},{12,0,923},{15,0
+,194},{15,0,204},{15,0,210},{15,0,222},{15,0,223},{15,0,229},{15,0,250},{18,0,
+179},{18,0,186},{18,0,192},{7,10,205},{135,10,2000},{132,11,667},{135,0,778},{4,
+0,137},{7,0,1178},{135,0,1520},{134,0,1314},{4,11,242},{134,11,333},{6,0,1661},{
+7,0,1975},{7,0,2009},{135,0,2011},{134,0,1591},{4,10,283},{135,10,1194},{11,0,
+820},{150,0,51},{4,11,39},{5,11,36},{7,11,1843},{8,11,407},{11,11,144},{140,11,
+523},{134,10,1720},{4,11,510},{7,11,29},{7,11,66},{7,11,1980},{10,11,487},{10,11
+,809},{146,11,9},{5,0,89},{7,0,1915},{9,0,185},{9,0,235},{10,0,64},{10,0,270},{
+10,0,403},{10,0,469},{10,0,529},{10,0,590},{11,0,140},{11,0,860},{13,0,1},{13,0,
+422},{14,0,341},{14,0,364},{17,0,93},{18,0,113},{19,0,97},{147,0,113},{133,0,695
+},{6,0,987},{134,0,1160},{5,0,6},{6,0,183},{7,0,680},{7,0,978},{7,0,1013},{7,0,
+1055},{12,0,230},{13,0,172},{146,0,29},{134,11,570},{132,11,787},{134,11,518},{6
+,0,29},{139,0,63},{132,11,516},{136,11,821},{132,0,311},{134,0,1740},{7,0,170},{
+8,0,90},{8,0,177},{8,0,415},{11,0,714},{14,0,281},{136,10,735},{134,0,1961},{135
+,11,1405},{4,11,10},{7,11,917},{139,11,786},{5,10,132},{9,10,486},{9,10,715},{10
+,10,458},{11,10,373},{11,10,668},{11,10,795},{11,10,897},{12,10,272},{12,10,424}
+,{12,10,539},{12,10,558},{14,10,245},{14,10,263},{14,10,264},{14,10,393},{142,10
+,403},{11,0,91},{13,0,129},{15,0,101},{145,0,125},{135,0,1132},{4,0,494},{6,0,74
+},{7,0,44},{7,0,407},{12,0,17},{15,0,5},{148,0,11},{133,10,379},{5,0,270},{5,11,
+684},{6,10,89},{6,10,400},{7,10,1569},{7,10,1623},{7,10,1850},{8,10,218},{8,10,
+422},{9,10,570},{138,10,626},{4,0,276},{133,0,296},{6,0,1523},{134,11,27},{6,10,
+387},{7,10,882},{141,10,111},{6,10,224},{7,10,877},{137,10,647},{135,10,790},{4,
+0,7},{5,0,90},{5,0,158},{6,0,542},{7,0,221},{7,0,1574},{9,0,490},{10,0,540},{11,
+0,443},{139,0,757},{7,0,588},{9,0,175},{138,0,530},{135,10,394},{142,11,23},{134
+,0,786},{135,0,580},{7,0,88},{136,0,627},{5,0,872},{6,0,57},{7,0,471},{9,0,447},
+{137,0,454},{6,11,342},{6,11,496},{8,11,275},{137,11,206},{4,11,909},{133,11,940
+},{6,0,735},{132,11,891},{8,0,845},{8,0,916},{135,10,1409},{5,0,31},{134,0,614},
+{11,0,458},{12,0,15},{140,0,432},{8,0,330},{140,0,477},{4,0,530},{5,0,521},{7,0,
+1200},{10,0,460},{132,11,687},{6,0,424},{135,0,1866},{9,0,569},{12,0,12},{12,0,
+81},{12,0,319},{13,0,69},{14,0,259},{16,0,87},{17,0,1},{17,0,21},{17,0,24},{18,0
+,15},{18,0,56},{18,0,59},{18,0,127},{18,0,154},{19,0,19},{148,0,31},{7,0,1302},{
+136,10,38},{134,11,253},{5,10,261},{7,10,78},{7,10,199},{8,10,815},{9,10,126},{
+138,10,342},{5,0,595},{135,0,1863},{6,11,41},{141,11,160},{5,0,13},{134,0,142},{
+6,0,97},{7,0,116},{8,0,322},{8,0,755},{9,0,548},{10,0,714},{11,0,884},{13,0,324}
+,{7,11,1304},{138,11,477},{132,10,628},{134,11,1718},{7,10,266},{136,10,804},{
+135,10,208},{7,0,1021},{6,10,79},{135,10,1519},{7,0,1472},{135,0,1554},{6,11,362
+},{146,11,51},{7,0,1071},{7,0,1541},{7,0,1767},{7,0,1806},{11,0,162},{11,0,242},
+{11,0,452},{12,0,605},{15,0,26},{144,0,44},{136,10,741},{133,11,115},{145,0,115}
+,{134,10,376},{6,0,1406},{134,0,1543},{5,11,193},{12,11,178},{13,11,130},{145,11
+,84},{135,0,1111},{8,0,1},{9,0,650},{10,0,326},{5,11,705},{137,11,606},{5,0,488}
+,{6,0,527},{7,0,489},{7,0,1636},{8,0,121},{8,0,144},{8,0,359},{9,0,193},{9,0,241
+},{9,0,336},{9,0,882},{11,0,266},{11,0,372},{11,0,944},{12,0,401},{140,0,641},{
+135,11,174},{6,0,267},{7,10,244},{7,10,632},{7,10,1609},{8,10,178},{8,10,638},{
+141,10,58},{134,0,1983},{134,0,1155},{134,0,1575},{134,0,1438},{9,0,31},{10,0,
+244},{10,0,699},{12,0,149},{141,0,497},{133,0,377},{4,11,122},{5,11,796},{5,11,
+952},{6,11,1660},{6,11,1671},{8,11,567},{9,11,687},{9,11,742},{10,11,686},{11,11
+,356},{11,11,682},{140,11,281},{145,0,101},{11,11,0},{144,11,78},{5,11,179},{5,
+10,791},{7,11,1095},{135,11,1213},{8,11,372},{9,11,122},{138,11,175},{7,10,686},
+{8,10,33},{8,10,238},{10,10,616},{11,10,467},{11,10,881},{13,10,217},{13,10,253}
+,{142,10,268},{9,0,476},{4,11,66},{7,11,722},{135,11,904},{7,11,352},{137,11,684
+},{135,0,2023},{135,0,1836},{132,10,447},{5,0,843},{144,0,35},{137,11,779},{141,
+11,35},{4,10,128},{5,10,415},{6,10,462},{7,10,294},{7,10,578},{10,10,710},{139,
+10,86},{132,0,554},{133,0,536},{136,10,587},{5,0,207},{9,0,79},{11,0,625},{145,0
+,7},{7,0,1371},{6,10,427},{138,10,692},{4,0,424},{4,10,195},{135,10,802},{8,0,
+785},{133,11,564},{135,0,336},{4,0,896},{6,0,1777},{134,11,556},{137,11,103},{
+134,10,1683},{7,11,544},{8,11,719},{138,11,61},{138,10,472},{4,11,5},{5,11,498},
+{136,11,637},{7,0,750},{9,0,223},{11,0,27},{11,0,466},{12,0,624},{14,0,265},{146
+,0,61},{12,0,238},{18,0,155},{12,11,238},{146,11,155},{151,10,28},{133,11,927},{
+12,0,383},{5,10,3},{8,10,578},{9,10,118},{10,10,705},{141,10,279},{4,11,893},{5,
+11,780},{133,11,893},{4,0,603},{133,0,661},{4,0,11},{6,0,128},{7,0,231},{7,0,
+1533},{10,0,725},{5,10,229},{5,11,238},{135,11,1350},{8,10,102},{10,10,578},{10,
+10,672},{12,10,496},{13,10,408},{14,10,121},{145,10,106},{132,0,476},{134,0,1552
+},{134,11,1729},{8,10,115},{8,10,350},{9,10,489},{10,10,128},{11,10,306},{12,10,
+373},{14,10,30},{17,10,79},{19,10,80},{150,10,55},{135,0,1807},{4,0,680},{4,11,
+60},{7,11,760},{7,11,1800},{8,11,314},{9,11,700},{139,11,487},{4,10,230},{5,10,
+702},{148,11,94},{132,11,228},{139,0,435},{9,0,20},{10,0,324},{10,0,807},{139,0,
+488},{6,10,1728},{136,11,419},{4,10,484},{18,10,26},{19,10,42},{20,10,43},{21,10
+,0},{23,10,27},{152,10,14},{135,0,1431},{133,11,828},{5,0,112},{6,0,103},{6,0,
+150},{7,0,1303},{9,0,292},{10,0,481},{20,0,13},{7,11,176},{7,11,178},{7,11,1110}
+,{10,11,481},{148,11,13},{138,0,356},{4,11,51},{5,11,39},{6,11,4},{7,11,591},{7,
+11,849},{7,11,951},{7,11,1129},{7,11,1613},{7,11,1760},{7,11,1988},{9,11,434},{
+10,11,754},{11,11,25},{11,11,37},{139,11,414},{6,0,1963},{134,0,2000},{132,10,
+633},{6,0,1244},{133,11,902},{135,11,928},{140,0,18},{138,0,204},{135,11,1173},{
+134,0,867},{4,0,708},{8,0,15},{9,0,50},{9,0,386},{11,0,18},{11,0,529},{140,0,228
+},{134,11,270},{4,0,563},{7,0,109},{7,0,592},{7,0,637},{7,0,770},{8,0,463},{9,0,
+60},{9,0,335},{9,0,904},{10,0,73},{11,0,434},{12,0,585},{13,0,331},{18,0,110},{
+148,0,60},{132,0,502},{14,11,359},{19,11,52},{148,11,47},{6,11,377},{7,11,1025},
+{9,11,613},{145,11,104},{6,0,347},{10,0,161},{5,10,70},{5,10,622},{6,10,334},{7,
+10,1032},{9,10,171},{11,10,26},{11,10,213},{11,10,637},{11,10,707},{12,10,202},{
+12,10,380},{13,10,226},{13,10,355},{14,10,222},{145,10,42},{132,11,416},{4,0,33}
+,{5,0,102},{6,0,284},{7,0,1079},{7,0,1423},{7,0,1702},{8,0,470},{9,0,554},{9,0,
+723},{11,0,333},{142,11,372},{5,11,152},{5,11,197},{7,11,340},{7,11,867},{10,11,
+548},{10,11,581},{11,11,6},{12,11,3},{12,11,19},{14,11,110},{142,11,289},{7,0,
+246},{135,0,840},{6,0,10},{8,0,571},{9,0,739},{143,0,91},{6,0,465},{7,0,1465},{4
+,10,23},{4,10,141},{5,10,313},{5,10,1014},{6,10,50},{7,10,142},{7,10,559},{8,10,
+640},{9,10,460},{9,10,783},{11,10,741},{12,10,183},{141,10,488},{133,0,626},{136
+,0,614},{138,0,237},{7,11,34},{7,11,190},{8,11,28},{8,11,141},{8,11,444},{8,11,
+811},{9,11,468},{11,11,334},{12,11,24},{12,11,386},{140,11,576},{133,11,757},{5,
+0,18},{6,0,526},{13,0,24},{13,0,110},{19,0,5},{147,0,44},{6,0,506},{134,11,506},
+{135,11,1553},{4,0,309},{5,0,462},{7,0,970},{7,0,1097},{22,0,30},{22,0,33},{7,11
+,1385},{11,11,582},{11,11,650},{11,11,901},{11,11,949},{12,11,232},{12,11,236},{
+13,11,413},{13,11,501},{146,11,116},{9,0,140},{5,10,222},{138,10,534},{6,0,1056}
+,{137,10,906},{134,0,1704},{138,10,503},{134,0,1036},{5,10,154},{7,10,1491},{10,
+10,379},{138,10,485},{4,11,383},{133,10,716},{134,0,1315},{5,0,86},{7,0,743},{9,
+0,85},{10,0,281},{10,0,432},{11,0,825},{12,0,251},{13,0,118},{142,0,378},{8,0,
+264},{4,10,91},{5,10,388},{5,10,845},{6,10,206},{6,10,252},{6,10,365},{7,10,136}
+,{7,10,531},{136,10,621},{5,0,524},{133,0,744},{5,11,277},{141,11,247},{132,11,
+435},{10,0,107},{140,0,436},{132,0,927},{10,0,123},{12,0,670},{146,0,94},{7,0,
+1149},{9,0,156},{138,0,957},{5,11,265},{6,11,212},{135,11,28},{133,0,778},{133,0
+,502},{8,0,196},{10,0,283},{139,0,406},{135,10,576},{136,11,535},{134,0,1312},{5
+,10,771},{5,10,863},{5,10,898},{6,10,1632},{6,10,1644},{134,10,1780},{5,0,855},{
+5,10,331},{135,11,1487},{132,11,702},{5,11,808},{135,11,2045},{7,0,1400},{9,0,
+446},{138,0,45},{140,10,632},{132,0,1003},{5,11,166},{8,11,739},{140,11,511},{5,
+10,107},{7,10,201},{136,10,518},{6,10,446},{135,10,1817},{134,0,1532},{134,0,
+1097},{4,11,119},{5,11,170},{5,11,447},{7,11,1708},{7,11,1889},{9,11,357},{9,11,
+719},{12,11,486},{140,11,596},{9,10,851},{141,10,510},{7,0,612},{8,0,545},{8,0,
+568},{8,0,642},{9,0,717},{10,0,541},{10,0,763},{11,0,449},{12,0,489},{13,0,153},
+{13,0,296},{14,0,138},{14,0,392},{15,0,50},{16,0,6},{16,0,12},{20,0,9},{132,10,
+504},{4,11,450},{135,11,1158},{11,0,54},{13,0,173},{13,0,294},{5,10,883},{5,10,
+975},{8,10,392},{148,10,7},{13,0,455},{15,0,99},{15,0,129},{144,0,68},{135,0,172
+},{132,11,754},{5,10,922},{134,10,1707},{134,0,1029},{17,11,39},{148,11,36},{4,0
+,568},{5,10,993},{7,10,515},{137,10,91},{132,0,732},{10,0,617},{138,11,617},{134
+,0,974},{7,0,989},{10,0,377},{12,0,363},{13,0,68},{13,0,94},{14,0,108},{142,0,
+306},{136,0,733},{132,0,428},{7,0,1789},{135,11,1062},{7,0,2015},{140,0,665},{
+135,10,1433},{5,0,287},{7,10,921},{8,10,580},{8,10,593},{8,10,630},{138,10,28},{
+138,0,806},{4,10,911},{5,10,867},{5,10,1013},{7,10,2034},{8,10,798},{136,10,813}
+,{134,0,1539},{8,11,523},{150,11,34},{135,11,740},{7,11,238},{7,11,2033},{8,11,
+120},{8,11,188},{8,11,659},{9,11,598},{10,11,466},{12,11,342},{12,11,588},{13,11
+,503},{14,11,246},{143,11,92},{7,0,1563},{141,0,182},{5,10,135},{6,10,519},{7,10
+,1722},{10,10,271},{11,10,261},{145,10,54},{14,10,338},{148,10,81},{7,0,484},{4,
+10,300},{133,10,436},{145,11,114},{6,0,1623},{134,0,1681},{133,11,640},{4,11,201
+},{7,11,1744},{8,11,602},{11,11,247},{11,11,826},{145,11,65},{8,11,164},{146,11,
+62},{6,0,1833},{6,0,1861},{136,0,878},{134,0,1569},{8,10,357},{10,10,745},{14,10
+,426},{17,10,94},{147,10,57},{12,0,93},{12,0,501},{13,0,362},{14,0,151},{15,0,40
+},{15,0,59},{16,0,46},{17,0,25},{18,0,14},{18,0,134},{19,0,25},{19,0,69},{20,0,
+16},{20,0,19},{20,0,66},{21,0,23},{21,0,25},{150,0,42},{6,0,1748},{8,0,715},{9,0
+,802},{10,0,46},{10,0,819},{13,0,308},{14,0,351},{14,0,363},{146,0,67},{132,0,
+994},{4,0,63},{133,0,347},{132,0,591},{133,0,749},{7,11,1577},{10,11,304},{10,11
+,549},{11,11,424},{12,11,365},{13,11,220},{13,11,240},{142,11,33},{133,0,366},{7
+,0,557},{12,0,547},{14,0,86},{133,10,387},{135,0,1747},{132,11,907},{5,11,100},{
+10,11,329},{12,11,416},{149,11,29},{4,10,6},{5,10,708},{136,10,75},{7,10,1351},{
+9,10,581},{10,10,639},{11,10,453},{140,10,584},{7,0,89},{132,10,303},{138,10,772
+},{132,11,176},{5,11,636},{5,11,998},{8,11,26},{137,11,358},{7,11,9},{7,11,1508}
+,{9,11,317},{10,11,210},{10,11,292},{10,11,533},{11,11,555},{12,11,526},{12,11,
+607},{13,11,263},{13,11,459},{142,11,271},{134,0,1463},{6,0,772},{6,0,1137},{139
+,11,595},{7,0,977},{139,11,66},{138,0,893},{20,0,48},{148,11,48},{5,0,824},{133,
+0,941},{134,11,295},{7,0,1543},{7,0,1785},{10,0,690},{4,10,106},{139,10,717},{7,
+0,440},{8,0,230},{139,0,106},{5,10,890},{133,10,988},{6,10,626},{142,10,431},{10
+,11,127},{141,11,27},{17,0,32},{10,10,706},{150,10,44},{132,0,216},{137,0,332},{
+4,10,698},{136,11,119},{139,11,267},{138,10,17},{11,11,526},{11,11,939},{141,11,
+290},{7,11,1167},{11,11,934},{13,11,391},{145,11,76},{139,11,39},{134,10,84},{4,
+0,914},{5,0,800},{133,0,852},{10,0,416},{141,0,115},{7,0,564},{142,0,168},{4,0,
+918},{133,0,876},{134,0,1764},{152,0,3},{4,0,92},{5,0,274},{7,11,126},{136,11,84
+},{140,10,498},{136,11,790},{8,0,501},{5,10,986},{6,10,130},{7,10,1582},{8,10,
+458},{10,10,101},{10,10,318},{138,10,823},{6,11,64},{12,11,377},{141,11,309},{5,
+0,743},{138,0,851},{4,0,49},{7,0,280},{135,0,1633},{134,0,879},{136,0,47},{7,10,
+1644},{137,10,129},{132,0,865},{134,0,1202},{9,11,34},{139,11,484},{135,10,997},
+{5,0,272},{5,0,908},{5,0,942},{8,0,197},{9,0,47},{11,0,538},{139,0,742},{6,11,
+1700},{7,11,26},{7,11,293},{7,11,382},{7,11,1026},{7,11,1087},{7,11,2027},{8,11,
+24},{8,11,114},{8,11,252},{8,11,727},{8,11,729},{9,11,30},{9,11,199},{9,11,231},
+{9,11,251},{9,11,334},{9,11,361},{9,11,488},{9,11,712},{10,11,55},{10,11,60},{10
+,11,232},{10,11,332},{10,11,384},{10,11,396},{10,11,504},{10,11,542},{10,11,652}
+,{11,11,20},{11,11,48},{11,11,207},{11,11,291},{11,11,298},{11,11,342},{11,11,
+365},{11,11,394},{11,11,620},{11,11,705},{11,11,1017},{12,11,123},{12,11,340},{
+12,11,406},{12,11,643},{13,11,61},{13,11,269},{13,11,311},{13,11,319},{13,11,486
+},{14,11,234},{15,11,62},{15,11,85},{16,11,71},{18,11,119},{148,11,105},{6,0,
+1455},{150,11,37},{135,10,1927},{135,0,1911},{137,0,891},{7,10,1756},{137,10,98}
+,{7,10,1046},{139,10,160},{132,0,761},{6,11,379},{7,11,270},{7,11,1116},{8,11,
+176},{8,11,183},{9,11,432},{9,11,661},{12,11,247},{12,11,617},{146,11,125},{6,10
+,45},{7,10,433},{8,10,129},{9,10,21},{10,10,392},{11,10,79},{12,10,499},{13,10,
+199},{141,10,451},{4,0,407},{5,11,792},{133,11,900},{132,0,560},{135,0,183},{13,
+0,490},{7,10,558},{136,10,353},{4,0,475},{6,0,731},{11,0,35},{13,0,71},{13,0,177
+},{14,0,422},{133,10,785},{8,10,81},{9,10,189},{9,10,201},{11,10,478},{11,10,712
+},{141,10,338},{4,0,418},{4,0,819},{133,10,353},{151,10,26},{4,11,901},{133,11,
+776},{132,0,575},{7,0,818},{16,0,92},{17,0,14},{17,0,45},{18,0,75},{148,0,18},{6
+,0,222},{7,0,636},{7,0,1620},{8,0,409},{9,0,693},{139,0,77},{6,10,25},{7,10,855}
+,{7,10,1258},{144,10,32},{6,0,1880},{6,0,1887},{6,0,1918},{6,0,1924},{9,0,967},{
+9,0,995},{9,0,1015},{12,0,826},{12,0,849},{12,0,857},{12,0,860},{12,0,886},{12,0
+,932},{18,0,228},{18,0,231},{146,0,240},{134,0,633},{134,0,1308},{4,11,37},{5,11
+,334},{135,11,1253},{10,0,86},{4,10,4},{7,10,1118},{7,10,1320},{7,10,1706},{8,10
+,277},{9,10,622},{11,10,724},{12,10,350},{12,10,397},{13,10,28},{13,10,159},{15,
+10,89},{18,10,5},{19,10,9},{20,10,34},{150,10,47},{132,11,508},{137,11,448},{12,
+11,107},{146,11,31},{132,0,817},{134,0,663},{133,0,882},{134,0,914},{132,11,540}
+,{132,11,533},{136,11,608},{8,0,885},{138,0,865},{132,0,426},{6,0,58},{7,0,745},
+{7,0,1969},{8,0,399},{8,0,675},{9,0,479},{9,0,731},{10,0,330},{10,0,593},{10,0,
+817},{11,0,32},{11,0,133},{11,0,221},{145,0,68},{134,10,255},{7,0,102},{137,0,
+538},{137,10,216},{7,11,253},{136,11,549},{135,11,912},{9,10,183},{139,10,286},{
+11,10,956},{151,10,3},{8,11,527},{18,11,60},{147,11,24},{4,10,536},{7,10,1141},{
+10,10,723},{139,10,371},{133,11,920},{7,0,876},{135,10,285},{135,10,560},{132,10
+,690},{142,11,126},{11,10,33},{12,10,571},{149,10,1},{133,0,566},{9,0,139},{10,0
+,399},{11,0,469},{12,0,634},{13,0,223},{132,11,483},{6,0,48},{135,0,63},{18,0,12
+},{7,10,1862},{12,10,491},{12,10,520},{13,10,383},{142,10,244},{135,11,1665},{
+132,11,448},{9,11,495},{146,11,104},{6,0,114},{7,0,1224},{7,0,1556},{136,0,3},{4
+,10,190},{133,10,554},{8,0,576},{9,0,267},{133,10,1001},{133,10,446},{133,0,933}
+,{139,11,1009},{8,11,653},{13,11,93},{147,11,14},{6,0,692},{6,0,821},{134,0,1077
+},{5,11,172},{135,11,801},{138,0,752},{4,0,375},{134,0,638},{134,0,1011},{140,11
+,540},{9,0,96},{133,11,260},{139,11,587},{135,10,1231},{12,0,30},{13,0,148},{14,
+0,87},{14,0,182},{16,0,42},{20,0,70},{132,10,304},{6,0,1398},{7,0,56},{7,0,1989}
+,{8,0,337},{8,0,738},{9,0,600},{12,0,37},{13,0,447},{142,0,92},{138,0,666},{5,0,
+394},{7,0,487},{136,0,246},{9,0,437},{6,10,53},{6,10,199},{7,10,1408},{8,10,32},
+{8,10,93},{10,10,397},{10,10,629},{11,10,593},{11,10,763},{13,10,326},{145,10,35
+},{134,10,105},{9,0,320},{10,0,506},{138,10,794},{7,11,57},{8,11,167},{8,11,375}
+,{9,11,82},{9,11,561},{10,11,620},{10,11,770},{11,10,704},{141,10,396},{6,0,1003
+},{5,10,114},{5,10,255},{141,10,285},{7,0,866},{135,0,1163},{133,11,531},{132,0,
+328},{7,10,2035},{8,10,19},{9,10,89},{138,10,831},{8,11,194},{136,11,756},{136,0
+,1000},{5,11,453},{134,11,441},{4,0,101},{5,0,833},{7,0,1171},{136,0,744},{133,0
+,726},{136,10,746},{138,0,176},{6,0,9},{6,0,397},{7,0,53},{7,0,1742},{10,0,632},
+{11,0,828},{140,0,146},{135,11,22},{145,11,64},{132,0,839},{11,0,417},{12,0,223}
+,{140,0,265},{4,11,102},{7,11,815},{7,11,1699},{139,11,964},{5,10,955},{136,10,
+814},{6,0,1931},{6,0,2007},{18,0,246},{146,0,247},{8,0,198},{11,0,29},{140,0,534
+},{135,0,1771},{6,0,846},{7,11,1010},{11,11,733},{11,11,759},{12,11,563},{13,11,
+34},{14,11,101},{18,11,45},{146,11,129},{4,0,186},{5,0,157},{8,0,168},{138,0,6},
+{132,11,899},{133,10,56},{148,10,100},{133,0,875},{5,0,773},{5,0,991},{6,0,1635}
+,{134,0,1788},{6,0,1274},{9,0,477},{141,0,78},{4,0,639},{7,0,111},{8,0,581},{12,
+0,177},{6,11,52},{9,11,104},{9,11,559},{10,10,4},{10,10,13},{11,10,638},{12,11,
+308},{19,11,87},{148,10,57},{132,11,604},{4,11,301},{133,10,738},{133,10,758},{
+134,0,1747},{7,11,1440},{11,11,854},{11,11,872},{11,11,921},{12,11,551},{13,11,
+472},{142,11,367},{7,0,1364},{7,0,1907},{141,0,158},{134,0,873},{4,0,404},{4,0,
+659},{7,0,552},{135,0,675},{135,10,1112},{139,10,328},{7,11,508},{137,10,133},{
+133,0,391},{5,10,110},{6,10,169},{6,10,1702},{7,10,400},{8,10,538},{9,10,184},{9
+,10,524},{140,10,218},{6,11,310},{7,11,1849},{8,11,72},{8,11,272},{8,11,431},{9,
+11,12},{9,11,351},{10,11,563},{10,11,630},{10,11,810},{11,11,367},{11,11,599},{
+11,11,686},{140,11,672},{5,0,540},{6,0,1697},{136,0,668},{132,0,883},{134,0,78},
+{12,0,628},{18,0,79},{6,10,133},{9,10,353},{139,10,993},{6,11,181},{7,11,537},{8
+,11,64},{9,11,127},{10,11,496},{12,11,510},{141,11,384},{6,10,93},{7,10,1422},{7
+,10,1851},{8,10,673},{9,10,529},{140,10,43},{137,10,371},{134,0,1460},{134,0,962
+},{4,11,244},{135,11,233},{9,10,25},{10,10,467},{138,10,559},{4,10,335},{135,10,
+942},{133,0,460},{135,11,334},{134,11,1650},{4,0,199},{139,0,34},{5,10,601},{8,
+10,39},{10,10,773},{11,10,84},{12,10,205},{142,10,1},{133,10,870},{134,0,388},{
+14,0,474},{148,0,120},{133,11,369},{139,0,271},{4,0,511},{9,0,333},{9,0,379},{10
+,0,602},{11,0,441},{11,0,723},{11,0,976},{12,0,357},{132,10,181},{134,0,608},{
+134,10,1652},{22,0,49},{137,11,338},{140,0,988},{134,0,617},{5,0,938},{136,0,707
+},{132,10,97},{5,10,147},{6,10,286},{7,10,1362},{141,10,176},{6,0,756},{134,0,
+1149},{133,11,896},{6,10,375},{7,10,169},{7,10,254},{136,10,780},{134,0,1583},{
+135,10,1447},{139,0,285},{7,11,1117},{8,11,393},{136,11,539},{135,0,344},{6,0,
+469},{7,0,1709},{138,0,515},{5,10,629},{135,10,1549},{5,11,4},{5,11,810},{6,11,
+13},{6,11,538},{6,11,1690},{6,11,1726},{7,11,499},{7,11,1819},{8,11,148},{8,11,
+696},{8,11,791},{12,11,125},{13,11,54},{143,11,9},{135,11,1268},{137,0,404},{132
+,0,500},{5,0,68},{134,0,383},{11,0,216},{139,0,340},{4,11,925},{5,11,803},{8,11,
+698},{138,11,828},{4,0,337},{6,0,353},{7,0,1934},{8,0,488},{137,0,429},{7,0,236}
+,{7,0,1795},{8,0,259},{9,0,135},{9,0,177},{9,0,860},{10,0,825},{11,0,115},{11,0,
+370},{11,0,405},{11,0,604},{12,0,10},{12,0,667},{12,0,669},{13,0,76},{14,0,310},
+{15,0,76},{15,0,147},{148,0,23},{4,0,15},{4,0,490},{5,0,22},{6,0,244},{7,0,40},{
+7,0,200},{7,0,906},{7,0,1199},{9,0,616},{10,0,716},{11,0,635},{11,0,801},{140,0,
+458},{12,0,756},{132,10,420},{134,0,1504},{6,0,757},{133,11,383},{6,0,1266},{135
+,0,1735},{5,0,598},{7,0,791},{8,0,108},{9,0,123},{7,10,1570},{140,10,542},{142,
+11,410},{9,11,660},{138,11,347}
+};
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_STATIC_DICT_LUT_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/utf8_util.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/utf8_util.c
new file mode 100644
index 000000000..04a780516
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/utf8_util.c
@@ -0,0 +1,85 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Heuristics for deciding about the UTF8-ness of strings. */
+
+#include "./utf8_util.h"
+
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+static size_t BrotliParseAsUTF8(
+ int* symbol, const uint8_t* input, size_t size) {
+ /* ASCII */
+ if ((input[0] & 0x80) == 0) {
+ *symbol = input[0];
+ if (*symbol > 0) {
+ return 1;
+ }
+ }
+ /* 2-byte UTF8 */
+ if (size > 1u &&
+ (input[0] & 0xE0) == 0xC0 &&
+ (input[1] & 0xC0) == 0x80) {
+ *symbol = (((input[0] & 0x1F) << 6) |
+ (input[1] & 0x3F));
+ if (*symbol > 0x7F) {
+ return 2;
+ }
+ }
+ /* 3-byte UFT8 */
+ if (size > 2u &&
+ (input[0] & 0xF0) == 0xE0 &&
+ (input[1] & 0xC0) == 0x80 &&
+ (input[2] & 0xC0) == 0x80) {
+ *symbol = (((input[0] & 0x0F) << 12) |
+ ((input[1] & 0x3F) << 6) |
+ (input[2] & 0x3F));
+ if (*symbol > 0x7FF) {
+ return 3;
+ }
+ }
+ /* 4-byte UFT8 */
+ if (size > 3u &&
+ (input[0] & 0xF8) == 0xF0 &&
+ (input[1] & 0xC0) == 0x80 &&
+ (input[2] & 0xC0) == 0x80 &&
+ (input[3] & 0xC0) == 0x80) {
+ *symbol = (((input[0] & 0x07) << 18) |
+ ((input[1] & 0x3F) << 12) |
+ ((input[2] & 0x3F) << 6) |
+ (input[3] & 0x3F));
+ if (*symbol > 0xFFFF && *symbol <= 0x10FFFF) {
+ return 4;
+ }
+ }
+ /* Not UTF8, emit a special symbol above the UTF8-code space */
+ *symbol = 0x110000 | input[0];
+ return 1;
+}
+
+/* Returns 1 if at least min_fraction of the data is UTF8-encoded.*/
+BROTLI_BOOL BrotliIsMostlyUTF8(
+ const uint8_t* data, const size_t pos, const size_t mask,
+ const size_t length, const double min_fraction) {
+ size_t size_utf8 = 0;
+ size_t i = 0;
+ while (i < length) {
+ int symbol;
+ size_t bytes_read =
+ BrotliParseAsUTF8(&symbol, &data[(pos + i) & mask], length - i);
+ i += bytes_read;
+ if (symbol < 0x110000) size_utf8 += bytes_read;
+ }
+ return TO_BROTLI_BOOL(size_utf8 > min_fraction * (double)length);
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/utf8_util.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/utf8_util.h
new file mode 100644
index 000000000..8fda80c22
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/utf8_util.h
@@ -0,0 +1,32 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Heuristics for deciding about the UTF8-ness of strings. */
+
+#ifndef BROTLI_ENC_UTF8_UTIL_H_
+#define BROTLI_ENC_UTF8_UTIL_H_
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+static const double kMinUTF8Ratio = 0.75;
+
+/* Returns 1 if at least min_fraction of the bytes between pos and
+ pos + length in the (data, mask) ring-buffer is UTF8-encoded, otherwise
+ returns 0. */
+BROTLI_INTERNAL BROTLI_BOOL BrotliIsMostlyUTF8(
+ const uint8_t* data, const size_t pos, const size_t mask,
+ const size_t length, const double min_fraction);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_UTF8_UTIL_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/write_bits.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/write_bits.h
new file mode 100644
index 000000000..f6f88b45b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/enc/write_bits.h
@@ -0,0 +1,87 @@
+/* Copyright 2010 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Write bits into a byte array. */
+
+#ifndef BROTLI_ENC_WRITE_BITS_H_
+#define BROTLI_ENC_WRITE_BITS_H_
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* This function writes bits into bytes in increasing addresses, and within
+ a byte least-significant-bit first.
+
+ The function can write up to 56 bits in one go with WriteBits
+ Example: let's assume that 3 bits (Rs below) have been written already:
+
+ BYTE-0 BYTE+1 BYTE+2
+
+ 0000 0RRR 0000 0000 0000 0000
+
+ Now, we could write 5 or less bits in MSB by just shifting by 3
+ and OR'ing to BYTE-0.
+
+ For n bits, we take the last 5 bits, OR that with high bits in BYTE-0,
+ and locate the rest in BYTE+1, BYTE+2, etc. */
+static BROTLI_INLINE void BrotliWriteBits(size_t n_bits,
+ uint64_t bits,
+ size_t* BROTLI_RESTRICT pos,
+ uint8_t* BROTLI_RESTRICT array) {
+ BROTLI_LOG(("WriteBits %2d 0x%08x%08x %10d\n", (int)n_bits,
+ (uint32_t)(bits >> 32), (uint32_t)(bits & 0xFFFFFFFF),
+ (int)*pos));
+ BROTLI_DCHECK((bits >> n_bits) == 0);
+ BROTLI_DCHECK(n_bits <= 56);
+#if defined(BROTLI_LITTLE_ENDIAN)
+ /* This branch of the code can write up to 56 bits at a time,
+ 7 bits are lost by being perhaps already in *p and at least
+ 1 bit is needed to initialize the bit-stream ahead (i.e. if 7
+ bits are in *p and we write 57 bits, then the next write will
+ access a byte that was never initialized). */
+ {
+ uint8_t* p = &array[*pos >> 3];
+ uint64_t v = (uint64_t)(*p); /* Zero-extend 8 to 64 bits. */
+ v |= bits << (*pos & 7);
+ BROTLI_UNALIGNED_STORE64LE(p, v); /* Set some bits. */
+ *pos += n_bits;
+ }
+#else
+ /* implicit & 0xFF is assumed for uint8_t arithmetics */
+ {
+ uint8_t* array_pos = &array[*pos >> 3];
+ const size_t bits_reserved_in_first_byte = (*pos & 7);
+ size_t bits_left_to_write;
+ bits <<= bits_reserved_in_first_byte;
+ *array_pos++ |= (uint8_t)bits;
+ for (bits_left_to_write = n_bits + bits_reserved_in_first_byte;
+ bits_left_to_write >= 9;
+ bits_left_to_write -= 8) {
+ bits >>= 8;
+ *array_pos++ = (uint8_t)bits;
+ }
+ *array_pos = 0;
+ *pos += n_bits;
+ }
+#endif
+}
+
+static BROTLI_INLINE void BrotliWriteBitsPrepareStorage(
+ size_t pos, uint8_t* array) {
+ BROTLI_LOG(("WriteBitsPrepareStorage %10d\n", (int)pos));
+ BROTLI_DCHECK((pos & 7) == 0);
+ array[pos >> 3] = 0;
+}
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_WRITE_BITS_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/fuzz/decode_fuzzer.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/fuzz/decode_fuzzer.c
new file mode 100644
index 000000000..46144e07e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/fuzz/decode_fuzzer.c
@@ -0,0 +1,58 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <brotli/decode.h>
+
+// Entry point for LibFuzzer.
+int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ size_t addend = 0;
+ if (size > 0)
+ addend = data[size - 1] & 7;
+ const uint8_t* next_in = data;
+
+ const int kBufferSize = 1024;
+ uint8_t* buffer = (uint8_t*) malloc(kBufferSize);
+ if (!buffer) {
+ // OOM is out-of-scope here.
+ return 0;
+ }
+ /* The biggest "magic number" in brotli is 16MiB - 16, so no need to check
+ the cases with much longer output. */
+ const size_t total_out_limit = (addend == 0) ? (1 << 26) : (1 << 24);
+ size_t total_out = 0;
+
+ BrotliDecoderState* state = BrotliDecoderCreateInstance(0, 0, 0);
+
+ if (addend == 0)
+ addend = size;
+ /* Test both fast (addend == size) and slow (addend <= 7) decoding paths. */
+ for (size_t i = 0; i < size;) {
+ size_t next_i = i + addend;
+ if (next_i > size)
+ next_i = size;
+ size_t avail_in = next_i - i;
+ i = next_i;
+ BrotliDecoderResult result = BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT;
+ while (result == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {
+ size_t avail_out = kBufferSize;
+ uint8_t* next_out = buffer;
+ result = BrotliDecoderDecompressStream(
+ state, &avail_in, &next_in, &avail_out, &next_out, &total_out);
+ if (total_out > total_out_limit)
+ break;
+ }
+ if (total_out > total_out_limit)
+ break;
+ if (result != BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT)
+ break;
+ }
+
+ BrotliDecoderDestroyInstance(state);
+ free(buffer);
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/fuzz/run_decode_fuzzer.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/fuzz/run_decode_fuzzer.c
new file mode 100644
index 000000000..c84f98a32
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/fuzz/run_decode_fuzzer.c
@@ -0,0 +1,44 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Simple runner for decode_fuzzer.cc */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+void LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
+
+int main(int argc, char* *argv) {
+ if (argc != 2) {
+ fprintf(stderr, "Exactly one argument is expected.\n");
+ exit(EXIT_FAILURE);
+ }
+
+ FILE* f = fopen(argv[1], "r");
+ if (!f) {
+ fprintf(stderr, "Failed to open input file.");
+ exit(EXIT_FAILURE);
+ }
+
+ size_t max_len = 1 << 20;
+ unsigned char* tmp = (unsigned char*)malloc(max_len);
+ size_t len = fread(tmp, 1, max_len, f);
+ if (ferror(f)) {
+ fclose(f);
+ fprintf(stderr, "Failed read input file.");
+ exit(EXIT_FAILURE);
+ }
+ /* Make data after the end "inaccessible". */
+ unsigned char* data = (unsigned char*)malloc(len);
+ memcpy(data, tmp, len);
+ free(tmp);
+
+ LLVMFuzzerTestOneInput(data, len);
+ free(data);
+ exit(EXIT_SUCCESS);
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/fuzz/test_fuzzer.sh b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/fuzz/test_fuzzer.sh
new file mode 100755
index 000000000..9985194a1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/fuzz/test_fuzzer.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+set -e
+
+export CC=${CC:-cc}
+
+BROTLI="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
+SRC=$BROTLI/c
+
+cd $BROTLI
+
+rm -rf bin
+mkdir bin
+cd bin
+
+cmake $BROTLI -DCMAKE_C_COMPILER="$CC" \
+ -DBUILD_TESTING=OFF -DENABLE_SANITIZER=address
+make -j$(nproc) brotlidec-static
+
+${CC} -o run_decode_fuzzer -std=c99 -fsanitize=address -I$SRC/include \
+ $SRC/fuzz/decode_fuzzer.c $SRC/fuzz/run_decode_fuzzer.c \
+ ./libbrotlidec-static.a ./libbrotlicommon-static.a
+
+mkdir decode_corpora
+unzip $BROTLI/java/org/brotli/integration/fuzz_data.zip -d decode_corpora
+
+for f in `ls decode_corpora`
+do
+ echo "Testing $f"
+ ./run_decode_fuzzer decode_corpora/$f
+done
+
+cd $BROTLI
+rm -rf bin
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/decode.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/decode.h
new file mode 100644
index 000000000..0f5c8f9d1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/decode.h
@@ -0,0 +1,344 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/**
+ * @file
+ * API for Brotli decompression.
+ */
+
+#ifndef BROTLI_DEC_DECODE_H_
+#define BROTLI_DEC_DECODE_H_
+
+#include <brotli/port.h>
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/**
+ * Opaque structure that holds decoder state.
+ *
+ * Allocated and initialized with ::BrotliDecoderCreateInstance.
+ * Cleaned up and deallocated with ::BrotliDecoderDestroyInstance.
+ */
+typedef struct BrotliDecoderStateStruct BrotliDecoderState;
+
+/**
+ * Result type for ::BrotliDecoderDecompress and
+ * ::BrotliDecoderDecompressStream functions.
+ */
+typedef enum {
+ /** Decoding error, e.g. corrupted input or memory allocation problem. */
+ BROTLI_DECODER_RESULT_ERROR = 0,
+ /** Decoding successfully completed. */
+ BROTLI_DECODER_RESULT_SUCCESS = 1,
+ /** Partially done; should be called again with more input. */
+ BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT = 2,
+ /** Partially done; should be called again with more output. */
+ BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT = 3
+} BrotliDecoderResult;
+
+/**
+ * Template that evaluates items of ::BrotliDecoderErrorCode.
+ *
+ * Example: @code {.cpp}
+ * // Log Brotli error code.
+ * switch (brotliDecoderErrorCode) {
+ * #define CASE_(PREFIX, NAME, CODE) \
+ * case BROTLI_DECODER ## PREFIX ## NAME: \
+ * LOG(INFO) << "error code:" << #NAME; \
+ * break;
+ * #define NEWLINE_
+ * BROTLI_DECODER_ERROR_CODES_LIST(CASE_, NEWLINE_)
+ * #undef CASE_
+ * #undef NEWLINE_
+ * default: LOG(FATAL) << "unknown brotli error code";
+ * }
+ * @endcode
+ */
+#define BROTLI_DECODER_ERROR_CODES_LIST(BROTLI_ERROR_CODE, SEPARATOR) \
+ BROTLI_ERROR_CODE(_, NO_ERROR, 0) SEPARATOR \
+ /* Same as BrotliDecoderResult values */ \
+ BROTLI_ERROR_CODE(_, SUCCESS, 1) SEPARATOR \
+ BROTLI_ERROR_CODE(_, NEEDS_MORE_INPUT, 2) SEPARATOR \
+ BROTLI_ERROR_CODE(_, NEEDS_MORE_OUTPUT, 3) SEPARATOR \
+ \
+ /* Errors caused by invalid input */ \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, EXUBERANT_NIBBLE, -1) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, RESERVED, -2) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, EXUBERANT_META_NIBBLE, -3) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, SIMPLE_HUFFMAN_ALPHABET, -4) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, SIMPLE_HUFFMAN_SAME, -5) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, CL_SPACE, -6) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, HUFFMAN_SPACE, -7) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, CONTEXT_MAP_REPEAT, -8) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, BLOCK_LENGTH_1, -9) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, BLOCK_LENGTH_2, -10) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, TRANSFORM, -11) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, DICTIONARY, -12) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, WINDOW_BITS, -13) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, PADDING_1, -14) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, PADDING_2, -15) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_FORMAT_, DISTANCE, -16) SEPARATOR \
+ \
+ /* -17..-18 codes are reserved */ \
+ \
+ BROTLI_ERROR_CODE(_ERROR_, DICTIONARY_NOT_SET, -19) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_, INVALID_ARGUMENTS, -20) SEPARATOR \
+ \
+ /* Memory allocation problems */ \
+ BROTLI_ERROR_CODE(_ERROR_ALLOC_, CONTEXT_MODES, -21) SEPARATOR \
+ /* Literal, insert and distance trees together */ \
+ BROTLI_ERROR_CODE(_ERROR_ALLOC_, TREE_GROUPS, -22) SEPARATOR \
+ /* -23..-24 codes are reserved for distinct tree groups */ \
+ BROTLI_ERROR_CODE(_ERROR_ALLOC_, CONTEXT_MAP, -25) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_ALLOC_, RING_BUFFER_1, -26) SEPARATOR \
+ BROTLI_ERROR_CODE(_ERROR_ALLOC_, RING_BUFFER_2, -27) SEPARATOR \
+ /* -28..-29 codes are reserved for dynamic ring-buffer allocation */ \
+ BROTLI_ERROR_CODE(_ERROR_ALLOC_, BLOCK_TYPE_TREES, -30) SEPARATOR \
+ \
+ /* "Impossible" states */ \
+ BROTLI_ERROR_CODE(_ERROR_, UNREACHABLE, -31)
+
+/**
+ * Error code for detailed logging / production debugging.
+ *
+ * See ::BrotliDecoderGetErrorCode and ::BROTLI_LAST_ERROR_CODE.
+ */
+typedef enum {
+#define BROTLI_COMMA_ ,
+#define BROTLI_ERROR_CODE_ENUM_ITEM_(PREFIX, NAME, CODE) \
+ BROTLI_DECODER ## PREFIX ## NAME = CODE
+ BROTLI_DECODER_ERROR_CODES_LIST(BROTLI_ERROR_CODE_ENUM_ITEM_, BROTLI_COMMA_)
+} BrotliDecoderErrorCode;
+#undef BROTLI_ERROR_CODE_ENUM_ITEM_
+#undef BROTLI_COMMA_
+
+/**
+ * The value of the last error code, negative integer.
+ *
+ * All other error code values are in the range from ::BROTLI_LAST_ERROR_CODE
+ * to @c -1. There are also 4 other possible non-error codes @c 0 .. @c 3 in
+ * ::BrotliDecoderErrorCode enumeration.
+ */
+#define BROTLI_LAST_ERROR_CODE BROTLI_DECODER_ERROR_UNREACHABLE
+
+/** Options to be used with ::BrotliDecoderSetParameter. */
+typedef enum BrotliDecoderParameter {
+ /**
+ * Disable "canny" ring buffer allocation strategy.
+ *
+ * Ring buffer is allocated according to window size, despite the real size of
+ * the content.
+ */
+ BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION = 0,
+ /**
+ * Flag that determines if "Large Window Brotli" is used.
+ */
+ BROTLI_DECODER_PARAM_LARGE_WINDOW = 1
+} BrotliDecoderParameter;
+
+/**
+ * Sets the specified parameter to the given decoder instance.
+ *
+ * @param state decoder instance
+ * @param param parameter to set
+ * @param value new parameter value
+ * @returns ::BROTLI_FALSE if parameter is unrecognized, or value is invalid
+ * @returns ::BROTLI_TRUE if value is accepted
+ */
+BROTLI_DEC_API BROTLI_BOOL BrotliDecoderSetParameter(
+ BrotliDecoderState* state, BrotliDecoderParameter param, uint32_t value);
+
+/**
+ * Creates an instance of ::BrotliDecoderState and initializes it.
+ *
+ * The instance can be used once for decoding and should then be destroyed with
+ * ::BrotliDecoderDestroyInstance, it cannot be reused for a new decoding
+ * session.
+ *
+ * @p alloc_func and @p free_func @b MUST be both zero or both non-zero. In the
+ * case they are both zero, default memory allocators are used. @p opaque is
+ * passed to @p alloc_func and @p free_func when they are called. @p free_func
+ * has to return without doing anything when asked to free a NULL pointer.
+ *
+ * @param alloc_func custom memory allocation function
+ * @param free_func custom memory free function
+ * @param opaque custom memory manager handle
+ * @returns @c 0 if instance can not be allocated or initialized
+ * @returns pointer to initialized ::BrotliDecoderState otherwise
+ */
+BROTLI_DEC_API BrotliDecoderState* BrotliDecoderCreateInstance(
+ brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque);
+
+/**
+ * Deinitializes and frees ::BrotliDecoderState instance.
+ *
+ * @param state decoder instance to be cleaned up and deallocated
+ */
+BROTLI_DEC_API void BrotliDecoderDestroyInstance(BrotliDecoderState* state);
+
+/**
+ * Performs one-shot memory-to-memory decompression.
+ *
+ * Decompresses the data in @p encoded_buffer into @p decoded_buffer, and sets
+ * @p *decoded_size to the decompressed length.
+ *
+ * @param encoded_size size of @p encoded_buffer
+ * @param encoded_buffer compressed data buffer with at least @p encoded_size
+ * addressable bytes
+ * @param[in, out] decoded_size @b in: size of @p decoded_buffer; \n
+ * @b out: length of decompressed data written to
+ * @p decoded_buffer
+ * @param decoded_buffer decompressed data destination buffer
+ * @returns ::BROTLI_DECODER_RESULT_ERROR if input is corrupted, memory
+ * allocation failed, or @p decoded_buffer is not large enough;
+ * @returns ::BROTLI_DECODER_RESULT_SUCCESS otherwise
+ */
+BROTLI_DEC_API BrotliDecoderResult BrotliDecoderDecompress(
+ size_t encoded_size,
+ const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)],
+ size_t* decoded_size,
+ uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]);
+
+/**
+ * Decompresses the input stream to the output stream.
+ *
+ * The values @p *available_in and @p *available_out must specify the number of
+ * bytes addressable at @p *next_in and @p *next_out respectively.
+ * When @p *available_out is @c 0, @p next_out is allowed to be @c NULL.
+ *
+ * After each call, @p *available_in will be decremented by the amount of input
+ * bytes consumed, and the @p *next_in pointer will be incremented by that
+ * amount. Similarly, @p *available_out will be decremented by the amount of
+ * output bytes written, and the @p *next_out pointer will be incremented by
+ * that amount.
+ *
+ * @p total_out, if it is not a null-pointer, will be set to the number
+ * of bytes decompressed since the last @p state initialization.
+ *
+ * @note Input is never overconsumed, so @p next_in and @p available_in could be
+ * passed to the next consumer after decoding is complete.
+ *
+ * @param state decoder instance
+ * @param[in, out] available_in @b in: amount of available input; \n
+ * @b out: amount of unused input
+ * @param[in, out] next_in pointer to the next compressed byte
+ * @param[in, out] available_out @b in: length of output buffer; \n
+ * @b out: remaining size of output buffer
+ * @param[in, out] next_out output buffer cursor;
+ * can be @c NULL if @p available_out is @c 0
+ * @param[out] total_out number of bytes decompressed so far; can be @c NULL
+ * @returns ::BROTLI_DECODER_RESULT_ERROR if input is corrupted, memory
+ * allocation failed, arguments were invalid, etc.;
+ * use ::BrotliDecoderGetErrorCode to get detailed error code
+ * @returns ::BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT decoding is blocked until
+ * more input data is provided
+ * @returns ::BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT decoding is blocked until
+ * more output space is provided
+ * @returns ::BROTLI_DECODER_RESULT_SUCCESS decoding is finished, no more
+ * input might be consumed and no more output will be produced
+ */
+BROTLI_DEC_API BrotliDecoderResult BrotliDecoderDecompressStream(
+ BrotliDecoderState* state, size_t* available_in, const uint8_t** next_in,
+ size_t* available_out, uint8_t** next_out, size_t* total_out);
+
+/**
+ * Checks if decoder has more output.
+ *
+ * @param state decoder instance
+ * @returns ::BROTLI_TRUE, if decoder has some unconsumed output
+ * @returns ::BROTLI_FALSE otherwise
+ */
+BROTLI_DEC_API BROTLI_BOOL BrotliDecoderHasMoreOutput(
+ const BrotliDecoderState* state);
+
+/**
+ * Acquires pointer to internal output buffer.
+ *
+ * This method is used to make language bindings easier and more efficient:
+ * -# push data to ::BrotliDecoderDecompressStream,
+ * until ::BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT is reported
+ * -# use ::BrotliDecoderTakeOutput to peek bytes and copy to language-specific
+ * entity
+ *
+ * Also this could be useful if there is an output stream that is able to
+ * consume all the provided data (e.g. when data is saved to file system).
+ *
+ * @attention After every call to ::BrotliDecoderTakeOutput @p *size bytes of
+ * output are considered consumed for all consecutive calls to the
+ * instance methods; returned pointer becomes invalidated as well.
+ *
+ * @note Decoder output is not guaranteed to be contiguous. This means that
+ * after the size-unrestricted call to ::BrotliDecoderTakeOutput,
+ * immediate next call to ::BrotliDecoderTakeOutput may return more data.
+ *
+ * @param state decoder instance
+ * @param[in, out] size @b in: number of bytes caller is ready to take, @c 0 if
+ * any amount could be handled; \n
+ * @b out: amount of data pointed by returned pointer and
+ * considered consumed; \n
+ * out value is never greater than in value, unless it is @c 0
+ * @returns pointer to output data
+ */
+BROTLI_DEC_API const uint8_t* BrotliDecoderTakeOutput(
+ BrotliDecoderState* state, size_t* size);
+
+/**
+ * Checks if instance has already consumed input.
+ *
+ * Instance that returns ::BROTLI_FALSE is considered "fresh" and could be
+ * reused.
+ *
+ * @param state decoder instance
+ * @returns ::BROTLI_TRUE if decoder has already used some input bytes
+ * @returns ::BROTLI_FALSE otherwise
+ */
+BROTLI_DEC_API BROTLI_BOOL BrotliDecoderIsUsed(const BrotliDecoderState* state);
+
+/**
+ * Checks if decoder instance reached the final state.
+ *
+ * @param state decoder instance
+ * @returns ::BROTLI_TRUE if decoder is in a state where it reached the end of
+ * the input and produced all of the output
+ * @returns ::BROTLI_FALSE otherwise
+ */
+BROTLI_DEC_API BROTLI_BOOL BrotliDecoderIsFinished(
+ const BrotliDecoderState* state);
+
+/**
+ * Acquires a detailed error code.
+ *
+ * Should be used only after ::BrotliDecoderDecompressStream returns
+ * ::BROTLI_DECODER_RESULT_ERROR.
+ *
+ * See also ::BrotliDecoderErrorString
+ *
+ * @param state decoder instance
+ * @returns last saved error code
+ */
+BROTLI_DEC_API BrotliDecoderErrorCode BrotliDecoderGetErrorCode(
+ const BrotliDecoderState* state);
+
+/**
+ * Converts error code to a c-string.
+ */
+BROTLI_DEC_API const char* BrotliDecoderErrorString(BrotliDecoderErrorCode c);
+
+/**
+ * Gets a decoder library version.
+ *
+ * Look at BROTLI_VERSION for more information.
+ */
+BROTLI_DEC_API uint32_t BrotliDecoderVersion(void);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_DEC_DECODE_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/encode.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/encode.h
new file mode 100644
index 000000000..b2774cb63
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/encode.h
@@ -0,0 +1,448 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/**
+ * @file
+ * API for Brotli compression.
+ */
+
+#ifndef BROTLI_ENC_ENCODE_H_
+#define BROTLI_ENC_ENCODE_H_
+
+#include <brotli/port.h>
+#include <brotli/types.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/** Minimal value for ::BROTLI_PARAM_LGWIN parameter. */
+#define BROTLI_MIN_WINDOW_BITS 10
+/**
+ * Maximal value for ::BROTLI_PARAM_LGWIN parameter.
+ *
+ * @note equal to @c BROTLI_MAX_DISTANCE_BITS constant.
+ */
+#define BROTLI_MAX_WINDOW_BITS 24
+/**
+ * Maximal value for ::BROTLI_PARAM_LGWIN parameter
+ * in "Large Window Brotli" (32-bit).
+ */
+#define BROTLI_LARGE_MAX_WINDOW_BITS 30
+/** Minimal value for ::BROTLI_PARAM_LGBLOCK parameter. */
+#define BROTLI_MIN_INPUT_BLOCK_BITS 16
+/** Maximal value for ::BROTLI_PARAM_LGBLOCK parameter. */
+#define BROTLI_MAX_INPUT_BLOCK_BITS 24
+/** Minimal value for ::BROTLI_PARAM_QUALITY parameter. */
+#define BROTLI_MIN_QUALITY 0
+/** Maximal value for ::BROTLI_PARAM_QUALITY parameter. */
+#define BROTLI_MAX_QUALITY 11
+
+/** Options for ::BROTLI_PARAM_MODE parameter. */
+typedef enum BrotliEncoderMode {
+ /**
+ * Default compression mode.
+ *
+ * In this mode compressor does not know anything in advance about the
+ * properties of the input.
+ */
+ BROTLI_MODE_GENERIC = 0,
+ /** Compression mode for UTF-8 formatted text input. */
+ BROTLI_MODE_TEXT = 1,
+ /** Compression mode used in WOFF 2.0. */
+ BROTLI_MODE_FONT = 2
+} BrotliEncoderMode;
+
+/** Default value for ::BROTLI_PARAM_QUALITY parameter. */
+#define BROTLI_DEFAULT_QUALITY 11
+/** Default value for ::BROTLI_PARAM_LGWIN parameter. */
+#define BROTLI_DEFAULT_WINDOW 22
+/** Default value for ::BROTLI_PARAM_MODE parameter. */
+#define BROTLI_DEFAULT_MODE BROTLI_MODE_GENERIC
+
+/** Operations that can be performed by streaming encoder. */
+typedef enum BrotliEncoderOperation {
+ /**
+ * Process input.
+ *
+ * Encoder may postpone producing output, until it has processed enough input.
+ */
+ BROTLI_OPERATION_PROCESS = 0,
+ /**
+ * Produce output for all processed input.
+ *
+ * Actual flush is performed when input stream is depleted and there is enough
+ * space in output stream. This means that client should repeat
+ * ::BROTLI_OPERATION_FLUSH operation until @p available_in becomes @c 0, and
+ * ::BrotliEncoderHasMoreOutput returns ::BROTLI_FALSE. If output is acquired
+ * via ::BrotliEncoderTakeOutput, then operation should be repeated after
+ * output buffer is drained.
+ *
+ * @warning Until flush is complete, client @b SHOULD @b NOT swap,
+ * reduce or extend input stream.
+ *
+ * When flush is complete, output data will be sufficient for decoder to
+ * reproduce all the given input.
+ */
+ BROTLI_OPERATION_FLUSH = 1,
+ /**
+ * Finalize the stream.
+ *
+ * Actual finalization is performed when input stream is depleted and there is
+ * enough space in output stream. This means that client should repeat
+ * ::BROTLI_OPERATION_FINISH operation until @p available_in becomes @c 0, and
+ * ::BrotliEncoderHasMoreOutput returns ::BROTLI_FALSE. If output is acquired
+ * via ::BrotliEncoderTakeOutput, then operation should be repeated after
+ * output buffer is drained.
+ *
+ * @warning Until finalization is complete, client @b SHOULD @b NOT swap,
+ * reduce or extend input stream.
+ *
+ * Helper function ::BrotliEncoderIsFinished checks if stream is finalized and
+ * output fully dumped.
+ *
+ * Adding more input data to finalized stream is impossible.
+ */
+ BROTLI_OPERATION_FINISH = 2,
+ /**
+ * Emit metadata block to stream.
+ *
+ * Metadata is opaque to Brotli: neither encoder, nor decoder processes this
+ * data or relies on it. It may be used to pass some extra information from
+ * encoder client to decoder client without interfering with main data stream.
+ *
+ * @note Encoder may emit empty metadata blocks internally, to pad encoded
+ * stream to byte boundary.
+ *
+ * @warning Until emitting metadata is complete client @b SHOULD @b NOT swap,
+ * reduce or extend input stream.
+ *
+ * @warning The whole content of input buffer is considered to be the content
+ * of metadata block. Do @b NOT @e append metadata to input stream,
+ * before it is depleted with other operations.
+ *
+ * Stream is soft-flushed before metadata block is emitted. Metadata block
+ * @b MUST be no longer than than 16MiB.
+ */
+ BROTLI_OPERATION_EMIT_METADATA = 3
+} BrotliEncoderOperation;
+
+/** Options to be used with ::BrotliEncoderSetParameter. */
+typedef enum BrotliEncoderParameter {
+ /**
+ * Tune encoder for specific input.
+ *
+ * ::BrotliEncoderMode enumerates all available values.
+ */
+ BROTLI_PARAM_MODE = 0,
+ /**
+ * The main compression speed-density lever.
+ *
+ * The higher the quality, the slower the compression. Range is
+ * from ::BROTLI_MIN_QUALITY to ::BROTLI_MAX_QUALITY.
+ */
+ BROTLI_PARAM_QUALITY = 1,
+ /**
+ * Recommended sliding LZ77 window size.
+ *
+ * Encoder may reduce this value, e.g. if input is much smaller than
+ * window size.
+ *
+ * Window size is `(1 << value) - 16`.
+ *
+ * Range is from ::BROTLI_MIN_WINDOW_BITS to ::BROTLI_MAX_WINDOW_BITS.
+ */
+ BROTLI_PARAM_LGWIN = 2,
+ /**
+ * Recommended input block size.
+ *
+ * Encoder may reduce this value, e.g. if input is much smaller than input
+ * block size.
+ *
+ * Range is from ::BROTLI_MIN_INPUT_BLOCK_BITS to
+ * ::BROTLI_MAX_INPUT_BLOCK_BITS.
+ *
+ * @note Bigger input block size allows better compression, but consumes more
+ * memory. \n The rough formula of memory used for temporary input
+ * storage is `3 << lgBlock`.
+ */
+ BROTLI_PARAM_LGBLOCK = 3,
+ /**
+ * Flag that affects usage of "literal context modeling" format feature.
+ *
+ * This flag is a "decoding-speed vs compression ratio" trade-off.
+ */
+ BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING = 4,
+ /**
+ * Estimated total input size for all ::BrotliEncoderCompressStream calls.
+ *
+ * The default value is 0, which means that the total input size is unknown.
+ */
+ BROTLI_PARAM_SIZE_HINT = 5,
+ /**
+ * Flag that determines if "Large Window Brotli" is used.
+ */
+ BROTLI_PARAM_LARGE_WINDOW = 6,
+ /**
+ * Recommended number of postfix bits (NPOSTFIX).
+ *
+ * Encoder may change this value.
+ *
+ * Range is from 0 to ::BROTLI_MAX_NPOSTFIX.
+ */
+ BROTLI_PARAM_NPOSTFIX = 7,
+ /**
+ * Recommended number of direct distance codes (NDIRECT).
+ *
+ * Encoder may change this value.
+ *
+ * Range is from 0 to (15 << NPOSTFIX) in steps of (1 << NPOSTFIX).
+ */
+ BROTLI_PARAM_NDIRECT = 8,
+ /**
+ * Number of bytes of input stream already processed by a different instance.
+ *
+ * @note It is important to configure all the encoder instances with same
+ * parameters (except this one) in order to allow all the encoded parts
+ * obey the same restrictions implied by header.
+ *
+ * If offset is not 0, then stream header is omitted.
+ * In any case output start is byte aligned, so for proper streams stitching
+ * "predecessor" stream must be flushed.
+ *
+ * Range is not artificially limited, but all the values greater or equal to
+ * maximal window size have the same effect. Values greater than 2**30 are not
+ * allowed.
+ */
+ BROTLI_PARAM_STREAM_OFFSET = 9
+} BrotliEncoderParameter;
+
+/**
+ * Opaque structure that holds encoder state.
+ *
+ * Allocated and initialized with ::BrotliEncoderCreateInstance.
+ * Cleaned up and deallocated with ::BrotliEncoderDestroyInstance.
+ */
+typedef struct BrotliEncoderStateStruct BrotliEncoderState;
+
+/**
+ * Sets the specified parameter to the given encoder instance.
+ *
+ * @param state encoder instance
+ * @param param parameter to set
+ * @param value new parameter value
+ * @returns ::BROTLI_FALSE if parameter is unrecognized, or value is invalid
+ * @returns ::BROTLI_FALSE if value of parameter can not be changed at current
+ * encoder state (e.g. when encoding is started, window size might be
+ * already encoded and therefore it is impossible to change it)
+ * @returns ::BROTLI_TRUE if value is accepted
+ * @warning invalid values might be accepted in case they would not break
+ * encoding process.
+ */
+BROTLI_ENC_API BROTLI_BOOL BrotliEncoderSetParameter(
+ BrotliEncoderState* state, BrotliEncoderParameter param, uint32_t value);
+
+/**
+ * Creates an instance of ::BrotliEncoderState and initializes it.
+ *
+ * @p alloc_func and @p free_func @b MUST be both zero or both non-zero. In the
+ * case they are both zero, default memory allocators are used. @p opaque is
+ * passed to @p alloc_func and @p free_func when they are called. @p free_func
+ * has to return without doing anything when asked to free a NULL pointer.
+ *
+ * @param alloc_func custom memory allocation function
+ * @param free_func custom memory free function
+ * @param opaque custom memory manager handle
+ * @returns @c 0 if instance can not be allocated or initialized
+ * @returns pointer to initialized ::BrotliEncoderState otherwise
+ */
+BROTLI_ENC_API BrotliEncoderState* BrotliEncoderCreateInstance(
+ brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque);
+
+/**
+ * Deinitializes and frees ::BrotliEncoderState instance.
+ *
+ * @param state decoder instance to be cleaned up and deallocated
+ */
+BROTLI_ENC_API void BrotliEncoderDestroyInstance(BrotliEncoderState* state);
+
+/**
+ * Calculates the output size bound for the given @p input_size.
+ *
+ * @warning Result is only valid if quality is at least @c 2 and, in
+ * case ::BrotliEncoderCompressStream was used, no flushes
+ * (::BROTLI_OPERATION_FLUSH) were performed.
+ *
+ * @param input_size size of projected input
+ * @returns @c 0 if result does not fit @c size_t
+ */
+BROTLI_ENC_API size_t BrotliEncoderMaxCompressedSize(size_t input_size);
+
+/**
+ * Performs one-shot memory-to-memory compression.
+ *
+ * Compresses the data in @p input_buffer into @p encoded_buffer, and sets
+ * @p *encoded_size to the compressed length.
+ *
+ * @note If ::BrotliEncoderMaxCompressedSize(@p input_size) returns non-zero
+ * value, then output is guaranteed to be no longer than that.
+ *
+ * @note If @p lgwin is greater than ::BROTLI_MAX_WINDOW_BITS then resulting
+ * stream might be incompatible with RFC 7932; to decode such streams,
+ * decoder should be configured with
+ * ::BROTLI_DECODER_PARAM_LARGE_WINDOW = @c 1
+ *
+ * @param quality quality parameter value, e.g. ::BROTLI_DEFAULT_QUALITY
+ * @param lgwin lgwin parameter value, e.g. ::BROTLI_DEFAULT_WINDOW
+ * @param mode mode parameter value, e.g. ::BROTLI_DEFAULT_MODE
+ * @param input_size size of @p input_buffer
+ * @param input_buffer input data buffer with at least @p input_size
+ * addressable bytes
+ * @param[in, out] encoded_size @b in: size of @p encoded_buffer; \n
+ * @b out: length of compressed data written to
+ * @p encoded_buffer, or @c 0 if compression fails
+ * @param encoded_buffer compressed data destination buffer
+ * @returns ::BROTLI_FALSE in case of compression error
+ * @returns ::BROTLI_FALSE if output buffer is too small
+ * @returns ::BROTLI_TRUE otherwise
+ */
+BROTLI_ENC_API BROTLI_BOOL BrotliEncoderCompress(
+ int quality, int lgwin, BrotliEncoderMode mode, size_t input_size,
+ const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)],
+ size_t* encoded_size,
+ uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]);
+
+/**
+ * Compresses input stream to output stream.
+ *
+ * The values @p *available_in and @p *available_out must specify the number of
+ * bytes addressable at @p *next_in and @p *next_out respectively.
+ * When @p *available_out is @c 0, @p next_out is allowed to be @c NULL.
+ *
+ * After each call, @p *available_in will be decremented by the amount of input
+ * bytes consumed, and the @p *next_in pointer will be incremented by that
+ * amount. Similarly, @p *available_out will be decremented by the amount of
+ * output bytes written, and the @p *next_out pointer will be incremented by
+ * that amount.
+ *
+ * @p total_out, if it is not a null-pointer, will be set to the number
+ * of bytes compressed since the last @p state initialization.
+ *
+ *
+ *
+ * Internally workflow consists of 3 tasks:
+ * -# (optionally) copy input data to internal buffer
+ * -# actually compress data and (optionally) store it to internal buffer
+ * -# (optionally) copy compressed bytes from internal buffer to output stream
+ *
+ * Whenever all 3 tasks can't move forward anymore, or error occurs, this
+ * method returns the control flow to caller.
+ *
+ * @p op is used to perform flush, finish the stream, or inject metadata block.
+ * See ::BrotliEncoderOperation for more information.
+ *
+ * Flushing the stream means forcing encoding of all input passed to encoder and
+ * completing the current output block, so it could be fully decoded by stream
+ * decoder. To perform flush set @p op to ::BROTLI_OPERATION_FLUSH.
+ * Under some circumstances (e.g. lack of output stream capacity) this operation
+ * would require several calls to ::BrotliEncoderCompressStream. The method must
+ * be called again until both input stream is depleted and encoder has no more
+ * output (see ::BrotliEncoderHasMoreOutput) after the method is called.
+ *
+ * Finishing the stream means encoding of all input passed to encoder and
+ * adding specific "final" marks, so stream decoder could determine that stream
+ * is complete. To perform finish set @p op to ::BROTLI_OPERATION_FINISH.
+ * Under some circumstances (e.g. lack of output stream capacity) this operation
+ * would require several calls to ::BrotliEncoderCompressStream. The method must
+ * be called again until both input stream is depleted and encoder has no more
+ * output (see ::BrotliEncoderHasMoreOutput) after the method is called.
+ *
+ * @warning When flushing and finishing, @p op should not change until operation
+ * is complete; input stream should not be swapped, reduced or
+ * extended as well.
+ *
+ * @param state encoder instance
+ * @param op requested operation
+ * @param[in, out] available_in @b in: amount of available input; \n
+ * @b out: amount of unused input
+ * @param[in, out] next_in pointer to the next input byte
+ * @param[in, out] available_out @b in: length of output buffer; \n
+ * @b out: remaining size of output buffer
+ * @param[in, out] next_out compressed output buffer cursor;
+ * can be @c NULL if @p available_out is @c 0
+ * @param[out] total_out number of bytes produced so far; can be @c NULL
+ * @returns ::BROTLI_FALSE if there was an error
+ * @returns ::BROTLI_TRUE otherwise
+ */
+BROTLI_ENC_API BROTLI_BOOL BrotliEncoderCompressStream(
+ BrotliEncoderState* state, BrotliEncoderOperation op, size_t* available_in,
+ const uint8_t** next_in, size_t* available_out, uint8_t** next_out,
+ size_t* total_out);
+
+/**
+ * Checks if encoder instance reached the final state.
+ *
+ * @param state encoder instance
+ * @returns ::BROTLI_TRUE if encoder is in a state where it reached the end of
+ * the input and produced all of the output
+ * @returns ::BROTLI_FALSE otherwise
+ */
+BROTLI_ENC_API BROTLI_BOOL BrotliEncoderIsFinished(BrotliEncoderState* state);
+
+/**
+ * Checks if encoder has more output.
+ *
+ * @param state encoder instance
+ * @returns ::BROTLI_TRUE, if encoder has some unconsumed output
+ * @returns ::BROTLI_FALSE otherwise
+ */
+BROTLI_ENC_API BROTLI_BOOL BrotliEncoderHasMoreOutput(
+ BrotliEncoderState* state);
+
+/**
+ * Acquires pointer to internal output buffer.
+ *
+ * This method is used to make language bindings easier and more efficient:
+ * -# push data to ::BrotliEncoderCompressStream,
+ * until ::BrotliEncoderHasMoreOutput returns BROTL_TRUE
+ * -# use ::BrotliEncoderTakeOutput to peek bytes and copy to language-specific
+ * entity
+ *
+ * Also this could be useful if there is an output stream that is able to
+ * consume all the provided data (e.g. when data is saved to file system).
+ *
+ * @attention After every call to ::BrotliEncoderTakeOutput @p *size bytes of
+ * output are considered consumed for all consecutive calls to the
+ * instance methods; returned pointer becomes invalidated as well.
+ *
+ * @note Encoder output is not guaranteed to be contiguous. This means that
+ * after the size-unrestricted call to ::BrotliEncoderTakeOutput,
+ * immediate next call to ::BrotliEncoderTakeOutput may return more data.
+ *
+ * @param state encoder instance
+ * @param[in, out] size @b in: number of bytes caller is ready to take, @c 0 if
+ * any amount could be handled; \n
+ * @b out: amount of data pointed by returned pointer and
+ * considered consumed; \n
+ * out value is never greater than in value, unless it is @c 0
+ * @returns pointer to output data
+ */
+BROTLI_ENC_API const uint8_t* BrotliEncoderTakeOutput(
+ BrotliEncoderState* state, size_t* size);
+
+
+/**
+ * Gets an encoder library version.
+ *
+ * Look at BROTLI_VERSION for more information.
+ */
+BROTLI_ENC_API uint32_t BrotliEncoderVersion(void);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_ENCODE_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/port.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/port.h
new file mode 100644
index 000000000..825237a33
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/port.h
@@ -0,0 +1,288 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Macros for compiler / platform specific API declarations. */
+
+#ifndef BROTLI_COMMON_PORT_H_
+#define BROTLI_COMMON_PORT_H_
+
+/* The following macros were borrowed from https://github.com/nemequ/hedley
+ * with permission of original author - Evan Nemerson <evan@nemerson.com> */
+
+/* >>> >>> >>> hedley macros */
+
+#define BROTLI_MAKE_VERSION(major, minor, revision) \
+ (((major) * 1000000) + ((minor) * 1000) + (revision))
+
+#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__)
+#define BROTLI_GNUC_VERSION \
+ BROTLI_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
+#elif defined(__GNUC__)
+#define BROTLI_GNUC_VERSION BROTLI_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, 0)
+#endif
+
+#if defined(BROTLI_GNUC_VERSION)
+#define BROTLI_GNUC_VERSION_CHECK(major, minor, patch) \
+ (BROTLI_GNUC_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
+#else
+#define BROTLI_GNUC_VERSION_CHECK(major, minor, patch) (0)
+#endif
+
+#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000)
+#define BROTLI_MSVC_VERSION \
+ BROTLI_MAKE_VERSION((_MSC_FULL_VER / 10000000), \
+ (_MSC_FULL_VER % 10000000) / 100000, \
+ (_MSC_FULL_VER % 100000) / 100)
+#elif defined(_MSC_FULL_VER)
+#define BROTLI_MSVC_VERSION \
+ BROTLI_MAKE_VERSION((_MSC_FULL_VER / 1000000), \
+ (_MSC_FULL_VER % 1000000) / 10000, \
+ (_MSC_FULL_VER % 10000) / 10)
+#elif defined(_MSC_VER)
+#define BROTLI_MSVC_VERSION \
+ BROTLI_MAKE_VERSION(_MSC_VER / 100, _MSC_VER % 100, 0)
+#endif
+
+#if !defined(_MSC_VER)
+#define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) (0)
+#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
+#define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) \
+ (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch)))
+#elif defined(_MSC_VER) && (_MSC_VER >= 1200)
+#define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) \
+ (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch)))
+#else
+#define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) \
+ (_MSC_VER >= ((major * 100) + (minor)))
+#endif
+
+#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE)
+#define BROTLI_INTEL_VERSION \
+ BROTLI_MAKE_VERSION(__INTEL_COMPILER / 100, \
+ __INTEL_COMPILER % 100, \
+ __INTEL_COMPILER_UPDATE)
+#elif defined(__INTEL_COMPILER)
+#define BROTLI_INTEL_VERSION \
+ BROTLI_MAKE_VERSION(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0)
+#endif
+
+#if defined(BROTLI_INTEL_VERSION)
+#define BROTLI_INTEL_VERSION_CHECK(major, minor, patch) \
+ (BROTLI_INTEL_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
+#else
+#define BROTLI_INTEL_VERSION_CHECK(major, minor, patch) (0)
+#endif
+
+#if defined(__PGI) && \
+ defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__)
+#define BROTLI_PGI_VERSION \
+ BROTLI_MAKE_VERSION(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__)
+#endif
+
+#if defined(BROTLI_PGI_VERSION)
+#define BROTLI_PGI_VERSION_CHECK(major, minor, patch) \
+ (BROTLI_PGI_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
+#else
+#define BROTLI_PGI_VERSION_CHECK(major, minor, patch) (0)
+#endif
+
+#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000)
+#define BROTLI_SUNPRO_VERSION \
+ BROTLI_MAKE_VERSION( \
+ (((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), \
+ (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), \
+ (__SUNPRO_C & 0xf) * 10)
+#elif defined(__SUNPRO_C)
+#define BROTLI_SUNPRO_VERSION \
+ BROTLI_MAKE_VERSION((__SUNPRO_C >> 8) & 0xf, \
+ (__SUNPRO_C >> 4) & 0xf, \
+ (__SUNPRO_C) & 0xf)
+#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000)
+#define BROTLI_SUNPRO_VERSION \
+ BROTLI_MAKE_VERSION( \
+ (((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), \
+ (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), \
+ (__SUNPRO_CC & 0xf) * 10)
+#elif defined(__SUNPRO_CC)
+#define BROTLI_SUNPRO_VERSION \
+ BROTLI_MAKE_VERSION((__SUNPRO_CC >> 8) & 0xf, \
+ (__SUNPRO_CC >> 4) & 0xf, \
+ (__SUNPRO_CC) & 0xf)
+#endif
+
+#if defined(BROTLI_SUNPRO_VERSION)
+#define BROTLI_SUNPRO_VERSION_CHECK(major, minor, patch) \
+ (BROTLI_SUNPRO_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
+#else
+#define BROTLI_SUNPRO_VERSION_CHECK(major, minor, patch) (0)
+#endif
+
+#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION)
+#define BROTLI_ARM_VERSION \
+ BROTLI_MAKE_VERSION((__ARMCOMPILER_VERSION / 1000000), \
+ (__ARMCOMPILER_VERSION % 1000000) / 10000, \
+ (__ARMCOMPILER_VERSION % 10000) / 100)
+#elif defined(__CC_ARM) && defined(__ARMCC_VERSION)
+#define BROTLI_ARM_VERSION \
+ BROTLI_MAKE_VERSION((__ARMCC_VERSION / 1000000), \
+ (__ARMCC_VERSION % 1000000) / 10000, \
+ (__ARMCC_VERSION % 10000) / 100)
+#endif
+
+#if defined(BROTLI_ARM_VERSION)
+#define BROTLI_ARM_VERSION_CHECK(major, minor, patch) \
+ (BROTLI_ARM_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
+#else
+#define BROTLI_ARM_VERSION_CHECK(major, minor, patch) (0)
+#endif
+
+#if defined(__ibmxl__)
+#define BROTLI_IBM_VERSION \
+ BROTLI_MAKE_VERSION(__ibmxl_version__, \
+ __ibmxl_release__, \
+ __ibmxl_modification__)
+#elif defined(__xlC__) && defined(__xlC_ver__)
+#define BROTLI_IBM_VERSION \
+ BROTLI_MAKE_VERSION(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff)
+#elif defined(__xlC__)
+#define BROTLI_IBM_VERSION BROTLI_MAKE_VERSION(__xlC__ >> 8, __xlC__ & 0xff, 0)
+#endif
+
+#if defined(BROTLI_IBM_VERSION)
+#define BROTLI_IBM_VERSION_CHECK(major, minor, patch) \
+ (BROTLI_IBM_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
+#else
+#define BROTLI_IBM_VERSION_CHECK(major, minor, patch) (0)
+#endif
+
+#if defined(__TI_COMPILER_VERSION__)
+#define BROTLI_TI_VERSION \
+ BROTLI_MAKE_VERSION((__TI_COMPILER_VERSION__ / 1000000), \
+ (__TI_COMPILER_VERSION__ % 1000000) / 1000, \
+ (__TI_COMPILER_VERSION__ % 1000))
+#endif
+
+#if defined(BROTLI_TI_VERSION)
+#define BROTLI_TI_VERSION_CHECK(major, minor, patch) \
+ (BROTLI_TI_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
+#else
+#define BROTLI_TI_VERSION_CHECK(major, minor, patch) (0)
+#endif
+
+#if defined(__IAR_SYSTEMS_ICC__)
+#if __VER__ > 1000
+#define BROTLI_IAR_VERSION \
+ BROTLI_MAKE_VERSION((__VER__ / 1000000), \
+ (__VER__ / 1000) % 1000, \
+ (__VER__ % 1000))
+#else
+#define BROTLI_IAR_VERSION BROTLI_MAKE_VERSION(VER / 100, __VER__ % 100, 0)
+#endif
+#endif
+
+#if defined(BROTLI_IAR_VERSION)
+#define BROTLI_IAR_VERSION_CHECK(major, minor, patch) \
+ (BROTLI_IAR_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
+#else
+#define BROTLI_IAR_VERSION_CHECK(major, minor, patch) (0)
+#endif
+
+#if defined(__TINYC__)
+#define BROTLI_TINYC_VERSION \
+ BROTLI_MAKE_VERSION(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100)
+#endif
+
+#if defined(BROTLI_TINYC_VERSION)
+#define BROTLI_TINYC_VERSION_CHECK(major, minor, patch) \
+ (BROTLI_TINYC_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
+#else
+#define BROTLI_TINYC_VERSION_CHECK(major, minor, patch) (0)
+#endif
+
+#if defined(__has_attribute)
+#define BROTLI_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
+ __has_attribute(attribute)
+#else
+#define BROTLI_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
+ BROTLI_GNUC_VERSION_CHECK(major, minor, patch)
+#endif
+
+#if defined(__has_builtin)
+#define BROTLI_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \
+ __has_builtin(builtin)
+#else
+#define BROTLI_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \
+ BROTLI_GNUC_VERSION_CHECK(major, minor, patch)
+#endif
+
+#if defined(__has_feature)
+#define BROTLI_HAS_FEATURE(feature) __has_feature(feature)
+#else
+#define BROTLI_HAS_FEATURE(feature) (0)
+#endif
+
+#if defined(ADDRESS_SANITIZER) || BROTLI_HAS_FEATURE(address_sanitizer) || \
+ defined(THREAD_SANITIZER) || BROTLI_HAS_FEATURE(thread_sanitizer) || \
+ defined(MEMORY_SANITIZER) || BROTLI_HAS_FEATURE(memory_sanitizer)
+#define BROTLI_SANITIZED 1
+#else
+#define BROTLI_SANITIZED 0
+#endif
+
+#if defined(_WIN32) || defined(__CYGWIN__)
+#define BROTLI_PUBLIC
+#elif BROTLI_GNUC_VERSION_CHECK(3, 3, 0) || \
+ BROTLI_TI_VERSION_CHECK(8, 0, 0) || \
+ BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \
+ BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \
+ BROTLI_IBM_VERSION_CHECK(13, 1, 0) || \
+ BROTLI_SUNPRO_VERSION_CHECK(5, 11, 0) || \
+ (BROTLI_TI_VERSION_CHECK(7, 3, 0) && \
+ defined(__TI_GNU_ATTRIBUTE_SUPPORT__) && defined(__TI_EABI__))
+#define BROTLI_PUBLIC __attribute__ ((visibility ("default")))
+#else
+#define BROTLI_PUBLIC
+#endif
+
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
+ !defined(__STDC_NO_VLA__) && !defined(__cplusplus) && \
+ !defined(__PGI) && !defined(__PGIC__) && !defined(__TINYC__)
+#define BROTLI_ARRAY_PARAM(name) (name)
+#else
+#define BROTLI_ARRAY_PARAM(name)
+#endif
+
+/* <<< <<< <<< end of hedley macros. */
+
+#if defined(BROTLI_SHARED_COMPILATION)
+#if defined(_WIN32)
+#if defined(BROTLICOMMON_SHARED_COMPILATION)
+#define BROTLI_COMMON_API __declspec(dllexport)
+#else
+#define BROTLI_COMMON_API __declspec(dllimport)
+#endif /* BROTLICOMMON_SHARED_COMPILATION */
+#if defined(BROTLIDEC_SHARED_COMPILATION)
+#define BROTLI_DEC_API __declspec(dllexport)
+#else
+#define BROTLI_DEC_API __declspec(dllimport)
+#endif /* BROTLIDEC_SHARED_COMPILATION */
+#if defined(BROTLIENC_SHARED_COMPILATION)
+#define BROTLI_ENC_API __declspec(dllexport)
+#else
+#define BROTLI_ENC_API __declspec(dllimport)
+#endif /* BROTLIENC_SHARED_COMPILATION */
+#else /* _WIN32 */
+#define BROTLI_COMMON_API BROTLI_PUBLIC
+#define BROTLI_DEC_API BROTLI_PUBLIC
+#define BROTLI_ENC_API BROTLI_PUBLIC
+#endif /* _WIN32 */
+#else /* BROTLI_SHARED_COMPILATION */
+#define BROTLI_COMMON_API
+#define BROTLI_DEC_API
+#define BROTLI_ENC_API
+#endif
+
+#endif /* BROTLI_COMMON_PORT_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/types.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/types.h
new file mode 100644
index 000000000..eff1a3cd0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/include/brotli/types.h
@@ -0,0 +1,83 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/**
+ * @file
+ * Common types used in decoder and encoder API.
+ */
+
+#ifndef BROTLI_COMMON_TYPES_H_
+#define BROTLI_COMMON_TYPES_H_
+
+#include <stddef.h> /* for size_t */
+
+#if defined(_MSC_VER) && (_MSC_VER < 1600)
+typedef __int8 int8_t;
+typedef unsigned __int8 uint8_t;
+typedef __int16 int16_t;
+typedef unsigned __int16 uint16_t;
+typedef __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int64 uint64_t;
+typedef __int64 int64_t;
+#else
+#include <stdint.h>
+#endif /* defined(_MSC_VER) && (_MSC_VER < 1600) */
+
+/**
+ * A portable @c bool replacement.
+ *
+ * ::BROTLI_BOOL is a "documentation" type: actually it is @c int, but in API it
+ * denotes a type, whose only values are ::BROTLI_TRUE and ::BROTLI_FALSE.
+ *
+ * ::BROTLI_BOOL values passed to Brotli should either be ::BROTLI_TRUE or
+ * ::BROTLI_FALSE, or be a result of ::TO_BROTLI_BOOL macros.
+ *
+ * ::BROTLI_BOOL values returned by Brotli should not be tested for equality
+ * with @c true, @c false, ::BROTLI_TRUE, ::BROTLI_FALSE, but rather should be
+ * evaluated, for example: @code{.cpp}
+ * if (SomeBrotliFunction(encoder, BROTLI_TRUE) &&
+ * !OtherBrotliFunction(decoder, BROTLI_FALSE)) {
+ * bool x = !!YetAnotherBrotliFunction(encoder, TO_BROLTI_BOOL(2 * 2 == 4));
+ * DoSomething(x);
+ * }
+ * @endcode
+ */
+#define BROTLI_BOOL int
+/** Portable @c true replacement. */
+#define BROTLI_TRUE 1
+/** Portable @c false replacement. */
+#define BROTLI_FALSE 0
+/** @c bool to ::BROTLI_BOOL conversion macros. */
+#define TO_BROTLI_BOOL(X) (!!(X) ? BROTLI_TRUE : BROTLI_FALSE)
+
+#define BROTLI_MAKE_UINT64_T(high, low) ((((uint64_t)(high)) << 32) | low)
+
+#define BROTLI_UINT32_MAX (~((uint32_t)0))
+#define BROTLI_SIZE_MAX (~((size_t)0))
+
+/**
+ * Allocating function pointer type.
+ *
+ * @param opaque custom memory manager handle provided by client
+ * @param size requested memory region size; can not be @c 0
+ * @returns @c 0 in the case of failure
+ * @returns a valid pointer to a memory region of at least @p size bytes
+ * long otherwise
+ */
+typedef void* (*brotli_alloc_func)(void* opaque, size_t size);
+
+/**
+ * Deallocating function pointer type.
+ *
+ * This function @b SHOULD do nothing if @p address is @c 0.
+ *
+ * @param opaque custom memory manager handle provided by client
+ * @param address memory region pointer returned by ::brotli_alloc_func, or @c 0
+ */
+typedef void (*brotli_free_func)(void* opaque, void* address);
+
+#endif /* BROTLI_COMMON_TYPES_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/tools/brotli.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/tools/brotli.c
new file mode 100644
index 000000000..04606a897
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/tools/brotli.c
@@ -0,0 +1,1107 @@
+/* Copyright 2014 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Command line interface for Brotli library. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <time.h>
+
+#include "../common/constants.h"
+#include "../common/version.h"
+#include <brotli/decode.h>
+#include <brotli/encode.h>
+
+#if !defined(_WIN32)
+#include <unistd.h>
+#include <utime.h>
+#define MAKE_BINARY(FILENO) (FILENO)
+#else
+#include <io.h>
+#include <share.h>
+#include <sys/utime.h>
+
+#define MAKE_BINARY(FILENO) (_setmode((FILENO), _O_BINARY), (FILENO))
+
+#if !defined(__MINGW32__)
+#define STDIN_FILENO _fileno(stdin)
+#define STDOUT_FILENO _fileno(stdout)
+#define S_IRUSR S_IREAD
+#define S_IWUSR S_IWRITE
+#endif
+
+#define fdopen _fdopen
+#define isatty _isatty
+#define unlink _unlink
+#define utimbuf _utimbuf
+#define utime _utime
+
+#define fopen ms_fopen
+#define open ms_open
+
+#define chmod(F, P) (0)
+#define chown(F, O, G) (0)
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1400)
+#define fseek _fseeki64
+#define ftell _ftelli64
+#endif
+
+static FILE* ms_fopen(const char* filename, const char* mode) {
+ FILE* result = 0;
+ fopen_s(&result, filename, mode);
+ return result;
+}
+
+static int ms_open(const char* filename, int oflag, int pmode) {
+ int result = -1;
+ _sopen_s(&result, filename, oflag | O_BINARY, _SH_DENYNO, pmode);
+ return result;
+}
+#endif /* WIN32 */
+
+typedef enum {
+ COMMAND_COMPRESS,
+ COMMAND_DECOMPRESS,
+ COMMAND_HELP,
+ COMMAND_INVALID,
+ COMMAND_TEST_INTEGRITY,
+ COMMAND_NOOP,
+ COMMAND_VERSION
+} Command;
+
+#define DEFAULT_LGWIN 24
+#define DEFAULT_SUFFIX ".br"
+#define MAX_OPTIONS 20
+
+typedef struct {
+ /* Parameters */
+ int quality;
+ int lgwin;
+ int verbosity;
+ BROTLI_BOOL force_overwrite;
+ BROTLI_BOOL junk_source;
+ BROTLI_BOOL copy_stat;
+ BROTLI_BOOL write_to_stdout;
+ BROTLI_BOOL test_integrity;
+ BROTLI_BOOL decompress;
+ BROTLI_BOOL large_window;
+ const char* output_path;
+ const char* suffix;
+ int not_input_indices[MAX_OPTIONS];
+ size_t longest_path_len;
+ size_t input_count;
+
+ /* Inner state */
+ int argc;
+ char** argv;
+ char* modified_path; /* Storage for path with appended / cut suffix */
+ int iterator;
+ int ignore;
+ BROTLI_BOOL iterator_error;
+ uint8_t* buffer;
+ uint8_t* input;
+ uint8_t* output;
+ const char* current_input_path;
+ const char* current_output_path;
+ int64_t input_file_length; /* -1, if impossible to calculate */
+ FILE* fin;
+ FILE* fout;
+
+ /* I/O buffers */
+ size_t available_in;
+ const uint8_t* next_in;
+ size_t available_out;
+ uint8_t* next_out;
+
+ /* Reporting */
+ /* size_t would be large enough,
+ until 4GiB+ files are compressed / decompressed on 32-bit CPUs. */
+ size_t total_in;
+ size_t total_out;
+} Context;
+
+/* Parse up to 5 decimal digits. */
+static BROTLI_BOOL ParseInt(const char* s, int low, int high, int* result) {
+ int value = 0;
+ int i;
+ for (i = 0; i < 5; ++i) {
+ char c = s[i];
+ if (c == 0) break;
+ if (s[i] < '0' || s[i] > '9') return BROTLI_FALSE;
+ value = (10 * value) + (c - '0');
+ }
+ if (i == 0) return BROTLI_FALSE;
+ if (i > 1 && s[0] == '0') return BROTLI_FALSE;
+ if (s[i] != 0) return BROTLI_FALSE;
+ if (value < low || value > high) return BROTLI_FALSE;
+ *result = value;
+ return BROTLI_TRUE;
+}
+
+/* Returns "base file name" or its tail, if it contains '/' or '\'. */
+static const char* FileName(const char* path) {
+ const char* separator_position = strrchr(path, '/');
+ if (separator_position) path = separator_position + 1;
+ separator_position = strrchr(path, '\\');
+ if (separator_position) path = separator_position + 1;
+ return path;
+}
+
+/* Detect if the program name is a special alias that infers a command type. */
+static Command ParseAlias(const char* name) {
+ /* TODO: cast name to lower case? */
+ const char* unbrotli = "unbrotli";
+ size_t unbrotli_len = strlen(unbrotli);
+ name = FileName(name);
+ /* Partial comparison. On Windows there could be ".exe" suffix. */
+ if (strncmp(name, unbrotli, unbrotli_len) == 0) {
+ char terminator = name[unbrotli_len];
+ if (terminator == 0 || terminator == '.') return COMMAND_DECOMPRESS;
+ }
+ return COMMAND_COMPRESS;
+}
+
+static Command ParseParams(Context* params) {
+ int argc = params->argc;
+ char** argv = params->argv;
+ int i;
+ int next_option_index = 0;
+ size_t input_count = 0;
+ size_t longest_path_len = 1;
+ BROTLI_BOOL command_set = BROTLI_FALSE;
+ BROTLI_BOOL quality_set = BROTLI_FALSE;
+ BROTLI_BOOL output_set = BROTLI_FALSE;
+ BROTLI_BOOL keep_set = BROTLI_FALSE;
+ BROTLI_BOOL lgwin_set = BROTLI_FALSE;
+ BROTLI_BOOL suffix_set = BROTLI_FALSE;
+ BROTLI_BOOL after_dash_dash = BROTLI_FALSE;
+ Command command = ParseAlias(argv[0]);
+
+ for (i = 1; i < argc; ++i) {
+ const char* arg = argv[i];
+ /* C99 5.1.2.2.1: "members argv[0] through argv[argc-1] inclusive shall
+ contain pointers to strings"; NULL and 0-length are not forbidden. */
+ size_t arg_len = arg ? strlen(arg) : 0;
+
+ if (arg_len == 0) {
+ params->not_input_indices[next_option_index++] = i;
+ continue;
+ }
+
+ /* Too many options. The expected longest option list is:
+ "-q 0 -w 10 -o f -D d -S b -d -f -k -n -v --", i.e. 16 items in total.
+ This check is an additional guard that is never triggered, but provides
+ a guard for future changes. */
+ if (next_option_index > (MAX_OPTIONS - 2)) {
+ fprintf(stderr, "too many options passed\n");
+ return COMMAND_INVALID;
+ }
+
+ /* Input file entry. */
+ if (after_dash_dash || arg[0] != '-' || arg_len == 1) {
+ input_count++;
+ if (longest_path_len < arg_len) longest_path_len = arg_len;
+ continue;
+ }
+
+ /* Not a file entry. */
+ params->not_input_indices[next_option_index++] = i;
+
+ /* '--' entry stop parsing arguments. */
+ if (arg_len == 2 && arg[1] == '-') {
+ after_dash_dash = BROTLI_TRUE;
+ continue;
+ }
+
+ /* Simple / coalesced options. */
+ if (arg[1] != '-') {
+ size_t j;
+ for (j = 1; j < arg_len; ++j) {
+ char c = arg[j];
+ if (c >= '0' && c <= '9') {
+ if (quality_set) {
+ fprintf(stderr, "quality already set\n");
+ return COMMAND_INVALID;
+ }
+ quality_set = BROTLI_TRUE;
+ params->quality = c - '0';
+ continue;
+ } else if (c == 'c') {
+ if (output_set) {
+ fprintf(stderr, "write to standard output already set\n");
+ return COMMAND_INVALID;
+ }
+ output_set = BROTLI_TRUE;
+ params->write_to_stdout = BROTLI_TRUE;
+ continue;
+ } else if (c == 'd') {
+ if (command_set) {
+ fprintf(stderr, "command already set when parsing -d\n");
+ return COMMAND_INVALID;
+ }
+ command_set = BROTLI_TRUE;
+ command = COMMAND_DECOMPRESS;
+ continue;
+ } else if (c == 'f') {
+ if (params->force_overwrite) {
+ fprintf(stderr, "force output overwrite already set\n");
+ return COMMAND_INVALID;
+ }
+ params->force_overwrite = BROTLI_TRUE;
+ continue;
+ } else if (c == 'h') {
+ /* Don't parse further. */
+ return COMMAND_HELP;
+ } else if (c == 'j' || c == 'k') {
+ if (keep_set) {
+ fprintf(stderr, "argument --rm / -j or --keep / -k already set\n");
+ return COMMAND_INVALID;
+ }
+ keep_set = BROTLI_TRUE;
+ params->junk_source = TO_BROTLI_BOOL(c == 'j');
+ continue;
+ } else if (c == 'n') {
+ if (!params->copy_stat) {
+ fprintf(stderr, "argument --no-copy-stat / -n already set\n");
+ return COMMAND_INVALID;
+ }
+ params->copy_stat = BROTLI_FALSE;
+ continue;
+ } else if (c == 't') {
+ if (command_set) {
+ fprintf(stderr, "command already set when parsing -t\n");
+ return COMMAND_INVALID;
+ }
+ command_set = BROTLI_TRUE;
+ command = COMMAND_TEST_INTEGRITY;
+ continue;
+ } else if (c == 'v') {
+ if (params->verbosity > 0) {
+ fprintf(stderr, "argument --verbose / -v already set\n");
+ return COMMAND_INVALID;
+ }
+ params->verbosity = 1;
+ continue;
+ } else if (c == 'V') {
+ /* Don't parse further. */
+ return COMMAND_VERSION;
+ } else if (c == 'Z') {
+ if (quality_set) {
+ fprintf(stderr, "quality already set\n");
+ return COMMAND_INVALID;
+ }
+ quality_set = BROTLI_TRUE;
+ params->quality = 11;
+ continue;
+ }
+ /* o/q/w/D/S with parameter is expected */
+ if (c != 'o' && c != 'q' && c != 'w' && c != 'D' && c != 'S') {
+ fprintf(stderr, "invalid argument -%c\n", c);
+ return COMMAND_INVALID;
+ }
+ if (j + 1 != arg_len) {
+ fprintf(stderr, "expected parameter for argument -%c\n", c);
+ return COMMAND_INVALID;
+ }
+ i++;
+ if (i == argc || !argv[i] || argv[i][0] == 0) {
+ fprintf(stderr, "expected parameter for argument -%c\n", c);
+ return COMMAND_INVALID;
+ }
+ params->not_input_indices[next_option_index++] = i;
+ if (c == 'o') {
+ if (output_set) {
+ fprintf(stderr, "write to standard output already set (-o)\n");
+ return COMMAND_INVALID;
+ }
+ params->output_path = argv[i];
+ } else if (c == 'q') {
+ if (quality_set) {
+ fprintf(stderr, "quality already set\n");
+ return COMMAND_INVALID;
+ }
+ quality_set = ParseInt(argv[i], BROTLI_MIN_QUALITY,
+ BROTLI_MAX_QUALITY, &params->quality);
+ if (!quality_set) {
+ fprintf(stderr, "error parsing quality value [%s]\n", argv[i]);
+ return COMMAND_INVALID;
+ }
+ } else if (c == 'w') {
+ if (lgwin_set) {
+ fprintf(stderr, "lgwin parameter already set\n");
+ return COMMAND_INVALID;
+ }
+ lgwin_set = ParseInt(argv[i], 0,
+ BROTLI_MAX_WINDOW_BITS, &params->lgwin);
+ if (!lgwin_set) {
+ fprintf(stderr, "error parsing lgwin value [%s]\n", argv[i]);
+ return COMMAND_INVALID;
+ }
+ if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) {
+ fprintf(stderr,
+ "lgwin parameter (%d) smaller than the minimum (%d)\n",
+ params->lgwin, BROTLI_MIN_WINDOW_BITS);
+ return COMMAND_INVALID;
+ }
+ } else if (c == 'S') {
+ if (suffix_set) {
+ fprintf(stderr, "suffix already set\n");
+ return COMMAND_INVALID;
+ }
+ suffix_set = BROTLI_TRUE;
+ params->suffix = argv[i];
+ }
+ }
+ } else { /* Double-dash. */
+ arg = &arg[2];
+ if (strcmp("best", arg) == 0) {
+ if (quality_set) {
+ fprintf(stderr, "quality already set\n");
+ return COMMAND_INVALID;
+ }
+ quality_set = BROTLI_TRUE;
+ params->quality = 11;
+ } else if (strcmp("decompress", arg) == 0) {
+ if (command_set) {
+ fprintf(stderr, "command already set when parsing --decompress\n");
+ return COMMAND_INVALID;
+ }
+ command_set = BROTLI_TRUE;
+ command = COMMAND_DECOMPRESS;
+ } else if (strcmp("force", arg) == 0) {
+ if (params->force_overwrite) {
+ fprintf(stderr, "force output overwrite already set\n");
+ return COMMAND_INVALID;
+ }
+ params->force_overwrite = BROTLI_TRUE;
+ } else if (strcmp("help", arg) == 0) {
+ /* Don't parse further. */
+ return COMMAND_HELP;
+ } else if (strcmp("keep", arg) == 0) {
+ if (keep_set) {
+ fprintf(stderr, "argument --rm / -j or --keep / -k already set\n");
+ return COMMAND_INVALID;
+ }
+ keep_set = BROTLI_TRUE;
+ params->junk_source = BROTLI_FALSE;
+ } else if (strcmp("no-copy-stat", arg) == 0) {
+ if (!params->copy_stat) {
+ fprintf(stderr, "argument --no-copy-stat / -n already set\n");
+ return COMMAND_INVALID;
+ }
+ params->copy_stat = BROTLI_FALSE;
+ } else if (strcmp("rm", arg) == 0) {
+ if (keep_set) {
+ fprintf(stderr, "argument --rm / -j or --keep / -k already set\n");
+ return COMMAND_INVALID;
+ }
+ keep_set = BROTLI_TRUE;
+ params->junk_source = BROTLI_TRUE;
+ } else if (strcmp("stdout", arg) == 0) {
+ if (output_set) {
+ fprintf(stderr, "write to standard output already set\n");
+ return COMMAND_INVALID;
+ }
+ output_set = BROTLI_TRUE;
+ params->write_to_stdout = BROTLI_TRUE;
+ } else if (strcmp("test", arg) == 0) {
+ if (command_set) {
+ fprintf(stderr, "command already set when parsing --test\n");
+ return COMMAND_INVALID;
+ }
+ command_set = BROTLI_TRUE;
+ command = COMMAND_TEST_INTEGRITY;
+ } else if (strcmp("verbose", arg) == 0) {
+ if (params->verbosity > 0) {
+ fprintf(stderr, "argument --verbose / -v already set\n");
+ return COMMAND_INVALID;
+ }
+ params->verbosity = 1;
+ } else if (strcmp("version", arg) == 0) {
+ /* Don't parse further. */
+ return COMMAND_VERSION;
+ } else {
+ /* key=value */
+ const char* value = strrchr(arg, '=');
+ size_t key_len;
+ if (!value || value[1] == 0) {
+ fprintf(stderr, "must pass the parameter as --%s=value\n", arg);
+ return COMMAND_INVALID;
+ }
+ key_len = (size_t)(value - arg);
+ value++;
+ if (strncmp("lgwin", arg, key_len) == 0) {
+ if (lgwin_set) {
+ fprintf(stderr, "lgwin parameter already set\n");
+ return COMMAND_INVALID;
+ }
+ lgwin_set = ParseInt(value, 0,
+ BROTLI_MAX_WINDOW_BITS, &params->lgwin);
+ if (!lgwin_set) {
+ fprintf(stderr, "error parsing lgwin value [%s]\n", value);
+ return COMMAND_INVALID;
+ }
+ if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) {
+ fprintf(stderr,
+ "lgwin parameter (%d) smaller than the minimum (%d)\n",
+ params->lgwin, BROTLI_MIN_WINDOW_BITS);
+ return COMMAND_INVALID;
+ }
+ } else if (strncmp("large_window", arg, key_len) == 0) {
+ /* This option is intentionally not mentioned in help. */
+ if (lgwin_set) {
+ fprintf(stderr, "lgwin parameter already set\n");
+ return COMMAND_INVALID;
+ }
+ lgwin_set = ParseInt(value, 0,
+ BROTLI_LARGE_MAX_WINDOW_BITS, &params->lgwin);
+ if (!lgwin_set) {
+ fprintf(stderr, "error parsing lgwin value [%s]\n", value);
+ return COMMAND_INVALID;
+ }
+ if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) {
+ fprintf(stderr,
+ "lgwin parameter (%d) smaller than the minimum (%d)\n",
+ params->lgwin, BROTLI_MIN_WINDOW_BITS);
+ return COMMAND_INVALID;
+ }
+ } else if (strncmp("output", arg, key_len) == 0) {
+ if (output_set) {
+ fprintf(stderr,
+ "write to standard output already set (--output)\n");
+ return COMMAND_INVALID;
+ }
+ params->output_path = value;
+ } else if (strncmp("quality", arg, key_len) == 0) {
+ if (quality_set) {
+ fprintf(stderr, "quality already set\n");
+ return COMMAND_INVALID;
+ }
+ quality_set = ParseInt(value, BROTLI_MIN_QUALITY,
+ BROTLI_MAX_QUALITY, &params->quality);
+ if (!quality_set) {
+ fprintf(stderr, "error parsing quality value [%s]\n", value);
+ return COMMAND_INVALID;
+ }
+ } else if (strncmp("suffix", arg, key_len) == 0) {
+ if (suffix_set) {
+ fprintf(stderr, "suffix already set\n");
+ return COMMAND_INVALID;
+ }
+ suffix_set = BROTLI_TRUE;
+ params->suffix = value;
+ } else {
+ fprintf(stderr, "invalid parameter: [%s]\n", arg);
+ return COMMAND_INVALID;
+ }
+ }
+ }
+ }
+
+ params->input_count = input_count;
+ params->longest_path_len = longest_path_len;
+ params->decompress = (command == COMMAND_DECOMPRESS);
+ params->test_integrity = (command == COMMAND_TEST_INTEGRITY);
+
+ if (input_count > 1 && output_set) return COMMAND_INVALID;
+ if (params->test_integrity) {
+ if (params->output_path) return COMMAND_INVALID;
+ if (params->write_to_stdout) return COMMAND_INVALID;
+ }
+ if (strchr(params->suffix, '/') || strchr(params->suffix, '\\')) {
+ return COMMAND_INVALID;
+ }
+
+ return command;
+}
+
+static void PrintVersion(void) {
+ int major = BROTLI_VERSION >> 24;
+ int minor = (BROTLI_VERSION >> 12) & 0xFFF;
+ int patch = BROTLI_VERSION & 0xFFF;
+ fprintf(stdout, "brotli %d.%d.%d\n", major, minor, patch);
+}
+
+static void PrintHelp(const char* name, BROTLI_BOOL error) {
+ FILE* media = error ? stderr : stdout;
+ /* String is cut to pieces with length less than 509, to conform C90 spec. */
+ fprintf(media,
+"Usage: %s [OPTION]... [FILE]...\n",
+ name);
+ fprintf(media,
+"Options:\n"
+" -# compression level (0-9)\n"
+" -c, --stdout write on standard output\n"
+" -d, --decompress decompress\n"
+" -f, --force force output file overwrite\n"
+" -h, --help display this help and exit\n");
+ fprintf(media,
+" -j, --rm remove source file(s)\n"
+" -k, --keep keep source file(s) (default)\n"
+" -n, --no-copy-stat do not copy source file(s) attributes\n"
+" -o FILE, --output=FILE output file (only if 1 input file)\n");
+ fprintf(media,
+" -q NUM, --quality=NUM compression level (%d-%d)\n",
+ BROTLI_MIN_QUALITY, BROTLI_MAX_QUALITY);
+ fprintf(media,
+" -t, --test test compressed file integrity\n"
+" -v, --verbose verbose mode\n");
+ fprintf(media,
+" -w NUM, --lgwin=NUM set LZ77 window size (0, %d-%d)\n"
+" window size = 2**NUM - 16\n"
+" 0 lets compressor choose the optimal value\n",
+ BROTLI_MIN_WINDOW_BITS, BROTLI_MAX_WINDOW_BITS);
+ fprintf(media,
+" --large_window=NUM use incompatible large-window brotli\n"
+" bitstream with window size (0, %d-%d)\n"
+" WARNING: this format is not compatible\n"
+" with brotli RFC 7932 and may not be\n"
+" decodable with regular brotli decoders\n",
+ BROTLI_MIN_WINDOW_BITS, BROTLI_LARGE_MAX_WINDOW_BITS);
+ fprintf(media,
+" -S SUF, --suffix=SUF output file suffix (default:'%s')\n",
+ DEFAULT_SUFFIX);
+ fprintf(media,
+" -V, --version display version and exit\n"
+" -Z, --best use best compression level (11) (default)\n"
+"Simple options could be coalesced, i.e. '-9kf' is equivalent to '-9 -k -f'.\n"
+"With no FILE, or when FILE is -, read standard input.\n"
+"All arguments after '--' are treated as files.\n");
+}
+
+static const char* PrintablePath(const char* path) {
+ return path ? path : "con";
+}
+
+static BROTLI_BOOL OpenInputFile(const char* input_path, FILE** f) {
+ *f = NULL;
+ if (!input_path) {
+ *f = fdopen(MAKE_BINARY(STDIN_FILENO), "rb");
+ return BROTLI_TRUE;
+ }
+ *f = fopen(input_path, "rb");
+ if (!*f) {
+ fprintf(stderr, "failed to open input file [%s]: %s\n",
+ PrintablePath(input_path), strerror(errno));
+ return BROTLI_FALSE;
+ }
+ return BROTLI_TRUE;
+}
+
+static BROTLI_BOOL OpenOutputFile(const char* output_path, FILE** f,
+ BROTLI_BOOL force) {
+ int fd;
+ *f = NULL;
+ if (!output_path) {
+ *f = fdopen(MAKE_BINARY(STDOUT_FILENO), "wb");
+ return BROTLI_TRUE;
+ }
+ fd = open(output_path, O_CREAT | (force ? 0 : O_EXCL) | O_WRONLY | O_TRUNC,
+ S_IRUSR | S_IWUSR);
+ if (fd < 0) {
+ fprintf(stderr, "failed to open output file [%s]: %s\n",
+ PrintablePath(output_path), strerror(errno));
+ return BROTLI_FALSE;
+ }
+ *f = fdopen(fd, "wb");
+ if (!*f) {
+ fprintf(stderr, "failed to open output file [%s]: %s\n",
+ PrintablePath(output_path), strerror(errno));
+ return BROTLI_FALSE;
+ }
+ return BROTLI_TRUE;
+}
+
+static int64_t FileSize(const char* path) {
+ FILE* f = fopen(path, "rb");
+ int64_t retval;
+ if (f == NULL) {
+ return -1;
+ }
+ if (fseek(f, 0L, SEEK_END) != 0) {
+ fclose(f);
+ return -1;
+ }
+ retval = ftell(f);
+ if (fclose(f) != 0) {
+ return -1;
+ }
+ return retval;
+}
+
+/* Copy file times and permissions.
+ TODO: this is a "best effort" implementation; honest cross-platform
+ fully featured implementation is way too hacky; add more hacks by request. */
+static void CopyStat(const char* input_path, const char* output_path) {
+ struct stat statbuf;
+ struct utimbuf times;
+ int res;
+ if (input_path == 0 || output_path == 0) {
+ return;
+ }
+ if (stat(input_path, &statbuf) != 0) {
+ return;
+ }
+ times.actime = statbuf.st_atime;
+ times.modtime = statbuf.st_mtime;
+ utime(output_path, &times);
+ res = chmod(output_path, statbuf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO));
+ if (res != 0) {
+ fprintf(stderr, "setting access bits failed for [%s]: %s\n",
+ PrintablePath(output_path), strerror(errno));
+ }
+ res = chown(output_path, (uid_t)-1, statbuf.st_gid);
+ if (res != 0) {
+ fprintf(stderr, "setting group failed for [%s]: %s\n",
+ PrintablePath(output_path), strerror(errno));
+ }
+ res = chown(output_path, statbuf.st_uid, (gid_t)-1);
+ if (res != 0) {
+ fprintf(stderr, "setting user failed for [%s]: %s\n",
+ PrintablePath(output_path), strerror(errno));
+ }
+}
+
+static BROTLI_BOOL NextFile(Context* context) {
+ const char* arg;
+ size_t arg_len;
+
+ /* Iterator points to last used arg; increment to search for the next one. */
+ context->iterator++;
+
+ context->input_file_length = -1;
+
+ /* No input path; read from console. */
+ if (context->input_count == 0) {
+ if (context->iterator > 1) return BROTLI_FALSE;
+ context->current_input_path = NULL;
+ /* Either write to the specified path, or to console. */
+ context->current_output_path = context->output_path;
+ return BROTLI_TRUE;
+ }
+
+ /* Skip option arguments. */
+ while (context->iterator == context->not_input_indices[context->ignore]) {
+ context->iterator++;
+ context->ignore++;
+ }
+
+ /* All args are scanned already. */
+ if (context->iterator >= context->argc) return BROTLI_FALSE;
+
+ /* Iterator now points to the input file name. */
+ arg = context->argv[context->iterator];
+ arg_len = strlen(arg);
+ /* Read from console. */
+ if (arg_len == 1 && arg[0] == '-') {
+ context->current_input_path = NULL;
+ context->current_output_path = context->output_path;
+ return BROTLI_TRUE;
+ }
+
+ context->current_input_path = arg;
+ context->input_file_length = FileSize(arg);
+ context->current_output_path = context->output_path;
+
+ if (context->output_path) return BROTLI_TRUE;
+ if (context->write_to_stdout) return BROTLI_TRUE;
+
+ strcpy(context->modified_path, arg);
+ context->current_output_path = context->modified_path;
+ /* If output is not specified, input path suffix should match. */
+ if (context->decompress) {
+ size_t suffix_len = strlen(context->suffix);
+ char* name = (char*)FileName(context->modified_path);
+ char* name_suffix;
+ size_t name_len = strlen(name);
+ if (name_len < suffix_len + 1) {
+ fprintf(stderr, "empty output file name for [%s] input file\n",
+ PrintablePath(arg));
+ context->iterator_error = BROTLI_TRUE;
+ return BROTLI_FALSE;
+ }
+ name_suffix = name + name_len - suffix_len;
+ if (strcmp(context->suffix, name_suffix) != 0) {
+ fprintf(stderr, "input file [%s] suffix mismatch\n",
+ PrintablePath(arg));
+ context->iterator_error = BROTLI_TRUE;
+ return BROTLI_FALSE;
+ }
+ name_suffix[0] = 0;
+ return BROTLI_TRUE;
+ } else {
+ strcpy(context->modified_path + arg_len, context->suffix);
+ return BROTLI_TRUE;
+ }
+}
+
+static BROTLI_BOOL OpenFiles(Context* context) {
+ BROTLI_BOOL is_ok = OpenInputFile(context->current_input_path, &context->fin);
+ if (!context->test_integrity && is_ok) {
+ is_ok = OpenOutputFile(
+ context->current_output_path, &context->fout, context->force_overwrite);
+ }
+ return is_ok;
+}
+
+static BROTLI_BOOL CloseFiles(Context* context, BROTLI_BOOL success) {
+ BROTLI_BOOL is_ok = BROTLI_TRUE;
+ if (!context->test_integrity && context->fout) {
+ if (!success && context->current_output_path) {
+ unlink(context->current_output_path);
+ }
+ if (fclose(context->fout) != 0) {
+ if (success) {
+ fprintf(stderr, "fclose failed [%s]: %s\n",
+ PrintablePath(context->current_output_path), strerror(errno));
+ }
+ is_ok = BROTLI_FALSE;
+ }
+
+ /* TOCTOU violation, but otherwise it is impossible to set file times. */
+ if (success && is_ok && context->copy_stat) {
+ CopyStat(context->current_input_path, context->current_output_path);
+ }
+ }
+
+ if (context->fin) {
+ if (fclose(context->fin) != 0) {
+ if (is_ok) {
+ fprintf(stderr, "fclose failed [%s]: %s\n",
+ PrintablePath(context->current_input_path), strerror(errno));
+ }
+ is_ok = BROTLI_FALSE;
+ }
+ }
+ if (success && context->junk_source && context->current_input_path) {
+ unlink(context->current_input_path);
+ }
+
+ context->fin = NULL;
+ context->fout = NULL;
+
+ return is_ok;
+}
+
+static const size_t kFileBufferSize = 1 << 19;
+
+static void InitializeBuffers(Context* context) {
+ context->available_in = 0;
+ context->next_in = NULL;
+ context->available_out = kFileBufferSize;
+ context->next_out = context->output;
+ context->total_in = 0;
+ context->total_out = 0;
+}
+
+static BROTLI_BOOL HasMoreInput(Context* context) {
+ return feof(context->fin) ? BROTLI_FALSE : BROTLI_TRUE;
+}
+
+static BROTLI_BOOL ProvideInput(Context* context) {
+ context->available_in =
+ fread(context->input, 1, kFileBufferSize, context->fin);
+ context->total_in += context->available_in;
+ context->next_in = context->input;
+ if (ferror(context->fin)) {
+ fprintf(stderr, "failed to read input [%s]: %s\n",
+ PrintablePath(context->current_input_path), strerror(errno));
+ return BROTLI_FALSE;
+ }
+ return BROTLI_TRUE;
+}
+
+/* Internal: should be used only in Provide-/Flush-Output. */
+static BROTLI_BOOL WriteOutput(Context* context) {
+ size_t out_size = (size_t)(context->next_out - context->output);
+ context->total_out += out_size;
+ if (out_size == 0) return BROTLI_TRUE;
+ if (context->test_integrity) return BROTLI_TRUE;
+
+ fwrite(context->output, 1, out_size, context->fout);
+ if (ferror(context->fout)) {
+ fprintf(stderr, "failed to write output [%s]: %s\n",
+ PrintablePath(context->current_output_path), strerror(errno));
+ return BROTLI_FALSE;
+ }
+ return BROTLI_TRUE;
+}
+
+static BROTLI_BOOL ProvideOutput(Context* context) {
+ if (!WriteOutput(context)) return BROTLI_FALSE;
+ context->available_out = kFileBufferSize;
+ context->next_out = context->output;
+ return BROTLI_TRUE;
+}
+
+static BROTLI_BOOL FlushOutput(Context* context) {
+ if (!WriteOutput(context)) return BROTLI_FALSE;
+ context->available_out = 0;
+ return BROTLI_TRUE;
+}
+
+static void PrintBytes(size_t value) {
+ if (value < 1024) {
+ fprintf(stderr, "%d B", (int)value);
+ } else if (value < 1048576) {
+ fprintf(stderr, "%0.3f KiB", (double)value / 1024.0);
+ } else if (value < 1073741824) {
+ fprintf(stderr, "%0.3f MiB", (double)value / 1048576.0);
+ } else {
+ fprintf(stderr, "%0.3f GiB", (double)value / 1073741824.0);
+ }
+}
+
+static void PrintFileProcessingProgress(Context* context) {
+ fprintf(stderr, "[%s]: ", PrintablePath(context->current_input_path));
+ PrintBytes(context->total_in);
+ fprintf(stderr, " -> ");
+ PrintBytes(context->total_out);
+}
+
+static BROTLI_BOOL DecompressFile(Context* context, BrotliDecoderState* s) {
+ BrotliDecoderResult result = BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT;
+ InitializeBuffers(context);
+ for (;;) {
+ if (result == BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT) {
+ if (!HasMoreInput(context)) {
+ fprintf(stderr, "corrupt input [%s]\n",
+ PrintablePath(context->current_input_path));
+ return BROTLI_FALSE;
+ }
+ if (!ProvideInput(context)) return BROTLI_FALSE;
+ } else if (result == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {
+ if (!ProvideOutput(context)) return BROTLI_FALSE;
+ } else if (result == BROTLI_DECODER_RESULT_SUCCESS) {
+ if (!FlushOutput(context)) return BROTLI_FALSE;
+ if (context->available_in != 0 || HasMoreInput(context)) {
+ fprintf(stderr, "corrupt input [%s]\n",
+ PrintablePath(context->current_input_path));
+ return BROTLI_FALSE;
+ }
+ if (context->verbosity > 0) {
+ fprintf(stderr, "Decompressed ");
+ PrintFileProcessingProgress(context);
+ fprintf(stderr, "\n");
+ }
+ return BROTLI_TRUE;
+ } else {
+ fprintf(stderr, "corrupt input [%s]\n",
+ PrintablePath(context->current_input_path));
+ return BROTLI_FALSE;
+ }
+
+ result = BrotliDecoderDecompressStream(s, &context->available_in,
+ &context->next_in, &context->available_out, &context->next_out, 0);
+ }
+}
+
+static BROTLI_BOOL DecompressFiles(Context* context) {
+ while (NextFile(context)) {
+ BROTLI_BOOL is_ok = BROTLI_TRUE;
+ BrotliDecoderState* s = BrotliDecoderCreateInstance(NULL, NULL, NULL);
+ if (!s) {
+ fprintf(stderr, "out of memory\n");
+ return BROTLI_FALSE;
+ }
+ /* This allows decoding "large-window" streams. Though it creates
+ fragmentation (new builds decode streams that old builds don't),
+ it is better from used experience perspective. */
+ BrotliDecoderSetParameter(s, BROTLI_DECODER_PARAM_LARGE_WINDOW, 1u);
+ is_ok = OpenFiles(context);
+ if (is_ok && !context->current_input_path &&
+ !context->force_overwrite && isatty(STDIN_FILENO)) {
+ fprintf(stderr, "Use -h help. Use -f to force input from a terminal.\n");
+ is_ok = BROTLI_FALSE;
+ }
+ if (is_ok) is_ok = DecompressFile(context, s);
+ BrotliDecoderDestroyInstance(s);
+ if (!CloseFiles(context, is_ok)) is_ok = BROTLI_FALSE;
+ if (!is_ok) return BROTLI_FALSE;
+ }
+ return BROTLI_TRUE;
+}
+
+static BROTLI_BOOL CompressFile(Context* context, BrotliEncoderState* s) {
+ BROTLI_BOOL is_eof = BROTLI_FALSE;
+ InitializeBuffers(context);
+ for (;;) {
+ if (context->available_in == 0 && !is_eof) {
+ if (!ProvideInput(context)) return BROTLI_FALSE;
+ is_eof = !HasMoreInput(context);
+ }
+
+ if (!BrotliEncoderCompressStream(s,
+ is_eof ? BROTLI_OPERATION_FINISH : BROTLI_OPERATION_PROCESS,
+ &context->available_in, &context->next_in,
+ &context->available_out, &context->next_out, NULL)) {
+ /* Should detect OOM? */
+ fprintf(stderr, "failed to compress data [%s]\n",
+ PrintablePath(context->current_input_path));
+ return BROTLI_FALSE;
+ }
+
+ if (context->available_out == 0) {
+ if (!ProvideOutput(context)) return BROTLI_FALSE;
+ }
+
+ if (BrotliEncoderIsFinished(s)) {
+ if (!FlushOutput(context)) return BROTLI_FALSE;
+ if (context->verbosity > 0) {
+ fprintf(stderr, "Compressed ");
+ PrintFileProcessingProgress(context);
+ fprintf(stderr, "\n");
+ }
+ return BROTLI_TRUE;
+ }
+ }
+}
+
+static BROTLI_BOOL CompressFiles(Context* context) {
+ while (NextFile(context)) {
+ BROTLI_BOOL is_ok = BROTLI_TRUE;
+ BrotliEncoderState* s = BrotliEncoderCreateInstance(NULL, NULL, NULL);
+ if (!s) {
+ fprintf(stderr, "out of memory\n");
+ return BROTLI_FALSE;
+ }
+ BrotliEncoderSetParameter(s,
+ BROTLI_PARAM_QUALITY, (uint32_t)context->quality);
+ if (context->lgwin > 0) {
+ /* Specified by user. */
+ /* Do not enable "large-window" extension, if not required. */
+ if (context->lgwin > BROTLI_MAX_WINDOW_BITS) {
+ BrotliEncoderSetParameter(s, BROTLI_PARAM_LARGE_WINDOW, 1u);
+ }
+ BrotliEncoderSetParameter(s,
+ BROTLI_PARAM_LGWIN, (uint32_t)context->lgwin);
+ } else {
+ /* 0, or not specified by user; could be chosen by compressor. */
+ uint32_t lgwin = DEFAULT_LGWIN;
+ /* Use file size to limit lgwin. */
+ if (context->input_file_length >= 0) {
+ lgwin = BROTLI_MIN_WINDOW_BITS;
+ while (BROTLI_MAX_BACKWARD_LIMIT(lgwin) <
+ (uint64_t)context->input_file_length) {
+ lgwin++;
+ if (lgwin == BROTLI_MAX_WINDOW_BITS) break;
+ }
+ }
+ BrotliEncoderSetParameter(s, BROTLI_PARAM_LGWIN, lgwin);
+ }
+ if (context->input_file_length > 0) {
+ uint32_t size_hint = context->input_file_length < (1 << 30) ?
+ (uint32_t)context->input_file_length : (1u << 30);
+ BrotliEncoderSetParameter(s, BROTLI_PARAM_SIZE_HINT, size_hint);
+ }
+ is_ok = OpenFiles(context);
+ if (is_ok && !context->current_output_path &&
+ !context->force_overwrite && isatty(STDOUT_FILENO)) {
+ fprintf(stderr, "Use -h help. Use -f to force output to a terminal.\n");
+ is_ok = BROTLI_FALSE;
+ }
+ if (is_ok) is_ok = CompressFile(context, s);
+ BrotliEncoderDestroyInstance(s);
+ if (!CloseFiles(context, is_ok)) is_ok = BROTLI_FALSE;
+ if (!is_ok) return BROTLI_FALSE;
+ }
+ return BROTLI_TRUE;
+}
+
+int main(int argc, char** argv) {
+ Command command;
+ Context context;
+ BROTLI_BOOL is_ok = BROTLI_TRUE;
+ int i;
+
+ context.quality = 11;
+ context.lgwin = -1;
+ context.verbosity = 0;
+ context.force_overwrite = BROTLI_FALSE;
+ context.junk_source = BROTLI_FALSE;
+ context.copy_stat = BROTLI_TRUE;
+ context.test_integrity = BROTLI_FALSE;
+ context.write_to_stdout = BROTLI_FALSE;
+ context.decompress = BROTLI_FALSE;
+ context.large_window = BROTLI_FALSE;
+ context.output_path = NULL;
+ context.suffix = DEFAULT_SUFFIX;
+ for (i = 0; i < MAX_OPTIONS; ++i) context.not_input_indices[i] = 0;
+ context.longest_path_len = 1;
+ context.input_count = 0;
+
+ context.argc = argc;
+ context.argv = argv;
+ context.modified_path = NULL;
+ context.iterator = 0;
+ context.ignore = 0;
+ context.iterator_error = BROTLI_FALSE;
+ context.buffer = NULL;
+ context.current_input_path = NULL;
+ context.current_output_path = NULL;
+ context.fin = NULL;
+ context.fout = NULL;
+
+ command = ParseParams(&context);
+
+ if (command == COMMAND_COMPRESS || command == COMMAND_DECOMPRESS ||
+ command == COMMAND_TEST_INTEGRITY) {
+ if (is_ok) {
+ size_t modified_path_len =
+ context.longest_path_len + strlen(context.suffix) + 1;
+ context.modified_path = (char*)malloc(modified_path_len);
+ context.buffer = (uint8_t*)malloc(kFileBufferSize * 2);
+ if (!context.modified_path || !context.buffer) {
+ fprintf(stderr, "out of memory\n");
+ is_ok = BROTLI_FALSE;
+ } else {
+ context.input = context.buffer;
+ context.output = context.buffer + kFileBufferSize;
+ }
+ }
+ }
+
+ if (!is_ok) command = COMMAND_NOOP;
+
+ switch (command) {
+ case COMMAND_NOOP:
+ break;
+
+ case COMMAND_VERSION:
+ PrintVersion();
+ break;
+
+ case COMMAND_COMPRESS:
+ is_ok = CompressFiles(&context);
+ break;
+
+ case COMMAND_DECOMPRESS:
+ case COMMAND_TEST_INTEGRITY:
+ is_ok = DecompressFiles(&context);
+ break;
+
+ case COMMAND_HELP:
+ case COMMAND_INVALID:
+ default:
+ is_ok = (command == COMMAND_HELP);
+ PrintHelp(FileName(argv[0]), is_ok);
+ break;
+ }
+
+ if (context.iterator_error) is_ok = BROTLI_FALSE;
+
+ free(context.modified_path);
+ free(context.buffer);
+
+ if (!is_ok) exit(1);
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/tools/brotli.md b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/tools/brotli.md
new file mode 100644
index 000000000..c029869bc
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/c/tools/brotli.md
@@ -0,0 +1,107 @@
+brotli(1) -- brotli, unbrotli - compress or decompress files
+================================================================
+
+SYNOPSIS
+--------
+
+`brotli` [*OPTION|FILE*]...
+
+`unbrotli` is equivalent to `brotli --decompress`
+
+DESCRIPTION
+-----------
+`brotli` is a generic-purpose lossless compression algorithm that compresses
+data using a combination of a modern variant of the **LZ77** algorithm, Huffman
+coding and 2-nd order context modeling, with a compression ratio comparable to
+the best currently available general-purpose compression methods. It is similar
+in speed with deflate but offers more dense compression.
+
+`brotli` command line syntax similar to `gzip (1)` and `zstd (1)`.
+Unlike `gzip (1)`, source files are preserved by default. It is possible to
+remove them after processing by using the `--rm` _option_.
+
+Arguments that look like "`--name`" or "`--name=value`" are _options_. Every
+_option_ has a short form "`-x`" or "`-x value`". Multiple short form _options_
+could be coalesced:
+
+* "`--decompress --stdout --suffix=.b`" works the same as
+* "`-d -s -S .b`" and
+* "`-dsS .b`"
+
+`brotli` has 3 operation modes:
+
+* default mode is compression;
+* `--decompress` option activates decompression mode;
+* `--test` option switches to integrity test mode; this option is equivalent to
+ "`--decompress --stdout`" except that the decompressed data is discarded
+ instead of being written to standard output.
+
+Every non-option argument is a _file_ entry. If no _files_ are given or _file_
+is "`-`", `brotli` reads from standard input. All arguments after "`--`" are
+_file_ entries.
+
+Unless `--stdout` or `--output` is specified, _files_ are written to a new file
+whose name is derived from the source _file_ name:
+
+* when compressing, a suffix is appended to the source filename to
+ get the target filename
+* when decompressing, a suffix is removed from the source filename to
+ get the target filename
+
+Default suffix is `.br`, but it could be specified with `--suffix` option.
+
+Conflicting or duplicate _options_ are not allowed.
+
+OPTIONS
+-------
+
+* `-#`:
+ compression level (0-9); bigger values cause denser, but slower compression
+* `-c`, `--stdout`:
+ write on standard output
+* `-d`, `--decompress`:
+ decompress mode
+* `-f`, `--force`:
+ force output file overwrite
+* `-h`, `--help`:
+ display this help and exit
+* `-j`, `--rm`:
+ remove source file(s); `gzip (1)`-like behaviour
+* `-k`, `--keep`:
+ keep source file(s); `zstd (1)`-like behaviour
+* `-n`, `--no-copy-stat`:
+ do not copy source file(s) attributes
+* `-o FILE`, `--output=FILE`
+ output file; valid only if there is a single input entry
+* `-q NUM`, `--quality=NUM`:
+ compression level (0-11); bigger values cause denser, but slower compression
+* `-t`, `--test`:
+ test file integrity mode
+* `-v`, `--verbose`:
+ increase output verbosity
+* `-w NUM`, `--lgwin=NUM`:
+ set LZ77 window size (0, 10-24) (default: 22); window size is
+ `(2**NUM - 16)`; 0 lets compressor decide over the optimal value; bigger
+ windows size improve density; decoder might require up to window size
+ memory to operate
+* `-S SUF`, `--suffix=SUF`:
+ output file suffix (default: `.br`)
+* `-V`, `--version`:
+ display version and exit
+* `-Z`, `--best`:
+ use best compression level (default); same as "`-q 11`"
+
+SEE ALSO
+--------
+
+`brotli` file format is defined in
+[RFC 7932](https://www.ietf.org/rfc/rfc7932.txt).
+
+`brotli` is open-sourced under the
+[MIT License](https://opensource.org/licenses/MIT).
+
+Mailing list: https://groups.google.com/forum/#!forum/brotli
+
+BUGS
+----
+Report bugs at: https://github.com/google/brotli/issues
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/compiler_config_setting.bzl b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/compiler_config_setting.bzl
new file mode 100755
index 000000000..572032bf7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/compiler_config_setting.bzl
@@ -0,0 +1,28 @@
+# Copyright 2018 Google Inc. All Rights Reserved.
+#
+# Distributed under MIT license.
+# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+"""Creates config_setting that allows selecting based on 'compiler' value."""
+
+def create_msvc_config():
+ # The "do_not_use_tools_cpp_compiler_present" attribute exists to
+ # distinguish between older versions of Bazel that do not support
+ # "@bazel_tools//tools/cpp:compiler" flag_value, and newer ones that do.
+ # In the future, the only way to select on the compiler will be through
+ # flag_values{"@bazel_tools//tools/cpp:compiler"} and the else branch can
+ # be removed.
+ if hasattr(cc_common, "do_not_use_tools_cpp_compiler_present"):
+ native.config_setting(
+ name = "msvc",
+ flag_values = {
+ "@bazel_tools//tools/cpp:compiler": "msvc-cl",
+ },
+ visibility = ["//visibility:public"],
+ )
+ else:
+ native.config_setting(
+ name = "msvc",
+ values = {"compiler": "msvc-cl"},
+ visibility = ["//visibility:public"],
+ )
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/configure b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/configure
new file mode 100755
index 000000000..d96129a44
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/configure
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+echo "Use Autotools, Bazel, CMake or Premake5 to generate projects / build files."
+echo " Bazel: http://www.bazel.build/"
+echo " CMake: https://cmake.org/"
+echo " Premake5: https://premake.github.io/"
+echo "To generate Autotools 'configure' file run './bootstrap'."
+echo "Run './configure-cmake' for Autotools-like CMake configuration."
+echo "Or simply run 'make' to build and test command line tool."
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/configure-cmake b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/configure-cmake
new file mode 100755
index 000000000..6dfb92c4e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/configure-cmake
@@ -0,0 +1,318 @@
+#!/usr/bin/env bash
+
+# Autotools-style (./configure) wrapper for CMake
+# <https://github.com/nemequ/configure-cmake>
+#
+# *** IMPORTANT ***
+#
+# You must include the GNUInstallDirs module (which comes with
+# CMake) in your project. Just put "include (GNUInstallDirs)" in
+# you CMakeLists.txt and you should be good.
+#
+# This script was originally written for Squash
+# <https://quixdb.github.io/squash/> by Evan Nemerson
+# <evan@nemerson.com>, but has been spun off into a separate
+# repository. Please feel free to copy it into your own repository,
+# though I would appreciate it if you would post improvements, bugs,
+# feature requests, etc. to the issue tracker at
+# <https://github.com/nemequ/configure-cmake/issues>.
+#
+# To the extent possible under law, the author(s) hereby waive all
+# copyright and related or neighboring rights to this work. For
+# details, see <https://creativecommons.org/publicdomain/zero/1.0/>
+
+TOP_SRCDIR="$(dirname $0)"
+
+if [ "${CMAKE_CMD}" = "" ]; then
+ CMAKE_CMD="cmake"
+fi
+
+BUILD_TYPE="Debug"
+PREFIX=/usr/local
+LIBDIR=
+CMAKE_ARGS=
+
+if [ -e "${TOP_SRCDIR}/scripts/.configure-custom.sh" ]; then
+ . "${TOP_SRCDIR}/scripts/.configure-custom.sh"
+fi
+
+quote() {
+ echo "$1" | sed -e "s|'|'\\\\''|g; 1s/^/'/; \$s/\$/'/"
+}
+
+extract_var_string() {
+ VAR_NAME=$1
+ VAR_NAME=$(echo $1 | sed -e 's/[ \t]*$//')
+ if [ "x$2" != "x" ]; then
+ VAR_VALUE=$2
+ else
+ VAR_VALUE=yes
+ fi
+
+ if [ "x$3" != "x" ]; then
+ VAR_UC_NAME=$3
+ else
+ VAR_UC_NAME=$(echo "$1" | tr '[:lower:]' '[:upper:]' | tr -c '[:alnum:]' '_' | sed 's/_$//g')
+ fi
+}
+
+set_config_var() {
+ is_with=n
+ case "$1" in
+ "--enable-"*)
+ name="${1#--enable-}"
+ cfg="${ENABLE_VARS}"
+ ;;
+ "--disable-"*)
+ name="${1#--disable-}";
+ cfg="${DISABLE_VARS}";
+ ;;
+ "--with-"*)
+ # IFS="=" read -ra WITHARGS <<< "${1}"
+ name="${1#--with-}"
+ cfg="${WITH_VARS}"
+ is_with=y
+ ;;
+ esac
+
+ found=n
+ for varstring in $cfg; do
+ extract_var_string $(echo "${varstring}" | tr '|' ' ')
+ if [ "x$VAR_NAME" = "x$name" ]; then
+ found=y
+ break;
+ fi
+ done
+
+ if [ "$found" = "y" ]; then
+ if [ "x$is_with" = "xy" ]; then
+ CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "$2")"
+ else
+ CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "${VAR_VALUE}")"
+ fi
+ else
+ echo "Unknown parameter: ${1}"
+ exit 1
+ fi
+}
+
+prefix_to_offset() {
+ expr $(echo "${1}" | awk '{ print length }') + 1
+}
+
+print_help() {
+ cat <<EOF >&2
+ -h, --help display this help and exit
+ --disable-debug disable debugging mode
+ --pass-thru pass remaining arguments through to CMake
+
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$PREFIX]
+ --bindir=DIR user executables [PREFIX/bin]
+ --sbindir=DIR system admin executables [PREFIX/sbin]
+ --libexecdir=DIR program executables [PREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [PREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/PROJECT_NAME]
+EOF
+
+ first=y
+ for varstring in ${ENABLE_VARS}; do
+ if [ $first = 'y' ]; then
+ echo ""
+ first=n
+ fi
+ extract_var_string $(echo "${varstring}" | tr '|' ' ')
+ var_doc_name="ENABLE_${VAR_UC_NAME}_DOC"
+ eval "docstring=\$$var_doc_name"
+ if [ "x${docstring}" = "x" ]; then
+ printf " --enable-%-14s enable %s support\n" "${VAR_NAME}" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
+ else
+ printf " --enable-%-14s %s\n" "${VAR_NAME}" "$docstring"
+ fi
+ done
+
+ first=y
+ for varstring in ${DISABLE_VARS}; do
+ if [ $first = 'y' ]; then
+ echo ""
+ first=n
+ fi
+ extract_var_string $(echo "${varstring}" | tr '|' ' ')
+ var_doc_name="DISABLE_${VAR_UC_NAME}_DOC"
+ eval "docstring=\$$var_doc_name"
+ if [ "x${docstring}" = "x" ]; then
+ printf " --disable-%-13s disable %s support\n" "${VAR_NAME}" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
+ else
+ printf " --disable-%-13s %s\n" "${VAR_NAME}" "$docstring"
+ fi
+ done
+
+ first=y
+ for varstring in ${WITH_VARS}; do
+ if [ $first = 'y' ]; then
+ echo ""
+ first=n
+ fi
+ extract_var_string $(echo "${varstring}" | tr '|' ' ')
+ var_doc_name="WITH_${VAR_UC_NAME}_DOC"
+ eval "docstring=\$$var_doc_name"
+ paraminfo="${VAR_NAME}=${VAR_VALUE}"
+ if [ "x${docstring}" = "x" ]; then
+ printf " --with-%-16s enable %s support\n" "$paraminfo" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
+ else
+ printf " --with-%-16s %s\n" "$paraminfo" "$docstring"
+ fi
+ done
+
+ exit 0
+}
+
+while [ $# != 0 ]; do
+ case "$1" in
+ "--prefix="*)
+ PREFIX="${1#*=}";;
+ "--prefix")
+ PREFIX="${2}"; shift;;
+ "--bindir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_BINDIR=$(quote "${1#*=}")";;
+ "--bindir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_BINDIR=$(quote "$2")"; shift;;
+ "--sbindir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SBINDIR=$(quote "${1#*=}")";;
+ "--sbindir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SBINDIR=$(quote "$2")"; shift;;
+ "--libexecdir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LIBEXECDIR=$(quote "${1#*=}")";;
+ "--libexecdir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LIBEXECDIR=$(quote "$2")"; shift;;
+ "--sysconfdir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SYSCONFDIR=$(quote "${1#*=}")";;
+ "--sysconfdir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SYSCONFDIR=$(quote "$2")"; shift;;
+ "--sharedstatedir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SHAREDSTATEDIR=$(quote "${1#*=}")";;
+ "--sharedstatedir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SHAREDSTATEDIR=$(quote "$2")"; shift;;
+ "--localstatedir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALSTATEDIR=$(quote "${1#*=}")";;
+ "--localstatedir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALSTATEDIR=$(quote "$2")"; shift;;
+ "--libdir="*)
+ LIBDIR="${1#*=}";;
+ "--libdir")
+ LIBDIR="${2}"; shift;;
+ "--includedir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INCLUDEDIR=$(quote "${1#*=}")";;
+ "--includedir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INCLUDEDIR=$(quote "$2")"; shift;;
+ "--oldincludedir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_OLDINCLUDEDIR=$(quote "${1#*=}")";;
+ "--oldincludedir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_OLDINCLUDEDIR=$(quote "$2")"; shift;;
+ "--datarootdir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATAROOTDIR=$(quote "${1#*=}")";;
+ "--datarootdir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATAROOTDIR=$(quote "$2")"; shift;;
+ "--datadir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATADIR=$(quote "${1#*=}")";;
+ "--datadir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATADIR=$(quote "$2")"; shift;;
+ "--infodir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INFODIR=$(quote "${1#*=}")";;
+ "--infodir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INFODIR=$(quote "$2")"; shift;;
+ "--localedir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALEDIR=$(quote "${1#*=}")";;
+ "--localedir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALEDIR=$(quote "$2")"; shift;;
+ "--mandir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_MANDIR=$(quote "${1#*=}")";;
+ "--mandir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_MANDIR=$(quote "$2")"; shift;;
+ "--docdir="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DOCDIR=$(quote "${1#*=}")";;
+ "--docdir")
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DOCDIR=$(quote "$2")"; shift;;
+
+ "CC="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_COMPILER=$(quote "${1#*=}")";;
+ "CXX="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_COMPILER=$(quote "${1#*=}")";;
+ "CFLAGS="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_FLAGS=$(quote "${1#*=}")";;
+ "CXXFLAGS="*)
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_FLAGS=$(quote "${1#*=}")";;
+ "LDFLAGS="*)
+ LDFLAGS="$LDFLAGS ${1#*=}";;
+
+ "--help")
+ print_help;;
+ "-h")
+ print_help;;
+
+ # This flag is the only one which may be a bit surprising to
+ # people. Autotools always builds with debugging symbols enabled
+ # (AFAIK), but for cmake you have to do -DCMAKE_BUILD_TYPE=Debug.
+ # Unfortunately this can change other things as well, so although
+ # I realize there is no --disable-debug flag I thought it would be
+ # prudent to support one here.
+ "--disable-debug")
+ BUILD_TYPE="Release";;
+
+ "--pass-thru")
+ shift;
+ while [ $# != 0 ]; do
+ CMAKE_ARGS="$CMAKE_ARGS $(quote "${1}")";
+ shift;
+ done;;
+
+ "--enable-"*)
+ set_config_var "$1"
+ ;;
+
+ "--disable-"*)
+ set_config_var "$1"
+ ;;
+
+ "--with-"*)
+ name=$(echo "${1#--with-}" | awk '{split($1,v,"="); print v[1]}')
+ case "${1}" in
+ "--with-${name}="*)
+ set_config_var "--with-${name}" "${1#--with-${name}=}";;
+ "--with-${name}")
+ set_config_var "$1" "$2";
+ shift;;
+ esac
+ ;;
+
+ *)
+ echo "$0: error: unrecognized option: \`$1'" >&2
+ echo "Try \`$0 --help' for more information" >&2
+ exit -1
+ esac;
+ shift
+done
+
+if [ "x${LIBDIR}" = "x" ]; then
+ LIBDIR="${PREFIX}/lib"
+fi
+
+# Unlike CFLAGS/CXXFLAGS/CC/CXX, LDFLAGS isn't handled by CMake, so we
+# need to parse it here.
+if [ "x${LDFLAGS}" != "x" ]; then
+ for varname in EXE MODULE SHARED STATIC; do
+ CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_${varname}_LINKER_FLAGS=$(quote "$LDFLAGS")"
+ done
+fi
+
+eval "${CMAKE_CMD}" "${TOP_SRCDIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_INSTALL_LIBDIR="${LIBDIR}" ${CMAKE_ARGS}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/configure.ac b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/configure.ac
new file mode 100644
index 000000000..87d579d45
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/configure.ac
@@ -0,0 +1,14 @@
+AC_PREREQ(2.57)
+
+dnl Actual version is substituted by bootstrap
+AC_INIT([brotli], [0.0.0], [https://groups.google.com/forum/#!forum/brotli])
+
+AM_INIT_AUTOMAKE()
+AC_CONFIG_MACRO_DIR([m4])
+
+AC_PROG_CC
+LT_INIT
+
+AC_CONFIG_FILES([Makefile scripts/libbrotlicommon.pc scripts/libbrotlidec.pc scripts/libbrotlienc.pc])
+
+AC_OUTPUT \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/injected_code.txt b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/injected_code.txt
new file mode 100644
index 000000000..64f129b0e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/injected_code.txt
@@ -0,0 +1,32 @@
+// <{[INJECTED CODE]}>
+ public override bool CanRead {
+ get {return true;}
+ }
+
+ public override bool CanSeek {
+ get {return false;}
+ }
+ public override long Length {
+ get {throw new System.NotSupportedException();}
+ }
+ public override long Position {
+ get {throw new System.NotSupportedException();}
+ set {throw new System.NotSupportedException();}
+ }
+ public override long Seek(long offset, System.IO.SeekOrigin origin) {
+ throw new System.NotSupportedException();
+ }
+ public override void SetLength(long value){
+ throw new System.NotSupportedException();
+ }
+
+ public override bool CanWrite{get{return false;}}
+ public override System.IAsyncResult BeginWrite(byte[] buffer, int offset,
+ int count, System.AsyncCallback callback, object state) {
+ throw new System.NotSupportedException();
+ }
+ public override void Write(byte[] buffer, int offset, int count) {
+ throw new System.NotSupportedException();
+ }
+
+ public override void Flush() {}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BitReader.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BitReader.cs
new file mode 100644
index 000000000..d3f1a3fff
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BitReader.cs
@@ -0,0 +1,271 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>Bit reading helpers.</summary>
+ internal sealed class BitReader
+ {
+ /// <summary>
+ /// Input byte buffer, consist of a ring-buffer and a "slack" region where bytes from the start of
+ /// the ring-buffer are copied.
+ /// </summary>
+ private const int Capacity = 1024;
+
+ private const int Slack = 16;
+
+ private const int IntBufferSize = Capacity + Slack;
+
+ private const int ByteReadSize = Capacity << 2;
+
+ private const int ByteBufferSize = IntBufferSize << 2;
+
+ private readonly byte[] byteBuffer = new byte[ByteBufferSize];
+
+ private readonly int[] intBuffer = new int[IntBufferSize];
+
+ private readonly Org.Brotli.Dec.IntReader intReader = new Org.Brotli.Dec.IntReader();
+
+ private System.IO.Stream input;
+
+ /// <summary>Input stream is finished.</summary>
+ private bool endOfStreamReached;
+
+ /// <summary>Pre-fetched bits.</summary>
+ internal long accumulator;
+
+ /// <summary>Current bit-reading position in accumulator.</summary>
+ internal int bitOffset;
+
+ /// <summary>Offset of next item in intBuffer.</summary>
+ private int intOffset;
+
+ private int tailBytes = 0;
+
+ /* Number of bytes in unfinished "int" item. */
+ /// <summary>Fills up the input buffer.</summary>
+ /// <remarks>
+ /// Fills up the input buffer.
+ /// <p> No-op if there are at least 36 bytes present after current position.
+ /// <p> After encountering the end of the input stream, 64 additional zero bytes are copied to the
+ /// buffer.
+ /// </remarks>
+ internal static void ReadMoreInput(Org.Brotli.Dec.BitReader br)
+ {
+ // TODO: Split to check and read; move read outside of decoding loop.
+ if (br.intOffset <= Capacity - 9)
+ {
+ return;
+ }
+ if (br.endOfStreamReached)
+ {
+ if (IntAvailable(br) >= -2)
+ {
+ return;
+ }
+ throw new Org.Brotli.Dec.BrotliRuntimeException("No more input");
+ }
+ int readOffset = br.intOffset << 2;
+ int bytesRead = ByteReadSize - readOffset;
+ System.Array.Copy(br.byteBuffer, readOffset, br.byteBuffer, 0, bytesRead);
+ br.intOffset = 0;
+ try
+ {
+ while (bytesRead < ByteReadSize)
+ {
+ int len = br.input.Read(br.byteBuffer, bytesRead, ByteReadSize - bytesRead);
+ // EOF is -1 in Java, but 0 in C#.
+ if (len <= 0)
+ {
+ br.endOfStreamReached = true;
+ br.tailBytes = bytesRead;
+ bytesRead += 3;
+ break;
+ }
+ bytesRead += len;
+ }
+ }
+ catch (System.IO.IOException e)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Failed to read input", e);
+ }
+ Org.Brotli.Dec.IntReader.Convert(br.intReader, bytesRead >> 2);
+ }
+
+ internal static void CheckHealth(Org.Brotli.Dec.BitReader br, bool endOfStream)
+ {
+ if (!br.endOfStreamReached)
+ {
+ return;
+ }
+ int byteOffset = (br.intOffset << 2) + ((br.bitOffset + 7) >> 3) - 8;
+ if (byteOffset > br.tailBytes)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Read after end");
+ }
+ if (endOfStream && (byteOffset != br.tailBytes))
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Unused bytes after end");
+ }
+ }
+
+ /// <summary>Advances the Read buffer by 5 bytes to make room for reading next 24 bits.</summary>
+ internal static void FillBitWindow(Org.Brotli.Dec.BitReader br)
+ {
+ if (br.bitOffset >= 32)
+ {
+ br.accumulator = ((long)br.intBuffer[br.intOffset++] << 32) | ((long)(((ulong)br.accumulator) >> 32));
+ br.bitOffset -= 32;
+ }
+ }
+
+ /// <summary>Reads the specified number of bits from Read Buffer.</summary>
+ internal static int ReadBits(Org.Brotli.Dec.BitReader br, int n)
+ {
+ FillBitWindow(br);
+ int val = (int)((long)(((ulong)br.accumulator) >> br.bitOffset)) & ((1 << n) - 1);
+ br.bitOffset += n;
+ return val;
+ }
+
+ /// <summary>Initialize bit reader.</summary>
+ /// <remarks>
+ /// Initialize bit reader.
+ /// <p> Initialisation turns bit reader to a ready state. Also a number of bytes is prefetched to
+ /// accumulator. Because of that this method may block until enough data could be read from input.
+ /// </remarks>
+ /// <param name="br">BitReader POJO</param>
+ /// <param name="input">data source</param>
+ internal static void Init(Org.Brotli.Dec.BitReader br, System.IO.Stream input)
+ {
+ if (br.input != null)
+ {
+ throw new System.InvalidOperationException("Bit reader already has associated input stream");
+ }
+ Org.Brotli.Dec.IntReader.Init(br.intReader, br.byteBuffer, br.intBuffer);
+ br.input = input;
+ br.accumulator = 0;
+ br.bitOffset = 64;
+ br.intOffset = Capacity;
+ br.endOfStreamReached = false;
+ Prepare(br);
+ }
+
+ private static void Prepare(Org.Brotli.Dec.BitReader br)
+ {
+ ReadMoreInput(br);
+ CheckHealth(br, false);
+ FillBitWindow(br);
+ FillBitWindow(br);
+ }
+
+ internal static void Reload(Org.Brotli.Dec.BitReader br)
+ {
+ if (br.bitOffset == 64)
+ {
+ Prepare(br);
+ }
+ }
+
+ /// <exception cref="System.IO.IOException"/>
+ internal static void Close(Org.Brotli.Dec.BitReader br)
+ {
+ System.IO.Stream @is = br.input;
+ br.input = null;
+ if (@is != null)
+ {
+ @is.Close();
+ }
+ }
+
+ internal static void JumpToByteBoundary(Org.Brotli.Dec.BitReader br)
+ {
+ int padding = (64 - br.bitOffset) & 7;
+ if (padding != 0)
+ {
+ int paddingBits = Org.Brotli.Dec.BitReader.ReadBits(br, padding);
+ if (paddingBits != 0)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Corrupted padding bits");
+ }
+ }
+ }
+
+ internal static int IntAvailable(Org.Brotli.Dec.BitReader br)
+ {
+ int limit = Capacity;
+ if (br.endOfStreamReached)
+ {
+ limit = (br.tailBytes + 3) >> 2;
+ }
+ return limit - br.intOffset;
+ }
+
+ internal static void CopyBytes(Org.Brotli.Dec.BitReader br, byte[] data, int offset, int length)
+ {
+ if ((br.bitOffset & 7) != 0)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Unaligned copyBytes");
+ }
+ // Drain accumulator.
+ while ((br.bitOffset != 64) && (length != 0))
+ {
+ data[offset++] = unchecked((byte)((long)(((ulong)br.accumulator) >> br.bitOffset)));
+ br.bitOffset += 8;
+ length--;
+ }
+ if (length == 0)
+ {
+ return;
+ }
+ // Get data from shadow buffer with "sizeof(int)" granularity.
+ int copyInts = System.Math.Min(IntAvailable(br), length >> 2);
+ if (copyInts > 0)
+ {
+ int readOffset = br.intOffset << 2;
+ System.Array.Copy(br.byteBuffer, readOffset, data, offset, copyInts << 2);
+ offset += copyInts << 2;
+ length -= copyInts << 2;
+ br.intOffset += copyInts;
+ }
+ if (length == 0)
+ {
+ return;
+ }
+ // Read tail bytes.
+ if (IntAvailable(br) > 0)
+ {
+ // length = 1..3
+ FillBitWindow(br);
+ while (length != 0)
+ {
+ data[offset++] = unchecked((byte)((long)(((ulong)br.accumulator) >> br.bitOffset)));
+ br.bitOffset += 8;
+ length--;
+ }
+ CheckHealth(br, false);
+ return;
+ }
+ // Now it is possible to copy bytes directly.
+ try
+ {
+ while (length > 0)
+ {
+ int len = br.input.Read(data, offset, length);
+ if (len == -1)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Unexpected end of input");
+ }
+ offset += len;
+ length -= len;
+ }
+ }
+ catch (System.IO.IOException e)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Failed to read input", e);
+ }
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BitReaderTest.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BitReaderTest.cs
new file mode 100644
index 000000000..c5403edf7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BitReaderTest.cs
@@ -0,0 +1,33 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>
+ /// Tests for
+ /// <see cref="BitReader"/>
+ /// .
+ /// </summary>
+ public class BitReaderTest
+ {
+ [NUnit.Framework.Test]
+ public virtual void TestReadAfterEos()
+ {
+ Org.Brotli.Dec.BitReader reader = new Org.Brotli.Dec.BitReader();
+ Org.Brotli.Dec.BitReader.Init(reader, new System.IO.MemoryStream(new byte[1]));
+ Org.Brotli.Dec.BitReader.ReadBits(reader, 9);
+ try
+ {
+ Org.Brotli.Dec.BitReader.CheckHealth(reader, false);
+ }
+ catch (Org.Brotli.Dec.BrotliRuntimeException)
+ {
+ // This exception is expected.
+ return;
+ }
+ NUnit.Framework.Assert.Fail("BrotliRuntimeException should have been thrown by BitReader.checkHealth");
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BrotliInputStream.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BrotliInputStream.cs
new file mode 100644
index 000000000..36f8128ea
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BrotliInputStream.cs
@@ -0,0 +1,223 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>
+ /// <see cref="System.IO.Stream"/>
+ /// decorator that decompresses brotli data.
+ /// <p> Not thread-safe.
+ /// </summary>
+ public class BrotliInputStream : System.IO.Stream
+ {
+ public const int DefaultInternalBufferSize = 16384;
+
+ /// <summary>Internal buffer used for efficient byte-by-byte reading.</summary>
+ private byte[] buffer;
+
+ /// <summary>Number of decoded but still unused bytes in internal buffer.</summary>
+ private int remainingBufferBytes;
+
+ /// <summary>Next unused byte offset.</summary>
+ private int bufferOffset;
+
+ /// <summary>Decoder state.</summary>
+ private readonly Org.Brotli.Dec.State state = new Org.Brotli.Dec.State();
+
+ /// <summary>
+ /// Creates a
+ /// <see cref="System.IO.Stream"/>
+ /// wrapper that decompresses brotli data.
+ /// <p> For byte-by-byte reading (
+ /// <see cref="ReadByte()"/>
+ /// ) internal buffer with
+ /// <see cref="DefaultInternalBufferSize"/>
+ /// size is allocated and used.
+ /// <p> Will block the thread until first kilobyte of data of source is available.
+ /// </summary>
+ /// <param name="source">underlying data source</param>
+ /// <exception cref="System.IO.IOException">in case of corrupted data or source stream problems</exception>
+ public BrotliInputStream(System.IO.Stream source)
+ : this(source, DefaultInternalBufferSize, null)
+ {
+ }
+
+ /// <summary>
+ /// Creates a
+ /// <see cref="System.IO.Stream"/>
+ /// wrapper that decompresses brotli data.
+ /// <p> For byte-by-byte reading (
+ /// <see cref="ReadByte()"/>
+ /// ) internal buffer of specified size is
+ /// allocated and used.
+ /// <p> Will block the thread until first kilobyte of data of source is available.
+ /// </summary>
+ /// <param name="source">compressed data source</param>
+ /// <param name="byteReadBufferSize">
+ /// size of internal buffer used in case of
+ /// byte-by-byte reading
+ /// </param>
+ /// <exception cref="System.IO.IOException">in case of corrupted data or source stream problems</exception>
+ public BrotliInputStream(System.IO.Stream source, int byteReadBufferSize)
+ : this(source, byteReadBufferSize, null)
+ {
+ }
+
+ /// <summary>
+ /// Creates a
+ /// <see cref="System.IO.Stream"/>
+ /// wrapper that decompresses brotli data.
+ /// <p> For byte-by-byte reading (
+ /// <see cref="ReadByte()"/>
+ /// ) internal buffer of specified size is
+ /// allocated and used.
+ /// <p> Will block the thread until first kilobyte of data of source is available.
+ /// </summary>
+ /// <param name="source">compressed data source</param>
+ /// <param name="byteReadBufferSize">
+ /// size of internal buffer used in case of
+ /// byte-by-byte reading
+ /// </param>
+ /// <param name="customDictionary">
+ /// custom dictionary data;
+ /// <see langword="null"/>
+ /// if not used
+ /// </param>
+ /// <exception cref="System.IO.IOException">in case of corrupted data or source stream problems</exception>
+ public BrotliInputStream(System.IO.Stream source, int byteReadBufferSize, byte[] customDictionary)
+ {
+ if (byteReadBufferSize <= 0)
+ {
+ throw new System.ArgumentException("Bad buffer size:" + byteReadBufferSize);
+ }
+ else if (source == null)
+ {
+ throw new System.ArgumentException("source is null");
+ }
+ this.buffer = new byte[byteReadBufferSize];
+ this.remainingBufferBytes = 0;
+ this.bufferOffset = 0;
+ try
+ {
+ Org.Brotli.Dec.State.SetInput(state, source);
+ }
+ catch (Org.Brotli.Dec.BrotliRuntimeException ex)
+ {
+ throw new System.IO.IOException("Brotli decoder initialization failed", ex);
+ }
+ if (customDictionary != null)
+ {
+ Org.Brotli.Dec.Decode.SetCustomDictionary(state, customDictionary);
+ }
+ }
+
+ /// <summary><inheritDoc/></summary>
+ /// <exception cref="System.IO.IOException"/>
+ public override void Close()
+ {
+ Org.Brotli.Dec.State.Close(state);
+ }
+
+ /// <summary><inheritDoc/></summary>
+ /// <exception cref="System.IO.IOException"/>
+ public override int ReadByte()
+ {
+ if (bufferOffset >= remainingBufferBytes)
+ {
+ remainingBufferBytes = Read(buffer, 0, buffer.Length);
+ bufferOffset = 0;
+ if (remainingBufferBytes == -1)
+ {
+ return -1;
+ }
+ }
+ return buffer[bufferOffset++] & unchecked((int)(0xFF));
+ }
+
+ /// <summary><inheritDoc/></summary>
+ /// <exception cref="System.IO.IOException"/>
+ public override int Read(byte[] destBuffer, int destOffset, int destLen)
+ {
+ if (destOffset < 0)
+ {
+ throw new System.ArgumentException("Bad offset: " + destOffset);
+ }
+ else if (destLen < 0)
+ {
+ throw new System.ArgumentException("Bad length: " + destLen);
+ }
+ else if (destOffset + destLen > destBuffer.Length)
+ {
+ throw new System.ArgumentException("Buffer overflow: " + (destOffset + destLen) + " > " + destBuffer.Length);
+ }
+ else if (destLen == 0)
+ {
+ return 0;
+ }
+ int copyLen = System.Math.Max(remainingBufferBytes - bufferOffset, 0);
+ if (copyLen != 0)
+ {
+ copyLen = System.Math.Min(copyLen, destLen);
+ System.Array.Copy(buffer, bufferOffset, destBuffer, destOffset, copyLen);
+ bufferOffset += copyLen;
+ destOffset += copyLen;
+ destLen -= copyLen;
+ if (destLen == 0)
+ {
+ return copyLen;
+ }
+ }
+ try
+ {
+ state.output = destBuffer;
+ state.outputOffset = destOffset;
+ state.outputLength = destLen;
+ state.outputUsed = 0;
+ Org.Brotli.Dec.Decode.Decompress(state);
+ if (state.outputUsed == 0)
+ {
+ return -1;
+ }
+ return state.outputUsed + copyLen;
+ }
+ catch (Org.Brotli.Dec.BrotliRuntimeException ex)
+ {
+ throw new System.IO.IOException("Brotli stream decoding failed", ex);
+ }
+ }
+ // <{[INJECTED CODE]}>
+ public override bool CanRead {
+ get {return true;}
+ }
+
+ public override bool CanSeek {
+ get {return false;}
+ }
+ public override long Length {
+ get {throw new System.NotSupportedException();}
+ }
+ public override long Position {
+ get {throw new System.NotSupportedException();}
+ set {throw new System.NotSupportedException();}
+ }
+ public override long Seek(long offset, System.IO.SeekOrigin origin) {
+ throw new System.NotSupportedException();
+ }
+ public override void SetLength(long value){
+ throw new System.NotSupportedException();
+ }
+
+ public override bool CanWrite{get{return false;}}
+ public override System.IAsyncResult BeginWrite(byte[] buffer, int offset,
+ int count, System.AsyncCallback callback, object state) {
+ throw new System.NotSupportedException();
+ }
+ public override void Write(byte[] buffer, int offset, int count) {
+ throw new System.NotSupportedException();
+ }
+
+ public override void Flush() {}
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BrotliRuntimeException.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BrotliRuntimeException.cs
new file mode 100644
index 000000000..1e0aef083
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/BrotliRuntimeException.cs
@@ -0,0 +1,22 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>Unchecked exception used internally.</summary>
+ [System.Serializable]
+ internal class BrotliRuntimeException : System.Exception
+ {
+ internal BrotliRuntimeException(string message)
+ : base(message)
+ {
+ }
+
+ internal BrotliRuntimeException(string message, System.Exception cause)
+ : base(message, cause)
+ {
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Context.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Context.cs
new file mode 100644
index 000000000..ad900e490
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Context.cs
@@ -0,0 +1,57 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>Common context lookup table for all context modes.</summary>
+ internal sealed class Context
+ {
+ internal static readonly int[] Lookup = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 12, 16, 12, 12, 20, 12, 16, 24, 28, 12, 12, 32, 12, 36, 12, 44, 44, 44, 44, 44, 44, 44, 44
+ , 44, 44, 32, 32, 24, 40, 28, 12, 12, 48, 52, 52, 52, 48, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 24, 12, 28, 12, 12, 12, 56, 60, 60, 60, 56, 60, 60, 60, 56, 60, 60, 60, 60, 60, 56, 60, 60, 60, 60
+ , 60, 56, 60, 60, 60, 60, 60, 24, 12, 28, 12, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
+ 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,
+ 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 56, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38
+ , 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35
+ , 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9,
+ 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24,
+ 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39,
+ 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54,
+ 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ internal static readonly int[] LookupOffsets = new int[] { 1024, 1536, 1280, 1536, 0, 256, 768, 512 };
+ // CONTEXT_UTF8, last byte.
+ // ASCII range.
+ // UTF8 continuation byte range.
+ // UTF8 lead byte range.
+ // CONTEXT_UTF8 second last byte.
+ // ASCII range.
+ // UTF8 continuation byte range.
+ // UTF8 lead byte range.
+ // CONTEXT_SIGNED, second last byte.
+ // CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits.
+ // CONTEXT_LSB6, last byte.
+ // CONTEXT_MSB6, last byte.
+ // CONTEXT_{M,L}SB6, second last byte,
+ // CONTEXT_LSB6
+ // CONTEXT_MSB6
+ // CONTEXT_UTF8
+ // CONTEXT_SIGNED
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Decode.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Decode.cs
new file mode 100644
index 000000000..bdc8709ff
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Decode.cs
@@ -0,0 +1,992 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>API for Brotli decompression.</summary>
+ internal sealed class Decode
+ {
+ private const int DefaultCodeLength = 8;
+
+ private const int CodeLengthRepeatCode = 16;
+
+ private const int NumLiteralCodes = 256;
+
+ private const int NumInsertAndCopyCodes = 704;
+
+ private const int NumBlockLengthCodes = 26;
+
+ private const int LiteralContextBits = 6;
+
+ private const int DistanceContextBits = 2;
+
+ private const int HuffmanTableBits = 8;
+
+ private const int HuffmanTableMask = unchecked((int)(0xFF));
+
+ private const int CodeLengthCodes = 18;
+
+ private static readonly int[] CodeLengthCodeOrder = new int[] { 1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
+
+ private const int NumDistanceShortCodes = 16;
+
+ private static readonly int[] DistanceShortCodeIndexOffset = new int[] { 3, 2, 1, 0, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 };
+
+ private static readonly int[] DistanceShortCodeValueOffset = new int[] { 0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3 };
+
+ /// <summary>Static Huffman code for the code length code lengths.</summary>
+ private static readonly int[] FixedTable = new int[] { unchecked((int)(0x020000)), unchecked((int)(0x020004)), unchecked((int)(0x020003)), unchecked((int)(0x030002)), unchecked((int)(0x020000)), unchecked((int)(0x020004)), unchecked((int)(0x020003
+ )), unchecked((int)(0x040001)), unchecked((int)(0x020000)), unchecked((int)(0x020004)), unchecked((int)(0x020003)), unchecked((int)(0x030002)), unchecked((int)(0x020000)), unchecked((int)(0x020004)), unchecked((int)(0x020003)), unchecked((int
+ )(0x040005)) };
+
+ /// <summary>Decodes a number in the range [0..255], by reading 1 - 11 bits.</summary>
+ private static int DecodeVarLenUnsignedByte(Org.Brotli.Dec.BitReader br)
+ {
+ if (Org.Brotli.Dec.BitReader.ReadBits(br, 1) != 0)
+ {
+ int n = Org.Brotli.Dec.BitReader.ReadBits(br, 3);
+ if (n == 0)
+ {
+ return 1;
+ }
+ else
+ {
+ return Org.Brotli.Dec.BitReader.ReadBits(br, n) + (1 << n);
+ }
+ }
+ return 0;
+ }
+
+ private static void DecodeMetaBlockLength(Org.Brotli.Dec.BitReader br, Org.Brotli.Dec.State state)
+ {
+ state.inputEnd = Org.Brotli.Dec.BitReader.ReadBits(br, 1) == 1;
+ state.metaBlockLength = 0;
+ state.isUncompressed = false;
+ state.isMetadata = false;
+ if (state.inputEnd && Org.Brotli.Dec.BitReader.ReadBits(br, 1) != 0)
+ {
+ return;
+ }
+ int sizeNibbles = Org.Brotli.Dec.BitReader.ReadBits(br, 2) + 4;
+ if (sizeNibbles == 7)
+ {
+ state.isMetadata = true;
+ if (Org.Brotli.Dec.BitReader.ReadBits(br, 1) != 0)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Corrupted reserved bit");
+ }
+ int sizeBytes = Org.Brotli.Dec.BitReader.ReadBits(br, 2);
+ if (sizeBytes == 0)
+ {
+ return;
+ }
+ for (int i = 0; i < sizeBytes; i++)
+ {
+ int bits = Org.Brotli.Dec.BitReader.ReadBits(br, 8);
+ if (bits == 0 && i + 1 == sizeBytes && sizeBytes > 1)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Exuberant nibble");
+ }
+ state.metaBlockLength |= bits << (i * 8);
+ }
+ }
+ else
+ {
+ for (int i = 0; i < sizeNibbles; i++)
+ {
+ int bits = Org.Brotli.Dec.BitReader.ReadBits(br, 4);
+ if (bits == 0 && i + 1 == sizeNibbles && sizeNibbles > 4)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Exuberant nibble");
+ }
+ state.metaBlockLength |= bits << (i * 4);
+ }
+ }
+ state.metaBlockLength++;
+ if (!state.inputEnd)
+ {
+ state.isUncompressed = Org.Brotli.Dec.BitReader.ReadBits(br, 1) == 1;
+ }
+ }
+
+ /// <summary>Decodes the next Huffman code from bit-stream.</summary>
+ private static int ReadSymbol(int[] table, int offset, Org.Brotli.Dec.BitReader br)
+ {
+ int val = (int)((long)(((ulong)br.accumulator) >> br.bitOffset));
+ offset += val & HuffmanTableMask;
+ int bits = table[offset] >> 16;
+ int sym = table[offset] & unchecked((int)(0xFFFF));
+ if (bits <= HuffmanTableBits)
+ {
+ br.bitOffset += bits;
+ return sym;
+ }
+ offset += sym;
+ int mask = (1 << bits) - 1;
+ offset += (int)(((uint)(val & mask)) >> HuffmanTableBits);
+ br.bitOffset += ((table[offset] >> 16) + HuffmanTableBits);
+ return table[offset] & unchecked((int)(0xFFFF));
+ }
+
+ private static int ReadBlockLength(int[] table, int offset, Org.Brotli.Dec.BitReader br)
+ {
+ Org.Brotli.Dec.BitReader.FillBitWindow(br);
+ int code = ReadSymbol(table, offset, br);
+ int n = Org.Brotli.Dec.Prefix.BlockLengthNBits[code];
+ return Org.Brotli.Dec.Prefix.BlockLengthOffset[code] + Org.Brotli.Dec.BitReader.ReadBits(br, n);
+ }
+
+ private static int TranslateShortCodes(int code, int[] ringBuffer, int index)
+ {
+ if (code < NumDistanceShortCodes)
+ {
+ index += DistanceShortCodeIndexOffset[code];
+ index &= 3;
+ return ringBuffer[index] + DistanceShortCodeValueOffset[code];
+ }
+ return code - NumDistanceShortCodes + 1;
+ }
+
+ private static void MoveToFront(int[] v, int index)
+ {
+ int value = v[index];
+ for (; index > 0; index--)
+ {
+ v[index] = v[index - 1];
+ }
+ v[0] = value;
+ }
+
+ private static void InverseMoveToFrontTransform(byte[] v, int vLen)
+ {
+ int[] mtf = new int[256];
+ for (int i = 0; i < 256; i++)
+ {
+ mtf[i] = i;
+ }
+ for (int i = 0; i < vLen; i++)
+ {
+ int index = v[i] & unchecked((int)(0xFF));
+ v[i] = unchecked((byte)mtf[index]);
+ if (index != 0)
+ {
+ MoveToFront(mtf, index);
+ }
+ }
+ }
+
+ private static void ReadHuffmanCodeLengths(int[] codeLengthCodeLengths, int numSymbols, int[] codeLengths, Org.Brotli.Dec.BitReader br)
+ {
+ int symbol = 0;
+ int prevCodeLen = DefaultCodeLength;
+ int repeat = 0;
+ int repeatCodeLen = 0;
+ int space = 32768;
+ int[] table = new int[32];
+ Org.Brotli.Dec.Huffman.BuildHuffmanTable(table, 0, 5, codeLengthCodeLengths, CodeLengthCodes);
+ while (symbol < numSymbols && space > 0)
+ {
+ Org.Brotli.Dec.BitReader.ReadMoreInput(br);
+ Org.Brotli.Dec.BitReader.FillBitWindow(br);
+ int p = (int)(((long)(((ulong)br.accumulator) >> br.bitOffset))) & 31;
+ br.bitOffset += table[p] >> 16;
+ int codeLen = table[p] & unchecked((int)(0xFFFF));
+ if (codeLen < CodeLengthRepeatCode)
+ {
+ repeat = 0;
+ codeLengths[symbol++] = codeLen;
+ if (codeLen != 0)
+ {
+ prevCodeLen = codeLen;
+ space -= 32768 >> codeLen;
+ }
+ }
+ else
+ {
+ int extraBits = codeLen - 14;
+ int newLen = 0;
+ if (codeLen == CodeLengthRepeatCode)
+ {
+ newLen = prevCodeLen;
+ }
+ if (repeatCodeLen != newLen)
+ {
+ repeat = 0;
+ repeatCodeLen = newLen;
+ }
+ int oldRepeat = repeat;
+ if (repeat > 0)
+ {
+ repeat -= 2;
+ repeat <<= extraBits;
+ }
+ repeat += Org.Brotli.Dec.BitReader.ReadBits(br, extraBits) + 3;
+ int repeatDelta = repeat - oldRepeat;
+ if (symbol + repeatDelta > numSymbols)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("symbol + repeatDelta > numSymbols");
+ }
+ // COV_NF_LINE
+ for (int i = 0; i < repeatDelta; i++)
+ {
+ codeLengths[symbol++] = repeatCodeLen;
+ }
+ if (repeatCodeLen != 0)
+ {
+ space -= repeatDelta << (15 - repeatCodeLen);
+ }
+ }
+ }
+ if (space != 0)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Unused space");
+ }
+ // COV_NF_LINE
+ // TODO: Pass max_symbol to Huffman table builder instead?
+ Org.Brotli.Dec.Utils.FillWithZeroes(codeLengths, symbol, numSymbols - symbol);
+ }
+
+ // TODO: Use specialized versions for smaller tables.
+ internal static void ReadHuffmanCode(int alphabetSize, int[] table, int offset, Org.Brotli.Dec.BitReader br)
+ {
+ bool ok = true;
+ int simpleCodeOrSkip;
+ Org.Brotli.Dec.BitReader.ReadMoreInput(br);
+ // TODO: Avoid allocation.
+ int[] codeLengths = new int[alphabetSize];
+ simpleCodeOrSkip = Org.Brotli.Dec.BitReader.ReadBits(br, 2);
+ if (simpleCodeOrSkip == 1)
+ {
+ // Read symbols, codes & code lengths directly.
+ int maxBitsCounter = alphabetSize - 1;
+ int maxBits = 0;
+ int[] symbols = new int[4];
+ int numSymbols = Org.Brotli.Dec.BitReader.ReadBits(br, 2) + 1;
+ while (maxBitsCounter != 0)
+ {
+ maxBitsCounter >>= 1;
+ maxBits++;
+ }
+ // TODO: uncomment when codeLengths is reused.
+ // Utils.fillWithZeroes(codeLengths, 0, alphabetSize);
+ for (int i = 0; i < numSymbols; i++)
+ {
+ symbols[i] = Org.Brotli.Dec.BitReader.ReadBits(br, maxBits) % alphabetSize;
+ codeLengths[symbols[i]] = 2;
+ }
+ codeLengths[symbols[0]] = 1;
+ switch (numSymbols)
+ {
+ case 1:
+ {
+ break;
+ }
+
+ case 2:
+ {
+ ok = symbols[0] != symbols[1];
+ codeLengths[symbols[1]] = 1;
+ break;
+ }
+
+ case 3:
+ {
+ ok = symbols[0] != symbols[1] && symbols[0] != symbols[2] && symbols[1] != symbols[2];
+ break;
+ }
+
+ case 4:
+ default:
+ {
+ ok = symbols[0] != symbols[1] && symbols[0] != symbols[2] && symbols[0] != symbols[3] && symbols[1] != symbols[2] && symbols[1] != symbols[3] && symbols[2] != symbols[3];
+ if (Org.Brotli.Dec.BitReader.ReadBits(br, 1) == 1)
+ {
+ codeLengths[symbols[2]] = 3;
+ codeLengths[symbols[3]] = 3;
+ }
+ else
+ {
+ codeLengths[symbols[0]] = 2;
+ }
+ break;
+ }
+ }
+ }
+ else
+ {
+ // Decode Huffman-coded code lengths.
+ int[] codeLengthCodeLengths = new int[CodeLengthCodes];
+ int space = 32;
+ int numCodes = 0;
+ for (int i = simpleCodeOrSkip; i < CodeLengthCodes && space > 0; i++)
+ {
+ int codeLenIdx = CodeLengthCodeOrder[i];
+ Org.Brotli.Dec.BitReader.FillBitWindow(br);
+ int p = (int)((long)(((ulong)br.accumulator) >> br.bitOffset)) & 15;
+ // TODO: Demultiplex FIXED_TABLE.
+ br.bitOffset += FixedTable[p] >> 16;
+ int v = FixedTable[p] & unchecked((int)(0xFFFF));
+ codeLengthCodeLengths[codeLenIdx] = v;
+ if (v != 0)
+ {
+ space -= (32 >> v);
+ numCodes++;
+ }
+ }
+ ok = (numCodes == 1 || space == 0);
+ ReadHuffmanCodeLengths(codeLengthCodeLengths, alphabetSize, codeLengths, br);
+ }
+ if (!ok)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Can't readHuffmanCode");
+ }
+ // COV_NF_LINE
+ Org.Brotli.Dec.Huffman.BuildHuffmanTable(table, offset, HuffmanTableBits, codeLengths, alphabetSize);
+ }
+
+ private static int DecodeContextMap(int contextMapSize, byte[] contextMap, Org.Brotli.Dec.BitReader br)
+ {
+ Org.Brotli.Dec.BitReader.ReadMoreInput(br);
+ int numTrees = DecodeVarLenUnsignedByte(br) + 1;
+ if (numTrees == 1)
+ {
+ Org.Brotli.Dec.Utils.FillWithZeroes(contextMap, 0, contextMapSize);
+ return numTrees;
+ }
+ bool useRleForZeros = Org.Brotli.Dec.BitReader.ReadBits(br, 1) == 1;
+ int maxRunLengthPrefix = 0;
+ if (useRleForZeros)
+ {
+ maxRunLengthPrefix = Org.Brotli.Dec.BitReader.ReadBits(br, 4) + 1;
+ }
+ int[] table = new int[Org.Brotli.Dec.Huffman.HuffmanMaxTableSize];
+ ReadHuffmanCode(numTrees + maxRunLengthPrefix, table, 0, br);
+ for (int i = 0; i < contextMapSize; )
+ {
+ Org.Brotli.Dec.BitReader.ReadMoreInput(br);
+ Org.Brotli.Dec.BitReader.FillBitWindow(br);
+ int code = ReadSymbol(table, 0, br);
+ if (code == 0)
+ {
+ contextMap[i] = 0;
+ i++;
+ }
+ else if (code <= maxRunLengthPrefix)
+ {
+ int reps = (1 << code) + Org.Brotli.Dec.BitReader.ReadBits(br, code);
+ while (reps != 0)
+ {
+ if (i >= contextMapSize)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Corrupted context map");
+ }
+ // COV_NF_LINE
+ contextMap[i] = 0;
+ i++;
+ reps--;
+ }
+ }
+ else
+ {
+ contextMap[i] = unchecked((byte)(code - maxRunLengthPrefix));
+ i++;
+ }
+ }
+ if (Org.Brotli.Dec.BitReader.ReadBits(br, 1) == 1)
+ {
+ InverseMoveToFrontTransform(contextMap, contextMapSize);
+ }
+ return numTrees;
+ }
+
+ private static void DecodeBlockTypeAndLength(Org.Brotli.Dec.State state, int treeType)
+ {
+ Org.Brotli.Dec.BitReader br = state.br;
+ int[] ringBuffers = state.blockTypeRb;
+ int offset = treeType * 2;
+ Org.Brotli.Dec.BitReader.FillBitWindow(br);
+ int blockType = ReadSymbol(state.blockTypeTrees, treeType * Org.Brotli.Dec.Huffman.HuffmanMaxTableSize, br);
+ state.blockLength[treeType] = ReadBlockLength(state.blockLenTrees, treeType * Org.Brotli.Dec.Huffman.HuffmanMaxTableSize, br);
+ if (blockType == 1)
+ {
+ blockType = ringBuffers[offset + 1] + 1;
+ }
+ else if (blockType == 0)
+ {
+ blockType = ringBuffers[offset];
+ }
+ else
+ {
+ blockType -= 2;
+ }
+ if (blockType >= state.numBlockTypes[treeType])
+ {
+ blockType -= state.numBlockTypes[treeType];
+ }
+ ringBuffers[offset] = ringBuffers[offset + 1];
+ ringBuffers[offset + 1] = blockType;
+ }
+
+ private static void DecodeLiteralBlockSwitch(Org.Brotli.Dec.State state)
+ {
+ DecodeBlockTypeAndLength(state, 0);
+ int literalBlockType = state.blockTypeRb[1];
+ state.contextMapSlice = literalBlockType << LiteralContextBits;
+ state.literalTreeIndex = state.contextMap[state.contextMapSlice] & unchecked((int)(0xFF));
+ state.literalTree = state.hGroup0.trees[state.literalTreeIndex];
+ int contextMode = state.contextModes[literalBlockType];
+ state.contextLookupOffset1 = Org.Brotli.Dec.Context.LookupOffsets[contextMode];
+ state.contextLookupOffset2 = Org.Brotli.Dec.Context.LookupOffsets[contextMode + 1];
+ }
+
+ private static void DecodeCommandBlockSwitch(Org.Brotli.Dec.State state)
+ {
+ DecodeBlockTypeAndLength(state, 1);
+ state.treeCommandOffset = state.hGroup1.trees[state.blockTypeRb[3]];
+ }
+
+ private static void DecodeDistanceBlockSwitch(Org.Brotli.Dec.State state)
+ {
+ DecodeBlockTypeAndLength(state, 2);
+ state.distContextMapSlice = state.blockTypeRb[5] << DistanceContextBits;
+ }
+
+ private static void MaybeReallocateRingBuffer(Org.Brotli.Dec.State state)
+ {
+ int newSize = state.maxRingBufferSize;
+ if ((long)newSize > state.expectedTotalSize)
+ {
+ /* TODO: Handle 2GB+ cases more gracefully. */
+ int minimalNewSize = (int)state.expectedTotalSize + state.customDictionary.Length;
+ while ((newSize >> 1) > minimalNewSize)
+ {
+ newSize >>= 1;
+ }
+ if (!state.inputEnd && newSize < 16384 && state.maxRingBufferSize >= 16384)
+ {
+ newSize = 16384;
+ }
+ }
+ if (newSize <= state.ringBufferSize)
+ {
+ return;
+ }
+ int ringBufferSizeWithSlack = newSize + Org.Brotli.Dec.Dictionary.MaxTransformedWordLength;
+ byte[] newBuffer = new byte[ringBufferSizeWithSlack];
+ if (state.ringBuffer != null)
+ {
+ System.Array.Copy(state.ringBuffer, 0, newBuffer, 0, state.ringBufferSize);
+ }
+ else if (state.customDictionary.Length != 0)
+ {
+ /* Prepend custom dictionary, if any. */
+ int length = state.customDictionary.Length;
+ int offset = 0;
+ if (length > state.maxBackwardDistance)
+ {
+ offset = length - state.maxBackwardDistance;
+ length = state.maxBackwardDistance;
+ }
+ System.Array.Copy(state.customDictionary, offset, newBuffer, 0, length);
+ state.pos = length;
+ state.bytesToIgnore = length;
+ }
+ state.ringBuffer = newBuffer;
+ state.ringBufferSize = newSize;
+ }
+
+ /// <summary>Reads next metablock header.</summary>
+ /// <param name="state">decoding state</param>
+ private static void ReadMetablockInfo(Org.Brotli.Dec.State state)
+ {
+ Org.Brotli.Dec.BitReader br = state.br;
+ if (state.inputEnd)
+ {
+ state.nextRunningState = Org.Brotli.Dec.RunningState.Finished;
+ state.bytesToWrite = state.pos;
+ state.bytesWritten = 0;
+ state.runningState = Org.Brotli.Dec.RunningState.Write;
+ return;
+ }
+ // TODO: Reset? Do we need this?
+ state.hGroup0.codes = null;
+ state.hGroup0.trees = null;
+ state.hGroup1.codes = null;
+ state.hGroup1.trees = null;
+ state.hGroup2.codes = null;
+ state.hGroup2.trees = null;
+ Org.Brotli.Dec.BitReader.ReadMoreInput(br);
+ DecodeMetaBlockLength(br, state);
+ if (state.metaBlockLength == 0 && !state.isMetadata)
+ {
+ return;
+ }
+ if (state.isUncompressed || state.isMetadata)
+ {
+ Org.Brotli.Dec.BitReader.JumpToByteBoundary(br);
+ state.runningState = state.isMetadata ? Org.Brotli.Dec.RunningState.ReadMetadata : Org.Brotli.Dec.RunningState.CopyUncompressed;
+ }
+ else
+ {
+ state.runningState = Org.Brotli.Dec.RunningState.CompressedBlockStart;
+ }
+ if (state.isMetadata)
+ {
+ return;
+ }
+ state.expectedTotalSize += state.metaBlockLength;
+ if (state.ringBufferSize < state.maxRingBufferSize)
+ {
+ MaybeReallocateRingBuffer(state);
+ }
+ }
+
+ private static void ReadMetablockHuffmanCodesAndContextMaps(Org.Brotli.Dec.State state)
+ {
+ Org.Brotli.Dec.BitReader br = state.br;
+ for (int i = 0; i < 3; i++)
+ {
+ state.numBlockTypes[i] = DecodeVarLenUnsignedByte(br) + 1;
+ state.blockLength[i] = 1 << 28;
+ if (state.numBlockTypes[i] > 1)
+ {
+ ReadHuffmanCode(state.numBlockTypes[i] + 2, state.blockTypeTrees, i * Org.Brotli.Dec.Huffman.HuffmanMaxTableSize, br);
+ ReadHuffmanCode(NumBlockLengthCodes, state.blockLenTrees, i * Org.Brotli.Dec.Huffman.HuffmanMaxTableSize, br);
+ state.blockLength[i] = ReadBlockLength(state.blockLenTrees, i * Org.Brotli.Dec.Huffman.HuffmanMaxTableSize, br);
+ }
+ }
+ Org.Brotli.Dec.BitReader.ReadMoreInput(br);
+ state.distancePostfixBits = Org.Brotli.Dec.BitReader.ReadBits(br, 2);
+ state.numDirectDistanceCodes = NumDistanceShortCodes + (Org.Brotli.Dec.BitReader.ReadBits(br, 4) << state.distancePostfixBits);
+ state.distancePostfixMask = (1 << state.distancePostfixBits) - 1;
+ int numDistanceCodes = state.numDirectDistanceCodes + (48 << state.distancePostfixBits);
+ // TODO: Reuse?
+ state.contextModes = new byte[state.numBlockTypes[0]];
+ for (int i = 0; i < state.numBlockTypes[0]; )
+ {
+ /* Ensure that less than 256 bits read between readMoreInput. */
+ int limit = System.Math.Min(i + 96, state.numBlockTypes[0]);
+ for (; i < limit; ++i)
+ {
+ state.contextModes[i] = unchecked((byte)(Org.Brotli.Dec.BitReader.ReadBits(br, 2) << 1));
+ }
+ Org.Brotli.Dec.BitReader.ReadMoreInput(br);
+ }
+ // TODO: Reuse?
+ state.contextMap = new byte[state.numBlockTypes[0] << LiteralContextBits];
+ int numLiteralTrees = DecodeContextMap(state.numBlockTypes[0] << LiteralContextBits, state.contextMap, br);
+ state.trivialLiteralContext = true;
+ for (int j = 0; j < state.numBlockTypes[0] << LiteralContextBits; j++)
+ {
+ if (state.contextMap[j] != j >> LiteralContextBits)
+ {
+ state.trivialLiteralContext = false;
+ break;
+ }
+ }
+ // TODO: Reuse?
+ state.distContextMap = new byte[state.numBlockTypes[2] << DistanceContextBits];
+ int numDistTrees = DecodeContextMap(state.numBlockTypes[2] << DistanceContextBits, state.distContextMap, br);
+ Org.Brotli.Dec.HuffmanTreeGroup.Init(state.hGroup0, NumLiteralCodes, numLiteralTrees);
+ Org.Brotli.Dec.HuffmanTreeGroup.Init(state.hGroup1, NumInsertAndCopyCodes, state.numBlockTypes[1]);
+ Org.Brotli.Dec.HuffmanTreeGroup.Init(state.hGroup2, numDistanceCodes, numDistTrees);
+ Org.Brotli.Dec.HuffmanTreeGroup.Decode(state.hGroup0, br);
+ Org.Brotli.Dec.HuffmanTreeGroup.Decode(state.hGroup1, br);
+ Org.Brotli.Dec.HuffmanTreeGroup.Decode(state.hGroup2, br);
+ state.contextMapSlice = 0;
+ state.distContextMapSlice = 0;
+ state.contextLookupOffset1 = Org.Brotli.Dec.Context.LookupOffsets[state.contextModes[0]];
+ state.contextLookupOffset2 = Org.Brotli.Dec.Context.LookupOffsets[state.contextModes[0] + 1];
+ state.literalTreeIndex = 0;
+ state.literalTree = state.hGroup0.trees[0];
+ state.treeCommandOffset = state.hGroup1.trees[0];
+ // TODO: == 0?
+ state.blockTypeRb[0] = state.blockTypeRb[2] = state.blockTypeRb[4] = 1;
+ state.blockTypeRb[1] = state.blockTypeRb[3] = state.blockTypeRb[5] = 0;
+ }
+
+ private static void CopyUncompressedData(Org.Brotli.Dec.State state)
+ {
+ Org.Brotli.Dec.BitReader br = state.br;
+ byte[] ringBuffer = state.ringBuffer;
+ // Could happen if block ends at ring buffer end.
+ if (state.metaBlockLength <= 0)
+ {
+ Org.Brotli.Dec.BitReader.Reload(br);
+ state.runningState = Org.Brotli.Dec.RunningState.BlockStart;
+ return;
+ }
+ int chunkLength = System.Math.Min(state.ringBufferSize - state.pos, state.metaBlockLength);
+ Org.Brotli.Dec.BitReader.CopyBytes(br, ringBuffer, state.pos, chunkLength);
+ state.metaBlockLength -= chunkLength;
+ state.pos += chunkLength;
+ if (state.pos == state.ringBufferSize)
+ {
+ state.nextRunningState = Org.Brotli.Dec.RunningState.CopyUncompressed;
+ state.bytesToWrite = state.ringBufferSize;
+ state.bytesWritten = 0;
+ state.runningState = Org.Brotli.Dec.RunningState.Write;
+ return;
+ }
+ Org.Brotli.Dec.BitReader.Reload(br);
+ state.runningState = Org.Brotli.Dec.RunningState.BlockStart;
+ }
+
+ private static bool WriteRingBuffer(Org.Brotli.Dec.State state)
+ {
+ /* Ignore custom dictionary bytes. */
+ if (state.bytesToIgnore != 0)
+ {
+ state.bytesWritten += state.bytesToIgnore;
+ state.bytesToIgnore = 0;
+ }
+ int toWrite = System.Math.Min(state.outputLength - state.outputUsed, state.bytesToWrite - state.bytesWritten);
+ if (toWrite != 0)
+ {
+ System.Array.Copy(state.ringBuffer, state.bytesWritten, state.output, state.outputOffset + state.outputUsed, toWrite);
+ state.outputUsed += toWrite;
+ state.bytesWritten += toWrite;
+ }
+ return state.outputUsed < state.outputLength;
+ }
+
+ internal static void SetCustomDictionary(Org.Brotli.Dec.State state, byte[] data)
+ {
+ state.customDictionary = (data == null) ? new byte[0] : data;
+ }
+
+ /// <summary>Actual decompress implementation.</summary>
+ internal static void Decompress(Org.Brotli.Dec.State state)
+ {
+ if (state.runningState == Org.Brotli.Dec.RunningState.Uninitialized)
+ {
+ throw new System.InvalidOperationException("Can't decompress until initialized");
+ }
+ if (state.runningState == Org.Brotli.Dec.RunningState.Closed)
+ {
+ throw new System.InvalidOperationException("Can't decompress after close");
+ }
+ Org.Brotli.Dec.BitReader br = state.br;
+ int ringBufferMask = state.ringBufferSize - 1;
+ byte[] ringBuffer = state.ringBuffer;
+ while (state.runningState != Org.Brotli.Dec.RunningState.Finished)
+ {
+ switch (state.runningState)
+ {
+ case Org.Brotli.Dec.RunningState.BlockStart:
+ {
+ // TODO: extract cases to methods for the better readability.
+ if (state.metaBlockLength < 0)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Invalid metablock length");
+ }
+ ReadMetablockInfo(state);
+ /* Ring-buffer would be reallocated here. */
+ ringBufferMask = state.ringBufferSize - 1;
+ ringBuffer = state.ringBuffer;
+ continue;
+ }
+
+ case Org.Brotli.Dec.RunningState.CompressedBlockStart:
+ {
+ ReadMetablockHuffmanCodesAndContextMaps(state);
+ state.runningState = Org.Brotli.Dec.RunningState.MainLoop;
+ goto case Org.Brotli.Dec.RunningState.MainLoop;
+ }
+
+ case Org.Brotli.Dec.RunningState.MainLoop:
+ {
+ // Fall through
+ if (state.metaBlockLength <= 0)
+ {
+ state.runningState = Org.Brotli.Dec.RunningState.BlockStart;
+ continue;
+ }
+ Org.Brotli.Dec.BitReader.ReadMoreInput(br);
+ if (state.blockLength[1] == 0)
+ {
+ DecodeCommandBlockSwitch(state);
+ }
+ state.blockLength[1]--;
+ Org.Brotli.Dec.BitReader.FillBitWindow(br);
+ int cmdCode = ReadSymbol(state.hGroup1.codes, state.treeCommandOffset, br);
+ int rangeIdx = (int)(((uint)cmdCode) >> 6);
+ state.distanceCode = 0;
+ if (rangeIdx >= 2)
+ {
+ rangeIdx -= 2;
+ state.distanceCode = -1;
+ }
+ int insertCode = Org.Brotli.Dec.Prefix.InsertRangeLut[rangeIdx] + (((int)(((uint)cmdCode) >> 3)) & 7);
+ int copyCode = Org.Brotli.Dec.Prefix.CopyRangeLut[rangeIdx] + (cmdCode & 7);
+ state.insertLength = Org.Brotli.Dec.Prefix.InsertLengthOffset[insertCode] + Org.Brotli.Dec.BitReader.ReadBits(br, Org.Brotli.Dec.Prefix.InsertLengthNBits[insertCode]);
+ state.copyLength = Org.Brotli.Dec.Prefix.CopyLengthOffset[copyCode] + Org.Brotli.Dec.BitReader.ReadBits(br, Org.Brotli.Dec.Prefix.CopyLengthNBits[copyCode]);
+ state.j = 0;
+ state.runningState = Org.Brotli.Dec.RunningState.InsertLoop;
+ goto case Org.Brotli.Dec.RunningState.InsertLoop;
+ }
+
+ case Org.Brotli.Dec.RunningState.InsertLoop:
+ {
+ // Fall through
+ if (state.trivialLiteralContext)
+ {
+ while (state.j < state.insertLength)
+ {
+ Org.Brotli.Dec.BitReader.ReadMoreInput(br);
+ if (state.blockLength[0] == 0)
+ {
+ DecodeLiteralBlockSwitch(state);
+ }
+ state.blockLength[0]--;
+ Org.Brotli.Dec.BitReader.FillBitWindow(br);
+ ringBuffer[state.pos] = unchecked((byte)ReadSymbol(state.hGroup0.codes, state.literalTree, br));
+ state.j++;
+ if (state.pos++ == ringBufferMask)
+ {
+ state.nextRunningState = Org.Brotli.Dec.RunningState.InsertLoop;
+ state.bytesToWrite = state.ringBufferSize;
+ state.bytesWritten = 0;
+ state.runningState = Org.Brotli.Dec.RunningState.Write;
+ break;
+ }
+ }
+ }
+ else
+ {
+ int prevByte1 = ringBuffer[(state.pos - 1) & ringBufferMask] & unchecked((int)(0xFF));
+ int prevByte2 = ringBuffer[(state.pos - 2) & ringBufferMask] & unchecked((int)(0xFF));
+ while (state.j < state.insertLength)
+ {
+ Org.Brotli.Dec.BitReader.ReadMoreInput(br);
+ if (state.blockLength[0] == 0)
+ {
+ DecodeLiteralBlockSwitch(state);
+ }
+ int literalTreeIndex = state.contextMap[state.contextMapSlice + (Org.Brotli.Dec.Context.Lookup[state.contextLookupOffset1 + prevByte1] | Org.Brotli.Dec.Context.Lookup[state.contextLookupOffset2 + prevByte2])] & unchecked((int)(0xFF));
+ state.blockLength[0]--;
+ prevByte2 = prevByte1;
+ Org.Brotli.Dec.BitReader.FillBitWindow(br);
+ prevByte1 = ReadSymbol(state.hGroup0.codes, state.hGroup0.trees[literalTreeIndex], br);
+ ringBuffer[state.pos] = unchecked((byte)prevByte1);
+ state.j++;
+ if (state.pos++ == ringBufferMask)
+ {
+ state.nextRunningState = Org.Brotli.Dec.RunningState.InsertLoop;
+ state.bytesToWrite = state.ringBufferSize;
+ state.bytesWritten = 0;
+ state.runningState = Org.Brotli.Dec.RunningState.Write;
+ break;
+ }
+ }
+ }
+ if (state.runningState != Org.Brotli.Dec.RunningState.InsertLoop)
+ {
+ continue;
+ }
+ state.metaBlockLength -= state.insertLength;
+ if (state.metaBlockLength <= 0)
+ {
+ state.runningState = Org.Brotli.Dec.RunningState.MainLoop;
+ continue;
+ }
+ if (state.distanceCode < 0)
+ {
+ Org.Brotli.Dec.BitReader.ReadMoreInput(br);
+ if (state.blockLength[2] == 0)
+ {
+ DecodeDistanceBlockSwitch(state);
+ }
+ state.blockLength[2]--;
+ Org.Brotli.Dec.BitReader.FillBitWindow(br);
+ state.distanceCode = ReadSymbol(state.hGroup2.codes, state.hGroup2.trees[state.distContextMap[state.distContextMapSlice + (state.copyLength > 4 ? 3 : state.copyLength - 2)] & unchecked((int)(0xFF))], br);
+ if (state.distanceCode >= state.numDirectDistanceCodes)
+ {
+ state.distanceCode -= state.numDirectDistanceCodes;
+ int postfix = state.distanceCode & state.distancePostfixMask;
+ state.distanceCode = (int)(((uint)state.distanceCode) >> state.distancePostfixBits);
+ int n = ((int)(((uint)state.distanceCode) >> 1)) + 1;
+ int offset = ((2 + (state.distanceCode & 1)) << n) - 4;
+ state.distanceCode = state.numDirectDistanceCodes + postfix + ((offset + Org.Brotli.Dec.BitReader.ReadBits(br, n)) << state.distancePostfixBits);
+ }
+ }
+ // Convert the distance code to the actual distance by possibly looking up past distances
+ // from the ringBuffer.
+ state.distance = TranslateShortCodes(state.distanceCode, state.distRb, state.distRbIdx);
+ if (state.distance < 0)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Negative distance");
+ }
+ // COV_NF_LINE
+ if (state.maxDistance != state.maxBackwardDistance && state.pos < state.maxBackwardDistance)
+ {
+ state.maxDistance = state.pos;
+ }
+ else
+ {
+ state.maxDistance = state.maxBackwardDistance;
+ }
+ state.copyDst = state.pos;
+ if (state.distance > state.maxDistance)
+ {
+ state.runningState = Org.Brotli.Dec.RunningState.Transform;
+ continue;
+ }
+ if (state.distanceCode > 0)
+ {
+ state.distRb[state.distRbIdx & 3] = state.distance;
+ state.distRbIdx++;
+ }
+ if (state.copyLength > state.metaBlockLength)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Invalid backward reference");
+ }
+ // COV_NF_LINE
+ state.j = 0;
+ state.runningState = Org.Brotli.Dec.RunningState.CopyLoop;
+ goto case Org.Brotli.Dec.RunningState.CopyLoop;
+ }
+
+ case Org.Brotli.Dec.RunningState.CopyLoop:
+ {
+ // fall through
+ int src = (state.pos - state.distance) & ringBufferMask;
+ int dst = state.pos;
+ int copyLength = state.copyLength - state.j;
+ if ((src + copyLength < ringBufferMask) && (dst + copyLength < ringBufferMask))
+ {
+ for (int k = 0; k < copyLength; ++k)
+ {
+ ringBuffer[dst++] = ringBuffer[src++];
+ }
+ state.j += copyLength;
+ state.metaBlockLength -= copyLength;
+ state.pos += copyLength;
+ }
+ else
+ {
+ for (; state.j < state.copyLength; )
+ {
+ ringBuffer[state.pos] = ringBuffer[(state.pos - state.distance) & ringBufferMask];
+ state.metaBlockLength--;
+ state.j++;
+ if (state.pos++ == ringBufferMask)
+ {
+ state.nextRunningState = Org.Brotli.Dec.RunningState.CopyLoop;
+ state.bytesToWrite = state.ringBufferSize;
+ state.bytesWritten = 0;
+ state.runningState = Org.Brotli.Dec.RunningState.Write;
+ break;
+ }
+ }
+ }
+ if (state.runningState == Org.Brotli.Dec.RunningState.CopyLoop)
+ {
+ state.runningState = Org.Brotli.Dec.RunningState.MainLoop;
+ }
+ continue;
+ }
+
+ case Org.Brotli.Dec.RunningState.Transform:
+ {
+ if (state.copyLength >= Org.Brotli.Dec.Dictionary.MinWordLength && state.copyLength <= Org.Brotli.Dec.Dictionary.MaxWordLength)
+ {
+ int offset = Org.Brotli.Dec.Dictionary.OffsetsByLength[state.copyLength];
+ int wordId = state.distance - state.maxDistance - 1;
+ int shift = Org.Brotli.Dec.Dictionary.SizeBitsByLength[state.copyLength];
+ int mask = (1 << shift) - 1;
+ int wordIdx = wordId & mask;
+ int transformIdx = (int)(((uint)wordId) >> shift);
+ offset += wordIdx * state.copyLength;
+ if (transformIdx < Org.Brotli.Dec.Transform.Transforms.Length)
+ {
+ int len = Org.Brotli.Dec.Transform.TransformDictionaryWord(ringBuffer, state.copyDst, Org.Brotli.Dec.Dictionary.GetData(), offset, state.copyLength, Org.Brotli.Dec.Transform.Transforms[transformIdx]);
+ state.copyDst += len;
+ state.pos += len;
+ state.metaBlockLength -= len;
+ if (state.copyDst >= state.ringBufferSize)
+ {
+ state.nextRunningState = Org.Brotli.Dec.RunningState.CopyWrapBuffer;
+ state.bytesToWrite = state.ringBufferSize;
+ state.bytesWritten = 0;
+ state.runningState = Org.Brotli.Dec.RunningState.Write;
+ continue;
+ }
+ }
+ else
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Invalid backward reference");
+ }
+ }
+ else
+ {
+ // COV_NF_LINE
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Invalid backward reference");
+ }
+ // COV_NF_LINE
+ state.runningState = Org.Brotli.Dec.RunningState.MainLoop;
+ continue;
+ }
+
+ case Org.Brotli.Dec.RunningState.CopyWrapBuffer:
+ {
+ System.Array.Copy(ringBuffer, state.ringBufferSize, ringBuffer, 0, state.copyDst - state.ringBufferSize);
+ state.runningState = Org.Brotli.Dec.RunningState.MainLoop;
+ continue;
+ }
+
+ case Org.Brotli.Dec.RunningState.ReadMetadata:
+ {
+ while (state.metaBlockLength > 0)
+ {
+ Org.Brotli.Dec.BitReader.ReadMoreInput(br);
+ // Optimize
+ Org.Brotli.Dec.BitReader.ReadBits(br, 8);
+ state.metaBlockLength--;
+ }
+ state.runningState = Org.Brotli.Dec.RunningState.BlockStart;
+ continue;
+ }
+
+ case Org.Brotli.Dec.RunningState.CopyUncompressed:
+ {
+ CopyUncompressedData(state);
+ continue;
+ }
+
+ case Org.Brotli.Dec.RunningState.Write:
+ {
+ if (!WriteRingBuffer(state))
+ {
+ // Output buffer is full.
+ return;
+ }
+ if (state.pos >= state.maxBackwardDistance)
+ {
+ state.maxDistance = state.maxBackwardDistance;
+ }
+ state.pos &= ringBufferMask;
+ state.runningState = state.nextRunningState;
+ continue;
+ }
+
+ default:
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Unexpected state " + state.runningState);
+ }
+ }
+ }
+ if (state.runningState == Org.Brotli.Dec.RunningState.Finished)
+ {
+ if (state.metaBlockLength < 0)
+ {
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Invalid metablock length");
+ }
+ Org.Brotli.Dec.BitReader.JumpToByteBoundary(br);
+ Org.Brotli.Dec.BitReader.CheckHealth(state.br, true);
+ }
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/DecodeTest.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/DecodeTest.cs
new file mode 100644
index 000000000..f6fad8c88
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/DecodeTest.cs
@@ -0,0 +1,171 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>
+ /// Tests for
+ /// <see cref="Decode"/>
+ /// .
+ /// </summary>
+ public class DecodeTest
+ {
+ /// <exception cref="System.IO.IOException"/>
+ private byte[] Decompress(byte[] data, bool byByte)
+ {
+ byte[] buffer = new byte[65536];
+ System.IO.MemoryStream input = new System.IO.MemoryStream(data);
+ System.IO.MemoryStream output = new System.IO.MemoryStream();
+ Org.Brotli.Dec.BrotliInputStream brotliInput = new Org.Brotli.Dec.BrotliInputStream(input);
+ if (byByte)
+ {
+ byte[] oneByte = new byte[1];
+ while (true)
+ {
+ int next = brotliInput.ReadByte();
+ if (next == -1)
+ {
+ break;
+ }
+ oneByte[0] = unchecked((byte)next);
+ output.Write(oneByte, 0, 1);
+ }
+ }
+ else
+ {
+ while (true)
+ {
+ int len = brotliInput.Read(buffer, 0, buffer.Length);
+ if (len <= 0)
+ {
+ break;
+ }
+ output.Write(buffer, 0, len);
+ }
+ }
+ brotliInput.Close();
+ return output.ToArray();
+ }
+
+ /// <exception cref="System.IO.IOException"/>
+ private byte[] DecompressWithDictionary(byte[] data, byte[] dictionary)
+ {
+ byte[] buffer = new byte[65536];
+ System.IO.MemoryStream input = new System.IO.MemoryStream(data);
+ System.IO.MemoryStream output = new System.IO.MemoryStream();
+ Org.Brotli.Dec.BrotliInputStream brotliInput = new Org.Brotli.Dec.BrotliInputStream(input, Org.Brotli.Dec.BrotliInputStream.DefaultInternalBufferSize, dictionary);
+ while (true)
+ {
+ int len = brotliInput.Read(buffer, 0, buffer.Length);
+ if (len <= 0)
+ {
+ break;
+ }
+ output.Write(buffer, 0, len);
+ }
+ brotliInput.Close();
+ return output.ToArray();
+ }
+
+ /// <exception cref="System.IO.IOException"/>
+ private void CheckDecodeResourceWithDictionary(string expected, string compressed, string dictionary)
+ {
+ byte[] expectedBytes = Org.Brotli.Dec.Transform.ReadUniBytes(expected);
+ byte[] compressedBytes = Org.Brotli.Dec.Transform.ReadUniBytes(compressed);
+ byte[] dictionaryBytes = Org.Brotli.Dec.Transform.ReadUniBytes(dictionary);
+ byte[] actual = DecompressWithDictionary(compressedBytes, dictionaryBytes);
+ NUnit.Framework.Assert.AreEqual(expectedBytes, actual);
+ }
+
+ /// <exception cref="System.IO.IOException"/>
+ private void CheckDecodeResource(string expected, string compressed)
+ {
+ byte[] expectedBytes = Org.Brotli.Dec.Transform.ReadUniBytes(expected);
+ byte[] compressedBytes = Org.Brotli.Dec.Transform.ReadUniBytes(compressed);
+ byte[] actual = Decompress(compressedBytes, false);
+ NUnit.Framework.Assert.AreEqual(expectedBytes, actual);
+ byte[] actualByByte = Decompress(compressedBytes, true);
+ NUnit.Framework.Assert.AreEqual(expectedBytes, actualByByte);
+ }
+
+ /// <exception cref="System.IO.IOException"/>
+ [NUnit.Framework.Test]
+ public virtual void TestEmpty()
+ {
+ CheckDecodeResource(string.Empty, "\u0006");
+ }
+
+ /// <exception cref="System.IO.IOException"/>
+ [NUnit.Framework.Test]
+ public virtual void TestX()
+ {
+ CheckDecodeResource("X", "\u000B\u0000\u0080X\u0003");
+ }
+
+ /// <exception cref="System.IO.IOException"/>
+ [NUnit.Framework.Test]
+ public virtual void TestX10Y10()
+ {
+ CheckDecodeResource("XXXXXXXXXXYYYYYYYYYY", "\u001B\u0013\u0000\u0000\u00A4\u00B0\u00B2\u00EA\u0081G\u0002\u008A");
+ }
+
+ /// <exception cref="System.IO.IOException"/>
+ [NUnit.Framework.Test]
+ public virtual void TestX64()
+ {
+ CheckDecodeResource("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "\u001B\u003F\u0000\u0000$\u00B0\u00E2\u0099\u0080\u0012");
+ }
+
+ /// <exception cref="System.IO.IOException"/>
+ [NUnit.Framework.Test]
+ public virtual void TestUkkonooa()
+ {
+ CheckDecodeResource("ukko nooa, ukko nooa oli kunnon mies, kun han meni saunaan, " + "pisti laukun naulaan, ukko nooa, ukko nooa oli kunnon mies.", "\u001Bv\u0000\u0000\u0014J\u00AC\u009Bz\u00BD\u00E1\u0097\u009D\u007F\u008E\u00C2\u0082" + "6\u000E\u009C\u00E0\u0090\u0003\u00F7\u008B\u009E8\u00E6\u00B6\u0000\u00AB\u00C3\u00CA"
+ + "\u00A0\u00C2\u00DAf6\u00DC\u00CD\u0080\u008D.!\u00D7n\u00E3\u00EAL\u00B8\u00F0\u00D2" + "\u00B8\u00C7\u00C2pM:\u00F0i~\u00A1\u00B8Es\u00AB\u00C4W\u001E");
+ }
+
+ /// <exception cref="System.IO.IOException"/>
+ [NUnit.Framework.Test]
+ public virtual void TestMonkey()
+ {
+ CheckDecodeResource("znxcvnmz,xvnm.,zxcnv.,xcn.z,vn.zvn.zxcvn.,zxcn.vn.v,znm.,vnzx.,vnzxc.vn.z,vnz.,nv.z,nvmz" + "xc,nvzxcvcnm.,vczxvnzxcnvmxc.zmcnvzm.,nvmc,nzxmc,vn.mnnmzxc,vnxcnmv,znvzxcnmv,.xcnvm,zxc" + "nzxv.zx,qweryweurqioweupropqwutioweupqrioweutiopweuriopweuriopqwurioputiopqwuriowuqeriou"
+ + "pqweropuweropqwurweuqriopuropqwuriopuqwriopuqweopruioqweurqweuriouqweopruioupqiytioqtyio" + "wtyqptypryoqweutioioqtweqruowqeytiowquiourowetyoqwupiotweuqiorweuqroipituqwiorqwtioweuri" + "ouytuioerytuioweryuitoweytuiweyuityeruirtyuqriqweuropqweiruioqweurioqwuerioqwyuituierwot"
+ + "ueryuiotweyrtuiwertyioweryrueioqptyioruyiopqwtjkasdfhlafhlasdhfjklashjkfhasjklfhklasjdfh" + "klasdhfjkalsdhfklasdhjkflahsjdkfhklasfhjkasdfhasfjkasdhfklsdhalghhaf;hdklasfhjklashjklfa" + "sdhfasdjklfhsdjklafsd;hkldadfjjklasdhfjasddfjklfhakjklasdjfkl;asdjfasfljasdfhjklasdfhjka"
+ + "ghjkashf;djfklasdjfkljasdklfjklasdjfkljasdfkljaklfj", "\u001BJ\u0003\u0000\u008C\u0094n\u00DE\u00B4\u00D7\u0096\u00B1x\u0086\u00F2-\u00E1\u001A" + "\u00BC\u000B\u001C\u00BA\u00A9\u00C7\u00F7\u00CCn\u00B2B4QD\u008BN\u0013\b\u00A0\u00CDn"
+ + "\u00E8,\u00A5S\u00A1\u009C],\u001D#\u001A\u00D2V\u00BE\u00DB\u00EB&\u00BA\u0003e|\u0096j" + "\u00A2v\u00EC\u00EF\u0087G3\u00D6\'\u000Ec\u0095\u00E2\u001D\u008D,\u00C5\u00D1(\u009F`" + "\u0094o\u0002\u008B\u00DD\u00AAd\u0094,\u001E;e|\u0007EZ\u00B2\u00E2\u00FCI\u0081,\u009F"
+ + "@\u00AE\u00EFh\u0081\u00AC\u0016z\u000F\u00F5;m\u001C\u00B9\u001E-_\u00D5\u00C8\u00AF^" + "\u0085\u00AA\u0005\u00BESu\u00C2\u00B0\"\u008A\u0015\u00C6\u00A3\u00B1\u00E6B\u0014" + "\u00F4\u0084TS\u0019_\u00BE\u00C3\u00F2\u001D\u00D1\u00B7\u00E5\u00DD\u00B6\u00D9#\u00C6"
+ + "\u00F6\u009F\u009E\u00F6Me0\u00FB\u00C0qE\u0004\u00AD\u0003\u00B5\u00BE\u00C9\u00CB" + "\u00FD\u00E2PZFt\u0004\r\u00FF \u0004w\u00B2m\'\u00BFG\u00A9\u009D\u001B\u0096,b\u0090#" + "\u008B\u00E0\u00F8\u001D\u00CF\u00AF\u001D=\u00EE\u008A\u00C8u#f\u00DD\u00DE\u00D6m"
+ + "\u00E3*\u0082\u008Ax\u008A\u00DB\u00E6 L\u00B7\\c\u00BA0\u00E3?\u00B6\u00EE\u008C\"" + "\u00A2*\u00B0\"\n\u0099\u00FF=bQ\u00EE\b\u00F6=J\u00E4\u00CC\u00EF\"\u0087\u0011\u00E2" + "\u0083(\u00E4\u00F5\u008F5\u0019c[\u00E1Z\u0092s\u00DD\u00A1P\u009D8\\\u00EB\u00B5\u0003"
+ + "jd\u0090\u0094\u00C8\u008D\u00FB/\u008A\u0086\"\u00CC\u001D\u0087\u00E0H\n\u0096w\u00909" + "\u00C6##H\u00FB\u0011GV\u00CA \u00E3B\u0081\u00F7w2\u00C1\u00A5\\@!e\u0017@)\u0017\u0017" + "lV2\u00988\u0006\u00DC\u0099M3)\u00BB\u0002\u00DFL&\u0093l\u0017\u0082\u0086 \u00D7"
+ + "\u0003y}\u009A\u0000\u00D7\u0087\u0000\u00E7\u000Bf\u00E3Lfqg\b2\u00F9\b>\u00813\u00CD" + "\u0017r1\u00F0\u00B8\u0094RK\u00901\u008Eh\u00C1\u00EF\u0090\u00C9\u00E5\u00F2a\tr%" + "\u00AD\u00EC\u00C5b\u00C0\u000B\u0012\u0005\u00F7\u0091u\r\u00EEa..\u0019\t\u00C2\u0003"
+ );
+ }
+
+ /// <exception cref="System.IO.IOException"/>
+ [NUnit.Framework.Test]
+ public virtual void TestFox()
+ {
+ CheckDecodeResource("The quick brown fox jumps over the lazy dog", "\u001B*\u0000\u0000\u0004\u0004\u00BAF:\u0085\u0003\u00E9\u00FA\f\u0091\u0002H\u0011," + "\u00F3\u008A:\u00A3V\u007F\u001A\u00AE\u00BF\u00A4\u00AB\u008EM\u00BF\u00ED\u00E2\u0004K"
+ + "\u0091\u00FF\u0087\u00E9\u001E");
+ }
+
+ /// <exception cref="System.IO.IOException"/>
+ [NUnit.Framework.Test]
+ public virtual void TestFoxFox()
+ {
+ CheckDecodeResourceWithDictionary("The quick brown fox jumps over the lazy dog", "\u001B*\u0000\u0000 \u0000\u00C2\u0098\u00B0\u00CA\u0001", "The quick brown fox jumps over the lazy dog");
+ }
+
+ [NUnit.Framework.Test]
+ public virtual void TestUtils()
+ {
+ new Org.Brotli.Dec.Context();
+ new Org.Brotli.Dec.Decode();
+ new Org.Brotli.Dec.Dictionary();
+ new Org.Brotli.Dec.Huffman();
+ new Org.Brotli.Dec.Prefix();
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Dictionary.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Dictionary.cs
new file mode 100644
index 000000000..3445f80f6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Dictionary.cs
@@ -0,0 +1,97 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>Collection of static dictionary words.</summary>
+ /// <remarks>
+ /// Collection of static dictionary words.
+ /// <p>Dictionary content is loaded from binary resource when
+ /// <see cref="GetData()"/>
+ /// is executed for the
+ /// first time. Consequently, it saves memory and CPU in case dictionary is not required.
+ /// <p>One possible drawback is that multiple threads that need dictionary data may be blocked (only
+ /// once in each classworld). To avoid this, it is enough to call
+ /// <see cref="GetData()"/>
+ /// proactively.
+ /// </remarks>
+ internal sealed class Dictionary
+ {
+ /// <summary>"Initialization-on-demand holder idiom" implementation.</summary>
+ /// <remarks>
+ /// "Initialization-on-demand holder idiom" implementation.
+ /// <p>This static class definition is not initialized until the JVM determines that it must be
+ /// executed (when the static method
+ /// <see cref="GetData()"/>
+ /// is invoked).
+ /// </remarks>
+ private class DataHolder0
+ {
+ internal static string GetData()
+ {
+ return "timedownlifeleftbackcodedatashowonlysitecityopenjustlikefreeworktextyearoverbodyloveformbookplaylivelinehelphomesidemorewordlongthemviewfindpagedaysfullheadtermeachareafromtruemarkableuponhighdatelandnewsevennextcasebothpostusedmadehandherewhatnameLinkblogsizebaseheldmakemainuser') +holdendswithNewsreadweresigntakehavegameseencallpathwellplusmenufilmpartjointhislistgoodneedwayswestjobsmindalsologorichuseslastteamarmyfoodkingwilleastwardbestfirePageknowaway.pngmovethanloadgiveselfnotemuchfeedmanyrockicononcelookhidediedHomerulehostajaxinfoclublawslesshalfsomesuchzone100%onescareTimeracebluefourweekfacehopegavehardlostwhenparkkeptpassshiproomHTMLplanTypedonesavekeepflaglinksoldfivetookratetownjumpthusdarkcardfilefearstaykillthatfallautoever.comtalkshopvotedeepmoderestturnbornbandfellroseurl(skinrolecomeactsagesmeetgold.jpgitemvaryfeltthensenddropViewcopy1.0\"</a>stopelseliestourpack.gifpastcss?graymean&gt;rideshotlatesaidroadvar feeljohnrickportfast'UA-dead</b>poorbilltypeU.S.woodmust2px;Inforankwidewantwalllead[0];paulwavesure$('#waitmassarmsgoesgainlangpaid!-- lockunitrootwalkfirmwifexml\"songtest20pxkindrowstoolfontmailsafestarmapscorerainflowbabyspansays4px;6px;artsfootrealwikiheatsteptriporg/lakeweaktoldFormcastfansbankveryrunsjulytask1px;goalgrewslowedgeid=\"sets5px;.js?40pxif (soonseatnonetubezerosentreedfactintogiftharm18pxcamehillboldzoomvoideasyringfillpeakinitcost3px;jacktagsbitsrolleditknewnear<!--growJSONdutyNamesaleyou lotspainjazzcoldeyesfishwww.risktabsprev10pxrise25pxBlueding300,ballfordearnwildbox.fairlackverspairjunetechif(!pickevil$(\"#warmlorddoespull,000ideadrawhugespotfundburnhrefcellkeystickhourlossfuel12pxsuitdealRSS\"agedgreyGET\"easeaimsgirlaids8px;navygridtips#999warsladycars); }php?helltallwhomzh:\u00E5*/\r\n 100hall.\n\nA7px;pushchat0px;crew*/</hash75pxflatrare && tellcampontolaidmissskiptentfinemalegetsplot400,\r\n\r\ncoolfeet.php<br>ericmostguidbelldeschairmathatom/img&#82luckcent000;tinygonehtmlselldrugFREEnodenick?id=losenullvastwindRSS wearrelybeensamedukenasacapewishgulfT23:hitsslotgatekickblurthey15px''););\">msiewinsbirdsortbetaseekT18:ordstreemall60pxfarm\u00E2\u0080\u0099sboys[0].');\"POSTbearkids);}}marytend(UK)quadzh:\u00E6-siz----prop');\rliftT19:viceandydebt>RSSpoolneckblowT16:doorevalT17:letsfailoralpollnovacolsgene \u00E2\u0080\u0094softrometillross<h3>pourfadepink<tr>mini)|!(minezh:\u00E8barshear00);milk -->ironfreddiskwentsoilputs/js/holyT22:ISBNT20:adamsees<h2>json', 'contT21: RSSloopasiamoon</p>soulLINEfortcartT14:<h1>80px!--<9px;T04:mike:46ZniceinchYorkricezh:\u00E4'));puremageparatonebond:37Z_of_']);000,zh:\u00E7tankyardbowlbush:56ZJava30px\n|}\n%C3%:34ZjeffEXPIcashvisagolfsnowzh:\u00E9quer.csssickmeatmin.binddellhirepicsrent:36ZHTTP-201fotowolfEND xbox:54ZBODYdick;\n}\nexit:35Zvarsbeat'});diet999;anne}}</[i].Langkm\u00C2\u00B2wiretoysaddssealalex;\n\t}echonine.org005)tonyjewssandlegsroof000) 200winegeardogsbootgarycutstyletemption.xmlcockgang$('.50pxPh.Dmiscalanloandeskmileryanunixdisc);}\ndustclip).\n\n70px-200DVDs7]><tapedemoi++)wageeurophiloptsholeFAQsasin-26TlabspetsURL bulkcook;}\r\nHEAD[0])abbrjuan(198leshtwin</i>sonyguysfuckpipe|-\n!002)ndow[1];[];\nLog salt\r\n\t\tbangtrimbath){\r\n00px\n});ko:\u00ECfeesad>\rs:// [];tollplug(){\n{\r\n .js'200pdualboat.JPG);\n}quot);\n\n');\n\r\n}\r201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037201320122011201020092008200720062005200420032002200120001999199819971996199519941993199219911990198919881987198619851984198319821981198019791978197719761975197419731972197119701969196819671966196519641963196219611960195919581957195619551954195319521951195010001024139400009999comom\u00C3\u00A1sesteestaperotodohacecadaa\u00C3\u00B1obiend\u00C3\u00ADaas\u00C3\u00ADvidacasootroforosolootracualdijosidograntipotemadebealgoqu\u00C3\u00A9estonadatrespococasabajotodasinoaguapuesunosantediceluisellamayozonaamorpisoobraclicellodioshoracasi\u00D0\u00B7\u00D0\u00B0\u00D0\u00BD\u00D0\u00B0\u00D0\u00BE\u00D0\u00BC\u00D1\u0080\u00D0\u00B0\u00D1\u0080\u00D1\u0083\u00D1\u0082\u00D0\u00B0\u00D0\u00BD\u00D0\u00B5\u00D0\u00BF\u00D0\u00BE\u00D0\u00BE\u00D1\u0082\u00D0\u00B8\u00D0\u00B7\u00D0\u00BD\u00D0\u00BE\u00D0\u00B4\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D0\u00B6\u00D0\u00B5\u00D0\u00BE\u00D0\u00BD\u00D0\u00B8\u00D1\u0085\u00D0\u009D\u00D0\u00B0\u00D0\u00B5\u00D0\u00B5\u00D0\u00B1\u00D1\u008B\u00D0\u00BC\u00D1\u008B\u00D0\u0092\u00D1\u008B\u00D1\u0081\u00D0\u00BE\u00D0\u00B2\u00D1\u008B\u00D0\u00B2\u00D0\u00BE\u00D0\u009D\u00D0\u00BE\u00D0\u00BE\u00D0\u00B1\u00D0\u009F\u00D0\u00BE\u00D0\u00BB\u00D0\u00B8\u00D0\u00BD\u00D0\u00B8\u00D0\u00A0\u00D0\u00A4\u00D0\u009D\u00D0\u00B5\u00D0\u009C\u00D1\u008B\u00D1\u0082\u00D1\u008B\u00D0\u009E\u00D0\u00BD\u00D0\u00B8\u00D0\u00BC\u00D0\u00B4\u00D0\u00B0\u00D0\u0097\u00D0\u00B0\u00D0\u0094\u00D0\u00B0\u00D0\u009D\u00D1\u0083\u00D0\u009E\u00D0\u00B1\u00D1\u0082\u00D0\u00B5\u00D0\u0098\u00D0\u00B7\u00D0\u00B5\u00D0\u00B9\u00D0\u00BD\u00D1\u0083\u00D0\u00BC\u00D0\u00BC\u00D0\u00A2\u00D1\u008B\u00D1\u0083\u00D0\u00B6\u00D9\u0081\u00D9\u008A\u00D8\u00A3\u00D9\u0086\u00D9\u0085\u00D8\u00A7\u00D9\u0085\u00D8\u00B9\u00D9\u0083\u00D9\u0084\u00D8\u00A3\u00D9\u0088\u00D8\u00B1\u00D8\u00AF\u00D9\u008A\u00D8\u00A7\u00D9\u0081\u00D9\u0089\u00D9\u0087\u00D9\u0088\u00D9\u0084\u00D9\u0085\u00D9\u0084\u00D9\u0083\u00D8\u00A7\u00D9\u0088\u00D9\u0084\u00D9\u0087\u00D8\u00A8\u00D8\u00B3\u00D8\u00A7\u00D9\u0084\u00D8\u00A5\u00D9\u0086\u00D9\u0087\u00D9\u008A\u00D8\u00A3\u00D9\u008A\u00D9\u0082\u00D8\u00AF\u00D9\u0087\u00D9\u0084\u00D8\u00AB\u00D9\u0085\u00D8\u00A8\u00D9\u0087\u00D9\u0084\u00D9\u0088\u00D9\u0084\u00D9\u008A\u00D8\u00A8\u00D9\u0084\u00D8\u00A7\u00D9\u008A\u00D8\u00A8\u00D9\u0083\u00D8\u00B4\u00D9\u008A\u00D8\u00A7\u00D9\u0085\u00D8\u00A3\u00D9\u0085\u00D9\u0086\u00D8\u00AA\u00D8\u00A8\u00D9\u008A\u00D9\u0084\u00D9\u0086\u00D8\u00AD\u00D8\u00A8\u00D9\u0087\u00D9\u0085\u00D9\u0085\u00D8\u00B4\u00D9\u0088\u00D8\u00B4firstvideolightworldmediawhitecloseblackrightsmallbooksplacemusicfieldorderpointvalueleveltableboardhousegroupworksyearsstatetodaywaterstartstyledeathpowerphonenighterrorinputabouttermstitletoolseventlocaltimeslargewordsgamesshortspacefocusclearmodelblockguideradiosharewomenagainmoneyimagenamesyounglineslatercolorgreenfront&amp;watchforcepricerulesbeginaftervisitissueareasbelowindextotalhourslabelprintpressbuiltlinksspeedstudytradefoundsenseundershownformsrangeaddedstillmovedtakenaboveflashfixedoftenotherviewschecklegalriveritemsquickshapehumanexistgoingmoviethirdbasicpeacestagewidthloginideaswrotepagesusersdrivestorebreaksouthvoicesitesmonthwherebuildwhichearthforumthreesportpartyClicklowerlivesclasslayerentrystoryusagesoundcourtyour birthpopuptypesapplyImagebeinguppernoteseveryshowsmeansextramatchtrackknownearlybegansuperpapernorthlearngivennamedendedTermspartsGroupbrandusingwomanfalsereadyaudiotakeswhile.com/livedcasesdailychildgreatjudgethoseunitsneverbroadcoastcoverapplefilescyclesceneplansclickwritequeenpieceemailframeolderphotolimitcachecivilscaleenterthemetheretouchboundroyalaskedwholesincestock namefaithheartemptyofferscopeownedmightalbumthinkbloodarraymajortrustcanonunioncountvalidstoneStyleLoginhappyoccurleft:freshquitefilmsgradeneedsurbanfightbasishoverauto;route.htmlmixedfinalYour slidetopicbrownalonedrawnsplitreachRightdatesmarchquotegoodsLinksdoubtasyncthumballowchiefyouthnovel10px;serveuntilhandsCheckSpacequeryjamesequaltwice0,000Startpanelsongsroundeightshiftworthpostsleadsweeksavoidthesemilesplanesmartalphaplantmarksratesplaysclaimsalestextsstarswrong</h3>thing.org/multiheardPowerstandtokensolid(thisbringshipsstafftriedcallsfullyfactsagentThis //-->adminegyptEvent15px;Emailtrue\"crossspentblogsbox\">notedleavechinasizesguest</h4>robotheavytrue,sevengrandcrimesignsawaredancephase><!--en_US&#39;200px_namelatinenjoyajax.ationsmithU.S. holdspeterindianav\">chainscorecomesdoingpriorShare1990sromanlistsjapanfallstrialowneragree</h2>abusealertopera\"-//WcardshillsteamsPhototruthclean.php?saintmetallouismeantproofbriefrow\">genretrucklooksValueFrame.net/-->\n<try {\nvar makescostsplainadultquesttrainlaborhelpscausemagicmotortheir250pxleaststepsCountcouldglasssidesfundshotelawardmouthmovesparisgivesdutchtexasfruitnull,||[];top\">\n<!--POST\"ocean<br/>floorspeakdepth sizebankscatchchart20px;aligndealswould50px;url=\"parksmouseMost ...</amongbrainbody none;basedcarrydraftreferpage_home.meterdelaydreamprovejoint</tr>drugs<!-- aprilidealallenexactforthcodeslogicView seemsblankports (200saved_linkgoalsgrantgreekhomesringsrated30px;whoseparse();\" Blocklinuxjonespixel');\">);if(-leftdavidhorseFocusraiseboxesTrackement</em>bar\">.src=toweralt=\"cablehenry24px;setupitalysharpminortastewantsthis.resetwheelgirls/css/100%;clubsstuffbiblevotes 1000korea});\r\nbandsqueue= {};80px;cking{\r\n\t\taheadclockirishlike ratiostatsForm\"yahoo)[0];Aboutfinds</h1>debugtasksURL =cells})();12px;primetellsturns0x600.jpg\"spainbeachtaxesmicroangel--></giftssteve-linkbody.});\n\tmount (199FAQ</rogerfrankClass28px;feeds<h1><scotttests22px;drink) || lewisshall#039; for lovedwaste00px;ja:\u00E3\u0082simon<fontreplymeetsuntercheaptightBrand) != dressclipsroomsonkeymobilmain.Name platefunnytreescom/\"1.jpgwmodeparamSTARTleft idden, 201);\n}\nform.viruschairtransworstPagesitionpatch<!--\no-cacfirmstours,000 asiani++){adobe')[0]id=10both;menu .2.mi.png\"kevincoachChildbruce2.jpgURL)+.jpg|suitesliceharry120\" sweettr>\r\nname=diegopage swiss-->\n\n#fff;\">Log.com\"treatsheet) && 14px;sleepntentfiledja:\u00E3\u0083id=\"cName\"worseshots-box-delta\n&lt;bears:48Z<data-rural</a> spendbakershops= \"\";php\">ction13px;brianhellosize=o=%2F joinmaybe<img img\">, fjsimg\" \")[0]MTopBType\"newlyDanskczechtrailknows</h5>faq\">zh-cn10);\n-1\");type=bluestrulydavis.js';>\r\n<!steel you h2>\r\nform jesus100% menu.\r\n\t\r\nwalesrisksumentddingb-likteachgif\" vegasdanskeestishqipsuomisobredesdeentretodospuedea\u00C3\u00B1osest\u00C3\u00A1tienehastaotrospartedondenuevohacerformamismomejormundoaqu\u00C3\u00ADd\u00C3\u00ADass\u00C3\u00B3loayudafechatodastantomenosdatosotrassitiomuchoahoralugarmayorestoshorastenerantesfotosestaspa\u00C3\u00ADsnuevasaludforosmedioquienmesespoderchileser\u00C3\u00A1vecesdecirjos\u00C3\u00A9estarventagrupohechoellostengoamigocosasnivelgentemismaairesjuliotemashaciafavorjuniolibrepuntobuenoautorabrilbuenatextomarzosaberlistaluegoc\u00C3\u00B3moenerojuegoper\u00C3\u00BAhaberestoynuncamujervalorfueralibrogustaigualvotoscasosgu\u00C3\u00ADapuedosomosavisousteddebennochebuscafaltaeurosseriedichocursoclavecasasle\u00C3\u00B3nplazolargoobrasvistaapoyojuntotratavistocrearcampohemoscincocargopisosordenhacen\u00C3\u00A1readiscopedrocercapuedapapelmenor\u00C3\u00BAtilclarojorgecalleponertardenadiemarcasigueellassiglocochemotosmadreclaserestoni\u00C3\u00B1oquedapasarbancohijosviajepablo\u00C3\u00A9stevienereinodejarfondocanalnorteletracausatomarmanoslunesautosvillavendopesartipostengamarcollevapadreunidovamoszonasambosbandamariaabusomuchasubirriojavivirgradochicaall\u00C3\u00ADjovendichaestantalessalirsuelopesosfinesllamabusco\u00C3\u00A9stalleganegroplazahumorpagarjuntadobleislasbolsaba\u00C3\u00B1ohablalucha\u00C3\u0081readicenjugarnotasvalleall\u00C3\u00A1cargadolorabajoest\u00C3\u00A9gustomentemariofirmacostofichaplatahogarartesleyesaquelmuseobasespocosmitadcielochicomiedoganarsantoetapadebesplayaredessietecortecoreadudasdeseoviejodeseaaguas&quot;domaincommonstatuseventsmastersystemactionbannerremovescrollupdateglobalmediumfilternumberchangeresultpublicscreenchoosenormaltravelissuessourcetargetspringmodulemobileswitchphotosborderregionitselfsocialactivecolumnrecordfollowtitle>eitherlengthfamilyfriendlayoutauthorcreatereviewsummerserverplayedplayerexpandpolicyformatdoublepointsseriespersonlivingdesignmonthsforcesuniqueweightpeopleenergynaturesearchfigurehavingcustomoffsetletterwindowsubmitrendergroupsuploadhealthmethodvideosschoolfutureshadowdebatevaluesObjectothersrightsleaguechromesimplenoticesharedendingseasonreportonlinesquarebuttonimagesenablemovinglatestwinterFranceperiodstrongrepeatLondondetailformeddemandsecurepassedtoggleplacesdevicestaticcitiesstreamyellowattackstreetflighthiddeninfo\">openedusefulvalleycausesleadersecretseconddamagesportsexceptratingsignedthingseffectfieldsstatesofficevisualeditorvolumeReportmuseummoviesparentaccessmostlymother\" id=\"marketgroundchancesurveybeforesymbolmomentspeechmotioninsidematterCenterobjectexistsmiddleEuropegrowthlegacymannerenoughcareeransweroriginportalclientselectrandomclosedtopicscomingfatheroptionsimplyraisedescapechosenchurchdefinereasoncorneroutputmemoryiframepolicemodelsNumberduringoffersstyleskilledlistedcalledsilvermargindeletebetterbrowselimitsGlobalsinglewidgetcenterbudgetnowrapcreditclaimsenginesafetychoicespirit-stylespreadmakingneededrussiapleaseextentScriptbrokenallowschargedividefactormember-basedtheoryconfigaroundworkedhelpedChurchimpactshouldalwayslogo\" bottomlist\">){var prefixorangeHeader.push(couplegardenbridgelaunchReviewtakingvisionlittledatingButtonbeautythemesforgotSearchanchoralmostloadedChangereturnstringreloadMobileincomesupplySourceordersviewed&nbsp;courseAbout island<html cookiename=\"amazonmodernadvicein</a>: The dialoghousesBEGIN MexicostartscentreheightaddingIslandassetsEmpireSchooleffortdirectnearlymanualSelect.\n\nOnejoinedmenu\">PhilipawardshandleimportOfficeregardskillsnationSportsdegreeweekly (e.g.behinddoctorloggedunited</b></beginsplantsassistartistissued300px|canadaagencyschemeremainBrazilsamplelogo\">beyond-scaleacceptservedmarineFootercamera</h1>\n_form\"leavesstress\" />\r\n.gif\" onloadloaderOxfordsistersurvivlistenfemaleDesignsize=\"appealtext\">levelsthankshigherforcedanimalanyoneAfricaagreedrecentPeople<br />wonderpricesturned|| {};main\">inlinesundaywrap\">failedcensusminutebeaconquotes150px|estateremoteemail\"linkedright;signalformal1.htmlsignupprincefloat:.png\" forum.AccesspaperssoundsextendHeightsliderUTF-8\"&amp; Before. WithstudioownersmanageprofitjQueryannualparamsboughtfamousgooglelongeri++) {israelsayingdecidehome\">headerensurebranchpiecesblock;statedtop\"><racingresize--&gt;pacitysexualbureau.jpg\" 10,000obtaintitlesamount, Inc.comedymenu\" lyricstoday.indeedcounty_logo.FamilylookedMarketlse ifPlayerturkey);var forestgivingerrorsDomain}else{insertBlog</footerlogin.fasteragents<body 10px 0pragmafridayjuniordollarplacedcoversplugin5,000 page\">boston.test(avatartested_countforumsschemaindex,filledsharesreaderalert(appearSubmitline\">body\">\n* TheThoughseeingjerseyNews</verifyexpertinjurywidth=CookieSTART across_imagethreadnativepocketbox\">\nSystem DavidcancertablesprovedApril reallydriveritem\">more\">boardscolorscampusfirst || [];media.guitarfinishwidth:showedOther .php\" assumelayerswilsonstoresreliefswedenCustomeasily your String\n\nWhiltaylorclear:resortfrenchthough\") + \"<body>buyingbrandsMembername\">oppingsector5px;\">vspacepostermajor coffeemartinmaturehappen</nav>kansaslink\">Images=falsewhile hspace0&amp; \n\nIn powerPolski-colorjordanBottomStart -count2.htmlnews\">01.jpgOnline-rightmillerseniorISBN 00,000 guidesvalue)ectionrepair.xml\" rights.html-blockregExp:hoverwithinvirginphones</tr>\rusing \n\tvar >');\n\t</td>\n</tr>\nbahasabrasilgalegomagyarpolskisrpski\u00D8\u00B1\u00D8\u00AF\u00D9\u0088\u00E4\u00B8\u00AD\u00E6\u0096\u0087\u00E7\u00AE\u0080\u00E4\u00BD\u0093\u00E7\u00B9\u0081\u00E9\u00AB\u0094\u00E4\u00BF\u00A1\u00E6\u0081\u00AF\u00E4\u00B8\u00AD\u00E5\u009B\u00BD\u00E6\u0088\u0091\u00E4\u00BB\u00AC\u00E4\u00B8\u0080\u00E4\u00B8\u00AA\u00E5\u0085\u00AC\u00E5\u008F\u00B8\u00E7\u00AE\u00A1\u00E7\u0090\u0086\u00E8\u00AE\u00BA\u00E5\u009D\u009B\u00E5\u008F\u00AF\u00E4\u00BB\u00A5\u00E6\u009C\u008D\u00E5\u008A\u00A1\u00E6\u0097\u00B6\u00E9\u0097\u00B4\u00E4\u00B8\u00AA\u00E4\u00BA\u00BA\u00E4\u00BA\u00A7\u00E5\u0093\u0081\u00E8\u0087\u00AA\u00E5\u00B7\u00B1\u00E4\u00BC\u0081\u00E4\u00B8\u009A\u00E6\u009F\u00A5\u00E7\u009C\u008B\u00E5\u00B7\u00A5\u00E4\u00BD\u009C\u00E8\u0081\u0094\u00E7\u00B3\u00BB\u00E6\u00B2\u00A1\u00E6\u009C\u0089\u00E7\u00BD\u0091\u00E7\u00AB\u0099\u00E6\u0089\u0080\u00E6\u009C\u0089\u00E8\u00AF\u0084\u00E8\u00AE\u00BA\u00E4\u00B8\u00AD\u00E5\u00BF\u0083\u00E6\u0096\u0087\u00E7\u00AB\u00A0\u00E7\u0094\u00A8\u00E6\u0088\u00B7\u00E9\u00A6\u0096\u00E9\u00A1\u00B5\u00E4\u00BD\u009C\u00E8\u0080\u0085\u00E6\u008A\u0080\u00E6\u009C\u00AF\u00E9\u0097\u00AE\u00E9\u00A2\u0098\u00E7\u009B\u00B8\u00E5\u0085\u00B3\u00E4\u00B8\u008B\u00E8\u00BD\u00BD\u00E6\u0090\u009C\u00E7\u00B4\u00A2\u00E4\u00BD\u00BF\u00E7\u0094\u00A8\u00E8\u00BD\u00AF\u00E4\u00BB\u00B6\u00E5\u009C\u00A8\u00E7\u00BA\u00BF\u00E4\u00B8\u00BB\u00E9\u00A2\u0098\u00E8\u00B5\u0084\u00E6\u0096\u0099\u00E8\u00A7\u0086\u00E9\u00A2\u0091\u00E5\u009B\u009E\u00E5\u00A4\u008D\u00E6\u00B3\u00A8\u00E5\u0086\u008C\u00E7\u00BD\u0091\u00E7\u00BB\u009C\u00E6\u0094\u00B6\u00E8\u0097\u008F\u00E5\u0086\u0085\u00E5\u00AE\u00B9\u00E6\u008E\u00A8\u00E8\u008D\u0090\u00E5\u00B8\u0082\u00E5\u009C\u00BA\u00E6\u00B6\u0088\u00E6\u0081\u00AF\u00E7\u00A9\u00BA\u00E9\u0097\u00B4\u00E5\u008F\u0091\u00E5\u00B8\u0083\u00E4\u00BB\u0080\u00E4\u00B9\u0088\u00E5\u00A5\u00BD\u00E5\u008F\u008B\u00E7\u0094\u009F\u00E6\u00B4\u00BB\u00E5\u009B\u00BE\u00E7\u0089\u0087\u00E5\u008F\u0091\u00E5\u00B1\u0095\u00E5\u00A6\u0082\u00E6\u009E\u009C\u00E6\u0089\u008B\u00E6\u009C\u00BA\u00E6\u0096\u00B0\u00E9\u0097\u00BB\u00E6\u009C\u0080\u00E6\u0096\u00B0\u00E6\u0096\u00B9\u00E5\u00BC\u008F\u00E5\u008C\u0097\u00E4\u00BA\u00AC\u00E6\u008F\u0090\u00E4\u00BE\u009B\u00E5\u0085\u00B3\u00E4\u00BA\u008E\u00E6\u009B\u00B4\u00E5\u00A4\u009A\u00E8\u00BF\u0099\u00E4\u00B8\u00AA\u00E7\u00B3\u00BB\u00E7\u00BB\u009F\u00E7\u009F\u00A5\u00E9\u0081\u0093\u00E6\u00B8\u00B8\u00E6\u0088\u008F\u00E5\u00B9\u00BF\u00E5\u0091\u008A\u00E5\u0085\u00B6\u00E4\u00BB\u0096\u00E5\u008F\u0091\u00E8\u00A1\u00A8\u00E5\u00AE\u0089\u00E5\u0085\u00A8\u00E7\u00AC\u00AC\u00E4\u00B8\u0080\u00E4\u00BC\u009A\u00E5\u0091\u0098\u00E8\u00BF\u009B\u00E8\u00A1\u008C\u00E7\u0082\u00B9\u00E5\u0087\u00BB\u00E7\u0089\u0088\u00E6\u009D\u0083\u00E7\u0094\u00B5\u00E5\u00AD\u0090\u00E4\u00B8\u0096\u00E7\u0095\u008C\u00E8\u00AE\u00BE\u00E8\u00AE\u00A1\u00E5\u0085\u008D\u00E8\u00B4\u00B9\u00E6\u0095\u0099\u00E8\u0082\u00B2\u00E5\u008A\u00A0\u00E5\u0085\u00A5\u00E6\u00B4\u00BB\u00E5\u008A\u00A8\u00E4\u00BB\u0096\u00E4\u00BB\u00AC\u00E5\u0095\u0086\u00E5\u0093\u0081\u00E5\u008D\u009A\u00E5\u00AE\u00A2\u00E7\u008E\u00B0\u00E5\u009C\u00A8\u00E4\u00B8\u008A\u00E6\u00B5\u00B7\u00E5\u00A6\u0082\u00E4\u00BD\u0095\u00E5\u00B7\u00B2\u00E7\u00BB\u008F\u00E7\u0095\u0099\u00E8\u00A8\u0080\u00E8\u00AF\u00A6\u00E7\u00BB\u0086\u00E7\u00A4\u00BE\u00E5\u008C\u00BA\u00E7\u0099\u00BB\u00E5\u00BD\u0095\u00E6\u009C\u00AC\u00E7\u00AB\u0099\u00E9\u009C\u0080\u00E8\u00A6\u0081\u00E4\u00BB\u00B7\u00E6\u00A0\u00BC\u00E6\u0094\u00AF\u00E6\u008C\u0081\u00E5\u009B\u00BD\u00E9\u0099\u0085\u00E9\u0093\u00BE\u00E6\u008E\u00A5\u00E5\u009B\u00BD\u00E5\u00AE\u00B6\u00E5\u00BB\u00BA\u00E8\u00AE\u00BE\u00E6\u009C\u008B\u00E5\u008F\u008B\u00E9\u0098\u0085\u00E8\u00AF\u00BB\u00E6\u00B3\u0095\u00E5\u00BE\u008B\u00E4\u00BD\u008D\u00E7\u00BD\u00AE\u00E7\u00BB\u008F\u00E6\u00B5\u008E\u00E9\u0080\u0089\u00E6\u008B\u00A9\u00E8\u00BF\u0099\u00E6\u00A0\u00B7\u00E5\u00BD\u0093\u00E5\u0089\u008D\u00E5\u0088\u0086\u00E7\u00B1\u00BB\u00E6\u008E\u0092\u00E8\u00A1\u008C\u00E5\u009B\u00A0\u00E4\u00B8\u00BA\u00E4\u00BA\u00A4\u00E6\u0098\u0093\u00E6\u009C\u0080\u00E5\u0090\u008E\u00E9\u009F\u00B3\u00E4\u00B9\u0090\u00E4\u00B8\u008D\u00E8\u0083\u00BD\u00E9\u0080\u009A\u00E8\u00BF\u0087\u00E8\u00A1\u008C\u00E4\u00B8\u009A\u00E7\u00A7\u0091\u00E6\u008A\u0080\u00E5\u008F\u00AF\u00E8\u0083\u00BD\u00E8\u00AE\u00BE\u00E5\u00A4\u0087\u00E5\u0090\u0088\u00E4\u00BD\u009C\u00E5\u00A4\u00A7\u00E5\u00AE\u00B6\u00E7\u00A4\u00BE\u00E4\u00BC\u009A\u00E7\u00A0\u0094\u00E7\u00A9\u00B6\u00E4\u00B8\u0093\u00E4\u00B8\u009A\u00E5\u0085\u00A8\u00E9\u0083\u00A8\u00E9\u00A1\u00B9\u00E7\u009B\u00AE\u00E8\u00BF\u0099\u00E9\u0087\u008C\u00E8\u00BF\u0098\u00E6\u0098\u00AF\u00E5\u00BC\u0080\u00E5\u00A7\u008B\u00E6\u0083\u0085\u00E5\u0086\u00B5\u00E7\u0094\u00B5\u00E8\u0084\u0091\u00E6\u0096\u0087\u00E4\u00BB\u00B6\u00E5\u0093\u0081\u00E7\u0089\u008C\u00E5\u00B8\u00AE\u00E5\u008A\u00A9\u00E6\u0096\u0087\u00E5\u008C\u0096\u00E8\u00B5\u0084\u00E6\u00BA\u0090\u00E5\u00A4\u00A7\u00E5\u00AD\u00A6\u00E5\u00AD\u00A6\u00E4\u00B9\u00A0\u00E5\u009C\u00B0\u00E5\u009D\u0080\u00E6\u00B5\u008F\u00E8\u00A7\u0088\u00E6\u008A\u0095\u00E8\u00B5\u0084\u00E5\u00B7\u00A5\u00E7\u00A8\u008B\u00E8\u00A6\u0081\u00E6\u00B1\u0082\u00E6\u0080\u008E\u00E4\u00B9\u0088\u00E6\u0097\u00B6\u00E5\u0080\u0099\u00E5\u008A\u009F\u00E8\u0083\u00BD\u00E4\u00B8\u00BB\u00E8\u00A6\u0081\u00E7\u009B\u00AE\u00E5\u0089\u008D\u00E8\u00B5\u0084\u00E8\u00AE\u00AF\u00E5\u009F\u008E\u00E5\u00B8\u0082\u00E6\u0096\u00B9\u00E6\u00B3\u0095\u00E7\u0094\u00B5\u00E5\u00BD\u00B1\u00E6\u008B\u009B\u00E8\u0081\u0098\u00E5\u00A3\u00B0\u00E6\u0098\u008E\u00E4\u00BB\u00BB\u00E4\u00BD\u0095\u00E5\u0081\u00A5\u00E5\u00BA\u00B7\u00E6\u0095\u00B0\u00E6\u008D\u00AE\u00E7\u00BE\u008E\u00E5\u009B\u00BD\u00E6\u00B1\u00BD\u00E8\u00BD\u00A6\u00E4\u00BB\u008B\u00E7\u00BB\u008D\u00E4\u00BD\u0086\u00E6\u0098\u00AF\u00E4\u00BA\u00A4\u00E6\u00B5\u0081\u00E7\u0094\u009F\u00E4\u00BA\u00A7\u00E6\u0089\u0080\u00E4\u00BB\u00A5\u00E7\u0094\u00B5\u00E8\u00AF\u009D\u00E6\u0098\u00BE\u00E7\u00A4\u00BA\u00E4\u00B8\u0080\u00E4\u00BA\u009B\u00E5\u008D\u0095\u00E4\u00BD\u008D\u00E4\u00BA\u00BA\u00E5\u0091\u0098\u00E5\u0088\u0086\u00E6\u009E\u0090\u00E5\u009C\u00B0\u00E5\u009B\u00BE\u00E6\u0097\u0085\u00E6\u00B8\u00B8\u00E5\u00B7\u00A5\u00E5\u0085\u00B7\u00E5\u00AD\u00A6\u00E7\u0094\u009F\u00E7\u00B3\u00BB\u00E5\u0088\u0097\u00E7\u00BD\u0091\u00E5\u008F\u008B\u00E5\u00B8\u0096\u00E5\u00AD\u0090\u00E5\u00AF\u0086\u00E7\u00A0\u0081\u00E9\u00A2\u0091\u00E9\u0081\u0093\u00E6\u008E\u00A7\u00E5\u0088\u00B6\u00E5\u009C\u00B0\u00E5\u008C\u00BA\u00E5\u009F\u00BA\u00E6\u009C\u00AC\u00E5\u0085\u00A8\u00E5\u009B\u00BD\u00E7\u00BD\u0091\u00E4\u00B8\u008A\u00E9\u0087\u008D\u00E8\u00A6\u0081\u00E7\u00AC\u00AC\u00E4\u00BA\u008C\u00E5\u0096\u009C\u00E6\u00AC\u00A2\u00E8\u00BF\u009B\u00E5\u0085\u00A5\u00E5\u008F\u008B\u00E6\u0083\u0085\u00E8\u00BF\u0099\u00E4\u00BA\u009B\u00E8\u0080\u0083\u00E8\u00AF\u0095\u00E5\u008F\u0091\u00E7\u008E\u00B0\u00E5\u009F\u00B9\u00E8\u00AE\u00AD\u00E4\u00BB\u00A5\u00E4\u00B8\u008A\u00E6\u0094\u00BF\u00E5\u00BA\u009C\u00E6\u0088\u0090\u00E4\u00B8\u00BA\u00E7\u008E\u00AF\u00E5\u00A2\u0083\u00E9\u00A6\u0099\u00E6\u00B8\u00AF\u00E5\u0090\u008C\u00E6\u0097\u00B6\u00E5\u00A8\u00B1\u00E4\u00B9\u0090\u00E5\u008F\u0091\u00E9\u0080\u0081\u00E4\u00B8\u0080\u00E5\u00AE\u009A\u00E5\u00BC\u0080\u00E5\u008F\u0091\u00E4\u00BD\u009C\u00E5\u0093\u0081\u00E6\u00A0\u0087\u00E5\u0087\u0086\u00E6\u00AC\u00A2\u00E8\u00BF\u008E\u00E8\u00A7\u00A3\u00E5\u0086\u00B3\u00E5\u009C\u00B0\u00E6\u0096\u00B9\u00E4\u00B8\u0080\u00E4\u00B8\u008B\u00E4\u00BB\u00A5\u00E5\u008F\u008A\u00E8\u00B4\u00A3\u00E4\u00BB\u00BB\u00E6\u0088\u0096\u00E8\u0080\u0085\u00E5\u00AE\u00A2\u00E6\u0088\u00B7\u00E4\u00BB\u00A3\u00E8\u00A1\u00A8\u00E7\u00A7\u00AF\u00E5\u0088\u0086\u00E5\u00A5\u00B3\u00E4\u00BA\u00BA\u00E6\u0095\u00B0\u00E7\u00A0\u0081\u00E9\u0094\u0080\u00E5\u0094\u00AE\u00E5\u0087\u00BA\u00E7\u008E\u00B0\u00E7\u00A6\u00BB\u00E7\u00BA\u00BF\u00E5\u00BA\u0094\u00E7\u0094\u00A8\u00E5\u0088\u0097\u00E8\u00A1\u00A8\u00E4\u00B8\u008D\u00E5\u0090\u008C\u00E7\u00BC\u0096\u00E8\u00BE\u0091\u00E7\u00BB\u009F\u00E8\u00AE\u00A1\u00E6\u009F\u00A5\u00E8\u00AF\u00A2\u00E4\u00B8\u008D\u00E8\u00A6\u0081\u00E6\u009C\u0089\u00E5\u0085\u00B3\u00E6\u009C\u00BA\u00E6\u009E\u0084\u00E5\u00BE\u0088\u00E5\u00A4\u009A\u00E6\u0092\u00AD\u00E6\u0094\u00BE\u00E7\u00BB\u0084\u00E7\u00BB\u0087\u00E6\u0094\u00BF\u00E7\u00AD\u0096\u00E7\u009B\u00B4\u00E6\u008E\u00A5\u00E8\u0083\u00BD\u00E5\u008A\u009B\u00E6\u009D\u00A5\u00E6\u00BA\u0090\u00E6\u0099\u0082\u00E9\u0096\u0093\u00E7\u009C\u008B\u00E5\u0088\u00B0\u00E7\u0083\u00AD\u00E9\u0097\u00A8\u00E5\u0085\u00B3\u00E9\u0094\u00AE\u00E4\u00B8\u0093\u00E5\u008C\u00BA\u00E9\u009D\u009E\u00E5\u00B8\u00B8\u00E8\u008B\u00B1\u00E8\u00AF\u00AD\u00E7\u0099\u00BE\u00E5\u00BA\u00A6\u00E5\u00B8\u008C\u00E6\u009C\u009B\u00E7\u00BE\u008E\u00E5\u00A5\u00B3\u00E6\u00AF\u0094\u00E8\u00BE\u0083\u00E7\u009F\u00A5\u00E8\u00AF\u0086\u00E8\u00A7\u0084\u00E5\u00AE\u009A\u00E5\u00BB\u00BA\u00E8\u00AE\u00AE\u00E9\u0083\u00A8\u00E9\u0097\u00A8\u00E6\u0084\u008F\u00E8\u00A7\u0081\u00E7\u00B2\u00BE\u00E5\u00BD\u00A9\u00E6\u0097\u00A5\u00E6\u009C\u00AC\u00E6\u008F\u0090\u00E9\u00AB\u0098\u00E5\u008F\u0091\u00E8\u00A8\u0080\u00E6\u0096\u00B9\u00E9\u009D\u00A2\u00E5\u009F\u00BA\u00E9\u0087\u0091\u00E5\u00A4\u0084\u00E7\u0090\u0086\u00E6\u009D\u0083\u00E9\u0099\u0090\u00E5\u00BD\u00B1\u00E7\u0089\u0087\u00E9\u0093\u00B6\u00E8\u00A1\u008C\u00E8\u00BF\u0098\u00E6\u009C\u0089\u00E5\u0088\u0086\u00E4\u00BA\u00AB\u00E7\u0089\u00A9\u00E5\u0093\u0081\u00E7\u00BB\u008F\u00E8\u0090\u00A5\u00E6\u00B7\u00BB\u00E5\u008A\u00A0\u00E4\u00B8\u0093\u00E5\u00AE\u00B6\u00E8\u00BF\u0099\u00E7\u00A7\u008D\u00E8\u00AF\u009D\u00E9\u00A2\u0098\u00E8\u00B5\u00B7\u00E6\u009D\u00A5\u00E4\u00B8\u009A\u00E5\u008A\u00A1\u00E5\u0085\u00AC\u00E5\u0091\u008A\u00E8\u00AE\u00B0\u00E5\u00BD\u0095\u00E7\u00AE\u0080\u00E4\u00BB\u008B\u00E8\u00B4\u00A8\u00E9\u0087\u008F\u00E7\u0094\u00B7\u00E4\u00BA\u00BA\u00E5\u00BD\u00B1\u00E5\u0093\u008D\u00E5\u00BC\u0095\u00E7\u0094\u00A8\u00E6\u008A\u00A5\u00E5\u0091\u008A\u00E9\u0083\u00A8\u00E5\u0088\u0086\u00E5\u00BF\u00AB\u00E9\u0080\u009F\u00E5\u0092\u00A8\u00E8\u00AF\u00A2\u00E6\u0097\u00B6\u00E5\u00B0\u009A\u00E6\u00B3\u00A8\u00E6\u0084\u008F\u00E7\u0094\u00B3\u00E8\u00AF\u00B7\u00E5\u00AD\u00A6\u00E6\u00A0\u00A1\u00E5\u00BA\u0094\u00E8\u00AF\u00A5\u00E5\u008E\u0086\u00E5\u008F\u00B2\u00E5\u008F\u00AA\u00E6\u0098\u00AF\u00E8\u00BF\u0094\u00E5\u009B\u009E\u00E8\u00B4\u00AD\u00E4\u00B9\u00B0\u00E5\u0090\u008D\u00E7\u00A7\u00B0\u00E4\u00B8\u00BA\u00E4\u00BA\u0086\u00E6\u0088\u0090\u00E5\u008A\u009F\u00E8\u00AF\u00B4\u00E6\u0098\u008E\u00E4\u00BE\u009B\u00E5\u00BA\u0094\u00E5\u00AD\u00A9\u00E5\u00AD\u0090\u00E4\u00B8\u0093\u00E9\u00A2\u0098\u00E7\u00A8\u008B\u00E5\u00BA\u008F\u00E4\u00B8\u0080\u00E8\u0088\u00AC\u00E6\u009C\u0083\u00E5\u0093\u00A1\u00E5\u008F\u00AA\u00E6\u009C\u0089\u00E5\u0085\u00B6\u00E5\u00AE\u0083\u00E4\u00BF\u009D\u00E6\u008A\u00A4\u00E8\u0080\u008C\u00E4\u00B8\u0094\u00E4\u00BB\u008A\u00E5\u00A4\u00A9\u00E7\u00AA\u0097\u00E5\u008F\u00A3\u00E5\u008A\u00A8\u00E6\u0080\u0081\u00E7\u008A\u00B6\u00E6\u0080\u0081\u00E7\u0089\u00B9\u00E5\u0088\u00AB\u00E8\u00AE\u00A4\u00E4\u00B8\u00BA\u00E5\u00BF\u0085\u00E9\u00A1\u00BB\u00E6\u009B\u00B4\u00E6\u0096\u00B0\u00E5\u00B0\u008F\u00E8\u00AF\u00B4\u00E6\u0088\u0091\u00E5\u0080\u0091\u00E4\u00BD\u009C\u00E4\u00B8\u00BA\u00E5\u00AA\u0092\u00E4\u00BD\u0093\u00E5\u008C\u0085\u00E6\u008B\u00AC\u00E9\u0082\u00A3\u00E4\u00B9\u0088\u00E4\u00B8\u0080\u00E6\u00A0\u00B7\u00E5\u009B\u00BD\u00E5\u0086\u0085\u00E6\u0098\u00AF\u00E5\u0090\u00A6\u00E6\u00A0\u00B9\u00E6\u008D\u00AE\u00E7\u0094\u00B5\u00E8\u00A7\u0086\u00E5\u00AD\u00A6\u00E9\u0099\u00A2\u00E5\u0085\u00B7\u00E6\u009C\u0089\u00E8\u00BF\u0087\u00E7\u00A8\u008B\u00E7\u0094\u00B1\u00E4\u00BA\u008E\u00E4\u00BA\u00BA\u00E6\u0089\u008D\u00E5\u0087\u00BA\u00E6\u009D\u00A5\u00E4\u00B8\u008D\u00E8\u00BF\u0087\u00E6\u00AD\u00A3\u00E5\u009C\u00A8\u00E6\u0098\u008E\u00E6\u0098\u009F\u00E6\u0095\u0085\u00E4\u00BA\u008B\u00E5\u0085\u00B3\u00E7\u00B3\u00BB\u00E6\u00A0\u0087\u00E9\u00A2\u0098\u00E5\u0095\u0086\u00E5\u008A\u00A1\u00E8\u00BE\u0093\u00E5\u0085\u00A5\u00E4\u00B8\u0080\u00E7\u009B\u00B4\u00E5\u009F\u00BA\u00E7\u00A1\u0080\u00E6\u0095\u0099\u00E5\u00AD\u00A6\u00E4\u00BA\u0086\u00E8\u00A7\u00A3\u00E5\u00BB\u00BA\u00E7\u00AD\u0091\u00E7\u00BB\u0093\u00E6\u009E\u009C\u00E5\u0085\u00A8\u00E7\u0090\u0083\u00E9\u0080\u009A\u00E7\u009F\u00A5\u00E8\u00AE\u00A1\u00E5\u0088\u0092\u00E5\u00AF\u00B9\u00E4\u00BA\u008E\u00E8\u0089\u00BA\u00E6\u009C\u00AF\u00E7\u009B\u00B8\u00E5\u0086\u008C\u00E5\u008F\u0091\u00E7\u0094\u009F\u00E7\u009C\u009F\u00E7\u009A\u0084\u00E5\u00BB\u00BA\u00E7\u00AB\u008B\u00E7\u00AD\u0089\u00E7\u00BA\u00A7\u00E7\u00B1\u00BB\u00E5\u009E\u008B\u00E7\u00BB\u008F\u00E9\u00AA\u008C\u00E5\u00AE\u009E\u00E7\u008E\u00B0\u00E5\u0088\u00B6\u00E4\u00BD\u009C\u00E6\u009D\u00A5\u00E8\u0087\u00AA\u00E6\u00A0\u0087\u00E7\u00AD\u00BE\u00E4\u00BB\u00A5\u00E4\u00B8\u008B\u00E5\u008E\u009F\u00E5\u0088\u009B\u00E6\u0097\u00A0\u00E6\u00B3\u0095\u00E5\u0085\u00B6\u00E4\u00B8\u00AD\u00E5\u0080\u008B\u00E4\u00BA\u00BA\u00E4\u00B8\u0080\u00E5\u0088\u0087\u00E6\u008C\u0087\u00E5\u008D\u0097\u00E5\u0085\u00B3\u00E9\u0097\u00AD\u00E9\u009B\u0086\u00E5\u009B\u00A2\u00E7\u00AC\u00AC\u00E4\u00B8\u0089\u00E5\u0085\u00B3\u00E6\u00B3\u00A8\u00E5\u009B\u00A0\u00E6\u00AD\u00A4\u00E7\u0085\u00A7\u00E7\u0089\u0087\u00E6\u00B7\u00B1\u00E5\u009C\u00B3\u00E5\u0095\u0086\u00E4\u00B8\u009A\u00E5\u00B9\u00BF\u00E5\u00B7\u009E\u00E6\u0097\u00A5\u00E6\u009C\u009F\u00E9\u00AB\u0098\u00E7\u00BA\u00A7\u00E6\u009C\u0080\u00E8\u00BF\u0091\u00E7\u00BB\u00BC\u00E5\u0090\u0088\u00E8\u00A1\u00A8\u00E7\u00A4\u00BA\u00E4\u00B8\u0093\u00E8\u00BE\u0091\u00E8\u00A1\u008C\u00E4\u00B8\u00BA\u00E4\u00BA\u00A4\u00E9\u0080\u009A\u00E8\u00AF\u0084\u00E4\u00BB\u00B7\u00E8\u00A7\u0089\u00E5\u00BE\u0097\u00E7\u00B2\u00BE\u00E5\u008D\u008E\u00E5\u00AE\u00B6\u00E5\u00BA\u00AD\u00E5\u00AE\u008C\u00E6\u0088\u0090\u00E6\u0084\u009F\u00E8\u00A7\u0089\u00E5\u00AE\u0089\u00E8\u00A3\u0085\u00E5\u00BE\u0097\u00E5\u0088\u00B0\u00E9\u0082\u00AE\u00E4\u00BB\u00B6\u00E5\u0088\u00B6\u00E5\u00BA\u00A6\u00E9\u00A3\u009F\u00E5\u0093\u0081\u00E8\u0099\u00BD\u00E7\u0084\u00B6\u00E8\u00BD\u00AC\u00E8\u00BD\u00BD\u00E6\u008A\u00A5\u00E4\u00BB\u00B7\u00E8\u00AE\u00B0\u00E8\u0080\u0085\u00E6\u0096\u00B9\u00E6\u00A1\u0088\u00E8\u00A1\u008C\u00E6\u0094\u00BF\u00E4\u00BA\u00BA\u00E6\u00B0\u0091\u00E7\u0094\u00A8\u00E5\u0093\u0081\u00E4\u00B8\u009C\u00E8\u00A5\u00BF\u00E6\u008F\u0090\u00E5\u0087\u00BA\u00E9\u0085\u0092\u00E5\u00BA\u0097\u00E7\u0084\u00B6\u00E5\u0090\u008E\u00E4\u00BB\u0098\u00E6\u00AC\u00BE\u00E7\u0083\u00AD\u00E7\u0082\u00B9\u00E4\u00BB\u00A5\u00E5\u0089\u008D\u00E5\u00AE\u008C\u00E5\u0085\u00A8\u00E5\u008F\u0091\u00E5\u00B8\u0096\u00E8\u00AE\u00BE\u00E7\u00BD\u00AE\u00E9\u00A2\u0086\u00E5\u00AF\u00BC\u00E5\u00B7\u00A5\u00E4\u00B8\u009A\u00E5\u008C\u00BB\u00E9\u0099\u00A2\u00E7\u009C\u008B\u00E7\u009C\u008B\u00E7\u00BB\u008F\u00E5\u0085\u00B8\u00E5\u008E\u009F\u00E5\u009B\u00A0\u00E5\u00B9\u00B3\u00E5\u008F\u00B0\u00E5\u0090\u0084\u00E7\u00A7\u008D\u00E5\u00A2\u009E\u00E5\u008A\u00A0\u00E6\u009D\u0090\u00E6\u0096\u0099\u00E6\u0096\u00B0\u00E5\u00A2\u009E\u00E4\u00B9\u008B\u00E5\u0090\u008E\u00E8\u0081\u008C\u00E4\u00B8\u009A\u00E6\u0095\u0088\u00E6\u009E\u009C\u00E4\u00BB\u008A\u00E5\u00B9\u00B4\u00E8\u00AE\u00BA\u00E6\u0096\u0087\u00E6\u0088\u0091\u00E5\u009B\u00BD\u00E5\u0091\u008A\u00E8\u00AF\u0089\u00E7\u0089\u0088\u00E4\u00B8\u00BB\u00E4\u00BF\u00AE\u00E6\u0094\u00B9\u00E5\u008F\u0082\u00E4\u00B8\u008E\u00E6\u0089\u0093\u00E5\u008D\u00B0\u00E5\u00BF\u00AB\u00E4\u00B9\u0090\u00E6\u009C\u00BA\u00E6\u00A2\u00B0\u00E8\u00A7\u0082\u00E7\u0082\u00B9\u00E5\u00AD\u0098\u00E5\u009C\u00A8\u00E7\u00B2\u00BE\u00E7\u00A5\u009E\u00E8\u008E\u00B7\u00E5\u00BE\u0097\u00E5\u0088\u00A9\u00E7\u0094\u00A8\u00E7\u00BB\u00A7\u00E7\u00BB\u00AD\u00E4\u00BD\u00A0\u00E4\u00BB\u00AC\u00E8\u00BF\u0099\u00E4\u00B9\u0088\u00E6\u00A8\u00A1\u00E5\u00BC\u008F\u00E8\u00AF\u00AD\u00E8\u00A8\u0080\u00E8\u0083\u00BD\u00E5\u00A4\u009F\u00E9\u009B\u0085\u00E8\u0099\u008E\u00E6\u0093\u008D\u00E4\u00BD\u009C\u00E9\u00A3\u008E\u00E6\u00A0\u00BC\u00E4\u00B8\u0080\u00E8\u00B5\u00B7\u00E7\u00A7\u0091\u00E5\u00AD\u00A6\u00E4\u00BD\u0093\u00E8\u0082\u00B2\u00E7\u009F\u00AD\u00E4\u00BF\u00A1\u00E6\u009D\u00A1\u00E4\u00BB\u00B6\u00E6\u00B2\u00BB\u00E7\u0096\u0097\u00E8\u00BF\u0090\u00E5\u008A\u00A8\u00E4\u00BA\u00A7\u00E4\u00B8\u009A\u00E4\u00BC\u009A\u00E8\u00AE\u00AE\u00E5\u00AF\u00BC\u00E8\u0088\u00AA\u00E5\u0085\u0088\u00E7\u0094\u009F\u00E8\u0081\u0094\u00E7\u009B\u009F\u00E5\u008F\u00AF\u00E6\u0098\u00AF\u00E5\u0095\u008F\u00E9\u00A1\u008C\u00E7\u00BB\u0093\u00E6\u009E\u0084\u00E4\u00BD\u009C\u00E7\u0094\u00A8\u00E8\u00B0\u0083\u00E6\u009F\u00A5\u00E8\u00B3\u0087\u00E6\u0096\u0099\u00E8\u0087\u00AA\u00E5\u008A\u00A8\u00E8\u00B4\u009F\u00E8\u00B4\u00A3\u00E5\u0086\u009C\u00E4\u00B8\u009A\u00E8\u00AE\u00BF\u00E9\u0097\u00AE\u00E5\u00AE\u009E\u00E6\u0096\u00BD\u00E6\u008E\u00A5\u00E5\u008F\u0097\u00E8\u00AE\u00A8\u00E8\u00AE\u00BA\u00E9\u0082\u00A3\u00E4\u00B8\u00AA\u00E5\u008F\u008D\u00E9\u00A6\u0088\u00E5\u008A\u00A0\u00E5\u00BC\u00BA\u00E5\u00A5\u00B3\u00E6\u0080\u00A7\u00E8\u008C\u0083\u00E5\u009B\u00B4\u00E6\u009C\u008D\u00E5\u008B\u0099\u00E4\u00BC\u0091\u00E9\u0097\u00B2\u00E4\u00BB\u008A\u00E6\u0097\u00A5\u00E5\u00AE\u00A2\u00E6\u009C\u008D\u00E8\u00A7\u0080\u00E7\u009C\u008B\u00E5\u008F\u0082\u00E5\u008A\u00A0\u00E7\u009A\u0084\u00E8\u00AF\u009D\u00E4\u00B8\u0080\u00E7\u0082\u00B9\u00E4\u00BF\u009D\u00E8\u00AF\u0081\u00E5\u009B\u00BE\u00E4\u00B9\u00A6\u00E6\u009C\u0089\u00E6\u0095\u0088\u00E6\u00B5\u008B\u00E8\u00AF\u0095\u00E7\u00A7\u00BB\u00E5\u008A\u00A8\u00E6\u0089\u008D\u00E8\u0083\u00BD\u00E5\u0086\u00B3\u00E5\u00AE\u009A\u00E8\u0082\u00A1\u00E7\u00A5\u00A8\u00E4\u00B8\u008D\u00E6\u0096\u00AD\u00E9\u009C\u0080\u00E6\u00B1\u0082\u00E4\u00B8\u008D\u00E5\u00BE\u0097\u00E5\u008A\u009E\u00E6\u00B3\u0095\u00E4\u00B9\u008B\u00E9\u0097\u00B4\u00E9\u0087\u0087\u00E7\u0094\u00A8\u00E8\u0090\u00A5\u00E9\u0094\u0080\u00E6\u008A\u0095\u00E8\u00AF\u0089\u00E7\u009B\u00AE\u00E6\u00A0\u0087\u00E7\u0088\u00B1\u00E6\u0083\u0085\u00E6\u0091\u0084\u00E5\u00BD\u00B1\u00E6\u009C\u0089\u00E4\u00BA\u009B\u00E8\u00A4\u0087\u00E8\u00A3\u00BD\u00E6\u0096\u0087\u00E5\u00AD\u00A6\u00E6\u009C\u00BA\u00E4\u00BC\u009A\u00E6\u0095\u00B0\u00E5\u00AD\u0097\u00E8\u00A3\u0085\u00E4\u00BF\u00AE\u00E8\u00B4\u00AD\u00E7\u0089\u00A9\u00E5\u0086\u009C\u00E6\u009D\u0091\u00E5\u0085\u00A8\u00E9\u009D\u00A2\u00E7\u00B2\u00BE\u00E5\u0093\u0081\u00E5\u0085\u00B6\u00E5\u00AE\u009E\u00E4\u00BA\u008B\u00E6\u0083\u0085\u00E6\u00B0\u00B4\u00E5\u00B9\u00B3\u00E6\u008F\u0090\u00E7\u00A4\u00BA\u00E4\u00B8\u008A\u00E5\u00B8\u0082\u00E8\u00B0\u00A2\u00E8\u00B0\u00A2\u00E6\u0099\u00AE\u00E9\u0080\u009A\u00E6\u0095\u0099\u00E5\u00B8\u0088\u00E4\u00B8\u008A\u00E4\u00BC\u00A0\u00E7\u00B1\u00BB\u00E5\u0088\u00AB\u00E6\u00AD\u008C\u00E6\u009B\u00B2\u00E6\u008B\u00A5\u00E6\u009C\u0089\u00E5\u0088\u009B\u00E6\u0096\u00B0\u00E9\u0085\u008D\u00E4\u00BB\u00B6\u00E5\u008F\u00AA\u00E8\u00A6\u0081\u00E6\u0097\u00B6\u00E4\u00BB\u00A3\u00E8\u00B3\u0087\u00E8\u00A8\u008A\u00E8\u00BE\u00BE\u00E5\u0088\u00B0\u00E4\u00BA\u00BA\u00E7\u0094\u009F\u00E8\u00AE\u00A2\u00E9\u0098\u0085\u00E8\u0080\u0081\u00E5\u00B8\u0088\u00E5\u00B1\u0095\u00E7\u00A4\u00BA\u00E5\u00BF\u0083\u00E7\u0090\u0086\u00E8\u00B4\u00B4\u00E5\u00AD\u0090\u00E7\u00B6\u00B2\u00E7\u00AB\u0099\u00E4\u00B8\u00BB\u00E9\u00A1\u008C\u00E8\u0087\u00AA\u00E7\u0084\u00B6\u00E7\u00BA\u00A7\u00E5\u0088\u00AB\u00E7\u00AE\u0080\u00E5\u008D\u0095\u00E6\u0094\u00B9\u00E9\u009D\u00A9\u00E9\u0082\u00A3\u00E4\u00BA\u009B\u00E6\u009D\u00A5\u00E8\u00AF\u00B4\u00E6\u0089\u0093\u00E5\u00BC\u0080\u00E4\u00BB\u00A3\u00E7\u00A0\u0081\u00E5\u0088\u00A0\u00E9\u0099\u00A4\u00E8\u00AF\u0081\u00E5\u0088\u00B8\u00E8\u008A\u0082\u00E7\u009B\u00AE\u00E9\u0087\u008D\u00E7\u0082\u00B9\u00E6\u00AC\u00A1\u00E6\u0095\u00B8\u00E5\u00A4\u009A\u00E5\u00B0\u0091\u00E8\u00A7\u0084\u00E5\u0088\u0092\u00E8\u00B5\u0084\u00E9\u0087\u0091\u00E6\u0089\u00BE\u00E5\u0088\u00B0\u00E4\u00BB\u00A5\u00E5\u0090\u008E\u00E5\u00A4\u00A7\u00E5\u0085\u00A8\u00E4\u00B8\u00BB\u00E9\u00A1\u00B5\u00E6\u009C\u0080\u00E4\u00BD\u00B3\u00E5\u009B\u009E\u00E7\u00AD\u0094\u00E5\u00A4\u00A9\u00E4\u00B8\u008B\u00E4\u00BF\u009D\u00E9\u009A\u009C\u00E7\u008E\u00B0\u00E4\u00BB\u00A3\u00E6\u00A3\u0080\u00E6\u009F\u00A5\u00E6\u008A\u0095\u00E7\u00A5\u00A8\u00E5\u00B0\u008F\u00E6\u0097\u00B6\u00E6\u00B2\u0092\u00E6\u009C\u0089\u00E6\u00AD\u00A3\u00E5\u00B8\u00B8\u00E7\u0094\u009A\u00E8\u0087\u00B3\u00E4\u00BB\u00A3\u00E7\u0090\u0086\u00E7\u009B\u00AE\u00E5\u00BD\u0095\u00E5\u0085\u00AC\u00E5\u00BC\u0080\u00E5\u00A4\u008D\u00E5\u0088\u00B6\u00E9\u0087\u0091\u00E8\u009E\u008D\u00E5\u00B9\u00B8\u00E7\u00A6\u008F\u00E7\u0089\u0088\u00E6\u009C\u00AC\u00E5\u00BD\u00A2\u00E6\u0088\u0090\u00E5\u0087\u0086\u00E5\u00A4\u0087\u00E8\u00A1\u008C\u00E6\u0083\u0085\u00E5\u009B\u009E\u00E5\u0088\u00B0\u00E6\u0080\u009D\u00E6\u0083\u00B3\u00E6\u0080\u008E\u00E6\u00A0\u00B7\u00E5\u008D\u008F\u00E8\u00AE\u00AE\u00E8\u00AE\u00A4\u00E8\u00AF\u0081\u00E6\u009C\u0080\u00E5\u00A5\u00BD\u00E4\u00BA\u00A7\u00E7\u0094\u009F\u00E6\u008C\u0089\u00E7\u0085\u00A7\u00E6\u009C\u008D\u00E8\u00A3\u0085\u00E5\u00B9\u00BF\u00E4\u00B8\u009C\u00E5\u008A\u00A8\u00E6\u00BC\u00AB\u00E9\u0087\u0087\u00E8\u00B4\u00AD\u00E6\u0096\u00B0\u00E6\u0089\u008B\u00E7\u00BB\u0084\u00E5\u009B\u00BE\u00E9\u009D\u00A2\u00E6\u009D\u00BF\u00E5\u008F\u0082\u00E8\u0080\u0083\u00E6\u0094\u00BF\u00E6\u00B2\u00BB\u00E5\u00AE\u00B9\u00E6\u0098\u0093\u00E5\u00A4\u00A9\u00E5\u009C\u00B0\u00E5\u008A\u00AA\u00E5\u008A\u009B\u00E4\u00BA\u00BA\u00E4\u00BB\u00AC\u00E5\u008D\u0087\u00E7\u00BA\u00A7\u00E9\u0080\u009F\u00E5\u00BA\u00A6\u00E4\u00BA\u00BA\u00E7\u0089\u00A9\u00E8\u00B0\u0083\u00E6\u0095\u00B4\u00E6\u00B5\u0081\u00E8\u00A1\u008C\u00E9\u0080\u00A0\u00E6\u0088\u0090\u00E6\u0096\u0087\u00E5\u00AD\u0097\u00E9\u009F\u00A9\u00E5\u009B\u00BD\u00E8\u00B4\u00B8\u00E6\u0098\u0093\u00E5\u00BC\u0080\u00E5\u00B1\u0095\u00E7\u009B\u00B8\u00E9\u0097\u009C\u00E8\u00A1\u00A8\u00E7\u008E\u00B0\u00E5\u00BD\u00B1\u00E8\u00A7\u0086\u00E5\u00A6\u0082\u00E6\u00AD\u00A4\u00E7\u00BE\u008E\u00E5\u00AE\u00B9\u00E5\u00A4\u00A7\u00E5\u00B0\u008F\u00E6\u008A\u00A5\u00E9\u0081\u0093\u00E6\u009D\u00A1\u00E6\u00AC\u00BE\u00E5\u00BF\u0083\u00E6\u0083\u0085\u00E8\u00AE\u00B8\u00E5\u00A4\u009A\u00E6\u00B3\u0095\u00E8\u00A7\u0084\u00E5\u00AE\u00B6\u00E5\u00B1\u0085\u00E4\u00B9\u00A6\u00E5\u00BA\u0097\u00E8\u00BF\u009E\u00E6\u008E\u00A5\u00E7\u00AB\u008B\u00E5\u008D\u00B3\u00E4\u00B8\u00BE\u00E6\u008A\u00A5\u00E6\u008A\u0080\u00E5\u00B7\u00A7\u00E5\u00A5\u00A5\u00E8\u00BF\u0090\u00E7\u0099\u00BB\u00E5\u0085\u00A5\u00E4\u00BB\u00A5\u00E6\u009D\u00A5\u00E7\u0090\u0086\u00E8\u00AE\u00BA\u00E4\u00BA\u008B\u00E4\u00BB\u00B6\u00E8\u0087\u00AA\u00E7\u0094\u00B1\u00E4\u00B8\u00AD\u00E5\u008D\u008E\u00E5\u008A\u009E\u00E5\u0085\u00AC\u00E5\u00A6\u0088\u00E5\u00A6\u0088\u00E7\u009C\u009F\u00E6\u00AD\u00A3\u00E4\u00B8\u008D\u00E9\u0094\u0099\u00E5\u0085\u00A8\u00E6\u0096\u0087\u00E5\u0090\u0088\u00E5\u0090\u008C\u00E4\u00BB\u00B7\u00E5\u0080\u00BC\u00E5\u0088\u00AB\u00E4\u00BA\u00BA\u00E7\u009B\u0091\u00E7\u009D\u00A3\u00E5\u0085\u00B7\u00E4\u00BD\u0093\u00E4\u00B8\u0096\u00E7\u00BA\u00AA\u00E5\u009B\u00A2\u00E9\u0098\u009F\u00E5\u0088\u009B\u00E4\u00B8\u009A\u00E6\u0089\u00BF\u00E6\u008B\u0085\u00E5\u00A2\u009E\u00E9\u0095\u00BF\u00E6\u009C\u0089\u00E4\u00BA\u00BA\u00E4\u00BF\u009D\u00E6\u008C\u0081\u00E5\u0095\u0086\u00E5\u00AE\u00B6\u00E7\u00BB\u00B4\u00E4\u00BF\u00AE\u00E5\u008F\u00B0\u00E6\u00B9\u00BE\u00E5\u00B7\u00A6\u00E5\u008F\u00B3\u00E8\u0082\u00A1\u00E4\u00BB\u00BD\u00E7\u00AD\u0094\u00E6\u00A1\u0088\u00E5\u00AE\u009E\u00E9\u0099\u0085\u00E7\u0094\u00B5\u00E4\u00BF\u00A1\u00E7\u00BB\u008F\u00E7\u0090\u0086\u00E7\u0094\u009F\u00E5\u0091\u00BD\u00E5\u00AE\u00A3\u00E4\u00BC\u00A0\u00E4\u00BB\u00BB\u00E5\u008A\u00A1\u00E6\u00AD\u00A3\u00E5\u00BC\u008F\u00E7\u0089\u00B9\u00E8\u0089\u00B2\u00E4\u00B8\u008B\u00E6\u009D\u00A5\u00E5\u008D\u008F\u00E4\u00BC\u009A\u00E5\u008F\u00AA\u00E8\u0083\u00BD\u00E5\u00BD\u0093\u00E7\u0084\u00B6\u00E9\u0087\u008D\u00E6\u0096\u00B0\u00E5\u0085\u00A7\u00E5\u00AE\u00B9\u00E6\u008C\u0087\u00E5\u00AF\u00BC\u00E8\u00BF\u0090\u00E8\u00A1\u008C\u00E6\u0097\u00A5\u00E5\u00BF\u0097\u00E8\u00B3\u00A3\u00E5\u00AE\u00B6\u00E8\u00B6\u0085\u00E8\u00BF\u0087\u00E5\u009C\u009F\u00E5\u009C\u00B0\u00E6\u00B5\u0099\u00E6\u00B1\u009F\u00E6\u0094\u00AF\u00E4\u00BB\u0098\u00E6\u008E\u00A8\u00E5\u0087\u00BA\u00E7\u00AB\u0099\u00E9\u0095\u00BF\u00E6\u009D\u00AD\u00E5\u00B7\u009E\u00E6\u0089\u00A7\u00E8\u00A1\u008C\u00E5\u0088\u00B6\u00E9\u0080\u00A0\u00E4\u00B9\u008B\u00E4\u00B8\u0080\u00E6\u008E\u00A8\u00E5\u00B9\u00BF\u00E7\u008E\u00B0\u00E5\u009C\u00BA\u00E6\u008F\u008F\u00E8\u00BF\u00B0\u00E5\u008F\u0098\u00E5\u008C\u0096\u00E4\u00BC\u00A0\u00E7\u00BB\u009F\u00E6\u00AD\u008C\u00E6\u0089\u008B\u00E4\u00BF\u009D\u00E9\u0099\u00A9\u00E8\u00AF\u00BE\u00E7\u00A8\u008B\u00E5\u008C\u00BB\u00E7\u0096\u0097\u00E7\u00BB\u008F\u00E8\u00BF\u0087\u00E8\u00BF\u0087\u00E5\u008E\u00BB\u00E4\u00B9\u008B\u00E5\u0089\u008D\u00E6\u0094\u00B6\u00E5\u0085\u00A5\u00E5\u00B9\u00B4\u00E5\u00BA\u00A6\u00E6\u009D\u0082\u00E5\u00BF\u0097\u00E7\u00BE\u008E\u00E4\u00B8\u00BD\u00E6\u009C\u0080\u00E9\u00AB\u0098\u00E7\u0099\u00BB\u00E9\u0099\u0086\u00E6\u009C\u00AA\u00E6\u009D\u00A5\u00E5\u008A\u00A0\u00E5\u00B7\u00A5\u00E5\u0085\u008D\u00E8\u00B4\u00A3\u00E6\u0095\u0099\u00E7\u00A8\u008B\u00E7\u0089\u0088\u00E5\u009D\u0097\u00E8\u00BA\u00AB\u00E4\u00BD\u0093\u00E9\u0087\u008D\u00E5\u00BA\u0086\u00E5\u0087\u00BA\u00E5\u0094\u00AE\u00E6\u0088\u0090\u00E6\u009C\u00AC\u00E5\u00BD\u00A2\u00E5\u00BC\u008F\u00E5\u009C\u009F\u00E8\u00B1\u0086\u00E5\u0087\u00BA\u00E5\u0083\u00B9\u00E4\u00B8\u009C\u00E6\u0096\u00B9\u00E9\u0082\u00AE\u00E7\u00AE\u00B1\u00E5\u008D\u0097\u00E4\u00BA\u00AC\u00E6\u00B1\u0082\u00E8\u0081\u008C\u00E5\u008F\u0096\u00E5\u00BE\u0097\u00E8\u0081\u008C\u00E4\u00BD\u008D\u00E7\u009B\u00B8\u00E4\u00BF\u00A1\u00E9\u00A1\u00B5\u00E9\u009D\u00A2\u00E5\u0088\u0086\u00E9\u0092\u009F\u00E7\u00BD\u0091\u00E9\u00A1\u00B5\u00E7\u00A1\u00AE\u00E5\u00AE\u009A\u00E5\u009B\u00BE\u00E4\u00BE\u008B\u00E7\u00BD\u0091\u00E5\u009D\u0080\u00E7\u00A7\u00AF\u00E6\u009E\u0081\u00E9\u0094\u0099\u00E8\u00AF\u00AF\u00E7\u009B\u00AE\u00E7\u009A\u0084\u00E5\u00AE\u009D\u00E8\u00B4\u009D\u00E6\u009C\u00BA\u00E5\u0085\u00B3\u00E9\u00A3\u008E\u00E9\u0099\u00A9\u00E6\u008E\u0088\u00E6\u009D\u0083\u00E7\u0097\u0085\u00E6\u00AF\u0092\u00E5\u00AE\u00A0\u00E7\u0089\u00A9\u00E9\u0099\u00A4\u00E4\u00BA\u0086\u00E8\u00A9\u0095\u00E8\u00AB\u0096\u00E7\u0096\u00BE\u00E7\u0097\u0085\u00E5\u008F\u008A\u00E6\u0097\u00B6\u00E6\u00B1\u0082\u00E8\u00B4\u00AD\u00E7\u00AB\u0099\u00E7\u0082\u00B9\u00E5\u0084\u00BF\u00E7\u00AB\u00A5\u00E6\u00AF\u008F\u00E5\u00A4\u00A9\u00E4\u00B8\u00AD\u00E5\u00A4\u00AE\u00E8\u00AE\u00A4\u00E8\u00AF\u0086\u00E6\u00AF\u008F\u00E4\u00B8\u00AA\u00E5\u00A4\u00A9\u00E6\u00B4\u00A5\u00E5\u00AD\u0097\u00E4\u00BD\u0093\u00E5\u008F\u00B0\u00E7\u0081\u00A3\u00E7\u00BB\u00B4\u00E6\u008A\u00A4\u00E6\u009C\u00AC\u00E9\u00A1\u00B5\u00E4\u00B8\u00AA\u00E6\u0080\u00A7\u00E5\u00AE\u0098\u00E6\u0096\u00B9\u00E5\u00B8\u00B8\u00E8\u00A7\u0081\u00E7\u009B\u00B8\u00E6\u009C\u00BA\u00E6\u0088\u0098\u00E7\u0095\u00A5\u00E5\u00BA\u0094\u00E5\u00BD\u0093\u00E5\u00BE\u008B\u00E5\u00B8\u0088\u00E6\u0096\u00B9\u00E4\u00BE\u00BF\u00E6\u00A0\u00A1\u00E5\u009B\u00AD\u00E8\u0082\u00A1\u00E5\u00B8\u0082\u00E6\u0088\u00BF\u00E5\u00B1\u008B\u00E6\u00A0\u008F\u00E7\u009B\u00AE\u00E5\u0091\u0098\u00E5\u00B7\u00A5\u00E5\u00AF\u00BC\u00E8\u0087\u00B4\u00E7\u00AA\u0081\u00E7\u0084\u00B6\u00E9\u0081\u0093\u00E5\u0085\u00B7\u00E6\u009C\u00AC\u00E7\u00BD\u0091\u00E7\u00BB\u0093\u00E5\u0090\u0088\u00E6\u00A1\u00A3\u00E6\u00A1\u0088\u00E5\u008A\u00B3\u00E5\u008A\u00A8\u00E5\u008F\u00A6\u00E5\u00A4\u0096\u00E7\u00BE\u008E\u00E5\u0085\u0083\u00E5\u00BC\u0095\u00E8\u00B5\u00B7\u00E6\u0094\u00B9\u00E5\u008F\u0098\u00E7\u00AC\u00AC\u00E5\u009B\u009B\u00E4\u00BC\u009A\u00E8\u00AE\u00A1\u00E8\u00AA\u00AA\u00E6\u0098\u008E\u00E9\u009A\u0090\u00E7\u00A7\u0081\u00E5\u00AE\u009D\u00E5\u00AE\u009D\u00E8\u00A7\u0084\u00E8\u008C\u0083\u00E6\u00B6\u0088\u00E8\u00B4\u00B9\u00E5\u0085\u00B1\u00E5\u0090\u008C\u00E5\u00BF\u0098\u00E8\u00AE\u00B0\u00E4\u00BD\u0093\u00E7\u00B3\u00BB\u00E5\u00B8\u00A6\u00E6\u009D\u00A5\u00E5\u0090\u008D\u00E5\u00AD\u0097\u00E7\u0099\u00BC\u00E8\u00A1\u00A8\u00E5\u00BC\u0080\u00E6\u0094\u00BE\u00E5\u008A\u00A0\u00E7\u009B\u009F\u00E5\u008F\u0097\u00E5\u0088\u00B0\u00E4\u00BA\u008C\u00E6\u0089\u008B\u00E5\u00A4\u00A7\u00E9\u0087\u008F\u00E6\u0088\u0090\u00E4\u00BA\u00BA\u00E6\u0095\u00B0\u00E9\u0087\u008F\u00E5\u0085\u00B1\u00E4\u00BA\u00AB\u00E5\u008C\u00BA\u00E5\u009F\u009F\u00E5\u00A5\u00B3\u00E5\u00AD\u00A9\u00E5\u008E\u009F\u00E5\u0088\u0099\u00E6\u0089\u0080\u00E5\u009C\u00A8\u00E7\u00BB\u0093\u00E6\u009D\u009F\u00E9\u0080\u009A\u00E4\u00BF\u00A1\u00E8\u00B6\u0085\u00E7\u00BA\u00A7\u00E9\u0085\u008D\u00E7\u00BD\u00AE\u00E5\u00BD\u0093\u00E6\u0097\u00B6\u00E4\u00BC\u0098\u00E7\u00A7\u0080\u00E6\u0080\u00A7\u00E6\u0084\u009F\u00E6\u0088\u00BF\u00E4\u00BA\u00A7\u00E9\u0081\u008A\u00E6\u0088\u00B2\u00E5\u0087\u00BA\u00E5\u008F\u00A3\u00E6\u008F\u0090\u00E4\u00BA\u00A4\u00E5\u00B0\u00B1\u00E4\u00B8\u009A\u00E4\u00BF\u009D\u00E5\u0081\u00A5\u00E7\u00A8\u008B\u00E5\u00BA\u00A6\u00E5\u008F\u0082\u00E6\u0095\u00B0\u00E4\u00BA\u008B\u00E4\u00B8\u009A\u00E6\u0095\u00B4\u00E4\u00B8\u00AA\u00E5\u00B1\u00B1\u00E4\u00B8\u009C\u00E6\u0083\u0085\u00E6\u0084\u009F\u00E7\u0089\u00B9\u00E6\u00AE\u008A\u00E5\u0088\u0086\u00E9\u00A1\u009E\u00E6\u0090\u009C\u00E5\u00B0\u008B\u00E5\u00B1\u009E\u00E4\u00BA\u008E\u00E9\u0097\u00A8\u00E6\u0088\u00B7\u00E8\u00B4\u00A2\u00E5\u008A\u00A1\u00E5\u00A3\u00B0\u00E9\u009F\u00B3\u00E5\u008F\u008A\u00E5\u0085\u00B6\u00E8\u00B4\u00A2\u00E7\u00BB\u008F\u00E5\u009D\u009A\u00E6\u008C\u0081\u00E5\u00B9\u00B2\u00E9\u0083\u00A8\u00E6\u0088\u0090\u00E7\u00AB\u008B\u00E5\u0088\u00A9\u00E7\u009B\u008A\u00E8\u0080\u0083\u00E8\u0099\u0091\u00E6\u0088\u0090\u00E9\u0083\u00BD\u00E5\u008C\u0085\u00E8\u00A3\u0085\u00E7\u0094\u00A8\u00E6\u0088\u00B6\u00E6\u00AF\u0094\u00E8\u00B5\u009B\u00E6\u0096\u0087\u00E6\u0098\u008E\u00E6\u008B\u009B\u00E5\u0095\u0086\u00E5\u00AE\u008C\u00E6\u0095\u00B4\u00E7\u009C\u009F\u00E6\u0098\u00AF\u00E7\u009C\u00BC\u00E7\u009D\u009B\u00E4\u00BC\u0099\u00E4\u00BC\u00B4\u00E5\u00A8\u0081\u00E6\u009C\u009B\u00E9\u00A2\u0086\u00E5\u009F\u009F\u00E5\u008D\u00AB\u00E7\u0094\u009F\u00E4\u00BC\u0098\u00E6\u0083\u00A0\u00E8\u00AB\u0096\u00E5\u00A3\u0087\u00E5\u0085\u00AC\u00E5\u0085\u00B1\u00E8\u0089\u00AF\u00E5\u00A5\u00BD\u00E5\u0085\u0085\u00E5\u0088\u0086\u00E7\u00AC\u00A6\u00E5\u0090\u0088\u00E9\u0099\u0084\u00E4\u00BB\u00B6\u00E7\u0089\u00B9\u00E7\u0082\u00B9\u00E4\u00B8\u008D\u00E5\u008F\u00AF\u00E8\u008B\u00B1\u00E6\u0096\u0087\u00E8\u00B5\u0084\u00E4\u00BA\u00A7\u00E6\u00A0\u00B9\u00E6\u009C\u00AC\u00E6\u0098\u008E\u00E6\u0098\u00BE\u00E5\u00AF\u0086\u00E7\u00A2\u00BC\u00E5\u0085\u00AC\u00E4\u00BC\u0097\u00E6\u00B0\u0091\u00E6\u0097\u008F\u00E6\u009B\u00B4\u00E5\u008A\u00A0\u00E4\u00BA\u00AB\u00E5\u008F\u0097\u00E5\u0090\u008C\u00E5\u00AD\u00A6\u00E5\u0090\u00AF\u00E5\u008A\u00A8\u00E9\u0080\u0082\u00E5\u0090\u0088\u00E5\u008E\u009F\u00E6\u009D\u00A5\u00E9\u0097\u00AE\u00E7\u00AD\u0094\u00E6\u009C\u00AC\u00E6\u0096\u0087\u00E7\u00BE\u008E\u00E9\u00A3\u009F\u00E7\u00BB\u00BF\u00E8\u0089\u00B2\u00E7\u00A8\u00B3\u00E5\u00AE\u009A\u00E7\u00BB\u0088\u00E4\u00BA\u008E\u00E7\u0094\u009F\u00E7\u0089\u00A9\u00E4\u00BE\u009B\u00E6\u00B1\u0082\u00E6\u0090\u009C\u00E7\u008B\u0090\u00E5\u008A\u009B\u00E9\u0087\u008F\u00E4\u00B8\u00A5\u00E9\u0087\u008D\u00E6\u00B0\u00B8\u00E8\u00BF\u009C\u00E5\u0086\u0099\u00E7\u009C\u009F\u00E6\u009C\u0089\u00E9\u0099\u0090\u00E7\u00AB\u009E\u00E4\u00BA\u0089\u00E5\u00AF\u00B9\u00E8\u00B1\u00A1\u00E8\u00B4\u00B9\u00E7\u0094\u00A8\u00E4\u00B8\u008D\u00E5\u00A5\u00BD\u00E7\u00BB\u009D\u00E5\u00AF\u00B9\u00E5\u008D\u0081\u00E5\u0088\u0086\u00E4\u00BF\u0083\u00E8\u00BF\u009B\u00E7\u0082\u00B9\u00E8\u00AF\u0084\u00E5\u00BD\u00B1\u00E9\u009F\u00B3\u00E4\u00BC\u0098\u00E5\u008A\u00BF\u00E4\u00B8\u008D\u00E5\u00B0\u0091\u00E6\u00AC\u00A3\u00E8\u00B5\u008F\u00E5\u00B9\u00B6\u00E4\u00B8\u0094\u00E6\u009C\u0089\u00E7\u0082\u00B9\u00E6\u0096\u00B9\u00E5\u0090\u0091\u00E5\u0085\u00A8\u00E6\u0096\u00B0\u00E4\u00BF\u00A1\u00E7\u0094\u00A8\u00E8\u00AE\u00BE\u00E6\u0096\u00BD\u00E5\u00BD\u00A2\u00E8\u00B1\u00A1\u00E8\u00B5\u0084\u00E6\u00A0\u00BC\u00E7\u00AA\u0081\u00E7\u00A0\u00B4\u00E9\u009A\u008F\u00E7\u009D\u0080\u00E9\u0087\u008D\u00E5\u00A4\u00A7\u00E4\u00BA\u008E\u00E6\u0098\u00AF\u00E6\u00AF\u0095\u00E4\u00B8\u009A\u00E6\u0099\u00BA\u00E8\u0083\u00BD\u00E5\u008C\u0096\u00E5\u00B7\u00A5\u00E5\u00AE\u008C\u00E7\u00BE\u008E\u00E5\u0095\u0086\u00E5\u009F\u008E\u00E7\u00BB\u009F\u00E4\u00B8\u0080\u00E5\u0087\u00BA\u00E7\u0089\u0088\u00E6\u0089\u0093\u00E9\u0080\u00A0\u00E7\u0094\u00A2\u00E5\u0093\u0081\u00E6\u00A6\u0082\u00E5\u0086\u00B5\u00E7\u0094\u00A8\u00E4\u00BA\u008E\u00E4\u00BF\u009D\u00E7\u0095\u0099\u00E5\u009B\u00A0\u00E7\u00B4\u00A0\u00E4\u00B8\u00AD\u00E5\u009C\u008B\u00E5\u00AD\u0098\u00E5\u0082\u00A8\u00E8\u00B4\u00B4\u00E5\u009B\u00BE\u00E6\u009C\u0080\u00E6\u0084\u009B\u00E9\u0095\u00BF\u00E6\u009C\u009F\u00E5\u008F\u00A3\u00E4\u00BB\u00B7\u00E7\u0090\u0086\u00E8\u00B4\u00A2\u00E5\u009F\u00BA\u00E5\u009C\u00B0\u00E5\u00AE\u0089\u00E6\u008E\u0092\u00E6\u00AD\u00A6\u00E6\u00B1\u0089\u00E9\u0087\u008C\u00E9\u009D\u00A2\u00E5\u0088\u009B\u00E5\u00BB\u00BA\u00E5\u00A4\u00A9\u00E7\u00A9\u00BA\u00E9\u00A6\u0096\u00E5\u0085\u0088\u00E5\u00AE\u008C\u00E5\u0096\u0084\u00E9\u00A9\u00B1\u00E5\u008A\u00A8\u00E4\u00B8\u008B\u00E9\u009D\u00A2\u00E4\u00B8\u008D\u00E5\u0086\u008D\u00E8\u00AF\u009A\u00E4\u00BF\u00A1\u00E6\u0084\u008F\u00E4\u00B9\u0089\u00E9\u0098\u00B3\u00E5\u0085\u0089\u00E8\u008B\u00B1\u00E5\u009B\u00BD\u00E6\u00BC\u0082\u00E4\u00BA\u00AE\u00E5\u0086\u009B\u00E4\u00BA\u008B\u00E7\u008E\u00A9\u00E5\u00AE\u00B6\u00E7\u00BE\u00A4\u00E4\u00BC\u0097\u00E5\u0086\u009C\u00E6\u00B0\u0091\u00E5\u008D\u00B3\u00E5\u008F\u00AF\u00E5\u0090\u008D\u00E7\u00A8\u00B1\u00E5\u00AE\u00B6\u00E5\u0085\u00B7\u00E5\u008A\u00A8\u00E7\u0094\u00BB\u00E6\u0083\u00B3\u00E5\u0088\u00B0\u00E6\u00B3\u00A8\u00E6\u0098\u008E\u00E5\u00B0\u008F\u00E5\u00AD\u00A6\u00E6\u0080\u00A7\u00E8\u0083\u00BD\u00E8\u0080\u0083\u00E7\u00A0\u0094\u00E7\u00A1\u00AC\u00E4\u00BB\u00B6\u00E8\u00A7\u0082\u00E7\u009C\u008B\u00E6\u00B8\u0085\u00E6\u00A5\u009A\u00E6\u0090\u009E\u00E7\u00AC\u0091\u00E9\u00A6\u0096\u00E9\u00A0\u0081\u00E9\u00BB\u0084\u00E9\u0087\u0091\u00E9\u0080\u0082\u00E7\u0094\u00A8\u00E6\u00B1\u009F\u00E8\u008B\u008F\u00E7\u009C\u009F\u00E5\u00AE\u009E\u00E4\u00B8\u00BB\u00E7\u00AE\u00A1\u00E9\u0098\u00B6\u00E6\u00AE\u00B5\u00E8\u00A8\u00BB\u00E5\u0086\u008A\u00E7\u00BF\u00BB\u00E8\u00AF\u0091\u00E6\u009D\u0083\u00E5\u0088\u00A9\u00E5\u0081\u009A\u00E5\u00A5\u00BD\u00E4\u00BC\u00BC\u00E4\u00B9\u008E\u00E9\u0080\u009A\u00E8\u00AE\u00AF\u00E6\u0096\u00BD\u00E5\u00B7\u00A5\u00E7\u008B\u0080\u00E6\u0085\u008B\u00E4\u00B9\u009F\u00E8\u00AE\u00B8\u00E7\u008E\u00AF\u00E4\u00BF\u009D\u00E5\u009F\u00B9\u00E5\u0085\u00BB\u00E6\u00A6\u0082\u00E5\u00BF\u00B5\u00E5\u00A4\u00A7\u00E5\u009E\u008B\u00E6\u009C\u00BA\u00E7\u00A5\u00A8\u00E7\u0090\u0086\u00E8\u00A7\u00A3\u00E5\u008C\u00BF\u00E5\u0090\u008Dcuandoenviarmadridbuscariniciotiempoporquecuentaestadopuedenjuegoscontraest\u00C3\u00A1nnombretienenperfilmaneraamigosciudadcentroaunquepuedesdentroprimerprecioseg\u00C3\u00BAnbuenosvolverpuntossemanahab\u00C3\u00ADaagostonuevosunidoscarlosequiponi\u00C3\u00B1osmuchosalgunacorreoimagenpartirarribamar\u00C3\u00ADahombreempleoverdadcambiomuchasfueronpasadol\u00C3\u00ADneaparecenuevascursosestabaquierolibroscuantoaccesomiguelvarioscuatrotienesgruposser\u00C3\u00A1neuropamediosfrenteacercadem\u00C3\u00A1sofertacochesmodeloitalialetrasalg\u00C3\u00BAncompracualesexistecuerposiendoprensallegarviajesdineromurciapodr\u00C3\u00A1puestodiariopuebloquieremanuelpropiocrisisciertoseguromuertefuentecerrargrandeefectopartesmedidapropiaofrecetierrae-mailvariasformasfuturoobjetoseguirriesgonormasmismos\u00C3\u00BAnicocaminositiosraz\u00C3\u00B3ndebidopruebatoledoten\u00C3\u00ADajes\u00C3\u00BAsesperococinaorigentiendacientoc\u00C3\u00A1dizhablarser\u00C3\u00ADalatinafuerzaestiloguerraentrar\u00C3\u00A9xitol\u00C3\u00B3pezagendav\u00C3\u00ADdeoevitarpaginametrosjavierpadresf\u00C3\u00A1cilcabeza\u00C3\u00A1reassalidaenv\u00C3\u00ADojap\u00C3\u00B3nabusosbienestextosllevarpuedanfuertecom\u00C3\u00BAnclaseshumanotenidobilbaounidadest\u00C3\u00A1seditarcreado\u00D0\u00B4\u00D0\u00BB\u00D1\u008F\u00D1\u0087\u00D1\u0082\u00D0\u00BE\u00D0\u00BA\u00D0\u00B0\u00D0\u00BA\u00D0\u00B8\u00D0\u00BB\u00D0\u00B8\u00D1\u008D\u00D1\u0082\u00D0\u00BE\u00D0\u00B2\u00D1\u0081\u00D0\u00B5\u00D0\u00B5\u00D0\u00B3\u00D0\u00BE\u00D0\u00BF\u00D1\u0080\u00D0\u00B8\u00D1\u0082\u00D0\u00B0\u00D0\u00BA\u00D0\u00B5\u00D1\u0089\u00D0\u00B5\u00D1\u0083\u00D0\u00B6\u00D0\u00B5\u00D0\u009A\u00D0\u00B0\u00D0\u00BA\u00D0\u00B1\u00D0\u00B5\u00D0\u00B7\u00D0\u00B1\u00D1\u008B\u00D0\u00BB\u00D0\u00BE\u00D0\u00BD\u00D0\u00B8\u00D0\u0092\u00D1\u0081\u00D0\u00B5\u00D0\u00BF\u00D0\u00BE\u00D0\u00B4\u00D0\u00AD\u00D1\u0082\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D0\u00BC\u00D1\u0087\u00D0\u00B5\u00D0\u00BC\u00D0\u00BD\u00D0\u00B5\u00D1\u0082\u00D0\u00BB\u00D0\u00B5\u00D1\u0082\u00D1\u0080\u00D0\u00B0\u00D0\u00B7\u00D0\u00BE\u00D0\u00BD\u00D0\u00B0\u00D0\u00B3\u00D0\u00B4\u00D0\u00B5\u00D0\u00BC\u00D0\u00BD\u00D0\u00B5\u00D0\u0094\u00D0\u00BB\u00D1\u008F\u00D0\u009F\u00D1\u0080\u00D0\u00B8\u00D0\u00BD\u00D0\u00B0\u00D1\u0081\u00D0\u00BD\u00D0\u00B8\u00D1\u0085\u00D1\u0082\u00D0\u00B5\u00D0\u00BC\u00D0\u00BA\u00D1\u0082\u00D0\u00BE\u00D0\u00B3\u00D0\u00BE\u00D0\u00B4\u00D0\u00B2\u00D0\u00BE\u00D1\u0082\u00D1\u0082\u00D0\u00B0\u00D0\u00BC\u00D0\u00A1\u00D0\u00A8\u00D0\u0090\u00D0\u00BC\u00D0\u00B0\u00D1\u008F\u00D0\u00A7\u00D1\u0082\u00D0\u00BE\u00D0\u00B2\u00D0\u00B0\u00D1\u0081\u00D0\u00B2\u00D0\u00B0\u00D0\u00BC\u00D0\u00B5\u00D0\u00BC\u00D1\u0083\u00D0\u00A2\u00D0\u00B0\u00D0\u00BA\u00D0\u00B4\u00D0\u00B2\u00D0\u00B0\u00D0\u00BD\u00D0\u00B0\u00D0\u00BC\u00D1\u008D\u00D1\u0082\u00D0\u00B8\u00D1\u008D\u00D1\u0082\u00D1\u0083\u00D0\u0092\u00D0\u00B0\u00D0\u00BC\u00D1\u0082\u00D0\u00B5\u00D1\u0085\u00D0\u00BF\u00D1\u0080\u00D0\u00BE\u00D1\u0082\u00D1\u0083\u00D1\u0082\u00D0\u00BD\u00D0\u00B0\u00D0\u00B4\u00D0\u00B4\u00D0\u00BD\u00D1\u008F\u00D0\u0092\u00D0\u00BE\u00D1\u0082\u00D1\u0082\u00D1\u0080\u00D0\u00B8\u00D0\u00BD\u00D0\u00B5\u00D0\u00B9\u00D0\u0092\u00D0\u00B0\u00D1\u0081\u00D0\u00BD\u00D0\u00B8\u00D0\u00BC\u00D1\u0081\u00D0\u00B0\u00D0\u00BC\u00D1\u0082\u00D0\u00BE\u00D1\u0082\u00D1\u0080\u00D1\u0083\u00D0\u00B1\u00D0\u009E\u00D0\u00BD\u00D0\u00B8\u00D0\u00BC\u00D0\u00B8\u00D1\u0080\u00D0\u00BD\u00D0\u00B5\u00D0\u00B5\u00D0\u009E\u00D0\u009E\u00D0\u009E\u00D0\u00BB\u00D0\u00B8\u00D1\u0086\u00D1\u008D\u00D1\u0082\u00D0\u00B0\u00D0\u009E\u00D0\u00BD\u00D0\u00B0\u00D0\u00BD\u00D0\u00B5\u00D0\u00BC\u00D0\u00B4\u00D0\u00BE\u00D0\u00BC\u00D0\u00BC\u00D0\u00BE\u00D0\u00B9\u00D0\u00B4\u00D0\u00B2\u00D0\u00B5\u00D0\u00BE\u00D0\u00BD\u00D0\u00BE\u00D1\u0081\u00D1\u0083\u00D0\u00B4\u00E0\u00A4\u0095\u00E0\u00A5\u0087\u00E0\u00A4\u00B9\u00E0\u00A5\u0088\u00E0\u00A4\u0095\u00E0\u00A5\u0080\u00E0\u00A4\u00B8\u00E0\u00A5\u0087\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u0095\u00E0\u00A5\u008B\u00E0\u00A4\u0094\u00E0\u00A4\u00B0\u00E0\u00A4\u00AA\u00E0\u00A4\u00B0\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u008F\u00E0\u00A4\u0095\u00E0\u00A4\u0095\u00E0\u00A4\u00BF\u00E0\u00A4\u00AD\u00E0\u00A5\u0080\u00E0\u00A4\u0087\u00E0\u00A4\u00B8\u00E0\u00A4\u0095\u00E0\u00A4\u00B0\u00E0\u00A4\u00A4\u00E0\u00A5\u008B\u00E0\u00A4\u00B9\u00E0\u00A5\u008B\u00E0\u00A4\u0086\u00E0\u00A4\u00AA\u00E0\u00A4\u00B9\u00E0\u00A5\u0080\u00E0\u00A4\u00AF\u00E0\u00A4\u00B9\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00A4\u00E0\u00A4\u0095\u00E0\u00A4\u00A5\u00E0\u00A4\u00BEjagran\u00E0\u00A4\u0086\u00E0\u00A4\u009C\u00E0\u00A4\u009C\u00E0\u00A5\u008B\u00E0\u00A4\u0085\u00E0\u00A4\u00AC\u00E0\u00A4\u00A6\u00E0\u00A5\u008B\u00E0\u00A4\u0097\u00E0\u00A4\u0088\u00E0\u00A4\u009C\u00E0\u00A4\u00BE\u00E0\u00A4\u0097\u00E0\u00A4\u008F\u00E0\u00A4\u00B9\u00E0\u00A4\u00AE\u00E0\u00A4\u0087\u00E0\u00A4\u00A8\u00E0\u00A4\u00B5\u00E0\u00A4\u00B9\u00E0\u00A4\u00AF\u00E0\u00A5\u0087\u00E0\u00A4\u00A5\u00E0\u00A5\u0087\u00E0\u00A4\u00A5\u00E0\u00A5\u0080\u00E0\u00A4\u0098\u00E0\u00A4\u00B0\u00E0\u00A4\u009C\u00E0\u00A4\u00AC\u00E0\u00A4\u00A6\u00E0\u00A5\u0080\u00E0\u00A4\u0095\u00E0\u00A4\u0088\u00E0\u00A4\u009C\u00E0\u00A5\u0080\u00E0\u00A4\u00B5\u00E0\u00A5\u0087\u00E0\u00A4\u00A8\u00E0\u00A4\u0088\u00E0\u00A4\u00A8\u00E0\u00A4\u008F\u00E0\u00A4\u00B9\u00E0\u00A4\u00B0\u00E0\u00A4\u0089\u00E0\u00A4\u00B8\u00E0\u00A4\u00AE\u00E0\u00A5\u0087\u00E0\u00A4\u0095\u00E0\u00A4\u00AE\u00E0\u00A4\u00B5\u00E0\u00A5\u008B\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u00B8\u00E0\u00A4\u00AC\u00E0\u00A4\u00AE\u00E0\u00A4\u0088\u00E0\u00A4\u00A6\u00E0\u00A5\u0087\u00E0\u00A4\u0093\u00E0\u00A4\u00B0\u00E0\u00A4\u0086\u00E0\u00A4\u00AE\u00E0\u00A4\u00AC\u00E0\u00A4\u00B8\u00E0\u00A4\u00AD\u00E0\u00A4\u00B0\u00E0\u00A4\u00AC\u00E0\u00A4\u00A8\u00E0\u00A4\u009A\u00E0\u00A4\u00B2\u00E0\u00A4\u00AE\u00E0\u00A4\u00A8\u00E0\u00A4\u0086\u00E0\u00A4\u0097\u00E0\u00A4\u00B8\u00E0\u00A5\u0080\u00E0\u00A4\u00B2\u00E0\u00A5\u0080\u00D8\u00B9\u00D9\u0084\u00D9\u0089\u00D8\u00A5\u00D9\u0084\u00D9\u0089\u00D9\u0087\u00D8\u00B0\u00D8\u00A7\u00D8\u00A2\u00D8\u00AE\u00D8\u00B1\u00D8\u00B9\u00D8\u00AF\u00D8\u00AF\u00D8\u00A7\u00D9\u0084\u00D9\u0089\u00D9\u0087\u00D8\u00B0\u00D9\u0087\u00D8\u00B5\u00D9\u0088\u00D8\u00B1\u00D8\u00BA\u00D9\u008A\u00D8\u00B1\u00D9\u0083\u00D8\u00A7\u00D9\u0086\u00D9\u0088\u00D9\u0084\u00D8\u00A7\u00D8\u00A8\u00D9\u008A\u00D9\u0086\u00D8\u00B9\u00D8\u00B1\u00D8\u00B6\u00D8\u00B0\u00D9\u0084\u00D9\u0083\u00D9\u0087\u00D9\u0086\u00D8\u00A7\u00D9\u008A\u00D9\u0088\u00D9\u0085\u00D9\u0082\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D9\u0084\u00D9\u008A\u00D8\u00A7\u00D9\u0086\u00D8\u00A7\u00D9\u0084\u00D9\u0083\u00D9\u0086\u00D8\u00AD\u00D8\u00AA\u00D9\u0089\u00D9\u0082\u00D8\u00A8\u00D9\u0084\u00D9\u0088\u00D8\u00AD\u00D8\u00A9\u00D8\u00A7\u00D8\u00AE\u00D8\u00B1\u00D9\u0081\u00D9\u0082\u00D8\u00B7\u00D8\u00B9\u00D8\u00A8\u00D8\u00AF\u00D8\u00B1\u00D9\u0083\u00D9\u0086\u00D8\u00A5\u00D8\u00B0\u00D8\u00A7\u00D9\u0083\u00D9\u0085\u00D8\u00A7\u00D8\u00A7\u00D8\u00AD\u00D8\u00AF\u00D8\u00A5\u00D9\u0084\u00D8\u00A7\u00D9\u0081\u00D9\u008A\u00D9\u0087\u00D8\u00A8\u00D8\u00B9\u00D8\u00B6\u00D9\u0083\u00D9\u008A\u00D9\u0081\u00D8\u00A8\u00D8\u00AD\u00D8\u00AB\u00D9\u0088\u00D9\u0085\u00D9\u0086\u00D9\u0088\u00D9\u0087\u00D9\u0088\u00D8\u00A3\u00D9\u0086\u00D8\u00A7\u00D8\u00AC\u00D8\u00AF\u00D8\u00A7\u00D9\u0084\u00D9\u0087\u00D8\u00A7\u00D8\u00B3\u00D9\u0084\u00D9\u0085\u00D8\u00B9\u00D9\u0086\u00D8\u00AF\u00D9\u0084\u00D9\u008A\u00D8\u00B3\u00D8\u00B9\u00D8\u00A8\u00D8\u00B1\u00D8\u00B5\u00D9\u0084\u00D9\u0089\u00D9\u0085\u00D9\u0086\u00D8\u00B0\u00D8\u00A8\u00D9\u0087\u00D8\u00A7\u00D8\u00A3\u00D9\u0086\u00D9\u0087\u00D9\u0085\u00D8\u00AB\u00D9\u0084\u00D9\u0083\u00D9\u0086\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D8\u00AD\u00D9\u008A\u00D8\u00AB\u00D9\u0085\u00D8\u00B5\u00D8\u00B1\u00D8\u00B4\u00D8\u00B1\u00D8\u00AD\u00D8\u00AD\u00D9\u0088\u00D9\u0084\u00D9\u0088\u00D9\u0081\u00D9\u008A\u00D8\u00A7\u00D8\u00B0\u00D8\u00A7\u00D9\u0084\u00D9\u0083\u00D9\u0084\u00D9\u0085\u00D8\u00B1\u00D8\u00A9\u00D8\u00A7\u00D9\u0086\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D9\u0081\u00D8\u00A3\u00D8\u00A8\u00D9\u0088\u00D8\u00AE\u00D8\u00A7\u00D8\u00B5\u00D8\u00A3\u00D9\u0086\u00D8\u00AA\u00D8\u00A7\u00D9\u0086\u00D9\u0087\u00D8\u00A7\u00D9\u0084\u00D9\u008A\u00D8\u00B9\u00D8\u00B6\u00D9\u0088\u00D9\u0088\u00D9\u0082\u00D8\u00AF\u00D8\u00A7\u00D8\u00A8\u00D9\u0086\u00D8\u00AE\u00D9\u008A\u00D8\u00B1\u00D8\u00A8\u00D9\u0086\u00D8\u00AA\u00D9\u0084\u00D9\u0083\u00D9\u0085\u00D8\u00B4\u00D8\u00A7\u00D8\u00A1\u00D9\u0088\u00D9\u0087\u00D9\u008A\u00D8\u00A7\u00D8\u00A8\u00D9\u0088\u00D9\u0082\u00D8\u00B5\u00D8\u00B5\u00D9\u0088\u00D9\u0085\u00D8\u00A7\u00D8\u00B1\u00D9\u0082\u00D9\u0085\u00D8\u00A3\u00D8\u00AD\u00D8\u00AF\u00D9\u0086\u00D8\u00AD\u00D9\u0086\u00D8\u00B9\u00D8\u00AF\u00D9\u0085\u00D8\u00B1\u00D8\u00A3\u00D9\u008A\u00D8\u00A7\u00D8\u00AD\u00D8\u00A9\u00D9\u0083\u00D8\u00AA\u00D8\u00A8\u00D8\u00AF\u00D9\u0088\u00D9\u0086\u00D9\u008A\u00D8\u00AC\u00D8\u00A8\u00D9\u0085\u00D9\u0086\u00D9\u0087\u00D8\u00AA\u00D8\u00AD\u00D8\u00AA\u00D8\u00AC\u00D9\u0087\u00D8\u00A9\u00D8\u00B3\u00D9\u0086\u00D8\u00A9\u00D9\u008A\u00D8\u00AA\u00D9\u0085\u00D9\u0083\u00D8\u00B1\u00D8\u00A9\u00D8\u00BA\u00D8\u00B2\u00D8\u00A9\u00D9\u0086\u00D9\u0081\u00D8\u00B3\u00D8\u00A8\u00D9\u008A\u00D8\u00AA\u00D9\u0084\u00D9\u0084\u00D9\u0087\u00D9\u0084\u00D9\u0086\u00D8\u00A7\u00D8\u00AA\u00D9\u0084\u00D9\u0083\u00D9\u0082\u00D9\u0084\u00D8\u00A8\u00D9\u0084\u00D9\u0085\u00D8\u00A7\u00D8\u00B9\u00D9\u0086\u00D9\u0087\u00D8\u00A3\u00D9\u0088\u00D9\u0084\u00D8\u00B4\u00D9\u008A\u00D8\u00A1\u00D9\u0086\u00D9\u0088\u00D8\u00B1\u00D8\u00A3\u00D9\u0085\u00D8\u00A7\u00D9\u0081\u00D9\u008A\u00D9\u0083\u00D8\u00A8\u00D9\u0083\u00D9\u0084\u00D8\u00B0\u00D8\u00A7\u00D8\u00AA\u00D8\u00B1\u00D8\u00AA\u00D8\u00A8\u00D8\u00A8\u00D8\u00A3\u00D9\u0086\u00D9\u0087\u00D9\u0085\u00D8\u00B3\u00D8\u00A7\u00D9\u0086\u00D9\u0083\u00D8\u00A8\u00D9\u008A\u00D8\u00B9\u00D9\u0081\u00D9\u0082\u00D8\u00AF\u00D8\u00AD\u00D8\u00B3\u00D9\u0086\u00D9\u0084\u00D9\u0087\u00D9\u0085\u00D8\u00B4\u00D8\u00B9\u00D8\u00B1\u00D8\u00A3\u00D9\u0087\u00D9\u0084\u00D8\u00B4\u00D9\u0087\u00D8\u00B1\u00D9\u0082\u00D8\u00B7\u00D8\u00B1\u00D8\u00B7\u00D9\u0084\u00D8\u00A8profileservicedefaulthimselfdetailscontentsupportstartedmessagesuccessfashion<title>countryaccountcreatedstoriesresultsrunningprocesswritingobjectsvisiblewelcomearticleunknownnetworkcompanydynamicbrowserprivacyproblemServicerespectdisplayrequestreservewebsitehistoryfriendsoptionsworkingversionmillionchannelwindow.addressvisitedweathercorrectproductedirectforwardyou canremovedsubjectcontrolarchivecurrentreadinglibrarylimitedmanagerfurthersummarymachineminutesprivatecontextprogramsocietynumberswrittenenabledtriggersourcesloadingelementpartnerfinallyperfectmeaningsystemskeepingculture&quot;,journalprojectsurfaces&quot;expiresreviewsbalanceEnglishContentthroughPlease opinioncontactaverageprimaryvillageSpanishgallerydeclinemeetingmissionpopularqualitymeasuregeneralspeciessessionsectionwriterscounterinitialreportsfiguresmembersholdingdisputeearlierexpressdigitalpictureAnothermarriedtrafficleadingchangedcentralvictoryimages/reasonsstudiesfeaturelistingmust beschoolsVersionusuallyepisodeplayinggrowingobviousoverlaypresentactions</ul>\r\nwrapperalreadycertainrealitystorageanotherdesktopofferedpatternunusualDigitalcapitalWebsitefailureconnectreducedAndroiddecadesregular &amp; animalsreleaseAutomatgettingmethodsnothingPopularcaptionletterscapturesciencelicensechangesEngland=1&amp;History = new CentralupdatedSpecialNetworkrequirecommentwarningCollegetoolbarremainsbecauseelectedDeutschfinanceworkersquicklybetweenexactlysettingdiseaseSocietyweaponsexhibit&lt;!--Controlclassescoveredoutlineattacksdevices(windowpurposetitle=\"Mobile killingshowingItaliandroppedheavilyeffects-1']);\nconfirmCurrentadvancesharingopeningdrawingbillionorderedGermanyrelated</form>includewhetherdefinedSciencecatalogArticlebuttonslargestuniformjourneysidebarChicagoholidayGeneralpassage,&quot;animatefeelingarrivedpassingnaturalroughly.\n\nThe but notdensityBritainChineselack oftributeIreland\" data-factorsreceivethat isLibraryhusbandin factaffairsCharlesradicalbroughtfindinglanding:lang=\"return leadersplannedpremiumpackageAmericaEdition]&quot;Messageneed tovalue=\"complexlookingstationbelievesmaller-mobilerecordswant tokind ofFirefoxyou aresimilarstudiedmaximumheadingrapidlyclimatekingdomemergedamountsfoundedpioneerformuladynastyhow to SupportrevenueeconomyResultsbrothersoldierlargelycalling.&quot;AccountEdward segmentRobert effortsPacificlearnedup withheight:we haveAngelesnations_searchappliedacquiremassivegranted: falsetreatedbiggestbenefitdrivingStudiesminimumperhapsmorningsellingis usedreversevariant role=\"missingachievepromotestudentsomeoneextremerestorebottom:evolvedall thesitemapenglishway to AugustsymbolsCompanymattersmusicalagainstserving})();\r\npaymenttroubleconceptcompareparentsplayersregionsmonitor ''The winningexploreadaptedGalleryproduceabilityenhancecareers). The collectSearch ancientexistedfooter handlerprintedconsoleEasternexportswindowsChannelillegalneutralsuggest_headersigning.html\">settledwesterncausing-webkitclaimedJusticechaptervictimsThomas mozillapromisepartieseditionoutside:false,hundredOlympic_buttonauthorsreachedchronicdemandssecondsprotectadoptedprepareneithergreatlygreateroverallimprovecommandspecialsearch.worshipfundingthoughthighestinsteadutilityquarterCulturetestingclearlyexposedBrowserliberal} catchProjectexamplehide();FloridaanswersallowedEmperordefenseseriousfreedomSeveral-buttonFurtherout of != nulltrainedDenmarkvoid(0)/all.jspreventRequestStephen\n\nWhen observe</h2>\r\nModern provide\" alt=\"borders.\n\nFor \n\nMany artistspoweredperformfictiontype ofmedicalticketsopposedCouncilwitnessjusticeGeorge Belgium...</a>twitternotablywaitingwarfare Other rankingphrasesmentionsurvivescholar</p>\r\n Countryignoredloss ofjust asGeorgiastrange<head><stopped1']);\r\nislandsnotableborder:list ofcarried100,000</h3>\n severalbecomesselect wedding00.htmlmonarchoff theteacherhighly biologylife ofor evenrise of&raquo;plusonehunting(thoughDouglasjoiningcirclesFor theAncientVietnamvehiclesuch ascrystalvalue =Windowsenjoyeda smallassumed<a id=\"foreign All rihow theDisplayretiredhoweverhidden;battlesseekingcabinetwas notlook atconductget theJanuaryhappensturninga:hoverOnline French lackingtypicalextractenemieseven ifgeneratdecidedare not/searchbeliefs-image:locatedstatic.login\">convertviolententeredfirst\">circuitFinlandchemistshe was10px;\">as suchdivided</span>will beline ofa greatmystery/index.fallingdue to railwaycollegemonsterdescentit withnuclearJewish protestBritishflowerspredictreformsbutton who waslectureinstantsuicidegenericperiodsmarketsSocial fishingcombinegraphicwinners<br /><by the NaturalPrivacycookiesoutcomeresolveSwedishbrieflyPersianso muchCenturydepictscolumnshousingscriptsnext tobearingmappingrevisedjQuery(-width:title\">tooltipSectiondesignsTurkishyounger.match(})();\n\nburningoperatedegreessource=Richardcloselyplasticentries</tr>\r\ncolor:#ul id=\"possessrollingphysicsfailingexecutecontestlink toDefault<br />\n: true,chartertourismclassicproceedexplain</h1>\r\nonline.?xml vehelpingdiamonduse theairlineend -->).attr(readershosting#ffffffrealizeVincentsignals src=\"/ProductdespitediversetellingPublic held inJoseph theatreaffects<style>a largedoesn'tlater, ElementfaviconcreatorHungaryAirportsee theso thatMichaelSystemsPrograms, and width=e&quot;tradingleft\">\npersonsGolden Affairsgrammarformingdestroyidea ofcase ofoldest this is.src = cartoonregistrCommonsMuslimsWhat isin manymarkingrevealsIndeed,equally/show_aoutdoorescape(Austriageneticsystem,In the sittingHe alsoIslandsAcademy\n\t\t<!--Daniel bindingblock\">imposedutilizeAbraham(except{width:putting).html(|| [];\nDATA[ *kitchenmountedactual dialectmainly _blank'installexpertsif(typeIt also&copy; \">Termsborn inOptionseasterntalkingconcerngained ongoingjustifycriticsfactoryits ownassaultinvitedlastinghis ownhref=\"/\" rel=\"developconcertdiagramdollarsclusterphp?id=alcohol);})();using a><span>vesselsrevivalAddressamateurandroidallegedillnesswalkingcentersqualifymatchesunifiedextinctDefensedied in\n\t<!-- customslinkingLittle Book ofeveningmin.js?are thekontakttoday's.html\" target=wearingAll Rig;\n})();raising Also, crucialabout\">declare-->\n<scfirefoxas muchappliesindex, s, but type = \n\r\n<!--towardsRecordsPrivateForeignPremierchoicesVirtualreturnsCommentPoweredinline;povertychamberLiving volumesAnthonylogin\" RelatedEconomyreachescuttinggravitylife inChapter-shadowNotable</td>\r\n returnstadiumwidgetsvaryingtravelsheld bywho arework infacultyangularwho hadairporttown of\n\nSome 'click'chargeskeywordit willcity of(this);Andrew unique checkedor more300px; return;rsion=\"pluginswithin herselfStationFederalventurepublishsent totensionactresscome tofingersDuke ofpeople,exploitwhat isharmonya major\":\"httpin his menu\">\nmonthlyofficercouncilgainingeven inSummarydate ofloyaltyfitnessand wasemperorsupremeSecond hearingRussianlongestAlbertalateralset of small\">.appenddo withfederalbank ofbeneathDespiteCapitalgrounds), and percentit fromclosingcontainInsteadfifteenas well.yahoo.respondfighterobscurereflectorganic= Math.editingonline paddinga wholeonerroryear ofend of barrierwhen itheader home ofresumedrenamedstrong>heatingretainscloudfrway of March 1knowingin partBetweenlessonsclosestvirtuallinks\">crossedEND -->famous awardedLicenseHealth fairly wealthyminimalAfricancompetelabel\">singingfarmersBrasil)discussreplaceGregoryfont copursuedappearsmake uproundedboth ofblockedsaw theofficescoloursif(docuwhen heenforcepush(fuAugust UTF-8\">Fantasyin mostinjuredUsuallyfarmingclosureobject defenceuse of Medical<body>\nevidentbe usedkeyCodesixteenIslamic#000000entire widely active (typeofone cancolor =speakerextendsPhysicsterrain<tbody>funeralviewingmiddle cricketprophetshifteddoctorsRussell targetcompactalgebrasocial-bulk ofman and</td>\n he left).val()false);logicalbankinghome tonaming Arizonacredits);\n});\nfounderin turnCollinsbefore But thechargedTitle\">CaptainspelledgoddessTag -->Adding:but wasRecent patientback in=false&Lincolnwe knowCounterJudaismscript altered']);\n has theunclearEvent',both innot all\n\n<!-- placinghard to centersort ofclientsstreetsBernardassertstend tofantasydown inharbourFreedomjewelry/about..searchlegendsis mademodern only ononly toimage\" linear painterand notrarely acronymdelivershorter00&amp;as manywidth=\"/* <![Ctitle =of the lowest picked escapeduses ofpeoples PublicMatthewtacticsdamagedway forlaws ofeasy to windowstrong simple}catch(seventhinfoboxwent topaintedcitizenI don'tretreat. Some ww.\");\nbombingmailto:made in. Many carries||{};wiwork ofsynonymdefeatsfavoredopticalpageTraunless sendingleft\"><comScorAll thejQuery.touristClassicfalse\" Wilhelmsuburbsgenuinebishops.split(global followsbody ofnominalContactsecularleft tochiefly-hidden-banner</li>\n\n. When in bothdismissExplorealways via thespa\u00C3\u00B1olwelfareruling arrangecaptainhis sonrule ofhe tookitself,=0&amp;(calledsamplesto makecom/pagMartin Kennedyacceptsfull ofhandledBesides//--></able totargetsessencehim to its by common.mineralto takeways tos.org/ladvisedpenaltysimple:if theyLettersa shortHerbertstrikes groups.lengthflightsoverlapslowly lesser social </p>\n\t\tit intoranked rate oful>\r\n attemptpair ofmake itKontaktAntoniohaving ratings activestreamstrapped\").css(hostilelead tolittle groups,Picture-->\r\n\r\n rows=\" objectinverse<footerCustomV><\\/scrsolvingChamberslaverywoundedwhereas!= 'undfor allpartly -right:Arabianbacked centuryunit ofmobile-Europe,is homerisk ofdesiredClintoncost ofage of become none ofp&quot;Middle ead')[0Criticsstudios>&copy;group\">assemblmaking pressedwidget.ps:\" ? rebuiltby someFormer editorsdelayedCanonichad thepushingclass=\"but arepartialBabylonbottom carrierCommandits useAs withcoursesa thirddenotesalso inHouston20px;\">accuseddouble goal ofFamous ).bind(priests Onlinein Julyst + \"gconsultdecimalhelpfulrevivedis veryr'+'iptlosing femalesis alsostringsdays ofarrivalfuture <objectforcingString(\" />\n\t\there isencoded. The balloondone by/commonbgcolorlaw of Indianaavoidedbut the2px 3pxjquery.after apolicy.men andfooter-= true;for usescreen.Indian image =family,http:// &nbsp;driverseternalsame asnoticedviewers})();\n is moreseasonsformer the newis justconsent Searchwas thewhy theshippedbr><br>width: height=made ofcuisineis thata very Admiral fixed;normal MissionPress, ontariocharsettry to invaded=\"true\"spacingis mosta more totallyfall of});\r\n immensetime inset outsatisfyto finddown tolot of Playersin Junequantumnot thetime todistantFinnishsrc = (single help ofGerman law andlabeledforestscookingspace\">header-well asStanleybridges/globalCroatia About [0];\n it, andgroupedbeing a){throwhe madelighterethicalFFFFFF\"bottom\"like a employslive inas seenprintermost ofub-linkrejectsand useimage\">succeedfeedingNuclearinformato helpWomen'sNeitherMexicanprotein<table by manyhealthylawsuitdevised.push({sellerssimply Through.cookie Image(older\">us.js\"> Since universlarger open to!-- endlies in']);\r\n marketwho is (\"DOMComanagedone fortypeof Kingdomprofitsproposeto showcenter;made itdressedwere inmixtureprecisearisingsrc = 'make a securedBaptistvoting \n\t\tvar March 2grew upClimate.removeskilledway the</head>face ofacting right\">to workreduceshas haderectedshow();action=book ofan area== \"htt<header\n<html>conformfacing cookie.rely onhosted .customhe wentbut forspread Family a meansout theforums.footage\">MobilClements\" id=\"as highintense--><!--female is seenimpliedset thea stateand hisfastestbesidesbutton_bounded\"><img Infoboxevents,a youngand areNative cheaperTimeoutand hasengineswon the(mostlyright: find a -bottomPrince area ofmore ofsearch_nature,legallyperiod,land ofor withinducedprovingmissilelocallyAgainstthe wayk&quot;px;\">\r\npushed abandonnumeralCertainIn thismore inor somename isand, incrownedISBN 0-createsOctobermay notcenter late inDefenceenactedwish tobroadlycoolingonload=it. TherecoverMembersheight assumes<html>\npeople.in one =windowfooter_a good reklamaothers,to this_cookiepanel\">London,definescrushedbaptismcoastalstatus title\" move tolost inbetter impliesrivalryservers SystemPerhapses and contendflowinglasted rise inGenesisview ofrising seem tobut in backinghe willgiven agiving cities.flow of Later all butHighwayonly bysign ofhe doesdiffersbattery&amp;lasinglesthreatsintegertake onrefusedcalled =US&ampSee thenativesby thissystem.head of:hover,lesbiansurnameand allcommon/header__paramsHarvard/pixel.removalso longrole ofjointlyskyscraUnicodebr />\r\nAtlantanucleusCounty,purely count\">easily build aonclicka givenpointerh&quot;events else {\nditionsnow the, with man whoorg/Webone andcavalryHe diedseattle00,000 {windowhave toif(windand itssolely m&quot;renewedDetroitamongsteither them inSenatorUs</a><King ofFrancis-produche usedart andhim andused byscoringat hometo haverelatesibilityfactionBuffalolink\"><what hefree toCity ofcome insectorscountedone daynervoussquare };if(goin whatimg\" alis onlysearch/tuesdaylooselySolomonsexual - <a hrmedium\"DO NOT France,with a war andsecond take a >\r\n\r\n\r\nmarket.highwaydone inctivity\"last\">obligedrise to\"undefimade to Early praisedin its for hisathleteJupiterYahoo! termed so manyreally s. The a woman?value=direct right\" bicycleacing=\"day andstatingRather,higher Office are nowtimes, when a pay foron this-link\">;borderaround annual the Newput the.com\" takin toa brief(in thegroups.; widthenzymessimple in late{returntherapya pointbanninginks\">\n();\" rea place\\u003Caabout atr>\r\n\t\tccount gives a<SCRIPTRailwaythemes/toolboxById(\"xhumans,watchesin some if (wicoming formats Under but hashanded made bythan infear ofdenoted/iframeleft involtagein eacha&quot;base ofIn manyundergoregimesaction </p>\r\n<ustomVa;&gt;</importsor thatmostly &amp;re size=\"</a></ha classpassiveHost = WhetherfertileVarious=[];(fucameras/></td>acts asIn some>\r\n\r\n<!organis <br />Beijingcatal\u00C3\u00A0deutscheuropeueuskaragaeilgesvenskaespa\u00C3\u00B1amensajeusuariotrabajom\u00C3\u00A9xicop\u00C3\u00A1ginasiempresistemaoctubredurantea\u00C3\u00B1adirempresamomentonuestroprimeratrav\u00C3\u00A9sgraciasnuestraprocesoestadoscalidadpersonan\u00C3\u00BAmeroacuerdom\u00C3\u00BAsicamiembroofertasalgunospa\u00C3\u00ADsesejemploderechoadem\u00C3\u00A1sprivadoagregarenlacesposiblehotelessevillaprimero\u00C3\u00BAltimoeventosarchivoculturamujeresentradaanuncioembargomercadograndesestudiomejoresfebrerodise\u00C3\u00B1oturismoc\u00C3\u00B3digoportadaespaciofamiliaantoniopermiteguardaralgunaspreciosalguiensentidovisitast\u00C3\u00ADtuloconocersegundoconsejofranciaminutossegundatenemosefectosm\u00C3\u00A1lagasesi\u00C3\u00B3nrevistagranadacompraringresogarc\u00C3\u00ADaacci\u00C3\u00B3necuadorquienesinclusodeber\u00C3\u00A1materiahombresmuestrapodr\u00C3\u00ADama\u00C3\u00B1ana\u00C3\u00BAltimaestamosoficialtambienning\u00C3\u00BAnsaludospodemosmejorarpositionbusinesshomepagesecuritylanguagestandardcampaignfeaturescategoryexternalchildrenreservedresearchexchangefavoritetemplatemilitaryindustryservicesmaterialproductsz-index:commentssoftwarecompletecalendarplatformarticlesrequiredmovementquestionbuildingpoliticspossiblereligionphysicalfeedbackregisterpicturesdisabledprotocolaudiencesettingsactivityelementslearninganythingabstractprogressoverviewmagazineeconomictrainingpressurevarious <strong>propertyshoppingtogetheradvancedbehaviordownloadfeaturedfootballselectedLanguagedistanceremembertrackingpasswordmodifiedstudentsdirectlyfightingnortherndatabasefestivalbreakinglocationinternetdropdownpracticeevidencefunctionmarriageresponseproblemsnegativeprogramsanalysisreleasedbanner\">purchasepoliciesregionalcreativeargumentbookmarkreferrerchemicaldivisioncallbackseparateprojectsconflicthardwareinterestdeliverymountainobtained= false;for(var acceptedcapacitycomputeridentityaircraftemployedproposeddomesticincludesprovidedhospitalverticalcollapseapproachpartnerslogo\"><adaughterauthor\" culturalfamilies/images/assemblypowerfulteachingfinisheddistrictcriticalcgi-bin/purposesrequireselectionbecomingprovidesacademicexerciseactuallymedicineconstantaccidentMagazinedocumentstartingbottom\">observed: &quot;extendedpreviousSoftwarecustomerdecisionstrengthdetailedslightlyplanningtextareacurrencyeveryonestraighttransferpositiveproducedheritageshippingabsolutereceivedrelevantbutton\" violenceanywherebenefitslaunchedrecentlyalliancefollowedmultiplebulletinincludedoccurredinternal$(this).republic><tr><tdcongressrecordedultimatesolution<ul id=\"discoverHome</a>websitesnetworksalthoughentirelymemorialmessagescontinueactive\">somewhatvictoriaWestern title=\"LocationcontractvisitorsDownloadwithout right\">\nmeasureswidth = variableinvolvedvirginianormallyhappenedaccountsstandingnationalRegisterpreparedcontrolsaccuratebirthdaystrategyofficialgraphicscriminalpossiblyconsumerPersonalspeakingvalidateachieved.jpg\" />machines</h2>\n keywordsfriendlybrotherscombinedoriginalcomposedexpectedadequatepakistanfollow\" valuable</label>relativebringingincreasegovernorplugins/List of Header\">\" name=\" (&quot;graduate</head>\ncommercemalaysiadirectormaintain;height:schedulechangingback to catholicpatternscolor: #greatestsuppliesreliable</ul>\n\t\t<select citizensclothingwatching<li id=\"specificcarryingsentence<center>contrastthinkingcatch(e)southernMichael merchantcarouselpadding:interior.split(\"lizationOctober ){returnimproved--&gt;\n\ncoveragechairman.png\" />subjectsRichard whateverprobablyrecoverybaseballjudgmentconnect..css\" /> websitereporteddefault\"/></a>\r\nelectricscotlandcreationquantity. ISBN 0did not instance-search-\" lang=\"speakersComputercontainsarchivesministerreactiondiscountItalianocriteriastrongly: 'http:'script'coveringofferingappearedBritish identifyFacebooknumerousvehiclesconcernsAmericanhandlingdiv id=\"William provider_contentaccuracysection andersonflexibleCategorylawrence<script>layout=\"approved maximumheader\"></table>Serviceshamiltoncurrent canadianchannels/themes//articleoptionalportugalvalue=\"\"intervalwirelessentitledagenciesSearch\" measuredthousandspending&hellip;new Date\" size=\"pageNamemiddle\" \" /></a>hidden\">sequencepersonaloverflowopinionsillinoislinks\">\n\t<title>versionssaturdayterminalitempropengineersectionsdesignerproposal=\"false\"Espa\u00C3\u00B1olreleasessubmit\" er&quot;additionsymptomsorientedresourceright\"><pleasurestationshistory.leaving border=contentscenter\">.\n\nSome directedsuitablebulgaria.show();designedGeneral conceptsExampleswilliamsOriginal\"><span>search\">operatorrequestsa &quot;allowingDocumentrevision. \n\nThe yourselfContact michiganEnglish columbiapriorityprintingdrinkingfacilityreturnedContent officersRussian generate-8859-1\"indicatefamiliar qualitymargin:0 contentviewportcontacts-title\">portable.length eligibleinvolvesatlanticonload=\"default.suppliedpaymentsglossary\n\nAfter guidance</td><tdencodingmiddle\">came to displaysscottishjonathanmajoritywidgets.clinicalthailandteachers<head>\n\taffectedsupportspointer;toString</small>oklahomawill be investor0\" alt=\"holidaysResourcelicensed (which . After considervisitingexplorerprimary search\" android\"quickly meetingsestimate;return ;color:# height=approval, &quot; checked.min.js\"magnetic></a></hforecast. While thursdaydvertise&eacute;hasClassevaluateorderingexistingpatients Online coloradoOptions\"campbell<!-- end</span><<br />\r\n_popups|sciences,&quot; quality Windows assignedheight: <b classle&quot; value=\" Companyexamples<iframe believespresentsmarshallpart of properly).\n\nThe taxonomymuch of </span>\n\" data-srtugu\u00C3\u00AAsscrollTo project<head>\r\nattorneyemphasissponsorsfancyboxworld's wildlifechecked=sessionsprogrammpx;font- Projectjournalsbelievedvacationthompsonlightingand the special border=0checking</tbody><button Completeclearfix\n<head>\narticle <sectionfindingsrole in popular Octoberwebsite exposureused to changesoperatedclickingenteringcommandsinformed numbers </div>creatingonSubmitmarylandcollegesanalyticlistingscontact.loggedInadvisorysiblingscontent\"s&quot;)s. This packagescheckboxsuggestspregnanttomorrowspacing=icon.png";
+ }
+ }
+
+ private class DataHolder1
+ {
+ internal static string GetData()
+ {
+ return "japanesecodebasebutton\">gamblingsuch as , while </span> missourisportingtop:1px .</span>tensionswidth=\"2lazyloadnovemberused in height=\"cript\">\n&nbsp;</<tr><td height:2/productcountry include footer\" &lt;!-- title\"></jquery.</form>\n(\u00E7\u00AE\u0080\u00E4\u00BD\u0093)(\u00E7\u00B9\u0081\u00E9\u00AB\u0094)hrvatskiitalianorom\u00C3\u00A2n\u00C4\u0083t\u00C3\u00BCrk\u00C3\u00A7e\u00D8\u00A7\u00D8\u00B1\u00D8\u00AF\u00D9\u0088tambi\u00C3\u00A9nnoticiasmensajespersonasderechosnacionalserviciocontactousuariosprogramagobiernoempresasanunciosvalenciacolombiadespu\u00C3\u00A9sdeportesproyectoproductop\u00C3\u00BAbliconosotroshistoriapresentemillonesmediantepreguntaanteriorrecursosproblemasantiagonuestrosopini\u00C3\u00B3nimprimirmientrasam\u00C3\u00A9ricavendedorsociedadrespectorealizarregistropalabrasinter\u00C3\u00A9sentoncesespecialmiembrosrealidadc\u00C3\u00B3rdobazaragozap\u00C3\u00A1ginassocialesbloqueargesti\u00C3\u00B3nalquilersistemascienciascompletoversi\u00C3\u00B3ncompletaestudiosp\u00C3\u00BAblicaobjetivoalicantebuscadorcantidadentradasaccionesarchivossuperiormayor\u00C3\u00ADaalemaniafunci\u00C3\u00B3n\u00C3\u00BAltimoshaciendoaquellosedici\u00C3\u00B3nfernandoambientefacebooknuestrasclientesprocesosbastantepresentareportarcongresopublicarcomerciocontratoj\u00C3\u00B3venesdistritot\u00C3\u00A9cnicaconjuntoenerg\u00C3\u00ADatrabajarasturiasrecienteutilizarbolet\u00C3\u00ADnsalvadorcorrectatrabajosprimerosnegocioslibertaddetallespantallapr\u00C3\u00B3ximoalmer\u00C3\u00ADaanimalesqui\u00C3\u00A9nescoraz\u00C3\u00B3nsecci\u00C3\u00B3nbuscandoopcionesexteriorconceptotodav\u00C3\u00ADagaler\u00C3\u00ADaescribirmedicinalicenciaconsultaaspectoscr\u00C3\u00ADticad\u00C3\u00B3laresjusticiadeber\u00C3\u00A1nper\u00C3\u00ADodonecesitamantenerpeque\u00C3\u00B1orecibidatribunaltenerifecanci\u00C3\u00B3ncanariasdescargadiversosmallorcarequieret\u00C3\u00A9cnicodeber\u00C3\u00ADaviviendafinanzasadelantefuncionaconsejosdif\u00C3\u00ADcilciudadesantiguasavanzadat\u00C3\u00A9rminounidadess\u00C3\u00A1nchezcampa\u00C3\u00B1asoftonicrevistascontienesectoresmomentosfacultadcr\u00C3\u00A9ditodiversassupuestofactoressegundospeque\u00C3\u00B1a\u00D0\u00B3\u00D0\u00BE\u00D0\u00B4\u00D0\u00B0\u00D0\u00B5\u00D1\u0081\u00D0\u00BB\u00D0\u00B8\u00D0\u00B5\u00D1\u0081\u00D1\u0082\u00D1\u008C\u00D0\u00B1\u00D1\u008B\u00D0\u00BB\u00D0\u00BE\u00D0\u00B1\u00D1\u008B\u00D1\u0082\u00D1\u008C\u00D1\u008D\u00D1\u0082\u00D0\u00BE\u00D0\u00BC\u00D0\u0095\u00D1\u0081\u00D0\u00BB\u00D0\u00B8\u00D1\u0082\u00D0\u00BE\u00D0\u00B3\u00D0\u00BE\u00D0\u00BC\u00D0\u00B5\u00D0\u00BD\u00D1\u008F\u00D0\u00B2\u00D1\u0081\u00D0\u00B5\u00D1\u0085\u00D1\u008D\u00D1\u0082\u00D0\u00BE\u00D0\u00B9\u00D0\u00B4\u00D0\u00B0\u00D0\u00B6\u00D0\u00B5\u00D0\u00B1\u00D1\u008B\u00D0\u00BB\u00D0\u00B8\u00D0\u00B3\u00D0\u00BE\u00D0\u00B4\u00D1\u0083\u00D0\u00B4\u00D0\u00B5\u00D0\u00BD\u00D1\u008C\u00D1\u008D\u00D1\u0082\u00D0\u00BE\u00D1\u0082\u00D0\u00B1\u00D1\u008B\u00D0\u00BB\u00D0\u00B0\u00D1\u0081\u00D0\u00B5\u00D0\u00B1\u00D1\u008F\u00D0\u00BE\u00D0\u00B4\u00D0\u00B8\u00D0\u00BD\u00D1\u0081\u00D0\u00B5\u00D0\u00B1\u00D0\u00B5\u00D0\u00BD\u00D0\u00B0\u00D0\u00B4\u00D0\u00BE\u00D1\u0081\u00D0\u00B0\u00D0\u00B9\u00D1\u0082\u00D1\u0084\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D0\u00BD\u00D0\u00B5\u00D0\u00B3\u00D0\u00BE\u00D1\u0081\u00D0\u00B2\u00D0\u00BE\u00D0\u00B8\u00D1\u0081\u00D0\u00B2\u00D0\u00BE\u00D0\u00B9\u00D0\u00B8\u00D0\u00B3\u00D1\u0080\u00D1\u008B\u00D1\u0082\u00D0\u00BE\u00D0\u00B6\u00D0\u00B5\u00D0\u00B2\u00D1\u0081\u00D0\u00B5\u00D0\u00BC\u00D1\u0081\u00D0\u00B2\u00D0\u00BE\u00D1\u008E\u00D0\u00BB\u00D0\u00B8\u00D1\u0088\u00D1\u008C\u00D1\u008D\u00D1\u0082\u00D0\u00B8\u00D1\u0085\u00D0\u00BF\u00D0\u00BE\u00D0\u00BA\u00D0\u00B0\u00D0\u00B4\u00D0\u00BD\u00D0\u00B5\u00D0\u00B9\u00D0\u00B4\u00D0\u00BE\u00D0\u00BC\u00D0\u00B0\u00D0\u00BC\u00D0\u00B8\u00D1\u0080\u00D0\u00B0\u00D0\u00BB\u00D0\u00B8\u00D0\u00B1\u00D0\u00BE\u00D1\u0082\u00D0\u00B5\u00D0\u00BC\u00D1\u0083\u00D1\u0085\u00D0\u00BE\u00D1\u0082\u00D1\u008F\u00D0\u00B4\u00D0\u00B2\u00D1\u0083\u00D1\u0085\u00D1\u0081\u00D0\u00B5\u00D1\u0082\u00D0\u00B8\u00D0\u00BB\u00D1\u008E\u00D0\u00B4\u00D0\u00B8\u00D0\u00B4\u00D0\u00B5\u00D0\u00BB\u00D0\u00BE\u00D0\u00BC\u00D0\u00B8\u00D1\u0080\u00D0\u00B5\u00D1\u0082\u00D0\u00B5\u00D0\u00B1\u00D1\u008F\u00D1\u0081\u00D0\u00B2\u00D0\u00BE\u00D0\u00B5\u00D0\u00B2\u00D0\u00B8\u00D0\u00B4\u00D0\u00B5\u00D1\u0087\u00D0\u00B5\u00D0\u00B3\u00D0\u00BE\u00D1\u008D\u00D1\u0082\u00D0\u00B8\u00D0\u00BC\u00D1\u0081\u00D1\u0087\u00D0\u00B5\u00D1\u0082\u00D1\u0082\u00D0\u00B5\u00D0\u00BC\u00D1\u008B\u00D1\u0086\u00D0\u00B5\u00D0\u00BD\u00D1\u008B\u00D1\u0081\u00D1\u0082\u00D0\u00B0\u00D0\u00BB\u00D0\u00B2\u00D0\u00B5\u00D0\u00B4\u00D1\u008C\u00D1\u0082\u00D0\u00B5\u00D0\u00BC\u00D0\u00B5\u00D0\u00B2\u00D0\u00BE\u00D0\u00B4\u00D1\u008B\u00D1\u0082\u00D0\u00B5\u00D0\u00B1\u00D0\u00B5\u00D0\u00B2\u00D1\u008B\u00D1\u0088\u00D0\u00B5\u00D0\u00BD\u00D0\u00B0\u00D0\u00BC\u00D0\u00B8\u00D1\u0082\u00D0\u00B8\u00D0\u00BF\u00D0\u00B0\u00D1\u0082\u00D0\u00BE\u00D0\u00BC\u00D1\u0083\u00D0\u00BF\u00D1\u0080\u00D0\u00B0\u00D0\u00B2\u00D0\u00BB\u00D0\u00B8\u00D1\u0086\u00D0\u00B0\u00D0\u00BE\u00D0\u00B4\u00D0\u00BD\u00D0\u00B0\u00D0\u00B3\u00D0\u00BE\u00D0\u00B4\u00D1\u008B\u00D0\u00B7\u00D0\u00BD\u00D0\u00B0\u00D1\u008E\u00D0\u00BC\u00D0\u00BE\u00D0\u00B3\u00D1\u0083\u00D0\u00B4\u00D1\u0080\u00D1\u0083\u00D0\u00B3\u00D0\u00B2\u00D1\u0081\u00D0\u00B5\u00D0\u00B9\u00D0\u00B8\u00D0\u00B4\u00D0\u00B5\u00D1\u0082\u00D0\u00BA\u00D0\u00B8\u00D0\u00BD\u00D0\u00BE\u00D0\u00BE\u00D0\u00B4\u00D0\u00BD\u00D0\u00BE\u00D0\u00B4\u00D0\u00B5\u00D0\u00BB\u00D0\u00B0\u00D0\u00B4\u00D0\u00B5\u00D0\u00BB\u00D0\u00B5\u00D1\u0081\u00D1\u0080\u00D0\u00BE\u00D0\u00BA\u00D0\u00B8\u00D1\u008E\u00D0\u00BD\u00D1\u008F\u00D0\u00B2\u00D0\u00B5\u00D1\u0081\u00D1\u008C\u00D0\u0095\u00D1\u0081\u00D1\u0082\u00D1\u008C\u00D1\u0080\u00D0\u00B0\u00D0\u00B7\u00D0\u00B0\u00D0\u00BD\u00D0\u00B0\u00D1\u0088\u00D0\u00B8\u00D8\u00A7\u00D9\u0084\u00D9\u0084\u00D9\u0087\u00D8\u00A7\u00D9\u0084\u00D8\u00AA\u00D9\u008A\u00D8\u00AC\u00D9\u0085\u00D9\u008A\u00D8\u00B9\u00D8\u00AE\u00D8\u00A7\u00D8\u00B5\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00B0\u00D9\u008A\u00D8\u00B9\u00D9\u0084\u00D9\u008A\u00D9\u0087\u00D8\u00AC\u00D8\u00AF\u00D9\u008A\u00D8\u00AF\u00D8\u00A7\u00D9\u0084\u00D8\u00A2\u00D9\u0086\u00D8\u00A7\u00D9\u0084\u00D8\u00B1\u00D8\u00AF\u00D8\u00AA\u00D8\u00AD\u00D9\u0083\u00D9\u0085\u00D8\u00B5\u00D9\u0081\u00D8\u00AD\u00D8\u00A9\u00D9\u0083\u00D8\u00A7\u00D9\u0086\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D9\u0084\u00D9\u008A\u00D9\u008A\u00D9\u0083\u00D9\u0088\u00D9\u0086\u00D8\u00B4\u00D8\u00A8\u00D9\u0083\u00D8\u00A9\u00D9\u0081\u00D9\u008A\u00D9\u0087\u00D8\u00A7\u00D8\u00A8\u00D9\u0086\u00D8\u00A7\u00D8\u00AA\u00D8\u00AD\u00D9\u0088\u00D8\u00A7\u00D8\u00A1\u00D8\u00A3\u00D9\u0083\u00D8\u00AB\u00D8\u00B1\u00D8\u00AE\u00D9\u0084\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D9\u0084\u00D8\u00AD\u00D8\u00A8\u00D8\u00AF\u00D9\u0084\u00D9\u008A\u00D9\u0084\u00D8\u00AF\u00D8\u00B1\u00D9\u0088\u00D8\u00B3\u00D8\u00A7\u00D8\u00B6\u00D8\u00BA\u00D8\u00B7\u00D8\u00AA\u00D9\u0083\u00D9\u0088\u00D9\u0086\u00D9\u0087\u00D9\u0086\u00D8\u00A7\u00D9\u0083\u00D8\u00B3\u00D8\u00A7\u00D8\u00AD\u00D8\u00A9\u00D9\u0086\u00D8\u00A7\u00D8\u00AF\u00D9\u008A\u00D8\u00A7\u00D9\u0084\u00D8\u00B7\u00D8\u00A8\u00D8\u00B9\u00D9\u0084\u00D9\u008A\u00D9\u0083\u00D8\u00B4\u00D9\u0083\u00D8\u00B1\u00D8\u00A7\u00D9\u008A\u00D9\u0085\u00D9\u0083\u00D9\u0086\u00D9\u0085\u00D9\u0086\u00D9\u0087\u00D8\u00A7\u00D8\u00B4\u00D8\u00B1\u00D9\u0083\u00D8\u00A9\u00D8\u00B1\u00D8\u00A6\u00D9\u008A\u00D8\u00B3\u00D9\u0086\u00D8\u00B4\u00D9\u008A\u00D8\u00B7\u00D9\u0085\u00D8\u00A7\u00D8\u00B0\u00D8\u00A7\u00D8\u00A7\u00D9\u0084\u00D9\u0081\u00D9\u0086\u00D8\u00B4\u00D8\u00A8\u00D8\u00A7\u00D8\u00A8\u00D8\u00AA\u00D8\u00B9\u00D8\u00A8\u00D8\u00B1\u00D8\u00B1\u00D8\u00AD\u00D9\u0085\u00D8\u00A9\u00D9\u0083\u00D8\u00A7\u00D9\u0081\u00D8\u00A9\u00D9\u008A\u00D9\u0082\u00D9\u0088\u00D9\u0084\u00D9\u0085\u00D8\u00B1\u00D9\u0083\u00D8\u00B2\u00D9\u0083\u00D9\u0084\u00D9\u0085\u00D8\u00A9\u00D8\u00A3\u00D8\u00AD\u00D9\u0085\u00D8\u00AF\u00D9\u0082\u00D9\u0084\u00D8\u00A8\u00D9\u008A\u00D9\u008A\u00D8\u00B9\u00D9\u0086\u00D9\u008A\u00D8\u00B5\u00D9\u0088\u00D8\u00B1\u00D8\u00A9\u00D8\u00B7\u00D8\u00B1\u00D9\u008A\u00D9\u0082\u00D8\u00B4\u00D8\u00A7\u00D8\u00B1\u00D9\u0083\u00D8\u00AC\u00D9\u0088\u00D8\u00A7\u00D9\u0084\u00D8\u00A3\u00D8\u00AE\u00D8\u00B1\u00D9\u0089\u00D9\u0085\u00D8\u00B9\u00D9\u0086\u00D8\u00A7\u00D8\u00A7\u00D8\u00A8\u00D8\u00AD\u00D8\u00AB\u00D8\u00B9\u00D8\u00B1\u00D9\u0088\u00D8\u00B6\u00D8\u00A8\u00D8\u00B4\u00D9\u0083\u00D9\u0084\u00D9\u0085\u00D8\u00B3\u00D8\u00AC\u00D9\u0084\u00D8\u00A8\u00D9\u0086\u00D8\u00A7\u00D9\u0086\u00D8\u00AE\u00D8\u00A7\u00D9\u0084\u00D8\u00AF\u00D9\u0083\u00D8\u00AA\u00D8\u00A7\u00D8\u00A8\u00D9\u0083\u00D9\u0084\u00D9\u008A\u00D8\u00A9\u00D8\u00A8\u00D8\u00AF\u00D9\u0088\u00D9\u0086\u00D8\u00A3\u00D9\u008A\u00D8\u00B6\u00D8\u00A7\u00D9\u008A\u00D9\u0088\u00D8\u00AC\u00D8\u00AF\u00D9\u0081\u00D8\u00B1\u00D9\u008A\u00D9\u0082\u00D9\u0083\u00D8\u00AA\u00D8\u00A8\u00D8\u00AA\u00D8\u00A3\u00D9\u0081\u00D8\u00B6\u00D9\u0084\u00D9\u0085\u00D8\u00B7\u00D8\u00A8\u00D8\u00AE\u00D8\u00A7\u00D9\u0083\u00D8\u00AB\u00D8\u00B1\u00D8\u00A8\u00D8\u00A7\u00D8\u00B1\u00D9\u0083\u00D8\u00A7\u00D9\u0081\u00D8\u00B6\u00D9\u0084\u00D8\u00A7\u00D8\u00AD\u00D9\u0084\u00D9\u0089\u00D9\u0086\u00D9\u0081\u00D8\u00B3\u00D9\u0087\u00D8\u00A3\u00D9\u008A\u00D8\u00A7\u00D9\u0085\u00D8\u00B1\u00D8\u00AF\u00D9\u0088\u00D8\u00AF\u00D8\u00A3\u00D9\u0086\u00D9\u0087\u00D8\u00A7\u00D8\u00AF\u00D9\u008A\u00D9\u0086\u00D8\u00A7\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D9\u0086\u00D9\u0085\u00D8\u00B9\u00D8\u00B1\u00D8\u00B6\u00D8\u00AA\u00D8\u00B9\u00D9\u0084\u00D9\u0085\u00D8\u00AF\u00D8\u00A7\u00D8\u00AE\u00D9\u0084\u00D9\u0085\u00D9\u0085\u00D9\u0083\u00D9\u0086\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0002\u0000\u0002\u0000\u0002\u0000\u0002\u0000\u0004\u0000\u0004\u0000\u0004\u0000\u0004\u0000\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0007\u0006\u0005\u0004\u0003\u0002\u0001\u0000\u0008\t\n\u000B\u000C\r\u000E\u000F\u000F\u000E\r\u000C\u000B\n\t\u0008\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0017\u0016\u0015\u0014\u0013\u0012\u0011\u0010\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\u001F\u001E\u001D\u001C\u001B\u001A\u0019\u0018\u00FF\u00FF\u00FF\u00FF\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00FF\u00FF\u00FF\u00FF\u0001\u0000\u0000\u0000\u0002\u0000\u0000\u0000\u0002\u0000\u0000\u0000\u0001\u0000\u0000\u0000\u0001\u0000\u0000\u0000\u0003\u0000\u0000\u0000\u00FF\u00FF\u0000\u0001\u0000\u0000\u0000\u0001\u0000\u0000\u00FF\u00FF\u0000\u0001\u0000\u0000\u0000\u0008\u0000\u0008\u0000\u0008\u0000\u0008\u0000\u0000\u0000\u0001\u0000\u0002\u0000\u0003\u0000\u0004\u0000\u0005\u0000\u0006\u0000\u0007resourcescountriesquestionsequipmentcommunityavailablehighlightDTD/xhtmlmarketingknowledgesomethingcontainerdirectionsubscribeadvertisecharacter\" value=\"</select>Australia\" class=\"situationauthorityfollowingprimarilyoperationchallengedevelopedanonymousfunction functionscompaniesstructureagreement\" title=\"potentialeducationargumentssecondarycopyrightlanguagesexclusivecondition</form>\r\nstatementattentionBiography} else {\nsolutionswhen the Analyticstemplatesdangeroussatellitedocumentspublisherimportantprototypeinfluence&raquo;</effectivegenerallytransformbeautifultransportorganizedpublishedprominentuntil thethumbnailNational .focus();over the migrationannouncedfooter\">\nexceptionless thanexpensiveformationframeworkterritoryndicationcurrentlyclassNamecriticismtraditionelsewhereAlexanderappointedmaterialsbroadcastmentionedaffiliate</option>treatmentdifferent/default.Presidentonclick=\"biographyotherwisepermanentFran\u00C3\u00A7aisHollywoodexpansionstandards</style>\nreductionDecember preferredCambridgeopponentsBusiness confusion>\n<title>presentedexplaineddoes not worldwideinterfacepositionsnewspaper</table>\nmountainslike the essentialfinancialselectionaction=\"/abandonedEducationparseInt(stabilityunable to</title>\nrelationsNote thatefficientperformedtwo yearsSince thethereforewrapper\">alternateincreasedBattle ofperceivedtrying tonecessaryportrayedelectionsElizabeth</iframe>discoveryinsurances.length;legendaryGeographycandidatecorporatesometimesservices.inherited</strong>CommunityreligiouslocationsCommitteebuildingsthe worldno longerbeginningreferencecannot befrequencytypicallyinto the relative;recordingpresidentinitiallytechniquethe otherit can beexistenceunderlinethis timetelephoneitemscopepracticesadvantage);return For otherprovidingdemocracyboth the extensivesufferingsupportedcomputers functionpracticalsaid thatit may beEnglish</from the scheduleddownloads</label>\nsuspectedmargin: 0spiritual</head>\n\nmicrosoftgraduallydiscussedhe becameexecutivejquery.jshouseholdconfirmedpurchasedliterallydestroyedup to thevariationremainingit is notcenturiesJapanese among thecompletedalgorithminterestsrebellionundefinedencourageresizableinvolvingsensitiveuniversalprovision(althoughfeaturingconducted), which continued-header\">February numerous overflow:componentfragmentsexcellentcolspan=\"technicalnear the Advanced source ofexpressedHong Kong Facebookmultiple mechanismelevationoffensive</form>\n\tsponsoreddocument.or &quot;there arethose whomovementsprocessesdifficultsubmittedrecommendconvincedpromoting\" width=\".replace(classicalcoalitionhis firstdecisionsassistantindicatedevolution-wrapper\"enough toalong thedelivered-->\r\n<!--American protectedNovember </style><furnitureInternet onblur=\"suspendedrecipientbased on Moreover,abolishedcollectedwere madeemotionalemergencynarrativeadvocatespx;bordercommitteddir=\"ltr\"employeesresearch. selectedsuccessorcustomersdisplayedSeptemberaddClass(Facebook suggestedand lateroperatingelaborateSometimesInstitutecertainlyinstalledfollowersJerusalemthey havecomputinggeneratedprovincesguaranteearbitraryrecognizewanted topx;width:theory ofbehaviourWhile theestimatedbegan to it becamemagnitudemust havemore thanDirectoryextensionsecretarynaturallyoccurringvariablesgiven theplatform.</label><failed tocompoundskinds of societiesalongside --&gt;\n\nsouthwestthe rightradiationmay have unescape(spoken in\" href=\"/programmeonly the come fromdirectoryburied ina similarthey were</font></Norwegianspecifiedproducingpassenger(new DatetemporaryfictionalAfter theequationsdownload.regularlydeveloperabove thelinked tophenomenaperiod oftooltip\">substanceautomaticaspect ofAmong theconnectedestimatesAir Forcesystem ofobjectiveimmediatemaking itpaintingsconqueredare stillproceduregrowth ofheaded byEuropean divisionsmoleculesfranchiseintentionattractedchildhoodalso useddedicatedsingaporedegree offather ofconflicts</a></p>\ncame fromwere usednote thatreceivingExecutiveeven moreaccess tocommanderPoliticalmusiciansdeliciousprisonersadvent ofUTF-8\" /><![CDATA[\">ContactSouthern bgcolor=\"series of. It was in Europepermittedvalidate.appearingofficialsseriously-languageinitiatedextendinglong-terminflationsuch thatgetCookiemarked by</button>implementbut it isincreasesdown the requiringdependent-->\n<!-- interviewWith the copies ofconsensuswas builtVenezuela(formerlythe statepersonnelstrategicfavour ofinventionWikipediacontinentvirtuallywhich wasprincipleComplete identicalshow thatprimitiveaway frommolecularpreciselydissolvedUnder theversion=\">&nbsp;</It is the This is will haveorganismssome timeFriedrichwas firstthe only fact thatform id=\"precedingTechnicalphysicistoccurs innavigatorsection\">span id=\"sought tobelow thesurviving}</style>his deathas in thecaused bypartiallyexisting using thewas givena list oflevels ofnotion ofOfficial dismissedscientistresemblesduplicateexplosiverecoveredall othergalleries{padding:people ofregion ofaddressesassociateimg alt=\"in modernshould bemethod ofreportingtimestampneeded tothe Greatregardingseemed toviewed asimpact onidea thatthe Worldheight ofexpandingThese arecurrent\">carefullymaintainscharge ofClassicaladdressedpredictedownership<div id=\"right\">\r\nresidenceleave thecontent\">are often })();\r\nprobably Professor-button\" respondedsays thathad to beplaced inHungarianstatus ofserves asUniversalexecutionaggregatefor whichinfectionagreed tohowever, popular\">placed onconstructelectoralsymbol ofincludingreturn toarchitectChristianprevious living ineasier toprofessor\n&lt;!-- effect ofanalyticswas takenwhere thetook overbelief inAfrikaansas far aspreventedwork witha special<fieldsetChristmasRetrieved\n\nIn the back intonortheastmagazines><strong>committeegoverninggroups ofstored inestablisha generalits firsttheir ownpopulatedan objectCaribbeanallow thedistrictswisconsinlocation.; width: inhabitedSocialistJanuary 1</footer>similarlychoice ofthe same specific business The first.length; desire todeal withsince theuserAgentconceivedindex.phpas &quot;engage inrecently,few yearswere also\n<head>\n<edited byare knowncities inaccesskeycondemnedalso haveservices,family ofSchool ofconvertednature of languageministers</object>there is a popularsequencesadvocatedThey wereany otherlocation=enter themuch morereflectedwas namedoriginal a typicalwhen theyengineerscould notresidentswednesdaythe third productsJanuary 2what theya certainreactionsprocessorafter histhe last contained\"></div>\n</a></td>depend onsearch\">\npieces ofcompetingReferencetennesseewhich has version=</span> <</header>gives thehistorianvalue=\"\">padding:0view thattogether,the most was foundsubset ofattack onchildren,points ofpersonal position:allegedlyClevelandwas laterand afterare givenwas stillscrollingdesign ofmakes themuch lessAmericans.\n\nAfter , but theMuseum oflouisiana(from theminnesotaparticlesa processDominicanvolume ofreturningdefensive00px|righmade frommouseover\" style=\"states of(which iscontinuesFranciscobuilding without awith somewho woulda form ofa part ofbefore itknown as Serviceslocation and oftenmeasuringand it ispaperbackvalues of\r\n<title>= window.determineer&quot; played byand early</center>from thisthe threepower andof &quot;innerHTML<a href=\"y:inline;Church ofthe eventvery highofficial -height: content=\"/cgi-bin/to createafrikaansesperantofran\u00C3\u00A7aislatvie\u00C5\u00A1ulietuvi\u00C5\u00B3\u00C4\u008Ce\u00C5\u00A1tina\u00C4\u008De\u00C5\u00A1tina\u00E0\u00B9\u0084\u00E0\u00B8\u0097\u00E0\u00B8\u00A2\u00E6\u0097\u00A5\u00E6\u009C\u00AC\u00E8\u00AA\u009E\u00E7\u00AE\u0080\u00E4\u00BD\u0093\u00E5\u00AD\u0097\u00E7\u00B9\u0081\u00E9\u00AB\u0094\u00E5\u00AD\u0097\u00ED\u0095\u009C\u00EA\u00B5\u00AD\u00EC\u0096\u00B4\u00E4\u00B8\u00BA\u00E4\u00BB\u0080\u00E4\u00B9\u0088\u00E8\u00AE\u00A1\u00E7\u00AE\u0097\u00E6\u009C\u00BA\u00E7\u00AC\u0094\u00E8\u00AE\u00B0\u00E6\u009C\u00AC\u00E8\u00A8\u008E\u00E8\u00AB\u0096\u00E5\u008D\u0080\u00E6\u009C\u008D\u00E5\u008A\u00A1\u00E5\u0099\u00A8\u00E4\u00BA\u0092\u00E8\u0081\u0094\u00E7\u00BD\u0091\u00E6\u0088\u00BF\u00E5\u009C\u00B0\u00E4\u00BA\u00A7\u00E4\u00BF\u00B1\u00E4\u00B9\u0090\u00E9\u0083\u00A8\u00E5\u0087\u00BA\u00E7\u0089\u0088\u00E7\u00A4\u00BE\u00E6\u008E\u0092\u00E8\u00A1\u008C\u00E6\u00A6\u009C\u00E9\u0083\u00A8\u00E8\u0090\u00BD\u00E6\u00A0\u00BC\u00E8\u00BF\u009B\u00E4\u00B8\u0080\u00E6\u00AD\u00A5\u00E6\u0094\u00AF\u00E4\u00BB\u0098\u00E5\u00AE\u009D\u00E9\u00AA\u008C\u00E8\u00AF\u0081\u00E7\u00A0\u0081\u00E5\u00A7\u0094\u00E5\u0091\u0098\u00E4\u00BC\u009A\u00E6\u0095\u00B0\u00E6\u008D\u00AE\u00E5\u00BA\u0093\u00E6\u00B6\u0088\u00E8\u00B4\u00B9\u00E8\u0080\u0085\u00E5\u008A\u009E\u00E5\u0085\u00AC\u00E5\u00AE\u00A4\u00E8\u00AE\u00A8\u00E8\u00AE\u00BA\u00E5\u008C\u00BA\u00E6\u00B7\u00B1\u00E5\u009C\u00B3\u00E5\u00B8\u0082\u00E6\u0092\u00AD\u00E6\u0094\u00BE\u00E5\u0099\u00A8\u00E5\u008C\u0097\u00E4\u00BA\u00AC\u00E5\u00B8\u0082\u00E5\u00A4\u00A7\u00E5\u00AD\u00A6\u00E7\u0094\u009F\u00E8\u00B6\u008A\u00E6\u009D\u00A5\u00E8\u00B6\u008A\u00E7\u00AE\u00A1\u00E7\u0090\u0086\u00E5\u0091\u0098\u00E4\u00BF\u00A1\u00E6\u0081\u00AF\u00E7\u00BD\u0091serviciosart\u00C3\u00ADculoargentinabarcelonacualquierpublicadoproductospol\u00C3\u00ADticarespuestawikipediasiguienteb\u00C3\u00BAsquedacomunidadseguridadprincipalpreguntascontenidorespondervenezuelaproblemasdiciembrerelaci\u00C3\u00B3nnoviembresimilaresproyectosprogramasinstitutoactividadencuentraeconom\u00C3\u00ADaim\u00C3\u00A1genescontactardescargarnecesarioatenci\u00C3\u00B3ntel\u00C3\u00A9fonocomisi\u00C3\u00B3ncancionescapacidadencontraran\u00C3\u00A1lisisfavoritost\u00C3\u00A9rminosprovinciaetiquetaselementosfuncionesresultadocar\u00C3\u00A1cterpropiedadprincipionecesidadmunicipalcreaci\u00C3\u00B3ndescargaspresenciacomercialopinionesejercicioeditorialsalamancagonz\u00C3\u00A1lezdocumentopel\u00C3\u00ADcularecientesgeneralestarragonapr\u00C3\u00A1cticanovedadespropuestapacientest\u00C3\u00A9cnicasobjetivoscontactos\u00E0\u00A4\u00AE\u00E0\u00A5\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u00B2\u00E0\u00A4\u00BF\u00E0\u00A4\u008F\u00E0\u00A4\u00B9\u00E0\u00A5\u0088\u00E0\u00A4\u0082\u00E0\u00A4\u0097\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A4\u00BE\u00E0\u00A4\u00A5\u00E0\u00A4\u008F\u00E0\u00A4\u00B5\u00E0\u00A4\u0082\u00E0\u00A4\u00B0\u00E0\u00A4\u00B9\u00E0\u00A5\u0087\u00E0\u00A4\u0095\u00E0\u00A5\u008B\u00E0\u00A4\u0088\u00E0\u00A4\u0095\u00E0\u00A5\u0081\u00E0\u00A4\u009B\u00E0\u00A4\u00B0\u00E0\u00A4\u00B9\u00E0\u00A4\u00BE\u00E0\u00A4\u00AC\u00E0\u00A4\u00BE\u00E0\u00A4\u00A6\u00E0\u00A4\u0095\u00E0\u00A4\u00B9\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A4\u00AD\u00E0\u00A5\u0080\u00E0\u00A4\u00B9\u00E0\u00A5\u0081\u00E0\u00A4\u008F\u00E0\u00A4\u00B0\u00E0\u00A4\u00B9\u00E0\u00A5\u0080\u00E0\u00A4\u00AE\u00E0\u00A5\u0088\u00E0\u00A4\u0082\u00E0\u00A4\u00A6\u00E0\u00A4\u00BF\u00E0\u00A4\u00A8\u00E0\u00A4\u00AC\u00E0\u00A4\u00BE\u00E0\u00A4\u00A4diplodocs\u00E0\u00A4\u00B8\u00E0\u00A4\u00AE\u00E0\u00A4\u00AF\u00E0\u00A4\u00B0\u00E0\u00A5\u0082\u00E0\u00A4\u00AA\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00AE\u00E0\u00A4\u00AA\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u00AB\u00E0\u00A4\u00BF\u00E0\u00A4\u00B0\u00E0\u00A4\u0094\u00E0\u00A4\u00B8\u00E0\u00A4\u00A4\u00E0\u00A4\u00A4\u00E0\u00A4\u00B0\u00E0\u00A4\u00B9\u00E0\u00A4\u00B2\u00E0\u00A5\u008B\u00E0\u00A4\u0097\u00E0\u00A4\u00B9\u00E0\u00A5\u0081\u00E0\u00A4\u0086\u00E0\u00A4\u00AC\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00A6\u00E0\u00A5\u0087\u00E0\u00A4\u00B6\u00E0\u00A4\u00B9\u00E0\u00A5\u0081\u00E0\u00A4\u0088\u00E0\u00A4\u0096\u00E0\u00A5\u0087\u00E0\u00A4\u00B2\u00E0\u00A4\u00AF\u00E0\u00A4\u00A6\u00E0\u00A4\u00BF\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00AE\u00E0\u00A4\u00B5\u00E0\u00A5\u0087\u00E0\u00A4\u00AC\u00E0\u00A4\u00A4\u00E0\u00A5\u0080\u00E0\u00A4\u00A8\u00E0\u00A4\u00AC\u00E0\u00A5\u0080\u00E0\u00A4\u009A\u00E0\u00A4\u00AE\u00E0\u00A5\u008C\u00E0\u00A4\u00A4\u00E0\u00A4\u00B8\u00E0\u00A4\u00BE\u00E0\u00A4\u00B2\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u0096\u00E0\u00A4\u009C\u00E0\u00A5\u0089\u00E0\u00A4\u00AC\u00E0\u00A4\u00AE\u00E0\u00A4\u00A6\u00E0\u00A4\u00A6\u00E0\u00A4\u00A4\u00E0\u00A4\u00A5\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A4\u00B9\u00E0\u00A5\u0080\u00E0\u00A4\u00B6\u00E0\u00A4\u00B9\u00E0\u00A4\u00B0\u00E0\u00A4\u0085\u00E0\u00A4\u00B2\u00E0\u00A4\u0097\u00E0\u00A4\u0095\u00E0\u00A4\u00AD\u00E0\u00A5\u0080\u00E0\u00A4\u00A8\u00E0\u00A4\u0097\u00E0\u00A4\u00B0\u00E0\u00A4\u00AA\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u00A4\u00E0\u00A4\u0095\u00E0\u00A4\u00BF\u00E0\u00A4\u008F\u00E0\u00A4\u0089\u00E0\u00A4\u00B8\u00E0\u00A5\u0087\u00E0\u00A4\u0097\u00E0\u00A4\u00AF\u00E0\u00A5\u0080\u00E0\u00A4\u00B9\u00E0\u00A5\u0082\u00E0\u00A4\u0081\u00E0\u00A4\u0086\u00E0\u00A4\u0097\u00E0\u00A5\u0087\u00E0\u00A4\u009F\u00E0\u00A5\u0080\u00E0\u00A4\u00AE\u00E0\u00A4\u0096\u00E0\u00A5\u008B\u00E0\u00A4\u009C\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u0085\u00E0\u00A4\u00AD\u00E0\u00A5\u0080\u00E0\u00A4\u0097\u00E0\u00A4\u00AF\u00E0\u00A5\u0087\u00E0\u00A4\u00A4\u00E0\u00A5\u0081\u00E0\u00A4\u00AE\u00E0\u00A4\u00B5\u00E0\u00A5\u008B\u00E0\u00A4\u009F\u00E0\u00A4\u00A6\u00E0\u00A5\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u0085\u00E0\u00A4\u0097\u00E0\u00A4\u00B0\u00E0\u00A4\u0090\u00E0\u00A4\u00B8\u00E0\u00A5\u0087\u00E0\u00A4\u00AE\u00E0\u00A5\u0087\u00E0\u00A4\u00B2\u00E0\u00A4\u00B2\u00E0\u00A4\u0097\u00E0\u00A4\u00BE\u00E0\u00A4\u00B9\u00E0\u00A4\u00BE\u00E0\u00A4\u00B2\u00E0\u00A4\u008A\u00E0\u00A4\u00AA\u00E0\u00A4\u00B0\u00E0\u00A4\u009A\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u0090\u00E0\u00A4\u00B8\u00E0\u00A4\u00BE\u00E0\u00A4\u00A6\u00E0\u00A5\u0087\u00E0\u00A4\u00B0\u00E0\u00A4\u009C\u00E0\u00A4\u00BF\u00E0\u00A4\u00B8\u00E0\u00A4\u00A6\u00E0\u00A4\u00BF\u00E0\u00A4\u00B2\u00E0\u00A4\u00AC\u00E0\u00A4\u0082\u00E0\u00A4\u00A6\u00E0\u00A4\u00AC\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00B9\u00E0\u00A5\u0082\u00E0\u00A4\u0082\u00E0\u00A4\u00B2\u00E0\u00A4\u00BE\u00E0\u00A4\u0096\u00E0\u00A4\u009C\u00E0\u00A5\u0080\u00E0\u00A4\u00A4\u00E0\u00A4\u00AC\u00E0\u00A4\u009F\u00E0\u00A4\u00A8\u00E0\u00A4\u00AE\u00E0\u00A4\u00BF\u00E0\u00A4\u00B2\u00E0\u00A4\u0087\u00E0\u00A4\u00B8\u00E0\u00A5\u0087\u00E0\u00A4\u0086\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u00A8\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u0095\u00E0\u00A5\u0081\u00E0\u00A4\u00B2\u00E0\u00A4\u00B2\u00E0\u00A5\u0089\u00E0\u00A4\u0097\u00E0\u00A4\u00AD\u00E0\u00A4\u00BE\u00E0\u00A4\u0097\u00E0\u00A4\u00B0\u00E0\u00A5\u0087\u00E0\u00A4\u00B2\u00E0\u00A4\u009C\u00E0\u00A4\u0097\u00E0\u00A4\u00B9\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u00AE\u00E0\u00A4\u00B2\u00E0\u00A4\u0097\u00E0\u00A5\u0087\u00E0\u00A4\u00AA\u00E0\u00A5\u0087\u00E0\u00A4\u009C\u00E0\u00A4\u00B9\u00E0\u00A4\u00BE\u00E0\u00A4\u00A5\u00E0\u00A4\u0087\u00E0\u00A4\u00B8\u00E0\u00A5\u0080\u00E0\u00A4\u00B8\u00E0\u00A4\u00B9\u00E0\u00A5\u0080\u00E0\u00A4\u0095\u00E0\u00A4\u00B2\u00E0\u00A4\u00BE\u00E0\u00A4\u00A0\u00E0\u00A5\u0080\u00E0\u00A4\u0095\u00E0\u00A4\u00B9\u00E0\u00A4\u00BE\u00E0\u00A4\u0081\u00E0\u00A4\u00A6\u00E0\u00A5\u0082\u00E0\u00A4\u00B0\u00E0\u00A4\u00A4\u00E0\u00A4\u00B9\u00E0\u00A4\u00A4\u00E0\u00A4\u00B8\u00E0\u00A4\u00BE\u00E0\u00A4\u00A4\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00A6\u00E0\u00A4\u0086\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00AA\u00E0\u00A4\u00BE\u00E0\u00A4\u0095\u00E0\u00A4\u0095\u00E0\u00A5\u008C\u00E0\u00A4\u00A8\u00E0\u00A4\u00B6\u00E0\u00A4\u00BE\u00E0\u00A4\u00AE\u00E0\u00A4\u00A6\u00E0\u00A5\u0087\u00E0\u00A4\u0096\u00E0\u00A4\u00AF\u00E0\u00A4\u00B9\u00E0\u00A5\u0080\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u00AF\u00E0\u00A4\u0096\u00E0\u00A5\u0081\u00E0\u00A4\u00A6\u00E0\u00A4\u00B2\u00E0\u00A4\u0097\u00E0\u00A5\u0080categoriesexperience</title>\r\nCopyright javascriptconditionseverything<p class=\"technologybackground<a class=\"management&copy; 201javaScriptcharactersbreadcrumbthemselveshorizontalgovernmentCaliforniaactivitiesdiscoveredNavigationtransitionconnectionnavigationappearance</title><mcheckbox\" techniquesprotectionapparentlyas well asunt', 'UA-resolutionoperationstelevisiontranslatedWashingtonnavigator. = window.impression&lt;br&gt;literaturepopulationbgcolor=\"#especially content=\"productionnewsletterpropertiesdefinitionleadershipTechnologyParliamentcomparisonul class=\".indexOf(\"conclusiondiscussioncomponentsbiologicalRevolution_containerunderstoodnoscript><permissioneach otheratmosphere onfocus=\"<form id=\"processingthis.valuegenerationConferencesubsequentwell-knownvariationsreputationphenomenondisciplinelogo.png\" (document,boundariesexpressionsettlementBackgroundout of theenterprise(\"https:\" unescape(\"password\" democratic<a href=\"/wrapper\">\nmembershiplinguisticpx;paddingphilosophyassistanceuniversityfacilitiesrecognizedpreferenceif (typeofmaintainedvocabularyhypothesis.submit();&amp;nbsp;annotationbehind theFoundationpublisher\"assumptionintroducedcorruptionscientistsexplicitlyinstead ofdimensions onClick=\"considereddepartmentoccupationsoon afterinvestmentpronouncedidentifiedexperimentManagementgeographic\" height=\"link rel=\".replace(/depressionconferencepunishmenteliminatedresistanceadaptationoppositionwell knownsupplementdeterminedh1 class=\"0px;marginmechanicalstatisticscelebratedGovernment\n\nDuring tdevelopersartificialequivalentoriginatedCommissionattachment<span id=\"there wereNederlandsbeyond theregisteredjournalistfrequentlyall of thelang=\"en\" </style>\r\nabsolute; supportingextremely mainstream</strong> popularityemployment</table>\r\n colspan=\"</form>\n conversionabout the </p></div>integrated\" lang=\"enPortuguesesubstituteindividualimpossiblemultimediaalmost allpx solid #apart fromsubject toin Englishcriticizedexcept forguidelinesoriginallyremarkablethe secondh2 class=\"<a title=\"(includingparametersprohibited= \"http://dictionaryperceptionrevolutionfoundationpx;height:successfulsupportersmillenniumhis fatherthe &quot;no-repeat;commercialindustrialencouragedamount of unofficialefficiencyReferencescoordinatedisclaimerexpeditiondevelopingcalculatedsimplifiedlegitimatesubstring(0\" class=\"completelyillustratefive yearsinstrumentPublishing1\" class=\"psychologyconfidencenumber of absence offocused onjoined thestructurespreviously></iframe>once againbut ratherimmigrantsof course,a group ofLiteratureUnlike the</a>&nbsp;\nfunction it was theConventionautomobileProtestantaggressiveafter the Similarly,\" /></div>collection\r\nfunctionvisibilitythe use ofvolunteersattractionunder the threatened*<![CDATA[importancein generalthe latter</form>\n</.indexOf('i = 0; i <differencedevoted totraditionssearch forultimatelytournamentattributesso-called }\n</style>evaluationemphasizedaccessible</section>successionalong withMeanwhile,industries</a><br />has becomeaspects ofTelevisionsufficientbasketballboth sidescontinuingan article<img alt=\"adventureshis mothermanchesterprinciplesparticularcommentaryeffects ofdecided to\"><strong>publishersJournal ofdifficultyfacilitateacceptablestyle.css\"\tfunction innovation>Copyrightsituationswould havebusinessesDictionarystatementsoften usedpersistentin Januarycomprising</title>\n\tdiplomaticcontainingperformingextensionsmay not beconcept of onclick=\"It is alsofinancial making theLuxembourgadditionalare calledengaged in\"script\");but it waselectroniconsubmit=\"\n<!-- End electricalofficiallysuggestiontop of theunlike theAustralianOriginallyreferences\n</head>\r\nrecognisedinitializelimited toAlexandriaretirementAdventuresfour years\n\n&lt;!-- increasingdecorationh3 class=\"origins ofobligationregulationclassified(function(advantagesbeing the historians<base hrefrepeatedlywilling tocomparabledesignatednominationfunctionalinside therevelationend of thes for the authorizedrefused totake placeautonomouscompromisepolitical restauranttwo of theFebruary 2quality ofswfobject.understandnearly allwritten byinterviews\" width=\"1withdrawalfloat:leftis usuallycandidatesnewspapersmysteriousDepartmentbest knownparliamentsuppressedconvenientremembereddifferent systematichas led topropagandacontrolledinfluencesceremonialproclaimedProtectionli class=\"Scientificclass=\"no-trademarksmore than widespreadLiberationtook placeday of theas long asimprisonedAdditional\n<head>\n<mLaboratoryNovember 2exceptionsIndustrialvariety offloat: lefDuring theassessmenthave been deals withStatisticsoccurrence/ul></div>clearfix\">the publicmany yearswhich wereover time,synonymouscontent\">\npresumablyhis familyuserAgent.unexpectedincluding challengeda minorityundefined\"belongs totaken fromin Octoberposition: said to bereligious Federation rowspan=\"only a fewmeant thatled to the-->\r\n<div <fieldset>Archbishop class=\"nobeing usedapproachesprivilegesnoscript>\nresults inmay be theEaster eggmechanismsreasonablePopulationCollectionselected\">noscript>\r/index.phparrival of-jssdk'));managed toincompletecasualtiescompletionChristiansSeptember arithmeticproceduresmight haveProductionit appearsPhilosophyfriendshipleading togiving thetoward theguaranteeddocumentedcolor:#000video gamecommissionreflectingchange theassociatedsans-serifonkeypress; padding:He was theunderlyingtypically , and the srcElementsuccessivesince the should be networkingaccountinguse of thelower thanshows that</span>\n\t\tcomplaintscontinuousquantitiesastronomerhe did notdue to itsapplied toan averageefforts tothe futureattempt toTherefore,capabilityRepublicanwas formedElectronickilometerschallengespublishingthe formerindigenousdirectionssubsidiaryconspiracydetails ofand in theaffordablesubstancesreason forconventionitemtype=\"absolutelysupposedlyremained aattractivetravellingseparatelyfocuses onelementaryapplicablefound thatstylesheetmanuscriptstands for no-repeat(sometimesCommercialin Americaundertakenquarter ofan examplepersonallyindex.php?</button>\npercentagebest-knowncreating a\" dir=\"ltrLieutenant\n<div id=\"they wouldability ofmade up ofnoted thatclear thatargue thatto anotherchildren'spurpose offormulatedbased uponthe regionsubject ofpassengerspossession.\n\nIn the Before theafterwardscurrently across thescientificcommunity.capitalismin Germanyright-wingthe systemSociety ofpoliticiandirection:went on toremoval of New York apartmentsindicationduring theunless thehistoricalhad been adefinitiveingredientattendanceCenter forprominencereadyStatestrategiesbut in theas part ofconstituteclaim thatlaboratorycompatiblefailure of, such as began withusing the to providefeature offrom which/\" class=\"geologicalseveral ofdeliberateimportant holds thating&quot; valign=topthe Germanoutside ofnegotiatedhis careerseparationid=\"searchwas calledthe fourthrecreationother thanpreventionwhile the education,connectingaccuratelywere builtwas killedagreementsmuch more Due to thewidth: 100some otherKingdom ofthe entirefamous forto connectobjectivesthe Frenchpeople andfeatured\">is said tostructuralreferendummost oftena separate->\n<div id Official worldwide.aria-labelthe planetand it wasd\" value=\"looking atbeneficialare in themonitoringreportedlythe modernworking onallowed towhere the innovative</a></div>soundtracksearchFormtend to beinput id=\"opening ofrestrictedadopted byaddressingtheologianmethods ofvariant ofChristian very largeautomotiveby far therange frompursuit offollow thebrought toin Englandagree thataccused ofcomes frompreventingdiv style=his or hertremendousfreedom ofconcerning0 1em 1em;Basketball/style.cssan earliereven after/\" title=\".com/indextaking thepittsburghcontent\">\r<script>(fturned outhaving the</span>\r\n occasionalbecause itstarted tophysically></div>\n created byCurrently, bgcolor=\"tabindex=\"disastrousAnalytics also has a><div id=\"</style>\n<called forsinger and.src = \"//violationsthis pointconstantlyis locatedrecordingsd from thenederlandsportugu\u00C3\u00AAs\u00D7\u00A2\u00D7\u0091\u00D7\u00A8\u00D7\u0099\u00D7\u00AA\u00D9\u0081\u00D8\u00A7\u00D8\u00B1\u00D8\u00B3\u00DB\u008Cdesarrollocomentarioeducaci\u00C3\u00B3nseptiembreregistradodirecci\u00C3\u00B3nubicaci\u00C3\u00B3npublicidadrespuestasresultadosimportantereservadosart\u00C3\u00ADculosdiferentessiguientesrep\u00C3\u00BAblicasituaci\u00C3\u00B3nministerioprivacidaddirectorioformaci\u00C3\u00B3npoblaci\u00C3\u00B3npresidentecontenidosaccesoriostechnoratipersonalescategor\u00C3\u00ADaespecialesdisponibleactualidadreferenciavalladolidbibliotecarelacionescalendariopol\u00C3\u00ADticasanterioresdocumentosnaturalezamaterialesdiferenciaecon\u00C3\u00B3micatransporterodr\u00C3\u00ADguezparticiparencuentrandiscusi\u00C3\u00B3nestructurafundaci\u00C3\u00B3nfrecuentespermanentetotalmente\u00D0\u00BC\u00D0\u00BE\u00D0\u00B6\u00D0\u00BD\u00D0\u00BE\u00D0\u00B1\u00D1\u0083\u00D0\u00B4\u00D0\u00B5\u00D1\u0082\u00D0\u00BC\u00D0\u00BE\u00D0\u00B6\u00D0\u00B5\u00D1\u0082\u00D0\u00B2\u00D1\u0080\u00D0\u00B5\u00D0\u00BC\u00D1\u008F\u00D1\u0082\u00D0\u00B0\u00D0\u00BA\u00D0\u00B6\u00D0\u00B5\u00D1\u0087\u00D1\u0082\u00D0\u00BE\u00D0\u00B1\u00D1\u008B\u00D0\u00B1\u00D0\u00BE\u00D0\u00BB\u00D0\u00B5\u00D0\u00B5\u00D0\u00BE\u00D1\u0087\u00D0\u00B5\u00D0\u00BD\u00D1\u008C\u00D1\u008D\u00D1\u0082\u00D0\u00BE\u00D0\u00B3\u00D0\u00BE\u00D0\u00BA\u00D0\u00BE\u00D0\u00B3\u00D0\u00B4\u00D0\u00B0\u00D0\u00BF\u00D0\u00BE\u00D1\u0081\u00D0\u00BB\u00D0\u00B5\u00D0\u00B2\u00D1\u0081\u00D0\u00B5\u00D0\u00B3\u00D0\u00BE\u00D1\u0081\u00D0\u00B0\u00D0\u00B9\u00D1\u0082\u00D0\u00B5\u00D1\u0087\u00D0\u00B5\u00D1\u0080\u00D0\u00B5\u00D0\u00B7\u00D0\u00BC\u00D0\u00BE\u00D0\u00B3\u00D1\u0083\u00D1\u0082\u00D1\u0081\u00D0\u00B0\u00D0\u00B9\u00D1\u0082\u00D0\u00B0\u00D0\u00B6\u00D0\u00B8\u00D0\u00B7\u00D0\u00BD\u00D0\u00B8\u00D0\u00BC\u00D0\u00B5\u00D0\u00B6\u00D0\u00B4\u00D1\u0083\u00D0\u00B1\u00D1\u0083\u00D0\u00B4\u00D1\u0083\u00D1\u0082\u00D0\u009F\u00D0\u00BE\u00D0\u00B8\u00D1\u0081\u00D0\u00BA\u00D0\u00B7\u00D0\u00B4\u00D0\u00B5\u00D1\u0081\u00D1\u008C\u00D0\u00B2\u00D0\u00B8\u00D0\u00B4\u00D0\u00B5\u00D0\u00BE\u00D1\u0081\u00D0\u00B2\u00D1\u008F\u00D0\u00B7\u00D0\u00B8\u00D0\u00BD\u00D1\u0083\u00D0\u00B6\u00D0\u00BD\u00D0\u00BE\u00D1\u0081\u00D0\u00B2\u00D0\u00BE\u00D0\u00B5\u00D0\u00B9\u00D0\u00BB\u00D1\u008E\u00D0\u00B4\u00D0\u00B5\u00D0\u00B9\u00D0\u00BF\u00D0\u00BE\u00D1\u0080\u00D0\u00BD\u00D0\u00BE\u00D0\u00BC\u00D0\u00BD\u00D0\u00BE\u00D0\u00B3\u00D0\u00BE\u00D0\u00B4\u00D0\u00B5\u00D1\u0082\u00D0\u00B5\u00D0\u00B9\u00D1\u0081\u00D0\u00B2\u00D0\u00BE\u00D0\u00B8\u00D1\u0085\u00D0\u00BF\u00D1\u0080\u00D0\u00B0\u00D0\u00B2\u00D0\u00B0\u00D1\u0082\u00D0\u00B0\u00D0\u00BA\u00D0\u00BE\u00D0\u00B9\u00D0\u00BC\u00D0\u00B5\u00D1\u0081\u00D1\u0082\u00D0\u00BE\u00D0\u00B8\u00D0\u00BC\u00D0\u00B5\u00D0\u00B5\u00D1\u0082\u00D0\u00B6\u00D0\u00B8\u00D0\u00B7\u00D0\u00BD\u00D1\u008C\u00D0\u00BE\u00D0\u00B4\u00D0\u00BD\u00D0\u00BE\u00D0\u00B9\u00D0\u00BB\u00D1\u0083\u00D1\u0087\u00D1\u0088\u00D0\u00B5\u00D0\u00BF\u00D0\u00B5\u00D1\u0080\u00D0\u00B5\u00D0\u00B4\u00D1\u0087\u00D0\u00B0\u00D1\u0081\u00D1\u0082\u00D0\u00B8\u00D1\u0087\u00D0\u00B0\u00D1\u0081\u00D1\u0082\u00D1\u008C\u00D1\u0080\u00D0\u00B0\u00D0\u00B1\u00D0\u00BE\u00D1\u0082\u00D0\u00BD\u00D0\u00BE\u00D0\u00B2\u00D1\u008B\u00D1\u0085\u00D0\u00BF\u00D1\u0080\u00D0\u00B0\u00D0\u00B2\u00D0\u00BE\u00D1\u0081\u00D0\u00BE\u00D0\u00B1\u00D0\u00BE\u00D0\u00B9\u00D0\u00BF\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D0\u00BC\u00D0\u00BC\u00D0\u00B5\u00D0\u00BD\u00D0\u00B5\u00D0\u00B5\u00D1\u0087\u00D0\u00B8\u00D1\u0081\u00D0\u00BB\u00D0\u00B5\u00D0\u00BD\u00D0\u00BE\u00D0\u00B2\u00D1\u008B\u00D0\u00B5\u00D1\u0083\u00D1\u0081\u00D0\u00BB\u00D1\u0083\u00D0\u00B3\u00D0\u00BE\u00D0\u00BA\u00D0\u00BE\u00D0\u00BB\u00D0\u00BE\u00D0\u00BD\u00D0\u00B0\u00D0\u00B7\u00D0\u00B0\u00D0\u00B4\u00D1\u0082\u00D0\u00B0\u00D0\u00BA\u00D0\u00BE\u00D0\u00B5\u00D1\u0082\u00D0\u00BE\u00D0\u00B3\u00D0\u00B4\u00D0\u00B0\u00D0\u00BF\u00D0\u00BE\u00D1\u0087\u00D1\u0082\u00D0\u00B8\u00D0\u009F\u00D0\u00BE\u00D1\u0081\u00D0\u00BB\u00D0\u00B5\u00D1\u0082\u00D0\u00B0\u00D0\u00BA\u00D0\u00B8\u00D0\u00B5\u00D0\u00BD\u00D0\u00BE\u00D0\u00B2\u00D1\u008B\u00D0\u00B9\u00D1\u0081\u00D1\u0082\u00D0\u00BE\u00D0\u00B8\u00D1\u0082\u00D1\u0082\u00D0\u00B0\u00D0\u00BA\u00D0\u00B8\u00D1\u0085\u00D1\u0081\u00D1\u0080\u00D0\u00B0\u00D0\u00B7\u00D1\u0083\u00D0\u00A1\u00D0\u00B0\u00D0\u00BD\u00D0\u00BA\u00D1\u0082\u00D1\u0084\u00D0\u00BE\u00D1\u0080\u00D1\u0083\u00D0\u00BC\u00D0\u009A\u00D0\u00BE\u00D0\u00B3\u00D0\u00B4\u00D0\u00B0\u00D0\u00BA\u00D0\u00BD\u00D0\u00B8\u00D0\u00B3\u00D0\u00B8\u00D1\u0081\u00D0\u00BB\u00D0\u00BE\u00D0\u00B2\u00D0\u00B0\u00D0\u00BD\u00D0\u00B0\u00D1\u0088\u00D0\u00B5\u00D0\u00B9\u00D0\u00BD\u00D0\u00B0\u00D0\u00B9\u00D1\u0082\u00D0\u00B8\u00D1\u0081\u00D0\u00B2\u00D0\u00BE\u00D0\u00B8\u00D0\u00BC\u00D1\u0081\u00D0\u00B2\u00D1\u008F\u00D0\u00B7\u00D1\u008C\u00D0\u00BB\u00D1\u008E\u00D0\u00B1\u00D0\u00BE\u00D0\u00B9\u00D1\u0087\u00D0\u00B0\u00D1\u0081\u00D1\u0082\u00D0\u00BE\u00D1\u0081\u00D1\u0080\u00D0\u00B5\u00D0\u00B4\u00D0\u00B8\u00D0\u009A\u00D1\u0080\u00D0\u00BE\u00D0\u00BC\u00D0\u00B5\u00D0\u00A4\u00D0\u00BE\u00D1\u0080\u00D1\u0083\u00D0\u00BC\u00D1\u0080\u00D1\u008B\u00D0\u00BD\u00D0\u00BA\u00D0\u00B5\u00D1\u0081\u00D1\u0082\u00D0\u00B0\u00D0\u00BB\u00D0\u00B8\u00D0\u00BF\u00D0\u00BE\u00D0\u00B8\u00D1\u0081\u00D0\u00BA\u00D1\u0082\u00D1\u008B\u00D1\u0081\u00D1\u008F\u00D1\u0087\u00D0\u00BC\u00D0\u00B5\u00D1\u0081\u00D1\u008F\u00D1\u0086\u00D1\u0086\u00D0\u00B5\u00D0\u00BD\u00D1\u0082\u00D1\u0080\u00D1\u0082\u00D1\u0080\u00D1\u0083\u00D0\u00B4\u00D0\u00B0\u00D1\u0081\u00D0\u00B0\u00D0\u00BC\u00D1\u008B\u00D1\u0085\u00D1\u0080\u00D1\u008B\u00D0\u00BD\u00D0\u00BA\u00D0\u00B0\u00D0\u009D\u00D0\u00BE\u00D0\u00B2\u00D1\u008B\u00D0\u00B9\u00D1\u0087\u00D0\u00B0\u00D1\u0081\u00D0\u00BE\u00D0\u00B2\u00D0\u00BC\u00D0\u00B5\u00D1\u0081\u00D1\u0082\u00D0\u00B0\u00D1\u0084\u00D0\u00B8\u00D0\u00BB\u00D1\u008C\u00D0\u00BC\u00D0\u00BC\u00D0\u00B0\u00D1\u0080\u00D1\u0082\u00D0\u00B0\u00D1\u0081\u00D1\u0082\u00D1\u0080\u00D0\u00B0\u00D0\u00BD\u00D0\u00BC\u00D0\u00B5\u00D1\u0081\u00D1\u0082\u00D0\u00B5\u00D1\u0082\u00D0\u00B5\u00D0\u00BA\u00D1\u0081\u00D1\u0082\u00D0\u00BD\u00D0\u00B0\u00D1\u0088\u00D0\u00B8\u00D1\u0085\u00D0\u00BC\u00D0\u00B8\u00D0\u00BD\u00D1\u0083\u00D1\u0082\u00D0\u00B8\u00D0\u00BC\u00D0\u00B5\u00D0\u00BD\u00D0\u00B8\u00D0\u00B8\u00D0\u00BC\u00D0\u00B5\u00D1\u008E\u00D1\u0082\u00D0\u00BD\u00D0\u00BE\u00D0\u00BC\u00D0\u00B5\u00D1\u0080\u00D0\u00B3\u00D0\u00BE\u00D1\u0080\u00D0\u00BE\u00D0\u00B4\u00D1\u0081\u00D0\u00B0\u00D0\u00BC\u00D0\u00BE\u00D0\u00BC\u00D1\u008D\u00D1\u0082\u00D0\u00BE\u00D0\u00BC\u00D1\u0083\u00D0\u00BA\u00D0\u00BE\u00D0\u00BD\u00D1\u0086\u00D0\u00B5\u00D1\u0081\u00D0\u00B2\u00D0\u00BE\u00D0\u00B5\u00D0\u00BC\u00D0\u00BA\u00D0\u00B0\u00D0\u00BA\u00D0\u00BE\u00D0\u00B9\u00D0\u0090\u00D1\u0080\u00D1\u0085\u00D0\u00B8\u00D0\u00B2\u00D9\u0085\u00D9\u0086\u00D8\u00AA\u00D8\u00AF\u00D9\u0089\u00D8\u00A5\u00D8\u00B1\u00D8\u00B3\u00D8\u00A7\u00D9\u0084\u00D8\u00B1\u00D8\u00B3\u00D8\u00A7\u00D9\u0084\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D8\u00A7\u00D9\u0085\u00D9\u0083\u00D8\u00AA\u00D8\u00A8\u00D9\u0087\u00D8\u00A7\u00D8\u00A8\u00D8\u00B1\u00D8\u00A7\u00D9\u0085\u00D8\u00AC\u00D8\u00A7\u00D9\u0084\u00D9\u008A\u00D9\u0088\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D8\u00B5\u00D9\u0088\u00D8\u00B1\u00D8\u00AC\u00D8\u00AF\u00D9\u008A\u00D8\u00AF\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D8\u00B6\u00D9\u0088\u00D8\u00A5\u00D8\u00B6\u00D8\u00A7\u00D9\u0081\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D9\u0082\u00D8\u00B3\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D8\u00A7\u00D8\u00A8\u00D8\u00AA\u00D8\u00AD\u00D9\u0085\u00D9\u008A\u00D9\u0084\u00D9\u0085\u00D9\u0084\u00D9\u0081\u00D8\u00A7\u00D8\u00AA\u00D9\u0085\u00D9\u0084\u00D8\u00AA\u00D9\u0082\u00D9\u0089\u00D8\u00AA\u00D8\u00B9\u00D8\u00AF\u00D9\u008A\u00D9\u0084\u00D8\u00A7\u00D9\u0084\u00D8\u00B4\u00D8\u00B9\u00D8\u00B1\u00D8\u00A3\u00D8\u00AE\u00D8\u00A8\u00D8\u00A7\u00D8\u00B1\u00D8\u00AA\u00D8\u00B7\u00D9\u0088\u00D9\u008A\u00D8\u00B1\u00D8\u00B9\u00D9\u0084\u00D9\u008A\u00D9\u0083\u00D9\u0085\u00D8\u00A5\u00D8\u00B1\u00D9\u0081\u00D8\u00A7\u00D9\u0082\u00D8\u00B7\u00D9\u0084\u00D8\u00A8\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D9\u0084\u00D8\u00BA\u00D8\u00A9\u00D8\u00AA\u00D8\u00B1\u00D8\u00AA\u00D9\u008A\u00D8\u00A8\u00D8\u00A7\u00D9\u0084\u00D9\u0086\u00D8\u00A7\u00D8\u00B3\u00D8\u00A7\u00D9\u0084\u00D8\u00B4\u00D9\u008A\u00D8\u00AE\u00D9\u0085\u00D9\u0086\u00D8\u00AA\u00D8\u00AF\u00D9\u008A\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D8\u00B1\u00D8\u00A8\u00D8\u00A7\u00D9\u0084\u00D9\u0082\u00D8\u00B5\u00D8\u00B5\u00D8\u00A7\u00D9\u0081\u00D9\u0084\u00D8\u00A7\u00D9\u0085\u00D8\u00B9\u00D9\u0084\u00D9\u008A\u00D9\u0087\u00D8\u00A7\u00D8\u00AA\u00D8\u00AD\u00D8\u00AF\u00D9\u008A\u00D8\u00AB\u00D8\u00A7\u00D9\u0084\u00D9\u0084\u00D9\u0087\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D9\u0085\u00D9\u0084\u00D9\u0085\u00D9\u0083\u00D8\u00AA\u00D8\u00A8\u00D8\u00A9\u00D9\u008A\u00D9\u0085\u00D9\u0083\u00D9\u0086\u00D9\u0083\u00D8\u00A7\u00D9\u0084\u00D8\u00B7\u00D9\u0081\u00D9\u0084\u00D9\u0081\u00D9\u008A\u00D8\u00AF\u00D9\u008A\u00D9\u0088\u00D8\u00A5\u00D8\u00AF\u00D8\u00A7\u00D8\u00B1\u00D8\u00A9\u00D8\u00AA\u00D8\u00A7\u00D8\u00B1\u00D9\u008A\u00D8\u00AE\u00D8\u00A7\u00D9\u0084\u00D8\u00B5\u00D8\u00AD\u00D8\u00A9\u00D8\u00AA\u00D8\u00B3\u00D8\u00AC\u00D9\u008A\u00D9\u0084\u00D8\u00A7\u00D9\u0084\u00D9\u0088\u00D9\u0082\u00D8\u00AA\u00D8\u00B9\u00D9\u0086\u00D8\u00AF\u00D9\u0085\u00D8\u00A7\u00D9\u0085\u00D8\u00AF\u00D9\u008A\u00D9\u0086\u00D8\u00A9\u00D8\u00AA\u00D8\u00B5\u00D9\u0085\u00D9\u008A\u00D9\u0085\u00D8\u00A3\u00D8\u00B1\u00D8\u00B4\u00D9\u008A\u00D9\u0081\u00D8\u00A7\u00D9\u0084\u00D8\u00B0\u00D9\u008A\u00D9\u0086\u00D8\u00B9\u00D8\u00B1\u00D8\u00A8\u00D9\u008A\u00D8\u00A9\u00D8\u00A8\u00D9\u0088\u00D8\u00A7\u00D8\u00A8\u00D8\u00A9\u00D8\u00A3\u00D9\u0084\u00D8\u00B9\u00D8\u00A7\u00D8\u00A8\u00D8\u00A7\u00D9\u0084\u00D8\u00B3\u00D9\u0081\u00D8\u00B1\u00D9\u0085\u00D8\u00B4\u00D8\u00A7\u00D9\u0083\u00D9\u0084\u00D8\u00AA\u00D8\u00B9\u00D8\u00A7\u00D9\u0084\u00D9\u0089\u00D8\u00A7\u00D9\u0084\u00D8\u00A3\u00D9\u0088\u00D9\u0084\u00D8\u00A7\u00D9\u0084\u00D8\u00B3\u00D9\u0086\u00D8\u00A9\u00D8\u00AC\u00D8\u00A7\u00D9\u0085\u00D8\u00B9\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00B5\u00D8\u00AD\u00D9\u0081\u00D8\u00A7\u00D9\u0084\u00D8\u00AF\u00D9\u008A\u00D9\u0086\u00D9\u0083\u00D9\u0084\u00D9\u0085\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D8\u00AE\u00D8\u00A7\u00D8\u00B5\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D9\u0084\u00D9\u0081\u00D8\u00A3\u00D8\u00B9\u00D8\u00B6\u00D8\u00A7\u00D8\u00A1\u00D9\u0083\u00D8\u00AA\u00D8\u00A7\u00D8\u00A8\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00AE\u00D9\u008A\u00D8\u00B1\u00D8\u00B1\u00D8\u00B3\u00D8\u00A7\u00D8\u00A6\u00D9\u0084\u00D8\u00A7\u00D9\u0084\u00D9\u0082\u00D9\u0084\u00D8\u00A8\u00D8\u00A7\u00D9\u0084\u00D8\u00A3\u00D8\u00AF\u00D8\u00A8\u00D9\u0085\u00D9\u0082\u00D8\u00A7\u00D8\u00B7\u00D8\u00B9\u00D9\u0085\u00D8\u00B1\u00D8\u00A7\u00D8\u00B3\u00D9\u0084\u00D9\u0085\u00D9\u0086\u00D8\u00B7\u00D9\u0082\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D9\u0083\u00D8\u00AA\u00D8\u00A8\u00D8\u00A7\u00D9\u0084\u00D8\u00B1\u00D8\u00AC\u00D9\u0084\u00D8\u00A7\u00D8\u00B4\u00D8\u00AA\u00D8\u00B1\u00D9\u0083\u00D8\u00A7\u00D9\u0084\u00D9\u0082\u00D8\u00AF\u00D9\u0085\u00D9\u008A\u00D8\u00B9\u00D8\u00B7\u00D9\u008A\u00D9\u0083sByTagName(.jpg\" alt=\"1px solid #.gif\" alt=\"transparentinformationapplication\" onclick=\"establishedadvertising.png\" alt=\"environmentperformanceappropriate&amp;mdash;immediately</strong></rather thantemperaturedevelopmentcompetitionplaceholdervisibility:copyright\">0\" height=\"even thoughreplacementdestinationCorporation<ul class=\"AssociationindividualsperspectivesetTimeout(url(http://mathematicsmargin-top:eventually description) no-repeatcollections.JPG|thumb|participate/head><bodyfloat:left;<li class=\"hundreds of\n\nHowever, compositionclear:both;cooperationwithin the label for=\"border-top:New Zealandrecommendedphotographyinteresting&lt;sup&gt;controversyNetherlandsalternativemaxlength=\"switzerlandDevelopmentessentially\n\nAlthough </textarea>thunderbirdrepresented&amp;ndash;speculationcommunitieslegislationelectronics\n\t<div id=\"illustratedengineeringterritoriesauthoritiesdistributed6\" height=\"sans-serif;capable of disappearedinteractivelooking forit would beAfghanistanwas createdMath.floor(surroundingcan also beobservationmaintenanceencountered<h2 class=\"more recentit has beeninvasion of).getTime()fundamentalDespite the\"><div id=\"inspirationexaminationpreparationexplanation<input id=\"</a></span>versions ofinstrumentsbefore the = 'http://Descriptionrelatively .substring(each of theexperimentsinfluentialintegrationmany peopledue to the combinationdo not haveMiddle East<noscript><copyright\" perhaps theinstitutionin Decemberarrangementmost famouspersonalitycreation oflimitationsexclusivelysovereignty-content\">\n<td class=\"undergroundparallel todoctrine ofoccupied byterminologyRenaissancea number ofsupport forexplorationrecognitionpredecessor<img src=\"/<h1 class=\"publicationmay also bespecialized</fieldset>progressivemillions ofstates thatenforcementaround the one another.parentNodeagricultureAlternativeresearcherstowards theMost of themany other (especially<td width=\";width:100%independent<h3 class=\" onchange=\").addClass(interactionOne of the daughter ofaccessoriesbranches of\r\n<div id=\"the largestdeclarationregulationsInformationtranslationdocumentaryin order to\">\n<head>\n<\" height=\"1across the orientation);</script>implementedcan be seenthere was ademonstratecontainer\">connectionsthe Britishwas written!important;px; margin-followed byability to complicatedduring the immigrationalso called<h4 class=\"distinctionreplaced bygovernmentslocation ofin Novemberwhether the</p>\n</div>acquisitioncalled the persecutiondesignation{font-size:appeared ininvestigateexperiencedmost likelywidely useddiscussionspresence of (document.extensivelyIt has beenit does notcontrary toinhabitantsimprovementscholarshipconsumptioninstructionfor exampleone or morepx; paddingthe currenta series ofare usuallyrole in thepreviously derivativesevidence ofexperiencescolorschemestated thatcertificate</a></div>\n selected=\"high schoolresponse tocomfortableadoption ofthree yearsthe countryin Februaryso that thepeople who provided by<param nameaffected byin terms ofappointmentISO-8859-1\"was born inhistorical regarded asmeasurementis based on and other : function(significantcelebrationtransmitted/js/jquery.is known astheoretical tabindex=\"it could be<noscript>\nhaving been\r\n<head>\r\n< &quot;The compilationhe had beenproduced byphilosopherconstructedintended toamong othercompared toto say thatEngineeringa differentreferred todifferencesbelief thatphotographsidentifyingHistory of Republic ofnecessarilyprobabilitytechnicallyleaving thespectacularfraction ofelectricityhead of therestaurantspartnershipemphasis onmost recentshare with saying thatfilled withdesigned toit is often\"></iframe>as follows:merged withthrough thecommercial pointed outopportunityview of therequirementdivision ofprogramminghe receivedsetInterval\"></span></in New Yorkadditional compression\n\n<div id=\"incorporate;</script><attachEventbecame the \" target=\"_carried outSome of thescience andthe time ofContainer\">maintainingChristopherMuch of thewritings of\" height=\"2size of theversion of mixture of between theExamples ofeducationalcompetitive onsubmit=\"director ofdistinctive/DTD XHTML relating totendency toprovince ofwhich woulddespite thescientific legislature.innerHTML allegationsAgriculturewas used inapproach tointelligentyears later,sans-serifdeterminingPerformanceappearances, which is foundationsabbreviatedhigher thans from the individual composed ofsupposed toclaims thatattributionfont-size:1elements ofHistorical his brotherat the timeanniversarygoverned byrelated to ultimately innovationsit is stillcan only bedefinitionstoGMTStringA number ofimg class=\"Eventually,was changedoccurred inneighboringdistinguishwhen he wasintroducingterrestrialMany of theargues thatan Americanconquest ofwidespread were killedscreen and In order toexpected todescendantsare locatedlegislativegenerations backgroundmost peopleyears afterthere is nothe highestfrequently they do notargued thatshowed thatpredominanttheologicalby the timeconsideringshort-lived</span></a>can be usedvery littleone of the had alreadyinterpretedcommunicatefeatures ofgovernment,</noscript>entered the\" height=\"3Independentpopulationslarge-scale. Although used in thedestructionpossibilitystarting intwo or moreexpressionssubordinatelarger thanhistory and</option>\r\nContinentaleliminatingwill not bepractice ofin front ofsite of theensure thatto create amississippipotentiallyoutstandingbetter thanwhat is nowsituated inmeta name=\"TraditionalsuggestionsTranslationthe form ofatmosphericideologicalenterprisescalculatingeast of theremnants ofpluginspage/index.php?remained intransformedHe was alsowas alreadystatisticalin favor ofMinistry ofmovement offormulationis required<link rel=\"This is the <a href=\"/popularizedinvolved inare used toand severalmade by theseems to belikely thatPalestiniannamed afterit had beenmost commonto refer tobut this isconsecutivetemporarilyIn general,conventionstakes placesubdivisionterritorialoperationalpermanentlywas largelyoutbreak ofin the pastfollowing a xmlns:og=\"><a class=\"class=\"textConversion may be usedmanufactureafter beingclearfix\">\nquestion ofwas electedto become abecause of some peopleinspired bysuccessful a time whenmore commonamongst thean officialwidth:100%;technology,was adoptedto keep thesettlementslive birthsindex.html\"Connecticutassigned to&amp;times;account foralign=rightthe companyalways beenreturned toinvolvementBecause thethis period\" name=\"q\" confined toa result ofvalue=\"\" />is actuallyEnvironment\r\n</head>\r\nConversely,>\n<div id=\"0\" width=\"1is probablyhave becomecontrollingthe problemcitizens ofpoliticiansreached theas early as:none; over<table cellvalidity ofdirectly toonmousedownwhere it iswhen it wasmembers of relation toaccommodatealong with In the latethe Englishdelicious\">this is notthe presentif they areand finallya matter of\r\n\t</div>\r\n\r\n</script>faster thanmajority ofafter whichcomparativeto maintainimprove theawarded theer\" class=\"frameborderrestorationin the sameanalysis oftheir firstDuring the continentalsequence offunction(){font-size: work on the</script>\n<begins withjavascript:constituentwas foundedequilibriumassume thatis given byneeds to becoordinatesthe variousare part ofonly in thesections ofis a commontheories ofdiscoveriesassociationedge of thestrength ofposition inpresent-dayuniversallyto form thebut insteadcorporationattached tois commonlyreasons for &quot;the can be madewas able towhich meansbut did notonMouseOveras possibleoperated bycoming fromthe primaryaddition offor severaltransferreda period ofare able tohowever, itshould havemuch larger\n\t</script>adopted theproperty ofdirected byeffectivelywas broughtchildren ofProgramminglonger thanmanuscriptswar againstby means ofand most ofsimilar to proprietaryoriginatingprestigiousgrammaticalexperience.to make theIt was alsois found incompetitorsin the U.S.replace thebrought thecalculationfall of thethe generalpracticallyin honor ofreleased inresidentialand some ofking of thereaction to1st Earl ofculture andprincipally</title>\n they can beback to thesome of hisexposure toare similarform of theaddFavoritecitizenshippart in thepeople within practiceto continue&amp;minus;approved by the first allowed theand for thefunctioningplaying thesolution toheight=\"0\" in his bookmore than afollows thecreated thepresence in&nbsp;</td>nationalistthe idea ofa characterwere forced class=\"btndays of thefeatured inshowing theinterest inin place ofturn of thethe head ofLord of thepoliticallyhas its ownEducationalapproval ofsome of theeach other,behavior ofand becauseand anotherappeared onrecorded inblack&quot;may includethe world'scan lead torefers to aborder=\"0\" government winning theresulted in while the Washington,the subjectcity in the></div>\r\n\t\treflect theto completebecame moreradioactiverejected bywithout anyhis father,which couldcopy of theto indicatea politicalaccounts ofconstitutesworked wither</a></li>of his lifeaccompaniedclientWidthprevent theLegislativedifferentlytogether inhas severalfor anothertext of thefounded thee with the is used forchanged theusually theplace wherewhereas the> <a href=\"\"><a href=\"themselves,although hethat can betraditionalrole of theas a resultremoveChilddesigned bywest of theSome peopleproduction,side of thenewslettersused by thedown to theaccepted bylive in theattempts tooutside thefrequenciesHowever, inprogrammersat least inapproximatealthough itwas part ofand variousGovernor ofthe articleturned into><a href=\"/the economyis the mostmost widelywould laterand perhapsrise to theoccurs whenunder whichconditions.the westerntheory thatis producedthe city ofin which heseen in thethe centralbuilding ofmany of hisarea of theis the onlymost of themany of thethe WesternThere is noextended toStatisticalcolspan=2 |short storypossible totopologicalcritical ofreported toa Christiandecision tois equal toproblems ofThis can bemerchandisefor most ofno evidenceeditions ofelements in&quot;. Thecom/images/which makesthe processremains theliterature,is a memberthe popularthe ancientproblems intime of thedefeated bybody of thea few yearsmuch of thethe work ofCalifornia,served as agovernment.concepts ofmovement in\t\t<div id=\"it\" value=\"language ofas they areproduced inis that theexplain thediv></div>\nHowever thelead to the\t<a href=\"/was grantedpeople havecontinuallywas seen asand relatedthe role ofproposed byof the besteach other.Constantinepeople fromdialects ofto revisionwas renameda source ofthe initiallaunched inprovide theto the westwhere thereand similarbetween twois also theEnglish andconditions,that it wasentitled tothemselves.quantity ofransparencythe same asto join thecountry andthis is theThis led toa statementcontrast tolastIndexOfthrough hisis designedthe term isis providedprotect theng</a></li>The currentthe site ofsubstantialexperience,in the Westthey shouldsloven\u00C4\u008Dinacomentariosuniversidadcondicionesactividadesexperienciatecnolog\u00C3\u00ADaproducci\u00C3\u00B3npuntuaci\u00C3\u00B3naplicaci\u00C3\u00B3ncontrase\u00C3\u00B1acategor\u00C3\u00ADasregistrarseprofesionaltratamientoreg\u00C3\u00ADstratesecretar\u00C3\u00ADaprincipalesprotecci\u00C3\u00B3nimportantesimportanciaposibilidadinteresantecrecimientonecesidadessuscribirseasociaci\u00C3\u00B3ndisponiblesevaluaci\u00C3\u00B3nestudiantesresponsableresoluci\u00C3\u00B3nguadalajararegistradosoportunidadcomercialesfotograf\u00C3\u00ADaautoridadesingenier\u00C3\u00ADatelevisi\u00C3\u00B3ncompetenciaoperacionesestablecidosimplementeactualmentenavegaci\u00C3\u00B3nconformidadline-height:font-family:\" : \"http://applicationslink\" href=\"specifically//<![CDATA[\nOrganizationdistribution0px; height:relationshipdevice-width<div class=\"<label for=\"registration</noscript>\n/index.html\"window.open( !important;application/independence//www.googleorganizationautocompleterequirementsconservative<form name=\"intellectualmargin-left:18th centuryan importantinstitutionsabbreviation<img class=\"organisationcivilization19th centuryarchitectureincorporated20th century-container\">most notably/></a></div>notification'undefined')Furthermore,believe thatinnerHTML = prior to thedramaticallyreferring tonegotiationsheadquartersSouth AfricaunsuccessfulPennsylvaniaAs a result,<html lang=\"&lt;/sup&gt;dealing withphiladelphiahistorically);</script>\npadding-top:experimentalgetAttributeinstructionstechnologiespart of the =function(){subscriptionl.dtd\">\r\n<htgeographicalConstitution', function(supported byagriculturalconstructionpublicationsfont-size: 1a variety of<div style=\"Encyclopediaiframe src=\"demonstratedaccomplisheduniversitiesDemographics);</script><dedicated toknowledge ofsatisfactionparticularly</div></div>English (US)appendChild(transmissions. However, intelligence\" tabindex=\"float:right;Commonwealthranging fromin which theat least onereproductionencyclopedia;font-size:1jurisdictionat that time\"><a class=\"In addition,description+conversationcontact withis generallyr\" content=\"representing&lt;math&gt;presentationoccasionally<img width=\"navigation\">compensationchampionshipmedia=\"all\" violation ofreference toreturn true;Strict//EN\" transactionsinterventionverificationInformation difficultiesChampionshipcapabilities<![endif]-->}\n</script>\nChristianityfor example,Professionalrestrictionssuggest thatwas released(such as theremoveClass(unemploymentthe Americanstructure of/index.html published inspan class=\"\"><a href=\"/introductionbelonging toclaimed thatconsequences<meta name=\"Guide to theoverwhelmingagainst the concentrated,\n.nontouch observations</a>\n</div>\nf (document.border: 1px {font-size:1treatment of0\" height=\"1modificationIndependencedivided intogreater thanachievementsestablishingJavaScript\" neverthelesssignificanceBroadcasting>&nbsp;</td>container\">\nsuch as the influence ofa particularsrc='http://navigation\" half of the substantial &nbsp;</div>advantage ofdiscovery offundamental metropolitanthe opposite\" xml:lang=\"deliberatelyalign=centerevolution ofpreservationimprovementsbeginning inJesus ChristPublicationsdisagreementtext-align:r, function()similaritiesbody></html>is currentlyalphabeticalis sometimestype=\"image/many of the flow:hidden;available indescribe theexistence ofall over thethe Internet\t<ul class=\"installationneighborhoodarmed forcesreducing thecontinues toNonetheless,temperatures\n\t\t<a href=\"close to theexamples of is about the(see below).\" id=\"searchprofessionalis availablethe official\t\t</script>\n\n\t\t<div id=\"accelerationthrough the Hall of Famedescriptionstranslationsinterference type='text/recent yearsin the worldvery popular{background:traditional some of the connected toexploitationemergence ofconstitutionA History ofsignificant manufacturedexpectations><noscript><can be foundbecause the has not beenneighbouringwithout the added to the\t<li class=\"instrumentalSoviet Unionacknowledgedwhich can bename for theattention toattempts to developmentsIn fact, the<li class=\"aimplicationssuitable formuch of the colonizationpresidentialcancelBubble Informationmost of the is describedrest of the more or lessin SeptemberIntelligencesrc=\"http://px; height: available tomanufacturerhuman rightslink href=\"/availabilityproportionaloutside the astronomicalhuman beingsname of the are found inare based onsmaller thana person whoexpansion ofarguing thatnow known asIn the earlyintermediatederived fromScandinavian</a></div>\r\nconsider thean estimatedthe National<div id=\"pagresulting incommissionedanalogous toare required/ul>\n</div>\nwas based onand became a&nbsp;&nbsp;t\" value=\"\" was capturedno more thanrespectivelycontinue to >\r\n<head>\r\n<were createdmore generalinformation used for theindependent the Imperialcomponent ofto the northinclude the Constructionside of the would not befor instanceinvention ofmore complexcollectivelybackground: text-align: its originalinto accountthis processan extensivehowever, thethey are notrejected thecriticism ofduring whichprobably thethis article(function(){It should bean agreementaccidentallydiffers fromArchitecturebetter knownarrangementsinfluence onattended theidentical tosouth of thepass throughxml\" title=\"weight:bold;creating thedisplay:nonereplaced the<img src=\"/ihttps://www.World War IItestimonialsfound in therequired to and that thebetween the was designedconsists of considerablypublished bythe languageConservationconsisted ofrefer to theback to the css\" media=\"People from available onproved to besuggestions\"was known asvarieties oflikely to becomprised ofsupport the hands of thecoupled withconnect and border:none;performancesbefore beinglater becamecalculationsoften calledresidents ofmeaning that><li class=\"evidence forexplanationsenvironments\"></a></div>which allowsIntroductiondeveloped bya wide rangeon behalf ofvalign=\"top\"principle ofat the time,</noscript>\rsaid to havein the firstwhile othershypotheticalphilosopherspower of thecontained inperformed byinability towere writtenspan style=\"input name=\"the questionintended forrejection ofimplies thatinvented thethe standardwas probablylink betweenprofessor ofinteractionschanging theIndian Ocean class=\"lastworking with'http://www.years beforeThis was therecreationalentering themeasurementsan extremelyvalue of thestart of the\n</script>\n\nan effort toincrease theto the southspacing=\"0\">sufficientlythe Europeanconverted toclearTimeoutdid not haveconsequentlyfor the nextextension ofeconomic andalthough theare producedand with theinsufficientgiven by thestating thatexpenditures</span></a>\nthought thaton the basiscellpadding=image of thereturning toinformation,separated byassassinateds\" content=\"authority ofnorthwestern</div>\n<div \"></div>\r\n consultationcommunity ofthe nationalit should beparticipants align=\"leftthe greatestselection ofsupernaturaldependent onis mentionedallowing thewas inventedaccompanyinghis personalavailable atstudy of theon the otherexecution ofHuman Rightsterms of theassociationsresearch andsucceeded bydefeated theand from thebut they arecommander ofstate of theyears of agethe study of<ul class=\"splace in thewhere he was<li class=\"fthere are nowhich becamehe publishedexpressed into which thecommissionerfont-weight:territory ofextensions\">Roman Empireequal to theIn contrast,however, andis typicallyand his wife(also called><ul class=\"effectively evolved intoseem to havewhich is thethere was noan excellentall of thesedescribed byIn practice,broadcastingcharged withreflected insubjected tomilitary andto the pointeconomicallysetTargetingare actuallyvictory over();</script>continuouslyrequired forevolutionaryan effectivenorth of the, which was front of theor otherwisesome form ofhad not beengenerated byinformation.permitted toincludes thedevelopment,entered intothe previous";
+ }
+ }
+
+ private class DataHolder2
+ {
+ internal static string GetData()
+ {
+ return "consistentlyare known asthe field ofthis type ofgiven to thethe title ofcontains theinstances ofin the northdue to theirare designedcorporationswas that theone of thesemore popularsucceeded insupport fromin differentdominated bydesigned forownership ofand possiblystandardizedresponseTextwas intendedreceived theassumed thatareas of theprimarily inthe basis ofin the senseaccounts fordestroyed byat least twowas declaredcould not beSecretary ofappear to bemargin-top:1/^\\s+|\\s+$/ge){throw e};the start oftwo separatelanguage andwho had beenoperation ofdeath of thereal numbers\t<link rel=\"provided thethe story ofcompetitionsenglish (UK)english (US)\u00D0\u009C\u00D0\u00BE\u00D0\u00BD\u00D0\u00B3\u00D0\u00BE\u00D0\u00BB\u00D0\u00A1\u00D1\u0080\u00D0\u00BF\u00D1\u0081\u00D0\u00BA\u00D0\u00B8\u00D1\u0081\u00D1\u0080\u00D0\u00BF\u00D1\u0081\u00D0\u00BA\u00D0\u00B8\u00D1\u0081\u00D1\u0080\u00D0\u00BF\u00D1\u0081\u00D0\u00BA\u00D0\u00BE\u00D9\u0084\u00D8\u00B9\u00D8\u00B1\u00D8\u00A8\u00D9\u008A\u00D8\u00A9\u00E6\u00AD\u00A3\u00E9\u00AB\u0094\u00E4\u00B8\u00AD\u00E6\u0096\u0087\u00E7\u00AE\u0080\u00E4\u00BD\u0093\u00E4\u00B8\u00AD\u00E6\u0096\u0087\u00E7\u00B9\u0081\u00E4\u00BD\u0093\u00E4\u00B8\u00AD\u00E6\u0096\u0087\u00E6\u009C\u0089\u00E9\u0099\u0090\u00E5\u0085\u00AC\u00E5\u008F\u00B8\u00E4\u00BA\u00BA\u00E6\u00B0\u0091\u00E6\u0094\u00BF\u00E5\u00BA\u009C\u00E9\u0098\u00BF\u00E9\u0087\u008C\u00E5\u00B7\u00B4\u00E5\u00B7\u00B4\u00E7\u00A4\u00BE\u00E4\u00BC\u009A\u00E4\u00B8\u00BB\u00E4\u00B9\u0089\u00E6\u0093\u008D\u00E4\u00BD\u009C\u00E7\u00B3\u00BB\u00E7\u00BB\u009F\u00E6\u0094\u00BF\u00E7\u00AD\u0096\u00E6\u00B3\u0095\u00E8\u00A7\u0084informaci\u00C3\u00B3nherramientaselectr\u00C3\u00B3nicodescripci\u00C3\u00B3nclasificadosconocimientopublicaci\u00C3\u00B3nrelacionadasinform\u00C3\u00A1ticarelacionadosdepartamentotrabajadoresdirectamenteayuntamientomercadoLibrecont\u00C3\u00A1ctenoshabitacionescumplimientorestaurantesdisposici\u00C3\u00B3nconsecuenciaelectr\u00C3\u00B3nicaaplicacionesdesconectadoinstalaci\u00C3\u00B3nrealizaci\u00C3\u00B3nutilizaci\u00C3\u00B3nenciclopediaenfermedadesinstrumentosexperienciasinstituci\u00C3\u00B3nparticularessubcategoria\u00D1\u0082\u00D0\u00BE\u00D0\u00BB\u00D1\u008C\u00D0\u00BA\u00D0\u00BE\u00D0\u00A0\u00D0\u00BE\u00D1\u0081\u00D1\u0081\u00D0\u00B8\u00D0\u00B8\u00D1\u0080\u00D0\u00B0\u00D0\u00B1\u00D0\u00BE\u00D1\u0082\u00D1\u008B\u00D0\u00B1\u00D0\u00BE\u00D0\u00BB\u00D1\u008C\u00D1\u0088\u00D0\u00B5\u00D0\u00BF\u00D1\u0080\u00D0\u00BE\u00D1\u0081\u00D1\u0082\u00D0\u00BE\u00D0\u00BC\u00D0\u00BE\u00D0\u00B6\u00D0\u00B5\u00D1\u0082\u00D0\u00B5\u00D0\u00B4\u00D1\u0080\u00D1\u0083\u00D0\u00B3\u00D0\u00B8\u00D1\u0085\u00D1\u0081\u00D0\u00BB\u00D1\u0083\u00D1\u0087\u00D0\u00B0\u00D0\u00B5\u00D1\u0081\u00D0\u00B5\u00D0\u00B9\u00D1\u0087\u00D0\u00B0\u00D1\u0081\u00D0\u00B2\u00D1\u0081\u00D0\u00B5\u00D0\u00B3\u00D0\u00B4\u00D0\u00B0\u00D0\u00A0\u00D0\u00BE\u00D1\u0081\u00D1\u0081\u00D0\u00B8\u00D1\u008F\u00D0\u009C\u00D0\u00BE\u00D1\u0081\u00D0\u00BA\u00D0\u00B2\u00D0\u00B5\u00D0\u00B4\u00D1\u0080\u00D1\u0083\u00D0\u00B3\u00D0\u00B8\u00D0\u00B5\u00D0\u00B3\u00D0\u00BE\u00D1\u0080\u00D0\u00BE\u00D0\u00B4\u00D0\u00B0\u00D0\u00B2\u00D0\u00BE\u00D0\u00BF\u00D1\u0080\u00D0\u00BE\u00D1\u0081\u00D0\u00B4\u00D0\u00B0\u00D0\u00BD\u00D0\u00BD\u00D1\u008B\u00D1\u0085\u00D0\u00B4\u00D0\u00BE\u00D0\u00BB\u00D0\u00B6\u00D0\u00BD\u00D1\u008B\u00D0\u00B8\u00D0\u00BC\u00D0\u00B5\u00D0\u00BD\u00D0\u00BD\u00D0\u00BE\u00D0\u009C\u00D0\u00BE\u00D1\u0081\u00D0\u00BA\u00D0\u00B2\u00D1\u008B\u00D1\u0080\u00D1\u0083\u00D0\u00B1\u00D0\u00BB\u00D0\u00B5\u00D0\u00B9\u00D0\u009C\u00D0\u00BE\u00D1\u0081\u00D0\u00BA\u00D0\u00B2\u00D0\u00B0\u00D1\u0081\u00D1\u0082\u00D1\u0080\u00D0\u00B0\u00D0\u00BD\u00D1\u008B\u00D0\u00BD\u00D0\u00B8\u00D1\u0087\u00D0\u00B5\u00D0\u00B3\u00D0\u00BE\u00D1\u0080\u00D0\u00B0\u00D0\u00B1\u00D0\u00BE\u00D1\u0082\u00D0\u00B5\u00D0\u00B4\u00D0\u00BE\u00D0\u00BB\u00D0\u00B6\u00D0\u00B5\u00D0\u00BD\u00D1\u0083\u00D1\u0081\u00D0\u00BB\u00D1\u0083\u00D0\u00B3\u00D0\u00B8\u00D1\u0082\u00D0\u00B5\u00D0\u00BF\u00D0\u00B5\u00D1\u0080\u00D1\u008C\u00D0\u009E\u00D0\u00B4\u00D0\u00BD\u00D0\u00B0\u00D0\u00BA\u00D0\u00BE\u00D0\u00BF\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D0\u00BC\u00D1\u0083\u00D1\u0080\u00D0\u00B0\u00D0\u00B1\u00D0\u00BE\u00D1\u0082\u00D1\u0083\u00D0\u00B0\u00D0\u00BF\u00D1\u0080\u00D0\u00B5\u00D0\u00BB\u00D1\u008F\u00D0\u00B2\u00D0\u00BE\u00D0\u00BE\u00D0\u00B1\u00D1\u0089\u00D0\u00B5\u00D0\u00BE\u00D0\u00B4\u00D0\u00BD\u00D0\u00BE\u00D0\u00B3\u00D0\u00BE\u00D1\u0081\u00D0\u00B2\u00D0\u00BE\u00D0\u00B5\u00D0\u00B3\u00D0\u00BE\u00D1\u0081\u00D1\u0082\u00D0\u00B0\u00D1\u0082\u00D1\u008C\u00D0\u00B8\u00D0\u00B4\u00D1\u0080\u00D1\u0083\u00D0\u00B3\u00D0\u00BE\u00D0\u00B9\u00D1\u0084\u00D0\u00BE\u00D1\u0080\u00D1\u0083\u00D0\u00BC\u00D0\u00B5\u00D1\u0085\u00D0\u00BE\u00D1\u0080\u00D0\u00BE\u00D1\u0088\u00D0\u00BE\u00D0\u00BF\u00D1\u0080\u00D0\u00BE\u00D1\u0082\u00D0\u00B8\u00D0\u00B2\u00D1\u0081\u00D1\u0081\u00D1\u008B\u00D0\u00BB\u00D0\u00BA\u00D0\u00B0\u00D0\u00BA\u00D0\u00B0\u00D0\u00B6\u00D0\u00B4\u00D1\u008B\u00D0\u00B9\u00D0\u00B2\u00D0\u00BB\u00D0\u00B0\u00D1\u0081\u00D1\u0082\u00D0\u00B8\u00D0\u00B3\u00D1\u0080\u00D1\u0083\u00D0\u00BF\u00D0\u00BF\u00D1\u008B\u00D0\u00B2\u00D0\u00BC\u00D0\u00B5\u00D1\u0081\u00D1\u0082\u00D0\u00B5\u00D1\u0080\u00D0\u00B0\u00D0\u00B1\u00D0\u00BE\u00D1\u0082\u00D0\u00B0\u00D1\u0081\u00D0\u00BA\u00D0\u00B0\u00D0\u00B7\u00D0\u00B0\u00D0\u00BB\u00D0\u00BF\u00D0\u00B5\u00D1\u0080\u00D0\u00B2\u00D1\u008B\u00D0\u00B9\u00D0\u00B4\u00D0\u00B5\u00D0\u00BB\u00D0\u00B0\u00D1\u0082\u00D1\u008C\u00D0\u00B4\u00D0\u00B5\u00D0\u00BD\u00D1\u008C\u00D0\u00B3\u00D0\u00B8\u00D0\u00BF\u00D0\u00B5\u00D1\u0080\u00D0\u00B8\u00D0\u00BE\u00D0\u00B4\u00D0\u00B1\u00D0\u00B8\u00D0\u00B7\u00D0\u00BD\u00D0\u00B5\u00D1\u0081\u00D0\u00BE\u00D1\u0081\u00D0\u00BD\u00D0\u00BE\u00D0\u00B2\u00D0\u00B5\u00D0\u00BC\u00D0\u00BE\u00D0\u00BC\u00D0\u00B5\u00D0\u00BD\u00D1\u0082\u00D0\u00BA\u00D1\u0083\u00D0\u00BF\u00D0\u00B8\u00D1\u0082\u00D1\u008C\u00D0\u00B4\u00D0\u00BE\u00D0\u00BB\u00D0\u00B6\u00D0\u00BD\u00D0\u00B0\u00D1\u0080\u00D0\u00B0\u00D0\u00BC\u00D0\u00BA\u00D0\u00B0\u00D1\u0085\u00D0\u00BD\u00D0\u00B0\u00D1\u0087\u00D0\u00B0\u00D0\u00BB\u00D0\u00BE\u00D0\u00A0\u00D0\u00B0\u00D0\u00B1\u00D0\u00BE\u00D1\u0082\u00D0\u00B0\u00D0\u00A2\u00D0\u00BE\u00D0\u00BB\u00D1\u008C\u00D0\u00BA\u00D0\u00BE\u00D1\u0081\u00D0\u00BE\u00D0\u00B2\u00D1\u0081\u00D0\u00B5\u00D0\u00BC\u00D0\u00B2\u00D1\u0082\u00D0\u00BE\u00D1\u0080\u00D0\u00BE\u00D0\u00B9\u00D0\u00BD\u00D0\u00B0\u00D1\u0087\u00D0\u00B0\u00D0\u00BB\u00D0\u00B0\u00D1\u0081\u00D0\u00BF\u00D0\u00B8\u00D1\u0081\u00D0\u00BE\u00D0\u00BA\u00D1\u0081\u00D0\u00BB\u00D1\u0083\u00D0\u00B6\u00D0\u00B1\u00D1\u008B\u00D1\u0081\u00D0\u00B8\u00D1\u0081\u00D1\u0082\u00D0\u00B5\u00D0\u00BC\u00D0\u00BF\u00D0\u00B5\u00D1\u0087\u00D0\u00B0\u00D1\u0082\u00D0\u00B8\u00D0\u00BD\u00D0\u00BE\u00D0\u00B2\u00D0\u00BE\u00D0\u00B3\u00D0\u00BE\u00D0\u00BF\u00D0\u00BE\u00D0\u00BC\u00D0\u00BE\u00D1\u0089\u00D0\u00B8\u00D1\u0081\u00D0\u00B0\u00D0\u00B9\u00D1\u0082\u00D0\u00BE\u00D0\u00B2\u00D0\u00BF\u00D0\u00BE\u00D1\u0087\u00D0\u00B5\u00D0\u00BC\u00D1\u0083\u00D0\u00BF\u00D0\u00BE\u00D0\u00BC\u00D0\u00BE\u00D1\u0089\u00D1\u008C\u00D0\u00B4\u00D0\u00BE\u00D0\u00BB\u00D0\u00B6\u00D0\u00BD\u00D0\u00BE\u00D1\u0081\u00D1\u0081\u00D1\u008B\u00D0\u00BB\u00D0\u00BA\u00D0\u00B8\u00D0\u00B1\u00D1\u008B\u00D1\u0081\u00D1\u0082\u00D1\u0080\u00D0\u00BE\u00D0\u00B4\u00D0\u00B0\u00D0\u00BD\u00D0\u00BD\u00D1\u008B\u00D0\u00B5\u00D0\u00BC\u00D0\u00BD\u00D0\u00BE\u00D0\u00B3\u00D0\u00B8\u00D0\u00B5\u00D0\u00BF\u00D1\u0080\u00D0\u00BE\u00D0\u00B5\u00D0\u00BA\u00D1\u0082\u00D0\u00A1\u00D0\u00B5\u00D0\u00B9\u00D1\u0087\u00D0\u00B0\u00D1\u0081\u00D0\u00BC\u00D0\u00BE\u00D0\u00B4\u00D0\u00B5\u00D0\u00BB\u00D0\u00B8\u00D1\u0082\u00D0\u00B0\u00D0\u00BA\u00D0\u00BE\u00D0\u00B3\u00D0\u00BE\u00D0\u00BE\u00D0\u00BD\u00D0\u00BB\u00D0\u00B0\u00D0\u00B9\u00D0\u00BD\u00D0\u00B3\u00D0\u00BE\u00D1\u0080\u00D0\u00BE\u00D0\u00B4\u00D0\u00B5\u00D0\u00B2\u00D0\u00B5\u00D1\u0080\u00D1\u0081\u00D0\u00B8\u00D1\u008F\u00D1\u0081\u00D1\u0082\u00D1\u0080\u00D0\u00B0\u00D0\u00BD\u00D0\u00B5\u00D1\u0084\u00D0\u00B8\u00D0\u00BB\u00D1\u008C\u00D0\u00BC\u00D1\u008B\u00D1\u0083\u00D1\u0080\u00D0\u00BE\u00D0\u00B2\u00D0\u00BD\u00D1\u008F\u00D1\u0080\u00D0\u00B0\u00D0\u00B7\u00D0\u00BD\u00D1\u008B\u00D1\u0085\u00D0\u00B8\u00D1\u0081\u00D0\u00BA\u00D0\u00B0\u00D1\u0082\u00D1\u008C\u00D0\u00BD\u00D0\u00B5\u00D0\u00B4\u00D0\u00B5\u00D0\u00BB\u00D1\u008E\u00D1\u008F\u00D0\u00BD\u00D0\u00B2\u00D0\u00B0\u00D1\u0080\u00D1\u008F\u00D0\u00BC\u00D0\u00B5\u00D0\u00BD\u00D1\u008C\u00D1\u0088\u00D0\u00B5\u00D0\u00BC\u00D0\u00BD\u00D0\u00BE\u00D0\u00B3\u00D0\u00B8\u00D1\u0085\u00D0\u00B4\u00D0\u00B0\u00D0\u00BD\u00D0\u00BD\u00D0\u00BE\u00D0\u00B9\u00D0\u00B7\u00D0\u00BD\u00D0\u00B0\u00D1\u0087\u00D0\u00B8\u00D1\u0082\u00D0\u00BD\u00D0\u00B5\u00D0\u00BB\u00D1\u008C\u00D0\u00B7\u00D1\u008F\u00D1\u0084\u00D0\u00BE\u00D1\u0080\u00D1\u0083\u00D0\u00BC\u00D0\u00B0\u00D0\u00A2\u00D0\u00B5\u00D0\u00BF\u00D0\u00B5\u00D1\u0080\u00D1\u008C\u00D0\u00BC\u00D0\u00B5\u00D1\u0081\u00D1\u008F\u00D1\u0086\u00D0\u00B0\u00D0\u00B7\u00D0\u00B0\u00D1\u0089\u00D0\u00B8\u00D1\u0082\u00D1\u008B\u00D0\u009B\u00D1\u0083\u00D1\u0087\u00D1\u0088\u00D0\u00B8\u00D0\u00B5\u00E0\u00A4\u00A8\u00E0\u00A4\u00B9\u00E0\u00A5\u0080\u00E0\u00A4\u0082\u00E0\u00A4\u0095\u00E0\u00A4\u00B0\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u0085\u00E0\u00A4\u00AA\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u0095\u00E0\u00A4\u00BF\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u0095\u00E0\u00A4\u00B0\u00E0\u00A5\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u0085\u00E0\u00A4\u00A8\u00E0\u00A5\u008D\u00E0\u00A4\u00AF\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u0097\u00E0\u00A4\u00BE\u00E0\u00A4\u0087\u00E0\u00A4\u00A1\u00E0\u00A4\u00AC\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A5\u0087\u00E0\u00A4\u0095\u00E0\u00A4\u00BF\u00E0\u00A4\u00B8\u00E0\u00A5\u0080\u00E0\u00A4\u00A6\u00E0\u00A4\u00BF\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00AA\u00E0\u00A4\u00B9\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u00B8\u00E0\u00A4\u00BF\u00E0\u00A4\u0082\u00E0\u00A4\u00B9\u00E0\u00A4\u00AD\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00A4\u00E0\u00A4\u0085\u00E0\u00A4\u00AA\u00E0\u00A4\u00A8\u00E0\u00A5\u0080\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u00B8\u00E0\u00A5\u0087\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u0095\u00E0\u00A4\u00B0\u00E0\u00A4\u00A4\u00E0\u00A5\u0087\u00E0\u00A4\u00AE\u00E0\u00A5\u0087\u00E0\u00A4\u00B0\u00E0\u00A5\u0087\u00E0\u00A4\u00B9\u00E0\u00A5\u008B\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u00B8\u00E0\u00A4\u0095\u00E0\u00A4\u00A4\u00E0\u00A5\u0087\u00E0\u00A4\u00AC\u00E0\u00A4\u00B9\u00E0\u00A5\u0081\u00E0\u00A4\u00A4\u00E0\u00A4\u00B8\u00E0\u00A4\u00BE\u00E0\u00A4\u0087\u00E0\u00A4\u009F\u00E0\u00A4\u00B9\u00E0\u00A5\u008B\u00E0\u00A4\u0097\u00E0\u00A4\u00BE\u00E0\u00A4\u009C\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u00AE\u00E0\u00A4\u00BF\u00E0\u00A4\u00A8\u00E0\u00A4\u009F\u00E0\u00A4\u0095\u00E0\u00A4\u00B0\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u0095\u00E0\u00A4\u00B0\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u0089\u00E0\u00A4\u00A8\u00E0\u00A4\u0095\u00E0\u00A5\u0087\u00E0\u00A4\u00AF\u00E0\u00A4\u00B9\u00E0\u00A4\u00BE\u00E0\u00A4\u0081\u00E0\u00A4\u00B8\u00E0\u00A4\u00AC\u00E0\u00A4\u00B8\u00E0\u00A5\u0087\u00E0\u00A4\u00AD\u00E0\u00A4\u00BE\u00E0\u00A4\u00B7\u00E0\u00A4\u00BE\u00E0\u00A4\u0086\u00E0\u00A4\u00AA\u00E0\u00A4\u0095\u00E0\u00A5\u0087\u00E0\u00A4\u00B2\u00E0\u00A4\u00BF\u00E0\u00A4\u00AF\u00E0\u00A5\u0087\u00E0\u00A4\u00B6\u00E0\u00A5\u0081\u00E0\u00A4\u00B0\u00E0\u00A5\u0082\u00E0\u00A4\u0087\u00E0\u00A4\u00B8\u00E0\u00A4\u0095\u00E0\u00A5\u0087\u00E0\u00A4\u0098\u00E0\u00A4\u0082\u00E0\u00A4\u009F\u00E0\u00A5\u0087\u00E0\u00A4\u00AE\u00E0\u00A5\u0087\u00E0\u00A4\u00B0\u00E0\u00A5\u0080\u00E0\u00A4\u00B8\u00E0\u00A4\u0095\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u00AE\u00E0\u00A5\u0087\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u0095\u00E0\u00A4\u00B0\u00E0\u00A4\u0085\u00E0\u00A4\u00A7\u00E0\u00A4\u00BF\u00E0\u00A4\u0095\u00E0\u00A4\u0085\u00E0\u00A4\u00AA\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A4\u00AE\u00E0\u00A4\u00BE\u00E0\u00A4\u009C\u00E0\u00A4\u00AE\u00E0\u00A5\u0081\u00E0\u00A4\u009D\u00E0\u00A5\u0087\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00A3\u00E0\u00A4\u00B9\u00E0\u00A5\u008B\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u0095\u00E0\u00A4\u00A1\u00E0\u00A4\u00BC\u00E0\u00A5\u0080\u00E0\u00A4\u00AF\u00E0\u00A4\u00B9\u00E0\u00A4\u00BE\u00E0\u00A4\u0082\u00E0\u00A4\u00B9\u00E0\u00A5\u008B\u00E0\u00A4\u009F\u00E0\u00A4\u00B2\u00E0\u00A4\u00B6\u00E0\u00A4\u00AC\u00E0\u00A5\u008D\u00E0\u00A4\u00A6\u00E0\u00A4\u00B2\u00E0\u00A4\u00BF\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u009C\u00E0\u00A5\u0080\u00E0\u00A4\u00B5\u00E0\u00A4\u00A8\u00E0\u00A4\u009C\u00E0\u00A4\u00BE\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u0095\u00E0\u00A5\u0088\u00E0\u00A4\u00B8\u00E0\u00A5\u0087\u00E0\u00A4\u0086\u00E0\u00A4\u00AA\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u00B2\u00E0\u00A5\u0080\u00E0\u00A4\u00A6\u00E0\u00A5\u0087\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u00AA\u00E0\u00A5\u0082\u00E0\u00A4\u00B0\u00E0\u00A5\u0080\u00E0\u00A4\u00AA\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A5\u0080\u00E0\u00A4\u0089\u00E0\u00A4\u00B8\u00E0\u00A4\u0095\u00E0\u00A5\u0087\u00E0\u00A4\u00B9\u00E0\u00A5\u008B\u00E0\u00A4\u0097\u00E0\u00A5\u0080\u00E0\u00A4\u00AC\u00E0\u00A5\u0088\u00E0\u00A4\u00A0\u00E0\u00A4\u0095\u00E0\u00A4\u0086\u00E0\u00A4\u00AA\u00E0\u00A4\u0095\u00E0\u00A5\u0080\u00E0\u00A4\u00B5\u00E0\u00A4\u00B0\u00E0\u00A5\u008D\u00E0\u00A4\u00B7\u00E0\u00A4\u0097\u00E0\u00A4\u00BE\u00E0\u00A4\u0082\u00E0\u00A4\u00B5\u00E0\u00A4\u0086\u00E0\u00A4\u00AA\u00E0\u00A4\u0095\u00E0\u00A5\u008B\u00E0\u00A4\u009C\u00E0\u00A4\u00BF\u00E0\u00A4\u00B2\u00E0\u00A4\u00BE\u00E0\u00A4\u009C\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A4\u00B9\u00E0\u00A4\u00AE\u00E0\u00A4\u00A4\u00E0\u00A4\u00B9\u00E0\u00A4\u00AE\u00E0\u00A5\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u0089\u00E0\u00A4\u00A8\u00E0\u00A4\u0095\u00E0\u00A5\u0080\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00B9\u00E0\u00A5\u0082\u00E0\u00A4\u00A6\u00E0\u00A4\u00B0\u00E0\u00A5\u008D\u00E0\u00A4\u009C\u00E0\u00A4\u00B8\u00E0\u00A5\u0082\u00E0\u00A4\u009A\u00E0\u00A5\u0080\u00E0\u00A4\u00AA\u00E0\u00A4\u00B8\u00E0\u00A4\u0082\u00E0\u00A4\u00A6\u00E0\u00A4\u00B8\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u00B2\u00E0\u00A4\u00B9\u00E0\u00A5\u008B\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00B9\u00E0\u00A5\u008B\u00E0\u00A4\u00A4\u00E0\u00A5\u0080\u00E0\u00A4\u009C\u00E0\u00A5\u0088\u00E0\u00A4\u00B8\u00E0\u00A5\u0087\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u00AA\u00E0\u00A4\u00B8\u00E0\u00A4\u009C\u00E0\u00A4\u00A8\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u009C\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A5\u0080\u00E0\u00A4\u0098\u00E0\u00A4\u00BE\u00E0\u00A4\u00AF\u00E0\u00A4\u00B2\u00E0\u00A4\u009C\u00E0\u00A4\u00BF\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u00A8\u00E0\u00A5\u0080\u00E0\u00A4\u009A\u00E0\u00A5\u0087\u00E0\u00A4\u009C\u00E0\u00A4\u00BE\u00E0\u00A4\u0082\u00E0\u00A4\u009A\u00E0\u00A4\u00AA\u00E0\u00A4\u00A4\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u0097\u00E0\u00A5\u0082\u00E0\u00A4\u0097\u00E0\u00A4\u00B2\u00E0\u00A4\u009C\u00E0\u00A4\u00BE\u00E0\u00A4\u00A4\u00E0\u00A5\u0087\u00E0\u00A4\u00AC\u00E0\u00A4\u00BE\u00E0\u00A4\u00B9\u00E0\u00A4\u00B0\u00E0\u00A4\u0086\u00E0\u00A4\u00AA\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u00B9\u00E0\u00A4\u00A8\u00E0\u00A4\u0087\u00E0\u00A4\u00B8\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A5\u0081\u00E0\u00A4\u00AC\u00E0\u00A4\u00B9\u00E0\u00A4\u00B0\u00E0\u00A4\u00B9\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u0087\u00E0\u00A4\u00B8\u00E0\u00A4\u00B8\u00E0\u00A5\u0087\u00E0\u00A4\u00B8\u00E0\u00A4\u00B9\u00E0\u00A4\u00BF\u00E0\u00A4\u00A4\u00E0\u00A4\u00AC\u00E0\u00A4\u00A1\u00E0\u00A4\u00BC\u00E0\u00A5\u0087\u00E0\u00A4\u0098\u00E0\u00A4\u009F\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00A4\u00E0\u00A4\u00B2\u00E0\u00A4\u00BE\u00E0\u00A4\u00B6\u00E0\u00A4\u00AA\u00E0\u00A4\u00BE\u00E0\u00A4\u0082\u00E0\u00A4\u009A\u00E0\u00A4\u00B6\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A5\u0080\u00E0\u00A4\u00AC\u00E0\u00A4\u00A1\u00E0\u00A4\u00BC\u00E0\u00A5\u0080\u00E0\u00A4\u00B9\u00E0\u00A5\u008B\u00E0\u00A4\u00A4\u00E0\u00A5\u0087\u00E0\u00A4\u00B8\u00E0\u00A4\u00BE\u00E0\u00A4\u0088\u00E0\u00A4\u009F\u00E0\u00A4\u00B6\u00E0\u00A4\u00BE\u00E0\u00A4\u00AF\u00E0\u00A4\u00A6\u00E0\u00A4\u00B8\u00E0\u00A4\u0095\u00E0\u00A4\u00A4\u00E0\u00A5\u0080\u00E0\u00A4\u009C\u00E0\u00A4\u00BE\u00E0\u00A4\u00A4\u00E0\u00A5\u0080\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u00B2\u00E0\u00A4\u00BE\u00E0\u00A4\u00B9\u00E0\u00A4\u009C\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00AA\u00E0\u00A4\u009F\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u0096\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u00B8\u00E0\u00A4\u00A1\u00E0\u00A4\u00BC\u00E0\u00A4\u0095\u00E0\u00A4\u00AE\u00E0\u00A4\u00BF\u00E0\u00A4\u00B2\u00E0\u00A4\u00BE\u00E0\u00A4\u0089\u00E0\u00A4\u00B8\u00E0\u00A4\u0095\u00E0\u00A5\u0080\u00E0\u00A4\u0095\u00E0\u00A5\u0087\u00E0\u00A4\u00B5\u00E0\u00A4\u00B2\u00E0\u00A4\u00B2\u00E0\u00A4\u0097\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u0096\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u0085\u00E0\u00A4\u00B0\u00E0\u00A5\u008D\u00E0\u00A4\u00A5\u00E0\u00A4\u009C\u00E0\u00A4\u00B9\u00E0\u00A4\u00BE\u00E0\u00A4\u0082\u00E0\u00A4\u00A6\u00E0\u00A5\u0087\u00E0\u00A4\u0096\u00E0\u00A4\u00BE\u00E0\u00A4\u00AA\u00E0\u00A4\u00B9\u00E0\u00A4\u00B2\u00E0\u00A5\u0080\u00E0\u00A4\u00A8\u00E0\u00A4\u00BF\u00E0\u00A4\u00AF\u00E0\u00A4\u00AE\u00E0\u00A4\u00AC\u00E0\u00A4\u00BF\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00AC\u00E0\u00A5\u0088\u00E0\u00A4\u0082\u00E0\u00A4\u0095\u00E0\u00A4\u0095\u00E0\u00A4\u00B9\u00E0\u00A5\u0080\u00E0\u00A4\u0082\u00E0\u00A4\u0095\u00E0\u00A4\u00B9\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00A6\u00E0\u00A5\u0087\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u00B9\u00E0\u00A4\u00AE\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00AB\u00E0\u00A5\u0080\u00E0\u00A4\u009C\u00E0\u00A4\u00AC\u00E0\u00A4\u0095\u00E0\u00A4\u00BF\u00E0\u00A4\u00A4\u00E0\u00A5\u0081\u00E0\u00A4\u00B0\u00E0\u00A4\u00A4\u00E0\u00A4\u00AE\u00E0\u00A4\u00BE\u00E0\u00A4\u0082\u00E0\u00A4\u0097\u00E0\u00A4\u00B5\u00E0\u00A4\u00B9\u00E0\u00A5\u0080\u00E0\u00A4\u0082\u00E0\u00A4\u00B0\u00E0\u00A5\u008B\u00E0\u00A4\u009C\u00E0\u00A4\u00BC\u00E0\u00A4\u00AE\u00E0\u00A4\u00BF\u00E0\u00A4\u00B2\u00E0\u00A5\u0080\u00E0\u00A4\u0086\u00E0\u00A4\u00B0\u00E0\u00A5\u008B\u00E0\u00A4\u00AA\u00E0\u00A4\u00B8\u00E0\u00A5\u0087\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00A6\u00E0\u00A4\u00B5\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u0096\u00E0\u00A4\u00BE\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u0095\u00E0\u00A4\u00B0\u00E0\u00A5\u0080\u00E0\u00A4\u00AC\u00E0\u00A4\u0089\u00E0\u00A4\u00A8\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u009C\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u00AC\u00E0\u00A4\u00AA\u00E0\u00A5\u0082\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u00AC\u00E0\u00A4\u00A1\u00E0\u00A4\u00BC\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A5\u008C\u00E0\u00A4\u00A6\u00E0\u00A4\u00BE\u00E0\u00A4\u00B6\u00E0\u00A5\u0087\u00E0\u00A4\u00AF\u00E0\u00A4\u00B0\u00E0\u00A4\u0095\u00E0\u00A4\u00BF\u00E0\u00A4\u00AF\u00E0\u00A5\u0087\u00E0\u00A4\u0095\u00E0\u00A4\u00B9\u00E0\u00A4\u00BE\u00E0\u00A4\u0082\u00E0\u00A4\u0085\u00E0\u00A4\u0095\u00E0\u00A4\u00B8\u00E0\u00A4\u00B0\u00E0\u00A4\u00AC\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u008F\u00E0\u00A4\u00B5\u00E0\u00A4\u00B9\u00E0\u00A4\u00BE\u00E0\u00A4\u0082\u00E0\u00A4\u00B8\u00E0\u00A5\u008D\u00E0\u00A4\u00A5\u00E0\u00A4\u00B2\u00E0\u00A4\u00AE\u00E0\u00A4\u00BF\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u0096\u00E0\u00A4\u0095\u00E0\u00A4\u00B5\u00E0\u00A4\u00BF\u00E0\u00A4\u00B7\u00E0\u00A4\u00AF\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u0082\u00E0\u00A4\u00B8\u00E0\u00A4\u00AE\u00E0\u00A5\u0082\u00E0\u00A4\u00B9\u00E0\u00A4\u00A5\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00D8\u00AA\u00D8\u00B3\u00D8\u00AA\u00D8\u00B7\u00D9\u008A\u00D8\u00B9\u00D9\u0085\u00D8\u00B4\u00D8\u00A7\u00D8\u00B1\u00D9\u0083\u00D8\u00A9\u00D8\u00A8\u00D9\u0088\u00D8\u00A7\u00D8\u00B3\u00D8\u00B7\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00B5\u00D9\u0081\u00D8\u00AD\u00D8\u00A9\u00D9\u0085\u00D9\u0088\u00D8\u00A7\u00D8\u00B6\u00D9\u008A\u00D8\u00B9\u00D8\u00A7\u00D9\u0084\u00D8\u00AE\u00D8\u00A7\u00D8\u00B5\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00B2\u00D9\u008A\u00D8\u00AF\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D8\u00A7\u00D9\u0085\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D9\u0083\u00D8\u00A7\u00D8\u00AA\u00D8\u00A8\u00D8\u00A7\u00D9\u0084\u00D8\u00B1\u00D8\u00AF\u00D9\u0088\u00D8\u00AF\u00D8\u00A8\u00D8\u00B1\u00D9\u0086\u00D8\u00A7\u00D9\u0085\u00D8\u00AC\u00D8\u00A7\u00D9\u0084\u00D8\u00AF\u00D9\u0088\u00D9\u0084\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D9\u0088\u00D9\u0082\u00D8\u00B9\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D8\u00B1\u00D8\u00A8\u00D9\u008A\u00D8\u00A7\u00D9\u0084\u00D8\u00B3\u00D8\u00B1\u00D9\u008A\u00D8\u00B9\u00D8\u00A7\u00D9\u0084\u00D8\u00AC\u00D9\u0088\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D9\u0084\u00D8\u00B0\u00D9\u0087\u00D8\u00A7\u00D8\u00A8\u00D8\u00A7\u00D9\u0084\u00D8\u00AD\u00D9\u008A\u00D8\u00A7\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00AD\u00D9\u0082\u00D9\u0088\u00D9\u0082\u00D8\u00A7\u00D9\u0084\u00D9\u0083\u00D8\u00B1\u00D9\u008A\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D8\u00B1\u00D8\u00A7\u00D9\u0082\u00D9\u0085\u00D8\u00AD\u00D9\u0081\u00D9\u0088\u00D8\u00B8\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00AB\u00D8\u00A7\u00D9\u0086\u00D9\u008A\u00D9\u0085\u00D8\u00B4\u00D8\u00A7\u00D9\u0087\u00D8\u00AF\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00B1\u00D8\u00A3\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D9\u0082\u00D8\u00B1\u00D8\u00A2\u00D9\u0086\u00D8\u00A7\u00D9\u0084\u00D8\u00B4\u00D8\u00A8\u00D8\u00A7\u00D8\u00A8\u00D8\u00A7\u00D9\u0084\u00D8\u00AD\u00D9\u0088\u00D8\u00A7\u00D8\u00B1\u00D8\u00A7\u00D9\u0084\u00D8\u00AC\u00D8\u00AF\u00D9\u008A\u00D8\u00AF\u00D8\u00A7\u00D9\u0084\u00D8\u00A3\u00D8\u00B3\u00D8\u00B1\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D9\u0084\u00D9\u0088\u00D9\u0085\u00D9\u0085\u00D8\u00AC\u00D9\u0085\u00D9\u0088\u00D8\u00B9\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00B1\u00D8\u00AD\u00D9\u0085\u00D9\u0086\u00D8\u00A7\u00D9\u0084\u00D9\u0086\u00D9\u0082\u00D8\u00A7\u00D8\u00B7\u00D9\u0081\u00D9\u0084\u00D8\u00B3\u00D8\u00B7\u00D9\u008A\u00D9\u0086\u00D8\u00A7\u00D9\u0084\u00D9\u0083\u00D9\u0088\u00D9\u008A\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D8\u00AF\u00D9\u0086\u00D9\u008A\u00D8\u00A7\u00D8\u00A8\u00D8\u00B1\u00D9\u0083\u00D8\u00A7\u00D8\u00AA\u00D9\u0087\u00D8\u00A7\u00D9\u0084\u00D8\u00B1\u00D9\u008A\u00D8\u00A7\u00D8\u00B6\u00D8\u00AA\u00D8\u00AD\u00D9\u008A\u00D8\u00A7\u00D8\u00AA\u00D9\u008A\u00D8\u00A8\u00D8\u00AA\u00D9\u0088\u00D9\u0082\u00D9\u008A\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D8\u00A3\u00D9\u0088\u00D9\u0084\u00D9\u0089\u00D8\u00A7\u00D9\u0084\u00D8\u00A8\u00D8\u00B1\u00D9\u008A\u00D8\u00AF\u00D8\u00A7\u00D9\u0084\u00D9\u0083\u00D9\u0084\u00D8\u00A7\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D8\u00B1\u00D8\u00A7\u00D8\u00A8\u00D8\u00B7\u00D8\u00A7\u00D9\u0084\u00D8\u00B4\u00D8\u00AE\u00D8\u00B5\u00D9\u008A\u00D8\u00B3\u00D9\u008A\u00D8\u00A7\u00D8\u00B1\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D8\u00AB\u00D8\u00A7\u00D9\u0084\u00D8\u00AB\u00D8\u00A7\u00D9\u0084\u00D8\u00B5\u00D9\u0084\u00D8\u00A7\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00AD\u00D8\u00AF\u00D9\u008A\u00D8\u00AB\u00D8\u00A7\u00D9\u0084\u00D8\u00B2\u00D9\u0088\u00D8\u00A7\u00D8\u00B1\u00D8\u00A7\u00D9\u0084\u00D8\u00AE\u00D9\u0084\u00D9\u008A\u00D8\u00AC\u00D8\u00A7\u00D9\u0084\u00D8\u00AC\u00D9\u0085\u00D9\u008A\u00D8\u00B9\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D8\u00A7\u00D9\u0085\u00D9\u0087\u00D8\u00A7\u00D9\u0084\u00D8\u00AC\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D9\u0084\u00D8\u00B3\u00D8\u00A7\u00D8\u00B9\u00D8\u00A9\u00D9\u0085\u00D8\u00B4\u00D8\u00A7\u00D9\u0087\u00D8\u00AF\u00D9\u0087\u00D8\u00A7\u00D9\u0084\u00D8\u00B1\u00D8\u00A6\u00D9\u008A\u00D8\u00B3\u00D8\u00A7\u00D9\u0084\u00D8\u00AF\u00D8\u00AE\u00D9\u0088\u00D9\u0084\u00D8\u00A7\u00D9\u0084\u00D9\u0081\u00D9\u0086\u00D9\u008A\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D9\u0083\u00D8\u00AA\u00D8\u00A7\u00D8\u00A8\u00D8\u00A7\u00D9\u0084\u00D8\u00AF\u00D9\u0088\u00D8\u00B1\u00D9\u008A\u00D8\u00A7\u00D9\u0084\u00D8\u00AF\u00D8\u00B1\u00D9\u0088\u00D8\u00B3\u00D8\u00A7\u00D8\u00B3\u00D8\u00AA\u00D8\u00BA\u00D8\u00B1\u00D9\u0082\u00D8\u00AA\u00D8\u00B5\u00D8\u00A7\u00D9\u0085\u00D9\u008A\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D8\u00A8\u00D9\u0086\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D8\u00B8\u00D9\u008A\u00D9\u0085entertainmentunderstanding = function().jpg\" width=\"configuration.png\" width=\"<body class=\"Math.random()contemporary United Statescircumstances.appendChild(organizations<span class=\"\"><img src=\"/distinguishedthousands of communicationclear\"></div>investigationfavicon.ico\" margin-right:based on the Massachusettstable border=internationalalso known aspronunciationbackground:#fpadding-left:For example, miscellaneous&lt;/math&gt;psychologicalin particularearch\" type=\"form method=\"as opposed toSupreme Courtoccasionally Additionally,North Americapx;backgroundopportunitiesEntertainment.toLowerCase(manufacturingprofessional combined withFor instance,consisting of\" maxlength=\"return false;consciousnessMediterraneanextraordinaryassassinationsubsequently button type=\"the number ofthe original comprehensiverefers to the</ul>\n</div>\nphilosophicallocation.hrefwas publishedSan Francisco(function(){\n<div id=\"mainsophisticatedmathematical /head>\r\n<bodysuggests thatdocumentationconcentrationrelationshipsmay have been(for example,This article in some casesparts of the definition ofGreat Britain cellpadding=equivalent toplaceholder=\"; font-size: justificationbelieved thatsuffered fromattempted to leader of thecript\" src=\"/(function() {are available\n\t<link rel=\" src='http://interested inconventional \" alt=\"\" /></are generallyhas also beenmost popular correspondingcredited withtyle=\"border:</a></span></.gif\" width=\"<iframe src=\"table class=\"inline-block;according to together withapproximatelyparliamentarymore and moredisplay:none;traditionallypredominantly&nbsp;|&nbsp;&nbsp;</span> cellspacing=<input name=\"or\" content=\"controversialproperty=\"og:/x-shockwave-demonstrationsurrounded byNevertheless,was the firstconsiderable Although the collaborationshould not beproportion of<span style=\"known as the shortly afterfor instance,described as /head>\n<body starting withincreasingly the fact thatdiscussion ofmiddle of thean individualdifficult to point of viewhomosexualityacceptance of</span></div>manufacturersorigin of thecommonly usedimportance ofdenominationsbackground: #length of thedeterminationa significant\" border=\"0\">revolutionaryprinciples ofis consideredwas developedIndo-Europeanvulnerable toproponents ofare sometimescloser to theNew York City name=\"searchattributed tocourse of themathematicianby the end ofat the end of\" border=\"0\" technological.removeClass(branch of theevidence that![endif]-->\r\nInstitute of into a singlerespectively.and thereforeproperties ofis located insome of whichThere is alsocontinued to appearance of &amp;ndash; describes theconsiderationauthor of theindependentlyequipped withdoes not have</a><a href=\"confused with<link href=\"/at the age ofappear in theThese includeregardless ofcould be used style=&quot;several timesrepresent thebody>\n</html>thought to bepopulation ofpossibilitiespercentage ofaccess to thean attempt toproduction ofjquery/jquerytwo differentbelong to theestablishmentreplacing thedescription\" determine theavailable forAccording to wide range of\t<div class=\"more commonlyorganisationsfunctionalitywas completed &amp;mdash; participationthe characteran additionalappears to befact that thean example ofsignificantlyonmouseover=\"because they async = true;problems withseems to havethe result of src=\"http://familiar withpossession offunction () {took place inand sometimessubstantially<span></span>is often usedin an attemptgreat deal ofEnvironmentalsuccessfully virtually all20th century,professionalsnecessary to determined bycompatibilitybecause it isDictionary ofmodificationsThe followingmay refer to:Consequently,Internationalalthough somethat would beworld's firstclassified asbottom of the(particularlyalign=\"left\" most commonlybasis for thefoundation ofcontributionspopularity ofcenter of theto reduce thejurisdictionsapproximation onmouseout=\"New Testamentcollection of</span></a></in the Unitedfilm director-strict.dtd\">has been usedreturn to thealthough thischange in theseveral otherbut there areunprecedentedis similar toespecially inweight: bold;is called thecomputationalindicate thatrestricted to\t<meta name=\"are typicallyconflict withHowever, the An example ofcompared withquantities ofrather than aconstellationnecessary forreported thatspecificationpolitical and&nbsp;&nbsp;<references tothe same yearGovernment ofgeneration ofhave not beenseveral yearscommitment to\t\t<ul class=\"visualization19th century,practitionersthat he wouldand continuedoccupation ofis defined ascentre of thethe amount of><div style=\"equivalent ofdifferentiatebrought aboutmargin-left: automaticallythought of asSome of these\n<div class=\"input class=\"replaced withis one of theeducation andinfluenced byreputation as\n<meta name=\"accommodation</div>\n</div>large part ofInstitute forthe so-called against the In this case,was appointedclaimed to beHowever, thisDepartment ofthe remainingeffect on theparticularly deal with the\n<div style=\"almost alwaysare currentlyexpression ofphilosophy offor more thancivilizationson the islandselectedIndexcan result in\" value=\"\" />the structure /></a></div>Many of thesecaused by theof the Unitedspan class=\"mcan be tracedis related tobecame one ofis frequentlyliving in thetheoreticallyFollowing theRevolutionarygovernment inis determinedthe politicalintroduced insufficient todescription\">short storiesseparation ofas to whetherknown for itswas initiallydisplay:blockis an examplethe principalconsists of arecognized as/body></html>a substantialreconstructedhead of stateresistance toundergraduateThere are twogravitationalare describedintentionallyserved as theclass=\"headeropposition tofundamentallydominated theand the otheralliance withwas forced torespectively,and politicalin support ofpeople in the20th century.and publishedloadChartbeatto understandmember statesenvironmentalfirst half ofcountries andarchitecturalbe consideredcharacterizedclearIntervalauthoritativeFederation ofwas succeededand there area consequencethe Presidentalso includedfree softwaresuccession ofdeveloped thewas destroyedaway from the;\n</script>\n<although theyfollowed by amore powerfulresulted in aUniversity ofHowever, manythe presidentHowever, someis thought tountil the endwas announcedare importantalso includes><input type=the center of DO NOT ALTERused to referthemes/?sort=that had beenthe basis forhas developedin the summercomparativelydescribed thesuch as thosethe resultingis impossiblevarious otherSouth Africanhave the sameeffectivenessin which case; text-align:structure and; background:regarding thesupported theis also knownstyle=\"marginincluding thebahasa Melayunorsk bokm\u00C3\u00A5lnorsk nynorsksloven\u00C5\u00A1\u00C4\u008Dinainternacionalcalificaci\u00C3\u00B3ncomunicaci\u00C3\u00B3nconstrucci\u00C3\u00B3n\"><div class=\"disambiguationDomainName', 'administrationsimultaneouslytransportationInternational margin-bottom:responsibility<![endif]-->\n</><meta name=\"implementationinfrastructurerepresentationborder-bottom:</head>\n<body>=http%3A%2F%2F<form method=\"method=\"post\" /favicon.ico\" });\n</script>\n.setAttribute(Administration= new Array();<![endif]-->\r\ndisplay:block;Unfortunately,\">&nbsp;</div>/favicon.ico\">='stylesheet' identification, for example,<li><a href=\"/an alternativeas a result ofpt\"></script>\ntype=\"submit\" \n(function() {recommendationform action=\"/transformationreconstruction.style.display According to hidden\" name=\"along with thedocument.body.approximately Communicationspost\" action=\"meaning &quot;--<![endif]-->Prime Ministercharacteristic</a> <a class=the history of onmouseover=\"the governmenthref=\"https://was originallywas introducedclassificationrepresentativeare considered<![endif]-->\n\ndepends on theUniversity of in contrast to placeholder=\"in the case ofinternational constitutionalstyle=\"border-: function() {Because of the-strict.dtd\">\n<table class=\"accompanied byaccount of the<script src=\"/nature of the the people in in addition tos); js.id = id\" width=\"100%\"regarding the Roman Catholican independentfollowing the .gif\" width=\"1the following discriminationarchaeologicalprime minister.js\"></script>combination of marginwidth=\"createElement(w.attachEvent(</a></td></tr>src=\"https://aIn particular, align=\"left\" Czech RepublicUnited Kingdomcorrespondenceconcluded that.html\" title=\"(function () {comes from theapplication of<span class=\"sbelieved to beement('script'</a>\n</li>\n<livery different><span class=\"option value=\"(also known as\t<li><a href=\"><input name=\"separated fromreferred to as valign=\"top\">founder of theattempting to carbon dioxide\n\n<div class=\"class=\"search-/body>\n</html>opportunity tocommunications</head>\r\n<body style=\"width:Ti\u00E1\u00BA\u00BFng Vi\u00E1\u00BB\u0087tchanges in theborder-color:#0\" border=\"0\" </span></div><was discovered\" type=\"text\" );\n</script>\n\nDepartment of ecclesiasticalthere has beenresulting from</body></html>has never beenthe first timein response toautomatically </div>\n\n<div iwas consideredpercent of the\" /></a></div>collection of descended fromsection of theaccept-charsetto be confusedmember of the padding-right:translation ofinterpretation href='http://whether or notThere are alsothere are manya small numberother parts ofimpossible to class=\"buttonlocated in the. However, theand eventuallyAt the end of because of itsrepresents the<form action=\" method=\"post\"it is possiblemore likely toan increase inhave also beencorresponds toannounced thatalign=\"right\">many countriesfor many yearsearliest knownbecause it waspt\"></script>\r valign=\"top\" inhabitants offollowing year\r\n<div class=\"million peoplecontroversial concerning theargue that thegovernment anda reference totransferred todescribing the style=\"color:although therebest known forsubmit\" name=\"multiplicationmore than one recognition ofCouncil of theedition of the <meta name=\"Entertainment away from the ;margin-right:at the time ofinvestigationsconnected withand many otheralthough it isbeginning with <span class=\"descendants of<span class=\"i align=\"right\"</head>\n<body aspects of thehas since beenEuropean Unionreminiscent ofmore difficultVice Presidentcomposition ofpassed throughmore importantfont-size:11pxexplanation ofthe concept ofwritten in the\t<span class=\"is one of the resemblance toon the groundswhich containsincluding the defined by thepublication ofmeans that theoutside of thesupport of the<input class=\"<span class=\"t(Math.random()most prominentdescription ofConstantinoplewere published<div class=\"seappears in the1\" height=\"1\" most importantwhich includeswhich had beendestruction ofthe population\n\t<div class=\"possibility ofsometimes usedappear to havesuccess of theintended to bepresent in thestyle=\"clear:b\r\n</script>\r\n<was founded ininterview with_id\" content=\"capital of the\r\n<link rel=\"srelease of thepoint out thatxMLHttpRequestand subsequentsecond largestvery importantspecificationssurface of theapplied to theforeign policy_setDomainNameestablished inis believed toIn addition tomeaning of theis named afterto protect theis representedDeclaration ofmore efficientClassificationother forms ofhe returned to<span class=\"cperformance of(function() {\rif and only ifregions of theleading to therelations withUnited Nationsstyle=\"height:other than theype\" content=\"Association of\n</head>\n<bodylocated on theis referred to(including theconcentrationsthe individualamong the mostthan any other/>\n<link rel=\" return false;the purpose ofthe ability to;color:#fff}\n.\n<span class=\"the subject ofdefinitions of>\r\n<link rel=\"claim that thehave developed<table width=\"celebration ofFollowing the to distinguish<span class=\"btakes place inunder the namenoted that the><![endif]-->\nstyle=\"margin-instead of theintroduced thethe process ofincreasing thedifferences inestimated thatespecially the/div><div id=\"was eventuallythroughout histhe differencesomething thatspan></span></significantly ></script>\r\n\r\nenvironmental to prevent thehave been usedespecially forunderstand theis essentiallywere the firstis the largesthave been made\" src=\"http://interpreted assecond half ofcrolling=\"no\" is composed ofII, Holy Romanis expected tohave their owndefined as thetraditionally have differentare often usedto ensure thatagreement withcontaining theare frequentlyinformation onexample is theresulting in a</a></li></ul> class=\"footerand especiallytype=\"button\" </span></span>which included>\n<meta name=\"considered thecarried out byHowever, it isbecame part ofin relation topopular in thethe capital ofwas officiallywhich has beenthe History ofalternative todifferent fromto support thesuggested thatin the process <div class=\"the foundationbecause of hisconcerned withthe universityopposed to thethe context of<span class=\"ptext\" name=\"q\"\t\t<div class=\"the scientificrepresented bymathematicianselected by thethat have been><div class=\"cdiv id=\"headerin particular,converted into);\n</script>\n<philosophical srpskohrvatskiti\u00E1\u00BA\u00BFng Vi\u00E1\u00BB\u0087t\u00D0\u00A0\u00D1\u0083\u00D1\u0081\u00D1\u0081\u00D0\u00BA\u00D0\u00B8\u00D0\u00B9\u00D1\u0080\u00D1\u0083\u00D1\u0081\u00D1\u0081\u00D0\u00BA\u00D0\u00B8\u00D0\u00B9investigaci\u00C3\u00B3nparticipaci\u00C3\u00B3n\u00D0\u00BA\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D1\u0080\u00D1\u008B\u00D0\u00B5\u00D0\u00BE\u00D0\u00B1\u00D0\u00BB\u00D0\u00B0\u00D1\u0081\u00D1\u0082\u00D0\u00B8\u00D0\u00BA\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D1\u0080\u00D1\u008B\u00D0\u00B9\u00D1\u0087\u00D0\u00B5\u00D0\u00BB\u00D0\u00BE\u00D0\u00B2\u00D0\u00B5\u00D0\u00BA\u00D1\u0081\u00D0\u00B8\u00D1\u0081\u00D1\u0082\u00D0\u00B5\u00D0\u00BC\u00D1\u008B\u00D0\u009D\u00D0\u00BE\u00D0\u00B2\u00D0\u00BE\u00D1\u0081\u00D1\u0082\u00D0\u00B8\u00D0\u00BA\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D1\u0080\u00D1\u008B\u00D1\u0085\u00D0\u00BE\u00D0\u00B1\u00D0\u00BB\u00D0\u00B0\u00D1\u0081\u00D1\u0082\u00D1\u008C\u00D0\u00B2\u00D1\u0080\u00D0\u00B5\u00D0\u00BC\u00D0\u00B5\u00D0\u00BD\u00D0\u00B8\u00D0\u00BA\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D1\u0080\u00D0\u00B0\u00D1\u008F\u00D1\u0081\u00D0\u00B5\u00D0\u00B3\u00D0\u00BE\u00D0\u00B4\u00D0\u00BD\u00D1\u008F\u00D1\u0081\u00D0\u00BA\u00D0\u00B0\u00D1\u0087\u00D0\u00B0\u00D1\u0082\u00D1\u008C\u00D0\u00BD\u00D0\u00BE\u00D0\u00B2\u00D0\u00BE\u00D1\u0081\u00D1\u0082\u00D0\u00B8\u00D0\u00A3\u00D0\u00BA\u00D1\u0080\u00D0\u00B0\u00D0\u00B8\u00D0\u00BD\u00D1\u008B\u00D0\u00B2\u00D0\u00BE\u00D0\u00BF\u00D1\u0080\u00D0\u00BE\u00D1\u0081\u00D1\u008B\u00D0\u00BA\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D1\u0080\u00D0\u00BE\u00D0\u00B9\u00D1\u0081\u00D0\u00B4\u00D0\u00B5\u00D0\u00BB\u00D0\u00B0\u00D1\u0082\u00D1\u008C\u00D0\u00BF\u00D0\u00BE\u00D0\u00BC\u00D0\u00BE\u00D1\u0089\u00D1\u008C\u00D1\u008E\u00D1\u0081\u00D1\u0080\u00D0\u00B5\u00D0\u00B4\u00D1\u0081\u00D1\u0082\u00D0\u00B2\u00D0\u00BE\u00D0\u00B1\u00D1\u0080\u00D0\u00B0\u00D0\u00B7\u00D0\u00BE\u00D0\u00BC\u00D1\u0081\u00D1\u0082\u00D0\u00BE\u00D1\u0080\u00D0\u00BE\u00D0\u00BD\u00D1\u008B\u00D1\u0083\u00D1\u0087\u00D0\u00B0\u00D1\u0081\u00D1\u0082\u00D0\u00B8\u00D0\u00B5\u00D1\u0082\u00D0\u00B5\u00D1\u0087\u00D0\u00B5\u00D0\u00BD\u00D0\u00B8\u00D0\u00B5\u00D0\u0093\u00D0\u00BB\u00D0\u00B0\u00D0\u00B2\u00D0\u00BD\u00D0\u00B0\u00D1\u008F\u00D0\u00B8\u00D1\u0081\u00D1\u0082\u00D0\u00BE\u00D1\u0080\u00D0\u00B8\u00D0\u00B8\u00D1\u0081\u00D0\u00B8\u00D1\u0081\u00D1\u0082\u00D0\u00B5\u00D0\u00BC\u00D0\u00B0\u00D1\u0080\u00D0\u00B5\u00D1\u0088\u00D0\u00B5\u00D0\u00BD\u00D0\u00B8\u00D1\u008F\u00D0\u00A1\u00D0\u00BA\u00D0\u00B0\u00D1\u0087\u00D0\u00B0\u00D1\u0082\u00D1\u008C\u00D0\u00BF\u00D0\u00BE\u00D1\u008D\u00D1\u0082\u00D0\u00BE\u00D0\u00BC\u00D1\u0083\u00D1\u0081\u00D0\u00BB\u00D0\u00B5\u00D0\u00B4\u00D1\u0083\u00D0\u00B5\u00D1\u0082\u00D1\u0081\u00D0\u00BA\u00D0\u00B0\u00D0\u00B7\u00D0\u00B0\u00D1\u0082\u00D1\u008C\u00D1\u0082\u00D0\u00BE\u00D0\u00B2\u00D0\u00B0\u00D1\u0080\u00D0\u00BE\u00D0\u00B2\u00D0\u00BA\u00D0\u00BE\u00D0\u00BD\u00D0\u00B5\u00D1\u0087\u00D0\u00BD\u00D0\u00BE\u00D1\u0080\u00D0\u00B5\u00D1\u0088\u00D0\u00B5\u00D0\u00BD\u00D0\u00B8\u00D0\u00B5\u00D0\u00BA\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D1\u0080\u00D0\u00BE\u00D0\u00B5\u00D0\u00BE\u00D1\u0080\u00D0\u00B3\u00D0\u00B0\u00D0\u00BD\u00D0\u00BE\u00D0\u00B2\u00D0\u00BA\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D1\u0080\u00D0\u00BE\u00D0\u00BC\u00D0\u00A0\u00D0\u00B5\u00D0\u00BA\u00D0\u00BB\u00D0\u00B0\u00D0\u00BC\u00D0\u00B0\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D9\u0086\u00D8\u00AA\u00D8\u00AF\u00D9\u0089\u00D9\u0085\u00D9\u0086\u00D8\u00AA\u00D8\u00AF\u00D9\u008A\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D9\u0088\u00D8\u00B6\u00D9\u0088\u00D8\u00B9\u00D8\u00A7\u00D9\u0084\u00D8\u00A8\u00D8\u00B1\u00D8\u00A7\u00D9\u0085\u00D8\u00AC\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D9\u0088\u00D8\u00A7\u00D9\u0082\u00D8\u00B9\u00D8\u00A7\u00D9\u0084\u00D8\u00B1\u00D8\u00B3\u00D8\u00A7\u00D8\u00A6\u00D9\u0084\u00D9\u0085\u00D8\u00B4\u00D8\u00A7\u00D8\u00B1\u00D9\u0083\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D8\u00A3\u00D8\u00B9\u00D8\u00B6\u00D8\u00A7\u00D8\u00A1\u00D8\u00A7\u00D9\u0084\u00D8\u00B1\u00D9\u008A\u00D8\u00A7\u00D8\u00B6\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00AA\u00D8\u00B5\u00D9\u0085\u00D9\u008A\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D8\u00B9\u00D8\u00B6\u00D8\u00A7\u00D8\u00A1\u00D8\u00A7\u00D9\u0084\u00D9\u0086\u00D8\u00AA\u00D8\u00A7\u00D8\u00A6\u00D8\u00AC\u00D8\u00A7\u00D9\u0084\u00D8\u00A3\u00D9\u0084\u00D8\u00B9\u00D8\u00A7\u00D8\u00A8\u00D8\u00A7\u00D9\u0084\u00D8\u00AA\u00D8\u00B3\u00D8\u00AC\u00D9\u008A\u00D9\u0084\u00D8\u00A7\u00D9\u0084\u00D8\u00A3\u00D9\u0082\u00D8\u00B3\u00D8\u00A7\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D8\u00B6\u00D8\u00BA\u00D8\u00B7\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D9\u0081\u00D9\u008A\u00D8\u00AF\u00D9\u008A\u00D9\u0088\u00D8\u00A7\u00D9\u0084\u00D8\u00AA\u00D8\u00B1\u00D8\u00AD\u00D9\u008A\u00D8\u00A8\u00D8\u00A7\u00D9\u0084\u00D8\u00AC\u00D8\u00AF\u00D9\u008A\u00D8\u00AF\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00AA\u00D8\u00B9\u00D9\u0084\u00D9\u008A\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D8\u00A3\u00D8\u00AE\u00D8\u00A8\u00D8\u00A7\u00D8\u00B1\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D9\u0081\u00D9\u0084\u00D8\u00A7\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D8\u00A3\u00D9\u0081\u00D9\u0084\u00D8\u00A7\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D8\u00AA\u00D8\u00A7\u00D8\u00B1\u00D9\u008A\u00D8\u00AE\u00D8\u00A7\u00D9\u0084\u00D8\u00AA\u00D9\u0082\u00D9\u0086\u00D9\u008A\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D8\u00A7\u00D8\u00A8\u00D8\u00A7\u00D9\u0084\u00D8\u00AE\u00D9\u0088\u00D8\u00A7\u00D8\u00B7\u00D8\u00B1\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00AC\u00D8\u00AA\u00D9\u0085\u00D8\u00B9\u00D8\u00A7\u00D9\u0084\u00D8\u00AF\u00D9\u008A\u00D9\u0083\u00D9\u0088\u00D8\u00B1\u00D8\u00A7\u00D9\u0084\u00D8\u00B3\u00D9\u008A\u00D8\u00A7\u00D8\u00AD\u00D8\u00A9\u00D8\u00B9\u00D8\u00A8\u00D8\u00AF\u00D8\u00A7\u00D9\u0084\u00D9\u0084\u00D9\u0087\u00D8\u00A7\u00D9\u0084\u00D8\u00AA\u00D8\u00B1\u00D8\u00A8\u00D9\u008A\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00B1\u00D9\u0088\u00D8\u00A7\u00D8\u00A8\u00D8\u00B7\u00D8\u00A7\u00D9\u0084\u00D8\u00A3\u00D8\u00AF\u00D8\u00A8\u00D9\u008A\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D8\u00AE\u00D8\u00A8\u00D8\u00A7\u00D8\u00B1\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00AA\u00D8\u00AD\u00D8\u00AF\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D8\u00BA\u00D8\u00A7\u00D9\u0086\u00D9\u008Acursor:pointer;</title>\n<meta \" href=\"http://\"><span class=\"members of the window.locationvertical-align:/a> | <a href=\"<!doctype html>media=\"screen\" <option value=\"favicon.ico\" />\n\t\t<div class=\"characteristics\" method=\"get\" /body>\n</html>\nshortcut icon\" document.write(padding-bottom:representativessubmit\" value=\"align=\"center\" throughout the science fiction\n <div class=\"submit\" class=\"one of the most valign=\"top\"><was established);\r\n</script>\r\nreturn false;\">).style.displaybecause of the document.cookie<form action=\"/}body{margin:0;Encyclopedia ofversion of the .createElement(name\" content=\"</div>\n</div>\n\nadministrative </body>\n</html>history of the \"><input type=\"portion of the as part of the &nbsp;<a href=\"other countries\">\n<div class=\"</span></span><In other words,display: block;control of the introduction of/>\n<meta name=\"as well as the in recent years\r\n\t<div class=\"</div>\n\t</div>\ninspired by thethe end of the compatible withbecame known as style=\"margin:.js\"></script>< International there have beenGerman language style=\"color:#Communist Partyconsistent withborder=\"0\" cell marginheight=\"the majority of\" align=\"centerrelated to the many different Orthodox Churchsimilar to the />\n<link rel=\"swas one of the until his death})();\n</script>other languagescompared to theportions of thethe Netherlandsthe most commonbackground:url(argued that thescrolling=\"no\" included in theNorth American the name of theinterpretationsthe traditionaldevelopment of frequently useda collection ofvery similar tosurrounding theexample of thisalign=\"center\">would have beenimage_caption =attached to thesuggesting thatin the form of involved in theis derived fromnamed after theIntroduction torestrictions on style=\"width: can be used to the creation ofmost important information andresulted in thecollapse of theThis means thatelements of thewas replaced byanalysis of theinspiration forregarded as themost successfulknown as &quot;a comprehensiveHistory of the were consideredreturned to theare referred toUnsourced image>\n\t<div class=\"consists of thestopPropagationinterest in theavailability ofappears to haveelectromagneticenableServices(function of theIt is important</script></div>function(){var relative to theas a result of the position ofFor example, in method=\"post\" was followed by&amp;mdash; thethe applicationjs\"></script>\r\nul></div></div>after the deathwith respect tostyle=\"padding:is particularlydisplay:inline; type=\"submit\" is divided into\u00E4\u00B8\u00AD\u00E6\u0096\u0087 (\u00E7\u00AE\u0080\u00E4\u00BD\u0093)responsabilidadadministraci\u00C3\u00B3ninternacionalescorrespondiente\u00E0\u00A4\u0089\u00E0\u00A4\u00AA\u00E0\u00A4\u00AF\u00E0\u00A5\u008B\u00E0\u00A4\u0097\u00E0\u00A4\u00AA\u00E0\u00A5\u0082\u00E0\u00A4\u00B0\u00E0\u00A5\u008D\u00E0\u00A4\u00B5\u00E0\u00A4\u00B9\u00E0\u00A4\u00AE\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A5\u0087\u00E0\u00A4\u00B2\u00E0\u00A5\u008B\u00E0\u00A4\u0097\u00E0\u00A5\u008B\u00E0\u00A4\u0082\u00E0\u00A4\u009A\u00E0\u00A5\u0081\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00B5\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u0095\u00E0\u00A4\u00BF\u00E0\u00A4\u00A8\u00E0\u00A4\u00B8\u00E0\u00A4\u00B0\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00AA\u00E0\u00A5\u0081\u00E0\u00A4\u00B2\u00E0\u00A4\u00BF\u00E0\u00A4\u00B8\u00E0\u00A4\u0096\u00E0\u00A5\u008B\u00E0\u00A4\u009C\u00E0\u00A5\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u009A\u00E0\u00A4\u00BE\u00E0\u00A4\u00B9\u00E0\u00A4\u00BF\u00E0\u00A4\u008F\u00E0\u00A4\u00AD\u00E0\u00A5\u0087\u00E0\u00A4\u009C\u00E0\u00A5\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u00B6\u00E0\u00A4\u00BE\u00E0\u00A4\u00AE\u00E0\u00A4\u00BF\u00E0\u00A4\u00B2\u00E0\u00A4\u00B9\u00E0\u00A4\u00AE\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A5\u0080\u00E0\u00A4\u009C\u00E0\u00A4\u00BE\u00E0\u00A4\u0097\u00E0\u00A4\u00B0\u00E0\u00A4\u00A3\u00E0\u00A4\u00AC\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u0095\u00E0\u00A5\u0081\u00E0\u00A4\u00AE\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00AC\u00E0\u00A5\u008D\u00E0\u00A4\u00B2\u00E0\u00A5\u0089\u00E0\u00A4\u0097\u00E0\u00A4\u00AE\u00E0\u00A4\u00BE\u00E0\u00A4\u00B2\u00E0\u00A4\u00BF\u00E0\u00A4\u0095\u00E0\u00A4\u00AE\u00E0\u00A4\u00B9\u00E0\u00A4\u00BF\u00E0\u00A4\u00B2\u00E0\u00A4\u00BE\u00E0\u00A4\u00AA\u00E0\u00A5\u0083\u00E0\u00A4\u00B7\u00E0\u00A5\u008D\u00E0\u00A4\u00A0\u00E0\u00A4\u00AC\u00E0\u00A4\u00A2\u00E0\u00A4\u00BC\u00E0\u00A4\u00A4\u00E0\u00A5\u0087\u00E0\u00A4\u00AD\u00E0\u00A4\u00BE\u00E0\u00A4\u009C\u00E0\u00A4\u00AA\u00E0\u00A4\u00BE\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00B2\u00E0\u00A4\u00BF\u00E0\u00A4\u0095\u00E0\u00A4\u009F\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A5\u0087\u00E0\u00A4\u00A8\u00E0\u00A4\u0096\u00E0\u00A4\u00BF\u00E0\u00A4\u00B2\u00E0\u00A4\u00BE\u00E0\u00A4\u00AB\u00E0\u00A4\u00A6\u00E0\u00A5\u008C\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A4\u00AE\u00E0\u00A4\u00BE\u00E0\u00A4\u00AE\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u00AE\u00E0\u00A4\u00A4\u00E0\u00A4\u00A6\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A4\u00AC\u00E0\u00A4\u00BE\u00E0\u00A4\u009C\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00B5\u00E0\u00A4\u00BF\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00AF\u00E0\u00A5\u008B\u00E0\u00A4\u0082\u00E0\u00A4\u009A\u00E0\u00A4\u00BE\u00E0\u00A4\u00B9\u00E0\u00A4\u00A4\u00E0\u00A5\u0087\u00E0\u00A4\u00AA\u00E0\u00A4\u00B9\u00E0\u00A5\u0081\u00E0\u00A4\u0081\u00E0\u00A4\u009A\u00E0\u00A4\u00AC\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A4\u0082\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u00A6\u00E0\u00A4\u00A6\u00E0\u00A5\u0087\u00E0\u00A4\u0096\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u00AA\u00E0\u00A4\u00BF\u00E0\u00A4\u009B\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u00B5\u00E0\u00A4\u00BF\u00E0\u00A4\u00B6\u00E0\u00A5\u0087\u00E0\u00A4\u00B7\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u009C\u00E0\u00A5\u008D\u00E0\u00A4\u00AF\u00E0\u00A4\u0089\u00E0\u00A4\u00A4\u00E0\u00A5\u008D\u00E0\u00A4\u00A4\u00E0\u00A4\u00B0\u00E0\u00A4\u00AE\u00E0\u00A5\u0081\u00E0\u00A4\u0082\u00E0\u00A4\u00AC\u00E0\u00A4\u0088\u00E0\u00A4\u00A6\u00E0\u00A5\u008B\u00E0\u00A4\u00A8\u00E0\u00A5\u008B\u00E0\u00A4\u0082\u00E0\u00A4\u0089\u00E0\u00A4\u00AA\u00E0\u00A4\u0095\u00E0\u00A4\u00B0\u00E0\u00A4\u00A3\u00E0\u00A4\u00AA\u00E0\u00A4\u00A2\u00E0\u00A4\u00BC\u00E0\u00A5\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u00B8\u00E0\u00A5\u008D\u00E0\u00A4\u00A5\u00E0\u00A4\u00BF\u00E0\u00A4\u00A4\u00E0\u00A4\u00AB\u00E0\u00A4\u00BF\u00E0\u00A4\u00B2\u00E0\u00A5\u008D\u00E0\u00A4\u00AE\u00E0\u00A4\u00AE\u00E0\u00A5\u0081\u00E0\u00A4\u0096\u00E0\u00A5\u008D\u00E0\u00A4\u00AF\u00E0\u00A4\u0085\u00E0\u00A4\u009A\u00E0\u00A5\u008D\u00E0\u00A4\u009B\u00E0\u00A4\u00BE\u00E0\u00A4\u009B\u00E0\u00A5\u0082\u00E0\u00A4\u009F\u00E0\u00A4\u00A4\u00E0\u00A5\u0080\u00E0\u00A4\u00B8\u00E0\u00A4\u0082\u00E0\u00A4\u0097\u00E0\u00A5\u0080\u00E0\u00A4\u00A4\u00E0\u00A4\u009C\u00E0\u00A4\u00BE\u00E0\u00A4\u008F\u00E0\u00A4\u0097\u00E0\u00A4\u00BE\u00E0\u00A4\u00B5\u00E0\u00A4\u00BF\u00E0\u00A4\u00AD\u00E0\u00A4\u00BE\u00E0\u00A4\u0097\u00E0\u00A4\u0098\u00E0\u00A4\u00A3\u00E0\u00A5\u008D\u00E0\u00A4\u009F\u00E0\u00A5\u0087\u00E0\u00A4\u00A6\u00E0\u00A5\u0082\u00E0\u00A4\u00B8\u00E0\u00A4\u00B0\u00E0\u00A5\u0087\u00E0\u00A4\u00A6\u00E0\u00A4\u00BF\u00E0\u00A4\u00A8\u00E0\u00A5\u008B\u00E0\u00A4\u0082\u00E0\u00A4\u00B9\u00E0\u00A4\u00A4\u00E0\u00A5\u008D\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A5\u0087\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00B8\u00E0\u00A4\u0097\u00E0\u00A4\u00BE\u00E0\u00A4\u0082\u00E0\u00A4\u00A7\u00E0\u00A5\u0080\u00E0\u00A4\u00B5\u00E0\u00A4\u00BF\u00E0\u00A4\u00B6\u00E0\u00A5\u008D\u00E0\u00A4\u00B5\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u00A4\u00E0\u00A5\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u00A6\u00E0\u00A5\u0088\u00E0\u00A4\u009F\u00E0\u00A5\u008D\u00E0\u00A4\u00B8\u00E0\u00A4\u00A8\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00B6\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A4\u00BE\u00E0\u00A4\u00AE\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u0085\u00E0\u00A4\u00A6\u00E0\u00A4\u00BE\u00E0\u00A4\u00B2\u00E0\u00A4\u00A4\u00E0\u00A4\u00AC\u00E0\u00A4\u00BF\u00E0\u00A4\u009C\u00E0\u00A4\u00B2\u00E0\u00A5\u0080\u00E0\u00A4\u00AA\u00E0\u00A5\u0081\u00E0\u00A4\u00B0\u00E0\u00A5\u0082\u00E0\u00A4\u00B7\u00E0\u00A4\u00B9\u00E0\u00A4\u00BF\u00E0\u00A4\u0082\u00E0\u00A4\u00A6\u00E0\u00A5\u0080\u00E0\u00A4\u00AE\u00E0\u00A4\u00BF\u00E0\u00A4\u00A4\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u0095\u00E0\u00A4\u00B5\u00E0\u00A4\u00BF\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A5\u0081\u00E0\u00A4\u00AA\u00E0\u00A4\u00AF\u00E0\u00A5\u0087\u00E0\u00A4\u00B8\u00E0\u00A5\u008D\u00E0\u00A4\u00A5\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A4\u0095\u00E0\u00A4\u00B0\u00E0\u00A5\u008B\u00E0\u00A4\u00A1\u00E0\u00A4\u00BC\u00E0\u00A4\u00AE\u00E0\u00A5\u0081\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00A4\u00E0\u00A4\u00AF\u00E0\u00A5\u008B\u00E0\u00A4\u009C\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u0095\u00E0\u00A5\u0083\u00E0\u00A4\u00AA\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00AA\u00E0\u00A5\u008B\u00E0\u00A4\u00B8\u00E0\u00A5\u008D\u00E0\u00A4\u009F\u00E0\u00A4\u0098\u00E0\u00A4\u00B0\u00E0\u00A5\u0087\u00E0\u00A4\u00B2\u00E0\u00A5\u0082\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A5\u008D\u00E0\u00A4\u00AF\u00E0\u00A4\u00B5\u00E0\u00A4\u00BF\u00E0\u00A4\u009A\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00B8\u00E0\u00A5\u0082\u00E0\u00A4\u009A\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00AE\u00E0\u00A5\u0082\u00E0\u00A4\u00B2\u00E0\u00A5\u008D\u00E0\u00A4\u00AF\u00E0\u00A4\u00A6\u00E0\u00A5\u0087\u00E0\u00A4\u0096\u00E0\u00A5\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u00B9\u00E0\u00A4\u00AE\u00E0\u00A5\u0087\u00E0\u00A4\u00B6\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A5\u008D\u00E0\u00A4\u0095\u00E0\u00A5\u0082\u00E0\u00A4\u00B2\u00E0\u00A4\u00AE\u00E0\u00A5\u0088\u00E0\u00A4\u0082\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u00A4\u00E0\u00A5\u0088\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u009C\u00E0\u00A4\u00BF\u00E0\u00A4\u00B8\u00E0\u00A4\u0095\u00E0\u00A5\u0087rss+xml\" title=\"-type\" content=\"title\" content=\"at the same time.js\"></script>\n<\" method=\"post\" </span></a></li>vertical-align:t/jquery.min.js\">.click(function( style=\"padding-})();\n</script>\n</span><a href=\"<a href=\"http://); return false;text-decoration: scrolling=\"no\" border-collapse:associated with Bahasa IndonesiaEnglish language<text xml:space=.gif\" border=\"0\"</body>\n</html>\noverflow:hidden;img src=\"http://addEventListenerresponsible for s.js\"></script>\n/favicon.ico\" />operating system\" style=\"width:1target=\"_blank\">State Universitytext-align:left;\ndocument.write(, including the around the world);\r\n</script>\r\n<\" style=\"height:;overflow:hiddenmore informationan internationala member of the one of the firstcan be found in </div>\n\t\t</div>\ndisplay: none;\">\" />\n<link rel=\"\n (function() {the 15th century.preventDefault(large number of Byzantine Empire.jpg|thumb|left|vast majority ofmajority of the align=\"center\">University Pressdominated by theSecond World Wardistribution of style=\"position:the rest of the characterized by rel=\"nofollow\">derives from therather than the a combination ofstyle=\"width:100English-speakingcomputer scienceborder=\"0\" alt=\"the existence ofDemocratic Party\" style=\"margin-For this reason,.js\"></script>\n\tsByTagName(s)[0]js\"></script>\r\n<.js\"></script>\r\nlink rel=\"icon\" ' alt='' class='formation of theversions of the </a></div></div>/page>\n <page>\n<div class=\"contbecame the firstbahasa Indonesiaenglish (simple)\u00CE\u0095\u00CE\u00BB\u00CE\u00BB\u00CE\u00B7\u00CE\u00BD\u00CE\u00B9\u00CE\u00BA\u00CE\u00AC\u00D1\u0085\u00D1\u0080\u00D0\u00B2\u00D0\u00B0\u00D1\u0082\u00D1\u0081\u00D0\u00BA\u00D0\u00B8\u00D0\u00BA\u00D0\u00BE\u00D0\u00BC\u00D0\u00BF\u00D0\u00B0\u00D0\u00BD\u00D0\u00B8\u00D0\u00B8\u00D1\u008F\u00D0\u00B2\u00D0\u00BB\u00D1\u008F\u00D0\u00B5\u00D1\u0082\u00D1\u0081\u00D1\u008F\u00D0\u0094\u00D0\u00BE\u00D0\u00B1\u00D0\u00B0\u00D0\u00B2\u00D0\u00B8\u00D1\u0082\u00D1\u008C\u00D1\u0087\u00D0\u00B5\u00D0\u00BB\u00D0\u00BE\u00D0\u00B2\u00D0\u00B5\u00D0\u00BA\u00D0\u00B0\u00D1\u0080\u00D0\u00B0\u00D0\u00B7\u00D0\u00B2\u00D0\u00B8\u00D1\u0082\u00D0\u00B8\u00D1\u008F\u00D0\u0098\u00D0\u00BD\u00D1\u0082\u00D0\u00B5\u00D1\u0080\u00D0\u00BD\u00D0\u00B5\u00D1\u0082\u00D0\u009E\u00D1\u0082\u00D0\u00B2\u00D0\u00B5\u00D1\u0082\u00D0\u00B8\u00D1\u0082\u00D1\u008C\u00D0\u00BD\u00D0\u00B0\u00D0\u00BF\u00D1\u0080\u00D0\u00B8\u00D0\u00BC\u00D0\u00B5\u00D1\u0080\u00D0\u00B8\u00D0\u00BD\u00D1\u0082\u00D0\u00B5\u00D1\u0080\u00D0\u00BD\u00D0\u00B5\u00D1\u0082\u00D0\u00BA\u00D0\u00BE\u00D1\u0082\u00D0\u00BE\u00D1\u0080\u00D0\u00BE\u00D0\u00B3\u00D0\u00BE\u00D1\u0081\u00D1\u0082\u00D1\u0080\u00D0\u00B0\u00D0\u00BD\u00D0\u00B8\u00D1\u0086\u00D1\u008B\u00D0\u00BA\u00D0\u00B0\u00D1\u0087\u00D0\u00B5\u00D1\u0081\u00D1\u0082\u00D0\u00B2\u00D0\u00B5\u00D1\u0083\u00D1\u0081\u00D0\u00BB\u00D0\u00BE\u00D0\u00B2\u00D0\u00B8\u00D1\u008F\u00D1\u0085\u00D0\u00BF\u00D1\u0080\u00D0\u00BE\u00D0\u00B1\u00D0\u00BB\u00D0\u00B5\u00D0\u00BC\u00D1\u008B\u00D0\u00BF\u00D0\u00BE\u00D0\u00BB\u00D1\u0083\u00D1\u0087\u00D0\u00B8\u00D1\u0082\u00D1\u008C\u00D1\u008F\u00D0\u00B2\u00D0\u00BB\u00D1\u008F\u00D1\u008E\u00D1\u0082\u00D1\u0081\u00D1\u008F\u00D0\u00BD\u00D0\u00B0\u00D0\u00B8\u00D0\u00B1\u00D0\u00BE\u00D0\u00BB\u00D0\u00B5\u00D0\u00B5\u00D0\u00BA\u00D0\u00BE\u00D0\u00BC\u00D0\u00BF\u00D0\u00B0\u00D0\u00BD\u00D0\u00B8\u00D1\u008F\u00D0\u00B2\u00D0\u00BD\u00D0\u00B8\u00D0\u00BC\u00D0\u00B0\u00D0\u00BD\u00D0\u00B8\u00D0\u00B5\u00D1\u0081\u00D1\u0080\u00D0\u00B5\u00D0\u00B4\u00D1\u0081\u00D1\u0082\u00D0\u00B2\u00D0\u00B0\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D9\u0088\u00D8\u00A7\u00D8\u00B6\u00D9\u008A\u00D8\u00B9\u00D8\u00A7\u00D9\u0084\u00D8\u00B1\u00D8\u00A6\u00D9\u008A\u00D8\u00B3\u00D9\u008A\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D9\u0086\u00D8\u00AA\u00D9\u0082\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00B4\u00D8\u00A7\u00D8\u00B1\u00D9\u0083\u00D8\u00A7\u00D8\u00AA\u00D9\u0083\u00D8\u00A7\u00D9\u0084\u00D8\u00B3\u00D9\u008A\u00D8\u00A7\u00D8\u00B1\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D9\u0083\u00D8\u00AA\u00D9\u0088\u00D8\u00A8\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00B3\u00D8\u00B9\u00D9\u0088\u00D8\u00AF\u00D9\u008A\u00D8\u00A9\u00D8\u00A7\u00D8\u00AD\u00D8\u00B5\u00D8\u00A7\u00D8\u00A6\u00D9\u008A\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D8\u00B9\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D9\u008A\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00B5\u00D9\u0088\u00D8\u00AA\u00D9\u008A\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D9\u0086\u00D8\u00AA\u00D8\u00B1\u00D9\u0086\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D8\u00AA\u00D8\u00B5\u00D8\u00A7\u00D9\u0085\u00D9\u008A\u00D9\u0085\u00D8\u00A7\u00D9\u0084\u00D8\u00A5\u00D8\u00B3\u00D9\u0084\u00D8\u00A7\u00D9\u0085\u00D9\u008A\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00B4\u00D8\u00A7\u00D8\u00B1\u00D9\u0083\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00B1\u00D8\u00A6\u00D9\u008A\u00D8\u00A7\u00D8\u00AArobots\" content=\"<div id=\"footer\">the United States<img src=\"http://.jpg|right|thumb|.js\"></script>\r\n<location.protocolframeborder=\"0\" s\" />\n<meta name=\"</a></div></div><font-weight:bold;&quot; and &quot;depending on the margin:0;padding:\" rel=\"nofollow\" President of the twentieth centuryevision>\n </pageInternet Explorera.async = true;\r\ninformation about<div id=\"header\">\" action=\"http://<a href=\"https://<div id=\"content\"</div>\r\n</div>\r\n<derived from the <img src='http://according to the \n</body>\n</html>\nstyle=\"font-size:script language=\"Arial, Helvetica,</a><span class=\"</script><script political partiestd></tr></table><href=\"http://www.interpretation ofrel=\"stylesheet\" document.write('<charset=\"utf-8\">\nbeginning of the revealed that thetelevision series\" rel=\"nofollow\"> target=\"_blank\">claiming that thehttp%3A%2F%2Fwww.manifestations ofPrime Minister ofinfluenced by theclass=\"clearfix\">/div>\r\n</div>\r\n\r\nthree-dimensionalChurch of Englandof North Carolinasquare kilometres.addEventListenerdistinct from thecommonly known asPhonetic Alphabetdeclared that thecontrolled by theBenjamin Franklinrole-playing gamethe University ofin Western Europepersonal computerProject Gutenbergregardless of thehas been proposedtogether with the></li><li class=\"in some countriesmin.js\"></script>of the populationofficial language<img src=\"images/identified by thenatural resourcesclassification ofcan be consideredquantum mechanicsNevertheless, themillion years ago</body>\r\n</html>\r\u00CE\u0095\u00CE\u00BB\u00CE\u00BB\u00CE\u00B7\u00CE\u00BD\u00CE\u00B9\u00CE\u00BA\u00CE\u00AC\ntake advantage ofand, according toattributed to theMicrosoft Windowsthe first centuryunder the controldiv class=\"headershortly after thenotable exceptiontens of thousandsseveral differentaround the world.reaching militaryisolated from theopposition to thethe Old TestamentAfrican Americansinserted into theseparate from themetropolitan areamakes it possibleacknowledged thatarguably the mosttype=\"text/css\">\nthe InternationalAccording to the pe=\"text/css\" />\ncoincide with thetwo-thirds of theDuring this time,during the periodannounced that hethe internationaland more recentlybelieved that theconsciousness andformerly known assurrounded by thefirst appeared inoccasionally usedposition:absolute;\" target=\"_blank\" position:relative;text-align:center;jax/libs/jquery/1.background-color:#type=\"application/anguage\" content=\"<meta http-equiv=\"Privacy Policy</a>e(\"%3Cscript src='\" target=\"_blank\">On the other hand,.jpg|thumb|right|2</div><div class=\"<div style=\"float:nineteenth century</body>\r\n</html>\r\n<img src=\"http://s;text-align:centerfont-weight: bold; According to the difference between\" frameborder=\"0\" \" style=\"position:link href=\"http://html4/loose.dtd\">\nduring this period</td></tr></table>closely related tofor the first time;font-weight:bold;input type=\"text\" <span style=\"font-onreadystatechange\t<div class=\"cleardocument.location. For example, the a wide variety of <!DOCTYPE html>\r\n<&nbsp;&nbsp;&nbsp;\"><a href=\"http://style=\"float:left;concerned with the=http%3A%2F%2Fwww.in popular culturetype=\"text/css\" />it is possible to Harvard Universitytylesheet\" href=\"/the main characterOxford University name=\"keywords\" cstyle=\"text-align:the United Kingdomfederal government<div style=\"margin depending on the description of the<div class=\"header.min.js\"></script>destruction of theslightly differentin accordance withtelecommunicationsindicates that theshortly thereafterespecially in the European countriesHowever, there aresrc=\"http://staticsuggested that the\" src=\"http://www.a large number of Telecommunications\" rel=\"nofollow\" tHoly Roman Emperoralmost exclusively\" border=\"0\" alt=\"Secretary of Stateculminating in theCIA World Factbookthe most importantanniversary of thestyle=\"background-<li><em><a href=\"/the Atlantic Oceanstrictly speaking,shortly before thedifferent types ofthe Ottoman Empire><img src=\"http://An Introduction toconsequence of thedeparture from theConfederate Statesindigenous peoplesProceedings of theinformation on thetheories have beeninvolvement in thedivided into threeadjacent countriesis responsible fordissolution of thecollaboration withwidely regarded ashis contemporariesfounding member ofDominican Republicgenerally acceptedthe possibility ofare also availableunder constructionrestoration of thethe general publicis almost entirelypasses through thehas been suggestedcomputer and videoGermanic languages according to the different from theshortly afterwardshref=\"https://www.recent developmentBoard of Directors<div class=\"search| <a href=\"http://In particular, theMultiple footnotesor other substancethousands of yearstranslation of the</div>\r\n</div>\r\n\r\n<a href=\"index.phpwas established inmin.js\"></script>\nparticipate in thea strong influencestyle=\"margin-top:represented by thegraduated from theTraditionally, theElement(\"script\");However, since the/div>\n</div>\n<div left; margin-left:protection against0; vertical-align:Unfortunately, thetype=\"image/x-icon/div>\n<div class=\" class=\"clearfix\"><div class=\"footer\t\t</div>\n\t\t</div>\nthe motion picture\u00D0\u0091\u00D1\u008A\u00D0\u00BB\u00D0\u00B3\u00D0\u00B0\u00D1\u0080\u00D1\u0081\u00D0\u00BA\u00D0\u00B8\u00D0\u00B1\u00D1\u008A\u00D0\u00BB\u00D0\u00B3\u00D0\u00B0\u00D1\u0080\u00D1\u0081\u00D0\u00BA\u00D0\u00B8\u00D0\u00A4\u00D0\u00B5\u00D0\u00B4\u00D0\u00B5\u00D1\u0080\u00D0\u00B0\u00D1\u0086\u00D0\u00B8\u00D0\u00B8\u00D0\u00BD\u00D0\u00B5\u00D1\u0081\u00D0\u00BA\u00D0\u00BE\u00D0\u00BB\u00D1\u008C\u00D0\u00BA\u00D0\u00BE\u00D1\u0081\u00D0\u00BE\u00D0\u00BE\u00D0\u00B1\u00D1\u0089\u00D0\u00B5\u00D0\u00BD\u00D0\u00B8\u00D0\u00B5\u00D1\u0081\u00D0\u00BE\u00D0\u00BE\u00D0\u00B1\u00D1\u0089\u00D0\u00B5\u00D0\u00BD\u00D0\u00B8\u00D1\u008F\u00D0\u00BF\u00D1\u0080\u00D0\u00BE\u00D0\u00B3\u00D1\u0080\u00D0\u00B0\u00D0\u00BC\u00D0\u00BC\u00D1\u008B\u00D0\u009E\u00D1\u0082\u00D0\u00BF\u00D1\u0080\u00D0\u00B0\u00D0\u00B2\u00D0\u00B8\u00D1\u0082\u00D1\u008C\u00D0\u00B1\u00D0\u00B5\u00D1\u0081\u00D0\u00BF\u00D0\u00BB\u00D0\u00B0\u00D1\u0082\u00D0\u00BD\u00D0\u00BE\u00D0\u00BC\u00D0\u00B0\u00D1\u0082\u00D0\u00B5\u00D1\u0080\u00D0\u00B8\u00D0\u00B0\u00D0\u00BB\u00D1\u008B\u00D0\u00BF\u00D0\u00BE\u00D0\u00B7\u00D0\u00B2\u00D0\u00BE\u00D0\u00BB\u00D1\u008F\u00D0\u00B5\u00D1\u0082\u00D0\u00BF\u00D0\u00BE\u00D1\u0081\u00D0\u00BB\u00D0\u00B5\u00D0\u00B4\u00D0\u00BD\u00D0\u00B8\u00D0\u00B5\u00D1\u0080\u00D0\u00B0\u00D0\u00B7\u00D0\u00BB\u00D0\u00B8\u00D1\u0087\u00D0\u00BD\u00D1\u008B\u00D1\u0085\u00D0\u00BF\u00D1\u0080\u00D0\u00BE\u00D0\u00B4\u00D1\u0083\u00D0\u00BA\u00D1\u0086\u00D0\u00B8\u00D0\u00B8\u00D0\u00BF\u00D1\u0080\u00D0\u00BE\u00D0\u00B3\u00D1\u0080\u00D0\u00B0\u00D0\u00BC\u00D0\u00BC\u00D0\u00B0\u00D0\u00BF\u00D0\u00BE\u00D0\u00BB\u00D0\u00BD\u00D0\u00BE\u00D1\u0081\u00D1\u0082\u00D1\u008C\u00D1\u008E\u00D0\u00BD\u00D0\u00B0\u00D1\u0085\u00D0\u00BE\u00D0\u00B4\u00D0\u00B8\u00D1\u0082\u00D1\u0081\u00D1\u008F\u00D0\u00B8\u00D0\u00B7\u00D0\u00B1\u00D1\u0080\u00D0\u00B0\u00D0\u00BD\u00D0\u00BD\u00D0\u00BE\u00D0\u00B5\u00D0\u00BD\u00D0\u00B0\u00D1\u0081\u00D0\u00B5\u00D0\u00BB\u00D0\u00B5\u00D0\u00BD\u00D0\u00B8\u00D1\u008F\u00D0\u00B8\u00D0\u00B7\u00D0\u00BC\u00D0\u00B5\u00D0\u00BD\u00D0\u00B5\u00D0\u00BD\u00D0\u00B8\u00D1\u008F\u00D0\u00BA\u00D0\u00B0\u00D1\u0082\u00D0\u00B5\u00D0\u00B3\u00D0\u00BE\u00D1\u0080\u00D0\u00B8\u00D0\u00B8\u00D0\u0090\u00D0\u00BB\u00D0\u00B5\u00D0\u00BA\u00D1\u0081\u00D0\u00B0\u00D0\u00BD\u00D0\u00B4\u00D1\u0080\u00E0\u00A4\u00A6\u00E0\u00A5\u008D\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u00AE\u00E0\u00A5\u0088\u00E0\u00A4\u00A8\u00E0\u00A5\u0081\u00E0\u00A4\u0085\u00E0\u00A4\u00B2\u00E0\u00A4\u00AA\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00A6\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A4\u00AD\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00A4\u00E0\u00A5\u0080\u00E0\u00A4\u00AF\u00E0\u00A4\u0085\u00E0\u00A4\u00A8\u00E0\u00A5\u0081\u00E0\u00A4\u00A6\u00E0\u00A5\u0087\u00E0\u00A4\u00B6\u00E0\u00A4\u00B9\u00E0\u00A4\u00BF\u00E0\u00A4\u00A8\u00E0\u00A5\u008D\u00E0\u00A4\u00A6\u00E0\u00A5\u0080\u00E0\u00A4\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u00A1\u00E0\u00A4\u00BF\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00A6\u00E0\u00A4\u00BF\u00E0\u00A4\u00B2\u00E0\u00A5\u008D\u00E0\u00A4\u00B2\u00E0\u00A5\u0080\u00E0\u00A4\u0085\u00E0\u00A4\u00A7\u00E0\u00A4\u00BF\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00B5\u00E0\u00A5\u0080\u00E0\u00A4\u00A1\u00E0\u00A4\u00BF\u00E0\u00A4\u00AF\u00E0\u00A5\u008B\u00E0\u00A4\u009A\u00E0\u00A4\u00BF\u00E0\u00A4\u009F\u00E0\u00A5\u008D\u00E0\u00A4\u00A0\u00E0\u00A5\u0087\u00E0\u00A4\u00B8\u00E0\u00A4\u00AE\u00E0\u00A4\u00BE\u00E0\u00A4\u009A\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u009C\u00E0\u00A4\u0082\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00B6\u00E0\u00A4\u00A8\u00E0\u00A4\u00A6\u00E0\u00A5\u0081\u00E0\u00A4\u00A8\u00E0\u00A4\u00BF\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00AA\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00AF\u00E0\u00A5\u008B\u00E0\u00A4\u0097\u00E0\u00A4\u0085\u00E0\u00A4\u00A8\u00E0\u00A5\u0081\u00E0\u00A4\u00B8\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u0091\u00E0\u00A4\u00A8\u00E0\u00A4\u00B2\u00E0\u00A4\u00BE\u00E0\u00A4\u0087\u00E0\u00A4\u00A8\u00E0\u00A4\u00AA\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A5\u008D\u00E0\u00A4\u009F\u00E0\u00A5\u0080\u00E0\u00A4\u00B6\u00E0\u00A4\u00B0\u00E0\u00A5\u008D\u00E0\u00A4\u00A4\u00E0\u00A5\u008B\u00E0\u00A4\u0082\u00E0\u00A4\u00B2\u00E0\u00A5\u008B\u00E0\u00A4\u0095\u00E0\u00A4\u00B8\u00E0\u00A4\u00AD\u00E0\u00A4\u00BE\u00E0\u00A4\u00AB\u00E0\u00A4\u00BC\u00E0\u00A5\u008D\u00E0\u00A4\u00B2\u00E0\u00A5\u0088\u00E0\u00A4\u00B6\u00E0\u00A4\u00B6\u00E0\u00A4\u00B0\u00E0\u00A5\u008D\u00E0\u00A4\u00A4\u00E0\u00A5\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u00AA\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00A6\u00E0\u00A5\u0087\u00E0\u00A4\u00B6\u00E0\u00A4\u00AA\u00E0\u00A5\u008D\u00E0\u00A4\u00B2\u00E0\u00A5\u0087\u00E0\u00A4\u00AF\u00E0\u00A4\u00B0\u00E0\u00A4\u0095\u00E0\u00A5\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u00A6\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00B8\u00E0\u00A5\u008D\u00E0\u00A4\u00A5\u00E0\u00A4\u00BF\u00E0\u00A4\u00A4\u00E0\u00A4\u00BF\u00E0\u00A4\u0089\u00E0\u00A4\u00A4\u00E0\u00A5\u008D\u00E0\u00A4\u00AA\u00E0\u00A4\u00BE\u00E0\u00A4\u00A6\u00E0\u00A4\u0089\u00E0\u00A4\u00A8\u00E0\u00A5\u008D\u00E0\u00A4\u00B9\u00E0\u00A5\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u009A\u00E0\u00A4\u00BF\u00E0\u00A4\u009F\u00E0\u00A5\u008D\u00E0\u00A4\u00A0\u00E0\u00A4\u00BE\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00A4\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u009C\u00E0\u00A5\u008D\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u00A6\u00E0\u00A4\u00BE\u00E0\u00A4\u00AA\u00E0\u00A5\u0081\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u009C\u00E0\u00A5\u008B\u00E0\u00A4\u00A1\u00E0\u00A4\u00BC\u00E0\u00A5\u0087\u00E0\u00A4\u0082\u00E0\u00A4\u0085\u00E0\u00A4\u00A8\u00E0\u00A5\u0081\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u00A6\u00E0\u00A4\u00B6\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A5\u0087\u00E0\u00A4\u00A3\u00E0\u00A5\u0080\u00E0\u00A4\u00B6\u00E0\u00A4\u00BF\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00B7\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A4\u00B0\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A5\u0080\u00E0\u00A4\u00B8\u00E0\u00A4\u0082\u00E0\u00A4\u0097\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00B9\u00E0\u00A4\u00AA\u00E0\u00A4\u00B0\u00E0\u00A4\u00BF\u00E0\u00A4\u00A3\u00E0\u00A4\u00BE\u00E0\u00A4\u00AE\u00E0\u00A4\u00AC\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u0082\u00E0\u00A4\u00A1\u00E0\u00A4\u00AC\u00E0\u00A4\u009A\u00E0\u00A5\u008D\u00E0\u00A4\u009A\u00E0\u00A5\u008B\u00E0\u00A4\u0082\u00E0\u00A4\u0089\u00E0\u00A4\u00AA\u00E0\u00A4\u00B2\u00E0\u00A4\u00AC\u00E0\u00A5\u008D\u00E0\u00A4\u00A7\u00E0\u00A4\u00AE\u00E0\u00A4\u0082\u00E0\u00A4\u00A4\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A5\u0080\u00E0\u00A4\u00B8\u00E0\u00A4\u0082\u00E0\u00A4\u00AA\u00E0\u00A4\u00B0\u00E0\u00A5\u008D\u00E0\u00A4\u0095\u00E0\u00A4\u0089\u00E0\u00A4\u00AE\u00E0\u00A5\u008D\u00E0\u00A4\u00AE\u00E0\u00A5\u0080\u00E0\u00A4\u00A6\u00E0\u00A4\u00AE\u00E0\u00A4\u00BE\u00E0\u00A4\u00A7\u00E0\u00A5\u008D\u00E0\u00A4\u00AF\u00E0\u00A4\u00AE\u00E0\u00A4\u00B8\u00E0\u00A4\u00B9\u00E0\u00A4\u00BE\u00E0\u00A4\u00AF\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u00B6\u00E0\u00A4\u00AC\u00E0\u00A5\u008D\u00E0\u00A4\u00A6\u00E0\u00A5\u008B\u00E0\u00A4\u0082\u00E0\u00A4\u00AE\u00E0\u00A5\u0080\u00E0\u00A4\u00A1\u00E0\u00A4\u00BF\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u0086\u00E0\u00A4\u0088\u00E0\u00A4\u00AA\u00E0\u00A5\u0080\u00E0\u00A4\u008F\u00E0\u00A4\u00B2\u00E0\u00A4\u00AE\u00E0\u00A5\u008B\u00E0\u00A4\u00AC\u00E0\u00A4\u00BE\u00E0\u00A4\u0087\u00E0\u00A4\u00B2\u00E0\u00A4\u00B8\u00E0\u00A4\u0082\u00E0\u00A4\u0096\u00E0\u00A5\u008D\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u0086\u00E0\u00A4\u00AA\u00E0\u00A4\u00B0\u00E0\u00A5\u0087\u00E0\u00A4\u00B6\u00E0\u00A4\u00A8\u00E0\u00A4\u0085\u00E0\u00A4\u00A8\u00E0\u00A5\u0081\u00E0\u00A4\u00AC\u00E0\u00A4\u0082\u00E0\u00A4\u00A7\u00E0\u00A4\u00AC\u00E0\u00A4\u00BE\u00E0\u00A4\u009C\u00E0\u00A4\u00BC\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00A8\u00E0\u00A4\u00B5\u00E0\u00A5\u0080\u00E0\u00A4\u00A8\u00E0\u00A4\u00A4\u00E0\u00A4\u00AE\u00E0\u00A4\u00AA\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00AE\u00E0\u00A5\u0081\u00E0\u00A4\u0096\u00E0\u00A4\u00AA\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00B6\u00E0\u00A5\u008D\u00E0\u00A4\u00A8\u00E0\u00A4\u00AA\u00E0\u00A4\u00B0\u00E0\u00A4\u00BF\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00A8\u00E0\u00A5\u0081\u00E0\u00A4\u0095\u00E0\u00A4\u00B8\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A4\u00B8\u00E0\u00A4\u00AE\u00E0\u00A4\u00B0\u00E0\u00A5\u008D\u00E0\u00A4\u00A5\u00E0\u00A4\u00A8\u00E0\u00A4\u0086\u00E0\u00A4\u00AF\u00E0\u00A5\u008B\u00E0\u00A4\u009C\u00E0\u00A4\u00BF\u00E0\u00A4\u00A4\u00E0\u00A4\u00B8\u00E0\u00A5\u008B\u00E0\u00A4\u00AE\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00B4\u00D8\u00A7\u00D8\u00B1\u00D9\u0083\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D9\u0086\u00D8\u00AA\u00D8\u00AF\u00D9\u008A\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D9\u0083\u00D9\u0085\u00D8\u00A8\u00D9\u008A\u00D9\u0088\u00D8\u00AA\u00D8\u00B1\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00B4\u00D8\u00A7\u00D9\u0087\u00D8\u00AF\u00D8\u00A7\u00D8\u00AA\u00D8\u00B9\u00D8\u00AF\u00D8\u00AF\u00D8\u00A7\u00D9\u0084\u00D8\u00B2\u00D9\u0088\u00D8\u00A7\u00D8\u00B1\u00D8\u00B9\u00D8\u00AF\u00D8\u00AF\u00D8\u00A7\u00D9\u0084\u00D8\u00B1\u00D8\u00AF\u00D9\u0088\u00D8\u00AF\u00D8\u00A7\u00D9\u0084\u00D8\u00A5\u00D8\u00B3\u00D9\u0084\u00D8\u00A7\u00D9\u0085\u00D9\u008A\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D9\u0081\u00D9\u0088\u00D8\u00AA\u00D9\u0088\u00D8\u00B4\u00D9\u0088\u00D8\u00A8\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00B3\u00D8\u00A7\u00D8\u00A8\u00D9\u0082\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00B9\u00D9\u0084\u00D9\u0088\u00D9\u0085\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00B3\u00D9\u0084\u00D8\u00B3\u00D9\u0084\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D8\u00AC\u00D8\u00B1\u00D8\u00A7\u00D9\u0081\u00D9\u008A\u00D9\u0083\u00D8\u00B3\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D8\u00B3\u00D9\u0084\u00D8\u00A7\u00D9\u0085\u00D9\u008A\u00D8\u00A9\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D8\u00AA\u00D8\u00B5\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D8\u00AAkeywords\" content=\"w3.org/1999/xhtml\"><a target=\"_blank\" text/html; charset=\" target=\"_blank\"><table cellpadding=\"autocomplete=\"off\" text-align: center;to last version by background-color: #\" href=\"http://www./div></div><div id=<a href=\"#\" class=\"\"><img src=\"http://cript\" src=\"http://\n<script language=\"//EN\" \"http://www.wencodeURIComponent(\" href=\"javascript:<div class=\"contentdocument.write('<scposition: absolute;script src=\"http:// style=\"margin-top:.min.js\"></script>\n</div>\n<div class=\"w3.org/1999/xhtml\" \n\r\n</body>\r\n</html>distinction between/\" target=\"_blank\"><link href=\"http://encoding=\"utf-8\"?>\nw.addEventListener?action=\"http://www.icon\" href=\"http:// style=\"background:type=\"text/css\" />\nmeta property=\"og:t<input type=\"text\" style=\"text-align:the development of tylesheet\" type=\"tehtml; charset=utf-8is considered to betable width=\"100%\" In addition to the contributed to the differences betweendevelopment of the It is important to </script>\n\n<script style=\"font-size:1></span><span id=gbLibrary of Congress<img src=\"http://imEnglish translationAcademy of Sciencesdiv style=\"display:construction of the.getElementById(id)in conjunction withElement('script'); <meta property=\"og:\u00D0\u0091\u00D1\u008A\u00D0\u00BB\u00D0\u00B3\u00D0\u00B0\u00D1\u0080\u00D1\u0081\u00D0\u00BA\u00D0\u00B8\n type=\"text\" name=\">Privacy Policy</a>administered by theenableSingleRequeststyle=&quot;margin:</div></div></div><><img src=\"http://i style=&quot;float:referred to as the total population ofin Washington, D.C. style=\"background-among other things,organization of theparticipated in thethe introduction ofidentified with thefictional character Oxford University misunderstanding ofThere are, however,stylesheet\" href=\"/Columbia Universityexpanded to includeusually referred toindicating that thehave suggested thataffiliated with thecorrelation betweennumber of different></td></tr></table>Republic of Ireland\n</script>\n<script under the influencecontribution to theOfficial website ofheadquarters of thecentered around theimplications of thehave been developedFederal Republic ofbecame increasinglycontinuation of theNote, however, thatsimilar to that of capabilities of theaccordance with theparticipants in thefurther developmentunder the directionis often consideredhis younger brother</td></tr></table><a http-equiv=\"X-UA-physical propertiesof British Columbiahas been criticized(with the exceptionquestions about thepassing through the0\" cellpadding=\"0\" thousands of peopleredirects here. Forhave children under%3E%3C/script%3E\"));<a href=\"http://www.<li><a href=\"http://site_name\" content=\"text-decoration:nonestyle=\"display: none<meta http-equiv=\"X-new Date().getTime() type=\"image/x-icon\"</span><span class=\"language=\"javascriptwindow.location.href<a href=\"javascript:-->\r\n<script type=\"t<a href='http://www.hortcut icon\" href=\"</div>\r\n<div class=\"<script src=\"http://\" rel=\"stylesheet\" t</div>\n<script type=/a> <a href=\"http:// allowTransparency=\"X-UA-Compatible\" conrelationship between\n</script>\r\n<script </a></li></ul></div>associated with the programming language</a><a href=\"http://</a></li><li class=\"form action=\"http://<div style=\"display:type=\"text\" name=\"q\"<table width=\"100%\" background-position:\" border=\"0\" width=\"rel=\"shortcut icon\" h6><ul><li><a href=\" <meta http-equiv=\"css\" media=\"screen\" responsible for the \" type=\"application/\" style=\"background-html; charset=utf-8\" allowtransparency=\"stylesheet\" type=\"te\r\n<meta http-equiv=\"></span><span class=\"0\" cellspacing=\"0\">;\n</script>\n<script sometimes called thedoes not necessarilyFor more informationat the beginning of <!DOCTYPE html><htmlparticularly in the type=\"hidden\" name=\"javascript:void(0);\"effectiveness of the autocomplete=\"off\" generally considered><input type=\"text\" \"></script>\r\n<scriptthroughout the worldcommon misconceptionassociation with the</div>\n</div>\n<div cduring his lifetime,corresponding to thetype=\"image/x-icon\" an increasing numberdiplomatic relationsare often consideredmeta charset=\"utf-8\" <input type=\"text\" examples include the\"><img src=\"http://iparticipation in thethe establishment of\n</div>\n<div class=\"&amp;nbsp;&amp;nbsp;to determine whetherquite different frommarked the beginningdistance between thecontributions to theconflict between thewidely considered towas one of the firstwith varying degreeshave speculated that(document.getElementparticipating in theoriginally developedeta charset=\"utf-8\"> type=\"text/css\" />\ninterchangeably withmore closely relatedsocial and politicalthat would otherwiseperpendicular to thestyle type=\"text/csstype=\"submit\" name=\"families residing indeveloping countriescomputer programmingeconomic developmentdetermination of thefor more informationon several occasionsportugu\u00C3\u00AAs (Europeu)\u00D0\u00A3\u00D0\u00BA\u00D1\u0080\u00D0\u00B0\u00D1\u0097\u00D0\u00BD\u00D1\u0081\u00D1\u008C\u00D0\u00BA\u00D0\u00B0\u00D1\u0083\u00D0\u00BA\u00D1\u0080\u00D0\u00B0\u00D1\u0097\u00D0\u00BD\u00D1\u0081\u00D1\u008C\u00D0\u00BA\u00D0\u00B0\u00D0\u00A0\u00D0\u00BE\u00D1\u0081\u00D1\u0081\u00D0\u00B8\u00D0\u00B9\u00D1\u0081\u00D0\u00BA\u00D0\u00BE\u00D0\u00B9\u00D0\u00BC\u00D0\u00B0\u00D1\u0082\u00D0\u00B5\u00D1\u0080\u00D0\u00B8\u00D0\u00B0\u00D0\u00BB\u00D0\u00BE\u00D0\u00B2\u00D0\u00B8\u00D0\u00BD\u00D1\u0084\u00D0\u00BE\u00D1\u0080\u00D0\u00BC\u00D0\u00B0\u00D1\u0086\u00D0\u00B8\u00D0\u00B8\u00D1\u0083\u00D0\u00BF\u00D1\u0080\u00D0\u00B0\u00D0\u00B2\u00D0\u00BB\u00D0\u00B5\u00D0\u00BD\u00D0\u00B8\u00D1\u008F\u00D0\u00BD\u00D0\u00B5\u00D0\u00BE\u00D0\u00B1\u00D1\u0085\u00D0\u00BE\u00D0\u00B4\u00D0\u00B8\u00D0\u00BC\u00D0\u00BE\u00D0\u00B8\u00D0\u00BD\u00D1\u0084\u00D0\u00BE\u00D1\u0080\u00D0\u00BC\u00D0\u00B0\u00D1\u0086\u00D0\u00B8\u00D1\u008F\u00D0\u0098\u00D0\u00BD\u00D1\u0084\u00D0\u00BE\u00D1\u0080\u00D0\u00BC\u00D0\u00B0\u00D1\u0086\u00D0\u00B8\u00D1\u008F\u00D0\u00A0\u00D0\u00B5\u00D1\u0081\u00D0\u00BF\u00D1\u0083\u00D0\u00B1\u00D0\u00BB\u00D0\u00B8\u00D0\u00BA\u00D0\u00B8\u00D0\u00BA\u00D0\u00BE\u00D0\u00BB\u00D0\u00B8\u00D1\u0087\u00D0\u00B5\u00D1\u0081\u00D1\u0082\u00D0\u00B2\u00D0\u00BE\u00D0\u00B8\u00D0\u00BD\u00D1\u0084\u00D0\u00BE\u00D1\u0080\u00D0\u00BC\u00D0\u00B0\u00D1\u0086\u00D0\u00B8\u00D1\u008E\u00D1\u0082\u00D0\u00B5\u00D1\u0080\u00D1\u0080\u00D0\u00B8\u00D1\u0082\u00D0\u00BE\u00D1\u0080\u00D0\u00B8\u00D0\u00B8\u00D0\u00B4\u00D0\u00BE\u00D1\u0081\u00D1\u0082\u00D0\u00B0\u00D1\u0082\u00D0\u00BE\u00D1\u0087\u00D0\u00BD\u00D0\u00BE\u00D8\u00A7\u00D9\u0084\u00D9\u0085\u00D8\u00AA\u00D9\u0088\u00D8\u00A7\u00D8\u00AC\u00D8\u00AF\u00D9\u0088\u00D9\u0086\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D8\u00B4\u00D8\u00AA\u00D8\u00B1\u00D8\u00A7\u00D9\u0083\u00D8\u00A7\u00D8\u00AA\u00D8\u00A7\u00D9\u0084\u00D8\u00A7\u00D9\u0082\u00D8\u00AA\u00D8\u00B1\u00D8\u00A7\u00D8\u00AD\u00D8\u00A7\u00D8\u00AAhtml; charset=UTF-8\" setTimeout(function()display:inline-block;<input type=\"submit\" type = 'text/javascri<img src=\"http://www.\" \"http://www.w3.org/shortcut icon\" href=\"\" autocomplete=\"off\" </a></div><div class=</a></li>\n<li class=\"css\" type=\"text/css\" <form action=\"http://xt/css\" href=\"http://link rel=\"alternate\" \r\n<script type=\"text/ onclick=\"javascript:(new Date).getTime()}height=\"1\" width=\"1\" People's Republic of <a href=\"http://www.text-decoration:underthe beginning of the </div>\n</div>\n</div>\nestablishment of the </div></div></div></d#viewport{min-height:\n<script src=\"http://option><option value=often referred to as /option>\n<option valu<!DOCTYPE html>\n<!--[International Airport>\n<a href=\"http://www</a><a href=\"http://w\u00E0\u00B8\u00A0\u00E0\u00B8\u00B2\u00E0\u00B8\u00A9\u00E0\u00B8\u00B2\u00E0\u00B9\u0084\u00E0\u00B8\u0097\u00E0\u00B8\u00A2\u00E1\u0083\u00A5\u00E1\u0083\u0090\u00E1\u0083\u00A0\u00E1\u0083\u0097\u00E1\u0083\u00A3\u00E1\u0083\u009A\u00E1\u0083\u0098\u00E6\u00AD\u00A3\u00E9\u00AB\u0094\u00E4\u00B8\u00AD\u00E6\u0096\u0087 (\u00E7\u00B9\u0081\u00E9\u00AB\u0094)\u00E0\u00A4\u00A8\u00E0\u00A4\u00BF\u00E0\u00A4\u00B0\u00E0\u00A5\u008D\u00E0\u00A4\u00A6\u00E0\u00A5\u0087\u00E0\u00A4\u00B6\u00E0\u00A4\u00A1\u00E0\u00A4\u00BE\u00E0\u00A4\u0089\u00E0\u00A4\u00A8\u00E0\u00A4\u00B2\u00E0\u00A5\u008B\u00E0\u00A4\u00A1\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00B7\u00E0\u00A5\u0087\u00E0\u00A4\u00A4\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u009C\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A5\u0080\u00E0\u00A4\u00B8\u00E0\u00A4\u0082\u00E0\u00A4\u00AC\u00E0\u00A4\u0082\u00E0\u00A4\u00A7\u00E0\u00A4\u00BF\u00E0\u00A4\u00A4\u00E0\u00A4\u00B8\u00E0\u00A5\u008D\u00E0\u00A4\u00A5\u00E0\u00A4\u00BE\u00E0\u00A4\u00AA\u00E0\u00A4\u00A8\u00E0\u00A4\u00BE\u00E0\u00A4\u00B8\u00E0\u00A5\u008D\u00E0\u00A4\u00B5\u00E0\u00A5\u0080\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00B8\u00E0\u00A4\u0082\u00E0\u00A4\u00B8\u00E0\u00A5\u008D\u00E0\u00A4\u0095\u00E0\u00A4\u00B0\u00E0\u00A4\u00A3\u00E0\u00A4\u00B8\u00E0\u00A4\u00BE\u00E0\u00A4\u00AE\u00E0\u00A4\u0097\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A5\u0080\u00E0\u00A4\u009A\u00E0\u00A4\u00BF\u00E0\u00A4\u009F\u00E0\u00A5\u008D\u00E0\u00A4\u00A0\u00E0\u00A5\u008B\u00E0\u00A4\u0082\u00E0\u00A4\u00B5\u00E0\u00A4\u00BF\u00E0\u00A4\u009C\u00E0\u00A5\u008D\u00E0\u00A4\u009E\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A4\u0085\u00E0\u00A4\u00AE\u00E0\u00A5\u0087\u00E0\u00A4\u00B0\u00E0\u00A4\u00BF\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00B5\u00E0\u00A4\u00BF\u00E0\u00A4\u00AD\u00E0\u00A4\u00BF\u00E0\u00A4\u00A8\u00E0\u00A5\u008D\u00E0\u00A4\u00A8\u00E0\u00A4\u0097\u00E0\u00A4\u00BE\u00E0\u00A4\u00A1\u00E0\u00A4\u00BF\u00E0\u00A4\u00AF\u00E0\u00A4\u00BE\u00E0\u00A4\u0081\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00AF\u00E0\u00A5\u008B\u00E0\u00A4\u0082\u00E0\u00A4\u0095\u00E0\u00A4\u00BF\u00E0\u00A4\u00B8\u00E0\u00A5\u0081\u00E0\u00A4\u00B0\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00B7\u00E0\u00A4\u00BE\u00E0\u00A4\u00AA\u00E0\u00A4\u00B9\u00E0\u00A5\u0081\u00E0\u00A4\u0081\u00E0\u00A4\u009A\u00E0\u00A4\u00A4\u00E0\u00A5\u0080\u00E0\u00A4\u00AA\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00AC\u00E0\u00A4\u0082\u00E0\u00A4\u00A7\u00E0\u00A4\u00A8\u00E0\u00A4\u009F\u00E0\u00A4\u00BF\u00E0\u00A4\u00AA\u00E0\u00A5\u008D\u00E0\u00A4\u00AA\u00E0\u00A4\u00A3\u00E0\u00A5\u0080\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00BF\u00E0\u00A4\u0095\u00E0\u00A5\u0087\u00E0\u00A4\u009F\u00E0\u00A4\u00AA\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u0082\u00E0\u00A4\u00AD\u00E0\u00A4\u00AA\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u00AA\u00E0\u00A5\u008D\u00E0\u00A4\u00A4\u00E0\u00A4\u00AE\u00E0\u00A4\u00BE\u00E0\u00A4\u00B2\u00E0\u00A4\u00BF\u00E0\u00A4\u0095\u00E0\u00A5\u008B\u00E0\u00A4\u0082\u00E0\u00A4\u00B0\u00E0\u00A4\u00AB\u00E0\u00A4\u00BC\u00E0\u00A5\u008D\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A4\u00A8\u00E0\u00A4\u00BF\u00E0\u00A4\u00B0\u00E0\u00A5\u008D\u00E0\u00A4\u00AE\u00E0\u00A4\u00BE\u00E0\u00A4\u00A3\u00E0\u00A4\u00B2\u00E0\u00A4\u00BF\u00E0\u00A4\u00AE\u00E0\u00A4\u00BF\u00E0\u00A4\u009F\u00E0\u00A5\u0087\u00E0\u00A4\u00A1description\" content=\"document.location.prot.getElementsByTagName(<!DOCTYPE html>\n<html <meta charset=\"utf-8\">:url\" content=\"http://.css\" rel=\"stylesheet\"style type=\"text/css\">type=\"text/css\" href=\"w3.org/1999/xhtml\" xmltype=\"text/javascript\" method=\"get\" action=\"link rel=\"stylesheet\" = document.getElementtype=\"image/x-icon\" />cellpadding=\"0\" cellsp.css\" type=\"text/css\" </a></li><li><a href=\"\" width=\"1\" height=\"1\"\"><a href=\"http://www.style=\"display:none;\">alternate\" type=\"appli-//W3C//DTD XHTML 1.0 ellspacing=\"0\" cellpad type=\"hidden\" value=\"/a>&nbsp;<span role=\"s\n<input type=\"hidden\" language=\"JavaScript\" document.getElementsBg=\"0\" cellspacing=\"0\" ype=\"text/css\" media=\"type='text/javascript'with the exception of ype=\"text/css\" rel=\"st height=\"1\" width=\"1\" ='+encodeURIComponent(<link rel=\"alternate\" \nbody, tr, input, textmeta name=\"robots\" conmethod=\"post\" action=\">\n<a href=\"http://www.css\" rel=\"stylesheet\" </div></div><div classlanguage=\"javascript\">aria-hidden=\"true\">\u00C2\u00B7<ript\" type=\"text/javasl=0;})();\n(function(){background-image: url(/a></li><li><a href=\"h\t\t<li><a href=\"http://ator\" aria-hidden=\"tru> <a href=\"http://www.language=\"javascript\" /option>\n<option value/div></div><div class=rator\" aria-hidden=\"tre=(new Date).getTime()portugu\u00C3\u00AAs (do Brasil)\u00D0\u00BE\u00D1\u0080\u00D0\u00B3\u00D0\u00B0\u00D0\u00BD\u00D0\u00B8\u00D0\u00B7\u00D0\u00B0\u00D1\u0086\u00D0\u00B8\u00D0\u00B8\u00D0\u00B2\u00D0\u00BE\u00D0\u00B7\u00D0\u00BC\u00D0\u00BE\u00D0\u00B6\u00D0\u00BD\u00D0\u00BE\u00D1\u0081\u00D1\u0082\u00D1\u008C\u00D0\u00BE\u00D0\u00B1\u00D1\u0080\u00D0\u00B0\u00D0\u00B7\u00D0\u00BE\u00D0\u00B2\u00D0\u00B0\u00D0\u00BD\u00D0\u00B8\u00D1\u008F\u00D1\u0080\u00D0\u00B5\u00D0\u00B3\u00D0\u00B8\u00D1\u0081\u00D1\u0082\u00D1\u0080\u00D0\u00B0\u00D1\u0086\u00D0\u00B8\u00D0\u00B8\u00D0\u00B2\u00D0\u00BE\u00D0\u00B7\u00D0\u00BC\u00D0\u00BE\u00D0\u00B6\u00D0\u00BD\u00D0\u00BE\u00D1\u0081\u00D1\u0082\u00D0\u00B8\u00D0\u00BE\u00D0\u00B1\u00D1\u008F\u00D0\u00B7\u00D0\u00B0\u00D1\u0082\u00D0\u00B5\u00D0\u00BB\u00D1\u008C\u00D0\u00BD\u00D0\u00B0<!DOCTYPE html PUBLIC \"nt-Type\" content=\"text/<meta http-equiv=\"Conteransitional//EN\" \"http:<html xmlns=\"http://www-//W3C//DTD XHTML 1.0 TDTD/xhtml1-transitional//www.w3.org/TR/xhtml1/pe = 'text/javascript';<meta name=\"descriptionparentNode.insertBefore<input type=\"hidden\" najs\" type=\"text/javascri(document).ready(functiscript type=\"text/javasimage\" content=\"http://UA-Compatible\" content=tml; charset=utf-8\" />\nlink rel=\"shortcut icon<link rel=\"stylesheet\" </script>\n<script type== document.createElemen<a target=\"_blank\" href= document.getElementsBinput type=\"text\" name=a.type = 'text/javascrinput type=\"hidden\" namehtml; charset=utf-8\" />dtd\">\n<html xmlns=\"http-//W3C//DTD HTML 4.01 TentsByTagName('script')input type=\"hidden\" nam<script type=\"text/javas\" style=\"display:none;\">document.getElementById(=document.createElement(' type='text/javascript'input type=\"text\" name=\"d.getElementsByTagName(snical\" href=\"http://www.C//DTD HTML 4.01 Transit<style type=\"text/css\">\n\n<style type=\"text/css\">ional.dtd\">\n<html xmlns=http-equiv=\"Content-Typeding=\"0\" cellspacing=\"0\"html; charset=utf-8\" />\n style=\"display:none;\"><<li><a href=\"http://www. type='text/javascript'>\u00D0\u00B4\u00D0\u00B5\u00D1\u008F\u00D1\u0082\u00D0\u00B5\u00D0\u00BB\u00D1\u008C\u00D0\u00BD\u00D0\u00BE\u00D1\u0081\u00D1\u0082\u00D0\u00B8\u00D1\u0081\u00D0\u00BE\u00D0\u00BE\u00D1\u0082\u00D0\u00B2\u00D0\u00B5\u00D1\u0082\u00D1\u0081\u00D1\u0082\u00D0\u00B2\u00D0\u00B8\u00D0\u00B8\u00D0\u00BF\u00D1\u0080\u00D0\u00BE\u00D0\u00B8\u00D0\u00B7\u00D0\u00B2\u00D0\u00BE\u00D0\u00B4\u00D1\u0081\u00D1\u0082\u00D0\u00B2\u00D0\u00B0\u00D0\u00B1\u00D0\u00B5\u00D0\u00B7\u00D0\u00BE\u00D0\u00BF\u00D0\u00B0\u00D1\u0081\u00D0\u00BD\u00D0\u00BE\u00D1\u0081\u00D1\u0082\u00D0\u00B8\u00E0\u00A4\u00AA\u00E0\u00A5\u0081\u00E0\u00A4\u00B8\u00E0\u00A5\u008D\u00E0\u00A4\u00A4\u00E0\u00A4\u00BF\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u0082\u00E0\u00A4\u0097\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A5\u0087\u00E0\u00A4\u00B8\u00E0\u00A4\u0089\u00E0\u00A4\u00A8\u00E0\u00A5\u008D\u00E0\u00A4\u00B9\u00E0\u00A5\u008B\u00E0\u00A4\u0082\u00E0\u00A4\u00A8\u00E0\u00A5\u0087\u00E0\u00A4\u00B5\u00E0\u00A4\u00BF\u00E0\u00A4\u00A7\u00E0\u00A4\u00BE\u00E0\u00A4\u00A8\u00E0\u00A4\u00B8\u00E0\u00A4\u00AD\u00E0\u00A4\u00BE\u00E0\u00A4\u00AB\u00E0\u00A4\u00BF\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00B8\u00E0\u00A4\u00BF\u00E0\u00A4\u0082\u00E0\u00A4\u0097\u00E0\u00A4\u00B8\u00E0\u00A5\u0081\u00E0\u00A4\u00B0\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00B7\u00E0\u00A4\u00BF\u00E0\u00A4\u00A4\u00E0\u00A4\u0095\u00E0\u00A5\u0089\u00E0\u00A4\u00AA\u00E0\u00A5\u0080\u00E0\u00A4\u00B0\u00E0\u00A4\u00BE\u00E0\u00A4\u0087\u00E0\u00A4\u009F\u00E0\u00A4\u00B5\u00E0\u00A4\u00BF\u00E0\u00A4\u009C\u00E0\u00A5\u008D\u00E0\u00A4\u009E\u00E0\u00A4\u00BE\u00E0\u00A4\u00AA\u00E0\u00A4\u00A8\u00E0\u00A4\u0095\u00E0\u00A4\u00BE\u00E0\u00A4\u00B0\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00B5\u00E0\u00A4\u00BE\u00E0\u00A4\u0088\u00E0\u00A4\u00B8\u00E0\u00A4\u0095\u00E0\u00A5\u008D\u00E0\u00A4\u00B0\u00E0\u00A4\u00BF\u00E0\u00A4\u00AF\u00E0\u00A4\u00A4\u00E0\u00A4\u00BE";
+ }
+ }
+
+ private class DataHolder
+ {
+ internal static readonly byte[] Data;
+
+ static DataHolder()
+ {
+ Data = new byte[122784];
+ string[] chunks = new string[] { Org.Brotli.Dec.Dictionary.DataHolder0.GetData(), Org.Brotli.Dec.Dictionary.DataHolder1.GetData(), Org.Brotli.Dec.Dictionary.DataHolder2.GetData() };
+ int sum = 0;
+ foreach (string chunk in chunks)
+ {
+ sum += chunk.Length;
+ }
+ if (sum != Data.Length)
+ {
+ throw new System.Exception("Corrupted brotli dictionary");
+ }
+ sum = 0;
+ foreach (string chunk in chunks)
+ {
+ for (int j = 0; j < chunk.Length; ++j)
+ {
+ Data[sum++] = unchecked((byte)chunk[j]);
+ }
+ }
+ }
+ }
+
+ internal static byte[] GetData()
+ {
+ return Org.Brotli.Dec.Dictionary.DataHolder.Data;
+ }
+
+ internal static readonly int[] OffsetsByLength = new int[] { 0, 0, 0, 0, 0, 4096, 9216, 21504, 35840, 44032, 53248, 63488, 74752, 87040, 93696, 100864, 104704, 106752, 108928, 113536, 115968, 118528, 119872, 121280, 122016 };
+
+ internal static readonly int[] SizeBitsByLength = new int[] { 0, 0, 0, 0, 10, 10, 11, 11, 10, 10, 10, 10, 10, 9, 9, 8, 7, 7, 8, 7, 7, 6, 6, 5, 5 };
+
+ internal const int MinWordLength = 4;
+
+ internal const int MaxWordLength = 24;
+
+ internal const int MaxTransformedWordLength = 5 + MaxWordLength + 8;
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/DictionaryTest.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/DictionaryTest.cs
new file mode 100644
index 000000000..84c35ab77
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/DictionaryTest.cs
@@ -0,0 +1,36 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>
+ /// Tests for
+ /// <see cref="Dictionary"/>
+ /// .
+ /// </summary>
+ public class DictionaryTest
+ {
+ private static long Crc64(byte[] data)
+ {
+ long crc = -1;
+ for (int i = 0; i < data.Length; ++i)
+ {
+ long c = (crc ^ (long)(data[i] & unchecked((int)(0xFF)))) & unchecked((int)(0xFF));
+ for (int k = 0; k < 8; k++)
+ {
+ c = ((long)(((ulong)c) >> 1)) ^ (-(c & 1L) & -3932672073523589310L);
+ }
+ crc = c ^ ((long)(((ulong)crc) >> 8));
+ }
+ return ~crc;
+ }
+
+ [NUnit.Framework.Test]
+ public virtual void TestGetData()
+ {
+ NUnit.Framework.Assert.AreEqual(37084801881332636L, Crc64(Org.Brotli.Dec.Dictionary.GetData()));
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Huffman.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Huffman.cs
new file mode 100644
index 000000000..4f10c7152
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Huffman.cs
@@ -0,0 +1,149 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>Utilities for building Huffman decoding tables.</summary>
+ internal sealed class Huffman
+ {
+ /// <summary>
+ /// Maximum possible Huffman table size for an alphabet size of 704, max code length 15 and root
+ /// table bits 8.
+ /// </summary>
+ internal const int HuffmanMaxTableSize = 1080;
+
+ private const int MaxLength = 15;
+
+ /// <summary>Returns reverse(reverse(key, len) + 1, len).</summary>
+ /// <remarks>
+ /// Returns reverse(reverse(key, len) + 1, len).
+ /// <p> reverse(key, len) is the bit-wise reversal of the len least significant bits of key.
+ /// </remarks>
+ private static int GetNextKey(int key, int len)
+ {
+ int step = 1 << (len - 1);
+ while ((key & step) != 0)
+ {
+ step >>= 1;
+ }
+ return (key & (step - 1)) + step;
+ }
+
+ /// <summary>
+ /// Stores
+ /// <paramref name="item"/>
+ /// in
+ /// <c>table[0], table[step], table[2 * step] .., table[end]</c>
+ /// .
+ /// <p> Assumes that end is an integer multiple of step.
+ /// </summary>
+ private static void ReplicateValue(int[] table, int offset, int step, int end, int item)
+ {
+ do
+ {
+ end -= step;
+ table[offset + end] = item;
+ }
+ while (end > 0);
+ }
+
+ /// <param name="count">histogram of bit lengths for the remaining symbols,</param>
+ /// <param name="len">code length of the next processed symbol.</param>
+ /// <returns>table width of the next 2nd level table.</returns>
+ private static int NextTableBitSize(int[] count, int len, int rootBits)
+ {
+ int left = 1 << (len - rootBits);
+ while (len < MaxLength)
+ {
+ left -= count[len];
+ if (left <= 0)
+ {
+ break;
+ }
+ len++;
+ left <<= 1;
+ }
+ return len - rootBits;
+ }
+
+ /// <summary>Builds Huffman lookup table assuming code lengths are in symbol order.</summary>
+ internal static void BuildHuffmanTable(int[] rootTable, int tableOffset, int rootBits, int[] codeLengths, int codeLengthsSize)
+ {
+ int key;
+ // Reversed prefix code.
+ int[] sorted = new int[codeLengthsSize];
+ // Symbols sorted by code length.
+ // TODO: fill with zeroes?
+ int[] count = new int[MaxLength + 1];
+ // Number of codes of each length.
+ int[] offset = new int[MaxLength + 1];
+ // Offsets in sorted table for each length.
+ int symbol;
+ // Build histogram of code lengths.
+ for (symbol = 0; symbol < codeLengthsSize; symbol++)
+ {
+ count[codeLengths[symbol]]++;
+ }
+ // Generate offsets into sorted symbol table by code length.
+ offset[1] = 0;
+ for (int len = 1; len < MaxLength; len++)
+ {
+ offset[len + 1] = offset[len] + count[len];
+ }
+ // Sort symbols by length, by symbol order within each length.
+ for (symbol = 0; symbol < codeLengthsSize; symbol++)
+ {
+ if (codeLengths[symbol] != 0)
+ {
+ sorted[offset[codeLengths[symbol]]++] = symbol;
+ }
+ }
+ int tableBits = rootBits;
+ int tableSize = 1 << tableBits;
+ int totalSize = tableSize;
+ // Special case code with only one value.
+ if (offset[MaxLength] == 1)
+ {
+ for (key = 0; key < totalSize; key++)
+ {
+ rootTable[tableOffset + key] = sorted[0];
+ }
+ return;
+ }
+ // Fill in root table.
+ key = 0;
+ symbol = 0;
+ for (int len = 1, step = 2; len <= rootBits; len++, step <<= 1)
+ {
+ for (; count[len] > 0; count[len]--)
+ {
+ ReplicateValue(rootTable, tableOffset + key, step, tableSize, len << 16 | sorted[symbol++]);
+ key = GetNextKey(key, len);
+ }
+ }
+ // Fill in 2nd level tables and add pointers to root table.
+ int mask = totalSize - 1;
+ int low = -1;
+ int currentOffset = tableOffset;
+ for (int len = rootBits + 1, step = 2; len <= MaxLength; len++, step <<= 1)
+ {
+ for (; count[len] > 0; count[len]--)
+ {
+ if ((key & mask) != low)
+ {
+ currentOffset += tableSize;
+ tableBits = NextTableBitSize(count, len, rootBits);
+ tableSize = 1 << tableBits;
+ totalSize += tableSize;
+ low = key & mask;
+ rootTable[tableOffset + low] = (tableBits + rootBits) << 16 | (currentOffset - tableOffset - low);
+ }
+ ReplicateValue(rootTable, currentOffset + (key >> rootBits), step, tableSize, (len - rootBits) << 16 | sorted[symbol++]);
+ key = GetNextKey(key, len);
+ }
+ }
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/HuffmanTreeGroup.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/HuffmanTreeGroup.cs
new file mode 100644
index 000000000..956ad2640
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/HuffmanTreeGroup.cs
@@ -0,0 +1,50 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>Contains a collection of huffman trees with the same alphabet size.</summary>
+ internal sealed class HuffmanTreeGroup
+ {
+ /// <summary>The maximal alphabet size in this group.</summary>
+ private int alphabetSize;
+
+ /// <summary>Storage for Huffman lookup tables.</summary>
+ internal int[] codes;
+
+ /// <summary>
+ /// Offsets of distinct lookup tables in
+ /// <see cref="codes"/>
+ /// storage.
+ /// </summary>
+ internal int[] trees;
+
+ /// <summary>Initializes the Huffman tree group.</summary>
+ /// <param name="group">POJO to be initialised</param>
+ /// <param name="alphabetSize">the maximal alphabet size in this group</param>
+ /// <param name="n">number of Huffman codes</param>
+ internal static void Init(Org.Brotli.Dec.HuffmanTreeGroup group, int alphabetSize, int n)
+ {
+ group.alphabetSize = alphabetSize;
+ group.codes = new int[n * Org.Brotli.Dec.Huffman.HuffmanMaxTableSize];
+ group.trees = new int[n];
+ }
+
+ /// <summary>Decodes Huffman trees from input stream and constructs lookup tables.</summary>
+ /// <param name="group">target POJO</param>
+ /// <param name="br">data source</param>
+ internal static void Decode(Org.Brotli.Dec.HuffmanTreeGroup group, Org.Brotli.Dec.BitReader br)
+ {
+ int next = 0;
+ int n = group.trees.Length;
+ for (int i = 0; i < n; i++)
+ {
+ group.trees[i] = next;
+ Org.Brotli.Dec.Decode.ReadHuffmanCode(group.alphabetSize, group.codes, next, br);
+ next += Org.Brotli.Dec.Huffman.HuffmanMaxTableSize;
+ }
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/IntReader.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/IntReader.cs
new file mode 100644
index 000000000..4363e0d30
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/IntReader.cs
@@ -0,0 +1,36 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>Byte-to-int conversion magic.</summary>
+ internal sealed class IntReader
+ {
+ private byte[] byteBuffer;
+
+ private int[] intBuffer;
+
+ internal static void Init(Org.Brotli.Dec.IntReader ir, byte[] byteBuffer, int[] intBuffer)
+ {
+ ir.byteBuffer = byteBuffer;
+ ir.intBuffer = intBuffer;
+ }
+
+ /// <summary>Translates bytes to ints.</summary>
+ /// <remarks>
+ /// Translates bytes to ints.
+ /// NB: intLen == 4 * byteSize!
+ /// NB: intLen should be less or equal to intBuffer length.
+ /// </remarks>
+ internal static void Convert(Org.Brotli.Dec.IntReader ir, int intLen)
+ {
+ for (int i = 0; i < intLen; ++i)
+ {
+ ir.intBuffer[i] = ((ir.byteBuffer[i * 4] & unchecked((int)(0xFF)))) | ((ir.byteBuffer[(i * 4) + 1] & unchecked((int)(0xFF))) << 8) | ((ir.byteBuffer[(i * 4) + 2] & unchecked((int)(0xFF))) << 16) | ((ir.byteBuffer[(i * 4) + 3] & unchecked((int
+ )(0xFF))) << 24);
+ }
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Prefix.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Prefix.cs
new file mode 100644
index 000000000..abb6ccb65
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Prefix.cs
@@ -0,0 +1,33 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>Lookup tables to map prefix codes to value ranges.</summary>
+ /// <remarks>
+ /// Lookup tables to map prefix codes to value ranges.
+ /// <p> This is used during decoding of the block lengths, literal insertion lengths and copy
+ /// lengths.
+ /// <p> Range represents values: [offset, offset + 2 ^ n_bits)
+ /// </remarks>
+ internal sealed class Prefix
+ {
+ internal static readonly int[] BlockLengthOffset = new int[] { 1, 5, 9, 13, 17, 25, 33, 41, 49, 65, 81, 97, 113, 145, 177, 209, 241, 305, 369, 497, 753, 1265, 2289, 4337, 8433, 16625 };
+
+ internal static readonly int[] BlockLengthNBits = new int[] { 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 24 };
+
+ internal static readonly int[] InsertLengthOffset = new int[] { 0, 1, 2, 3, 4, 5, 6, 8, 10, 14, 18, 26, 34, 50, 66, 98, 130, 194, 322, 578, 1090, 2114, 6210, 22594 };
+
+ internal static readonly int[] InsertLengthNBits = new int[] { 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 12, 14, 24 };
+
+ internal static readonly int[] CopyLengthOffset = new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 18, 22, 30, 38, 54, 70, 102, 134, 198, 326, 582, 1094, 2118 };
+
+ internal static readonly int[] CopyLengthNBits = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 24 };
+
+ internal static readonly int[] InsertRangeLut = new int[] { 0, 0, 8, 8, 0, 16, 8, 16, 16 };
+
+ internal static readonly int[] CopyRangeLut = new int[] { 0, 8, 0, 8, 16, 0, 16, 8, 16 };
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/RunningState.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/RunningState.cs
new file mode 100644
index 000000000..81a374354
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/RunningState.cs
@@ -0,0 +1,37 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>Enumeration of decoding state-machine.</summary>
+ internal sealed class RunningState
+ {
+ internal const int Uninitialized = 0;
+
+ internal const int BlockStart = 1;
+
+ internal const int CompressedBlockStart = 2;
+
+ internal const int MainLoop = 3;
+
+ internal const int ReadMetadata = 4;
+
+ internal const int CopyUncompressed = 5;
+
+ internal const int InsertLoop = 6;
+
+ internal const int CopyLoop = 7;
+
+ internal const int CopyWrapBuffer = 8;
+
+ internal const int Transform = 9;
+
+ internal const int Finished = 10;
+
+ internal const int Closed = 11;
+
+ internal const int Write = 12;
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/State.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/State.cs
new file mode 100644
index 000000000..b35c39e1b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/State.cs
@@ -0,0 +1,171 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ internal sealed class State
+ {
+ internal int runningState = Org.Brotli.Dec.RunningState.Uninitialized;
+
+ internal int nextRunningState;
+
+ internal readonly Org.Brotli.Dec.BitReader br = new Org.Brotli.Dec.BitReader();
+
+ internal byte[] ringBuffer;
+
+ internal readonly int[] blockTypeTrees = new int[3 * Org.Brotli.Dec.Huffman.HuffmanMaxTableSize];
+
+ internal readonly int[] blockLenTrees = new int[3 * Org.Brotli.Dec.Huffman.HuffmanMaxTableSize];
+
+ internal int metaBlockLength;
+
+ internal bool inputEnd;
+
+ internal bool isUncompressed;
+
+ internal bool isMetadata;
+
+ internal readonly Org.Brotli.Dec.HuffmanTreeGroup hGroup0 = new Org.Brotli.Dec.HuffmanTreeGroup();
+
+ internal readonly Org.Brotli.Dec.HuffmanTreeGroup hGroup1 = new Org.Brotli.Dec.HuffmanTreeGroup();
+
+ internal readonly Org.Brotli.Dec.HuffmanTreeGroup hGroup2 = new Org.Brotli.Dec.HuffmanTreeGroup();
+
+ internal readonly int[] blockLength = new int[3];
+
+ internal readonly int[] numBlockTypes = new int[3];
+
+ internal readonly int[] blockTypeRb = new int[6];
+
+ internal readonly int[] distRb = new int[] { 16, 15, 11, 4 };
+
+ internal int pos = 0;
+
+ internal int maxDistance = 0;
+
+ internal int distRbIdx = 0;
+
+ internal bool trivialLiteralContext = false;
+
+ internal int literalTreeIndex = 0;
+
+ internal int literalTree;
+
+ internal int j;
+
+ internal int insertLength;
+
+ internal byte[] contextModes;
+
+ internal byte[] contextMap;
+
+ internal int contextMapSlice;
+
+ internal int distContextMapSlice;
+
+ internal int contextLookupOffset1;
+
+ internal int contextLookupOffset2;
+
+ internal int treeCommandOffset;
+
+ internal int distanceCode;
+
+ internal byte[] distContextMap;
+
+ internal int numDirectDistanceCodes;
+
+ internal int distancePostfixMask;
+
+ internal int distancePostfixBits;
+
+ internal int distance;
+
+ internal int copyLength;
+
+ internal int copyDst;
+
+ internal int maxBackwardDistance;
+
+ internal int maxRingBufferSize;
+
+ internal int ringBufferSize = 0;
+
+ internal long expectedTotalSize = 0;
+
+ internal byte[] customDictionary = new byte[0];
+
+ internal int bytesToIgnore = 0;
+
+ internal int outputOffset;
+
+ internal int outputLength;
+
+ internal int outputUsed;
+
+ internal int bytesWritten;
+
+ internal int bytesToWrite;
+
+ internal byte[] output;
+
+ // Current meta-block header information.
+ // TODO: Update to current spec.
+ private static int DecodeWindowBits(Org.Brotli.Dec.BitReader br)
+ {
+ if (Org.Brotli.Dec.BitReader.ReadBits(br, 1) == 0)
+ {
+ return 16;
+ }
+ int n = Org.Brotli.Dec.BitReader.ReadBits(br, 3);
+ if (n != 0)
+ {
+ return 17 + n;
+ }
+ n = Org.Brotli.Dec.BitReader.ReadBits(br, 3);
+ if (n != 0)
+ {
+ return 8 + n;
+ }
+ return 17;
+ }
+
+ /// <summary>Associate input with decoder state.</summary>
+ /// <param name="state">uninitialized state without associated input</param>
+ /// <param name="input">compressed data source</param>
+ internal static void SetInput(Org.Brotli.Dec.State state, System.IO.Stream input)
+ {
+ if (state.runningState != Org.Brotli.Dec.RunningState.Uninitialized)
+ {
+ throw new System.InvalidOperationException("State MUST be uninitialized");
+ }
+ Org.Brotli.Dec.BitReader.Init(state.br, input);
+ int windowBits = DecodeWindowBits(state.br);
+ if (windowBits == 9)
+ {
+ /* Reserved case for future expansion. */
+ throw new Org.Brotli.Dec.BrotliRuntimeException("Invalid 'windowBits' code");
+ }
+ state.maxRingBufferSize = 1 << windowBits;
+ state.maxBackwardDistance = state.maxRingBufferSize - 16;
+ state.runningState = Org.Brotli.Dec.RunningState.BlockStart;
+ }
+
+ /// <exception cref="System.IO.IOException"/>
+ internal static void Close(Org.Brotli.Dec.State state)
+ {
+ if (state.runningState == Org.Brotli.Dec.RunningState.Uninitialized)
+ {
+ throw new System.InvalidOperationException("State MUST be initialized");
+ }
+ if (state.runningState == Org.Brotli.Dec.RunningState.Closed)
+ {
+ return;
+ }
+ state.runningState = Org.Brotli.Dec.RunningState.Closed;
+ Org.Brotli.Dec.BitReader.Close(state.br);
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/SynthTest.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/SynthTest.cs
new file mode 100644
index 000000000..92a03ae6a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/SynthTest.cs
@@ -0,0 +1,2174 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>
+ /// Tests for
+ /// <see cref="Decode"/>
+ /// .
+ /// </summary>
+ public class SynthTest
+ {
+ /// <exception cref="System.IO.IOException"/>
+ private byte[] Decompress(byte[] data)
+ {
+ byte[] buffer = new byte[65536];
+ System.IO.MemoryStream input = new System.IO.MemoryStream(data);
+ System.IO.MemoryStream output = new System.IO.MemoryStream();
+ Org.Brotli.Dec.BrotliInputStream brotliInput = new Org.Brotli.Dec.BrotliInputStream(input);
+ while (true)
+ {
+ int len = brotliInput.Read(buffer, 0, buffer.Length);
+ if (len <= 0)
+ {
+ break;
+ }
+ output.Write(buffer, 0, len);
+ }
+ brotliInput.Close();
+ return output.ToArray();
+ }
+
+ private void CheckSynth(byte[] compressed, bool expectSuccess, string expectedOutput)
+ {
+ byte[] expected = Org.Brotli.Dec.Transform.ReadUniBytes(expectedOutput);
+ try
+ {
+ byte[] actual = Decompress(compressed);
+ if (!expectSuccess)
+ {
+ NUnit.Framework.Assert.Fail("expected to fail decoding, but succeeded");
+ }
+ NUnit.Framework.Assert.AreEqual(expected, actual);
+ }
+ catch (System.IO.IOException)
+ {
+ if (expectSuccess)
+ {
+ NUnit.Framework.Assert.Fail("expected to succeed decoding, but failed");
+ }
+ }
+ }
+
+ /* GENERATED CODE START */
+ [NUnit.Framework.Test]
+ public virtual void TestBaseDictWord()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x41))), unchecked(
+ (byte)unchecked((int)(0x02))) };
+ CheckSynth(compressed, true, string.Empty + "time");
+ }
+
+ /*
+ // The stream consists of a base dictionary word.
+ main_header
+ metablock_header_easy: 4, 1
+ command_inscopy_easy: 0, 4
+ command_dist_easy: 1
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestBaseDictWordFinishBlockOnRingbufferWrap()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x1f))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x9b))), unchecked((byte)unchecked((int)(0x58))), unchecked(
+ (byte)unchecked((int)(0x32))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked(
+ (byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked(
+ (byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked(
+ (byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked(
+ (byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0x34))), unchecked((byte)unchecked((int)(0xd4))), unchecked((byte)unchecked((int)(0x00))) };
+ CheckSynth(compressed, true, string.Empty + "aaaaaaaaaaaaaaaaaaaaaaaaaaaatime");
+ }
+
+ /*
+ main_header
+ metablock_header_easy: 32, 1 // 32 = minimal ringbuffer size
+ command_easy: 4, "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", 29
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestBaseDictWordTooLong()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x41))), unchecked(
+ (byte)unchecked((int)(0x02))) };
+ CheckSynth(compressed, false, string.Empty);
+ }
+
+ /*
+ // Has an unmodified dictionary word that goes over the end of the
+ // meta-block. Same as BaseDictWord, but with a shorter meta-block length.
+ main_header
+ metablock_header_easy: 1, 1
+ command_inscopy_easy: 0, 4
+ command_dist_easy: 1
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestBlockCountMessage()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x0b))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x01))), unchecked(
+ (byte)unchecked((int)(0x8c))), unchecked((byte)unchecked((int)(0xc1))), unchecked((byte)unchecked((int)(0xc5))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x08))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x22))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0xe1))), unchecked((byte)unchecked((int)(0xfc))), unchecked((byte)unchecked((int)(0xfd))), unchecked((byte)unchecked((int)(0x22))), unchecked(
+ (byte)unchecked((int)(0x2c))), unchecked((byte)unchecked((int)(0xc4))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0xd8))), unchecked(
+ (byte)unchecked((int)(0x32))), unchecked((byte)unchecked((int)(0x89))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x77))), unchecked((byte)unchecked((int)(0xda))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x10))), unchecked((byte)unchecked((int)(0x42))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))) };
+ CheckSynth(compressed, true, string.Empty + "aabbaaaaabab");
+ }
+
+ /*
+ // Same as BlockSwitchMessage but also uses 0-bit block-type commands.
+ main_header
+ metablock_header_begin: 1, 0, 12, 0
+ // two literal block types
+ vlq_blocktypes: 2
+ huffman_simple: 1,1,4, 1 // literal blocktype prefix code
+ huffman_fixed: 26 // literal blockcount prefix code
+ blockcount_easy: 2 // 2 a's
+ // one ins/copy and dist block type
+ vlq_blocktypes: 1
+ vlq_blocktypes: 1
+ ndirect: 0 0
+ // two MSB6 literal context modes
+ bits: "00", "00"
+ // two literal prefix codes
+ vlq_blocktypes: 2
+ // literal context map
+ vlq_rlemax: 5
+ huffman_simple: 0,3,7, 5,0,6 // context map rle huffman code
+ // context map rle: repeat 0 64 times, 1+5 64 times
+ bits: "01", "0", "11111", "11", "0", "11111"
+ bit: 1 // MTF enabled
+ // one distance prefix code
+ vlq_blocktypes: 1
+ huffman_simple: 0,1,256, 97 // only a's
+ huffman_simple: 0,1,256, 98 // only b's
+ huffman_fixed: 704
+ huffman_fixed: 64
+ // now comes the data
+ command_inscopy_easy: 12, 0
+ blockcount_easy: 2 // switch to other block type; 2 b's
+ blockcount_easy: 5 // switch to other block type; 5 a's
+ blockcount_easy: 1 // switch to other block type; 1 b
+ blockcount_easy: 1 // switch to other block type; 1 a
+ blockcount_easy: 1 // switch to other block type; 1 b
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestBlockSwitchMessage()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x0b))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xd1))), unchecked((byte)unchecked((int)(0xe1))), unchecked(
+ (byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0xc6))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0xe2))), unchecked((byte)unchecked((int)(0x06))), unchecked((byte)unchecked((int)(0x04))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x91))), unchecked((byte)unchecked((int)(0xb2))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xfe))), unchecked((byte)unchecked((int)(0x7e))), unchecked(
+ (byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x16))), unchecked((byte)unchecked((int)(0x62))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x1c))), unchecked(
+ (byte)unchecked((int)(0x6c))), unchecked((byte)unchecked((int)(0x99))), unchecked((byte)unchecked((int)(0xc4))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x09))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x3b))), unchecked((byte)unchecked((int)(0x6d))), unchecked((byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x08))), unchecked((byte)unchecked((int)(0x82))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))) };
+ CheckSynth(compressed, true, string.Empty + "aabbaaaaabab");
+ }
+
+ /*
+ // Uses blocks with 1-symbol huffman codes that take 0 bits, so that it
+ // is the blockswitch commands that encode the message rather than actual
+ // literals.
+ main_header
+ metablock_header_begin: 1, 0, 12, 0
+ // two literal block types
+ vlq_blocktypes: 2
+ huffman_simple: 1,4,4, 1,0,2,3 // literal blocktype prefix code
+ huffman_fixed: 26 // literal blockcount prefix code
+ blockcount_easy: 2 // 2 a's
+ // one ins/copy and dist block type
+ vlq_blocktypes: 1
+ vlq_blocktypes: 1
+ ndirect: 0 0
+ // two MSB6 literal context modes
+ bits: "00", "00"
+ // two literal prefix codes
+ vlq_blocktypes: 2
+ // literal context map
+ vlq_rlemax: 5
+ huffman_simple: 0,3,7, 5,0,6 // context map rle huffman code
+ // context map rle: repeat 0 64 times, 1+5 64 times
+ bits: "01", "0", "11111", "11", "0", "11111"
+ bit: 1 // MTF enabled
+ // one distance prefix code
+ vlq_blocktypes: 1
+ huffman_simple: 0,1,256, 97 // only a's
+ huffman_simple: 0,1,256, 98 // only b's
+ huffman_fixed: 704
+ huffman_fixed: 64
+ // now comes the data
+ command_inscopy_easy: 12, 0
+ bits: "0"; blockcount_easy: 2 // switch to other block type; 2 b's
+ bits: "0"; blockcount_easy: 5 // switch to other block type; 5 a's
+ bits: "0"; blockcount_easy: 1 // switch to other block type; 1 b
+ bits: "0"; blockcount_easy: 1 // switch to other block type; 1 a
+ bits: "0"; blockcount_easy: 1 // switch to other block type; 1 b
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestClClTreeDeficiency()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x43))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x05))), unchecked(
+ (byte)unchecked((int)(0x88))), unchecked((byte)unchecked((int)(0x55))), unchecked((byte)unchecked((int)(0x90))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0xd8))), unchecked((byte)unchecked((int)(0x32))), unchecked((byte)unchecked((int)(0x89))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x77))), unchecked((byte)unchecked((int)(0xda))), unchecked((byte)unchecked((int)(0x28))), unchecked((byte)unchecked((int)(0x40))), unchecked((byte)unchecked((int)(0x23))) };
+ CheckSynth(compressed, false, string.Empty + "aaab");
+ }
+
+ /*
+ // This test is a copy of TooManySymbolsRepeated, with changed clcl table.
+ main_header
+ metablock_header_begin: 1, 0, 4, 0
+ metablock_header_trivial_context
+ hskip: 0
+ clcl_ordered: 0,3,0,0,0,0,0,0,3,3,0,0,0,0,0,0,1,0
+ set_prefix_cl_rle: "", "110", "", "", "", "", "", "", "111", "101",\
+ "", "", "", "", "", "", "0", ""
+ cl_rle: 8
+ cl_rle_rep: 9, 96
+ cl_rle: 1
+ cl_rle_rep: 9, 159 // 1 + 96 + 1 + 159 = 257 > 256 = alphabet size
+ huffman_fixed: 704
+ huffman_fixed: 64
+ command_inscopy_easy: 4, 0
+ command_literal_bits: 0, 0, 0, 101100010
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestClClTreeExcess()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xc3))), unchecked((byte)unchecked((int)(0x7b))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x58))), unchecked(
+ (byte)unchecked((int)(0x41))), unchecked((byte)unchecked((int)(0x06))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x60))), unchecked((byte)unchecked((int)(0xcb))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x06))), unchecked((byte)unchecked((int)(0x48))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xdc))), unchecked(
+ (byte)unchecked((int)(0x69))), unchecked((byte)unchecked((int)(0xa3))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x8d))), unchecked((byte)unchecked((int)(0x00))) };
+ CheckSynth(compressed, false, string.Empty + "aaab");
+ }
+
+ /*
+ // This test is a copy of ClClTreeDeficiency, with changed clcl table.
+ main_header
+ metablock_header_begin: 1, 0, 4, 0
+ metablock_header_trivial_context
+ hskip: 0
+ clcl_ordered: 0,3,0,0,0,0,0,0,3,1,0,0,0,0,0,0,1,0
+ set_prefix_cl_rle: "", "110", "", "", "", "", "", "", "111", "1",\
+ "", "", "", "", "", "", "0", ""
+ cl_rle: 8
+ cl_rle_rep: 9, 96
+ cl_rle: 1
+ cl_rle_rep: 9, 159 // 1 + 96 + 1 + 159 = 257 > 256 = alphabet size
+ huffman_fixed: 704
+ huffman_fixed: 64
+ command_inscopy_easy: 4, 0
+ command_literal_bits: 0, 0, 0, 101100010
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestComplexHuffmanCodeTwoSymbols()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked(
+ (byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0xa2))), unchecked((byte)unchecked((int)(0x1a))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x0e))), unchecked((byte)unchecked((int)(0xb6))), unchecked((byte)unchecked((int)(0x4c))), unchecked((byte)unchecked((int)(0x62))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x04))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xc0))), unchecked((byte)unchecked((int)(0x9d))), unchecked((byte)unchecked((int)(0x36))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x04))) };
+ CheckSynth(compressed, true, string.Empty + "ab");
+ }
+
+ /*
+ // This tests a complex huffman code with only two symbols followed by a
+ // tiny amount of content.
+ main_header
+ metablock_header_begin: 1, 0, 2, 0
+ metablock_header_trivial_context
+ // begin of literal huffman tree. The tree has symbol length 1 for "a",
+ // symbol length 1 for "b" and symbol length 0 for all others.
+ hskip: 0
+ clcl_ordered: 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
+ set_prefix_cl_rle: "", "0", "", "", "", "", "", "", "", "",\
+ "", "", "", "", "", "", "", "1"
+ cl_rle_rep_0: 97
+ cl_rle: 1 // literal number 97, that is, the letter 'a'
+ cl_rle: 1 // literal number 98, that is, the letter 'b'
+ // end of literal huffman tree
+ huffman_fixed: 704
+ huffman_fixed: 64
+ command_inscopy_easy: 2, 0
+ command_literal_bits: 0, 1 // a followed by b
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestCompressedUncompressedShortCompressed()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x8b))), unchecked((byte)unchecked((int)(0xfe))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x9b))), unchecked((byte)unchecked((int)(0x66))), unchecked(
+ (byte)unchecked((int)(0x6f))), unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x0a))), unchecked((byte)unchecked((int)(0x50))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x10))), unchecked(
+ (byte)unchecked((int)(0x62))), unchecked((byte)unchecked((int)(0x62))), unchecked((byte)unchecked((int)(0x62))), unchecked((byte)unchecked((int)(0x62))), unchecked((byte)unchecked((int)(0x62))), unchecked((byte)unchecked((int)(0x62))), unchecked(
+ (byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked(
+ (byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))) };
+ CheckSynth(compressed, true, string.Empty + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaabbbbbbbbbb"
+ );
+ }
+
+ /*
+ main_header: 22
+ metablock_header_easy: 1022, 0
+ command_easy: 1021, "a", 1 // 1022 x "a"
+ metablock_uncompressed: "bbbbbb"
+ metablock_header_easy: 4, 1
+ command_easy: 4, "", 1 // 6 + 4 = 10 x "b"
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestCompressedUncompressedShortCompressedSmallWindow()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x21))), unchecked((byte)unchecked((int)(0xf4))), unchecked((byte)unchecked((int)(0x0f))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x1c))), unchecked((byte)unchecked((int)(0xa7))), unchecked((byte)unchecked((int)(0x6d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0xd8))), unchecked((byte)unchecked((int)(0x32))), unchecked((byte)unchecked((int)(0x89))), unchecked((byte)unchecked((int)(0x01))), unchecked(
+ (byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x77))), unchecked((byte)unchecked((int)(0xda))), unchecked((byte)unchecked((int)(0x34))), unchecked(
+ (byte)unchecked((int)(0x7b))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x50))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x80))), unchecked(
+ (byte)unchecked((int)(0x62))), unchecked((byte)unchecked((int)(0x62))), unchecked((byte)unchecked((int)(0x62))), unchecked((byte)unchecked((int)(0x62))), unchecked((byte)unchecked((int)(0x62))), unchecked((byte)unchecked((int)(0x62))), unchecked(
+ (byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked(
+ (byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))) };
+ CheckSynth(compressed, true, string.Empty + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaabbbbbbbbbb"
+ );
+ }
+
+ /*
+ main_header: 10
+ metablock_header_easy: 1022, 0
+ command_easy: 1021, "a", 1 // 1022 x "a"
+ metablock_uncompressed: "bbbbbb"
+ metablock_header_easy: 4, 1
+ command_easy: 4, "", 1 // 6 + 4 = 10 x "b"
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestCopyLengthTooLong()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x86))), unchecked((byte)unchecked((int)(0x02))) };
+ CheckSynth(compressed, false, string.Empty);
+ }
+
+ /*
+ // Has a copy length that goes over the end of the meta-block.
+ // Same as OneCommand, but with a shorter meta-block length.
+ main_header
+ metablock_header_easy: 2, 1
+ command_easy: 2, "a", 1
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestCustomHuffmanCode()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xc3))), unchecked((byte)unchecked((int)(0x3d))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x58))), unchecked(
+ (byte)unchecked((int)(0x82))), unchecked((byte)unchecked((int)(0x08))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xc0))), unchecked((byte)unchecked((int)(0xc1))), unchecked((byte)unchecked((int)(0x96))), unchecked(
+ (byte)unchecked((int)(0x49))), unchecked((byte)unchecked((int)(0x0c))), unchecked((byte)unchecked((int)(0x90))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xb8))), unchecked(
+ (byte)unchecked((int)(0xd3))), unchecked((byte)unchecked((int)(0x46))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x1a))), unchecked((byte)unchecked((int)(0x01))) };
+ CheckSynth(compressed, true, string.Empty + "aaab");
+ }
+
+ /*
+ // This tests a small hand crafted huffman code followed by a tiny amount
+ // of content. This tests if the bit reader detects the end correctly even
+ // with tiny content after a larger huffman tree encoding.
+ main_header
+ metablock_header_begin: 1, 0, 4, 0
+ metablock_header_trivial_context
+ // begin of literal huffman tree. The tree has symbol length 1 for "a",
+ // symbol length 8 for null, symbol length 9 for all others. The length 1
+ // for a is chosen on purpose here, the others must be like that to
+ // fulfill the requirement that sum of 32>>length is 32768.
+ hskip: 0
+ clcl_ordered: 0,3,0,0,0,0,0,0,3,2,0,0,0,0,0,0,1,0
+ set_prefix_cl_rle: "", "110", "", "", "", "", "", "", "111", "10",\
+ "", "", "", "", "", "", "0", ""
+ cl_rle: 8
+ cl_rle_rep: 9, 96
+ cl_rle: 1 // literal number 97, that is, the letter 'a'
+ cl_rle_rep: 9, 158
+ // end of literal huffman tree
+ huffman_fixed: 704
+ huffman_fixed: 64
+ command_inscopy_easy: 4, 0
+ // Here is how the code "101100010" for b is derived: remember that a has
+ // symbol length 1, null has symbol length 8, the rest 9. So in the
+ // canonical huffman code, the code for "a" is "0", for null is
+ // "10000000". The next value has "100000010" (cfr. the rules of canonical
+ // prefix code). Counting upwards +95 from there, the value "@" (ascii 96,
+ // before "a") has "101100001", and so b, the next 9-bit symbol, has the
+ // next binary value "101100010".
+ command_literal_bits: 0, 0, 0, 101100010 // 3 a's followed by a b
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestEmpty()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x3b))) };
+ CheckSynth(compressed, true, string.Empty);
+ }
+
+ /*
+ main_header
+ metablock_lastempty
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestHelloWorld()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x0a))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x9b))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x59))), unchecked((byte)unchecked((int)(0x98))), unchecked((byte)unchecked((int)(0xda))), unchecked((byte)unchecked((int)(0xd8))), unchecked((byte)unchecked((int)(0xd8))), unchecked((byte)unchecked((int)(0x13))), unchecked(
+ (byte)unchecked((int)(0xb8))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x3b))), unchecked((byte)unchecked((int)(0xd9))), unchecked((byte)unchecked((int)(0x98))), unchecked((byte)unchecked((int)(0x00))) };
+ CheckSynth(compressed, true, string.Empty + "hello world");
+ }
+
+ /*
+ main_header
+ metablock_fixed: "hello world", 1
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestInsertTooLong()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x09))), unchecked(
+ (byte)unchecked((int)(0x86))), unchecked((byte)unchecked((int)(0x46))) };
+ CheckSynth(compressed, false, string.Empty);
+ }
+
+ /*
+ // Has an insert length that goes over the end of the meta-block.
+ // Same as OneInsert, but with a shorter meta-block length.
+ main_header
+ metablock_header_easy: 1, 1
+ command_easy: 0, "ab"
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestInvalidNoLastMetablock()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x0b))), unchecked((byte)unchecked((int)(0x06))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x9b))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x13))), unchecked((byte)unchecked((int)(0x59))), unchecked((byte)unchecked((int)(0x98))), unchecked((byte)unchecked((int)(0xda))), unchecked((byte)unchecked((int)(0xd8))), unchecked((byte)unchecked((int)(0xd8))), unchecked(
+ (byte)unchecked((int)(0x13))), unchecked((byte)unchecked((int)(0xb8))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x3b))), unchecked((byte)unchecked((int)(0xd9))), unchecked((byte)unchecked((int)(0x98))), unchecked(
+ (byte)unchecked((int)(0xe8))), unchecked((byte)unchecked((int)(0x00))) };
+ CheckSynth(compressed, false, string.Empty + "hello world");
+ }
+
+ /*
+ main_header
+ metablock_fixed: \"hello world\", 0
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestInvalidNoMetaBlocks()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x0b))) };
+ CheckSynth(compressed, false, string.Empty);
+ }
+
+ /*
+ main_header
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestInvalidTooFarDist()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0xa1))), unchecked((byte)unchecked((int)(0x48))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x1c))), unchecked((byte)unchecked((int)(0xa7))), unchecked((byte)unchecked((int)(0x6d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0xd8))), unchecked((byte)unchecked((int)(0x32))), unchecked((byte)unchecked((int)(0x89))), unchecked((byte)unchecked((int)(0x01))), unchecked(
+ (byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x77))), unchecked((byte)unchecked((int)(0xda))), unchecked((byte)unchecked((int)(0xe8))), unchecked(
+ (byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x62))), unchecked((byte)unchecked((int)(0x6f))), unchecked((byte)unchecked((int)(0x4f))), unchecked((byte)unchecked((int)(0x60))), unchecked((byte)unchecked((int)(0x66))), unchecked(
+ (byte)unchecked((int)(0xe8))), unchecked((byte)unchecked((int)(0x44))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x0f))), unchecked((byte)unchecked((int)(0x09))), unchecked((byte)unchecked((int)(0x0d))) };
+ CheckSynth(compressed, false, string.Empty);
+ }
+
+ /*
+ main_header: 10
+ metablock_header_begin: 1, 0, 10, 0
+ metablock_header_trivial_context
+ huffman_fixed: 256
+ huffman_fixed: 704
+ huffman_fixed: 64
+ command_easy: 2, "too far!", 1000000 // distance too far for 10 wbits
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestInvalidTooLargeContextMap()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xd1))), unchecked((byte)unchecked((int)(0xe1))), unchecked(
+ (byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0xc6))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0xe2))), unchecked((byte)unchecked((int)(0x06))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x91))), unchecked((byte)unchecked((int)(0xb2))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xfe))), unchecked((byte)unchecked((int)(0xfb))), unchecked(
+ (byte)unchecked((int)(0x45))), unchecked((byte)unchecked((int)(0x58))), unchecked((byte)unchecked((int)(0x88))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked(
+ (byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x01))) };
+ CheckSynth(compressed, false, string.Empty + "a");
+ }
+
+ /*
+ // Has a repeat code a context map that makes the size too big -> invalid.
+ main_header
+ metablock_header_begin: 1, 0, 1, 0
+ // two literal block types
+ vlq_blocktypes: 2
+ huffman_simple: 1,4,4, 1,0,2,3 // literal blocktype prefix code
+ huffman_fixed: 26 // literal blockcount prefix code
+ blockcount_easy: 1
+ // one ins/copy and dist block type
+ vlq_blocktypes: 1
+ vlq_blocktypes: 1
+ ndirect: 0 0
+ // two MSB6 literal context modes
+ bits: "00", "00"
+ // two literal prefix codes
+ vlq_blocktypes: 2
+ // literal context map
+ vlq_rlemax: 5
+ huffman_simple: 0,3,7, 5,0,6 // context map rle huffman code
+ // Too long context map rle: repeat 0 64 times, 1+5 65 times, that is 129
+ // values which is 1 too much.
+ bits: "01", "0", "11111", "11", "11", "0", "11111"
+ bit: 1 // MTF enabled
+ // one distance prefix code
+ vlq_blocktypes: 1
+ huffman_simple: 0,1,256, 97 // only a's
+ huffman_simple: 0,1,256, 98 // only b's
+ huffman_fixed: 704
+ huffman_fixed: 64
+ // now comes the data
+ command_inscopy_easy: 1, 0
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestInvalidTransformType()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x41))), unchecked(
+ (byte)unchecked((int)(0x2d))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x19))) };
+ CheckSynth(compressed, false, string.Empty);
+ }
+
+ /*
+ main_header
+ metablock_header_easy: 4, 1
+ command_inscopy_easy: 0, 4
+ command_dist_easy: 123905 // = 121 << 10 + 1
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestInvalidWindowBits9()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x91))), unchecked((byte)unchecked((int)(0x10))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x1c))), unchecked((byte)unchecked((int)(0xa7))), unchecked((byte)unchecked((int)(0x6d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0xd8))), unchecked((byte)unchecked((int)(0x32))), unchecked((byte)unchecked((int)(0x89))), unchecked((byte)unchecked((int)(0x01))), unchecked(
+ (byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x77))), unchecked((byte)unchecked((int)(0xda))), unchecked((byte)unchecked((int)(0xc8))), unchecked(
+ (byte)unchecked((int)(0x20))), unchecked((byte)unchecked((int)(0x32))), unchecked((byte)unchecked((int)(0xd4))), unchecked((byte)unchecked((int)(0x01))) };
+ CheckSynth(compressed, false, string.Empty + "a");
+ }
+
+ /*
+ main_header: 9
+ metablock_fixed: \"a\", 1
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestManyTinyMetablocks()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x0b))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked(
+ (byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked(
+ (byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x04))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x61))), unchecked((byte)unchecked((int)(0x34))) };
+ CheckSynth(compressed, true, string.Empty + "abababababababababababababababababababababababababababababababababababab" + "abababababababababababababababababababababababababababababababababababab" + "abababababababababababababababababababababababababababababababababababab"
+ + "abababababababababababababababababababababababababababababababababababab" + "abababababababababababababababababababababababababababababababababababab" + "abababababababababababababababababababababababababababababababababababab" + "abababababababababababababababababababababababababababababababababababab"
+ + "abababababababababababababababababababababababababababababababababababab" + "abababababababababababab");
+ }
+
+ /*
+ main_header
+ repeat: 300
+ metablock_uncompressed: "a"
+ metablock_fixed: "b"
+ end_repeat
+ metablock_lastempty
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestNegativeDistance()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x0f))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x41))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x42))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x42))), unchecked((byte)unchecked((int)(0x01))), unchecked(
+ (byte)unchecked((int)(0x42))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x42))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x42))), unchecked((byte)unchecked((int)(0x01))), unchecked(
+ (byte)unchecked((int)(0x1c))) };
+ CheckSynth(compressed, false, string.Empty + "timemememememeXX");
+ }
+
+ /*
+ main_header
+ metablock_header_easy: 16, 1
+ command_inscopy_easy: 0, 4 // time
+ command_dist_easy: 1
+ command_inscopy_easy: 0, 2 // me
+ command_dist_easy: 2
+ command_inscopy_easy: 0, 2 // me
+ command_dist_easy: 2
+ command_inscopy_easy: 0, 2 // me
+ command_dist_easy: 2
+ command_inscopy_easy: 0, 2 // me
+ command_dist_easy: 2
+ command_inscopy_easy: 0, 2 // me
+ command_dist_easy: 2 // All rb items are 2 now
+ command_inscopy_easy: 0, 2
+ bits: "011100" // 15 -> distance = rb[idx + 2] - 3
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestNegativeRemainingLenBetweenMetablocks()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x0b))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x09))), unchecked(
+ (byte)unchecked((int)(0x86))), unchecked((byte)unchecked((int)(0x46))), unchecked((byte)unchecked((int)(0x11))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x38))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0xdb))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked(
+ (byte)unchecked((int)(0x24))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x91))), unchecked(
+ (byte)unchecked((int)(0x60))), unchecked((byte)unchecked((int)(0x68))), unchecked((byte)unchecked((int)(0x04))) };
+ CheckSynth(compressed, false, string.Empty + "abab");
+ }
+
+ /*
+ main_header
+ metablock_header_easy: 1, 0
+ command_easy: 0, "ab" // remaining length == -1 -> invalid stream
+ metablock_header_easy: 2, 1
+ command_easy: 0, "ab"
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestOneCommand()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x11))), unchecked(
+ (byte)unchecked((int)(0x86))), unchecked((byte)unchecked((int)(0x02))) };
+ CheckSynth(compressed, true, string.Empty + "aaa");
+ }
+
+ /*
+ // The stream consists of one command with insert and copy.
+ main_header
+ metablock_header_easy: 3, 1
+ command_easy: 2, "a", 1
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestOneInsert()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x09))), unchecked(
+ (byte)unchecked((int)(0x86))), unchecked((byte)unchecked((int)(0x46))) };
+ CheckSynth(compressed, true, string.Empty + "ab");
+ }
+
+ /*
+ // The stream consists of one half command with insert only.
+ main_header
+ metablock_header_easy: 2, 1
+ command_easy: 0, "ab"
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestSimplePrefix()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xa0))), unchecked(
+ (byte)unchecked((int)(0xc3))), unchecked((byte)unchecked((int)(0xc4))), unchecked((byte)unchecked((int)(0xc6))), unchecked((byte)unchecked((int)(0xc8))), unchecked((byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x51))), unchecked((byte)unchecked((int)(0xa0))), unchecked(
+ (byte)unchecked((int)(0x1d))) };
+ CheckSynth(compressed, true, string.Empty + "abcd");
+ }
+
+ /*
+ main_header
+ metablock_header_begin: 1, 0, 4, 0
+ metablock_header_trivial_context
+ huffman_simple: 1,4,256, 97,98,99,100 // ascii codes for a, b, c, d
+ huffman_fixed: 704
+ huffman_fixed: 64
+ command_inscopy_easy: 4, 0
+ command_literal_bits: 0, 10, 110, 111 // a, b, c, d
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestSimplePrefixDuplicateSymbols()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xa0))), unchecked(
+ (byte)unchecked((int)(0xc3))), unchecked((byte)unchecked((int)(0xc4))), unchecked((byte)unchecked((int)(0xc2))), unchecked((byte)unchecked((int)(0xc4))), unchecked((byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x70))), unchecked((byte)unchecked((int)(0xb0))), unchecked((byte)unchecked((int)(0x65))), unchecked((byte)unchecked((int)(0x12))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x24))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xee))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x51))), unchecked((byte)unchecked((int)(0xa0))), unchecked(
+ (byte)unchecked((int)(0x1d))) };
+ CheckSynth(compressed, false, string.Empty + "abab");
+ }
+
+ /*
+ main_header
+ metablock_header_begin: 1, 0, 4, 0
+ metablock_header_trivial_context
+ huffman_simple: 1,4,256, 97,98,97,98 // ascii codes for a, b, a, b
+ huffman_fixed: 704
+ huffman_fixed: 64
+ command_inscopy_easy: 4, 0
+ command_literal_bits: 0, 10, 110, 111 // a, b, a, b
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestSimplePrefixOutOfRangeSymbols()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x4d))), unchecked((byte)unchecked((int)(0xff))), unchecked(
+ (byte)unchecked((int)(0xef))), unchecked((byte)unchecked((int)(0x7f))), unchecked((byte)unchecked((int)(0xff))), unchecked((byte)unchecked((int)(0xfc))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0xb8))), unchecked((byte)unchecked((int)(0xd3))), unchecked((byte)unchecked((int)(0x06))) };
+ CheckSynth(compressed, false, string.Empty);
+ }
+
+ /*
+ main_header
+ metablock_header_begin: 1, 0, 4, 0
+ metablock_header_trivial_context
+ huffman_fixed: 256
+ huffman_simple: 1,4,704, 1023,1022,1021,1020
+ huffman_fixed: 64
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestTooManySymbolsRepeated()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xc3))), unchecked((byte)unchecked((int)(0x3d))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0x58))), unchecked(
+ (byte)unchecked((int)(0x82))), unchecked((byte)unchecked((int)(0x0c))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xc0))), unchecked((byte)unchecked((int)(0xc1))), unchecked((byte)unchecked((int)(0x96))), unchecked(
+ (byte)unchecked((int)(0x49))), unchecked((byte)unchecked((int)(0x0c))), unchecked((byte)unchecked((int)(0x90))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xb8))), unchecked(
+ (byte)unchecked((int)(0xd3))), unchecked((byte)unchecked((int)(0x46))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x1a))), unchecked((byte)unchecked((int)(0x01))) };
+ CheckSynth(compressed, false, string.Empty + "aaab");
+ }
+
+ /*
+ // This test is a copy of CustomHuffmanCode, with changed repeat count.
+ main_header
+ metablock_header_begin: 1, 0, 4, 0
+ metablock_header_trivial_context
+ hskip: 0
+ clcl_ordered: 0,3,0,0,0,0,0,0,3,2,0,0,0,0,0,0,1,0
+ set_prefix_cl_rle: "", "110", "", "", "", "", "", "", "111", "10",\
+ "", "", "", "", "", "", "0", ""
+ cl_rle: 8
+ cl_rle_rep: 9, 96
+ cl_rle: 1
+ cl_rle_rep: 9, 159 // 1 + 96 + 1 + 159 = 257 > 256 = alphabet size
+ huffman_fixed: 704
+ huffman_fixed: 64
+ command_inscopy_easy: 4, 0
+ command_literal_bits: 0, 0, 0, 101100010
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestTransformedDictWord()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x08))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x41))), unchecked(
+ (byte)unchecked((int)(0x09))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x01))) };
+ CheckSynth(compressed, true, string.Empty + "time the ");
+ }
+
+ /*
+ // The stream consists of a transformed dictionary word.
+ main_header
+ metablock_header_easy: 9, 1
+ command_inscopy_easy: 0, 4
+ command_dist_easy: 5121
+ */
+ [NUnit.Framework.Test]
+ public virtual void TestTransformedDictWordTooLong()
+ {
+ byte[] compressed = new byte[] { unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x03))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x80))), unchecked((byte)unchecked((int)(0xe3))), unchecked((byte)unchecked((int)(0xb4))), unchecked((byte)unchecked((int)(0x0d))), unchecked((byte)unchecked((int)(0x00))), unchecked(
+ (byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0x07))), unchecked((byte)unchecked((int)(0x5b))), unchecked((byte)unchecked((int)(0x26))), unchecked((byte)unchecked((int)(0x31))), unchecked((byte)unchecked((int)(0x40))), unchecked(
+ (byte)unchecked((int)(0x02))), unchecked((byte)unchecked((int)(0x00))), unchecked((byte)unchecked((int)(0xe0))), unchecked((byte)unchecked((int)(0x4e))), unchecked((byte)unchecked((int)(0x1b))), unchecked((byte)unchecked((int)(0x41))), unchecked(
+ (byte)unchecked((int)(0x09))), unchecked((byte)unchecked((int)(0x01))), unchecked((byte)unchecked((int)(0x01))) };
+ CheckSynth(compressed, false, string.Empty);
+ }
+ /*
+ // Has a transformed dictionary word that goes over the end of the
+ // meta-block, but the base dictionary word fits in the meta-block.
+ // Same as TransformedDictWord, but with a shorter meta-block length.
+ main_header
+ metablock_header_easy: 4, 1
+ command_inscopy_easy: 0, 4
+ command_dist_easy: 5121
+ */
+ /* GENERATED CODE END */
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Transform.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Transform.cs
new file mode 100644
index 000000000..9869d6ec2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Transform.cs
@@ -0,0 +1,154 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>Transformations on dictionary words.</summary>
+ internal sealed class Transform
+ {
+ private readonly byte[] prefix;
+
+ private readonly int type;
+
+ private readonly byte[] suffix;
+
+ internal Transform(string prefix, int type, string suffix)
+ {
+ this.prefix = ReadUniBytes(prefix);
+ this.type = type;
+ this.suffix = ReadUniBytes(suffix);
+ }
+
+ internal static byte[] ReadUniBytes(string uniBytes)
+ {
+ byte[] result = new byte[uniBytes.Length];
+ for (int i = 0; i < result.Length; ++i)
+ {
+ result[i] = unchecked((byte)uniBytes[i]);
+ }
+ return result;
+ }
+
+ internal static readonly Org.Brotli.Dec.Transform[] Transforms = new Org.Brotli.Dec.Transform[] { new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, string.Empty), new Org.Brotli.Dec.Transform(string.Empty,
+ Org.Brotli.Dec.WordTransformType.Identity, " "), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.Identity, " "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.OmitFirst1, string.Empty), new Org.Brotli.Dec.Transform
+ (string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseFirst, " "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, " the "), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.Identity
+ , string.Empty), new Org.Brotli.Dec.Transform("s ", Org.Brotli.Dec.WordTransformType.Identity, " "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, " of "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType
+ .UppercaseFirst, string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, " and "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.OmitFirst2, string.Empty), new Org.Brotli.Dec.Transform
+ (string.Empty, Org.Brotli.Dec.WordTransformType.OmitLast1, string.Empty), new Org.Brotli.Dec.Transform(", ", Org.Brotli.Dec.WordTransformType.Identity, " "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity
+ , ", "), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.UppercaseFirst, " "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, " in "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType
+ .Identity, " to "), new Org.Brotli.Dec.Transform("e ", Org.Brotli.Dec.WordTransformType.Identity, " "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "\""), new Org.Brotli.Dec.Transform(string.Empty,
+ Org.Brotli.Dec.WordTransformType.Identity, "."), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "\">"), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "\n"), new
+ Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.OmitLast3, string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "]"), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType
+ .Identity, " for "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.OmitFirst3, string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.OmitLast2, string.Empty), new Org.Brotli.Dec.Transform
+ (string.Empty, Org.Brotli.Dec.WordTransformType.Identity, " a "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, " that "), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.UppercaseFirst
+ , string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, ". "), new Org.Brotli.Dec.Transform(".", Org.Brotli.Dec.WordTransformType.Identity, string.Empty), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType
+ .Identity, ", "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.OmitFirst4, string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, " with "), new Org.Brotli.Dec.Transform
+ (string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "'"), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, " from "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity
+ , " by "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.OmitFirst5, string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.OmitFirst6, string.Empty), new Org.Brotli.Dec.Transform
+ (" the ", Org.Brotli.Dec.WordTransformType.Identity, string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.OmitLast4, string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType
+ .Identity, ". The "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseAll, string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, " on "), new Org.Brotli.Dec.Transform
+ (string.Empty, Org.Brotli.Dec.WordTransformType.Identity, " as "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, " is "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.OmitLast7
+ , string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.OmitLast1, "ing "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "\n\t"), new Org.Brotli.Dec.Transform(string.Empty
+ , Org.Brotli.Dec.WordTransformType.Identity, ":"), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.Identity, ". "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "ed "), new Org.Brotli.Dec.Transform
+ (string.Empty, Org.Brotli.Dec.WordTransformType.OmitFirst9, string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.OmitFirst7, string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType
+ .OmitLast6, string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "("), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseFirst, ", "), new Org.Brotli.Dec.Transform
+ (string.Empty, Org.Brotli.Dec.WordTransformType.OmitLast8, string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, " at "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType
+ .Identity, "ly "), new Org.Brotli.Dec.Transform(" the ", Org.Brotli.Dec.WordTransformType.Identity, " of "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.OmitLast5, string.Empty), new Org.Brotli.Dec.Transform(
+ string.Empty, Org.Brotli.Dec.WordTransformType.OmitLast9, string.Empty), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.UppercaseFirst, ", "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseFirst
+ , "\""), new Org.Brotli.Dec.Transform(".", Org.Brotli.Dec.WordTransformType.Identity, "("), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseAll, " "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType
+ .UppercaseFirst, "\">"), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "=\""), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.Identity, "."), new Org.Brotli.Dec.Transform(".com/",
+ Org.Brotli.Dec.WordTransformType.Identity, string.Empty), new Org.Brotli.Dec.Transform(" the ", Org.Brotli.Dec.WordTransformType.Identity, " of the "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseFirst
+ , "'"), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, ". This "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, ","), new Org.Brotli.Dec.Transform(".", Org.Brotli.Dec.WordTransformType
+ .Identity, " "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseFirst, "("), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseFirst, "."), new Org.Brotli.Dec.Transform
+ (string.Empty, Org.Brotli.Dec.WordTransformType.Identity, " not "), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.Identity, "=\""), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "er "
+ ), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.UppercaseAll, " "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "al "), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType
+ .UppercaseAll, string.Empty), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "='"), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseAll, "\""), new Org.Brotli.Dec.Transform
+ (string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseFirst, ". "), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.Identity, "("), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity,
+ "ful "), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.UppercaseFirst, ". "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "ive "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType
+ .Identity, "less "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseAll, "'"), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "est "), new Org.Brotli.Dec.Transform
+ (" ", Org.Brotli.Dec.WordTransformType.UppercaseFirst, "."), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseAll, "\">"), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.Identity, "='"
+ ), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseFirst, ","), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity, "ize "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType
+ .UppercaseAll, "."), new Org.Brotli.Dec.Transform("\u00c2\u00a0", Org.Brotli.Dec.WordTransformType.Identity, string.Empty), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.Identity, ","), new Org.Brotli.Dec.Transform(string.Empty
+ , Org.Brotli.Dec.WordTransformType.UppercaseFirst, "=\""), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseAll, "=\""), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.Identity
+ , "ous "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseAll, ", "), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseFirst, "='"), new Org.Brotli.Dec.Transform(" ",
+ Org.Brotli.Dec.WordTransformType.UppercaseFirst, ","), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.UppercaseAll, "=\""), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.UppercaseAll, ", "), new Org.Brotli.Dec.Transform
+ (string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseAll, ","), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseAll, "("), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.
+ UppercaseAll, ". "), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.UppercaseAll, "."), new Org.Brotli.Dec.Transform(string.Empty, Org.Brotli.Dec.WordTransformType.UppercaseAll, "='"), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType
+ .UppercaseAll, ". "), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.UppercaseFirst, "=\""), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType.UppercaseAll, "='"), new Org.Brotli.Dec.Transform(" ", Org.Brotli.Dec.WordTransformType
+ .UppercaseFirst, "='") };
+
+ internal static int TransformDictionaryWord(byte[] dst, int dstOffset, byte[] word, int wordOffset, int len, Org.Brotli.Dec.Transform transform)
+ {
+ int offset = dstOffset;
+ // Copy prefix.
+ byte[] @string = transform.prefix;
+ int tmp = @string.Length;
+ int i = 0;
+ // In most cases tmp < 10 -> no benefits from System.arrayCopy
+ while (i < tmp)
+ {
+ dst[offset++] = @string[i++];
+ }
+ // Copy trimmed word.
+ int op = transform.type;
+ tmp = Org.Brotli.Dec.WordTransformType.GetOmitFirst(op);
+ if (tmp > len)
+ {
+ tmp = len;
+ }
+ wordOffset += tmp;
+ len -= tmp;
+ len -= Org.Brotli.Dec.WordTransformType.GetOmitLast(op);
+ i = len;
+ while (i > 0)
+ {
+ dst[offset++] = word[wordOffset++];
+ i--;
+ }
+ if (op == Org.Brotli.Dec.WordTransformType.UppercaseAll || op == Org.Brotli.Dec.WordTransformType.UppercaseFirst)
+ {
+ int uppercaseOffset = offset - len;
+ if (op == Org.Brotli.Dec.WordTransformType.UppercaseFirst)
+ {
+ len = 1;
+ }
+ while (len > 0)
+ {
+ tmp = dst[uppercaseOffset] & unchecked((int)(0xFF));
+ if (tmp < unchecked((int)(0xc0)))
+ {
+ if (tmp >= 'a' && tmp <= 'z')
+ {
+ dst[uppercaseOffset] ^= unchecked((byte)32);
+ }
+ uppercaseOffset += 1;
+ len -= 1;
+ }
+ else if (tmp < unchecked((int)(0xe0)))
+ {
+ dst[uppercaseOffset + 1] ^= unchecked((byte)32);
+ uppercaseOffset += 2;
+ len -= 2;
+ }
+ else
+ {
+ dst[uppercaseOffset + 2] ^= unchecked((byte)5);
+ uppercaseOffset += 3;
+ len -= 3;
+ }
+ }
+ }
+ // Copy suffix.
+ @string = transform.suffix;
+ tmp = @string.Length;
+ i = 0;
+ while (i < tmp)
+ {
+ dst[offset++] = @string[i++];
+ }
+ return offset - dstOffset;
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/TransformTest.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/TransformTest.cs
new file mode 100644
index 000000000..0f6845fde
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/TransformTest.cs
@@ -0,0 +1,74 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>
+ /// Tests for
+ /// <see cref="Transform"/>
+ /// .
+ /// </summary>
+ public class TransformTest
+ {
+ private static long Crc64(byte[] data)
+ {
+ long crc = -1;
+ for (int i = 0; i < data.Length; ++i)
+ {
+ long c = (crc ^ (long)(data[i] & unchecked((int)(0xFF)))) & unchecked((int)(0xFF));
+ for (int k = 0; k < 8; k++)
+ {
+ c = ((long)(((ulong)c) >> 1)) ^ (-(c & 1L) & -3932672073523589310L);
+ }
+ crc = c ^ ((long)(((ulong)crc) >> 8));
+ }
+ return ~crc;
+ }
+
+ [NUnit.Framework.Test]
+ public virtual void TestTrimAll()
+ {
+ byte[] output = new byte[2];
+ byte[] input = new byte[] { 119, 111, 114, 100 };
+ // "word"
+ Org.Brotli.Dec.Transform transform = new Org.Brotli.Dec.Transform("[", Org.Brotli.Dec.WordTransformType.OmitFirst5, "]");
+ Org.Brotli.Dec.Transform.TransformDictionaryWord(output, 0, input, 0, input.Length, transform);
+ byte[] expectedOutput = new byte[] { 91, 93 };
+ // "[]"
+ NUnit.Framework.Assert.AreEqual(expectedOutput, output);
+ }
+
+ [NUnit.Framework.Test]
+ public virtual void TestCapitalize()
+ {
+ byte[] output = new byte[8];
+ byte[] input = new byte[] { 113, unchecked((byte)(-61)), unchecked((byte)(-90)), unchecked((byte)(-32)), unchecked((byte)(-92)), unchecked((byte)(-86)) };
+ // "qæप"
+ Org.Brotli.Dec.Transform transform = new Org.Brotli.Dec.Transform("[", Org.Brotli.Dec.WordTransformType.UppercaseAll, "]");
+ Org.Brotli.Dec.Transform.TransformDictionaryWord(output, 0, input, 0, input.Length, transform);
+ byte[] expectedOutput = new byte[] { 91, 81, unchecked((byte)(-61)), unchecked((byte)(-122)), unchecked((byte)(-32)), unchecked((byte)(-92)), unchecked((byte)(-81)), 93 };
+ // "[QÆय]"
+ NUnit.Framework.Assert.AreEqual(expectedOutput, output);
+ }
+
+ [NUnit.Framework.Test]
+ public virtual void TestAllTransforms()
+ {
+ /* This string allows to apply all transforms: head and tail cutting, capitalization and
+ turning to upper case; all results will be mutually different. */
+ // "o123456789abcdef"
+ byte[] testWord = new byte[] { 111, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102 };
+ byte[] output = new byte[2259];
+ int offset = 0;
+ for (int i = 0; i < Org.Brotli.Dec.Transform.Transforms.Length; ++i)
+ {
+ offset += Org.Brotli.Dec.Transform.TransformDictionaryWord(output, offset, testWord, 0, testWord.Length, Org.Brotli.Dec.Transform.Transforms[i]);
+ output[offset++] = unchecked((byte)(-1));
+ }
+ NUnit.Framework.Assert.AreEqual(output.Length, offset);
+ NUnit.Framework.Assert.AreEqual(8929191060211225186L, Crc64(output));
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Utils.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Utils.cs
new file mode 100644
index 000000000..e95f87efe
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/Utils.cs
@@ -0,0 +1,59 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>A set of utility methods.</summary>
+ internal sealed class Utils
+ {
+ private static readonly byte[] ByteZeroes = new byte[1024];
+
+ private static readonly int[] IntZeroes = new int[1024];
+
+ /// <summary>Fills byte array with zeroes.</summary>
+ /// <remarks>
+ /// Fills byte array with zeroes.
+ /// <p> Current implementation uses
+ /// <see cref="System.Array.Copy(object, int, object, int, int)"/>
+ /// , so it should be used for length not
+ /// less than 16.
+ /// </remarks>
+ /// <param name="dest">array to fill with zeroes</param>
+ /// <param name="offset">the first byte to fill</param>
+ /// <param name="length">number of bytes to change</param>
+ internal static void FillWithZeroes(byte[] dest, int offset, int length)
+ {
+ int cursor = 0;
+ while (cursor < length)
+ {
+ int step = System.Math.Min(cursor + 1024, length) - cursor;
+ System.Array.Copy(ByteZeroes, 0, dest, offset + cursor, step);
+ cursor += step;
+ }
+ }
+
+ /// <summary>Fills int array with zeroes.</summary>
+ /// <remarks>
+ /// Fills int array with zeroes.
+ /// <p> Current implementation uses
+ /// <see cref="System.Array.Copy(object, int, object, int, int)"/>
+ /// , so it should be used for length not
+ /// less than 16.
+ /// </remarks>
+ /// <param name="dest">array to fill with zeroes</param>
+ /// <param name="offset">the first item to fill</param>
+ /// <param name="length">number of item to change</param>
+ internal static void FillWithZeroes(int[] dest, int offset, int length)
+ {
+ int cursor = 0;
+ while (cursor < length)
+ {
+ int step = System.Math.Min(cursor + 1024, length) - cursor;
+ System.Array.Copy(IntZeroes, 0, dest, offset + cursor, step);
+ cursor += step;
+ }
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/WordTransformType.cs b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/WordTransformType.cs
new file mode 100644
index 000000000..777a5f5a5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/org/brotli/dec/WordTransformType.cs
@@ -0,0 +1,68 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Distributed under MIT license.
+See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+namespace Org.Brotli.Dec
+{
+ /// <summary>Enumeration of all possible word transformations.</summary>
+ /// <remarks>
+ /// Enumeration of all possible word transformations.
+ /// <p>There are two simple types of transforms: omit X first/last symbols, two character-case
+ /// transforms and the identity transform.
+ /// </remarks>
+ internal sealed class WordTransformType
+ {
+ internal const int Identity = 0;
+
+ internal const int OmitLast1 = 1;
+
+ internal const int OmitLast2 = 2;
+
+ internal const int OmitLast3 = 3;
+
+ internal const int OmitLast4 = 4;
+
+ internal const int OmitLast5 = 5;
+
+ internal const int OmitLast6 = 6;
+
+ internal const int OmitLast7 = 7;
+
+ internal const int OmitLast8 = 8;
+
+ internal const int OmitLast9 = 9;
+
+ internal const int UppercaseFirst = 10;
+
+ internal const int UppercaseAll = 11;
+
+ internal const int OmitFirst1 = 12;
+
+ internal const int OmitFirst2 = 13;
+
+ internal const int OmitFirst3 = 14;
+
+ internal const int OmitFirst4 = 15;
+
+ internal const int OmitFirst5 = 16;
+
+ internal const int OmitFirst6 = 17;
+
+ internal const int OmitFirst7 = 18;
+
+ internal const int OmitFirst8 = 19;
+
+ internal const int OmitFirst9 = 20;
+
+ internal static int GetOmitFirst(int type)
+ {
+ return type >= OmitFirst1 ? (type - OmitFirst1 + 1) : 0;
+ }
+
+ internal static int GetOmitLast(int type)
+ {
+ return type <= OmitLast9 ? (type - OmitLast1 + 1) : 0;
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/sharpen.cfg b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/sharpen.cfg
new file mode 100644
index 000000000..b69cf4316
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/sharpen.cfg
@@ -0,0 +1,18 @@
+-pascalCase+
+-nativeTypeSystem
+-separateInterfaceConstants
+-maxColumns 240
+-copySharpenCs false
+-sharpenNamespace nonamespace
+-outputFolder build/generated
+
+-namespaceMapping java.io System.IO
+
+-typeMapping java.io.ByteArrayInputStream System.IO.MemoryStream
+-typeMapping java.io.ByteArrayOutputStream System.IO.MemoryStream
+-typeMapping java.io.InputStream System.IO.Stream
+
+-methodMapping java.io.ByteArrayOutputStream.toByteArray() ToArray
+-methodMapping java.io.InputStream.read() ReadByte
+-methodMapping org.brotli.dec.BrotliInputStream.read() ReadByte
+-methodMapping org.junit.Assert.assertArrayEquals NUnit.Framework.Assert.AreEqual
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/transpile.sh b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/transpile.sh
new file mode 100644
index 000000000..3fefb8432
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/csharp/transpile.sh
@@ -0,0 +1,94 @@
+if ! which mvn >/dev/null; then
+ echo -e '\033[01;31mMaven is not installed / configured.\033[00m'
+ exit 1
+fi
+
+if ! which mono >/dev/null; then
+ echo -e '\033[01;31mMono platform is not installed / configured.\033[00m'
+ exit 1
+fi
+
+if ! which nuget >/dev/null; then
+ echo -e '\033[01;31mNuGet compiler is not installed / configured.\033[00m'
+ exit 1
+fi
+
+if ! which mcs >/dev/null; then
+ echo -e '\033[01;31mC# compiler is not installed / configured.\033[00m'
+ exit 1
+fi
+
+rm -rf build
+mkdir build
+cd build
+
+#-------------------------------------------------------------------------------
+
+echo -e '\033[01;33mFetching Sharpen sources.\033[00m'
+
+git clone https://github.com/stanislaw89/sharpen.git
+cd sharpen
+git checkout 4f609ed42862a1f9aab1be00374ff86534a5e6d6 || exit 1
+
+#-------------------------------------------------------------------------------
+
+echo -e '\n\033[01;33mCompiling Sharpen.\033[00m'
+
+mvn clean package -DskipTests
+mvn dependency:copy -Dartifact=junit:junit:4.12 -DoutputDirectory=..
+cd ..
+cp sharpen/target/sharpencore-0.0.1-SNAPSHOT-jar-with-dependencies.jar ./sharpen.jar
+
+#-------------------------------------------------------------------------------
+
+echo -e '\n\033[01;33mTranspiling.\033[00m'
+
+cd ..
+java -jar build/sharpen.jar ../java/org/brotli/dec/ -cp build/junit-4.12.jar @sharpen.cfg
+
+#-------------------------------------------------------------------------------
+
+echo -e '\n\033[01;33mPatching.\033[00m'
+
+# TODO: detect "dead" files, that are not generated by sharpen anymore.
+cp -r build/generated/* ./
+
+# Reflection does not work without Sharpen.cs
+rm org/brotli/dec/EnumTest.cs
+
+PATTERN='\/\/ \<\{\[INJECTED CODE\]\}\>'
+CODE=$(<org/brotli/dec/BrotliInputStream.cs)
+REPLACEMENT=$(<injected_code.txt)
+echo "${CODE//$PATTERN/$REPLACEMENT}" > org/brotli/dec/BrotliInputStream.cs
+
+#-------------------------------------------------------------------------------
+
+echo -e '\n\033[01;33mDowloading dependencies.\033[00m'
+
+cd build
+nuget install NUnit -Version 3.6.1
+nuget install NUnit.ConsoleRunner -Version 3.6.1
+cd ..
+
+#-------------------------------------------------------------------------------
+
+echo -e '\n\033[01;33mCompiling generated code.\033[00m'
+
+SOURCES=`find org/brotli -type file ! -path "*Test.cs"`
+TESTS_SOURCES=`find org/brotli -type file -path "*Test.cs"`
+
+mcs $SOURCES -target:library -out:build/brotlidec.dll
+mcs $SOURCES $TESTS_SOURCES -target:library -out:build/brotlidec_test.dll -r:build/NUnit.3.6.1/lib/net45/nunit.framework.dll
+
+#-------------------------------------------------------------------------------
+
+echo -e '\n\033[01;33mRunning tests.\033[00m'
+
+export MONO_PATH=$MONO_PATH:`pwd`/build/NUnit.3.6.1/lib/net45
+mono --debug build/NUnit.ConsoleRunner.3.6.1/tools/nunit3-console.exe build/brotlidec_test.dll
+
+#-------------------------------------------------------------------------------
+
+echo -e '\n\033[01;33mCleanup.\033[00m'
+rm TestResult.xml
+rm -rf build
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/brotli-comparison-study-2015-09-22.pdf b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/brotli-comparison-study-2015-09-22.pdf
new file mode 100644
index 000000000..040f179e2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/brotli-comparison-study-2015-09-22.pdf
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/brotli.1 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/brotli.1
new file mode 100644
index 000000000..7242a3255
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/brotli.1
@@ -0,0 +1,132 @@
+.TH "BROTLI" "1" "February 2018" "brotli 1.0.0" "User commands"
+.SH "NAME"
+\fBbrotli\fR \- brotli, unbrotli \- compress or decompress files
+.SH SYNOPSIS
+.P
+\fBbrotli\fP [\fIOPTION|FILE\fR]\.\.\.
+.P
+\fBunbrotli\fP is equivalent to \fBbrotli \-\-decompress\fP
+.SH DESCRIPTION
+.P
+\fBbrotli\fP is a generic\-purpose lossless compression algorithm that compresses
+data using a combination of a modern variant of the \fBLZ77\fR algorithm, Huffman
+coding and 2\-nd order context modeling, with a compression ratio comparable to
+the best currently available general\-purpose compression methods\. It is similar
+in speed with deflate but offers more dense compression\.
+.P
+\fBbrotli\fP command line syntax similar to \fBgzip (1)\fP and \fBzstd (1)\fP\|\.
+Unlike \fBgzip (1)\fP, source files are preserved by default\. It is possible to
+remove them after processing by using the \fB\-\-rm\fP \fIoption\fR\|\.
+.P
+Arguments that look like "\fB\-\-name\fP" or "\fB\-\-name=value\fP" are \fIoptions\fR\|\. Every
+\fIoption\fR has a short form "\fB\-x\fP" or "\fB\-x value\fP"\. Multiple short form \fIoptions\fR
+could be coalesced:
+.RS 0
+.IP \(bu 2
+"\fB\-\-decompress \-\-stdout \-\-suffix=\.b\fP" works the same as
+.IP \(bu 2
+"\fB\-d \-s \-S \.b\fP" and
+.IP \(bu 2
+"\fB\-dsS \.b\fP"
+
+.RE
+.P
+\fBbrotli\fP has 3 operation modes:
+.RS 0
+.IP \(bu 2
+default mode is compression;
+.IP \(bu 2
+\fB\-\-decompress\fP option activates decompression mode;
+.IP \(bu 2
+\fB\-\-test\fP option switches to integrity test mode; this option is equivalent to
+"\fB\-\-decompress \-\-stdout\fP" except that the decompressed data is discarded
+instead of being written to standard output\.
+
+.RE
+.P
+Every non\-option argument is a \fIfile\fR entry\. If no \fIfiles\fR are given or \fIfile\fR
+is "\fB\-\fP", \fBbrotli\fP reads from standard input\. All arguments after "\fB\-\-\fP" are
+\fIfile\fR entries\.
+.P
+Unless \fB\-\-stdout\fP or \fB\-\-output\fP is specified, \fIfiles\fR are written to a new file
+whose name is derived from the source \fIfile\fR name:
+.RS 0
+.IP \(bu 2
+when compressing, a suffix is appended to the source filename to
+get the target filename
+.IP \(bu 2
+when decompressing, a suffix is removed from the source filename to
+get the target filename
+
+.RE
+.P
+Default suffix is \fB\|\.br\fP, but it could be specified with \fB\-\-suffix\fP option\.
+.P
+Conflicting or duplicate \fIoptions\fR are not allowed\.
+.SH OPTIONS
+.RS 0
+.IP \(bu 2
+\fB\-#\fP:
+ compression level (0\-9); bigger values cause denser, but slower compression
+.IP \(bu 2
+\fB\-c\fP, \fB\-\-stdout\fP:
+ write on standard output
+.IP \(bu 2
+\fB\-d\fP, \fB\-\-decompress\fP:
+ decompress mode
+.IP \(bu 2
+\fB\-f\fP, \fB\-\-force\fP:
+ force output file overwrite
+.IP \(bu 2
+\fB\-h\fP, \fB\-\-help\fP:
+ display this help and exit
+.IP \(bu 2
+\fB\-j\fP, \fB\-\-rm\fP:
+ remove source file(s); \fBgzip (1)\fP\-like behaviour
+.IP \(bu 2
+\fB\-k\fP, \fB\-\-keep\fP:
+ keep source file(s); \fBzstd (1)\fP\-like behaviour
+.IP \(bu 2
+\fB\-n\fP, \fB\-\-no\-copy\-stat\fP:
+ do not copy source file(s) attributes
+.IP \(bu 2
+\fB\-o FILE\fP, \fB\-\-output=FILE\fP
+ output file; valid only if there is a single input entry
+.IP \(bu 2
+\fB\-q NUM\fP, \fB\-\-quality=NUM\fP:
+ compression level (0\-11); bigger values cause denser, but slower compression
+.IP \(bu 2
+\fB\-t\fP, \fB\-\-test\fP:
+ test file integrity mode
+.IP \(bu 2
+\fB\-v\fP, \fB\-\-verbose\fP:
+ increase output verbosity
+.IP \(bu 2
+\fB\-w NUM\fP, \fB\-\-lgwin=NUM\fP:
+ set LZ77 window size (0, 10\-24) (default: 22); window size is
+ \fB(2**NUM \- 16)\fP; 0 lets compressor decide over the optimal value; bigger
+ windows size improve density; decoder might require up to window size
+ memory to operate
+.IP \(bu 2
+\fB\-S SUF\fP, \fB\-\-suffix=SUF\fP:
+ output file suffix (default: \fB\|\.br\fP)
+.IP \(bu 2
+\fB\-V\fP, \fB\-\-version\fP:
+ display version and exit
+.IP \(bu 2
+\fB\-Z\fP, \fB\-\-best\fP:
+ use best compression level (default); same as "\fB\-q 11\fP"
+
+.RE
+.SH SEE ALSO
+.P
+\fBbrotli\fP file format is defined in
+RFC 7932 \fIhttps://www\.ietf\.org/rfc/rfc7932\.txt\fR\|\.
+.P
+\fBbrotli\fP is open\-sourced under the
+MIT License \fIhttps://opensource\.org/licenses/MIT\fR\|\.
+.P
+Mailing list: https://groups\.google\.com/forum/#!forum/brotli
+.SH BUGS
+.P
+Report bugs at: https://github\.com/google/brotli/issues
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/decode.h.3 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/decode.h.3
new file mode 100644
index 000000000..7b8581cc2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/decode.h.3
@@ -0,0 +1,415 @@
+.TH "decode.h" 3 "Thu Feb 22 2018" "Brotli" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+decode.h \- API for Brotli decompression\&.
+
+.SH SYNOPSIS
+.br
+.PP
+.SS "Macros"
+
+.in +1c
+.ti -1c
+.RI "#define \fBBROTLI_DECODER_ERROR_CODES_LIST\fP(BROTLI_ERROR_CODE, SEPARATOR) "
+.br
+.RI "\fITemplate that evaluates items of \fBBrotliDecoderErrorCode\fP\&. \fP"
+.ti -1c
+.RI "#define \fBBROTLI_LAST_ERROR_CODE\fP BROTLI_DECODER_ERROR_UNREACHABLE"
+.br
+.RI "\fIThe value of the last error code, negative integer\&. \fP"
+.in -1c
+.SS "Typedefs"
+
+.in +1c
+.ti -1c
+.RI "typedef enum \fBBrotliDecoderParameter\fP \fBBrotliDecoderParameter\fP"
+.br
+.RI "\fIOptions to be used with \fBBrotliDecoderSetParameter\fP\&. \fP"
+.ti -1c
+.RI "typedef struct BrotliDecoderStateStruct \fBBrotliDecoderState\fP"
+.br
+.RI "\fIOpaque structure that holds decoder state\&. \fP"
+.in -1c
+.SS "Enumerations"
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "\fBBrotliDecoderState\fP * \fBBrotliDecoderCreateInstance\fP (\fBbrotli_alloc_func\fP alloc_func, \fBbrotli_free_func\fP free_func, void *opaque)"
+.br
+.RI "\fICreates an instance of \fBBrotliDecoderState\fP and initializes it\&. \fP"
+.ti -1c
+.RI "\fBBrotliDecoderResult\fP \fBBrotliDecoderDecompress\fP (size_t encoded_size, const uint8_t encoded_buffer[encoded_size], size_t *decoded_size, uint8_t decoded_buffer[*decoded_size])"
+.br
+.RI "\fIPerforms one-shot memory-to-memory decompression\&. \fP"
+.ti -1c
+.RI "\fBBrotliDecoderResult\fP \fBBrotliDecoderDecompressStream\fP (\fBBrotliDecoderState\fP *state, size_t *available_in, const uint8_t **next_in, size_t *available_out, uint8_t **next_out, size_t *total_out)"
+.br
+.RI "\fIDecompresses the input stream to the output stream\&. \fP"
+.ti -1c
+.RI "void \fBBrotliDecoderDestroyInstance\fP (\fBBrotliDecoderState\fP *state)"
+.br
+.RI "\fIDeinitializes and frees \fBBrotliDecoderState\fP instance\&. \fP"
+.ti -1c
+.RI "const char * \fBBrotliDecoderErrorString\fP (\fBBrotliDecoderErrorCode\fP c)"
+.br
+.RI "\fIConverts error code to a c-string\&. \fP"
+.ti -1c
+.RI "\fBBrotliDecoderErrorCode\fP \fBBrotliDecoderGetErrorCode\fP (const \fBBrotliDecoderState\fP *state)"
+.br
+.RI "\fIAcquires a detailed error code\&. \fP"
+.ti -1c
+.RI "\fBBROTLI_BOOL\fP \fBBrotliDecoderHasMoreOutput\fP (const \fBBrotliDecoderState\fP *state)"
+.br
+.RI "\fIChecks if decoder has more output\&. \fP"
+.ti -1c
+.RI "\fBBROTLI_BOOL\fP \fBBrotliDecoderIsFinished\fP (const \fBBrotliDecoderState\fP *state)"
+.br
+.RI "\fIChecks if decoder instance reached the final state\&. \fP"
+.ti -1c
+.RI "\fBBROTLI_BOOL\fP \fBBrotliDecoderIsUsed\fP (const \fBBrotliDecoderState\fP *state)"
+.br
+.RI "\fIChecks if instance has already consumed input\&. \fP"
+.ti -1c
+.RI "\fBBROTLI_BOOL\fP \fBBrotliDecoderSetParameter\fP (\fBBrotliDecoderState\fP *state, \fBBrotliDecoderParameter\fP param, uint32_t value)"
+.br
+.RI "\fISets the specified parameter to the given decoder instance\&. \fP"
+.ti -1c
+.RI "const uint8_t * \fBBrotliDecoderTakeOutput\fP (\fBBrotliDecoderState\fP *state, size_t *size)"
+.br
+.RI "\fIAcquires pointer to internal output buffer\&. \fP"
+.ti -1c
+.RI "uint32_t \fBBrotliDecoderVersion\fP (void)"
+.br
+.RI "\fIGets a decoder library version\&. \fP"
+.in -1c
+.SH "Detailed Description"
+.PP
+API for Brotli decompression\&.
+
+
+.SH "Macro Definition Documentation"
+.PP
+.SS "#define BROTLI_DECODER_ERROR_CODES_LIST(BROTLI_ERROR_CODE, SEPARATOR)"
+
+.PP
+Template that evaluates items of \fBBrotliDecoderErrorCode\fP\&. Example:
+.PP
+.nf
+// Log Brotli error code\&.
+switch (brotliDecoderErrorCode) {
+#define CASE_(PREFIX, NAME, CODE) \
+ case BROTLI_DECODER ## PREFIX ## NAME: \
+ LOG(INFO) << "error code:" << #NAME; \
+ break;
+#define NEWLINE_
+BROTLI_DECODER_ERROR_CODES_LIST(CASE_, NEWLINE_)
+#undef CASE_
+#undef NEWLINE_
+ default: LOG(FATAL) << "unknown brotli error code";
+}
+
+.fi
+.PP
+
+.SS "#define BROTLI_LAST_ERROR_CODE BROTLI_DECODER_ERROR_UNREACHABLE"
+
+.PP
+The value of the last error code, negative integer\&. All other error code values are in the range from \fBBROTLI_LAST_ERROR_CODE\fP to \fC-1\fP\&. There are also 4 other possible non-error codes \fC0\fP \&.\&. \fC3\fP in \fBBrotliDecoderErrorCode\fP enumeration\&.
+.SH "Typedef Documentation"
+.PP
+.SS "typedef enum \fBBrotliDecoderParameter\fP \fBBrotliDecoderParameter\fP"
+
+.PP
+Options to be used with \fBBrotliDecoderSetParameter\fP\&.
+.SS "typedef struct BrotliDecoderStateStruct \fBBrotliDecoderState\fP"
+
+.PP
+Opaque structure that holds decoder state\&. Allocated and initialized with \fBBrotliDecoderCreateInstance\fP\&. Cleaned up and deallocated with \fBBrotliDecoderDestroyInstance\fP\&.
+.SH "Enumeration Type Documentation"
+.PP
+.SS "enum \fBBrotliDecoderErrorCode\fP"
+
+.PP
+Error code for detailed logging / production debugging\&. See \fBBrotliDecoderGetErrorCode\fP and \fBBROTLI_LAST_ERROR_CODE\fP\&.
+.SS "enum \fBBrotliDecoderParameter\fP"
+
+.PP
+Options to be used with \fBBrotliDecoderSetParameter\fP\&.
+.PP
+\fBEnumerator\fP
+.in +1c
+.TP
+\fB\fIBROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION \fP\fP
+Disable 'canny' ring buffer allocation strategy\&. Ring buffer is allocated according to window size, despite the real size of the content\&.
+.TP
+\fB\fIBROTLI_DECODER_PARAM_LARGE_WINDOW \fP\fP
+Flag that determines if 'Large Window Brotli' is used\&.
+.SS "enum \fBBrotliDecoderResult\fP"
+
+.PP
+Result type for \fBBrotliDecoderDecompress\fP and \fBBrotliDecoderDecompressStream\fP functions\&.
+.PP
+\fBEnumerator\fP
+.in +1c
+.TP
+\fB\fIBROTLI_DECODER_RESULT_ERROR \fP\fP
+Decoding error, e\&.g\&. corrupted input or memory allocation problem\&.
+.TP
+\fB\fIBROTLI_DECODER_RESULT_SUCCESS \fP\fP
+Decoding successfully completed\&.
+.TP
+\fB\fIBROTLI_DECODER_RESULT_NEEDS_MORE_INPUT \fP\fP
+Partially done; should be called again with more input\&.
+.TP
+\fB\fIBROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT \fP\fP
+Partially done; should be called again with more output\&.
+.SH "Function Documentation"
+.PP
+.SS "\fBBrotliDecoderState\fP* BrotliDecoderCreateInstance (\fBbrotli_alloc_func\fP alloc_func, \fBbrotli_free_func\fP free_func, void * opaque)"
+
+.PP
+Creates an instance of \fBBrotliDecoderState\fP and initializes it\&. The instance can be used once for decoding and should then be destroyed with \fBBrotliDecoderDestroyInstance\fP, it cannot be reused for a new decoding session\&.
+.PP
+\fCalloc_func\fP and \fCfree_func\fP \fBMUST\fP be both zero or both non-zero\&. In the case they are both zero, default memory allocators are used\&. \fCopaque\fP is passed to \fCalloc_func\fP and \fCfree_func\fP when they are called\&. \fCfree_func\fP has to return without doing anything when asked to free a NULL pointer\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIalloc_func\fP custom memory allocation function
+.br
+\fIfree_func\fP custom memory free function
+.br
+\fIopaque\fP custom memory manager handle
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fC0\fP if instance can not be allocated or initialized
+.PP
+pointer to initialized \fBBrotliDecoderState\fP otherwise
+.RE
+.PP
+
+.SS "\fBBrotliDecoderResult\fP BrotliDecoderDecompress (size_t encoded_size, const uint8_t encoded_buffer[encoded_size], size_t * decoded_size, uint8_t decoded_buffer[*decoded_size])"
+
+.PP
+Performs one-shot memory-to-memory decompression\&. Decompresses the data in \fCencoded_buffer\fP into \fCdecoded_buffer\fP, and sets \fC*decoded_size\fP to the decompressed length\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIencoded_size\fP size of \fCencoded_buffer\fP
+.br
+\fIencoded_buffer\fP compressed data buffer with at least \fCencoded_size\fP addressable bytes
+.br
+\fIdecoded_size\fP \fBin:\fP size of \fCdecoded_buffer\fP;
+.br
+ \fBout:\fP length of decompressed data written to \fCdecoded_buffer\fP
+.br
+\fIdecoded_buffer\fP decompressed data destination buffer
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fBBROTLI_DECODER_RESULT_ERROR\fP if input is corrupted, memory allocation failed, or \fCdecoded_buffer\fP is not large enough;
+.PP
+\fBBROTLI_DECODER_RESULT_SUCCESS\fP otherwise
+.RE
+.PP
+
+.SS "\fBBrotliDecoderResult\fP BrotliDecoderDecompressStream (\fBBrotliDecoderState\fP * state, size_t * available_in, const uint8_t ** next_in, size_t * available_out, uint8_t ** next_out, size_t * total_out)"
+
+.PP
+Decompresses the input stream to the output stream\&. The values \fC*available_in\fP and \fC*available_out\fP must specify the number of bytes addressable at \fC*next_in\fP and \fC*next_out\fP respectively\&. When \fC*available_out\fP is \fC0\fP, \fCnext_out\fP is allowed to be \fCNULL\fP\&.
+.PP
+After each call, \fC*available_in\fP will be decremented by the amount of input bytes consumed, and the \fC*next_in\fP pointer will be incremented by that amount\&. Similarly, \fC*available_out\fP will be decremented by the amount of output bytes written, and the \fC*next_out\fP pointer will be incremented by that amount\&.
+.PP
+\fCtotal_out\fP, if it is not a null-pointer, will be set to the number of bytes decompressed since the last \fCstate\fP initialization\&.
+.PP
+\fBNote:\fP
+.RS 4
+Input is never overconsumed, so \fCnext_in\fP and \fCavailable_in\fP could be passed to the next consumer after decoding is complete\&.
+.RE
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP decoder instance
+.br
+\fIavailable_in\fP \fBin:\fP amount of available input;
+.br
+ \fBout:\fP amount of unused input
+.br
+\fInext_in\fP pointer to the next compressed byte
+.br
+\fIavailable_out\fP \fBin:\fP length of output buffer;
+.br
+ \fBout:\fP remaining size of output buffer
+.br
+\fInext_out\fP output buffer cursor; can be \fCNULL\fP if \fCavailable_out\fP is \fC0\fP
+.br
+\fItotal_out\fP number of bytes decompressed so far; can be \fCNULL\fP
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fBBROTLI_DECODER_RESULT_ERROR\fP if input is corrupted, memory allocation failed, arguments were invalid, etc\&.; use \fBBrotliDecoderGetErrorCode\fP to get detailed error code
+.PP
+\fBBROTLI_DECODER_RESULT_NEEDS_MORE_INPUT\fP decoding is blocked until more input data is provided
+.PP
+\fBBROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT\fP decoding is blocked until more output space is provided
+.PP
+\fBBROTLI_DECODER_RESULT_SUCCESS\fP decoding is finished, no more input might be consumed and no more output will be produced
+.RE
+.PP
+
+.SS "void BrotliDecoderDestroyInstance (\fBBrotliDecoderState\fP * state)"
+
+.PP
+Deinitializes and frees \fBBrotliDecoderState\fP instance\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP decoder instance to be cleaned up and deallocated
+.RE
+.PP
+
+.SS "\fBBrotliDecoderErrorCode\fP BrotliDecoderGetErrorCode (const \fBBrotliDecoderState\fP * state)"
+
+.PP
+Acquires a detailed error code\&. Should be used only after \fBBrotliDecoderDecompressStream\fP returns \fBBROTLI_DECODER_RESULT_ERROR\fP\&.
+.PP
+See also \fBBrotliDecoderErrorString\fP
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP decoder instance
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+last saved error code
+.RE
+.PP
+
+.SS "\fBBROTLI_BOOL\fP BrotliDecoderHasMoreOutput (const \fBBrotliDecoderState\fP * state)"
+
+.PP
+Checks if decoder has more output\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP decoder instance
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fBBROTLI_TRUE\fP, if decoder has some unconsumed output
+.PP
+\fBBROTLI_FALSE\fP otherwise
+.RE
+.PP
+
+.SS "\fBBROTLI_BOOL\fP BrotliDecoderIsFinished (const \fBBrotliDecoderState\fP * state)"
+
+.PP
+Checks if decoder instance reached the final state\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP decoder instance
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fBBROTLI_TRUE\fP if decoder is in a state where it reached the end of the input and produced all of the output
+.PP
+\fBBROTLI_FALSE\fP otherwise
+.RE
+.PP
+
+.SS "\fBBROTLI_BOOL\fP BrotliDecoderIsUsed (const \fBBrotliDecoderState\fP * state)"
+
+.PP
+Checks if instance has already consumed input\&. Instance that returns \fBBROTLI_FALSE\fP is considered 'fresh' and could be reused\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP decoder instance
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fBBROTLI_TRUE\fP if decoder has already used some input bytes
+.PP
+\fBBROTLI_FALSE\fP otherwise
+.RE
+.PP
+
+.SS "\fBBROTLI_BOOL\fP BrotliDecoderSetParameter (\fBBrotliDecoderState\fP * state, \fBBrotliDecoderParameter\fP param, uint32_t value)"
+
+.PP
+Sets the specified parameter to the given decoder instance\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP decoder instance
+.br
+\fIparam\fP parameter to set
+.br
+\fIvalue\fP new parameter value
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fBBROTLI_FALSE\fP if parameter is unrecognized, or value is invalid
+.PP
+\fBBROTLI_TRUE\fP if value is accepted
+.RE
+.PP
+
+.SS "const uint8_t* BrotliDecoderTakeOutput (\fBBrotliDecoderState\fP * state, size_t * size)"
+
+.PP
+Acquires pointer to internal output buffer\&. This method is used to make language bindings easier and more efficient:
+.IP "1." 4
+push data to \fBBrotliDecoderDecompressStream\fP, until \fBBROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT\fP is reported
+.IP "2." 4
+use \fBBrotliDecoderTakeOutput\fP to peek bytes and copy to language-specific entity
+.PP
+.PP
+Also this could be useful if there is an output stream that is able to consume all the provided data (e\&.g\&. when data is saved to file system)\&.
+.PP
+\fBAttention:\fP
+.RS 4
+After every call to \fBBrotliDecoderTakeOutput\fP \fC*size\fP bytes of output are considered consumed for all consecutive calls to the instance methods; returned pointer becomes invalidated as well\&.
+.RE
+.PP
+\fBNote:\fP
+.RS 4
+Decoder output is not guaranteed to be contiguous\&. This means that after the size-unrestricted call to \fBBrotliDecoderTakeOutput\fP, immediate next call to \fBBrotliDecoderTakeOutput\fP may return more data\&.
+.RE
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP decoder instance
+.br
+\fIsize\fP \fBin:\fP number of bytes caller is ready to take, \fC0\fP if any amount could be handled;
+.br
+ \fBout:\fP amount of data pointed by returned pointer and considered consumed;
+.br
+ out value is never greater than in value, unless it is \fC0\fP
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+pointer to output data
+.RE
+.PP
+
+.SS "uint32_t BrotliDecoderVersion (void)"
+
+.PP
+Gets a decoder library version\&. Look at BROTLI_VERSION for more information\&.
+.SH "Author"
+.PP
+Generated automatically by Doxygen for Brotli from the source code\&.
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/encode.h.3 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/encode.h.3
new file mode 100644
index 000000000..0cab81668
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/encode.h.3
@@ -0,0 +1,586 @@
+.TH "encode.h" 3 "Thu Feb 22 2018" "Brotli" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+encode.h \- API for Brotli compression\&.
+
+.SH SYNOPSIS
+.br
+.PP
+.SS "Macros"
+
+.in +1c
+.ti -1c
+.RI "#define \fBBROTLI_DEFAULT_MODE\fP \fBBROTLI_MODE_GENERIC\fP"
+.br
+.RI "\fIDefault value for \fBBROTLI_PARAM_MODE\fP parameter\&. \fP"
+.ti -1c
+.RI "#define \fBBROTLI_DEFAULT_QUALITY\fP 11"
+.br
+.RI "\fIDefault value for \fBBROTLI_PARAM_QUALITY\fP parameter\&. \fP"
+.ti -1c
+.RI "#define \fBBROTLI_DEFAULT_WINDOW\fP 22"
+.br
+.RI "\fIDefault value for \fBBROTLI_PARAM_LGWIN\fP parameter\&. \fP"
+.ti -1c
+.RI "#define \fBBROTLI_LARGE_MAX_WINDOW_BITS\fP 30"
+.br
+.RI "\fIMaximal value for \fBBROTLI_PARAM_LGWIN\fP parameter in 'Large Window Brotli' (32-bit)\&. \fP"
+.ti -1c
+.RI "#define \fBBROTLI_MAX_INPUT_BLOCK_BITS\fP 24"
+.br
+.RI "\fIMaximal value for \fBBROTLI_PARAM_LGBLOCK\fP parameter\&. \fP"
+.ti -1c
+.RI "#define \fBBROTLI_MAX_QUALITY\fP 11"
+.br
+.RI "\fIMaximal value for \fBBROTLI_PARAM_QUALITY\fP parameter\&. \fP"
+.ti -1c
+.RI "#define \fBBROTLI_MAX_WINDOW_BITS\fP 24"
+.br
+.RI "\fIMaximal value for \fBBROTLI_PARAM_LGWIN\fP parameter\&. \fP"
+.ti -1c
+.RI "#define \fBBROTLI_MIN_INPUT_BLOCK_BITS\fP 16"
+.br
+.RI "\fIMinimal value for \fBBROTLI_PARAM_LGBLOCK\fP parameter\&. \fP"
+.ti -1c
+.RI "#define \fBBROTLI_MIN_QUALITY\fP 0"
+.br
+.RI "\fIMinimal value for \fBBROTLI_PARAM_QUALITY\fP parameter\&. \fP"
+.ti -1c
+.RI "#define \fBBROTLI_MIN_WINDOW_BITS\fP 10"
+.br
+.RI "\fIMinimal value for \fBBROTLI_PARAM_LGWIN\fP parameter\&. \fP"
+.in -1c
+.SS "Typedefs"
+
+.in +1c
+.ti -1c
+.RI "typedef enum \fBBrotliEncoderMode\fP \fBBrotliEncoderMode\fP"
+.br
+.RI "\fIOptions for \fBBROTLI_PARAM_MODE\fP parameter\&. \fP"
+.ti -1c
+.RI "typedef enum \fBBrotliEncoderOperation\fP \fBBrotliEncoderOperation\fP"
+.br
+.RI "\fIOperations that can be performed by streaming encoder\&. \fP"
+.ti -1c
+.RI "typedef enum \fBBrotliEncoderParameter\fP \fBBrotliEncoderParameter\fP"
+.br
+.RI "\fIOptions to be used with \fBBrotliEncoderSetParameter\fP\&. \fP"
+.ti -1c
+.RI "typedef struct BrotliEncoderStateStruct \fBBrotliEncoderState\fP"
+.br
+.RI "\fIOpaque structure that holds encoder state\&. \fP"
+.in -1c
+.SS "Enumerations"
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "\fBBROTLI_BOOL\fP \fBBrotliEncoderCompress\fP (int quality, int lgwin, \fBBrotliEncoderMode\fP mode, size_t input_size, const uint8_t input_buffer[input_size], size_t *encoded_size, uint8_t encoded_buffer[*encoded_size])"
+.br
+.RI "\fIPerforms one-shot memory-to-memory compression\&. \fP"
+.ti -1c
+.RI "\fBBROTLI_BOOL\fP \fBBrotliEncoderCompressStream\fP (\fBBrotliEncoderState\fP *state, \fBBrotliEncoderOperation\fP op, size_t *available_in, const uint8_t **next_in, size_t *available_out, uint8_t **next_out, size_t *total_out)"
+.br
+.RI "\fICompresses input stream to output stream\&. \fP"
+.ti -1c
+.RI "\fBBrotliEncoderState\fP * \fBBrotliEncoderCreateInstance\fP (\fBbrotli_alloc_func\fP alloc_func, \fBbrotli_free_func\fP free_func, void *opaque)"
+.br
+.RI "\fICreates an instance of \fBBrotliEncoderState\fP and initializes it\&. \fP"
+.ti -1c
+.RI "void \fBBrotliEncoderDestroyInstance\fP (\fBBrotliEncoderState\fP *state)"
+.br
+.RI "\fIDeinitializes and frees \fBBrotliEncoderState\fP instance\&. \fP"
+.ti -1c
+.RI "\fBBROTLI_BOOL\fP \fBBrotliEncoderHasMoreOutput\fP (\fBBrotliEncoderState\fP *state)"
+.br
+.RI "\fIChecks if encoder has more output\&. \fP"
+.ti -1c
+.RI "\fBBROTLI_BOOL\fP \fBBrotliEncoderIsFinished\fP (\fBBrotliEncoderState\fP *state)"
+.br
+.RI "\fIChecks if encoder instance reached the final state\&. \fP"
+.ti -1c
+.RI "size_t \fBBrotliEncoderMaxCompressedSize\fP (size_t input_size)"
+.br
+.RI "\fICalculates the output size bound for the given \fCinput_size\fP\&. \fP"
+.ti -1c
+.RI "\fBBROTLI_BOOL\fP \fBBrotliEncoderSetParameter\fP (\fBBrotliEncoderState\fP *state, \fBBrotliEncoderParameter\fP param, uint32_t value)"
+.br
+.RI "\fISets the specified parameter to the given encoder instance\&. \fP"
+.ti -1c
+.RI "const uint8_t * \fBBrotliEncoderTakeOutput\fP (\fBBrotliEncoderState\fP *state, size_t *size)"
+.br
+.RI "\fIAcquires pointer to internal output buffer\&. \fP"
+.ti -1c
+.RI "uint32_t \fBBrotliEncoderVersion\fP (void)"
+.br
+.RI "\fIGets an encoder library version\&. \fP"
+.in -1c
+.SH "Detailed Description"
+.PP
+API for Brotli compression\&.
+
+
+.SH "Macro Definition Documentation"
+.PP
+.SS "#define BROTLI_DEFAULT_MODE \fBBROTLI_MODE_GENERIC\fP"
+
+.PP
+Default value for \fBBROTLI_PARAM_MODE\fP parameter\&.
+.SS "#define BROTLI_DEFAULT_QUALITY 11"
+
+.PP
+Default value for \fBBROTLI_PARAM_QUALITY\fP parameter\&.
+.SS "#define BROTLI_DEFAULT_WINDOW 22"
+
+.PP
+Default value for \fBBROTLI_PARAM_LGWIN\fP parameter\&.
+.SS "#define BROTLI_MAX_INPUT_BLOCK_BITS 24"
+
+.PP
+Maximal value for \fBBROTLI_PARAM_LGBLOCK\fP parameter\&.
+.SS "#define BROTLI_MAX_QUALITY 11"
+
+.PP
+Maximal value for \fBBROTLI_PARAM_QUALITY\fP parameter\&.
+.SS "#define BROTLI_MAX_WINDOW_BITS 24"
+
+.PP
+Maximal value for \fBBROTLI_PARAM_LGWIN\fP parameter\&.
+.PP
+\fBNote:\fP
+.RS 4
+equal to \fCBROTLI_MAX_DISTANCE_BITS\fP constant\&.
+.RE
+.PP
+
+.SS "#define BROTLI_MIN_INPUT_BLOCK_BITS 16"
+
+.PP
+Minimal value for \fBBROTLI_PARAM_LGBLOCK\fP parameter\&.
+.SS "#define BROTLI_MIN_QUALITY 0"
+
+.PP
+Minimal value for \fBBROTLI_PARAM_QUALITY\fP parameter\&.
+.SS "#define BROTLI_MIN_WINDOW_BITS 10"
+
+.PP
+Minimal value for \fBBROTLI_PARAM_LGWIN\fP parameter\&.
+.SH "Typedef Documentation"
+.PP
+.SS "typedef enum \fBBrotliEncoderMode\fP \fBBrotliEncoderMode\fP"
+
+.PP
+Options for \fBBROTLI_PARAM_MODE\fP parameter\&.
+.SS "typedef enum \fBBrotliEncoderOperation\fP \fBBrotliEncoderOperation\fP"
+
+.PP
+Operations that can be performed by streaming encoder\&.
+.SS "typedef enum \fBBrotliEncoderParameter\fP \fBBrotliEncoderParameter\fP"
+
+.PP
+Options to be used with \fBBrotliEncoderSetParameter\fP\&.
+.SS "typedef struct BrotliEncoderStateStruct \fBBrotliEncoderState\fP"
+
+.PP
+Opaque structure that holds encoder state\&. Allocated and initialized with \fBBrotliEncoderCreateInstance\fP\&. Cleaned up and deallocated with \fBBrotliEncoderDestroyInstance\fP\&.
+.SH "Enumeration Type Documentation"
+.PP
+.SS "enum \fBBrotliEncoderMode\fP"
+
+.PP
+Options for \fBBROTLI_PARAM_MODE\fP parameter\&.
+.PP
+\fBEnumerator\fP
+.in +1c
+.TP
+\fB\fIBROTLI_MODE_GENERIC \fP\fP
+Default compression mode\&. In this mode compressor does not know anything in advance about the properties of the input\&.
+.TP
+\fB\fIBROTLI_MODE_TEXT \fP\fP
+Compression mode for UTF-8 formatted text input\&.
+.TP
+\fB\fIBROTLI_MODE_FONT \fP\fP
+Compression mode used in WOFF 2\&.0\&.
+.SS "enum \fBBrotliEncoderOperation\fP"
+
+.PP
+Operations that can be performed by streaming encoder\&.
+.PP
+\fBEnumerator\fP
+.in +1c
+.TP
+\fB\fIBROTLI_OPERATION_PROCESS \fP\fP
+Process input\&. Encoder may postpone producing output, until it has processed enough input\&.
+.TP
+\fB\fIBROTLI_OPERATION_FLUSH \fP\fP
+Produce output for all processed input\&. Actual flush is performed when input stream is depleted and there is enough space in output stream\&. This means that client should repeat \fBBROTLI_OPERATION_FLUSH\fP operation until \fCavailable_in\fP becomes \fC0\fP, and \fBBrotliEncoderHasMoreOutput\fP returns \fBBROTLI_FALSE\fP\&. If output is acquired via \fBBrotliEncoderTakeOutput\fP, then operation should be repeated after output buffer is drained\&.
+.PP
+\fBWarning:\fP
+.RS 4
+Until flush is complete, client \fBSHOULD\fP \fBNOT\fP swap, reduce or extend input stream\&.
+.RE
+.PP
+When flush is complete, output data will be sufficient for decoder to reproduce all the given input\&.
+.TP
+\fB\fIBROTLI_OPERATION_FINISH \fP\fP
+Finalize the stream\&. Actual finalization is performed when input stream is depleted and there is enough space in output stream\&. This means that client should repeat \fBBROTLI_OPERATION_FINISH\fP operation until \fCavailable_in\fP becomes \fC0\fP, and \fBBrotliEncoderHasMoreOutput\fP returns \fBBROTLI_FALSE\fP\&. If output is acquired via \fBBrotliEncoderTakeOutput\fP, then operation should be repeated after output buffer is drained\&.
+.PP
+\fBWarning:\fP
+.RS 4
+Until finalization is complete, client \fBSHOULD\fP \fBNOT\fP swap, reduce or extend input stream\&.
+.RE
+.PP
+Helper function \fBBrotliEncoderIsFinished\fP checks if stream is finalized and output fully dumped\&.
+.PP
+Adding more input data to finalized stream is impossible\&.
+.TP
+\fB\fIBROTLI_OPERATION_EMIT_METADATA \fP\fP
+Emit metadata block to stream\&. Metadata is opaque to Brotli: neither encoder, nor decoder processes this data or relies on it\&. It may be used to pass some extra information from encoder client to decoder client without interfering with main data stream\&.
+.PP
+\fBNote:\fP
+.RS 4
+Encoder may emit empty metadata blocks internally, to pad encoded stream to byte boundary\&.
+.RE
+.PP
+\fBWarning:\fP
+.RS 4
+Until emitting metadata is complete client \fBSHOULD\fP \fBNOT\fP swap, reduce or extend input stream\&.
+.PP
+The whole content of input buffer is considered to be the content of metadata block\&. Do \fBNOT\fP \fIappend\fP metadata to input stream, before it is depleted with other operations\&.
+.RE
+.PP
+Stream is soft-flushed before metadata block is emitted\&. Metadata block \fBMUST\fP be no longer than than 16MiB\&.
+.SS "enum \fBBrotliEncoderParameter\fP"
+
+.PP
+Options to be used with \fBBrotliEncoderSetParameter\fP\&.
+.PP
+\fBEnumerator\fP
+.in +1c
+.TP
+\fB\fIBROTLI_PARAM_MODE \fP\fP
+Tune encoder for specific input\&. \fBBrotliEncoderMode\fP enumerates all available values\&.
+.TP
+\fB\fIBROTLI_PARAM_QUALITY \fP\fP
+The main compression speed-density lever\&. The higher the quality, the slower the compression\&. Range is from \fBBROTLI_MIN_QUALITY\fP to \fBBROTLI_MAX_QUALITY\fP\&.
+.TP
+\fB\fIBROTLI_PARAM_LGWIN \fP\fP
+Recommended sliding LZ77 window size\&. Encoder may reduce this value, e\&.g\&. if input is much smaller than window size\&.
+.PP
+Window size is \fC(1 << value) - 16\fP\&.
+.PP
+Range is from \fBBROTLI_MIN_WINDOW_BITS\fP to \fBBROTLI_MAX_WINDOW_BITS\fP\&.
+.TP
+\fB\fIBROTLI_PARAM_LGBLOCK \fP\fP
+Recommended input block size\&. Encoder may reduce this value, e\&.g\&. if input is much smaller than input block size\&.
+.PP
+Range is from \fBBROTLI_MIN_INPUT_BLOCK_BITS\fP to \fBBROTLI_MAX_INPUT_BLOCK_BITS\fP\&.
+.PP
+\fBNote:\fP
+.RS 4
+Bigger input block size allows better compression, but consumes more memory\&.
+.br
+ The rough formula of memory used for temporary input storage is \fC3 << lgBlock\fP\&.
+.RE
+.PP
+
+.TP
+\fB\fIBROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING \fP\fP
+Flag that affects usage of 'literal context modeling' format feature\&. This flag is a 'decoding-speed vs compression ratio' trade-off\&.
+.TP
+\fB\fIBROTLI_PARAM_SIZE_HINT \fP\fP
+Estimated total input size for all \fBBrotliEncoderCompressStream\fP calls\&. The default value is 0, which means that the total input size is unknown\&.
+.TP
+\fB\fIBROTLI_PARAM_LARGE_WINDOW \fP\fP
+Flag that determines if 'Large Window Brotli' is used\&.
+.TP
+\fB\fIBROTLI_PARAM_NPOSTFIX \fP\fP
+Recommended number of postfix bits (NPOSTFIX)\&. Encoder may change this value\&.
+.PP
+Range is from 0 to \fBBROTLI_MAX_NPOSTFIX\fP\&.
+.TP
+\fB\fIBROTLI_PARAM_NDIRECT \fP\fP
+Recommended number of direct distance codes (NDIRECT)\&. Encoder may change this value\&.
+.PP
+Range is from 0 to (15 << NPOSTFIX) in steps of (1 << NPOSTFIX)\&.
+.TP
+\fB\fIBROTLI_PARAM_STREAM_OFFSET \fP\fP
+Number of bytes of input stream already processed by a different instance\&.
+.PP
+\fBNote:\fP
+.RS 4
+It is important to configure all the encoder instances with same parameters (except this one) in order to allow all the encoded parts obey the same restrictions implied by header\&.
+.RE
+.PP
+If offset is not 0, then stream header is omitted\&. In any case output start is byte aligned, so for proper streams stitching 'predecessor' stream must be flushed\&.
+.PP
+Range is not artificially limited, but all the values greater or equal to maximal window size have the same effect\&. Values greater than 2**30 are not allowed\&.
+.SH "Function Documentation"
+.PP
+.SS "\fBBROTLI_BOOL\fP BrotliEncoderCompress (int quality, int lgwin, \fBBrotliEncoderMode\fP mode, size_t input_size, const uint8_t input_buffer[input_size], size_t * encoded_size, uint8_t encoded_buffer[*encoded_size])"
+
+.PP
+Performs one-shot memory-to-memory compression\&. Compresses the data in \fCinput_buffer\fP into \fCencoded_buffer\fP, and sets \fC*encoded_size\fP to the compressed length\&.
+.PP
+\fBNote:\fP
+.RS 4
+If \fBBrotliEncoderMaxCompressedSize\fP(\fCinput_size\fP) returns non-zero value, then output is guaranteed to be no longer than that\&.
+.PP
+If \fClgwin\fP is greater than \fBBROTLI_MAX_WINDOW_BITS\fP then resulting stream might be incompatible with RFC 7932; to decode such streams, decoder should be configured with \fBBROTLI_DECODER_PARAM_LARGE_WINDOW\fP = \fC1\fP
+.RE
+.PP
+\fBParameters:\fP
+.RS 4
+\fIquality\fP quality parameter value, e\&.g\&. \fBBROTLI_DEFAULT_QUALITY\fP
+.br
+\fIlgwin\fP lgwin parameter value, e\&.g\&. \fBBROTLI_DEFAULT_WINDOW\fP
+.br
+\fImode\fP mode parameter value, e\&.g\&. \fBBROTLI_DEFAULT_MODE\fP
+.br
+\fIinput_size\fP size of \fCinput_buffer\fP
+.br
+\fIinput_buffer\fP input data buffer with at least \fCinput_size\fP addressable bytes
+.br
+\fIencoded_size\fP \fBin:\fP size of \fCencoded_buffer\fP;
+.br
+ \fBout:\fP length of compressed data written to \fCencoded_buffer\fP, or \fC0\fP if compression fails
+.br
+\fIencoded_buffer\fP compressed data destination buffer
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fBBROTLI_FALSE\fP in case of compression error
+.PP
+\fBBROTLI_FALSE\fP if output buffer is too small
+.PP
+\fBBROTLI_TRUE\fP otherwise
+.RE
+.PP
+
+.SS "\fBBROTLI_BOOL\fP BrotliEncoderCompressStream (\fBBrotliEncoderState\fP * state, \fBBrotliEncoderOperation\fP op, size_t * available_in, const uint8_t ** next_in, size_t * available_out, uint8_t ** next_out, size_t * total_out)"
+
+.PP
+Compresses input stream to output stream\&. The values \fC*available_in\fP and \fC*available_out\fP must specify the number of bytes addressable at \fC*next_in\fP and \fC*next_out\fP respectively\&. When \fC*available_out\fP is \fC0\fP, \fCnext_out\fP is allowed to be \fCNULL\fP\&.
+.PP
+After each call, \fC*available_in\fP will be decremented by the amount of input bytes consumed, and the \fC*next_in\fP pointer will be incremented by that amount\&. Similarly, \fC*available_out\fP will be decremented by the amount of output bytes written, and the \fC*next_out\fP pointer will be incremented by that amount\&.
+.PP
+\fCtotal_out\fP, if it is not a null-pointer, will be set to the number of bytes compressed since the last \fCstate\fP initialization\&.
+.PP
+Internally workflow consists of 3 tasks:
+.IP "1." 4
+(optionally) copy input data to internal buffer
+.IP "2." 4
+actually compress data and (optionally) store it to internal buffer
+.IP "3." 4
+(optionally) copy compressed bytes from internal buffer to output stream
+.PP
+.PP
+Whenever all 3 tasks can't move forward anymore, or error occurs, this method returns the control flow to caller\&.
+.PP
+\fCop\fP is used to perform flush, finish the stream, or inject metadata block\&. See \fBBrotliEncoderOperation\fP for more information\&.
+.PP
+Flushing the stream means forcing encoding of all input passed to encoder and completing the current output block, so it could be fully decoded by stream decoder\&. To perform flush set \fCop\fP to \fBBROTLI_OPERATION_FLUSH\fP\&. Under some circumstances (e\&.g\&. lack of output stream capacity) this operation would require several calls to \fBBrotliEncoderCompressStream\fP\&. The method must be called again until both input stream is depleted and encoder has no more output (see \fBBrotliEncoderHasMoreOutput\fP) after the method is called\&.
+.PP
+Finishing the stream means encoding of all input passed to encoder and adding specific 'final' marks, so stream decoder could determine that stream is complete\&. To perform finish set \fCop\fP to \fBBROTLI_OPERATION_FINISH\fP\&. Under some circumstances (e\&.g\&. lack of output stream capacity) this operation would require several calls to \fBBrotliEncoderCompressStream\fP\&. The method must be called again until both input stream is depleted and encoder has no more output (see \fBBrotliEncoderHasMoreOutput\fP) after the method is called\&.
+.PP
+\fBWarning:\fP
+.RS 4
+When flushing and finishing, \fCop\fP should not change until operation is complete; input stream should not be swapped, reduced or extended as well\&.
+.RE
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP encoder instance
+.br
+\fIop\fP requested operation
+.br
+\fIavailable_in\fP \fBin:\fP amount of available input;
+.br
+ \fBout:\fP amount of unused input
+.br
+\fInext_in\fP pointer to the next input byte
+.br
+\fIavailable_out\fP \fBin:\fP length of output buffer;
+.br
+ \fBout:\fP remaining size of output buffer
+.br
+\fInext_out\fP compressed output buffer cursor; can be \fCNULL\fP if \fCavailable_out\fP is \fC0\fP
+.br
+\fItotal_out\fP number of bytes produced so far; can be \fCNULL\fP
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fBBROTLI_FALSE\fP if there was an error
+.PP
+\fBBROTLI_TRUE\fP otherwise
+.RE
+.PP
+
+.SS "\fBBrotliEncoderState\fP* BrotliEncoderCreateInstance (\fBbrotli_alloc_func\fP alloc_func, \fBbrotli_free_func\fP free_func, void * opaque)"
+
+.PP
+Creates an instance of \fBBrotliEncoderState\fP and initializes it\&. \fCalloc_func\fP and \fCfree_func\fP \fBMUST\fP be both zero or both non-zero\&. In the case they are both zero, default memory allocators are used\&. \fCopaque\fP is passed to \fCalloc_func\fP and \fCfree_func\fP when they are called\&. \fCfree_func\fP has to return without doing anything when asked to free a NULL pointer\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIalloc_func\fP custom memory allocation function
+.br
+\fIfree_func\fP custom memory free function
+.br
+\fIopaque\fP custom memory manager handle
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fC0\fP if instance can not be allocated or initialized
+.PP
+pointer to initialized \fBBrotliEncoderState\fP otherwise
+.RE
+.PP
+
+.SS "void BrotliEncoderDestroyInstance (\fBBrotliEncoderState\fP * state)"
+
+.PP
+Deinitializes and frees \fBBrotliEncoderState\fP instance\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP decoder instance to be cleaned up and deallocated
+.RE
+.PP
+
+.SS "\fBBROTLI_BOOL\fP BrotliEncoderHasMoreOutput (\fBBrotliEncoderState\fP * state)"
+
+.PP
+Checks if encoder has more output\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP encoder instance
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fBBROTLI_TRUE\fP, if encoder has some unconsumed output
+.PP
+\fBBROTLI_FALSE\fP otherwise
+.RE
+.PP
+
+.SS "\fBBROTLI_BOOL\fP BrotliEncoderIsFinished (\fBBrotliEncoderState\fP * state)"
+
+.PP
+Checks if encoder instance reached the final state\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP encoder instance
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fBBROTLI_TRUE\fP if encoder is in a state where it reached the end of the input and produced all of the output
+.PP
+\fBBROTLI_FALSE\fP otherwise
+.RE
+.PP
+
+.SS "size_t BrotliEncoderMaxCompressedSize (size_t input_size)"
+
+.PP
+Calculates the output size bound for the given \fCinput_size\fP\&.
+.PP
+\fBWarning:\fP
+.RS 4
+Result is only valid if quality is at least \fC2\fP and, in case \fBBrotliEncoderCompressStream\fP was used, no flushes (\fBBROTLI_OPERATION_FLUSH\fP) were performed\&.
+.RE
+.PP
+\fBParameters:\fP
+.RS 4
+\fIinput_size\fP size of projected input
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fC0\fP if result does not fit \fCsize_t\fP
+.RE
+.PP
+
+.SS "\fBBROTLI_BOOL\fP BrotliEncoderSetParameter (\fBBrotliEncoderState\fP * state, \fBBrotliEncoderParameter\fP param, uint32_t value)"
+
+.PP
+Sets the specified parameter to the given encoder instance\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP encoder instance
+.br
+\fIparam\fP parameter to set
+.br
+\fIvalue\fP new parameter value
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fBBROTLI_FALSE\fP if parameter is unrecognized, or value is invalid
+.PP
+\fBBROTLI_FALSE\fP if value of parameter can not be changed at current encoder state (e\&.g\&. when encoding is started, window size might be already encoded and therefore it is impossible to change it)
+.PP
+\fBBROTLI_TRUE\fP if value is accepted
+.RE
+.PP
+\fBWarning:\fP
+.RS 4
+invalid values might be accepted in case they would not break encoding process\&.
+.RE
+.PP
+
+.SS "const uint8_t* BrotliEncoderTakeOutput (\fBBrotliEncoderState\fP * state, size_t * size)"
+
+.PP
+Acquires pointer to internal output buffer\&. This method is used to make language bindings easier and more efficient:
+.IP "1." 4
+push data to \fBBrotliEncoderCompressStream\fP, until \fBBrotliEncoderHasMoreOutput\fP returns BROTL_TRUE
+.IP "2." 4
+use \fBBrotliEncoderTakeOutput\fP to peek bytes and copy to language-specific entity
+.PP
+.PP
+Also this could be useful if there is an output stream that is able to consume all the provided data (e\&.g\&. when data is saved to file system)\&.
+.PP
+\fBAttention:\fP
+.RS 4
+After every call to \fBBrotliEncoderTakeOutput\fP \fC*size\fP bytes of output are considered consumed for all consecutive calls to the instance methods; returned pointer becomes invalidated as well\&.
+.RE
+.PP
+\fBNote:\fP
+.RS 4
+Encoder output is not guaranteed to be contiguous\&. This means that after the size-unrestricted call to \fBBrotliEncoderTakeOutput\fP, immediate next call to \fBBrotliEncoderTakeOutput\fP may return more data\&.
+.RE
+.PP
+\fBParameters:\fP
+.RS 4
+\fIstate\fP encoder instance
+.br
+\fIsize\fP \fBin:\fP number of bytes caller is ready to take, \fC0\fP if any amount could be handled;
+.br
+ \fBout:\fP amount of data pointed by returned pointer and considered consumed;
+.br
+ out value is never greater than in value, unless it is \fC0\fP
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+pointer to output data
+.RE
+.PP
+
+.SS "uint32_t BrotliEncoderVersion (void)"
+
+.PP
+Gets an encoder library version\&. Look at BROTLI_VERSION for more information\&.
+.SH "Author"
+.PP
+Generated automatically by Doxygen for Brotli from the source code\&.
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/types.h.3 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/types.h.3
new file mode 100644
index 000000000..bef931303
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/docs/types.h.3
@@ -0,0 +1,117 @@
+.TH "types.h" 3 "Thu Feb 22 2018" "Brotli" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+types.h \- Common types used in decoder and encoder API\&.
+
+.SH SYNOPSIS
+.br
+.PP
+.SS "Macros"
+
+.in +1c
+.ti -1c
+.RI "#define \fBBROTLI_BOOL\fP int"
+.br
+.RI "\fIA portable \fCbool\fP replacement\&. \fP"
+.ti -1c
+.RI "#define \fBBROTLI_FALSE\fP 0"
+.br
+.RI "\fIPortable \fCfalse\fP replacement\&. \fP"
+.ti -1c
+.RI "#define \fBBROTLI_TRUE\fP 1"
+.br
+.RI "\fIPortable \fCtrue\fP replacement\&. \fP"
+.ti -1c
+.RI "#define \fBTO_BROTLI_BOOL\fP(X) (!!(X) ? \fBBROTLI_TRUE\fP : \fBBROTLI_FALSE\fP)"
+.br
+.RI "\fI\fCbool\fP to \fBBROTLI_BOOL\fP conversion macros\&. \fP"
+.in -1c
+.SS "Typedefs"
+
+.in +1c
+.ti -1c
+.RI "typedef void *(* \fBbrotli_alloc_func\fP) (void *opaque, size_t size)"
+.br
+.RI "\fIAllocating function pointer type\&. \fP"
+.ti -1c
+.RI "typedef void(* \fBbrotli_free_func\fP) (void *opaque, void *address)"
+.br
+.RI "\fIDeallocating function pointer type\&. \fP"
+.in -1c
+.SH "Detailed Description"
+.PP
+Common types used in decoder and encoder API\&.
+
+
+.SH "Macro Definition Documentation"
+.PP
+.SS "#define BROTLI_BOOL int"
+
+.PP
+A portable \fCbool\fP replacement\&. \fBBROTLI_BOOL\fP is a 'documentation' type: actually it is \fCint\fP, but in API it denotes a type, whose only values are \fBBROTLI_TRUE\fP and \fBBROTLI_FALSE\fP\&.
+.PP
+\fBBROTLI_BOOL\fP values passed to Brotli should either be \fBBROTLI_TRUE\fP or \fBBROTLI_FALSE\fP, or be a result of \fBTO_BROTLI_BOOL\fP macros\&.
+.PP
+\fBBROTLI_BOOL\fP values returned by Brotli should not be tested for equality with \fCtrue\fP, \fCfalse\fP, \fBBROTLI_TRUE\fP, \fBBROTLI_FALSE\fP, but rather should be evaluated, for example:
+.PP
+.nf
+if (SomeBrotliFunction(encoder, BROTLI_TRUE) &&
+ !OtherBrotliFunction(decoder, BROTLI_FALSE)) {
+ bool x = !!YetAnotherBrotliFunction(encoder, TO_BROLTI_BOOL(2 * 2 == 4));
+ DoSomething(x);
+}
+
+.fi
+.PP
+
+.SS "#define BROTLI_FALSE 0"
+
+.PP
+Portable \fCfalse\fP replacement\&.
+.SS "#define BROTLI_TRUE 1"
+
+.PP
+Portable \fCtrue\fP replacement\&.
+.SS "#define TO_BROTLI_BOOL(X) (!!(X) ? \fBBROTLI_TRUE\fP : \fBBROTLI_FALSE\fP)"
+
+.PP
+\fCbool\fP to \fBBROTLI_BOOL\fP conversion macros\&.
+.SH "Typedef Documentation"
+.PP
+.SS "typedef void*(* brotli_alloc_func) (void *opaque, size_t size)"
+
+.PP
+Allocating function pointer type\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIopaque\fP custom memory manager handle provided by client
+.br
+\fIsize\fP requested memory region size; can not be \fC0\fP
+.RE
+.PP
+\fBReturns:\fP
+.RS 4
+\fC0\fP in the case of failure
+.PP
+a valid pointer to a memory region of at least \fCsize\fP bytes long otherwise
+.RE
+.PP
+
+.SS "typedef void(* brotli_free_func) (void *opaque, void *address)"
+
+.PP
+Deallocating function pointer type\&. This function \fBSHOULD\fP do nothing if \fCaddress\fP is \fC0\fP\&.
+.PP
+\fBParameters:\fP
+.RS 4
+\fIopaque\fP custom memory manager handle provided by client
+.br
+\fIaddress\fP memory region pointer returned by \fBbrotli_alloc_func\fP, or \fC0\fP
+.RE
+.PP
+
+.SH "Author"
+.PP
+Generated automatically by Doxygen for Brotli from the source code\&.
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/fetch-spec/shared-brotli-fetch-spec.txt b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/fetch-spec/shared-brotli-fetch-spec.txt
new file mode 100644
index 000000000..ea2d11712
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/fetch-spec/shared-brotli-fetch-spec.txt
@@ -0,0 +1,116 @@
+[DRAFT]
+
+Introduction:
+
+This document is a draft proposal for Shard Brotli dictionaries in the fetch spec
+(https://fetch.spec.whatwg.org/).
+
+The goal is to add support for custom dictionaries for Brotli. A dictionary is used
+to improve compression. A client can download a dictionary from a server and then
+use it to decompress resources compressed with this dictionary.
+
+This document specifies how the client and server negotiate the dictionary over HTTP.
+A high level overview is as follows: The server adds an HTTP header to the response
+with a URL of the dictionary. The browser downloads the dictionary from the URL and
+then caches it so it can be reused. The server also adds a checksum to an HTTP header
+which the client uses to verify the dictionary. Caching, CORS, and other existing
+mechanisms are used. A dictionary can be a pre-made static dictionary, but does not
+have to be, for example a previous page loaded from this server, or an old version
+of a page, can be used as well.
+
+Below are changes and additions to add Shared Brotli dictionaries to the fetch spec
+at https://fetch.spec.whatwg.org/:
+
+Additions to `4.5. HTTP-network-or-cache fetch`
+
+Add to point `15. Modify httpRequest’s header list per HTTP.`:
+
+ If the recursive-sbr flag is enabled, `Accept-Encoding` may not contain `sbr`
+ [NOTE-BOX] When sbr can be used, it is possible to add a header Available-Dict
+ with the URL and hash code of a cached resource. The server may then use it as
+ shared dictionary.
+
+Additions to `4.6. HTTP-network fetch`
+
+Add after point `10. Run these steps, but abort if the ongoing fetch is terminated`:
+
+ 11. Let codings be the result of extracting header list values given
+ `Content-Encoding` and response’s header list.
+ 12. If codings contains `sbr`
+ 1. If the header list does not contain `Sbr-Dict`, return a network error
+ 2. Let dictionaryId be the result of extracting header list values given
+ `Sbr-Dict` and response’s header list.
+
+To point `12. Run these substeps in parallel:`, add new first sub-point:
+
+ 1. If codings contains `sbr`, run these subsubsteps:
+ 1. Let dictionaryResponse be the result of performing a
+ Shared-Brotli-dictionary fetch given dictionaryId and request.
+ 2. If dictionaryResponse is a network error, return a network error.
+
+Change point `12.4. Set bytes to the result of handling content codings given codings and bytes.` to:
+
+ 4. Set bytes to the result of handling content codings given codings, bytes
+ and, if codings contains `sbr`, also dictionaryResponse's body.
+ [NOTE-BOX] If the dictionary is still being fetched, which happens in
+ parallel, enqueue bytes in a compressed buffer and handle content coding
+ once the dictionary is fetched
+
+Additions to `2.2.4. Bodies`
+
+
+Change last section `To handle content codings ...` to:
+
+ To handle content codings given codings, bytes and optionally a dictionary, run these substeps:
+ 1. If codings are not supported, return bytes.
+ 2. If the codings has `sbr`, run these subsubsteps:
+ a. Return the result of decoding bytes and dictionary with the Shared
+ Brotli decoder.
+ [Shared Brotli Spec] [IANA Brotli](https://www.iana.org/assignments/http-parameters/http-parameters.xhtml)
+ 3. Else:
+ a. Return the result of decoding bytes with the given codings, as
+ explained in HTTP. [HTTP] [HTTP-SEMANTICS] [HTTP-COND] [HTTP-CACHING]
+ [HTTP-AUTH]
+
+New section `4.10. Shared-Brotli-dictionary fetch`
+
+ To perform a Shared-Brotli-dictionary fetch using dictionaryId, and parentRequest, perform these steps:
+
+ 1. Let dictionaryURL be the URL extracted from dictionaryId
+ 2. Let dictionaryHash be the hash id extracted from dictionaryId
+ 3. Let dictionaryRequest be a new request whose method is `GET`, url is
+ dictionaryURL, mode is "cors", and client is parentRequest's client.
+ 4. Let dictionaryResponse be the result of performing an
+ [HTTP-network-or-cache](https://fetch.spec.whatwg.org/#concept-http-network-or-cache-fetch)
+ fetch using dictionaryRequest with the recursive-sbr flag set to true.
+ [NOTE-BOX] For compression benefits, the dictionary should be reused to
+ decode multiple different responses. We rely on caching to achieve this.
+ It is suggested for servers to not add any "no-cache" or short "max-age"
+ Cache-Control directives, and it is suggested for the client to effectively
+ support caching it.
+ [NOTE-BOX] Since the same dictionary can be identified by a hash code, a
+ browser can avoid fetching a dictionary if it already has one with the same
+ hashed cached from a different source URL.
+ [NOTE-BOX] It is suggested that a server does not reuse the same URL
+ to host an updated or different dictionary. Instead the same dictionary URL
+ should contain a dictionary with the same content and same hash.
+ 5. If dictionaryResponse is a network error, return a network error.
+ 6. If dictionaryResponse's status is not an ok status, return a network error.
+ 7. Let tokens be the result of
+ [parsing metadata](https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata)
+ given dictionaryHash.
+ [Subresource Integrity](https://w3c.github.io/webappsec-subresource-integrity/)
+ 8. If tokens is no metadata or the length of tokens is not 1, return a network
+ error
+ 9. Let algorithm be the alg component of tokens[0]. If alg is 'hw3', set
+ algorithm to 256-bit HighwayHash
+ 10. Let digest be the val component of tokens[1].
+ 11. Let hashValue be the result of base64 decoding digest
+ [base64](https://tools.ietf.org/html/rfc4648)
+ 12. If hashValue is not a valid base64 encoding, return a network error
+ [NOTE-BOX] All of the supported hashing algorithms are cryptographically
+ secure.
+ 13. Compute the hash code of dictionaryResponse's body using algorithm and
+ compare this checksum for equality with hashValue. If the computed
+ checksum does not match hashValue, return a network error.
+ 14. Return dictionaryResponse.
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/BUILD b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/BUILD
new file mode 100644
index 000000000..72a5317f1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/BUILD
@@ -0,0 +1,2 @@
+# Description:
+# cbrotli is a CGo wrapper for Brotli, a generic-purpose lossless compression algorithm.
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/WORKSPACE b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/WORKSPACE
new file mode 100644
index 000000000..e9652697c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/WORKSPACE
@@ -0,0 +1,21 @@
+workspace(name = "org_brotli_go")
+
+local_repository(
+ name = "org_brotli",
+ path = "..",
+)
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+http_archive(
+ name = "io_bazel_rules_go",
+ urls = [
+ "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.19.0/rules_go-0.19.0.tar.gz",
+ "https://github.com/bazelbuild/rules_go/releases/download/0.19.0/rules_go-0.19.0.tar.gz",
+ ],
+ sha256 = "9fb16af4d4836c8222142e54c9efa0bb5fc562ffc893ce2abeac3e25daead144",
+)
+
+load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
+go_rules_dependencies()
+go_register_toolchains()
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/BUILD b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/BUILD
new file mode 100644
index 000000000..ce594ad19
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/BUILD
@@ -0,0 +1,26 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # MIT
+
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "cbrotli",
+ srcs = [
+ "reader.go",
+ "writer.go",
+ ],
+ cdeps = [
+ "@org_brotli//:brotlidec",
+ "@org_brotli//:brotlienc",
+ ],
+ cgo = True,
+ importpath = "github.com/google/brotli/go/cbrotli",
+)
+
+go_test(
+ name = "cbrotli_test",
+ size = "small",
+ srcs = ["cbrotli_test.go"],
+ embed = [":cbrotli"],
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/cbrotli_test.go b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/cbrotli_test.go
new file mode 100644
index 000000000..f59ec582d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/cbrotli_test.go
@@ -0,0 +1,367 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Distributed under MIT license.
+// See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+package cbrotli
+
+import (
+ "bytes"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "math"
+ "math/rand"
+ "testing"
+ "time"
+)
+
+func checkCompressedData(compressedData, wantOriginalData []byte) error {
+ uncompressed, err := Decode(compressedData)
+ if err != nil {
+ return fmt.Errorf("brotli decompress failed: %v", err)
+ }
+ if !bytes.Equal(uncompressed, wantOriginalData) {
+ if len(wantOriginalData) != len(uncompressed) {
+ return fmt.Errorf(""+
+ "Data doesn't uncompress to the original value.\n"+
+ "Length of original: %v\n"+
+ "Length of uncompressed: %v",
+ len(wantOriginalData), len(uncompressed))
+ }
+ for i := range wantOriginalData {
+ if wantOriginalData[i] != uncompressed[i] {
+ return fmt.Errorf(""+
+ "Data doesn't uncompress to the original value.\n"+
+ "Original at %v is %v\n"+
+ "Uncompressed at %v is %v",
+ i, wantOriginalData[i], i, uncompressed[i])
+ }
+ }
+ }
+ return nil
+}
+
+func TestEncoderNoWrite(t *testing.T) {
+ out := bytes.Buffer{}
+ e := NewWriter(&out, WriterOptions{Quality: 5})
+ if err := e.Close(); err != nil {
+ t.Errorf("Close()=%v, want nil", err)
+ }
+ // Check Write after close.
+ if _, err := e.Write([]byte("hi")); err == nil {
+ t.Errorf("No error after Close() + Write()")
+ }
+}
+
+func TestEncoderEmptyWrite(t *testing.T) {
+ out := bytes.Buffer{}
+ e := NewWriter(&out, WriterOptions{Quality: 5})
+ n, err := e.Write([]byte(""))
+ if n != 0 || err != nil {
+ t.Errorf("Write()=%v,%v, want 0, nil", n, err)
+ }
+ if err := e.Close(); err != nil {
+ t.Errorf("Close()=%v, want nil", err)
+ }
+}
+
+func TestWriter(t *testing.T) {
+ // Test basic encoder usage.
+ input := []byte("<html><body><H1>Hello world</H1></body></html>")
+ out := bytes.Buffer{}
+ e := NewWriter(&out, WriterOptions{Quality: 1})
+ in := bytes.NewReader([]byte(input))
+ n, err := io.Copy(e, in)
+ if err != nil {
+ t.Errorf("Copy Error: %v", err)
+ }
+ if int(n) != len(input) {
+ t.Errorf("Copy() n=%v, want %v", n, len(input))
+ }
+ if err := e.Close(); err != nil {
+ t.Errorf("Close Error after copied %d bytes: %v", n, err)
+ }
+ if err := checkCompressedData(out.Bytes(), input); err != nil {
+ t.Error(err)
+ }
+}
+
+func TestEncoderStreams(t *testing.T) {
+ // Test that output is streamed.
+ // Adjust window size to ensure the encoder outputs at least enough bytes
+ // to fill the window.
+ const lgWin = 16
+ windowSize := int(math.Pow(2, lgWin))
+ input := make([]byte, 8*windowSize)
+ rand.Read(input)
+ out := bytes.Buffer{}
+ e := NewWriter(&out, WriterOptions{Quality: 11, LGWin: lgWin})
+ halfInput := input[:len(input)/2]
+ in := bytes.NewReader(halfInput)
+
+ n, err := io.Copy(e, in)
+ if err != nil {
+ t.Errorf("Copy Error: %v", err)
+ }
+
+ // We've fed more data than the sliding window size. Check that some
+ // compressed data has been output.
+ if out.Len() == 0 {
+ t.Errorf("Output length is 0 after %d bytes written", n)
+ }
+ if err := e.Close(); err != nil {
+ t.Errorf("Close Error after copied %d bytes: %v", n, err)
+ }
+ if err := checkCompressedData(out.Bytes(), halfInput); err != nil {
+ t.Error(err)
+ }
+}
+
+func TestEncoderLargeInput(t *testing.T) {
+ input := make([]byte, 1000000)
+ rand.Read(input)
+ out := bytes.Buffer{}
+ e := NewWriter(&out, WriterOptions{Quality: 5})
+ in := bytes.NewReader(input)
+
+ n, err := io.Copy(e, in)
+ if err != nil {
+ t.Errorf("Copy Error: %v", err)
+ }
+ if int(n) != len(input) {
+ t.Errorf("Copy() n=%v, want %v", n, len(input))
+ }
+ if err := e.Close(); err != nil {
+ t.Errorf("Close Error after copied %d bytes: %v", n, err)
+ }
+ if err := checkCompressedData(out.Bytes(), input); err != nil {
+ t.Error(err)
+ }
+}
+
+func TestEncoderFlush(t *testing.T) {
+ input := make([]byte, 1000)
+ rand.Read(input)
+ out := bytes.Buffer{}
+ e := NewWriter(&out, WriterOptions{Quality: 5})
+ in := bytes.NewReader(input)
+ _, err := io.Copy(e, in)
+ if err != nil {
+ t.Fatalf("Copy Error: %v", err)
+ }
+ if err := e.Flush(); err != nil {
+ t.Fatalf("Flush(): %v", err)
+ }
+ if out.Len() == 0 {
+ t.Fatalf("0 bytes written after Flush()")
+ }
+ decompressed := make([]byte, 1000)
+ reader := NewReader(bytes.NewReader(out.Bytes()))
+ n, err := reader.Read(decompressed)
+ if n != len(decompressed) || err != nil {
+ t.Errorf("Expected <%v, nil>, but <%v, %v>", len(decompressed), n, err)
+ }
+ reader.Close()
+ if !bytes.Equal(decompressed, input) {
+ t.Errorf(""+
+ "Decompress after flush: %v\n"+
+ "%q\n"+
+ "want:\n%q",
+ err, decompressed, input)
+ }
+ if err := e.Close(); err != nil {
+ t.Errorf("Close(): %v", err)
+ }
+}
+
+type readerWithTimeout struct {
+ io.ReadCloser
+}
+
+func (r readerWithTimeout) Read(p []byte) (int, error) {
+ type result struct {
+ n int
+ err error
+ }
+ ch := make(chan result)
+ go func() {
+ n, err := r.ReadCloser.Read(p)
+ ch <- result{n, err}
+ }()
+ select {
+ case result := <-ch:
+ return result.n, result.err
+ case <-time.After(5 * time.Second):
+ return 0, fmt.Errorf("read timed out")
+ }
+}
+
+func TestDecoderStreaming(t *testing.T) {
+ pr, pw := io.Pipe()
+ writer := NewWriter(pw, WriterOptions{Quality: 5, LGWin: 20})
+ reader := readerWithTimeout{NewReader(pr)}
+ defer func() {
+ if err := reader.Close(); err != nil {
+ t.Errorf("reader.Close: %v", err)
+ }
+ go ioutil.ReadAll(pr) // swallow the "EOF" token from writer.Close
+ if err := writer.Close(); err != nil {
+ t.Errorf("writer.Close: %v", err)
+ }
+ }()
+
+ ch := make(chan []byte)
+ errch := make(chan error)
+ go func() {
+ for {
+ segment, ok := <-ch
+ if !ok {
+ return
+ }
+ if n, err := writer.Write(segment); err != nil || n != len(segment) {
+ errch <- fmt.Errorf("write=%v,%v, want %v,%v", n, err, len(segment), nil)
+ return
+ }
+ if err := writer.Flush(); err != nil {
+ errch <- fmt.Errorf("flush: %v", err)
+ return
+ }
+ }
+ }()
+ defer close(ch)
+
+ segments := [...][]byte{
+ []byte("first"),
+ []byte("second"),
+ []byte("third"),
+ }
+ for k, segment := range segments {
+ t.Run(fmt.Sprintf("Segment%d", k), func(t *testing.T) {
+ select {
+ case ch <- segment:
+ case err := <-errch:
+ t.Fatalf("write: %v", err)
+ case <-time.After(5 * time.Second):
+ t.Fatalf("timed out")
+ }
+ wantLen := len(segment)
+ got := make([]byte, wantLen)
+ if n, err := reader.Read(got); err != nil || n != wantLen || !bytes.Equal(got, segment) {
+ t.Fatalf("read[%d]=%q,%v,%v, want %q,%v,%v", k, got, n, err, segment, wantLen, nil)
+ }
+ })
+ }
+}
+
+func TestReader(t *testing.T) {
+ content := bytes.Repeat([]byte("hello world!"), 10000)
+ encoded, _ := Encode(content, WriterOptions{Quality: 5})
+ r := NewReader(bytes.NewReader(encoded))
+ var decodedOutput bytes.Buffer
+ n, err := io.Copy(&decodedOutput, r)
+ if err != nil {
+ t.Fatalf("Copy(): n=%v, err=%v", n, err)
+ }
+ if err := r.Close(); err != nil {
+ t.Errorf("Close(): %v", err)
+ }
+ if got := decodedOutput.Bytes(); !bytes.Equal(got, content) {
+ t.Errorf(""+
+ "Reader output:\n"+
+ "%q\n"+
+ "want:\n"+
+ "<%d bytes>",
+ got, len(content))
+ }
+}
+
+func TestDecode(t *testing.T) {
+ content := bytes.Repeat([]byte("hello world!"), 10000)
+ encoded, _ := Encode(content, WriterOptions{Quality: 5})
+ decoded, err := Decode(encoded)
+ if err != nil {
+ t.Errorf("Decode: %v", err)
+ }
+ if !bytes.Equal(decoded, content) {
+ t.Errorf(""+
+ "Decode content:\n"+
+ "%q\n"+
+ "want:\n"+
+ "<%d bytes>",
+ decoded, len(content))
+ }
+}
+
+func TestDecodeFuzz(t *testing.T) {
+ // Test that the decoder terminates with corrupted input.
+ content := bytes.Repeat([]byte("hello world!"), 100)
+ src := rand.NewSource(0)
+ encoded, err := Encode(content, WriterOptions{Quality: 5})
+ if err != nil {
+ t.Fatalf("Encode(<%d bytes>, _) = _, %s", len(content), err)
+ }
+ if len(encoded) == 0 {
+ t.Fatalf("Encode(<%d bytes>, _) produced empty output", len(content))
+ }
+ for i := 0; i < 100; i++ {
+ enc := append([]byte{}, encoded...)
+ for j := 0; j < 5; j++ {
+ enc[int(src.Int63())%len(enc)] = byte(src.Int63() % 256)
+ }
+ Decode(enc)
+ }
+}
+
+func TestDecodeTrailingData(t *testing.T) {
+ content := bytes.Repeat([]byte("hello world!"), 100)
+ encoded, _ := Encode(content, WriterOptions{Quality: 5})
+ _, err := Decode(append(encoded, 0))
+ if err == nil {
+ t.Errorf("Expected 'excessive input' error")
+ }
+}
+
+func TestEncodeDecode(t *testing.T) {
+ for _, test := range []struct {
+ data []byte
+ repeats int
+ }{
+ {nil, 0},
+ {[]byte("A"), 1},
+ {[]byte("<html><body><H1>Hello world</H1></body></html>"), 10},
+ {[]byte("<html><body><H1>Hello world</H1></body></html>"), 1000},
+ } {
+ t.Logf("case %q x %d", test.data, test.repeats)
+ input := bytes.Repeat(test.data, test.repeats)
+ encoded, err := Encode(input, WriterOptions{Quality: 5})
+ if err != nil {
+ t.Errorf("Encode: %v", err)
+ }
+ // Inputs are compressible, but may be too small to compress.
+ if maxSize := len(input)/2 + 20; len(encoded) >= maxSize {
+ t.Errorf(""+
+ "Encode returned %d bytes, want <%d\n"+
+ "Encoded=%q",
+ len(encoded), maxSize, encoded)
+ }
+ decoded, err := Decode(encoded)
+ if err != nil {
+ t.Errorf("Decode: %v", err)
+ }
+ if !bytes.Equal(decoded, input) {
+ var want string
+ if len(input) > 320 {
+ want = fmt.Sprintf("<%d bytes>", len(input))
+ } else {
+ want = fmt.Sprintf("%q", input)
+ }
+ t.Errorf(""+
+ "Decode content:\n"+
+ "%q\n"+
+ "want:\n"+
+ "%s",
+ decoded, want)
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/cgo.go b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/cgo.go
new file mode 100644
index 000000000..f953f72cd
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/cgo.go
@@ -0,0 +1,13 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Distributed under MIT license.
+// See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+package cbrotli
+
+// Inform golang build system that it should link brotli libraries.
+
+// #cgo LDFLAGS: -lbrotlicommon
+// #cgo LDFLAGS: -lbrotlidec
+// #cgo LDFLAGS: -lbrotlienc
+import "C"
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/reader.go b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/reader.go
new file mode 100644
index 000000000..3d8d42450
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/reader.go
@@ -0,0 +1,161 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Distributed under MIT license.
+// See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+// Package cbrotli compresses and decompresses data with C-Brotli library.
+package cbrotli
+
+/*
+#include <stddef.h>
+#include <stdint.h>
+
+#include <brotli/decode.h>
+
+static BrotliDecoderResult DecompressStream(BrotliDecoderState* s,
+ uint8_t* out, size_t out_len,
+ const uint8_t* in, size_t in_len,
+ size_t* bytes_written,
+ size_t* bytes_consumed) {
+ size_t in_remaining = in_len;
+ size_t out_remaining = out_len;
+ BrotliDecoderResult result = BrotliDecoderDecompressStream(
+ s, &in_remaining, &in, &out_remaining, &out, NULL);
+ *bytes_written = out_len - out_remaining;
+ *bytes_consumed = in_len - in_remaining;
+ return result;
+}
+*/
+import "C"
+
+import (
+ "bytes"
+ "errors"
+ "io"
+ "io/ioutil"
+)
+
+type decodeError C.BrotliDecoderErrorCode
+
+func (err decodeError) Error() string {
+ return "cbrotli: " +
+ C.GoString(C.BrotliDecoderErrorString(C.BrotliDecoderErrorCode(err)))
+}
+
+var errExcessiveInput = errors.New("cbrotli: excessive input")
+var errInvalidState = errors.New("cbrotli: invalid state")
+var errReaderClosed = errors.New("cbrotli: Reader is closed")
+
+// Reader implements io.ReadCloser by reading Brotli-encoded data from an
+// underlying Reader.
+type Reader struct {
+ src io.Reader
+ state *C.BrotliDecoderState
+ buf []byte // scratch space for reading from src
+ in []byte // current chunk to decode; usually aliases buf
+}
+
+// readBufSize is a "good" buffer size that avoids excessive round-trips
+// between C and Go but doesn't waste too much memory on buffering.
+// It is arbitrarily chosen to be equal to the constant used in io.Copy.
+const readBufSize = 32 * 1024
+
+// NewReader initializes new Reader instance.
+// Close MUST be called to free resources.
+func NewReader(src io.Reader) *Reader {
+ return &Reader{
+ src: src,
+ state: C.BrotliDecoderCreateInstance(nil, nil, nil),
+ buf: make([]byte, readBufSize),
+ }
+}
+
+// Close implements io.Closer. Close MUST be invoked to free native resources.
+func (r *Reader) Close() error {
+ if r.state == nil {
+ return errReaderClosed
+ }
+ // Close despite the state; i.e. there might be some unread decoded data.
+ C.BrotliDecoderDestroyInstance(r.state)
+ r.state = nil
+ return nil
+}
+
+func (r *Reader) Read(p []byte) (n int, err error) {
+ if int(C.BrotliDecoderHasMoreOutput(r.state)) == 0 && len(r.in) == 0 {
+ m, readErr := r.src.Read(r.buf)
+ if m == 0 {
+ // If readErr is `nil`, we just proxy underlying stream behavior.
+ return 0, readErr
+ }
+ r.in = r.buf[:m]
+ }
+
+ if len(p) == 0 {
+ return 0, nil
+ }
+
+ for {
+ var written, consumed C.size_t
+ var data *C.uint8_t
+ if len(r.in) != 0 {
+ data = (*C.uint8_t)(&r.in[0])
+ }
+ result := C.DecompressStream(r.state,
+ (*C.uint8_t)(&p[0]), C.size_t(len(p)),
+ data, C.size_t(len(r.in)),
+ &written, &consumed)
+ r.in = r.in[int(consumed):]
+ n = int(written)
+
+ switch result {
+ case C.BROTLI_DECODER_RESULT_SUCCESS:
+ if len(r.in) > 0 {
+ return n, errExcessiveInput
+ }
+ return n, nil
+ case C.BROTLI_DECODER_RESULT_ERROR:
+ return n, decodeError(C.BrotliDecoderGetErrorCode(r.state))
+ case C.BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:
+ if n == 0 {
+ return 0, io.ErrShortBuffer
+ }
+ return n, nil
+ case C.BROTLI_DECODER_NEEDS_MORE_INPUT:
+ }
+
+ if len(r.in) != 0 {
+ return 0, errInvalidState
+ }
+
+ // Calling r.src.Read may block. Don't block if we have data to return.
+ if n > 0 {
+ return n, nil
+ }
+
+ // Top off the buffer.
+ encN, err := r.src.Read(r.buf)
+ if encN == 0 {
+ // Not enough data to complete decoding.
+ if err == io.EOF {
+ return 0, io.ErrUnexpectedEOF
+ }
+ return 0, err
+ }
+ r.in = r.buf[:encN]
+ }
+
+ return n, nil
+}
+
+// Decode decodes Brotli encoded data.
+func Decode(encodedData []byte) ([]byte, error) {
+ r := &Reader{
+ src: bytes.NewReader(nil),
+ state: C.BrotliDecoderCreateInstance(nil, nil, nil),
+ buf: make([]byte, 4), // arbitrarily small but nonzero so that r.src.Read returns io.EOF
+ in: encodedData,
+ }
+ defer r.Close()
+ return ioutil.ReadAll(r)
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/writer.go b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/writer.go
new file mode 100644
index 000000000..9fa75ab06
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/go/cbrotli/writer.go
@@ -0,0 +1,159 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Distributed under MIT license.
+// See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+package cbrotli
+
+/*
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include <brotli/encode.h>
+
+struct CompressStreamResult {
+ size_t bytes_consumed;
+ const uint8_t* output_data;
+ size_t output_data_size;
+ int success;
+ int has_more;
+};
+
+static struct CompressStreamResult CompressStream(
+ BrotliEncoderState* s, BrotliEncoderOperation op,
+ const uint8_t* data, size_t data_size) {
+ struct CompressStreamResult result;
+ size_t available_in = data_size;
+ const uint8_t* next_in = data;
+ size_t available_out = 0;
+ result.success = BrotliEncoderCompressStream(s, op,
+ &available_in, &next_in, &available_out, 0, 0) ? 1 : 0;
+ result.bytes_consumed = data_size - available_in;
+ result.output_data = 0;
+ result.output_data_size = 0;
+ if (result.success) {
+ result.output_data = BrotliEncoderTakeOutput(s, &result.output_data_size);
+ }
+ result.has_more = BrotliEncoderHasMoreOutput(s) ? 1 : 0;
+ return result;
+}
+*/
+import "C"
+
+import (
+ "bytes"
+ "errors"
+ "io"
+ "unsafe"
+)
+
+// WriterOptions configures Writer.
+type WriterOptions struct {
+ // Quality controls the compression-speed vs compression-density trade-offs.
+ // The higher the quality, the slower the compression. Range is 0 to 11.
+ Quality int
+ // LGWin is the base 2 logarithm of the sliding window size.
+ // Range is 10 to 24. 0 indicates automatic configuration based on Quality.
+ LGWin int
+}
+
+// Writer implements io.WriteCloser by writing Brotli-encoded data to an
+// underlying Writer.
+type Writer struct {
+ dst io.Writer
+ state *C.BrotliEncoderState
+ buf, encoded []byte
+}
+
+var (
+ errEncode = errors.New("cbrotli: encode error")
+ errWriterClosed = errors.New("cbrotli: Writer is closed")
+)
+
+// NewWriter initializes new Writer instance.
+// Close MUST be called to free resources.
+func NewWriter(dst io.Writer, options WriterOptions) *Writer {
+ state := C.BrotliEncoderCreateInstance(nil, nil, nil)
+ C.BrotliEncoderSetParameter(
+ state, C.BROTLI_PARAM_QUALITY, (C.uint32_t)(options.Quality))
+ if options.LGWin > 0 {
+ C.BrotliEncoderSetParameter(
+ state, C.BROTLI_PARAM_LGWIN, (C.uint32_t)(options.LGWin))
+ }
+ return &Writer{
+ dst: dst,
+ state: state,
+ }
+}
+
+func (w *Writer) writeChunk(p []byte, op C.BrotliEncoderOperation) (n int, err error) {
+ if w.state == nil {
+ return 0, errWriterClosed
+ }
+
+ for {
+ var data *C.uint8_t
+ if len(p) != 0 {
+ data = (*C.uint8_t)(&p[0])
+ }
+ result := C.CompressStream(w.state, op, data, C.size_t(len(p)))
+ if result.success == 0 {
+ return n, errEncode
+ }
+ p = p[int(result.bytes_consumed):]
+ n += int(result.bytes_consumed)
+
+ length := int(result.output_data_size)
+ if length != 0 {
+ // It is a workaround for non-copying-wrapping of native memory.
+ // C-encoder never pushes output block longer than ((2 << 25) + 502).
+ // TODO: use natural wrapper, when it becomes available, see
+ // https://golang.org/issue/13656.
+ output := (*[1 << 30]byte)(unsafe.Pointer(result.output_data))[:length:length]
+ _, err = w.dst.Write(output)
+ if err != nil {
+ return n, err
+ }
+ }
+ if len(p) == 0 && result.has_more == 0 {
+ return n, nil
+ }
+ }
+}
+
+// Flush outputs encoded data for all input provided to Write. The resulting
+// output can be decoded to match all input before Flush, but the stream is
+// not yet complete until after Close.
+// Flush has a negative impact on compression.
+func (w *Writer) Flush() error {
+ _, err := w.writeChunk(nil, C.BROTLI_OPERATION_FLUSH)
+ return err
+}
+
+// Close flushes remaining data to the decorated writer and frees C resources.
+func (w *Writer) Close() error {
+ // If stream is already closed, it is reported by `writeChunk`.
+ _, err := w.writeChunk(nil, C.BROTLI_OPERATION_FINISH)
+ // C-Brotli tolerates `nil` pointer here.
+ C.BrotliEncoderDestroyInstance(w.state)
+ w.state = nil
+ return err
+}
+
+// Write implements io.Writer. Flush or Close must be called to ensure that the
+// encoded bytes are actually flushed to the underlying Writer.
+func (w *Writer) Write(p []byte) (n int, err error) {
+ return w.writeChunk(p, C.BROTLI_OPERATION_PROCESS)
+}
+
+// Encode returns content encoded with Brotli.
+func Encode(content []byte, options WriterOptions) ([]byte, error) {
+ var buf bytes.Buffer
+ writer := NewWriter(&buf, options)
+ _, err := writer.Write(content)
+ if closeErr := writer.Close(); err == nil {
+ err = closeErr
+ }
+ return buf.Bytes(), err
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/BUILD b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/BUILD
new file mode 100644
index 000000000..cd55c5477
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/BUILD
@@ -0,0 +1,98 @@
+package(
+ default_visibility = ["//visibility:public"],
+)
+
+# >>> JNI headers
+
+genrule(
+ name = "copy_link_jni_header",
+ srcs = ["@openjdk_jni_h//file"],
+ outs = ["jni/jni.h"],
+ cmd = "cp -f $< $@",
+)
+
+genrule(
+ name = "copy_link_jni_md_header",
+ srcs = select({
+ "@org_brotli//:darwin": ["@openjdk_macosx_jni_md_h//file"],
+ "@org_brotli//:darwin_x86_64": ["@openjdk_macosx_jni_md_h//file"],
+ "@org_brotli//:windows_msys": ["@openjdk_windows_jni_md_h//file"],
+ "@org_brotli//:windows_msvc": ["@openjdk_windows_jni_md_h//file"],
+ "@org_brotli//:windows": ["@openjdk_windows_jni_md_h//file"],
+ "//conditions:default": ["@openjdk_solaris_jni_md_h//file"],
+ }),
+ outs = ["jni/jni_md.h"],
+ cmd = "cp -f $< $@",
+)
+
+cc_library(
+ name = "jni_inc",
+ hdrs = [
+ ":jni/jni.h",
+ ":jni/jni_md.h",
+ ],
+ includes = ["jni"],
+)
+
+# <<< JNI headers
+
+genrule(
+ name = "license_resource",
+ srcs = ["@org_brotli//:LICENSE"],
+ outs = ["META-INF/LICENSE"],
+ cmd = "cp -f $< $@",
+)
+
+java_library(
+ name = "license",
+ resources = [":license_resource"],
+)
+
+########################################################
+# WARNING: do not (transitively) depend on this target!
+########################################################
+cc_binary(
+ name = "brotli_jni.dll",
+ srcs = [
+ "//org/brotli/wrapper/common:jni_src",
+ "//org/brotli/wrapper/dec:jni_src",
+ "//org/brotli/wrapper/enc:jni_src",
+ "@org_brotli//:common_headers",
+ "@org_brotli//:common_sources",
+ "@org_brotli//:dec_headers",
+ "@org_brotli//:dec_sources",
+ "@org_brotli//:enc_headers",
+ "@org_brotli//:enc_sources",
+ ],
+ linkshared = 1,
+ deps = [
+ ":jni_inc",
+ "@org_brotli//:brotli_inc",
+ ],
+)
+
+########################################################
+# WARNING: do not (transitively) depend on this target!
+########################################################
+cc_binary(
+ name = "brotli_jni_no_dictionary_data.dll",
+ srcs = [
+ "//org/brotli/wrapper/common:jni_src",
+ "//org/brotli/wrapper/dec:jni_src",
+ "//org/brotli/wrapper/enc:jni_src",
+ "@org_brotli//:common_headers",
+ "@org_brotli//:common_sources",
+ "@org_brotli//:dec_headers",
+ "@org_brotli//:dec_sources",
+ "@org_brotli//:enc_headers",
+ "@org_brotli//:enc_sources",
+ ],
+ defines = [
+ "BROTLI_EXTERNAL_DICTIONARY_DATA=",
+ ],
+ linkshared = 1,
+ deps = [
+ ":jni_inc",
+ "@org_brotli//:brotli_inc",
+ ],
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/WORKSPACE b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/WORKSPACE
new file mode 100644
index 000000000..06fbdfeea
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/WORKSPACE
@@ -0,0 +1,41 @@
+workspace(name = "org_brotli_java")
+
+local_repository(
+ name = "org_brotli",
+ path = "..",
+)
+
+maven_jar(
+ name = "junit_junit",
+ artifact = "junit:junit:4.12",
+)
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
+
+http_file(
+ name = "openjdk_jni_h",
+ downloaded_file_path = "jni.h",
+ urls = ["https://hg.openjdk.java.net/jdk8/jdk8/jdk/raw-file/687fd7c7986d/src/share/javavm/export/jni.h"],
+ sha256 = "ed99792df48670072b78028faf704a8dcb6868fe140ccc7eced9b01dfa62fef4",
+)
+
+http_file(
+ name = "openjdk_solaris_jni_md_h",
+ downloaded_file_path = "jni_md.h",
+ urls = ["https://hg.openjdk.java.net/jdk8/jdk8/jdk/raw-file/687fd7c7986d/src/solaris/javavm/export/jni_md.h"],
+ sha256 = "ecbe6944fe1a4290644d5a6b3c8f68576798a53b9da12cd31c58c48569595ff7",
+)
+
+http_file(
+ name = "openjdk_macosx_jni_md_h",
+ downloaded_file_path = "jni_md.h",
+ urls = ["https://hg.openjdk.java.net/jdk8/jdk8/jdk/raw-file/687fd7c7986d/src/macosx/javavm/export/jni_md.h"],
+ sha256 = "8f718071022e7e7f2fc9a229984b7e83582db91ed83861b49ce1461436fe8dc4",
+)
+
+http_file(
+ name = "openjdk_windows_jni_md_h",
+ downloaded_file_path = "jni_md.h",
+ urls = ["https://hg.openjdk.java.net/jdk8/jdk8/jdk/raw-file/687fd7c7986d/src/windows/javavm/export/jni_md.h"],
+ sha256 = "5479fb385ea1e11619f5c0cdfd9ccb3ea3a3fea0f5bc6176fb3ce62be29d759b",
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BUILD b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BUILD
new file mode 100644
index 000000000..0cc0cbf18
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BUILD
@@ -0,0 +1,59 @@
+# Description:
+# Java port of Brotli decoder.
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # MIT
+
+TEST_DEPS = [
+ ":dec",
+ "@junit_junit//jar",
+]
+
+java_library(
+ name = "dec",
+ srcs = glob(
+ ["*.java"],
+ exclude = ["*Test*.java"],
+ ),
+ proguard_specs = ["proguard.pgcfg"],
+ resource_jars = ["//:license"],
+)
+
+load(":build_defs.bzl", "brotli_java_test")
+
+brotli_java_test(
+ name = "BitReaderTest",
+ srcs = ["BitReaderTest.java"],
+ deps = TEST_DEPS,
+)
+
+brotli_java_test(
+ name = "DecodeTest",
+ srcs = ["DecodeTest.java"],
+ deps = TEST_DEPS,
+)
+
+brotli_java_test(
+ name = "DictionaryTest",
+ srcs = ["DictionaryTest.java"],
+ deps = TEST_DEPS,
+)
+
+brotli_java_test(
+ name = "EagerStreamTest",
+ srcs = ["EagerStreamTest.java"],
+ deps = TEST_DEPS,
+)
+
+brotli_java_test(
+ name = "SynthTest",
+ srcs = ["SynthTest.java"],
+ deps = TEST_DEPS,
+)
+
+brotli_java_test(
+ name = "TransformTest",
+ srcs = ["TransformTest.java"],
+ deps = TEST_DEPS,
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BitReader.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BitReader.java
new file mode 100644
index 000000000..6dfeedca8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BitReader.java
@@ -0,0 +1,289 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+/**
+ * Bit reading helpers.
+ */
+final class BitReader {
+
+ // Possible values: {5, 6}. 5 corresponds to 32-bit build, 6 to 64-bit. This value is used for
+ // JIT conditional compilation.
+ private static final int LOG_BITNESS = Utils.getLogBintness();
+
+ // Not only Java compiler prunes "if (const false)" code, but JVM as well.
+ // Code under "if (DEBUG != 0)" have zero performance impact (outside unit tests).
+ private static final int DEBUG = Utils.isDebugMode();
+
+ static final int BITNESS = 1 << LOG_BITNESS;
+
+ private static final int BYTENESS = BITNESS / 8;
+ private static final int CAPACITY = 4096;
+ // After encountering the end of the input stream, this amount of zero bytes will be appended.
+ private static final int SLACK = 64;
+ private static final int BUFFER_SIZE = CAPACITY + SLACK;
+ // Don't bother to replenish the buffer while this number of bytes is available.
+ private static final int SAFEGUARD = 36;
+ private static final int WATERLINE = CAPACITY - SAFEGUARD;
+
+ // "Half" refers to "half of native integer type", i.e. on 64-bit machines it is 32-bit type,
+ // on 32-bit machines it is 16-bit.
+ private static final int HALF_BITNESS = BITNESS / 2;
+ private static final int HALF_SIZE = BYTENESS / 2;
+ private static final int HALVES_CAPACITY = CAPACITY / HALF_SIZE;
+ private static final int HALF_BUFFER_SIZE = BUFFER_SIZE / HALF_SIZE;
+ private static final int HALF_WATERLINE = WATERLINE / HALF_SIZE;
+
+ private static final int LOG_HALF_SIZE = LOG_BITNESS - 4;
+
+ /**
+ * Fills up the input buffer.
+ *
+ * <p> No-op if there are at least 36 bytes present after current position.
+ *
+ * <p> After encountering the end of the input stream, 64 additional zero bytes are copied to the
+ * buffer.
+ */
+ static void readMoreInput(State s) {
+ if (s.halfOffset > HALF_WATERLINE) {
+ doReadMoreInput(s);
+ }
+ }
+
+ static void doReadMoreInput(State s) {
+ if (s.endOfStreamReached != 0) {
+ if (halfAvailable(s) >= -2) {
+ return;
+ }
+ throw new BrotliRuntimeException("No more input");
+ }
+ int readOffset = s.halfOffset << LOG_HALF_SIZE;
+ int bytesInBuffer = CAPACITY - readOffset;
+ // Move unused bytes to the head of the buffer.
+ Utils.copyBytesWithin(s.byteBuffer, 0, readOffset, CAPACITY);
+ s.halfOffset = 0;
+ while (bytesInBuffer < CAPACITY) {
+ int spaceLeft = CAPACITY - bytesInBuffer;
+ int len = Utils.readInput(s.input, s.byteBuffer, bytesInBuffer, spaceLeft);
+ // EOF is -1 in Java, but 0 in C#.
+ if (len <= 0) {
+ s.endOfStreamReached = 1;
+ s.tailBytes = bytesInBuffer;
+ bytesInBuffer += HALF_SIZE - 1;
+ break;
+ }
+ bytesInBuffer += len;
+ }
+ bytesToNibbles(s, bytesInBuffer);
+ }
+
+ static void checkHealth(State s, int endOfStream) {
+ if (s.endOfStreamReached == 0) {
+ return;
+ }
+ int byteOffset = (s.halfOffset << LOG_HALF_SIZE) + ((s.bitOffset + 7) >> 3) - BYTENESS;
+ if (byteOffset > s.tailBytes) {
+ throw new BrotliRuntimeException("Read after end");
+ }
+ if ((endOfStream != 0) && (byteOffset != s.tailBytes)) {
+ throw new BrotliRuntimeException("Unused bytes after end");
+ }
+ }
+
+ static void assertAccumulatorHealthy(State s) {
+ if (s.bitOffset > BITNESS) {
+ throw new IllegalStateException("Accumulator underloaded: " + s.bitOffset);
+ }
+ }
+
+ static void fillBitWindow(State s) {
+ if (DEBUG != 0) {
+ assertAccumulatorHealthy(s);
+ }
+ if (s.bitOffset >= HALF_BITNESS) {
+ // Same as doFillBitWindow. JVM fails to inline it.
+ if (BITNESS == 64) {
+ s.accumulator64 = ((long) s.intBuffer[s.halfOffset++] << HALF_BITNESS)
+ | (s.accumulator64 >>> HALF_BITNESS);
+ } else {
+ s.accumulator32 = ((int) s.shortBuffer[s.halfOffset++] << HALF_BITNESS)
+ | (s.accumulator32 >>> HALF_BITNESS);
+ }
+ s.bitOffset -= HALF_BITNESS;
+ }
+ }
+
+ static void doFillBitWindow(State s) {
+ if (DEBUG != 0) {
+ assertAccumulatorHealthy(s);
+ }
+ if (BITNESS == 64) {
+ s.accumulator64 = ((long) s.intBuffer[s.halfOffset++] << HALF_BITNESS)
+ | (s.accumulator64 >>> HALF_BITNESS);
+ } else {
+ s.accumulator32 = ((int) s.shortBuffer[s.halfOffset++] << HALF_BITNESS)
+ | (s.accumulator32 >>> HALF_BITNESS);
+ }
+ s.bitOffset -= HALF_BITNESS;
+ }
+
+ static int peekBits(State s) {
+ if (BITNESS == 64) {
+ return (int) (s.accumulator64 >>> s.bitOffset);
+ } else {
+ return s.accumulator32 >>> s.bitOffset;
+ }
+ }
+
+ /**
+ * Fetches bits from accumulator.
+ *
+ * WARNING: accumulator MUST contain at least the specified amount of bits,
+ * otherwise BitReader will become broken.
+ */
+ static int readFewBits(State s, int n) {
+ int val = peekBits(s) & ((1 << n) - 1);
+ s.bitOffset += n;
+ return val;
+ }
+
+ static int readBits(State s, int n) {
+ if (HALF_BITNESS >= 24) {
+ return readFewBits(s, n);
+ } else {
+ return (n <= 16) ? readFewBits(s, n) : readManyBits(s, n);
+ }
+ }
+
+ private static int readManyBits(State s, int n) {
+ int low = readFewBits(s, 16);
+ doFillBitWindow(s);
+ return low | (readFewBits(s, n - 16) << 16);
+ }
+
+ static void initBitReader(State s) {
+ s.byteBuffer = new byte[BUFFER_SIZE];
+ if (BITNESS == 64) {
+ s.accumulator64 = 0;
+ s.intBuffer = new int[HALF_BUFFER_SIZE];
+ } else {
+ s.accumulator32 = 0;
+ s.shortBuffer = new short[HALF_BUFFER_SIZE];
+ }
+ s.bitOffset = BITNESS;
+ s.halfOffset = HALVES_CAPACITY;
+ s.endOfStreamReached = 0;
+ prepare(s);
+ }
+
+ private static void prepare(State s) {
+ readMoreInput(s);
+ checkHealth(s, 0);
+ doFillBitWindow(s);
+ doFillBitWindow(s);
+ }
+
+ static void reload(State s) {
+ if (s.bitOffset == BITNESS) {
+ prepare(s);
+ }
+ }
+
+ static void jumpToByteBoundary(State s) {
+ int padding = (BITNESS - s.bitOffset) & 7;
+ if (padding != 0) {
+ int paddingBits = readFewBits(s, padding);
+ if (paddingBits != 0) {
+ throw new BrotliRuntimeException("Corrupted padding bits");
+ }
+ }
+ }
+
+ static int halfAvailable(State s) {
+ int limit = HALVES_CAPACITY;
+ if (s.endOfStreamReached != 0) {
+ limit = (s.tailBytes + (HALF_SIZE - 1)) >> LOG_HALF_SIZE;
+ }
+ return limit - s.halfOffset;
+ }
+
+ static void copyBytes(State s, byte[] data, int offset, int length) {
+ if ((s.bitOffset & 7) != 0) {
+ throw new BrotliRuntimeException("Unaligned copyBytes");
+ }
+
+ // Drain accumulator.
+ while ((s.bitOffset != BITNESS) && (length != 0)) {
+ data[offset++] = (byte) peekBits(s);
+ s.bitOffset += 8;
+ length--;
+ }
+ if (length == 0) {
+ return;
+ }
+
+ // Get data from shadow buffer with "sizeof(int)" granularity.
+ int copyNibbles = Math.min(halfAvailable(s), length >> LOG_HALF_SIZE);
+ if (copyNibbles > 0) {
+ int readOffset = s.halfOffset << LOG_HALF_SIZE;
+ int delta = copyNibbles << LOG_HALF_SIZE;
+ System.arraycopy(s.byteBuffer, readOffset, data, offset, delta);
+ offset += delta;
+ length -= delta;
+ s.halfOffset += copyNibbles;
+ }
+ if (length == 0) {
+ return;
+ }
+
+ // Read tail bytes.
+ if (halfAvailable(s) > 0) {
+ // length = 1..3
+ fillBitWindow(s);
+ while (length != 0) {
+ data[offset++] = (byte) peekBits(s);
+ s.bitOffset += 8;
+ length--;
+ }
+ checkHealth(s, 0);
+ return;
+ }
+
+ // Now it is possible to copy bytes directly.
+ while (length > 0) {
+ int len = Utils.readInput(s.input, data, offset, length);
+ if (len == -1) {
+ throw new BrotliRuntimeException("Unexpected end of input");
+ }
+ offset += len;
+ length -= len;
+ }
+ }
+
+ /**
+ * Translates bytes to halves (int/short).
+ */
+ static void bytesToNibbles(State s, int byteLen) {
+ byte[] byteBuffer = s.byteBuffer;
+ int halfLen = byteLen >> LOG_HALF_SIZE;
+ if (BITNESS == 64) {
+ int[] intBuffer = s.intBuffer;
+ for (int i = 0; i < halfLen; ++i) {
+ intBuffer[i] = ((byteBuffer[i * 4] & 0xFF))
+ | ((byteBuffer[(i * 4) + 1] & 0xFF) << 8)
+ | ((byteBuffer[(i * 4) + 2] & 0xFF) << 16)
+ | ((byteBuffer[(i * 4) + 3] & 0xFF) << 24);
+ }
+ } else {
+ short[] shortBuffer = s.shortBuffer;
+ for (int i = 0; i < halfLen; ++i) {
+ shortBuffer[i] = (short) ((byteBuffer[i * 2] & 0xFF)
+ | ((byteBuffer[(i * 2) + 1] & 0xFF) << 8));
+ }
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BitReaderTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BitReaderTest.java
new file mode 100644
index 000000000..da59ebcea
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BitReaderTest.java
@@ -0,0 +1,54 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import static org.junit.Assert.fail;
+
+import java.io.ByteArrayInputStream;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Tests for {@link BitReader}.
+ */
+@RunWith(JUnit4.class)
+public class BitReaderTest {
+
+ @Test
+ public void testReadAfterEos() {
+ State reader = new State();
+ Decode.initState(reader, new ByteArrayInputStream(new byte[1]));
+ BitReader.readBits(reader, 9);
+ try {
+ BitReader.checkHealth(reader, 0);
+ } catch (BrotliRuntimeException ex) {
+ // This exception is expected.
+ return;
+ }
+ fail("BrotliRuntimeException should have been thrown by BitReader.checkHealth");
+ }
+
+ @Test
+ public void testAccumulatorUnderflowDetected() {
+ State reader = new State();
+ Decode.initState(reader, new ByteArrayInputStream(new byte[8]));
+ // 65 bits is enough for both 32 and 64 bit systems.
+ BitReader.readBits(reader, 13);
+ BitReader.readBits(reader, 13);
+ BitReader.readBits(reader, 13);
+ BitReader.readBits(reader, 13);
+ BitReader.readBits(reader, 13);
+ try {
+ BitReader.fillBitWindow(reader);
+ } catch (IllegalStateException ex) {
+ // This exception is expected.
+ return;
+ }
+ fail("IllegalStateException should have been thrown by 'broken' BitReader");
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BrotliInputStream.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BrotliInputStream.java
new file mode 100644
index 000000000..b99e40a26
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BrotliInputStream.java
@@ -0,0 +1,160 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * {@link InputStream} decorator that decompresses brotli data.
+ *
+ * <p> Not thread-safe.
+ */
+public class BrotliInputStream extends InputStream {
+
+ public static final int DEFAULT_INTERNAL_BUFFER_SIZE = 256;
+
+ /**
+ * Internal buffer used for efficient byte-by-byte reading.
+ */
+ private byte[] buffer;
+
+ /**
+ * Number of decoded but still unused bytes in internal buffer.
+ */
+ private int remainingBufferBytes;
+
+ /**
+ * Next unused byte offset.
+ */
+ private int bufferOffset;
+
+ /**
+ * Decoder state.
+ */
+ private final State state = new State();
+
+ /**
+ * Creates a {@link InputStream} wrapper that decompresses brotli data.
+ *
+ * <p> For byte-by-byte reading ({@link #read()}) internal buffer with
+ * {@link #DEFAULT_INTERNAL_BUFFER_SIZE} size is allocated and used.
+ *
+ * <p> Will block the thread until first {@link BitReader#CAPACITY} bytes of data of source
+ * are available.
+ *
+ * @param source underlying data source
+ * @throws IOException in case of corrupted data or source stream problems
+ */
+ public BrotliInputStream(InputStream source) throws IOException {
+ this(source, DEFAULT_INTERNAL_BUFFER_SIZE);
+ }
+
+ /**
+ * Creates a {@link InputStream} wrapper that decompresses brotli data.
+ *
+ * <p> For byte-by-byte reading ({@link #read()}) internal buffer of specified size is
+ * allocated and used.
+ *
+ * <p> Will block the thread until first {@link BitReader#CAPACITY} bytes of data of source
+ * are available.
+ *
+ * @param source compressed data source
+ * @param byteReadBufferSize size of internal buffer used in case of
+ * byte-by-byte reading
+ * @throws IOException in case of corrupted data or source stream problems
+ */
+ public BrotliInputStream(InputStream source, int byteReadBufferSize) throws IOException {
+ if (byteReadBufferSize <= 0) {
+ throw new IllegalArgumentException("Bad buffer size:" + byteReadBufferSize);
+ } else if (source == null) {
+ throw new IllegalArgumentException("source is null");
+ }
+ this.buffer = new byte[byteReadBufferSize];
+ this.remainingBufferBytes = 0;
+ this.bufferOffset = 0;
+ try {
+ Decode.initState(state, source);
+ } catch (BrotliRuntimeException ex) {
+ throw new IOException("Brotli decoder initialization failed", ex);
+ }
+ }
+
+ public void enableEagerOutput() {
+ Decode.enableEagerOutput(state);
+ }
+
+ public void enableLargeWindow() {
+ Decode.enableLargeWindow(state);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void close() throws IOException {
+ Decode.close(state);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int read() throws IOException {
+ if (bufferOffset >= remainingBufferBytes) {
+ remainingBufferBytes = read(buffer, 0, buffer.length);
+ bufferOffset = 0;
+ if (remainingBufferBytes == -1) {
+ return -1;
+ }
+ }
+ return buffer[bufferOffset++] & 0xFF;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int read(byte[] destBuffer, int destOffset, int destLen) throws IOException {
+ if (destOffset < 0) {
+ throw new IllegalArgumentException("Bad offset: " + destOffset);
+ } else if (destLen < 0) {
+ throw new IllegalArgumentException("Bad length: " + destLen);
+ } else if (destOffset + destLen > destBuffer.length) {
+ throw new IllegalArgumentException(
+ "Buffer overflow: " + (destOffset + destLen) + " > " + destBuffer.length);
+ } else if (destLen == 0) {
+ return 0;
+ }
+ int copyLen = Math.max(remainingBufferBytes - bufferOffset, 0);
+ if (copyLen != 0) {
+ copyLen = Math.min(copyLen, destLen);
+ System.arraycopy(buffer, bufferOffset, destBuffer, destOffset, copyLen);
+ bufferOffset += copyLen;
+ destOffset += copyLen;
+ destLen -= copyLen;
+ if (destLen == 0) {
+ return copyLen;
+ }
+ }
+ try {
+ state.output = destBuffer;
+ state.outputOffset = destOffset;
+ state.outputLength = destLen;
+ state.outputUsed = 0;
+ Decode.decompress(state);
+ if (state.outputUsed == 0) {
+ return -1;
+ }
+ return state.outputUsed + copyLen;
+ } catch (BrotliRuntimeException ex) {
+ throw new IOException("Brotli stream decoding failed", ex);
+ }
+
+ // <{[INJECTED CODE]}>
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BrotliRuntimeException.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BrotliRuntimeException.java
new file mode 100644
index 000000000..184490722
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/BrotliRuntimeException.java
@@ -0,0 +1,21 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+/**
+ * Unchecked exception used internally.
+ */
+class BrotliRuntimeException extends RuntimeException {
+
+ BrotliRuntimeException(String message) {
+ super(message);
+ }
+
+ BrotliRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Context.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Context.java
new file mode 100644
index 000000000..d9f3f91f2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Context.java
@@ -0,0 +1,58 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+/**
+ * Common context lookup table for all context modes.
+ */
+final class Context {
+
+ static final int[] LOOKUP = new int[2048];
+
+ private static final String UTF_MAP = " !! ! \"#$##%#$&'##(#)#+++++++++"
+ + "+((&*'##,---,---,-----,-----,-----&#'###.///.///./////./////./////&#'# ";
+ private static final String UTF_RLE = "A/* ': & : $ \u0081 @";
+
+ private static void unpackLookupTable(int[] lookup, String map, String rle) {
+ // LSB6, MSB6, SIGNED
+ for (int i = 0; i < 256; ++i) {
+ lookup[i] = i & 0x3F;
+ lookup[512 + i] = i >> 2;
+ lookup[1792 + i] = 2 + (i >> 6);
+ }
+ // UTF8
+ for (int i = 0; i < 128; ++i) {
+ lookup[1024 + i] = 4 * (map.charAt(i) - 32);
+ }
+ for (int i = 0; i < 64; ++i) {
+ lookup[1152 + i] = i & 1;
+ lookup[1216 + i] = 2 + (i & 1);
+ }
+ int offset = 1280;
+ for (int k = 0; k < 19; ++k) {
+ int value = k & 3;
+ int rep = rle.charAt(k) - 32;
+ for (int i = 0; i < rep; ++i) {
+ lookup[offset++] = value;
+ }
+ }
+ // SIGNED
+ for (int i = 0; i < 16; ++i) {
+ lookup[1792 + i] = 1;
+ lookup[2032 + i] = 6;
+ }
+ lookup[1792] = 0;
+ lookup[2047] = 7;
+ for (int i = 0; i < 256; ++i) {
+ lookup[1536 + i] = lookup[1792 + i] << 3;
+ }
+ }
+
+ static {
+ unpackLookupTable(LOOKUP, UTF_MAP, UTF_RLE);
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Decode.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Decode.java
new file mode 100644
index 000000000..560c635df
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Decode.java
@@ -0,0 +1,1251 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * API for Brotli decompression.
+ */
+final class Decode {
+
+ static final int MIN_LARGE_WINDOW_BITS = 10;
+ /* Maximum was chosen to be 30 to allow efficient decoder implementation.
+ * Format allows bigger window, but Java does not support 2G+ arrays. */
+ static final int MAX_LARGE_WINDOW_BITS = 30;
+
+ //----------------------------------------------------------------------------
+ // RunningState
+ //----------------------------------------------------------------------------
+ private static final int UNINITIALIZED = 0;
+ private static final int INITIALIZED = 1;
+ private static final int BLOCK_START = 2;
+ private static final int COMPRESSED_BLOCK_START = 3;
+ private static final int MAIN_LOOP = 4;
+ private static final int READ_METADATA = 5;
+ private static final int COPY_UNCOMPRESSED = 6;
+ private static final int INSERT_LOOP = 7;
+ private static final int COPY_LOOP = 8;
+ private static final int TRANSFORM = 9;
+ private static final int FINISHED = 10;
+ private static final int CLOSED = 11;
+ private static final int INIT_WRITE = 12;
+ private static final int WRITE = 13;
+
+ private static final int DEFAULT_CODE_LENGTH = 8;
+ private static final int CODE_LENGTH_REPEAT_CODE = 16;
+ private static final int NUM_LITERAL_CODES = 256;
+ private static final int NUM_COMMAND_CODES = 704;
+ private static final int NUM_BLOCK_LENGTH_CODES = 26;
+ private static final int LITERAL_CONTEXT_BITS = 6;
+ private static final int DISTANCE_CONTEXT_BITS = 2;
+
+ private static final int HUFFMAN_TABLE_BITS = 8;
+ private static final int HUFFMAN_TABLE_MASK = 0xFF;
+
+ /**
+ * Maximum possible Huffman table size for an alphabet size of (index * 32),
+ * max code length 15 and root table bits 8.
+ * The biggest alphabet is "command" - 704 symbols. Though "distance" alphabet could theoretically
+ * outreach that limit (for 62 extra bit distances), practically it is limited by
+ * MAX_ALLOWED_DISTANCE and never gets bigger than 544 symbols.
+ */
+ static final int[] MAX_HUFFMAN_TABLE_SIZE = {
+ 256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822,
+ 854, 886, 920, 952, 984, 1016, 1048, 1080
+ };
+
+ private static final int HUFFMAN_TABLE_SIZE_26 = 396;
+ private static final int HUFFMAN_TABLE_SIZE_258 = 632;
+
+ private static final int CODE_LENGTH_CODES = 18;
+ private static final int[] CODE_LENGTH_CODE_ORDER = {
+ 1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ };
+
+ private static final int NUM_DISTANCE_SHORT_CODES = 16;
+ private static final int[] DISTANCE_SHORT_CODE_INDEX_OFFSET = {
+ 0, 3, 2, 1, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3
+ };
+
+ private static final int[] DISTANCE_SHORT_CODE_VALUE_OFFSET = {
+ 0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3
+ };
+
+ /**
+ * Static Huffman code for the code length code lengths.
+ */
+ private static final int[] FIXED_TABLE = {
+ 0x020000, 0x020004, 0x020003, 0x030002, 0x020000, 0x020004, 0x020003, 0x040001,
+ 0x020000, 0x020004, 0x020003, 0x030002, 0x020000, 0x020004, 0x020003, 0x040005
+ };
+
+ static final int[] DICTIONARY_OFFSETS_BY_LENGTH = {
+ 0, 0, 0, 0, 0, 4096, 9216, 21504, 35840, 44032, 53248, 63488, 74752, 87040, 93696, 100864,
+ 104704, 106752, 108928, 113536, 115968, 118528, 119872, 121280, 122016
+ };
+
+ static final int[] DICTIONARY_SIZE_BITS_BY_LENGTH = {
+ 0, 0, 0, 0, 10, 10, 11, 11, 10, 10, 10, 10, 10, 9, 9, 8, 7, 7, 8, 7, 7, 6, 6, 5, 5
+ };
+
+ static final int MIN_WORD_LENGTH = 4;
+
+ static final int MAX_WORD_LENGTH = 24;
+
+ static final int MAX_TRANSFORMED_WORD_LENGTH = 5 + MAX_WORD_LENGTH + 8;
+
+ private static final int MAX_DISTANCE_BITS = 24;
+ private static final int MAX_LARGE_WINDOW_DISTANCE_BITS = 62;
+
+ /**
+ * Safe distance limit.
+ *
+ * Limit ((1 << 31) - 4) allows safe distance calculation without overflows,
+ * given the distance alphabet size is limited to corresponding size.
+ */
+ private static final int MAX_ALLOWED_DISTANCE = 0x7FFFFFFC;
+
+ //----------------------------------------------------------------------------
+ // Prefix code LUT.
+ //----------------------------------------------------------------------------
+ static final int[] BLOCK_LENGTH_OFFSET = {
+ 1, 5, 9, 13, 17, 25, 33, 41, 49, 65, 81, 97, 113, 145, 177, 209, 241, 305, 369, 497,
+ 753, 1265, 2289, 4337, 8433, 16625
+ };
+
+ static final int[] BLOCK_LENGTH_N_BITS = {
+ 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 24
+ };
+
+ static final short[] INSERT_LENGTH_N_BITS = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03,
+ 0x04, 0x04, 0x05, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0C, 0x0E, 0x18
+ };
+
+ static final short[] COPY_LENGTH_N_BITS = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02,
+ 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x18
+ };
+
+ // Each command is represented with 4x16-bit values:
+ // * [insertLenExtraBits, copyLenExtraBits]
+ // * insertLenOffset
+ // * copyLenOffset
+ // * distanceContext
+ static final short[] CMD_LOOKUP = new short[NUM_COMMAND_CODES * 4];
+
+ static {
+ unpackCommandLookupTable(CMD_LOOKUP);
+ }
+
+ private static int log2floor(int i) {
+ int result = -1;
+ int step = 16;
+ while (step > 0) {
+ if ((i >>> step) != 0) {
+ result += step;
+ i = i >>> step;
+ }
+ step = step >> 1;
+ }
+ return result + i;
+ }
+
+ private static int calculateDistanceAlphabetSize(int npostfix, int ndirect, int maxndistbits) {
+ return NUM_DISTANCE_SHORT_CODES + ndirect + 2 * (maxndistbits << npostfix);
+ }
+
+ // TODO: add a correctness test for this function when
+ // large-window and dictionary are implemented.
+ private static int calculateDistanceAlphabetLimit(int maxDistance, int npostfix, int ndirect) {
+ if (maxDistance < ndirect + (2 << npostfix)) {
+ throw new IllegalArgumentException("maxDistance is too small");
+ }
+ int offset = ((maxDistance - ndirect) >> npostfix) + 4;
+ int ndistbits = log2floor(offset) - 1;
+ int group = ((ndistbits - 1) << 1) | ((offset >> ndistbits) & 1);
+ return ((group - 1) << npostfix) + (1 << npostfix) + ndirect + NUM_DISTANCE_SHORT_CODES;
+ }
+
+ private static void unpackCommandLookupTable(short[] cmdLookup) {
+ short[] insertLengthOffsets = new short[24];
+ short[] copyLengthOffsets = new short[24];
+ copyLengthOffsets[0] = 2;
+ for (int i = 0; i < 23; ++i) {
+ insertLengthOffsets[i + 1] =
+ (short) (insertLengthOffsets[i] + (1 << INSERT_LENGTH_N_BITS[i]));
+ copyLengthOffsets[i + 1] =
+ (short) (copyLengthOffsets[i] + (1 << COPY_LENGTH_N_BITS[i]));
+ }
+
+ for (int cmdCode = 0; cmdCode < NUM_COMMAND_CODES; ++cmdCode) {
+ int rangeIdx = cmdCode >>> 6;
+ /* -4 turns any regular distance code to negative. */
+ int distanceContextOffset = -4;
+ if (rangeIdx >= 2) {
+ rangeIdx -= 2;
+ distanceContextOffset = 0;
+ }
+ int insertCode = (((0x29850 >>> (rangeIdx * 2)) & 0x3) << 3) | ((cmdCode >>> 3) & 7);
+ int copyCode = (((0x26244 >>> (rangeIdx * 2)) & 0x3) << 3) | (cmdCode & 7);
+ short copyLengthOffset = copyLengthOffsets[copyCode];
+ int distanceContext =
+ distanceContextOffset + (copyLengthOffset > 4 ? 3 : copyLengthOffset - 2);
+ int index = cmdCode * 4;
+ cmdLookup[index + 0] =
+ (short) (INSERT_LENGTH_N_BITS[insertCode] | (COPY_LENGTH_N_BITS[copyCode] << 8));
+ cmdLookup[index + 1] = insertLengthOffsets[insertCode];
+ cmdLookup[index + 2] = copyLengthOffsets[copyCode];
+ cmdLookup[index + 3] = (short) distanceContext;
+ }
+ }
+
+ /**
+ * Reads brotli stream header and parses "window bits".
+ *
+ * @param s initialized state, before any read is performed.
+ * @return -1 if header is invalid
+ */
+ private static int decodeWindowBits(State s) {
+ /* Change the meaning of flag. Before that step it means "decoder must be capable of reading
+ * "large-window" brotli stream. After this step it means that "large-window" feature
+ * is actually detected. Despite the window size could be same as before (lgwin = 10..24),
+ * encoded distances are allowed to be much greater, thus bigger dictinary could be used. */
+ int largeWindowEnabled = s.isLargeWindow;
+ s.isLargeWindow = 0;
+
+ BitReader.fillBitWindow(s);
+ if (BitReader.readFewBits(s, 1) == 0) {
+ return 16;
+ }
+ int n = BitReader.readFewBits(s, 3);
+ if (n != 0) {
+ return 17 + n;
+ }
+ n = BitReader.readFewBits(s, 3);
+ if (n != 0) {
+ if (n == 1) {
+ if (largeWindowEnabled == 0) {
+ /* Reserved value in regular brotli stream. */
+ return -1;
+ }
+ s.isLargeWindow = 1;
+ /* Check "reserved" bit for future (post-large-window) extensions. */
+ if (BitReader.readFewBits(s, 1) == 1) {
+ return -1;
+ }
+ n = BitReader.readFewBits(s, 6);
+ if (n < MIN_LARGE_WINDOW_BITS || n > MAX_LARGE_WINDOW_BITS) {
+ /* Encoded window bits value is too small or too big. */
+ return -1;
+ }
+ return n;
+ } else {
+ return 8 + n;
+ }
+ }
+ return 17;
+ }
+
+ /**
+ * Switch decoder to "eager" mode.
+ *
+ * In "eager" mode decoder returns as soon as there is enough data to fill output buffer.
+ *
+ * @param s initialized state, before any read is performed.
+ */
+ static void enableEagerOutput(State s) {
+ if (s.runningState != INITIALIZED) {
+ throw new IllegalStateException("State MUST be freshly initialized");
+ }
+ s.isEager = 1;
+ }
+
+ static void enableLargeWindow(State s) {
+ if (s.runningState != INITIALIZED) {
+ throw new IllegalStateException("State MUST be freshly initialized");
+ }
+ s.isLargeWindow = 1;
+ }
+
+ /**
+ * Associate input with decoder state.
+ *
+ * @param s uninitialized state without associated input
+ * @param input compressed data source
+ */
+ static void initState(State s, InputStream input) {
+ if (s.runningState != UNINITIALIZED) {
+ throw new IllegalStateException("State MUST be uninitialized");
+ }
+ /* 6 trees + 1 extra "offset" slot to simplify table decoding logic. */
+ s.blockTrees = new int[7 + 3 * (HUFFMAN_TABLE_SIZE_258 + HUFFMAN_TABLE_SIZE_26)];
+ s.blockTrees[0] = 7;
+ s.distRbIdx = 3;
+ int maxDistanceAlphabetLimit = calculateDistanceAlphabetLimit(MAX_ALLOWED_DISTANCE, 3, 15 << 3);
+ s.distExtraBits = new byte[maxDistanceAlphabetLimit];
+ s.distOffset = new int[maxDistanceAlphabetLimit];
+ s.input = input;
+ BitReader.initBitReader(s);
+ s.runningState = INITIALIZED;
+ }
+
+ static void close(State s) throws IOException {
+ if (s.runningState == UNINITIALIZED) {
+ throw new IllegalStateException("State MUST be initialized");
+ }
+ if (s.runningState == CLOSED) {
+ return;
+ }
+ s.runningState = CLOSED;
+ if (s.input != null) {
+ Utils.closeInput(s.input);
+ s.input = null;
+ }
+ }
+
+ /**
+ * Decodes a number in the range [0..255], by reading 1 - 11 bits.
+ */
+ private static int decodeVarLenUnsignedByte(State s) {
+ BitReader.fillBitWindow(s);
+ if (BitReader.readFewBits(s, 1) != 0) {
+ int n = BitReader.readFewBits(s, 3);
+ if (n == 0) {
+ return 1;
+ } else {
+ return BitReader.readFewBits(s, n) + (1 << n);
+ }
+ }
+ return 0;
+ }
+
+ private static void decodeMetaBlockLength(State s) {
+ BitReader.fillBitWindow(s);
+ s.inputEnd = BitReader.readFewBits(s, 1);
+ s.metaBlockLength = 0;
+ s.isUncompressed = 0;
+ s.isMetadata = 0;
+ if ((s.inputEnd != 0) && BitReader.readFewBits(s, 1) != 0) {
+ return;
+ }
+ int sizeNibbles = BitReader.readFewBits(s, 2) + 4;
+ if (sizeNibbles == 7) {
+ s.isMetadata = 1;
+ if (BitReader.readFewBits(s, 1) != 0) {
+ throw new BrotliRuntimeException("Corrupted reserved bit");
+ }
+ int sizeBytes = BitReader.readFewBits(s, 2);
+ if (sizeBytes == 0) {
+ return;
+ }
+ for (int i = 0; i < sizeBytes; i++) {
+ BitReader.fillBitWindow(s);
+ int bits = BitReader.readFewBits(s, 8);
+ if (bits == 0 && i + 1 == sizeBytes && sizeBytes > 1) {
+ throw new BrotliRuntimeException("Exuberant nibble");
+ }
+ s.metaBlockLength |= bits << (i * 8);
+ }
+ } else {
+ for (int i = 0; i < sizeNibbles; i++) {
+ BitReader.fillBitWindow(s);
+ int bits = BitReader.readFewBits(s, 4);
+ if (bits == 0 && i + 1 == sizeNibbles && sizeNibbles > 4) {
+ throw new BrotliRuntimeException("Exuberant nibble");
+ }
+ s.metaBlockLength |= bits << (i * 4);
+ }
+ }
+ s.metaBlockLength++;
+ if (s.inputEnd == 0) {
+ s.isUncompressed = BitReader.readFewBits(s, 1);
+ }
+ }
+
+ /**
+ * Decodes the next Huffman code from bit-stream.
+ */
+ private static int readSymbol(int[] tableGroup, int tableIdx, State s) {
+ int offset = tableGroup[tableIdx];
+ int val = BitReader.peekBits(s);
+ offset += val & HUFFMAN_TABLE_MASK;
+ int bits = tableGroup[offset] >> 16;
+ int sym = tableGroup[offset] & 0xFFFF;
+ if (bits <= HUFFMAN_TABLE_BITS) {
+ s.bitOffset += bits;
+ return sym;
+ }
+ offset += sym;
+ int mask = (1 << bits) - 1;
+ offset += (val & mask) >>> HUFFMAN_TABLE_BITS;
+ s.bitOffset += ((tableGroup[offset] >> 16) + HUFFMAN_TABLE_BITS);
+ return tableGroup[offset] & 0xFFFF;
+ }
+
+ private static int readBlockLength(int[] tableGroup, int tableIdx, State s) {
+ BitReader.fillBitWindow(s);
+ int code = readSymbol(tableGroup, tableIdx, s);
+ int n = BLOCK_LENGTH_N_BITS[code];
+ BitReader.fillBitWindow(s);
+ return BLOCK_LENGTH_OFFSET[code] + BitReader.readBits(s, n);
+ }
+
+ private static void moveToFront(int[] v, int index) {
+ int value = v[index];
+ for (; index > 0; index--) {
+ v[index] = v[index - 1];
+ }
+ v[0] = value;
+ }
+
+ private static void inverseMoveToFrontTransform(byte[] v, int vLen) {
+ int[] mtf = new int[256];
+ for (int i = 0; i < 256; i++) {
+ mtf[i] = i;
+ }
+ for (int i = 0; i < vLen; i++) {
+ int index = v[i] & 0xFF;
+ v[i] = (byte) mtf[index];
+ if (index != 0) {
+ moveToFront(mtf, index);
+ }
+ }
+ }
+
+ private static void readHuffmanCodeLengths(
+ int[] codeLengthCodeLengths, int numSymbols, int[] codeLengths, State s) {
+ int symbol = 0;
+ int prevCodeLen = DEFAULT_CODE_LENGTH;
+ int repeat = 0;
+ int repeatCodeLen = 0;
+ int space = 32768;
+ int[] table = new int[32 + 1]; /* Speculative single entry table group. */
+ int tableIdx = table.length - 1;
+ Huffman.buildHuffmanTable(table, tableIdx, 5, codeLengthCodeLengths, CODE_LENGTH_CODES);
+
+ while (symbol < numSymbols && space > 0) {
+ BitReader.readMoreInput(s);
+ BitReader.fillBitWindow(s);
+ int p = BitReader.peekBits(s) & 31;
+ s.bitOffset += table[p] >> 16;
+ int codeLen = table[p] & 0xFFFF;
+ if (codeLen < CODE_LENGTH_REPEAT_CODE) {
+ repeat = 0;
+ codeLengths[symbol++] = codeLen;
+ if (codeLen != 0) {
+ prevCodeLen = codeLen;
+ space -= 32768 >> codeLen;
+ }
+ } else {
+ int extraBits = codeLen - 14;
+ int newLen = 0;
+ if (codeLen == CODE_LENGTH_REPEAT_CODE) {
+ newLen = prevCodeLen;
+ }
+ if (repeatCodeLen != newLen) {
+ repeat = 0;
+ repeatCodeLen = newLen;
+ }
+ int oldRepeat = repeat;
+ if (repeat > 0) {
+ repeat -= 2;
+ repeat <<= extraBits;
+ }
+ BitReader.fillBitWindow(s);
+ repeat += BitReader.readFewBits(s, extraBits) + 3;
+ int repeatDelta = repeat - oldRepeat;
+ if (symbol + repeatDelta > numSymbols) {
+ throw new BrotliRuntimeException("symbol + repeatDelta > numSymbols"); // COV_NF_LINE
+ }
+ for (int i = 0; i < repeatDelta; i++) {
+ codeLengths[symbol++] = repeatCodeLen;
+ }
+ if (repeatCodeLen != 0) {
+ space -= repeatDelta << (15 - repeatCodeLen);
+ }
+ }
+ }
+ if (space != 0) {
+ throw new BrotliRuntimeException("Unused space"); // COV_NF_LINE
+ }
+ // TODO: Pass max_symbol to Huffman table builder instead?
+ Utils.fillIntsWithZeroes(codeLengths, symbol, numSymbols);
+ }
+
+ private static void checkDupes(int[] symbols, int length) {
+ for (int i = 0; i < length - 1; ++i) {
+ for (int j = i + 1; j < length; ++j) {
+ if (symbols[i] == symbols[j]) {
+ throw new BrotliRuntimeException("Duplicate simple Huffman code symbol"); // COV_NF_LINE
+ }
+ }
+ }
+ }
+
+ /**
+ * Reads up to 4 symbols directly and applies predefined histograms.
+ */
+ private static int readSimpleHuffmanCode(int alphabetSizeMax, int alphabetSizeLimit,
+ int[] tableGroup, int tableIdx, State s) {
+ // TODO: Avoid allocation?
+ int[] codeLengths = new int[alphabetSizeLimit];
+ int[] symbols = new int[4];
+
+ int maxBits = 1 + log2floor(alphabetSizeMax - 1);
+
+ int numSymbols = BitReader.readFewBits(s, 2) + 1;
+ for (int i = 0; i < numSymbols; i++) {
+ BitReader.fillBitWindow(s);
+ int symbol = BitReader.readFewBits(s, maxBits);
+ if (symbol >= alphabetSizeLimit) {
+ throw new BrotliRuntimeException("Can't readHuffmanCode"); // COV_NF_LINE
+ }
+ symbols[i] = symbol;
+ }
+ checkDupes(symbols, numSymbols);
+
+ int histogramId = numSymbols;
+ if (numSymbols == 4) {
+ histogramId += BitReader.readFewBits(s, 1);
+ }
+
+ switch (histogramId) {
+ case 1:
+ codeLengths[symbols[0]] = 1;
+ break;
+
+ case 2:
+ codeLengths[symbols[0]] = 1;
+ codeLengths[symbols[1]] = 1;
+ break;
+
+ case 3:
+ codeLengths[symbols[0]] = 1;
+ codeLengths[symbols[1]] = 2;
+ codeLengths[symbols[2]] = 2;
+ break;
+
+ case 4: // uniform 4-symbol histogram
+ codeLengths[symbols[0]] = 2;
+ codeLengths[symbols[1]] = 2;
+ codeLengths[symbols[2]] = 2;
+ codeLengths[symbols[3]] = 2;
+ break;
+
+ case 5: // prioritized 4-symbol histogram
+ codeLengths[symbols[0]] = 1;
+ codeLengths[symbols[1]] = 2;
+ codeLengths[symbols[2]] = 3;
+ codeLengths[symbols[3]] = 3;
+ break;
+
+ default:
+ break;
+ }
+
+ // TODO: Use specialized version?
+ return Huffman.buildHuffmanTable(
+ tableGroup, tableIdx, HUFFMAN_TABLE_BITS, codeLengths, alphabetSizeLimit);
+ }
+
+ // Decode Huffman-coded code lengths.
+ private static int readComplexHuffmanCode(int alphabetSizeLimit, int skip,
+ int[] tableGroup, int tableIdx, State s) {
+ // TODO: Avoid allocation?
+ int[] codeLengths = new int[alphabetSizeLimit];
+ int[] codeLengthCodeLengths = new int[CODE_LENGTH_CODES];
+ int space = 32;
+ int numCodes = 0;
+ for (int i = skip; i < CODE_LENGTH_CODES && space > 0; i++) {
+ int codeLenIdx = CODE_LENGTH_CODE_ORDER[i];
+ BitReader.fillBitWindow(s);
+ int p = BitReader.peekBits(s) & 15;
+ // TODO: Demultiplex FIXED_TABLE.
+ s.bitOffset += FIXED_TABLE[p] >> 16;
+ int v = FIXED_TABLE[p] & 0xFFFF;
+ codeLengthCodeLengths[codeLenIdx] = v;
+ if (v != 0) {
+ space -= (32 >> v);
+ numCodes++;
+ }
+ }
+ if (space != 0 && numCodes != 1) {
+ throw new BrotliRuntimeException("Corrupted Huffman code histogram"); // COV_NF_LINE
+ }
+
+ readHuffmanCodeLengths(codeLengthCodeLengths, alphabetSizeLimit, codeLengths, s);
+
+ return Huffman.buildHuffmanTable(
+ tableGroup, tableIdx, HUFFMAN_TABLE_BITS, codeLengths, alphabetSizeLimit);
+ }
+
+ /**
+ * Decodes Huffman table from bit-stream.
+ *
+ * @return number of slots used by resulting Huffman table
+ */
+ private static int readHuffmanCode(int alphabetSizeMax, int alphabetSizeLimit,
+ int[] tableGroup, int tableIdx, State s) {
+ BitReader.readMoreInput(s);
+ BitReader.fillBitWindow(s);
+ int simpleCodeOrSkip = BitReader.readFewBits(s, 2);
+ if (simpleCodeOrSkip == 1) {
+ return readSimpleHuffmanCode(alphabetSizeMax, alphabetSizeLimit, tableGroup, tableIdx, s);
+ } else {
+ return readComplexHuffmanCode(alphabetSizeLimit, simpleCodeOrSkip, tableGroup, tableIdx, s);
+ }
+ }
+
+ private static int decodeContextMap(int contextMapSize, byte[] contextMap, State s) {
+ BitReader.readMoreInput(s);
+ int numTrees = decodeVarLenUnsignedByte(s) + 1;
+
+ if (numTrees == 1) {
+ Utils.fillBytesWithZeroes(contextMap, 0, contextMapSize);
+ return numTrees;
+ }
+
+ BitReader.fillBitWindow(s);
+ int useRleForZeros = BitReader.readFewBits(s, 1);
+ int maxRunLengthPrefix = 0;
+ if (useRleForZeros != 0) {
+ maxRunLengthPrefix = BitReader.readFewBits(s, 4) + 1;
+ }
+ int alphabetSize = numTrees + maxRunLengthPrefix;
+ int tableSize = MAX_HUFFMAN_TABLE_SIZE[(alphabetSize + 31) >> 5];
+ /* Speculative single entry table group. */
+ int[] table = new int[tableSize + 1];
+ int tableIdx = table.length - 1;
+ readHuffmanCode(alphabetSize, alphabetSize, table, tableIdx, s);
+ for (int i = 0; i < contextMapSize; ) {
+ BitReader.readMoreInput(s);
+ BitReader.fillBitWindow(s);
+ int code = readSymbol(table, tableIdx, s);
+ if (code == 0) {
+ contextMap[i] = 0;
+ i++;
+ } else if (code <= maxRunLengthPrefix) {
+ BitReader.fillBitWindow(s);
+ int reps = (1 << code) + BitReader.readFewBits(s, code);
+ while (reps != 0) {
+ if (i >= contextMapSize) {
+ throw new BrotliRuntimeException("Corrupted context map"); // COV_NF_LINE
+ }
+ contextMap[i] = 0;
+ i++;
+ reps--;
+ }
+ } else {
+ contextMap[i] = (byte) (code - maxRunLengthPrefix);
+ i++;
+ }
+ }
+ BitReader.fillBitWindow(s);
+ if (BitReader.readFewBits(s, 1) == 1) {
+ inverseMoveToFrontTransform(contextMap, contextMapSize);
+ }
+ return numTrees;
+ }
+
+ private static int decodeBlockTypeAndLength(State s, int treeType, int numBlockTypes) {
+ final int[] ringBuffers = s.rings;
+ final int offset = 4 + treeType * 2;
+ BitReader.fillBitWindow(s);
+ int blockType = readSymbol(s.blockTrees, 2 * treeType, s);
+ int result = readBlockLength(s.blockTrees, 2 * treeType + 1, s);
+
+ if (blockType == 1) {
+ blockType = ringBuffers[offset + 1] + 1;
+ } else if (blockType == 0) {
+ blockType = ringBuffers[offset];
+ } else {
+ blockType -= 2;
+ }
+ if (blockType >= numBlockTypes) {
+ blockType -= numBlockTypes;
+ }
+ ringBuffers[offset] = ringBuffers[offset + 1];
+ ringBuffers[offset + 1] = blockType;
+ return result;
+ }
+
+ private static void decodeLiteralBlockSwitch(State s) {
+ s.literalBlockLength = decodeBlockTypeAndLength(s, 0, s.numLiteralBlockTypes);
+ int literalBlockType = s.rings[5];
+ s.contextMapSlice = literalBlockType << LITERAL_CONTEXT_BITS;
+ s.literalTreeIdx = s.contextMap[s.contextMapSlice] & 0xFF;
+ int contextMode = s.contextModes[literalBlockType];
+ s.contextLookupOffset1 = contextMode << 9;
+ s.contextLookupOffset2 = s.contextLookupOffset1 + 256;
+ }
+
+ private static void decodeCommandBlockSwitch(State s) {
+ s.commandBlockLength = decodeBlockTypeAndLength(s, 1, s.numCommandBlockTypes);
+ s.commandTreeIdx = s.rings[7];
+ }
+
+ private static void decodeDistanceBlockSwitch(State s) {
+ s.distanceBlockLength = decodeBlockTypeAndLength(s, 2, s.numDistanceBlockTypes);
+ s.distContextMapSlice = s.rings[9] << DISTANCE_CONTEXT_BITS;
+ }
+
+ private static void maybeReallocateRingBuffer(State s) {
+ int newSize = s.maxRingBufferSize;
+ if (newSize > s.expectedTotalSize) {
+ /* TODO: Handle 2GB+ cases more gracefully. */
+ int minimalNewSize = s.expectedTotalSize;
+ while ((newSize >> 1) > minimalNewSize) {
+ newSize >>= 1;
+ }
+ if ((s.inputEnd == 0) && newSize < 16384 && s.maxRingBufferSize >= 16384) {
+ newSize = 16384;
+ }
+ }
+ if (newSize <= s.ringBufferSize) {
+ return;
+ }
+ int ringBufferSizeWithSlack = newSize + MAX_TRANSFORMED_WORD_LENGTH;
+ byte[] newBuffer = new byte[ringBufferSizeWithSlack];
+ if (s.ringBuffer.length != 0) {
+ System.arraycopy(s.ringBuffer, 0, newBuffer, 0, s.ringBufferSize);
+ }
+ s.ringBuffer = newBuffer;
+ s.ringBufferSize = newSize;
+ }
+
+ private static void readNextMetablockHeader(State s) {
+ if (s.inputEnd != 0) {
+ s.nextRunningState = FINISHED;
+ s.runningState = INIT_WRITE;
+ return;
+ }
+ // TODO: Reset? Do we need this?
+ s.literalTreeGroup = new int[0];
+ s.commandTreeGroup = new int[0];
+ s.distanceTreeGroup = new int[0];
+
+ BitReader.readMoreInput(s);
+ decodeMetaBlockLength(s);
+ if ((s.metaBlockLength == 0) && (s.isMetadata == 0)) {
+ return;
+ }
+ if ((s.isUncompressed != 0) || (s.isMetadata != 0)) {
+ BitReader.jumpToByteBoundary(s);
+ s.runningState = (s.isMetadata != 0) ? READ_METADATA : COPY_UNCOMPRESSED;
+ } else {
+ s.runningState = COMPRESSED_BLOCK_START;
+ }
+
+ if (s.isMetadata != 0) {
+ return;
+ }
+ s.expectedTotalSize += s.metaBlockLength;
+ if (s.expectedTotalSize > 1 << 30) {
+ s.expectedTotalSize = 1 << 30;
+ }
+ if (s.ringBufferSize < s.maxRingBufferSize) {
+ maybeReallocateRingBuffer(s);
+ }
+ }
+
+ private static int readMetablockPartition(State s, int treeType, int numBlockTypes) {
+ int offset = s.blockTrees[2 * treeType];
+ if (numBlockTypes <= 1) {
+ s.blockTrees[2 * treeType + 1] = offset;
+ s.blockTrees[2 * treeType + 2] = offset;
+ return 1 << 28;
+ }
+
+ int blockTypeAlphabetSize = numBlockTypes + 2;
+ offset += readHuffmanCode(
+ blockTypeAlphabetSize, blockTypeAlphabetSize, s.blockTrees, 2 * treeType, s);
+ s.blockTrees[2 * treeType + 1] = offset;
+
+ int blockLengthAlphabetSize = NUM_BLOCK_LENGTH_CODES;
+ offset += readHuffmanCode(
+ blockLengthAlphabetSize, blockLengthAlphabetSize, s.blockTrees, 2 * treeType + 1, s);
+ s.blockTrees[2 * treeType + 2] = offset;
+
+ return readBlockLength(s.blockTrees, 2 * treeType + 1, s);
+ }
+
+ private static void calculateDistanceLut(State s, int alphabetSizeLimit) {
+ byte[] distExtraBits = s.distExtraBits;
+ int[] distOffset = s.distOffset;
+ int npostfix = s.distancePostfixBits;
+ int ndirect = s.numDirectDistanceCodes;
+ int postfix = 1 << npostfix;
+ int bits = 1;
+ int half = 0;
+
+ /* Skip short codes. */
+ int i = NUM_DISTANCE_SHORT_CODES;
+
+ /* Fill direct codes. */
+ for (int j = 0; j < ndirect; ++j) {
+ distExtraBits[i] = 0;
+ distOffset[i] = j + 1;
+ ++i;
+ }
+
+ /* Fill regular distance codes. */
+ while (i < alphabetSizeLimit) {
+ int base = ndirect + ((((2 + half) << bits) - 4) << npostfix) + 1;
+ /* Always fill the complete group. */
+ for (int j = 0; j < postfix; ++j) {
+ distExtraBits[i] = (byte) bits;
+ distOffset[i] = base + j;
+ ++i;
+ }
+ bits = bits + half;
+ half = half ^ 1;
+ }
+ }
+
+ private static void readMetablockHuffmanCodesAndContextMaps(State s) {
+ s.numLiteralBlockTypes = decodeVarLenUnsignedByte(s) + 1;
+ s.literalBlockLength = readMetablockPartition(s, 0, s.numLiteralBlockTypes);
+ s.numCommandBlockTypes = decodeVarLenUnsignedByte(s) + 1;
+ s.commandBlockLength = readMetablockPartition(s, 1, s.numCommandBlockTypes);
+ s.numDistanceBlockTypes = decodeVarLenUnsignedByte(s) + 1;
+ s.distanceBlockLength = readMetablockPartition(s, 2, s.numDistanceBlockTypes);
+
+ BitReader.readMoreInput(s);
+ BitReader.fillBitWindow(s);
+ s.distancePostfixBits = BitReader.readFewBits(s, 2);
+ s.numDirectDistanceCodes = BitReader.readFewBits(s, 4) << s.distancePostfixBits;
+ s.distancePostfixMask = (1 << s.distancePostfixBits) - 1;
+ // TODO: Reuse?
+ s.contextModes = new byte[s.numLiteralBlockTypes];
+ for (int i = 0; i < s.numLiteralBlockTypes;) {
+ /* Ensure that less than 256 bits read between readMoreInput. */
+ int limit = Math.min(i + 96, s.numLiteralBlockTypes);
+ for (; i < limit; ++i) {
+ BitReader.fillBitWindow(s);
+ s.contextModes[i] = (byte) BitReader.readFewBits(s, 2);
+ }
+ BitReader.readMoreInput(s);
+ }
+
+ // TODO: Reuse?
+ s.contextMap = new byte[s.numLiteralBlockTypes << LITERAL_CONTEXT_BITS];
+ int numLiteralTrees = decodeContextMap(s.numLiteralBlockTypes << LITERAL_CONTEXT_BITS,
+ s.contextMap, s);
+ s.trivialLiteralContext = 1;
+ for (int j = 0; j < s.numLiteralBlockTypes << LITERAL_CONTEXT_BITS; j++) {
+ if (s.contextMap[j] != j >> LITERAL_CONTEXT_BITS) {
+ s.trivialLiteralContext = 0;
+ break;
+ }
+ }
+
+ // TODO: Reuse?
+ s.distContextMap = new byte[s.numDistanceBlockTypes << DISTANCE_CONTEXT_BITS];
+ int numDistTrees = decodeContextMap(s.numDistanceBlockTypes << DISTANCE_CONTEXT_BITS,
+ s.distContextMap, s);
+
+ s.literalTreeGroup = decodeHuffmanTreeGroup(NUM_LITERAL_CODES, NUM_LITERAL_CODES,
+ numLiteralTrees, s);
+ s.commandTreeGroup = decodeHuffmanTreeGroup(NUM_COMMAND_CODES, NUM_COMMAND_CODES,
+ s.numCommandBlockTypes, s);
+ int distanceAlphabetSizeMax = calculateDistanceAlphabetSize(
+ s.distancePostfixBits, s.numDirectDistanceCodes, MAX_DISTANCE_BITS);
+ int distanceAlphabetSizeLimit = distanceAlphabetSizeMax;
+ if (s.isLargeWindow == 1) {
+ distanceAlphabetSizeMax = calculateDistanceAlphabetSize(
+ s.distancePostfixBits, s.numDirectDistanceCodes, MAX_LARGE_WINDOW_DISTANCE_BITS);
+ distanceAlphabetSizeLimit = calculateDistanceAlphabetLimit(
+ MAX_ALLOWED_DISTANCE, s.distancePostfixBits, s.numDirectDistanceCodes);
+ }
+ s.distanceTreeGroup = decodeHuffmanTreeGroup(distanceAlphabetSizeMax, distanceAlphabetSizeLimit,
+ numDistTrees, s);
+ calculateDistanceLut(s, distanceAlphabetSizeLimit);
+
+ s.contextMapSlice = 0;
+ s.distContextMapSlice = 0;
+ s.contextLookupOffset1 = s.contextModes[0] * 512;
+ s.contextLookupOffset2 = s.contextLookupOffset1 + 256;
+ s.literalTreeIdx = 0;
+ s.commandTreeIdx = 0;
+
+ s.rings[4] = 1;
+ s.rings[5] = 0;
+ s.rings[6] = 1;
+ s.rings[7] = 0;
+ s.rings[8] = 1;
+ s.rings[9] = 0;
+ }
+
+ private static void copyUncompressedData(State s) {
+ final byte[] ringBuffer = s.ringBuffer;
+
+ // Could happen if block ends at ring buffer end.
+ if (s.metaBlockLength <= 0) {
+ BitReader.reload(s);
+ s.runningState = BLOCK_START;
+ return;
+ }
+
+ int chunkLength = Math.min(s.ringBufferSize - s.pos, s.metaBlockLength);
+ BitReader.copyBytes(s, ringBuffer, s.pos, chunkLength);
+ s.metaBlockLength -= chunkLength;
+ s.pos += chunkLength;
+ if (s.pos == s.ringBufferSize) {
+ s.nextRunningState = COPY_UNCOMPRESSED;
+ s.runningState = INIT_WRITE;
+ return;
+ }
+
+ BitReader.reload(s);
+ s.runningState = BLOCK_START;
+ }
+
+ private static int writeRingBuffer(State s) {
+ int toWrite = Math.min(s.outputLength - s.outputUsed,
+ s.ringBufferBytesReady - s.ringBufferBytesWritten);
+ if (toWrite != 0) {
+ System.arraycopy(s.ringBuffer, s.ringBufferBytesWritten, s.output,
+ s.outputOffset + s.outputUsed, toWrite);
+ s.outputUsed += toWrite;
+ s.ringBufferBytesWritten += toWrite;
+ }
+
+ if (s.outputUsed < s.outputLength) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ private static int[] decodeHuffmanTreeGroup(int alphabetSizeMax, int alphabetSizeLimit,
+ int n, State s) {
+ int maxTableSize = MAX_HUFFMAN_TABLE_SIZE[(alphabetSizeLimit + 31) >> 5];
+ int[] group = new int[n + n * maxTableSize];
+ int next = n;
+ for (int i = 0; i < n; ++i) {
+ group[i] = next;
+ next += readHuffmanCode(alphabetSizeMax, alphabetSizeLimit, group, i, s);
+ }
+ return group;
+ }
+
+ // Returns offset in ringBuffer that should trigger WRITE when filled.
+ private static int calculateFence(State s) {
+ int result = s.ringBufferSize;
+ if (s.isEager != 0) {
+ result = Math.min(result, s.ringBufferBytesWritten + s.outputLength - s.outputUsed);
+ }
+ return result;
+ }
+
+ /**
+ * Actual decompress implementation.
+ */
+ static void decompress(State s) {
+ if (s.runningState == UNINITIALIZED) {
+ throw new IllegalStateException("Can't decompress until initialized");
+ }
+ if (s.runningState == CLOSED) {
+ throw new IllegalStateException("Can't decompress after close");
+ }
+ if (s.runningState == INITIALIZED) {
+ int windowBits = decodeWindowBits(s);
+ if (windowBits == -1) { /* Reserved case for future expansion. */
+ throw new BrotliRuntimeException("Invalid 'windowBits' code");
+ }
+ s.maxRingBufferSize = 1 << windowBits;
+ s.maxBackwardDistance = s.maxRingBufferSize - 16;
+ s.runningState = BLOCK_START;
+ }
+
+ int fence = calculateFence(s);
+ int ringBufferMask = s.ringBufferSize - 1;
+ byte[] ringBuffer = s.ringBuffer;
+
+ while (s.runningState != FINISHED) {
+ // TODO: extract cases to methods for the better readability.
+ switch (s.runningState) {
+ case BLOCK_START:
+ if (s.metaBlockLength < 0) {
+ throw new BrotliRuntimeException("Invalid metablock length");
+ }
+ readNextMetablockHeader(s);
+ /* Ring-buffer would be reallocated here. */
+ fence = calculateFence(s);
+ ringBufferMask = s.ringBufferSize - 1;
+ ringBuffer = s.ringBuffer;
+ continue;
+
+ case COMPRESSED_BLOCK_START:
+ readMetablockHuffmanCodesAndContextMaps(s);
+ s.runningState = MAIN_LOOP;
+ // Fall through
+
+ case MAIN_LOOP:
+ if (s.metaBlockLength <= 0) {
+ s.runningState = BLOCK_START;
+ continue;
+ }
+ BitReader.readMoreInput(s);
+ if (s.commandBlockLength == 0) {
+ decodeCommandBlockSwitch(s);
+ }
+ s.commandBlockLength--;
+ BitReader.fillBitWindow(s);
+ int cmdCode = readSymbol(s.commandTreeGroup, s.commandTreeIdx, s) << 2;
+ short insertAndCopyExtraBits = CMD_LOOKUP[cmdCode];
+ int insertLengthOffset = CMD_LOOKUP[cmdCode + 1];
+ int copyLengthOffset = CMD_LOOKUP[cmdCode + 2];
+ s.distanceCode = CMD_LOOKUP[cmdCode + 3];
+ BitReader.fillBitWindow(s);
+ {
+ int extraBits = insertAndCopyExtraBits & 0xFF;
+ s.insertLength = insertLengthOffset + BitReader.readBits(s, extraBits);
+ }
+ BitReader.fillBitWindow(s);
+ {
+ int extraBits = insertAndCopyExtraBits >> 8;
+ s.copyLength = copyLengthOffset + BitReader.readBits(s, extraBits);
+ }
+
+ s.j = 0;
+ s.runningState = INSERT_LOOP;
+
+ // Fall through
+ case INSERT_LOOP:
+ if (s.trivialLiteralContext != 0) {
+ while (s.j < s.insertLength) {
+ BitReader.readMoreInput(s);
+ if (s.literalBlockLength == 0) {
+ decodeLiteralBlockSwitch(s);
+ }
+ s.literalBlockLength--;
+ BitReader.fillBitWindow(s);
+ ringBuffer[s.pos] = (byte) readSymbol(s.literalTreeGroup, s.literalTreeIdx, s);
+ s.pos++;
+ s.j++;
+ if (s.pos >= fence) {
+ s.nextRunningState = INSERT_LOOP;
+ s.runningState = INIT_WRITE;
+ break;
+ }
+ }
+ } else {
+ int prevByte1 = ringBuffer[(s.pos - 1) & ringBufferMask] & 0xFF;
+ int prevByte2 = ringBuffer[(s.pos - 2) & ringBufferMask] & 0xFF;
+ while (s.j < s.insertLength) {
+ BitReader.readMoreInput(s);
+ if (s.literalBlockLength == 0) {
+ decodeLiteralBlockSwitch(s);
+ }
+ int literalContext = Context.LOOKUP[s.contextLookupOffset1 + prevByte1]
+ | Context.LOOKUP[s.contextLookupOffset2 + prevByte2];
+ int literalTreeIdx = s.contextMap[s.contextMapSlice + literalContext] & 0xFF;
+ s.literalBlockLength--;
+ prevByte2 = prevByte1;
+ BitReader.fillBitWindow(s);
+ prevByte1 = readSymbol(s.literalTreeGroup, literalTreeIdx, s);
+ ringBuffer[s.pos] = (byte) prevByte1;
+ s.pos++;
+ s.j++;
+ if (s.pos >= fence) {
+ s.nextRunningState = INSERT_LOOP;
+ s.runningState = INIT_WRITE;
+ break;
+ }
+ }
+ }
+ if (s.runningState != INSERT_LOOP) {
+ continue;
+ }
+ s.metaBlockLength -= s.insertLength;
+ if (s.metaBlockLength <= 0) {
+ s.runningState = MAIN_LOOP;
+ continue;
+ }
+ int distanceCode = s.distanceCode;
+ if (distanceCode < 0) {
+ // distanceCode in untouched; assigning it 0 won't affect distance ring buffer rolling.
+ s.distance = s.rings[s.distRbIdx];
+ } else {
+ BitReader.readMoreInput(s);
+ if (s.distanceBlockLength == 0) {
+ decodeDistanceBlockSwitch(s);
+ }
+ s.distanceBlockLength--;
+ BitReader.fillBitWindow(s);
+ int distTreeIdx = s.distContextMap[s.distContextMapSlice + distanceCode] & 0xFF;
+ distanceCode = readSymbol(s.distanceTreeGroup, distTreeIdx, s);
+ if (distanceCode < NUM_DISTANCE_SHORT_CODES) {
+ int index = (s.distRbIdx + DISTANCE_SHORT_CODE_INDEX_OFFSET[distanceCode]) & 0x3;
+ s.distance = s.rings[index] + DISTANCE_SHORT_CODE_VALUE_OFFSET[distanceCode];
+ if (s.distance < 0) {
+ throw new BrotliRuntimeException("Negative distance"); // COV_NF_LINE
+ }
+ } else {
+ int extraBits = s.distExtraBits[distanceCode];
+ int bits;
+ if (s.bitOffset + extraBits <= BitReader.BITNESS) {
+ bits = BitReader.readFewBits(s, extraBits);
+ } else {
+ BitReader.fillBitWindow(s);
+ bits = BitReader.readBits(s, extraBits);
+ }
+ s.distance = s.distOffset[distanceCode] + (bits << s.distancePostfixBits);
+ }
+ }
+
+ if (s.maxDistance != s.maxBackwardDistance
+ && s.pos < s.maxBackwardDistance) {
+ s.maxDistance = s.pos;
+ } else {
+ s.maxDistance = s.maxBackwardDistance;
+ }
+
+ if (s.distance > s.maxDistance) {
+ s.runningState = TRANSFORM;
+ continue;
+ }
+
+ if (distanceCode > 0) {
+ s.distRbIdx = (s.distRbIdx + 1) & 0x3;
+ s.rings[s.distRbIdx] = s.distance;
+ }
+
+ if (s.copyLength > s.metaBlockLength) {
+ throw new BrotliRuntimeException("Invalid backward reference"); // COV_NF_LINE
+ }
+ s.j = 0;
+ s.runningState = COPY_LOOP;
+ // fall through
+ case COPY_LOOP:
+ int src = (s.pos - s.distance) & ringBufferMask;
+ int dst = s.pos;
+ int copyLength = s.copyLength - s.j;
+ int srcEnd = src + copyLength;
+ int dstEnd = dst + copyLength;
+ if ((srcEnd < ringBufferMask) && (dstEnd < ringBufferMask)) {
+ if (copyLength < 12 || (srcEnd > dst && dstEnd > src)) {
+ for (int k = 0; k < copyLength; k += 4) {
+ ringBuffer[dst++] = ringBuffer[src++];
+ ringBuffer[dst++] = ringBuffer[src++];
+ ringBuffer[dst++] = ringBuffer[src++];
+ ringBuffer[dst++] = ringBuffer[src++];
+ }
+ } else {
+ Utils.copyBytesWithin(ringBuffer, dst, src, srcEnd);
+ }
+ s.j += copyLength;
+ s.metaBlockLength -= copyLength;
+ s.pos += copyLength;
+ } else {
+ for (; s.j < s.copyLength;) {
+ ringBuffer[s.pos] =
+ ringBuffer[(s.pos - s.distance) & ringBufferMask];
+ s.metaBlockLength--;
+ s.pos++;
+ s.j++;
+ if (s.pos >= fence) {
+ s.nextRunningState = COPY_LOOP;
+ s.runningState = INIT_WRITE;
+ break;
+ }
+ }
+ }
+ if (s.runningState == COPY_LOOP) {
+ s.runningState = MAIN_LOOP;
+ }
+ continue;
+
+ case TRANSFORM:
+ // This check is done here to unburden the hot loop.
+ if (s.distance > MAX_ALLOWED_DISTANCE) {
+ throw new BrotliRuntimeException("Invalid backward reference"); // COV_NF_LINE
+ }
+ if (s.copyLength >= MIN_WORD_LENGTH
+ && s.copyLength <= MAX_WORD_LENGTH) {
+ int offset = DICTIONARY_OFFSETS_BY_LENGTH[s.copyLength];
+ int wordId = s.distance - s.maxDistance - 1;
+ int shift = DICTIONARY_SIZE_BITS_BY_LENGTH[s.copyLength];
+ int mask = (1 << shift) - 1;
+ int wordIdx = wordId & mask;
+ int transformIdx = wordId >>> shift;
+ offset += wordIdx * s.copyLength;
+ if (transformIdx < Transform.NUM_RFC_TRANSFORMS) {
+ int len = Transform.transformDictionaryWord(ringBuffer, s.pos, Dictionary.getData(),
+ offset, s.copyLength, Transform.RFC_TRANSFORMS, transformIdx);
+ s.pos += len;
+ s.metaBlockLength -= len;
+ if (s.pos >= fence) {
+ s.nextRunningState = MAIN_LOOP;
+ s.runningState = INIT_WRITE;
+ continue;
+ }
+ } else {
+ throw new BrotliRuntimeException("Invalid backward reference"); // COV_NF_LINE
+ }
+ } else {
+ throw new BrotliRuntimeException("Invalid backward reference"); // COV_NF_LINE
+ }
+ s.runningState = MAIN_LOOP;
+ continue;
+
+ case READ_METADATA:
+ while (s.metaBlockLength > 0) {
+ BitReader.readMoreInput(s);
+ // Optimize
+ BitReader.fillBitWindow(s);
+ BitReader.readFewBits(s, 8);
+ s.metaBlockLength--;
+ }
+ s.runningState = BLOCK_START;
+ continue;
+
+
+ case COPY_UNCOMPRESSED:
+ copyUncompressedData(s);
+ continue;
+
+ case INIT_WRITE:
+ s.ringBufferBytesReady = Math.min(s.pos, s.ringBufferSize);
+ s.runningState = WRITE;
+ // fall through
+ case WRITE:
+ if (writeRingBuffer(s) == 0) {
+ // Output buffer is full.
+ return;
+ }
+ if (s.pos >= s.maxBackwardDistance) {
+ s.maxDistance = s.maxBackwardDistance;
+ }
+ // Wrap the ringBuffer.
+ if (s.pos >= s.ringBufferSize) {
+ if (s.pos > s.ringBufferSize) {
+ Utils.copyBytesWithin(ringBuffer, 0, s.ringBufferSize, s.pos);
+ }
+ s.pos &= ringBufferMask;
+ s.ringBufferBytesWritten = 0;
+ }
+ s.runningState = s.nextRunningState;
+ continue;
+
+ default:
+ throw new BrotliRuntimeException("Unexpected state " + s.runningState);
+ }
+ }
+ if (s.runningState == FINISHED) {
+ if (s.metaBlockLength < 0) {
+ throw new BrotliRuntimeException("Invalid metablock length");
+ }
+ BitReader.jumpToByteBoundary(s);
+ BitReader.checkHealth(s, 1);
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/DecodeTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/DecodeTest.java
new file mode 100644
index 000000000..a0c2784b9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/DecodeTest.java
@@ -0,0 +1,160 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import static org.junit.Assert.assertArrayEquals;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Tests for {@link Decode}.
+ */
+@RunWith(JUnit4.class)
+public class DecodeTest {
+
+ static byte[] readUniBytes(String uniBytes) {
+ byte[] result = new byte[uniBytes.length()];
+ for (int i = 0; i < result.length; ++i) {
+ result[i] = (byte) uniBytes.charAt(i);
+ }
+ return result;
+ }
+
+ private byte[] decompress(byte[] data, boolean byByte) throws IOException {
+ byte[] buffer = new byte[65536];
+ ByteArrayInputStream input = new ByteArrayInputStream(data);
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ BrotliInputStream brotliInput = new BrotliInputStream(input);
+ if (byByte) {
+ byte[] oneByte = new byte[1];
+ while (true) {
+ int next = brotliInput.read();
+ if (next == -1) {
+ break;
+ }
+ oneByte[0] = (byte) next;
+ output.write(oneByte, 0, 1);
+ }
+ } else {
+ while (true) {
+ int len = brotliInput.read(buffer, 0, buffer.length);
+ if (len <= 0) {
+ break;
+ }
+ output.write(buffer, 0, len);
+ }
+ }
+ brotliInput.close();
+ return output.toByteArray();
+ }
+
+ private void checkDecodeResource(String expected, String compressed) throws IOException {
+ byte[] expectedBytes = readUniBytes(expected);
+ byte[] compressedBytes = readUniBytes(compressed);
+ byte[] actual = decompress(compressedBytes, false);
+ assertArrayEquals(expectedBytes, actual);
+ byte[] actualByByte = decompress(compressedBytes, true);
+ assertArrayEquals(expectedBytes, actualByByte);
+ }
+
+ @Test
+ public void testEmpty() throws IOException {
+ checkDecodeResource(
+ "",
+ "\u0006");
+ }
+
+ @Test
+ public void testX() throws IOException {
+ checkDecodeResource(
+ "X",
+ "\u000B\u0000\u0080X\u0003");
+ }
+
+ @Test
+ public void testX10Y10() throws IOException {
+ checkDecodeResource(
+ "XXXXXXXXXXYYYYYYYYYY",
+ "\u001B\u0013\u0000\u0000\u00A4\u00B0\u00B2\u00EA\u0081G\u0002\u008A");
+ }
+
+ @Test
+ public void testX64() throws IOException {
+ checkDecodeResource(
+ "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+ "\u001B\u003F\u0000\u0000$\u00B0\u00E2\u0099\u0080\u0012");
+ }
+
+ @Test
+ public void testUkkonooa() throws IOException {
+ checkDecodeResource(
+ "ukko nooa, ukko nooa oli kunnon mies, kun han meni saunaan, "
+ + "pisti laukun naulaan, ukko nooa, ukko nooa oli kunnon mies.",
+ "\u001Bv\u0000\u0000\u0014J\u00AC\u009Bz\u00BD\u00E1\u0097\u009D\u007F\u008E\u00C2\u0082"
+ + "6\u000E\u009C\u00E0\u0090\u0003\u00F7\u008B\u009E8\u00E6\u00B6\u0000\u00AB\u00C3\u00CA"
+ + "\u00A0\u00C2\u00DAf6\u00DC\u00CD\u0080\u008D.!\u00D7n\u00E3\u00EAL\u00B8\u00F0\u00D2"
+ + "\u00B8\u00C7\u00C2pM:\u00F0i~\u00A1\u00B8Es\u00AB\u00C4W\u001E");
+ }
+
+ @Test
+ public void testMonkey() throws IOException {
+ checkDecodeResource(
+ "znxcvnmz,xvnm.,zxcnv.,xcn.z,vn.zvn.zxcvn.,zxcn.vn.v,znm.,vnzx.,vnzxc.vn.z,vnz.,nv.z,nvmz"
+ + "xc,nvzxcvcnm.,vczxvnzxcnvmxc.zmcnvzm.,nvmc,nzxmc,vn.mnnmzxc,vnxcnmv,znvzxcnmv,.xcnvm,zxc"
+ + "nzxv.zx,qweryweurqioweupropqwutioweupqrioweutiopweuriopweuriopqwurioputiopqwuriowuqeriou"
+ + "pqweropuweropqwurweuqriopuropqwuriopuqwriopuqweopruioqweurqweuriouqweopruioupqiytioqtyio"
+ + "wtyqptypryoqweutioioqtweqruowqeytiowquiourowetyoqwupiotweuqiorweuqroipituqwiorqwtioweuri"
+ + "ouytuioerytuioweryuitoweytuiweyuityeruirtyuqriqweuropqweiruioqweurioqwuerioqwyuituierwot"
+ + "ueryuiotweyrtuiwertyioweryrueioqptyioruyiopqwtjkasdfhlafhlasdhfjklashjkfhasjklfhklasjdfh"
+ + "klasdhfjkalsdhfklasdhjkflahsjdkfhklasfhjkasdfhasfjkasdhfklsdhalghhaf;hdklasfhjklashjklfa"
+ + "sdhfasdjklfhsdjklafsd;hkldadfjjklasdhfjasddfjklfhakjklasdjfkl;asdjfasfljasdfhjklasdfhjka"
+ + "ghjkashf;djfklasdjfkljasdklfjklasdjfkljasdfkljaklfj",
+ "\u001BJ\u0003\u0000\u008C\u0094n\u00DE\u00B4\u00D7\u0096\u00B1x\u0086\u00F2-\u00E1\u001A"
+ + "\u00BC\u000B\u001C\u00BA\u00A9\u00C7\u00F7\u00CCn\u00B2B4QD\u008BN\u0013\b\u00A0\u00CDn"
+ + "\u00E8,\u00A5S\u00A1\u009C],\u001D#\u001A\u00D2V\u00BE\u00DB\u00EB&\u00BA\u0003e|\u0096j"
+ + "\u00A2v\u00EC\u00EF\u0087G3\u00D6\'\u000Ec\u0095\u00E2\u001D\u008D,\u00C5\u00D1(\u009F`"
+ + "\u0094o\u0002\u008B\u00DD\u00AAd\u0094,\u001E;e|\u0007EZ\u00B2\u00E2\u00FCI\u0081,\u009F"
+ + "@\u00AE\u00EFh\u0081\u00AC\u0016z\u000F\u00F5;m\u001C\u00B9\u001E-_\u00D5\u00C8\u00AF^"
+ + "\u0085\u00AA\u0005\u00BESu\u00C2\u00B0\"\u008A\u0015\u00C6\u00A3\u00B1\u00E6B\u0014"
+ + "\u00F4\u0084TS\u0019_\u00BE\u00C3\u00F2\u001D\u00D1\u00B7\u00E5\u00DD\u00B6\u00D9#\u00C6"
+ + "\u00F6\u009F\u009E\u00F6Me0\u00FB\u00C0qE\u0004\u00AD\u0003\u00B5\u00BE\u00C9\u00CB"
+ + "\u00FD\u00E2PZFt\u0004\r\u00FF \u0004w\u00B2m\'\u00BFG\u00A9\u009D\u001B\u0096,b\u0090#"
+ + "\u008B\u00E0\u00F8\u001D\u00CF\u00AF\u001D=\u00EE\u008A\u00C8u#f\u00DD\u00DE\u00D6m"
+ + "\u00E3*\u0082\u008Ax\u008A\u00DB\u00E6 L\u00B7\\c\u00BA0\u00E3?\u00B6\u00EE\u008C\""
+ + "\u00A2*\u00B0\"\n\u0099\u00FF=bQ\u00EE\b\u00F6=J\u00E4\u00CC\u00EF\"\u0087\u0011\u00E2"
+ + "\u0083(\u00E4\u00F5\u008F5\u0019c[\u00E1Z\u0092s\u00DD\u00A1P\u009D8\\\u00EB\u00B5\u0003"
+ + "jd\u0090\u0094\u00C8\u008D\u00FB/\u008A\u0086\"\u00CC\u001D\u0087\u00E0H\n\u0096w\u00909"
+ + "\u00C6##H\u00FB\u0011GV\u00CA \u00E3B\u0081\u00F7w2\u00C1\u00A5\\@!e\u0017@)\u0017\u0017"
+ + "lV2\u00988\u0006\u00DC\u0099M3)\u00BB\u0002\u00DFL&\u0093l\u0017\u0082\u0086 \u00D7"
+ + "\u0003y}\u009A\u0000\u00D7\u0087\u0000\u00E7\u000Bf\u00E3Lfqg\b2\u00F9\b>\u00813\u00CD"
+ + "\u0017r1\u00F0\u00B8\u0094RK\u00901\u008Eh\u00C1\u00EF\u0090\u00C9\u00E5\u00F2a\tr%"
+ + "\u00AD\u00EC\u00C5b\u00C0\u000B\u0012\u0005\u00F7\u0091u\r\u00EEa..\u0019\t\u00C2\u0003"
+ );
+ }
+
+ @Test
+ public void testFox() throws IOException {
+ checkDecodeResource(
+ "The quick brown fox jumps over the lazy dog",
+ "\u001B*\u0000\u0000\u0004\u0004\u00BAF:\u0085\u0003\u00E9\u00FA\f\u0091\u0002H\u0011,"
+ + "\u00F3\u008A:\u00A3V\u007F\u001A\u00AE\u00BF\u00A4\u00AB\u008EM\u00BF\u00ED\u00E2\u0004K"
+ + "\u0091\u00FF\u0087\u00E9\u001E");
+ }
+
+ @Test
+ public void testUtils() {
+ new Context();
+ new Decode();
+ new Dictionary();
+ new Huffman();
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Dictionary.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Dictionary.java
new file mode 100644
index 000000000..a6867b7d4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Dictionary.java
@@ -0,0 +1,54 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Collection of static dictionary words.
+ *
+ * <p>Dictionary content is loaded from binary resource when {@link #getData()} is executed for the
+ * first time. Consequently, it saves memory and CPU in case dictionary is not required.
+ *
+ * <p>One possible drawback is that multiple threads that need dictionary data may be blocked (only
+ * once in each classworld). To avoid this, it is enough to call {@link #getData()} proactively.
+ */
+public final class Dictionary {
+ private static volatile ByteBuffer data;
+
+ private static class DataLoader {
+ static final boolean OK;
+
+ static {
+ boolean ok = true;
+ try {
+ Class.forName(Dictionary.class.getPackage().getName() + ".DictionaryData");
+ } catch (Throwable ex) {
+ ok = false;
+ }
+ OK = ok;
+ }
+ }
+
+ public static void setData(ByteBuffer data) {
+ if (!data.isDirect() || !data.isReadOnly()) {
+ throw new BrotliRuntimeException("data must be a direct read-only byte buffer");
+ }
+ Dictionary.data = data;
+ }
+
+ public static ByteBuffer getData() {
+ if (data != null) {
+ return data;
+ }
+ if (!DataLoader.OK) {
+ throw new BrotliRuntimeException("brotli dictionary is not set");
+ }
+ /* Might have been set when {@link DictionaryData} was loaded.*/
+ return data;
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/DictionaryData.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/DictionaryData.java
new file mode 100644
index 000000000..f969df35f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/DictionaryData.java
@@ -0,0 +1,51 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Built-in dictionary data.
+ *
+ * When this class is loaded, it sets its data: {@link Dictionary#setData(ByteBuffer)}.
+ */
+final class DictionaryData {
+ private static final String DATA0 = "timedownlifeleftbackcodedatashowonlysitecityopenjustlikefreeworktextyearoverbodyloveformbookplaylivelinehelphomesidemorewordlongthemviewfindpagedaysfullheadtermeachareafromtruemarkableuponhighdatelandnewsevennextcasebothpostusedmadehandherewhatnameLinkblogsizebaseheldmakemainuser') +holdendswithNewsreadweresigntakehavegameseencallpathwellplusmenufilmpartjointhislistgoodneedwayswestjobsmindalsologorichuseslastteamarmyfoodkingwilleastwardbestfirePageknowaway.pngmovethanloadgiveselfnotemuchfeedmanyrockicononcelookhidediedHomerulehostajaxinfoclublawslesshalfsomesuchzone100%onescareTimeracebluefourweekfacehopegavehardlostwhenparkkeptpassshiproomHTMLplanTypedonesavekeepflaglinksoldfivetookratetownjumpthusdarkcardfilefearstaykillthatfallautoever.comtalkshopvotedeepmoderestturnbornbandfellroseurl(skinrolecomeactsagesmeetgold.jpgitemvaryfeltthensenddropViewcopy1.0\"</a>stopelseliestourpack.gifpastcss?graymean&gt;rideshotlatesaidroadvar feeljohnrickportfast'UA-dead</b>poorbilltypeU.S.woodmust2px;Inforankwidewantwalllead[0];paulwavesure$('#waitmassarmsgoesgainlangpaid!-- lockunitrootwalkfirmwifexml\"songtest20pxkindrowstoolfontmailsafestarmapscorerainflowbabyspansays4px;6px;artsfootrealwikiheatsteptriporg/lakeweaktoldFormcastfansbankveryrunsjulytask1px;goalgrewslowedgeid=\"sets5px;.js?40pxif (soonseatnonetubezerosentreedfactintogiftharm18pxcamehillboldzoomvoideasyringfillpeakinitcost3px;jacktagsbitsrolleditknewnear<!--growJSONdutyNamesaleyou lotspainjazzcoldeyesfishwww.risktabsprev10pxrise25pxBlueding300,ballfordearnwildbox.fairlackverspairjunetechif(!pickevil$(\"#warmlorddoespull,000ideadrawhugespotfundburnhrefcellkeystickhourlossfuel12pxsuitdealRSS\"agedgreyGET\"easeaimsgirlaids8px;navygridtips#999warsladycars); }php?helltallwhomzh:e*/\r\n 100hall.\n\nA7px;pushchat0px;crew*/</hash75pxflatrare && tellcampontolaidmissskiptentfinemalegetsplot400,\r\n\r\ncoolfeet.php<br>ericmostguidbelldeschairmathatom/img&#82luckcent000;tinygonehtmlselldrugFREEnodenick?id=losenullvastwindRSS wearrelybeensamedukenasacapewishgulfT23:hitsslotgatekickblurthey15px''););\">msiewinsbirdsortbetaseekT18:ordstreemall60pxfarmb\u0000\u0019sboys[0].');\"POSTbearkids);}}marytend(UK)quadzh:f-siz----prop');\rliftT19:viceandydebt>RSSpoolneckblowT16:doorevalT17:letsfailoralpollnovacolsgene b\u0000\u0014softrometillross<h3>pourfadepink<tr>mini)|!(minezh:hbarshear00);milk -->ironfreddiskwentsoilputs/js/holyT22:ISBNT20:adamsees<h2>json', 'contT21: RSSloopasiamoon</p>soulLINEfortcartT14:<h1>80px!--<9px;T04:mike:46ZniceinchYorkricezh:d'));puremageparatonebond:37Z_of_']);000,zh:gtankyardbowlbush:56ZJava30px\n|}\n%C3%:34ZjeffEXPIcashvisagolfsnowzh:iquer.csssickmeatmin.binddellhirepicsrent:36ZHTTP-201fotowolfEND xbox:54ZBODYdick;\n}\nexit:35Zvarsbeat'});diet999;anne}}</[i].LangkmB2wiretoysaddssealalex;\n\t}echonine.org005)tonyjewssandlegsroof000) 200winegeardogsbootgarycutstyletemption.xmlcockgang$('.50pxPh.Dmiscalanloandeskmileryanunixdisc);}\ndustclip).\n\n70px-200DVDs7]><tapedemoi++)wageeurophiloptsholeFAQsasin-26TlabspetsURL bulkcook;}\r\nHEAD[0])abbrjuan(198leshtwin</i>sonyguysfuckpipe|-\n!002)ndow[1];[];\nLog salt\r\n\t\tbangtrimbath){\r\n00px\n});ko:lfeesad>\rs:// [];tollplug(){\n{\r\n .js'200pdualboat.JPG);\n}quot);\n\n');\n\r\n}\r201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037201320122011201020092008200720062005200420032002200120001999199819971996199519941993199219911990198919881987198619851984198319821981198019791978197719761975197419731972197119701969196819671966196519641963196219611960195919581957195619551954195319521951195010001024139400009999comomC!sesteestaperotodohacecadaaC1obiendC-aasC-vidacasootroforosolootracualdijosidograntipotemadebealgoquC)estonadatrespococasabajotodasinoaguapuesunosantediceluisellamayozonaamorpisoobraclicellodioshoracasiP7P0P=P0P>P<Q\u0000P0Q\u0000Q\u0003Q\u0002P0P=P5P?P>P>Q\u0002P8P7P=P>P4P>Q\u0002P>P6P5P>P=P8Q\u0005P\u001DP0P5P5P1Q\u000BP<Q\u000BP\u0012Q\u000BQ\u0001P>P2Q\u000BP2P>P\u001DP>P>P1P\u001FP>P;P8P=P8P P$P\u001DP5P\u001CQ\u000BQ\u0002Q\u000BP\u001EP=P8P<P4P0P\u0017P0P\u0014P0P\u001DQ\u0003P\u001EP1Q\u0002P5P\u0018P7P5P9P=Q\u0003P<P<P\"Q\u000BQ\u0003P6Y\u0001Y\nX#Y\u0006Y\u0005X'Y\u0005X9Y\u0003Y\u0004X#Y\u0008X1X/Y\nX'Y\u0001Y\tY\u0007Y\u0008Y\u0004Y\u0005Y\u0004Y\u0003X'Y\u0008Y\u0004Y\u0007X(X3X'Y\u0004X%Y\u0006Y\u0007Y\nX#Y\nY\u0002X/Y\u0007Y\u0004X+Y\u0005X(Y\u0007Y\u0004Y\u0008Y\u0004Y\nX(Y\u0004X'Y\nX(Y\u0003X4Y\nX'Y\u0005X#Y\u0005Y\u0006X*X(Y\nY\u0004Y\u0006X-X(Y\u0007Y\u0005Y\u0005X4Y\u0008X4firstvideolightworldmediawhitecloseblackrightsmallbooksplacemusicfieldorderpointvalueleveltableboardhousegroupworksyearsstatetodaywaterstartstyledeathpowerphonenighterrorinputabouttermstitletoolseventlocaltimeslargewordsgamesshortspacefocusclearmodelblockguideradiosharewomenagainmoneyimagenamesyounglineslatercolorgreenfront&amp;watchforcepricerulesbeginaftervisitissueareasbelowindextotalhourslabelprintpressbuiltlinksspeedstudytradefoundsenseundershownformsrangeaddedstillmovedtakenaboveflashfixedoftenotherviewschecklegalriveritemsquickshapehumanexistgoingmoviethirdbasicpeacestagewidthloginideaswrotepagesusersdrivestorebreaksouthvoicesitesmonthwherebuildwhichearthforumthreesportpartyClicklowerlivesclasslayerentrystoryusagesoundcourtyour birthpopuptypesapplyImagebeinguppernoteseveryshowsmeansextramatchtrackknownearlybegansuperpapernorthlearngivennamedendedTermspartsGroupbrandusingwomanfalsereadyaudiotakeswhile.com/livedcasesdailychildgreatjudgethoseunitsneverbroadcoastcoverapplefilescyclesceneplansclickwritequeenpieceemailframeolderphotolimitcachecivilscaleenterthemetheretouchboundroyalaskedwholesincestock namefaithheartemptyofferscopeownedmightalbumthinkbloodarraymajortrustcanonunioncountvalidstoneStyleLoginhappyoccurleft:freshquitefilmsgradeneedsurbanfightbasishoverauto;route.htmlmixedfinalYour slidetopicbrownalonedrawnsplitreachRightdatesmarchquotegoodsLinksdoubtasyncthumballowchiefyouthnovel10px;serveuntilhandsCheckSpacequeryjamesequaltwice0,000Startpanelsongsroundeightshiftworthpostsleadsweeksavoidthesemilesplanesmartalphaplantmarksratesplaysclaimsalestextsstarswrong</h3>thing.org/multiheardPowerstandtokensolid(thisbringshipsstafftriedcallsfullyfactsagentThis //-->adminegyptEvent15px;Emailtrue\"crossspentblogsbox\">notedleavechinasizesguest</h4>robotheavytrue,sevengrandcrimesignsawaredancephase><!--en_US&#39;200px_namelatinenjoyajax.ationsmithU.S. holdspeterindianav\">chainscorecomesdoingpriorShare1990sromanlistsjapanfallstrialowneragree</h2>abusealertopera\"-//WcardshillsteamsPhototruthclean.php?saintmetallouismeantproofbriefrow\">genretrucklooksValueFrame.net/-->\n<try {\nvar makescostsplainadultquesttrainlaborhelpscausemagicmotortheir250pxleaststepsCountcouldglasssidesfundshotelawardmouthmovesparisgivesdutchtexasfruitnull,||[];top\">\n<!--POST\"ocean<br/>floorspeakdepth sizebankscatchchart20px;aligndealswould50px;url=\"parksmouseMost ...</amongbrainbody none;basedcarrydraftreferpage_home.meterdelaydreamprovejoint</tr>drugs<!-- aprilidealallenexactforthcodeslogicView seemsblankports (200saved_linkgoalsgrantgreekhomesringsrated30px;whoseparse();\" Blocklinuxjonespixel');\">);if(-leftdavidhorseFocusraiseboxesTrackement</em>bar\">.src=toweralt=\"cablehenry24px;setupitalysharpminortastewantsthis.resetwheelgirls/css/100%;clubsstuffbiblevotes 1000korea});\r\nbandsqueue= {};80px;cking{\r\n\t\taheadclockirishlike ratiostatsForm\"yahoo)[0];Aboutfinds</h1>debugtasksURL =cells})();12px;primetellsturns0x600.jpg\"spainbeachtaxesmicroangel--></giftssteve-linkbody.});\n\tmount (199FAQ</rogerfrankClass28px;feeds<h1><scotttests22px;drink) || lewisshall#039; for lovedwaste00px;ja:c\u0002simon<fontreplymeetsuntercheaptightBrand) != dressclipsroomsonkeymobilmain.Name platefunnytreescom/\"1.jpgwmodeparamSTARTleft idden, 201);\n}\nform.viruschairtransworstPagesitionpatch<!--\no-cacfirmstours,000 asiani++){adobe')[0]id=10both;menu .2.mi.png\"kevincoachChildbruce2.jpgURL)+.jpg|suitesliceharry120\" sweettr>\r\nname=diegopage swiss-->\n\n#fff;\">Log.com\"treatsheet) && 14px;sleepntentfiledja:c\u0003id=\"cName\"worseshots-box-delta\n&lt;bears:48Z<data-rural</a> spendbakershops= \"\";php\">ction13px;brianhellosize=o=%2F joinmaybe<img img\">, fjsimg\" \")[0]MTopBType\"newlyDanskczechtrailknows</h5>faq\">zh-cn10);\n-1\");type=bluestrulydavis.js';>\r\n<!steel you h2>\r\nform jesus100% menu.\r\n\t\r\nwalesrisksumentddingb-likteachgif\" vegasdanskeestishqipsuomisobredesdeentretodospuedeaC1osestC!tienehastaotrospartedondenuevohacerformamismomejormundoaquC-dC-assC3loayudafechatodastantomenosdatosotrassitiomuchoahoralugarmayorestoshorastenerantesfotosestaspaC-snuevasaludforosmedioquienmesespoderchileserC!vecesdecirjosC)estarventagrupohechoellostengoamigocosasnivelgentemismaairesjuliotemashaciafavorjuniolibrepuntobuenoautorabrilbuenatextomarzosaberlistaluegocC3moenerojuegoperC:haberestoynuncamujervalorfueralibrogustaigualvotoscasosguC-apuedosomosavisousteddebennochebuscafaltaeurosseriedichocursoclavecasasleC3nplazolargoobrasvistaapoyojuntotratavistocrearcampohemoscincocargopisosordenhacenC!readiscopedrocercapuedapapelmenorC:tilclarojorgecalleponertardenadiemarcasigueellassiglocochemotosmadreclaserestoniC1oquedapasarbancohijosviajepabloC)stevienereinodejarfondocanalnorteletracausatomarmanoslunesautosvillavendopesartipostengamarcollevapadreunidovamoszonasambosbandamariaabusomuchasubirriojavivirgradochicaallC-jovendichaestantalessalirsuelopesosfinesllamabuscoC)stalleganegroplazahumorpagarjuntadobleislasbolsabaC1ohablaluchaC\u0001readicenjugarnotasvalleallC!cargadolorabajoestC)gustomentemariofirmacostofichaplatahogarartesleyesaquelmuseobasespocosmitadcielochicomiedoganarsantoetapadebesplayaredessietecortecoreadudasdeseoviejodeseaaguas&quot;domaincommonstatuseventsmastersystemactionbannerremovescrollupdateglobalmediumfilternumberchangeresultpublicscreenchoosenormaltravelissuessourcetargetspringmodulemobileswitchphotosborderregionitselfsocialactivecolumnrecordfollowtitle>eitherlengthfamilyfriendlayoutauthorcreatereviewsummerserverplayedplayerexpandpolicyformatdoublepointsseriespersonlivingdesignmonthsforcesuniqueweightpeopleenergynaturesearchfigurehavingcustomoffsetletterwindowsubmitrendergroupsuploadhealthmethodvideosschoolfutureshadowdebatevaluesObjectothersrightsleaguechromesimplenoticesharedendingseasonreportonlinesquarebuttonimagesenablemovinglatestwinterFranceperiodstrongrepeatLondondetailformeddemandsecurepassedtoggleplacesdevicestaticcitiesstreamyellowattackstreetflighthiddeninfo\">openedusefulvalleycausesleadersecretseconddamagesportsexceptratingsignedthingseffectfieldsstatesofficevisualeditorvolumeReportmuseummoviesparentaccessmostlymother\" id=\"marketgroundchancesurveybeforesymbolmomentspeechmotioninsidematterCenterobjectexistsmiddleEuropegrowthlegacymannerenoughcareeransweroriginportalclientselectrandomclosedtopicscomingfatheroptionsimplyraisedescapechosenchurchdefinereasoncorneroutputmemoryiframepolicemodelsNumberduringoffersstyleskilledlistedcalledsilvermargindeletebetterbrowselimitsGlobalsinglewidgetcenterbudgetnowrapcreditclaimsenginesafetychoicespirit-stylespreadmakingneededrussiapleaseextentScriptbrokenallowschargedividefactormember-basedtheoryconfigaroundworkedhelpedChurchimpactshouldalwayslogo\" bottomlist\">){var prefixorangeHeader.push(couplegardenbridgelaunchReviewtakingvisionlittledatingButtonbeautythemesforgotSearchanchoralmostloadedChangereturnstringreloadMobileincomesupplySourceordersviewed&nbsp;courseAbout island<html cookiename=\"amazonmodernadvicein</a>: The dialoghousesBEGIN MexicostartscentreheightaddingIslandassetsEmpireSchooleffortdirectnearlymanualSelect.\n\nOnejoinedmenu\">PhilipawardshandleimportOfficeregardskillsnationSportsdegreeweekly (e.g.behinddoctorloggedunited</b></beginsplantsassistartistissued300px|canadaagencyschemeremainBrazilsamplelogo\">beyond-scaleacceptservedmarineFootercamera</h1>\n_form\"leavesstress\" />\r\n.gif\" onloadloaderOxfordsistersurvivlistenfemaleDesignsize=\"appealtext\">levelsthankshigherforcedanimalanyoneAfricaagreedrecentPeople<br />wonderpricesturned|| {};main\">inlinesundaywrap\">failedcensusminutebeaconquotes150px|estateremoteemail\"linkedright;signalformal1.htmlsignupprincefloat:.png\" forum.AccesspaperssoundsextendHeightsliderUTF-8\"&amp; Before. WithstudioownersmanageprofitjQueryannualparamsboughtfamousgooglelongeri++) {israelsayingdecidehome\">headerensurebranchpiecesblock;statedtop\"><racingresize--&gt;pacitysexualbureau.jpg\" 10,000obtaintitlesamount, Inc.comedymenu\" lyricstoday.indeedcounty_logo.FamilylookedMarketlse ifPlayerturkey);var forestgivingerrorsDomain}else{insertBlog</footerlogin.fasteragents<body 10px 0pragmafridayjuniordollarplacedcoversplugin5,000 page\">boston.test(avatartested_countforumsschemaindex,filledsharesreaderalert(appearSubmitline\">body\">\n* TheThoughseeingjerseyNews</verifyexpertinjurywidth=CookieSTART across_imagethreadnativepocketbox\">\nSystem DavidcancertablesprovedApril reallydriveritem\">more\">boardscolorscampusfirst || [];media.guitarfinishwidth:showedOther .php\" assumelayerswilsonstoresreliefswedenCustomeasily your String\n\nWhiltaylorclear:resortfrenchthough\") + \"<body>buyingbrandsMembername\">oppingsector5px;\">vspacepostermajor coffeemartinmaturehappen</nav>kansaslink\">Images=falsewhile hspace0&amp; \n\nIn powerPolski-colorjordanBottomStart -count2.htmlnews\">01.jpgOnline-rightmillerseniorISBN 00,000 guidesvalue)ectionrepair.xml\" rights.html-blockregExp:hoverwithinvirginphones</tr>\rusing \n\tvar >');\n\t</td>\n</tr>\nbahasabrasilgalegomagyarpolskisrpskiX1X/Y\u0008d8-f\u0016\u0007g.\u0000d=\u0013g9\u0001i+\u0014d?!f\u0001/d8-e\u001B=f\u0008\u0011d;,d8\u0000d8*e\u0005,e\u000F8g.!g\u0010\u0006h.:e\u001D\u001Be\u000F/d;%f\u001C\re\n!f\u00176i\u00174d8*d::d:'e\u0013\u0001h\u0007*e71d<\u0001d8\u001Af\u001F%g\u001C\u000Be7%d=\u001Ch\u0001\u0014g3;f2!f\u001C\tg=\u0011g+\u0019f\t\u0000f\u001C\th/\u0004h.:d8-e?\u0003f\u0016\u0007g+ g\u0014(f\u00087i&\u0016i!5d=\u001Ch\u0000\u0005f\n\u0000f\u001C/i\u0017.i\"\u0018g\u001B8e\u00053d8\u000Bh==f\u0010\u001Cg4\"d=?g\u0014(h=/d;6e\u001C(g:?d8;i\"\u0018h5\u0004f\u0016\u0019h'\u0006i\"\u0011e\u001B\u001Ee$\rf3(e\u0006\u000Cg=\u0011g;\u001Cf\u00146h\u0017\u000Fe\u0006\u0005e.9f\u000E(h\r\u0010e8\u0002e\u001C:f6\u0008f\u0001/g):i\u00174e\u000F\u0011e8\u0003d;\u0000d9\u0008e%=e\u000F\u000Bg\u0014\u001Ff4;e\u001B>g\t\u0007e\u000F\u0011e1\u0015e&\u0002f\u001E\u001Cf\t\u000Bf\u001C:f\u00160i\u0017;f\u001C\u0000f\u00160f\u00169e<\u000Fe\u000C\u0017d:,f\u000F\u0010d>\u001Be\u00053d:\u000Ef\u001B4e$\u001Ah?\u0019d8*g3;g;\u001Fg\u001F%i\u0001\u0013f88f\u0008\u000Fe9?e\u0011\ne\u00056d;\u0016e\u000F\u0011h!(e.\te\u0005(g,,d8\u0000d<\u001Ae\u0011\u0018h?\u001Bh!\u000Cg\u00029e\u0007;g\t\u0008f\u001D\u0003g\u00145e-\u0010d8\u0016g\u0015\u000Ch.>h.!e\u0005\rh49f\u0015\u0019h\u00022e\n e\u0005%f4;e\n(d;\u0016d;,e\u0015\u0006e\u0013\u0001e\r\u001Ae.\"g\u000E0e\u001C(d8\nf57e&\u0002d=\u0015e72g;\u000Fg\u0015\u0019h(\u0000h/&g;\u0006g$>e\u000C:g\u0019;e=\u0015f\u001C,g+\u0019i\u001C\u0000h&\u0001d;7f <f\u0014/f\u000C\u0001e\u001B=i\u0019\u0005i\u0013>f\u000E%e\u001B=e.6e;:h.>f\u001C\u000Be\u000F\u000Bi\u0018\u0005h/;f3\u0015e>\u000Bd=\rg=.g;\u000Ff5\u000Ei\u0000\tf\u000B)h?\u0019f 7e=\u0013e\t\re\u0008\u0006g1;f\u000E\u0012h!\u000Ce\u001B d8:d:$f\u0018\u0013f\u001C\u0000e\u0010\u000Ei\u001F3d9\u0010d8\rh\u0003=i\u0000\u001Ah?\u0007h!\u000Cd8\u001Ag'\u0011f\n\u0000e\u000F/h\u0003=h.>e$\u0007e\u0010\u0008d=\u001Ce$'e.6g$>d<\u001Ag \u0014g)6d8\u0013d8\u001Ae\u0005(i\u0003(i!9g\u001B.h?\u0019i\u0007\u000Ch?\u0018f\u0018/e<\u0000e'\u000Bf\u0003\u0005e\u00065g\u00145h\u0004\u0011f\u0016\u0007d;6e\u0013\u0001g\t\u000Ce8.e\n)f\u0016\u0007e\u000C\u0016h5\u0004f:\u0010e$'e-&e-&d9 e\u001C0e\u001D\u0000f5\u000Fh'\u0008f\n\u0015h5\u0004e7%g(\u000Bh&\u0001f1\u0002f\u0000\u000Ed9\u0008f\u00176e\u0000\u0019e\n\u001Fh\u0003=d8;h&\u0001g\u001B.e\t\rh5\u0004h./e\u001F\u000Ee8\u0002f\u00169f3\u0015g\u00145e=1f\u000B\u001Bh\u0001\u0018e#0f\u0018\u000Ed;;d=\u0015e\u0001%e:7f\u00150f\r.g>\u000Ee\u001B=f1=h=&d;\u000Bg;\rd=\u0006f\u0018/d:$f5\u0001g\u0014\u001Fd:'f\t\u0000d;%g\u00145h/\u001Df\u0018>g$:d8\u0000d:\u001Be\r\u0015d=\rd::e\u0011\u0018e\u0008\u0006f\u001E\u0010e\u001C0e\u001B>f\u0017\u0005f88e7%e\u00057e-&g\u0014\u001Fg3;e\u0008\u0017g=\u0011e\u000F\u000Be8\u0016e-\u0010e/\u0006g \u0001i\"\u0011i\u0001\u0013f\u000E'e\u00086e\u001C0e\u000C:e\u001F:f\u001C,e\u0005(e\u001B=g=\u0011d8\ni\u0007\rh&\u0001g,,d:\u000Ce\u0016\u001Cf,\"h?\u001Be\u0005%e\u000F\u000Bf\u0003\u0005h?\u0019d:\u001Bh\u0000\u0003h/\u0015e\u000F\u0011g\u000E0e\u001F9h.-d;%d8\nf\u0014?e:\u001Cf\u0008\u0010d8:g\u000E/e\"\u0003i&\u0019f8/e\u0010\u000Cf\u00176e(1d9\u0010e\u000F\u0011i\u0000\u0001d8\u0000e.\u001Ae<\u0000e\u000F\u0011d=\u001Ce\u0013\u0001f \u0007e\u0007\u0006f,\"h?\u000Eh'#e\u00063e\u001C0f\u00169d8\u0000d8\u000Bd;%e\u000F\nh4#d;;f\u0008\u0016h\u0000\u0005e.\"f\u00087d;#h!(g'/e\u0008\u0006e%3d::f\u00150g \u0001i\u0014\u0000e\u0014.e\u0007:g\u000E0g&;g:?e:\u0014g\u0014(e\u0008\u0017h!(d8\re\u0010\u000Cg<\u0016h>\u0011g;\u001Fh.!f\u001F%h/\"d8\rh&\u0001f\u001C\te\u00053f\u001C:f\u001E\u0004e>\u0008e$\u001Af\u0012-f\u0014>g;\u0004g;\u0007f\u0014?g-\u0016g\u001B4f\u000E%h\u0003=e\n\u001Bf\u001D%f:\u0010f\u0019\u0002i\u0016\u0013g\u001C\u000Be\u00080g\u0003-i\u0017(e\u00053i\u0014.d8\u0013e\u000C:i\u001D\u001Ee88h\u000B1h/-g\u0019>e:&e8\u000Cf\u001C\u001Bg>\u000Ee%3f/\u0014h>\u0003g\u001F%h/\u0006h'\u0004e.\u001Ae;:h..i\u0003(i\u0017(f\u0004\u000Fh'\u0001g2>e=)f\u0017%f\u001C,f\u000F\u0010i+\u0018e\u000F\u0011h(\u0000f\u00169i\u001D\"e\u001F:i\u0007\u0011e$\u0004g\u0010\u0006f\u001D\u0003i\u0019\u0010e=1g\t\u0007i\u00136h!\u000Ch?\u0018f\u001C\te\u0008\u0006d:+g\t)e\u0013\u0001g;\u000Fh\u0010%f7;e\n d8\u0013e.6h?\u0019g'\rh/\u001Di\"\u0018h57f\u001D%d8\u001Ae\n!e\u0005,e\u0011\nh.0e=\u0015g.\u0000d;\u000Bh4(i\u0007\u000Fg\u00147d::e=1e\u0013\re<\u0015g\u0014(f\n%e\u0011\ni\u0003(e\u0008\u0006e?+i\u0000\u001Fe\u0012(h/\"f\u00176e0\u001Af3(f\u0004\u000Fg\u00143h/7e-&f !e:\u0014h/%e\u000E\u0006e\u000F2e\u000F*f\u0018/h?\u0014e\u001B\u001Eh4-d90e\u0010\rg'0d8:d:\u0006f\u0008\u0010e\n\u001Fh/4f\u0018\u000Ed>\u001Be:\u0014e-)e-\u0010d8\u0013i\"\u0018g(\u000Be:\u000Fd8\u0000h\u0008,f\u001C\u0003e\u0013!e\u000F*f\u001C\te\u00056e.\u0003d?\u001Df\n$h\u0000\u000Cd8\u0014d;\ne$)g*\u0017e\u000F#e\n(f\u0000\u0001g\n6f\u0000\u0001g\t9e\u0008+h.$d8:e?\u0005i!;f\u001B4f\u00160e0\u000Fh/4f\u0008\u0011e\u0000\u0011d=\u001Cd8:e*\u0012d=\u0013e\u000C\u0005f\u000B,i\u0002#d9\u0008d8\u0000f 7e\u001B=e\u0006\u0005f\u0018/e\u0010&f 9f\r.g\u00145h'\u0006e-&i\u0019\"e\u00057f\u001C\th?\u0007g(\u000Bg\u00141d:\u000Ed::f\t\re\u0007:f\u001D%d8\rh?\u0007f-#e\u001C(f\u0018\u000Ef\u0018\u001Ff\u0015\u0005d:\u000Be\u00053g3;f \u0007i\"\u0018e\u0015\u0006e\n!h>\u0013e\u0005%d8\u0000g\u001B4e\u001F:g!\u0000f\u0015\u0019e-&d:\u0006h'#e;:g-\u0011g;\u0013f\u001E\u001Ce\u0005(g\u0010\u0003i\u0000\u001Ag\u001F%h.!e\u0008\u0012e/9d:\u000Eh\t:f\u001C/g\u001B8e\u0006\u000Ce\u000F\u0011g\u0014\u001Fg\u001C\u001Fg\u001A\u0004e;:g+\u000Bg-\tg:'g1;e\u001E\u000Bg;\u000Fi*\u000Ce.\u001Eg\u000E0e\u00086d=\u001Cf\u001D%h\u0007*f \u0007g->d;%d8\u000Be\u000E\u001Fe\u0008\u001Bf\u0017 f3\u0015e\u00056d8-e\u0000\u000Bd::d8\u0000e\u0008\u0007f\u000C\u0007e\r\u0017e\u00053i\u0017-i\u001B\u0006e\u001B\"g,,d8\te\u00053f3(e\u001B f-$g\u0005'g\t\u0007f71e\u001C3e\u0015\u0006d8\u001Ae9?e7\u001Ef\u0017%f\u001C\u001Fi+\u0018g:'f\u001C\u0000h?\u0011g;<e\u0010\u0008h!(g$:d8\u0013h>\u0011h!\u000Cd8:d:$i\u0000\u001Ah/\u0004d;7h'\te>\u0017g2>e\r\u000Ee.6e:-e.\u000Cf\u0008\u0010f\u0004\u001Fh'\te.\th#\u0005e>\u0017e\u00080i\u0002.d;6e\u00086e:&i#\u001Fe\u0013\u0001h\u0019=g\u00046h=,h==f\n%d;7h.0h\u0000\u0005f\u00169f!\u0008h!\u000Cf\u0014?d::f0\u0011g\u0014(e\u0013\u0001d8\u001Ch%?f\u000F\u0010e\u0007:i\u0005\u0012e:\u0017g\u00046e\u0010\u000Ed;\u0018f,>g\u0003-g\u00029d;%e\t\re.\u000Ce\u0005(e\u000F\u0011e8\u0016h.>g=.i\"\u0006e/<e7%d8\u001Ae\u000C;i\u0019\"g\u001C\u000Bg\u001C\u000Bg;\u000Fe\u00058e\u000E\u001Fe\u001B e93e\u000F0e\u0010\u0004g'\re\"\u001Ee\n f\u001D\u0010f\u0016\u0019f\u00160e\"\u001Ed9\u000Be\u0010\u000Eh\u0001\u000Cd8\u001Af\u0015\u0008f\u001E\u001Cd;\ne94h.:f\u0016\u0007f\u0008\u0011e\u001B=e\u0011\nh/\tg\t\u0008d8;d?.f\u00149e\u000F\u0002d8\u000Ef\t\u0013e\r0e?+d9\u0010f\u001C:f\"0h'\u0002g\u00029e-\u0018e\u001C(g2>g%\u001Eh\u000E7e>\u0017e\u0008)g\u0014(g;'g;-d= d;,h?\u0019d9\u0008f(!e<\u000Fh/-h(\u0000h\u0003=e$\u001Fi\u001B\u0005h\u0019\u000Ef\u0013\rd=\u001Ci#\u000Ef <d8\u0000h57g'\u0011e-&d=\u0013h\u00022g\u001F-d?!f\u001D!d;6f2;g\u0016\u0017h?\u0010e\n(d:'d8\u001Ad<\u001Ah..e/<h\u0008*e\u0005\u0008g\u0014\u001Fh\u0001\u0014g\u001B\u001Fe\u000F/f\u0018/e\u0015\u000Fi!\u000Cg;\u0013f\u001E\u0004d=\u001Cg\u0014(h0\u0003f\u001F%h3\u0007f\u0016\u0019h\u0007*e\n(h4\u001Fh4#e\u0006\u001Cd8\u001Ah.?i\u0017.e.\u001Ef\u0016=f\u000E%e\u000F\u0017h.(h.:i\u0002#d8*e\u000F\ri&\u0008e\n e<:e%3f\u0000'h\u000C\u0003e\u001B4f\u001C\re\u000B\u0019d<\u0011i\u00172d;\nf\u0017%e.\"f\u001C\rh'\u0000g\u001C\u000Be\u000F\u0002e\n g\u001A\u0004h/\u001Dd8\u0000g\u00029d?\u001Dh/\u0001e\u001B>d9&f\u001C\tf\u0015\u0008f5\u000Bh/\u0015g';e\n(f\t\rh\u0003=e\u00063e.\u001Ah\u0002!g%(d8\rf\u0016-i\u001C\u0000f1\u0002d8\re>\u0017e\n\u001Ef3\u0015d9\u000Bi\u00174i\u0007\u0007g\u0014(h\u0010%i\u0014\u0000f\n\u0015h/\tg\u001B.f \u0007g\u00081f\u0003\u0005f\u0011\u0004e=1f\u001C\td:\u001Bh$\u0007h#=f\u0016\u0007e-&f\u001C:d<\u001Af\u00150e-\u0017h#\u0005d?.h4-g\t)e\u0006\u001Cf\u001D\u0011e\u0005(i\u001D\"g2>e\u0013\u0001e\u00056e.\u001Ed:\u000Bf\u0003\u0005f04e93f\u000F\u0010g$:d8\ne8\u0002h0\"h0\"f\u0019.i\u0000\u001Af\u0015\u0019e8\u0008d8\nd< g1;e\u0008+f-\u000Cf\u001B2f\u000B%f\u001C\te\u0008\u001Bf\u00160i\u0005\rd;6e\u000F*h&\u0001f\u00176d;#h3\u0007h(\nh>>e\u00080d::g\u0014\u001Fh.\"i\u0018\u0005h\u0000\u0001e8\u0008e1\u0015g$:e?\u0003g\u0010\u0006h44e-\u0010g62g+\u0019d8;i!\u000Ch\u0007*g\u00046g:'e\u0008+g.\u0000e\r\u0015f\u00149i\u001D)i\u0002#d:\u001Bf\u001D%h/4f\t\u0013e<\u0000d;#g \u0001e\u0008 i\u0019$h/\u0001e\u00088h\n\u0002g\u001B.i\u0007\rg\u00029f,!f\u00158e$\u001Ae0\u0011h'\u0004e\u0008\u0012h5\u0004i\u0007\u0011f\t>e\u00080d;%e\u0010\u000Ee$'e\u0005(d8;i!5f\u001C\u0000d=3e\u001B\u001Eg-\u0014e$)d8\u000Bd?\u001Di\u001A\u001Cg\u000E0d;#f#\u0000f\u001F%f\n\u0015g%(e0\u000Ff\u00176f2\u0012f\u001C\tf-#e88g\u0014\u001Ah\u00073d;#g\u0010\u0006g\u001B.e=\u0015e\u0005,e<\u0000e$\re\u00086i\u0007\u0011h\u001E\re98g&\u000Fg\t\u0008f\u001C,e=\"f\u0008\u0010e\u0007\u0006e$\u0007h!\u000Cf\u0003\u0005e\u001B\u001Ee\u00080f\u0000\u001Df\u00033f\u0000\u000Ef 7e\r\u000Fh..h.$h/\u0001f\u001C\u0000e%=d:'g\u0014\u001Ff\u000C\tg\u0005'f\u001C\rh#\u0005e9?d8\u001Ce\n(f<+i\u0007\u0007h4-f\u00160f\t\u000Bg;\u0004e\u001B>i\u001D\"f\u001D?e\u000F\u0002h\u0000\u0003f\u0014?f2;e.9f\u0018\u0013e$)e\u001C0e\n*e\n\u001Bd::d;,e\r\u0007g:'i\u0000\u001Fe:&d::g\t)h0\u0003f\u00154f5\u0001h!\u000Ci\u0000 f\u0008\u0010f\u0016\u0007e-\u0017i\u001F)e\u001B=h48f\u0018\u0013e<\u0000e1\u0015g\u001B8i\u0017\u001Ch!(g\u000E0e=1h'\u0006e&\u0002f-$g>\u000Ee.9e$'e0\u000Ff\n%i\u0001\u0013f\u001D!f,>e?\u0003f\u0003\u0005h.8e$\u001Af3\u0015h'\u0004e.6e1\u0005d9&e:\u0017h?\u001Ef\u000E%g+\u000Be\r3d8>f\n%f\n\u0000e7'e%%h?\u0010g\u0019;e\u0005%d;%f\u001D%g\u0010\u0006h.:d:\u000Bd;6h\u0007*g\u00141d8-e\r\u000Ee\n\u001Ee\u0005,e&\u0008e&\u0008g\u001C\u001Ff-#d8\ri\u0014\u0019e\u0005(f\u0016\u0007e\u0010\u0008e\u0010\u000Cd;7e\u0000<e\u0008+d::g\u001B\u0011g\u001D#e\u00057d=\u0013d8\u0016g:*e\u001B\"i\u0018\u001Fe\u0008\u001Bd8\u001Af\t?f\u000B\u0005e\"\u001Ei\u0015?f\u001C\td::d?\u001Df\u000C\u0001e\u0015\u0006e.6g;4d?.e\u000F0f9>e7&e\u000F3h\u0002!d;=g-\u0014f!\u0008e.\u001Ei\u0019\u0005g\u00145d?!g;\u000Fg\u0010\u0006g\u0014\u001Fe\u0011=e.#d< d;;e\n!f-#e<\u000Fg\t9h\t2d8\u000Bf\u001D%e\r\u000Fd<\u001Ae\u000F*h\u0003=e=\u0013g\u00046i\u0007\rf\u00160e\u0005'e.9f\u000C\u0007e/<h?\u0010h!\u000Cf\u0017%e?\u0017h3#e.6h6\u0005h?\u0007e\u001C\u001Fe\u001C0f5\u0019f1\u001Ff\u0014/d;\u0018f\u000E(e\u0007:g+\u0019i\u0015?f\u001D-e7\u001Ef\t'h!\u000Ce\u00086i\u0000 d9\u000Bd8\u0000f\u000E(e9?g\u000E0e\u001C:f\u000F\u000Fh?0e\u000F\u0018e\u000C\u0016d< g;\u001Ff-\u000Cf\t\u000Bd?\u001Di\u0019)h/>g(\u000Be\u000C;g\u0016\u0017g;\u000Fh?\u0007h?\u0007e\u000E;d9\u000Be\t\rf\u00146e\u0005%e94e:&f\u001D\u0002e?\u0017g>\u000Ed8=f\u001C\u0000i+\u0018g\u0019;i\u0019\u0006f\u001C*f\u001D%e\n e7%e\u0005\rh4#f\u0015\u0019g(\u000Bg\t\u0008e\u001D\u0017h:+d=\u0013i\u0007\re:\u0006e\u0007:e\u0014.f\u0008\u0010f\u001C,e=\"e<\u000Fe\u001C\u001Fh1\u0006e\u0007:e\u00039d8\u001Cf\u00169i\u0002.g.1e\r\u0017d:,f1\u0002h\u0001\u000Ce\u000F\u0016e>\u0017h\u0001\u000Cd=\rg\u001B8d?!i!5i\u001D\"e\u0008\u0006i\u0012\u001Fg=\u0011i!5g!.e.\u001Ae\u001B>d>\u000Bg=\u0011e\u001D\u0000g'/f\u001E\u0001i\u0014\u0019h//g\u001B.g\u001A\u0004e.\u001Dh4\u001Df\u001C:e\u00053i#\u000Ei\u0019)f\u000E\u0008f\u001D\u0003g\u0017\u0005f/\u0012e. g\t)i\u0019$d:\u0006h)\u0015h+\u0016g\u0016>g\u0017\u0005e\u000F\nf\u00176f1\u0002h4-g+\u0019g\u00029e\u0004?g+%f/\u000Fe$)d8-e$.h.$h/\u0006f/\u000Fd8*e$)f4%e-\u0017d=\u0013e\u000F0g\u0001#g;4f\n$f\u001C,i!5d8*f\u0000'e.\u0018f\u00169e88h'\u0001g\u001B8f\u001C:f\u0008\u0018g\u0015%e:\u0014e=\u0013e>\u000Be8\u0008f\u00169d>?f !e\u001B-h\u0002!e8\u0002f\u0008?e1\u000Bf \u000Fg\u001B.e\u0011\u0018e7%e/<h\u00074g*\u0001g\u00046i\u0001\u0013e\u00057f\u001C,g=\u0011g;\u0013e\u0010\u0008f!#f!\u0008e\n3e\n(e\u000F&e$\u0016g>\u000Ee\u0005\u0003e<\u0015h57f\u00149e\u000F\u0018g,,e\u001B\u001Bd<\u001Ah.!h**f\u0018\u000Ei\u001A\u0010g'\u0001e.\u001De.\u001Dh'\u0004h\u000C\u0003f6\u0008h49e\u00051e\u0010\u000Ce?\u0018h.0d=\u0013g3;e8&f\u001D%e\u0010\re-\u0017g\u0019<h!(e<\u0000f\u0014>e\n g\u001B\u001Fe\u000F\u0017e\u00080d:\u000Cf\t\u000Be$'i\u0007\u000Ff\u0008\u0010d::f\u00150i\u0007\u000Fe\u00051d:+e\u000C:e\u001F\u001Fe%3e-)e\u000E\u001Fe\u0008\u0019f\t\u0000e\u001C(g;\u0013f\u001D\u001Fi\u0000\u001Ad?!h6\u0005g:'i\u0005\rg=.e=\u0013f\u00176d<\u0018g'\u0000f\u0000'f\u0004\u001Ff\u0008?d:'i\u0001\nf\u00082e\u0007:e\u000F#f\u000F\u0010d:$e01d8\u001Ad?\u001De\u0001%g(\u000Be:&e\u000F\u0002f\u00150d:\u000Bd8\u001Af\u00154d8*e11d8\u001Cf\u0003\u0005f\u0004\u001Fg\t9f.\ne\u0008\u0006i!\u001Ef\u0010\u001Ce0\u000Be1\u001Ed:\u000Ei\u0017(f\u00087h4\"e\n!e#0i\u001F3e\u000F\ne\u00056h4\"g;\u000Fe\u001D\u001Af\u000C\u0001e92i\u0003(f\u0008\u0010g+\u000Be\u0008)g\u001B\nh\u0000\u0003h\u0019\u0011f\u0008\u0010i\u0003=e\u000C\u0005h#\u0005g\u0014(f\u00086f/\u0014h5\u001Bf\u0016\u0007f\u0018\u000Ef\u000B\u001Be\u0015\u0006e.\u000Cf\u00154g\u001C\u001Ff\u0018/g\u001C<g\u001D\u001Bd<\u0019d<4e(\u0001f\u001C\u001Bi\"\u0006e\u001F\u001Fe\r+g\u0014\u001Fd<\u0018f\u0003 h+\u0016e#\u0007e\u0005,e\u00051h\t/e%=e\u0005\u0005e\u0008\u0006g,&e\u0010\u0008i\u0019\u0004d;6g\t9g\u00029d8\re\u000F/h\u000B1f\u0016\u0007h5\u0004d:'f 9f\u001C,f\u0018\u000Ef\u0018>e/\u0006g\"<e\u0005,d<\u0017f0\u0011f\u0017\u000Ff\u001B4e\n d:+e\u000F\u0017e\u0010\u000Ce-&e\u0010/e\n(i\u0000\u0002e\u0010\u0008e\u000E\u001Ff\u001D%i\u0017.g-\u0014f\u001C,f\u0016\u0007g>\u000Ei#\u001Fg;?h\t2g(3e.\u001Ag;\u0008d:\u000Eg\u0014\u001Fg\t)d>\u001Bf1\u0002f\u0010\u001Cg\u000B\u0010e\n\u001Bi\u0007\u000Fd8%i\u0007\rf08h?\u001Ce\u0006\u0019g\u001C\u001Ff\u001C\ti\u0019\u0010g+\u001Ed:\te/9h1!h49g\u0014(d8\re%=g;\u001De/9e\r\u0001e\u0008\u0006d?\u0003h?\u001Bg\u00029h/\u0004e=1i\u001F3d<\u0018e\n?d8\re0\u0011f,#h5\u000Fe96d8\u0014f\u001C\tg\u00029f\u00169e\u0010\u0011e\u0005(f\u00160d?!g\u0014(h.>f\u0016=e=\"h1!h5\u0004f <g*\u0001g 4i\u001A\u000Fg\u001D\u0000i\u0007\re$'d:\u000Ef\u0018/f/\u0015d8\u001Af\u0019:h\u0003=e\u000C\u0016e7%e.\u000Cg>\u000Ee\u0015\u0006e\u001F\u000Eg;\u001Fd8\u0000e\u0007:g\t\u0008f\t\u0013i\u0000 g\u0014\"e\u0013\u0001f&\u0002e\u00065g\u0014(d:\u000Ed?\u001Dg\u0015\u0019e\u001B g4 d8-e\u001C\u000Be-\u0018e\u0002(h44e\u001B>f\u001C\u0000f\u0004\u001Bi\u0015?f\u001C\u001Fe\u000F#d;7g\u0010\u0006h4\"e\u001F:e\u001C0e.\tf\u000E\u0012f-&f1\ti\u0007\u000Ci\u001D\"e\u0008\u001Be;:e$)g):i&\u0016e\u0005\u0008e.\u000Ce\u0016\u0004i)1e\n(d8\u000Bi\u001D\"d8\re\u0006\rh/\u001Ad?!f\u0004\u000Fd9\ti\u00183e\u0005\th\u000B1e\u001B=f<\u0002d:.e\u0006\u001Bd:\u000Bg\u000E)e.6g>$d<\u0017e\u0006\u001Cf0\u0011e\r3e\u000F/e\u0010\rg(1e.6e\u00057e\n(g\u0014;f\u00033e\u00080f3(f\u0018\u000Ee0\u000Fe-&f\u0000'h\u0003=h\u0000\u0003g \u0014g!,d;6h'\u0002g\u001C\u000Bf8\u0005f%\u001Af\u0010\u001Eg,\u0011i&\u0016i \u0001i;\u0004i\u0007\u0011i\u0000\u0002g\u0014(f1\u001Fh\u000B\u000Fg\u001C\u001Fe.\u001Ed8;g.!i\u00186f.5h(;e\u0006\ng?;h/\u0011f\u001D\u0003e\u0008)e\u0001\u001Ae%=d<<d9\u000Ei\u0000\u001Ah./f\u0016=e7%g\u000B\u0000f\u0005\u000Bd9\u001Fh.8g\u000E/d?\u001De\u001F9e\u0005;f&\u0002e?5e$'e\u001E\u000Bf\u001C:g%(g\u0010\u0006h'#e\u000C?e\u0010\rcuandoenviarmadridbuscariniciotiempoporquecuentaestadopuedenjuegoscontraestC!nnombretienenperfilmaneraamigosciudadcentroaunquepuedesdentroprimerpreciosegC:nbuenosvolverpuntossemanahabC-aagostonuevosunidoscarlosequiponiC1osmuchosalgunacorreoimagenpartirarribamarC-ahombreempleoverdadcambiomuchasfueronpasadolC-neaparecenuevascursosestabaquierolibroscuantoaccesomiguelvarioscuatrotienesgruposserC!neuropamediosfrenteacercademC!sofertacochesmodeloitalialetrasalgC:ncompracualesexistecuerposiendoprensallegarviajesdineromurciapodrC!puestodiariopuebloquieremanuelpropiocrisisciertoseguromuertefuentecerrargrandeefectopartesmedidapropiaofrecetierrae-mailvariasformasfuturoobjetoseguirriesgonormasmismosC:nicocaminositiosrazC3ndebidopruebatoledotenC-ajesC:sesperococinaorigentiendacientocC!dizhablarserC-alatinafuerzaestiloguerraentrarC)xitolC3pezagendavC-deoevitarpaginametrosjavierpadresfC!cilcabezaC!reassalidaenvC-ojapC3nabusosbienestextosllevarpuedanfuertecomC:nclaseshumanotenidobilbaounidadestC!seditarcreadoP4P;Q\u000FQ\u0007Q\u0002P>P:P0P:P8P;P8Q\rQ\u0002P>P2Q\u0001P5P5P3P>P?Q\u0000P8Q\u0002P0P:P5Q\tP5Q\u0003P6P5P\u001AP0P:P1P5P7P1Q\u000BP;P>P=P8P\u0012Q\u0001P5P?P>P4P-Q\u0002P>Q\u0002P>P<Q\u0007P5P<P=P5Q\u0002P;P5Q\u0002Q\u0000P0P7P>P=P0P3P4P5P<P=P5P\u0014P;Q\u000FP\u001FQ\u0000P8P=P0Q\u0001P=P8Q\u0005Q\u0002P5P<P:Q\u0002P>P3P>P4P2P>Q\u0002Q\u0002P0P<P!P(P\u0010P<P0Q\u000FP'Q\u0002P>P2P0Q\u0001P2P0P<P5P<Q\u0003P\"P0P:P4P2P0P=P0P<Q\rQ\u0002P8Q\rQ\u0002Q\u0003P\u0012P0P<Q\u0002P5Q\u0005P?Q\u0000P>Q\u0002Q\u0003Q\u0002P=P0P4P4P=Q\u000FP\u0012P>Q\u0002Q\u0002Q\u0000P8P=P5P9P\u0012P0Q\u0001P=P8P<Q\u0001P0P<Q\u0002P>Q\u0002Q\u0000Q\u0003P1P\u001EP=P8P<P8Q\u0000P=P5P5P\u001EP\u001EP\u001EP;P8Q\u0006Q\rQ\u0002P0P\u001EP=P0P=P5P<P4P>P<P<P>P9P4P2P5P>P=P>Q\u0001Q\u0003P4`$\u0015`%\u0007`$9`%\u0008`$\u0015`%\u0000`$8`%\u0007`$\u0015`$>`$\u0015`%\u000B`$\u0014`$0`$*`$0`$(`%\u0007`$\u000F`$\u0015`$\u0015`$?`$-`%\u0000`$\u0007`$8`$\u0015`$0`$$`%\u000B`$9`%\u000B`$\u0006`$*`$9`%\u0000`$/`$9`$/`$>`$$`$\u0015`$%`$>jagran`$\u0006`$\u001C`$\u001C`%\u000B`$\u0005`$,`$&`%\u000B`$\u0017`$\u0008`$\u001C`$>`$\u0017`$\u000F`$9`$.`$\u0007`$(`$5`$9`$/`%\u0007`$%`%\u0007`$%`%\u0000`$\u0018`$0`$\u001C`$,`$&`%\u0000`$\u0015`$\u0008`$\u001C`%\u0000`$5`%\u0007`$(`$\u0008`$(`$\u000F`$9`$0`$\t`$8`$.`%\u0007`$\u0015`$.`$5`%\u000B`$2`%\u0007`$8`$,`$.`$\u0008`$&`%\u0007`$\u0013`$0`$\u0006`$.`$,`$8`$-`$0`$,`$(`$\u001A`$2`$.`$(`$\u0006`$\u0017`$8`%\u0000`$2`%\u0000X9Y\u0004Y\tX%Y\u0004Y\tY\u0007X0X'X\"X.X1X9X/X/X'Y\u0004Y\tY\u0007X0Y\u0007X5Y\u0008X1X:Y\nX1Y\u0003X'Y\u0006Y\u0008Y\u0004X'X(Y\nY\u0006X9X1X6X0Y\u0004Y\u0003Y\u0007Y\u0006X'Y\nY\u0008Y\u0005Y\u0002X'Y\u0004X9Y\u0004Y\nX'Y\u0006X'Y\u0004Y\u0003Y\u0006X-X*Y\tY\u0002X(Y\u0004Y\u0008X-X)X'X.X1Y\u0001Y\u0002X7X9X(X/X1Y\u0003Y\u0006X%X0X'Y\u0003Y\u0005X'X'X-X/X%Y\u0004X'Y\u0001Y\nY\u0007X(X9X6Y\u0003Y\nY\u0001X(X-X+Y\u0008Y\u0005Y\u0006Y\u0008Y\u0007Y\u0008X#Y\u0006X'X,X/X'Y\u0004Y\u0007X'X3Y\u0004Y\u0005X9Y\u0006X/Y\u0004Y\nX3X9X(X1X5Y\u0004Y\tY\u0005Y\u0006X0X(Y\u0007X'X#Y\u0006Y\u0007Y\u0005X+Y\u0004Y\u0003Y\u0006X*X'Y\u0004X'X-Y\nX+Y\u0005X5X1X4X1X-X-Y\u0008Y\u0004Y\u0008Y\u0001Y\nX'X0X'Y\u0004Y\u0003Y\u0004Y\u0005X1X)X'Y\u0006X*X'Y\u0004Y\u0001X#X(Y\u0008X.X'X5X#Y\u0006X*X'Y\u0006Y\u0007X'Y\u0004Y\nX9X6Y\u0008Y\u0008Y\u0002X/X'X(Y\u0006X.Y\nX1X(Y\u0006X*Y\u0004Y\u0003Y\u0005X4X'X!Y\u0008Y\u0007Y\nX'X(Y\u0008Y\u0002X5X5Y\u0008Y\u0005X'X1Y\u0002Y\u0005X#X-X/Y\u0006X-Y\u0006X9X/Y\u0005X1X#Y\nX'X-X)Y\u0003X*X(X/Y\u0008Y\u0006Y\nX,X(Y\u0005Y\u0006Y\u0007X*X-X*X,Y\u0007X)X3Y\u0006X)Y\nX*Y\u0005Y\u0003X1X)X:X2X)Y\u0006Y\u0001X3X(Y\nX*Y\u0004Y\u0004Y\u0007Y\u0004Y\u0006X'X*Y\u0004Y\u0003Y\u0002Y\u0004X(Y\u0004Y\u0005X'X9Y\u0006Y\u0007X#Y\u0008Y\u0004X4Y\nX!Y\u0006Y\u0008X1X#Y\u0005X'Y\u0001Y\nY\u0003X(Y\u0003Y\u0004X0X'X*X1X*X(X(X#Y\u0006Y\u0007Y\u0005X3X'Y\u0006Y\u0003X(Y\nX9Y\u0001Y\u0002X/X-X3Y\u0006Y\u0004Y\u0007Y\u0005X4X9X1X#Y\u0007Y\u0004X4Y\u0007X1Y\u0002X7X1X7Y\u0004X(profileservicedefaulthimselfdetailscontentsupportstartedmessagesuccessfashion<title>countryaccountcreatedstoriesresultsrunningprocesswritingobjectsvisiblewelcomearticleunknownnetworkcompanydynamicbrowserprivacyproblemServicerespectdisplayrequestreservewebsitehistoryfriendsoptionsworkingversionmillionchannelwindow.addressvisitedweathercorrectproductedirectforwardyou canremovedsubjectcontrolarchivecurrentreadinglibrarylimitedmanagerfurthersummarymachineminutesprivatecontextprogramsocietynumberswrittenenabledtriggersourcesloadingelementpartnerfinallyperfectmeaningsystemskeepingculture&quot;,journalprojectsurfaces&quot;expiresreviewsbalanceEnglishContentthroughPlease opinioncontactaverageprimaryvillageSpanishgallerydeclinemeetingmissionpopularqualitymeasuregeneralspeciessessionsectionwriterscounterinitialreportsfiguresmembersholdingdisputeearlierexpressdigitalpictureAnothermarriedtrafficleadingchangedcentralvictoryimages/reasonsstudiesfeaturelistingmust beschoolsVersionusuallyepisodeplayinggrowingobviousoverlaypresentactions</ul>\r\nwrapperalreadycertainrealitystorageanotherdesktopofferedpatternunusualDigitalcapitalWebsitefailureconnectreducedAndroiddecadesregular &amp; animalsreleaseAutomatgettingmethodsnothingPopularcaptionletterscapturesciencelicensechangesEngland=1&amp;History = new CentralupdatedSpecialNetworkrequirecommentwarningCollegetoolbarremainsbecauseelectedDeutschfinanceworkersquicklybetweenexactlysettingdiseaseSocietyweaponsexhibit&lt;!--Controlclassescoveredoutlineattacksdevices(windowpurposetitle=\"Mobile killingshowingItaliandroppedheavilyeffects-1']);\nconfirmCurrentadvancesharingopeningdrawingbillionorderedGermanyrelated</form>includewhetherdefinedSciencecatalogArticlebuttonslargestuniformjourneysidebarChicagoholidayGeneralpassage,&quot;animatefeelingarrivedpassingnaturalroughly.\n\nThe but notdensityBritainChineselack oftributeIreland\" data-factorsreceivethat isLibraryhusbandin factaffairsCharlesradicalbroughtfindinglanding:lang=\"return leadersplannedpremiumpackageAmericaEdition]&quot;Messageneed tovalue=\"complexlookingstationbelievesmaller-mobilerecordswant tokind ofFirefoxyou aresimilarstudiedmaximumheadingrapidlyclimatekingdomemergedamountsfoundedpioneerformuladynastyhow to SupportrevenueeconomyResultsbrothersoldierlargelycalling.&quot;AccountEdward segmentRobert effortsPacificlearnedup withheight:we haveAngelesnations_searchappliedacquiremassivegranted: falsetreatedbiggestbenefitdrivingStudiesminimumperhapsmorningsellingis usedreversevariant role=\"missingachievepromotestudentsomeoneextremerestorebottom:evolvedall thesitemapenglishway to AugustsymbolsCompanymattersmusicalagainstserving})();\r\npaymenttroubleconceptcompareparentsplayersregionsmonitor ''The winningexploreadaptedGalleryproduceabilityenhancecareers). The collectSearch ancientexistedfooter handlerprintedconsoleEasternexportswindowsChannelillegalneutralsuggest_headersigning.html\">settledwesterncausing-webkitclaimedJusticechaptervictimsThomas mozillapromisepartieseditionoutside:false,hundredOlympic_buttonauthorsreachedchronicdemandssecondsprotectadoptedprepareneithergreatlygreateroverallimprovecommandspecialsearch.worshipfundingthoughthighestinsteadutilityquarterCulturetestingclearlyexposedBrowserliberal} catchProjectexamplehide();FloridaanswersallowedEmperordefenseseriousfreedomSeveral-buttonFurtherout of != nulltrainedDenmarkvoid(0)/all.jspreventRequestStephen\n\nWhen observe</h2>\r\nModern provide\" alt=\"borders.\n\nFor \n\nMany artistspoweredperformfictiontype ofmedicalticketsopposedCouncilwitnessjusticeGeorge Belgium...</a>twitternotablywaitingwarfare Other rankingphrasesmentionsurvivescholar</p>\r\n Countryignoredloss ofjust asGeorgiastrange<head><stopped1']);\r\nislandsnotableborder:list ofcarried100,000</h3>\n severalbecomesselect wedding00.htmlmonarchoff theteacherhighly biologylife ofor evenrise of&raquo;plusonehunting(thoughDouglasjoiningcirclesFor theAncientVietnamvehiclesuch ascrystalvalue =Windowsenjoyeda smallassumed<a id=\"foreign All rihow theDisplayretiredhoweverhidden;battlesseekingcabinetwas notlook atconductget theJanuaryhappensturninga:hoverOnline French lackingtypicalextractenemieseven ifgeneratdecidedare not/searchbeliefs-image:locatedstatic.login\">convertviolententeredfirst\">circuitFinlandchemistshe was10px;\">as suchdivided</span>will beline ofa greatmystery/index.fallingdue to railwaycollegemonsterdescentit withnuclearJewish protestBritishflowerspredictreformsbutton who waslectureinstantsuicidegenericperiodsmarketsSocial fishingcombinegraphicwinners<br /><by the NaturalPrivacycookiesoutcomeresolveSwedishbrieflyPersianso muchCenturydepictscolumnshousingscriptsnext tobearingmappingrevisedjQuery(-width:title\">tooltipSectiondesignsTurkishyounger.match(})();\n\nburningoperatedegreessource=Richardcloselyplasticentries</tr>\r\ncolor:#ul id=\"possessrollingphysicsfailingexecutecontestlink toDefault<br />\n: true,chartertourismclassicproceedexplain</h1>\r\nonline.?xml vehelpingdiamonduse theairlineend -->).attr(readershosting#ffffffrealizeVincentsignals src=\"/ProductdespitediversetellingPublic held inJoseph theatreaffects<style>a largedoesn'tlater, ElementfaviconcreatorHungaryAirportsee theso thatMichaelSystemsPrograms, and width=e&quot;tradingleft\">\npersonsGolden Affairsgrammarformingdestroyidea ofcase ofoldest this is.src = cartoonregistrCommonsMuslimsWhat isin manymarkingrevealsIndeed,equally/show_aoutdoorescape(Austriageneticsystem,In the sittingHe alsoIslandsAcademy\n\t\t<!--Daniel bindingblock\">imposedutilizeAbraham(except{width:putting).html(|| [];\nDATA[ *kitchenmountedactual dialectmainly _blank'installexpertsif(typeIt also&copy; \">Termsborn inOptionseasterntalkingconcerngained ongoingjustifycriticsfactoryits ownassaultinvitedlastinghis ownhref=\"/\" rel=\"developconcertdiagramdollarsclusterphp?id=alcohol);})();using a><span>vesselsrevivalAddressamateurandroidallegedillnesswalkingcentersqualifymatchesunifiedextinctDefensedied in\n\t<!-- customslinkingLittle Book ofeveningmin.js?are thekontakttoday's.html\" target=wearingAll Rig;\n})();raising Also, crucialabout\">declare-->\n<scfirefoxas muchappliesindex, s, but type = \n\r\n<!--towardsRecordsPrivateForeignPremierchoicesVirtualreturnsCommentPoweredinline;povertychamberLiving volumesAnthonylogin\" RelatedEconomyreachescuttinggravitylife inChapter-shadowNotable</td>\r\n returnstadiumwidgetsvaryingtravelsheld bywho arework infacultyangularwho hadairporttown of\n\nSome 'click'chargeskeywordit willcity of(this);Andrew unique checkedor more300px; return;rsion=\"pluginswithin herselfStationFederalventurepublishsent totensionactresscome tofingersDuke ofpeople,exploitwhat isharmonya major\":\"httpin his menu\">\nmonthlyofficercouncilgainingeven inSummarydate ofloyaltyfitnessand wasemperorsupremeSecond hearingRussianlongestAlbertalateralset of small\">.appenddo withfederalbank ofbeneathDespiteCapitalgrounds), and percentit fromclosingcontainInsteadfifteenas well.yahoo.respondfighterobscurereflectorganic= Math.editingonline paddinga wholeonerroryear ofend of barrierwhen itheader home ofresumedrenamedstrong>heatingretainscloudfrway of March 1knowingin partBetweenlessonsclosestvirtuallinks\">crossedEND -->famous awardedLicenseHealth fairly wealthyminimalAfricancompetelabel\">singingfarmersBrasil)discussreplaceGregoryfont copursuedappearsmake uproundedboth ofblockedsaw theofficescoloursif(docuwhen heenforcepush(fuAugust UTF-8\">Fantasyin mostinjuredUsuallyfarmingclosureobject defenceuse of Medical<body>\nevidentbe usedkeyCodesixteenIslamic#000000entire widely active (typeofone cancolor =speakerextendsPhysicsterrain<tbody>funeralviewingmiddle cricketprophetshifteddoctorsRussell targetcompactalgebrasocial-bulk ofman and</td>\n he left).val()false);logicalbankinghome tonaming Arizonacredits);\n});\nfounderin turnCollinsbefore But thechargedTitle\">CaptainspelledgoddessTag -->Adding:but wasRecent patientback in=false&Lincolnwe knowCounterJudaismscript altered']);\n has theunclearEvent',both innot all\n\n<!-- placinghard to centersort ofclientsstreetsBernardassertstend tofantasydown inharbourFreedomjewelry/about..searchlegendsis mademodern only ononly toimage\" linear painterand notrarely acronymdelivershorter00&amp;as manywidth=\"/* <![Ctitle =of the lowest picked escapeduses ofpeoples PublicMatthewtacticsdamagedway forlaws ofeasy to windowstrong simple}catch(seventhinfoboxwent topaintedcitizenI don'tretreat. Some ww.\");\nbombingmailto:made in. Many carries||{};wiwork ofsynonymdefeatsfavoredopticalpageTraunless sendingleft\"><comScorAll thejQuery.touristClassicfalse\" Wilhelmsuburbsgenuinebishops.split(global followsbody ofnominalContactsecularleft tochiefly-hidden-banner</li>\n\n. When in bothdismissExplorealways via thespaC1olwelfareruling arrangecaptainhis sonrule ofhe tookitself,=0&amp;(calledsamplesto makecom/pagMartin Kennedyacceptsfull ofhandledBesides//--></able totargetsessencehim to its by common.mineralto takeways tos.org/ladvisedpenaltysimple:if theyLettersa shortHerbertstrikes groups.lengthflightsoverlapslowly lesser social </p>\n\t\tit intoranked rate oful>\r\n attemptpair ofmake itKontaktAntoniohaving ratings activestreamstrapped\").css(hostilelead tolittle groups,Picture-->\r\n\r\n rows=\" objectinverse<footerCustomV><\\/scrsolvingChamberslaverywoundedwhereas!= 'undfor allpartly -right:Arabianbacked centuryunit ofmobile-Europe,is homerisk ofdesiredClintoncost ofage of become none ofp&quot;Middle ead')[0Criticsstudios>&copy;group\">assemblmaking pressedwidget.ps:\" ? rebuiltby someFormer editorsdelayedCanonichad thepushingclass=\"but arepartialBabylonbottom carrierCommandits useAs withcoursesa thirddenotesalso inHouston20px;\">accuseddouble goal ofFamous ).bind(priests Onlinein Julyst + \"gconsultdecimalhelpfulrevivedis veryr'+'iptlosing femalesis alsostringsdays ofarrivalfuture <objectforcingString(\" />\n\t\there isencoded. The balloondone by/commonbgcolorlaw of Indianaavoidedbut the2px 3pxjquery.after apolicy.men andfooter-= true;for usescreen.Indian image =family,http:// &nbsp;driverseternalsame asnoticedviewers})();\n is moreseasonsformer the newis justconsent Searchwas thewhy theshippedbr><br>width: height=made ofcuisineis thata very Admiral fixed;normal MissionPress, ontariocharsettry to invaded=\"true\"spacingis mosta more totallyfall of});\r\n immensetime inset outsatisfyto finddown tolot of Playersin Junequantumnot thetime todistantFinnishsrc = (single help ofGerman law andlabeledforestscookingspace\">header-well asStanleybridges/globalCroatia About [0];\n it, andgroupedbeing a){throwhe madelighterethicalFFFFFF\"bottom\"like a employslive inas seenprintermost ofub-linkrejectsand useimage\">succeedfeedingNuclearinformato helpWomen'sNeitherMexicanprotein<table by manyhealthylawsuitdevised.push({sellerssimply Through.cookie Image(older\">us.js\"> Since universlarger open to!-- endlies in']);\r\n marketwho is (\"DOMComanagedone fortypeof Kingdomprofitsproposeto showcenter;made itdressedwere inmixtureprecisearisingsrc = 'make a securedBaptistvoting \n\t\tvar March 2grew upClimate.removeskilledway the</head>face ofacting right\">to workreduceshas haderectedshow();action=book ofan area== \"htt<header\n<html>conformfacing cookie.rely onhosted .customhe wentbut forspread Family a meansout theforums.footage\">MobilClements\" id=\"as highintense--><!--female is seenimpliedset thea stateand hisfastestbesidesbutton_bounded\"><img Infoboxevents,a youngand areNative cheaperTimeoutand hasengineswon the(mostlyright: find a -bottomPrince area ofmore ofsearch_nature,legallyperiod,land ofor withinducedprovingmissilelocallyAgainstthe wayk&quot;px;\">\r\npushed abandonnumeralCertainIn thismore inor somename isand, incrownedISBN 0-createsOctobermay notcenter late inDefenceenactedwish tobroadlycoolingonload=it. TherecoverMembersheight assumes<html>\npeople.in one =windowfooter_a good reklamaothers,to this_cookiepanel\">London,definescrushedbaptismcoastalstatus title\" move tolost inbetter impliesrivalryservers SystemPerhapses and contendflowinglasted rise inGenesisview ofrising seem tobut in backinghe willgiven agiving cities.flow of Later all butHighwayonly bysign ofhe doesdiffersbattery&amp;lasinglesthreatsintegertake onrefusedcalled =US&ampSee thenativesby thissystem.head of:hover,lesbiansurnameand allcommon/header__paramsHarvard/pixel.removalso longrole ofjointlyskyscraUnicodebr />\r\nAtlantanucleusCounty,purely count\">easily build aonclicka givenpointerh&quot;events else {\nditionsnow the, with man whoorg/Webone andcavalryHe diedseattle00,000 {windowhave toif(windand itssolely m&quot;renewedDetroitamongsteither them inSenatorUs</a><King ofFrancis-produche usedart andhim andused byscoringat hometo haverelatesibilityfactionBuffalolink\"><what hefree toCity ofcome insectorscountedone daynervoussquare };if(goin whatimg\" alis onlysearch/tuesdaylooselySolomonsexual - <a hrmedium\"DO NOT France,with a war andsecond take a >\r\n\r\n\r\nmarket.highwaydone inctivity\"last\">obligedrise to\"undefimade to Early praisedin its for hisathleteJupiterYahoo! termed so manyreally s. The a woman?value=direct right\" bicycleacing=\"day andstatingRather,higher Office are nowtimes, when a pay foron this-link\">;borderaround annual the Newput the.com\" takin toa brief(in thegroups.; widthenzymessimple in late{returntherapya pointbanninginks\">\n();\" rea place\\u003Caabout atr>\r\n\t\tccount gives a<SCRIPTRailwaythemes/toolboxById(\"xhumans,watchesin some if (wicoming formats Under but hashanded made bythan infear ofdenoted/iframeleft involtagein eacha&quot;base ofIn manyundergoregimesaction </p>\r\n<ustomVa;&gt;</importsor thatmostly &amp;re size=\"</a></ha classpassiveHost = WhetherfertileVarious=[];(fucameras/></td>acts asIn some>\r\n\r\n<!organis <br />BeijingcatalC deutscheuropeueuskaragaeilgesvenskaespaC1amensajeusuariotrabajomC)xicopC!ginasiempresistemaoctubreduranteaC1adirempresamomentonuestroprimeratravC)sgraciasnuestraprocesoestadoscalidadpersonanC:meroacuerdomC:sicamiembroofertasalgunospaC-sesejemploderechoademC!sprivadoagregarenlacesposiblehotelessevillaprimeroC:ltimoeventosarchivoculturamujeresentradaanuncioembargomercadograndesestudiomejoresfebrerodiseC1oturismocC3digoportadaespaciofamiliaantoniopermiteguardaralgunaspreciosalguiensentidovisitastC-tuloconocersegundoconsejofranciaminutossegundatenemosefectosmC!lagasesiC3nrevistagranadacompraringresogarcC-aacciC3necuadorquienesinclusodeberC!materiahombresmuestrapodrC-amaC1anaC:ltimaestamosoficialtambienningC:nsaludospodemosmejorarpositionbusinesshomepagesecuritylanguagestandardcampaignfeaturescategoryexternalchildrenreservedresearchexchangefavoritetemplatemilitaryindustryservicesmaterialproductsz-index:commentssoftwarecompletecalendarplatformarticlesrequiredmovementquestionbuildingpoliticspossiblereligionphysicalfeedbackregisterpicturesdisabledprotocolaudiencesettingsactivityelementslearninganythingabstractprogressoverviewmagazineeconomictrainingpressurevarious <strong>propertyshoppingtogetheradvancedbehaviordownloadfeaturedfootballselectedLanguagedistanceremembertrackingpasswordmodifiedstudentsdirectlyfightingnortherndatabasefestivalbreakinglocationinternetdropdownpracticeevidencefunctionmarriageresponseproblemsnegativeprogramsanalysisreleasedbanner\">purchasepoliciesregionalcreativeargumentbookmarkreferrerchemicaldivisioncallbackseparateprojectsconflicthardwareinterestdeliverymountainobtained= false;for(var acceptedcapacitycomputeridentityaircraftemployedproposeddomesticincludesprovidedhospitalverticalcollapseapproachpartnerslogo\"><adaughterauthor\" culturalfamilies/images/assemblypowerfulteachingfinisheddistrictcriticalcgi-bin/purposesrequireselectionbecomingprovidesacademicexerciseactuallymedicineconstantaccidentMagazinedocumentstartingbottom\">observed: &quot;extendedpreviousSoftwarecustomerdecisionstrengthdetailedslightlyplanningtextareacurrencyeveryonestraighttransferpositiveproducedheritageshippingabsolutereceivedrelevantbutton\" violenceanywherebenefitslaunchedrecentlyalliancefollowedmultiplebulletinincludedoccurredinternal$(this).republic><tr><tdcongressrecordedultimatesolution<ul id=\"discoverHome</a>websitesnetworksalthoughentirelymemorialmessagescontinueactive\">somewhatvictoriaWestern title=\"LocationcontractvisitorsDownloadwithout right\">\nmeasureswidth = variableinvolvedvirginianormallyhappenedaccountsstandingnationalRegisterpreparedcontrolsaccuratebirthdaystrategyofficialgraphicscriminalpossiblyconsumerPersonalspeakingvalidateachieved.jpg\" />machines</h2>\n keywordsfriendlybrotherscombinedoriginalcomposedexpectedadequatepakistanfollow\" valuable</label>relativebringingincreasegovernorplugins/List of Header\">\" name=\" (&quot;graduate</head>\ncommercemalaysiadirectormaintain;height:schedulechangingback to catholicpatternscolor: #greatestsuppliesreliable</ul>\n\t\t<select citizensclothingwatching<li id=\"specificcarryingsentence<center>contrastthinkingcatch(e)southernMichael merchantcarouselpadding:interior.split(\"lizationOctober ){returnimproved--&gt;\n\ncoveragechairman.png\" />subjectsRichard whateverprobablyrecoverybaseballjudgmentconnect..css\" /> websitereporteddefault\"/></a>\r\nelectricscotlandcreationquantity. ISBN 0did not instance-search-\" lang=\"speakersComputercontainsarchivesministerreactiondiscountItalianocriteriastrongly: 'http:'script'coveringofferingappearedBritish identifyFacebooknumerousvehiclesconcernsAmericanhandlingdiv id=\"William provider_contentaccuracysection andersonflexibleCategorylawrence<script>layout=\"approved maximumheader\"></table>Serviceshamiltoncurrent canadianchannels/themes//articleoptionalportugalvalue=\"\"intervalwirelessentitledagenciesSearch\" measuredthousandspending&hellip;new Date\" size=\"pageNamemiddle\" \" /></a>hidden\">sequencepersonaloverflowopinionsillinoislinks\">\n\t<title>versionssaturdayterminalitempropengineersectionsdesignerproposal=\"false\"EspaC1olreleasessubmit\" er&quot;additionsymptomsorientedresourceright\"><pleasurestationshistory.leaving border=contentscenter\">.\n\nSome directedsuitablebulgaria.show();designedGeneral conceptsExampleswilliamsOriginal\"><span>search\">operatorrequestsa &quot;allowingDocumentrevision. \n\nThe yourselfContact michiganEnglish columbiapriorityprintingdrinkingfacilityreturnedContent officersRussian generate-8859-1\"indicatefamiliar qualitymargin:0 contentviewportcontacts-title\">portable.length eligibleinvolvesatlanticonload=\"default.suppliedpaymentsglossary\n\nAfter guidance</td><tdencodingmiddle\">came to displaysscottishjonathanmajoritywidgets.clinicalthailandteachers<head>\n\taffectedsupportspointer;toString</small>oklahomawill be investor0\" alt=\"holidaysResourcelicensed (which . After considervisitingexplorerprimary search\" android\"quickly meetingsestimate;return ;color:# height=approval, &quot; checked.min.js\"magnetic></a></hforecast. While thursdaydvertise&eacute;hasClassevaluateorderingexistingpatients Online coloradoOptions\"campbell<!-- end</span><<br />\r\n_popups|sciences,&quot; quality Windows assignedheight: <b classle&quot; value=\" Companyexamples<iframe believespresentsmarshallpart of properly).\n\nThe taxonomymuch of </span>\n\" data-srtuguC*sscrollTo project<head>\r\nattorneyemphasissponsorsfancyboxworld's wildlifechecked=sessionsprogrammpx;font- Projectjournalsbelievedvacationthompsonlightingand the special border=0checking</tbody><button Completeclearfix\n<head>\narticle <sectionfindingsrole in popular Octoberwebsite exposureused to changesoperatedclickingenteringcommandsinformed numbers </div>creatingonSubmitmarylandcollegesanalyticlistingscontact.loggedInadvisorysiblingscontent\"s&quot;)s. This packagescheckboxsuggestspregnanttomorrowspacing=icon.pngjapanesecodebasebutton\">gamblingsuch as , while </span> missourisportingtop:1px .</span>tensionswidth=\"2lazyloadnovemberused in height=\"cript\">\n&nbsp;</<tr><td height:2/productcountry include footer\" &lt;!-- title\"></jquery.</form>\n(g.\u0000d=\u0013)(g9\u0001i+\u0014)hrvatskiitalianoromC\"nD\u0003tC<rkC'eX'X1X/Y\u0008tambiC)nnoticiasmensajespersonasderechosnacionalserviciocontactousuariosprogramagobiernoempresasanunciosvalenciacolombiadespuC)sdeportesproyectoproductopC:bliconosotroshistoriapresentemillonesmediantepreguntaanteriorrecursosproblemasantiagonuestrosopiniC3nimprimirmientrasamC)ricavendedorsociedadrespectorealizarregistropalabrasinterC)sentoncesespecialmiembrosrealidadcC3rdobazaragozapC!ginassocialesbloqueargestiC3nalquilersistemascienciascompletoversiC3ncompletaestudiospC:blicaobjetivoalicantebuscadorcantidadentradasaccionesarchivossuperiormayorC-aalemaniafunciC3nC:ltimoshaciendoaquellosediciC3nfernandoambientefacebooknuestrasclientesprocesosbastantepresentareportarcongresopublicarcomerciocontratojC3venesdistritotC)cnicaconjuntoenergC-atrabajarasturiasrecienteutilizarboletC-nsalvadorcorrectatrabajosprimerosnegocioslibertaddetallespantallaprC3ximoalmerC-aanimalesquiC)nescorazC3nsecciC3nbuscandoopcionesexteriorconceptotodavC-agalerC-aescribirmedicinalicenciaconsultaaspectoscrC-ticadC3laresjusticiadeberC!nperC-odonecesitamantenerpequeC1orecibidatribunaltenerifecanciC3ncanariasdescargadiversosmallorcarequieretC)cnicodeberC-aviviendafinanzasadelantefuncionaconsejosdifC-cilciudadesantiguasavanzadatC)rminounidadessC!nchezcampaC1asoftonicrevistascontienesectoresmomentosfacultadcrC)ditodiversassupuestofactoressegundospequeC1aP3P>P4P0P5Q\u0001P;P8P5Q\u0001Q\u0002Q\u000CP1Q\u000BP;P>P1Q\u000BQ\u0002Q\u000CQ\rQ\u0002P>P<P\u0015Q\u0001P;P8Q\u0002P>P3P>P<P5P=Q\u000FP2Q\u0001P5Q\u0005Q\rQ\u0002P>P9P4P0P6P5P1Q\u000BP;P8P3P>P4Q\u0003P4P5P=Q\u000CQ\rQ\u0002P>Q\u0002P1Q\u000BP;P0Q\u0001P5P1Q\u000FP>P4P8P=Q\u0001P5P1P5P=P0P4P>Q\u0001P0P9Q\u0002Q\u0004P>Q\u0002P>P=P5P3P>Q\u0001P2P>P8Q\u0001P2P>P9P8P3Q\u0000Q\u000BQ\u0002P>P6P5P2Q\u0001P5P<Q\u0001P2P>Q\u000EP;P8Q\u0008Q\u000CQ\rQ\u0002P8Q\u0005P?P>P:P0P4P=P5P9P4P>P<P0P<P8Q\u0000P0P;P8P1P>Q\u0002P5P<Q\u0003Q\u0005P>Q\u0002Q\u000FP4P2Q\u0003Q\u0005Q\u0001P5Q\u0002P8P;Q\u000EP4P8P4P5P;P>P<P8Q\u0000P5Q\u0002P5P1Q\u000FQ\u0001P2P>P5P2P8P4P5Q\u0007P5P3P>Q\rQ\u0002P8P<Q\u0001Q\u0007P5Q\u0002Q\u0002P5P<Q\u000BQ\u0006P5P=Q\u000BQ\u0001Q\u0002P0P;P2P5P4Q\u000CQ\u0002P5P<P5P2P>P4Q\u000BQ\u0002P5P1P5P2Q\u000BQ\u0008P5P=P0P<P8Q\u0002P8P?P0Q\u0002P>P<Q\u0003P?Q\u0000P0P2P;P8Q\u0006P0P>P4P=P0P3P>P4Q\u000BP7P=P0Q\u000EP<P>P3Q\u0003P4Q\u0000Q\u0003P3P2Q\u0001P5P9P8P4P5Q\u0002P:P8P=P>P>P4P=P>P4P5P;P0P4P5P;P5Q\u0001Q\u0000P>P:P8Q\u000EP=Q\u000FP2P5Q\u0001Q\u000CP\u0015Q\u0001Q\u0002Q\u000CQ\u0000P0P7P0P=P0Q\u0008P8X'Y\u0004Y\u0004Y\u0007X'Y\u0004X*Y\nX,Y\u0005Y\nX9X.X'X5X)X'Y\u0004X0Y\nX9Y\u0004Y\nY\u0007X,X/Y\nX/X'Y\u0004X\"Y\u0006X'Y\u0004X1X/X*X-Y\u0003Y\u0005X5Y\u0001X-X)Y\u0003X'Y\u0006X*X'Y\u0004Y\u0004Y\nY\nY\u0003Y\u0008Y\u0006X4X(Y\u0003X)Y\u0001Y\nY\u0007X'X(Y\u0006X'X*X-Y\u0008X'X!X#Y\u0003X+X1X.Y\u0004X'Y\u0004X'Y\u0004X-X(X/Y\u0004Y\nY\u0004X/X1Y\u0008X3X'X6X:X7X*Y\u0003Y\u0008Y\u0006Y\u0007Y\u0006X'Y\u0003X3X'X-X)Y\u0006X'X/Y\nX'Y\u0004X7X(X9Y\u0004Y\nY\u0003X4Y\u0003X1X'Y\nY\u0005Y\u0003Y\u0006Y\u0005Y\u0006Y\u0007X'X4X1Y\u0003X)X1X&Y\nX3Y\u0006X4Y\nX7Y\u0005X'X0X'X'Y\u0004Y\u0001Y\u0006X4X(X'X(X*X9X(X1X1X-Y\u0005X)Y\u0003X'Y\u0001X)Y\nY\u0002Y\u0008Y\u0004Y\u0005X1Y\u0003X2Y\u0003Y\u0004Y\u0005X)X#X-Y\u0005X/Y\u0002Y\u0004X(Y\nY\nX9Y\u0006Y\nX5Y\u0008X1X)X7X1Y\nY\u0002X4X'X1Y\u0003X,Y\u0008X'Y\u0004X#X.X1Y\tY\u0005X9Y\u0006X'X'X(X-X+X9X1Y\u0008X6X(X4Y\u0003Y\u0004Y\u0005X3X,Y\u0004X(Y\u0006X'Y\u0006X.X'Y\u0004X/Y\u0003X*X'X(Y\u0003Y\u0004Y\nX)X(X/Y\u0008Y\u0006X#Y\nX6X'Y\nY\u0008X,X/Y\u0001X1Y\nY\u0002Y\u0003X*X(X*X#Y\u0001X6Y\u0004Y\u0005X7X(X.X'Y\u0003X+X1X(X'X1Y\u0003X'Y\u0001X6Y\u0004X'X-Y\u0004Y\tY\u0006Y\u0001X3Y\u0007X#Y\nX'Y\u0005X1X/Y\u0008X/X#Y\u0006Y\u0007X'X/Y\nY\u0006X'X'Y\u0004X'Y\u0006Y\u0005X9X1X6X*X9Y\u0004Y\u0005X/X'X.Y\u0004Y\u0005Y\u0005Y\u0003Y\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0002\u0000\u0002\u0000\u0002\u0000\u0002\u0000\u0004\u0000\u0004\u0000\u0004\u0000\u0004\u0000\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0007\u0006\u0005\u0004\u0003\u0002\u0001\u0000\u0008\t\n\u000B\u000C\r\u000E\u000F\u000F\u000E\r\u000C\u000B\n\t\u0008\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0017\u0016\u0015\u0014\u0013\u0012\u0011\u0010\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\u001F\u001E\u001D\u001C\u001B\u001A\u0019\u0018\u007F\u007F\u007F\u007F\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007F\u007F\u007F\u007F\u0001\u0000\u0000\u0000\u0002\u0000\u0000\u0000\u0002\u0000\u0000\u0000\u0001\u0000\u0000\u0000\u0001\u0000\u0000\u0000\u0003\u0000\u0000\u0000\u007F\u007F\u0000\u0001\u0000\u0000\u0000\u0001\u0000\u0000\u007F\u007F\u0000\u0001\u0000\u0000\u0000\u0008\u0000\u0008\u0000\u0008\u0000\u0008\u0000\u0000\u0000\u0001\u0000\u0002\u0000\u0003\u0000\u0004\u0000\u0005\u0000\u0006\u0000\u0007resourcescountriesquestionsequipmentcommunityavailablehighlightDTD/xhtmlmarketingknowledgesomethingcontainerdirectionsubscribeadvertisecharacter\" value=\"</select>Australia\" class=\"situationauthorityfollowingprimarilyoperationchallengedevelopedanonymousfunction functionscompaniesstructureagreement\" title=\"potentialeducationargumentssecondarycopyrightlanguagesexclusivecondition</form>\r\nstatementattentionBiography} else {\nsolutionswhen the Analyticstemplatesdangeroussatellitedocumentspublisherimportantprototypeinfluence&raquo;</effectivegenerallytransformbeautifultransportorganizedpublishedprominentuntil thethumbnailNational .focus();over the migrationannouncedfooter\">\nexceptionless thanexpensiveformationframeworkterritoryndicationcurrentlyclassNamecriticismtraditionelsewhereAlexanderappointedmaterialsbroadcastmentionedaffiliate</option>treatmentdifferent/default.Presidentonclick=\"biographyotherwisepermanentFranC'aisHollywoodexpansionstandards</style>\nreductionDecember preferredCambridgeopponentsBusiness confusion>\n<title>presentedexplaineddoes not worldwideinterfacepositionsnewspaper</table>\nmountainslike the essentialfinancialselectionaction=\"/abandonedEducationparseInt(stabilityunable to</title>\nrelationsNote thatefficientperformedtwo yearsSince thethereforewrapper\">alternateincreasedBattle ofperceivedtrying tonecessaryportrayedelectionsElizabeth</iframe>discoveryinsurances.length;legendaryGeographycandidatecorporatesometimesservices.inherited</strong>CommunityreligiouslocationsCommitteebuildingsthe worldno longerbeginningreferencecannot befrequencytypicallyinto the relative;recordingpresidentinitiallytechniquethe otherit can beexistenceunderlinethis timetelephoneitemscopepracticesadvantage);return For otherprovidingdemocracyboth the extensivesufferingsupportedcomputers functionpracticalsaid thatit may beEnglish</from the scheduleddownloads</label>\nsuspectedmargin: 0spiritual</head>\n\nmicrosoftgraduallydiscussedhe becameexecutivejquery.jshouseholdconfirmedpurchasedliterallydestroyedup to thevariationremainingit is notcenturiesJapanese among thecompletedalgorithminterestsrebellionundefinedencourageresizableinvolvingsensitiveuniversalprovision(althoughfeaturingconducted), which continued-header\">February numerous overflow:componentfragmentsexcellentcolspan=\"technicalnear the Advanced source ofexpressedHong Kong Facebookmultiple mechanismelevationoffensive</form>\n\tsponsoreddocument.or &quot;there arethose whomovementsprocessesdifficultsubmittedrecommendconvincedpromoting\" width=\".replace(classicalcoalitionhis firstdecisionsassistantindicatedevolution-wrapper\"enough toalong thedelivered-->\r\n<!--American protectedNovember </style><furnitureInternet onblur=\"suspendedrecipientbased on Moreover,abolishedcollectedwere madeemotionalemergencynarrativeadvocatespx;bordercommitteddir=\"ltr\"employeesresearch. selectedsuccessorcustomersdisplayedSeptemberaddClass(Facebook suggestedand lateroperatingelaborateSometimesInstitutecertainlyinstalledfollowersJerusalemthey havecomputinggeneratedprovincesguaranteearbitraryrecognizewanted topx;width:theory ofbehaviourWhile theestimatedbegan to it becamemagnitudemust havemore thanDirectoryextensionsecretarynaturallyoccurringvariablesgiven theplatform.</label><failed tocompoundskinds of societiesalongside --&gt;\n\nsouthwestthe rightradiationmay have unescape(spoken in\" href=\"/programmeonly the come fromdirectoryburied ina similarthey were</font></Norwegianspecifiedproducingpassenger(new DatetemporaryfictionalAfter theequationsdownload.regularlydeveloperabove thelinked tophenomenaperiod oftooltip\">substanceautomaticaspect ofAmong theconnectedestimatesAir Forcesystem ofobjectiveimmediatemaking itpaintingsconqueredare stillproceduregrowth ofheaded byEuropean divisionsmoleculesfranchiseintentionattractedchildhoodalso useddedicatedsingaporedegree offather ofconflicts</a></p>\ncame fromwere usednote thatreceivingExecutiveeven moreaccess tocommanderPoliticalmusiciansdeliciousprisonersadvent ofUTF-8\" /><![CDATA[\">ContactSouthern bgcolor=\"series of. It was in Europepermittedvalidate.appearingofficialsseriously-languageinitiatedextendinglong-terminflationsuch thatgetCookiemarked by</button>implementbut it isincreasesdown the requiringdependent-->\n<!-- interviewWith the copies ofconsensuswas builtVenezuela(formerlythe statepersonnelstrategicfavour ofinventionWikipediacontinentvirtuallywhich wasprincipleComplete identicalshow thatprimitiveaway frommolecularpreciselydissolvedUnder theversion=\">&nbsp;</It is the This is will haveorganismssome timeFriedrichwas firstthe only fact thatform id=\"precedingTechnicalphysicistoccurs innavigatorsection\">span id=\"sought tobelow thesurviving}</style>his deathas in thecaused bypartiallyexisting using thewas givena list oflevels ofnotion ofOfficial dismissedscientistresemblesduplicateexplosiverecoveredall othergalleries{padding:people ofregion ofaddressesassociateimg alt=\"in modernshould bemethod ofreportingtimestampneeded tothe Greatregardingseemed toviewed asimpact onidea thatthe Worldheight ofexpandingThese arecurrent\">carefullymaintainscharge ofClassicaladdressedpredictedownership<div id=\"right\">\r\nresidenceleave thecontent\">are often })();\r\nprobably Professor-button\" respondedsays thathad to beplaced inHungarianstatus ofserves asUniversalexecutionaggregatefor whichinfectionagreed tohowever, popular\">placed onconstructelectoralsymbol ofincludingreturn toarchitectChristianprevious living ineasier toprofessor\n&lt;!-- effect ofanalyticswas takenwhere thetook overbelief inAfrikaansas far aspreventedwork witha special<fieldsetChristmasRetrieved\n\nIn the back intonortheastmagazines><strong>committeegoverninggroups ofstored inestablisha generalits firsttheir ownpopulatedan objectCaribbeanallow thedistrictswisconsinlocation.; width: inhabitedSocialistJanuary 1</footer>similarlychoice ofthe same specific business The first.length; desire todeal withsince theuserAgentconceivedindex.phpas &quot;engage inrecently,few yearswere also\n<head>\n<edited byare knowncities inaccesskeycondemnedalso haveservices,family ofSchool ofconvertednature of languageministers</object>there is a popularsequencesadvocatedThey wereany otherlocation=enter themuch morereflectedwas namedoriginal a typicalwhen theyengineerscould notresidentswednesdaythe third productsJanuary 2what theya certainreactionsprocessorafter histhe last contained\"></div>\n</a></td>depend onsearch\">\npieces ofcompetingReferencetennesseewhich has version=</span> <</header>gives thehistorianvalue=\"\">padding:0view thattogether,the most was foundsubset ofattack onchildren,points ofpersonal position:allegedlyClevelandwas laterand afterare givenwas stillscrollingdesign ofmakes themuch lessAmericans.\n\nAfter , but theMuseum oflouisiana(from theminnesotaparticlesa processDominicanvolume ofreturningdefensive00px|righmade frommouseover\" style=\"states of(which iscontinuesFranciscobuilding without awith somewho woulda form ofa part ofbefore itknown as Serviceslocation and oftenmeasuringand it ispaperbackvalues of\r\n<title>= window.determineer&quot; played byand early</center>from thisthe threepower andof &quot;innerHTML<a href=\"y:inline;Church ofthe eventvery highofficial -height: content=\"/cgi-bin/to createafrikaansesperantofranC'aislatvieE!ulietuviE3D\u000CeE!tinaD\reE!tina`9\u0004`8\u0017`8\"f\u0017%f\u001C,h*\u001Eg.\u0000d=\u0013e-\u0017g9\u0001i+\u0014e-\u0017m\u0015\u001Cj5-l\u00164d8:d;\u0000d9\u0008h.!g.\u0017f\u001C:g,\u0014h.0f\u001C,h(\u000Eh+\u0016e\r\u0000f\u001C\re\n!e\u0019(d:\u0012h\u0001\u0014g=\u0011f\u0008?e\u001C0d:'d?1d9\u0010i\u0003(e\u0007:g\t\u0008g$>f\u000E\u0012h!\u000Cf&\u001Ci\u0003(h\u0010=f <h?\u001Bd8\u0000f-%f\u0014/d;\u0018e.\u001Di*\u000Ch/\u0001g \u0001e'\u0014e\u0011\u0018d<\u001Af\u00150f\r.e:\u0013f6\u0008h49h\u0000\u0005e\n\u001Ee\u0005,e.$h.(h.:e\u000C:f71e\u001C3e8\u0002f\u0012-f\u0014>e\u0019(e\u000C\u0017d:,e8\u0002e$'e-&g\u0014\u001Fh6\nf\u001D%h6\ng.!g\u0010\u0006e\u0011\u0018d?!f\u0001/g=\u0011serviciosartC-culoargentinabarcelonacualquierpublicadoproductospolC-ticarespuestawikipediasiguientebC:squedacomunidadseguridadprincipalpreguntascontenidorespondervenezuelaproblemasdiciembrerelaciC3nnoviembresimilaresproyectosprogramasinstitutoactividadencuentraeconomC-aimC!genescontactardescargarnecesarioatenciC3ntelC)fonocomisiC3ncancionescapacidadencontraranC!lisisfavoritostC)rminosprovinciaetiquetaselementosfuncionesresultadocarC!cterpropiedadprincipionecesidadmunicipalcreaciC3ndescargaspresenciacomercialopinionesejercicioeditorialsalamancagonzC!lezdocumentopelC-cularecientesgeneralestarragonaprC!cticanovedadespropuestapacientestC)cnicasobjetivoscontactos`$.`%\u0007`$\u0002`$2`$?`$\u000F`$9`%\u0008`$\u0002`$\u0017`$/`$>`$8`$>`$%`$\u000F`$5`$\u0002`$0`$9`%\u0007`$\u0015`%\u000B`$\u0008`$\u0015`%\u0001`$\u001B`$0`$9`$>`$,`$>`$&`$\u0015`$9`$>`$8`$-`%\u0000`$9`%\u0001`$\u000F`$0`$9`%\u0000`$.`%\u0008`$\u0002`$&`$?`$(`$,`$>`$$diplodocs`$8`$.`$/`$0`%\u0002`$*`$(`$>`$.`$*`$$`$>`$+`$?`$0`$\u0014`$8`$$`$$`$0`$9`$2`%\u000B`$\u0017`$9`%\u0001`$\u0006`$,`$>`$0`$&`%\u0007`$6`$9`%\u0001`$\u0008`$\u0016`%\u0007`$2`$/`$&`$?`$\u0015`$>`$.`$5`%\u0007`$,`$$`%\u0000`$(`$,`%\u0000`$\u001A`$.`%\u000C`$$`$8`$>`$2`$2`%\u0007`$\u0016`$\u001C`%\t`$,`$.`$&`$&`$$`$%`$>`$(`$9`%\u0000`$6`$9`$0`$\u0005`$2`$\u0017`$\u0015`$-`%\u0000`$(`$\u0017`$0`$*`$>`$8`$0`$>`$$`$\u0015`$?`$\u000F`$\t`$8`%\u0007`$\u0017`$/`%\u0000`$9`%\u0002`$\u0001`$\u0006`$\u0017`%\u0007`$\u001F`%\u0000`$.`$\u0016`%\u000B`$\u001C`$\u0015`$>`$0`$\u0005`$-`%\u0000`$\u0017`$/`%\u0007`$$`%\u0001`$.`$5`%\u000B`$\u001F`$&`%\u0007`$\u0002`$\u0005`$\u0017`$0`$\u0010`$8`%\u0007`$.`%\u0007`$2`$2`$\u0017`$>`$9`$>`$2`$\n`$*`$0`$\u001A`$>`$0`$\u0010`$8`$>`$&`%\u0007`$0`$\u001C`$?`$8`$&`$?`$2`$,`$\u0002`$&`$,`$(`$>`$9`%\u0002`$\u0002`$2`$>`$\u0016`$\u001C`%\u0000`$$`$,`$\u001F`$(`$.`$?`$2`$\u0007`$8`%\u0007`$\u0006`$(`%\u0007`$(`$/`$>`$\u0015`%\u0001`$2`$2`%\t`$\u0017`$-`$>`$\u0017`$0`%\u0007`$2`$\u001C`$\u0017`$9`$0`$>`$.`$2`$\u0017`%\u0007`$*`%\u0007`$\u001C`$9`$>`$%`$\u0007`$8`%\u0000`$8`$9`%\u0000`$\u0015`$2`$>`$ `%\u0000`$\u0015`$9`$>`$\u0001`$&`%\u0002`$0`$$`$9`$$`$8`$>`$$`$/`$>`$&`$\u0006`$/`$>`$*`$>`$\u0015`$\u0015`%\u000C`$(`$6`$>`$.`$&`%\u0007`$\u0016`$/`$9`%\u0000`$0`$>`$/`$\u0016`%\u0001`$&`$2`$\u0017`%\u0000categoriesexperience</title>\r\nCopyright javascriptconditionseverything<p class=\"technologybackground<a class=\"management&copy; 201javaScriptcharactersbreadcrumbthemselveshorizontalgovernmentCaliforniaactivitiesdiscoveredNavigationtransitionconnectionnavigationappearance</title><mcheckbox\" techniquesprotectionapparentlyas well asunt', 'UA-resolutionoperationstelevisiontranslatedWashingtonnavigator. = window.impression&lt;br&gt;literaturepopulationbgcolor=\"#especially content=\"productionnewsletterpropertiesdefinitionleadershipTechnologyParliamentcomparisonul class=\".indexOf(\"conclusiondiscussioncomponentsbiologicalRevolution_containerunderstoodnoscript><permissioneach otheratmosphere onfocus=\"<form id=\"processingthis.valuegenerationConferencesubsequentwell-knownvariationsreputationphenomenondisciplinelogo.png\" (document,boundariesexpressionsettlementBackgroundout of theenterprise(\"https:\" unescape(\"password\" democratic<a href=\"/wrapper\">\nmembershiplinguisticpx;paddingphilosophyassistanceuniversityfacilitiesrecognizedpreferenceif (typeofmaintainedvocabularyhypothesis.submit();&amp;nbsp;annotationbehind theFoundationpublisher\"assumptionintroducedcorruptionscientistsexplicitlyinstead ofdimensions onClick=\"considereddepartmentoccupationsoon afterinvestmentpronouncedidentifiedexperimentManagementgeographic\" height=\"link rel=\".replace(/depressionconferencepunishmenteliminatedresistanceadaptationoppositionwell knownsupplementdeterminedh1 class=\"0px;marginmechanicalstatisticscelebratedGovernment\n\nDuring tdevelopersartificialequivalentoriginatedCommissionattachment<span id=\"there wereNederlandsbeyond theregisteredjournalistfrequentlyall of thelang=\"en\" </style>\r\nabsolute; supportingextremely mainstream</strong> popularityemployment</table>\r\n colspan=\"</form>\n conversionabout the </p></div>integrated\" lang=\"enPortuguesesubstituteindividualimpossiblemultimediaalmost allpx solid #apart fromsubject toin Englishcriticizedexcept forguidelinesoriginallyremarkablethe secondh2 class=\"<a title=\"(includingparametersprohibited= \"http://dictionaryperceptionrevolutionfoundationpx;height:successfulsupportersmillenniumhis fatherthe &quot;no-repeat;commercialindustrialencouragedamount of unofficialefficiencyReferencescoordinatedisclaimerexpeditiondevelopingcalculatedsimplifiedlegitimatesubstring(0\" class=\"completelyillustratefive yearsinstrumentPublishing1\" class=\"psychologyconfidencenumber of absence offocused onjoined thestructurespreviously></iframe>once againbut ratherimmigrantsof course,a group ofLiteratureUnlike the</a>&nbsp;\nfunction it was theConventionautomobileProtestantaggressiveafter the Similarly,\" /></div>collection\r\nfunctionvisibilitythe use ofvolunteersattractionunder the threatened*<![CDATA[importancein generalthe latter</form>\n</.indexOf('i = 0; i <differencedevoted totraditionssearch forultimatelytournamentattributesso-called }\n</style>evaluationemphasizedaccessible</section>successionalong withMeanwhile,industries</a><br />has becomeaspects ofTelevisionsufficientbasketballboth sidescontinuingan article<img alt=\"adventureshis mothermanchesterprinciplesparticularcommentaryeffects ofdecided to\"><strong>publishersJournal ofdifficultyfacilitateacceptablestyle.css\"\tfunction innovation>Copyrightsituationswould havebusinessesDictionarystatementsoften usedpersistentin Januarycomprising</title>\n\tdiplomaticcontainingperformingextensionsmay not beconcept of onclick=\"It is alsofinancial making theLuxembourgadditionalare calledengaged in\"script\");but it waselectroniconsubmit=\"\n<!-- End electricalofficiallysuggestiontop of theunlike theAustralianOriginallyreferences\n</head>\r\nrecognisedinitializelimited toAlexandriaretirementAdventuresfour years\n\n&lt;!-- increasingdecorationh3 class=\"origins ofobligationregulationclassified(function(advantagesbeing the historians<base hrefrepeatedlywilling tocomparabledesignatednominationfunctionalinside therevelationend of thes for the authorizedrefused totake placeautonomouscompromisepolitical restauranttwo of theFebruary 2quality ofswfobject.understandnearly allwritten byinterviews\" width=\"1withdrawalfloat:leftis usuallycandidatesnewspapersmysteriousDepartmentbest knownparliamentsuppressedconvenientremembereddifferent systematichas led topropagandacontrolledinfluencesceremonialproclaimedProtectionli class=\"Scientificclass=\"no-trademarksmore than widespreadLiberationtook placeday of theas long asimprisonedAdditional\n<head>\n<mLaboratoryNovember 2exceptionsIndustrialvariety offloat: lefDuring theassessmenthave been deals withStatisticsoccurrence/ul></div>clearfix\">the publicmany yearswhich wereover time,synonymouscontent\">\npresumablyhis familyuserAgent.unexpectedincluding challengeda minorityundefined\"belongs totaken fromin Octoberposition: said to bereligious Federation rowspan=\"only a fewmeant thatled to the-->\r\n<div <fieldset>Archbishop class=\"nobeing usedapproachesprivilegesnoscript>\nresults inmay be theEaster eggmechanismsreasonablePopulationCollectionselected\">noscript>\r/index.phparrival of-jssdk'));managed toincompletecasualtiescompletionChristiansSeptember arithmeticproceduresmight haveProductionit appearsPhilosophyfriendshipleading togiving thetoward theguaranteeddocumentedcolor:#000video gamecommissionreflectingchange theassociatedsans-serifonkeypress; padding:He was theunderlyingtypically , and the srcElementsuccessivesince the should be networkingaccountinguse of thelower thanshows that</span>\n\t\tcomplaintscontinuousquantitiesastronomerhe did notdue to itsapplied toan averageefforts tothe futureattempt toTherefore,capabilityRepublicanwas formedElectronickilometerschallengespublishingthe formerindigenousdirectionssubsidiaryconspiracydetails ofand in theaffordablesubstancesreason forconventionitemtype=\"absolutelysupposedlyremained aattractivetravellingseparatelyfocuses onelementaryapplicablefound thatstylesheetmanuscriptstands for no-repeat(sometimesCommercialin Americaundertakenquarter ofan examplepersonallyindex.php?</button>\npercentagebest-knowncreating a\" dir=\"ltrLieutenant\n<div id=\"they wouldability ofmade up ofnoted thatclear thatargue thatto anotherchildren'spurpose offormulatedbased uponthe regionsubject ofpassengerspossession.\n\nIn the Before theafterwardscurrently across thescientificcommunity.capitalismin Germanyright-wingthe systemSociety ofpoliticiandirection:went on toremoval of New York apartmentsindicationduring theunless thehistoricalhad been adefinitiveingredientattendanceCenter forprominencereadyStatestrategiesbut in theas part ofconstituteclaim thatlaboratorycompatiblefailure of, such as began withusing the to providefeature offrom which/\" class=\"geologicalseveral ofdeliberateimportant holds thating&quot; valign=topthe Germanoutside ofnegotiatedhis careerseparationid=\"searchwas calledthe fourthrecreationother thanpreventionwhile the education,connectingaccuratelywere builtwas killedagreementsmuch more Due to thewidth: 100some otherKingdom ofthe entirefamous forto connectobjectivesthe Frenchpeople andfeatured\">is said tostructuralreferendummost oftena separate->\n<div id Official worldwide.aria-labelthe planetand it wasd\" value=\"looking atbeneficialare in themonitoringreportedlythe modernworking onallowed towhere the innovative</a></div>soundtracksearchFormtend to beinput id=\"opening ofrestrictedadopted byaddressingtheologianmethods ofvariant ofChristian very largeautomotiveby far therange frompursuit offollow thebrought toin Englandagree thataccused ofcomes frompreventingdiv style=his or hertremendousfreedom ofconcerning0 1em 1em;Basketball/style.cssan earliereven after/\" title=\".com/indextaking thepittsburghcontent\">\r<script>(fturned outhaving the</span>\r\n occasionalbecause itstarted tophysically></div>\n created byCurrently, bgcolor=\"tabindex=\"disastrousAnalytics also has a><div id=\"</style>\n<called forsinger and.src = \"//violationsthis pointconstantlyis locatedrecordingsd from thenederlandsportuguC*sW\"W\u0011W(W\u0019W*Y\u0001X'X1X3[\u000CdesarrollocomentarioeducaciC3nseptiembreregistradodirecciC3nubicaciC3npublicidadrespuestasresultadosimportantereservadosartC-culosdiferentessiguientesrepC:blicasituaciC3nministerioprivacidaddirectorioformaciC3npoblaciC3npresidentecont";
+ private static final String DATA1 = "enidosaccesoriostechnoratipersonalescategorC-aespecialesdisponibleactualidadreferenciavalladolidbibliotecarelacionescalendariopolC-ticasanterioresdocumentosnaturalezamaterialesdiferenciaeconC3micatransporterodrC-guezparticiparencuentrandiscusiC3nestructurafundaciC3nfrecuentespermanentetotalmenteP<P>P6P=P>P1Q\u0003P4P5Q\u0002P<P>P6P5Q\u0002P2Q\u0000P5P<Q\u000FQ\u0002P0P:P6P5Q\u0007Q\u0002P>P1Q\u000BP1P>P;P5P5P>Q\u0007P5P=Q\u000CQ\rQ\u0002P>P3P>P:P>P3P4P0P?P>Q\u0001P;P5P2Q\u0001P5P3P>Q\u0001P0P9Q\u0002P5Q\u0007P5Q\u0000P5P7P<P>P3Q\u0003Q\u0002Q\u0001P0P9Q\u0002P0P6P8P7P=P8P<P5P6P4Q\u0003P1Q\u0003P4Q\u0003Q\u0002P\u001FP>P8Q\u0001P:P7P4P5Q\u0001Q\u000CP2P8P4P5P>Q\u0001P2Q\u000FP7P8P=Q\u0003P6P=P>Q\u0001P2P>P5P9P;Q\u000EP4P5P9P?P>Q\u0000P=P>P<P=P>P3P>P4P5Q\u0002P5P9Q\u0001P2P>P8Q\u0005P?Q\u0000P0P2P0Q\u0002P0P:P>P9P<P5Q\u0001Q\u0002P>P8P<P5P5Q\u0002P6P8P7P=Q\u000CP>P4P=P>P9P;Q\u0003Q\u0007Q\u0008P5P?P5Q\u0000P5P4Q\u0007P0Q\u0001Q\u0002P8Q\u0007P0Q\u0001Q\u0002Q\u000CQ\u0000P0P1P>Q\u0002P=P>P2Q\u000BQ\u0005P?Q\u0000P0P2P>Q\u0001P>P1P>P9P?P>Q\u0002P>P<P<P5P=P5P5Q\u0007P8Q\u0001P;P5P=P>P2Q\u000BP5Q\u0003Q\u0001P;Q\u0003P3P>P:P>P;P>P=P0P7P0P4Q\u0002P0P:P>P5Q\u0002P>P3P4P0P?P>Q\u0007Q\u0002P8P\u001FP>Q\u0001P;P5Q\u0002P0P:P8P5P=P>P2Q\u000BP9Q\u0001Q\u0002P>P8Q\u0002Q\u0002P0P:P8Q\u0005Q\u0001Q\u0000P0P7Q\u0003P!P0P=P:Q\u0002Q\u0004P>Q\u0000Q\u0003P<P\u001AP>P3P4P0P:P=P8P3P8Q\u0001P;P>P2P0P=P0Q\u0008P5P9P=P0P9Q\u0002P8Q\u0001P2P>P8P<Q\u0001P2Q\u000FP7Q\u000CP;Q\u000EP1P>P9Q\u0007P0Q\u0001Q\u0002P>Q\u0001Q\u0000P5P4P8P\u001AQ\u0000P>P<P5P$P>Q\u0000Q\u0003P<Q\u0000Q\u000BP=P:P5Q\u0001Q\u0002P0P;P8P?P>P8Q\u0001P:Q\u0002Q\u000BQ\u0001Q\u000FQ\u0007P<P5Q\u0001Q\u000FQ\u0006Q\u0006P5P=Q\u0002Q\u0000Q\u0002Q\u0000Q\u0003P4P0Q\u0001P0P<Q\u000BQ\u0005Q\u0000Q\u000BP=P:P0P\u001DP>P2Q\u000BP9Q\u0007P0Q\u0001P>P2P<P5Q\u0001Q\u0002P0Q\u0004P8P;Q\u000CP<P<P0Q\u0000Q\u0002P0Q\u0001Q\u0002Q\u0000P0P=P<P5Q\u0001Q\u0002P5Q\u0002P5P:Q\u0001Q\u0002P=P0Q\u0008P8Q\u0005P<P8P=Q\u0003Q\u0002P8P<P5P=P8P8P<P5Q\u000EQ\u0002P=P>P<P5Q\u0000P3P>Q\u0000P>P4Q\u0001P0P<P>P<Q\rQ\u0002P>P<Q\u0003P:P>P=Q\u0006P5Q\u0001P2P>P5P<P:P0P:P>P9P\u0010Q\u0000Q\u0005P8P2Y\u0005Y\u0006X*X/Y\tX%X1X3X'Y\u0004X1X3X'Y\u0004X)X'Y\u0004X9X'Y\u0005Y\u0003X*X(Y\u0007X'X(X1X'Y\u0005X,X'Y\u0004Y\nY\u0008Y\u0005X'Y\u0004X5Y\u0008X1X,X/Y\nX/X)X'Y\u0004X9X6Y\u0008X%X6X'Y\u0001X)X'Y\u0004Y\u0002X3Y\u0005X'Y\u0004X9X'X(X*X-Y\u0005Y\nY\u0004Y\u0005Y\u0004Y\u0001X'X*Y\u0005Y\u0004X*Y\u0002Y\tX*X9X/Y\nY\u0004X'Y\u0004X4X9X1X#X.X(X'X1X*X7Y\u0008Y\nX1X9Y\u0004Y\nY\u0003Y\u0005X%X1Y\u0001X'Y\u0002X7Y\u0004X(X'X*X'Y\u0004Y\u0004X:X)X*X1X*Y\nX(X'Y\u0004Y\u0006X'X3X'Y\u0004X4Y\nX.Y\u0005Y\u0006X*X/Y\nX'Y\u0004X9X1X(X'Y\u0004Y\u0002X5X5X'Y\u0001Y\u0004X'Y\u0005X9Y\u0004Y\nY\u0007X'X*X-X/Y\nX+X'Y\u0004Y\u0004Y\u0007Y\u0005X'Y\u0004X9Y\u0005Y\u0004Y\u0005Y\u0003X*X(X)Y\nY\u0005Y\u0003Y\u0006Y\u0003X'Y\u0004X7Y\u0001Y\u0004Y\u0001Y\nX/Y\nY\u0008X%X/X'X1X)X*X'X1Y\nX.X'Y\u0004X5X-X)X*X3X,Y\nY\u0004X'Y\u0004Y\u0008Y\u0002X*X9Y\u0006X/Y\u0005X'Y\u0005X/Y\nY\u0006X)X*X5Y\u0005Y\nY\u0005X#X1X4Y\nY\u0001X'Y\u0004X0Y\nY\u0006X9X1X(Y\nX)X(Y\u0008X'X(X)X#Y\u0004X9X'X(X'Y\u0004X3Y\u0001X1Y\u0005X4X'Y\u0003Y\u0004X*X9X'Y\u0004Y\tX'Y\u0004X#Y\u0008Y\u0004X'Y\u0004X3Y\u0006X)X,X'Y\u0005X9X)X'Y\u0004X5X-Y\u0001X'Y\u0004X/Y\nY\u0006Y\u0003Y\u0004Y\u0005X'X*X'Y\u0004X.X'X5X'Y\u0004Y\u0005Y\u0004Y\u0001X#X9X6X'X!Y\u0003X*X'X(X)X'Y\u0004X.Y\nX1X1X3X'X&Y\u0004X'Y\u0004Y\u0002Y\u0004X(X'Y\u0004X#X/X(Y\u0005Y\u0002X'X7X9Y\u0005X1X'X3Y\u0004Y\u0005Y\u0006X7Y\u0002X)X'Y\u0004Y\u0003X*X(X'Y\u0004X1X,Y\u0004X'X4X*X1Y\u0003X'Y\u0004Y\u0002X/Y\u0005Y\nX9X7Y\nY\u0003sByTagName(.jpg\" alt=\"1px solid #.gif\" alt=\"transparentinformationapplication\" onclick=\"establishedadvertising.png\" alt=\"environmentperformanceappropriate&amp;mdash;immediately</strong></rather thantemperaturedevelopmentcompetitionplaceholdervisibility:copyright\">0\" height=\"even thoughreplacementdestinationCorporation<ul class=\"AssociationindividualsperspectivesetTimeout(url(http://mathematicsmargin-top:eventually description) no-repeatcollections.JPG|thumb|participate/head><bodyfloat:left;<li class=\"hundreds of\n\nHowever, compositionclear:both;cooperationwithin the label for=\"border-top:New Zealandrecommendedphotographyinteresting&lt;sup&gt;controversyNetherlandsalternativemaxlength=\"switzerlandDevelopmentessentially\n\nAlthough </textarea>thunderbirdrepresented&amp;ndash;speculationcommunitieslegislationelectronics\n\t<div id=\"illustratedengineeringterritoriesauthoritiesdistributed6\" height=\"sans-serif;capable of disappearedinteractivelooking forit would beAfghanistanwas createdMath.floor(surroundingcan also beobservationmaintenanceencountered<h2 class=\"more recentit has beeninvasion of).getTime()fundamentalDespite the\"><div id=\"inspirationexaminationpreparationexplanation<input id=\"</a></span>versions ofinstrumentsbefore the = 'http://Descriptionrelatively .substring(each of theexperimentsinfluentialintegrationmany peopledue to the combinationdo not haveMiddle East<noscript><copyright\" perhaps theinstitutionin Decemberarrangementmost famouspersonalitycreation oflimitationsexclusivelysovereignty-content\">\n<td class=\"undergroundparallel todoctrine ofoccupied byterminologyRenaissancea number ofsupport forexplorationrecognitionpredecessor<img src=\"/<h1 class=\"publicationmay also bespecialized</fieldset>progressivemillions ofstates thatenforcementaround the one another.parentNodeagricultureAlternativeresearcherstowards theMost of themany other (especially<td width=\";width:100%independent<h3 class=\" onchange=\").addClass(interactionOne of the daughter ofaccessoriesbranches of\r\n<div id=\"the largestdeclarationregulationsInformationtranslationdocumentaryin order to\">\n<head>\n<\" height=\"1across the orientation);</script>implementedcan be seenthere was ademonstratecontainer\">connectionsthe Britishwas written!important;px; margin-followed byability to complicatedduring the immigrationalso called<h4 class=\"distinctionreplaced bygovernmentslocation ofin Novemberwhether the</p>\n</div>acquisitioncalled the persecutiondesignation{font-size:appeared ininvestigateexperiencedmost likelywidely useddiscussionspresence of (document.extensivelyIt has beenit does notcontrary toinhabitantsimprovementscholarshipconsumptioninstructionfor exampleone or morepx; paddingthe currenta series ofare usuallyrole in thepreviously derivativesevidence ofexperiencescolorschemestated thatcertificate</a></div>\n selected=\"high schoolresponse tocomfortableadoption ofthree yearsthe countryin Februaryso that thepeople who provided by<param nameaffected byin terms ofappointmentISO-8859-1\"was born inhistorical regarded asmeasurementis based on and other : function(significantcelebrationtransmitted/js/jquery.is known astheoretical tabindex=\"it could be<noscript>\nhaving been\r\n<head>\r\n< &quot;The compilationhe had beenproduced byphilosopherconstructedintended toamong othercompared toto say thatEngineeringa differentreferred todifferencesbelief thatphotographsidentifyingHistory of Republic ofnecessarilyprobabilitytechnicallyleaving thespectacularfraction ofelectricityhead of therestaurantspartnershipemphasis onmost recentshare with saying thatfilled withdesigned toit is often\"></iframe>as follows:merged withthrough thecommercial pointed outopportunityview of therequirementdivision ofprogramminghe receivedsetInterval\"></span></in New Yorkadditional compression\n\n<div id=\"incorporate;</script><attachEventbecame the \" target=\"_carried outSome of thescience andthe time ofContainer\">maintainingChristopherMuch of thewritings of\" height=\"2size of theversion of mixture of between theExamples ofeducationalcompetitive onsubmit=\"director ofdistinctive/DTD XHTML relating totendency toprovince ofwhich woulddespite thescientific legislature.innerHTML allegationsAgriculturewas used inapproach tointelligentyears later,sans-serifdeterminingPerformanceappearances, which is foundationsabbreviatedhigher thans from the individual composed ofsupposed toclaims thatattributionfont-size:1elements ofHistorical his brotherat the timeanniversarygoverned byrelated to ultimately innovationsit is stillcan only bedefinitionstoGMTStringA number ofimg class=\"Eventually,was changedoccurred inneighboringdistinguishwhen he wasintroducingterrestrialMany of theargues thatan Americanconquest ofwidespread were killedscreen and In order toexpected todescendantsare locatedlegislativegenerations backgroundmost peopleyears afterthere is nothe highestfrequently they do notargued thatshowed thatpredominanttheologicalby the timeconsideringshort-lived</span></a>can be usedvery littleone of the had alreadyinterpretedcommunicatefeatures ofgovernment,</noscript>entered the\" height=\"3Independentpopulationslarge-scale. Although used in thedestructionpossibilitystarting intwo or moreexpressionssubordinatelarger thanhistory and</option>\r\nContinentaleliminatingwill not bepractice ofin front ofsite of theensure thatto create amississippipotentiallyoutstandingbetter thanwhat is nowsituated inmeta name=\"TraditionalsuggestionsTranslationthe form ofatmosphericideologicalenterprisescalculatingeast of theremnants ofpluginspage/index.php?remained intransformedHe was alsowas alreadystatisticalin favor ofMinistry ofmovement offormulationis required<link rel=\"This is the <a href=\"/popularizedinvolved inare used toand severalmade by theseems to belikely thatPalestiniannamed afterit had beenmost commonto refer tobut this isconsecutivetemporarilyIn general,conventionstakes placesubdivisionterritorialoperationalpermanentlywas largelyoutbreak ofin the pastfollowing a xmlns:og=\"><a class=\"class=\"textConversion may be usedmanufactureafter beingclearfix\">\nquestion ofwas electedto become abecause of some peopleinspired bysuccessful a time whenmore commonamongst thean officialwidth:100%;technology,was adoptedto keep thesettlementslive birthsindex.html\"Connecticutassigned to&amp;times;account foralign=rightthe companyalways beenreturned toinvolvementBecause thethis period\" name=\"q\" confined toa result ofvalue=\"\" />is actuallyEnvironment\r\n</head>\r\nConversely,>\n<div id=\"0\" width=\"1is probablyhave becomecontrollingthe problemcitizens ofpoliticiansreached theas early as:none; over<table cellvalidity ofdirectly toonmousedownwhere it iswhen it wasmembers of relation toaccommodatealong with In the latethe Englishdelicious\">this is notthe presentif they areand finallya matter of\r\n\t</div>\r\n\r\n</script>faster thanmajority ofafter whichcomparativeto maintainimprove theawarded theer\" class=\"frameborderrestorationin the sameanalysis oftheir firstDuring the continentalsequence offunction(){font-size: work on the</script>\n<begins withjavascript:constituentwas foundedequilibriumassume thatis given byneeds to becoordinatesthe variousare part ofonly in thesections ofis a commontheories ofdiscoveriesassociationedge of thestrength ofposition inpresent-dayuniversallyto form thebut insteadcorporationattached tois commonlyreasons for &quot;the can be madewas able towhich meansbut did notonMouseOveras possibleoperated bycoming fromthe primaryaddition offor severaltransferreda period ofare able tohowever, itshould havemuch larger\n\t</script>adopted theproperty ofdirected byeffectivelywas broughtchildren ofProgramminglonger thanmanuscriptswar againstby means ofand most ofsimilar to proprietaryoriginatingprestigiousgrammaticalexperience.to make theIt was alsois found incompetitorsin the U.S.replace thebrought thecalculationfall of thethe generalpracticallyin honor ofreleased inresidentialand some ofking of thereaction to1st Earl ofculture andprincipally</title>\n they can beback to thesome of hisexposure toare similarform of theaddFavoritecitizenshippart in thepeople within practiceto continue&amp;minus;approved by the first allowed theand for thefunctioningplaying thesolution toheight=\"0\" in his bookmore than afollows thecreated thepresence in&nbsp;</td>nationalistthe idea ofa characterwere forced class=\"btndays of thefeatured inshowing theinterest inin place ofturn of thethe head ofLord of thepoliticallyhas its ownEducationalapproval ofsome of theeach other,behavior ofand becauseand anotherappeared onrecorded inblack&quot;may includethe world'scan lead torefers to aborder=\"0\" government winning theresulted in while the Washington,the subjectcity in the></div>\r\n\t\treflect theto completebecame moreradioactiverejected bywithout anyhis father,which couldcopy of theto indicatea politicalaccounts ofconstitutesworked wither</a></li>of his lifeaccompaniedclientWidthprevent theLegislativedifferentlytogether inhas severalfor anothertext of thefounded thee with the is used forchanged theusually theplace wherewhereas the> <a href=\"\"><a href=\"themselves,although hethat can betraditionalrole of theas a resultremoveChilddesigned bywest of theSome peopleproduction,side of thenewslettersused by thedown to theaccepted bylive in theattempts tooutside thefrequenciesHowever, inprogrammersat least inapproximatealthough itwas part ofand variousGovernor ofthe articleturned into><a href=\"/the economyis the mostmost widelywould laterand perhapsrise to theoccurs whenunder whichconditions.the westerntheory thatis producedthe city ofin which heseen in thethe centralbuilding ofmany of hisarea of theis the onlymost of themany of thethe WesternThere is noextended toStatisticalcolspan=2 |short storypossible totopologicalcritical ofreported toa Christiandecision tois equal toproblems ofThis can bemerchandisefor most ofno evidenceeditions ofelements in&quot;. Thecom/images/which makesthe processremains theliterature,is a memberthe popularthe ancientproblems intime of thedefeated bybody of thea few yearsmuch of thethe work ofCalifornia,served as agovernment.concepts ofmovement in\t\t<div id=\"it\" value=\"language ofas they areproduced inis that theexplain thediv></div>\nHowever thelead to the\t<a href=\"/was grantedpeople havecontinuallywas seen asand relatedthe role ofproposed byof the besteach other.Constantinepeople fromdialects ofto revisionwas renameda source ofthe initiallaunched inprovide theto the westwhere thereand similarbetween twois also theEnglish andconditions,that it wasentitled tothemselves.quantity ofransparencythe same asto join thecountry andthis is theThis led toa statementcontrast tolastIndexOfthrough hisis designedthe term isis providedprotect theng</a></li>The currentthe site ofsubstantialexperience,in the Westthey shouldslovenD\rinacomentariosuniversidadcondicionesactividadesexperienciatecnologC-aproducciC3npuntuaciC3naplicaciC3ncontraseC1acategorC-asregistrarseprofesionaltratamientoregC-stratesecretarC-aprincipalesprotecciC3nimportantesimportanciaposibilidadinteresantecrecimientonecesidadessuscribirseasociaciC3ndisponiblesevaluaciC3nestudiantesresponsableresoluciC3nguadalajararegistradosoportunidadcomercialesfotografC-aautoridadesingenierC-atelevisiC3ncompetenciaoperacionesestablecidosimplementeactualmentenavegaciC3nconformidadline-height:font-family:\" : \"http://applicationslink\" href=\"specifically//<![CDATA[\nOrganizationdistribution0px; height:relationshipdevice-width<div class=\"<label for=\"registration</noscript>\n/index.html\"window.open( !important;application/independence//www.googleorganizationautocompleterequirementsconservative<form name=\"intellectualmargin-left:18th centuryan importantinstitutionsabbreviation<img class=\"organisationcivilization19th centuryarchitectureincorporated20th century-container\">most notably/></a></div>notification'undefined')Furthermore,believe thatinnerHTML = prior to thedramaticallyreferring tonegotiationsheadquartersSouth AfricaunsuccessfulPennsylvaniaAs a result,<html lang=\"&lt;/sup&gt;dealing withphiladelphiahistorically);</script>\npadding-top:experimentalgetAttributeinstructionstechnologiespart of the =function(){subscriptionl.dtd\">\r\n<htgeographicalConstitution', function(supported byagriculturalconstructionpublicationsfont-size: 1a variety of<div style=\"Encyclopediaiframe src=\"demonstratedaccomplisheduniversitiesDemographics);</script><dedicated toknowledge ofsatisfactionparticularly</div></div>English (US)appendChild(transmissions. However, intelligence\" tabindex=\"float:right;Commonwealthranging fromin which theat least onereproductionencyclopedia;font-size:1jurisdictionat that time\"><a class=\"In addition,description+conversationcontact withis generallyr\" content=\"representing&lt;math&gt;presentationoccasionally<img width=\"navigation\">compensationchampionshipmedia=\"all\" violation ofreference toreturn true;Strict//EN\" transactionsinterventionverificationInformation difficultiesChampionshipcapabilities<![endif]-->}\n</script>\nChristianityfor example,Professionalrestrictionssuggest thatwas released(such as theremoveClass(unemploymentthe Americanstructure of/index.html published inspan class=\"\"><a href=\"/introductionbelonging toclaimed thatconsequences<meta name=\"Guide to theoverwhelmingagainst the concentrated,\n.nontouch observations</a>\n</div>\nf (document.border: 1px {font-size:1treatment of0\" height=\"1modificationIndependencedivided intogreater thanachievementsestablishingJavaScript\" neverthelesssignificanceBroadcasting>&nbsp;</td>container\">\nsuch as the influence ofa particularsrc='http://navigation\" half of the substantial &nbsp;</div>advantage ofdiscovery offundamental metropolitanthe opposite\" xml:lang=\"deliberatelyalign=centerevolution ofpreservationimprovementsbeginning inJesus ChristPublicationsdisagreementtext-align:r, function()similaritiesbody></html>is currentlyalphabeticalis sometimestype=\"image/many of the flow:hidden;available indescribe theexistence ofall over thethe Internet\t<ul class=\"installationneighborhoodarmed forcesreducing thecontinues toNonetheless,temperatures\n\t\t<a href=\"close to theexamples of is about the(see below).\" id=\"searchprofessionalis availablethe official\t\t</script>\n\n\t\t<div id=\"accelerationthrough the Hall of Famedescriptionstranslationsinterference type='text/recent yearsin the worldvery popular{background:traditional some of the connected toexploitationemergence ofconstitutionA History ofsignificant manufacturedexpectations><noscript><can be foundbecause the has not beenneighbouringwithout the added to the\t<li class=\"instrumentalSoviet Unionacknowledgedwhich can bename for theattention toattempts to developmentsIn fact, the<li class=\"aimplicationssuitable formuch of the colonizationpresidentialcancelBubble Informationmost of the is describedrest of the more or lessin SeptemberIntelligencesrc=\"http://px; height: available tomanufacturerhuman rightslink href=\"/availabilityproportionaloutside the astronomicalhuman beingsname of the are found inare based onsmaller thana person whoexpansion ofarguing thatnow known asIn the earlyintermediatederived fromScandinavian</a></div>\r\nconsider thean estimatedthe National<div id=\"pagresulting incommissionedanalogous toare required/ul>\n</div>\nwas based onand became a&nbsp;&nbsp;t\" value=\"\" was capturedno more thanrespectivelycontinue to >\r\n<head>\r\n<were createdmore generalinformation used for theindependent the Imperialcomponent ofto the northinclude the Constructionside of the would not befor instanceinvention ofmore complexcollectivelybackground: text-align: its originalinto accountthis processan extensivehowever, thethey are notrejected thecriticism ofduring whichprobably thethis article(function(){It should bean agreementaccidentallydiffers fromArchitecturebetter knownarrangementsinfluence onattended theidentical tosouth of thepass throughxml\" title=\"weight:bold;creating thedisplay:nonereplaced the<img src=\"/ihttps://www.World War IItestimonialsfound in therequired to and that thebetween the was designedconsists of considerablypublished bythe languageConservationconsisted ofrefer to theback to the css\" media=\"People from available onproved to besuggestions\"was known asvarieties oflikely to becomprised ofsupport the hands of thecoupled withconnect and border:none;performancesbefore beinglater becamecalculationsoften calledresidents ofmeaning that><li class=\"evidence forexplanationsenvironments\"></a></div>which allowsIntroductiondeveloped bya wide rangeon behalf ofvalign=\"top\"principle ofat the time,</noscript>\rsaid to havein the firstwhile othershypotheticalphilosopherspower of thecontained inperformed byinability towere writtenspan style=\"input name=\"the questionintended forrejection ofimplies thatinvented thethe standardwas probablylink betweenprofessor ofinteractionschanging theIndian Ocean class=\"lastworking with'http://www.years beforeThis was therecreationalentering themeasurementsan extremelyvalue of thestart of the\n</script>\n\nan effort toincrease theto the southspacing=\"0\">sufficientlythe Europeanconverted toclearTimeoutdid not haveconsequentlyfor the nextextension ofeconomic andalthough theare producedand with theinsufficientgiven by thestating thatexpenditures</span></a>\nthought thaton the basiscellpadding=image of thereturning toinformation,separated byassassinateds\" content=\"authority ofnorthwestern</div>\n<div \"></div>\r\n consultationcommunity ofthe nationalit should beparticipants align=\"leftthe greatestselection ofsupernaturaldependent onis mentionedallowing thewas inventedaccompanyinghis personalavailable atstudy of theon the otherexecution ofHuman Rightsterms of theassociationsresearch andsucceeded bydefeated theand from thebut they arecommander ofstate of theyears of agethe study of<ul class=\"splace in thewhere he was<li class=\"fthere are nowhich becamehe publishedexpressed into which thecommissionerfont-weight:territory ofextensions\">Roman Empireequal to theIn contrast,however, andis typicallyand his wife(also called><ul class=\"effectively evolved intoseem to havewhich is thethere was noan excellentall of thesedescribed byIn practice,broadcastingcharged withreflected insubjected tomilitary andto the pointeconomicallysetTargetingare actuallyvictory over();</script>continuouslyrequired forevolutionaryan effectivenorth of the, which was front of theor otherwisesome form ofhad not beengenerated byinformation.permitted toincludes thedevelopment,entered intothe previousconsistentlyare known asthe field ofthis type ofgiven to thethe title ofcontains theinstances ofin the northdue to theirare designedcorporationswas that theone of thesemore popularsucceeded insupport fromin differentdominated bydesigned forownership ofand possiblystandardizedresponseTextwas intendedreceived theassumed thatareas of theprimarily inthe basis ofin the senseaccounts fordestroyed byat least twowas declaredcould not beSecretary ofappear to bemargin-top:1/^\\s+|\\s+$/ge){throw e};the start oftwo separatelanguage andwho had beenoperation ofdeath of thereal numbers\t<link rel=\"provided thethe story ofcompetitionsenglish (UK)english (US)P\u001CP>P=P3P>P;P!Q\u0000P?Q\u0001P:P8Q\u0001Q\u0000P?Q\u0001P:P8Q\u0001Q\u0000P?Q\u0001P:P>Y\u0004X9X1X(Y\nX)f-#i+\u0014d8-f\u0016\u0007g.\u0000d=\u0013d8-f\u0016\u0007g9\u0001d=\u0013d8-f\u0016\u0007f\u001C\ti\u0019\u0010e\u0005,e\u000F8d::f0\u0011f\u0014?e:\u001Ci\u0018?i\u0007\u000Ce74e74g$>d<\u001Ad8;d9\tf\u0013\rd=\u001Cg3;g;\u001Ff\u0014?g-\u0016f3\u0015h'\u0004informaciC3nherramientaselectrC3nicodescripciC3nclasificadosconocimientopublicaciC3nrelacionadasinformC!ticarelacionadosdepartamentotrabajadoresdirectamenteayuntamientomercadoLibrecontC!ctenoshabitacionescumplimientorestaurantesdisposiciC3nconsecuenciaelectrC3nicaaplicacionesdesconectadoinstalaciC3nrealizaciC3nutilizaciC3nenciclopediaenfermedadesinstrumentosexperienciasinstituciC3nparticularessubcategoriaQ\u0002P>P;Q\u000CP:P>P P>Q\u0001Q\u0001P8P8Q\u0000P0P1P>Q\u0002Q\u000BP1P>P;Q\u000CQ\u0008P5P?Q\u0000P>Q\u0001Q\u0002P>P<P>P6P5Q\u0002P5P4Q\u0000Q\u0003P3P8Q\u0005Q\u0001P;Q\u0003Q\u0007P0P5Q\u0001P5P9Q\u0007P0Q\u0001P2Q\u0001P5P3P4P0P P>Q\u0001Q\u0001P8Q\u000FP\u001CP>Q\u0001P:P2P5P4Q\u0000Q\u0003P3P8P5P3P>Q\u0000P>P4P0P2P>P?Q\u0000P>Q\u0001P4P0P=P=Q\u000BQ\u0005P4P>P;P6P=Q\u000BP8P<P5P=P=P>P\u001CP>Q\u0001P:P2Q\u000BQ\u0000Q\u0003P1P;P5P9P\u001CP>Q\u0001P:P2P0Q\u0001Q\u0002Q\u0000P0P=Q\u000BP=P8Q\u0007P5P3P>Q\u0000P0P1P>Q\u0002P5P4P>P;P6P5P=Q\u0003Q\u0001P;Q\u0003P3P8Q\u0002P5P?P5Q\u0000Q\u000CP\u001EP4P=P0P:P>P?P>Q\u0002P>P<Q\u0003Q\u0000P0P1P>Q\u0002Q\u0003P0P?Q\u0000P5P;Q\u000FP2P>P>P1Q\tP5P>P4P=P>P3P>Q\u0001P2P>P5P3P>Q\u0001Q\u0002P0Q\u0002Q\u000CP8P4Q\u0000Q\u0003P3P>P9Q\u0004P>Q\u0000Q\u0003P<P5Q\u0005P>Q\u0000P>Q\u0008P>P?Q\u0000P>Q\u0002P8P2Q\u0001Q\u0001Q\u000BP;P:P0P:P0P6P4Q\u000BP9P2P;P0Q\u0001Q\u0002P8P3Q\u0000Q\u0003P?P?Q\u000BP2P<P5Q\u0001Q\u0002P5Q\u0000P0P1P>Q\u0002P0Q\u0001P:P0P7P0P;P?P5Q\u0000P2Q\u000BP9P4P5P;P0Q\u0002Q\u000CP4P5P=Q\u000CP3P8P?P5Q\u0000P8P>P4P1P8P7P=P5Q\u0001P>Q\u0001P=P>P2P5P<P>P<P5P=Q\u0002P:Q\u0003P?P8Q\u0002Q\u000CP4P>P;P6P=P0Q\u0000P0P<P:P0Q\u0005P=P0Q\u0007P0P;P>P P0P1P>Q\u0002P0P\"P>P;Q\u000CP:P>Q\u0001P>P2Q\u0001P5P<P2Q\u0002P>Q\u0000P>P9P=P0Q\u0007P0P;P0Q\u0001P?P8Q\u0001P>P:Q\u0001P;Q\u0003P6P1Q\u000BQ\u0001P8Q\u0001Q\u0002P5P<P?P5Q\u0007P0Q\u0002P8P=P>P2P>P3P>P?P>P<P>Q\tP8Q\u0001P0P9Q\u0002P>P2P?P>Q\u0007P5P<Q\u0003P?P>P<P>Q\tQ\u000CP4P>P;P6P=P>Q\u0001Q\u0001Q\u000BP;P:P8P1Q\u000BQ\u0001Q\u0002Q\u0000P>P4P0P=P=Q\u000BP5P<P=P>P3P8P5P?Q\u0000P>P5P:Q\u0002P!P5P9Q\u0007P0Q\u0001P<P>P4P5P;P8Q\u0002P0P:P>P3P>P>P=P;P0P9P=P3P>Q\u0000P>P4P5P2P5Q\u0000Q\u0001P8Q\u000FQ\u0001Q\u0002Q\u0000P0P=P5Q\u0004P8P;Q\u000CP<Q\u000BQ\u0003Q\u0000P>P2P=Q\u000FQ\u0000P0P7P=Q\u000BQ\u0005P8Q\u0001P:P0Q\u0002Q\u000CP=P5P4P5P;Q\u000EQ\u000FP=P2P0Q\u0000Q\u000FP<P5P=Q\u000CQ\u0008P5P<P=P>P3P8Q\u0005P4P0P=P=P>P9P7P=P0Q\u0007P8Q\u0002P=P5P;Q\u000CP7Q\u000FQ\u0004P>Q\u0000Q\u0003P<P0P\"P5P?P5Q\u0000Q\u000CP<P5Q\u0001Q\u000FQ\u0006P0P7P0Q\tP8Q\u0002Q\u000BP\u001BQ\u0003Q\u0007Q\u0008P8P5`$(`$9`%\u0000`$\u0002`$\u0015`$0`$(`%\u0007`$\u0005`$*`$(`%\u0007`$\u0015`$?`$/`$>`$\u0015`$0`%\u0007`$\u0002`$\u0005`$(`%\r`$/`$\u0015`%\r`$/`$>`$\u0017`$>`$\u0007`$!`$,`$>`$0`%\u0007`$\u0015`$?`$8`%\u0000`$&`$?`$/`$>`$*`$9`$2`%\u0007`$8`$?`$\u0002`$9`$-`$>`$0`$$`$\u0005`$*`$(`%\u0000`$5`$>`$2`%\u0007`$8`%\u0007`$5`$>`$\u0015`$0`$$`%\u0007`$.`%\u0007`$0`%\u0007`$9`%\u000B`$(`%\u0007`$8`$\u0015`$$`%\u0007`$,`$9`%\u0001`$$`$8`$>`$\u0007`$\u001F`$9`%\u000B`$\u0017`$>`$\u001C`$>`$(`%\u0007`$.`$?`$(`$\u001F`$\u0015`$0`$$`$>`$\u0015`$0`$(`$>`$\t`$(`$\u0015`%\u0007`$/`$9`$>`$\u0001`$8`$,`$8`%\u0007`$-`$>`$7`$>`$\u0006`$*`$\u0015`%\u0007`$2`$?`$/`%\u0007`$6`%\u0001`$0`%\u0002`$\u0007`$8`$\u0015`%\u0007`$\u0018`$\u0002`$\u001F`%\u0007`$.`%\u0007`$0`%\u0000`$8`$\u0015`$$`$>`$.`%\u0007`$0`$>`$2`%\u0007`$\u0015`$0`$\u0005`$'`$?`$\u0015`$\u0005`$*`$(`$>`$8`$.`$>`$\u001C`$.`%\u0001`$\u001D`%\u0007`$\u0015`$>`$0`$#`$9`%\u000B`$$`$>`$\u0015`$!`$<`%\u0000`$/`$9`$>`$\u0002`$9`%\u000B`$\u001F`$2`$6`$,`%\r`$&`$2`$?`$/`$>`$\u001C`%\u0000`$5`$(`$\u001C`$>`$$`$>`$\u0015`%\u0008`$8`%\u0007`$\u0006`$*`$\u0015`$>`$5`$>`$2`%\u0000`$&`%\u0007`$(`%\u0007`$*`%\u0002`$0`%\u0000`$*`$>`$(`%\u0000`$\t`$8`$\u0015`%\u0007`$9`%\u000B`$\u0017`%\u0000`$,`%\u0008`$ `$\u0015`$\u0006`$*`$\u0015`%\u0000`$5`$0`%\r`$7`$\u0017`$>`$\u0002`$5`$\u0006`$*`$\u0015`%\u000B`$\u001C`$?`$2`$>`$\u001C`$>`$(`$>`$8`$9`$.`$$`$9`$.`%\u0007`$\u0002`$\t`$(`$\u0015`%\u0000`$/`$>`$9`%\u0002`$&`$0`%\r`$\u001C`$8`%\u0002`$\u001A`%\u0000`$*`$8`$\u0002`$&`$8`$5`$>`$2`$9`%\u000B`$(`$>`$9`%\u000B`$$`%\u0000`$\u001C`%\u0008`$8`%\u0007`$5`$>`$*`$8`$\u001C`$(`$$`$>`$(`%\u0007`$$`$>`$\u001C`$>`$0`%\u0000`$\u0018`$>`$/`$2`$\u001C`$?`$2`%\u0007`$(`%\u0000`$\u001A`%\u0007`$\u001C`$>`$\u0002`$\u001A`$*`$$`%\r`$0`$\u0017`%\u0002`$\u0017`$2`$\u001C`$>`$$`%\u0007`$,`$>`$9`$0`$\u0006`$*`$(`%\u0007`$5`$>`$9`$(`$\u0007`$8`$\u0015`$>`$8`%\u0001`$,`$9`$0`$9`$(`%\u0007`$\u0007`$8`$8`%\u0007`$8`$9`$?`$$`$,`$!`$<`%\u0007`$\u0018`$\u001F`$(`$>`$$`$2`$>`$6`$*`$>`$\u0002`$\u001A`$6`%\r`$0`%\u0000`$,`$!`$<`%\u0000`$9`%\u000B`$$`%\u0007`$8`$>`$\u0008`$\u001F`$6`$>`$/`$&`$8`$\u0015`$$`%\u0000`$\u001C`$>`$$`%\u0000`$5`$>`$2`$>`$9`$\u001C`$>`$0`$*`$\u001F`$(`$>`$0`$\u0016`$(`%\u0007`$8`$!`$<`$\u0015`$.`$?`$2`$>`$\t`$8`$\u0015`%\u0000`$\u0015`%\u0007`$5`$2`$2`$\u0017`$$`$>`$\u0016`$>`$(`$>`$\u0005`$0`%\r`$%`$\u001C`$9`$>`$\u0002`$&`%\u0007`$\u0016`$>`$*`$9`$2`%\u0000`$(`$?`$/`$.`$,`$?`$(`$>`$,`%\u0008`$\u0002`$\u0015`$\u0015`$9`%\u0000`$\u0002`$\u0015`$9`$(`$>`$&`%\u0007`$$`$>`$9`$.`$2`%\u0007`$\u0015`$>`$+`%\u0000`$\u001C`$,`$\u0015`$?`$$`%\u0001`$0`$$`$.`$>`$\u0002`$\u0017`$5`$9`%\u0000`$\u0002`$0`%\u000B`$\u001C`$<`$.`$?`$2`%\u0000`$\u0006`$0`%\u000B`$*`$8`%\u0007`$(`$>`$/`$>`$&`$5`$2`%\u0007`$(`%\u0007`$\u0016`$>`$$`$>`$\u0015`$0`%\u0000`$,`$\t`$(`$\u0015`$>`$\u001C`$5`$>`$,`$*`%\u0002`$0`$>`$,`$!`$<`$>`$8`%\u000C`$&`$>`$6`%\u0007`$/`$0`$\u0015`$?`$/`%\u0007`$\u0015`$9`$>`$\u0002`$\u0005`$\u0015`$8`$0`$,`$(`$>`$\u000F`$5`$9`$>`$\u0002`$8`%\r`$%`$2`$.`$?`$2`%\u0007`$2`%\u0007`$\u0016`$\u0015`$5`$?`$7`$/`$\u0015`%\r`$0`$\u0002`$8`$.`%\u0002`$9`$%`$>`$(`$>X*X3X*X7Y\nX9Y\u0005X4X'X1Y\u0003X)X(Y\u0008X'X3X7X)X'Y\u0004X5Y\u0001X-X)Y\u0005Y\u0008X'X6Y\nX9X'Y\u0004X.X'X5X)X'Y\u0004Y\u0005X2Y\nX/X'Y\u0004X9X'Y\u0005X)X'Y\u0004Y\u0003X'X*X(X'Y\u0004X1X/Y\u0008X/X(X1Y\u0006X'Y\u0005X,X'Y\u0004X/Y\u0008Y\u0004X)X'Y\u0004X9X'Y\u0004Y\u0005X'Y\u0004Y\u0005Y\u0008Y\u0002X9X'Y\u0004X9X1X(Y\nX'Y\u0004X3X1Y\nX9X'Y\u0004X,Y\u0008X'Y\u0004X'Y\u0004X0Y\u0007X'X(X'Y\u0004X-Y\nX'X)X'Y\u0004X-Y\u0002Y\u0008Y\u0002X'Y\u0004Y\u0003X1Y\nY\u0005X'Y\u0004X9X1X'Y\u0002Y\u0005X-Y\u0001Y\u0008X8X)X'Y\u0004X+X'Y\u0006Y\nY\u0005X4X'Y\u0007X/X)X'Y\u0004Y\u0005X1X#X)X'Y\u0004Y\u0002X1X\"Y\u0006X'Y\u0004X4X(X'X(X'Y\u0004X-Y\u0008X'X1X'Y\u0004X,X/Y\nX/X'Y\u0004X#X3X1X)X'Y\u0004X9Y\u0004Y\u0008Y\u0005Y\u0005X,Y\u0005Y\u0008X9X)X'Y\u0004X1X-Y\u0005Y\u0006X'Y\u0004Y\u0006Y\u0002X'X7Y\u0001Y\u0004X3X7Y\nY\u0006X'Y\u0004Y\u0003Y\u0008Y\nX*X'Y\u0004X/Y\u0006Y\nX'X(X1Y\u0003X'X*Y\u0007X'Y\u0004X1Y\nX'X6X*X-Y\nX'X*Y\nX(X*Y\u0008Y\u0002Y\nX*X'Y\u0004X#Y\u0008Y\u0004Y\tX'Y\u0004X(X1Y\nX/X'Y\u0004Y\u0003Y\u0004X'Y\u0005X'Y\u0004X1X'X(X7X'Y\u0004X4X.X5Y\nX3Y\nX'X1X'X*X'Y\u0004X+X'Y\u0004X+X'Y\u0004X5Y\u0004X'X)X'Y\u0004X-X/Y\nX+X'Y\u0004X2Y\u0008X'X1X'Y\u0004X.Y\u0004Y\nX,X'Y\u0004X,Y\u0005Y\nX9X'Y\u0004X9X'Y\u0005Y\u0007X'Y\u0004X,Y\u0005X'Y\u0004X'Y\u0004X3X'X9X)Y\u0005X4X'Y\u0007X/Y\u0007X'Y\u0004X1X&Y\nX3X'Y\u0004X/X.Y\u0008Y\u0004X'Y\u0004Y\u0001Y\u0006Y\nX)X'Y\u0004Y\u0003X*X'X(X'Y\u0004X/Y\u0008X1Y\nX'Y\u0004X/X1Y\u0008X3X'X3X*X:X1Y\u0002X*X5X'Y\u0005Y\nY\u0005X'Y\u0004X(Y\u0006X'X*X'Y\u0004X9X8Y\nY\u0005entertainmentunderstanding = function().jpg\" width=\"configuration.png\" width=\"<body class=\"Math.random()contemporary United Statescircumstances.appendChild(organizations<span class=\"\"><img src=\"/distinguishedthousands of communicationclear\"></div>investigationfavicon.ico\" margin-right:based on the Massachusettstable border=internationalalso known aspronunciationbackground:#fpadding-left:For example, miscellaneous&lt;/math&gt;psychologicalin particularearch\" type=\"form method=\"as opposed toSupreme Courtoccasionally Additionally,North Americapx;backgroundopportunitiesEntertainment.toLowerCase(manufacturingprofessional combined withFor instance,consisting of\" maxlength=\"return false;consciousnessMediterraneanextraordinaryassassinationsubsequently button type=\"the number ofthe original comprehensiverefers to the</ul>\n</div>\nphilosophicallocation.hrefwas publishedSan Francisco(function(){\n<div id=\"mainsophisticatedmathematical /head>\r\n<bodysuggests thatdocumentationconcentrationrelationshipsmay have been(for example,This article in some casesparts of the definition ofGreat Britain cellpadding=equivalent toplaceholder=\"; font-size: justificationbelieved thatsuffered fromattempted to leader of thecript\" src=\"/(function() {are available\n\t<link rel=\" src='http://interested inconventional \" alt=\"\" /></are generallyhas also beenmost popular correspondingcredited withtyle=\"border:</a></span></.gif\" width=\"<iframe src=\"table class=\"inline-block;according to together withapproximatelyparliamentarymore and moredisplay:none;traditionallypredominantly&nbsp;|&nbsp;&nbsp;</span> cellspacing=<input name=\"or\" content=\"controversialproperty=\"og:/x-shockwave-demonstrationsurrounded byNevertheless,was the firstconsiderable Although the collaborationshould not beproportion of<span style=\"known as the shortly afterfor instance,described as /head>\n<body starting withincreasingly the fact thatdiscussion ofmiddle of thean individualdifficult to point of viewhomosexualityacceptance of</span></div>manufacturersorigin of thecommonly usedimportance ofdenominationsbackground: #length of thedeterminationa significant\" border=\"0\">revolutionaryprinciples ofis consideredwas developedIndo-Europeanvulnerable toproponents ofare sometimescloser to theNew York City name=\"searchattributed tocourse of themathematicianby the end ofat the end of\" border=\"0\" technological.removeClass(branch of theevidence that![endif]-->\r\nInstitute of into a singlerespectively.and thereforeproperties ofis located insome of whichThere is alsocontinued to appearance of &amp;ndash; describes theconsiderationauthor of theindependentlyequipped withdoes not have</a><a href=\"confused with<link href=\"/at the age ofappear in theThese includeregardless ofcould be used style=&quot;several timesrepresent thebody>\n</html>thought to bepopulation ofpossibilitiespercentage ofaccess to thean attempt toproduction ofjquery/jquerytwo differentbelong to theestablishmentreplacing thedescription\" determine theavailable forAccording to wide range of\t<div class=\"more commonlyorganisationsfunctionalitywas completed &amp;mdash; participationthe characteran additionalappears to befact that thean example ofsignificantlyonmouseover=\"because they async = true;problems withseems to havethe result of src=\"http://familiar withpossession offunction () {took place inand sometimessubstantially<span></span>is often usedin an attemptgreat deal ofEnvironmentalsuccessfully virtually all20th century,professionalsnecessary to determined bycompatibilitybecause it isDictionary ofmodificationsThe followingmay refer to:Consequently,Internationalalthough somethat would beworld's firstclassified asbottom of the(particularlyalign=\"left\" most commonlybasis for thefoundation ofcontributionspopularity ofcenter of theto reduce thejurisdictionsapproximation onmouseout=\"New Testamentcollection of</span></a></in the Unitedfilm director-strict.dtd\">has been usedreturn to thealthough thischange in theseveral otherbut there areunprecedentedis similar toespecially inweight: bold;is called thecomputationalindicate thatrestricted to\t<meta name=\"are typicallyconflict withHowever, the An example ofcompared withquantities ofrather than aconstellationnecessary forreported thatspecificationpolitical and&nbsp;&nbsp;<references tothe same yearGovernment ofgeneration ofhave not beenseveral yearscommitment to\t\t<ul class=\"visualization19th century,practitionersthat he wouldand continuedoccupation ofis defined ascentre of thethe amount of><div style=\"equivalent ofdifferentiatebrought aboutmargin-left: automaticallythought of asSome of these\n<div class=\"input class=\"replaced withis one of theeducation andinfluenced byreputation as\n<meta name=\"accommodation</div>\n</div>large part ofInstitute forthe so-called against the In this case,was appointedclaimed to beHowever, thisDepartment ofthe remainingeffect on theparticularly deal with the\n<div style=\"almost alwaysare currentlyexpression ofphilosophy offor more thancivilizationson the islandselectedIndexcan result in\" value=\"\" />the structure /></a></div>Many of thesecaused by theof the Unitedspan class=\"mcan be tracedis related tobecame one ofis frequentlyliving in thetheoreticallyFollowing theRevolutionarygovernment inis determinedthe politicalintroduced insufficient todescription\">short storiesseparation ofas to whetherknown for itswas initiallydisplay:blockis an examplethe principalconsists of arecognized as/body></html>a substantialreconstructedhead of stateresistance toundergraduateThere are twogravitationalare describedintentionallyserved as theclass=\"headeropposition tofundamentallydominated theand the otheralliance withwas forced torespectively,and politicalin support ofpeople in the20th century.and publishedloadChartbeatto understandmember statesenvironmentalfirst half ofcountries andarchitecturalbe consideredcharacterizedclearIntervalauthoritativeFederation ofwas succeededand there area consequencethe Presidentalso includedfree softwaresuccession ofdeveloped thewas destroyedaway from the;\n</script>\n<although theyfollowed by amore powerfulresulted in aUniversity ofHowever, manythe presidentHowever, someis thought tountil the endwas announcedare importantalso includes><input type=the center of DO NOT ALTERused to referthemes/?sort=that had beenthe basis forhas developedin the summercomparativelydescribed thesuch as thosethe resultingis impossiblevarious otherSouth Africanhave the sameeffectivenessin which case; text-align:structure and; background:regarding thesupported theis also knownstyle=\"marginincluding thebahasa Melayunorsk bokmC%lnorsk nynorskslovenE!D\rinainternacionalcalificaciC3ncomunicaciC3nconstrucciC3n\"><div class=\"disambiguationDomainName', 'administrationsimultaneouslytransportationInternational margin-bottom:responsibility<![endif]-->\n</><meta name=\"implementationinfrastructurerepresentationborder-bottom:</head>\n<body>=http%3A%2F%2F<form method=\"method=\"post\" /favicon.ico\" });\n</script>\n.setAttribute(Administration= new Array();<![endif]-->\r\ndisplay:block;Unfortunately,\">&nbsp;</div>/favicon.ico\">='stylesheet' identification, for example,<li><a href=\"/an alternativeas a result ofpt\"></script>\ntype=\"submit\" \n(function() {recommendationform action=\"/transformationreconstruction.style.display According to hidden\" name=\"along with thedocument.body.approximately Communicationspost\" action=\"meaning &quot;--<![endif]-->Prime Ministercharacteristic</a> <a class=the history of onmouseover=\"the governmenthref=\"https://was originallywas introducedclassificationrepresentativeare considered<![endif]-->\n\ndepends on theUniversity of in contrast to placeholder=\"in the case ofinternational constitutionalstyle=\"border-: function() {Because of the-strict.dtd\">\n<table class=\"accompanied byaccount of the<script src=\"/nature of the the people in in addition tos); js.id = id\" width=\"100%\"regarding the Roman Catholican independentfollowing the .gif\" width=\"1the following discriminationarchaeologicalprime minister.js\"></script>combination of marginwidth=\"createElement(w.attachEvent(</a></td></tr>src=\"https://aIn particular, align=\"left\" Czech RepublicUnited Kingdomcorrespondenceconcluded that.html\" title=\"(function () {comes from theapplication of<span class=\"sbelieved to beement('script'</a>\n</li>\n<livery different><span class=\"option value=\"(also known as\t<li><a href=\"><input name=\"separated fromreferred to as valign=\"top\">founder of theattempting to carbon dioxide\n\n<div class=\"class=\"search-/body>\n</html>opportunity tocommunications</head>\r\n<body style=\"width:Tia:?ng Via;\u0007tchanges in theborder-color:#0\" border=\"0\" </span></div><was discovered\" type=\"text\" );\n</script>\n\nDepartment of ecclesiasticalthere has beenresulting from</body></html>has never beenthe first timein response toautomatically </div>\n\n<div iwas consideredpercent of the\" /></a></div>collection of descended fromsection of theaccept-charsetto be confusedmember of the padding-right:translation ofinterpretation href='http://whether or notThere are alsothere are manya small numberother parts ofimpossible to class=\"buttonlocated in the. However, theand eventuallyAt the end of because of itsrepresents the<form action=\" method=\"post\"it is possiblemore likely toan increase inhave also beencorresponds toannounced thatalign=\"right\">many countriesfor many yearsearliest knownbecause it waspt\"></script>\r valign=\"top\" inhabitants offollowing year\r\n<div class=\"million peoplecontroversial concerning theargue that thegovernment anda reference totransferred todescribing the style=\"color:although therebest known forsubmit\" name=\"multiplicationmore than one recognition ofCouncil of theedition of the <meta name=\"Entertainment away from the ;margin-right:at the time ofinvestigationsconnected withand many otheralthough it isbeginning with <span class=\"descendants of<span class=\"i align=\"right\"</head>\n<body aspects of thehas since beenEuropean Unionreminiscent ofmore difficultVice Presidentcomposition ofpassed throughmore importantfont-size:11pxexplanation ofthe concept ofwritten in the\t<span class=\"is one of the resemblance toon the groundswhich containsincluding the defined by thepublication ofmeans that theoutside of thesupport of the<input class=\"<span class=\"t(Math.random()most prominentdescription ofConstantinoplewere published<div class=\"seappears in the1\" height=\"1\" most importantwhich includeswhich had beendestruction ofthe population\n\t<div class=\"possibility ofsometimes usedappear to havesuccess of theintended to bepresent in thestyle=\"clear:b\r\n</script>\r\n<was founded ininterview with_id\" content=\"capital of the\r\n<link rel=\"srelease of thepoint out thatxMLHttpRequestand subsequentsecond largestvery importantspecificationssurface of theapplied to theforeign policy_setDomainNameestablished inis believed toIn addition tomeaning of theis named afterto protect theis representedDeclaration ofmore efficientClassificationother forms ofhe returned to<span class=\"cperformance of(function() {\rif and only ifregions of theleading to therelations withUnited Nationsstyle=\"height:other than theype\" content=\"Association of\n</head>\n<bodylocated on theis referred to(including theconcentrationsthe individualamong the mostthan any other/>\n<link rel=\" return false;the purpose ofthe ability to;color:#fff}\n.\n<span class=\"the subject ofdefinitions of>\r\n<link rel=\"claim that thehave developed<table width=\"celebration ofFollowing the to distinguish<span class=\"btakes place inunder the namenoted that the><![endif]-->\nstyle=\"margin-instead of theintroduced thethe process ofincreasing thedifferences inestimated thatespecially the/div><div id=\"was eventuallythroughout histhe differencesomething thatspan></span></significantly ></script>\r\n\r\nenvironmental to prevent thehave been usedespecially forunderstand theis essentiallywere the firstis the largesthave been made\" src=\"http://interpreted assecond half ofcrolling=\"no\" is composed ofII, Holy Romanis expected tohave their owndefined as thetraditionally have differentare often usedto ensure thatagreement withcontaining theare frequentlyinformation onexample is theresulting in a</a></li></ul> class=\"footerand especiallytype=\"button\" </span></span>which included>\n<meta name=\"considered thecarried out byHowever, it isbecame part ofin relation topopular in thethe capital ofwas officiallywhich has beenthe History ofalternative todifferent fromto support thesuggested thatin the process <div class=\"the foundationbecause of hisconcerned withthe universityopposed to thethe context of<span class=\"ptext\" name=\"q\"\t\t<div class=\"the scientificrepresented bymathematicianselected by thethat have been><div class=\"cdiv id=\"headerin particular,converted into);\n</script>\n<philosophical srpskohrvatskitia:?ng Via;\u0007tP Q\u0003Q\u0001Q\u0001P:P8P9Q\u0000Q\u0003Q\u0001Q\u0001P:P8P9investigaciC3nparticipaciC3nP:P>Q\u0002P>Q\u0000Q\u000BP5P>P1P;P0Q\u0001Q\u0002P8P:P>Q\u0002P>Q\u0000Q\u000BP9Q\u0007P5P;P>P2P5P:Q\u0001P8Q\u0001Q\u0002P5P<Q\u000BP\u001DP>P2P>Q\u0001Q\u0002P8P:P>Q\u0002P>Q\u0000Q\u000BQ\u0005P>P1P;P0Q\u0001Q\u0002Q\u000CP2Q\u0000P5P<P5P=P8P:P>Q\u0002P>Q\u0000P0Q\u000FQ\u0001P5P3P>P4P=Q\u000FQ\u0001P:P0Q\u0007P0Q\u0002Q\u000CP=P>P2P>Q\u0001Q\u0002P8P#P:Q\u0000P0P8P=Q\u000BP2P>P?Q\u0000P>Q\u0001Q\u000BP:P>Q\u0002P>Q\u0000P>P9Q\u0001P4P5P;P0Q\u0002Q\u000CP?P>P<P>Q\tQ\u000CQ\u000EQ\u0001Q\u0000P5P4Q\u0001Q\u0002P2P>P1Q\u0000P0P7P>P<Q\u0001Q\u0002P>Q\u0000P>P=Q\u000BQ\u0003Q\u0007P0Q\u0001Q\u0002P8P5Q\u0002P5Q\u0007P5P=P8P5P\u0013P;P0P2P=P0Q\u000FP8Q\u0001Q\u0002P>Q\u0000P8P8Q\u0001P8Q\u0001Q\u0002P5P<P0Q\u0000P5Q\u0008P5P=P8Q\u000FP!P:P0Q\u0007P0Q\u0002Q\u000CP?P>Q\rQ\u0002P>P<Q\u0003Q\u0001P;P5P4Q\u0003P5Q\u0002Q\u0001P:P0P7P0Q\u0002Q\u000CQ\u0002P>P2P0Q\u0000P>P2P:P>P=P5Q\u0007P=P>Q\u0000P5Q\u0008P5P=P8P5P:P>Q\u0002P>Q\u0000P>P5P>Q\u0000P3P0P=P>P2P:P>Q\u0002P>Q\u0000P>P<P P5P:P;P0P<P0X'Y\u0004Y\u0005Y\u0006X*X/Y\tY\u0005Y\u0006X*X/Y\nX'X*X'Y\u0004Y\u0005Y\u0008X6Y\u0008X9X'Y\u0004X(X1X'Y\u0005X,X'Y\u0004Y\u0005Y\u0008X'Y\u0002X9X'Y\u0004X1X3X'X&Y\u0004Y\u0005X4X'X1Y\u0003X'X*X'Y\u0004X#X9X6X'X!X'Y\u0004X1Y\nX'X6X)X'Y\u0004X*X5Y\u0005Y\nY\u0005X'Y\u0004X'X9X6X'X!X'Y\u0004Y\u0006X*X'X&X,X'Y\u0004X#Y\u0004X9X'X(X'Y\u0004X*X3X,Y\nY\u0004X'Y\u0004X#Y\u0002X3X'Y\u0005X'Y\u0004X6X:X7X'X*X'Y\u0004Y\u0001Y\nX/Y\nY\u0008X'Y\u0004X*X1X-Y\nX(X'Y\u0004X,X/Y\nX/X)X'Y\u0004X*X9Y\u0004Y\nY\u0005X'Y\u0004X#X.X(X'X1X'Y\u0004X'Y\u0001Y\u0004X'Y\u0005X'Y\u0004X#Y\u0001Y\u0004X'Y\u0005X'Y\u0004X*X'X1Y\nX.X'Y\u0004X*Y\u0002Y\u0006Y\nX)X'Y\u0004X'Y\u0004X9X'X(X'Y\u0004X.Y\u0008X'X7X1X'Y\u0004Y\u0005X,X*Y\u0005X9X'Y\u0004X/Y\nY\u0003Y\u0008X1X'Y\u0004X3Y\nX'X-X)X9X(X/X'Y\u0004Y\u0004Y\u0007X'Y\u0004X*X1X(Y\nX)X'Y\u0004X1Y\u0008X'X(X7X'Y\u0004X#X/X(Y\nX)X'Y\u0004X'X.X(X'X1X'Y\u0004Y\u0005X*X-X/X)X'Y\u0004X'X:X'Y\u0006Y\ncursor:pointer;</title>\n<meta \" href=\"http://\"><span class=\"members of the window.locationvertical-align:/a> | <a href=\"<!doctype html>media=\"screen\" <option value=\"favicon.ico\" />\n\t\t<div class=\"characteristics\" method=\"get\" /body>\n</html>\nshortcut icon\" document.write(padding-bottom:representativessubmit\" value=\"align=\"center\" throughout the science fiction\n <div class=\"submit\" class=\"one of the most valign=\"top\"><was established);\r\n</script>\r\nreturn false;\">).style.displaybecause of the document.cookie<form action=\"/}body{margin:0;Encyclopedia ofversion of the .createElement(name\" content=\"</div>\n</div>\n\nadministrative </body>\n</html>history of the \"><input type=\"portion of the as part of the &nbsp;<a href=\"other countries\">\n<div class=\"</span></span><In other words,display: block;control of the introduction of/>\n<meta name=\"as well as the in recent years\r\n\t<div class=\"</div>\n\t</div>\ninspired by thethe end of the compatible withbecame known as style=\"margin:.js\"></script>< International there have beenGerman language style=\"color:#Communist Partyconsistent withborder=\"0\" cell marginheight=\"the majority of\" align=\"centerrelated to the many different Orthodox Churchsimilar to the />\n<link rel=\"swas one of the until his death})();\n</script>other languagescompared to theportions of thethe Netherlandsthe most commonbackground:url(argued that thescrolling=\"no\" included in theNorth American the name of theinterpretationsthe traditionaldevelopment of frequently useda collection ofvery similar tosurrounding theexample of thisalign=\"center\">would have beenimage_caption =attached to thesuggesting thatin the form of involved in theis derived fromnamed after theIntroduction torestrictions on style=\"width: can be used to the creation ofmost important information andresulted in thecollapse of theThis means thatelements of thewas replaced byanalysis of theinspiration forregarded as themost successfulknown as &quot;a comprehensiveHistory of the were consideredreturned to theare referred toUnsourced image>\n\t<div class=\"consists of thestopPropagationinterest in theavailability ofappears to haveelectromagneticenableServices(function of theIt is important</script></div>function(){var relative to theas a result of the position ofFor example, in method=\"post\" was followed by&amp;mdash; thethe applicationjs\"></script>\r\nul></div></div>after the deathwith respect tostyle=\"padding:is particularlydisplay:inline; type=\"submit\" is divided intod8-f\u0016\u0007 (g.\u0000d=\u0013)responsabilidadadministraciC3ninternacionalescorrespondiente`$\t`$*`$/`%\u000B`$\u0017`$*`%\u0002`$0`%\r`$5`$9`$.`$>`$0`%\u0007`$2`%\u000B`$\u0017`%\u000B`$\u0002`$\u001A`%\u0001`$(`$>`$5`$2`%\u0007`$\u0015`$?`$(`$8`$0`$\u0015`$>`$0`$*`%\u0001`$2`$?`$8`$\u0016`%\u000B`$\u001C`%\u0007`$\u0002`$\u001A`$>`$9`$?`$\u000F`$-`%\u0007`$\u001C`%\u0007`$\u0002`$6`$>`$.`$?`$2`$9`$.`$>`$0`%\u0000`$\u001C`$>`$\u0017`$0`$#`$,`$(`$>`$(`%\u0007`$\u0015`%\u0001`$.`$>`$0`$,`%\r`$2`%\t`$\u0017`$.`$>`$2`$?`$\u0015`$.`$9`$?`$2`$>`$*`%\u0003`$7`%\r`$ `$,`$\"`$<`$$`%\u0007`$-`$>`$\u001C`$*`$>`$\u0015`%\r`$2`$?`$\u0015`$\u001F`%\r`$0`%\u0007`$(`$\u0016`$?`$2`$>`$+`$&`%\u000C`$0`$>`$(`$.`$>`$.`$2`%\u0007`$.`$$`$&`$>`$(`$,`$>`$\u001C`$>`$0`$5`$?`$\u0015`$>`$8`$\u0015`%\r`$/`%\u000B`$\u0002`$\u001A`$>`$9`$$`%\u0007`$*`$9`%\u0001`$\u0001`$\u001A`$,`$$`$>`$/`$>`$8`$\u0002`$5`$>`$&`$&`%\u0007`$\u0016`$(`%\u0007`$*`$?`$\u001B`$2`%\u0007`$5`$?`$6`%\u0007`$7`$0`$>`$\u001C`%\r`$/`$\t`$$`%\r`$$`$0`$.`%\u0001`$\u0002`$,`$\u0008`$&`%\u000B`$(`%\u000B`$\u0002`$\t`$*`$\u0015`$0`$#`$*`$\"`$<`%\u0007`$\u0002`$8`%\r`$%`$?`$$`$+`$?`$2`%\r`$.`$.`%\u0001`$\u0016`%\r`$/`$\u0005`$\u001A`%\r`$\u001B`$>`$\u001B`%\u0002`$\u001F`$$`%\u0000`$8`$\u0002`$\u0017`%\u0000`$$`$\u001C`$>`$\u000F`$\u0017`$>`$5`$?`$-`$>`$\u0017`$\u0018`$#`%\r`$\u001F`%\u0007`$&`%\u0002`$8`$0`%\u0007`$&`$?`$(`%\u000B`$\u0002`$9`$$`%\r`$/`$>`$8`%\u0007`$\u0015`%\r`$8`$\u0017`$>`$\u0002`$'`%\u0000`$5`$?`$6`%\r`$5`$0`$>`$$`%\u0007`$\u0002`$&`%\u0008`$\u001F`%\r`$8`$(`$\u0015`%\r`$6`$>`$8`$>`$.`$(`%\u0007`$\u0005`$&`$>`$2`$$`$,`$?`$\u001C`$2`%\u0000`$*`%\u0001`$0`%\u0002`$7`$9`$?`$\u0002`$&`%\u0000`$.`$?`$$`%\r`$0`$\u0015`$5`$?`$$`$>`$0`%\u0001`$*`$/`%\u0007`$8`%\r`$%`$>`$(`$\u0015`$0`%\u000B`$!`$<`$.`%\u0001`$\u0015`%\r`$$`$/`%\u000B`$\u001C`$(`$>`$\u0015`%\u0003`$*`$/`$>`$*`%\u000B`$8`%\r`$\u001F`$\u0018`$0`%\u0007`$2`%\u0002`$\u0015`$>`$0`%\r`$/`$5`$?`$\u001A`$>`$0`$8`%\u0002`$\u001A`$(`$>`$.`%\u0002`$2`%\r`$/`$&`%\u0007`$\u0016`%\u0007`$\u0002`$9`$.`%\u0007`$6`$>`$8`%\r`$\u0015`%\u0002`$2`$.`%\u0008`$\u0002`$(`%\u0007`$$`%\u0008`$/`$>`$0`$\u001C`$?`$8`$\u0015`%\u0007rss+xml\" title=\"-type\" content=\"title\" content=\"at the same time.js\"></script>\n<\" method=\"post\" </span></a></li>vertical-align:t/jquery.min.js\">.click(function( style=\"padding-})();\n</script>\n</span><a href=\"<a href=\"http://); return false;text-decoration: scrolling=\"no\" border-collapse:associated with Bahasa IndonesiaEnglish language<text xml:space=.gif\" border=\"0\"</body>\n</html>\noverflow:hidden;img src=\"http://addEventListenerresponsible for s.js\"></script>\n/favicon.ico\" />operating system\" style=\"width:1target=\"_blank\">State Universitytext-align:left;\ndocument.write(, including the around the world);\r\n</script>\r\n<\" style=\"height:;overflow:hiddenmore informationan internationala member of the one of the firstcan be found in </div>\n\t\t</div>\ndisplay: none;\">\" />\n<link rel=\"\n (function() {the 15th century.preventDefault(large number of Byzantine Empire.jpg|thumb|left|vast majority ofmajority of the align=\"center\">University Pressdominated by theSecond World Wardistribution of style=\"position:the rest of the characterized by rel=\"nofollow\">derives from therather than the a combination ofstyle=\"width:100English-speakingcomputer scienceborder=\"0\" alt=\"the existence ofDemocratic Party\" style=\"margin-For this reason,.js\"></script>\n\tsByTagName(s)[0]js\"></script>\r\n<.js\"></script>\r\nlink rel=\"icon\" ' alt='' class='formation of theversions of the </a></div></div>/page>\n <page>\n<div class=\"contbecame the firstbahasa Indonesiaenglish (simple)N\u0015N;N;N7N=N9N:N,Q\u0005Q\u0000P2P0Q\u0002Q\u0001P:P8P:P>P<P?P0P=P8P8Q\u000FP2P;Q\u000FP5Q\u0002Q\u0001Q\u000FP\u0014P>P1P0P2P8Q\u0002Q\u000CQ\u0007P5P;P>P2P5P:P0Q\u0000P0P7P2P8Q\u0002P8Q\u000FP\u0018P=Q\u0002P5Q\u0000P=P5Q\u0002P\u001EQ\u0002P2P5Q\u0002P8Q\u0002Q\u000CP=P0P?Q\u0000P8P<P5Q\u0000P8P=Q\u0002P5Q\u0000P=P5Q\u0002P:P>Q\u0002P>Q\u0000P>P3P>Q\u0001Q\u0002Q\u0000P0P=P8Q\u0006Q\u000BP:P0Q\u0007P5Q\u0001Q\u0002P2P5Q\u0003Q\u0001P;P>P2P8Q\u000FQ\u0005P?Q\u0000P>P1P;P5P<Q\u000BP?P>P;Q\u0003Q\u0007P8Q\u0002Q\u000CQ\u000FP2P;Q\u000FQ\u000EQ\u0002Q\u0001Q\u000FP=P0P8P1P>P;P5P5P:P>P<P?P0P=P8Q\u000FP2P=P8P<P0P=P8P5Q\u0001Q\u0000P5P4Q\u0001Q\u0002P2P0X'Y\u0004Y\u0005Y\u0008X'X6Y\nX9X'Y\u0004X1X&Y\nX3Y\nX)X'Y\u0004X'Y\u0006X*Y\u0002X'Y\u0004Y\u0005X4X'X1Y\u0003X'X*Y\u0003X'Y\u0004X3Y\nX'X1X'X*X'Y\u0004Y\u0005Y\u0003X*Y\u0008X(X)X'Y\u0004X3X9Y\u0008X/Y\nX)X'X-X5X'X&Y\nX'X*X'Y\u0004X9X'Y\u0004Y\u0005Y\nX)X'Y\u0004X5Y\u0008X*Y\nX'X*X'Y\u0004X'Y\u0006X*X1Y\u0006X*X'Y\u0004X*X5X'Y\u0005Y\nY\u0005X'Y\u0004X%X3Y\u0004X'Y\u0005Y\nX'Y\u0004Y\u0005X4X'X1Y\u0003X)X'Y\u0004Y\u0005X1X&Y\nX'X*robots\" content=\"<div id=\"footer\">the United States<img src=\"http://.jpg|right|thumb|.js\"></script>\r\n<location.protocolframeborder=\"0\" s\" />\n<meta name=\"</a></div></div><font-weight:bold;&quot; and &quot;depending on the margin:0;padding:\" rel=\"nofollow\" President of the twentieth centuryevision>\n </pageInternet Explorera.async = true;\r\ninformation about<div id=\"header\">\" action=\"http://<a href=\"https://<div id=\"content\"</div>\r\n</div>\r\n<derived from the <img src='http://according to the \n</body>\n</html>\nstyle=\"font-size:script language=\"Arial, Helvetica,</a><span class=\"</script><script political partiestd></tr></table><href=\"http://www.interpretation ofrel=\"stylesheet\" document.write('<charset=\"utf-8\">\nbeginning of the revealed that thetelevision series\" rel=\"nofollow\"> target=\"_blank\">claiming that thehttp%3A%2F%2Fwww.manifestations ofPrime Minister ofinfluenced by theclass=\"clearfix\">/div>\r\n</div>\r\n\r\nthree-dimensionalChurch of Englandof North Carolinasquare kilometres.addEventListenerdistinct from thecommonly known asPhonetic Alphabetdeclared that thecontrolled by theBenjamin Franklinrole-playing gamethe University ofin Western Europepersonal computerProject Gutenbergregardless of thehas been proposedtogether with the></li><li class=\"in some countriesmin.js\"></script>of the populationofficial language<img src=\"images/identified by thenatural resourcesclassification ofcan be consideredquantum mechanicsNevertheless, themillion years ago</body>\r\n</html>\rN\u0015N;N;N7N=N9N:N,\ntake advantage ofand, according toattributed to theMicrosoft Windowsthe first centuryunder the controldiv class=\"headershortly after thenotable exceptiontens of thousandsseveral differentaround the world.reaching militaryisolated from theopposition to thethe Old TestamentAfrican Americansinserted into theseparate from themetropolitan areamakes it possibleacknowledged thatarguably the mosttype=\"text/css\">\nthe InternationalAccording to the pe=\"text/css\" />\ncoincide with thetwo-thirds of theDuring this time,during the periodannounced that hethe internationaland more recentlybelieved that theconsciousness andformerly known assurrounded by thefirst appeared inoccasionally usedposition:absolute;\" target=\"_blank\" position:relative;text-align:center;jax/libs/jquery/1.background-color:#type=\"application/anguage\" content=\"<meta http-equiv=\"Privacy Policy</a>e(\"%3Cscript src='\" target=\"_blank\">On the other hand,.jpg|thumb|right|2</div><div class=\"<div style=\"float:nineteenth century</body>\r\n</html>\r\n<img src=\"http://s;text-align:centerfont-weight: bold; According to the difference between\" frameborder=\"0\" \" style=\"position:link href=\"http://html4/loose.dtd\">\nduring this period</td></tr></table>closely related tofor the first time;font-weight:bold;input type=\"text\" <span style=\"font-onreadystatechange\t<div class=\"cleardocument.location. For example, the a wide variety of <!DOCTYPE html>\r\n<&nbsp;&nbsp;&nbsp;\"><a href=\"http://style=\"float:left;concerned with the=http%3A%2F%2Fwww.in popular culturetype=\"text/css\" />it is possible to Harvard Universitytylesheet\" href=\"/the main characterOxford University name=\"keywords\" cstyle=\"text-align:the United Kingdomfederal government<div style=\"margin depending on the description of the<div class=\"header.min.js\"></script>destruction of theslightly differentin accordance withtelecommunicationsindicates that theshortly thereafterespecially in the European countriesHowever, there aresrc=\"http://staticsuggested that the\" src=\"http://www.a large number of Telecommunications\" rel=\"nofollow\" tHoly Roman Emperoralmost exclusively\" border=\"0\" alt=\"Secretary of Stateculminating in theCIA World Factbookthe most importantanniversary of thestyle=\"background-<li><em><a href=\"/the Atlantic Oceanstrictly speaking,shortly before thedifferent types ofthe Ottoman Empire><img src=\"http://An Introduction toconsequence of thedeparture from theConfederate Statesindigenous peoplesProceedings of theinformation on thetheories have beeninvolvement in thedivided into threeadjacent countriesis responsible fordissolution of thecollaboration withwidely regarded ashis contemporariesfounding member ofDominican Republicgenerally acceptedthe possibility ofare also availableunder constructionrestoration of thethe general publicis almost entirelypasses through thehas been suggestedcomputer and videoGermanic languages according to the different from theshortly afterwardshref=\"https://www.recent developmentBoard of Directors<div class=\"search| <a href=\"http://In particular, theMultiple footnotesor other substancethousands of yearstranslation of the</div>\r\n</div>\r\n\r\n<a href=\"index.phpwas established inmin.js\"></script>\nparticipate in thea strong influencestyle=\"margin-top:represented by thegraduated from theTraditionally, theElement(\"script\");However, since the/div>\n</div>\n<div left; margin-left:protection against0; vertical-align:Unfortunately, thetype=\"image/x-icon/div>\n<div class=\" class=\"clearfix\"><div class=\"footer\t\t</div>\n\t\t</div>\nthe motion pictureP\u0011Q\nP;P3P0Q\u0000Q\u0001P:P8P1Q\nP;P3P0Q\u0000Q\u0001P:P8P$P5P4P5Q\u0000P0Q\u0006P8P8P=P5Q\u0001P:P>P;Q\u000CP:P>Q\u0001P>P>P1Q\tP5P=P8P5Q\u0001P>P>P1Q\tP5P=P8Q\u000FP?Q\u0000P>P3Q\u0000P0P<P<Q\u000BP\u001EQ\u0002P?Q\u0000P0P2P8Q\u0002Q\u000CP1P5Q\u0001P?P;P0Q\u0002P=P>P<P0Q\u0002P5Q\u0000P8P0P;Q\u000BP?P>P7P2P>P;Q\u000FP5Q\u0002P?P>Q\u0001P;P5P4P=P8P5Q\u0000P0P7P;P8Q\u0007P=Q\u000BQ\u0005P?Q\u0000P>P4Q\u0003P:Q\u0006P8P8P?Q\u0000P>P3Q\u0000P0P<P<P0P?P>P;P=P>Q\u0001Q\u0002Q\u000CQ\u000EP=P0Q\u0005P>P4P8Q\u0002Q\u0001Q\u000FP8P7P1Q\u0000P0P=P=P>P5P=P0Q\u0001P5P;P5P=P8Q\u000FP8P7P<P5P=P5P=P8Q\u000FP:P0Q\u0002P5P3P>Q\u0000P8P8P\u0010P;P5P:Q\u0001P0P=P4Q\u0000`$&`%\r`$5`$>`$0`$>`$.`%\u0008`$(`%\u0001`$\u0005`$2`$*`%\r`$0`$&`$>`$(`$-`$>`$0`$$`%\u0000`$/`$\u0005`$(`%\u0001`$&`%\u0007`$6`$9`$?`$(`%\r`$&`%\u0000`$\u0007`$\u0002`$!`$?`$/`$>`$&`$?`$2`%\r`$2`%\u0000`$\u0005`$'`$?`$\u0015`$>`$0`$5`%\u0000`$!`$?`$/`%\u000B`$\u001A`$?`$\u001F`%\r`$ `%\u0007`$8`$.`$>`$\u001A`$>`$0`$\u001C`$\u0002`$\u0015`%\r`$6`$(`$&`%\u0001`$(`$?`$/`$>`$*`%\r`$0`$/`%\u000B`$\u0017`$\u0005`$(`%\u0001`$8`$>`$0`$\u0011`$(`$2`$>`$\u0007`$(`$*`$>`$0`%\r`$\u001F`%\u0000`$6`$0`%\r`$$`%\u000B`$\u0002`$2`%\u000B`$\u0015`$8`$-`$>`$+`$<`%\r`$2`%\u0008`$6`$6`$0`%\r`$$`%\u0007`$\u0002`$*`%\r`$0`$&`%\u0007`$6`$*`%\r`$2`%\u0007`$/`$0`$\u0015`%\u0007`$\u0002`$&`%\r`$0`$8`%\r`$%`$?`$$`$?`$\t`$$`%\r`$*`$>`$&`$\t`$(`%\r`$9`%\u0007`$\u0002`$\u001A`$?`$\u001F`%\r`$ `$>`$/`$>`$$`%\r`$0`$>`$\u001C`%\r`$/`$>`$&`$>`$*`%\u0001`$0`$>`$(`%\u0007`$\u001C`%\u000B`$!`$<`%\u0007`$\u0002`$\u0005`$(`%\u0001`$5`$>`$&`$6`%\r`$0`%\u0007`$#`%\u0000`$6`$?`$\u0015`%\r`$7`$>`$8`$0`$\u0015`$>`$0`%\u0000`$8`$\u0002`$\u0017`%\r`$0`$9`$*`$0`$?`$#`$>`$.`$,`%\r`$0`$>`$\u0002`$!`$,`$\u001A`%\r`$\u001A`%\u000B`$\u0002`$\t`$*`$2`$,`%\r`$'`$.`$\u0002`$$`%\r`$0`%\u0000`$8`$\u0002`$*`$0`%\r`$\u0015`$\t`$.`%\r`$.`%\u0000`$&`$.`$>`$'`%\r`$/`$.`$8`$9`$>`$/`$$`$>`$6`$,`%\r`$&`%\u000B`$\u0002`$.`%\u0000`$!`$?`$/`$>`$\u0006`$\u0008`$*`%\u0000`$\u000F`$2`$.`%\u000B`$,`$>`$\u0007`$2`$8`$\u0002`$\u0016`%\r`$/`$>`$\u0006`$*`$0`%\u0007`$6`$(`$\u0005`$(`%\u0001`$,`$\u0002`$'`$,`$>`$\u001C`$<`$>`$0`$(`$5`%\u0000`$(`$$`$.`$*`%\r`$0`$.`%\u0001`$\u0016`$*`%\r`$0`$6`%\r`$(`$*`$0`$?`$5`$>`$0`$(`%\u0001`$\u0015`$8`$>`$(`$8`$.`$0`%\r`$%`$(`$\u0006`$/`%\u000B`$\u001C`$?`$$`$8`%\u000B`$.`$5`$>`$0X'Y\u0004Y\u0005X4X'X1Y\u0003X'X*X'Y\u0004Y\u0005Y\u0006X*X/Y\nX'X*X'Y\u0004Y\u0003Y\u0005X(Y\nY\u0008X*X1X'Y\u0004Y\u0005X4X'Y\u0007X/X'X*X9X/X/X'Y\u0004X2Y\u0008X'X1X9X/X/X'Y\u0004X1X/Y\u0008X/X'Y\u0004X%X3Y\u0004X'Y\u0005Y\nX)X'Y\u0004Y\u0001Y\u0008X*Y\u0008X4Y\u0008X(X'Y\u0004Y\u0005X3X'X(Y\u0002X'X*X'Y\u0004Y\u0005X9Y\u0004Y\u0008Y\u0005X'X*X'Y\u0004Y\u0005X3Y\u0004X3Y\u0004X'X*X'Y\u0004X,X1X'Y\u0001Y\nY\u0003X3X'Y\u0004X'X3Y\u0004X'Y\u0005Y\nX)X'Y\u0004X'X*X5X'Y\u0004X'X*keywords\" content=\"w3.org/1999/xhtml\"><a target=\"_blank\" text/html; charset=\" target=\"_blank\"><table cellpadding=\"autocomplete=\"off\" text-align: center;to last version by background-color: #\" href=\"http://www./div></div><div id=<a href=\"#\" class=\"\"><img src=\"http://cript\" src=\"http://\n<script language=\"//EN\" \"http://www.wencodeURIComponent(\" href=\"javascript:<div class=\"contentdocument.write('<scposition: absolute;script src=\"http:// style=\"margin-top:.min.js\"></script>\n</div>\n<div class=\"w3.org/1999/xhtml\" \n\r\n</body>\r\n</html>distinction between/\" target=\"_blank\"><link href=\"http://encoding=\"utf-8\"?>\nw.addEventListener?action=\"http://www.icon\" href=\"http:// style=\"background:type=\"text/css\" />\nmeta property=\"og:t<input type=\"text\" style=\"text-align:the development of tylesheet\" type=\"tehtml; charset=utf-8is considered to betable width=\"100%\" In addition to the contributed to the differences betweendevelopment of the It is important to </script>\n\n<script style=\"font-size:1></span><span id=gbLibrary of Congress<img src=\"http://imEnglish translationAcademy of Sciencesdiv style=\"display:construction of the.getElementById(id)in conjunction withElement('script'); <meta property=\"og:P\u0011Q\nP;P3P0Q\u0000Q\u0001P:P8\n type=\"text\" name=\">Privacy Policy</a>administered by theenableSingleRequeststyle=&quot;margin:</div></div></div><><img src=\"http://i style=&quot;float:referred to as the total population ofin Washington, D.C. style=\"background-among other things,organization of theparticipated in thethe introduction ofidentified with thefictional character Oxford University misunderstanding ofThere are, however,stylesheet\" href=\"/Columbia Universityexpanded to includeusually referred toindicating that thehave suggested thataffiliated with thecorrelation betweennumber of different></td></tr></table>Republic of Ireland\n</script>\n<script under the influencecontribution to theOfficial website ofheadquarters of thecentered around theimplications of thehave been developedFederal Republic ofbecame increasinglycontinuation of theNote, however, thatsimilar to that of capabilities of theaccordance with theparticipants in thefurther developmentunder the directionis often consideredhis younger brother</td></tr></table><a http-equiv=\"X-UA-physical propertiesof British Columbiahas been criticized(with the exceptionquestions about thepassing through the0\" cellpadding=\"0\" thousands of peopleredirects here. Forhave children under%3E%3C/script%3E\"));<a href=\"http://www.<li><a href=\"http://site_name\" content=\"text-decoration:nonestyle=\"display: none<meta http-equiv=\"X-new Date().getTime() type=\"image/x-icon\"</span><span class=\"language=\"javascriptwindow.location.href<a href=\"javascript:-->\r\n<script type=\"t<a href='http://www.hortcut icon\" href=\"</div>\r\n<div class=\"<script src=\"http://\" rel=\"stylesheet\" t</div>\n<script type=/a> <a href=\"http:// allowTransparency=\"X-UA-Compatible\" conrelationship between\n</script>\r\n<script </a></li></ul></div>associated with the programming language</a><a href=\"http://</a></li><li class=\"form action=\"http://<div style=\"display:type=\"text\" name=\"q\"<table width=\"100%\" background-position:\" border=\"0\" width=\"rel=\"shortcut icon\" h6><ul><li><a href=\" <meta http-equiv=\"css\" media=\"screen\" responsible for the \" type=\"application/\" style=\"background-html; charset=utf-8\" allowtransparency=\"stylesheet\" type=\"te\r\n<meta http-equiv=\"></span><span class=\"0\" cellspacing=\"0\">;\n</script>\n<script sometimes called thedoes not necessarilyFor more informationat the beginning of <!DOCTYPE html><htmlparticularly in the type=\"hidden\" name=\"javascript:void(0);\"effectiveness of the autocomplete=\"off\" generally considered><input type=\"text\" \"></script>\r\n<scriptthroughout the worldcommon misconceptionassociation with the</div>\n</div>\n<div cduring his lifetime,corresponding to thetype=\"image/x-icon\" an increasing numberdiplomatic relationsare often consideredmeta charset=\"utf-8\" <input type=\"text\" examples include the\"><img src=\"http://iparticipation in thethe establishment of\n</div>\n<div class=\"&amp;nbsp;&amp;nbsp;to determine whetherquite different frommarked the beginningdistance between thecontributions to theconflict between thewidely considered towas one of the firstwith varying degreeshave speculated that(document.getElementparticipating in theoriginally developedeta charset=\"utf-8\"> type=\"text/css\" />\ninterchangeably withmore closely relatedsocial and politicalthat would otherwiseperpendicular to thestyle type=\"text/csstype=\"submit\" name=\"families residing indeveloping countriescomputer programmingeconomic developmentdetermination of thefor more informationon several occasionsportuguC*s (Europeu)P#P:Q\u0000P0Q\u0017P=Q\u0001Q\u000CP:P0Q\u0003P:Q\u0000P0Q\u0017P=Q\u0001Q\u000CP:P0P P>Q\u0001Q\u0001P8P9Q\u0001P:P>P9P<P0Q\u0002P5Q\u0000P8P0P;P>P2P8P=Q\u0004P>Q\u0000P<P0Q\u0006P8P8Q\u0003P?Q\u0000P0P2P;P5P=P8Q\u000FP=P5P>P1Q\u0005P>P4P8P<P>P8P=Q\u0004P>Q\u0000P<P0Q\u0006P8Q\u000FP\u0018P=Q\u0004P>Q\u0000P<P0Q\u0006P8Q\u000FP P5Q\u0001P?Q\u0003P1P;P8P:P8P:P>P;P8Q\u0007P5Q\u0001Q\u0002P2P>P8P=Q\u0004P>Q\u0000P<P0Q\u0006P8Q\u000EQ\u0002P5Q\u0000Q\u0000P8Q\u0002P>Q\u0000P8P8P4P>Q\u0001Q\u0002P0Q\u0002P>Q\u0007P=P>X'Y\u0004Y\u0005X*Y\u0008X'X,X/Y\u0008Y\u0006X'Y\u0004X'X4X*X1X'Y\u0003X'X*X'Y\u0004X'Y\u0002X*X1X'X-X'X*html; charset=UTF-8\" setTimeout(function()display:inline-block;<input type=\"submit\" type = 'text/javascri<img src=\"http://www.\" \"http://www.w3.org/shortcut icon\" href=\"\" autocomplete=\"off\" </a></div><div class=</a></li>\n<li class=\"css\" type=\"text/css\" <form action=\"http://xt/css\" href=\"http://link rel=\"alternate\" \r\n<script type=\"text/ onclick=\"javascript:(new Date).getTime()}height=\"1\" width=\"1\" People's Republic of <a href=\"http://www.text-decoration:underthe beginning of the </div>\n</div>\n</div>\nestablishment of the </div></div></div></d#viewport{min-height:\n<script src=\"http://option><option value=often referred to as /option>\n<option valu<!DOCTYPE html>\n<!--[International Airport>\n<a href=\"http://www</a><a href=\"http://w`8 `82`8)`82`9\u0004`8\u0017`8\"a\u0003%a\u0003\u0010a\u0003 a\u0003\u0017a\u0003#a\u0003\u001Aa\u0003\u0018f-#i+\u0014d8-f\u0016\u0007 (g9\u0001i+\u0014)`$(`$?`$0`%\r`$&`%\u0007`$6`$!`$>`$\t`$(`$2`%\u000B`$!`$\u0015`%\r`$7`%\u0007`$$`%\r`$0`$\u001C`$>`$(`$\u0015`$>`$0`%\u0000`$8`$\u0002`$,`$\u0002`$'`$?`$$`$8`%\r`$%`$>`$*`$(`$>`$8`%\r`$5`%\u0000`$\u0015`$>`$0`$8`$\u0002`$8`%\r`$\u0015`$0`$#`$8`$>`$.`$\u0017`%\r`$0`%\u0000`$\u001A`$?`$\u001F`%\r`$ `%\u000B`$\u0002`$5`$?`$\u001C`%\r`$\u001E`$>`$(`$\u0005`$.`%\u0007`$0`$?`$\u0015`$>`$5`$?`$-`$?`$(`%\r`$(`$\u0017`$>`$!`$?`$/`$>`$\u0001`$\u0015`%\r`$/`%\u000B`$\u0002`$\u0015`$?`$8`%\u0001`$0`$\u0015`%\r`$7`$>`$*`$9`%\u0001`$\u0001`$\u001A`$$`%\u0000`$*`%\r`$0`$,`$\u0002`$'`$(`$\u001F`$?`$*`%\r`$*`$#`%\u0000`$\u0015`%\r`$0`$?`$\u0015`%\u0007`$\u001F`$*`%\r`$0`$>`$0`$\u0002`$-`$*`%\r`$0`$>`$*`%\r`$$`$.`$>`$2`$?`$\u0015`%\u000B`$\u0002`$0`$+`$<`%\r`$$`$>`$0`$(`$?`$0`%\r`$.`$>`$#`$2`$?`$.`$?`$\u001F`%\u0007`$!description\" content=\"document.location.prot.getElementsByTagName(<!DOCTYPE html>\n<html <meta charset=\"utf-8\">:url\" content=\"http://.css\" rel=\"stylesheet\"style type=\"text/css\">type=\"text/css\" href=\"w3.org/1999/xhtml\" xmltype=\"text/javascript\" method=\"get\" action=\"link rel=\"stylesheet\" = document.getElementtype=\"image/x-icon\" />cellpadding=\"0\" cellsp.css\" type=\"text/css\" </a></li><li><a href=\"\" width=\"1\" height=\"1\"\"><a href=\"http://www.style=\"display:none;\">alternate\" type=\"appli-//W3C//DTD XHTML 1.0 ellspacing=\"0\" cellpad type=\"hidden\" value=\"/a>&nbsp;<span role=\"s\n<input type=\"hidden\" language=\"JavaScript\" document.getElementsBg=\"0\" cellspacing=\"0\" ype=\"text/css\" media=\"type='text/javascript'with the exception of ype=\"text/css\" rel=\"st height=\"1\" width=\"1\" ='+encodeURIComponent(<link rel=\"alternate\" \nbody, tr, input, textmeta name=\"robots\" conmethod=\"post\" action=\">\n<a href=\"http://www.css\" rel=\"stylesheet\" </div></div><div classlanguage=\"javascript\">aria-hidden=\"true\">B7<ript\" type=\"text/javasl=0;})();\n(function(){background-image: url(/a></li><li><a href=\"h\t\t<li><a href=\"http://ator\" aria-hidden=\"tru> <a href=\"http://www.language=\"javascript\" /option>\n<option value/div></div><div class=rator\" aria-hidden=\"tre=(new Date).getTime()portuguC*s (do Brasil)P>Q\u0000P3P0P=P8P7P0Q\u0006P8P8P2P>P7P<P>P6P=P>Q\u0001Q\u0002Q\u000CP>P1Q\u0000P0P7P>P2P0P=P8Q\u000FQ\u0000P5P3P8Q\u0001Q\u0002Q\u0000P0Q\u0006P8P8P2P>P7P<P>P6P=P>Q\u0001Q\u0002P8P>P1Q\u000FP7P0Q\u0002P5P;Q\u000CP=P0<!DOCTYPE html PUBLIC \"nt-Type\" content=\"text/<meta http-equiv=\"Conteransitional//EN\" \"http:<html xmlns=\"http://www-//W3C//DTD XHTML 1.0 TDTD/xhtml1-transitional//www.w3.org/TR/xhtml1/pe = 'text/javascript';<meta name=\"descriptionparentNode.insertBefore<input type=\"hidden\" najs\" type=\"text/javascri(document).ready(functiscript type=\"text/javasimage\" content=\"http://UA-Compatible\" content=tml; charset=utf-8\" />\nlink rel=\"shortcut icon<link rel=\"stylesheet\" </script>\n<script type== document.createElemen<a target=\"_blank\" href= document.getElementsBinput type=\"text\" name=a.type = 'text/javascrinput type=\"hidden\" namehtml; charset=utf-8\" />dtd\">\n<html xmlns=\"http-//W3C//DTD HTML 4.01 TentsByTagName('script')input type=\"hidden\" nam<script type=\"text/javas\" style=\"display:none;\">document.getElementById(=document.createElement(' type='text/javascript'input type=\"text\" name=\"d.getElementsByTagName(snical\" href=\"http://www.C//DTD HTML 4.01 Transit<style type=\"text/css\">\n\n<style type=\"text/css\">ional.dtd\">\n<html xmlns=http-equiv=\"Content-Typeding=\"0\" cellspacing=\"0\"html; charset=utf-8\" />\n style=\"display:none;\"><<li><a href=\"http://www. type='text/javascript'>P4P5Q\u000FQ\u0002P5P;Q\u000CP=P>Q\u0001Q\u0002P8Q\u0001P>P>Q\u0002P2P5Q\u0002Q\u0001Q\u0002P2P8P8P?Q\u0000P>P8P7P2P>P4Q\u0001Q\u0002P2P0P1P5P7P>P?P0Q\u0001P=P>Q\u0001Q\u0002P8`$*`%\u0001`$8`%\r`$$`$?`$\u0015`$>`$\u0015`$>`$\u0002`$\u0017`%\r`$0`%\u0007`$8`$\t`$(`%\r`$9`%\u000B`$\u0002`$(`%\u0007`$5`$?`$'`$>`$(`$8`$-`$>`$+`$?`$\u0015`%\r`$8`$?`$\u0002`$\u0017`$8`%\u0001`$0`$\u0015`%\r`$7`$?`$$`$\u0015`%\t`$*`%\u0000`$0`$>`$\u0007`$\u001F`$5`$?`$\u001C`%\r`$\u001E`$>`$*`$(`$\u0015`$>`$0`%\r`$0`$5`$>`$\u0008`$8`$\u0015`%\r`$0`$?`$/`$$`$>";
+ private static final String SKIP_FLIP = "\u06F7%\u018C'T%\u0085'W%\u00D7%O%g%\u00A6&\u0193%\u01E5&>&*&'&^&\u0088\u0178\u0C3E&\u01AD&\u0192&)&^&%&'&\u0082&P&1&\u00B1&3&]&m&u&E&t&C&\u00CF&V&V&/&>&6&\u0F76\u177Co&p&@&E&M&P&x&@&F&e&\u00CC&7&:&(&D&0&C&)&.&F&-&1&(&L&F&1\u025E*\u03EA\u21F3&\u1372&K&;&)&E&H&P&0&?&9&V&\u0081&-&v&a&,&E&)&?&=&'&'&B&\u0D2E&\u0503&\u0316*&*8&%&%&&&%,)&\u009A&>&\u0086&7&]&F&2&>&J&6&n&2&%&?&\u008E&2&6&J&g&-&0&,&*&J&*&O&)&6&(&<&B&N&.&P&@&2&.&W&M&%\u053C\u0084(,(<&,&\u03DA&\u18C7&-&,(%&(&%&(\u013B0&X&D&\u0081&j&'&J&(&.&B&3&Z&R&h&3&E&E&<\u00C6-\u0360\u1EF3&%8?&@&,&Z&@&0&J&,&^&x&_&6&C&6&C\u072C\u2A25&f&-&-&-&-&,&J&2&8&z&8&C&Y&8&-&d&\u1E78\u00CC-&7&1&F&7&t&W&7&I&.&.&^&=\u0F9C\u19D3&8(>&/&/&\u077B')'\u1065')'%@/&0&%\u043E\u09C0*&*@&C\u053D\u05D4\u0274\u05EB4\u0DD7\u071A\u04D16\u0D84&/\u0178\u0303Z&*%\u0246\u03FF&\u0134&1\u00A8\u04B4\u0174";
+
+ private static void unpackDictionaryData(
+ ByteBuffer dictionary, String data0, String data1, String skipFlip) {
+ // Initialize lower 7 bits of every byte in the dictionary.
+ byte[] dict = Utils.toUsAsciiBytes(data0 + data1);
+ if (dict.length != dictionary.capacity()) {
+ throw new RuntimeException("Corrupted brotli dictionary");
+ }
+
+ // Toggle high bit using run-length delta encoded "skipFlip".
+ int offset = 0;
+ int n = skipFlip.length();
+ for (int i = 0; i < n; i += 2) {
+ int skip = skipFlip.charAt(i) - 36;
+ int flip = skipFlip.charAt(i + 1) - 36;
+ offset += skip;
+ for (int j = 0; j < flip; ++j) {
+ dict[offset] |= 0x80;
+ offset++;
+ }
+ }
+
+ dictionary.put(dict);
+ }
+
+ static {
+ ByteBuffer dictionary = ByteBuffer.allocateDirect(122784);
+ unpackDictionaryData(dictionary, DATA0, DATA1, SKIP_FLIP);
+ Utils.flipBuffer(dictionary);
+ Dictionary.setData(dictionary.asReadOnlyBuffer());
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/DictionaryTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/DictionaryTest.java
new file mode 100644
index 000000000..b2ea04b10
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/DictionaryTest.java
@@ -0,0 +1,38 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import static org.junit.Assert.assertEquals;
+
+import java.nio.ByteBuffer;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Tests for {@link Dictionary}.
+ */
+@RunWith(JUnit4.class)
+public class DictionaryTest {
+
+ private static long crc64(ByteBuffer data) {
+ long crc = -1;
+ for (int i = 0; i < data.capacity(); ++i) {
+ long c = (crc ^ (long) (data.get(i) & 0xFF)) & 0xFF;
+ for (int k = 0; k < 8; k++) {
+ c = (c >>> 1) ^ (-(c & 1L) & -3932672073523589310L);
+ }
+ crc = c ^ (crc >>> 8);
+ }
+ return ~crc;
+ }
+
+ @Test
+ public void testGetData() {
+ assertEquals(37084801881332636L, crc64(Dictionary.getData()));
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/EagerStreamTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/EagerStreamTest.java
new file mode 100755
index 000000000..8e079c042
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/EagerStreamTest.java
@@ -0,0 +1,386 @@
+/* Copyright 2018 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Tests for {@link Decode}.
+ */
+@RunWith(JUnit4.class)
+public class EagerStreamTest {
+
+ private static final byte[] DATA = {
+ 31, 118, -122, 17, -43, -92, 84, 0, -76, 42, -80, -101, 95, -74, -104, -120, -89, -127, 30, 58,
+ -4, 11, 91, -104, -99, -81, 44, 86, 61, 108, -74, -97, 68, 32, -120, -78, 97, -107, 88, -52,
+ -22, -55, -8, -56, -106, -117, 49, 113, -106, -82, -43, -12, -11, -91, -66, 55, 68, 118, -127,
+ -77, -104, -12, 103, -14, -94, -30, -112, 100, 79, -72, -42, 121, 62, -99, 76, -39, -89, 42, 58,
+ -110, 91, 65, 32, -102, -113, 49, 4, 73, 60, 122, -106, 107, 16, -123, 30, -97, 90, -102, -83,
+ -65, -90, 34, 26, -26, 52, 75, -118, 43, -47, -47, 52, 84, -10, -121, -68, -2, 20, 80, 101, 53,
+ 101, -119, -17, -111, -75, -21, -66, -96, -80, -114, 4, -65, 124, -89, -3, -25, -25, -21, -35,
+ -15, -114, 55, 14, -76, -68, 71, 9, 123, 46, 78, 67, -18, -127, 70, -93, -128, -44, -87, 3, 36,
+ -107, -3, 62, 83, 75, -123, -125, -11, 50, 46, -68, 80, 54, 9, -116, -29, 82, -14, -87, -94, 92,
+ -88, -86, -18, -1, 22, 3, 46, -98, -128, -27, 121, -56, 88, -37, 85, -43, 61, -60, 12, -122,
+ 107, -64, -27, -45, -110, 123, 60, 99, 108, 46, -29, -77, 76, 65, 100, 92, -104, 40, 63, 19, 36,
+ -89, 80, -39, 37, -95, -74, 97, 90, -109, 54, 105, -10, -38, 100, 95, 27, 36, 33, -60, 39, 100,
+ 32, -18, 93, -46, -99, 103, 127, -91, -62, 82, 76, 56, -66, -110, -16, 83, -116, -76, -9, -47,
+ -5, -32, -65, 111, 0, 55, 47, -60, -95, -56, -100, 65, 125, 38, 77, 38, -32, -62, 55, 119, 10,
+ 120, -69, 33, -111, -62, -87, 17, 102, -95, -106, 26, -50, -16, -109, 94, 83, -79, 90, 2, 42,
+ -47, 37, -124, 114, -68, 6, 104, -65, 38, -108, -114, -110, 73, -95, -83, -90, -86, -36, -48,
+ -63, -97, -120, -25, -53, 93, -77, -50, 59, -74, -9, 36, 85, 11, 76, 95, 74, -61, -9, 116, -14,
+ -38, 73, 78, 44, -92, 58, -27, -54, 38, 81, 50, -36, -46, -117, 126, 89, 53, -37, -58, -12, 61,
+ 77, -56, -85, -21, -128, 43, -111, 14, 54, 57, 116, 52, -85, 70, 88, -72, -26, 54, 109, -70,
+ -84, -13, -1, -54, 91, 81, 101, -65, 49, -48, -16, 26, -115, -39, 100, -21, 105, -121, 38, 72,
+ -115, 104, -100, 36, 120, 15, -109, 115, 64, 118, -68, -14, -26, -57, -71, 9, -118, -113, 15,
+ 94, 108, 114, 109, -14, -80, -31, -57, -6, 57, 111, -36, -92, -25, -23, -71, -61, 120, 93, -65,
+ 104, -123, -53, 35, -77, -8, -23, -31, 99, -3, 73, 75, 98, -2, -94, 73, 91, -109, -38, -78,
+ -106, -121, -17, -21, 55, 45, -26, -7, -93, 38, 59, -90, -116, 3, -68, -2, -110, 19, -96, 28,
+ -23, -39, 102, 99, 8, -82, -41, 63, 88, -70, 115, -123, -11, 111, 92, 47, -12, -16, -70, -2,
+ -29, 101, 61, -45, -57, 54, 24, -125, 20, -37, -75, 89, -56, 52, 125, 22, -68, -63, 105, -91,
+ -20, 91, 56, -99, -56, 35, -77, -78, -24, -79, 57, 5, -55, 101, -127, 75, -35, -113, -51, -103,
+ 79, 102, 16, -124, -79, -128, -45, -65, -84, -97, -91, -90, -105, 76, 90, -93, 90, -49, -41,
+ 104, 44, 81, -37, -84, 103, -120, -51, 79, -43, -114, -101, 38, -78, -94, -1, 15, 109, -62, 34,
+ -65, -127, 98, 32, 46, -72, 70, 58, -61, -55, 90, 30, -103, 5, 109, -105, -119, 81, 92, -40,
+ -75, -23, -77, 36, 18, 62, -33, -51, -38, -19, -12, 89, -101, 117, 94, 71, 127, -43, 54, 115,
+ -67, 34, -83, -115, 127, 127, 42, 126, -121, -121, -40, 56, -113, 60, -27, 30, 44, -21, 98,
+ -123, -14, 91, -69, 15, -81, 119, -101, 25, -73, 40, 105, 26, -86, -31, 86, -75, 74, 94, -74,
+ 19, -4, -20, 69, 24, 43, -5, -91, 6, -89, 52, 77, -65, -71, 82, -81, -52, 22, -61, -15, 51, 22,
+ 1, 70, -43, -3, -39, -27, 123, -13, -127, -86, 65, 51, 45, 127, -101, -27, -3, -44, -34, 75, 69,
+ 77, 71, -34, 7, -51, 93, -83, -84, -57, -38, -100, 59, -105, -1, 44, -47, 63, 96, -127, 32, -63,
+ 16, 80, -64, -127, 6, 54, 12, 44, 28, 48, -128, 4, 10, -104, 64, 3, 11, -47, 59, -79, -125, 52,
+ -16, -78, -66, 19, -6, -33, -107, -10, -4, -42, 102, -31, -32, 99, 115, -22, -96, -45, -112, 28,
+ 126, -44, -4, -47, -99, 127, -84, 37, -112, -34, 36, 1, -68, -14, -16, 55, 83, -99, 120, -69,
+ -30, 89, 48, 126, -80, -43, 15, 13, -18, 14, -4, -126, -120, -118, -11, 100, 16, 76, 17, 54,
+ -75, 114, 101, 37, 121, -23, -65, 39, 94, -48, -78, 67, -61, 75, 48, 23, -127, 83, -124, 95, -5,
+ 67, 13, 87, 18, -2, 117, -36, -121, 115, -112, -107, -54, -36, 14, -4, -68, 35, 32, 79, -118,
+ 81, 94, -56, -110, 37, -84, -121, 72, -7, -52, -40, -44, -1, 73, 123, 12, 42, -67, -87, 63, -2,
+ -100, 29, -41, 112, 98, -125, 88, 97, -56, 90, 7, -40, -111, -126, 74, 121, -95, -45, -69, 48,
+ -98, 18, -20, -124, 3, 46, -5, 26, 24, -79, 109, 4, 43, 60, 97, 96, -76, -21, 95, -52, -40, -45,
+ 2, -103, -107, -9, 79, -79, -82, -73, -51, -74, -10, 81, -77, 111, -96, -41, -120, -38, 24, -87,
+ 93, -41, 64, 72, 57, -81, -32, 60, -79, 36, -84, -89, -7, -25, 81, -98, 36, -22, -69, 86, 123,
+ 120, -16, -113, -70, 47, -125, 2, 97, 78, -91, 102, 120, -91, 5, -71, 39, 116, -12, -79, -29,
+ -9, 87, -5, -37, 87, -73, 116, -15, -10, -106, -49, -3, -21, 5, 120, 47, 72, -40, 79, -3, 85,
+ -84, -87, 57, -83, -67, -64, 122, -39, 36, 70, -27, 71, -73, 42, -100, -99, 124, -90, 90, -29,
+ -54, -115, 7, 89, -51, 9, -43, 32, 79, -104, 127, -38, 7, 93, -80, -124, 27, 96, 54, -51, -7,
+ 57, 57, 63, 21, 110, 70, 122, 76, 51, 124, 78, -5, 126, -100, -98, 116, 59, 125, -106, -113,
+ -111, -128, 92, 43, -19, -2, 105, -90, 96, -116, -116, -30, 115, -20, -106, 64, -108, -111, 94,
+ -9, -123, 52, -71, -88, -84, 87, -25, -54, -117, -2, -29, 29, -85, -22, -20, -94, -25, 98, 101,
+ 114, 80, -55, -51, 97, 99, 117, -86, 2, 79, 48, 110, 44, -94, -127, -85, 61, -95, 30, -91, -125,
+ 83, 113, -93, -4, -126, -98, -93, -68, -99, -70, -37, -73, -90, 4, 53, -2, 78, -35, 101, 42, -6,
+ -3, 106, -117, -127, 48, 31, 88, 117, 116, 106, -98, -23, -117, -7, -57, -128, -118, -117, -118,
+ 115, 30, -61, 6, -38, -114, -103, 37, 53, -4, -100, -121, 98, -110, -113, 2, -20, 26, -88, -118,
+ 19, -71, 39, -54, -11, -28, 47, 28, 89, 35, -13, -20, -48, 14, -6, -91, -85, -119, -7, 116, 112,
+ 114, 41, 44, -1, -39, 60, -85, -54, 101, -119, 95, -77, -64, -121, 47, 75, -78, -30, -66, -38,
+ -15, 98, 14, 82, -60, 85, -90, -78, 112, -7, 64, 5, 28, 64, 41, -64, 57, 85, 21, 122, -52, 90,
+ 70, -73, 17, 47, -125, 40, -45, -7, -91, 100, -21, -120, -51, 21, 65, 31, 110, -105, -79, -80,
+ 105, -43, 73, -61, 45, -30, -4, 83, 95, 3, 109, 55, -92, 120, 74, -36, -111, 54, -26, 76, -69,
+ 7, -20, 55, 4, 70, -124, -31, -32, 127, -63, -58, 73, 106, 109, -41, -45, 96, 30, 63, 14, 8, 16,
+ -88, 69, -115, -17, -14, -116, 115, -88, 119, -65, 16, -64, -112, -73, -10, -46, -7, 113, 5, 54,
+ -38, -47, -18, 106, 23, 12, -117, 120, -107, 121, -62, -35, -6, -56, 112, 81, 3, 5, 31, -11,
+ -92, -85, -29, 102, 43, 108, 88, -69, 55, -74, 110, 97, -128, 29, -63, -114, -19, 77, 123, 23,
+ 76, 81, 57, 51, 117, -74, -1, 74, 84, 70, 86, -109, -127, 122, 10, 9, 23, 71, 110, -116, -30,
+ -85, -104, 2, 40, -62, 20, 46, 8, 95, 46, 13, 113, -83, 124, 33, 38, 105, -99, 72, -62, -80,
+ -16, -118, 92, -66, -14, -124, 112, 79, 103, 53, -127, 61, -31, -92, 92, -42, -37, -37, -24,
+ -116, 2, -81, 40, 46, -44, 23, -68, -113, 88, 92, 95, 11, 118, 98, 19, -80, -102, 96, 73, -20,
+ 47, -105, -120, -74, -83, -77, -87, -59, -97, 112, 99, -52, 80, 116, -119, -44, 18, 62, 108, 73,
+ -34, 70, 28, 73, 81, -26, 87, -125, -55, 64, -53, -73, 114, -3, -45, -109, 19, -2, 68, 119, 14,
+ 26, 72, 19, 13, -121, -98, 26, -52, 85, 34, 17, -95, -7, 20, -12, 106, -11, 104, 20, -106, -42,
+ -26, 107, -106, 112, 103, -53, -62, 13, -58, -23, 23, 65, -104, -55, -90, 107, 55, -77, -25,
+ -125, 63, -61, -21, 117, -102, -70, -93, -67, -45, -61, 18, -63, 7, -127, 90, 16, -25, 116, 80,
+ 35, 105, 80, -93, 105, -44, 114, -126, -103, 88, -102, -76, -94, -66, 69, -35, 22, 36, 95, -55,
+ 22, 43, 78, -111, 109, 72, 104, -49, -9, -48, 59, 102, -54, -43, -128, 111, 127, -9, 35, 23,
+ -79, 40, -122, -52, 36, -81, -4, -102, -2, -62, 53, -111, -117, 40, 122, -95, 55, 32, -127, -9,
+ -91, 79, -109, -81, -3, 98, -78, 56, -119, 69, -41, 76, -102, 18, 90, -15, 12, -60, 86, -106,
+ 34, -118, -43, -13, 61, -106, -56, 48, 27, -15, -70, -41, 127, 61, -2, -80, -13, 86, 28, 91,
+ -10, -8, 98, -20, 54, 122, -116, -55, -70, -94, 54, -64, 71, 102, -106, -1, 99, -73, -71, -18,
+ -11, 56, 11, -27, -5, 11, -86, 126, 8, 46, -21, 63, -66, -43, 88, 46, -113, -5, 113, 26, -9,
+ -32, 18, -3, -6, -38, 81, 38, -110, 111, 97, 34, 65, 114, -71, -118, 9, -110, -109, -61, -113,
+ 31, -82, -102, -127, 16, -7, -16, -11, -87, -76, -41, -52, 58, -116, 100, 102, -127, 6, 127, 64,
+ 14, 110, 112, 43, 44, 87, 42, -118, -119, -39, 64, -7, 57, 16, 2, -69, -12, -54, -94, 36, -48,
+ 123, -119, 82, 46, 26, -62, 30, 97, -17, 34, 80, 32, -15, 116, -96, -3, 33, 34, 51, 59, -63,
+ -100, -7, -79, -126, -21, -15, -18, -113, 30, -25, 107, -25, -125, 53, 82, -15, -80, 96, -24,
+ -47, 94, -25, -109, -94, 114, -62, 112, -104, 26, -107, -68, -14, -36, -9, -89, 27, -75, 62, 62,
+ -20, -125, -77, -57, -127, 80, 58, -118, 63, -27, -82, -126, 74, -23, -91, -28, -95, 8, -122,
+ -73, 28, -87, -74, 80, -15, -119, 14, 32, 124, 73, 15, 61, -32, -68, 81, 56, -119, 66, 105, 3,
+ -15, 20, -86, 124, -70, -113, 100, -72, -117, -97, 127, 103, 16, 105, 8, 39, -128, -64, -47, 66,
+ 123, -110, 13, 123, -124, -24, 42, 102, -4, 47, 107, 125, 63, -52, -35, 113, -74, 13, 8, 17, 16,
+ -106, -21, -69, 47, -3, 103, -2, 19, -100, 111, -11, 1, 112, 90, -38, -31, -45, -55, 25, 92,
+ -122, 66, -18, -98, -82, -49, 119, -35, -128, 26, 60, -79, -23, 127, 82, -52, 115, 77, -109,
+ -111, 17, -99, 31, 33, 41, 35, 87, -47, -126, -18, -25, 81, -71, 9, -72, -92, 64, -92, 23, 116,
+ 96, 40, 55, -87, 119, -105, 66, 49, 46, -10, 26, -25, -105, 127, -124, 86, -2, 39, 116, -108, 6,
+ 21, 15, 1, 75, -5, 101, 13, 57, 70, 126, -50, -97, 123, -73, -77, 53, -11, -73, 44, -99, 91, 85,
+ 21, -59, -1, 117, 64, -100, 47, 75, 93, 9, -4, 83, -55, 15, 99, 31, 43, -49, 15, -89, -115,
+ -114, -50, -35, -19, -65, 122, -39, 92, -21, -3, -66, 8, -70, 107, -55, -86, -36, -23, -21, 80,
+ -79, 48, 116, 57, -71, 33, -111, -68, -75, 37, 55, 39, 124, 96, -66, 10, 14, 118, 50, 85, -33,
+ 54, -101, -7, 21, 88, -122, 50, -92, 123, 37, 109, -60, -127, 26, 110, -20, -31, -66, -56, -24,
+ 47, -14, -60, -101, 69, -38, 78, 0, 44, -71, 108, 4, 25, -68, -106, 20, -40, -103, 108, -70,
+ -56, 78, 12, 82, 81, 46, -105, -123, -46, -20, -127, -67, -77, 76, -74, 40, 105, 2, 27, 112,
+ -107, -121, -53, 6, -88, -11, 26, 41, 64, -69, -44, 27, 47, 24, -31, -86, -4, 4, -46, 42, 50,
+ -55, 37, -11, -95, 108, 54, 37, 67, 37, -14, -40, 41, 124, 22, 108, 99, 16, 55, 88, 19, 49, -87,
+ 27, 17, -68, -107, 15, -62, 84, 109, 72, -26, 71, 63, -17, -72, -63, -101, -8, 62, 24, -112,
+ 126, -102, -64, 29, -19, -75, 74, 29, 90, -90, 83, -22, 106, -27, -114, 56, -111, -33, 11, 3,
+ -16, 94, 115, -97, 67, -78, 62, -93, -36, 60, -65, -54, 72, 70, 44, -77, 73, 29, -106, 38, 72,
+ -37, -110, 79, -98, -15, -58, 96, -85, -68, -15, 73, 57, -127, 14, -123, -40, 70, 63, -64, 115,
+ -63, 127, 94, 85, 52, 30, -62, 83, -30, -97, 82, 39, 2, 36, -50, 106, 116, 66, 104, -14, 73, 14,
+ -106, -127, 11, 41, -27, 56, -99, -74, 55, 123, 124, 9, 46, 12, -97, -37, -10, 122, 124, -27,
+ -64, 93, -70, 9, 119, 13, -9, -71, -118, 19, 50, -36, 114, 120, -24, -62, 40, 127, 9, -62, 84,
+ 57, 66, 91, -114, 120, -49, 63, 99, -73, -66, -64, 84, -31, 67, -52, 12, 38, -62, 37, -122, -50,
+ -95, 24, 19, 54, -80, 57, -118, -84, 124, 90, 53, 72, 29, -123, 67, -65, 99, -58, -28, 20, -110,
+ -103, 92, -91, -108, 23, -118, 44, 74, 76, -29, 94, -121, -37, -32, 107, -62, -67, -55, -45,
+ -50, -44, 25, -77, -102, 90, -128, -31, -5, -64, 110, 122, 88, -18, -53, -85, 122, -11, 100,
+ -106, 97, 59, -103, -110, 5, -16, 59, -126, -74, 9, -119, 115, 49, -73, -42, 32, 100, 59, -98,
+ 106, 55, -101, 87, 126, 59, -23, 106, -102, 100, -69, -46, 76, 53, -107, -119, -113, 104, 117,
+ -27, 75, -32, 8, -81, -10, 50, 108, -32, 51, -79, -53, -2, 66, -9, 113, 14, 99, -100, -34, -21,
+ 13, 2, 45, -33, 0, -16, -64, -126, 69, -25, -34, 28, 105, -48, -38, 82, 12, 27, -71, 35, 13, 11,
+ 21, 26, -19, -4, 44, -52, -126, -63, -32, -84, -22, -63, -29, 96, -97, -82, -12, -53, 98, 41,
+ -69, -38, 101, -31, 47, -9, 16, -10, 9, -36, -103, -91, -65, -36, -93, -45, 94, 110, 54, -94,
+ 68, -39, -116, -40, 61, -112, -91, -79, 98, -36, 87, 35, 88, -61, 125, 112, -84, 48, -38, 105,
+ -92, 69, -68, 92, 0, 27, -72, -65, 97, 98, 66, 97, -74, 29, 46, -21, 102, 61, 120, -62, 38,
+ -125, -60, -43, 4, 5, -27, 113, -43, 105, -22, -110, 68, 13, -14, -23, 18, 95, -79, -108, 87,
+ 19, -80, 16, 54, -121, 88, -64, -113, 73, 3, -20, 17, 0, 26, -88, -49, -2, 21, 120, -105, -85,
+ -113, 76, 106, 37, -13, -75, 29, -127, 10, -17, -53, -124, 24, 37, -31, 26, -1, 109, 88, -88,
+ -37, -51, -32, -125, 48, -40, 123, -108, 55, -120, -62, -91, 47, 62, -127, -25, 99, 68, 22, -40,
+ 58, 119, -31, -93, -122, 39, -92, 25, -127, -42, 97, 69, -6, 110, -61, -21, -94, 82, 123, -93,
+ -51, -90, 50, -96, 127, -32, 125, -76, 117, 75, -52, 79, 110, -51, -15, -81, 49, 62, 118, 120,
+ -27, 22, 84, -22, 77, -105, 87, -7, -23, 47, -8, 108, 82, -12, 84, -52, -85, 68, -89, -24, -32,
+ 6, -34, -83, 80, 44, 12, -51, 50, 74, -121, -106, 6, 85, 32, 42, 76, -59, -52, -99, 102, 108,
+ -127, -49, 0, 60, 62, 2, 13, -19, -92, -41, -69, 55, -70, 94, 23, 36, 89, 70, -115, -51, 26,
+ -95, 13, -69, 42, 62, 59, -24, -63, -50, -6, -86, -97, -115, -58, -107, 69, -12, -109, 73, 4,
+ 63, 12, 32, 13, -123, -72, -41, -7, -81, 37, -91, -128, 109, -79, -80, 88, -22, 108, 126, 103,
+ 27, -29, -81, 52, 55, -91, -13, -43, -75, -59, 80, -6, 6, 83, -103, -64, 8, 63, -34, -59, 21,
+ 55, -115, 62, 77, 30, -50, -71, -66, 87, 99, -47, 0, 124, 76, 120, 79, -12, 54, -16, -98, -72,
+ -41, -66, -14, 114, -27, 108, 57, -49, 107, -73, 90, 107, -103, 25, -107, 112, -119, -54, 106,
+ -54, -8, -13, -81, -62, 92, -84, 113, 77, 74, -63, 104, 92, -94, -128, -43, -54, -71, 117, 27,
+ 14, 98, 52, 119, -93, -77, -80, -46, 88, 35, 123, 86, 87, 122, 62, 108, 19, 27, 111, 2, 62, -67,
+ 89, 14, -82, 41, 123, -117, 74, 109, -124, -115, 15, 123, -65, 42, -81, -105, 19, -30, 86, -72,
+ 84, 63, -109, 34, -65, -127, 6, -104, 77, 103, -111, 90, 16, 31, -74, -33, 122, 58, 52, 10, 2,
+ 65, 72, 68, 79, 52, 31, -19, 100, -86, 21, -49, 116, 101, 82, 111, -96, -76, 67, -40, -62, -15,
+ -79, 109, -58, 6, 11, -91, -29, 65, 21, 75, 74, -28, 21, 103, 46, 48, -42, 51, -110, 80, -95,
+ -102, -9, 8, -95, 102, 102, 16, 105, 103, 92, -106, -109, 77, 93, 32, -12, -25, 5, 17, -86, -34,
+ 58, -50, 55, 63, -8, -72, 3, 26, 91, 72, 71, -77, 94, 91, 39, 45, 7, 0, 30, -45, -100, 35, 43,
+ -41, -72, 16, -103, -115, -4, 51, 39, -23, -89, -84, 105, 94, -91, -88, 82, 123, -26, 51, -16,
+ 97, 47, -39, 35, 46, -89, 74, 7, -80, 116, -21, 82, -84, -13, -99, 31, -58, -93, 36, 99, 36, 44,
+ -65, 45, 94, -91, -41, 115, -10, 116, -67, 45, 19, -20, 113, -62, 111, 124, 108, 71, -121, -64,
+ 122, -121, -105, 114, 115, -126, -93, -108, -113, -1, -80, -86, 116, -111, -29, 53, -76, 87, 19,
+ 45, -30, 91, 91, -7, -49, 12, 112, -8, -26, 82, 58, -82, -76, 119, -50, 14, 85, 113, 20, 48,
+ -102, 37, 24, -120, -107, -52, 67, -44, -92, -79, -40, 28, 21, 55, 116, 88, 19, -49, -78, 86,
+ -89, 74, -4, 118, 75, 11, -103, -127, -47, -16, -77, -78, 8, 2, -88, 50, 23, -99, 102, -100,
+ -116, -99, -109, -112, -115, 78, 55, -39, -84, 100, -91, -101, 73, -9, 39, -23, 62, -125, -106,
+ -55, 119, -118, 114, -33, -99, 20, -53, 91, 115, 47, -93, 51, -99, -9, 92, -71, 120, 57, -44,
+ -87, -11, 108, 30, 43, -4, 118, 90, 126, -54, -99, -47, -2, -61, -3, -62, 45, 92, -70, -105, 30,
+ 98, 112, -94, 56, 35, -22, 32, -93, -6, -36, -5, -77, -78, 120, 45, 104, 69, -49, -30, 39, 75,
+ 38, -94, -12, 34, 34, -44, 48, -100, 74, 34, 69, 94, -12, 73, 27, -111, 90, 33, -38, 93, 40,
+ -16, 89, 26, -110, -116, -10, -65, 85, -57, 48, -86, 121, 118, -41, 63, 33, 109, -78, -26, 122,
+ 111, -115, -52, 95, 26, -70, -14, -86, -80, -27, -6, 12, -44, 123, 28, 93, -74, 14, -124, 87,
+ -28, -12, 111, -117, -83, 48, -41, -3, 60, -51, -91, 118, 54, 110, 18, -2, -120, -66, 46, -35,
+ -91, 106, 94, -91, -11, 41, -92, -22, 96, -113, -109, 105, 56, -80, 17, -118, 124, -16, 30, 30,
+ 117, 126, -99, -106, -69, -28, 85, 85, -41, 21, -95, -85, -112, -125, -45, 69, 10, -34, -120,
+ 33, -58, 120, 51, -22, -7, 31, -34, 4, 55, -102, -70, 118, -83, 49, 111, -45, -9, 69, -95, -66,
+ 116, -3, 104, -61, 17, 21, -20, 121, 117, 127, -70, 5, 89, -89, 51, 15, 64, 126, -73, 97, 90,
+ 119, -22, -37, -54, 52, -33, 26, -54, 75, 79, 73, 100, 44, 3, 53, -25, 49, -123, -101, -80, -54,
+ -81, -32, 88, 49, -14, -4, 18, 42, 52, -65, -33, 68, 83, -89, -11, 57, 102, 71, 122, 74, -92,
+ -44, -94, -108, 14, 104, -107, -124, -63, 8, 32, 85, -18, -16, -91, -63, -38, 27, -108, 24, 19,
+ -33, 53, 70, -32, 41, 38, -77, -30, 89, 28, -15, -89, -86, 32, 51, 28, 67, 124, -96, -103, -34,
+ -113, 22, 15, -8, 104, -38, -56, 65, -96, -111, 104, -9, -38, 107, 55, 112, 47, 99, 50, -18, 90,
+ -69, 116, 80, 95, 52, -27, -98, 6, 12, -11, 124, -120, -96, -91, 118, -51, -120, 90, -92, -104,
+ -83, -73, 84, 61, 78, -39, -99, 33, 58, -45, -14, 127, -20, -44, 125, 21, -26, -21, -36, 51, 73,
+ 71, 73, -17, 83, 11, 107, 91, 36, -65, -24, 56, 117, 114, -126, -34, 1, 120, 66, -50, 14, 91,
+ 97, -35, 75, 87, 123, -53, 63, -38, -74, -62, -117, -45, -40, 125, -5, 53, 50, 0, -110, 7, 7,
+ 45, 37, -71, -21, 70, -95, -60, 74, -55, -54, -96, 115, -62, -32, -3, -121, -18, 27, -107, 49,
+ -39, 58, -39, 91, 107, 65, -99, -64, -19, -10, -126, 38, -40, -112, 0, 16, 107, -59, 119, -70,
+ 79, 49, -18, -76, -22, -38, -98, 35, -99, 61, 67, -100, 29, -104, -17, 22, 108, 105, 88, -114,
+ -65, 84, 99, -69, -84, -87, -81, -28, 68, -66, 3, 69, -69, 83, 16, 61, -102, 50, 67, 46, -98,
+ -77, -40, -78, 48, 68, -85, 123, -92, 37, 14, 75, 13, -23, -110, 23, 26, 90, -81, -1, -109, 85,
+ 121, -68, -55, -7, 21, -81, -35, 41, 3, -72, -52, 36, 35, -83, -9, -81, -124, -104, 31, 54, 8,
+ -32, 80, 73, 89, -41, 116, 127, -110, 68, -82, 82, -79, 105, 113, -110, -70, 121, -24, -54, 37,
+ -12, -70, -77, 15, 14, 105, -19, 16, -6, 73, 102, 121, -116, -62, 54, 65, 119, 43, 60, -79, -66,
+ -17, 1, 97, -1, -11, -5, 104, 10, 59, -108, 21, -8, 64, -71, -86, 14, -98, -87, -49, 30, -45,
+ 109, 43, -67, 10, -122, 25, 98, -102, 127, -27, -52, -61, -66, -47, 114, -94, -126, 4, 0, -65,
+ -11, -51, -67, 84, -43, 44, 88, 53, -6, 124, 11, -123, 34, 12, 102, -13, -106, 47, 62, -71, 43,
+ -65, 28, 37, 32, 80, 23, 6, 75, -103, 73, 112, 33, 84, -89, 12, -81, 42, 65, 58, 14, -102, 90,
+ 29, -116, 104, 107, -99, -1, -43, 122, 118, 88, -2, 117, 84, 1, -123, -2, 2, -32, -18, -122,
+ -36, -58, 16, 76, 115, 27, -121, -2, -79, -44, -39, 33, -29, 33, -34, 55, 71, 61, 117, -22,
+ -126, 51, 29, 55, -34, -48, 17, -57, 74, 71, -33, -50, 60, 41, -119, -93, -45, -127, -30, 104,
+ 35, 60, -117, -113, 81, -59, -39, -84, -39, -46, -106, 57, 77, 62, -11, -44, -87, 71, 35, -117,
+ -87, -77, -98, 68, -29, -121, -16, -16, 39, 48, -74, 23, 82, -62, 32, 62, 27, 125, 84, 39, -91,
+ -91, -93, 76, -24, 98, 123, -58, -114, 17, 28, 93, -17, 74, 92, -17, 9, -86, -116, -72, 54, -74,
+ 71, 9, -97, -33, -20, -126, -50, 117, 102, 54, 123, 124, -70, 30, -102, 27, 23, 105, -40, -35,
+ -89, -33, 89, 3, 44, 18, -15, 10, 116, -111, 1, -81, -31, -125, -102, 103, -93, -15, 72, 84, 19,
+ -30, -17, -115, 99, 43, 5, -92, 52, 59, -55, -105, -128, 19, 8, -78, 43, 7, -55, -126, -106, 11,
+ 69, 118, 24, -128, -54, -86, 22, -121, -43, 69, -15, 96, 52, 52, 90, -118, -10, -58, 121, 63,
+ -48, -13, 22, -101, 17, 42, -28, -54, -63, 121, -96, 111, 113, 103, 126, 37, -52, -40, -106,
+ -104, 123, -48, -92, 83, 100, -70, -52, -59, -93, -116, -90, -93, 82, -117, 103, 52, -71, -42,
+ 57, 25, 57, -74, 71, 7, 32, 96, -60, 11, 121, 58, 71, 40, -92, 35, 88, -12, -109, -56, -122,
+ -30, -118, 103, 65, -5, -90, -97, 103, -117, 66, -20, -42, -46, 67, -29, -23, 72, -97, 26, -54,
+ -103, -76, -47, -71, 23, -83, -20, 95, 111, 101, -83, 106, -71, -70, -63, 55, -85, -41, 117, -9,
+ 37, 96, -71, -118, -44, -43, 2, 107, 113, -39, -107, 41, -13, 0, -87, 77, 83, 99, 68, -84, -6,
+ -1, 67, 124, -57, 115, 29, 24, 26, -42, 104, 58, -87, -38, 12, -98, 11, 109, 62, 59, -66, -48,
+ -20, 70, -111, 11, 120, 21, -58, -29, -76, 44, -7, 26, -119, -59, -87, 44, 122, 8, 114, -58,
+ -109, -119, -63, -58, -51, 33, 35, -109, 81, 110, -90, 121, -21, 64, -60, 68, 18, 75, -82, -81,
+ -103, -76, -116, 23, 53, 58, -41, -23, 49, -102, 81, 101, 39, -59, -91, -98, 111, 2, 65, 110,
+ 121, 5, 13, 97, -119, 109, 40, 82, 47, -51, 47, -57, 35, -109, 53, -42, 10, 3, -15, 122, -25,
+ -67, -62, -121, -120, -31, 18, -20, 87, -88, 75, 95, -121, -93, 33, 61, -88, -96, 88, -69, -54,
+ -121, -99, 49, 122, -53, -49, -125, 53, -79, -46, -128, 109, 125, -93, -83, 44, -101, 69, 68,
+ -91, -17, 55, -13, -75, -80, 21, 32, -13, 40, 86, -65, 85, 80, -82, -38, -52, 110, -119, 100, 8,
+ 77, -23, 67, -41, 73, 27, 38, 9, -11, -32, -30, 75, -15, 67, -41, 46, 27, -89, 9, 117, -38, -14,
+ -81, -4, 71, 113, -79, 81, -36, 63, 15, -70, 104, 34, -56, -39, 93, -34, -127, 90, -36, 73, 47,
+ -76, 113, 55, 123, -92, 48, 116, 108, -123, 31, -67, -39, 3, -9, 6, 13, -17, -50, -125, 1, 105,
+ 121, 100, 79, 82, -85, 123, -33, -73, 54, -61, -113, 121, -110, 69, 119, 94, -112, -120, -34,
+ -35, -104, -116, 44, 85, 109, -104, 127, 120, 87, 75, -48, -115, 74, 85, -47, -53, 16, -5, 92,
+ 67, -32, 12, 79, 109, 105, 5, -92, 51, 46, 96, -96, 63, 106, 82, -54, -95, 20, -60, -23, 48, -5,
+ -128, 22, 23, -93, 93, -64, 35, 21, -121, -79, 59, -1, -50, 55, -7, -10, -85, 3, -7, 121, 98, 5,
+ -19, 76, -78, -128, -47, -42, 61, -59, -46, -24, -16, -51, -48, 122, -26, 74, -91, 54, 53, 46,
+ 74, 25, -30, -74, 52, -22, 118, -103, -53, -113, 44, -19, 70, -86, 106, 72, -68, -86, 110, 34,
+ -35, 57, -43, 32, -4, 14, 102, 25, -76, -84, -86, -83, -2, -107, -4, 49, -97, -83, -95, 6, 100,
+ -73, 6, 34, 49, 59, 50, 30, -8, 6, -55, 24, -6, 67, -121, 115, 40, -50, -75, -46, -26, 111, -20,
+ -75, -83, -16, -48, 65, -64, 119, 62, -59, 3, -12, 109, 0, -118, -94, 17, -51, 124, 63, 42, -3,
+ 44, 53, -81, -35, -33, -83, 115, -114, -4, -104, 44, 7, -81, -97, -102, 104, 29, -97, 70, 91, 3,
+ 88, 67, -127, 78, -92, -16, -34, -18, -81, -125, -38, 117, -78, -36, 9, 76, -85, 121, 2, 10,
+ 114, 65, -5, -29, -34, 101, 20, -108, 46, -90, -98, 85, -62, -51, 108, -72, -51, 44, 22, 112,
+ 121, 58, -58, 109, -96, 58, 103, 27, -88, -81, 99, -7, -33, -113, 64, -122, 115, 19, -93, 37,
+ -19, 93, -98, 78, 115, 91, -88, -82, -36, 61, 90, 77, 27, 26, -116, 80, 90, 85, 6, -87, 59, 110,
+ 63, 20, -81, -127, -53, 18, -73, 39, 75, 79, -106, 29, -50, -13, 43, -99, -92, 109, 80, -83, 69,
+ -102, 38, 90, -41, 48, -47, -93, 18, 116, 32, 90, -73, -96, 90, 49, 19, 73, -35, 60, 53, -72,
+ -52, 84, 52, 27, -67, -114, 82, 79, -89, -80, -111, 124, -51, 80, 110, -76, 125, 18, -73, 44,
+ -100, 118, -16, -64, -35, 22, -86, -116, -19, -101, -35, 42, 85, -83, 69, -65, 37, -104, -88,
+ -108, -25, -9, 15, 91, -100, -86, 8, -75, -37, 103, 3, -69, -9, 114, -25, 25, -87, 118, -75,
+ -115, -8, 74, 53, 73, 46, -22, -108, 30, 71, -96, 40, -76, 121, 71, -63, 95, 96, 113, -54, 87,
+ 1, -79, 2, -40, 11, 22, -118, -117, 94, -44, -112, -27, -86, 96, -4, -58, 121, -71, 54, -58,
+ -71, -125, -65, 126, -116, -107, 125, -28, -74, 97, 15, -76, 59, -26, 58, -38, -39, 122, 55, 85,
+ -109, -114, 75, 25, -74, 57, -78, -10, -76, -115, -12, 29, 84, 86, 97, 5, 116, -114, 62, -98,
+ -36, 105, -119, -19, 12, 11, 49, 76, 21, 56, 1, 115, 115, 42, -67, 60, -40, 19, 38, 50, 33, 112,
+ 98, 123, -76, -74, 50, 66, 18, -61, -114, 36, -95, 92, 124, 20, -56, 29, -41, 28, -4, -106, 115,
+ -83, 98, -47, 96, 87, -72, 96, -83, -93, 1, 112, -43, 59, -80, -24, 46, -45, 87, 92, -108, -78,
+ 101, -112, 111, -119, -67, 26, 97, 1, 36, -128, 120, 8, -20, 84, 107, -9, -104, 25, 0, -36, 58,
+ 111, 81, -83, 65, 42, 51, 61, -71, 118, 111, 29, -93, 39, -56, -72, -18, -53, 0, 34, -77, -59,
+ 112, -79, 51, 86, 82, -24, 64, -120, -1, -102, -3, 42, -93, 16, 38, 100, 39, -124, 92, -89, 31,
+ 94, -32, 40, 19, -8, 48, -83, -66, -68, 110, -72, 36, -38, -91, -63, 33, 35, -96, -121, -119,
+ -59, 56, 89, -117, -123, -79, -68, 42, -4, -116, -108, -104, -84, -111, -26, 94, -38, 61, 94,
+ -72, -85, -18, -30, 118, -14, -94, -74, -24, -21, -90, -83, -116, -38, -8, 9, -17, 72, -62, -78,
+ -75, 47, -117, 109, 127, -87, -36, 53, 90, 16, -72, -50, 40, 87, 97, -51, -96, -55, -120, -32,
+ -58, -21, 102, 117, -121, -98, 74, -67, 104, -122, 108, -3, -96, 64, -114, -3, 30, 48, -14, 44,
+ -41, 91, 54, 58, 80, -13, -88, 121, 32, 122, 25, 24, 9, 72, 17, -1, -93, -66, 96, -84, 4, 37,
+ 69, 91, 64, 32, 46, 89, 7, -32, -120, 10, -38, -3, -59, -75, 14, 116, 115, 121, 99, 122, -95,
+ 107, 1, 65, 70, -45, 35, -52, -87, -56, 43, 121, 12, -93, -8, 83, -118, 15, -33, -67, 45, 74,
+ -66, -31, -28, 5, 104, -13, 113, 19, -89, 105, 66, -82, 74, 54, -104, 69, 103, 86, 118, -44,
+ -75, -47, 81, -75, 8, -32, -95, 121, 48, -121, -106, -88, -15, -52, -99, -78, 58, 113, 16, 71,
+ -48, 76, 80, 81, 59, 43, -106, 27, -49, 2, -11, -71, -30, -80, -44, 62, -113, -20, 12, -60, -87,
+ 22, -30, 64, -120, 127, 121, 47, 127, 58, -98, -4, 79, -72, -117, 115, 52, 95, 40, -59, -125,
+ -33, 125, -96, -93, -92, 17, -99, -85, 10, -119, 91, -115, -63, -32, -11, -102, -105, -93, 90,
+ 37, 94, -104, -47, -63, -94, 15, -34, 20, 73, -59, 85, -31, 6, 106, -67, 14, -125, 28, -63, 40,
+ 86, -68, 104, -22, 124, -27, -84, -13, 43, -45, -30, -95, 95, 16, 79, 23, -66, -78, -74, 43, 86,
+ 70, -95, 90, -65, -1, -58, 54, 12, 47, -47, 28, 91, -54, -19, -75, -43, 12, -108, 12, 71, 38,
+ 118, -8, 1, 42, -113, -6, 1, -93, 118, 67, -79, 25, -80, 118, 34, -29, 0, -23, 86, 53, -118, 89,
+ 112, 0, -61, -88, 76, -24, 59, -75, 23, -1, 64, -80, -52, -40, 34, -50, -19, -127, 57, 79, 43,
+ 92, -113, -96, 73, 0, 33, 122, 42, 104, -62, -66, -108, -104, 45, -120, 69, -3, -20, -113, -40,
+ -70, -96, 72, -21, -95, 1, -16, -124, -87, 125, 56, -108, 7, -112, -104, 105, 80, -34, -93, 24,
+ -6, 35, -38, 42, -4, 23, -112, 40, 45, 106, -72, 29, 44, -36, -61, -8, -93, -34, 3, -41, -26,
+ 121, 6, 100, -14, -112, -117, -15, -120, -92, 44, -43, 94, -13, 121, -59, -82, -68, 7, -19,
+ -110, -121, -58, -118, -121, 92, -8, 33, -120, -28, -95, -31, -120, -62, 49, 51, 3, 68, 4, -56,
+ 51, -13, -90, 47, -16, -24, 63, 125, -11, -94, 99, 69, -84, -54, 127, 81, -120, 42, -47, -128,
+ -13, 38, 115, 59, -112, -30, -9, -116, 121, 63, 111, 32, -116, -2, 0, -33, 79, -67, 90, -65,
+ -108, -107, -5, -107, 11, -102, 91, 106, -42, 74, 45, -80, -65, 54, 36, 121, -125, -118, -34,
+ -51, 36, -85, -78, 86, 121, -103, -39, 35, -76, 17, 59, 68, -40, -43, -27, 63, -76, 126, -94,
+ 18, 87, 20, 92, 38, -6, -54, 9, 45, 93, -57, 53, -11, -44, -38, -24, -126, -40, -24, -35, -121,
+ -55, -87, -63, 70, -88, 13, -78, -89, 2, 50, 59, 4, -14, 81, 25, 34, -20, 87, 116, -76, -31,
+ -93, 15, 112, 61, -43, -11, -86, -25, 10, 41, 1, 60, 105, -42, -90, -44, 38, 98, 126, -128, 28,
+ 99, 20, -97, 105, -101, 27, -106, 13, -108, -18, 23, -79, 121, 57, 93, -16, -37, -82, -1, -128,
+ -67, 99, 117, 79, 85, 83, 12, 53, -101, -52, -75, 72, -128, -62, 45, -54, 11, 0, -58, -88, 11,
+ 121, 33, 86, -87, 31, -54, 109, -37, 10, 119, -9, 55, -7, 77, -52, 93, 64, -62, 115, -88, -4,
+ 67, -1, -37, 31, 107, 90, -109, -121, 71, 105, -123, 61, 75, 89, 108, -91, -6, 115, 45, 109, 10,
+ -35, -84, 41, 127, 104, -84, -70, -6, -118, 6, 110, 99, -7, -112, 15, -79, -20, 51, -41, 78, 25,
+ -97, -2, -121, -117, 7, -87, -76, 60, -7, -7, 0, 51, 91, 34, 85, 21, -1, 108, 41, 8, 126, -25,
+ -30, 68, 109, -52, -51, 1, -111, 11, -22, -70, -33, 95, 40, 6, 63, 52, -66, -20, -6, -104, 81,
+ 57, 22, 82, 119, 126, 76, -10, -108, -63, -123, 19, 23, -106, -1, 117, 26, 112, -85, -78, 81,
+ -116, 53, 86, -126, -80, 122, 36, 67, 18, 19, -114, 73, 125, -3, -69, 99, 10, -30, 19, 112,
+ -103, 0, -61, 47, -106, -45, -105, -107, -56, 23, 14, 51, -70, 30, -32, 30, 7, 22, -31, -41, 19,
+ -47, -64, -52, 119, -66, 54, -109, -87, 3, 95, -124, 94, -48, 36, -40, 13, 19, 91, -14, -115,
+ 103, 66, 20, 44, 47, 8, -40, 4, -114, -110, -47, -28, -108, 89, 0, -7, -71, -91, -43, 98, 8,
+ -85, -98, -113, 103, -71, 69, 14, -95, -36, 92, -17, -66, -95, 123, -15, 52, 88, -60, -23, 123,
+ -61, -4, -33, -45, 77, 57, -121, 119, 116, -40, -31, -15, 96, 54, -49, -44, 36, -37, 111, -45,
+ -17, 12, 14, 21, 105, 48, 51, 42, -89, 55, 61, -5, -2, -36, -88, 36, -35, -29, -7, -68, -28,
+ -76, 5, -38, -66, -72, 24, -120, 8, -86, -28, 0, 71, -89, 20, -40, -100, 61, -57, 52, 23, 66,
+ -2, -24, -7, 86, -100, 111, -114, -47, -25, -40, -61, -67, -104, 33, 49, 16, -115, 9, -64, 27,
+ 122, 34, -33, -89, -113, -50, 42, 111, -14, 110, 43, 32, -112, 101, -59, 28, 76, -2, -117, 47,
+ 5, -73, -75, 21, -91, 99, 81, 93, -17, -119, 68, -21, -84, -51, -64, -98, 58, -33, 77, 4, 18,
+ 116, 62, 111, -105, -13, 91, -92, 81, -34, 40, 17, -128, 85, -19, 20, 8, 92, 83, 10, 3, 40, 89,
+ 60, 109, -23, 59, -66, -22, 43, 124, 25, -105, 77, 14, 75, -111, 13, 45, -90, -108, -79, 78,
+ -45, -55, -44, -86, -20, -41, -11, 65, 76, -79, 91, -23, 77, -84, 114, -109, 2, -71, 68, 8, -31,
+ 99, 97, -104, -94, 69, 64, -16, -48, -78, 99, -58, -17, 95, 96, -64, 47, 96, -69, 60, 28, 114,
+ 64, -128, -128, 114, 28, -124, 72, -41, -48, 82, -6, 63, -27, -126, -86, -121, 0, 4, 4, 35,
+ -111, 66, 64, -61, 117, -92, 48, 88, -128, 116, 7, -24, -111, -55, 96, -59, -96, 49, -70, -41,
+ -47, 85, 86, -37, -32, 53, -49, 62, 68, 80, -37, 95, 29, -114, 11, -65, 90, -99, -97, 101, 96,
+ -88, 5, 34, 3, 23, -22, 42, 4, -4, 17, -121, 106, -60, 33, -38, -32, -8, 41, -87, -4, -35, -102,
+ 7, 18, 35, -7, 85, -18, 60, 15, 34, 82, 46, 68, 63, 80, -38, 4, 51, -74, -34, 83, -33, -8, 44,
+ 87, -18, -8, 46, -53, -109, -121, -114, 10, 63, -36, -1, -123, 69, 107, -58, 33, -11, 63, -117,
+ 60, 22, 73, -36, 22, -76, -92, -74, -37, -35, 87, 40, -97, -6, 95, -25, -2, -99, -101, 102, -48,
+ 45, -55, 85, 94, -48, 57, -100, 34, 16, -63, -16, 106, -75, -7, -109, 71, -74, 20, -16, 37, 90,
+ -61, 69, 19, -111, 95, -104, 116, 75, -68, 85, -80, 66, 127, 127, 67, -98, 121, 53, 23, -3, 56,
+ -89, 99, 57, 9, 122, 76, 119, 1, -117, 47, -105, -42, -7, 51, -8, -81, 48, -60, -69, -29, 24,
+ 19, -81, 43, 31, -36, 62, 96, 20, -58, 39, -122, -115, 7, -114, 118, 27, 27, 78, -101, 75, -93,
+ -104, -8, 119, 121, -97, -84, 58, 33, 18, -35, -29, 20, 20, 7, 112, 60, 31, -12, 7, -128, -55,
+ -68, -7, -12, -115, 97, 115, 44, -46, -68, 108, 36, 121, -1, 84, -4, -26, -126, 85, -32, 36, 26,
+ -19, 71, -121, -92, -51, -116, 81, -71, -83, -50, 21, -119, -60, -78, -84, 102, 19, -26, 118,
+ -53, -13, 16, 36, -64, -83, -66, 32, -99, 54, 83, 104, 61, -19, 107, 95, -66, -42, -6, 25, 86,
+ -13, -53, -49, -9, 74, -13, 58, 125, -96, -32, -22, -21, -12, -38, -114, -88, -100, 35, -87,
+ -108, -2, -103, 87, -119, -109, 50, -28, -101, -4, -43, 105, 119, -118, 103, -104, 41, 47, 71,
+ 53, 11, -53, 59, -13, -11, 83, -33, 28, 11, 78, -59, 73, -33, -60, 119, -73, -127, 98, 39, 77,
+ 21, -8, -103, 103, 44, -87, -52, -74, 56, -63, -70, -121, 40, 103, 7, -100, 113, 53, -46, 44,
+ 16, 31, 102, -31, 104, -38, -120, 118, -122, -55, 25, 1, 92, 22, -14, 24, 108, 92, -90, -93,
+ -16, -99, -13, -127, 75, 101, -42, -86, -29, -51, -49, -105, -118, 91, -56, -51, -73, 117, 53,
+ -39, -73, 121, 83, -49, -10, -86, 11, -97, 40, -33, 6, -40, -9, -32, 92, -101, -83, 116, -5,
+ -57, -93, -121, 2, 38, -65, -6, 45, 100, 92, 92, 74, 115, 45, -33, 92, -11, 70, 33, 76, 85, 94,
+ 1, -111, -103, 6, -4, -31, 44, -53, -77, -45, 100, -83, 92, -11, 10, -7, 126, 23, 36, 61, -18,
+ -28, 67, 126, 53, -45, -77, 95, 43, -73, 30, -37, 122, -53, -79, -77, -42, 71, -124, 43, -89,
+ 60, -80, -89, -68, 96, 29, 103, -50, -93, 105, 7
+ };
+
+ static class ProxyStream extends FilterInputStream {
+ int readBytes;
+
+ ProxyStream(InputStream is) {
+ super(is);
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ int result = super.read(b, off, len);
+ if (result > 0) {
+ readBytes += result;
+ }
+ return result;
+ }
+ }
+
+ @Test
+ public void testEagerStream() throws IOException {
+ ProxyStream ps = new ProxyStream(new ByteArrayInputStream(DATA));
+ BrotliInputStream reader = new BrotliInputStream(ps, 1);
+ byte[] buffer = new byte[1];
+ reader.read(buffer);
+ reader.close();
+ int normalReadBytes = ps.readBytes;
+
+ ps = new ProxyStream(new ByteArrayInputStream(DATA));
+ reader = new BrotliInputStream(ps, 1);
+ reader.enableEagerOutput();
+ reader.read(buffer);
+ reader.close();
+ int eagerReadBytes = ps.readBytes;
+
+ // Did not continue decoding - suspended as soon as enough data was decoded.
+ assertTrue(eagerReadBytes < normalReadBytes);
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Huffman.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Huffman.java
new file mode 100644
index 000000000..38f7f293d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Huffman.java
@@ -0,0 +1,137 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+/**
+ * Utilities for building Huffman decoding tables.
+ */
+final class Huffman {
+
+ private static final int MAX_LENGTH = 15;
+
+ /**
+ * Returns reverse(reverse(key, len) + 1, len).
+ *
+ * <p> reverse(key, len) is the bit-wise reversal of the len least significant bits of key.
+ */
+ private static int getNextKey(int key, int len) {
+ int step = 1 << (len - 1);
+ while ((key & step) != 0) {
+ step >>= 1;
+ }
+ return (key & (step - 1)) + step;
+ }
+
+ /**
+ * Stores {@code item} in {@code table[0], table[step], table[2 * step] .., table[end]}.
+ *
+ * <p> Assumes that end is an integer multiple of step.
+ */
+ private static void replicateValue(int[] table, int offset, int step, int end, int item) {
+ do {
+ end -= step;
+ table[offset + end] = item;
+ } while (end > 0);
+ }
+
+ /**
+ * @param count histogram of bit lengths for the remaining symbols,
+ * @param len code length of the next processed symbol.
+ * @return table width of the next 2nd level table.
+ */
+ private static int nextTableBitSize(int[] count, int len, int rootBits) {
+ int left = 1 << (len - rootBits);
+ while (len < MAX_LENGTH) {
+ left -= count[len];
+ if (left <= 0) {
+ break;
+ }
+ len++;
+ left <<= 1;
+ }
+ return len - rootBits;
+ }
+
+ /**
+ * Builds Huffman lookup table assuming code lengths are in symbol order.
+ *
+ * @return number of slots used by resulting Huffman table
+ */
+ static int buildHuffmanTable(int[] tableGroup, int tableIdx, int rootBits, int[] codeLengths,
+ int codeLengthsSize) {
+ int tableOffset = tableGroup[tableIdx];
+ int key; // Reversed prefix code.
+ int[] sorted = new int[codeLengthsSize]; // Symbols sorted by code length.
+ // TODO: fill with zeroes?
+ int[] count = new int[MAX_LENGTH + 1]; // Number of codes of each length.
+ int[] offset = new int[MAX_LENGTH + 1]; // Offsets in sorted table for each length.
+ int symbol;
+
+ // Build histogram of code lengths.
+ for (symbol = 0; symbol < codeLengthsSize; symbol++) {
+ count[codeLengths[symbol]]++;
+ }
+
+ // Generate offsets into sorted symbol table by code length.
+ offset[1] = 0;
+ for (int len = 1; len < MAX_LENGTH; len++) {
+ offset[len + 1] = offset[len] + count[len];
+ }
+
+ // Sort symbols by length, by symbol order within each length.
+ for (symbol = 0; symbol < codeLengthsSize; symbol++) {
+ if (codeLengths[symbol] != 0) {
+ sorted[offset[codeLengths[symbol]]++] = symbol;
+ }
+ }
+
+ int tableBits = rootBits;
+ int tableSize = 1 << tableBits;
+ int totalSize = tableSize;
+
+ // Special case code with only one value.
+ if (offset[MAX_LENGTH] == 1) {
+ for (key = 0; key < totalSize; key++) {
+ tableGroup[tableOffset + key] = sorted[0];
+ }
+ return totalSize;
+ }
+
+ // Fill in root table.
+ key = 0;
+ symbol = 0;
+ for (int len = 1, step = 2; len <= rootBits; len++, step <<= 1) {
+ for (; count[len] > 0; count[len]--) {
+ replicateValue(tableGroup, tableOffset + key, step, tableSize,
+ len << 16 | sorted[symbol++]);
+ key = getNextKey(key, len);
+ }
+ }
+
+ // Fill in 2nd level tables and add pointers to root table.
+ int mask = totalSize - 1;
+ int low = -1;
+ int currentOffset = tableOffset;
+ for (int len = rootBits + 1, step = 2; len <= MAX_LENGTH; len++, step <<= 1) {
+ for (; count[len] > 0; count[len]--) {
+ if ((key & mask) != low) {
+ currentOffset += tableSize;
+ tableBits = nextTableBitSize(count, len, rootBits);
+ tableSize = 1 << tableBits;
+ totalSize += tableSize;
+ low = key & mask;
+ tableGroup[tableOffset + low] =
+ (tableBits + rootBits) << 16 | (currentOffset - tableOffset - low);
+ }
+ replicateValue(tableGroup, currentOffset + (key >> rootBits), step, tableSize,
+ (len - rootBits) << 16 | sorted[symbol++]);
+ key = getNextKey(key, len);
+ }
+ }
+ return totalSize;
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/SetDictionaryTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/SetDictionaryTest.java
new file mode 100644
index 000000000..f462c49eb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/SetDictionaryTest.java
@@ -0,0 +1,76 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Tests for {@link Dictionary}.
+ */
+@RunWith(JUnit4.class)
+public class SetDictionaryTest {
+
+ /** See {@link SynthTest} */
+ private static final byte[] BASE_DICT_WORD = {
+ (byte) 0x1b, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x41, (byte) 0x02
+ };
+
+ /** See {@link SynthTest} */
+ private static final byte[] ONE_COMMAND = {
+ (byte) 0x1b, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x11, (byte) 0x86, (byte) 0x02
+ };
+
+ @Test
+ public void testSetDictionary() throws IOException {
+ byte[] buffer = new byte[16];
+ BrotliInputStream decoder;
+
+ // No dictionary set; still decoding should succeed, if no dictionary entries are used.
+ decoder = new BrotliInputStream(new ByteArrayInputStream(ONE_COMMAND));
+ assertEquals(3, decoder.read(buffer, 0, buffer.length));
+ assertEquals("aaa", new String(buffer, 0, 3, "US-ASCII"));
+ decoder.close();
+
+ // Decoding of dictionary item must fail.
+ decoder = new BrotliInputStream(new ByteArrayInputStream(BASE_DICT_WORD));
+ boolean decodingFailed = false;
+ try {
+ decoder.read(buffer, 0, buffer.length);
+ } catch (IOException ex) {
+ decodingFailed = true;
+ }
+ assertEquals(true, decodingFailed);
+ decoder.close();
+
+ // Load dictionary data.
+ FileChannel dictionaryChannel =
+ new FileInputStream(System.getProperty("RFC_DICTIONARY")).getChannel();
+ ByteBuffer dictionary = dictionaryChannel.map(FileChannel.MapMode.READ_ONLY, 0, 122784).load();
+ Dictionary.setData(dictionary);
+
+ // Retry decoding of dictionary item.
+ decoder = new BrotliInputStream(new ByteArrayInputStream(BASE_DICT_WORD));
+ assertEquals(4, decoder.read(buffer, 0, buffer.length));
+ assertEquals("time", new String(buffer, 0, 4, "US-ASCII"));
+ decoder.close();
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/State.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/State.java
new file mode 100644
index 000000000..54a5a2d91
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/State.java
@@ -0,0 +1,89 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import java.io.InputStream;
+
+final class State {
+ byte[] ringBuffer;
+ byte[] contextModes;
+ byte[] contextMap;
+ byte[] distContextMap;
+ byte[] distExtraBits;
+ byte[] output;
+ byte[] byteBuffer; // BitReader
+
+ short[] shortBuffer; // BitReader
+
+ int[] intBuffer; // BitReader
+ int[] rings;
+ int[] blockTrees;
+ int[] literalTreeGroup;
+ int[] commandTreeGroup;
+ int[] distanceTreeGroup;
+ int[] distOffset;
+
+ long accumulator64; // BitReader: pre-fetched bits.
+
+ int runningState; // Default value is 0 == Decode.UNINITIALIZED
+ int nextRunningState;
+ int accumulator32; // BitReader: pre-fetched bits.
+ int bitOffset; // BitReader: bit-reading position in accumulator.
+ int halfOffset; // BitReader: offset of next item in intBuffer/shortBuffer.
+ int tailBytes; // BitReader: number of bytes in unfinished half.
+ int endOfStreamReached; // BitReader: input stream is finished.
+ int metaBlockLength;
+ int inputEnd;
+ int isUncompressed;
+ int isMetadata;
+ int literalBlockLength;
+ int numLiteralBlockTypes;
+ int commandBlockLength;
+ int numCommandBlockTypes;
+ int distanceBlockLength;
+ int numDistanceBlockTypes;
+ int pos;
+ int maxDistance;
+ int distRbIdx;
+ int trivialLiteralContext;
+ int literalTreeIdx;
+ int commandTreeIdx;
+ int j;
+ int insertLength;
+ int contextMapSlice;
+ int distContextMapSlice;
+ int contextLookupOffset1;
+ int contextLookupOffset2;
+ int distanceCode;
+ int numDirectDistanceCodes;
+ int distancePostfixMask;
+ int distancePostfixBits;
+ int distance;
+ int copyLength;
+ int maxBackwardDistance;
+ int maxRingBufferSize;
+ int ringBufferSize;
+ int expectedTotalSize;
+ int outputOffset;
+ int outputLength;
+ int outputUsed;
+ int ringBufferBytesWritten;
+ int ringBufferBytesReady;
+ int isEager;
+ int isLargeWindow;
+
+ InputStream input; // BitReader
+
+ State() {
+ this.ringBuffer = new byte[0];
+ this.rings = new int[10];
+ this.rings[0] = 16;
+ this.rings[1] = 15;
+ this.rings[2] = 11;
+ this.rings[3] = 4;
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/SynthTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/SynthTest.java
new file mode 100644
index 000000000..e269e6b03
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/SynthTest.java
@@ -0,0 +1,2940 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.fail;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Tests for {@link Decode}.
+ */
+@RunWith(JUnit4.class)
+public class SynthTest {
+
+ static byte[] readUniBytes(String uniBytes) {
+ byte[] result = new byte[uniBytes.length()];
+ for (int i = 0; i < result.length; ++i) {
+ result[i] = (byte) uniBytes.charAt(i);
+ }
+ return result;
+ }
+
+ private byte[] decompress(byte[] data) throws IOException {
+ byte[] buffer = new byte[65536];
+ ByteArrayInputStream input = new ByteArrayInputStream(data);
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ BrotliInputStream brotliInput = new BrotliInputStream(input);
+ while (true) {
+ int len = brotliInput.read(buffer, 0, buffer.length);
+ if (len <= 0) {
+ break;
+ }
+ output.write(buffer, 0, len);
+ }
+ brotliInput.close();
+ return output.toByteArray();
+ }
+
+ private void checkSynth(byte[] compressed, boolean expectSuccess,
+ String expectedOutput) {
+ byte[] expected = readUniBytes(expectedOutput);
+ try {
+ byte[] actual = decompress(compressed);
+ if (!expectSuccess) {
+ fail("expected to fail decoding, but succeeded");
+ }
+ assertArrayEquals(expected, actual);
+ } catch (IOException ex) {
+ if (expectSuccess) {
+ fail("expected to succeed decoding, but failed");
+ }
+ }
+ }
+
+/* GENERATED CODE START */
+
+ @Test
+ public void testAllTransforms10() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0xfc, (byte) 0x05, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x13, (byte) 0x7c, (byte) 0x84, (byte) 0x26, (byte) 0xf8, (byte) 0x04,
+ (byte) 0x10, (byte) 0x4c, (byte) 0xf0, (byte) 0x89, (byte) 0x38, (byte) 0x30, (byte) 0xc1,
+ (byte) 0x27, (byte) 0x4e, (byte) 0xc1, (byte) 0x04, (byte) 0x9f, (byte) 0x64, (byte) 0x06,
+ (byte) 0x26, (byte) 0xf8, (byte) 0x24, (byte) 0x3f, (byte) 0x34, (byte) 0xc1, (byte) 0x27,
+ (byte) 0x7d, (byte) 0x82, (byte) 0x09, (byte) 0x3e, (byte) 0xe9, (byte) 0x16, (byte) 0x4d,
+ (byte) 0xf0, (byte) 0xc9, (byte) 0xd2, (byte) 0xc0, (byte) 0x04, (byte) 0x9f, (byte) 0x0c,
+ (byte) 0x8f, (byte) 0x4c, (byte) 0xf0, (byte) 0xc9, (byte) 0x06, (byte) 0xd1, (byte) 0x04,
+ (byte) 0x9f, (byte) 0x6c, (byte) 0x92, (byte) 0x4d, (byte) 0xf0, (byte) 0xc9, (byte) 0x39,
+ (byte) 0xc1, (byte) 0x04, (byte) 0x9f, (byte) 0xdc, (byte) 0x94, (byte) 0x4c, (byte) 0xf0,
+ (byte) 0xc9, (byte) 0x69, (byte) 0xd1, (byte) 0x04, (byte) 0x9f, (byte) 0x3c, (byte) 0x98,
+ (byte) 0x4d, (byte) 0xf0, (byte) 0x29, (byte) 0x9c, (byte) 0x81, (byte) 0x09, (byte) 0x3e,
+ (byte) 0x45, (byte) 0x37, (byte) 0x31, (byte) 0xc1, (byte) 0xa7, (byte) 0x60, (byte) 0x47,
+ (byte) 0x26, (byte) 0xf8, (byte) 0x14, (byte) 0xfa, (byte) 0xcc, (byte) 0x04, (byte) 0x9f,
+ (byte) 0xc2, (byte) 0x20, (byte) 0x9a, (byte) 0xe0, (byte) 0x53, (byte) 0x48, (byte) 0x54,
+ (byte) 0x13, (byte) 0x7c, (byte) 0x8a, (byte) 0x8f, (byte) 0x6c, (byte) 0x82, (byte) 0x4f,
+ (byte) 0xb1, (byte) 0xd2, (byte) 0x4d, (byte) 0xf0, (byte) 0x29, (byte) 0x67, (byte) 0x82,
+ (byte) 0x09, (byte) 0x3e, (byte) 0xe5, (byte) 0x4f, (byte) 0x31, (byte) 0xc1, (byte) 0xa7,
+ (byte) 0x7c, (byte) 0x4a, (byte) 0x26, (byte) 0xf8, (byte) 0x94, (byte) 0x57, (byte) 0xcd,
+ (byte) 0x04, (byte) 0x9f, (byte) 0x12, (byte) 0x2c, (byte) 0x9a, (byte) 0xe0, (byte) 0x53,
+ (byte) 0xba, (byte) 0x55, (byte) 0x13, (byte) 0x7c, (byte) 0xca, (byte) 0xbf, (byte) 0x6c,
+ (byte) 0x82, (byte) 0x4f, (byte) 0xb9, (byte) 0xd8, (byte) 0x4d, (byte) 0xf0, (byte) 0xa9,
+ (byte) 0x30, (byte) 0x03, (byte) 0x13, (byte) 0x7c, (byte) 0x2a, (byte) 0xd2, (byte) 0xc2,
+ (byte) 0x04, (byte) 0x9f, (byte) 0x4a, (byte) 0x36, (byte) 0x31, (byte) 0xc1, (byte) 0xa7,
+ (byte) 0xca, (byte) 0x6d, (byte) 0x4c, (byte) 0xf0, (byte) 0xa9, (byte) 0x94, (byte) 0x23,
+ (byte) 0x13, (byte) 0x7c, (byte) 0x2a, (byte) 0xeb, (byte) 0xca, (byte) 0x04, (byte) 0x9f,
+ (byte) 0xea, (byte) 0x3c, (byte) 0x33, (byte) 0xc1, (byte) 0xa7, (byte) 0xb2, (byte) 0xef,
+ (byte) 0x4c, (byte) 0xf0, (byte) 0xa9, (byte) 0xf8, (byte) 0x43, (byte) 0x13, (byte) 0x7c,
+ (byte) 0xaa, (byte) 0x00, (byte) 0xd3, (byte) 0x04, (byte) 0x9f, (byte) 0x2a, (byte) 0x42,
+ (byte) 0x35, (byte) 0xc1, (byte) 0xa7, (byte) 0xc2, (byte) 0x70, (byte) 0x4d, (byte) 0xf0,
+ (byte) 0xa9, (byte) 0x52, (byte) 0x64, (byte) 0x13, (byte) 0x7c, (byte) 0x2a, (byte) 0x1a,
+ (byte) 0xdb, (byte) 0x04, (byte) 0x9f, (byte) 0x6a, (byte) 0x48, (byte) 0x37, (byte) 0xc1,
+ (byte) 0xa7, (byte) 0x92, (byte) 0xf2, (byte) 0x4d, (byte) 0xf0, (byte) 0xa9, (byte) 0xc3,
+ (byte) 0x04, (byte) 0x13, (byte) 0x7c, (byte) 0xea, (byte) 0x32, (byte) 0xc3, (byte) 0x04,
+ (byte) 0x9f, (byte) 0x7a, (byte) 0x4e, (byte) 0x31, (byte) 0xc1, (byte) 0xa7, (byte) 0x06,
+ (byte) 0x74, (byte) 0x4c, (byte) 0xf0, (byte) 0xa9, (byte) 0x19, (byte) 0x25, (byte) 0x13,
+ (byte) 0x7c, (byte) 0x6a, (byte) 0x4d, (byte) 0xcb, (byte) 0x04, (byte) 0x9f, (byte) 0x1a,
+ (byte) 0x55, (byte) 0x33, (byte) 0xc1, (byte) 0xa7, (byte) 0x56, (byte) 0xf5, (byte) 0x4c,
+ (byte) 0xf0, (byte) 0xa9, (byte) 0x5d, (byte) 0x45, (byte) 0x13, (byte) 0x7c, (byte) 0xea,
+ (byte) 0x59, (byte) 0xd3, (byte) 0x04, (byte) 0x9f, (byte) 0xfa, (byte) 0x57, (byte) 0x35,
+ (byte) 0xc1, (byte) 0xa7, (byte) 0x66, (byte) 0x76, (byte) 0x4d, (byte) 0xf0, (byte) 0xa9,
+ (byte) 0x9f, (byte) 0x65, (byte) 0x13, (byte) 0x7c, (byte) 0x6a, (byte) 0x6f, (byte) 0xdb,
+ (byte) 0x04, (byte) 0x9f, (byte) 0x9a, (byte) 0x5d, (byte) 0x37, (byte) 0xc1, (byte) 0xa7,
+ (byte) 0x06, (byte) 0xf8, (byte) 0x4d, (byte) 0xf0, (byte) 0x69, (byte) 0x0c, (byte) 0x06,
+ (byte) 0x26, (byte) 0xf8, (byte) 0x34, (byte) 0x08, (byte) 0x07, (byte) 0x13, (byte) 0x7c,
+ (byte) 0x1a, (byte) 0x8b, (byte) 0x85, (byte) 0x09, (byte) 0x3e, (byte) 0x8d, (byte) 0xc8,
+ (byte) 0xc3, (byte) 0x04, (byte) 0x9f, (byte) 0xe6, (byte) 0x65, (byte) 0x62, (byte) 0x82,
+ (byte) 0x4f, (byte) 0xb3, (byte) 0x73, (byte) 0x31, (byte) 0xc1, (byte) 0xa7, (byte) 0x41,
+ (byte) 0xda, (byte) 0x98, (byte) 0xe0, (byte) 0xd3, (byte) 0x54, (byte) 0x7d, (byte) 0x4c,
+ (byte) 0xf0, (byte) 0x69, (byte) 0xc4, (byte) 0x46, (byte) 0x26, (byte) 0xf8, (byte) 0x34,
+ (byte) 0x72, (byte) 0x27, (byte) 0x13, (byte) 0x7c, (byte) 0x1a, (byte) 0xc5, (byte) 0x95,
+ (byte) 0x09, (byte) 0x3e, (byte) 0x8d, (byte) 0xe5, (byte) 0xcb, (byte) 0x04, (byte) 0x9f,
+ (byte) 0x06, (byte) 0x75, (byte) 0x66, (byte) 0x82, (byte) 0x4f, (byte) 0x43, (byte) 0x7b,
+ (byte) 0x33, (byte) 0xc1, (byte) 0xa7, (byte) 0x09, (byte) 0xde, (byte) 0x99, (byte) 0xe0,
+ (byte) 0xd3, (byte) 0x34, (byte) 0xff, (byte) 0x4c, (byte) 0xf0, (byte) 0x69, (byte) 0xb2,
+ (byte) 0x87, (byte) 0x26, (byte) 0xf8, (byte) 0x34, (byte) 0xe9, (byte) 0x47, (byte) 0x13,
+ (byte) 0x7c, (byte) 0x9a, (byte) 0xfb, (byte) 0xa5, (byte) 0x09, (byte) 0x3e, (byte) 0x4d,
+ (byte) 0x01, (byte) 0xd4, (byte) 0x04, (byte) 0x9f, (byte) 0x46, (byte) 0x82, (byte) 0x6a,
+ (byte) 0x82, (byte) 0x4f, (byte) 0x03, (byte) 0x82, (byte) 0x35, (byte) 0xc1, (byte) 0xa7,
+ (byte) 0x61, (byte) 0xe1, (byte) 0x9a, (byte) 0xe0, (byte) 0xd3, (byte) 0xe4, (byte) 0x80,
+ (byte) 0x4d, (byte) 0xf0, (byte) 0x69, (byte) 0x8a, (byte) 0xc8, (byte) 0x26, (byte) 0xf8,
+ (byte) 0x34, (byte) 0x52, (byte) 0x68, (byte) 0x13, (byte) 0x7c, (byte) 0x9a, (byte) 0x2f,
+ (byte) 0xb6, (byte) 0x09, (byte) 0x3e, (byte) 0x8d, (byte) 0x1b, (byte) 0xdc, (byte) 0x04,
+ (byte) 0x9f, (byte) 0x86, (byte) 0x8f, (byte) 0x6e, (byte) 0x82, (byte) 0x4f, (byte) 0xb3,
+ (byte) 0x88, (byte) 0x37, (byte) 0xc1, (byte) 0xa7, (byte) 0xd9, (byte) 0xe4, (byte) 0x9b,
+ (byte) 0xe0, (byte) 0xd3, (byte) 0x9e, (byte) 0x02, (byte) 0x4c, (byte) 0xf0, (byte) 0x69,
+ (byte) 0x6d, (byte) 0x09, (byte) 0x26, (byte) 0xf8, (byte) 0xb4, (byte) 0xc3, (byte) 0x08,
+ (byte) 0x13, (byte) 0x7c, (byte) 0x5a, (byte) 0x68, (byte) 0x86, (byte) 0x09, (byte) 0x3e,
+ (byte) 0xad, (byte) 0x37, (byte) 0xc4, (byte) 0x04, (byte) 0x9f, (byte) 0x56, (byte) 0x9d,
+ (byte) 0x62, (byte) 0x82, (byte) 0x4f, (byte) 0x9b, (byte) 0x8f, (byte) 0x31, (byte) 0xc1,
+ (byte) 0xa7, (byte) 0x2d, (byte) 0xe8, (byte) 0x98, (byte) 0xe0, (byte) 0xd3, (byte) 0x4a,
+ (byte) 0x84, (byte) 0x4c, (byte) 0xf0, (byte) 0x69, (byte) 0x3f, (byte) 0x4a, (byte) 0x26,
+ (byte) 0xf8, (byte) 0xb4, (byte) 0x2c, (byte) 0x29, (byte) 0x13, (byte) 0x7c, (byte) 0xda,
+ (byte) 0x9c, (byte) 0x96, (byte) 0x09, (byte) 0x3e, (byte) 0x2d, (byte) 0x52, (byte) 0xcc,
+ (byte) 0x04, (byte) 0x9f, (byte) 0xb6, (byte) 0xaa, (byte) 0x66, (byte) 0x82, (byte) 0x4f,
+ (byte) 0x2b, (byte) 0x96, (byte) 0x33, (byte) 0xc1, (byte) 0xa7, (byte) 0x7d, (byte) 0xeb,
+ (byte) 0x99, (byte) 0xe0, (byte) 0xd3, (byte) 0xf6, (byte) 0x05, (byte) 0x4d, (byte) 0xf0,
+ (byte) 0x69, (byte) 0x17, (byte) 0x8b, (byte) 0x26, (byte) 0xf8, (byte) 0xb4, (byte) 0x97,
+ (byte) 0x49, (byte) 0x13, (byte) 0x7c, (byte) 0xda, (byte) 0xd1, (byte) 0xa6, (byte) 0x09,
+ (byte) 0x3e, (byte) 0x2d, (byte) 0x6c, (byte) 0xd4, (byte) 0x04, (byte) 0x9f, (byte) 0xb6,
+ (byte) 0xb7, (byte) 0x6a, (byte) 0x82, (byte) 0x4f, (byte) 0xab, (byte) 0x9c, (byte) 0x35,
+ (byte) 0xc1, (byte) 0xa7, (byte) 0xc5, (byte) 0xee, (byte) 0x9a, (byte) 0xe0, (byte) 0xd3,
+ (byte) 0x9a, (byte) 0x87, (byte) 0x4d, (byte) 0xf0, (byte) 0x69, (byte) 0xe9, (byte) 0xcb
+ };
+ checkSynth(
+ /*
+ * // The stream consists of word "time" with all possible transforms.
+ * main_header
+ * metablock_header_easy: 1533, 1
+ * command_easy: 10, "|", 2 // = 0 << 10 + 1 + 1
+ * command_easy: 10, "|", 1037 // = 1 << 10 + 1 + 12
+ * command_easy: 10, "|", 2073 // = 2 << 10 + 1 + 24
+ * command_easy: 10, "|", 3110 // = 3 << 10 + 1 + 37
+ * command_easy: 10, "|", 4144 // = 4 << 10 + 1 + 47
+ * command_easy: 10, "|", 5180 // = 5 << 10 + 1 + 59
+ * command_easy: 10, "|", 6220 // = 6 << 10 + 1 + 75
+ * command_easy: 10, "|", 7256 // = 7 << 10 + 1 + 87
+ * command_easy: 10, "|", 8294 // = 8 << 10 + 1 + 101
+ * command_easy: 10, "|", 9333 // = 9 << 10 + 1 + 116
+ * command_easy: 10, "|", 10368 // = 10 << 10 + 1 + 127
+ * command_easy: 10, "|", 11408 // = 11 << 10 + 1 + 143
+ * command_easy: 10, "|", 12441 // = 12 << 10 + 1 + 152
+ * command_easy: 10, "|", 13475 // = 13 << 10 + 1 + 162
+ * command_easy: 10, "|", 14513 // = 14 << 10 + 1 + 176
+ * command_easy: 10, "|", 15550 // = 15 << 10 + 1 + 189
+ * command_easy: 10, "|", 16587 // = 16 << 10 + 1 + 202
+ * command_easy: 10, "|", 17626 // = 17 << 10 + 1 + 217
+ * command_easy: 10, "|", 18665 // = 18 << 10 + 1 + 232
+ * command_easy: 10, "|", 19703 // = 19 << 10 + 1 + 246
+ * command_easy: 10, "|", 20739 // = 20 << 10 + 1 + 258
+ * command_easy: 10, "|", 21775 // = 21 << 10 + 1 + 270
+ * command_easy: 10, "|", 22812 // = 22 << 10 + 1 + 283
+ * command_easy: 10, "|", 23848 // = 23 << 10 + 1 + 295
+ * command_easy: 10, "|", 24880 // = 24 << 10 + 1 + 303
+ * command_easy: 10, "|", 25916 // = 25 << 10 + 1 + 315
+ * command_easy: 10, "|", 26956 // = 26 << 10 + 1 + 331
+ * command_easy: 10, "|", 27988 // = 27 << 10 + 1 + 339
+ * command_easy: 10, "|", 29021 // = 28 << 10 + 1 + 348
+ * command_easy: 10, "|", 30059 // = 29 << 10 + 1 + 362
+ * command_easy: 10, "|", 31100 // = 30 << 10 + 1 + 379
+ * command_easy: 10, "|", 32136 // = 31 << 10 + 1 + 391
+ * command_easy: 10, "|", 33173 // = 32 << 10 + 1 + 404
+ * command_easy: 10, "|", 34209 // = 33 << 10 + 1 + 416
+ * command_easy: 10, "|", 35247 // = 34 << 10 + 1 + 430
+ * command_easy: 10, "|", 36278 // = 35 << 10 + 1 + 437
+ * command_easy: 10, "|", 37319 // = 36 << 10 + 1 + 454
+ * command_easy: 10, "|", 38355 // = 37 << 10 + 1 + 466
+ * command_easy: 10, "|", 39396 // = 38 << 10 + 1 + 483
+ * command_easy: 10, "|", 40435 // = 39 << 10 + 1 + 498
+ * command_easy: 10, "|", 41465 // = 40 << 10 + 1 + 504
+ * command_easy: 10, "|", 42494 // = 41 << 10 + 1 + 509
+ * command_easy: 10, "|", 43534 // = 42 << 10 + 1 + 525
+ * command_easy: 10, "|", 44565 // = 43 << 10 + 1 + 532
+ * command_easy: 10, "|", 45606 // = 44 << 10 + 1 + 549
+ * command_easy: 10, "|", 46641 // = 45 << 10 + 1 + 560
+ * command_easy: 10, "|", 47680 // = 46 << 10 + 1 + 575
+ * command_easy: 10, "|", 48719 // = 47 << 10 + 1 + 590
+ * command_easy: 10, "|", 49758 // = 48 << 10 + 1 + 605
+ * command_easy: 10, "|", 50786 // = 49 << 10 + 1 + 609
+ * command_easy: 10, "|", 51824 // = 50 << 10 + 1 + 623
+ * command_easy: 10, "|", 52861 // = 51 << 10 + 1 + 636
+ * command_easy: 10, "|", 53897 // = 52 << 10 + 1 + 648
+ * command_easy: 10, "|", 54935 // = 53 << 10 + 1 + 662
+ * command_easy: 10, "|", 55973 // = 54 << 10 + 1 + 676
+ * command_easy: 10, "|", 56999 // = 55 << 10 + 1 + 678
+ * command_easy: 10, "|", 58027 // = 56 << 10 + 1 + 682
+ * command_easy: 10, "|", 59056 // = 57 << 10 + 1 + 687
+ * command_easy: 10, "|", 60092 // = 58 << 10 + 1 + 699
+ * command_easy: 10, "|", 61129 // = 59 << 10 + 1 + 712
+ * command_easy: 10, "|", 62156 // = 60 << 10 + 1 + 715
+ * command_easy: 10, "|", 63195 // = 61 << 10 + 1 + 730
+ * command_easy: 10, "|", 64233 // = 62 << 10 + 1 + 744
+ * command_easy: 10, "|", 65277 // = 63 << 10 + 1 + 764
+ * command_easy: 10, "|", 66307 // = 64 << 10 + 1 + 770
+ * command_easy: 10, "|", 67333 // = 65 << 10 + 1 + 772
+ * command_easy: 10, "|", 68371 // = 66 << 10 + 1 + 786
+ * command_easy: 10, "|", 69407 // = 67 << 10 + 1 + 798
+ * command_easy: 10, "|", 70444 // = 68 << 10 + 1 + 811
+ * command_easy: 10, "|", 71480 // = 69 << 10 + 1 + 823
+ * command_easy: 10, "|", 72517 // = 70 << 10 + 1 + 836
+ * command_easy: 10, "|", 73554 // = 71 << 10 + 1 + 849
+ * command_easy: 10, "|", 74591 // = 72 << 10 + 1 + 862
+ * command_easy: 10, "|", 75631 // = 73 << 10 + 1 + 878
+ * command_easy: 10, "|", 76679 // = 74 << 10 + 1 + 902
+ * command_easy: 10, "|", 77715 // = 75 << 10 + 1 + 914
+ * command_easy: 10, "|", 78757 // = 76 << 10 + 1 + 932
+ * command_easy: 10, "|", 79793 // = 77 << 10 + 1 + 944
+ * command_easy: 10, "|", 80830 // = 78 << 10 + 1 + 957
+ * command_easy: 10, "|", 81866 // = 79 << 10 + 1 + 969
+ * command_easy: 10, "|", 82902 // = 80 << 10 + 1 + 981
+ * command_easy: 10, "|", 83942 // = 81 << 10 + 1 + 997
+ * command_easy: 10, "|", 84980 // = 82 << 10 + 1 + 1011
+ * command_easy: 10, "|", 86018 // = 83 << 10 + 1 + 1025
+ * command_easy: 10, "|", 87055 // = 84 << 10 + 1 + 1038
+ * command_easy: 10, "|", 88093 // = 85 << 10 + 1 + 1052
+ * command_easy: 10, "|", 89129 // = 86 << 10 + 1 + 1064
+ * command_easy: 10, "|", 90166 // = 87 << 10 + 1 + 1077
+ * command_easy: 10, "|", 91202 // = 88 << 10 + 1 + 1089
+ * command_easy: 10, "|", 92239 // = 89 << 10 + 1 + 1102
+ * command_easy: 10, "|", 93276 // = 90 << 10 + 1 + 1115
+ * command_easy: 10, "|", 94315 // = 91 << 10 + 1 + 1130
+ * command_easy: 10, "|", 95353 // = 92 << 10 + 1 + 1144
+ * command_easy: 10, "|", 96392 // = 93 << 10 + 1 + 1159
+ * command_easy: 10, "|", 97432 // = 94 << 10 + 1 + 1175
+ * command_easy: 10, "|", 98468 // = 95 << 10 + 1 + 1187
+ * command_easy: 10, "|", 99507 // = 96 << 10 + 1 + 1202
+ * command_easy: 10, "|", 100544 // = 97 << 10 + 1 + 1215
+ * command_easy: 10, "|", 101581 // = 98 << 10 + 1 + 1228
+ * command_easy: 10, "|", 102619 // = 99 << 10 + 1 + 1242
+ * command_easy: 10, "|", 103655 // = 100 << 10 + 1 + 1254
+ * command_easy: 10, "|", 104694 // = 101 << 10 + 1 + 1269
+ * command_easy: 10, "|", 105730 // = 102 << 10 + 1 + 1281
+ * command_easy: 10, "|", 106767 // = 103 << 10 + 1 + 1294
+ * command_easy: 10, "|", 107804 // = 104 << 10 + 1 + 1307
+ * command_easy: 10, "|", 108841 // = 105 << 10 + 1 + 1320
+ * command_easy: 10, "|", 109878 // = 106 << 10 + 1 + 1333
+ * command_easy: 10, "|", 110917 // = 107 << 10 + 1 + 1348
+ * command_easy: 10, "|", 111954 // = 108 << 10 + 1 + 1361
+ * command_easy: 10, "|", 112991 // = 109 << 10 + 1 + 1374
+ * command_easy: 10, "|", 114028 // = 110 << 10 + 1 + 1387
+ * command_easy: 10, "|", 115066 // = 111 << 10 + 1 + 1401
+ * command_easy: 10, "|", 116104 // = 112 << 10 + 1 + 1415
+ * command_easy: 10, "|", 117140 // = 113 << 10 + 1 + 1427
+ * command_easy: 10, "|", 118176 // = 114 << 10 + 1 + 1439
+ * command_easy: 10, "|", 119213 // = 115 << 10 + 1 + 1452
+ * command_easy: 10, "|", 120250 // = 116 << 10 + 1 + 1465
+ * command_easy: 10, "|", 121287 // = 117 << 10 + 1 + 1478
+ * command_easy: 10, "|", 122325 // = 118 << 10 + 1 + 1492
+ * command_easy: 10, "|", 123363 // = 119 << 10 + 1 + 1506
+ * command_easy: 10, "|", 124401 // = 120 << 10 + 1 + 1520
+ */
+ compressed,
+ true,
+ "|categories|categories | categories |ategories|Categories |categories the | categories|s cat"
+ + "egories |categories of |Categories|categories and |tegories|categorie|, categories |catego"
+ + "ries, | Categories |categories in |categories to |e categories |categories\"|categories.|c"
+ + "ategories\">|categories\n|categor|categories]|categories for |egories|categori|categories "
+ + "a |categories that | Categories|categories. |.categories| categories, |gories|categories w"
+ + "ith |categories'|categories from |categories by |ories|ries| the categories|catego|categor"
+ + "ies. The |CATEGORIES|categories on |categories as |categories is |cat|categorieing |catego"
+ + "ries\n\t|categories:| categories. |categoriesed |s|ies|cate|categories(|Categories, |ca|ca"
+ + "tegories at |categoriesly | the categories of |categ|c| Categories, |Categories\"|.categor"
+ + "ies(|CATEGORIES |Categories\">|categories=\"| categories.|.com/categories| the categories "
+ + "of the |Categories'|categories. This |categories,|.categories |Categories(|Categories.|cat"
+ + "egories not | categories=\"|categorieser | CATEGORIES |categoriesal | CATEGORIES|categorie"
+ + "s='|CATEGORIES\"|Categories. | categories(|categoriesful | Categories. |categoriesive |cat"
+ + "egoriesless |CATEGORIES'|categoriesest | Categories.|CATEGORIES\">| categories='|Categorie"
+ + "s,|categoriesize |CATEGORIES.|\302\240categories| categories,|Categories=\"|CATEGORIES="
+ + "\"|categoriesous |CATEGORIES, |Categories='| Categories,| CATEGORIES=\"| CATEGORIES, |CATE"
+ + "GORIES,|CATEGORIES(|CATEGORIES. | CATEGORIES.|CATEGORIES='| CATEGORIES. | Categories=\"| C"
+ + "ATEGORIES='| Categories='"
+ );
+ }
+
+ @Test
+ public void testAllTransforms4() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x40, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x51, (byte) 0x3e, (byte) 0x42, (byte) 0x51, (byte) 0x3e, (byte) 0x81,
+ (byte) 0x02, (byte) 0x51, (byte) 0x3e, (byte) 0x11, (byte) 0x04, (byte) 0xa2, (byte) 0x7c,
+ (byte) 0xe2, (byte) 0x0b, (byte) 0x44, (byte) 0xf9, (byte) 0x24, (byte) 0x1b, (byte) 0x10,
+ (byte) 0xe5, (byte) 0x93, (byte) 0x84, (byte) 0x50, (byte) 0x94, (byte) 0x4f, (byte) 0xba,
+ (byte) 0x02, (byte) 0x51, (byte) 0x3e, (byte) 0x69, (byte) 0x0c, (byte) 0x45, (byte) 0xf9,
+ (byte) 0x64, (byte) 0x39, (byte) 0x20, (byte) 0xca, (byte) 0x27, (byte) 0x13, (byte) 0x22,
+ (byte) 0x51, (byte) 0x3e, (byte) 0xd9, (byte) 0x11, (byte) 0x8a, (byte) 0xf2, (byte) 0xc9,
+ (byte) 0xa2, (byte) 0x58, (byte) 0x94, (byte) 0x4f, (byte) 0x4e, (byte) 0x05, (byte) 0xa2,
+ (byte) 0x7c, (byte) 0x72, (byte) 0x2c, (byte) 0x12, (byte) 0xe5, (byte) 0x93, (byte) 0x83,
+ (byte) 0xa1, (byte) 0x28, (byte) 0x9f, (byte) 0xfc, (byte) 0x8c, (byte) 0x45, (byte) 0xf9,
+ (byte) 0x14, (byte) 0x6e, (byte) 0x40, (byte) 0x94, (byte) 0x4f, (byte) 0x71, (byte) 0x47,
+ (byte) 0x44, (byte) 0xf9, (byte) 0x14, (byte) 0x80, (byte) 0x48, (byte) 0x94, (byte) 0x4f,
+ (byte) 0x81, (byte) 0xc8, (byte) 0x44, (byte) 0xf9, (byte) 0x14, (byte) 0x8e, (byte) 0x50,
+ (byte) 0x94, (byte) 0x4f, (byte) 0x41, (byte) 0x49, (byte) 0x45, (byte) 0xf9, (byte) 0x14,
+ (byte) 0x9b, (byte) 0x58, (byte) 0x94, (byte) 0x4f, (byte) 0x11, (byte) 0xca, (byte) 0x45,
+ (byte) 0xf9, (byte) 0x94, (byte) 0xa3, (byte) 0x40, (byte) 0x94, (byte) 0x4f, (byte) 0x99,
+ (byte) 0x4a, (byte) 0x44, (byte) 0xf9, (byte) 0x94, (byte) 0xb3, (byte) 0x48, (byte) 0x94,
+ (byte) 0x4f, (byte) 0x59, (byte) 0xcb, (byte) 0x44, (byte) 0xf9, (byte) 0x94, (byte) 0xb8,
+ (byte) 0x50, (byte) 0x94, (byte) 0x4f, (byte) 0x09, (byte) 0x4c, (byte) 0x45, (byte) 0xf9,
+ (byte) 0x94, (byte) 0xcb, (byte) 0x58, (byte) 0x94, (byte) 0x4f, (byte) 0x19, (byte) 0xcd,
+ (byte) 0x45, (byte) 0xf9, (byte) 0x54, (byte) 0xd8, (byte) 0x80, (byte) 0x28, (byte) 0x9f,
+ (byte) 0xca, (byte) 0x9b, (byte) 0x10, (byte) 0xe5, (byte) 0x53, (byte) 0x99, (byte) 0x23,
+ (byte) 0xa2, (byte) 0x7c, (byte) 0xaa, (byte) 0x73, (byte) 0x46, (byte) 0x94, (byte) 0x4f,
+ (byte) 0x25, (byte) 0x0f, (byte) 0x89, (byte) 0xf2, (byte) 0xa9, (byte) 0xf0, (byte) 0x29,
+ (byte) 0x51, (byte) 0x3e, (byte) 0xd5, (byte) 0x40, (byte) 0x26, (byte) 0xca, (byte) 0xa7,
+ (byte) 0x62, (byte) 0xe8, (byte) 0x44, (byte) 0xf9, (byte) 0x54, (byte) 0x0d, (byte) 0xa1,
+ (byte) 0x28, (byte) 0x9f, (byte) 0xca, (byte) 0xa1, (byte) 0x14, (byte) 0xe5, (byte) 0x53,
+ (byte) 0x61, (byte) 0xa4, (byte) 0xa2, (byte) 0x7c, (byte) 0xaa, (byte) 0x8c, (byte) 0x56,
+ (byte) 0x94, (byte) 0x4f, (byte) 0x45, (byte) 0x12, (byte) 0x8b, (byte) 0xf2, (byte) 0xa9,
+ (byte) 0x52, (byte) 0x6a, (byte) 0x51, (byte) 0x3e, (byte) 0x95, (byte) 0x4c, (byte) 0x2e,
+ (byte) 0xca, (byte) 0xa7, (byte) 0xda, (byte) 0xe9, (byte) 0x45, (byte) 0xf9, (byte) 0xd4,
+ (byte) 0x44, (byte) 0x81, (byte) 0x28, (byte) 0x9f, (byte) 0xba, (byte) 0xa8, (byte) 0x10,
+ (byte) 0xe5, (byte) 0x53, (byte) 0x37, (byte) 0x25, (byte) 0xa2, (byte) 0x7c, (byte) 0x6a,
+ (byte) 0xaa, (byte) 0x46, (byte) 0x94, (byte) 0x4f, (byte) 0xad, (byte) 0x15, (byte) 0x89,
+ (byte) 0xf2, (byte) 0xa9, (byte) 0xc5, (byte) 0x2a, (byte) 0x51, (byte) 0x3e, (byte) 0xb5,
+ (byte) 0x5a, (byte) 0x26, (byte) 0xca, (byte) 0xa7, (byte) 0x5e, (byte) 0xeb, (byte) 0x44,
+ (byte) 0xf9, (byte) 0xd4, (byte) 0x6c, (byte) 0xa1, (byte) 0x28, (byte) 0x9f, (byte) 0xba,
+ (byte) 0xad, (byte) 0x14, (byte) 0xe5, (byte) 0x53, (byte) 0xcf, (byte) 0xa5, (byte) 0xa2,
+ (byte) 0x7c, (byte) 0x6a, (byte) 0xbd, (byte) 0x56, (byte) 0x94, (byte) 0x4f, (byte) 0xbd,
+ (byte) 0x17, (byte) 0x8b, (byte) 0xf2, (byte) 0xa9, (byte) 0x09, (byte) 0x6b, (byte) 0x51,
+ (byte) 0x3e, (byte) 0x35, (byte) 0x63, (byte) 0x2e, (byte) 0xca, (byte) 0xa7, (byte) 0xd6,
+ (byte) 0xec, (byte) 0x45, (byte) 0xf9, (byte) 0x34, (byte) 0x9b, (byte) 0x01, (byte) 0x51,
+ (byte) 0x3e, (byte) 0x0d, (byte) 0x67, (byte) 0x41, (byte) 0x94, (byte) 0x4f, (byte) 0x43,
+ (byte) 0x9a, (byte) 0x10, (byte) 0xe5, (byte) 0xd3, (byte) 0xa8, (byte) 0x36, (byte) 0x44,
+ (byte) 0xf9, (byte) 0x34, (byte) 0xb1, (byte) 0x11, (byte) 0x51, (byte) 0x3e, (byte) 0xcd,
+ (byte) 0x6d, (byte) 0x45, (byte) 0x94, (byte) 0x4f, (byte) 0xe3, (byte) 0x9b, (byte) 0x11,
+ (byte) 0xe5, (byte) 0xd3, (byte) 0x14, (byte) 0x77, (byte) 0x44, (byte) 0xf9, (byte) 0x34,
+ (byte) 0xcc, (byte) 0x21, (byte) 0x51, (byte) 0x3e, (byte) 0x8d, (byte) 0x75, (byte) 0x49,
+ (byte) 0x94, (byte) 0x4f, (byte) 0x83, (byte) 0x9e, (byte) 0x12, (byte) 0xe5, (byte) 0xd3,
+ (byte) 0xb8, (byte) 0xb7, (byte) 0x44, (byte) 0xf9, (byte) 0x34, (byte) 0xfa, (byte) 0x31,
+ (byte) 0x51, (byte) 0x3e, (byte) 0x0d, (byte) 0x80, (byte) 0x4d, (byte) 0x94, (byte) 0x4f,
+ (byte) 0x73, (byte) 0xa0, (byte) 0x13, (byte) 0xe5, (byte) 0xd3, (byte) 0x34, (byte) 0xf8,
+ (byte) 0x44, (byte) 0xf9, (byte) 0x34, (byte) 0x13, (byte) 0x42, (byte) 0x51, (byte) 0x3e,
+ (byte) 0x4d, (byte) 0x87, (byte) 0x51, (byte) 0x94, (byte) 0x4f, (byte) 0x53, (byte) 0xa2,
+ (byte) 0x14, (byte) 0xe5, (byte) 0xd3, (byte) 0xb4, (byte) 0x38, (byte) 0x45, (byte) 0xf9,
+ (byte) 0x34, (byte) 0x34, (byte) 0x52, (byte) 0x51, (byte) 0x3e, (byte) 0x0d, (byte) 0x8f,
+ (byte) 0x55, (byte) 0x94, (byte) 0x4f, (byte) 0x23, (byte) 0xa4, (byte) 0x15, (byte) 0xe5,
+ (byte) 0xd3, (byte) 0x24, (byte) 0x79, (byte) 0x45, (byte) 0xf9, (byte) 0x34, (byte) 0x4f,
+ (byte) 0x62, (byte) 0x51, (byte) 0x3e, (byte) 0x8d, (byte) 0x95, (byte) 0x59, (byte) 0x94,
+ (byte) 0x4f, (byte) 0xd3, (byte) 0xa5, (byte) 0x16, (byte) 0xe5, (byte) 0xd3, (byte) 0x98,
+ (byte) 0xb9, (byte) 0x45, (byte) 0xf9, (byte) 0x34, (byte) 0x6e, (byte) 0x72, (byte) 0x51,
+ (byte) 0x3e, (byte) 0xcd, (byte) 0x9d, (byte) 0x5d, (byte) 0x94, (byte) 0x4f, (byte) 0x13,
+ (byte) 0xa8, (byte) 0x17, (byte) 0xe5, (byte) 0xd3, (byte) 0x1c, (byte) 0xfa, (byte) 0x45,
+ (byte) 0xf9, (byte) 0xb4, (byte) 0x90, (byte) 0x02, (byte) 0x51, (byte) 0x3e, (byte) 0xed,
+ (byte) 0xa5, (byte) 0x41, (byte) 0x94, (byte) 0x4f, (byte) 0xeb, (byte) 0xa9, (byte) 0x10,
+ (byte) 0xe5, (byte) 0xd3, (byte) 0x9a, (byte) 0x3a, (byte) 0x44, (byte) 0xf9, (byte) 0xb4,
+ (byte) 0xac, (byte) 0x12, (byte) 0x51, (byte) 0x3e, (byte) 0x6d, (byte) 0xad, (byte) 0x45,
+ (byte) 0x94, (byte) 0x4f, (byte) 0xbb, (byte) 0xab, (byte) 0x11, (byte) 0xe5, (byte) 0xd3,
+ (byte) 0x0a, (byte) 0x7b, (byte) 0x44, (byte) 0xf9, (byte) 0xb4, (byte) 0xc9, (byte) 0x22,
+ (byte) 0x51, (byte) 0x3e, (byte) 0x2d, (byte) 0xb4, (byte) 0x49, (byte) 0x94, (byte) 0x4f,
+ (byte) 0x7b, (byte) 0xad, (byte) 0x12, (byte) 0xe5, (byte) 0xd3, (byte) 0x82, (byte) 0xbb,
+ (byte) 0x44, (byte) 0xf9, (byte) 0xb4, (byte) 0xe7, (byte) 0x32, (byte) 0x51, (byte) 0x3e,
+ (byte) 0xad, (byte) 0xbb, (byte) 0x4d, (byte) 0x94, (byte) 0x4f, (byte) 0x5b, (byte) 0xaf,
+ (byte) 0x13, (byte) 0xe5, (byte) 0xd3, (byte) 0xf6, (byte) 0xfb, (byte) 0x44, (byte) 0xf9,
+ (byte) 0xb4, (byte) 0x05, (byte) 0x43, (byte) 0x51, (byte) 0x3e, (byte) 0xed, (byte) 0xc2,
+ (byte) 0x51, (byte) 0x94, (byte) 0x4f, (byte) 0x1b, (byte) 0xb1, (byte) 0x14, (byte) 0xe5,
+ (byte) 0xd3, (byte) 0x62, (byte) 0x3c, (byte) 0x45, (byte) 0xf9, (byte) 0xb4, (byte) 0x1f,
+ (byte) 0x53, (byte) 0x51, (byte) 0x3e, (byte) 0xad, (byte) 0xc9, (byte) 0x55, (byte) 0x94,
+ (byte) 0x4f, (byte) 0xeb, (byte) 0xb2, (byte) 0x15, (byte) 0xe5, (byte) 0xd3, (byte) 0xda,
+ (byte) 0x7c, (byte) 0x45, (byte) 0xf9, (byte) 0xb4, (byte) 0x3e, (byte) 0x63
+ };
+ checkSynth(
+ /*
+ * // The stream consists of word "time" with all possible transforms.
+ * main_header
+ * metablock_header_easy: 833, 1
+ * command_easy: 4, "|", 2 // = 0 << 10 + 1 + 1
+ * command_easy: 4, "|", 1031 // = 1 << 10 + 1 + 6
+ * command_easy: 4, "|", 2061 // = 2 << 10 + 1 + 12
+ * command_easy: 4, "|", 3092 // = 3 << 10 + 1 + 19
+ * command_easy: 4, "|", 4120 // = 4 << 10 + 1 + 23
+ * command_easy: 4, "|", 5150 // = 5 << 10 + 1 + 29
+ * command_easy: 4, "|", 6184 // = 6 << 10 + 1 + 39
+ * command_easy: 4, "|", 7214 // = 7 << 10 + 1 + 45
+ * command_easy: 4, "|", 8246 // = 8 << 10 + 1 + 53
+ * command_easy: 4, "|", 9279 // = 9 << 10 + 1 + 62
+ * command_easy: 4, "|", 10308 // = 10 << 10 + 1 + 67
+ * command_easy: 4, "|", 11342 // = 11 << 10 + 1 + 77
+ * command_easy: 4, "|", 12369 // = 12 << 10 + 1 + 80
+ * command_easy: 4, "|", 13397 // = 13 << 10 + 1 + 84
+ * command_easy: 4, "|", 14429 // = 14 << 10 + 1 + 92
+ * command_easy: 4, "|", 15460 // = 15 << 10 + 1 + 99
+ * command_easy: 4, "|", 16491 // = 16 << 10 + 1 + 106
+ * command_easy: 4, "|", 17524 // = 17 << 10 + 1 + 115
+ * command_easy: 4, "|", 18557 // = 18 << 10 + 1 + 124
+ * command_easy: 4, "|", 19589 // = 19 << 10 + 1 + 132
+ * command_easy: 4, "|", 20619 // = 20 << 10 + 1 + 138
+ * command_easy: 4, "|", 21649 // = 21 << 10 + 1 + 144
+ * command_easy: 4, "|", 22680 // = 22 << 10 + 1 + 151
+ * command_easy: 4, "|", 23710 // = 23 << 10 + 1 + 157
+ * command_easy: 4, "|", 24736 // = 24 << 10 + 1 + 159
+ * command_easy: 4, "|", 25766 // = 25 << 10 + 1 + 165
+ * command_easy: 4, "|", 26800 // = 26 << 10 + 1 + 175
+ * command_easy: 4, "|", 27826 // = 27 << 10 + 1 + 177
+ * command_easy: 4, "|", 28853 // = 28 << 10 + 1 + 180
+ * command_easy: 4, "|", 29885 // = 29 << 10 + 1 + 188
+ * command_easy: 4, "|", 30920 // = 30 << 10 + 1 + 199
+ * command_easy: 4, "|", 31950 // = 31 << 10 + 1 + 205
+ * command_easy: 4, "|", 32981 // = 32 << 10 + 1 + 212
+ * command_easy: 4, "|", 34011 // = 33 << 10 + 1 + 218
+ * command_easy: 4, "|", 35043 // = 34 << 10 + 1 + 226
+ * command_easy: 4, "|", 36068 // = 35 << 10 + 1 + 227
+ * command_easy: 4, "|", 37103 // = 36 << 10 + 1 + 238
+ * command_easy: 4, "|", 38133 // = 37 << 10 + 1 + 244
+ * command_easy: 4, "|", 39168 // = 38 << 10 + 1 + 255
+ * command_easy: 4, "|", 40201 // = 39 << 10 + 1 + 264
+ * command_easy: 4, "|", 41226 // = 40 << 10 + 1 + 265
+ * command_easy: 4, "|", 42251 // = 41 << 10 + 1 + 266
+ * command_easy: 4, "|", 43285 // = 42 << 10 + 1 + 276
+ * command_easy: 4, "|", 44310 // = 43 << 10 + 1 + 277
+ * command_easy: 4, "|", 45345 // = 44 << 10 + 1 + 288
+ * command_easy: 4, "|", 46374 // = 45 << 10 + 1 + 293
+ * command_easy: 4, "|", 47407 // = 46 << 10 + 1 + 302
+ * command_easy: 4, "|", 48440 // = 47 << 10 + 1 + 311
+ * command_easy: 4, "|", 49473 // = 48 << 10 + 1 + 320
+ * command_easy: 4, "|", 50498 // = 49 << 10 + 1 + 321
+ * command_easy: 4, "|", 51530 // = 50 << 10 + 1 + 329
+ * command_easy: 4, "|", 52561 // = 51 << 10 + 1 + 336
+ * command_easy: 4, "|", 53591 // = 52 << 10 + 1 + 342
+ * command_easy: 4, "|", 54623 // = 53 << 10 + 1 + 350
+ * command_easy: 4, "|", 55655 // = 54 << 10 + 1 + 358
+ * command_easy: 4, "|", 56680 // = 55 << 10 + 1 + 359
+ * command_easy: 4, "|", 57705 // = 56 << 10 + 1 + 360
+ * command_easy: 4, "|", 58730 // = 57 << 10 + 1 + 361
+ * command_easy: 4, "|", 59760 // = 58 << 10 + 1 + 367
+ * command_easy: 4, "|", 60791 // = 59 << 10 + 1 + 374
+ * command_easy: 4, "|", 61816 // = 60 << 10 + 1 + 375
+ * command_easy: 4, "|", 62849 // = 61 << 10 + 1 + 384
+ * command_easy: 4, "|", 63881 // = 62 << 10 + 1 + 392
+ * command_easy: 4, "|", 64919 // = 63 << 10 + 1 + 406
+ * command_easy: 4, "|", 65944 // = 64 << 10 + 1 + 407
+ * command_easy: 4, "|", 66969 // = 65 << 10 + 1 + 408
+ * command_easy: 4, "|", 68001 // = 66 << 10 + 1 + 416
+ * command_easy: 4, "|", 69031 // = 67 << 10 + 1 + 422
+ * command_easy: 4, "|", 70062 // = 68 << 10 + 1 + 429
+ * command_easy: 4, "|", 71092 // = 69 << 10 + 1 + 435
+ * command_easy: 4, "|", 72123 // = 70 << 10 + 1 + 442
+ * command_easy: 4, "|", 73154 // = 71 << 10 + 1 + 449
+ * command_easy: 4, "|", 74185 // = 72 << 10 + 1 + 456
+ * command_easy: 4, "|", 75219 // = 73 << 10 + 1 + 466
+ * command_easy: 4, "|", 76261 // = 74 << 10 + 1 + 484
+ * command_easy: 4, "|", 77291 // = 75 << 10 + 1 + 490
+ * command_easy: 4, "|", 78327 // = 76 << 10 + 1 + 502
+ * command_easy: 4, "|", 79357 // = 77 << 10 + 1 + 508
+ * command_easy: 4, "|", 80388 // = 78 << 10 + 1 + 515
+ * command_easy: 4, "|", 81418 // = 79 << 10 + 1 + 521
+ * command_easy: 4, "|", 82448 // = 80 << 10 + 1 + 527
+ * command_easy: 4, "|", 83482 // = 81 << 10 + 1 + 537
+ * command_easy: 4, "|", 84514 // = 82 << 10 + 1 + 545
+ * command_easy: 4, "|", 85546 // = 83 << 10 + 1 + 553
+ * command_easy: 4, "|", 86577 // = 84 << 10 + 1 + 560
+ * command_easy: 4, "|", 87609 // = 85 << 10 + 1 + 568
+ * command_easy: 4, "|", 88639 // = 86 << 10 + 1 + 574
+ * command_easy: 4, "|", 89670 // = 87 << 10 + 1 + 581
+ * command_easy: 4, "|", 90700 // = 88 << 10 + 1 + 587
+ * command_easy: 4, "|", 91731 // = 89 << 10 + 1 + 594
+ * command_easy: 4, "|", 92762 // = 90 << 10 + 1 + 601
+ * command_easy: 4, "|", 93795 // = 91 << 10 + 1 + 610
+ * command_easy: 4, "|", 94827 // = 92 << 10 + 1 + 618
+ * command_easy: 4, "|", 95860 // = 93 << 10 + 1 + 627
+ * command_easy: 4, "|", 96894 // = 94 << 10 + 1 + 637
+ * command_easy: 4, "|", 97924 // = 95 << 10 + 1 + 643
+ * command_easy: 4, "|", 98957 // = 96 << 10 + 1 + 652
+ * command_easy: 4, "|", 99988 // = 97 << 10 + 1 + 659
+ * command_easy: 4, "|", 101019 // = 98 << 10 + 1 + 666
+ * command_easy: 4, "|", 102051 // = 99 << 10 + 1 + 674
+ * command_easy: 4, "|", 103081 // = 100 << 10 + 1 + 680
+ * command_easy: 4, "|", 104114 // = 101 << 10 + 1 + 689
+ * command_easy: 4, "|", 105144 // = 102 << 10 + 1 + 695
+ * command_easy: 4, "|", 106175 // = 103 << 10 + 1 + 702
+ * command_easy: 4, "|", 107206 // = 104 << 10 + 1 + 709
+ * command_easy: 4, "|", 108237 // = 105 << 10 + 1 + 716
+ * command_easy: 4, "|", 109268 // = 106 << 10 + 1 + 723
+ * command_easy: 4, "|", 110301 // = 107 << 10 + 1 + 732
+ * command_easy: 4, "|", 111332 // = 108 << 10 + 1 + 739
+ * command_easy: 4, "|", 112363 // = 109 << 10 + 1 + 746
+ * command_easy: 4, "|", 113394 // = 110 << 10 + 1 + 753
+ * command_easy: 4, "|", 114426 // = 111 << 10 + 1 + 761
+ * command_easy: 4, "|", 115458 // = 112 << 10 + 1 + 769
+ * command_easy: 4, "|", 116488 // = 113 << 10 + 1 + 775
+ * command_easy: 4, "|", 117518 // = 114 << 10 + 1 + 781
+ * command_easy: 4, "|", 118549 // = 115 << 10 + 1 + 788
+ * command_easy: 4, "|", 119580 // = 116 << 10 + 1 + 795
+ * command_easy: 4, "|", 120611 // = 117 << 10 + 1 + 802
+ * command_easy: 4, "|", 121643 // = 118 << 10 + 1 + 810
+ * command_easy: 4, "|", 122675 // = 119 << 10 + 1 + 818
+ * command_easy: 4, "|", 123707 // = 120 << 10 + 1 + 826
+ */
+ compressed,
+ true,
+ "|time|time | time |ime|Time |time the | time|s time |time of |Time|time and |me|tim|, time |"
+ + "time, | Time |time in |time to |e time |time\"|time.|time\">|time\n|t|time]|time for |e|ti"
+ + "|time a |time that | Time|time. |.time| time, ||time with |time'|time from |time by ||| th"
+ + "e time||time. The |TIME|time on |time as |time is ||timing |time\n\t|time:| time. |timeed "
+ + "||||time(|Time, ||time at |timely | the time of ||| Time, |Time\"|.time(|TIME |Time\">|tim"
+ + "e=\"| time.|.com/time| the time of the |Time'|time. This |time,|.time |Time(|Time.|time no"
+ + "t | time=\"|timeer | TIME |timeal | TIME|time='|TIME\"|Time. | time(|timeful | Time. |time"
+ + "ive |timeless |TIME'|timeest | Time.|TIME\">| time='|Time,|timeize |TIME.|\302\240time| ti"
+ + "me,|Time=\"|TIME=\"|timeous |TIME, |Time='| Time,| TIME=\"| TIME, |TIME,|TIME(|TIME. | TIM"
+ + "E.|TIME='| TIME. | Time=\"| TIME='| Time='"
+ );
+ }
+
+ @Test
+ public void testBaseDictWord() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x41, (byte) 0x02
+ };
+ checkSynth(
+ /*
+ * // The stream consists of a base dictionary word.
+ * main_header
+ * metablock_header_easy: 4, 1
+ * command_inscopy_easy: 0, 4
+ * command_dist_easy: 1
+ */
+ compressed,
+ true,
+ "time"
+ );
+ }
+
+ @Test
+ public void testBaseDictWordFinishBlockOnRingbufferWrap() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x1f, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x9b, (byte) 0x58, (byte) 0x32, (byte) 0x34, (byte) 0x34, (byte) 0x34, (byte) 0x34,
+ (byte) 0x34, (byte) 0x34, (byte) 0x34, (byte) 0x34, (byte) 0x34, (byte) 0x34, (byte) 0x34,
+ (byte) 0x34, (byte) 0x34, (byte) 0x34, (byte) 0x34, (byte) 0x34, (byte) 0x34, (byte) 0x34,
+ (byte) 0x34, (byte) 0x34, (byte) 0x34, (byte) 0x34, (byte) 0x34, (byte) 0x34, (byte) 0x34,
+ (byte) 0x34, (byte) 0x34, (byte) 0xd4, (byte) 0x00
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_easy: 32, 1 // 32 = minimal ringbuffer size
+ * command_easy: 4, "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", 29
+ */
+ compressed,
+ true,
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaatime"
+ );
+ }
+
+ @Test
+ public void testBaseDictWordTooLong() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x41, (byte) 0x02
+ };
+ checkSynth(
+ /*
+ * // Has an unmodified dictionary word that goes over the end of the
+ * // meta-block. Same as BaseDictWord, but with a shorter meta-block length.
+ * main_header
+ * metablock_header_easy: 1, 1
+ * command_inscopy_easy: 0, 4
+ * command_dist_easy: 1
+ */
+ compressed,
+ false,
+ ""
+ );
+ }
+
+ @Test
+ public void testBlockCountMessage() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x0b, (byte) 0x00, (byte) 0x11, (byte) 0x01, (byte) 0x8c, (byte) 0xc1,
+ (byte) 0xc5, (byte) 0x0d, (byte) 0x08, (byte) 0x00, (byte) 0x22, (byte) 0x65, (byte) 0xe1,
+ (byte) 0xfc, (byte) 0xfd, (byte) 0x22, (byte) 0x2c, (byte) 0xc4, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0xd8, (byte) 0x32, (byte) 0x89, (byte) 0x01, (byte) 0x12, (byte) 0x00,
+ (byte) 0x00, (byte) 0x77, (byte) 0xda, (byte) 0x04, (byte) 0x10, (byte) 0x42, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00
+ };
+ checkSynth(
+ /*
+ * // Same as BlockSwitchMessage but also uses 0-bit block-type commands.
+ * main_header
+ * metablock_header_begin: 1, 0, 12, 0
+ * // two literal block types
+ * vlq_blocktypes: 2
+ * huffman_simple: 1,1,4, 1 // literal blocktype prefix code
+ * huffman_fixed: 26 // literal blockcount prefix code
+ * blockcount_easy: 2 // 2 a's
+ * // one ins/copy and dist block type
+ * vlq_blocktypes: 1
+ * vlq_blocktypes: 1
+ * ndirect: 0, 0
+ * // two MSB6 literal context modes
+ * bits: "00", "00"
+ * // two literal prefix codes
+ * vlq_blocktypes: 2
+ * // literal context map
+ * vlq_rlemax: 5
+ * huffman_simple: 0,3,7, 5,0,6 // context map RLE Huffman code
+ * // context map RLE: repeat 0 64 times, 1+5 64 times
+ * bits: "01", "0", "11111", "11", "0", "11111"
+ * bit: 1 // MTF enabled
+ * // one distance prefix code
+ * vlq_blocktypes: 1
+ * huffman_simple: 0,1,256, 97 // only a's
+ * huffman_simple: 0,1,256, 98 // only b's
+ * huffman_fixed: 704
+ * huffman_fixed: 64
+ * // now comes the data
+ * command_inscopy_easy: 12, 0
+ * blockcount_easy: 2 // switch to other block type; 2 b's
+ * blockcount_easy: 5 // switch to other block type; 5 a's
+ * blockcount_easy: 1 // switch to other block type; 1 b
+ * blockcount_easy: 1 // switch to other block type; 1 a
+ * blockcount_easy: 1 // switch to other block type; 1 b
+ */
+ compressed,
+ true,
+ "aabbaaaaabab"
+ );
+ }
+
+ @Test
+ public void testBlockSwitchMessage() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x0b, (byte) 0x00, (byte) 0xd1, (byte) 0xe1, (byte) 0x01, (byte) 0xc6,
+ (byte) 0xe0, (byte) 0xe2, (byte) 0x06, (byte) 0x04, (byte) 0x00, (byte) 0x91, (byte) 0xb2,
+ (byte) 0x70, (byte) 0xfe, (byte) 0x7e, (byte) 0x11, (byte) 0x16, (byte) 0x62, (byte) 0x00,
+ (byte) 0x00, (byte) 0x1c, (byte) 0x6c, (byte) 0x99, (byte) 0xc4, (byte) 0x00, (byte) 0x09,
+ (byte) 0x00, (byte) 0x80, (byte) 0x3b, (byte) 0x6d, (byte) 0x02, (byte) 0x08, (byte) 0x82,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00
+ };
+ checkSynth(
+ /*
+ * // Uses blocks with 1-symbol Huffman codes that take 0 bits, so that it
+ * // is the block-switch commands that encode the message rather than actual
+ * // literals.
+ * main_header
+ * metablock_header_begin: 1, 0, 12, 0
+ * // two literal block types
+ * vlq_blocktypes: 2
+ * huffman_simple: 1,4,4, 1,0,2,3 // literal blocktype prefix code
+ * huffman_fixed: 26 // literal blockcount prefix code
+ * blockcount_easy: 2 // 2 a's
+ * // one ins/copy and dist block type
+ * vlq_blocktypes: 1
+ * vlq_blocktypes: 1
+ * ndirect: 0, 0
+ * // two MSB6 literal context modes
+ * bits: "00", "00"
+ * // two literal prefix codes
+ * vlq_blocktypes: 2
+ * // literal context map
+ * vlq_rlemax: 5
+ * huffman_simple: 0,3,7, 5,0,6 // context map RLE Huffman code
+ * // context map RLE: repeat 0 64 times, 1+5 64 times
+ * bits: "01", "0", "11111", "11", "0", "11111"
+ * bit: 1 // MTF enabled
+ * // one distance prefix code
+ * vlq_blocktypes: 1
+ * huffman_simple: 0,1,256, 97 // only a's
+ * huffman_simple: 0,1,256, 98 // only b's
+ * huffman_fixed: 704
+ * huffman_fixed: 64
+ * // now comes the data
+ * command_inscopy_easy: 12, 0
+ * bits: "0"; blockcount_easy: 2 // switch to other block type; 2 b's
+ * bits: "0"; blockcount_easy: 5 // switch to other block type; 5 a's
+ * bits: "0"; blockcount_easy: 1 // switch to other block type; 1 b
+ * bits: "0"; blockcount_easy: 1 // switch to other block type; 1 a
+ * bits: "0"; blockcount_easy: 1 // switch to other block type; 1 b
+ */
+ compressed,
+ true,
+ "aabbaaaaabab"
+ );
+ }
+
+ @Test
+ public void testClClTreeDeficiency() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x80,
+ (byte) 0x43, (byte) 0x01, (byte) 0xe0, (byte) 0x05, (byte) 0x88, (byte) 0x55, (byte) 0x90,
+ (byte) 0x01, (byte) 0x00, (byte) 0x38, (byte) 0xd8, (byte) 0x32, (byte) 0x89, (byte) 0x01,
+ (byte) 0x12, (byte) 0x00, (byte) 0x00, (byte) 0x77, (byte) 0xda, (byte) 0x28, (byte) 0x40,
+ (byte) 0x23
+ };
+ checkSynth(
+ /*
+ * // This test is a copy of TooManySymbolsRepeated, with changed clcl table.
+ * main_header
+ * metablock_header_begin: 1, 0, 4, 0
+ * metablock_header_trivial_context
+ * hskip: 0
+ * clcl_ordered: 0,3,0,0,0,0,0,0,3,3,0,0,0,0,0,0,1,0
+ * set_prefix_cl_rle: "", "110", "", "", "", "", "", "", "111", "101",\
+ * "", "", "", "", "", "", "0", ""
+ * cl_rle: 8
+ * cl_rle_rep: 9, 96
+ * cl_rle: 1
+ * cl_rle_rep: 9, 159 // 1 + 96 + 1 + 159 = 257 > 256 = alphabet size
+ * huffman_fixed: 704
+ * huffman_fixed: 64
+ * command_inscopy_easy: 4, 0
+ * command_literal_bits: 0, 0, 0, 101100010
+ */
+ compressed,
+ false,
+ "aaab"
+ );
+ }
+
+ @Test
+ public void testClClTreeExcess() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x80,
+ (byte) 0xc3, (byte) 0x7b, (byte) 0x80, (byte) 0x58, (byte) 0x41, (byte) 0x06, (byte) 0x00,
+ (byte) 0xe0, (byte) 0x60, (byte) 0xcb, (byte) 0x24, (byte) 0x06, (byte) 0x48, (byte) 0x00,
+ (byte) 0x00, (byte) 0xdc, (byte) 0x69, (byte) 0xa3, (byte) 0x00, (byte) 0x8d, (byte) 0x00
+ };
+ checkSynth(
+ /*
+ * // This test is a copy of ClClTreeDeficiency, with changed clcl table.
+ * main_header
+ * metablock_header_begin: 1, 0, 4, 0
+ * metablock_header_trivial_context
+ * hskip: 0
+ * clcl_ordered: 0,3,0,0,0,0,0,0,3,1,0,0,0,0,0,0,1,0
+ * set_prefix_cl_rle: "", "110", "", "", "", "", "", "", "111", "1",\
+ * "", "", "", "", "", "", "0", ""
+ * cl_rle: 8
+ * cl_rle_rep: 9, 96
+ * cl_rle: 1
+ * cl_rle_rep: 9, 159 // 1 + 96 + 1 + 159 = 257 > 256 = alphabet size
+ * huffman_fixed: 704
+ * huffman_fixed: 64
+ * command_inscopy_easy: 4, 0
+ * command_literal_bits: 0, 0, 0, 101100010
+ */
+ compressed,
+ false,
+ "aaab"
+ );
+ }
+
+ @Test
+ public void testComplexHuffmanCodeTwoSymbols() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x03, (byte) 0xe0,
+ (byte) 0xa2, (byte) 0x1a, (byte) 0x00, (byte) 0x00, (byte) 0x0e, (byte) 0xb6, (byte) 0x4c,
+ (byte) 0x62, (byte) 0x80, (byte) 0x04, (byte) 0x00, (byte) 0xc0, (byte) 0x9d, (byte) 0x36,
+ (byte) 0x12, (byte) 0x04
+ };
+ checkSynth(
+ /*
+ * // This tests a complex Huffman code with only two symbols followed by a
+ * // tiny amount of content.
+ * main_header
+ * metablock_header_begin: 1, 0, 2, 0
+ * metablock_header_trivial_context
+ * // begin of literal Huffman tree. The tree has symbol length 1 for "a",
+ * // symbol length 1 for "b" and symbol length 0 for all others.
+ * hskip: 0
+ * clcl_ordered: 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
+ * set_prefix_cl_rle: "", "0", "", "", "", "", "", "", "", "",\
+ * "", "", "", "", "", "", "", "1"
+ * cl_rle_rep_0: 97
+ * cl_rle: 1 // literal number 97, that is, the letter 'a'
+ * cl_rle: 1 // literal number 98, that is, the letter 'b'
+ * // end of literal Huffman tree
+ * huffman_fixed: 704
+ * huffman_fixed: 64
+ * command_inscopy_easy: 2, 0
+ * command_literal_bits: 0, 1 // a followed by b
+ */
+ compressed,
+ true,
+ "ab"
+ );
+ }
+
+ @Test
+ public void testCompressedUncompressedShortCompressed() {
+ byte[] compressed = {
+ (byte) 0x8b, (byte) 0xfe, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x9b, (byte) 0x66, (byte) 0x6f, (byte) 0x1b, (byte) 0x0a, (byte) 0x50, (byte) 0x00,
+ (byte) 0x10, (byte) 0x62, (byte) 0x62, (byte) 0x62, (byte) 0x62, (byte) 0x62, (byte) 0x62,
+ (byte) 0x31, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x24, (byte) 0x00
+ };
+ checkSynth(
+ /*
+ * main_header: 22
+ * metablock_header_easy: 1022, 0
+ * command_easy: 1021, "a", 1 // 1022 x "a"
+ * metablock_uncompressed: "bbbbbb"
+ * metablock_header_easy: 4, 1
+ * command_easy: 4, "", 1 // 6 + 4 = 10 x "b"
+ */
+ compressed,
+ true,
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbb"
+ );
+ }
+
+ @Test
+ public void testCompressedUncompressedShortCompressedSmallWindow() {
+ byte[] compressed = {
+ (byte) 0x21, (byte) 0xf4, (byte) 0x0f, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x1c, (byte) 0xa7, (byte) 0x6d, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0xd8,
+ (byte) 0x32, (byte) 0x89, (byte) 0x01, (byte) 0x12, (byte) 0x00, (byte) 0x00, (byte) 0x77,
+ (byte) 0xda, (byte) 0x34, (byte) 0x7b, (byte) 0xdb, (byte) 0x50, (byte) 0x80, (byte) 0x02,
+ (byte) 0x80, (byte) 0x62, (byte) 0x62, (byte) 0x62, (byte) 0x62, (byte) 0x62, (byte) 0x62,
+ (byte) 0x31, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x24, (byte) 0x00
+ };
+ checkSynth(
+ /*
+ * main_header: 10
+ * metablock_header_easy: 1022, 0
+ * command_easy: 1021, "a", 1 // 1022 x "a"
+ * metablock_uncompressed: "bbbbbb"
+ * metablock_header_easy: 4, 1
+ * command_easy: 4, "", 1 // 6 + 4 = 10 x "b"
+ */
+ compressed,
+ true,
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbb"
+ );
+ }
+
+ @Test
+ public void testCopyLengthTooLong() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x11, (byte) 0x86, (byte) 0x02
+ };
+ checkSynth(
+ /*
+ * // Has a copy length that goes over the end of the meta-block.
+ * // Same as OneCommand, but with a shorter meta-block length.
+ * main_header
+ * metablock_header_easy: 2, 1
+ * command_easy: 2, "a", 1
+ */
+ compressed,
+ false,
+ ""
+ );
+ }
+
+ @Test
+ public void testCopyTooLong() {
+ byte[] compressed = {
+ (byte) 0xa1, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x1c, (byte) 0xa7, (byte) 0x6d, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0xd8,
+ (byte) 0x32, (byte) 0x89, (byte) 0x01, (byte) 0x12, (byte) 0x00, (byte) 0x00, (byte) 0x77,
+ (byte) 0xda, (byte) 0x34, (byte) 0xab, (byte) 0xdb, (byte) 0x50, (byte) 0x00
+ };
+ checkSynth(
+ /*
+ * // Has a copy length that goes over the end of the meta-block,
+ * // with a ringbuffer wrap.
+ * main_header: 10
+ * metablock_header_easy: 2, 1
+ * command_easy: 1024, "a", 1
+ */
+ compressed,
+ false,
+ ""
+ );
+ }
+
+ @Test
+ public void testCustomHuffmanCode() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x80,
+ (byte) 0xc3, (byte) 0x3d, (byte) 0x80, (byte) 0x58, (byte) 0x82, (byte) 0x08, (byte) 0x00,
+ (byte) 0xc0, (byte) 0xc1, (byte) 0x96, (byte) 0x49, (byte) 0x0c, (byte) 0x90, (byte) 0x00,
+ (byte) 0x00, (byte) 0xb8, (byte) 0xd3, (byte) 0x46, (byte) 0x01, (byte) 0x1a, (byte) 0x01
+ };
+ checkSynth(
+ /*
+ * // This tests a small hand crafted Huffman code followed by a tiny amount
+ * // of content. This tests if the bit reader detects the end correctly even
+ * // with tiny content after a larger Huffman tree encoding.
+ * main_header
+ * metablock_header_begin: 1, 0, 4, 0
+ * metablock_header_trivial_context
+ * // begin of literal Huffman tree. The tree has symbol length 1 for "a",
+ * // symbol length 8 for null, symbol length 9 for all others. The length 1
+ * // for a is chosen on purpose here, the others must be like that to
+ * // fulfill the requirement that sum of 32>>length is 32768.
+ * hskip: 0
+ * clcl_ordered: 0,3,0,0,0,0,0,0,3,2,0,0,0,0,0,0,1,0
+ * set_prefix_cl_rle: "", "110", "", "", "", "", "", "", "111", "10",\
+ * "", "", "", "", "", "", "0", ""
+ * cl_rle: 8
+ * cl_rle_rep: 9, 96
+ * cl_rle: 1 // literal number 97, that is, the letter 'a'
+ * cl_rle_rep: 9, 158
+ * // end of literal Huffman tree
+ * huffman_fixed: 704
+ * huffman_fixed: 64
+ * command_inscopy_easy: 4, 0
+ * // Here is how the code "101100010" for b is derived: remember that a has
+ * // symbol length 1, null has symbol length 8, the rest 9. So in the
+ * // canonical Huffman code, the code for "a" is "0", for null is
+ * // "10000000". The next value has "100000010" (cfr. the rules of canonical
+ * // prefix code). Counting upwards +95 from there, the value "@" (ASCII 96,
+ * // before "a") has "101100001", and so b, the next 9-bit symbol, has the
+ * // next binary value "101100010".
+ * command_literal_bits: 0, 0, 0, 101100010 // 3 a's followed by a b
+ */
+ compressed,
+ true,
+ "aaab"
+ );
+ }
+
+ @Test
+ public void testDistanceLut() {
+ byte[] compressed = {
+ (byte) 0x8b, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x99, (byte) 0x86, (byte) 0x46, (byte) 0xc6, (byte) 0x22, (byte) 0x14,
+ (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x1c, (byte) 0xa7,
+ (byte) 0x6d, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0xd8, (byte) 0x32, (byte) 0x89,
+ (byte) 0x01, (byte) 0x12, (byte) 0x21, (byte) 0x91, (byte) 0x69, (byte) 0x62, (byte) 0x6a,
+ (byte) 0x36
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_easy: 6, 0 // implicit ndirect: 0, 0
+ * command_easy: 3, "abc", 3 // Insert "abc", copy "abc"
+ * metablock_header_begin: 0, 0, 6, 0
+ * vlq_blocktypes: 1 // num litetal block types
+ * vlq_blocktypes: 1 // num command block types
+ * vlq_blocktypes: 1 // num distance block types
+ * ndirect: 3, 0
+ * bits: "00" // literal context modes
+ * vlq_blocktypes: 1 // num literal Huffman trees
+ * // command has no context -> num trees == num block types
+ * vlq_blocktypes: 1 // num distance Huffman trees
+ * huffman_fixed: 256
+ * huffman_fixed: 704
+ * huffman_simple: 0,1,67, 18
+ * command_inscopy_easy: 3, 3 // Insert 3, copy 3
+ * command_literals_easy: "def"
+ * // 0-bit Huffman code : dcode = 18 -> third direct distance
+ * metablock_lastempty // make sure that no extra distance bits are read
+ */
+ compressed,
+ true,
+ "abcabcdefdef"
+ );
+ }
+
+ @Test
+ public void testEmpty() {
+ byte[] compressed = {
+ (byte) 0x3b
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_lastempty
+ */
+ compressed,
+ true,
+ ""
+ );
+ }
+
+ @Test
+ public void testHelloWorld() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x0a, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x9b, (byte) 0x00, (byte) 0x59, (byte) 0x98, (byte) 0xda, (byte) 0xd8, (byte) 0xd8,
+ (byte) 0x13, (byte) 0xb8, (byte) 0xdb, (byte) 0x3b, (byte) 0xd9, (byte) 0x98, (byte) 0x00
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_fixed: "hello world", 1
+ */
+ compressed,
+ true,
+ "hello world"
+ );
+ }
+
+ @Test
+ public void testInsertTooLong() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x09, (byte) 0x86, (byte) 0x46
+ };
+ checkSynth(
+ /*
+ * // Has an insert length that goes over the end of the meta-block.
+ * // Same as OneInsert, but with a shorter meta-block length.
+ * main_header
+ * metablock_header_easy: 1, 1
+ * command_easy: 0, "ab"
+ */
+ compressed,
+ false,
+ ""
+ );
+ }
+
+ @Test
+ public void testIntactDistanceRingBuffer0() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x0a, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0xa1, (byte) 0x80, (byte) 0x20, (byte) 0x00
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_easy: 11, 1
+ * command_inscopy_easy: 0, 7 // "himself" from dictionary
+ * bits: "000000" // distance = 4 from RB; RB remains intact
+ * command_inscopy_easy: 0, 4 // copy "self"
+ * bits: "000000" // distance = 4 from RB; RB remains intact
+ */
+ compressed,
+ true,
+ "himselfself"
+ );
+ }
+
+ @Test
+ public void testIntactDistanceRingBuffer1() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x09, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x21, (byte) 0xa0, (byte) 0x20, (byte) 0x00
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_easy: 10, 1
+ * command_inscopy_easy: 0, 6 // "scroll" from dictionary
+ * bits: "100000" // distance = 11 from RB; RB remains intact
+ * command_inscopy_easy: 0, 4 // copy "roll"
+ * bits: "000000" // distance = 4 from RB; RB remains intact
+ */
+ compressed,
+ true,
+ "scrollroll"
+ );
+ }
+
+ @Test
+ public void testIntactDistanceRingBuffer2() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x0f, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x41, (byte) 0x80, (byte) 0x20, (byte) 0x50, (byte) 0x10, (byte) 0x24,
+ (byte) 0x08, (byte) 0x06
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_easy: 16, 1
+ * command_inscopy_easy: 0, 4 // "left" from dictionary (index = 3 = 4 - 1)
+ * bits: "000000" // distance = 4 from RB; RB remains intact
+ * command_inscopy_easy: 0, 4 // "data" from dictionary (index = 6 = 11 - 5)
+ * bits: "100000" // distance = 11 from RB; RB remains intact
+ * command_inscopy_easy: 0, 4 // "data" from dictionary (index = 6 = 15 - 9)
+ * bits: "010000" // distance = 15 from RB; RB remains intact
+ * command_inscopy_easy: 0, 4 // "left" from dictionary (index = 3 = 16 - 13)
+ * bits: "110000" // distance = 16 from RB; RB remains intact
+ */
+ compressed,
+ true,
+ "leftdatadataleft"
+ );
+ }
+
+ @Test
+ public void testIntactDistanceRingBufferNoDistanceValue0() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x17, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x40, (byte) 0x82, (byte) 0x40, (byte) 0x41, (byte) 0x90, (byte) 0x20,
+ (byte) 0x58, (byte) 0x18, (byte) 0x00
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_easy: 24, 1
+ * // cmd is {ins_extra, copy_extra, distance_code, ctx, ins_off, copy_off}
+ * // cmd.2 = {0x00, 0x00, 0, 0x02, 0x0000, 0x0004}
+ * // cmd.2 = no insert, copy length = 4, distance_code = 0 (last distance)
+ * command_short: 2 // "left" from dictionary (index = 3 = 4 - 1)
+ * // Check that RB is untouched after the first command...
+ * command_inscopy_easy: 0, 4 // "data" from dictionary (index = 6 = 11 - 5)
+ * bits: "100000" // distance = 11 from RB; RB remains intact
+ * command_inscopy_easy: 0, 4 // "data" from dictionary (index = 6 = 15 - 9)
+ * bits: "010000" // distance = 15 from RB; RB remains intact
+ * command_inscopy_easy: 0, 4 // "left" from dictionary (index = 3 = 16 - 13)
+ * bits: "110000" // distance = 16 from RB; RB remains intact
+ * command_inscopy_easy: 0, 8 // copy "leftleft"
+ * bits: "000000" // distance = 4 from RB; RB remains intact
+ */
+ compressed,
+ true,
+ "leftdatadataleftleftleft"
+ );
+ }
+
+ @Test
+ public void testIntactDistanceRingBufferNoDistanceValue1() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x19, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0xc0, (byte) 0x82, (byte) 0x41, (byte) 0x41, (byte) 0x90, (byte) 0x20,
+ (byte) 0x58, (byte) 0x18, (byte) 0x00
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_easy: 26, 1
+ * // cmd is {ins_extra, copy_extra, distance_code, ctx, ins_off, copy_off}
+ * // cmd.3 = {0x00, 0x00, 0, 0x03, 0x0000, 0x0005}
+ * // cmd.3 = no insert, copy length = 5, distance_code = 0 (last distance)
+ * command_short: 3 // "world" from dictionary (index = 3 = 4 - 1)
+ * // Check that RB is untouched after the first command...
+ * command_inscopy_easy: 0, 5 // "white" from dictionary (index = 5 = 11 - 6)
+ * bits: "100000" // distance = 11 from RB; RB remains intact
+ * command_inscopy_easy: 0, 4 // "back" from dictionary (index = 4 = 15 - 11)
+ * bits: "010000" // distance = 15 from RB; RB remains intact
+ * command_inscopy_easy: 0, 4 // "down" from dictionary (index = 1 = 16 - 15)
+ * bits: "110000" // distance = 16 from RB; RB remains intact
+ * command_inscopy_easy: 0, 8 // copy "downdown"
+ * bits: "000000" // distance = 4 from RB; RB remains intact
+ */
+ compressed,
+ true,
+ "worldwhitebackdowndowndown"
+ );
+ }
+
+ @Test
+ public void testInvalidNoLastMetablock() {
+ byte[] compressed = {
+ (byte) 0x0b, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x9b, (byte) 0x00, (byte) 0x13, (byte) 0x59, (byte) 0x98, (byte) 0xda, (byte) 0xd8,
+ (byte) 0xd8, (byte) 0x13, (byte) 0xb8, (byte) 0xdb, (byte) 0x3b, (byte) 0xd9, (byte) 0x98,
+ (byte) 0xe8, (byte) 0x00
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_fixed: \"hello world\", 0
+ */
+ compressed,
+ false,
+ "hello world"
+ );
+ }
+
+ @Test
+ public void testInvalidNoMetaBlocks() {
+ byte[] compressed = {
+ (byte) 0x0b
+ };
+ checkSynth(
+ /*
+ * main_header
+ */
+ compressed,
+ false,
+ ""
+ );
+ }
+
+ @Test
+ public void testInvalidTooFarDist() {
+ byte[] compressed = {
+ (byte) 0xa1, (byte) 0x48, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x1c, (byte) 0xa7, (byte) 0x6d, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0xd8,
+ (byte) 0x32, (byte) 0x89, (byte) 0x01, (byte) 0x12, (byte) 0x00, (byte) 0x00, (byte) 0x77,
+ (byte) 0xda, (byte) 0xe8, (byte) 0xe0, (byte) 0x62, (byte) 0x6f, (byte) 0x4f, (byte) 0x60,
+ (byte) 0x66, (byte) 0xe8, (byte) 0x44, (byte) 0x38, (byte) 0x0f, (byte) 0x09, (byte) 0x0d
+ };
+ checkSynth(
+ /*
+ * main_header: 10
+ * metablock_header_begin: 1, 0, 10, 0
+ * metablock_header_trivial_context
+ * huffman_fixed: 256
+ * huffman_fixed: 704
+ * huffman_fixed: 64
+ * command_easy: 2, "too far!", 1000000 // distance too far for 10 wbits
+ */
+ compressed,
+ false,
+ ""
+ );
+ }
+
+ @Test
+ public void testInvalidTooLargeContextMap() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x00, (byte) 0x00, (byte) 0xd1, (byte) 0xe1, (byte) 0x01, (byte) 0xc6,
+ (byte) 0xe0, (byte) 0xe2, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x91, (byte) 0xb2,
+ (byte) 0x70, (byte) 0xfe, (byte) 0xfb, (byte) 0x45, (byte) 0x58, (byte) 0x88, (byte) 0x01,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x01
+ };
+ checkSynth(
+ /*
+ * // Has a repeat code a context map that makes the size too big -> invalid.
+ * main_header
+ * metablock_header_begin: 1, 0, 1, 0
+ * // two literal block types
+ * vlq_blocktypes: 2
+ * huffman_simple: 1,4,4, 1,0,2,3 // literal blocktype prefix code
+ * huffman_fixed: 26 // literal blockcount prefix code
+ * blockcount_easy: 1
+ * // one ins/copy and dist block type
+ * vlq_blocktypes: 1
+ * vlq_blocktypes: 1
+ * ndirect: 0, 0
+ * // two MSB6 literal context modes
+ * bits: "00", "00"
+ * // two literal prefix codes
+ * vlq_blocktypes: 2
+ * // literal context map
+ * vlq_rlemax: 5
+ * huffman_simple: 0,3,7, 5,0,6 // context map RLE Huffman code
+ * // Too long context map RLE: repeat 0 64 times, 1+5 65 times, that is 129
+ * // values which is 1 too much.
+ * bits: "01", "0", "11111", "11", "11", "0", "11111"
+ * bit: 1 // MTF enabled
+ * // one distance prefix code
+ * vlq_blocktypes: 1
+ * huffman_simple: 0,1,256, 97 // only a's
+ * huffman_simple: 0,1,256, 98 // only b's
+ * huffman_fixed: 704
+ * huffman_fixed: 64
+ * // now comes the data
+ * command_inscopy_easy: 1, 0
+ */
+ compressed,
+ false,
+ "a"
+ );
+ }
+
+ @Test
+ public void testInvalidTransformType() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x41, (byte) 0x2d, (byte) 0x01, (byte) 0x19
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_easy: 4, 1
+ * command_inscopy_easy: 0, 4
+ * command_dist_easy: 123905 // = 121 << 10 + 1
+ */
+ compressed,
+ false,
+ ""
+ );
+ }
+
+ @Test
+ public void testInvalidWindowBits9() {
+ byte[] compressed = {
+ (byte) 0x91, (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x1c, (byte) 0xa7, (byte) 0x6d, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0xd8,
+ (byte) 0x32, (byte) 0x89, (byte) 0x01, (byte) 0x12, (byte) 0x00, (byte) 0x00, (byte) 0x77,
+ (byte) 0xda, (byte) 0xc8, (byte) 0x20, (byte) 0x32, (byte) 0xd4, (byte) 0x01
+ };
+ checkSynth(
+ /*
+ * main_header: 9
+ * metablock_fixed: \"a\", 1
+ */
+ compressed,
+ false,
+ "a"
+ );
+ }
+
+ @Test
+ public void testManyTinyMetablocks() {
+ byte[] compressed = {
+ (byte) 0x0b, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb,
+ (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03,
+ (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61,
+ (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04,
+ (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00,
+ (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00,
+ (byte) 0x80, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70,
+ (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00,
+ (byte) 0xee, (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80,
+ (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0,
+ (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee,
+ (byte) 0xb4, (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38,
+ (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x11, (byte) 0x61, (byte) 0x04, (byte) 0x00, (byte) 0x80, (byte) 0x61, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e,
+ (byte) 0xdb, (byte) 0x00, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12,
+ (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x11,
+ (byte) 0x61, (byte) 0x34
+ };
+ checkSynth(
+ /*
+ * main_header
+ * repeat: 300
+ * metablock_uncompressed: "a"
+ * metablock_fixed: "b"
+ * end_repeat
+ * metablock_lastempty
+ */
+ compressed,
+ true,
+ "abababababababababababababababababababababababababababababababababababababababababababababab"
+ + "ababababababababababababababababababababababababababababababababababababababababababababab"
+ + "ababababababababababababababababababababababababababababababababababababababababababababab"
+ + "ababababababababababababababababababababababababababababababababababababababababababababab"
+ + "ababababababababababababababababababababababababababababababababababababababababababababab"
+ + "ababababababababababababababababababababababababababababababababababababababababababababab"
+ + "ababababababababababababababababababababababababababababab"
+ );
+ }
+
+ @Test
+ public void testNegativeDistance() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x0f, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x41, (byte) 0x02, (byte) 0x01, (byte) 0x42, (byte) 0x01, (byte) 0x42,
+ (byte) 0x01, (byte) 0x42, (byte) 0x01, (byte) 0x42, (byte) 0x01, (byte) 0x42, (byte) 0x01,
+ (byte) 0x1c
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_easy: 16, 1
+ * command_inscopy_easy: 0, 4 // time
+ * command_dist_easy: 1
+ * command_inscopy_easy: 0, 2 // me
+ * command_dist_easy: 2
+ * command_inscopy_easy: 0, 2 // me
+ * command_dist_easy: 2
+ * command_inscopy_easy: 0, 2 // me
+ * command_dist_easy: 2
+ * command_inscopy_easy: 0, 2 // me
+ * command_dist_easy: 2
+ * command_inscopy_easy: 0, 2 // me
+ * command_dist_easy: 2 // All rb items are 2 now
+ * command_inscopy_easy: 0, 2
+ * bits: "011100" // 15 -> distance = rb[idx + 2] - 3
+ */
+ compressed,
+ false,
+ "timemememememeXX"
+ );
+ }
+
+ @Test
+ public void testNegativeRemainingLenBetweenMetablocks() {
+ byte[] compressed = {
+ (byte) 0x0b, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x09, (byte) 0x86, (byte) 0x46, (byte) 0x11, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00,
+ (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24,
+ (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4, (byte) 0x91, (byte) 0x60, (byte) 0x68,
+ (byte) 0x04
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_easy: 1, 0
+ * command_easy: 0, "ab" // remaining length == -1 -> invalid stream
+ * metablock_header_easy: 2, 1
+ * command_easy: 0, "ab"
+ */
+ compressed,
+ false,
+ "abab"
+ );
+ }
+
+ @Test
+ public void testOneCommand() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x11, (byte) 0x86, (byte) 0x02
+ };
+ checkSynth(
+ /*
+ * // The stream consists of one command with insert and copy.
+ * main_header
+ * metablock_header_easy: 3, 1
+ * command_easy: 2, "a", 1
+ */
+ compressed,
+ true,
+ "aaa"
+ );
+ }
+
+ @Test
+ public void testOneInsert() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x09, (byte) 0x86, (byte) 0x46
+ };
+ checkSynth(
+ /*
+ * // The stream consists of one half command with insert only.
+ * main_header
+ * metablock_header_easy: 2, 1
+ * command_easy: 0, "ab"
+ */
+ compressed,
+ true,
+ "ab"
+ );
+ }
+
+ @Test
+ public void testSimplePrefix() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0xa0, (byte) 0xc3, (byte) 0xc4,
+ (byte) 0xc6, (byte) 0xc8, (byte) 0x02, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x51, (byte) 0xa0, (byte) 0x1d
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_begin: 1, 0, 4, 0
+ * metablock_header_trivial_context
+ * huffman_simple: 1,4,256, 97,98,99,100 // ASCII codes for a, b, c, d
+ * huffman_fixed: 704
+ * huffman_fixed: 64
+ * command_inscopy_easy: 4, 0
+ * command_literal_bits: 0, 10, 110, 111 // a, b, c, d
+ */
+ compressed,
+ true,
+ "abcd"
+ );
+ }
+
+ @Test
+ public void testSimplePrefixDuplicateSymbols() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0xa0, (byte) 0xc3, (byte) 0xc4,
+ (byte) 0xc2, (byte) 0xc4, (byte) 0x02, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x51, (byte) 0xa0, (byte) 0x1d
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_begin: 1, 0, 4, 0
+ * metablock_header_trivial_context
+ * huffman_simple: 1,4,256, 97,98,97,98 // ASCII codes for a, b, a, b
+ * huffman_fixed: 704
+ * huffman_fixed: 64
+ * command_inscopy_easy: 4, 0
+ * command_literal_bits: 0, 10, 110, 111 // a, b, a, b
+ */
+ compressed,
+ false,
+ "abab"
+ );
+ }
+
+ @Test
+ public void testSimplePrefixOutOfRangeSymbols() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x4d, (byte) 0xff, (byte) 0xef, (byte) 0x7f, (byte) 0xff,
+ (byte) 0xfc, (byte) 0x07, (byte) 0x00, (byte) 0xb8, (byte) 0xd3, (byte) 0x06
+ };
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_begin: 1, 0, 4, 0
+ * metablock_header_trivial_context
+ * huffman_fixed: 256
+ * huffman_simple: 1,4,704, 1023,1022,1021,1020
+ * huffman_fixed: 64
+ */
+ compressed,
+ false,
+ ""
+ );
+ }
+
+/* DISABLED: Java decoder does not tolerate extra input after the brotli stream.
+ @Test
+ public void testSimplePrefixPlusExtraData() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0xa0, (byte) 0xc3, (byte) 0xc4,
+ (byte) 0xc6, (byte) 0xc8, (byte) 0x02, (byte) 0x00, (byte) 0x70, (byte) 0xb0, (byte) 0x65,
+ (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xee, (byte) 0xb4,
+ (byte) 0x51, (byte) 0xa0, (byte) 0x1d, (byte) 0x55, (byte) 0xaa
+ };
+ checkSynth(
+ compressed,
+ true,
+ "abcd"
+ );
+ }
+*/
+
+ @Test
+ public void testStressReadDistanceExtraBits() {
+ byte[] compressed = {
+ (byte) 0x4f, (byte) 0xfe, (byte) 0xff, (byte) 0x3f, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x80, (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07,
+ (byte) 0x5b, (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0,
+ (byte) 0x4e, (byte) 0x9b, (byte) 0xf6, (byte) 0x69, (byte) 0xef, (byte) 0xff, (byte) 0x0c,
+ (byte) 0x8d, (byte) 0x8c, (byte) 0x05, (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0x4e, (byte) 0xdb, (byte) 0x00, (byte) 0x00,
+ (byte) 0x70, (byte) 0xb0, (byte) 0x65, (byte) 0x12, (byte) 0x03, (byte) 0x24, (byte) 0xa8,
+ (byte) 0xaa, (byte) 0xef, (byte) 0xab, (byte) 0xaa, (byte) 0x7f, (byte) 0x24, (byte) 0x16,
+ (byte) 0x35, (byte) 0x8f, (byte) 0xac, (byte) 0x9e, (byte) 0x3d, (byte) 0xf7, (byte) 0xf3,
+ (byte) 0xe3, (byte) 0x0a, (byte) 0xfc, (byte) 0xff, (byte) 0x03, (byte) 0x00, (byte) 0x00,
+ (byte) 0x78, (byte) 0x01, (byte) 0x08, (byte) 0x30, (byte) 0x31, (byte) 0x32, (byte) 0x33,
+ (byte) 0x34, (byte) 0x35, (byte) 0x36, (byte) 0x37, (byte) 0x38, (byte) 0x39, (byte) 0x41,
+ (byte) 0x42, (byte) 0x43, (byte) 0x44, (byte) 0x45, (byte) 0x46, (byte) 0x30, (byte) 0x31,
+ (byte) 0x32, (byte) 0x33, (byte) 0x34, (byte) 0x35, (byte) 0x36, (byte) 0x37, (byte) 0x38,
+ (byte) 0x39, (byte) 0x41, (byte) 0x42, (byte) 0x43, (byte) 0x44, (byte) 0x45, (byte) 0x46,
+ (byte) 0x30, (byte) 0x31, (byte) 0x32, (byte) 0x33, (byte) 0x34, (byte) 0x35, (byte) 0x36,
+ (byte) 0x37, (byte) 0x38, (byte) 0x39, (byte) 0x41, (byte) 0x42, (byte) 0x43, (byte) 0x44,
+ (byte) 0x45, (byte) 0x46, (byte) 0x03
+ };
+ /* This line is added manually. */
+ char[] stub = new char[8388602]; Arrays.fill(stub, 'c'); String hex = "0123456789ABCDEF";
+ checkSynth(
+ /*
+ * main_header: 24
+ * metablock_header_easy: 8388605, 0 // 2^23 - 3 = shortest 22-bit distance
+ * command_easy: 8388602, "abc", 1
+ * metablock_header_begin: 0, 0, 3, 0
+ * vlq_blocktypes: 1 // num litetal block types
+ * vlq_blocktypes: 1 // num command block types
+ * vlq_blocktypes: 1 // num distance block types
+ * ndirect: 0, 0
+ * bits: "00" // literal context modes
+ * vlq_blocktypes: 1 // num literal Huffman trees
+ * // command has no context -> num trees == num block types
+ * vlq_blocktypes: 1 // num distance Huffman trees
+ * huffman_fixed: 256
+ * huffman_fixed: 704
+ * // Begin of distance Huffman tree. First 15 codes have lengths 1 to 15.
+ * // Symbol that corresponds to first half of 22-bit distance range is also
+ * // 15. All other symbols are 0.
+ * hskip: 0
+ * clcl_ordered: 4,4,4,4, 4,4,4,4, 4,4,4,4, 4,4, 5,5,5,5
+ * set_prefix_cl_rle: "0000", "0001", "0010", "0011", \
+ * "0100", "0101", "0110", "0111", \
+ * "1000", "1001", "1010", "1011", \
+ * "1100", "1101", \
+ * "11100", "11101", "11110", "11111"
+ * cl_rle: 1
+ * cl_rle: 2
+ * cl_rle: 3
+ * cl_rle: 4
+ * cl_rle: 5
+ * cl_rle: 6
+ * cl_rle: 7
+ * cl_rle: 8
+ * cl_rle: 9
+ * cl_rle: 10
+ * cl_rle: 11
+ * cl_rle: 12
+ * cl_rle: 13
+ * cl_rle: 14
+ * cl_rle: 15
+ * cl_rle_rep_0: 43
+ * cl_rle: 15 // literal number 97, that is, the letter 'a'
+ * // end of literal Huffman tree
+ * command_inscopy_easy: 0, 3 // Insert 0, copy 3
+ * // 15 bits of distance code plus 22 extra bits
+ * command_dist_bits: "111111111111111", "0000000000000000000000"
+ * metablock_uncompressed: "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
+ * metablock_lastempty
+ */
+ compressed,
+ true,
+ /* This line is modified manually. */
+ "abc" + new String(stub) + "abc" + hex + hex + hex
+ );
+ }
+
+ @Test
+ public void testTooManySymbolsRepeated() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x80,
+ (byte) 0xc3, (byte) 0x3d, (byte) 0x80, (byte) 0x58, (byte) 0x82, (byte) 0x0c, (byte) 0x00,
+ (byte) 0xc0, (byte) 0xc1, (byte) 0x96, (byte) 0x49, (byte) 0x0c, (byte) 0x90, (byte) 0x00,
+ (byte) 0x00, (byte) 0xb8, (byte) 0xd3, (byte) 0x46, (byte) 0x01, (byte) 0x1a, (byte) 0x01
+ };
+ checkSynth(
+ /*
+ * // This test is a copy of CustomHuffmanCode, with changed repeat count.
+ * main_header
+ * metablock_header_begin: 1, 0, 4, 0
+ * metablock_header_trivial_context
+ * hskip: 0
+ * clcl_ordered: 0,3,0,0,0,0,0,0,3,2,0,0,0,0,0,0,1,0
+ * set_prefix_cl_rle: "", "110", "", "", "", "", "", "", "111", "10",\
+ * "", "", "", "", "", "", "0", ""
+ * cl_rle: 8
+ * cl_rle_rep: 9, 96
+ * cl_rle: 1
+ * cl_rle_rep: 9, 159 // 1 + 96 + 1 + 159 = 257 > 256 = alphabet size
+ * huffman_fixed: 704
+ * huffman_fixed: 64
+ * command_inscopy_easy: 4, 0
+ * command_literal_bits: 0, 0, 0, 101100010
+ */
+ compressed,
+ false,
+ "aaab"
+ );
+ }
+
+ @Test
+ public void testTransformedDictWord() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x41, (byte) 0x09, (byte) 0x01, (byte) 0x01
+ };
+ checkSynth(
+ /*
+ * // The stream consists of a transformed dictionary word.
+ * main_header
+ * metablock_header_easy: 9, 1
+ * command_inscopy_easy: 0, 4
+ * command_dist_easy: 5121 // 5 << 10 + 1
+ */
+ compressed,
+ true,
+ "time the "
+ );
+ }
+
+ @Test
+ public void testTransformedDictWordTooLong() {
+ byte[] compressed = {
+ (byte) 0x1b, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80,
+ (byte) 0xe3, (byte) 0xb4, (byte) 0x0d, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x5b,
+ (byte) 0x26, (byte) 0x31, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0xe0, (byte) 0x4e,
+ (byte) 0x1b, (byte) 0x41, (byte) 0x09, (byte) 0x01, (byte) 0x01
+ };
+ checkSynth(
+ /*
+ * // Has a transformed dictionary word that goes over the end of the
+ * // meta-block, but the base dictionary word fits in the meta-block.
+ * // Same as TransformedDictWord, but with a shorter meta-block length.
+ * main_header
+ * metablock_header_easy: 4, 1
+ * command_inscopy_easy: 0, 4
+ * command_dist_easy: 5121 // 5 << 10 + 1
+ */
+ compressed,
+ false,
+ ""
+ );
+ }
+
+ @Test
+ public void testZeroCostLiterals() {
+ byte[] compressed = {
+ (byte) 0x9b, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x20, (byte) 0x54,
+ (byte) 0x00, (byte) 0x00, (byte) 0x38, (byte) 0xd8, (byte) 0x32, (byte) 0x89, (byte) 0x01,
+ (byte) 0x12, (byte) 0x00, (byte) 0x00, (byte) 0x77, (byte) 0xda, (byte) 0xcc, (byte) 0xe1,
+ (byte) 0x7b, (byte) 0xfa, (byte) 0x0f
+ };
+ /* This lines is added manually. */
+ char[] expected = new char[16777216]; Arrays.fill(expected, '*');
+ checkSynth(
+ /*
+ * main_header
+ * metablock_header_begin: 1, 0, 16777216, 0
+ * metablock_header_trivial_context
+ * huffman_simple: 0,1,256, 42 // Single symbol alphabet
+ * huffman_fixed: 704
+ * huffman_fixed: 64
+ * command_inscopy_easy: 16777216, 0
+ * // 16777216 times 0 bits
+ */
+ compressed,
+ true,
+ /* This line is modified manually. */
+ new String(expected)
+ );
+ }
+
+/* GENERATED CODE END */
+
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Transform.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Transform.java
new file mode 100644
index 000000000..3279ee739
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Transform.java
@@ -0,0 +1,236 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Transformations on dictionary words.
+ *
+ * Transform descriptor is a triplet: {prefix, operator, suffix}.
+ * "prefix" and "suffix" are short strings inserted before and after transformed dictionary word.
+ * "operator" is applied to dictionary word itself.
+ *
+ * Some operators has "built-in" parameters, i.e. parameter is defined by operator ordinal. Other
+ * operators have "external" parameters, supplied via additional table encoded in shared dictionary.
+ *
+ * Operators:
+ * - IDENTITY (0): dictionary word is inserted "as is"
+ * - OMIT_LAST_N (1 - 9): last N octets of dictionary word are not inserted; N == ordinal
+ * - OMIT_FIRST_M (12-20): first M octets of dictionary word are not inserted; M == ordinal - 11
+ * - UPPERCASE_FIRST (10): first "scalar" is XOR'ed with number 32
+ * - UPPERCASE_ALL (11): all "scalars" are XOR'ed with number 32
+ * - SHIFT_FIRST (21): first "scalar" is shifted by number form parameter table
+ * - SHIFT_ALL (22): all "scalar" is shifted by number form parameter table
+ *
+ * Here "scalar" is a variable length character coding similar to UTF-8 encoding.
+ * UPPERCASE_XXX / SHIFT_XXX operators were designed to change the case of UTF-8 encoded characters.
+ * While UPPERCASE_XXX works well only on ASCII charset, SHIFT is much more generic and could be
+ * used for most (all?) alphabets.
+ */
+final class Transform {
+
+ static final class Transforms {
+ final int numTransforms;
+ final int[] triplets;
+ final byte[] prefixSuffixStorage;
+ final int[] prefixSuffixHeads;
+ final short[] params;
+
+ Transforms(int numTransforms, int prefixSuffixLen, int prefixSuffixCount) {
+ this.numTransforms = numTransforms;
+ this.triplets = new int[numTransforms * 3];
+ this.params = new short[numTransforms];
+ this.prefixSuffixStorage = new byte[prefixSuffixLen];
+ this.prefixSuffixHeads = new int[prefixSuffixCount + 1];
+ }
+ }
+
+ static final int NUM_RFC_TRANSFORMS = 121;
+ static final Transforms RFC_TRANSFORMS = new Transforms(NUM_RFC_TRANSFORMS, 167, 50);
+
+ private static final int OMIT_FIRST_LAST_LIMIT = 9;
+
+ private static final int IDENTITY = 0;
+ private static final int OMIT_LAST_BASE = IDENTITY + 1 - 1; // there is no OMIT_LAST_0.
+ private static final int UPPERCASE_FIRST = OMIT_LAST_BASE + OMIT_FIRST_LAST_LIMIT + 1;
+ private static final int UPPERCASE_ALL = UPPERCASE_FIRST + 1;
+ private static final int OMIT_FIRST_BASE = UPPERCASE_ALL + 1 - 1; // there is no OMIT_FIRST_0.
+ private static final int SHIFT_FIRST = OMIT_FIRST_BASE + OMIT_FIRST_LAST_LIMIT + 1;
+ private static final int SHIFT_ALL = SHIFT_FIRST + 1;
+
+ // Bundle of 0-terminated strings.
+ private static final String PREFIX_SUFFIX_SRC = "# #s #, #e #.# the #.com/#\u00C2\u00A0# of # and"
+ + " # in # to #\"#\">#\n#]# for # a # that #. # with #'# from # by #. The # on # as # is #ing"
+ + " #\n\t#:#ed #(# at #ly #=\"# of the #. This #,# not #er #al #='#ful #ive #less #est #ize #"
+ + "ous #";
+ private static final String TRANSFORMS_SRC = " !! ! , *! &! \" ! ) * * - ! # ! #!*! "
+ + "+ ,$ ! - % . / # 0 1 . \" 2 3!* 4% ! # / 5 6 7 8 0 1 & $ 9 + : "
+ + " ; < ' != > ?! 4 @ 4 2 & A *# ( B C& ) % ) !*# *-% A +! *. D! %' & E *6 F "
+ + " G% ! *A *% H! D I!+! J!+ K +- *4! A L!*4 M N +6 O!*% +.! K *G P +%( ! G *D +D "
+ + " Q +# *K!*G!+D!+# +G +A +4!+% +K!+4!*D!+K!*K";
+
+ private static void unpackTransforms(byte[] prefixSuffix,
+ int[] prefixSuffixHeads, int[] transforms, String prefixSuffixSrc, String transformsSrc) {
+ int n = prefixSuffixSrc.length();
+ int index = 1;
+ int j = 0;
+ for (int i = 0; i < n; ++i) {
+ char c = prefixSuffixSrc.charAt(i);
+ if (c == 35) { // == #
+ prefixSuffixHeads[index++] = j;
+ } else {
+ prefixSuffix[j++] = (byte) c;
+ }
+ }
+
+ for (int i = 0; i < NUM_RFC_TRANSFORMS * 3; ++i) {
+ transforms[i] = transformsSrc.charAt(i) - 32;
+ }
+ }
+
+ static {
+ unpackTransforms(RFC_TRANSFORMS.prefixSuffixStorage, RFC_TRANSFORMS.prefixSuffixHeads,
+ RFC_TRANSFORMS.triplets, PREFIX_SUFFIX_SRC, TRANSFORMS_SRC);
+ }
+
+ static int transformDictionaryWord(byte[] dst, int dstOffset, ByteBuffer src, int srcOffset,
+ int len, Transforms transforms, int transformIndex) {
+ int offset = dstOffset;
+ int[] triplets = transforms.triplets;
+ byte[] prefixSuffixStorage = transforms.prefixSuffixStorage;
+ int[] prefixSuffixHeads = transforms.prefixSuffixHeads;
+ int transformOffset = 3 * transformIndex;
+ int prefixIdx = triplets[transformOffset];
+ int transformType = triplets[transformOffset + 1];
+ int suffixIdx = triplets[transformOffset + 2];
+ int prefix = prefixSuffixHeads[prefixIdx];
+ int prefixEnd = prefixSuffixHeads[prefixIdx + 1];
+ int suffix = prefixSuffixHeads[suffixIdx];
+ int suffixEnd = prefixSuffixHeads[suffixIdx + 1];
+
+ int omitFirst = transformType - OMIT_FIRST_BASE;
+ int omitLast = transformType - OMIT_LAST_BASE;
+ if (omitFirst < 1 || omitFirst > OMIT_FIRST_LAST_LIMIT) {
+ omitFirst = 0;
+ }
+ if (omitLast < 1 || omitLast > OMIT_FIRST_LAST_LIMIT) {
+ omitLast = 0;
+ }
+
+ // Copy prefix.
+ while (prefix != prefixEnd) {
+ dst[offset++] = prefixSuffixStorage[prefix++];
+ }
+
+ // Copy trimmed word.
+ if (omitFirst > len) {
+ omitFirst = len;
+ }
+ srcOffset += omitFirst;
+ len -= omitFirst;
+ len -= omitLast;
+ int i = len;
+ while (i > 0) {
+ dst[offset++] = src.get(srcOffset++);
+ i--;
+ }
+
+ // Ferment.
+ if (transformType == UPPERCASE_FIRST || transformType == UPPERCASE_ALL) {
+ int uppercaseOffset = offset - len;
+ if (transformType == UPPERCASE_FIRST) {
+ len = 1;
+ }
+ while (len > 0) {
+ int c0 = dst[uppercaseOffset] & 0xFF;
+ if (c0 < 0xC0) {
+ if (c0 >= 97 && c0 <= 122) { // in [a..z] range
+ dst[uppercaseOffset] ^= (byte) 32;
+ }
+ uppercaseOffset += 1;
+ len -= 1;
+ } else if (c0 < 0xE0) {
+ dst[uppercaseOffset + 1] ^= (byte) 32;
+ uppercaseOffset += 2;
+ len -= 2;
+ } else {
+ dst[uppercaseOffset + 2] ^= (byte) 5;
+ uppercaseOffset += 3;
+ len -= 3;
+ }
+ }
+ } else if (transformType == SHIFT_FIRST || transformType == SHIFT_ALL) {
+ int shiftOffset = offset - len;
+ short param = transforms.params[transformIndex];
+ /* Limited sign extension: scalar < (1 << 24). */
+ int scalar = (param & 0x7FFF) + (0x1000000 - (param & 0x8000));
+ while (len > 0) {
+ int step = 1;
+ int c0 = dst[shiftOffset] & 0xFF;
+ if (c0 < 0x80) {
+ /* 1-byte rune / 0sssssss / 7 bit scalar (ASCII). */
+ scalar += c0;
+ dst[shiftOffset] = (byte) (scalar & 0x7F);
+ } else if (c0 < 0xC0) {
+ /* Continuation / 10AAAAAA. */
+ } else if (c0 < 0xE0) {
+ /* 2-byte rune / 110sssss AAssssss / 11 bit scalar. */
+ if (len >= 2) {
+ byte c1 = dst[shiftOffset + 1];
+ scalar += (c1 & 0x3F) | ((c0 & 0x1F) << 6);
+ dst[shiftOffset] = (byte) (0xC0 | ((scalar >> 6) & 0x1F));
+ dst[shiftOffset + 1] = (byte) ((c1 & 0xC0) | (scalar & 0x3F));
+ step = 2;
+ } else {
+ step = len;
+ }
+ } else if (c0 < 0xF0) {
+ /* 3-byte rune / 1110ssss AAssssss BBssssss / 16 bit scalar. */
+ if (len >= 3) {
+ byte c1 = dst[shiftOffset + 1];
+ byte c2 = dst[shiftOffset + 2];
+ scalar += (c2 & 0x3F) | ((c1 & 0x3F) << 6) | ((c0 & 0x0F) << 12);
+ dst[shiftOffset] = (byte) (0xE0 | ((scalar >> 12) & 0x0F));
+ dst[shiftOffset + 1] = (byte) ((c1 & 0xC0) | ((scalar >> 6) & 0x3F));
+ dst[shiftOffset + 2] = (byte) ((c2 & 0xC0) | (scalar & 0x3F));
+ step = 3;
+ } else {
+ step = len;
+ }
+ } else if (c0 < 0xF8) {
+ /* 4-byte rune / 11110sss AAssssss BBssssss CCssssss / 21 bit scalar. */
+ if (len >= 4) {
+ byte c1 = dst[shiftOffset + 1];
+ byte c2 = dst[shiftOffset + 2];
+ byte c3 = dst[shiftOffset + 3];
+ scalar += (c3 & 0x3F) | ((c2 & 0x3F) << 6) | ((c1 & 0x3F) << 12) | ((c0 & 0x07) << 18);
+ dst[shiftOffset] = (byte) (0xF0 | ((scalar >> 18) & 0x07));
+ dst[shiftOffset + 1] = (byte) ((c1 & 0xC0) | ((scalar >> 12) & 0x3F));
+ dst[shiftOffset + 2] = (byte) ((c2 & 0xC0) | ((scalar >> 6) & 0x3F));
+ dst[shiftOffset + 3] = (byte) ((c3 & 0xC0) | (scalar & 0x3F));
+ step = 4;
+ } else {
+ step = len;
+ }
+ }
+ shiftOffset += step;
+ len -= step;
+ if (transformType == SHIFT_FIRST) {
+ len = 0;
+ }
+ }
+ }
+
+ // Copy suffix.
+ while (suffix != suffixEnd) {
+ dst[offset++] = prefixSuffixStorage[suffix++];
+ }
+
+ return offset - dstOffset;
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/TransformTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/TransformTest.java
new file mode 100644
index 000000000..6e04f0dc6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/TransformTest.java
@@ -0,0 +1,71 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+import java.nio.ByteBuffer;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Tests for {@link Transform}.
+ */
+@RunWith(JUnit4.class)
+public class TransformTest {
+
+ private static long crc64(byte[] data) {
+ long crc = -1;
+ for (int i = 0; i < data.length; ++i) {
+ long c = (crc ^ (long) (data[i] & 0xFF)) & 0xFF;
+ for (int k = 0; k < 8; k++) {
+ c = (c >>> 1) ^ (-(c & 1L) & -3932672073523589310L);
+ }
+ crc = c ^ (crc >>> 8);
+ }
+ return ~crc;
+ }
+
+ @Test
+ public void testTrimAll() {
+ byte[] output = new byte[0];
+ byte[] input = {119, 111, 114, 100}; // "word"
+ Transform.transformDictionaryWord(output, 0,
+ ByteBuffer.wrap(input), 0, input.length, Transform.RFC_TRANSFORMS, 39);
+ byte[] expectedOutput = new byte[0];
+ assertArrayEquals(expectedOutput, output);
+ }
+
+ @Test
+ public void testCapitalize() {
+ byte[] output = new byte[6];
+ byte[] input = {113, -61, -90, -32, -92, -86}; // "qæप"
+ Transform.transformDictionaryWord(output, 0,
+ ByteBuffer.wrap(input), 0, input.length, Transform.RFC_TRANSFORMS, 44);
+ byte[] expectedOutput = {81, -61, -122, -32, -92, -81}; // "QÆय"
+ assertArrayEquals(expectedOutput, output);
+ }
+
+ @Test
+ public void testAllTransforms() {
+ /* This string allows to apply all transforms: head and tail cutting, capitalization and
+ turning to upper case; all results will be mutually different. */
+ // "o123456789abcdef"
+ byte[] testWord = {111, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102};
+ byte[] output = new byte[2259];
+ int offset = 0;
+ for (int i = 0; i < Transform.NUM_RFC_TRANSFORMS; ++i) {
+ offset += Transform.transformDictionaryWord(output, offset,
+ ByteBuffer.wrap(testWord), 0, testWord.length, Transform.RFC_TRANSFORMS, i);
+ output[offset++] = -1;
+ }
+ assertEquals(output.length, offset);
+ assertEquals(8929191060211225186L, crc64(output));
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Utils.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Utils.java
new file mode 100644
index 000000000..2d04aecd3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/Utils.java
@@ -0,0 +1,102 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.dec;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.Buffer;
+
+/**
+ * A set of utility methods.
+ */
+final class Utils {
+
+ private static final byte[] BYTE_ZEROES = new byte[1024];
+
+ private static final int[] INT_ZEROES = new int[1024];
+
+ /**
+ * Fills byte array with zeroes.
+ *
+ * <p> Current implementation uses {@link System#arraycopy}, so it should be used for length not
+ * less than 16.
+ *
+ * @param dest array to fill with zeroes
+ * @param offset the first byte to fill
+ * @param length number of bytes to change
+ */
+ static void fillBytesWithZeroes(byte[] dest, int start, int end) {
+ int cursor = start;
+ while (cursor < end) {
+ int step = Math.min(cursor + 1024, end) - cursor;
+ System.arraycopy(BYTE_ZEROES, 0, dest, cursor, step);
+ cursor += step;
+ }
+ }
+
+ /**
+ * Fills int array with zeroes.
+ *
+ * <p> Current implementation uses {@link System#arraycopy}, so it should be used for length not
+ * less than 16.
+ *
+ * @param dest array to fill with zeroes
+ * @param offset the first item to fill
+ * @param length number of item to change
+ */
+ static void fillIntsWithZeroes(int[] dest, int start, int end) {
+ int cursor = start;
+ while (cursor < end) {
+ int step = Math.min(cursor + 1024, end) - cursor;
+ System.arraycopy(INT_ZEROES, 0, dest, cursor, step);
+ cursor += step;
+ }
+ }
+
+ static void copyBytesWithin(byte[] bytes, int target, int start, int end) {
+ System.arraycopy(bytes, start, bytes, target, end - start);
+ }
+
+ static int readInput(InputStream src, byte[] dst, int offset, int length) {
+ try {
+ return src.read(dst, offset, length);
+ } catch (IOException e) {
+ throw new BrotliRuntimeException("Failed to read input", e);
+ }
+ }
+
+ static void closeInput(InputStream src) throws IOException {
+ src.close();
+ }
+
+ static byte[] toUsAsciiBytes(String src) {
+ try {
+ // NB: String#getBytes(String) is present in JDK 1.1, while other variants require JDK 1.6 and
+ // above.
+ return src.getBytes("US-ASCII");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e); // cannot happen
+ }
+ }
+
+ // Crazy pills factory: code compiled for JDK8 does not work on JRE9.
+ static void flipBuffer(Buffer buffer) {
+ buffer.flip();
+ }
+
+ static int isDebugMode() {
+ boolean assertsEnabled = Boolean.parseBoolean(System.getProperty("BROTLI_ENABLE_ASSERTS"));
+ return assertsEnabled ? 1 : 0;
+ }
+
+ // See BitReader.LOG_BITNESS
+ static int getLogBintness() {
+ boolean isLongExpensive = Boolean.parseBoolean(System.getProperty("BROTLI_32_BIT_CPU"));
+ return isLongExpensive ? 5 : 6;
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/build_defs.bzl b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/build_defs.bzl
new file mode 100644
index 000000000..d0a015c0c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/build_defs.bzl
@@ -0,0 +1,34 @@
+"""Utilities for Java brotli tests."""
+
+_TEST_JVM_FLAGS = [
+ "-DBROTLI_ENABLE_ASSERTS=true",
+]
+
+def brotli_java_test(name, main_class = None, jvm_flags = None, **kwargs):
+ """test duplication rule that creates 32/64-bit test pair."""
+
+ if jvm_flags == None:
+ jvm_flags = []
+ jvm_flags = jvm_flags + _TEST_JVM_FLAGS
+
+ test_package = native.package_name().replace("/", ".")
+ if main_class == None:
+ test_class = test_package + "." + name
+ else:
+ test_class = None
+
+ native.java_test(
+ name = name + "_32",
+ main_class = main_class,
+ test_class = test_class,
+ jvm_flags = jvm_flags + ["-DBROTLI_32_BIT_CPU=true"],
+ **kwargs
+ )
+
+ native.java_test(
+ name = name + "_64",
+ main_class = main_class,
+ test_class = test_class,
+ jvm_flags = jvm_flags + ["-DBROTLI_32_BIT_CPU=false"],
+ **kwargs
+ )
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/pom.xml b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/pom.xml
new file mode 100644
index 000000000..946fddf2d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/pom.xml
@@ -0,0 +1,172 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.brotli</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>dec</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name>${project.groupId}:${project.artifactId}</name>
+
+ <properties>
+ <manifestdir>${project.build.directory}/osgi</manifestdir>
+ <manifestfile>${manifestdir}/MANIFEST.MF</manifestfile>
+ </properties>
+
+ <build>
+ <sourceDirectory>../../..</sourceDirectory>
+ <testSourceDirectory>../../..</testSourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>org/brotli/dec/*.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*Test*.java</exclude>
+ </excludes>
+ <testIncludes>
+ <include>org/brotli/dec/*Test*.java</include>
+ </testIncludes>
+ <testExcludes>
+ <exclude>org/brotli/dec/SetDictionaryTest.java</exclude>
+ </testExcludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.0.0-M3</version>
+ <configuration>
+ <systemPropertyVariables>
+ <BROTLI_ENABLE_ASSERTS>true</BROTLI_ENABLE_ASSERTS>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.4</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>jar-no-fork</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>org/brotli/dec/*.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*Test*.java</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.10.4</version>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <sourcepath>.</sourcepath>
+ <sourceFileExcludes>
+ <exclude>**/*Test*.java</exclude>
+ </sourceFileExcludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>3.0.1</version>
+ <configuration>
+ <archive>
+ <forced>true</forced>
+ </archive>
+ <excludeDependencies>true</excludeDependencies>
+ <manifestLocation>${manifestdir}</manifestLocation>
+ <instructions>
+ <_nouses>true</_nouses>
+ <Bundle-SymbolicName>org.brotli.${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Description>${project.description}</Bundle-Description>
+ <Export-Package>org.brotli.dec;version=${project.version};-noimport:=true</Export-Package>
+ <Private-Package></Private-Package>
+ <Import-Package>*</Import-Package>
+ <DynamicImport-Package></DynamicImport-Package>
+ <Bundle-DocURL>${project.url}</Bundle-DocURL>
+ </instructions>
+ </configuration>
+ <executions>
+ <execution>
+ <id>bundle-manifest</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <archive>
+ <manifestFile>${manifestfile}</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <id>copy-license</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory>
+ <resources>
+ <resource>
+ <directory>../../../../</directory>
+ <includes>
+ <include>LICENSE</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/proguard.pgcfg b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/proguard.pgcfg
new file mode 100644
index 000000000..4c545dce5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/dec/proguard.pgcfg
@@ -0,0 +1,6 @@
+# DictionaryData is an optionally / dynamically loaded built-in dictionary.
+-keep class org.brotli.dec.DictionaryData
+
+# We get the fully-qualified name of DictionaryData from Dictionary, so avoid
+# renaming it.
+-keepnames class org.brotli.dec.Dictionary
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BUILD b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BUILD
new file mode 100644
index 000000000..5b773251a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BUILD
@@ -0,0 +1,73 @@
+# Description:
+# Integration test runner + corpus for Java port of Brotli decoder.
+
+java_library(
+ name = "brotli_jni_test_base",
+ srcs = ["BrotliJniTestBase.java"],
+ visibility = [
+ "//org/brotli/wrapper/common:__pkg__",
+ "//org/brotli/wrapper/dec:__pkg__",
+ "//org/brotli/wrapper/enc:__pkg__",
+ ],
+)
+
+java_library(
+ name = "bundle_helper",
+ srcs = ["BundleHelper.java"],
+ visibility = [
+ "//org/brotli/wrapper/dec:__pkg__",
+ "//org/brotli/wrapper/enc:__pkg__",
+ ],
+)
+
+java_library(
+ name = "bundle_checker",
+ srcs = ["BundleChecker.java"],
+ deps = [
+ ":bundle_helper",
+ "//org/brotli/dec",
+ ],
+)
+
+java_binary(
+ name = "bundle_checker_bin",
+ main_class = "org.brotli.integration.BundleChecker",
+ runtime_deps = [":bundle_checker"],
+)
+
+java_test(
+ name = "bundle_checker_data_test",
+ args = ["org/brotli/integration/test_data.zip"],
+ data = ["test_data.zip"],
+ main_class = "org.brotli.integration.BundleChecker",
+ use_testrunner = 0,
+ runtime_deps = [":bundle_checker"],
+)
+
+java_test(
+ name = "bundle_checker_fuzz_test",
+ args = [
+ "-s",
+ "org/brotli/integration/fuzz_data.zip",
+ ],
+ data = ["fuzz_data.zip"],
+ main_class = "org.brotli.integration.BundleChecker",
+ use_testrunner = 0,
+ runtime_deps = [":bundle_checker"],
+)
+
+filegroup(
+ name = "test_data",
+ srcs = ["test_data.zip"],
+ visibility = [
+ "//org/brotli/wrapper/dec:__pkg__",
+ ],
+)
+
+filegroup(
+ name = "test_corpus",
+ srcs = ["test_corpus.zip"],
+ visibility = [
+ "//org/brotli/wrapper/enc:__pkg__",
+ ],
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BrotliJniTestBase.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BrotliJniTestBase.java
new file mode 100644
index 000000000..4d699d5cf
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BrotliJniTestBase.java
@@ -0,0 +1,13 @@
+package org.brotli.integration;
+
+/**
+ * Optionally loads brotli JNI wrapper native library.
+ */
+public class BrotliJniTestBase {
+ static {
+ String jniLibrary = System.getProperty("BROTLI_JNI_LIBRARY");
+ if (jniLibrary != null) {
+ System.load(new java.io.File(jniLibrary).getAbsolutePath());
+ }
+ }
+} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BundleChecker.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BundleChecker.java
new file mode 100644
index 000000000..e3ddb33b0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BundleChecker.java
@@ -0,0 +1,112 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.integration;
+
+import org.brotli.dec.BrotliInputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+/**
+ * Decompress files and (optionally) checks their checksums.
+ *
+ * <p> File are read from ZIP archive passed as an array of bytes. Multiple checkers negotiate about
+ * task distribution via shared AtomicInteger counter.
+ * <p> All entries are expected to be valid brotli compressed streams and output CRC64 checksum
+ * is expected to match the checksum hex-encoded in the first part of entry name.
+ */
+public class BundleChecker implements Runnable {
+ private final AtomicInteger nextJob;
+ private final InputStream input;
+ private final boolean sanityCheck;
+
+ /**
+ * @param sanityCheck do not calculate checksum and ignore {@link IOException}.
+ */
+ public BundleChecker(InputStream input, AtomicInteger nextJob, boolean sanityCheck) {
+ this.input = input;
+ this.nextJob = nextJob;
+ this.sanityCheck = sanityCheck;
+ }
+
+ private long decompressAndCalculateCrc(ZipInputStream input) throws IOException {
+ /* Do not allow entry readers to close the whole ZipInputStream. */
+ FilterInputStream entryStream = new FilterInputStream(input) {
+ @Override
+ public void close() {}
+ };
+
+ BrotliInputStream decompressedStream = new BrotliInputStream(entryStream);
+ long crc;
+ try {
+ crc = BundleHelper.fingerprintStream(decompressedStream);
+ } finally {
+ decompressedStream.close();
+ }
+ return crc;
+ }
+
+ @Override
+ public void run() {
+ String entryName = "";
+ ZipInputStream zis = new ZipInputStream(input);
+ try {
+ int entryIndex = 0;
+ ZipEntry entry;
+ int jobIndex = nextJob.getAndIncrement();
+ while ((entry = zis.getNextEntry()) != null) {
+ if (entry.isDirectory()) {
+ continue;
+ }
+ if (entryIndex++ != jobIndex) {
+ zis.closeEntry();
+ continue;
+ }
+ entryName = entry.getName();
+ long entryCrc = BundleHelper.getExpectedFingerprint(entryName);
+ try {
+ if (entryCrc != decompressAndCalculateCrc(zis) && !sanityCheck) {
+ throw new RuntimeException("CRC mismatch");
+ }
+ } catch (IOException iox) {
+ if (!sanityCheck) {
+ throw new RuntimeException("Decompression failed", iox);
+ }
+ }
+ zis.closeEntry();
+ entryName = "";
+ jobIndex = nextJob.getAndIncrement();
+ }
+ zis.close();
+ input.close();
+ } catch (Throwable ex) {
+ throw new RuntimeException(entryName, ex);
+ }
+ }
+
+ public static void main(String[] args) throws FileNotFoundException {
+ int argsOffset = 0;
+ boolean sanityCheck = false;
+ if (args.length != 0) {
+ if (args[0].equals("-s")) {
+ sanityCheck = true;
+ argsOffset = 1;
+ }
+ }
+ if (args.length == argsOffset) {
+ throw new RuntimeException("Usage: BundleChecker [-s] <fileX.zip> ...");
+ }
+ for (int i = argsOffset; i < args.length; ++i) {
+ new BundleChecker(new FileInputStream(args[i]), new AtomicInteger(0), sanityCheck).run();
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BundleHelper.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BundleHelper.java
new file mode 100644
index 000000000..0eab7bcb1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/BundleHelper.java
@@ -0,0 +1,113 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.integration;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+/**
+ * Utilities to work test files bundles in zip archive.
+ */
+public class BundleHelper {
+ private BundleHelper() { }
+
+ public static List<String> listEntries(InputStream input) throws IOException {
+ List<String> result = new ArrayList<String>();
+ ZipInputStream zis = new ZipInputStream(input);
+ ZipEntry entry;
+ try {
+ while ((entry = zis.getNextEntry()) != null) {
+ if (!entry.isDirectory()) {
+ result.add(entry.getName());
+ }
+ zis.closeEntry();
+ }
+ } finally {
+ zis.close();
+ }
+ return result;
+ }
+
+ public static byte[] readStream(InputStream input) throws IOException {
+ ByteArrayOutputStream result = new ByteArrayOutputStream();
+ byte[] buffer = new byte[65536];
+ int bytesRead;
+ while ((bytesRead = input.read(buffer)) != -1) {
+ result.write(buffer, 0, bytesRead);
+ }
+ return result.toByteArray();
+ }
+
+ public static byte[] readEntry(InputStream input, String entryName) throws IOException {
+ ZipInputStream zis = new ZipInputStream(input);
+ ZipEntry entry;
+ try {
+ while ((entry = zis.getNextEntry()) != null) {
+ if (entry.getName().equals(entryName)) {
+ byte[] result = readStream(zis);
+ zis.closeEntry();
+ return result;
+ }
+ zis.closeEntry();
+ }
+ } finally {
+ zis.close();
+ }
+ /* entry not found */
+ return null;
+ }
+
+ /** ECMA CRC64 polynomial. */
+ private static final long CRC_64_POLY =
+ new BigInteger("C96C5795D7870F42", 16).longValue();
+
+ /**
+ * Rolls CRC64 calculation.
+ *
+ * <p> {@code CRC64(data) = -1 ^ updateCrc64((... updateCrc64(-1, firstBlock), ...), lastBlock);}
+ * <p> This simple and reliable checksum is chosen to make is easy to calculate the same value
+ * across the variety of languages (C++, Java, Go, ...).
+ */
+ public static long updateCrc64(long crc, byte[] data, int offset, int length) {
+ for (int i = offset; i < offset + length; ++i) {
+ long c = (crc ^ (long) (data[i] & 0xFF)) & 0xFF;
+ for (int k = 0; k < 8; k++) {
+ c = ((c & 1) == 1) ? CRC_64_POLY ^ (c >>> 1) : c >>> 1;
+ }
+ crc = c ^ (crc >>> 8);
+ }
+ return crc;
+ }
+
+ /**
+ * Calculates CRC64 of stream contents.
+ */
+ public static long fingerprintStream(InputStream input) throws IOException {
+ byte[] buffer = new byte[65536];
+ long crc = -1;
+ while (true) {
+ int len = input.read(buffer);
+ if (len <= 0) {
+ break;
+ }
+ crc = updateCrc64(crc, buffer, 0, len);
+ }
+ return ~crc;
+ }
+
+ public static long getExpectedFingerprint(String entryName) {
+ int dotIndex = entryName.indexOf('.');
+ String entryCrcString = (dotIndex == -1) ? entryName : entryName.substring(0, dotIndex);
+ return new BigInteger(entryCrcString, 16).longValue();
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/fuzz_data.zip b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/fuzz_data.zip
new file mode 100644
index 000000000..7a7eedaa0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/fuzz_data.zip
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/pom.xml b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/pom.xml
new file mode 100644
index 000000000..2858a12ec
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/pom.xml
@@ -0,0 +1,65 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.brotli</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>integration</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name>${project.groupId}:${project.artifactId}</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.brotli</groupId>
+ <artifactId>dec</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>.</sourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.5.0</version>
+ <executions>
+ <execution>
+ <id>data</id>
+ <phase>test</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+ <executable>java</executable>
+ <mainClass>org.brotli.integration.BundleChecker</mainClass>
+ <arguments>
+ <argument>test_data.zip</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>fuzz</id>
+ <phase>test</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+ <executable>java</executable>
+ <mainClass>org.brotli.integration.BundleChecker</mainClass>
+ <arguments>
+ <argument>-s</argument>
+ <argument>fuzz_data.zip</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/test_corpus.zip b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/test_corpus.zip
new file mode 100644
index 000000000..8450112d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/test_corpus.zip
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/test_data.zip b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/test_data.zip
new file mode 100644
index 000000000..15ed86207
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/integration/test_data.zip
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/pom.xml b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/pom.xml
new file mode 100644
index 000000000..9a7abd095
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/pom.xml
@@ -0,0 +1,101 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.brotli</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>${project.groupId}:${project.artifactId}</name>
+ <description>Brotli is a generic-purpose lossless compression algorithm.</description>
+ <url>http://brotli.org</url>
+ <licenses>
+ <license>
+ <name>MIT License</name>
+ <url>http://www.opensource.org/licenses/mit-license.php</url>
+ </license>
+ </licenses>
+ <developers>
+ <developer>
+ <organization>Google</organization>
+ <organizationUrl>https://github.com/google</organizationUrl>
+ </developer>
+ </developers>
+ <scm>
+ <connection>scm:git:git://github.com/google/brotli.git</connection>
+ <developerConnection>scm:git:ssh://git@github.com/google/brotli.git</developerConnection>
+ <url>https://github.com/google/brotli</url>
+ </scm>
+
+ <modules>
+ <module>dec</module>
+ </modules>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <id>ossrh</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <profiles>
+ <profile>
+ <id>release-sign-artifacts</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>nexus-staging-maven-plugin</artifactId>
+ <version>1.6.7</version>
+ <extensions>true</extensions>
+ <configuration>
+ <serverId>ossrh</serverId>
+ <nexusUrl>https://oss.sonatype.org/</nexusUrl>
+ <autoReleaseAfterClose>false</autoReleaseAfterClose>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/BUILD b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/BUILD
new file mode 100644
index 000000000..7c3480a09
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/BUILD
@@ -0,0 +1,61 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # MIT
+
+filegroup(
+ name = "jni_src",
+ srcs = ["common_jni.cc"],
+)
+
+filegroup(
+ name = "brotli_jni_no_dictionary_data",
+ srcs = ["//:brotli_jni_no_dictionary_data.dll"],
+)
+
+java_library(
+ name = "common",
+ srcs = glob(
+ ["*.java"],
+ exclude = ["*Test*.java"],
+ ),
+ resource_jars = ["//:license"],
+)
+
+java_library(
+ name = "test_lib",
+ testonly = 1,
+ srcs = glob(["*Test*.java"]),
+ deps = [
+ ":common",
+ "//org/brotli/dec",
+ "//org/brotli/integration:brotli_jni_test_base",
+ "//org/brotli/wrapper/dec",
+ "@junit_junit//jar",
+ ],
+)
+
+java_test(
+ name = "SetZeroDictionaryTest",
+ size = "small",
+ data = [
+ ":brotli_jni_no_dictionary_data", # Bazel JNI workaround
+ ],
+ jvm_flags = [
+ "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni_no_dictionary_data)",
+ ],
+ test_class = "org.brotli.wrapper.common.SetZeroDictionaryTest",
+ runtime_deps = [":test_lib"],
+)
+
+java_test(
+ name = "SetRfcDictionaryTest",
+ size = "small",
+ data = [
+ ":brotli_jni_no_dictionary_data", # Bazel JNI workaround
+ ],
+ jvm_flags = [
+ "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni_no_dictionary_data)",
+ ],
+ test_class = "org.brotli.wrapper.common.SetRfcDictionaryTest",
+ runtime_deps = [":test_lib"],
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/BrotliCommon.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/BrotliCommon.java
new file mode 100644
index 000000000..9419e42d6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/BrotliCommon.java
@@ -0,0 +1,130 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.common;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+/**
+ * JNI wrapper for brotli common.
+ */
+public class BrotliCommon {
+ public static final int RFC_DICTIONARY_SIZE = 122784;
+
+ /* 96cecd2ee7a666d5aa3627d74735b32a */
+ private static final byte[] RFC_DICTIONARY_MD5 = {
+ -106, -50, -51, 46, -25, -90, 102, -43, -86, 54, 39, -41, 71, 53, -77, 42
+ };
+
+ /* 72b41051cb61a9281ba3c4414c289da50d9a7640 */
+ private static final byte[] RFC_DICTIONARY_SHA_1 = {
+ 114, -76, 16, 81, -53, 97, -87, 40, 27, -93, -60, 65, 76, 40, -99, -91, 13, -102, 118, 64
+ };
+
+ /* 20e42eb1b511c21806d4d227d07e5dd06877d8ce7b3a817f378f313653f35c70 */
+ private static final byte[] RFC_DICTIONARY_SHA_256 = {
+ 32, -28, 46, -79, -75, 17, -62, 24, 6, -44, -46, 39, -48, 126, 93, -48,
+ 104, 119, -40, -50, 123, 58, -127, 127, 55, -113, 49, 54, 83, -13, 92, 112
+ };
+
+ private static boolean isDictionaryDataSet;
+ private static final Object mutex = new Object();
+
+ /**
+ * Checks if the given checksum matches MD5 checksum of the RFC dictionary.
+ */
+ public static boolean checkDictionaryDataMd5(byte[] digest) {
+ return Arrays.equals(RFC_DICTIONARY_MD5, digest);
+ }
+
+ /**
+ * Checks if the given checksum matches SHA-1 checksum of the RFC dictionary.
+ */
+ public static boolean checkDictionaryDataSha1(byte[] digest) {
+ return Arrays.equals(RFC_DICTIONARY_SHA_1, digest);
+ }
+
+ /**
+ * Checks if the given checksum matches SHA-256 checksum of the RFC dictionary.
+ */
+ public static boolean checkDictionaryDataSha256(byte[] digest) {
+ return Arrays.equals(RFC_DICTIONARY_SHA_256, digest);
+ }
+
+ /**
+ * Copy bytes to a new direct ByteBuffer.
+ *
+ * Direct byte buffers are used to supply native code with large data chunks.
+ */
+ public static ByteBuffer makeNative(byte[] data) {
+ ByteBuffer result = ByteBuffer.allocateDirect(data.length);
+ result.put(data);
+ return result;
+ }
+
+ /**
+ * Copies data and sets it to be brotli dictionary.
+ */
+ public static void setDictionaryData(byte[] data) {
+ if (data.length != RFC_DICTIONARY_SIZE) {
+ throw new IllegalArgumentException("invalid dictionary size");
+ }
+ synchronized (mutex) {
+ if (isDictionaryDataSet) {
+ return;
+ }
+ setDictionaryData(makeNative(data));
+ }
+ }
+
+ /**
+ * Reads data and sets it to be brotli dictionary.
+ */
+ public static void setDictionaryData(InputStream src) throws IOException {
+ synchronized (mutex) {
+ if (isDictionaryDataSet) {
+ return;
+ }
+ ByteBuffer copy = ByteBuffer.allocateDirect(RFC_DICTIONARY_SIZE);
+ byte[] buffer = new byte[4096];
+ int readBytes;
+ while ((readBytes = src.read(buffer)) != -1) {
+ if (copy.remaining() < readBytes) {
+ throw new IllegalArgumentException("invalid dictionary size");
+ }
+ copy.put(buffer, 0, readBytes);
+ }
+ if (copy.remaining() != 0) {
+ throw new IllegalArgumentException("invalid dictionary size " + copy.remaining());
+ }
+ setDictionaryData(copy);
+ }
+ }
+
+ /**
+ * Sets data to be brotli dictionary.
+ */
+ public static void setDictionaryData(ByteBuffer data) {
+ if (!data.isDirect()) {
+ throw new IllegalArgumentException("direct byte buffer is expected");
+ }
+ if (data.capacity() != RFC_DICTIONARY_SIZE) {
+ throw new IllegalArgumentException("invalid dictionary size");
+ }
+ synchronized (mutex) {
+ if (isDictionaryDataSet) {
+ return;
+ }
+ if (!CommonJNI.nativeSetDictionaryData(data)) {
+ throw new RuntimeException("setting dictionary failed");
+ }
+ isDictionaryDataSet = true;
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/CommonJNI.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/CommonJNI.java
new file mode 100644
index 000000000..d6625461b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/CommonJNI.java
@@ -0,0 +1,16 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.common;
+
+import java.nio.ByteBuffer;
+
+/**
+ * JNI wrapper for brotli common.
+ */
+class CommonJNI {
+ static native boolean nativeSetDictionaryData(ByteBuffer data);
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/SetRfcDictionaryTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/SetRfcDictionaryTest.java
new file mode 100644
index 000000000..a986eaee4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/SetRfcDictionaryTest.java
@@ -0,0 +1,74 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.common;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.brotli.dec.Dictionary;
+import org.brotli.integration.BrotliJniTestBase;
+import org.brotli.wrapper.dec.BrotliInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Tests for {@link BrotliCommon}.
+ */
+@RunWith(JUnit4.class)
+public class SetRfcDictionaryTest extends BrotliJniTestBase {
+
+ @Test
+ public void testRfcDictionaryChecksums() throws NoSuchAlgorithmException {
+ System.err.println(Dictionary.getData().slice().remaining());
+ MessageDigest md5 = MessageDigest.getInstance("MD5");
+ md5.update(Dictionary.getData().slice());
+ assertTrue(BrotliCommon.checkDictionaryDataMd5(md5.digest()));
+
+ MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
+ sha1.update(Dictionary.getData().slice());
+ assertTrue(BrotliCommon.checkDictionaryDataSha1(sha1.digest()));
+
+ MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
+ sha256.update(Dictionary.getData().slice());
+ assertTrue(BrotliCommon.checkDictionaryDataSha256(sha256.digest()));
+ }
+
+ @Test
+ public void testSetRfcDictionary() throws IOException {
+ /* "leftdatadataleft" encoded with dictionary words. */
+ byte[] data = {27, 15, 0, 0, 0, 0, -128, -29, -76, 13, 0, 0, 7, 91, 38, 49, 64, 2, 0, -32, 78,
+ 27, 65, -128, 32, 80, 16, 36, 8, 6};
+ BrotliCommon.setDictionaryData(Dictionary.getData());
+
+ BrotliInputStream decoder = new BrotliInputStream(new ByteArrayInputStream(data));
+ byte[] output = new byte[17];
+ int offset = 0;
+ try {
+ int bytesRead;
+ while ((bytesRead = decoder.read(output, offset, 17 - offset)) != -1) {
+ offset += bytesRead;
+ }
+ } finally {
+ decoder.close();
+ }
+ assertEquals(16, offset);
+ byte[] expected = {
+ 'l', 'e', 'f', 't',
+ 'd', 'a', 't', 'a',
+ 'd', 'a', 't', 'a',
+ 'l', 'e', 'f', 't',
+ 0
+ };
+ assertArrayEquals(expected, output);
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/SetZeroDictionaryTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/SetZeroDictionaryTest.java
new file mode 100644
index 000000000..669939c9f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/SetZeroDictionaryTest.java
@@ -0,0 +1,48 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.common;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+import org.brotli.integration.BrotliJniTestBase;
+import org.brotli.wrapper.dec.BrotliInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Tests for {@link BrotliCommon}.
+ */
+@RunWith(JUnit4.class)
+public class SetZeroDictionaryTest extends BrotliJniTestBase {
+
+ @Test
+ public void testZeroDictionary() throws IOException {
+ /* "leftdatadataleft" encoded with dictionary words. */
+ byte[] data = {27, 15, 0, 0, 0, 0, -128, -29, -76, 13, 0, 0, 7, 91, 38, 49, 64, 2, 0, -32, 78,
+ 27, 65, -128, 32, 80, 16, 36, 8, 6};
+ byte[] dictionary = new byte[BrotliCommon.RFC_DICTIONARY_SIZE];
+ BrotliCommon.setDictionaryData(dictionary);
+
+ BrotliInputStream decoder = new BrotliInputStream(new ByteArrayInputStream(data));
+ byte[] output = new byte[17];
+ int offset = 0;
+ try {
+ int bytesRead;
+ while ((bytesRead = decoder.read(output, offset, 17 - offset)) != -1) {
+ offset += bytesRead;
+ }
+ } finally {
+ decoder.close();
+ }
+ assertEquals(16, offset);
+ assertArrayEquals(new byte[17], output);
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/common_jni.cc b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/common_jni.cc
new file mode 100644
index 000000000..c71ca4955
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/common/common_jni.cc
@@ -0,0 +1,47 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+#include <jni.h>
+
+#include "c/common/dictionary.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Set data to be brotli dictionary data.
+ *
+ * @param buffer direct ByteBuffer
+ * @returns false if dictionary data was already set; otherwise true
+ */
+JNIEXPORT jint JNICALL
+Java_org_brotli_wrapper_common_CommonJNI_nativeSetDictionaryData(
+ JNIEnv* env, jobject /*jobj*/, jobject buffer) {
+ jobject buffer_ref = env->NewGlobalRef(buffer);
+ if (!buffer_ref) {
+ return false;
+ }
+ uint8_t* data = static_cast<uint8_t*>(env->GetDirectBufferAddress(buffer));
+ if (!data) {
+ env->DeleteGlobalRef(buffer_ref);
+ return false;
+ }
+
+ BrotliSetDictionaryData(data);
+
+ const BrotliDictionary* dictionary = BrotliGetDictionary();
+ if (dictionary->data != data) {
+ env->DeleteGlobalRef(buffer_ref);
+ } else {
+ /* Don't release reference; it is an intended memory leak. */
+ }
+ return true;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BUILD b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BUILD
new file mode 100644
index 000000000..d1c8f5ba1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BUILD
@@ -0,0 +1,84 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # MIT
+
+filegroup(
+ name = "jni_src",
+ srcs = ["decoder_jni.cc"],
+)
+
+java_library(
+ name = "dec",
+ srcs = glob(
+ ["*.java"],
+ exclude = ["*Test*.java"],
+ ),
+ resource_jars = ["//:license"],
+)
+
+java_library(
+ name = "test_lib",
+ testonly = 1,
+ srcs = glob(["*Test*.java"]),
+ deps = [
+ ":dec",
+ "//org/brotli/integration:brotli_jni_test_base",
+ "//org/brotli/integration:bundle_helper",
+ "@junit_junit//jar",
+ ],
+)
+
+filegroup(
+ name = "brotli_jni",
+ srcs = ["//:brotli_jni.dll"],
+)
+
+filegroup(
+ name = "test_bundle",
+ srcs = ["//org/brotli/integration:test_data"],
+)
+
+java_test(
+ name = "BrotliDecoderChannelTest",
+ size = "large",
+ data = [
+ ":brotli_jni", # Bazel JNI workaround
+ ":test_bundle",
+ ],
+ jvm_flags = [
+ "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
+ "-DTEST_BUNDLE=$(location :test_bundle)",
+ ],
+ test_class = "org.brotli.wrapper.dec.BrotliDecoderChannelTest",
+ runtime_deps = [":test_lib"],
+)
+
+java_test(
+ name = "BrotliInputStreamTest",
+ size = "large",
+ data = [
+ ":brotli_jni", # Bazel JNI workaround
+ ":test_bundle",
+ ],
+ jvm_flags = [
+ "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
+ "-DTEST_BUNDLE=$(location :test_bundle)",
+ ],
+ test_class = "org.brotli.wrapper.dec.BrotliInputStreamTest",
+ runtime_deps = [":test_lib"],
+)
+
+java_test(
+ name = "DecoderTest",
+ size = "large",
+ data = [
+ ":brotli_jni", # Bazel JNI workaround
+ ":test_bundle",
+ ],
+ jvm_flags = [
+ "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
+ "-DTEST_BUNDLE=$(location :test_bundle)",
+ ],
+ test_class = "org.brotli.wrapper.dec.DecoderTest",
+ runtime_deps = [":test_lib"],
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliDecoderChannel.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliDecoderChannel.java
new file mode 100644
index 000000000..6dfe8f21a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliDecoderChannel.java
@@ -0,0 +1,69 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.dec;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.ReadableByteChannel;
+
+/**
+ * ReadableByteChannel that wraps native brotli decoder.
+ */
+public class BrotliDecoderChannel extends Decoder implements ReadableByteChannel {
+ /** The default internal buffer size used by the decoder. */
+ private static final int DEFAULT_BUFFER_SIZE = 16384;
+
+ private final Object mutex = new Object();
+
+ /**
+ * Creates a BrotliDecoderChannel.
+ *
+ * @param source underlying source
+ * @param bufferSize intermediate buffer size
+ * @param customDictionary initial LZ77 dictionary
+ */
+ public BrotliDecoderChannel(ReadableByteChannel source, int bufferSize) throws IOException {
+ super(source, bufferSize);
+ }
+
+ public BrotliDecoderChannel(ReadableByteChannel source) throws IOException {
+ this(source, DEFAULT_BUFFER_SIZE);
+ }
+
+ @Override
+ public boolean isOpen() {
+ synchronized (mutex) {
+ return !closed;
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ synchronized (mutex) {
+ super.close();
+ }
+ }
+
+ @Override
+ public int read(ByteBuffer dst) throws IOException {
+ synchronized (mutex) {
+ if (closed) {
+ throw new ClosedChannelException();
+ }
+ int result = 0;
+ while (dst.hasRemaining()) {
+ int outputSize = decode();
+ if (outputSize <= 0) {
+ return result == 0 ? outputSize : result;
+ }
+ result += consume(dst);
+ }
+ return result;
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliDecoderChannelTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliDecoderChannelTest.java
new file mode 100644
index 000000000..71d8f68ad
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliDecoderChannelTest.java
@@ -0,0 +1,84 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.dec;
+
+import static org.junit.Assert.assertEquals;
+
+import org.brotli.integration.BrotliJniTestBase;
+import org.brotli.integration.BundleHelper;
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.util.List;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.AllTests;
+
+/** Tests for {@link org.brotli.wrapper.dec.BrotliDecoderChannel}. */
+@RunWith(AllTests.class)
+public class BrotliDecoderChannelTest extends BrotliJniTestBase {
+
+ static InputStream getBundle() throws IOException {
+ return new FileInputStream(System.getProperty("TEST_BUNDLE"));
+ }
+
+ /** Creates a test suite. */
+ public static TestSuite suite() throws IOException {
+ TestSuite suite = new TestSuite();
+ InputStream bundle = getBundle();
+ try {
+ List<String> entries = BundleHelper.listEntries(bundle);
+ for (String entry : entries) {
+ suite.addTest(new ChannelTestCase(entry));
+ }
+ } finally {
+ bundle.close();
+ }
+ return suite;
+ }
+
+ /** Test case with a unique name. */
+ static class ChannelTestCase extends TestCase {
+ final String entryName;
+ ChannelTestCase(String entryName) {
+ super("BrotliDecoderChannelTest." + entryName);
+ this.entryName = entryName;
+ }
+
+ @Override
+ protected void runTest() throws Throwable {
+ BrotliDecoderChannelTest.run(entryName);
+ }
+ }
+
+ private static void run(String entryName) throws Throwable {
+ InputStream bundle = getBundle();
+ byte[] compressed;
+ try {
+ compressed = BundleHelper.readEntry(bundle, entryName);
+ } finally {
+ bundle.close();
+ }
+ if (compressed == null) {
+ throw new RuntimeException("Can't read bundle entry: " + entryName);
+ }
+
+ ReadableByteChannel src = Channels.newChannel(new ByteArrayInputStream(compressed));
+ ReadableByteChannel decoder = new BrotliDecoderChannel(src);
+ long crc;
+ try {
+ crc = BundleHelper.fingerprintStream(Channels.newInputStream(decoder));
+ } finally {
+ decoder.close();
+ }
+ assertEquals(BundleHelper.getExpectedFingerprint(entryName), crc);
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliInputStream.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliInputStream.java
new file mode 100644
index 000000000..6e2e6e5fa
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliInputStream.java
@@ -0,0 +1,115 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.dec;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.channels.Channels;
+
+/**
+ * InputStream that wraps native brotli decoder.
+ */
+public class BrotliInputStream extends InputStream {
+ /** The default internal buffer size used by the decoder. */
+ private static final int DEFAULT_BUFFER_SIZE = 16384;
+
+ private final Decoder decoder;
+
+ /**
+ * Creates a BrotliInputStream.
+ *
+ * @param source underlying source
+ * @param bufferSize intermediate buffer size
+ */
+ public BrotliInputStream(InputStream source, int bufferSize)
+ throws IOException {
+ this.decoder = new Decoder(Channels.newChannel(source), bufferSize);
+ }
+
+ public BrotliInputStream(InputStream source) throws IOException {
+ this(source, DEFAULT_BUFFER_SIZE);
+ }
+
+ public void enableEagerOutput() {
+ decoder.enableEagerOutput();
+ }
+
+ @Override
+ public void close() throws IOException {
+ decoder.close();
+ }
+
+ @Override
+ public int available() {
+ return (decoder.buffer != null) ? decoder.buffer.remaining() : 0;
+ }
+
+ @Override
+ public int read() throws IOException {
+ if (decoder.closed) {
+ throw new IOException("read after close");
+ }
+ int decoded;
+ // Iterate until at leat one byte is decoded, or EOF reached.
+ while (true) {
+ decoded = decoder.decode();
+ if (decoded != 0) {
+ break;
+ }
+ }
+
+ if (decoded == -1) {
+ return -1;
+ }
+ return decoder.buffer.get() & 0xFF;
+ }
+
+ @Override
+ public int read(byte[] b) throws IOException {
+ return read(b, 0, b.length);
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ if (decoder.closed) {
+ throw new IOException("read after close");
+ }
+ if (decoder.decode() == -1) {
+ return -1;
+ }
+ int result = 0;
+ while (len > 0) {
+ int limit = Math.min(len, decoder.buffer.remaining());
+ decoder.buffer.get(b, off, limit);
+ off += limit;
+ len -= limit;
+ result += limit;
+ if (decoder.decode() == -1) {
+ break;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public long skip(long n) throws IOException {
+ if (decoder.closed) {
+ throw new IOException("read after close");
+ }
+ long result = 0;
+ while (n > 0) {
+ if (decoder.decode() == -1) {
+ break;
+ }
+ int limit = (int) Math.min(n, (long) decoder.buffer.remaining());
+ decoder.discard(limit);
+ result += limit;
+ n -= limit;
+ }
+ return result;
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliInputStreamTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliInputStreamTest.java
new file mode 100644
index 000000000..5da7115b6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/BrotliInputStreamTest.java
@@ -0,0 +1,82 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.dec;
+
+import static org.junit.Assert.assertEquals;
+
+import org.brotli.integration.BrotliJniTestBase;
+import org.brotli.integration.BundleHelper;
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.AllTests;
+
+/** Tests for {@link org.brotli.wrapper.dec.BrotliInputStream}. */
+@RunWith(AllTests.class)
+public class BrotliInputStreamTest extends BrotliJniTestBase {
+
+ static InputStream getBundle() throws IOException {
+ return new FileInputStream(System.getProperty("TEST_BUNDLE"));
+ }
+
+ /** Creates a test suite. */
+ public static TestSuite suite() throws IOException {
+ TestSuite suite = new TestSuite();
+ InputStream bundle = getBundle();
+ try {
+ List<String> entries = BundleHelper.listEntries(bundle);
+ for (String entry : entries) {
+ suite.addTest(new StreamTestCase(entry));
+ }
+ } finally {
+ bundle.close();
+ }
+ return suite;
+ }
+
+ /** Test case with a unique name. */
+ static class StreamTestCase extends TestCase {
+ final String entryName;
+ StreamTestCase(String entryName) {
+ super("BrotliInputStreamTest." + entryName);
+ this.entryName = entryName;
+ }
+
+ @Override
+ protected void runTest() throws Throwable {
+ BrotliInputStreamTest.run(entryName);
+ }
+ }
+
+ private static void run(String entryName) throws Throwable {
+ InputStream bundle = getBundle();
+ byte[] compressed;
+ try {
+ compressed = BundleHelper.readEntry(bundle, entryName);
+ } finally {
+ bundle.close();
+ }
+ if (compressed == null) {
+ throw new RuntimeException("Can't read bundle entry: " + entryName);
+ }
+
+ InputStream src = new ByteArrayInputStream(compressed);
+ InputStream decoder = new BrotliInputStream(src);
+ long crc;
+ try {
+ crc = BundleHelper.fingerprintStream(decoder);
+ } finally {
+ decoder.close();
+ }
+ assertEquals(BundleHelper.getExpectedFingerprint(entryName), crc);
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/Decoder.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/Decoder.java
new file mode 100644
index 000000000..26183aba6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/Decoder.java
@@ -0,0 +1,177 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.dec;
+
+import java.io.IOException;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.channels.ReadableByteChannel;
+import java.util.ArrayList;
+
+/**
+ * Base class for InputStream / Channel implementations.
+ */
+public class Decoder {
+ private static final ByteBuffer EMPTY_BUFER = ByteBuffer.allocate(0);
+ private final ReadableByteChannel source;
+ private final DecoderJNI.Wrapper decoder;
+ ByteBuffer buffer;
+ boolean closed;
+ boolean eager;
+
+ /**
+ * Creates a Decoder wrapper.
+ *
+ * @param source underlying source
+ * @param inputBufferSize read buffer size
+ */
+ public Decoder(ReadableByteChannel source, int inputBufferSize)
+ throws IOException {
+ if (inputBufferSize <= 0) {
+ throw new IllegalArgumentException("buffer size must be positive");
+ }
+ if (source == null) {
+ throw new NullPointerException("source can not be null");
+ }
+ this.source = source;
+ this.decoder = new DecoderJNI.Wrapper(inputBufferSize);
+ }
+
+ private void fail(String message) throws IOException {
+ try {
+ close();
+ } catch (IOException ex) {
+ /* Ignore */
+ }
+ throw new IOException(message);
+ }
+
+ public void enableEagerOutput() {
+ this.eager = true;
+ }
+
+ /**
+ * Continue decoding.
+ *
+ * @return -1 if stream is finished, or number of bytes available in read buffer (> 0)
+ */
+ int decode() throws IOException {
+ while (true) {
+ if (buffer != null) {
+ if (!buffer.hasRemaining()) {
+ buffer = null;
+ } else {
+ return buffer.remaining();
+ }
+ }
+
+ switch (decoder.getStatus()) {
+ case DONE:
+ return -1;
+
+ case OK:
+ decoder.push(0);
+ break;
+
+ case NEEDS_MORE_INPUT:
+ // In "eager" more pulling preempts pushing.
+ if (eager && decoder.hasOutput()) {
+ buffer = decoder.pull();
+ break;
+ }
+ ByteBuffer inputBuffer = decoder.getInputBuffer();
+ ((Buffer) inputBuffer).clear();
+ int bytesRead = source.read(inputBuffer);
+ if (bytesRead == -1) {
+ fail("unexpected end of input");
+ }
+ if (bytesRead == 0) {
+ // No input data is currently available.
+ buffer = EMPTY_BUFER;
+ return 0;
+ }
+ decoder.push(bytesRead);
+ break;
+
+ case NEEDS_MORE_OUTPUT:
+ buffer = decoder.pull();
+ break;
+
+ default:
+ fail("corrupted input");
+ }
+ }
+ }
+
+ void discard(int length) {
+ ((Buffer) buffer).position(buffer.position() + length);
+ if (!buffer.hasRemaining()) {
+ buffer = null;
+ }
+ }
+
+ int consume(ByteBuffer dst) {
+ ByteBuffer slice = buffer.slice();
+ int limit = Math.min(slice.remaining(), dst.remaining());
+ ((Buffer) slice).limit(limit);
+ dst.put(slice);
+ discard(limit);
+ return limit;
+ }
+
+ void close() throws IOException {
+ if (closed) {
+ return;
+ }
+ closed = true;
+ decoder.destroy();
+ source.close();
+ }
+
+ /**
+ * Decodes the given data buffer.
+ */
+ public static byte[] decompress(byte[] data) throws IOException {
+ DecoderJNI.Wrapper decoder = new DecoderJNI.Wrapper(data.length);
+ ArrayList<byte[]> output = new ArrayList<byte[]>();
+ int totalOutputSize = 0;
+ try {
+ decoder.getInputBuffer().put(data);
+ decoder.push(data.length);
+ while (decoder.getStatus() != DecoderJNI.Status.DONE) {
+ switch (decoder.getStatus()) {
+ case OK:
+ decoder.push(0);
+ break;
+
+ case NEEDS_MORE_OUTPUT:
+ ByteBuffer buffer = decoder.pull();
+ byte[] chunk = new byte[buffer.remaining()];
+ buffer.get(chunk);
+ output.add(chunk);
+ totalOutputSize += chunk.length;
+ break;
+
+ default:
+ throw new IOException("corrupted input");
+ }
+ }
+ } finally {
+ decoder.destroy();
+ }
+ if (output.size() == 1) {
+ return output.get(0);
+ }
+ byte[] result = new byte[totalOutputSize];
+ int offset = 0;
+ for (byte[] chunk : output) {
+ System.arraycopy(chunk, 0, result, offset, chunk.length);
+ offset += chunk.length;
+ }
+ return result;
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/DecoderJNI.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/DecoderJNI.java
new file mode 100644
index 000000000..2319b1eae
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/DecoderJNI.java
@@ -0,0 +1,121 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.dec;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/**
+ * JNI wrapper for brotli decoder.
+ */
+public class DecoderJNI {
+ private static native ByteBuffer nativeCreate(long[] context);
+ private static native void nativePush(long[] context, int length);
+ private static native ByteBuffer nativePull(long[] context);
+ private static native void nativeDestroy(long[] context);
+
+ public enum Status {
+ ERROR,
+ DONE,
+ NEEDS_MORE_INPUT,
+ NEEDS_MORE_OUTPUT,
+ OK
+ };
+
+ public static class Wrapper {
+ private final long[] context = new long[3];
+ private final ByteBuffer inputBuffer;
+ private Status lastStatus = Status.NEEDS_MORE_INPUT;
+ private boolean fresh = true;
+
+ public Wrapper(int inputBufferSize) throws IOException {
+ this.context[1] = inputBufferSize;
+ this.inputBuffer = nativeCreate(this.context);
+ if (this.context[0] == 0) {
+ throw new IOException("failed to initialize native brotli decoder");
+ }
+ }
+
+ public void push(int length) {
+ if (length < 0) {
+ throw new IllegalArgumentException("negative block length");
+ }
+ if (context[0] == 0) {
+ throw new IllegalStateException("brotli decoder is already destroyed");
+ }
+ if (lastStatus != Status.NEEDS_MORE_INPUT && lastStatus != Status.OK) {
+ throw new IllegalStateException("pushing input to decoder in " + lastStatus + " state");
+ }
+ if (lastStatus == Status.OK && length != 0) {
+ throw new IllegalStateException("pushing input to decoder in OK state");
+ }
+ fresh = false;
+ nativePush(context, length);
+ parseStatus();
+ }
+
+ private void parseStatus() {
+ long status = context[1];
+ if (status == 1) {
+ lastStatus = Status.DONE;
+ } else if (status == 2) {
+ lastStatus = Status.NEEDS_MORE_INPUT;
+ } else if (status == 3) {
+ lastStatus = Status.NEEDS_MORE_OUTPUT;
+ } else if (status == 4) {
+ lastStatus = Status.OK;
+ } else {
+ lastStatus = Status.ERROR;
+ }
+ }
+
+ public Status getStatus() {
+ return lastStatus;
+ }
+
+ public ByteBuffer getInputBuffer() {
+ return inputBuffer;
+ }
+
+ public boolean hasOutput() {
+ return context[2] != 0;
+ }
+
+ public ByteBuffer pull() {
+ if (context[0] == 0) {
+ throw new IllegalStateException("brotli decoder is already destroyed");
+ }
+ if (lastStatus != Status.NEEDS_MORE_OUTPUT && !hasOutput()) {
+ throw new IllegalStateException("pulling output from decoder in " + lastStatus + " state");
+ }
+ fresh = false;
+ ByteBuffer result = nativePull(context);
+ parseStatus();
+ return result;
+ }
+
+ /**
+ * Releases native resources.
+ */
+ public void destroy() {
+ if (context[0] == 0) {
+ throw new IllegalStateException("brotli decoder is already destroyed");
+ }
+ nativeDestroy(context);
+ context[0] = 0;
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ if (context[0] != 0) {
+ /* TODO: log resource leak? */
+ destroy();
+ }
+ super.finalize();
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/DecoderTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/DecoderTest.java
new file mode 100644
index 000000000..74b77d30a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/DecoderTest.java
@@ -0,0 +1,77 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.dec;
+
+import static org.junit.Assert.assertEquals;
+
+import org.brotli.integration.BrotliJniTestBase;
+import org.brotli.integration.BundleHelper;
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.AllTests;
+
+/** Tests for {@link org.brotli.wrapper.dec.Decoder}. */
+@RunWith(AllTests.class)
+public class DecoderTest extends BrotliJniTestBase {
+
+ static InputStream getBundle() throws IOException {
+ return new FileInputStream(System.getProperty("TEST_BUNDLE"));
+ }
+
+ /** Creates a test suite. */
+ public static TestSuite suite() throws IOException {
+ TestSuite suite = new TestSuite();
+ InputStream bundle = getBundle();
+ try {
+ List<String> entries = BundleHelper.listEntries(bundle);
+ for (String entry : entries) {
+ suite.addTest(new DecoderTestCase(entry));
+ }
+ } finally {
+ bundle.close();
+ }
+ return suite;
+ }
+
+ /** Test case with a unique name. */
+ static class DecoderTestCase extends TestCase {
+ final String entryName;
+ DecoderTestCase(String entryName) {
+ super("DecoderTest." + entryName);
+ this.entryName = entryName;
+ }
+
+ @Override
+ protected void runTest() throws Throwable {
+ DecoderTest.run(entryName);
+ }
+ }
+
+ private static void run(String entryName) throws Throwable {
+ InputStream bundle = getBundle();
+ byte[] compressed;
+ try {
+ compressed = BundleHelper.readEntry(bundle, entryName);
+ } finally {
+ bundle.close();
+ }
+ if (compressed == null) {
+ throw new RuntimeException("Can't read bundle entry: " + entryName);
+ }
+
+ byte[] decompressed = Decoder.decompress(compressed);
+
+ long crc = BundleHelper.fingerprintStream(new ByteArrayInputStream(decompressed));
+ assertEquals(BundleHelper.getExpectedFingerprint(entryName), crc);
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/EagerStreamTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/EagerStreamTest.java
new file mode 100755
index 000000000..919f6e3b4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/EagerStreamTest.java
@@ -0,0 +1,75 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.dec;
+
+import static org.junit.Assert.assertEquals;
+
+import org.brotli.integration.BrotliJniTestBase;
+import java.io.IOException;
+import java.io.InputStream;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Tests for {@link org.brotli.wrapper.dec.BrotliInputStream}. */
+@RunWith(JUnit4.class)
+public class EagerStreamTest extends BrotliJniTestBase {
+
+ @Test
+ public void testEagerReading() throws IOException {
+ final StringBuilder log = new StringBuilder();
+ final byte[] data = {0, 0, 16, 42, 3};
+ InputStream source = new InputStream() {
+ int index;
+
+ @Override
+ public int read() {
+ if (index < data.length) {
+ log.append("<").append(index);
+ return data[index++];
+ } else {
+ log.append("<#");
+ return -1;
+ }
+ }
+
+ @Override
+ public int read(byte[] b) throws IOException {
+ return read(b, 0, b.length);
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ if (len < 1) {
+ return 0;
+ }
+ int d = read();
+ if (d == -1) {
+ return 0;
+ }
+ b[off] = (byte) d;
+ return 1;
+ }
+ };
+ BrotliInputStream reader = new BrotliInputStream(source);
+ reader.enableEagerOutput();
+ int count = 0;
+ while (true) {
+ log.append("^").append(count);
+ int b = reader.read();
+ if (b == -1) {
+ log.append(">#");
+ break;
+ } else {
+ log.append(">").append(count++);
+ }
+ }
+ // Lazy log: ^0<0<1<2<3<4>0^1>#
+ assertEquals("^0<0<1<2<3>0^1<4>#", log.toString());
+ }
+
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/decoder_jni.cc b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/decoder_jni.cc
new file mode 100644
index 000000000..268a10b60
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/dec/decoder_jni.cc
@@ -0,0 +1,202 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+#include <jni.h>
+
+#include <new>
+
+#include <brotli/decode.h>
+
+namespace {
+/* A structure used to persist the decoder's state in between calls. */
+typedef struct DecoderHandle {
+ BrotliDecoderState* state;
+
+ uint8_t* input_start;
+ size_t input_offset;
+ size_t input_length;
+} DecoderHandle;
+
+/* Obtain handle from opaque pointer. */
+DecoderHandle* getHandle(void* opaque) {
+ return static_cast<DecoderHandle*>(opaque);
+}
+
+} /* namespace */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Creates a new Decoder.
+ *
+ * Cookie to address created decoder is stored in out_cookie. In case of failure
+ * cookie is 0.
+ *
+ * @param ctx {out_cookie, in_directBufferSize} tuple
+ * @returns direct ByteBuffer if directBufferSize is not 0; otherwise null
+ */
+JNIEXPORT jobject JNICALL
+Java_org_brotli_wrapper_dec_DecoderJNI_nativeCreate(
+ JNIEnv* env, jobject /*jobj*/, jlongArray ctx) {
+ bool ok = true;
+ DecoderHandle* handle = nullptr;
+ jlong context[3];
+ env->GetLongArrayRegion(ctx, 0, 3, context);
+ size_t input_size = context[1];
+ context[0] = 0;
+ context[2] = 0;
+ handle = new (std::nothrow) DecoderHandle();
+ ok = !!handle;
+
+ if (ok) {
+ handle->input_offset = 0;
+ handle->input_length = 0;
+ handle->input_start = nullptr;
+
+ if (input_size == 0) {
+ ok = false;
+ } else {
+ handle->input_start = new (std::nothrow) uint8_t[input_size];
+ ok = !!handle->input_start;
+ }
+ }
+
+ if (ok) {
+ handle->state = BrotliDecoderCreateInstance(nullptr, nullptr, nullptr);
+ ok = !!handle->state;
+ }
+
+ if (ok) {
+ /* TODO: future versions (e.g. when 128-bit architecture comes)
+ might require thread-safe cookie<->handle mapping. */
+ context[0] = reinterpret_cast<jlong>(handle);
+ } else if (!!handle) {
+ if (!!handle->input_start) delete[] handle->input_start;
+ delete handle;
+ }
+
+ env->SetLongArrayRegion(ctx, 0, 3, context);
+
+ if (!ok) {
+ return nullptr;
+ }
+
+ return env->NewDirectByteBuffer(handle->input_start, input_size);
+}
+
+/**
+ * Push data to decoder.
+ *
+ * status codes:
+ * - 0 error happened
+ * - 1 stream is finished, no more input / output expected
+ * - 2 needs more input to process further
+ * - 3 needs more output to process further
+ * - 4 ok, can proceed further without additional input
+ *
+ * @param ctx {in_cookie, out_status} tuple
+ * @param input_length number of bytes provided in input or direct input;
+ * 0 to process further previous input
+ */
+JNIEXPORT void JNICALL
+Java_org_brotli_wrapper_dec_DecoderJNI_nativePush(
+ JNIEnv* env, jobject /*jobj*/, jlongArray ctx, jint input_length) {
+ jlong context[3];
+ env->GetLongArrayRegion(ctx, 0, 3, context);
+ DecoderHandle* handle = getHandle(reinterpret_cast<void*>(context[0]));
+ context[1] = 0; /* ERROR */
+ context[2] = 0;
+ env->SetLongArrayRegion(ctx, 0, 3, context);
+
+ if (input_length != 0) {
+ /* Still have unconsumed data. Workflow is broken. */
+ if (handle->input_offset < handle->input_length) {
+ return;
+ }
+ handle->input_offset = 0;
+ handle->input_length = input_length;
+ }
+
+ /* Actual decompression. */
+ const uint8_t* in = handle->input_start + handle->input_offset;
+ size_t in_size = handle->input_length - handle->input_offset;
+ size_t out_size = 0;
+ BrotliDecoderResult status = BrotliDecoderDecompressStream(
+ handle->state, &in_size, &in, &out_size, nullptr, nullptr);
+ handle->input_offset = handle->input_length - in_size;
+ switch (status) {
+ case BROTLI_DECODER_RESULT_SUCCESS:
+ /* Bytes after stream end are not allowed. */
+ context[1] = (handle->input_offset == handle->input_length) ? 1 : 0;
+ break;
+
+ case BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:
+ context[1] = 2;
+ break;
+
+ case BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:
+ context[1] = 3;
+ break;
+
+ default:
+ context[1] = 0;
+ break;
+ }
+ context[2] = BrotliDecoderHasMoreOutput(handle->state) ? 1 : 0;
+ env->SetLongArrayRegion(ctx, 0, 3, context);
+}
+
+/**
+ * Pull decompressed data from decoder.
+ *
+ * @param ctx {in_cookie, out_status} tuple
+ * @returns direct ByteBuffer; all the produced data MUST be consumed before
+ * any further invocation; null in case of error
+ */
+JNIEXPORT jobject JNICALL
+Java_org_brotli_wrapper_dec_DecoderJNI_nativePull(
+ JNIEnv* env, jobject /*jobj*/, jlongArray ctx) {
+ jlong context[3];
+ env->GetLongArrayRegion(ctx, 0, 3, context);
+ DecoderHandle* handle = getHandle(reinterpret_cast<void*>(context[0]));
+ size_t data_length = 0;
+ const uint8_t* data = BrotliDecoderTakeOutput(handle->state, &data_length);
+ bool hasMoreOutput = !!BrotliDecoderHasMoreOutput(handle->state);
+ if (hasMoreOutput) {
+ context[1] = 3;
+ } else if (BrotliDecoderIsFinished(handle->state)) {
+ /* Bytes after stream end are not allowed. */
+ context[1] = (handle->input_offset == handle->input_length) ? 1 : 0;
+ } else {
+ /* Can proceed, or more data is required? */
+ context[1] = (handle->input_offset == handle->input_length) ? 2 : 4;
+ }
+ context[2] = hasMoreOutput ? 1 : 0;
+ env->SetLongArrayRegion(ctx, 0, 3, context);
+ return env->NewDirectByteBuffer(const_cast<uint8_t*>(data), data_length);
+}
+
+/**
+ * Releases all used resources.
+ *
+ * @param ctx {in_cookie} tuple
+ */
+JNIEXPORT void JNICALL
+Java_org_brotli_wrapper_dec_DecoderJNI_nativeDestroy(
+ JNIEnv* env, jobject /*jobj*/, jlongArray ctx) {
+ jlong context[3];
+ env->GetLongArrayRegion(ctx, 0, 3, context);
+ DecoderHandle* handle = getHandle(reinterpret_cast<void*>(context[0]));
+ BrotliDecoderDestroyInstance(handle->state);
+ delete[] handle->input_start;
+ delete handle;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BUILD b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BUILD
new file mode 100644
index 000000000..9aea6ba0a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BUILD
@@ -0,0 +1,88 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # MIT
+
+filegroup(
+ name = "jni_src",
+ srcs = ["encoder_jni.cc"],
+)
+
+filegroup(
+ name = "brotli_jni",
+ srcs = ["//:brotli_jni.dll"],
+)
+
+java_library(
+ name = "enc",
+ srcs = glob(
+ ["*.java"],
+ exclude = ["*Test*.java"],
+ ),
+ resource_jars = ["//:license"],
+)
+
+java_library(
+ name = "test_lib",
+ testonly = 1,
+ srcs = glob(["*Test*.java"]),
+ deps = [
+ ":enc",
+ "//org/brotli/integration:brotli_jni_test_base",
+ "//org/brotli/integration:bundle_helper",
+ "//org/brotli/wrapper/dec",
+ "@junit_junit//jar",
+ ],
+)
+
+filegroup(
+ name = "test_bundle",
+ srcs = ["//org/brotli/integration:test_corpus"],
+)
+
+java_test(
+ name = "BrotliEncoderChannelTest",
+ size = "large",
+ data = [
+ ":brotli_jni", # Bazel JNI workaround
+ ":test_bundle",
+ ],
+ jvm_flags = [
+ "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
+ "-DTEST_BUNDLE=$(location :test_bundle)",
+ ],
+ shard_count = 15,
+ test_class = "org.brotli.wrapper.enc.BrotliEncoderChannelTest",
+ runtime_deps = [":test_lib"],
+)
+
+java_test(
+ name = "BrotliOutputStreamTest",
+ size = "large",
+ data = [
+ ":brotli_jni", # Bazel JNI workaround
+ ":test_bundle",
+ ],
+ jvm_flags = [
+ "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
+ "-DTEST_BUNDLE=$(location :test_bundle)",
+ ],
+ shard_count = 15,
+ test_class = "org.brotli.wrapper.enc.BrotliOutputStreamTest",
+ runtime_deps = [":test_lib"],
+)
+
+java_test(
+ name = "EncoderTest",
+ size = "large",
+ data = [
+ ":brotli_jni", # Bazel JNI workaround
+ ":test_bundle",
+ ],
+ jvm_flags = [
+ "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
+ "-DTEST_BUNDLE=$(location :test_bundle)",
+ ],
+ shard_count = 15,
+ test_class = "org.brotli.wrapper.enc.EncoderTest",
+ runtime_deps = [":test_lib"],
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliEncoderChannel.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliEncoderChannel.java
new file mode 100644
index 000000000..047c3562e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliEncoderChannel.java
@@ -0,0 +1,77 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.enc;
+
+import java.io.IOException;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.WritableByteChannel;
+
+/**
+ * WritableByteChannel that wraps native brotli encoder.
+ */
+public class BrotliEncoderChannel extends Encoder implements WritableByteChannel {
+ /** The default internal buffer size used by the decoder. */
+ private static final int DEFAULT_BUFFER_SIZE = 16384;
+
+ private final Object mutex = new Object();
+
+ /**
+ * Creates a BrotliEncoderChannel.
+ *
+ * @param destination underlying destination
+ * @param params encoding settings
+ * @param bufferSize intermediate buffer size
+ */
+ public BrotliEncoderChannel(WritableByteChannel destination, Encoder.Parameters params,
+ int bufferSize) throws IOException {
+ super(destination, params, bufferSize);
+ }
+
+ public BrotliEncoderChannel(WritableByteChannel destination, Encoder.Parameters params)
+ throws IOException {
+ this(destination, params, DEFAULT_BUFFER_SIZE);
+ }
+
+ public BrotliEncoderChannel(WritableByteChannel destination) throws IOException {
+ this(destination, new Encoder.Parameters());
+ }
+
+ @Override
+ public boolean isOpen() {
+ synchronized (mutex) {
+ return !closed;
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ synchronized (mutex) {
+ super.close();
+ }
+ }
+
+ @Override
+ public int write(ByteBuffer src) throws IOException {
+ synchronized (mutex) {
+ if (closed) {
+ throw new ClosedChannelException();
+ }
+ int result = 0;
+ while (src.hasRemaining() && encode(EncoderJNI.Operation.PROCESS)) {
+ int limit = Math.min(src.remaining(), inputBuffer.remaining());
+ ByteBuffer slice = src.slice();
+ ((Buffer) slice).limit(limit);
+ inputBuffer.put(slice);
+ result += limit;
+ ((Buffer) src).position(src.position() + limit);
+ }
+ return result;
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliEncoderChannelTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliEncoderChannelTest.java
new file mode 100644
index 000000000..aacc6daea
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliEncoderChannelTest.java
@@ -0,0 +1,118 @@
+package org.brotli.wrapper.enc;
+
+import static org.junit.Assert.assertEquals;
+
+import org.brotli.integration.BrotliJniTestBase;
+import org.brotli.integration.BundleHelper;
+import org.brotli.wrapper.dec.BrotliInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.WritableByteChannel;
+import java.util.List;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.AllTests;
+
+/** Tests for {@link org.brotli.wrapper.enc.BrotliEncoderChannel}. */
+@RunWith(AllTests.class)
+public class BrotliEncoderChannelTest extends BrotliJniTestBase {
+
+ private enum TestMode {
+ WRITE_ALL,
+ WRITE_CHUNKS
+ }
+
+ private static final int CHUNK_SIZE = 256;
+
+ static InputStream getBundle() throws IOException {
+ return new FileInputStream(System.getProperty("TEST_BUNDLE"));
+ }
+
+ /** Creates a test suite. */
+ public static TestSuite suite() throws IOException {
+ TestSuite suite = new TestSuite();
+ InputStream bundle = getBundle();
+ try {
+ List<String> entries = BundleHelper.listEntries(bundle);
+ for (String entry : entries) {
+ suite.addTest(new ChannleTestCase(entry, TestMode.WRITE_ALL));
+ suite.addTest(new ChannleTestCase(entry, TestMode.WRITE_CHUNKS));
+ }
+ } finally {
+ bundle.close();
+ }
+ return suite;
+ }
+
+ /** Test case with a unique name. */
+ static class ChannleTestCase extends TestCase {
+ final String entryName;
+ final TestMode mode;
+ ChannleTestCase(String entryName, TestMode mode) {
+ super("BrotliEncoderChannelTest." + entryName + "." + mode.name());
+ this.entryName = entryName;
+ this.mode = mode;
+ }
+
+ @Override
+ protected void runTest() throws Throwable {
+ BrotliEncoderChannelTest.run(entryName, mode);
+ }
+ }
+
+ private static void run(String entryName, TestMode mode) throws Throwable {
+ InputStream bundle = getBundle();
+ byte[] original;
+ try {
+ original = BundleHelper.readEntry(bundle, entryName);
+ } finally {
+ bundle.close();
+ }
+ if (original == null) {
+ throw new RuntimeException("Can't read bundle entry: " + entryName);
+ }
+
+ if ((mode == TestMode.WRITE_CHUNKS) && (original.length <= CHUNK_SIZE)) {
+ return;
+ }
+
+ ByteArrayOutputStream dst = new ByteArrayOutputStream();
+ WritableByteChannel encoder = new BrotliEncoderChannel(Channels.newChannel(dst));
+ ByteBuffer src = ByteBuffer.wrap(original);
+ try {
+ switch (mode) {
+ case WRITE_ALL:
+ encoder.write(src);
+ break;
+
+ case WRITE_CHUNKS:
+ while (src.hasRemaining()) {
+ int limit = Math.min(CHUNK_SIZE, src.remaining());
+ ByteBuffer slice = src.slice();
+ ((Buffer) slice).limit(limit);
+ ((Buffer) src).position(src.position() + limit);
+ encoder.write(slice);
+ }
+ break;
+ }
+ } finally {
+ encoder.close();
+ }
+
+ InputStream decoder = new BrotliInputStream(new ByteArrayInputStream(dst.toByteArray()));
+ try {
+ long originalCrc = BundleHelper.fingerprintStream(new ByteArrayInputStream(original));
+ long crc = BundleHelper.fingerprintStream(decoder);
+ assertEquals(originalCrc, crc);
+ } finally {
+ decoder.close();
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliOutputStream.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliOutputStream.java
new file mode 100644
index 000000000..5bd395777
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliOutputStream.java
@@ -0,0 +1,87 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.enc;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.channels.Channels;
+
+/**
+ * Output stream that wraps native brotli encoder.
+ */
+public class BrotliOutputStream extends OutputStream {
+ /** The default internal buffer size used by the encoder. */
+ private static final int DEFAULT_BUFFER_SIZE = 16384;
+
+ private final Encoder encoder;
+
+ /**
+ * Creates a BrotliOutputStream.
+ *
+ * @param destination underlying destination
+ * @param params encoding settings
+ * @param bufferSize intermediate buffer size
+ */
+ public BrotliOutputStream(OutputStream destination, Encoder.Parameters params, int bufferSize)
+ throws IOException {
+ this.encoder = new Encoder(Channels.newChannel(destination), params, bufferSize);
+ }
+
+ public BrotliOutputStream(OutputStream destination, Encoder.Parameters params)
+ throws IOException {
+ this(destination, params, DEFAULT_BUFFER_SIZE);
+ }
+
+ public BrotliOutputStream(OutputStream destination) throws IOException {
+ this(destination, new Encoder.Parameters());
+ }
+
+ @Override
+ public void close() throws IOException {
+ encoder.close();
+ }
+
+ @Override
+ public void flush() throws IOException {
+ if (encoder.closed) {
+ throw new IOException("write after close");
+ }
+ encoder.flush();
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ if (encoder.closed) {
+ throw new IOException("write after close");
+ }
+ while (!encoder.encode(EncoderJNI.Operation.PROCESS)) {
+ // Busy-wait loop.
+ }
+ encoder.inputBuffer.put((byte) b);
+ }
+
+ @Override
+ public void write(byte[] b) throws IOException {
+ this.write(b, 0, b.length);
+ }
+
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException {
+ if (encoder.closed) {
+ throw new IOException("write after close");
+ }
+ while (len > 0) {
+ if (!encoder.encode(EncoderJNI.Operation.PROCESS)) {
+ continue;
+ }
+ int limit = Math.min(len, encoder.inputBuffer.remaining());
+ encoder.inputBuffer.put(b, off, limit);
+ off += limit;
+ len -= limit;
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliOutputStreamTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliOutputStreamTest.java
new file mode 100644
index 000000000..699b4b203
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/BrotliOutputStreamTest.java
@@ -0,0 +1,118 @@
+package org.brotli.wrapper.enc;
+
+import static org.junit.Assert.assertEquals;
+
+import org.brotli.integration.BrotliJniTestBase;
+import org.brotli.integration.BundleHelper;
+import org.brotli.wrapper.dec.BrotliInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.AllTests;
+
+/** Tests for {@link org.brotli.wrapper.enc.BrotliOutputStream}. */
+@RunWith(AllTests.class)
+public class BrotliOutputStreamTest extends BrotliJniTestBase {
+
+ private enum TestMode {
+ WRITE_ALL,
+ WRITE_CHUNKS,
+ WRITE_BYTE
+ }
+
+ private static final int CHUNK_SIZE = 256;
+
+ static InputStream getBundle() throws IOException {
+ return new FileInputStream(System.getProperty("TEST_BUNDLE"));
+ }
+
+ /** Creates a test suite. */
+ public static TestSuite suite() throws IOException {
+ TestSuite suite = new TestSuite();
+ InputStream bundle = getBundle();
+ try {
+ List<String> entries = BundleHelper.listEntries(bundle);
+ for (String entry : entries) {
+ suite.addTest(new StreamTestCase(entry, TestMode.WRITE_ALL));
+ suite.addTest(new StreamTestCase(entry, TestMode.WRITE_CHUNKS));
+ suite.addTest(new StreamTestCase(entry, TestMode.WRITE_BYTE));
+ }
+ } finally {
+ bundle.close();
+ }
+ return suite;
+ }
+
+ /** Test case with a unique name. */
+ static class StreamTestCase extends TestCase {
+ final String entryName;
+ final TestMode mode;
+ StreamTestCase(String entryName, TestMode mode) {
+ super("BrotliOutputStreamTest." + entryName + "." + mode.name());
+ this.entryName = entryName;
+ this.mode = mode;
+ }
+
+ @Override
+ protected void runTest() throws Throwable {
+ BrotliOutputStreamTest.run(entryName, mode);
+ }
+ }
+
+ private static void run(String entryName, TestMode mode) throws Throwable {
+ InputStream bundle = getBundle();
+ byte[] original;
+ try {
+ original = BundleHelper.readEntry(bundle, entryName);
+ } finally {
+ bundle.close();
+ }
+ if (original == null) {
+ throw new RuntimeException("Can't read bundle entry: " + entryName);
+ }
+
+ if ((mode == TestMode.WRITE_CHUNKS) && (original.length <= CHUNK_SIZE)) {
+ return;
+ }
+
+ ByteArrayOutputStream dst = new ByteArrayOutputStream();
+ OutputStream encoder = new BrotliOutputStream(dst);
+ try {
+ switch (mode) {
+ case WRITE_ALL:
+ encoder.write(original);
+ break;
+
+ case WRITE_CHUNKS:
+ for (int offset = 0; offset < original.length; offset += CHUNK_SIZE) {
+ encoder.write(original, offset, Math.min(CHUNK_SIZE, original.length - offset));
+ }
+ break;
+
+ case WRITE_BYTE:
+ for (byte singleByte : original) {
+ encoder.write(singleByte);
+ }
+ break;
+ }
+ } finally {
+ encoder.close();
+ }
+
+ InputStream decoder = new BrotliInputStream(new ByteArrayInputStream(dst.toByteArray()));
+ try {
+ long originalCrc = BundleHelper.fingerprintStream(new ByteArrayInputStream(original));
+ long crc = BundleHelper.fingerprintStream(decoder);
+ assertEquals(originalCrc, crc);
+ } finally {
+ decoder.close();
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/EmptyInputTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/EmptyInputTest.java
new file mode 100755
index 000000000..a536381af
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/EmptyInputTest.java
@@ -0,0 +1,29 @@
+/* Copyright 2018 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.enc;
+
+import static org.junit.Assert.assertEquals;
+
+import org.brotli.integration.BrotliJniTestBase;
+import org.brotli.wrapper.dec.Decoder;
+import java.io.IOException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Tests for {@link org.brotli.wrapper.enc.Encoder}. */
+@RunWith(JUnit4.class)
+public class EmptyInputTest extends BrotliJniTestBase {
+ @Test
+ public void testEmptyInput() throws IOException {
+ byte[] data = new byte[0];
+ byte[] encoded = Encoder.compress(data);
+ assertEquals(1, encoded.length);
+ byte[] decoded = Decoder.decompress(encoded);
+ assertEquals(0, decoded.length);
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/Encoder.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/Encoder.java
new file mode 100644
index 000000000..1fde8d64f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/Encoder.java
@@ -0,0 +1,205 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.enc;
+
+import java.io.IOException;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.channels.WritableByteChannel;
+import java.util.ArrayList;
+
+/**
+ * Base class for OutputStream / Channel implementations.
+ */
+public class Encoder {
+ private final WritableByteChannel destination;
+ private final EncoderJNI.Wrapper encoder;
+ private ByteBuffer buffer;
+ final ByteBuffer inputBuffer;
+ boolean closed;
+
+ /**
+ * Brotli encoder settings.
+ */
+ public static final class Parameters {
+ private int quality = -1;
+ private int lgwin = -1;
+
+ public Parameters() { }
+
+ private Parameters(Parameters other) {
+ this.quality = other.quality;
+ this.lgwin = other.lgwin;
+ }
+
+ /**
+ * @param quality compression quality, or -1 for default
+ */
+ public Parameters setQuality(int quality) {
+ if (quality < -1 || quality > 11) {
+ throw new IllegalArgumentException("quality should be in range [0, 11], or -1");
+ }
+ this.quality = quality;
+ return this;
+ }
+
+ /**
+ * @param lgwin log2(LZ window size), or -1 for default
+ */
+ public Parameters setWindow(int lgwin) {
+ if ((lgwin != -1) && ((lgwin < 10) || (lgwin > 24))) {
+ throw new IllegalArgumentException("lgwin should be in range [10, 24], or -1");
+ }
+ this.lgwin = lgwin;
+ return this;
+ }
+ }
+
+ /**
+ * Creates a Encoder wrapper.
+ *
+ * @param destination underlying destination
+ * @param params encoding parameters
+ * @param inputBufferSize read buffer size
+ */
+ Encoder(WritableByteChannel destination, Parameters params, int inputBufferSize)
+ throws IOException {
+ if (inputBufferSize <= 0) {
+ throw new IllegalArgumentException("buffer size must be positive");
+ }
+ if (destination == null) {
+ throw new NullPointerException("destination can not be null");
+ }
+ this.destination = destination;
+ this.encoder = new EncoderJNI.Wrapper(inputBufferSize, params.quality, params.lgwin);
+ this.inputBuffer = this.encoder.getInputBuffer();
+ }
+
+ private void fail(String message) throws IOException {
+ try {
+ close();
+ } catch (IOException ex) {
+ /* Ignore */
+ }
+ throw new IOException(message);
+ }
+
+ /**
+ * @param force repeat pushing until all output is consumed
+ * @return true if all encoder output is consumed
+ */
+ boolean pushOutput(boolean force) throws IOException {
+ while (buffer != null) {
+ if (buffer.hasRemaining()) {
+ destination.write(buffer);
+ }
+ if (!buffer.hasRemaining()) {
+ buffer = null;
+ } else if (!force) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @return true if there is space in inputBuffer.
+ */
+ boolean encode(EncoderJNI.Operation op) throws IOException {
+ boolean force = (op != EncoderJNI.Operation.PROCESS);
+ if (force) {
+ ((Buffer) inputBuffer).limit(inputBuffer.position());
+ } else if (inputBuffer.hasRemaining()) {
+ return true;
+ }
+ boolean hasInput = true;
+ while (true) {
+ if (!encoder.isSuccess()) {
+ fail("encoding failed");
+ } else if (!pushOutput(force)) {
+ return false;
+ } else if (encoder.hasMoreOutput()) {
+ buffer = encoder.pull();
+ } else if (encoder.hasRemainingInput()) {
+ encoder.push(op, 0);
+ } else if (hasInput) {
+ encoder.push(op, inputBuffer.limit());
+ hasInput = false;
+ } else {
+ ((Buffer) inputBuffer).clear();
+ return true;
+ }
+ }
+ }
+
+ void flush() throws IOException {
+ encode(EncoderJNI.Operation.FLUSH);
+ }
+
+ void close() throws IOException {
+ if (closed) {
+ return;
+ }
+ closed = true;
+ try {
+ encode(EncoderJNI.Operation.FINISH);
+ } finally {
+ encoder.destroy();
+ destination.close();
+ }
+ }
+
+ /**
+ * Encodes the given data buffer.
+ */
+ public static byte[] compress(byte[] data, Parameters params) throws IOException {
+ if (data.length == 0) {
+ byte[] empty = new byte[1];
+ empty[0] = 6;
+ return empty;
+ }
+ /* data.length > 0 */
+ EncoderJNI.Wrapper encoder = new EncoderJNI.Wrapper(data.length, params.quality, params.lgwin);
+ ArrayList<byte[]> output = new ArrayList<byte[]>();
+ int totalOutputSize = 0;
+ try {
+ encoder.getInputBuffer().put(data);
+ encoder.push(EncoderJNI.Operation.FINISH, data.length);
+ while (true) {
+ if (!encoder.isSuccess()) {
+ throw new IOException("encoding failed");
+ } else if (encoder.hasMoreOutput()) {
+ ByteBuffer buffer = encoder.pull();
+ byte[] chunk = new byte[buffer.remaining()];
+ buffer.get(chunk);
+ output.add(chunk);
+ totalOutputSize += chunk.length;
+ } else if (!encoder.isFinished()) {
+ encoder.push(EncoderJNI.Operation.FINISH, 0);
+ } else {
+ break;
+ }
+ }
+ } finally {
+ encoder.destroy();
+ }
+ if (output.size() == 1) {
+ return output.get(0);
+ }
+ byte[] result = new byte[totalOutputSize];
+ int offset = 0;
+ for (byte[] chunk : output) {
+ System.arraycopy(chunk, 0, result, offset, chunk.length);
+ offset += chunk.length;
+ }
+ return result;
+ }
+
+ public static byte[] compress(byte[] data) throws IOException {
+ return compress(data, new Parameters());
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/EncoderJNI.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/EncoderJNI.java
new file mode 100644
index 000000000..501362957
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/EncoderJNI.java
@@ -0,0 +1,118 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+package org.brotli.wrapper.enc;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/**
+ * JNI wrapper for brotli encoder.
+ */
+class EncoderJNI {
+ private static native ByteBuffer nativeCreate(long[] context);
+ private static native void nativePush(long[] context, int length);
+ private static native ByteBuffer nativePull(long[] context);
+ private static native void nativeDestroy(long[] context);
+
+ enum Operation {
+ PROCESS,
+ FLUSH,
+ FINISH
+ }
+
+ static class Wrapper {
+ protected final long[] context = new long[5];
+ private final ByteBuffer inputBuffer;
+ private boolean fresh = true;
+
+ Wrapper(int inputBufferSize, int quality, int lgwin)
+ throws IOException {
+ if (inputBufferSize <= 0) {
+ throw new IOException("buffer size must be positive");
+ }
+ this.context[1] = inputBufferSize;
+ this.context[2] = quality;
+ this.context[3] = lgwin;
+ this.inputBuffer = nativeCreate(this.context);
+ if (this.context[0] == 0) {
+ throw new IOException("failed to initialize native brotli encoder");
+ }
+ this.context[1] = 1;
+ this.context[2] = 0;
+ this.context[3] = 0;
+ }
+
+ void push(Operation op, int length) {
+ if (length < 0) {
+ throw new IllegalArgumentException("negative block length");
+ }
+ if (context[0] == 0) {
+ throw new IllegalStateException("brotli encoder is already destroyed");
+ }
+ if (!isSuccess() || hasMoreOutput()) {
+ throw new IllegalStateException("pushing input to encoder in unexpected state");
+ }
+ if (hasRemainingInput() && length != 0) {
+ throw new IllegalStateException("pushing input to encoder over previous input");
+ }
+ context[1] = op.ordinal();
+ fresh = false;
+ nativePush(context, length);
+ }
+
+ boolean isSuccess() {
+ return context[1] != 0;
+ }
+
+ boolean hasMoreOutput() {
+ return context[2] != 0;
+ }
+
+ boolean hasRemainingInput() {
+ return context[3] != 0;
+ }
+
+ boolean isFinished() {
+ return context[4] != 0;
+ }
+
+ ByteBuffer getInputBuffer() {
+ return inputBuffer;
+ }
+
+ ByteBuffer pull() {
+ if (context[0] == 0) {
+ throw new IllegalStateException("brotli encoder is already destroyed");
+ }
+ if (!isSuccess() || !hasMoreOutput()) {
+ throw new IllegalStateException("pulling while data is not ready");
+ }
+ fresh = false;
+ return nativePull(context);
+ }
+
+ /**
+ * Releases native resources.
+ */
+ void destroy() {
+ if (context[0] == 0) {
+ throw new IllegalStateException("brotli encoder is already destroyed");
+ }
+ nativeDestroy(context);
+ context[0] = 0;
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ if (context[0] != 0) {
+ /* TODO: log resource leak? */
+ destroy();
+ }
+ super.finalize();
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/EncoderTest.java b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/EncoderTest.java
new file mode 100644
index 000000000..18ed6470a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/EncoderTest.java
@@ -0,0 +1,80 @@
+package org.brotli.wrapper.enc;
+
+import static org.junit.Assert.assertEquals;
+
+import org.brotli.integration.BrotliJniTestBase;
+import org.brotli.integration.BundleHelper;
+import org.brotli.wrapper.dec.BrotliInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.AllTests;
+
+/** Tests for {@link org.brotli.wrapper.enc.Encoder}. */
+@RunWith(AllTests.class)
+public class EncoderTest extends BrotliJniTestBase {
+ static InputStream getBundle() throws IOException {
+ return new FileInputStream(System.getProperty("TEST_BUNDLE"));
+ }
+
+ /** Creates a test suite. */
+ public static TestSuite suite() throws IOException {
+ TestSuite suite = new TestSuite();
+ InputStream bundle = getBundle();
+ try {
+ List<String> entries = BundleHelper.listEntries(bundle);
+ for (String entry : entries) {
+ suite.addTest(new EncoderTestCase(entry));
+ }
+ } finally {
+ bundle.close();
+ }
+ return suite;
+ }
+
+ /** Test case with a unique name. */
+ static class EncoderTestCase extends TestCase {
+ final String entryName;
+ EncoderTestCase(String entryName) {
+ super("EncoderTest." + entryName);
+ this.entryName = entryName;
+ }
+
+ @Override
+ protected void runTest() throws Throwable {
+ EncoderTest.run(entryName);
+ }
+ }
+
+ private static void run(String entryName) throws Throwable {
+ InputStream bundle = getBundle();
+ byte[] original;
+ try {
+ original = BundleHelper.readEntry(bundle, entryName);
+ } finally {
+ bundle.close();
+ }
+ if (original == null) {
+ throw new RuntimeException("Can't read bundle entry: " + entryName);
+ }
+
+ for (int window = 10; window <= 22; window++) {
+ byte[] compressed =
+ Encoder.compress(original, new Encoder.Parameters().setQuality(6).setWindow(window));
+
+ InputStream decoder = new BrotliInputStream(new ByteArrayInputStream(compressed));
+ try {
+ long originalCrc = BundleHelper.fingerprintStream(new ByteArrayInputStream(original));
+ long crc = BundleHelper.fingerprintStream(decoder);
+ assertEquals(originalCrc, crc);
+ } finally {
+ decoder.close();
+ }
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/encoder_jni.cc b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/encoder_jni.cc
new file mode 100644
index 000000000..5cde6dfb9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/java/org/brotli/wrapper/enc/encoder_jni.cc
@@ -0,0 +1,195 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+#include <jni.h>
+
+#include <new>
+
+#include <brotli/encode.h>
+
+namespace {
+/* A structure used to persist the encoder's state in between calls. */
+typedef struct EncoderHandle {
+ BrotliEncoderState* state;
+
+ uint8_t* input_start;
+ size_t input_offset;
+ size_t input_last;
+} EncoderHandle;
+
+/* Obtain handle from opaque pointer. */
+EncoderHandle* getHandle(void* opaque) {
+ return static_cast<EncoderHandle*>(opaque);
+}
+
+} /* namespace */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Creates a new Encoder.
+ *
+ * Cookie to address created encoder is stored in out_cookie. In case of failure
+ * cookie is 0.
+ *
+ * @param ctx {out_cookie, in_directBufferSize, in_quality, in_lgwin} tuple
+ * @returns direct ByteBuffer if directBufferSize is not 0; otherwise null
+ */
+JNIEXPORT jobject JNICALL
+Java_org_brotli_wrapper_enc_EncoderJNI_nativeCreate(
+ JNIEnv* env, jobject /*jobj*/, jlongArray ctx) {
+ bool ok = true;
+ EncoderHandle* handle = nullptr;
+ jlong context[5];
+ env->GetLongArrayRegion(ctx, 0, 5, context);
+ size_t input_size = context[1];
+ context[0] = 0;
+ handle = new (std::nothrow) EncoderHandle();
+ ok = !!handle;
+
+ if (ok) {
+ handle->input_offset = 0;
+ handle->input_last = 0;
+ handle->input_start = nullptr;
+
+ if (input_size == 0) {
+ ok = false;
+ } else {
+ handle->input_start = new (std::nothrow) uint8_t[input_size];
+ ok = !!handle->input_start;
+ }
+ }
+
+ if (ok) {
+ handle->state = BrotliEncoderCreateInstance(nullptr, nullptr, nullptr);
+ ok = !!handle->state;
+ }
+
+ if (ok) {
+ int quality = context[2];
+ if (quality >= 0) {
+ BrotliEncoderSetParameter(handle->state, BROTLI_PARAM_QUALITY, quality);
+ }
+ int lgwin = context[3];
+ if (lgwin >= 0) {
+ BrotliEncoderSetParameter(handle->state, BROTLI_PARAM_LGWIN, lgwin);
+ }
+ }
+
+ if (ok) {
+ /* TODO: future versions (e.g. when 128-bit architecture comes)
+ might require thread-safe cookie<->handle mapping. */
+ context[0] = reinterpret_cast<jlong>(handle);
+ } else if (!!handle) {
+ if (!!handle->input_start) delete[] handle->input_start;
+ delete handle;
+ }
+
+ env->SetLongArrayRegion(ctx, 0, 1, context);
+
+ if (!ok) {
+ return nullptr;
+ }
+
+ return env->NewDirectByteBuffer(handle->input_start, input_size);
+}
+
+/**
+ * Push data to encoder.
+ *
+ * @param ctx {in_cookie, in_operation_out_success, out_has_more_output,
+ * out_has_remaining_input} tuple
+ * @param input_length number of bytes provided in input or direct input;
+ * 0 to process further previous input
+ */
+JNIEXPORT void JNICALL
+Java_org_brotli_wrapper_enc_EncoderJNI_nativePush(
+ JNIEnv* env, jobject /*jobj*/, jlongArray ctx, jint input_length) {
+ jlong context[5];
+ env->GetLongArrayRegion(ctx, 0, 5, context);
+ EncoderHandle* handle = getHandle(reinterpret_cast<void*>(context[0]));
+ int operation = context[1];
+ context[1] = 0; /* ERROR */
+ env->SetLongArrayRegion(ctx, 0, 5, context);
+
+ BrotliEncoderOperation op;
+ switch (operation) {
+ case 0: op = BROTLI_OPERATION_PROCESS; break;
+ case 1: op = BROTLI_OPERATION_FLUSH; break;
+ case 2: op = BROTLI_OPERATION_FINISH; break;
+ default: return; /* ERROR */
+ }
+
+ if (input_length != 0) {
+ /* Still have unconsumed data. Workflow is broken. */
+ if (handle->input_offset < handle->input_last) {
+ return;
+ }
+ handle->input_offset = 0;
+ handle->input_last = input_length;
+ }
+
+ /* Actual compression. */
+ const uint8_t* in = handle->input_start + handle->input_offset;
+ size_t in_size = handle->input_last - handle->input_offset;
+ size_t out_size = 0;
+ BROTLI_BOOL status = BrotliEncoderCompressStream(
+ handle->state, op, &in_size, &in, &out_size, nullptr, nullptr);
+ handle->input_offset = handle->input_last - in_size;
+ if (!!status) {
+ context[1] = 1;
+ context[2] = BrotliEncoderHasMoreOutput(handle->state) ? 1 : 0;
+ context[3] = (handle->input_offset != handle->input_last) ? 1 : 0;
+ context[4] = BrotliEncoderIsFinished(handle->state) ? 1 : 0;
+ }
+ env->SetLongArrayRegion(ctx, 0, 5, context);
+}
+
+/**
+ * Pull decompressed data from encoder.
+ *
+ * @param ctx {in_cookie, out_success, out_has_more_output,
+ * out_has_remaining_input} tuple
+ * @returns direct ByteBuffer; all the produced data MUST be consumed before
+ * any further invocation; null in case of error
+ */
+JNIEXPORT jobject JNICALL
+Java_org_brotli_wrapper_enc_EncoderJNI_nativePull(
+ JNIEnv* env, jobject /*jobj*/, jlongArray ctx) {
+ jlong context[5];
+ env->GetLongArrayRegion(ctx, 0, 5, context);
+ EncoderHandle* handle = getHandle(reinterpret_cast<void*>(context[0]));
+ size_t data_length = 0;
+ const uint8_t* data = BrotliEncoderTakeOutput(handle->state, &data_length);
+ context[1] = 1;
+ context[2] = BrotliEncoderHasMoreOutput(handle->state) ? 1 : 0;
+ context[3] = (handle->input_offset != handle->input_last) ? 1 : 0;
+ context[4] = BrotliEncoderIsFinished(handle->state) ? 1 : 0;
+ env->SetLongArrayRegion(ctx, 0, 5, context);
+ return env->NewDirectByteBuffer(const_cast<uint8_t*>(data), data_length);
+}
+
+/**
+ * Releases all used resources.
+ *
+ * @param ctx {in_cookie} tuple
+ */
+JNIEXPORT void JNICALL
+Java_org_brotli_wrapper_enc_EncoderJNI_nativeDestroy(
+ JNIEnv* env, jobject /*jobj*/, jlongArray ctx) {
+ jlong context[2];
+ env->GetLongArrayRegion(ctx, 0, 2, context);
+ EncoderHandle* handle = getHandle(reinterpret_cast<void*>(context[0]));
+ BrotliEncoderDestroyInstance(handle->state);
+ delete[] handle->input_start;
+ delete handle;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/BUILD b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/BUILD
new file mode 100644
index 000000000..49c17287c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/BUILD
@@ -0,0 +1,43 @@
+package(
+ default_visibility = ["//visibility:public"],
+)
+
+licenses(["notice"]) # MIT
+
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
+
+# Not a real polyfill. Do NOT use for anything, but tests.
+closure_js_library(
+ name = "polyfill",
+ srcs = ["polyfill.js"],
+ suppress = [
+ "JSC_INVALID_OPERAND_TYPE",
+ "JSC_MISSING_JSDOC",
+ "JSC_STRICT_INEXISTENT_PROPERTY",
+ "JSC_TYPE_MISMATCH",
+ "JSC_UNKNOWN_EXPR_TYPE",
+ ],
+)
+
+# Do NOT use this artifact; it is for test purposes only.
+closure_js_library(
+ name = "decode",
+ srcs = ["decode.js"],
+ suppress = [
+ "JSC_DUP_VAR_DECLARATION",
+ "JSC_USELESS_BLOCK",
+ ],
+ deps = [":polyfill"],
+)
+
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_test")
+
+closure_js_test(
+ name = "all_tests",
+ srcs = ["decode_test.js"],
+ deps = [
+ ":decode",
+ ":polyfill",
+ "@io_bazel_rules_closure//closure/library:testing",
+ ],
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/WORKSPACE b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/WORKSPACE
new file mode 100644
index 000000000..f15740a69
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/WORKSPACE
@@ -0,0 +1,12 @@
+workspace(name = "org_brotli_js")
+
+load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
+
+git_repository(
+ name = "io_bazel_rules_closure",
+ commit = "29ec97e7c85d607ba9e41cab3993fbb13f812c4b",
+ remote = "https://github.com/bazelbuild/rules_closure.git",
+)
+
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")
+closure_repositories()
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/decode.js b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/decode.js
new file mode 100644
index 000000000..7896a5024
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/decode.js
@@ -0,0 +1,2029 @@
+/* Copyright 2017 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/** @return {function(!Int8Array):!Int8Array} */
+function BrotliDecodeClosure() {
+ "use strict";
+
+ /** @type {!Int8Array} */
+ var DICTIONARY_DATA = new Int8Array(0);
+
+ /**
+ * @constructor
+ * @param {!Int8Array} bytes
+ * @struct
+ */
+ function InputStream(bytes) {
+ /** @type {!Int8Array} */
+ this.data = bytes;
+ /** @type {!number} */
+ this.offset = 0;
+ }
+ var MAX_HUFFMAN_TABLE_SIZE = Int32Array.from([256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822, 854, 886, 920, 952, 984, 1016, 1048, 1080]);
+ var CODE_LENGTH_CODE_ORDER = Int32Array.from([1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
+ var DISTANCE_SHORT_CODE_INDEX_OFFSET = Int32Array.from([0, 3, 2, 1, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3]);
+ var DISTANCE_SHORT_CODE_VALUE_OFFSET = Int32Array.from([0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3]);
+ var FIXED_TABLE = Int32Array.from([0x020000, 0x020004, 0x020003, 0x030002, 0x020000, 0x020004, 0x020003, 0x040001, 0x020000, 0x020004, 0x020003, 0x030002, 0x020000, 0x020004, 0x020003, 0x040005]);
+ var DICTIONARY_OFFSETS_BY_LENGTH = Int32Array.from([0, 0, 0, 0, 0, 4096, 9216, 21504, 35840, 44032, 53248, 63488, 74752, 87040, 93696, 100864, 104704, 106752, 108928, 113536, 115968, 118528, 119872, 121280, 122016]);
+ var DICTIONARY_SIZE_BITS_BY_LENGTH = Int32Array.from([0, 0, 0, 0, 10, 10, 11, 11, 10, 10, 10, 10, 10, 9, 9, 8, 7, 7, 8, 7, 7, 6, 6, 5, 5]);
+ var BLOCK_LENGTH_OFFSET = Int32Array.from([1, 5, 9, 13, 17, 25, 33, 41, 49, 65, 81, 97, 113, 145, 177, 209, 241, 305, 369, 497, 753, 1265, 2289, 4337, 8433, 16625]);
+ var BLOCK_LENGTH_N_BITS = Int32Array.from([2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 24]);
+ var INSERT_LENGTH_N_BITS = Int16Array.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0C, 0x0E, 0x18]);
+ var COPY_LENGTH_N_BITS = Int16Array.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x18]);
+ var CMD_LOOKUP = new Int16Array(2816);
+ {
+ unpackCommandLookupTable(CMD_LOOKUP);
+ }
+ /**
+ * @param {number} i
+ * @return {number}
+ */
+ function log2floor(i) {
+ var /** number */ result = -1;
+ var /** number */ step = 16;
+ while (step > 0) {
+ if ((i >>> step) != 0) {
+ result += step;
+ i = i >>> step;
+ }
+ step = step >> 1;
+ }
+ return result + i;
+ }
+ /**
+ * @param {number} npostfix
+ * @param {number} ndirect
+ * @param {number} maxndistbits
+ * @return {number}
+ */
+ function calculateDistanceAlphabetSize(npostfix, ndirect, maxndistbits) {
+ return 16 + ndirect + 2 * (maxndistbits << npostfix);
+ }
+ /**
+ * @param {number} maxDistance
+ * @param {number} npostfix
+ * @param {number} ndirect
+ * @return {number}
+ */
+ function calculateDistanceAlphabetLimit(maxDistance, npostfix, ndirect) {
+ if (maxDistance < ndirect + (2 << npostfix)) {
+ throw "maxDistance is too small";
+ }
+ var /** number */ offset = ((maxDistance - ndirect) >> npostfix) + 4;
+ var /** number */ ndistbits = log2floor(offset) - 1;
+ var /** number */ group = ((ndistbits - 1) << 1) | ((offset >> ndistbits) & 1);
+ return ((group - 1) << npostfix) + (1 << npostfix) + ndirect + 16;
+ }
+ /**
+ * @param {!Int16Array} cmdLookup
+ * @return {void}
+ */
+ function unpackCommandLookupTable(cmdLookup) {
+ var /** !Int16Array */ insertLengthOffsets = new Int16Array(24);
+ var /** !Int16Array */ copyLengthOffsets = new Int16Array(24);
+ copyLengthOffsets[0] = 2;
+ for (var /** number */ i = 0; i < 23; ++i) {
+ insertLengthOffsets[i + 1] = (insertLengthOffsets[i] + (1 << INSERT_LENGTH_N_BITS[i]));
+ copyLengthOffsets[i + 1] = (copyLengthOffsets[i] + (1 << COPY_LENGTH_N_BITS[i]));
+ }
+ for (var /** number */ cmdCode = 0; cmdCode < 704; ++cmdCode) {
+ var /** number */ rangeIdx = cmdCode >>> 6;
+ var /** number */ distanceContextOffset = -4;
+ if (rangeIdx >= 2) {
+ rangeIdx -= 2;
+ distanceContextOffset = 0;
+ }
+ var /** number */ insertCode = (((0x29850 >>> (rangeIdx * 2)) & 0x3) << 3) | ((cmdCode >>> 3) & 7);
+ var /** number */ copyCode = (((0x26244 >>> (rangeIdx * 2)) & 0x3) << 3) | (cmdCode & 7);
+ var /** number */ copyLengthOffset = copyLengthOffsets[copyCode];
+ var /** number */ distanceContext = distanceContextOffset + (copyLengthOffset > 4 ? 3 : copyLengthOffset - 2);
+ var /** number */ index = cmdCode * 4;
+ cmdLookup[index + 0] = (INSERT_LENGTH_N_BITS[insertCode] | (COPY_LENGTH_N_BITS[copyCode] << 8));
+ cmdLookup[index + 1] = insertLengthOffsets[insertCode];
+ cmdLookup[index + 2] = copyLengthOffsets[copyCode];
+ cmdLookup[index + 3] = distanceContext;
+ }
+ }
+ /**
+ * @param {!State} s
+ * @return {number}
+ */
+ function decodeWindowBits(s) {
+ var /** number */ largeWindowEnabled = s.isLargeWindow;
+ s.isLargeWindow = 0;
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ if (readFewBits(s, 1) == 0) {
+ return 16;
+ }
+ var /** number */ n = readFewBits(s, 3);
+ if (n != 0) {
+ return 17 + n;
+ }
+ n = readFewBits(s, 3);
+ if (n != 0) {
+ if (n == 1) {
+ if (largeWindowEnabled == 0) {
+ return -1;
+ }
+ s.isLargeWindow = 1;
+ if (readFewBits(s, 1) == 1) {
+ return -1;
+ }
+ n = readFewBits(s, 6);
+ if (n < 10 || n > 30) {
+ return -1;
+ }
+ return n;
+ } else {
+ return 8 + n;
+ }
+ }
+ return 17;
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function enableEagerOutput(s) {
+ if (s.runningState != 1) {
+ throw "State MUST be freshly initialized";
+ }
+ s.isEager = 1;
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function enableLargeWindow(s) {
+ if (s.runningState != 1) {
+ throw "State MUST be freshly initialized";
+ }
+ s.isLargeWindow = 1;
+ }
+ /**
+ * @param {!State} s
+ * @param {!InputStream} input
+ * @return {void}
+ */
+ function initState(s, input) {
+ if (s.runningState != 0) {
+ throw "State MUST be uninitialized";
+ }
+ s.blockTrees = new Int32Array(3091);
+ s.blockTrees[0] = 7;
+ s.distRbIdx = 3;
+ var /** number */ maxDistanceAlphabetLimit = calculateDistanceAlphabetLimit(0x7FFFFFFC, 3, 15 << 3);
+ s.distExtraBits = new Int8Array(maxDistanceAlphabetLimit);
+ s.distOffset = new Int32Array(maxDistanceAlphabetLimit);
+ s.input = input;
+ initBitReader(s);
+ s.runningState = 1;
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function close(s) {
+ if (s.runningState == 0) {
+ throw "State MUST be initialized";
+ }
+ if (s.runningState == 11) {
+ return;
+ }
+ s.runningState = 11;
+ if (s.input != null) {
+ closeInput(s.input);
+ s.input = null;
+ }
+ }
+ /**
+ * @param {!State} s
+ * @return {number}
+ */
+ function decodeVarLenUnsignedByte(s) {
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ if (readFewBits(s, 1) != 0) {
+ var /** number */ n = readFewBits(s, 3);
+ if (n == 0) {
+ return 1;
+ } else {
+ return readFewBits(s, n) + (1 << n);
+ }
+ }
+ return 0;
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function decodeMetaBlockLength(s) {
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ s.inputEnd = readFewBits(s, 1);
+ s.metaBlockLength = 0;
+ s.isUncompressed = 0;
+ s.isMetadata = 0;
+ if ((s.inputEnd != 0) && readFewBits(s, 1) != 0) {
+ return;
+ }
+ var /** number */ sizeNibbles = readFewBits(s, 2) + 4;
+ if (sizeNibbles == 7) {
+ s.isMetadata = 1;
+ if (readFewBits(s, 1) != 0) {
+ throw "Corrupted reserved bit";
+ }
+ var /** number */ sizeBytes = readFewBits(s, 2);
+ if (sizeBytes == 0) {
+ return;
+ }
+ for (var /** number */ i = 0; i < sizeBytes; i++) {
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ bits = readFewBits(s, 8);
+ if (bits == 0 && i + 1 == sizeBytes && sizeBytes > 1) {
+ throw "Exuberant nibble";
+ }
+ s.metaBlockLength |= bits << (i * 8);
+ }
+ } else {
+ for (var /** number */ i = 0; i < sizeNibbles; i++) {
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ bits = readFewBits(s, 4);
+ if (bits == 0 && i + 1 == sizeNibbles && sizeNibbles > 4) {
+ throw "Exuberant nibble";
+ }
+ s.metaBlockLength |= bits << (i * 4);
+ }
+ }
+ s.metaBlockLength++;
+ if (s.inputEnd == 0) {
+ s.isUncompressed = readFewBits(s, 1);
+ }
+ }
+ /**
+ * @param {!Int32Array} tableGroup
+ * @param {number} tableIdx
+ * @param {!State} s
+ * @return {number}
+ */
+ function readSymbol(tableGroup, tableIdx, s) {
+ var /** number */ offset = tableGroup[tableIdx];
+ var /** number */ val = (s.accumulator32 >>> s.bitOffset);
+ offset += val & 0xFF;
+ var /** number */ bits = tableGroup[offset] >> 16;
+ var /** number */ sym = tableGroup[offset] & 0xFFFF;
+ if (bits <= 8) {
+ s.bitOffset += bits;
+ return sym;
+ }
+ offset += sym;
+ var /** number */ mask = (1 << bits) - 1;
+ offset += (val & mask) >>> 8;
+ s.bitOffset += ((tableGroup[offset] >> 16) + 8);
+ return tableGroup[offset] & 0xFFFF;
+ }
+ /**
+ * @param {!Int32Array} tableGroup
+ * @param {number} tableIdx
+ * @param {!State} s
+ * @return {number}
+ */
+ function readBlockLength(tableGroup, tableIdx, s) {
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ code = readSymbol(tableGroup, tableIdx, s);
+ var /** number */ n = BLOCK_LENGTH_N_BITS[code];
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ return BLOCK_LENGTH_OFFSET[code] + ((n <= 16) ? readFewBits(s, n) : readManyBits(s, n));
+ }
+ /**
+ * @param {!Int32Array} v
+ * @param {number} index
+ * @return {void}
+ */
+ function moveToFront(v, index) {
+ var /** number */ value = v[index];
+ for (; index > 0; index--) {
+ v[index] = v[index - 1];
+ }
+ v[0] = value;
+ }
+ /**
+ * @param {!Int8Array} v
+ * @param {number} vLen
+ * @return {void}
+ */
+ function inverseMoveToFrontTransform(v, vLen) {
+ var /** !Int32Array */ mtf = new Int32Array(256);
+ for (var /** number */ i = 0; i < 256; i++) {
+ mtf[i] = i;
+ }
+ for (var /** number */ i = 0; i < vLen; i++) {
+ var /** number */ index = v[i] & 0xFF;
+ v[i] = mtf[index];
+ if (index != 0) {
+ moveToFront(mtf, index);
+ }
+ }
+ }
+ /**
+ * @param {!Int32Array} codeLengthCodeLengths
+ * @param {number} numSymbols
+ * @param {!Int32Array} codeLengths
+ * @param {!State} s
+ * @return {void}
+ */
+ function readHuffmanCodeLengths(codeLengthCodeLengths, numSymbols, codeLengths, s) {
+ var /** number */ symbol = 0;
+ var /** number */ prevCodeLen = 8;
+ var /** number */ repeat = 0;
+ var /** number */ repeatCodeLen = 0;
+ var /** number */ space = 32768;
+ var /** !Int32Array */ table = new Int32Array(32 + 1);
+ var /** number */ tableIdx = table.length - 1;
+ buildHuffmanTable(table, tableIdx, 5, codeLengthCodeLengths, 18);
+ while (symbol < numSymbols && space > 0) {
+ if (s.halfOffset > 2030) {
+ doReadMoreInput(s);
+ }
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ p = (s.accumulator32 >>> s.bitOffset) & 31;
+ s.bitOffset += table[p] >> 16;
+ var /** number */ codeLen = table[p] & 0xFFFF;
+ if (codeLen < 16) {
+ repeat = 0;
+ codeLengths[symbol++] = codeLen;
+ if (codeLen != 0) {
+ prevCodeLen = codeLen;
+ space -= 32768 >> codeLen;
+ }
+ } else {
+ var /** number */ extraBits = codeLen - 14;
+ var /** number */ newLen = 0;
+ if (codeLen == 16) {
+ newLen = prevCodeLen;
+ }
+ if (repeatCodeLen != newLen) {
+ repeat = 0;
+ repeatCodeLen = newLen;
+ }
+ var /** number */ oldRepeat = repeat;
+ if (repeat > 0) {
+ repeat -= 2;
+ repeat <<= extraBits;
+ }
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ repeat += readFewBits(s, extraBits) + 3;
+ var /** number */ repeatDelta = repeat - oldRepeat;
+ if (symbol + repeatDelta > numSymbols) {
+ throw "symbol + repeatDelta > numSymbols";
+ }
+ for (var /** number */ i = 0; i < repeatDelta; i++) {
+ codeLengths[symbol++] = repeatCodeLen;
+ }
+ if (repeatCodeLen != 0) {
+ space -= repeatDelta << (15 - repeatCodeLen);
+ }
+ }
+ }
+ if (space != 0) {
+ throw "Unused space";
+ }
+ codeLengths.fill(0, symbol, numSymbols);
+ }
+ /**
+ * @param {!Int32Array} symbols
+ * @param {number} length
+ * @return {void}
+ */
+ function checkDupes(symbols, length) {
+ for (var /** number */ i = 0; i < length - 1; ++i) {
+ for (var /** number */ j = i + 1; j < length; ++j) {
+ if (symbols[i] == symbols[j]) {
+ throw "Duplicate simple Huffman code symbol";
+ }
+ }
+ }
+ }
+ /**
+ * @param {number} alphabetSizeMax
+ * @param {number} alphabetSizeLimit
+ * @param {!Int32Array} tableGroup
+ * @param {number} tableIdx
+ * @param {!State} s
+ * @return {number}
+ */
+ function readSimpleHuffmanCode(alphabetSizeMax, alphabetSizeLimit, tableGroup, tableIdx, s) {
+ var /** !Int32Array */ codeLengths = new Int32Array(alphabetSizeLimit);
+ var /** !Int32Array */ symbols = new Int32Array(4);
+ var /** number */ maxBits = 1 + log2floor(alphabetSizeMax - 1);
+ var /** number */ numSymbols = readFewBits(s, 2) + 1;
+ for (var /** number */ i = 0; i < numSymbols; i++) {
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ symbol = readFewBits(s, maxBits);
+ if (symbol >= alphabetSizeLimit) {
+ throw "Can't readHuffmanCode";
+ }
+ symbols[i] = symbol;
+ }
+ checkDupes(symbols, numSymbols);
+ var /** number */ histogramId = numSymbols;
+ if (numSymbols == 4) {
+ histogramId += readFewBits(s, 1);
+ }
+ switch(histogramId) {
+ case 1:
+ codeLengths[symbols[0]] = 1;
+ break;
+ case 2:
+ codeLengths[symbols[0]] = 1;
+ codeLengths[symbols[1]] = 1;
+ break;
+ case 3:
+ codeLengths[symbols[0]] = 1;
+ codeLengths[symbols[1]] = 2;
+ codeLengths[symbols[2]] = 2;
+ break;
+ case 4:
+ codeLengths[symbols[0]] = 2;
+ codeLengths[symbols[1]] = 2;
+ codeLengths[symbols[2]] = 2;
+ codeLengths[symbols[3]] = 2;
+ break;
+ case 5:
+ codeLengths[symbols[0]] = 1;
+ codeLengths[symbols[1]] = 2;
+ codeLengths[symbols[2]] = 3;
+ codeLengths[symbols[3]] = 3;
+ break;
+ default:
+ break;
+ }
+ return buildHuffmanTable(tableGroup, tableIdx, 8, codeLengths, alphabetSizeLimit);
+ }
+ /**
+ * @param {number} alphabetSizeLimit
+ * @param {number} skip
+ * @param {!Int32Array} tableGroup
+ * @param {number} tableIdx
+ * @param {!State} s
+ * @return {number}
+ */
+ function readComplexHuffmanCode(alphabetSizeLimit, skip, tableGroup, tableIdx, s) {
+ var /** !Int32Array */ codeLengths = new Int32Array(alphabetSizeLimit);
+ var /** !Int32Array */ codeLengthCodeLengths = new Int32Array(18);
+ var /** number */ space = 32;
+ var /** number */ numCodes = 0;
+ for (var /** number */ i = skip; i < 18 && space > 0; i++) {
+ var /** number */ codeLenIdx = CODE_LENGTH_CODE_ORDER[i];
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ p = (s.accumulator32 >>> s.bitOffset) & 15;
+ s.bitOffset += FIXED_TABLE[p] >> 16;
+ var /** number */ v = FIXED_TABLE[p] & 0xFFFF;
+ codeLengthCodeLengths[codeLenIdx] = v;
+ if (v != 0) {
+ space -= (32 >> v);
+ numCodes++;
+ }
+ }
+ if (space != 0 && numCodes != 1) {
+ throw "Corrupted Huffman code histogram";
+ }
+ readHuffmanCodeLengths(codeLengthCodeLengths, alphabetSizeLimit, codeLengths, s);
+ return buildHuffmanTable(tableGroup, tableIdx, 8, codeLengths, alphabetSizeLimit);
+ }
+ /**
+ * @param {number} alphabetSizeMax
+ * @param {number} alphabetSizeLimit
+ * @param {!Int32Array} tableGroup
+ * @param {number} tableIdx
+ * @param {!State} s
+ * @return {number}
+ */
+ function readHuffmanCode(alphabetSizeMax, alphabetSizeLimit, tableGroup, tableIdx, s) {
+ if (s.halfOffset > 2030) {
+ doReadMoreInput(s);
+ }
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ simpleCodeOrSkip = readFewBits(s, 2);
+ if (simpleCodeOrSkip == 1) {
+ return readSimpleHuffmanCode(alphabetSizeMax, alphabetSizeLimit, tableGroup, tableIdx, s);
+ } else {
+ return readComplexHuffmanCode(alphabetSizeLimit, simpleCodeOrSkip, tableGroup, tableIdx, s);
+ }
+ }
+ /**
+ * @param {number} contextMapSize
+ * @param {!Int8Array} contextMap
+ * @param {!State} s
+ * @return {number}
+ */
+ function decodeContextMap(contextMapSize, contextMap, s) {
+ if (s.halfOffset > 2030) {
+ doReadMoreInput(s);
+ }
+ var /** number */ numTrees = decodeVarLenUnsignedByte(s) + 1;
+ if (numTrees == 1) {
+ contextMap.fill(0, 0, contextMapSize);
+ return numTrees;
+ }
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ useRleForZeros = readFewBits(s, 1);
+ var /** number */ maxRunLengthPrefix = 0;
+ if (useRleForZeros != 0) {
+ maxRunLengthPrefix = readFewBits(s, 4) + 1;
+ }
+ var /** number */ alphabetSize = numTrees + maxRunLengthPrefix;
+ var /** number */ tableSize = MAX_HUFFMAN_TABLE_SIZE[(alphabetSize + 31) >> 5];
+ var /** !Int32Array */ table = new Int32Array(tableSize + 1);
+ var /** number */ tableIdx = table.length - 1;
+ readHuffmanCode(alphabetSize, alphabetSize, table, tableIdx, s);
+ for (var /** number */ i = 0; i < contextMapSize; ) {
+ if (s.halfOffset > 2030) {
+ doReadMoreInput(s);
+ }
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ code = readSymbol(table, tableIdx, s);
+ if (code == 0) {
+ contextMap[i] = 0;
+ i++;
+ } else if (code <= maxRunLengthPrefix) {
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ reps = (1 << code) + readFewBits(s, code);
+ while (reps != 0) {
+ if (i >= contextMapSize) {
+ throw "Corrupted context map";
+ }
+ contextMap[i] = 0;
+ i++;
+ reps--;
+ }
+ } else {
+ contextMap[i] = (code - maxRunLengthPrefix);
+ i++;
+ }
+ }
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ if (readFewBits(s, 1) == 1) {
+ inverseMoveToFrontTransform(contextMap, contextMapSize);
+ }
+ return numTrees;
+ }
+ /**
+ * @param {!State} s
+ * @param {number} treeType
+ * @param {number} numBlockTypes
+ * @return {number}
+ */
+ function decodeBlockTypeAndLength(s, treeType, numBlockTypes) {
+ var /** !Int32Array */ ringBuffers = s.rings;
+ var /** number */ offset = 4 + treeType * 2;
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ blockType = readSymbol(s.blockTrees, 2 * treeType, s);
+ var /** number */ result = readBlockLength(s.blockTrees, 2 * treeType + 1, s);
+ if (blockType == 1) {
+ blockType = ringBuffers[offset + 1] + 1;
+ } else if (blockType == 0) {
+ blockType = ringBuffers[offset];
+ } else {
+ blockType -= 2;
+ }
+ if (blockType >= numBlockTypes) {
+ blockType -= numBlockTypes;
+ }
+ ringBuffers[offset] = ringBuffers[offset + 1];
+ ringBuffers[offset + 1] = blockType;
+ return result;
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function decodeLiteralBlockSwitch(s) {
+ s.literalBlockLength = decodeBlockTypeAndLength(s, 0, s.numLiteralBlockTypes);
+ var /** number */ literalBlockType = s.rings[5];
+ s.contextMapSlice = literalBlockType << 6;
+ s.literalTreeIdx = s.contextMap[s.contextMapSlice] & 0xFF;
+ var /** number */ contextMode = s.contextModes[literalBlockType];
+ s.contextLookupOffset1 = contextMode << 9;
+ s.contextLookupOffset2 = s.contextLookupOffset1 + 256;
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function decodeCommandBlockSwitch(s) {
+ s.commandBlockLength = decodeBlockTypeAndLength(s, 1, s.numCommandBlockTypes);
+ s.commandTreeIdx = s.rings[7];
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function decodeDistanceBlockSwitch(s) {
+ s.distanceBlockLength = decodeBlockTypeAndLength(s, 2, s.numDistanceBlockTypes);
+ s.distContextMapSlice = s.rings[9] << 2;
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function maybeReallocateRingBuffer(s) {
+ var /** number */ newSize = s.maxRingBufferSize;
+ if (newSize > s.expectedTotalSize) {
+ var /** number */ minimalNewSize = s.expectedTotalSize;
+ while ((newSize >> 1) > minimalNewSize) {
+ newSize >>= 1;
+ }
+ if ((s.inputEnd == 0) && newSize < 16384 && s.maxRingBufferSize >= 16384) {
+ newSize = 16384;
+ }
+ }
+ if (newSize <= s.ringBufferSize) {
+ return;
+ }
+ var /** number */ ringBufferSizeWithSlack = newSize + 37;
+ var /** !Int8Array */ newBuffer = new Int8Array(ringBufferSizeWithSlack);
+ if (s.ringBuffer.length != 0) {
+ newBuffer.set(s.ringBuffer.subarray(0, 0 + s.ringBufferSize), 0);
+ }
+ s.ringBuffer = newBuffer;
+ s.ringBufferSize = newSize;
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function readNextMetablockHeader(s) {
+ if (s.inputEnd != 0) {
+ s.nextRunningState = 10;
+ s.runningState = 12;
+ return;
+ }
+ s.literalTreeGroup = new Int32Array(0);
+ s.commandTreeGroup = new Int32Array(0);
+ s.distanceTreeGroup = new Int32Array(0);
+ if (s.halfOffset > 2030) {
+ doReadMoreInput(s);
+ }
+ decodeMetaBlockLength(s);
+ if ((s.metaBlockLength == 0) && (s.isMetadata == 0)) {
+ return;
+ }
+ if ((s.isUncompressed != 0) || (s.isMetadata != 0)) {
+ jumpToByteBoundary(s);
+ s.runningState = (s.isMetadata != 0) ? 5 : 6;
+ } else {
+ s.runningState = 3;
+ }
+ if (s.isMetadata != 0) {
+ return;
+ }
+ s.expectedTotalSize += s.metaBlockLength;
+ if (s.expectedTotalSize > 1 << 30) {
+ s.expectedTotalSize = 1 << 30;
+ }
+ if (s.ringBufferSize < s.maxRingBufferSize) {
+ maybeReallocateRingBuffer(s);
+ }
+ }
+ /**
+ * @param {!State} s
+ * @param {number} treeType
+ * @param {number} numBlockTypes
+ * @return {number}
+ */
+ function readMetablockPartition(s, treeType, numBlockTypes) {
+ var /** number */ offset = s.blockTrees[2 * treeType];
+ if (numBlockTypes <= 1) {
+ s.blockTrees[2 * treeType + 1] = offset;
+ s.blockTrees[2 * treeType + 2] = offset;
+ return 1 << 28;
+ }
+ var /** number */ blockTypeAlphabetSize = numBlockTypes + 2;
+ offset += readHuffmanCode(blockTypeAlphabetSize, blockTypeAlphabetSize, s.blockTrees, 2 * treeType, s);
+ s.blockTrees[2 * treeType + 1] = offset;
+ var /** number */ blockLengthAlphabetSize = 26;
+ offset += readHuffmanCode(blockLengthAlphabetSize, blockLengthAlphabetSize, s.blockTrees, 2 * treeType + 1, s);
+ s.blockTrees[2 * treeType + 2] = offset;
+ return readBlockLength(s.blockTrees, 2 * treeType + 1, s);
+ }
+ /**
+ * @param {!State} s
+ * @param {number} alphabetSizeLimit
+ * @return {void}
+ */
+ function calculateDistanceLut(s, alphabetSizeLimit) {
+ var /** !Int8Array */ distExtraBits = s.distExtraBits;
+ var /** !Int32Array */ distOffset = s.distOffset;
+ var /** number */ npostfix = s.distancePostfixBits;
+ var /** number */ ndirect = s.numDirectDistanceCodes;
+ var /** number */ postfix = 1 << npostfix;
+ var /** number */ bits = 1;
+ var /** number */ half = 0;
+ var /** number */ i = 16;
+ for (var /** number */ j = 0; j < ndirect; ++j) {
+ distExtraBits[i] = 0;
+ distOffset[i] = j + 1;
+ ++i;
+ }
+ while (i < alphabetSizeLimit) {
+ var /** number */ base = ndirect + ((((2 + half) << bits) - 4) << npostfix) + 1;
+ for (var /** number */ j = 0; j < postfix; ++j) {
+ distExtraBits[i] = bits;
+ distOffset[i] = base + j;
+ ++i;
+ }
+ bits = bits + half;
+ half = half ^ 1;
+ }
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function readMetablockHuffmanCodesAndContextMaps(s) {
+ s.numLiteralBlockTypes = decodeVarLenUnsignedByte(s) + 1;
+ s.literalBlockLength = readMetablockPartition(s, 0, s.numLiteralBlockTypes);
+ s.numCommandBlockTypes = decodeVarLenUnsignedByte(s) + 1;
+ s.commandBlockLength = readMetablockPartition(s, 1, s.numCommandBlockTypes);
+ s.numDistanceBlockTypes = decodeVarLenUnsignedByte(s) + 1;
+ s.distanceBlockLength = readMetablockPartition(s, 2, s.numDistanceBlockTypes);
+ if (s.halfOffset > 2030) {
+ doReadMoreInput(s);
+ }
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ s.distancePostfixBits = readFewBits(s, 2);
+ s.numDirectDistanceCodes = readFewBits(s, 4) << s.distancePostfixBits;
+ s.distancePostfixMask = (1 << s.distancePostfixBits) - 1;
+ s.contextModes = new Int8Array(s.numLiteralBlockTypes);
+ for (var /** number */ i = 0; i < s.numLiteralBlockTypes; ) {
+ var /** number */ limit = min(i + 96, s.numLiteralBlockTypes);
+ for (; i < limit; ++i) {
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ s.contextModes[i] = readFewBits(s, 2);
+ }
+ if (s.halfOffset > 2030) {
+ doReadMoreInput(s);
+ }
+ }
+ s.contextMap = new Int8Array(s.numLiteralBlockTypes << 6);
+ var /** number */ numLiteralTrees = decodeContextMap(s.numLiteralBlockTypes << 6, s.contextMap, s);
+ s.trivialLiteralContext = 1;
+ for (var /** number */ j = 0; j < s.numLiteralBlockTypes << 6; j++) {
+ if (s.contextMap[j] != j >> 6) {
+ s.trivialLiteralContext = 0;
+ break;
+ }
+ }
+ s.distContextMap = new Int8Array(s.numDistanceBlockTypes << 2);
+ var /** number */ numDistTrees = decodeContextMap(s.numDistanceBlockTypes << 2, s.distContextMap, s);
+ s.literalTreeGroup = decodeHuffmanTreeGroup(256, 256, numLiteralTrees, s);
+ s.commandTreeGroup = decodeHuffmanTreeGroup(704, 704, s.numCommandBlockTypes, s);
+ var /** number */ distanceAlphabetSizeMax = calculateDistanceAlphabetSize(s.distancePostfixBits, s.numDirectDistanceCodes, 24);
+ var /** number */ distanceAlphabetSizeLimit = distanceAlphabetSizeMax;
+ if (s.isLargeWindow == 1) {
+ distanceAlphabetSizeMax = calculateDistanceAlphabetSize(s.distancePostfixBits, s.numDirectDistanceCodes, 62);
+ distanceAlphabetSizeLimit = calculateDistanceAlphabetLimit(0x7FFFFFFC, s.distancePostfixBits, s.numDirectDistanceCodes);
+ }
+ s.distanceTreeGroup = decodeHuffmanTreeGroup(distanceAlphabetSizeMax, distanceAlphabetSizeLimit, numDistTrees, s);
+ calculateDistanceLut(s, distanceAlphabetSizeLimit);
+ s.contextMapSlice = 0;
+ s.distContextMapSlice = 0;
+ s.contextLookupOffset1 = s.contextModes[0] * 512;
+ s.contextLookupOffset2 = s.contextLookupOffset1 + 256;
+ s.literalTreeIdx = 0;
+ s.commandTreeIdx = 0;
+ s.rings[4] = 1;
+ s.rings[5] = 0;
+ s.rings[6] = 1;
+ s.rings[7] = 0;
+ s.rings[8] = 1;
+ s.rings[9] = 0;
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function copyUncompressedData(s) {
+ var /** !Int8Array */ ringBuffer = s.ringBuffer;
+ if (s.metaBlockLength <= 0) {
+ reload(s);
+ s.runningState = 2;
+ return;
+ }
+ var /** number */ chunkLength = min(s.ringBufferSize - s.pos, s.metaBlockLength);
+ copyBytes(s, ringBuffer, s.pos, chunkLength);
+ s.metaBlockLength -= chunkLength;
+ s.pos += chunkLength;
+ if (s.pos == s.ringBufferSize) {
+ s.nextRunningState = 6;
+ s.runningState = 12;
+ return;
+ }
+ reload(s);
+ s.runningState = 2;
+ }
+ /**
+ * @param {!State} s
+ * @return {number}
+ */
+ function writeRingBuffer(s) {
+ var /** number */ toWrite = min(s.outputLength - s.outputUsed, s.ringBufferBytesReady - s.ringBufferBytesWritten);
+ if (toWrite != 0) {
+ s.output.set(s.ringBuffer.subarray(s.ringBufferBytesWritten, s.ringBufferBytesWritten + toWrite), s.outputOffset + s.outputUsed);
+ s.outputUsed += toWrite;
+ s.ringBufferBytesWritten += toWrite;
+ }
+ if (s.outputUsed < s.outputLength) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+ /**
+ * @param {number} alphabetSizeMax
+ * @param {number} alphabetSizeLimit
+ * @param {number} n
+ * @param {!State} s
+ * @return {!Int32Array}
+ */
+ function decodeHuffmanTreeGroup(alphabetSizeMax, alphabetSizeLimit, n, s) {
+ var /** number */ maxTableSize = MAX_HUFFMAN_TABLE_SIZE[(alphabetSizeLimit + 31) >> 5];
+ var /** !Int32Array */ group = new Int32Array(n + n * maxTableSize);
+ var /** number */ next = n;
+ for (var /** number */ i = 0; i < n; ++i) {
+ group[i] = next;
+ next += readHuffmanCode(alphabetSizeMax, alphabetSizeLimit, group, i, s);
+ }
+ return group;
+ }
+ /**
+ * @param {!State} s
+ * @return {number}
+ */
+ function calculateFence(s) {
+ var /** number */ result = s.ringBufferSize;
+ if (s.isEager != 0) {
+ result = min(result, s.ringBufferBytesWritten + s.outputLength - s.outputUsed);
+ }
+ return result;
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function decompress(s) {
+ if (s.runningState == 0) {
+ throw "Can't decompress until initialized";
+ }
+ if (s.runningState == 11) {
+ throw "Can't decompress after close";
+ }
+ if (s.runningState == 1) {
+ var /** number */ windowBits = decodeWindowBits(s);
+ if (windowBits == -1) {
+ throw "Invalid 'windowBits' code";
+ }
+ s.maxRingBufferSize = 1 << windowBits;
+ s.maxBackwardDistance = s.maxRingBufferSize - 16;
+ s.runningState = 2;
+ }
+ var /** number */ fence = calculateFence(s);
+ var /** number */ ringBufferMask = s.ringBufferSize - 1;
+ var /** !Int8Array */ ringBuffer = s.ringBuffer;
+ while (s.runningState != 10) {
+ switch(s.runningState) {
+ case 2:
+ if (s.metaBlockLength < 0) {
+ throw "Invalid metablock length";
+ }
+ readNextMetablockHeader(s);
+ fence = calculateFence(s);
+ ringBufferMask = s.ringBufferSize - 1;
+ ringBuffer = s.ringBuffer;
+ continue;
+ case 3:
+ readMetablockHuffmanCodesAndContextMaps(s);
+ s.runningState = 4;
+ case 4:
+ if (s.metaBlockLength <= 0) {
+ s.runningState = 2;
+ continue;
+ }
+ if (s.halfOffset > 2030) {
+ doReadMoreInput(s);
+ }
+ if (s.commandBlockLength == 0) {
+ decodeCommandBlockSwitch(s);
+ }
+ s.commandBlockLength--;
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ cmdCode = readSymbol(s.commandTreeGroup, s.commandTreeIdx, s) << 2;
+ var /** number */ insertAndCopyExtraBits = CMD_LOOKUP[cmdCode];
+ var /** number */ insertLengthOffset = CMD_LOOKUP[cmdCode + 1];
+ var /** number */ copyLengthOffset = CMD_LOOKUP[cmdCode + 2];
+ s.distanceCode = CMD_LOOKUP[cmdCode + 3];
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ extraBits = insertAndCopyExtraBits & 0xFF;
+ s.insertLength = insertLengthOffset + ((extraBits <= 16) ? readFewBits(s, extraBits) : readManyBits(s, extraBits));
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ extraBits = insertAndCopyExtraBits >> 8;
+ s.copyLength = copyLengthOffset + ((extraBits <= 16) ? readFewBits(s, extraBits) : readManyBits(s, extraBits));
+ s.j = 0;
+ s.runningState = 7;
+ case 7:
+ if (s.trivialLiteralContext != 0) {
+ while (s.j < s.insertLength) {
+ if (s.halfOffset > 2030) {
+ doReadMoreInput(s);
+ }
+ if (s.literalBlockLength == 0) {
+ decodeLiteralBlockSwitch(s);
+ }
+ s.literalBlockLength--;
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ ringBuffer[s.pos] = readSymbol(s.literalTreeGroup, s.literalTreeIdx, s);
+ s.pos++;
+ s.j++;
+ if (s.pos >= fence) {
+ s.nextRunningState = 7;
+ s.runningState = 12;
+ break;
+ }
+ }
+ } else {
+ var /** number */ prevByte1 = ringBuffer[(s.pos - 1) & ringBufferMask] & 0xFF;
+ var /** number */ prevByte2 = ringBuffer[(s.pos - 2) & ringBufferMask] & 0xFF;
+ while (s.j < s.insertLength) {
+ if (s.halfOffset > 2030) {
+ doReadMoreInput(s);
+ }
+ if (s.literalBlockLength == 0) {
+ decodeLiteralBlockSwitch(s);
+ }
+ var /** number */ literalContext = LOOKUP[s.contextLookupOffset1 + prevByte1] | LOOKUP[s.contextLookupOffset2 + prevByte2];
+ var /** number */ literalTreeIdx = s.contextMap[s.contextMapSlice + literalContext] & 0xFF;
+ s.literalBlockLength--;
+ prevByte2 = prevByte1;
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ prevByte1 = readSymbol(s.literalTreeGroup, literalTreeIdx, s);
+ ringBuffer[s.pos] = prevByte1;
+ s.pos++;
+ s.j++;
+ if (s.pos >= fence) {
+ s.nextRunningState = 7;
+ s.runningState = 12;
+ break;
+ }
+ }
+ }
+ if (s.runningState != 7) {
+ continue;
+ }
+ s.metaBlockLength -= s.insertLength;
+ if (s.metaBlockLength <= 0) {
+ s.runningState = 4;
+ continue;
+ }
+ var /** number */ distanceCode = s.distanceCode;
+ if (distanceCode < 0) {
+ s.distance = s.rings[s.distRbIdx];
+ } else {
+ if (s.halfOffset > 2030) {
+ doReadMoreInput(s);
+ }
+ if (s.distanceBlockLength == 0) {
+ decodeDistanceBlockSwitch(s);
+ }
+ s.distanceBlockLength--;
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ var /** number */ distTreeIdx = s.distContextMap[s.distContextMapSlice + distanceCode] & 0xFF;
+ distanceCode = readSymbol(s.distanceTreeGroup, distTreeIdx, s);
+ if (distanceCode < 16) {
+ var /** number */ index = (s.distRbIdx + DISTANCE_SHORT_CODE_INDEX_OFFSET[distanceCode]) & 0x3;
+ s.distance = s.rings[index] + DISTANCE_SHORT_CODE_VALUE_OFFSET[distanceCode];
+ if (s.distance < 0) {
+ throw "Negative distance";
+ }
+ } else {
+ var /** number */ extraBits = s.distExtraBits[distanceCode];
+ var /** number */ bits;
+ if (s.bitOffset + extraBits <= 32) {
+ bits = readFewBits(s, extraBits);
+ } else {
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ bits = ((extraBits <= 16) ? readFewBits(s, extraBits) : readManyBits(s, extraBits));
+ }
+ s.distance = s.distOffset[distanceCode] + (bits << s.distancePostfixBits);
+ }
+ }
+ if (s.maxDistance != s.maxBackwardDistance && s.pos < s.maxBackwardDistance) {
+ s.maxDistance = s.pos;
+ } else {
+ s.maxDistance = s.maxBackwardDistance;
+ }
+ if (s.distance > s.maxDistance) {
+ s.runningState = 9;
+ continue;
+ }
+ if (distanceCode > 0) {
+ s.distRbIdx = (s.distRbIdx + 1) & 0x3;
+ s.rings[s.distRbIdx] = s.distance;
+ }
+ if (s.copyLength > s.metaBlockLength) {
+ throw "Invalid backward reference";
+ }
+ s.j = 0;
+ s.runningState = 8;
+ case 8:
+ var /** number */ src = (s.pos - s.distance) & ringBufferMask;
+ var /** number */ dst = s.pos;
+ var /** number */ copyLength = s.copyLength - s.j;
+ var /** number */ srcEnd = src + copyLength;
+ var /** number */ dstEnd = dst + copyLength;
+ if ((srcEnd < ringBufferMask) && (dstEnd < ringBufferMask)) {
+ if (copyLength < 12 || (srcEnd > dst && dstEnd > src)) {
+ for (var /** number */ k = 0; k < copyLength; k += 4) {
+ ringBuffer[dst++] = ringBuffer[src++];
+ ringBuffer[dst++] = ringBuffer[src++];
+ ringBuffer[dst++] = ringBuffer[src++];
+ ringBuffer[dst++] = ringBuffer[src++];
+ }
+ } else {
+ ringBuffer.copyWithin(dst, src, srcEnd);
+ }
+ s.j += copyLength;
+ s.metaBlockLength -= copyLength;
+ s.pos += copyLength;
+ } else {
+ for (; s.j < s.copyLength; ) {
+ ringBuffer[s.pos] = ringBuffer[(s.pos - s.distance) & ringBufferMask];
+ s.metaBlockLength--;
+ s.pos++;
+ s.j++;
+ if (s.pos >= fence) {
+ s.nextRunningState = 8;
+ s.runningState = 12;
+ break;
+ }
+ }
+ }
+ if (s.runningState == 8) {
+ s.runningState = 4;
+ }
+ continue;
+ case 9:
+ if (s.distance > 0x7FFFFFFC) {
+ throw "Invalid backward reference";
+ }
+ if (s.copyLength >= 4 && s.copyLength <= 24) {
+ var /** number */ offset = DICTIONARY_OFFSETS_BY_LENGTH[s.copyLength];
+ var /** number */ wordId = s.distance - s.maxDistance - 1;
+ var /** number */ shift = DICTIONARY_SIZE_BITS_BY_LENGTH[s.copyLength];
+ var /** number */ mask = (1 << shift) - 1;
+ var /** number */ wordIdx = wordId & mask;
+ var /** number */ transformIdx = wordId >>> shift;
+ offset += wordIdx * s.copyLength;
+ if (transformIdx < 121) {
+ var /** number */ len = transformDictionaryWord(ringBuffer, s.pos, DICTIONARY_DATA, offset, s.copyLength, RFC_TRANSFORMS, transformIdx);
+ s.pos += len;
+ s.metaBlockLength -= len;
+ if (s.pos >= fence) {
+ s.nextRunningState = 4;
+ s.runningState = 12;
+ continue;
+ }
+ } else {
+ throw "Invalid backward reference";
+ }
+ } else {
+ throw "Invalid backward reference";
+ }
+ s.runningState = 4;
+ continue;
+ case 5:
+ while (s.metaBlockLength > 0) {
+ if (s.halfOffset > 2030) {
+ doReadMoreInput(s);
+ }
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ readFewBits(s, 8);
+ s.metaBlockLength--;
+ }
+ s.runningState = 2;
+ continue;
+ case 6:
+ copyUncompressedData(s);
+ continue;
+ case 12:
+ s.ringBufferBytesReady = min(s.pos, s.ringBufferSize);
+ s.runningState = 13;
+ case 13:
+ if (writeRingBuffer(s) == 0) {
+ return;
+ }
+ if (s.pos >= s.maxBackwardDistance) {
+ s.maxDistance = s.maxBackwardDistance;
+ }
+ if (s.pos >= s.ringBufferSize) {
+ if (s.pos > s.ringBufferSize) {
+ ringBuffer.copyWithin(0, s.ringBufferSize, s.pos);
+ }
+ s.pos &= ringBufferMask;
+ s.ringBufferBytesWritten = 0;
+ }
+ s.runningState = s.nextRunningState;
+ continue;
+ default:
+ throw "Unexpected state " + s.runningState;
+ }
+ }
+ if (s.runningState == 10) {
+ if (s.metaBlockLength < 0) {
+ throw "Invalid metablock length";
+ }
+ jumpToByteBoundary(s);
+ checkHealth(s, 1);
+ }
+ }
+
+ /**
+ * @constructor
+ * @param {number} numTransforms
+ * @param {number} prefixSuffixLen
+ * @param {number} prefixSuffixCount
+ * @struct
+ */
+ function Transforms(numTransforms, prefixSuffixLen, prefixSuffixCount) {
+ /** @type {!number} */
+ this.numTransforms = 0;
+ /** @type {!Int32Array} */
+ this.triplets = new Int32Array(0);
+ /** @type {!Int8Array} */
+ this.prefixSuffixStorage = new Int8Array(0);
+ /** @type {!Int32Array} */
+ this.prefixSuffixHeads = new Int32Array(0);
+ /** @type {!Int16Array} */
+ this.params = new Int16Array(0);
+ this.numTransforms = numTransforms;
+ this.triplets = new Int32Array(numTransforms * 3);
+ this.params = new Int16Array(numTransforms);
+ this.prefixSuffixStorage = new Int8Array(prefixSuffixLen);
+ this.prefixSuffixHeads = new Int32Array(prefixSuffixCount + 1);
+ }
+
+ var RFC_TRANSFORMS = new Transforms(121, 167, 50);
+ /**
+ * @param {!Int8Array} prefixSuffix
+ * @param {!Int32Array} prefixSuffixHeads
+ * @param {!Int32Array} transforms
+ * @param {!string} prefixSuffixSrc
+ * @param {!string} transformsSrc
+ * @return {void}
+ */
+ function unpackTransforms(prefixSuffix, prefixSuffixHeads, transforms, prefixSuffixSrc, transformsSrc) {
+ var /** number */ n = prefixSuffixSrc.length;
+ var /** number */ index = 1;
+ var /** number */ j = 0;
+ for (var /** number */ i = 0; i < n; ++i) {
+ var /** number */ c = prefixSuffixSrc.charCodeAt(i);
+ if (c == 35) {
+ prefixSuffixHeads[index++] = j;
+ } else {
+ prefixSuffix[j++] = c;
+ }
+ }
+ for (var /** number */ i = 0; i < 363; ++i) {
+ transforms[i] = transformsSrc.charCodeAt(i) - 32;
+ }
+ }
+ {
+ unpackTransforms(RFC_TRANSFORMS.prefixSuffixStorage, RFC_TRANSFORMS.prefixSuffixHeads, RFC_TRANSFORMS.triplets, "# #s #, #e #.# the #.com/#\u00C2\u00A0# of # and # in # to #\"#\">#\n#]# for # a # that #. # with #'# from # by #. The # on # as # is #ing #\n\t#:#ed #(# at #ly #=\"# of the #. This #,# not #er #al #='#ful #ive #less #est #ize #ous #", " !! ! , *! &! \" ! ) * * - ! # ! #!*! + ,$ ! - % . / # 0 1 . \" 2 3!* 4% ! # / 5 6 7 8 0 1 & $ 9 + : ; < ' != > ?! 4 @ 4 2 & A *# ( B C& ) % ) !*# *-% A +! *. D! %' & E *6 F G% ! *A *% H! D I!+! J!+ K +- *4! A L!*4 M N +6 O!*% +.! K *G P +%( ! G *D +D Q +# *K!*G!+D!+# +G +A +4!+% +K!+4!*D!+K!*K");
+ }
+ /**
+ * @param {!Int8Array} dst
+ * @param {number} dstOffset
+ * @param {!Int8Array} src
+ * @param {number} srcOffset
+ * @param {number} len
+ * @param {!Transforms} transforms
+ * @param {number} transformIndex
+ * @return {number}
+ */
+ function transformDictionaryWord(dst, dstOffset, src, srcOffset, len, transforms, transformIndex) {
+ var /** number */ offset = dstOffset;
+ var /** !Int32Array */ triplets = transforms.triplets;
+ var /** !Int8Array */ prefixSuffixStorage = transforms.prefixSuffixStorage;
+ var /** !Int32Array */ prefixSuffixHeads = transforms.prefixSuffixHeads;
+ var /** number */ transformOffset = 3 * transformIndex;
+ var /** number */ prefixIdx = triplets[transformOffset];
+ var /** number */ transformType = triplets[transformOffset + 1];
+ var /** number */ suffixIdx = triplets[transformOffset + 2];
+ var /** number */ prefix = prefixSuffixHeads[prefixIdx];
+ var /** number */ prefixEnd = prefixSuffixHeads[prefixIdx + 1];
+ var /** number */ suffix = prefixSuffixHeads[suffixIdx];
+ var /** number */ suffixEnd = prefixSuffixHeads[suffixIdx + 1];
+ var /** number */ omitFirst = transformType - 11;
+ var /** number */ omitLast = transformType - 0;
+ if (omitFirst < 1 || omitFirst > 9) {
+ omitFirst = 0;
+ }
+ if (omitLast < 1 || omitLast > 9) {
+ omitLast = 0;
+ }
+ while (prefix != prefixEnd) {
+ dst[offset++] = prefixSuffixStorage[prefix++];
+ }
+ if (omitFirst > len) {
+ omitFirst = len;
+ }
+ srcOffset += omitFirst;
+ len -= omitFirst;
+ len -= omitLast;
+ var /** number */ i = len;
+ while (i > 0) {
+ dst[offset++] = src[srcOffset++];
+ i--;
+ }
+ if (transformType == 10 || transformType == 11) {
+ var /** number */ uppercaseOffset = offset - len;
+ if (transformType == 10) {
+ len = 1;
+ }
+ while (len > 0) {
+ var /** number */ c0 = dst[uppercaseOffset] & 0xFF;
+ if (c0 < 0xC0) {
+ if (c0 >= 97 && c0 <= 122) {
+ dst[uppercaseOffset] ^= 32;
+ }
+ uppercaseOffset += 1;
+ len -= 1;
+ } else if (c0 < 0xE0) {
+ dst[uppercaseOffset + 1] ^= 32;
+ uppercaseOffset += 2;
+ len -= 2;
+ } else {
+ dst[uppercaseOffset + 2] ^= 5;
+ uppercaseOffset += 3;
+ len -= 3;
+ }
+ }
+ } else if (transformType == 21 || transformType == 22) {
+ var /** number */ shiftOffset = offset - len;
+ var /** number */ param = transforms.params[transformIndex];
+ var /** number */ scalar = (param & 0x7FFF) + (0x1000000 - (param & 0x8000));
+ while (len > 0) {
+ var /** number */ step = 1;
+ var /** number */ c0 = dst[shiftOffset] & 0xFF;
+ if (c0 < 0x80) {
+ scalar += c0;
+ dst[shiftOffset] = (scalar & 0x7F);
+ } else if (c0 < 0xC0) {
+ } else if (c0 < 0xE0) {
+ if (len >= 2) {
+ var /** number */ c1 = dst[shiftOffset + 1];
+ scalar += (c1 & 0x3F) | ((c0 & 0x1F) << 6);
+ dst[shiftOffset] = (0xC0 | ((scalar >> 6) & 0x1F));
+ dst[shiftOffset + 1] = ((c1 & 0xC0) | (scalar & 0x3F));
+ step = 2;
+ } else {
+ step = len;
+ }
+ } else if (c0 < 0xF0) {
+ if (len >= 3) {
+ var /** number */ c1 = dst[shiftOffset + 1];
+ var /** number */ c2 = dst[shiftOffset + 2];
+ scalar += (c2 & 0x3F) | ((c1 & 0x3F) << 6) | ((c0 & 0x0F) << 12);
+ dst[shiftOffset] = (0xE0 | ((scalar >> 12) & 0x0F));
+ dst[shiftOffset + 1] = ((c1 & 0xC0) | ((scalar >> 6) & 0x3F));
+ dst[shiftOffset + 2] = ((c2 & 0xC0) | (scalar & 0x3F));
+ step = 3;
+ } else {
+ step = len;
+ }
+ } else if (c0 < 0xF8) {
+ if (len >= 4) {
+ var /** number */ c1 = dst[shiftOffset + 1];
+ var /** number */ c2 = dst[shiftOffset + 2];
+ var /** number */ c3 = dst[shiftOffset + 3];
+ scalar += (c3 & 0x3F) | ((c2 & 0x3F) << 6) | ((c1 & 0x3F) << 12) | ((c0 & 0x07) << 18);
+ dst[shiftOffset] = (0xF0 | ((scalar >> 18) & 0x07));
+ dst[shiftOffset + 1] = ((c1 & 0xC0) | ((scalar >> 12) & 0x3F));
+ dst[shiftOffset + 2] = ((c2 & 0xC0) | ((scalar >> 6) & 0x3F));
+ dst[shiftOffset + 3] = ((c3 & 0xC0) | (scalar & 0x3F));
+ step = 4;
+ } else {
+ step = len;
+ }
+ }
+ shiftOffset += step;
+ len -= step;
+ if (transformType == 21) {
+ len = 0;
+ }
+ }
+ }
+ while (suffix != suffixEnd) {
+ dst[offset++] = prefixSuffixStorage[suffix++];
+ }
+ return offset - dstOffset;
+ }
+
+ /**
+ * @param {number} key
+ * @param {number} len
+ * @return {number}
+ */
+ function getNextKey(key, len) {
+ var /** number */ step = 1 << (len - 1);
+ while ((key & step) != 0) {
+ step >>= 1;
+ }
+ return (key & (step - 1)) + step;
+ }
+ /**
+ * @param {!Int32Array} table
+ * @param {number} offset
+ * @param {number} step
+ * @param {number} end
+ * @param {number} item
+ * @return {void}
+ */
+ function replicateValue(table, offset, step, end, item) {
+ do {
+ end -= step;
+ table[offset + end] = item;
+ } while (end > 0);
+ }
+ /**
+ * @param {!Int32Array} count
+ * @param {number} len
+ * @param {number} rootBits
+ * @return {number}
+ */
+ function nextTableBitSize(count, len, rootBits) {
+ var /** number */ left = 1 << (len - rootBits);
+ while (len < 15) {
+ left -= count[len];
+ if (left <= 0) {
+ break;
+ }
+ len++;
+ left <<= 1;
+ }
+ return len - rootBits;
+ }
+ /**
+ * @param {!Int32Array} tableGroup
+ * @param {number} tableIdx
+ * @param {number} rootBits
+ * @param {!Int32Array} codeLengths
+ * @param {number} codeLengthsSize
+ * @return {number}
+ */
+ function buildHuffmanTable(tableGroup, tableIdx, rootBits, codeLengths, codeLengthsSize) {
+ var /** number */ tableOffset = tableGroup[tableIdx];
+ var /** number */ key;
+ var /** !Int32Array */ sorted = new Int32Array(codeLengthsSize);
+ var /** !Int32Array */ count = new Int32Array(16);
+ var /** !Int32Array */ offset = new Int32Array(16);
+ var /** number */ symbol;
+ for (symbol = 0; symbol < codeLengthsSize; symbol++) {
+ count[codeLengths[symbol]]++;
+ }
+ offset[1] = 0;
+ for (var /** number */ len = 1; len < 15; len++) {
+ offset[len + 1] = offset[len] + count[len];
+ }
+ for (symbol = 0; symbol < codeLengthsSize; symbol++) {
+ if (codeLengths[symbol] != 0) {
+ sorted[offset[codeLengths[symbol]]++] = symbol;
+ }
+ }
+ var /** number */ tableBits = rootBits;
+ var /** number */ tableSize = 1 << tableBits;
+ var /** number */ totalSize = tableSize;
+ if (offset[15] == 1) {
+ for (key = 0; key < totalSize; key++) {
+ tableGroup[tableOffset + key] = sorted[0];
+ }
+ return totalSize;
+ }
+ key = 0;
+ symbol = 0;
+ for (var /** number */ len = 1, step = 2; len <= rootBits; len++, step <<= 1) {
+ for (; count[len] > 0; count[len]--) {
+ replicateValue(tableGroup, tableOffset + key, step, tableSize, len << 16 | sorted[symbol++]);
+ key = getNextKey(key, len);
+ }
+ }
+ var /** number */ mask = totalSize - 1;
+ var /** number */ low = -1;
+ var /** number */ currentOffset = tableOffset;
+ for (var /** number */ len = rootBits + 1, step = 2; len <= 15; len++, step <<= 1) {
+ for (; count[len] > 0; count[len]--) {
+ if ((key & mask) != low) {
+ currentOffset += tableSize;
+ tableBits = nextTableBitSize(count, len, rootBits);
+ tableSize = 1 << tableBits;
+ totalSize += tableSize;
+ low = key & mask;
+ tableGroup[tableOffset + low] = (tableBits + rootBits) << 16 | (currentOffset - tableOffset - low);
+ }
+ replicateValue(tableGroup, currentOffset + (key >> rootBits), step, tableSize, (len - rootBits) << 16 | sorted[symbol++]);
+ key = getNextKey(key, len);
+ }
+ }
+ return totalSize;
+ }
+
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function doReadMoreInput(s) {
+ if (s.endOfStreamReached != 0) {
+ if (halfAvailable(s) >= -2) {
+ return;
+ }
+ throw "No more input";
+ }
+ var /** number */ readOffset = s.halfOffset << 1;
+ var /** number */ bytesInBuffer = 4096 - readOffset;
+ s.byteBuffer.copyWithin(0, readOffset, 4096);
+ s.halfOffset = 0;
+ while (bytesInBuffer < 4096) {
+ var /** number */ spaceLeft = 4096 - bytesInBuffer;
+ var /** number */ len = readInput(s.input, s.byteBuffer, bytesInBuffer, spaceLeft);
+ if (len <= 0) {
+ s.endOfStreamReached = 1;
+ s.tailBytes = bytesInBuffer;
+ bytesInBuffer += 1;
+ break;
+ }
+ bytesInBuffer += len;
+ }
+ bytesToNibbles(s, bytesInBuffer);
+ }
+ /**
+ * @param {!State} s
+ * @param {number} endOfStream
+ * @return {void}
+ */
+ function checkHealth(s, endOfStream) {
+ if (s.endOfStreamReached == 0) {
+ return;
+ }
+ var /** number */ byteOffset = (s.halfOffset << 1) + ((s.bitOffset + 7) >> 3) - 4;
+ if (byteOffset > s.tailBytes) {
+ throw "Read after end";
+ }
+ if ((endOfStream != 0) && (byteOffset != s.tailBytes)) {
+ throw "Unused bytes after end";
+ }
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function assertAccumulatorHealthy(s) {
+ if (s.bitOffset > 32) {
+ throw "Accumulator underloaded: " + s.bitOffset;
+ }
+ }
+ /**
+ * @param {!State} s
+ * @param {number} n
+ * @return {number}
+ */
+ function readFewBits(s, n) {
+ var /** number */ val = (s.accumulator32 >>> s.bitOffset) & ((1 << n) - 1);
+ s.bitOffset += n;
+ return val;
+ }
+ /**
+ * @param {!State} s
+ * @param {number} n
+ * @return {number}
+ */
+ function readManyBits(s, n) {
+ var /** number */ low = readFewBits(s, 16);
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ return low | (readFewBits(s, n - 16) << 16);
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function initBitReader(s) {
+ s.byteBuffer = new Int8Array(4160);
+ s.accumulator32 = 0;
+ s.shortBuffer = new Int16Array(2080);
+ s.bitOffset = 32;
+ s.halfOffset = 2048;
+ s.endOfStreamReached = 0;
+ prepare(s);
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function prepare(s) {
+ if (s.halfOffset > 2030) {
+ doReadMoreInput(s);
+ }
+ checkHealth(s, 0);
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function reload(s) {
+ if (s.bitOffset == 32) {
+ prepare(s);
+ }
+ }
+ /**
+ * @param {!State} s
+ * @return {void}
+ */
+ function jumpToByteBoundary(s) {
+ var /** number */ padding = (32 - s.bitOffset) & 7;
+ if (padding != 0) {
+ var /** number */ paddingBits = readFewBits(s, padding);
+ if (paddingBits != 0) {
+ throw "Corrupted padding bits";
+ }
+ }
+ }
+ /**
+ * @param {!State} s
+ * @return {number}
+ */
+ function halfAvailable(s) {
+ var /** number */ limit = 2048;
+ if (s.endOfStreamReached != 0) {
+ limit = (s.tailBytes + 1) >> 1;
+ }
+ return limit - s.halfOffset;
+ }
+ /**
+ * @param {!State} s
+ * @param {!Int8Array} data
+ * @param {number} offset
+ * @param {number} length
+ * @return {void}
+ */
+ function copyBytes(s, data, offset, length) {
+ if ((s.bitOffset & 7) != 0) {
+ throw "Unaligned copyBytes";
+ }
+ while ((s.bitOffset != 32) && (length != 0)) {
+ data[offset++] = (s.accumulator32 >>> s.bitOffset);
+ s.bitOffset += 8;
+ length--;
+ }
+ if (length == 0) {
+ return;
+ }
+ var /** number */ copyNibbles = min(halfAvailable(s), length >> 1);
+ if (copyNibbles > 0) {
+ var /** number */ readOffset = s.halfOffset << 1;
+ var /** number */ delta = copyNibbles << 1;
+ data.set(s.byteBuffer.subarray(readOffset, readOffset + delta), offset);
+ offset += delta;
+ length -= delta;
+ s.halfOffset += copyNibbles;
+ }
+ if (length == 0) {
+ return;
+ }
+ if (halfAvailable(s) > 0) {
+ if (s.bitOffset >= 16) {
+ s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
+ s.bitOffset -= 16;
+ }
+ while (length != 0) {
+ data[offset++] = (s.accumulator32 >>> s.bitOffset);
+ s.bitOffset += 8;
+ length--;
+ }
+ checkHealth(s, 0);
+ return;
+ }
+ while (length > 0) {
+ var /** number */ len = readInput(s.input, data, offset, length);
+ if (len == -1) {
+ throw "Unexpected end of input";
+ }
+ offset += len;
+ length -= len;
+ }
+ }
+ /**
+ * @param {!State} s
+ * @param {number} byteLen
+ * @return {void}
+ */
+ function bytesToNibbles(s, byteLen) {
+ var /** !Int8Array */ byteBuffer = s.byteBuffer;
+ var /** number */ halfLen = byteLen >> 1;
+ var /** !Int16Array */ shortBuffer = s.shortBuffer;
+ for (var /** number */ i = 0; i < halfLen; ++i) {
+ shortBuffer[i] = ((byteBuffer[i * 2] & 0xFF) | ((byteBuffer[(i * 2) + 1] & 0xFF) << 8));
+ }
+ }
+
+ var LOOKUP = new Int32Array(2048);
+ /**
+ * @param {!Int32Array} lookup
+ * @param {!string} map
+ * @param {!string} rle
+ * @return {void}
+ */
+ function unpackLookupTable(lookup, map, rle) {
+ for (var /** number */ i = 0; i < 256; ++i) {
+ lookup[i] = i & 0x3F;
+ lookup[512 + i] = i >> 2;
+ lookup[1792 + i] = 2 + (i >> 6);
+ }
+ for (var /** number */ i = 0; i < 128; ++i) {
+ lookup[1024 + i] = 4 * (map.charCodeAt(i) - 32);
+ }
+ for (var /** number */ i = 0; i < 64; ++i) {
+ lookup[1152 + i] = i & 1;
+ lookup[1216 + i] = 2 + (i & 1);
+ }
+ var /** number */ offset = 1280;
+ for (var /** number */ k = 0; k < 19; ++k) {
+ var /** number */ value = k & 3;
+ var /** number */ rep = rle.charCodeAt(k) - 32;
+ for (var /** number */ i = 0; i < rep; ++i) {
+ lookup[offset++] = value;
+ }
+ }
+ for (var /** number */ i = 0; i < 16; ++i) {
+ lookup[1792 + i] = 1;
+ lookup[2032 + i] = 6;
+ }
+ lookup[1792] = 0;
+ lookup[2047] = 7;
+ for (var /** number */ i = 0; i < 256; ++i) {
+ lookup[1536 + i] = lookup[1792 + i] << 3;
+ }
+ }
+ {
+ unpackLookupTable(LOOKUP, " !! ! \"#$##%#$&'##(#)#++++++++++((&*'##,---,---,-----,-----,-----&#'###.///.///./////./////./////&#'# ", "A/* ': & : $ \u0081 @");
+ }
+
+ /**
+ * @constructor
+ * @struct
+ */
+ function State() {
+ /** @type {!Int8Array} */
+ this.ringBuffer = new Int8Array(0);
+ /** @type {!Int8Array} */
+ this.contextModes = new Int8Array(0);
+ /** @type {!Int8Array} */
+ this.contextMap = new Int8Array(0);
+ /** @type {!Int8Array} */
+ this.distContextMap = new Int8Array(0);
+ /** @type {!Int8Array} */
+ this.distExtraBits = new Int8Array(0);
+ /** @type {!Int8Array} */
+ this.output = new Int8Array(0);
+ /** @type {!Int8Array} */
+ this.byteBuffer = new Int8Array(0);
+ /** @type {!Int16Array} */
+ this.shortBuffer = new Int16Array(0);
+ /** @type {!Int32Array} */
+ this.intBuffer = new Int32Array(0);
+ /** @type {!Int32Array} */
+ this.rings = new Int32Array(0);
+ /** @type {!Int32Array} */
+ this.blockTrees = new Int32Array(0);
+ /** @type {!Int32Array} */
+ this.literalTreeGroup = new Int32Array(0);
+ /** @type {!Int32Array} */
+ this.commandTreeGroup = new Int32Array(0);
+ /** @type {!Int32Array} */
+ this.distanceTreeGroup = new Int32Array(0);
+ /** @type {!Int32Array} */
+ this.distOffset = new Int32Array(0);
+ /** @type {!number} */
+ this.runningState = 0;
+ /** @type {!number} */
+ this.nextRunningState = 0;
+ /** @type {!number} */
+ this.accumulator32 = 0;
+ /** @type {!number} */
+ this.bitOffset = 0;
+ /** @type {!number} */
+ this.halfOffset = 0;
+ /** @type {!number} */
+ this.tailBytes = 0;
+ /** @type {!number} */
+ this.endOfStreamReached = 0;
+ /** @type {!number} */
+ this.metaBlockLength = 0;
+ /** @type {!number} */
+ this.inputEnd = 0;
+ /** @type {!number} */
+ this.isUncompressed = 0;
+ /** @type {!number} */
+ this.isMetadata = 0;
+ /** @type {!number} */
+ this.literalBlockLength = 0;
+ /** @type {!number} */
+ this.numLiteralBlockTypes = 0;
+ /** @type {!number} */
+ this.commandBlockLength = 0;
+ /** @type {!number} */
+ this.numCommandBlockTypes = 0;
+ /** @type {!number} */
+ this.distanceBlockLength = 0;
+ /** @type {!number} */
+ this.numDistanceBlockTypes = 0;
+ /** @type {!number} */
+ this.pos = 0;
+ /** @type {!number} */
+ this.maxDistance = 0;
+ /** @type {!number} */
+ this.distRbIdx = 0;
+ /** @type {!number} */
+ this.trivialLiteralContext = 0;
+ /** @type {!number} */
+ this.literalTreeIdx = 0;
+ /** @type {!number} */
+ this.commandTreeIdx = 0;
+ /** @type {!number} */
+ this.j = 0;
+ /** @type {!number} */
+ this.insertLength = 0;
+ /** @type {!number} */
+ this.contextMapSlice = 0;
+ /** @type {!number} */
+ this.distContextMapSlice = 0;
+ /** @type {!number} */
+ this.contextLookupOffset1 = 0;
+ /** @type {!number} */
+ this.contextLookupOffset2 = 0;
+ /** @type {!number} */
+ this.distanceCode = 0;
+ /** @type {!number} */
+ this.numDirectDistanceCodes = 0;
+ /** @type {!number} */
+ this.distancePostfixMask = 0;
+ /** @type {!number} */
+ this.distancePostfixBits = 0;
+ /** @type {!number} */
+ this.distance = 0;
+ /** @type {!number} */
+ this.copyLength = 0;
+ /** @type {!number} */
+ this.maxBackwardDistance = 0;
+ /** @type {!number} */
+ this.maxRingBufferSize = 0;
+ /** @type {!number} */
+ this.ringBufferSize = 0;
+ /** @type {!number} */
+ this.expectedTotalSize = 0;
+ /** @type {!number} */
+ this.outputOffset = 0;
+ /** @type {!number} */
+ this.outputLength = 0;
+ /** @type {!number} */
+ this.outputUsed = 0;
+ /** @type {!number} */
+ this.ringBufferBytesWritten = 0;
+ /** @type {!number} */
+ this.ringBufferBytesReady = 0;
+ /** @type {!number} */
+ this.isEager = 0;
+ /** @type {!number} */
+ this.isLargeWindow = 0;
+ /** @type {!InputStream|null} */
+ this.input = null;
+ this.ringBuffer = new Int8Array(0);
+ this.rings = new Int32Array(10);
+ this.rings[0] = 16;
+ this.rings[1] = 15;
+ this.rings[2] = 11;
+ this.rings[3] = 4;
+ }
+
+ /**
+ * @param {!Int8Array} dictionary
+ * @param {!string} data0
+ * @param {!string} data1
+ * @param {!string} skipFlip
+ * @return {void}
+ */
+ function unpackDictionaryData(dictionary, data0, data1, skipFlip) {
+ var /** !Int8Array */ dict = toUsAsciiBytes(data0 + data1);
+ if (dict.length != dictionary.length) {
+ throw "Corrupted brotli dictionary";
+ }
+ var /** number */ offset = 0;
+ var /** number */ n = skipFlip.length;
+ for (var /** number */ i = 0; i < n; i += 2) {
+ var /** number */ skip = skipFlip.charCodeAt(i) - 36;
+ var /** number */ flip = skipFlip.charCodeAt(i + 1) - 36;
+ offset += skip;
+ for (var /** number */ j = 0; j < flip; ++j) {
+ dict[offset] |= 0x80;
+ offset++;
+ }
+ }
+ dictionary.set(dict);
+ }
+ {
+ var /** !Int8Array */ dictionary = new Int8Array(122784);
+ unpackDictionaryData(dictionary, "timedownlifeleftbackcodedatashowonlysitecityopenjustlikefreeworktextyearoverbodyloveformbookplaylivelinehelphomesidemorewordlongthemviewfindpagedaysfullheadtermeachareafromtruemarkableuponhighdatelandnewsevennextcasebothpostusedmadehandherewhatnameLinkblogsizebaseheldmakemainuser') +holdendswithNewsreadweresigntakehavegameseencallpathwellplusmenufilmpartjointhislistgoodneedwayswestjobsmindalsologorichuseslastteamarmyfoodkingwilleastwardbestfirePageknowaway.pngmovethanloadgiveselfnotemuchfeedmanyrockicononcelookhidediedHomerulehostajaxinfoclublawslesshalfsomesuchzone100%onescareTimeracebluefourweekfacehopegavehardlostwhenparkkeptpassshiproomHTMLplanTypedonesavekeepflaglinksoldfivetookratetownjumpthusdarkcardfilefearstaykillthatfallautoever.comtalkshopvotedeepmoderestturnbornbandfellroseurl(skinrolecomeactsagesmeetgold.jpgitemvaryfeltthensenddropViewcopy1.0\"</a>stopelseliestourpack.gifpastcss?graymean&gt;rideshotlatesaidroadvar feeljohnrickportfast'UA-dead</b>poorbilltypeU.S.woodmust2px;Inforankwidewantwalllead[0];paulwavesure$('#waitmassarmsgoesgainlangpaid!-- lockunitrootwalkfirmwifexml\"songtest20pxkindrowstoolfontmailsafestarmapscorerainflowbabyspansays4px;6px;artsfootrealwikiheatsteptriporg/lakeweaktoldFormcastfansbankveryrunsjulytask1px;goalgrewslowedgeid=\"sets5px;.js?40pxif (soonseatnonetubezerosentreedfactintogiftharm18pxcamehillboldzoomvoideasyringfillpeakinitcost3px;jacktagsbitsrolleditknewnear<!--growJSONdutyNamesaleyou lotspainjazzcoldeyesfishwww.risktabsprev10pxrise25pxBlueding300,ballfordearnwildbox.fairlackverspairjunetechif(!pickevil$(\"#warmlorddoespull,000ideadrawhugespotfundburnhrefcellkeystickhourlossfuel12pxsuitdealRSS\"agedgreyGET\"easeaimsgirlaids8px;navygridtips#999warsladycars); }php?helltallwhomzh:e*/\r\n 100hall.\n\nA7px;pushchat0px;crew*/</hash75pxflatrare && tellcampontolaidmissskiptentfinemalegetsplot400,\r\n\r\ncoolfeet.php<br>ericmostguidbelldeschairmathatom/img&#82luckcent000;tinygonehtmlselldrugFREEnodenick?id=losenullvastwindRSS wearrelybeensamedukenasacapewishgulfT23:hitsslotgatekickblurthey15px''););\">msiewinsbirdsortbetaseekT18:ordstreemall60pxfarmb\u0000\u0019sboys[0].');\"POSTbearkids);}}marytend(UK)quadzh:f-siz----prop');\rliftT19:viceandydebt>RSSpoolneckblowT16:doorevalT17:letsfailoralpollnovacolsgene b\u0000\u0014softrometillross<h3>pourfadepink<tr>mini)|!(minezh:hbarshear00);milk -->ironfreddiskwentsoilputs/js/holyT22:ISBNT20:adamsees<h2>json', 'contT21: RSSloopasiamoon</p>soulLINEfortcartT14:<h1>80px!--<9px;T04:mike:46ZniceinchYorkricezh:d'));puremageparatonebond:37Z_of_']);000,zh:gtankyardbowlbush:56ZJava30px\n|}\n%C3%:34ZjeffEXPIcashvisagolfsnowzh:iquer.csssickmeatmin.binddellhirepicsrent:36ZHTTP-201fotowolfEND xbox:54ZBODYdick;\n}\nexit:35Zvarsbeat'});diet999;anne}}</[i].LangkmB2wiretoysaddssealalex;\n\t}echonine.org005)tonyjewssandlegsroof000) 200winegeardogsbootgarycutstyletemption.xmlcockgang$('.50pxPh.Dmiscalanloandeskmileryanunixdisc);}\ndustclip).\n\n70px-200DVDs7]><tapedemoi++)wageeurophiloptsholeFAQsasin-26TlabspetsURL bulkcook;}\r\nHEAD[0])abbrjuan(198leshtwin</i>sonyguysfuckpipe|-\n!002)ndow[1];[];\nLog salt\r\n\t\tbangtrimbath){\r\n00px\n});ko:lfeesad>\rs:// [];tollplug(){\n{\r\n .js'200pdualboat.JPG);\n}quot);\n\n');\n\r\n}\r201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037201320122011201020092008200720062005200420032002200120001999199819971996199519941993199219911990198919881987198619851984198319821981198019791978197719761975197419731972197119701969196819671966196519641963196219611960195919581957195619551954195319521951195010001024139400009999comomC!sesteestaperotodohacecadaaC1obiendC-aasC-vidacasootroforosolootracualdijosidograntipotemadebealgoquC)estonadatrespococasabajotodasinoaguapuesunosantediceluisellamayozonaamorpisoobraclicellodioshoracasiP7P0P=P0P>P<Q\u0000P0Q\u0000Q\u0003Q\u0002P0P=P5P?P>P>Q\u0002P8P7P=P>P4P>Q\u0002P>P6P5P>P=P8Q\u0005P\u001DP0P5P5P1Q\u000BP<Q\u000BP\u0012Q\u000BQ\u0001P>P2Q\u000BP2P>P\u001DP>P>P1P\u001FP>P;P8P=P8P P$P\u001DP5P\u001CQ\u000BQ\u0002Q\u000BP\u001EP=P8P<P4P0P\u0017P0P\u0014P0P\u001DQ\u0003P\u001EP1Q\u0002P5P\u0018P7P5P9P=Q\u0003P<P<P\"Q\u000BQ\u0003P6Y\u0001Y\nX#Y\u0006Y\u0005X'Y\u0005X9Y\u0003Y\u0004X#Y\u0008X1X/Y\nX'Y\u0001Y\tY\u0007Y\u0008Y\u0004Y\u0005Y\u0004Y\u0003X'Y\u0008Y\u0004Y\u0007X(X3X'Y\u0004X%Y\u0006Y\u0007Y\nX#Y\nY\u0002X/Y\u0007Y\u0004X+Y\u0005X(Y\u0007Y\u0004Y\u0008Y\u0004Y\nX(Y\u0004X'Y\nX(Y\u0003X4Y\nX'Y\u0005X#Y\u0005Y\u0006X*X(Y\nY\u0004Y\u0006X-X(Y\u0007Y\u0005Y\u0005X4Y\u0008X4firstvideolightworldmediawhitecloseblackrightsmallbooksplacemusicfieldorderpointvalueleveltableboardhousegroupworksyearsstatetodaywaterstartstyledeathpowerphonenighterrorinputabouttermstitletoolseventlocaltimeslargewordsgamesshortspacefocusclearmodelblockguideradiosharewomenagainmoneyimagenamesyounglineslatercolorgreenfront&amp;watchforcepricerulesbeginaftervisitissueareasbelowindextotalhourslabelprintpressbuiltlinksspeedstudytradefoundsenseundershownformsrangeaddedstillmovedtakenaboveflashfixedoftenotherviewschecklegalriveritemsquickshapehumanexistgoingmoviethirdbasicpeacestagewidthloginideaswrotepagesusersdrivestorebreaksouthvoicesitesmonthwherebuildwhichearthforumthreesportpartyClicklowerlivesclasslayerentrystoryusagesoundcourtyour birthpopuptypesapplyImagebeinguppernoteseveryshowsmeansextramatchtrackknownearlybegansuperpapernorthlearngivennamedendedTermspartsGroupbrandusingwomanfalsereadyaudiotakeswhile.com/livedcasesdailychildgreatjudgethoseunitsneverbroadcoastcoverapplefilescyclesceneplansclickwritequeenpieceemailframeolderphotolimitcachecivilscaleenterthemetheretouchboundroyalaskedwholesincestock namefaithheartemptyofferscopeownedmightalbumthinkbloodarraymajortrustcanonunioncountvalidstoneStyleLoginhappyoccurleft:freshquitefilmsgradeneedsurbanfightbasishoverauto;route.htmlmixedfinalYour slidetopicbrownalonedrawnsplitreachRightdatesmarchquotegoodsLinksdoubtasyncthumballowchiefyouthnovel10px;serveuntilhandsCheckSpacequeryjamesequaltwice0,000Startpanelsongsroundeightshiftworthpostsleadsweeksavoidthesemilesplanesmartalphaplantmarksratesplaysclaimsalestextsstarswrong</h3>thing.org/multiheardPowerstandtokensolid(thisbringshipsstafftriedcallsfullyfactsagentThis //-->adminegyptEvent15px;Emailtrue\"crossspentblogsbox\">notedleavechinasizesguest</h4>robotheavytrue,sevengrandcrimesignsawaredancephase><!--en_US&#39;200px_namelatinenjoyajax.ationsmithU.S. holdspeterindianav\">chainscorecomesdoingpriorShare1990sromanlistsjapanfallstrialowneragree</h2>abusealertopera\"-//WcardshillsteamsPhototruthclean.php?saintmetallouismeantproofbriefrow\">genretrucklooksValueFrame.net/-->\n<try {\nvar makescostsplainadultquesttrainlaborhelpscausemagicmotortheir250pxleaststepsCountcouldglasssidesfundshotelawardmouthmovesparisgivesdutchtexasfruitnull,||[];top\">\n<!--POST\"ocean<br/>floorspeakdepth sizebankscatchchart20px;aligndealswould50px;url=\"parksmouseMost ...</amongbrainbody none;basedcarrydraftreferpage_home.meterdelaydreamprovejoint</tr>drugs<!-- aprilidealallenexactforthcodeslogicView seemsblankports (200saved_linkgoalsgrantgreekhomesringsrated30px;whoseparse();\" Blocklinuxjonespixel');\">);if(-leftdavidhorseFocusraiseboxesTrackement</em>bar\">.src=toweralt=\"cablehenry24px;setupitalysharpminortastewantsthis.resetwheelgirls/css/100%;clubsstuffbiblevotes 1000korea});\r\nbandsqueue= {};80px;cking{\r\n\t\taheadclockirishlike ratiostatsForm\"yahoo)[0];Aboutfinds</h1>debugtasksURL =cells})();12px;primetellsturns0x600.jpg\"spainbeachtaxesmicroangel--></giftssteve-linkbody.});\n\tmount (199FAQ</rogerfrankClass28px;feeds<h1><scotttests22px;drink) || lewisshall#039; for lovedwaste00px;ja:c\u0002simon<fontreplymeetsuntercheaptightBrand) != dressclipsroomsonkeymobilmain.Name platefunnytreescom/\"1.jpgwmodeparamSTARTleft idden, 201);\n}\nform.viruschairtransworstPagesitionpatch<!--\no-cacfirmstours,000 asiani++){adobe')[0]id=10both;menu .2.mi.png\"kevincoachChildbruce2.jpgURL)+.jpg|suitesliceharry120\" sweettr>\r\nname=diegopage swiss-->\n\n#fff;\">Log.com\"treatsheet) && 14px;sleepntentfiledja:c\u0003id=\"cName\"worseshots-box-delta\n&lt;bears:48Z<data-rural</a> spendbakershops= \"\";php\">ction13px;brianhellosize=o=%2F joinmaybe<img img\">, fjsimg\" \")[0]MTopBType\"newlyDanskczechtrailknows</h5>faq\">zh-cn10);\n-1\");type=bluestrulydavis.js';>\r\n<!steel you h2>\r\nform jesus100% menu.\r\n\t\r\nwalesrisksumentddingb-likteachgif\" vegasdanskeestishqipsuomisobredesdeentretodospuedeaC1osestC!tienehastaotrospartedondenuevohacerformamismomejormundoaquC-dC-assC3loayudafechatodastantomenosdatosotrassitiomuchoahoralugarmayorestoshorastenerantesfotosestaspaC-snuevasaludforosmedioquienmesespoderchileserC!vecesdecirjosC)estarventagrupohechoellostengoamigocosasnivelgentemismaairesjuliotemashaciafavorjuniolibrepuntobuenoautorabrilbuenatextomarzosaberlistaluegocC3moenerojuegoperC:haberestoynuncamujervalorfueralibrogustaigualvotoscasosguC-apuedosomosavisousteddebennochebuscafaltaeurosseriedichocursoclavecasasleC3nplazolargoobrasvistaapoyojuntotratavistocrearcampohemoscincocargopisosordenhacenC!readiscopedrocercapuedapapelmenorC:tilclarojorgecalleponertardenadiemarcasigueellassiglocochemotosmadreclaserestoniC1oquedapasarbancohijosviajepabloC)stevienereinodejarfondocanalnorteletracausatomarmanoslunesautosvillavendopesartipostengamarcollevapadreunidovamoszonasambosbandamariaabusomuchasubirriojavivirgradochicaallC-jovendichaestantalessalirsuelopesosfinesllamabuscoC)stalleganegroplazahumorpagarjuntadobleislasbolsabaC1ohablaluchaC\u0001readicenjugarnotasvalleallC!cargadolorabajoestC)gustomentemariofirmacostofichaplatahogarartesleyesaquelmuseobasespocosmitadcielochicomiedoganarsantoetapadebesplayaredessietecortecoreadudasdeseoviejodeseaaguas&quot;domaincommonstatuseventsmastersystemactionbannerremovescrollupdateglobalmediumfilternumberchangeresultpublicscreenchoosenormaltravelissuessourcetargetspringmodulemobileswitchphotosborderregionitselfsocialactivecolumnrecordfollowtitle>eitherlengthfamilyfriendlayoutauthorcreatereviewsummerserverplayedplayerexpandpolicyformatdoublepointsseriespersonlivingdesignmonthsforcesuniqueweightpeopleenergynaturesearchfigurehavingcustomoffsetletterwindowsubmitrendergroupsuploadhealthmethodvideosschoolfutureshadowdebatevaluesObjectothersrightsleaguechromesimplenoticesharedendingseasonreportonlinesquarebuttonimagesenablemovinglatestwinterFranceperiodstrongrepeatLondondetailformeddemandsecurepassedtoggleplacesdevicestaticcitiesstreamyellowattackstreetflighthiddeninfo\">openedusefulvalleycausesleadersecretseconddamagesportsexceptratingsignedthingseffectfieldsstatesofficevisualeditorvolumeReportmuseummoviesparentaccessmostlymother\" id=\"marketgroundchancesurveybeforesymbolmomentspeechmotioninsidematterCenterobjectexistsmiddleEuropegrowthlegacymannerenoughcareeransweroriginportalclientselectrandomclosedtopicscomingfatheroptionsimplyraisedescapechosenchurchdefinereasoncorneroutputmemoryiframepolicemodelsNumberduringoffersstyleskilledlistedcalledsilvermargindeletebetterbrowselimitsGlobalsinglewidgetcenterbudgetnowrapcreditclaimsenginesafetychoicespirit-stylespreadmakingneededrussiapleaseextentScriptbrokenallowschargedividefactormember-basedtheoryconfigaroundworkedhelpedChurchimpactshouldalwayslogo\" bottomlist\">){var prefixorangeHeader.push(couplegardenbridgelaunchReviewtakingvisionlittledatingButtonbeautythemesforgotSearchanchoralmostloadedChangereturnstringreloadMobileincomesupplySourceordersviewed&nbsp;courseAbout island<html cookiename=\"amazonmodernadvicein</a>: The dialoghousesBEGIN MexicostartscentreheightaddingIslandassetsEmpireSchooleffortdirectnearlymanualSelect.\n\nOnejoinedmenu\">PhilipawardshandleimportOfficeregardskillsnationSportsdegreeweekly (e.g.behinddoctorloggedunited</b></beginsplantsassistartistissued300px|canadaagencyschemeremainBrazilsamplelogo\">beyond-scaleacceptservedmarineFootercamera</h1>\n_form\"leavesstress\" />\r\n.gif\" onloadloaderOxfordsistersurvivlistenfemaleDesignsize=\"appealtext\">levelsthankshigherforcedanimalanyoneAfricaagreedrecentPeople<br />wonderpricesturned|| {};main\">inlinesundaywrap\">failedcensusminutebeaconquotes150px|estateremoteemail\"linkedright;signalformal1.htmlsignupprincefloat:.png\" forum.AccesspaperssoundsextendHeightsliderUTF-8\"&amp; Before. WithstudioownersmanageprofitjQueryannualparamsboughtfamousgooglelongeri++) {israelsayingdecidehome\">headerensurebranchpiecesblock;statedtop\"><racingresize--&gt;pacitysexualbureau.jpg\" 10,000obtaintitlesamount, Inc.comedymenu\" lyricstoday.indeedcounty_logo.FamilylookedMarketlse ifPlayerturkey);var forestgivingerrorsDomain}else{insertBlog</footerlogin.fasteragents<body 10px 0pragmafridayjuniordollarplacedcoversplugin5,000 page\">boston.test(avatartested_countforumsschemaindex,filledsharesreaderalert(appearSubmitline\">body\">\n* TheThoughseeingjerseyNews</verifyexpertinjurywidth=CookieSTART across_imagethreadnativepocketbox\">\nSystem DavidcancertablesprovedApril reallydriveritem\">more\">boardscolorscampusfirst || [];media.guitarfinishwidth:showedOther .php\" assumelayerswilsonstoresreliefswedenCustomeasily your String\n\nWhiltaylorclear:resortfrenchthough\") + \"<body>buyingbrandsMembername\">oppingsector5px;\">vspacepostermajor coffeemartinmaturehappen</nav>kansaslink\">Images=falsewhile hspace0&amp; \n\nIn powerPolski-colorjordanBottomStart -count2.htmlnews\">01.jpgOnline-rightmillerseniorISBN 00,000 guidesvalue)ectionrepair.xml\" rights.html-blockregExp:hoverwithinvirginphones</tr>\rusing \n\tvar >');\n\t</td>\n</tr>\nbahasabrasilgalegomagyarpolskisrpskiX1X/Y\u0008d8-f\u0016\u0007g.\u0000d=\u0013g9\u0001i+\u0014d?!f\u0001/d8-e\u001B=f\u0008\u0011d;,d8\u0000d8*e\u0005,e\u000F8g.!g\u0010\u0006h.:e\u001D\u001Be\u000F/d;%f\u001C\re\n!f\u00176i\u00174d8*d::d:'e\u0013\u0001h\u0007*e71d<\u0001d8\u001Af\u001F%g\u001C\u000Be7%d=\u001Ch\u0001\u0014g3;f2!f\u001C\tg=\u0011g+\u0019f\t\u0000f\u001C\th/\u0004h.:d8-e?\u0003f\u0016\u0007g+ g\u0014(f\u00087i&\u0016i!5d=\u001Ch\u0000\u0005f\n\u0000f\u001C/i\u0017.i\"\u0018g\u001B8e\u00053d8\u000Bh==f\u0010\u001Cg4\"d=?g\u0014(h=/d;6e\u001C(g:?d8;i\"\u0018h5\u0004f\u0016\u0019h'\u0006i\"\u0011e\u001B\u001Ee$\rf3(e\u0006\u000Cg=\u0011g;\u001Cf\u00146h\u0017\u000Fe\u0006\u0005e.9f\u000E(h\r\u0010e8\u0002e\u001C:f6\u0008f\u0001/g):i\u00174e\u000F\u0011e8\u0003d;\u0000d9\u0008e%=e\u000F\u000Bg\u0014\u001Ff4;e\u001B>g\t\u0007e\u000F\u0011e1\u0015e&\u0002f\u001E\u001Cf\t\u000Bf\u001C:f\u00160i\u0017;f\u001C\u0000f\u00160f\u00169e<\u000Fe\u000C\u0017d:,f\u000F\u0010d>\u001Be\u00053d:\u000Ef\u001B4e$\u001Ah?\u0019d8*g3;g;\u001Fg\u001F%i\u0001\u0013f88f\u0008\u000Fe9?e\u0011\ne\u00056d;\u0016e\u000F\u0011h!(e.\te\u0005(g,,d8\u0000d<\u001Ae\u0011\u0018h?\u001Bh!\u000Cg\u00029e\u0007;g\t\u0008f\u001D\u0003g\u00145e-\u0010d8\u0016g\u0015\u000Ch.>h.!e\u0005\rh49f\u0015\u0019h\u00022e\n e\u0005%f4;e\n(d;\u0016d;,e\u0015\u0006e\u0013\u0001e\r\u001Ae.\"g\u000E0e\u001C(d8\nf57e&\u0002d=\u0015e72g;\u000Fg\u0015\u0019h(\u0000h/&g;\u0006g$>e\u000C:g\u0019;e=\u0015f\u001C,g+\u0019i\u001C\u0000h&\u0001d;7f <f\u0014/f\u000C\u0001e\u001B=i\u0019\u0005i\u0013>f\u000E%e\u001B=e.6e;:h.>f\u001C\u000Be\u000F\u000Bi\u0018\u0005h/;f3\u0015e>\u000Bd=\rg=.g;\u000Ff5\u000Ei\u0000\tf\u000B)h?\u0019f 7e=\u0013e\t\re\u0008\u0006g1;f\u000E\u0012h!\u000Ce\u001B d8:d:$f\u0018\u0013f\u001C\u0000e\u0010\u000Ei\u001F3d9\u0010d8\rh\u0003=i\u0000\u001Ah?\u0007h!\u000Cd8\u001Ag'\u0011f\n\u0000e\u000F/h\u0003=h.>e$\u0007e\u0010\u0008d=\u001Ce$'e.6g$>d<\u001Ag \u0014g)6d8\u0013d8\u001Ae\u0005(i\u0003(i!9g\u001B.h?\u0019i\u0007\u000Ch?\u0018f\u0018/e<\u0000e'\u000Bf\u0003\u0005e\u00065g\u00145h\u0004\u0011f\u0016\u0007d;6e\u0013\u0001g\t\u000Ce8.e\n)f\u0016\u0007e\u000C\u0016h5\u0004f:\u0010e$'e-&e-&d9 e\u001C0e\u001D\u0000f5\u000Fh'\u0008f\n\u0015h5\u0004e7%g(\u000Bh&\u0001f1\u0002f\u0000\u000Ed9\u0008f\u00176e\u0000\u0019e\n\u001Fh\u0003=d8;h&\u0001g\u001B.e\t\rh5\u0004h./e\u001F\u000Ee8\u0002f\u00169f3\u0015g\u00145e=1f\u000B\u001Bh\u0001\u0018e#0f\u0018\u000Ed;;d=\u0015e\u0001%e:7f\u00150f\r.g>\u000Ee\u001B=f1=h=&d;\u000Bg;\rd=\u0006f\u0018/d:$f5\u0001g\u0014\u001Fd:'f\t\u0000d;%g\u00145h/\u001Df\u0018>g$:d8\u0000d:\u001Be\r\u0015d=\rd::e\u0011\u0018e\u0008\u0006f\u001E\u0010e\u001C0e\u001B>f\u0017\u0005f88e7%e\u00057e-&g\u0014\u001Fg3;e\u0008\u0017g=\u0011e\u000F\u000Be8\u0016e-\u0010e/\u0006g \u0001i\"\u0011i\u0001\u0013f\u000E'e\u00086e\u001C0e\u000C:e\u001F:f\u001C,e\u0005(e\u001B=g=\u0011d8\ni\u0007\rh&\u0001g,,d:\u000Ce\u0016\u001Cf,\"h?\u001Be\u0005%e\u000F\u000Bf\u0003\u0005h?\u0019d:\u001Bh\u0000\u0003h/\u0015e\u000F\u0011g\u000E0e\u001F9h.-d;%d8\nf\u0014?e:\u001Cf\u0008\u0010d8:g\u000E/e\"\u0003i&\u0019f8/e\u0010\u000Cf\u00176e(1d9\u0010e\u000F\u0011i\u0000\u0001d8\u0000e.\u001Ae<\u0000e\u000F\u0011d=\u001Ce\u0013\u0001f \u0007e\u0007\u0006f,\"h?\u000Eh'#e\u00063e\u001C0f\u00169d8\u0000d8\u000Bd;%e\u000F\nh4#d;;f\u0008\u0016h\u0000\u0005e.\"f\u00087d;#h!(g'/e\u0008\u0006e%3d::f\u00150g \u0001i\u0014\u0000e\u0014.e\u0007:g\u000E0g&;g:?e:\u0014g\u0014(e\u0008\u0017h!(d8\re\u0010\u000Cg<\u0016h>\u0011g;\u001Fh.!f\u001F%h/\"d8\rh&\u0001f\u001C\te\u00053f\u001C:f\u001E\u0004e>\u0008e$\u001Af\u0012-f\u0014>g;\u0004g;\u0007f\u0014?g-\u0016g\u001B4f\u000E%h\u0003=e\n\u001Bf\u001D%f:\u0010f\u0019\u0002i\u0016\u0013g\u001C\u000Be\u00080g\u0003-i\u0017(e\u00053i\u0014.d8\u0013e\u000C:i\u001D\u001Ee88h\u000B1h/-g\u0019>e:&e8\u000Cf\u001C\u001Bg>\u000Ee%3f/\u0014h>\u0003g\u001F%h/\u0006h'\u0004e.\u001Ae;:h..i\u0003(i\u0017(f\u0004\u000Fh'\u0001g2>e=)f\u0017%f\u001C,f\u000F\u0010i+\u0018e\u000F\u0011h(\u0000f\u00169i\u001D\"e\u001F:i\u0007\u0011e$\u0004g\u0010\u0006f\u001D\u0003i\u0019\u0010e=1g\t\u0007i\u00136h!\u000Ch?\u0018f\u001C\te\u0008\u0006d:+g\t)e\u0013\u0001g;\u000Fh\u0010%f7;e\n d8\u0013e.6h?\u0019g'\rh/\u001Di\"\u0018h57f\u001D%d8\u001Ae\n!e\u0005,e\u0011\nh.0e=\u0015g.\u0000d;\u000Bh4(i\u0007\u000Fg\u00147d::e=1e\u0013\re<\u0015g\u0014(f\n%e\u0011\ni\u0003(e\u0008\u0006e?+i\u0000\u001Fe\u0012(h/\"f\u00176e0\u001Af3(f\u0004\u000Fg\u00143h/7e-&f !e:\u0014h/%e\u000E\u0006e\u000F2e\u000F*f\u0018/h?\u0014e\u001B\u001Eh4-d90e\u0010\rg'0d8:d:\u0006f\u0008\u0010e\n\u001Fh/4f\u0018\u000Ed>\u001Be:\u0014e-)e-\u0010d8\u0013i\"\u0018g(\u000Be:\u000Fd8\u0000h\u0008,f\u001C\u0003e\u0013!e\u000F*f\u001C\te\u00056e.\u0003d?\u001Df\n$h\u0000\u000Cd8\u0014d;\ne$)g*\u0017e\u000F#e\n(f\u0000\u0001g\n6f\u0000\u0001g\t9e\u0008+h.$d8:e?\u0005i!;f\u001B4f\u00160e0\u000Fh/4f\u0008\u0011e\u0000\u0011d=\u001Cd8:e*\u0012d=\u0013e\u000C\u0005f\u000B,i\u0002#d9\u0008d8\u0000f 7e\u001B=e\u0006\u0005f\u0018/e\u0010&f 9f\r.g\u00145h'\u0006e-&i\u0019\"e\u00057f\u001C\th?\u0007g(\u000Bg\u00141d:\u000Ed::f\t\re\u0007:f\u001D%d8\rh?\u0007f-#e\u001C(f\u0018\u000Ef\u0018\u001Ff\u0015\u0005d:\u000Be\u00053g3;f \u0007i\"\u0018e\u0015\u0006e\n!h>\u0013e\u0005%d8\u0000g\u001B4e\u001F:g!\u0000f\u0015\u0019e-&d:\u0006h'#e;:g-\u0011g;\u0013f\u001E\u001Ce\u0005(g\u0010\u0003i\u0000\u001Ag\u001F%h.!e\u0008\u0012e/9d:\u000Eh\t:f\u001C/g\u001B8e\u0006\u000Ce\u000F\u0011g\u0014\u001Fg\u001C\u001Fg\u001A\u0004e;:g+\u000Bg-\tg:'g1;e\u001E\u000Bg;\u000Fi*\u000Ce.\u001Eg\u000E0e\u00086d=\u001Cf\u001D%h\u0007*f \u0007g->d;%d8\u000Be\u000E\u001Fe\u0008\u001Bf\u0017 f3\u0015e\u00056d8-e\u0000\u000Bd::d8\u0000e\u0008\u0007f\u000C\u0007e\r\u0017e\u00053i\u0017-i\u001B\u0006e\u001B\"g,,d8\te\u00053f3(e\u001B f-$g\u0005'g\t\u0007f71e\u001C3e\u0015\u0006d8\u001Ae9?e7\u001Ef\u0017%f\u001C\u001Fi+\u0018g:'f\u001C\u0000h?\u0011g;<e\u0010\u0008h!(g$:d8\u0013h>\u0011h!\u000Cd8:d:$i\u0000\u001Ah/\u0004d;7h'\te>\u0017g2>e\r\u000Ee.6e:-e.\u000Cf\u0008\u0010f\u0004\u001Fh'\te.\th#\u0005e>\u0017e\u00080i\u0002.d;6e\u00086e:&i#\u001Fe\u0013\u0001h\u0019=g\u00046h=,h==f\n%d;7h.0h\u0000\u0005f\u00169f!\u0008h!\u000Cf\u0014?d::f0\u0011g\u0014(e\u0013\u0001d8\u001Ch%?f\u000F\u0010e\u0007:i\u0005\u0012e:\u0017g\u00046e\u0010\u000Ed;\u0018f,>g\u0003-g\u00029d;%e\t\re.\u000Ce\u0005(e\u000F\u0011e8\u0016h.>g=.i\"\u0006e/<e7%d8\u001Ae\u000C;i\u0019\"g\u001C\u000Bg\u001C\u000Bg;\u000Fe\u00058e\u000E\u001Fe\u001B e93e\u000F0e\u0010\u0004g'\re\"\u001Ee\n f\u001D\u0010f\u0016\u0019f\u00160e\"\u001Ed9\u000Be\u0010\u000Eh\u0001\u000Cd8\u001Af\u0015\u0008f\u001E\u001Cd;\ne94h.:f\u0016\u0007f\u0008\u0011e\u001B=e\u0011\nh/\tg\t\u0008d8;d?.f\u00149e\u000F\u0002d8\u000Ef\t\u0013e\r0e?+d9\u0010f\u001C:f\"0h'\u0002g\u00029e-\u0018e\u001C(g2>g%\u001Eh\u000E7e>\u0017e\u0008)g\u0014(g;'g;-d= d;,h?\u0019d9\u0008f(!e<\u000Fh/-h(\u0000h\u0003=e$\u001Fi\u001B\u0005h\u0019\u000Ef\u0013\rd=\u001Ci#\u000Ef <d8\u0000h57g'\u0011e-&d=\u0013h\u00022g\u001F-d?!f\u001D!d;6f2;g\u0016\u0017h?\u0010e\n(d:'d8\u001Ad<\u001Ah..e/<h\u0008*e\u0005\u0008g\u0014\u001Fh\u0001\u0014g\u001B\u001Fe\u000F/f\u0018/e\u0015\u000Fi!\u000Cg;\u0013f\u001E\u0004d=\u001Cg\u0014(h0\u0003f\u001F%h3\u0007f\u0016\u0019h\u0007*e\n(h4\u001Fh4#e\u0006\u001Cd8\u001Ah.?i\u0017.e.\u001Ef\u0016=f\u000E%e\u000F\u0017h.(h.:i\u0002#d8*e\u000F\ri&\u0008e\n e<:e%3f\u0000'h\u000C\u0003e\u001B4f\u001C\re\u000B\u0019d<\u0011i\u00172d;\nf\u0017%e.\"f\u001C\rh'\u0000g\u001C\u000Be\u000F\u0002e\n g\u001A\u0004h/\u001Dd8\u0000g\u00029d?\u001Dh/\u0001e\u001B>d9&f\u001C\tf\u0015\u0008f5\u000Bh/\u0015g';e\n(f\t\rh\u0003=e\u00063e.\u001Ah\u0002!g%(d8\rf\u0016-i\u001C\u0000f1\u0002d8\re>\u0017e\n\u001Ef3\u0015d9\u000Bi\u00174i\u0007\u0007g\u0014(h\u0010%i\u0014\u0000f\n\u0015h/\tg\u001B.f \u0007g\u00081f\u0003\u0005f\u0011\u0004e=1f\u001C\td:\u001Bh$\u0007h#=f\u0016\u0007e-&f\u001C:d<\u001Af\u00150e-\u0017h#\u0005d?.h4-g\t)e\u0006\u001Cf\u001D\u0011e\u0005(i\u001D\"g2>e\u0013\u0001e\u00056e.\u001Ed:\u000Bf\u0003\u0005f04e93f\u000F\u0010g$:d8\ne8\u0002h0\"h0\"f\u0019.i\u0000\u001Af\u0015\u0019e8\u0008d8\nd< g1;e\u0008+f-\u000Cf\u001B2f\u000B%f\u001C\te\u0008\u001Bf\u00160i\u0005\rd;6e\u000F*h&\u0001f\u00176d;#h3\u0007h(\nh>>e\u00080d::g\u0014\u001Fh.\"i\u0018\u0005h\u0000\u0001e8\u0008e1\u0015g$:e?\u0003g\u0010\u0006h44e-\u0010g62g+\u0019d8;i!\u000Ch\u0007*g\u00046g:'e\u0008+g.\u0000e\r\u0015f\u00149i\u001D)i\u0002#d:\u001Bf\u001D%h/4f\t\u0013e<\u0000d;#g \u0001e\u0008 i\u0019$h/\u0001e\u00088h\n\u0002g\u001B.i\u0007\rg\u00029f,!f\u00158e$\u001Ae0\u0011h'\u0004e\u0008\u0012h5\u0004i\u0007\u0011f\t>e\u00080d;%e\u0010\u000Ee$'e\u0005(d8;i!5f\u001C\u0000d=3e\u001B\u001Eg-\u0014e$)d8\u000Bd?\u001Di\u001A\u001Cg\u000E0d;#f#\u0000f\u001F%f\n\u0015g%(e0\u000Ff\u00176f2\u0012f\u001C\tf-#e88g\u0014\u001Ah\u00073d;#g\u0010\u0006g\u001B.e=\u0015e\u0005,e<\u0000e$\re\u00086i\u0007\u0011h\u001E\re98g&\u000Fg\t\u0008f\u001C,e=\"f\u0008\u0010e\u0007\u0006e$\u0007h!\u000Cf\u0003\u0005e\u001B\u001Ee\u00080f\u0000\u001Df\u00033f\u0000\u000Ef 7e\r\u000Fh..h.$h/\u0001f\u001C\u0000e%=d:'g\u0014\u001Ff\u000C\tg\u0005'f\u001C\rh#\u0005e9?d8\u001Ce\n(f<+i\u0007\u0007h4-f\u00160f\t\u000Bg;\u0004e\u001B>i\u001D\"f\u001D?e\u000F\u0002h\u0000\u0003f\u0014?f2;e.9f\u0018\u0013e$)e\u001C0e\n*e\n\u001Bd::d;,e\r\u0007g:'i\u0000\u001Fe:&d::g\t)h0\u0003f\u00154f5\u0001h!\u000Ci\u0000 f\u0008\u0010f\u0016\u0007e-\u0017i\u001F)e\u001B=h48f\u0018\u0013e<\u0000e1\u0015g\u001B8i\u0017\u001Ch!(g\u000E0e=1h'\u0006e&\u0002f-$g>\u000Ee.9e$'e0\u000Ff\n%i\u0001\u0013f\u001D!f,>e?\u0003f\u0003\u0005h.8e$\u001Af3\u0015h'\u0004e.6e1\u0005d9&e:\u0017h?\u001Ef\u000E%g+\u000Be\r3d8>f\n%f\n\u0000e7'e%%h?\u0010g\u0019;e\u0005%d;%f\u001D%g\u0010\u0006h.:d:\u000Bd;6h\u0007*g\u00141d8-e\r\u000Ee\n\u001Ee\u0005,e&\u0008e&\u0008g\u001C\u001Ff-#d8\ri\u0014\u0019e\u0005(f\u0016\u0007e\u0010\u0008e\u0010\u000Cd;7e\u0000<e\u0008+d::g\u001B\u0011g\u001D#e\u00057d=\u0013d8\u0016g:*e\u001B\"i\u0018\u001Fe\u0008\u001Bd8\u001Af\t?f\u000B\u0005e\"\u001Ei\u0015?f\u001C\td::d?\u001Df\u000C\u0001e\u0015\u0006e.6g;4d?.e\u000F0f9>e7&e\u000F3h\u0002!d;=g-\u0014f!\u0008e.\u001Ei\u0019\u0005g\u00145d?!g;\u000Fg\u0010\u0006g\u0014\u001Fe\u0011=e.#d< d;;e\n!f-#e<\u000Fg\t9h\t2d8\u000Bf\u001D%e\r\u000Fd<\u001Ae\u000F*h\u0003=e=\u0013g\u00046i\u0007\rf\u00160e\u0005'e.9f\u000C\u0007e/<h?\u0010h!\u000Cf\u0017%e?\u0017h3#e.6h6\u0005h?\u0007e\u001C\u001Fe\u001C0f5\u0019f1\u001Ff\u0014/d;\u0018f\u000E(e\u0007:g+\u0019i\u0015?f\u001D-e7\u001Ef\t'h!\u000Ce\u00086i\u0000 d9\u000Bd8\u0000f\u000E(e9?g\u000E0e\u001C:f\u000F\u000Fh?0e\u000F\u0018e\u000C\u0016d< g;\u001Ff-\u000Cf\t\u000Bd?\u001Di\u0019)h/>g(\u000Be\u000C;g\u0016\u0017g;\u000Fh?\u0007h?\u0007e\u000E;d9\u000Be\t\rf\u00146e\u0005%e94e:&f\u001D\u0002e?\u0017g>\u000Ed8=f\u001C\u0000i+\u0018g\u0019;i\u0019\u0006f\u001C*f\u001D%e\n e7%e\u0005\rh4#f\u0015\u0019g(\u000Bg\t\u0008e\u001D\u0017h:+d=\u0013i\u0007\re:\u0006e\u0007:e\u0014.f\u0008\u0010f\u001C,e=\"e<\u000Fe\u001C\u001Fh1\u0006e\u0007:e\u00039d8\u001Cf\u00169i\u0002.g.1e\r\u0017d:,f1\u0002h\u0001\u000Ce\u000F\u0016e>\u0017h\u0001\u000Cd=\rg\u001B8d?!i!5i\u001D\"e\u0008\u0006i\u0012\u001Fg=\u0011i!5g!.e.\u001Ae\u001B>d>\u000Bg=\u0011e\u001D\u0000g'/f\u001E\u0001i\u0014\u0019h//g\u001B.g\u001A\u0004e.\u001Dh4\u001Df\u001C:e\u00053i#\u000Ei\u0019)f\u000E\u0008f\u001D\u0003g\u0017\u0005f/\u0012e. g\t)i\u0019$d:\u0006h)\u0015h+\u0016g\u0016>g\u0017\u0005e\u000F\nf\u00176f1\u0002h4-g+\u0019g\u00029e\u0004?g+%f/\u000Fe$)d8-e$.h.$h/\u0006f/\u000Fd8*e$)f4%e-\u0017d=\u0013e\u000F0g\u0001#g;4f\n$f\u001C,i!5d8*f\u0000'e.\u0018f\u00169e88h'\u0001g\u001B8f\u001C:f\u0008\u0018g\u0015%e:\u0014e=\u0013e>\u000Be8\u0008f\u00169d>?f !e\u001B-h\u0002!e8\u0002f\u0008?e1\u000Bf \u000Fg\u001B.e\u0011\u0018e7%e/<h\u00074g*\u0001g\u00046i\u0001\u0013e\u00057f\u001C,g=\u0011g;\u0013e\u0010\u0008f!#f!\u0008e\n3e\n(e\u000F&e$\u0016g>\u000Ee\u0005\u0003e<\u0015h57f\u00149e\u000F\u0018g,,e\u001B\u001Bd<\u001Ah.!h**f\u0018\u000Ei\u001A\u0010g'\u0001e.\u001De.\u001Dh'\u0004h\u000C\u0003f6\u0008h49e\u00051e\u0010\u000Ce?\u0018h.0d=\u0013g3;e8&f\u001D%e\u0010\re-\u0017g\u0019<h!(e<\u0000f\u0014>e\n g\u001B\u001Fe\u000F\u0017e\u00080d:\u000Cf\t\u000Be$'i\u0007\u000Ff\u0008\u0010d::f\u00150i\u0007\u000Fe\u00051d:+e\u000C:e\u001F\u001Fe%3e-)e\u000E\u001Fe\u0008\u0019f\t\u0000e\u001C(g;\u0013f\u001D\u001Fi\u0000\u001Ad?!h6\u0005g:'i\u0005\rg=.e=\u0013f\u00176d<\u0018g'\u0000f\u0000'f\u0004\u001Ff\u0008?d:'i\u0001\nf\u00082e\u0007:e\u000F#f\u000F\u0010d:$e01d8\u001Ad?\u001De\u0001%g(\u000Be:&e\u000F\u0002f\u00150d:\u000Bd8\u001Af\u00154d8*e11d8\u001Cf\u0003\u0005f\u0004\u001Fg\t9f.\ne\u0008\u0006i!\u001Ef\u0010\u001Ce0\u000Be1\u001Ed:\u000Ei\u0017(f\u00087h4\"e\n!e#0i\u001F3e\u000F\ne\u00056h4\"g;\u000Fe\u001D\u001Af\u000C\u0001e92i\u0003(f\u0008\u0010g+\u000Be\u0008)g\u001B\nh\u0000\u0003h\u0019\u0011f\u0008\u0010i\u0003=e\u000C\u0005h#\u0005g\u0014(f\u00086f/\u0014h5\u001Bf\u0016\u0007f\u0018\u000Ef\u000B\u001Be\u0015\u0006e.\u000Cf\u00154g\u001C\u001Ff\u0018/g\u001C<g\u001D\u001Bd<\u0019d<4e(\u0001f\u001C\u001Bi\"\u0006e\u001F\u001Fe\r+g\u0014\u001Fd<\u0018f\u0003 h+\u0016e#\u0007e\u0005,e\u00051h\t/e%=e\u0005\u0005e\u0008\u0006g,&e\u0010\u0008i\u0019\u0004d;6g\t9g\u00029d8\re\u000F/h\u000B1f\u0016\u0007h5\u0004d:'f 9f\u001C,f\u0018\u000Ef\u0018>e/\u0006g\"<e\u0005,d<\u0017f0\u0011f\u0017\u000Ff\u001B4e\n d:+e\u000F\u0017e\u0010\u000Ce-&e\u0010/e\n(i\u0000\u0002e\u0010\u0008e\u000E\u001Ff\u001D%i\u0017.g-\u0014f\u001C,f\u0016\u0007g>\u000Ei#\u001Fg;?h\t2g(3e.\u001Ag;\u0008d:\u000Eg\u0014\u001Fg\t)d>\u001Bf1\u0002f\u0010\u001Cg\u000B\u0010e\n\u001Bi\u0007\u000Fd8%i\u0007\rf08h?\u001Ce\u0006\u0019g\u001C\u001Ff\u001C\ti\u0019\u0010g+\u001Ed:\te/9h1!h49g\u0014(d8\re%=g;\u001De/9e\r\u0001e\u0008\u0006d?\u0003h?\u001Bg\u00029h/\u0004e=1i\u001F3d<\u0018e\n?d8\re0\u0011f,#h5\u000Fe96d8\u0014f\u001C\tg\u00029f\u00169e\u0010\u0011e\u0005(f\u00160d?!g\u0014(h.>f\u0016=e=\"h1!h5\u0004f <g*\u0001g 4i\u001A\u000Fg\u001D\u0000i\u0007\re$'d:\u000Ef\u0018/f/\u0015d8\u001Af\u0019:h\u0003=e\u000C\u0016e7%e.\u000Cg>\u000Ee\u0015\u0006e\u001F\u000Eg;\u001Fd8\u0000e\u0007:g\t\u0008f\t\u0013i\u0000 g\u0014\"e\u0013\u0001f&\u0002e\u00065g\u0014(d:\u000Ed?\u001Dg\u0015\u0019e\u001B g4 d8-e\u001C\u000Be-\u0018e\u0002(h44e\u001B>f\u001C\u0000f\u0004\u001Bi\u0015?f\u001C\u001Fe\u000F#d;7g\u0010\u0006h4\"e\u001F:e\u001C0e.\tf\u000E\u0012f-&f1\ti\u0007\u000Ci\u001D\"e\u0008\u001Be;:e$)g):i&\u0016e\u0005\u0008e.\u000Ce\u0016\u0004i)1e\n(d8\u000Bi\u001D\"d8\re\u0006\rh/\u001Ad?!f\u0004\u000Fd9\ti\u00183e\u0005\th\u000B1e\u001B=f<\u0002d:.e\u0006\u001Bd:\u000Bg\u000E)e.6g>$d<\u0017e\u0006\u001Cf0\u0011e\r3e\u000F/e\u0010\rg(1e.6e\u00057e\n(g\u0014;f\u00033e\u00080f3(f\u0018\u000Ee0\u000Fe-&f\u0000'h\u0003=h\u0000\u0003g \u0014g!,d;6h'\u0002g\u001C\u000Bf8\u0005f%\u001Af\u0010\u001Eg,\u0011i&\u0016i \u0001i;\u0004i\u0007\u0011i\u0000\u0002g\u0014(f1\u001Fh\u000B\u000Fg\u001C\u001Fe.\u001Ed8;g.!i\u00186f.5h(;e\u0006\ng?;h/\u0011f\u001D\u0003e\u0008)e\u0001\u001Ae%=d<<d9\u000Ei\u0000\u001Ah./f\u0016=e7%g\u000B\u0000f\u0005\u000Bd9\u001Fh.8g\u000E/d?\u001De\u001F9e\u0005;f&\u0002e?5e$'e\u001E\u000Bf\u001C:g%(g\u0010\u0006h'#e\u000C?e\u0010\rcuandoenviarmadridbuscariniciotiempoporquecuentaestadopuedenjuegoscontraestC!nnombretienenperfilmaneraamigosciudadcentroaunquepuedesdentroprimerpreciosegC:nbuenosvolverpuntossemanahabC-aagostonuevosunidoscarlosequiponiC1osmuchosalgunacorreoimagenpartirarribamarC-ahombreempleoverdadcambiomuchasfueronpasadolC-neaparecenuevascursosestabaquierolibroscuantoaccesomiguelvarioscuatrotienesgruposserC!neuropamediosfrenteacercademC!sofertacochesmodeloitalialetrasalgC:ncompracualesexistecuerposiendoprensallegarviajesdineromurciapodrC!puestodiariopuebloquieremanuelpropiocrisisciertoseguromuertefuentecerrargrandeefectopartesmedidapropiaofrecetierrae-mailvariasformasfuturoobjetoseguirriesgonormasmismosC:nicocaminositiosrazC3ndebidopruebatoledotenC-ajesC:sesperococinaorigentiendacientocC!dizhablarserC-alatinafuerzaestiloguerraentrarC)xitolC3pezagendavC-deoevitarpaginametrosjavierpadresfC!cilcabezaC!reassalidaenvC-ojapC3nabusosbienestextosllevarpuedanfuertecomC:nclaseshumanotenidobilbaounidadestC!seditarcreadoP4P;Q\u000FQ\u0007Q\u0002P>P:P0P:P8P;P8Q\rQ\u0002P>P2Q\u0001P5P5P3P>P?Q\u0000P8Q\u0002P0P:P5Q\tP5Q\u0003P6P5P\u001AP0P:P1P5P7P1Q\u000BP;P>P=P8P\u0012Q\u0001P5P?P>P4P-Q\u0002P>Q\u0002P>P<Q\u0007P5P<P=P5Q\u0002P;P5Q\u0002Q\u0000P0P7P>P=P0P3P4P5P<P=P5P\u0014P;Q\u000FP\u001FQ\u0000P8P=P0Q\u0001P=P8Q\u0005Q\u0002P5P<P:Q\u0002P>P3P>P4P2P>Q\u0002Q\u0002P0P<P!P(P\u0010P<P0Q\u000FP'Q\u0002P>P2P0Q\u0001P2P0P<P5P<Q\u0003P\"P0P:P4P2P0P=P0P<Q\rQ\u0002P8Q\rQ\u0002Q\u0003P\u0012P0P<Q\u0002P5Q\u0005P?Q\u0000P>Q\u0002Q\u0003Q\u0002P=P0P4P4P=Q\u000FP\u0012P>Q\u0002Q\u0002Q\u0000P8P=P5P9P\u0012P0Q\u0001P=P8P<Q\u0001P0P<Q\u0002P>Q\u0002Q\u0000Q\u0003P1P\u001EP=P8P<P8Q\u0000P=P5P5P\u001EP\u001EP\u001EP;P8Q\u0006Q\rQ\u0002P0P\u001EP=P0P=P5P<P4P>P<P<P>P9P4P2P5P>P=P>Q\u0001Q\u0003P4`$\u0015`%\u0007`$9`%\u0008`$\u0015`%\u0000`$8`%\u0007`$\u0015`$>`$\u0015`%\u000B`$\u0014`$0`$*`$0`$(`%\u0007`$\u000F`$\u0015`$\u0015`$?`$-`%\u0000`$\u0007`$8`$\u0015`$0`$$`%\u000B`$9`%\u000B`$\u0006`$*`$9`%\u0000`$/`$9`$/`$>`$$`$\u0015`$%`$>jagran`$\u0006`$\u001C`$\u001C`%\u000B`$\u0005`$,`$&`%\u000B`$\u0017`$\u0008`$\u001C`$>`$\u0017`$\u000F`$9`$.`$\u0007`$(`$5`$9`$/`%\u0007`$%`%\u0007`$%`%\u0000`$\u0018`$0`$\u001C`$,`$&`%\u0000`$\u0015`$\u0008`$\u001C`%\u0000`$5`%\u0007`$(`$\u0008`$(`$\u000F`$9`$0`$\t`$8`$.`%\u0007`$\u0015`$.`$5`%\u000B`$2`%\u0007`$8`$,`$.`$\u0008`$&`%\u0007`$\u0013`$0`$\u0006`$.`$,`$8`$-`$0`$,`$(`$\u001A`$2`$.`$(`$\u0006`$\u0017`$8`%\u0000`$2`%\u0000X9Y\u0004Y\tX%Y\u0004Y\tY\u0007X0X'X\"X.X1X9X/X/X'Y\u0004Y\tY\u0007X0Y\u0007X5Y\u0008X1X:Y\nX1Y\u0003X'Y\u0006Y\u0008Y\u0004X'X(Y\nY\u0006X9X1X6X0Y\u0004Y\u0003Y\u0007Y\u0006X'Y\nY\u0008Y\u0005Y\u0002X'Y\u0004X9Y\u0004Y\nX'Y\u0006X'Y\u0004Y\u0003Y\u0006X-X*Y\tY\u0002X(Y\u0004Y\u0008X-X)X'X.X1Y\u0001Y\u0002X7X9X(X/X1Y\u0003Y\u0006X%X0X'Y\u0003Y\u0005X'X'X-X/X%Y\u0004X'Y\u0001Y\nY\u0007X(X9X6Y\u0003Y\nY\u0001X(X-X+Y\u0008Y\u0005Y\u0006Y\u0008Y\u0007Y\u0008X#Y\u0006X'X,X/X'Y\u0004Y\u0007X'X3Y\u0004Y\u0005X9Y\u0006X/Y\u0004Y\nX3X9X(X1X5Y\u0004Y\tY\u0005Y\u0006X0X(Y\u0007X'X#Y\u0006Y\u0007Y\u0005X+Y\u0004Y\u0003Y\u0006X*X'Y\u0004X'X-Y\nX+Y\u0005X5X1X4X1X-X-Y\u0008Y\u0004Y\u0008Y\u0001Y\nX'X0X'Y\u0004Y\u0003Y\u0004Y\u0005X1X)X'Y\u0006X*X'Y\u0004Y\u0001X#X(Y\u0008X.X'X5X#Y\u0006X*X'Y\u0006Y\u0007X'Y\u0004Y\nX9X6Y\u0008Y\u0008Y\u0002X/X'X(Y\u0006X.Y\nX1X(Y\u0006X*Y\u0004Y\u0003Y\u0005X4X'X!Y\u0008Y\u0007Y\nX'X(Y\u0008Y\u0002X5X5Y\u0008Y\u0005X'X1Y\u0002Y\u0005X#X-X/Y\u0006X-Y\u0006X9X/Y\u0005X1X#Y\nX'X-X)Y\u0003X*X(X/Y\u0008Y\u0006Y\nX,X(Y\u0005Y\u0006Y\u0007X*X-X*X,Y\u0007X)X3Y\u0006X)Y\nX*Y\u0005Y\u0003X1X)X:X2X)Y\u0006Y\u0001X3X(Y\nX*Y\u0004Y\u0004Y\u0007Y\u0004Y\u0006X'X*Y\u0004Y\u0003Y\u0002Y\u0004X(Y\u0004Y\u0005X'X9Y\u0006Y\u0007X#Y\u0008Y\u0004X4Y\nX!Y\u0006Y\u0008X1X#Y\u0005X'Y\u0001Y\nY\u0003X(Y\u0003Y\u0004X0X'X*X1X*X(X(X#Y\u0006Y\u0007Y\u0005X3X'Y\u0006Y\u0003X(Y\nX9Y\u0001Y\u0002X/X-X3Y\u0006Y\u0004Y\u0007Y\u0005X4X9X1X#Y\u0007Y\u0004X4Y\u0007X1Y\u0002X7X1X7Y\u0004X(profileservicedefaulthimselfdetailscontentsupportstartedmessagesuccessfashion<title>countryaccountcreatedstoriesresultsrunningprocesswritingobjectsvisiblewelcomearticleunknownnetworkcompanydynamicbrowserprivacyproblemServicerespectdisplayrequestreservewebsitehistoryfriendsoptionsworkingversionmillionchannelwindow.addressvisitedweathercorrectproductedirectforwardyou canremovedsubjectcontrolarchivecurrentreadinglibrarylimitedmanagerfurthersummarymachineminutesprivatecontextprogramsocietynumberswrittenenabledtriggersourcesloadingelementpartnerfinallyperfectmeaningsystemskeepingculture&quot;,journalprojectsurfaces&quot;expiresreviewsbalanceEnglishContentthroughPlease opinioncontactaverageprimaryvillageSpanishgallerydeclinemeetingmissionpopularqualitymeasuregeneralspeciessessionsectionwriterscounterinitialreportsfiguresmembersholdingdisputeearlierexpressdigitalpictureAnothermarriedtrafficleadingchangedcentralvictoryimages/reasonsstudiesfeaturelistingmust beschoolsVersionusuallyepisodeplayinggrowingobviousoverlaypresentactions</ul>\r\nwrapperalreadycertainrealitystorageanotherdesktopofferedpatternunusualDigitalcapitalWebsitefailureconnectreducedAndroiddecadesregular &amp; animalsreleaseAutomatgettingmethodsnothingPopularcaptionletterscapturesciencelicensechangesEngland=1&amp;History = new CentralupdatedSpecialNetworkrequirecommentwarningCollegetoolbarremainsbecauseelectedDeutschfinanceworkersquicklybetweenexactlysettingdiseaseSocietyweaponsexhibit&lt;!--Controlclassescoveredoutlineattacksdevices(windowpurposetitle=\"Mobile killingshowingItaliandroppedheavilyeffects-1']);\nconfirmCurrentadvancesharingopeningdrawingbillionorderedGermanyrelated</form>includewhetherdefinedSciencecatalogArticlebuttonslargestuniformjourneysidebarChicagoholidayGeneralpassage,&quot;animatefeelingarrivedpassingnaturalroughly.\n\nThe but notdensityBritainChineselack oftributeIreland\" data-factorsreceivethat isLibraryhusbandin factaffairsCharlesradicalbroughtfindinglanding:lang=\"return leadersplannedpremiumpackageAmericaEdition]&quot;Messageneed tovalue=\"complexlookingstationbelievesmaller-mobilerecordswant tokind ofFirefoxyou aresimilarstudiedmaximumheadingrapidlyclimatekingdomemergedamountsfoundedpioneerformuladynastyhow to SupportrevenueeconomyResultsbrothersoldierlargelycalling.&quot;AccountEdward segmentRobert effortsPacificlearnedup withheight:we haveAngelesnations_searchappliedacquiremassivegranted: falsetreatedbiggestbenefitdrivingStudiesminimumperhapsmorningsellingis usedreversevariant role=\"missingachievepromotestudentsomeoneextremerestorebottom:evolvedall thesitemapenglishway to AugustsymbolsCompanymattersmusicalagainstserving})();\r\npaymenttroubleconceptcompareparentsplayersregionsmonitor ''The winningexploreadaptedGalleryproduceabilityenhancecareers). The collectSearch ancientexistedfooter handlerprintedconsoleEasternexportswindowsChannelillegalneutralsuggest_headersigning.html\">settledwesterncausing-webkitclaimedJusticechaptervictimsThomas mozillapromisepartieseditionoutside:false,hundredOlympic_buttonauthorsreachedchronicdemandssecondsprotectadoptedprepareneithergreatlygreateroverallimprovecommandspecialsearch.worshipfundingthoughthighestinsteadutilityquarterCulturetestingclearlyexposedBrowserliberal} catchProjectexamplehide();FloridaanswersallowedEmperordefenseseriousfreedomSeveral-buttonFurtherout of != nulltrainedDenmarkvoid(0)/all.jspreventRequestStephen\n\nWhen observe</h2>\r\nModern provide\" alt=\"borders.\n\nFor \n\nMany artistspoweredperformfictiontype ofmedicalticketsopposedCouncilwitnessjusticeGeorge Belgium...</a>twitternotablywaitingwarfare Other rankingphrasesmentionsurvivescholar</p>\r\n Countryignoredloss ofjust asGeorgiastrange<head><stopped1']);\r\nislandsnotableborder:list ofcarried100,000</h3>\n severalbecomesselect wedding00.htmlmonarchoff theteacherhighly biologylife ofor evenrise of&raquo;plusonehunting(thoughDouglasjoiningcirclesFor theAncientVietnamvehiclesuch ascrystalvalue =Windowsenjoyeda smallassumed<a id=\"foreign All rihow theDisplayretiredhoweverhidden;battlesseekingcabinetwas notlook atconductget theJanuaryhappensturninga:hoverOnline French lackingtypicalextractenemieseven ifgeneratdecidedare not/searchbeliefs-image:locatedstatic.login\">convertviolententeredfirst\">circuitFinlandchemistshe was10px;\">as suchdivided</span>will beline ofa greatmystery/index.fallingdue to railwaycollegemonsterdescentit withnuclearJewish protestBritishflowerspredictreformsbutton who waslectureinstantsuicidegenericperiodsmarketsSocial fishingcombinegraphicwinners<br /><by the NaturalPrivacycookiesoutcomeresolveSwedishbrieflyPersianso muchCenturydepictscolumnshousingscriptsnext tobearingmappingrevisedjQuery(-width:title\">tooltipSectiondesignsTurkishyounger.match(})();\n\nburningoperatedegreessource=Richardcloselyplasticentries</tr>\r\ncolor:#ul id=\"possessrollingphysicsfailingexecutecontestlink toDefault<br />\n: true,chartertourismclassicproceedexplain</h1>\r\nonline.?xml vehelpingdiamonduse theairlineend -->).attr(readershosting#ffffffrealizeVincentsignals src=\"/ProductdespitediversetellingPublic held inJoseph theatreaffects<style>a largedoesn'tlater, ElementfaviconcreatorHungaryAirportsee theso thatMichaelSystemsPrograms, and width=e&quot;tradingleft\">\npersonsGolden Affairsgrammarformingdestroyidea ofcase ofoldest this is.src = cartoonregistrCommonsMuslimsWhat isin manymarkingrevealsIndeed,equally/show_aoutdoorescape(Austriageneticsystem,In the sittingHe alsoIslandsAcademy\n\t\t<!--Daniel bindingblock\">imposedutilizeAbraham(except{width:putting).html(|| [];\nDATA[ *kitchenmountedactual dialectmainly _blank'installexpertsif(typeIt also&copy; \">Termsborn inOptionseasterntalkingconcerngained ongoingjustifycriticsfactoryits ownassaultinvitedlastinghis ownhref=\"/\" rel=\"developconcertdiagramdollarsclusterphp?id=alcohol);})();using a><span>vesselsrevivalAddressamateurandroidallegedillnesswalkingcentersqualifymatchesunifiedextinctDefensedied in\n\t<!-- customslinkingLittle Book ofeveningmin.js?are thekontakttoday's.html\" target=wearingAll Rig;\n})();raising Also, crucialabout\">declare-->\n<scfirefoxas muchappliesindex, s, but type = \n\r\n<!--towardsRecordsPrivateForeignPremierchoicesVirtualreturnsCommentPoweredinline;povertychamberLiving volumesAnthonylogin\" RelatedEconomyreachescuttinggravitylife inChapter-shadowNotable</td>\r\n returnstadiumwidgetsvaryingtravelsheld bywho arework infacultyangularwho hadairporttown of\n\nSome 'click'chargeskeywordit willcity of(this);Andrew unique checkedor more300px; return;rsion=\"pluginswithin herselfStationFederalventurepublishsent totensionactresscome tofingersDuke ofpeople,exploitwhat isharmonya major\":\"httpin his menu\">\nmonthlyofficercouncilgainingeven inSummarydate ofloyaltyfitnessand wasemperorsupremeSecond hearingRussianlongestAlbertalateralset of small\">.appenddo withfederalbank ofbeneathDespiteCapitalgrounds), and percentit fromclosingcontainInsteadfifteenas well.yahoo.respondfighterobscurereflectorganic= Math.editingonline paddinga wholeonerroryear ofend of barrierwhen itheader home ofresumedrenamedstrong>heatingretainscloudfrway of March 1knowingin partBetweenlessonsclosestvirtuallinks\">crossedEND -->famous awardedLicenseHealth fairly wealthyminimalAfricancompetelabel\">singingfarmersBrasil)discussreplaceGregoryfont copursuedappearsmake uproundedboth ofblockedsaw theofficescoloursif(docuwhen heenforcepush(fuAugust UTF-8\">Fantasyin mostinjuredUsuallyfarmingclosureobject defenceuse of Medical<body>\nevidentbe usedkeyCodesixteenIslamic#000000entire widely active (typeofone cancolor =speakerextendsPhysicsterrain<tbody>funeralviewingmiddle cricketprophetshifteddoctorsRussell targetcompactalgebrasocial-bulk ofman and</td>\n he left).val()false);logicalbankinghome tonaming Arizonacredits);\n});\nfounderin turnCollinsbefore But thechargedTitle\">CaptainspelledgoddessTag -->Adding:but wasRecent patientback in=false&Lincolnwe knowCounterJudaismscript altered']);\n has theunclearEvent',both innot all\n\n<!-- placinghard to centersort ofclientsstreetsBernardassertstend tofantasydown inharbourFreedomjewelry/about..searchlegendsis mademodern only ononly toimage\" linear painterand notrarely acronymdelivershorter00&amp;as manywidth=\"/* <![Ctitle =of the lowest picked escapeduses ofpeoples PublicMatthewtacticsdamagedway forlaws ofeasy to windowstrong simple}catch(seventhinfoboxwent topaintedcitizenI don'tretreat. Some ww.\");\nbombingmailto:made in. Many carries||{};wiwork ofsynonymdefeatsfavoredopticalpageTraunless sendingleft\"><comScorAll thejQuery.touristClassicfalse\" Wilhelmsuburbsgenuinebishops.split(global followsbody ofnominalContactsecularleft tochiefly-hidden-banner</li>\n\n. When in bothdismissExplorealways via thespaC1olwelfareruling arrangecaptainhis sonrule ofhe tookitself,=0&amp;(calledsamplesto makecom/pagMartin Kennedyacceptsfull ofhandledBesides//--></able totargetsessencehim to its by common.mineralto takeways tos.org/ladvisedpenaltysimple:if theyLettersa shortHerbertstrikes groups.lengthflightsoverlapslowly lesser social </p>\n\t\tit intoranked rate oful>\r\n attemptpair ofmake itKontaktAntoniohaving ratings activestreamstrapped\").css(hostilelead tolittle groups,Picture-->\r\n\r\n rows=\" objectinverse<footerCustomV><\\/scrsolvingChamberslaverywoundedwhereas!= 'undfor allpartly -right:Arabianbacked centuryunit ofmobile-Europe,is homerisk ofdesiredClintoncost ofage of become none ofp&quot;Middle ead')[0Criticsstudios>&copy;group\">assemblmaking pressedwidget.ps:\" ? rebuiltby someFormer editorsdelayedCanonichad thepushingclass=\"but arepartialBabylonbottom carrierCommandits useAs withcoursesa thirddenotesalso inHouston20px;\">accuseddouble goal ofFamous ).bind(priests Onlinein Julyst + \"gconsultdecimalhelpfulrevivedis veryr'+'iptlosing femalesis alsostringsdays ofarrivalfuture <objectforcingString(\" />\n\t\there isencoded. The balloondone by/commonbgcolorlaw of Indianaavoidedbut the2px 3pxjquery.after apolicy.men andfooter-= true;for usescreen.Indian image =family,http:// &nbsp;driverseternalsame asnoticedviewers})();\n is moreseasonsformer the newis justconsent Searchwas thewhy theshippedbr><br>width: height=made ofcuisineis thata very Admiral fixed;normal MissionPress, ontariocharsettry to invaded=\"true\"spacingis mosta more totallyfall of});\r\n immensetime inset outsatisfyto finddown tolot of Playersin Junequantumnot thetime todistantFinnishsrc = (single help ofGerman law andlabeledforestscookingspace\">header-well asStanleybridges/globalCroatia About [0];\n it, andgroupedbeing a){throwhe madelighterethicalFFFFFF\"bottom\"like a employslive inas seenprintermost ofub-linkrejectsand useimage\">succeedfeedingNuclearinformato helpWomen'sNeitherMexicanprotein<table by manyhealthylawsuitdevised.push({sellerssimply Through.cookie Image(older\">us.js\"> Since universlarger open to!-- endlies in']);\r\n marketwho is (\"DOMComanagedone fortypeof Kingdomprofitsproposeto showcenter;made itdressedwere inmixtureprecisearisingsrc = 'make a securedBaptistvoting \n\t\tvar March 2grew upClimate.removeskilledway the</head>face ofacting right\">to workreduceshas haderectedshow();action=book ofan area== \"htt<header\n<html>conformfacing cookie.rely onhosted .customhe wentbut forspread Family a meansout theforums.footage\">MobilClements\" id=\"as highintense--><!--female is seenimpliedset thea stateand hisfastestbesidesbutton_bounded\"><img Infoboxevents,a youngand areNative cheaperTimeoutand hasengineswon the(mostlyright: find a -bottomPrince area ofmore ofsearch_nature,legallyperiod,land ofor withinducedprovingmissilelocallyAgainstthe wayk&quot;px;\">\r\npushed abandonnumeralCertainIn thismore inor somename isand, incrownedISBN 0-createsOctobermay notcenter late inDefenceenactedwish tobroadlycoolingonload=it. TherecoverMembersheight assumes<html>\npeople.in one =windowfooter_a good reklamaothers,to this_cookiepanel\">London,definescrushedbaptismcoastalstatus title\" move tolost inbetter impliesrivalryservers SystemPerhapses and contendflowinglasted rise inGenesisview ofrising seem tobut in backinghe willgiven agiving cities.flow of Later all butHighwayonly bysign ofhe doesdiffersbattery&amp;lasinglesthreatsintegertake onrefusedcalled =US&ampSee thenativesby thissystem.head of:hover,lesbiansurnameand allcommon/header__paramsHarvard/pixel.removalso longrole ofjointlyskyscraUnicodebr />\r\nAtlantanucleusCounty,purely count\">easily build aonclicka givenpointerh&quot;events else {\nditionsnow the, with man whoorg/Webone andcavalryHe diedseattle00,000 {windowhave toif(windand itssolely m&quot;renewedDetroitamongsteither them inSenatorUs</a><King ofFrancis-produche usedart andhim andused byscoringat hometo haverelatesibilityfactionBuffalolink\"><what hefree toCity ofcome insectorscountedone daynervoussquare };if(goin whatimg\" alis onlysearch/tuesdaylooselySolomonsexual - <a hrmedium\"DO NOT France,with a war andsecond take a >\r\n\r\n\r\nmarket.highwaydone inctivity\"last\">obligedrise to\"undefimade to Early praisedin its for hisathleteJupiterYahoo! termed so manyreally s. The a woman?value=direct right\" bicycleacing=\"day andstatingRather,higher Office are nowtimes, when a pay foron this-link\">;borderaround annual the Newput the.com\" takin toa brief(in thegroups.; widthenzymessimple in late{returntherapya pointbanninginks\">\n();\" rea place\\u003Caabout atr>\r\n\t\tccount gives a<SCRIPTRailwaythemes/toolboxById(\"xhumans,watchesin some if (wicoming formats Under but hashanded made bythan infear ofdenoted/iframeleft involtagein eacha&quot;base ofIn manyundergoregimesaction </p>\r\n<ustomVa;&gt;</importsor thatmostly &amp;re size=\"</a></ha classpassiveHost = WhetherfertileVarious=[];(fucameras/></td>acts asIn some>\r\n\r\n<!organis <br />BeijingcatalC deutscheuropeueuskaragaeilgesvenskaespaC1amensajeusuariotrabajomC)xicopC!ginasiempresistemaoctubreduranteaC1adirempresamomentonuestroprimeratravC)sgraciasnuestraprocesoestadoscalidadpersonanC:meroacuerdomC:sicamiembroofertasalgunospaC-sesejemploderechoademC!sprivadoagregarenlacesposiblehotelessevillaprimeroC:ltimoeventosarchivoculturamujeresentradaanuncioembargomercadograndesestudiomejoresfebrerodiseC1oturismocC3digoportadaespaciofamiliaantoniopermiteguardaralgunaspreciosalguiensentidovisitastC-tuloconocersegundoconsejofranciaminutossegundatenemosefectosmC!lagasesiC3nrevistagranadacompraringresogarcC-aacciC3necuadorquienesinclusodeberC!materiahombresmuestrapodrC-amaC1anaC:ltimaestamosoficialtambienningC:nsaludospodemosmejorarpositionbusinesshomepagesecuritylanguagestandardcampaignfeaturescategoryexternalchildrenreservedresearchexchangefavoritetemplatemilitaryindustryservicesmaterialproductsz-index:commentssoftwarecompletecalendarplatformarticlesrequiredmovementquestionbuildingpoliticspossiblereligionphysicalfeedbackregisterpicturesdisabledprotocolaudiencesettingsactivityelementslearninganythingabstractprogressoverviewmagazineeconomictrainingpressurevarious <strong>propertyshoppingtogetheradvancedbehaviordownloadfeaturedfootballselectedLanguagedistanceremembertrackingpasswordmodifiedstudentsdirectlyfightingnortherndatabasefestivalbreakinglocationinternetdropdownpracticeevidencefunctionmarriageresponseproblemsnegativeprogramsanalysisreleasedbanner\">purchasepoliciesregionalcreativeargumentbookmarkreferrerchemicaldivisioncallbackseparateprojectsconflicthardwareinterestdeliverymountainobtained= false;for(var acceptedcapacitycomputeridentityaircraftemployedproposeddomesticincludesprovidedhospitalverticalcollapseapproachpartnerslogo\"><adaughterauthor\" culturalfamilies/images/assemblypowerfulteachingfinisheddistrictcriticalcgi-bin/purposesrequireselectionbecomingprovidesacademicexerciseactuallymedicineconstantaccidentMagazinedocumentstartingbottom\">observed: &quot;extendedpreviousSoftwarecustomerdecisionstrengthdetailedslightlyplanningtextareacurrencyeveryonestraighttransferpositiveproducedheritageshippingabsolutereceivedrelevantbutton\" violenceanywherebenefitslaunchedrecentlyalliancefollowedmultiplebulletinincludedoccurredinternal$(this).republic><tr><tdcongressrecordedultimatesolution<ul id=\"discoverHome</a>websitesnetworksalthoughentirelymemorialmessagescontinueactive\">somewhatvictoriaWestern title=\"LocationcontractvisitorsDownloadwithout right\">\nmeasureswidth = variableinvolvedvirginianormallyhappenedaccountsstandingnationalRegisterpreparedcontrolsaccuratebirthdaystrategyofficialgraphicscriminalpossiblyconsumerPersonalspeakingvalidateachieved.jpg\" />machines</h2>\n keywordsfriendlybrotherscombinedoriginalcomposedexpectedadequatepakistanfollow\" valuable</label>relativebringingincreasegovernorplugins/List of Header\">\" name=\" (&quot;graduate</head>\ncommercemalaysiadirectormaintain;height:schedulechangingback to catholicpatternscolor: #greatestsuppliesreliable</ul>\n\t\t<select citizensclothingwatching<li id=\"specificcarryingsentence<center>contrastthinkingcatch(e)southernMichael merchantcarouselpadding:interior.split(\"lizationOctober ){returnimproved--&gt;\n\ncoveragechairman.png\" />subjectsRichard whateverprobablyrecoverybaseballjudgmentconnect..css\" /> websitereporteddefault\"/></a>\r\nelectricscotlandcreationquantity. ISBN 0did not instance-search-\" lang=\"speakersComputercontainsarchivesministerreactiondiscountItalianocriteriastrongly: 'http:'script'coveringofferingappearedBritish identifyFacebooknumerousvehiclesconcernsAmericanhandlingdiv id=\"William provider_contentaccuracysection andersonflexibleCategorylawrence<script>layout=\"approved maximumheader\"></table>Serviceshamiltoncurrent canadianchannels/themes//articleoptionalportugalvalue=\"\"intervalwirelessentitledagenciesSearch\" measuredthousandspending&hellip;new Date\" size=\"pageNamemiddle\" \" /></a>hidden\">sequencepersonaloverflowopinionsillinoislinks\">\n\t<title>versionssaturdayterminalitempropengineersectionsdesignerproposal=\"false\"EspaC1olreleasessubmit\" er&quot;additionsymptomsorientedresourceright\"><pleasurestationshistory.leaving border=contentscenter\">.\n\nSome directedsuitablebulgaria.show();designedGeneral conceptsExampleswilliamsOriginal\"><span>search\">operatorrequestsa &quot;allowingDocumentrevision. \n\nThe yourselfContact michiganEnglish columbiapriorityprintingdrinkingfacilityreturnedContent officersRussian generate-8859-1\"indicatefamiliar qualitymargin:0 contentviewportcontacts-title\">portable.length eligibleinvolvesatlanticonload=\"default.suppliedpaymentsglossary\n\nAfter guidance</td><tdencodingmiddle\">came to displaysscottishjonathanmajoritywidgets.clinicalthailandteachers<head>\n\taffectedsupportspointer;toString</small>oklahomawill be investor0\" alt=\"holidaysResourcelicensed (which . After considervisitingexplorerprimary search\" android\"quickly meetingsestimate;return ;color:# height=approval, &quot; checked.min.js\"magnetic></a></hforecast. While thursdaydvertise&eacute;hasClassevaluateorderingexistingpatients Online coloradoOptions\"campbell<!-- end</span><<br />\r\n_popups|sciences,&quot; quality Windows assignedheight: <b classle&quot; value=\" Companyexamples<iframe believespresentsmarshallpart of properly).\n\nThe taxonomymuch of </span>\n\" data-srtuguC*sscrollTo project<head>\r\nattorneyemphasissponsorsfancyboxworld's wildlifechecked=sessionsprogrammpx;font- Projectjournalsbelievedvacationthompsonlightingand the special border=0checking</tbody><button Completeclearfix\n<head>\narticle <sectionfindingsrole in popular Octoberwebsite exposureused to changesoperatedclickingenteringcommandsinformed numbers </div>creatingonSubmitmarylandcollegesanalyticlistingscontact.loggedInadvisorysiblingscontent\"s&quot;)s. This packagescheckboxsuggestspregnanttomorrowspacing=icon.pngjapanesecodebasebutton\">gamblingsuch as , while </span> missourisportingtop:1px .</span>tensionswidth=\"2lazyloadnovemberused in height=\"cript\">\n&nbsp;</<tr><td height:2/productcountry include footer\" &lt;!-- title\"></jquery.</form>\n(g.\u0000d=\u0013)(g9\u0001i+\u0014)hrvatskiitalianoromC\"nD\u0003tC<rkC'eX'X1X/Y\u0008tambiC)nnoticiasmensajespersonasderechosnacionalserviciocontactousuariosprogramagobiernoempresasanunciosvalenciacolombiadespuC)sdeportesproyectoproductopC:bliconosotroshistoriapresentemillonesmediantepreguntaanteriorrecursosproblemasantiagonuestrosopiniC3nimprimirmientrasamC)ricavendedorsociedadrespectorealizarregistropalabrasinterC)sentoncesespecialmiembrosrealidadcC3rdobazaragozapC!ginassocialesbloqueargestiC3nalquilersistemascienciascompletoversiC3ncompletaestudiospC:blicaobjetivoalicantebuscadorcantidadentradasaccionesarchivossuperiormayorC-aalemaniafunciC3nC:ltimoshaciendoaquellosediciC3nfernandoambientefacebooknuestrasclientesprocesosbastantepresentareportarcongresopublicarcomerciocontratojC3venesdistritotC)cnicaconjuntoenergC-atrabajarasturiasrecienteutilizarboletC-nsalvadorcorrectatrabajosprimerosnegocioslibertaddetallespantallaprC3ximoalmerC-aanimalesquiC)nescorazC3nsecciC3nbuscandoopcionesexteriorconceptotodavC-agalerC-aescribirmedicinalicenciaconsultaaspectoscrC-ticadC3laresjusticiadeberC!nperC-odonecesitamantenerpequeC1orecibidatribunaltenerifecanciC3ncanariasdescargadiversosmallorcarequieretC)cnicodeberC-aviviendafinanzasadelantefuncionaconsejosdifC-cilciudadesantiguasavanzadatC)rminounidadessC!nchezcampaC1asoftonicrevistascontienesectoresmomentosfacultadcrC)ditodiversassupuestofactoressegundospequeC1aP3P>P4P0P5Q\u0001P;P8P5Q\u0001Q\u0002Q\u000CP1Q\u000BP;P>P1Q\u000BQ\u0002Q\u000CQ\rQ\u0002P>P<P\u0015Q\u0001P;P8Q\u0002P>P3P>P<P5P=Q\u000FP2Q\u0001P5Q\u0005Q\rQ\u0002P>P9P4P0P6P5P1Q\u000BP;P8P3P>P4Q\u0003P4P5P=Q\u000CQ\rQ\u0002P>Q\u0002P1Q\u000BP;P0Q\u0001P5P1Q\u000FP>P4P8P=Q\u0001P5P1P5P=P0P4P>Q\u0001P0P9Q\u0002Q\u0004P>Q\u0002P>P=P5P3P>Q\u0001P2P>P8Q\u0001P2P>P9P8P3Q\u0000Q\u000BQ\u0002P>P6P5P2Q\u0001P5P<Q\u0001P2P>Q\u000EP;P8Q\u0008Q\u000CQ\rQ\u0002P8Q\u0005P?P>P:P0P4P=P5P9P4P>P<P0P<P8Q\u0000P0P;P8P1P>Q\u0002P5P<Q\u0003Q\u0005P>Q\u0002Q\u000FP4P2Q\u0003Q\u0005Q\u0001P5Q\u0002P8P;Q\u000EP4P8P4P5P;P>P<P8Q\u0000P5Q\u0002P5P1Q\u000FQ\u0001P2P>P5P2P8P4P5Q\u0007P5P3P>Q\rQ\u0002P8P<Q\u0001Q\u0007P5Q\u0002Q\u0002P5P<Q\u000BQ\u0006P5P=Q\u000BQ\u0001Q\u0002P0P;P2P5P4Q\u000CQ\u0002P5P<P5P2P>P4Q\u000BQ\u0002P5P1P5P2Q\u000BQ\u0008P5P=P0P<P8Q\u0002P8P?P0Q\u0002P>P<Q\u0003P?Q\u0000P0P2P;P8Q\u0006P0P>P4P=P0P3P>P4Q\u000BP7P=P0Q\u000EP<P>P3Q\u0003P4Q\u0000Q\u0003P3P2Q\u0001P5P9P8P4P5Q\u0002P:P8P=P>P>P4P=P>P4P5P;P0P4P5P;P5Q\u0001Q\u0000P>P:P8Q\u000EP=Q\u000FP2P5Q\u0001Q\u000CP\u0015Q\u0001Q\u0002Q\u000CQ\u0000P0P7P0P=P0Q\u0008P8X'Y\u0004Y\u0004Y\u0007X'Y\u0004X*Y\nX,Y\u0005Y\nX9X.X'X5X)X'Y\u0004X0Y\nX9Y\u0004Y\nY\u0007X,X/Y\nX/X'Y\u0004X\"Y\u0006X'Y\u0004X1X/X*X-Y\u0003Y\u0005X5Y\u0001X-X)Y\u0003X'Y\u0006X*X'Y\u0004Y\u0004Y\nY\nY\u0003Y\u0008Y\u0006X4X(Y\u0003X)Y\u0001Y\nY\u0007X'X(Y\u0006X'X*X-Y\u0008X'X!X#Y\u0003X+X1X.Y\u0004X'Y\u0004X'Y\u0004X-X(X/Y\u0004Y\nY\u0004X/X1Y\u0008X3X'X6X:X7X*Y\u0003Y\u0008Y\u0006Y\u0007Y\u0006X'Y\u0003X3X'X-X)Y\u0006X'X/Y\nX'Y\u0004X7X(X9Y\u0004Y\nY\u0003X4Y\u0003X1X'Y\nY\u0005Y\u0003Y\u0006Y\u0005Y\u0006Y\u0007X'X4X1Y\u0003X)X1X&Y\nX3Y\u0006X4Y\nX7Y\u0005X'X0X'X'Y\u0004Y\u0001Y\u0006X4X(X'X(X*X9X(X1X1X-Y\u0005X)Y\u0003X'Y\u0001X)Y\nY\u0002Y\u0008Y\u0004Y\u0005X1Y\u0003X2Y\u0003Y\u0004Y\u0005X)X#X-Y\u0005X/Y\u0002Y\u0004X(Y\nY\nX9Y\u0006Y\nX5Y\u0008X1X)X7X1Y\nY\u0002X4X'X1Y\u0003X,Y\u0008X'Y\u0004X#X.X1Y\tY\u0005X9Y\u0006X'X'X(X-X+X9X1Y\u0008X6X(X4Y\u0003Y\u0004Y\u0005X3X,Y\u0004X(Y\u0006X'Y\u0006X.X'Y\u0004X/Y\u0003X*X'X(Y\u0003Y\u0004Y\nX)X(X/Y\u0008Y\u0006X#Y\nX6X'Y\nY\u0008X,X/Y\u0001X1Y\nY\u0002Y\u0003X*X(X*X#Y\u0001X6Y\u0004Y\u0005X7X(X.X'Y\u0003X+X1X(X'X1Y\u0003X'Y\u0001X6Y\u0004X'X-Y\u0004Y\tY\u0006Y\u0001X3Y\u0007X#Y\nX'Y\u0005X1X/Y\u0008X/X#Y\u0006Y\u0007X'X/Y\nY\u0006X'X'Y\u0004X'Y\u0006Y\u0005X9X1X6X*X9Y\u0004Y\u0005X/X'X.Y\u0004Y\u0005Y\u0005Y\u0003Y\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0002\u0000\u0002\u0000\u0002\u0000\u0002\u0000\u0004\u0000\u0004\u0000\u0004\u0000\u0004\u0000\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0007\u0006\u0005\u0004\u0003\u0002\u0001\u0000\u0008\t\n\u000B\u000C\r\u000E\u000F\u000F\u000E\r\u000C\u000B\n\t\u0008\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0017\u0016\u0015\u0014\u0013\u0012\u0011\u0010\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\u001F\u001E\u001D\u001C\u001B\u001A\u0019\u0018\u007F\u007F\u007F\u007F\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007F\u007F\u007F\u007F\u0001\u0000\u0000\u0000\u0002\u0000\u0000\u0000\u0002\u0000\u0000\u0000\u0001\u0000\u0000\u0000\u0001\u0000\u0000\u0000\u0003\u0000\u0000\u0000\u007F\u007F\u0000\u0001\u0000\u0000\u0000\u0001\u0000\u0000\u007F\u007F\u0000\u0001\u0000\u0000\u0000\u0008\u0000\u0008\u0000\u0008\u0000\u0008\u0000\u0000\u0000\u0001\u0000\u0002\u0000\u0003\u0000\u0004\u0000\u0005\u0000\u0006\u0000\u0007resourcescountriesquestionsequipmentcommunityavailablehighlightDTD/xhtmlmarketingknowledgesomethingcontainerdirectionsubscribeadvertisecharacter\" value=\"</select>Australia\" class=\"situationauthorityfollowingprimarilyoperationchallengedevelopedanonymousfunction functionscompaniesstructureagreement\" title=\"potentialeducationargumentssecondarycopyrightlanguagesexclusivecondition</form>\r\nstatementattentionBiography} else {\nsolutionswhen the Analyticstemplatesdangeroussatellitedocumentspublisherimportantprototypeinfluence&raquo;</effectivegenerallytransformbeautifultransportorganizedpublishedprominentuntil thethumbnailNational .focus();over the migrationannouncedfooter\">\nexceptionless thanexpensiveformationframeworkterritoryndicationcurrentlyclassNamecriticismtraditionelsewhereAlexanderappointedmaterialsbroadcastmentionedaffiliate</option>treatmentdifferent/default.Presidentonclick=\"biographyotherwisepermanentFranC'aisHollywoodexpansionstandards</style>\nreductionDecember preferredCambridgeopponentsBusiness confusion>\n<title>presentedexplaineddoes not worldwideinterfacepositionsnewspaper</table>\nmountainslike the essentialfinancialselectionaction=\"/abandonedEducationparseInt(stabilityunable to</title>\nrelationsNote thatefficientperformedtwo yearsSince thethereforewrapper\">alternateincreasedBattle ofperceivedtrying tonecessaryportrayedelectionsElizabeth</iframe>discoveryinsurances.length;legendaryGeographycandidatecorporatesometimesservices.inherited</strong>CommunityreligiouslocationsCommitteebuildingsthe worldno longerbeginningreferencecannot befrequencytypicallyinto the relative;recordingpresidentinitiallytechniquethe otherit can beexistenceunderlinethis timetelephoneitemscopepracticesadvantage);return For otherprovidingdemocracyboth the extensivesufferingsupportedcomputers functionpracticalsaid thatit may beEnglish</from the scheduleddownloads</label>\nsuspectedmargin: 0spiritual</head>\n\nmicrosoftgraduallydiscussedhe becameexecutivejquery.jshouseholdconfirmedpurchasedliterallydestroyedup to thevariationremainingit is notcenturiesJapanese among thecompletedalgorithminterestsrebellionundefinedencourageresizableinvolvingsensitiveuniversalprovision(althoughfeaturingconducted), which continued-header\">February numerous overflow:componentfragmentsexcellentcolspan=\"technicalnear the Advanced source ofexpressedHong Kong Facebookmultiple mechanismelevationoffensive</form>\n\tsponsoreddocument.or &quot;there arethose whomovementsprocessesdifficultsubmittedrecommendconvincedpromoting\" width=\".replace(classicalcoalitionhis firstdecisionsassistantindicatedevolution-wrapper\"enough toalong thedelivered-->\r\n<!--American protectedNovember </style><furnitureInternet onblur=\"suspendedrecipientbased on Moreover,abolishedcollectedwere madeemotionalemergencynarrativeadvocatespx;bordercommitteddir=\"ltr\"employeesresearch. selectedsuccessorcustomersdisplayedSeptemberaddClass(Facebook suggestedand lateroperatingelaborateSometimesInstitutecertainlyinstalledfollowersJerusalemthey havecomputinggeneratedprovincesguaranteearbitraryrecognizewanted topx;width:theory ofbehaviourWhile theestimatedbegan to it becamemagnitudemust havemore thanDirectoryextensionsecretarynaturallyoccurringvariablesgiven theplatform.</label><failed tocompoundskinds of societiesalongside --&gt;\n\nsouthwestthe rightradiationmay have unescape(spoken in\" href=\"/programmeonly the come fromdirectoryburied ina similarthey were</font></Norwegianspecifiedproducingpassenger(new DatetemporaryfictionalAfter theequationsdownload.regularlydeveloperabove thelinked tophenomenaperiod oftooltip\">substanceautomaticaspect ofAmong theconnectedestimatesAir Forcesystem ofobjectiveimmediatemaking itpaintingsconqueredare stillproceduregrowth ofheaded byEuropean divisionsmoleculesfranchiseintentionattractedchildhoodalso useddedicatedsingaporedegree offather ofconflicts</a></p>\ncame fromwere usednote thatreceivingExecutiveeven moreaccess tocommanderPoliticalmusiciansdeliciousprisonersadvent ofUTF-8\" /><![CDATA[\">ContactSouthern bgcolor=\"series of. It was in Europepermittedvalidate.appearingofficialsseriously-languageinitiatedextendinglong-terminflationsuch thatgetCookiemarked by</button>implementbut it isincreasesdown the requiringdependent-->\n<!-- interviewWith the copies ofconsensuswas builtVenezuela(formerlythe statepersonnelstrategicfavour ofinventionWikipediacontinentvirtuallywhich wasprincipleComplete identicalshow thatprimitiveaway frommolecularpreciselydissolvedUnder theversion=\">&nbsp;</It is the This is will haveorganismssome timeFriedrichwas firstthe only fact thatform id=\"precedingTechnicalphysicistoccurs innavigatorsection\">span id=\"sought tobelow thesurviving}</style>his deathas in thecaused bypartiallyexisting using thewas givena list oflevels ofnotion ofOfficial dismissedscientistresemblesduplicateexplosiverecoveredall othergalleries{padding:people ofregion ofaddressesassociateimg alt=\"in modernshould bemethod ofreportingtimestampneeded tothe Greatregardingseemed toviewed asimpact onidea thatthe Worldheight ofexpandingThese arecurrent\">carefullymaintainscharge ofClassicaladdressedpredictedownership<div id=\"right\">\r\nresidenceleave thecontent\">are often })();\r\nprobably Professor-button\" respondedsays thathad to beplaced inHungarianstatus ofserves asUniversalexecutionaggregatefor whichinfectionagreed tohowever, popular\">placed onconstructelectoralsymbol ofincludingreturn toarchitectChristianprevious living ineasier toprofessor\n&lt;!-- effect ofanalyticswas takenwhere thetook overbelief inAfrikaansas far aspreventedwork witha special<fieldsetChristmasRetrieved\n\nIn the back intonortheastmagazines><strong>committeegoverninggroups ofstored inestablisha generalits firsttheir ownpopulatedan objectCaribbeanallow thedistrictswisconsinlocation.; width: inhabitedSocialistJanuary 1</footer>similarlychoice ofthe same specific business The first.length; desire todeal withsince theuserAgentconceivedindex.phpas &quot;engage inrecently,few yearswere also\n<head>\n<edited byare knowncities inaccesskeycondemnedalso haveservices,family ofSchool ofconvertednature of languageministers</object>there is a popularsequencesadvocatedThey wereany otherlocation=enter themuch morereflectedwas namedoriginal a typicalwhen theyengineerscould notresidentswednesdaythe third productsJanuary 2what theya certainreactionsprocessorafter histhe last contained\"></div>\n</a></td>depend onsearch\">\npieces ofcompetingReferencetennesseewhich has version=</span> <</header>gives thehistorianvalue=\"\">padding:0view thattogether,the most was foundsubset ofattack onchildren,points ofpersonal position:allegedlyClevelandwas laterand afterare givenwas stillscrollingdesign ofmakes themuch lessAmericans.\n\nAfter , but theMuseum oflouisiana(from theminnesotaparticlesa processDominicanvolume ofreturningdefensive00px|righmade frommouseover\" style=\"states of(which iscontinuesFranciscobuilding without awith somewho woulda form ofa part ofbefore itknown as Serviceslocation and oftenmeasuringand it ispaperbackvalues of\r\n<title>= window.determineer&quot; played byand early</center>from thisthe threepower andof &quot;innerHTML<a href=\"y:inline;Church ofthe eventvery highofficial -height: content=\"/cgi-bin/to createafrikaansesperantofranC'aislatvieE!ulietuviE3D\u000CeE!tinaD\reE!tina`9\u0004`8\u0017`8\"f\u0017%f\u001C,h*\u001Eg.\u0000d=\u0013e-\u0017g9\u0001i+\u0014e-\u0017m\u0015\u001Cj5-l\u00164d8:d;\u0000d9\u0008h.!g.\u0017f\u001C:g,\u0014h.0f\u001C,h(\u000Eh+\u0016e\r\u0000f\u001C\re\n!e\u0019(d:\u0012h\u0001\u0014g=\u0011f\u0008?e\u001C0d:'d?1d9\u0010i\u0003(e\u0007:g\t\u0008g$>f\u000E\u0012h!\u000Cf&\u001Ci\u0003(h\u0010=f <h?\u001Bd8\u0000f-%f\u0014/d;\u0018e.\u001Di*\u000Ch/\u0001g \u0001e'\u0014e\u0011\u0018d<\u001Af\u00150f\r.e:\u0013f6\u0008h49h\u0000\u0005e\n\u001Ee\u0005,e.$h.(h.:e\u000C:f71e\u001C3e8\u0002f\u0012-f\u0014>e\u0019(e\u000C\u0017d:,e8\u0002e$'e-&g\u0014\u001Fh6\nf\u001D%h6\ng.!g\u0010\u0006e\u0011\u0018d?!f\u0001/g=\u0011serviciosartC-culoargentinabarcelonacualquierpublicadoproductospolC-ticarespuestawikipediasiguientebC:squedacomunidadseguridadprincipalpreguntascontenidorespondervenezuelaproblemasdiciembrerelaciC3nnoviembresimilaresproyectosprogramasinstitutoactividadencuentraeconomC-aimC!genescontactardescargarnecesarioatenciC3ntelC)fonocomisiC3ncancionescapacidadencontraranC!lisisfavoritostC)rminosprovinciaetiquetaselementosfuncionesresultadocarC!cterpropiedadprincipionecesidadmunicipalcreaciC3ndescargaspresenciacomercialopinionesejercicioeditorialsalamancagonzC!lezdocumentopelC-cularecientesgeneralestarragonaprC!cticanovedadespropuestapacientestC)cnicasobjetivoscontactos`$.`%\u0007`$\u0002`$2`$?`$\u000F`$9`%\u0008`$\u0002`$\u0017`$/`$>`$8`$>`$%`$\u000F`$5`$\u0002`$0`$9`%\u0007`$\u0015`%\u000B`$\u0008`$\u0015`%\u0001`$\u001B`$0`$9`$>`$,`$>`$&`$\u0015`$9`$>`$8`$-`%\u0000`$9`%\u0001`$\u000F`$0`$9`%\u0000`$.`%\u0008`$\u0002`$&`$?`$(`$,`$>`$$diplodocs`$8`$.`$/`$0`%\u0002`$*`$(`$>`$.`$*`$$`$>`$+`$?`$0`$\u0014`$8`$$`$$`$0`$9`$2`%\u000B`$\u0017`$9`%\u0001`$\u0006`$,`$>`$0`$&`%\u0007`$6`$9`%\u0001`$\u0008`$\u0016`%\u0007`$2`$/`$&`$?`$\u0015`$>`$.`$5`%\u0007`$,`$$`%\u0000`$(`$,`%\u0000`$\u001A`$.`%\u000C`$$`$8`$>`$2`$2`%\u0007`$\u0016`$\u001C`%\t`$,`$.`$&`$&`$$`$%`$>`$(`$9`%\u0000`$6`$9`$0`$\u0005`$2`$\u0017`$\u0015`$-`%\u0000`$(`$\u0017`$0`$*`$>`$8`$0`$>`$$`$\u0015`$?`$\u000F`$\t`$8`%\u0007`$\u0017`$/`%\u0000`$9`%\u0002`$\u0001`$\u0006`$\u0017`%\u0007`$\u001F`%\u0000`$.`$\u0016`%\u000B`$\u001C`$\u0015`$>`$0`$\u0005`$-`%\u0000`$\u0017`$/`%\u0007`$$`%\u0001`$.`$5`%\u000B`$\u001F`$&`%\u0007`$\u0002`$\u0005`$\u0017`$0`$\u0010`$8`%\u0007`$.`%\u0007`$2`$2`$\u0017`$>`$9`$>`$2`$\n`$*`$0`$\u001A`$>`$0`$\u0010`$8`$>`$&`%\u0007`$0`$\u001C`$?`$8`$&`$?`$2`$,`$\u0002`$&`$,`$(`$>`$9`%\u0002`$\u0002`$2`$>`$\u0016`$\u001C`%\u0000`$$`$,`$\u001F`$(`$.`$?`$2`$\u0007`$8`%\u0007`$\u0006`$(`%\u0007`$(`$/`$>`$\u0015`%\u0001`$2`$2`%\t`$\u0017`$-`$>`$\u0017`$0`%\u0007`$2`$\u001C`$\u0017`$9`$0`$>`$.`$2`$\u0017`%\u0007`$*`%\u0007`$\u001C`$9`$>`$%`$\u0007`$8`%\u0000`$8`$9`%\u0000`$\u0015`$2`$>`$ `%\u0000`$\u0015`$9`$>`$\u0001`$&`%\u0002`$0`$$`$9`$$`$8`$>`$$`$/`$>`$&`$\u0006`$/`$>`$*`$>`$\u0015`$\u0015`%\u000C`$(`$6`$>`$.`$&`%\u0007`$\u0016`$/`$9`%\u0000`$0`$>`$/`$\u0016`%\u0001`$&`$2`$\u0017`%\u0000categoriesexperience</title>\r\nCopyright javascriptconditionseverything<p class=\"technologybackground<a class=\"management&copy; 201javaScriptcharactersbreadcrumbthemselveshorizontalgovernmentCaliforniaactivitiesdiscoveredNavigationtransitionconnectionnavigationappearance</title><mcheckbox\" techniquesprotectionapparentlyas well asunt', 'UA-resolutionoperationstelevisiontranslatedWashingtonnavigator. = window.impression&lt;br&gt;literaturepopulationbgcolor=\"#especially content=\"productionnewsletterpropertiesdefinitionleadershipTechnologyParliamentcomparisonul class=\".indexOf(\"conclusiondiscussioncomponentsbiologicalRevolution_containerunderstoodnoscript><permissioneach otheratmosphere onfocus=\"<form id=\"processingthis.valuegenerationConferencesubsequentwell-knownvariationsreputationphenomenondisciplinelogo.png\" (document,boundariesexpressionsettlementBackgroundout of theenterprise(\"https:\" unescape(\"password\" democratic<a href=\"/wrapper\">\nmembershiplinguisticpx;paddingphilosophyassistanceuniversityfacilitiesrecognizedpreferenceif (typeofmaintainedvocabularyhypothesis.submit();&amp;nbsp;annotationbehind theFoundationpublisher\"assumptionintroducedcorruptionscientistsexplicitlyinstead ofdimensions onClick=\"considereddepartmentoccupationsoon afterinvestmentpronouncedidentifiedexperimentManagementgeographic\" height=\"link rel=\".replace(/depressionconferencepunishmenteliminatedresistanceadaptationoppositionwell knownsupplementdeterminedh1 class=\"0px;marginmechanicalstatisticscelebratedGovernment\n\nDuring tdevelopersartificialequivalentoriginatedCommissionattachment<span id=\"there wereNederlandsbeyond theregisteredjournalistfrequentlyall of thelang=\"en\" </style>\r\nabsolute; supportingextremely mainstream</strong> popularityemployment</table>\r\n colspan=\"</form>\n conversionabout the </p></div>integrated\" lang=\"enPortuguesesubstituteindividualimpossiblemultimediaalmost allpx solid #apart fromsubject toin Englishcriticizedexcept forguidelinesoriginallyremarkablethe secondh2 class=\"<a title=\"(includingparametersprohibited= \"http://dictionaryperceptionrevolutionfoundationpx;height:successfulsupportersmillenniumhis fatherthe &quot;no-repeat;commercialindustrialencouragedamount of unofficialefficiencyReferencescoordinatedisclaimerexpeditiondevelopingcalculatedsimplifiedlegitimatesubstring(0\" class=\"completelyillustratefive yearsinstrumentPublishing1\" class=\"psychologyconfidencenumber of absence offocused onjoined thestructurespreviously></iframe>once againbut ratherimmigrantsof course,a group ofLiteratureUnlike the</a>&nbsp;\nfunction it was theConventionautomobileProtestantaggressiveafter the Similarly,\" /></div>collection\r\nfunctionvisibilitythe use ofvolunteersattractionunder the threatened*<![CDATA[importancein generalthe latter</form>\n</.indexOf('i = 0; i <differencedevoted totraditionssearch forultimatelytournamentattributesso-called }\n</style>evaluationemphasizedaccessible</section>successionalong withMeanwhile,industries</a><br />has becomeaspects ofTelevisionsufficientbasketballboth sidescontinuingan article<img alt=\"adventureshis mothermanchesterprinciplesparticularcommentaryeffects ofdecided to\"><strong>publishersJournal ofdifficultyfacilitateacceptablestyle.css\"\tfunction innovation>Copyrightsituationswould havebusinessesDictionarystatementsoften usedpersistentin Januarycomprising</title>\n\tdiplomaticcontainingperformingextensionsmay not beconcept of onclick=\"It is alsofinancial making theLuxembourgadditionalare calledengaged in\"script\");but it waselectroniconsubmit=\"\n<!-- End electricalofficiallysuggestiontop of theunlike theAustralianOriginallyreferences\n</head>\r\nrecognisedinitializelimited toAlexandriaretirementAdventuresfour years\n\n&lt;!-- increasingdecorationh3 class=\"origins ofobligationregulationclassified(function(advantagesbeing the historians<base hrefrepeatedlywilling tocomparabledesignatednominationfunctionalinside therevelationend of thes for the authorizedrefused totake placeautonomouscompromisepolitical restauranttwo of theFebruary 2quality ofswfobject.understandnearly allwritten byinterviews\" width=\"1withdrawalfloat:leftis usuallycandidatesnewspapersmysteriousDepartmentbest knownparliamentsuppressedconvenientremembereddifferent systematichas led topropagandacontrolledinfluencesceremonialproclaimedProtectionli class=\"Scientificclass=\"no-trademarksmore than widespreadLiberationtook placeday of theas long asimprisonedAdditional\n<head>\n<mLaboratoryNovember 2exceptionsIndustrialvariety offloat: lefDuring theassessmenthave been deals withStatisticsoccurrence/ul></div>clearfix\">the publicmany yearswhich wereover time,synonymouscontent\">\npresumablyhis familyuserAgent.unexpectedincluding challengeda minorityundefined\"belongs totaken fromin Octoberposition: said to bereligious Federation rowspan=\"only a fewmeant thatled to the-->\r\n<div <fieldset>Archbishop class=\"nobeing usedapproachesprivilegesnoscript>\nresults inmay be theEaster eggmechanismsreasonablePopulationCollectionselected\">noscript>\r/index.phparrival of-jssdk'));managed toincompletecasualtiescompletionChristiansSeptember arithmeticproceduresmight haveProductionit appearsPhilosophyfriendshipleading togiving thetoward theguaranteeddocumentedcolor:#000video gamecommissionreflectingchange theassociatedsans-serifonkeypress; padding:He was theunderlyingtypically , and the srcElementsuccessivesince the should be networkingaccountinguse of thelower thanshows that</span>\n\t\tcomplaintscontinuousquantitiesastronomerhe did notdue to itsapplied toan averageefforts tothe futureattempt toTherefore,capabilityRepublicanwas formedElectronickilometerschallengespublishingthe formerindigenousdirectionssubsidiaryconspiracydetails ofand in theaffordablesubstancesreason forconventionitemtype=\"absolutelysupposedlyremained aattractivetravellingseparatelyfocuses onelementaryapplicablefound thatstylesheetmanuscriptstands for no-repeat(sometimesCommercialin Americaundertakenquarter ofan examplepersonallyindex.php?</button>\npercentagebest-knowncreating a\" dir=\"ltrLieutenant\n<div id=\"they wouldability ofmade up ofnoted thatclear thatargue thatto anotherchildren'spurpose offormulatedbased uponthe regionsubject ofpassengerspossession.\n\nIn the Before theafterwardscurrently across thescientificcommunity.capitalismin Germanyright-wingthe systemSociety ofpoliticiandirection:went on toremoval of New York apartmentsindicationduring theunless thehistoricalhad been adefinitiveingredientattendanceCenter forprominencereadyStatestrategiesbut in theas part ofconstituteclaim thatlaboratorycompatiblefailure of, such as began withusing the to providefeature offrom which/\" class=\"geologicalseveral ofdeliberateimportant holds thating&quot; valign=topthe Germanoutside ofnegotiatedhis careerseparationid=\"searchwas calledthe fourthrecreationother thanpreventionwhile the education,connectingaccuratelywere builtwas killedagreementsmuch more Due to thewidth: 100some otherKingdom ofthe entirefamous forto connectobjectivesthe Frenchpeople andfeatured\">is said tostructuralreferendummost oftena separate->\n<div id Official worldwide.aria-labelthe planetand it wasd\" value=\"looking atbeneficialare in themonitoringreportedlythe modernworking onallowed towhere the innovative</a></div>soundtracksearchFormtend to beinput id=\"opening ofrestrictedadopted byaddressingtheologianmethods ofvariant ofChristian very largeautomotiveby far therange frompursuit offollow thebrought toin Englandagree thataccused ofcomes frompreventingdiv style=his or hertremendousfreedom ofconcerning0 1em 1em;Basketball/style.cssan earliereven after/\" title=\".com/indextaking thepittsburghcontent\">\r<script>(fturned outhaving the</span>\r\n occasionalbecause itstarted tophysically></div>\n created byCurrently, bgcolor=\"tabindex=\"disastrousAnalytics also has a><div id=\"</style>\n<called forsinger and.src = \"//violationsthis pointconstantlyis locatedrecordingsd from thenederlandsportuguC*sW\"W\u0011W(W\u0019W*Y\u0001X'X1X3[\u000CdesarrollocomentarioeducaciC3nseptiembreregistradodirecciC3nubicaciC3npublicidadrespuestasresultadosimportantereservadosartC-culosdiferentessiguientesrepC:blicasituaciC3nministerioprivacidaddirectorioformaciC3npoblaciC3npresidentecont", "enidosaccesoriostechnoratipersonalescategorC-aespecialesdisponibleactualidadreferenciavalladolidbibliotecarelacionescalendariopolC-ticasanterioresdocumentosnaturalezamaterialesdiferenciaeconC3micatransporterodrC-guezparticiparencuentrandiscusiC3nestructurafundaciC3nfrecuentespermanentetotalmenteP<P>P6P=P>P1Q\u0003P4P5Q\u0002P<P>P6P5Q\u0002P2Q\u0000P5P<Q\u000FQ\u0002P0P:P6P5Q\u0007Q\u0002P>P1Q\u000BP1P>P;P5P5P>Q\u0007P5P=Q\u000CQ\rQ\u0002P>P3P>P:P>P3P4P0P?P>Q\u0001P;P5P2Q\u0001P5P3P>Q\u0001P0P9Q\u0002P5Q\u0007P5Q\u0000P5P7P<P>P3Q\u0003Q\u0002Q\u0001P0P9Q\u0002P0P6P8P7P=P8P<P5P6P4Q\u0003P1Q\u0003P4Q\u0003Q\u0002P\u001FP>P8Q\u0001P:P7P4P5Q\u0001Q\u000CP2P8P4P5P>Q\u0001P2Q\u000FP7P8P=Q\u0003P6P=P>Q\u0001P2P>P5P9P;Q\u000EP4P5P9P?P>Q\u0000P=P>P<P=P>P3P>P4P5Q\u0002P5P9Q\u0001P2P>P8Q\u0005P?Q\u0000P0P2P0Q\u0002P0P:P>P9P<P5Q\u0001Q\u0002P>P8P<P5P5Q\u0002P6P8P7P=Q\u000CP>P4P=P>P9P;Q\u0003Q\u0007Q\u0008P5P?P5Q\u0000P5P4Q\u0007P0Q\u0001Q\u0002P8Q\u0007P0Q\u0001Q\u0002Q\u000CQ\u0000P0P1P>Q\u0002P=P>P2Q\u000BQ\u0005P?Q\u0000P0P2P>Q\u0001P>P1P>P9P?P>Q\u0002P>P<P<P5P=P5P5Q\u0007P8Q\u0001P;P5P=P>P2Q\u000BP5Q\u0003Q\u0001P;Q\u0003P3P>P:P>P;P>P=P0P7P0P4Q\u0002P0P:P>P5Q\u0002P>P3P4P0P?P>Q\u0007Q\u0002P8P\u001FP>Q\u0001P;P5Q\u0002P0P:P8P5P=P>P2Q\u000BP9Q\u0001Q\u0002P>P8Q\u0002Q\u0002P0P:P8Q\u0005Q\u0001Q\u0000P0P7Q\u0003P!P0P=P:Q\u0002Q\u0004P>Q\u0000Q\u0003P<P\u001AP>P3P4P0P:P=P8P3P8Q\u0001P;P>P2P0P=P0Q\u0008P5P9P=P0P9Q\u0002P8Q\u0001P2P>P8P<Q\u0001P2Q\u000FP7Q\u000CP;Q\u000EP1P>P9Q\u0007P0Q\u0001Q\u0002P>Q\u0001Q\u0000P5P4P8P\u001AQ\u0000P>P<P5P$P>Q\u0000Q\u0003P<Q\u0000Q\u000BP=P:P5Q\u0001Q\u0002P0P;P8P?P>P8Q\u0001P:Q\u0002Q\u000BQ\u0001Q\u000FQ\u0007P<P5Q\u0001Q\u000FQ\u0006Q\u0006P5P=Q\u0002Q\u0000Q\u0002Q\u0000Q\u0003P4P0Q\u0001P0P<Q\u000BQ\u0005Q\u0000Q\u000BP=P:P0P\u001DP>P2Q\u000BP9Q\u0007P0Q\u0001P>P2P<P5Q\u0001Q\u0002P0Q\u0004P8P;Q\u000CP<P<P0Q\u0000Q\u0002P0Q\u0001Q\u0002Q\u0000P0P=P<P5Q\u0001Q\u0002P5Q\u0002P5P:Q\u0001Q\u0002P=P0Q\u0008P8Q\u0005P<P8P=Q\u0003Q\u0002P8P<P5P=P8P8P<P5Q\u000EQ\u0002P=P>P<P5Q\u0000P3P>Q\u0000P>P4Q\u0001P0P<P>P<Q\rQ\u0002P>P<Q\u0003P:P>P=Q\u0006P5Q\u0001P2P>P5P<P:P0P:P>P9P\u0010Q\u0000Q\u0005P8P2Y\u0005Y\u0006X*X/Y\tX%X1X3X'Y\u0004X1X3X'Y\u0004X)X'Y\u0004X9X'Y\u0005Y\u0003X*X(Y\u0007X'X(X1X'Y\u0005X,X'Y\u0004Y\nY\u0008Y\u0005X'Y\u0004X5Y\u0008X1X,X/Y\nX/X)X'Y\u0004X9X6Y\u0008X%X6X'Y\u0001X)X'Y\u0004Y\u0002X3Y\u0005X'Y\u0004X9X'X(X*X-Y\u0005Y\nY\u0004Y\u0005Y\u0004Y\u0001X'X*Y\u0005Y\u0004X*Y\u0002Y\tX*X9X/Y\nY\u0004X'Y\u0004X4X9X1X#X.X(X'X1X*X7Y\u0008Y\nX1X9Y\u0004Y\nY\u0003Y\u0005X%X1Y\u0001X'Y\u0002X7Y\u0004X(X'X*X'Y\u0004Y\u0004X:X)X*X1X*Y\nX(X'Y\u0004Y\u0006X'X3X'Y\u0004X4Y\nX.Y\u0005Y\u0006X*X/Y\nX'Y\u0004X9X1X(X'Y\u0004Y\u0002X5X5X'Y\u0001Y\u0004X'Y\u0005X9Y\u0004Y\nY\u0007X'X*X-X/Y\nX+X'Y\u0004Y\u0004Y\u0007Y\u0005X'Y\u0004X9Y\u0005Y\u0004Y\u0005Y\u0003X*X(X)Y\nY\u0005Y\u0003Y\u0006Y\u0003X'Y\u0004X7Y\u0001Y\u0004Y\u0001Y\nX/Y\nY\u0008X%X/X'X1X)X*X'X1Y\nX.X'Y\u0004X5X-X)X*X3X,Y\nY\u0004X'Y\u0004Y\u0008Y\u0002X*X9Y\u0006X/Y\u0005X'Y\u0005X/Y\nY\u0006X)X*X5Y\u0005Y\nY\u0005X#X1X4Y\nY\u0001X'Y\u0004X0Y\nY\u0006X9X1X(Y\nX)X(Y\u0008X'X(X)X#Y\u0004X9X'X(X'Y\u0004X3Y\u0001X1Y\u0005X4X'Y\u0003Y\u0004X*X9X'Y\u0004Y\tX'Y\u0004X#Y\u0008Y\u0004X'Y\u0004X3Y\u0006X)X,X'Y\u0005X9X)X'Y\u0004X5X-Y\u0001X'Y\u0004X/Y\nY\u0006Y\u0003Y\u0004Y\u0005X'X*X'Y\u0004X.X'X5X'Y\u0004Y\u0005Y\u0004Y\u0001X#X9X6X'X!Y\u0003X*X'X(X)X'Y\u0004X.Y\nX1X1X3X'X&Y\u0004X'Y\u0004Y\u0002Y\u0004X(X'Y\u0004X#X/X(Y\u0005Y\u0002X'X7X9Y\u0005X1X'X3Y\u0004Y\u0005Y\u0006X7Y\u0002X)X'Y\u0004Y\u0003X*X(X'Y\u0004X1X,Y\u0004X'X4X*X1Y\u0003X'Y\u0004Y\u0002X/Y\u0005Y\nX9X7Y\nY\u0003sByTagName(.jpg\" alt=\"1px solid #.gif\" alt=\"transparentinformationapplication\" onclick=\"establishedadvertising.png\" alt=\"environmentperformanceappropriate&amp;mdash;immediately</strong></rather thantemperaturedevelopmentcompetitionplaceholdervisibility:copyright\">0\" height=\"even thoughreplacementdestinationCorporation<ul class=\"AssociationindividualsperspectivesetTimeout(url(http://mathematicsmargin-top:eventually description) no-repeatcollections.JPG|thumb|participate/head><bodyfloat:left;<li class=\"hundreds of\n\nHowever, compositionclear:both;cooperationwithin the label for=\"border-top:New Zealandrecommendedphotographyinteresting&lt;sup&gt;controversyNetherlandsalternativemaxlength=\"switzerlandDevelopmentessentially\n\nAlthough </textarea>thunderbirdrepresented&amp;ndash;speculationcommunitieslegislationelectronics\n\t<div id=\"illustratedengineeringterritoriesauthoritiesdistributed6\" height=\"sans-serif;capable of disappearedinteractivelooking forit would beAfghanistanwas createdMath.floor(surroundingcan also beobservationmaintenanceencountered<h2 class=\"more recentit has beeninvasion of).getTime()fundamentalDespite the\"><div id=\"inspirationexaminationpreparationexplanation<input id=\"</a></span>versions ofinstrumentsbefore the = 'http://Descriptionrelatively .substring(each of theexperimentsinfluentialintegrationmany peopledue to the combinationdo not haveMiddle East<noscript><copyright\" perhaps theinstitutionin Decemberarrangementmost famouspersonalitycreation oflimitationsexclusivelysovereignty-content\">\n<td class=\"undergroundparallel todoctrine ofoccupied byterminologyRenaissancea number ofsupport forexplorationrecognitionpredecessor<img src=\"/<h1 class=\"publicationmay also bespecialized</fieldset>progressivemillions ofstates thatenforcementaround the one another.parentNodeagricultureAlternativeresearcherstowards theMost of themany other (especially<td width=\";width:100%independent<h3 class=\" onchange=\").addClass(interactionOne of the daughter ofaccessoriesbranches of\r\n<div id=\"the largestdeclarationregulationsInformationtranslationdocumentaryin order to\">\n<head>\n<\" height=\"1across the orientation);</script>implementedcan be seenthere was ademonstratecontainer\">connectionsthe Britishwas written!important;px; margin-followed byability to complicatedduring the immigrationalso called<h4 class=\"distinctionreplaced bygovernmentslocation ofin Novemberwhether the</p>\n</div>acquisitioncalled the persecutiondesignation{font-size:appeared ininvestigateexperiencedmost likelywidely useddiscussionspresence of (document.extensivelyIt has beenit does notcontrary toinhabitantsimprovementscholarshipconsumptioninstructionfor exampleone or morepx; paddingthe currenta series ofare usuallyrole in thepreviously derivativesevidence ofexperiencescolorschemestated thatcertificate</a></div>\n selected=\"high schoolresponse tocomfortableadoption ofthree yearsthe countryin Februaryso that thepeople who provided by<param nameaffected byin terms ofappointmentISO-8859-1\"was born inhistorical regarded asmeasurementis based on and other : function(significantcelebrationtransmitted/js/jquery.is known astheoretical tabindex=\"it could be<noscript>\nhaving been\r\n<head>\r\n< &quot;The compilationhe had beenproduced byphilosopherconstructedintended toamong othercompared toto say thatEngineeringa differentreferred todifferencesbelief thatphotographsidentifyingHistory of Republic ofnecessarilyprobabilitytechnicallyleaving thespectacularfraction ofelectricityhead of therestaurantspartnershipemphasis onmost recentshare with saying thatfilled withdesigned toit is often\"></iframe>as follows:merged withthrough thecommercial pointed outopportunityview of therequirementdivision ofprogramminghe receivedsetInterval\"></span></in New Yorkadditional compression\n\n<div id=\"incorporate;</script><attachEventbecame the \" target=\"_carried outSome of thescience andthe time ofContainer\">maintainingChristopherMuch of thewritings of\" height=\"2size of theversion of mixture of between theExamples ofeducationalcompetitive onsubmit=\"director ofdistinctive/DTD XHTML relating totendency toprovince ofwhich woulddespite thescientific legislature.innerHTML allegationsAgriculturewas used inapproach tointelligentyears later,sans-serifdeterminingPerformanceappearances, which is foundationsabbreviatedhigher thans from the individual composed ofsupposed toclaims thatattributionfont-size:1elements ofHistorical his brotherat the timeanniversarygoverned byrelated to ultimately innovationsit is stillcan only bedefinitionstoGMTStringA number ofimg class=\"Eventually,was changedoccurred inneighboringdistinguishwhen he wasintroducingterrestrialMany of theargues thatan Americanconquest ofwidespread were killedscreen and In order toexpected todescendantsare locatedlegislativegenerations backgroundmost peopleyears afterthere is nothe highestfrequently they do notargued thatshowed thatpredominanttheologicalby the timeconsideringshort-lived</span></a>can be usedvery littleone of the had alreadyinterpretedcommunicatefeatures ofgovernment,</noscript>entered the\" height=\"3Independentpopulationslarge-scale. Although used in thedestructionpossibilitystarting intwo or moreexpressionssubordinatelarger thanhistory and</option>\r\nContinentaleliminatingwill not bepractice ofin front ofsite of theensure thatto create amississippipotentiallyoutstandingbetter thanwhat is nowsituated inmeta name=\"TraditionalsuggestionsTranslationthe form ofatmosphericideologicalenterprisescalculatingeast of theremnants ofpluginspage/index.php?remained intransformedHe was alsowas alreadystatisticalin favor ofMinistry ofmovement offormulationis required<link rel=\"This is the <a href=\"/popularizedinvolved inare used toand severalmade by theseems to belikely thatPalestiniannamed afterit had beenmost commonto refer tobut this isconsecutivetemporarilyIn general,conventionstakes placesubdivisionterritorialoperationalpermanentlywas largelyoutbreak ofin the pastfollowing a xmlns:og=\"><a class=\"class=\"textConversion may be usedmanufactureafter beingclearfix\">\nquestion ofwas electedto become abecause of some peopleinspired bysuccessful a time whenmore commonamongst thean officialwidth:100%;technology,was adoptedto keep thesettlementslive birthsindex.html\"Connecticutassigned to&amp;times;account foralign=rightthe companyalways beenreturned toinvolvementBecause thethis period\" name=\"q\" confined toa result ofvalue=\"\" />is actuallyEnvironment\r\n</head>\r\nConversely,>\n<div id=\"0\" width=\"1is probablyhave becomecontrollingthe problemcitizens ofpoliticiansreached theas early as:none; over<table cellvalidity ofdirectly toonmousedownwhere it iswhen it wasmembers of relation toaccommodatealong with In the latethe Englishdelicious\">this is notthe presentif they areand finallya matter of\r\n\t</div>\r\n\r\n</script>faster thanmajority ofafter whichcomparativeto maintainimprove theawarded theer\" class=\"frameborderrestorationin the sameanalysis oftheir firstDuring the continentalsequence offunction(){font-size: work on the</script>\n<begins withjavascript:constituentwas foundedequilibriumassume thatis given byneeds to becoordinatesthe variousare part ofonly in thesections ofis a commontheories ofdiscoveriesassociationedge of thestrength ofposition inpresent-dayuniversallyto form thebut insteadcorporationattached tois commonlyreasons for &quot;the can be madewas able towhich meansbut did notonMouseOveras possibleoperated bycoming fromthe primaryaddition offor severaltransferreda period ofare able tohowever, itshould havemuch larger\n\t</script>adopted theproperty ofdirected byeffectivelywas broughtchildren ofProgramminglonger thanmanuscriptswar againstby means ofand most ofsimilar to proprietaryoriginatingprestigiousgrammaticalexperience.to make theIt was alsois found incompetitorsin the U.S.replace thebrought thecalculationfall of thethe generalpracticallyin honor ofreleased inresidentialand some ofking of thereaction to1st Earl ofculture andprincipally</title>\n they can beback to thesome of hisexposure toare similarform of theaddFavoritecitizenshippart in thepeople within practiceto continue&amp;minus;approved by the first allowed theand for thefunctioningplaying thesolution toheight=\"0\" in his bookmore than afollows thecreated thepresence in&nbsp;</td>nationalistthe idea ofa characterwere forced class=\"btndays of thefeatured inshowing theinterest inin place ofturn of thethe head ofLord of thepoliticallyhas its ownEducationalapproval ofsome of theeach other,behavior ofand becauseand anotherappeared onrecorded inblack&quot;may includethe world'scan lead torefers to aborder=\"0\" government winning theresulted in while the Washington,the subjectcity in the></div>\r\n\t\treflect theto completebecame moreradioactiverejected bywithout anyhis father,which couldcopy of theto indicatea politicalaccounts ofconstitutesworked wither</a></li>of his lifeaccompaniedclientWidthprevent theLegislativedifferentlytogether inhas severalfor anothertext of thefounded thee with the is used forchanged theusually theplace wherewhereas the> <a href=\"\"><a href=\"themselves,although hethat can betraditionalrole of theas a resultremoveChilddesigned bywest of theSome peopleproduction,side of thenewslettersused by thedown to theaccepted bylive in theattempts tooutside thefrequenciesHowever, inprogrammersat least inapproximatealthough itwas part ofand variousGovernor ofthe articleturned into><a href=\"/the economyis the mostmost widelywould laterand perhapsrise to theoccurs whenunder whichconditions.the westerntheory thatis producedthe city ofin which heseen in thethe centralbuilding ofmany of hisarea of theis the onlymost of themany of thethe WesternThere is noextended toStatisticalcolspan=2 |short storypossible totopologicalcritical ofreported toa Christiandecision tois equal toproblems ofThis can bemerchandisefor most ofno evidenceeditions ofelements in&quot;. Thecom/images/which makesthe processremains theliterature,is a memberthe popularthe ancientproblems intime of thedefeated bybody of thea few yearsmuch of thethe work ofCalifornia,served as agovernment.concepts ofmovement in\t\t<div id=\"it\" value=\"language ofas they areproduced inis that theexplain thediv></div>\nHowever thelead to the\t<a href=\"/was grantedpeople havecontinuallywas seen asand relatedthe role ofproposed byof the besteach other.Constantinepeople fromdialects ofto revisionwas renameda source ofthe initiallaunched inprovide theto the westwhere thereand similarbetween twois also theEnglish andconditions,that it wasentitled tothemselves.quantity ofransparencythe same asto join thecountry andthis is theThis led toa statementcontrast tolastIndexOfthrough hisis designedthe term isis providedprotect theng</a></li>The currentthe site ofsubstantialexperience,in the Westthey shouldslovenD\rinacomentariosuniversidadcondicionesactividadesexperienciatecnologC-aproducciC3npuntuaciC3naplicaciC3ncontraseC1acategorC-asregistrarseprofesionaltratamientoregC-stratesecretarC-aprincipalesprotecciC3nimportantesimportanciaposibilidadinteresantecrecimientonecesidadessuscribirseasociaciC3ndisponiblesevaluaciC3nestudiantesresponsableresoluciC3nguadalajararegistradosoportunidadcomercialesfotografC-aautoridadesingenierC-atelevisiC3ncompetenciaoperacionesestablecidosimplementeactualmentenavegaciC3nconformidadline-height:font-family:\" : \"http://applicationslink\" href=\"specifically//<![CDATA[\nOrganizationdistribution0px; height:relationshipdevice-width<div class=\"<label for=\"registration</noscript>\n/index.html\"window.open( !important;application/independence//www.googleorganizationautocompleterequirementsconservative<form name=\"intellectualmargin-left:18th centuryan importantinstitutionsabbreviation<img class=\"organisationcivilization19th centuryarchitectureincorporated20th century-container\">most notably/></a></div>notification'undefined')Furthermore,believe thatinnerHTML = prior to thedramaticallyreferring tonegotiationsheadquartersSouth AfricaunsuccessfulPennsylvaniaAs a result,<html lang=\"&lt;/sup&gt;dealing withphiladelphiahistorically);</script>\npadding-top:experimentalgetAttributeinstructionstechnologiespart of the =function(){subscriptionl.dtd\">\r\n<htgeographicalConstitution', function(supported byagriculturalconstructionpublicationsfont-size: 1a variety of<div style=\"Encyclopediaiframe src=\"demonstratedaccomplisheduniversitiesDemographics);</script><dedicated toknowledge ofsatisfactionparticularly</div></div>English (US)appendChild(transmissions. However, intelligence\" tabindex=\"float:right;Commonwealthranging fromin which theat least onereproductionencyclopedia;font-size:1jurisdictionat that time\"><a class=\"In addition,description+conversationcontact withis generallyr\" content=\"representing&lt;math&gt;presentationoccasionally<img width=\"navigation\">compensationchampionshipmedia=\"all\" violation ofreference toreturn true;Strict//EN\" transactionsinterventionverificationInformation difficultiesChampionshipcapabilities<![endif]-->}\n</script>\nChristianityfor example,Professionalrestrictionssuggest thatwas released(such as theremoveClass(unemploymentthe Americanstructure of/index.html published inspan class=\"\"><a href=\"/introductionbelonging toclaimed thatconsequences<meta name=\"Guide to theoverwhelmingagainst the concentrated,\n.nontouch observations</a>\n</div>\nf (document.border: 1px {font-size:1treatment of0\" height=\"1modificationIndependencedivided intogreater thanachievementsestablishingJavaScript\" neverthelesssignificanceBroadcasting>&nbsp;</td>container\">\nsuch as the influence ofa particularsrc='http://navigation\" half of the substantial &nbsp;</div>advantage ofdiscovery offundamental metropolitanthe opposite\" xml:lang=\"deliberatelyalign=centerevolution ofpreservationimprovementsbeginning inJesus ChristPublicationsdisagreementtext-align:r, function()similaritiesbody></html>is currentlyalphabeticalis sometimestype=\"image/many of the flow:hidden;available indescribe theexistence ofall over thethe Internet\t<ul class=\"installationneighborhoodarmed forcesreducing thecontinues toNonetheless,temperatures\n\t\t<a href=\"close to theexamples of is about the(see below).\" id=\"searchprofessionalis availablethe official\t\t</script>\n\n\t\t<div id=\"accelerationthrough the Hall of Famedescriptionstranslationsinterference type='text/recent yearsin the worldvery popular{background:traditional some of the connected toexploitationemergence ofconstitutionA History ofsignificant manufacturedexpectations><noscript><can be foundbecause the has not beenneighbouringwithout the added to the\t<li class=\"instrumentalSoviet Unionacknowledgedwhich can bename for theattention toattempts to developmentsIn fact, the<li class=\"aimplicationssuitable formuch of the colonizationpresidentialcancelBubble Informationmost of the is describedrest of the more or lessin SeptemberIntelligencesrc=\"http://px; height: available tomanufacturerhuman rightslink href=\"/availabilityproportionaloutside the astronomicalhuman beingsname of the are found inare based onsmaller thana person whoexpansion ofarguing thatnow known asIn the earlyintermediatederived fromScandinavian</a></div>\r\nconsider thean estimatedthe National<div id=\"pagresulting incommissionedanalogous toare required/ul>\n</div>\nwas based onand became a&nbsp;&nbsp;t\" value=\"\" was capturedno more thanrespectivelycontinue to >\r\n<head>\r\n<were createdmore generalinformation used for theindependent the Imperialcomponent ofto the northinclude the Constructionside of the would not befor instanceinvention ofmore complexcollectivelybackground: text-align: its originalinto accountthis processan extensivehowever, thethey are notrejected thecriticism ofduring whichprobably thethis article(function(){It should bean agreementaccidentallydiffers fromArchitecturebetter knownarrangementsinfluence onattended theidentical tosouth of thepass throughxml\" title=\"weight:bold;creating thedisplay:nonereplaced the<img src=\"/ihttps://www.World War IItestimonialsfound in therequired to and that thebetween the was designedconsists of considerablypublished bythe languageConservationconsisted ofrefer to theback to the css\" media=\"People from available onproved to besuggestions\"was known asvarieties oflikely to becomprised ofsupport the hands of thecoupled withconnect and border:none;performancesbefore beinglater becamecalculationsoften calledresidents ofmeaning that><li class=\"evidence forexplanationsenvironments\"></a></div>which allowsIntroductiondeveloped bya wide rangeon behalf ofvalign=\"top\"principle ofat the time,</noscript>\rsaid to havein the firstwhile othershypotheticalphilosopherspower of thecontained inperformed byinability towere writtenspan style=\"input name=\"the questionintended forrejection ofimplies thatinvented thethe standardwas probablylink betweenprofessor ofinteractionschanging theIndian Ocean class=\"lastworking with'http://www.years beforeThis was therecreationalentering themeasurementsan extremelyvalue of thestart of the\n</script>\n\nan effort toincrease theto the southspacing=\"0\">sufficientlythe Europeanconverted toclearTimeoutdid not haveconsequentlyfor the nextextension ofeconomic andalthough theare producedand with theinsufficientgiven by thestating thatexpenditures</span></a>\nthought thaton the basiscellpadding=image of thereturning toinformation,separated byassassinateds\" content=\"authority ofnorthwestern</div>\n<div \"></div>\r\n consultationcommunity ofthe nationalit should beparticipants align=\"leftthe greatestselection ofsupernaturaldependent onis mentionedallowing thewas inventedaccompanyinghis personalavailable atstudy of theon the otherexecution ofHuman Rightsterms of theassociationsresearch andsucceeded bydefeated theand from thebut they arecommander ofstate of theyears of agethe study of<ul class=\"splace in thewhere he was<li class=\"fthere are nowhich becamehe publishedexpressed into which thecommissionerfont-weight:territory ofextensions\">Roman Empireequal to theIn contrast,however, andis typicallyand his wife(also called><ul class=\"effectively evolved intoseem to havewhich is thethere was noan excellentall of thesedescribed byIn practice,broadcastingcharged withreflected insubjected tomilitary andto the pointeconomicallysetTargetingare actuallyvictory over();</script>continuouslyrequired forevolutionaryan effectivenorth of the, which was front of theor otherwisesome form ofhad not beengenerated byinformation.permitted toincludes thedevelopment,entered intothe previousconsistentlyare known asthe field ofthis type ofgiven to thethe title ofcontains theinstances ofin the northdue to theirare designedcorporationswas that theone of thesemore popularsucceeded insupport fromin differentdominated bydesigned forownership ofand possiblystandardizedresponseTextwas intendedreceived theassumed thatareas of theprimarily inthe basis ofin the senseaccounts fordestroyed byat least twowas declaredcould not beSecretary ofappear to bemargin-top:1/^\\s+|\\s+$/ge){throw e};the start oftwo separatelanguage andwho had beenoperation ofdeath of thereal numbers\t<link rel=\"provided thethe story ofcompetitionsenglish (UK)english (US)P\u001CP>P=P3P>P;P!Q\u0000P?Q\u0001P:P8Q\u0001Q\u0000P?Q\u0001P:P8Q\u0001Q\u0000P?Q\u0001P:P>Y\u0004X9X1X(Y\nX)f-#i+\u0014d8-f\u0016\u0007g.\u0000d=\u0013d8-f\u0016\u0007g9\u0001d=\u0013d8-f\u0016\u0007f\u001C\ti\u0019\u0010e\u0005,e\u000F8d::f0\u0011f\u0014?e:\u001Ci\u0018?i\u0007\u000Ce74e74g$>d<\u001Ad8;d9\tf\u0013\rd=\u001Cg3;g;\u001Ff\u0014?g-\u0016f3\u0015h'\u0004informaciC3nherramientaselectrC3nicodescripciC3nclasificadosconocimientopublicaciC3nrelacionadasinformC!ticarelacionadosdepartamentotrabajadoresdirectamenteayuntamientomercadoLibrecontC!ctenoshabitacionescumplimientorestaurantesdisposiciC3nconsecuenciaelectrC3nicaaplicacionesdesconectadoinstalaciC3nrealizaciC3nutilizaciC3nenciclopediaenfermedadesinstrumentosexperienciasinstituciC3nparticularessubcategoriaQ\u0002P>P;Q\u000CP:P>P P>Q\u0001Q\u0001P8P8Q\u0000P0P1P>Q\u0002Q\u000BP1P>P;Q\u000CQ\u0008P5P?Q\u0000P>Q\u0001Q\u0002P>P<P>P6P5Q\u0002P5P4Q\u0000Q\u0003P3P8Q\u0005Q\u0001P;Q\u0003Q\u0007P0P5Q\u0001P5P9Q\u0007P0Q\u0001P2Q\u0001P5P3P4P0P P>Q\u0001Q\u0001P8Q\u000FP\u001CP>Q\u0001P:P2P5P4Q\u0000Q\u0003P3P8P5P3P>Q\u0000P>P4P0P2P>P?Q\u0000P>Q\u0001P4P0P=P=Q\u000BQ\u0005P4P>P;P6P=Q\u000BP8P<P5P=P=P>P\u001CP>Q\u0001P:P2Q\u000BQ\u0000Q\u0003P1P;P5P9P\u001CP>Q\u0001P:P2P0Q\u0001Q\u0002Q\u0000P0P=Q\u000BP=P8Q\u0007P5P3P>Q\u0000P0P1P>Q\u0002P5P4P>P;P6P5P=Q\u0003Q\u0001P;Q\u0003P3P8Q\u0002P5P?P5Q\u0000Q\u000CP\u001EP4P=P0P:P>P?P>Q\u0002P>P<Q\u0003Q\u0000P0P1P>Q\u0002Q\u0003P0P?Q\u0000P5P;Q\u000FP2P>P>P1Q\tP5P>P4P=P>P3P>Q\u0001P2P>P5P3P>Q\u0001Q\u0002P0Q\u0002Q\u000CP8P4Q\u0000Q\u0003P3P>P9Q\u0004P>Q\u0000Q\u0003P<P5Q\u0005P>Q\u0000P>Q\u0008P>P?Q\u0000P>Q\u0002P8P2Q\u0001Q\u0001Q\u000BP;P:P0P:P0P6P4Q\u000BP9P2P;P0Q\u0001Q\u0002P8P3Q\u0000Q\u0003P?P?Q\u000BP2P<P5Q\u0001Q\u0002P5Q\u0000P0P1P>Q\u0002P0Q\u0001P:P0P7P0P;P?P5Q\u0000P2Q\u000BP9P4P5P;P0Q\u0002Q\u000CP4P5P=Q\u000CP3P8P?P5Q\u0000P8P>P4P1P8P7P=P5Q\u0001P>Q\u0001P=P>P2P5P<P>P<P5P=Q\u0002P:Q\u0003P?P8Q\u0002Q\u000CP4P>P;P6P=P0Q\u0000P0P<P:P0Q\u0005P=P0Q\u0007P0P;P>P P0P1P>Q\u0002P0P\"P>P;Q\u000CP:P>Q\u0001P>P2Q\u0001P5P<P2Q\u0002P>Q\u0000P>P9P=P0Q\u0007P0P;P0Q\u0001P?P8Q\u0001P>P:Q\u0001P;Q\u0003P6P1Q\u000BQ\u0001P8Q\u0001Q\u0002P5P<P?P5Q\u0007P0Q\u0002P8P=P>P2P>P3P>P?P>P<P>Q\tP8Q\u0001P0P9Q\u0002P>P2P?P>Q\u0007P5P<Q\u0003P?P>P<P>Q\tQ\u000CP4P>P;P6P=P>Q\u0001Q\u0001Q\u000BP;P:P8P1Q\u000BQ\u0001Q\u0002Q\u0000P>P4P0P=P=Q\u000BP5P<P=P>P3P8P5P?Q\u0000P>P5P:Q\u0002P!P5P9Q\u0007P0Q\u0001P<P>P4P5P;P8Q\u0002P0P:P>P3P>P>P=P;P0P9P=P3P>Q\u0000P>P4P5P2P5Q\u0000Q\u0001P8Q\u000FQ\u0001Q\u0002Q\u0000P0P=P5Q\u0004P8P;Q\u000CP<Q\u000BQ\u0003Q\u0000P>P2P=Q\u000FQ\u0000P0P7P=Q\u000BQ\u0005P8Q\u0001P:P0Q\u0002Q\u000CP=P5P4P5P;Q\u000EQ\u000FP=P2P0Q\u0000Q\u000FP<P5P=Q\u000CQ\u0008P5P<P=P>P3P8Q\u0005P4P0P=P=P>P9P7P=P0Q\u0007P8Q\u0002P=P5P;Q\u000CP7Q\u000FQ\u0004P>Q\u0000Q\u0003P<P0P\"P5P?P5Q\u0000Q\u000CP<P5Q\u0001Q\u000FQ\u0006P0P7P0Q\tP8Q\u0002Q\u000BP\u001BQ\u0003Q\u0007Q\u0008P8P5`$(`$9`%\u0000`$\u0002`$\u0015`$0`$(`%\u0007`$\u0005`$*`$(`%\u0007`$\u0015`$?`$/`$>`$\u0015`$0`%\u0007`$\u0002`$\u0005`$(`%\r`$/`$\u0015`%\r`$/`$>`$\u0017`$>`$\u0007`$!`$,`$>`$0`%\u0007`$\u0015`$?`$8`%\u0000`$&`$?`$/`$>`$*`$9`$2`%\u0007`$8`$?`$\u0002`$9`$-`$>`$0`$$`$\u0005`$*`$(`%\u0000`$5`$>`$2`%\u0007`$8`%\u0007`$5`$>`$\u0015`$0`$$`%\u0007`$.`%\u0007`$0`%\u0007`$9`%\u000B`$(`%\u0007`$8`$\u0015`$$`%\u0007`$,`$9`%\u0001`$$`$8`$>`$\u0007`$\u001F`$9`%\u000B`$\u0017`$>`$\u001C`$>`$(`%\u0007`$.`$?`$(`$\u001F`$\u0015`$0`$$`$>`$\u0015`$0`$(`$>`$\t`$(`$\u0015`%\u0007`$/`$9`$>`$\u0001`$8`$,`$8`%\u0007`$-`$>`$7`$>`$\u0006`$*`$\u0015`%\u0007`$2`$?`$/`%\u0007`$6`%\u0001`$0`%\u0002`$\u0007`$8`$\u0015`%\u0007`$\u0018`$\u0002`$\u001F`%\u0007`$.`%\u0007`$0`%\u0000`$8`$\u0015`$$`$>`$.`%\u0007`$0`$>`$2`%\u0007`$\u0015`$0`$\u0005`$'`$?`$\u0015`$\u0005`$*`$(`$>`$8`$.`$>`$\u001C`$.`%\u0001`$\u001D`%\u0007`$\u0015`$>`$0`$#`$9`%\u000B`$$`$>`$\u0015`$!`$<`%\u0000`$/`$9`$>`$\u0002`$9`%\u000B`$\u001F`$2`$6`$,`%\r`$&`$2`$?`$/`$>`$\u001C`%\u0000`$5`$(`$\u001C`$>`$$`$>`$\u0015`%\u0008`$8`%\u0007`$\u0006`$*`$\u0015`$>`$5`$>`$2`%\u0000`$&`%\u0007`$(`%\u0007`$*`%\u0002`$0`%\u0000`$*`$>`$(`%\u0000`$\t`$8`$\u0015`%\u0007`$9`%\u000B`$\u0017`%\u0000`$,`%\u0008`$ `$\u0015`$\u0006`$*`$\u0015`%\u0000`$5`$0`%\r`$7`$\u0017`$>`$\u0002`$5`$\u0006`$*`$\u0015`%\u000B`$\u001C`$?`$2`$>`$\u001C`$>`$(`$>`$8`$9`$.`$$`$9`$.`%\u0007`$\u0002`$\t`$(`$\u0015`%\u0000`$/`$>`$9`%\u0002`$&`$0`%\r`$\u001C`$8`%\u0002`$\u001A`%\u0000`$*`$8`$\u0002`$&`$8`$5`$>`$2`$9`%\u000B`$(`$>`$9`%\u000B`$$`%\u0000`$\u001C`%\u0008`$8`%\u0007`$5`$>`$*`$8`$\u001C`$(`$$`$>`$(`%\u0007`$$`$>`$\u001C`$>`$0`%\u0000`$\u0018`$>`$/`$2`$\u001C`$?`$2`%\u0007`$(`%\u0000`$\u001A`%\u0007`$\u001C`$>`$\u0002`$\u001A`$*`$$`%\r`$0`$\u0017`%\u0002`$\u0017`$2`$\u001C`$>`$$`%\u0007`$,`$>`$9`$0`$\u0006`$*`$(`%\u0007`$5`$>`$9`$(`$\u0007`$8`$\u0015`$>`$8`%\u0001`$,`$9`$0`$9`$(`%\u0007`$\u0007`$8`$8`%\u0007`$8`$9`$?`$$`$,`$!`$<`%\u0007`$\u0018`$\u001F`$(`$>`$$`$2`$>`$6`$*`$>`$\u0002`$\u001A`$6`%\r`$0`%\u0000`$,`$!`$<`%\u0000`$9`%\u000B`$$`%\u0007`$8`$>`$\u0008`$\u001F`$6`$>`$/`$&`$8`$\u0015`$$`%\u0000`$\u001C`$>`$$`%\u0000`$5`$>`$2`$>`$9`$\u001C`$>`$0`$*`$\u001F`$(`$>`$0`$\u0016`$(`%\u0007`$8`$!`$<`$\u0015`$.`$?`$2`$>`$\t`$8`$\u0015`%\u0000`$\u0015`%\u0007`$5`$2`$2`$\u0017`$$`$>`$\u0016`$>`$(`$>`$\u0005`$0`%\r`$%`$\u001C`$9`$>`$\u0002`$&`%\u0007`$\u0016`$>`$*`$9`$2`%\u0000`$(`$?`$/`$.`$,`$?`$(`$>`$,`%\u0008`$\u0002`$\u0015`$\u0015`$9`%\u0000`$\u0002`$\u0015`$9`$(`$>`$&`%\u0007`$$`$>`$9`$.`$2`%\u0007`$\u0015`$>`$+`%\u0000`$\u001C`$,`$\u0015`$?`$$`%\u0001`$0`$$`$.`$>`$\u0002`$\u0017`$5`$9`%\u0000`$\u0002`$0`%\u000B`$\u001C`$<`$.`$?`$2`%\u0000`$\u0006`$0`%\u000B`$*`$8`%\u0007`$(`$>`$/`$>`$&`$5`$2`%\u0007`$(`%\u0007`$\u0016`$>`$$`$>`$\u0015`$0`%\u0000`$,`$\t`$(`$\u0015`$>`$\u001C`$5`$>`$,`$*`%\u0002`$0`$>`$,`$!`$<`$>`$8`%\u000C`$&`$>`$6`%\u0007`$/`$0`$\u0015`$?`$/`%\u0007`$\u0015`$9`$>`$\u0002`$\u0005`$\u0015`$8`$0`$,`$(`$>`$\u000F`$5`$9`$>`$\u0002`$8`%\r`$%`$2`$.`$?`$2`%\u0007`$2`%\u0007`$\u0016`$\u0015`$5`$?`$7`$/`$\u0015`%\r`$0`$\u0002`$8`$.`%\u0002`$9`$%`$>`$(`$>X*X3X*X7Y\nX9Y\u0005X4X'X1Y\u0003X)X(Y\u0008X'X3X7X)X'Y\u0004X5Y\u0001X-X)Y\u0005Y\u0008X'X6Y\nX9X'Y\u0004X.X'X5X)X'Y\u0004Y\u0005X2Y\nX/X'Y\u0004X9X'Y\u0005X)X'Y\u0004Y\u0003X'X*X(X'Y\u0004X1X/Y\u0008X/X(X1Y\u0006X'Y\u0005X,X'Y\u0004X/Y\u0008Y\u0004X)X'Y\u0004X9X'Y\u0004Y\u0005X'Y\u0004Y\u0005Y\u0008Y\u0002X9X'Y\u0004X9X1X(Y\nX'Y\u0004X3X1Y\nX9X'Y\u0004X,Y\u0008X'Y\u0004X'Y\u0004X0Y\u0007X'X(X'Y\u0004X-Y\nX'X)X'Y\u0004X-Y\u0002Y\u0008Y\u0002X'Y\u0004Y\u0003X1Y\nY\u0005X'Y\u0004X9X1X'Y\u0002Y\u0005X-Y\u0001Y\u0008X8X)X'Y\u0004X+X'Y\u0006Y\nY\u0005X4X'Y\u0007X/X)X'Y\u0004Y\u0005X1X#X)X'Y\u0004Y\u0002X1X\"Y\u0006X'Y\u0004X4X(X'X(X'Y\u0004X-Y\u0008X'X1X'Y\u0004X,X/Y\nX/X'Y\u0004X#X3X1X)X'Y\u0004X9Y\u0004Y\u0008Y\u0005Y\u0005X,Y\u0005Y\u0008X9X)X'Y\u0004X1X-Y\u0005Y\u0006X'Y\u0004Y\u0006Y\u0002X'X7Y\u0001Y\u0004X3X7Y\nY\u0006X'Y\u0004Y\u0003Y\u0008Y\nX*X'Y\u0004X/Y\u0006Y\nX'X(X1Y\u0003X'X*Y\u0007X'Y\u0004X1Y\nX'X6X*X-Y\nX'X*Y\nX(X*Y\u0008Y\u0002Y\nX*X'Y\u0004X#Y\u0008Y\u0004Y\tX'Y\u0004X(X1Y\nX/X'Y\u0004Y\u0003Y\u0004X'Y\u0005X'Y\u0004X1X'X(X7X'Y\u0004X4X.X5Y\nX3Y\nX'X1X'X*X'Y\u0004X+X'Y\u0004X+X'Y\u0004X5Y\u0004X'X)X'Y\u0004X-X/Y\nX+X'Y\u0004X2Y\u0008X'X1X'Y\u0004X.Y\u0004Y\nX,X'Y\u0004X,Y\u0005Y\nX9X'Y\u0004X9X'Y\u0005Y\u0007X'Y\u0004X,Y\u0005X'Y\u0004X'Y\u0004X3X'X9X)Y\u0005X4X'Y\u0007X/Y\u0007X'Y\u0004X1X&Y\nX3X'Y\u0004X/X.Y\u0008Y\u0004X'Y\u0004Y\u0001Y\u0006Y\nX)X'Y\u0004Y\u0003X*X'X(X'Y\u0004X/Y\u0008X1Y\nX'Y\u0004X/X1Y\u0008X3X'X3X*X:X1Y\u0002X*X5X'Y\u0005Y\nY\u0005X'Y\u0004X(Y\u0006X'X*X'Y\u0004X9X8Y\nY\u0005entertainmentunderstanding = function().jpg\" width=\"configuration.png\" width=\"<body class=\"Math.random()contemporary United Statescircumstances.appendChild(organizations<span class=\"\"><img src=\"/distinguishedthousands of communicationclear\"></div>investigationfavicon.ico\" margin-right:based on the Massachusettstable border=internationalalso known aspronunciationbackground:#fpadding-left:For example, miscellaneous&lt;/math&gt;psychologicalin particularearch\" type=\"form method=\"as opposed toSupreme Courtoccasionally Additionally,North Americapx;backgroundopportunitiesEntertainment.toLowerCase(manufacturingprofessional combined withFor instance,consisting of\" maxlength=\"return false;consciousnessMediterraneanextraordinaryassassinationsubsequently button type=\"the number ofthe original comprehensiverefers to the</ul>\n</div>\nphilosophicallocation.hrefwas publishedSan Francisco(function(){\n<div id=\"mainsophisticatedmathematical /head>\r\n<bodysuggests thatdocumentationconcentrationrelationshipsmay have been(for example,This article in some casesparts of the definition ofGreat Britain cellpadding=equivalent toplaceholder=\"; font-size: justificationbelieved thatsuffered fromattempted to leader of thecript\" src=\"/(function() {are available\n\t<link rel=\" src='http://interested inconventional \" alt=\"\" /></are generallyhas also beenmost popular correspondingcredited withtyle=\"border:</a></span></.gif\" width=\"<iframe src=\"table class=\"inline-block;according to together withapproximatelyparliamentarymore and moredisplay:none;traditionallypredominantly&nbsp;|&nbsp;&nbsp;</span> cellspacing=<input name=\"or\" content=\"controversialproperty=\"og:/x-shockwave-demonstrationsurrounded byNevertheless,was the firstconsiderable Although the collaborationshould not beproportion of<span style=\"known as the shortly afterfor instance,described as /head>\n<body starting withincreasingly the fact thatdiscussion ofmiddle of thean individualdifficult to point of viewhomosexualityacceptance of</span></div>manufacturersorigin of thecommonly usedimportance ofdenominationsbackground: #length of thedeterminationa significant\" border=\"0\">revolutionaryprinciples ofis consideredwas developedIndo-Europeanvulnerable toproponents ofare sometimescloser to theNew York City name=\"searchattributed tocourse of themathematicianby the end ofat the end of\" border=\"0\" technological.removeClass(branch of theevidence that![endif]-->\r\nInstitute of into a singlerespectively.and thereforeproperties ofis located insome of whichThere is alsocontinued to appearance of &amp;ndash; describes theconsiderationauthor of theindependentlyequipped withdoes not have</a><a href=\"confused with<link href=\"/at the age ofappear in theThese includeregardless ofcould be used style=&quot;several timesrepresent thebody>\n</html>thought to bepopulation ofpossibilitiespercentage ofaccess to thean attempt toproduction ofjquery/jquerytwo differentbelong to theestablishmentreplacing thedescription\" determine theavailable forAccording to wide range of\t<div class=\"more commonlyorganisationsfunctionalitywas completed &amp;mdash; participationthe characteran additionalappears to befact that thean example ofsignificantlyonmouseover=\"because they async = true;problems withseems to havethe result of src=\"http://familiar withpossession offunction () {took place inand sometimessubstantially<span></span>is often usedin an attemptgreat deal ofEnvironmentalsuccessfully virtually all20th century,professionalsnecessary to determined bycompatibilitybecause it isDictionary ofmodificationsThe followingmay refer to:Consequently,Internationalalthough somethat would beworld's firstclassified asbottom of the(particularlyalign=\"left\" most commonlybasis for thefoundation ofcontributionspopularity ofcenter of theto reduce thejurisdictionsapproximation onmouseout=\"New Testamentcollection of</span></a></in the Unitedfilm director-strict.dtd\">has been usedreturn to thealthough thischange in theseveral otherbut there areunprecedentedis similar toespecially inweight: bold;is called thecomputationalindicate thatrestricted to\t<meta name=\"are typicallyconflict withHowever, the An example ofcompared withquantities ofrather than aconstellationnecessary forreported thatspecificationpolitical and&nbsp;&nbsp;<references tothe same yearGovernment ofgeneration ofhave not beenseveral yearscommitment to\t\t<ul class=\"visualization19th century,practitionersthat he wouldand continuedoccupation ofis defined ascentre of thethe amount of><div style=\"equivalent ofdifferentiatebrought aboutmargin-left: automaticallythought of asSome of these\n<div class=\"input class=\"replaced withis one of theeducation andinfluenced byreputation as\n<meta name=\"accommodation</div>\n</div>large part ofInstitute forthe so-called against the In this case,was appointedclaimed to beHowever, thisDepartment ofthe remainingeffect on theparticularly deal with the\n<div style=\"almost alwaysare currentlyexpression ofphilosophy offor more thancivilizationson the islandselectedIndexcan result in\" value=\"\" />the structure /></a></div>Many of thesecaused by theof the Unitedspan class=\"mcan be tracedis related tobecame one ofis frequentlyliving in thetheoreticallyFollowing theRevolutionarygovernment inis determinedthe politicalintroduced insufficient todescription\">short storiesseparation ofas to whetherknown for itswas initiallydisplay:blockis an examplethe principalconsists of arecognized as/body></html>a substantialreconstructedhead of stateresistance toundergraduateThere are twogravitationalare describedintentionallyserved as theclass=\"headeropposition tofundamentallydominated theand the otheralliance withwas forced torespectively,and politicalin support ofpeople in the20th century.and publishedloadChartbeatto understandmember statesenvironmentalfirst half ofcountries andarchitecturalbe consideredcharacterizedclearIntervalauthoritativeFederation ofwas succeededand there area consequencethe Presidentalso includedfree softwaresuccession ofdeveloped thewas destroyedaway from the;\n</script>\n<although theyfollowed by amore powerfulresulted in aUniversity ofHowever, manythe presidentHowever, someis thought tountil the endwas announcedare importantalso includes><input type=the center of DO NOT ALTERused to referthemes/?sort=that had beenthe basis forhas developedin the summercomparativelydescribed thesuch as thosethe resultingis impossiblevarious otherSouth Africanhave the sameeffectivenessin which case; text-align:structure and; background:regarding thesupported theis also knownstyle=\"marginincluding thebahasa Melayunorsk bokmC%lnorsk nynorskslovenE!D\rinainternacionalcalificaciC3ncomunicaciC3nconstrucciC3n\"><div class=\"disambiguationDomainName', 'administrationsimultaneouslytransportationInternational margin-bottom:responsibility<![endif]-->\n</><meta name=\"implementationinfrastructurerepresentationborder-bottom:</head>\n<body>=http%3A%2F%2F<form method=\"method=\"post\" /favicon.ico\" });\n</script>\n.setAttribute(Administration= new Array();<![endif]-->\r\ndisplay:block;Unfortunately,\">&nbsp;</div>/favicon.ico\">='stylesheet' identification, for example,<li><a href=\"/an alternativeas a result ofpt\"></script>\ntype=\"submit\" \n(function() {recommendationform action=\"/transformationreconstruction.style.display According to hidden\" name=\"along with thedocument.body.approximately Communicationspost\" action=\"meaning &quot;--<![endif]-->Prime Ministercharacteristic</a> <a class=the history of onmouseover=\"the governmenthref=\"https://was originallywas introducedclassificationrepresentativeare considered<![endif]-->\n\ndepends on theUniversity of in contrast to placeholder=\"in the case ofinternational constitutionalstyle=\"border-: function() {Because of the-strict.dtd\">\n<table class=\"accompanied byaccount of the<script src=\"/nature of the the people in in addition tos); js.id = id\" width=\"100%\"regarding the Roman Catholican independentfollowing the .gif\" width=\"1the following discriminationarchaeologicalprime minister.js\"></script>combination of marginwidth=\"createElement(w.attachEvent(</a></td></tr>src=\"https://aIn particular, align=\"left\" Czech RepublicUnited Kingdomcorrespondenceconcluded that.html\" title=\"(function () {comes from theapplication of<span class=\"sbelieved to beement('script'</a>\n</li>\n<livery different><span class=\"option value=\"(also known as\t<li><a href=\"><input name=\"separated fromreferred to as valign=\"top\">founder of theattempting to carbon dioxide\n\n<div class=\"class=\"search-/body>\n</html>opportunity tocommunications</head>\r\n<body style=\"width:Tia:?ng Via;\u0007tchanges in theborder-color:#0\" border=\"0\" </span></div><was discovered\" type=\"text\" );\n</script>\n\nDepartment of ecclesiasticalthere has beenresulting from</body></html>has never beenthe first timein response toautomatically </div>\n\n<div iwas consideredpercent of the\" /></a></div>collection of descended fromsection of theaccept-charsetto be confusedmember of the padding-right:translation ofinterpretation href='http://whether or notThere are alsothere are manya small numberother parts ofimpossible to class=\"buttonlocated in the. However, theand eventuallyAt the end of because of itsrepresents the<form action=\" method=\"post\"it is possiblemore likely toan increase inhave also beencorresponds toannounced thatalign=\"right\">many countriesfor many yearsearliest knownbecause it waspt\"></script>\r valign=\"top\" inhabitants offollowing year\r\n<div class=\"million peoplecontroversial concerning theargue that thegovernment anda reference totransferred todescribing the style=\"color:although therebest known forsubmit\" name=\"multiplicationmore than one recognition ofCouncil of theedition of the <meta name=\"Entertainment away from the ;margin-right:at the time ofinvestigationsconnected withand many otheralthough it isbeginning with <span class=\"descendants of<span class=\"i align=\"right\"</head>\n<body aspects of thehas since beenEuropean Unionreminiscent ofmore difficultVice Presidentcomposition ofpassed throughmore importantfont-size:11pxexplanation ofthe concept ofwritten in the\t<span class=\"is one of the resemblance toon the groundswhich containsincluding the defined by thepublication ofmeans that theoutside of thesupport of the<input class=\"<span class=\"t(Math.random()most prominentdescription ofConstantinoplewere published<div class=\"seappears in the1\" height=\"1\" most importantwhich includeswhich had beendestruction ofthe population\n\t<div class=\"possibility ofsometimes usedappear to havesuccess of theintended to bepresent in thestyle=\"clear:b\r\n</script>\r\n<was founded ininterview with_id\" content=\"capital of the\r\n<link rel=\"srelease of thepoint out thatxMLHttpRequestand subsequentsecond largestvery importantspecificationssurface of theapplied to theforeign policy_setDomainNameestablished inis believed toIn addition tomeaning of theis named afterto protect theis representedDeclaration ofmore efficientClassificationother forms ofhe returned to<span class=\"cperformance of(function() {\rif and only ifregions of theleading to therelations withUnited Nationsstyle=\"height:other than theype\" content=\"Association of\n</head>\n<bodylocated on theis referred to(including theconcentrationsthe individualamong the mostthan any other/>\n<link rel=\" return false;the purpose ofthe ability to;color:#fff}\n.\n<span class=\"the subject ofdefinitions of>\r\n<link rel=\"claim that thehave developed<table width=\"celebration ofFollowing the to distinguish<span class=\"btakes place inunder the namenoted that the><![endif]-->\nstyle=\"margin-instead of theintroduced thethe process ofincreasing thedifferences inestimated thatespecially the/div><div id=\"was eventuallythroughout histhe differencesomething thatspan></span></significantly ></script>\r\n\r\nenvironmental to prevent thehave been usedespecially forunderstand theis essentiallywere the firstis the largesthave been made\" src=\"http://interpreted assecond half ofcrolling=\"no\" is composed ofII, Holy Romanis expected tohave their owndefined as thetraditionally have differentare often usedto ensure thatagreement withcontaining theare frequentlyinformation onexample is theresulting in a</a></li></ul> class=\"footerand especiallytype=\"button\" </span></span>which included>\n<meta name=\"considered thecarried out byHowever, it isbecame part ofin relation topopular in thethe capital ofwas officiallywhich has beenthe History ofalternative todifferent fromto support thesuggested thatin the process <div class=\"the foundationbecause of hisconcerned withthe universityopposed to thethe context of<span class=\"ptext\" name=\"q\"\t\t<div class=\"the scientificrepresented bymathematicianselected by thethat have been><div class=\"cdiv id=\"headerin particular,converted into);\n</script>\n<philosophical srpskohrvatskitia:?ng Via;\u0007tP Q\u0003Q\u0001Q\u0001P:P8P9Q\u0000Q\u0003Q\u0001Q\u0001P:P8P9investigaciC3nparticipaciC3nP:P>Q\u0002P>Q\u0000Q\u000BP5P>P1P;P0Q\u0001Q\u0002P8P:P>Q\u0002P>Q\u0000Q\u000BP9Q\u0007P5P;P>P2P5P:Q\u0001P8Q\u0001Q\u0002P5P<Q\u000BP\u001DP>P2P>Q\u0001Q\u0002P8P:P>Q\u0002P>Q\u0000Q\u000BQ\u0005P>P1P;P0Q\u0001Q\u0002Q\u000CP2Q\u0000P5P<P5P=P8P:P>Q\u0002P>Q\u0000P0Q\u000FQ\u0001P5P3P>P4P=Q\u000FQ\u0001P:P0Q\u0007P0Q\u0002Q\u000CP=P>P2P>Q\u0001Q\u0002P8P#P:Q\u0000P0P8P=Q\u000BP2P>P?Q\u0000P>Q\u0001Q\u000BP:P>Q\u0002P>Q\u0000P>P9Q\u0001P4P5P;P0Q\u0002Q\u000CP?P>P<P>Q\tQ\u000CQ\u000EQ\u0001Q\u0000P5P4Q\u0001Q\u0002P2P>P1Q\u0000P0P7P>P<Q\u0001Q\u0002P>Q\u0000P>P=Q\u000BQ\u0003Q\u0007P0Q\u0001Q\u0002P8P5Q\u0002P5Q\u0007P5P=P8P5P\u0013P;P0P2P=P0Q\u000FP8Q\u0001Q\u0002P>Q\u0000P8P8Q\u0001P8Q\u0001Q\u0002P5P<P0Q\u0000P5Q\u0008P5P=P8Q\u000FP!P:P0Q\u0007P0Q\u0002Q\u000CP?P>Q\rQ\u0002P>P<Q\u0003Q\u0001P;P5P4Q\u0003P5Q\u0002Q\u0001P:P0P7P0Q\u0002Q\u000CQ\u0002P>P2P0Q\u0000P>P2P:P>P=P5Q\u0007P=P>Q\u0000P5Q\u0008P5P=P8P5P:P>Q\u0002P>Q\u0000P>P5P>Q\u0000P3P0P=P>P2P:P>Q\u0002P>Q\u0000P>P<P P5P:P;P0P<P0X'Y\u0004Y\u0005Y\u0006X*X/Y\tY\u0005Y\u0006X*X/Y\nX'X*X'Y\u0004Y\u0005Y\u0008X6Y\u0008X9X'Y\u0004X(X1X'Y\u0005X,X'Y\u0004Y\u0005Y\u0008X'Y\u0002X9X'Y\u0004X1X3X'X&Y\u0004Y\u0005X4X'X1Y\u0003X'X*X'Y\u0004X#X9X6X'X!X'Y\u0004X1Y\nX'X6X)X'Y\u0004X*X5Y\u0005Y\nY\u0005X'Y\u0004X'X9X6X'X!X'Y\u0004Y\u0006X*X'X&X,X'Y\u0004X#Y\u0004X9X'X(X'Y\u0004X*X3X,Y\nY\u0004X'Y\u0004X#Y\u0002X3X'Y\u0005X'Y\u0004X6X:X7X'X*X'Y\u0004Y\u0001Y\nX/Y\nY\u0008X'Y\u0004X*X1X-Y\nX(X'Y\u0004X,X/Y\nX/X)X'Y\u0004X*X9Y\u0004Y\nY\u0005X'Y\u0004X#X.X(X'X1X'Y\u0004X'Y\u0001Y\u0004X'Y\u0005X'Y\u0004X#Y\u0001Y\u0004X'Y\u0005X'Y\u0004X*X'X1Y\nX.X'Y\u0004X*Y\u0002Y\u0006Y\nX)X'Y\u0004X'Y\u0004X9X'X(X'Y\u0004X.Y\u0008X'X7X1X'Y\u0004Y\u0005X,X*Y\u0005X9X'Y\u0004X/Y\nY\u0003Y\u0008X1X'Y\u0004X3Y\nX'X-X)X9X(X/X'Y\u0004Y\u0004Y\u0007X'Y\u0004X*X1X(Y\nX)X'Y\u0004X1Y\u0008X'X(X7X'Y\u0004X#X/X(Y\nX)X'Y\u0004X'X.X(X'X1X'Y\u0004Y\u0005X*X-X/X)X'Y\u0004X'X:X'Y\u0006Y\ncursor:pointer;</title>\n<meta \" href=\"http://\"><span class=\"members of the window.locationvertical-align:/a> | <a href=\"<!doctype html>media=\"screen\" <option value=\"favicon.ico\" />\n\t\t<div class=\"characteristics\" method=\"get\" /body>\n</html>\nshortcut icon\" document.write(padding-bottom:representativessubmit\" value=\"align=\"center\" throughout the science fiction\n <div class=\"submit\" class=\"one of the most valign=\"top\"><was established);\r\n</script>\r\nreturn false;\">).style.displaybecause of the document.cookie<form action=\"/}body{margin:0;Encyclopedia ofversion of the .createElement(name\" content=\"</div>\n</div>\n\nadministrative </body>\n</html>history of the \"><input type=\"portion of the as part of the &nbsp;<a href=\"other countries\">\n<div class=\"</span></span><In other words,display: block;control of the introduction of/>\n<meta name=\"as well as the in recent years\r\n\t<div class=\"</div>\n\t</div>\ninspired by thethe end of the compatible withbecame known as style=\"margin:.js\"></script>< International there have beenGerman language style=\"color:#Communist Partyconsistent withborder=\"0\" cell marginheight=\"the majority of\" align=\"centerrelated to the many different Orthodox Churchsimilar to the />\n<link rel=\"swas one of the until his death})();\n</script>other languagescompared to theportions of thethe Netherlandsthe most commonbackground:url(argued that thescrolling=\"no\" included in theNorth American the name of theinterpretationsthe traditionaldevelopment of frequently useda collection ofvery similar tosurrounding theexample of thisalign=\"center\">would have beenimage_caption =attached to thesuggesting thatin the form of involved in theis derived fromnamed after theIntroduction torestrictions on style=\"width: can be used to the creation ofmost important information andresulted in thecollapse of theThis means thatelements of thewas replaced byanalysis of theinspiration forregarded as themost successfulknown as &quot;a comprehensiveHistory of the were consideredreturned to theare referred toUnsourced image>\n\t<div class=\"consists of thestopPropagationinterest in theavailability ofappears to haveelectromagneticenableServices(function of theIt is important</script></div>function(){var relative to theas a result of the position ofFor example, in method=\"post\" was followed by&amp;mdash; thethe applicationjs\"></script>\r\nul></div></div>after the deathwith respect tostyle=\"padding:is particularlydisplay:inline; type=\"submit\" is divided intod8-f\u0016\u0007 (g.\u0000d=\u0013)responsabilidadadministraciC3ninternacionalescorrespondiente`$\t`$*`$/`%\u000B`$\u0017`$*`%\u0002`$0`%\r`$5`$9`$.`$>`$0`%\u0007`$2`%\u000B`$\u0017`%\u000B`$\u0002`$\u001A`%\u0001`$(`$>`$5`$2`%\u0007`$\u0015`$?`$(`$8`$0`$\u0015`$>`$0`$*`%\u0001`$2`$?`$8`$\u0016`%\u000B`$\u001C`%\u0007`$\u0002`$\u001A`$>`$9`$?`$\u000F`$-`%\u0007`$\u001C`%\u0007`$\u0002`$6`$>`$.`$?`$2`$9`$.`$>`$0`%\u0000`$\u001C`$>`$\u0017`$0`$#`$,`$(`$>`$(`%\u0007`$\u0015`%\u0001`$.`$>`$0`$,`%\r`$2`%\t`$\u0017`$.`$>`$2`$?`$\u0015`$.`$9`$?`$2`$>`$*`%\u0003`$7`%\r`$ `$,`$\"`$<`$$`%\u0007`$-`$>`$\u001C`$*`$>`$\u0015`%\r`$2`$?`$\u0015`$\u001F`%\r`$0`%\u0007`$(`$\u0016`$?`$2`$>`$+`$&`%\u000C`$0`$>`$(`$.`$>`$.`$2`%\u0007`$.`$$`$&`$>`$(`$,`$>`$\u001C`$>`$0`$5`$?`$\u0015`$>`$8`$\u0015`%\r`$/`%\u000B`$\u0002`$\u001A`$>`$9`$$`%\u0007`$*`$9`%\u0001`$\u0001`$\u001A`$,`$$`$>`$/`$>`$8`$\u0002`$5`$>`$&`$&`%\u0007`$\u0016`$(`%\u0007`$*`$?`$\u001B`$2`%\u0007`$5`$?`$6`%\u0007`$7`$0`$>`$\u001C`%\r`$/`$\t`$$`%\r`$$`$0`$.`%\u0001`$\u0002`$,`$\u0008`$&`%\u000B`$(`%\u000B`$\u0002`$\t`$*`$\u0015`$0`$#`$*`$\"`$<`%\u0007`$\u0002`$8`%\r`$%`$?`$$`$+`$?`$2`%\r`$.`$.`%\u0001`$\u0016`%\r`$/`$\u0005`$\u001A`%\r`$\u001B`$>`$\u001B`%\u0002`$\u001F`$$`%\u0000`$8`$\u0002`$\u0017`%\u0000`$$`$\u001C`$>`$\u000F`$\u0017`$>`$5`$?`$-`$>`$\u0017`$\u0018`$#`%\r`$\u001F`%\u0007`$&`%\u0002`$8`$0`%\u0007`$&`$?`$(`%\u000B`$\u0002`$9`$$`%\r`$/`$>`$8`%\u0007`$\u0015`%\r`$8`$\u0017`$>`$\u0002`$'`%\u0000`$5`$?`$6`%\r`$5`$0`$>`$$`%\u0007`$\u0002`$&`%\u0008`$\u001F`%\r`$8`$(`$\u0015`%\r`$6`$>`$8`$>`$.`$(`%\u0007`$\u0005`$&`$>`$2`$$`$,`$?`$\u001C`$2`%\u0000`$*`%\u0001`$0`%\u0002`$7`$9`$?`$\u0002`$&`%\u0000`$.`$?`$$`%\r`$0`$\u0015`$5`$?`$$`$>`$0`%\u0001`$*`$/`%\u0007`$8`%\r`$%`$>`$(`$\u0015`$0`%\u000B`$!`$<`$.`%\u0001`$\u0015`%\r`$$`$/`%\u000B`$\u001C`$(`$>`$\u0015`%\u0003`$*`$/`$>`$*`%\u000B`$8`%\r`$\u001F`$\u0018`$0`%\u0007`$2`%\u0002`$\u0015`$>`$0`%\r`$/`$5`$?`$\u001A`$>`$0`$8`%\u0002`$\u001A`$(`$>`$.`%\u0002`$2`%\r`$/`$&`%\u0007`$\u0016`%\u0007`$\u0002`$9`$.`%\u0007`$6`$>`$8`%\r`$\u0015`%\u0002`$2`$.`%\u0008`$\u0002`$(`%\u0007`$$`%\u0008`$/`$>`$0`$\u001C`$?`$8`$\u0015`%\u0007rss+xml\" title=\"-type\" content=\"title\" content=\"at the same time.js\"></script>\n<\" method=\"post\" </span></a></li>vertical-align:t/jquery.min.js\">.click(function( style=\"padding-})();\n</script>\n</span><a href=\"<a href=\"http://); return false;text-decoration: scrolling=\"no\" border-collapse:associated with Bahasa IndonesiaEnglish language<text xml:space=.gif\" border=\"0\"</body>\n</html>\noverflow:hidden;img src=\"http://addEventListenerresponsible for s.js\"></script>\n/favicon.ico\" />operating system\" style=\"width:1target=\"_blank\">State Universitytext-align:left;\ndocument.write(, including the around the world);\r\n</script>\r\n<\" style=\"height:;overflow:hiddenmore informationan internationala member of the one of the firstcan be found in </div>\n\t\t</div>\ndisplay: none;\">\" />\n<link rel=\"\n (function() {the 15th century.preventDefault(large number of Byzantine Empire.jpg|thumb|left|vast majority ofmajority of the align=\"center\">University Pressdominated by theSecond World Wardistribution of style=\"position:the rest of the characterized by rel=\"nofollow\">derives from therather than the a combination ofstyle=\"width:100English-speakingcomputer scienceborder=\"0\" alt=\"the existence ofDemocratic Party\" style=\"margin-For this reason,.js\"></script>\n\tsByTagName(s)[0]js\"></script>\r\n<.js\"></script>\r\nlink rel=\"icon\" ' alt='' class='formation of theversions of the </a></div></div>/page>\n <page>\n<div class=\"contbecame the firstbahasa Indonesiaenglish (simple)N\u0015N;N;N7N=N9N:N,Q\u0005Q\u0000P2P0Q\u0002Q\u0001P:P8P:P>P<P?P0P=P8P8Q\u000FP2P;Q\u000FP5Q\u0002Q\u0001Q\u000FP\u0014P>P1P0P2P8Q\u0002Q\u000CQ\u0007P5P;P>P2P5P:P0Q\u0000P0P7P2P8Q\u0002P8Q\u000FP\u0018P=Q\u0002P5Q\u0000P=P5Q\u0002P\u001EQ\u0002P2P5Q\u0002P8Q\u0002Q\u000CP=P0P?Q\u0000P8P<P5Q\u0000P8P=Q\u0002P5Q\u0000P=P5Q\u0002P:P>Q\u0002P>Q\u0000P>P3P>Q\u0001Q\u0002Q\u0000P0P=P8Q\u0006Q\u000BP:P0Q\u0007P5Q\u0001Q\u0002P2P5Q\u0003Q\u0001P;P>P2P8Q\u000FQ\u0005P?Q\u0000P>P1P;P5P<Q\u000BP?P>P;Q\u0003Q\u0007P8Q\u0002Q\u000CQ\u000FP2P;Q\u000FQ\u000EQ\u0002Q\u0001Q\u000FP=P0P8P1P>P;P5P5P:P>P<P?P0P=P8Q\u000FP2P=P8P<P0P=P8P5Q\u0001Q\u0000P5P4Q\u0001Q\u0002P2P0X'Y\u0004Y\u0005Y\u0008X'X6Y\nX9X'Y\u0004X1X&Y\nX3Y\nX)X'Y\u0004X'Y\u0006X*Y\u0002X'Y\u0004Y\u0005X4X'X1Y\u0003X'X*Y\u0003X'Y\u0004X3Y\nX'X1X'X*X'Y\u0004Y\u0005Y\u0003X*Y\u0008X(X)X'Y\u0004X3X9Y\u0008X/Y\nX)X'X-X5X'X&Y\nX'X*X'Y\u0004X9X'Y\u0004Y\u0005Y\nX)X'Y\u0004X5Y\u0008X*Y\nX'X*X'Y\u0004X'Y\u0006X*X1Y\u0006X*X'Y\u0004X*X5X'Y\u0005Y\nY\u0005X'Y\u0004X%X3Y\u0004X'Y\u0005Y\nX'Y\u0004Y\u0005X4X'X1Y\u0003X)X'Y\u0004Y\u0005X1X&Y\nX'X*robots\" content=\"<div id=\"footer\">the United States<img src=\"http://.jpg|right|thumb|.js\"></script>\r\n<location.protocolframeborder=\"0\" s\" />\n<meta name=\"</a></div></div><font-weight:bold;&quot; and &quot;depending on the margin:0;padding:\" rel=\"nofollow\" President of the twentieth centuryevision>\n </pageInternet Explorera.async = true;\r\ninformation about<div id=\"header\">\" action=\"http://<a href=\"https://<div id=\"content\"</div>\r\n</div>\r\n<derived from the <img src='http://according to the \n</body>\n</html>\nstyle=\"font-size:script language=\"Arial, Helvetica,</a><span class=\"</script><script political partiestd></tr></table><href=\"http://www.interpretation ofrel=\"stylesheet\" document.write('<charset=\"utf-8\">\nbeginning of the revealed that thetelevision series\" rel=\"nofollow\"> target=\"_blank\">claiming that thehttp%3A%2F%2Fwww.manifestations ofPrime Minister ofinfluenced by theclass=\"clearfix\">/div>\r\n</div>\r\n\r\nthree-dimensionalChurch of Englandof North Carolinasquare kilometres.addEventListenerdistinct from thecommonly known asPhonetic Alphabetdeclared that thecontrolled by theBenjamin Franklinrole-playing gamethe University ofin Western Europepersonal computerProject Gutenbergregardless of thehas been proposedtogether with the></li><li class=\"in some countriesmin.js\"></script>of the populationofficial language<img src=\"images/identified by thenatural resourcesclassification ofcan be consideredquantum mechanicsNevertheless, themillion years ago</body>\r\n</html>\rN\u0015N;N;N7N=N9N:N,\ntake advantage ofand, according toattributed to theMicrosoft Windowsthe first centuryunder the controldiv class=\"headershortly after thenotable exceptiontens of thousandsseveral differentaround the world.reaching militaryisolated from theopposition to thethe Old TestamentAfrican Americansinserted into theseparate from themetropolitan areamakes it possibleacknowledged thatarguably the mosttype=\"text/css\">\nthe InternationalAccording to the pe=\"text/css\" />\ncoincide with thetwo-thirds of theDuring this time,during the periodannounced that hethe internationaland more recentlybelieved that theconsciousness andformerly known assurrounded by thefirst appeared inoccasionally usedposition:absolute;\" target=\"_blank\" position:relative;text-align:center;jax/libs/jquery/1.background-color:#type=\"application/anguage\" content=\"<meta http-equiv=\"Privacy Policy</a>e(\"%3Cscript src='\" target=\"_blank\">On the other hand,.jpg|thumb|right|2</div><div class=\"<div style=\"float:nineteenth century</body>\r\n</html>\r\n<img src=\"http://s;text-align:centerfont-weight: bold; According to the difference between\" frameborder=\"0\" \" style=\"position:link href=\"http://html4/loose.dtd\">\nduring this period</td></tr></table>closely related tofor the first time;font-weight:bold;input type=\"text\" <span style=\"font-onreadystatechange\t<div class=\"cleardocument.location. For example, the a wide variety of <!DOCTYPE html>\r\n<&nbsp;&nbsp;&nbsp;\"><a href=\"http://style=\"float:left;concerned with the=http%3A%2F%2Fwww.in popular culturetype=\"text/css\" />it is possible to Harvard Universitytylesheet\" href=\"/the main characterOxford University name=\"keywords\" cstyle=\"text-align:the United Kingdomfederal government<div style=\"margin depending on the description of the<div class=\"header.min.js\"></script>destruction of theslightly differentin accordance withtelecommunicationsindicates that theshortly thereafterespecially in the European countriesHowever, there aresrc=\"http://staticsuggested that the\" src=\"http://www.a large number of Telecommunications\" rel=\"nofollow\" tHoly Roman Emperoralmost exclusively\" border=\"0\" alt=\"Secretary of Stateculminating in theCIA World Factbookthe most importantanniversary of thestyle=\"background-<li><em><a href=\"/the Atlantic Oceanstrictly speaking,shortly before thedifferent types ofthe Ottoman Empire><img src=\"http://An Introduction toconsequence of thedeparture from theConfederate Statesindigenous peoplesProceedings of theinformation on thetheories have beeninvolvement in thedivided into threeadjacent countriesis responsible fordissolution of thecollaboration withwidely regarded ashis contemporariesfounding member ofDominican Republicgenerally acceptedthe possibility ofare also availableunder constructionrestoration of thethe general publicis almost entirelypasses through thehas been suggestedcomputer and videoGermanic languages according to the different from theshortly afterwardshref=\"https://www.recent developmentBoard of Directors<div class=\"search| <a href=\"http://In particular, theMultiple footnotesor other substancethousands of yearstranslation of the</div>\r\n</div>\r\n\r\n<a href=\"index.phpwas established inmin.js\"></script>\nparticipate in thea strong influencestyle=\"margin-top:represented by thegraduated from theTraditionally, theElement(\"script\");However, since the/div>\n</div>\n<div left; margin-left:protection against0; vertical-align:Unfortunately, thetype=\"image/x-icon/div>\n<div class=\" class=\"clearfix\"><div class=\"footer\t\t</div>\n\t\t</div>\nthe motion pictureP\u0011Q\nP;P3P0Q\u0000Q\u0001P:P8P1Q\nP;P3P0Q\u0000Q\u0001P:P8P$P5P4P5Q\u0000P0Q\u0006P8P8P=P5Q\u0001P:P>P;Q\u000CP:P>Q\u0001P>P>P1Q\tP5P=P8P5Q\u0001P>P>P1Q\tP5P=P8Q\u000FP?Q\u0000P>P3Q\u0000P0P<P<Q\u000BP\u001EQ\u0002P?Q\u0000P0P2P8Q\u0002Q\u000CP1P5Q\u0001P?P;P0Q\u0002P=P>P<P0Q\u0002P5Q\u0000P8P0P;Q\u000BP?P>P7P2P>P;Q\u000FP5Q\u0002P?P>Q\u0001P;P5P4P=P8P5Q\u0000P0P7P;P8Q\u0007P=Q\u000BQ\u0005P?Q\u0000P>P4Q\u0003P:Q\u0006P8P8P?Q\u0000P>P3Q\u0000P0P<P<P0P?P>P;P=P>Q\u0001Q\u0002Q\u000CQ\u000EP=P0Q\u0005P>P4P8Q\u0002Q\u0001Q\u000FP8P7P1Q\u0000P0P=P=P>P5P=P0Q\u0001P5P;P5P=P8Q\u000FP8P7P<P5P=P5P=P8Q\u000FP:P0Q\u0002P5P3P>Q\u0000P8P8P\u0010P;P5P:Q\u0001P0P=P4Q\u0000`$&`%\r`$5`$>`$0`$>`$.`%\u0008`$(`%\u0001`$\u0005`$2`$*`%\r`$0`$&`$>`$(`$-`$>`$0`$$`%\u0000`$/`$\u0005`$(`%\u0001`$&`%\u0007`$6`$9`$?`$(`%\r`$&`%\u0000`$\u0007`$\u0002`$!`$?`$/`$>`$&`$?`$2`%\r`$2`%\u0000`$\u0005`$'`$?`$\u0015`$>`$0`$5`%\u0000`$!`$?`$/`%\u000B`$\u001A`$?`$\u001F`%\r`$ `%\u0007`$8`$.`$>`$\u001A`$>`$0`$\u001C`$\u0002`$\u0015`%\r`$6`$(`$&`%\u0001`$(`$?`$/`$>`$*`%\r`$0`$/`%\u000B`$\u0017`$\u0005`$(`%\u0001`$8`$>`$0`$\u0011`$(`$2`$>`$\u0007`$(`$*`$>`$0`%\r`$\u001F`%\u0000`$6`$0`%\r`$$`%\u000B`$\u0002`$2`%\u000B`$\u0015`$8`$-`$>`$+`$<`%\r`$2`%\u0008`$6`$6`$0`%\r`$$`%\u0007`$\u0002`$*`%\r`$0`$&`%\u0007`$6`$*`%\r`$2`%\u0007`$/`$0`$\u0015`%\u0007`$\u0002`$&`%\r`$0`$8`%\r`$%`$?`$$`$?`$\t`$$`%\r`$*`$>`$&`$\t`$(`%\r`$9`%\u0007`$\u0002`$\u001A`$?`$\u001F`%\r`$ `$>`$/`$>`$$`%\r`$0`$>`$\u001C`%\r`$/`$>`$&`$>`$*`%\u0001`$0`$>`$(`%\u0007`$\u001C`%\u000B`$!`$<`%\u0007`$\u0002`$\u0005`$(`%\u0001`$5`$>`$&`$6`%\r`$0`%\u0007`$#`%\u0000`$6`$?`$\u0015`%\r`$7`$>`$8`$0`$\u0015`$>`$0`%\u0000`$8`$\u0002`$\u0017`%\r`$0`$9`$*`$0`$?`$#`$>`$.`$,`%\r`$0`$>`$\u0002`$!`$,`$\u001A`%\r`$\u001A`%\u000B`$\u0002`$\t`$*`$2`$,`%\r`$'`$.`$\u0002`$$`%\r`$0`%\u0000`$8`$\u0002`$*`$0`%\r`$\u0015`$\t`$.`%\r`$.`%\u0000`$&`$.`$>`$'`%\r`$/`$.`$8`$9`$>`$/`$$`$>`$6`$,`%\r`$&`%\u000B`$\u0002`$.`%\u0000`$!`$?`$/`$>`$\u0006`$\u0008`$*`%\u0000`$\u000F`$2`$.`%\u000B`$,`$>`$\u0007`$2`$8`$\u0002`$\u0016`%\r`$/`$>`$\u0006`$*`$0`%\u0007`$6`$(`$\u0005`$(`%\u0001`$,`$\u0002`$'`$,`$>`$\u001C`$<`$>`$0`$(`$5`%\u0000`$(`$$`$.`$*`%\r`$0`$.`%\u0001`$\u0016`$*`%\r`$0`$6`%\r`$(`$*`$0`$?`$5`$>`$0`$(`%\u0001`$\u0015`$8`$>`$(`$8`$.`$0`%\r`$%`$(`$\u0006`$/`%\u000B`$\u001C`$?`$$`$8`%\u000B`$.`$5`$>`$0X'Y\u0004Y\u0005X4X'X1Y\u0003X'X*X'Y\u0004Y\u0005Y\u0006X*X/Y\nX'X*X'Y\u0004Y\u0003Y\u0005X(Y\nY\u0008X*X1X'Y\u0004Y\u0005X4X'Y\u0007X/X'X*X9X/X/X'Y\u0004X2Y\u0008X'X1X9X/X/X'Y\u0004X1X/Y\u0008X/X'Y\u0004X%X3Y\u0004X'Y\u0005Y\nX)X'Y\u0004Y\u0001Y\u0008X*Y\u0008X4Y\u0008X(X'Y\u0004Y\u0005X3X'X(Y\u0002X'X*X'Y\u0004Y\u0005X9Y\u0004Y\u0008Y\u0005X'X*X'Y\u0004Y\u0005X3Y\u0004X3Y\u0004X'X*X'Y\u0004X,X1X'Y\u0001Y\nY\u0003X3X'Y\u0004X'X3Y\u0004X'Y\u0005Y\nX)X'Y\u0004X'X*X5X'Y\u0004X'X*keywords\" content=\"w3.org/1999/xhtml\"><a target=\"_blank\" text/html; charset=\" target=\"_blank\"><table cellpadding=\"autocomplete=\"off\" text-align: center;to last version by background-color: #\" href=\"http://www./div></div><div id=<a href=\"#\" class=\"\"><img src=\"http://cript\" src=\"http://\n<script language=\"//EN\" \"http://www.wencodeURIComponent(\" href=\"javascript:<div class=\"contentdocument.write('<scposition: absolute;script src=\"http:// style=\"margin-top:.min.js\"></script>\n</div>\n<div class=\"w3.org/1999/xhtml\" \n\r\n</body>\r\n</html>distinction between/\" target=\"_blank\"><link href=\"http://encoding=\"utf-8\"?>\nw.addEventListener?action=\"http://www.icon\" href=\"http:// style=\"background:type=\"text/css\" />\nmeta property=\"og:t<input type=\"text\" style=\"text-align:the development of tylesheet\" type=\"tehtml; charset=utf-8is considered to betable width=\"100%\" In addition to the contributed to the differences betweendevelopment of the It is important to </script>\n\n<script style=\"font-size:1></span><span id=gbLibrary of Congress<img src=\"http://imEnglish translationAcademy of Sciencesdiv style=\"display:construction of the.getElementById(id)in conjunction withElement('script'); <meta property=\"og:P\u0011Q\nP;P3P0Q\u0000Q\u0001P:P8\n type=\"text\" name=\">Privacy Policy</a>administered by theenableSingleRequeststyle=&quot;margin:</div></div></div><><img src=\"http://i style=&quot;float:referred to as the total population ofin Washington, D.C. style=\"background-among other things,organization of theparticipated in thethe introduction ofidentified with thefictional character Oxford University misunderstanding ofThere are, however,stylesheet\" href=\"/Columbia Universityexpanded to includeusually referred toindicating that thehave suggested thataffiliated with thecorrelation betweennumber of different></td></tr></table>Republic of Ireland\n</script>\n<script under the influencecontribution to theOfficial website ofheadquarters of thecentered around theimplications of thehave been developedFederal Republic ofbecame increasinglycontinuation of theNote, however, thatsimilar to that of capabilities of theaccordance with theparticipants in thefurther developmentunder the directionis often consideredhis younger brother</td></tr></table><a http-equiv=\"X-UA-physical propertiesof British Columbiahas been criticized(with the exceptionquestions about thepassing through the0\" cellpadding=\"0\" thousands of peopleredirects here. Forhave children under%3E%3C/script%3E\"));<a href=\"http://www.<li><a href=\"http://site_name\" content=\"text-decoration:nonestyle=\"display: none<meta http-equiv=\"X-new Date().getTime() type=\"image/x-icon\"</span><span class=\"language=\"javascriptwindow.location.href<a href=\"javascript:-->\r\n<script type=\"t<a href='http://www.hortcut icon\" href=\"</div>\r\n<div class=\"<script src=\"http://\" rel=\"stylesheet\" t</div>\n<script type=/a> <a href=\"http:// allowTransparency=\"X-UA-Compatible\" conrelationship between\n</script>\r\n<script </a></li></ul></div>associated with the programming language</a><a href=\"http://</a></li><li class=\"form action=\"http://<div style=\"display:type=\"text\" name=\"q\"<table width=\"100%\" background-position:\" border=\"0\" width=\"rel=\"shortcut icon\" h6><ul><li><a href=\" <meta http-equiv=\"css\" media=\"screen\" responsible for the \" type=\"application/\" style=\"background-html; charset=utf-8\" allowtransparency=\"stylesheet\" type=\"te\r\n<meta http-equiv=\"></span><span class=\"0\" cellspacing=\"0\">;\n</script>\n<script sometimes called thedoes not necessarilyFor more informationat the beginning of <!DOCTYPE html><htmlparticularly in the type=\"hidden\" name=\"javascript:void(0);\"effectiveness of the autocomplete=\"off\" generally considered><input type=\"text\" \"></script>\r\n<scriptthroughout the worldcommon misconceptionassociation with the</div>\n</div>\n<div cduring his lifetime,corresponding to thetype=\"image/x-icon\" an increasing numberdiplomatic relationsare often consideredmeta charset=\"utf-8\" <input type=\"text\" examples include the\"><img src=\"http://iparticipation in thethe establishment of\n</div>\n<div class=\"&amp;nbsp;&amp;nbsp;to determine whetherquite different frommarked the beginningdistance between thecontributions to theconflict between thewidely considered towas one of the firstwith varying degreeshave speculated that(document.getElementparticipating in theoriginally developedeta charset=\"utf-8\"> type=\"text/css\" />\ninterchangeably withmore closely relatedsocial and politicalthat would otherwiseperpendicular to thestyle type=\"text/csstype=\"submit\" name=\"families residing indeveloping countriescomputer programmingeconomic developmentdetermination of thefor more informationon several occasionsportuguC*s (Europeu)P#P:Q\u0000P0Q\u0017P=Q\u0001Q\u000CP:P0Q\u0003P:Q\u0000P0Q\u0017P=Q\u0001Q\u000CP:P0P P>Q\u0001Q\u0001P8P9Q\u0001P:P>P9P<P0Q\u0002P5Q\u0000P8P0P;P>P2P8P=Q\u0004P>Q\u0000P<P0Q\u0006P8P8Q\u0003P?Q\u0000P0P2P;P5P=P8Q\u000FP=P5P>P1Q\u0005P>P4P8P<P>P8P=Q\u0004P>Q\u0000P<P0Q\u0006P8Q\u000FP\u0018P=Q\u0004P>Q\u0000P<P0Q\u0006P8Q\u000FP P5Q\u0001P?Q\u0003P1P;P8P:P8P:P>P;P8Q\u0007P5Q\u0001Q\u0002P2P>P8P=Q\u0004P>Q\u0000P<P0Q\u0006P8Q\u000EQ\u0002P5Q\u0000Q\u0000P8Q\u0002P>Q\u0000P8P8P4P>Q\u0001Q\u0002P0Q\u0002P>Q\u0007P=P>X'Y\u0004Y\u0005X*Y\u0008X'X,X/Y\u0008Y\u0006X'Y\u0004X'X4X*X1X'Y\u0003X'X*X'Y\u0004X'Y\u0002X*X1X'X-X'X*html; charset=UTF-8\" setTimeout(function()display:inline-block;<input type=\"submit\" type = 'text/javascri<img src=\"http://www.\" \"http://www.w3.org/shortcut icon\" href=\"\" autocomplete=\"off\" </a></div><div class=</a></li>\n<li class=\"css\" type=\"text/css\" <form action=\"http://xt/css\" href=\"http://link rel=\"alternate\" \r\n<script type=\"text/ onclick=\"javascript:(new Date).getTime()}height=\"1\" width=\"1\" People's Republic of <a href=\"http://www.text-decoration:underthe beginning of the </div>\n</div>\n</div>\nestablishment of the </div></div></div></d#viewport{min-height:\n<script src=\"http://option><option value=often referred to as /option>\n<option valu<!DOCTYPE html>\n<!--[International Airport>\n<a href=\"http://www</a><a href=\"http://w`8 `82`8)`82`9\u0004`8\u0017`8\"a\u0003%a\u0003\u0010a\u0003 a\u0003\u0017a\u0003#a\u0003\u001Aa\u0003\u0018f-#i+\u0014d8-f\u0016\u0007 (g9\u0001i+\u0014)`$(`$?`$0`%\r`$&`%\u0007`$6`$!`$>`$\t`$(`$2`%\u000B`$!`$\u0015`%\r`$7`%\u0007`$$`%\r`$0`$\u001C`$>`$(`$\u0015`$>`$0`%\u0000`$8`$\u0002`$,`$\u0002`$'`$?`$$`$8`%\r`$%`$>`$*`$(`$>`$8`%\r`$5`%\u0000`$\u0015`$>`$0`$8`$\u0002`$8`%\r`$\u0015`$0`$#`$8`$>`$.`$\u0017`%\r`$0`%\u0000`$\u001A`$?`$\u001F`%\r`$ `%\u000B`$\u0002`$5`$?`$\u001C`%\r`$\u001E`$>`$(`$\u0005`$.`%\u0007`$0`$?`$\u0015`$>`$5`$?`$-`$?`$(`%\r`$(`$\u0017`$>`$!`$?`$/`$>`$\u0001`$\u0015`%\r`$/`%\u000B`$\u0002`$\u0015`$?`$8`%\u0001`$0`$\u0015`%\r`$7`$>`$*`$9`%\u0001`$\u0001`$\u001A`$$`%\u0000`$*`%\r`$0`$,`$\u0002`$'`$(`$\u001F`$?`$*`%\r`$*`$#`%\u0000`$\u0015`%\r`$0`$?`$\u0015`%\u0007`$\u001F`$*`%\r`$0`$>`$0`$\u0002`$-`$*`%\r`$0`$>`$*`%\r`$$`$.`$>`$2`$?`$\u0015`%\u000B`$\u0002`$0`$+`$<`%\r`$$`$>`$0`$(`$?`$0`%\r`$.`$>`$#`$2`$?`$.`$?`$\u001F`%\u0007`$!description\" content=\"document.location.prot.getElementsByTagName(<!DOCTYPE html>\n<html <meta charset=\"utf-8\">:url\" content=\"http://.css\" rel=\"stylesheet\"style type=\"text/css\">type=\"text/css\" href=\"w3.org/1999/xhtml\" xmltype=\"text/javascript\" method=\"get\" action=\"link rel=\"stylesheet\" = document.getElementtype=\"image/x-icon\" />cellpadding=\"0\" cellsp.css\" type=\"text/css\" </a></li><li><a href=\"\" width=\"1\" height=\"1\"\"><a href=\"http://www.style=\"display:none;\">alternate\" type=\"appli-//W3C//DTD XHTML 1.0 ellspacing=\"0\" cellpad type=\"hidden\" value=\"/a>&nbsp;<span role=\"s\n<input type=\"hidden\" language=\"JavaScript\" document.getElementsBg=\"0\" cellspacing=\"0\" ype=\"text/css\" media=\"type='text/javascript'with the exception of ype=\"text/css\" rel=\"st height=\"1\" width=\"1\" ='+encodeURIComponent(<link rel=\"alternate\" \nbody, tr, input, textmeta name=\"robots\" conmethod=\"post\" action=\">\n<a href=\"http://www.css\" rel=\"stylesheet\" </div></div><div classlanguage=\"javascript\">aria-hidden=\"true\">B7<ript\" type=\"text/javasl=0;})();\n(function(){background-image: url(/a></li><li><a href=\"h\t\t<li><a href=\"http://ator\" aria-hidden=\"tru> <a href=\"http://www.language=\"javascript\" /option>\n<option value/div></div><div class=rator\" aria-hidden=\"tre=(new Date).getTime()portuguC*s (do Brasil)P>Q\u0000P3P0P=P8P7P0Q\u0006P8P8P2P>P7P<P>P6P=P>Q\u0001Q\u0002Q\u000CP>P1Q\u0000P0P7P>P2P0P=P8Q\u000FQ\u0000P5P3P8Q\u0001Q\u0002Q\u0000P0Q\u0006P8P8P2P>P7P<P>P6P=P>Q\u0001Q\u0002P8P>P1Q\u000FP7P0Q\u0002P5P;Q\u000CP=P0<!DOCTYPE html PUBLIC \"nt-Type\" content=\"text/<meta http-equiv=\"Conteransitional//EN\" \"http:<html xmlns=\"http://www-//W3C//DTD XHTML 1.0 TDTD/xhtml1-transitional//www.w3.org/TR/xhtml1/pe = 'text/javascript';<meta name=\"descriptionparentNode.insertBefore<input type=\"hidden\" najs\" type=\"text/javascri(document).ready(functiscript type=\"text/javasimage\" content=\"http://UA-Compatible\" content=tml; charset=utf-8\" />\nlink rel=\"shortcut icon<link rel=\"stylesheet\" </script>\n<script type== document.createElemen<a target=\"_blank\" href= document.getElementsBinput type=\"text\" name=a.type = 'text/javascrinput type=\"hidden\" namehtml; charset=utf-8\" />dtd\">\n<html xmlns=\"http-//W3C//DTD HTML 4.01 TentsByTagName('script')input type=\"hidden\" nam<script type=\"text/javas\" style=\"display:none;\">document.getElementById(=document.createElement(' type='text/javascript'input type=\"text\" name=\"d.getElementsByTagName(snical\" href=\"http://www.C//DTD HTML 4.01 Transit<style type=\"text/css\">\n\n<style type=\"text/css\">ional.dtd\">\n<html xmlns=http-equiv=\"Content-Typeding=\"0\" cellspacing=\"0\"html; charset=utf-8\" />\n style=\"display:none;\"><<li><a href=\"http://www. type='text/javascript'>P4P5Q\u000FQ\u0002P5P;Q\u000CP=P>Q\u0001Q\u0002P8Q\u0001P>P>Q\u0002P2P5Q\u0002Q\u0001Q\u0002P2P8P8P?Q\u0000P>P8P7P2P>P4Q\u0001Q\u0002P2P0P1P5P7P>P?P0Q\u0001P=P>Q\u0001Q\u0002P8`$*`%\u0001`$8`%\r`$$`$?`$\u0015`$>`$\u0015`$>`$\u0002`$\u0017`%\r`$0`%\u0007`$8`$\t`$(`%\r`$9`%\u000B`$\u0002`$(`%\u0007`$5`$?`$'`$>`$(`$8`$-`$>`$+`$?`$\u0015`%\r`$8`$?`$\u0002`$\u0017`$8`%\u0001`$0`$\u0015`%\r`$7`$?`$$`$\u0015`%\t`$*`%\u0000`$0`$>`$\u0007`$\u001F`$5`$?`$\u001C`%\r`$\u001E`$>`$*`$(`$\u0015`$>`$0`%\r`$0`$5`$>`$\u0008`$8`$\u0015`%\r`$0`$?`$/`$$`$>", "\u06F7%\u018C'T%\u0085'W%\u00D7%O%g%\u00A6&\u0193%\u01E5&>&*&'&^&\u0088\u0178\u0C3E&\u01AD&\u0192&)&^&%&'&\u0082&P&1&\u00B1&3&]&m&u&E&t&C&\u00CF&V&V&/&>&6&\u0F76\u177Co&p&@&E&M&P&x&@&F&e&\u00CC&7&:&(&D&0&C&)&.&F&-&1&(&L&F&1\u025E*\u03EA\u21F3&\u1372&K&;&)&E&H&P&0&?&9&V&\u0081&-&v&a&,&E&)&?&=&'&'&B&\u0D2E&\u0503&\u0316*&*8&%&%&&&%,)&\u009A&>&\u0086&7&]&F&2&>&J&6&n&2&%&?&\u008E&2&6&J&g&-&0&,&*&J&*&O&)&6&(&<&B&N&.&P&@&2&.&W&M&%\u053C\u0084(,(<&,&\u03DA&\u18C7&-&,(%&(&%&(\u013B0&X&D&\u0081&j&'&J&(&.&B&3&Z&R&h&3&E&E&<\u00C6-\u0360\u1EF3&%8?&@&,&Z&@&0&J&,&^&x&_&6&C&6&C\u072C\u2A25&f&-&-&-&-&,&J&2&8&z&8&C&Y&8&-&d&\u1E78\u00CC-&7&1&F&7&t&W&7&I&.&.&^&=\u0F9C\u19D3&8(>&/&/&\u077B')'\u1065')'%@/&0&%\u043E\u09C0*&*@&C\u053D\u05D4\u0274\u05EB4\u0DD7\u071A\u04D16\u0D84&/\u0178\u0303Z&*%\u0246\u03FF&\u0134&1\u00A8\u04B4\u0174");
+ flipBuffer(dictionary);
+ DICTIONARY_DATA = dictionary;
+ }
+
+
+ /**
+ * @param {!number} a
+ * @param {!number} b
+ * @return {!number}
+ */
+ function min(a, b) {
+ return a <= b ? a : b;
+ }
+
+ /**
+ * @param {!InputStream|null} src
+ * @param {!Int8Array} dst
+ * @param {!number} offset
+ * @param {!number} length
+ * @return {!number}
+ */
+ function readInput(src, dst, offset, length) {
+ if (src == null) return -1;
+ var /** number */ end = min(src.offset + length, src.data.length);
+ var /** number */ bytesRead = end - src.offset;
+ dst.set(src.data.subarray(src.offset, end), offset);
+ src.offset += bytesRead;
+ return bytesRead;
+ }
+
+ /**
+ * @param {!InputStream} src
+ * @return {!number}
+ */
+ function closeInput(src) { return 0; }
+
+ /**
+ * @param {!Int8Array} buffer
+ * @return {void}
+ */
+ function flipBuffer(buffer) { /* no-op */ }
+
+ /**
+ * @param {!string} src
+ * @return {!Int8Array}
+ */
+ function toUsAsciiBytes(src) {
+ var /** !number */ n = src.length;
+ var /** !Int8Array */ result = new Int8Array(n);
+ for (var /** !number */ i = 0; i < n; ++i) {
+ result[i] = src.charCodeAt(i);
+ }
+ return result;
+ }
+
+ /**
+ * @param {!Int8Array} bytes
+ * @return {!Int8Array}
+ */
+ function decode(bytes) {
+ var /** !State */ s = new State();
+ initState(s, new InputStream(bytes));
+ var /** !number */ totalOutput = 0;
+ var /** !Array<!Int8Array> */ chunks = [];
+ while (true) {
+ var /** !Int8Array */ chunk = new Int8Array(16384);
+ chunks.push(chunk);
+ s.output = chunk;
+ s.outputOffset = 0;
+ s.outputLength = 16384;
+ s.outputUsed = 0;
+ decompress(s);
+ totalOutput += s.outputUsed;
+ if (s.outputUsed < 16384) break;
+ }
+ close(s);
+ var /** !Int8Array */ result = new Int8Array(totalOutput);
+ var /** !number */ offset = 0;
+ for (var /** !number */ i = 0; i < chunks.length; ++i) {
+ var /** !Int8Array */ chunk = chunks[i];
+ var /** !number */ end = min(totalOutput, offset + 16384);
+ var /** !number */ len = end - offset;
+ if (len < 16384) {
+ result.set(chunk.subarray(0, len), offset);
+ } else {
+ result.set(chunk, offset);
+ }
+ offset += len;
+ }
+ return result;
+ }
+
+ return decode;
+}
+
+/** @export */
+var BrotliDecode = BrotliDecodeClosure();
+
+window["BrotliDecode"] = BrotliDecode;
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/decode.min.js b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/decode.min.js
new file mode 100755
index 000000000..5fee00121
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/decode.min.js
@@ -0,0 +1,2 @@
+function BrotliDecodeClosure(){"use strict";function e(e){this.a=e,this.b=0}function t(e){for(var t=-1,i=16;i>0;)e>>>i!=0&&(t+=i,e>>>=i),i>>=1;return t+e}function i(e,t,i){return 16+t+2*(i<<e)}function n(e,i,n){if(e<n+(2<<i))throw"maxDistance is too small";var a=(e-n>>i)+4,o=t(a)-1,r=o-1<<1|a>>o&1;return(r-1<<i)+(1<<i)+n+16}function a(e){var t=new Int16Array(24),i=new Int16Array(24);i[0]=2;for(var n=0;n<23;++n)t[n+1]=t[n]+(1<<Pe[n]),i[n+1]=i[n]+(1<<$e[n]);for(var a=0;a<704;++a){var o=a>>>6,r=-4;o>=2&&(o-=2,r=0);var s=(170064>>>2*o&3)<<3|a>>>3&7,l=(156228>>>2*o&3)<<3|7&a,c=i[l],d=r+(c>4?3:c-2),h=4*a;e[h+0]=Pe[s]|$e[l]<<8,e[h+1]=t[s],e[h+2]=i[l],e[h+3]=d}}function o(e){var t=e.c;if(e.c=0,e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16),0==H(e,1))return 16;var i=H(e,3);return 0!=i?17+i:(i=H(e,3),0!=i?1==i?0==t?-1:(e.c=1,1==H(e,1)?-1:(i=H(e,6),i<10||i>30?-1:i)):8+i:17)}function r(e,t){if(0!=e.h)throw"State MUST be uninitialized";e.j=new Int32Array(3091),e.j[0]=7,e.k=3;var i=n(2147483644,3,120);e.l=new Int8Array(i),e.m=new Int32Array(i),e.input=t,U(e),e.h=1}function s(e){if(0==e.h)throw"State MUST be initialized";11!=e.h&&(e.h=11,null!=e.input&&(ne(e.input),e.input=null))}function l(e){if(e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16),0!=H(e,1)){var t=H(e,3);return 0==t?1:H(e,t)+(1<<t)}return 0}function c(e){if(e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16),e.n=H(e,1),e.o=0,e.p=0,e.q=0,0==e.n||0==H(e,1)){var t=H(e,2)+4;if(7==t){if(e.q=1,0!=H(e,1))throw"Corrupted reserved bit";var i=H(e,2);if(0==i)return;for(var n=0;n<i;n++){e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16);var a=H(e,8);if(0==a&&n+1==i&&i>1)throw"Exuberant nibble";e.o|=a<<8*n}}else for(var n=0;n<t;n++){e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16);var a=H(e,4);if(0==a&&n+1==t&&t>4)throw"Exuberant nibble";e.o|=a<<4*n}e.o++,0==e.n&&(e.p=H(e,1))}}function d(e,t,i){var n=e[t],a=i.e>>>i.d;n+=255&a;var o=e[n]>>16,r=65535&e[n];if(o<=8)return i.d+=o,r;n+=r;var s=(1<<o)-1;return n+=(a&s)>>>8,i.d+=(e[n]>>16)+8,65535&e[n]}function h(e,t,i){i.d>=16&&(i.e=i.f[i.g++]<<16|i.e>>>16,i.d-=16);var n=d(e,t,i),a=ge[n];return i.d>=16&&(i.e=i.f[i.g++]<<16|i.e>>>16,i.d-=16),me[n]+(a<=16?H(i,a):R(i,a))}function f(e,t){for(var i=e[t];t>0;t--)e[t]=e[t-1];e[0]=i}function p(e,t){for(var i=new Int32Array(256),n=0;n<256;n++)i[n]=n;for(var n=0;n<t;n++){var a=255&e[n];e[n]=i[a],0!=a&&f(i,a)}}function u(e,t,i,n){var a=0,o=8,r=0,s=0,l=32768,c=new Int32Array(33),d=c.length-1;for(W(c,d,5,e,18);a<t&&l>0;){n.g>2030&&B(n),n.d>=16&&(n.e=n.f[n.g++]<<16|n.e>>>16,n.d-=16);var h=n.e>>>n.d&31;n.d+=c[h]>>16;var f=65535&c[h];if(f<16)r=0,i[a++]=f,0!=f&&(o=f,l-=32768>>f);else{var p=f-14,u=0;16==f&&(u=o),s!=u&&(r=0,s=u);var m=r;r>0&&(r-=2,r<<=p),n.d>=16&&(n.e=n.f[n.g++]<<16|n.e>>>16,n.d-=16),r+=H(n,p)+3;var g=r-m;if(a+g>t)throw"symbol + repeatDelta > numSymbols";for(var P=0;P<g;P++)i[a++]=s;0!=s&&(l-=g<<15-s)}}if(0!=l)throw"Unused space";i.fill(0,a,t)}function m(e,t){for(var i=0;i<t-1;++i)for(var n=i+1;n<t;++n)if(e[i]==e[n])throw"Duplicate simple Huffman code symbol"}function g(e,i,n,a,o){for(var r=new Int32Array(i),s=new Int32Array(4),l=1+t(e-1),c=H(o,2)+1,d=0;d<c;d++){o.d>=16&&(o.e=o.f[o.g++]<<16|o.e>>>16,o.d-=16);var h=H(o,l);if(h>=i)throw"Can't readHuffmanCode";s[d]=h}m(s,c);var f=c;switch(4==c&&(f+=H(o,1)),f){case 1:r[s[0]]=1;break;case 2:r[s[0]]=1,r[s[1]]=1;break;case 3:r[s[0]]=1,r[s[1]]=2,r[s[2]]=2;break;case 4:r[s[0]]=2,r[s[1]]=2,r[s[2]]=2,r[s[3]]=2;break;case 5:r[s[0]]=1,r[s[1]]=2,r[s[2]]=3,r[s[3]]=3}return W(n,a,8,r,i)}function P(e,t,i,n,a){for(var o=new Int32Array(e),r=new Int32Array(18),s=32,l=0,c=t;c<18&&s>0;c++){var d=ce[c];a.d>=16&&(a.e=a.f[a.g++]<<16|a.e>>>16,a.d-=16);var h=a.e>>>a.d&15;a.d+=fe[h]>>16;var f=65535&fe[h];r[d]=f,0!=f&&(s-=32>>f,l++)}if(0!=s&&1!=l)throw"Corrupted Huffman code histogram";return u(r,e,o,a),W(i,n,8,o,e)}function $(e,t,i,n,a){a.g>2030&&B(a),a.d>=16&&(a.e=a.f[a.g++]<<16|a.e>>>16,a.d-=16);var o=H(a,2);return 1==o?g(e,t,i,n,a):P(t,o,i,n,a)}function b(e,t,i){i.g>2030&&B(i);var n=l(i)+1;if(1==n)return t.fill(0,0,e),n;i.d>=16&&(i.e=i.f[i.g++]<<16|i.e>>>16,i.d-=16);var a=H(i,1),o=0;0!=a&&(o=H(i,4)+1);var r=n+o,s=le[r+31>>5],c=new Int32Array(s+1),h=c.length-1;$(r,r,c,h,i);for(var f=0;f<e;){i.g>2030&&B(i),i.d>=16&&(i.e=i.f[i.g++]<<16|i.e>>>16,i.d-=16);var u=d(c,h,i);if(0==u)t[f]=0,f++;else if(u<=o){i.d>=16&&(i.e=i.f[i.g++]<<16|i.e>>>16,i.d-=16);for(var m=(1<<u)+H(i,u);0!=m;){if(f>=e)throw"Corrupted context map";t[f]=0,f++,m--}}else t[f]=u-o,f++}return i.d>=16&&(i.e=i.f[i.g++]<<16|i.e>>>16,i.d-=16),1==H(i,1)&&p(t,e),n}function v(e,t,i){var n=e.r,a=4+2*t;e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16);var o=d(e.j,2*t,e),r=h(e.j,2*t+1,e);return 1==o?o=n[a+1]+1:0==o?o=n[a]:o-=2,o>=i&&(o-=i),n[a]=n[a+1],n[a+1]=o,r}function y(e){e.s=v(e,0,e.t);var t=e.r[5];e.u=t<<6,e.v=255&e.w[e.u];var i=e.x[t];e.y=i<<9,e.z=e.y+256}function X(e){e.A=v(e,1,e.B),e.C=e.r[7]}function w(e){e.D=v(e,2,e.F),e.G=e.r[9]<<2}function Y(e){var t=e.H;if(t>e.I){for(var i=e.I;t>>1>i;)t>>=1;0==e.n&&t<16384&&e.H>=16384&&(t=16384)}if(!(t<=e.J)){var n=t+37,a=new Int8Array(n);0!=e.K.length&&a.L(e.K.M(0,0+e.J),0),e.K=a,e.J=t}}function Q(e){return 0!=e.n?(e.N=10,void(e.h=12)):(e.O=new Int32Array(0),e.P=new Int32Array(0),e.Q=new Int32Array(0),e.g>2030&&B(e),c(e),void(0==e.o&&0==e.q||(0!=e.p||0!=e.q?(J(e),e.h=0!=e.q?5:6):e.h=3,0==e.q&&(e.I+=e.o,e.I>1<<30&&(e.I=1<<30),e.J<e.H&&Y(e)))))}function k(e,t,i){var n=e.j[2*t];if(i<=1)return e.j[2*t+1]=n,e.j[2*t+2]=n,1<<28;var a=i+2;n+=$(a,a,e.j,2*t,e),e.j[2*t+1]=n;var o=26;return n+=$(o,o,e.j,2*t+1,e),e.j[2*t+2]=n,h(e.j,2*t+1,e)}function x(e,t){for(var i=e.l,n=e.m,a=e.R,o=e.S,r=1<<a,s=1,l=0,c=16,d=0;d<o;++d)i[c]=0,n[c]=d+1,++c;for(;c<t;){for(var h=o+((2+l<<s)-4<<a)+1,d=0;d<r;++d)i[c]=s,n[c]=h+d,++c;s+=l,l^=1}}function C(e){e.t=l(e)+1,e.s=k(e,0,e.t),e.B=l(e)+1,e.A=k(e,1,e.B),e.F=l(e)+1,e.D=k(e,2,e.F),e.g>2030&&B(e),e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16),e.R=H(e,2),e.S=H(e,4)<<e.R,e.T=(1<<e.R)-1,e.x=new Int8Array(e.t);for(var t=0;t<e.t;){for(var a=te(t+96,e.t);t<a;++t)e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16),e.x[t]=H(e,2);e.g>2030&&B(e)}e.w=new Int8Array(e.t<<6);var o=b(e.t<<6,e.w,e);e.U=1;for(var r=0;r<e.t<<6;r++)if(e.w[r]!=r>>6){e.U=0;break}e.V=new Int8Array(e.F<<2);var s=b(e.F<<2,e.V,e);e.O=I(256,256,o,e),e.P=I(704,704,e.B,e);var c=i(e.R,e.S,24),d=c;1==e.c&&(c=i(e.R,e.S,62),d=n(2147483644,e.R,e.S)),e.Q=I(c,d,s,e),x(e,d),e.u=0,e.G=0,e.y=512*e.x[0],e.z=e.y+256,e.v=0,e.C=0,e.r[4]=1,e.r[5]=0,e.r[6]=1,e.r[7]=0,e.r[8]=1,e.r[9]=0}function j(e){var t=e.K;if(e.o<=0)return L(e),void(e.h=2);var i=te(e.J-e.W,e.o);return G(e,t,e.W,i),e.o-=i,e.W+=i,e.W==e.J?(e.N=6,void(e.h=12)):(L(e),void(e.h=2))}function A(e){var t=te(e.X-e.Y,e.Z-e.$);return 0!=t&&(e._.L(e.K.M(e.$,e.$+t),e.aa+e.Y),e.Y+=t,e.$+=t),e.Y<e.X?1:0}function I(e,t,i,n){for(var a=le[t+31>>5],o=new Int32Array(i+i*a),r=i,s=0;s<i;++s)o[s]=r,r+=$(e,t,o,s,n);return o}function q(e){var t=e.J;return 0!=e.i&&(t=te(t,e.$+e.X-e.Y)),t}function T(e){if(0==e.h)throw"Can't decompress until initialized";if(11==e.h)throw"Can't decompress after close";if(1==e.h){var t=o(e);if(t==-1)throw"Invalid 'windowBits' code";e.H=1<<t,e.ba=e.H-16,e.h=2}for(var i=q(e),n=e.J-1,a=e.K;10!=e.h;)switch(e.h){case 2:if(e.o<0)throw"Invalid metablock length";Q(e),i=q(e),n=e.J-1,a=e.K;continue;case 3:C(e),e.h=4;case 4:if(e.o<=0){e.h=2;continue}e.g>2030&&B(e),0==e.A&&X(e),e.A--,e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16);var r=d(e.P,e.C,e)<<2,s=be[r],l=be[r+1],c=be[r+2];e.ca=be[r+3],e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16);var h=255&s;e.da=l+(h<=16?H(e,h):R(e,h)),e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16);var h=s>>8;e.ea=c+(h<=16?H(e,h):R(e,h)),e.fa=0,e.h=7;case 7:if(0!=e.U){for(;e.fa<e.da;)if(e.g>2030&&B(e),0==e.s&&y(e),e.s--,e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16),a[e.W]=d(e.O,e.v,e),e.W++,e.fa++,e.W>=i){e.N=7,e.h=12;break}}else for(var f=255&a[e.W-1&n],p=255&a[e.W-2&n];e.fa<e.da;){e.g>2030&&B(e),0==e.s&&y(e);var u=ye[e.y+f]|ye[e.z+p],m=255&e.w[e.u+u];if(e.s--,p=f,e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16),f=d(e.O,m,e),a[e.W]=f,e.W++,e.fa++,e.W>=i){e.N=7,e.h=12;break}}if(7!=e.h)continue;if(e.o-=e.da,e.o<=0){e.h=4;continue}var g=e.ca;if(g<0)e.ga=e.r[e.k];else{e.g>2030&&B(e),0==e.D&&w(e),e.D--,e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16);var P=255&e.V[e.G+g];if(g=d(e.Q,P,e),g<16){var $=e.k+de[g]&3;if(e.ga=e.r[$]+he[g],e.ga<0)throw"Negative distance"}else{var b,h=e.l[g];e.d+h<=32?b=H(e,h):(e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16),b=h<=16?H(e,h):R(e,h)),e.ga=e.m[g]+(b<<e.R)}}if(e.ha!=e.ba&&e.W<e.ba?e.ha=e.W:e.ha=e.ba,e.ga>e.ha){e.h=9;continue}if(g>0&&(e.k=e.k+1&3,e.r[e.k]=e.ga),e.ea>e.o)throw"Invalid backward reference";e.fa=0,e.h=8;case 8:var v=e.W-e.ga&n,Y=e.W,k=e.ea-e.fa,x=v+k,I=Y+k;if(x<n&&I<n){if(k<12||x>Y&&I>v)for(var T=0;T<k;T+=4)a[Y++]=a[v++],a[Y++]=a[v++],a[Y++]=a[v++],a[Y++]=a[v++];else a.copyWithin(Y,v,x);e.fa+=k,e.o-=k,e.W+=k}else for(;e.fa<e.ea;)if(a[e.W]=a[e.W-e.ga&n],e.o--,e.W++,e.fa++,e.W>=i){e.N=8,e.h=12;break}8==e.h&&(e.h=4);continue;case 9:if(e.ga>2147483644)throw"Invalid backward reference";if(!(e.ea>=4&&e.ea<=24))throw"Invalid backward reference";var S=pe[e.ea],E=e.ga-e.ha-1,D=ue[e.ea],N=(1<<D)-1,F=E&N,W=E>>>D;if(S+=F*e.ea,!(W<121))throw"Invalid backward reference";var U=z(a,e.W,se,S,e.ea,ve,W);if(e.W+=U,e.o-=U,e.W>=i){e.N=4,e.h=12;continue}e.h=4;continue;case 5:for(;e.o>0;)e.g>2030&&B(e),e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16),H(e,8),e.o--;e.h=2;continue;case 6:j(e);continue;case 12:e.Z=te(e.W,e.J),e.h=13;case 13:if(0==A(e))return;e.W>=e.ba&&(e.ha=e.ba),e.W>=e.J&&(e.W>e.J&&a.copyWithin(0,e.J,e.W),e.W&=n,e.$=0),e.h=e.N;continue;default:throw"Unexpected state "+e.h}if(10==e.h){if(e.o<0)throw"Invalid metablock length";J(e),M(e,1)}}function S(e,t,i){this.ia=0,this.ja=new Int32Array(0),this.ka=new Int8Array(0),this.la=new Int32Array(0),this.ma=new Int16Array(0),this.ia=e,this.ja=new Int32Array(3*e),this.ma=new Int16Array(e),this.ka=new Int8Array(t),this.la=new Int32Array(i+1)}function E(e,t,i,n,a){for(var o=n.length,r=1,s=0,l=0;l<o;++l){var c=n.charCodeAt(l);35==c?t[r++]=s:e[s++]=c}for(var l=0;l<363;++l)i[l]=a.charCodeAt(l)-32}function z(e,t,i,n,a,o,r){var s=t,l=o.ja,c=o.ka,d=o.la,h=3*r,f=l[h],p=l[h+1],u=l[h+2],m=d[f],g=d[f+1],P=d[u],$=d[u+1],b=p-11,v=p-0;for((b<1||b>9)&&(b=0),(v<1||v>9)&&(v=0);m!=g;)e[s++]=c[m++];b>a&&(b=a),n+=b,a-=b,a-=v;for(var y=a;y>0;)e[s++]=i[n++],y--;if(10==p||11==p){var X=s-a;for(10==p&&(a=1);a>0;){var w=255&e[X];w<192?(w>=97&&w<=122&&(e[X]^=32),X+=1,a-=1):w<224?(e[X+1]^=32,X+=2,a-=2):(e[X+2]^=5,X+=3,a-=3)}}else if(21==p||22==p)for(var Y=s-a,Q=o.ma[r],k=(32767&Q)+(16777216-(32768&Q));a>0;){var x=1,w=255&e[Y];if(w<128)k+=w,e[Y]=127&k;else if(w<192);else if(w<224)if(a>=2){var C=e[Y+1];k+=63&C|(31&w)<<6,e[Y]=192|k>>6&31,e[Y+1]=192&C|63&k,x=2}else x=a;else if(w<240)if(a>=3){var C=e[Y+1],j=e[Y+2];k+=63&j|(63&C)<<6|(15&w)<<12,e[Y]=224|k>>12&15,e[Y+1]=192&C|k>>6&63,e[Y+2]=192&j|63&k,x=3}else x=a;else if(w<248)if(a>=4){var C=e[Y+1],j=e[Y+2],A=e[Y+3];k+=63&A|(63&j)<<6|(63&C)<<12|(7&w)<<18,e[Y]=240|k>>18&7,e[Y+1]=192&C|k>>12&63,e[Y+2]=192&j|k>>6&63,e[Y+3]=192&A|63&k,x=4}else x=a;Y+=x,a-=x,21==p&&(a=0)}for(;P!=$;)e[s++]=c[P++];return s-t}function D(e,t){for(var i=1<<t-1;0!=(e&i);)i>>=1;return(e&i-1)+i}function N(e,t,i,n,a){do n-=i,e[t+n]=a;while(n>0)}function F(e,t,i){for(var n=1<<t-i;t<15&&(n-=e[t],!(n<=0));)t++,n<<=1;return t-i}function W(e,t,i,n,a){var o,r,s=e[t],l=new Int32Array(a),c=new Int32Array(16),d=new Int32Array(16);for(r=0;r<a;r++)c[n[r]]++;d[1]=0;for(var h=1;h<15;h++)d[h+1]=d[h]+c[h];for(r=0;r<a;r++)0!=n[r]&&(l[d[n[r]]++]=r);var f=i,p=1<<f,u=p;if(1==d[15]){for(o=0;o<u;o++)e[s+o]=l[0];return u}o=0,r=0;for(var h=1,m=2;h<=i;h++,m<<=1)for(;c[h]>0;c[h]--)N(e,s+o,m,p,h<<16|l[r++]),o=D(o,h);for(var g=u-1,P=-1,$=s,h=i+1,m=2;h<=15;h++,m<<=1)for(;c[h]>0;c[h]--)(o&g)!=P&&($+=p,f=F(c,h,i),p=1<<f,u+=p,P=o&g,e[s+P]=f+i<<16|$-s-P),N(e,$+(o>>i),m,p,h-i<<16|l[r++]),o=D(o,h);return u}function B(e){if(0!=e.na){if(_(e)>=-2)return;throw"No more input"}var t=e.g<<1,i=4096-t;for(e.oa.copyWithin(0,t,4096),e.g=0;i<4096;){var n=4096-i,a=ie(e.input,e.oa,i,n);if(a<=0){e.na=1,e.pa=i,i+=1;break}i+=a}K(e,i)}function M(e,t){if(0!=e.na){var i=(e.g<<1)+(e.d+7>>3)-4;if(i>e.pa)throw"Read after end";if(0!=t&&i!=e.pa)throw"Unused bytes after end"}}function H(e,t){var i=e.e>>>e.d&(1<<t)-1;return e.d+=t,i}function R(e,t){var i=H(e,16);return e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16,i|H(e,t-16)<<16}function U(e){e.oa=new Int8Array(4160),e.e=0,e.f=new Int16Array(2080),e.d=32,e.g=2048,e.na=0,O(e)}function O(e){e.g>2030&&B(e),M(e,0),e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16,e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16}function L(e){32==e.d&&O(e)}function J(e){var t=32-e.d&7;if(0!=t){var i=H(e,t);if(0!=i)throw"Corrupted padding bits"}}function _(e){var t=2048;return 0!=e.na&&(t=e.pa+1>>1),t-e.g}function G(e,t,i,n){if(0!=(7&e.d))throw"Unaligned copyBytes";for(;32!=e.d&&0!=n;)t[i++]=e.e>>>e.d,e.d+=8,n--;if(0!=n){var a=te(_(e),n>>1);if(a>0){var o=e.g<<1,r=a<<1;t.L(e.oa.M(o,o+r),i),i+=r,n-=r,e.g+=a}if(0!=n){if(_(e)>0){for(e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16);0!=n;)t[i++]=e.e>>>e.d,e.d+=8,n--;return void M(e,0)}for(;n>0;){var s=ie(e.input,t,i,n);if(s==-1)throw"Unexpected end of input";i+=s,n-=s}}}}function K(e,t){for(var i=e.oa,n=t>>1,a=e.f,o=0;o<n;++o)a[o]=255&i[2*o]|(255&i[2*o+1])<<8}function V(e,t,i){for(var n=0;n<256;++n)e[n]=63&n,e[512+n]=n>>2,e[1792+n]=2+(n>>6);for(var n=0;n<128;++n)e[1024+n]=4*(t.charCodeAt(n)-32);for(var n=0;n<64;++n)e[1152+n]=1&n,e[1216+n]=2+(1&n);for(var a=1280,o=0;o<19;++o)for(var r=3&o,s=i.charCodeAt(o)-32,n=0;n<s;++n)e[a++]=r;for(var n=0;n<16;++n)e[1792+n]=1,e[2032+n]=6;e[1792]=0,e[2047]=7;for(var n=0;n<256;++n)e[1536+n]=e[1792+n]<<3}function Z(){this.K=new Int8Array(0),this.x=new Int8Array(0),this.w=new Int8Array(0),this.V=new Int8Array(0),this.l=new Int8Array(0),this._=new Int8Array(0),this.oa=new Int8Array(0),this.f=new Int16Array(0),this.qa=new Int32Array(0),this.r=new Int32Array(0),this.j=new Int32Array(0),this.O=new Int32Array(0),this.P=new Int32Array(0),this.Q=new Int32Array(0),this.m=new Int32Array(0),this.h=0,this.N=0,this.e=0,this.d=0,this.g=0,this.pa=0,this.na=0,this.o=0,this.n=0,this.p=0,this.q=0,this.s=0,this.t=0,this.A=0,this.B=0,this.D=0,this.F=0,this.W=0,this.ha=0,this.k=0,this.U=0,this.v=0,this.C=0,this.fa=0,this.da=0,this.u=0,this.G=0,this.y=0,this.z=0,this.ca=0,this.S=0,this.T=0,this.R=0,this.ga=0,this.ea=0,this.ba=0,this.H=0,this.J=0,this.I=0,this.aa=0,this.X=0,this.Y=0,this.$=0,this.Z=0,this.i=0,this.c=0,this.input=null,this.K=new Int8Array(0),this.r=new Int32Array(10),this.r[0]=16,this.r[1]=15,this.r[2]=11,this.r[3]=4}function ee(e,t,i,n){var a=oe(t+i);if(a.length!=e.length)throw"Corrupted brotli dictionary";for(var o=0,r=n.length,s=0;s<r;s+=2){var l=n.charCodeAt(s)-36,c=n.charCodeAt(s+1)-36;o+=l;for(var d=0;d<c;++d)a[o]|=128,o++}e.L(a)}function te(e,t){return e<=t?e:t}function ie(e,t,i,n){if(null==e)return-1;var a=te(e.b+n,e.a.length),o=a-e.b;return t.L(e.a.M(e.b,a),i),e.b+=o,o}function ne(e){return 0}function ae(e){}function oe(e){for(var t=e.length,i=new Int8Array(t),n=0;n<t;++n)i[n]=e.charCodeAt(n);return i}function re(t){var i=new Z;r(i,new e(t));for(var n=0,a=[];;){var o=new Int8Array(16384);if(a.push(o),i._=o,i.aa=0,i.X=16384,i.Y=0,T(i),n+=i.Y,i.Y<16384)break}s(i);for(var l=new Int8Array(n),c=0,d=0;d<a.length;++d){var o=a[d],h=te(n,c+16384),f=h-c;f<16384?l.L(o.M(0,f),c):l.L(o,c),c+=f}return l}var se=new Int8Array(0),le=Int32Array.from([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]),ce=Int32Array.from([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),de=Int32Array.from([0,3,2,1,0,0,0,0,0,0,3,3,3,3,3,3]),he=Int32Array.from([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),fe=Int32Array.from([131072,131076,131075,196610,131072,131076,131075,262145,131072,131076,131075,196610,131072,131076,131075,262149]),pe=Int32Array.from([0,0,0,0,0,4096,9216,21504,35840,44032,53248,63488,74752,87040,93696,100864,104704,106752,108928,113536,115968,118528,119872,121280,122016]),ue=Int32Array.from([0,0,0,0,10,10,11,11,10,10,10,10,10,9,9,8,7,7,8,7,7,6,6,5,5]),me=Int32Array.from([1,5,9,13,17,25,33,41,49,65,81,97,113,145,177,209,241,305,369,497,753,1265,2289,4337,8433,16625]),ge=Int32Array.from([2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,7,8,9,10,11,12,13,24]),Pe=Int16Array.from([0,0,0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,7,8,9,10,12,14,24]),$e=Int16Array.from([0,0,0,0,0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,7,8,9,10,24]),be=new Int16Array(2816);a(be);var ve=new S(121,167,50);E(ve.ka,ve.la,ve.ja,'# #s #, #e #.# the #.com/#\xc2\xa0# of # and # in # to #"#">#\n#]# for # a # that #. # with #\'# from # by #. The # on # as # is #ing #\n\t#:#ed #(# at #ly #="# of the #. This #,# not #er #al #=\'#ful #ive #less #est #ize #ous #'," !! ! , *! &! \" ! ) * * - ! # ! #!*! + ,$ ! - % . / # 0 1 . \" 2 3!* 4% ! # / 5 6 7 8 0 1 & $ 9 + : ; < ' != > ?! 4 @ 4 2 & A *# ( B C& ) % ) !*# *-% A +! *. D! %' & E *6 F G% ! *A *% H! D I!+! J!+ K +- *4! A L!*4 M N +6 O!*% +.! K *G P +%( ! G *D +D Q +# *K!*G!+D!+# +G +A +4!+% +K!+4!*D!+K!*K");var ye=new Int32Array(2048);V(ye," !! ! \"#$##%#$&'##(#)#++++++++++((&*'##,---,---,-----,-----,-----&#'###.///.///./////./////./////&#'# ","A/* ': & : $ \x81 @");var Xe=new Int8Array(122784);return ee(Xe,'timedownlifeleftbackcodedatashowonlysitecityopenjustlikefreeworktextyearoverbodyloveformbookplaylivelinehelphomesidemorewordlongthemviewfindpagedaysfullheadtermeachareafromtruemarkableuponhighdatelandnewsevennextcasebothpostusedmadehandherewhatnameLinkblogsizebaseheldmakemainuser\') +holdendswithNewsreadweresigntakehavegameseencallpathwellplusmenufilmpartjointhislistgoodneedwayswestjobsmindalsologorichuseslastteamarmyfoodkingwilleastwardbestfirePageknowaway.pngmovethanloadgiveselfnotemuchfeedmanyrockicononcelookhidediedHomerulehostajaxinfoclublawslesshalfsomesuchzone100%onescareTimeracebluefourweekfacehopegavehardlostwhenparkkeptpassshiproomHTMLplanTypedonesavekeepflaglinksoldfivetookratetownjumpthusdarkcardfilefearstaykillthatfallautoever.comtalkshopvotedeepmoderestturnbornbandfellroseurl(skinrolecomeactsagesmeetgold.jpgitemvaryfeltthensenddropViewcopy1.0"</a>stopelseliestourpack.gifpastcss?graymean&gt;rideshotlatesaidroadvar feeljohnrickportfast\'UA-dead</b>poorbilltypeU.S.woodmust2px;Inforankwidewantwalllead[0];paulwavesure$(\'#waitmassarmsgoesgainlangpaid!-- lockunitrootwalkfirmwifexml"songtest20pxkindrowstoolfontmailsafestarmapscorerainflowbabyspansays4px;6px;artsfootrealwikiheatsteptriporg/lakeweaktoldFormcastfansbankveryrunsjulytask1px;goalgrewslowedgeid="sets5px;.js?40pxif (soonseatnonetubezerosentreedfactintogiftharm18pxcamehillboldzoomvoideasyringfillpeakinitcost3px;jacktagsbitsrolleditknewnear<!--growJSONdutyNamesaleyou lotspainjazzcoldeyesfishwww.risktabsprev10pxrise25pxBlueding300,ballfordearnwildbox.fairlackverspairjunetechif(!pickevil$("#warmlorddoespull,000ideadrawhugespotfundburnhrefcellkeystickhourlossfuel12pxsuitdealRSS"agedgreyGET"easeaimsgirlaids8px;navygridtips#999warsladycars); }php?helltallwhomzh:e*/\r\n 100hall.\n\nA7px;pushchat0px;crew*/</hash75pxflatrare && tellcampontolaidmissskiptentfinemalegetsplot400,\r\n\r\ncoolfeet.php<br>ericmostguidbelldeschairmathatom/img&#82luckcent000;tinygonehtmlselldrugFREEnodenick?id=losenullvastwindRSS wearrelybeensamedukenasacapewishgulfT23:hitsslotgatekickblurthey15px\'\'););">msiewinsbirdsortbetaseekT18:ordstreemall60pxfarmb\0\x19sboys[0].\');"POSTbearkids);}}marytend(UK)quadzh:f-siz----prop\');\rliftT19:viceandydebt>RSSpoolneckblowT16:doorevalT17:letsfailoralpollnovacolsgene b\0\x14softrometillross<h3>pourfadepink<tr>mini)|!(minezh:hbarshear00);milk -->ironfreddiskwentsoilputs/js/holyT22:ISBNT20:adamsees<h2>json\', \'contT21: RSSloopasiamoon</p>soulLINEfortcartT14:<h1>80px!--<9px;T04:mike:46ZniceinchYorkricezh:d\'));puremageparatonebond:37Z_of_\']);000,zh:gtankyardbowlbush:56ZJava30px\n|}\n%C3%:34ZjeffEXPIcashvisagolfsnowzh:iquer.csssickmeatmin.binddellhirepicsrent:36ZHTTP-201fotowolfEND xbox:54ZBODYdick;\n}\nexit:35Zvarsbeat\'});diet999;anne}}</[i].LangkmB2wiretoysaddssealalex;\n\t}echonine.org005)tonyjewssandlegsroof000) 200winegeardogsbootgarycutstyletemption.xmlcockgang$(\'.50pxPh.Dmiscalanloandeskmileryanunixdisc);}\ndustclip).\n\n70px-200DVDs7]><tapedemoi++)wageeurophiloptsholeFAQsasin-26TlabspetsURL bulkcook;}\r\nHEAD[0])abbrjuan(198leshtwin</i>sonyguysfuckpipe|-\n!002)ndow[1];[];\nLog salt\r\n\t\tbangtrimbath){\r\n00px\n});ko:lfeesad>\rs:// [];tollplug(){\n{\r\n .js\'200pdualboat.JPG);\n}quot);\n\n\');\n\r\n}\r201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037201320122011201020092008200720062005200420032002200120001999199819971996199519941993199219911990198919881987198619851984198319821981198019791978197719761975197419731972197119701969196819671966196519641963196219611960195919581957195619551954195319521951195010001024139400009999comomC!sesteestaperotodohacecadaaC1obiendC-aasC-vidacasootroforosolootracualdijosidograntipotemadebealgoquC)estonadatrespococasabajotodasinoaguapuesunosantediceluisellamayozonaamorpisoobraclicellodioshoracasiP7P0P=P0P>P<Q\0P0Q\0Q\x03Q\x02P0P=P5P?P>P>Q\x02P8P7P=P>P4P>Q\x02P>P6P5P>P=P8Q\x05P\x1dP0P5P5P1Q\vP<Q\vP\x12Q\vQ\x01P>P2Q\vP2P>P\x1dP>P>P1P\x1fP>P;P8P=P8P P$P\x1dP5P\x1cQ\vQ\x02Q\vP\x1eP=P8P<P4P0P\x17P0P\x14P0P\x1dQ\x03P\x1eP1Q\x02P5P\x18P7P5P9P=Q\x03P<P<P"Q\vQ\x03P6Y\x01Y\nX#Y\x06Y\x05X\'Y\x05X9Y\x03Y\x04X#Y\bX1X/Y\nX\'Y\x01Y\tY\x07Y\bY\x04Y\x05Y\x04Y\x03X\'Y\bY\x04Y\x07X(X3X\'Y\x04X%Y\x06Y\x07Y\nX#Y\nY\x02X/Y\x07Y\x04X+Y\x05X(Y\x07Y\x04Y\bY\x04Y\nX(Y\x04X\'Y\nX(Y\x03X4Y\nX\'Y\x05X#Y\x05Y\x06X*X(Y\nY\x04Y\x06X-X(Y\x07Y\x05Y\x05X4Y\bX4firstvideolightworldmediawhitecloseblackrightsmallbooksplacemusicfieldorderpointvalueleveltableboardhousegroupworksyearsstatetodaywaterstartstyledeathpowerphonenighterrorinputabouttermstitletoolseventlocaltimeslargewordsgamesshortspacefocusclearmodelblockguideradiosharewomenagainmoneyimagenamesyounglineslatercolorgreenfront&amp;watchforcepricerulesbeginaftervisitissueareasbelowindextotalhourslabelprintpressbuiltlinksspeedstudytradefoundsenseundershownformsrangeaddedstillmovedtakenaboveflashfixedoftenotherviewschecklegalriveritemsquickshapehumanexistgoingmoviethirdbasicpeacestagewidthloginideaswrotepagesusersdrivestorebreaksouthvoicesitesmonthwherebuildwhichearthforumthreesportpartyClicklowerlivesclasslayerentrystoryusagesoundcourtyour birthpopuptypesapplyImagebeinguppernoteseveryshowsmeansextramatchtrackknownearlybegansuperpapernorthlearngivennamedendedTermspartsGroupbrandusingwomanfalsereadyaudiotakeswhile.com/livedcasesdailychildgreatjudgethoseunitsneverbroadcoastcoverapplefilescyclesceneplansclickwritequeenpieceemailframeolderphotolimitcachecivilscaleenterthemetheretouchboundroyalaskedwholesincestock namefaithheartemptyofferscopeownedmightalbumthinkbloodarraymajortrustcanonunioncountvalidstoneStyleLoginhappyoccurleft:freshquitefilmsgradeneedsurbanfightbasishoverauto;route.htmlmixedfinalYour slidetopicbrownalonedrawnsplitreachRightdatesmarchquotegoodsLinksdoubtasyncthumballowchiefyouthnovel10px;serveuntilhandsCheckSpacequeryjamesequaltwice0,000Startpanelsongsroundeightshiftworthpostsleadsweeksavoidthesemilesplanesmartalphaplantmarksratesplaysclaimsalestextsstarswrong</h3>thing.org/multiheardPowerstandtokensolid(thisbringshipsstafftriedcallsfullyfactsagentThis //-->adminegyptEvent15px;Emailtrue"crossspentblogsbox">notedleavechinasizesguest</h4>robotheavytrue,sevengrandcrimesignsawaredancephase><!--en_US&#39;200px_namelatinenjoyajax.ationsmithU.S. holdspeterindianav">chainscorecomesdoingpriorShare1990sromanlistsjapanfallstrialowneragree</h2>abusealertopera"-//WcardshillsteamsPhototruthclean.php?saintmetallouismeantproofbriefrow">genretrucklooksValueFrame.net/-->\n<try {\nvar makescostsplainadultquesttrainlaborhelpscausemagicmotortheir250pxleaststepsCountcouldglasssidesfundshotelawardmouthmovesparisgivesdutchtexasfruitnull,||[];top">\n<!--POST"ocean<br/>floorspeakdepth sizebankscatchchart20px;aligndealswould50px;url="parksmouseMost ...</amongbrainbody none;basedcarrydraftreferpage_home.meterdelaydreamprovejoint</tr>drugs<!-- aprilidealallenexactforthcodeslogicView seemsblankports (200saved_linkgoalsgrantgreekhomesringsrated30px;whoseparse();" Blocklinuxjonespixel\');">);if(-leftdavidhorseFocusraiseboxesTrackement</em>bar">.src=toweralt="cablehenry24px;setupitalysharpminortastewantsthis.resetwheelgirls/css/100%;clubsstuffbiblevotes 1000korea});\r\nbandsqueue= {};80px;cking{\r\n\t\taheadclockirishlike ratiostatsForm"yahoo)[0];Aboutfinds</h1>debugtasksURL =cells})();12px;primetellsturns0x600.jpg"spainbeachtaxesmicroangel--></giftssteve-linkbody.});\n\tmount (199FAQ</rogerfrankClass28px;feeds<h1><scotttests22px;drink) || lewisshall#039; for lovedwaste00px;ja:c\x02simon<fontreplymeetsuntercheaptightBrand) != dressclipsroomsonkeymobilmain.Name platefunnytreescom/"1.jpgwmodeparamSTARTleft idden, 201);\n}\nform.viruschairtransworstPagesitionpatch<!--\no-cacfirmstours,000 asiani++){adobe\')[0]id=10both;menu .2.mi.png"kevincoachChildbruce2.jpgURL)+.jpg|suitesliceharry120" sweettr>\r\nname=diegopage swiss-->\n\n#fff;">Log.com"treatsheet) && 14px;sleepntentfiledja:c\x03id="cName"worseshots-box-delta\n&lt;bears:48Z<data-rural</a> spendbakershops= "";php">ction13px;brianhellosize=o=%2F joinmaybe<img img">, fjsimg" ")[0]MTopBType"newlyDanskczechtrailknows</h5>faq">zh-cn10);\n-1");type=bluestrulydavis.js\';>\r\n<!steel you h2>\r\nform jesus100% menu.\r\n\t\r\nwalesrisksumentddingb-likteachgif" vegasdanskeestishqipsuomisobredesdeentretodospuedeaC1osestC!tienehastaotrospartedondenuevohacerformamismomejormundoaquC-dC-assC3loayudafechatodastantomenosdatosotrassitiomuchoahoralugarmayorestoshorastenerantesfotosestaspaC-snuevasaludforosmedioquienmesespoderchileserC!vecesdecirjosC)estarventagrupohechoellostengoamigocosasnivelgentemismaairesjuliotemashaciafavorjuniolibrepuntobuenoautorabrilbuenatextomarzosaberlistaluegocC3moenerojuegoperC:haberestoynuncamujervalorfueralibrogustaigualvotoscasosguC-apuedosomosavisousteddebennochebuscafaltaeurosseriedichocursoclavecasasleC3nplazolargoobrasvistaapoyojuntotratavistocrearcampohemoscincocargopisosordenhacenC!readiscopedrocercapuedapapelmenorC:tilclarojorgecalleponertardenadiemarcasigueellassiglocochemotosmadreclaserestoniC1oquedapasarbancohijosviajepabloC)stevienereinodejarfondocanalnorteletracausatomarmanoslunesautosvillavendopesartipostengamarcollevapadreunidovamoszonasambosbandamariaabusomuchasubirriojavivirgradochicaallC-jovendichaestantalessalirsuelopesosfinesllamabuscoC)stalleganegroplazahumorpagarjuntadobleislasbolsabaC1ohablaluchaC\x01readicenjugarnotasvalleallC!cargadolorabajoestC)gustomentemariofirmacostofichaplatahogarartesleyesaquelmuseobasespocosmitadcielochicomiedoganarsantoetapadebesplayaredessietecortecoreadudasdeseoviejodeseaaguas&quot;domaincommonstatuseventsmastersystemactionbannerremovescrollupdateglobalmediumfilternumberchangeresultpublicscreenchoosenormaltravelissuessourcetargetspringmodulemobileswitchphotosborderregionitselfsocialactivecolumnrecordfollowtitle>eitherlengthfamilyfriendlayoutauthorcreatereviewsummerserverplayedplayerexpandpolicyformatdoublepointsseriespersonlivingdesignmonthsforcesuniqueweightpeopleenergynaturesearchfigurehavingcustomoffsetletterwindowsubmitrendergroupsuploadhealthmethodvideosschoolfutureshadowdebatevaluesObjectothersrightsleaguechromesimplenoticesharedendingseasonreportonlinesquarebuttonimagesenablemovinglatestwinterFranceperiodstrongrepeatLondondetailformeddemandsecurepassedtoggleplacesdevicestaticcitiesstreamyellowattackstreetflighthiddeninfo">openedusefulvalleycausesleadersecretseconddamagesportsexceptratingsignedthingseffectfieldsstatesofficevisualeditorvolumeReportmuseummoviesparentaccessmostlymother" id="marketgroundchancesurveybeforesymbolmomentspeechmotioninsidematterCenterobjectexistsmiddleEuropegrowthlegacymannerenoughcareeransweroriginportalclientselectrandomclosedtopicscomingfatheroptionsimplyraisedescapechosenchurchdefinereasoncorneroutputmemoryiframepolicemodelsNumberduringoffersstyleskilledlistedcalledsilvermargindeletebetterbrowselimitsGlobalsinglewidgetcenterbudgetnowrapcreditclaimsenginesafetychoicespirit-stylespreadmakingneededrussiapleaseextentScriptbrokenallowschargedividefactormember-basedtheoryconfigaroundworkedhelpedChurchimpactshouldalwayslogo" bottomlist">){var prefixorangeHeader.push(couplegardenbridgelaunchReviewtakingvisionlittledatingButtonbeautythemesforgotSearchanchoralmostloadedChangereturnstringreloadMobileincomesupplySourceordersviewed&nbsp;courseAbout island<html cookiename="amazonmodernadvicein</a>: The dialoghousesBEGIN MexicostartscentreheightaddingIslandassetsEmpireSchooleffortdirectnearlymanualSelect.\n\nOnejoinedmenu">PhilipawardshandleimportOfficeregardskillsnationSportsdegreeweekly (e.g.behinddoctorloggedunited</b></beginsplantsassistartistissued300px|canadaagencyschemeremainBrazilsamplelogo">beyond-scaleacceptservedmarineFootercamera</h1>\n_form"leavesstress" />\r\n.gif" onloadloaderOxfordsistersurvivlistenfemaleDesignsize="appealtext">levelsthankshigherforcedanimalanyoneAfricaagreedrecentPeople<br />wonderpricesturned|| {};main">inlinesundaywrap">failedcensusminutebeaconquotes150px|estateremoteemail"linkedright;signalformal1.htmlsignupprincefloat:.png" forum.AccesspaperssoundsextendHeightsliderUTF-8"&amp; Before. WithstudioownersmanageprofitjQueryannualparamsboughtfamousgooglelongeri++) {israelsayingdecidehome">headerensurebranchpiecesblock;statedtop"><racingresize--&gt;pacitysexualbureau.jpg" 10,000obtaintitlesamount, Inc.comedymenu" lyricstoday.indeedcounty_logo.FamilylookedMarketlse ifPlayerturkey);var forestgivingerrorsDomain}else{insertBlog</footerlogin.fasteragents<body 10px 0pragmafridayjuniordollarplacedcoversplugin5,000 page">boston.test(avatartested_countforumsschemaindex,filledsharesreaderalert(appearSubmitline">body">\n* TheThoughseeingjerseyNews</verifyexpertinjurywidth=CookieSTART across_imagethreadnativepocketbox">\nSystem DavidcancertablesprovedApril reallydriveritem">more">boardscolorscampusfirst || [];media.guitarfinishwidth:showedOther .php" assumelayerswilsonstoresreliefswedenCustomeasily your String\n\nWhiltaylorclear:resortfrenchthough") + "<body>buyingbrandsMembername">oppingsector5px;">vspacepostermajor coffeemartinmaturehappen</nav>kansaslink">Images=falsewhile hspace0&amp; \n\nIn powerPolski-colorjordanBottomStart -count2.htmlnews">01.jpgOnline-rightmillerseniorISBN 00,000 guidesvalue)ectionrepair.xml" rights.html-blockregExp:hoverwithinvirginphones</tr>\rusing \n\tvar >\');\n\t</td>\n</tr>\nbahasabrasilgalegomagyarpolskisrpskiX1X/Y\bd8-f\x16\x07g.\0d=\x13g9\x01i+\x14d?!f\x01/d8-e\x1b=f\b\x11d;,d8\0d8*e\x05,e\x0f8g.!g\x10\x06h.:e\x1d\x1be\x0f/d;%f\x1c\re\n!f\x176i\x174d8*d::d:\'e\x13\x01h\x07*e71d<\x01d8\x1af\x1f%g\x1c\ve7%d=\x1ch\x01\x14g3;f2!f\x1c\tg=\x11g+\x19f\t\0f\x1c\th/\x04h.:d8-e?\x03f\x16\x07g+ g\x14(f\b7i&\x16i!5d=\x1ch\0\x05f\n\0f\x1c/i\x17.i"\x18g\x1b8e\x053d8\vh==f\x10\x1cg4"d=?g\x14(h=/d;6e\x1c(g:?d8;i"\x18h5\x04f\x16\x19h\'\x06i"\x11e\x1b\x1ee$\rf3(e\x06\fg=\x11g;\x1cf\x146h\x17\x0fe\x06\x05e.9f\x0e(h\r\x10e8\x02e\x1c:f6\bf\x01/g):i\x174e\x0f\x11e8\x03d;\0d9\be%=e\x0f\vg\x14\x1ff4;e\x1b>g\t\x07e\x0f\x11e1\x15e&\x02f\x1e\x1cf\t\vf\x1c:f\x160i\x17;f\x1c\0f\x160f\x169e<\x0fe\f\x17d:,f\x0f\x10d>\x1be\x053d:\x0ef\x1b4e$\x1ah?\x19d8*g3;g;\x1fg\x1f%i\x01\x13f88f\b\x0fe9?e\x11\ne\x056d;\x16e\x0f\x11h!(e.\te\x05(g,,d8\0d<\x1ae\x11\x18h?\x1bh!\fg\x029e\x07;g\t\bf\x1d\x03g\x145e-\x10d8\x16g\x15\fh.>h.!e\x05\rh49f\x15\x19h\x022e\n e\x05%f4;e\n(d;\x16d;,e\x15\x06e\x13\x01e\r\x1ae."g\x0e0e\x1c(d8\nf57e&\x02d=\x15e72g;\x0fg\x15\x19h(\0h/&g;\x06g$>e\f:g\x19;e=\x15f\x1c,g+\x19i\x1c\0h&\x01d;7f <f\x14/f\f\x01e\x1b=i\x19\x05i\x13>f\x0e%e\x1b=e.6e;:h.>f\x1c\ve\x0f\vi\x18\x05h/;f3\x15e>\vd=\rg=.g;\x0ff5\x0ei\0\tf\v)h?\x19f 7e=\x13e\t\re\b\x06g1;f\x0e\x12h!\fe\x1b d8:d:$f\x18\x13f\x1c\0e\x10\x0ei\x1f3d9\x10d8\rh\x03=i\0\x1ah?\x07h!\fd8\x1ag\'\x11f\n\0e\x0f/h\x03=h.>e$\x07e\x10\bd=\x1ce$\'e.6g$>d<\x1ag \x14g)6d8\x13d8\x1ae\x05(i\x03(i!9g\x1b.h?\x19i\x07\fh?\x18f\x18/e<\0e\'\vf\x03\x05e\x065g\x145h\x04\x11f\x16\x07d;6e\x13\x01g\t\fe8.e\n)f\x16\x07e\f\x16h5\x04f:\x10e$\'e-&e-&d9 e\x1c0e\x1d\0f5\x0fh\'\bf\n\x15h5\x04e7%g(\vh&\x01f1\x02f\0\x0ed9\bf\x176e\0\x19e\n\x1fh\x03=d8;h&\x01g\x1b.e\t\rh5\x04h./e\x1f\x0ee8\x02f\x169f3\x15g\x145e=1f\v\x1bh\x01\x18e#0f\x18\x0ed;;d=\x15e\x01%e:7f\x150f\r.g>\x0ee\x1b=f1=h=&d;\vg;\rd=\x06f\x18/d:$f5\x01g\x14\x1fd:\'f\t\0d;%g\x145h/\x1df\x18>g$:d8\0d:\x1be\r\x15d=\rd::e\x11\x18e\b\x06f\x1e\x10e\x1c0e\x1b>f\x17\x05f88e7%e\x057e-&g\x14\x1fg3;e\b\x17g=\x11e\x0f\ve8\x16e-\x10e/\x06g \x01i"\x11i\x01\x13f\x0e\'e\b6e\x1c0e\f:e\x1f:f\x1c,e\x05(e\x1b=g=\x11d8\ni\x07\rh&\x01g,,d:\fe\x16\x1cf,"h?\x1be\x05%e\x0f\vf\x03\x05h?\x19d:\x1bh\0\x03h/\x15e\x0f\x11g\x0e0e\x1f9h.-d;%d8\nf\x14?e:\x1cf\b\x10d8:g\x0e/e"\x03i&\x19f8/e\x10\ff\x176e(1d9\x10e\x0f\x11i\0\x01d8\0e.\x1ae<\0e\x0f\x11d=\x1ce\x13\x01f \x07e\x07\x06f,"h?\x0eh\'#e\x063e\x1c0f\x169d8\0d8\vd;%e\x0f\nh4#d;;f\b\x16h\0\x05e."f\b7d;#h!(g\'/e\b\x06e%3d::f\x150g \x01i\x14\0e\x14.e\x07:g\x0e0g&;g:?e:\x14g\x14(e\b\x17h!(d8\re\x10\fg<\x16h>\x11g;\x1fh.!f\x1f%h/"d8\rh&\x01f\x1c\te\x053f\x1c:f\x1e\x04e>\be$\x1af\x12-f\x14>g;\x04g;\x07f\x14?g-\x16g\x1b4f\x0e%h\x03=e\n\x1bf\x1d%f:\x10f\x19\x02i\x16\x13g\x1c\ve\b0g\x03-i\x17(e\x053i\x14.d8\x13e\f:i\x1d\x1ee88h\v1h/-g\x19>e:&e8\ff\x1c\x1bg>\x0ee%3f/\x14h>\x03g\x1f%h/\x06h\'\x04e.\x1ae;:h..i\x03(i\x17(f\x04\x0fh\'\x01g2>e=)f\x17%f\x1c,f\x0f\x10i+\x18e\x0f\x11h(\0f\x169i\x1d"e\x1f:i\x07\x11e$\x04g\x10\x06f\x1d\x03i\x19\x10e=1g\t\x07i\x136h!\fh?\x18f\x1c\te\b\x06d:+g\t)e\x13\x01g;\x0fh\x10%f7;e\n d8\x13e.6h?\x19g\'\rh/\x1di"\x18h57f\x1d%d8\x1ae\n!e\x05,e\x11\nh.0e=\x15g.\0d;\vh4(i\x07\x0fg\x147d::e=1e\x13\re<\x15g\x14(f\n%e\x11\ni\x03(e\b\x06e?+i\0\x1fe\x12(h/"f\x176e0\x1af3(f\x04\x0fg\x143h/7e-&f !e:\x14h/%e\x0e\x06e\x0f2e\x0f*f\x18/h?\x14e\x1b\x1eh4-d90e\x10\rg\'0d8:d:\x06f\b\x10e\n\x1fh/4f\x18\x0ed>\x1be:\x14e-)e-\x10d8\x13i"\x18g(\ve:\x0fd8\0h\b,f\x1c\x03e\x13!e\x0f*f\x1c\te\x056e.\x03d?\x1df\n$h\0\fd8\x14d;\ne$)g*\x17e\x0f#e\n(f\0\x01g\n6f\0\x01g\t9e\b+h.$d8:e?\x05i!;f\x1b4f\x160e0\x0fh/4f\b\x11e\0\x11d=\x1cd8:e*\x12d=\x13e\f\x05f\v,i\x02#d9\bd8\0f 7e\x1b=e\x06\x05f\x18/e\x10&f 9f\r.g\x145h\'\x06e-&i\x19"e\x057f\x1c\th?\x07g(\vg\x141d:\x0ed::f\t\re\x07:f\x1d%d8\rh?\x07f-#e\x1c(f\x18\x0ef\x18\x1ff\x15\x05d:\ve\x053g3;f \x07i"\x18e\x15\x06e\n!h>\x13e\x05%d8\0g\x1b4e\x1f:g!\0f\x15\x19e-&d:\x06h\'#e;:g-\x11g;\x13f\x1e\x1ce\x05(g\x10\x03i\0\x1ag\x1f%h.!e\b\x12e/9d:\x0eh\t:f\x1c/g\x1b8e\x06\fe\x0f\x11g\x14\x1fg\x1c\x1fg\x1a\x04e;:g+\vg-\tg:\'g1;e\x1e\vg;\x0fi*\fe.\x1eg\x0e0e\b6d=\x1cf\x1d%h\x07*f \x07g->d;%d8\ve\x0e\x1fe\b\x1bf\x17 f3\x15e\x056d8-e\0\vd::d8\0e\b\x07f\f\x07e\r\x17e\x053i\x17-i\x1b\x06e\x1b"g,,d8\te\x053f3(e\x1b f-$g\x05\'g\t\x07f71e\x1c3e\x15\x06d8\x1ae9?e7\x1ef\x17%f\x1c\x1fi+\x18g:\'f\x1c\0h?\x11g;<e\x10\bh!(g$:d8\x13h>\x11h!\fd8:d:$i\0\x1ah/\x04d;7h\'\te>\x17g2>e\r\x0ee.6e:-e.\ff\b\x10f\x04\x1fh\'\te.\th#\x05e>\x17e\b0i\x02.d;6e\b6e:&i#\x1fe\x13\x01h\x19=g\x046h=,h==f\n%d;7h.0h\0\x05f\x169f!\bh!\ff\x14?d::f0\x11g\x14(e\x13\x01d8\x1ch%?f\x0f\x10e\x07:i\x05\x12e:\x17g\x046e\x10\x0ed;\x18f,>g\x03-g\x029d;%e\t\re.\fe\x05(e\x0f\x11e8\x16h.>g=.i"\x06e/<e7%d8\x1ae\f;i\x19"g\x1c\vg\x1c\vg;\x0fe\x058e\x0e\x1fe\x1b e93e\x0f0e\x10\x04g\'\re"\x1ee\n f\x1d\x10f\x16\x19f\x160e"\x1ed9\ve\x10\x0eh\x01\fd8\x1af\x15\bf\x1e\x1cd;\ne94h.:f\x16\x07f\b\x11e\x1b=e\x11\nh/\tg\t\bd8;d?.f\x149e\x0f\x02d8\x0ef\t\x13e\r0e?+d9\x10f\x1c:f"0h\'\x02g\x029e-\x18e\x1c(g2>g%\x1eh\x0e7e>\x17e\b)g\x14(g;\'g;-d= d;,h?\x19d9\bf(!e<\x0fh/-h(\0h\x03=e$\x1fi\x1b\x05h\x19\x0ef\x13\rd=\x1ci#\x0ef <d8\0h57g\'\x11e-&d=\x13h\x022g\x1f-d?!f\x1d!d;6f2;g\x16\x17h?\x10e\n(d:\'d8\x1ad<\x1ah..e/<h\b*e\x05\bg\x14\x1fh\x01\x14g\x1b\x1fe\x0f/f\x18/e\x15\x0fi!\fg;\x13f\x1e\x04d=\x1cg\x14(h0\x03f\x1f%h3\x07f\x16\x19h\x07*e\n(h4\x1fh4#e\x06\x1cd8\x1ah.?i\x17.e.\x1ef\x16=f\x0e%e\x0f\x17h.(h.:i\x02#d8*e\x0f\ri&\be\n e<:e%3f\0\'h\f\x03e\x1b4f\x1c\re\v\x19d<\x11i\x172d;\nf\x17%e."f\x1c\rh\'\0g\x1c\ve\x0f\x02e\n g\x1a\x04h/\x1dd8\0g\x029d?\x1dh/\x01e\x1b>d9&f\x1c\tf\x15\bf5\vh/\x15g\';e\n(f\t\rh\x03=e\x063e.\x1ah\x02!g%(d8\rf\x16-i\x1c\0f1\x02d8\re>\x17e\n\x1ef3\x15d9\vi\x174i\x07\x07g\x14(h\x10%i\x14\0f\n\x15h/\tg\x1b.f \x07g\b1f\x03\x05f\x11\x04e=1f\x1c\td:\x1bh$\x07h#=f\x16\x07e-&f\x1c:d<\x1af\x150e-\x17h#\x05d?.h4-g\t)e\x06\x1cf\x1d\x11e\x05(i\x1d"g2>e\x13\x01e\x056e.\x1ed:\vf\x03\x05f04e93f\x0f\x10g$:d8\ne8\x02h0"h0"f\x19.i\0\x1af\x15\x19e8\bd8\nd< g1;e\b+f-\ff\x1b2f\v%f\x1c\te\b\x1bf\x160i\x05\rd;6e\x0f*h&\x01f\x176d;#h3\x07h(\nh>>e\b0d::g\x14\x1fh."i\x18\x05h\0\x01e8\be1\x15g$:e?\x03g\x10\x06h44e-\x10g62g+\x19d8;i!\fh\x07*g\x046g:\'e\b+g.\0e\r\x15f\x149i\x1d)i\x02#d:\x1bf\x1d%h/4f\t\x13e<\0d;#g \x01e\b i\x19$h/\x01e\b8h\n\x02g\x1b.i\x07\rg\x029f,!f\x158e$\x1ae0\x11h\'\x04e\b\x12h5\x04i\x07\x11f\t>e\b0d;%e\x10\x0ee$\'e\x05(d8;i!5f\x1c\0d=3e\x1b\x1eg-\x14e$)d8\vd?\x1di\x1a\x1cg\x0e0d;#f#\0f\x1f%f\n\x15g%(e0\x0ff\x176f2\x12f\x1c\tf-#e88g\x14\x1ah\x073d;#g\x10\x06g\x1b.e=\x15e\x05,e<\0e$\re\b6i\x07\x11h\x1e\re98g&\x0fg\t\bf\x1c,e="f\b\x10e\x07\x06e$\x07h!\ff\x03\x05e\x1b\x1ee\b0f\0\x1df\x033f\0\x0ef 7e\r\x0fh..h.$h/\x01f\x1c\0e%=d:\'g\x14\x1ff\f\tg\x05\'f\x1c\rh#\x05e9?d8\x1ce\n(f<+i\x07\x07h4-f\x160f\t\vg;\x04e\x1b>i\x1d"f\x1d?e\x0f\x02h\0\x03f\x14?f2;e.9f\x18\x13e$)e\x1c0e\n*e\n\x1bd::d;,e\r\x07g:\'i\0\x1fe:&d::g\t)h0\x03f\x154f5\x01h!\fi\0 f\b\x10f\x16\x07e-\x17i\x1f)e\x1b=h48f\x18\x13e<\0e1\x15g\x1b8i\x17\x1ch!(g\x0e0e=1h\'\x06e&\x02f-$g>\x0ee.9e$\'e0\x0ff\n%i\x01\x13f\x1d!f,>e?\x03f\x03\x05h.8e$\x1af3\x15h\'\x04e.6e1\x05d9&e:\x17h?\x1ef\x0e%g+\ve\r3d8>f\n%f\n\0e7\'e%%h?\x10g\x19;e\x05%d;%f\x1d%g\x10\x06h.:d:\vd;6h\x07*g\x141d8-e\r\x0ee\n\x1ee\x05,e&\be&\bg\x1c\x1ff-#d8\ri\x14\x19e\x05(f\x16\x07e\x10\be\x10\fd;7e\0<e\b+d::g\x1b\x11g\x1d#e\x057d=\x13d8\x16g:*e\x1b"i\x18\x1fe\b\x1bd8\x1af\t?f\v\x05e"\x1ei\x15?f\x1c\td::d?\x1df\f\x01e\x15\x06e.6g;4d?.e\x0f0f9>e7&e\x0f3h\x02!d;=g-\x14f!\be.\x1ei\x19\x05g\x145d?!g;\x0fg\x10\x06g\x14\x1fe\x11=e.#d< d;;e\n!f-#e<\x0fg\t9h\t2d8\vf\x1d%e\r\x0fd<\x1ae\x0f*h\x03=e=\x13g\x046i\x07\rf\x160e\x05\'e.9f\f\x07e/<h?\x10h!\ff\x17%e?\x17h3#e.6h6\x05h?\x07e\x1c\x1fe\x1c0f5\x19f1\x1ff\x14/d;\x18f\x0e(e\x07:g+\x19i\x15?f\x1d-e7\x1ef\t\'h!\fe\b6i\0 d9\vd8\0f\x0e(e9?g\x0e0e\x1c:f\x0f\x0fh?0e\x0f\x18e\f\x16d< g;\x1ff-\ff\t\vd?\x1di\x19)h/>g(\ve\f;g\x16\x17g;\x0fh?\x07h?\x07e\x0e;d9\ve\t\rf\x146e\x05%e94e:&f\x1d\x02e?\x17g>\x0ed8=f\x1c\0i+\x18g\x19;i\x19\x06f\x1c*f\x1d%e\n e7%e\x05\rh4#f\x15\x19g(\vg\t\be\x1d\x17h:+d=\x13i\x07\re:\x06e\x07:e\x14.f\b\x10f\x1c,e="e<\x0fe\x1c\x1fh1\x06e\x07:e\x039d8\x1cf\x169i\x02.g.1e\r\x17d:,f1\x02h\x01\fe\x0f\x16e>\x17h\x01\fd=\rg\x1b8d?!i!5i\x1d"e\b\x06i\x12\x1fg=\x11i!5g!.e.\x1ae\x1b>d>\vg=\x11e\x1d\0g\'/f\x1e\x01i\x14\x19h//g\x1b.g\x1a\x04e.\x1dh4\x1df\x1c:e\x053i#\x0ei\x19)f\x0e\bf\x1d\x03g\x17\x05f/\x12e. g\t)i\x19$d:\x06h)\x15h+\x16g\x16>g\x17\x05e\x0f\nf\x176f1\x02h4-g+\x19g\x029e\x04?g+%f/\x0fe$)d8-e$.h.$h/\x06f/\x0fd8*e$)f4%e-\x17d=\x13e\x0f0g\x01#g;4f\n$f\x1c,i!5d8*f\0\'e.\x18f\x169e88h\'\x01g\x1b8f\x1c:f\b\x18g\x15%e:\x14e=\x13e>\ve8\bf\x169d>?f !e\x1b-h\x02!e8\x02f\b?e1\vf \x0fg\x1b.e\x11\x18e7%e/<h\x074g*\x01g\x046i\x01\x13e\x057f\x1c,g=\x11g;\x13e\x10\bf!#f!\be\n3e\n(e\x0f&e$\x16g>\x0ee\x05\x03e<\x15h57f\x149e\x0f\x18g,,e\x1b\x1bd<\x1ah.!h**f\x18\x0ei\x1a\x10g\'\x01e.\x1de.\x1dh\'\x04h\f\x03f6\bh49e\x051e\x10\fe?\x18h.0d=\x13g3;e8&f\x1d%e\x10\re-\x17g\x19<h!(e<\0f\x14>e\n g\x1b\x1fe\x0f\x17e\b0d:\ff\t\ve$\'i\x07\x0ff\b\x10d::f\x150i\x07\x0fe\x051d:+e\f:e\x1f\x1fe%3e-)e\x0e\x1fe\b\x19f\t\0e\x1c(g;\x13f\x1d\x1fi\0\x1ad?!h6\x05g:\'i\x05\rg=.e=\x13f\x176d<\x18g\'\0f\0\'f\x04\x1ff\b?d:\'i\x01\nf\b2e\x07:e\x0f#f\x0f\x10d:$e01d8\x1ad?\x1de\x01%g(\ve:&e\x0f\x02f\x150d:\vd8\x1af\x154d8*e11d8\x1cf\x03\x05f\x04\x1fg\t9f.\ne\b\x06i!\x1ef\x10\x1ce0\ve1\x1ed:\x0ei\x17(f\b7h4"e\n!e#0i\x1f3e\x0f\ne\x056h4"g;\x0fe\x1d\x1af\f\x01e92i\x03(f\b\x10g+\ve\b)g\x1b\nh\0\x03h\x19\x11f\b\x10i\x03=e\f\x05h#\x05g\x14(f\b6f/\x14h5\x1bf\x16\x07f\x18\x0ef\v\x1be\x15\x06e.\ff\x154g\x1c\x1ff\x18/g\x1c<g\x1d\x1bd<\x19d<4e(\x01f\x1c\x1bi"\x06e\x1f\x1fe\r+g\x14\x1fd<\x18f\x03 h+\x16e#\x07e\x05,e\x051h\t/e%=e\x05\x05e\b\x06g,&e\x10\bi\x19\x04d;6g\t9g\x029d8\re\x0f/h\v1f\x16\x07h5\x04d:\'f 9f\x1c,f\x18\x0ef\x18>e/\x06g"<e\x05,d<\x17f0\x11f\x17\x0ff\x1b4e\n d:+e\x0f\x17e\x10\fe-&e\x10/e\n(i\0\x02e\x10\be\x0e\x1ff\x1d%i\x17.g-\x14f\x1c,f\x16\x07g>\x0ei#\x1fg;?h\t2g(3e.\x1ag;\bd:\x0eg\x14\x1fg\t)d>\x1bf1\x02f\x10\x1cg\v\x10e\n\x1bi\x07\x0fd8%i\x07\rf08h?\x1ce\x06\x19g\x1c\x1ff\x1c\ti\x19\x10g+\x1ed:\te/9h1!h49g\x14(d8\re%=g;\x1de/9e\r\x01e\b\x06d?\x03h?\x1bg\x029h/\x04e=1i\x1f3d<\x18e\n?d8\re0\x11f,#h5\x0fe96d8\x14f\x1c\tg\x029f\x169e\x10\x11e\x05(f\x160d?!g\x14(h.>f\x16=e="h1!h5\x04f <g*\x01g 4i\x1a\x0fg\x1d\0i\x07\re$\'d:\x0ef\x18/f/\x15d8\x1af\x19:h\x03=e\f\x16e7%e.\fg>\x0ee\x15\x06e\x1f\x0eg;\x1fd8\0e\x07:g\t\bf\t\x13i\0 g\x14"e\x13\x01f&\x02e\x065g\x14(d:\x0ed?\x1dg\x15\x19e\x1b g4 d8-e\x1c\ve-\x18e\x02(h44e\x1b>f\x1c\0f\x04\x1bi\x15?f\x1c\x1fe\x0f#d;7g\x10\x06h4"e\x1f:e\x1c0e.\tf\x0e\x12f-&f1\ti\x07\fi\x1d"e\b\x1be;:e$)g):i&\x16e\x05\be.\fe\x16\x04i)1e\n(d8\vi\x1d"d8\re\x06\rh/\x1ad?!f\x04\x0fd9\ti\x183e\x05\th\v1e\x1b=f<\x02d:.e\x06\x1bd:\vg\x0e)e.6g>$d<\x17e\x06\x1cf0\x11e\r3e\x0f/e\x10\rg(1e.6e\x057e\n(g\x14;f\x033e\b0f3(f\x18\x0ee0\x0fe-&f\0\'h\x03=h\0\x03g \x14g!,d;6h\'\x02g\x1c\vf8\x05f%\x1af\x10\x1eg,\x11i&\x16i \x01i;\x04i\x07\x11i\0\x02g\x14(f1\x1fh\v\x0fg\x1c\x1fe.\x1ed8;g.!i\x186f.5h(;e\x06\ng?;h/\x11f\x1d\x03e\b)e\x01\x1ae%=d<<d9\x0ei\0\x1ah./f\x16=e7%g\v\0f\x05\vd9\x1fh.8g\x0e/d?\x1de\x1f9e\x05;f&\x02e?5e$\'e\x1e\vf\x1c:g%(g\x10\x06h\'#e\f?e\x10\rcuandoenviarmadridbuscariniciotiempoporquecuentaestadopuedenjuegoscontraestC!nnombretienenperfilmaneraamigosciudadcentroaunquepuedesdentroprimerpreciosegC:nbuenosvolverpuntossemanahabC-aagostonuevosunidoscarlosequiponiC1osmuchosalgunacorreoimagenpartirarribamarC-ahombreempleoverdadcambiomuchasfueronpasadolC-neaparecenuevascursosestabaquierolibroscuantoaccesomiguelvarioscuatrotienesgruposserC!neuropamediosfrenteacercademC!sofertacochesmodeloitalialetrasalgC:ncompracualesexistecuerposiendoprensallegarviajesdineromurciapodrC!puestodiariopuebloquieremanuelpropiocrisisciertoseguromuertefuentecerrargrandeefectopartesmedidapropiaofrecetierrae-mailvariasformasfuturoobjetoseguirriesgonormasmismosC:nicocaminositiosrazC3ndebidopruebatoledotenC-ajesC:sesperococinaorigentiendacientocC!dizhablarserC-alatinafuerzaestiloguerraentrarC)xitolC3pezagendavC-deoevitarpaginametrosjavierpadresfC!cilcabezaC!reassalidaenvC-ojapC3nabusosbienestextosllevarpuedanfuertecomC:nclaseshumanotenidobilbaounidadestC!seditarcreadoP4P;Q\x0fQ\x07Q\x02P>P:P0P:P8P;P8Q\rQ\x02P>P2Q\x01P5P5P3P>P?Q\0P8Q\x02P0P:P5Q\tP5Q\x03P6P5P\x1aP0P:P1P5P7P1Q\vP;P>P=P8P\x12Q\x01P5P?P>P4P-Q\x02P>Q\x02P>P<Q\x07P5P<P=P5Q\x02P;P5Q\x02Q\0P0P7P>P=P0P3P4P5P<P=P5P\x14P;Q\x0fP\x1fQ\0P8P=P0Q\x01P=P8Q\x05Q\x02P5P<P:Q\x02P>P3P>P4P2P>Q\x02Q\x02P0P<P!P(P\x10P<P0Q\x0fP\'Q\x02P>P2P0Q\x01P2P0P<P5P<Q\x03P"P0P:P4P2P0P=P0P<Q\rQ\x02P8Q\rQ\x02Q\x03P\x12P0P<Q\x02P5Q\x05P?Q\0P>Q\x02Q\x03Q\x02P=P0P4P4P=Q\x0fP\x12P>Q\x02Q\x02Q\0P8P=P5P9P\x12P0Q\x01P=P8P<Q\x01P0P<Q\x02P>Q\x02Q\0Q\x03P1P\x1eP=P8P<P8Q\0P=P5P5P\x1eP\x1eP\x1eP;P8Q\x06Q\rQ\x02P0P\x1eP=P0P=P5P<P4P>P<P<P>P9P4P2P5P>P=P>Q\x01Q\x03P4`$\x15`%\x07`$9`%\b`$\x15`%\0`$8`%\x07`$\x15`$>`$\x15`%\v`$\x14`$0`$*`$0`$(`%\x07`$\x0f`$\x15`$\x15`$?`$-`%\0`$\x07`$8`$\x15`$0`$$`%\v`$9`%\v`$\x06`$*`$9`%\0`$/`$9`$/`$>`$$`$\x15`$%`$>jagran`$\x06`$\x1c`$\x1c`%\v`$\x05`$,`$&`%\v`$\x17`$\b`$\x1c`$>`$\x17`$\x0f`$9`$.`$\x07`$(`$5`$9`$/`%\x07`$%`%\x07`$%`%\0`$\x18`$0`$\x1c`$,`$&`%\0`$\x15`$\b`$\x1c`%\0`$5`%\x07`$(`$\b`$(`$\x0f`$9`$0`$\t`$8`$.`%\x07`$\x15`$.`$5`%\v`$2`%\x07`$8`$,`$.`$\b`$&`%\x07`$\x13`$0`$\x06`$.`$,`$8`$-`$0`$,`$(`$\x1a`$2`$.`$(`$\x06`$\x17`$8`%\0`$2`%\0X9Y\x04Y\tX%Y\x04Y\tY\x07X0X\'X"X.X1X9X/X/X\'Y\x04Y\tY\x07X0Y\x07X5Y\bX1X:Y\nX1Y\x03X\'Y\x06Y\bY\x04X\'X(Y\nY\x06X9X1X6X0Y\x04Y\x03Y\x07Y\x06X\'Y\nY\bY\x05Y\x02X\'Y\x04X9Y\x04Y\nX\'Y\x06X\'Y\x04Y\x03Y\x06X-X*Y\tY\x02X(Y\x04Y\bX-X)X\'X.X1Y\x01Y\x02X7X9X(X/X1Y\x03Y\x06X%X0X\'Y\x03Y\x05X\'X\'X-X/X%Y\x04X\'Y\x01Y\nY\x07X(X9X6Y\x03Y\nY\x01X(X-X+Y\bY\x05Y\x06Y\bY\x07Y\bX#Y\x06X\'X,X/X\'Y\x04Y\x07X\'X3Y\x04Y\x05X9Y\x06X/Y\x04Y\nX3X9X(X1X5Y\x04Y\tY\x05Y\x06X0X(Y\x07X\'X#Y\x06Y\x07Y\x05X+Y\x04Y\x03Y\x06X*X\'Y\x04X\'X-Y\nX+Y\x05X5X1X4X1X-X-Y\bY\x04Y\bY\x01Y\nX\'X0X\'Y\x04Y\x03Y\x04Y\x05X1X)X\'Y\x06X*X\'Y\x04Y\x01X#X(Y\bX.X\'X5X#Y\x06X*X\'Y\x06Y\x07X\'Y\x04Y\nX9X6Y\bY\bY\x02X/X\'X(Y\x06X.Y\nX1X(Y\x06X*Y\x04Y\x03Y\x05X4X\'X!Y\bY\x07Y\nX\'X(Y\bY\x02X5X5Y\bY\x05X\'X1Y\x02Y\x05X#X-X/Y\x06X-Y\x06X9X/Y\x05X1X#Y\nX\'X-X)Y\x03X*X(X/Y\bY\x06Y\nX,X(Y\x05Y\x06Y\x07X*X-X*X,Y\x07X)X3Y\x06X)Y\nX*Y\x05Y\x03X1X)X:X2X)Y\x06Y\x01X3X(Y\nX*Y\x04Y\x04Y\x07Y\x04Y\x06X\'X*Y\x04Y\x03Y\x02Y\x04X(Y\x04Y\x05X\'X9Y\x06Y\x07X#Y\bY\x04X4Y\nX!Y\x06Y\bX1X#Y\x05X\'Y\x01Y\nY\x03X(Y\x03Y\x04X0X\'X*X1X*X(X(X#Y\x06Y\x07Y\x05X3X\'Y\x06Y\x03X(Y\nX9Y\x01Y\x02X/X-X3Y\x06Y\x04Y\x07Y\x05X4X9X1X#Y\x07Y\x04X4Y\x07X1Y\x02X7X1X7Y\x04X(profileservicedefaulthimselfdetailscontentsupportstartedmessagesuccessfashion<title>countryaccountcreatedstoriesresultsrunningprocesswritingobjectsvisiblewelcomearticleunknownnetworkcompanydynamicbrowserprivacyproblemServicerespectdisplayrequestreservewebsitehistoryfriendsoptionsworkingversionmillionchannelwindow.addressvisitedweathercorrectproductedirectforwardyou canremovedsubjectcontrolarchivecurrentreadinglibrarylimitedmanagerfurthersummarymachineminutesprivatecontextprogramsocietynumberswrittenenabledtriggersourcesloadingelementpartnerfinallyperfectmeaningsystemskeepingculture&quot;,journalprojectsurfaces&quot;expiresreviewsbalanceEnglishContentthroughPlease opinioncontactaverageprimaryvillageSpanishgallerydeclinemeetingmissionpopularqualitymeasuregeneralspeciessessionsectionwriterscounterinitialreportsfiguresmembersholdingdisputeearlierexpressdigitalpictureAnothermarriedtrafficleadingchangedcentralvictoryimages/reasonsstudiesfeaturelistingmust beschoolsVersionusuallyepisodeplayinggrowingobviousoverlaypresentactions</ul>\r\nwrapperalreadycertainrealitystorageanotherdesktopofferedpatternunusualDigitalcapitalWebsitefailureconnectreducedAndroiddecadesregular &amp; animalsreleaseAutomatgettingmethodsnothingPopularcaptionletterscapturesciencelicensechangesEngland=1&amp;History = new CentralupdatedSpecialNetworkrequirecommentwarningCollegetoolbarremainsbecauseelectedDeutschfinanceworkersquicklybetweenexactlysettingdiseaseSocietyweaponsexhibit&lt;!--Controlclassescoveredoutlineattacksdevices(windowpurposetitle="Mobile killingshowingItaliandroppedheavilyeffects-1\']);\nconfirmCurrentadvancesharingopeningdrawingbillionorderedGermanyrelated</form>includewhetherdefinedSciencecatalogArticlebuttonslargestuniformjourneysidebarChicagoholidayGeneralpassage,&quot;animatefeelingarrivedpassingnaturalroughly.\n\nThe but notdensityBritainChineselack oftributeIreland" data-factorsreceivethat isLibraryhusbandin factaffairsCharlesradicalbroughtfindinglanding:lang="return leadersplannedpremiumpackageAmericaEdition]&quot;Messageneed tovalue="complexlookingstationbelievesmaller-mobilerecordswant tokind ofFirefoxyou aresimilarstudiedmaximumheadingrapidlyclimatekingdomemergedamountsfoundedpioneerformuladynastyhow to SupportrevenueeconomyResultsbrothersoldierlargelycalling.&quot;AccountEdward segmentRobert effortsPacificlearnedup withheight:we haveAngelesnations_searchappliedacquiremassivegranted: falsetreatedbiggestbenefitdrivingStudiesminimumperhapsmorningsellingis usedreversevariant role="missingachievepromotestudentsomeoneextremerestorebottom:evolvedall thesitemapenglishway to AugustsymbolsCompanymattersmusicalagainstserving})();\r\npaymenttroubleconceptcompareparentsplayersregionsmonitor \'\'The winningexploreadaptedGalleryproduceabilityenhancecareers). The collectSearch ancientexistedfooter handlerprintedconsoleEasternexportswindowsChannelillegalneutralsuggest_headersigning.html">settledwesterncausing-webkitclaimedJusticechaptervictimsThomas mozillapromisepartieseditionoutside:false,hundredOlympic_buttonauthorsreachedchronicdemandssecondsprotectadoptedprepareneithergreatlygreateroverallimprovecommandspecialsearch.worshipfundingthoughthighestinsteadutilityquarterCulturetestingclearlyexposedBrowserliberal} catchProjectexamplehide();FloridaanswersallowedEmperordefenseseriousfreedomSeveral-buttonFurtherout of != nulltrainedDenmarkvoid(0)/all.jspreventRequestStephen\n\nWhen observe</h2>\r\nModern provide" alt="borders.\n\nFor \n\nMany artistspoweredperformfictiontype ofmedicalticketsopposedCouncilwitnessjusticeGeorge Belgium...</a>twitternotablywaitingwarfare Other rankingphrasesmentionsurvivescholar</p>\r\n Countryignoredloss ofjust asGeorgiastrange<head><stopped1\']);\r\nislandsnotableborder:list ofcarried100,000</h3>\n severalbecomesselect wedding00.htmlmonarchoff theteacherhighly biologylife ofor evenrise of&raquo;plusonehunting(thoughDouglasjoiningcirclesFor theAncientVietnamvehiclesuch ascrystalvalue =Windowsenjoyeda smallassumed<a id="foreign All rihow theDisplayretiredhoweverhidden;battlesseekingcabinetwas notlook atconductget theJanuaryhappensturninga:hoverOnline French lackingtypicalextractenemieseven ifgeneratdecidedare not/searchbeliefs-image:locatedstatic.login">convertviolententeredfirst">circuitFinlandchemistshe was10px;">as suchdivided</span>will beline ofa greatmystery/index.fallingdue to railwaycollegemonsterdescentit withnuclearJewish protestBritishflowerspredictreformsbutton who waslectureinstantsuicidegenericperiodsmarketsSocial fishingcombinegraphicwinners<br /><by the NaturalPrivacycookiesoutcomeresolveSwedishbrieflyPersianso muchCenturydepictscolumnshousingscriptsnext tobearingmappingrevisedjQuery(-width:title">tooltipSectiondesignsTurkishyounger.match(})();\n\nburningoperatedegreessource=Richardcloselyplasticentries</tr>\r\ncolor:#ul id="possessrollingphysicsfailingexecutecontestlink toDefault<br />\n: true,chartertourismclassicproceedexplain</h1>\r\nonline.?xml vehelpingdiamonduse theairlineend -->).attr(readershosting#ffffffrealizeVincentsignals src="/ProductdespitediversetellingPublic held inJoseph theatreaffects<style>a largedoesn\'tlater, ElementfaviconcreatorHungaryAirportsee theso thatMichaelSystemsPrograms, and width=e&quot;tradingleft">\npersonsGolden Affairsgrammarformingdestroyidea ofcase ofoldest this is.src = cartoonregistrCommonsMuslimsWhat isin manymarkingrevealsIndeed,equally/show_aoutdoorescape(Austriageneticsystem,In the sittingHe alsoIslandsAcademy\n\t\t<!--Daniel bindingblock">imposedutilizeAbraham(except{width:putting).html(|| [];\nDATA[ *kitchenmountedactual dialectmainly _blank\'installexpertsif(typeIt also&copy; ">Termsborn inOptionseasterntalkingconcerngained ongoingjustifycriticsfactoryits ownassaultinvitedlastinghis ownhref="/" rel="developconcertdiagramdollarsclusterphp?id=alcohol);})();using a><span>vesselsrevivalAddressamateurandroidallegedillnesswalkingcentersqualifymatchesunifiedextinctDefensedied in\n\t<!-- customslinkingLittle Book ofeveningmin.js?are thekontakttoday\'s.html" target=wearingAll Rig;\n})();raising Also, crucialabout">declare-->\n<scfirefoxas muchappliesindex, s, but type = \n\r\n<!--towardsRecordsPrivateForeignPremierchoicesVirtualreturnsCommentPoweredinline;povertychamberLiving volumesAnthonylogin" RelatedEconomyreachescuttinggravitylife inChapter-shadowNotable</td>\r\n returnstadiumwidgetsvaryingtravelsheld bywho arework infacultyangularwho hadairporttown of\n\nSome \'click\'chargeskeywordit willcity of(this);Andrew unique checkedor more300px; return;rsion="pluginswithin herselfStationFederalventurepublishsent totensionactresscome tofingersDuke ofpeople,exploitwhat isharmonya major":"httpin his menu">\nmonthlyofficercouncilgainingeven inSummarydate ofloyaltyfitnessand wasemperorsupremeSecond hearingRussianlongestAlbertalateralset of small">.appenddo withfederalbank ofbeneathDespiteCapitalgrounds), and percentit fromclosingcontainInsteadfifteenas well.yahoo.respondfighterobscurereflectorganic= Math.editingonline paddinga wholeonerroryear ofend of barrierwhen itheader home ofresumedrenamedstrong>heatingretainscloudfrway of March 1knowingin partBetweenlessonsclosestvirtuallinks">crossedEND -->famous awardedLicenseHealth fairly wealthyminimalAfricancompetelabel">singingfarmersBrasil)discussreplaceGregoryfont copursuedappearsmake uproundedboth ofblockedsaw theofficescoloursif(docuwhen heenforcepush(fuAugust UTF-8">Fantasyin mostinjuredUsuallyfarmingclosureobject defenceuse of Medical<body>\nevidentbe usedkeyCodesixteenIslamic#000000entire widely active (typeofone cancolor =speakerextendsPhysicsterrain<tbody>funeralviewingmiddle cricketprophetshifteddoctorsRussell targetcompactalgebrasocial-bulk ofman and</td>\n he left).val()false);logicalbankinghome tonaming Arizonacredits);\n});\nfounderin turnCollinsbefore But thechargedTitle">CaptainspelledgoddessTag -->Adding:but wasRecent patientback in=false&Lincolnwe knowCounterJudaismscript altered\']);\n has theunclearEvent\',both innot all\n\n<!-- placinghard to centersort ofclientsstreetsBernardassertstend tofantasydown inharbourFreedomjewelry/about..searchlegendsis mademodern only ononly toimage" linear painterand notrarely acronymdelivershorter00&amp;as manywidth="/* <![Ctitle =of the lowest picked escapeduses ofpeoples PublicMatthewtacticsdamagedway forlaws ofeasy to windowstrong simple}catch(seventhinfoboxwent topaintedcitizenI don\'tretreat. Some ww.");\nbombingmailto:made in. Many carries||{};wiwork ofsynonymdefeatsfavoredopticalpageTraunless sendingleft"><comScorAll thejQuery.touristClassicfalse" Wilhelmsuburbsgenuinebishops.split(global followsbody ofnominalContactsecularleft tochiefly-hidden-banner</li>\n\n. When in bothdismissExplorealways via thespaC1olwelfareruling arrangecaptainhis sonrule ofhe tookitself,=0&amp;(calledsamplesto makecom/pagMartin Kennedyacceptsfull ofhandledBesides//--></able totargetsessencehim to its by common.mineralto takeways tos.org/ladvisedpenaltysimple:if theyLettersa shortHerbertstrikes groups.lengthflightsoverlapslowly lesser social </p>\n\t\tit intoranked rate oful>\r\n attemptpair ofmake itKontaktAntoniohaving ratings activestreamstrapped").css(hostilelead tolittle groups,Picture-->\r\n\r\n rows=" objectinverse<footerCustomV><\\/scrsolvingChamberslaverywoundedwhereas!= \'undfor allpartly -right:Arabianbacked centuryunit ofmobile-Europe,is homerisk ofdesiredClintoncost ofage of become none ofp&quot;Middle ead\')[0Criticsstudios>&copy;group">assemblmaking pressedwidget.ps:" ? rebuiltby someFormer editorsdelayedCanonichad thepushingclass="but arepartialBabylonbottom carrierCommandits useAs withcoursesa thirddenotesalso inHouston20px;">accuseddouble goal ofFamous ).bind(priests Onlinein Julyst + "gconsultdecimalhelpfulrevivedis veryr\'+\'iptlosing femalesis alsostringsdays ofarrivalfuture <objectforcingString(" />\n\t\there isencoded. The balloondone by/commonbgcolorlaw of Indianaavoidedbut the2px 3pxjquery.after apolicy.men andfooter-= true;for usescreen.Indian image =family,http:// &nbsp;driverseternalsame asnoticedviewers})();\n is moreseasonsformer the newis justconsent Searchwas thewhy theshippedbr><br>width: height=made ofcuisineis thata very Admiral fixed;normal MissionPress, ontariocharsettry to invaded="true"spacingis mosta more totallyfall of});\r\n immensetime inset outsatisfyto finddown tolot of Playersin Junequantumnot thetime todistantFinnishsrc = (single help ofGerman law andlabeledforestscookingspace">header-well asStanleybridges/globalCroatia About [0];\n it, andgroupedbeing a){throwhe madelighterethicalFFFFFF"bottom"like a employslive inas seenprintermost ofub-linkrejectsand useimage">succeedfeedingNuclearinformato helpWomen\'sNeitherMexicanprotein<table by manyhealthylawsuitdevised.push({sellerssimply Through.cookie Image(older">us.js"> Since universlarger open to!-- endlies in\']);\r\n marketwho is ("DOMComanagedone fortypeof Kingdomprofitsproposeto showcenter;made itdressedwere inmixtureprecisearisingsrc = \'make a securedBaptistvoting \n\t\tvar March 2grew upClimate.removeskilledway the</head>face ofacting right">to workreduceshas haderectedshow();action=book ofan area== "htt<header\n<html>conformfacing cookie.rely onhosted .customhe wentbut forspread Family a meansout theforums.footage">MobilClements" id="as highintense--><!--female is seenimpliedset thea stateand hisfastestbesidesbutton_bounded"><img Infoboxevents,a youngand areNative cheaperTimeoutand hasengineswon the(mostlyright: find a -bottomPrince area ofmore ofsearch_nature,legallyperiod,land ofor withinducedprovingmissilelocallyAgainstthe wayk&quot;px;">\r\npushed abandonnumeralCertainIn thismore inor somename isand, incrownedISBN 0-createsOctobermay notcenter late inDefenceenactedwish tobroadlycoolingonload=it. TherecoverMembersheight assumes<html>\npeople.in one =windowfooter_a good reklamaothers,to this_cookiepanel">London,definescrushedbaptismcoastalstatus title" move tolost inbetter impliesrivalryservers SystemPerhapses and contendflowinglasted rise inGenesisview ofrising seem tobut in backinghe willgiven agiving cities.flow of Later all butHighwayonly bysign ofhe doesdiffersbattery&amp;lasinglesthreatsintegertake onrefusedcalled =US&ampSee thenativesby thissystem.head of:hover,lesbiansurnameand allcommon/header__paramsHarvard/pixel.removalso longrole ofjointlyskyscraUnicodebr />\r\nAtlantanucleusCounty,purely count">easily build aonclicka givenpointerh&quot;events else {\nditionsnow the, with man whoorg/Webone andcavalryHe diedseattle00,000 {windowhave toif(windand itssolely m&quot;renewedDetroitamongsteither them inSenatorUs</a><King ofFrancis-produche usedart andhim andused byscoringat hometo haverelatesibilityfactionBuffalolink"><what hefree toCity ofcome insectorscountedone daynervoussquare };if(goin whatimg" alis onlysearch/tuesdaylooselySolomonsexual - <a hrmedium"DO NOT France,with a war andsecond take a >\r\n\r\n\r\nmarket.highwaydone inctivity"last">obligedrise to"undefimade to Early praisedin its for hisathleteJupiterYahoo! termed so manyreally s. The a woman?value=direct right" bicycleacing="day andstatingRather,higher Office are nowtimes, when a pay foron this-link">;borderaround annual the Newput the.com" takin toa brief(in thegroups.; widthenzymessimple in late{returntherapya pointbanninginks">\n();" rea place\\u003Caabout atr>\r\n\t\tccount gives a<SCRIPTRailwaythemes/toolboxById("xhumans,watchesin some if (wicoming formats Under but hashanded made bythan infear ofdenoted/iframeleft involtagein eacha&quot;base ofIn manyundergoregimesaction </p>\r\n<ustomVa;&gt;</importsor thatmostly &amp;re size="</a></ha classpassiveHost = WhetherfertileVarious=[];(fucameras/></td>acts asIn some>\r\n\r\n<!organis <br />BeijingcatalC deutscheuropeueuskaragaeilgesvenskaespaC1amensajeusuariotrabajomC)xicopC!ginasiempresistemaoctubreduranteaC1adirempresamomentonuestroprimeratravC)sgraciasnuestraprocesoestadoscalidadpersonanC:meroacuerdomC:sicamiembroofertasalgunospaC-sesejemploderechoademC!sprivadoagregarenlacesposiblehotelessevillaprimeroC:ltimoeventosarchivoculturamujeresentradaanuncioembargomercadograndesestudiomejoresfebrerodiseC1oturismocC3digoportadaespaciofamiliaantoniopermiteguardaralgunaspreciosalguiensentidovisitastC-tuloconocersegundoconsejofranciaminutossegundatenemosefectosmC!lagasesiC3nrevistagranadacompraringresogarcC-aacciC3necuadorquienesinclusodeberC!materiahombresmuestrapodrC-amaC1anaC:ltimaestamosoficialtambienningC:nsaludospodemosmejorarpositionbusinesshomepagesecuritylanguagestandardcampaignfeaturescategoryexternalchildrenreservedresearchexchangefavoritetemplatemilitaryindustryservicesmaterialproductsz-index:commentssoftwarecompletecalendarplatformarticlesrequiredmovementquestionbuildingpoliticspossiblereligionphysicalfeedbackregisterpicturesdisabledprotocolaudiencesettingsactivityelementslearninganythingabstractprogressoverviewmagazineeconomictrainingpressurevarious <strong>propertyshoppingtogetheradvancedbehaviordownloadfeaturedfootballselectedLanguagedistanceremembertrackingpasswordmodifiedstudentsdirectlyfightingnortherndatabasefestivalbreakinglocationinternetdropdownpracticeevidencefunctionmarriageresponseproblemsnegativeprogramsanalysisreleasedbanner">purchasepoliciesregionalcreativeargumentbookmarkreferrerchemicaldivisioncallbackseparateprojectsconflicthardwareinterestdeliverymountainobtained= false;for(var acceptedcapacitycomputeridentityaircraftemployedproposeddomesticincludesprovidedhospitalverticalcollapseapproachpartnerslogo"><adaughterauthor" culturalfamilies/images/assemblypowerfulteachingfinisheddistrictcriticalcgi-bin/purposesrequireselectionbecomingprovidesacademicexerciseactuallymedicineconstantaccidentMagazinedocumentstartingbottom">observed: &quot;extendedpreviousSoftwarecustomerdecisionstrengthdetailedslightlyplanningtextareacurrencyeveryonestraighttransferpositiveproducedheritageshippingabsolutereceivedrelevantbutton" violenceanywherebenefitslaunchedrecentlyalliancefollowedmultiplebulletinincludedoccurredinternal$(this).republic><tr><tdcongressrecordedultimatesolution<ul id="discoverHome</a>websitesnetworksalthoughentirelymemorialmessagescontinueactive">somewhatvictoriaWestern title="LocationcontractvisitorsDownloadwithout right">\nmeasureswidth = variableinvolvedvirginianormallyhappenedaccountsstandingnationalRegisterpreparedcontrolsaccuratebirthdaystrategyofficialgraphicscriminalpossiblyconsumerPersonalspeakingvalidateachieved.jpg" />machines</h2>\n keywordsfriendlybrotherscombinedoriginalcomposedexpectedadequatepakistanfollow" valuable</label>relativebringingincreasegovernorplugins/List of Header">" name=" (&quot;graduate</head>\ncommercemalaysiadirectormaintain;height:schedulechangingback to catholicpatternscolor: #greatestsuppliesreliable</ul>\n\t\t<select citizensclothingwatching<li id="specificcarryingsentence<center>contrastthinkingcatch(e)southernMichael merchantcarouselpadding:interior.split("lizationOctober ){returnimproved--&gt;\n\ncoveragechairman.png" />subjectsRichard whateverprobablyrecoverybaseballjudgmentconnect..css" /> websitereporteddefault"/></a>\r\nelectricscotlandcreationquantity. ISBN 0did not instance-search-" lang="speakersComputercontainsarchivesministerreactiondiscountItalianocriteriastrongly: \'http:\'script\'coveringofferingappearedBritish identifyFacebooknumerousvehiclesconcernsAmericanhandlingdiv id="William provider_contentaccuracysection andersonflexibleCategorylawrence<script>layout="approved maximumheader"></table>Serviceshamiltoncurrent canadianchannels/themes//articleoptionalportugalvalue=""intervalwirelessentitledagenciesSearch" measuredthousandspending&hellip;new Date" size="pageNamemiddle" " /></a>hidden">sequencepersonaloverflowopinionsillinoislinks">\n\t<title>versionssaturdayterminalitempropengineersectionsdesignerproposal="false"EspaC1olreleasessubmit" er&quot;additionsymptomsorientedresourceright"><pleasurestationshistory.leaving border=contentscenter">.\n\nSome directedsuitablebulgaria.show();designedGeneral conceptsExampleswilliamsOriginal"><span>search">operatorrequestsa &quot;allowingDocumentrevision. \n\nThe yourselfContact michiganEnglish columbiapriorityprintingdrinkingfacilityreturnedContent officersRussian generate-8859-1"indicatefamiliar qualitymargin:0 contentviewportcontacts-title">portable.length eligibleinvolvesatlanticonload="default.suppliedpaymentsglossary\n\nAfter guidance</td><tdencodingmiddle">came to displaysscottishjonathanmajoritywidgets.clinicalthailandteachers<head>\n\taffectedsupportspointer;toString</small>oklahomawill be investor0" alt="holidaysResourcelicensed (which . After considervisitingexplorerprimary search" android"quickly meetingsestimate;return ;color:# height=approval, &quot; checked.min.js"magnetic></a></hforecast. While thursdaydvertise&eacute;hasClassevaluateorderingexistingpatients Online coloradoOptions"campbell<!-- end</span><<br />\r\n_popups|sciences,&quot; quality Windows assignedheight: <b classle&quot; value=" Companyexamples<iframe believespresentsmarshallpart of properly).\n\nThe taxonomymuch of </span>\n" data-srtuguC*sscrollTo project<head>\r\nattorneyemphasissponsorsfancyboxworld\'s wildlifechecked=sessionsprogrammpx;font- Projectjournalsbelievedvacationthompsonlightingand the special border=0checking</tbody><button Completeclearfix\n<head>\narticle <sectionfindingsrole in popular Octoberwebsite exposureused to changesoperatedclickingenteringcommandsinformed numbers </div>creatingonSubmitmarylandcollegesanalyticlistingscontact.loggedInadvisorysiblingscontent"s&quot;)s. This packagescheckboxsuggestspregnanttomorrowspacing=icon.pngjapanesecodebasebutton">gamblingsuch as , while </span> missourisportingtop:1px .</span>tensionswidth="2lazyloadnovemberused in height="cript">\n&nbsp;</<tr><td height:2/productcountry include footer" &lt;!-- title"></jquery.</form>\n(g.\0d=\x13)(g9\x01i+\x14)hrvatskiitalianoromC"nD\x03tC<rkC\'eX\'X1X/Y\btambiC)nnoticiasmensajespersonasderechosnacionalserviciocontactousuariosprogramagobiernoempresasanunciosvalenciacolombiadespuC)sdeportesproyectoproductopC:bliconosotroshistoriapresentemillonesmediantepreguntaanteriorrecursosproblemasantiagonuestrosopiniC3nimprimirmientrasamC)ricavendedorsociedadrespectorealizarregistropalabrasinterC)sentoncesespecialmiembrosrealidadcC3rdobazaragozapC!ginassocialesbloqueargestiC3nalquilersistemascienciascompletoversiC3ncompletaestudiospC:blicaobjetivoalicantebuscadorcantidadentradasaccionesarchivossuperiormayorC-aalemaniafunciC3nC:ltimoshaciendoaquellosediciC3nfernandoambientefacebooknuestrasclientesprocesosbastantepresentareportarcongresopublicarcomerciocontratojC3venesdistritotC)cnicaconjuntoenergC-atrabajarasturiasrecienteutilizarboletC-nsalvadorcorrectatrabajosprimerosnegocioslibertaddetallespantallaprC3ximoalmerC-aanimalesquiC)nescorazC3nsecciC3nbuscandoopcionesexteriorconceptotodavC-agalerC-aescribirmedicinalicenciaconsultaaspectoscrC-ticadC3laresjusticiadeberC!nperC-odonecesitamantenerpequeC1orecibidatribunaltenerifecanciC3ncanariasdescargadiversosmallorcarequieretC)cnicodeberC-aviviendafinanzasadelantefuncionaconsejosdifC-cilciudadesantiguasavanzadatC)rminounidadessC!nchezcampaC1asoftonicrevistascontienesectoresmomentosfacultadcrC)ditodiversassupuestofactoressegundospequeC1aP3P>P4P0P5Q\x01P;P8P5Q\x01Q\x02Q\fP1Q\vP;P>P1Q\vQ\x02Q\fQ\rQ\x02P>P<P\x15Q\x01P;P8Q\x02P>P3P>P<P5P=Q\x0fP2Q\x01P5Q\x05Q\rQ\x02P>P9P4P0P6P5P1Q\vP;P8P3P>P4Q\x03P4P5P=Q\fQ\rQ\x02P>Q\x02P1Q\vP;P0Q\x01P5P1Q\x0fP>P4P8P=Q\x01P5P1P5P=P0P4P>Q\x01P0P9Q\x02Q\x04P>Q\x02P>P=P5P3P>Q\x01P2P>P8Q\x01P2P>P9P8P3Q\0Q\vQ\x02P>P6P5P2Q\x01P5P<Q\x01P2P>Q\x0eP;P8Q\bQ\fQ\rQ\x02P8Q\x05P?P>P:P0P4P=P5P9P4P>P<P0P<P8Q\0P0P;P8P1P>Q\x02P5P<Q\x03Q\x05P>Q\x02Q\x0fP4P2Q\x03Q\x05Q\x01P5Q\x02P8P;Q\x0eP4P8P4P5P;P>P<P8Q\0P5Q\x02P5P1Q\x0fQ\x01P2P>P5P2P8P4P5Q\x07P5P3P>Q\rQ\x02P8P<Q\x01Q\x07P5Q\x02Q\x02P5P<Q\vQ\x06P5P=Q\vQ\x01Q\x02P0P;P2P5P4Q\fQ\x02P5P<P5P2P>P4Q\vQ\x02P5P1P5P2Q\vQ\bP5P=P0P<P8Q\x02P8P?P0Q\x02P>P<Q\x03P?Q\0P0P2P;P8Q\x06P0P>P4P=P0P3P>P4Q\vP7P=P0Q\x0eP<P>P3Q\x03P4Q\0Q\x03P3P2Q\x01P5P9P8P4P5Q\x02P:P8P=P>P>P4P=P>P4P5P;P0P4P5P;P5Q\x01Q\0P>P:P8Q\x0eP=Q\x0fP2P5Q\x01Q\fP\x15Q\x01Q\x02Q\fQ\0P0P7P0P=P0Q\bP8X\'Y\x04Y\x04Y\x07X\'Y\x04X*Y\nX,Y\x05Y\nX9X.X\'X5X)X\'Y\x04X0Y\nX9Y\x04Y\nY\x07X,X/Y\nX/X\'Y\x04X"Y\x06X\'Y\x04X1X/X*X-Y\x03Y\x05X5Y\x01X-X)Y\x03X\'Y\x06X*X\'Y\x04Y\x04Y\nY\nY\x03Y\bY\x06X4X(Y\x03X)Y\x01Y\nY\x07X\'X(Y\x06X\'X*X-Y\bX\'X!X#Y\x03X+X1X.Y\x04X\'Y\x04X\'Y\x04X-X(X/Y\x04Y\nY\x04X/X1Y\bX3X\'X6X:X7X*Y\x03Y\bY\x06Y\x07Y\x06X\'Y\x03X3X\'X-X)Y\x06X\'X/Y\nX\'Y\x04X7X(X9Y\x04Y\nY\x03X4Y\x03X1X\'Y\nY\x05Y\x03Y\x06Y\x05Y\x06Y\x07X\'X4X1Y\x03X)X1X&Y\nX3Y\x06X4Y\nX7Y\x05X\'X0X\'X\'Y\x04Y\x01Y\x06X4X(X\'X(X*X9X(X1X1X-Y\x05X)Y\x03X\'Y\x01X)Y\nY\x02Y\bY\x04Y\x05X1Y\x03X2Y\x03Y\x04Y\x05X)X#X-Y\x05X/Y\x02Y\x04X(Y\nY\nX9Y\x06Y\nX5Y\bX1X)X7X1Y\nY\x02X4X\'X1Y\x03X,Y\bX\'Y\x04X#X.X1Y\tY\x05X9Y\x06X\'X\'X(X-X+X9X1Y\bX6X(X4Y\x03Y\x04Y\x05X3X,Y\x04X(Y\x06X\'Y\x06X.X\'Y\x04X/Y\x03X*X\'X(Y\x03Y\x04Y\nX)X(X/Y\bY\x06X#Y\nX6X\'Y\nY\bX,X/Y\x01X1Y\nY\x02Y\x03X*X(X*X#Y\x01X6Y\x04Y\x05X7X(X.X\'Y\x03X+X1X(X\'X1Y\x03X\'Y\x01X6Y\x04X\'X-Y\x04Y\tY\x06Y\x01X3Y\x07X#Y\nX\'Y\x05X1X/Y\bX/X#Y\x06Y\x07X\'X/Y\nY\x06X\'X\'Y\x04X\'Y\x06Y\x05X9X1X6X*X9Y\x04Y\x05X/X\'X.Y\x04Y\x05Y\x05Y\x03Y\x06\0\0\0\0\0\0\0\0\x01\0\x01\0\x01\0\x01\0\x02\0\x02\0\x02\0\x02\0\x04\0\x04\0\x04\0\x04\0\0\x01\x02\x03\x04\x05\x06\x07\x07\x06\x05\x04\x03\x02\x01\0\b\t\n\v\f\r\x0e\x0f\x0f\x0e\r\f\v\n\t\b\x10\x11\x12\x13\x14\x15\x16\x17\x17\x16\x15\x14\x13\x12\x11\x10\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x1f\x1e\x1d\x1c\x1b\x1a\x19\x18\x7f\x7f\x7f\x7f\0\0\0\0\0\0\0\0\x7f\x7f\x7f\x7f\x01\0\0\0\x02\0\0\0\x02\0\0\0\x01\0\0\0\x01\0\0\0\x03\0\0\0\x7f\x7f\0\x01\0\0\0\x01\0\0\x7f\x7f\0\x01\0\0\0\b\0\b\0\b\0\b\0\0\0\x01\0\x02\0\x03\0\x04\0\x05\0\x06\0\x07resourcescountriesquestionsequipmentcommunityavailablehighlightDTD/xhtmlmarketingknowledgesomethingcontainerdirectionsubscribeadvertisecharacter" value="</select>Australia" class="situationauthorityfollowingprimarilyoperationchallengedevelopedanonymousfunction functionscompaniesstructureagreement" title="potentialeducationargumentssecondarycopyrightlanguagesexclusivecondition</form>\r\nstatementattentionBiography} else {\nsolutionswhen the Analyticstemplatesdangeroussatellitedocumentspublisherimportantprototypeinfluence&raquo;</effectivegenerallytransformbeautifultransportorganizedpublishedprominentuntil thethumbnailNational .focus();over the migrationannouncedfooter">\nexceptionless thanexpensiveformationframeworkterritoryndicationcurrentlyclassNamecriticismtraditionelsewhereAlexanderappointedmaterialsbroadcastmentionedaffiliate</option>treatmentdifferent/default.Presidentonclick="biographyotherwisepermanentFranC\'aisHollywoodexpansionstandards</style>\nreductionDecember preferredCambridgeopponentsBusiness confusion>\n<title>presentedexplaineddoes not worldwideinterfacepositionsnewspaper</table>\nmountainslike the essentialfinancialselectionaction="/abandonedEducationparseInt(stabilityunable to</title>\nrelationsNote thatefficientperformedtwo yearsSince thethereforewrapper">alternateincreasedBattle ofperceivedtrying tonecessaryportrayedelectionsElizabeth</iframe>discoveryinsurances.length;legendaryGeographycandidatecorporatesometimesservices.inherited</strong>CommunityreligiouslocationsCommitteebuildingsthe worldno longerbeginningreferencecannot befrequencytypicallyinto the relative;recordingpresidentinitiallytechniquethe otherit can beexistenceunderlinethis timetelephoneitemscopepracticesadvantage);return For otherprovidingdemocracyboth the extensivesufferingsupportedcomputers functionpracticalsaid thatit may beEnglish</from the scheduleddownloads</label>\nsuspectedmargin: 0spiritual</head>\n\nmicrosoftgraduallydiscussedhe becameexecutivejquery.jshouseholdconfirmedpurchasedliterallydestroyedup to thevariationremainingit is notcenturiesJapanese among thecompletedalgorithminterestsrebellionundefinedencourageresizableinvolvingsensitiveuniversalprovision(althoughfeaturingconducted), which continued-header">February numerous overflow:componentfragmentsexcellentcolspan="technicalnear the Advanced source ofexpressedHong Kong Facebookmultiple mechanismelevationoffensive</form>\n\tsponsoreddocument.or &quot;there arethose whomovementsprocessesdifficultsubmittedrecommendconvincedpromoting" width=".replace(classicalcoalitionhis firstdecisionsassistantindicatedevolution-wrapper"enough toalong thedelivered-->\r\n<!--American protectedNovember </style><furnitureInternet onblur="suspendedrecipientbased on Moreover,abolishedcollectedwere madeemotionalemergencynarrativeadvocatespx;bordercommitteddir="ltr"employeesresearch. selectedsuccessorcustomersdisplayedSeptemberaddClass(Facebook suggestedand lateroperatingelaborateSometimesInstitutecertainlyinstalledfollowersJerusalemthey havecomputinggeneratedprovincesguaranteearbitraryrecognizewanted topx;width:theory ofbehaviourWhile theestimatedbegan to it becamemagnitudemust havemore thanDirectoryextensionsecretarynaturallyoccurringvariablesgiven theplatform.</label><failed tocompoundskinds of societiesalongside --&gt;\n\nsouthwestthe rightradiationmay have unescape(spoken in" href="/programmeonly the come fromdirectoryburied ina similarthey were</font></Norwegianspecifiedproducingpassenger(new DatetemporaryfictionalAfter theequationsdownload.regularlydeveloperabove thelinked tophenomenaperiod oftooltip">substanceautomaticaspect ofAmong theconnectedestimatesAir Forcesystem ofobjectiveimmediatemaking itpaintingsconqueredare stillproceduregrowth ofheaded byEuropean divisionsmoleculesfranchiseintentionattractedchildhoodalso useddedicatedsingaporedegree offather ofconflicts</a></p>\ncame fromwere usednote thatreceivingExecutiveeven moreaccess tocommanderPoliticalmusiciansdeliciousprisonersadvent ofUTF-8" /><![CDATA[">ContactSouthern bgcolor="series of. It was in Europepermittedvalidate.appearingofficialsseriously-languageinitiatedextendinglong-terminflationsuch thatgetCookiemarked by</button>implementbut it isincreasesdown the requiringdependent-->\n<!-- interviewWith the copies ofconsensuswas builtVenezuela(formerlythe statepersonnelstrategicfavour ofinventionWikipediacontinentvirtuallywhich wasprincipleComplete identicalshow thatprimitiveaway frommolecularpreciselydissolvedUnder theversion=">&nbsp;</It is the This is will haveorganismssome timeFriedrichwas firstthe only fact thatform id="precedingTechnicalphysicistoccurs innavigatorsection">span id="sought tobelow thesurviving}</style>his deathas in thecaused bypartiallyexisting using thewas givena list oflevels ofnotion ofOfficial dismissedscientistresemblesduplicateexplosiverecoveredall othergalleries{padding:people ofregion ofaddressesassociateimg alt="in modernshould bemethod ofreportingtimestampneeded tothe Greatregardingseemed toviewed asimpact onidea thatthe Worldheight ofexpandingThese arecurrent">carefullymaintainscharge ofClassicaladdressedpredictedownership<div id="right">\r\nresidenceleave thecontent">are often })();\r\nprobably Professor-button" respondedsays thathad to beplaced inHungarianstatus ofserves asUniversalexecutionaggregatefor whichinfectionagreed tohowever, popular">placed onconstructelectoralsymbol ofincludingreturn toarchitectChristianprevious living ineasier toprofessor\n&lt;!-- effect ofanalyticswas takenwhere thetook overbelief inAfrikaansas far aspreventedwork witha special<fieldsetChristmasRetrieved\n\nIn the back intonortheastmagazines><strong>committeegoverninggroups ofstored inestablisha generalits firsttheir ownpopulatedan objectCaribbeanallow thedistrictswisconsinlocation.; width: inhabitedSocialistJanuary 1</footer>similarlychoice ofthe same specific business The first.length; desire todeal withsince theuserAgentconceivedindex.phpas &quot;engage inrecently,few yearswere also\n<head>\n<edited byare knowncities inaccesskeycondemnedalso haveservices,family ofSchool ofconvertednature of languageministers</object>there is a popularsequencesadvocatedThey wereany otherlocation=enter themuch morereflectedwas namedoriginal a typicalwhen theyengineerscould notresidentswednesdaythe third productsJanuary 2what theya certainreactionsprocessorafter histhe last contained"></div>\n</a></td>depend onsearch">\npieces ofcompetingReferencetennesseewhich has version=</span> <</header>gives thehistorianvalue="">padding:0view thattogether,the most was foundsubset ofattack onchildren,points ofpersonal position:allegedlyClevelandwas laterand afterare givenwas stillscrollingdesign ofmakes themuch lessAmericans.\n\nAfter , but theMuseum oflouisiana(from theminnesotaparticlesa processDominicanvolume ofreturningdefensive00px|righmade frommouseover" style="states of(which iscontinuesFranciscobuilding without awith somewho woulda form ofa part ofbefore itknown as Serviceslocation and oftenmeasuringand it ispaperbackvalues of\r\n<title>= window.determineer&quot; played byand early</center>from thisthe threepower andof &quot;innerHTML<a href="y:inline;Church ofthe eventvery highofficial -height: content="/cgi-bin/to createafrikaansesperantofranC\'aislatvieE!ulietuviE3D\feE!tinaD\reE!tina`9\x04`8\x17`8"f\x17%f\x1c,h*\x1eg.\0d=\x13e-\x17g9\x01i+\x14e-\x17m\x15\x1cj5-l\x164d8:d;\0d9\bh.!g.\x17f\x1c:g,\x14h.0f\x1c,h(\x0eh+\x16e\r\0f\x1c\re\n!e\x19(d:\x12h\x01\x14g=\x11f\b?e\x1c0d:\'d?1d9\x10i\x03(e\x07:g\t\bg$>f\x0e\x12h!\ff&\x1ci\x03(h\x10=f <h?\x1bd8\0f-%f\x14/d;\x18e.\x1di*\fh/\x01g \x01e\'\x14e\x11\x18d<\x1af\x150f\r.e:\x13f6\bh49h\0\x05e\n\x1ee\x05,e.$h.(h.:e\f:f71e\x1c3e8\x02f\x12-f\x14>e\x19(e\f\x17d:,e8\x02e$\'e-&g\x14\x1fh6\nf\x1d%h6\ng.!g\x10\x06e\x11\x18d?!f\x01/g=\x11serviciosartC-culoargentinabarcelonacualquierpublicadoproductospolC-ticarespuestawikipediasiguientebC:squedacomunidadseguridadprincipalpreguntascontenidorespondervenezuelaproblemasdiciembrerelaciC3nnoviembresimilaresproyectosprogramasinstitutoactividadencuentraeconomC-aimC!genescontactardescargarnecesarioatenciC3ntelC)fonocomisiC3ncancionescapacidadencontraranC!lisisfavoritostC)rminosprovinciaetiquetaselementosfuncionesresultadocarC!cterpropiedadprincipionecesidadmunicipalcreaciC3ndescargaspresenciacomercialopinionesejercicioeditorialsalamancagonzC!lezdocumentopelC-cularecientesgeneralestarragonaprC!cticanovedadespropuestapacientestC)cnicasobjetivoscontactos`$.`%\x07`$\x02`$2`$?`$\x0f`$9`%\b`$\x02`$\x17`$/`$>`$8`$>`$%`$\x0f`$5`$\x02`$0`$9`%\x07`$\x15`%\v`$\b`$\x15`%\x01`$\x1b`$0`$9`$>`$,`$>`$&`$\x15`$9`$>`$8`$-`%\0`$9`%\x01`$\x0f`$0`$9`%\0`$.`%\b`$\x02`$&`$?`$(`$,`$>`$$diplodocs`$8`$.`$/`$0`%\x02`$*`$(`$>`$.`$*`$$`$>`$+`$?`$0`$\x14`$8`$$`$$`$0`$9`$2`%\v`$\x17`$9`%\x01`$\x06`$,`$>`$0`$&`%\x07`$6`$9`%\x01`$\b`$\x16`%\x07`$2`$/`$&`$?`$\x15`$>`$.`$5`%\x07`$,`$$`%\0`$(`$,`%\0`$\x1a`$.`%\f`$$`$8`$>`$2`$2`%\x07`$\x16`$\x1c`%\t`$,`$.`$&`$&`$$`$%`$>`$(`$9`%\0`$6`$9`$0`$\x05`$2`$\x17`$\x15`$-`%\0`$(`$\x17`$0`$*`$>`$8`$0`$>`$$`$\x15`$?`$\x0f`$\t`$8`%\x07`$\x17`$/`%\0`$9`%\x02`$\x01`$\x06`$\x17`%\x07`$\x1f`%\0`$.`$\x16`%\v`$\x1c`$\x15`$>`$0`$\x05`$-`%\0`$\x17`$/`%\x07`$$`%\x01`$.`$5`%\v`$\x1f`$&`%\x07`$\x02`$\x05`$\x17`$0`$\x10`$8`%\x07`$.`%\x07`$2`$2`$\x17`$>`$9`$>`$2`$\n`$*`$0`$\x1a`$>`$0`$\x10`$8`$>`$&`%\x07`$0`$\x1c`$?`$8`$&`$?`$2`$,`$\x02`$&`$,`$(`$>`$9`%\x02`$\x02`$2`$>`$\x16`$\x1c`%\0`$$`$,`$\x1f`$(`$.`$?`$2`$\x07`$8`%\x07`$\x06`$(`%\x07`$(`$/`$>`$\x15`%\x01`$2`$2`%\t`$\x17`$-`$>`$\x17`$0`%\x07`$2`$\x1c`$\x17`$9`$0`$>`$.`$2`$\x17`%\x07`$*`%\x07`$\x1c`$9`$>`$%`$\x07`$8`%\0`$8`$9`%\0`$\x15`$2`$>`$ `%\0`$\x15`$9`$>`$\x01`$&`%\x02`$0`$$`$9`$$`$8`$>`$$`$/`$>`$&`$\x06`$/`$>`$*`$>`$\x15`$\x15`%\f`$(`$6`$>`$.`$&`%\x07`$\x16`$/`$9`%\0`$0`$>`$/`$\x16`%\x01`$&`$2`$\x17`%\0categoriesexperience</title>\r\nCopyright javascriptconditionseverything<p class="technologybackground<a class="management&copy; 201javaScriptcharactersbreadcrumbthemselveshorizontalgovernmentCaliforniaactivitiesdiscoveredNavigationtransitionconnectionnavigationappearance</title><mcheckbox" techniquesprotectionapparentlyas well asunt\', \'UA-resolutionoperationstelevisiontranslatedWashingtonnavigator. = window.impression&lt;br&gt;literaturepopulationbgcolor="#especially content="productionnewsletterpropertiesdefinitionleadershipTechnologyParliamentcomparisonul class=".indexOf("conclusiondiscussioncomponentsbiologicalRevolution_containerunderstoodnoscript><permissioneach otheratmosphere onfocus="<form id="processingthis.valuegenerationConferencesubsequentwell-knownvariationsreputationphenomenondisciplinelogo.png" (document,boundariesexpressionsettlementBackgroundout of theenterprise("https:" unescape("password" democratic<a href="/wrapper">\nmembershiplinguisticpx;paddingphilosophyassistanceuniversityfacilitiesrecognizedpreferenceif (typeofmaintainedvocabularyhypothesis.submit();&amp;nbsp;annotationbehind theFoundationpublisher"assumptionintroducedcorruptionscientistsexplicitlyinstead ofdimensions onClick="considereddepartmentoccupationsoon afterinvestmentpronouncedidentifiedexperimentManagementgeographic" height="link rel=".replace(/depressionconferencepunishmenteliminatedresistanceadaptationoppositionwell knownsupplementdeterminedh1 class="0px;marginmechanicalstatisticscelebratedGovernment\n\nDuring tdevelopersartificialequivalentoriginatedCommissionattachment<span id="there wereNederlandsbeyond theregisteredjournalistfrequentlyall of thelang="en" </style>\r\nabsolute; supportingextremely mainstream</strong> popularityemployment</table>\r\n colspan="</form>\n conversionabout the </p></div>integrated" lang="enPortuguesesubstituteindividualimpossiblemultimediaalmost allpx solid #apart fromsubject toin Englishcriticizedexcept forguidelinesoriginallyremarkablethe secondh2 class="<a title="(includingparametersprohibited= "http://dictionaryperceptionrevolutionfoundationpx;height:successfulsupportersmillenniumhis fatherthe &quot;no-repeat;commercialindustrialencouragedamount of unofficialefficiencyReferencescoordinatedisclaimerexpeditiondevelopingcalculatedsimplifiedlegitimatesubstring(0" class="completelyillustratefive yearsinstrumentPublishing1" class="psychologyconfidencenumber of absence offocused onjoined thestructurespreviously></iframe>once againbut ratherimmigrantsof course,a group ofLiteratureUnlike the</a>&nbsp;\nfunction it was theConventionautomobileProtestantaggressiveafter the Similarly," /></div>collection\r\nfunctionvisibilitythe use ofvolunteersattractionunder the threatened*<![CDATA[importancein generalthe latter</form>\n</.indexOf(\'i = 0; i <differencedevoted totraditionssearch forultimatelytournamentattributesso-called }\n</style>evaluationemphasizedaccessible</section>successionalong withMeanwhile,industries</a><br />has becomeaspects ofTelevisionsufficientbasketballboth sidescontinuingan article<img alt="adventureshis mothermanchesterprinciplesparticularcommentaryeffects ofdecided to"><strong>publishersJournal ofdifficultyfacilitateacceptablestyle.css"\tfunction innovation>Copyrightsituationswould havebusinessesDictionarystatementsoften usedpersistentin Januarycomprising</title>\n\tdiplomaticcontainingperformingextensionsmay not beconcept of onclick="It is alsofinancial making theLuxembourgadditionalare calledengaged in"script");but it waselectroniconsubmit="\n<!-- End electricalofficiallysuggestiontop of theunlike theAustralianOriginallyreferences\n</head>\r\nrecognisedinitializelimited toAlexandriaretirementAdventuresfour years\n\n&lt;!-- increasingdecorationh3 class="origins ofobligationregulationclassified(function(advantagesbeing the historians<base hrefrepeatedlywilling tocomparabledesignatednominationfunctionalinside therevelationend of thes for the authorizedrefused totake placeautonomouscompromisepolitical restauranttwo of theFebruary 2quality ofswfobject.understandnearly allwritten byinterviews" width="1withdrawalfloat:leftis usuallycandidatesnewspapersmysteriousDepartmentbest knownparliamentsuppressedconvenientremembereddifferent systematichas led topropagandacontrolledinfluencesceremonialproclaimedProtectionli class="Scientificclass="no-trademarksmore than widespreadLiberationtook placeday of theas long asimprisonedAdditional\n<head>\n<mLaboratoryNovember 2exceptionsIndustrialvariety offloat: lefDuring theassessmenthave been deals withStatisticsoccurrence/ul></div>clearfix">the publicmany yearswhich wereover time,synonymouscontent">\npresumablyhis familyuserAgent.unexpectedincluding challengeda minorityundefined"belongs totaken fromin Octoberposition: said to bereligious Federation rowspan="only a fewmeant thatled to the-->\r\n<div <fieldset>Archbishop class="nobeing usedapproachesprivilegesnoscript>\nresults inmay be theEaster eggmechanismsreasonablePopulationCollectionselected">noscript>\r/index.phparrival of-jssdk\'));managed toincompletecasualtiescompletionChristiansSeptember arithmeticproceduresmight haveProductionit appearsPhilosophyfriendshipleading togiving thetoward theguaranteeddocumentedcolor:#000video gamecommissionreflectingchange theassociatedsans-serifonkeypress; padding:He was theunderlyingtypically , and the srcElementsuccessivesince the should be networkingaccountinguse of thelower thanshows that</span>\n\t\tcomplaintscontinuousquantitiesastronomerhe did notdue to itsapplied toan averageefforts tothe futureattempt toTherefore,capabilityRepublicanwas formedElectronickilometerschallengespublishingthe formerindigenousdirectionssubsidiaryconspiracydetails ofand in theaffordablesubstancesreason forconventionitemtype="absolutelysupposedlyremained aattractivetravellingseparatelyfocuses onelementaryapplicablefound thatstylesheetmanuscriptstands for no-repeat(sometimesCommercialin Americaundertakenquarter ofan examplepersonallyindex.php?</button>\npercentagebest-knowncreating a" dir="ltrLieutenant\n<div id="they wouldability ofmade up ofnoted thatclear thatargue thatto anotherchildren\'spurpose offormulatedbased uponthe regionsubject ofpassengerspossession.\n\nIn the Before theafterwardscurrently across thescientificcommunity.capitalismin Germanyright-wingthe systemSociety ofpoliticiandirection:went on toremoval of New York apartmentsindicationduring theunless thehistoricalhad been adefinitiveingredientattendanceCenter forprominencereadyStatestrategiesbut in theas part ofconstituteclaim thatlaboratorycompatiblefailure of, such as began withusing the to providefeature offrom which/" class="geologicalseveral ofdeliberateimportant holds thating&quot; valign=topthe Germanoutside ofnegotiatedhis careerseparationid="searchwas calledthe fourthrecreationother thanpreventionwhile the education,connectingaccuratelywere builtwas killedagreementsmuch more Due to thewidth: 100some otherKingdom ofthe entirefamous forto connectobjectivesthe Frenchpeople andfeatured">is said tostructuralreferendummost oftena separate->\n<div id Official worldwide.aria-labelthe planetand it wasd" value="looking atbeneficialare in themonitoringreportedlythe modernworking onallowed towhere the innovative</a></div>soundtracksearchFormtend to beinput id="opening ofrestrictedadopted byaddressingtheologianmethods ofvariant ofChristian very largeautomotiveby far therange frompursuit offollow thebrought toin Englandagree thataccused ofcomes frompreventingdiv style=his or hertremendousfreedom ofconcerning0 1em 1em;Basketball/style.cssan earliereven after/" title=".com/indextaking thepittsburghcontent">\r<script>(fturned outhaving the</span>\r\n occasionalbecause itstarted tophysically></div>\n created byCurrently, bgcolor="tabindex="disastrousAnalytics also has a><div id="</style>\n<called forsinger and.src = "//violationsthis pointconstantlyis locatedrecordingsd from thenederlandsportuguC*sW"W\x11W(W\x19W*Y\x01X\'X1X3[\fdesarrollocomentarioeducaciC3nseptiembreregistradodirecciC3nubicaciC3npublicidadrespuestasresultadosimportantereservadosartC-culosdiferentessiguientesrepC:blicasituaciC3nministerioprivacidaddirectorioformaciC3npoblaciC3npresidentecont','enidosaccesoriostechnoratipersonalescategorC-aespecialesdisponibleactualidadreferenciavalladolidbibliotecarelacionescalendariopolC-ticasanterioresdocumentosnaturalezamaterialesdiferenciaeconC3micatransporterodrC-guezparticiparencuentrandiscusiC3nestructurafundaciC3nfrecuentespermanentetotalmenteP<P>P6P=P>P1Q\x03P4P5Q\x02P<P>P6P5Q\x02P2Q\0P5P<Q\x0fQ\x02P0P:P6P5Q\x07Q\x02P>P1Q\vP1P>P;P5P5P>Q\x07P5P=Q\fQ\rQ\x02P>P3P>P:P>P3P4P0P?P>Q\x01P;P5P2Q\x01P5P3P>Q\x01P0P9Q\x02P5Q\x07P5Q\0P5P7P<P>P3Q\x03Q\x02Q\x01P0P9Q\x02P0P6P8P7P=P8P<P5P6P4Q\x03P1Q\x03P4Q\x03Q\x02P\x1fP>P8Q\x01P:P7P4P5Q\x01Q\fP2P8P4P5P>Q\x01P2Q\x0fP7P8P=Q\x03P6P=P>Q\x01P2P>P5P9P;Q\x0eP4P5P9P?P>Q\0P=P>P<P=P>P3P>P4P5Q\x02P5P9Q\x01P2P>P8Q\x05P?Q\0P0P2P0Q\x02P0P:P>P9P<P5Q\x01Q\x02P>P8P<P5P5Q\x02P6P8P7P=Q\fP>P4P=P>P9P;Q\x03Q\x07Q\bP5P?P5Q\0P5P4Q\x07P0Q\x01Q\x02P8Q\x07P0Q\x01Q\x02Q\fQ\0P0P1P>Q\x02P=P>P2Q\vQ\x05P?Q\0P0P2P>Q\x01P>P1P>P9P?P>Q\x02P>P<P<P5P=P5P5Q\x07P8Q\x01P;P5P=P>P2Q\vP5Q\x03Q\x01P;Q\x03P3P>P:P>P;P>P=P0P7P0P4Q\x02P0P:P>P5Q\x02P>P3P4P0P?P>Q\x07Q\x02P8P\x1fP>Q\x01P;P5Q\x02P0P:P8P5P=P>P2Q\vP9Q\x01Q\x02P>P8Q\x02Q\x02P0P:P8Q\x05Q\x01Q\0P0P7Q\x03P!P0P=P:Q\x02Q\x04P>Q\0Q\x03P<P\x1aP>P3P4P0P:P=P8P3P8Q\x01P;P>P2P0P=P0Q\bP5P9P=P0P9Q\x02P8Q\x01P2P>P8P<Q\x01P2Q\x0fP7Q\fP;Q\x0eP1P>P9Q\x07P0Q\x01Q\x02P>Q\x01Q\0P5P4P8P\x1aQ\0P>P<P5P$P>Q\0Q\x03P<Q\0Q\vP=P:P5Q\x01Q\x02P0P;P8P?P>P8Q\x01P:Q\x02Q\vQ\x01Q\x0fQ\x07P<P5Q\x01Q\x0fQ\x06Q\x06P5P=Q\x02Q\0Q\x02Q\0Q\x03P4P0Q\x01P0P<Q\vQ\x05Q\0Q\vP=P:P0P\x1dP>P2Q\vP9Q\x07P0Q\x01P>P2P<P5Q\x01Q\x02P0Q\x04P8P;Q\fP<P<P0Q\0Q\x02P0Q\x01Q\x02Q\0P0P=P<P5Q\x01Q\x02P5Q\x02P5P:Q\x01Q\x02P=P0Q\bP8Q\x05P<P8P=Q\x03Q\x02P8P<P5P=P8P8P<P5Q\x0eQ\x02P=P>P<P5Q\0P3P>Q\0P>P4Q\x01P0P<P>P<Q\rQ\x02P>P<Q\x03P:P>P=Q\x06P5Q\x01P2P>P5P<P:P0P:P>P9P\x10Q\0Q\x05P8P2Y\x05Y\x06X*X/Y\tX%X1X3X\'Y\x04X1X3X\'Y\x04X)X\'Y\x04X9X\'Y\x05Y\x03X*X(Y\x07X\'X(X1X\'Y\x05X,X\'Y\x04Y\nY\bY\x05X\'Y\x04X5Y\bX1X,X/Y\nX/X)X\'Y\x04X9X6Y\bX%X6X\'Y\x01X)X\'Y\x04Y\x02X3Y\x05X\'Y\x04X9X\'X(X*X-Y\x05Y\nY\x04Y\x05Y\x04Y\x01X\'X*Y\x05Y\x04X*Y\x02Y\tX*X9X/Y\nY\x04X\'Y\x04X4X9X1X#X.X(X\'X1X*X7Y\bY\nX1X9Y\x04Y\nY\x03Y\x05X%X1Y\x01X\'Y\x02X7Y\x04X(X\'X*X\'Y\x04Y\x04X:X)X*X1X*Y\nX(X\'Y\x04Y\x06X\'X3X\'Y\x04X4Y\nX.Y\x05Y\x06X*X/Y\nX\'Y\x04X9X1X(X\'Y\x04Y\x02X5X5X\'Y\x01Y\x04X\'Y\x05X9Y\x04Y\nY\x07X\'X*X-X/Y\nX+X\'Y\x04Y\x04Y\x07Y\x05X\'Y\x04X9Y\x05Y\x04Y\x05Y\x03X*X(X)Y\nY\x05Y\x03Y\x06Y\x03X\'Y\x04X7Y\x01Y\x04Y\x01Y\nX/Y\nY\bX%X/X\'X1X)X*X\'X1Y\nX.X\'Y\x04X5X-X)X*X3X,Y\nY\x04X\'Y\x04Y\bY\x02X*X9Y\x06X/Y\x05X\'Y\x05X/Y\nY\x06X)X*X5Y\x05Y\nY\x05X#X1X4Y\nY\x01X\'Y\x04X0Y\nY\x06X9X1X(Y\nX)X(Y\bX\'X(X)X#Y\x04X9X\'X(X\'Y\x04X3Y\x01X1Y\x05X4X\'Y\x03Y\x04X*X9X\'Y\x04Y\tX\'Y\x04X#Y\bY\x04X\'Y\x04X3Y\x06X)X,X\'Y\x05X9X)X\'Y\x04X5X-Y\x01X\'Y\x04X/Y\nY\x06Y\x03Y\x04Y\x05X\'X*X\'Y\x04X.X\'X5X\'Y\x04Y\x05Y\x04Y\x01X#X9X6X\'X!Y\x03X*X\'X(X)X\'Y\x04X.Y\nX1X1X3X\'X&Y\x04X\'Y\x04Y\x02Y\x04X(X\'Y\x04X#X/X(Y\x05Y\x02X\'X7X9Y\x05X1X\'X3Y\x04Y\x05Y\x06X7Y\x02X)X\'Y\x04Y\x03X*X(X\'Y\x04X1X,Y\x04X\'X4X*X1Y\x03X\'Y\x04Y\x02X/Y\x05Y\nX9X7Y\nY\x03sByTagName(.jpg" alt="1px solid #.gif" alt="transparentinformationapplication" onclick="establishedadvertising.png" alt="environmentperformanceappropriate&amp;mdash;immediately</strong></rather thantemperaturedevelopmentcompetitionplaceholdervisibility:copyright">0" height="even thoughreplacementdestinationCorporation<ul class="AssociationindividualsperspectivesetTimeout(url(http://mathematicsmargin-top:eventually description) no-repeatcollections.JPG|thumb|participate/head><bodyfloat:left;<li class="hundreds of\n\nHowever, compositionclear:both;cooperationwithin the label for="border-top:New Zealandrecommendedphotographyinteresting&lt;sup&gt;controversyNetherlandsalternativemaxlength="switzerlandDevelopmentessentially\n\nAlthough </textarea>thunderbirdrepresented&amp;ndash;speculationcommunitieslegislationelectronics\n\t<div id="illustratedengineeringterritoriesauthoritiesdistributed6" height="sans-serif;capable of disappearedinteractivelooking forit would beAfghanistanwas createdMath.floor(surroundingcan also beobservationmaintenanceencountered<h2 class="more recentit has beeninvasion of).getTime()fundamentalDespite the"><div id="inspirationexaminationpreparationexplanation<input id="</a></span>versions ofinstrumentsbefore the = \'http://Descriptionrelatively .substring(each of theexperimentsinfluentialintegrationmany peopledue to the combinationdo not haveMiddle East<noscript><copyright" perhaps theinstitutionin Decemberarrangementmost famouspersonalitycreation oflimitationsexclusivelysovereignty-content">\n<td class="undergroundparallel todoctrine ofoccupied byterminologyRenaissancea number ofsupport forexplorationrecognitionpredecessor<img src="/<h1 class="publicationmay also bespecialized</fieldset>progressivemillions ofstates thatenforcementaround the one another.parentNodeagricultureAlternativeresearcherstowards theMost of themany other (especially<td width=";width:100%independent<h3 class=" onchange=").addClass(interactionOne of the daughter ofaccessoriesbranches of\r\n<div id="the largestdeclarationregulationsInformationtranslationdocumentaryin order to">\n<head>\n<" height="1across the orientation);</script>implementedcan be seenthere was ademonstratecontainer">connectionsthe Britishwas written!important;px; margin-followed byability to complicatedduring the immigrationalso called<h4 class="distinctionreplaced bygovernmentslocation ofin Novemberwhether the</p>\n</div>acquisitioncalled the persecutiondesignation{font-size:appeared ininvestigateexperiencedmost likelywidely useddiscussionspresence of (document.extensivelyIt has beenit does notcontrary toinhabitantsimprovementscholarshipconsumptioninstructionfor exampleone or morepx; paddingthe currenta series ofare usuallyrole in thepreviously derivativesevidence ofexperiencescolorschemestated thatcertificate</a></div>\n selected="high schoolresponse tocomfortableadoption ofthree yearsthe countryin Februaryso that thepeople who provided by<param nameaffected byin terms ofappointmentISO-8859-1"was born inhistorical regarded asmeasurementis based on and other : function(significantcelebrationtransmitted/js/jquery.is known astheoretical tabindex="it could be<noscript>\nhaving been\r\n<head>\r\n< &quot;The compilationhe had beenproduced byphilosopherconstructedintended toamong othercompared toto say thatEngineeringa differentreferred todifferencesbelief thatphotographsidentifyingHistory of Republic ofnecessarilyprobabilitytechnicallyleaving thespectacularfraction ofelectricityhead of therestaurantspartnershipemphasis onmost recentshare with saying thatfilled withdesigned toit is often"></iframe>as follows:merged withthrough thecommercial pointed outopportunityview of therequirementdivision ofprogramminghe receivedsetInterval"></span></in New Yorkadditional compression\n\n<div id="incorporate;</script><attachEventbecame the " target="_carried outSome of thescience andthe time ofContainer">maintainingChristopherMuch of thewritings of" height="2size of theversion of mixture of between theExamples ofeducationalcompetitive onsubmit="director ofdistinctive/DTD XHTML relating totendency toprovince ofwhich woulddespite thescientific legislature.innerHTML allegationsAgriculturewas used inapproach tointelligentyears later,sans-serifdeterminingPerformanceappearances, which is foundationsabbreviatedhigher thans from the individual composed ofsupposed toclaims thatattributionfont-size:1elements ofHistorical his brotherat the timeanniversarygoverned byrelated to ultimately innovationsit is stillcan only bedefinitionstoGMTStringA number ofimg class="Eventually,was changedoccurred inneighboringdistinguishwhen he wasintroducingterrestrialMany of theargues thatan Americanconquest ofwidespread were killedscreen and In order toexpected todescendantsare locatedlegislativegenerations backgroundmost peopleyears afterthere is nothe highestfrequently they do notargued thatshowed thatpredominanttheologicalby the timeconsideringshort-lived</span></a>can be usedvery littleone of the had alreadyinterpretedcommunicatefeatures ofgovernment,</noscript>entered the" height="3Independentpopulationslarge-scale. Although used in thedestructionpossibilitystarting intwo or moreexpressionssubordinatelarger thanhistory and</option>\r\nContinentaleliminatingwill not bepractice ofin front ofsite of theensure thatto create amississippipotentiallyoutstandingbetter thanwhat is nowsituated inmeta name="TraditionalsuggestionsTranslationthe form ofatmosphericideologicalenterprisescalculatingeast of theremnants ofpluginspage/index.php?remained intransformedHe was alsowas alreadystatisticalin favor ofMinistry ofmovement offormulationis required<link rel="This is the <a href="/popularizedinvolved inare used toand severalmade by theseems to belikely thatPalestiniannamed afterit had beenmost commonto refer tobut this isconsecutivetemporarilyIn general,conventionstakes placesubdivisionterritorialoperationalpermanentlywas largelyoutbreak ofin the pastfollowing a xmlns:og="><a class="class="textConversion may be usedmanufactureafter beingclearfix">\nquestion ofwas electedto become abecause of some peopleinspired bysuccessful a time whenmore commonamongst thean officialwidth:100%;technology,was adoptedto keep thesettlementslive birthsindex.html"Connecticutassigned to&amp;times;account foralign=rightthe companyalways beenreturned toinvolvementBecause thethis period" name="q" confined toa result ofvalue="" />is actuallyEnvironment\r\n</head>\r\nConversely,>\n<div id="0" width="1is probablyhave becomecontrollingthe problemcitizens ofpoliticiansreached theas early as:none; over<table cellvalidity ofdirectly toonmousedownwhere it iswhen it wasmembers of relation toaccommodatealong with In the latethe Englishdelicious">this is notthe presentif they areand finallya matter of\r\n\t</div>\r\n\r\n</script>faster thanmajority ofafter whichcomparativeto maintainimprove theawarded theer" class="frameborderrestorationin the sameanalysis oftheir firstDuring the continentalsequence offunction(){font-size: work on the</script>\n<begins withjavascript:constituentwas foundedequilibriumassume thatis given byneeds to becoordinatesthe variousare part ofonly in thesections ofis a commontheories ofdiscoveriesassociationedge of thestrength ofposition inpresent-dayuniversallyto form thebut insteadcorporationattached tois commonlyreasons for &quot;the can be madewas able towhich meansbut did notonMouseOveras possibleoperated bycoming fromthe primaryaddition offor severaltransferreda period ofare able tohowever, itshould havemuch larger\n\t</script>adopted theproperty ofdirected byeffectivelywas broughtchildren ofProgramminglonger thanmanuscriptswar againstby means ofand most ofsimilar to proprietaryoriginatingprestigiousgrammaticalexperience.to make theIt was alsois found incompetitorsin the U.S.replace thebrought thecalculationfall of thethe generalpracticallyin honor ofreleased inresidentialand some ofking of thereaction to1st Earl ofculture andprincipally</title>\n they can beback to thesome of hisexposure toare similarform of theaddFavoritecitizenshippart in thepeople within practiceto continue&amp;minus;approved by the first allowed theand for thefunctioningplaying thesolution toheight="0" in his bookmore than afollows thecreated thepresence in&nbsp;</td>nationalistthe idea ofa characterwere forced class="btndays of thefeatured inshowing theinterest inin place ofturn of thethe head ofLord of thepoliticallyhas its ownEducationalapproval ofsome of theeach other,behavior ofand becauseand anotherappeared onrecorded inblack&quot;may includethe world\'scan lead torefers to aborder="0" government winning theresulted in while the Washington,the subjectcity in the></div>\r\n\t\treflect theto completebecame moreradioactiverejected bywithout anyhis father,which couldcopy of theto indicatea politicalaccounts ofconstitutesworked wither</a></li>of his lifeaccompaniedclientWidthprevent theLegislativedifferentlytogether inhas severalfor anothertext of thefounded thee with the is used forchanged theusually theplace wherewhereas the> <a href=""><a href="themselves,although hethat can betraditionalrole of theas a resultremoveChilddesigned bywest of theSome peopleproduction,side of thenewslettersused by thedown to theaccepted bylive in theattempts tooutside thefrequenciesHowever, inprogrammersat least inapproximatealthough itwas part ofand variousGovernor ofthe articleturned into><a href="/the economyis the mostmost widelywould laterand perhapsrise to theoccurs whenunder whichconditions.the westerntheory thatis producedthe city ofin which heseen in thethe centralbuilding ofmany of hisarea of theis the onlymost of themany of thethe WesternThere is noextended toStatisticalcolspan=2 |short storypossible totopologicalcritical ofreported toa Christiandecision tois equal toproblems ofThis can bemerchandisefor most ofno evidenceeditions ofelements in&quot;. Thecom/images/which makesthe processremains theliterature,is a memberthe popularthe ancientproblems intime of thedefeated bybody of thea few yearsmuch of thethe work ofCalifornia,served as agovernment.concepts ofmovement in\t\t<div id="it" value="language ofas they areproduced inis that theexplain thediv></div>\nHowever thelead to the\t<a href="/was grantedpeople havecontinuallywas seen asand relatedthe role ofproposed byof the besteach other.Constantinepeople fromdialects ofto revisionwas renameda source ofthe initiallaunched inprovide theto the westwhere thereand similarbetween twois also theEnglish andconditions,that it wasentitled tothemselves.quantity ofransparencythe same asto join thecountry andthis is theThis led toa statementcontrast tolastIndexOfthrough hisis designedthe term isis providedprotect theng</a></li>The currentthe site ofsubstantialexperience,in the Westthey shouldslovenD\rinacomentariosuniversidadcondicionesactividadesexperienciatecnologC-aproducciC3npuntuaciC3naplicaciC3ncontraseC1acategorC-asregistrarseprofesionaltratamientoregC-stratesecretarC-aprincipalesprotecciC3nimportantesimportanciaposibilidadinteresantecrecimientonecesidadessuscribirseasociaciC3ndisponiblesevaluaciC3nestudiantesresponsableresoluciC3nguadalajararegistradosoportunidadcomercialesfotografC-aautoridadesingenierC-atelevisiC3ncompetenciaoperacionesestablecidosimplementeactualmentenavegaciC3nconformidadline-height:font-family:" : "http://applicationslink" href="specifically//<![CDATA[\nOrganizationdistribution0px; height:relationshipdevice-width<div class="<label for="registration</noscript>\n/index.html"window.open( !important;application/independence//www.googleorganizationautocompleterequirementsconservative<form name="intellectualmargin-left:18th centuryan importantinstitutionsabbreviation<img class="organisationcivilization19th centuryarchitectureincorporated20th century-container">most notably/></a></div>notification\'undefined\')Furthermore,believe thatinnerHTML = prior to thedramaticallyreferring tonegotiationsheadquartersSouth AfricaunsuccessfulPennsylvaniaAs a result,<html lang="&lt;/sup&gt;dealing withphiladelphiahistorically);</script>\npadding-top:experimentalgetAttributeinstructionstechnologiespart of the =function(){subscriptionl.dtd">\r\n<htgeographicalConstitution\', function(supported byagriculturalconstructionpublicationsfont-size: 1a variety of<div style="Encyclopediaiframe src="demonstratedaccomplisheduniversitiesDemographics);</script><dedicated toknowledge ofsatisfactionparticularly</div></div>English (US)appendChild(transmissions. However, intelligence" tabindex="float:right;Commonwealthranging fromin which theat least onereproductionencyclopedia;font-size:1jurisdictionat that time"><a class="In addition,description+conversationcontact withis generallyr" content="representing&lt;math&gt;presentationoccasionally<img width="navigation">compensationchampionshipmedia="all" violation ofreference toreturn true;Strict//EN" transactionsinterventionverificationInformation difficultiesChampionshipcapabilities<![endif]-->}\n</script>\nChristianityfor example,Professionalrestrictionssuggest thatwas released(such as theremoveClass(unemploymentthe Americanstructure of/index.html published inspan class=""><a href="/introductionbelonging toclaimed thatconsequences<meta name="Guide to theoverwhelmingagainst the concentrated,\n.nontouch observations</a>\n</div>\nf (document.border: 1px {font-size:1treatment of0" height="1modificationIndependencedivided intogreater thanachievementsestablishingJavaScript" neverthelesssignificanceBroadcasting>&nbsp;</td>container">\nsuch as the influence ofa particularsrc=\'http://navigation" half of the substantial &nbsp;</div>advantage ofdiscovery offundamental metropolitanthe opposite" xml:lang="deliberatelyalign=centerevolution ofpreservationimprovementsbeginning inJesus ChristPublicationsdisagreementtext-align:r, function()similaritiesbody></html>is currentlyalphabeticalis sometimestype="image/many of the flow:hidden;available indescribe theexistence ofall over thethe Internet\t<ul class="installationneighborhoodarmed forcesreducing thecontinues toNonetheless,temperatures\n\t\t<a href="close to theexamples of is about the(see below)." id="searchprofessionalis availablethe official\t\t</script>\n\n\t\t<div id="accelerationthrough the Hall of Famedescriptionstranslationsinterference type=\'text/recent yearsin the worldvery popular{background:traditional some of the connected toexploitationemergence ofconstitutionA History ofsignificant manufacturedexpectations><noscript><can be foundbecause the has not beenneighbouringwithout the added to the\t<li class="instrumentalSoviet Unionacknowledgedwhich can bename for theattention toattempts to developmentsIn fact, the<li class="aimplicationssuitable formuch of the colonizationpresidentialcancelBubble Informationmost of the is describedrest of the more or lessin SeptemberIntelligencesrc="http://px; height: available tomanufacturerhuman rightslink href="/availabilityproportionaloutside the astronomicalhuman beingsname of the are found inare based onsmaller thana person whoexpansion ofarguing thatnow known asIn the earlyintermediatederived fromScandinavian</a></div>\r\nconsider thean estimatedthe National<div id="pagresulting incommissionedanalogous toare required/ul>\n</div>\nwas based onand became a&nbsp;&nbsp;t" value="" was capturedno more thanrespectivelycontinue to >\r\n<head>\r\n<were createdmore generalinformation used for theindependent the Imperialcomponent ofto the northinclude the Constructionside of the would not befor instanceinvention ofmore complexcollectivelybackground: text-align: its originalinto accountthis processan extensivehowever, thethey are notrejected thecriticism ofduring whichprobably thethis article(function(){It should bean agreementaccidentallydiffers fromArchitecturebetter knownarrangementsinfluence onattended theidentical tosouth of thepass throughxml" title="weight:bold;creating thedisplay:nonereplaced the<img src="/ihttps://www.World War IItestimonialsfound in therequired to and that thebetween the was designedconsists of considerablypublished bythe languageConservationconsisted ofrefer to theback to the css" media="People from available onproved to besuggestions"was known asvarieties oflikely to becomprised ofsupport the hands of thecoupled withconnect and border:none;performancesbefore beinglater becamecalculationsoften calledresidents ofmeaning that><li class="evidence forexplanationsenvironments"></a></div>which allowsIntroductiondeveloped bya wide rangeon behalf ofvalign="top"principle ofat the time,</noscript>\rsaid to havein the firstwhile othershypotheticalphilosopherspower of thecontained inperformed byinability towere writtenspan style="input name="the questionintended forrejection ofimplies thatinvented thethe standardwas probablylink betweenprofessor ofinteractionschanging theIndian Ocean class="lastworking with\'http://www.years beforeThis was therecreationalentering themeasurementsan extremelyvalue of thestart of the\n</script>\n\nan effort toincrease theto the southspacing="0">sufficientlythe Europeanconverted toclearTimeoutdid not haveconsequentlyfor the nextextension ofeconomic andalthough theare producedand with theinsufficientgiven by thestating thatexpenditures</span></a>\nthought thaton the basiscellpadding=image of thereturning toinformation,separated byassassinateds" content="authority ofnorthwestern</div>\n<div "></div>\r\n consultationcommunity ofthe nationalit should beparticipants align="leftthe greatestselection ofsupernaturaldependent onis mentionedallowing thewas inventedaccompanyinghis personalavailable atstudy of theon the otherexecution ofHuman Rightsterms of theassociationsresearch andsucceeded bydefeated theand from thebut they arecommander ofstate of theyears of agethe study of<ul class="splace in thewhere he was<li class="fthere are nowhich becamehe publishedexpressed into which thecommissionerfont-weight:territory ofextensions">Roman Empireequal to theIn contrast,however, andis typicallyand his wife(also called><ul class="effectively evolved intoseem to havewhich is thethere was noan excellentall of thesedescribed byIn practice,broadcastingcharged withreflected insubjected tomilitary andto the pointeconomicallysetTargetingare actuallyvictory over();</script>continuouslyrequired forevolutionaryan effectivenorth of the, which was front of theor otherwisesome form ofhad not beengenerated byinformation.permitted toincludes thedevelopment,entered intothe previousconsistentlyare known asthe field ofthis type ofgiven to thethe title ofcontains theinstances ofin the northdue to theirare designedcorporationswas that theone of thesemore popularsucceeded insupport fromin differentdominated bydesigned forownership ofand possiblystandardizedresponseTextwas intendedreceived theassumed thatareas of theprimarily inthe basis ofin the senseaccounts fordestroyed byat least twowas declaredcould not beSecretary ofappear to bemargin-top:1/^\\s+|\\s+$/ge){throw e};the start oftwo separatelanguage andwho had beenoperation ofdeath of thereal numbers\t<link rel="provided thethe story ofcompetitionsenglish (UK)english (US)P\x1cP>P=P3P>P;P!Q\0P?Q\x01P:P8Q\x01Q\0P?Q\x01P:P8Q\x01Q\0P?Q\x01P:P>Y\x04X9X1X(Y\nX)f-#i+\x14d8-f\x16\x07g.\0d=\x13d8-f\x16\x07g9\x01d=\x13d8-f\x16\x07f\x1c\ti\x19\x10e\x05,e\x0f8d::f0\x11f\x14?e:\x1ci\x18?i\x07\fe74e74g$>d<\x1ad8;d9\tf\x13\rd=\x1cg3;g;\x1ff\x14?g-\x16f3\x15h\'\x04informaciC3nherramientaselectrC3nicodescripciC3nclasificadosconocimientopublicaciC3nrelacionadasinformC!ticarelacionadosdepartamentotrabajadoresdirectamenteayuntamientomercadoLibrecontC!ctenoshabitacionescumplimientorestaurantesdisposiciC3nconsecuenciaelectrC3nicaaplicacionesdesconectadoinstalaciC3nrealizaciC3nutilizaciC3nenciclopediaenfermedadesinstrumentosexperienciasinstituciC3nparticularessubcategoriaQ\x02P>P;Q\fP:P>P P>Q\x01Q\x01P8P8Q\0P0P1P>Q\x02Q\vP1P>P;Q\fQ\bP5P?Q\0P>Q\x01Q\x02P>P<P>P6P5Q\x02P5P4Q\0Q\x03P3P8Q\x05Q\x01P;Q\x03Q\x07P0P5Q\x01P5P9Q\x07P0Q\x01P2Q\x01P5P3P4P0P P>Q\x01Q\x01P8Q\x0fP\x1cP>Q\x01P:P2P5P4Q\0Q\x03P3P8P5P3P>Q\0P>P4P0P2P>P?Q\0P>Q\x01P4P0P=P=Q\vQ\x05P4P>P;P6P=Q\vP8P<P5P=P=P>P\x1cP>Q\x01P:P2Q\vQ\0Q\x03P1P;P5P9P\x1cP>Q\x01P:P2P0Q\x01Q\x02Q\0P0P=Q\vP=P8Q\x07P5P3P>Q\0P0P1P>Q\x02P5P4P>P;P6P5P=Q\x03Q\x01P;Q\x03P3P8Q\x02P5P?P5Q\0Q\fP\x1eP4P=P0P:P>P?P>Q\x02P>P<Q\x03Q\0P0P1P>Q\x02Q\x03P0P?Q\0P5P;Q\x0fP2P>P>P1Q\tP5P>P4P=P>P3P>Q\x01P2P>P5P3P>Q\x01Q\x02P0Q\x02Q\fP8P4Q\0Q\x03P3P>P9Q\x04P>Q\0Q\x03P<P5Q\x05P>Q\0P>Q\bP>P?Q\0P>Q\x02P8P2Q\x01Q\x01Q\vP;P:P0P:P0P6P4Q\vP9P2P;P0Q\x01Q\x02P8P3Q\0Q\x03P?P?Q\vP2P<P5Q\x01Q\x02P5Q\0P0P1P>Q\x02P0Q\x01P:P0P7P0P;P?P5Q\0P2Q\vP9P4P5P;P0Q\x02Q\fP4P5P=Q\fP3P8P?P5Q\0P8P>P4P1P8P7P=P5Q\x01P>Q\x01P=P>P2P5P<P>P<P5P=Q\x02P:Q\x03P?P8Q\x02Q\fP4P>P;P6P=P0Q\0P0P<P:P0Q\x05P=P0Q\x07P0P;P>P P0P1P>Q\x02P0P"P>P;Q\fP:P>Q\x01P>P2Q\x01P5P<P2Q\x02P>Q\0P>P9P=P0Q\x07P0P;P0Q\x01P?P8Q\x01P>P:Q\x01P;Q\x03P6P1Q\vQ\x01P8Q\x01Q\x02P5P<P?P5Q\x07P0Q\x02P8P=P>P2P>P3P>P?P>P<P>Q\tP8Q\x01P0P9Q\x02P>P2P?P>Q\x07P5P<Q\x03P?P>P<P>Q\tQ\fP4P>P;P6P=P>Q\x01Q\x01Q\vP;P:P8P1Q\vQ\x01Q\x02Q\0P>P4P0P=P=Q\vP5P<P=P>P3P8P5P?Q\0P>P5P:Q\x02P!P5P9Q\x07P0Q\x01P<P>P4P5P;P8Q\x02P0P:P>P3P>P>P=P;P0P9P=P3P>Q\0P>P4P5P2P5Q\0Q\x01P8Q\x0fQ\x01Q\x02Q\0P0P=P5Q\x04P8P;Q\fP<Q\vQ\x03Q\0P>P2P=Q\x0fQ\0P0P7P=Q\vQ\x05P8Q\x01P:P0Q\x02Q\fP=P5P4P5P;Q\x0eQ\x0fP=P2P0Q\0Q\x0fP<P5P=Q\fQ\bP5P<P=P>P3P8Q\x05P4P0P=P=P>P9P7P=P0Q\x07P8Q\x02P=P5P;Q\fP7Q\x0fQ\x04P>Q\0Q\x03P<P0P"P5P?P5Q\0Q\fP<P5Q\x01Q\x0fQ\x06P0P7P0Q\tP8Q\x02Q\vP\x1bQ\x03Q\x07Q\bP8P5`$(`$9`%\0`$\x02`$\x15`$0`$(`%\x07`$\x05`$*`$(`%\x07`$\x15`$?`$/`$>`$\x15`$0`%\x07`$\x02`$\x05`$(`%\r`$/`$\x15`%\r`$/`$>`$\x17`$>`$\x07`$!`$,`$>`$0`%\x07`$\x15`$?`$8`%\0`$&`$?`$/`$>`$*`$9`$2`%\x07`$8`$?`$\x02`$9`$-`$>`$0`$$`$\x05`$*`$(`%\0`$5`$>`$2`%\x07`$8`%\x07`$5`$>`$\x15`$0`$$`%\x07`$.`%\x07`$0`%\x07`$9`%\v`$(`%\x07`$8`$\x15`$$`%\x07`$,`$9`%\x01`$$`$8`$>`$\x07`$\x1f`$9`%\v`$\x17`$>`$\x1c`$>`$(`%\x07`$.`$?`$(`$\x1f`$\x15`$0`$$`$>`$\x15`$0`$(`$>`$\t`$(`$\x15`%\x07`$/`$9`$>`$\x01`$8`$,`$8`%\x07`$-`$>`$7`$>`$\x06`$*`$\x15`%\x07`$2`$?`$/`%\x07`$6`%\x01`$0`%\x02`$\x07`$8`$\x15`%\x07`$\x18`$\x02`$\x1f`%\x07`$.`%\x07`$0`%\0`$8`$\x15`$$`$>`$.`%\x07`$0`$>`$2`%\x07`$\x15`$0`$\x05`$\'`$?`$\x15`$\x05`$*`$(`$>`$8`$.`$>`$\x1c`$.`%\x01`$\x1d`%\x07`$\x15`$>`$0`$#`$9`%\v`$$`$>`$\x15`$!`$<`%\0`$/`$9`$>`$\x02`$9`%\v`$\x1f`$2`$6`$,`%\r`$&`$2`$?`$/`$>`$\x1c`%\0`$5`$(`$\x1c`$>`$$`$>`$\x15`%\b`$8`%\x07`$\x06`$*`$\x15`$>`$5`$>`$2`%\0`$&`%\x07`$(`%\x07`$*`%\x02`$0`%\0`$*`$>`$(`%\0`$\t`$8`$\x15`%\x07`$9`%\v`$\x17`%\0`$,`%\b`$ `$\x15`$\x06`$*`$\x15`%\0`$5`$0`%\r`$7`$\x17`$>`$\x02`$5`$\x06`$*`$\x15`%\v`$\x1c`$?`$2`$>`$\x1c`$>`$(`$>`$8`$9`$.`$$`$9`$.`%\x07`$\x02`$\t`$(`$\x15`%\0`$/`$>`$9`%\x02`$&`$0`%\r`$\x1c`$8`%\x02`$\x1a`%\0`$*`$8`$\x02`$&`$8`$5`$>`$2`$9`%\v`$(`$>`$9`%\v`$$`%\0`$\x1c`%\b`$8`%\x07`$5`$>`$*`$8`$\x1c`$(`$$`$>`$(`%\x07`$$`$>`$\x1c`$>`$0`%\0`$\x18`$>`$/`$2`$\x1c`$?`$2`%\x07`$(`%\0`$\x1a`%\x07`$\x1c`$>`$\x02`$\x1a`$*`$$`%\r`$0`$\x17`%\x02`$\x17`$2`$\x1c`$>`$$`%\x07`$,`$>`$9`$0`$\x06`$*`$(`%\x07`$5`$>`$9`$(`$\x07`$8`$\x15`$>`$8`%\x01`$,`$9`$0`$9`$(`%\x07`$\x07`$8`$8`%\x07`$8`$9`$?`$$`$,`$!`$<`%\x07`$\x18`$\x1f`$(`$>`$$`$2`$>`$6`$*`$>`$\x02`$\x1a`$6`%\r`$0`%\0`$,`$!`$<`%\0`$9`%\v`$$`%\x07`$8`$>`$\b`$\x1f`$6`$>`$/`$&`$8`$\x15`$$`%\0`$\x1c`$>`$$`%\0`$5`$>`$2`$>`$9`$\x1c`$>`$0`$*`$\x1f`$(`$>`$0`$\x16`$(`%\x07`$8`$!`$<`$\x15`$.`$?`$2`$>`$\t`$8`$\x15`%\0`$\x15`%\x07`$5`$2`$2`$\x17`$$`$>`$\x16`$>`$(`$>`$\x05`$0`%\r`$%`$\x1c`$9`$>`$\x02`$&`%\x07`$\x16`$>`$*`$9`$2`%\0`$(`$?`$/`$.`$,`$?`$(`$>`$,`%\b`$\x02`$\x15`$\x15`$9`%\0`$\x02`$\x15`$9`$(`$>`$&`%\x07`$$`$>`$9`$.`$2`%\x07`$\x15`$>`$+`%\0`$\x1c`$,`$\x15`$?`$$`%\x01`$0`$$`$.`$>`$\x02`$\x17`$5`$9`%\0`$\x02`$0`%\v`$\x1c`$<`$.`$?`$2`%\0`$\x06`$0`%\v`$*`$8`%\x07`$(`$>`$/`$>`$&`$5`$2`%\x07`$(`%\x07`$\x16`$>`$$`$>`$\x15`$0`%\0`$,`$\t`$(`$\x15`$>`$\x1c`$5`$>`$,`$*`%\x02`$0`$>`$,`$!`$<`$>`$8`%\f`$&`$>`$6`%\x07`$/`$0`$\x15`$?`$/`%\x07`$\x15`$9`$>`$\x02`$\x05`$\x15`$8`$0`$,`$(`$>`$\x0f`$5`$9`$>`$\x02`$8`%\r`$%`$2`$.`$?`$2`%\x07`$2`%\x07`$\x16`$\x15`$5`$?`$7`$/`$\x15`%\r`$0`$\x02`$8`$.`%\x02`$9`$%`$>`$(`$>X*X3X*X7Y\nX9Y\x05X4X\'X1Y\x03X)X(Y\bX\'X3X7X)X\'Y\x04X5Y\x01X-X)Y\x05Y\bX\'X6Y\nX9X\'Y\x04X.X\'X5X)X\'Y\x04Y\x05X2Y\nX/X\'Y\x04X9X\'Y\x05X)X\'Y\x04Y\x03X\'X*X(X\'Y\x04X1X/Y\bX/X(X1Y\x06X\'Y\x05X,X\'Y\x04X/Y\bY\x04X)X\'Y\x04X9X\'Y\x04Y\x05X\'Y\x04Y\x05Y\bY\x02X9X\'Y\x04X9X1X(Y\nX\'Y\x04X3X1Y\nX9X\'Y\x04X,Y\bX\'Y\x04X\'Y\x04X0Y\x07X\'X(X\'Y\x04X-Y\nX\'X)X\'Y\x04X-Y\x02Y\bY\x02X\'Y\x04Y\x03X1Y\nY\x05X\'Y\x04X9X1X\'Y\x02Y\x05X-Y\x01Y\bX8X)X\'Y\x04X+X\'Y\x06Y\nY\x05X4X\'Y\x07X/X)X\'Y\x04Y\x05X1X#X)X\'Y\x04Y\x02X1X"Y\x06X\'Y\x04X4X(X\'X(X\'Y\x04X-Y\bX\'X1X\'Y\x04X,X/Y\nX/X\'Y\x04X#X3X1X)X\'Y\x04X9Y\x04Y\bY\x05Y\x05X,Y\x05Y\bX9X)X\'Y\x04X1X-Y\x05Y\x06X\'Y\x04Y\x06Y\x02X\'X7Y\x01Y\x04X3X7Y\nY\x06X\'Y\x04Y\x03Y\bY\nX*X\'Y\x04X/Y\x06Y\nX\'X(X1Y\x03X\'X*Y\x07X\'Y\x04X1Y\nX\'X6X*X-Y\nX\'X*Y\nX(X*Y\bY\x02Y\nX*X\'Y\x04X#Y\bY\x04Y\tX\'Y\x04X(X1Y\nX/X\'Y\x04Y\x03Y\x04X\'Y\x05X\'Y\x04X1X\'X(X7X\'Y\x04X4X.X5Y\nX3Y\nX\'X1X\'X*X\'Y\x04X+X\'Y\x04X+X\'Y\x04X5Y\x04X\'X)X\'Y\x04X-X/Y\nX+X\'Y\x04X2Y\bX\'X1X\'Y\x04X.Y\x04Y\nX,X\'Y\x04X,Y\x05Y\nX9X\'Y\x04X9X\'Y\x05Y\x07X\'Y\x04X,Y\x05X\'Y\x04X\'Y\x04X3X\'X9X)Y\x05X4X\'Y\x07X/Y\x07X\'Y\x04X1X&Y\nX3X\'Y\x04X/X.Y\bY\x04X\'Y\x04Y\x01Y\x06Y\nX)X\'Y\x04Y\x03X*X\'X(X\'Y\x04X/Y\bX1Y\nX\'Y\x04X/X1Y\bX3X\'X3X*X:X1Y\x02X*X5X\'Y\x05Y\nY\x05X\'Y\x04X(Y\x06X\'X*X\'Y\x04X9X8Y\nY\x05entertainmentunderstanding = function().jpg" width="configuration.png" width="<body class="Math.random()contemporary United Statescircumstances.appendChild(organizations<span class=""><img src="/distinguishedthousands of communicationclear"></div>investigationfavicon.ico" margin-right:based on the Massachusettstable border=internationalalso known aspronunciationbackground:#fpadding-left:For example, miscellaneous&lt;/math&gt;psychologicalin particularearch" type="form method="as opposed toSupreme Courtoccasionally Additionally,North Americapx;backgroundopportunitiesEntertainment.toLowerCase(manufacturingprofessional combined withFor instance,consisting of" maxlength="return false;consciousnessMediterraneanextraordinaryassassinationsubsequently button type="the number ofthe original comprehensiverefers to the</ul>\n</div>\nphilosophicallocation.hrefwas publishedSan Francisco(function(){\n<div id="mainsophisticatedmathematical /head>\r\n<bodysuggests thatdocumentationconcentrationrelationshipsmay have been(for example,This article in some casesparts of the definition ofGreat Britain cellpadding=equivalent toplaceholder="; font-size: justificationbelieved thatsuffered fromattempted to leader of thecript" src="/(function() {are available\n\t<link rel=" src=\'http://interested inconventional " alt="" /></are generallyhas also beenmost popular correspondingcredited withtyle="border:</a></span></.gif" width="<iframe src="table class="inline-block;according to together withapproximatelyparliamentarymore and moredisplay:none;traditionallypredominantly&nbsp;|&nbsp;&nbsp;</span> cellspacing=<input name="or" content="controversialproperty="og:/x-shockwave-demonstrationsurrounded byNevertheless,was the firstconsiderable Although the collaborationshould not beproportion of<span style="known as the shortly afterfor instance,described as /head>\n<body starting withincreasingly the fact thatdiscussion ofmiddle of thean individualdifficult to point of viewhomosexualityacceptance of</span></div>manufacturersorigin of thecommonly usedimportance ofdenominationsbackground: #length of thedeterminationa significant" border="0">revolutionaryprinciples ofis consideredwas developedIndo-Europeanvulnerable toproponents ofare sometimescloser to theNew York City name="searchattributed tocourse of themathematicianby the end ofat the end of" border="0" technological.removeClass(branch of theevidence that![endif]-->\r\nInstitute of into a singlerespectively.and thereforeproperties ofis located insome of whichThere is alsocontinued to appearance of &amp;ndash; describes theconsiderationauthor of theindependentlyequipped withdoes not have</a><a href="confused with<link href="/at the age ofappear in theThese includeregardless ofcould be used style=&quot;several timesrepresent thebody>\n</html>thought to bepopulation ofpossibilitiespercentage ofaccess to thean attempt toproduction ofjquery/jquerytwo differentbelong to theestablishmentreplacing thedescription" determine theavailable forAccording to wide range of\t<div class="more commonlyorganisationsfunctionalitywas completed &amp;mdash; participationthe characteran additionalappears to befact that thean example ofsignificantlyonmouseover="because they async = true;problems withseems to havethe result of src="http://familiar withpossession offunction () {took place inand sometimessubstantially<span></span>is often usedin an attemptgreat deal ofEnvironmentalsuccessfully virtually all20th century,professionalsnecessary to determined bycompatibilitybecause it isDictionary ofmodificationsThe followingmay refer to:Consequently,Internationalalthough somethat would beworld\'s firstclassified asbottom of the(particularlyalign="left" most commonlybasis for thefoundation ofcontributionspopularity ofcenter of theto reduce thejurisdictionsapproximation onmouseout="New Testamentcollection of</span></a></in the Unitedfilm director-strict.dtd">has been usedreturn to thealthough thischange in theseveral otherbut there areunprecedentedis similar toespecially inweight: bold;is called thecomputationalindicate thatrestricted to\t<meta name="are typicallyconflict withHowever, the An example ofcompared withquantities ofrather than aconstellationnecessary forreported thatspecificationpolitical and&nbsp;&nbsp;<references tothe same yearGovernment ofgeneration ofhave not beenseveral yearscommitment to\t\t<ul class="visualization19th century,practitionersthat he wouldand continuedoccupation ofis defined ascentre of thethe amount of><div style="equivalent ofdifferentiatebrought aboutmargin-left: automaticallythought of asSome of these\n<div class="input class="replaced withis one of theeducation andinfluenced byreputation as\n<meta name="accommodation</div>\n</div>large part ofInstitute forthe so-called against the In this case,was appointedclaimed to beHowever, thisDepartment ofthe remainingeffect on theparticularly deal with the\n<div style="almost alwaysare currentlyexpression ofphilosophy offor more thancivilizationson the islandselectedIndexcan result in" value="" />the structure /></a></div>Many of thesecaused by theof the Unitedspan class="mcan be tracedis related tobecame one ofis frequentlyliving in thetheoreticallyFollowing theRevolutionarygovernment inis determinedthe politicalintroduced insufficient todescription">short storiesseparation ofas to whetherknown for itswas initiallydisplay:blockis an examplethe principalconsists of arecognized as/body></html>a substantialreconstructedhead of stateresistance toundergraduateThere are twogravitationalare describedintentionallyserved as theclass="headeropposition tofundamentallydominated theand the otheralliance withwas forced torespectively,and politicalin support ofpeople in the20th century.and publishedloadChartbeatto understandmember statesenvironmentalfirst half ofcountries andarchitecturalbe consideredcharacterizedclearIntervalauthoritativeFederation ofwas succeededand there area consequencethe Presidentalso includedfree softwaresuccession ofdeveloped thewas destroyedaway from the;\n</script>\n<although theyfollowed by amore powerfulresulted in aUniversity ofHowever, manythe presidentHowever, someis thought tountil the endwas announcedare importantalso includes><input type=the center of DO NOT ALTERused to referthemes/?sort=that had beenthe basis forhas developedin the summercomparativelydescribed thesuch as thosethe resultingis impossiblevarious otherSouth Africanhave the sameeffectivenessin which case; text-align:structure and; background:regarding thesupported theis also knownstyle="marginincluding thebahasa Melayunorsk bokmC%lnorsk nynorskslovenE!D\rinainternacionalcalificaciC3ncomunicaciC3nconstrucciC3n"><div class="disambiguationDomainName\', \'administrationsimultaneouslytransportationInternational margin-bottom:responsibility<![endif]-->\n</><meta name="implementationinfrastructurerepresentationborder-bottom:</head>\n<body>=http%3A%2F%2F<form method="method="post" /favicon.ico" });\n</script>\n.setAttribute(Administration= new Array();<![endif]-->\r\ndisplay:block;Unfortunately,">&nbsp;</div>/favicon.ico">=\'stylesheet\' identification, for example,<li><a href="/an alternativeas a result ofpt"></script>\ntype="submit" \n(function() {recommendationform action="/transformationreconstruction.style.display According to hidden" name="along with thedocument.body.approximately Communicationspost" action="meaning &quot;--<![endif]-->Prime Ministercharacteristic</a> <a class=the history of onmouseover="the governmenthref="https://was originallywas introducedclassificationrepresentativeare considered<![endif]-->\n\ndepends on theUniversity of in contrast to placeholder="in the case ofinternational constitutionalstyle="border-: function() {Because of the-strict.dtd">\n<table class="accompanied byaccount of the<script src="/nature of the the people in in addition tos); js.id = id" width="100%"regarding the Roman Catholican independentfollowing the .gif" width="1the following discriminationarchaeologicalprime minister.js"></script>combination of marginwidth="createElement(w.attachEvent(</a></td></tr>src="https://aIn particular, align="left" Czech RepublicUnited Kingdomcorrespondenceconcluded that.html" title="(function () {comes from theapplication of<span class="sbelieved to beement(\'script\'</a>\n</li>\n<livery different><span class="option value="(also known as\t<li><a href="><input name="separated fromreferred to as valign="top">founder of theattempting to carbon dioxide\n\n<div class="class="search-/body>\n</html>opportunity tocommunications</head>\r\n<body style="width:Tia:?ng Via;\x07tchanges in theborder-color:#0" border="0" </span></div><was discovered" type="text" );\n</script>\n\nDepartment of ecclesiasticalthere has beenresulting from</body></html>has never beenthe first timein response toautomatically </div>\n\n<div iwas consideredpercent of the" /></a></div>collection of descended fromsection of theaccept-charsetto be confusedmember of the padding-right:translation ofinterpretation href=\'http://whether or notThere are alsothere are manya small numberother parts ofimpossible to class="buttonlocated in the. However, theand eventuallyAt the end of because of itsrepresents the<form action=" method="post"it is possiblemore likely toan increase inhave also beencorresponds toannounced thatalign="right">many countriesfor many yearsearliest knownbecause it waspt"></script>\r valign="top" inhabitants offollowing year\r\n<div class="million peoplecontroversial concerning theargue that thegovernment anda reference totransferred todescribing the style="color:although therebest known forsubmit" name="multiplicationmore than one recognition ofCouncil of theedition of the <meta name="Entertainment away from the ;margin-right:at the time ofinvestigationsconnected withand many otheralthough it isbeginning with <span class="descendants of<span class="i align="right"</head>\n<body aspects of thehas since beenEuropean Unionreminiscent ofmore difficultVice Presidentcomposition ofpassed throughmore importantfont-size:11pxexplanation ofthe concept ofwritten in the\t<span class="is one of the resemblance toon the groundswhich containsincluding the defined by thepublication ofmeans that theoutside of thesupport of the<input class="<span class="t(Math.random()most prominentdescription ofConstantinoplewere published<div class="seappears in the1" height="1" most importantwhich includeswhich had beendestruction ofthe population\n\t<div class="possibility ofsometimes usedappear to havesuccess of theintended to bepresent in thestyle="clear:b\r\n</script>\r\n<was founded ininterview with_id" content="capital of the\r\n<link rel="srelease of thepoint out thatxMLHttpRequestand subsequentsecond largestvery importantspecificationssurface of theapplied to theforeign policy_setDomainNameestablished inis believed toIn addition tomeaning of theis named afterto protect theis representedDeclaration ofmore efficientClassificationother forms ofhe returned to<span class="cperformance of(function() {\rif and only ifregions of theleading to therelations withUnited Nationsstyle="height:other than theype" content="Association of\n</head>\n<bodylocated on theis referred to(including theconcentrationsthe individualamong the mostthan any other/>\n<link rel=" return false;the purpose ofthe ability to;color:#fff}\n.\n<span class="the subject ofdefinitions of>\r\n<link rel="claim that thehave developed<table width="celebration ofFollowing the to distinguish<span class="btakes place inunder the namenoted that the><![endif]-->\nstyle="margin-instead of theintroduced thethe process ofincreasing thedifferences inestimated thatespecially the/div><div id="was eventuallythroughout histhe differencesomething thatspan></span></significantly ></script>\r\n\r\nenvironmental to prevent thehave been usedespecially forunderstand theis essentiallywere the firstis the largesthave been made" src="http://interpreted assecond half ofcrolling="no" is composed ofII, Holy Romanis expected tohave their owndefined as thetraditionally have differentare often usedto ensure thatagreement withcontaining theare frequentlyinformation onexample is theresulting in a</a></li></ul> class="footerand especiallytype="button" </span></span>which included>\n<meta name="considered thecarried out byHowever, it isbecame part ofin relation topopular in thethe capital ofwas officiallywhich has beenthe History ofalternative todifferent fromto support thesuggested thatin the process <div class="the foundationbecause of hisconcerned withthe universityopposed to thethe context of<span class="ptext" name="q"\t\t<div class="the scientificrepresented bymathematicianselected by thethat have been><div class="cdiv id="headerin particular,converted into);\n</script>\n<philosophical srpskohrvatskitia:?ng Via;\x07tP Q\x03Q\x01Q\x01P:P8P9Q\0Q\x03Q\x01Q\x01P:P8P9investigaciC3nparticipaciC3nP:P>Q\x02P>Q\0Q\vP5P>P1P;P0Q\x01Q\x02P8P:P>Q\x02P>Q\0Q\vP9Q\x07P5P;P>P2P5P:Q\x01P8Q\x01Q\x02P5P<Q\vP\x1dP>P2P>Q\x01Q\x02P8P:P>Q\x02P>Q\0Q\vQ\x05P>P1P;P0Q\x01Q\x02Q\fP2Q\0P5P<P5P=P8P:P>Q\x02P>Q\0P0Q\x0fQ\x01P5P3P>P4P=Q\x0fQ\x01P:P0Q\x07P0Q\x02Q\fP=P>P2P>Q\x01Q\x02P8P#P:Q\0P0P8P=Q\vP2P>P?Q\0P>Q\x01Q\vP:P>Q\x02P>Q\0P>P9Q\x01P4P5P;P0Q\x02Q\fP?P>P<P>Q\tQ\fQ\x0eQ\x01Q\0P5P4Q\x01Q\x02P2P>P1Q\0P0P7P>P<Q\x01Q\x02P>Q\0P>P=Q\vQ\x03Q\x07P0Q\x01Q\x02P8P5Q\x02P5Q\x07P5P=P8P5P\x13P;P0P2P=P0Q\x0fP8Q\x01Q\x02P>Q\0P8P8Q\x01P8Q\x01Q\x02P5P<P0Q\0P5Q\bP5P=P8Q\x0fP!P:P0Q\x07P0Q\x02Q\fP?P>Q\rQ\x02P>P<Q\x03Q\x01P;P5P4Q\x03P5Q\x02Q\x01P:P0P7P0Q\x02Q\fQ\x02P>P2P0Q\0P>P2P:P>P=P5Q\x07P=P>Q\0P5Q\bP5P=P8P5P:P>Q\x02P>Q\0P>P5P>Q\0P3P0P=P>P2P:P>Q\x02P>Q\0P>P<P P5P:P;P0P<P0X\'Y\x04Y\x05Y\x06X*X/Y\tY\x05Y\x06X*X/Y\nX\'X*X\'Y\x04Y\x05Y\bX6Y\bX9X\'Y\x04X(X1X\'Y\x05X,X\'Y\x04Y\x05Y\bX\'Y\x02X9X\'Y\x04X1X3X\'X&Y\x04Y\x05X4X\'X1Y\x03X\'X*X\'Y\x04X#X9X6X\'X!X\'Y\x04X1Y\nX\'X6X)X\'Y\x04X*X5Y\x05Y\nY\x05X\'Y\x04X\'X9X6X\'X!X\'Y\x04Y\x06X*X\'X&X,X\'Y\x04X#Y\x04X9X\'X(X\'Y\x04X*X3X,Y\nY\x04X\'Y\x04X#Y\x02X3X\'Y\x05X\'Y\x04X6X:X7X\'X*X\'Y\x04Y\x01Y\nX/Y\nY\bX\'Y\x04X*X1X-Y\nX(X\'Y\x04X,X/Y\nX/X)X\'Y\x04X*X9Y\x04Y\nY\x05X\'Y\x04X#X.X(X\'X1X\'Y\x04X\'Y\x01Y\x04X\'Y\x05X\'Y\x04X#Y\x01Y\x04X\'Y\x05X\'Y\x04X*X\'X1Y\nX.X\'Y\x04X*Y\x02Y\x06Y\nX)X\'Y\x04X\'Y\x04X9X\'X(X\'Y\x04X.Y\bX\'X7X1X\'Y\x04Y\x05X,X*Y\x05X9X\'Y\x04X/Y\nY\x03Y\bX1X\'Y\x04X3Y\nX\'X-X)X9X(X/X\'Y\x04Y\x04Y\x07X\'Y\x04X*X1X(Y\nX)X\'Y\x04X1Y\bX\'X(X7X\'Y\x04X#X/X(Y\nX)X\'Y\x04X\'X.X(X\'X1X\'Y\x04Y\x05X*X-X/X)X\'Y\x04X\'X:X\'Y\x06Y\ncursor:pointer;</title>\n<meta " href="http://"><span class="members of the window.locationvertical-align:/a> | <a href="<!doctype html>media="screen" <option value="favicon.ico" />\n\t\t<div class="characteristics" method="get" /body>\n</html>\nshortcut icon" document.write(padding-bottom:representativessubmit" value="align="center" throughout the science fiction\n <div class="submit" class="one of the most valign="top"><was established);\r\n</script>\r\nreturn false;">).style.displaybecause of the document.cookie<form action="/}body{margin:0;Encyclopedia ofversion of the .createElement(name" content="</div>\n</div>\n\nadministrative </body>\n</html>history of the "><input type="portion of the as part of the &nbsp;<a href="other countries">\n<div class="</span></span><In other words,display: block;control of the introduction of/>\n<meta name="as well as the in recent years\r\n\t<div class="</div>\n\t</div>\ninspired by thethe end of the compatible withbecame known as style="margin:.js"></script>< International there have beenGerman language style="color:#Communist Partyconsistent withborder="0" cell marginheight="the majority of" align="centerrelated to the many different Orthodox Churchsimilar to the />\n<link rel="swas one of the until his death})();\n</script>other languagescompared to theportions of thethe Netherlandsthe most commonbackground:url(argued that thescrolling="no" included in theNorth American the name of theinterpretationsthe traditionaldevelopment of frequently useda collection ofvery similar tosurrounding theexample of thisalign="center">would have beenimage_caption =attached to thesuggesting thatin the form of involved in theis derived fromnamed after theIntroduction torestrictions on style="width: can be used to the creation ofmost important information andresulted in thecollapse of theThis means thatelements of thewas replaced byanalysis of theinspiration forregarded as themost successfulknown as &quot;a comprehensiveHistory of the were consideredreturned to theare referred toUnsourced image>\n\t<div class="consists of thestopPropagationinterest in theavailability ofappears to haveelectromagneticenableServices(function of theIt is important</script></div>function(){var relative to theas a result of the position ofFor example, in method="post" was followed by&amp;mdash; thethe applicationjs"></script>\r\nul></div></div>after the deathwith respect tostyle="padding:is particularlydisplay:inline; type="submit" is divided intod8-f\x16\x07 (g.\0d=\x13)responsabilidadadministraciC3ninternacionalescorrespondiente`$\t`$*`$/`%\v`$\x17`$*`%\x02`$0`%\r`$5`$9`$.`$>`$0`%\x07`$2`%\v`$\x17`%\v`$\x02`$\x1a`%\x01`$(`$>`$5`$2`%\x07`$\x15`$?`$(`$8`$0`$\x15`$>`$0`$*`%\x01`$2`$?`$8`$\x16`%\v`$\x1c`%\x07`$\x02`$\x1a`$>`$9`$?`$\x0f`$-`%\x07`$\x1c`%\x07`$\x02`$6`$>`$.`$?`$2`$9`$.`$>`$0`%\0`$\x1c`$>`$\x17`$0`$#`$,`$(`$>`$(`%\x07`$\x15`%\x01`$.`$>`$0`$,`%\r`$2`%\t`$\x17`$.`$>`$2`$?`$\x15`$.`$9`$?`$2`$>`$*`%\x03`$7`%\r`$ `$,`$"`$<`$$`%\x07`$-`$>`$\x1c`$*`$>`$\x15`%\r`$2`$?`$\x15`$\x1f`%\r`$0`%\x07`$(`$\x16`$?`$2`$>`$+`$&`%\f`$0`$>`$(`$.`$>`$.`$2`%\x07`$.`$$`$&`$>`$(`$,`$>`$\x1c`$>`$0`$5`$?`$\x15`$>`$8`$\x15`%\r`$/`%\v`$\x02`$\x1a`$>`$9`$$`%\x07`$*`$9`%\x01`$\x01`$\x1a`$,`$$`$>`$/`$>`$8`$\x02`$5`$>`$&`$&`%\x07`$\x16`$(`%\x07`$*`$?`$\x1b`$2`%\x07`$5`$?`$6`%\x07`$7`$0`$>`$\x1c`%\r`$/`$\t`$$`%\r`$$`$0`$.`%\x01`$\x02`$,`$\b`$&`%\v`$(`%\v`$\x02`$\t`$*`$\x15`$0`$#`$*`$"`$<`%\x07`$\x02`$8`%\r`$%`$?`$$`$+`$?`$2`%\r`$.`$.`%\x01`$\x16`%\r`$/`$\x05`$\x1a`%\r`$\x1b`$>`$\x1b`%\x02`$\x1f`$$`%\0`$8`$\x02`$\x17`%\0`$$`$\x1c`$>`$\x0f`$\x17`$>`$5`$?`$-`$>`$\x17`$\x18`$#`%\r`$\x1f`%\x07`$&`%\x02`$8`$0`%\x07`$&`$?`$(`%\v`$\x02`$9`$$`%\r`$/`$>`$8`%\x07`$\x15`%\r`$8`$\x17`$>`$\x02`$\'`%\0`$5`$?`$6`%\r`$5`$0`$>`$$`%\x07`$\x02`$&`%\b`$\x1f`%\r`$8`$(`$\x15`%\r`$6`$>`$8`$>`$.`$(`%\x07`$\x05`$&`$>`$2`$$`$,`$?`$\x1c`$2`%\0`$*`%\x01`$0`%\x02`$7`$9`$?`$\x02`$&`%\0`$.`$?`$$`%\r`$0`$\x15`$5`$?`$$`$>`$0`%\x01`$*`$/`%\x07`$8`%\r`$%`$>`$(`$\x15`$0`%\v`$!`$<`$.`%\x01`$\x15`%\r`$$`$/`%\v`$\x1c`$(`$>`$\x15`%\x03`$*`$/`$>`$*`%\v`$8`%\r`$\x1f`$\x18`$0`%\x07`$2`%\x02`$\x15`$>`$0`%\r`$/`$5`$?`$\x1a`$>`$0`$8`%\x02`$\x1a`$(`$>`$.`%\x02`$2`%\r`$/`$&`%\x07`$\x16`%\x07`$\x02`$9`$.`%\x07`$6`$>`$8`%\r`$\x15`%\x02`$2`$.`%\b`$\x02`$(`%\x07`$$`%\b`$/`$>`$0`$\x1c`$?`$8`$\x15`%\x07rss+xml" title="-type" content="title" content="at the same time.js"></script>\n<" method="post" </span></a></li>vertical-align:t/jquery.min.js">.click(function( style="padding-})();\n</script>\n</span><a href="<a href="http://); return false;text-decoration: scrolling="no" border-collapse:associated with Bahasa IndonesiaEnglish language<text xml:space=.gif" border="0"</body>\n</html>\noverflow:hidden;img src="http://addEventListenerresponsible for s.js"></script>\n/favicon.ico" />operating system" style="width:1target="_blank">State Universitytext-align:left;\ndocument.write(, including the around the world);\r\n</script>\r\n<" style="height:;overflow:hiddenmore informationan internationala member of the one of the firstcan be found in </div>\n\t\t</div>\ndisplay: none;">" />\n<link rel="\n (function() {the 15th century.preventDefault(large number of Byzantine Empire.jpg|thumb|left|vast majority ofmajority of the align="center">University Pressdominated by theSecond World Wardistribution of style="position:the rest of the characterized by rel="nofollow">derives from therather than the a combination ofstyle="width:100English-speakingcomputer scienceborder="0" alt="the existence ofDemocratic Party" style="margin-For this reason,.js"></script>\n\tsByTagName(s)[0]js"></script>\r\n<.js"></script>\r\nlink rel="icon" \' alt=\'\' class=\'formation of theversions of the </a></div></div>/page>\n <page>\n<div class="contbecame the firstbahasa Indonesiaenglish (simple)N\x15N;N;N7N=N9N:N,Q\x05Q\0P2P0Q\x02Q\x01P:P8P:P>P<P?P0P=P8P8Q\x0fP2P;Q\x0fP5Q\x02Q\x01Q\x0fP\x14P>P1P0P2P8Q\x02Q\fQ\x07P5P;P>P2P5P:P0Q\0P0P7P2P8Q\x02P8Q\x0fP\x18P=Q\x02P5Q\0P=P5Q\x02P\x1eQ\x02P2P5Q\x02P8Q\x02Q\fP=P0P?Q\0P8P<P5Q\0P8P=Q\x02P5Q\0P=P5Q\x02P:P>Q\x02P>Q\0P>P3P>Q\x01Q\x02Q\0P0P=P8Q\x06Q\vP:P0Q\x07P5Q\x01Q\x02P2P5Q\x03Q\x01P;P>P2P8Q\x0fQ\x05P?Q\0P>P1P;P5P<Q\vP?P>P;Q\x03Q\x07P8Q\x02Q\fQ\x0fP2P;Q\x0fQ\x0eQ\x02Q\x01Q\x0fP=P0P8P1P>P;P5P5P:P>P<P?P0P=P8Q\x0fP2P=P8P<P0P=P8P5Q\x01Q\0P5P4Q\x01Q\x02P2P0X\'Y\x04Y\x05Y\bX\'X6Y\nX9X\'Y\x04X1X&Y\nX3Y\nX)X\'Y\x04X\'Y\x06X*Y\x02X\'Y\x04Y\x05X4X\'X1Y\x03X\'X*Y\x03X\'Y\x04X3Y\nX\'X1X\'X*X\'Y\x04Y\x05Y\x03X*Y\bX(X)X\'Y\x04X3X9Y\bX/Y\nX)X\'X-X5X\'X&Y\nX\'X*X\'Y\x04X9X\'Y\x04Y\x05Y\nX)X\'Y\x04X5Y\bX*Y\nX\'X*X\'Y\x04X\'Y\x06X*X1Y\x06X*X\'Y\x04X*X5X\'Y\x05Y\nY\x05X\'Y\x04X%X3Y\x04X\'Y\x05Y\nX\'Y\x04Y\x05X4X\'X1Y\x03X)X\'Y\x04Y\x05X1X&Y\nX\'X*robots" content="<div id="footer">the United States<img src="http://.jpg|right|thumb|.js"></script>\r\n<location.protocolframeborder="0" s" />\n<meta name="</a></div></div><font-weight:bold;&quot; and &quot;depending on the margin:0;padding:" rel="nofollow" President of the twentieth centuryevision>\n </pageInternet Explorera.async = true;\r\ninformation about<div id="header">" action="http://<a href="https://<div id="content"</div>\r\n</div>\r\n<derived from the <img src=\'http://according to the \n</body>\n</html>\nstyle="font-size:script language="Arial, Helvetica,</a><span class="</script><script political partiestd></tr></table><href="http://www.interpretation ofrel="stylesheet" document.write(\'<charset="utf-8">\nbeginning of the revealed that thetelevision series" rel="nofollow"> target="_blank">claiming that thehttp%3A%2F%2Fwww.manifestations ofPrime Minister ofinfluenced by theclass="clearfix">/div>\r\n</div>\r\n\r\nthree-dimensionalChurch of Englandof North Carolinasquare kilometres.addEventListenerdistinct from thecommonly known asPhonetic Alphabetdeclared that thecontrolled by theBenjamin Franklinrole-playing gamethe University ofin Western Europepersonal computerProject Gutenbergregardless of thehas been proposedtogether with the></li><li class="in some countriesmin.js"></script>of the populationofficial language<img src="images/identified by thenatural resourcesclassification ofcan be consideredquantum mechanicsNevertheless, themillion years ago</body>\r\n</html>\rN\x15N;N;N7N=N9N:N,\ntake advantage ofand, according toattributed to theMicrosoft Windowsthe first centuryunder the controldiv class="headershortly after thenotable exceptiontens of thousandsseveral differentaround the world.reaching militaryisolated from theopposition to thethe Old TestamentAfrican Americansinserted into theseparate from themetropolitan areamakes it possibleacknowledged thatarguably the mosttype="text/css">\nthe InternationalAccording to the pe="text/css" />\ncoincide with thetwo-thirds of theDuring this time,during the periodannounced that hethe internationaland more recentlybelieved that theconsciousness andformerly known assurrounded by thefirst appeared inoccasionally usedposition:absolute;" target="_blank" position:relative;text-align:center;jax/libs/jquery/1.background-color:#type="application/anguage" content="<meta http-equiv="Privacy Policy</a>e("%3Cscript src=\'" target="_blank">On the other hand,.jpg|thumb|right|2</div><div class="<div style="float:nineteenth century</body>\r\n</html>\r\n<img src="http://s;text-align:centerfont-weight: bold; According to the difference between" frameborder="0" " style="position:link href="http://html4/loose.dtd">\nduring this period</td></tr></table>closely related tofor the first time;font-weight:bold;input type="text" <span style="font-onreadystatechange\t<div class="cleardocument.location. For example, the a wide variety of <!DOCTYPE html>\r\n<&nbsp;&nbsp;&nbsp;"><a href="http://style="float:left;concerned with the=http%3A%2F%2Fwww.in popular culturetype="text/css" />it is possible to Harvard Universitytylesheet" href="/the main characterOxford University name="keywords" cstyle="text-align:the United Kingdomfederal government<div style="margin depending on the description of the<div class="header.min.js"></script>destruction of theslightly differentin accordance withtelecommunicationsindicates that theshortly thereafterespecially in the European countriesHowever, there aresrc="http://staticsuggested that the" src="http://www.a large number of Telecommunications" rel="nofollow" tHoly Roman Emperoralmost exclusively" border="0" alt="Secretary of Stateculminating in theCIA World Factbookthe most importantanniversary of thestyle="background-<li><em><a href="/the Atlantic Oceanstrictly speaking,shortly before thedifferent types ofthe Ottoman Empire><img src="http://An Introduction toconsequence of thedeparture from theConfederate Statesindigenous peoplesProceedings of theinformation on thetheories have beeninvolvement in thedivided into threeadjacent countriesis responsible fordissolution of thecollaboration withwidely regarded ashis contemporariesfounding member ofDominican Republicgenerally acceptedthe possibility ofare also availableunder constructionrestoration of thethe general publicis almost entirelypasses through thehas been suggestedcomputer and videoGermanic languages according to the different from theshortly afterwardshref="https://www.recent developmentBoard of Directors<div class="search| <a href="http://In particular, theMultiple footnotesor other substancethousands of yearstranslation of the</div>\r\n</div>\r\n\r\n<a href="index.phpwas established inmin.js"></script>\nparticipate in thea strong influencestyle="margin-top:represented by thegraduated from theTraditionally, theElement("script");However, since the/div>\n</div>\n<div left; margin-left:protection against0; vertical-align:Unfortunately, thetype="image/x-icon/div>\n<div class=" class="clearfix"><div class="footer\t\t</div>\n\t\t</div>\nthe motion pictureP\x11Q\nP;P3P0Q\0Q\x01P:P8P1Q\nP;P3P0Q\0Q\x01P:P8P$P5P4P5Q\0P0Q\x06P8P8P=P5Q\x01P:P>P;Q\fP:P>Q\x01P>P>P1Q\tP5P=P8P5Q\x01P>P>P1Q\tP5P=P8Q\x0fP?Q\0P>P3Q\0P0P<P<Q\vP\x1eQ\x02P?Q\0P0P2P8Q\x02Q\fP1P5Q\x01P?P;P0Q\x02P=P>P<P0Q\x02P5Q\0P8P0P;Q\vP?P>P7P2P>P;Q\x0fP5Q\x02P?P>Q\x01P;P5P4P=P8P5Q\0P0P7P;P8Q\x07P=Q\vQ\x05P?Q\0P>P4Q\x03P:Q\x06P8P8P?Q\0P>P3Q\0P0P<P<P0P?P>P;P=P>Q\x01Q\x02Q\fQ\x0eP=P0Q\x05P>P4P8Q\x02Q\x01Q\x0fP8P7P1Q\0P0P=P=P>P5P=P0Q\x01P5P;P5P=P8Q\x0fP8P7P<P5P=P5P=P8Q\x0fP:P0Q\x02P5P3P>Q\0P8P8P\x10P;P5P:Q\x01P0P=P4Q\0`$&`%\r`$5`$>`$0`$>`$.`%\b`$(`%\x01`$\x05`$2`$*`%\r`$0`$&`$>`$(`$-`$>`$0`$$`%\0`$/`$\x05`$(`%\x01`$&`%\x07`$6`$9`$?`$(`%\r`$&`%\0`$\x07`$\x02`$!`$?`$/`$>`$&`$?`$2`%\r`$2`%\0`$\x05`$\'`$?`$\x15`$>`$0`$5`%\0`$!`$?`$/`%\v`$\x1a`$?`$\x1f`%\r`$ `%\x07`$8`$.`$>`$\x1a`$>`$0`$\x1c`$\x02`$\x15`%\r`$6`$(`$&`%\x01`$(`$?`$/`$>`$*`%\r`$0`$/`%\v`$\x17`$\x05`$(`%\x01`$8`$>`$0`$\x11`$(`$2`$>`$\x07`$(`$*`$>`$0`%\r`$\x1f`%\0`$6`$0`%\r`$$`%\v`$\x02`$2`%\v`$\x15`$8`$-`$>`$+`$<`%\r`$2`%\b`$6`$6`$0`%\r`$$`%\x07`$\x02`$*`%\r`$0`$&`%\x07`$6`$*`%\r`$2`%\x07`$/`$0`$\x15`%\x07`$\x02`$&`%\r`$0`$8`%\r`$%`$?`$$`$?`$\t`$$`%\r`$*`$>`$&`$\t`$(`%\r`$9`%\x07`$\x02`$\x1a`$?`$\x1f`%\r`$ `$>`$/`$>`$$`%\r`$0`$>`$\x1c`%\r`$/`$>`$&`$>`$*`%\x01`$0`$>`$(`%\x07`$\x1c`%\v`$!`$<`%\x07`$\x02`$\x05`$(`%\x01`$5`$>`$&`$6`%\r`$0`%\x07`$#`%\0`$6`$?`$\x15`%\r`$7`$>`$8`$0`$\x15`$>`$0`%\0`$8`$\x02`$\x17`%\r`$0`$9`$*`$0`$?`$#`$>`$.`$,`%\r`$0`$>`$\x02`$!`$,`$\x1a`%\r`$\x1a`%\v`$\x02`$\t`$*`$2`$,`%\r`$\'`$.`$\x02`$$`%\r`$0`%\0`$8`$\x02`$*`$0`%\r`$\x15`$\t`$.`%\r`$.`%\0`$&`$.`$>`$\'`%\r`$/`$.`$8`$9`$>`$/`$$`$>`$6`$,`%\r`$&`%\v`$\x02`$.`%\0`$!`$?`$/`$>`$\x06`$\b`$*`%\0`$\x0f`$2`$.`%\v`$,`$>`$\x07`$2`$8`$\x02`$\x16`%\r`$/`$>`$\x06`$*`$0`%\x07`$6`$(`$\x05`$(`%\x01`$,`$\x02`$\'`$,`$>`$\x1c`$<`$>`$0`$(`$5`%\0`$(`$$`$.`$*`%\r`$0`$.`%\x01`$\x16`$*`%\r`$0`$6`%\r`$(`$*`$0`$?`$5`$>`$0`$(`%\x01`$\x15`$8`$>`$(`$8`$.`$0`%\r`$%`$(`$\x06`$/`%\v`$\x1c`$?`$$`$8`%\v`$.`$5`$>`$0X\'Y\x04Y\x05X4X\'X1Y\x03X\'X*X\'Y\x04Y\x05Y\x06X*X/Y\nX\'X*X\'Y\x04Y\x03Y\x05X(Y\nY\bX*X1X\'Y\x04Y\x05X4X\'Y\x07X/X\'X*X9X/X/X\'Y\x04X2Y\bX\'X1X9X/X/X\'Y\x04X1X/Y\bX/X\'Y\x04X%X3Y\x04X\'Y\x05Y\nX)X\'Y\x04Y\x01Y\bX*Y\bX4Y\bX(X\'Y\x04Y\x05X3X\'X(Y\x02X\'X*X\'Y\x04Y\x05X9Y\x04Y\bY\x05X\'X*X\'Y\x04Y\x05X3Y\x04X3Y\x04X\'X*X\'Y\x04X,X1X\'Y\x01Y\nY\x03X3X\'Y\x04X\'X3Y\x04X\'Y\x05Y\nX)X\'Y\x04X\'X*X5X\'Y\x04X\'X*keywords" content="w3.org/1999/xhtml"><a target="_blank" text/html; charset=" target="_blank"><table cellpadding="autocomplete="off" text-align: center;to last version by background-color: #" href="http://www./div></div><div id=<a href="#" class=""><img src="http://cript" src="http://\n<script language="//EN" "http://www.wencodeURIComponent(" href="javascript:<div class="contentdocument.write(\'<scposition: absolute;script src="http:// style="margin-top:.min.js"></script>\n</div>\n<div class="w3.org/1999/xhtml" \n\r\n</body>\r\n</html>distinction between/" target="_blank"><link href="http://encoding="utf-8"?>\nw.addEventListener?action="http://www.icon" href="http:// style="background:type="text/css" />\nmeta property="og:t<input type="text" style="text-align:the development of tylesheet" type="tehtml; charset=utf-8is considered to betable width="100%" In addition to the contributed to the differences betweendevelopment of the It is important to </script>\n\n<script style="font-size:1></span><span id=gbLibrary of Congress<img src="http://imEnglish translationAcademy of Sciencesdiv style="display:construction of the.getElementById(id)in conjunction withElement(\'script\'); <meta property="og:P\x11Q\nP;P3P0Q\0Q\x01P:P8\n type="text" name=">Privacy Policy</a>administered by theenableSingleRequeststyle=&quot;margin:</div></div></div><><img src="http://i style=&quot;float:referred to as the total population ofin Washington, D.C. style="background-among other things,organization of theparticipated in thethe introduction ofidentified with thefictional character Oxford University misunderstanding ofThere are, however,stylesheet" href="/Columbia Universityexpanded to includeusually referred toindicating that thehave suggested thataffiliated with thecorrelation betweennumber of different></td></tr></table>Republic of Ireland\n</script>\n<script under the influencecontribution to theOfficial website ofheadquarters of thecentered around theimplications of thehave been developedFederal Republic ofbecame increasinglycontinuation of theNote, however, thatsimilar to that of capabilities of theaccordance with theparticipants in thefurther developmentunder the directionis often consideredhis younger brother</td></tr></table><a http-equiv="X-UA-physical propertiesof British Columbiahas been criticized(with the exceptionquestions about thepassing through the0" cellpadding="0" thousands of peopleredirects here. Forhave children under%3E%3C/script%3E"));<a href="http://www.<li><a href="http://site_name" content="text-decoration:nonestyle="display: none<meta http-equiv="X-new Date().getTime() type="image/x-icon"</span><span class="language="javascriptwindow.location.href<a href="javascript:-->\r\n<script type="t<a href=\'http://www.hortcut icon" href="</div>\r\n<div class="<script src="http://" rel="stylesheet" t</div>\n<script type=/a> <a href="http:// allowTransparency="X-UA-Compatible" conrelationship between\n</script>\r\n<script </a></li></ul></div>associated with the programming language</a><a href="http://</a></li><li class="form action="http://<div style="display:type="text" name="q"<table width="100%" background-position:" border="0" width="rel="shortcut icon" h6><ul><li><a href=" <meta http-equiv="css" media="screen" responsible for the " type="application/" style="background-html; charset=utf-8" allowtransparency="stylesheet" type="te\r\n<meta http-equiv="></span><span class="0" cellspacing="0">;\n</script>\n<script sometimes called thedoes not necessarilyFor more informationat the beginning of <!DOCTYPE html><htmlparticularly in the type="hidden" name="javascript:void(0);"effectiveness of the autocomplete="off" generally considered><input type="text" "></script>\r\n<scriptthroughout the worldcommon misconceptionassociation with the</div>\n</div>\n<div cduring his lifetime,corresponding to thetype="image/x-icon" an increasing numberdiplomatic relationsare often consideredmeta charset="utf-8" <input type="text" examples include the"><img src="http://iparticipation in thethe establishment of\n</div>\n<div class="&amp;nbsp;&amp;nbsp;to determine whetherquite different frommarked the beginningdistance between thecontributions to theconflict between thewidely considered towas one of the firstwith varying degreeshave speculated that(document.getElementparticipating in theoriginally developedeta charset="utf-8"> type="text/css" />\ninterchangeably withmore closely relatedsocial and politicalthat would otherwiseperpendicular to thestyle type="text/csstype="submit" name="families residing indeveloping countriescomputer programmingeconomic developmentdetermination of thefor more informationon several occasionsportuguC*s (Europeu)P#P:Q\0P0Q\x17P=Q\x01Q\fP:P0Q\x03P:Q\0P0Q\x17P=Q\x01Q\fP:P0P P>Q\x01Q\x01P8P9Q\x01P:P>P9P<P0Q\x02P5Q\0P8P0P;P>P2P8P=Q\x04P>Q\0P<P0Q\x06P8P8Q\x03P?Q\0P0P2P;P5P=P8Q\x0fP=P5P>P1Q\x05P>P4P8P<P>P8P=Q\x04P>Q\0P<P0Q\x06P8Q\x0fP\x18P=Q\x04P>Q\0P<P0Q\x06P8Q\x0fP P5Q\x01P?Q\x03P1P;P8P:P8P:P>P;P8Q\x07P5Q\x01Q\x02P2P>P8P=Q\x04P>Q\0P<P0Q\x06P8Q\x0eQ\x02P5Q\0Q\0P8Q\x02P>Q\0P8P8P4P>Q\x01Q\x02P0Q\x02P>Q\x07P=P>X\'Y\x04Y\x05X*Y\bX\'X,X/Y\bY\x06X\'Y\x04X\'X4X*X1X\'Y\x03X\'X*X\'Y\x04X\'Y\x02X*X1X\'X-X\'X*html; charset=UTF-8" setTimeout(function()display:inline-block;<input type="submit" type = \'text/javascri<img src="http://www." "http://www.w3.org/shortcut icon" href="" autocomplete="off" </a></div><div class=</a></li>\n<li class="css" type="text/css" <form action="http://xt/css" href="http://link rel="alternate" \r\n<script type="text/ onclick="javascript:(new Date).getTime()}height="1" width="1" People\'s Republic of <a href="http://www.text-decoration:underthe beginning of the </div>\n</div>\n</div>\nestablishment of the </div></div></div></d#viewport{min-height:\n<script src="http://option><option value=often referred to as /option>\n<option valu<!DOCTYPE html>\n<!--[International Airport>\n<a href="http://www</a><a href="http://w`8 `82`8)`82`9\x04`8\x17`8"a\x03%a\x03\x10a\x03 a\x03\x17a\x03#a\x03\x1aa\x03\x18f-#i+\x14d8-f\x16\x07 (g9\x01i+\x14)`$(`$?`$0`%\r`$&`%\x07`$6`$!`$>`$\t`$(`$2`%\v`$!`$\x15`%\r`$7`%\x07`$$`%\r`$0`$\x1c`$>`$(`$\x15`$>`$0`%\0`$8`$\x02`$,`$\x02`$\'`$?`$$`$8`%\r`$%`$>`$*`$(`$>`$8`%\r`$5`%\0`$\x15`$>`$0`$8`$\x02`$8`%\r`$\x15`$0`$#`$8`$>`$.`$\x17`%\r`$0`%\0`$\x1a`$?`$\x1f`%\r`$ `%\v`$\x02`$5`$?`$\x1c`%\r`$\x1e`$>`$(`$\x05`$.`%\x07`$0`$?`$\x15`$>`$5`$?`$-`$?`$(`%\r`$(`$\x17`$>`$!`$?`$/`$>`$\x01`$\x15`%\r`$/`%\v`$\x02`$\x15`$?`$8`%\x01`$0`$\x15`%\r`$7`$>`$*`$9`%\x01`$\x01`$\x1a`$$`%\0`$*`%\r`$0`$,`$\x02`$\'`$(`$\x1f`$?`$*`%\r`$*`$#`%\0`$\x15`%\r`$0`$?`$\x15`%\x07`$\x1f`$*`%\r`$0`$>`$0`$\x02`$-`$*`%\r`$0`$>`$*`%\r`$$`$.`$>`$2`$?`$\x15`%\v`$\x02`$0`$+`$<`%\r`$$`$>`$0`$(`$?`$0`%\r`$.`$>`$#`$2`$?`$.`$?`$\x1f`%\x07`$!description" content="document.location.prot.getElementsByTagName(<!DOCTYPE html>\n<html <meta charset="utf-8">:url" content="http://.css" rel="stylesheet"style type="text/css">type="text/css" href="w3.org/1999/xhtml" xmltype="text/javascript" method="get" action="link rel="stylesheet" = document.getElementtype="image/x-icon" />cellpadding="0" cellsp.css" type="text/css" </a></li><li><a href="" width="1" height="1""><a href="http://www.style="display:none;">alternate" type="appli-//W3C//DTD XHTML 1.0 ellspacing="0" cellpad type="hidden" value="/a>&nbsp;<span role="s\n<input type="hidden" language="JavaScript" document.getElementsBg="0" cellspacing="0" ype="text/css" media="type=\'text/javascript\'with the exception of ype="text/css" rel="st height="1" width="1" =\'+encodeURIComponent(<link rel="alternate" \nbody, tr, input, textmeta name="robots" conmethod="post" action=">\n<a href="http://www.css" rel="stylesheet" </div></div><div classlanguage="javascript">aria-hidden="true">B7<ript" type="text/javasl=0;})();\n(function(){background-image: url(/a></li><li><a href="h\t\t<li><a href="http://ator" aria-hidden="tru> <a href="http://www.language="javascript" /option>\n<option value/div></div><div class=rator" aria-hidden="tre=(new Date).getTime()portuguC*s (do Brasil)P>Q\0P3P0P=P8P7P0Q\x06P8P8P2P>P7P<P>P6P=P>Q\x01Q\x02Q\fP>P1Q\0P0P7P>P2P0P=P8Q\x0fQ\0P5P3P8Q\x01Q\x02Q\0P0Q\x06P8P8P2P>P7P<P>P6P=P>Q\x01Q\x02P8P>P1Q\x0fP7P0Q\x02P5P;Q\fP=P0<!DOCTYPE html PUBLIC "nt-Type" content="text/<meta http-equiv="Conteransitional//EN" "http:<html xmlns="http://www-//W3C//DTD XHTML 1.0 TDTD/xhtml1-transitional//www.w3.org/TR/xhtml1/pe = \'text/javascript\';<meta name="descriptionparentNode.insertBefore<input type="hidden" najs" type="text/javascri(document).ready(functiscript type="text/javasimage" content="http://UA-Compatible" content=tml; charset=utf-8" />\nlink rel="shortcut icon<link rel="stylesheet" </script>\n<script type== document.createElemen<a target="_blank" href= document.getElementsBinput type="text" name=a.type = \'text/javascrinput type="hidden" namehtml; charset=utf-8" />dtd">\n<html xmlns="http-//W3C//DTD HTML 4.01 TentsByTagName(\'script\')input type="hidden" nam<script type="text/javas" style="display:none;">document.getElementById(=document.createElement(\' type=\'text/javascript\'input type="text" name="d.getElementsByTagName(snical" href="http://www.C//DTD HTML 4.01 Transit<style type="text/css">\n\n<style type="text/css">ional.dtd">\n<html xmlns=http-equiv="Content-Typeding="0" cellspacing="0"html; charset=utf-8" />\n style="display:none;"><<li><a href="http://www. type=\'text/javascript\'>P4P5Q\x0fQ\x02P5P;Q\fP=P>Q\x01Q\x02P8Q\x01P>P>Q\x02P2P5Q\x02Q\x01Q\x02P2P8P8P?Q\0P>P8P7P2P>P4Q\x01Q\x02P2P0P1P5P7P>P?P0Q\x01P=P>Q\x01Q\x02P8`$*`%\x01`$8`%\r`$$`$?`$\x15`$>`$\x15`$>`$\x02`$\x17`%\r`$0`%\x07`$8`$\t`$(`%\r`$9`%\v`$\x02`$(`%\x07`$5`$?`$\'`$>`$(`$8`$-`$>`$+`$?`$\x15`%\r`$8`$?`$\x02`$\x17`$8`%\x01`$0`$\x15`%\r`$7`$?`$$`$\x15`%\t`$*`%\0`$0`$>`$\x07`$\x1f`$5`$?`$\x1c`%\r`$\x1e`$>`$*`$(`$\x15`$>`$0`%\r`$0`$5`$>`$\b`$8`$\x15`%\r`$0`$?`$/`$$`$>',"\u06f7%\u018c'T%\x85'W%\xd7%O%g%\xa6&\u0193%\u01e5&>&*&'&^&\x88\u0178\u0c3e&\u01ad&\u0192&)&^&%&'&\x82&P&1&\xb1&3&]&m&u&E&t&C&\xcf&V&V&/&>&6&\u0f76\u177co&p&@&E&M&P&x&@&F&e&\xcc&7&:&(&D&0&C&)&.&F&-&1&(&L&F&1\u025e*\u03ea\u21f3&\u1372&K&;&)&E&H&P&0&?&9&V&\x81&-&v&a&,&E&)&?&=&'&'&B&\u0d2e&\u0503&\u0316*&*8&%&%&&&%,)&\x9a&>&\x86&7&]&F&2&>&J&6&n&2&%&?&\x8e&2&6&J&g&-&0&,&*&J&*&O&)&6&(&<&B&N&.&P&@&2&.&W&M&%\u053c\x84(,(<&,&\u03da&\u18c7&-&,(%&(&%&(\u013b0&X&D&\x81&j&'&J&(&.&B&3&Z&R&h&3&E&E&<\xc6-\u0360\u1ef3&%8?&@&,&Z&@&0&J&,&^&x&_&6&C&6&C\u072c\u2a25&f&-&-&-&-&,&J&2&8&z&8&C&Y&8&-&d&\u1e78\xcc-&7&1&F&7&t&W&7&I&.&.&^&=\u0f9c\u19d3&8(>&/&/&\u077b')'\u1065')'%@/&0&%\u043e\u09c0*&*@&C\u053d\u05d4\u0274\u05eb4\u0dd7\u071a\u04d16\u0d84&/\u0178\u0303Z&*%\u0246\u03ff&\u0134&1\xa8\u04b4\u0174"),
+ae(Xe),se=Xe,re}var BrotliDecode=BrotliDecodeClosure();window.ra=BrotliDecode; \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/decode_test.js b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/decode_test.js
new file mode 100644
index 000000000..0c18f44fd
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/decode_test.js
@@ -0,0 +1,79 @@
+goog.require('goog.testing.asserts');
+goog.require('goog.testing.jsunit');
+
+/**
+ * @param {!Int8Array} bytes
+ * @return {string}
+ */
+function bytesToString(bytes) {
+ return String.fromCharCode.apply(null, new Uint16Array(bytes));
+}
+
+function testMetadata() {
+ assertEquals("", bytesToString(BrotliDecode(Int8Array.from([1, 11, 0, 42, 3]))));
+}
+
+function testEmpty() {
+ assertEquals("", bytesToString(BrotliDecode(Int8Array.from([6]))));
+ assertEquals("", bytesToString(BrotliDecode(Int8Array.from([0x81, 1]))));
+}
+
+function testBaseDictWord() {
+ var input = Int8Array.from([
+ 0x1b, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe3, 0xb4, 0x0d, 0x00, 0x00,
+ 0x07, 0x5b, 0x26, 0x31, 0x40, 0x02, 0x00, 0xe0, 0x4e, 0x1b, 0x41, 0x02
+ ]);
+ /** @type {!Int8Array} */
+ var output = BrotliDecode(input);
+ assertEquals("time", bytesToString(output));
+}
+
+function testBlockCountMessage() {
+ var input = Int8Array.from([
+ 0x1b, 0x0b, 0x00, 0x11, 0x01, 0x8c, 0xc1, 0xc5, 0x0d, 0x08, 0x00, 0x22,
+ 0x65, 0xe1, 0xfc, 0xfd, 0x22, 0x2c, 0xc4, 0x00, 0x00, 0x38, 0xd8, 0x32,
+ 0x89, 0x01, 0x12, 0x00, 0x00, 0x77, 0xda, 0x04, 0x10, 0x42, 0x00, 0x00, 0x00
+ ]);
+ /** @type {!Int8Array} */
+ var output = BrotliDecode(input);
+ assertEquals("aabbaaaaabab", bytesToString(output));
+}
+
+function testCompressedUncompressedShortCompressedSmallWindow() {
+ var input = Int8Array.from([
+ 0x21, 0xf4, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xa7, 0x6d, 0x00, 0x00,
+ 0x38, 0xd8, 0x32, 0x89, 0x01, 0x12, 0x00, 0x00, 0x77, 0xda, 0x34, 0x7b,
+ 0xdb, 0x50, 0x80, 0x02, 0x80, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x31,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x4e, 0xdb, 0x00, 0x00, 0x70, 0xb0,
+ 0x65, 0x12, 0x03, 0x24, 0x00, 0x00, 0xee, 0xb4, 0x11, 0x24, 0x00
+ ]);
+ /** @type {!Int8Array} */
+ var output = BrotliDecode(input);
+ assertEquals(
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaabbbbbbbbbb", bytesToString(output));
+}
+
+function testIntactDistanceRingBuffer0() {
+ var input = Int8Array.from([
+ 0x1b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe3, 0xb4, 0x0d, 0x00, 0x00,
+ 0x07, 0x5b, 0x26, 0x31, 0x40, 0x02, 0x00, 0xe0, 0x4e, 0x1b, 0xa1, 0x80,
+ 0x20, 0x00
+ ]);
+ /** @type {!Int8Array} */
+ var output = BrotliDecode(input);
+ assertEquals("himselfself", bytesToString(output));
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/polyfill.js b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/polyfill.js
new file mode 100644
index 000000000..707a89a6e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/js/polyfill.js
@@ -0,0 +1,65 @@
+if (!Int32Array.__proto__.from) {
+ Object.defineProperty(Int32Array.__proto__, 'from', {
+ value: function(obj) {
+ obj = Object(obj);
+ if (!obj['length']) {
+ return new this(0);
+ }
+ var typed_array = new this(obj.length);
+ for(var i = 0; i < typed_array.length; i++) {
+ typed_array[i] = obj[i];
+ }
+ return typed_array;
+ }
+ });
+}
+
+if (!Array.prototype.copyWithin) {
+ Array.prototype.copyWithin = function(target, start, end) {
+ var O = Object(this);
+ var len = O.length >>> 0;
+ var to = target | 0;
+ var from = start | 0;
+ var count = Math.min(Math.min(end | 0, len) - from, len - to);
+ var direction = 1;
+ if (from < to && to < (from + count)) {
+ direction = -1;
+ from += count - 1;
+ to += count - 1;
+ }
+ while (count > 0) {
+ O[to] = O[from];
+ from += direction;
+ to += direction;
+ count--;
+ }
+ return O;
+ };
+}
+
+if (!Array.prototype.fill) {
+ Object.defineProperty(Array.prototype, 'fill', {
+ value: function(value, start, end) {
+ end = end | 0;
+ var O = Object(this);
+ var k = start | 0;
+ while (k < end) {
+ O[k] = value;
+ k++;
+ }
+ return O;
+ }
+ });
+}
+
+if (!Int8Array.prototype.copyWithin) {
+ Int8Array.prototype.copyWithin = Array.prototype.copyWithin;
+}
+
+if (!Int8Array.prototype.fill) {
+ Int8Array.prototype.fill = Array.prototype.fill;
+}
+
+if (!Int32Array.prototype.fill) {
+ Int32Array.prototype.fill = Array.prototype.fill;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/premake5.lua b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/premake5.lua
new file mode 100644
index 000000000..555263e00
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/premake5.lua
@@ -0,0 +1,78 @@
+-- A solution contains projects, and defines the available configurations
+solution "brotli"
+configurations { "Release", "Debug" }
+platforms { "x64", "x86" }
+targetdir "bin"
+location "buildfiles"
+flags "RelativeLinks"
+includedirs { "c/include" }
+
+filter "configurations:Release"
+ optimize "Speed"
+ flags { "StaticRuntime" }
+
+filter "configurations:Debug"
+ flags { "Symbols" }
+
+filter { "platforms:x64" }
+ architecture "x86_64"
+
+filter { "platforms:x86" }
+ architecture "x86"
+
+configuration { "gmake" }
+ buildoptions { "-Wall -fno-omit-frame-pointer" }
+ location "buildfiles/gmake"
+
+configuration { "xcode4" }
+ location "buildfiles/xcode4"
+
+configuration "linux"
+ links "m"
+
+configuration { "macosx" }
+ defines { "OS_MACOSX" }
+
+project "brotlicommon"
+ kind "SharedLib"
+ language "C"
+ files { "c/common/**.h", "c/common/**.c" }
+
+project "brotlicommon_static"
+ kind "StaticLib"
+ targetname "brotlicommon"
+ language "C"
+ files { "c/common/**.h", "c/common/**.c" }
+
+project "brotlidec"
+ kind "SharedLib"
+ language "C"
+ files { "c/dec/**.h", "c/dec/**.c" }
+ links "brotlicommon"
+
+project "brotlidec_static"
+ kind "StaticLib"
+ targetname "brotlidec"
+ language "C"
+ files { "c/dec/**.h", "c/dec/**.c" }
+ links "brotlicommon_static"
+
+project "brotlienc"
+ kind "SharedLib"
+ language "C"
+ files { "c/enc/**.h", "c/enc/**.c" }
+ links "brotlicommon"
+
+project "brotlienc_static"
+ kind "StaticLib"
+ targetname "brotlienc"
+ language "C"
+ files { "c/enc/**.h", "c/enc/**.c" }
+ links "brotlicommon_static"
+
+project "brotli"
+ kind "ConsoleApp"
+ language "C"
+ linkoptions "-static"
+ files { "c/tools/brotli.c" }
+ links { "brotlicommon_static", "brotlidec_static", "brotlienc_static" }
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/Makefile b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/Makefile
new file mode 100644
index 000000000..d5d88f87f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/Makefile
@@ -0,0 +1,57 @@
+# Copyright 2016 The Brotli Authors. All rights reserved.
+#
+# Distributed under MIT license.
+# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+
+# Default (Build)
+.PHONY: all
+# Build
+.PHONY: build
+# Develop
+.PHONY: develop
+# Install
+.PHONY: install
+# Test
+.PHONY: test
+# Clean
+.PHONY: clean
+# Format
+.PHONY: fix
+
+
+PYTHON ?= python
+YAPF ?= yapf
+
+EXT_SUFFIX=$(shell $(PYTHON) -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))')
+EXT_SOURCES=$(shell find . -name '*.cc')
+EXTENSIONS=$(EXT_SOURCES:%.cc=%$(EXT_SUFFIX))
+
+
+all: build
+
+build: $(EXTENSIONS)
+
+$(EXTENSIONS): $(EXT_SOURCES)
+ @cd .. && $(PYTHON) setup.py build_ext --inplace
+
+develop:
+ @cd .. && $(PYTHON) setup.py develop
+
+install:
+ @cd .. && $(PYTHON) setup.py install
+
+test: build
+ @echo 'running tests'
+ @$(PYTHON) -m unittest discover -v -p '*_test.py'
+
+clean:
+ @cd .. && $(PYTHON) setup.py clean
+ @find .. -name '*.pyc' | xargs rm -v
+ @find .. -name '*.so' | xargs rm -v
+ @find .. -type d -name '__pycache__' | xargs rm -v -r
+ @find .. -type d -name '*.egg-info' | xargs rm -v -r
+
+fix:
+ @echo 'formatting code'
+ -@$(YAPF) --in-place --recursive --verify .
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/README.md b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/README.md
new file mode 100644
index 000000000..6a9068aa4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/README.md
@@ -0,0 +1,54 @@
+This directory contains the code for the Python `brotli` module,
+`bro.py` tool, and roundtrip tests.
+
+Only Python 2.7+ is supported.
+
+We provide a `Makefile` to simplify common development commands.
+
+### Installation
+
+If you just want to install the latest release of the Python `brotli`
+module, we recommend installing from [PyPI][]:
+
+ $ pip install brotli
+
+Alternatively, you may install directly from source by running the
+following command from this directory:
+
+ $ make install
+
+### Development
+
+You may run the following commands from this directory:
+
+ $ make # Build the module in-place
+
+ $ make test # Test the module
+
+ $ make clean # Remove all temporary files and build output
+
+If you wish to make the module available while still being
+able to edit the source files, you can use the `setuptools`
+"[development mode][]":
+
+ $ make develop # Install the module in "development mode"
+
+### Code Style
+
+Brotli's code follows the [Google Python Style Guide][]. To
+automatically format your code, first install [YAPF][]:
+
+ $ pip install yapf
+
+Then, to format all files in the project, you can run:
+
+ $ make fix # Automatically format code
+
+See the [YAPF usage][] documentation for more information.
+
+
+[PyPI]: https://pypi.org/project/Brotli/
+[development mode]: https://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode
+[Google Python Style Guide]: https://google.github.io/styleguide/pyguide.html
+[YAPF]: https://github.com/google/yapf
+[YAPF usage]: https://github.com/google/yapf#usage
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/_brotli.cc b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/_brotli.cc
new file mode 100644
index 000000000..d4075bd45
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/_brotli.cc
@@ -0,0 +1,753 @@
+#define PY_SSIZE_T_CLEAN 1
+#include <Python.h>
+#include <bytesobject.h>
+#include <structmember.h>
+#include <vector>
+#include "../common/version.h"
+#include <brotli/decode.h>
+#include <brotli/encode.h>
+
+#if PY_MAJOR_VERSION >= 3
+#define PyInt_Check PyLong_Check
+#define PyInt_AsLong PyLong_AsLong
+#endif
+
+static PyObject *BrotliError;
+
+static int as_bounded_int(PyObject *o, int* result, int lower_bound, int upper_bound) {
+ long value = PyInt_AsLong(o);
+ if ((value < (long) lower_bound) || (value > (long) upper_bound)) {
+ return 0;
+ }
+ *result = (int) value;
+ return 1;
+}
+
+static int mode_convertor(PyObject *o, BrotliEncoderMode *mode) {
+ if (!PyInt_Check(o)) {
+ PyErr_SetString(BrotliError, "Invalid mode");
+ return 0;
+ }
+
+ int mode_value = -1;
+ if (!as_bounded_int(o, &mode_value, 0, 255)) {
+ PyErr_SetString(BrotliError, "Invalid mode");
+ return 0;
+ }
+ *mode = (BrotliEncoderMode) mode_value;
+ if (*mode != BROTLI_MODE_GENERIC &&
+ *mode != BROTLI_MODE_TEXT &&
+ *mode != BROTLI_MODE_FONT) {
+ PyErr_SetString(BrotliError, "Invalid mode");
+ return 0;
+ }
+
+ return 1;
+}
+
+static int quality_convertor(PyObject *o, int *quality) {
+ if (!PyInt_Check(o)) {
+ PyErr_SetString(BrotliError, "Invalid quality");
+ return 0;
+ }
+
+ if (!as_bounded_int(o, quality, 0, 11)) {
+ PyErr_SetString(BrotliError, "Invalid quality. Range is 0 to 11.");
+ return 0;
+ }
+
+ return 1;
+}
+
+static int lgwin_convertor(PyObject *o, int *lgwin) {
+ if (!PyInt_Check(o)) {
+ PyErr_SetString(BrotliError, "Invalid lgwin");
+ return 0;
+ }
+
+ if (!as_bounded_int(o, lgwin, 10, 24)) {
+ PyErr_SetString(BrotliError, "Invalid lgwin. Range is 10 to 24.");
+ return 0;
+ }
+
+ return 1;
+}
+
+static int lgblock_convertor(PyObject *o, int *lgblock) {
+ if (!PyInt_Check(o)) {
+ PyErr_SetString(BrotliError, "Invalid lgblock");
+ return 0;
+ }
+
+ if (!as_bounded_int(o, lgblock, 0, 24) || (*lgblock != 0 && *lgblock < 16)) {
+ PyErr_SetString(BrotliError, "Invalid lgblock. Can be 0 or in range 16 to 24.");
+ return 0;
+ }
+
+ return 1;
+}
+
+static BROTLI_BOOL compress_stream(BrotliEncoderState* enc, BrotliEncoderOperation op,
+ std::vector<uint8_t>* output,
+ uint8_t* input, size_t input_length) {
+ BROTLI_BOOL ok = BROTLI_TRUE;
+ Py_BEGIN_ALLOW_THREADS
+
+ size_t available_in = input_length;
+ const uint8_t* next_in = input;
+ size_t available_out = 0;
+ uint8_t* next_out = NULL;
+
+ while (ok) {
+ ok = BrotliEncoderCompressStream(enc, op,
+ &available_in, &next_in,
+ &available_out, &next_out, NULL);
+ if (!ok)
+ break;
+
+ size_t buffer_length = 0; // Request all available output.
+ const uint8_t* buffer = BrotliEncoderTakeOutput(enc, &buffer_length);
+ if (buffer_length) {
+ (*output).insert((*output).end(), buffer, buffer + buffer_length);
+ }
+
+ if (available_in || BrotliEncoderHasMoreOutput(enc)) {
+ continue;
+ }
+
+ break;
+ }
+
+ Py_END_ALLOW_THREADS
+ return ok;
+}
+
+PyDoc_STRVAR(brotli_Compressor_doc,
+"An object to compress a byte string.\n"
+"\n"
+"Signature:\n"
+" Compressor(mode=MODE_GENERIC, quality=11, lgwin=22, lgblock=0)\n"
+"\n"
+"Args:\n"
+" mode (int, optional): The compression mode can be MODE_GENERIC (default),\n"
+" MODE_TEXT (for UTF-8 format text input) or MODE_FONT (for WOFF 2.0). \n"
+" quality (int, optional): Controls the compression-speed vs compression-\n"
+" density tradeoff. The higher the quality, the slower the compression.\n"
+" Range is 0 to 11. Defaults to 11.\n"
+" lgwin (int, optional): Base 2 logarithm of the sliding window size. Range\n"
+" is 10 to 24. Defaults to 22.\n"
+" lgblock (int, optional): Base 2 logarithm of the maximum input block size.\n"
+" Range is 16 to 24. If set to 0, the value will be set based on the\n"
+" quality. Defaults to 0.\n"
+"\n"
+"Raises:\n"
+" brotli.error: If arguments are invalid.\n");
+
+typedef struct {
+ PyObject_HEAD
+ BrotliEncoderState* enc;
+} brotli_Compressor;
+
+static void brotli_Compressor_dealloc(brotli_Compressor* self) {
+ BrotliEncoderDestroyInstance(self->enc);
+ #if PY_MAJOR_VERSION >= 3
+ Py_TYPE(self)->tp_free((PyObject*)self);
+ #else
+ self->ob_type->tp_free((PyObject*)self);
+ #endif
+}
+
+static PyObject* brotli_Compressor_new(PyTypeObject *type, PyObject *args, PyObject *keywds) {
+ brotli_Compressor *self;
+ self = (brotli_Compressor *)type->tp_alloc(type, 0);
+
+ if (self != NULL) {
+ self->enc = BrotliEncoderCreateInstance(0, 0, 0);
+ }
+
+ return (PyObject *)self;
+}
+
+static int brotli_Compressor_init(brotli_Compressor *self, PyObject *args, PyObject *keywds) {
+ BrotliEncoderMode mode = (BrotliEncoderMode) -1;
+ int quality = -1;
+ int lgwin = -1;
+ int lgblock = -1;
+ int ok;
+
+ static const char *kwlist[] = {"mode", "quality", "lgwin", "lgblock", NULL};
+
+ ok = PyArg_ParseTupleAndKeywords(args, keywds, "|O&O&O&O&:Compressor",
+ const_cast<char **>(kwlist),
+ &mode_convertor, &mode,
+ &quality_convertor, &quality,
+ &lgwin_convertor, &lgwin,
+ &lgblock_convertor, &lgblock);
+ if (!ok)
+ return -1;
+ if (!self->enc)
+ return -1;
+
+ if ((int) mode != -1)
+ BrotliEncoderSetParameter(self->enc, BROTLI_PARAM_MODE, (uint32_t)mode);
+ if (quality != -1)
+ BrotliEncoderSetParameter(self->enc, BROTLI_PARAM_QUALITY, (uint32_t)quality);
+ if (lgwin != -1)
+ BrotliEncoderSetParameter(self->enc, BROTLI_PARAM_LGWIN, (uint32_t)lgwin);
+ if (lgblock != -1)
+ BrotliEncoderSetParameter(self->enc, BROTLI_PARAM_LGBLOCK, (uint32_t)lgblock);
+
+ return 0;
+}
+
+PyDoc_STRVAR(brotli_Compressor_process_doc,
+"Process \"string\" for compression, returning a string that contains \n"
+"compressed output data. This data should be concatenated to the output \n"
+"produced by any preceding calls to the \"process()\" or flush()\" methods. \n"
+"Some or all of the input may be kept in internal buffers for later \n"
+"processing, and the compressed output data may be empty until enough input \n"
+"has been accumulated.\n"
+"\n"
+"Signature:\n"
+" compress(string)\n"
+"\n"
+"Args:\n"
+" string (bytes): The input data\n"
+"\n"
+"Returns:\n"
+" The compressed output data (bytes)\n"
+"\n"
+"Raises:\n"
+" brotli.error: If compression fails\n");
+
+static PyObject* brotli_Compressor_process(brotli_Compressor *self, PyObject *args) {
+ PyObject* ret = NULL;
+ std::vector<uint8_t> output;
+ Py_buffer input;
+ BROTLI_BOOL ok = BROTLI_TRUE;
+
+#if PY_MAJOR_VERSION >= 3
+ ok = (BROTLI_BOOL)PyArg_ParseTuple(args, "y*:process", &input);
+#else
+ ok = (BROTLI_BOOL)PyArg_ParseTuple(args, "s*:process", &input);
+#endif
+
+ if (!ok)
+ return NULL;
+
+ if (!self->enc) {
+ ok = BROTLI_FALSE;
+ goto end;
+ }
+
+ ok = compress_stream(self->enc, BROTLI_OPERATION_PROCESS,
+ &output, static_cast<uint8_t*>(input.buf), input.len);
+
+end:
+ PyBuffer_Release(&input);
+ if (ok) {
+ ret = PyBytes_FromStringAndSize((char*)(output.size() ? &output[0] : NULL), output.size());
+ } else {
+ PyErr_SetString(BrotliError, "BrotliEncoderCompressStream failed while processing the stream");
+ }
+
+ return ret;
+}
+
+PyDoc_STRVAR(brotli_Compressor_flush_doc,
+"Process all pending input, returning a string containing the remaining\n"
+"compressed data. This data should be concatenated to the output produced by\n"
+"any preceding calls to the \"process()\" or \"flush()\" methods.\n"
+"\n"
+"Signature:\n"
+" flush()\n"
+"\n"
+"Returns:\n"
+" The compressed output data (bytes)\n"
+"\n"
+"Raises:\n"
+" brotli.error: If compression fails\n");
+
+static PyObject* brotli_Compressor_flush(brotli_Compressor *self) {
+ PyObject *ret = NULL;
+ std::vector<uint8_t> output;
+ BROTLI_BOOL ok = BROTLI_TRUE;
+
+ if (!self->enc) {
+ ok = BROTLI_FALSE;
+ goto end;
+ }
+
+ ok = compress_stream(self->enc, BROTLI_OPERATION_FLUSH,
+ &output, NULL, 0);
+
+end:
+ if (ok) {
+ ret = PyBytes_FromStringAndSize((char*)(output.size() ? &output[0] : NULL), output.size());
+ } else {
+ PyErr_SetString(BrotliError, "BrotliEncoderCompressStream failed while flushing the stream");
+ }
+
+ return ret;
+}
+
+PyDoc_STRVAR(brotli_Compressor_finish_doc,
+"Process all pending input and complete all compression, returning a string\n"
+"containing the remaining compressed data. This data should be concatenated\n"
+"to the output produced by any preceding calls to the \"process()\" or\n"
+"\"flush()\" methods.\n"
+"After calling \"finish()\", the \"process()\" and \"flush()\" methods\n"
+"cannot be called again, and a new \"Compressor\" object should be created.\n"
+"\n"
+"Signature:\n"
+" finish(string)\n"
+"\n"
+"Returns:\n"
+" The compressed output data (bytes)\n"
+"\n"
+"Raises:\n"
+" brotli.error: If compression fails\n");
+
+static PyObject* brotli_Compressor_finish(brotli_Compressor *self) {
+ PyObject *ret = NULL;
+ std::vector<uint8_t> output;
+ BROTLI_BOOL ok = BROTLI_TRUE;
+
+ if (!self->enc) {
+ ok = BROTLI_FALSE;
+ goto end;
+ }
+
+ ok = compress_stream(self->enc, BROTLI_OPERATION_FINISH,
+ &output, NULL, 0);
+
+ if (ok) {
+ ok = BrotliEncoderIsFinished(self->enc);
+ }
+
+end:
+ if (ok) {
+ ret = PyBytes_FromStringAndSize((char*)(output.empty() ? NULL : &output[0]), output.size());
+ } else {
+ PyErr_SetString(BrotliError, "BrotliEncoderCompressStream failed while finishing the stream");
+ }
+
+ return ret;
+}
+
+static PyMemberDef brotli_Compressor_members[] = {
+ {NULL} /* Sentinel */
+};
+
+static PyMethodDef brotli_Compressor_methods[] = {
+ {"process", (PyCFunction)brotli_Compressor_process, METH_VARARGS, brotli_Compressor_process_doc},
+ {"flush", (PyCFunction)brotli_Compressor_flush, METH_NOARGS, brotli_Compressor_flush_doc},
+ {"finish", (PyCFunction)brotli_Compressor_finish, METH_NOARGS, brotli_Compressor_finish_doc},
+ {NULL} /* Sentinel */
+};
+
+static PyTypeObject brotli_CompressorType = {
+ #if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+ #else
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size*/
+ #endif
+ "brotli.Compressor", /* tp_name */
+ sizeof(brotli_Compressor), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ (destructor)brotli_Compressor_dealloc, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ brotli_Compressor_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ brotli_Compressor_methods, /* tp_methods */
+ brotli_Compressor_members, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)brotli_Compressor_init, /* tp_init */
+ 0, /* tp_alloc */
+ brotli_Compressor_new, /* tp_new */
+};
+
+static BROTLI_BOOL decompress_stream(BrotliDecoderState* dec,
+ std::vector<uint8_t>* output,
+ uint8_t* input, size_t input_length) {
+ BROTLI_BOOL ok = BROTLI_TRUE;
+ Py_BEGIN_ALLOW_THREADS
+
+ size_t available_in = input_length;
+ const uint8_t* next_in = input;
+ size_t available_out = 0;
+ uint8_t* next_out = NULL;
+
+ BrotliDecoderResult result = BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT;
+ while (result == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {
+ result = BrotliDecoderDecompressStream(dec,
+ &available_in, &next_in,
+ &available_out, &next_out, NULL);
+ size_t buffer_length = 0; // Request all available output.
+ const uint8_t* buffer = BrotliDecoderTakeOutput(dec, &buffer_length);
+ if (buffer_length) {
+ (*output).insert((*output).end(), buffer, buffer + buffer_length);
+ }
+ }
+ ok = result != BROTLI_DECODER_RESULT_ERROR && !available_in;
+
+ Py_END_ALLOW_THREADS
+ return ok;
+}
+
+PyDoc_STRVAR(brotli_Decompressor_doc,
+"An object to decompress a byte string.\n"
+"\n"
+"Signature:\n"
+" Decompressor()\n"
+"\n"
+"Raises:\n"
+" brotli.error: If arguments are invalid.\n");
+
+typedef struct {
+ PyObject_HEAD
+ BrotliDecoderState* dec;
+} brotli_Decompressor;
+
+static void brotli_Decompressor_dealloc(brotli_Decompressor* self) {
+ BrotliDecoderDestroyInstance(self->dec);
+ #if PY_MAJOR_VERSION >= 3
+ Py_TYPE(self)->tp_free((PyObject*)self);
+ #else
+ self->ob_type->tp_free((PyObject*)self);
+ #endif
+}
+
+static PyObject* brotli_Decompressor_new(PyTypeObject *type, PyObject *args, PyObject *keywds) {
+ brotli_Decompressor *self;
+ self = (brotli_Decompressor *)type->tp_alloc(type, 0);
+
+ if (self != NULL) {
+ self->dec = BrotliDecoderCreateInstance(0, 0, 0);
+ }
+
+ return (PyObject *)self;
+}
+
+static int brotli_Decompressor_init(brotli_Decompressor *self, PyObject *args, PyObject *keywds) {
+ int ok;
+
+ static const char *kwlist[] = {NULL};
+
+ ok = PyArg_ParseTupleAndKeywords(args, keywds, "|:Decompressor",
+ const_cast<char **>(kwlist));
+ if (!ok)
+ return -1;
+ if (!self->dec)
+ return -1;
+
+ return 0;
+}
+
+PyDoc_STRVAR(brotli_Decompressor_process_doc,
+"Process \"string\" for decompression, returning a string that contains \n"
+"decompressed output data. This data should be concatenated to the output \n"
+"produced by any preceding calls to the \"process()\" method. \n"
+"Some or all of the input may be kept in internal buffers for later \n"
+"processing, and the decompressed output data may be empty until enough input \n"
+"has been accumulated.\n"
+"\n"
+"Signature:\n"
+" decompress(string)\n"
+"\n"
+"Args:\n"
+" string (bytes): The input data\n"
+"\n"
+"Returns:\n"
+" The decompressed output data (bytes)\n"
+"\n"
+"Raises:\n"
+" brotli.error: If decompression fails\n");
+
+static PyObject* brotli_Decompressor_process(brotli_Decompressor *self, PyObject *args) {
+ PyObject* ret = NULL;
+ std::vector<uint8_t> output;
+ Py_buffer input;
+ BROTLI_BOOL ok = BROTLI_TRUE;
+
+#if PY_MAJOR_VERSION >= 3
+ ok = (BROTLI_BOOL)PyArg_ParseTuple(args, "y*:process", &input);
+#else
+ ok = (BROTLI_BOOL)PyArg_ParseTuple(args, "s*:process", &input);
+#endif
+
+ if (!ok)
+ return NULL;
+
+ if (!self->dec) {
+ ok = BROTLI_FALSE;
+ goto end;
+ }
+
+ ok = decompress_stream(self->dec, &output, static_cast<uint8_t*>(input.buf), input.len);
+
+end:
+ PyBuffer_Release(&input);
+ if (ok) {
+ ret = PyBytes_FromStringAndSize((char*)(output.empty() ? NULL : &output[0]), output.size());
+ } else {
+ PyErr_SetString(BrotliError, "BrotliDecoderDecompressStream failed while processing the stream");
+ }
+
+ return ret;
+}
+
+PyDoc_STRVAR(brotli_Decompressor_is_finished_doc,
+"Checks if decoder instance reached the final state.\n"
+"\n"
+"Signature:\n"
+" is_finished()\n"
+"\n"
+"Returns:\n"
+" True if the decoder is in a state where it reached the end of the input\n"
+" and produced all of the output\n"
+" False otherwise\n"
+"\n"
+"Raises:\n"
+" brotli.error: If decompression fails\n");
+
+static PyObject* brotli_Decompressor_is_finished(brotli_Decompressor *self) {
+ PyObject *ret = NULL;
+ std::vector<uint8_t> output;
+ BROTLI_BOOL ok = BROTLI_TRUE;
+
+ if (!self->dec) {
+ ok = BROTLI_FALSE;
+ PyErr_SetString(BrotliError, "BrotliDecoderState is NULL while checking is_finished");
+ goto end;
+ }
+
+ if (BrotliDecoderIsFinished(self->dec)) {
+ Py_RETURN_TRUE;
+ } else {
+ Py_RETURN_FALSE;
+ }
+
+end:
+ if (ok) {
+ ret = PyBytes_FromStringAndSize((char*)(output.empty() ? NULL : &output[0]), output.size());
+ } else {
+ PyErr_SetString(BrotliError, "BrotliDecoderDecompressStream failed while finishing the stream");
+ }
+
+ return ret;
+}
+
+static PyMemberDef brotli_Decompressor_members[] = {
+ {NULL} /* Sentinel */
+};
+
+static PyMethodDef brotli_Decompressor_methods[] = {
+ {"process", (PyCFunction)brotli_Decompressor_process, METH_VARARGS, brotli_Decompressor_process_doc},
+ {"is_finished", (PyCFunction)brotli_Decompressor_is_finished, METH_NOARGS, brotli_Decompressor_is_finished_doc},
+ {NULL} /* Sentinel */
+};
+
+static PyTypeObject brotli_DecompressorType = {
+ #if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+ #else
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size*/
+ #endif
+ "brotli.Decompressor", /* tp_name */
+ sizeof(brotli_Decompressor), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ (destructor)brotli_Decompressor_dealloc, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ brotli_Decompressor_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ brotli_Decompressor_methods, /* tp_methods */
+ brotli_Decompressor_members, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)brotli_Decompressor_init, /* tp_init */
+ 0, /* tp_alloc */
+ brotli_Decompressor_new, /* tp_new */
+};
+
+PyDoc_STRVAR(brotli_decompress__doc__,
+"Decompress a compressed byte string.\n"
+"\n"
+"Signature:\n"
+" decompress(string)\n"
+"\n"
+"Args:\n"
+" string (bytes): The compressed input data.\n"
+"\n"
+"Returns:\n"
+" The decompressed byte string.\n"
+"\n"
+"Raises:\n"
+" brotli.error: If decompressor fails.\n");
+
+static PyObject* brotli_decompress(PyObject *self, PyObject *args, PyObject *keywds) {
+ PyObject *ret = NULL;
+ Py_buffer input;
+ const uint8_t* next_in;
+ size_t available_in;
+ int ok;
+
+ static const char *kwlist[] = {"string", NULL};
+
+#if PY_MAJOR_VERSION >= 3
+ ok = PyArg_ParseTupleAndKeywords(args, keywds, "y*|:decompress",
+ const_cast<char **>(kwlist), &input);
+#else
+ ok = PyArg_ParseTupleAndKeywords(args, keywds, "s*|:decompress",
+ const_cast<char **>(kwlist), &input);
+#endif
+
+ if (!ok)
+ return NULL;
+
+ std::vector<uint8_t> output;
+
+ /* >>> Pure C block; release python GIL. */
+ Py_BEGIN_ALLOW_THREADS
+
+ BrotliDecoderState* state = BrotliDecoderCreateInstance(0, 0, 0);
+
+ BrotliDecoderResult result = BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT;
+ next_in = static_cast<uint8_t*>(input.buf);
+ available_in = input.len;
+ while (result == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {
+ size_t available_out = 0;
+ result = BrotliDecoderDecompressStream(state, &available_in, &next_in,
+ &available_out, 0, 0);
+ const uint8_t* next_out = BrotliDecoderTakeOutput(state, &available_out);
+ if (available_out != 0)
+ output.insert(output.end(), next_out, next_out + available_out);
+ }
+ ok = result == BROTLI_DECODER_RESULT_SUCCESS && !available_in;
+ BrotliDecoderDestroyInstance(state);
+
+ Py_END_ALLOW_THREADS
+ /* <<< Pure C block end. Python GIL reacquired. */
+
+ PyBuffer_Release(&input);
+ if (ok) {
+ ret = PyBytes_FromStringAndSize((char*)(output.size() ? &output[0] : NULL), output.size());
+ } else {
+ PyErr_SetString(BrotliError, "BrotliDecompress failed");
+ }
+
+ return ret;
+}
+
+static PyMethodDef brotli_methods[] = {
+ {"decompress", (PyCFunction)brotli_decompress, METH_VARARGS | METH_KEYWORDS, brotli_decompress__doc__},
+ {NULL, NULL, 0, NULL}
+};
+
+PyDoc_STRVAR(brotli_doc, "Implementation module for the Brotli library.");
+
+#if PY_MAJOR_VERSION >= 3
+#define INIT_BROTLI PyInit__brotli
+#define CREATE_BROTLI PyModule_Create(&brotli_module)
+#define RETURN_BROTLI return m
+#define RETURN_NULL return NULL
+
+static struct PyModuleDef brotli_module = {
+ PyModuleDef_HEAD_INIT,
+ "_brotli", /* m_name */
+ brotli_doc, /* m_doc */
+ 0, /* m_size */
+ brotli_methods, /* m_methods */
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL /* m_free */
+};
+#else
+#define INIT_BROTLI init_brotli
+#define CREATE_BROTLI Py_InitModule3("_brotli", brotli_methods, brotli_doc)
+#define RETURN_BROTLI return
+#define RETURN_NULL return
+#endif
+
+PyMODINIT_FUNC INIT_BROTLI(void) {
+ PyObject *m = CREATE_BROTLI;
+
+ BrotliError = PyErr_NewException((char*) "brotli.error", NULL, NULL);
+ if (BrotliError != NULL) {
+ Py_INCREF(BrotliError);
+ PyModule_AddObject(m, "error", BrotliError);
+ }
+
+ if (PyType_Ready(&brotli_CompressorType) < 0) {
+ RETURN_NULL;
+ }
+ Py_INCREF(&brotli_CompressorType);
+ PyModule_AddObject(m, "Compressor", (PyObject *)&brotli_CompressorType);
+
+ if (PyType_Ready(&brotli_DecompressorType) < 0) {
+ RETURN_NULL;
+ }
+ Py_INCREF(&brotli_DecompressorType);
+ PyModule_AddObject(m, "Decompressor", (PyObject *)&brotli_DecompressorType);
+
+ PyModule_AddIntConstant(m, "MODE_GENERIC", (int) BROTLI_MODE_GENERIC);
+ PyModule_AddIntConstant(m, "MODE_TEXT", (int) BROTLI_MODE_TEXT);
+ PyModule_AddIntConstant(m, "MODE_FONT", (int) BROTLI_MODE_FONT);
+
+ char version[16];
+ snprintf(version, sizeof(version), "%d.%d.%d",
+ BROTLI_VERSION >> 24, (BROTLI_VERSION >> 12) & 0xFFF, BROTLI_VERSION & 0xFFF);
+ PyModule_AddStringConstant(m, "__version__", version);
+
+ RETURN_BROTLI;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/bro.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/bro.py
new file mode 100755
index 000000000..7a094b4c1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/bro.py
@@ -0,0 +1,160 @@
+#! /usr/bin/env python
+"""Compression/decompression utility using the Brotli algorithm."""
+
+from __future__ import print_function
+import argparse
+import sys
+import os
+import platform
+
+import brotli
+
+# default values of encoder parameters
+DEFAULT_PARAMS = {
+ 'mode': brotli.MODE_GENERIC,
+ 'quality': 11,
+ 'lgwin': 22,
+ 'lgblock': 0,
+}
+
+
+def get_binary_stdio(stream):
+ """ Return the specified standard input, output or errors stream as a
+ 'raw' buffer object suitable for reading/writing binary data from/to it.
+ """
+ assert stream in ['stdin', 'stdout', 'stderr'], 'invalid stream name'
+ stdio = getattr(sys, stream)
+ if sys.version_info[0] < 3:
+ if sys.platform == 'win32':
+ # set I/O stream binary flag on python2.x (Windows)
+ runtime = platform.python_implementation()
+ if runtime == 'PyPy':
+ # the msvcrt trick doesn't work in pypy, so I use fdopen
+ mode = 'rb' if stream == 'stdin' else 'wb'
+ stdio = os.fdopen(stdio.fileno(), mode, 0)
+ else:
+ # this works with CPython -- untested on other implementations
+ import msvcrt
+ msvcrt.setmode(stdio.fileno(), os.O_BINARY)
+ return stdio
+ else:
+ # get 'buffer' attribute to read/write binary data on python3.x
+ if hasattr(stdio, 'buffer'):
+ return stdio.buffer
+ else:
+ orig_stdio = getattr(sys, '__%s__' % stream)
+ return orig_stdio.buffer
+
+
+def main(args=None):
+
+ parser = argparse.ArgumentParser(
+ prog=os.path.basename(__file__), description=__doc__)
+ parser.add_argument(
+ '--version', action='version', version=brotli.__version__)
+ parser.add_argument(
+ '-i',
+ '--input',
+ metavar='FILE',
+ type=str,
+ dest='infile',
+ help='Input file',
+ default=None)
+ parser.add_argument(
+ '-o',
+ '--output',
+ metavar='FILE',
+ type=str,
+ dest='outfile',
+ help='Output file',
+ default=None)
+ parser.add_argument(
+ '-f',
+ '--force',
+ action='store_true',
+ help='Overwrite existing output file',
+ default=False)
+ parser.add_argument(
+ '-d',
+ '--decompress',
+ action='store_true',
+ help='Decompress input file',
+ default=False)
+ params = parser.add_argument_group('optional encoder parameters')
+ params.add_argument(
+ '-m',
+ '--mode',
+ metavar='MODE',
+ type=int,
+ choices=[0, 1, 2],
+ help='The compression mode can be 0 for generic input, '
+ '1 for UTF-8 encoded text, or 2 for WOFF 2.0 font data. '
+ 'Defaults to 0.')
+ params.add_argument(
+ '-q',
+ '--quality',
+ metavar='QUALITY',
+ type=int,
+ choices=list(range(0, 12)),
+ help='Controls the compression-speed vs compression-density '
+ 'tradeoff. The higher the quality, the slower the '
+ 'compression. Range is 0 to 11. Defaults to 11.')
+ params.add_argument(
+ '--lgwin',
+ metavar='LGWIN',
+ type=int,
+ choices=list(range(10, 25)),
+ help='Base 2 logarithm of the sliding window size. Range is '
+ '10 to 24. Defaults to 22.')
+ params.add_argument(
+ '--lgblock',
+ metavar='LGBLOCK',
+ type=int,
+ choices=[0] + list(range(16, 25)),
+ help='Base 2 logarithm of the maximum input block size. '
+ 'Range is 16 to 24. If set to 0, the value will be set based '
+ 'on the quality. Defaults to 0.')
+ # set default values using global DEFAULT_PARAMS dictionary
+ parser.set_defaults(**DEFAULT_PARAMS)
+
+ options = parser.parse_args(args=args)
+
+ if options.infile:
+ if not os.path.isfile(options.infile):
+ parser.error('file "%s" not found' % options.infile)
+ with open(options.infile, 'rb') as infile:
+ data = infile.read()
+ else:
+ if sys.stdin.isatty():
+ # interactive console, just quit
+ parser.error('no input')
+ infile = get_binary_stdio('stdin')
+ data = infile.read()
+
+ if options.outfile:
+ if os.path.isfile(options.outfile) and not options.force:
+ parser.error('output file exists')
+ outfile = open(options.outfile, 'wb')
+ else:
+ outfile = get_binary_stdio('stdout')
+
+ try:
+ if options.decompress:
+ data = brotli.decompress(data)
+ else:
+ data = brotli.compress(
+ data,
+ mode=options.mode,
+ quality=options.quality,
+ lgwin=options.lgwin,
+ lgblock=options.lgblock)
+ except brotli.error as e:
+ parser.exit(1,
+ 'bro: error: %s: %s' % (e, options.infile or 'sys.stdin'))
+
+ outfile.write(data)
+ outfile.close()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/brotli.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/brotli.py
new file mode 100644
index 000000000..d66966ba6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/brotli.py
@@ -0,0 +1,56 @@
+# Copyright 2016 The Brotli Authors. All rights reserved.
+#
+# Distributed under MIT license.
+# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+"""Functions to compress and decompress data using the Brotli library."""
+
+import _brotli
+
+
+# The library version.
+__version__ = _brotli.__version__
+
+# The compression mode.
+MODE_GENERIC = _brotli.MODE_GENERIC
+MODE_TEXT = _brotli.MODE_TEXT
+MODE_FONT = _brotli.MODE_FONT
+
+# The Compressor object.
+Compressor = _brotli.Compressor
+
+# The Decompressor object.
+Decompressor = _brotli.Decompressor
+
+# Compress a byte string.
+def compress(string, mode=MODE_GENERIC, quality=11, lgwin=22, lgblock=0):
+ """Compress a byte string.
+
+ Args:
+ string (bytes): The input data.
+ mode (int, optional): The compression mode can be MODE_GENERIC (default),
+ MODE_TEXT (for UTF-8 format text input) or MODE_FONT (for WOFF 2.0).
+ quality (int, optional): Controls the compression-speed vs compression-
+ density tradeoff. The higher the quality, the slower the compression.
+ Range is 0 to 11. Defaults to 11.
+ lgwin (int, optional): Base 2 logarithm of the sliding window size. Range
+ is 10 to 24. Defaults to 22.
+ lgblock (int, optional): Base 2 logarithm of the maximum input block size.
+ Range is 16 to 24. If set to 0, the value will be set based on the
+ quality. Defaults to 0.
+
+ Returns:
+ The compressed byte string.
+
+ Raises:
+ brotli.error: If arguments are invalid, or compressor fails.
+ """
+ compressor = Compressor(mode=mode, quality=quality, lgwin=lgwin,
+ lgblock=lgblock)
+ return compressor.process(string) + compressor.finish()
+
+# Decompress a compressed byte string.
+decompress = _brotli.decompress
+
+# Raised if compression or decompression fails.
+error = _brotli.error
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/__init__.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/__init__.py
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/_test_utils.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/_test_utils.py
new file mode 100644
index 000000000..104e6548e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/_test_utils.py
@@ -0,0 +1,112 @@
+from __future__ import print_function
+import filecmp
+import glob
+import itertools
+import os
+import sys
+import sysconfig
+import tempfile
+import unittest
+
+
+project_dir = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
+src_dir = os.path.join(project_dir, 'python')
+test_dir = os.path.join(project_dir, 'tests')
+
+python_exe = sys.executable or 'python'
+bro_path = os.path.join(src_dir, 'bro.py')
+BRO_ARGS = [python_exe, bro_path]
+
+# Get the platform/version-specific build folder.
+# By default, the distutils build base is in the same location as setup.py.
+platform_lib_name = 'lib.{platform}-{version[0]}.{version[1]}'.format(
+ platform=sysconfig.get_platform(), version=sys.version_info)
+build_dir = os.path.join(project_dir, 'bin', platform_lib_name)
+
+# Prepend the build folder to sys.path and the PYTHONPATH environment variable.
+if build_dir not in sys.path:
+ sys.path.insert(0, build_dir)
+TEST_ENV = os.environ.copy()
+if 'PYTHONPATH' not in TEST_ENV:
+ TEST_ENV['PYTHONPATH'] = build_dir
+else:
+ TEST_ENV['PYTHONPATH'] = build_dir + os.pathsep + TEST_ENV['PYTHONPATH']
+
+TESTDATA_DIR = os.path.join(test_dir, 'testdata')
+
+TESTDATA_FILES = [
+ 'empty', # Empty file
+ '10x10y', # Small text
+ 'alice29.txt', # Large text
+ 'random_org_10k.bin', # Small data
+ 'mapsdatazrh', # Large data
+]
+
+TESTDATA_PATHS = [os.path.join(TESTDATA_DIR, f) for f in TESTDATA_FILES]
+
+TESTDATA_PATHS_FOR_DECOMPRESSION = glob.glob(
+ os.path.join(TESTDATA_DIR, '*.compressed'))
+
+TEMP_DIR = tempfile.mkdtemp()
+
+
+def get_temp_compressed_name(filename):
+ return os.path.join(TEMP_DIR, os.path.basename(filename + '.bro'))
+
+
+def get_temp_uncompressed_name(filename):
+ return os.path.join(TEMP_DIR, os.path.basename(filename + '.unbro'))
+
+
+def bind_method_args(method, *args, **kwargs):
+ return lambda self: method(self, *args, **kwargs)
+
+
+def generate_test_methods(test_case_class,
+ for_decompression=False,
+ variants=None):
+ # Add test methods for each test data file. This makes identifying problems
+ # with specific compression scenarios easier.
+ if for_decompression:
+ paths = TESTDATA_PATHS_FOR_DECOMPRESSION
+ else:
+ paths = TESTDATA_PATHS
+ opts = []
+ if variants:
+ opts_list = []
+ for k, v in variants.items():
+ opts_list.append([r for r in itertools.product([k], v)])
+ for o in itertools.product(*opts_list):
+ opts_name = '_'.join([str(i) for i in itertools.chain(*o)])
+ opts_dict = dict(o)
+ opts.append([opts_name, opts_dict])
+ else:
+ opts.append(['', {}])
+ for method in [m for m in dir(test_case_class) if m.startswith('_test')]:
+ for testdata in paths:
+ for (opts_name, opts_dict) in opts:
+ f = os.path.splitext(os.path.basename(testdata))[0]
+ name = 'test_{method}_{options}_{file}'.format(
+ method=method, options=opts_name, file=f)
+ func = bind_method_args(
+ getattr(test_case_class, method), testdata, **opts_dict)
+ setattr(test_case_class, name, func)
+
+
+class TestCase(unittest.TestCase):
+
+ def tearDown(self):
+ for f in TESTDATA_PATHS:
+ try:
+ os.unlink(get_temp_compressed_name(f))
+ except OSError:
+ pass
+ try:
+ os.unlink(get_temp_uncompressed_name(f))
+ except OSError:
+ pass
+
+ def assertFilesMatch(self, first, second):
+ self.assertTrue(
+ filecmp.cmp(first, second, shallow=False),
+ 'File {} differs from {}'.format(first, second))
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/bro_test.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/bro_test.py
new file mode 100644
index 000000000..b55129def
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/bro_test.py
@@ -0,0 +1,102 @@
+# Copyright 2016 The Brotli Authors. All rights reserved.
+#
+# Distributed under MIT license.
+# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+import subprocess
+import unittest
+
+from . import _test_utils
+import brotli
+
+BRO_ARGS = _test_utils.BRO_ARGS
+TEST_ENV = _test_utils.TEST_ENV
+
+
+def _get_original_name(test_data):
+ return test_data.split('.compressed')[0]
+
+
+class TestBroDecompress(_test_utils.TestCase):
+
+ def _check_decompression(self, test_data):
+ # Verify decompression matches the original.
+ temp_uncompressed = _test_utils.get_temp_uncompressed_name(test_data)
+ original = _get_original_name(test_data)
+ self.assertFilesMatch(temp_uncompressed, original)
+
+ def _decompress_file(self, test_data):
+ temp_uncompressed = _test_utils.get_temp_uncompressed_name(test_data)
+ args = BRO_ARGS + ['-f', '-d', '-i', test_data, '-o', temp_uncompressed]
+ subprocess.check_call(args, env=TEST_ENV)
+
+ def _decompress_pipe(self, test_data):
+ temp_uncompressed = _test_utils.get_temp_uncompressed_name(test_data)
+ args = BRO_ARGS + ['-d']
+ with open(temp_uncompressed, 'wb') as out_file:
+ with open(test_data, 'rb') as in_file:
+ subprocess.check_call(
+ args, stdin=in_file, stdout=out_file, env=TEST_ENV)
+
+ def _test_decompress_file(self, test_data):
+ self._decompress_file(test_data)
+ self._check_decompression(test_data)
+
+ def _test_decompress_pipe(self, test_data):
+ self._decompress_pipe(test_data)
+ self._check_decompression(test_data)
+
+
+_test_utils.generate_test_methods(TestBroDecompress, for_decompression=True)
+
+
+class TestBroCompress(_test_utils.TestCase):
+
+ VARIANTS = {'quality': (1, 6, 9, 11), 'lgwin': (10, 15, 20, 24)}
+
+ def _check_decompression(self, test_data, **kwargs):
+ # Write decompression to temp file and verify it matches the original.
+ temp_uncompressed = _test_utils.get_temp_uncompressed_name(test_data)
+ temp_compressed = _test_utils.get_temp_compressed_name(test_data)
+ original = test_data
+ args = BRO_ARGS + ['-f', '-d']
+ args.extend(['-i', temp_compressed, '-o', temp_uncompressed])
+ subprocess.check_call(args, env=TEST_ENV)
+ self.assertFilesMatch(temp_uncompressed, original)
+
+ def _compress_file(self, test_data, **kwargs):
+ temp_compressed = _test_utils.get_temp_compressed_name(test_data)
+ args = BRO_ARGS + ['-f']
+ if 'quality' in kwargs:
+ args.extend(['-q', str(kwargs['quality'])])
+ if 'lgwin' in kwargs:
+ args.extend(['--lgwin', str(kwargs['lgwin'])])
+ args.extend(['-i', test_data, '-o', temp_compressed])
+ subprocess.check_call(args, env=TEST_ENV)
+
+ def _compress_pipe(self, test_data, **kwargs):
+ temp_compressed = _test_utils.get_temp_compressed_name(test_data)
+ args = BRO_ARGS
+ if 'quality' in kwargs:
+ args.extend(['-q', str(kwargs['quality'])])
+ if 'lgwin' in kwargs:
+ args.extend(['--lgwin', str(kwargs['lgwin'])])
+ with open(temp_compressed, 'wb') as out_file:
+ with open(test_data, 'rb') as in_file:
+ subprocess.check_call(
+ args, stdin=in_file, stdout=out_file, env=TEST_ENV)
+
+ def _test_compress_file(self, test_data, **kwargs):
+ self._compress_file(test_data, **kwargs)
+ self._check_decompression(test_data)
+
+ def _test_compress_pipe(self, test_data, **kwargs):
+ self._compress_pipe(test_data, **kwargs)
+ self._check_decompression(test_data)
+
+
+_test_utils.generate_test_methods(
+ TestBroCompress, variants=TestBroCompress.VARIANTS)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/compress_test.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/compress_test.py
new file mode 100644
index 000000000..46ff68f50
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/compress_test.py
@@ -0,0 +1,41 @@
+# Copyright 2016 The Brotli Authors. All rights reserved.
+#
+# Distributed under MIT license.
+# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+import unittest
+
+from . import _test_utils
+import brotli
+
+
+class TestCompress(_test_utils.TestCase):
+
+ VARIANTS = {'quality': (1, 6, 9, 11), 'lgwin': (10, 15, 20, 24)}
+
+ def _check_decompression(self, test_data, **kwargs):
+ kwargs = {}
+ # Write decompression to temp file and verify it matches the original.
+ temp_uncompressed = _test_utils.get_temp_uncompressed_name(test_data)
+ temp_compressed = _test_utils.get_temp_compressed_name(test_data)
+ original = test_data
+ with open(temp_uncompressed, 'wb') as out_file:
+ with open(temp_compressed, 'rb') as in_file:
+ out_file.write(brotli.decompress(in_file.read(), **kwargs))
+ self.assertFilesMatch(temp_uncompressed, original)
+
+ def _compress(self, test_data, **kwargs):
+ temp_compressed = _test_utils.get_temp_compressed_name(test_data)
+ with open(temp_compressed, 'wb') as out_file:
+ with open(test_data, 'rb') as in_file:
+ out_file.write(brotli.compress(in_file.read(), **kwargs))
+
+ def _test_compress(self, test_data, **kwargs):
+ self._compress(test_data, **kwargs)
+ self._check_decompression(test_data, **kwargs)
+
+
+_test_utils.generate_test_methods(TestCompress, variants=TestCompress.VARIANTS)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/compressor_test.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/compressor_test.py
new file mode 100644
index 000000000..2d4791996
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/compressor_test.py
@@ -0,0 +1,94 @@
+# Copyright 2016 The Brotli Authors. All rights reserved.
+#
+# Distributed under MIT license.
+# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+import functools
+import unittest
+
+from . import _test_utils
+import brotli
+
+
+# Do not inherit from TestCase here to ensure that test methods
+# are not run automatically and instead are run as part of a specific
+# configuration below.
+class _TestCompressor(object):
+
+ CHUNK_SIZE = 2048
+
+ def tearDown(self):
+ self.compressor = None
+
+ def _check_decompression(self, test_data):
+ # Write decompression to temp file and verify it matches the original.
+ temp_uncompressed = _test_utils.get_temp_uncompressed_name(test_data)
+ temp_compressed = _test_utils.get_temp_compressed_name(test_data)
+ original = test_data
+ with open(temp_uncompressed, 'wb') as out_file:
+ with open(temp_compressed, 'rb') as in_file:
+ out_file.write(brotli.decompress(in_file.read()))
+ self.assertFilesMatch(temp_uncompressed, original)
+
+ def _test_single_process(self, test_data):
+ # Write single-shot compression to temp file.
+ temp_compressed = _test_utils.get_temp_compressed_name(test_data)
+ with open(temp_compressed, 'wb') as out_file:
+ with open(test_data, 'rb') as in_file:
+ out_file.write(self.compressor.process(in_file.read()))
+ out_file.write(self.compressor.finish())
+ self._check_decompression(test_data)
+
+ def _test_multiple_process(self, test_data):
+ # Write chunked compression to temp file.
+ temp_compressed = _test_utils.get_temp_compressed_name(test_data)
+ with open(temp_compressed, 'wb') as out_file:
+ with open(test_data, 'rb') as in_file:
+ read_chunk = functools.partial(in_file.read, self.CHUNK_SIZE)
+ for data in iter(read_chunk, b''):
+ out_file.write(self.compressor.process(data))
+ out_file.write(self.compressor.finish())
+ self._check_decompression(test_data)
+
+ def _test_multiple_process_and_flush(self, test_data):
+ # Write chunked and flushed compression to temp file.
+ temp_compressed = _test_utils.get_temp_compressed_name(test_data)
+ with open(temp_compressed, 'wb') as out_file:
+ with open(test_data, 'rb') as in_file:
+ read_chunk = functools.partial(in_file.read, self.CHUNK_SIZE)
+ for data in iter(read_chunk, b''):
+ out_file.write(self.compressor.process(data))
+ out_file.write(self.compressor.flush())
+ out_file.write(self.compressor.finish())
+ self._check_decompression(test_data)
+
+
+_test_utils.generate_test_methods(_TestCompressor)
+
+
+class TestCompressorQuality1(_TestCompressor, _test_utils.TestCase):
+
+ def setUp(self):
+ self.compressor = brotli.Compressor(quality=1)
+
+
+class TestCompressorQuality6(_TestCompressor, _test_utils.TestCase):
+
+ def setUp(self):
+ self.compressor = brotli.Compressor(quality=6)
+
+
+class TestCompressorQuality9(_TestCompressor, _test_utils.TestCase):
+
+ def setUp(self):
+ self.compressor = brotli.Compressor(quality=9)
+
+
+class TestCompressorQuality11(_TestCompressor, _test_utils.TestCase):
+
+ def setUp(self):
+ self.compressor = brotli.Compressor(quality=11)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/decompress_test.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/decompress_test.py
new file mode 100644
index 000000000..814e56332
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/decompress_test.py
@@ -0,0 +1,42 @@
+# Copyright 2016 The Brotli Authors. All rights reserved.
+#
+# Distributed under MIT license.
+# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+import unittest
+
+from . import _test_utils
+import brotli
+
+
+def _get_original_name(test_data):
+ return test_data.split('.compressed')[0]
+
+
+class TestDecompress(_test_utils.TestCase):
+
+ def _check_decompression(self, test_data):
+ # Verify decompression matches the original.
+ temp_uncompressed = _test_utils.get_temp_uncompressed_name(test_data)
+ original = _get_original_name(test_data)
+ self.assertFilesMatch(temp_uncompressed, original)
+
+ def _decompress(self, test_data):
+ temp_uncompressed = _test_utils.get_temp_uncompressed_name(test_data)
+ with open(temp_uncompressed, 'wb') as out_file:
+ with open(test_data, 'rb') as in_file:
+ out_file.write(brotli.decompress(in_file.read()))
+
+ def _test_decompress(self, test_data):
+ self._decompress(test_data)
+ self._check_decompression(test_data)
+
+ def test_garbage_appended(self):
+ with self.assertRaises(brotli.error):
+ brotli.decompress(brotli.compress(b'a') + b'a')
+
+
+_test_utils.generate_test_methods(TestDecompress, for_decompression=True)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/decompressor_test.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/decompressor_test.py
new file mode 100644
index 000000000..05918ada8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/python/tests/decompressor_test.py
@@ -0,0 +1,59 @@
+# Copyright 2016 The Brotli Authors. All rights reserved.
+#
+# Distributed under MIT license.
+# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+import functools
+import unittest
+
+from . import _test_utils
+import brotli
+
+
+def _get_original_name(test_data):
+ return test_data.split('.compressed')[0]
+
+
+class TestDecompressor(_test_utils.TestCase):
+
+ CHUNK_SIZE = 1
+
+ def setUp(self):
+ self.decompressor = brotli.Decompressor()
+
+ def tearDown(self):
+ self.decompressor = None
+
+ def _check_decompression(self, test_data):
+ # Verify decompression matches the original.
+ temp_uncompressed = _test_utils.get_temp_uncompressed_name(test_data)
+ original = _get_original_name(test_data)
+ self.assertFilesMatch(temp_uncompressed, original)
+
+ def _decompress(self, test_data):
+ temp_uncompressed = _test_utils.get_temp_uncompressed_name(test_data)
+ with open(temp_uncompressed, 'wb') as out_file:
+ with open(test_data, 'rb') as in_file:
+ read_chunk = functools.partial(in_file.read, self.CHUNK_SIZE)
+ for data in iter(read_chunk, b''):
+ out_file.write(self.decompressor.process(data))
+ self.assertTrue(self.decompressor.is_finished())
+
+ def _test_decompress(self, test_data):
+ self._decompress(test_data)
+ self._check_decompression(test_data)
+
+ def test_garbage_appended(self):
+ with self.assertRaises(brotli.error):
+ self.decompressor.process(brotli.compress(b'a') + b'a')
+
+ def test_already_finished(self):
+ self.decompressor.process(brotli.compress(b'a'))
+ with self.assertRaises(brotli.error):
+ self.decompressor.process(b'a')
+
+
+_test_utils.generate_test_methods(TestDecompressor, for_decompression=True)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/BUILD b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/BUILD
new file mode 100755
index 000000000..7b7d81b83
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/BUILD
@@ -0,0 +1,44 @@
+# Description: brotli research tools.
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # MIT
+
+cc_library(
+ name = "dm",
+ srcs = ["deorummolae.cc"],
+ hdrs = [
+ "deorummolae.h",
+ "esaxx/sais.hxx",
+ ],
+)
+
+cc_library(
+ name = "durchschlag",
+ srcs = ["durchschlag.cc"],
+ hdrs = ["durchschlag.h"],
+ deps = ["@divsufsort//:libdivsufsort"],
+)
+
+cc_library(
+ name = "sieve",
+ srcs = ["sieve.cc"],
+ hdrs = ["sieve.h"],
+)
+
+cc_binary(
+ name = "dictionary_generator",
+ srcs = ["dictionary_generator.cc"],
+ deps = [
+ ":dm",
+ ":durchschlag",
+ ":sieve",
+ ],
+)
+
+cc_binary(
+ name = "brotli_decoder",
+ srcs = ["brotli_decoder.c"],
+ linkstatic = 1,
+ deps = ["@org_brotli//:brotlidec"],
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/BUILD.libdivsufsort b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/BUILD.libdivsufsort
new file mode 100644
index 000000000..ce60e9c20
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/BUILD.libdivsufsort
@@ -0,0 +1,55 @@
+package(
+ default_visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "libdivsufsort",
+ srcs = [
+ "lib/divsufsort.c",
+ "lib/sssort.c",
+ "lib/trsort.c",
+ "lib/utils.c",
+ ],
+ hdrs = [
+ "include/config.h",
+ "include/divsufsort.h",
+ "include/divsufsort_private.h",
+ ],
+ copts = [
+ "-DHAVE_CONFIG_H=1",
+ ],
+ includes = ["include"],
+)
+
+commom_awk_replaces = (
+ "gsub(/#cmakedefine/, \"#define\"); " +
+ "gsub(/@DIVSUFSORT_EXPORT@/, \"\"); " +
+ "gsub(/@DIVSUFSORT_IMPORT@/, \"\"); " +
+ "gsub(/@INLINE@/, \"inline\"); " +
+ "gsub(/@INCFILE@/, \"#include <inttypes.h>\"); " +
+ "gsub(/@SAUCHAR_TYPE@/, \"uint8_t\"); " +
+ "gsub(/@SAINT32_TYPE@/, \"int32_t\"); " +
+ "gsub(/@SAINT_PRId@/, \"PRId32\"); "
+)
+
+genrule(
+ name = "config_h",
+ srcs = ["include/config.h.cmake"],
+ outs = ["include/config.h"],
+ cmd = ("awk '{ " +
+ "gsub(/@HAVE_IO_H 1@/, \"HAVE_IO_H 0\"); " +
+ commom_awk_replaces +
+ "print; }' $(<) > $(@)"),
+)
+
+genrule(
+ name = "divsufsort_h",
+ srcs = ["include/divsufsort.h.cmake"],
+ outs = ["include/divsufsort.h"],
+ cmd = ("awk '{ " +
+ "gsub(/@W64BIT@/, \"\"); " +
+ "gsub(/@SAINDEX_TYPE@/, \"int32_t\"); " +
+ "gsub(/@SAINDEX_PRId@/, \"PRId32\"); " +
+ commom_awk_replaces +
+ "print; }' $(<) > $(@)"),
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/Makefile b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/Makefile
new file mode 100644
index 000000000..751b3162c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/Makefile
@@ -0,0 +1,17 @@
+CC = g++
+CFLAGS += -O2
+CPPFLAGS += -std=c++11
+SOURCES = $(wildcard *.cc)
+EXECUTABLES = $(SOURCES:.cc=)
+BINDIR = bin
+
+all: $(EXECUTABLES)
+
+$(BINDIR):
+ mkdir -p $@
+
+$(EXECUTABLES): $(BINDIR)
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(addsuffix .cc, $@) -o $(BINDIR)/$@ -lgflags_nothreads
+
+clean:
+ rm -rf $(BINDIR)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/README.md b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/README.md
new file mode 100644
index 000000000..9c87ef820
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/README.md
@@ -0,0 +1,67 @@
+## Introduction
+
+In this directory we publish simple tools to analyze backward reference distance distributions in LZ77 compression. We developed these tools to be able to make more efficient encoding of distances in large-window brotli. In large-window compression the average cost of a backward reference distance is higher, and this may allow for more advanced encoding strategies, such as delta coding or an increase in context size, to bring significant compression density improvements. Our tools visualize the backward references as histogram images, i.e., one pixel in the image shows how many distances of a certain range exist at a certain locality in the data. The human visual system is excellent at pattern detection, so we tried to roughly identify patterns visually before going into more quantitative analysis. These tools can turn out to be useful in development of other LZ77-based compressors and we hope you try them out.
+
+
+## Tools
+### find\_opt\_references
+
+This tool generates optimal (match-length-wise) backward references for every position in the input files and stores them in `*.dist` file described below.
+
+Example usage:
+
+ find_opt_references input.txt output.dist
+
+### draw\_histogram
+
+This tool generates a visualization of the distribution of backward references stored in `*.dist` file. The original file size has to be specified as a second parameter. The output is a grayscale PGM (binary) image.
+
+Example usage:
+
+ draw_histogram input.dist 65536 output.pgm
+
+Here's an example of resulting image:
+
+![](img/enwik9_brotli.png)
+
+### draw\_diff
+
+This tool generates a diff PPM (binary) image between two input 8-bit PGM (binary) images. Input images must be of same size. Useful for comparing different backward references distributions for same input file. Normally used for comparison of output images from `draw_histogram` tool.
+
+Example usage:
+
+ draw_diff image1.pgm image2.pgm diff.ppm
+
+For example the diff of this image
+
+![](img/enwik9_brotli.png)
+
+and this image
+
+![](img/enwik9_opt.png)
+
+looks like this:
+
+![](img/enwik9_diff.png)
+
+
+## Backward distance file format
+
+The format of `*.dist` files is as follows:
+
+ [[ 0| match length][ 1|position|distance]...]
+ [1 byte| 4 bytes][1 byte| 4 bytes| 4 bytes]
+
+More verbose explanation: for each backward reference there is a position-distance pair, also a copy length may be specified. Copy length is prefixed with flag byte 0, position-distance pair is prefixed with flag byte 1. Each number is a 32-bit integer. Copy length always comes before position-distance pair. Standalone copy length is allowed, in this case it is ignored.
+
+Here's an example of how to read from `*.dist` file:
+
+```c++
+#include "read_dist.h"
+
+FILE* f;
+int copy, pos, dist;
+while (ReadBackwardReference(fin, &copy, &pos, &dist)) {
+ ...
+}
+```
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/WORKSPACE b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/WORKSPACE
new file mode 100644
index 000000000..bb0f8ca08
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/WORKSPACE
@@ -0,0 +1,12 @@
+workspace(name = "org_brotli_research")
+
+local_repository(
+ name = "org_brotli",
+ path = "..",
+)
+
+new_local_repository(
+ name = "divsufsort",
+ build_file = "BUILD.libdivsufsort",
+ path = "libdivsufsort",
+)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/brotli_decoder.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/brotli_decoder.c
new file mode 100644
index 000000000..b1d556d23
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/brotli_decoder.c
@@ -0,0 +1,93 @@
+/* Copyright 2018 Google Inc. All Rights Reserved.
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <brotli/decode.h>
+
+#define BUFFER_SIZE (1u << 20)
+
+typedef struct Context {
+ FILE* fin;
+ FILE* fout;
+ uint8_t* input_buffer;
+ uint8_t* output_buffer;
+ BrotliDecoderState* decoder;
+} Context;
+
+void init(Context* ctx) {
+ ctx->fin = 0;
+ ctx->fout = 0;
+ ctx->input_buffer = 0;
+ ctx->output_buffer = 0;
+ ctx->decoder = 0;
+}
+
+void cleanup(Context* ctx) {
+ if (ctx->decoder) BrotliDecoderDestroyInstance(ctx->decoder);
+ if (ctx->output_buffer) free(ctx->output_buffer);
+ if (ctx->input_buffer) free(ctx->input_buffer);
+ if (ctx->fout) fclose(ctx->fout);
+ if (ctx->fin) fclose(ctx->fin);
+}
+
+void fail(Context* ctx, const char* message) {
+ fprintf(stderr, "%s\n", message);
+ exit(1);
+}
+
+int main(int argc, char** argv) {
+ Context ctx;
+ BrotliDecoderResult result = BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT;
+ size_t available_in;
+ const uint8_t* next_in;
+ size_t available_out = BUFFER_SIZE;
+ uint8_t* next_out;
+ init(&ctx);
+
+ ctx.fin = fdopen(STDIN_FILENO, "rb");
+ if (!ctx.fin) fail(&ctx, "can't open input file");
+ ctx.fout = fdopen(STDOUT_FILENO, "wb");
+ if (!ctx.fout) fail(&ctx, "can't open output file");
+ ctx.input_buffer = (uint8_t*)malloc(BUFFER_SIZE);
+ if (!ctx.input_buffer) fail(&ctx, "out of memory / input buffer");
+ ctx.output_buffer = (uint8_t*)malloc(BUFFER_SIZE);
+ if (!ctx.output_buffer) fail(&ctx, "out of memory / output buffer");
+ ctx.decoder = BrotliDecoderCreateInstance(0, 0, 0);
+ if (!ctx.decoder) fail(&ctx, "out of memory / decoder");
+ BrotliDecoderSetParameter(ctx.decoder, BROTLI_DECODER_PARAM_LARGE_WINDOW, 1);
+
+ next_out = ctx.output_buffer;
+ while (1) {
+ if (result == BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT) {
+ if (feof(ctx.fin)) break;
+ available_in = fread(ctx.input_buffer, 1, BUFFER_SIZE, ctx.fin);
+ next_in = ctx.input_buffer;
+ if (ferror(ctx.fin)) break;
+ } else if (result == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {
+ fwrite(ctx.output_buffer, 1, BUFFER_SIZE, ctx.fout);
+ if (ferror(ctx.fout)) break;
+ available_out = BUFFER_SIZE;
+ next_out = ctx.output_buffer;
+ } else {
+ break;
+ }
+ result = BrotliDecoderDecompressStream(
+ ctx.decoder, &available_in, &next_in, &available_out, &next_out, 0);
+ }
+ if (next_out != ctx.output_buffer) {
+ fwrite(ctx.output_buffer, 1, next_out - ctx.output_buffer, ctx.fout);
+ }
+ if ((result == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) || ferror(ctx.fout)) {
+ fail(&ctx, "failed to write output");
+ } else if (result != BROTLI_DECODER_RESULT_SUCCESS) {
+ fail(&ctx, "corrupt input");
+ }
+ cleanup(&ctx);
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/brotlidump.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/brotlidump.py
new file mode 100644
index 000000000..701893456
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/brotlidump.py
@@ -0,0 +1,2362 @@
+#!python3
+"""Program to dump contents of Brotli compressed files showing the compression format.
+Jurjen N.E. Bos, 2016.
+I found the following issues with the Brotli format:
+- The distance alphabet has size 16+(48<<POSTFIX),
+ but the last symbols are useless.
+ It could be lowered to 16+(44-POSTFIX<<POSTFIX), and this could matter.
+- The block type code is useless if NBLTYPES==2, you would only need 1 symbol
+ anyway, so why don't you just switch to "the other" type?
+"""
+import struct
+from operator import itemgetter, methodcaller
+from itertools import accumulate, repeat
+from collections import defaultdict, deque
+from functools import partial
+
+class InvalidStream(Exception): pass
+#lookup table
+L, I, D = "literal", "insert&copy", "distance"
+pL, pI, pD = 'P'+L, 'P'+I, 'P'+D
+
+def outputCharFormatter(c):
+ """Show character in readable format
+ """
+ #TODO 2: allow hex only output
+ if 32<c<127: return chr(c)
+ elif c==10: return '\\n'
+ elif c==13: return '\\r'
+ elif c==32: return '" "'
+ else: return '\\x{:02x}'.format(c)
+
+def outputFormatter(s):
+ """Show string or char.
+ """
+ result = ''
+ def formatSubString(s):
+ for c in s:
+ if c==32: yield ' '
+ else: yield outputCharFormatter(c)
+ if len(result)<200: return ''.join(formatSubString(s))
+ else:
+ return ''.join(formatSubString(s[:100]))+'...'+ \
+ ''.join(formatSubString(s[-100:]))
+
+
+class BitStream:
+ """Represent a bytes object. Can read bits and prefix codes the way
+ Brotli does.
+ """
+ def __init__(self, byteString):
+ self.data = byteString
+ #position in bits: byte pos is pos>>3, bit pos is pos&7
+ self.pos = 0
+
+ def __repr__(self):
+ """Representation
+ >>> olleke
+ BitStream(pos=0:0)
+ """
+ return "BitStream(pos={:x}:{})".format(self.pos>>3, self.pos&7)
+
+ def read(self, n):
+ """Read n bits from the stream and return as an integer.
+ Produces zero bits beyond the stream.
+ >>> olleke.data[0]==27
+ True
+ >>> olleke.read(5)
+ 27
+
+ >>> olleke
+ BitStream(pos=0:5)
+ """
+ value = self.peek(n)
+ self.pos += n
+ if self.pos>len(self.data)*8:
+ raise ValueError('Read past end of stream')
+ return value
+
+ def peek(self, n):
+ """Peek an n bit integer from the stream without updating the pointer.
+ It is not an error to read beyond the end of the stream.
+ >>> olleke.data[:2]==b'\x1b\x2e' and 0x2e1b==11803
+ True
+ >>> olleke.peek(15)
+ 11803
+ >>> hex(olleke.peek(32))
+ '0x2e1b'
+ """
+ #read bytes that contain the data: self.data[self.pos>>3:self.pos+n+7>>3]
+ #convert to int: int.from_bytes(..., 'little')
+ #shift out the bits from the first byte: >>(self.pos&7)
+ #mask unwanted bits: & (1<<n)-1
+ return int.from_bytes(
+ self.data[self.pos>>3:self.pos+n+7>>3],
+ 'little')>>(self.pos&7) & (1<<n)-1
+
+ def readBytes(self, n):
+ """Read n bytes from the stream on a byte boundary.
+ """
+ if self.pos&7: raise ValueError('readBytes: need byte boundary')
+ result = self.data[self.pos>>3:(self.pos>>3)+n]
+ self.pos += 8*n
+ return result
+
+#-----------------------Symbol-------------------------------------------
+class Symbol:
+ """A symbol in a code.
+ Refers back to the code that contains it.
+ Index is the place in the alphabet of the symbol.
+ """
+ __slots__ = 'code', 'index'
+ def __init__(self, code, value):
+ self.code = code
+ self.index = value
+
+ def __repr__(self):
+ return 'Symbol({}, {})'.format(self.code.name, self.index)
+
+ def __len__(self):
+ """Number of bits in the prefix notation of this symbol
+ """
+ return self.code.length(self.index)
+
+ def __int__(self):
+ return self.index
+
+ #these routines call equivalent routine in Code class
+ def bitPattern(self):
+ """Value of the symbol in the stream
+ """
+ return self.code.bitPattern(self.index)
+
+ def extraBits(self):
+ """Number of extra bits to read for this symbol
+ """
+ return self.code.extraBits(self.index)
+
+ def __str__(self):
+ """Short descriptor of the symbol without extra bits.
+ """
+ return self.code.mnemonic(self.index)
+
+ #requiring optional extra bits, if self.code supports them
+ def value(self, extra=None):
+ """The value used for processing. Can be a tuple.
+ with optional extra bits
+ """
+ if isinstance(self.code, WithExtra):
+ if not 0<=extra<1<<self.extraBits():
+ raise ValueError("value: extra value doesn't fit in extraBits")
+ return self.code.value(self.index, extra)
+ if extra is not None:
+ raise ValueError('value: no extra bits for this code')
+ return self.code.value(self.index)
+
+ def explanation(self, extra=None):
+ """Long explanation of the value from the numeric value
+ with optional extra bits
+ Used by Layout.verboseRead when printing the value
+ """
+ if isinstance(self.code, WithExtra):
+ return self.code.callback(self, extra)
+ return self.code.callback(self)
+
+#========================Code definitions==================================
+class RangeDecoder:
+ """A decoder for the Code class that assumes the symbols
+ are encoded consecutively in binary.
+ It all depends on the "alphabetSize" property.
+ The range runs from 0 to alphabetSize-1.
+ This is the default decoder.
+ """
+ def __init__(self, *, alphabetSize=None, bitLength=None, **args):
+ if bitLength is not None: alphabetSize = 1<<bitLength
+ if alphabetSize is not None:
+ self.alphabetSize = alphabetSize
+ self.maxLength = (alphabetSize-1).bit_length()
+
+ def __len__(self):
+ return self.alphabetSize
+
+ def __iter__(self):
+ """Produce all symbols.
+ """
+ return map(partial(Symbol, self), range(len(self)))
+
+ def __getitem__(self, index):
+ if index>=self.alphabetSize: raise ValueError('index out of range')
+ return Symbol(self, index)
+
+ def bitPattern(self, index):
+ return '{:0{}b}'.format(index, self.maxLength)
+
+ def length(self, index):
+ """Encoding length of given symbol.
+ Does not depend on index in this case.
+ """
+ return self.maxLength
+
+ def decodePeek(self, data):
+ """Find which symbol index matches the given data (from peek, as a number)
+ and return the number of bits decoded.
+ Can also be used to figure out length of a symbol.
+ """
+ return self.maxLength, Symbol(self, data&(1<<self.maxLength)-1)
+
+class PrefixDecoder:
+ """A decoder for the Code class that uses a prefix code.
+ The code is determined by encoding:
+ encode[p] gives the index corresponding to bit pattern p.
+ Used setDecode(decodeTable) to switch the decoder from the default
+ to a prefix decoder, or pass decodeTable at init.
+ You can also use setLength(lengthTable)
+ to define the encoding from the lengths.
+ The set of symbol values does not need to be consecutive.
+ """
+ def __init__(self, *, decodeTable=None, **args):
+ if decodeTable is not None: self.setDecode(decodeTable)
+
+ def __len__(self):
+ return len(self.decodeTable)
+
+ def __iter__(self):
+ def revBits(index):
+ return self.bitPattern(index)[::-1]
+ return (
+ Symbol(self, index)
+ for index in sorted(self.decodeTable.values(), key=revBits)
+ )
+
+ def __getitem__(self, index):
+ if index not in self.lengthTable:
+ raise ValueError('No symbol {}[{}]'.format(
+ self.__class__.__name__, index))
+ return Symbol(self, index)
+
+ def bitPattern(self, index):
+ bits = next(b for (b,s) in self.decodeTable.items() if s==index)
+ return '{:0{}b}'.format(bits, self.length(index))
+
+ def length(self, index):
+ """Encoding length of given symbol.
+ """
+ return self.lengthTable[index]
+
+ def decodePeek(self, data):
+ """Find which symbol index matches the given data (from peek, as a number)
+ and return the number of bits decoded.
+ Can also be used to figure out length of a symbol.
+ """
+ #do binary search for word length
+ #invariant: lo<=length<=hi
+ lo, hi = self.minLength, self.maxLength
+ while lo<=hi:
+ mid = lo+hi>>1
+ #note lo<=mid<hi at this point
+ mask = (1<<mid)-1
+ #lets see what happens if we guess length is mid
+ try: index = self.decodeTable[data&mask]
+ except KeyError:
+ #too many bits specified, reduce estimated length
+ hi = mid-1
+ continue
+ #we found a symbol, but there could be a longer match
+ symbolLength = self.lengthTable[index]
+ if symbolLength<=mid:
+ #all bits match, symbol must be right
+ return symbolLength, Symbol(self, index)
+ #there must be more bits to match
+ lo = mid+1
+ return lo, Symbol(self, index)
+
+ #routine to set up the tables
+ def setDecode(self, decodeTable):
+ """Store decodeTable,
+ and compute lengthTable, minLength, maxLength from encodings.
+ """
+ self.decodeTable = decodeTable
+ #set of symbols with unknown length
+ todo = set(decodeTable)
+ #bit size under investigation
+ maskLength = 0
+ lengthTable = {}
+ while todo:
+ mask = (1<<maskLength)-1
+ #split the encodings that we didn't find yet using b bits
+ splitSymbols = defaultdict(list)
+ for s in todo: splitSymbols[s&mask].append(s)
+ #unique encodings have a length of maskLength bits
+ #set length, and remove from todo list
+ for s,subset in splitSymbols.items():
+ if len(subset)==1:
+ lengthTable[self.decodeTable[s]] = maskLength
+ todo.remove(s)
+ #now investigate with longer mask
+ maskLength +=1
+ #save result
+ self.lengthTable = lengthTable
+ self.minLength = min(lengthTable.values())
+ self.maxLength = max(lengthTable.values())
+ self.switchToPrefix()
+
+ def setLength(self, lengthTable):
+ """Given the bit pattern lengths for symbols given in lengthTable,
+ set decodeTable, minLength, maxLength
+ """
+ self.lengthTable = lengthTable
+ self.minLength = min(lengthTable.values())
+ self.maxLength = max(lengthTable.values())
+ #compute the backwards codes first; then reverse them
+ #compute (backwards) first code for every separate lengths
+ nextCodes = []
+ #build codes for each length, from right to left
+ code = 0
+ for bits in range(self.maxLength+1):
+ code <<= 1
+ nextCodes.append(code)
+ code += sum(x==bits for x in lengthTable.values())
+ self.decodeTable = {}
+ #count codes for each length, and store reversed in the table
+ for symbol in sorted(lengthTable):
+ bits = lengthTable[symbol]
+ bitpattern = '{:0{}b}'.format(nextCodes[bits], bits)
+ self.decodeTable[int(bitpattern[::-1], 2)] = symbol
+ nextCodes[bits] += 1
+ self.switchToPrefix()
+
+ def switchToPrefix(self):
+ """This routine makes sure the prefix decoder is activated.
+ """
+ self.mode = PrefixDecoder
+
+class Code(RangeDecoder, PrefixDecoder):
+ """An alphabet of symbols, that can be read from a stream.
+ If you use setDecode or setLength, you have a prefix code,
+ otherwise you have a range code.
+ Features:
+ code[index] produces symbol with given index
+ value(index): value of symbol
+ mnemonic(index): short description of symbol
+ explanation(index): show meaning of symbol, shown in Layout.verboseRead
+ iter(code): produce all symbols in some order
+ name: show as context in Layout.verboseRead
+ """
+ name = '?'
+ #callback is a function that gets the symbol and the extra bits
+ #default callback calls explanation
+ def __init__(self, name=None, *, callback=None, description='', **args):
+ """Don't forget to set either alphabetSize or decodeTable
+ """
+ #set name when provided, otherwise take class variable
+ if name is not None: self.name = name
+ if callback is not None: self.callback = callback
+ self.description = description
+ #mode switch
+ if 'bitLength' in args or 'alphabetSize' in args:
+ self.mode = RangeDecoder
+ RangeDecoder.__init__(self, **args)
+ elif 'decodeTable' in args:
+ self.mode = PrefixDecoder
+ PrefixDecoder.__init__(self, **args)
+ else:
+ super().__init__(**args)
+
+ def __repr__(self):
+ return self.__class__.__name__+' '+self.name
+
+ #the routines that get switched between RangeDecoder and PrefixDecoder
+ def __len__(self): return self.mode.__len__(self)
+ def __iter__(self): return self.mode.__iter__(self)
+ def __getitem__(self, index): return self.mode.__getitem__(self, index)
+ def bitPattern(self, index): return self.mode.bitPattern(self, index)
+ def length(self, index): return self.mode.length(self, index)
+ def decodePeek(self, data): return self.mode.decodePeek(self, data)
+ #general routines
+ def value(self, index, extra=None):
+ """Get value of symbol for computations.
+ Override where needed.
+ """
+ if extra is not None:
+ raise ValueError('value: no extra for this symbol')
+ return index
+
+ def mnemonic(self, index):
+ """Give mnemonic of symbol.
+ Override where needed.
+ """
+ return str(self.value(index))
+
+ def callback(self, symbol):
+ return self.explanation(symbol.index)
+
+ def explanation(self, index):
+ """Long explanation of the value from the numeric value
+ This is a default routine.
+ You can customize in three ways:
+ - set description to add some text
+ - override to get more control
+ - set callback to make it dependent on you local variables
+ """
+ value = self.value(index)
+ return '{0}{1}: {2}'.format(
+ self.description and self.description+': ',
+ self.bitPattern(index),
+ value,
+ )
+
+ def extraBits(self, index):
+ return 0
+
+ #Routines that use the decode interface
+ def showCode(self, width=80):
+ """Show all words of the code in a nice format.
+ """
+ #make table of all symbols with binary strings
+ symbolStrings = [
+ (self.bitPattern(s.index), self.mnemonic(s.index))
+ for s in self
+ ]
+ #determine column widths the way Lisp programmers do it
+ leftColWidth, rightColWidth = map(max, map(
+ map,
+ repeat(len),
+ zip(*symbolStrings)
+ ))
+ colwidth = leftColWidth+rightColWidth
+ columns = 81//(colwidth+2)
+ rows = -(-len(symbolStrings)//columns)
+ def justify(bs):
+ b,s = bs
+ return b.rjust(leftColWidth)+':'+s.ljust(rightColWidth)
+ for i in range(rows):
+ print(' '.join(map(justify, symbolStrings[i::rows])).rstrip())
+
+ def readTuple(self, stream):
+ """Read symbol from stream. Returns symbol, length.
+ """
+ length, symbol = self.decodePeek(stream.peek(self.maxLength))
+ stream.pos += length
+ return length, symbol
+
+ def readTupleAndExtra(self, stream):
+ return self.readTuple(stream)+(0, None)
+
+class WithExtra(Code):
+ """Extension for Code so that symbol may have extra bits associated.
+ If you supply an extraTable, you can use extraBits
+ You can define an extraTable,
+ which allows to call extraBits to get the number of extraBits.
+ Otherwise, you can supply extraBits yourself.
+ Routine readTupleAndExtra now reads the extra bits too.
+ Value probably needs to be overridden; see Enumerator.
+ Note: this does not give you an decodeTable.
+ """
+ #redefine these if you don't want to use an extraTable
+ def extraBits(self, index):
+ """Get the number of extra bits for this symbol.
+ """
+ return self.extraTable[index]
+
+ def mnemonic(self, index):
+ """This value must be independent of extra.
+ """
+ return str(index)
+
+ def readTupleAndExtra(self, stream):
+ """Read symbol and extrabits from stream.
+ Returns symbol length, symbol, extraBits, extra
+ >>> olleke.pos = 6
+ >>> MetablockLengthAlphabet().readTupleAndExtra(olleke)
+ (2, Symbol(MLEN, 4), 16, 46)
+ """
+ length, symbol = self.decodePeek(stream.peek(self.maxLength))
+ stream.pos += length
+ extraBits = self.extraBits(symbol.index)
+ return length, symbol, extraBits, stream.read(extraBits)
+
+ def explanation(self, index, extra=None):
+ """Expanded version of Code.explanation supporting extra bits.
+ If you don't supply extra, it is not mentioned.
+ """
+ extraBits = 0 if extra is None else self.extraBits(index)
+ if not hasattr(self, 'extraTable'):
+ formatString = '{0}{3}'
+ lo = hi = value = self.value(index, extra)
+ elif extraBits==0:
+ formatString = '{0}{2}: {3}'
+ lo, hi = self.span(index)
+ value = lo
+ else:
+ formatString = '{0}{1} {2}: {3}-{4}; {3}+{5}={6}'
+ lo, hi = self.span(index)
+ value = lo+extra
+ return formatString.format(
+ self.description and self.description+': ',
+ 'x'*extraBits,
+ self.bitPattern(index),
+ lo, hi,
+ extra,
+ value,
+ )
+
+ def callback(self, symbol, extra):
+ return self.explanation(symbol.index, extra)
+
+class BoolCode(Code):
+ """Same as Code(bitLength=1), but shows a boolean.
+ """
+ def __init__(self, name=None, **args):
+ super().__init__(name, bitLength=1, **args)
+
+ def value(self, index, extra=None):
+ return bool(super().value(index, extra))
+
+class Enumerator(WithExtra):
+ """Code that is defined by the ExtraTable.
+ extraTable is a class variable that contains
+ the extraBits of the symbols from 0
+ value0 contains the value of symbol 0
+ encodings is not neccessary, but allowed.
+ Note: place for FixedCode to make sure extraBits works
+ """
+ def __init__(self, name=None, **args):
+ #if there is no decodeTable to determine length, compute it ourselves
+ if 'decodeTable' not in args:
+ args['alphabetSize'] = len(self.extraTable)
+ super().__init__(name, **args)
+
+ def __len__(self):
+ return len(self.extraTable)
+
+ def __getitem__(self, index):
+ """Faster than PrefixDecoder
+ """
+ if index>=len(self.extraTable):
+ raise ValueError("No symbol {}[{}]".format(
+ self.__class__.__name__, index))
+ return Symbol(self, index)
+
+ def value(self, index, extra):
+ """Override if you don't define value0 and extraTable
+ """
+ lower, upper = self.span(index)
+ value = lower+(extra or 0)
+ if value>upper:
+ raise ValueError('value: extra out of range')
+ return value
+
+ def span(self, index):
+ """Give the range of possible values in a tuple
+ Useful for mnemonic and explanation
+ """
+ lower = self.value0+sum(1<<x for x in self.extraTable[:index])
+ upper = lower+(1<<self.extraTable[index])
+ return lower, upper-1
+
+#======================Code subclasses======================================
+#Alphabets used in the metablock header----------------------------------
+#For prefix codes
+class PrefixCodeHeader(WithExtra):
+ """Header of prefix codes.
+ """
+ def __init__(self, codename):
+ super().__init__('PFX', bitLength=2)
+ #this is the name of the code that it describes
+ self.codename = codename
+
+ def extraBits(self, index):
+ return 2 if index==1 else 0
+
+ def value(self, index, extra):
+ """Returns ('Simple', #codewords) or ('Complex', HSKIP)
+ """
+ if index==1:
+ if extra>3:
+ raise ValueError('value: extra out of range')
+ return 'Simple', extra+1
+ if extra:
+ raise ValueError('value: extra out of range')
+ return 'Complex', index
+
+ def explanation(self, index, extra):
+ if index==1:
+ return '{} is simple with {} code word{}'.format(
+ self.codename, extra+1, 's' if extra else '')
+ lengths = [1, 2, 3, 4, 0, 5, 17, 6]
+ return '{} is complex with lengths {}...'.format(
+ self.codename,
+ ','.join(
+ map(str, lengths[index:index+5]))
+ )
+
+class TreeShapeAlhabet(BoolCode):
+ """The bit used to indicate if four word code is "deep" or "wide"
+ """
+ name = 'SHAPE'
+ def value(self, index):
+ return [(2,2,2,2), (1,2,3,3)][index]
+
+ def explanation(self, index):
+ return str(bool(index))+': lengths {},{},{},{}'.format(*self.value(index))
+
+class LengthOfLengthAlphabet(Code):
+ """For use in decoding complex code descriptors.
+ >>> lengthOfLengthAlphabet = LengthOfLengthAlphabet('')
+ >>> print(lengthOfLengthAlphabet[2])
+ coded with 2 bits
+ >>> len(lengthOfLengthAlphabet[0])
+ 2
+ >>> [len(lengthOfLengthAlphabet[x]) for x in range(6)]
+ [2, 4, 3, 2, 2, 4]
+ >>> lengthOfLengthAlphabet.showCode()
+ 00:skipped 01:coded with 4 bits 0111:coded with 1 bits
+ 10:coded with 3 bits 011:coded with 2 bits 1111:coded with 5 bits
+ """
+ decodeTable = {
+ 0b00:0, 0b10:3,
+ 0b0111:1, 0b01:4,
+ 0b011:2, 0b1111:5,
+ }
+
+ def __init__(self, name=None, **args):
+ super().__init__(name, decodeTable=self.decodeTable, **args)
+
+ def mnemonic(self, index):
+ if index==0: return 'skipped'
+ return 'coded with {} bits'.format(index)
+
+ def explanation(self, index, extra=None):
+ return self.description+': '+self.mnemonic(index)
+
+class LengthAlphabet(WithExtra):
+ """Length of symbols
+ Used during construction of a code.
+ """
+ def __init__(self, name):
+ super().__init__(name, alphabetSize=18)
+
+ def extraBits(self, index):
+ return {16:2, 17:3}.get(index, 0)
+
+ def mnemonic(self, index):
+ if index==0: return 'unused'
+ elif index==16: return 'rep xx'
+ elif index==17: return 'zero xxx'
+ else: return 'len {}'.format(index)
+
+ def explanation(self, index, extra):
+ return self.description.format(self[index], extra)
+
+ def value(self, index, extra):
+ #the caller got the length already, so extra is enough
+ return extra
+
+#Stream header
+class WindowSizeAlphabet(Code):
+ """The alphabet used for window size in the stream header.
+ >>> WindowSizeAlphabet()[10].explanation()
+ 'windowsize=(1<<10)-16=1008'
+ """
+ decodeTable = {
+ 0b0100001: 10, 0b1100001: 14, 0b0011: 18, 0b1011: 22,
+ 0b0110001: 11, 0b1110001: 15, 0b0101: 19, 0b1101: 23,
+ 0b1000001: 12, 0b0: 16, 0b0111: 20, 0b1111: 24,
+ 0b1010001: 13, 0b0000001: 17, 0b1001: 21,
+ 0b0010001: None,
+ }
+
+ name = 'WSIZE'
+
+ def __init__(self, name=None):
+ super().__init__(name, decodeTable=self.decodeTable)
+
+ def value(self, index):
+ #missing value gives index None
+ if index is None: return None
+ return (1<<index)-16
+
+ def explanation(self, index):
+ return 'windowsize=(1<<{})-16={}'.format(
+ index, (1<<index)-16)
+
+#Metablock
+class MetablockLengthAlphabet(WithExtra):
+ """Used for the meta block length;
+ also indicates a block with no data
+ >>> metablockLengthAlphabet = MetablockLengthAlphabet()
+ >>> metablockLengthAlphabet[0]; str(metablockLengthAlphabet[0])
+ Symbol(MLEN, 0)
+ 'empty'
+ >>> metablockLengthAlphabet[3]
+ Traceback (most recent call last):
+ ...
+ ValueError: No symbol MetablockLengthAlphabet[3]
+ >>> print(metablockLengthAlphabet[4])
+ hhhh00
+ >>> metablockLengthAlphabet[4].value(0x1000)
+ 4097
+ >>> metablockLengthAlphabet[5].value(0x1000)
+ Traceback (most recent call last):
+ ...
+ InvalidStream: Zeros in high nibble of MLEN
+ >>> metablockLengthAlphabet[5].explanation(0x12345)
+ 'data length: 12345h+1=74566'
+ >>> metablockLengthAlphabet.showCode()
+ 00:hhhh00 10:hhhhhh10 01:hhhhh01 11:empty
+ """
+ decodeTable = {0b11:0, 0b00:4, 0b01:5, 0b10:6}
+
+ name = 'MLEN'
+ def __init__(self, name=None):
+ super().__init__(name, decodeTable=self.decodeTable)
+
+ def extraBits(self, index):
+ return index*4
+
+ def mnemonic(self, index):
+ if index==0: return 'empty'
+ return 'h'*(self.extraBits(index)//4)+self.bitPattern(index)
+
+ def value(self, index, extra):
+ extraBits = self.extraBits(index)
+ if not 0<=extra<1<<extraBits:
+ raise ValueError('value: extra out of range')
+ if index==0: return 0
+ if index>4 and extra>>extraBits-4==0: raise InvalidStream(
+ 'Zeros in high nibble of MLEN')
+ return extra+1
+
+ def explanation(self, index, extra):
+ if index==0: return '11: empty block'
+ extraBits = self.extraBits(index)
+ return 'data length: {:0{}x}h+1={}'.format(extra, extraBits//4, extra+1)
+
+
+class ReservedAlphabet(BoolCode):
+ """The reserved bit that must be zero.
+ """
+ name = 'RSVD'
+ def value(self, index):
+ if index: raise ValueError('Reserved bit is not zero')
+
+ def explanation(self, index):
+ return 'Reserved (must be zero)'
+
+class FillerAlphabet(Code):
+ def __init__(self, *, streamPos):
+ super().__init__('SKIP', bitLength=(-streamPos)&7)
+
+ def explanation(self, index):
+ return '{} bit{} ignored'.format(
+ self.length(index),
+ '' if self.length(index)==1 else 's',
+ )
+
+class SkipLengthAlphabet(WithExtra):
+ """Used for the skip length in an empty metablock
+ >>> skipLengthAlphabet = SkipLengthAlphabet()
+ >>> skipLengthAlphabet[0]; str(skipLengthAlphabet[0])
+ Symbol(SKIP, 0)
+ 'empty'
+ >>> skipLengthAlphabet[4]
+ Traceback (most recent call last):
+ ...
+ ValueError: index out of range
+ >>> print(skipLengthAlphabet[3])
+ hhhhhh11
+ >>> skipLengthAlphabet[2].value(0x1000)
+ 4097
+ >>> skipLengthAlphabet[3].value(0x1000)
+ Traceback (most recent call last):
+ ...
+ InvalidStream: Zeros in high byte of SKIPBYTES
+ >>> skipLengthAlphabet[3].explanation(0x12345)
+ 'skip length: 12345h+1=74566'
+ >>> skipLengthAlphabet.showCode()
+ 00:empty 01:hh01 10:hhhh10 11:hhhhhh11
+ """
+ def __init__(self):
+ super().__init__('SKIP', bitLength=2)
+
+ def extraBits(self, index):
+ return index*8
+
+ def mnemonic(self, index):
+ if index==0: return 'empty'
+ return 'h'*(self.extraBits(index)//4)+self.bitPattern(index)
+
+ def value(self, index, extra):
+ extraBits = self.extraBits(index)
+ if not 0<=extra<1<<extraBits:
+ raise ValueError('value: extra out of range')
+ if index==0: return 0
+ if index>1 and extra>>extraBits-8==0:
+ raise InvalidStream('Zeros in high byte of SKIPBYTES')
+ return extra+1
+
+ def explanation(self, index, extra):
+ if index==0: return '00: no skip'
+ extraBits = self.extraBits(index)
+ return 'skip length: {:{}x}h+1={}'.format(extra, extraBits//8, extra+1)
+
+
+class TypeCountAlphabet(Enumerator):
+ """Used for giving block type counts and tree counts.
+ >>> TypeCountAlphabet(description='').showCode()
+ 0:0 0101:xx,0101 1011:xxxxx,1011
+ 0001:0001 1101:xxxxxx,1101 0111:xxx,0111
+ 1001:xxxx,1001 0011:x,0011 1111:xxxxxxx,1111
+ """
+ decodeTable = {
+ 0b0: 0, 0b1001: 5,
+ 0b0001: 1, 0b1011: 6,
+ 0b0011: 2, 0b1101: 7,
+ 0b0101: 3, 0b1111: 8,
+ 0b0111: 4,
+ }
+
+ value0 = 1
+ extraTable = [0, 0, 1, 2, 3, 4, 5, 6, 7]
+ name = 'BT#'
+
+ def __init__(self, name=None, *, description):
+ super().__init__(
+ name,
+ decodeTable=self.decodeTable,
+ description=description)
+
+ def mnemonic(self, index):
+ if index==0: return '0'
+ if index==1: return '0001'
+ return 'x'*(self.extraBits(index))+','+self.bitPattern(index)
+
+ def explanation(self, index, extra):
+ value = self.value(index, extra)
+ description = self.description
+ if value==1: description = description[:-1]
+ return '{}: {} {}'.format(
+ self.mnemonic(index),
+ value,
+ description)
+
+class BlockTypeAlphabet(Code):
+ """The block types; this code works for all three kinds.
+ >>> b = BlockTypeAlphabet('T', NBLTYPES=5)
+ >>> print(*(x for x in b))
+ prev +1 #0 #1 #2 #3 #4
+ """
+ def __init__(self, name, NBLTYPES, **args):
+ super().__init__(name, alphabetSize=NBLTYPES+2, **args)
+ self.NBLTYPES = NBLTYPES
+
+ def mnemonic(self, index):
+ if index==0: return 'prev'
+ elif index==1: return '+1'
+ else: return '#'+str(index-2)
+
+ def value(self, index):
+ return index-2
+
+ def explanation(self, index):
+ if index==0: return '0: previous'
+ elif index==1: return '1: increment'
+ else: return 'Set block type to: '+str(index-2)
+
+class BlockCountAlphabet(Enumerator):
+ """Block counts
+ >>> b = BlockCountAlphabet('L')
+ >>> print(b[25])
+ [24*x]: BC16625-16793840
+ """
+
+ value0 = 1
+ extraTable = [2,2,2,2,3, 3,3,3,4,4, 4,4,5,5,5, 5,6,6,7,8, 9,10,11,12,13, 24]
+ def __init__(self, name, **args):
+ super().__init__(name, alphabetSize=26, **args)
+
+ def mnemonic(self, index):
+ extraBits = self.extraBits(index)
+ return '{}: BC{}-{}'.format(
+ 'x'*extraBits if index<5 else '[{}*x]'.format(extraBits),
+ *self.span(index))
+
+ def explanation(self, index, extra):
+ return 'Block count: '+super().explanation(index, extra)
+
+class DistanceParamAlphabet(WithExtra):
+ """The distance parameters NPOSTFIX and NDIRECT.
+ Although these are treated as two in the description, this is easier.
+ """
+ def __init__(self):
+ super().__init__('DIST', bitLength=2)
+
+ def extraBits(self, index):
+ return 4
+
+ def value(self, index, extra):
+ """Returns NPOSTFIX and NDIRECT<<NPOSTFIX
+ """
+ if extra>15:
+ raise ValueError('value: extra out of range')
+ return index, extra<<index
+
+ def explanation(self, index, extra):
+ return '{} postfix bits and {:04b}<<{}={} direct codes'.format(
+ index, extra, index, extra<<index)
+
+ def mnemonic(self, index):
+ return 'PF'+str(index)
+
+class LiteralContextMode(Code):
+ """For the literal context modes.
+ >>> LiteralContextMode().showCode()
+ 00:LSB6 01:MSB6 10:UTF8 11:Signed
+ >>> LiteralContextMode().explanation(2)
+ 'Context mode for type 9: 2(UTF8)'
+ """
+
+ def __init__(self, *, number=9):
+ super().__init__('LC'+str(number), bitLength=2)
+ self.number = number
+
+ def mnemonic(self, index):
+ return ['LSB6', 'MSB6', 'UTF8', 'Signed'][index]
+
+ def explanation(self, index):
+ return 'Context mode for type {}: {}({})'.format(
+ self.number,
+ index,
+ self.mnemonic(index))
+
+class RLEmaxAlphabet(Enumerator):
+ """Used for describing the run length encoding used for describing context maps.
+ >>> RLEmaxAlphabet().showCode()
+ 0:1 1:more
+ """
+ value0 = 0
+ extraTable = [0, 4]
+ name = 'RLE#'
+
+ def mnemonic(self, index):
+ return ['1', 'more'][index]
+
+ def explanation(self, index, extra):
+ description = self.description and self.description+': '
+ if index==0: return description+'No RLE coding'
+ return '{}xxxx 1: RLEMAX={}'.format(description, extra+1)
+
+class TreeAlphabet(WithExtra):
+ """The alphabet to enumerate entries (called trees) in the context map.
+ parameters are RLEMAX and NTREES
+ >>> t = TreeAlphabet('', RLEMAX=3, NTREES=5)
+ >>> len(t)
+ 8
+ >>> print(t[2])
+ xx+4 zeroes
+ >>> t[3].explanation(2)
+ '8+010=10 zeroes'
+ >>> t[0].value(0)
+ (1, 0)
+ """
+ name = 'CMI'
+ def __init__(self, name=None, *, RLEMAX, NTREES, **args):
+ super().__init__(name, alphabetSize=RLEMAX+NTREES, **args)
+ self.RLEMAX = RLEMAX
+ self.NTREES = NTREES
+
+ def extraBits(self, index):
+ if 0<index<=self.RLEMAX: return index
+ return 0
+
+ def mnemonic(self, index):
+ if index==0: return 'map #0'
+ if index<=self.RLEMAX:
+ return '{}+{} zeroes'.format('x'*index, 1<<index)
+ return 'map #{}'.format(index-self.RLEMAX)
+
+ def value(self, index, extra):
+ """Give count and value."""
+ index = index
+ if index==0: return 1, 0
+ if index<=self.RLEMAX: return (1<<index)+extra, 0
+ return 1, index-self.RLEMAX
+
+ def explanation(self, index, extra):
+ description = self.description and self.description+': '
+ if index==0: return description+'map #0'
+ if index<=self.RLEMAX:
+ return '{}+{:0{}b}={} zeroes'.format(
+ (1<<index),
+ extra, self.extraBits(index),
+ (1<<index)+extra)
+ return '{}map #{}-{}={}'.format(
+ description,
+ index, self.RLEMAX, index-self.RLEMAX)
+
+#Prefix alphabets for the data stream----------------------------------
+class LiteralAlphabet(Code):
+ """Alphabet of symbols.
+ """
+ minLength = maxLength = 8
+ def __init__(self, number):
+ super().__init__('L'+str(number), alphabetSize=1<<8)
+
+ def mnemonic(self, index):
+ return outputCharFormatter(index)
+
+ def value(self, index, extra=None):
+ return index
+
+ def explanation(self, index, extra=None):
+ return self.mnemonic(index)
+
+class InsertLengthAlphabet(Enumerator):
+ """Intern code for insert counts
+ """
+ value0 = 0
+ extraTable = [0,0,0,0,0, 0,1,1,2,2, 3,3,4,4,5, 5,6,7,8,9, 10,12,14,24]
+
+class CopyLengthAlphabet(Enumerator):
+ value0 = 2
+ extraTable = [0,0,0,0,0, 0,0,0,1,1, 2,2,3,3,4, 4,5,5,6,7, 8,9,10,24]
+
+class InsertAndCopyAlphabet(WithExtra):
+ """The insert and copy code
+ >>> for x in range(0,704,704//13):
+ ... print('{:10b}'.format(x), InsertAndCopyAlphabet()[x])
+ 0 I0C2&D=0
+ 110110 I6+xC8&D=0
+ 1101100 I5C22+xxx&D=0
+ 10100010 I4C4
+ 11011000 I3C10+x
+ 100001110 I14+xxC8
+ 101000100 I10+xxC22+xxx
+ 101111010 I98+xxxxxC14+xx
+ 110110000 I6+xC70+xxxxx
+ 111100110 I1090+[10*x]C8
+ 1000011100 I26+xxxC326+[8*x]
+ 1001010010 I322+[8*x]C14+xx
+ 1010001000 I194+[7*x]C70+xxxxx
+ 1010111110 I22594+[24*x]C1094+[10*x]
+ """
+ insertLengthAlphabet = InsertLengthAlphabet(None)
+ copyLengthAlphabet = CopyLengthAlphabet(None)
+
+ def __init__(self, number=''):
+ super().__init__('IC'+str(number), bitLength=10)
+
+ def __len__(self):
+ return 704
+
+ def extraBits(self, index):
+ insertSymbol, copySymbol, dist0 = self.splitSymbol(index)
+ return InsertLengthAlphabet.extraTable[insertSymbol.index] + \
+ CopyLengthAlphabet.extraTable[copySymbol.index]
+
+ def splitSymbol(self, index):
+ """Give relevant values for computations:
+ (insertSymbol, copySymbol, dist0flag)
+ """
+ #determine insert and copy upper bits from table
+ row = [0,0,1,1,2,2,1,3,2,3,3][index>>6]
+ col = [0,1,0,1,0,1,2,0,2,1,2][index>>6]
+ #determine inserts and copy sub codes
+ insertLengthCode = row<<3 | index>>3&7
+ if row: insertLengthCode -= 8
+ copyLengthCode = col<<3 | index&7
+ return (
+ Symbol(self.insertLengthAlphabet, insertLengthCode),
+ Symbol(self.copyLengthAlphabet, copyLengthCode),
+ row==0
+ )
+
+ def mnemonic(self, index):
+ """Make a nice mnemonic
+ """
+ i,c,d0 = self.splitSymbol(index)
+ iLower, _ = i.code.span(i.index)
+ iExtra = i.extraBits()
+ cLower, _ = c.code.span(c.index)
+ cExtra = c.extraBits()
+ return 'I{}{}{}C{}{}{}{}'.format(
+ iLower,
+ '+' if iExtra else '',
+ 'x'*iExtra if iExtra<6 else '[{}*x]'.format(iExtra),
+ cLower,
+ '+' if cExtra else '',
+ 'x'*cExtra if cExtra<6 else '[{}*x]'.format(cExtra),
+ '&D=0' if d0 else '')
+
+ def value(self, index, extra):
+ i,c,d0 = self.splitSymbol(index)
+ iExtra = i.extraBits()
+ ce, ie = extra>>iExtra, extra&(1<<iExtra)-1
+ insert = i.value(ie)
+ copy = c.value(ce)
+ return insert, copy, d0
+
+ def explanation(self, index, extra):
+ insert, copy, d0 = self.value(index, extra)
+ if d0: return 'Literal: {}, copy: {}, same distance'.format(insert, copy)
+ else: return 'Literal: {}, copy: {}'.format(insert, copy)
+
+class DistanceAlphabet(WithExtra):
+ """Represent the distance encoding.
+ Dynamically generated alphabet.
+ This is what the documentation should have said:
+ Ignoring offsets for the moment, the "long" encoding works as follows:
+ Write the distance in binary as follows:
+ 1xy..yz..z, then the distance symbol consists of n..nxz..z
+ Where:
+ n is one less than number of bits in y
+ x is a single bit
+ y..y are n+1 extra bits (encoded in the bit stream)
+ z..z is NPOSTFIX bits that are part of the symbol
+ The offsets are so as to start at the lowest useable value:
+ if 1xyyyyz = distance +(4<<POSTFIX)-NDIRECT-1
+ then n..nxz..z is symbol -NDIRECT-16
+ >>> d = DistanceAlphabet('D', NPOSTFIX=2, NDIRECT=10)
+ >>> print(d[4], d[17], d[34])
+ last-1 1 10xx00-5
+ >>> [str(d[x]) for x in range(26, 32)]
+ ['10x00-5', '10x01-5', '10x10-5', '10x11-5', '11x00-5', '11x01-5']
+ """
+ def __init__(self, number, *, NPOSTFIX, NDIRECT):
+ self.NPOSTFIX = NPOSTFIX
+ self.NDIRECT = NDIRECT
+ #set length
+ #Actually, not all symbols are used,
+ #only NDIRECT+16+(44-2*POSTFIX<<NPOSTFIX)
+ super().__init__('D'+str(number),
+ alphabetSize=self.NDIRECT+16+(48<<self.NPOSTFIX))
+
+ def extraBits(self, index):
+ """Indicate how many extra bits are needed to interpret symbol
+ >>> d = DistanceAlphabet('D', NPOSTFIX=2, NDIRECT=10)
+ >>> [d[i].extraBits() for i in range(26)]
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+ >>> [d[i].extraBits() for i in range(26,36)]
+ [1, 1, 1, 1, 1, 1, 1, 1, 2, 2]
+ """
+ if index<16+self.NDIRECT: return 0
+ return 1 + ((index - self.NDIRECT - 16) >> (self.NPOSTFIX + 1))
+
+ def value(self, dcode, dextra):
+ """Decode value of symbol together with the extra bits.
+ >>> d = DistanceAlphabet('D', NPOSTFIX=2, NDIRECT=10)
+ >>> d[34].value(2)
+ (0, 35)
+ """
+ if dcode<16:
+ return [(1,0),(2,0),(3,0),(4,0),
+ (1,-1),(1,+1),(1,-2),(1,+2),(1,-3),(1,+3),
+ (2,-1),(2,+1),(2,-2),(2,+2),(2,-3),(2,+3)
+ ][dcode]
+ if dcode<16+self.NDIRECT:
+ return (0,dcode-16)
+ #we use the original formulas, instead of my clear explanation
+ POSTFIX_MASK = (1 << self.NPOSTFIX) - 1
+ ndistbits = 1 + ((dcode - self.NDIRECT - 16) >> (self.NPOSTFIX + 1))
+ hcode = (dcode - self.NDIRECT - 16) >> self.NPOSTFIX
+ lcode = (dcode - self.NDIRECT - 16) & POSTFIX_MASK
+ offset = ((2 + (hcode & 1)) << ndistbits) - 4
+ distance = ((offset + dextra) << self.NPOSTFIX) + lcode + self.NDIRECT + 1
+ return (0,distance)
+
+ def mnemonic(self, index, verbose=False):
+ """Give mnemonic representation of meaning.
+ verbose compresses strings of x's
+ """
+ if index<16:
+ return ['last', '2last', '3last', '4last',
+ 'last-1', 'last+1', 'last-2', 'last+2', 'last-3', 'last+3',
+ '2last-1', '2last+1', '2last-2', '2last+2', '2last-3', '2last+3'
+ ][index]
+ if index<16+self.NDIRECT:
+ return str(index-16)
+ #construct strings like "1xx01-15"
+ index -= self.NDIRECT+16
+ hcode = index >> self.NPOSTFIX
+ lcode = index & (1<<self.NPOSTFIX)-1
+ if self.NPOSTFIX: formatString = '1{0}{1}{2:0{3}b}{4:+d}'
+ else: formatString = '1{0}{1}{4:+d}'
+ return formatString.format(
+ hcode&1,
+ 'x'*(2+hcode>>1) if hcode<13 or verbose else '[{}*x]'.format(2+hcode>>1),
+ lcode, self.NPOSTFIX,
+ self.NDIRECT+1-(4<<self.NPOSTFIX))
+
+ def explanation(self, index, extra):
+ """
+ >>> d = DistanceAlphabet('D', NPOSTFIX=2, NDIRECT=10)
+ >>> d[55].explanation(13)
+ '11[1101]01-5: [0]+240'
+ """
+ extraBits = self.extraBits(index)
+ extraString = '[{:0{}b}]'.format(extra, extraBits)
+ return '{0}: [{1[0]}]{1[1]:+d}'.format(
+ self.mnemonic(index, True).replace('x'*(extraBits or 1), extraString),
+ self.value(index, extra))
+
+#Classes for doing actual work------------------------------------------
+class ContextModeKeeper:
+ """For computing the literal context mode.
+ You feed it characters, and it computes indices in the context map.
+ """
+ def __init__(self, mode):
+ self.chars = deque([0,0], maxlen=2)
+ self.mode = mode
+
+ def setContextMode(self, mode):
+ """Switch to given context mode (0..3)"""
+ self.mode = mode
+ def getIndex(self):
+ if self.mode==0: #LSB6
+ return self.chars[1]&0x3f
+ elif self.mode==1: #MSB6
+ return self.chars[1]>>2
+ elif self.mode==2: #UTF8: character class of previous and a bit of the second
+ p2,p1 = self.chars
+ return self.lut0[p1]|self.lut1[p2]
+ elif self.mode==3: #Signed: initial bits of last two bytes
+ p2,p1 = self.chars
+ return self.lut2[p1]<<3|self.lut2[p2]
+
+ def add(self, index):
+ """Adjust the context for output char (as int)."""
+ self.chars.append(index)
+
+ #0: control #16: quote #32: ,:; #48: AEIOU
+ #4: tab/lf/cr #20: % #36: . #52: BC..Z
+ #8: space #24: (<[{ #40: = #56: aeiou
+ #12:!#$&*+-/?@| #28: )>]} #44: 0-9 #60: bc..z
+ lut0 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 8, 12, 16, 12, 12, 20, 12, 16, 24, 28, 12, 12, 32, 12, 36, 12,
+ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 32, 32, 24, 40, 28, 12,
+ 12, 48, 52, 52, 52, 48, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48,
+ 52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 24, 12, 28, 12, 12,
+ 12, 56, 60, 60, 60, 56, 60, 60, 60, 56, 60, 60, 60, 60, 60, 56,
+ 60, 60, 60, 60, 60, 56, 60, 60, 60, 60, 60, 24, 12, 28, 12, 0
+ ]+[0,1]*32+[2,3]*32
+ #0: space 1:punctuation 2:digit/upper 3:lower
+ lut1 = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
+ 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,
+ 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0
+ ]+[0]*96+[2]*32
+ #initial bits: 8*0, 4*0, 2*0, 1*0, 1*1, 2*1, 4*1, 8*1
+ lut2 = [0]+[1]*15+[2]*48+[3]*64+[4]*64+[5]*48+[6]*15+[7]
+ assert len(lut0)==len(lut1)==len(lut2)==256
+
+class WordList:
+ """Word list.
+ >>> WordList().word(7, 35555)
+ b'Program to '
+ """
+ NDBITS = [0, 0, 0, 0, 10, 10, 11, 11, 10, 10,
+ 10, 10, 10, 9, 9, 8, 7, 7, 8, 7,
+ 7, 6, 6, 5, 5]
+ def __init__(self):
+ self.file = open('dict', 'rb')
+ self.compileActions()
+
+ def word(self, size, dist):
+ """Get word
+ """
+ #split dist in index and action
+ ndbits = self.NDBITS[size]
+ index = dist&(1<<ndbits)-1
+ action = dist>>ndbits
+ #compute position in file
+ position = sum(n<<self.NDBITS[n] for n in range(4,size))+size*index
+ self.file.seek(position)
+ return self.doAction(self.file.read(size), action)
+
+ def upperCase1(self, word):
+ word = word.decode('utf8')
+ word = word[0].upper()+word[1:]
+ return word.encode('utf8')
+
+
+ #Super compact form of action table.
+ #_ means space, .U means UpperCaseAll, U(w) means UpperCaseFirst
+ actionTable = r"""
+ 0:w 25:w+_for_ 50:w+\n\t 75:w+. This_100:w+ize_
+ 1:w+_ 26:w[3:] 51:w+: 76:w+, 101:w.U+.
+ 2:_+w+_ 27:w[:-2] 52:_+w+._ 77:.+w+_ 102:\xc2\xa0+w
+ 3:w[1:] 28:w+_a_ 53:w+ed_ 78:U(w)+( 103:_+w+,
+ 4:U(w)+_ 29:w+_that_ 54:w[9:] 79:U(w)+. 104:U(w)+="
+ 5:w+_the_ 30:_+U(w) 55:w[7:] 80:w+_not_ 105:w.U+="
+ 6:_+w 31:w+._ 56:w[:-6] 81:_+w+=" 106:w+ous_
+ 7:s_+w+_ 32:.+w 57:w+( 82:w+er_ 107:w.U+,_
+ 8:w+_of_ 33:_+w+,_ 58:U(w)+,_ 83:_+w.U+_ 108:U(w)+=\'
+ 9:U(w) 34:w[4:] 59:w[:-8] 84:w+al_ 109:_+U(w)+,
+ 10:w+_and_ 35:w+_with_ 60:w+_at_ 85:_+w.U 110:_+w.U+="
+ 11:w[2:] 36:w+\' 61:w+ly_ 86:w+=\' 111:_+w.U+,_
+ 12:w[:-1] 37:w+_from_ 62:_the_+w+_of_ 87:w.U+" 112:_+w.U+,
+ 13:,_+w+_ 38:w+_by_ 63:w[:-5] 88:U(w)+._ 113:w.U+(
+ 14:w+,_ 39:w[5:] 64:w[:-9] 89:_+w+( 114:w.U+._
+ 15:_+U(w)+_ 40:w[6:] 65:_+U(w)+,_ 90:w+ful_ 115:_+w.U+.
+ 16:w+_in_ 41:_the_+w 66:U(w)+" 91:_+U(w)+._116:w.U+=\'
+ 17:w+_to_ 42:w[:-4] 67:.+w+( 92:w+ive_ 117:_+w.U+._
+ 18:e_+w+_ 43:w+. The_ 68:w.U+_ 93:w+less_ 118:_+U(w)+="
+ 19:w+" 44:w.U 69:U(w)+"> 94:w.U+\' 119:_+w.U+=\'
+ 20:w+. 45:w+_on_ 70:w+=" 95:w+est_ 120:_+U(w)+=\'
+ 21:w+"> 46:w+_as_ 71:_+w+. 96:_+U(w)+.
+ 22:w+\n 47:w+_is_ 72:.com/+w 97:w.U+">
+ 23:w[:-3] 48:w[:-7] 98:_+w+=\'
+ 24:w+] 49:w[:-1]+ing_ 74:U(w)+\' 99:U(w)+,
+ """
+
+ def compileActions(self):
+ """Build the action table from the text above
+ """
+ import re
+ self.actionList = actions = [None]*121
+ #Action 73, which is too long, looks like this when expanded:
+ actions[73] = "b' the '+w+b' of the '"
+ #find out what the columns are
+ actionLines = self.actionTable.splitlines()
+ colonPositions = [m.start()
+ for m in re.finditer(':',actionLines[1])
+ ]+[100]
+ columns = [(colonPositions[i]-3,colonPositions[i+1]-3)
+ for i in range(len(colonPositions)-1)]
+ for line in self.actionTable.splitlines(keepends=False):
+ for start,end in columns:
+ action = line[start:end]
+ #skip empty actions
+ if not action or action.isspace(): continue
+ #chop it up, and check if the colon is properly placed
+ index, colon, action = action[:3], action[3], action[4:]
+ assert colon==':'
+ #remove filler spaces at right
+ action = action.rstrip()
+ #replace space symbols
+ action = action.replace('_', ' ')
+ wPos = action.index('w')
+ #add quotes around left string when present
+ #translation: any pattern from beginning, up to
+ #(but not including) a + following by a w later on
+ action = re.sub(r"^(.*)(?=\+[U(]*w)", r"b'\1'", action)
+ #add quotes around right string when present
+ #translation: anything with a w in it, followed by a +
+ #and a pattern up to the end
+ #(there is no variable lookbehind assertion,
+ #so we have to copy the pattern)
+ action = re.sub(r"(w[[:\-1\]).U]*)\+(.*)$", r"\1+b'\2'", action)
+ #expand shortcut for uppercaseAll
+ action = action.replace(".U", ".upper()")
+ #store action
+ actions[int(index)] = action
+
+ def doAction(self, w, action):
+ """Perform the proper action
+ """
+ #set environment for the UpperCaseFirst
+ U = self.upperCase1
+ return eval(self.actionList[action], locals())
+
+class Layout:
+ """Class to layout the output.
+ """
+ #display width of hexdata+bitdata
+ width = 25
+ #general
+ def __init__(self, stream):
+ self.stream = stream
+ self.bitPtr = self.width
+
+ def makeHexData(self, pos):
+ """Produce hex dump of all data containing the bits
+ from pos to stream.pos
+ """
+ firstAddress = pos+7>>3
+ lastAddress = self.stream.pos+7>>3
+ return ''.join(map('{:02x} '.format,
+ self.stream.data[firstAddress:lastAddress]))
+
+ def formatBitData(self, pos, width1, width2=0):
+ """Show formatted bit data:
+ Bytes are separated by commas
+ whole bytes are displayed in hex
+ >>> Layout(olleke).formatBitData(6, 2, 16)
+ '|00h|2Eh,|00'
+ >>> Layout(olleke).formatBitData(4, 1, 0)
+ '1'
+ """
+ result = []
+ #make empty prefix code explicit
+ if width1==0: result = ['()', ',']
+ for width in width1, width2:
+ #skip empty width2
+ if width==0: continue
+ #build result backwards in a list
+ while width>0:
+ availableBits = 8-(pos&7)
+ if width<availableBits:
+ #read partial byte, beginning nor ending at boundary
+ data = self.stream.data[pos>>3] >> (pos&7) & (1<<width)-1
+ result.append('{:0{}b}'.format(data, width))
+ elif availableBits<8:
+ #read rest of byte, ending at boundary
+ data = self.stream.data[pos>>3] >> (pos&7)
+ result.append('|{:0{}b}'.format(data, availableBits))
+ else:
+ #read whole byte (in hex), beginning and ending at boundary
+ data = self.stream.data[pos>>3]
+ result.append('|{:02X}h'.format(data))
+ width -= availableBits
+ pos += availableBits
+ #if width overshot from the availableBits subtraction, fix it
+ pos += width
+ #add comma to separate fields
+ result.append(',')
+ #concatenate pieces, reversed, skipping the last space
+ return ''.join(result[-2::-1])
+
+ def readPrefixCode(self, alphabet):
+ """give alphabet the prefix code that is read from the stream
+ Called for the following alphabets, in this order:
+ The alphabet in question must have a "logical" order,
+ otherwise the assignment of symbols doesn't work.
+ """
+ mode, numberOfSymbols = self.verboseRead(PrefixCodeHeader(alphabet.name))
+ if mode=='Complex':
+ #for a complex code, numberOfSymbols means hskip
+ self.readComplexCode(numberOfSymbols, alphabet)
+ return alphabet
+ else:
+ table = []
+ #Set table of lengths for mnemonic function
+ lengths = [[0], [1,1], [1,2,2], '????'][numberOfSymbols-1]
+ #adjust mnemonic function of alphabet class
+ def myMnemonic(index):
+ return '{} bit{}: {}'.format(
+ lengths[i],
+ '' if lengths[i]==1 else 's',
+ alphabet.__class__.mnemonic(alphabet, index)
+ )
+ alphabet.mnemonic = myMnemonic
+ for i in range(numberOfSymbols):
+ table.append(self.verboseRead(alphabet, skipExtra=True).index)
+ #restore mnemonic
+ del alphabet.mnemonic
+ if numberOfSymbols==4:
+ #read tree shape to redefine lengths
+ lengths = self.verboseRead(TreeShapeAlhabet())
+ #construct the alphabet prefix code
+ alphabet.setLength(dict(zip(table, lengths)))
+ return alphabet
+
+ def readComplexCode(self, hskip, alphabet):
+ """Read complex code"""
+ stream = self.stream
+ #read the lengths for the length code
+ lengths = [1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15][hskip:]
+ codeLengths = {}
+ total = 0
+ lol = LengthOfLengthAlphabet('##'+alphabet.name)
+ #lengthCode will be used for coding the lengths of the new code
+ #we use it for display until now; definition comes below
+ lengthCode = LengthAlphabet('#'+alphabet.name)
+ lengthIter = iter(lengths)
+ lengthsLeft = len(lengths)
+ while total<32 and lengthsLeft>0:
+ lengthsLeft -= 1
+ newSymbol = next(lengthIter)
+ lol.description = str(lengthCode[newSymbol])
+ length = self.verboseRead(lol)
+ if length:
+ codeLengths[newSymbol] = length
+ total += 32>>length
+ if total>32: raise ValueError("Stream format")
+ if len(codeLengths)==1: codeLengths[list(codeLengths.keys())[0]] = 0
+ #Now set the encoding of the lengthCode
+ lengthCode.setLength(codeLengths)
+ print("***** Lengths for {} will be coded as:".format(alphabet.name))
+ lengthCode.showCode()
+ #Now determine the symbol lengths with the lengthCode
+ symbolLengths = {}
+ total = 0
+ lastLength = 8
+ alphabetIter = iter(alphabet)
+ while total<32768:
+ #look ahead to see what is going to happen
+ length = lengthCode.decodePeek(
+ self.stream.peek(lengthCode.maxLength))[1].index
+ #in every branch, set lengthCode.description to explanatory text
+ #lengthCode calls format(symbol, extra) with this string
+ if length==0:
+ symbol = next(alphabetIter)
+ lengthCode.description = 'symbol {} unused'.format(symbol)
+ self.verboseRead(lengthCode)
+ #unused symbol
+ continue
+ if length==16:
+ lengthCode.description = \
+ '{1}+3 symbols of length '+str(lastLength)
+ extra = self.verboseRead(lengthCode)
+ #scan series of 16s (repeat counts)
+ #start with repeat count 2
+ repeat = 2
+ startSymbol = next(alphabetIter)
+ endSymbol = next(alphabetIter)
+ symbolLengths[startSymbol.index] = \
+ symbolLengths[endSymbol.index] = lastLength
+ #count the two just defined symbols
+ total += 2*32768>>lastLength
+ #note: loop may end because we're there
+ #even if a 16 _appears_ to follow
+ while True:
+ #determine last symbol
+ oldRepeat = repeat
+ repeat = (repeat-2<<2)+extra+3
+ #read as many symbols as repeat increased
+ for i in range(oldRepeat, repeat):
+ endSymbol = next(alphabetIter)
+ symbolLengths[endSymbol.index] = lastLength
+ #compute new total; it may be end of loop
+ total += (repeat-oldRepeat)*32768>>lastLength
+ if total>=32768: break
+ #see if there is more to do
+ length = lengthCode.decodePeek(
+ self.stream.peek(lengthCode.maxLength))[1].index
+ if length!=16: break
+ lengthCode.description = 'total {}+{{1}} symbols'.format(
+ (repeat-2<<2)+3)
+ extra = self.verboseRead(lengthCode)
+ elif length==17:
+ #read, and show explanation
+ lengthCode.description = '{1}+3 unused'
+ extra = self.verboseRead(lengthCode)
+ #scan series of 17s (groups of zero counts)
+ #start with repeat count 2
+ repeat = 2
+ startSymbol = next(alphabetIter)
+ endSymbol = next(alphabetIter)
+ #note: loop will not end with total==32768,
+ #since total doesn't change here
+ while True:
+ #determine last symbol
+ oldRepeat = repeat
+ repeat = (repeat-2<<3)+extra+3
+ #read as many symbols as repeat increases
+ for i in range(repeat-oldRepeat):
+ endSymbol = next(alphabetIter)
+ #see if there is more to do
+ length = lengthCode.decodePeek(
+ self.stream.peek(lengthCode.maxLength))[1].index
+ if length!=17: break
+ lengthCode.description = 'total {}+{{1}} unused'.format(
+ (repeat-2<<3)+3)
+ extra = self.verboseRead(lengthCode)
+ else:
+ symbol = next(alphabetIter)
+ #double braces for format
+ char = str(symbol)
+ if char in '{}': char *= 2
+ lengthCode.description = \
+ 'Length for {} is {{0.index}} bits'.format(char)
+ #output is not needed (will be 0)
+ self.verboseRead(lengthCode)
+ symbolLengths[symbol.index] = length
+ total += 32768>>length
+ lastLength = length
+ assert total==32768
+ alphabet.setLength(symbolLengths)
+ print('End of table. Prefix code '+alphabet.name+':')
+ alphabet.showCode()
+
+ #stream
+ def processStream(self):
+ """Process a brotli stream.
+ """
+ print('addr hex{:{}s}binary context explanation'.format(
+ '', self.width-10))
+ print('Stream header'.center(60, '-'))
+ self.windowSize = self.verboseRead(WindowSizeAlphabet())
+ print('Metablock header'.center(60, '='))
+ self.ISLAST = False
+ self.output = bytearray()
+ while not self.ISLAST:
+ self.ISLAST = self.verboseRead(
+ BoolCode('LAST', description="Last block"))
+ if self.ISLAST:
+ if self.verboseRead(
+ BoolCode('EMPTY', description="Empty block")): break
+ if self.metablockLength(): continue
+ if not self.ISLAST and self.uncompressed(): continue
+ print('Block type descriptors'.center(60, '-'))
+ self.numberOfBlockTypes = {}
+ self.currentBlockCounts = {}
+ self.blockTypeCodes = {}
+ self.blockCountCodes = {}
+ for blockType in (L,I,D): self.blockType(blockType)
+ print('Distance code parameters'.center(60, '-'))
+ self.NPOSTFIX, self.NDIRECT = self.verboseRead(DistanceParamAlphabet())
+ self.readLiteralContextModes()
+ print('Context maps'.center(60, '-'))
+ self.cmaps = {}
+ #keep the number of each kind of prefix tree for the last loop
+ numberOfTrees = {I: self.numberOfBlockTypes[I]}
+ for blockType in (L,D):
+ numberOfTrees[blockType] = self.contextMap(blockType)
+ print('Prefix code lists'.center(60, '-'))
+ self.prefixCodes = {}
+ for blockType in (L,I,D):
+ self.readPrefixArray(blockType, numberOfTrees[blockType])
+ self.metablock()
+
+ #metablock header
+ def verboseRead(self, alphabet, context='', skipExtra=False):
+ """Read symbol and extra from stream and explain what happens.
+ Returns the value of the symbol
+ >>> olleke.pos = 0
+ >>> l = Layout(olleke)
+ >>> l.verboseRead(WindowSizeAlphabet())
+ 0000 1b 1011 WSIZE windowsize=(1<<22)-16=4194288
+ 4194288
+ """
+ #TODO 2: verbosity level, e.g. show only codes and maps in header
+ stream = self.stream
+ pos = stream.pos
+ if skipExtra:
+ length, symbol = alphabet.readTuple(stream)
+ extraBits, extra = 0, None
+ else:
+ length, symbol, extraBits, extra = alphabet.readTupleAndExtra(
+ stream)
+ #fields: address, hex data, binary data, name of alphabet, explanation
+ hexdata = self.makeHexData(pos)
+ addressField = '{:04x}'.format(pos+7>>3) if hexdata else ''
+ bitdata = self.formatBitData(pos, length, extraBits)
+ #bitPtr moves bitdata so that the bytes are easier to read
+ #jump back to right if a new byte starts
+ if '|' in bitdata[1:]:
+ #start over on the right side
+ self.bitPtr = self.width
+ fillWidth = self.bitPtr-(len(hexdata)+len(bitdata))
+ if fillWidth<0: fillWidth = 0
+ print('{:<5s} {:<{}s} {:7s} {}'.format(
+ addressField,
+ hexdata+' '*fillWidth+bitdata, self.width,
+ context+alphabet.name,
+ symbol if skipExtra else symbol.explanation(extra),
+ ))
+ #jump to the right if we started with a '|'
+ #because we didn't jump before printing
+ if bitdata.startswith('|'): self.bitPtr = self.width
+ else: self.bitPtr -= len(bitdata)
+ return symbol if skipExtra else symbol.value(extra)
+
+ def metablockLength(self):
+ """Read MNIBBLES and meta block length;
+ if empty block, skip block and return true.
+ """
+ self.MLEN = self.verboseRead(MetablockLengthAlphabet())
+ if self.MLEN:
+ return False
+ #empty block; skip and return False
+ self.verboseRead(ReservedAlphabet())
+ MSKIP = self.verboseRead(SkipLengthAlphabet())
+ self.verboseRead(FillerAlphabet(streamPos=self.stream.pos))
+ self.stream.pos += 8*MSKIP
+ print("Skipping to {:x}".format(self.stream.pos>>3))
+ return True
+
+ def uncompressed(self):
+ """If true, handle uncompressed data
+ """
+ ISUNCOMPRESSED = self.verboseRead(
+ BoolCode('UNCMPR', description='Is uncompressed?'))
+ if ISUNCOMPRESSED:
+ self.verboseRead(FillerAlphabet(streamPos=self.stream.pos))
+ print('Uncompressed data:')
+ self.output += self.stream.readBytes(self.MLEN)
+ print(outputFormatter(self.output[-self.MLEN:]))
+ return ISUNCOMPRESSED
+
+ def blockType(self, kind):
+ """Read block type switch descriptor for given kind of blockType."""
+ NBLTYPES = self.verboseRead(TypeCountAlphabet(
+ 'BT#'+kind[0].upper(),
+ description='{} block types'.format(kind),
+ ))
+ self.numberOfBlockTypes[kind] = NBLTYPES
+ if NBLTYPES>=2:
+ self.blockTypeCodes[kind] = self.readPrefixCode(
+ BlockTypeAlphabet('BT'+kind[0].upper(), NBLTYPES))
+ self.blockCountCodes[kind] = self.readPrefixCode(
+ BlockCountAlphabet('BC'+kind[0].upper()))
+ blockCount = self.verboseRead(self.blockCountCodes[kind])
+ else:
+ blockCount = 1<<24
+ self.currentBlockCounts[kind] = blockCount
+
+ def readLiteralContextModes(self):
+ """Read literal context modes.
+ LSB6: lower 6 bits of last char
+ MSB6: upper 6 bits of last char
+ UTF8: rougly dependent on categories:
+ upper 4 bits depend on category of last char:
+ control/whitespace/space/ punctuation/quote/%/open/close/
+ comma/period/=/digits/ VOWEL/CONSONANT/vowel/consonant
+ lower 2 bits depend on category of 2nd last char:
+ space/punctuation/digit or upper/lowercase
+ signed: hamming weight of last 2 chars
+ """
+ print('Context modes'.center(60, '-'))
+ self.literalContextModes = []
+ for i in range(self.numberOfBlockTypes[L]):
+ self.literalContextModes.append(
+ self.verboseRead(LiteralContextMode(number=i)))
+
+ def contextMap(self, kind):
+ """Read context maps
+ Returns the number of differnt values on the context map
+ (In other words, the number of prefix trees)
+ """
+ NTREES = self.verboseRead(TypeCountAlphabet(
+ kind[0].upper()+'T#',
+ description='{} prefix trees'.format(kind)))
+ mapSize = {L:64, D:4}[kind]
+ if NTREES<2:
+ self.cmaps[kind] = [0]*mapSize
+ else:
+ #read CMAPkind
+ RLEMAX = self.verboseRead(RLEmaxAlphabet(
+ 'RLE#'+kind[0].upper(),
+ description=kind+' context map'))
+ alphabet = TreeAlphabet('CM'+kind[0].upper(), NTREES=NTREES, RLEMAX=RLEMAX)
+ cmapCode = self.readPrefixCode(alphabet)
+ tableSize = mapSize*self.numberOfBlockTypes[kind]
+ cmap = []
+ while len(cmap)<tableSize:
+ cmapCode.description = 'map {}, entry {}'.format(
+ *divmod(len(cmap), mapSize))
+ count, value = self.verboseRead(cmapCode)
+ cmap.extend([value]*count)
+ assert len(cmap)==tableSize
+ IMTF = self.verboseRead(BoolCode('IMTF', description='Apply inverse MTF'))
+ if IMTF:
+ self.IMTF(cmap)
+ if kind==L:
+ print('Context maps for literal data:')
+ for i in range(0, len(cmap), 64):
+ print(*(
+ ''.join(map(str, cmap[j:j+8]))
+ for j in range(i, i+64, 8)
+ ))
+ else:
+ print('Context map for distances:')
+ print(*(
+ ''.join(map('{:x}'.format, cmap[i:i+4]))
+ for i in range(0, len(cmap), 4)
+ ))
+ self.cmaps[kind] = cmap
+ return NTREES
+
+ @staticmethod
+ def IMTF(v):
+ """In place inverse move to front transform.
+ """
+ #mtf is initialized virtually with range(infinity)
+ mtf = []
+ for i, vi in enumerate(v):
+ #get old value from mtf. If never seen, take virtual value
+ try: value = mtf.pop(vi)
+ except IndexError: value = vi
+ #put value at front
+ mtf.insert(0, value)
+ #replace transformed value
+ v[i] = value
+
+ def readPrefixArray(self, kind, numberOfTrees):
+ """Read prefix code array"""
+ prefixes = []
+ for i in range(numberOfTrees):
+ if kind==L: alphabet = LiteralAlphabet(i)
+ elif kind==I: alphabet = InsertAndCopyAlphabet(i)
+ elif kind==D: alphabet = DistanceAlphabet(
+ i, NPOSTFIX=self.NPOSTFIX, NDIRECT=self.NDIRECT)
+ self.readPrefixCode(alphabet)
+ prefixes.append(alphabet)
+ self.prefixCodes[kind] = prefixes
+
+ #metablock data
+ def metablock(self):
+ """Process the data.
+ Relevant variables of self:
+ numberOfBlockTypes[kind]: number of block types
+ currentBlockTypes[kind]: current block types (=0)
+ literalContextModes: the context modes for the literal block types
+ currentBlockCounts[kind]: counters for block types
+ blockTypeCodes[kind]: code for block type
+ blockCountCodes[kind]: code for block count
+ cmaps[kind]: the context maps (not for I)
+ prefixCodes[kind][#]: the prefix codes
+ lastDistances: the last four distances
+ lastChars: the last two chars
+ output: the result
+ """
+ print('Meta block contents'.center(60, '='))
+ self.currentBlockTypes = {L:0, I:0, D:0, pL:1, pI:1, pD:1}
+ self.lastDistances = deque([17,16,11,4], maxlen=4)
+ #the current context mode is for block type 0
+ self.contextMode = ContextModeKeeper(self.literalContextModes[0])
+ wordList = WordList()
+
+ #setup distance callback function
+ def distanceCallback(symbol, extra):
+ "callback function for displaying decoded distance"
+ index, offset = symbol.value(extra)
+ if index:
+ #recent distance
+ distance = self.lastDistances[-index]+offset
+ return 'Distance: {}last{:+d}={}'.format(index, offset, distance)
+ #absolute value
+ if offset<=maxDistance:
+ return 'Absolute value: {} (pos {})'.format(offset, maxDistance-offset)
+ #word list value
+ action, word = divmod(offset-maxDistance, 1<<wordList.NDBITS[copyLen])
+ return '{}-{} gives word {},{} action {}'.format(
+ offset, maxDistance, copyLen, word, action)
+ for dpc in self.prefixCodes[D]: dpc.callback = distanceCallback
+
+ blockLen = 0
+ #there we go
+ while blockLen<self.MLEN:
+ #get insert&copy command
+ litLen, copyLen, dist0Flag = self.verboseRead(
+ self.prefixCodes[I][
+ self.figureBlockType(I)])
+ #literal data
+ for i in range(litLen):
+ bt = self.figureBlockType(L)
+ cm = self.contextMode.getIndex()
+ ct = self.cmaps[L][bt<<6|cm]
+ char = self.verboseRead(
+ self.prefixCodes[L][ct],
+ context='{},{}='.format(bt,cm))
+ self.contextMode.add(char)
+ self.output.append(char)
+ blockLen += litLen
+ #check if we're done
+ if blockLen>=self.MLEN: return
+ #distance
+ #distances are computed relative to output length, at most window size
+ maxDistance = min(len(self.output), self.windowSize)
+ if dist0Flag:
+ distance = self.lastDistances[-1]
+ else:
+ bt = self.figureBlockType(D)
+ cm = {2:0, 3:1, 4:2}.get(copyLen, 3)
+ ct = self.cmaps[D][bt<<2|cm]
+ index, offset = self.verboseRead(
+ self.prefixCodes[D][ct],
+ context='{},{}='.format(bt,cm))
+ distance = self.lastDistances[-index]+offset if index else offset
+ if index==1 and offset==0:
+ #to make sure distance is not put in last distance list
+ dist0Flag = True
+ if distance<=maxDistance:
+ #copy from output
+ for i in range(
+ maxDistance-distance,
+ maxDistance-distance+copyLen):
+ self.output.append(self.output[i])
+ if not dist0Flag: self.lastDistances.append(distance)
+ comment = 'Seen before'
+ else:
+ #fetch from wordlist
+ newWord = wordList.word(copyLen, distance-maxDistance-1)
+ self.output.extend(newWord)
+ #adjust copyLen to reflect actual new data
+ copyLen = len(newWord)
+ comment = 'From wordlist'
+ blockLen += copyLen
+ print(' '*40,
+ comment,
+ ': "',
+ outputFormatter(self.output[-copyLen:]),
+ '"',
+ sep='')
+ self.contextMode.add(self.output[-2])
+ self.contextMode.add(self.output[-1])
+
+ def figureBlockType(self, kind):
+ counts, types = self.currentBlockCounts, self.currentBlockTypes
+ if counts[kind]==0:
+ newType = self.verboseRead(self.blockTypeCodes[kind])
+ if newType==-2: newType = types['P'+kind]
+ elif newType==-1:
+ newType = (types[kind]+1)%self.numberOfBlockTypes[kind]
+ types['P'+kind] = types[kind]
+ types[kind] = newType
+ counts[kind] = self.verboseRead(self.blockCountCodes[kind])
+ counts[kind] -=1
+ return types[kind]
+
+__test__ = {
+'BitStream': """
+ >>> bs = BitStream(b'Jurjen')
+ >>> bs.readBytes(2)
+ b'Ju'
+ >>> bs.read(6) #r=01110010
+ 50
+ >>> bs
+ BitStream(pos=2:6)
+ >>> bs.peek(5) #j=01101010
+ 9
+ >>> bs.readBytes(2)
+ Traceback (most recent call last):
+ ...
+ ValueError: readBytes: need byte boundary
+ """,
+
+'Symbol': """
+ >>> a=Symbol(MetablockLengthAlphabet(),5)
+ >>> len(a)
+ 2
+ >>> int(a)
+ 5
+ >>> a.bitPattern()
+ '01'
+ >>> a.value(200000)
+ 200001
+ >>> a.explanation(300000)
+ 'data length: 493e0h+1=300001'
+ """,
+
+'RangeDecoder': """
+ >>> a=RangeDecoder(bitLength=3)
+ >>> len(a)
+ 8
+ >>> a.name='t'
+ >>> list(a)
+ [Symbol(t, 0), Symbol(t, 1), Symbol(t, 2), Symbol(t, 3), Symbol(t, 4), Symbol(t, 5), Symbol(t, 6), Symbol(t, 7)]
+ >>> a[2]
+ Symbol(t, 2)
+ >>> a.bitPattern(4)
+ '100'
+ >>> a.length(2)
+ 3
+ >>> a.decodePeek(15)
+ (3, Symbol(t, 7))
+ >>>
+
+ """,
+
+'PrefixDecoder': """
+ >>> a=PrefixDecoder(decodeTable={0:1,1:2,3:3,7:4})
+ >>> len(a)
+ 4
+ >>> a.name='t'
+ >>> list(a)
+ [Symbol(t, 1), Symbol(t, 2), Symbol(t, 3), Symbol(t, 4)]
+ >>> a.decodePeek(22)
+ (1, Symbol(t, 1))
+ >>> a.decodePeek(27)
+ (3, Symbol(t, 3))
+ >>> a.length(1)
+ 1
+ >>> a.length(4)
+ 3
+ """,
+
+'Code': """
+ >>> a=Code('t',alphabetSize=10)
+ >>> len(a)
+ 10
+ >>> a.showCode()
+ 0000:0 0001:1 0010:2 0011:3 0100:4 0101:5 0110:6 0111:7 1000:8 1001:9
+ >>> a.setLength({2:1,3:2,5:3,6:3})
+ >>> a.showCode()
+ 0:2 01:3 011:5 111:6
+ >>> len(a)
+ 4
+ >>> def callback(i): return 'call{}back'.format(i)
+ >>> a=Code('t',callback=callback,bitLength=3)
+ >>> a[6].explanation()
+ 'call6back'
+ """,
+
+'WithExtra': """
+ >>> class A(WithExtra):
+ ... extraTable = [0,1,1,2,2]
+ >>> a=A('t',alphabetSize=5)
+ >>> a[1]
+ Symbol(t, 1)
+ >>> a.extraBits(2)
+ 1
+ >>> a.mnemonic(4)
+ '4'
+ >>> a.readTupleAndExtra(BitStream(b'\x5b'))
+ (3, Symbol(t, 3), 2, 3)
+ """,
+
+'BoolCode': """
+ >>> BoolCode('test')[0].explanation()
+ '0: False'
+ """,
+
+'Enumerator': """
+ >>> class A(Enumerator):
+ ... extraTable = [0,1,1,2,2]
+ ... value0=3
+ >>> a=A(alphabetLength=5)
+ >>> a.value(3)
+ Traceback (most recent call last):
+ ...
+ TypeError: value() missing 1 required positional argument: 'extra'
+ >>> a.explanation(3,4)
+ 'xx 011: 8-11; 8+4=12'
+ """,
+
+'WindowSizeAlphabet': """
+ >>> windowSizeAlphabet = WindowSizeAlphabet()
+ >>> windowSizeAlphabet[0]
+ Traceback (most recent call last):
+ ...
+ ValueError: No symbol WindowSizeAlphabet[0]
+ >>> len(windowSizeAlphabet)
+ 16
+ >>> windowSizeAlphabet[21]
+ Symbol(WSIZE, 21)
+ >>> windowSizeAlphabet[21].bitPattern()
+ '1001'
+ >>> windowSizeAlphabet[21].extraBits()
+ 0
+ >>> windowSizeAlphabet[21].index
+ 21
+ >>> windowSizeAlphabet[10].value()
+ 1008
+ >>> windowSizeAlphabet[10].explanation()
+ 'windowsize=(1<<10)-16=1008'
+ >>> windowSizeAlphabet.showCode()
+ 0:65520 1100001:16368 1110001:32752 0011:262128
+ 0000001:131056 0010001:None 1001:2097136 1011:4194288
+ 1000001:4080 1010001:8176 0101:524272 0111:1048560
+ 0100001:1008 0110001:2032 1101:8388592 1111:16777200
+ """,
+
+'TypeCountAlphabet': """
+ >>> typeCountAlphabet = TypeCountAlphabet(description='bananas')
+ >>> len(typeCountAlphabet)
+ 9
+ >>> typeCountAlphabet[3]
+ Symbol(BT#, 3)
+ >>> typeCountAlphabet[9]
+ Traceback (most recent call last):
+ ...
+ ValueError: No symbol TypeCountAlphabet[9]
+ >>> print(typeCountAlphabet[3])
+ xx,0101
+ >>> typeCountAlphabet[8].value(127)
+ 256
+ >>> typeCountAlphabet[4].explanation(2)
+ 'xxx,0111: 11 bananas'
+ >>> typeCountAlphabet[0].explanation()
+ '0: 1 banana'
+ """,
+
+'DistanceParamAlphabet': """
+ >>> dpa = DistanceParamAlphabet()
+ >>> dpa.showCode()
+ 00:PF0 01:PF1 10:PF2 11:PF3
+ >>> dpa.readTupleAndExtra(BitStream(b'\\x29'))
+ (2, Symbol(DIST, 1), 4, 10)
+ >>> dpa.explanation(2, 5)
+ '2 postfix bits and 0101<<2=20 direct codes'
+ """,
+
+'LiteralAlphabet': """
+ >>> LiteralAlphabet(-1).showCode() #doctest: +ELLIPSIS
+ 00000000:\\x00 00110100:4 01101000:h 10011100:\\x9c 11010000:\\xd0
+ 00000001:\\x01 00110101:5 01101001:i 10011101:\\x9d 11010001:\\xd1
+ 00000010:\\x02 00110110:6 01101010:j 10011110:\\x9e 11010010:\\xd2
+ ...
+ 00101111:/ 01100011:c 10010111:\\x97 11001011:\\xcb 11111111:\\xff
+ 00110000:0 01100100:d 10011000:\\x98 11001100:\\xcc
+ 00110001:1 01100101:e 10011001:\\x99 11001101:\\xcd
+ 00110010:2 01100110:f 10011010:\\x9a 11001110:\\xce
+ 00110011:3 01100111:g 10011011:\\x9b 11001111:\\xcf
+ """,
+
+'BlockCountAlphabet': """
+ >>> bc=BlockCountAlphabet('BCL')
+ >>> len(bc)
+ 26
+ >>> bs=BitStream(b'\\x40\\x83\\xc8\\x59\\12\\x02')
+ >>> x = bc.readTupleAndExtra(bs); x[1].explanation(x[3])
+ 'Block count: xx 00000: 1-4; 1+2=3'
+ >>> x = bc.readTupleAndExtra(bs); x[1].explanation(x[3])
+ 'Block count: xxx 00110: 33-40; 33+0=33'
+ >>> x = bc.readTupleAndExtra(bs); x[1].explanation(x[3])
+ 'Block count: xxxxxx 10001: 305-368; 305+28=333'
+ >>> x = bc.readTupleAndExtra(bs); x[1].explanation(x[3])
+ 'Block count: xxxxxxxxxxx 10110: 2289-4336; 2289+1044=3333'
+ """,
+
+'Layout': """
+ >>> olleke.pos = 0
+ >>> l = Layout(olleke)
+ >>> l.verboseRead(WindowSizeAlphabet())
+ 0000 1b 1011 WSIZE windowsize=(1<<22)-16=4194288
+ 4194288
+ >>> l.verboseRead(BoolCode('LAST', description="Last block"))
+ 1 LAST Last block: 1: True
+ True
+ >>> l.verboseRead(BoolCode('EMPTY', description="Empty block"))
+ 0 EMPTY Empty block: 0: False
+ False
+ >>> l.verboseRead(MetablockLengthAlphabet())
+ 0001 2e 00 |00h|2Eh,|00 MLEN data length: 002eh+1=47
+ 47
+ >>> olleke.pos = 76
+ >>> l = Layout(olleke)
+ >>> x = l.verboseRead(DistanceAlphabet(0,NPOSTFIX=0,NDIRECT=0), skipExtra=True)
+ 000a 82 10|1100 D0 10[15*x]-3
+ >>> x.explanation(0x86a3)
+ '10[1000011010100011]-3: [0]+100000'
+ """,
+
+'olleke': """
+ >>> olleke.pos = 0
+ >>> try: Layout(olleke).processStream()
+ ... except NotImplementedError: pass
+ ... #doctest: +REPORT_NDIFF
+ addr hex binary context explanation
+ -----------------------Stream header------------------------
+ 0000 1b 1011 WSIZE windowsize=(1<<22)-16=4194288
+ ======================Metablock header======================
+ 1 LAST Last block: 1: True
+ 0 EMPTY Empty block: 0: False
+ 0001 2e 00 |00h|2Eh,|00 MLEN data length: 002eh+1=47
+ -------------------Block type descriptors-------------------
+ 0003 00 0 BT#L 0: 1 literal block type
+ 0 BT#I 0: 1 insert&copy block type
+ 0 BT#D 0: 1 distance block type
+ ------------------Distance code parameters------------------
+ 0004 44 0|000,00 DIST 0 postfix bits and 0000<<0=0 direct codes
+ -----------------------Context modes------------------------
+ 10 LC0 Context mode for type 0: 2(UTF8)
+ ------------------------Context maps------------------------
+ 0 LT# 0: 1 literal prefix tree
+ 0 DT# 0: 1 distance prefix tree
+ ---------------------Prefix code lists----------------------
+ 10 PFX L0 is complex with lengths 3,4,0,5,17...
+ 0005 4f 1|0 ##L0 len 3: coded with 3 bits
+ 0111 ##L0 len 4: coded with 1 bits
+ 10 ##L0 unused: coded with 3 bits
+ 0006 d6 0|0 ##L0 len 5: skipped
+ 011 ##L0 zero xxx: coded with 2 bits
+ ***** Lengths for L0 will be coded as:
+ 0:len 4 01:zero xxx 011:unused 111:len 3
+ 0007 95 1|11,01 #L0 7+3 unused
+ 0 #L0 Length for \\n is 4 bits
+ 001,01 #L0 1+3 unused
+ 0008 44 010,0|1 #L0 total 19+2 unused
+ 0 #L0 Length for " " is 4 bits
+ 0 #L0 Length for ! is 4 bits
+ 0009 cb 011,|01 #L0 3+3 unused
+ |110,01 #L0 total 35+6 unused
+ 000a 82 0 #L0 Length for K is 4 bits
+ 000,01 #L0 0+3 unused
+ 0 #L0 Length for O is 4 bits
+ 000b 4d 01|1 #L0 symbol P unused
+ 011 #L0 symbol Q unused
+ 0 #L0 Length for R is 4 bits
+ 000c 88 000,|01 #L0 0+3 unused
+ |100,01 #L0 total 11+4 unused
+ 000d b6 0 #L0 Length for b is 4 bits
+ 011 #L0 symbol c unused
+ 011 #L0 symbol d unused
+ 000e 27 11|1 #L0 Length for e is 3 bits
+ 010,01 #L0 2+3 unused
+ |0 #L0 Length for k is 4 bits
+ 000f 1f 111 #L0 Length for l is 3 bits
+ 011 #L0 symbol m unused
+ 0 #L0 Length for n is 4 bits
+ |0 #L0 Length for o is 4 bits
+ 0010 c1 000,01 #L0 0+3 unused
+ 0 #L0 Length for s is 4 bits
+ 0011 b4 0|11 #L0 symbol t unused
+ 0 #L0 Length for u is 4 bits
+ End of table. Prefix code L0:
+ 000:e 0010:\\n 0110:! 0001:O 0101:b 0011:n 0111:s
+ 100:l 1010:" " 1110:K 1001:R 1101:k 1011:o 1111:u
+ 11,01 PFX IC0 is simple with 4 code words
+ 0012 2a |2Ah|10 IC0 ? bits: I5C4
+ 0013 b5 ec 00|B5h IC0 ? bits: I6+xC7
+ 0015 22 0010|111011 IC0 ? bits: I8+xC5
+ 0016 8c 001100|0010 IC0 ? bits: I0C14+xx
+ 0 SHAPE False: lengths 2,2,2,2
+ 0017 74 10,0|1 PFX D0 is simple with 3 code words
+ 0018 a6 0|01110 D0 1 bit: 2last-3
+ 010011 D0 2 bits: 11xx-3
+ 0019 aa 01010|1 D0 2 bits: 11xxx-3
+ ====================Meta block contents=====================
+ |1,01 IC0 Literal: 9, copy: 5
+ 001a 41 0001 0,0=L0 O
+ 100 0,48=L0 l
+ 001b a2 10|0 0,62=L0 l
+ 000 0,63=L0 e
+ 001c a1 1|101 0,59=L0 k
+ 000 0,63=L0 e
+ |1010 0,59=L0 " "
+ 001d b5 0101 0,11=L0 b
+ |1011 0,60=L0 o
+ 001e 24 0 0,3=D0 Distance: 2last-3=8
+ Seen before: "lleke"
+ 0,10 IC0 Literal: 6, copy: 7
+ |0010 0,59=L0 \\n
+ 001f 89 1001 0,7=L0 R
+ 000 0,52=L0 e
+ 0020 fa 010|1 0,58=L0 b
+ 1111 0,63=L0 u
+ 0021 eb 011|1 0,59=L0 s
+ 11,01 0,3=D0 Absolute value: 12 (pos 8)
+ Seen before: "olleke\\n"
+ 0022 db 01,1|1 IC0 Literal: 0, copy: 15
+ |110,11 0,3=D0 Absolute value: 27 (pos 0)
+ Seen before: "Olleke bolleke\\n"
+ 0023 f8 00 IC0 Literal: 5, copy: 4
+ 1110 0,7=L0 K
+ 0024 2c 00|11 0,52=L0 n
+ 1011 0,62=L0 o
+ 0025 0d 1|00 0,59=L0 l
+ 0110 0,63=L0 !
+ """,
+
+'file': """
+ >>> try: Layout(BitStream(
+ ... open("H:/Downloads/brotli-master/tests/testdata/10x10y.compressed",'rb')
+ ... .read())).processStream()
+ ... except NotImplementedError: pass
+ addr hex binary context explanation
+ -----------------------Stream header------------------------
+ 0000 1b 1011 WSIZE windowsize=(1<<22)-16=4194288
+ ======================Metablock header======================
+ 1 LAST Last block: 1: True
+ 0 EMPTY Empty block: 0: False
+ 0001 13 00 |00h|13h,|00 MLEN data length: 0013h+1=20
+ -------------------Block type descriptors-------------------
+ 0003 00 0 BT#L 0: 1 literal block type
+ 0 BT#I 0: 1 insert&copy block type
+ 0 BT#D 0: 1 distance block type
+ ------------------Distance code parameters------------------
+ 0004 a4 0|000,00 DIST 0 postfix bits and 0000<<0=0 direct codes
+ -----------------------Context modes------------------------
+ 10 LC0 Context mode for type 0: 2(UTF8)
+ ------------------------Context maps------------------------
+ 0 LT# 0: 1 literal prefix tree
+ 0 DT# 0: 1 distance prefix tree
+ ---------------------Prefix code lists----------------------
+ 0005 b0 0|1,01 PFX L0 is simple with 2 code words
+ 0006 b2 0|1011000 L0 1 bit: X
+ 0007 ea 0|1011001 L0 1 bit: Y
+ 01,01 PFX IC0 is simple with 2 code words
+ 0008 81 0000001|111 IC0 1 bit: I1C9&D=0
+ 0009 47 02 0|47h|1 IC0 1 bit: I1C9
+ 00,01 PFX D0 is simple with 1 code word
+ 000b 8a 010|000 D0 0 bits: 10x-3
+ ====================Meta block contents=====================
+ 1 IC0 Literal: 1, copy: 9
+ 0 0,0=L0 X
+ 0,() 0,3=D0 Absolute value: 1 (pos 0)
+ Seen before: "XXXXXXXXX"
+ 0 IC0 Literal: 1, copy: 9, same distance
+ |1 0,54=L0 Y
+ Seen before: "YYYYYYYYY"
+ """,
+
+'XY': """
+ >>> try: Layout(BitStream(brotli.compress('X'*10+'Y'*10))).processStream()
+ ... except NotImplementedError: pass
+ addr hex binary context explanation
+ -----------------------Stream header------------------------
+ 0000 1b 1011 WSIZE windowsize=(1<<22)-16=4194288
+ ======================Metablock header======================
+ 1 LAST Last block: 1: True
+ 0 EMPTY Empty block: 0: False
+ 0001 13 00 |00h|13h,|00 MLEN data length: 0013h+1=20
+ -------------------Block type descriptors-------------------
+ 0003 00 0 BT#L 0: 1 literal block type
+ 0 BT#I 0: 1 insert&copy block type
+ 0 BT#D 0: 1 distance block type
+ ------------------Distance code parameters------------------
+ 0004 a4 0|000,00 DIST 0 postfix bits and 0000<<0=0 direct codes
+ -----------------------Context modes------------------------
+ 10 LC0 Context mode for type 0: 2(UTF8)
+ ------------------------Context maps------------------------
+ 0 LT# 0: 1 literal prefix tree
+ 0 DT# 0: 1 distance prefix tree
+ ---------------------Prefix code lists----------------------
+ 0005 b0 0|1,01 PFX L0 is simple with 2 code words
+ 0006 b2 0|1011000 L0 1 bit: X
+ 0007 82 0|1011001 L0 1 bit: Y
+ 00,01 PFX IC0 is simple with 1 code word
+ 0008 84 0000100|100 IC0 0 bits: I4C6&D=0
+ 0009 00 00,0|1 PFX D0 is simple with 1 code word
+ 000a e0 0|00000 D0 0 bits: last
+ ====================Meta block contents=====================
+ () IC0 Literal: 4, copy: 6, same distance
+ 0 0,0=L0 X
+ 0 0,52=L0 X
+ 0 0,54=L0 X
+ 0 0,54=L0 X
+ Seen before: "XXXXXX"
+ () IC0 Literal: 4, copy: 6, same distance
+ 1 0,54=L0 Y
+ 1 0,54=L0 Y
+ |1 0,54=L0 Y
+ 000b 01 1 0,54=L0 Y
+ Seen before: "YYYYYY"
+ """,
+
+'empty': """
+ >>> try: Layout(BitStream(b'\\x81\\x16\\x00\\x58')).processStream()
+ ... except NotImplementedError: pass
+ addr hex binary context explanation
+ -----------------------Stream header------------------------
+ 0000 81 0000001 WSIZE windowsize=(1<<17)-16=131056
+ ======================Metablock header======================
+ |1 LAST Last block: 1: True
+ 0001 16 0 EMPTY Empty block: 0: False
+ 11 MLEN 11: empty block
+ 0 RSVD Reserved (must be zero)
+ 0002 00 000000|00,01 SKIP skip length: 0h+1=1
+ |00 SKIP 2 bits ignored
+ Skipping to 4
+ """,
+
+}
+
+if __name__=='__main__':
+ import sys
+ if len(sys.argv)>1:
+ l = Layout(BitStream(open(sys.argv[1],'rb').read()))
+ l.processStream()
+ else:
+ sys.path.append("h:/Persoonlijk/bin")
+ try:
+ import brotli
+ open('brotlidump.br', 'wb').write(
+ brotli.compress(
+ open('brotlidump.py', 'r').read()
+ ))
+ olleke = BitStream(brotli.compress(
+ 'Olleke bolleke\nRebusolleke\nOlleke bolleke\nKnol!'))
+ except ImportError: pass
+ import doctest
+ doctest.testmod(optionflags=doctest.REPORT_NDIFF
+ #|doctest.FAIL_FAST
+ )
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/deorummolae.cc b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/deorummolae.cc
new file mode 100644
index 000000000..d15b7ee55
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/deorummolae.cc
@@ -0,0 +1,302 @@
+#include "./deorummolae.h"
+
+#include <array>
+#include <cstdio>
+
+#include "./esaxx/sais.hxx"
+
+/* Used for quick SA-entry to file mapping. Each file is padded to size that
+ is a multiple of chunk size. */
+#define CHUNK_SIZE 64
+/* Length of substring that is considered to be covered by dictionary string. */
+#define CUT_MATCH 6
+/* Minimal dictionary entry size. */
+#define MIN_MATCH 24
+
+/* Non tunable definitions. */
+#define CHUNK_MASK (CHUNK_SIZE - 1)
+#define COVERAGE_SIZE (1 << (DM_LOG_MAX_FILES - 6))
+
+/* File coverage: every bit set to 1 denotes a file covered by an isle. */
+typedef std::array<uint64_t, COVERAGE_SIZE> Coverage;
+
+/* Symbol of text alphabet. */
+typedef int32_t TextChar;
+
+/* Pointer to position in text. */
+typedef uint32_t TextIdx;
+
+/* SAIS sarray_type; unfortunately, must be a signed type. */
+typedef int32_t TextSaIdx;
+
+static size_t popcount(uint64_t u) {
+ return static_cast<size_t>(__builtin_popcountll(u));
+}
+
+/* Condense terminators and pad file entries. */
+static void rewriteText(std::vector<TextChar>* text) {
+ TextChar terminator = text->back();
+ TextChar prev = terminator;
+ TextIdx to = 0;
+ for (TextIdx from = 0; from < text->size(); ++from) {
+ TextChar next = text->at(from);
+ if (next < 256 || prev < 256) {
+ text->at(to++) = next;
+ if (next >= 256) terminator = next;
+ }
+ prev = next;
+ }
+ text->resize(to);
+ if (text->empty()) text->push_back(terminator);
+ while (text->size() & CHUNK_MASK) text->push_back(terminator);
+}
+
+/* Reenumerate terminators for smaller alphabet. */
+static void remapTerminators(std::vector<TextChar>* text,
+ TextChar* next_terminator) {
+ TextChar prev = -1;
+ TextChar x = 256;
+ for (TextIdx i = 0; i < text->size(); ++i) {
+ TextChar next = text->at(i);
+ if (next < 256) { // Char.
+ // Do nothing.
+ } else if (prev < 256) { // Terminator after char.
+ next = x++;
+ } else { // Terminator after terminator.
+ next = prev;
+ }
+ text->at(i) = next;
+ prev = next;
+ }
+ *next_terminator = x;
+}
+
+/* Combine all file entries; create mapping position->file. */
+static void buildFullText(std::vector<std::vector<TextChar>>* data,
+ std::vector<TextChar>* full_text, std::vector<TextIdx>* file_map,
+ std::vector<TextIdx>* file_offset, TextChar* next_terminator) {
+ file_map->resize(0);
+ file_offset->resize(0);
+ full_text->resize(0);
+ for (TextIdx i = 0; i < data->size(); ++i) {
+ file_offset->push_back(full_text->size());
+ std::vector<TextChar>& file = data->at(i);
+ rewriteText(&file);
+ full_text->insert(full_text->end(), file.begin(), file.end());
+ file_map->insert(file_map->end(), file.size() / CHUNK_SIZE, i);
+ }
+ if (false) remapTerminators(full_text, next_terminator);
+}
+
+/* Build longest-common-prefix based on suffix array and text.
+ TODO: borrowed -> unknown efficiency. */
+static void buildLcp(std::vector<TextChar>* text, std::vector<TextIdx>* sa,
+ std::vector<TextIdx>* lcp, std::vector<TextIdx>* invese_sa) {
+ TextIdx size = static_cast<TextIdx>(text->size());
+ lcp->resize(size);
+ TextIdx k = 0;
+ lcp->at(size - 1) = 0;
+ for (TextIdx i = 0; i < size; ++i) {
+ if (invese_sa->at(i) == size - 1) {
+ k = 0;
+ continue;
+ }
+ // Suffix which follow i-th suffix.
+ TextIdx j = sa->at(invese_sa->at(i) + 1);
+ while (i + k < size && j + k < size && text->at(i + k) == text->at(j + k)) {
+ ++k;
+ }
+ lcp->at(invese_sa->at(i)) = k;
+ if (k > 0) --k;
+ }
+}
+
+/* Isle is a range in SA with LCP not less than some value.
+ When we raise the LCP requirement, the isle sunks and smaller isles appear
+ instead. */
+typedef struct {
+ TextIdx lcp;
+ TextIdx l;
+ TextIdx r;
+ Coverage coverage;
+} Isle;
+
+/* Helper routine for `cutMatch`. */
+static void poisonData(TextIdx pos, TextIdx length,
+ std::vector<std::vector<TextChar>>* data, std::vector<TextIdx>* file_map,
+ std::vector<TextIdx>* file_offset, TextChar* next_terminator) {
+ TextIdx f = file_map->at(pos / CHUNK_SIZE);
+ pos -= file_offset->at(f);
+ std::vector<TextChar>& file = data->at(f);
+ TextIdx l = (length == CUT_MATCH) ? CUT_MATCH : 1;
+ for (TextIdx j = 0; j < l; j++, pos++) {
+ if (file[pos] >= 256) continue;
+ if (file[pos + 1] >= 256) {
+ file[pos] = file[pos + 1];
+ } else if (pos > 0 && file[pos - 1] >= 256) {
+ file[pos] = file[pos - 1];
+ } else {
+ file[pos] = (*next_terminator)++;
+ }
+ }
+}
+
+/* Remove substrings of a given match from files.
+ Substrings are replaced with unique terminators, so next iteration SA would
+ not allow to cross removed areas. */
+static void cutMatch(std::vector<std::vector<TextChar>>* data, TextIdx index,
+ TextIdx length, std::vector<TextIdx>* sa, std::vector<TextIdx>* lcp,
+ std::vector<TextIdx>* invese_sa, TextChar* next_terminator,
+ std::vector<TextIdx>* file_map, std::vector<TextIdx>* file_offset) {
+ while (length >= CUT_MATCH) {
+ TextIdx i = index;
+ while (lcp->at(i) >= length) {
+ i++;
+ poisonData(
+ sa->at(i), length, data, file_map, file_offset, next_terminator);
+ }
+ while (true) {
+ poisonData(
+ sa->at(index), length, data, file_map, file_offset, next_terminator);
+ if (index == 0 || lcp->at(index - 1) < length) break;
+ index--;
+ }
+ length--;
+ index = invese_sa->at(sa->at(index) + 1);
+ }
+}
+
+std::string DM_generate(size_t dictionary_size_limit,
+ const std::vector<size_t>& sample_sizes, const uint8_t* sample_data) {
+ {
+ TextIdx tmp = static_cast<TextIdx>(dictionary_size_limit);
+ if ((tmp != dictionary_size_limit) || (tmp > 1u << 30)) {
+ fprintf(stderr, "dictionary_size_limit is too large\n");
+ return "";
+ }
+ }
+
+ /* Could use 256 + '0' for easier debugging. */
+ TextChar next_terminator = 256;
+
+ std::string output;
+ std::vector<std::vector<TextChar>> data;
+
+ TextIdx offset = 0;
+ size_t num_samples = sample_sizes.size();
+ if (num_samples > DM_MAX_FILES) num_samples = DM_MAX_FILES;
+ for (size_t n = 0; n < num_samples; ++n) {
+ TextIdx delta = static_cast<TextIdx>(sample_sizes[n]);
+ if (delta != sample_sizes[n]) {
+ fprintf(stderr, "sample is too large\n");
+ return "";
+ }
+ if (delta == 0) {
+ fprintf(stderr, "0-length samples are prohibited\n");
+ return "";
+ }
+ TextIdx next_offset = offset + delta;
+ if (next_offset <= offset) {
+ fprintf(stderr, "corpus is too large\n");
+ return "";
+ }
+ data.push_back(
+ std::vector<TextChar>(sample_data + offset, sample_data + next_offset));
+ offset = next_offset;
+ data.back().push_back(next_terminator++);
+ }
+
+ /* Most arrays are allocated once, and then just resized to smaller and
+ smaller sizes. */
+ std::vector<TextChar> full_text;
+ std::vector<TextIdx> file_map;
+ std::vector<TextIdx> file_offset;
+ std::vector<TextIdx> sa;
+ std::vector<TextIdx> invese_sa;
+ std::vector<TextIdx> lcp;
+ std::vector<Isle> isles;
+ std::vector<char> output_data;
+ TextIdx total = 0;
+ TextIdx total_cost = 0;
+ TextIdx best_cost;
+ Isle best_isle;
+ size_t min_count = num_samples;
+
+ while (true) {
+ TextIdx max_match = static_cast<TextIdx>(dictionary_size_limit) - total;
+ buildFullText(&data, &full_text, &file_map, &file_offset, &next_terminator);
+ sa.resize(full_text.size());
+ /* Hopefully, non-negative TextSaIdx is the same sa TextIdx counterpart. */
+ saisxx(full_text.data(), reinterpret_cast<TextSaIdx*>(sa.data()),
+ static_cast<TextChar>(full_text.size()), next_terminator);
+ invese_sa.resize(full_text.size());
+ for (TextIdx i = 0; i < full_text.size(); ++i) {
+ invese_sa[sa[i]] = i;
+ }
+ buildLcp(&full_text, &sa, &lcp, &invese_sa);
+
+ /* Do not rebuild SA/LCP, just use different selection. */
+ retry:
+ best_cost = 0;
+ best_isle = {0, 0, 0, {{0}}};
+ isles.resize(0);
+ isles.push_back(best_isle);
+
+ for (TextIdx i = 0; i < lcp.size(); ++i) {
+ TextIdx l = i;
+ Coverage cov = {{0}};
+ size_t f = file_map[sa[i] / CHUNK_SIZE];
+ cov[f >> 6] = (static_cast<uint64_t>(1)) << (f & 63);
+ while (lcp[i] < isles.back().lcp) {
+ Isle& top = isles.back();
+ top.r = i;
+ l = top.l;
+ for (size_t x = 0; x < cov.size(); ++x) cov[x] |= top.coverage[x];
+ size_t count = 0;
+ for (size_t x = 0; x < cov.size(); ++x) count += popcount(cov[x]);
+ TextIdx effective_lcp = top.lcp;
+ /* Restrict (last) dictionary entry length. */
+ if (effective_lcp > max_match) effective_lcp = max_match;
+ TextIdx cost = count * effective_lcp;
+ if (cost > best_cost && count >= min_count &&
+ effective_lcp >= MIN_MATCH) {
+ best_cost = cost;
+ best_isle = top;
+ best_isle.lcp = effective_lcp;
+ }
+ isles.pop_back();
+ for (size_t x = 0; x < cov.size(); ++x) {
+ isles.back().coverage[x] |= cov[x];
+ }
+ }
+ if (lcp[i] > isles.back().lcp) isles.push_back({lcp[i], l, 0, {{0}}});
+ for (size_t x = 0; x < cov.size(); ++x) {
+ isles.back().coverage[x] |= cov[x];
+ }
+ }
+
+ /* When saturated matches do not match length restrictions, lower the
+ saturation requirements. */
+ if (best_cost == 0 || best_isle.lcp < MIN_MATCH) {
+ if (min_count >= 8) {
+ min_count = (min_count * 7) / 8;
+ fprintf(stderr, "Retry: min_count=%zu\n", min_count);
+ goto retry;
+ }
+ break;
+ }
+
+ /* Save the entry. */
+ fprintf(stderr, "Savings: %d+%d, dictionary: %d+%d\n",
+ total_cost, best_cost, total, best_isle.lcp);
+ int* piece = &full_text[sa[best_isle.l]];
+ output.insert(output.end(), piece, piece + best_isle.lcp);
+ total += best_isle.lcp;
+ total_cost += best_cost;
+ cutMatch(&data, best_isle.l, best_isle.lcp, &sa, &lcp, &invese_sa,
+ &next_terminator, &file_map, &file_offset);
+ if (total >= dictionary_size_limit) break;
+ }
+
+ return output;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/deorummolae.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/deorummolae.h
new file mode 100644
index 000000000..581509726
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/deorummolae.h
@@ -0,0 +1,26 @@
+#ifndef BROTLI_RESEARCH_DEORUMMOLAE_H_
+#define BROTLI_RESEARCH_DEORUMMOLAE_H_
+
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <vector>
+
+/* log2(maximal number of files). Value 6 provides some speedups. */
+#define DM_LOG_MAX_FILES 6
+
+/* Non tunable definitions. */
+#define DM_MAX_FILES (1 << DM_LOG_MAX_FILES)
+
+/**
+ * Generate a dictionary for given samples.
+ *
+ * @param dictionary_size_limit maximal dictionary size
+ * @param sample_sizes vector with sample sizes
+ * @param sample_data concatenated samples
+ * @return generated dictionary
+ */
+std::string DM_generate(size_t dictionary_size_limit,
+ const std::vector<size_t>& sample_sizes, const uint8_t* sample_data);
+
+#endif // BROTLI_RESEARCH_DEORUMMOLAE_H_
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/dictionary_generator.cc b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/dictionary_generator.cc
new file mode 100755
index 000000000..dcdf2fa12
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/dictionary_generator.cc
@@ -0,0 +1,326 @@
+#include <climits>
+#include <cstddef>
+#include <cstdio>
+#include <cstring>
+#include <fstream>
+#include <vector>
+
+#include "./deorummolae.h"
+#include "./durchschlag.h"
+#include "./sieve.h"
+
+/* This isn't a definitive list of "--foo" arguments, only those that take an
+ * additional "=#" integer parameter, like "--foo=20" or "--foo=32K".
+ */
+#define LONG_ARG_BLOCK_LEN "--block_len="
+#define LONG_ARG_SLICE_LEN "--slice_len="
+#define LONG_ARG_TARGET_DICT_LEN "--target_dict_len="
+#define LONG_ARG_MIN_SLICE_POP "--min_slice_pop="
+#define LONG_ARG_CHUNK_LEN "--chunk_len="
+#define LONG_ARG_OVERLAP_LEN "--overlap_len="
+
+#define METHOD_DM 0
+#define METHOD_SIEVE 1
+#define METHOD_DURCHSCHLAG 2
+#define METHOD_DISTILL 3
+#define METHOD_PURIFY 4
+
+static size_t readInt(const char* str) {
+ size_t result = 0;
+ if (str[0] == 0 || str[0] == '0') {
+ return 0;
+ }
+ for (size_t i = 0; i < 13; ++i) {
+ if (str[i] == 0) {
+ return result;
+ }
+ if (str[i] == 'k' || str[i] == 'K') {
+ if ((str[i + 1] == 0) && ((result << 10) > result)) {
+ return result << 10;
+ }
+ return 0;
+ }
+ if (str[i] == 'm' || str[i] == 'M') {
+ if ((str[i + 1] == 0) && ((result << 20) > result)) {
+ return result << 20;
+ }
+ return 0;
+ }
+ if (str[i] < '0' || str[i] > '9') {
+ return 0;
+ }
+ size_t next = (10 * result) + (str[i] - '0');
+ if (next <= result) {
+ return 0;
+ }
+ result = next;
+ }
+ return 0;
+}
+
+static std::string readFile(const std::string& path) {
+ std::ifstream file(path);
+ std::string content(
+ (std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
+ return content;
+}
+
+static void writeFile(const char* file, const std::string& content) {
+ std::ofstream outfile(file, std::ofstream::binary);
+ outfile.write(content.c_str(), static_cast<std::streamsize>(content.size()));
+ outfile.close();
+}
+
+static void writeSamples(char const* argv[], const std::vector<int>& pathArgs,
+ const std::vector<size_t>& sizes, const uint8_t* data) {
+ size_t offset = 0;
+ for (size_t i = 0; i < pathArgs.size(); ++i) {
+ int j = pathArgs[i];
+ const char* file = argv[j];
+ size_t sampleSize = sizes[i];
+ std::ofstream outfile(file, std::ofstream::binary);
+ outfile.write(reinterpret_cast<const char*>(data + offset),
+ static_cast<std::streamsize>(sampleSize));
+ outfile.close();
+ offset += sampleSize;
+ }
+}
+
+/* Returns "base file name" or its tail, if it contains '/' or '\'. */
+static const char* fileName(const char* path) {
+ const char* separator_position = strrchr(path, '/');
+ if (separator_position) path = separator_position + 1;
+ separator_position = strrchr(path, '\\');
+ if (separator_position) path = separator_position + 1;
+ return path;
+}
+
+static void printHelp(const char* name) {
+ fprintf(stderr, "Usage: %s [OPTION]... DICTIONARY [SAMPLE]...\n", name);
+ fprintf(stderr,
+ "Options:\n"
+ " --dm use 'deorummolae' engine\n"
+ " --distill rewrite samples; unique text parts are removed\n"
+ " --dsh use 'durchschlag' engine (default)\n"
+ " --purify rewrite samples; unique text parts are zeroed out\n"
+ " --sieve use 'sieve' engine\n"
+ " -b#, --block_len=#\n"
+ " set block length for 'durchschlag'; default: 1024\n"
+ " -s#, --slice_len=#\n"
+ " set slice length for 'distill', 'durchschlag', 'purify'\n"
+ " and 'sieve'; default: 16\n"
+ " -t#, --target_dict_len=#\n"
+ " set target dictionary length (limit); default: 16K\n"
+ " -u#, --min_slice_pop=#\n"
+ " set minimum slice population (for rewrites); default: 2\n"
+ " -c#, --chunk_len=#\n"
+ " if positive, samples are cut into chunks of this length;\n"
+ " default: 0; cannot mix with 'rewrite samples'\n"
+ " -o#, --overlap_len=#\n"
+ " set chunk overlap length; default 0\n"
+ "# is a decimal number with optional k/K/m/M suffix.\n"
+ "WARNING: 'distill' and 'purify' will overwrite original samples!\n"
+ " Completely unique samples might become empty files.\n\n");
+}
+
+int main(int argc, char const* argv[]) {
+ int dictionaryArg = -1;
+ int method = METHOD_DURCHSCHLAG;
+ size_t sliceLen = 16;
+ size_t targetSize = 16 << 10;
+ size_t blockSize = 1024;
+ size_t minimumPopulation = 2;
+ size_t chunkLen = 0;
+ size_t overlapLen = 0;
+
+ std::vector<uint8_t> data;
+ std::vector<size_t> sizes;
+ std::vector<int> pathArgs;
+ size_t total = 0;
+ for (int i = 1; i < argc; ++i) {
+ if (argv[i] == nullptr) {
+ continue;
+ }
+
+ if (argv[i][0] == '-') {
+ char arg1 = argv[i][1];
+ const char* arg2 = arg1 ? &argv[i][2] : nullptr;
+ if (arg1 == '-') {
+ if (dictionaryArg != -1) {
+ fprintf(stderr,
+ "Method should be specified before dictionary / sample '%s'\n",
+ argv[i]);
+ exit(1);
+ }
+
+ /* Look for "--long_arg" via exact match. */
+ if (std::strcmp(argv[i], "--sieve") == 0) {
+ method = METHOD_SIEVE;
+ continue;
+ }
+ if (std::strcmp(argv[i], "--dm") == 0) {
+ method = METHOD_DM;
+ continue;
+ }
+ if (std::strcmp(argv[i], "--dsh") == 0) {
+ method = METHOD_DURCHSCHLAG;
+ continue;
+ }
+ if (std::strcmp(argv[i], "--distill") == 0) {
+ method = METHOD_DISTILL;
+ continue;
+ }
+ if (std::strcmp(argv[i], "--purify") == 0) {
+ method = METHOD_PURIFY;
+ continue;
+ }
+
+ /* Look for "--long_arg=#" via prefix match. */
+ if (std::strncmp(argv[i], LONG_ARG_BLOCK_LEN,
+ std::strlen(LONG_ARG_BLOCK_LEN)) == 0) {
+ arg1 = 'b';
+ arg2 = &argv[i][std::strlen(LONG_ARG_BLOCK_LEN)];
+ } else if (std::strncmp(argv[i], LONG_ARG_SLICE_LEN,
+ std::strlen(LONG_ARG_SLICE_LEN)) == 0) {
+ arg1 = 's';
+ arg2 = &argv[i][std::strlen(LONG_ARG_SLICE_LEN)];
+ } else if (std::strncmp(argv[i], LONG_ARG_TARGET_DICT_LEN,
+ std::strlen(LONG_ARG_TARGET_DICT_LEN)) == 0) {
+ arg1 = 't';
+ arg2 = &argv[i][std::strlen(LONG_ARG_TARGET_DICT_LEN)];
+ } else if (std::strncmp(argv[i], LONG_ARG_MIN_SLICE_POP,
+ std::strlen(LONG_ARG_MIN_SLICE_POP)) == 0) {
+ arg1 = 'u';
+ arg2 = &argv[i][std::strlen(LONG_ARG_MIN_SLICE_POP)];
+ } else if (std::strncmp(argv[i], LONG_ARG_CHUNK_LEN,
+ std::strlen(LONG_ARG_CHUNK_LEN)) == 0) {
+ arg1 = 'c';
+ arg2 = &argv[i][std::strlen(LONG_ARG_CHUNK_LEN)];
+ } else if (std::strncmp(argv[i], LONG_ARG_OVERLAP_LEN,
+ std::strlen(LONG_ARG_OVERLAP_LEN)) == 0) {
+ arg1 = 'o';
+ arg2 = &argv[i][std::strlen(LONG_ARG_OVERLAP_LEN)];
+ } else {
+ printHelp(fileName(argv[0]));
+ fprintf(stderr, "Invalid option '%s'\n", argv[i]);
+ exit(1);
+ }
+ }
+
+ /* Look for "-f" short args or "--foo=#" long args. */
+ if (arg1 == 'b') {
+ blockSize = readInt(arg2);
+ if (blockSize < 16 || blockSize > 65536) {
+ printHelp(fileName(argv[0]));
+ fprintf(stderr, "Invalid option '%s'\n", argv[i]);
+ exit(1);
+ }
+ } else if (arg1 == 's') {
+ sliceLen = readInt(arg2);
+ if (sliceLen < 4 || sliceLen > 256) {
+ printHelp(fileName(argv[0]));
+ fprintf(stderr, "Invalid option '%s'\n", argv[i]);
+ exit(1);
+ }
+ } else if (arg1 == 't') {
+ targetSize = readInt(arg2);
+ if (targetSize < 256 || targetSize > (1 << 25)) {
+ printHelp(fileName(argv[0]));
+ fprintf(stderr, "Invalid option '%s'\n", argv[i]);
+ exit(1);
+ }
+ } else if (arg1 == 'u') {
+ minimumPopulation = readInt(arg2);
+ if (minimumPopulation < 256 || minimumPopulation > 65536) {
+ printHelp(fileName(argv[0]));
+ fprintf(stderr, "Invalid option '%s'\n", argv[i]);
+ exit(1);
+ }
+ } else if (arg1 == 'c') {
+ chunkLen = readInt(arg2);
+ if (chunkLen < 0 || chunkLen > INT_MAX) {
+ printHelp(fileName(argv[0]));
+ fprintf(stderr, "Invalid option '%s'\n", argv[i]);
+ exit(1);
+ }
+ } else if (arg1 == 'o') {
+ overlapLen = readInt(arg2);
+ if (overlapLen < 0 || overlapLen > INT_MAX) {
+ printHelp(fileName(argv[0]));
+ fprintf(stderr, "Invalid option '%s'\n", argv[i]);
+ exit(1);
+ }
+ } else {
+ printHelp(fileName(argv[0]));
+ fprintf(stderr, "Unrecognized option '%s'\n", argv[i]);
+ exit(1);
+ }
+ continue;
+ }
+
+ if (dictionaryArg == -1) {
+ if (method != METHOD_DISTILL && method != METHOD_PURIFY) {
+ dictionaryArg = i;
+ continue;
+ }
+ }
+
+ std::string content = readFile(argv[i]);
+ if (chunkLen == 0) {
+ pathArgs.push_back(i);
+ data.insert(data.end(), content.begin(), content.end());
+ total += content.size();
+ sizes.push_back(content.size());
+ continue;
+ } else if (chunkLen <= overlapLen) {
+ printHelp(fileName(argv[0]));
+ fprintf(stderr, "Invalid chunkLen - overlapLen combination\n");
+ exit(1);
+ }
+ for (size_t chunkStart = 0;
+ chunkStart < content.size();
+ chunkStart += chunkLen - overlapLen) {
+ std::string chunk = content.substr(chunkStart, chunkLen);
+ data.insert(data.end(), chunk.begin(), chunk.end());
+ total += chunk.size();
+ sizes.push_back(chunk.size());
+ }
+ }
+
+ bool wantDictionary = (dictionaryArg == -1);
+ if (method == METHOD_DISTILL || method == METHOD_PURIFY) {
+ wantDictionary = false;
+ if (chunkLen != 0) {
+ printHelp(fileName(argv[0]));
+ fprintf(stderr, "Cannot mix 'rewrite samples' with positive chunk_len\n");
+ exit(1);
+ }
+ }
+ if (wantDictionary || total == 0) {
+ printHelp(fileName(argv[0]));
+ fprintf(stderr, "Not enough arguments\n");
+ exit(1);
+ }
+
+ if (method == METHOD_SIEVE) {
+ writeFile(argv[dictionaryArg], sieve_generate(
+ targetSize, sliceLen, sizes, data.data()));
+ } else if (method == METHOD_DM) {
+ writeFile(argv[dictionaryArg], DM_generate(
+ targetSize, sizes, data.data()));
+ } else if (method == METHOD_DURCHSCHLAG) {
+ writeFile(argv[dictionaryArg], durchschlag_generate(
+ targetSize, sliceLen, blockSize, sizes, data.data()));
+ } else if (method == METHOD_DISTILL) {
+ durchschlag_distill(sliceLen, minimumPopulation, &sizes, data.data());
+ writeSamples(argv, pathArgs, sizes, data.data());
+ } else if (method == METHOD_PURIFY) {
+ durchschlag_purify(sliceLen, minimumPopulation, sizes, data.data());
+ writeSamples(argv, pathArgs, sizes, data.data());
+ } else {
+ printHelp(fileName(argv[0]));
+ fprintf(stderr, "Unknown generator\n");
+ exit(1);
+ }
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/draw_diff.cc b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/draw_diff.cc
new file mode 100644
index 000000000..1a5286960
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/draw_diff.cc
@@ -0,0 +1,117 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+ Author: zip753@gmail.com (Ivan Nikulin)
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Tool for drawing diff PPM images between two input PGM images. Normally used
+ with backward reference histogram drawing tool. */
+
+#include <algorithm>
+#include <cassert>
+#include <cmath>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib> /* exit, EXIT_FAILURE */
+#include <vector>
+
+#if !defined(CHECK)
+#define CHECK(X) if (!(X)) exit(EXIT_FAILURE);
+#endif
+
+typedef uint8_t* ScanLine;
+typedef ScanLine* Image;
+
+void ReadPGM(FILE* f, Image* image, size_t* height, size_t* width) {
+ int colors;
+ CHECK(fscanf(f, "P5\n%lu %lu\n%d\n", width, height, &colors) == 3);
+ assert(colors == 255);
+ ScanLine* lines = new ScanLine[*height];
+ *image = lines;
+ for (int i = *height - 1; i >= 0; --i) {
+ ScanLine line = new uint8_t[*width];
+ lines[i] = line;
+ CHECK(fread(line, 1, *width, f) == *width);
+ }
+}
+
+void CalculateDiff(int** diff, Image image1, Image image2,
+ size_t height, size_t width) {
+ for (size_t i = 0; i < height; ++i) {
+ for (size_t j = 0; j < width; ++j) {
+ diff[i][j] = static_cast<int>(image1[i][j]) - image2[i][j];
+ }
+ }
+}
+
+void DrawDiff(int** diff, Image image1, Image image2,
+ size_t height, size_t width, FILE* f) {
+ int max = -1234;
+ int min = +1234;
+ for (size_t i = 0; i < height; ++i) {
+ for (size_t j = 0; j < width; ++j) {
+ if (max < diff[i][j]) max = diff[i][j];
+ if (min > diff[i][j]) min = diff[i][j];
+ int img_min = std::min(255 - image1[i][j], 255 - image2[i][j]);
+ if (max < img_min) max = img_min;
+ }
+ }
+
+ int abs_max = -min;
+ if (abs_max < max) abs_max = max;
+
+ fprintf(f, "P6\n%lu %lu\n%d\n", width, height, abs_max);
+
+ uint8_t* row = new uint8_t[3 * width];
+ for (int i = height - 1; i >= 0; --i) {
+ for (int j = 0; j < width; ++j) {
+ int min_val = std::min(255 - image1[i][j], 255 - image2[i][j]);
+ int max_val = std::max(min_val, abs(diff[i][j]));
+ if (diff[i][j] > 0) { /* red */
+ row[3 * j + 0] = abs_max - max_val + diff[i][j];
+ row[3 * j + 1] = abs_max - max_val;
+ row[3 * j + 2] = abs_max - max_val + min_val;
+ } else { /* green */
+ row[3 * j + 0] = abs_max - max_val;
+ row[3 * j + 1] = abs_max - max_val - diff[i][j];
+ row[3 * j + 2] = abs_max - max_val + min_val;
+ }
+ }
+ fwrite(row, 1, 3 * width, f);
+ }
+ delete[] row;
+}
+
+int main(int argc, char** argv) {
+ if (argc != 4) {
+ printf("usage: %s pgm1 pgm2 diff_ppm_path\n", argv[0]);
+ return 1;
+ }
+
+ Image image1, image2;
+ size_t h1, w1, h2, w2;
+
+ FILE* fimage1 = fopen(argv[1], "rb");
+ ReadPGM(fimage1, &image1, &h1, &w1);
+ fclose(fimage1);
+
+ FILE* fimage2 = fopen(argv[2], "rb");
+ ReadPGM(fimage2, &image2, &h2, &w2);
+ fclose(fimage2);
+
+ if (!(h1 == h2 && w1 == w2)) {
+ printf("Images must have the same size.\n");
+ return 1;
+ }
+
+ int** diff = new int*[h1];
+ for (size_t i = 0; i < h1; ++i) diff[i] = new int[w1];
+ CalculateDiff(diff, image1, image2, h1, w1);
+
+ FILE* fdiff = fopen(argv[3], "wb");
+ DrawDiff(diff, image1, image2, h1, w1, fdiff);
+ fclose(fdiff);
+
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/draw_histogram.cc b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/draw_histogram.cc
new file mode 100644
index 000000000..b0192a217
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/draw_histogram.cc
@@ -0,0 +1,197 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+ Author: zip753@gmail.com (Ivan Nikulin)
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Backward reference visualization tool. Accepts file with backward references
+ as an input and produces PGM image with histogram of those references. */
+
+#include <algorithm> /* min */
+#include <cassert>
+#include <cstring> /* memset */
+#include <cmath> /* log, round */
+#include <cstdio> /* fscanf, fprintf */
+#include <cstdint>
+
+#include <gflags/gflags.h>
+using gflags::ParseCommandLineFlags;
+
+#include "./read_dist.h"
+
+DEFINE_int32(height, 1000, "Height of the resulting histogam.");
+DEFINE_int32(width, 8000, "Width of the resulting histogam.");
+DEFINE_int32(size, 1e8, "Size of the compressed file.");
+DEFINE_int32(brotli_window, -1, "Size of brotli window in bits.");
+DEFINE_uint64(min_distance, 0, "Minimum distance.");
+DEFINE_uint64(max_distance, 1 << 30, "Maximum distance.");
+DEFINE_bool(with_copies, false, "True if input contains copy length.");
+DEFINE_bool(simple, false, "True if using only black and white pixels.");
+DEFINE_bool(linear, false, "True if using linear distance mapping.");
+DEFINE_uint64(skip, 0, "Number of bytes to skip.");
+
+inline double DistanceTransform(double x) {
+ static bool linear = FLAGS_linear;
+ if (linear) {
+ return x;
+ } else {
+ /* Using log^2 scale because log scale produces big white gap at the bottom
+ of image. */
+ return log(x) * log(x);
+ }
+}
+
+/* Mapping pixel density on arc function to increase contrast. */
+inline double DensityTransform(double x) {
+ double z = 255 - x;
+ return sqrt(255 * 255 - z * z);
+}
+
+inline int GetMaxDistance() {
+ return FLAGS_max_distance;
+}
+
+void AdjustPosition(int* pos) {
+ static uint32_t offset = 0;
+ static int last = 0;
+ static uint32_t window_size = (1 << FLAGS_brotli_window);
+ assert(*pos >= 0 && *pos < window_size);
+ if (*pos < last) {
+ offset += window_size;
+ }
+ last = *pos;
+ *pos += offset;
+}
+
+void BuildHistogram(FILE* fin, int** histo) {
+ int height = FLAGS_height;
+ int width = FLAGS_width;
+ int skip = FLAGS_skip;
+ size_t min_distance = FLAGS_min_distance;
+
+ printf("height = %d, width = %d\n", height, width);
+
+ for (int i = 0; i < height; i++) {
+ for (int j = 0; j < width; j++) {
+ histo[i][j] = 0;
+ }
+ }
+
+ int max_pos = FLAGS_size - skip;
+ double min_dist = min_distance > 0 ? DistanceTransform(min_distance) : 0;
+ double max_dist = DistanceTransform(GetMaxDistance()) - min_dist;
+ int copy, pos, distance, x, y;
+ double dist;
+ while (ReadBackwardReference(fin, &copy, &pos, &distance)) {
+ if (pos == -1) continue; // In case when only insert is present.
+ if (distance < min_distance || distance >= GetMaxDistance()) continue;
+ if (FLAGS_brotli_window != -1) {
+ AdjustPosition(&pos);
+ }
+ if (pos >= skip && distance <= pos) {
+ pos -= skip;
+ if (pos >= max_pos) break;
+ dist = DistanceTransform(static_cast<double>(distance)) - min_dist;
+
+ x = std::min(static_cast<int>(round(dist / max_dist * height)),
+ height - 1);
+ y = 1ul * pos * width / max_pos;
+ if (!(y >= 0 && y < width)) {
+ printf("pos = %d, max_pos = %d, y = %d\n", pos, max_pos, y);
+ assert(y >= 0 && y < width);
+ }
+
+ if (FLAGS_with_copies) {
+ int right = 1ul * (pos + copy - 1) * width / max_pos;
+ if (right < 0) {
+ printf("pos = %d, distance = %d, copy = %d, y = %d, right = %d\n",
+ pos, distance, copy, y, right);
+ assert(right >= 0);
+ }
+ if (y == right) {
+ histo[x][y] += copy;
+ } else {
+ int pos2 = static_cast<int>(ceil(1.0 * (y + 1) * max_pos / width));
+ histo[x][y] += pos2 - pos;
+ for (int i = y + 1; i < right && i < width; ++i) {
+ histo[x][i] += max_pos / width; // Sometimes 1 more, but who cares.
+ }
+ // Make sure the match doesn't go beyond the image.
+ if (right < width) {
+ pos2 = static_cast<int>(ceil(1.0 * right * max_pos / width));
+ histo[x][right] += pos + copy - 1 - pos2 + 1;
+ }
+ }
+ } else {
+ histo[x][y]++;
+ }
+ }
+ }
+}
+
+void ConvertToPixels(int** histo, uint8_t** pixel) {
+ int height = FLAGS_height;
+ int width = FLAGS_width;
+
+ int maxs = 0;
+ for (int i = 0; i < height; i++) {
+ for (int j = 0; j < width; j++) {
+ if (maxs < histo[i][j]) maxs = histo[i][j];
+ }
+ }
+
+ bool simple = FLAGS_simple;
+ double max_histo = static_cast<double>(maxs);
+ for (int i = 0; i < height; i++) {
+ for (int j = 0; j < width; j++) {
+ if (simple) {
+ pixel[i][j] = histo[i][j] > 0 ? 0 : 255;
+ } else {
+ pixel[i][j] = static_cast<uint8_t>(
+ 255 - DensityTransform(histo[i][j] / max_histo * 255));
+ }
+ }
+ }
+}
+
+void DrawPixels(uint8_t** pixel, FILE* fout) {
+ int height = FLAGS_height;
+ int width = FLAGS_width;
+
+ fprintf(fout, "P5\n%d %d\n255\n", width, height);
+ for (int i = height - 1; i >= 0; i--) {
+ fwrite(pixel[i], 1, width, fout);
+ }
+}
+
+int main(int argc, char* argv[]) {
+ ParseCommandLineFlags(&argc, &argv, true);
+ if (argc != 3) {
+ printf("usage: draw_histogram.cc data output_file\n");
+ return 1;
+ }
+
+ int height = FLAGS_height;
+ int width = FLAGS_width;
+
+ FILE* fin = fopen(argv[1], "r");
+ FILE* fout = fopen(argv[2], "wb");
+
+ uint8_t** pixel = new uint8_t*[height];
+ int** histo = new int*[height];
+ for (int i = 0; i < height; i++) {
+ pixel[i] = new uint8_t[width];
+ histo[i] = new int[width];
+ }
+
+ BuildHistogram(fin, histo);
+ fclose(fin);
+
+ ConvertToPixels(histo, pixel);
+
+ DrawPixels(pixel, fout);
+ fclose(fout);
+
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/durchschlag.cc b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/durchschlag.cc
new file mode 100755
index 000000000..2fbf41b58
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/durchschlag.cc
@@ -0,0 +1,726 @@
+#include "./durchschlag.h"
+
+#include <algorithm>
+#include <exception> /* terminate */
+
+#include "divsufsort.h"
+
+/* Pointer to position in text. */
+typedef DurchschlagTextIdx TextIdx;
+
+/* (Sum of) value(s) of slice(s). */
+typedef uint32_t Score;
+
+typedef struct HashSlot {
+ TextIdx next;
+ TextIdx offset;
+} HashSlot;
+
+typedef struct MetaSlot {
+ TextIdx mark;
+ Score score;
+} MetaSlot;
+
+typedef struct Range {
+ TextIdx start;
+ TextIdx end;
+} Range;
+
+typedef struct Candidate {
+ Score score;
+ TextIdx position;
+} Candidate;
+
+struct greaterScore {
+ bool operator()(const Candidate& a, const Candidate& b) const {
+ return (a.score > b.score) ||
+ ((a.score == b.score) && (a.position < b.position));
+ }
+};
+
+struct lessScore {
+ bool operator()(const Candidate& a, const Candidate& b) const {
+ return (a.score < b.score) ||
+ ((a.score == b.score) && (a.position > b.position));
+ }
+};
+
+#define CANDIDATE_BUNDLE_SIZE (1 << 18)
+
+static void fatal(const char* error) {
+ fprintf(stderr, "%s\n", error);
+ std::terminate();
+}
+
+static TextIdx calculateDictionarySize(const std::vector<Range>& ranges) {
+ TextIdx result = 0;
+ for (size_t i = 0; i < ranges.size(); ++i) {
+ const Range& r = ranges[i];
+ result += r.end - r.start;
+ }
+ return result;
+}
+
+static std::string createDictionary(
+ const uint8_t* data, const std::vector<Range>& ranges, size_t limit) {
+ std::string output;
+ output.reserve(calculateDictionarySize(ranges));
+ for (size_t i = 0; i < ranges.size(); ++i) {
+ const Range& r = ranges[i];
+ output.insert(output.end(), &data[r.start], &data[r.end]);
+ }
+ if (output.size() > limit) {
+ output.resize(limit);
+ }
+ return output;
+}
+
+/* precondition: span > 0
+ precondition: end + span == len(shortcut) */
+static Score buildCandidatesList(std::vector<Candidate>* candidates,
+ std::vector<MetaSlot>* map, TextIdx span, const TextIdx* shortcut,
+ TextIdx end) {
+ candidates->resize(0);
+
+ size_t n = map->size();
+ MetaSlot* slots = map->data();
+ for (size_t j = 0; j < n; ++j) {
+ slots[j].mark = 0;
+ }
+
+ Score score = 0;
+ /* Consider the whole span, except one last item. The following loop will
+ add the last item to the end of the "chain", evaluate it, and cut one
+ "link" form the beginning. */
+ for (size_t j = 0; j < span - 1; ++j) {
+ MetaSlot& item = slots[shortcut[j]];
+ if (item.mark == 0) {
+ score += item.score;
+ }
+ item.mark++;
+ }
+
+ TextIdx i = 0;
+ TextIdx limit = std::min<TextIdx>(end, CANDIDATE_BUNDLE_SIZE);
+ Score maxScore = 0;
+ for (; i < limit; ++i) {
+ TextIdx slice = shortcut[i + span - 1];
+ MetaSlot& pick = slots[slice];
+ if (pick.mark == 0) {
+ score += pick.score;
+ }
+ pick.mark++;
+
+ if (score > maxScore) {
+ maxScore = score;
+ }
+ candidates->push_back({score, i});
+
+ MetaSlot& drop = slots[shortcut[i]];
+ drop.mark--;
+ if (drop.mark == 0) {
+ score -= drop.score;
+ }
+ }
+
+ std::make_heap(candidates->begin(), candidates->end(), greaterScore());
+ Score minScore = candidates->at(0).score;
+ for (; i < end; ++i) {
+ TextIdx slice = shortcut[i + span - 1];
+ MetaSlot& pick = slots[slice];
+ if (pick.mark == 0) {
+ score += pick.score;
+ }
+ pick.mark++;
+
+ if (score > maxScore) {
+ maxScore = score;
+ }
+ if (score >= minScore) {
+ candidates->push_back({score, i});
+ std::push_heap(candidates->begin(), candidates->end(), greaterScore());
+ if (candidates->size() > CANDIDATE_BUNDLE_SIZE && maxScore != minScore) {
+ while (candidates->at(0).score == minScore) {
+ std::pop_heap(candidates->begin(), candidates->end(), greaterScore());
+ candidates->pop_back();
+ }
+ minScore = candidates->at(0).score;
+ }
+ }
+
+ MetaSlot& drop = slots[shortcut[i]];
+ drop.mark--;
+ if (drop.mark == 0) {
+ score -= drop.score;
+ }
+ }
+
+ for (size_t j = 0; j < n; ++j) {
+ slots[j].mark = 0;
+ }
+
+ std::make_heap(candidates->begin(), candidates->end(), lessScore());
+ return minScore;
+}
+
+/* precondition: span > 0
+ precondition: end + span == len(shortcut) */
+static Score rebuildCandidatesList(std::vector<TextIdx>* candidates,
+ std::vector<MetaSlot>* map, TextIdx span, const TextIdx* shortcut,
+ TextIdx end, TextIdx* next) {
+ size_t n = candidates->size();
+ TextIdx* data = candidates->data();
+ for (size_t i = 0; i < n; ++i) {
+ data[i] = 0;
+ }
+
+ n = map->size();
+ MetaSlot* slots = map->data();
+ for (size_t i = 0; i < n; ++i) {
+ slots[i].mark = 0;
+ }
+
+ Score score = 0;
+ /* Consider the whole span, except one last item. The following loop will
+ add the last item to the end of the "chain", evaluate it, and cut one
+ "link" form the beginning. */
+ for (TextIdx i = 0; i < span - 1; ++i) {
+ MetaSlot& item = slots[shortcut[i]];
+ if (item.mark == 0) {
+ score += item.score;
+ }
+ item.mark++;
+ }
+
+ Score maxScore = 0;
+ for (TextIdx i = 0; i < end; ++i) {
+ MetaSlot& pick = slots[shortcut[i + span - 1]];
+ if (pick.mark == 0) {
+ score += pick.score;
+ }
+ pick.mark++;
+
+ if (candidates->size() <= score) {
+ candidates->resize(score + 1);
+ }
+ if (score > maxScore) {
+ maxScore = score;
+ }
+ next[i] = candidates->at(score);
+ candidates->at(score) = i;
+
+ MetaSlot& drop = slots[shortcut[i]];
+ drop.mark--;
+ if (drop.mark == 0) {
+ score -= drop.score;
+ }
+ }
+
+ for (size_t i = 0; i < n; ++i) {
+ slots[i].mark = 0;
+ }
+
+ candidates->resize(maxScore + 1);
+ return maxScore;
+}
+
+static void addRange(std::vector<Range>* ranges, TextIdx start, TextIdx end) {
+ for (auto it = ranges->begin(); it != ranges->end();) {
+ if (end < it->start) {
+ ranges->insert(it, {start, end});
+ return;
+ }
+ if (it->end < start) {
+ it++;
+ continue;
+ }
+ // Combine with existing.
+ start = std::min(start, it->start);
+ end = std::max(end, it->end);
+ // Remove consumed vector and continue.
+ it = ranges->erase(it);
+ }
+ ranges->push_back({start, end});
+}
+
+std::string durchschlag_generate(
+ size_t dictionary_size_limit, size_t slice_len, size_t block_len,
+ const std::vector<size_t>& sample_sizes, const uint8_t* sample_data) {
+ DurchschlagContext ctx = durchschlag_prepare(
+ slice_len, sample_sizes, sample_data);
+ return durchschlag_generate(DURCHSCHLAG_COLLABORATIVE,
+ dictionary_size_limit, block_len, ctx, sample_data);
+}
+
+DurchschlagContext durchschlag_prepare(size_t slice_len,
+ const std::vector<size_t>& sample_sizes, const uint8_t* sample_data) {
+ /* Parameters aliasing */
+ TextIdx sliceLen = static_cast<TextIdx>(slice_len);
+ if (sliceLen != slice_len) fatal("slice_len is too large");
+ if (sliceLen < 1) fatal("slice_len is too small");
+ const uint8_t* data = sample_data;
+
+ TextIdx total = 0;
+ std::vector<TextIdx> offsets;
+ offsets.reserve(sample_sizes.size());
+ for (size_t i = 0; i < sample_sizes.size(); ++i) {
+ TextIdx delta = static_cast<TextIdx>(sample_sizes[i]);
+ if (delta != sample_sizes[i]) fatal("sample is too large");
+ if (delta == 0) fatal("0-length samples are prohibited");
+ TextIdx next_total = total + delta;
+ if (next_total <= total) fatal("corpus is too large");
+ total = next_total;
+ offsets.push_back(total);
+ }
+
+ if (total < sliceLen) fatal("slice_len is larger than corpus size");
+ TextIdx end = total - static_cast<TextIdx>(sliceLen) + 1;
+ TextIdx hashLen = 11;
+ while (hashLen < 29 && ((1u << hashLen) < end)) {
+ hashLen += 3;
+ }
+ hashLen -= 3;
+ TextIdx hashMask = (1u << hashLen) - 1u;
+ std::vector<TextIdx> hashHead(1 << hashLen);
+ TextIdx hash = 0;
+ TextIdx lShift = 3;
+ TextIdx rShift = hashLen - lShift;
+ for (TextIdx i = 0; i < sliceLen - 1; ++i) {
+ TextIdx v = data[i];
+ hash = (((hash << lShift) | (hash >> rShift)) & hashMask) ^ v;
+ }
+ TextIdx lShiftX = (lShift * (sliceLen - 1)) % hashLen;
+ TextIdx rShiftX = hashLen - lShiftX;
+
+ std::vector<HashSlot> map;
+ map.push_back({0, 0});
+ TextIdx hashSlot = 1;
+ std::vector<TextIdx> sliceMap;
+ sliceMap.reserve(end);
+ for (TextIdx i = 0; i < end; ++i) {
+ TextIdx v = data[i + sliceLen - 1];
+ TextIdx bucket = (((hash << lShift) | (hash >> rShift)) & hashMask) ^ v;
+ v = data[i];
+ hash = bucket ^ (((v << lShiftX) | (v >> rShiftX)) & hashMask);
+ TextIdx slot = hashHead[bucket];
+ while (slot != 0) {
+ HashSlot& item = map[slot];
+ TextIdx start = item.offset;
+ bool miss = false;
+ for (TextIdx j = 0; j < sliceLen; ++j) {
+ if (data[i + j] != data[start + j]) {
+ miss = true;
+ break;
+ }
+ }
+ if (!miss) {
+ sliceMap.push_back(slot);
+ break;
+ }
+ slot = item.next;
+ }
+ if (slot == 0) {
+ map.push_back({hashHead[bucket], i});
+ hashHead[bucket] = hashSlot;
+ sliceMap.push_back(hashSlot);
+ hashSlot++;
+ }
+ }
+
+ return {total, sliceLen, static_cast<TextIdx>(map.size()),
+ std::move(offsets), std::move(sliceMap)};
+}
+
+DurchschlagContext durchschlag_prepare(size_t slice_len,
+ const std::vector<size_t>& sample_sizes, const DurchschlagIndex& index) {
+ /* Parameters aliasing */
+ TextIdx sliceLen = static_cast<TextIdx>(slice_len);
+ if (sliceLen != slice_len) fatal("slice_len is too large");
+ if (sliceLen < 1) fatal("slice_len is too small");
+ const TextIdx* lcp = index.lcp.data();
+ const TextIdx* sa = index.sa.data();
+
+ TextIdx total = 0;
+ std::vector<TextIdx> offsets;
+ offsets.reserve(sample_sizes.size());
+ for (size_t i = 0; i < sample_sizes.size(); ++i) {
+ TextIdx delta = static_cast<TextIdx>(sample_sizes[i]);
+ if (delta != sample_sizes[i]) fatal("sample is too large");
+ if (delta == 0) fatal("0-length samples are prohibited");
+ TextIdx next_total = total + delta;
+ if (next_total <= total) fatal("corpus is too large");
+ total = next_total;
+ offsets.push_back(total);
+ }
+
+ if (total < sliceLen) fatal("slice_len is larger than corpus size");
+ TextIdx counter = 1;
+ TextIdx end = total - sliceLen + 1;
+ std::vector<TextIdx> sliceMap(total);
+ TextIdx last = 0;
+ TextIdx current = 1;
+ while (current <= total) {
+ if (lcp[current - 1] < sliceLen) {
+ for (TextIdx i = last; i < current; ++i) {
+ sliceMap[sa[i]] = counter;
+ }
+ counter++;
+ last = current;
+ }
+ current++;
+ }
+ sliceMap.resize(end);
+
+ // Reorder items for the better locality.
+ std::vector<TextIdx> reorder(counter);
+ counter = 1;
+ for (TextIdx i = 0; i < end; ++i) {
+ if (reorder[sliceMap[i]] == 0) {
+ reorder[sliceMap[i]] = counter++;
+ }
+ }
+ for (TextIdx i = 0; i < end; ++i) {
+ sliceMap[i] = reorder[sliceMap[i]];
+ }
+
+ return {total, sliceLen, counter, std::move(offsets), std::move(sliceMap)};
+}
+
+DurchschlagIndex durchschlag_index(const std::vector<uint8_t>& data) {
+ TextIdx total = static_cast<TextIdx>(data.size());
+ if (total != data.size()) fatal("corpus is too large");
+ saidx_t saTotal = static_cast<saidx_t>(total);
+ if (saTotal < 0) fatal("corpus is too large");
+ if (static_cast<TextIdx>(saTotal) != total) fatal("corpus is too large");
+ std::vector<TextIdx> sa(total);
+ /* Hopefully, non-negative int32_t values match TextIdx ones. */
+ if (sizeof(TextIdx) != sizeof(int32_t)) fatal("type length mismatch");
+ int32_t* saData = reinterpret_cast<int32_t*>(sa.data());
+ divsufsort(data.data(), saData, saTotal);
+
+ std::vector<TextIdx> isa(total);
+ for (TextIdx i = 0; i < total; ++i) isa[sa[i]] = i;
+
+ // TODO: borrowed -> unknown efficiency.
+ std::vector<TextIdx> lcp(total);
+ TextIdx k = 0;
+ lcp[total - 1] = 0;
+ for (TextIdx i = 0; i < total; ++i) {
+ TextIdx current = isa[i];
+ if (current == total - 1) {
+ k = 0;
+ continue;
+ }
+ TextIdx j = sa[current + 1]; // Suffix which follow i-th suffix.
+ while ((i + k < total) && (j + k < total) && (data[i + k] == data[j + k])) {
+ ++k;
+ }
+ lcp[current] = k;
+ if (k > 0) --k;
+ }
+
+ return {std::move(lcp), std::move(sa)};
+}
+
+static void ScoreSlices(const std::vector<TextIdx>& offsets,
+ std::vector<MetaSlot>& map, const TextIdx* shortcut, TextIdx end) {
+ TextIdx piece = 0;
+ /* Fresh map contains all zeroes -> initial mark should be different. */
+ TextIdx mark = 1;
+ for (TextIdx i = 0; i < end; ++i) {
+ if (offsets[piece] == i) {
+ piece++;
+ mark++;
+ }
+ MetaSlot& item = map[shortcut[i]];
+ if (item.mark != mark) {
+ item.mark = mark;
+ item.score++;
+ }
+ }
+}
+
+static std::string durchschlagGenerateExclusive(
+ size_t dictionary_size_limit, size_t block_len,
+ const DurchschlagContext& context, const uint8_t* sample_data) {
+ /* Parameters aliasing */
+ TextIdx targetSize = static_cast<TextIdx>(dictionary_size_limit);
+ if (targetSize != dictionary_size_limit) {
+ fprintf(stderr, "dictionary_size_limit is too large\n");
+ return "";
+ }
+ TextIdx sliceLen = context.sliceLen;
+ TextIdx total = context.dataSize;
+ TextIdx blockLen = static_cast<TextIdx>(block_len);
+ if (blockLen != block_len) {
+ fprintf(stderr, "block_len is too large\n");
+ return "";
+ }
+ const uint8_t* data = sample_data;
+ const std::vector<TextIdx>& offsets = context.offsets;
+ std::vector<MetaSlot> map(context.numUniqueSlices);
+ const TextIdx* shortcut = context.sliceMap.data();
+
+ /* Initialization */
+ if (blockLen < sliceLen) {
+ fprintf(stderr, "sliceLen is larger than block_len\n");
+ return "";
+ }
+ if (targetSize < blockLen || total < blockLen) {
+ fprintf(stderr, "block_len is too large\n");
+ return "";
+ }
+ TextIdx end = total - sliceLen + 1;
+ ScoreSlices(offsets, map, shortcut, end);
+ TextIdx span = blockLen - sliceLen + 1;
+ end = static_cast<TextIdx>(context.sliceMap.size()) - span;
+ std::vector<TextIdx> candidates;
+ std::vector<TextIdx> next(end);
+ Score maxScore = rebuildCandidatesList(
+ &candidates, &map, span, shortcut, end, next.data());
+
+ /* Block selection */
+ const size_t triesLimit = (600 * 1000000) / span;
+ const size_t candidatesLimit = (150 * 1000000) / span;
+ std::vector<Range> ranges;
+ TextIdx mark = 0;
+ size_t numTries = 0;
+ while (true) {
+ TextIdx dictSize = calculateDictionarySize(ranges);
+ size_t numCandidates = 0;
+ if (dictSize > targetSize - blockLen) {
+ break;
+ }
+ if (maxScore == 0) {
+ break;
+ }
+ while (true) {
+ TextIdx candidate = 0;
+ while (maxScore > 0) {
+ if (candidates[maxScore] != 0) {
+ candidate = candidates[maxScore];
+ candidates[maxScore] = next[candidate];
+ break;
+ }
+ maxScore--;
+ }
+ if (maxScore == 0) {
+ break;
+ }
+ mark++;
+ numTries++;
+ numCandidates++;
+ Score score = 0;
+ for (size_t j = candidate; j < candidate + span; ++j) {
+ MetaSlot& item = map[shortcut[j]];
+ if (item.mark != mark) {
+ score += item.score;
+ item.mark = mark;
+ }
+ }
+ if (score < maxScore) {
+ if (numTries < triesLimit && numCandidates < candidatesLimit) {
+ next[candidate] = candidates[score];
+ candidates[score] = candidate;
+ } else {
+ maxScore = rebuildCandidatesList(
+ &candidates, &map, span, shortcut, end, next.data());
+ mark = 0;
+ numTries = 0;
+ numCandidates = 0;
+ }
+ continue;
+ } else if (score > maxScore) {
+ fprintf(stderr, "Broken invariant\n");
+ return "";
+ }
+ for (TextIdx j = candidate; j < candidate + span; ++j) {
+ MetaSlot& item = map[shortcut[j]];
+ item.score = 0;
+ }
+ addRange(&ranges, candidate, candidate + blockLen);
+ break;
+ }
+ }
+
+ return createDictionary(data, ranges, targetSize);
+}
+
+static std::string durchschlagGenerateCollaborative(
+ size_t dictionary_size_limit, size_t block_len,
+ const DurchschlagContext& context, const uint8_t* sample_data) {
+ /* Parameters aliasing */
+ TextIdx targetSize = static_cast<TextIdx>(dictionary_size_limit);
+ if (targetSize != dictionary_size_limit) {
+ fprintf(stderr, "dictionary_size_limit is too large\n");
+ return "";
+ }
+ TextIdx sliceLen = context.sliceLen;
+ TextIdx total = context.dataSize;
+ TextIdx blockLen = static_cast<TextIdx>(block_len);
+ if (blockLen != block_len) {
+ fprintf(stderr, "block_len is too large\n");
+ return "";
+ }
+ const uint8_t* data = sample_data;
+ const std::vector<TextIdx>& offsets = context.offsets;
+ std::vector<MetaSlot> map(context.numUniqueSlices);
+ const TextIdx* shortcut = context.sliceMap.data();
+
+ /* Initialization */
+ if (blockLen < sliceLen) {
+ fprintf(stderr, "sliceLen is larger than block_len\n");
+ return "";
+ }
+ if (targetSize < blockLen || total < blockLen) {
+ fprintf(stderr, "block_len is too large\n");
+ return "";
+ }
+ TextIdx end = total - sliceLen + 1;
+ ScoreSlices(offsets, map, shortcut, end);
+ TextIdx span = blockLen - sliceLen + 1;
+ end = static_cast<TextIdx>(context.sliceMap.size()) - span;
+ std::vector<Candidate> candidates;
+ candidates.reserve(CANDIDATE_BUNDLE_SIZE + 1024);
+ Score minScore = buildCandidatesList(&candidates, &map, span, shortcut, end);
+
+ /* Block selection */
+ std::vector<Range> ranges;
+ TextIdx mark = 0;
+ while (true) {
+ TextIdx dictSize = calculateDictionarySize(ranges);
+ if (dictSize > targetSize - blockLen) {
+ break;
+ }
+ if (minScore == 0 && candidates.empty()) {
+ break;
+ }
+ while (true) {
+ if (candidates.empty()) {
+ minScore = buildCandidatesList(&candidates, &map, span, shortcut, end);
+ mark = 0;
+ }
+ TextIdx candidate = candidates[0].position;
+ Score expectedScore = candidates[0].score;
+ if (expectedScore == 0) {
+ candidates.resize(0);
+ break;
+ }
+ std::pop_heap(candidates.begin(), candidates.end(), lessScore());
+ candidates.pop_back();
+ mark++;
+ Score score = 0;
+ for (TextIdx j = candidate; j < candidate + span; ++j) {
+ MetaSlot& item = map[shortcut[j]];
+ if (item.mark != mark) {
+ score += item.score;
+ item.mark = mark;
+ }
+ }
+ if (score < expectedScore) {
+ if (score >= minScore) {
+ candidates.push_back({score, candidate});
+ std::push_heap(candidates.begin(), candidates.end(), lessScore());
+ }
+ continue;
+ } else if (score > expectedScore) {
+ fatal("Broken invariant");
+ }
+ for (TextIdx j = candidate; j < candidate + span; ++j) {
+ MetaSlot& item = map[shortcut[j]];
+ item.score = 0;
+ }
+ addRange(&ranges, candidate, candidate + blockLen);
+ break;
+ }
+ }
+
+ return createDictionary(data, ranges, targetSize);
+}
+
+std::string durchschlag_generate(DurchschalgResourceStrategy strategy,
+ size_t dictionary_size_limit, size_t block_len,
+ const DurchschlagContext& context, const uint8_t* sample_data) {
+ if (strategy == DURCHSCHLAG_COLLABORATIVE) {
+ return durchschlagGenerateCollaborative(
+ dictionary_size_limit, block_len, context, sample_data);
+ } else {
+ return durchschlagGenerateExclusive(
+ dictionary_size_limit, block_len, context, sample_data);
+ }
+}
+
+void durchschlag_distill(size_t slice_len, size_t minimum_population,
+ std::vector<size_t>* sample_sizes, uint8_t* sample_data) {
+ /* Parameters aliasing */
+ uint8_t* data = sample_data;
+
+ /* Build slice map. */
+ DurchschlagContext context = durchschlag_prepare(
+ slice_len, *sample_sizes, data);
+
+ /* Calculate slice population. */
+ const std::vector<TextIdx>& offsets = context.offsets;
+ std::vector<MetaSlot> map(context.numUniqueSlices);
+ const TextIdx* shortcut = context.sliceMap.data();
+ TextIdx sliceLen = context.sliceLen;
+ TextIdx total = context.dataSize;
+ TextIdx end = total - sliceLen + 1;
+ ScoreSlices(offsets, map, shortcut, end);
+
+ /* Condense samples, omitting unique slices. */
+ TextIdx readPos = 0;
+ TextIdx writePos = 0;
+ TextIdx lastNonUniquePos = 0;
+ for (TextIdx i = 0; i < sample_sizes->size(); ++i) {
+ TextIdx sampleStart = writePos;
+ TextIdx oldSampleEnd =
+ readPos + static_cast<TextIdx>(sample_sizes->at(i));
+ while (readPos < oldSampleEnd) {
+ if (readPos < end) {
+ MetaSlot& item = map[shortcut[readPos]];
+ if (item.score >= minimum_population) {
+ lastNonUniquePos = readPos + sliceLen;
+ }
+ }
+ if (readPos < lastNonUniquePos) {
+ data[writePos++] = data[readPos];
+ }
+ readPos++;
+ }
+ sample_sizes->at(i) = writePos - sampleStart;
+ }
+}
+
+void durchschlag_purify(size_t slice_len, size_t minimum_population,
+ const std::vector<size_t>& sample_sizes, uint8_t* sample_data) {
+ /* Parameters aliasing */
+ uint8_t* data = sample_data;
+
+ /* Build slice map. */
+ DurchschlagContext context = durchschlag_prepare(
+ slice_len, sample_sizes, data);
+
+ /* Calculate slice population. */
+ const std::vector<TextIdx>& offsets = context.offsets;
+ std::vector<MetaSlot> map(context.numUniqueSlices);
+ const TextIdx* shortcut = context.sliceMap.data();
+ TextIdx sliceLen = context.sliceLen;
+ TextIdx total = context.dataSize;
+ TextIdx end = total - sliceLen + 1;
+ ScoreSlices(offsets, map, shortcut, end);
+
+ /* Rewrite samples, zeroing out unique slices. */
+ TextIdx lastNonUniquePos = 0;
+ for (TextIdx readPos = 0; readPos < total; ++readPos) {
+ if (readPos < end) {
+ MetaSlot& item = map[shortcut[readPos]];
+ if (item.score >= minimum_population) {
+ lastNonUniquePos = readPos + sliceLen;
+ }
+ }
+ if (readPos >= lastNonUniquePos) {
+ data[readPos] = 0;
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/durchschlag.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/durchschlag.h
new file mode 100755
index 000000000..adbc53141
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/durchschlag.h
@@ -0,0 +1,99 @@
+#ifndef BROTLI_RESEARCH_DURCHSCHLAG_H_
+#define BROTLI_RESEARCH_DURCHSCHLAG_H_
+
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <vector>
+
+/**
+ * Generate a dictionary for given samples.
+ *
+ * @param dictionary_size_limit maximal dictionary size
+ * @param slice_len text slice size
+ * @param block_len score block length
+ * @param sample_sizes vector with sample sizes
+ * @param sample_data concatenated samples
+ * @return generated dictionary
+ */
+std::string durchschlag_generate(
+ size_t dictionary_size_limit, size_t slice_len, size_t block_len,
+ const std::vector<size_t>& sample_sizes, const uint8_t* sample_data);
+
+//------------------------------------------------------------------------------
+// Lower level API for repetitive dictionary generation.
+//------------------------------------------------------------------------------
+
+/* Pointer to position in text. */
+typedef uint32_t DurchschlagTextIdx;
+
+/* Context is made public for flexible serialization / deserialization. */
+typedef struct DurchschlagContext {
+ DurchschlagTextIdx dataSize;
+ DurchschlagTextIdx sliceLen;
+ DurchschlagTextIdx numUniqueSlices;
+ std::vector<DurchschlagTextIdx> offsets;
+ std::vector<DurchschlagTextIdx> sliceMap;
+} DurchschlagContext;
+
+DurchschlagContext durchschlag_prepare(size_t slice_len,
+ const std::vector<size_t>& sample_sizes, const uint8_t* sample_data);
+
+typedef enum DurchschalgResourceStrategy {
+ // Faster
+ DURCHSCHLAG_EXCLUSIVE = 0,
+ // Uses much less memory
+ DURCHSCHLAG_COLLABORATIVE = 1
+} DurchschalgResourceStrategy;
+
+std::string durchschlag_generate(DurchschalgResourceStrategy strategy,
+ size_t dictionary_size_limit, size_t block_len,
+ const DurchschlagContext& context, const uint8_t* sample_data);
+
+//------------------------------------------------------------------------------
+// Suffix Array based preparation.
+//------------------------------------------------------------------------------
+
+typedef struct DurchschlagIndex {
+ std::vector<DurchschlagTextIdx> lcp;
+ std::vector<DurchschlagTextIdx> sa;
+} DurchschlagIndex;
+
+DurchschlagIndex durchschlag_index(const std::vector<uint8_t>& data);
+
+DurchschlagContext durchschlag_prepare(size_t slice_len,
+ const std::vector<size_t>& sample_sizes, const DurchschlagIndex& index);
+
+//------------------------------------------------------------------------------
+// Data preparation.
+//------------------------------------------------------------------------------
+
+/**
+ * Cut out unique slices.
+ *
+ * Both @p sample_sizes and @p sample_data are modified in-place. Number of
+ * samples remains unchanged, but some samples become shorter.
+ *
+ * @param slice_len (unique) slice size
+ * @param minimum_population minimum non-unique slice occurrence
+ * @param sample_sizes [in / out] vector with sample sizes
+ * @param sample_data [in / out] concatenated samples
+ */
+void durchschlag_distill(size_t slice_len, size_t minimum_population,
+ std::vector<size_t>* sample_sizes, uint8_t* sample_data);
+
+/**
+ * Replace unique slices with zeroes.
+ *
+ * @p sample_data is modified in-place. Number of samples and their length
+ * remain unchanged.
+ *
+ * @param slice_len (unique) slice size
+ * @param minimum_population minimum non-unique slice occurrence
+ * @param sample_sizes vector with sample sizes
+ * @param sample_data [in / out] concatenated samples
+ */
+void durchschlag_purify(size_t slice_len, size_t minimum_population,
+ const std::vector<size_t>& sample_sizes, uint8_t* sample_data);
+
+#endif // BROTLI_RESEARCH_DURCHSCHLAG_H_
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/COPYING b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/COPYING
new file mode 100644
index 000000000..07394df7c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/COPYING
@@ -0,0 +1,24 @@
+This is the esaxx copyright.
+
+Copyright (c) 2010 Daisuke Okanohara All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/README b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/README
new file mode 100644
index 000000000..c3afa09de
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/README
@@ -0,0 +1,34 @@
+ESAXX
+----------------------
+
+This library provides the implementation of enhanced suffix array.
+For an input text of length N, this library builds an enhanced suffix array in O(N) time
+using 20N bytes.
+
+For a suffix array construction, I use sais.hxx, the induced sorting algorithm
+implemented by Yuta Mori.
+
+It also provides the program to enumerate the statistics of all substrings in the text.
+
+> enum_substring
+ Enumerate all substring
+> enum_substring -w
+ Input are words separated by space.
+
+Example:
+------------------
+$ cat abra
+abracadabra
+$ enum_substring < abra
+ n:11
+alpha:256
+ node:5
+0 2 4 abra
+1 5 1 a
+2 2 3 bra
+3 2 2 ra
+4 11 0
+
+$ enum_substring -w < wiki.txt >
+
+Daisuke Okanohara <daisuke dot okanohara at gmail.com>
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/cmdline.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/cmdline.h
new file mode 100644
index 000000000..2fc0260cb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/cmdline.h
@@ -0,0 +1,704 @@
+/*
+Copyright (c) 2009, Hideyuki Tanaka
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the <organization> nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY <copyright holder> ''AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#pragma once
+
+#include <iostream>
+#include <sstream>
+#include <vector>
+#include <map>
+#include <string>
+#include <stdexcept>
+#include <typeinfo>
+#include <cstring>
+#include <algorithm>
+#include <cxxabi.h>
+
+namespace cmdline{
+
+namespace detail{
+
+template <typename Target, typename Source, bool Same>
+class lexical_cast_t{
+public:
+ static Target cast(const Source &arg){
+ Target ret;
+ std::stringstream ss;
+ if (!(ss<<arg && ss>>ret && ss.eof()))
+ throw std::bad_cast();
+
+ return ret;
+ }
+};
+
+template <typename Target, typename Source>
+class lexical_cast_t<Target, Source, true>{
+public:
+ static Target cast(const Source &arg){
+ return arg;
+ }
+};
+
+template <typename Source>
+class lexical_cast_t<std::string, Source, false>{
+public:
+ static std::string cast(const Source &arg){
+ std::ostringstream ss;
+ ss<<arg;
+ return ss.str();
+ }
+};
+
+template <typename Target>
+class lexical_cast_t<Target, std::string, false>{
+public:
+ static Target cast(const std::string &arg){
+ Target ret;
+ std::istringstream ss(arg);
+ if (!(ss>>ret && ss.eof()))
+ throw std::bad_cast();
+ return ret;
+ }
+};
+
+template <typename T1, typename T2>
+struct is_same {
+ static const bool value = false;
+};
+
+template <typename T>
+struct is_same<T, T>{
+ static const bool value = true;
+};
+
+template<typename Target, typename Source>
+Target lexical_cast(const Source &arg)
+{
+ return lexical_cast_t<Target, Source, detail::is_same<Target, Source>::value>::cast(arg);
+}
+
+static inline std::string demangle(const std::string &name)
+{
+ int status=0;
+ char *p=abi::__cxa_demangle(name.c_str(), 0, 0, &status);
+ std::string ret(p);
+ free(p);
+ return ret;
+}
+
+template <class T>
+std::string readable_typename()
+{
+ return demangle(typeid(T).name());
+}
+
+template <>
+std::string readable_typename<std::string>()
+{
+ return "string";
+}
+
+} // detail
+
+//-----
+
+class cmdline_error : public std::exception {
+public:
+ cmdline_error(const std::string &msg): msg(msg){}
+ ~cmdline_error() throw() {}
+ const char *what() const throw() { return msg.c_str(); }
+private:
+ std::string msg;
+};
+
+template <class T>
+struct default_reader{
+ T operator()(const std::string &str){
+ return detail::lexical_cast<T>(str);
+ }
+};
+
+template <class T>
+struct range_reader{
+ range_reader(const T &low, const T &high): low(low), high(high) {}
+ T operator()(const std::string &s) const {
+ T ret=default_reader<T>()(s);
+ if (!(ret>=low && ret<=high)) throw cmdline::cmdline_error("range_error");
+ return ret;
+ }
+private:
+ T low, high;
+};
+
+template <class T>
+range_reader<T> range(const T &low, const T &high)
+{
+ return range_reader<T>(low, high);
+}
+
+template <class T>
+struct oneof_reader{
+ T operator()(const std::string &s){
+ T ret=default_reader<T>()(s);
+ if (std::find(alt.begin(), alt.end(), s)==alt.end())
+ throw cmdline_error("");
+ return ret;
+ }
+ void add(const T &v){ alt.push_back(v); }
+private:
+ std::vector<T> alt;
+};
+
+template <class T>
+oneof_reader<T> oneof(T a1)
+{
+ oneof_reader<T> ret;
+ ret.add(a1);
+ return ret;
+}
+
+template <class T>
+oneof_reader<T> oneof(T a1, T a2)
+{
+ oneof_reader<T> ret;
+ ret.add(a1);
+ ret.add(a2);
+ return ret;
+}
+
+template <class T>
+oneof_reader<T> oneof(T a1, T a2, T a3)
+{
+ oneof_reader<T> ret;
+ ret.add(a1);
+ ret.add(a2);
+ ret.add(a3);
+ return ret;
+}
+
+template <class T>
+oneof_reader<T> oneof(T a1, T a2, T a3, T a4)
+{
+ oneof_reader<T> ret;
+ ret.add(a1);
+ ret.add(a2);
+ ret.add(a3);
+ ret.add(a4);
+ return ret;
+}
+
+template <class T>
+oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5)
+{
+ oneof_reader<T> ret;
+ ret.add(a1);
+ ret.add(a2);
+ ret.add(a3);
+ ret.add(a4);
+ ret.add(a5);
+ return ret;
+}
+
+template <class T>
+oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6)
+{
+ oneof_reader<T> ret;
+ ret.add(a1);
+ ret.add(a2);
+ ret.add(a3);
+ ret.add(a4);
+ ret.add(a5);
+ ret.add(a6);
+ return ret;
+}
+
+template <class T>
+oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7)
+{
+ oneof_reader<T> ret;
+ ret.add(a1);
+ ret.add(a2);
+ ret.add(a3);
+ ret.add(a4);
+ ret.add(a5);
+ ret.add(a6);
+ ret.add(a7);
+ return ret;
+}
+
+template <class T>
+oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7, T a8)
+{
+ oneof_reader<T> ret;
+ ret.add(a1);
+ ret.add(a2);
+ ret.add(a3);
+ ret.add(a4);
+ ret.add(a5);
+ ret.add(a6);
+ ret.add(a7);
+ ret.add(a8);
+ return ret;
+}
+
+template <class T>
+oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7, T a8, T a9)
+{
+ oneof_reader<T> ret;
+ ret.add(a1);
+ ret.add(a2);
+ ret.add(a3);
+ ret.add(a4);
+ ret.add(a5);
+ ret.add(a6);
+ ret.add(a7);
+ ret.add(a8);
+ ret.add(a9);
+ return ret;
+}
+
+template <class T>
+oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7, T a8, T a9, T a10)
+{
+ oneof_reader<T> ret;
+ ret.add(a1);
+ ret.add(a2);
+ ret.add(a3);
+ ret.add(a4);
+ ret.add(a5);
+ ret.add(a6);
+ ret.add(a7);
+ ret.add(a8);
+ ret.add(a9);
+ ret.add(a10);
+ return ret;
+}
+
+//-----
+
+class parser{
+public:
+ parser(){
+ }
+ ~parser(){
+ for (std::map<std::string, option_base*>::iterator p=options.begin();
+ p!=options.end(); p++)
+ delete p->second;
+ }
+
+ void add(const std::string &name,
+ char short_name=0,
+ const std::string &desc=""){
+ if (options.count(name)) throw cmdline_error("multiple definition: "+name);
+ options[name]=new option_without_value(name, short_name, desc);
+ ordered.push_back(options[name]);
+ }
+
+ template <class T>
+ void add(const std::string &name,
+ char short_name=0,
+ const std::string &desc="",
+ bool need=true,
+ const T def=T()){
+ add(name, short_name, desc, need, def, default_reader<T>());
+ }
+
+ template <class T, class F>
+ void add(const std::string &name,
+ char short_name=0,
+ const std::string &desc="",
+ bool need=true,
+ const T def=T(),
+ F reader=F()){
+ if (options.count(name)) throw cmdline_error("multiple definition: "+name);
+ options[name]=new option_with_value_with_reader<T, F>(name, short_name, need, def, desc, reader);
+ ordered.push_back(options[name]);
+ }
+
+ void footer(const std::string &f){
+ ftr=f;
+ }
+
+ void set_program_name(const std::string &name){
+ prog_name=name;
+ }
+
+ bool exist(const std::string &name){
+ if (options.count(name)==0) throw cmdline_error("there is no flag: --"+name);
+ return options[name]->has_set();
+ }
+
+ template <class T>
+ const T &get(const std::string &name) const {
+ if (options.count(name)==0) throw cmdline_error("there is no flag: --"+name);
+ const option_with_value<T> *p=dynamic_cast<const option_with_value<T>*>(options.find(name)->second);
+ if (p==NULL) throw cmdline_error("type mismatch flag '"+name+"'");
+ return p->get();
+ }
+
+ const std::vector<std::string> &rest() const {
+ return others;
+ }
+
+ bool parse(int argc, char *argv[]){
+ errors.clear();
+ others.clear();
+
+ if (argc<1){
+ errors.push_back("argument number must be longer than 0");
+ return false;
+ }
+ if (prog_name=="")
+ prog_name=argv[0];
+
+ std::map<char, std::string> lookup;
+ for (std::map<std::string, option_base*>::iterator p=options.begin();
+ p!=options.end(); p++){
+ if (p->first.length()==0) continue;
+ char initial=p->second->short_name();
+ if (initial){
+ if (lookup.count(initial)>0){
+ lookup[initial]="";
+ errors.push_back(std::string("short option '")+initial+"' is ambiguous");
+ return false;
+ }
+ else lookup[initial]=p->first;
+ }
+ }
+
+ for (int i=1; i<argc; i++){
+ if (strncmp(argv[i], "--", 2)==0){
+ char *p=strchr(argv[i]+2, '=');
+ if (p){
+ std::string name(argv[i]+2, p);
+ std::string val(p+1);
+ set_option(name, val);
+ }
+ else{
+ std::string name(argv[i]+2);
+ set_option(name);
+ }
+ }
+ else if (strncmp(argv[i], "-", 1)==0){
+ if (!argv[i][1]) continue;
+ char last=argv[i][1];
+ for (int j=2; argv[i][j]; j++){
+ last=argv[i][j];
+ if (lookup.count(argv[i][j-1])==0){
+ errors.push_back(std::string("undefined short option: -")+argv[i][j-1]);
+ continue;
+ }
+ if (lookup[argv[i][j-1]]==""){
+ errors.push_back(std::string("ambiguous short option: -")+argv[i][j-1]);
+ continue;
+ }
+ set_option(lookup[argv[i][j-1]]);
+ }
+
+ if (lookup.count(last)==0){
+ errors.push_back(std::string("undefined short option: -")+last);
+ continue;
+ }
+ if (lookup[last]==""){
+ errors.push_back(std::string("ambiguous short option: -")+last);
+ continue;
+ }
+
+ if (i+1<argc && options[lookup[last]]->has_value()){
+ set_option(lookup[last], argv[i+1]);
+ i++;
+ }
+ else{
+ set_option(lookup[last]);
+ }
+ }
+ else{
+ others.push_back(argv[i]);
+ }
+ }
+
+ for (std::map<std::string, option_base*>::iterator p=options.begin();
+ p!=options.end(); p++)
+ if (!p->second->valid())
+ errors.push_back("need option: --"+std::string(p->first));
+
+ return errors.size()==0;
+ }
+
+ std::string error() const{
+ return errors.size()>0?errors[0]:"";
+ }
+
+ std::string error_full() const{
+ std::ostringstream oss;
+ for (size_t i=0; i<errors.size(); i++)
+ oss<<errors[i]<<std::endl;
+ return oss.str();
+ }
+
+ std::string usage() const {
+ std::ostringstream oss;
+ oss<<"usage: "<<prog_name<<" ";
+ for (size_t i=0; i<ordered.size(); i++){
+ if (ordered[i]->must())
+ oss<<ordered[i]->short_description()<<" ";
+ }
+
+ oss<<"[options] ... "<<ftr<<std::endl;
+ oss<<"options:"<<std::endl;
+
+ size_t max_width=0;
+ for (size_t i=0; i<ordered.size(); i++){
+ max_width=std::max(max_width, ordered[i]->name().length());
+ }
+ for (size_t i=0; i<ordered.size(); i++){
+ if (ordered[i]->short_name()){
+ oss<<" -"<<ordered[i]->short_name()<<", ";
+ }
+ else{
+ oss<<" ";
+ }
+
+ oss<<"--"<<ordered[i]->name();
+ for (size_t j=ordered[i]->name().length(); j<max_width+4; j++)
+ oss<<' ';
+ oss<<ordered[i]->description()<<std::endl;
+ }
+ return oss.str();
+ }
+
+private:
+
+ void set_option(const std::string &name){
+ if (options.count(name)==0){
+ errors.push_back("undefined option: --"+name);
+ return;
+ }
+ if (!options[name]->set()){
+ errors.push_back("option needs value: --"+name);
+ return;
+ }
+ }
+
+ void set_option(const std::string &name, const std::string &value){
+ if (options.count(name)==0){
+ errors.push_back("undefined option: --"+name);
+ return;
+ }
+ if (!options[name]->set(value)){
+ errors.push_back("option value is invalid: --"+name+"="+value);
+ return;
+ }
+ }
+
+ class option_base{
+ public:
+ virtual ~option_base(){}
+
+ virtual bool has_value() const=0;
+ virtual bool set()=0;
+ virtual bool set(const std::string &value)=0;
+ virtual bool has_set() const=0;
+ virtual bool valid() const=0;
+ virtual bool must() const=0;
+
+ virtual const std::string &name() const=0;
+ virtual char short_name() const=0;
+ virtual const std::string &description() const=0;
+ virtual std::string short_description() const=0;
+ };
+
+ class option_without_value : public option_base {
+ public:
+ option_without_value(const std::string &name,
+ char short_name,
+ const std::string &desc)
+ :nam(name), snam(short_name), desc(desc), has(false){
+ }
+ ~option_without_value(){}
+
+ bool has_value() const { return false; }
+
+ bool set(){
+ has=true;
+ return true;
+ }
+
+ bool set(const std::string &){
+ return false;
+ }
+
+ bool has_set() const {
+ return has;
+ }
+
+ bool valid() const{
+ return true;
+ }
+
+ bool must() const{
+ return false;
+ }
+
+ const std::string &name() const{
+ return nam;
+ }
+
+ char short_name() const{
+ return snam;
+ }
+
+ const std::string &description() const {
+ return desc;
+ }
+
+ std::string short_description() const{
+ return "--"+nam;
+ }
+
+ private:
+ std::string nam;
+ char snam;
+ std::string desc;
+ bool has;
+ };
+
+ template <class T>
+ class option_with_value : public option_base {
+ public:
+ option_with_value(const std::string &name,
+ char short_name,
+ bool need,
+ const T &def,
+ const std::string &desc)
+ : nam(name), snam(short_name), need(need), has(false)
+ , def(def), actual(def) {
+ this->desc=full_description(desc);
+ }
+ ~option_with_value(){}
+
+ const T &get() const {
+ return actual;
+ }
+
+ bool has_value() const { return true; }
+
+ bool set(){
+ return false;
+ }
+
+ bool set(const std::string &value){
+ try{
+ actual=read(value);
+ has=true;
+ }
+ catch(const std::exception &e){
+ return false;
+ }
+ return true;
+ }
+
+ bool has_set() const{
+ return has;
+ }
+
+ bool valid() const{
+ if (need && !has) return false;
+ return true;
+ }
+
+ bool must() const{
+ return need;
+ }
+
+ const std::string &name() const{
+ return nam;
+ }
+
+ char short_name() const{
+ return snam;
+ }
+
+ const std::string &description() const {
+ return desc;
+ }
+
+ std::string short_description() const{
+ return "--"+nam+"="+detail::readable_typename<T>();
+ }
+
+ protected:
+ std::string full_description(const std::string &desc){
+ return
+ desc+" ("+detail::readable_typename<T>()+
+ (need?"":" [="+detail::lexical_cast<std::string>(def)+"]")
+ +")";
+ }
+
+ virtual T read(const std::string &s)=0;
+
+ std::string nam;
+ char snam;
+ bool need;
+ std::string desc;
+
+ bool has;
+ T def;
+ T actual;
+ };
+
+ template <class T, class F>
+ class option_with_value_with_reader : public option_with_value<T> {
+ public:
+ option_with_value_with_reader(const std::string &name,
+ char short_name,
+ bool need,
+ const T def,
+ const std::string &desc,
+ F reader)
+ : option_with_value<T>(name, short_name, need, def, desc), reader(reader){
+ }
+
+ private:
+ T read(const std::string &s){
+ return reader(s);
+ }
+
+ F reader;
+ };
+
+ std::map<std::string, option_base*> options;
+ std::vector<option_base*> ordered;
+ std::string ftr;
+
+ std::string prog_name;
+ std::vector<std::string> others;
+
+ std::vector<std::string> errors;
+};
+
+} // cmdline
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/enumSubstring.cpp b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/enumSubstring.cpp
new file mode 100644
index 000000000..e34842fd2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/enumSubstring.cpp
@@ -0,0 +1,140 @@
+#include <iostream>
+#include <string>
+#include <vector>
+#include <map>
+#include "cmdline.h"
+#include "esa.hxx"
+
+using namespace std;
+
+int readFile(const char* fn, vector<int>& T){
+ FILE* fp = fopen(fn, "rb");
+ if (fp == NULL){
+ cerr << "cannot open " << fn << endl;
+ return -1;
+ }
+
+ if (fseek(fp, 0, SEEK_END) != 0){
+ cerr << "cannot fseek " << fn << endl;
+ fclose(fp);
+ return -1;
+ }
+ int n = ftell(fp);
+ rewind(fp);
+ if (n < 0){
+ cerr << "cannot ftell " << fn << endl;
+ fclose(fp);
+ return -1;
+ }
+ T.resize(n);
+ if (fread(&T[0], sizeof(unsigned char), (size_t)n, fp) != (size_t) n){
+ cerr << "fread error " << fn << endl;
+ fclose(fp);
+ return -1;
+ }
+
+ fclose(fp);
+ return 0;
+}
+
+int getID(const string& str, map<string, int>& word2id){
+ map<string, int>::const_iterator it = word2id.find(str);
+ if (it == word2id.end()){
+ int newID = (int)word2id.size();
+ word2id[str] = newID;
+ return newID;
+ } else {
+ return it->second;
+ }
+}
+
+void printSnipet(const vector<int>& T, const int beg, const int len, const vector<string>& id2word){
+ for (int i = 0; i < len; ++i){
+ int c = T[beg + i];
+ if (id2word.size() > 0){
+ cout << id2word[c] << " ";
+ } else {
+ cout << (isspace((char)c) ? '_' : (char)c);
+ }
+ }
+}
+
+int main(int argc, char* argv[]){
+ cmdline::parser p;
+ p.add("word", 'w', "word type");
+
+ if (!p.parse(argc, argv)){
+ cerr << p.error() << endl
+ << p.usage() << endl;
+ return -1;
+ }
+
+ if (p.rest().size() > 0){
+ cerr << p.usage() << endl;
+ return -1;
+ }
+
+ vector<int> T;
+
+ bool isWord = p.exist("word");
+ map<string, int> word2id;
+ istreambuf_iterator<char> isit(cin);
+ istreambuf_iterator<char> end;
+
+ size_t origLen = 0;
+ if (isWord){
+ string word;
+ while (isit != end){
+ char c = *isit++;
+ if (!isspace(c)){
+ word += c;
+ } else if (word.size() > 0){
+ T.push_back(getID(word, word2id));
+ word = "";
+ }
+ ++origLen;
+ }
+ if (word.size() > 0){
+ T.push_back(getID(word, word2id));
+ }
+ } else {
+ while (isit != end){
+ T.push_back((unsigned char)(*isit++));
+ }
+ origLen = T.size();
+ }
+
+ vector<string> id2word(word2id.size());
+ for (map<string, int>::const_iterator it = word2id.begin();
+ it != word2id.end(); ++it){
+ id2word[it->second] = it->first;
+ }
+
+ vector<int> SA(T.size());
+ vector<int> L (T.size());
+ vector<int> R (T.size());
+ vector<int> D (T.size());
+
+ int k = (isWord) ? (int)id2word.size() : 0x100;
+ if (isWord){
+ cerr << "origN:" << origLen << endl;
+ }
+ cerr << " n:" << T.size() << endl;
+ cerr << "alpha:" << k << endl;
+
+ int nodeNum = 0;
+ if (esaxx(T.begin(), SA.begin(),
+ L.begin(), R.begin(), D.begin(),
+ (int)T.size(), k, nodeNum) == -1){
+ return -1;
+ }
+ cerr << " node:" << nodeNum << endl;
+
+ for (int i = 0; i < nodeNum; ++i){
+ cout << i << "\t" << R[i] - L[i] << "\t" << D[i] << "\t";
+ printSnipet(T, SA[L[i]], D[i], id2word);
+ cout << endl;
+ }
+
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/esa.hxx b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/esa.hxx
new file mode 100644
index 000000000..acb5c7a1b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/esa.hxx
@@ -0,0 +1,125 @@
+/*
+ * esa.hxx
+ * Copyright (c) 2010 Daisuke Okanohara All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _ESA_HXX
+#define _ESA_HXX
+
+#include <vector>
+#include <utility>
+#include <cassert>
+#include "sais.hxx"
+
+namespace esaxx_private {
+template<typename string_type, typename sarray_type, typename index_type>
+index_type suffixtree(string_type T, sarray_type SA, sarray_type L, sarray_type R, sarray_type D, index_type n){
+ if (n == 0){
+ return 0;
+ }
+ sarray_type Psi = L;
+ Psi[SA[0]] = SA[n-1];
+ for (index_type i = 1; i < n; ++i){
+ Psi[SA[i]] = SA[i-1];
+ }
+
+ // Compare at most 2n log n charcters. Practically fastest
+ // "Permuted Longest-Common-Prefix Array", Juha Karkkainen, CPM 09
+ sarray_type PLCP = R;
+ index_type h = 0;
+ for (index_type i = 0; i < n; ++i){
+ index_type j = Psi[i];
+ while (i+h < n && j+h < n &&
+ T[i+h] == T[j+h]){
+ ++h;
+ }
+ PLCP[i] = h;
+ if (h > 0) --h;
+ }
+
+ sarray_type H = L;
+ for (index_type i = 0; i < n; ++i){
+ H[i] = PLCP[SA[i]];
+ }
+ H[0] = -1;
+
+ std::vector<std::pair<index_type, index_type> > S;
+ S.push_back(std::make_pair((index_type)-1, (index_type)-1));
+ size_t nodeNum = 0;
+ for (index_type i = 0; ; ++i){
+ std::pair<index_type, index_type> cur (i, (i == n) ? -1 : H[i]);
+ std::pair<index_type, index_type> cand(S.back());
+ while (cand.second > cur.second){
+ if (i - cand.first > 1){
+ L[nodeNum] = cand.first;
+ R[nodeNum] = i;
+ D[nodeNum] = cand.second;
+ ++nodeNum;
+ }
+ cur.first = cand.first;
+ S.pop_back();
+ cand = S.back();
+ }
+ if (cand.second < cur.second){
+ S.push_back(cur);
+ }
+ if (i == n) break;
+ S.push_back(std::make_pair(i, n - SA[i] + 1));
+ }
+ return nodeNum;
+}
+}
+
+/**
+ * @brief Build an enhanced suffix array of a given string in linear time
+ * For an input text T, esaxx() builds an enhancd suffix array in linear time.
+ * i-th internal node is represented as a triple (L[i], R[i], D[i]);
+ * L[i] and R[i] is the left/right boundary of the suffix array as SA[L[i]....R[i]-1]
+ * D[i] is the depth of the internal node
+ * The number of internal node is at most N-1 and return the actual number by
+ * @param T[0...n-1] The input string. (random access iterator)
+ * @param SA[0...n-1] The output suffix array (random access iterator)
+ * @param L[0...n-1] The output left boundary of internal node (random access iterator)
+ * @param R[0...n-1] The output right boundary of internal node (random access iterator)
+ * @param D[0...n-1] The output depth of internal node (random access iterator)
+ * @param n The length of the input string
+ * @param k The alphabet size
+ * @pram nodeNum The output the number of internal node
+ * @return 0 if succeded, -1 or -2 otherwise
+ */
+
+template<typename string_type, typename sarray_type, typename index_type>
+int esaxx(string_type T, sarray_type SA, sarray_type L, sarray_type R, sarray_type D,
+ index_type n, index_type k, index_type& nodeNum) {
+ if ((n < 0) || (k <= 0)) return -1;
+ int err = saisxx(T, SA, n, k);
+ if (err != 0){
+ return err;
+ }
+ nodeNum = esaxx_private::suffixtree(T, SA, L, R, D, n);
+ return 0;
+}
+
+
+#endif // _ESA_HXX
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/sais.hxx b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/sais.hxx
new file mode 100644
index 000000000..20e69dfec
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/sais.hxx
@@ -0,0 +1,364 @@
+/*
+ * sais.hxx for sais-lite
+ * Copyright (c) 2008-2009 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _SAIS_HXX
+#define _SAIS_HXX 1
+#ifdef __cplusplus
+
+#ifdef __INTEL_COMPILER
+#pragma warning(disable : 383 981 1418)
+// for icc 64-bit
+//#define __builtin_vsnprintf(a, b, c, d) __builtin_vsnprintf(a, b, c, (char *)d)
+#endif
+
+#include <iterator>
+#ifdef _OPENMP
+# include <omp.h>
+#endif
+
+namespace saisxx_private {
+
+/* find the start or end of each bucket */
+template<typename string_type, typename bucket_type, typename index_type>
+void
+getCounts(const string_type T, bucket_type C, index_type n, index_type k) {
+#ifdef _OPENMP
+ bucket_type D;
+ index_type i, j, p, sum, first, last;
+ int thnum, maxthreads = omp_get_max_threads();
+#pragma omp parallel default(shared) private(D, i, thnum, first, last)
+ {
+ thnum = omp_get_thread_num();
+ D = C + thnum * k;
+ first = n / maxthreads * thnum;
+ last = (thnum < (maxthreads - 1)) ? n / maxthreads * (thnum + 1) : n;
+ for(i = 0; i < k; ++i) { D[i] = 0; }
+ for(i = first; i < last; ++i) { ++D[T[i]]; }
+ }
+ if(1 < maxthreads) {
+#pragma omp parallel for default(shared) private(i, j, p, sum)
+ for(i = 0; i < k; ++i) {
+ for(j = 1, p = i + k, sum = C[i]; j < maxthreads; ++j, p += k) {
+ sum += C[p];
+ }
+ C[i] = sum;
+ }
+ }
+#else
+ index_type i;
+ for(i = 0; i < k; ++i) { C[i] = 0; }
+ for(i = 0; i < n; ++i) { ++C[T[i]]; }
+#endif
+}
+template<typename bucket_type, typename index_type>
+void
+getBuckets(const bucket_type C, bucket_type B, index_type k, bool end) {
+ index_type i, sum = 0;
+ if(end) { for(i = 0; i < k; ++i) { sum += C[i]; B[i] = sum; } }
+ else { for(i = 0; i < k; ++i) { sum += C[i]; B[i] = sum - C[i]; } }
+}
+
+/* compute SA and BWT */
+template<typename string_type, typename sarray_type,
+ typename bucket_type, typename index_type>
+void
+induceSA(string_type T, sarray_type SA, bucket_type C, bucket_type B,
+ index_type n, index_type k) {
+typedef typename std::iterator_traits<string_type>::value_type char_type;
+ sarray_type b;
+ index_type i, j;
+ char_type c0, c1;
+ /* compute SAl */
+ if(C == B) { getCounts(T, C, n, k); }
+ getBuckets(C, B, k, false); /* find starts of buckets */
+ b = SA + B[c1 = T[j = n - 1]];
+ *b++ = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
+ for(i = 0; i < n; ++i) {
+ j = SA[i], SA[i] = ~j;
+ if(0 < j) {
+ if((c0 = T[--j]) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
+ *b++ = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
+ }
+ }
+ /* compute SAs */
+ if(C == B) { getCounts(T, C, n, k); }
+ getBuckets(C, B, k, true); /* find ends of buckets */
+ for(i = n - 1, b = SA + B[c1 = 0]; 0 <= i; --i) {
+ if(0 < (j = SA[i])) {
+ if((c0 = T[--j]) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
+ *--b = ((j == 0) || (T[j - 1] > c1)) ? ~j : j;
+ } else {
+ SA[i] = ~j;
+ }
+ }
+}
+template<typename string_type, typename sarray_type,
+ typename bucket_type, typename index_type>
+int
+computeBWT(string_type T, sarray_type SA, bucket_type C, bucket_type B,
+ index_type n, index_type k) {
+typedef typename std::iterator_traits<string_type>::value_type char_type;
+ sarray_type b;
+ index_type i, j, pidx = -1;
+ char_type c0, c1;
+ /* compute SAl */
+ if(C == B) { getCounts(T, C, n, k); }
+ getBuckets(C, B, k, false); /* find starts of buckets */
+ b = SA + B[c1 = T[j = n - 1]];
+ *b++ = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
+ for(i = 0; i < n; ++i) {
+ if(0 < (j = SA[i])) {
+ SA[i] = ~(c0 = T[--j]);
+ if(c0 != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
+ *b++ = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
+ } else if(j != 0) {
+ SA[i] = ~j;
+ }
+ }
+ /* compute SAs */
+ if(C == B) { getCounts(T, C, n, k); }
+ getBuckets(C, B, k, true); /* find ends of buckets */
+ for(i = n - 1, b = SA + B[c1 = 0]; 0 <= i; --i) {
+ if(0 < (j = SA[i])) {
+ SA[i] = (c0 = T[--j]);
+ if(c0 != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
+ *--b = ((0 < j) && (T[j - 1] > c1)) ? ~((index_type)T[j - 1]) : j;
+ } else if(j != 0) {
+ SA[i] = ~j;
+ } else {
+ pidx = i;
+ }
+ }
+ return pidx;
+}
+
+/* find the suffix array SA of T[0..n-1] in {0..k}^n
+ use a working space (excluding s and SA) of at most 2n+O(1) for a constant alphabet */
+template<typename string_type, typename sarray_type, typename index_type>
+int
+suffixsort(string_type T, sarray_type SA,
+ index_type fs, index_type n, index_type k,
+ bool isbwt) {
+typedef typename std::iterator_traits<string_type>::value_type char_type;
+ sarray_type RA;
+ index_type i, j, m, p, q, plen, qlen, name, pidx = 0;
+ bool diff;
+ int c;
+#ifdef _OPENMP
+ int maxthreads = omp_get_max_threads();
+#else
+# define maxthreads 1
+#endif
+ char_type c0, c1;
+
+ /* stage 1: reduce the problem by at least 1/2
+ sort all the S-substrings */
+ if(fs < (maxthreads * k)) {
+ index_type *C, *B;
+ if((C = new index_type[maxthreads * k]) == 0) { return -2; }
+ B = (1 < maxthreads) ? C + k : C;
+ getCounts(T, C, n, k); getBuckets(C, B, k, true); /* find ends of buckets */
+#ifdef _OPENMP
+#pragma omp parallel for default(shared) private(i)
+#endif
+ for(i = 0; i < n; ++i) { SA[i] = 0; }
+ for(i = n - 2, c = 0, c1 = T[n - 1]; 0 <= i; --i, c1 = c0) {
+ if((c0 = T[i]) < (c1 + c)) { c = 1; }
+ else if(c != 0) { SA[--B[c1]] = i + 1, c = 0; }
+ }
+ induceSA(T, SA, C, B, n, k);
+ delete [] C;
+ } else {
+ sarray_type C, B;
+ C = SA + n;
+ B = ((1 < maxthreads) || (k <= (fs - k))) ? C + k : C;
+ getCounts(T, C, n, k); getBuckets(C, B, k, true); /* find ends of buckets */
+#ifdef _OPENMP
+#pragma omp parallel for default(shared) private(i)
+#endif
+ for(i = 0; i < n; ++i) { SA[i] = 0; }
+ for(i = n - 2, c = 0, c1 = T[n - 1]; 0 <= i; --i, c1 = c0) {
+ if((c0 = T[i]) < (c1 + c)) { c = 1; }
+ else if(c != 0) { SA[--B[c1]] = i + 1, c = 0; }
+ }
+ induceSA(T, SA, C, B, n, k);
+ }
+
+ /* compact all the sorted substrings into the first m items of SA
+ 2*m must be not larger than n (proveable) */
+#ifdef _OPENMP
+#pragma omp parallel for default(shared) private(i, j, p, c0, c1)
+ for(i = 0; i < n; ++i) {
+ p = SA[i];
+ if((0 < p) && (T[p - 1] > (c0 = T[p]))) {
+ for(j = p + 1; (j < n) && (c0 == (c1 = T[j])); ++j) { }
+ if((j < n) && (c0 < c1)) { SA[i] = ~p; }
+ }
+ }
+ for(i = 0, m = 0; i < n; ++i) { if((p = SA[i]) < 0) { SA[m++] = ~p; } }
+#else
+ for(i = 0, m = 0; i < n; ++i) {
+ p = SA[i];
+ if((0 < p) && (T[p - 1] > (c0 = T[p]))) {
+ for(j = p + 1; (j < n) && (c0 == (c1 = T[j])); ++j) { }
+ if((j < n) && (c0 < c1)) { SA[m++] = p; }
+ }
+ }
+#endif
+ j = m + (n >> 1);
+#ifdef _OPENMP
+#pragma omp parallel for default(shared) private(i)
+#endif
+ for(i = m; i < j; ++i) { SA[i] = 0; } /* init the name array buffer */
+ /* store the length of all substrings */
+ for(i = n - 2, j = n, c = 0, c1 = T[n - 1]; 0 <= i; --i, c1 = c0) {
+ if((c0 = T[i]) < (c1 + c)) { c = 1; }
+ else if(c != 0) { SA[m + ((i + 1) >> 1)] = j - i - 1; j = i + 1; c = 0; }
+ }
+ /* find the lexicographic names of all substrings */
+ for(i = 0, name = 0, q = n, qlen = 0; i < m; ++i) {
+ p = SA[i], plen = SA[m + (p >> 1)], diff = true;
+ if(plen == qlen) {
+ for(j = 0; (j < plen) && (T[p + j] == T[q + j]); ++j) { }
+ if(j == plen) { diff = false; }
+ }
+ if(diff != false) { ++name, q = p, qlen = plen; }
+ SA[m + (p >> 1)] = name;
+ }
+
+ /* stage 2: solve the reduced problem
+ recurse if names are not yet unique */
+ if(name < m) {
+ RA = SA + n + fs - m;
+ for(i = m + (n >> 1) - 1, j = m - 1; m <= i; --i) {
+ if(SA[i] != 0) { RA[j--] = SA[i] - 1; }
+ }
+ if(suffixsort(RA, SA, fs + n - m * 2, m, name, false) != 0) { return -2; }
+ for(i = n - 2, j = m - 1, c = 0, c1 = T[n - 1]; 0 <= i; --i, c1 = c0) {
+ if((c0 = T[i]) < (c1 + c)) { c = 1; }
+ else if(c != 0) { RA[j--] = i + 1, c = 0; } /* get p1 */
+ }
+#ifdef _OPENMP
+#pragma omp parallel for default(shared) private(i)
+#endif
+ for(i = 0; i < m; ++i) { SA[i] = RA[SA[i]]; } /* get index in s */
+ }
+
+ /* stage 3: induce the result for the original problem */
+ if(fs < (maxthreads * k)) {
+ index_type *B, *C;
+ if((C = new index_type[maxthreads * k]) == 0) { return -2; }
+ B = (1 < maxthreads) ? C + k : C;
+ /* put all left-most S characters into their buckets */
+ getCounts(T, C, n, k); getBuckets(C, B, k, true); /* find ends of buckets */
+#ifdef _OPENMP
+#pragma omp parallel for default(shared) private(i)
+#endif
+ for(i = m; i < n; ++i) { SA[i] = 0; } /* init SA[m..n-1] */
+ for(i = m - 1; 0 <= i; --i) {
+ j = SA[i], SA[i] = 0;
+ SA[--B[T[j]]] = j;
+ }
+ if(isbwt == false) { induceSA(T, SA, C, B, n, k); }
+ else { pidx = computeBWT(T, SA, C, B, n, k); }
+ delete [] C;
+ } else {
+ sarray_type C, B;
+ C = SA + n;
+ B = ((1 < maxthreads) || (k <= (fs - k))) ? C + k : C;
+ /* put all left-most S characters into their buckets */
+ getCounts(T, C, n, k); getBuckets(C, B, k, true); /* find ends of buckets */
+#ifdef _OPENMP
+#pragma omp parallel for default(shared) private(i)
+#endif
+ for(i = m; i < n; ++i) { SA[i] = 0; } /* init SA[m..n-1] */
+ for(i = m - 1; 0 <= i; --i) {
+ j = SA[i], SA[i] = 0;
+ SA[--B[T[j]]] = j;
+ }
+ if(isbwt == false) { induceSA(T, SA, C, B, n, k); }
+ else { pidx = computeBWT(T, SA, C, B, n, k); }
+ }
+
+ return pidx;
+#ifndef _OPENMP
+# undef maxthreads
+#endif
+}
+
+} /* namespace saisxx_private */
+
+
+/**
+ * @brief Constructs the suffix array of a given string in linear time.
+ * @param T[0..n-1] The input string. (random access iterator)
+ * @param SA[0..n-1] The output array of suffixes. (random access iterator)
+ * @param n The length of the given string.
+ * @param k The alphabet size.
+ * @return 0 if no error occurred, -1 or -2 otherwise.
+ */
+template<typename string_type, typename sarray_type, typename index_type>
+int
+saisxx(string_type T, sarray_type SA, index_type n, index_type k = 256) {
+ int err;
+ if((n < 0) || (k <= 0)) { return -1; }
+ if(n <= 1) { if(n == 1) { SA[0] = 0; } return 0; }
+ try { err = saisxx_private::suffixsort(T, SA, 0, n, k, false); }
+ catch(...) { err = -2; }
+ return err;
+}
+
+/**
+ * @brief Constructs the burrows-wheeler transformed string of a given string in linear time.
+ * @param T[0..n-1] The input string. (random access iterator)
+ * @param U[0..n-1] The output string. (random access iterator)
+ * @param A[0..n-1] The temporary array. (random access iterator)
+ * @param n The length of the given string.
+ * @param k The alphabet size.
+ * @return The primary index if no error occurred, -1 or -2 otherwise.
+ */
+template<typename string_type, typename sarray_type, typename index_type>
+index_type
+saisxx_bwt(string_type T, string_type U, sarray_type A, index_type n, index_type k = 256) {
+typedef typename std::iterator_traits<string_type>::value_type char_type;
+ index_type i, pidx;
+ if((n < 0) || (k <= 0)) { return -1; }
+ if(n <= 1) { if(n == 1) { U[0] = T[0]; } return n; }
+ try {
+ pidx = saisxx_private::suffixsort(T, A, 0, n, k, true);
+ if(0 <= pidx) {
+ U[0] = T[n - 1];
+ for(i = 0; i < pidx; ++i) { U[i + 1] = (char_type)A[i]; }
+ for(i += 1; i < n; ++i) { U[i] = (char_type)A[i]; }
+ pidx += 1;
+ }
+ } catch(...) { pidx = -2; }
+ return pidx;
+}
+
+
+#endif /* __cplusplus */
+#endif /* _SAIS_HXX */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/waf b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/waf
new file mode 100755
index 000000000..d99146fa4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/waf
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/wscript b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/wscript
new file mode 100644
index 000000000..a58f45826
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/esaxx/wscript
@@ -0,0 +1,23 @@
+VERSION= '0.0.4'
+APPNAME= 'esaxx'
+
+srcdir= '.'
+blddir= 'bin'
+
+def set_options(ctx):
+ ctx.tool_options('compiler_cxx')
+
+def configure(ctx):
+ ctx.check_tool('compiler_cxx')
+ ctx.env.CXXFLAGS += ['-O2', '-Wall', '-g']
+
+def build(bld):
+ task1= bld(features='cxx cprogram',
+ source = 'enumSubstring.cpp',
+ name = 'enum_substring',
+ target = 'enum_substring',
+ includes = '.')
+
+def dist_hook():
+ import os
+ os.remove('googlecode_upload.py')
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/find_opt_references.cc b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/find_opt_references.cc
new file mode 100644
index 000000000..378d3b521
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/find_opt_references.cc
@@ -0,0 +1,267 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+ Author: zip753@gmail.com (Ivan Nikulin)
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* Tool for generating optimal backward references for the input file. Uses
+ sais-lite library for building suffix array. */
+
+#include <algorithm>
+#include <cassert>
+#include <cstdio>
+#include <cstring>
+#include <functional>
+#include <utility>
+#include <vector>
+
+#include <gflags/gflags.h>
+using gflags::ParseCommandLineFlags;
+
+#include "./esaxx/sais.hxx"
+
+DEFINE_bool(advanced, false, "Advanced searching mode: finds all longest "
+ "matches at positions that are not covered by matches of length at least "
+ "max_length. WARNING: uses much more memory than simple mode, especially "
+ "for small values of min_length.");
+DEFINE_int32(min_length, 1, "Minimal length of found backward references.");
+/* For advanced mode. */
+DEFINE_int32(long_length, 32,
+ "Maximal length of found backward references for advanced mode.");
+DEFINE_int32(skip, 1, "Number of bytes to skip.");
+
+const size_t kFileBufferSize = (1 << 16); // 64KB
+
+typedef int sarray_type; // Can't make it unsigned because of templates :(
+typedef uint8_t input_type;
+typedef uint32_t lcp_type;
+typedef std::pair<int, std::vector<int> > entry_type;
+typedef std::function<void(sarray_type*, lcp_type*, size_t, int, int, int, int,
+ int)> Fn;
+
+void ReadInput(FILE* fin, input_type* storage, size_t input_size) {
+ size_t last_pos = 0;
+ size_t available_in;
+ fseek(fin, 0, SEEK_SET);
+ do {
+ available_in = fread(storage + last_pos, 1, kFileBufferSize, fin);
+ last_pos += available_in;
+ } while (available_in != 0);
+ assert(last_pos == input_size);
+}
+
+void BuildLCP(input_type* storage, sarray_type* sarray, lcp_type* lcp,
+ size_t size, uint32_t* pos) {
+ for (int i = 0; i < size; ++i) {
+ pos[sarray[i]] = i;
+ }
+ uint32_t k = 0;
+ lcp[size - 1] = 0;
+ for (int i = 0; i < size; ++i) {
+ if (pos[i] == size - 1) {
+ k = 0;
+ continue;
+ }
+ uint32_t j = sarray[pos[i] + 1]; // Suffix which follow i-th suffix in SA.
+ while (i + k < size && j + k < size && storage[i + k] == storage[j + k]) {
+ ++k;
+ }
+ lcp[pos[i]] = k;
+ if (k > 0) --k;
+ }
+}
+
+inline void PrintReference(sarray_type* sarray, lcp_type* lcp, size_t size,
+ int idx, int left_ix, int right_ix, int left_lcp,
+ int right_lcp, FILE* fout) {
+ int max_lcp_ix;
+ if (right_ix == size - 1 || (left_ix >= 0 && left_lcp >= right_lcp)) {
+ max_lcp_ix = left_ix;
+ } else {
+ max_lcp_ix = right_ix;
+ }
+ int dist = idx - sarray[max_lcp_ix];
+ assert(dist > 0);
+ fputc(1, fout);
+ fwrite(&idx, sizeof(int), 1, fout); // Position in input.
+ fwrite(&dist, sizeof(int), 1, fout); // Backward distance.
+}
+
+inline void GoLeft(sarray_type* sarray, lcp_type* lcp, int idx, int left_ix,
+ int left_lcp, entry_type* entry) {
+ entry->first = left_lcp;
+ if (left_lcp > FLAGS_long_length) return;
+ for (; left_ix >= 0; --left_ix) {
+ if (lcp[left_ix] < left_lcp) break;
+ if (sarray[left_ix] < idx) {
+ entry->second.push_back(idx - sarray[left_ix]);
+ }
+ }
+}
+
+inline void GoRight(sarray_type* sarray, lcp_type* lcp, int idx, size_t size,
+ int right_ix, int right_lcp, entry_type* entry) {
+ entry->first = right_lcp;
+ if (right_lcp > FLAGS_long_length) return;
+ for (; right_ix < size - 1; ++right_ix) {
+ if (lcp[right_ix] < right_lcp) break;
+ if (sarray[right_ix] < idx) {
+ entry->second.push_back(idx - sarray[right_ix]);
+ }
+ }
+}
+
+inline void StoreReference(sarray_type* sarray, lcp_type* lcp, size_t size,
+ int idx, int left_ix, int right_ix, int left_lcp,
+ int right_lcp, entry_type* entries) {
+ if (right_ix == size - 1 || (left_ix >= 0 && left_lcp > right_lcp)) {
+ // right is invalid or left is better
+ GoLeft(sarray, lcp, idx, left_ix, left_lcp, &entries[idx]);
+ } else if (left_ix < 0 || (right_ix < size - 1 && right_lcp > left_lcp)) {
+ // left is invalid or right is better
+ GoRight(sarray, lcp, idx, size, right_ix, right_lcp, &entries[idx]);
+ } else { // both are valid and of equal length
+ GoLeft(sarray, lcp, idx, left_ix, left_lcp, &entries[idx]);
+ GoRight(sarray, lcp, idx, size, right_ix, right_lcp, &entries[idx]);
+ }
+}
+
+void ProcessReferences(sarray_type* sarray, lcp_type* lcp, size_t size,
+ uint32_t* pos, const Fn& process_output) {
+ int min_length = FLAGS_min_length;
+ for (int idx = FLAGS_skip; idx < size; ++idx) {
+ int left_lcp = -1;
+ int left_ix;
+ for (left_ix = pos[idx] - 1; left_ix >= 0; --left_ix) {
+ if (left_lcp == -1 || left_lcp > lcp[left_ix]) {
+ left_lcp = lcp[left_ix];
+ }
+ if (left_lcp == 0) break;
+ if (sarray[left_ix] < idx) break;
+ }
+
+ int right_lcp = -1;
+ int right_ix;
+ for (right_ix = pos[idx]; right_ix < size - 1; ++right_ix) {
+ if (right_lcp == -1 || right_lcp > lcp[right_ix]) {
+ right_lcp = lcp[right_ix];
+ }
+ // Stop if we have better result from the left side already.
+ if (right_lcp < left_lcp && left_ix >= 0) break;
+ if (right_lcp == 0) break;
+ if (sarray[right_ix] < idx) break;
+ }
+
+ if ((left_ix >= 0 && left_lcp >= min_length) ||
+ (right_ix < size - 1 && right_lcp >= min_length)) {
+ process_output(sarray, lcp, size, idx, left_ix, right_ix, left_lcp,
+ right_lcp);
+ }
+ }
+}
+
+void ProcessEntries(entry_type* entries, size_t size, FILE* fout) {
+ int long_length = FLAGS_long_length;
+ std::vector<std::pair<int, int> > segments;
+ size_t idx;
+ for (idx = 0; idx < size;) {
+ entry_type& entry = entries[idx];
+ if (entry.first > long_length) {
+ // Add segment.
+ if (segments.empty() || segments.back().second < idx) {
+ segments.push_back({idx, idx + entry.first});
+ } else {
+ segments.back().second = idx + entry.first;
+ }
+ }
+ ++idx;
+ }
+ printf("Segments generated.\n");
+ size_t segments_ix = 0;
+ for (idx = 0; idx < size;) {
+ if (idx == segments[segments_ix].first) {
+ // Skip segment.
+ idx = segments[segments_ix].second;
+ } else {
+ for (auto& dist : entries[idx].second) {
+ fputc(1, fout);
+ fwrite(&idx, sizeof(int), 1, fout); // Position in input.
+ fwrite(&dist, sizeof(int), 1, fout); // Backward distance.
+ }
+ ++idx;
+ }
+ }
+}
+
+int main(int argc, char* argv[]) {
+ ParseCommandLineFlags(&argc, &argv, true);
+ if (argc != 3) {
+ printf("usage: %s input_file output_file\n", argv[0]);
+ return 1;
+ }
+
+ FILE* fin = fopen(argv[1], "rb");
+ FILE* fout = fopen(argv[2], "w");
+
+ fseek(fin, 0, SEEK_END);
+ int input_size = ftell(fin);
+ fseek(fin, 0, SEEK_SET);
+ printf("The file size is %u bytes\n", input_size);
+
+ input_type* storage = new input_type[input_size];
+
+ ReadInput(fin, storage, input_size);
+ fclose(fin);
+
+ sarray_type* sarray = new sarray_type[input_size];
+ saisxx(storage, sarray, input_size);
+ printf("Suffix array calculated.\n");
+
+ // Inverse suffix array.
+ uint32_t* pos = new uint32_t[input_size];
+
+ lcp_type* lcp = new lcp_type[input_size];
+ BuildLCP(storage, sarray, lcp, input_size, pos);
+ printf("LCP array constructed.\n");
+ delete[] storage;
+
+ using std::placeholders::_1;
+ using std::placeholders::_2;
+ using std::placeholders::_3;
+ using std::placeholders::_4;
+ using std::placeholders::_5;
+ using std::placeholders::_6;
+ using std::placeholders::_7;
+ using std::placeholders::_8;
+ entry_type* entries;
+ if (FLAGS_advanced) {
+ entries = new entry_type[input_size];
+ for (size_t i = 0; i < input_size; ++i) entries[i].first = -1;
+ }
+ Fn print = std::bind(PrintReference, _1, _2, _3, _4, _5, _6, _7, _8, fout);
+ Fn store = std::bind(StoreReference, _1, _2, _3, _4, _5, _6, _7, _8, entries);
+
+ ProcessReferences(sarray, lcp, input_size, pos,
+ FLAGS_advanced ? store : print);
+ printf("References processed.\n");
+
+ if (FLAGS_advanced) {
+ int good_cnt = 0;
+ uint64_t avg_cnt = 0;
+ for (size_t i = 0; i < input_size; ++i) {
+ if (entries[i].first != -1) {
+ ++good_cnt;
+ avg_cnt += entries[i].second.size();
+ }
+ }
+ printf("Number of covered positions = %d\n", good_cnt);
+ printf("Average number of references per covered position = %.4lf\n",
+ static_cast<double>(avg_cnt) / good_cnt);
+ ProcessEntries(entries, input_size, fout);
+ printf("Entries processed.\n");
+ }
+
+ fclose(fout);
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/img/enwik9_brotli.png b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/img/enwik9_brotli.png
new file mode 100644
index 000000000..c95eba967
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/img/enwik9_brotli.png
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/img/enwik9_diff.png b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/img/enwik9_diff.png
new file mode 100644
index 000000000..5df6748e8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/img/enwik9_diff.png
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/img/enwik9_opt.png b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/img/enwik9_opt.png
new file mode 100644
index 000000000..43c655d44
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/img/enwik9_opt.png
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/.gitignore b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/.gitignore
new file mode 100644
index 000000000..a0a066640
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/.gitignore
@@ -0,0 +1,32 @@
+# Object files
+*.o
+*.ko
+*.obj
+*.elf
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Libraries
+*.lib
+*.a
+*.la
+*.lo
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.out
+*.app
+*.i*86
+*.x86_64
+*.hex
+
+# CMake files/directories
+build/
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CHANGELOG.md b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CHANGELOG.md
new file mode 100644
index 000000000..fe9d00405
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CHANGELOG.md
@@ -0,0 +1,21 @@
+# libdivsufsort Change Log
+
+See full changelog at: https://github.com/y-256/libdivsufsort/commits
+
+## [2.0.1] - 2010-11-11
+### Fixed
+* Wrong variable used in `divbwt` function
+* Enclose some string variables with double quotation marks in include/CMakeLists.txt
+* Fix typo in include/CMakeLists.txt
+
+## 2.0.0 - 2008-08-23
+### Changed
+* Switch the build system to [CMake](http://www.cmake.org/)
+* Improve the performance of the suffix-sorting algorithm
+
+### Added
+* OpenMP support
+* 64-bit version of divsufsort
+
+[Unreleased]: https://github.com/y-256/libdivsufsort/compare/2.0.1...HEAD
+[2.0.1]: https://github.com/y-256/libdivsufsort/compare/2.0.0...2.0.1
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeLists.txt b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeLists.txt
new file mode 100644
index 000000000..785994393
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeLists.txt
@@ -0,0 +1,99 @@
+### cmake file for building libdivsufsort Package ###
+cmake_minimum_required(VERSION 2.4.4)
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
+include(AppendCompilerFlags)
+
+## Project information ##
+project(libdivsufsort C)
+set(PROJECT_VENDOR "Yuta Mori")
+set(PROJECT_CONTACT "yuta.256@gmail.com")
+set(PROJECT_URL "https://github.com/y-256/libdivsufsort")
+set(PROJECT_DESCRIPTION "A lightweight suffix sorting library")
+include(VERSION.cmake)
+
+## CPack configuration ##
+set(CPACK_GENERATOR "TGZ;TBZ2;ZIP")
+set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2;ZIP")
+include(ProjectCPack)
+
+## Project options ##
+option(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON)
+option(BUILD_EXAMPLES "Build examples" ON)
+option(BUILD_DIVSUFSORT64 "Build libdivsufsort64" OFF)
+option(USE_OPENMP "Use OpenMP for parallelization" OFF)
+option(WITH_LFS "Enable Large File Support" ON)
+
+## Installation directories ##
+set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32 or 64)")
+
+set(CMAKE_INSTALL_RUNTIMEDIR "" CACHE PATH "Specify the output directory for dll runtimes (default is bin)")
+if(NOT CMAKE_INSTALL_RUNTIMEDIR)
+ set(CMAKE_INSTALL_RUNTIMEDIR "${CMAKE_INSTALL_PREFIX}/bin")
+endif(NOT CMAKE_INSTALL_RUNTIMEDIR)
+
+set(CMAKE_INSTALL_LIBDIR "" CACHE PATH "Specify the output directory for libraries (default is lib)")
+if(NOT CMAKE_INSTALL_LIBDIR)
+ set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
+endif(NOT CMAKE_INSTALL_LIBDIR)
+
+set(CMAKE_INSTALL_INCLUDEDIR "" CACHE PATH "Specify the output directory for header files (default is include)")
+if(NOT CMAKE_INSTALL_INCLUDEDIR)
+ set(CMAKE_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include")
+endif(NOT CMAKE_INSTALL_INCLUDEDIR)
+
+set(CMAKE_INSTALL_PKGCONFIGDIR "" CACHE PATH "Specify the output directory for pkgconfig files (default is lib/pkgconfig)")
+if(NOT CMAKE_INSTALL_PKGCONFIGDIR)
+ set(CMAKE_INSTALL_PKGCONFIGDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+endif(NOT CMAKE_INSTALL_PKGCONFIGDIR)
+
+## Build type ##
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Release")
+elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ set(CMAKE_VERBOSE_MAKEFILE ON)
+endif(NOT CMAKE_BUILD_TYPE)
+
+## Compiler options ##
+if(MSVC)
+ append_c_compiler_flags("/W4" "VC" CMAKE_C_FLAGS)
+ append_c_compiler_flags("/Oi;/Ot;/Ox;/Oy" "VC" CMAKE_C_FLAGS_RELEASE)
+ if(USE_OPENMP)
+ append_c_compiler_flags("/openmp" "VC" CMAKE_C_FLAGS)
+ endif(USE_OPENMP)
+elseif(BORLAND)
+ append_c_compiler_flags("-w" "BCC" CMAKE_C_FLAGS)
+ append_c_compiler_flags("-Oi;-Og;-Os;-Ov;-Ox" "BCC" CMAKE_C_FLAGS_RELEASE)
+else(MSVC)
+ if(CMAKE_COMPILER_IS_GNUCC)
+ append_c_compiler_flags("-Wall" "GCC" CMAKE_C_FLAGS)
+ append_c_compiler_flags("-fomit-frame-pointer" "GCC" CMAKE_C_FLAGS_RELEASE)
+ if(USE_OPENMP)
+ append_c_compiler_flags("-fopenmp" "GCC" CMAKE_C_FLAGS)
+ endif(USE_OPENMP)
+ else(CMAKE_COMPILER_IS_GNUCC)
+ append_c_compiler_flags("-Wall" "UNKNOWN" CMAKE_C_FLAGS)
+ append_c_compiler_flags("-fomit-frame-pointer" "UNKNOWN" CMAKE_C_FLAGS_RELEASE)
+ if(USE_OPENMP)
+ append_c_compiler_flags("-fopenmp;-openmp;-omp" "UNKNOWN" CMAKE_C_FLAGS)
+ endif(USE_OPENMP)
+ endif(CMAKE_COMPILER_IS_GNUCC)
+endif(MSVC)
+
+## Add definitions ##
+add_definitions(-DHAVE_CONFIG_H=1 -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS)
+
+## Add subdirectories ##
+add_subdirectory(pkgconfig)
+add_subdirectory(include)
+add_subdirectory(lib)
+if(BUILD_EXAMPLES)
+ add_subdirectory(examples)
+endif(BUILD_EXAMPLES)
+
+## Add 'uninstall' target ##
+CONFIGURE_FILE(
+ "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/CMakeModules/cmake_uninstall.cmake"
+ IMMEDIATE @ONLY)
+ADD_CUSTOM_TARGET(uninstall
+ "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/CMakeModules/cmake_uninstall.cmake")
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/AppendCompilerFlags.cmake b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/AppendCompilerFlags.cmake
new file mode 100644
index 000000000..58d3f99ec
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/AppendCompilerFlags.cmake
@@ -0,0 +1,38 @@
+include(CheckCSourceCompiles)
+include(CheckCXXSourceCompiles)
+
+macro(append_c_compiler_flags _flags _name _result)
+ set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ string(REGEX REPLACE "[-+/ ]" "_" cname "${_name}")
+ string(TOUPPER "${cname}" cname)
+ foreach(flag ${_flags})
+ string(REGEX REPLACE "^[-+/ ]+(.*)[-+/ ]*$" "\\1" flagname "${flag}")
+ string(REGEX REPLACE "[-+/ ]" "_" flagname "${flagname}")
+ string(TOUPPER "${flagname}" flagname)
+ set(have_flag "HAVE_${cname}_${flagname}")
+ set(CMAKE_REQUIRED_FLAGS "${flag}")
+ check_c_source_compiles("int main() { return 0; }" ${have_flag})
+ if(${have_flag})
+ set(${_result} "${${_result}} ${flag}")
+ endif(${have_flag})
+ endforeach(flag)
+ set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS})
+endmacro(append_c_compiler_flags)
+
+macro(append_cxx_compiler_flags _flags _name _result)
+ set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ string(REGEX REPLACE "[-+/ ]" "_" cname "${_name}")
+ string(TOUPPER "${cname}" cname)
+ foreach(flag ${_flags})
+ string(REGEX REPLACE "^[-+/ ]+(.*)[-+/ ]*$" "\\1" flagname "${flag}")
+ string(REGEX REPLACE "[-+/ ]" "_" flagname "${flagname}")
+ string(TOUPPER "${flagname}" flagname)
+ set(have_flag "HAVE_${cname}_${flagname}")
+ set(CMAKE_REQUIRED_FLAGS "${flag}")
+ check_cxx_source_compiles("int main() { return 0; }" ${have_flag})
+ if(${have_flag})
+ set(${_result} "${${_result}} ${flag}")
+ endif(${have_flag})
+ endforeach(flag)
+ set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS})
+endmacro(append_cxx_compiler_flags)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/CheckFunctionKeywords.cmake b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/CheckFunctionKeywords.cmake
new file mode 100644
index 000000000..44601fd4e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/CheckFunctionKeywords.cmake
@@ -0,0 +1,15 @@
+include(CheckCSourceCompiles)
+
+macro(check_function_keywords _wordlist)
+ set(${_result} "")
+ foreach(flag ${_wordlist})
+ string(REGEX REPLACE "[-+/ ()]" "_" flagname "${flag}")
+ string(TOUPPER "${flagname}" flagname)
+ set(have_flag "HAVE_${flagname}")
+ check_c_source_compiles("${flag} void func(); void func() { } int main() { func(); return 0; }" ${have_flag})
+ if(${have_flag} AND NOT ${_result})
+ set(${_result} "${flag}")
+# break()
+ endif(${have_flag} AND NOT ${_result})
+ endforeach(flag)
+endmacro(check_function_keywords)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/CheckLFS.cmake b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/CheckLFS.cmake
new file mode 100644
index 000000000..e2b009914
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/CheckLFS.cmake
@@ -0,0 +1,109 @@
+## Checks for large file support ##
+include(CheckIncludeFile)
+include(CheckSymbolExists)
+include(CheckTypeSize)
+
+macro(check_lfs _isenable)
+ set(LFS_OFF_T "")
+ set(LFS_FOPEN "")
+ set(LFS_FSEEK "")
+ set(LFS_FTELL "")
+ set(LFS_PRID "")
+
+ if(${_isenable})
+ set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
+ set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ -D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=64
+ -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS)
+
+ check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
+ check_include_file("inttypes.h" HAVE_INTTYPES_H)
+ check_include_file("stddef.h" HAVE_STDDEF_H)
+ check_include_file("stdint.h" HAVE_STDINT_H)
+
+ # LFS type1: 8 <= sizeof(off_t), fseeko, ftello
+ check_type_size("off_t" SIZEOF_OFF_T)
+ if(SIZEOF_OFF_T GREATER 7)
+ check_symbol_exists("fseeko" "stdio.h" HAVE_FSEEKO)
+ check_symbol_exists("ftello" "stdio.h" HAVE_FTELLO)
+ if(HAVE_FSEEKO AND HAVE_FTELLO)
+ set(LFS_OFF_T "off_t")
+ set(LFS_FOPEN "fopen")
+ set(LFS_FSEEK "fseeko")
+ set(LFS_FTELL "ftello")
+ check_symbol_exists("PRIdMAX" "inttypes.h" HAVE_PRIDMAX)
+ if(HAVE_PRIDMAX)
+ set(LFS_PRID "PRIdMAX")
+ else(HAVE_PRIDMAX)
+ check_type_size("long" SIZEOF_LONG)
+ check_type_size("int" SIZEOF_INT)
+ if(SIZEOF_OFF_T GREATER SIZEOF_LONG)
+ set(LFS_PRID "\"lld\"")
+ elseif(SIZEOF_LONG GREATER SIZEOF_INT)
+ set(LFS_PRID "\"ld\"")
+ else(SIZEOF_OFF_T GREATER SIZEOF_LONG)
+ set(LFS_PRID "\"d\"")
+ endif(SIZEOF_OFF_T GREATER SIZEOF_LONG)
+ endif(HAVE_PRIDMAX)
+ endif(HAVE_FSEEKO AND HAVE_FTELLO)
+ endif(SIZEOF_OFF_T GREATER 7)
+
+ # LFS type2: 8 <= sizeof(off64_t), fopen64, fseeko64, ftello64
+ if(NOT LFS_OFF_T)
+ check_type_size("off64_t" SIZEOF_OFF64_T)
+ if(SIZEOF_OFF64_T GREATER 7)
+ check_symbol_exists("fopen64" "stdio.h" HAVE_FOPEN64)
+ check_symbol_exists("fseeko64" "stdio.h" HAVE_FSEEKO64)
+ check_symbol_exists("ftello64" "stdio.h" HAVE_FTELLO64)
+ if(HAVE_FOPEN64 AND HAVE_FSEEKO64 AND HAVE_FTELLO64)
+ set(LFS_OFF_T "off64_t")
+ set(LFS_FOPEN "fopen64")
+ set(LFS_FSEEK "fseeko64")
+ set(LFS_FTELL "ftello64")
+ check_symbol_exists("PRIdMAX" "inttypes.h" HAVE_PRIDMAX)
+ if(HAVE_PRIDMAX)
+ set(LFS_PRID "PRIdMAX")
+ else(HAVE_PRIDMAX)
+ check_type_size("long" SIZEOF_LONG)
+ check_type_size("int" SIZEOF_INT)
+ if(SIZEOF_OFF64_T GREATER SIZEOF_LONG)
+ set(LFS_PRID "\"lld\"")
+ elseif(SIZEOF_LONG GREATER SIZEOF_INT)
+ set(LFS_PRID "\"ld\"")
+ else(SIZEOF_OFF64_T GREATER SIZEOF_LONG)
+ set(LFS_PRID "\"d\"")
+ endif(SIZEOF_OFF64_T GREATER SIZEOF_LONG)
+ endif(HAVE_PRIDMAX)
+ endif(HAVE_FOPEN64 AND HAVE_FSEEKO64 AND HAVE_FTELLO64)
+ endif(SIZEOF_OFF64_T GREATER 7)
+ endif(NOT LFS_OFF_T)
+
+ # LFS type3: 8 <= sizeof(__int64), _fseeki64, _ftelli64
+ if(NOT LFS_OFF_T)
+ check_type_size("__int64" SIZEOF___INT64)
+ if(SIZEOF___INT64 GREATER 7)
+ check_symbol_exists("_fseeki64" "stdio.h" HAVE__FSEEKI64)
+ check_symbol_exists("_ftelli64" "stdio.h" HAVE__FTELLI64)
+ if(HAVE__FSEEKI64 AND HAVE__FTELLI64)
+ set(LFS_OFF_T "__int64")
+ set(LFS_FOPEN "fopen")
+ set(LFS_FSEEK "_fseeki64")
+ set(LFS_FTELL "_ftelli64")
+ set(LFS_PRID "\"I64d\"")
+ endif(HAVE__FSEEKI64 AND HAVE__FTELLI64)
+ endif(SIZEOF___INT64 GREATER 7)
+ endif(NOT LFS_OFF_T)
+
+ set(CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
+ endif(${_isenable})
+
+ if(NOT LFS_OFF_T)
+ ## not found
+ set(LFS_OFF_T "long")
+ set(LFS_FOPEN "fopen")
+ set(LFS_FSEEK "fseek")
+ set(LFS_FTELL "ftell")
+ set(LFS_PRID "\"ld\"")
+ endif(NOT LFS_OFF_T)
+
+endmacro(check_lfs)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/ProjectCPack.cmake b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/ProjectCPack.cmake
new file mode 100644
index 000000000..7c105f933
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/ProjectCPack.cmake
@@ -0,0 +1,38 @@
+# If the cmake version includes cpack, use it
+IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
+ SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
+ SET(CPACK_PACKAGE_VENDOR "${PROJECT_VENDOR}")
+ SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
+ SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
+ SET(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
+ SET(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
+ SET(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
+# SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${PROJECT_VERSION}")
+ SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION_FULL}")
+
+ IF(NOT DEFINED CPACK_SYSTEM_NAME)
+ SET(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
+ ENDIF(NOT DEFINED CPACK_SYSTEM_NAME)
+
+ IF(${CPACK_SYSTEM_NAME} MATCHES Windows)
+ IF(CMAKE_CL_64)
+ SET(CPACK_SYSTEM_NAME win64-${CMAKE_SYSTEM_PROCESSOR})
+ ELSE(CMAKE_CL_64)
+ SET(CPACK_SYSTEM_NAME win32-${CMAKE_SYSTEM_PROCESSOR})
+ ENDIF(CMAKE_CL_64)
+ ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows)
+
+ IF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
+ SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
+ ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
+
+ SET(CPACK_PACKAGE_CONTACT "${PROJECT_CONTACT}")
+ IF(UNIX)
+ SET(CPACK_STRIP_FILES "")
+ SET(CPACK_SOURCE_STRIP_FILES "")
+# SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
+ ENDIF(UNIX)
+ SET(CPACK_SOURCE_IGNORE_FILES "/CVS/" "/build/" "/\\\\.build/" "/\\\\.svn/" "~$")
+ # include CPack model once all variables are set
+ INCLUDE(CPack)
+ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/cmake_uninstall.cmake.in b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/cmake_uninstall.cmake.in
new file mode 100644
index 000000000..8366a8353
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/CMakeModules/cmake_uninstall.cmake.in
@@ -0,0 +1,36 @@
+IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+ MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
+ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+STRING(REGEX REPLACE "\n" ";" files "${files}")
+
+SET(NUM 0)
+FOREACH(file ${files})
+ IF(EXISTS "$ENV{DESTDIR}${file}")
+ MESSAGE(STATUS "Looking for \"$ENV{DESTDIR}${file}\" - found")
+ SET(UNINSTALL_CHECK_${NUM} 1)
+ ELSE(EXISTS "$ENV{DESTDIR}${file}")
+ MESSAGE(STATUS "Looking for \"$ENV{DESTDIR}${file}\" - not found")
+ SET(UNINSTALL_CHECK_${NUM} 0)
+ ENDIF(EXISTS "$ENV{DESTDIR}${file}")
+ MATH(EXPR NUM "1 + ${NUM}")
+ENDFOREACH(file)
+
+SET(NUM 0)
+FOREACH(file ${files})
+ IF(${UNINSTALL_CHECK_${NUM}})
+ MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
+ EXEC_PROGRAM(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF(NOT "${rm_retval}" STREQUAL 0)
+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+ ENDIF(NOT "${rm_retval}" STREQUAL 0)
+ ENDIF(${UNINSTALL_CHECK_${NUM}})
+ MATH(EXPR NUM "1 + ${NUM}")
+ENDFOREACH(file)
+
+FILE(REMOVE "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/LICENSE b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/LICENSE
new file mode 100644
index 000000000..249efa49a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2003 Yuta Mori All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/README.md b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/README.md
new file mode 100644
index 000000000..381a18888
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/README.md
@@ -0,0 +1,140 @@
+# libdivsufsort
+
+libdivsufsort is a software library that implements a lightweight suffix array construction algorithm.
+
+## News
+* 2015-03-21: The project has moved from [Google Code](http://code.google.com/p/libdivsufsort/) to [GitHub](https://github.com/y-256/libdivsufsort)
+
+## Introduction
+This library provides a simple and an efficient C API to construct a suffix array and a Burrows-Wheeler transformed string from a given string over a constant-size alphabet.
+The algorithm runs in O(n log n) worst-case time using only 5n+O(1) bytes of memory space, where n is the length of
+the string.
+
+## Build requirements
+* An ANSI C Compiler (e.g. GNU GCC)
+* [CMake](http://www.cmake.org/ "CMake") version 2.4.2 or newer
+* CMake-supported build tool
+
+## Building on GNU/Linux
+1. Get the source code from GitHub. You can either
+ * use git to clone the repository
+ ```
+ git clone https://github.com/y-256/libdivsufsort.git
+ ```
+ * or download a [zip file](../../archive/master.zip) directly
+2. Create a `build` directory in the package source directory.
+```shell
+$ cd libdivsufsort
+$ mkdir build
+$ cd build
+```
+3. Configure the package for your system.
+If you want to install to a different location, change the -DCMAKE_INSTALL_PREFIX option.
+```shell
+$ cmake -DCMAKE_BUILD_TYPE="Release" \
+-DCMAKE_INSTALL_PREFIX="/usr/local" ..
+```
+4. Compile the package.
+```shell
+$ make
+```
+5. (Optional) Install the library and header files.
+```shell
+$ sudo make install
+```
+
+## API
+```c
+/* Data types */
+typedef int32_t saint_t;
+typedef int32_t saidx_t;
+typedef uint8_t sauchar_t;
+
+/*
+ * Constructs the suffix array of a given string.
+ * @param T[0..n-1] The input string.
+ * @param SA[0..n-1] The output array or suffixes.
+ * @param n The length of the given string.
+ * @return 0 if no error occurred, -1 or -2 otherwise.
+ */
+saint_t
+divsufsort(const sauchar_t *T, saidx_t *SA, saidx_t n);
+
+/*
+ * Constructs the burrows-wheeler transformed string of a given string.
+ * @param T[0..n-1] The input string.
+ * @param U[0..n-1] The output string. (can be T)
+ * @param A[0..n-1] The temporary array. (can be NULL)
+ * @param n The length of the given string.
+ * @return The primary index if no error occurred, -1 or -2 otherwise.
+ */
+saidx_t
+divbwt(const sauchar_t *T, sauchar_t *U, saidx_t *A, saidx_t n);
+```
+
+## Example Usage
+```c
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <divsufsort.h>
+
+int main() {
+ // intput data
+ char *Text = "abracadabra";
+ int n = strlen(Text);
+ int i, j;
+
+ // allocate
+ int *SA = (int *)malloc(n * sizeof(int));
+
+ // sort
+ divsufsort((unsigned char *)Text, SA, n);
+
+ // output
+ for(i = 0; i < n; ++i) {
+ printf("SA[%2d] = %2d: ", i, SA[i]);
+ for(j = SA[i]; j < n; ++j) {
+ printf("%c", Text[j]);
+ }
+ printf("$\n");
+ }
+
+ // deallocate
+ free(SA);
+
+ return 0;
+}
+```
+See the [examples](examples) directory for a few other examples.
+
+## Benchmarks
+See [Benchmarks](https://github.com/y-256/libdivsufsort/blob/wiki/SACA_Benchmarks.md) page for details.
+
+## License
+libdivsufsort is released under the [MIT license](LICENSE "MIT license").
+> The MIT License (MIT)
+>
+> Copyright (c) 2003 Yuta Mori All rights reserved.
+>
+> Permission is hereby granted, free of charge, to any person obtaining a copy
+> of this software and associated documentation files (the "Software"), to deal
+> in the Software without restriction, including without limitation the rights
+> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+> copies of the Software, and to permit persons to whom the Software is
+> furnished to do so, subject to the following conditions:
+>
+> The above copyright notice and this permission notice shall be included in all
+> copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+> SOFTWARE.
+
+## Author
+* Yuta Mori
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/VERSION.cmake b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/VERSION.cmake
new file mode 100644
index 000000000..3f11ac18c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/VERSION.cmake
@@ -0,0 +1,23 @@
+set(PROJECT_VERSION_MAJOR "2")
+set(PROJECT_VERSION_MINOR "0")
+set(PROJECT_VERSION_PATCH "2")
+set(PROJECT_VERSION_EXTRA "-1")
+set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
+set(PROJECT_VERSION_FULL "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${PROJECT_VERSION_EXTRA}")
+
+set(LIBRARY_VERSION "3.0.1")
+set(LIBRARY_SOVERSION "3")
+
+## Git revision number ##
+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
+ execute_process(COMMAND git describe --tags HEAD
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ OUTPUT_VARIABLE GIT_DESCRIBE_TAGS ERROR_QUIET)
+ if(GIT_DESCRIBE_TAGS)
+ string(REGEX REPLACE "^v(.*)" "\\1" GIT_REVISION "${GIT_DESCRIBE_TAGS}")
+ string(STRIP "${GIT_REVISION}" GIT_REVISION)
+ if(GIT_REVISION)
+ set(PROJECT_VERSION_FULL "${GIT_REVISION}")
+ endif(GIT_REVISION)
+ endif(GIT_DESCRIBE_TAGS)
+endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/CMakeLists.txt b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/CMakeLists.txt
new file mode 100644
index 000000000..e801c81a4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/CMakeLists.txt
@@ -0,0 +1,11 @@
+## Add definitions ##
+add_definitions(-D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=64)
+
+## Targets ##
+include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include"
+ "${CMAKE_CURRENT_BINARY_DIR}/../include")
+link_directories("${CMAKE_CURRENT_BINARY_DIR}/../lib")
+foreach(src suftest mksary sasearch bwt unbwt)
+ add_executable(${src} ${src}.c)
+ target_link_libraries(${src} divsufsort)
+endforeach(src)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/bwt.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/bwt.c
new file mode 100644
index 000000000..5a362d017
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/bwt.c
@@ -0,0 +1,220 @@
+/*
+ * bwt.c for libdivsufsort
+ * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include <stdio.h>
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#if HAVE_MEMORY_H
+# include <memory.h>
+#endif
+#if HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_IO_H && HAVE_FCNTL_H
+# include <io.h>
+# include <fcntl.h>
+#endif
+#include <time.h>
+#include <divsufsort.h>
+#include "lfs.h"
+
+
+static
+size_t
+write_int(FILE *fp, saidx_t n) {
+ unsigned char c[4];
+ c[0] = (unsigned char)((n >> 0) & 0xff), c[1] = (unsigned char)((n >> 8) & 0xff),
+ c[2] = (unsigned char)((n >> 16) & 0xff), c[3] = (unsigned char)((n >> 24) & 0xff);
+ return fwrite(c, sizeof(unsigned char), 4, fp);
+}
+
+static
+void
+print_help(const char *progname, int status) {
+ fprintf(stderr,
+ "bwt, a burrows-wheeler transform program, version %s.\n",
+ divsufsort_version());
+ fprintf(stderr, "usage: %s [-b num] INFILE OUTFILE\n", progname);
+ fprintf(stderr, " -b num set block size to num MiB [1..512] (default: 32)\n\n");
+ exit(status);
+}
+
+int
+main(int argc, const char *argv[]) {
+ FILE *fp, *ofp;
+ const char *fname, *ofname;
+ sauchar_t *T;
+ saidx_t *SA;
+ LFS_OFF_T n;
+ size_t m;
+ saidx_t pidx;
+ clock_t start,finish;
+ saint_t i, blocksize = 32, needclose = 3;
+
+ /* Check arguments. */
+ if((argc == 1) ||
+ (strcmp(argv[1], "-h") == 0) ||
+ (strcmp(argv[1], "--help") == 0)) { print_help(argv[0], EXIT_SUCCESS); }
+ if((argc != 3) && (argc != 5)) { print_help(argv[0], EXIT_FAILURE); }
+ i = 1;
+ if(argc == 5) {
+ if(strcmp(argv[i], "-b") != 0) { print_help(argv[0], EXIT_FAILURE); }
+ blocksize = atoi(argv[i + 1]);
+ if(blocksize < 0) { blocksize = 1; }
+ else if(512 < blocksize) { blocksize = 512; }
+ i += 2;
+ }
+ blocksize <<= 20;
+
+ /* Open a file for reading. */
+ if(strcmp(argv[i], "-") != 0) {
+#if HAVE_FOPEN_S
+ if(fopen_s(&fp, fname = argv[i], "rb") != 0) {
+#else
+ if((fp = LFS_FOPEN(fname = argv[i], "rb")) == NULL) {
+#endif
+ fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+#if HAVE__SETMODE && HAVE__FILENO
+ if(_setmode(_fileno(stdin), _O_BINARY) == -1) {
+ fprintf(stderr, "%s: Cannot set mode: ", argv[0]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+#endif
+ fp = stdin;
+ fname = "stdin";
+ needclose ^= 1;
+ }
+ i += 1;
+
+ /* Open a file for writing. */
+ if(strcmp(argv[i], "-") != 0) {
+#if HAVE_FOPEN_S
+ if(fopen_s(&ofp, ofname = argv[i], "wb") != 0) {
+#else
+ if((ofp = LFS_FOPEN(ofname = argv[i], "wb")) == NULL) {
+#endif
+ fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], ofname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+#if HAVE__SETMODE && HAVE__FILENO
+ if(_setmode(_fileno(stdout), _O_BINARY) == -1) {
+ fprintf(stderr, "%s: Cannot set mode: ", argv[0]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+#endif
+ ofp = stdout;
+ ofname = "stdout";
+ needclose ^= 2;
+ }
+
+ /* Get the file size. */
+ if(LFS_FSEEK(fp, 0, SEEK_END) == 0) {
+ n = LFS_FTELL(fp);
+ rewind(fp);
+ if(n < 0) {
+ fprintf(stderr, "%s: Cannot ftell `%s': ", argv[0], fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ if(0x20000000L < n) { n = 0x20000000L; }
+ if((blocksize == 0) || (n < blocksize)) { blocksize = (saidx_t)n; }
+ } else if(blocksize == 0) { blocksize = 32 << 20; }
+
+ /* Allocate 5blocksize bytes of memory. */
+ T = (sauchar_t *)malloc(blocksize * sizeof(sauchar_t));
+ SA = (saidx_t *)malloc(blocksize * sizeof(saidx_t));
+ if((T == NULL) || (SA == NULL)) {
+ fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ /* Write the blocksize. */
+ if(write_int(ofp, blocksize) != 4) {
+ fprintf(stderr, "%s: Cannot write to `%s': ", argv[0], ofname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+
+ fprintf(stderr, " BWT (blocksize %" PRIdSAINT_T ") ... ", blocksize);
+ start = clock();
+ for(n = 0; 0 < (m = fread(T, sizeof(sauchar_t), blocksize, fp)); n += m) {
+ /* Burrows-Wheeler Transform. */
+ pidx = divbwt(T, T, SA, m);
+ if(pidx < 0) {
+ fprintf(stderr, "%s (bw_transform): %s.\n",
+ argv[0],
+ (pidx == -1) ? "Invalid arguments" : "Cannot allocate memory");
+ exit(EXIT_FAILURE);
+ }
+
+ /* Write the bwted data. */
+ if((write_int(ofp, pidx) != 4) ||
+ (fwrite(T, sizeof(sauchar_t), m, ofp) != m)) {
+ fprintf(stderr, "%s: Cannot write to `%s': ", argv[0], ofname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ }
+ if(ferror(fp)) {
+ fprintf(stderr, "%s: Cannot read from `%s': ", argv[0], fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ finish = clock();
+ fprintf(stderr, "%" PRIdOFF_T " bytes: %.4f sec\n",
+ n, (double)(finish - start) / (double)CLOCKS_PER_SEC);
+
+ /* Close files */
+ if(needclose & 1) { fclose(fp); }
+ if(needclose & 2) { fclose(ofp); }
+
+ /* Deallocate memory. */
+ free(SA);
+ free(T);
+
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/mksary.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/mksary.c
new file mode 100644
index 000000000..b48177cf8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/mksary.c
@@ -0,0 +1,193 @@
+/*
+ * mksary.c for libdivsufsort
+ * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include <stdio.h>
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#if HAVE_MEMORY_H
+# include <memory.h>
+#endif
+#if HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_IO_H && HAVE_FCNTL_H
+# include <io.h>
+# include <fcntl.h>
+#endif
+#include <time.h>
+#include <divsufsort.h>
+#include "lfs.h"
+
+
+static
+void
+print_help(const char *progname, int status) {
+ fprintf(stderr,
+ "mksary, a simple suffix array builder, version %s.\n",
+ divsufsort_version());
+ fprintf(stderr, "usage: %s INFILE OUTFILE\n\n", progname);
+ exit(status);
+}
+
+int
+main(int argc, const char *argv[]) {
+ FILE *fp, *ofp;
+ const char *fname, *ofname;
+ sauchar_t *T;
+ saidx_t *SA;
+ LFS_OFF_T n;
+ clock_t start, finish;
+ saint_t needclose = 3;
+
+ /* Check arguments. */
+ if((argc == 1) ||
+ (strcmp(argv[1], "-h") == 0) ||
+ (strcmp(argv[1], "--help") == 0)) { print_help(argv[0], EXIT_SUCCESS); }
+ if(argc != 3) { print_help(argv[0], EXIT_FAILURE); }
+
+ /* Open a file for reading. */
+ if(strcmp(argv[1], "-") != 0) {
+#if HAVE_FOPEN_S
+ if(fopen_s(&fp, fname = argv[1], "rb") != 0) {
+#else
+ if((fp = LFS_FOPEN(fname = argv[1], "rb")) == NULL) {
+#endif
+ fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+#if HAVE__SETMODE && HAVE__FILENO
+ if(_setmode(_fileno(stdin), _O_BINARY) == -1) {
+ fprintf(stderr, "%s: Cannot set mode: ", argv[0]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+#endif
+ fp = stdin;
+ fname = "stdin";
+ needclose ^= 1;
+ }
+
+ /* Open a file for writing. */
+ if(strcmp(argv[2], "-") != 0) {
+#if HAVE_FOPEN_S
+ if(fopen_s(&ofp, ofname = argv[2], "wb") != 0) {
+#else
+ if((ofp = LFS_FOPEN(ofname = argv[2], "wb")) == NULL) {
+#endif
+ fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], ofname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+#if HAVE__SETMODE && HAVE__FILENO
+ if(_setmode(_fileno(stdout), _O_BINARY) == -1) {
+ fprintf(stderr, "%s: Cannot set mode: ", argv[0]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+#endif
+ ofp = stdout;
+ ofname = "stdout";
+ needclose ^= 2;
+ }
+
+ /* Get the file size. */
+ if(LFS_FSEEK(fp, 0, SEEK_END) == 0) {
+ n = LFS_FTELL(fp);
+ rewind(fp);
+ if(n < 0) {
+ fprintf(stderr, "%s: Cannot ftell `%s': ", argv[0], fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ if(0x7fffffff <= n) {
+ fprintf(stderr, "%s: Input file `%s' is too big.\n", argv[0], fname);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ fprintf(stderr, "%s: Cannot fseek `%s': ", argv[0], fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+
+ /* Allocate 5blocksize bytes of memory. */
+ T = (sauchar_t *)malloc((size_t)n * sizeof(sauchar_t));
+ SA = (saidx_t *)malloc((size_t)n * sizeof(saidx_t));
+ if((T == NULL) || (SA == NULL)) {
+ fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ /* Read n bytes of data. */
+ if(fread(T, sizeof(sauchar_t), (size_t)n, fp) != (size_t)n) {
+ fprintf(stderr, "%s: %s `%s': ",
+ argv[0],
+ (ferror(fp) || !feof(fp)) ? "Cannot read from" : "Unexpected EOF in",
+ fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ if(needclose & 1) { fclose(fp); }
+
+ /* Construct the suffix array. */
+ fprintf(stderr, "%s: %" PRIdOFF_T " bytes ... ", fname, n);
+ start = clock();
+ if(divsufsort(T, SA, (saidx_t)n) != 0) {
+ fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+ finish = clock();
+ fprintf(stderr, "%.4f sec\n", (double)(finish - start) / (double)CLOCKS_PER_SEC);
+
+ /* Write the suffix array. */
+ if(fwrite(SA, sizeof(saidx_t), (size_t)n, ofp) != (size_t)n) {
+ fprintf(stderr, "%s: Cannot write to `%s': ", argv[0], ofname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ if(needclose & 2) { fclose(ofp); }
+
+ /* Deallocate memory. */
+ free(SA);
+ free(T);
+
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/sasearch.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/sasearch.c
new file mode 100644
index 000000000..7e5ca4fe0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/sasearch.c
@@ -0,0 +1,165 @@
+/*
+ * sasearch.c for libdivsufsort
+ * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include <stdio.h>
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#if HAVE_MEMORY_H
+# include <memory.h>
+#endif
+#if HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_IO_H && HAVE_FCNTL_H
+# include <io.h>
+# include <fcntl.h>
+#endif
+#include <divsufsort.h>
+#include "lfs.h"
+
+
+static
+void
+print_help(const char *progname, int status) {
+ fprintf(stderr,
+ "sasearch, a simple SA-based full-text search tool, version %s\n",
+ divsufsort_version());
+ fprintf(stderr, "usage: %s PATTERN FILE SAFILE\n\n", progname);
+ exit(status);
+}
+
+int
+main(int argc, const char *argv[]) {
+ FILE *fp;
+ const char *P;
+ sauchar_t *T;
+ saidx_t *SA;
+ LFS_OFF_T n;
+ size_t Psize;
+ saidx_t i, size, left;
+
+ if((argc == 1) ||
+ (strcmp(argv[1], "-h") == 0) ||
+ (strcmp(argv[1], "--help") == 0)) { print_help(argv[0], EXIT_SUCCESS); }
+ if(argc != 4) { print_help(argv[0], EXIT_FAILURE); }
+
+ P = argv[1];
+ Psize = strlen(P);
+
+ /* Open a file for reading. */
+#if HAVE_FOPEN_S
+ if(fopen_s(&fp, argv[2], "rb") != 0) {
+#else
+ if((fp = LFS_FOPEN(argv[2], "rb")) == NULL) {
+#endif
+ fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], argv[2]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+
+ /* Get the file size. */
+ if(LFS_FSEEK(fp, 0, SEEK_END) == 0) {
+ n = LFS_FTELL(fp);
+ rewind(fp);
+ if(n < 0) {
+ fprintf(stderr, "%s: Cannot ftell `%s': ", argv[0], argv[2]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ fprintf(stderr, "%s: Cannot fseek `%s': ", argv[0], argv[2]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+
+ /* Allocate 5n bytes of memory. */
+ T = (sauchar_t *)malloc((size_t)n * sizeof(sauchar_t));
+ SA = (saidx_t *)malloc((size_t)n * sizeof(saidx_t));
+ if((T == NULL) || (SA == NULL)) {
+ fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ /* Read n bytes of data. */
+ if(fread(T, sizeof(sauchar_t), (size_t)n, fp) != (size_t)n) {
+ fprintf(stderr, "%s: %s `%s': ",
+ argv[0],
+ (ferror(fp) || !feof(fp)) ? "Cannot read from" : "Unexpected EOF in",
+ argv[2]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ fclose(fp);
+
+ /* Open the SA file for reading. */
+#if HAVE_FOPEN_S
+ if(fopen_s(&fp, argv[3], "rb") != 0) {
+#else
+ if((fp = LFS_FOPEN(argv[3], "rb")) == NULL) {
+#endif
+ fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], argv[3]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+
+ /* Read n * sizeof(saidx_t) bytes of data. */
+ if(fread(SA, sizeof(saidx_t), (size_t)n, fp) != (size_t)n) {
+ fprintf(stderr, "%s: %s `%s': ",
+ argv[0],
+ (ferror(fp) || !feof(fp)) ? "Cannot read from" : "Unexpected EOF in",
+ argv[3]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ fclose(fp);
+
+ /* Search and print */
+ size = sa_search(T, (saidx_t)n,
+ (const sauchar_t *)P, (saidx_t)Psize,
+ SA, (saidx_t)n, &left);
+ for(i = 0; i < size; ++i) {
+ fprintf(stdout, "%" PRIdSAIDX_T "\n", SA[left + i]);
+ }
+
+ /* Deallocate memory. */
+ free(SA);
+ free(T);
+
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/suftest.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/suftest.c
new file mode 100644
index 000000000..71892ac17
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/suftest.c
@@ -0,0 +1,164 @@
+/*
+ * suftest.c for libdivsufsort
+ * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include <stdio.h>
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#if HAVE_MEMORY_H
+# include <memory.h>
+#endif
+#if HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_IO_H && HAVE_FCNTL_H
+# include <io.h>
+# include <fcntl.h>
+#endif
+#include <time.h>
+#include <divsufsort.h>
+#include "lfs.h"
+
+
+static
+void
+print_help(const char *progname, int status) {
+ fprintf(stderr,
+ "suftest, a suffixsort tester, version %s.\n",
+ divsufsort_version());
+ fprintf(stderr, "usage: %s FILE\n\n", progname);
+ exit(status);
+}
+
+int
+main(int argc, const char *argv[]) {
+ FILE *fp;
+ const char *fname;
+ sauchar_t *T;
+ saidx_t *SA;
+ LFS_OFF_T n;
+ clock_t start, finish;
+ saint_t needclose = 1;
+
+ /* Check arguments. */
+ if((argc == 1) ||
+ (strcmp(argv[1], "-h") == 0) ||
+ (strcmp(argv[1], "--help") == 0)) { print_help(argv[0], EXIT_SUCCESS); }
+ if(argc != 2) { print_help(argv[0], EXIT_FAILURE); }
+
+ /* Open a file for reading. */
+ if(strcmp(argv[1], "-") != 0) {
+#if HAVE_FOPEN_S
+ if(fopen_s(&fp, fname = argv[1], "rb") != 0) {
+#else
+ if((fp = LFS_FOPEN(fname = argv[1], "rb")) == NULL) {
+#endif
+ fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+#if HAVE__SETMODE && HAVE__FILENO
+ if(_setmode(_fileno(stdin), _O_BINARY) == -1) {
+ fprintf(stderr, "%s: Cannot set mode: ", argv[0]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+#endif
+ fp = stdin;
+ fname = "stdin";
+ needclose = 0;
+ }
+
+ /* Get the file size. */
+ if(LFS_FSEEK(fp, 0, SEEK_END) == 0) {
+ n = LFS_FTELL(fp);
+ rewind(fp);
+ if(n < 0) {
+ fprintf(stderr, "%s: Cannot ftell `%s': ", argv[0], fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ if(0x7fffffff <= n) {
+ fprintf(stderr, "%s: Input file `%s' is too big.\n", argv[0], fname);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ fprintf(stderr, "%s: Cannot fseek `%s': ", argv[0], fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+
+ /* Allocate 5n bytes of memory. */
+ T = (sauchar_t *)malloc((size_t)n * sizeof(sauchar_t));
+ SA = (saidx_t *)malloc((size_t)n * sizeof(saidx_t));
+ if((T == NULL) || (SA == NULL)) {
+ fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ /* Read n bytes of data. */
+ if(fread(T, sizeof(sauchar_t), (size_t)n, fp) != (size_t)n) {
+ fprintf(stderr, "%s: %s `%s': ",
+ argv[0],
+ (ferror(fp) || !feof(fp)) ? "Cannot read from" : "Unexpected EOF in",
+ argv[1]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ if(needclose & 1) { fclose(fp); }
+
+ /* Construct the suffix array. */
+ fprintf(stderr, "%s: %" PRIdOFF_T " bytes ... ", fname, n);
+ start = clock();
+ if(divsufsort(T, SA, (saidx_t)n) != 0) {
+ fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+ finish = clock();
+ fprintf(stderr, "%.4f sec\n", (double)(finish - start) / (double)CLOCKS_PER_SEC);
+
+ /* Check the suffix array. */
+ if(sufcheck(T, SA, (saidx_t)n, 1) != 0) { exit(EXIT_FAILURE); }
+
+ /* Deallocate memory. */
+ free(SA);
+ free(T);
+
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/unbwt.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/unbwt.c
new file mode 100644
index 000000000..c0f19e97a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/examples/unbwt.c
@@ -0,0 +1,207 @@
+/*
+ * unbwt.c for libdivsufsort
+ * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include <stdio.h>
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#if HAVE_MEMORY_H
+# include <memory.h>
+#endif
+#if HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_IO_H && HAVE_FCNTL_H
+# include <io.h>
+# include <fcntl.h>
+#endif
+#include <time.h>
+#include <divsufsort.h>
+#include "lfs.h"
+
+
+static
+size_t
+read_int(FILE *fp, saidx_t *n) {
+ unsigned char c[4];
+ size_t m = fread(c, sizeof(unsigned char), 4, fp);
+ if(m == 4) {
+ *n = (c[0] << 0) | (c[1] << 8) |
+ (c[2] << 16) | (c[3] << 24);
+ }
+ return m;
+}
+
+static
+void
+print_help(const char *progname, int status) {
+ fprintf(stderr,
+ "unbwt, an inverse burrows-wheeler transform program, version %s.\n",
+ divsufsort_version());
+ fprintf(stderr, "usage: %s INFILE OUTFILE\n\n", progname);
+ exit(status);
+}
+
+int
+main(int argc, const char *argv[]) {
+ FILE *fp, *ofp;
+ const char *fname, *ofname;
+ sauchar_t *T;
+ saidx_t *A;
+ LFS_OFF_T n;
+ size_t m;
+ saidx_t pidx;
+ clock_t start, finish;
+ saint_t err, blocksize, needclose = 3;
+
+ /* Check arguments. */
+ if((argc == 1) ||
+ (strcmp(argv[1], "-h") == 0) ||
+ (strcmp(argv[1], "--help") == 0)) { print_help(argv[0], EXIT_SUCCESS); }
+ if(argc != 3) { print_help(argv[0], EXIT_FAILURE); }
+
+ /* Open a file for reading. */
+ if(strcmp(argv[1], "-") != 0) {
+#if HAVE_FOPEN_S
+ if(fopen_s(&fp, fname = argv[1], "rb") != 0) {
+#else
+ if((fp = LFS_FOPEN(fname = argv[1], "rb")) == NULL) {
+#endif
+ fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+#if HAVE__SETMODE && HAVE__FILENO
+ if(_setmode(_fileno(stdin), _O_BINARY) == -1) {
+ fprintf(stderr, "%s: Cannot set mode: ", argv[0]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+#endif
+ fp = stdin;
+ fname = "stdin";
+ needclose ^= 1;
+ }
+
+ /* Open a file for writing. */
+ if(strcmp(argv[2], "-") != 0) {
+#if HAVE_FOPEN_S
+ if(fopen_s(&ofp, ofname = argv[2], "wb") != 0) {
+#else
+ if((ofp = LFS_FOPEN(ofname = argv[2], "wb")) == NULL) {
+#endif
+ fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], ofname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+#if HAVE__SETMODE && HAVE__FILENO
+ if(_setmode(_fileno(stdout), _O_BINARY) == -1) {
+ fprintf(stderr, "%s: Cannot set mode: ", argv[0]);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+#endif
+ ofp = stdout;
+ ofname = "stdout";
+ needclose ^= 2;
+ }
+
+ /* Read the blocksize. */
+ if(read_int(fp, &blocksize) != 4) {
+ fprintf(stderr, "%s: Cannot read from `%s': ", argv[0], fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+
+ /* Allocate 5blocksize bytes of memory. */
+ T = (sauchar_t *)malloc(blocksize * sizeof(sauchar_t));
+ A = (saidx_t *)malloc(blocksize * sizeof(saidx_t));
+ if((T == NULL) || (A == NULL)) {
+ fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ fprintf(stderr, "UnBWT (blocksize %" PRIdSAINT_T ") ... ", blocksize);
+ start = clock();
+ for(n = 0; (m = read_int(fp, &pidx)) != 0; n += m) {
+ /* Read blocksize bytes of data. */
+ if((m != 4) || ((m = fread(T, sizeof(sauchar_t), blocksize, fp)) == 0)) {
+ fprintf(stderr, "%s: %s `%s': ",
+ argv[0],
+ (ferror(fp) || !feof(fp)) ? "Cannot read from" : "Unexpected EOF in",
+ fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+
+ /* Inverse Burrows-Wheeler Transform. */
+ if((err = inverse_bw_transform(T, T, A, m, pidx)) != 0) {
+ fprintf(stderr, "%s (reverseBWT): %s.\n",
+ argv[0],
+ (err == -1) ? "Invalid data" : "Cannot allocate memory");
+ exit(EXIT_FAILURE);
+ }
+
+ /* Write m bytes of data. */
+ if(fwrite(T, sizeof(sauchar_t), m, ofp) != m) {
+ fprintf(stderr, "%s: Cannot write to `%s': ", argv[0], ofname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ }
+ if(ferror(fp)) {
+ fprintf(stderr, "%s: Cannot read from `%s': ", argv[0], fname);
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ finish = clock();
+ fprintf(stderr, "%" PRIdOFF_T " bytes: %.4f sec\n",
+ n, (double)(finish - start) / (double)CLOCKS_PER_SEC);
+
+ /* Close files */
+ if(needclose & 1) { fclose(fp); }
+ if(needclose & 2) { fclose(ofp); }
+
+ /* Deallocate memory. */
+ free(A);
+ free(T);
+
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/CMakeLists.txt b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/CMakeLists.txt
new file mode 100644
index 000000000..37781ccb3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/CMakeLists.txt
@@ -0,0 +1,162 @@
+include(CheckIncludeFiles)
+include(CheckIncludeFile)
+include(CheckSymbolExists)
+include(CheckTypeSize)
+include(CheckFunctionKeywords)
+include(CheckLFS)
+
+## Checks for header files ##
+check_include_file("inttypes.h" HAVE_INTTYPES_H)
+check_include_file("memory.h" HAVE_MEMORY_H)
+check_include_file("stddef.h" HAVE_STDDEF_H)
+check_include_file("stdint.h" HAVE_STDINT_H)
+check_include_file("stdlib.h" HAVE_STDLIB_H)
+check_include_file("string.h" HAVE_STRING_H)
+check_include_file("strings.h" HAVE_STRINGS_H)
+check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
+if(HAVE_INTTYPES_H)
+ set(INCFILE "#include <inttypes.h>")
+elseif(HAVE_STDINT_H)
+ set(INCFILE "#include <stdint.h>")
+else(HAVE_INTTYPES_H)
+ set(INCFILE "")
+endif(HAVE_INTTYPES_H)
+
+## create configuration files from .cmake file ##
+if(BUILD_EXAMPLES)
+ ## Checks for WinIO ##
+ if(WIN32)
+ check_include_file("io.h" HAVE_IO_H)
+ check_include_file("fcntl.h" HAVE_FCNTL_H)
+ check_symbol_exists("_setmode" "io.h;fcntl.h" HAVE__SETMODE)
+ if(NOT HAVE__SETMODE)
+ check_symbol_exists("setmode" "io.h;fcntl.h" HAVE_SETMODE)
+ endif(NOT HAVE__SETMODE)
+ check_symbol_exists("_fileno" "stdio.h" HAVE__FILENO)
+ check_symbol_exists("fopen_s" "stdio.h" HAVE_FOPEN_S)
+ check_symbol_exists("_O_BINARY" "fcntl.h" HAVE__O_BINARY)
+ endif(WIN32)
+
+ ## Checks for large file support ##
+ check_lfs(WITH_LFS)
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lfs.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/lfs.h" @ONLY)
+endif(BUILD_EXAMPLES)
+
+## generate config.h ##
+check_function_keywords("inline;__inline;__inline__;__declspec(dllexport);__declspec(dllimport)")
+if(HAVE_INLINE)
+ set(INLINE "inline")
+elseif(HAVE___INLINE)
+ set(INLINE "__inline")
+elseif(HAVE___INLINE__)
+ set(INLINE "__inline__")
+else(HAVE_INLINE)
+ set(INLINE "")
+endif(HAVE_INLINE)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/config.h")
+
+## Checks for types ##
+# sauchar_t (8bit)
+check_type_size("uint8_t" UINT8_T)
+if(HAVE_UINT8_T)
+ set(SAUCHAR_TYPE "uint8_t")
+else(HAVE_UINT8_T)
+ check_type_size("unsigned char" SIZEOF_UNSIGNED_CHAR)
+ if("${SIZEOF_UNSIGNED_CHAR}" STREQUAL "1")
+ set(SAUCHAR_TYPE "unsigned char")
+ else("${SIZEOF_UNSIGNED_CHAR}" STREQUAL "1")
+ message(FATAL_ERROR "Cannot find unsigned 8-bit integer type")
+ endif("${SIZEOF_UNSIGNED_CHAR}" STREQUAL "1")
+endif(HAVE_UINT8_T)
+# saint_t (32bit)
+check_type_size("int32_t" INT32_T)
+if(HAVE_INT32_T)
+ set(SAINT32_TYPE "int32_t")
+ check_symbol_exists("PRId32" "inttypes.h" HAVE_PRID32)
+ if(HAVE_PRID32)
+ set(SAINT32_PRId "PRId32")
+ else(HAVE_PRID32)
+ set(SAINT32_PRId "\"d\"")
+ endif(HAVE_PRID32)
+else(HAVE_INT32_T)
+ check_type_size("int" SIZEOF_INT)
+ check_type_size("long" SIZEOF_LONG)
+ check_type_size("short" SIZEOF_SHORT)
+ check_type_size("__int32" SIZEOF___INT32)
+ if("${SIZEOF_INT}" STREQUAL "4")
+ set(SAINT32_TYPE "int")
+ set(SAINT32_PRId "\"d\"")
+ elseif("${SIZEOF_LONG}" STREQUAL "4")
+ set(SAINT32_TYPE "long")
+ set(SAINT32_PRId "\"ld\"")
+ elseif("${SIZEOF_SHORT}" STREQUAL "4")
+ set(SAINT32_TYPE "short")
+ set(SAINT32_PRId "\"d\"")
+ elseif("${SIZEOF___INT32}" STREQUAL "4")
+ set(SAINT32_TYPE "__int32")
+ set(SAINT32_PRId "\"d\"")
+ else("${SIZEOF_INT}" STREQUAL "4")
+ message(FATAL_ERROR "Cannot find 32-bit integer type")
+ endif("${SIZEOF_INT}" STREQUAL "4")
+endif(HAVE_INT32_T)
+# saint64_t (64bit)
+if(BUILD_DIVSUFSORT64)
+ check_type_size("int64_t" INT64_T)
+ if(HAVE_INT64_T)
+ set(SAINT64_TYPE "int64_t")
+ check_symbol_exists("PRId64" "inttypes.h" HAVE_PRID64)
+ if(HAVE_PRID64)
+ set(SAINT64_PRId "PRId64")
+ else(HAVE_PRID64)
+ set(SAINT64_PRId "\"lld\"")
+ endif(HAVE_PRID64)
+ else(HAVE_INT64_T)
+ check_type_size("int" SIZEOF_INT)
+ check_type_size("long" SIZEOF_LONG)
+ check_type_size("long long" SIZEOF_LONG_LONG)
+ check_type_size("__int64" SIZEOF___INT64)
+ if("${SIZEOF_INT}" STREQUAL "8")
+ set(SAINT64_TYPE "int")
+ set(SAINT64_PRId "\"d\"")
+ elseif("${SIZEOF_LONG}" STREQUAL "8")
+ set(SAINT64_TYPE "long")
+ set(SAINT64_PRId "\"ld\"")
+ elseif("${SIZEOF_LONG_LONG}" STREQUAL "8")
+ set(SAINT64_TYPE "long long")
+ set(SAINT64_PRId "\"lld\"")
+ elseif("${SIZEOF___INT64}" STREQUAL "8")
+ set(SAINT64_TYPE "__int64")
+ set(SAINT64_PRId "\"I64d\"")
+ else("${SIZEOF_INT}" STREQUAL "8")
+ message(SEND_ERROR "Cannot find 64-bit integer type")
+ set(BUILD_DIVSUFSORT64 OFF)
+ endif("${SIZEOF_INT}" STREQUAL "8")
+ endif(HAVE_INT64_T)
+endif(BUILD_DIVSUFSORT64)
+
+## generate divsufsort.h ##
+set(DIVSUFSORT_IMPORT "")
+set(DIVSUFSORT_EXPORT "")
+if(BUILD_SHARED_LIBS)
+ if(HAVE___DECLSPEC_DLLIMPORT_)
+ set(DIVSUFSORT_IMPORT "__declspec(dllimport)")
+ endif(HAVE___DECLSPEC_DLLIMPORT_)
+ if(HAVE___DECLSPEC_DLLEXPORT_)
+ set(DIVSUFSORT_EXPORT "__declspec(dllexport)")
+ endif(HAVE___DECLSPEC_DLLEXPORT_)
+endif(BUILD_SHARED_LIBS)
+set(W64BIT "")
+set(SAINDEX_TYPE "${SAINT32_TYPE}")
+set(SAINDEX_PRId "${SAINT32_PRId}")
+set(SAINT_PRId "${SAINT32_PRId}")
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/divsufsort.h.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/divsufsort.h" @ONLY)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/divsufsort.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+if(BUILD_DIVSUFSORT64)
+ set(W64BIT "64")
+ set(SAINDEX_TYPE "${SAINT64_TYPE}")
+ set(SAINDEX_PRId "${SAINT64_PRId}")
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/divsufsort.h.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/divsufsort64.h" @ONLY)
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/divsufsort64.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+endif(BUILD_DIVSUFSORT64)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/config.h.cmake b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/config.h.cmake
new file mode 100644
index 000000000..6a1cf47d8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/config.h.cmake
@@ -0,0 +1,81 @@
+/*
+ * config.h for libdivsufsort
+ * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _CONFIG_H
+#define _CONFIG_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** Define to the version of this package. **/
+#cmakedefine PROJECT_VERSION_FULL "${PROJECT_VERSION_FULL}"
+
+/** Define to 1 if you have the header files. **/
+#cmakedefine HAVE_INTTYPES_H 1
+#cmakedefine HAVE_STDDEF_H 1
+#cmakedefine HAVE_STDINT_H 1
+#cmakedefine HAVE_STDLIB_H 1
+#cmakedefine HAVE_STRING_H 1
+#cmakedefine HAVE_STRINGS_H 1
+#cmakedefine HAVE_MEMORY_H 1
+#cmakedefine HAVE_SYS_TYPES_H 1
+
+/** for WinIO **/
+#cmakedefine HAVE_IO_H 1
+#cmakedefine HAVE_FCNTL_H 1
+#cmakedefine HAVE__SETMODE 1
+#cmakedefine HAVE_SETMODE 1
+#cmakedefine HAVE__FILENO 1
+#cmakedefine HAVE_FOPEN_S 1
+#cmakedefine HAVE__O_BINARY 1
+#ifndef HAVE__SETMODE
+# if HAVE_SETMODE
+# define _setmode setmode
+# define HAVE__SETMODE 1
+# endif
+# if HAVE__SETMODE && !HAVE__O_BINARY
+# define _O_BINARY 0
+# define HAVE__O_BINARY 1
+# endif
+#endif
+
+/** for inline **/
+#ifndef INLINE
+# define INLINE @INLINE@
+#endif
+
+/** for VC++ warning **/
+#ifdef _MSC_VER
+#pragma warning(disable: 4127)
+#endif
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _CONFIG_H */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/divsufsort.h.cmake b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/divsufsort.h.cmake
new file mode 100644
index 000000000..bcaba7c64
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/divsufsort.h.cmake
@@ -0,0 +1,180 @@
+/*
+ * divsufsort@W64BIT@.h for libdivsufsort@W64BIT@
+ * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _DIVSUFSORT@W64BIT@_H
+#define _DIVSUFSORT@W64BIT@_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+@INCFILE@
+
+#ifndef DIVSUFSORT_API
+# ifdef DIVSUFSORT_BUILD_DLL
+# define DIVSUFSORT_API @DIVSUFSORT_EXPORT@
+# else
+# define DIVSUFSORT_API @DIVSUFSORT_IMPORT@
+# endif
+#endif
+
+/*- Datatypes -*/
+#ifndef SAUCHAR_T
+#define SAUCHAR_T
+typedef @SAUCHAR_TYPE@ sauchar_t;
+#endif /* SAUCHAR_T */
+#ifndef SAINT_T
+#define SAINT_T
+typedef @SAINT32_TYPE@ saint_t;
+#endif /* SAINT_T */
+#ifndef SAIDX@W64BIT@_T
+#define SAIDX@W64BIT@_T
+typedef @SAINDEX_TYPE@ saidx@W64BIT@_t;
+#endif /* SAIDX@W64BIT@_T */
+#ifndef PRIdSAINT_T
+#define PRIdSAINT_T @SAINT_PRId@
+#endif /* PRIdSAINT_T */
+#ifndef PRIdSAIDX@W64BIT@_T
+#define PRIdSAIDX@W64BIT@_T @SAINDEX_PRId@
+#endif /* PRIdSAIDX@W64BIT@_T */
+
+
+/*- Prototypes -*/
+
+/**
+ * Constructs the suffix array of a given string.
+ * @param T[0..n-1] The input string.
+ * @param SA[0..n-1] The output array of suffixes.
+ * @param n The length of the given string.
+ * @return 0 if no error occurred, -1 or -2 otherwise.
+ */
+DIVSUFSORT_API
+saint_t
+divsufsort@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t *SA, saidx@W64BIT@_t n);
+
+/**
+ * Constructs the burrows-wheeler transformed string of a given string.
+ * @param T[0..n-1] The input string.
+ * @param U[0..n-1] The output string. (can be T)
+ * @param A[0..n-1] The temporary array. (can be NULL)
+ * @param n The length of the given string.
+ * @return The primary index if no error occurred, -1 or -2 otherwise.
+ */
+DIVSUFSORT_API
+saidx@W64BIT@_t
+divbwt@W64BIT@(const sauchar_t *T, sauchar_t *U, saidx@W64BIT@_t *A, saidx@W64BIT@_t n);
+
+/**
+ * Returns the version of the divsufsort library.
+ * @return The version number string.
+ */
+DIVSUFSORT_API
+const char *
+divsufsort@W64BIT@_version(void);
+
+
+/**
+ * Constructs the burrows-wheeler transformed string of a given string and suffix array.
+ * @param T[0..n-1] The input string.
+ * @param U[0..n-1] The output string. (can be T)
+ * @param SA[0..n-1] The suffix array. (can be NULL)
+ * @param n The length of the given string.
+ * @param idx The output primary index.
+ * @return 0 if no error occurred, -1 or -2 otherwise.
+ */
+DIVSUFSORT_API
+saint_t
+bw_transform@W64BIT@(const sauchar_t *T, sauchar_t *U,
+ saidx@W64BIT@_t *SA /* can NULL */,
+ saidx@W64BIT@_t n, saidx@W64BIT@_t *idx);
+
+/**
+ * Inverse BW-transforms a given BWTed string.
+ * @param T[0..n-1] The input string.
+ * @param U[0..n-1] The output string. (can be T)
+ * @param A[0..n-1] The temporary array. (can be NULL)
+ * @param n The length of the given string.
+ * @param idx The primary index.
+ * @return 0 if no error occurred, -1 or -2 otherwise.
+ */
+DIVSUFSORT_API
+saint_t
+inverse_bw_transform@W64BIT@(const sauchar_t *T, sauchar_t *U,
+ saidx@W64BIT@_t *A /* can NULL */,
+ saidx@W64BIT@_t n, saidx@W64BIT@_t idx);
+
+/**
+ * Checks the correctness of a given suffix array.
+ * @param T[0..n-1] The input string.
+ * @param SA[0..n-1] The input suffix array.
+ * @param n The length of the given string.
+ * @param verbose The verbose mode.
+ * @return 0 if no error occurred.
+ */
+DIVSUFSORT_API
+saint_t
+sufcheck@W64BIT@(const sauchar_t *T, const saidx@W64BIT@_t *SA, saidx@W64BIT@_t n, saint_t verbose);
+
+/**
+ * Search for the pattern P in the string T.
+ * @param T[0..Tsize-1] The input string.
+ * @param Tsize The length of the given string.
+ * @param P[0..Psize-1] The input pattern string.
+ * @param Psize The length of the given pattern string.
+ * @param SA[0..SAsize-1] The input suffix array.
+ * @param SAsize The length of the given suffix array.
+ * @param idx The output index.
+ * @return The count of matches if no error occurred, -1 otherwise.
+ */
+DIVSUFSORT_API
+saidx@W64BIT@_t
+sa_search@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t Tsize,
+ const sauchar_t *P, saidx@W64BIT@_t Psize,
+ const saidx@W64BIT@_t *SA, saidx@W64BIT@_t SAsize,
+ saidx@W64BIT@_t *left);
+
+/**
+ * Search for the character c in the string T.
+ * @param T[0..Tsize-1] The input string.
+ * @param Tsize The length of the given string.
+ * @param SA[0..SAsize-1] The input suffix array.
+ * @param SAsize The length of the given suffix array.
+ * @param c The input character.
+ * @param idx The output index.
+ * @return The count of matches if no error occurred, -1 otherwise.
+ */
+DIVSUFSORT_API
+saidx@W64BIT@_t
+sa_simplesearch@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t Tsize,
+ const saidx@W64BIT@_t *SA, saidx@W64BIT@_t SAsize,
+ saint_t c, saidx@W64BIT@_t *left);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _DIVSUFSORT@W64BIT@_H */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/divsufsort_private.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/divsufsort_private.h
new file mode 100644
index 000000000..7e261c19d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/divsufsort_private.h
@@ -0,0 +1,207 @@
+/*
+ * divsufsort_private.h for libdivsufsort
+ * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _DIVSUFSORT_PRIVATE_H
+#define _DIVSUFSORT_PRIVATE_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include <assert.h>
+#include <stdio.h>
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#if HAVE_MEMORY_H
+# include <memory.h>
+#endif
+#if HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if defined(BUILD_DIVSUFSORT64)
+# include "divsufsort64.h"
+# ifndef SAIDX_T
+# define SAIDX_T
+# define saidx_t saidx64_t
+# endif /* SAIDX_T */
+# ifndef PRIdSAIDX_T
+# define PRIdSAIDX_T PRIdSAIDX64_T
+# endif /* PRIdSAIDX_T */
+# define divsufsort divsufsort64
+# define divbwt divbwt64
+# define divsufsort_version divsufsort64_version
+# define bw_transform bw_transform64
+# define inverse_bw_transform inverse_bw_transform64
+# define sufcheck sufcheck64
+# define sa_search sa_search64
+# define sa_simplesearch sa_simplesearch64
+# define sssort sssort64
+# define trsort trsort64
+#else
+# include "divsufsort.h"
+#endif
+
+
+/*- Constants -*/
+#if !defined(UINT8_MAX)
+# define UINT8_MAX (255)
+#endif /* UINT8_MAX */
+#if defined(ALPHABET_SIZE) && (ALPHABET_SIZE < 1)
+# undef ALPHABET_SIZE
+#endif
+#if !defined(ALPHABET_SIZE)
+# define ALPHABET_SIZE (UINT8_MAX + 1)
+#endif
+/* for divsufsort.c */
+#define BUCKET_A_SIZE (ALPHABET_SIZE)
+#define BUCKET_B_SIZE (ALPHABET_SIZE * ALPHABET_SIZE)
+/* for sssort.c */
+#if defined(SS_INSERTIONSORT_THRESHOLD)
+# if SS_INSERTIONSORT_THRESHOLD < 1
+# undef SS_INSERTIONSORT_THRESHOLD
+# define SS_INSERTIONSORT_THRESHOLD (1)
+# endif
+#else
+# define SS_INSERTIONSORT_THRESHOLD (8)
+#endif
+#if defined(SS_BLOCKSIZE)
+# if SS_BLOCKSIZE < 0
+# undef SS_BLOCKSIZE
+# define SS_BLOCKSIZE (0)
+# elif 32768 <= SS_BLOCKSIZE
+# undef SS_BLOCKSIZE
+# define SS_BLOCKSIZE (32767)
+# endif
+#else
+# define SS_BLOCKSIZE (1024)
+#endif
+/* minstacksize = log(SS_BLOCKSIZE) / log(3) * 2 */
+#if SS_BLOCKSIZE == 0
+# if defined(BUILD_DIVSUFSORT64)
+# define SS_MISORT_STACKSIZE (96)
+# else
+# define SS_MISORT_STACKSIZE (64)
+# endif
+#elif SS_BLOCKSIZE <= 4096
+# define SS_MISORT_STACKSIZE (16)
+#else
+# define SS_MISORT_STACKSIZE (24)
+#endif
+#if defined(BUILD_DIVSUFSORT64)
+# define SS_SMERGE_STACKSIZE (64)
+#else
+# define SS_SMERGE_STACKSIZE (32)
+#endif
+/* for trsort.c */
+#define TR_INSERTIONSORT_THRESHOLD (8)
+#if defined(BUILD_DIVSUFSORT64)
+# define TR_STACKSIZE (96)
+#else
+# define TR_STACKSIZE (64)
+#endif
+
+
+/*- Macros -*/
+#ifndef SWAP
+# define SWAP(_a, _b) do { t = (_a); (_a) = (_b); (_b) = t; } while(0)
+#endif /* SWAP */
+#ifndef MIN
+# define MIN(_a, _b) (((_a) < (_b)) ? (_a) : (_b))
+#endif /* MIN */
+#ifndef MAX
+# define MAX(_a, _b) (((_a) > (_b)) ? (_a) : (_b))
+#endif /* MAX */
+#define STACK_PUSH(_a, _b, _c, _d)\
+ do {\
+ assert(ssize < STACK_SIZE);\
+ stack[ssize].a = (_a), stack[ssize].b = (_b),\
+ stack[ssize].c = (_c), stack[ssize++].d = (_d);\
+ } while(0)
+#define STACK_PUSH5(_a, _b, _c, _d, _e)\
+ do {\
+ assert(ssize < STACK_SIZE);\
+ stack[ssize].a = (_a), stack[ssize].b = (_b),\
+ stack[ssize].c = (_c), stack[ssize].d = (_d), stack[ssize++].e = (_e);\
+ } while(0)
+#define STACK_POP(_a, _b, _c, _d)\
+ do {\
+ assert(0 <= ssize);\
+ if(ssize == 0) { return; }\
+ (_a) = stack[--ssize].a, (_b) = stack[ssize].b,\
+ (_c) = stack[ssize].c, (_d) = stack[ssize].d;\
+ } while(0)
+#define STACK_POP5(_a, _b, _c, _d, _e)\
+ do {\
+ assert(0 <= ssize);\
+ if(ssize == 0) { return; }\
+ (_a) = stack[--ssize].a, (_b) = stack[ssize].b,\
+ (_c) = stack[ssize].c, (_d) = stack[ssize].d, (_e) = stack[ssize].e;\
+ } while(0)
+/* for divsufsort.c */
+#define BUCKET_A(_c0) bucket_A[(_c0)]
+#if ALPHABET_SIZE == 256
+#define BUCKET_B(_c0, _c1) (bucket_B[((_c1) << 8) | (_c0)])
+#define BUCKET_BSTAR(_c0, _c1) (bucket_B[((_c0) << 8) | (_c1)])
+#else
+#define BUCKET_B(_c0, _c1) (bucket_B[(_c1) * ALPHABET_SIZE + (_c0)])
+#define BUCKET_BSTAR(_c0, _c1) (bucket_B[(_c0) * ALPHABET_SIZE + (_c1)])
+#endif
+
+
+/*- Private Prototypes -*/
+/* sssort.c */
+void
+sssort(const sauchar_t *Td, const saidx_t *PA,
+ saidx_t *first, saidx_t *last,
+ saidx_t *buf, saidx_t bufsize,
+ saidx_t depth, saidx_t n, saint_t lastsuffix);
+/* trsort.c */
+void
+trsort(saidx_t *ISA, saidx_t *SA, saidx_t n, saidx_t depth);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _DIVSUFSORT_PRIVATE_H */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/lfs.h.cmake b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/lfs.h.cmake
new file mode 100644
index 000000000..d5b84a842
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/include/lfs.h.cmake
@@ -0,0 +1,56 @@
+/*
+ * lfs.h for libdivsufsort
+ * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _LFS_H
+#define _LFS_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifndef __STRICT_ANSI__
+# define LFS_OFF_T @LFS_OFF_T@
+# define LFS_FOPEN @LFS_FOPEN@
+# define LFS_FTELL @LFS_FTELL@
+# define LFS_FSEEK @LFS_FSEEK@
+# define LFS_PRId @LFS_PRID@
+#else
+# define LFS_OFF_T long
+# define LFS_FOPEN fopen
+# define LFS_FTELL ftell
+# define LFS_FSEEK fseek
+# define LFS_PRId "ld"
+#endif
+#ifndef PRIdOFF_T
+# define PRIdOFF_T LFS_PRId
+#endif
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _LFS_H */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/CMakeLists.txt b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/CMakeLists.txt
new file mode 100644
index 000000000..abc90e61d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/CMakeLists.txt
@@ -0,0 +1,31 @@
+include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include"
+ "${CMAKE_CURRENT_BINARY_DIR}/../include")
+
+set(divsufsort_SRCS divsufsort.c sssort.c trsort.c utils.c)
+
+## libdivsufsort ##
+add_library(divsufsort ${divsufsort_SRCS})
+install(TARGETS divsufsort
+ RUNTIME DESTINATION ${CMAKE_INSTALL_RUNTIMEDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+set_target_properties(divsufsort PROPERTIES
+ VERSION "${LIBRARY_VERSION}"
+ SOVERSION "${LIBRARY_SOVERSION}"
+ DEFINE_SYMBOL DIVSUFSORT_BUILD_DLL
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../examples")
+
+## libdivsufsort64 ##
+if(BUILD_DIVSUFSORT64)
+ add_library(divsufsort64 ${divsufsort_SRCS})
+ install(TARGETS divsufsort64
+ RUNTIME DESTINATION ${CMAKE_INSTALL_RUNTIMEDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ set_target_properties(divsufsort64 PROPERTIES
+ VERSION "${LIBRARY_VERSION}"
+ SOVERSION "${LIBRARY_SOVERSION}"
+ DEFINE_SYMBOL DIVSUFSORT_BUILD_DLL
+ COMPILE_FLAGS "-DBUILD_DIVSUFSORT64"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../examples")
+endif(BUILD_DIVSUFSORT64)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/divsufsort.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/divsufsort.c
new file mode 100644
index 000000000..9f64b4f48
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/divsufsort.c
@@ -0,0 +1,398 @@
+/*
+ * divsufsort.c for libdivsufsort
+ * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "divsufsort_private.h"
+#ifdef _OPENMP
+# include <omp.h>
+#endif
+
+
+/*- Private Functions -*/
+
+/* Sorts suffixes of type B*. */
+static
+saidx_t
+sort_typeBstar(const sauchar_t *T, saidx_t *SA,
+ saidx_t *bucket_A, saidx_t *bucket_B,
+ saidx_t n) {
+ saidx_t *PAb, *ISAb, *buf;
+#ifdef _OPENMP
+ saidx_t *curbuf;
+ saidx_t l;
+#endif
+ saidx_t i, j, k, t, m, bufsize;
+ saint_t c0, c1;
+#ifdef _OPENMP
+ saint_t d0, d1;
+ int tmp;
+#endif
+
+ /* Initialize bucket arrays. */
+ for(i = 0; i < BUCKET_A_SIZE; ++i) { bucket_A[i] = 0; }
+ for(i = 0; i < BUCKET_B_SIZE; ++i) { bucket_B[i] = 0; }
+
+ /* Count the number of occurrences of the first one or two characters of each
+ type A, B and B* suffix. Moreover, store the beginning position of all
+ type B* suffixes into the array SA. */
+ for(i = n - 1, m = n, c0 = T[n - 1]; 0 <= i;) {
+ /* type A suffix. */
+ do { ++BUCKET_A(c1 = c0); } while((0 <= --i) && ((c0 = T[i]) >= c1));
+ if(0 <= i) {
+ /* type B* suffix. */
+ ++BUCKET_BSTAR(c0, c1);
+ SA[--m] = i;
+ /* type B suffix. */
+ for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) <= c1); --i, c1 = c0) {
+ ++BUCKET_B(c0, c1);
+ }
+ }
+ }
+ m = n - m;
+/*
+note:
+ A type B* suffix is lexicographically smaller than a type B suffix that
+ begins with the same first two characters.
+*/
+
+ /* Calculate the index of start/end point of each bucket. */
+ for(c0 = 0, i = 0, j = 0; c0 < ALPHABET_SIZE; ++c0) {
+ t = i + BUCKET_A(c0);
+ BUCKET_A(c0) = i + j; /* start point */
+ i = t + BUCKET_B(c0, c0);
+ for(c1 = c0 + 1; c1 < ALPHABET_SIZE; ++c1) {
+ j += BUCKET_BSTAR(c0, c1);
+ BUCKET_BSTAR(c0, c1) = j; /* end point */
+ i += BUCKET_B(c0, c1);
+ }
+ }
+
+ if(0 < m) {
+ /* Sort the type B* suffixes by their first two characters. */
+ PAb = SA + n - m; ISAb = SA + m;
+ for(i = m - 2; 0 <= i; --i) {
+ t = PAb[i], c0 = T[t], c1 = T[t + 1];
+ SA[--BUCKET_BSTAR(c0, c1)] = i;
+ }
+ t = PAb[m - 1], c0 = T[t], c1 = T[t + 1];
+ SA[--BUCKET_BSTAR(c0, c1)] = m - 1;
+
+ /* Sort the type B* substrings using sssort. */
+#ifdef _OPENMP
+ tmp = omp_get_max_threads();
+ buf = SA + m, bufsize = (n - (2 * m)) / tmp;
+ c0 = ALPHABET_SIZE - 2, c1 = ALPHABET_SIZE - 1, j = m;
+#pragma omp parallel default(shared) private(curbuf, k, l, d0, d1, tmp)
+ {
+ tmp = omp_get_thread_num();
+ curbuf = buf + tmp * bufsize;
+ k = 0;
+ for(;;) {
+ #pragma omp critical(sssort_lock)
+ {
+ if(0 < (l = j)) {
+ d0 = c0, d1 = c1;
+ do {
+ k = BUCKET_BSTAR(d0, d1);
+ if(--d1 <= d0) {
+ d1 = ALPHABET_SIZE - 1;
+ if(--d0 < 0) { break; }
+ }
+ } while(((l - k) <= 1) && (0 < (l = k)));
+ c0 = d0, c1 = d1, j = k;
+ }
+ }
+ if(l == 0) { break; }
+ sssort(T, PAb, SA + k, SA + l,
+ curbuf, bufsize, 2, n, *(SA + k) == (m - 1));
+ }
+ }
+#else
+ buf = SA + m, bufsize = n - (2 * m);
+ for(c0 = ALPHABET_SIZE - 2, j = m; 0 < j; --c0) {
+ for(c1 = ALPHABET_SIZE - 1; c0 < c1; j = i, --c1) {
+ i = BUCKET_BSTAR(c0, c1);
+ if(1 < (j - i)) {
+ sssort(T, PAb, SA + i, SA + j,
+ buf, bufsize, 2, n, *(SA + i) == (m - 1));
+ }
+ }
+ }
+#endif
+
+ /* Compute ranks of type B* substrings. */
+ for(i = m - 1; 0 <= i; --i) {
+ if(0 <= SA[i]) {
+ j = i;
+ do { ISAb[SA[i]] = i; } while((0 <= --i) && (0 <= SA[i]));
+ SA[i + 1] = i - j;
+ if(i <= 0) { break; }
+ }
+ j = i;
+ do { ISAb[SA[i] = ~SA[i]] = j; } while(SA[--i] < 0);
+ ISAb[SA[i]] = j;
+ }
+
+ /* Construct the inverse suffix array of type B* suffixes using trsort. */
+ trsort(ISAb, SA, m, 1);
+
+ /* Set the sorted order of tyoe B* suffixes. */
+ for(i = n - 1, j = m, c0 = T[n - 1]; 0 <= i;) {
+ for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) >= c1); --i, c1 = c0) { }
+ if(0 <= i) {
+ t = i;
+ for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) <= c1); --i, c1 = c0) { }
+ SA[ISAb[--j]] = ((t == 0) || (1 < (t - i))) ? t : ~t;
+ }
+ }
+
+ /* Calculate the index of start/end point of each bucket. */
+ BUCKET_B(ALPHABET_SIZE - 1, ALPHABET_SIZE - 1) = n; /* end point */
+ for(c0 = ALPHABET_SIZE - 2, k = m - 1; 0 <= c0; --c0) {
+ i = BUCKET_A(c0 + 1) - 1;
+ for(c1 = ALPHABET_SIZE - 1; c0 < c1; --c1) {
+ t = i - BUCKET_B(c0, c1);
+ BUCKET_B(c0, c1) = i; /* end point */
+
+ /* Move all type B* suffixes to the correct position. */
+ for(i = t, j = BUCKET_BSTAR(c0, c1);
+ j <= k;
+ --i, --k) { SA[i] = SA[k]; }
+ }
+ BUCKET_BSTAR(c0, c0 + 1) = i - BUCKET_B(c0, c0) + 1; /* start point */
+ BUCKET_B(c0, c0) = i; /* end point */
+ }
+ }
+
+ return m;
+}
+
+/* Constructs the suffix array by using the sorted order of type B* suffixes. */
+static
+void
+construct_SA(const sauchar_t *T, saidx_t *SA,
+ saidx_t *bucket_A, saidx_t *bucket_B,
+ saidx_t n, saidx_t m) {
+ saidx_t *i, *j, *k;
+ saidx_t s;
+ saint_t c0, c1, c2;
+
+ if(0 < m) {
+ /* Construct the sorted order of type B suffixes by using
+ the sorted order of type B* suffixes. */
+ for(c1 = ALPHABET_SIZE - 2; 0 <= c1; --c1) {
+ /* Scan the suffix array from right to left. */
+ for(i = SA + BUCKET_BSTAR(c1, c1 + 1),
+ j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1;
+ i <= j;
+ --j) {
+ if(0 < (s = *j)) {
+ assert(T[s] == c1);
+ assert(((s + 1) < n) && (T[s] <= T[s + 1]));
+ assert(T[s - 1] <= T[s]);
+ *j = ~s;
+ c0 = T[--s];
+ if((0 < s) && (T[s - 1] > c0)) { s = ~s; }
+ if(c0 != c2) {
+ if(0 <= c2) { BUCKET_B(c2, c1) = k - SA; }
+ k = SA + BUCKET_B(c2 = c0, c1);
+ }
+ assert(k < j);
+ *k-- = s;
+ } else {
+ assert(((s == 0) && (T[s] == c1)) || (s < 0));
+ *j = ~s;
+ }
+ }
+ }
+ }
+
+ /* Construct the suffix array by using
+ the sorted order of type B suffixes. */
+ k = SA + BUCKET_A(c2 = T[n - 1]);
+ *k++ = (T[n - 2] < c2) ? ~(n - 1) : (n - 1);
+ /* Scan the suffix array from left to right. */
+ for(i = SA, j = SA + n; i < j; ++i) {
+ if(0 < (s = *i)) {
+ assert(T[s - 1] >= T[s]);
+ c0 = T[--s];
+ if((s == 0) || (T[s - 1] < c0)) { s = ~s; }
+ if(c0 != c2) {
+ BUCKET_A(c2) = k - SA;
+ k = SA + BUCKET_A(c2 = c0);
+ }
+ assert(i < k);
+ *k++ = s;
+ } else {
+ assert(s < 0);
+ *i = ~s;
+ }
+ }
+}
+
+/* Constructs the burrows-wheeler transformed string directly
+ by using the sorted order of type B* suffixes. */
+static
+saidx_t
+construct_BWT(const sauchar_t *T, saidx_t *SA,
+ saidx_t *bucket_A, saidx_t *bucket_B,
+ saidx_t n, saidx_t m) {
+ saidx_t *i, *j, *k, *orig;
+ saidx_t s;
+ saint_t c0, c1, c2;
+
+ if(0 < m) {
+ /* Construct the sorted order of type B suffixes by using
+ the sorted order of type B* suffixes. */
+ for(c1 = ALPHABET_SIZE - 2; 0 <= c1; --c1) {
+ /* Scan the suffix array from right to left. */
+ for(i = SA + BUCKET_BSTAR(c1, c1 + 1),
+ j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1;
+ i <= j;
+ --j) {
+ if(0 < (s = *j)) {
+ assert(T[s] == c1);
+ assert(((s + 1) < n) && (T[s] <= T[s + 1]));
+ assert(T[s - 1] <= T[s]);
+ c0 = T[--s];
+ *j = ~((saidx_t)c0);
+ if((0 < s) && (T[s - 1] > c0)) { s = ~s; }
+ if(c0 != c2) {
+ if(0 <= c2) { BUCKET_B(c2, c1) = k - SA; }
+ k = SA + BUCKET_B(c2 = c0, c1);
+ }
+ assert(k < j);
+ *k-- = s;
+ } else if(s != 0) {
+ *j = ~s;
+#ifndef NDEBUG
+ } else {
+ assert(T[s] == c1);
+#endif
+ }
+ }
+ }
+ }
+
+ /* Construct the BWTed string by using
+ the sorted order of type B suffixes. */
+ k = SA + BUCKET_A(c2 = T[n - 1]);
+ *k++ = (T[n - 2] < c2) ? ~((saidx_t)T[n - 2]) : (n - 1);
+ /* Scan the suffix array from left to right. */
+ for(i = SA, j = SA + n, orig = SA; i < j; ++i) {
+ if(0 < (s = *i)) {
+ assert(T[s - 1] >= T[s]);
+ c0 = T[--s];
+ *i = c0;
+ if((0 < s) && (T[s - 1] < c0)) { s = ~((saidx_t)T[s - 1]); }
+ if(c0 != c2) {
+ BUCKET_A(c2) = k - SA;
+ k = SA + BUCKET_A(c2 = c0);
+ }
+ assert(i < k);
+ *k++ = s;
+ } else if(s != 0) {
+ *i = ~s;
+ } else {
+ orig = i;
+ }
+ }
+
+ return orig - SA;
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+/*- Function -*/
+
+saint_t
+divsufsort(const sauchar_t *T, saidx_t *SA, saidx_t n) {
+ saidx_t *bucket_A, *bucket_B;
+ saidx_t m;
+ saint_t err = 0;
+
+ /* Check arguments. */
+ if((T == NULL) || (SA == NULL) || (n < 0)) { return -1; }
+ else if(n == 0) { return 0; }
+ else if(n == 1) { SA[0] = 0; return 0; }
+ else if(n == 2) { m = (T[0] < T[1]); SA[m ^ 1] = 0, SA[m] = 1; return 0; }
+
+ bucket_A = (saidx_t *)malloc(BUCKET_A_SIZE * sizeof(saidx_t));
+ bucket_B = (saidx_t *)malloc(BUCKET_B_SIZE * sizeof(saidx_t));
+
+ /* Suffixsort. */
+ if((bucket_A != NULL) && (bucket_B != NULL)) {
+ m = sort_typeBstar(T, SA, bucket_A, bucket_B, n);
+ construct_SA(T, SA, bucket_A, bucket_B, n, m);
+ } else {
+ err = -2;
+ }
+
+ free(bucket_B);
+ free(bucket_A);
+
+ return err;
+}
+
+saidx_t
+divbwt(const sauchar_t *T, sauchar_t *U, saidx_t *A, saidx_t n) {
+ saidx_t *B;
+ saidx_t *bucket_A, *bucket_B;
+ saidx_t m, pidx, i;
+
+ /* Check arguments. */
+ if((T == NULL) || (U == NULL) || (n < 0)) { return -1; }
+ else if(n <= 1) { if(n == 1) { U[0] = T[0]; } return n; }
+
+ if((B = A) == NULL) { B = (saidx_t *)malloc((size_t)(n + 1) * sizeof(saidx_t)); }
+ bucket_A = (saidx_t *)malloc(BUCKET_A_SIZE * sizeof(saidx_t));
+ bucket_B = (saidx_t *)malloc(BUCKET_B_SIZE * sizeof(saidx_t));
+
+ /* Burrows-Wheeler Transform. */
+ if((B != NULL) && (bucket_A != NULL) && (bucket_B != NULL)) {
+ m = sort_typeBstar(T, B, bucket_A, bucket_B, n);
+ pidx = construct_BWT(T, B, bucket_A, bucket_B, n, m);
+
+ /* Copy to output string. */
+ U[0] = T[n - 1];
+ for(i = 0; i < pidx; ++i) { U[i + 1] = (sauchar_t)B[i]; }
+ for(i += 1; i < n; ++i) { U[i] = (sauchar_t)B[i]; }
+ pidx += 1;
+ } else {
+ pidx = -2;
+ }
+
+ free(bucket_B);
+ free(bucket_A);
+ if(A == NULL) { free(B); }
+
+ return pidx;
+}
+
+const char *
+divsufsort_version(void) {
+ return PROJECT_VERSION_FULL;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/sssort.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/sssort.c
new file mode 100644
index 000000000..4a18fd2ab
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/sssort.c
@@ -0,0 +1,815 @@
+/*
+ * sssort.c for libdivsufsort
+ * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "divsufsort_private.h"
+
+
+/*- Private Functions -*/
+
+static const saint_t lg_table[256]= {
+ -1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
+};
+
+#if (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE)
+
+static INLINE
+saint_t
+ss_ilg(saidx_t n) {
+#if SS_BLOCKSIZE == 0
+# if defined(BUILD_DIVSUFSORT64)
+ return (n >> 32) ?
+ ((n >> 48) ?
+ ((n >> 56) ?
+ 56 + lg_table[(n >> 56) & 0xff] :
+ 48 + lg_table[(n >> 48) & 0xff]) :
+ ((n >> 40) ?
+ 40 + lg_table[(n >> 40) & 0xff] :
+ 32 + lg_table[(n >> 32) & 0xff])) :
+ ((n & 0xffff0000) ?
+ ((n & 0xff000000) ?
+ 24 + lg_table[(n >> 24) & 0xff] :
+ 16 + lg_table[(n >> 16) & 0xff]) :
+ ((n & 0x0000ff00) ?
+ 8 + lg_table[(n >> 8) & 0xff] :
+ 0 + lg_table[(n >> 0) & 0xff]));
+# else
+ return (n & 0xffff0000) ?
+ ((n & 0xff000000) ?
+ 24 + lg_table[(n >> 24) & 0xff] :
+ 16 + lg_table[(n >> 16) & 0xff]) :
+ ((n & 0x0000ff00) ?
+ 8 + lg_table[(n >> 8) & 0xff] :
+ 0 + lg_table[(n >> 0) & 0xff]);
+# endif
+#elif SS_BLOCKSIZE < 256
+ return lg_table[n];
+#else
+ return (n & 0xff00) ?
+ 8 + lg_table[(n >> 8) & 0xff] :
+ 0 + lg_table[(n >> 0) & 0xff];
+#endif
+}
+
+#endif /* (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) */
+
+#if SS_BLOCKSIZE != 0
+
+static const saint_t sqq_table[256] = {
+ 0, 16, 22, 27, 32, 35, 39, 42, 45, 48, 50, 53, 55, 57, 59, 61,
+ 64, 65, 67, 69, 71, 73, 75, 76, 78, 80, 81, 83, 84, 86, 87, 89,
+ 90, 91, 93, 94, 96, 97, 98, 99, 101, 102, 103, 104, 106, 107, 108, 109,
+110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
+128, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
+143, 144, 144, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 155,
+156, 157, 158, 159, 160, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168,
+169, 170, 170, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 178, 179, 180,
+181, 181, 182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190, 191,
+192, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 201,
+202, 203, 203, 204, 204, 205, 206, 206, 207, 208, 208, 209, 209, 210, 211, 211,
+212, 212, 213, 214, 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 221,
+221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, 227, 228, 229, 229, 230,
+230, 231, 231, 232, 232, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238,
+239, 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247,
+247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255
+};
+
+static INLINE
+saidx_t
+ss_isqrt(saidx_t x) {
+ saidx_t y, e;
+
+ if(x >= (SS_BLOCKSIZE * SS_BLOCKSIZE)) { return SS_BLOCKSIZE; }
+ e = (x & 0xffff0000) ?
+ ((x & 0xff000000) ?
+ 24 + lg_table[(x >> 24) & 0xff] :
+ 16 + lg_table[(x >> 16) & 0xff]) :
+ ((x & 0x0000ff00) ?
+ 8 + lg_table[(x >> 8) & 0xff] :
+ 0 + lg_table[(x >> 0) & 0xff]);
+
+ if(e >= 16) {
+ y = sqq_table[x >> ((e - 6) - (e & 1))] << ((e >> 1) - 7);
+ if(e >= 24) { y = (y + 1 + x / y) >> 1; }
+ y = (y + 1 + x / y) >> 1;
+ } else if(e >= 8) {
+ y = (sqq_table[x >> ((e - 6) - (e & 1))] >> (7 - (e >> 1))) + 1;
+ } else {
+ return sqq_table[x] >> 4;
+ }
+
+ return (x < (y * y)) ? y - 1 : y;
+}
+
+#endif /* SS_BLOCKSIZE != 0 */
+
+
+/*---------------------------------------------------------------------------*/
+
+/* Compares two suffixes. */
+static INLINE
+saint_t
+ss_compare(const sauchar_t *T,
+ const saidx_t *p1, const saidx_t *p2,
+ saidx_t depth) {
+ const sauchar_t *U1, *U2, *U1n, *U2n;
+
+ for(U1 = T + depth + *p1,
+ U2 = T + depth + *p2,
+ U1n = T + *(p1 + 1) + 2,
+ U2n = T + *(p2 + 1) + 2;
+ (U1 < U1n) && (U2 < U2n) && (*U1 == *U2);
+ ++U1, ++U2) {
+ }
+
+ return U1 < U1n ?
+ (U2 < U2n ? *U1 - *U2 : 1) :
+ (U2 < U2n ? -1 : 0);
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+#if (SS_BLOCKSIZE != 1) && (SS_INSERTIONSORT_THRESHOLD != 1)
+
+/* Insertionsort for small size groups */
+static
+void
+ss_insertionsort(const sauchar_t *T, const saidx_t *PA,
+ saidx_t *first, saidx_t *last, saidx_t depth) {
+ saidx_t *i, *j;
+ saidx_t t;
+ saint_t r;
+
+ for(i = last - 2; first <= i; --i) {
+ for(t = *i, j = i + 1; 0 < (r = ss_compare(T, PA + t, PA + *j, depth));) {
+ do { *(j - 1) = *j; } while((++j < last) && (*j < 0));
+ if(last <= j) { break; }
+ }
+ if(r == 0) { *j = ~*j; }
+ *(j - 1) = t;
+ }
+}
+
+#endif /* (SS_BLOCKSIZE != 1) && (SS_INSERTIONSORT_THRESHOLD != 1) */
+
+
+/*---------------------------------------------------------------------------*/
+
+#if (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE)
+
+static INLINE
+void
+ss_fixdown(const sauchar_t *Td, const saidx_t *PA,
+ saidx_t *SA, saidx_t i, saidx_t size) {
+ saidx_t j, k;
+ saidx_t v;
+ saint_t c, d, e;
+
+ for(v = SA[i], c = Td[PA[v]]; (j = 2 * i + 1) < size; SA[i] = SA[k], i = k) {
+ d = Td[PA[SA[k = j++]]];
+ if(d < (e = Td[PA[SA[j]]])) { k = j; d = e; }
+ if(d <= c) { break; }
+ }
+ SA[i] = v;
+}
+
+/* Simple top-down heapsort. */
+static
+void
+ss_heapsort(const sauchar_t *Td, const saidx_t *PA, saidx_t *SA, saidx_t size) {
+ saidx_t i, m;
+ saidx_t t;
+
+ m = size;
+ if((size % 2) == 0) {
+ m--;
+ if(Td[PA[SA[m / 2]]] < Td[PA[SA[m]]]) { SWAP(SA[m], SA[m / 2]); }
+ }
+
+ for(i = m / 2 - 1; 0 <= i; --i) { ss_fixdown(Td, PA, SA, i, m); }
+ if((size % 2) == 0) { SWAP(SA[0], SA[m]); ss_fixdown(Td, PA, SA, 0, m); }
+ for(i = m - 1; 0 < i; --i) {
+ t = SA[0], SA[0] = SA[i];
+ ss_fixdown(Td, PA, SA, 0, i);
+ SA[i] = t;
+ }
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+/* Returns the median of three elements. */
+static INLINE
+saidx_t *
+ss_median3(const sauchar_t *Td, const saidx_t *PA,
+ saidx_t *v1, saidx_t *v2, saidx_t *v3) {
+ saidx_t *t;
+ if(Td[PA[*v1]] > Td[PA[*v2]]) { SWAP(v1, v2); }
+ if(Td[PA[*v2]] > Td[PA[*v3]]) {
+ if(Td[PA[*v1]] > Td[PA[*v3]]) { return v1; }
+ else { return v3; }
+ }
+ return v2;
+}
+
+/* Returns the median of five elements. */
+static INLINE
+saidx_t *
+ss_median5(const sauchar_t *Td, const saidx_t *PA,
+ saidx_t *v1, saidx_t *v2, saidx_t *v3, saidx_t *v4, saidx_t *v5) {
+ saidx_t *t;
+ if(Td[PA[*v2]] > Td[PA[*v3]]) { SWAP(v2, v3); }
+ if(Td[PA[*v4]] > Td[PA[*v5]]) { SWAP(v4, v5); }
+ if(Td[PA[*v2]] > Td[PA[*v4]]) { SWAP(v2, v4); SWAP(v3, v5); }
+ if(Td[PA[*v1]] > Td[PA[*v3]]) { SWAP(v1, v3); }
+ if(Td[PA[*v1]] > Td[PA[*v4]]) { SWAP(v1, v4); SWAP(v3, v5); }
+ if(Td[PA[*v3]] > Td[PA[*v4]]) { return v4; }
+ return v3;
+}
+
+/* Returns the pivot element. */
+static INLINE
+saidx_t *
+ss_pivot(const sauchar_t *Td, const saidx_t *PA, saidx_t *first, saidx_t *last) {
+ saidx_t *middle;
+ saidx_t t;
+
+ t = last - first;
+ middle = first + t / 2;
+
+ if(t <= 512) {
+ if(t <= 32) {
+ return ss_median3(Td, PA, first, middle, last - 1);
+ } else {
+ t >>= 2;
+ return ss_median5(Td, PA, first, first + t, middle, last - 1 - t, last - 1);
+ }
+ }
+ t >>= 3;
+ first = ss_median3(Td, PA, first, first + t, first + (t << 1));
+ middle = ss_median3(Td, PA, middle - t, middle, middle + t);
+ last = ss_median3(Td, PA, last - 1 - (t << 1), last - 1 - t, last - 1);
+ return ss_median3(Td, PA, first, middle, last);
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+/* Binary partition for substrings. */
+static INLINE
+saidx_t *
+ss_partition(const saidx_t *PA,
+ saidx_t *first, saidx_t *last, saidx_t depth) {
+ saidx_t *a, *b;
+ saidx_t t;
+ for(a = first - 1, b = last;;) {
+ for(; (++a < b) && ((PA[*a] + depth) >= (PA[*a + 1] + 1));) { *a = ~*a; }
+ for(; (a < --b) && ((PA[*b] + depth) < (PA[*b + 1] + 1));) { }
+ if(b <= a) { break; }
+ t = ~*b;
+ *b = *a;
+ *a = t;
+ }
+ if(first < a) { *first = ~*first; }
+ return a;
+}
+
+/* Multikey introsort for medium size groups. */
+static
+void
+ss_mintrosort(const sauchar_t *T, const saidx_t *PA,
+ saidx_t *first, saidx_t *last,
+ saidx_t depth) {
+#define STACK_SIZE SS_MISORT_STACKSIZE
+ struct { saidx_t *a, *b, c; saint_t d; } stack[STACK_SIZE];
+ const sauchar_t *Td;
+ saidx_t *a, *b, *c, *d, *e, *f;
+ saidx_t s, t;
+ saint_t ssize;
+ saint_t limit;
+ saint_t v, x = 0;
+
+ for(ssize = 0, limit = ss_ilg(last - first);;) {
+
+ if((last - first) <= SS_INSERTIONSORT_THRESHOLD) {
+#if 1 < SS_INSERTIONSORT_THRESHOLD
+ if(1 < (last - first)) { ss_insertionsort(T, PA, first, last, depth); }
+#endif
+ STACK_POP(first, last, depth, limit);
+ continue;
+ }
+
+ Td = T + depth;
+ if(limit-- == 0) { ss_heapsort(Td, PA, first, last - first); }
+ if(limit < 0) {
+ for(a = first + 1, v = Td[PA[*first]]; a < last; ++a) {
+ if((x = Td[PA[*a]]) != v) {
+ if(1 < (a - first)) { break; }
+ v = x;
+ first = a;
+ }
+ }
+ if(Td[PA[*first] - 1] < v) {
+ first = ss_partition(PA, first, a, depth);
+ }
+ if((a - first) <= (last - a)) {
+ if(1 < (a - first)) {
+ STACK_PUSH(a, last, depth, -1);
+ last = a, depth += 1, limit = ss_ilg(a - first);
+ } else {
+ first = a, limit = -1;
+ }
+ } else {
+ if(1 < (last - a)) {
+ STACK_PUSH(first, a, depth + 1, ss_ilg(a - first));
+ first = a, limit = -1;
+ } else {
+ last = a, depth += 1, limit = ss_ilg(a - first);
+ }
+ }
+ continue;
+ }
+
+ /* choose pivot */
+ a = ss_pivot(Td, PA, first, last);
+ v = Td[PA[*a]];
+ SWAP(*first, *a);
+
+ /* partition */
+ for(b = first; (++b < last) && ((x = Td[PA[*b]]) == v);) { }
+ if(((a = b) < last) && (x < v)) {
+ for(; (++b < last) && ((x = Td[PA[*b]]) <= v);) {
+ if(x == v) { SWAP(*b, *a); ++a; }
+ }
+ }
+ for(c = last; (b < --c) && ((x = Td[PA[*c]]) == v);) { }
+ if((b < (d = c)) && (x > v)) {
+ for(; (b < --c) && ((x = Td[PA[*c]]) >= v);) {
+ if(x == v) { SWAP(*c, *d); --d; }
+ }
+ }
+ for(; b < c;) {
+ SWAP(*b, *c);
+ for(; (++b < c) && ((x = Td[PA[*b]]) <= v);) {
+ if(x == v) { SWAP(*b, *a); ++a; }
+ }
+ for(; (b < --c) && ((x = Td[PA[*c]]) >= v);) {
+ if(x == v) { SWAP(*c, *d); --d; }
+ }
+ }
+
+ if(a <= d) {
+ c = b - 1;
+
+ if((s = a - first) > (t = b - a)) { s = t; }
+ for(e = first, f = b - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); }
+ if((s = d - c) > (t = last - d - 1)) { s = t; }
+ for(e = b, f = last - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); }
+
+ a = first + (b - a), c = last - (d - c);
+ b = (v <= Td[PA[*a] - 1]) ? a : ss_partition(PA, a, c, depth);
+
+ if((a - first) <= (last - c)) {
+ if((last - c) <= (c - b)) {
+ STACK_PUSH(b, c, depth + 1, ss_ilg(c - b));
+ STACK_PUSH(c, last, depth, limit);
+ last = a;
+ } else if((a - first) <= (c - b)) {
+ STACK_PUSH(c, last, depth, limit);
+ STACK_PUSH(b, c, depth + 1, ss_ilg(c - b));
+ last = a;
+ } else {
+ STACK_PUSH(c, last, depth, limit);
+ STACK_PUSH(first, a, depth, limit);
+ first = b, last = c, depth += 1, limit = ss_ilg(c - b);
+ }
+ } else {
+ if((a - first) <= (c - b)) {
+ STACK_PUSH(b, c, depth + 1, ss_ilg(c - b));
+ STACK_PUSH(first, a, depth, limit);
+ first = c;
+ } else if((last - c) <= (c - b)) {
+ STACK_PUSH(first, a, depth, limit);
+ STACK_PUSH(b, c, depth + 1, ss_ilg(c - b));
+ first = c;
+ } else {
+ STACK_PUSH(first, a, depth, limit);
+ STACK_PUSH(c, last, depth, limit);
+ first = b, last = c, depth += 1, limit = ss_ilg(c - b);
+ }
+ }
+ } else {
+ limit += 1;
+ if(Td[PA[*first] - 1] < v) {
+ first = ss_partition(PA, first, last, depth);
+ limit = ss_ilg(last - first);
+ }
+ depth += 1;
+ }
+ }
+#undef STACK_SIZE
+}
+
+#endif /* (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) */
+
+
+/*---------------------------------------------------------------------------*/
+
+#if SS_BLOCKSIZE != 0
+
+static INLINE
+void
+ss_blockswap(saidx_t *a, saidx_t *b, saidx_t n) {
+ saidx_t t;
+ for(; 0 < n; --n, ++a, ++b) {
+ t = *a, *a = *b, *b = t;
+ }
+}
+
+static INLINE
+void
+ss_rotate(saidx_t *first, saidx_t *middle, saidx_t *last) {
+ saidx_t *a, *b, t;
+ saidx_t l, r;
+ l = middle - first, r = last - middle;
+ for(; (0 < l) && (0 < r);) {
+ if(l == r) { ss_blockswap(first, middle, l); break; }
+ if(l < r) {
+ a = last - 1, b = middle - 1;
+ t = *a;
+ do {
+ *a-- = *b, *b-- = *a;
+ if(b < first) {
+ *a = t;
+ last = a;
+ if((r -= l + 1) <= l) { break; }
+ a -= 1, b = middle - 1;
+ t = *a;
+ }
+ } while(1);
+ } else {
+ a = first, b = middle;
+ t = *a;
+ do {
+ *a++ = *b, *b++ = *a;
+ if(last <= b) {
+ *a = t;
+ first = a + 1;
+ if((l -= r + 1) <= r) { break; }
+ a += 1, b = middle;
+ t = *a;
+ }
+ } while(1);
+ }
+ }
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+static
+void
+ss_inplacemerge(const sauchar_t *T, const saidx_t *PA,
+ saidx_t *first, saidx_t *middle, saidx_t *last,
+ saidx_t depth) {
+ const saidx_t *p;
+ saidx_t *a, *b;
+ saidx_t len, half;
+ saint_t q, r;
+ saint_t x;
+
+ for(;;) {
+ if(*(last - 1) < 0) { x = 1; p = PA + ~*(last - 1); }
+ else { x = 0; p = PA + *(last - 1); }
+ for(a = first, len = middle - first, half = len >> 1, r = -1;
+ 0 < len;
+ len = half, half >>= 1) {
+ b = a + half;
+ q = ss_compare(T, PA + ((0 <= *b) ? *b : ~*b), p, depth);
+ if(q < 0) {
+ a = b + 1;
+ half -= (len & 1) ^ 1;
+ } else {
+ r = q;
+ }
+ }
+ if(a < middle) {
+ if(r == 0) { *a = ~*a; }
+ ss_rotate(a, middle, last);
+ last -= middle - a;
+ middle = a;
+ if(first == middle) { break; }
+ }
+ --last;
+ if(x != 0) { while(*--last < 0) { } }
+ if(middle == last) { break; }
+ }
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+/* Merge-forward with internal buffer. */
+static
+void
+ss_mergeforward(const sauchar_t *T, const saidx_t *PA,
+ saidx_t *first, saidx_t *middle, saidx_t *last,
+ saidx_t *buf, saidx_t depth) {
+ saidx_t *a, *b, *c, *bufend;
+ saidx_t t;
+ saint_t r;
+
+ bufend = buf + (middle - first) - 1;
+ ss_blockswap(buf, first, middle - first);
+
+ for(t = *(a = first), b = buf, c = middle;;) {
+ r = ss_compare(T, PA + *b, PA + *c, depth);
+ if(r < 0) {
+ do {
+ *a++ = *b;
+ if(bufend <= b) { *bufend = t; return; }
+ *b++ = *a;
+ } while(*b < 0);
+ } else if(r > 0) {
+ do {
+ *a++ = *c, *c++ = *a;
+ if(last <= c) {
+ while(b < bufend) { *a++ = *b, *b++ = *a; }
+ *a = *b, *b = t;
+ return;
+ }
+ } while(*c < 0);
+ } else {
+ *c = ~*c;
+ do {
+ *a++ = *b;
+ if(bufend <= b) { *bufend = t; return; }
+ *b++ = *a;
+ } while(*b < 0);
+
+ do {
+ *a++ = *c, *c++ = *a;
+ if(last <= c) {
+ while(b < bufend) { *a++ = *b, *b++ = *a; }
+ *a = *b, *b = t;
+ return;
+ }
+ } while(*c < 0);
+ }
+ }
+}
+
+/* Merge-backward with internal buffer. */
+static
+void
+ss_mergebackward(const sauchar_t *T, const saidx_t *PA,
+ saidx_t *first, saidx_t *middle, saidx_t *last,
+ saidx_t *buf, saidx_t depth) {
+ const saidx_t *p1, *p2;
+ saidx_t *a, *b, *c, *bufend;
+ saidx_t t;
+ saint_t r;
+ saint_t x;
+
+ bufend = buf + (last - middle) - 1;
+ ss_blockswap(buf, middle, last - middle);
+
+ x = 0;
+ if(*bufend < 0) { p1 = PA + ~*bufend; x |= 1; }
+ else { p1 = PA + *bufend; }
+ if(*(middle - 1) < 0) { p2 = PA + ~*(middle - 1); x |= 2; }
+ else { p2 = PA + *(middle - 1); }
+ for(t = *(a = last - 1), b = bufend, c = middle - 1;;) {
+ r = ss_compare(T, p1, p2, depth);
+ if(0 < r) {
+ if(x & 1) { do { *a-- = *b, *b-- = *a; } while(*b < 0); x ^= 1; }
+ *a-- = *b;
+ if(b <= buf) { *buf = t; break; }
+ *b-- = *a;
+ if(*b < 0) { p1 = PA + ~*b; x |= 1; }
+ else { p1 = PA + *b; }
+ } else if(r < 0) {
+ if(x & 2) { do { *a-- = *c, *c-- = *a; } while(*c < 0); x ^= 2; }
+ *a-- = *c, *c-- = *a;
+ if(c < first) {
+ while(buf < b) { *a-- = *b, *b-- = *a; }
+ *a = *b, *b = t;
+ break;
+ }
+ if(*c < 0) { p2 = PA + ~*c; x |= 2; }
+ else { p2 = PA + *c; }
+ } else {
+ if(x & 1) { do { *a-- = *b, *b-- = *a; } while(*b < 0); x ^= 1; }
+ *a-- = ~*b;
+ if(b <= buf) { *buf = t; break; }
+ *b-- = *a;
+ if(x & 2) { do { *a-- = *c, *c-- = *a; } while(*c < 0); x ^= 2; }
+ *a-- = *c, *c-- = *a;
+ if(c < first) {
+ while(buf < b) { *a-- = *b, *b-- = *a; }
+ *a = *b, *b = t;
+ break;
+ }
+ if(*b < 0) { p1 = PA + ~*b; x |= 1; }
+ else { p1 = PA + *b; }
+ if(*c < 0) { p2 = PA + ~*c; x |= 2; }
+ else { p2 = PA + *c; }
+ }
+ }
+}
+
+/* D&C based merge. */
+static
+void
+ss_swapmerge(const sauchar_t *T, const saidx_t *PA,
+ saidx_t *first, saidx_t *middle, saidx_t *last,
+ saidx_t *buf, saidx_t bufsize, saidx_t depth) {
+#define STACK_SIZE SS_SMERGE_STACKSIZE
+#define GETIDX(a) ((0 <= (a)) ? (a) : (~(a)))
+#define MERGE_CHECK(a, b, c)\
+ do {\
+ if(((c) & 1) ||\
+ (((c) & 2) && (ss_compare(T, PA + GETIDX(*((a) - 1)), PA + *(a), depth) == 0))) {\
+ *(a) = ~*(a);\
+ }\
+ if(((c) & 4) && ((ss_compare(T, PA + GETIDX(*((b) - 1)), PA + *(b), depth) == 0))) {\
+ *(b) = ~*(b);\
+ }\
+ } while(0)
+ struct { saidx_t *a, *b, *c; saint_t d; } stack[STACK_SIZE];
+ saidx_t *l, *r, *lm, *rm;
+ saidx_t m, len, half;
+ saint_t ssize;
+ saint_t check, next;
+
+ for(check = 0, ssize = 0;;) {
+ if((last - middle) <= bufsize) {
+ if((first < middle) && (middle < last)) {
+ ss_mergebackward(T, PA, first, middle, last, buf, depth);
+ }
+ MERGE_CHECK(first, last, check);
+ STACK_POP(first, middle, last, check);
+ continue;
+ }
+
+ if((middle - first) <= bufsize) {
+ if(first < middle) {
+ ss_mergeforward(T, PA, first, middle, last, buf, depth);
+ }
+ MERGE_CHECK(first, last, check);
+ STACK_POP(first, middle, last, check);
+ continue;
+ }
+
+ for(m = 0, len = MIN(middle - first, last - middle), half = len >> 1;
+ 0 < len;
+ len = half, half >>= 1) {
+ if(ss_compare(T, PA + GETIDX(*(middle + m + half)),
+ PA + GETIDX(*(middle - m - half - 1)), depth) < 0) {
+ m += half + 1;
+ half -= (len & 1) ^ 1;
+ }
+ }
+
+ if(0 < m) {
+ lm = middle - m, rm = middle + m;
+ ss_blockswap(lm, middle, m);
+ l = r = middle, next = 0;
+ if(rm < last) {
+ if(*rm < 0) {
+ *rm = ~*rm;
+ if(first < lm) { for(; *--l < 0;) { } next |= 4; }
+ next |= 1;
+ } else if(first < lm) {
+ for(; *r < 0; ++r) { }
+ next |= 2;
+ }
+ }
+
+ if((l - first) <= (last - r)) {
+ STACK_PUSH(r, rm, last, (next & 3) | (check & 4));
+ middle = lm, last = l, check = (check & 3) | (next & 4);
+ } else {
+ if((next & 2) && (r == middle)) { next ^= 6; }
+ STACK_PUSH(first, lm, l, (check & 3) | (next & 4));
+ first = r, middle = rm, check = (next & 3) | (check & 4);
+ }
+ } else {
+ if(ss_compare(T, PA + GETIDX(*(middle - 1)), PA + *middle, depth) == 0) {
+ *middle = ~*middle;
+ }
+ MERGE_CHECK(first, last, check);
+ STACK_POP(first, middle, last, check);
+ }
+ }
+#undef STACK_SIZE
+}
+
+#endif /* SS_BLOCKSIZE != 0 */
+
+
+/*---------------------------------------------------------------------------*/
+
+/*- Function -*/
+
+/* Substring sort */
+void
+sssort(const sauchar_t *T, const saidx_t *PA,
+ saidx_t *first, saidx_t *last,
+ saidx_t *buf, saidx_t bufsize,
+ saidx_t depth, saidx_t n, saint_t lastsuffix) {
+ saidx_t *a;
+#if SS_BLOCKSIZE != 0
+ saidx_t *b, *middle, *curbuf;
+ saidx_t j, k, curbufsize, limit;
+#endif
+ saidx_t i;
+
+ if(lastsuffix != 0) { ++first; }
+
+#if SS_BLOCKSIZE == 0
+ ss_mintrosort(T, PA, first, last, depth);
+#else
+ if((bufsize < SS_BLOCKSIZE) &&
+ (bufsize < (last - first)) &&
+ (bufsize < (limit = ss_isqrt(last - first)))) {
+ if(SS_BLOCKSIZE < limit) { limit = SS_BLOCKSIZE; }
+ buf = middle = last - limit, bufsize = limit;
+ } else {
+ middle = last, limit = 0;
+ }
+ for(a = first, i = 0; SS_BLOCKSIZE < (middle - a); a += SS_BLOCKSIZE, ++i) {
+#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE
+ ss_mintrosort(T, PA, a, a + SS_BLOCKSIZE, depth);
+#elif 1 < SS_BLOCKSIZE
+ ss_insertionsort(T, PA, a, a + SS_BLOCKSIZE, depth);
+#endif
+ curbufsize = last - (a + SS_BLOCKSIZE);
+ curbuf = a + SS_BLOCKSIZE;
+ if(curbufsize <= bufsize) { curbufsize = bufsize, curbuf = buf; }
+ for(b = a, k = SS_BLOCKSIZE, j = i; j & 1; b -= k, k <<= 1, j >>= 1) {
+ ss_swapmerge(T, PA, b - k, b, b + k, curbuf, curbufsize, depth);
+ }
+ }
+#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE
+ ss_mintrosort(T, PA, a, middle, depth);
+#elif 1 < SS_BLOCKSIZE
+ ss_insertionsort(T, PA, a, middle, depth);
+#endif
+ for(k = SS_BLOCKSIZE; i != 0; k <<= 1, i >>= 1) {
+ if(i & 1) {
+ ss_swapmerge(T, PA, a - k, a, middle, buf, bufsize, depth);
+ a -= k;
+ }
+ }
+ if(limit != 0) {
+#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE
+ ss_mintrosort(T, PA, middle, last, depth);
+#elif 1 < SS_BLOCKSIZE
+ ss_insertionsort(T, PA, middle, last, depth);
+#endif
+ ss_inplacemerge(T, PA, first, middle, last, depth);
+ }
+#endif
+
+ if(lastsuffix != 0) {
+ /* Insert last type B* suffix. */
+ saidx_t PAi[2]; PAi[0] = PA[*(first - 1)], PAi[1] = n - 2;
+ for(a = first, i = *(first - 1);
+ (a < last) && ((*a < 0) || (0 < ss_compare(T, &(PAi[0]), PA + *a, depth)));
+ ++a) {
+ *(a - 1) = *a;
+ }
+ *(a - 1) = i;
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/trsort.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/trsort.c
new file mode 100644
index 000000000..6fe3e67ba
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/trsort.c
@@ -0,0 +1,586 @@
+/*
+ * trsort.c for libdivsufsort
+ * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "divsufsort_private.h"
+
+
+/*- Private Functions -*/
+
+static const saint_t lg_table[256]= {
+ -1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
+};
+
+static INLINE
+saint_t
+tr_ilg(saidx_t n) {
+#if defined(BUILD_DIVSUFSORT64)
+ return (n >> 32) ?
+ ((n >> 48) ?
+ ((n >> 56) ?
+ 56 + lg_table[(n >> 56) & 0xff] :
+ 48 + lg_table[(n >> 48) & 0xff]) :
+ ((n >> 40) ?
+ 40 + lg_table[(n >> 40) & 0xff] :
+ 32 + lg_table[(n >> 32) & 0xff])) :
+ ((n & 0xffff0000) ?
+ ((n & 0xff000000) ?
+ 24 + lg_table[(n >> 24) & 0xff] :
+ 16 + lg_table[(n >> 16) & 0xff]) :
+ ((n & 0x0000ff00) ?
+ 8 + lg_table[(n >> 8) & 0xff] :
+ 0 + lg_table[(n >> 0) & 0xff]));
+#else
+ return (n & 0xffff0000) ?
+ ((n & 0xff000000) ?
+ 24 + lg_table[(n >> 24) & 0xff] :
+ 16 + lg_table[(n >> 16) & 0xff]) :
+ ((n & 0x0000ff00) ?
+ 8 + lg_table[(n >> 8) & 0xff] :
+ 0 + lg_table[(n >> 0) & 0xff]);
+#endif
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+/* Simple insertionsort for small size groups. */
+static
+void
+tr_insertionsort(const saidx_t *ISAd, saidx_t *first, saidx_t *last) {
+ saidx_t *a, *b;
+ saidx_t t, r;
+
+ for(a = first + 1; a < last; ++a) {
+ for(t = *a, b = a - 1; 0 > (r = ISAd[t] - ISAd[*b]);) {
+ do { *(b + 1) = *b; } while((first <= --b) && (*b < 0));
+ if(b < first) { break; }
+ }
+ if(r == 0) { *b = ~*b; }
+ *(b + 1) = t;
+ }
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+static INLINE
+void
+tr_fixdown(const saidx_t *ISAd, saidx_t *SA, saidx_t i, saidx_t size) {
+ saidx_t j, k;
+ saidx_t v;
+ saidx_t c, d, e;
+
+ for(v = SA[i], c = ISAd[v]; (j = 2 * i + 1) < size; SA[i] = SA[k], i = k) {
+ d = ISAd[SA[k = j++]];
+ if(d < (e = ISAd[SA[j]])) { k = j; d = e; }
+ if(d <= c) { break; }
+ }
+ SA[i] = v;
+}
+
+/* Simple top-down heapsort. */
+static
+void
+tr_heapsort(const saidx_t *ISAd, saidx_t *SA, saidx_t size) {
+ saidx_t i, m;
+ saidx_t t;
+
+ m = size;
+ if((size % 2) == 0) {
+ m--;
+ if(ISAd[SA[m / 2]] < ISAd[SA[m]]) { SWAP(SA[m], SA[m / 2]); }
+ }
+
+ for(i = m / 2 - 1; 0 <= i; --i) { tr_fixdown(ISAd, SA, i, m); }
+ if((size % 2) == 0) { SWAP(SA[0], SA[m]); tr_fixdown(ISAd, SA, 0, m); }
+ for(i = m - 1; 0 < i; --i) {
+ t = SA[0], SA[0] = SA[i];
+ tr_fixdown(ISAd, SA, 0, i);
+ SA[i] = t;
+ }
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+/* Returns the median of three elements. */
+static INLINE
+saidx_t *
+tr_median3(const saidx_t *ISAd, saidx_t *v1, saidx_t *v2, saidx_t *v3) {
+ saidx_t *t;
+ if(ISAd[*v1] > ISAd[*v2]) { SWAP(v1, v2); }
+ if(ISAd[*v2] > ISAd[*v3]) {
+ if(ISAd[*v1] > ISAd[*v3]) { return v1; }
+ else { return v3; }
+ }
+ return v2;
+}
+
+/* Returns the median of five elements. */
+static INLINE
+saidx_t *
+tr_median5(const saidx_t *ISAd,
+ saidx_t *v1, saidx_t *v2, saidx_t *v3, saidx_t *v4, saidx_t *v5) {
+ saidx_t *t;
+ if(ISAd[*v2] > ISAd[*v3]) { SWAP(v2, v3); }
+ if(ISAd[*v4] > ISAd[*v5]) { SWAP(v4, v5); }
+ if(ISAd[*v2] > ISAd[*v4]) { SWAP(v2, v4); SWAP(v3, v5); }
+ if(ISAd[*v1] > ISAd[*v3]) { SWAP(v1, v3); }
+ if(ISAd[*v1] > ISAd[*v4]) { SWAP(v1, v4); SWAP(v3, v5); }
+ if(ISAd[*v3] > ISAd[*v4]) { return v4; }
+ return v3;
+}
+
+/* Returns the pivot element. */
+static INLINE
+saidx_t *
+tr_pivot(const saidx_t *ISAd, saidx_t *first, saidx_t *last) {
+ saidx_t *middle;
+ saidx_t t;
+
+ t = last - first;
+ middle = first + t / 2;
+
+ if(t <= 512) {
+ if(t <= 32) {
+ return tr_median3(ISAd, first, middle, last - 1);
+ } else {
+ t >>= 2;
+ return tr_median5(ISAd, first, first + t, middle, last - 1 - t, last - 1);
+ }
+ }
+ t >>= 3;
+ first = tr_median3(ISAd, first, first + t, first + (t << 1));
+ middle = tr_median3(ISAd, middle - t, middle, middle + t);
+ last = tr_median3(ISAd, last - 1 - (t << 1), last - 1 - t, last - 1);
+ return tr_median3(ISAd, first, middle, last);
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+typedef struct _trbudget_t trbudget_t;
+struct _trbudget_t {
+ saidx_t chance;
+ saidx_t remain;
+ saidx_t incval;
+ saidx_t count;
+};
+
+static INLINE
+void
+trbudget_init(trbudget_t *budget, saidx_t chance, saidx_t incval) {
+ budget->chance = chance;
+ budget->remain = budget->incval = incval;
+}
+
+static INLINE
+saint_t
+trbudget_check(trbudget_t *budget, saidx_t size) {
+ if(size <= budget->remain) { budget->remain -= size; return 1; }
+ if(budget->chance == 0) { budget->count += size; return 0; }
+ budget->remain += budget->incval - size;
+ budget->chance -= 1;
+ return 1;
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+static INLINE
+void
+tr_partition(const saidx_t *ISAd,
+ saidx_t *first, saidx_t *middle, saidx_t *last,
+ saidx_t **pa, saidx_t **pb, saidx_t v) {
+ saidx_t *a, *b, *c, *d, *e, *f;
+ saidx_t t, s;
+ saidx_t x = 0;
+
+ for(b = middle - 1; (++b < last) && ((x = ISAd[*b]) == v);) { }
+ if(((a = b) < last) && (x < v)) {
+ for(; (++b < last) && ((x = ISAd[*b]) <= v);) {
+ if(x == v) { SWAP(*b, *a); ++a; }
+ }
+ }
+ for(c = last; (b < --c) && ((x = ISAd[*c]) == v);) { }
+ if((b < (d = c)) && (x > v)) {
+ for(; (b < --c) && ((x = ISAd[*c]) >= v);) {
+ if(x == v) { SWAP(*c, *d); --d; }
+ }
+ }
+ for(; b < c;) {
+ SWAP(*b, *c);
+ for(; (++b < c) && ((x = ISAd[*b]) <= v);) {
+ if(x == v) { SWAP(*b, *a); ++a; }
+ }
+ for(; (b < --c) && ((x = ISAd[*c]) >= v);) {
+ if(x == v) { SWAP(*c, *d); --d; }
+ }
+ }
+
+ if(a <= d) {
+ c = b - 1;
+ if((s = a - first) > (t = b - a)) { s = t; }
+ for(e = first, f = b - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); }
+ if((s = d - c) > (t = last - d - 1)) { s = t; }
+ for(e = b, f = last - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); }
+ first += (b - a), last -= (d - c);
+ }
+ *pa = first, *pb = last;
+}
+
+static
+void
+tr_copy(saidx_t *ISA, const saidx_t *SA,
+ saidx_t *first, saidx_t *a, saidx_t *b, saidx_t *last,
+ saidx_t depth) {
+ /* sort suffixes of middle partition
+ by using sorted order of suffixes of left and right partition. */
+ saidx_t *c, *d, *e;
+ saidx_t s, v;
+
+ v = b - SA - 1;
+ for(c = first, d = a - 1; c <= d; ++c) {
+ if((0 <= (s = *c - depth)) && (ISA[s] == v)) {
+ *++d = s;
+ ISA[s] = d - SA;
+ }
+ }
+ for(c = last - 1, e = d + 1, d = b; e < d; --c) {
+ if((0 <= (s = *c - depth)) && (ISA[s] == v)) {
+ *--d = s;
+ ISA[s] = d - SA;
+ }
+ }
+}
+
+static
+void
+tr_partialcopy(saidx_t *ISA, const saidx_t *SA,
+ saidx_t *first, saidx_t *a, saidx_t *b, saidx_t *last,
+ saidx_t depth) {
+ saidx_t *c, *d, *e;
+ saidx_t s, v;
+ saidx_t rank, lastrank, newrank = -1;
+
+ v = b - SA - 1;
+ lastrank = -1;
+ for(c = first, d = a - 1; c <= d; ++c) {
+ if((0 <= (s = *c - depth)) && (ISA[s] == v)) {
+ *++d = s;
+ rank = ISA[s + depth];
+ if(lastrank != rank) { lastrank = rank; newrank = d - SA; }
+ ISA[s] = newrank;
+ }
+ }
+
+ lastrank = -1;
+ for(e = d; first <= e; --e) {
+ rank = ISA[*e];
+ if(lastrank != rank) { lastrank = rank; newrank = e - SA; }
+ if(newrank != rank) { ISA[*e] = newrank; }
+ }
+
+ lastrank = -1;
+ for(c = last - 1, e = d + 1, d = b; e < d; --c) {
+ if((0 <= (s = *c - depth)) && (ISA[s] == v)) {
+ *--d = s;
+ rank = ISA[s + depth];
+ if(lastrank != rank) { lastrank = rank; newrank = d - SA; }
+ ISA[s] = newrank;
+ }
+ }
+}
+
+static
+void
+tr_introsort(saidx_t *ISA, const saidx_t *ISAd,
+ saidx_t *SA, saidx_t *first, saidx_t *last,
+ trbudget_t *budget) {
+#define STACK_SIZE TR_STACKSIZE
+ struct { const saidx_t *a; saidx_t *b, *c; saint_t d, e; }stack[STACK_SIZE];
+ saidx_t *a, *b, *c;
+ saidx_t t;
+ saidx_t v, x = 0;
+ saidx_t incr = ISAd - ISA;
+ saint_t limit, next;
+ saint_t ssize, trlink = -1;
+
+ for(ssize = 0, limit = tr_ilg(last - first);;) {
+
+ if(limit < 0) {
+ if(limit == -1) {
+ /* tandem repeat partition */
+ tr_partition(ISAd - incr, first, first, last, &a, &b, last - SA - 1);
+
+ /* update ranks */
+ if(a < last) {
+ for(c = first, v = a - SA - 1; c < a; ++c) { ISA[*c] = v; }
+ }
+ if(b < last) {
+ for(c = a, v = b - SA - 1; c < b; ++c) { ISA[*c] = v; }
+ }
+
+ /* push */
+ if(1 < (b - a)) {
+ STACK_PUSH5(NULL, a, b, 0, 0);
+ STACK_PUSH5(ISAd - incr, first, last, -2, trlink);
+ trlink = ssize - 2;
+ }
+ if((a - first) <= (last - b)) {
+ if(1 < (a - first)) {
+ STACK_PUSH5(ISAd, b, last, tr_ilg(last - b), trlink);
+ last = a, limit = tr_ilg(a - first);
+ } else if(1 < (last - b)) {
+ first = b, limit = tr_ilg(last - b);
+ } else {
+ STACK_POP5(ISAd, first, last, limit, trlink);
+ }
+ } else {
+ if(1 < (last - b)) {
+ STACK_PUSH5(ISAd, first, a, tr_ilg(a - first), trlink);
+ first = b, limit = tr_ilg(last - b);
+ } else if(1 < (a - first)) {
+ last = a, limit = tr_ilg(a - first);
+ } else {
+ STACK_POP5(ISAd, first, last, limit, trlink);
+ }
+ }
+ } else if(limit == -2) {
+ /* tandem repeat copy */
+ a = stack[--ssize].b, b = stack[ssize].c;
+ if(stack[ssize].d == 0) {
+ tr_copy(ISA, SA, first, a, b, last, ISAd - ISA);
+ } else {
+ if(0 <= trlink) { stack[trlink].d = -1; }
+ tr_partialcopy(ISA, SA, first, a, b, last, ISAd - ISA);
+ }
+ STACK_POP5(ISAd, first, last, limit, trlink);
+ } else {
+ /* sorted partition */
+ if(0 <= *first) {
+ a = first;
+ do { ISA[*a] = a - SA; } while((++a < last) && (0 <= *a));
+ first = a;
+ }
+ if(first < last) {
+ a = first; do { *a = ~*a; } while(*++a < 0);
+ next = (ISA[*a] != ISAd[*a]) ? tr_ilg(a - first + 1) : -1;
+ if(++a < last) { for(b = first, v = a - SA - 1; b < a; ++b) { ISA[*b] = v; } }
+
+ /* push */
+ if(trbudget_check(budget, a - first)) {
+ if((a - first) <= (last - a)) {
+ STACK_PUSH5(ISAd, a, last, -3, trlink);
+ ISAd += incr, last = a, limit = next;
+ } else {
+ if(1 < (last - a)) {
+ STACK_PUSH5(ISAd + incr, first, a, next, trlink);
+ first = a, limit = -3;
+ } else {
+ ISAd += incr, last = a, limit = next;
+ }
+ }
+ } else {
+ if(0 <= trlink) { stack[trlink].d = -1; }
+ if(1 < (last - a)) {
+ first = a, limit = -3;
+ } else {
+ STACK_POP5(ISAd, first, last, limit, trlink);
+ }
+ }
+ } else {
+ STACK_POP5(ISAd, first, last, limit, trlink);
+ }
+ }
+ continue;
+ }
+
+ if((last - first) <= TR_INSERTIONSORT_THRESHOLD) {
+ tr_insertionsort(ISAd, first, last);
+ limit = -3;
+ continue;
+ }
+
+ if(limit-- == 0) {
+ tr_heapsort(ISAd, first, last - first);
+ for(a = last - 1; first < a; a = b) {
+ for(x = ISAd[*a], b = a - 1; (first <= b) && (ISAd[*b] == x); --b) { *b = ~*b; }
+ }
+ limit = -3;
+ continue;
+ }
+
+ /* choose pivot */
+ a = tr_pivot(ISAd, first, last);
+ SWAP(*first, *a);
+ v = ISAd[*first];
+
+ /* partition */
+ tr_partition(ISAd, first, first + 1, last, &a, &b, v);
+ if((last - first) != (b - a)) {
+ next = (ISA[*a] != v) ? tr_ilg(b - a) : -1;
+
+ /* update ranks */
+ for(c = first, v = a - SA - 1; c < a; ++c) { ISA[*c] = v; }
+ if(b < last) { for(c = a, v = b - SA - 1; c < b; ++c) { ISA[*c] = v; } }
+
+ /* push */
+ if((1 < (b - a)) && (trbudget_check(budget, b - a))) {
+ if((a - first) <= (last - b)) {
+ if((last - b) <= (b - a)) {
+ if(1 < (a - first)) {
+ STACK_PUSH5(ISAd + incr, a, b, next, trlink);
+ STACK_PUSH5(ISAd, b, last, limit, trlink);
+ last = a;
+ } else if(1 < (last - b)) {
+ STACK_PUSH5(ISAd + incr, a, b, next, trlink);
+ first = b;
+ } else {
+ ISAd += incr, first = a, last = b, limit = next;
+ }
+ } else if((a - first) <= (b - a)) {
+ if(1 < (a - first)) {
+ STACK_PUSH5(ISAd, b, last, limit, trlink);
+ STACK_PUSH5(ISAd + incr, a, b, next, trlink);
+ last = a;
+ } else {
+ STACK_PUSH5(ISAd, b, last, limit, trlink);
+ ISAd += incr, first = a, last = b, limit = next;
+ }
+ } else {
+ STACK_PUSH5(ISAd, b, last, limit, trlink);
+ STACK_PUSH5(ISAd, first, a, limit, trlink);
+ ISAd += incr, first = a, last = b, limit = next;
+ }
+ } else {
+ if((a - first) <= (b - a)) {
+ if(1 < (last - b)) {
+ STACK_PUSH5(ISAd + incr, a, b, next, trlink);
+ STACK_PUSH5(ISAd, first, a, limit, trlink);
+ first = b;
+ } else if(1 < (a - first)) {
+ STACK_PUSH5(ISAd + incr, a, b, next, trlink);
+ last = a;
+ } else {
+ ISAd += incr, first = a, last = b, limit = next;
+ }
+ } else if((last - b) <= (b - a)) {
+ if(1 < (last - b)) {
+ STACK_PUSH5(ISAd, first, a, limit, trlink);
+ STACK_PUSH5(ISAd + incr, a, b, next, trlink);
+ first = b;
+ } else {
+ STACK_PUSH5(ISAd, first, a, limit, trlink);
+ ISAd += incr, first = a, last = b, limit = next;
+ }
+ } else {
+ STACK_PUSH5(ISAd, first, a, limit, trlink);
+ STACK_PUSH5(ISAd, b, last, limit, trlink);
+ ISAd += incr, first = a, last = b, limit = next;
+ }
+ }
+ } else {
+ if((1 < (b - a)) && (0 <= trlink)) { stack[trlink].d = -1; }
+ if((a - first) <= (last - b)) {
+ if(1 < (a - first)) {
+ STACK_PUSH5(ISAd, b, last, limit, trlink);
+ last = a;
+ } else if(1 < (last - b)) {
+ first = b;
+ } else {
+ STACK_POP5(ISAd, first, last, limit, trlink);
+ }
+ } else {
+ if(1 < (last - b)) {
+ STACK_PUSH5(ISAd, first, a, limit, trlink);
+ first = b;
+ } else if(1 < (a - first)) {
+ last = a;
+ } else {
+ STACK_POP5(ISAd, first, last, limit, trlink);
+ }
+ }
+ }
+ } else {
+ if(trbudget_check(budget, last - first)) {
+ limit = tr_ilg(last - first), ISAd += incr;
+ } else {
+ if(0 <= trlink) { stack[trlink].d = -1; }
+ STACK_POP5(ISAd, first, last, limit, trlink);
+ }
+ }
+ }
+#undef STACK_SIZE
+}
+
+
+
+/*---------------------------------------------------------------------------*/
+
+/*- Function -*/
+
+/* Tandem repeat sort */
+void
+trsort(saidx_t *ISA, saidx_t *SA, saidx_t n, saidx_t depth) {
+ saidx_t *ISAd;
+ saidx_t *first, *last;
+ trbudget_t budget;
+ saidx_t t, skip, unsorted;
+
+ trbudget_init(&budget, tr_ilg(n) * 2 / 3, n);
+/* trbudget_init(&budget, tr_ilg(n) * 3 / 4, n); */
+ for(ISAd = ISA + depth; -n < *SA; ISAd += ISAd - ISA) {
+ first = SA;
+ skip = 0;
+ unsorted = 0;
+ do {
+ if((t = *first) < 0) { first -= t; skip += t; }
+ else {
+ if(skip != 0) { *(first + skip) = skip; skip = 0; }
+ last = SA + ISA[t] + 1;
+ if(1 < (last - first)) {
+ budget.count = 0;
+ tr_introsort(ISA, ISAd, SA, first, last, &budget);
+ if(budget.count != 0) { unsorted += budget.count; }
+ else { skip = first - last; }
+ } else if((last - first) == 1) {
+ skip = -1;
+ }
+ first = last;
+ }
+ } while(first < (SA + n));
+ if(skip != 0) { *(first + skip) = skip; }
+ if(unsorted == 0) { break; }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/utils.c b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/utils.c
new file mode 100644
index 000000000..90fb23efa
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/lib/utils.c
@@ -0,0 +1,381 @@
+/*
+ * utils.c for libdivsufsort
+ * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "divsufsort_private.h"
+
+
+/*- Private Function -*/
+
+/* Binary search for inverse bwt. */
+static
+saidx_t
+binarysearch_lower(const saidx_t *A, saidx_t size, saidx_t value) {
+ saidx_t half, i;
+ for(i = 0, half = size >> 1;
+ 0 < size;
+ size = half, half >>= 1) {
+ if(A[i + half] < value) {
+ i += half + 1;
+ half -= (size & 1) ^ 1;
+ }
+ }
+ return i;
+}
+
+
+/*- Functions -*/
+
+/* Burrows-Wheeler transform. */
+saint_t
+bw_transform(const sauchar_t *T, sauchar_t *U, saidx_t *SA,
+ saidx_t n, saidx_t *idx) {
+ saidx_t *A, i, j, p, t;
+ saint_t c;
+
+ /* Check arguments. */
+ if((T == NULL) || (U == NULL) || (n < 0) || (idx == NULL)) { return -1; }
+ if(n <= 1) {
+ if(n == 1) { U[0] = T[0]; }
+ *idx = n;
+ return 0;
+ }
+
+ if((A = SA) == NULL) {
+ i = divbwt(T, U, NULL, n);
+ if(0 <= i) { *idx = i; i = 0; }
+ return (saint_t)i;
+ }
+
+ /* BW transform. */
+ if(T == U) {
+ t = n;
+ for(i = 0, j = 0; i < n; ++i) {
+ p = t - 1;
+ t = A[i];
+ if(0 <= p) {
+ c = T[j];
+ U[j] = (j <= p) ? T[p] : (sauchar_t)A[p];
+ A[j] = c;
+ j++;
+ } else {
+ *idx = i;
+ }
+ }
+ p = t - 1;
+ if(0 <= p) {
+ c = T[j];
+ U[j] = (j <= p) ? T[p] : (sauchar_t)A[p];
+ A[j] = c;
+ } else {
+ *idx = i;
+ }
+ } else {
+ U[0] = T[n - 1];
+ for(i = 0; A[i] != 0; ++i) { U[i + 1] = T[A[i] - 1]; }
+ *idx = i + 1;
+ for(++i; i < n; ++i) { U[i] = T[A[i] - 1]; }
+ }
+
+ if(SA == NULL) {
+ /* Deallocate memory. */
+ free(A);
+ }
+
+ return 0;
+}
+
+/* Inverse Burrows-Wheeler transform. */
+saint_t
+inverse_bw_transform(const sauchar_t *T, sauchar_t *U, saidx_t *A,
+ saidx_t n, saidx_t idx) {
+ saidx_t C[ALPHABET_SIZE];
+ sauchar_t D[ALPHABET_SIZE];
+ saidx_t *B;
+ saidx_t i, p;
+ saint_t c, d;
+
+ /* Check arguments. */
+ if((T == NULL) || (U == NULL) || (n < 0) || (idx < 0) ||
+ (n < idx) || ((0 < n) && (idx == 0))) {
+ return -1;
+ }
+ if(n <= 1) { return 0; }
+
+ if((B = A) == NULL) {
+ /* Allocate n*sizeof(saidx_t) bytes of memory. */
+ if((B = (saidx_t *)malloc((size_t)n * sizeof(saidx_t))) == NULL) { return -2; }
+ }
+
+ /* Inverse BW transform. */
+ for(c = 0; c < ALPHABET_SIZE; ++c) { C[c] = 0; }
+ for(i = 0; i < n; ++i) { ++C[T[i]]; }
+ for(c = 0, d = 0, i = 0; c < ALPHABET_SIZE; ++c) {
+ p = C[c];
+ if(0 < p) {
+ C[c] = i;
+ D[d++] = (sauchar_t)c;
+ i += p;
+ }
+ }
+ for(i = 0; i < idx; ++i) { B[C[T[i]]++] = i; }
+ for( ; i < n; ++i) { B[C[T[i]]++] = i + 1; }
+ for(c = 0; c < d; ++c) { C[c] = C[D[c]]; }
+ for(i = 0, p = idx; i < n; ++i) {
+ U[i] = D[binarysearch_lower(C, d, p)];
+ p = B[p - 1];
+ }
+
+ if(A == NULL) {
+ /* Deallocate memory. */
+ free(B);
+ }
+
+ return 0;
+}
+
+/* Checks the suffix array SA of the string T. */
+saint_t
+sufcheck(const sauchar_t *T, const saidx_t *SA,
+ saidx_t n, saint_t verbose) {
+ saidx_t C[ALPHABET_SIZE];
+ saidx_t i, p, q, t;
+ saint_t c;
+
+ if(verbose) { fprintf(stderr, "sufcheck: "); }
+
+ /* Check arguments. */
+ if((T == NULL) || (SA == NULL) || (n < 0)) {
+ if(verbose) { fprintf(stderr, "Invalid arguments.\n"); }
+ return -1;
+ }
+ if(n == 0) {
+ if(verbose) { fprintf(stderr, "Done.\n"); }
+ return 0;
+ }
+
+ /* check range: [0..n-1] */
+ for(i = 0; i < n; ++i) {
+ if((SA[i] < 0) || (n <= SA[i])) {
+ if(verbose) {
+ fprintf(stderr, "Out of the range [0,%" PRIdSAIDX_T "].\n"
+ " SA[%" PRIdSAIDX_T "]=%" PRIdSAIDX_T "\n",
+ n - 1, i, SA[i]);
+ }
+ return -2;
+ }
+ }
+
+ /* check first characters. */
+ for(i = 1; i < n; ++i) {
+ if(T[SA[i - 1]] > T[SA[i]]) {
+ if(verbose) {
+ fprintf(stderr, "Suffixes in wrong order.\n"
+ " T[SA[%" PRIdSAIDX_T "]=%" PRIdSAIDX_T "]=%d"
+ " > T[SA[%" PRIdSAIDX_T "]=%" PRIdSAIDX_T "]=%d\n",
+ i - 1, SA[i - 1], T[SA[i - 1]], i, SA[i], T[SA[i]]);
+ }
+ return -3;
+ }
+ }
+
+ /* check suffixes. */
+ for(i = 0; i < ALPHABET_SIZE; ++i) { C[i] = 0; }
+ for(i = 0; i < n; ++i) { ++C[T[i]]; }
+ for(i = 0, p = 0; i < ALPHABET_SIZE; ++i) {
+ t = C[i];
+ C[i] = p;
+ p += t;
+ }
+
+ q = C[T[n - 1]];
+ C[T[n - 1]] += 1;
+ for(i = 0; i < n; ++i) {
+ p = SA[i];
+ if(0 < p) {
+ c = T[--p];
+ t = C[c];
+ } else {
+ c = T[p = n - 1];
+ t = q;
+ }
+ if((t < 0) || (p != SA[t])) {
+ if(verbose) {
+ fprintf(stderr, "Suffix in wrong position.\n"
+ " SA[%" PRIdSAIDX_T "]=%" PRIdSAIDX_T " or\n"
+ " SA[%" PRIdSAIDX_T "]=%" PRIdSAIDX_T "\n",
+ t, (0 <= t) ? SA[t] : -1, i, SA[i]);
+ }
+ return -4;
+ }
+ if(t != q) {
+ ++C[c];
+ if((n <= C[c]) || (T[SA[C[c]]] != c)) { C[c] = -1; }
+ }
+ }
+
+ if(1 <= verbose) { fprintf(stderr, "Done.\n"); }
+ return 0;
+}
+
+
+static
+int
+_compare(const sauchar_t *T, saidx_t Tsize,
+ const sauchar_t *P, saidx_t Psize,
+ saidx_t suf, saidx_t *match) {
+ saidx_t i, j;
+ saint_t r;
+ for(i = suf + *match, j = *match, r = 0;
+ (i < Tsize) && (j < Psize) && ((r = T[i] - P[j]) == 0); ++i, ++j) { }
+ *match = j;
+ return (r == 0) ? -(j != Psize) : r;
+}
+
+/* Search for the pattern P in the string T. */
+saidx_t
+sa_search(const sauchar_t *T, saidx_t Tsize,
+ const sauchar_t *P, saidx_t Psize,
+ const saidx_t *SA, saidx_t SAsize,
+ saidx_t *idx) {
+ saidx_t size, lsize, rsize, half;
+ saidx_t match, lmatch, rmatch;
+ saidx_t llmatch, lrmatch, rlmatch, rrmatch;
+ saidx_t i, j, k;
+ saint_t r;
+
+ if(idx != NULL) { *idx = -1; }
+ if((T == NULL) || (P == NULL) || (SA == NULL) ||
+ (Tsize < 0) || (Psize < 0) || (SAsize < 0)) { return -1; }
+ if((Tsize == 0) || (SAsize == 0)) { return 0; }
+ if(Psize == 0) { if(idx != NULL) { *idx = 0; } return SAsize; }
+
+ for(i = j = k = 0, lmatch = rmatch = 0, size = SAsize, half = size >> 1;
+ 0 < size;
+ size = half, half >>= 1) {
+ match = MIN(lmatch, rmatch);
+ r = _compare(T, Tsize, P, Psize, SA[i + half], &match);
+ if(r < 0) {
+ i += half + 1;
+ half -= (size & 1) ^ 1;
+ lmatch = match;
+ } else if(r > 0) {
+ rmatch = match;
+ } else {
+ lsize = half, j = i, rsize = size - half - 1, k = i + half + 1;
+
+ /* left part */
+ for(llmatch = lmatch, lrmatch = match, half = lsize >> 1;
+ 0 < lsize;
+ lsize = half, half >>= 1) {
+ lmatch = MIN(llmatch, lrmatch);
+ r = _compare(T, Tsize, P, Psize, SA[j + half], &lmatch);
+ if(r < 0) {
+ j += half + 1;
+ half -= (lsize & 1) ^ 1;
+ llmatch = lmatch;
+ } else {
+ lrmatch = lmatch;
+ }
+ }
+
+ /* right part */
+ for(rlmatch = match, rrmatch = rmatch, half = rsize >> 1;
+ 0 < rsize;
+ rsize = half, half >>= 1) {
+ rmatch = MIN(rlmatch, rrmatch);
+ r = _compare(T, Tsize, P, Psize, SA[k + half], &rmatch);
+ if(r <= 0) {
+ k += half + 1;
+ half -= (rsize & 1) ^ 1;
+ rlmatch = rmatch;
+ } else {
+ rrmatch = rmatch;
+ }
+ }
+
+ break;
+ }
+ }
+
+ if(idx != NULL) { *idx = (0 < (k - j)) ? j : i; }
+ return k - j;
+}
+
+/* Search for the character c in the string T. */
+saidx_t
+sa_simplesearch(const sauchar_t *T, saidx_t Tsize,
+ const saidx_t *SA, saidx_t SAsize,
+ saint_t c, saidx_t *idx) {
+ saidx_t size, lsize, rsize, half;
+ saidx_t i, j, k, p;
+ saint_t r;
+
+ if(idx != NULL) { *idx = -1; }
+ if((T == NULL) || (SA == NULL) || (Tsize < 0) || (SAsize < 0)) { return -1; }
+ if((Tsize == 0) || (SAsize == 0)) { return 0; }
+
+ for(i = j = k = 0, size = SAsize, half = size >> 1;
+ 0 < size;
+ size = half, half >>= 1) {
+ p = SA[i + half];
+ r = (p < Tsize) ? T[p] - c : -1;
+ if(r < 0) {
+ i += half + 1;
+ half -= (size & 1) ^ 1;
+ } else if(r == 0) {
+ lsize = half, j = i, rsize = size - half - 1, k = i + half + 1;
+
+ /* left part */
+ for(half = lsize >> 1;
+ 0 < lsize;
+ lsize = half, half >>= 1) {
+ p = SA[j + half];
+ r = (p < Tsize) ? T[p] - c : -1;
+ if(r < 0) {
+ j += half + 1;
+ half -= (lsize & 1) ^ 1;
+ }
+ }
+
+ /* right part */
+ for(half = rsize >> 1;
+ 0 < rsize;
+ rsize = half, half >>= 1) {
+ p = SA[k + half];
+ r = (p < Tsize) ? T[p] - c : -1;
+ if(r <= 0) {
+ k += half + 1;
+ half -= (rsize & 1) ^ 1;
+ }
+ }
+
+ break;
+ }
+ }
+
+ if(idx != NULL) { *idx = (0 < (k - j)) ? j : i; }
+ return k - j;
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/pkgconfig/CMakeLists.txt b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/pkgconfig/CMakeLists.txt
new file mode 100644
index 000000000..ee7063c98
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/pkgconfig/CMakeLists.txt
@@ -0,0 +1,9 @@
+## generate libdivsufsort.pc ##
+set(W64BIT "")
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libdivsufsort.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libdivsufsort.pc" @ONLY)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libdivsufsort.pc" DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR})
+if(BUILD_DIVSUFSORT64)
+ set(W64BIT "64")
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libdivsufsort.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libdivsufsort64.pc" @ONLY)
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libdivsufsort64.pc" DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR})
+endif(BUILD_DIVSUFSORT64)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/pkgconfig/libdivsufsort.pc.cmake b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/pkgconfig/libdivsufsort.pc.cmake
new file mode 100644
index 000000000..6419d1ea8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/libdivsufsort/pkgconfig/libdivsufsort.pc.cmake
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=@CMAKE_INSTALL_LIBDIR@
+includedir=@CMAKE_INSTALL_INCLUDEDIR@
+
+Name: @PROJECT_NAME@@W64BIT@
+Description: @PROJECT_DESCRIPTION@
+Version: @PROJECT_VERSION_FULL@
+URL: @PROJECT_URL@
+Libs: -L${libdir} -ldivsufsort@W64BIT@
+Cflags: -I${includedir}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/read_dist.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/read_dist.h
new file mode 100644
index 000000000..63d3b97ff
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/read_dist.h
@@ -0,0 +1,50 @@
+/* Copyright 2016 Google Inc. All Rights Reserved.
+ Author: zip753@gmail.com (Ivan Nikulin)
+
+ Distributed under MIT license.
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* API for reading distances from *.dist file.
+ The format of *.dist file is as follows: for each backward reference there is
+ a position-distance pair, also a copy length may be specified. Copy length is
+ prefixed with flag byte 0, position-distance pair is prefixed with flag
+ byte 1. Each number is a 32-bit integer. Copy length always comes before
+ position-distance pair. Standalone copy length is allowed, in this case it is
+ ignored. */
+
+#ifndef BROTLI_RESEARCH_READ_DIST_H_
+#define BROTLI_RESEARCH_READ_DIST_H_
+
+#include <cstdio>
+#include <cstdlib> /* exit, EXIT_FAILURE */
+
+#if !defined(CHECK)
+#define CHECK(X) if (!(X)) exit(EXIT_FAILURE);
+#endif
+
+/* Reads backwards reference from .dist file. Sets all missing fields to -1.
+ Returns false when EOF is met or input is corrupt. */
+bool ReadBackwardReference(FILE* fin, int* copy, int* pos, int* dist) {
+ int c = getc(fin);
+ if (c == EOF) return false;
+ if (c == 0) {
+ CHECK(fread(copy, sizeof(int), 1, fin) == 1);
+ if ((c = getc(fin)) != 1) {
+ ungetc(c, fin);
+ *pos = *dist = -1;
+ } else {
+ CHECK(fread(pos, sizeof(int), 1, fin) == 1);
+ CHECK(fread(dist, sizeof(int), 1, fin) == 1);
+ }
+ } else if (c != 1) {
+ return false;
+ } else {
+ CHECK(fread(pos, sizeof(int), 1, fin) == 1);
+ CHECK(fread(dist, sizeof(int), 1, fin) == 1);
+ *copy = -1;
+ }
+ return true;
+}
+
+#endif /* BROTLI_RESEARCH_READ_DIST_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/sieve.cc b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/sieve.cc
new file mode 100755
index 000000000..4d147e112
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/sieve.cc
@@ -0,0 +1,259 @@
+#include "./sieve.h"
+
+/* Pointer to position in (combined corpus) text. */
+typedef uint32_t TextIdx;
+
+/* Index of sample / generation. */
+typedef uint16_t SampleIdx;
+
+typedef struct Slot {
+ TextIdx next;
+ TextIdx offset;
+ SampleIdx presence;
+ SampleIdx mark;
+} Slot;
+
+static const TextIdx kNowhere = static_cast<TextIdx>(-1);
+
+static TextIdx dryRun(TextIdx sliceLen, Slot* map, TextIdx* shortcut,
+ TextIdx end, TextIdx middle, SampleIdx minPresence, SampleIdx iteration) {
+ TextIdx from = kNowhere;
+ TextIdx to = kNowhere;
+ TextIdx result = 0;
+ SampleIdx targetPresence = minPresence;
+ for (TextIdx i = 0; i < end; ++i) {
+ if (i == middle) {
+ targetPresence++;
+ }
+ Slot& item = map[shortcut[i]];
+ if (item.mark != iteration) {
+ item.mark = iteration;
+ if (item.presence >= targetPresence) {
+ if ((to == kNowhere) || (to < i)) {
+ if (from != kNowhere) {
+ result += to - from;
+ }
+ from = i;
+ }
+ to = i + sliceLen;
+ }
+ }
+ }
+ if (from != kNowhere) {
+ result += to - from;
+ }
+ return result;
+}
+
+static std::string createDictionary(const uint8_t* data, TextIdx sliceLen,
+ Slot* map, TextIdx* shortcut, TextIdx end, TextIdx middle,
+ SampleIdx minPresence, SampleIdx iteration) {
+ std::string output;
+ TextIdx from = kNowhere;
+ TextIdx to = kNowhere;
+ SampleIdx targetPresence = minPresence;
+ for (TextIdx i = 0; i < end; ++i) {
+ if (i == middle) {
+ targetPresence++;
+ }
+ Slot& item = map[shortcut[i]];
+ if (item.mark != iteration) {
+ item.mark = iteration;
+ if (item.presence >= targetPresence) {
+ if ((to == kNowhere) || (to < i)) {
+ if (from != kNowhere) {
+ output.insert(output.end(), &data[from], &data[to]);
+ }
+ from = i;
+ }
+ to = i + sliceLen;
+ }
+ }
+ }
+ if (from != kNowhere) {
+ output.insert(output.end(), &data[from], &data[to]);
+ }
+ return output;
+}
+
+std::string sieve_generate(size_t dictionary_size_limit, size_t slice_len,
+ const std::vector<size_t>& sample_sizes, const uint8_t* sample_data) {
+ /* Parameters aliasing */
+ TextIdx targetSize = static_cast<TextIdx>(dictionary_size_limit);
+ if (targetSize != dictionary_size_limit) {
+ fprintf(stderr, "dictionary_size_limit is too large\n");
+ return "";
+ }
+ TextIdx sliceLen = static_cast<TextIdx>(slice_len);
+ if (sliceLen != slice_len) {
+ fprintf(stderr, "slice_len is too large\n");
+ return "";
+ }
+ if (sliceLen < 1) {
+ fprintf(stderr, "slice_len is too small\n");
+ return "";
+ }
+ SampleIdx numSamples = static_cast<SampleIdx>(sample_sizes.size());
+ if ((numSamples != sample_sizes.size()) || (numSamples * 2 < numSamples)) {
+ fprintf(stderr, "too many samples\n");
+ return "";
+ }
+ const uint8_t* data = sample_data;
+
+ TextIdx total = 0;
+ std::vector<TextIdx> offsets;
+ for (SampleIdx i = 0; i < numSamples; ++i) {
+ TextIdx delta = static_cast<TextIdx>(sample_sizes[i]);
+ if (delta != sample_sizes[i]) {
+ fprintf(stderr, "sample is too large\n");
+ return "";
+ }
+ if (delta == 0) {
+ fprintf(stderr, "empty samples are prohibited\n");
+ return "";
+ }
+ if (total + delta <= total) {
+ fprintf(stderr, "corpus is too large\n");
+ return "";
+ }
+ total += delta;
+ offsets.push_back(total);
+ }
+
+ if (total * 2 < total) {
+ fprintf(stderr, "corpus is too large\n");
+ return "";
+ }
+
+ if (total < sliceLen) {
+ fprintf(stderr, "slice_len is larger than corpus size\n");
+ return "";
+ }
+
+ /*****************************************************************************
+ * Build coverage map.
+ ****************************************************************************/
+ std::vector<Slot> map;
+ std::vector<TextIdx> shortcut;
+ map.push_back({0, 0, 0, 0});
+ TextIdx end = total - sliceLen;
+ TextIdx hashLen = 11;
+ while (hashLen < 29 && ((1u << hashLen) < end)) {
+ hashLen += 3;
+ }
+ hashLen -= 3;
+ TextIdx hashMask = (1u << hashLen) - 1u;
+ std::vector<TextIdx> hashHead(1 << hashLen);
+ TextIdx hashSlot = 1;
+ SampleIdx piece = 0;
+ TextIdx hash = 0;
+ TextIdx lShift = 3;
+ TextIdx rShift = hashLen - lShift;
+ for (TextIdx i = 0; i < sliceLen - 1; ++i) {
+ TextIdx v = data[i];
+ hash = (((hash << lShift) | (hash >> rShift)) & hashMask) ^ v;
+ }
+ TextIdx lShiftX = (lShift * (sliceLen - 1)) % hashLen;
+ TextIdx rShiftX = hashLen - lShiftX;
+ for (TextIdx i = 0; i < end; ++i) {
+ TextIdx v = data[i + sliceLen - 1];
+ hash = (((hash << lShift) | (hash >> rShift)) & hashMask) ^ v;
+
+ if (offsets[piece] == i) {
+ piece++;
+ }
+ TextIdx slot = hashHead[hash];
+ while (slot != 0) {
+ Slot& item = map[slot];
+ TextIdx start = item.offset;
+ bool miss = false;
+ for (TextIdx j = 0; j < sliceLen; ++j) {
+ if (data[i + j] != data[start + j]) {
+ miss = true;
+ break;
+ }
+ }
+ if (!miss) {
+ if (item.mark != piece) {
+ item.mark = piece;
+ item.presence++;
+ }
+ shortcut.push_back(slot);
+ break;
+ }
+ slot = item.next;
+ }
+ if (slot == 0) {
+ map.push_back({hashHead[hash], i, 1, piece});
+ hashHead[hash] = hashSlot;
+ shortcut.push_back(hashSlot);
+ hashSlot++;
+ }
+ v = data[i];
+ hash ^= ((v << lShiftX) | (v >> rShiftX)) & hashMask;
+ }
+
+ /*****************************************************************************
+ * Build dictionary of specified size.
+ ****************************************************************************/
+ SampleIdx a = 1;
+ TextIdx size = dryRun(
+ sliceLen, map.data(), shortcut.data(), end, end, a, ++piece);
+ /* Maximal output is smaller than target. */
+ if (size <= targetSize) {
+ return createDictionary(
+ data, sliceLen, map.data(), shortcut.data(), end, end, a, ++piece);
+ }
+
+ SampleIdx b = numSamples;
+ size = dryRun(sliceLen, map.data(), shortcut.data(), end, end, b, ++piece);
+ if (size == targetSize) {
+ return createDictionary(
+ data, sliceLen, map.data(), shortcut.data(), end, end, b, ++piece);
+ }
+ /* Run binary search. */
+ if (size < targetSize) {
+ /* size(a) > targetSize > size(b) && a < m < b */
+ while (a + 1 < b) {
+ SampleIdx m = static_cast<SampleIdx>((a + b) / 2);
+ size = dryRun(
+ sliceLen, map.data(), shortcut.data(), end, end, m, ++piece);
+ if (size < targetSize) {
+ b = m;
+ } else if (size > targetSize) {
+ a = m;
+ } else {
+ return createDictionary(
+ data, sliceLen, map.data(), shortcut.data(), end, end, b, ++piece);
+ }
+ }
+ } else {
+ a = b;
+ }
+ /* size(minPresence) > targetSize > size(minPresence + 1) */
+ SampleIdx minPresence = a;
+ TextIdx c = 0;
+ TextIdx d = end;
+ /* size(a) < targetSize < size(b) && a < m < b */
+ while (c + 1 < d) {
+ TextIdx m = (c + d) / 2;
+ size = dryRun(
+ sliceLen, map.data(), shortcut.data(), end, m, minPresence, ++piece);
+ if (size < targetSize) {
+ c = m;
+ } else if (size > targetSize) {
+ d = m;
+ } else {
+ return createDictionary(data, sliceLen, map.data(), shortcut.data(), end,
+ m, minPresence, ++piece);
+ }
+ }
+
+ bool unrestricted = false;
+ if (minPresence <= 2 && !unrestricted) {
+ minPresence = 2;
+ c = end;
+ }
+ return createDictionary(data, sliceLen, map.data(), shortcut.data(), end, c,
+ minPresence, ++piece);
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/sieve.h b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/sieve.h
new file mode 100755
index 000000000..6c65dc8e0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/research/sieve.h
@@ -0,0 +1,21 @@
+#ifndef BROTLI_RESEARCH_SIEVE_H_
+#define BROTLI_RESEARCH_SIEVE_H_
+
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <vector>
+
+/**
+ * Generate a dictionary for given samples.
+ *
+ * @param dictionary_size_limit maximal dictionary size
+ * @param slice_len text slice size
+ * @param sample_sizes vector with sample sizes
+ * @param sample_data concatenated samples
+ * @return generated dictionary
+ */
+std::string sieve_generate(size_t dictionary_size_limit, size_t slice_len,
+ const std::vector<size_t>& sample_sizes, const uint8_t* sample_data);
+
+#endif // BROTLI_RESEARCH_SIEVE_H_
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/.bintray.json b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/.bintray.json
new file mode 100644
index 000000000..ef2ea9d8e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/.bintray.json
@@ -0,0 +1,19 @@
+{
+ "package": {
+ "name": "bin",
+ "repo": "brotli",
+ "subject": "eustas"
+ },
+
+ "version": {"name": "snapshot"},
+
+ "files": [
+ {
+ "includePattern": "brotli.zip",
+ "uploadPattern": "brotli-${TRAVIS_OS_NAME}-${RELEASE_DATE}.zip",
+ "matrix_params": {"override": 1}
+ }
+ ],
+
+ "publish": true
+}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/.configure-custom.sh b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/.configure-custom.sh
new file mode 100644
index 000000000..f1f641af1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/.configure-custom.sh
@@ -0,0 +1 @@
+#!/usr/bin/env bash
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/.travis.sh b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/.travis.sh
new file mode 100755
index 000000000..8b7e2b314
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/.travis.sh
@@ -0,0 +1,81 @@
+#!/bin/bash
+
+case "$1" in
+ "before_install")
+ ;;
+ "install")
+ case "${TRAVIS_OS_NAME}" in
+ "osx")
+ brew update
+ brew install binutils
+
+ case "${CC}" in
+ "gcc-"*)
+ which ${CC} || brew install $(echo "${CC}" | sed 's/\-/@/') || brew link --overwrite $(echo "${CC}" | sed 's/\-/@/')
+ ;;
+ esac
+
+ case "${BUILD_SYSTEM}" in
+ "bazel")
+ brew install bazel
+ brew upgrade python
+ ;;
+ esac
+ ;;
+ "linux")
+ case "${CC}" in
+ "pgcc")
+ wget 'https://raw.githubusercontent.com/nemequ/pgi-travis/de6212d94fd0e7d07a6ef730c23548c337c436a7/install-pgi.sh'
+ echo 'acd3ef995ad93cfb87d26f65147395dcbedd4c3c844ee6ec39616f1a347c8df5 install-pgi.sh' | sha256sum -c --strict || exit 1
+ /bin/sh install-pgi.sh
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ "script")
+ case "${BUILD_SYSTEM}" in
+ "cmake")
+ mkdir builddir && cd builddir
+ CMAKE_FLAGS=
+ if [ "${CROSS_COMPILE}" = "yes" ]; then
+ CMAKE_FLAGS="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_RC_COMPILER=${RC_COMPILER}"
+ fi
+ cmake ${CMAKE_FLAGS} -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DENABLE_SANITIZER="${SANITIZER}" -DCMAKE_C_FLAGS="${CFLAGS}" .. || exit 1
+ make VERBOSE=1 || exit 1
+ ctest -V || exit 1
+ ;;
+ "python")
+ python setup.py test
+ ;;
+ "maven")
+ cd java/org/brotli
+ mvn install && cd integration && mvn verify
+ ;;
+ "autotools")
+ ./bootstrap && ./configure && make
+ ;;
+ "fuzz")
+ ./c/fuzz/test_fuzzer.sh
+ ;;
+ "bazel")
+ bazel build -c opt ...:all &&
+ cd go && bazel test -c opt ...:all && cd .. &&
+ cd java && bazel test -c opt ...:all && cd .. &&
+ cd js && bazel test -c opt ...:all && cd .. &&
+ cd research && bazel build -c opt ...:all && cd ..
+ ;;
+ esac
+ ;;
+ "after_success")
+ ;;
+ "before_deploy")
+ case "${BUILD_SYSTEM}" in
+ "bazel")
+ export RELEASE_DATE=`date +%Y-%m-%d`
+ perl -p -i -e 's/\$\{([^}]+)\}/defined $ENV{$1} ? $ENV{$1} : $&/eg' scripts/.bintray.json
+ zip -j9 brotli.zip bazel-bin/libbrotli*.a bazel-bin/libbrotli*.so bazel-bin/brotli
+ ;;
+ esac
+ ;;
+esac
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/appveyor.yml b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/appveyor.yml
new file mode 100644
index 000000000..e22a8c689
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/appveyor.yml
@@ -0,0 +1,111 @@
+branches:
+ only:
+ - master
+
+environment:
+ matrix:
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+ BUILD_SYSTEM: CMake
+ GENERATOR: Visual Studio 15 2017 Win64
+ CONFIG: Release
+
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+ BUILD_SYSTEM: CMake
+ GENERATOR: Visual Studio 15 2017 Win64
+ CONFIG: Debug
+
+ - BUILD_SYSTEM: CMake
+ GENERATOR: Visual Studio 14 2015 Win64
+ CONFIG: Debug
+
+ - BUILD_SYSTEM: CMake
+ GENERATOR: Visual Studio 14 2015
+ CONFIG: Debug
+
+ - BUILD_SYSTEM: Python
+ PYTHON: "C:\\Python27"
+ PYTHON_VERSION: "2.7.x"
+ PYTHON_ARCH: "32"
+
+ - BUILD_SYSTEM: Python
+ PYTHON: "C:\\Python36-x64"
+ PYTHON_VERSION: "3.6.x"
+ PYTHON_ARCH: "64"
+
+ - BUILD_SYSTEM: make
+ ARCH: "i686"
+
+ - BUILD_SYSTEM: make
+ ARCH: "x86_64"
+
+ - BUILD_SYSTEM: bazel
+
+install:
+- IF "%BUILD_SYSTEM%"=="Python" (
+ SET "PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%" &&
+ python -m pip install --upgrade pip &&
+ pip install --upgrade setuptools
+ )
+- IF "%BUILD_SYSTEM%"=="make" (
+ IF "%ARCH%"=="i686" (
+ SET "TOOLCHAIN=i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32"
+ ) ELSE (
+ SET "TOOLCHAIN=x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64"
+ )
+ )
+- IF "%BUILD_SYSTEM%"=="bazel" (
+ appveyor DownloadFile https://github.com/bazelbuild/bazel/releases/download/0.18.0/bazel-0.18.0-windows-x86_64.exe -FileName bazel.exe
+ )
+
+before_build:
+- FOR /f %%i in ('C:\cygwin64\bin\date.exe +%%Y-%%m-%%d') DO SET "RELEASE_DATE=%%i"
+- IF "%BUILD_SYSTEM%"=="CMake" ( mkdir builddir && cd builddir && cmake -G "%GENERATOR%" .. )
+- IF "%BUILD_SYSTEM%"=="make" (
+ SET "CC=gcc" &&
+ SET "PATH=C:\mingw-w64\%TOOLCHAIN%\bin;%PATH%" &&
+ COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\%TOOLCHAIN%\bin\make.exe
+ )
+- SET "ROOT=%APPVEYOR_BUILD_FOLDER%"
+
+build_script:
+- IF "%BUILD_SYSTEM%"=="CMake" ( cmake --build . --config %CONFIG% )
+- IF "%BUILD_SYSTEM%"=="Python" ( python setup.py build_ext )
+- IF "%BUILD_SYSTEM%"=="make" (
+ sh -c "make brotli" &&
+ cd bin && 7z a -tzip -mx9 brotli-win-%ARCH%-%RELEASE_DATE%.zip brotli.exe &&
+ appveyor PushArtifact brotli-win-%ARCH%-%RELEASE_DATE%.zip && cd ..
+ )
+- IF "%BUILD_SYSTEM%"=="bazel" (
+ cd java &&
+ %ROOT%\bazel.exe --batch build -c opt org/brotli/wrapper/...:all &&
+ python %ROOT%\scripts\fix-win-bazel-build.py &&
+ cd bazel-bin &&
+ 7z a -tzip -mx9 brotli-win-bazel-jni-%RELEASE_DATE%.zip brotli_jni.dll &&
+ appveyor PushArtifact brotli-win-bazel-jni-%RELEASE_DATE%.zip &&
+ cd .. &&
+ cd ..
+ )
+
+test_script:
+- IF "%BUILD_SYSTEM%"=="CMake" ( ctest --output-on-failure --interactive-debug-mode 0 -C %CONFIG% )
+- IF "%BUILD_SYSTEM%"=="Python" ( python setup.py test )
+- IF "%BUILD_SYSTEM%"=="make" ( sh -c "make test" )
+- IF "%BUILD_SYSTEM%"=="bazel" (
+ cd java &&
+ %ROOT%\bazel.exe --batch test -c opt --test_output streamed org/brotli/wrapper/...:all &&
+ cd ..
+ )
+
+deploy:
+- provider: BinTray
+ on:
+ branch: master
+ username: eustas
+ api_key:
+ secure: B3rM8JYeIHIw6BfOjHggAeyTmxEf8ZDYmyF9gCwqyWaxyxECD9BuN50SiV2KE/RI
+ subject: eustas
+ repo: brotli
+ package: bin
+ version: snapshot
+ publish: true
+ override: true
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/README.md b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/README.md
new file mode 100644
index 000000000..366a82c3f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/README.md
@@ -0,0 +1,3 @@
+Set of tools that can be used to download brotli RFC, extract and validate
+binary dictionary, and generate dictionary derivatives
+(e.g. Java `DictionaryData` class constants).
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-01-download-rfc.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-01-download-rfc.py
new file mode 100644
index 000000000..14f65cc42
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-01-download-rfc.py
@@ -0,0 +1,16 @@
+# Step 01 - download RFC7932.
+#
+# RFC is the ultimate source for brotli format and constants, including
+# static dictionary.
+
+import urllib2
+
+response = urllib2.urlopen('https://tools.ietf.org/rfc/rfc7932.txt')
+
+text = response.read()
+path = "rfc7932.txt"
+
+with open(path, "w") as rfc:
+ rfc.write(text)
+
+print("Downloaded and saved " + str(len(text)) + " bytes to " + path)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-02-rfc-to-bin.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-02-rfc-to-bin.py
new file mode 100644
index 000000000..27737c583
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-02-rfc-to-bin.py
@@ -0,0 +1,34 @@
+# Step 02 - parse RFC.
+#
+# Static dictionary is described in "Appendix A" section in a hexadecimal form.
+# This tool locates dictionary data in RFC and converts it to raw binary format.
+
+import re
+
+rfc_path = "rfc7932.txt"
+
+with open(rfc_path, "r") as rfc:
+ lines = rfc.readlines()
+
+re_data_line = re.compile("^ [0-9a-f]{64}$")
+
+appendix_a_found = False
+dictionary = []
+for line in lines:
+ if appendix_a_found:
+ if re_data_line.match(line) is not None:
+ data = line.strip()
+ for i in range(32):
+ dictionary.append(int(data[2 * i : 2 * i + 2], 16))
+ if len(dictionary) == 122784:
+ break
+ else:
+ if line.startswith("Appendix A."):
+ appendix_a_found = True
+
+bin_path = "dictionary.bin"
+
+with open(bin_path, "wb") as output:
+ output.write(bytearray(dictionary))
+
+print("Parsed and saved " + str(len(dictionary)) + " bytes to " + bin_path)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-03-validate-bin.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-03-validate-bin.py
new file mode 100644
index 000000000..171cc9b8c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-03-validate-bin.py
@@ -0,0 +1,38 @@
+# Step 03 - validate raw dictionary file.
+#
+# CRC32, MD5, SHA1 and SHA256 checksums for raw binary dictionary are checked.
+
+import hashlib
+import zlib
+
+bin_path = "dictionary.bin"
+
+with open(bin_path, "rb") as raw:
+ data = raw.read()
+
+def check_digest(name, expected, actual):
+ if expected == actual:
+ print("[OK] " + name)
+ else:
+ print("[ERROR] " + name + " | " + expected + " != " + actual)
+
+
+check_digest(
+ "CRC32", # This is the only checksum provided in RFC.
+ "0x5136cb04",
+ hex(zlib.crc32(data)))
+
+check_digest(
+ "MD5",
+ "96cecd2ee7a666d5aa3627d74735b32a",
+ hashlib.md5(data).hexdigest())
+
+check_digest(
+ "SHA1",
+ "72b41051cb61a9281ba3c4414c289da50d9a7640",
+ hashlib.sha1(data).hexdigest())
+
+check_digest(
+ "SHA256",
+ "20e42eb1b511c21806d4d227d07e5dd06877d8ce7b3a817f378f313653f35c70",
+ hashlib.sha256(data).hexdigest())
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-04-generate-java-literals.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-04-generate-java-literals.py
new file mode 100644
index 000000000..fd3c64e00
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/dictionary/step-04-generate-java-literals.py
@@ -0,0 +1,79 @@
+# Step 04 - generate Java literals.
+#
+# Java byte-code has ridiculous restrictions. There is no such thing as
+# "array literal" - those are implemented as series of data[x] = y;
+# as a consequence N-byte array will use 7N bytes in class, plus N bytes
+# in instantiated variable. Also no literal could be longer than 64KiB.
+#
+# To keep dictionary data compact both in source code and in compiled format
+# we use the following tricks:
+# * use String as a data container
+# * store only lowest 7 bits; i.e. all characters fit ASCII table; this allows
+# efficient conversion to byte array; also ASCII characters use only 1 byte
+#. of memory (UTF-8 encoding)
+# * RLE-compress sequence of 8-th bits
+#
+# This script generates literals used in Java code.
+
+bin_path = "dictionary.bin"
+
+with open(bin_path, "rb") as raw:
+ data = raw.read()
+
+low = []
+hi = []
+is_skip = True
+skip_flip_offset = 36
+cntr = skip_flip_offset
+for b in data:
+ value = ord(b)
+ low.append(chr(value & 0x7F))
+ if is_skip:
+ if value < 0x80:
+ cntr += 1
+ else:
+ is_skip = False
+ hi.append(unichr(cntr))
+ cntr = skip_flip_offset + 1
+ else:
+ if value >= 0x80:
+ cntr += 1
+ else:
+ is_skip = True
+ hi.append(unichr(cntr))
+ cntr = skip_flip_offset + 1
+hi.append(unichr(cntr))
+
+low0 = low[0 : len(low) // 2]
+low1 = low[len(low) // 2 : len(low)]
+
+def escape(chars):
+ result = []
+ for c in chars:
+ if "\r" == c:
+ result.append("\\r")
+ elif "\n" == c:
+ result.append("\\n")
+ elif "\t" == c:
+ result.append("\\t")
+ elif "\"" == c:
+ result.append("\\\"")
+ elif "\\" == c:
+ result.append("\\\\")
+ elif ord(c) < 32 or ord(c) >= 127:
+ result.append("\\u%04X" % ord(c))
+ else:
+ result.append(c);
+ return result
+
+
+source_code = [
+ " private static final String DATA0 = \"", "".join(escape(low0)), "\";\n",
+ " private static final String DATA1 = \"", "".join(escape(low1)), "\";\n",
+ " private static final String SKIP_FLIP = \"", "".join(escape(hi)), "\";\n"
+]
+
+src_path = "DictionaryData.inc.java"
+
+with open(src_path, "w") as source:
+ source.write("".join(source_code))
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/fix-win-bazel-build.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/fix-win-bazel-build.py
new file mode 100644
index 000000000..7a9b21198
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/fix-win-bazel-build.py
@@ -0,0 +1,36 @@
+import fnmatch
+import os
+import os.path
+from shutil import copyfile
+
+print('Searching for manifests...')
+
+matches = []
+for root, dirnames, filenames in os.walk('bazel-bin\\org\\brotli'):
+ for filename in fnmatch.filter(filenames, '*.runfiles_manifest'):
+ matches.append(os.path.join(root, filename))
+
+for match in matches:
+ print('Scanning manifest ' + match)
+ runfiles = match[:-len('_manifest')]
+ with open(match) as manifest:
+ for entry in manifest:
+ entry = entry.strip()
+ if not entry.startswith("org_brotli_java"):
+ continue
+ if entry.startswith('org_brotli_java/external'):
+ continue
+ (alias, space, link) = entry.partition(' ')
+ if alias.endswith('.jar') or alias.endswith('.exe'):
+ continue
+ link = link.replace('/', '\\')
+ alias = alias.replace('/', '\\')
+ dst = os.path.join(runfiles, alias)
+ if not os.path.exists(dst):
+ print(link + ' -> ' + dst)
+ parent = os.path.dirname(dst)
+ if not os.path.exists(parent):
+ os.makedirs(parent)
+ copyfile(link, dst)
+
+print('Finished resolving symlinks')
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/libbrotlicommon.pc.in b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/libbrotlicommon.pc.in
new file mode 100644
index 000000000..2a8cf7a35
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/libbrotlicommon.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libbrotlicommon
+URL: https://github.com/google/brotli
+Description: Brotli common dictionary library
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lbrotlicommon
+Cflags: -I${includedir}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/libbrotlidec.pc.in b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/libbrotlidec.pc.in
new file mode 100644
index 000000000..6f8ef2e41
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/libbrotlidec.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libbrotlidec
+URL: https://github.com/google/brotli
+Description: Brotli decoder library
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lbrotlidec
+Requires.private: libbrotlicommon >= 1.0.2
+Cflags: -I${includedir}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/libbrotlienc.pc.in b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/libbrotlienc.pc.in
new file mode 100644
index 000000000..2098afe2c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/libbrotlienc.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libbrotlienc
+URL: https://github.com/google/brotli
+Description: Brotli encoder library
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lbrotlienc
+Requires.private: libbrotlicommon >= 1.0.2
+Cflags: -I${includedir}
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/sources.lst b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/sources.lst
new file mode 100644
index 000000000..5e8e817c9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/scripts/sources.lst
@@ -0,0 +1,99 @@
+# IT WOULD BE FOOLISH TO USE COMPUTERS TO AUTOMATE REPETITIVE TASKS:
+# ENLIST EVERY USED HEADER AND SOURCE FILE MANUALLY!
+
+BROTLI_CLI_C = \
+ c/tools/brotli.c
+
+BROTLI_COMMON_C = \
+ c/common/dictionary.c \
+ c/common/transform.c
+
+BROTLI_COMMON_H = \
+ c/common/constants.h \
+ c/common/context.h \
+ c/common/dictionary.h \
+ c/common/platform.h \
+ c/common/transform.h \
+ c/common/version.h
+
+BROTLI_DEC_C = \
+ c/dec/bit_reader.c \
+ c/dec/decode.c \
+ c/dec/huffman.c \
+ c/dec/state.c
+
+BROTLI_DEC_H = \
+ c/dec/bit_reader.h \
+ c/dec/huffman.h \
+ c/dec/prefix.h \
+ c/dec/state.h
+
+BROTLI_ENC_C = \
+ c/enc/backward_references.c \
+ c/enc/backward_references_hq.c \
+ c/enc/bit_cost.c \
+ c/enc/block_splitter.c \
+ c/enc/brotli_bit_stream.c \
+ c/enc/cluster.c \
+ c/enc/compress_fragment.c \
+ c/enc/compress_fragment_two_pass.c \
+ c/enc/dictionary_hash.c \
+ c/enc/encode.c \
+ c/enc/encoder_dict.c \
+ c/enc/entropy_encode.c \
+ c/enc/histogram.c \
+ c/enc/literal_cost.c \
+ c/enc/memory.c \
+ c/enc/metablock.c \
+ c/enc/static_dict.c \
+ c/enc/utf8_util.c
+
+BROTLI_ENC_H = \
+ c/enc/backward_references.h \
+ c/enc/backward_references_hq.h \
+ c/enc/backward_references_inc.h \
+ c/enc/bit_cost.h \
+ c/enc/bit_cost_inc.h \
+ c/enc/block_encoder_inc.h \
+ c/enc/block_splitter.h \
+ c/enc/block_splitter_inc.h \
+ c/enc/brotli_bit_stream.h \
+ c/enc/cluster.h \
+ c/enc/cluster_inc.h \
+ c/enc/command.h \
+ c/enc/compress_fragment.h \
+ c/enc/compress_fragment_two_pass.h \
+ c/enc/dictionary_hash.h \
+ c/enc/encoder_dict.h \
+ c/enc/entropy_encode.h \
+ c/enc/entropy_encode_static.h \
+ c/enc/fast_log.h \
+ c/enc/find_match_length.h \
+ c/enc/hash.h \
+ c/enc/hash_composite_inc.h \
+ c/enc/hash_forgetful_chain_inc.h \
+ c/enc/hash_longest_match64_inc.h \
+ c/enc/hash_longest_match_inc.h \
+ c/enc/hash_longest_match_quickly_inc.h \
+ c/enc/hash_rolling_inc.h \
+ c/enc/hash_to_binary_tree_inc.h \
+ c/enc/histogram.h \
+ c/enc/histogram_inc.h \
+ c/enc/literal_cost.h \
+ c/enc/memory.h \
+ c/enc/metablock.h \
+ c/enc/metablock_inc.h \
+ c/enc/params.h \
+ c/enc/prefix.h \
+ c/enc/quality.h \
+ c/enc/ringbuffer.h \
+ c/enc/static_dict.h \
+ c/enc/static_dict_lut.h \
+ c/enc/utf8_util.h \
+ c/enc/write_bits.h
+
+BROTLI_INCLUDE = \
+ c/include/brotli/decode.h \
+ c/include/brotli/encode.h \
+ c/include/brotli/port.h \
+ c/include/brotli/types.h
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/setup.cfg b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/setup.cfg
new file mode 100644
index 000000000..990b9e1a0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/setup.cfg
@@ -0,0 +1,5 @@
+[build]
+build-base=bin
+
+[yapf]
+based_on_style=google
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/setup.py b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/setup.py
new file mode 100644
index 000000000..78672103b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/setup.py
@@ -0,0 +1,288 @@
+# Copyright 2015 The Brotli Authors. All rights reserved.
+#
+# Distributed under MIT license.
+# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+import os
+import platform
+import re
+import unittest
+
+try:
+ from setuptools import Extension
+ from setuptools import setup
+except:
+ from distutils.core import Extension
+ from distutils.core import setup
+from distutils.command.build_ext import build_ext
+from distutils import errors
+from distutils import dep_util
+from distutils import log
+
+
+CURR_DIR = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
+
+
+def get_version():
+ """ Return BROTLI_VERSION string as defined in 'common/version.h' file. """
+ version_file_path = os.path.join(CURR_DIR, 'c', 'common', 'version.h')
+ version = 0
+ with open(version_file_path, 'r') as f:
+ for line in f:
+ m = re.match(r'#define\sBROTLI_VERSION\s+0x([0-9a-fA-F]+)', line)
+ if m:
+ version = int(m.group(1), 16)
+ if version == 0:
+ return ''
+ # Semantic version is calculated as (MAJOR << 24) | (MINOR << 12) | PATCH.
+ major = version >> 24
+ minor = (version >> 12) & 0xFFF
+ patch = version & 0xFFF
+ return '{0}.{1}.{2}'.format(major, minor, patch)
+
+
+def get_test_suite():
+ test_loader = unittest.TestLoader()
+ test_suite = test_loader.discover('python', pattern='*_test.py')
+ return test_suite
+
+
+class BuildExt(build_ext):
+
+ def get_source_files(self):
+ filenames = build_ext.get_source_files(self)
+ for ext in self.extensions:
+ filenames.extend(ext.depends)
+ return filenames
+
+ def build_extension(self, ext):
+ if ext.sources is None or not isinstance(ext.sources, (list, tuple)):
+ raise errors.DistutilsSetupError(
+ "in 'ext_modules' option (extension '%s'), "
+ "'sources' must be present and must be "
+ "a list of source filenames" % ext.name)
+
+ ext_path = self.get_ext_fullpath(ext.name)
+ depends = ext.sources + ext.depends
+ if not (self.force or dep_util.newer_group(depends, ext_path, 'newer')):
+ log.debug("skipping '%s' extension (up-to-date)", ext.name)
+ return
+ else:
+ log.info("building '%s' extension", ext.name)
+
+ c_sources = []
+ cxx_sources = []
+ for source in ext.sources:
+ if source.endswith('.c'):
+ c_sources.append(source)
+ else:
+ cxx_sources.append(source)
+ extra_args = ext.extra_compile_args or []
+
+ objects = []
+ for lang, sources in (('c', c_sources), ('c++', cxx_sources)):
+ if lang == 'c++':
+ if self.compiler.compiler_type == 'msvc':
+ extra_args.append('/EHsc')
+
+ macros = ext.define_macros[:]
+ if platform.system() == 'Darwin':
+ macros.append(('OS_MACOSX', '1'))
+ elif self.compiler.compiler_type == 'mingw32':
+ # On Windows Python 2.7, pyconfig.h defines "hypot" as "_hypot",
+ # This clashes with GCC's cmath, and causes compilation errors when
+ # building under MinGW: http://bugs.python.org/issue11566
+ macros.append(('_hypot', 'hypot'))
+ for undef in ext.undef_macros:
+ macros.append((undef,))
+
+ objs = self.compiler.compile(
+ sources,
+ output_dir=self.build_temp,
+ macros=macros,
+ include_dirs=ext.include_dirs,
+ debug=self.debug,
+ extra_postargs=extra_args,
+ depends=ext.depends)
+ objects.extend(objs)
+
+ self._built_objects = objects[:]
+ if ext.extra_objects:
+ objects.extend(ext.extra_objects)
+ extra_args = ext.extra_link_args or []
+ # when using GCC on Windows, we statically link libgcc and libstdc++,
+ # so that we don't need to package extra DLLs
+ if self.compiler.compiler_type == 'mingw32':
+ extra_args.extend(['-static-libgcc', '-static-libstdc++'])
+
+ ext_path = self.get_ext_fullpath(ext.name)
+ # Detect target language, if not provided
+ language = ext.language or self.compiler.detect_language(sources)
+
+ self.compiler.link_shared_object(
+ objects,
+ ext_path,
+ libraries=self.get_libraries(ext),
+ library_dirs=ext.library_dirs,
+ runtime_library_dirs=ext.runtime_library_dirs,
+ extra_postargs=extra_args,
+ export_symbols=self.get_export_symbols(ext),
+ debug=self.debug,
+ build_temp=self.build_temp,
+ target_lang=language)
+
+
+NAME = 'Brotli'
+
+VERSION = get_version()
+
+URL = 'https://github.com/google/brotli'
+
+DESCRIPTION = 'Python bindings for the Brotli compression library'
+
+AUTHOR = 'The Brotli Authors'
+
+LICENSE = 'MIT'
+
+PLATFORMS = ['Posix', 'MacOS X', 'Windows']
+
+CLASSIFIERS = [
+ 'Development Status :: 4 - Beta',
+ 'Environment :: Console',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: MIT License',
+ 'Operating System :: MacOS :: MacOS X',
+ 'Operating System :: Microsoft :: Windows',
+ 'Operating System :: POSIX :: Linux',
+ 'Programming Language :: C',
+ 'Programming Language :: C++',
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Unix Shell',
+ 'Topic :: Software Development :: Libraries',
+ 'Topic :: Software Development :: Libraries :: Python Modules',
+ 'Topic :: System :: Archiving',
+ 'Topic :: System :: Archiving :: Compression',
+ 'Topic :: Text Processing :: Fonts',
+ 'Topic :: Utilities',
+]
+
+PACKAGE_DIR = {'': 'python'}
+
+PY_MODULES = ['brotli']
+
+EXT_MODULES = [
+ Extension(
+ '_brotli',
+ sources=[
+ 'python/_brotli.cc',
+ 'c/common/dictionary.c',
+ 'c/common/transform.c',
+ 'c/dec/bit_reader.c',
+ 'c/dec/decode.c',
+ 'c/dec/huffman.c',
+ 'c/dec/state.c',
+ 'c/enc/backward_references.c',
+ 'c/enc/backward_references_hq.c',
+ 'c/enc/bit_cost.c',
+ 'c/enc/block_splitter.c',
+ 'c/enc/brotli_bit_stream.c',
+ 'c/enc/cluster.c',
+ 'c/enc/compress_fragment.c',
+ 'c/enc/compress_fragment_two_pass.c',
+ 'c/enc/dictionary_hash.c',
+ 'c/enc/encode.c',
+ 'c/enc/encoder_dict.c',
+ 'c/enc/entropy_encode.c',
+ 'c/enc/histogram.c',
+ 'c/enc/literal_cost.c',
+ 'c/enc/memory.c',
+ 'c/enc/metablock.c',
+ 'c/enc/static_dict.c',
+ 'c/enc/utf8_util.c',
+ ],
+ depends=[
+ 'c/common/constants.h',
+ 'c/common/context.h',
+ 'c/common/dictionary.h',
+ 'c/common/platform.h',
+ 'c/common/transform.h',
+ 'c/common/version.h',
+ 'c/dec/bit_reader.h',
+ 'c/dec/huffman.h',
+ 'c/dec/prefix.h',
+ 'c/dec/state.h',
+ 'c/enc/backward_references.h',
+ 'c/enc/backward_references_hq.h',
+ 'c/enc/backward_references_inc.h',
+ 'c/enc/bit_cost.h',
+ 'c/enc/bit_cost_inc.h',
+ 'c/enc/block_encoder_inc.h',
+ 'c/enc/block_splitter.h',
+ 'c/enc/block_splitter_inc.h',
+ 'c/enc/brotli_bit_stream.h',
+ 'c/enc/cluster.h',
+ 'c/enc/cluster_inc.h',
+ 'c/enc/command.h',
+ 'c/enc/compress_fragment.h',
+ 'c/enc/compress_fragment_two_pass.h',
+ 'c/enc/dictionary_hash.h',
+ 'c/enc/encoder_dict.h',
+ 'c/enc/entropy_encode.h',
+ 'c/enc/entropy_encode_static.h',
+ 'c/enc/fast_log.h',
+ 'c/enc/find_match_length.h',
+ 'c/enc/hash.h',
+ 'c/enc/hash_composite_inc.h',
+ 'c/enc/hash_forgetful_chain_inc.h',
+ 'c/enc/hash_longest_match64_inc.h',
+ 'c/enc/hash_longest_match_inc.h',
+ 'c/enc/hash_longest_match_quickly_inc.h',
+ 'c/enc/hash_rolling_inc.h',
+ 'c/enc/hash_to_binary_tree_inc.h',
+ 'c/enc/histogram.h',
+ 'c/enc/histogram_inc.h',
+ 'c/enc/literal_cost.h',
+ 'c/enc/memory.h',
+ 'c/enc/metablock.h',
+ 'c/enc/metablock_inc.h',
+ 'c/enc/params.h',
+ 'c/enc/prefix.h',
+ 'c/enc/quality.h',
+ 'c/enc/ringbuffer.h',
+ 'c/enc/static_dict.h',
+ 'c/enc/static_dict_lut.h',
+ 'c/enc/utf8_util.h',
+ 'c/enc/write_bits.h',
+ ],
+ include_dirs=[
+ 'c/include',
+ ],
+ language='c++'),
+]
+
+TEST_SUITE = 'setup.get_test_suite'
+
+CMD_CLASS = {
+ 'build_ext': BuildExt,
+}
+
+setup(
+ name=NAME,
+ description=DESCRIPTION,
+ version=VERSION,
+ url=URL,
+ author=AUTHOR,
+ license=LICENSE,
+ platforms=PLATFORMS,
+ classifiers=CLASSIFIERS,
+ package_dir=PACKAGE_DIR,
+ py_modules=PY_MODULES,
+ ext_modules=EXT_MODULES,
+ test_suite=TEST_SUITE,
+ cmdclass=CMD_CLASS)
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/Makefile b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/Makefile
new file mode 100644
index 000000000..28da198f0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/Makefile
@@ -0,0 +1,17 @@
+#brotli/tests
+
+BROTLI = ..
+
+all: test
+
+test: deps
+ ./compatibility_test.sh
+ ./roundtrip_test.sh
+
+deps :
+ $(MAKE) -C $(BROTLI) brotli
+
+clean :
+ rm -f testdata/*.{br,unbr,uncompressed}
+ rm -f $(BROTLI)/{enc,dec,tools}/*.{un,}br
+ $(MAKE) -C $(BROTLI)/tools clean
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/compatibility_test.sh b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/compatibility_test.sh
new file mode 100755
index 000000000..c5af8bf1a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/compatibility_test.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+#
+# Test that the brotli command-line tool can decompress old brotli-compressed
+# files.
+#
+# The first argument may be a wrapper for brotli, such as 'qemu-arm'.
+
+set -o errexit
+
+BROTLI_WRAPPER=$1
+BROTLI="${BROTLI_WRAPPER} bin/brotli"
+TMP_DIR=bin/tmp
+
+for file in tests/testdata/*.compressed*; do
+ echo "Testing decompression of file $file"
+ expected=${file%.compressed*}
+ uncompressed=${TMP_DIR}/${expected##*/}.uncompressed
+ echo $uncompressed
+ $BROTLI $file -fdo $uncompressed
+ diff -q $uncompressed $expected
+ # Test the streaming version
+ cat $file | $BROTLI -dc > $uncompressed
+ diff -q $uncompressed $expected
+ rm -f $uncompressed
+done
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/roundtrip_test.sh b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/roundtrip_test.sh
new file mode 100755
index 000000000..90027af52
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/roundtrip_test.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+#
+# Roundtrip test for the brotli command-line tool.
+#
+# The first argument may be a wrapper for brotli, such as 'qemu-arm'.
+
+set -o errexit
+
+BROTLI_WRAPPER=$1
+BROTLI="${BROTLI_WRAPPER} bin/brotli"
+TMP_DIR=bin/tmp
+INPUTS="""
+tests/testdata/alice29.txt
+tests/testdata/asyoulik.txt
+tests/testdata/lcet10.txt
+tests/testdata/plrabn12.txt
+c/enc/encode.c
+c/common/dictionary.h
+c/dec/decode.c
+"""
+
+for file in $INPUTS; do
+ for quality in 1 6 9 11; do
+ echo "Roundtrip testing $file at quality $quality"
+ compressed=${TMP_DIR}/${file##*/}.br
+ uncompressed=${TMP_DIR}/${file##*/}.unbr
+ $BROTLI -fq $quality $file -o $compressed
+ $BROTLI $compressed -fdo $uncompressed
+ diff -q $file $uncompressed
+ # Test the streaming version
+ cat $file | $BROTLI -cq $quality | $BROTLI -cd >$uncompressed
+ diff -q $file $uncompressed
+ done
+done
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/run-compatibility-test.cmake b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/run-compatibility-test.cmake
new file mode 100644
index 000000000..f594d9829
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/run-compatibility-test.cmake
@@ -0,0 +1,31 @@
+string(REGEX REPLACE "([a-zA-Z0-9\\.]+)\\.compressed(\\.[0-9]+)?$" "\\1" REFERENCE_DATA "${INPUT}")
+string(REGEX REPLACE "\\.compressed" "" OUTPUT_FILE "${INPUT}")
+get_filename_component(OUTPUT_NAME "${OUTPUT_FILE}" NAME)
+
+set(ENV{QEMU_LD_PREFIX} "${BROTLI_WRAPPER_LD_PREFIX}")
+
+execute_process(
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ COMMAND ${BROTLI_WRAPPER} ${BROTLI_CLI} --force --decompress ${INPUT} --output=${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME}.unbr
+ RESULT_VARIABLE result)
+if(result)
+ message(FATAL_ERROR "Decompression failed")
+endif()
+
+function(test_file_equality f1 f2)
+ if(NOT CMAKE_VERSION VERSION_LESS 2.8.7)
+ file(SHA512 "${f1}" f1_cs)
+ file(SHA512 "${f2}" f2_cs)
+ if(NOT "${f1_cs}" STREQUAL "${f2_cs}")
+ message(FATAL_ERROR "Files do not match")
+ endif()
+ else()
+ file(READ "${f1}" f1_contents)
+ file(READ "${f2}" f2_contents)
+ if(NOT "${f1_contents}" STREQUAL "${f2_contents}")
+ message(FATAL_ERROR "Files do not match")
+ endif()
+ endif()
+endfunction()
+
+test_file_equality("${REFERENCE_DATA}" "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME}.unbr")
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/run-roundtrip-test.cmake b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/run-roundtrip-test.cmake
new file mode 100644
index 000000000..39303d33f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/run-roundtrip-test.cmake
@@ -0,0 +1,36 @@
+set(ENV{QEMU_LD_PREFIX} "${BROTLI_WRAPPER_LD_PREFIX}")
+
+execute_process(
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ COMMAND ${BROTLI_WRAPPER} ${BROTLI_CLI} --force --quality=${QUALITY} ${INPUT} --output=${OUTPUT}.br
+ RESULT_VARIABLE result
+ ERROR_VARIABLE result_stderr)
+if(result)
+ message(FATAL_ERROR "Compression failed: ${result_stderr}")
+endif()
+
+execute_process(
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ COMMAND ${BROTLI_WRAPPER} ${BROTLI_CLI} --force --decompress ${OUTPUT}.br --output=${OUTPUT}.unbr
+ RESULT_VARIABLE result)
+if(result)
+ message(FATAL_ERROR "Decompression failed")
+endif()
+
+function(test_file_equality f1 f2)
+ if(NOT CMAKE_VERSION VERSION_LESS 2.8.7)
+ file(SHA512 "${f1}" f1_cs)
+ file(SHA512 "${f2}" f2_cs)
+ if(NOT "${f1_cs}" STREQUAL "${f2_cs}")
+ message(FATAL_ERROR "Files do not match")
+ endif()
+ else()
+ file(READ "${f1}" f1_contents)
+ file(READ "${f2}" f2_contents)
+ if(NOT "${f1_contents}" STREQUAL "${f2_contents}")
+ message(FATAL_ERROR "Files do not match")
+ endif()
+ endif()
+endfunction()
+
+test_file_equality("${INPUT}" "${OUTPUT}.unbr")
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/10x10y b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/10x10y
new file mode 100644
index 000000000..3f9cf8651
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/10x10y
@@ -0,0 +1 @@
+XXXXXXXXXXYYYYYYYYYY \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/10x10y.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/10x10y.compressed
new file mode 100644
index 000000000..3769516d9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/10x10y.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/64x b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/64x
new file mode 100644
index 000000000..caa41718c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/64x
@@ -0,0 +1 @@
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/64x.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/64x.compressed
new file mode 100644
index 000000000..74d0be10a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/64x.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/alice29.txt b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/alice29.txt
new file mode 100644
index 000000000..703365523
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/alice29.txt
@@ -0,0 +1,3609 @@
+
+
+
+
+ ALICE'S ADVENTURES IN WONDERLAND
+
+ Lewis Carroll
+
+ THE MILLENNIUM FULCRUM EDITION 2.9
+
+
+
+
+ CHAPTER I
+
+ Down the Rabbit-Hole
+
+
+ Alice was beginning to get very tired of sitting by her sister
+on the bank, and of having nothing to do: once or twice she had
+peeped into the book her sister was reading, but it had no
+pictures or conversations in it, `and what is the use of a book,'
+thought Alice `without pictures or conversation?'
+
+ So she was considering in her own mind (as well as she could,
+for the hot day made her feel very sleepy and stupid), whether
+the pleasure of making a daisy-chain would be worth the trouble
+of getting up and picking the daisies, when suddenly a White
+Rabbit with pink eyes ran close by her.
+
+ There was nothing so VERY remarkable in that; nor did Alice
+think it so VERY much out of the way to hear the Rabbit say to
+itself, `Oh dear! Oh dear! I shall be late!' (when she thought
+it over afterwards, it occurred to her that she ought to have
+wondered at this, but at the time it all seemed quite natural);
+but when the Rabbit actually TOOK A WATCH OUT OF ITS WAISTCOAT-
+POCKET, and looked at it, and then hurried on, Alice started to
+her feet, for it flashed across her mind that she had never
+before seen a rabbit with either a waistcoat-pocket, or a watch to
+take out of it, and burning with curiosity, she ran across the
+field after it, and fortunately was just in time to see it pop
+down a large rabbit-hole under the hedge.
+
+ In another moment down went Alice after it, never once
+considering how in the world she was to get out again.
+
+ The rabbit-hole went straight on like a tunnel for some way,
+and then dipped suddenly down, so suddenly that Alice had not a
+moment to think about stopping herself before she found herself
+falling down a very deep well.
+
+ Either the well was very deep, or she fell very slowly, for she
+had plenty of time as she went down to look about her and to
+wonder what was going to happen next. First, she tried to look
+down and make out what she was coming to, but it was too dark to
+see anything; then she looked at the sides of the well, and
+noticed that they were filled with cupboards and book-shelves;
+here and there she saw maps and pictures hung upon pegs. She
+took down a jar from one of the shelves as she passed; it was
+labelled `ORANGE MARMALADE', but to her great disappointment it
+was empty: she did not like to drop the jar for fear of killing
+somebody, so managed to put it into one of the cupboards as she
+fell past it.
+
+ `Well!' thought Alice to herself, `after such a fall as this, I
+shall think nothing of tumbling down stairs! How brave they'll
+all think me at home! Why, I wouldn't say anything about it,
+even if I fell off the top of the house!' (Which was very likely
+true.)
+
+ Down, down, down. Would the fall NEVER come to an end! `I
+wonder how many miles I've fallen by this time?' she said aloud.
+`I must be getting somewhere near the centre of the earth. Let
+me see: that would be four thousand miles down, I think--' (for,
+you see, Alice had learnt several things of this sort in her
+lessons in the schoolroom, and though this was not a VERY good
+opportunity for showing off her knowledge, as there was no one to
+listen to her, still it was good practice to say it over) `--yes,
+that's about the right distance--but then I wonder what Latitude
+or Longitude I've got to?' (Alice had no idea what Latitude was,
+or Longitude either, but thought they were nice grand words to
+say.)
+
+ Presently she began again. `I wonder if I shall fall right
+THROUGH the earth! How funny it'll seem to come out among the
+people that walk with their heads downward! The Antipathies, I
+think--' (she was rather glad there WAS no one listening, this
+time, as it didn't sound at all the right word) `--but I shall
+have to ask them what the name of the country is, you know.
+Please, Ma'am, is this New Zealand or Australia?' (and she tried
+to curtsey as she spoke--fancy CURTSEYING as you're falling
+through the air! Do you think you could manage it?) `And what
+an ignorant little girl she'll think me for asking! No, it'll
+never do to ask: perhaps I shall see it written up somewhere.'
+
+ Down, down, down. There was nothing else to do, so Alice soon
+began talking again. `Dinah'll miss me very much to-night, I
+should think!' (Dinah was the cat.) `I hope they'll remember
+her saucer of milk at tea-time. Dinah my dear! I wish you were
+down here with me! There are no mice in the air, I'm afraid, but
+you might catch a bat, and that's very like a mouse, you know.
+But do cats eat bats, I wonder?' And here Alice began to get
+rather sleepy, and went on saying to herself, in a dreamy sort of
+way, `Do cats eat bats? Do cats eat bats?' and sometimes, `Do
+bats eat cats?' for, you see, as she couldn't answer either
+question, it didn't much matter which way she put it. She felt
+that she was dozing off, and had just begun to dream that she
+was walking hand in hand with Dinah, and saying to her very
+earnestly, `Now, Dinah, tell me the truth: did you ever eat a
+bat?' when suddenly, thump! thump! down she came upon a heap of
+sticks and dry leaves, and the fall was over.
+
+ Alice was not a bit hurt, and she jumped up on to her feet in a
+moment: she looked up, but it was all dark overhead; before her
+was another long passage, and the White Rabbit was still in
+sight, hurrying down it. There was not a moment to be lost:
+away went Alice like the wind, and was just in time to hear it
+say, as it turned a corner, `Oh my ears and whiskers, how late
+it's getting!' She was close behind it when she turned the
+corner, but the Rabbit was no longer to be seen: she found
+herself in a long, low hall, which was lit up by a row of lamps
+hanging from the roof.
+
+ There were doors all round the hall, but they were all locked;
+and when Alice had been all the way down one side and up the
+other, trying every door, she walked sadly down the middle,
+wondering how she was ever to get out again.
+
+ Suddenly she came upon a little three-legged table, all made of
+solid glass; there was nothing on it except a tiny golden key,
+and Alice's first thought was that it might belong to one of the
+doors of the hall; but, alas! either the locks were too large, or
+the key was too small, but at any rate it would not open any of
+them. However, on the second time round, she came upon a low
+curtain she had not noticed before, and behind it was a little
+door about fifteen inches high: she tried the little golden key
+in the lock, and to her great delight it fitted!
+
+ Alice opened the door and found that it led into a small
+passage, not much larger than a rat-hole: she knelt down and
+looked along the passage into the loveliest garden you ever saw.
+How she longed to get out of that dark hall, and wander about
+among those beds of bright flowers and those cool fountains, but
+she could not even get her head though the doorway; `and even if
+my head would go through,' thought poor Alice, `it would be of
+very little use without my shoulders. Oh, how I wish
+I could shut up like a telescope! I think I could, if I only
+know how to begin.' For, you see, so many out-of-the-way things
+had happened lately, that Alice had begun to think that very few
+things indeed were really impossible.
+
+ There seemed to be no use in waiting by the little door, so she
+went back to the table, half hoping she might find another key on
+it, or at any rate a book of rules for shutting people up like
+telescopes: this time she found a little bottle on it, (`which
+certainly was not here before,' said Alice,) and round the neck
+of the bottle was a paper label, with the words `DRINK ME'
+beautifully printed on it in large letters.
+
+ It was all very well to say `Drink me,' but the wise little
+Alice was not going to do THAT in a hurry. `No, I'll look
+first,' she said, `and see whether it's marked "poison" or not';
+for she had read several nice little histories about children who
+had got burnt, and eaten up by wild beasts and other unpleasant
+things, all because they WOULD not remember the simple rules
+their friends had taught them: such as, that a red-hot poker
+will burn you if you hold it too long; and that if you cut your
+finger VERY deeply with a knife, it usually bleeds; and she had
+never forgotten that, if you drink much from a bottle marked
+`poison,' it is almost certain to disagree with you, sooner or
+later.
+
+ However, this bottle was NOT marked `poison,' so Alice ventured
+to taste it, and finding it very nice, (it had, in fact, a sort
+of mixed flavour of cherry-tart, custard, pine-apple, roast
+turkey, toffee, and hot buttered toast,) she very soon finished
+it off.
+
+ * * * * * * *
+
+ * * * * * *
+
+ * * * * * * *
+
+ `What a curious feeling!' said Alice; `I must be shutting up
+like a telescope.'
+
+ And so it was indeed: she was now only ten inches high, and
+her face brightened up at the thought that she was now the right
+size for going though the little door into that lovely garden.
+First, however, she waited for a few minutes to see if she was
+going to shrink any further: she felt a little nervous about
+this; `for it might end, you know,' said Alice to herself, `in my
+going out altogether, like a candle. I wonder what I should be
+like then?' And she tried to fancy what the flame of a candle is
+like after the candle is blown out, for she could not remember
+ever having seen such a thing.
+
+ After a while, finding that nothing more happened, she decided
+on going into the garden at once; but, alas for poor Alice! when
+she got to the door, she found he had forgotten the little golden
+key, and when she went back to the table for it, she found she
+could not possibly reach it: she could see it quite plainly
+through the glass, and she tried her best to climb up one of the
+legs of the table, but it was too slippery; and when she had
+tired herself out with trying, the poor little thing sat down and
+cried.
+
+ `Come, there's no use in crying like that!' said Alice to
+herself, rather sharply; `I advise you to leave off this minute!'
+She generally gave herself very good advice, (though she very
+seldom followed it), and sometimes she scolded herself so
+severely as to bring tears into her eyes; and once she remembered
+trying to box her own ears for having cheated herself in a game
+of croquet she was playing against herself, for this curious
+child was very fond of pretending to be two people. `But it's no
+use now,' thought poor Alice, `to pretend to be two people! Why,
+there's hardly enough of me left to make ONE respectable
+person!'
+
+ Soon her eye fell on a little glass box that was lying under
+the table: she opened it, and found in it a very small cake, on
+which the words `EAT ME' were beautifully marked in currants.
+`Well, I'll eat it,' said Alice, `and if it makes me grow larger,
+I can reach the key; and if it makes me grow smaller, I can creep
+under the door; so either way I'll get into the garden, and I
+don't care which happens!'
+
+ She ate a little bit, and said anxiously to herself, `Which
+way? Which way?', holding her hand on the top of her head to
+feel which way it was growing, and she was quite surprised to
+find that she remained the same size: to be sure, this generally
+happens when one eats cake, but Alice had got so much into the
+way of expecting nothing but out-of-the-way things to happen,
+that it seemed quite dull and stupid for life to go on in the
+common way.
+
+ So she set to work, and very soon finished off the cake.
+
+ * * * * * * *
+
+ * * * * * *
+
+ * * * * * * *
+
+
+
+
+ CHAPTER II
+
+ The Pool of Tears
+
+
+ `Curiouser and curiouser!' cried Alice (she was so much
+surprised, that for the moment she quite forgot how to speak good
+English); `now I'm opening out like the largest telescope that
+ever was! Good-bye, feet!' (for when she looked down at her
+feet, they seemed to be almost out of sight, they were getting so
+far off). `Oh, my poor little feet, I wonder who will put on
+your shoes and stockings for you now, dears? I'm sure _I_ shan't
+be able! I shall be a great deal too far off to trouble myself
+about you: you must manage the best way you can; --but I must be
+kind to them,' thought Alice, `or perhaps they won't walk the
+way I want to go! Let me see: I'll give them a new pair of
+boots every Christmas.'
+
+ And she went on planning to herself how she would manage it.
+`They must go by the carrier,' she thought; `and how funny it'll
+seem, sending presents to one's own feet! And how odd the
+directions will look!
+
+ ALICE'S RIGHT FOOT, ESQ.
+ HEARTHRUG,
+ NEAR THE FENDER,
+ (WITH ALICE'S LOVE).
+
+Oh dear, what nonsense I'm talking!'
+
+ Just then her head struck against the roof of the hall: in
+fact she was now more than nine feet high, and she at once took
+up the little golden key and hurried off to the garden door.
+
+ Poor Alice! It was as much as she could do, lying down on one
+side, to look through into the garden with one eye; but to get
+through was more hopeless than ever: she sat down and began to
+cry again.
+
+ `You ought to be ashamed of yourself,' said Alice, `a great
+girl like you,' (she might well say this), `to go on crying in
+this way! Stop this moment, I tell you!' But she went on all
+the same, shedding gallons of tears, until there was a large pool
+all round her, about four inches deep and reaching half down the
+hall.
+
+ After a time she heard a little pattering of feet in the
+distance, and she hastily dried her eyes to see what was coming.
+It was the White Rabbit returning, splendidly dressed, with a
+pair of white kid gloves in one hand and a large fan in the
+other: he came trotting along in a great hurry, muttering to
+himself as he came, `Oh! the Duchess, the Duchess! Oh! won't she
+be savage if I've kept her waiting!' Alice felt so desperate
+that she was ready to ask help of any one; so, when the Rabbit
+came near her, she began, in a low, timid voice, `If you please,
+sir--' The Rabbit started violently, dropped the white kid
+gloves and the fan, and skurried away into the darkness as hard
+as he could go.
+
+ Alice took up the fan and gloves, and, as the hall was very
+hot, she kept fanning herself all the time she went on talking:
+`Dear, dear! How queer everything is to-day! And yesterday
+things went on just as usual. I wonder if I've been changed in
+the night? Let me think: was I the same when I got up this
+morning? I almost think I can remember feeling a little
+different. But if I'm not the same, the next question is, Who in
+the world am I? Ah, THAT'S the great puzzle!' And she began
+thinking over all the children she knew that were of the same age
+as herself, to see if she could have been changed for any of
+them.
+
+ `I'm sure I'm not Ada,' she said, `for her hair goes in such
+long ringlets, and mine doesn't go in ringlets at all; and I'm
+sure I can't be Mabel, for I know all sorts of things, and she,
+oh! she knows such a very little! Besides, SHE'S she, and I'm I,
+and--oh dear, how puzzling it all is! I'll try if I know all the
+things I used to know. Let me see: four times five is twelve,
+and four times six is thirteen, and four times seven is--oh dear!
+I shall never get to twenty at that rate! However, the
+Multiplication Table doesn't signify: let's try Geography.
+London is the capital of Paris, and Paris is the capital of Rome,
+and Rome--no, THAT'S all wrong, I'm certain! I must have been
+changed for Mabel! I'll try and say "How doth the little--"'
+and she crossed her hands on her lap as if she were saying lessons,
+and began to repeat it, but her voice sounded hoarse and
+strange, and the words did not come the same as they used to do:--
+
+ `How doth the little crocodile
+ Improve his shining tail,
+ And pour the waters of the Nile
+ On every golden scale!
+
+ `How cheerfully he seems to grin,
+ How neatly spread his claws,
+ And welcome little fishes in
+ With gently smiling jaws!'
+
+ `I'm sure those are not the right words,' said poor Alice, and
+her eyes filled with tears again as she went on, `I must be Mabel
+after all, and I shall have to go and live in that poky little
+house, and have next to no toys to play with, and oh! ever so
+many lessons to learn! No, I've made up my mind about it; if I'm
+Mabel, I'll stay down here! It'll be no use their putting their
+heads down and saying "Come up again, dear!" I shall only look
+up and say "Who am I then? Tell me that first, and then, if I
+like being that person, I'll come up: if not, I'll stay down
+here till I'm somebody else"--but, oh dear!' cried Alice, with a
+sudden burst of tears, `I do wish they WOULD put their heads
+down! I am so VERY tired of being all alone here!'
+
+ As she said this she looked down at her hands, and was
+surprised to see that she had put on one of the Rabbit's little
+white kid gloves while she was talking. `How CAN I have done
+that?' she thought. `I must be growing small again.' She got up
+and went to the table to measure herself by it, and found that,
+as nearly as she could guess, she was now about two feet high,
+and was going on shrinking rapidly: she soon found out that the
+cause of this was the fan she was holding, and she dropped it
+hastily, just in time to avoid shrinking away altogether.
+
+`That WAS a narrow escape!' said Alice, a good deal frightened at
+the sudden change, but very glad to find herself still in
+existence; `and now for the garden!' and she ran with all speed
+back to the little door: but, alas! the little door was shut
+again, and the little golden key was lying on the glass table as
+before, `and things are worse than ever,' thought the poor child,
+`for I never was so small as this before, never! And I declare
+it's too bad, that it is!'
+
+ As she said these words her foot slipped, and in another
+moment, splash! she was up to her chin in salt water. He first
+idea was that she had somehow fallen into the sea, `and in that
+case I can go back by railway,' she said to herself. (Alice had
+been to the seaside once in her life, and had come to the general
+conclusion, that wherever you go to on the English coast you find
+a number of bathing machines in the sea, some children digging in
+the sand with wooden spades, then a row of lodging houses, and
+behind them a railway station.) However, she soon made out that
+she was in the pool of tears which she had wept when she was nine
+feet high.
+
+ `I wish I hadn't cried so much!' said Alice, as she swam about,
+trying to find her way out. `I shall be punished for it now, I
+suppose, by being drowned in my own tears! That WILL be a queer
+thing, to be sure! However, everything is queer to-day.'
+
+ Just then she heard something splashing about in the pool a
+little way off, and she swam nearer to make out what it was: at
+first she thought it must be a walrus or hippopotamus, but then
+she remembered how small she was now, and she soon made out that
+it was only a mouse that had slipped in like herself.
+
+ `Would it be of any use, now,' thought Alice, `to speak to this
+mouse? Everything is so out-of-the-way down here, that I should
+think very likely it can talk: at any rate, there's no harm in
+trying.' So she began: `O Mouse, do you know the way out of
+this pool? I am very tired of swimming about here, O Mouse!'
+(Alice thought this must be the right way of speaking to a mouse:
+she had never done such a thing before, but she remembered having
+seen in her brother's Latin Grammar, `A mouse--of a mouse--to a
+mouse--a mouse--O mouse!' The Mouse looked at her rather
+inquisitively, and seemed to her to wink with one of its little
+eyes, but it said nothing.
+
+ `Perhaps it doesn't understand English,' thought Alice; `I
+daresay it's a French mouse, come over with William the
+Conqueror.' (For, with all her knowledge of history, Alice had
+no very clear notion how long ago anything had happened.) So she
+began again: `Ou est ma chatte?' which was the first sentence in
+her French lesson-book. The Mouse gave a sudden leap out of the
+water, and seemed to quiver all over with fright. `Oh, I beg
+your pardon!' cried Alice hastily, afraid that she had hurt the
+poor animal's feelings. `I quite forgot you didn't like cats.'
+
+ `Not like cats!' cried the Mouse, in a shrill, passionate
+voice. `Would YOU like cats if you were me?'
+
+ `Well, perhaps not,' said Alice in a soothing tone: `don't be
+angry about it. And yet I wish I could show you our cat Dinah:
+I think you'd take a fancy to cats if you could only see her.
+She is such a dear quiet thing,' Alice went on, half to herself,
+as she swam lazily about in the pool, `and she sits purring so
+nicely by the fire, licking her paws and washing her face--and
+she is such a nice soft thing to nurse--and she's such a capital
+one for catching mice--oh, I beg your pardon!' cried Alice again,
+for this time the Mouse was bristling all over, and she felt
+certain it must be really offended. `We won't talk about her any
+more if you'd rather not.'
+
+ `We indeed!' cried the Mouse, who was trembling down to the end
+of his tail. `As if I would talk on such a subject! Our family
+always HATED cats: nasty, low, vulgar things! Don't let me hear
+the name again!'
+
+ `I won't indeed!' said Alice, in a great hurry to change the
+subject of conversation. `Are you--are you fond--of--of dogs?'
+The Mouse did not answer, so Alice went on eagerly: `There is
+such a nice little dog near our house I should like to show you!
+A little bright-eyed terrier, you know, with oh, such long curly
+brown hair! And it'll fetch things when you throw them, and
+it'll sit up and beg for its dinner, and all sorts of things--I
+can't remember half of them--and it belongs to a farmer, you
+know, and he says it's so useful, it's worth a hundred pounds!
+He says it kills all the rats and--oh dear!' cried Alice in a
+sorrowful tone, `I'm afraid I've offended it again!' For the
+Mouse was swimming away from her as hard as it could go, and
+making quite a commotion in the pool as it went.
+
+ So she called softly after it, `Mouse dear! Do come back
+again, and we won't talk about cats or dogs either, if you don't
+like them!' When the Mouse heard this, it turned round and swam
+slowly back to her: its face was quite pale (with passion, Alice
+thought), and it said in a low trembling voice, `Let us get to
+the shore, and then I'll tell you my history, and you'll
+understand why it is I hate cats and dogs.'
+
+ It was high time to go, for the pool was getting quite crowded
+with the birds and animals that had fallen into it: there were a
+Duck and a Dodo, a Lory and an Eaglet, and several other curious
+creatures. Alice led the way, and the whole party swam to the
+shore.
+
+
+
+ CHAPTER III
+
+ A Caucus-Race and a Long Tale
+
+
+ They were indeed a queer-looking party that assembled on the
+bank--the birds with draggled feathers, the animals with their
+fur clinging close to them, and all dripping wet, cross, and
+uncomfortable.
+
+ The first question of course was, how to get dry again: they
+had a consultation about this, and after a few minutes it seemed
+quite natural to Alice to find herself talking familiarly with
+them, as if she had known them all her life. Indeed, she had
+quite a long argument with the Lory, who at last turned sulky,
+and would only say, `I am older than you, and must know better';
+and this Alice would not allow without knowing how old it was,
+and, as the Lory positively refused to tell its age, there was no
+more to be said.
+
+ At last the Mouse, who seemed to be a person of authority among
+them, called out, `Sit down, all of you, and listen to me! I'LL
+soon make you dry enough!' They all sat down at once, in a large
+ring, with the Mouse in the middle. Alice kept her eyes
+anxiously fixed on it, for she felt sure she would catch a bad
+cold if she did not get dry very soon.
+
+ `Ahem!' said the Mouse with an important air, `are you all ready?
+This is the driest thing I know. Silence all round, if you please!
+"William the Conqueror, whose cause was favoured by the pope, was
+soon submitted to by the English, who wanted leaders, and had been
+of late much accustomed to usurpation and conquest. Edwin and
+Morcar, the earls of Mercia and Northumbria--"'
+
+ `Ugh!' said the Lory, with a shiver.
+
+ `I beg your pardon!' said the Mouse, frowning, but very
+politely: `Did you speak?'
+
+ `Not I!' said the Lory hastily.
+
+ `I thought you did,' said the Mouse. `--I proceed. "Edwin and
+Morcar, the earls of Mercia and Northumbria, declared for him:
+and even Stigand, the patriotic archbishop of Canterbury, found
+it advisable--"'
+
+ `Found WHAT?' said the Duck.
+
+ `Found IT,' the Mouse replied rather crossly: `of course you
+know what "it" means.'
+
+ `I know what "it" means well enough, when I find a thing,' said
+the Duck: `it's generally a frog or a worm. The question is,
+what did the archbishop find?'
+
+ The Mouse did not notice this question, but hurriedly went on,
+`"--found it advisable to go with Edgar Atheling to meet William
+and offer him the crown. William's conduct at first was
+moderate. But the insolence of his Normans--" How are you
+getting on now, my dear?' it continued, turning to Alice as it
+spoke.
+
+ `As wet as ever,' said Alice in a melancholy tone: `it doesn't
+seem to dry me at all.'
+
+ `In that case,' said the Dodo solemnly, rising to its feet, `I
+move that the meeting adjourn, for the immediate adoption of more
+energetic remedies--'
+
+ `Speak English!' said the Eaglet. `I don't know the meaning of
+half those long words, and, what's more, I don't believe you do
+either!' And the Eaglet bent down its head to hide a smile:
+some of the other birds tittered audibly.
+
+ `What I was going to say,' said the Dodo in an offended tone,
+`was, that the best thing to get us dry would be a Caucus-race.'
+
+ `What IS a Caucus-race?' said Alice; not that she wanted much
+to know, but the Dodo had paused as if it thought that SOMEBODY
+ought to speak, and no one else seemed inclined to say anything.
+
+ `Why,' said the Dodo, `the best way to explain it is to do it.'
+(And, as you might like to try the thing yourself, some winter
+day, I will tell you how the Dodo managed it.)
+
+ First it marked out a race-course, in a sort of circle, (`the
+exact shape doesn't matter,' it said,) and then all the party
+were placed along the course, here and there. There was no `One,
+two, three, and away,' but they began running when they liked,
+and left off when they liked, so that it was not easy to know
+when the race was over. However, when they had been running half
+an hour or so, and were quite dry again, the Dodo suddenly called
+out `The race is over!' and they all crowded round it, panting,
+and asking, `But who has won?'
+
+ This question the Dodo could not answer without a great deal of
+thought, and it sat for a long time with one finger pressed upon
+its forehead (the position in which you usually see Shakespeare,
+in the pictures of him), while the rest waited in silence. At
+last the Dodo said, `EVERYBODY has won, and all must have
+prizes.'
+
+ `But who is to give the prizes?' quite a chorus of voices
+asked.
+
+ `Why, SHE, of course,' said the Dodo, pointing to Alice with
+one finger; and the whole party at once crowded round her,
+calling out in a confused way, `Prizes! Prizes!'
+
+ Alice had no idea what to do, and in despair she put her hand
+in her pocket, and pulled out a box of comfits, (luckily the salt
+water had not got into it), and handed them round as prizes.
+There was exactly one a-piece all round.
+
+ `But she must have a prize herself, you know,' said the Mouse.
+
+ `Of course,' the Dodo replied very gravely. `What else have
+you got in your pocket?' he went on, turning to Alice.
+
+ `Only a thimble,' said Alice sadly.
+
+ `Hand it over here,' said the Dodo.
+
+ Then they all crowded round her once more, while the Dodo
+solemnly presented the thimble, saying `We beg your acceptance of
+this elegant thimble'; and, when it had finished this short
+speech, they all cheered.
+
+ Alice thought the whole thing very absurd, but they all looked
+so grave that she did not dare to laugh; and, as she could not
+think of anything to say, she simply bowed, and took the thimble,
+looking as solemn as she could.
+
+ The next thing was to eat the comfits: this caused some noise
+and confusion, as the large birds complained that they could not
+taste theirs, and the small ones choked and had to be patted on
+the back. However, it was over at last, and they sat down again
+in a ring, and begged the Mouse to tell them something more.
+
+ `You promised to tell me your history, you know,' said Alice,
+`and why it is you hate--C and D,' she added in a whisper, half
+afraid that it would be offended again.
+
+ `Mine is a long and a sad tale!' said the Mouse, turning to
+Alice, and sighing.
+
+ `It IS a long tail, certainly,' said Alice, looking down with
+wonder at the Mouse's tail; `but why do you call it sad?' And
+she kept on puzzling about it while the Mouse was speaking, so
+that her idea of the tale was something like this:--
+
+ `Fury said to a
+ mouse, That he
+ met in the
+ house,
+ "Let us
+ both go to
+ law: I will
+ prosecute
+ YOU. --Come,
+ I'll take no
+ denial; We
+ must have a
+ trial: For
+ really this
+ morning I've
+ nothing
+ to do."
+ Said the
+ mouse to the
+ cur, "Such
+ a trial,
+ dear Sir,
+ With
+ no jury
+ or judge,
+ would be
+ wasting
+ our
+ breath."
+ "I'll be
+ judge, I'll
+ be jury,"
+ Said
+ cunning
+ old Fury:
+ "I'll
+ try the
+ whole
+ cause,
+ and
+ condemn
+ you
+ to
+ death."'
+
+
+ `You are not attending!' said the Mouse to Alice severely.
+`What are you thinking of?'
+
+ `I beg your pardon,' said Alice very humbly: `you had got to
+the fifth bend, I think?'
+
+ `I had NOT!' cried the Mouse, sharply and very angrily.
+
+ `A knot!' said Alice, always ready to make herself useful, and
+looking anxiously about her. `Oh, do let me help to undo it!'
+
+ `I shall do nothing of the sort,' said the Mouse, getting up
+and walking away. `You insult me by talking such nonsense!'
+
+ `I didn't mean it!' pleaded poor Alice. `But you're so easily
+offended, you know!'
+
+ The Mouse only growled in reply.
+
+ `Please come back and finish your story!' Alice called after
+it; and the others all joined in chorus, `Yes, please do!' but
+the Mouse only shook its head impatiently, and walked a little
+quicker.
+
+ `What a pity it wouldn't stay!' sighed the Lory, as soon as it
+was quite out of sight; and an old Crab took the opportunity of
+saying to her daughter `Ah, my dear! Let this be a lesson to you
+never to lose YOUR temper!' `Hold your tongue, Ma!' said the
+young Crab, a little snappishly. `You're enough to try the
+patience of an oyster!'
+
+ `I wish I had our Dinah here, I know I do!' said Alice aloud,
+addressing nobody in particular. `She'd soon fetch it back!'
+
+ `And who is Dinah, if I might venture to ask the question?'
+said the Lory.
+
+ Alice replied eagerly, for she was always ready to talk about
+her pet: `Dinah's our cat. And she's such a capital one for
+catching mice you can't think! And oh, I wish you could see her
+after the birds! Why, she'll eat a little bird as soon as look
+at it!'
+
+ This speech caused a remarkable sensation among the party.
+Some of the birds hurried off at once: one the old Magpie began
+wrapping itself up very carefully, remarking, `I really must be
+getting home; the night-air doesn't suit my throat!' and a Canary
+called out in a trembling voice to its children, `Come away, my
+dears! It's high time you were all in bed!' On various pretexts
+they all moved off, and Alice was soon left alone.
+
+ `I wish I hadn't mentioned Dinah!' she said to herself in a
+melancholy tone. `Nobody seems to like her, down here, and I'm
+sure she's the best cat in the world! Oh, my dear Dinah! I
+wonder if I shall ever see you any more!' And here poor Alice
+began to cry again, for she felt very lonely and low-spirited.
+In a little while, however, she again heard a little pattering of
+footsteps in the distance, and she looked up eagerly, half hoping
+that the Mouse had changed his mind, and was coming back to
+finish his story.
+
+
+
+ CHAPTER IV
+
+ The Rabbit Sends in a Little Bill
+
+
+ It was the White Rabbit, trotting slowly back again, and
+looking anxiously about as it went, as if it had lost something;
+and she heard it muttering to itself `The Duchess! The Duchess!
+Oh my dear paws! Oh my fur and whiskers! She'll get me
+executed, as sure as ferrets are ferrets! Where CAN I have
+dropped them, I wonder?' Alice guessed in a moment that it was
+looking for the fan and the pair of white kid gloves, and she
+very good-naturedly began hunting about for them, but they were
+nowhere to be seen--everything seemed to have changed since her
+swim in the pool, and the great hall, with the glass table and
+the little door, had vanished completely.
+
+ Very soon the Rabbit noticed Alice, as she went hunting about,
+and called out to her in an angry tone, `Why, Mary Ann, what ARE
+you doing out here? Run home this moment, and fetch me a pair of
+gloves and a fan! Quick, now!' And Alice was so much frightened
+that she ran off at once in the direction it pointed to, without
+trying to explain the mistake it had made.
+
+ `He took me for his housemaid,' she said to herself as she ran.
+`How surprised he'll be when he finds out who I am! But I'd
+better take him his fan and gloves--that is, if I can find them.'
+As she said this, she came upon a neat little house, on the door
+of which was a bright brass plate with the name `W. RABBIT'
+engraved upon it. She went in without knocking, and hurried
+upstairs, in great fear lest she should meet the real Mary Ann,
+and be turned out of the house before she had found the fan and
+gloves.
+
+ `How queer it seems,' Alice said to herself, `to be going
+messages for a rabbit! I suppose Dinah'll be sending me on
+messages next!' And she began fancying the sort of thing that
+would happen: `"Miss Alice! Come here directly, and get ready
+for your walk!" "Coming in a minute, nurse! But I've got to see
+that the mouse doesn't get out." Only I don't think,' Alice went
+on, `that they'd let Dinah stop in the house if it began ordering
+people about like that!'
+
+ By this time she had found her way into a tidy little room with
+a table in the window, and on it (as she had hoped) a fan and two
+or three pairs of tiny white kid gloves: she took up the fan and
+a pair of the gloves, and was just going to leave the room, when
+her eye fell upon a little bottle that stood near the looking-
+glass. There was no label this time with the words `DRINK ME,'
+but nevertheless she uncorked it and put it to her lips. `I know
+SOMETHING interesting is sure to happen,' she said to herself,
+`whenever I eat or drink anything; so I'll just see what this
+bottle does. I do hope it'll make me grow large again, for
+really I'm quite tired of being such a tiny little thing!'
+
+ It did so indeed, and much sooner than she had expected:
+before she had drunk half the bottle, she found her head pressing
+against the ceiling, and had to stoop to save her neck from being
+broken. She hastily put down the bottle, saying to herself
+`That's quite enough--I hope I shan't grow any more--As it is, I
+can't get out at the door--I do wish I hadn't drunk quite so
+much!'
+
+ Alas! it was too late to wish that! She went on growing, and
+growing, and very soon had to kneel down on the floor: in
+another minute there was not even room for this, and she tried
+the effect of lying down with one elbow against the door, and the
+other arm curled round her head. Still she went on growing, and,
+as a last resource, she put one arm out of the window, and one
+foot up the chimney, and said to herself `Now I can do no more,
+whatever happens. What WILL become of me?'
+
+ Luckily for Alice, the little magic bottle had now had its full
+effect, and she grew no larger: still it was very uncomfortable,
+and, as there seemed to be no sort of chance of her ever getting
+out of the room again, no wonder she felt unhappy.
+
+ `It was much pleasanter at home,' thought poor Alice, `when one
+wasn't always growing larger and smaller, and being ordered about
+by mice and rabbits. I almost wish I hadn't gone down that
+rabbit-hole--and yet--and yet--it's rather curious, you know,
+this sort of life! I do wonder what CAN have happened to me!
+When I used to read fairy-tales, I fancied that kind of thing
+never happened, and now here I am in the middle of one! There
+ought to be a book written about me, that there ought! And when
+I grow up, I'll write one--but I'm grown up now,' she added in a
+sorrowful tone; `at least there's no room to grow up any more
+HERE.'
+
+ `But then,' thought Alice, `shall I NEVER get any older than I
+am now? That'll be a comfort, one way--never to be an old woman-
+-but then--always to have lessons to learn! Oh, I shouldn't like
+THAT!'
+
+ `Oh, you foolish Alice!' she answered herself. `How can you
+learn lessons in here? Why, there's hardly room for YOU, and no
+room at all for any lesson-books!'
+
+ And so she went on, taking first one side and then the other,
+and making quite a conversation of it altogether; but after a few
+minutes she heard a voice outside, and stopped to listen.
+
+ `Mary Ann! Mary Ann!' said the voice. `Fetch me my gloves
+this moment!' Then came a little pattering of feet on the
+stairs. Alice knew it was the Rabbit coming to look for her, and
+she trembled till she shook the house, quite forgetting that she
+was now about a thousand times as large as the Rabbit, and had no
+reason to be afraid of it.
+
+ Presently the Rabbit came up to the door, and tried to open it;
+but, as the door opened inwards, and Alice's elbow was pressed
+hard against it, that attempt proved a failure. Alice heard it
+say to itself `Then I'll go round and get in at the window.'
+
+ `THAT you won't' thought Alice, and, after waiting till she
+fancied she heard the Rabbit just under the window, she suddenly
+spread out her hand, and made a snatch in the air. She did not
+get hold of anything, but she heard a little shriek and a fall,
+and a crash of broken glass, from which she concluded that it was
+just possible it had fallen into a cucumber-frame, or something
+of the sort.
+
+ Next came an angry voice--the Rabbit's--`Pat! Pat! Where are
+you?' And then a voice she had never heard before, `Sure then
+I'm here! Digging for apples, yer honour!'
+
+ `Digging for apples, indeed!' said the Rabbit angrily. `Here!
+Come and help me out of THIS!' (Sounds of more broken glass.)
+
+ `Now tell me, Pat, what's that in the window?'
+
+ `Sure, it's an arm, yer honour!' (He pronounced it `arrum.')
+
+ `An arm, you goose! Who ever saw one that size? Why, it
+fills the whole window!'
+
+ `Sure, it does, yer honour: but it's an arm for all that.'
+
+ `Well, it's got no business there, at any rate: go and take it
+away!'
+
+ There was a long silence after this, and Alice could only hear
+whispers now and then; such as, `Sure, I don't like it, yer
+honour, at all, at all!' `Do as I tell you, you coward!' and at
+last she spread out her hand again, and made another snatch in
+the air. This time there were TWO little shrieks, and more
+sounds of broken glass. `What a number of cucumber-frames there
+must be!' thought Alice. `I wonder what they'll do next! As for
+pulling me out of the window, I only wish they COULD! I'm sure I
+don't want to stay in here any longer!'
+
+ She waited for some time without hearing anything more: at
+last came a rumbling of little cartwheels, and the sound of a
+good many voice all talking together: she made out the words:
+`Where's the other ladder?--Why, I hadn't to bring but one;
+Bill's got the other--Bill! fetch it here, lad!--Here, put 'em up
+at this corner--No, tie 'em together first--they don't reach half
+high enough yet--Oh! they'll do well enough; don't be particular-
+-Here, Bill! catch hold of this rope--Will the roof bear?--Mind
+that loose slate--Oh, it's coming down! Heads below!' (a loud
+crash)--`Now, who did that?--It was Bill, I fancy--Who's to go
+down the chimney?--Nay, I shan't! YOU do it!--That I won't,
+then!--Bill's to go down--Here, Bill! the master says you're to
+go down the chimney!'
+
+ `Oh! So Bill's got to come down the chimney, has he?' said
+Alice to herself. `Shy, they seem to put everything upon Bill!
+I wouldn't be in Bill's place for a good deal: this fireplace is
+narrow, to be sure; but I THINK I can kick a little!'
+
+ She drew her foot as far down the chimney as she could, and
+waited till she heard a little animal (she couldn't guess of what
+sort it was) scratching and scrambling about in the chimney close
+above her: then, saying to herself `This is Bill,' she gave one
+sharp kick, and waited to see what would happen next.
+
+ The first thing she heard was a general chorus of `There goes
+Bill!' then the Rabbit's voice along--`Catch him, you by the
+hedge!' then silence, and then another confusion of voices--`Hold
+up his head--Brandy now--Don't choke him--How was it, old fellow?
+What happened to you? Tell us all about it!'
+
+ Last came a little feeble, squeaking voice, (`That's Bill,'
+thought Alice,) `Well, I hardly know--No more, thank ye; I'm
+better now--but I'm a deal too flustered to tell you--all I know
+is, something comes at me like a Jack-in-the-box, and up I goes
+like a sky-rocket!'
+
+ `So you did, old fellow!' said the others.
+
+ `We must burn the house down!' said the Rabbit's voice; and
+Alice called out as loud as she could, `If you do. I'll set
+Dinah at you!'
+
+ There was a dead silence instantly, and Alice thought to
+herself, `I wonder what they WILL do next! If they had any
+sense, they'd take the roof off.' After a minute or two, they
+began moving about again, and Alice heard the Rabbit say, `A
+barrowful will do, to begin with.'
+
+ `A barrowful of WHAT?' thought Alice; but she had not long to
+doubt, for the next moment a shower of little pebbles came
+rattling in at the window, and some of them hit her in the face.
+`I'll put a stop to this,' she said to herself, and shouted out,
+`You'd better not do that again!' which produced another dead
+silence.
+
+ Alice noticed with some surprise that the pebbles were all
+turning into little cakes as they lay on the floor, and a bright
+idea came into her head. `If I eat one of these cakes,' she
+thought, `it's sure to make SOME change in my size; and as it
+can't possibly make me larger, it must make me smaller, I
+suppose.'
+
+ So she swallowed one of the cakes, and was delighted to find
+that she began shrinking directly. As soon as she was small
+enough to get through the door, she ran out of the house, and
+found quite a crowd of little animals and birds waiting outside.
+The poor little Lizard, Bill, was in the middle, being held up by
+two guinea-pigs, who were giving it something out of a bottle.
+They all made a rush at Alice the moment she appeared; but she
+ran off as hard as she could, and soon found herself safe in a
+thick wood.
+
+ `The first thing I've got to do,' said Alice to herself, as she
+wandered about in the wood, `is to grow to my right size again;
+and the second thing is to find my way into that lovely garden.
+I think that will be the best plan.'
+
+ It sounded an excellent plan, no doubt, and very neatly and
+simply arranged; the only difficulty was, that she had not the
+smallest idea how to set about it; and while she was peering
+about anxiously among the trees, a little sharp bark just over
+her head made her look up in a great hurry.
+
+ An enormous puppy was looking down at her with large round
+eyes, and feebly stretching out one paw, trying to touch her.
+`Poor little thing!' said Alice, in a coaxing tone, and she tried
+hard to whistle to it; but she was terribly frightened all the
+time at the thought that it might be hungry, in which case it
+would be very likely to eat her up in spite of all her coaxing.
+
+ Hardly knowing what she did, she picked up a little bit of
+stick, and held it out to the puppy; whereupon the puppy jumped
+into the air off all its feet at once, with a yelp of delight,
+and rushed at the stick, and made believe to worry it; then Alice
+dodged behind a great thistle, to keep herself from being run
+over; and the moment she appeared on the other side, the puppy
+made another rush at the stick, and tumbled head over heels in
+its hurry to get hold of it; then Alice, thinking it was very
+like having a game of play with a cart-horse, and expecting every
+moment to be trampled under its feet, ran round the thistle
+again; then the puppy began a series of short charges at the
+stick, running a very little way forwards each time and a long
+way back, and barking hoarsely all the while, till at last it sat
+down a good way off, panting, with its tongue hanging out of its
+mouth, and its great eyes half shut.
+
+ This seemed to Alice a good opportunity for making her escape;
+so she set off at once, and ran till she was quite tired and out
+of breath, and till the puppy's bark sounded quite faint in the
+distance.
+
+ `And yet what a dear little puppy it was!' said Alice, as she
+leant against a buttercup to rest herself, and fanned herself
+with one of the leaves: `I should have liked teaching it tricks
+very much, if--if I'd only been the right size to do it! Oh
+dear! I'd nearly forgotten that I've got to grow up again! Let
+me see--how IS it to be managed? I suppose I ought to eat or
+drink something or other; but the great question is, what?'
+
+ The great question certainly was, what? Alice looked all round
+her at the flowers and the blades of grass, but she did not see
+anything that looked like the right thing to eat or drink under
+the circumstances. There was a large mushroom growing near her,
+about the same height as herself; and when she had looked under
+it, and on both sides of it, and behind it, it occurred to her
+that she might as well look and see what was on the top of it.
+
+ She stretched herself up on tiptoe, and peeped over the edge of
+the mushroom, and her eyes immediately met those of a large
+caterpillar, that was sitting on the top with its arms folded,
+quietly smoking a long hookah, and taking not the smallest notice
+of her or of anything else.
+
+
+
+ CHAPTER V
+
+ Advice from a Caterpillar
+
+
+ The Caterpillar and Alice looked at each other for some time in
+silence: at last the Caterpillar took the hookah out of its
+mouth, and addressed her in a languid, sleepy voice.
+
+ `Who are YOU?' said the Caterpillar.
+
+ This was not an encouraging opening for a conversation. Alice
+replied, rather shyly, `I--I hardly know, sir, just at present--
+at least I know who I WAS when I got up this morning, but I think
+I must have been changed several times since then.'
+
+ `What do you mean by that?' said the Caterpillar sternly.
+`Explain yourself!'
+
+ `I can't explain MYSELF, I'm afraid, sir' said Alice, `because
+I'm not myself, you see.'
+
+ `I don't see,' said the Caterpillar.
+
+ `I'm afraid I can't put it more clearly,' Alice replied very
+politely, `for I can't understand it myself to begin with; and
+being so many different sizes in a day is very confusing.'
+
+ `It isn't,' said the Caterpillar.
+
+ `Well, perhaps you haven't found it so yet,' said Alice; `but
+when you have to turn into a chrysalis--you will some day, you
+know--and then after that into a butterfly, I should think you'll
+feel it a little queer, won't you?'
+
+ `Not a bit,' said the Caterpillar.
+
+ `Well, perhaps your feelings may be different,' said Alice;
+`all I know is, it would feel very queer to ME.'
+
+ `You!' said the Caterpillar contemptuously. `Who are YOU?'
+
+ Which brought them back again to the beginning of the
+conversation. Alice felt a little irritated at the Caterpillar's
+making such VERY short remarks, and she drew herself up and said,
+very gravely, `I think, you ought to tell me who YOU are, first.'
+
+ `Why?' said the Caterpillar.
+
+ Here was another puzzling question; and as Alice could not
+think of any good reason, and as the Caterpillar seemed to be in
+a VERY unpleasant state of mind, she turned away.
+
+ `Come back!' the Caterpillar called after her. `I've something
+important to say!'
+
+ This sounded promising, certainly: Alice turned and came back
+again.
+
+ `Keep your temper,' said the Caterpillar.
+
+ `Is that all?' said Alice, swallowing down her anger as well as
+she could.
+
+ `No,' said the Caterpillar.
+
+ Alice thought she might as well wait, as she had nothing else
+to do, and perhaps after all it might tell her something worth
+hearing. For some minutes it puffed away without speaking, but
+at last it unfolded its arms, took the hookah out of its mouth
+again, and said, `So you think you're changed, do you?'
+
+ `I'm afraid I am, sir,' said Alice; `I can't remember things as
+I used--and I don't keep the same size for ten minutes together!'
+
+ `Can't remember WHAT things?' said the Caterpillar.
+
+ `Well, I've tried to say "HOW DOTH THE LITTLE BUSY BEE," but it
+all came different!' Alice replied in a very melancholy voice.
+
+ `Repeat, "YOU ARE OLD, FATHER WILLIAM,"' said the Caterpillar.
+
+ Alice folded her hands, and began:--
+
+ `You are old, Father William,' the young man said,
+ `And your hair has become very white;
+ And yet you incessantly stand on your head--
+ Do you think, at your age, it is right?'
+
+ `In my youth,' Father William replied to his son,
+ `I feared it might injure the brain;
+ But, now that I'm perfectly sure I have none,
+ Why, I do it again and again.'
+
+ `You are old,' said the youth, `as I mentioned before,
+ And have grown most uncommonly fat;
+ Yet you turned a back-somersault in at the door--
+ Pray, what is the reason of that?'
+
+ `In my youth,' said the sage, as he shook his grey locks,
+ `I kept all my limbs very supple
+ By the use of this ointment--one shilling the box--
+ Allow me to sell you a couple?'
+
+ `You are old,' said the youth, `and your jaws are too weak
+ For anything tougher than suet;
+ Yet you finished the goose, with the bones and the beak--
+ Pray how did you manage to do it?'
+
+ `In my youth,' said his father, `I took to the law,
+ And argued each case with my wife;
+ And the muscular strength, which it gave to my jaw,
+ Has lasted the rest of my life.'
+
+ `You are old,' said the youth, `one would hardly suppose
+ That your eye was as steady as ever;
+ Yet you balanced an eel on the end of your nose--
+ What made you so awfully clever?'
+
+ `I have answered three questions, and that is enough,'
+ Said his father; `don't give yourself airs!
+ Do you think I can listen all day to such stuff?
+ Be off, or I'll kick you down stairs!'
+
+
+ `That is not said right,' said the Caterpillar.
+
+ `Not QUITE right, I'm afraid,' said Alice, timidly; `some of the
+words have got altered.'
+
+ `It is wrong from beginning to end,' said the Caterpillar
+decidedly, and there was silence for some minutes.
+
+ The Caterpillar was the first to speak.
+
+ `What size do you want to be?' it asked.
+
+ `Oh, I'm not particular as to size,' Alice hastily replied;
+`only one doesn't like changing so often, you know.'
+
+ `I DON'T know,' said the Caterpillar.
+
+ Alice said nothing: she had never been so much contradicted in
+her life before, and she felt that she was losing her temper.
+
+ `Are you content now?' said the Caterpillar.
+
+ `Well, I should like to be a LITTLE larger, sir, if you
+wouldn't mind,' said Alice: `three inches is such a wretched
+height to be.'
+
+ `It is a very good height indeed!' said the Caterpillar
+angrily, rearing itself upright as it spoke (it was exactly three
+inches high).
+
+ `But I'm not used to it!' pleaded poor Alice in a piteous tone.
+And she thought of herself, `I wish the creatures wouldn't be so
+easily offended!'
+
+ `You'll get used to it in time,' said the Caterpillar; and it
+put the hookah into its mouth and began smoking again.
+
+ This time Alice waited patiently until it chose to speak again.
+In a minute or two the Caterpillar took the hookah out of its
+mouth and yawned once or twice, and shook itself. Then it got
+down off the mushroom, and crawled away in the grass, merely
+remarking as it went, `One side will make you grow taller, and
+the other side will make you grow shorter.'
+
+ `One side of WHAT? The other side of WHAT?' thought Alice to
+herself.
+
+ `Of the mushroom,' said the Caterpillar, just as if she had
+asked it aloud; and in another moment it was out of sight.
+
+ Alice remained looking thoughtfully at the mushroom for a
+minute, trying to make out which were the two sides of it; and as
+it was perfectly round, she found this a very difficult question.
+However, at last she stretched her arms round it as far as they
+would go, and broke off a bit of the edge with each hand.
+
+ `And now which is which?' she said to herself, and nibbled a
+little of the right-hand bit to try the effect: the next moment
+she felt a violent blow underneath her chin: it had struck her
+foot!
+
+ She was a good deal frightened by this very sudden change, but
+she felt that there was no time to be lost, as she was shrinking
+rapidly; so she set to work at once to eat some of the other bit.
+Her chin was pressed so closely against her foot, that there was
+hardly room to open her mouth; but she did it at last, and
+managed to swallow a morsel of the lefthand bit.
+
+
+ * * * * * * *
+
+ * * * * * *
+
+ * * * * * * *
+
+ `Come, my head's free at last!' said Alice in a tone of
+delight, which changed into alarm in another moment, when she
+found that her shoulders were nowhere to be found: all she could
+see, when she looked down, was an immense length of neck, which
+seemed to rise like a stalk out of a sea of green leaves that lay
+far below her.
+
+ `What CAN all that green stuff be?' said Alice. `And where
+HAVE my shoulders got to? And oh, my poor hands, how is it I
+can't see you?' She was moving them about as she spoke, but no
+result seemed to follow, except a little shaking among the
+distant green leaves.
+
+ As there seemed to be no chance of getting her hands up to her
+head, she tried to get her head down to them, and was delighted
+to find that her neck would bend about easily in any direction,
+like a serpent. She had just succeeded in curving it down into a
+graceful zigzag, and was going to dive in among the leaves, which
+she found to be nothing but the tops of the trees under which she
+had been wandering, when a sharp hiss made her draw back in a
+hurry: a large pigeon had flown into her face, and was beating
+her violently with its wings.
+
+ `Serpent!' screamed the Pigeon.
+
+ `I'm NOT a serpent!' said Alice indignantly. `Let me alone!'
+
+ `Serpent, I say again!' repeated the Pigeon, but in a more
+subdued tone, and added with a kind of sob, `I've tried every
+way, and nothing seems to suit them!'
+
+ `I haven't the least idea what you're talking about,' said
+Alice.
+
+ `I've tried the roots of trees, and I've tried banks, and I've
+tried hedges,' the Pigeon went on, without attending to her; `but
+those serpents! There's no pleasing them!'
+
+ Alice was more and more puzzled, but she thought there was no
+use in saying anything more till the Pigeon had finished.
+
+ `As if it wasn't trouble enough hatching the eggs,' said the
+Pigeon; `but I must be on the look-out for serpents night and
+day! Why, I haven't had a wink of sleep these three weeks!'
+
+ `I'm very sorry you've been annoyed,' said Alice, who was
+beginning to see its meaning.
+
+ `And just as I'd taken the highest tree in the wood,' continued
+the Pigeon, raising its voice to a shriek, `and just as I was
+thinking I should be free of them at last, they must needs come
+wriggling down from the sky! Ugh, Serpent!'
+
+ `But I'm NOT a serpent, I tell you!' said Alice. `I'm a--I'm
+a--'
+
+ `Well! WHAT are you?' said the Pigeon. `I can see you're
+trying to invent something!'
+
+ `I--I'm a little girl,' said Alice, rather doubtfully, as she
+remembered the number of changes she had gone through that day.
+
+ `A likely story indeed!' said the Pigeon in a tone of the
+deepest contempt. `I've seen a good many little girls in my
+time, but never ONE with such a neck as that! No, no! You're a
+serpent; and there's no use denying it. I suppose you'll be
+telling me next that you never tasted an egg!'
+
+ `I HAVE tasted eggs, certainly,' said Alice, who was a very
+truthful child; `but little girls eat eggs quite as much as
+serpents do, you know.'
+
+ `I don't believe it,' said the Pigeon; `but if they do, why
+then they're a kind of serpent, that's all I can say.'
+
+ This was such a new idea to Alice, that she was quite silent
+for a minute or two, which gave the Pigeon the opportunity of
+adding, `You're looking for eggs, I know THAT well enough; and
+what does it matter to me whether you're a little girl or a
+serpent?'
+
+ `It matters a good deal to ME,' said Alice hastily; `but I'm
+not looking for eggs, as it happens; and if I was, I shouldn't
+want YOURS: I don't like them raw.'
+
+ `Well, be off, then!' said the Pigeon in a sulky tone, as it
+settled down again into its nest. Alice crouched down among the
+trees as well as she could, for her neck kept getting entangled
+among the branches, and every now and then she had to stop and
+untwist it. After a while she remembered that she still held the
+pieces of mushroom in her hands, and she set to work very
+carefully, nibbling first at one and then at the other, and
+growing sometimes taller and sometimes shorter, until she had
+succeeded in bringing herself down to her usual height.
+
+ It was so long since she had been anything near the right size,
+that it felt quite strange at first; but she got used to it in a
+few minutes, and began talking to herself, as usual. `Come,
+there's half my plan done now! How puzzling all these changes
+are! I'm never sure what I'm going to be, from one minute to
+another! However, I've got back to my right size: the next
+thing is, to get into that beautiful garden--how IS that to be
+done, I wonder?' As she said this, she came suddenly upon an
+open place, with a little house in it about four feet high.
+`Whoever lives there,' thought Alice, `it'll never do to come
+upon them THIS size: why, I should frighten them out of their
+wits!' So she began nibbling at the righthand bit again, and did
+not venture to go near the house till she had brought herself
+down to nine inches high.
+
+
+
+ CHAPTER VI
+
+ Pig and Pepper
+
+
+ For a minute or two she stood looking at the house, and
+wondering what to do next, when suddenly a footman in livery came
+running out of the wood--(she considered him to be a footman
+because he was in livery: otherwise, judging by his face only,
+she would have called him a fish)--and rapped loudly at the door
+with his knuckles. It was opened by another footman in livery,
+with a round face, and large eyes like a frog; and both footmen,
+Alice noticed, had powdered hair that curled all over their
+heads. She felt very curious to know what it was all about, and
+crept a little way out of the wood to listen.
+
+ The Fish-Footman began by producing from under his arm a great
+letter, nearly as large as himself, and this he handed over to
+the other, saying, in a solemn tone, `For the Duchess. An
+invitation from the Queen to play croquet.' The Frog-Footman
+repeated, in the same solemn tone, only changing the order of the
+words a little, `From the Queen. An invitation for the Duchess
+to play croquet.'
+
+ Then they both bowed low, and their curls got entangled
+together.
+
+ Alice laughed so much at this, that she had to run back into
+the wood for fear of their hearing her; and when she next peeped
+out the Fish-Footman was gone, and the other was sitting on the
+ground near the door, staring stupidly up into the sky.
+
+ Alice went timidly up to the door, and knocked.
+
+ `There's no sort of use in knocking,' said the Footman, `and
+that for two reasons. First, because I'm on the same side of the
+door as you are; secondly, because they're making such a noise
+inside, no one could possibly hear you.' And certainly there was
+a most extraordinary noise going on within--a constant howling
+and sneezing, and every now and then a great crash, as if a dish
+or kettle had been broken to pieces.
+
+ `Please, then,' said Alice, `how am I to get in?'
+
+ `There might be some sense in your knocking,' the Footman went
+on without attending to her, `if we had the door between us. For
+instance, if you were INSIDE, you might knock, and I could let
+you out, you know.' He was looking up into the sky all the time
+he was speaking, and this Alice thought decidedly uncivil. `But
+perhaps he can't help it,' she said to herself; `his eyes are so
+VERY nearly at the top of his head. But at any rate he might
+answer questions.--How am I to get in?' she repeated, aloud.
+
+ `I shall sit here,' the Footman remarked, `till tomorrow--'
+
+ At this moment the door of the house opened, and a large plate
+came skimming out, straight at the Footman's head: it just
+grazed his nose, and broke to pieces against one of the trees
+behind him.
+
+ `--or next day, maybe,' the Footman continued in the same tone,
+exactly as if nothing had happened.
+
+ `How am I to get in?' asked Alice again, in a louder tone.
+
+ `ARE you to get in at all?' said the Footman. `That's the
+first question, you know.'
+
+ It was, no doubt: only Alice did not like to be told so.
+`It's really dreadful,' she muttered to herself, `the way all the
+creatures argue. It's enough to drive one crazy!'
+
+ The Footman seemed to think this a good opportunity for
+repeating his remark, with variations. `I shall sit here,' he
+said, `on and off, for days and days.'
+
+ `But what am I to do?' said Alice.
+
+ `Anything you like,' said the Footman, and began whistling.
+
+ `Oh, there's no use in talking to him,' said Alice desperately:
+`he's perfectly idiotic!' And she opened the door and went in.
+
+ The door led right into a large kitchen, which was full of
+smoke from one end to the other: the Duchess was sitting on a
+three-legged stool in the middle, nursing a baby; the cook was
+leaning over the fire, stirring a large cauldron which seemed to
+be full of soup.
+
+ `There's certainly too much pepper in that soup!' Alice said to
+herself, as well as she could for sneezing.
+
+ There was certainly too much of it in the air. Even the
+Duchess sneezed occasionally; and as for the baby, it was
+sneezing and howling alternately without a moment's pause. The
+only things in the kitchen that did not sneeze, were the cook,
+and a large cat which was sitting on the hearth and grinning from
+ear to ear.
+
+ `Please would you tell me,' said Alice, a little timidly, for
+she was not quite sure whether it was good manners for her to
+speak first, `why your cat grins like that?'
+
+ `It's a Cheshire cat,' said the Duchess, `and that's why.
+Pig!'
+
+ She said the last word with such sudden violence that Alice
+quite jumped; but she saw in another moment that it was addressed
+to the baby, and not to her, so she took courage, and went on
+again:--
+
+ `I didn't know that Cheshire cats always grinned; in fact, I
+didn't know that cats COULD grin.'
+
+ `They all can,' said the Duchess; `and most of 'em do.'
+
+ `I don't know of any that do,' Alice said very politely,
+feeling quite pleased to have got into a conversation.
+
+ `You don't know much,' said the Duchess; `and that's a fact.'
+
+ Alice did not at all like the tone of this remark, and thought
+it would be as well to introduce some other subject of
+conversation. While she was trying to fix on one, the cook took
+the cauldron of soup off the fire, and at once set to work
+throwing everything within her reach at the Duchess and the baby
+--the fire-irons came first; then followed a shower of saucepans,
+plates, and dishes. The Duchess took no notice of them even when
+they hit her; and the baby was howling so much already, that it
+was quite impossible to say whether the blows hurt it or not.
+
+ `Oh, PLEASE mind what you're doing!' cried Alice, jumping up
+and down in an agony of terror. `Oh, there goes his PRECIOUS
+nose'; as an unusually large saucepan flew close by it, and very
+nearly carried it off.
+
+ `If everybody minded their own business,' the Duchess said in a
+hoarse growl, `the world would go round a deal faster than it
+does.'
+
+ `Which would NOT be an advantage,' said Alice, who felt very
+glad to get an opportunity of showing off a little of her
+knowledge. `Just think of what work it would make with the day
+and night! You see the earth takes twenty-four hours to turn
+round on its axis--'
+
+ `Talking of axes,' said the Duchess, `chop off her head!'
+
+ Alice glanced rather anxiously at the cook, to see if she meant
+to take the hint; but the cook was busily stirring the soup, and
+seemed not to be listening, so she went on again: `Twenty-four
+hours, I THINK; or is it twelve? I--'
+
+ `Oh, don't bother ME,' said the Duchess; `I never could abide
+figures!' And with that she began nursing her child again,
+singing a sort of lullaby to it as she did so, and giving it a
+violent shake at the end of every line:
+
+ `Speak roughly to your little boy,
+ And beat him when he sneezes:
+ He only does it to annoy,
+ Because he knows it teases.'
+
+ CHORUS.
+
+ (In which the cook and the baby joined):--
+
+ `Wow! wow! wow!'
+
+ While the Duchess sang the second verse of the song, she kept
+tossing the baby violently up and down, and the poor little thing
+howled so, that Alice could hardly hear the words:--
+
+ `I speak severely to my boy,
+ I beat him when he sneezes;
+ For he can thoroughly enjoy
+ The pepper when he pleases!'
+
+ CHORUS.
+
+ `Wow! wow! wow!'
+
+ `Here! you may nurse it a bit, if you like!' the Duchess said
+to Alice, flinging the baby at her as she spoke. `I must go and
+get ready to play croquet with the Queen,' and she hurried out of
+the room. The cook threw a frying-pan after her as she went out,
+but it just missed her.
+
+ Alice caught the baby with some difficulty, as it was a queer-
+shaped little creature, and held out its arms and legs in all
+directions, `just like a star-fish,' thought Alice. The poor
+little thing was snorting like a steam-engine when she caught it,
+and kept doubling itself up and straightening itself out again,
+so that altogether, for the first minute or two, it was as much
+as she could do to hold it.
+
+ As soon as she had made out the proper way of nursing it,
+(which was to twist it up into a sort of knot, and then keep
+tight hold of its right ear and left foot, so as to prevent its
+undoing itself,) she carried it out into the open air. `IF I
+don't take this child away with me,' thought Alice, `they're sure
+to kill it in a day or two: wouldn't it be murder to leave it
+behind?' She said the last words out loud, and the little thing
+grunted in reply (it had left off sneezing by this time). `Don't
+grunt,' said Alice; `that's not at all a proper way of expressing
+yourself.'
+
+ The baby grunted again, and Alice looked very anxiously into
+its face to see what was the matter with it. There could be no
+doubt that it had a VERY turn-up nose, much more like a snout
+than a real nose; also its eyes were getting extremely small for
+a baby: altogether Alice did not like the look of the thing at
+all. `But perhaps it was only sobbing,' she thought, and looked
+into its eyes again, to see if there were any tears.
+
+ No, there were no tears. `If you're going to turn into a pig,
+my dear,' said Alice, seriously, `I'll have nothing more to do
+with you. Mind now!' The poor little thing sobbed again (or
+grunted, it was impossible to say which), and they went on for
+some while in silence.
+
+ Alice was just beginning to think to herself, `Now, what am I
+to do with this creature when I get it home?' when it grunted
+again, so violently, that she looked down into its face in some
+alarm. This time there could be NO mistake about it: it was
+neither more nor less than a pig, and she felt that it would be
+quite absurd for her to carry it further.
+
+ So she set the little creature down, and felt quite relieved to
+see it trot away quietly into the wood. `If it had grown up,'
+she said to herself, `it would have made a dreadfully ugly child:
+but it makes rather a handsome pig, I think.' And she began
+thinking over other children she knew, who might do very well as
+pigs, and was just saying to herself, `if one only knew the right
+way to change them--' when she was a little startled by seeing
+the Cheshire Cat sitting on a bough of a tree a few yards off.
+
+ The Cat only grinned when it saw Alice. It looked good-
+natured, she thought: still it had VERY long claws and a great
+many teeth, so she felt that it ought to be treated with respect.
+
+ `Cheshire Puss,' she began, rather timidly, as she did not at
+all know whether it would like the name: however, it only
+grinned a little wider. `Come, it's pleased so far,' thought
+Alice, and she went on. `Would you tell me, please, which way I
+ought to go from here?'
+
+ `That depends a good deal on where you want to get to,' said
+the Cat.
+
+ `I don't much care where--' said Alice.
+
+ `Then it doesn't matter which way you go,' said the Cat.
+
+ `--so long as I get SOMEWHERE,' Alice added as an explanation.
+
+ `Oh, you're sure to do that,' said the Cat, `if you only walk
+long enough.'
+
+ Alice felt that this could not be denied, so she tried another
+question. `What sort of people live about here?'
+
+ `In THAT direction,' the Cat said, waving its right paw round,
+`lives a Hatter: and in THAT direction,' waving the other paw,
+`lives a March Hare. Visit either you like: they're both mad.'
+
+ `But I don't want to go among mad people,' Alice remarked.
+
+ `Oh, you can't help that,' said the Cat: `we're all mad here.
+I'm mad. You're mad.'
+
+ `How do you know I'm mad?' said Alice.
+
+ `You must be,' said the Cat, `or you wouldn't have come here.'
+
+ Alice didn't think that proved it at all; however, she went on
+`And how do you know that you're mad?'
+
+ `To begin with,' said the Cat, `a dog's not mad. You grant
+that?'
+
+ `I suppose so,' said Alice.
+
+ `Well, then,' the Cat went on, `you see, a dog growls when it's
+angry, and wags its tail when it's pleased. Now I growl when I'm
+pleased, and wag my tail when I'm angry. Therefore I'm mad.'
+
+ `I call it purring, not growling,' said Alice.
+
+ `Call it what you like,' said the Cat. `Do you play croquet
+with the Queen to-day?'
+
+ `I should like it very much,' said Alice, `but I haven't been
+invited yet.'
+
+ `You'll see me there,' said the Cat, and vanished.
+
+ Alice was not much surprised at this, she was getting so used
+to queer things happening. While she was looking at the place
+where it had been, it suddenly appeared again.
+
+ `By-the-bye, what became of the baby?' said the Cat. `I'd
+nearly forgotten to ask.'
+
+ `It turned into a pig,' Alice quietly said, just as if it had
+come back in a natural way.
+
+ `I thought it would,' said the Cat, and vanished again.
+
+ Alice waited a little, half expecting to see it again, but it
+did not appear, and after a minute or two she walked on in the
+direction in which the March Hare was said to live. `I've seen
+hatters before,' she said to herself; `the March Hare will be
+much the most interesting, and perhaps as this is May it won't be
+raving mad--at least not so mad as it was in March.' As she said
+this, she looked up, and there was the Cat again, sitting on a
+branch of a tree.
+
+ `Did you say pig, or fig?' said the Cat.
+
+ `I said pig,' replied Alice; `and I wish you wouldn't keep
+appearing and vanishing so suddenly: you make one quite giddy.'
+
+ `All right,' said the Cat; and this time it vanished quite
+slowly, beginning with the end of the tail, and ending with the
+grin, which remained some time after the rest of it had gone.
+
+ `Well! I've often seen a cat without a grin,' thought Alice;
+`but a grin without a cat! It's the most curious thing I ever
+say in my life!'
+
+ She had not gone much farther before she came in sight of the
+house of the March Hare: she thought it must be the right house,
+because the chimneys were shaped like ears and the roof was
+thatched with fur. It was so large a house, that she did not
+like to go nearer till she had nibbled some more of the lefthand
+bit of mushroom, and raised herself to about two feet high: even
+then she walked up towards it rather timidly, saying to herself
+`Suppose it should be raving mad after all! I almost wish I'd
+gone to see the Hatter instead!'
+
+
+
+ CHAPTER VII
+
+ A Mad Tea-Party
+
+
+ There was a table set out under a tree in front of the house,
+and the March Hare and the Hatter were having tea at it: a
+Dormouse was sitting between them, fast asleep, and the other two
+were using it as a cushion, resting their elbows on it, and the
+talking over its head. `Very uncomfortable for the Dormouse,'
+thought Alice; `only, as it's asleep, I suppose it doesn't mind.'
+
+ The table was a large one, but the three were all crowded
+together at one corner of it: `No room! No room!' they cried
+out when they saw Alice coming. `There's PLENTY of room!' said
+Alice indignantly, and she sat down in a large arm-chair at one
+end of the table.
+
+ `Have some wine,' the March Hare said in an encouraging tone.
+
+ Alice looked all round the table, but there was nothing on it
+but tea. `I don't see any wine,' she remarked.
+
+ `There isn't any,' said the March Hare.
+
+ `Then it wasn't very civil of you to offer it,' said Alice
+angrily.
+
+ `It wasn't very civil of you to sit down without being
+invited,' said the March Hare.
+
+ `I didn't know it was YOUR table,' said Alice; `it's laid for a
+great many more than three.'
+
+ `Your hair wants cutting,' said the Hatter. He had been
+looking at Alice for some time with great curiosity, and this was
+his first speech.
+
+ `You should learn not to make personal remarks,' Alice said
+with some severity; `it's very rude.'
+
+ The Hatter opened his eyes very wide on hearing this; but all
+he SAID was, `Why is a raven like a writing-desk?'
+
+ `Come, we shall have some fun now!' thought Alice. `I'm glad
+they've begun asking riddles.--I believe I can guess that,' she
+added aloud.
+
+ `Do you mean that you think you can find out the answer to it?'
+said the March Hare.
+
+ `Exactly so,' said Alice.
+
+ `Then you should say what you mean,' the March Hare went on.
+
+ `I do,' Alice hastily replied; `at least--at least I mean what
+I say--that's the same thing, you know.'
+
+ `Not the same thing a bit!' said the Hatter. `You might just
+as well say that "I see what I eat" is the same thing as "I eat
+what I see"!'
+
+ `You might just as well say,' added the March Hare, `that "I
+like what I get" is the same thing as "I get what I like"!'
+
+ `You might just as well say,' added the Dormouse, who seemed to
+be talking in his sleep, `that "I breathe when I sleep" is the
+same thing as "I sleep when I breathe"!'
+
+ `It IS the same thing with you,' said the Hatter, and here the
+conversation dropped, and the party sat silent for a minute,
+while Alice thought over all she could remember about ravens and
+writing-desks, which wasn't much.
+
+ The Hatter was the first to break the silence. `What day of
+the month is it?' he said, turning to Alice: he had taken his
+watch out of his pocket, and was looking at it uneasily, shaking
+it every now and then, and holding it to his ear.
+
+ Alice considered a little, and then said `The fourth.'
+
+ `Two days wrong!' sighed the Hatter. `I told you butter
+wouldn't suit the works!' he added looking angrily at the March
+Hare.
+
+ `It was the BEST butter,' the March Hare meekly replied.
+
+ `Yes, but some crumbs must have got in as well,' the Hatter
+grumbled: `you shouldn't have put it in with the bread-knife.'
+
+ The March Hare took the watch and looked at it gloomily: then
+he dipped it into his cup of tea, and looked at it again: but he
+could think of nothing better to say than his first remark, `It
+was the BEST butter, you know.'
+
+ Alice had been looking over his shoulder with some curiosity.
+`What a funny watch!' she remarked. `It tells the day of the
+month, and doesn't tell what o'clock it is!'
+
+ `Why should it?' muttered the Hatter. `Does YOUR watch tell
+you what year it is?'
+
+ `Of course not,' Alice replied very readily: `but that's
+because it stays the same year for such a long time together.'
+
+ `Which is just the case with MINE,' said the Hatter.
+
+ Alice felt dreadfully puzzled. The Hatter's remark seemed to
+have no sort of meaning in it, and yet it was certainly English.
+`I don't quite understand you,' she said, as politely as she
+could.
+
+ `The Dormouse is asleep again,' said the Hatter, and he poured
+a little hot tea upon its nose.
+
+ The Dormouse shook its head impatiently, and said, without
+opening its eyes, `Of course, of course; just what I was going to
+remark myself.'
+
+ `Have you guessed the riddle yet?' the Hatter said, turning to
+Alice again.
+
+ `No, I give it up,' Alice replied: `what's the answer?'
+
+ `I haven't the slightest idea,' said the Hatter.
+
+ `Nor I,' said the March Hare.
+
+ Alice sighed wearily. `I think you might do something better
+with the time,' she said, `than waste it in asking riddles that
+have no answers.'
+
+ `If you knew Time as well as I do,' said the Hatter, `you
+wouldn't talk about wasting IT. It's HIM.'
+
+ `I don't know what you mean,' said Alice.
+
+ `Of course you don't!' the Hatter said, tossing his head
+contemptuously. `I dare say you never even spoke to Time!'
+
+ `Perhaps not,' Alice cautiously replied: `but I know I have to
+beat time when I learn music.'
+
+ `Ah! that accounts for it,' said the Hatter. `He won't stand
+beating. Now, if you only kept on good terms with him, he'd do
+almost anything you liked with the clock. For instance, suppose
+it were nine o'clock in the morning, just time to begin lessons:
+you'd only have to whisper a hint to Time, and round goes the
+clock in a twinkling! Half-past one, time for dinner!'
+
+ (`I only wish it was,' the March Hare said to itself in a
+whisper.)
+
+ `That would be grand, certainly,' said Alice thoughtfully:
+`but then--I shouldn't be hungry for it, you know.'
+
+ `Not at first, perhaps,' said the Hatter: `but you could keep
+it to half-past one as long as you liked.'
+
+ `Is that the way YOU manage?' Alice asked.
+
+ The Hatter shook his head mournfully. `Not I!' he replied.
+`We quarrelled last March--just before HE went mad, you know--'
+(pointing with his tea spoon at the March Hare,) `--it was at the
+great concert given by the Queen of Hearts, and I had to sing
+
+ "Twinkle, twinkle, little bat!
+ How I wonder what you're at!"
+
+You know the song, perhaps?'
+
+ `I've heard something like it,' said Alice.
+
+ `It goes on, you know,' the Hatter continued, `in this way:--
+
+ "Up above the world you fly,
+ Like a tea-tray in the sky.
+ Twinkle, twinkle--"'
+
+Here the Dormouse shook itself, and began singing in its sleep
+`Twinkle, twinkle, twinkle, twinkle--' and went on so long that
+they had to pinch it to make it stop.
+
+ `Well, I'd hardly finished the first verse,' said the Hatter,
+`when the Queen jumped up and bawled out, "He's murdering the
+time! Off with his head!"'
+
+ `How dreadfully savage!' exclaimed Alice.
+
+ `And ever since that,' the Hatter went on in a mournful tone,
+`he won't do a thing I ask! It's always six o'clock now.'
+
+ A bright idea came into Alice's head. `Is that the reason so
+many tea-things are put out here?' she asked.
+
+ `Yes, that's it,' said the Hatter with a sigh: `it's always
+tea-time, and we've no time to wash the things between whiles.'
+
+ `Then you keep moving round, I suppose?' said Alice.
+
+ `Exactly so,' said the Hatter: `as the things get used up.'
+
+ `But what happens when you come to the beginning again?' Alice
+ventured to ask.
+
+ `Suppose we change the subject,' the March Hare interrupted,
+yawning. `I'm getting tired of this. I vote the young lady
+tells us a story.'
+
+ `I'm afraid I don't know one,' said Alice, rather alarmed at
+the proposal.
+
+ `Then the Dormouse shall!' they both cried. `Wake up,
+Dormouse!' And they pinched it on both sides at once.
+
+ The Dormouse slowly opened his eyes. `I wasn't asleep,' he
+said in a hoarse, feeble voice: `I heard every word you fellows
+were saying.'
+
+ `Tell us a story!' said the March Hare.
+
+ `Yes, please do!' pleaded Alice.
+
+ `And be quick about it,' added the Hatter, `or you'll be asleep
+again before it's done.'
+
+ `Once upon a time there were three little sisters,' the
+Dormouse began in a great hurry; `and their names were Elsie,
+Lacie, and Tillie; and they lived at the bottom of a well--'
+
+ `What did they live on?' said Alice, who always took a great
+interest in questions of eating and drinking.
+
+ `They lived on treacle,' said the Dormouse, after thinking a
+minute or two.
+
+ `They couldn't have done that, you know,' Alice gently
+remarked; `they'd have been ill.'
+
+ `So they were,' said the Dormouse; `VERY ill.'
+
+ Alice tried to fancy to herself what such an extraordinary ways
+of living would be like, but it puzzled her too much, so she went
+on: `But why did they live at the bottom of a well?'
+
+ `Take some more tea,' the March Hare said to Alice, very
+earnestly.
+
+ `I've had nothing yet,' Alice replied in an offended tone, `so
+I can't take more.'
+
+ `You mean you can't take LESS,' said the Hatter: `it's very
+easy to take MORE than nothing.'
+
+ `Nobody asked YOUR opinion,' said Alice.
+
+ `Who's making personal remarks now?' the Hatter asked
+triumphantly.
+
+ Alice did not quite know what to say to this: so she helped
+herself to some tea and bread-and-butter, and then turned to the
+Dormouse, and repeated her question. `Why did they live at the
+bottom of a well?'
+
+ The Dormouse again took a minute or two to think about it, and
+then said, `It was a treacle-well.'
+
+ `There's no such thing!' Alice was beginning very angrily, but
+the Hatter and the March Hare went `Sh! sh!' and the Dormouse
+sulkily remarked, `If you can't be civil, you'd better finish the
+story for yourself.'
+
+ `No, please go on!' Alice said very humbly; `I won't interrupt
+again. I dare say there may be ONE.'
+
+ `One, indeed!' said the Dormouse indignantly. However, he
+consented to go on. `And so these three little sisters--they
+were learning to draw, you know--'
+
+ `What did they draw?' said Alice, quite forgetting her promise.
+
+ `Treacle,' said the Dormouse, without considering at all this
+time.
+
+ `I want a clean cup,' interrupted the Hatter: `let's all move
+one place on.'
+
+ He moved on as he spoke, and the Dormouse followed him: the
+March Hare moved into the Dormouse's place, and Alice rather
+unwillingly took the place of the March Hare. The Hatter was the
+only one who got any advantage from the change: and Alice was a
+good deal worse off than before, as the March Hare had just upset
+the milk-jug into his plate.
+
+ Alice did not wish to offend the Dormouse again, so she began
+very cautiously: `But I don't understand. Where did they draw
+the treacle from?'
+
+ `You can draw water out of a water-well,' said the Hatter; `so
+I should think you could draw treacle out of a treacle-well--eh,
+stupid?'
+
+ `But they were IN the well,' Alice said to the Dormouse, not
+choosing to notice this last remark.
+
+ `Of course they were', said the Dormouse; `--well in.'
+
+ This answer so confused poor Alice, that she let the Dormouse
+go on for some time without interrupting it.
+
+ `They were learning to draw,' the Dormouse went on, yawning and
+rubbing its eyes, for it was getting very sleepy; `and they drew
+all manner of things--everything that begins with an M--'
+
+ `Why with an M?' said Alice.
+
+ `Why not?' said the March Hare.
+
+ Alice was silent.
+
+ The Dormouse had closed its eyes by this time, and was going
+off into a doze; but, on being pinched by the Hatter, it woke up
+again with a little shriek, and went on: `--that begins with an
+M, such as mouse-traps, and the moon, and memory, and muchness--
+you know you say things are "much of a muchness"--did you ever
+see such a thing as a drawing of a muchness?'
+
+ `Really, now you ask me,' said Alice, very much confused, `I
+don't think--'
+
+ `Then you shouldn't talk,' said the Hatter.
+
+ This piece of rudeness was more than Alice could bear: she got
+up in great disgust, and walked off; the Dormouse fell asleep
+instantly, and neither of the others took the least notice of her
+going, though she looked back once or twice, half hoping that
+they would call after her: the last time she saw them, they were
+trying to put the Dormouse into the teapot.
+
+ `At any rate I'll never go THERE again!' said Alice as she
+picked her way through the wood. `It's the stupidest tea-party I
+ever was at in all my life!'
+
+ Just as she said this, she noticed that one of the trees had a
+door leading right into it. `That's very curious!' she thought.
+`But everything's curious today. I think I may as well go in at
+once.' And in she went.
+
+ Once more she found herself in the long hall, and close to the
+little glass table. `Now, I'll manage better this time,' she
+said to herself, and began by taking the little golden key, and
+unlocking the door that led into the garden. Then she went to
+work nibbling at the mushroom (she had kept a piece of it in her
+pocked) till she was about a foot high: then she walked down the
+little passage: and THEN--she found herself at last in the
+beautiful garden, among the bright flower-beds and the cool
+fountains.
+
+
+
+ CHAPTER VIII
+
+ The Queen's Croquet-Ground
+
+
+ A large rose-tree stood near the entrance of the garden: the
+roses growing on it were white, but there were three gardeners at
+it, busily painting them red. Alice thought this a very curious
+thing, and she went nearer to watch them, and just as she came up
+to them she heard one of them say, `Look out now, Five! Don't go
+splashing paint over me like that!'
+
+ `I couldn't help it,' said Five, in a sulky tone; `Seven jogged
+my elbow.'
+
+ On which Seven looked up and said, `That's right, Five! Always
+lay the blame on others!'
+
+ `YOU'D better not talk!' said Five. `I heard the Queen say only
+yesterday you deserved to be beheaded!'
+
+ `What for?' said the one who had spoken first.
+
+ `That's none of YOUR business, Two!' said Seven.
+
+ `Yes, it IS his business!' said Five, `and I'll tell him--it
+was for bringing the cook tulip-roots instead of onions.'
+
+ Seven flung down his brush, and had just begun `Well, of all
+the unjust things--' when his eye chanced to fall upon Alice, as
+she stood watching them, and he checked himself suddenly: the
+others looked round also, and all of them bowed low.
+
+ `Would you tell me,' said Alice, a little timidly, `why you are
+painting those roses?'
+
+ Five and Seven said nothing, but looked at Two. Two began in a
+low voice, `Why the fact is, you see, Miss, this here ought to
+have been a RED rose-tree, and we put a white one in by mistake;
+and if the Queen was to find it out, we should all have our heads
+cut off, you know. So you see, Miss, we're doing our best, afore
+she comes, to--' At this moment Five, who had been anxiously
+looking across the garden, called out `The Queen! The Queen!'
+and the three gardeners instantly threw themselves flat upon
+their faces. There was a sound of many footsteps, and Alice
+looked round, eager to see the Queen.
+
+ First came ten soldiers carrying clubs; these were all shaped
+like the three gardeners, oblong and flat, with their hands and
+feet at the corners: next the ten courtiers; these were
+ornamented all over with diamonds, and walked two and two, as the
+soldiers did. After these came the royal children; there were
+ten of them, and the little dears came jumping merrily along hand
+in hand, in couples: they were all ornamented with hearts. Next
+came the guests, mostly Kings and Queens, and among them Alice
+recognised the White Rabbit: it was talking in a hurried nervous
+manner, smiling at everything that was said, and went by without
+noticing her. Then followed the Knave of Hearts, carrying the
+King's crown on a crimson velvet cushion; and, last of all this
+grand procession, came THE KING AND QUEEN OF HEARTS.
+
+ Alice was rather doubtful whether she ought not to lie down on
+her face like the three gardeners, but she could not remember
+every having heard of such a rule at processions; `and besides,
+what would be the use of a procession,' thought she, `if people
+had all to lie down upon their faces, so that they couldn't see
+it?' So she stood still where she was, and waited.
+
+ When the procession came opposite to Alice, they all stopped
+and looked at her, and the Queen said severely `Who is this?'
+She said it to the Knave of Hearts, who only bowed and smiled in
+reply.
+
+ `Idiot!' said the Queen, tossing her head impatiently; and,
+turning to Alice, she went on, `What's your name, child?'
+
+ `My name is Alice, so please your Majesty,' said Alice very
+politely; but she added, to herself, `Why, they're only a pack of
+cards, after all. I needn't be afraid of them!'
+
+ `And who are THESE?' said the Queen, pointing to the three
+gardeners who were lying round the rosetree; for, you see, as
+they were lying on their faces, and the pattern on their backs
+was the same as the rest of the pack, she could not tell whether
+they were gardeners, or soldiers, or courtiers, or three of her
+own children.
+
+ `How should I know?' said Alice, surprised at her own courage.
+`It's no business of MINE.'
+
+ The Queen turned crimson with fury, and, after glaring at her
+for a moment like a wild beast, screamed `Off with her head!
+Off--'
+
+ `Nonsense!' said Alice, very loudly and decidedly, and the
+Queen was silent.
+
+ The King laid his hand upon her arm, and timidly said
+`Consider, my dear: she is only a child!'
+
+ The Queen turned angrily away from him, and said to the Knave
+`Turn them over!'
+
+ The Knave did so, very carefully, with one foot.
+
+ `Get up!' said the Queen, in a shrill, loud voice, and the
+three gardeners instantly jumped up, and began bowing to the
+King, the Queen, the royal children, and everybody else.
+
+ `Leave off that!' screamed the Queen. `You make me giddy.'
+And then, turning to the rose-tree, she went on, `What HAVE you
+been doing here?'
+
+ `May it please your Majesty,' said Two, in a very humble tone,
+going down on one knee as he spoke, `we were trying--'
+
+ `I see!' said the Queen, who had meanwhile been examining the
+roses. `Off with their heads!' and the procession moved on,
+three of the soldiers remaining behind to execute the unfortunate
+gardeners, who ran to Alice for protection.
+
+ `You shan't be beheaded!' said Alice, and she put them into a
+large flower-pot that stood near. The three soldiers wandered
+about for a minute or two, looking for them, and then quietly
+marched off after the others.
+
+ `Are their heads off?' shouted the Queen.
+
+ `Their heads are gone, if it please your Majesty!' the soldiers
+shouted in reply.
+
+ `That's right!' shouted the Queen. `Can you play croquet?'
+
+ The soldiers were silent, and looked at Alice, as the question
+was evidently meant for her.
+
+ `Yes!' shouted Alice.
+
+ `Come on, then!' roared the Queen, and Alice joined the
+procession, wondering very much what would happen next.
+
+ `It's--it's a very fine day!' said a timid voice at her side.
+She was walking by the White Rabbit, who was peeping anxiously
+into her face.
+
+ `Very,' said Alice: `--where's the Duchess?'
+
+ `Hush! Hush!' said the Rabbit in a low, hurried tone. He
+looked anxiously over his shoulder as he spoke, and then raised
+himself upon tiptoe, put his mouth close to her ear, and
+whispered `She's under sentence of execution.'
+
+ `What for?' said Alice.
+
+ `Did you say "What a pity!"?' the Rabbit asked.
+
+ `No, I didn't,' said Alice: `I don't think it's at all a pity.
+I said "What for?"'
+
+ `She boxed the Queen's ears--' the Rabbit began. Alice gave a
+little scream of laughter. `Oh, hush!' the Rabbit whispered in a
+frightened tone. `The Queen will hear you! You see, she came
+rather late, and the Queen said--'
+
+ `Get to your places!' shouted the Queen in a voice of thunder,
+and people began running about in all directions, tumbling up
+against each other; however, they got settled down in a minute or
+two, and the game began. Alice thought she had never seen such a
+curious croquet-ground in her life; it was all ridges and
+furrows; the balls were live hedgehogs, the mallets live
+flamingoes, and the soldiers had to double themselves up and to
+stand on their hands and feet, to make the arches.
+
+ The chief difficulty Alice found at first was in managing her
+flamingo: she succeeded in getting its body tucked away,
+comfortably enough, under her arm, with its legs hanging down,
+but generally, just as she had got its neck nicely straightened
+out, and was going to give the hedgehog a blow with its head, it
+WOULD twist itself round and look up in her face, with such a
+puzzled expression that she could not help bursting out laughing:
+and when she had got its head down, and was going to begin again,
+it was very provoking to find that the hedgehog had unrolled
+itself, and was in the act of crawling away: besides all this,
+there was generally a ridge or furrow in the way wherever she
+wanted to send the hedgehog to, and, as the doubled-up soldiers
+were always getting up and walking off to other parts of the
+ground, Alice soon came to the conclusion that it was a very
+difficult game indeed.
+
+ The players all played at once without waiting for turns,
+quarrelling all the while, and fighting for the hedgehogs; and in
+a very short time the Queen was in a furious passion, and went
+stamping about, and shouting `Off with his head!' or `Off with
+her head!' about once in a minute.
+
+ Alice began to feel very uneasy: to be sure, she had not as
+yet had any dispute with the Queen, but she knew that it might
+happen any minute, `and then,' thought she, `what would become of
+me? They're dreadfully fond of beheading people here; the great
+wonder is, that there's any one left alive!'
+
+ She was looking about for some way of escape, and wondering
+whether she could get away without being seen, when she noticed a
+curious appearance in the air: it puzzled her very much at
+first, but, after watching it a minute or two, she made it out to
+be a grin, and she said to herself `It's the Cheshire Cat: now I
+shall have somebody to talk to.'
+
+ `How are you getting on?' said the Cat, as soon as there was
+mouth enough for it to speak with.
+
+ Alice waited till the eyes appeared, and then nodded. `It's no
+use speaking to it,' she thought, `till its ears have come, or at
+least one of them.' In another minute the whole head appeared,
+and then Alice put down her flamingo, and began an account of the
+game, feeling very glad she had someone to listen to her. The
+Cat seemed to think that there was enough of it now in sight, and
+no more of it appeared.
+
+ `I don't think they play at all fairly,' Alice began, in rather
+a complaining tone, `and they all quarrel so dreadfully one can't
+hear oneself speak--and they don't seem to have any rules in
+particular; at least, if there are, nobody attends to them--and
+you've no idea how confusing it is all the things being alive;
+for instance, there's the arch I've got to go through next
+walking about at the other end of the ground--and I should have
+croqueted the Queen's hedgehog just now, only it ran away when it
+saw mine coming!'
+
+ `How do you like the Queen?' said the Cat in a low voice.
+
+ `Not at all,' said Alice: `she's so extremely--' Just then
+she noticed that the Queen was close behind her, listening: so
+she went on, `--likely to win, that it's hardly worth while
+finishing the game.'
+
+ The Queen smiled and passed on.
+
+ `Who ARE you talking to?' said the King, going up to Alice, and
+looking at the Cat's head with great curiosity.
+
+ `It's a friend of mine--a Cheshire Cat,' said Alice: `allow me
+to introduce it.'
+
+ `I don't like the look of it at all,' said the King: `however,
+it may kiss my hand if it likes.'
+
+ `I'd rather not,' the Cat remarked.
+
+ `Don't be impertinent,' said the King, `and don't look at me
+like that!' He got behind Alice as he spoke.
+
+ `A cat may look at a king,' said Alice. `I've read that in
+some book, but I don't remember where.'
+
+ `Well, it must be removed,' said the King very decidedly, and
+he called the Queen, who was passing at the moment, `My dear! I
+wish you would have this cat removed!'
+
+ The Queen had only one way of settling all difficulties, great
+or small. `Off with his head!' she said, without even looking
+round.
+
+ `I'll fetch the executioner myself,' said the King eagerly, and
+he hurried off.
+
+ Alice thought she might as well go back, and see how the game
+was going on, as she heard the Queen's voice in the distance,
+screaming with passion. She had already heard her sentence three
+of the players to be executed for having missed their turns, and
+she did not like the look of things at all, as the game was in
+such confusion that she never knew whether it was her turn or
+not. So she went in search of her hedgehog.
+
+ The hedgehog was engaged in a fight with another hedgehog,
+which seemed to Alice an excellent opportunity for croqueting one
+of them with the other: the only difficulty was, that her
+flamingo was gone across to the other side of the garden, where
+Alice could see it trying in a helpless sort of way to fly up
+into a tree.
+
+ By the time she had caught the flamingo and brought it back,
+the fight was over, and both the hedgehogs were out of sight:
+`but it doesn't matter much,' thought Alice, `as all the arches
+are gone from this side of the ground.' So she tucked it away
+under her arm, that it might not escape again, and went back for
+a little more conversation with her friend.
+
+ When she got back to the Cheshire Cat, she was surprised to
+find quite a large crowd collected round it: there was a dispute
+going on between the executioner, the King, and the Queen, who
+were all talking at once, while all the rest were quite silent,
+and looked very uncomfortable.
+
+ The moment Alice appeared, she was appealed to by all three to
+settle the question, and they repeated their arguments to her,
+though, as they all spoke at once, she found it very hard indeed
+to make out exactly what they said.
+
+ The executioner's argument was, that you couldn't cut off a
+head unless there was a body to cut it off from: that he had
+never had to do such a thing before, and he wasn't going to begin
+at HIS time of life.
+
+ The King's argument was, that anything that had a head could be
+beheaded, and that you weren't to talk nonsense.
+
+ The Queen's argument was, that if something wasn't done about
+it in less than no time she'd have everybody executed, all round.
+(It was this last remark that had made the whole party look so
+grave and anxious.)
+
+ Alice could think of nothing else to say but `It belongs to the
+Duchess: you'd better ask HER about it.'
+
+ `She's in prison,' the Queen said to the executioner: `fetch
+her here.' And the executioner went off like an arrow.
+
+ The Cat's head began fading away the moment he was gone, and,
+by the time he had come back with the Dutchess, it had entirely
+disappeared; so the King and the executioner ran wildly up and
+down looking for it, while the rest of the party went back to the game.
+
+
+
+ CHAPTER IX
+
+ The Mock Turtle's Story
+
+
+ `You can't think how glad I am to see you again, you dear old
+thing!' said the Duchess, as she tucked her arm affectionately
+into Alice's, and they walked off together.
+
+ Alice was very glad to find her in such a pleasant temper, and
+thought to herself that perhaps it was only the pepper that had
+made her so savage when they met in the kitchen.
+
+ `When I'M a Duchess,' she said to herself, (not in a very
+hopeful tone though), `I won't have any pepper in my kitchen AT
+ALL. Soup does very well without--Maybe it's always pepper that
+makes people hot-tempered,' she went on, very much pleased at
+having found out a new kind of rule, `and vinegar that makes them
+sour--and camomile that makes them bitter--and--and barley-sugar
+and such things that make children sweet-tempered. I only wish
+people knew that: then they wouldn't be so stingy about it, you
+know--'
+
+ She had quite forgotten the Duchess by this time, and was a
+little startled when she heard her voice close to her ear.
+`You're thinking about something, my dear, and that makes you
+forget to talk. I can't tell you just now what the moral of that
+is, but I shall remember it in a bit.'
+
+ `Perhaps it hasn't one,' Alice ventured to remark.
+
+ `Tut, tut, child!' said the Duchess. `Everything's got a
+moral, if only you can find it.' And she squeezed herself up
+closer to Alice's side as she spoke.
+
+ Alice did not much like keeping so close to her: first,
+because the Duchess was VERY ugly; and secondly, because she was
+exactly the right height to rest her chin upon Alice's shoulder,
+and it was an uncomfortably sharp chin. However, she did not
+like to be rude, so she bore it as well as she could.
+
+ `The game's going on rather better now,' she said, by way of
+keeping up the conversation a little.
+
+ `'Tis so,' said the Duchess: `and the moral of that is--"Oh,
+'tis love, 'tis love, that makes the world go round!"'
+
+ `Somebody said,' Alice whispered, `that it's done by everybody
+minding their own business!'
+
+ `Ah, well! It means much the same thing,' said the Duchess,
+digging her sharp little chin into Alice's shoulder as she added,
+`and the moral of THAT is--"Take care of the sense, and the
+sounds will take care of themselves."'
+
+ `How fond she is of finding morals in things!' Alice thought to
+herself.
+
+ `I dare say you're wondering why I don't put my arm round your
+waist,' the Duchess said after a pause: `the reason is, that I'm
+doubtful about the temper of your flamingo. Shall I try the
+experiment?'
+
+ `HE might bite,' Alice cautiously replied, not feeling at all
+anxious to have the experiment tried.
+
+ `Very true,' said the Duchess: `flamingoes and mustard both
+bite. And the moral of that is--"Birds of a feather flock
+together."'
+
+ `Only mustard isn't a bird,' Alice remarked.
+
+ `Right, as usual,' said the Duchess: `what a clear way you
+have of putting things!'
+
+ `It's a mineral, I THINK,' said Alice.
+
+ `Of course it is,' said the Duchess, who seemed ready to agree
+to everything that Alice said; `there's a large mustard-mine near
+here. And the moral of that is--"The more there is of mine, the
+less there is of yours."'
+
+ `Oh, I know!' exclaimed Alice, who had not attended to this
+last remark, `it's a vegetable. It doesn't look like one, but it
+is.'
+
+ `I quite agree with you,' said the Duchess; `and the moral of
+that is--"Be what you would seem to be"--or if you'd like it put
+more simply--"Never imagine yourself not to be otherwise than
+what it might appear to others that what you were or might have
+been was not otherwise than what you had been would have appeared
+to them to be otherwise."'
+
+ `I think I should understand that better,' Alice said very
+politely, `if I had it written down: but I can't quite follow it
+as you say it.'
+
+ `That's nothing to what I could say if I chose,' the Duchess
+replied, in a pleased tone.
+
+ `Pray don't trouble yourself to say it any longer than that,'
+said Alice.
+
+ `Oh, don't talk about trouble!' said the Duchess. `I make you
+a present of everything I've said as yet.'
+
+ `A cheap sort of present!' thought Alice. `I'm glad they don't
+give birthday presents like that!' But she did not venture to
+say it out loud.
+
+ `Thinking again?' the Duchess asked, with another dig of her
+sharp little chin.
+
+ `I've a right to think,' said Alice sharply, for she was
+beginning to feel a little worried.
+
+ `Just about as much right,' said the Duchess, `as pigs have to
+fly; and the m--'
+
+ But here, to Alice's great surprise, the Duchess's voice died
+away, even in the middle of her favourite word `moral,' and the
+arm that was linked into hers began to tremble. Alice looked up,
+and there stood the Queen in front of them, with her arms folded,
+frowning like a thunderstorm.
+
+ `A fine day, your Majesty!' the Duchess began in a low, weak
+voice.
+
+ `Now, I give you fair warning,' shouted the Queen, stamping on
+the ground as she spoke; `either you or your head must be off,
+and that in about half no time! Take your choice!'
+
+ The Duchess took her choice, and was gone in a moment.
+
+ `Let's go on with the game,' the Queen said to Alice; and Alice
+was too much frightened to say a word, but slowly followed her
+back to the croquet-ground.
+
+ The other guests had taken advantage of the Queen's absence,
+and were resting in the shade: however, the moment they saw her,
+they hurried back to the game, the Queen merely remarking that a
+moment's delay would cost them their lives.
+
+ All the time they were playing the Queen never left off
+quarrelling with the other players, and shouting `Off with his
+head!' or `Off with her head!' Those whom she sentenced were
+taken into custody by the soldiers, who of course had to leave
+off being arches to do this, so that by the end of half an hour
+or so there were no arches left, and all the players, except the
+King, the Queen, and Alice, were in custody and under sentence of
+execution.
+
+ Then the Queen left off, quite out of breath, and said to
+Alice, `Have you seen the Mock Turtle yet?'
+
+ `No,' said Alice. `I don't even know what a Mock Turtle is.'
+
+ `It's the thing Mock Turtle Soup is made from,' said the Queen.
+
+ `I never saw one, or heard of one,' said Alice.
+
+ `Come on, then,' said the Queen, `and he shall tell you his
+history,'
+
+ As they walked off together, Alice heard the King say in a low
+voice, to the company generally, `You are all pardoned.' `Come,
+THAT'S a good thing!' she said to herself, for she had felt quite
+unhappy at the number of executions the Queen had ordered.
+
+ They very soon came upon a Gryphon, lying fast asleep in the
+sun. (IF you don't know what a Gryphon is, look at the picture.)
+`Up, lazy thing!' said the Queen, `and take this young lady to
+see the Mock Turtle, and to hear his history. I must go back and
+see after some executions I have ordered'; and she walked off,
+leaving Alice alone with the Gryphon. Alice did not quite like
+the look of the creature, but on the whole she thought it would
+be quite as safe to stay with it as to go after that savage
+Queen: so she waited.
+
+ The Gryphon sat up and rubbed its eyes: then it watched the
+Queen till she was out of sight: then it chuckled. `What fun!'
+said the Gryphon, half to itself, half to Alice.
+
+ `What IS the fun?' said Alice.
+
+ `Why, SHE,' said the Gryphon. `It's all her fancy, that: they
+never executes nobody, you know. Come on!'
+
+ `Everybody says "come on!" here,' thought Alice, as she went
+slowly after it: `I never was so ordered about in all my life,
+never!'
+
+ They had not gone far before they saw the Mock Turtle in the
+distance, sitting sad and lonely on a little ledge of rock, and,
+as they came nearer, Alice could hear him sighing as if his heart
+would break. She pitied him deeply. `What is his sorrow?' she
+asked the Gryphon, and the Gryphon answered, very nearly in the
+same words as before, `It's all his fancy, that: he hasn't got
+no sorrow, you know. Come on!'
+
+ So they went up to the Mock Turtle, who looked at them with
+large eyes full of tears, but said nothing.
+
+ `This here young lady,' said the Gryphon, `she wants for to
+know your history, she do.'
+
+ `I'll tell it her,' said the Mock Turtle in a deep, hollow
+tone: `sit down, both of you, and don't speak a word till I've
+finished.'
+
+ So they sat down, and nobody spoke for some minutes. Alice
+thought to herself, `I don't see how he can EVEN finish, if he
+doesn't begin.' But she waited patiently.
+
+ `Once,' said the Mock Turtle at last, with a deep sigh, `I was
+a real Turtle.'
+
+ These words were followed by a very long silence, broken only
+by an occasional exclamation of `Hjckrrh!' from the Gryphon, and
+the constant heavy sobbing of the Mock Turtle. Alice was very
+nearly getting up and saying, `Thank you, sir, for your
+interesting story,' but she could not help thinking there MUST be
+more to come, so she sat still and said nothing.
+
+ `When we were little,' the Mock Turtle went on at last, more
+calmly, though still sobbing a little now and then, `we went to
+school in the sea. The master was an old Turtle--we used to call
+him Tortoise--'
+
+ `Why did you call him Tortoise, if he wasn't one?' Alice asked.
+
+ `We called him Tortoise because he taught us,' said the Mock
+Turtle angrily: `really you are very dull!'
+
+ `You ought to be ashamed of yourself for asking such a simple
+question,' added the Gryphon; and then they both sat silent and
+looked at poor Alice, who felt ready to sink into the earth. At
+last the Gryphon said to the Mock Turtle, `Drive on, old fellow!
+Don't be all day about it!' and he went on in these words:
+
+ `Yes, we went to school in the sea, though you mayn't believe
+it--'
+
+ `I never said I didn't!' interrupted Alice.
+
+ `You did,' said the Mock Turtle.
+
+ `Hold your tongue!' added the Gryphon, before Alice could speak
+again. The Mock Turtle went on.
+
+ `We had the best of educations--in fact, we went to school
+every day--'
+
+ `I'VE been to a day-school, too,' said Alice; `you needn't be
+so proud as all that.'
+
+ `With extras?' asked the Mock Turtle a little anxiously.
+
+ `Yes,' said Alice, `we learned French and music.'
+
+ `And washing?' said the Mock Turtle.
+
+ `Certainly not!' said Alice indignantly.
+
+ `Ah! then yours wasn't a really good school,' said the Mock
+Turtle in a tone of great relief. `Now at OURS they had at the
+end of the bill, "French, music, AND WASHING--extra."'
+
+ `You couldn't have wanted it much,' said Alice; `living at the
+bottom of the sea.'
+
+ `I couldn't afford to learn it.' said the Mock Turtle with a
+sigh. `I only took the regular course.'
+
+ `What was that?' inquired Alice.
+
+ `Reeling and Writhing, of course, to begin with,' the Mock
+Turtle replied; `and then the different branches of Arithmetic--
+Ambition, Distraction, Uglification, and Derision.'
+
+ `I never heard of "Uglification,"' Alice ventured to say. `What
+is it?'
+
+ The Gryphon lifted up both its paws in surprise. `What! Never
+heard of uglifying!' it exclaimed. `You know what to beautify
+is, I suppose?'
+
+ `Yes,' said Alice doubtfully: `it means--to--make--anything--
+prettier.'
+
+ `Well, then,' the Gryphon went on, `if you don't know what to
+uglify is, you ARE a simpleton.'
+
+ Alice did not feel encouraged to ask any more questions about
+it, so she turned to the Mock Turtle, and said `What else had you
+to learn?'
+
+ `Well, there was Mystery,' the Mock Turtle replied, counting
+off the subjects on his flappers, `--Mystery, ancient and modern,
+with Seaography: then Drawling--the Drawling-master was an old
+conger-eel, that used to come once a week: HE taught us
+Drawling, Stretching, and Fainting in Coils.'
+
+ `What was THAT like?' said Alice.
+
+ `Well, I can't show it you myself,' the Mock Turtle said: `I'm
+too stiff. And the Gryphon never learnt it.'
+
+ `Hadn't time,' said the Gryphon: `I went to the Classics
+master, though. He was an old crab, HE was.'
+
+ `I never went to him,' the Mock Turtle said with a sigh: `he
+taught Laughing and Grief, they used to say.'
+
+ `So he did, so he did,' said the Gryphon, sighing in his turn;
+and both creatures hid their faces in their paws.
+
+ `And how many hours a day did you do lessons?' said Alice, in a
+hurry to change the subject.
+
+ `Ten hours the first day,' said the Mock Turtle: `nine the
+next, and so on.'
+
+ `What a curious plan!' exclaimed Alice.
+
+ `That's the reason they're called lessons,' the Gryphon
+remarked: `because they lessen from day to day.'
+
+ This was quite a new idea to Alice, and she thought it over a
+little before she made her next remark. `Then the eleventh day
+must have been a holiday?'
+
+ `Of course it was,' said the Mock Turtle.
+
+ `And how did you manage on the twelfth?' Alice went on eagerly.
+
+ `That's enough about lessons,' the Gryphon interrupted in a
+very decided tone: `tell her something about the games now.'
+
+
+
+ CHAPTER X
+
+ The Lobster Quadrille
+
+
+ The Mock Turtle sighed deeply, and drew the back of one flapper
+across his eyes. He looked at Alice, and tried to speak, but for
+a minute or two sobs choked his voice. `Same as if he had a bone
+in his throat,' said the Gryphon: and it set to work shaking him
+and punching him in the back. At last the Mock Turtle recovered
+his voice, and, with tears running down his cheeks, he went on
+again:--
+
+ `You may not have lived much under the sea--' (`I haven't,'
+said Alice)--`and perhaps you were never even introduced to a lobster--'
+(Alice began to say `I once tasted--' but checked herself hastily,
+and said `No, never') `--so you can have no idea what a delightful
+thing a Lobster Quadrille is!'
+
+ `No, indeed,' said Alice. `What sort of a dance is it?'
+
+ `Why,' said the Gryphon, `you first form into a line along the
+sea-shore--'
+
+ `Two lines!' cried the Mock Turtle. `Seals, turtles, salmon,
+and so on; then, when you've cleared all the jelly-fish out of
+the way--'
+
+ `THAT generally takes some time,' interrupted the Gryphon.
+
+ `--you advance twice--'
+
+ `Each with a lobster as a partner!' cried the Gryphon.
+
+ `Of course,' the Mock Turtle said: `advance twice, set to
+partners--'
+
+ `--change lobsters, and retire in same order,' continued the
+Gryphon.
+
+ `Then, you know,' the Mock Turtle went on, `you throw the--'
+
+ `The lobsters!' shouted the Gryphon, with a bound into the air.
+
+ `--as far out to sea as you can--'
+
+ `Swim after them!' screamed the Gryphon.
+
+ `Turn a somersault in the sea!' cried the Mock Turtle,
+capering wildly about.
+
+ `Back to land again, and that's all the first figure,' said the
+Mock Turtle, suddenly dropping his voice; and the two creatures,
+who had been jumping about like mad things all this time, sat
+down again very sadly and quietly, and looked at Alice.
+
+ `It must be a very pretty dance,' said Alice timidly.
+
+ `Would you like to see a little of it?' said the Mock Turtle.
+
+ `Very much indeed,' said Alice.
+
+ `Come, let's try the first figure!' said the Mock Turtle to the
+Gryphon. `We can do without lobsters, you know. Which shall
+sing?'
+
+ `Oh, YOU sing,' said the Gryphon. `I've forgotten the words.'
+
+ So they began solemnly dancing round and round Alice, every now
+and then treading on her toes when they passed too close, and
+waving their forepaws to mark the time, while the Mock Turtle
+sang this, very slowly and sadly:--
+
+
+`"Will you walk a little faster?" said a whiting to a snail.
+"There's a porpoise close behind us, and he's treading on my
+ tail.
+See how eagerly the lobsters and the turtles all advance!
+They are waiting on the shingle--will you come and join the
+dance?
+
+Will you, won't you, will you, won't you, will you join the
+dance?
+Will you, won't you, will you, won't you, won't you join the
+dance?
+
+
+"You can really have no notion how delightful it will be
+When they take us up and throw us, with the lobsters, out to
+ sea!"
+But the snail replied "Too far, too far!" and gave a look
+ askance--
+Said he thanked the whiting kindly, but he would not join the
+ dance.
+ Would not, could not, would not, could not, would not join
+ the dance.
+ Would not, could not, would not, could not, could not join
+ the dance.
+
+`"What matters it how far we go?" his scaly friend replied.
+"There is another shore, you know, upon the other side.
+The further off from England the nearer is to France--
+Then turn not pale, beloved snail, but come and join the dance.
+
+ Will you, won't you, will you, won't you, will you join the
+ dance?
+ Will you, won't you, will you, won't you, won't you join the
+ dance?"'
+
+
+
+ `Thank you, it's a very interesting dance to watch,' said
+Alice, feeling very glad that it was over at last: `and I do so
+like that curious song about the whiting!'
+
+ `Oh, as to the whiting,' said the Mock Turtle, `they--you've
+seen them, of course?'
+
+ `Yes,' said Alice, `I've often seen them at dinn--' she
+checked herself hastily.
+
+ `I don't know where Dinn may be,' said the Mock Turtle, `but
+if you've seen them so often, of course you know what they're
+like.'
+
+ `I believe so,' Alice replied thoughtfully. `They have their
+tails in their mouths--and they're all over crumbs.'
+
+ `You're wrong about the crumbs,' said the Mock Turtle:
+`crumbs would all wash off in the sea. But they HAVE their tails
+in their mouths; and the reason is--' here the Mock Turtle
+yawned and shut his eyes.--`Tell her about the reason and all
+that,' he said to the Gryphon.
+
+ `The reason is,' said the Gryphon, `that they WOULD go with
+the lobsters to the dance. So they got thrown out to sea. So
+they had to fall a long way. So they got their tails fast in
+their mouths. So they couldn't get them out again. That's all.'
+
+ `Thank you,' said Alice, `it's very interesting. I never knew
+so much about a whiting before.'
+
+ `I can tell you more than that, if you like,' said the
+Gryphon. `Do you know why it's called a whiting?'
+
+ `I never thought about it,' said Alice. `Why?'
+
+ `IT DOES THE BOOTS AND SHOES.' the Gryphon replied very
+solemnly.
+
+ Alice was thoroughly puzzled. `Does the boots and shoes!' she
+repeated in a wondering tone.
+
+ `Why, what are YOUR shoes done with?' said the Gryphon. `I
+mean, what makes them so shiny?'
+
+ Alice looked down at them, and considered a little before she
+gave her answer. `They're done with blacking, I believe.'
+
+ `Boots and shoes under the sea,' the Gryphon went on in a deep
+voice, `are done with a whiting. Now you know.'
+
+ `And what are they made of?' Alice asked in a tone of great
+curiosity.
+
+ `Soles and eels, of course,' the Gryphon replied rather
+impatiently: `any shrimp could have told you that.'
+
+ `If I'd been the whiting,' said Alice, whose thoughts were
+still running on the song, `I'd have said to the porpoise, "Keep
+back, please: we don't want YOU with us!"'
+
+ `They were obliged to have him with them,' the Mock Turtle
+said: `no wise fish would go anywhere without a porpoise.'
+
+ `Wouldn't it really?' said Alice in a tone of great surprise.
+
+ `Of course not,' said the Mock Turtle: `why, if a fish came
+to ME, and told me he was going a journey, I should say "With
+what porpoise?"'
+
+ `Don't you mean "purpose"?' said Alice.
+
+ `I mean what I say,' the Mock Turtle replied in an offended
+tone. And the Gryphon added `Come, let's hear some of YOUR
+adventures.'
+
+ `I could tell you my adventures--beginning from this morning,'
+said Alice a little timidly: `but it's no use going back to
+yesterday, because I was a different person then.'
+
+ `Explain all that,' said the Mock Turtle.
+
+ `No, no! The adventures first,' said the Gryphon in an
+impatient tone: `explanations take such a dreadful time.'
+
+ So Alice began telling them her adventures from the time when
+she first saw the White Rabbit. She was a little nervous about
+it just at first, the two creatures got so close to her, one on
+each side, and opened their eyes and mouths so VERY wide, but she
+gained courage as she went on. Her listeners were perfectly
+quiet till she got to the part about her repeating `YOU ARE OLD,
+FATHER WILLIAM,' to the Caterpillar, and the words all coming
+different, and then the Mock Turtle drew a long breath, and said
+`That's very curious.'
+
+ `It's all about as curious as it can be,' said the Gryphon.
+
+ `It all came different!' the Mock Turtle repeated
+thoughtfully. `I should like to hear her try and repeat
+something now. Tell her to begin.' He looked at the Gryphon as
+if he thought it had some kind of authority over Alice.
+
+ `Stand up and repeat "'TIS THE VOICE OF THE SLUGGARD,"' said
+the Gryphon.
+
+ `How the creatures order one about, and make one repeat
+lessons!' thought Alice; `I might as well be at school at once.'
+However, she got up, and began to repeat it, but her head was so
+full of the Lobster Quadrille, that she hardly knew what she was
+saying, and the words came very queer indeed:--
+
+ `'Tis the voice of the Lobster; I heard him declare,
+ "You have baked me too brown, I must sugar my hair."
+ As a duck with its eyelids, so he with his nose
+ Trims his belt and his buttons, and turns out his toes.'
+
+ [later editions continued as follows
+ When the sands are all dry, he is gay as a lark,
+ And will talk in contemptuous tones of the Shark,
+ But, when the tide rises and sharks are around,
+ His voice has a timid and tremulous sound.]
+
+ `That's different from what I used to say when I was a child,'
+said the Gryphon.
+
+ `Well, I never heard it before,' said the Mock Turtle; `but it
+sounds uncommon nonsense.'
+
+ Alice said nothing; she had sat down with her face in her
+hands, wondering if anything would EVER happen in a natural way
+again.
+
+ `I should like to have it explained,' said the Mock Turtle.
+
+ `She can't explain it,' said the Gryphon hastily. `Go on with
+the next verse.'
+
+ `But about his toes?' the Mock Turtle persisted. `How COULD
+he turn them out with his nose, you know?'
+
+ `It's the first position in dancing.' Alice said; but was
+dreadfully puzzled by the whole thing, and longed to change the
+subject.
+
+ `Go on with the next verse,' the Gryphon repeated impatiently:
+`it begins "I passed by his garden."'
+
+ Alice did not dare to disobey, though she felt sure it would
+all come wrong, and she went on in a trembling voice:--
+
+ `I passed by his garden, and marked, with one eye,
+ How the Owl and the Panther were sharing a pie--'
+
+ [later editions continued as follows
+ The Panther took pie-crust, and gravy, and meat,
+ While the Owl had the dish as its share of the treat.
+ When the pie was all finished, the Owl, as a boon,
+ Was kindly permitted to pocket the spoon:
+ While the Panther received knife and fork with a growl,
+ And concluded the banquet--]
+
+ `What IS the use of repeating all that stuff,' the Mock Turtle
+interrupted, `if you don't explain it as you go on? It's by far
+the most confusing thing I ever heard!'
+
+ `Yes, I think you'd better leave off,' said the Gryphon: and
+Alice was only too glad to do so.
+
+ `Shall we try another figure of the Lobster Quadrille?' the
+Gryphon went on. `Or would you like the Mock Turtle to sing you
+a song?'
+
+ `Oh, a song, please, if the Mock Turtle would be so kind,'
+Alice replied, so eagerly that the Gryphon said, in a rather
+offended tone, `Hm! No accounting for tastes! Sing her "Turtle
+Soup," will you, old fellow?'
+
+ The Mock Turtle sighed deeply, and began, in a voice sometimes
+choked with sobs, to sing this:--
+
+
+ `Beautiful Soup, so rich and green,
+ Waiting in a hot tureen!
+ Who for such dainties would not stoop?
+ Soup of the evening, beautiful Soup!
+ Soup of the evening, beautiful Soup!
+ Beau--ootiful Soo--oop!
+ Beau--ootiful Soo--oop!
+ Soo--oop of the e--e--evening,
+ Beautiful, beautiful Soup!
+
+ `Beautiful Soup! Who cares for fish,
+ Game, or any other dish?
+ Who would not give all else for two p
+ ennyworth only of beautiful Soup?
+ Pennyworth only of beautiful Soup?
+ Beau--ootiful Soo--oop!
+ Beau--ootiful Soo--oop!
+ Soo--oop of the e--e--evening,
+ Beautiful, beauti--FUL SOUP!'
+
+ `Chorus again!' cried the Gryphon, and the Mock Turtle had
+just begun to repeat it, when a cry of `The trial's beginning!'
+was heard in the distance.
+
+ `Come on!' cried the Gryphon, and, taking Alice by the hand,
+it hurried off, without waiting for the end of the song.
+
+ `What trial is it?' Alice panted as she ran; but the Gryphon
+only answered `Come on!' and ran the faster, while more and more
+faintly came, carried on the breeze that followed them, the
+melancholy words:--
+
+ `Soo--oop of the e--e--evening,
+ Beautiful, beautiful Soup!'
+
+
+
+ CHAPTER XI
+
+ Who Stole the Tarts?
+
+
+ The King and Queen of Hearts were seated on their throne when
+they arrived, with a great crowd assembled about them--all sorts
+of little birds and beasts, as well as the whole pack of cards:
+the Knave was standing before them, in chains, with a soldier on
+each side to guard him; and near the King was the White Rabbit,
+with a trumpet in one hand, and a scroll of parchment in the
+other. In the very middle of the court was a table, with a large
+dish of tarts upon it: they looked so good, that it made Alice
+quite hungry to look at them--`I wish they'd get the trial done,'
+she thought, `and hand round the refreshments!' But there seemed
+to be no chance of this, so she began looking at everything about
+her, to pass away the time.
+
+ Alice had never been in a court of justice before, but she had
+read about them in books, and she was quite pleased to find that
+she knew the name of nearly everything there. `That's the
+judge,' she said to herself, `because of his great wig.'
+
+ The judge, by the way, was the King; and as he wore his crown
+over the wig, (look at the frontispiece if you want to see how he
+did it,) he did not look at all comfortable, and it was certainly
+not becoming.
+
+ `And that's the jury-box,' thought Alice, `and those twelve
+creatures,' (she was obliged to say `creatures,' you see, because
+some of them were animals, and some were birds,) `I suppose they
+are the jurors.' She said this last word two or three times over
+to herself, being rather proud of it: for she thought, and
+rightly too, that very few little girls of her age knew the
+meaning of it at all. However, `jury-men' would have done just
+as well.
+
+ The twelve jurors were all writing very busily on slates.
+`What are they doing?' Alice whispered to the Gryphon. `They
+can't have anything to put down yet, before the trial's begun.'
+
+ `They're putting down their names,' the Gryphon whispered in
+reply, `for fear they should forget them before the end of the
+trial.'
+
+ `Stupid things!' Alice began in a loud, indignant voice, but
+she stopped hastily, for the White Rabbit cried out, `Silence in
+the court!' and the King put on his spectacles and looked
+anxiously round, to make out who was talking.
+
+ Alice could see, as well as if she were looking over their
+shoulders, that all the jurors were writing down `stupid things!'
+on their slates, and she could even make out that one of them
+didn't know how to spell `stupid,' and that he had to ask his
+neighbour to tell him. `A nice muddle their slates'll be in
+before the trial's over!' thought Alice.
+
+ One of the jurors had a pencil that squeaked. This of course,
+Alice could not stand, and she went round the court and got
+behind him, and very soon found an opportunity of taking it
+away. She did it so quickly that the poor little juror (it was
+Bill, the Lizard) could not make out at all what had become of
+it; so, after hunting all about for it, he was obliged to write
+with one finger for the rest of the day; and this was of very
+little use, as it left no mark on the slate.
+
+ `Herald, read the accusation!' said the King.
+
+ On this the White Rabbit blew three blasts on the trumpet, and
+then unrolled the parchment scroll, and read as follows:--
+
+ `The Queen of Hearts, she made some tarts,
+ All on a summer day:
+ The Knave of Hearts, he stole those tarts,
+ And took them quite away!'
+
+ `Consider your verdict,' the King said to the jury.
+
+ `Not yet, not yet!' the Rabbit hastily interrupted. `There's
+a great deal to come before that!'
+
+ `Call the first witness,' said the King; and the White Rabbit
+blew three blasts on the trumpet, and called out, `First
+witness!'
+
+ The first witness was the Hatter. He came in with a teacup in
+one hand and a piece of bread-and-butter in the other. `I beg
+pardon, your Majesty,' he began, `for bringing these in: but I
+hadn't quite finished my tea when I was sent for.'
+
+ `You ought to have finished,' said the King. `When did you
+begin?'
+
+ The Hatter looked at the March Hare, who had followed him into
+the court, arm-in-arm with the Dormouse. `Fourteenth of March, I
+think it was,' he said.
+
+ `Fifteenth,' said the March Hare.
+
+ `Sixteenth,' added the Dormouse.
+
+ `Write that down,' the King said to the jury, and the jury
+eagerly wrote down all three dates on their slates, and then
+added them up, and reduced the answer to shillings and pence.
+
+ `Take off your hat,' the King said to the Hatter.
+
+ `It isn't mine,' said the Hatter.
+
+ `Stolen!' the King exclaimed, turning to the jury, who
+instantly made a memorandum of the fact.
+
+ `I keep them to sell,' the Hatter added as an explanation;
+`I've none of my own. I'm a hatter.'
+
+ Here the Queen put on her spectacles, and began staring at the
+Hatter, who turned pale and fidgeted.
+
+ `Give your evidence,' said the King; `and don't be nervous, or
+I'll have you executed on the spot.'
+
+ This did not seem to encourage the witness at all: he kept
+shifting from one foot to the other, looking uneasily at the
+Queen, and in his confusion he bit a large piece out of his
+teacup instead of the bread-and-butter.
+
+ Just at this moment Alice felt a very curious sensation, which
+puzzled her a good deal until she made out what it was: she was
+beginning to grow larger again, and she thought at first she
+would get up and leave the court; but on second thoughts she
+decided to remain where she was as long as there was room for
+her.
+
+ `I wish you wouldn't squeeze so.' said the Dormouse, who was
+sitting next to her. `I can hardly breathe.'
+
+ `I can't help it,' said Alice very meekly: `I'm growing.'
+
+ `You've no right to grow here,' said the Dormouse.
+
+ `Don't talk nonsense,' said Alice more boldly: `you know
+you're growing too.'
+
+ `Yes, but I grow at a reasonable pace,' said the Dormouse:
+`not in that ridiculous fashion.' And he got up very sulkily
+and crossed over to the other side of the court.
+
+ All this time the Queen had never left off staring at the
+Hatter, and, just as the Dormouse crossed the court, she said to
+one of the officers of the court, `Bring me the list of the
+singers in the last concert!' on which the wretched Hatter
+trembled so, that he shook both his shoes off.
+
+ `Give your evidence,' the King repeated angrily, `or I'll have
+you executed, whether you're nervous or not.'
+
+ `I'm a poor man, your Majesty,' the Hatter began, in a
+trembling voice, `--and I hadn't begun my tea--not above a week
+or so--and what with the bread-and-butter getting so thin--and
+the twinkling of the tea--'
+
+ `The twinkling of the what?' said the King.
+
+ `It began with the tea,' the Hatter replied.
+
+ `Of course twinkling begins with a T!' said the King sharply.
+`Do you take me for a dunce? Go on!'
+
+ `I'm a poor man,' the Hatter went on, `and most things
+twinkled after that--only the March Hare said--'
+
+ `I didn't!' the March Hare interrupted in a great hurry.
+
+ `You did!' said the Hatter.
+
+ `I deny it!' said the March Hare.
+
+ `He denies it,' said the King: `leave out that part.'
+
+ `Well, at any rate, the Dormouse said--' the Hatter went on,
+looking anxiously round to see if he would deny it too: but the
+Dormouse denied nothing, being fast asleep.
+
+ `After that,' continued the Hatter, `I cut some more bread-
+and-butter--'
+
+ `But what did the Dormouse say?' one of the jury asked.
+
+ `That I can't remember,' said the Hatter.
+
+ `You MUST remember,' remarked the King, `or I'll have you
+executed.'
+
+ The miserable Hatter dropped his teacup and bread-and-butter,
+and went down on one knee. `I'm a poor man, your Majesty,' he
+began.
+
+ `You're a very poor speaker,' said the King.
+
+ Here one of the guinea-pigs cheered, and was immediately
+suppressed by the officers of the court. (As that is rather a
+hard word, I will just explain to you how it was done. They had
+a large canvas bag, which tied up at the mouth with strings:
+into this they slipped the guinea-pig, head first, and then sat
+upon it.)
+
+ `I'm glad I've seen that done,' thought Alice. `I've so often
+read in the newspapers, at the end of trials, "There was some
+attempts at applause, which was immediately suppressed by the
+officers of the court," and I never understood what it meant
+till now.'
+
+ `If that's all you know about it, you may stand down,'
+continued the King.
+
+ `I can't go no lower,' said the Hatter: `I'm on the floor, as
+it is.'
+
+ `Then you may SIT down,' the King replied.
+
+ Here the other guinea-pig cheered, and was suppressed.
+
+ `Come, that finished the guinea-pigs!' thought Alice. `Now we
+shall get on better.'
+
+ `I'd rather finish my tea,' said the Hatter, with an anxious
+look at the Queen, who was reading the list of singers.
+
+ `You may go,' said the King, and the Hatter hurriedly left the
+court, without even waiting to put his shoes on.
+
+ `--and just take his head off outside,' the Queen added to one
+of the officers: but the Hatter was out of sight before the
+officer could get to the door.
+
+ `Call the next witness!' said the King.
+
+ The next witness was the Duchess's cook. She carried the
+pepper-box in her hand, and Alice guessed who it was, even before
+she got into the court, by the way the people near the door began
+sneezing all at once.
+
+ `Give your evidence,' said the King.
+
+ `Shan't,' said the cook.
+
+ The King looked anxiously at the White Rabbit, who said in a
+low voice, `Your Majesty must cross-examine THIS witness.'
+
+ `Well, if I must, I must,' the King said, with a melancholy
+air, and, after folding his arms and frowning at the cook till
+his eyes were nearly out of sight, he said in a deep voice, `What
+are tarts made of?'
+
+ `Pepper, mostly,' said the cook.
+
+ `Treacle,' said a sleepy voice behind her.
+
+ `Collar that Dormouse,' the Queen shrieked out. `Behead that
+Dormouse! Turn that Dormouse out of court! Suppress him! Pinch
+him! Off with his whiskers!'
+
+ For some minutes the whole court was in confusion, getting the
+Dormouse turned out, and, by the time they had settled down
+again, the cook had disappeared.
+
+ `Never mind!' said the King, with an air of great relief.
+`Call the next witness.' And he added in an undertone to the
+Queen, `Really, my dear, YOU must cross-examine the next witness.
+It quite makes my forehead ache!'
+
+ Alice watched the White Rabbit as he fumbled over the list,
+feeling very curious to see what the next witness would be like,
+`--for they haven't got much evidence YET,' she said to herself.
+Imagine her surprise, when the White Rabbit read out, at the top
+of his shrill little voice, the name `Alice!'
+
+
+
+ CHAPTER XII
+
+ Alice's Evidence
+
+
+ `Here!' cried Alice, quite forgetting in the flurry of the
+moment how large she had grown in the last few minutes, and she
+jumped up in such a hurry that she tipped over the jury-box with
+the edge of her skirt, upsetting all the jurymen on to the heads
+of the crowd below, and there they lay sprawling about, reminding
+her very much of a globe of goldfish she had accidentally upset
+the week before.
+
+ `Oh, I BEG your pardon!' she exclaimed in a tone of great
+dismay, and began picking them up again as quickly as she could,
+for the accident of the goldfish kept running in her head, and
+she had a vague sort of idea that they must be collected at once
+and put back into the jury-box, or they would die.
+
+ `The trial cannot proceed,' said the King in a very grave
+voice, `until all the jurymen are back in their proper places--
+ALL,' he repeated with great emphasis, looking hard at Alice as
+he said do.
+
+ Alice looked at the jury-box, and saw that, in her haste, she
+had put the Lizard in head downwards, and the poor little thing
+was waving its tail about in a melancholy way, being quite unable
+to move. She soon got it out again, and put it right; `not that
+it signifies much,' she said to herself; `I should think it
+would be QUITE as much use in the trial one way up as the other.'
+
+ As soon as the jury had a little recovered from the shock of
+being upset, and their slates and pencils had been found and
+handed back to them, they set to work very diligently to write
+out a history of the accident, all except the Lizard, who seemed
+too much overcome to do anything but sit with its mouth open,
+gazing up into the roof of the court.
+
+ `What do you know about this business?' the King said to
+Alice.
+
+ `Nothing,' said Alice.
+
+ `Nothing WHATEVER?' persisted the King.
+
+ `Nothing whatever,' said Alice.
+
+ `That's very important,' the King said, turning to the jury.
+They were just beginning to write this down on their slates, when
+the White Rabbit interrupted: `UNimportant, your Majesty means,
+of course,' he said in a very respectful tone, but frowning and
+making faces at him as he spoke.
+
+ `UNimportant, of course, I meant,' the King hastily said, and
+went on to himself in an undertone, `important--unimportant--
+unimportant--important--' as if he were trying which word
+sounded best.
+
+ Some of the jury wrote it down `important,' and some
+`unimportant.' Alice could see this, as she was near enough to
+look over their slates; `but it doesn't matter a bit,' she
+thought to herself.
+
+ At this moment the King, who had been for some time busily
+writing in his note-book, cackled out `Silence!' and read out
+from his book, `Rule Forty-two. ALL PERSONS MORE THAN A MILE
+HIGH TO LEAVE THE COURT.'
+
+ Everybody looked at Alice.
+
+ `I'M not a mile high,' said Alice.
+
+ `You are,' said the King.
+
+ `Nearly two miles high,' added the Queen.
+
+ `Well, I shan't go, at any rate,' said Alice: `besides,
+that's not a regular rule: you invented it just now.'
+
+ `It's the oldest rule in the book,' said the King.
+
+ `Then it ought to be Number One,' said Alice.
+
+ The King turned pale, and shut his note-book hastily.
+`Consider your verdict,' he said to the jury, in a low, trembling
+voice.
+
+ `There's more evidence to come yet, please your Majesty,' said
+the White Rabbit, jumping up in a great hurry; `this paper has
+just been picked up.'
+
+ `What's in it?' said the Queen.
+
+ `I haven't opened it yet,' said the White Rabbit, `but it seems
+to be a letter, written by the prisoner to--to somebody.'
+
+ `It must have been that,' said the King, `unless it was
+written to nobody, which isn't usual, you know.'
+
+ `Who is it directed to?' said one of the jurymen.
+
+ `It isn't directed at all,' said the White Rabbit; `in fact,
+there's nothing written on the OUTSIDE.' He unfolded the paper
+as he spoke, and added `It isn't a letter, after all: it's a set
+of verses.'
+
+ `Are they in the prisoner's handwriting?' asked another of
+they jurymen.
+
+ `No, they're not,' said the White Rabbit, `and that's the
+queerest thing about it.' (The jury all looked puzzled.)
+
+ `He must have imitated somebody else's hand,' said the King.
+(The jury all brightened up again.)
+
+ `Please your Majesty,' said the Knave, `I didn't write it, and
+they can't prove I did: there's no name signed at the end.'
+
+ `If you didn't sign it,' said the King, `that only makes the
+matter worse. You MUST have meant some mischief, or else you'd
+have signed your name like an honest man.'
+
+ There was a general clapping of hands at this: it was the
+first really clever thing the King had said that day.
+
+ `That PROVES his guilt,' said the Queen.
+
+ `It proves nothing of the sort!' said Alice. `Why, you don't
+even know what they're about!'
+
+ `Read them,' said the King.
+
+ The White Rabbit put on his spectacles. `Where shall I begin,
+please your Majesty?' he asked.
+
+ `Begin at the beginning,' the King said gravely, `and go on
+till you come to the end: then stop.'
+
+ These were the verses the White Rabbit read:--
+
+ `They told me you had been to her,
+ And mentioned me to him:
+ She gave me a good character,
+ But said I could not swim.
+
+ He sent them word I had not gone
+ (We know it to be true):
+ If she should push the matter on,
+ What would become of you?
+
+ I gave her one, they gave him two,
+ You gave us three or more;
+ They all returned from him to you,
+ Though they were mine before.
+
+ If I or she should chance to be
+ Involved in this affair,
+ He trusts to you to set them free,
+ Exactly as we were.
+
+ My notion was that you had been
+ (Before she had this fit)
+ An obstacle that came between
+ Him, and ourselves, and it.
+
+ Don't let him know she liked them best,
+ For this must ever be
+ A secret, kept from all the rest,
+ Between yourself and me.'
+
+ `That's the most important piece of evidence we've heard yet,'
+said the King, rubbing his hands; `so now let the jury--'
+
+ `If any one of them can explain it,' said Alice, (she had
+grown so large in the last few minutes that she wasn't a bit
+afraid of interrupting him,) `I'll give him sixpence. _I_ don't
+believe there's an atom of meaning in it.'
+
+ The jury all wrote down on their slates, `SHE doesn't believe
+there's an atom of meaning in it,' but none of them attempted to
+explain the paper.
+
+ `If there's no meaning in it,' said the King, `that saves a
+world of trouble, you know, as we needn't try to find any. And
+yet I don't know,' he went on, spreading out the verses on his
+knee, and looking at them with one eye; `I seem to see some
+meaning in them, after all. "--SAID I COULD NOT SWIM--" you
+can't swim, can you?' he added, turning to the Knave.
+
+ The Knave shook his head sadly. `Do I look like it?' he said.
+(Which he certainly did NOT, being made entirely of cardboard.)
+
+ `All right, so far,' said the King, and he went on muttering
+over the verses to himself: `"WE KNOW IT TO BE TRUE--" that's
+the jury, of course-- "I GAVE HER ONE, THEY GAVE HIM TWO--" why,
+that must be what he did with the tarts, you know--'
+
+ `But, it goes on "THEY ALL RETURNED FROM HIM TO YOU,"' said
+Alice.
+
+ `Why, there they are!' said the King triumphantly, pointing to
+the tarts on the table. `Nothing can be clearer than THAT.
+Then again--"BEFORE SHE HAD THIS FIT--" you never had fits, my
+dear, I think?' he said to the Queen.
+
+ `Never!' said the Queen furiously, throwing an inkstand at the
+Lizard as she spoke. (The unfortunate little Bill had left off
+writing on his slate with one finger, as he found it made no
+mark; but he now hastily began again, using the ink, that was
+trickling down his face, as long as it lasted.)
+
+ `Then the words don't FIT you,' said the King, looking round
+the court with a smile. There was a dead silence.
+
+ `It's a pun!' the King added in an offended tone, and
+everybody laughed, `Let the jury consider their verdict,' the
+King said, for about the twentieth time that day.
+
+ `No, no!' said the Queen. `Sentence first--verdict afterwards.'
+
+ `Stuff and nonsense!' said Alice loudly. `The idea of having
+the sentence first!'
+
+ `Hold your tongue!' said the Queen, turning purple.
+
+ `I won't!' said Alice.
+
+ `Off with her head!' the Queen shouted at the top of her voice.
+Nobody moved.
+
+ `Who cares for you?' said Alice, (she had grown to her full
+size by this time.) `You're nothing but a pack of cards!'
+
+ At this the whole pack rose up into the air, and came flying
+down upon her: she gave a little scream, half of fright and half
+of anger, and tried to beat them off, and found herself lying on
+the bank, with her head in the lap of her sister, who was gently
+brushing away some dead leaves that had fluttered down from the
+trees upon her face.
+
+ `Wake up, Alice dear!' said her sister; `Why, what a long
+sleep you've had!'
+
+ `Oh, I've had such a curious dream!' said Alice, and she told
+her sister, as well as she could remember them, all these strange
+Adventures of hers that you have just been reading about; and
+when she had finished, her sister kissed her, and said, `It WAS a
+curious dream, dear, certainly: but now run in to your tea; it's
+getting late.' So Alice got up and ran off, thinking while she
+ran, as well she might, what a wonderful dream it had been.
+
+ But her sister sat still just as she left her, leaning her
+head on her hand, watching the setting sun, and thinking of
+little Alice and all her wonderful Adventures, till she too began
+dreaming after a fashion, and this was her dream:--
+
+ First, she dreamed of little Alice herself, and once again the
+tiny hands were clasped upon her knee, and the bright eager eyes
+were looking up into hers--she could hear the very tones of her
+voice, and see that queer little toss of her head to keep back
+the wandering hair that WOULD always get into her eyes--and
+still as she listened, or seemed to listen, the whole place
+around her became alive the strange creatures of her little
+sister's dream.
+
+ The long grass rustled at her feet as the White Rabbit hurried
+by--the frightened Mouse splashed his way through the
+neighbouring pool--she could hear the rattle of the teacups as
+the March Hare and his friends shared their never-ending meal,
+and the shrill voice of the Queen ordering off her unfortunate
+guests to execution--once more the pig-baby was sneezing on the
+Duchess's knee, while plates and dishes crashed around it--once
+more the shriek of the Gryphon, the squeaking of the Lizard's
+slate-pencil, and the choking of the suppressed guinea-pigs,
+filled the air, mixed up with the distant sobs of the miserable
+Mock Turtle.
+
+ So she sat on, with closed eyes, and half believed herself in
+Wonderland, though she knew she had but to open them again, and
+all would change to dull reality--the grass would be only
+rustling in the wind, and the pool rippling to the waving of the
+reeds--the rattling teacups would change to tinkling sheep-
+bells, and the Queen's shrill cries to the voice of the shepherd
+boy--and the sneeze of the baby, the shriek of the Gryphon, and
+all thy other queer noises, would change (she knew) to the
+confused clamour of the busy farm-yard--while the lowing of the
+cattle in the distance would take the place of the Mock Turtle's
+heavy sobs.
+
+ Lastly, she pictured to herself how this same little sister of
+hers would, in the after-time, be herself a grown woman; and how
+she would keep, through all her riper years, the simple and
+loving heart of her childhood: and how she would gather about
+her other little children, and make THEIR eyes bright and eager
+with many a strange tale, perhaps even with the dream of
+Wonderland of long ago: and how she would feel with all their
+simple sorrows, and find a pleasure in all their simple joys,
+remembering her own child-life, and the happy summer days.
+
+ THE END
+ \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/alice29.txt.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/alice29.txt.compressed
new file mode 100644
index 000000000..37d86e253
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/alice29.txt.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/asyoulik.txt b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/asyoulik.txt
new file mode 100644
index 000000000..88dc7b60f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/asyoulik.txt
@@ -0,0 +1,4122 @@
+ AS YOU LIKE IT
+
+
+ DRAMATIS PERSONAE
+
+
+DUKE SENIOR living in banishment.
+
+DUKE FREDERICK his brother, an usurper of his dominions.
+
+
+AMIENS |
+ | lords attending on the banished duke.
+JAQUES |
+
+
+LE BEAU a courtier attending upon Frederick.
+
+CHARLES wrestler to Frederick.
+
+
+OLIVER |
+ |
+JAQUES (JAQUES DE BOYS:) | sons of Sir Rowland de Boys.
+ |
+ORLANDO |
+
+
+ADAM |
+ | servants to Oliver.
+DENNIS |
+
+
+TOUCHSTONE a clown.
+
+SIR OLIVER MARTEXT a vicar.
+
+
+CORIN |
+ | shepherds.
+SILVIUS |
+
+
+WILLIAM a country fellow in love with Audrey.
+
+ A person representing HYMEN. (HYMEN:)
+
+ROSALIND daughter to the banished duke.
+
+CELIA daughter to Frederick.
+
+PHEBE a shepherdess.
+
+AUDREY a country wench.
+
+ Lords, pages, and attendants, &c.
+ (Forester:)
+ (A Lord:)
+ (First Lord:)
+ (Second Lord:)
+ (First Page:)
+ (Second Page:)
+
+
+SCENE Oliver's house; Duke Frederick's court; and the
+ Forest of Arden.
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT I
+
+
+
+SCENE I Orchard of Oliver's house.
+
+
+ [Enter ORLANDO and ADAM]
+
+ORLANDO As I remember, Adam, it was upon this fashion
+ bequeathed me by will but poor a thousand crowns,
+ and, as thou sayest, charged my brother, on his
+ blessing, to breed me well: and there begins my
+ sadness. My brother Jaques he keeps at school, and
+ report speaks goldenly of his profit: for my part,
+ he keeps me rustically at home, or, to speak more
+ properly, stays me here at home unkept; for call you
+ that keeping for a gentleman of my birth, that
+ differs not from the stalling of an ox? His horses
+ are bred better; for, besides that they are fair
+ with their feeding, they are taught their manage,
+ and to that end riders dearly hired: but I, his
+ brother, gain nothing under him but growth; for the
+ which his animals on his dunghills are as much
+ bound to him as I. Besides this nothing that he so
+ plentifully gives me, the something that nature gave
+ me his countenance seems to take from me: he lets
+ me feed with his hinds, bars me the place of a
+ brother, and, as much as in him lies, mines my
+ gentility with my education. This is it, Adam, that
+ grieves me; and the spirit of my father, which I
+ think is within me, begins to mutiny against this
+ servitude: I will no longer endure it, though yet I
+ know no wise remedy how to avoid it.
+
+ADAM Yonder comes my master, your brother.
+
+ORLANDO Go apart, Adam, and thou shalt hear how he will
+ shake me up.
+
+ [Enter OLIVER]
+
+OLIVER Now, sir! what make you here?
+
+ORLANDO Nothing: I am not taught to make any thing.
+
+OLIVER What mar you then, sir?
+
+ORLANDO Marry, sir, I am helping you to mar that which God
+ made, a poor unworthy brother of yours, with idleness.
+
+OLIVER Marry, sir, be better employed, and be naught awhile.
+
+ORLANDO Shall I keep your hogs and eat husks with them?
+ What prodigal portion have I spent, that I should
+ come to such penury?
+
+OLIVER Know you where your are, sir?
+
+ORLANDO O, sir, very well; here in your orchard.
+
+OLIVER Know you before whom, sir?
+
+ORLANDO Ay, better than him I am before knows me. I know
+ you are my eldest brother; and, in the gentle
+ condition of blood, you should so know me. The
+ courtesy of nations allows you my better, in that
+ you are the first-born; but the same tradition
+ takes not away my blood, were there twenty brothers
+ betwixt us: I have as much of my father in me as
+ you; albeit, I confess, your coming before me is
+ nearer to his reverence.
+
+OLIVER What, boy!
+
+ORLANDO Come, come, elder brother, you are too young in this.
+
+OLIVER Wilt thou lay hands on me, villain?
+
+ORLANDO I am no villain; I am the youngest son of Sir
+ Rowland de Boys; he was my father, and he is thrice
+ a villain that says such a father begot villains.
+ Wert thou not my brother, I would not take this hand
+ from thy throat till this other had pulled out thy
+ tongue for saying so: thou hast railed on thyself.
+
+ADAM Sweet masters, be patient: for your father's
+ remembrance, be at accord.
+
+OLIVER Let me go, I say.
+
+ORLANDO I will not, till I please: you shall hear me. My
+ father charged you in his will to give me good
+ education: you have trained me like a peasant,
+ obscuring and hiding from me all gentleman-like
+ qualities. The spirit of my father grows strong in
+ me, and I will no longer endure it: therefore allow
+ me such exercises as may become a gentleman, or
+ give me the poor allottery my father left me by
+ testament; with that I will go buy my fortunes.
+
+OLIVER And what wilt thou do? beg, when that is spent?
+ Well, sir, get you in: I will not long be troubled
+ with you; you shall have some part of your will: I
+ pray you, leave me.
+
+ORLANDO I will no further offend you than becomes me for my good.
+
+OLIVER Get you with him, you old dog.
+
+ADAM Is 'old dog' my reward? Most true, I have lost my
+ teeth in your service. God be with my old master!
+ he would not have spoke such a word.
+
+ [Exeunt ORLANDO and ADAM]
+
+OLIVER Is it even so? begin you to grow upon me? I will
+ physic your rankness, and yet give no thousand
+ crowns neither. Holla, Dennis!
+
+ [Enter DENNIS]
+
+DENNIS Calls your worship?
+
+OLIVER Was not Charles, the duke's wrestler, here to speak with me?
+
+DENNIS So please you, he is here at the door and importunes
+ access to you.
+
+OLIVER Call him in.
+
+ [Exit DENNIS]
+
+ 'Twill be a good way; and to-morrow the wrestling is.
+
+ [Enter CHARLES]
+
+CHARLES Good morrow to your worship.
+
+OLIVER Good Monsieur Charles, what's the new news at the
+ new court?
+
+CHARLES There's no news at the court, sir, but the old news:
+ that is, the old duke is banished by his younger
+ brother the new duke; and three or four loving lords
+ have put themselves into voluntary exile with him,
+ whose lands and revenues enrich the new duke;
+ therefore he gives them good leave to wander.
+
+OLIVER Can you tell if Rosalind, the duke's daughter, be
+ banished with her father?
+
+CHARLES O, no; for the duke's daughter, her cousin, so loves
+ her, being ever from their cradles bred together,
+ that she would have followed her exile, or have died
+ to stay behind her. She is at the court, and no
+ less beloved of her uncle than his own daughter; and
+ never two ladies loved as they do.
+
+OLIVER Where will the old duke live?
+
+CHARLES They say he is already in the forest of Arden, and
+ a many merry men with him; and there they live like
+ the old Robin Hood of England: they say many young
+ gentlemen flock to him every day, and fleet the time
+ carelessly, as they did in the golden world.
+
+OLIVER What, you wrestle to-morrow before the new duke?
+
+CHARLES Marry, do I, sir; and I came to acquaint you with a
+ matter. I am given, sir, secretly to understand
+ that your younger brother Orlando hath a disposition
+ to come in disguised against me to try a fall.
+ To-morrow, sir, I wrestle for my credit; and he that
+ escapes me without some broken limb shall acquit him
+ well. Your brother is but young and tender; and,
+ for your love, I would be loath to foil him, as I
+ must, for my own honour, if he come in: therefore,
+ out of my love to you, I came hither to acquaint you
+ withal, that either you might stay him from his
+ intendment or brook such disgrace well as he shall
+ run into, in that it is a thing of his own search
+ and altogether against my will.
+
+OLIVER Charles, I thank thee for thy love to me, which
+ thou shalt find I will most kindly requite. I had
+ myself notice of my brother's purpose herein and
+ have by underhand means laboured to dissuade him from
+ it, but he is resolute. I'll tell thee, Charles:
+ it is the stubbornest young fellow of France, full
+ of ambition, an envious emulator of every man's
+ good parts, a secret and villanous contriver against
+ me his natural brother: therefore use thy
+ discretion; I had as lief thou didst break his neck
+ as his finger. And thou wert best look to't; for if
+ thou dost him any slight disgrace or if he do not
+ mightily grace himself on thee, he will practise
+ against thee by poison, entrap thee by some
+ treacherous device and never leave thee till he
+ hath ta'en thy life by some indirect means or other;
+ for, I assure thee, and almost with tears I speak
+ it, there is not one so young and so villanous this
+ day living. I speak but brotherly of him; but
+ should I anatomize him to thee as he is, I must
+ blush and weep and thou must look pale and wonder.
+
+CHARLES I am heartily glad I came hither to you. If he come
+ to-morrow, I'll give him his payment: if ever he go
+ alone again, I'll never wrestle for prize more: and
+ so God keep your worship!
+
+OLIVER Farewell, good Charles.
+
+ [Exit CHARLES]
+
+ Now will I stir this gamester: I hope I shall see
+ an end of him; for my soul, yet I know not why,
+ hates nothing more than he. Yet he's gentle, never
+ schooled and yet learned, full of noble device, of
+ all sorts enchantingly beloved, and indeed so much
+ in the heart of the world, and especially of my own
+ people, who best know him, that I am altogether
+ misprised: but it shall not be so long; this
+ wrestler shall clear all: nothing remains but that
+ I kindle the boy thither; which now I'll go about.
+
+ [Exit]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT I
+
+
+
+SCENE II Lawn before the Duke's palace.
+
+
+ [Enter CELIA and ROSALIND]
+
+CELIA I pray thee, Rosalind, sweet my coz, be merry.
+
+ROSALIND Dear Celia, I show more mirth than I am mistress of;
+ and would you yet I were merrier? Unless you could
+ teach me to forget a banished father, you must not
+ learn me how to remember any extraordinary pleasure.
+
+CELIA Herein I see thou lovest me not with the full weight
+ that I love thee. If my uncle, thy banished father,
+ had banished thy uncle, the duke my father, so thou
+ hadst been still with me, I could have taught my
+ love to take thy father for mine: so wouldst thou,
+ if the truth of thy love to me were so righteously
+ tempered as mine is to thee.
+
+ROSALIND Well, I will forget the condition of my estate, to
+ rejoice in yours.
+
+CELIA You know my father hath no child but I, nor none is
+ like to have: and, truly, when he dies, thou shalt
+ be his heir, for what he hath taken away from thy
+ father perforce, I will render thee again in
+ affection; by mine honour, I will; and when I break
+ that oath, let me turn monster: therefore, my
+ sweet Rose, my dear Rose, be merry.
+
+ROSALIND From henceforth I will, coz, and devise sports. Let
+ me see; what think you of falling in love?
+
+CELIA Marry, I prithee, do, to make sport withal: but
+ love no man in good earnest; nor no further in sport
+ neither than with safety of a pure blush thou mayst
+ in honour come off again.
+
+ROSALIND What shall be our sport, then?
+
+CELIA Let us sit and mock the good housewife Fortune from
+ her wheel, that her gifts may henceforth be bestowed equally.
+
+ROSALIND I would we could do so, for her benefits are
+ mightily misplaced, and the bountiful blind woman
+ doth most mistake in her gifts to women.
+
+CELIA 'Tis true; for those that she makes fair she scarce
+ makes honest, and those that she makes honest she
+ makes very ill-favouredly.
+
+ROSALIND Nay, now thou goest from Fortune's office to
+ Nature's: Fortune reigns in gifts of the world,
+ not in the lineaments of Nature.
+
+ [Enter TOUCHSTONE]
+
+CELIA No? when Nature hath made a fair creature, may she
+ not by Fortune fall into the fire? Though Nature
+ hath given us wit to flout at Fortune, hath not
+ Fortune sent in this fool to cut off the argument?
+
+ROSALIND Indeed, there is Fortune too hard for Nature, when
+ Fortune makes Nature's natural the cutter-off of
+ Nature's wit.
+
+CELIA Peradventure this is not Fortune's work neither, but
+ Nature's; who perceiveth our natural wits too dull
+ to reason of such goddesses and hath sent this
+ natural for our whetstone; for always the dulness of
+ the fool is the whetstone of the wits. How now,
+ wit! whither wander you?
+
+TOUCHSTONE Mistress, you must come away to your father.
+
+CELIA Were you made the messenger?
+
+TOUCHSTONE No, by mine honour, but I was bid to come for you.
+
+ROSALIND Where learned you that oath, fool?
+
+TOUCHSTONE Of a certain knight that swore by his honour they
+ were good pancakes and swore by his honour the
+ mustard was naught: now I'll stand to it, the
+ pancakes were naught and the mustard was good, and
+ yet was not the knight forsworn.
+
+CELIA How prove you that, in the great heap of your
+ knowledge?
+
+ROSALIND Ay, marry, now unmuzzle your wisdom.
+
+TOUCHSTONE Stand you both forth now: stroke your chins, and
+ swear by your beards that I am a knave.
+
+CELIA By our beards, if we had them, thou art.
+
+TOUCHSTONE By my knavery, if I had it, then I were; but if you
+ swear by that that is not, you are not forsworn: no
+ more was this knight swearing by his honour, for he
+ never had any; or if he had, he had sworn it away
+ before ever he saw those pancakes or that mustard.
+
+CELIA Prithee, who is't that thou meanest?
+
+TOUCHSTONE One that old Frederick, your father, loves.
+
+CELIA My father's love is enough to honour him: enough!
+ speak no more of him; you'll be whipped for taxation
+ one of these days.
+
+TOUCHSTONE The more pity, that fools may not speak wisely what
+ wise men do foolishly.
+
+CELIA By my troth, thou sayest true; for since the little
+ wit that fools have was silenced, the little foolery
+ that wise men have makes a great show. Here comes
+ Monsieur Le Beau.
+
+ROSALIND With his mouth full of news.
+
+CELIA Which he will put on us, as pigeons feed their young.
+
+ROSALIND Then shall we be news-crammed.
+
+CELIA All the better; we shall be the more marketable.
+
+ [Enter LE BEAU]
+
+ Bon jour, Monsieur Le Beau: what's the news?
+
+LE BEAU Fair princess, you have lost much good sport.
+
+CELIA Sport! of what colour?
+
+LE BEAU What colour, madam! how shall I answer you?
+
+ROSALIND As wit and fortune will.
+
+TOUCHSTONE Or as the Destinies decree.
+
+CELIA Well said: that was laid on with a trowel.
+
+TOUCHSTONE Nay, if I keep not my rank,--
+
+ROSALIND Thou losest thy old smell.
+
+LE BEAU You amaze me, ladies: I would have told you of good
+ wrestling, which you have lost the sight of.
+
+ROSALIND You tell us the manner of the wrestling.
+
+LE BEAU I will tell you the beginning; and, if it please
+ your ladyships, you may see the end; for the best is
+ yet to do; and here, where you are, they are coming
+ to perform it.
+
+CELIA Well, the beginning, that is dead and buried.
+
+LE BEAU There comes an old man and his three sons,--
+
+CELIA I could match this beginning with an old tale.
+
+LE BEAU Three proper young men, of excellent growth and presence.
+
+ROSALIND With bills on their necks, 'Be it known unto all men
+ by these presents.'
+
+LE BEAU The eldest of the three wrestled with Charles, the
+ duke's wrestler; which Charles in a moment threw him
+ and broke three of his ribs, that there is little
+ hope of life in him: so he served the second, and
+ so the third. Yonder they lie; the poor old man,
+ their father, making such pitiful dole over them
+ that all the beholders take his part with weeping.
+
+ROSALIND Alas!
+
+TOUCHSTONE But what is the sport, monsieur, that the ladies
+ have lost?
+
+LE BEAU Why, this that I speak of.
+
+TOUCHSTONE Thus men may grow wiser every day: it is the first
+ time that ever I heard breaking of ribs was sport
+ for ladies.
+
+CELIA Or I, I promise thee.
+
+ROSALIND But is there any else longs to see this broken music
+ in his sides? is there yet another dotes upon
+ rib-breaking? Shall we see this wrestling, cousin?
+
+LE BEAU You must, if you stay here; for here is the place
+ appointed for the wrestling, and they are ready to
+ perform it.
+
+CELIA Yonder, sure, they are coming: let us now stay and see it.
+
+ [Flourish. Enter DUKE FREDERICK, Lords, ORLANDO,
+ CHARLES, and Attendants]
+
+DUKE FREDERICK Come on: since the youth will not be entreated, his
+ own peril on his forwardness.
+
+ROSALIND Is yonder the man?
+
+LE BEAU Even he, madam.
+
+CELIA Alas, he is too young! yet he looks successfully.
+
+DUKE FREDERICK How now, daughter and cousin! are you crept hither
+ to see the wrestling?
+
+ROSALIND Ay, my liege, so please you give us leave.
+
+DUKE FREDERICK You will take little delight in it, I can tell you;
+ there is such odds in the man. In pity of the
+ challenger's youth I would fain dissuade him, but he
+ will not be entreated. Speak to him, ladies; see if
+ you can move him.
+
+CELIA Call him hither, good Monsieur Le Beau.
+
+DUKE FREDERICK Do so: I'll not be by.
+
+LE BEAU Monsieur the challenger, the princesses call for you.
+
+ORLANDO I attend them with all respect and duty.
+
+ROSALIND Young man, have you challenged Charles the wrestler?
+
+ORLANDO No, fair princess; he is the general challenger: I
+ come but in, as others do, to try with him the
+ strength of my youth.
+
+CELIA Young gentleman, your spirits are too bold for your
+ years. You have seen cruel proof of this man's
+ strength: if you saw yourself with your eyes or
+ knew yourself with your judgment, the fear of your
+ adventure would counsel you to a more equal
+ enterprise. We pray you, for your own sake, to
+ embrace your own safety and give over this attempt.
+
+ROSALIND Do, young sir; your reputation shall not therefore
+ be misprised: we will make it our suit to the duke
+ that the wrestling might not go forward.
+
+ORLANDO I beseech you, punish me not with your hard
+ thoughts; wherein I confess me much guilty, to deny
+ so fair and excellent ladies any thing. But let
+ your fair eyes and gentle wishes go with me to my
+ trial: wherein if I be foiled, there is but one
+ shamed that was never gracious; if killed, but one
+ dead that was willing to be so: I shall do my
+ friends no wrong, for I have none to lament me, the
+ world no injury, for in it I have nothing; only in
+ the world I fill up a place, which may be better
+ supplied when I have made it empty.
+
+ROSALIND The little strength that I have, I would it were with you.
+
+CELIA And mine, to eke out hers.
+
+ROSALIND Fare you well: pray heaven I be deceived in you!
+
+CELIA Your heart's desires be with you!
+
+CHARLES Come, where is this young gallant that is so
+ desirous to lie with his mother earth?
+
+ORLANDO Ready, sir; but his will hath in it a more modest working.
+
+DUKE FREDERICK You shall try but one fall.
+
+CHARLES No, I warrant your grace, you shall not entreat him
+ to a second, that have so mightily persuaded him
+ from a first.
+
+ORLANDO An you mean to mock me after, you should not have
+ mocked me before: but come your ways.
+
+ROSALIND Now Hercules be thy speed, young man!
+
+CELIA I would I were invisible, to catch the strong
+ fellow by the leg.
+
+ [They wrestle]
+
+ROSALIND O excellent young man!
+
+CELIA If I had a thunderbolt in mine eye, I can tell who
+ should down.
+
+ [Shout. CHARLES is thrown]
+
+DUKE FREDERICK No more, no more.
+
+ORLANDO Yes, I beseech your grace: I am not yet well breathed.
+
+DUKE FREDERICK How dost thou, Charles?
+
+LE BEAU He cannot speak, my lord.
+
+DUKE FREDERICK Bear him away. What is thy name, young man?
+
+ORLANDO Orlando, my liege; the youngest son of Sir Rowland de Boys.
+
+DUKE FREDERICK I would thou hadst been son to some man else:
+ The world esteem'd thy father honourable,
+ But I did find him still mine enemy:
+ Thou shouldst have better pleased me with this deed,
+ Hadst thou descended from another house.
+ But fare thee well; thou art a gallant youth:
+ I would thou hadst told me of another father.
+
+ [Exeunt DUKE FREDERICK, train, and LE BEAU]
+
+CELIA Were I my father, coz, would I do this?
+
+ORLANDO I am more proud to be Sir Rowland's son,
+ His youngest son; and would not change that calling,
+ To be adopted heir to Frederick.
+
+ROSALIND My father loved Sir Rowland as his soul,
+ And all the world was of my father's mind:
+ Had I before known this young man his son,
+ I should have given him tears unto entreaties,
+ Ere he should thus have ventured.
+
+CELIA Gentle cousin,
+ Let us go thank him and encourage him:
+ My father's rough and envious disposition
+ Sticks me at heart. Sir, you have well deserved:
+ If you do keep your promises in love
+ But justly, as you have exceeded all promise,
+ Your mistress shall be happy.
+
+ROSALIND Gentleman,
+
+ [Giving him a chain from her neck]
+
+ Wear this for me, one out of suits with fortune,
+ That could give more, but that her hand lacks means.
+ Shall we go, coz?
+
+CELIA Ay. Fare you well, fair gentleman.
+
+ORLANDO Can I not say, I thank you? My better parts
+ Are all thrown down, and that which here stands up
+ Is but a quintain, a mere lifeless block.
+
+ROSALIND He calls us back: my pride fell with my fortunes;
+ I'll ask him what he would. Did you call, sir?
+ Sir, you have wrestled well and overthrown
+ More than your enemies.
+
+CELIA Will you go, coz?
+
+ROSALIND Have with you. Fare you well.
+
+ [Exeunt ROSALIND and CELIA]
+
+ORLANDO What passion hangs these weights upon my tongue?
+ I cannot speak to her, yet she urged conference.
+ O poor Orlando, thou art overthrown!
+ Or Charles or something weaker masters thee.
+
+ [Re-enter LE BEAU]
+
+LE BEAU Good sir, I do in friendship counsel you
+ To leave this place. Albeit you have deserved
+ High commendation, true applause and love,
+ Yet such is now the duke's condition
+ That he misconstrues all that you have done.
+ The duke is humorous; what he is indeed,
+ More suits you to conceive than I to speak of.
+
+ORLANDO I thank you, sir: and, pray you, tell me this:
+ Which of the two was daughter of the duke
+ That here was at the wrestling?
+
+LE BEAU Neither his daughter, if we judge by manners;
+ But yet indeed the lesser is his daughter
+ The other is daughter to the banish'd duke,
+ And here detain'd by her usurping uncle,
+ To keep his daughter company; whose loves
+ Are dearer than the natural bond of sisters.
+ But I can tell you that of late this duke
+ Hath ta'en displeasure 'gainst his gentle niece,
+ Grounded upon no other argument
+ But that the people praise her for her virtues
+ And pity her for her good father's sake;
+ And, on my life, his malice 'gainst the lady
+ Will suddenly break forth. Sir, fare you well:
+ Hereafter, in a better world than this,
+ I shall desire more love and knowledge of you.
+
+ORLANDO I rest much bounden to you: fare you well.
+
+ [Exit LE BEAU]
+
+ Thus must I from the smoke into the smother;
+ From tyrant duke unto a tyrant brother:
+ But heavenly Rosalind!
+
+ [Exit]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT I
+
+
+
+SCENE III A room in the palace.
+
+
+ [Enter CELIA and ROSALIND]
+
+CELIA Why, cousin! why, Rosalind! Cupid have mercy! not a word?
+
+ROSALIND Not one to throw at a dog.
+
+CELIA No, thy words are too precious to be cast away upon
+ curs; throw some of them at me; come, lame me with reasons.
+
+ROSALIND Then there were two cousins laid up; when the one
+ should be lamed with reasons and the other mad
+ without any.
+
+CELIA But is all this for your father?
+
+ROSALIND No, some of it is for my child's father. O, how
+ full of briers is this working-day world!
+
+CELIA They are but burs, cousin, thrown upon thee in
+ holiday foolery: if we walk not in the trodden
+ paths our very petticoats will catch them.
+
+ROSALIND I could shake them off my coat: these burs are in my heart.
+
+CELIA Hem them away.
+
+ROSALIND I would try, if I could cry 'hem' and have him.
+
+CELIA Come, come, wrestle with thy affections.
+
+ROSALIND O, they take the part of a better wrestler than myself!
+
+CELIA O, a good wish upon you! you will try in time, in
+ despite of a fall. But, turning these jests out of
+ service, let us talk in good earnest: is it
+ possible, on such a sudden, you should fall into so
+ strong a liking with old Sir Rowland's youngest son?
+
+ROSALIND The duke my father loved his father dearly.
+
+CELIA Doth it therefore ensue that you should love his son
+ dearly? By this kind of chase, I should hate him,
+ for my father hated his father dearly; yet I hate
+ not Orlando.
+
+ROSALIND No, faith, hate him not, for my sake.
+
+CELIA Why should I not? doth he not deserve well?
+
+ROSALIND Let me love him for that, and do you love him
+ because I do. Look, here comes the duke.
+
+CELIA With his eyes full of anger.
+
+ [Enter DUKE FREDERICK, with Lords]
+
+DUKE FREDERICK Mistress, dispatch you with your safest haste
+ And get you from our court.
+
+ROSALIND Me, uncle?
+
+DUKE FREDERICK You, cousin
+ Within these ten days if that thou be'st found
+ So near our public court as twenty miles,
+ Thou diest for it.
+
+ROSALIND I do beseech your grace,
+ Let me the knowledge of my fault bear with me:
+ If with myself I hold intelligence
+ Or have acquaintance with mine own desires,
+ If that I do not dream or be not frantic,--
+ As I do trust I am not--then, dear uncle,
+ Never so much as in a thought unborn
+ Did I offend your highness.
+
+DUKE FREDERICK Thus do all traitors:
+ If their purgation did consist in words,
+ They are as innocent as grace itself:
+ Let it suffice thee that I trust thee not.
+
+ROSALIND Yet your mistrust cannot make me a traitor:
+ Tell me whereon the likelihood depends.
+
+DUKE FREDERICK Thou art thy father's daughter; there's enough.
+
+ROSALIND So was I when your highness took his dukedom;
+ So was I when your highness banish'd him:
+ Treason is not inherited, my lord;
+ Or, if we did derive it from our friends,
+ What's that to me? my father was no traitor:
+ Then, good my liege, mistake me not so much
+ To think my poverty is treacherous.
+
+CELIA Dear sovereign, hear me speak.
+
+DUKE FREDERICK Ay, Celia; we stay'd her for your sake,
+ Else had she with her father ranged along.
+
+CELIA I did not then entreat to have her stay;
+ It was your pleasure and your own remorse:
+ I was too young that time to value her;
+ But now I know her: if she be a traitor,
+ Why so am I; we still have slept together,
+ Rose at an instant, learn'd, play'd, eat together,
+ And wheresoever we went, like Juno's swans,
+ Still we went coupled and inseparable.
+
+DUKE FREDERICK She is too subtle for thee; and her smoothness,
+ Her very silence and her patience
+ Speak to the people, and they pity her.
+ Thou art a fool: she robs thee of thy name;
+ And thou wilt show more bright and seem more virtuous
+ When she is gone. Then open not thy lips:
+ Firm and irrevocable is my doom
+ Which I have pass'd upon her; she is banish'd.
+
+CELIA Pronounce that sentence then on me, my liege:
+ I cannot live out of her company.
+
+DUKE FREDERICK You are a fool. You, niece, provide yourself:
+ If you outstay the time, upon mine honour,
+ And in the greatness of my word, you die.
+
+ [Exeunt DUKE FREDERICK and Lords]
+
+CELIA O my poor Rosalind, whither wilt thou go?
+ Wilt thou change fathers? I will give thee mine.
+ I charge thee, be not thou more grieved than I am.
+
+ROSALIND I have more cause.
+
+CELIA Thou hast not, cousin;
+ Prithee be cheerful: know'st thou not, the duke
+ Hath banish'd me, his daughter?
+
+ROSALIND That he hath not.
+
+CELIA No, hath not? Rosalind lacks then the love
+ Which teacheth thee that thou and I am one:
+ Shall we be sunder'd? shall we part, sweet girl?
+ No: let my father seek another heir.
+ Therefore devise with me how we may fly,
+ Whither to go and what to bear with us;
+ And do not seek to take your change upon you,
+ To bear your griefs yourself and leave me out;
+ For, by this heaven, now at our sorrows pale,
+ Say what thou canst, I'll go along with thee.
+
+ROSALIND Why, whither shall we go?
+
+CELIA To seek my uncle in the forest of Arden.
+
+ROSALIND Alas, what danger will it be to us,
+ Maids as we are, to travel forth so far!
+ Beauty provoketh thieves sooner than gold.
+
+CELIA I'll put myself in poor and mean attire
+ And with a kind of umber smirch my face;
+ The like do you: so shall we pass along
+ And never stir assailants.
+
+ROSALIND Were it not better,
+ Because that I am more than common tall,
+ That I did suit me all points like a man?
+ A gallant curtle-axe upon my thigh,
+ A boar-spear in my hand; and--in my heart
+ Lie there what hidden woman's fear there will--
+ We'll have a swashing and a martial outside,
+ As many other mannish cowards have
+ That do outface it with their semblances.
+
+CELIA What shall I call thee when thou art a man?
+
+ROSALIND I'll have no worse a name than Jove's own page;
+ And therefore look you call me Ganymede.
+ But what will you be call'd?
+
+CELIA Something that hath a reference to my state
+ No longer Celia, but Aliena.
+
+ROSALIND But, cousin, what if we assay'd to steal
+ The clownish fool out of your father's court?
+ Would he not be a comfort to our travel?
+
+CELIA He'll go along o'er the wide world with me;
+ Leave me alone to woo him. Let's away,
+ And get our jewels and our wealth together,
+ Devise the fittest time and safest way
+ To hide us from pursuit that will be made
+ After my flight. Now go we in content
+ To liberty and not to banishment.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT II
+
+
+
+SCENE I The Forest of Arden.
+
+
+ [Enter DUKE SENIOR, AMIENS, and two or three Lords,
+ like foresters]
+
+DUKE SENIOR Now, my co-mates and brothers in exile,
+ Hath not old custom made this life more sweet
+ Than that of painted pomp? Are not these woods
+ More free from peril than the envious court?
+ Here feel we but the penalty of Adam,
+ The seasons' difference, as the icy fang
+ And churlish chiding of the winter's wind,
+ Which, when it bites and blows upon my body,
+ Even till I shrink with cold, I smile and say
+ 'This is no flattery: these are counsellors
+ That feelingly persuade me what I am.'
+ Sweet are the uses of adversity,
+ Which, like the toad, ugly and venomous,
+ Wears yet a precious jewel in his head;
+ And this our life exempt from public haunt
+ Finds tongues in trees, books in the running brooks,
+ Sermons in stones and good in every thing.
+ I would not change it.
+
+AMIENS Happy is your grace,
+ That can translate the stubbornness of fortune
+ Into so quiet and so sweet a style.
+
+DUKE SENIOR Come, shall we go and kill us venison?
+ And yet it irks me the poor dappled fools,
+ Being native burghers of this desert city,
+ Should in their own confines with forked heads
+ Have their round haunches gored.
+
+First Lord Indeed, my lord,
+ The melancholy Jaques grieves at that,
+ And, in that kind, swears you do more usurp
+ Than doth your brother that hath banish'd you.
+ To-day my Lord of Amiens and myself
+ Did steal behind him as he lay along
+ Under an oak whose antique root peeps out
+ Upon the brook that brawls along this wood:
+ To the which place a poor sequester'd stag,
+ That from the hunter's aim had ta'en a hurt,
+ Did come to languish, and indeed, my lord,
+ The wretched animal heaved forth such groans
+ That their discharge did stretch his leathern coat
+ Almost to bursting, and the big round tears
+ Coursed one another down his innocent nose
+ In piteous chase; and thus the hairy fool
+ Much marked of the melancholy Jaques,
+ Stood on the extremest verge of the swift brook,
+ Augmenting it with tears.
+
+DUKE SENIOR But what said Jaques?
+ Did he not moralize this spectacle?
+
+First Lord O, yes, into a thousand similes.
+ First, for his weeping into the needless stream;
+ 'Poor deer,' quoth he, 'thou makest a testament
+ As worldlings do, giving thy sum of more
+ To that which had too much:' then, being there alone,
+ Left and abandon'd of his velvet friends,
+ ''Tis right:' quoth he; 'thus misery doth part
+ The flux of company:' anon a careless herd,
+ Full of the pasture, jumps along by him
+ And never stays to greet him; 'Ay' quoth Jaques,
+ 'Sweep on, you fat and greasy citizens;
+ 'Tis just the fashion: wherefore do you look
+ Upon that poor and broken bankrupt there?'
+ Thus most invectively he pierceth through
+ The body of the country, city, court,
+ Yea, and of this our life, swearing that we
+ Are mere usurpers, tyrants and what's worse,
+ To fright the animals and to kill them up
+ In their assign'd and native dwelling-place.
+
+DUKE SENIOR And did you leave him in this contemplation?
+
+Second Lord We did, my lord, weeping and commenting
+ Upon the sobbing deer.
+
+DUKE SENIOR Show me the place:
+ I love to cope him in these sullen fits,
+ For then he's full of matter.
+
+First Lord I'll bring you to him straight.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT II
+
+
+
+SCENE II A room in the palace.
+
+
+ [Enter DUKE FREDERICK, with Lords]
+
+DUKE FREDERICK Can it be possible that no man saw them?
+ It cannot be: some villains of my court
+ Are of consent and sufferance in this.
+
+First Lord I cannot hear of any that did see her.
+ The ladies, her attendants of her chamber,
+ Saw her abed, and in the morning early
+ They found the bed untreasured of their mistress.
+
+Second Lord My lord, the roynish clown, at whom so oft
+ Your grace was wont to laugh, is also missing.
+ Hisperia, the princess' gentlewoman,
+ Confesses that she secretly o'erheard
+ Your daughter and her cousin much commend
+ The parts and graces of the wrestler
+ That did but lately foil the sinewy Charles;
+ And she believes, wherever they are gone,
+ That youth is surely in their company.
+
+DUKE FREDERICK Send to his brother; fetch that gallant hither;
+ If he be absent, bring his brother to me;
+ I'll make him find him: do this suddenly,
+ And let not search and inquisition quail
+ To bring again these foolish runaways.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT II
+
+
+
+SCENE III Before OLIVER'S house.
+
+
+ [Enter ORLANDO and ADAM, meeting]
+
+ORLANDO Who's there?
+
+ADAM What, my young master? O, my gentle master!
+ O my sweet master! O you memory
+ Of old Sir Rowland! why, what make you here?
+ Why are you virtuous? why do people love you?
+ And wherefore are you gentle, strong and valiant?
+ Why would you be so fond to overcome
+ The bonny priser of the humorous duke?
+ Your praise is come too swiftly home before you.
+ Know you not, master, to some kind of men
+ Their graces serve them but as enemies?
+ No more do yours: your virtues, gentle master,
+ Are sanctified and holy traitors to you.
+ O, what a world is this, when what is comely
+ Envenoms him that bears it!
+
+ORLANDO Why, what's the matter?
+
+ADAM O unhappy youth!
+ Come not within these doors; within this roof
+ The enemy of all your graces lives:
+ Your brother--no, no brother; yet the son--
+ Yet not the son, I will not call him son
+ Of him I was about to call his father--
+ Hath heard your praises, and this night he means
+ To burn the lodging where you use to lie
+ And you within it: if he fail of that,
+ He will have other means to cut you off.
+ I overheard him and his practises.
+ This is no place; this house is but a butchery:
+ Abhor it, fear it, do not enter it.
+
+ORLANDO Why, whither, Adam, wouldst thou have me go?
+
+ADAM No matter whither, so you come not here.
+
+ORLANDO What, wouldst thou have me go and beg my food?
+ Or with a base and boisterous sword enforce
+ A thievish living on the common road?
+ This I must do, or know not what to do:
+ Yet this I will not do, do how I can;
+ I rather will subject me to the malice
+ Of a diverted blood and bloody brother.
+
+ADAM But do not so. I have five hundred crowns,
+ The thrifty hire I saved under your father,
+ Which I did store to be my foster-nurse
+ When service should in my old limbs lie lame
+ And unregarded age in corners thrown:
+ Take that, and He that doth the ravens feed,
+ Yea, providently caters for the sparrow,
+ Be comfort to my age! Here is the gold;
+ And all this I give you. Let me be your servant:
+ Though I look old, yet I am strong and lusty;
+ For in my youth I never did apply
+ Hot and rebellious liquors in my blood,
+ Nor did not with unbashful forehead woo
+ The means of weakness and debility;
+ Therefore my age is as a lusty winter,
+ Frosty, but kindly: let me go with you;
+ I'll do the service of a younger man
+ In all your business and necessities.
+
+ORLANDO O good old man, how well in thee appears
+ The constant service of the antique world,
+ When service sweat for duty, not for meed!
+ Thou art not for the fashion of these times,
+ Where none will sweat but for promotion,
+ And having that, do choke their service up
+ Even with the having: it is not so with thee.
+ But, poor old man, thou prunest a rotten tree,
+ That cannot so much as a blossom yield
+ In lieu of all thy pains and husbandry
+ But come thy ways; well go along together,
+ And ere we have thy youthful wages spent,
+ We'll light upon some settled low content.
+
+ADAM Master, go on, and I will follow thee,
+ To the last gasp, with truth and loyalty.
+ From seventeen years till now almost fourscore
+ Here lived I, but now live here no more.
+ At seventeen years many their fortunes seek;
+ But at fourscore it is too late a week:
+ Yet fortune cannot recompense me better
+ Than to die well and not my master's debtor.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT II
+
+
+
+SCENE IV The Forest of Arden.
+
+
+ [Enter ROSALIND for Ganymede, CELIA for Aliena,
+ and TOUCHSTONE]
+
+ROSALIND O Jupiter, how weary are my spirits!
+
+TOUCHSTONE I care not for my spirits, if my legs were not weary.
+
+ROSALIND I could find in my heart to disgrace my man's
+ apparel and to cry like a woman; but I must comfort
+ the weaker vessel, as doublet and hose ought to show
+ itself courageous to petticoat: therefore courage,
+ good Aliena!
+
+CELIA I pray you, bear with me; I cannot go no further.
+
+TOUCHSTONE For my part, I had rather bear with you than bear
+ you; yet I should bear no cross if I did bear you,
+ for I think you have no money in your purse.
+
+ROSALIND Well, this is the forest of Arden.
+
+TOUCHSTONE Ay, now am I in Arden; the more fool I; when I was
+ at home, I was in a better place: but travellers
+ must be content.
+
+ROSALIND Ay, be so, good Touchstone.
+
+ [Enter CORIN and SILVIUS]
+
+ Look you, who comes here; a young man and an old in
+ solemn talk.
+
+CORIN That is the way to make her scorn you still.
+
+SILVIUS O Corin, that thou knew'st how I do love her!
+
+CORIN I partly guess; for I have loved ere now.
+
+SILVIUS No, Corin, being old, thou canst not guess,
+ Though in thy youth thou wast as true a lover
+ As ever sigh'd upon a midnight pillow:
+ But if thy love were ever like to mine--
+ As sure I think did never man love so--
+ How many actions most ridiculous
+ Hast thou been drawn to by thy fantasy?
+
+CORIN Into a thousand that I have forgotten.
+
+SILVIUS O, thou didst then ne'er love so heartily!
+ If thou remember'st not the slightest folly
+ That ever love did make thee run into,
+ Thou hast not loved:
+ Or if thou hast not sat as I do now,
+ Wearying thy hearer in thy mistress' praise,
+ Thou hast not loved:
+ Or if thou hast not broke from company
+ Abruptly, as my passion now makes me,
+ Thou hast not loved.
+ O Phebe, Phebe, Phebe!
+
+ [Exit]
+
+ROSALIND Alas, poor shepherd! searching of thy wound,
+ I have by hard adventure found mine own.
+
+TOUCHSTONE And I mine. I remember, when I was in love I broke
+ my sword upon a stone and bid him take that for
+ coming a-night to Jane Smile; and I remember the
+ kissing of her batlet and the cow's dugs that her
+ pretty chopt hands had milked; and I remember the
+ wooing of a peascod instead of her, from whom I took
+ two cods and, giving her them again, said with
+ weeping tears 'Wear these for my sake.' We that are
+ true lovers run into strange capers; but as all is
+ mortal in nature, so is all nature in love mortal in folly.
+
+ROSALIND Thou speakest wiser than thou art ware of.
+
+TOUCHSTONE Nay, I shall ne'er be ware of mine own wit till I
+ break my shins against it.
+
+ROSALIND Jove, Jove! this shepherd's passion
+ Is much upon my fashion.
+
+TOUCHSTONE And mine; but it grows something stale with me.
+
+CELIA I pray you, one of you question yond man
+ If he for gold will give us any food:
+ I faint almost to death.
+
+TOUCHSTONE Holla, you clown!
+
+ROSALIND Peace, fool: he's not thy kinsman.
+
+CORIN Who calls?
+
+TOUCHSTONE Your betters, sir.
+
+CORIN Else are they very wretched.
+
+ROSALIND Peace, I say. Good even to you, friend.
+
+CORIN And to you, gentle sir, and to you all.
+
+ROSALIND I prithee, shepherd, if that love or gold
+ Can in this desert place buy entertainment,
+ Bring us where we may rest ourselves and feed:
+ Here's a young maid with travel much oppress'd
+ And faints for succor.
+
+CORIN Fair sir, I pity her
+ And wish, for her sake more than for mine own,
+ My fortunes were more able to relieve her;
+ But I am shepherd to another man
+ And do not shear the fleeces that I graze:
+ My master is of churlish disposition
+ And little recks to find the way to heaven
+ By doing deeds of hospitality:
+ Besides, his cote, his flocks and bounds of feed
+ Are now on sale, and at our sheepcote now,
+ By reason of his absence, there is nothing
+ That you will feed on; but what is, come see.
+ And in my voice most welcome shall you be.
+
+ROSALIND What is he that shall buy his flock and pasture?
+
+CORIN That young swain that you saw here but erewhile,
+ That little cares for buying any thing.
+
+ROSALIND I pray thee, if it stand with honesty,
+ Buy thou the cottage, pasture and the flock,
+ And thou shalt have to pay for it of us.
+
+CELIA And we will mend thy wages. I like this place.
+ And willingly could waste my time in it.
+
+CORIN Assuredly the thing is to be sold:
+ Go with me: if you like upon report
+ The soil, the profit and this kind of life,
+ I will your very faithful feeder be
+ And buy it with your gold right suddenly.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT II
+
+
+
+SCENE V The Forest.
+
+
+ [Enter AMIENS, JAQUES, and others]
+
+ SONG.
+AMIENS Under the greenwood tree
+ Who loves to lie with me,
+ And turn his merry note
+ Unto the sweet bird's throat,
+ Come hither, come hither, come hither:
+ Here shall he see No enemy
+ But winter and rough weather.
+
+JAQUES More, more, I prithee, more.
+
+AMIENS It will make you melancholy, Monsieur Jaques.
+
+JAQUES I thank it. More, I prithee, more. I can suck
+ melancholy out of a song, as a weasel sucks eggs.
+ More, I prithee, more.
+
+AMIENS My voice is ragged: I know I cannot please you.
+
+JAQUES I do not desire you to please me; I do desire you to
+ sing. Come, more; another stanzo: call you 'em stanzos?
+
+AMIENS What you will, Monsieur Jaques.
+
+JAQUES Nay, I care not for their names; they owe me
+ nothing. Will you sing?
+
+AMIENS More at your request than to please myself.
+
+JAQUES Well then, if ever I thank any man, I'll thank you;
+ but that they call compliment is like the encounter
+ of two dog-apes, and when a man thanks me heartily,
+ methinks I have given him a penny and he renders me
+ the beggarly thanks. Come, sing; and you that will
+ not, hold your tongues.
+
+AMIENS Well, I'll end the song. Sirs, cover the while; the
+ duke will drink under this tree. He hath been all
+ this day to look you.
+
+JAQUES And I have been all this day to avoid him. He is
+ too disputable for my company: I think of as many
+ matters as he, but I give heaven thanks and make no
+ boast of them. Come, warble, come.
+
+ SONG.
+ Who doth ambition shun
+
+ [All together here]
+
+ And loves to live i' the sun,
+ Seeking the food he eats
+ And pleased with what he gets,
+ Come hither, come hither, come hither:
+ Here shall he see No enemy
+ But winter and rough weather.
+
+JAQUES I'll give you a verse to this note that I made
+ yesterday in despite of my invention.
+
+AMIENS And I'll sing it.
+
+JAQUES Thus it goes:--
+
+ If it do come to pass
+ That any man turn ass,
+ Leaving his wealth and ease,
+ A stubborn will to please,
+ Ducdame, ducdame, ducdame:
+ Here shall he see
+ Gross fools as he,
+ An if he will come to me.
+
+AMIENS What's that 'ducdame'?
+
+JAQUES 'Tis a Greek invocation, to call fools into a
+ circle. I'll go sleep, if I can; if I cannot, I'll
+ rail against all the first-born of Egypt.
+
+AMIENS And I'll go seek the duke: his banquet is prepared.
+
+ [Exeunt severally]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT II
+
+
+
+SCENE VI The forest.
+
+
+ [Enter ORLANDO and ADAM]
+
+ADAM Dear master, I can go no further. O, I die for food!
+ Here lie I down, and measure out my grave. Farewell,
+ kind master.
+
+ORLANDO Why, how now, Adam! no greater heart in thee? Live
+ a little; comfort a little; cheer thyself a little.
+ If this uncouth forest yield any thing savage, I
+ will either be food for it or bring it for food to
+ thee. Thy conceit is nearer death than thy powers.
+ For my sake be comfortable; hold death awhile at
+ the arm's end: I will here be with thee presently;
+ and if I bring thee not something to eat, I will
+ give thee leave to die: but if thou diest before I
+ come, thou art a mocker of my labour. Well said!
+ thou lookest cheerly, and I'll be with thee quickly.
+ Yet thou liest in the bleak air: come, I will bear
+ thee to some shelter; and thou shalt not die for
+ lack of a dinner, if there live any thing in this
+ desert. Cheerly, good Adam!
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT II
+
+
+
+SCENE VII The forest.
+
+
+ [A table set out. Enter DUKE SENIOR, AMIENS, and
+ Lords like outlaws]
+
+DUKE SENIOR I think he be transform'd into a beast;
+ For I can no where find him like a man.
+
+First Lord My lord, he is but even now gone hence:
+ Here was he merry, hearing of a song.
+
+DUKE SENIOR If he, compact of jars, grow musical,
+ We shall have shortly discord in the spheres.
+ Go, seek him: tell him I would speak with him.
+
+ [Enter JAQUES]
+
+First Lord He saves my labour by his own approach.
+
+DUKE SENIOR Why, how now, monsieur! what a life is this,
+ That your poor friends must woo your company?
+ What, you look merrily!
+
+JAQUES A fool, a fool! I met a fool i' the forest,
+ A motley fool; a miserable world!
+ As I do live by food, I met a fool
+ Who laid him down and bask'd him in the sun,
+ And rail'd on Lady Fortune in good terms,
+ In good set terms and yet a motley fool.
+ 'Good morrow, fool,' quoth I. 'No, sir,' quoth he,
+ 'Call me not fool till heaven hath sent me fortune:'
+ And then he drew a dial from his poke,
+ And, looking on it with lack-lustre eye,
+ Says very wisely, 'It is ten o'clock:
+ Thus we may see,' quoth he, 'how the world wags:
+ 'Tis but an hour ago since it was nine,
+ And after one hour more 'twill be eleven;
+ And so, from hour to hour, we ripe and ripe,
+ And then, from hour to hour, we rot and rot;
+ And thereby hangs a tale.' When I did hear
+ The motley fool thus moral on the time,
+ My lungs began to crow like chanticleer,
+ That fools should be so deep-contemplative,
+ And I did laugh sans intermission
+ An hour by his dial. O noble fool!
+ A worthy fool! Motley's the only wear.
+
+DUKE SENIOR What fool is this?
+
+JAQUES O worthy fool! One that hath been a courtier,
+ And says, if ladies be but young and fair,
+ They have the gift to know it: and in his brain,
+ Which is as dry as the remainder biscuit
+ After a voyage, he hath strange places cramm'd
+ With observation, the which he vents
+ In mangled forms. O that I were a fool!
+ I am ambitious for a motley coat.
+
+DUKE SENIOR Thou shalt have one.
+
+JAQUES It is my only suit;
+ Provided that you weed your better judgments
+ Of all opinion that grows rank in them
+ That I am wise. I must have liberty
+ Withal, as large a charter as the wind,
+ To blow on whom I please; for so fools have;
+ And they that are most galled with my folly,
+ They most must laugh. And why, sir, must they so?
+ The 'why' is plain as way to parish church:
+ He that a fool doth very wisely hit
+ Doth very foolishly, although he smart,
+ Not to seem senseless of the bob: if not,
+ The wise man's folly is anatomized
+ Even by the squandering glances of the fool.
+ Invest me in my motley; give me leave
+ To speak my mind, and I will through and through
+ Cleanse the foul body of the infected world,
+ If they will patiently receive my medicine.
+
+DUKE SENIOR Fie on thee! I can tell what thou wouldst do.
+
+JAQUES What, for a counter, would I do but good?
+
+DUKE SENIOR Most mischievous foul sin, in chiding sin:
+ For thou thyself hast been a libertine,
+ As sensual as the brutish sting itself;
+ And all the embossed sores and headed evils,
+ That thou with licence of free foot hast caught,
+ Wouldst thou disgorge into the general world.
+
+JAQUES Why, who cries out on pride,
+ That can therein tax any private party?
+ Doth it not flow as hugely as the sea,
+ Till that the weary very means do ebb?
+ What woman in the city do I name,
+ When that I say the city-woman bears
+ The cost of princes on unworthy shoulders?
+ Who can come in and say that I mean her,
+ When such a one as she such is her neighbour?
+ Or what is he of basest function
+ That says his bravery is not of my cost,
+ Thinking that I mean him, but therein suits
+ His folly to the mettle of my speech?
+ There then; how then? what then? Let me see wherein
+ My tongue hath wrong'd him: if it do him right,
+ Then he hath wrong'd himself; if he be free,
+ Why then my taxing like a wild-goose flies,
+ Unclaim'd of any man. But who comes here?
+
+ [Enter ORLANDO, with his sword drawn]
+
+ORLANDO Forbear, and eat no more.
+
+JAQUES Why, I have eat none yet.
+
+ORLANDO Nor shalt not, till necessity be served.
+
+JAQUES Of what kind should this cock come of?
+
+DUKE SENIOR Art thou thus bolden'd, man, by thy distress,
+ Or else a rude despiser of good manners,
+ That in civility thou seem'st so empty?
+
+ORLANDO You touch'd my vein at first: the thorny point
+ Of bare distress hath ta'en from me the show
+ Of smooth civility: yet am I inland bred
+ And know some nurture. But forbear, I say:
+ He dies that touches any of this fruit
+ Till I and my affairs are answered.
+
+JAQUES An you will not be answered with reason, I must die.
+
+DUKE SENIOR What would you have? Your gentleness shall force
+ More than your force move us to gentleness.
+
+ORLANDO I almost die for food; and let me have it.
+
+DUKE SENIOR Sit down and feed, and welcome to our table.
+
+ORLANDO Speak you so gently? Pardon me, I pray you:
+ I thought that all things had been savage here;
+ And therefore put I on the countenance
+ Of stern commandment. But whate'er you are
+ That in this desert inaccessible,
+ Under the shade of melancholy boughs,
+ Lose and neglect the creeping hours of time
+ If ever you have look'd on better days,
+ If ever been where bells have knoll'd to church,
+ If ever sat at any good man's feast,
+ If ever from your eyelids wiped a tear
+ And know what 'tis to pity and be pitied,
+ Let gentleness my strong enforcement be:
+ In the which hope I blush, and hide my sword.
+
+DUKE SENIOR True is it that we have seen better days,
+ And have with holy bell been knoll'd to church
+ And sat at good men's feasts and wiped our eyes
+ Of drops that sacred pity hath engender'd:
+ And therefore sit you down in gentleness
+ And take upon command what help we have
+ That to your wanting may be minister'd.
+
+ORLANDO Then but forbear your food a little while,
+ Whiles, like a doe, I go to find my fawn
+ And give it food. There is an old poor man,
+ Who after me hath many a weary step
+ Limp'd in pure love: till he be first sufficed,
+ Oppress'd with two weak evils, age and hunger,
+ I will not touch a bit.
+
+DUKE SENIOR Go find him out,
+ And we will nothing waste till you return.
+
+ORLANDO I thank ye; and be blest for your good comfort!
+
+ [Exit]
+
+DUKE SENIOR Thou seest we are not all alone unhappy:
+ This wide and universal theatre
+ Presents more woeful pageants than the scene
+ Wherein we play in.
+
+JAQUES All the world's a stage,
+ And all the men and women merely players:
+ They have their exits and their entrances;
+ And one man in his time plays many parts,
+ His acts being seven ages. At first the infant,
+ Mewling and puking in the nurse's arms.
+ And then the whining school-boy, with his satchel
+ And shining morning face, creeping like snail
+ Unwillingly to school. And then the lover,
+ Sighing like furnace, with a woeful ballad
+ Made to his mistress' eyebrow. Then a soldier,
+ Full of strange oaths and bearded like the pard,
+ Jealous in honour, sudden and quick in quarrel,
+ Seeking the bubble reputation
+ Even in the cannon's mouth. And then the justice,
+ In fair round belly with good capon lined,
+ With eyes severe and beard of formal cut,
+ Full of wise saws and modern instances;
+ And so he plays his part. The sixth age shifts
+ Into the lean and slipper'd pantaloon,
+ With spectacles on nose and pouch on side,
+ His youthful hose, well saved, a world too wide
+ For his shrunk shank; and his big manly voice,
+ Turning again toward childish treble, pipes
+ And whistles in his sound. Last scene of all,
+ That ends this strange eventful history,
+ Is second childishness and mere oblivion,
+ Sans teeth, sans eyes, sans taste, sans everything.
+
+ [Re-enter ORLANDO, with ADAM]
+
+DUKE SENIOR Welcome. Set down your venerable burthen,
+ And let him feed.
+
+ORLANDO I thank you most for him.
+
+ADAM So had you need:
+ I scarce can speak to thank you for myself.
+
+DUKE SENIOR Welcome; fall to: I will not trouble you
+ As yet, to question you about your fortunes.
+ Give us some music; and, good cousin, sing.
+
+ SONG.
+AMIENS Blow, blow, thou winter wind.
+ Thou art not so unkind
+ As man's ingratitude;
+ Thy tooth is not so keen,
+ Because thou art not seen,
+ Although thy breath be rude.
+ Heigh-ho! sing, heigh-ho! unto the green holly:
+ Most friendship is feigning, most loving mere folly:
+ Then, heigh-ho, the holly!
+ This life is most jolly.
+ Freeze, freeze, thou bitter sky,
+ That dost not bite so nigh
+ As benefits forgot:
+ Though thou the waters warp,
+ Thy sting is not so sharp
+ As friend remember'd not.
+ Heigh-ho! sing, &c.
+
+DUKE SENIOR If that you were the good Sir Rowland's son,
+ As you have whisper'd faithfully you were,
+ And as mine eye doth his effigies witness
+ Most truly limn'd and living in your face,
+ Be truly welcome hither: I am the duke
+ That loved your father: the residue of your fortune,
+ Go to my cave and tell me. Good old man,
+ Thou art right welcome as thy master is.
+ Support him by the arm. Give me your hand,
+ And let me all your fortunes understand.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT III
+
+
+
+SCENE I A room in the palace.
+
+
+ [Enter DUKE FREDERICK, Lords, and OLIVER]
+
+DUKE FREDERICK Not see him since? Sir, sir, that cannot be:
+ But were I not the better part made mercy,
+ I should not seek an absent argument
+ Of my revenge, thou present. But look to it:
+ Find out thy brother, wheresoe'er he is;
+ Seek him with candle; bring him dead or living
+ Within this twelvemonth, or turn thou no more
+ To seek a living in our territory.
+ Thy lands and all things that thou dost call thine
+ Worth seizure do we seize into our hands,
+ Till thou canst quit thee by thy brothers mouth
+ Of what we think against thee.
+
+OLIVER O that your highness knew my heart in this!
+ I never loved my brother in my life.
+
+DUKE FREDERICK More villain thou. Well, push him out of doors;
+ And let my officers of such a nature
+ Make an extent upon his house and lands:
+ Do this expediently and turn him going.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT III
+
+
+
+SCENE II The forest.
+
+
+ [Enter ORLANDO, with a paper]
+
+ORLANDO Hang there, my verse, in witness of my love:
+ And thou, thrice-crowned queen of night, survey
+ With thy chaste eye, from thy pale sphere above,
+ Thy huntress' name that my full life doth sway.
+ O Rosalind! these trees shall be my books
+ And in their barks my thoughts I'll character;
+ That every eye which in this forest looks
+ Shall see thy virtue witness'd every where.
+ Run, run, Orlando; carve on every tree
+ The fair, the chaste and unexpressive she.
+
+ [Exit]
+
+ [Enter CORIN and TOUCHSTONE]
+
+CORIN And how like you this shepherd's life, Master Touchstone?
+
+TOUCHSTONE Truly, shepherd, in respect of itself, it is a good
+ life, but in respect that it is a shepherd's life,
+ it is naught. In respect that it is solitary, I
+ like it very well; but in respect that it is
+ private, it is a very vile life. Now, in respect it
+ is in the fields, it pleaseth me well; but in
+ respect it is not in the court, it is tedious. As
+ is it a spare life, look you, it fits my humour well;
+ but as there is no more plenty in it, it goes much
+ against my stomach. Hast any philosophy in thee, shepherd?
+
+CORIN No more but that I know the more one sickens the
+ worse at ease he is; and that he that wants money,
+ means and content is without three good friends;
+ that the property of rain is to wet and fire to
+ burn; that good pasture makes fat sheep, and that a
+ great cause of the night is lack of the sun; that
+ he that hath learned no wit by nature nor art may
+ complain of good breeding or comes of a very dull kindred.
+
+TOUCHSTONE Such a one is a natural philosopher. Wast ever in
+ court, shepherd?
+
+CORIN No, truly.
+
+TOUCHSTONE Then thou art damned.
+
+CORIN Nay, I hope.
+
+TOUCHSTONE Truly, thou art damned like an ill-roasted egg, all
+ on one side.
+
+CORIN For not being at court? Your reason.
+
+TOUCHSTONE Why, if thou never wast at court, thou never sawest
+ good manners; if thou never sawest good manners,
+ then thy manners must be wicked; and wickedness is
+ sin, and sin is damnation. Thou art in a parlous
+ state, shepherd.
+
+CORIN Not a whit, Touchstone: those that are good manners
+ at the court are as ridiculous in the country as the
+ behavior of the country is most mockable at the
+ court. You told me you salute not at the court, but
+ you kiss your hands: that courtesy would be
+ uncleanly, if courtiers were shepherds.
+
+TOUCHSTONE Instance, briefly; come, instance.
+
+CORIN Why, we are still handling our ewes, and their
+ fells, you know, are greasy.
+
+TOUCHSTONE Why, do not your courtier's hands sweat? and is not
+ the grease of a mutton as wholesome as the sweat of
+ a man? Shallow, shallow. A better instance, I say; come.
+
+CORIN Besides, our hands are hard.
+
+TOUCHSTONE Your lips will feel them the sooner. Shallow again.
+ A more sounder instance, come.
+
+CORIN And they are often tarred over with the surgery of
+ our sheep: and would you have us kiss tar? The
+ courtier's hands are perfumed with civet.
+
+TOUCHSTONE Most shallow man! thou worms-meat, in respect of a
+ good piece of flesh indeed! Learn of the wise, and
+ perpend: civet is of a baser birth than tar, the
+ very uncleanly flux of a cat. Mend the instance, shepherd.
+
+CORIN You have too courtly a wit for me: I'll rest.
+
+TOUCHSTONE Wilt thou rest damned? God help thee, shallow man!
+ God make incision in thee! thou art raw.
+
+CORIN Sir, I am a true labourer: I earn that I eat, get
+ that I wear, owe no man hate, envy no man's
+ happiness, glad of other men's good, content with my
+ harm, and the greatest of my pride is to see my ewes
+ graze and my lambs suck.
+
+TOUCHSTONE That is another simple sin in you, to bring the ewes
+ and the rams together and to offer to get your
+ living by the copulation of cattle; to be bawd to a
+ bell-wether, and to betray a she-lamb of a
+ twelvemonth to a crooked-pated, old, cuckoldly ram,
+ out of all reasonable match. If thou beest not
+ damned for this, the devil himself will have no
+ shepherds; I cannot see else how thou shouldst
+ 'scape.
+
+CORIN Here comes young Master Ganymede, my new mistress's brother.
+
+ [Enter ROSALIND, with a paper, reading]
+
+ROSALIND From the east to western Ind,
+ No jewel is like Rosalind.
+ Her worth, being mounted on the wind,
+ Through all the world bears Rosalind.
+ All the pictures fairest lined
+ Are but black to Rosalind.
+ Let no fair be kept in mind
+ But the fair of Rosalind.
+
+TOUCHSTONE I'll rhyme you so eight years together, dinners and
+ suppers and sleeping-hours excepted: it is the
+ right butter-women's rank to market.
+
+ROSALIND Out, fool!
+
+TOUCHSTONE For a taste:
+ If a hart do lack a hind,
+ Let him seek out Rosalind.
+ If the cat will after kind,
+ So be sure will Rosalind.
+ Winter garments must be lined,
+ So must slender Rosalind.
+ They that reap must sheaf and bind;
+ Then to cart with Rosalind.
+ Sweetest nut hath sourest rind,
+ Such a nut is Rosalind.
+ He that sweetest rose will find
+ Must find love's prick and Rosalind.
+ This is the very false gallop of verses: why do you
+ infect yourself with them?
+
+ROSALIND Peace, you dull fool! I found them on a tree.
+
+TOUCHSTONE Truly, the tree yields bad fruit.
+
+ROSALIND I'll graff it with you, and then I shall graff it
+ with a medlar: then it will be the earliest fruit
+ i' the country; for you'll be rotten ere you be half
+ ripe, and that's the right virtue of the medlar.
+
+TOUCHSTONE You have said; but whether wisely or no, let the
+ forest judge.
+
+ [Enter CELIA, with a writing]
+
+ROSALIND Peace! Here comes my sister, reading: stand aside.
+
+CELIA [Reads]
+
+ Why should this a desert be?
+ For it is unpeopled? No:
+ Tongues I'll hang on every tree,
+ That shall civil sayings show:
+ Some, how brief the life of man
+ Runs his erring pilgrimage,
+ That the stretching of a span
+ Buckles in his sum of age;
+ Some, of violated vows
+ 'Twixt the souls of friend and friend:
+ But upon the fairest boughs,
+ Or at every sentence end,
+ Will I Rosalinda write,
+ Teaching all that read to know
+ The quintessence of every sprite
+ Heaven would in little show.
+ Therefore Heaven Nature charged
+ That one body should be fill'd
+ With all graces wide-enlarged:
+ Nature presently distill'd
+ Helen's cheek, but not her heart,
+ Cleopatra's majesty,
+ Atalanta's better part,
+ Sad Lucretia's modesty.
+ Thus Rosalind of many parts
+ By heavenly synod was devised,
+ Of many faces, eyes and hearts,
+ To have the touches dearest prized.
+ Heaven would that she these gifts should have,
+ And I to live and die her slave.
+
+ROSALIND O most gentle pulpiter! what tedious homily of love
+ have you wearied your parishioners withal, and never
+ cried 'Have patience, good people!'
+
+CELIA How now! back, friends! Shepherd, go off a little.
+ Go with him, sirrah.
+
+TOUCHSTONE Come, shepherd, let us make an honourable retreat;
+ though not with bag and baggage, yet with scrip and scrippage.
+
+ [Exeunt CORIN and TOUCHSTONE]
+
+CELIA Didst thou hear these verses?
+
+ROSALIND O, yes, I heard them all, and more too; for some of
+ them had in them more feet than the verses would bear.
+
+CELIA That's no matter: the feet might bear the verses.
+
+ROSALIND Ay, but the feet were lame and could not bear
+ themselves without the verse and therefore stood
+ lamely in the verse.
+
+CELIA But didst thou hear without wondering how thy name
+ should be hanged and carved upon these trees?
+
+ROSALIND I was seven of the nine days out of the wonder
+ before you came; for look here what I found on a
+ palm-tree. I was never so be-rhymed since
+ Pythagoras' time, that I was an Irish rat, which I
+ can hardly remember.
+
+CELIA Trow you who hath done this?
+
+ROSALIND Is it a man?
+
+CELIA And a chain, that you once wore, about his neck.
+ Change you colour?
+
+ROSALIND I prithee, who?
+
+CELIA O Lord, Lord! it is a hard matter for friends to
+ meet; but mountains may be removed with earthquakes
+ and so encounter.
+
+ROSALIND Nay, but who is it?
+
+CELIA Is it possible?
+
+ROSALIND Nay, I prithee now with most petitionary vehemence,
+ tell me who it is.
+
+CELIA O wonderful, wonderful, and most wonderful
+ wonderful! and yet again wonderful, and after that,
+ out of all hooping!
+
+ROSALIND Good my complexion! dost thou think, though I am
+ caparisoned like a man, I have a doublet and hose in
+ my disposition? One inch of delay more is a
+ South-sea of discovery; I prithee, tell me who is it
+ quickly, and speak apace. I would thou couldst
+ stammer, that thou mightst pour this concealed man
+ out of thy mouth, as wine comes out of a narrow-
+ mouthed bottle, either too much at once, or none at
+ all. I prithee, take the cork out of thy mouth that
+ may drink thy tidings.
+
+CELIA So you may put a man in your belly.
+
+ROSALIND Is he of God's making? What manner of man? Is his
+ head worth a hat, or his chin worth a beard?
+
+CELIA Nay, he hath but a little beard.
+
+ROSALIND Why, God will send more, if the man will be
+ thankful: let me stay the growth of his beard, if
+ thou delay me not the knowledge of his chin.
+
+CELIA It is young Orlando, that tripped up the wrestler's
+ heels and your heart both in an instant.
+
+ROSALIND Nay, but the devil take mocking: speak, sad brow and
+ true maid.
+
+CELIA I' faith, coz, 'tis he.
+
+ROSALIND Orlando?
+
+CELIA Orlando.
+
+ROSALIND Alas the day! what shall I do with my doublet and
+ hose? What did he when thou sawest him? What said
+ he? How looked he? Wherein went he? What makes
+ him here? Did he ask for me? Where remains he?
+ How parted he with thee? and when shalt thou see
+ him again? Answer me in one word.
+
+CELIA You must borrow me Gargantua's mouth first: 'tis a
+ word too great for any mouth of this age's size. To
+ say ay and no to these particulars is more than to
+ answer in a catechism.
+
+ROSALIND But doth he know that I am in this forest and in
+ man's apparel? Looks he as freshly as he did the
+ day he wrestled?
+
+CELIA It is as easy to count atomies as to resolve the
+ propositions of a lover; but take a taste of my
+ finding him, and relish it with good observance.
+ I found him under a tree, like a dropped acorn.
+
+ROSALIND It may well be called Jove's tree, when it drops
+ forth such fruit.
+
+CELIA Give me audience, good madam.
+
+ROSALIND Proceed.
+
+CELIA There lay he, stretched along, like a wounded knight.
+
+ROSALIND Though it be pity to see such a sight, it well
+ becomes the ground.
+
+CELIA Cry 'holla' to thy tongue, I prithee; it curvets
+ unseasonably. He was furnished like a hunter.
+
+ROSALIND O, ominous! he comes to kill my heart.
+
+CELIA I would sing my song without a burden: thou bringest
+ me out of tune.
+
+ROSALIND Do you not know I am a woman? when I think, I must
+ speak. Sweet, say on.
+
+CELIA You bring me out. Soft! comes he not here?
+
+ [Enter ORLANDO and JAQUES]
+
+ROSALIND 'Tis he: slink by, and note him.
+
+JAQUES I thank you for your company; but, good faith, I had
+ as lief have been myself alone.
+
+ORLANDO And so had I; but yet, for fashion sake, I thank you
+ too for your society.
+
+JAQUES God be wi' you: let's meet as little as we can.
+
+ORLANDO I do desire we may be better strangers.
+
+JAQUES I pray you, mar no more trees with writing
+ love-songs in their barks.
+
+ORLANDO I pray you, mar no more of my verses with reading
+ them ill-favouredly.
+
+JAQUES Rosalind is your love's name?
+
+ORLANDO Yes, just.
+
+JAQUES I do not like her name.
+
+ORLANDO There was no thought of pleasing you when she was
+ christened.
+
+JAQUES What stature is she of?
+
+ORLANDO Just as high as my heart.
+
+JAQUES You are full of pretty answers. Have you not been
+ acquainted with goldsmiths' wives, and conned them
+ out of rings?
+
+ORLANDO Not so; but I answer you right painted cloth, from
+ whence you have studied your questions.
+
+JAQUES You have a nimble wit: I think 'twas made of
+ Atalanta's heels. Will you sit down with me? and
+ we two will rail against our mistress the world and
+ all our misery.
+
+ORLANDO I will chide no breather in the world but myself,
+ against whom I know most faults.
+
+JAQUES The worst fault you have is to be in love.
+
+ORLANDO 'Tis a fault I will not change for your best virtue.
+ I am weary of you.
+
+JAQUES By my troth, I was seeking for a fool when I found
+ you.
+
+ORLANDO He is drowned in the brook: look but in, and you
+ shall see him.
+
+JAQUES There I shall see mine own figure.
+
+ORLANDO Which I take to be either a fool or a cipher.
+
+JAQUES I'll tarry no longer with you: farewell, good
+ Signior Love.
+
+ORLANDO I am glad of your departure: adieu, good Monsieur
+ Melancholy.
+
+ [Exit JAQUES]
+
+ROSALIND [Aside to CELIA] I will speak to him, like a saucy
+ lackey and under that habit play the knave with him.
+ Do you hear, forester?
+
+ORLANDO Very well: what would you?
+
+ROSALIND I pray you, what is't o'clock?
+
+ORLANDO You should ask me what time o' day: there's no clock
+ in the forest.
+
+ROSALIND Then there is no true lover in the forest; else
+ sighing every minute and groaning every hour would
+ detect the lazy foot of Time as well as a clock.
+
+ORLANDO And why not the swift foot of Time? had not that
+ been as proper?
+
+ROSALIND By no means, sir: Time travels in divers paces with
+ divers persons. I'll tell you who Time ambles
+ withal, who Time trots withal, who Time gallops
+ withal and who he stands still withal.
+
+ORLANDO I prithee, who doth he trot withal?
+
+ROSALIND Marry, he trots hard with a young maid between the
+ contract of her marriage and the day it is
+ solemnized: if the interim be but a se'nnight,
+ Time's pace is so hard that it seems the length of
+ seven year.
+
+ORLANDO Who ambles Time withal?
+
+ROSALIND With a priest that lacks Latin and a rich man that
+ hath not the gout, for the one sleeps easily because
+ he cannot study, and the other lives merrily because
+ he feels no pain, the one lacking the burden of lean
+ and wasteful learning, the other knowing no burden
+ of heavy tedious penury; these Time ambles withal.
+
+ORLANDO Who doth he gallop withal?
+
+ROSALIND With a thief to the gallows, for though he go as
+ softly as foot can fall, he thinks himself too soon there.
+
+ORLANDO Who stays it still withal?
+
+ROSALIND With lawyers in the vacation, for they sleep between
+ term and term and then they perceive not how Time moves.
+
+ORLANDO Where dwell you, pretty youth?
+
+ROSALIND With this shepherdess, my sister; here in the
+ skirts of the forest, like fringe upon a petticoat.
+
+ORLANDO Are you native of this place?
+
+ROSALIND As the cony that you see dwell where she is kindled.
+
+ORLANDO Your accent is something finer than you could
+ purchase in so removed a dwelling.
+
+ROSALIND I have been told so of many: but indeed an old
+ religious uncle of mine taught me to speak, who was
+ in his youth an inland man; one that knew courtship
+ too well, for there he fell in love. I have heard
+ him read many lectures against it, and I thank God
+ I am not a woman, to be touched with so many
+ giddy offences as he hath generally taxed their
+ whole sex withal.
+
+ORLANDO Can you remember any of the principal evils that he
+ laid to the charge of women?
+
+ROSALIND There were none principal; they were all like one
+ another as half-pence are, every one fault seeming
+ monstrous till his fellow fault came to match it.
+
+ORLANDO I prithee, recount some of them.
+
+ROSALIND No, I will not cast away my physic but on those that
+ are sick. There is a man haunts the forest, that
+ abuses our young plants with carving 'Rosalind' on
+ their barks; hangs odes upon hawthorns and elegies
+ on brambles, all, forsooth, deifying the name of
+ Rosalind: if I could meet that fancy-monger I would
+ give him some good counsel, for he seems to have the
+ quotidian of love upon him.
+
+ORLANDO I am he that is so love-shaked: I pray you tell me
+ your remedy.
+
+ROSALIND There is none of my uncle's marks upon you: he
+ taught me how to know a man in love; in which cage
+ of rushes I am sure you are not prisoner.
+
+ORLANDO What were his marks?
+
+ROSALIND A lean cheek, which you have not, a blue eye and
+ sunken, which you have not, an unquestionable
+ spirit, which you have not, a beard neglected,
+ which you have not; but I pardon you for that, for
+ simply your having in beard is a younger brother's
+ revenue: then your hose should be ungartered, your
+ bonnet unbanded, your sleeve unbuttoned, your shoe
+ untied and every thing about you demonstrating a
+ careless desolation; but you are no such man; you
+ are rather point-device in your accoutrements as
+ loving yourself than seeming the lover of any other.
+
+ORLANDO Fair youth, I would I could make thee believe I love.
+
+ROSALIND Me believe it! you may as soon make her that you
+ love believe it; which, I warrant, she is apter to
+ do than to confess she does: that is one of the
+ points in the which women still give the lie to
+ their consciences. But, in good sooth, are you he
+ that hangs the verses on the trees, wherein Rosalind
+ is so admired?
+
+ORLANDO I swear to thee, youth, by the white hand of
+ Rosalind, I am that he, that unfortunate he.
+
+ROSALIND But are you so much in love as your rhymes speak?
+
+ORLANDO Neither rhyme nor reason can express how much.
+
+ROSALIND Love is merely a madness, and, I tell you, deserves
+ as well a dark house and a whip as madmen do: and
+ the reason why they are not so punished and cured
+ is, that the lunacy is so ordinary that the whippers
+ are in love too. Yet I profess curing it by counsel.
+
+ORLANDO Did you ever cure any so?
+
+ROSALIND Yes, one, and in this manner. He was to imagine me
+ his love, his mistress; and I set him every day to
+ woo me: at which time would I, being but a moonish
+ youth, grieve, be effeminate, changeable, longing
+ and liking, proud, fantastical, apish, shallow,
+ inconstant, full of tears, full of smiles, for every
+ passion something and for no passion truly any
+ thing, as boys and women are for the most part
+ cattle of this colour; would now like him, now loathe
+ him; then entertain him, then forswear him; now weep
+ for him, then spit at him; that I drave my suitor
+ from his mad humour of love to a living humour of
+ madness; which was, to forswear the full stream of
+ the world, and to live in a nook merely monastic.
+ And thus I cured him; and this way will I take upon
+ me to wash your liver as clean as a sound sheep's
+ heart, that there shall not be one spot of love in't.
+
+ORLANDO I would not be cured, youth.
+
+ROSALIND I would cure you, if you would but call me Rosalind
+ and come every day to my cote and woo me.
+
+ORLANDO Now, by the faith of my love, I will: tell me
+ where it is.
+
+ROSALIND Go with me to it and I'll show it you and by the way
+ you shall tell me where in the forest you live.
+ Will you go?
+
+ORLANDO With all my heart, good youth.
+
+ROSALIND Nay you must call me Rosalind. Come, sister, will you go?
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT III
+
+
+
+SCENE III The forest.
+
+
+ [Enter TOUCHSTONE and AUDREY; JAQUES behind]
+
+TOUCHSTONE Come apace, good Audrey: I will fetch up your
+ goats, Audrey. And how, Audrey? am I the man yet?
+ doth my simple feature content you?
+
+AUDREY Your features! Lord warrant us! what features!
+
+TOUCHSTONE I am here with thee and thy goats, as the most
+ capricious poet, honest Ovid, was among the Goths.
+
+JAQUES [Aside] O knowledge ill-inhabited, worse than Jove
+ in a thatched house!
+
+TOUCHSTONE When a man's verses cannot be understood, nor a
+ man's good wit seconded with the forward child
+ Understanding, it strikes a man more dead than a
+ great reckoning in a little room. Truly, I would
+ the gods had made thee poetical.
+
+AUDREY I do not know what 'poetical' is: is it honest in
+ deed and word? is it a true thing?
+
+TOUCHSTONE No, truly; for the truest poetry is the most
+ feigning; and lovers are given to poetry, and what
+ they swear in poetry may be said as lovers they do feign.
+
+AUDREY Do you wish then that the gods had made me poetical?
+
+TOUCHSTONE I do, truly; for thou swearest to me thou art
+ honest: now, if thou wert a poet, I might have some
+ hope thou didst feign.
+
+AUDREY Would you not have me honest?
+
+TOUCHSTONE No, truly, unless thou wert hard-favoured; for
+ honesty coupled to beauty is to have honey a sauce to sugar.
+
+JAQUES [Aside] A material fool!
+
+AUDREY Well, I am not fair; and therefore I pray the gods
+ make me honest.
+
+TOUCHSTONE Truly, and to cast away honesty upon a foul slut
+ were to put good meat into an unclean dish.
+
+AUDREY I am not a slut, though I thank the gods I am foul.
+
+TOUCHSTONE Well, praised be the gods for thy foulness!
+ sluttishness may come hereafter. But be it as it may
+ be, I will marry thee, and to that end I have been
+ with Sir Oliver Martext, the vicar of the next
+ village, who hath promised to meet me in this place
+ of the forest and to couple us.
+
+JAQUES [Aside] I would fain see this meeting.
+
+AUDREY Well, the gods give us joy!
+
+TOUCHSTONE Amen. A man may, if he were of a fearful heart,
+ stagger in this attempt; for here we have no temple
+ but the wood, no assembly but horn-beasts. But what
+ though? Courage! As horns are odious, they are
+ necessary. It is said, 'many a man knows no end of
+ his goods:' right; many a man has good horns, and
+ knows no end of them. Well, that is the dowry of
+ his wife; 'tis none of his own getting. Horns?
+ Even so. Poor men alone? No, no; the noblest deer
+ hath them as huge as the rascal. Is the single man
+ therefore blessed? No: as a walled town is more
+ worthier than a village, so is the forehead of a
+ married man more honourable than the bare brow of a
+ bachelor; and by how much defence is better than no
+ skill, by so much is a horn more precious than to
+ want. Here comes Sir Oliver.
+
+ [Enter SIR OLIVER MARTEXT]
+
+ Sir Oliver Martext, you are well met: will you
+ dispatch us here under this tree, or shall we go
+ with you to your chapel?
+
+SIR OLIVER MARTEXT Is there none here to give the woman?
+
+TOUCHSTONE I will not take her on gift of any man.
+
+SIR OLIVER MARTEXT Truly, she must be given, or the marriage is not lawful.
+
+JAQUES [Advancing]
+
+ Proceed, proceed I'll give her.
+
+TOUCHSTONE Good even, good Master What-ye-call't: how do you,
+ sir? You are very well met: God 'ild you for your
+ last company: I am very glad to see you: even a
+ toy in hand here, sir: nay, pray be covered.
+
+JAQUES Will you be married, motley?
+
+TOUCHSTONE As the ox hath his bow, sir, the horse his curb and
+ the falcon her bells, so man hath his desires; and
+ as pigeons bill, so wedlock would be nibbling.
+
+JAQUES And will you, being a man of your breeding, be
+ married under a bush like a beggar? Get you to
+ church, and have a good priest that can tell you
+ what marriage is: this fellow will but join you
+ together as they join wainscot; then one of you will
+ prove a shrunk panel and, like green timber, warp, warp.
+
+TOUCHSTONE [Aside] I am not in the mind but I were better to be
+ married of him than of another: for he is not like
+ to marry me well; and not being well married, it
+ will be a good excuse for me hereafter to leave my wife.
+
+JAQUES Go thou with me, and let me counsel thee.
+
+TOUCHSTONE 'Come, sweet Audrey:
+ We must be married, or we must live in bawdry.
+ Farewell, good Master Oliver: not,--
+ O sweet Oliver,
+ O brave Oliver,
+ Leave me not behind thee: but,--
+ Wind away,
+ Begone, I say,
+ I will not to wedding with thee.
+
+ [Exeunt JAQUES, TOUCHSTONE and AUDREY]
+
+SIR OLIVER MARTEXT 'Tis no matter: ne'er a fantastical knave of them
+ all shall flout me out of my calling.
+
+ [Exit]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT III
+
+
+
+SCENE IV The forest.
+
+
+ [Enter ROSALIND and CELIA]
+
+ROSALIND Never talk to me; I will weep.
+
+CELIA Do, I prithee; but yet have the grace to consider
+ that tears do not become a man.
+
+ROSALIND But have I not cause to weep?
+
+CELIA As good cause as one would desire; therefore weep.
+
+ROSALIND His very hair is of the dissembling colour.
+
+CELIA Something browner than Judas's marry, his kisses are
+ Judas's own children.
+
+ROSALIND I' faith, his hair is of a good colour.
+
+CELIA An excellent colour: your chestnut was ever the only colour.
+
+ROSALIND And his kissing is as full of sanctity as the touch
+ of holy bread.
+
+CELIA He hath bought a pair of cast lips of Diana: a nun
+ of winter's sisterhood kisses not more religiously;
+ the very ice of chastity is in them.
+
+ROSALIND But why did he swear he would come this morning, and
+ comes not?
+
+CELIA Nay, certainly, there is no truth in him.
+
+ROSALIND Do you think so?
+
+CELIA Yes; I think he is not a pick-purse nor a
+ horse-stealer, but for his verity in love, I do
+ think him as concave as a covered goblet or a
+ worm-eaten nut.
+
+ROSALIND Not true in love?
+
+CELIA Yes, when he is in; but I think he is not in.
+
+ROSALIND You have heard him swear downright he was.
+
+CELIA 'Was' is not 'is:' besides, the oath of a lover is
+ no stronger than the word of a tapster; they are
+ both the confirmer of false reckonings. He attends
+ here in the forest on the duke your father.
+
+ROSALIND I met the duke yesterday and had much question with
+ him: he asked me of what parentage I was; I told
+ him, of as good as he; so he laughed and let me go.
+ But what talk we of fathers, when there is such a
+ man as Orlando?
+
+CELIA O, that's a brave man! he writes brave verses,
+ speaks brave words, swears brave oaths and breaks
+ them bravely, quite traverse, athwart the heart of
+ his lover; as a puisny tilter, that spurs his horse
+ but on one side, breaks his staff like a noble
+ goose: but all's brave that youth mounts and folly
+ guides. Who comes here?
+
+ [Enter CORIN]
+
+CORIN Mistress and master, you have oft inquired
+ After the shepherd that complain'd of love,
+ Who you saw sitting by me on the turf,
+ Praising the proud disdainful shepherdess
+ That was his mistress.
+
+CELIA Well, and what of him?
+
+CORIN If you will see a pageant truly play'd,
+ Between the pale complexion of true love
+ And the red glow of scorn and proud disdain,
+ Go hence a little and I shall conduct you,
+ If you will mark it.
+
+ROSALIND O, come, let us remove:
+ The sight of lovers feedeth those in love.
+ Bring us to this sight, and you shall say
+ I'll prove a busy actor in their play.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT III
+
+
+
+SCENE V Another part of the forest.
+
+
+ [Enter SILVIUS and PHEBE]
+
+SILVIUS Sweet Phebe, do not scorn me; do not, Phebe;
+ Say that you love me not, but say not so
+ In bitterness. The common executioner,
+ Whose heart the accustom'd sight of death makes hard,
+ Falls not the axe upon the humbled neck
+ But first begs pardon: will you sterner be
+ Than he that dies and lives by bloody drops?
+
+ [Enter ROSALIND, CELIA, and CORIN, behind]
+
+PHEBE I would not be thy executioner:
+ I fly thee, for I would not injure thee.
+ Thou tell'st me there is murder in mine eye:
+ 'Tis pretty, sure, and very probable,
+ That eyes, that are the frail'st and softest things,
+ Who shut their coward gates on atomies,
+ Should be call'd tyrants, butchers, murderers!
+ Now I do frown on thee with all my heart;
+ And if mine eyes can wound, now let them kill thee:
+ Now counterfeit to swoon; why now fall down;
+ Or if thou canst not, O, for shame, for shame,
+ Lie not, to say mine eyes are murderers!
+ Now show the wound mine eye hath made in thee:
+ Scratch thee but with a pin, and there remains
+ Some scar of it; lean but upon a rush,
+ The cicatrice and capable impressure
+ Thy palm some moment keeps; but now mine eyes,
+ Which I have darted at thee, hurt thee not,
+ Nor, I am sure, there is no force in eyes
+ That can do hurt.
+
+SILVIUS O dear Phebe,
+ If ever,--as that ever may be near,--
+ You meet in some fresh cheek the power of fancy,
+ Then shall you know the wounds invisible
+ That love's keen arrows make.
+
+PHEBE But till that time
+ Come not thou near me: and when that time comes,
+ Afflict me with thy mocks, pity me not;
+ As till that time I shall not pity thee.
+
+ROSALIND And why, I pray you? Who might be your mother,
+ That you insult, exult, and all at once,
+ Over the wretched? What though you have no beauty,--
+ As, by my faith, I see no more in you
+ Than without candle may go dark to bed--
+ Must you be therefore proud and pitiless?
+ Why, what means this? Why do you look on me?
+ I see no more in you than in the ordinary
+ Of nature's sale-work. 'Od's my little life,
+ I think she means to tangle my eyes too!
+ No, faith, proud mistress, hope not after it:
+ 'Tis not your inky brows, your black silk hair,
+ Your bugle eyeballs, nor your cheek of cream,
+ That can entame my spirits to your worship.
+ You foolish shepherd, wherefore do you follow her,
+ Like foggy south puffing with wind and rain?
+ You are a thousand times a properer man
+ Than she a woman: 'tis such fools as you
+ That makes the world full of ill-favour'd children:
+ 'Tis not her glass, but you, that flatters her;
+ And out of you she sees herself more proper
+ Than any of her lineaments can show her.
+ But, mistress, know yourself: down on your knees,
+ And thank heaven, fasting, for a good man's love:
+ For I must tell you friendly in your ear,
+ Sell when you can: you are not for all markets:
+ Cry the man mercy; love him; take his offer:
+ Foul is most foul, being foul to be a scoffer.
+ So take her to thee, shepherd: fare you well.
+
+PHEBE Sweet youth, I pray you, chide a year together:
+ I had rather hear you chide than this man woo.
+
+ROSALIND He's fallen in love with your foulness and she'll
+ fall in love with my anger. If it be so, as fast as
+ she answers thee with frowning looks, I'll sauce her
+ with bitter words. Why look you so upon me?
+
+PHEBE For no ill will I bear you.
+
+ROSALIND I pray you, do not fall in love with me,
+ For I am falser than vows made in wine:
+ Besides, I like you not. If you will know my house,
+ 'Tis at the tuft of olives here hard by.
+ Will you go, sister? Shepherd, ply her hard.
+ Come, sister. Shepherdess, look on him better,
+ And be not proud: though all the world could see,
+ None could be so abused in sight as he.
+ Come, to our flock.
+
+ [Exeunt ROSALIND, CELIA and CORIN]
+
+PHEBE Dead Shepherd, now I find thy saw of might,
+ 'Who ever loved that loved not at first sight?'
+
+SILVIUS Sweet Phebe,--
+
+PHEBE Ha, what say'st thou, Silvius?
+
+SILVIUS Sweet Phebe, pity me.
+
+PHEBE Why, I am sorry for thee, gentle Silvius.
+
+SILVIUS Wherever sorrow is, relief would be:
+ If you do sorrow at my grief in love,
+ By giving love your sorrow and my grief
+ Were both extermined.
+
+PHEBE Thou hast my love: is not that neighbourly?
+
+SILVIUS I would have you.
+
+PHEBE Why, that were covetousness.
+ Silvius, the time was that I hated thee,
+ And yet it is not that I bear thee love;
+ But since that thou canst talk of love so well,
+ Thy company, which erst was irksome to me,
+ I will endure, and I'll employ thee too:
+ But do not look for further recompense
+ Than thine own gladness that thou art employ'd.
+
+SILVIUS So holy and so perfect is my love,
+ And I in such a poverty of grace,
+ That I shall think it a most plenteous crop
+ To glean the broken ears after the man
+ That the main harvest reaps: loose now and then
+ A scatter'd smile, and that I'll live upon.
+
+PHEBE Know'st now the youth that spoke to me erewhile?
+
+SILVIUS Not very well, but I have met him oft;
+ And he hath bought the cottage and the bounds
+ That the old carlot once was master of.
+
+PHEBE Think not I love him, though I ask for him:
+ 'Tis but a peevish boy; yet he talks well;
+ But what care I for words? yet words do well
+ When he that speaks them pleases those that hear.
+ It is a pretty youth: not very pretty:
+ But, sure, he's proud, and yet his pride becomes him:
+ He'll make a proper man: the best thing in him
+ Is his complexion; and faster than his tongue
+ Did make offence his eye did heal it up.
+ He is not very tall; yet for his years he's tall:
+ His leg is but so so; and yet 'tis well:
+ There was a pretty redness in his lip,
+ A little riper and more lusty red
+ Than that mix'd in his cheek; 'twas just the difference
+ Between the constant red and mingled damask.
+ There be some women, Silvius, had they mark'd him
+ In parcels as I did, would have gone near
+ To fall in love with him; but, for my part,
+ I love him not nor hate him not; and yet
+ I have more cause to hate him than to love him:
+ For what had he to do to chide at me?
+ He said mine eyes were black and my hair black:
+ And, now I am remember'd, scorn'd at me:
+ I marvel why I answer'd not again:
+ But that's all one; omittance is no quittance.
+ I'll write to him a very taunting letter,
+ And thou shalt bear it: wilt thou, Silvius?
+
+SILVIUS Phebe, with all my heart.
+
+PHEBE I'll write it straight;
+ The matter's in my head and in my heart:
+ I will be bitter with him and passing short.
+ Go with me, Silvius.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT IV
+
+
+
+SCENE I The forest.
+
+
+ [Enter ROSALIND, CELIA, and JAQUES]
+
+JAQUES I prithee, pretty youth, let me be better acquainted
+ with thee.
+
+ROSALIND They say you are a melancholy fellow.
+
+JAQUES I am so; I do love it better than laughing.
+
+ROSALIND Those that are in extremity of either are abominable
+ fellows and betray themselves to every modern
+ censure worse than drunkards.
+
+JAQUES Why, 'tis good to be sad and say nothing.
+
+ROSALIND Why then, 'tis good to be a post.
+
+JAQUES I have neither the scholar's melancholy, which is
+ emulation, nor the musician's, which is fantastical,
+ nor the courtier's, which is proud, nor the
+ soldier's, which is ambitious, nor the lawyer's,
+ which is politic, nor the lady's, which is nice, nor
+ the lover's, which is all these: but it is a
+ melancholy of mine own, compounded of many simples,
+ extracted from many objects, and indeed the sundry's
+ contemplation of my travels, in which my often
+ rumination wraps me m a most humorous sadness.
+
+ROSALIND A traveller! By my faith, you have great reason to
+ be sad: I fear you have sold your own lands to see
+ other men's; then, to have seen much and to have
+ nothing, is to have rich eyes and poor hands.
+
+JAQUES Yes, I have gained my experience.
+
+ROSALIND And your experience makes you sad: I had rather have
+ a fool to make me merry than experience to make me
+ sad; and to travel for it too!
+
+ [Enter ORLANDO]
+
+ORLANDO Good day and happiness, dear Rosalind!
+
+JAQUES Nay, then, God be wi' you, an you talk in blank verse.
+
+ [Exit]
+
+ROSALIND Farewell, Monsieur Traveller: look you lisp and
+ wear strange suits, disable all the benefits of your
+ own country, be out of love with your nativity and
+ almost chide God for making you that countenance you
+ are, or I will scarce think you have swam in a
+ gondola. Why, how now, Orlando! where have you been
+ all this while? You a lover! An you serve me such
+ another trick, never come in my sight more.
+
+ORLANDO My fair Rosalind, I come within an hour of my promise.
+
+ROSALIND Break an hour's promise in love! He that will
+ divide a minute into a thousand parts and break but
+ a part of the thousandth part of a minute in the
+ affairs of love, it may be said of him that Cupid
+ hath clapped him o' the shoulder, but I'll warrant
+ him heart-whole.
+
+ORLANDO Pardon me, dear Rosalind.
+
+ROSALIND Nay, an you be so tardy, come no more in my sight: I
+ had as lief be wooed of a snail.
+
+ORLANDO Of a snail?
+
+ROSALIND Ay, of a snail; for though he comes slowly, he
+ carries his house on his head; a better jointure,
+ I think, than you make a woman: besides he brings
+ his destiny with him.
+
+ORLANDO What's that?
+
+ROSALIND Why, horns, which such as you are fain to be
+ beholding to your wives for: but he comes armed in
+ his fortune and prevents the slander of his wife.
+
+ORLANDO Virtue is no horn-maker; and my Rosalind is virtuous.
+
+ROSALIND And I am your Rosalind.
+
+CELIA It pleases him to call you so; but he hath a
+ Rosalind of a better leer than you.
+
+ROSALIND Come, woo me, woo me, for now I am in a holiday
+ humour and like enough to consent. What would you
+ say to me now, an I were your very very Rosalind?
+
+ORLANDO I would kiss before I spoke.
+
+ROSALIND Nay, you were better speak first, and when you were
+ gravelled for lack of matter, you might take
+ occasion to kiss. Very good orators, when they are
+ out, they will spit; and for lovers lacking--God
+ warn us!--matter, the cleanliest shift is to kiss.
+
+ORLANDO How if the kiss be denied?
+
+ROSALIND Then she puts you to entreaty, and there begins new matter.
+
+ORLANDO Who could be out, being before his beloved mistress?
+
+ROSALIND Marry, that should you, if I were your mistress, or
+ I should think my honesty ranker than my wit.
+
+ORLANDO What, of my suit?
+
+ROSALIND Not out of your apparel, and yet out of your suit.
+ Am not I your Rosalind?
+
+ORLANDO I take some joy to say you are, because I would be
+ talking of her.
+
+ROSALIND Well in her person I say I will not have you.
+
+ORLANDO Then in mine own person I die.
+
+ROSALIND No, faith, die by attorney. The poor world is
+ almost six thousand years old, and in all this time
+ there was not any man died in his own person,
+ videlicit, in a love-cause. Troilus had his brains
+ dashed out with a Grecian club; yet he did what he
+ could to die before, and he is one of the patterns
+ of love. Leander, he would have lived many a fair
+ year, though Hero had turned nun, if it had not been
+ for a hot midsummer night; for, good youth, he went
+ but forth to wash him in the Hellespont and being
+ taken with the cramp was drowned and the foolish
+ coroners of that age found it was 'Hero of Sestos.'
+ But these are all lies: men have died from time to
+ time and worms have eaten them, but not for love.
+
+ORLANDO I would not have my right Rosalind of this mind,
+ for, I protest, her frown might kill me.
+
+ROSALIND By this hand, it will not kill a fly. But come, now
+ I will be your Rosalind in a more coming-on
+ disposition, and ask me what you will. I will grant
+ it.
+
+ORLANDO Then love me, Rosalind.
+
+ROSALIND Yes, faith, will I, Fridays and Saturdays and all.
+
+ORLANDO And wilt thou have me?
+
+ROSALIND Ay, and twenty such.
+
+ORLANDO What sayest thou?
+
+ROSALIND Are you not good?
+
+ORLANDO I hope so.
+
+ROSALIND Why then, can one desire too much of a good thing?
+ Come, sister, you shall be the priest and marry us.
+ Give me your hand, Orlando. What do you say, sister?
+
+ORLANDO Pray thee, marry us.
+
+CELIA I cannot say the words.
+
+ROSALIND You must begin, 'Will you, Orlando--'
+
+CELIA Go to. Will you, Orlando, have to wife this Rosalind?
+
+ORLANDO I will.
+
+ROSALIND Ay, but when?
+
+ORLANDO Why now; as fast as she can marry us.
+
+ROSALIND Then you must say 'I take thee, Rosalind, for wife.'
+
+ORLANDO I take thee, Rosalind, for wife.
+
+ROSALIND I might ask you for your commission; but I do take
+ thee, Orlando, for my husband: there's a girl goes
+ before the priest; and certainly a woman's thought
+ runs before her actions.
+
+ORLANDO So do all thoughts; they are winged.
+
+ROSALIND Now tell me how long you would have her after you
+ have possessed her.
+
+ORLANDO For ever and a day.
+
+ROSALIND Say 'a day,' without the 'ever.' No, no, Orlando;
+ men are April when they woo, December when they wed:
+ maids are May when they are maids, but the sky
+ changes when they are wives. I will be more jealous
+ of thee than a Barbary cock-pigeon over his hen,
+ more clamorous than a parrot against rain, more
+ new-fangled than an ape, more giddy in my desires
+ than a monkey: I will weep for nothing, like Diana
+ in the fountain, and I will do that when you are
+ disposed to be merry; I will laugh like a hyen, and
+ that when thou art inclined to sleep.
+
+ORLANDO But will my Rosalind do so?
+
+ROSALIND By my life, she will do as I do.
+
+ORLANDO O, but she is wise.
+
+ROSALIND Or else she could not have the wit to do this: the
+ wiser, the waywarder: make the doors upon a woman's
+ wit and it will out at the casement; shut that and
+ 'twill out at the key-hole; stop that, 'twill fly
+ with the smoke out at the chimney.
+
+ORLANDO A man that had a wife with such a wit, he might say
+ 'Wit, whither wilt?'
+
+ROSALIND Nay, you might keep that cheque for it till you met
+ your wife's wit going to your neighbour's bed.
+
+ORLANDO And what wit could wit have to excuse that?
+
+ROSALIND Marry, to say she came to seek you there. You shall
+ never take her without her answer, unless you take
+ her without her tongue. O, that woman that cannot
+ make her fault her husband's occasion, let her
+ never nurse her child herself, for she will breed
+ it like a fool!
+
+ORLANDO For these two hours, Rosalind, I will leave thee.
+
+ROSALIND Alas! dear love, I cannot lack thee two hours.
+
+ORLANDO I must attend the duke at dinner: by two o'clock I
+ will be with thee again.
+
+ROSALIND Ay, go your ways, go your ways; I knew what you
+ would prove: my friends told me as much, and I
+ thought no less: that flattering tongue of yours
+ won me: 'tis but one cast away, and so, come,
+ death! Two o'clock is your hour?
+
+ORLANDO Ay, sweet Rosalind.
+
+ROSALIND By my troth, and in good earnest, and so God mend
+ me, and by all pretty oaths that are not dangerous,
+ if you break one jot of your promise or come one
+ minute behind your hour, I will think you the most
+ pathetical break-promise and the most hollow lover
+ and the most unworthy of her you call Rosalind that
+ may be chosen out of the gross band of the
+ unfaithful: therefore beware my censure and keep
+ your promise.
+
+ORLANDO With no less religion than if thou wert indeed my
+ Rosalind: so adieu.
+
+ROSALIND Well, Time is the old justice that examines all such
+ offenders, and let Time try: adieu.
+
+ [Exit ORLANDO]
+
+CELIA You have simply misused our sex in your love-prate:
+ we must have your doublet and hose plucked over your
+ head, and show the world what the bird hath done to
+ her own nest.
+
+ROSALIND O coz, coz, coz, my pretty little coz, that thou
+ didst know how many fathom deep I am in love! But
+ it cannot be sounded: my affection hath an unknown
+ bottom, like the bay of Portugal.
+
+CELIA Or rather, bottomless, that as fast as you pour
+ affection in, it runs out.
+
+ROSALIND No, that same wicked bastard of Venus that was begot
+ of thought, conceived of spleen and born of madness,
+ that blind rascally boy that abuses every one's eyes
+ because his own are out, let him be judge how deep I
+ am in love. I'll tell thee, Aliena, I cannot be out
+ of the sight of Orlando: I'll go find a shadow and
+ sigh till he come.
+
+CELIA And I'll sleep.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT IV
+
+
+
+SCENE II The forest.
+
+
+ [Enter JAQUES, Lords, and Foresters]
+
+JAQUES Which is he that killed the deer?
+
+A Lord Sir, it was I.
+
+JAQUES Let's present him to the duke, like a Roman
+ conqueror; and it would do well to set the deer's
+ horns upon his head, for a branch of victory. Have
+ you no song, forester, for this purpose?
+
+Forester Yes, sir.
+
+JAQUES Sing it: 'tis no matter how it be in tune, so it
+ make noise enough.
+
+ SONG.
+Forester What shall he have that kill'd the deer?
+ His leather skin and horns to wear.
+ Then sing him home;
+
+ [The rest shall bear this burden]
+
+ Take thou no scorn to wear the horn;
+ It was a crest ere thou wast born:
+ Thy father's father wore it,
+ And thy father bore it:
+ The horn, the horn, the lusty horn
+ Is not a thing to laugh to scorn.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT IV
+
+
+
+SCENE III The forest.
+
+
+ [Enter ROSALIND and CELIA]
+
+ROSALIND How say you now? Is it not past two o'clock? and
+ here much Orlando!
+
+CELIA I warrant you, with pure love and troubled brain, he
+ hath ta'en his bow and arrows and is gone forth to
+ sleep. Look, who comes here.
+
+ [Enter SILVIUS]
+
+SILVIUS My errand is to you, fair youth;
+ My gentle Phebe bid me give you this:
+ I know not the contents; but, as I guess
+ By the stern brow and waspish action
+ Which she did use as she was writing of it,
+ It bears an angry tenor: pardon me:
+ I am but as a guiltless messenger.
+
+ROSALIND Patience herself would startle at this letter
+ And play the swaggerer; bear this, bear all:
+ She says I am not fair, that I lack manners;
+ She calls me proud, and that she could not love me,
+ Were man as rare as phoenix. 'Od's my will!
+ Her love is not the hare that I do hunt:
+ Why writes she so to me? Well, shepherd, well,
+ This is a letter of your own device.
+
+SILVIUS No, I protest, I know not the contents:
+ Phebe did write it.
+
+ROSALIND Come, come, you are a fool
+ And turn'd into the extremity of love.
+ I saw her hand: she has a leathern hand.
+ A freestone-colour'd hand; I verily did think
+ That her old gloves were on, but 'twas her hands:
+ She has a huswife's hand; but that's no matter:
+ I say she never did invent this letter;
+ This is a man's invention and his hand.
+
+SILVIUS Sure, it is hers.
+
+ROSALIND Why, 'tis a boisterous and a cruel style.
+ A style for-challengers; why, she defies me,
+ Like Turk to Christian: women's gentle brain
+ Could not drop forth such giant-rude invention
+ Such Ethiope words, blacker in their effect
+ Than in their countenance. Will you hear the letter?
+
+SILVIUS So please you, for I never heard it yet;
+ Yet heard too much of Phebe's cruelty.
+
+ROSALIND She Phebes me: mark how the tyrant writes.
+
+ [Reads]
+
+ Art thou god to shepherd turn'd,
+ That a maiden's heart hath burn'd?
+ Can a woman rail thus?
+
+SILVIUS Call you this railing?
+
+ROSALIND [Reads]
+
+ Why, thy godhead laid apart,
+ Warr'st thou with a woman's heart?
+ Did you ever hear such railing?
+ Whiles the eye of man did woo me,
+ That could do no vengeance to me.
+ Meaning me a beast.
+ If the scorn of your bright eyne
+ Have power to raise such love in mine,
+ Alack, in me what strange effect
+ Would they work in mild aspect!
+ Whiles you chid me, I did love;
+ How then might your prayers move!
+ He that brings this love to thee
+ Little knows this love in me:
+ And by him seal up thy mind;
+ Whether that thy youth and kind
+ Will the faithful offer take
+ Of me and all that I can make;
+ Or else by him my love deny,
+ And then I'll study how to die.
+
+SILVIUS Call you this chiding?
+
+CELIA Alas, poor shepherd!
+
+ROSALIND Do you pity him? no, he deserves no pity. Wilt
+ thou love such a woman? What, to make thee an
+ instrument and play false strains upon thee! not to
+ be endured! Well, go your way to her, for I see
+ love hath made thee a tame snake, and say this to
+ her: that if she love me, I charge her to love
+ thee; if she will not, I will never have her unless
+ thou entreat for her. If you be a true lover,
+ hence, and not a word; for here comes more company.
+
+ [Exit SILVIUS]
+
+ [Enter OLIVER]
+
+OLIVER Good morrow, fair ones: pray you, if you know,
+ Where in the purlieus of this forest stands
+ A sheep-cote fenced about with olive trees?
+
+CELIA West of this place, down in the neighbour bottom:
+ The rank of osiers by the murmuring stream
+ Left on your right hand brings you to the place.
+ But at this hour the house doth keep itself;
+ There's none within.
+
+OLIVER If that an eye may profit by a tongue,
+ Then should I know you by description;
+ Such garments and such years: 'The boy is fair,
+ Of female favour, and bestows himself
+ Like a ripe sister: the woman low
+ And browner than her brother.' Are not you
+ The owner of the house I did inquire for?
+
+CELIA It is no boast, being ask'd, to say we are.
+
+OLIVER Orlando doth commend him to you both,
+ And to that youth he calls his Rosalind
+ He sends this bloody napkin. Are you he?
+
+ROSALIND I am: what must we understand by this?
+
+OLIVER Some of my shame; if you will know of me
+ What man I am, and how, and why, and where
+ This handkercher was stain'd.
+
+CELIA I pray you, tell it.
+
+OLIVER When last the young Orlando parted from you
+ He left a promise to return again
+ Within an hour, and pacing through the forest,
+ Chewing the food of sweet and bitter fancy,
+ Lo, what befell! he threw his eye aside,
+ And mark what object did present itself:
+ Under an oak, whose boughs were moss'd with age
+ And high top bald with dry antiquity,
+ A wretched ragged man, o'ergrown with hair,
+ Lay sleeping on his back: about his neck
+ A green and gilded snake had wreathed itself,
+ Who with her head nimble in threats approach'd
+ The opening of his mouth; but suddenly,
+ Seeing Orlando, it unlink'd itself,
+ And with indented glides did slip away
+ Into a bush: under which bush's shade
+ A lioness, with udders all drawn dry,
+ Lay couching, head on ground, with catlike watch,
+ When that the sleeping man should stir; for 'tis
+ The royal disposition of that beast
+ To prey on nothing that doth seem as dead:
+ This seen, Orlando did approach the man
+ And found it was his brother, his elder brother.
+
+CELIA O, I have heard him speak of that same brother;
+ And he did render him the most unnatural
+ That lived amongst men.
+
+OLIVER And well he might so do,
+ For well I know he was unnatural.
+
+ROSALIND But, to Orlando: did he leave him there,
+ Food to the suck'd and hungry lioness?
+
+OLIVER Twice did he turn his back and purposed so;
+ But kindness, nobler ever than revenge,
+ And nature, stronger than his just occasion,
+ Made him give battle to the lioness,
+ Who quickly fell before him: in which hurtling
+ From miserable slumber I awaked.
+
+CELIA Are you his brother?
+
+ROSALIND Wast you he rescued?
+
+CELIA Was't you that did so oft contrive to kill him?
+
+OLIVER 'Twas I; but 'tis not I I do not shame
+ To tell you what I was, since my conversion
+ So sweetly tastes, being the thing I am.
+
+ROSALIND But, for the bloody napkin?
+
+OLIVER By and by.
+ When from the first to last betwixt us two
+ Tears our recountments had most kindly bathed,
+ As how I came into that desert place:--
+ In brief, he led me to the gentle duke,
+ Who gave me fresh array and entertainment,
+ Committing me unto my brother's love;
+ Who led me instantly unto his cave,
+ There stripp'd himself, and here upon his arm
+ The lioness had torn some flesh away,
+ Which all this while had bled; and now he fainted
+ And cried, in fainting, upon Rosalind.
+ Brief, I recover'd him, bound up his wound;
+ And, after some small space, being strong at heart,
+ He sent me hither, stranger as I am,
+ To tell this story, that you might excuse
+ His broken promise, and to give this napkin
+ Dyed in his blood unto the shepherd youth
+ That he in sport doth call his Rosalind.
+
+ [ROSALIND swoons]
+
+CELIA Why, how now, Ganymede! sweet Ganymede!
+
+OLIVER Many will swoon when they do look on blood.
+
+CELIA There is more in it. Cousin Ganymede!
+
+OLIVER Look, he recovers.
+
+ROSALIND I would I were at home.
+
+CELIA We'll lead you thither.
+ I pray you, will you take him by the arm?
+
+OLIVER Be of good cheer, youth: you a man! you lack a
+ man's heart.
+
+ROSALIND I do so, I confess it. Ah, sirrah, a body would
+ think this was well counterfeited! I pray you, tell
+ your brother how well I counterfeited. Heigh-ho!
+
+OLIVER This was not counterfeit: there is too great
+ testimony in your complexion that it was a passion
+ of earnest.
+
+ROSALIND Counterfeit, I assure you.
+
+OLIVER Well then, take a good heart and counterfeit to be a man.
+
+ROSALIND So I do: but, i' faith, I should have been a woman by right.
+
+CELIA Come, you look paler and paler: pray you, draw
+ homewards. Good sir, go with us.
+
+OLIVER That will I, for I must bear answer back
+ How you excuse my brother, Rosalind.
+
+ROSALIND I shall devise something: but, I pray you, commend
+ my counterfeiting to him. Will you go?
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT V
+
+
+
+SCENE I The forest.
+
+
+ [Enter TOUCHSTONE and AUDREY]
+
+TOUCHSTONE We shall find a time, Audrey; patience, gentle Audrey.
+
+AUDREY Faith, the priest was good enough, for all the old
+ gentleman's saying.
+
+TOUCHSTONE A most wicked Sir Oliver, Audrey, a most vile
+ Martext. But, Audrey, there is a youth here in the
+ forest lays claim to you.
+
+AUDREY Ay, I know who 'tis; he hath no interest in me in
+ the world: here comes the man you mean.
+
+TOUCHSTONE It is meat and drink to me to see a clown: by my
+ troth, we that have good wits have much to answer
+ for; we shall be flouting; we cannot hold.
+
+ [Enter WILLIAM]
+
+WILLIAM Good even, Audrey.
+
+AUDREY God ye good even, William.
+
+WILLIAM And good even to you, sir.
+
+TOUCHSTONE Good even, gentle friend. Cover thy head, cover thy
+ head; nay, prithee, be covered. How old are you, friend?
+
+WILLIAM Five and twenty, sir.
+
+TOUCHSTONE A ripe age. Is thy name William?
+
+WILLIAM William, sir.
+
+TOUCHSTONE A fair name. Wast born i' the forest here?
+
+WILLIAM Ay, sir, I thank God.
+
+TOUCHSTONE 'Thank God;' a good answer. Art rich?
+
+WILLIAM Faith, sir, so so.
+
+TOUCHSTONE 'So so' is good, very good, very excellent good; and
+ yet it is not; it is but so so. Art thou wise?
+
+WILLIAM Ay, sir, I have a pretty wit.
+
+TOUCHSTONE Why, thou sayest well. I do now remember a saying,
+ 'The fool doth think he is wise, but the wise man
+ knows himself to be a fool.' The heathen
+ philosopher, when he had a desire to eat a grape,
+ would open his lips when he put it into his mouth;
+ meaning thereby that grapes were made to eat and
+ lips to open. You do love this maid?
+
+WILLIAM I do, sir.
+
+TOUCHSTONE Give me your hand. Art thou learned?
+
+WILLIAM No, sir.
+
+TOUCHSTONE Then learn this of me: to have, is to have; for it
+ is a figure in rhetoric that drink, being poured out
+ of a cup into a glass, by filling the one doth empty
+ the other; for all your writers do consent that ipse
+ is he: now, you are not ipse, for I am he.
+
+WILLIAM Which he, sir?
+
+TOUCHSTONE He, sir, that must marry this woman. Therefore, you
+ clown, abandon,--which is in the vulgar leave,--the
+ society,--which in the boorish is company,--of this
+ female,--which in the common is woman; which
+ together is, abandon the society of this female, or,
+ clown, thou perishest; or, to thy better
+ understanding, diest; or, to wit I kill thee, make
+ thee away, translate thy life into death, thy
+ liberty into bondage: I will deal in poison with
+ thee, or in bastinado, or in steel; I will bandy
+ with thee in faction; I will o'errun thee with
+ policy; I will kill thee a hundred and fifty ways:
+ therefore tremble and depart.
+
+AUDREY Do, good William.
+
+WILLIAM God rest you merry, sir.
+
+ [Exit]
+
+ [Enter CORIN]
+
+CORIN Our master and mistress seeks you; come, away, away!
+
+TOUCHSTONE Trip, Audrey! trip, Audrey! I attend, I attend.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT V
+
+
+
+SCENE II The forest.
+
+
+ [Enter ORLANDO and OLIVER]
+
+ORLANDO Is't possible that on so little acquaintance you
+ should like her? that but seeing you should love
+ her? and loving woo? and, wooing, she should
+ grant? and will you persever to enjoy her?
+
+OLIVER Neither call the giddiness of it in question, the
+ poverty of her, the small acquaintance, my sudden
+ wooing, nor her sudden consenting; but say with me,
+ I love Aliena; say with her that she loves me;
+ consent with both that we may enjoy each other: it
+ shall be to your good; for my father's house and all
+ the revenue that was old Sir Rowland's will I
+ estate upon you, and here live and die a shepherd.
+
+ORLANDO You have my consent. Let your wedding be to-morrow:
+ thither will I invite the duke and all's contented
+ followers. Go you and prepare Aliena; for look
+ you, here comes my Rosalind.
+
+ [Enter ROSALIND]
+
+ROSALIND God save you, brother.
+
+OLIVER And you, fair sister.
+
+ [Exit]
+
+ROSALIND O, my dear Orlando, how it grieves me to see thee
+ wear thy heart in a scarf!
+
+ORLANDO It is my arm.
+
+ROSALIND I thought thy heart had been wounded with the claws
+ of a lion.
+
+ORLANDO Wounded it is, but with the eyes of a lady.
+
+ROSALIND Did your brother tell you how I counterfeited to
+ swoon when he showed me your handkerchief?
+
+ORLANDO Ay, and greater wonders than that.
+
+ROSALIND O, I know where you are: nay, 'tis true: there was
+ never any thing so sudden but the fight of two rams
+ and Caesar's thrasonical brag of 'I came, saw, and
+ overcame:' for your brother and my sister no sooner
+ met but they looked, no sooner looked but they
+ loved, no sooner loved but they sighed, no sooner
+ sighed but they asked one another the reason, no
+ sooner knew the reason but they sought the remedy;
+ and in these degrees have they made a pair of stairs
+ to marriage which they will climb incontinent, or
+ else be incontinent before marriage: they are in
+ the very wrath of love and they will together; clubs
+ cannot part them.
+
+ORLANDO They shall be married to-morrow, and I will bid the
+ duke to the nuptial. But, O, how bitter a thing it
+ is to look into happiness through another man's
+ eyes! By so much the more shall I to-morrow be at
+ the height of heart-heaviness, by how much I shall
+ think my brother happy in having what he wishes for.
+
+ROSALIND Why then, to-morrow I cannot serve your turn for Rosalind?
+
+ORLANDO I can live no longer by thinking.
+
+ROSALIND I will weary you then no longer with idle talking.
+ Know of me then, for now I speak to some purpose,
+ that I know you are a gentleman of good conceit: I
+ speak not this that you should bear a good opinion
+ of my knowledge, insomuch I say I know you are;
+ neither do I labour for a greater esteem than may in
+ some little measure draw a belief from you, to do
+ yourself good and not to grace me. Believe then, if
+ you please, that I can do strange things: I have,
+ since I was three year old, conversed with a
+ magician, most profound in his art and yet not
+ damnable. If you do love Rosalind so near the heart
+ as your gesture cries it out, when your brother
+ marries Aliena, shall you marry her: I know into
+ what straits of fortune she is driven; and it is
+ not impossible to me, if it appear not inconvenient
+ to you, to set her before your eyes tomorrow human
+ as she is and without any danger.
+
+ORLANDO Speakest thou in sober meanings?
+
+ROSALIND By my life, I do; which I tender dearly, though I
+ say I am a magician. Therefore, put you in your
+ best array: bid your friends; for if you will be
+ married to-morrow, you shall, and to Rosalind, if you will.
+
+ [Enter SILVIUS and PHEBE]
+
+ Look, here comes a lover of mine and a lover of hers.
+
+PHEBE Youth, you have done me much ungentleness,
+ To show the letter that I writ to you.
+
+ROSALIND I care not if I have: it is my study
+ To seem despiteful and ungentle to you:
+ You are there followed by a faithful shepherd;
+ Look upon him, love him; he worships you.
+
+PHEBE Good shepherd, tell this youth what 'tis to love.
+
+SILVIUS It is to be all made of sighs and tears;
+ And so am I for Phebe.
+
+PHEBE And I for Ganymede.
+
+ORLANDO And I for Rosalind.
+
+ROSALIND And I for no woman.
+
+SILVIUS It is to be all made of faith and service;
+ And so am I for Phebe.
+
+PHEBE And I for Ganymede.
+
+ORLANDO And I for Rosalind.
+
+ROSALIND And I for no woman.
+
+SILVIUS It is to be all made of fantasy,
+ All made of passion and all made of wishes,
+ All adoration, duty, and observance,
+ All humbleness, all patience and impatience,
+ All purity, all trial, all observance;
+ And so am I for Phebe.
+
+PHEBE And so am I for Ganymede.
+
+ORLANDO And so am I for Rosalind.
+
+ROSALIND And so am I for no woman.
+
+PHEBE If this be so, why blame you me to love you?
+
+SILVIUS If this be so, why blame you me to love you?
+
+ORLANDO If this be so, why blame you me to love you?
+
+ROSALIND Who do you speak to, 'Why blame you me to love you?'
+
+ORLANDO To her that is not here, nor doth not hear.
+
+ROSALIND Pray you, no more of this; 'tis like the howling
+ of Irish wolves against the moon.
+
+ [To SILVIUS]
+
+ I will help you, if I can:
+
+ [To PHEBE]
+
+ I would love you, if I could. To-morrow meet me all together.
+
+ [To PHEBE]
+
+ I will marry you, if ever I marry woman, and I'll be
+ married to-morrow:
+
+ [To ORLANDO]
+
+ I will satisfy you, if ever I satisfied man, and you
+ shall be married to-morrow:
+
+ [To SILVIUS]
+
+ I will content you, if what pleases you contents
+ you, and you shall be married to-morrow.
+
+ [To ORLANDO]
+
+ As you love Rosalind, meet:
+
+ [To SILVIUS]
+
+ as you love Phebe, meet: and as I love no woman,
+ I'll meet. So fare you well: I have left you commands.
+
+SILVIUS I'll not fail, if I live.
+
+PHEBE Nor I.
+
+ORLANDO Nor I.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT V
+
+
+
+SCENE III The forest.
+
+
+ [Enter TOUCHSTONE and AUDREY]
+
+TOUCHSTONE To-morrow is the joyful day, Audrey; to-morrow will
+ we be married.
+
+AUDREY I do desire it with all my heart; and I hope it is
+ no dishonest desire to desire to be a woman of the
+ world. Here comes two of the banished duke's pages.
+
+ [Enter two Pages]
+
+First Page Well met, honest gentleman.
+
+TOUCHSTONE By my troth, well met. Come, sit, sit, and a song.
+
+Second Page We are for you: sit i' the middle.
+
+First Page Shall we clap into't roundly, without hawking or
+ spitting or saying we are hoarse, which are the only
+ prologues to a bad voice?
+
+Second Page I'faith, i'faith; and both in a tune, like two
+ gipsies on a horse.
+
+ SONG.
+ It was a lover and his lass,
+ With a hey, and a ho, and a hey nonino,
+ That o'er the green corn-field did pass
+ In the spring time, the only pretty ring time,
+ When birds do sing, hey ding a ding, ding:
+ Sweet lovers love the spring.
+
+ Between the acres of the rye,
+ With a hey, and a ho, and a hey nonino
+ These pretty country folks would lie,
+ In spring time, &c.
+
+ This carol they began that hour,
+ With a hey, and a ho, and a hey nonino,
+ How that a life was but a flower
+ In spring time, &c.
+
+ And therefore take the present time,
+ With a hey, and a ho, and a hey nonino;
+ For love is crowned with the prime
+ In spring time, &c.
+
+TOUCHSTONE Truly, young gentlemen, though there was no great
+ matter in the ditty, yet the note was very
+ untuneable.
+
+First Page You are deceived, sir: we kept time, we lost not our time.
+
+TOUCHSTONE By my troth, yes; I count it but time lost to hear
+ such a foolish song. God be wi' you; and God mend
+ your voices! Come, Audrey.
+
+ [Exeunt]
+
+
+
+
+ AS YOU LIKE IT
+
+
+ACT V
+
+
+
+SCENE IV The forest.
+
+
+ [Enter DUKE SENIOR, AMIENS, JAQUES, ORLANDO, OLIVER,
+ and CELIA]
+
+DUKE SENIOR Dost thou believe, Orlando, that the boy
+ Can do all this that he hath promised?
+
+ORLANDO I sometimes do believe, and sometimes do not;
+ As those that fear they hope, and know they fear.
+
+ [Enter ROSALIND, SILVIUS, and PHEBE]
+
+ROSALIND Patience once more, whiles our compact is urged:
+ You say, if I bring in your Rosalind,
+ You will bestow her on Orlando here?
+
+DUKE SENIOR That would I, had I kingdoms to give with her.
+
+ROSALIND And you say, you will have her, when I bring her?
+
+ORLANDO That would I, were I of all kingdoms king.
+
+ROSALIND You say, you'll marry me, if I be willing?
+
+PHEBE That will I, should I die the hour after.
+
+ROSALIND But if you do refuse to marry me,
+ You'll give yourself to this most faithful shepherd?
+
+PHEBE So is the bargain.
+
+ROSALIND You say, that you'll have Phebe, if she will?
+
+SILVIUS Though to have her and death were both one thing.
+
+ROSALIND I have promised to make all this matter even.
+ Keep you your word, O duke, to give your daughter;
+ You yours, Orlando, to receive his daughter:
+ Keep your word, Phebe, that you'll marry me,
+ Or else refusing me, to wed this shepherd:
+ Keep your word, Silvius, that you'll marry her.
+ If she refuse me: and from hence I go,
+ To make these doubts all even.
+
+ [Exeunt ROSALIND and CELIA]
+
+DUKE SENIOR I do remember in this shepherd boy
+ Some lively touches of my daughter's favour.
+
+ORLANDO My lord, the first time that I ever saw him
+ Methought he was a brother to your daughter:
+ But, my good lord, this boy is forest-born,
+ And hath been tutor'd in the rudiments
+ Of many desperate studies by his uncle,
+ Whom he reports to be a great magician,
+ Obscured in the circle of this forest.
+
+ [Enter TOUCHSTONE and AUDREY]
+
+JAQUES There is, sure, another flood toward, and these
+ couples are coming to the ark. Here comes a pair of
+ very strange beasts, which in all tongues are called fools.
+
+TOUCHSTONE Salutation and greeting to you all!
+
+JAQUES Good my lord, bid him welcome: this is the
+ motley-minded gentleman that I have so often met in
+ the forest: he hath been a courtier, he swears.
+
+TOUCHSTONE If any man doubt that, let him put me to my
+ purgation. I have trod a measure; I have flattered
+ a lady; I have been politic with my friend, smooth
+ with mine enemy; I have undone three tailors; I have
+ had four quarrels, and like to have fought one.
+
+JAQUES And how was that ta'en up?
+
+TOUCHSTONE Faith, we met, and found the quarrel was upon the
+ seventh cause.
+
+JAQUES How seventh cause? Good my lord, like this fellow.
+
+DUKE SENIOR I like him very well.
+
+TOUCHSTONE God 'ild you, sir; I desire you of the like. I
+ press in here, sir, amongst the rest of the country
+ copulatives, to swear and to forswear: according as
+ marriage binds and blood breaks: a poor virgin,
+ sir, an ill-favoured thing, sir, but mine own; a poor
+ humour of mine, sir, to take that that no man else
+ will: rich honesty dwells like a miser, sir, in a
+ poor house; as your pearl in your foul oyster.
+
+DUKE SENIOR By my faith, he is very swift and sententious.
+
+TOUCHSTONE According to the fool's bolt, sir, and such dulcet diseases.
+
+JAQUES But, for the seventh cause; how did you find the
+ quarrel on the seventh cause?
+
+TOUCHSTONE Upon a lie seven times removed:--bear your body more
+ seeming, Audrey:--as thus, sir. I did dislike the
+ cut of a certain courtier's beard: he sent me word,
+ if I said his beard was not cut well, he was in the
+ mind it was: this is called the Retort Courteous.
+ If I sent him word again 'it was not well cut,' he
+ would send me word, he cut it to please himself:
+ this is called the Quip Modest. If again 'it was
+ not well cut,' he disabled my judgment: this is
+ called the Reply Churlish. If again 'it was not
+ well cut,' he would answer, I spake not true: this
+ is called the Reproof Valiant. If again 'it was not
+ well cut,' he would say I lied: this is called the
+ Counter-cheque Quarrelsome: and so to the Lie
+ Circumstantial and the Lie Direct.
+
+JAQUES And how oft did you say his beard was not well cut?
+
+TOUCHSTONE I durst go no further than the Lie Circumstantial,
+ nor he durst not give me the Lie Direct; and so we
+ measured swords and parted.
+
+JAQUES Can you nominate in order now the degrees of the lie?
+
+TOUCHSTONE O sir, we quarrel in print, by the book; as you have
+ books for good manners: I will name you the degrees.
+ The first, the Retort Courteous; the second, the
+ Quip Modest; the third, the Reply Churlish; the
+ fourth, the Reproof Valiant; the fifth, the
+ Countercheque Quarrelsome; the sixth, the Lie with
+ Circumstance; the seventh, the Lie Direct. All
+ these you may avoid but the Lie Direct; and you may
+ avoid that too, with an If. I knew when seven
+ justices could not take up a quarrel, but when the
+ parties were met themselves, one of them thought but
+ of an If, as, 'If you said so, then I said so;' and
+ they shook hands and swore brothers. Your If is the
+ only peacemaker; much virtue in If.
+
+JAQUES Is not this a rare fellow, my lord? he's as good at
+ any thing and yet a fool.
+
+DUKE SENIOR He uses his folly like a stalking-horse and under
+ the presentation of that he shoots his wit.
+
+ [Enter HYMEN, ROSALIND, and CELIA]
+
+ [Still Music]
+
+HYMEN Then is there mirth in heaven,
+ When earthly things made even
+ Atone together.
+ Good duke, receive thy daughter
+ Hymen from heaven brought her,
+ Yea, brought her hither,
+ That thou mightst join her hand with his
+ Whose heart within his bosom is.
+
+ROSALIND [To DUKE SENIOR] To you I give myself, for I am yours.
+
+ [To ORLANDO]
+
+ To you I give myself, for I am yours.
+
+DUKE SENIOR If there be truth in sight, you are my daughter.
+
+ORLANDO If there be truth in sight, you are my Rosalind.
+
+PHEBE If sight and shape be true,
+ Why then, my love adieu!
+
+ROSALIND I'll have no father, if you be not he:
+ I'll have no husband, if you be not he:
+ Nor ne'er wed woman, if you be not she.
+
+HYMEN Peace, ho! I bar confusion:
+ 'Tis I must make conclusion
+ Of these most strange events:
+ Here's eight that must take hands
+ To join in Hymen's bands,
+ If truth holds true contents.
+ You and you no cross shall part:
+ You and you are heart in heart
+ You to his love must accord,
+ Or have a woman to your lord:
+ You and you are sure together,
+ As the winter to foul weather.
+ Whiles a wedlock-hymn we sing,
+ Feed yourselves with questioning;
+ That reason wonder may diminish,
+ How thus we met, and these things finish.
+
+ SONG.
+ Wedding is great Juno's crown:
+ O blessed bond of board and bed!
+ 'Tis Hymen peoples every town;
+ High wedlock then be honoured:
+ Honour, high honour and renown,
+ To Hymen, god of every town!
+
+DUKE SENIOR O my dear niece, welcome thou art to me!
+ Even daughter, welcome, in no less degree.
+
+PHEBE I will not eat my word, now thou art mine;
+ Thy faith my fancy to thee doth combine.
+
+ [Enter JAQUES DE BOYS]
+
+JAQUES DE BOYS Let me have audience for a word or two:
+ I am the second son of old Sir Rowland,
+ That bring these tidings to this fair assembly.
+ Duke Frederick, hearing how that every day
+ Men of great worth resorted to this forest,
+ Address'd a mighty power; which were on foot,
+ In his own conduct, purposely to take
+ His brother here and put him to the sword:
+ And to the skirts of this wild wood he came;
+ Where meeting with an old religious man,
+ After some question with him, was converted
+ Both from his enterprise and from the world,
+ His crown bequeathing to his banish'd brother,
+ And all their lands restored to them again
+ That were with him exiled. This to be true,
+ I do engage my life.
+
+DUKE SENIOR Welcome, young man;
+ Thou offer'st fairly to thy brothers' wedding:
+ To one his lands withheld, and to the other
+ A land itself at large, a potent dukedom.
+ First, in this forest, let us do those ends
+ That here were well begun and well begot:
+ And after, every of this happy number
+ That have endured shrewd days and nights with us
+ Shall share the good of our returned fortune,
+ According to the measure of their states.
+ Meantime, forget this new-fall'n dignity
+ And fall into our rustic revelry.
+ Play, music! And you, brides and bridegrooms all,
+ With measure heap'd in joy, to the measures fall.
+
+JAQUES Sir, by your patience. If I heard you rightly,
+ The duke hath put on a religious life
+ And thrown into neglect the pompous court?
+
+JAQUES DE BOYS He hath.
+
+JAQUES To him will I : out of these convertites
+ There is much matter to be heard and learn'd.
+
+ [To DUKE SENIOR]
+
+ You to your former honour I bequeath;
+ Your patience and your virtue well deserves it:
+
+ [To ORLANDO]
+
+ You to a love that your true faith doth merit:
+
+ [To OLIVER]
+
+ You to your land and love and great allies:
+
+ [To SILVIUS]
+
+ You to a long and well-deserved bed:
+
+ [To TOUCHSTONE]
+
+ And you to wrangling; for thy loving voyage
+ Is but for two months victuall'd. So, to your pleasures:
+ I am for other than for dancing measures.
+
+DUKE SENIOR Stay, Jaques, stay.
+
+JAQUES To see no pastime I what you would have
+ I'll stay to know at your abandon'd cave.
+
+ [Exit]
+
+DUKE SENIOR Proceed, proceed: we will begin these rites,
+ As we do trust they'll end, in true delights.
+
+ [A dance]
+
+
+
+
+ AS YOU LIKE IT
+
+ EPILOGUE
+
+
+ROSALIND It is not the fashion to see the lady the epilogue;
+ but it is no more unhandsome than to see the lord
+ the prologue. If it be true that good wine needs
+ no bush, 'tis true that a good play needs no
+ epilogue; yet to good wine they do use good bushes,
+ and good plays prove the better by the help of good
+ epilogues. What a case am I in then, that am
+ neither a good epilogue nor cannot insinuate with
+ you in the behalf of a good play! I am not
+ furnished like a beggar, therefore to beg will not
+ become me: my way is to conjure you; and I'll begin
+ with the women. I charge you, O women, for the love
+ you bear to men, to like as much of this play as
+ please you: and I charge you, O men, for the love
+ you bear to women--as I perceive by your simpering,
+ none of you hates them--that between you and the
+ women the play may please. If I were a woman I
+ would kiss as many of you as had beards that pleased
+ me, complexions that liked me and breaths that I
+ defied not: and, I am sure, as many as have good
+ beards or good faces or sweet breaths will, for my
+ kind offer, when I make curtsy, bid me farewell.
+
+ [Exeunt]
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/asyoulik.txt.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/asyoulik.txt.compressed
new file mode 100644
index 000000000..3a7621100
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/asyoulik.txt.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/backward65536 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/backward65536
new file mode 100644
index 000000000..40efb3c11
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/backward65536
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/backward65536.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/backward65536.compressed
new file mode 100644
index 000000000..07152197d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/backward65536.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/bb.binast b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/bb.binast
new file mode 100644
index 000000000..9b7f07399
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/bb.binast
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_file b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_file
new file mode 100644
index 000000000..37d86e253
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_file
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_file.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_file.compressed
new file mode 100644
index 000000000..8834f3275
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_file.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_repeated b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_repeated
new file mode 100644
index 000000000..9870b5fdc
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_repeated
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_repeated.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_repeated.compressed
new file mode 100644
index 000000000..092754589
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/compressed_repeated.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed
new file mode 100644
index 000000000..f8fa5a235
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.00 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.00
new file mode 100644
index 000000000..f8fa5a235
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.00
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.01 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.01
new file mode 100644
index 000000000..17bb34721
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.01
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.02 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.02
new file mode 100644
index 000000000..c183df6a3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.02
@@ -0,0 +1 @@
+¡ \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.03 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.03
new file mode 100644
index 000000000..ae60db8f3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.03
@@ -0,0 +1 @@
+± \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.04 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.04
new file mode 100644
index 000000000..8fac0345c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.04
@@ -0,0 +1 @@
+Á \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.05 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.05
new file mode 100644
index 000000000..98c9dcca2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.05
@@ -0,0 +1 @@
+Ñ \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.06 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.06
new file mode 100644
index 000000000..84f606f03
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.06
@@ -0,0 +1 @@
+á \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.07 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.07
new file mode 100644
index 000000000..0941d5368
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.07
@@ -0,0 +1 @@
+ñ \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.08 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.08
new file mode 100644
index 000000000..e440e5c84
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.08
@@ -0,0 +1 @@
+3 \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.09 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.09
new file mode 100644
index 000000000..7813681f5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.09
@@ -0,0 +1 @@
+5 \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.10 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.10
new file mode 100644
index 000000000..c7930257d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.10
@@ -0,0 +1 @@
+7 \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.11 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.11
new file mode 100644
index 000000000..f11c82a4c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.11
@@ -0,0 +1 @@
+9 \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.12 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.12
new file mode 100644
index 000000000..1c8a0e797
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.12
@@ -0,0 +1 @@
+; \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.13 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.13
new file mode 100644
index 000000000..851c75cc5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.13
@@ -0,0 +1 @@
+= \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.14 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.14
new file mode 100644
index 000000000..0d758c9c7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.14
@@ -0,0 +1 @@
+? \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.15 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.15
new file mode 100644
index 000000000..152f9ed5a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.15
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.16 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.16
new file mode 100644
index 000000000..e136a792a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.16
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.17 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.17
new file mode 100644
index 000000000..81f0388bf
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.17
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.18 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.18
new file mode 100644
index 000000000..524e34198
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/empty.compressed.18
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/lcet10.txt b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/lcet10.txt
new file mode 100644
index 000000000..25dda6b3f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/lcet10.txt
@@ -0,0 +1,7519 @@
+
+
+The Project Gutenberg Etext of LOC WORKSHOP ON ELECTRONIC TEXTS
+
+
+
+
+ WORKSHOP ON ELECTRONIC TEXTS
+
+ PROCEEDINGS
+
+
+
+ Edited by James Daly
+
+
+
+
+
+
+
+ 9-10 June 1992
+
+
+ Library of Congress
+ Washington, D.C.
+
+
+
+ Supported by a Grant from the David and Lucile Packard Foundation
+
+
+ *** *** *** ****** *** *** ***
+
+
+ TABLE OF CONTENTS
+
+
+Acknowledgements
+
+Introduction
+
+Proceedings
+ Welcome
+ Prosser Gifford and Carl Fleischhauer
+
+ Session I. Content in a New Form: Who Will Use It and What Will They Do?
+ James Daly (Moderator)
+ Avra Michelson, Overview
+ Susan H. Veccia, User Evaluation
+ Joanne Freeman, Beyond the Scholar
+ Discussion
+
+ Session II. Show and Tell
+ Jacqueline Hess (Moderator)
+ Elli Mylonas, Perseus Project
+ Discussion
+ Eric M. Calaluca, Patrologia Latina Database
+ Carl Fleischhauer and Ricky Erway, American Memory
+ Discussion
+ Dorothy Twohig, The Papers of George Washington
+ Discussion
+ Maria L. Lebron, The Online Journal of Current Clinical Trials
+ Discussion
+ Lynne K. Personius, Cornell mathematics books
+ Discussion
+
+ Session III. Distribution, Networks, and Networking:
+ Options for Dissemination
+ Robert G. Zich (Moderator)
+ Clifford A. Lynch
+ Discussion
+ Howard Besser
+ Discussion
+ Ronald L. Larsen
+ Edwin B. Brownrigg
+ Discussion
+
+ Session IV. Image Capture, Text Capture, Overview of Text and
+ Image Storage Formats
+ William L. Hooton (Moderator)
+ A) Principal Methods for Image Capture of Text:
+ direct scanning, use of microform
+ Anne R. Kenney
+ Pamela Q.J. Andre
+ Judith A. Zidar
+ Donald J. Waters
+ Discussion
+ B) Special Problems: bound volumes, conservation,
+ reproducing printed halftones
+ George Thoma
+ Carl Fleischhauer
+ Discussion
+ C) Image Standards and Implications for Preservation
+ Jean Baronas
+ Patricia Battin
+ Discussion
+ D) Text Conversion: OCR vs. rekeying, standards of accuracy
+ and use of imperfect texts, service bureaus
+ Michael Lesk
+ Ricky Erway
+ Judith A. Zidar
+ Discussion
+
+ Session V. Approaches to Preparing Electronic Texts
+ Susan Hockey (Moderator)
+ Stuart Weibel
+ Discussion
+ C.M. Sperberg-McQueen
+ Discussion
+ Eric M. Calaluca
+ Discussion
+
+ Session VI. Copyright Issues
+ Marybeth Peters
+
+ Session VII. Conclusion
+ Prosser Gifford (Moderator)
+ General discussion
+
+Appendix I: Program
+
+Appendix II: Abstracts
+
+Appendix III: Directory of Participants
+
+
+ *** *** *** ****** *** *** ***
+
+
+ Acknowledgements
+
+I would like to thank Carl Fleischhauer and Prosser Gifford for the
+opportunity to learn about areas of human activity unknown to me a scant
+ten months ago, and the David and Lucile Packard Foundation for
+supporting that opportunity. The help given by others is acknowledged on
+a separate page.
+
+ 19 October 1992
+
+
+ *** *** *** ****** *** *** ***
+
+
+ INTRODUCTION
+
+The Workshop on Electronic Texts (1) drew together representatives of
+various projects and interest groups to compare ideas, beliefs,
+experiences, and, in particular, methods of placing and presenting
+historical textual materials in computerized form. Most attendees gained
+much in insight and outlook from the event. But the assembly did not
+form a new nation, or, to put it another way, the diversity of projects
+and interests was too great to draw the representatives into a cohesive,
+action-oriented body.(2)
+
+Everyone attending the Workshop shared an interest in preserving and
+providing access to historical texts. But within this broad field the
+attendees represented a variety of formal, informal, figurative, and
+literal groups, with many individuals belonging to more than one. These
+groups may be defined roughly according to the following topics or
+activities:
+
+* Imaging
+* Searchable coded texts
+* National and international computer networks
+* CD-ROM production and dissemination
+* Methods and technology for converting older paper materials into
+electronic form
+* Study of the use of digital materials by scholars and others
+
+This summary is arranged thematically and does not follow the actual
+sequence of presentations.
+
+NOTES:
+ (1) In this document, the phrase electronic text is used to mean
+ any computerized reproduction or version of a document, book,
+ article, or manuscript (including images), and not merely a machine-
+ readable or machine-searchable text.
+
+ (2) The Workshop was held at the Library of Congress on 9-10 June
+ 1992, with funding from the David and Lucile Packard Foundation.
+ The document that follows represents a summary of the presentations
+ made at the Workshop and was compiled by James DALY. This
+ introduction was written by DALY and Carl FLEISCHHAUER.
+
+
+PRESERVATION AND IMAGING
+
+Preservation, as that term is used by archivists,(3) was most explicitly
+discussed in the context of imaging. Anne KENNEY and Lynne PERSONIUS
+explained how the concept of a faithful copy and the user-friendliness of
+the traditional book have guided their project at Cornell University.(4)
+Although interested in computerized dissemination, participants in the
+Cornell project are creating digital image sets of older books in the
+public domain as a source for a fresh paper facsimile or, in a future
+phase, microfilm. The books returned to the library shelves are
+high-quality and useful replacements on acid-free paper that should last
+a long time. To date, the Cornell project has placed little or no
+emphasis on creating searchable texts; one would not be surprised to find
+that the project participants view such texts as new editions, and thus
+not as faithful reproductions.
+
+In her talk on preservation, Patricia BATTIN struck an ecumenical and
+flexible note as she endorsed the creation and dissemination of a variety
+of types of digital copies. Do not be too narrow in defining what counts
+as a preservation element, BATTIN counseled; for the present, at least,
+digital copies made with preservation in mind cannot be as narrowly
+standardized as, say, microfilm copies with the same objective. Setting
+standards precipitously can inhibit creativity, but delay can result in
+chaos, she advised.
+
+In part, BATTIN's position reflected the unsettled nature of image-format
+standards, and attendees could hear echoes of this unsettledness in the
+comments of various speakers. For example, Jean BARONAS reviewed the
+status of several formal standards moving through committees of experts;
+and Clifford LYNCH encouraged the use of a new guideline for transmitting
+document images on Internet. Testimony from participants in the National
+Agricultural Library's (NAL) Text Digitization Program and LC's American
+Memory project highlighted some of the challenges to the actual creation
+or interchange of images, including difficulties in converting
+preservation microfilm to digital form. Donald WATERS reported on the
+progress of a master plan for a project at Yale University to convert
+books on microfilm to digital image sets, Project Open Book (POB).
+
+The Workshop offered rather less of an imaging practicum than planned,
+but "how-to" hints emerge at various points, for example, throughout
+KENNEY's presentation and in the discussion of arcana such as
+thresholding and dithering offered by George THOMA and FLEISCHHAUER.
+
+NOTES:
+ (3) Although there is a sense in which any reproductions of
+ historical materials preserve the human record, specialists in the
+ field have developed particular guidelines for the creation of
+ acceptable preservation copies.
+
+ (4) Titles and affiliations of presenters are given at the
+ beginning of their respective talks and in the Directory of
+ Participants (Appendix III).
+
+
+THE MACHINE-READABLE TEXT: MARKUP AND USE
+
+The sections of the Workshop that dealt with machine-readable text tended
+to be more concerned with access and use than with preservation, at least
+in the narrow technical sense. Michael SPERBERG-McQUEEN made a forceful
+presentation on the Text Encoding Initiative's (TEI) implementation of
+the Standard Generalized Markup Language (SGML). His ideas were echoed
+by Susan HOCKEY, Elli MYLONAS, and Stuart WEIBEL. While the
+presentations made by the TEI advocates contained no practicum, their
+discussion focused on the value of the finished product, what the
+European Community calls reusability, but what may also be termed
+durability. They argued that marking up--that is, coding--a text in a
+well-conceived way will permit it to be moved from one computer
+environment to another, as well as to be used by various users. Two
+kinds of markup were distinguished: 1) procedural markup, which
+describes the features of a text (e.g., dots on a page), and 2)
+descriptive markup, which describes the structure or elements of a
+document (e.g., chapters, paragraphs, and front matter).
+
+The TEI proponents emphasized the importance of texts to scholarship.
+They explained how heavily coded (and thus analyzed and annotated) texts
+can underlie research, play a role in scholarly communication, and
+facilitate classroom teaching. SPERBERG-McQUEEN reminded listeners that
+a written or printed item (e.g., a particular edition of a book) is
+merely a representation of the abstraction we call a text. To concern
+ourselves with faithfully reproducing a printed instance of the text,
+SPERBERG-McQUEEN argued, is to concern ourselves with the representation
+of a representation ("images as simulacra for the text"). The TEI proponents'
+interest in images tends to focus on corollary materials for use in teaching,
+for example, photographs of the Acropolis to accompany a Greek text.
+
+By the end of the Workshop, SPERBERG-McQUEEN confessed to having been
+converted to a limited extent to the view that electronic images
+constitute a promising alternative to microfilming; indeed, an
+alternative probably superior to microfilming. But he was not convinced
+that electronic images constitute a serious attempt to represent text in
+electronic form. HOCKEY and MYLONAS also conceded that their experience
+at the Pierce Symposium the previous week at Georgetown University and
+the present conference at the Library of Congress had compelled them to
+reevaluate their perspective on the usefulness of text as images.
+Attendees could see that the text and image advocates were in
+constructive tension, so to say.
+
+Three nonTEI presentations described approaches to preparing
+machine-readable text that are less rigorous and thus less expensive. In
+the case of the Papers of George Washington, Dorothy TWOHIG explained
+that the digital version will provide a not-quite-perfect rendering of
+the transcribed text--some 135,000 documents, available for research
+during the decades while the perfect or print version is completed.
+Members of the American Memory team and the staff of NAL's Text
+Digitization Program (see below) also outlined a middle ground concerning
+searchable texts. In the case of American Memory, contractors produce
+texts with about 99-percent accuracy that serve as "browse" or
+"reference" versions of written or printed originals. End users who need
+faithful copies or perfect renditions must refer to accompanying sets of
+digital facsimile images or consult copies of the originals in a nearby
+library or archive. American Memory staff argued that the high cost of
+producing 100-percent accurate copies would prevent LC from offering
+access to large parts of its collections.
+
+
+THE MACHINE-READABLE TEXT: METHODS OF CONVERSION
+
+Although the Workshop did not include a systematic examination of the
+methods for converting texts from paper (or from facsimile images) into
+machine-readable form, nevertheless, various speakers touched upon this
+matter. For example, WEIBEL reported that OCLC has experimented with a
+merging of multiple optical character recognition systems that will
+reduce errors from an unacceptable rate of 5 characters out of every
+l,000 to an unacceptable rate of 2 characters out of every l,000.
+
+Pamela ANDRE presented an overview of NAL's Text Digitization Program and
+Judith ZIDAR discussed the technical details. ZIDAR explained how NAL
+purchased hardware and software capable of performing optical character
+recognition (OCR) and text conversion and used its own staff to convert
+texts. The process, ZIDAR said, required extensive editing and project
+staff found themselves considering alternatives, including rekeying
+and/or creating abstracts or summaries of texts. NAL reckoned costs at
+$7 per page. By way of contrast, Ricky ERWAY explained that American
+Memory had decided from the start to contract out conversion to external
+service bureaus. The criteria used to select these contractors were cost
+and quality of results, as opposed to methods of conversion. ERWAY noted
+that historical documents or books often do not lend themselves to OCR.
+Bound materials represent a special problem. In her experience, quality
+control--inspecting incoming materials, counting errors in samples--posed
+the most time-consuming aspect of contracting out conversion. ERWAY
+reckoned American Memory's costs at $4 per page, but cautioned that fewer
+cost-elements had been included than in NAL's figure.
+
+
+OPTIONS FOR DISSEMINATION
+
+The topic of dissemination proper emerged at various points during the
+Workshop. At the session devoted to national and international computer
+networks, LYNCH, Howard BESSER, Ronald LARSEN, and Edwin BROWNRIGG
+highlighted the virtues of Internet today and of the network that will
+evolve from Internet. Listeners could discern in these narratives a
+vision of an information democracy in which millions of citizens freely
+find and use what they need. LYNCH noted that a lack of standards
+inhibits disseminating multimedia on the network, a topic also discussed
+by BESSER. LARSEN addressed the issues of network scalability and
+modularity and commented upon the difficulty of anticipating the effects
+of growth in orders of magnitude. BROWNRIGG talked about the ability of
+packet radio to provide certain links in a network without the need for
+wiring. However, the presenters also called attention to the
+shortcomings and incongruities of present-day computer networks. For
+example: 1) Network use is growing dramatically, but much network
+traffic consists of personal communication (E-mail). 2) Large bodies of
+information are available, but a user's ability to search across their
+entirety is limited. 3) There are significant resources for science and
+technology, but few network sources provide content in the humanities.
+4) Machine-readable texts are commonplace, but the capability of the
+system to deal with images (let alone other media formats) lags behind.
+A glimpse of a multimedia future for networks, however, was provided by
+Maria LEBRON in her overview of the Online Journal of Current Clinical
+Trials (OJCCT), and the process of scholarly publishing on-line.
+
+The contrasting form of the CD-ROM disk was never systematically
+analyzed, but attendees could glean an impression from several of the
+show-and-tell presentations. The Perseus and American Memory examples
+demonstrated recently published disks, while the descriptions of the
+IBYCUS version of the Papers of George Washington and Chadwyck-Healey's
+Patrologia Latina Database (PLD) told of disks to come. According to
+Eric CALALUCA, PLD's principal focus has been on converting Jacques-Paul
+Migne's definitive collection of Latin texts to machine-readable form.
+Although everyone could share the network advocates' enthusiasm for an
+on-line future, the possibility of rolling up one's sleeves for a session
+with a CD-ROM containing both textual materials and a powerful retrieval
+engine made the disk seem an appealing vessel indeed. The overall
+discussion suggested that the transition from CD-ROM to on-line networked
+access may prove far slower and more difficult than has been anticipated.
+
+
+WHO ARE THE USERS AND WHAT DO THEY DO?
+
+Although concerned with the technicalities of production, the Workshop
+never lost sight of the purposes and uses of electronic versions of
+textual materials. As noted above, those interested in imaging discussed
+the problematical matter of digital preservation, while the TEI proponents
+described how machine-readable texts can be used in research. This latter
+topic received thorough treatment in the paper read by Avra MICHELSON.
+She placed the phenomenon of electronic texts within the context of
+broader trends in information technology and scholarly communication.
+
+Among other things, MICHELSON described on-line conferences that
+represent a vigorous and important intellectual forum for certain
+disciplines. Internet now carries more than 700 conferences, with about
+80 percent of these devoted to topics in the social sciences and the
+humanities. Other scholars use on-line networks for "distance learning."
+Meanwhile, there has been a tremendous growth in end-user computing;
+professors today are less likely than their predecessors to ask the
+campus computer center to process their data. Electronic texts are one
+key to these sophisticated applications, MICHELSON reported, and more and
+more scholars in the humanities now work in an on-line environment.
+Toward the end of the Workshop, Michael LESK presented a corollary to
+MICHELSON's talk, reporting the results of an experiment that compared
+the work of one group of chemistry students using traditional printed
+texts and two groups using electronic sources. The experiment
+demonstrated that in the event one does not know what to read, one needs
+the electronic systems; the electronic systems hold no advantage at the
+moment if one knows what to read, but neither do they impose a penalty.
+
+DALY provided an anecdotal account of the revolutionizing impact of the
+new technology on his previous methods of research in the field of classics.
+His account, by extrapolation, served to illustrate in part the arguments
+made by MICHELSON concerning the positive effects of the sudden and radical
+transformation being wrought in the ways scholars work.
+
+Susan VECCIA and Joanne FREEMAN delineated the use of electronic
+materials outside the university. The most interesting aspect of their
+use, FREEMAN said, could be seen as a paradox: teachers in elementary
+and secondary schools requested access to primary source materials but,
+at the same time, found that "primariness" itself made these materials
+difficult for their students to use.
+
+
+OTHER TOPICS
+
+Marybeth PETERS reviewed copyright law in the United States and offered
+advice during a lively discussion of this subject. But uncertainty
+remains concerning the price of copyright in a digital medium, because a
+solution remains to be worked out concerning management and synthesis of
+copyrighted and out-of-copyright pieces of a database.
+
+As moderator of the final session of the Workshop, Prosser GIFFORD directed
+discussion to future courses of action and the potential role of LC in
+advancing them. Among the recommendations that emerged were the following:
+
+ * Workshop participants should 1) begin to think about working
+ with image material, but structure and digitize it in such a
+ way that at a later stage it can be interpreted into text, and
+ 2) find a common way to build text and images together so that
+ they can be used jointly at some stage in the future, with
+ appropriate network support, because that is how users will want
+ to access these materials. The Library might encourage attempts
+ to bring together people who are working on texts and images.
+
+ * A network version of American Memory should be developed or
+ consideration should be given to making the data in it
+ available to people interested in doing network multimedia.
+ Given the current dearth of digital data that is appealing and
+ unencumbered by extremely complex rights problems, developing a
+ network version of American Memory could do much to help make
+ network multimedia a reality.
+
+ * Concerning the thorny issue of electronic deposit, LC should
+ initiate a catalytic process in terms of distributed
+ responsibility, that is, bring together the distributed
+ organizations and set up a study group to look at all the
+ issues related to electronic deposit and see where we as a
+ nation should move. For example, LC might attempt to persuade
+ one major library in each state to deal with its state
+ equivalent publisher, which might produce a cooperative project
+ that would be equitably distributed around the country, and one
+ in which LC would be dealing with a minimal number of publishers
+ and minimal copyright problems. LC must also deal with the
+ concept of on-line publishing, determining, among other things,
+ how serials such as OJCCT might be deposited for copyright.
+
+ * Since a number of projects are planning to carry out
+ preservation by creating digital images that will end up in
+ on-line or near-line storage at some institution, LC might play
+ a helpful role, at least in the near term, by accelerating how
+ to catalog that information into the Research Library Information
+ Network (RLIN) and then into OCLC, so that it would be accessible.
+ This would reduce the possibility of multiple institutions digitizing
+ the same work.
+
+
+CONCLUSION
+
+The Workshop was valuable because it brought together partisans from
+various groups and provided an occasion to compare goals and methods.
+The more committed partisans frequently communicate with others in their
+groups, but less often across group boundaries. The Workshop was also
+valuable to attendees--including those involved with American Memory--who
+came less committed to particular approaches or concepts. These
+attendees learned a great deal, and plan to select and employ elements of
+imaging, text-coding, and networked distribution that suit their
+respective projects and purposes.
+
+Still, reality rears its ugly head: no breakthrough has been achieved.
+On the imaging side, one confronts a proliferation of competing
+data-interchange standards and a lack of consensus on the role of digital
+facsimiles in preservation. In the realm of machine-readable texts, one
+encounters a reasonably mature standard but methodological difficulties
+and high costs. These latter problems, of course, represent a special
+impediment to the desire, as it is sometimes expressed in the popular
+press, "to put the [contents of the] Library of Congress on line." In
+the words of one participant, there was "no solution to the economic
+problems--the projects that are out there are surviving, but it is going
+to be a lot of work to transform the information industry, and so far the
+investment to do that is not forthcoming" (LESK, per litteras).
+
+
+ *** *** *** ****** *** *** ***
+
+
+ PROCEEDINGS
+
+
+WELCOME
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+GIFFORD * Origin of Workshop in current Librarian's desire to make LC's
+collections more widely available * Desiderata arising from the prospect
+of greater interconnectedness *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+After welcoming participants on behalf of the Library of Congress,
+American Memory (AM), and the National Demonstration Lab, Prosser
+GIFFORD, director for scholarly programs, Library of Congress, located
+the origin of the Workshop on Electronic Texts in a conversation he had
+had considerably more than a year ago with Carl FLEISCHHAUER concerning
+some of the issues faced by AM. On the assumption that numerous other
+people were asking the same questions, the decision was made to bring
+together as many of these people as possible to ask the same questions
+together. In a deeper sense, GIFFORD said, the origin of the Workshop
+lay in the desire of the current Librarian of Congress, James H.
+Billington, to make the collections of the Library, especially those
+offering unique or unusual testimony on aspects of the American
+experience, available to a much wider circle of users than those few
+people who can come to Washington to use them. This meant that the
+emphasis of AM, from the outset, has been on archival collections of the
+basic material, and on making these collections themselves available,
+rather than selected or heavily edited products.
+
+From AM's emphasis followed the questions with which the Workshop began:
+who will use these materials, and in what form will they wish to use
+them. But an even larger issue deserving mention, in GIFFORD's view, was
+the phenomenal growth in Internet connectivity. He expressed the hope
+that the prospect of greater interconnectedness than ever before would
+lead to: 1) much more cooperative and mutually supportive endeavors; 2)
+development of systems of shared and distributed responsibilities to
+avoid duplication and to ensure accuracy and preservation of unique
+materials; and 3) agreement on the necessary standards and development of
+the appropriate directories and indices to make navigation
+straightforward among the varied resources that are, and increasingly
+will be, available. In this connection, GIFFORD requested that
+participants reflect from the outset upon the sorts of outcomes they
+thought the Workshop might have. Did those present constitute a group
+with sufficient common interests to propose a next step or next steps,
+and if so, what might those be? They would return to these questions the
+following afternoon.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+FLEISCHHAUER * Core of Workshop concerns preparation and production of
+materials * Special challenge in conversion of textual materials *
+Quality versus quantity * Do the several groups represented share common
+interests? *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Carl FLEISCHHAUER, coordinator, American Memory, Library of Congress,
+emphasized that he would attempt to represent the people who perform some
+of the work of converting or preparing materials and that the core of
+the Workshop had to do with preparation and production. FLEISCHHAUER
+then drew a distinction between the long term, when many things would be
+available and connected in the ways that GIFFORD described, and the short
+term, in which AM not only has wrestled with the issue of what is the
+best course to pursue but also has faced a variety of technical
+challenges.
+
+FLEISCHHAUER remarked AM's endeavors to deal with a wide range of library
+formats, such as motion picture collections, sound-recording collections,
+and pictorial collections of various sorts, especially collections of
+photographs. In the course of these efforts, AM kept coming back to
+textual materials--manuscripts or rare printed matter, bound materials,
+etc. Text posed the greatest conversion challenge of all. Thus, the
+genesis of the Workshop, which reflects the problems faced by AM. These
+problems include physical problems. For example, those in the library
+and archive business deal with collections made up of fragile and rare
+manuscript items, bound materials, especially the notoriously brittle
+bound materials of the late nineteenth century. These are precious
+cultural artifacts, however, as well as interesting sources of
+information, and LC desires to retain and conserve them. AM needs to
+handle things without damaging them. Guillotining a book to run it
+through a sheet feeder must be avoided at all costs.
+
+Beyond physical problems, issues pertaining to quality arose. For
+example, the desire to provide users with a searchable text is affected
+by the question of acceptable level of accuracy. One hundred percent
+accuracy is tremendously expensive. On the other hand, the output of
+optical character recognition (OCR) can be tremendously inaccurate.
+Although AM has attempted to find a middle ground, uncertainty persists
+as to whether or not it has discovered the right solution.
+
+Questions of quality arose concerning images as well. FLEISCHHAUER
+contrasted the extremely high level of quality of the digital images in
+the Cornell Xerox Project with AM's efforts to provide a browse-quality
+or access-quality image, as opposed to an archival or preservation image.
+FLEISCHHAUER therefore welcomed the opportunity to compare notes.
+
+FLEISCHHAUER observed in passing that conversations he had had about
+networks have begun to signal that for various forms of media a
+determination may be made that there is a browse-quality item, or a
+distribution-and-access-quality item that may coexist in some systems
+with a higher quality archival item that would be inconvenient to send
+through the network because of its size. FLEISCHHAUER referred, of
+course, to images more than to searchable text.
+
+As AM considered those questions, several conceptual issues arose: ought
+AM occasionally to reproduce materials entirely through an image set, at
+other times, entirely through a text set, and in some cases, a mix?
+There probably would be times when the historical authenticity of an
+artifact would require that its image be used. An image might be
+desirable as a recourse for users if one could not provide 100-percent
+accurate text. Again, AM wondered, as a practical matter, if a
+distinction could be drawn between rare printed matter that might exist
+in multiple collections--that is, in ten or fifteen libraries. In such
+cases, the need for perfect reproduction would be less than for unique
+items. Implicit in his remarks, FLEISCHHAUER conceded, was the admission
+that AM has been tilting strongly towards quantity and drawing back a
+little from perfect quality. That is, it seemed to AM that society would
+be better served if more things were distributed by LC--even if they were
+not quite perfect--than if fewer things, perfectly represented, were
+distributed. This was stated as a proposition to be tested, with
+responses to be gathered from users.
+
+In thinking about issues related to reproduction of materials and seeing
+other people engaged in parallel activities, AM deemed it useful to
+convene a conference. Hence, the Workshop. FLEISCHHAUER thereupon
+surveyed the several groups represented: 1) the world of images (image
+users and image makers); 2) the world of text and scholarship and, within
+this group, those concerned with language--FLEISCHHAUER confessed to finding
+delightful irony in the fact that some of the most advanced thinkers on
+computerized texts are those dealing with ancient Greek and Roman materials;
+3) the network world; and 4) the general world of library science, which
+includes people interested in preservation and cataloging.
+
+FLEISCHHAUER concluded his remarks with special thanks to the David and
+Lucile Packard Foundation for its support of the meeting, the American
+Memory group, the Office for Scholarly Programs, the National
+Demonstration Lab, and the Office of Special Events. He expressed the
+hope that David Woodley Packard might be able to attend, noting that
+Packard's work and the work of the foundation had sponsored a number of
+projects in the text area.
+
+ ******
+
+SESSION I. CONTENT IN A NEW FORM: WHO WILL USE IT AND WHAT WILL THEY DO?
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DALY * Acknowledgements * A new Latin authors disk * Effects of the new
+technology on previous methods of research *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Serving as moderator, James DALY acknowledged the generosity of all the
+presenters for giving of their time, counsel, and patience in planning
+the Workshop, as well as of members of the American Memory project and
+other Library of Congress staff, and the David and Lucile Packard
+Foundation and its executive director, Colburn S. Wilbur.
+
+DALY then recounted his visit in March to the Center for Electronic Texts
+in the Humanities (CETH) and the Department of Classics at Rutgers
+University, where an old friend, Lowell Edmunds, introduced him to the
+department's IBYCUS scholarly personal computer, and, in particular, the
+new Latin CD-ROM, containing, among other things, almost all classical
+Latin literary texts through A.D. 200. Packard Humanities Institute
+(PHI), Los Altos, California, released this disk late in 1991, with a
+nominal triennial licensing fee.
+
+Playing with the disk for an hour or so at Rutgers brought home to DALY
+at once the revolutionizing impact of the new technology on his previous
+methods of research. Had this disk been available two or three years
+earlier, DALY contended, when he was engaged in preparing a commentary on
+Book 10 of Virgil's Aeneid for Cambridge University Press, he would not
+have required a forty-eight-square-foot table on which to spread the
+numerous, most frequently consulted items, including some ten or twelve
+concordances to key Latin authors, an almost equal number of lexica to
+authors who lacked concordances, and where either lexica or concordances
+were lacking, numerous editions of authors antedating and postdating Virgil.
+
+Nor, when checking each of the average six to seven words contained in
+the Virgilian hexameter for its usage elsewhere in Virgil's works or
+other Latin authors, would DALY have had to maintain the laborious
+mechanical process of flipping through these concordances, lexica, and
+editions each time. Nor would he have had to frequent as often the
+Milton S. Eisenhower Library at the Johns Hopkins University to consult
+the Thesaurus Linguae Latinae. Instead of devoting countless hours, or
+the bulk of his research time, to gathering data concerning Virgil's use
+of words, DALY--now freed by PHI's Latin authors disk from the
+tyrannical, yet in some ways paradoxically happy scholarly drudgery--
+would have been able to devote that same bulk of time to analyzing and
+interpreting Virgilian verbal usage.
+
+Citing Theodore Brunner, Gregory Crane, Elli MYLONAS, and Avra MICHELSON,
+DALY argued that this reversal in his style of work, made possible by the
+new technology, would perhaps have resulted in better, more productive
+research. Indeed, even in the course of his browsing the Latin authors
+disk at Rutgers, its powerful search, retrieval, and highlighting
+capabilities suggested to him several new avenues of research into
+Virgil's use of sound effects. This anecdotal account, DALY maintained,
+may serve to illustrate in part the sudden and radical transformation
+being wrought in the ways scholars work.
+
+ ******
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+MICHELSON * Elements related to scholarship and technology * Electronic
+texts within the context of broader trends within information technology
+and scholarly communication * Evaluation of the prospects for the use of
+electronic texts * Relationship of electronic texts to processes of
+scholarly communication in humanities research * New exchange formats
+created by scholars * Projects initiated to increase scholarly access to
+converted text * Trend toward making electronic resources available
+through research and education networks * Changes taking place in
+scholarly communication among humanities scholars * Network-mediated
+scholarship transforming traditional scholarly practices * Key
+information technology trends affecting the conduct of scholarly
+communication over the next decade * The trend toward end-user computing
+* The trend toward greater connectivity * Effects of these trends * Key
+transformations taking place * Summary of principal arguments *
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Avra MICHELSON, Archival Research and Evaluation Staff, National Archives
+and Records Administration (NARA), argued that establishing who will use
+electronic texts and what they will use them for involves a consideration
+of both information technology and scholarship trends. This
+consideration includes several elements related to scholarship and
+technology: 1) the key trends in information technology that are most
+relevant to scholarship; 2) the key trends in the use of currently
+available technology by scholars in the nonscientific community; and 3)
+the relationship between these two very distinct but interrelated trends.
+The investment in understanding this relationship being made by
+information providers, technologists, and public policy developers, as
+well as by scholars themselves, seems to be pervasive and growing,
+MICHELSON contended. She drew on collaborative work with Jeff Rothenberg
+on the scholarly use of technology.
+
+MICHELSON sought to place the phenomenon of electronic texts within the
+context of broader trends within information technology and scholarly
+communication. She argued that electronic texts are of most use to
+researchers to the extent that the researchers' working context (i.e.,
+their relevant bibliographic sources, collegial feedback, analytic tools,
+notes, drafts, etc.), along with their field's primary and secondary
+sources, also is accessible in electronic form and can be integrated in
+ways that are unique to the on-line environment.
+
+Evaluation of the prospects for the use of electronic texts includes two
+elements: 1) an examination of the ways in which researchers currently
+are using electronic texts along with other electronic resources, and 2)
+an analysis of key information technology trends that are affecting the
+long-term conduct of scholarly communication. MICHELSON limited her
+discussion of the use of electronic texts to the practices of humanists
+and noted that the scientific community was outside the panel's overview.
+
+MICHELSON examined the nature of the current relationship of electronic
+texts in particular, and electronic resources in general, to what she
+maintained were, essentially, five processes of scholarly communication
+in humanities research. Researchers 1) identify sources, 2) communicate
+with their colleagues, 3) interpret and analyze data, 4) disseminate
+their research findings, and 5) prepare curricula to instruct the next
+generation of scholars and students. This examination would produce a
+clearer understanding of the synergy among these five processes that
+fuels the tendency of the use of electronic resources for one process to
+stimulate its use for other processes of scholarly communication.
+
+For the first process of scholarly communication, the identification of
+sources, MICHELSON remarked the opportunity scholars now enjoy to
+supplement traditional word-of-mouth searches for sources among their
+colleagues with new forms of electronic searching. So, for example,
+instead of having to visit the library, researchers are able to explore
+descriptions of holdings in their offices. Furthermore, if their own
+institutions' holdings prove insufficient, scholars can access more than
+200 major American library catalogues over Internet, including the
+universities of California, Michigan, Pennsylvania, and Wisconsin.
+Direct access to the bibliographic databases offers intellectual
+empowerment to scholars by presenting a comprehensive means of browsing
+through libraries from their homes and offices at their convenience.
+
+The second process of communication involves communication among
+scholars. Beyond the most common methods of communication, scholars are
+using E-mail and a variety of new electronic communications formats
+derived from it for further academic interchange. E-mail exchanges are
+growing at an astonishing rate, reportedly 15 percent a month. They
+currently constitute approximately half the traffic on research and
+education networks. Moreover, the global spread of E-mail has been so
+rapid that it is now possible for American scholars to use it to
+communicate with colleagues in close to 140 other countries.
+
+Other new exchange formats created by scholars and operating on Internet
+include more than 700 conferences, with about 80 percent of these devoted
+to topics in the social sciences and humanities. The rate of growth of
+these scholarly electronic conferences also is astonishing. From l990 to
+l991, 200 new conferences were identified on Internet. From October 1991
+to June 1992, an additional 150 conferences in the social sciences and
+humanities were added to this directory of listings. Scholars have
+established conferences in virtually every field, within every different
+discipline. For example, there are currently close to 600 active social
+science and humanities conferences on topics such as art and
+architecture, ethnomusicology, folklore, Japanese culture, medical
+education, and gifted and talented education. The appeal to scholars of
+communicating through these conferences is that, unlike any other medium,
+electronic conferences today provide a forum for global communication
+with peers at the front end of the research process.
+
+Interpretation and analysis of sources constitutes the third process of
+scholarly communication that MICHELSON discussed in terms of texts and
+textual resources. The methods used to analyze sources fall somewhere on
+a continuum from quantitative analysis to qualitative analysis.
+Typically, evidence is culled and evaluated using methods drawn from both
+ends of this continuum. At one end, quantitative analysis involves the
+use of mathematical processes such as a count of frequencies and
+distributions of occurrences or, on a higher level, regression analysis.
+At the other end of the continuum, qualitative analysis typically
+involves nonmathematical processes oriented toward language
+interpretation or the building of theory. Aspects of this work involve
+the processing--either manual or computational--of large and sometimes
+massive amounts of textual sources, although the use of nontextual
+sources as evidence, such as photographs, sound recordings, film footage,
+and artifacts, is significant as well.
+
+Scholars have discovered that many of the methods of interpretation and
+analysis that are related to both quantitative and qualitative methods
+are processes that can be performed by computers. For example, computers
+can count. They can count brush strokes used in a Rembrandt painting or
+perform regression analysis for understanding cause and effect. By means
+of advanced technologies, computers can recognize patterns, analyze text,
+and model concepts. Furthermore, computers can complete these processes
+faster with more sources and with greater precision than scholars who
+must rely on manual interpretation of data. But if scholars are to use
+computers for these processes, source materials must be in a form
+amenable to computer-assisted analysis. For this reason many scholars,
+once they have identified the sources that are key to their research, are
+converting them to machine-readable form. Thus, a representative example
+of the numerous textual conversion projects organized by scholars around
+the world in recent years to support computational text analysis is the
+TLG, the Thesaurus Linguae Graecae. This project is devoted to
+converting the extant ancient texts of classical Greece. (Editor's note:
+according to the TLG Newsletter of May l992, TLG was in use in thirty-two
+different countries. This figure updates MICHELSON's previous count by one.)
+
+The scholars performing these conversions have been asked to recognize
+that the electronic sources they are converting for one use possess value
+for other research purposes as well. As a result, during the past few
+years, humanities scholars have initiated a number of projects to
+increase scholarly access to converted text. So, for example, the Text
+Encoding Initiative (TEI), about which more is said later in the program,
+was established as an effort by scholars to determine standard elements
+and methods for encoding machine-readable text for electronic exchange.
+In a second effort to facilitate the sharing of converted text, scholars
+have created a new institution, the Center for Electronic Texts in the
+Humanities (CETH). The center estimates that there are 8,000 series of
+source texts in the humanities that have been converted to
+machine-readable form worldwide. CETH is undertaking an international
+search for converted text in the humanities, compiling it into an
+electronic library, and preparing bibliographic descriptions of the
+sources for the Research Libraries Information Network's (RLIN)
+machine-readable data file. The library profession has begun to initiate
+large conversion projects as well, such as American Memory.
+
+While scholars have been making converted text available to one another,
+typically on disk or on CD-ROM, the clear trend is toward making these
+resources available through research and education networks. Thus, the
+American and French Research on the Treasury of the French Language
+(ARTFL) and the Dante Project are already available on Internet.
+MICHELSON summarized this section on interpretation and analysis by
+noting that: 1) increasing numbers of humanities scholars in the library
+community are recognizing the importance to the advancement of
+scholarship of retrospective conversion of source materials in the arts
+and humanities; and 2) there is a growing realization that making the
+sources available on research and education networks maximizes their
+usefulness for the analysis performed by humanities scholars.
+
+The fourth process of scholarly communication is dissemination of
+research findings, that is, publication. Scholars are using existing
+research and education networks to engineer a new type of publication:
+scholarly-controlled journals that are electronically produced and
+disseminated. Although such journals are still emerging as a
+communication format, their number has grown, from approximately twelve
+to thirty-six during the past year (July 1991 to June 1992). Most of
+these electronic scholarly journals are devoted to topics in the
+humanities. As with network conferences, scholarly enthusiasm for these
+electronic journals stems from the medium's unique ability to advance
+scholarship in a way that no other medium can do by supporting global
+feedback and interchange, practically in real time, early in the research
+process. Beyond scholarly journals, MICHELSON remarked the delivery of
+commercial full-text products, such as articles in professional journals,
+newsletters, magazines, wire services, and reference sources. These are
+being delivered via on-line local library catalogues, especially through
+CD-ROMs. Furthermore, according to MICHELSON, there is general optimism
+that the copyright and fees issues impeding the delivery of full text on
+existing research and education networks soon will be resolved.
+
+The final process of scholarly communication is curriculum development
+and instruction, and this involves the use of computer information
+technologies in two areas. The first is the development of
+computer-oriented instructional tools, which includes simulations,
+multimedia applications, and computer tools that are used to assist in
+the analysis of sources in the classroom, etc. The Perseus Project, a
+database that provides a multimedia curriculum on classical Greek
+civilization, is a good example of the way in which entire curricula are
+being recast using information technologies. It is anticipated that the
+current difficulty in exchanging electronically computer-based
+instructional software, which in turn makes it difficult for one scholar
+to build upon the work of others, will be resolved before too long.
+Stand-alone curricular applications that involve electronic text will be
+sharable through networks, reinforcing their significance as intellectual
+products as well as instructional tools.
+
+The second aspect of electronic learning involves the use of research and
+education networks for distance education programs. Such programs
+interactively link teachers with students in geographically scattered
+locations and rely on the availability of electronic instructional
+resources. Distance education programs are gaining wide appeal among
+state departments of education because of their demonstrated capacity to
+bring advanced specialized course work and an array of experts to many
+classrooms. A recent report found that at least 32 states operated at
+least one statewide network for education in 1991, with networks under
+development in many of the remaining states.
+
+MICHELSON summarized this section by noting two striking changes taking
+place in scholarly communication among humanities scholars. First is the
+extent to which electronic text in particular, and electronic resources
+in general, are being infused into each of the five processes described
+above. As mentioned earlier, there is a certain synergy at work here.
+The use of electronic resources for one process tends to stimulate its
+use for other processes, because the chief course of movement is toward a
+comprehensive on-line working context for humanities scholars that
+includes on-line availability of key bibliographies, scholarly feedback,
+sources, analytical tools, and publications. MICHELSON noted further
+that the movement toward a comprehensive on-line working context for
+humanities scholars is not new. In fact, it has been underway for more
+than forty years in the humanities, since Father Roberto Busa began
+developing an electronic concordance of the works of Saint Thomas Aquinas
+in 1949. What we are witnessing today, MICHELSON contended, is not the
+beginning of this on-line transition but, for at least some humanities
+scholars, the turning point in the transition from a print to an
+electronic working context. Coinciding with the on-line transition, the
+second striking change is the extent to which research and education
+networks are becoming the new medium of scholarly communication. The
+existing Internet and the pending National Education and Research Network
+(NREN) represent the new meeting ground where scholars are going for
+bibliographic information, scholarly dialogue and feedback, the most
+current publications in their field, and high-level educational
+offerings. Traditional scholarly practices are undergoing tremendous
+transformations as a result of the emergence and growing prominence of
+what is called network-mediated scholarship.
+
+MICHELSON next turned to the second element of the framework she proposed
+at the outset of her talk for evaluating the prospects for electronic
+text, namely the key information technology trends affecting the conduct
+of scholarly communication over the next decade: 1) end-user computing
+and 2) connectivity.
+
+End-user computing means that the person touching the keyboard, or
+performing computations, is the same as the person who initiates or
+consumes the computation. The emergence of personal computers, along
+with a host of other forces, such as ubiquitous computing, advances in
+interface design, and the on-line transition, is prompting the consumers
+of computation to do their own computing, and is thus rendering obsolete
+the traditional distinction between end users and ultimate users.
+
+The trend toward end-user computing is significant to consideration of
+the prospects for electronic texts because it means that researchers are
+becoming more adept at doing their own computations and, thus, more
+competent in the use of electronic media. By avoiding programmer
+intermediaries, computation is becoming central to the researcher's
+thought process. This direct involvement in computing is changing the
+researcher's perspective on the nature of research itself, that is, the
+kinds of questions that can be posed, the analytical methodologies that
+can be used, the types and amount of sources that are appropriate for
+analyses, and the form in which findings are presented. The trend toward
+end-user computing means that, increasingly, electronic media and
+computation are being infused into all processes of humanities
+scholarship, inspiring remarkable transformations in scholarly
+communication.
+
+The trend toward greater connectivity suggests that researchers are using
+computation increasingly in network environments. Connectivity is
+important to scholarship because it erases the distance that separates
+students from teachers and scholars from their colleagues, while allowing
+users to access remote databases, share information in many different
+media, connect to their working context wherever they are, and
+collaborate in all phases of research.
+
+The combination of the trend toward end-user computing and the trend
+toward connectivity suggests that the scholarly use of electronic
+resources, already evident among some researchers, will soon become an
+established feature of scholarship. The effects of these trends, along
+with ongoing changes in scholarly practices, point to a future in which
+humanities researchers will use computation and electronic communication
+to help them formulate ideas, access sources, perform research,
+collaborate with colleagues, seek peer review, publish and disseminate
+results, and engage in many other professional and educational activities.
+
+In summary, MICHELSON emphasized four points: 1) A portion of humanities
+scholars already consider electronic texts the preferred format for
+analysis and dissemination. 2) Scholars are using these electronic
+texts, in conjunction with other electronic resources, in all the
+processes of scholarly communication. 3) The humanities scholars'
+working context is in the process of changing from print technology to
+electronic technology, in many ways mirroring transformations that have
+occurred or are occurring within the scientific community. 4) These
+changes are occurring in conjunction with the development of a new
+communication medium: research and education networks that are
+characterized by their capacity to advance scholarship in a wholly unique
+way.
+
+MICHELSON also reiterated her three principal arguments: l) Electronic
+texts are best understood in terms of the relationship to other
+electronic resources and the growing prominence of network-mediated
+scholarship. 2) The prospects for electronic texts lie in their capacity
+to be integrated into the on-line network of electronic resources that
+comprise the new working context for scholars. 3) Retrospective conversion
+of portions of the scholarly record should be a key strategy as information
+providers respond to changes in scholarly communication practices.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+VECCIA * AM's evaluation project and public users of electronic resources
+* AM and its design * Site selection and evaluating the Macintosh
+implementation of AM * Characteristics of the six public libraries
+selected * Characteristics of AM's users in these libraries * Principal
+ways AM is being used *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Susan VECCIA, team leader, and Joanne FREEMAN, associate coordinator,
+American Memory, Library of Congress, gave a joint presentation. First,
+by way of introduction, VECCIA explained her and FREEMAN's roles in
+American Memory (AM). Serving principally as an observer, VECCIA has
+assisted with the evaluation project of AM, placing AM collections in a
+variety of different sites around the country and helping to organize and
+implement that project. FREEMAN has been an associate coordinator of AM
+and has been involved principally with the interpretative materials,
+preparing some of the electronic exhibits and printed historical
+information that accompanies AM and that is requested by users. VECCIA
+and FREEMAN shared anecdotal observations concerning AM with public users
+of electronic resources. Notwithstanding a fairly structured evaluation
+in progress, both VECCIA and FREEMAN chose not to report on specifics in
+terms of numbers, etc., because they felt it was too early in the
+evaluation project to do so.
+
+AM is an electronic archive of primary source materials from the Library
+of Congress, selected collections representing a variety of formats--
+photographs, graphic arts, recorded sound, motion pictures, broadsides,
+and soon, pamphlets and books. In terms of the design of this system,
+the interpretative exhibits have been kept separate from the primary
+resources, with good reason. Accompanying this collection are printed
+documentation and user guides, as well as guides that FREEMAN prepared for
+teachers so that they may begin using the content of the system at once.
+
+VECCIA described the evaluation project before talking about the public
+users of AM, limiting her remarks to public libraries, because FREEMAN
+would talk more specifically about schools from kindergarten to twelfth
+grade (K-12). Having started in spring 1991, the evaluation currently
+involves testing of the Macintosh implementation of AM. Since the
+primary goal of this evaluation is to determine the most appropriate
+audience or audiences for AM, very different sites were selected. This
+makes evaluation difficult because of the varying degrees of technology
+literacy among the sites. AM is situated in forty-four locations, of
+which six are public libraries and sixteen are schools. Represented
+among the schools are elementary, junior high, and high schools.
+District offices also are involved in the evaluation, which will
+conclude in summer 1993.
+
+VECCIA focused the remainder of her talk on the six public libraries, one
+of which doubles as a state library. They represent a range of
+geographic areas and a range of demographic characteristics. For
+example, three are located in urban settings, two in rural settings, and
+one in a suburban setting. A range of technical expertise is to be found
+among these facilities as well. For example, one is an "Apple library of
+the future," while two others are rural one-room libraries--in one, AM
+sits at the front desk next to a tractor manual.
+
+All public libraries have been extremely enthusiastic, supportive, and
+appreciative of the work that AM has been doing. VECCIA characterized
+various users: Most users in public libraries describe themselves as
+general readers; of the students who use AM in the public libraries,
+those in fourth grade and above seem most interested. Public libraries
+in rural sites tend to attract retired people, who have been highly
+receptive to AM. Users tend to fall into two additional categories:
+people interested in the content and historical connotations of these
+primary resources, and those fascinated by the technology. The format
+receiving the most comments has been motion pictures. The adult users in
+public libraries are more comfortable with IBM computers, whereas young
+people seem comfortable with either IBM or Macintosh, although most of
+them seem to come from a Macintosh background. This same tendency is
+found in the schools.
+
+What kinds of things do users do with AM? In a public library there are
+two main goals or ways that AM is being used: as an individual learning
+tool, and as a leisure activity. Adult learning was one area that VECCIA
+would highlight as a possible application for a tool such as AM. She
+described a patron of a rural public library who comes in every day on
+his lunch hour and literally reads AM, methodically going through the
+collection image by image. At the end of his hour he makes an electronic
+bookmark, puts it in his pocket, and returns to work. The next day he
+comes in and resumes where he left off. Interestingly, this man had
+never been in the library before he used AM. In another small, rural
+library, the coordinator reports that AM is a popular activity for some
+of the older, retired people in the community, who ordinarily would not
+use "those things,"--computers. Another example of adult learning in
+public libraries is book groups, one of which, in particular, is using AM
+as part of its reading on industrialization, integration, and urbanization
+in the early 1900s.
+
+One library reports that a family is using AM to help educate their
+children. In another instance, individuals from a local museum came in
+to use AM to prepare an exhibit on toys of the past. These two examples
+emphasize the mission of the public library as a cultural institution,
+reaching out to people who do not have the same resources available to
+those who live in a metropolitan area or have access to a major library.
+One rural library reports that junior high school students in large
+numbers came in one afternoon to use AM for entertainment. A number of
+public libraries reported great interest among postcard collectors in the
+Detroit collection, which was essentially a collection of images used on
+postcards around the turn of the century. Train buffs are similarly
+interested because that was a time of great interest in railroading.
+People, it was found, relate to things that they know of firsthand. For
+example, in both rural public libraries where AM was made available,
+observers reported that the older people with personal remembrances of
+the turn of the century were gravitating to the Detroit collection.
+These examples served to underscore MICHELSON's observation re the
+integration of electronic tools and ideas--that people learn best when
+the material relates to something they know.
+
+VECCIA made the final point that in many cases AM serves as a
+public-relations tool for the public libraries that are testing it. In
+one case, AM is being used as a vehicle to secure additional funding for
+the library. In another case, AM has served as an inspiration to the
+staff of a major local public library in the South to think about ways to
+make its own collection of photographs more accessible to the public.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+FREEMAN * AM and archival electronic resources in a school environment *
+Questions concerning context * Questions concerning the electronic format
+itself * Computer anxiety * Access and availability of the system *
+Hardware * Strengths gained through the use of archival resources in
+schools *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Reiterating an observation made by VECCIA, that AM is an archival
+resource made up of primary materials with very little interpretation,
+FREEMAN stated that the project has attempted to bridge the gap between
+these bare primary materials and a school environment, and in that cause
+has created guided introductions to AM collections. Loud demand from the
+educational community, chiefly from teachers working with the upper
+grades of elementary school through high school, greeted the announcement
+that AM would be tested around the country.
+
+FREEMAN reported not only on what was learned about AM in a school
+environment, but also on several universal questions that were raised
+concerning archival electronic resources in schools. She discussed
+several strengths of this type of material in a school environment as
+opposed to a highly structured resource that offers a limited number of
+paths to follow.
+
+FREEMAN first raised several questions about using AM in a school
+environment. There is often some difficulty in developing a sense of
+what the system contains. Many students sit down at a computer resource
+and assume that, because AM comes from the Library of Congress, all of
+American history is now at their fingertips. As a result of that sort of
+mistaken judgment, some students are known to conclude that AM contains
+nothing of use to them when they look for one or two things and do not
+find them. It is difficult to discover that middle ground where one has
+a sense of what the system contains. Some students grope toward the idea
+of an archive, a new idea to them, since they have not previously
+experienced what it means to have access to a vast body of somewhat
+random information.
+
+Other questions raised by FREEMAN concerned the electronic format itself.
+For instance, in a school environment it is often difficult both for
+teachers and students to gain a sense of what it is they are viewing.
+They understand that it is a visual image, but they do not necessarily
+know that it is a postcard from the turn of the century, a panoramic
+photograph, or even machine-readable text of an eighteenth-century
+broadside, a twentieth-century printed book, or a nineteenth-century
+diary. That distinction is often difficult for people in a school
+environment to grasp. Because of that, it occasionally becomes difficult
+to draw conclusions from what one is viewing.
+
+FREEMAN also noted the obvious fear of the computer, which constitutes a
+difficulty in using an electronic resource. Though students in general
+did not suffer from this anxiety, several older students feared that they
+were computer-illiterate, an assumption that became self-fulfilling when
+they searched for something but failed to find it. FREEMAN said she
+believed that some teachers also fear computer resources, because they
+believe they lack complete control. FREEMAN related the example of
+teachers shooing away students because it was not their time to use the
+system. This was a case in which the situation had to be extremely
+structured so that the teachers would not feel that they had lost their
+grasp on what the system contained.
+
+A final question raised by FREEMAN concerned access and availability of
+the system. She noted the occasional existence of a gap in communication
+between school librarians and teachers. Often AM sits in a school
+library and the librarian is the person responsible for monitoring the
+system. Teachers do not always take into their world new library
+resources about which the librarian is excited. Indeed, at the sites
+where AM had been used most effectively within a library, the librarian
+was required to go to specific teachers and instruct them in its use. As
+a result, several AM sites will have in-service sessions over a summer,
+in the hope that perhaps, with a more individualized link, teachers will
+be more likely to use the resource.
+
+A related issue in the school context concerned the number of
+workstations available at any one location. Centralization of equipment
+at the district level, with teachers invited to download things and walk
+away with them, proved unsuccessful because the hours these offices were
+open were also school hours.
+
+Another issue was hardware. As VECCIA observed, a range of sites exists,
+some technologically advanced and others essentially acquiring their
+first computer for the primary purpose of using it in conjunction with
+AM's testing. Users at technologically sophisticated sites want even
+more sophisticated hardware, so that they can perform even more
+sophisticated tasks with the materials in AM. But once they acquire a
+newer piece of hardware, they must learn how to use that also; at an
+unsophisticated site it takes an extremely long time simply to become
+accustomed to the computer, not to mention the program offered with the
+computer. All of these small issues raise one large question, namely,
+are systems like AM truly rewarding in a school environment, or do they
+simply act as innovative toys that do little more than spark interest?
+
+FREEMAN contended that the evaluation project has revealed several strengths
+that were gained through the use of archival resources in schools, including:
+
+ * Psychic rewards from using AM as a vast, rich database, with
+ teachers assigning various projects to students--oral presentations,
+ written reports, a documentary, a turn-of-the-century newspaper--
+ projects that start with the materials in AM but are completed using
+ other resources; AM thus is used as a research tool in conjunction
+ with other electronic resources, as well as with books and items in
+ the library where the system is set up.
+
+ * Students are acquiring computer literacy in a humanities context.
+
+ * This sort of system is overcoming the isolation between disciplines
+ that often exists in schools. For example, many English teachers are
+ requiring their students to write papers on historical topics
+ represented in AM. Numerous teachers have reported that their
+ students are learning critical thinking skills using the system.
+
+ * On a broader level, AM is introducing primary materials, not only
+ to students but also to teachers, in an environment where often
+ simply none exist--an exciting thing for the students because it
+ helps them learn to conduct research, to interpret, and to draw
+ their own conclusions. In learning to conduct research and what it
+ means, students are motivated to seek knowledge. That relates to
+ another positive outcome--a high level of personal involvement of
+ students with the materials in this system and greater motivation to
+ conduct their own research and draw their own conclusions.
+
+ * Perhaps the most ironic strength of these kinds of archival
+ electronic resources is that many of the teachers AM interviewed
+ were desperate, it is no exaggeration to say, not only for primary
+ materials but for unstructured primary materials. These would, they
+ thought, foster personally motivated research, exploration, and
+ excitement in their students. Indeed, these materials have done
+ just that. Ironically, however, this lack of structure produces
+ some of the confusion to which the newness of these kinds of
+ resources may also contribute. The key to effective use of archival
+ products in a school environment is a clear, effective introduction
+ to the system and to what it contains.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Nothing known, quantitatively, about the number of
+humanities scholars who must see the original versus those who would
+settle for an edited transcript, or about the ways in which humanities
+scholars are using information technology * Firm conclusions concerning
+the manner and extent of the use of supporting materials in print
+provided by AM to await completion of evaluative study * A listener's
+reflections on additional applications of electronic texts * Role of
+electronic resources in teaching elementary research skills to students *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+During the discussion that followed the presentations by MICHELSON,
+VECCIA, and FREEMAN, additional points emerged.
+
+LESK asked if MICHELSON could give any quantitative estimate of the
+number of humanities scholars who must see or want to see the original,
+or the best possible version of the material, versus those who typically
+would settle for an edited transcript. While unable to provide a figure,
+she offered her impressions as an archivist who has done some reference
+work and has discussed this issue with other archivists who perform
+reference, that those who use archives and those who use primary sources
+for what would be considered very high-level scholarly research, as
+opposed to, say, undergraduate papers, were few in number, especially
+given the public interest in using primary sources to conduct
+genealogical or avocational research and the kind of professional
+research done by people in private industry or the federal government.
+More important in MICHELSON's view was that, quantitatively, nothing is
+known about the ways in which, for example, humanities scholars are using
+information technology. No studies exist to offer guidance in creating
+strategies. The most recent study was conducted in 1985 by the American
+Council of Learned Societies (ACLS), and what it showed was that 50
+percent of humanities scholars at that time were using computers. That
+constitutes the extent of our knowledge.
+
+Concerning AM's strategy for orienting people toward the scope of
+electronic resources, FREEMAN could offer no hard conclusions at this
+point, because she and her colleagues were still waiting to see,
+particularly in the schools, what has been made of their efforts. Within
+the system, however, AM has provided what are called electronic exhibits-
+-such as introductions to time periods and materials--and these are
+intended to offer a student user a sense of what a broadside is and what
+it might tell her or him. But FREEMAN conceded that the project staff
+would have to talk with students next year, after teachers have had a
+summer to use the materials, and attempt to discover what the students
+were learning from the materials. In addition, FREEMAN described
+supporting materials in print provided by AM at the request of local
+teachers during a meeting held at LC. These included time lines,
+bibliographies, and other materials that could be reproduced on a
+photocopier in a classroom. Teachers could walk away with and use these,
+and in this way gain a better understanding of the contents. But again,
+reaching firm conclusions concerning the manner and extent of their use
+would have to wait until next year.
+
+As to the changes she saw occurring at the National Archives and Records
+Administration (NARA) as a result of the increasing emphasis on
+technology in scholarly research, MICHELSON stated that NARA at this
+point was absorbing the report by her and Jeff Rothenberg addressing
+strategies for the archival profession in general, although not for the
+National Archives specifically. NARA is just beginning to establish its
+role and what it can do. In terms of changes and initiatives that NARA
+can take, no clear response could be given at this time.
+
+GREENFIELD remarked two trends mentioned in the session. Reflecting on
+DALY's opening comments on how he could have used a Latin collection of
+text in an electronic form, he said that at first he thought most scholars
+would be unwilling to do that. But as he thought of that in terms of the
+original meaning of research--that is, having already mastered these texts,
+researching them for critical and comparative purposes--for the first time,
+the electronic format made a lot of sense. GREENFIELD could envision
+growing numbers of scholars learning the new technologies for that very
+aspect of their scholarship and for convenience's sake.
+
+Listening to VECCIA and FREEMAN, GREENFIELD thought of an additional
+application of electronic texts. He realized that AM could be used as a
+guide to lead someone to original sources. Students cannot be expected
+to have mastered these sources, things they have never known about
+before. Thus, AM is leading them, in theory, to a vast body of
+information and giving them a superficial overview of it, enabling them
+to select parts of it. GREENFIELD asked if any evidence exists that this
+resource will indeed teach the new user, the K-12 students, how to do
+research. Scholars already know how to do research and are applying
+these new tools. But he wondered why students would go beyond picking
+out things that were most exciting to them.
+
+FREEMAN conceded the correctness of GREENFIELD's observation as applied
+to a school environment. The risk is that a student would sit down at a
+system, play with it, find some things of interest, and then walk away.
+But in the relatively controlled situation of a school library, much will
+depend on the instructions a teacher or a librarian gives a student. She
+viewed the situation not as one of fine-tuning research skills but of
+involving students at a personal level in understanding and researching
+things. Given the guidance one can receive at school, it then becomes
+possible to teach elementary research skills to students, which in fact
+one particular librarian said she was teaching her fifth graders.
+FREEMAN concluded that introducing the idea of following one's own path
+of inquiry, which is essentially what research entails, involves more
+than teaching specific skills. To these comments VECCIA added the
+observation that the individual teacher and the use of a creative
+resource, rather than AM itself, seemed to make the key difference.
+Some schools and some teachers are making excellent use of the nature
+of critical thinking and teaching skills, she said.
+
+Concurring with these remarks, DALY closed the session with the thought that
+the more that producers produced for teachers and for scholars to use with
+their students, the more successful their electronic products would prove.
+
+ ******
+
+SESSION II. SHOW AND TELL
+
+Jacqueline HESS, director, National Demonstration Laboratory, served as
+moderator of the "show-and-tell" session. She noted that a
+question-and-answer period would follow each presentation.
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+MYLONAS * Overview and content of Perseus * Perseus' primary materials
+exist in a system-independent, archival form * A concession * Textual
+aspects of Perseus * Tools to use with the Greek text * Prepared indices
+and full-text searches in Perseus * English-Greek word search leads to
+close study of words and concepts * Navigating Perseus by tracing down
+indices * Using the iconography to perform research *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Elli MYLONAS, managing editor, Perseus Project, Harvard University, first
+gave an overview of Perseus, a large, collaborative effort based at
+Harvard University but with contributors and collaborators located at
+numerous universities and colleges in the United States (e.g., Bowdoin,
+Maryland, Pomona, Chicago, Virginia). Funded primarily by the
+Annenberg/CPB Project, with additional funding from Apple, Harvard, and
+the Packard Humanities Institute, among others, Perseus is a multimedia,
+hypertextual database for teaching and research on classical Greek
+civilization, which was released in February 1992 in version 1.0 and
+distributed by Yale University Press.
+
+Consisting entirely of primary materials, Perseus includes ancient Greek
+texts and translations of those texts; catalog entries--that is, museum
+catalog entries, not library catalog entries--on vases, sites, coins,
+sculpture, and archaeological objects; maps; and a dictionary, among
+other sources. The number of objects and the objects for which catalog
+entries exist are accompanied by thousands of color images, which
+constitute a major feature of the database. Perseus contains
+approximately 30 megabytes of text, an amount that will double in
+subsequent versions. In addition to these primary materials, the Perseus
+Project has been building tools for using them, making access and
+navigation easier, the goal being to build part of the electronic
+environment discussed earlier in the morning in which students or
+scholars can work with their sources.
+
+The demonstration of Perseus will show only a fraction of the real work
+that has gone into it, because the project had to face the dilemma of
+what to enter when putting something into machine-readable form: should
+one aim for very high quality or make concessions in order to get the
+material in? Since Perseus decided to opt for very high quality, all of
+its primary materials exist in a system-independent--insofar as it is
+possible to be system-independent--archival form. Deciding what that
+archival form would be and attaining it required much work and thought.
+For example, all the texts are marked up in SGML, which will be made
+compatible with the guidelines of the Text Encoding Initiative (TEI) when
+they are issued.
+
+Drawings are postscript files, not meeting international standards, but
+at least designed to go across platforms. Images, or rather the real
+archival forms, consist of the best available slides, which are being
+digitized. Much of the catalog material exists in database form--a form
+that the average user could use, manipulate, and display on a personal
+computer, but only at great cost. Thus, this is where the concession
+comes in: All of this rich, well-marked-up information is stripped of
+much of its content; the images are converted into bit-maps and the text
+into small formatted chunks. All this information can then be imported
+into HyperCard and run on a mid-range Macintosh, which is what Perseus
+users have. This fact has made it possible for Perseus to attain wide
+use fairly rapidly. Without those archival forms the HyperCard version
+being demonstrated could not be made easily, and the project could not
+have the potential to move to other forms and machines and software as
+they appear, none of which information is in Perseus on the CD.
+
+Of the numerous multimedia aspects of Perseus, MYLONAS focused on the
+textual. Part of what makes Perseus such a pleasure to use, MYLONAS
+said, is this effort at seamless integration and the ability to move
+around both visual and textual material. Perseus also made the decision
+not to attempt to interpret its material any more than one interprets by
+selecting. But, MYLONAS emphasized, Perseus is not courseware: No
+syllabus exists. There is no effort to define how one teaches a topic
+using Perseus, although the project may eventually collect papers by
+people who have used it to teach. Rather, Perseus aims to provide
+primary material in a kind of electronic library, an electronic sandbox,
+so to say, in which students and scholars who are working on this
+material can explore by themselves. With that, MYLONAS demonstrated
+Perseus, beginning with the Perseus gateway, the first thing one sees
+upon opening Perseus--an effort in part to solve the contextualizing
+problem--which tells the user what the system contains.
+
+MYLONAS demonstrated only a very small portion, beginning with primary
+texts and running off the CD-ROM. Having selected Aeschylus' Prometheus
+Bound, which was viewable in Greek and English pretty much in the same
+segments together, MYLONAS demonstrated tools to use with the Greek text,
+something not possible with a book: looking up the dictionary entry form
+of an unfamiliar word in Greek after subjecting it to Perseus'
+morphological analysis for all the texts. After finding out about a
+word, a user may then decide to see if it is used anywhere else in Greek.
+Because vast amounts of indexing support all of the primary material, one
+can find out where else all forms of a particular Greek word appear--
+often not a trivial matter because Greek is highly inflected. Further,
+since the story of Prometheus has to do with the origins of sacrifice, a
+user may wish to study and explore sacrifice in Greek literature; by
+typing sacrifice into a small window, a user goes to the English-Greek
+word list--something one cannot do without the computer (Perseus has
+indexed the definitions of its dictionary)--the string sacrifice appears
+in the definitions of these sixty-five words. One may then find out
+where any of those words is used in the work(s) of a particular author.
+The English definitions are not lemmatized.
+
+All of the indices driving this kind of usage were originally devised for
+speed, MYLONAS observed; in other words, all that kind of information--
+all forms of all words, where they exist, the dictionary form they belong
+to--were collected into databases, which will expedite searching. Then
+it was discovered that one can do things searching in these databases
+that could not be done searching in the full texts. Thus, although there
+are full-text searches in Perseus, much of the work is done behind the
+scenes, using prepared indices. Re the indexing that is done behind the
+scenes, MYLONAS pointed out that without the SGML forms of the text, it
+could not be done effectively. Much of this indexing is based on the
+structures that are made explicit by the SGML tagging.
+
+It was found that one of the things many of Perseus' non-Greek-reading
+users do is start from the dictionary and then move into the close study
+of words and concepts via this kind of English-Greek word search, by which
+means they might select a concept. This exercise has been assigned to
+students in core courses at Harvard--to study a concept by looking for the
+English word in the dictionary, finding the Greek words, and then finding
+the words in the Greek but, of course, reading across in the English.
+That tells them a great deal about what a translation means as well.
+
+Should one also wish to see images that have to do with sacrifice, that
+person would go to the object key word search, which allows one to
+perform a similar kind of index retrieval on the database of
+archaeological objects. Without words, pictures are useless; Perseus has
+not reached the point where it can do much with images that are not
+cataloged. Thus, although it is possible in Perseus with text and images
+to navigate by knowing where one wants to end up--for example, a
+red-figure vase from the Boston Museum of Fine Arts--one can perform this
+kind of navigation very easily by tracing down indices. MYLONAS
+illustrated several generic scenes of sacrifice on vases. The features
+demonstrated derived from Perseus 1.0; version 2.0 will implement even
+better means of retrieval.
+
+MYLONAS closed by looking at one of the pictures and noting again that
+one can do a great deal of research using the iconography as well as the
+texts. For instance, students in a core course at Harvard this year were
+highly interested in Greek concepts of foreigners and representations of
+non-Greeks. So they performed a great deal of research, both with texts
+(e.g., Herodotus) and with iconography on vases and coins, on how the
+Greeks portrayed non-Greeks. At the same time, art historians who study
+iconography were also interested, and were able to use this material.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Indexing and searchability of all English words in Perseus *
+Several features of Perseus 1.0 * Several levels of customization
+possible * Perseus used for general education * Perseus' effects on
+education * Contextual information in Perseus * Main challenge and
+emphasis of Perseus *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Several points emerged in the discussion that followed MYLONAS's presentation.
+
+Although MYLONAS had not demonstrated Perseus' ability to cross-search
+documents, she confirmed that all English words in Perseus are indexed
+and can be searched. So, for example, sacrifice could have been searched
+in all texts, the historical essay, and all the catalogue entries with
+their descriptions--in short, in all of Perseus.
+
+Boolean logic is not in Perseus 1.0 but will be added to the next
+version, although an effort is being made not to restrict Perseus to a
+database in which one just performs searching, Boolean or otherwise. It
+is possible to move laterally through the documents by selecting a word
+one is interested in and selecting an area of information one is
+interested in and trying to look that word up in that area.
+
+Since Perseus was developed in HyperCard, several levels of customization
+are possible. Simple authoring tools exist that allow one to create
+annotated paths through the information, which are useful for note-taking
+and for guided tours for teaching purposes and for expository writing.
+With a little more ingenuity it is possible to begin to add or substitute
+material in Perseus.
+
+Perseus has not been used so much for classics education as for general
+education, where it seemed to have an impact on the students in the core
+course at Harvard (a general required course that students must take in
+certain areas). Students were able to use primary material much more.
+
+The Perseus Project has an evaluation team at the University of Maryland
+that has been documenting Perseus' effects on education. Perseus is very
+popular, and anecdotal evidence indicates that it is having an effect at
+places other than Harvard, for example, test sites at Ball State
+University, Drury College, and numerous small places where opportunities
+to use vast amounts of primary data may not exist. One documented effect
+is that archaeological, anthropological, and philological research is
+being done by the same person instead of by three different people.
+
+The contextual information in Perseus includes an overview essay, a
+fairly linear historical essay on the fifth century B.C. that provides
+links into the primary material (e.g., Herodotus, Thucydides, and
+Plutarch), via small gray underscoring (on the screen) of linked
+passages. These are handmade links into other material.
+
+To different extents, most of the production work was done at Harvard,
+where the people and the equipment are located. Much of the
+collaborative activity involved data collection and structuring, because
+the main challenge and the emphasis of Perseus is the gathering of
+primary material, that is, building a useful environment for studying
+classical Greece, collecting data, and making it useful.
+Systems-building is definitely not the main concern. Thus, much of the
+work has involved writing essays, collecting information, rewriting it,
+and tagging it. That can be done off site. The creative link for the
+overview essay as well as for both systems and data was collaborative,
+and was forged via E-mail and paper mail with professors at Pomona and
+Bowdoin.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+CALALUCA * PLD's principal focus and contribution to scholarship *
+Various questions preparatory to beginning the project * Basis for
+project * Basic rule in converting PLD * Concerning the images in PLD *
+Running PLD under a variety of retrieval softwares * Encoding the
+database a hard-fought issue * Various features demonstrated * Importance
+of user documentation * Limitations of the CD-ROM version *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Eric CALALUCA, vice president, Chadwyck-Healey, Inc., demonstrated a
+software interpretation of the Patrologia Latina Database (PLD). PLD's
+principal focus from the beginning of the project about three-and-a-half
+years ago was on converting Migne's Latin series, and in the end,
+CALALUCA suggested, conversion of the text will be the major contribution
+to scholarship. CALALUCA stressed that, as possibly the only private
+publishing organization at the Workshop, Chadwyck-Healey had sought no
+federal funds or national foundation support before embarking upon the
+project, but instead had relied upon a great deal of homework and
+marketing to accomplish the task of conversion.
+
+Ever since the possibilities of computer-searching have emerged, scholars
+in the field of late ancient and early medieval studies (philosophers,
+theologians, classicists, and those studying the history of natural law
+and the history of the legal development of Western civilization) have
+been longing for a fully searchable version of Western literature, for
+example, all the texts of Augustine and Bernard of Clairvaux and
+Boethius, not to mention all the secondary and tertiary authors.
+
+Various questions arose, CALALUCA said. Should one convert Migne?
+Should the database be encoded? Is it necessary to do that? How should
+it be delivered? What about CD-ROM? Since this is a transitional
+medium, why even bother to create software to run on a CD-ROM? Since
+everybody knows people will be networking information, why go to the
+trouble--which is far greater with CD-ROM than with the production of
+magnetic data? Finally, how does one make the data available? Can many
+of the hurdles to using electronic information that some publishers have
+imposed upon databases be eliminated?
+
+The PLD project was based on the principle that computer-searching of
+texts is most effective when it is done with a large database. Because
+PLD represented a collection that serves so many disciplines across so
+many periods, it was irresistible.
+
+The basic rule in converting PLD was to do no harm, to avoid the sins of
+intrusion in such a database: no introduction of newer editions, no
+on-the-spot changes, no eradicating of all possible falsehoods from an
+edition. Thus, PLD is not the final act in electronic publishing for
+this discipline, but simply the beginning. The conversion of PLD has
+evoked numerous unanticipated questions: How will information be used?
+What about networking? Can the rights of a database be protected?
+Should one protect the rights of a database? How can it be made
+available?
+
+Those converting PLD also tried to avoid the sins of omission, that is,
+excluding portions of the collections or whole sections. What about the
+images? PLD is full of images, some are extremely pious
+nineteenth-century representations of the Fathers, while others contain
+highly interesting elements. The goal was to cover all the text of Migne
+(including notes, in Greek and in Hebrew, the latter of which, in
+particular, causes problems in creating a search structure), all the
+indices, and even the images, which are being scanned in separately
+searchable files.
+
+Several North American institutions that have placed acquisition requests
+for the PLD database have requested it in magnetic form without software,
+which means they are already running it without software, without
+anything demonstrated at the Workshop.
+
+What cannot practically be done is go back and reconvert and re-encode
+data, a time-consuming and extremely costly enterprise. CALALUCA sees
+PLD as a database that can, and should, be run under a variety of
+retrieval softwares. This will permit the widest possible searches.
+Consequently, the need to produce a CD-ROM of PLD, as well as to develop
+software that could handle some 1.3 gigabyte of heavily encoded text,
+developed out of conversations with collection development and reference
+librarians who wanted software both compassionate enough for the
+pedestrian but also capable of incorporating the most detailed
+lexicographical studies that a user desires to conduct. In the end, the
+encoding and conversion of the data will prove the most enduring
+testament to the value of the project.
+
+The encoding of the database was also a hard-fought issue: Did the
+database need to be encoded? Were there normative structures for encoding
+humanist texts? Should it be SGML? What about the TEI--will it last,
+will it prove useful? CALALUCA expressed some minor doubts as to whether
+a data bank can be fully TEI-conformant. Every effort can be made, but
+in the end to be TEI-conformant means to accept the need to make some
+firm encoding decisions that can, indeed, be disputed. The TEI points
+the publisher in a proper direction but does not presume to make all the
+decisions for him or her. Essentially, the goal of encoding was to
+eliminate, as much as possible, the hindrances to information-networking,
+so that if an institution acquires a database, everybody associated with
+the institution can have access to it.
+
+CALALUCA demonstrated a portion of Volume 160, because it had the most
+anomalies in it. The software was created by Electronic Book
+Technologies of Providence, RI, and is called Dynatext. The software
+works only with SGML-coded data.
+
+Viewing a table of contents on the screen, the audience saw how Dynatext
+treats each element as a book and attempts to simplify movement through a
+volume. Familiarity with the Patrologia in print (i.e., the text, its
+source, and the editions) will make the machine-readable versions highly
+useful. (Software with a Windows application was sought for PLD,
+CALALUCA said, because this was the main trend for scholarly use.)
+
+CALALUCA also demonstrated how a user can perform a variety of searches
+and quickly move to any part of a volume; the look-up screen provides
+some basic, simple word-searching.
+
+CALALUCA argued that one of the major difficulties is not the software.
+Rather, in creating a product that will be used by scholars representing
+a broad spectrum of computer sophistication, user documentation proves
+to be the most important service one can provide.
+
+CALALUCA next illustrated a truncated search under mysterium within ten
+words of virtus and how one would be able to find its contents throughout
+the entire database. He said that the exciting thing about PLD is that
+many of the applications in the retrieval software being written for it
+will exceed the capabilities of the software employed now for the CD-ROM
+version. The CD-ROM faces genuine limitations, in terms of speed and
+comprehensiveness, in the creation of a retrieval software to run it.
+CALALUCA said he hoped that individual scholars will download the data,
+if they wish, to their personal computers, and have ready access to
+important texts on a constant basis, which they will be able to use in
+their research and from which they might even be able to publish.
+
+(CALALUCA explained that the blue numbers represented Migne's column numbers,
+which are the standard scholarly references. Pulling up a note, he stated
+that these texts were heavily edited and the image files would appear simply
+as a note as well, so that one could quickly access an image.)
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+FLEISCHHAUER/ERWAY * Several problems with which AM is still wrestling *
+Various search and retrieval capabilities * Illustration of automatic
+stemming and a truncated search * AM's attempt to find ways to connect
+cataloging to the texts * AM's gravitation towards SGML * Striking a
+balance between quantity and quality * How AM furnishes users recourse to
+images * Conducting a search in a full-text environment * Macintosh and
+IBM prototypes of AM * Multimedia aspects of AM *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+A demonstration of American Memory by its coordinator, Carl FLEISCHHAUER,
+and Ricky ERWAY, associate coordinator, Library of Congress, concluded
+the morning session. Beginning with a collection of broadsides from the
+Continental Congress and the Constitutional Convention, the only text
+collection in a presentable form at the time of the Workshop, FLEISCHHAUER
+highlighted several of the problems with which AM is still wrestling.
+(In its final form, the disk will contain two collections, not only the
+broadsides but also the full text with illustrations of a set of
+approximately 300 African-American pamphlets from the period 1870 to 1910.)
+
+As FREEMAN had explained earlier, AM has attempted to use a small amount
+of interpretation to introduce collections. In the present case, the
+contractor, a company named Quick Source, in Silver Spring, MD., used
+software called Toolbook and put together a modestly interactive
+introduction to the collection. Like the two preceding speakers,
+FLEISCHHAUER argued that the real asset was the underlying collection.
+
+FLEISCHHAUER proceeded to describe various search and retrieval
+capabilities while ERWAY worked the computer. In this particular package
+the "go to" pull-down allowed the user in effect to jump out of Toolbook,
+where the interactive program was located, and enter the third-party
+software used by AM for this text collection, which is called Personal
+Librarian. This was the Windows version of Personal Librarian, a
+software application put together by a company in Rockville, Md.
+
+Since the broadsides came from the Revolutionary War period, a search was
+conducted using the words British or war, with the default operator reset
+as or. FLEISCHHAUER demonstrated both automatic stemming (which finds
+other forms of the same root) and a truncated search. One of Personal
+Librarian's strongest features, the relevance ranking, was represented by
+a chart that indicated how often words being sought appeared in
+documents, with the one receiving the most "hits" obtaining the highest
+score. The "hit list" that is supplied takes the relevance ranking into
+account, making the first hit, in effect, the one the software has
+selected as the most relevant example.
+
+While in the text of one of the broadside documents, FLEISCHHAUER
+remarked AM's attempt to find ways to connect cataloging to the texts,
+which it does in different ways in different manifestations. In the case
+shown, the cataloging was pasted on: AM took MARC records that were
+written as on-line records right into one of the Library's mainframe
+retrieval programs, pulled them out, and handed them off to the contractor,
+who massaged them somewhat to display them in the manner shown. One of
+AM's questions is, Does the cataloguing normally performed in the mainframe
+work in this context, or had AM ought to think through adjustments?
+
+FLEISCHHAUER made the additional point that, as far as the text goes, AM
+has gravitated towards SGML (he pointed to the boldface in the upper part
+of the screen). Although extremely limited in its ability to translate
+or interpret SGML, Personal Librarian will furnish both bold and italics
+on screen; a fairly easy thing to do, but it is one of the ways in which
+SGML is useful.
+
+Striking a balance between quantity and quality has been a major concern
+of AM, with accuracy being one of the places where project staff have
+felt that less than 100-percent accuracy was not unacceptable.
+FLEISCHHAUER cited the example of the standard of the rekeying industry,
+namely 99.95 percent; as one service bureau informed him, to go from
+99.95 to 100 percent would double the cost.
+
+FLEISCHHAUER next demonstrated how AM furnishes users recourse to images,
+and at the same time recalled LESK's pointed question concerning the
+number of people who would look at those images and the number who would
+work only with the text. If the implication of LESK's question was
+sound, FLEISCHHAUER said, it raised the stakes for text accuracy and
+reduced the value of the strategy for images.
+
+Contending that preservation is always a bugaboo, FLEISCHHAUER
+demonstrated several images derived from a scan of a preservation
+microfilm that AM had made. He awarded a grade of C at best, perhaps a
+C minus or a C plus, for how well it worked out. Indeed, the matter of
+learning if other people had better ideas about scanning in general, and,
+in particular, scanning from microfilm, was one of the factors that drove
+AM to attempt to think through the agenda for the Workshop. Skew, for
+example, was one of the issues that AM in its ignorance had not reckoned
+would prove so difficult.
+
+Further, the handling of images of the sort shown, in a desktop computer
+environment, involved a considerable amount of zooming and scrolling.
+Ultimately, AM staff feel that perhaps the paper copy that is printed out
+might be the most useful one, but they remain uncertain as to how much
+on-screen reading users will do.
+
+Returning to the text, FLEISCHHAUER asked viewers to imagine a person who
+might be conducting a search in a full-text environment. With this
+scenario, he proceeded to illustrate other features of Personal Librarian
+that he considered helpful; for example, it provides the ability to
+notice words as one reads. Clicking the "include" button on the bottom
+of the search window pops the words that have been highlighted into the
+search. Thus, a user can refine the search as he or she reads,
+re-executing the search and continuing to find things in the quest for
+materials. This software not only contains relevance ranking, Boolean
+operators, and truncation, it also permits one to perform word algebra,
+so to say, where one puts two or three words in parentheses and links
+them with one Boolean operator and then a couple of words in another set
+of parentheses and asks for things within so many words of others.
+
+Until they became acquainted recently with some of the work being done in
+classics, the AM staff had not realized that a large number of the
+projects that involve electronic texts were being done by people with a
+profound interest in language and linguistics. Their search strategies
+and thinking are oriented to those fields, as is shown in particular by
+the Perseus example. As amateur historians, the AM staff were thinking
+more of searching for concepts and ideas than for particular words.
+Obviously, FLEISCHHAUER conceded, searching for concepts and ideas and
+searching for words may be two rather closely related things.
+
+While displaying several images, FLEISCHHAUER observed that the Macintosh
+prototype built by AM contains a greater diversity of formats. Echoing a
+previous speaker, he said that it was easier to stitch things together in
+the Macintosh, though it tended to be a little more anemic in search and
+retrieval. AM, therefore, increasingly has been investigating
+sophisticated retrieval engines in the IBM format.
+
+FLEISCHHAUER demonstrated several additional examples of the prototype
+interfaces: One was AM's metaphor for the network future, in which a
+kind of reading-room graphic suggests how one would be able to go around
+to different materials. AM contains a large number of photographs in
+analog video form worked up from a videodisc, which enable users to make
+copies to print or incorporate in digital documents. A frame-grabber is
+built into the system, making it possible to bring an image into a window
+and digitize or print it out.
+
+FLEISCHHAUER next demonstrated sound recording, which included texts.
+Recycled from a previous project, the collection included sixty 78-rpm
+phonograph records of political speeches that were made during and
+immediately after World War I. These constituted approximately three
+hours of audio, as AM has digitized it, which occupy 150 megabytes on a
+CD. Thus, they are considerably compressed. From the catalogue card,
+FLEISCHHAUER proceeded to a transcript of a speech with the audio
+available and with highlighted text following it as it played.
+A photograph has been added and a transcription made.
+
+Considerable value has been added beyond what the Library of Congress
+normally would do in cataloguing a sound recording, which raises several
+questions for AM concerning where to draw lines about how much value it can
+afford to add and at what point, perhaps, this becomes more than AM could
+reasonably do or reasonably wish to do. FLEISCHHAUER also demonstrated
+a motion picture. As FREEMAN had reported earlier, the motion picture
+materials have proved the most popular, not surprisingly. This says more
+about the medium, he thought, than about AM's presentation of it.
+
+Because AM's goal was to bring together things that could be used by
+historians or by people who were curious about history,
+turn-of-the-century footage seemed to represent the most appropriate
+collections from the Library of Congress in motion pictures. These were
+the very first films made by Thomas Edison's company and some others at
+that time. The particular example illustrated was a Biograph film,
+brought in with a frame-grabber into a window. A single videodisc
+contains about fifty titles and pieces of film from that period, all of
+New York City. Taken together, AM believes, they provide an interesting
+documentary resource.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Using the frame-grabber in AM * Volume of material processed
+and to be processed * Purpose of AM within LC * Cataloguing and the
+nature of AM's material * SGML coding and the question of quality versus
+quantity *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+During the question-and-answer period that followed FLEISCHHAUER's
+presentation, several clarifications were made.
+
+AM is bringing in motion pictures from a videodisc. The frame-grabber
+devices create a window on a computer screen, which permits users to
+digitize a single frame of the movie or one of the photographs. It
+produces a crude, rough-and-ready image that high school students can
+incorporate into papers, and that has worked very nicely in this way.
+
+Commenting on FLEISCHHAUER's assertion that AM was looking more at
+searching ideas than words, MYLONAS argued that without words an idea
+does not exist. FLEISCHHAUER conceded that he ought to have articulated
+his point more clearly. MYLONAS stated that they were in fact both
+talking about the same thing. By searching for words and by forcing
+people to focus on the word, the Perseus Project felt that they would get
+them to the idea. The way one reviews results is tailored more to one
+kind of user than another.
+
+Concerning the total volume of material that has been processed in this
+way, AM at this point has in retrievable form seven or eight collections,
+all of them photographic. In the Macintosh environment, for example,
+there probably are 35,000-40,000 photographs. The sound recordings
+number sixty items. The broadsides number about 300 items. There are
+500 political cartoons in the form of drawings. The motion pictures, as
+individual items, number sixty to seventy.
+
+AM also has a manuscript collection, the life history portion of one of
+the federal project series, which will contain 2,900 individual
+documents, all first-person narratives. AM has in process about 350
+African-American pamphlets, or about 12,000 printed pages for the period
+1870-1910. Also in the works are some 4,000 panoramic photographs. AM
+has recycled a fair amount of the work done by LC's Prints and
+Photographs Division during the Library's optical disk pilot project in
+the 1980s. For example, a special division of LC has tooled up and
+thought through all the ramifications of electronic presentation of
+photographs. Indeed, they are wheeling them out in great barrel loads.
+The purpose of AM within the Library, it is hoped, is to catalyze several
+of the other special collection divisions which have no particular
+experience with, in some cases, mixed feelings about, an activity such as
+AM. Moreover, in many cases the divisions may be characterized as not
+only lacking experience in "electronifying" things but also in automated
+cataloguing. MARC cataloguing as practiced in the United States is
+heavily weighted toward the description of monograph and serial
+materials, but is much thinner when one enters the world of manuscripts
+and things that are held in the Library's music collection and other
+units. In response to a comment by LESK, that AM's material is very
+heavily photographic, and is so primarily because individual records have
+been made for each photograph, FLEISCHHAUER observed that an item-level
+catalog record exists, for example, for each photograph in the Detroit
+Publishing collection of 25,000 pictures. In the case of the Federal
+Writers Project, for which nearly 3,000 documents exist, representing
+information from twenty-six different states, AM with the assistance of
+Karen STUART of the Manuscript Division will attempt to find some way not
+only to have a collection-level record but perhaps a MARC record for each
+state, which will then serve as an umbrella for the 100-200 documents
+that come under it. But that drama remains to be enacted. The AM staff
+is conservative and clings to cataloguing, though of course visitors tout
+artificial intelligence and neural networks in a manner that suggests that
+perhaps one need not have cataloguing or that much of it could be put aside.
+
+The matter of SGML coding, FLEISCHHAUER conceded, returned the discussion
+to the earlier treated question of quality versus quantity in the Library
+of Congress. Of course, text conversion can be done with 100-percent
+accuracy, but it means that when one's holdings are as vast as LC's only
+a tiny amount will be exposed, whereas permitting lower levels of
+accuracy can lead to exposing or sharing larger amounts, but with the
+quality correspondingly impaired.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+TWOHIG * A contrary experience concerning electronic options * Volume of
+material in the Washington papers and a suggestion of David Packard *
+Implications of Packard's suggestion * Transcribing the documents for the
+CD-ROM * Accuracy of transcriptions * The CD-ROM edition of the Founding
+Fathers documents *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Finding encouragement in a comment of MICHELSON's from the morning
+session--that numerous people in the humanities were choosing electronic
+options to do their work--Dorothy TWOHIG, editor, The Papers of George
+Washington, opened her illustrated talk by noting that her experience
+with literary scholars and numerous people in editing was contrary to
+MICHELSON's. TWOHIG emphasized literary scholars' complete ignorance of
+the technological options available to them or their reluctance or, in
+some cases, their downright hostility toward these options.
+
+After providing an overview of the five Founding Fathers projects
+(Jefferson at Princeton, Franklin at Yale, John Adams at the
+Massachusetts Historical Society, and Madison down the hall from her at
+the University of Virginia), TWOHIG observed that the Washington papers,
+like all of the projects, include both sides of the Washington
+correspondence and deal with some 135,000 documents to be published with
+extensive annotation in eighty to eighty-five volumes, a project that
+will not be completed until well into the next century. Thus, it was
+with considerable enthusiasm several years ago that the Washington Papers
+Project (WPP) greeted David Packard's suggestion that the papers of the
+Founding Fathers could be published easily and inexpensively, and to the
+great benefit of American scholarship, via CD-ROM.
+
+In pragmatic terms, funding from the Packard Foundation would expedite
+the transcription of thousands of documents waiting to be put on disk in
+the WPP offices. Further, since the costs of collecting, editing, and
+converting the Founding Fathers documents into letterpress editions were
+running into the millions of dollars, and the considerable staffs
+involved in all of these projects were devoting their careers to
+producing the work, the Packard Foundation's suggestion had a
+revolutionary aspect: Transcriptions of the entire corpus of the
+Founding Fathers papers would be available on CD-ROM to public and
+college libraries, even high schools, at a fraction of the cost--
+$100-$150 for the annual license fee--to produce a limited university
+press run of 1,000 of each volume of the published papers at $45-$150 per
+printed volume. Given the current budget crunch in educational systems
+and the corresponding constraints on librarians in smaller institutions
+who wish to add these volumes to their collections, producing the
+documents on CD-ROM would likely open a greatly expanded audience for the
+papers. TWOHIG stressed, however, that development of the Founding
+Fathers CD-ROM is still in its infancy. Serious software problems remain
+to be resolved before the material can be put into readable form.
+
+Funding from the Packard Foundation resulted in a major push to
+transcribe the 75,000 or so documents of the Washington papers remaining
+to be transcribed onto computer disks. Slides illustrated several of the
+problems encountered, for example, the present inability of CD-ROM to
+indicate the cross-outs (deleted material) in eighteenth century
+documents. TWOHIG next described documents from various periods in the
+eighteenth century that have been transcribed in chronological order and
+delivered to the Packard offices in California, where they are converted
+to the CD-ROM, a process that is expected to consume five years to
+complete (that is, reckoning from David Packard's suggestion made several
+years ago, until about July 1994). TWOHIG found an encouraging
+indication of the project's benefits in the ongoing use made by scholars
+of the search functions of the CD-ROM, particularly in reducing the time
+spent in manually turning the pages of the Washington papers.
+
+TWOHIG next furnished details concerning the accuracy of transcriptions.
+For instance, the insertion of thousands of documents on the CD-ROM
+currently does not permit each document to be verified against the
+original manuscript several times as in the case of documents that appear
+in the published edition. However, the transcriptions receive a cursory
+check for obvious typos, the misspellings of proper names, and other
+errors from the WPP CD-ROM editor. Eventually, all documents that appear
+in the electronic version will be checked by project editors. Although
+this process has met with opposition from some of the editors on the
+grounds that imperfect work may leave their offices, the advantages in
+making this material available as a research tool outweigh fears about the
+misspelling of proper names and other relatively minor editorial matters.
+
+Completion of all five Founding Fathers projects (i.e., retrievability
+and searchability of all of the documents by proper names, alternate
+spellings, or varieties of subjects) will provide one of the richest
+sources of this size for the history of the United States in the latter
+part of the eighteenth century. Further, publication on CD-ROM will
+allow editors to include even minutiae, such as laundry lists, not
+included in the printed volumes.
+
+It seems possible that the extensive annotation provided in the printed
+volumes eventually will be added to the CD-ROM edition, pending
+negotiations with the publishers of the papers. At the moment, the
+Founding Fathers CD-ROM is accessible only on the IBYCUS, a computer
+developed out of the Thesaurus Linguae Graecae project and designed for
+the use of classical scholars. There are perhaps 400 IBYCUS computers in
+the country, most of which are in university classics departments.
+Ultimately, it is anticipated that the CD-ROM edition of the Founding
+Fathers documents will run on any IBM-compatible or Macintosh computer
+with a CD-ROM drive. Numerous changes in the software will also occur
+before the project is completed. (Editor's note: an IBYCUS was
+unavailable to demonstrate the CD-ROM.)
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Several additional features of WPP clarified *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Discussion following TWOHIG's presentation served to clarify several
+additional features, including (1) that the project's primary
+intellectual product consists in the electronic transcription of the
+material; (2) that the text transmitted to the CD-ROM people is not
+marked up; (3) that cataloging and subject-indexing of the material
+remain to be worked out (though at this point material can be retrieved
+by name); and (4) that because all the searching is done in the hardware,
+the IBYCUS is designed to read a CD-ROM which contains only sequential
+text files. Technically, it then becomes very easy to read the material
+off and put it on another device.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+LEBRON * Overview of the history of the joint project between AAAS and
+OCLC * Several practices the on-line environment shares with traditional
+publishing on hard copy * Several technical and behavioral barriers to
+electronic publishing * How AAAS and OCLC arrived at the subject of
+clinical trials * Advantages of the electronic format and other features
+of OJCCT * An illustrated tour of the journal *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Maria LEBRON, managing editor, The Online Journal of Current Clinical
+Trials (OJCCT), presented an illustrated overview of the history of the
+joint project between the American Association for the Advancement of
+Science (AAAS) and the Online Computer Library Center, Inc. (OCLC). The
+joint venture between AAAS and OCLC owes its beginning to a
+reorganization launched by the new chief executive officer at OCLC about
+three years ago and combines the strengths of these two disparate
+organizations. In short, OJCCT represents the process of scholarly
+publishing on line.
+
+LEBRON next discussed several practices the on-line environment shares
+with traditional publishing on hard copy--for example, peer review of
+manuscripts--that are highly important in the academic world. LEBRON
+noted in particular the implications of citation counts for tenure
+committees and grants committees. In the traditional hard-copy
+environment, citation counts are readily demonstrable, whereas the
+on-line environment represents an ethereal medium to most academics.
+
+LEBRON remarked several technical and behavioral barriers to electronic
+publishing, for instance, the problems in transmission created by special
+characters or by complex graphics and halftones. In addition, she noted
+economic limitations such as the storage costs of maintaining back issues
+and market or audience education.
+
+Manuscripts cannot be uploaded to OJCCT, LEBRON explained, because it is
+not a bulletin board or E-mail, forms of electronic transmission of
+information that have created an ambience clouding people's understanding
+of what the journal is attempting to do. OJCCT, which publishes
+peer-reviewed medical articles dealing with the subject of clinical
+trials, includes text, tabular material, and graphics, although at this
+time it can transmit only line illustrations.
+
+Next, LEBRON described how AAAS and OCLC arrived at the subject of
+clinical trials: It is 1) a highly statistical discipline that 2) does
+not require halftones but can satisfy the needs of its audience with line
+illustrations and graphic material, and 3) there is a need for the speedy
+dissemination of high-quality research results. Clinical trials are
+research activities that involve the administration of a test treatment
+to some experimental unit in order to test its usefulness before it is
+made available to the general population. LEBRON proceeded to give
+additional information on OJCCT concerning its editor-in-chief, editorial
+board, editorial content, and the types of articles it publishes
+(including peer-reviewed research reports and reviews), as well as
+features shared by other traditional hard-copy journals.
+
+Among the advantages of the electronic format are faster dissemination of
+information, including raw data, and the absence of space constraints
+because pages do not exist. (This latter fact creates an interesting
+situation when it comes to citations.) Nor are there any issues. AAAS's
+capacity to download materials directly from the journal to a
+subscriber's printer, hard drive, or floppy disk helps ensure highly
+accurate transcription. Other features of OJCCT include on-screen alerts
+that allow linkage of subsequently published documents to the original
+documents; on-line searching by subject, author, title, etc.; indexing of
+every single word that appears in an article; viewing access to an
+article by component (abstract, full text, or graphs); numbered
+paragraphs to replace page counts; publication in Science every thirty
+days of indexing of all articles published in the journal;
+typeset-quality screens; and Hypertext links that enable subscribers to
+bring up Medline abstracts directly without leaving the journal.
+
+After detailing the two primary ways to gain access to the journal,
+through the OCLC network and Compuserv if one desires graphics or through
+the Internet if just an ASCII file is desired, LEBRON illustrated the
+speedy editorial process and the coding of the document using SGML tags
+after it has been accepted for publication. She also gave an illustrated
+tour of the journal, its search-and-retrieval capabilities in particular,
+but also including problems associated with scanning in illustrations,
+and the importance of on-screen alerts to the medical profession re
+retractions or corrections, or more frequently, editorials, letters to
+the editors, or follow-up reports. She closed by inviting the audience
+to join AAAS on 1 July, when OJCCT was scheduled to go on-line.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Additional features of OJCCT *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+In the lengthy discussion that followed LEBRON's presentation, these
+points emerged:
+
+ * The SGML text can be tailored as users wish.
+
+ * All these articles have a fairly simple document definition.
+
+ * Document-type definitions (DTDs) were developed and given to OJCCT
+ for coding.
+
+ * No articles will be removed from the journal. (Because there are
+ no back issues, there are no lost issues either. Once a subscriber
+ logs onto the journal he or she has access not only to the currently
+ published materials, but retrospectively to everything that has been
+ published in it. Thus the table of contents grows bigger. The date
+ of publication serves to distinguish between currently published
+ materials and older materials.)
+
+ * The pricing system for the journal resembles that for most medical
+ journals: for 1992, $95 for a year, plus telecommunications charges
+ (there are no connect time charges); for 1993, $110 for the
+ entire year for single users, though the journal can be put on a
+ local area network (LAN). However, only one person can access the
+ journal at a time. Site licenses may come in the future.
+
+ * AAAS is working closely with colleagues at OCLC to display
+ mathematical equations on screen.
+
+ * Without compromising any steps in the editorial process, the
+ technology has reduced the time lag between when a manuscript is
+ originally submitted and the time it is accepted; the review process
+ does not differ greatly from the standard six-to-eight weeks
+ employed by many of the hard-copy journals. The process still
+ depends on people.
+
+ * As far as a preservation copy is concerned, articles will be
+ maintained on the computer permanently and subscribers, as part of
+ their subscription, will receive a microfiche-quality archival copy
+ of everything published during that year; in addition, reprints can
+ be purchased in much the same way as in a hard-copy environment.
+ Hard copies are prepared but are not the primary medium for the
+ dissemination of the information.
+
+ * Because OJCCT is not yet on line, it is difficult to know how many
+ people would simply browse through the journal on the screen as
+ opposed to downloading the whole thing and printing it out; a mix of
+ both types of users likely will result.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+PERSONIUS * Developments in technology over the past decade * The CLASS
+Project * Advantages for technology and for the CLASS Project *
+Developing a network application an underlying assumption of the project
+* Details of the scanning process * Print-on-demand copies of books *
+Future plans include development of a browsing tool *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Lynne PERSONIUS, assistant director, Cornell Information Technologies for
+Scholarly Information Services, Cornell University, first commented on
+the tremendous impact that developments in technology over the past ten
+years--networking, in particular--have had on the way information is
+handled, and how, in her own case, these developments have counterbalanced
+Cornell's relative geographical isolation. Other significant technologies
+include scanners, which are much more sophisticated than they were ten years
+ago; mass storage and the dramatic savings that result from it in terms of
+both space and money relative to twenty or thirty years ago; new and
+improved printing technologies, which have greatly affected the distribution
+of information; and, of course, digital technologies, whose applicability to
+library preservation remains at issue.
+
+Given that context, PERSONIUS described the College Library Access and
+Storage System (CLASS) Project, a library preservation project,
+primarily, and what has been accomplished. Directly funded by the
+Commission on Preservation and Access and by the Xerox Corporation, which
+has provided a significant amount of hardware, the CLASS Project has been
+working with a development team at Xerox to develop a software
+application tailored to library preservation requirements. Within
+Cornell, participants in the project have been working jointly with both
+library and information technologies. The focus of the project has been
+on reformatting and saving books that are in brittle condition.
+PERSONIUS showed Workshop participants a brittle book, and described how
+such books were the result of developments in papermaking around the
+beginning of the Industrial Revolution. The papermaking process was
+changed so that a significant amount of acid was introduced into the
+actual paper itself, which deteriorates as it sits on library shelves.
+
+One of the advantages for technology and for the CLASS Project is that
+the information in brittle books is mostly out of copyright and thus
+offers an opportunity to work with material that requires library
+preservation, and to create and work on an infrastructure to save the
+material. Acknowledging the familiarity of those working in preservation
+with this information, PERSONIUS noted that several things are being
+done: the primary preservation technology used today is photocopying of
+brittle material. Saving the intellectual content of the material is the
+main goal. With microfilm copy, the intellectual content is preserved on
+the assumption that in the future the image can be reformatted in any
+other way that then exists.
+
+An underlying assumption of the CLASS Project from the beginning was
+that it would develop a network application. Project staff scan books
+at a workstation located in the library, near the brittle material.
+An image-server filing system is located at a distance from that
+workstation, and a printer is located in another building. All of the
+materials digitized and stored on the image-filing system are cataloged
+in the on-line catalogue. In fact, a record for each of these electronic
+books is stored in the RLIN database so that a record exists of what is
+in the digital library throughout standard catalogue procedures. In the
+future, researchers working from their own workstations in their offices,
+or their networks, will have access--wherever they might be--through a
+request server being built into the new digital library. A second
+assumption is that the preferred means of finding the material will be by
+looking through a catalogue. PERSONIUS described the scanning process,
+which uses a prototype scanner being developed by Xerox and which scans a
+very high resolution image at great speed. Another significant feature,
+because this is a preservation application, is the placing of the pages
+that fall apart one for one on the platen. Ordinarily, a scanner could
+be used with some sort of a document feeder, but because of this
+application that is not feasible. Further, because CLASS is a
+preservation application, after the paper replacement is made there, a
+very careful quality control check is performed. An original book is
+compared to the printed copy and verification is made, before proceeding,
+that all of the image, all of the information, has been captured. Then,
+a new library book is produced: The printed images are rebound by a
+commercial binder and a new book is returned to the shelf.
+Significantly, the books returned to the library shelves are beautiful
+and useful replacements on acid-free paper that should last a long time,
+in effect, the equivalent of preservation photocopies. Thus, the project
+has a library of digital books. In essence, CLASS is scanning and
+storing books as 600 dot-per-inch bit-mapped images, compressed using
+Group 4 CCITT (i.e., the French acronym for International Consultative
+Committee for Telegraph and Telephone) compression. They are stored as
+TIFF files on an optical filing system that is composed of a database
+used for searching and locating the books and an optical jukebox that
+stores 64 twelve-inch platters. A very-high-resolution printed copy of
+these books at 600 dots per inch is created, using a Xerox DocuTech
+printer to make the paper replacements on acid-free paper.
+
+PERSONIUS maintained that the CLASS Project presents an opportunity to
+introduce people to books as digital images by using a paper medium.
+Books are returned to the shelves while people are also given the ability
+to print on demand--to make their own copies of books. (PERSONIUS
+distributed copies of an engineering journal published by engineering
+students at Cornell around 1900 as an example of what a print-on-demand
+copy of material might be like. This very cheap copy would be available
+to people to use for their own research purposes and would bridge the gap
+between an electronic work and the paper that readers like to have.)
+PERSONIUS then attempted to illustrate a very early prototype of
+networked access to this digital library. Xerox Corporation has
+developed a prototype of a view station that can send images across the
+network to be viewed.
+
+The particular library brought down for demonstration contained two
+mathematics books. CLASS is developing and will spend the next year
+developing an application that allows people at workstations to browse
+the books. Thus, CLASS is developing a browsing tool, on the assumption
+that users do not want to read an entire book from a workstation, but
+would prefer to be able to look through and decide if they would like to
+have a printed copy of it.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Re retrieval software * "Digital file copyright" * Scanning
+rate during production * Autosegmentation * Criteria employed in
+selecting books for scanning * Compression and decompression of images *
+OCR not precluded *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+During the question-and-answer period that followed her presentation,
+PERSONIUS made these additional points:
+
+ * Re retrieval software, Cornell is developing a Unix-based server
+ as well as clients for the server that support multiple platforms
+ (Macintosh, IBM and Sun workstations), in the hope that people from
+ any of those platforms will retrieve books; a further operating
+ assumption is that standard interfaces will be used as much as
+ possible, where standards can be put in place, because CLASS
+ considers this retrieval software a library application and would
+ like to be able to look at material not only at Cornell but at other
+ institutions.
+
+ * The phrase "digital file copyright by Cornell University" was
+ added at the advice of Cornell's legal staff with the caveat that it
+ probably would not hold up in court. Cornell does not want people
+ to copy its books and sell them but would like to keep them
+ available for use in a library environment for library purposes.
+
+ * In production the scanner can scan about 300 pages per hour,
+ capturing 600 dots per inch.
+
+ * The Xerox software has filters to scan halftone material and avoid
+ the moire patterns that occur when halftone material is scanned.
+ Xerox has been working on hardware and software that would enable
+ the scanner itself to recognize this situation and deal with it
+ appropriately--a kind of autosegmentation that would enable the
+ scanner to handle halftone material as well as text on a single page.
+
+ * The books subjected to the elaborate process described above were
+ selected because CLASS is a preservation project, with the first 500
+ books selected coming from Cornell's mathematics collection, because
+ they were still being heavily used and because, although they were
+ in need of preservation, the mathematics library and the mathematics
+ faculty were uncomfortable having them microfilmed. (They wanted a
+ printed copy.) Thus, these books became a logical choice for this
+ project. Other books were chosen by the project's selection committees
+ for experiments with the technology, as well as to meet a demand or need.
+
+ * Images will be decompressed before they are sent over the line; at
+ this time they are compressed and sent to the image filing system
+ and then sent to the printer as compressed images; they are returned
+ to the workstation as compressed 600-dpi images and the workstation
+ decompresses and scales them for display--an inefficient way to
+ access the material though it works quite well for printing and
+ other purposes.
+
+ * CLASS is also decompressing on Macintosh and IBM, a slow process
+ right now. Eventually, compression and decompression will take
+ place on an image conversion server. Trade-offs will be made, based
+ on future performance testing, concerning where the file is
+ compressed and what resolution image is sent.
+
+ * OCR has not been precluded; images are being stored that have been
+ scanned at a high resolution, which presumably would suit them well
+ to an OCR process. Because the material being scanned is about 100
+ years old and was printed with less-than-ideal technologies, very
+ early and preliminary tests have not produced good results. But the
+ project is capturing an image that is of sufficient resolution to be
+ subjected to OCR in the future. Moreover, the system architecture
+ and the system plan have a logical place to store an OCR image if it
+ has been captured. But that is not being done now.
+
+ ******
+
+SESSION III. DISTRIBUTION, NETWORKS, AND NETWORKING: OPTIONS FOR
+DISSEMINATION
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ZICH * Issues pertaining to CD-ROMs * Options for publishing in CD-ROM *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Robert ZICH, special assistant to the associate librarian for special
+projects, Library of Congress, and moderator of this session, first noted
+the blessed but somewhat awkward circumstance of having four very
+distinguished people representing networks and networking or at least
+leaning in that direction, while lacking anyone to speak from the
+strongest possible background in CD-ROMs. ZICH expressed the hope that
+members of the audience would join the discussion. He stressed the
+subtitle of this particular session, "Options for Dissemination," and,
+concerning CD-ROMs, the importance of determining when it would be wise
+to consider dissemination in CD-ROM versus networks. A shopping list of
+issues pertaining to CD-ROMs included: the grounds for selecting
+commercial publishers, and in-house publication where possible versus
+nonprofit or government publication. A similar list for networks
+included: determining when one should consider dissemination through a
+network, identifying the mechanisms or entities that exist to place items
+on networks, identifying the pool of existing networks, determining how a
+producer would choose between networks, and identifying the elements of
+a business arrangement in a network.
+
+Options for publishing in CD-ROM: an outside publisher versus
+self-publication. If an outside publisher is used, it can be nonprofit,
+such as the Government Printing Office (GPO) or the National Technical
+Information Service (NTIS), in the case of government. The pros and cons
+associated with employing an outside publisher are obvious. Among the
+pros, there is no trouble getting accepted. One pays the bill and, in
+effect, goes one's way. Among the cons, when one pays an outside
+publisher to perform the work, that publisher will perform the work it is
+obliged to do, but perhaps without the production expertise and skill in
+marketing and dissemination that some would seek. There is the body of
+commercial publishers that do possess that kind of expertise in
+distribution and marketing but that obviously are selective. In
+self-publication, one exercises full control, but then one must handle
+matters such as distribution and marketing. Such are some of the options
+for publishing in the case of CD-ROM.
+
+In the case of technical and design issues, which are also important,
+there are many matters which many at the Workshop already knew a good
+deal about: retrieval system requirements and costs, what to do about
+images, the various capabilities and platforms, the trade-offs between
+cost and performance, concerns about local-area networkability,
+interoperability, etc.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+LYNCH * Creating networked information is different from using networks
+as an access or dissemination vehicle * Networked multimedia on a large
+scale does not yet work * Typical CD-ROM publication model a two-edged
+sword * Publishing information on a CD-ROM in the present world of
+immature standards * Contrast between CD-ROM and network pricing *
+Examples demonstrated earlier in the day as a set of insular information
+gems * Paramount need to link databases * Layering to become increasingly
+necessary * Project NEEDS and the issues of information reuse and active
+versus passive use * X-Windows as a way of differentiating between
+network access and networked information * Barriers to the distribution
+of networked multimedia information * Need for good, real-time delivery
+protocols * The question of presentation integrity in client-server
+computing in the academic world * Recommendations for producing multimedia
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Clifford LYNCH, director, Library Automation, University of California,
+opened his talk with the general observation that networked information
+constituted a difficult and elusive topic because it is something just
+starting to develop and not yet fully understood. LYNCH contended that
+creating genuinely networked information was different from using
+networks as an access or dissemination vehicle and was more sophisticated
+and more subtle. He invited the members of the audience to extrapolate,
+from what they heard about the preceding demonstration projects, to what
+sort of a world of electronics information--scholarly, archival,
+cultural, etc.--they wished to end up with ten or fifteen years from now.
+LYNCH suggested that to extrapolate directly from these projects would
+produce unpleasant results.
+
+Putting the issue of CD-ROM in perspective before getting into
+generalities on networked information, LYNCH observed that those engaged
+in multimedia today who wish to ship a product, so to say, probably do
+not have much choice except to use CD-ROM: networked multimedia on a
+large scale basically does not yet work because the technology does not
+exist. For example, anybody who has tried moving images around over the
+Internet knows that this is an exciting touch-and-go process, a
+fascinating and fertile area for experimentation, research, and
+development, but not something that one can become deeply enthusiastic
+about committing to production systems at this time.
+
+This situation will change, LYNCH said. He differentiated CD-ROM from
+the practices that have been followed up to now in distributing data on
+CD-ROM. For LYNCH the problem with CD-ROM is not its portability or its
+slowness but the two-edged sword of having the retrieval application and
+the user interface inextricably bound up with the data, which is the
+typical CD-ROM publication model. It is not a case of publishing data
+but of distributing a typically stand-alone, typically closed system,
+all--software, user interface, and data--on a little disk. Hence, all
+the between-disk navigational issues as well as the impossibility in most
+cases of integrating data on one disk with that on another. Most CD-ROM
+retrieval software does not network very gracefully at present. However,
+in the present world of immature standards and lack of understanding of
+what network information is or what the ground rules are for creating or
+using it, publishing information on a CD-ROM does add value in a very
+real sense.
+
+LYNCH drew a contrast between CD-ROM and network pricing and in doing so
+highlighted something bizarre in information pricing. A large
+institution such as the University of California has vendors who will
+offer to sell information on CD-ROM for a price per year in four digits,
+but for the same data (e.g., an abstracting and indexing database) on
+magnetic tape, regardless of how many people may use it concurrently,
+will quote a price in six digits.
+
+What is packaged with the CD-ROM in one sense adds value--a complete
+access system, not just raw, unrefined information--although it is not
+generally perceived that way. This is because the access software,
+although it adds value, is viewed by some people, particularly in the
+university environment where there is a very heavy commitment to
+networking, as being developed in the wrong direction.
+
+Given that context, LYNCH described the examples demonstrated as a set of
+insular information gems--Perseus, for example, offers nicely linked
+information, but would be very difficult to integrate with other
+databases, that is, to link together seamlessly with other source files
+from other sources. It resembles an island, and in this respect is
+similar to numerous stand-alone projects that are based on videodiscs,
+that is, on the single-workstation concept.
+
+As scholarship evolves in a network environment, the paramount need will
+be to link databases. We must link personal databases to public
+databases, to group databases, in fairly seamless ways--which is
+extremely difficult in the environments under discussion with copies of
+databases proliferating all over the place.
+
+The notion of layering also struck LYNCH as lurking in several of the
+projects demonstrated. Several databases in a sense constitute
+information archives without a significant amount of navigation built in.
+Educators, critics, and others will want a layered structure--one that
+defines or links paths through the layers to allow users to reach
+specific points. In LYNCH's view, layering will become increasingly
+necessary, and not just within a single resource but across resources
+(e.g., tracing mythology and cultural themes across several classics
+databases as well as a database of Renaissance culture). This ability to
+organize resources, to build things out of multiple other things on the
+network or select pieces of it, represented for LYNCH one of the key
+aspects of network information.
+
+Contending that information reuse constituted another significant issue,
+LYNCH commended to the audience's attention Project NEEDS (i.e., National
+Engineering Education Delivery System). This project's objective is to
+produce a database of engineering courseware as well as the components
+that can be used to develop new courseware. In a number of the existing
+applications, LYNCH said, the issue of reuse (how much one can take apart
+and reuse in other applications) was not being well considered. He also
+raised the issue of active versus passive use, one aspect of which is
+how much information will be manipulated locally by users. Most people,
+he argued, may do a little browsing and then will wish to print. LYNCH
+was uncertain how these resources would be used by the vast majority of
+users in the network environment.
+
+LYNCH next said a few words about X-Windows as a way of differentiating
+between network access and networked information. A number of the
+applications demonstrated at the Workshop could be rewritten to use X
+across the network, so that one could run them from any X-capable device-
+-a workstation, an X terminal--and transact with a database across the
+network. Although this opens up access a little, assuming one has enough
+network to handle it, it does not provide an interface to develop a
+program that conveniently integrates information from multiple databases.
+X is a viewing technology that has limits. In a real sense, it is just a
+graphical version of remote log-in across the network. X-type applications
+represent only one step in the progression towards real access.
+
+LYNCH next discussed barriers to the distribution of networked multimedia
+information. The heart of the problem is a lack of standards to provide
+the ability for computers to talk to each other, retrieve information,
+and shuffle it around fairly casually. At the moment, little progress is
+being made on standards for networked information; for example, present
+standards do not cover images, digital voice, and digital video. A
+useful tool kit of exchange formats for basic texts is only now being
+assembled. The synchronization of content streams (i.e., synchronizing a
+voice track to a video track, establishing temporal relations between
+different components in a multimedia object) constitutes another issue
+for networked multimedia that is just beginning to receive attention.
+
+Underlying network protocols also need some work; good, real-time
+delivery protocols on the Internet do not yet exist. In LYNCH's view,
+highly important in this context is the notion of networked digital
+object IDs, the ability of one object on the network to point to another
+object (or component thereof) on the network. Serious bandwidth issues
+also exist. LYNCH was uncertain if billion-bit-per-second networks would
+prove sufficient if numerous people ran video in parallel.
+
+LYNCH concluded by offering an issue for database creators to consider,
+as well as several comments about what might constitute good trial
+multimedia experiments. In a networked information world the database
+builder or service builder (publisher) does not exercise the same
+extensive control over the integrity of the presentation; strange
+programs "munge" with one's data before the user sees it. Serious
+thought must be given to what guarantees integrity of presentation. Part
+of that is related to where one draws the boundaries around a networked
+information service. This question of presentation integrity in
+client-server computing has not been stressed enough in the academic
+world, LYNCH argued, though commercial service providers deal with it
+regularly.
+
+Concerning multimedia, LYNCH observed that good multimedia at the moment
+is hideously expensive to produce. He recommended producing multimedia
+with either very high sale value, or multimedia with a very long life
+span, or multimedia that will have a very broad usage base and whose
+costs therefore can be amortized among large numbers of users. In this
+connection, historical and humanistically oriented material may be a good
+place to start, because it tends to have a longer life span than much of
+the scientific material, as well as a wider user base. LYNCH noted, for
+example, that American Memory fits many of the criteria outlined. He
+remarked the extensive discussion about bringing the Internet or the
+National Research and Education Network (NREN) into the K-12 environment
+as a way of helping the American educational system.
+
+LYNCH closed by noting that the kinds of applications demonstrated struck
+him as excellent justifications of broad-scale networking for K-12, but
+that at this time no "killer" application exists to mobilize the K-12
+community to obtain connectivity.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Dearth of genuinely interesting applications on the network
+a slow-changing situation * The issue of the integrity of presentation in
+a networked environment * Several reasons why CD-ROM software does not
+network *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+During the discussion period that followed LYNCH's presentation, several
+additional points were made.
+
+LYNCH reiterated even more strongly his contention that, historically,
+once one goes outside high-end science and the group of those who need
+access to supercomputers, there is a great dearth of genuinely
+interesting applications on the network. He saw this situation changing
+slowly, with some of the scientific databases and scholarly discussion
+groups and electronic journals coming on as well as with the availability
+of Wide Area Information Servers (WAIS) and some of the databases that
+are being mounted there. However, many of those things do not seem to
+have piqued great popular interest. For instance, most high school
+students of LYNCH's acquaintance would not qualify as devotees of serious
+molecular biology.
+
+Concerning the issue of the integrity of presentation, LYNCH believed
+that a couple of information providers have laid down the law at least on
+certain things. For example, his recollection was that the National
+Library of Medicine feels strongly that one needs to employ the
+identifier field if he or she is to mount a database commercially. The
+problem with a real networked environment is that one does not know who
+is reformatting and reprocessing one's data when one enters a client
+server mode. It becomes anybody's guess, for example, if the network
+uses a Z39.50 server, or what clients are doing with one's data. A data
+provider can say that his contract will only permit clients to have
+access to his data after he vets them and their presentation and makes
+certain it suits him. But LYNCH held out little expectation that the
+network marketplace would evolve in that way, because it required too
+much prior negotiation.
+
+CD-ROM software does not network for a variety of reasons, LYNCH said.
+He speculated that CD-ROM publishers are not eager to have their products
+really hook into wide area networks, because they fear it will make their
+data suppliers nervous. Moreover, until relatively recently, one had to
+be rather adroit to run a full TCP/IP stack plus applications on a
+PC-size machine, whereas nowadays it is becoming easier as PCs grow
+bigger and faster. LYNCH also speculated that software providers had not
+heard from their customers until the last year or so, or had not heard
+from enough of their customers.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+BESSER * Implications of disseminating images on the network; planning
+the distribution of multimedia documents poses two critical
+implementation problems * Layered approach represents the way to deal
+with users' capabilities * Problems in platform design; file size and its
+implications for networking * Transmission of megabyte size images
+impractical * Compression and decompression at the user's end * Promising
+trends for compression * A disadvantage of using X-Windows * A project at
+the Smithsonian that mounts images on several networks *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Howard BESSER, School of Library and Information Science, University of
+Pittsburgh, spoke primarily about multimedia, focusing on images and the
+broad implications of disseminating them on the network. He argued that
+planning the distribution of multimedia documents posed two critical
+implementation problems, which he framed in the form of two questions:
+1) What platform will one use and what hardware and software will users
+have for viewing of the material? and 2) How can one deliver a
+sufficiently robust set of information in an accessible format in a
+reasonable amount of time? Depending on whether network or CD-ROM is the
+medium used, this question raises different issues of storage,
+compression, and transmission.
+
+Concerning the design of platforms (e.g., sound, gray scale, simple
+color, etc.) and the various capabilities users may have, BESSER
+maintained that a layered approach was the way to deal with users'
+capabilities. A result would be that users with less powerful
+workstations would simply have less functionality. He urged members of
+the audience to advocate standards and accompanying software that handle
+layered functionality across a wide variety of platforms.
+
+BESSER also addressed problems in platform design, namely, deciding how
+large a machine to design for situations when the largest number of users
+have the lowest level of the machine, and one desires higher
+functionality. BESSER then proceeded to the question of file size and
+its implications for networking. He discussed still images in the main.
+For example, a digital color image that fills the screen of a standard
+mega-pel workstation (Sun or Next) will require one megabyte of storage
+for an eight-bit image or three megabytes of storage for a true color or
+twenty-four-bit image. Lossless compression algorithms (that is,
+computational procedures in which no data is lost in the process of
+compressing [and decompressing] an image--the exact bit-representation is
+maintained) might bring storage down to a third of a megabyte per image,
+but not much further than that. The question of size makes it difficult
+to fit an appropriately sized set of these images on a single disk or to
+transmit them quickly enough on a network.
+
+With these full screen mega-pel images that constitute a third of a
+megabyte, one gets 1,000-3,000 full-screen images on a one-gigabyte disk;
+a standard CD-ROM represents approximately 60 percent of that. Storing
+images the size of a PC screen (just 8 bit color) increases storage
+capacity to 4,000-12,000 images per gigabyte; 60 percent of that gives
+one the size of a CD-ROM, which in turn creates a major problem. One
+cannot have full-screen, full-color images with lossless compression; one
+must compress them or use a lower resolution. For megabyte-size images,
+anything slower than a T-1 speed is impractical. For example, on a
+fifty-six-kilobaud line, it takes three minutes to transfer a
+one-megabyte file, if it is not compressed; and this speed assumes ideal
+circumstances (no other user contending for network bandwidth). Thus,
+questions of disk access, remote display, and current telephone
+connection speed make transmission of megabyte-size images impractical.
+
+BESSER then discussed ways to deal with these large images, for example,
+compression and decompression at the user's end. In this connection, the
+issues of how much one is willing to lose in the compression process and
+what image quality one needs in the first place are unknown. But what is
+known is that compression entails some loss of data. BESSER urged that
+more studies be conducted on image quality in different situations, for
+example, what kind of images are needed for what kind of disciplines, and
+what kind of image quality is needed for a browsing tool, an intermediate
+viewing tool, and archiving.
+
+BESSER remarked two promising trends for compression: from a technical
+perspective, algorithms that use what is called subjective redundancy
+employ principles from visual psycho-physics to identify and remove
+information from the image that the human eye cannot perceive; from an
+interchange and interoperability perspective, the JPEG (i.e., Joint
+Photographic Experts Group, an ISO standard) compression algorithms also
+offer promise. These issues of compression and decompression, BESSER
+argued, resembled those raised earlier concerning the design of different
+platforms. Gauging the capabilities of potential users constitutes a
+primary goal. BESSER advocated layering or separating the images from
+the applications that retrieve and display them, to avoid tying them to
+particular software.
+
+BESSER detailed several lessons learned from his work at Berkeley with
+Imagequery, especially the advantages and disadvantages of using
+X-Windows. In the latter category, for example, retrieval is tied
+directly to one's data, an intolerable situation in the long run on a
+networked system. Finally, BESSER described a project of Jim Wallace at
+the Smithsonian Institution, who is mounting images in a extremely
+rudimentary way on the Compuserv and Genie networks and is preparing to
+mount them on America On Line. Although the average user takes over
+thirty minutes to download these images (assuming a fairly fast modem),
+nevertheless, images have been downloaded 25,000 times.
+
+BESSER concluded his talk with several comments on the business
+arrangement between the Smithsonian and Compuserv. He contended that not
+enough is known concerning the value of images.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Creating digitized photographic collections nearly
+impossible except with large organizations like museums * Need for study
+to determine quality of images users will tolerate *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+During the brief exchange between LESK and BESSER that followed, several
+clarifications emerged.
+
+LESK argued that the photographers were far ahead of BESSER: It is
+almost impossible to create such digitized photographic collections
+except with large organizations like museums, because all the
+photographic agencies have been going crazy about this and will not sign
+licensing agreements on any sort of reasonable terms. LESK had heard
+that National Geographic, for example, had tried to buy the right to use
+some image in some kind of educational production for $100 per image, but
+the photographers will not touch it. They want accounting and payment
+for each use, which cannot be accomplished within the system. BESSER
+responded that a consortium of photographers, headed by a former National
+Geographic photographer, had started assembling its own collection of
+electronic reproductions of images, with the money going back to the
+cooperative.
+
+LESK contended that BESSER was unnecessarily pessimistic about multimedia
+images, because people are accustomed to low-quality images, particularly
+from video. BESSER urged the launching of a study to determine what
+users would tolerate, what they would feel comfortable with, and what
+absolutely is the highest quality they would ever need. Conceding that
+he had adopted a dire tone in order to arouse people about the issue,
+BESSER closed on a sanguine note by saying that he would not be in this
+business if he did not think that things could be accomplished.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+LARSEN * Issues of scalability and modularity * Geometric growth of the
+Internet and the role played by layering * Basic functions sustaining
+this growth * A library's roles and functions in a network environment *
+Effects of implementation of the Z39.50 protocol for information
+retrieval on the library system * The trade-off between volumes of data
+and its potential usage * A snapshot of current trends *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Ronald LARSEN, associate director for information technology, University
+of Maryland at College Park, first addressed the issues of scalability
+and modularity. He noted the difficulty of anticipating the effects of
+orders-of-magnitude growth, reflecting on the twenty years of experience
+with the Arpanet and Internet. Recalling the day's demonstrations of
+CD-ROM and optical disk material, he went on to ask if the field has yet
+learned how to scale new systems to enable delivery and dissemination
+across large-scale networks.
+
+LARSEN focused on the geometric growth of the Internet from its inception
+circa 1969 to the present, and the adjustments required to respond to
+that rapid growth. To illustrate the issue of scalability, LARSEN
+considered computer networks as including three generic components:
+computers, network communication nodes, and communication media. Each
+component scales (e.g., computers range from PCs to supercomputers;
+network nodes scale from interface cards in a PC through sophisticated
+routers and gateways; and communication media range from 2,400-baud
+dial-up facilities through 4.5-Mbps backbone links, and eventually to
+multigigabit-per-second communication lines), and architecturally, the
+components are organized to scale hierarchically from local area networks
+to international-scale networks. Such growth is made possible by
+building layers of communication protocols, as BESSER pointed out.
+By layering both physically and logically, a sense of scalability is
+maintained from local area networks in offices, across campuses, through
+bridges, routers, campus backbones, fiber-optic links, etc., up into
+regional networks and ultimately into national and international
+networks.
+
+LARSEN then illustrated the geometric growth over a two-year period--
+through September 1991--of the number of networks that comprise the
+Internet. This growth has been sustained largely by the availability of
+three basic functions: electronic mail, file transfer (ftp), and remote
+log-on (telnet). LARSEN also reviewed the growth in the kind of traffic
+that occurs on the network. Network traffic reflects the joint contributions
+of a larger population of users and increasing use per user. Today one sees
+serious applications involving moving images across the network--a rarity
+ten years ago. LARSEN recalled and concurred with BESSER's main point
+that the interesting problems occur at the application level.
+
+LARSEN then illustrated a model of a library's roles and functions in a
+network environment. He noted, in particular, the placement of on-line
+catalogues onto the network and patrons obtaining access to the library
+increasingly through local networks, campus networks, and the Internet.
+LARSEN supported LYNCH's earlier suggestion that we need to address
+fundamental questions of networked information in order to build
+environments that scale in the information sense as well as in the
+physical sense.
+
+LARSEN supported the role of the library system as the access point into
+the nation's electronic collections. Implementation of the Z39.50
+protocol for information retrieval would make such access practical and
+feasible. For example, this would enable patrons in Maryland to search
+California libraries, or other libraries around the world that are
+conformant with Z39.50 in a manner that is familiar to University of
+Maryland patrons. This client-server model also supports moving beyond
+secondary content into primary content. (The notion of how one links
+from secondary content to primary content, LARSEN said, represents a
+fundamental problem that requires rigorous thought.) After noting
+numerous network experiments in accessing full-text materials, including
+projects supporting the ordering of materials across the network, LARSEN
+revisited the issue of transmitting high-density, high-resolution color
+images across the network and the large amounts of bandwidth they
+require. He went on to address the bandwidth and synchronization
+problems inherent in sending full-motion video across the network.
+
+LARSEN illustrated the trade-off between volumes of data in bytes or
+orders of magnitude and the potential usage of that data. He discussed
+transmission rates (particularly, the time it takes to move various forms
+of information), and what one could do with a network supporting
+multigigabit-per-second transmission. At the moment, the network
+environment includes a composite of data-transmission requirements,
+volumes and forms, going from steady to bursty (high-volume) and from
+very slow to very fast. This aggregate must be considered in the design,
+construction, and operation of multigigabyte networks.
+
+LARSEN's objective is to use the networks and library systems now being
+constructed to increase access to resources wherever they exist, and
+thus, to evolve toward an on-line electronic virtual library.
+
+LARSEN concluded by offering a snapshot of current trends: continuing
+geometric growth in network capacity and number of users; slower
+development of applications; and glacial development and adoption of
+standards. The challenge is to design and develop each new application
+system with network access and scalability in mind.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+BROWNRIGG * Access to the Internet cannot be taken for granted * Packet
+radio and the development of MELVYL in 1980-81 in the Division of Library
+Automation at the University of California * Design criteria for packet
+radio * A demonstration project in San Diego and future plans * Spread
+spectrum * Frequencies at which the radios will run and plans to
+reimplement the WAIS server software in the public domain * Need for an
+infrastructure of radios that do not move around *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Edwin BROWNRIGG, executive director, Memex Research Institute, first
+polled the audience in order to seek out regular users of the Internet as
+well as those planning to use it some time in the future. With nearly
+everybody in the room falling into one category or the other, BROWNRIGG
+made a point re access, namely that numerous individuals, especially those
+who use the Internet every day, take for granted their access to it, the
+speeds with which they are connected, and how well it all works.
+However, as BROWNRIGG discovered between 1987 and 1989 in Australia,
+if one wants access to the Internet but cannot afford it or has some
+physical boundary that prevents her or him from gaining access, it can
+be extremely frustrating. He suggested that because of economics and
+physical barriers we were beginning to create a world of haves and have-nots
+in the process of scholarly communication, even in the United States.
+
+BROWNRIGG detailed the development of MELVYL in academic year 1980-81 in
+the Division of Library Automation at the University of California, in
+order to underscore the issue of access to the system, which at the
+outset was extremely limited. In short, the project needed to build a
+network, which at that time entailed use of satellite technology, that is,
+putting earth stations on campus and also acquiring some terrestrial links
+from the State of California's microwave system. The installation of
+satellite links, however, did not solve the problem (which actually
+formed part of a larger problem involving politics and financial resources).
+For while the project team could get a signal onto a campus, it had no means
+of distributing the signal throughout the campus. The solution involved
+adopting a recent development in wireless communication called packet radio,
+which combined the basic notion of packet-switching with radio. The project
+used this technology to get the signal from a point on campus where it
+came down, an earth station for example, into the libraries, because it
+found that wiring the libraries, especially the older marble buildings,
+would cost $2,000-$5,000 per terminal.
+
+BROWNRIGG noted that, ten years ago, the project had neither the public
+policy nor the technology that would have allowed it to use packet radio
+in any meaningful way. Since then much had changed. He proceeded to
+detail research and development of the technology, how it is being
+deployed in California, and what direction he thought it would take.
+The design criteria are to produce a high-speed, one-time, low-cost,
+high-quality, secure, license-free device (packet radio) that one can
+plug in and play today, forget about it, and have access to the Internet.
+By high speed, BROWNRIGG meant 1 megabyte and 1.5 megabytes. Those units
+have been built, he continued, and are in the process of being
+type-certified by an independent underwriting laboratory so that they can
+be type-licensed by the Federal Communications Commission. As is the
+case with citizens band, one will be able to purchase a unit and not have
+to worry about applying for a license.
+
+The basic idea, BROWNRIGG elaborated, is to take high-speed radio data
+transmission and create a backbone network that at certain strategic
+points in the network will "gateway" into a medium-speed packet radio
+(i.e., one that runs at 38.4 kilobytes), so that perhaps by 1994-1995
+people, like those in the audience for the price of a VCR could purchase
+a medium-speed radio for the office or home, have full network connectivity
+to the Internet, and partake of all its services, with no need for an FCC
+license and no regular bill from the local common carrier. BROWNRIGG
+presented several details of a demonstration project currently taking
+place in San Diego and described plans, pending funding, to install a
+full-bore network in the San Francisco area. This network will have 600
+nodes running at backbone speeds, and 100 of these nodes will be libraries,
+which in turn will be the gateway ports to the 38.4 kilobyte radios that
+will give coverage for the neighborhoods surrounding the libraries.
+
+BROWNRIGG next explained Part 15.247, a new rule within Title 47 of the
+Code of Federal Regulations enacted by the FCC in 1985. This rule
+challenged the industry, which has only now risen to the occasion, to
+build a radio that would run at no more than one watt of output power and
+use a fairly exotic method of modulating the radio wave called spread
+spectrum. Spread spectrum in fact permits the building of networks so
+that numerous data communications can occur simultaneously, without
+interfering with each other, within the same wide radio channel.
+
+BROWNRIGG explained that the frequencies at which the radios would run
+are very short wave signals. They are well above standard microwave and
+radar. With a radio wave that small, one watt becomes a tremendous punch
+per bit and thus makes transmission at reasonable speed possible. In
+order to minimize the potential for congestion, the project is
+undertaking to reimplement software which has been available in the
+networking business and is taken for granted now, for example, TCP/IP,
+routing algorithms, bridges, and gateways. In addition, the project
+plans to take the WAIS server software in the public domain and
+reimplement it so that one can have a WAIS server on a Mac instead of a
+Unix machine. The Memex Research Institute believes that libraries, in
+particular, will want to use the WAIS servers with packet radio. This
+project, which has a team of about twelve people, will run through 1993
+and will include the 100 libraries already mentioned as well as other
+professionals such as those in the medical profession, engineering, and
+law. Thus, the need is to create an infrastructure of radios that do not
+move around, which, BROWNRIGG hopes, will solve a problem not only for
+libraries but for individuals who, by and large today, do not have access
+to the Internet from their homes and offices.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Project operating frequencies *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+During a brief discussion period, which also concluded the day's
+proceedings, BROWNRIGG stated that the project was operating in four
+frequencies. The slow speed is operating at 435 megahertz, and it would
+later go up to 920 megahertz. With the high-speed frequency, the
+one-megabyte radios will run at 2.4 gigabits, and 1.5 will run at 5.7.
+At 5.7, rain can be a factor, but it would have to be tropical rain,
+unlike what falls in most parts of the United States.
+
+ ******
+
+SESSION IV. IMAGE CAPTURE, TEXT CAPTURE, OVERVIEW OF TEXT AND
+ IMAGE STORAGE FORMATS
+
+William HOOTON, vice president of operations, I-NET, moderated this session.
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+KENNEY * Factors influencing development of CXP * Advantages of using
+digital technology versus photocopy and microfilm * A primary goal of
+CXP; publishing challenges * Characteristics of copies printed * Quality
+of samples achieved in image capture * Several factors to be considered
+in choosing scanning * Emphasis of CXP on timely and cost-effective
+production of black-and-white printed facsimiles * Results of producing
+microfilm from digital files * Advantages of creating microfilm * Details
+concerning production * Costs * Role of digital technology in library
+preservation *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Anne KENNEY, associate director, Department of Preservation and
+Conservation, Cornell University, opened her talk by observing that the
+Cornell Xerox Project (CXP) has been guided by the assumption that the
+ability to produce printed facsimiles or to replace paper with paper
+would be important, at least for the present generation of users and
+equipment. She described three factors that influenced development of
+the project: 1) Because the project has emphasized the preservation of
+deteriorating brittle books, the quality of what was produced had to be
+sufficiently high to return a paper replacement to the shelf. CXP was
+only interested in using: 2) a system that was cost-effective, which
+meant that it had to be cost-competitive with the processes currently
+available, principally photocopy and microfilm, and 3) new or currently
+available product hardware and software.
+
+KENNEY described the advantages that using digital technology offers over
+both photocopy and microfilm: 1) The potential exists to create a higher
+quality reproduction of a deteriorating original than conventional
+light-lens technology. 2) Because a digital image is an encoded
+representation, it can be reproduced again and again with no resulting
+loss of quality, as opposed to the situation with light-lens processes,
+in which there is discernible difference between a second and a
+subsequent generation of an image. 3) A digital image can be manipulated
+in a number of ways to improve image capture; for example, Xerox has
+developed a windowing application that enables one to capture a page
+containing both text and illustrations in a manner that optimizes the
+reproduction of both. (With light-lens technology, one must choose which
+to optimize, text or the illustration; in preservation microfilming, the
+current practice is to shoot an illustrated page twice, once to highlight
+the text and the second time to provide the best capture for the
+illustration.) 4) A digital image can also be edited, density levels
+adjusted to remove underlining and stains, and to increase legibility for
+faint documents. 5) On-screen inspection can take place at the time of
+initial setup and adjustments made prior to scanning, factors that
+substantially reduce the number of retakes required in quality control.
+
+A primary goal of CXP has been to evaluate the paper output printed on
+the Xerox DocuTech, a high-speed printer that produces 600-dpi pages from
+scanned images at a rate of 135 pages a minute. KENNEY recounted several
+publishing challenges to represent faithful and legible reproductions of
+the originals that the 600-dpi copy for the most part successfully
+captured. For example, many of the deteriorating volumes in the project
+were heavily illustrated with fine line drawings or halftones or came in
+languages such as Japanese, in which the buildup of characters comprised
+of varying strokes is difficult to reproduce at lower resolutions; a
+surprising number of them came with annotations and mathematical
+formulas, which it was critical to be able to duplicate exactly.
+
+KENNEY noted that 1) the copies are being printed on paper that meets the
+ANSI standards for performance, 2) the DocuTech printer meets the machine
+and toner requirements for proper adhesion of print to page, as described
+by the National Archives, and thus 3) paper product is considered to be
+the archival equivalent of preservation photocopy.
+
+KENNEY then discussed several samples of the quality achieved in the
+project that had been distributed in a handout, for example, a copy of a
+print-on-demand version of the 1911 Reed lecture on the steam turbine,
+which contains halftones, line drawings, and illustrations embedded in
+text; the first four loose pages in the volume compared the capture
+capabilities of scanning to photocopy for a standard test target, the
+IEEE standard 167A 1987 test chart. In all instances scanning proved
+superior to photocopy, though only slightly more so in one.
+
+Conceding the simplistic nature of her review of the quality of scanning
+to photocopy, KENNEY described it as one representation of the kinds of
+settings that could be used with scanning capabilities on the equipment
+CXP uses. KENNEY also pointed out that CXP investigated the quality
+achieved with binary scanning only, and noted the great promise in gray
+scale and color scanning, whose advantages and disadvantages need to be
+examined. She argued further that scanning resolutions and file formats
+can represent a complex trade-off between the time it takes to capture
+material, file size, fidelity to the original, and on-screen display; and
+printing and equipment availability. All these factors must be taken
+into consideration.
+
+CXP placed primary emphasis on the production in a timely and
+cost-effective manner of printed facsimiles that consisted largely of
+black-and-white text. With binary scanning, large files may be
+compressed efficiently and in a lossless manner (i.e., no data is lost in
+the process of compressing [and decompressing] an image--the exact
+bit-representation is maintained) using Group 4 CCITT (i.e., the French
+acronym for International Consultative Committee for Telegraph and
+Telephone) compression. CXP was getting compression ratios of about
+forty to one. Gray-scale compression, which primarily uses JPEG, is much
+less economical and can represent a lossy compression (i.e., not
+lossless), so that as one compresses and decompresses, the illustration
+is subtly changed. While binary files produce a high-quality printed
+version, it appears 1) that other combinations of spatial resolution with
+gray and/or color hold great promise as well, and 2) that gray scale can
+represent a tremendous advantage for on-screen viewing. The quality
+associated with binary and gray scale also depends on the equipment used.
+For instance, binary scanning produces a much better copy on a binary
+printer.
+
+Among CXP's findings concerning the production of microfilm from digital
+files, KENNEY reported that the digital files for the same Reed lecture
+were used to produce sample film using an electron beam recorder. The
+resulting film was faithful to the image capture of the digital files,
+and while CXP felt that the text and image pages represented in the Reed
+lecture were superior to that of the light-lens film, the resolution
+readings for the 600 dpi were not as high as standard microfilming.
+KENNEY argued that the standards defined for light-lens technology are
+not totally transferable to a digital environment. Moreover, they are
+based on definition of quality for a preservation copy. Although making
+this case will prove to be a long, uphill struggle, CXP plans to continue
+to investigate the issue over the course of the next year.
+
+KENNEY concluded this portion of her talk with a discussion of the
+advantages of creating film: it can serve as a primary backup and as a
+preservation master to the digital file; it could then become the print
+or production master and service copies could be paper, film, optical
+disks, magnetic media, or on-screen display.
+
+Finally, KENNEY presented details re production:
+
+ * Development and testing of a moderately-high resolution production
+ scanning workstation represented a third goal of CXP; to date, 1,000
+ volumes have been scanned, or about 300,000 images.
+
+ * The resulting digital files are stored and used to produce
+ hard-copy replacements for the originals and additional prints on
+ demand; although the initial costs are high, scanning technology
+ offers an affordable means for reformatting brittle material.
+
+ * A technician in production mode can scan 300 pages per hour when
+ performing single-sheet scanning, which is a necessity when working
+ with truly brittle paper; this figure is expected to increase
+ significantly with subsequent iterations of the software from Xerox;
+ a three-month time-and-cost study of scanning found that the average
+ 300-page book would take about an hour and forty minutes to scan
+ (this figure included the time for setup, which involves keying in
+ primary bibliographic data, going into quality control mode to
+ define page size, establishing front-to-back registration, and
+ scanning sample pages to identify a default range of settings for
+ the entire book--functions not dissimilar to those performed by
+ filmers or those preparing a book for photocopy).
+
+ * The final step in the scanning process involved rescans, which
+ happily were few and far between, representing well under 1 percent
+ of the total pages scanned.
+
+In addition to technician time, CXP costed out equipment, amortized over
+four years, the cost of storing and refreshing the digital files every
+four years, and the cost of printing and binding, book-cloth binding, a
+paper reproduction. The total amounted to a little under $65 per single
+300-page volume, with 30 percent overhead included--a figure competitive
+with the prices currently charged by photocopy vendors.
+
+Of course, with scanning, in addition to the paper facsimile, one is left
+with a digital file from which subsequent copies of the book can be
+produced for a fraction of the cost of photocopy, with readers afforded
+choices in the form of these copies.
+
+KENNEY concluded that digital technology offers an electronic means for a
+library preservation effort to pay for itself. If a brittle-book program
+included the means of disseminating reprints of books that are in demand
+by libraries and researchers alike, the initial investment in capture
+could be recovered and used to preserve additional but less popular
+books. She disclosed that an economic model for a self-sustaining
+program could be developed for CXP's report to the Commission on
+Preservation and Access (CPA).
+
+KENNEY stressed that the focus of CXP has been on obtaining high quality
+in a production environment. The use of digital technology is viewed as
+an affordable alternative to other reformatting options.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ANDRE * Overview and history of NATDP * Various agricultural CD-ROM
+products created inhouse and by service bureaus * Pilot project on
+Internet transmission * Additional products in progress *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Pamela ANDRE, associate director for automation, National Agricultural
+Text Digitizing Program (NATDP), National Agricultural Library (NAL),
+presented an overview of NATDP, which has been underway at NAL the last
+four years, before Judith ZIDAR discussed the technical details. ANDRE
+defined agricultural information as a broad range of material going from
+basic and applied research in the hard sciences to the one-page pamphlets
+that are distributed by the cooperative state extension services on such
+things as how to grow blueberries.
+
+NATDP began in late 1986 with a meeting of representatives from the
+land-grant library community to deal with the issue of electronic
+information. NAL and forty-five of these libraries banded together to
+establish this project--to evaluate the technology for converting what
+were then source documents in paper form into electronic form, to provide
+access to that digital information, and then to distribute it.
+Distributing that material to the community--the university community as
+well as the extension service community, potentially down to the county
+level--constituted the group's chief concern.
+
+Since January 1988 (when the microcomputer-based scanning system was
+installed at NAL), NATDP has done a variety of things, concerning which
+ZIDAR would provide further details. For example, the first technology
+considered in the project's discussion phase was digital videodisc, which
+indicates how long ago it was conceived.
+
+Over the four years of this project, four separate CD-ROM products on
+four different agricultural topics were created, two at a
+scanning-and-OCR station installed at NAL, and two by service bureaus.
+Thus, NATDP has gained comparative information in terms of those relative
+costs. Each of these products contained the full ASCII text as well as
+page images of the material, or between 4,000 and 6,000 pages of material
+on these disks. Topics included aquaculture, food, agriculture and
+science (i.e., international agriculture and research), acid rain, and
+Agent Orange, which was the final product distributed (approximately
+eighteen months before the Workshop).
+
+The third phase of NATDP focused on delivery mechanisms other than
+CD-ROM. At the suggestion of Clifford LYNCH, who was a technical
+consultant to the project at this point, NATDP became involved with the
+Internet and initiated a project with the help of North Carolina State
+University, in which fourteen of the land-grant university libraries are
+transmitting digital images over the Internet in response to interlibrary
+loan requests--a topic for another meeting. At this point, the pilot
+project had been completed for about a year and the final report would be
+available shortly after the Workshop. In the meantime, the project's
+success had led to its extension. (ANDRE noted that one of the first
+things done under the program title was to select a retrieval package to
+use with subsequent products; Windows Personal Librarian was the package
+of choice after a lengthy evaluation.)
+
+Three additional products had been planned and were in progress:
+
+ 1) An arrangement with the American Society of Agronomy--a
+ professional society that has published the Agronomy Journal since
+ about 1908--to scan and create bit-mapped images of its journal.
+ ASA granted permission first to put and then to distribute this
+ material in electronic form, to hold it at NAL, and to use these
+ electronic images as a mechanism to deliver documents or print out
+ material for patrons, among other uses. Effectively, NAL has the
+ right to use this material in support of its program.
+ (Significantly, this arrangement offers a potential cooperative
+ model for working with other professional societies in agriculture
+ to try to do the same thing--put the journals of particular interest
+ to agriculture research into electronic form.)
+
+ 2) An extension of the earlier product on aquaculture.
+
+ 3) The George Washington Carver Papers--a joint project with
+ Tuskegee University to scan and convert from microfilm some 3,500
+ images of Carver's papers, letters, and drawings.
+
+It was anticipated that all of these products would appear no more than
+six months after the Workshop.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ZIDAR * (A separate arena for scanning) * Steps in creating a database *
+Image capture, with and without performing OCR * Keying in tracking data
+* Scanning, with electronic and manual tracking * Adjustments during
+scanning process * Scanning resolutions * Compression * De-skewing and
+filtering * Image capture from microform: the papers and letters of
+George Washington Carver * Equipment used for a scanning system *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Judith ZIDAR, coordinator, National Agricultural Text Digitizing Program
+(NATDP), National Agricultural Library (NAL), illustrated the technical
+details of NATDP, including her primary responsibility, scanning and
+creating databases on a topic and putting them on CD-ROM.
+
+(ZIDAR remarked a separate arena from the CD-ROM projects, although the
+processing of the material is nearly identical, in which NATDP is also
+scanning material and loading it on a Next microcomputer, which in turn
+is linked to NAL's integrated library system. Thus, searches in NAL's
+bibliographic database will enable people to pull up actual page images
+and text for any documents that have been entered.)
+
+In accordance with the session's topic, ZIDAR focused her illustrated
+talk on image capture, offering a primer on the three main steps in the
+process: 1) assemble the printed publications; 2) design the database
+(database design occurs in the process of preparing the material for
+scanning; this step entails reviewing and organizing the material,
+defining the contents--what will constitute a record, what kinds of
+fields will be captured in terms of author, title, etc.); 3) perform a
+certain amount of markup on the paper publications. NAL performs this
+task record by record, preparing work sheets or some other sort of
+tracking material and designing descriptors and other enhancements to be
+added to the data that will not be captured from the printed publication.
+Part of this process also involves determining NATDP's file and directory
+structure: NATDP attempts to avoid putting more than approximately 100
+images in a directory, because placing more than that on a CD-ROM would
+reduce the access speed.
+
+This up-front process takes approximately two weeks for a
+6,000-7,000-page database. The next step is to capture the page images.
+How long this process takes is determined by the decision whether or not
+to perform OCR. Not performing OCR speeds the process, whereas text
+capture requires greater care because of the quality of the image: it
+has to be straighter and allowance must be made for text on a page, not
+just for the capture of photographs.
+
+NATDP keys in tracking data, that is, a standard bibliographic record
+including the title of the book and the title of the chapter, which will
+later either become the access information or will be attached to the
+front of a full-text record so that it is searchable.
+
+Images are scanned from a bound or unbound publication, chiefly from
+bound publications in the case of NATDP, however, because often they are
+the only copies and the publications are returned to the shelves. NATDP
+usually scans one record at a time, because its database tracking system
+tracks the document in that way and does not require further logical
+separating of the images. After performing optical character
+recognition, NATDP moves the images off the hard disk and maintains a
+volume sheet. Though the system tracks electronically, all the
+processing steps are also tracked manually with a log sheet.
+
+ZIDAR next illustrated the kinds of adjustments that one can make when
+scanning from paper and microfilm, for example, redoing images that need
+special handling, setting for dithering or gray scale, and adjusting for
+brightness or for the whole book at one time.
+
+NATDP is scanning at 300 dots per inch, a standard scanning resolution.
+Though adequate for capturing text that is all of a standard size, 300
+dpi is unsuitable for any kind of photographic material or for very small
+text. Many scanners allow for different image formats, TIFF, of course,
+being a de facto standard. But if one intends to exchange images with
+other people, the ability to scan other image formats, even if they are
+less common, becomes highly desirable.
+
+CCITT Group 4 is the standard compression for normal black-and-white
+images, JPEG for gray scale or color. ZIDAR recommended 1) using the
+standard compressions, particularly if one attempts to make material
+available and to allow users to download images and reuse them from
+CD-ROMs; and 2) maintaining the ability to output an uncompressed image,
+because in image exchange uncompressed images are more likely to be able
+to cross platforms.
+
+ZIDAR emphasized the importance of de-skewing and filtering as
+requirements on NATDP's upgraded system. For instance, scanning bound
+books, particularly books published by the federal government whose pages
+are skewed, and trying to scan them straight if OCR is to be performed,
+is extremely time-consuming. The same holds for filtering of
+poor-quality or older materials.
+
+ZIDAR described image capture from microform, using as an example three
+reels from a sixty-seven-reel set of the papers and letters of George
+Washington Carver that had been produced by Tuskegee University. These
+resulted in approximately 3,500 images, which NATDP had had scanned by
+its service contractor, Science Applications International Corporation
+(SAIC). NATDP also created bibliographic records for access. (NATDP did
+not have such specialized equipment as a microfilm scanner.
+
+Unfortunately, the process of scanning from microfilm was not an
+unqualified success, ZIDAR reported: because microfilm frame sizes vary,
+occasionally some frames were missed, which without spending much time
+and money could not be recaptured.
+
+OCR could not be performed from the scanned images of the frames. The
+bleeding in the text simply output text, when OCR was run, that could not
+even be edited. NATDP tested for negative versus positive images,
+landscape versus portrait orientation, and single- versus dual-page
+microfilm, none of which seemed to affect the quality of the image; but
+also on none of them could OCR be performed.
+
+In selecting the microfilm they would use, therefore, NATDP had other
+factors in mind. ZIDAR noted two factors that influenced the quality of
+the images: 1) the inherent quality of the original and 2) the amount of
+size reduction on the pages.
+
+The Carver papers were selected because they are informative and visually
+interesting, treat a single subject, and are valuable in their own right.
+The images were scanned and divided into logical records by SAIC, then
+delivered, and loaded onto NATDP's system, where bibliographic
+information taken directly from the images was added. Scanning was
+completed in summer 1991 and by the end of summer 1992 the disk was
+scheduled to be published.
+
+Problems encountered during processing included the following: Because
+the microfilm scanning had to be done in a batch, adjustment for
+individual page variations was not possible. The frame size varied on
+account of the nature of the material, and therefore some of the frames
+were missed while others were just partial frames. The only way to go
+back and capture this material was to print out the page with the
+microfilm reader from the missing frame and then scan it in from the
+page, which was extremely time-consuming. The quality of the images
+scanned from the printout of the microfilm compared unfavorably with that
+of the original images captured directly from the microfilm. The
+inability to perform OCR also was a major disappointment. At the time,
+computer output microfilm was unavailable to test.
+
+The equipment used for a scanning system was the last topic addressed by
+ZIDAR. The type of equipment that one would purchase for a scanning
+system included: a microcomputer, at least a 386, but preferably a 486;
+a large hard disk, 380 megabyte at minimum; a multi-tasking operating
+system that allows one to run some things in batch in the background
+while scanning or doing text editing, for example, Unix or OS/2 and,
+theoretically, Windows; a high-speed scanner and scanning software that
+allows one to make the various adjustments mentioned earlier; a
+high-resolution monitor (150 dpi ); OCR software and hardware to perform
+text recognition; an optical disk subsystem on which to archive all the
+images as the processing is done; file management and tracking software.
+
+ZIDAR opined that the software one purchases was more important than the
+hardware and might also cost more than the hardware, but it was likely to
+prove critical to the success or failure of one's system. In addition to
+a stand-alone scanning workstation for image capture, then, text capture
+requires one or two editing stations networked to this scanning station
+to perform editing. Editing the text takes two or three times as long as
+capturing the images.
+
+Finally, ZIDAR stressed the importance of buying an open system that allows
+for more than one vendor, complies with standards, and can be upgraded.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+WATERS *Yale University Library's master plan to convert microfilm to
+digital imagery (POB) * The place of electronic tools in the library of
+the future * The uses of images and an image library * Primary input from
+preservation microfilm * Features distinguishing POB from CXP and key
+hypotheses guiding POB * Use of vendor selection process to facilitate
+organizational work * Criteria for selecting vendor * Finalists and
+results of process for Yale * Key factor distinguishing vendors *
+Components, design principles, and some estimated costs of POB * Role of
+preservation materials in developing imaging market * Factors affecting
+quality and cost * Factors affecting the usability of complex documents
+in image form *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Donald WATERS, head of the Systems Office, Yale University Library,
+reported on the progress of a master plan for a project at Yale to
+convert microfilm to digital imagery, Project Open Book (POB). Stating
+that POB was in an advanced stage of planning, WATERS detailed, in
+particular, the process of selecting a vendor partner and several key
+issues under discussion as Yale prepares to move into the project itself.
+He commented first on the vision that serves as the context of POB and
+then described its purpose and scope.
+
+WATERS sees the library of the future not necessarily as an electronic
+library but as a place that generates, preserves, and improves for its
+clients ready access to both intellectual and physical recorded
+knowledge. Electronic tools must find a place in the library in the
+context of this vision. Several roles for electronic tools include
+serving as: indirect sources of electronic knowledge or as "finding"
+aids (the on-line catalogues, the article-level indices, registers for
+documents and archives); direct sources of recorded knowledge; full-text
+images; and various kinds of compound sources of recorded knowledge (the
+so-called compound documents of Hypertext, mixed text and image,
+mixed-text image format, and multimedia).
+
+POB is looking particularly at images and an image library, the uses to
+which images will be put (e.g., storage, printing, browsing, and then use
+as input for other processes), OCR as a subsequent process to image
+capture, or creating an image library, and also possibly generating
+microfilm.
+
+While input will come from a variety of sources, POB is considering
+especially input from preservation microfilm. A possible outcome is that
+the film and paper which provide the input for the image library
+eventually may go off into remote storage, and that the image library may
+be the primary access tool.
+
+The purpose and scope of POB focus on imaging. Though related to CXP,
+POB has two features which distinguish it: 1) scale--conversion of
+10,000 volumes into digital image form; and 2) source--conversion from
+microfilm. Given these features, several key working hypotheses guide
+POB, including: 1) Since POB is using microfilm, it is not concerned with
+the image library as a preservation medium. 2) Digital imagery can improve
+access to recorded knowledge through printing and network distribution at
+a modest incremental cost of microfilm. 3) Capturing and storing documents
+in a digital image form is necessary to further improvements in access.
+(POB distinguishes between the imaging, digitizing process and OCR,
+which at this stage it does not plan to perform.)
+
+Currently in its first or organizational phase, POB found that it could
+use a vendor selection process to facilitate a good deal of the
+organizational work (e.g., creating a project team and advisory board,
+confirming the validity of the plan, establishing the cost of the project
+and a budget, selecting the materials to convert, and then raising the
+necessary funds).
+
+POB developed numerous selection criteria, including: a firm committed
+to image-document management, the ability to serve as systems integrator
+in a large-scale project over several years, interest in developing the
+requisite software as a standard rather than a custom product, and a
+willingness to invest substantial resources in the project itself.
+
+Two vendors, DEC and Xerox, were selected as finalists in October 1991,
+and with the support of the Commission on Preservation and Access, each
+was commissioned to generate a detailed requirements analysis for the
+project and then to submit a formal proposal for the completion of the
+project, which included a budget and costs. The terms were that POB would
+pay the loser. The results for Yale of involving a vendor included:
+broad involvement of Yale staff across the board at a relatively low
+cost, which may have long-term significance in carrying out the project
+(twenty-five to thirty university people are engaged in POB); better
+understanding of the factors that affect corporate response to markets
+for imaging products; a competitive proposal; and a more sophisticated
+view of the imaging markets.
+
+The most important factor that distinguished the vendors under
+consideration was their identification with the customer. The size and
+internal complexity of the company also was an important factor. POB was
+looking at large companies that had substantial resources. In the end,
+the process generated for Yale two competitive proposals, with Xerox's
+the clear winner. WATERS then described the components of the proposal,
+the design principles, and some of the costs estimated for the process.
+
+Components are essentially four: a conversion subsystem, a
+network-accessible storage subsystem for 10,000 books (and POB expects
+200 to 600 dpi storage), browsing stations distributed on the campus
+network, and network access to the image printers.
+
+Among the design principles, POB wanted conversion at the highest
+possible resolution. Assuming TIFF files, TIFF files with Group 4
+compression, TCP/IP, and ethernet network on campus, POB wanted a
+client-server approach with image documents distributed to the
+workstations and made accessible through native workstation interfaces
+such as Windows. POB also insisted on a phased approach to
+implementation: 1) a stand-alone, single-user, low-cost entry into the
+business with a workstation focused on conversion and allowing POB to
+explore user access; 2) movement into a higher-volume conversion with
+network-accessible storage and multiple access stations; and 3) a
+high-volume conversion, full-capacity storage, and multiple browsing
+stations distributed throughout the campus.
+
+The costs proposed for start-up assumed the existence of the Yale network
+and its two DocuTech image printers. Other start-up costs are estimated
+at $1 million over the three phases. At the end of the project, the annual
+operating costs estimated primarily for the software and hardware proposed
+come to about $60,000, but these exclude costs for labor needed in the
+conversion process, network and printer usage, and facilities management.
+
+Finally, the selection process produced for Yale a more sophisticated
+view of the imaging markets: the management of complex documents in
+image form is not a preservation problem, not a library problem, but a
+general problem in a broad, general industry. Preservation materials are
+useful for developing that market because of the qualities of the
+material. For example, much of it is out of copyright. The resolution
+of key issues such as the quality of scanning and image browsing also
+will affect development of that market.
+
+The technology is readily available but changing rapidly. In this
+context of rapid change, several factors affect quality and cost, to
+which POB intends to pay particular attention, for example, the various
+levels of resolution that can be achieved. POB believes it can bring
+resolution up to 600 dpi, but an interpolation process from 400 to 600 is
+more likely. The variation quality in microfilm will prove to be a
+highly important factor. POB may reexamine the standards used to film in
+the first place by looking at this process as a follow-on to microfilming.
+
+Other important factors include: the techniques available to the
+operator for handling material, the ways of integrating quality control
+into the digitizing work flow, and a work flow that includes indexing and
+storage. POB's requirement was to be able to deal with quality control
+at the point of scanning. Thus, thanks to Xerox, POB anticipates having
+a mechanism which will allow it not only to scan in batch form, but to
+review the material as it goes through the scanner and control quality
+from the outset.
+
+The standards for measuring quality and costs depend greatly on the uses
+of the material, including subsequent OCR, storage, printing, and
+browsing. But especially at issue for POB is the facility for browsing.
+This facility, WATERS said, is perhaps the weakest aspect of imaging
+technology and the most in need of development.
+
+A variety of factors affect the usability of complex documents in image
+form, among them: 1) the ability of the system to handle the full range
+of document types, not just monographs but serials, multi-part
+monographs, and manuscripts; 2) the location of the database of record
+for bibliographic information about the image document, which POB wants
+to enter once and in the most useful place, the on-line catalog; 3) a
+document identifier for referencing the bibliographic information in one
+place and the images in another; 4) the technique for making the basic
+internal structure of the document accessible to the reader; and finally,
+5) the physical presentation on the CRT of those documents. POB is ready
+to complete this phase now. One last decision involves deciding which
+material to scan.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * TIFF files constitute de facto standard * NARA's experience
+with image conversion software and text conversion * RFC 1314 *
+Considerable flux concerning available hardware and software solutions *
+NAL through-put rate during scanning * Window management questions *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+In the question-and-answer period that followed WATERS's presentation,
+the following points emerged:
+
+ * ZIDAR's statement about using TIFF files as a standard meant de
+ facto standard. This is what most people use and typically exchange
+ with other groups, across platforms, or even occasionally across
+ display software.
+
+ * HOLMES commented on the unsuccessful experience of NARA in
+ attempting to run image-conversion software or to exchange between
+ applications: What are supposedly TIFF files go into other software
+ that is supposed to be able to accept TIFF but cannot recognize the
+ format and cannot deal with it, and thus renders the exchange
+ useless. Re text conversion, he noted the different recognition
+ rates obtained by substituting the make and model of scanners in
+ NARA's recent test of an "intelligent" character-recognition product
+ for a new company. In the selection of hardware and software,
+ HOLMES argued, software no longer constitutes the overriding factor
+ it did until about a year ago; rather it is perhaps important to
+ look at both now.
+
+ * Danny Cohen and Alan Katz of the University of Southern California
+ Information Sciences Institute began circulating as an Internet RFC
+ (RFC 1314) about a month ago a standard for a TIFF interchange
+ format for Internet distribution of monochrome bit-mapped images,
+ which LYNCH said he believed would be used as a de facto standard.
+
+ * FLEISCHHAUER's impression from hearing these reports and thinking
+ about AM's experience was that there is considerable flux concerning
+ available hardware and software solutions. HOOTON agreed and
+ commented at the same time on ZIDAR's statement that the equipment
+ employed affects the results produced. One cannot draw a complete
+ conclusion by saying it is difficult or impossible to perform OCR
+ from scanning microfilm, for example, with that device, that set of
+ parameters, and system requirements, because numerous other people
+ are accomplishing just that, using other components, perhaps.
+ HOOTON opined that both the hardware and the software were highly
+ important. Most of the problems discussed today have been solved in
+ numerous different ways by other people. Though it is good to be
+ cognizant of various experiences, this is not to say that it will
+ always be thus.
+
+ * At NAL, the through-put rate of the scanning process for paper,
+ page by page, performing OCR, ranges from 300 to 600 pages per day;
+ not performing OCR is considerably faster, although how much faster
+ is not known. This is for scanning from bound books, which is much
+ slower.
+
+ * WATERS commented on window management questions: DEC proposed an
+ X-Windows solution which was problematical for two reasons. One was
+ POB's requirement to be able to manipulate images on the workstation
+ and bring them down to the workstation itself and the other was
+ network usage.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+THOMA * Illustration of deficiencies in scanning and storage process *
+Image quality in this process * Different costs entailed by better image
+quality * Techniques for overcoming various de-ficiencies: fixed
+thresholding, dynamic thresholding, dithering, image merge * Page edge
+effects *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+George THOMA, chief, Communications Engineering Branch, National Library
+of Medicine (NLM), illustrated several of the deficiencies discussed by
+the previous speakers. He introduced the topic of special problems by
+noting the advantages of electronic imaging. For example, it is regenerable
+because it is a coded file, and real-time quality control is possible with
+electronic capture, whereas in photographic capture it is not.
+
+One of the difficulties discussed in the scanning and storage process was
+image quality which, without belaboring the obvious, means different
+things for maps, medical X-rays, or broadcast television. In the case of
+documents, THOMA said, image quality boils down to legibility of the
+textual parts, and fidelity in the case of gray or color photo print-type
+material. Legibility boils down to scan density, the standard in most
+cases being 300 dpi. Increasing the resolution with scanners that
+perform 600 or 1200 dpi, however, comes at a cost.
+
+Better image quality entails at least four different kinds of costs: 1)
+equipment costs, because the CCD (i.e., charge-couple device) with
+greater number of elements costs more; 2) time costs that translate to
+the actual capture costs, because manual labor is involved (the time is
+also dependent on the fact that more data has to be moved around in the
+machine in the scanning or network devices that perform the scanning as
+well as the storage); 3) media costs, because at high resolutions larger
+files have to be stored; and 4) transmission costs, because there is just
+more data to be transmitted.
+
+But while resolution takes care of the issue of legibility in image
+quality, other deficiencies have to do with contrast and elements on the
+page scanned or the image that needed to be removed or clarified. Thus,
+THOMA proceeded to illustrate various deficiencies, how they are
+manifested, and several techniques to overcome them.
+
+Fixed thresholding was the first technique described, suitable for
+black-and-white text, when the contrast does not vary over the page. One
+can have many different threshold levels in scanning devices. Thus,
+THOMA offered an example of extremely poor contrast, which resulted from
+the fact that the stock was a heavy red. This is the sort of image that
+when microfilmed fails to provide any legibility whatsoever. Fixed
+thresholding is the way to change the black-to-red contrast to the
+desired black-to-white contrast.
+
+Other examples included material that had been browned or yellowed by
+age. This was also a case of contrast deficiency, and correction was
+done by fixed thresholding. A final example boils down to the same
+thing, slight variability, but it is not significant. Fixed thresholding
+solves this problem as well. The microfilm equivalent is certainly legible,
+but it comes with dark areas. Though THOMA did not have a slide of the
+microfilm in this case, he did show the reproduced electronic image.
+
+When one has variable contrast over a page or the lighting over the page
+area varies, especially in the case where a bound volume has light
+shining on it, the image must be processed by a dynamic thresholding
+scheme. One scheme, dynamic averaging, allows the threshold level not to
+be fixed but to be recomputed for every pixel from the neighboring
+characteristics. The neighbors of a pixel determine where the threshold
+should be set for that pixel.
+
+THOMA showed an example of a page that had been made deficient by a
+variety of techniques, including a burn mark, coffee stains, and a yellow
+marker. Application of a fixed-thresholding scheme, THOMA argued, might
+take care of several deficiencies on the page but not all of them.
+Performing the calculation for a dynamic threshold setting, however,
+removes most of the deficiencies so that at least the text is legible.
+
+Another problem is representing a gray level with black-and-white pixels
+by a process known as dithering or electronic screening. But dithering
+does not provide good image quality for pure black-and-white textual
+material. THOMA illustrated this point with examples. Although its
+suitability for photoprint is the reason for electronic screening or
+dithering, it cannot be used for every compound image. In the document
+that was distributed by CXP, THOMA noticed that the dithered image of the
+IEEE test chart evinced some deterioration in the text. He presented an
+extreme example of deterioration in the text in which compounded
+documents had to be set right by other techniques. The technique
+illustrated by the present example was an image merge in which the page
+is scanned twice and the settings go from fixed threshold to the
+dithering matrix; the resulting images are merged to give the best
+results with each technique.
+
+THOMA illustrated how dithering is also used in nonphotographic or
+nonprint materials with an example of a grayish page from a medical text,
+which was reproduced to show all of the gray that appeared in the
+original. Dithering provided a reproduction of all the gray in the
+original of another example from the same text.
+
+THOMA finally illustrated the problem of bordering, or page-edge,
+effects. Books and bound volumes that are placed on a photocopy machine
+or a scanner produce page-edge effects that are undesirable for two
+reasons: 1) the aesthetics of the image; after all, if the image is to
+be preserved, one does not necessarily want to keep all of its
+deficiencies; 2) compression (with the bordering problem THOMA
+illustrated, the compression ratio deteriorated tremendously). One way
+to eliminate this more serious problem is to have the operator at the
+point of scanning window the part of the image that is desirable and
+automatically turn all of the pixels out of that picture to white.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+FLEISCHHAUER * AM's experience with scanning bound materials * Dithering
+*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Carl FLEISCHHAUER, coordinator, American Memory, Library of Congress,
+reported AM's experience with scanning bound materials, which he likened
+to the problems involved in using photocopying machines. Very few
+devices in the industry offer book-edge scanning, let alone book cradles.
+The problem may be unsolvable, FLEISCHHAUER said, because a large enough
+market does not exist for a preservation-quality scanner. AM is using a
+Kurzweil scanner, which is a book-edge scanner now sold by Xerox.
+
+Devoting the remainder of his brief presentation to dithering,
+FLEISCHHAUER related AM's experience with a contractor who was using
+unsophisticated equipment and software to reduce moire patterns from
+printed halftones. AM took the same image and used the dithering
+algorithm that forms part of the same Kurzweil Xerox scanner; it
+disguised moire patterns much more effectively.
+
+FLEISCHHAUER also observed that dithering produces a binary file which is
+useful for numerous purposes, for example, printing it on a laser printer
+without having to "re-halftone" it. But it tends to defeat efficient
+compression, because the very thing that dithers to reduce moire patterns
+also tends to work against compression schemes. AM thought the
+difference in image quality was worth it.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Relative use as a criterion for POB's selection of books to
+be converted into digital form *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+During the discussion period, WATERS noted that one of the criteria for
+selecting books among the 10,000 to be converted into digital image form
+would be how much relative use they would receive--a subject still
+requiring evaluation. The challenge will be to understand whether
+coherent bodies of material will increase usage or whether POB should
+seek material that is being used, scan that, and make it more accessible.
+POB might decide to digitize materials that are already heavily used, in
+order to make them more accessible and decrease wear on them. Another
+approach would be to provide a large body of intellectually coherent
+material that may be used more in digital form than it is currently used
+in microfilm. POB would seek material that was out of copyright.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+BARONAS * Origin and scope of AIIM * Types of documents produced in
+AIIM's standards program * Domain of AIIM's standardization work * AIIM's
+structure * TC 171 and MS23 * Electronic image management standards *
+Categories of EIM standardization where AIIM standards are being
+developed *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Jean BARONAS, senior manager, Department of Standards and Technology,
+Association for Information and Image Management (AIIM), described the
+not-for-profit association and the national and international programs
+for standardization in which AIIM is active.
+
+Accredited for twenty-five years as the nation's standards development
+organization for document image management, AIIM began life in a library
+community developing microfilm standards. Today the association
+maintains both its library and business-image management standardization
+activities--and has moved into electronic image-management
+standardization (EIM).
+
+BARONAS defined the program's scope. AIIM deals with: 1) the
+terminology of standards and of the technology it uses; 2) methods of
+measurement for the systems, as well as quality; 3) methodologies for
+users to evaluate and measure quality; 4) the features of apparatus used
+to manage and edit images; and 5) the procedures used to manage images.
+
+BARONAS noted that three types of documents are produced in the AIIM
+standards program: the first two, accredited by the American National
+Standards Institute (ANSI), are standards and standard recommended
+practices. Recommended practices differ from standards in that they
+contain more tutorial information. A technical report is not an ANSI
+standard. Because AIIM's policies and procedures for developing
+standards are approved by ANSI, its standards are labeled ANSI/AIIM,
+followed by the number and title of the standard.
+
+BARONAS then illustrated the domain of AIIM's standardization work. For
+example, AIIM is the administrator of the U.S. Technical Advisory Group
+(TAG) to the International Standards Organization's (ISO) technical
+committee, TC l7l Micrographics and Optical Memories for Document and
+Image Recording, Storage, and Use. AIIM officially works through ANSI in
+the international standardization process.
+
+BARONAS described AIIM's structure, including its board of directors, its
+standards board of twelve individuals active in the image-management
+industry, its strategic planning and legal admissibility task forces, and
+its National Standards Council, which is comprised of the members of a
+number of organizations who vote on every AIIM standard before it is
+published. BARONAS pointed out that AIIM's liaisons deal with numerous
+other standards developers, including the optical disk community, office
+and publishing systems, image-codes-and-character set committees, and the
+National Information Standards Organization (NISO).
+
+BARONAS illustrated the procedures of TC l7l, which covers all aspects of
+image management. When AIIM's national program has conceptualized a new
+project, it is usually submitted to the international level, so that the
+member countries of TC l7l can simultaneously work on the development of
+the standard or the technical report. BARONAS also illustrated a classic
+microfilm standard, MS23, which deals with numerous imaging concepts that
+apply to electronic imaging. Originally developed in the l970s, revised
+in the l980s, and revised again in l991, this standard is scheduled for
+another revision. MS23 is an active standard whereby users may propose
+new density ranges and new methods of evaluating film images in the
+standard's revision.
+
+BARONAS detailed several electronic image-management standards, for
+instance, ANSI/AIIM MS44, a quality-control guideline for scanning 8.5"
+by 11" black-and-white office documents. This standard is used with the
+IEEE fax image--a continuous tone photographic image with gray scales,
+text, and several continuous tone pictures--and AIIM test target number
+2, a representative document used in office document management.
+
+BARONAS next outlined the four categories of EIM standardization in which
+AIIM standards are being developed: transfer and retrieval, evaluation,
+optical disc and document scanning applications, and design and
+conversion of documents. She detailed several of the main projects of
+each: 1) in the category of image transfer and retrieval, a bi-level
+image transfer format, ANSI/AIIM MS53, which is a proposed standard that
+describes a file header for image transfer between unlike systems when
+the images are compressed using G3 and G4 compression; 2) the category of
+image evaluation, which includes the AIIM-proposed TR26 tutorial on image
+resolution (this technical report will treat the differences and
+similarities between classical or photographic and electronic imaging);
+3) design and conversion, which includes a proposed technical report
+called "Forms Design Optimization for EIM" (this report considers how
+general-purpose business forms can be best designed so that scanning is
+optimized; reprographic characteristics such as type, rules, background,
+tint, and color will likewise be treated in the technical report); 4)
+disk and document scanning applications includes a project a) on planning
+platters and disk management, b) on generating an application profile for
+EIM when images are stored and distributed on CD-ROM, and c) on
+evaluating SCSI2, and how a common command set can be generated for SCSI2
+so that document scanners are more easily integrated. (ANSI/AIIM MS53
+will also apply to compressed images.)
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+BATTIN * The implications of standards for preservation * A major
+obstacle to successful cooperation * A hindrance to access in the digital
+environment * Standards a double-edged sword for those concerned with the
+preservation of the human record * Near-term prognosis for reliable
+archival standards * Preservation concerns for electronic media * Need
+for reconceptualizing our preservation principles * Standards in the real
+world and the politics of reproduction * Need to redefine the concept of
+archival and to begin to think in terms of life cycles * Cooperation and
+the La Guardia Eight * Concerns generated by discussions on the problems
+of preserving text and image * General principles to be adopted in a
+world without standards *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Patricia BATTIN, president, the Commission on Preservation and Access
+(CPA), addressed the implications of standards for preservation. She
+listed several areas where the library profession and the analog world of
+the printed book had made enormous contributions over the past hundred
+years--for example, in bibliographic formats, binding standards, and, most
+important, in determining what constitutes longevity or archival quality.
+
+Although standards have lightened the preservation burden through the
+development of national and international collaborative programs,
+nevertheless, a pervasive mistrust of other people's standards remains a
+major obstacle to successful cooperation, BATTIN said.
+
+The zeal to achieve perfection, regardless of the cost, has hindered
+rather than facilitated access in some instances, and in the digital
+environment, where no real standards exist, has brought an ironically
+just reward.
+
+BATTIN argued that standards are a double-edged sword for those concerned
+with the preservation of the human record, that is, the provision of
+access to recorded knowledge in a multitude of media as far into the
+future as possible. Standards are essential to facilitate
+interconnectivity and access, but, BATTIN said, as LYNCH pointed out
+yesterday, if set too soon they can hinder creativity, expansion of
+capability, and the broadening of access. The characteristics of
+standards for digital imagery differ radically from those for analog
+imagery. And the nature of digital technology implies continuing
+volatility and change. To reiterate, precipitous standard-setting can
+inhibit creativity, but delayed standard-setting results in chaos.
+
+Since in BATTIN'S opinion the near-term prognosis for reliable archival
+standards, as defined by librarians in the analog world, is poor, two
+alternatives remain: standing pat with the old technology, or
+reconceptualizing.
+
+Preservation concerns for electronic media fall into two general domains.
+One is the continuing assurance of access to knowledge originally
+generated, stored, disseminated, and used in electronic form. This
+domain contains several subdivisions, including 1) the closed,
+proprietary systems discussed the previous day, bundled information such
+as electronic journals and government agency records, and electronically
+produced or captured raw data; and 2) the application of digital
+technologies to the reformatting of materials originally published on a
+deteriorating analog medium such as acid paper or videotape.
+
+The preservation of electronic media requires a reconceptualizing of our
+preservation principles during a volatile, standardless transition which
+may last far longer than any of us envision today. BATTIN urged the
+necessity of shifting focus from assessing, measuring, and setting
+standards for the permanence of the medium to the concept of managing
+continuing access to information stored on a variety of media and
+requiring a variety of ever-changing hardware and software for access--a
+fundamental shift for the library profession.
+
+BATTIN offered a primer on how to move forward with reasonable confidence
+in a world without standards. Her comments fell roughly into two sections:
+1) standards in the real world and 2) the politics of reproduction.
+
+In regard to real-world standards, BATTIN argued the need to redefine the
+concept of archive and to begin to think in terms of life cycles. In
+the past, the naive assumption that paper would last forever produced a
+cavalier attitude toward life cycles. The transient nature of the
+electronic media has compelled people to recognize and accept upfront the
+concept of life cycles in place of permanency.
+
+Digital standards have to be developed and set in a cooperative context
+to ensure efficient exchange of information. Moreover, during this
+transition period, greater flexibility concerning how concepts such as
+backup copies and archival copies in the CXP are defined is necessary,
+or the opportunity to move forward will be lost.
+
+In terms of cooperation, particularly in the university setting, BATTIN
+also argued the need to avoid going off in a hundred different
+directions. The CPA has catalyzed a small group of universities called
+the La Guardia Eight--because La Guardia Airport is where meetings take
+place--Harvard, Yale, Cornell, Princeton, Penn State, Tennessee,
+Stanford, and USC, to develop a digital preservation consortium to look
+at all these issues and develop de facto standards as we move along,
+instead of waiting for something that is officially blessed. Continuing
+to apply analog values and definitions of standards to the digital
+environment, BATTIN said, will effectively lead to forfeiture of the
+benefits of digital technology to research and scholarship.
+
+Under the second rubric, the politics of reproduction, BATTIN reiterated
+an oft-made argument concerning the electronic library, namely, that it
+is more difficult to transform than to create, and nowhere is that belief
+expressed more dramatically than in the conversion of brittle books to
+new media. Preserving information published in electronic media involves
+making sure the information remains accessible and that digital
+information is not lost through reproduction. In the analog world of
+photocopies and microfilm, the issue of fidelity to the original becomes
+paramount, as do issues of "Whose fidelity?" and "Whose original?"
+
+BATTIN elaborated these arguments with a few examples from a recent study
+conducted by the CPA on the problems of preserving text and image.
+Discussions with scholars, librarians, and curators in a variety of
+disciplines dependent on text and image generated a variety of concerns,
+for example: 1) Copy what is, not what the technology is capable of.
+This is very important for the history of ideas. Scholars wish to know
+what the author saw and worked from. And make available at the
+workstation the opportunity to erase all the defects and enhance the
+presentation. 2) The fidelity of reproduction--what is good enough, what
+can we afford, and the difference it makes--issues of subjective versus
+objective resolution. 3) The differences between primary and secondary
+users. Restricting the definition of primary user to the one in whose
+discipline the material has been published runs one headlong into the
+reality that these printed books have had a host of other users from a
+host of other disciplines, who not only were looking for very different
+things, but who also shared values very different from those of the
+primary user. 4) The relationship of the standard of reproduction to new
+capabilities of scholarship--the browsing standard versus an archival
+standard. How good must the archival standard be? Can a distinction be
+drawn between potential users in setting standards for reproduction?
+Archival storage, use copies, browsing copies--ought an attempt to set
+standards even be made? 5) Finally, costs. How much are we prepared to
+pay to capture absolute fidelity? What are the trade-offs between vastly
+enhanced access, degrees of fidelity, and costs?
+
+These standards, BATTIN concluded, serve to complicate further the
+reproduction process, and add to the long list of technical standards
+that are necessary to ensure widespread access. Ways to articulate and
+analyze the costs that are attached to the different levels of standards
+must be found.
+
+Given the chaos concerning standards, which promises to linger for the
+foreseeable future, BATTIN urged adoption of the following general
+principles:
+
+ * Strive to understand the changing information requirements of
+ scholarly disciplines as more and more technology is integrated into
+ the process of research and scholarly communication in order to meet
+ future scholarly needs, not to build for the past. Capture
+ deteriorating information at the highest affordable resolution, even
+ though the dissemination and display technologies will lag.
+
+ * Develop cooperative mechanisms to foster agreement on protocols
+ for document structure and other interchange mechanisms necessary
+ for widespread dissemination and use before official standards are
+ set.
+
+ * Accept that, in a transition period, de facto standards will have
+ to be developed.
+
+ * Capture information in a way that keeps all options open and
+ provides for total convertibility: OCR, scanning of microfilm,
+ producing microfilm from scanned documents, etc.
+
+ * Work closely with the generators of information and the builders
+ of networks and databases to ensure that continuing accessibility is
+ a primary concern from the beginning.
+
+ * Piggyback on standards under development for the broad market, and
+ avoid library-specific standards; work with the vendors, in order to
+ take advantage of that which is being standardized for the rest of
+ the world.
+
+ * Concentrate efforts on managing permanence in the digital world,
+ rather than perfecting the longevity of a particular medium.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Additional comments on TIFF *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+During the brief discussion period that followed BATTIN's presentation,
+BARONAS explained that TIFF was not developed in collaboration with or
+under the auspices of AIIM. TIFF is a company product, not a standard,
+is owned by two corporations, and is always changing. BARONAS also
+observed that ANSI/AIIM MS53, a bi-level image file transfer format that
+allows unlike systems to exchange images, is compatible with TIFF as well
+as with DEC's architecture and IBM's MODCA/IOCA.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+HOOTON * Several questions to be considered in discussing text conversion
+*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+HOOTON introduced the final topic, text conversion, by noting that it is
+becoming an increasingly important part of the imaging business. Many
+people now realize that it enhances their system to be able to have more
+and more character data as part of their imaging system. Re the issue of
+OCR versus rekeying, HOOTON posed several questions: How does one get
+text into computer-readable form? Does one use automated processes?
+Does one attempt to eliminate the use of operators where possible?
+Standards for accuracy, he said, are extremely important: it makes a
+major difference in cost and time whether one sets as a standard 98.5
+percent acceptance or 99.5 percent. He mentioned outsourcing as a
+possibility for converting text. Finally, what one does with the image
+to prepare it for the recognition process is also important, he said,
+because such preparation changes how recognition is viewed, as well as
+facilitates recognition itself.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+LESK * Roles of participants in CORE * Data flow * The scanning process *
+The image interface * Results of experiments involving the use of
+electronic resources and traditional paper copies * Testing the issue of
+serendipity * Conclusions *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Michael LESK, executive director, Computer Science Research, Bell
+Communications Research, Inc. (Bellcore), discussed the Chemical Online
+Retrieval Experiment (CORE), a cooperative project involving Cornell
+University, OCLC, Bellcore, and the American Chemical Society (ACS).
+
+LESK spoke on 1) how the scanning was performed, including the unusual
+feature of page segmentation, and 2) the use made of the text and the
+image in experiments.
+
+Working with the chemistry journals (because ACS has been saving its
+typesetting tapes since the mid-1970s and thus has a significant back-run
+of the most important chemistry journals in the United States), CORE is
+attempting to create an automated chemical library. Approximately a
+quarter of the pages by square inch are made up of images of
+quasi-pictorial material; dealing with the graphic components of the
+pages is extremely important. LESK described the roles of participants
+in CORE: 1) ACS provides copyright permission, journals on paper,
+journals on microfilm, and some of the definitions of the files; 2) at
+Bellcore, LESK chiefly performs the data preparation, while Dennis Egan
+performs experiments on the users of chemical abstracts, and supplies the
+indexing and numerous magnetic tapes; 3) Cornell provides the site of the
+experiment; 4) OCLC develops retrieval software and other user interfaces.
+Various manufacturers and publishers have furnished other help.
+
+Concerning data flow, Bellcore receives microfilm and paper from ACS; the
+microfilm is scanned by outside vendors, while the paper is scanned
+inhouse on an Improvision scanner, twenty pages per minute at 300 dpi,
+which provides sufficient quality for all practical uses. LESK would
+prefer to have more gray level, because one of the ACS journals prints on
+some colored pages, which creates a problem.
+
+Bellcore performs all this scanning, creates a page-image file, and also
+selects from the pages the graphics, to mix with the text file (which is
+discussed later in the Workshop). The user is always searching the ASCII
+file, but she or he may see a display based on the ASCII or a display
+based on the images.
+
+LESK illustrated how the program performs page analysis, and the image
+interface. (The user types several words, is presented with a list--
+usually of the titles of articles contained in an issue--that derives
+from the ASCII, clicks on an icon and receives an image that mirrors an
+ACS page.) LESK also illustrated an alternative interface, based on text
+on the ASCII, the so-called SuperBook interface from Bellcore.
+
+LESK next presented the results of an experiment conducted by Dennis Egan
+and involving thirty-six students at Cornell, one third of them
+undergraduate chemistry majors, one third senior undergraduate chemistry
+majors, and one third graduate chemistry students. A third of them
+received the paper journals, the traditional paper copies and chemical
+abstracts on paper. A third received image displays of the pictures of
+the pages, and a third received the text display with pop-up graphics.
+
+The students were given several questions made up by some chemistry
+professors. The questions fell into five classes, ranging from very easy
+to very difficult, and included questions designed to simulate browsing
+as well as a traditional information retrieval-type task.
+
+LESK furnished the following results. In the straightforward question
+search--the question being, what is the phosphorus oxygen bond distance
+and hydroxy phosphate?--the students were told that they could take
+fifteen minutes and, then, if they wished, give up. The students with
+paper took more than fifteen minutes on average, and yet most of them
+gave up. The students with either electronic format, text or image,
+received good scores in reasonable time, hardly ever had to give up, and
+usually found the right answer.
+
+In the browsing study, the students were given a list of eight topics,
+told to imagine that an issue of the Journal of the American Chemical
+Society had just appeared on their desks, and were also told to flip
+through it and to find topics mentioned in the issue. The average scores
+were about the same. (The students were told to answer yes or no about
+whether or not particular topics appeared.) The errors, however, were
+quite different. The students with paper rarely said that something
+appeared when it had not. But they often failed to find something
+actually mentioned in the issue. The computer people found numerous
+things, but they also frequently said that a topic was mentioned when it
+was not. (The reason, of course, was that they were performing word
+searches. They were finding that words were mentioned and they were
+concluding that they had accomplished their task.)
+
+This question also contained a trick to test the issue of serendipity.
+The students were given another list of eight topics and instructed,
+without taking a second look at the journal, to recall how many of this
+new list of eight topics were in this particular issue. This was an
+attempt to see if they performed better at remembering what they were not
+looking for. They all performed about the same, paper or electronics,
+about 62 percent accurate. In short, LESK said, people were not very
+good when it came to serendipity, but they were no worse at it with
+computers than they were with paper.
+
+(LESK gave a parenthetical illustration of the learning curve of students
+who used SuperBook.)
+
+The students using the electronic systems started off worse than the ones
+using print, but by the third of the three sessions in the series had
+caught up to print. As one might expect, electronics provide a much
+better means of finding what one wants to read; reading speeds, once the
+object of the search has been found, are about the same.
+
+Almost none of the students could perform the hard task--the analogous
+transformation. (It would require the expertise of organic chemists to
+complete.) But an interesting result was that the students using the text
+search performed terribly, while those using the image system did best.
+That the text search system is driven by text offers the explanation.
+Everything is focused on the text; to see the pictures, one must press
+on an icon. Many students found the right article containing the answer
+to the question, but they did not click on the icon to bring up the right
+figure and see it. They did not know that they had found the right place,
+and thus got it wrong.
+
+The short answer demonstrated by this experiment was that in the event
+one does not know what to read, one needs the electronic systems; the
+electronic systems hold no advantage at the moment if one knows what to
+read, but neither do they impose a penalty.
+
+LESK concluded by commenting that, on one hand, the image system was easy
+to use. On the other hand, the text display system, which represented
+twenty man-years of work in programming and polishing, was not winning,
+because the text was not being read, just searched. The much easier
+system is highly competitive as well as remarkably effective for the
+actual chemists.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ERWAY * Most challenging aspect of working on AM * Assumptions guiding
+AM's approach * Testing different types of service bureaus * AM's
+requirement for 99.95 percent accuracy * Requirements for text-coding *
+Additional factors influencing AM's approach to coding * Results of AM's
+experience with rekeying * Other problems in dealing with service bureaus
+* Quality control the most time-consuming aspect of contracting out
+conversion * Long-term outlook uncertain *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+To Ricky ERWAY, associate coordinator, American Memory, Library of
+Congress, the constant variety of conversion projects taking place
+simultaneously represented perhaps the most challenging aspect of working
+on AM. Thus, the challenge was not to find a solution for text
+conversion but a tool kit of solutions to apply to LC's varied
+collections that need to be converted. ERWAY limited her remarks to the
+process of converting text to machine-readable form, and the variety of
+LC's text collections, for example, bound volumes, microfilm, and
+handwritten manuscripts.
+
+Two assumptions have guided AM's approach, ERWAY said: 1) A desire not
+to perform the conversion inhouse. Because of the variety of formats and
+types of texts, to capitalize the equipment and have the talents and
+skills to operate them at LC would be extremely expensive. Further, the
+natural inclination to upgrade to newer and better equipment each year
+made it reasonable for AM to focus on what it did best and seek external
+conversion services. Using service bureaus also allowed AM to have
+several types of operations take place at the same time. 2) AM was not a
+technology project, but an effort to improve access to library
+collections. Hence, whether text was converted using OCR or rekeying
+mattered little to AM. What mattered were cost and accuracy of results.
+
+AM considered different types of service bureaus and selected three to
+perform several small tests in order to acquire a sense of the field.
+The sample collections with which they worked included handwritten
+correspondence, typewritten manuscripts from the 1940s, and
+eighteenth-century printed broadsides on microfilm. On none of these
+samples was OCR performed; they were all rekeyed. AM had several special
+requirements for the three service bureaus it had engaged. For instance,
+any errors in the original text were to be retained. Working from bound
+volumes or anything that could not be sheet-fed also constituted a factor
+eliminating companies that would have performed OCR.
+
+AM requires 99.95 percent accuracy, which, though it sounds high, often
+means one or two errors per page. The initial batch of test samples
+contained several handwritten materials for which AM did not require
+text-coding. The results, ERWAY reported, were in all cases fairly
+comparable: for the most part, all three service bureaus achieved 99.95
+percent accuracy. AM was satisfied with the work but surprised at the cost.
+
+As AM began converting whole collections, it retained the requirement for
+99.95 percent accuracy and added requirements for text-coding. AM needed
+to begin performing work more than three years ago before LC requirements
+for SGML applications had been established. Since AM's goal was simply
+to retain any of the intellectual content represented by the formatting
+of the document (which would be lost if one performed a straight ASCII
+conversion), AM used "SGML-like" codes. These codes resembled SGML tags
+but were used without the benefit of document-type definitions. AM found
+that many service bureaus were not yet SGML-proficient.
+
+Additional factors influencing the approach AM took with respect to
+coding included: 1) the inability of any known microcomputer-based
+user-retrieval software to take advantage of SGML coding; and 2) the
+multiple inconsistencies in format of the older documents, which
+confirmed AM in its desire not to attempt to force the different formats
+to conform to a single document-type definition (DTD) and thus create the
+need for a separate DTD for each document.
+
+The five text collections that AM has converted or is in the process of
+converting include a collection of eighteenth-century broadsides, a
+collection of pamphlets, two typescript document collections, and a
+collection of 150 books.
+
+ERWAY next reviewed the results of AM's experience with rekeying, noting
+again that because the bulk of AM's materials are historical, the quality
+of the text often does not lend itself to OCR. While non-English
+speakers are less likely to guess or elaborate or correct typos in the
+original text, they are also less able to infer what we would; they also
+are nearly incapable of converting handwritten text. Another
+disadvantage of working with overseas keyers is that they are much less
+likely to telephone with questions, especially on the coding, with the
+result that they develop their own rules as they encounter new
+situations.
+
+Government contracting procedures and time frames posed a major challenge
+to performing the conversion. Many service bureaus are not accustomed to
+retaining the image, even if they perform OCR. Thus, questions of image
+format and storage media were somewhat novel to many of them. ERWAY also
+remarked other problems in dealing with service bureaus, for example,
+their inability to perform text conversion from the kind of microfilm
+that LC uses for preservation purposes.
+
+But quality control, in ERWAY's experience, was the most time-consuming
+aspect of contracting out conversion. AM has been attempting to perform
+a 10-percent quality review, looking at either every tenth document or
+every tenth page to make certain that the service bureaus are maintaining
+99.95 percent accuracy. But even if they are complying with the
+requirement for accuracy, finding errors produces a desire to correct
+them and, in turn, to clean up the whole collection, which defeats the
+purpose to some extent. Even a double entry requires a
+character-by-character comparison to the original to meet the accuracy
+requirement. LC is not accustomed to publish imperfect texts, which
+makes attempting to deal with the industry standard an emotionally
+fraught issue for AM. As was mentioned in the previous day's discussion,
+going from 99.95 to 99.99 percent accuracy usually doubles costs and
+means a third keying or another complete run-through of the text.
+
+Although AM has learned much from its experiences with various collections
+and various service bureaus, ERWAY concluded pessimistically that no
+breakthrough has been achieved. Incremental improvements have occurred
+in some of the OCR technology, some of the processes, and some of the
+standards acceptances, which, though they may lead to somewhat lower costs,
+do not offer much encouragement to many people who are anxiously awaiting
+the day that the entire contents of LC are available on-line.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ZIDAR * Several answers to why one attempts to perform full-text
+conversion * Per page cost of performing OCR * Typical problems
+encountered during editing * Editing poor copy OCR vs. rekeying *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Judith ZIDAR, coordinator, National Agricultural Text Digitizing Program
+(NATDP), National Agricultural Library (NAL), offered several answers to
+the question of why one attempts to perform full-text conversion: 1)
+Text in an image can be read by a human but not by a computer, so of
+course it is not searchable and there is not much one can do with it. 2)
+Some material simply requires word-level access. For instance, the legal
+profession insists on full-text access to its material; with taxonomic or
+geographic material, which entails numerous names, one virtually requires
+word-level access. 3) Full text permits rapid browsing and searching,
+something that cannot be achieved in an image with today's technology.
+4) Text stored as ASCII and delivered in ASCII is standardized and highly
+portable. 5) People just want full-text searching, even those who do not
+know how to do it. NAL, for the most part, is performing OCR at an
+actual cost per average-size page of approximately $7. NAL scans the
+page to create the electronic image and passes it through the OCR device.
+
+ZIDAR next rehearsed several typical problems encountered during editing.
+Praising the celerity of her student workers, ZIDAR observed that editing
+requires approximately five to ten minutes per page, assuming that there
+are no large tables to audit. Confusion among the three characters I, 1,
+and l, constitutes perhaps the most common problem encountered. Zeroes
+and O's also are frequently confused. Double M's create a particular
+problem, even on clean pages. They are so wide in most fonts that they
+touch, and the system simply cannot tell where one letter ends and the
+other begins. Complex page formats occasionally fail to columnate
+properly, which entails rescanning as though one were working with a
+single column, entering the ASCII, and decolumnating for better
+searching. With proportionally spaced text, OCR can have difficulty
+discerning what is a space and what are merely spaces between letters, as
+opposed to spaces between words, and therefore will merge text or break
+up words where it should not.
+
+ZIDAR said that it can often take longer to edit a poor-copy OCR than to
+key it from scratch. NAL has also experimented with partial editing of
+text, whereby project workers go into and clean up the format, removing
+stray characters but not running a spell-check. NAL corrects typos in
+the title and authors' names, which provides a foothold for searching and
+browsing. Even extremely poor-quality OCR (e.g., 60-percent accuracy)
+can still be searched, because numerous words are correct, while the
+important words are probably repeated often enough that they are likely
+to be found correct somewhere. Librarians, however, cannot tolerate this
+situation, though end users seem more willing to use this text for
+searching, provided that NAL indicates that it is unedited. ZIDAR
+concluded that rekeying of text may be the best route to take, in spite
+of numerous problems with quality control and cost.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Modifying an image before performing OCR * NAL's costs per
+page *AM's costs per page and experience with Federal Prison Industries *
+Elements comprising NATDP's costs per page * OCR and structured markup *
+Distinction between the structure of a document and its representation
+when put on the screen or printed *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+HOOTON prefaced the lengthy discussion that followed with several
+comments about modifying an image before one reaches the point of
+performing OCR. For example, in regard to an application containing a
+significant amount of redundant data, such as form-type data, numerous
+companies today are working on various kinds of form renewal, prior to
+going through a recognition process, by using dropout colors. Thus,
+acquiring access to form design or using electronic means are worth
+considering. HOOTON also noted that conversion usually makes or breaks
+one's imaging system. It is extremely important, extremely costly in
+terms of either capital investment or service, and determines the quality
+of the remainder of one's system, because it determines the character of
+the raw material used by the system.
+
+Concerning the four projects undertaken by NAL, two inside and two
+performed by outside contractors, ZIDAR revealed that an in-house service
+bureau executed the first at a cost between $8 and $10 per page for
+everything, including building of the database. The project undertaken
+by the Consultative Group on International Agricultural Research (CGIAR)
+cost approximately $10 per page for the conversion, plus some expenses
+for the software and building of the database. The Acid Rain Project--a
+two-disk set produced by the University of Vermont, consisting of
+Canadian publications on acid rain--cost $6.70 per page for everything,
+including keying of the text, which was double keyed, scanning of the
+images, and building of the database. The in-house project offered
+considerable ease of convenience and greater control of the process. On
+the other hand, the service bureaus know their job and perform it
+expeditiously, because they have more people.
+
+As a useful comparison, ERWAY revealed AM's costs as follows: $0.75
+cents to $0.85 cents per thousand characters, with an average page
+containing 2,700 characters. Requirements for coding and imaging
+increase the costs. Thus, conversion of the text, including the coding,
+costs approximately $3 per page. (This figure does not include the
+imaging and database-building included in the NAL costs.) AM also
+enjoyed a happy experience with Federal Prison Industries, which
+precluded the necessity of going through the request-for-proposal process
+to award a contract, because it is another government agency. The
+prisoners performed AM's rekeying just as well as other service bureaus
+and proved handy as well. AM shipped them the books, which they would
+photocopy on a book-edge scanner. They would perform the markup on
+photocopies, return the books as soon as they were done with them,
+perform the keying, and return the material to AM on WORM disks.
+
+ZIDAR detailed the elements that constitute the previously noted cost of
+approximately $7 per page. Most significant is the editing, correction
+of errors, and spell-checkings, which though they may sound easy to
+perform require, in fact, a great deal of time. Reformatting text also
+takes a while, but a significant amount of NAL's expenses are for equipment,
+which was extremely expensive when purchased because it was one of the few
+systems on the market. The costs of equipment are being amortized over
+five years but are still quite high, nearly $2,000 per month.
+
+HOCKEY raised a general question concerning OCR and the amount of editing
+required (substantial in her experience) to generate the kind of
+structured markup necessary for manipulating the text on the computer or
+loading it into any retrieval system. She wondered if the speakers could
+extend the previous question about the cost-benefit of adding or exerting
+structured markup. ERWAY noted that several OCR systems retain italics,
+bolding, and other spatial formatting. While the material may not be in
+the format desired, these systems possess the ability to remove the
+original materials quickly from the hands of the people performing the
+conversion, as well as to retain that information so that users can work
+with it. HOCKEY rejoined that the current thinking on markup is that one
+should not say that something is italic or bold so much as why it is that
+way. To be sure, one needs to know that something was italicized, but
+how can one get from one to the other? One can map from the structure to
+the typographic representation.
+
+FLEISCHHAUER suggested that, given the 100 million items the Library
+holds, it may not be possible for LC to do more than report that a thing
+was in italics as opposed to why it was italics, although that may be
+desirable in some contexts. Promising to talk a bit during the afternoon
+session about several experiments OCLC performed on automatic recognition
+of document elements, and which they hoped to extend, WEIBEL said that in
+fact one can recognize the major elements of a document with a fairly
+high degree of reliability, at least as good as OCR. STEVENS drew a
+useful distinction between standard, generalized markup (i.e., defining
+for a document-type definition the structure of the document), and what
+he termed a style sheet, which had to do with italics, bolding, and other
+forms of emphasis. Thus, two different components are at work, one being
+the structure of the document itself (its logic), and the other being its
+representation when it is put on the screen or printed.
+
+ ******
+
+SESSION V. APPROACHES TO PREPARING ELECTRONIC TEXTS
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+HOCKEY * Text in ASCII and the representation of electronic text versus
+an image * The need to look at ways of using markup to assist retrieval *
+The need for an encoding format that will be reusable and multifunctional
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Susan HOCKEY, director, Center for Electronic Texts in the Humanities
+(CETH), Rutgers and Princeton Universities, announced that one talk
+(WEIBEL's) was moved into this session from the morning and that David
+Packard was unable to attend. The session would attempt to focus more on
+what one can do with a text in ASCII and the representation of electronic
+text rather than just an image, what one can do with a computer that
+cannot be done with a book or an image. It would be argued that one can
+do much more than just read a text, and from that starting point one can
+use markup and methods of preparing the text to take full advantage of
+the capability of the computer. That would lead to a discussion of what
+the European Community calls REUSABILITY, what may better be termed
+DURABILITY, that is, how to prepare or make a text that will last a long
+time and that can be used for as many applications as possible, which
+would lead to issues of improving intellectual access.
+
+HOCKEY urged the need to look at ways of using markup to facilitate retrieval,
+not just for referencing or to help locate an item that is retrieved, but also to put markup tags in
+a text to help retrieve the thing sought either with linguistic tagging or
+interpretation. HOCKEY also argued that little advancement had occurred in
+the software tools currently available for retrieving and searching text.
+She pressed the desideratum of going beyond Boolean searches and performing
+more sophisticated searching, which the insertion of more markup in the text
+would facilitate. Thinking about electronic texts as opposed to images means
+considering material that will never appear in print form, or print will not
+be its primary form, that is, material which only appears in electronic form.
+HOCKEY alluded to the history and the need for markup and tagging and
+electronic text, which was developed through the use of computers in the
+humanities; as MICHELSON had observed, Father Busa had started in 1949
+to prepare the first-ever text on the computer.
+
+HOCKEY remarked several large projects, particularly in Europe, for the
+compilation of dictionaries, language studies, and language analysis, in
+which people have built up archives of text and have begun to recognize
+the need for an encoding format that will be reusable and multifunctional,
+that can be used not just to print the text, which may be assumed to be a
+byproduct of what one wants to do, but to structure it inside the computer
+so that it can be searched, built into a Hypertext system, etc.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+WEIBEL * OCLC's approach to preparing electronic text: retroconversion,
+keying of texts, more automated ways of developing data * Project ADAPT
+and the CORE Project * Intelligent character recognition does not exist *
+Advantages of SGML * Data should be free of procedural markup;
+descriptive markup strongly advocated * OCLC's interface illustrated *
+Storage requirements and costs for putting a lot of information on line *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Stuart WEIBEL, senior research scientist, Online Computer Library Center,
+Inc. (OCLC), described OCLC's approach to preparing electronic text. He
+argued that the electronic world into which we are moving must
+accommodate not only the future but the past as well, and to some degree
+even the present. Thus, starting out at one end with retroconversion and
+keying of texts, one would like to move toward much more automated ways
+of developing data.
+
+For example, Project ADAPT had to do with automatically converting
+document images into a structured document database with OCR text as
+indexing and also a little bit of automatic formatting and tagging of
+that text. The CORE project hosted by Cornell University, Bellcore,
+OCLC, the American Chemical Society, and Chemical Abstracts, constitutes
+WEIBEL's principal concern at the moment. This project is an example of
+converting text for which one already has a machine-readable version into
+a format more suitable for electronic delivery and database searching.
+(Since Michael LESK had previously described CORE, WEIBEL would say
+little concerning it.) Borrowing a chemical phrase, de novo synthesis,
+WEIBEL cited the Online Journal of Current Clinical Trials as an example
+of de novo electronic publishing, that is, a form in which the primary
+form of the information is electronic.
+
+Project ADAPT, then, which OCLC completed a couple of years ago and in
+fact is about to resume, is a model in which one takes page images either
+in paper or microfilm and converts them automatically to a searchable
+electronic database, either on-line or local. The operating assumption
+is that accepting some blemishes in the data, especially for
+retroconversion of materials, will make it possible to accomplish more.
+Not enough money is available to support perfect conversion.
+
+WEIBEL related several steps taken to perform image preprocessing
+(processing on the image before performing optical character
+recognition), as well as image postprocessing. He denied the existence
+of intelligent character recognition and asserted that what is wanted is
+page recognition, which is a long way off. OCLC has experimented with
+merging of multiple optical character recognition systems that will
+reduce errors from an unacceptable rate of 5 characters out of every
+l,000 to an unacceptable rate of 2 characters out of every l,000, but it
+is not good enough. It will never be perfect.
+
+Concerning the CORE Project, WEIBEL observed that Bellcore is taking the
+topography files, extracting the page images, and converting those
+topography files to SGML markup. LESK hands that data off to OCLC, which
+builds that data into a Newton database, the same system that underlies
+the on-line system in virtually all of the reference products at OCLC.
+The long-term goal is to make the systems interoperable so that not just
+Bellcore's system and OCLC's system can access this data, but other
+systems can as well, and the key to that is the Z39.50 common command
+language and the full-text extension. Z39.50 is fine for MARC records,
+but is not enough to do it for full text (that is, make full texts
+interoperable).
+
+WEIBEL next outlined the critical role of SGML for a variety of purposes,
+for example, as noted by HOCKEY, in the world of extremely large
+databases, using highly structured data to perform field searches.
+WEIBEL argued that by building the structure of the data in (i.e., the
+structure of the data originally on a printed page), it becomes easy to
+look at a journal article even if one cannot read the characters and know
+where the title or author is, or what the sections of that document would be.
+OCLC wants to make that structure explicit in the database, because it will
+be important for retrieval purposes.
+
+The second big advantage of SGML is that it gives one the ability to
+build structure into the database that can be used for display purposes
+without contaminating the data with instructions about how to format
+things. The distinction lies between procedural markup, which tells one
+where to put dots on the page, and descriptive markup, which describes
+the elements of a document.
+
+WEIBEL believes that there should be no procedural markup in the data at
+all, that the data should be completely unsullied by information about
+italics or boldness. That should be left up to the display device,
+whether that display device is a page printer or a screen display device.
+By keeping one's database free of that kind of contamination, one can
+make decisions down the road, for example, reorganize the data in ways
+that are not cramped by built-in notions of what should be italic and
+what should be bold. WEIBEL strongly advocated descriptive markup. As
+an example, he illustrated the index structure in the CORE data. With
+subsequent illustrated examples of markup, WEIBEL acknowledged the common
+complaint that SGML is hard to read in its native form, although markup
+decreases considerably once one gets into the body. Without the markup,
+however, one would not have the structure in the data. One can pass
+markup through a LaTeX processor and convert it relatively easily to a
+printed version of the document.
+
+WEIBEL next illustrated an extremely cluttered screen dump of OCLC's
+system, in order to show as much as possible the inherent capability on
+the screen. (He noted parenthetically that he had become a supporter of
+X-Windows as a result of the progress of the CORE Project.) WEIBEL also
+illustrated the two major parts of the interface: l) a control box that
+allows one to generate lists of items, which resembles a small table of
+contents based on key words one wishes to search, and 2) a document
+viewer, which is a separate process in and of itself. He demonstrated
+how to follow links through the electronic database simply by selecting
+the appropriate button and bringing them up. He also noted problems that
+remain to be accommodated in the interface (e.g., as pointed out by LESK,
+what happens when users do not click on the icon for the figure).
+
+Given the constraints of time, WEIBEL omitted a large number of ancillary
+items in order to say a few words concerning storage requirements and
+what will be required to put a lot of things on line. Since it is
+extremely expensive to reconvert all of this data, especially if it is
+just in paper form (and even if it is in electronic form in typesetting
+tapes), he advocated building journals electronically from the start. In
+that case, if one only has text graphics and indexing (which is all that
+one needs with de novo electronic publishing, because there is no need to
+go back and look at bit-maps of pages), one can get 10,000 journals of
+full text, or almost 6 million pages per year. These pages can be put in
+approximately 135 gigabytes of storage, which is not all that much,
+WEIBEL said. For twenty years, something less than three terabytes would
+be required. WEIBEL calculated the costs of storing this information as
+follows: If a gigabyte costs approximately $1,000, then a terabyte costs
+approximately $1 million to buy in terms of hardware. One also needs a
+building to put it in and a staff like OCLC to handle that information.
+So, to support a terabyte, multiply by five, which gives $5 million per
+year for a supported terabyte of data.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Tapes saved by ACS are the typography files originally
+supporting publication of the journal * Cost of building tagged text into
+the database *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+During the question-and-answer period that followed WEIBEL's
+presentation, these clarifications emerged. The tapes saved by the
+American Chemical Society are the typography files that originally
+supported the publication of the journal. Although they are not tagged
+in SGML, they are tagged in very fine detail. Every single sentence is
+marked, all the registry numbers, all the publications issues, dates, and
+volumes. No cost figures on tagging material on a per-megabyte basis
+were available. Because ACS's typesetting system runs from tagged text,
+there is no extra cost per article. It was unknown what it costs ACS to
+keyboard the tagged text rather than just keyboard the text in the
+cheapest process. In other words, since one intends to publish things
+and will need to build tagged text into a typography system in any case,
+if one does that in such a way that it can drive not only typography but
+an electronic system (which is what ACS intends to do--move to SGML
+publishing), the marginal cost is zero. The marginal cost represents the
+cost of building tagged text into the database, which is small.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+SPERBERG-McQUEEN * Distinction between texts and computers * Implications
+of recognizing that all representation is encoding * Dealing with
+complicated representations of text entails the need for a grammar of
+documents * Variety of forms of formal grammars * Text as a bit-mapped
+image does not represent a serious attempt to represent text in
+electronic form * SGML, the TEI, document-type declarations, and the
+reusability and longevity of data * TEI conformance explicitly allows
+extension or modification of the TEI tag set * Administrative background
+of the TEI * Several design goals for the TEI tag set * An absolutely
+fixed requirement of the TEI Guidelines * Challenges the TEI has
+attempted to face * Good texts not beyond economic feasibility * The
+issue of reproducibility or processability * The issue of mages as
+simulacra for the text redux * One's model of text determines what one's
+software can do with a text and has economic consequences *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Prior to speaking about SGML and markup, Michael SPERBERG-McQUEEN, editor,
+Text Encoding Initiative (TEI), University of Illinois-Chicago, first drew
+a distinction between texts and computers: Texts are abstract cultural
+and linguistic objects while computers are complicated physical devices,
+he said. Abstract objects cannot be placed inside physical devices; with
+computers one can only represent text and act upon those representations.
+
+The recognition that all representation is encoding, SPERBERG-McQUEEN
+argued, leads to the recognition of two things: 1) The topic description
+for this session is slightly misleading, because there can be no discussion
+of pros and cons of text-coding unless what one means is pros and cons of
+working with text with computers. 2) No text can be represented in a
+computer without some sort of encoding; images are one way of encoding text,
+ASCII is another, SGML yet another. There is no encoding without some
+information loss, that is, there is no perfect reproduction of a text that
+allows one to do away with the original. Thus, the question becomes,
+What is the most useful representation of text for a serious work?
+This depends on what kind of serious work one is talking about.
+
+The projects demonstrated the previous day all involved highly complex
+information and fairly complex manipulation of the textual material.
+In order to use that complicated information, one has to calculate it
+slowly or manually and store the result. It needs to be stored, therefore,
+as part of one's representation of the text. Thus, one needs to store the
+structure in the text. To deal with complicated representations of text,
+one needs somehow to control the complexity of the representation of a text;
+that means one needs a way of finding out whether a document and an
+electronic representation of a document is legal or not; and that
+means one needs a grammar of documents.
+
+SPERBERG-McQUEEN discussed the variety of forms of formal grammars,
+implicit and explicit, as applied to text, and their capabilities. He
+argued that these grammars correspond to different models of text that
+different developers have. For example, one implicit model of the text
+is that there is no internal structure, but just one thing after another,
+a few characters and then perhaps a start-title command, and then a few
+more characters and an end-title command. SPERBERG-McQUEEN also
+distinguished several kinds of text that have a sort of hierarchical
+structure that is not very well defined, which, typically, corresponds
+to grammars that are not very well defined, as well as hierarchies that
+are very well defined (e.g., the Thesaurus Linguae Graecae) and extremely
+complicated things such as SGML, which handle strictly hierarchical data
+very nicely.
+
+SPERBERG-McQUEEN conceded that one other model not illustrated on his two
+displays was the model of text as a bit-mapped image, an image of a page,
+and confessed to having been converted to a limited extent by the
+Workshop to the view that electronic images constitute a promising,
+probably superior alternative to microfilming. But he was not convinced
+that electronic images represent a serious attempt to represent text in
+electronic form. Many of their problems stem from the fact that they are
+not direct attempts to represent the text but attempts to represent the
+page, thus making them representations of representations.
+
+In this situation of increasingly complicated textual information and the
+need to control that complexity in a useful way (which begs the question
+of the need for good textual grammars), one has the introduction of SGML.
+With SGML, one can develop specific document-type declarations
+for specific text types or, as with the TEI, attempts to generate
+general document-type declarations that can handle all sorts of text.
+The TEI is an attempt to develop formats for text representation that
+will ensure the kind of reusability and longevity of data discussed earlier.
+It offers a way to stay alive in the state of permanent technological
+revolution.
+
+It has been a continuing challenge in the TEI to create document grammars
+that do some work in controlling the complexity of the textual object but
+also allowing one to represent the real text that one will find.
+Fundamental to the notion of the TEI is that TEI conformance allows one
+the ability to extend or modify the TEI tag set so that it fits the text
+that one is attempting to represent.
+
+SPERBERG-McQUEEN next outlined the administrative background of the TEI.
+The TEI is an international project to develop and disseminate guidelines
+for the encoding and interchange of machine-readable text. It is
+sponsored by the Association for Computers in the Humanities, the
+Association for Computational Linguistics, and the Association for
+Literary and Linguistic Computing. Representatives of numerous other
+professional societies sit on its advisory board. The TEI has a number
+of affiliated projects that have provided assistance by testing drafts of
+the guidelines.
+
+Among the design goals for the TEI tag set, the scheme first of all must
+meet the needs of research, because the TEI came out of the research
+community, which did not feel adequately served by existing tag sets.
+The tag set must be extensive as well as compatible with existing and
+emerging standards. In 1990, version 1.0 of the Guidelines was released
+(SPERBERG-McQUEEN illustrated their contents).
+
+SPERBERG-McQUEEN noted that one problem besetting electronic text has
+been the lack of adequate internal or external documentation for many
+existing electronic texts. The TEI guidelines as currently formulated
+contain few fixed requirements, but one of them is this: There must
+always be a document header, an in-file SGML tag that provides
+1) a bibliographic description of the electronic object one is talking
+about (that is, who included it, when, what for, and under which title);
+and 2) the copy text from which it was derived, if any. If there was
+no copy text or if the copy text is unknown, then one states as much.
+Version 2.0 of the Guidelines was scheduled to be completed in fall 1992
+and a revised third version is to be presented to the TEI advisory board
+for its endorsement this coming winter. The TEI itself exists to provide
+a markup language, not a marked-up text.
+
+Among the challenges the TEI has attempted to face is the need for a
+markup language that will work for existing projects, that is, handle the
+level of markup that people are using now to tag only chapter, section,
+and paragraph divisions and not much else. At the same time, such a
+language also will be able to scale up gracefully to handle the highly
+detailed markup which many people foresee as the future destination of
+much electronic text, and which is not the future destination but the
+present home of numerous electronic texts in specialized areas.
+
+SPERBERG-McQUEEN dismissed the lowest-common-denominator approach as
+unable to support the kind of applications that draw people who have
+never been in the public library regularly before, and make them come
+back. He advocated more interesting text and more intelligent text.
+Asserting that it is not beyond economic feasibility to have good texts,
+SPERBERG-McQUEEN noted that the TEI Guidelines listing 200-odd tags
+contains tags that one is expected to enter every time the relevant
+textual feature occurs. It contains all the tags that people need now,
+and it is not expected that everyone will tag things in the same way.
+
+The question of how people will tag the text is in large part a function
+of their reaction to what SPERBERG-McQUEEN termed the issue of
+reproducibility. What one needs to be able to reproduce are the things
+one wants to work with. Perhaps a more useful concept than that of
+reproducibility or recoverability is that of processability, that is,
+what can one get from an electronic text without reading it again
+in the original. He illustrated this contention with a page from
+Jan Comenius's bilingual Introduction to Latin.
+
+SPERBERG-McQUEEN returned at length to the issue of images as simulacra
+for the text, in order to reiterate his belief that in the long run more
+than images of pages of particular editions of the text are needed,
+because just as second-generation photocopies and second-generation
+microfilm degenerate, so second-generation representations tend to
+degenerate, and one tends to overstress some relatively trivial aspects
+of the text such as its layout on the page, which is not always
+significant, despite what the text critics might say, and slight other
+pieces of information such as the very important lexical ties between the
+English and Latin versions of Comenius's bilingual text, for example.
+Moreover, in many crucial respects it is easy to fool oneself concerning
+what a scanned image of the text will accomplish. For example, in order
+to study the transmission of texts, information concerning the text
+carrier is necessary, which scanned images simply do not always handle.
+Further, even the high-quality materials being produced at Cornell use
+much of the information that one would need if studying those books as
+physical objects. It is a choice that has been made. It is an arguably
+justifiable choice, but one does not know what color those pen strokes in
+the margin are or whether there was a stain on the page, because it has
+been filtered out. One does not know whether there were rips in the page
+because they do not show up, and on a couple of the marginal marks one
+loses half of the mark because the pen is very light and the scanner
+failed to pick it up, and so what is clearly a checkmark in the margin of
+the original becomes a little scoop in the margin of the facsimile.
+Standard problems for facsimile editions, not new to electronics, but
+also true of light-lens photography, and are remarked here because it is
+important that we not fool ourselves that even if we produce a very nice
+image of this page with good contrast, we are not replacing the
+manuscript any more than microfilm has replaced the manuscript.
+
+The TEI comes from the research community, where its first allegiance
+lies, but it is not just an academic exercise. It has relevance far
+beyond those who spend all of their time studying text, because one's
+model of text determines what one's software can do with a text. Good
+models lead to good software. Bad models lead to bad software. That has
+economic consequences, and it is these economic consequences that have
+led the European Community to help support the TEI, and that will lead,
+SPERBERG-McQUEEN hoped, some software vendors to realize that if they
+provide software with a better model of the text they can make a killing.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Implications of different DTDs and tag sets * ODA versus SGML *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+During the discussion that followed, several additional points were made.
+Neither AAP (i.e., Association of American Publishers) nor CALS (i.e.,
+Computer-aided Acquisition and Logistics Support) has a document-type
+definition for ancient Greek drama, although the TEI will be able to
+handle that. Given this state of affairs and assuming that the
+technical-journal producers and the commercial vendors decide to use the
+other two types, then an institution like the Library of Congress, which
+might receive all of their publications, would have to be able to handle
+three different types of document definitions and tag sets and be able to
+distinguish among them.
+
+Office Document Architecture (ODA) has some advantages that flow from its
+tight focus on office documents and clear directions for implementation.
+Much of the ODA standard is easier to read and clearer at first reading
+than the SGML standard, which is extremely general. What that means is
+that if one wants to use graphics in TIFF and ODA, one is stuck, because
+ODA defines graphics formats while TIFF does not, whereas SGML says the
+world is not waiting for this work group to create another graphics format.
+What is needed is an ability to use whatever graphics format one wants.
+
+The TEI provides a socket that allows one to connect the SGML document to
+the graphics. The notation that the graphics are in is clearly a choice
+that one needs to make based on her or his environment, and that is one
+advantage. SGML is less megalomaniacal in attempting to define formats
+for all kinds of information, though more megalomaniacal in attempting to
+cover all sorts of documents. The other advantage is that the model of
+text represented by SGML is simply an order of magnitude richer and more
+flexible than the model of text offered by ODA. Both offer hierarchical
+structures, but SGML recognizes that the hierarchical model of the text
+that one is looking at may not have been in the minds of the designers,
+whereas ODA does not.
+
+ODA is not really aiming for the kind of document that the TEI wants to
+encompass. The TEI can handle the kind of material ODA has, as well as a
+significantly broader range of material. ODA seems to be very much
+focused on office documents, which is what it started out being called--
+office document architecture.
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+CALALUCA * Text-encoding from a publisher's perspective *
+Responsibilities of a publisher * Reproduction of Migne's Latin series
+whole and complete with SGML tags based on perceived need and expected
+use * Particular decisions arising from the general decision to produce
+and publish PLD *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+The final speaker in this session, Eric CALALUCA, vice president,
+Chadwyck-Healey, Inc., spoke from the perspective of a publisher re
+text-encoding, rather than as one qualified to discuss methods of
+encoding data, and observed that the presenters sitting in the room,
+whether they had chosen to or not, were acting as publishers: making
+choices, gathering data, gathering information, and making assessments.
+CALALUCA offered the hard-won conviction that in publishing very large
+text files (such as PLD), one cannot avoid making personal judgments of
+appropriateness and structure.
+
+In CALALUCA's view, encoding decisions stem from prior judgments. Two
+notions have become axioms for him in the consideration of future sources
+for electronic publication: 1) electronic text publishing is as personal
+as any other kind of publishing, and questions of if and how to encode
+the data are simply a consequence of that prior decision; 2) all
+personal decisions are open to criticism, which is unavoidable.
+
+CALALUCA rehearsed his role as a publisher or, better, as an intermediary
+between what is viewed as a sound idea and the people who would make use
+of it. Finding the specialist to advise in this process is the core of
+that function. The publisher must monitor and hug the fine line between
+giving users what they want and suggesting what they might need. One
+responsibility of a publisher is to represent the desires of scholars and
+research librarians as opposed to bullheadedly forcing them into areas
+they would not choose to enter.
+
+CALALUCA likened the questions being raised today about data structure
+and standards to the decisions faced by the Abbe Migne himself during
+production of the Patrologia series in the mid-nineteenth century.
+Chadwyck-Healey's decision to reproduce Migne's Latin series whole and
+complete with SGML tags was also based upon a perceived need and an
+expected use. In the same way that Migne's work came to be far more than
+a simple handbook for clerics, PLD is already far more than a database
+for theologians. It is a bedrock source for the study of Western
+civilization, CALALUCA asserted.
+
+In regard to the decision to produce and publish PLD, the editorial board
+offered direct judgments on the question of appropriateness of these
+texts for conversion, their encoding and their distribution, and
+concluded that the best possible project was one that avoided overt
+intrusions or exclusions in so important a resource. Thus, the general
+decision to transmit the original collection as clearly as possible with
+the widest possible avenues for use led to other decisions: 1) To encode
+the data or not, SGML or not, TEI or not. Again, the expected user
+community asserted the need for normative tagging structures of important
+humanities texts, and the TEI seemed the most appropriate structure for
+that purpose. Research librarians, who are trained to view the larger
+impact of electronic text sources on 80 or 90 or 100 doctoral
+disciplines, loudly approved the decision to include tagging. They see
+what is coming better than the specialist who is completely focused on
+one edition of Ambrose's De Anima, and they also understand that the
+potential uses exceed present expectations. 2) What will be tagged and
+what will not. Once again, the board realized that one must tag the
+obvious. But in no way should one attempt to identify through encoding
+schemes every single discrete area of a text that might someday be
+searched. That was another decision. Searching by a column number, an
+author, a word, a volume, permitting combination searches, and tagging
+notations seemed logical choices as core elements. 3) How does one make
+the data available? Tieing it to a CD-ROM edition creates limitations,
+but a magnetic tape file that is very large, is accompanied by the
+encoding specifications, and that allows one to make local modifications
+also allows one to incorporate any changes one may desire within the
+bounds of private research, though exporting tag files from a CD-ROM
+could serve just as well. Since no one on the board could possibly
+anticipate each and every way in which a scholar might choose to mine
+this data bank, it was decided to satisfy the basics and make some
+provisions for what might come. 4) Not to encode the database would rob
+it of the interchangeability and portability these important texts should
+accommodate. For CALALUCA, the extensive options presented by full-text
+searching require care in text selection and strongly support encoding of
+data to facilitate the widest possible search strategies. Better
+software can always be created, but summoning the resources, the people,
+and the energy to reconvert the text is another matter.
+
+PLD is being encoded, captured, and distributed, because to
+Chadwyck-Healey and the board it offers the widest possible array of
+future research applications that can be seen today. CALALUCA concluded
+by urging the encoding of all important text sources in whatever way
+seems most appropriate and durable at the time, without blanching at the
+thought that one's work may require emendation in the future. (Thus,
+Chadwyck-Healey produced a very large humanities text database before the
+final release of the TEI Guidelines.)
+
+ ******
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+DISCUSSION * Creating texts with markup advocated * Trends in encoding *
+The TEI and the issue of interchangeability of standards * A
+misconception concerning the TEI * Implications for an institution like
+LC in the event that a multiplicity of DTDs develops * Producing images
+as a first step towards possible conversion to full text through
+character recognition * The AAP tag sets as a common starting point and
+the need for caution *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+HOCKEY prefaced the discussion that followed with several comments in
+favor of creating texts with markup and on trends in encoding. In the
+future, when many more texts are available for on-line searching, real
+problems in finding what is wanted will develop, if one is faced with
+millions of words of data. It therefore becomes important to consider
+putting markup in texts to help searchers home in on the actual things
+they wish to retrieve. Various approaches to refining retrieval methods
+toward this end include building on a computer version of a dictionary
+and letting the computer look up words in it to obtain more information
+about the semantic structure or semantic field of a word, its grammatical
+structure, and syntactic structure.
+
+HOCKEY commented on the present keen interest in the encoding world
+in creating: 1) machine-readable versions of dictionaries that can be
+initially tagged in SGML, which gives a structure to the dictionary entry;
+these entries can then be converted into a more rigid or otherwise
+different database structure inside the computer, which can be treated as
+a dynamic tool for searching mechanisms; 2) large bodies of text to study
+the language. In order to incorporate more sophisticated mechanisms,
+more about how words behave needs to be known, which can be learned in
+part from information in dictionaries. However, the last ten years have
+seen much interest in studying the structure of printed dictionaries
+converted into computer-readable form. The information one derives about
+many words from those is only partial, one or two definitions of the
+common or the usual meaning of a word, and then numerous definitions of
+unusual usages. If the computer is using a dictionary to help retrieve
+words in a text, it needs much more information about the common usages,
+because those are the ones that occur over and over again. Hence the
+current interest in developing large bodies of text in computer-readable
+form in order to study the language. Several projects are engaged in
+compiling, for example, 100 million words. HOCKEY described one with
+which she was associated briefly at Oxford University involving
+compilation of 100 million words of British English: about 10 percent of
+that will contain detailed linguistic tagging encoded in SGML; it will
+have word class taggings, with words identified as nouns, verbs,
+adjectives, or other parts of speech. This tagging can then be used by
+programs which will begin to learn a bit more about the structure of the
+language, and then, can go to tag more text.
+
+HOCKEY said that the more that is tagged accurately, the more one can
+refine the tagging process and thus the bigger body of text one can build
+up with linguistic tagging incorporated into it. Hence, the more tagging
+or annotation there is in the text, the more one may begin to learn about
+language and the more it will help accomplish more intelligent OCR. She
+recommended the development of software tools that will help one begin to
+understand more about a text, which can then be applied to scanning
+images of that text in that format and to using more intelligence to help
+one interpret or understand the text.
+
+HOCKEY posited the need to think about common methods of text-encoding
+for a long time to come, because building these large bodies of text is
+extremely expensive and will only be done once.
+
+In the more general discussion on approaches to encoding that followed,
+these points were made:
+
+BESSER identified the underlying problem with standards that all have to
+struggle with in adopting a standard, namely, the tension between a very
+highly defined standard that is very interchangeable but does not work
+for everyone because something is lacking, and a standard that is less
+defined, more open, more adaptable, but less interchangeable. Contending
+that the way in which people use SGML is not sufficiently defined, BESSER
+wondered 1) if people resist the TEI because they think it is too defined
+in certain things they do not fit into, and 2) how progress with
+interchangeability can be made without frightening people away.
+
+SPERBERG-McQUEEN replied that the published drafts of the TEI had met
+with surprisingly little objection on the grounds that they do not allow
+one to handle X or Y or Z. Particular concerns of the affiliated
+projects have led, in practice, to discussions of how extensions are to
+be made; the primary concern of any project has to be how it can be
+represented locally, thus making interchange secondary. The TEI has
+received much criticism based on the notion that everything in it is
+required or even recommended, which, as it happens, is a misconception
+from the beginning, because none of it is required and very little is
+actually actively recommended for all cases, except that one document
+one's source.
+
+SPERBERG-McQUEEN agreed with BESSER about this trade-off: all the
+projects in a set of twenty TEI-conformant projects will not necessarily
+tag the material in the same way. One result of the TEI will be that the
+easiest problems will be solved--those dealing with the external form of
+the information; but the problem that is hardest in interchange is that
+one is not encoding what another wants, and vice versa. Thus, after
+the adoption of a common notation, the differences in the underlying
+conceptions of what is interesting about texts become more visible.
+The success of a standard like the TEI will lie in the ability of
+the recipient of interchanged texts to use some of what it contains
+and to add the information that was not encoded that one wants, in a
+layered way, so that texts can be gradually enriched and one does not
+have to put in everything all at once. Hence, having a well-behaved
+markup scheme is important.
+
+STEVENS followed up on the paradoxical analogy that BESSER alluded to in
+the example of the MARC records, namely, the formats that are the same
+except that they are different. STEVENS drew a parallel between
+document-type definitions and MARC records for books and serials and maps,
+where one has a tagging structure and there is a text-interchange.
+STEVENS opined that the producers of the information will set the terms
+for the standard (i.e., develop document-type definitions for the users
+of their products), creating a situation that will be problematical for
+an institution like the Library of Congress, which will have to deal with
+the DTDs in the event that a multiplicity of them develops. Thus,
+numerous people are seeking a standard but cannot find the tag set that
+will be acceptable to them and their clients. SPERBERG-McQUEEN agreed
+with this view, and said that the situation was in a way worse: attempting
+to unify arbitrary DTDs resembled attempting to unify a MARC record with a
+bibliographic record done according to the Prussian instructions.
+According to STEVENS, this situation occurred very early in the process.
+
+WATERS recalled from early discussions on Project Open Book the concern
+of many people that merely by producing images, POB was not really
+enhancing intellectual access to the material. Nevertheless, not wishing
+to overemphasize the opposition between imaging and full text, WATERS
+stated that POB views getting the images as a first step toward possibly
+converting to full text through character recognition, if the technology
+is appropriate. WATERS also emphasized that encoding is involved even
+with a set of images.
+
+SPERBERG-McQUEEN agreed with WATERS that one can create an SGML document
+consisting wholly of images. At first sight, organizing graphic images
+with an SGML document may not seem to offer great advantages, but the
+advantages of the scheme WATERS described would be precisely that
+ability to move into something that is more of a multimedia document:
+a combination of transcribed text and page images. WEIBEL concurred in
+this judgment, offering evidence from Project ADAPT, where a page is
+divided into text elements and graphic elements, and in fact the text
+elements are organized by columns and lines. These lines may be used as
+the basis for distributing documents in a network environment. As one
+develops software intelligent enough to recognize what those elements
+are, it makes sense to apply SGML to an image initially, that may, in
+fact, ultimately become more and more text, either through OCR or edited
+OCR or even just through keying. For WATERS, the labor of composing the
+document and saying this set of documents or this set of images belongs
+to this document constitutes a significant investment.
+
+WEIBEL also made the point that the AAP tag sets, while not excessively
+prescriptive, offer a common starting point; they do not define the
+structure of the documents, though. They have some recommendations about
+DTDs one could use as examples, but they do just suggest tag sets. For
+example, the CORE project attempts to use the AAP markup as much as
+possible, but there are clearly areas where structure must be added.
+That in no way contradicts the use of AAP tag sets.
+
+SPERBERG-McQUEEN noted that the TEI prepared a long working paper early
+on about the AAP tag set and what it lacked that the TEI thought it
+needed, and a fairly long critique of the naming conventions, which has
+led to a very different style of naming in the TEI. He stressed the
+importance of the opposition between prescriptive markup, the kind that a
+publisher or anybody can do when producing documents de novo, and
+descriptive markup, in which one has to take what the text carrier
+provides. In these particular tag sets it is easy to overemphasize this
+opposition, because the AAP tag set is extremely flexible. Even if one
+just used the DTDs, they allow almost anything to appear almost anywhere.
+
+ ******
+
+SESSION VI. COPYRIGHT ISSUES
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+PETERS * Several cautions concerning copyright in an electronic
+environment * Review of copyright law in the United States * The notion
+of the public good and the desirability of incentives to promote it *
+What copyright protects * Works not protected by copyright * The rights
+of copyright holders * Publishers' concerns in today's electronic
+environment * Compulsory licenses * The price of copyright in a digital
+medium and the need for cooperation * Additional clarifications * Rough
+justice oftentimes the outcome in numerous copyright matters * Copyright
+in an electronic society * Copyright law always only sets up the
+boundaries; anything can be changed by contract *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Marybeth PETERS, policy planning adviser to the Register of Copyrights,
+Library of Congress, made several general comments and then opened the
+floor to discussion of subjects of interest to the audience.
+
+Having attended several sessions in an effort to gain a sense of what
+people did and where copyright would affect their lives, PETERS expressed
+the following cautions:
+
+ * If one takes and converts materials and puts them in new forms,
+ then, from a copyright point of view, one is creating something and
+ will receive some rights.
+
+ * However, if what one is converting already exists, a question
+ immediately arises about the status of the materials in question.
+
+ * Putting something in the public domain in the United States offers
+ some freedom from anxiety, but distributing it throughout the world
+ on a network is another matter, even if one has put it in the public
+ domain in the United States. Re foreign laws, very frequently a
+ work can be in the public domain in the United States but protected
+ in other countries. Thus, one must consider all of the places a
+ work may reach, lest one unwittingly become liable to being faced
+ with a suit for copyright infringement, or at least a letter
+ demanding discussion of what one is doing.
+
+PETERS reviewed copyright law in the United States. The U.S.
+Constitution effectively states that Congress has the power to enact
+copyright laws for two purposes: 1) to encourage the creation and
+dissemination of intellectual works for the good of society as a whole;
+and, significantly, 2) to give creators and those who package and
+disseminate materials the economic rewards that are due them.
+
+Congress strives to strike a balance, which at times can become an
+emotional issue. The United States has never accepted the notion of the
+natural right of an author so much as it has accepted the notion of the
+public good and the desirability of incentives to promote it. This state
+of affairs, however, has created strains on the international level and
+is the reason for several of the differences in the laws that we have.
+Today the United States protects almost every kind of work that can be
+called an expression of an author. The standard for gaining copyright
+protection is simply originality. This is a low standard and means that
+a work is not copied from something else, as well as shows a certain
+minimal amount of authorship. One can also acquire copyright protection
+for making a new version of preexisting material, provided it manifests
+some spark of creativity.
+
+However, copyright does not protect ideas, methods, systems--only the way
+that one expresses those things. Nor does copyright protect anything
+that is mechanical, anything that does not involve choice, or criteria
+concerning whether or not one should do a thing. For example, the
+results of a process called declicking, in which one mechanically removes
+impure sounds from old recordings, are not copyrightable. On the other
+hand, the choice to record a song digitally and to increase the sound of
+violins or to bring up the tympani constitutes the results of conversion
+that are copyrightable. Moreover, if a work is protected by copyright in
+the United States, one generally needs the permission of the copyright
+owner to convert it. Normally, who will own the new--that is, converted-
+-material is a matter of contract. In the absence of a contract, the
+person who creates the new material is the author and owner. But people
+do not generally think about the copyright implications until after the
+fact. PETERS stressed the need when dealing with copyrighted works to
+think about copyright in advance. One's bargaining power is much greater
+up front than it is down the road.
+
+PETERS next discussed works not protected by copyright, for example, any
+work done by a federal employee as part of his or her official duties is
+in the public domain in the United States. The issue is not wholly free
+of doubt concerning whether or not the work is in the public domain
+outside the United States. Other materials in the public domain include:
+any works published more than seventy-five years ago, and any work
+published in the United States more than twenty-eight years ago, whose
+copyright was not renewed. In talking about the new technology and
+putting material in a digital form to send all over the world, PETERS
+cautioned, one must keep in mind that while the rights may not be an
+issue in the United States, they may be in different parts of the world,
+where most countries previously employed a copyright term of the life of
+the author plus fifty years.
+
+PETERS next reviewed the economics of copyright holding. Simply,
+economic rights are the rights to control the reproduction of a work in
+any form. They belong to the author, or in the case of a work made for
+hire, the employer. The second right, which is critical to conversion,
+is the right to change a work. The right to make new versions is perhaps
+one of the most significant rights of authors, particularly in an
+electronic world. The third right is the right to publish the work and
+the right to disseminate it, something that everyone who deals in an
+electronic medium needs to know. The basic rule is if a copy is sold,
+all rights of distribution are extinguished with the sale of that copy.
+The key is that it must be sold. A number of companies overcome this
+obstacle by leasing or renting their product. These companies argue that
+if the material is rented or leased and not sold, they control the uses
+of a work. The fourth right, and one very important in a digital world,
+is a right of public performance, which means the right to show the work
+sequentially. For example, copyright owners control the showing of a
+CD-ROM product in a public place such as a public library. The reverse
+side of public performance is something called the right of public
+display. Moral rights also exist, which at the federal level apply only
+to very limited visual works of art, but in theory may apply under
+contract and other principles. Moral rights may include the right of an
+author to have his or her name on a work, the right of attribution, and
+the right to object to distortion or mutilation--the right of integrity.
+
+The way copyright law is worded gives much latitude to activities such as
+preservation; to use of material for scholarly and research purposes when
+the user does not make multiple copies; and to the generation of
+facsimile copies of unpublished works by libraries for themselves and
+other libraries. But the law does not allow anyone to become the
+distributor of the product for the entire world. In today's electronic
+environment, publishers are extremely concerned that the entire world is
+networked and can obtain the information desired from a single copy in a
+single library. Hence, if there is to be only one sale, which publishers
+may choose to live with, they will obtain their money in other ways, for
+example, from access and use. Hence, the development of site licenses
+and other kinds of agreements to cover what publishers believe they
+should be compensated for. Any solution that the United States takes
+today has to consider the international arena.
+
+Noting that the United States is a member of the Berne Convention and
+subscribes to its provisions, PETERS described the permissions process.
+She also defined compulsory licenses. A compulsory license, of which the
+United States has had a few, builds into the law the right to use a work
+subject to certain terms and conditions. In the international arena,
+however, the ability to use compulsory licenses is extremely limited.
+Thus, clearinghouses and other collectives comprise one option that has
+succeeded in providing for use of a work. Often overlooked when one
+begins to use copyrighted material and put products together is how
+expensive the permissions process and managing it is. According to
+PETERS, the price of copyright in a digital medium, whatever solution is
+worked out, will include managing and assembling the database. She
+strongly recommended that publishers and librarians or people with
+various backgrounds cooperate to work out administratively feasible
+systems, in order to produce better results.
+
+In the lengthy question-and-answer period that followed PETERS's
+presentation, the following points emerged:
+
+ * The Copyright Office maintains that anything mechanical and
+ totally exhaustive probably is not protected. In the event that
+ what an individual did in developing potentially copyrightable
+ material is not understood, the Copyright Office will ask about the
+ creative choices the applicant chose to make or not to make. As a
+ practical matter, if one believes she or he has made enough of those
+ choices, that person has a right to assert a copyright and someone
+ else must assert that the work is not copyrightable. The more
+ mechanical, the more automatic, a thing is, the less likely it is to
+ be copyrightable.
+
+ * Nearly all photographs are deemed to be copyrightable, but no one
+ worries about them much, because everyone is free to take the same
+ image. Thus, a photographic copyright represents what is called a
+ "thin" copyright. The photograph itself must be duplicated, in
+ order for copyright to be violated.
+
+ * The Copyright Office takes the position that X-rays are not
+ copyrightable because they are mechanical. It can be argued
+ whether or not image enhancement in scanning can be protected. One
+ must exercise care with material created with public funds and
+ generally in the public domain. An article written by a federal
+ employee, if written as part of official duties, is not
+ copyrightable. However, control over a scientific article written
+ by a National Institutes of Health grantee (i.e., someone who
+ receives money from the U.S. government), depends on NIH policy. If
+ the government agency has no policy (and that policy can be
+ contained in its regulations, the contract, or the grant), the
+ author retains copyright. If a provision of the contract, grant, or
+ regulation states that there will be no copyright, then it does not
+ exist. When a work is created, copyright automatically comes into
+ existence unless something exists that says it does not.
+
+ * An enhanced electronic copy of a print copy of an older reference
+ work in the public domain that does not contain copyrightable new
+ material is a purely mechanical rendition of the original work, and
+ is not copyrightable.
+
+ * Usually, when a work enters the public domain, nothing can remove
+ it. For example, Congress recently passed into law the concept of
+ automatic renewal, which means that copyright on any work published
+ between l964 and l978 does not have to be renewed in order to
+ receive a seventy-five-year term. But any work not renewed before
+ 1964 is in the public domain.
+
+ * Concerning whether or not the United States keeps track of when
+ authors die, nothing was ever done, nor is anything being done at
+ the moment by the Copyright Office.
+
+ * Software that drives a mechanical process is itself copyrightable.
+ If one changes platforms, the software itself has a copyright. The
+ World Intellectual Property Organization will hold a symposium 28
+ March through 2 April l993, at Harvard University, on digital
+ technology, and will study this entire issue. If one purchases a
+ computer software package, such as MacPaint, and creates something
+ new, one receives protection only for that which has been added.
+
+PETERS added that often in copyright matters, rough justice is the
+outcome, for example, in collective licensing, ASCAP (i.e., American
+Society of Composers, Authors, and Publishers), and BMI (i.e., Broadcast
+Music, Inc.), where it may seem that the big guys receive more than their
+due. Of course, people ought not to copy a creative product without
+paying for it; there should be some compensation. But the truth of the
+world, and it is not a great truth, is that the big guy gets played on
+the radio more frequently than the little guy, who has to do much more
+until he becomes a big guy. That is true of every author, every
+composer, everyone, and, unfortunately, is part of life.
+
+Copyright always originates with the author, except in cases of works
+made for hire. (Most software falls into this category.) When an author
+sends his article to a journal, he has not relinquished copyright, though
+he retains the right to relinquish it. The author receives absolutely
+everything. The less prominent the author, the more leverage the
+publisher will have in contract negotiations. In order to transfer the
+rights, the author must sign an agreement giving them away.
+
+In an electronic society, it is important to be able to license a writer
+and work out deals. With regard to use of a work, it usually is much
+easier when a publisher holds the rights. In an electronic era, a real
+problem arises when one is digitizing and making information available.
+PETERS referred again to electronic licensing clearinghouses. Copyright
+ought to remain with the author, but as one moves forward globally in the
+electronic arena, a middleman who can handle the various rights becomes
+increasingly necessary.
+
+The notion of copyright law is that it resides with the individual, but
+in an on-line environment, where a work can be adapted and tinkered with
+by many individuals, there is concern. If changes are authorized and
+there is no agreement to the contrary, the person who changes a work owns
+the changes. To put it another way, the person who acquires permission
+to change a work technically will become the author and the owner, unless
+some agreement to the contrary has been made. It is typical for the
+original publisher to try to control all of the versions and all of the
+uses. Copyright law always only sets up the boundaries. Anything can be
+changed by contract.
+
+ ******
+
+SESSION VII. CONCLUSION
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+GENERAL DISCUSSION * Two questions for discussion * Different emphases in
+the Workshop * Bringing the text and image partisans together *
+Desiderata in planning the long-term development of something * Questions
+surrounding the issue of electronic deposit * Discussion of electronic
+deposit as an allusion to the issue of standards * Need for a directory
+of preservation projects in digital form and for access to their
+digitized files * CETH's catalogue of machine-readable texts in the
+humanities * What constitutes a publication in the electronic world? *
+Need for LC to deal with the concept of on-line publishing * LC's Network
+Development Office exploring the limits of MARC as a standard in terms
+of handling electronic information * Magnitude of the problem and the
+need for distributed responsibility in order to maintain and store
+electronic information * Workshop participants to be viewed as a starting
+point * Development of a network version of AM urged * A step toward AM's
+construction of some sort of apparatus for network access * A delicate
+and agonizing policy question for LC * Re the issue of electronic
+deposit, LC urged to initiate a catalytic process in terms of distributed
+responsibility * Suggestions for cooperative ventures * Commercial
+publishers' fears * Strategic questions for getting the image and text
+people to think through long-term cooperation * Clarification of the
+driving force behind both the Perseus and the Cornell Xerox projects *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+In his role as moderator of the concluding session, GIFFORD raised two
+questions he believed would benefit from discussion: 1) Are there enough
+commonalities among those of us that have been here for two days so that
+we can see courses of action that should be taken in the future? And, if
+so, what are they and who might take them? 2) Partly derivative from
+that, but obviously very dangerous to LC as host, do you see a role for
+the Library of Congress in all this? Of course, the Library of Congress
+holds a rather special status in a number of these matters, because it is
+not perceived as a player with an economic stake in them, but are there
+roles that LC can play that can help advance us toward where we are heading?
+
+Describing himself as an uninformed observer of the technicalities of the
+last two days, GIFFORD detected three different emphases in the Workshop:
+1) people who are very deeply committed to text; 2) people who are almost
+passionate about images; and 3) a few people who are very committed to
+what happens to the networks. In other words, the new networking
+dimension, the accessibility of the processability, the portability of
+all this across the networks. How do we pull those three together?
+
+Adding a question that reflected HOCKEY's comment that this was the
+fourth workshop she had attended in the previous thirty days, FLEISCHHAUER
+wondered to what extent this meeting had reinvented the wheel, or if it
+had contributed anything in the way of bringing together a different group
+of people from those who normally appear on the workshop circuit.
+
+HOCKEY confessed to being struck at this meeting and the one the
+Electronic Pierce Consortium organized the previous week that this was a
+coming together of people working on texts and not images. Attempting to
+bring the two together is something we ought to be thinking about for the
+future: How one can think about working with image material to begin
+with, but structuring it and digitizing it in such a way that at a later
+stage it can be interpreted into text, and find a common way of building
+text and images together so that they can be used jointly in the future,
+with the network support to begin there because that is how people will
+want to access it.
+
+In planning the long-term development of something, which is what is
+being done in electronic text, HOCKEY stressed the importance not only
+of discussing the technical aspects of how one does it but particularly
+of thinking about what the people who use the stuff will want to do.
+But conversely, there are numerous things that people start to do with
+electronic text or material that nobody ever thought of in the beginning.
+
+LESK, in response to the question concerning the role of the Library of
+Congress, remarked the often suggested desideratum of having electronic
+deposit: Since everything is now computer-typeset, an entire decade of
+material that was machine-readable exists, but the publishers frequently
+did not save it; has LC taken any action to have its copyright deposit
+operation start collecting these machine-readable versions? In the
+absence of PETERS, GIFFORD replied that the question was being
+actively considered but that that was only one dimension of the problem.
+Another dimension is the whole question of the integrity of the original
+electronic document. It becomes highly important in science to prove
+authorship. How will that be done?
+
+ERWAY explained that, under the old policy, to make a claim for a
+copyright for works that were published in electronic form, including
+software, one had to submit a paper copy of the first and last twenty
+pages of code--something that represented the work but did not include
+the entire work itself and had little value to anyone. As a temporary
+measure, LC has claimed the right to demand electronic versions of
+electronic publications. This measure entails a proactive role for the
+Library to say that it wants a particular electronic version. Publishers
+then have perhaps a year to submit it. But the real problem for LC is
+what to do with all this material in all these different formats. Will
+the Library mount it? How will it give people access to it? How does LC
+keep track of the appropriate computers, software, and media? The situation
+is so hard to control, ERWAY said, that it makes sense for each publishing
+house to maintain its own archive. But LC cannot enforce that either.
+
+GIFFORD acknowledged LESK's suggestion that establishing a priority
+offered the solution, albeit a fairly complicated one. But who maintains
+that register?, he asked. GRABER noted that LC does attempt to collect a
+Macintosh version and the IBM-compatible version of software. It does
+not collect other versions. But while true for software, BYRUM observed,
+this reply does not speak to materials, that is, all the materials that
+were published that were on somebody's microcomputer or driver tapes
+at a publishing office across the country. LC does well to acquire
+specific machine-readable products selectively that were intended to be
+machine-readable. Materials that were in machine-readable form at one time,
+BYRUM said, would be beyond LC's capability at the moment, insofar as
+attempting to acquire, organize, and preserve them are concerned--and
+preservation would be the most important consideration. In this
+connection, GIFFORD reiterated the need to work out some sense of
+distributive responsibility for a number of these issues, which
+inevitably will require significant cooperation and discussion.
+Nobody can do it all.
+
+LESK suggested that some publishers may look with favor on LC beginning
+to serve as a depository of tapes in an electronic manuscript standard.
+Publishers may view this as a service that they did not have to perform
+and they might send in tapes. However, SPERBERG-McQUEEN countered,
+although publishers have had equivalent services available to them for a
+long time, the electronic text archive has never turned away or been
+flooded with tapes and is forever sending feedback to the depositor.
+Some publishers do send in tapes.
+
+ANDRE viewed this discussion as an allusion to the issue of standards.
+She recommended that the AAP standard and the TEI, which has already been
+somewhat harmonized internationally and which also shares several
+compatibilities with the AAP, be harmonized to ensure sufficient
+compatibility in the software. She drew the line at saying LC ought to
+be the locus or forum for such harmonization.
+
+Taking the group in a slightly different direction, but one where at
+least in the near term LC might play a helpful role, LYNCH remarked the
+plans of a number of projects to carry out preservation by creating
+digital images that will end up in on-line or near-line storage at some
+institution. Presumably, LC will link this material somehow to its
+on-line catalog in most cases. Thus, it is in a digital form. LYNCH had
+the impression that many of these institutions would be willing to make
+those files accessible to other people outside the institution, provided
+that there is no copyright problem. This desideratum will require
+propagating the knowledge that those digitized files exist, so that they
+can end up in other on-line catalogs. Although uncertain about the
+mechanism for achieving this result, LYNCH said that it warranted
+scrutiny because it seemed to be connected to some of the basic issues of
+cataloging and distribution of records. It would be foolish, given the
+amount of work that all of us have to do and our meager resources, to
+discover multiple institutions digitizing the same work. Re microforms,
+LYNCH said, we are in pretty good shape.
+
+BATTIN called this a big problem and noted that the Cornell people (who
+had already departed) were working on it. At issue from the beginning
+was to learn how to catalog that information into RLIN and then into
+OCLC, so that it would be accessible. That issue remains to be resolved.
+LYNCH rejoined that putting it into OCLC or RLIN was helpful insofar as
+somebody who is thinking of performing preservation activity on that work
+could learn about it. It is not necessarily helpful for institutions to
+make that available. BATTIN opined that the idea was that it not only be
+for preservation purposes but for the convenience of people looking for
+this material. She endorsed LYNCH's dictum that duplication of this
+effort was to be avoided by every means.
+
+HOCKEY informed the Workshop about one major current activity of CETH,
+namely a catalogue of machine-readable texts in the humanities. Held on
+RLIN at present, the catalogue has been concentrated on ASCII as opposed
+to digitized images of text. She is exploring ways to improve the
+catalogue and make it more widely available, and welcomed suggestions
+about these concerns. CETH owns the records, which are not just
+restricted to RLIN, and can distribute them however it wishes.
+
+Taking up LESK's earlier question, BATTIN inquired whether LC, since it
+is accepting electronic files and designing a mechanism for dealing with
+that rather than putting books on shelves, would become responsible for
+the National Copyright Depository of Electronic Materials. Of course
+that could not be accomplished overnight, but it would be something LC
+could plan for. GIFFORD acknowledged that much thought was being devoted
+to that set of problems and returned the discussion to the issue raised
+by LYNCH--whether or not putting the kind of records that both BATTIN and
+HOCKEY have been talking about in RLIN is not a satisfactory solution.
+It seemed to him that RLIN answered LYNCH's original point concerning
+some kind of directory for these kinds of materials. In a situation
+where somebody is attempting to decide whether or not to scan this or
+film that or to learn whether or not someone has already done so, LYNCH
+suggested, RLIN is helpful, but it is not helpful in the case of a local,
+on-line catalogue. Further, one would like to have her or his system be
+aware that that exists in digital form, so that one can present it to a
+patron, even though one did not digitize it, if it is out of copyright.
+The only way to make those linkages would be to perform a tremendous
+amount of real-time look-up, which would be awkward at best, or
+periodically to yank the whole file from RLIN and match it against one's
+own stuff, which is a nuisance.
+
+But where, ERWAY inquired, does one stop including things that are
+available with Internet, for instance, in one's local catalogue?
+It almost seems that that is LC's means to acquire access to them.
+That represents LC's new form of library loan. Perhaps LC's new on-line
+catalogue is an amalgamation of all these catalogues on line. LYNCH
+conceded that perhaps that was true in the very long term, but was not
+applicable to scanning in the short term. In his view, the totals cited
+by Yale, 10,000 books over perhaps a four-year period, and 1,000-1,500
+books from Cornell, were not big numbers, while searching all over
+creation for relatively rare occurrences will prove to be less efficient.
+As GIFFORD wondered if this would not be a separable file on RLIN and
+could be requested from them, BATTIN interjected that it was easily
+accessible to an institution. SEVERTSON pointed out that that file, cum
+enhancements, was available with reference information on CD-ROM, which
+makes it a little more available.
+
+In HOCKEY's view, the real question facing the Workshop is what to put in
+this catalogue, because that raises the question of what constitutes a
+publication in the electronic world. (WEIBEL interjected that Eric Joule
+in OCLC's Office of Research is also wrestling with this particular
+problem, while GIFFORD thought it sounded fairly generic.) HOCKEY
+contended that a majority of texts in the humanities are in the hands
+of either a small number of large research institutions or individuals
+and are not generally available for anyone else to access at all.
+She wondered if these texts ought to be catalogued.
+
+After argument proceeded back and forth for several minutes over why
+cataloguing might be a necessary service, LEBRON suggested that this
+issue involved the responsibility of a publisher. The fact that someone
+has created something electronically and keeps it under his or her
+control does not constitute publication. Publication implies
+dissemination. While it would be important for a scholar to let other
+people know that this creation exists, in many respects this is no
+different from an unpublished manuscript. That is what is being accessed
+in there, except that now one is not looking at it in the hard-copy but
+in the electronic environment.
+
+LEBRON expressed puzzlement at the variety of ways electronic publishing
+has been viewed. Much of what has been discussed throughout these two
+days has concerned CD-ROM publishing, whereas in the on-line environment
+that she confronts, the constraints and challenges are very different.
+Sooner or later LC will have to deal with the concept of on-line
+publishing. Taking up the comment ERWAY made earlier about storing
+copies, LEBRON gave her own journal as an example. How would she deposit
+OJCCT for copyright?, she asked, because the journal will exist in the
+mainframe at OCLC and people will be able to access it. Here the
+situation is different, ownership versus access, and is something that
+arises with publication in the on-line environment, faster than is
+sometimes realized. Lacking clear answers to all of these questions
+herself, LEBRON did not anticipate that LC would be able to take a role
+in helping to define some of them for quite a while.
+
+GREENFIELD observed that LC's Network Development Office is attempting,
+among other things, to explore the limits of MARC as a standard in terms
+of handling electronic information. GREENFIELD also noted that Rebecca
+GUENTHER from that office gave a paper to the American Society for
+Information Science (ASIS) summarizing several of the discussion papers
+that were coming out of the Network Development Office. GREENFIELD said
+he understood that that office had a list-server soliciting just the kind
+of feedback received today concerning the difficulties of identifying and
+cataloguing electronic information. GREENFIELD hoped that everybody
+would be aware of that and somehow contribute to that conversation.
+
+Noting two of LC's roles, first, to act as a repository of record for
+material that is copyrighted in this country, and second, to make
+materials it holds available in some limited form to a clientele that
+goes beyond Congress, BESSER suggested that it was incumbent on LC to
+extend those responsibilities to all the things being published in
+electronic form. This would mean eventually accepting electronic
+formats. LC could require that at some point they be in a certain
+limited set of formats, and then develop mechanisms for allowing people
+to access those in the same way that other things are accessed. This
+does not imply that they are on the network and available to everyone.
+LC does that with most of its bibliographic records, BESSER said, which
+end up migrating to the utility (e.g., OCLC) or somewhere else. But just
+as most of LC's books are available in some form through interlibrary
+loan or some other mechanism, so in the same way electronic formats ought
+to be available to others in some format, though with some copyright
+considerations. BESSER was not suggesting that these mechanisms be
+established tomorrow, only that they seemed to fall within LC's purview,
+and that there should be long-range plans to establish them.
+
+Acknowledging that those from LC in the room agreed with BESSER
+concerning the need to confront difficult questions, GIFFORD underscored
+the magnitude of the problem of what to keep and what to select. GIFFORD
+noted that LC currently receives some 31,000 items per day, not counting
+electronic materials, and argued for much more distributed responsibility
+in order to maintain and store electronic information.
+
+BESSER responded that the assembled group could be viewed as a starting
+point, whose initial operating premise could be helping to move in this
+direction and defining how LC could do so, for example, in areas of
+standardization or distribution of responsibility.
+
+FLEISCHHAUER added that AM was fully engaged, wrestling with some of the
+questions that pertain to the conversion of older historical materials,
+which would be one thing that the Library of Congress might do. Several
+points mentioned by BESSER and several others on this question have a
+much greater impact on those who are concerned with cataloguing and the
+networking of bibliographic information, as well as preservation itself.
+
+Speaking directly to AM, which he considered was a largely uncopyrighted
+database, LYNCH urged development of a network version of AM, or
+consideration of making the data in it available to people interested in
+doing network multimedia. On account of the current great shortage of
+digital data that is both appealing and unencumbered by complex rights
+problems, this course of action could have a significant effect on making
+network multimedia a reality.
+
+In this connection, FLEISCHHAUER reported on a fragmentary prototype in
+LC's Office of Information Technology Services that attempts to associate
+digital images of photographs with cataloguing information in ways that
+work within a local area network--a step, so to say, toward AM's
+construction of some sort of apparatus for access. Further, AM has
+attempted to use standard data forms in order to help make that
+distinction between the access tools and the underlying data, and thus
+believes that the database is networkable.
+
+A delicate and agonizing policy question for LC, however, which comes
+back to resources and unfortunately has an impact on this, is to find
+some appropriate, honorable, and legal cost-recovery possibilities. A
+certain skittishness concerning cost-recovery has made people unsure
+exactly what to do. AM would be highly receptive to discussing further
+LYNCH's offer to test or demonstrate its database in a network
+environment, FLEISCHHAUER said.
+
+Returning the discussion to what she viewed as the vital issue of
+electronic deposit, BATTIN recommended that LC initiate a catalytic
+process in terms of distributed responsibility, that is, bring together
+the distributed organizations and set up a study group to look at all
+these issues and see where we as a nation should move. The broader
+issues of how we deal with the management of electronic information will
+not disappear, but only grow worse.
+
+LESK took up this theme and suggested that LC attempt to persuade one
+major library in each state to deal with its state equivalent publisher,
+which might produce a cooperative project that would be equitably
+distributed around the country, and one in which LC would be dealing with
+a minimal number of publishers and minimal copyright problems.
+
+GRABER remarked the recent development in the scientific community of a
+willingness to use SGML and either deposit or interchange on a fairly
+standardized format. He wondered if a similar movement was taking place
+in the humanities. Although the National Library of Medicine found only
+a few publishers to cooperate in a like venture two or three years ago, a
+new effort might generate a much larger number willing to cooperate.
+
+KIMBALL recounted his unit's (Machine-Readable Collections Reading Room)
+troubles with the commercial publishers of electronic media in acquiring
+materials for LC's collections, in particular the publishers' fear that
+they would not be able to cover their costs and would lose control of
+their products, that LC would give them away or sell them and make
+profits from them. He doubted that the publishing industry was prepared
+to move into this area at the moment, given its resistance to allowing LC
+to use its machine-readable materials as the Library would like.
+
+The copyright law now addresses compact disk as a medium, and LC can
+request one copy of that, or two copies if it is the only version, and
+can request copies of software, but that fails to address magazines or
+books or anything like that which is in machine-readable form.
+
+GIFFORD acknowledged the thorny nature of this issue, which he illustrated
+with the example of the cumbersome process involved in putting a copy of a
+scientific database on a LAN in LC's science reading room. He also
+acknowledged that LC needs help and could enlist the energies and talents
+of Workshop participants in thinking through a number of these problems.
+
+GIFFORD returned the discussion to getting the image and text people to
+think through together where they want to go in the long term. MYLONAS
+conceded that her experience at the Pierce Symposium the previous week at
+Georgetown University and this week at LC had forced her to reevaluate
+her perspective on the usefulness of text as images. MYLONAS framed the
+issues in a series of questions: How do we acquire machine-readable
+text? Do we take pictures of it and perform OCR on it later? Is it
+important to obtain very high-quality images and text, etc.?
+FLEISCHHAUER agreed with MYLONAS's framing of strategic questions, adding
+that a large institution such as LC probably has to do all of those
+things at different times. Thus, the trick is to exercise judgment. The
+Workshop had added to his and AM's considerations in making those
+judgments. Concerning future meetings or discussions, MYLONAS suggested
+that screening priorities would be helpful.
+
+WEIBEL opined that the diversity reflected in this group was a sign both
+of the health and of the immaturity of the field, and more time would
+have to pass before we convince one another concerning standards.
+
+An exchange between MYLONAS and BATTIN clarified the point that the
+driving force behind both the Perseus and the Cornell Xerox projects was
+the preservation of knowledge for the future, not simply for particular
+research use. In the case of Perseus, MYLONAS said, the assumption was
+that the texts would not be entered again into electronically readable
+form. SPERBERG-McQUEEN added that a scanned image would not serve as an
+archival copy for purposes of preservation in the case of, say, the Bill
+of Rights, in the sense that the scanned images are effectively the
+archival copies for the Cornell mathematics books.
+
+
+ *** *** *** ****** *** *** ***
+
+
+ Appendix I: PROGRAM
+
+
+
+ WORKSHOP
+ ON
+ ELECTRONIC
+ TEXTS
+
+
+
+ 9-10 June 1992
+
+ Library of Congress
+ Washington, D.C.
+
+
+
+ Supported by a Grant from the David and Lucile Packard Foundation
+
+
+Tuesday, 9 June 1992
+
+NATIONAL DEMONSTRATION LAB, ATRIUM, LIBRARY MADISON
+
+8:30 AM Coffee and Danish, registration
+
+9:00 AM Welcome
+
+ Prosser Gifford, Director for Scholarly Programs, and Carl
+ Fleischhauer, Coordinator, American Memory, Library of
+ Congress
+
+9:l5 AM Session I. Content in a New Form: Who Will Use It and What
+ Will They Do?
+
+ Broad description of the range of electronic information.
+ Characterization of who uses it and how it is or may be used.
+ In addition to a look at scholarly uses, this session will
+ include a presentation on use by students (K-12 and college)
+ and the general public.
+
+ Moderator: James Daly
+ Avra Michelson, Archival Research and Evaluation Staff,
+ National Archives and Records Administration (Overview)
+ Susan H. Veccia, Team Leader, American Memory, User Evaluation,
+ and
+ Joanne Freeman, Associate Coordinator, American Memory, Library
+ of Congress (Beyond the scholar)
+
+10:30-
+11:00 AM Break
+
+11:00 AM Session II. Show and Tell.
+
+ Each presentation to consist of a fifteen-minute
+ statement/show; group discussion will follow lunch.
+
+ Moderator: Jacqueline Hess, Director, National Demonstration
+ Lab
+
+ 1. A classics project, stressing texts and text retrieval
+ more than multimedia: Perseus Project, Harvard
+ University
+ Elli Mylonas, Managing Editor
+
+ 2. Other humanities projects employing the emerging norms of
+ the Text Encoding Initiative (TEI): Chadwyck-Healey's
+ The English Poetry Full Text Database and/or Patrologia
+ Latina Database
+ Eric M. Calaluca, Vice President, Chadwyck-Healey, Inc.
+
+ 3. American Memory
+ Carl Fleischhauer, Coordinator, and
+ Ricky Erway, Associate Coordinator, Library of Congress
+
+ 4. Founding Fathers example from Packard Humanities
+ Institute: The Papers of George Washington, University
+ of Virginia
+ Dorothy Twohig, Managing Editor, and/or
+ David Woodley Packard
+
+ 5. An electronic medical journal offering graphics and
+ full-text searchability: The Online Journal of Current
+ Clinical Trials, American Association for the Advancement
+ of Science
+ Maria L. Lebron, Managing Editor
+
+ 6. A project that offers facsimile images of pages but omits
+ searchable text: Cornell math books
+ Lynne K. Personius, Assistant Director, Cornell
+ Information Technologies for Scholarly Information
+ Sources, Cornell University
+
+12:30 PM Lunch (Dining Room A, Library Madison 620. Exhibits
+ available.)
+
+1:30 PM Session II. Show and Tell (Cont'd.).
+
+3:00-
+3:30 PM Break
+
+3:30-
+5:30 PM Session III. Distribution, Networks, and Networking: Options
+ for Dissemination.
+
+ Published disks: University presses and public-sector
+ publishers, private-sector publishers
+ Computer networks
+
+ Moderator: Robert G. Zich, Special Assistant to the Associate
+ Librarian for Special Projects, Library of Congress
+ Clifford A. Lynch, Director, Library Automation, University of
+ California
+ Howard Besser, School of Library and Information Science,
+ University of Pittsburgh
+ Ronald L. Larsen, Associate Director of Libraries for
+ Information Technology, University of Maryland at College
+ Park
+ Edwin B. Brownrigg, Executive Director, Memex Research
+ Institute
+
+6:30 PM Reception (Montpelier Room, Library Madison 619.)
+
+ ******
+
+Wednesday, 10 June 1992
+
+DINING ROOM A, LIBRARY MADISON 620
+
+8:30 AM Coffee and Danish
+
+9:00 AM Session IV. Image Capture, Text Capture, Overview of Text and
+ Image Storage Formats.
+
+ Moderator: William L. Hooton, Vice President of Operations,
+ I-NET
+
+ A) Principal Methods for Image Capture of Text:
+ Direct scanning
+ Use of microform
+
+ Anne R. Kenney, Assistant Director, Department of Preservation
+ and Conservation, Cornell University
+ Pamela Q.J. Andre, Associate Director, Automation, and
+ Judith A. Zidar, Coordinator, National Agricultural Text
+ Digitizing Program (NATDP), National Agricultural Library
+ (NAL)
+ Donald J. Waters, Head, Systems Office, Yale University Library
+
+ B) Special Problems:
+ Bound volumes
+ Conservation
+ Reproducing printed halftones
+
+ Carl Fleischhauer, Coordinator, American Memory, Library of
+ Congress
+ George Thoma, Chief, Communications Engineering Branch,
+ National Library of Medicine (NLM)
+
+10:30-
+11:00 AM Break
+
+11:00 AM Session IV. Image Capture, Text Capture, Overview of Text and
+ Image Storage Formats (Cont'd.).
+
+ C) Image Standards and Implications for Preservation
+
+ Jean Baronas, Senior Manager, Department of Standards and
+ Technology, Association for Information and Image Management
+ (AIIM)
+ Patricia Battin, President, The Commission on Preservation and
+ Access (CPA)
+
+ D) Text Conversion:
+ OCR vs. rekeying
+ Standards of accuracy and use of imperfect texts
+ Service bureaus
+
+ Stuart Weibel, Senior Research Specialist, Online Computer
+ Library Center, Inc. (OCLC)
+ Michael Lesk, Executive Director, Computer Science Research,
+ Bellcore
+ Ricky Erway, Associate Coordinator, American Memory, Library of
+ Congress
+ Pamela Q.J. Andre, Associate Director, Automation, and
+ Judith A. Zidar, Coordinator, National Agricultural Text
+ Digitizing Program (NATDP), National Agricultural Library
+ (NAL)
+
+12:30-
+1:30 PM Lunch
+
+1:30 PM Session V. Approaches to Preparing Electronic Texts.
+
+ Discussion of approaches to structuring text for the computer;
+ pros and cons of text coding, description of methods in
+ practice, and comparison of text-coding methods.
+
+ Moderator: Susan Hockey, Director, Center for Electronic Texts
+ in the Humanities (CETH), Rutgers and Princeton Universities
+ David Woodley Packard
+ C.M. Sperberg-McQueen, Editor, Text Encoding Initiative (TEI),
+ University of Illinois-Chicago
+ Eric M. Calaluca, Vice President, Chadwyck-Healey, Inc.
+
+3:30-
+4:00 PM Break
+
+4:00 PM Session VI. Copyright Issues.
+
+ Marybeth Peters, Policy Planning Adviser to the Register of
+ Copyrights, Library of Congress
+
+5:00 PM Session VII. Conclusion.
+
+ General discussion.
+ What topics were omitted or given short shrift that anyone
+ would like to talk about now?
+ Is there a "group" here? What should the group do next, if
+ anything? What should the Library of Congress do next, if
+ anything?
+ Moderator: Prosser Gifford, Director for Scholarly Programs,
+ Library of Congress
+
+6:00 PM Adjourn
+
+
+ *** *** *** ****** *** *** ***
+
+
+ Appendix II: ABSTRACTS
+
+
+SESSION I
+
+Avra MICHELSON Forecasting the Use of Electronic Texts by
+ Social Sciences and Humanities Scholars
+
+This presentation explores the ways in which electronic texts are likely
+to be used by the non-scientific scholarly community. Many of the
+remarks are drawn from a report the speaker coauthored with Jeff
+Rothenberg, a computer scientist at The RAND Corporation.
+
+The speaker assesses 1) current scholarly use of information technology
+and 2) the key trends in information technology most relevant to the
+research process, in order to predict how social sciences and humanities
+scholars are apt to use electronic texts. In introducing the topic,
+current use of electronic texts is explored broadly within the context of
+scholarly communication. From the perspective of scholarly
+communication, the work of humanities and social sciences scholars
+involves five processes: 1) identification of sources, 2) communication
+with colleagues, 3) interpretation and analysis of data, 4) dissemination
+of research findings, and 5) curriculum development and instruction. The
+extent to which computation currently permeates aspects of scholarly
+communication represents a viable indicator of the prospects for
+electronic texts.
+
+The discussion of current practice is balanced by an analysis of key
+trends in the scholarly use of information technology. These include the
+trends toward end-user computing and connectivity, which provide a
+framework for forecasting the use of electronic texts through this
+millennium. The presentation concludes with a summary of the ways in
+which the nonscientific scholarly community can be expected to use
+electronic texts, and the implications of that use for information
+providers.
+
+Susan VECCIA and Joanne FREEMAN Electronic Archives for the Public:
+ Use of American Memory in Public and
+ School Libraries
+
+This joint discussion focuses on nonscholarly applications of electronic
+library materials, specifically addressing use of the Library of Congress
+American Memory (AM) program in a small number of public and school
+libraries throughout the United States. AM consists of selected Library
+of Congress primary archival materials, stored on optical media
+(CD-ROM/videodisc), and presented with little or no editing. Many
+collections are accompanied by electronic introductions and user's guides
+offering background information and historical context. Collections
+represent a variety of formats including photographs, graphic arts,
+motion pictures, recorded sound, music, broadsides and manuscripts,
+books, and pamphlets.
+
+In 1991, the Library of Congress began a nationwide evaluation of AM in
+different types of institutions. Test sites include public libraries,
+elementary and secondary school libraries, college and university
+libraries, state libraries, and special libraries. Susan VECCIA and
+Joanne FREEMAN will discuss their observations on the use of AM by the
+nonscholarly community, using evidence gleaned from this ongoing
+evaluation effort.
+
+VECCIA will comment on the overall goals of the evaluation project, and
+the types of public and school libraries included in this study. Her
+comments on nonscholarly use of AM will focus on the public library as a
+cultural and community institution, often bridging the gap between formal
+and informal education. FREEMAN will discuss the use of AM in school
+libraries. Use by students and teachers has revealed some broad
+questions about the use of electronic resources, as well as definite
+benefits gained by the "nonscholar." Topics will include the problem of
+grasping content and context in an electronic environment, the stumbling
+blocks created by "new" technologies, and the unique skills and interests
+awakened through use of electronic resources.
+
+SESSION II
+
+Elli MYLONAS The Perseus Project: Interactive Sources and
+ Studies in Classical Greece
+
+The Perseus Project (5) has just released Perseus 1.0, the first publicly
+available version of its hypertextual database of multimedia materials on
+classical Greece. Perseus is designed to be used by a wide audience,
+comprised of readers at the student and scholar levels. As such, it must
+be able to locate information using different strategies, and it must
+contain enough detail to serve the different needs of its users. In
+addition, it must be delivered so that it is affordable to its target
+audience. [These problems and the solutions we chose are described in
+Mylonas, "An Interface to Classical Greek Civilization," JASIS 43:2,
+March 1992.]
+
+In order to achieve its objective, the project staff decided to make a
+conscious separation between selecting and converting textual, database,
+and image data on the one hand, and putting it into a delivery system on
+the other. That way, it is possible to create the electronic data
+without thinking about the restrictions of the delivery system. We have
+made a great effort to choose system-independent formats for our data,
+and to put as much thought and work as possible into structuring it so
+that the translation from paper to electronic form will enhance the value
+of the data. [A discussion of these solutions as of two years ago is in
+Elli Mylonas, Gregory Crane, Kenneth Morrell, and D. Neel Smith, "The
+Perseus Project: Data in the Electronic Age," in Accessing Antiquity:
+The Computerization of Classical Databases, J. Solomon and T. Worthen
+(eds.), University of Arizona Press, in press.]
+
+Much of the work on Perseus is focused on collecting and converting the
+data on which the project is based. At the same time, it is necessary to
+provide means of access to the information, in order to make it usable,
+and them to investigate how it is used. As we learn more about what
+students and scholars from different backgrounds do with Perseus, we can
+adjust our data collection, and also modify the system to accommodate
+them. In creating a delivery system for general use, we have tried to
+avoid favoring any one type of use by allowing multiple forms of access
+to and navigation through the system.
+
+The way text is handled exemplifies some of these principles. All text
+in Perseus is tagged using SGML, following the guidelines of the Text
+Encoding Initiative (TEI). This markup is used to index the text, and
+process it so that it can be imported into HyperCard. No SGML markup
+remains in the text that reaches the user, because currently it would be
+too expensive to create a system that acts on SGML in real time.
+However, the regularity provided by SGML is essential for verifying the
+content of the texts, and greatly speeds all the processing performed on
+them. The fact that the texts exist in SGML ensures that they will be
+relatively easy to port to different hardware and software, and so will
+outlast the current delivery platform. Finally, the SGML markup
+incorporates existing canonical reference systems (chapter, verse, line,
+etc.); indexing and navigation are based on these features. This ensures
+that the same canonical reference will always resolve to the same point
+within a text, and that all versions of our texts, regardless of delivery
+platform (even paper printouts) will function the same way.
+
+In order to provide tools for users, the text is processed by a
+morphological analyzer, and the results are stored in a database.
+Together with the index, the Greek-English Lexicon, and the index of all
+the English words in the definitions of the lexicon, the morphological
+analyses comprise a set of linguistic tools that allow users of all
+levels to work with the textual information, and to accomplish different
+tasks. For example, students who read no Greek may explore a concept as
+it appears in Greek texts by using the English-Greek index, and then
+looking up works in the texts and translations, or scholars may do
+detailed morphological studies of word use by using the morphological
+analyses of the texts. Because these tools were not designed for any one
+use, the same tools and the same data can be used by both students and
+scholars.
+
+NOTES:
+ (5) Perseus is based at Harvard University, with collaborators at
+ several other universities. The project has been funded primarily
+ by the Annenberg/CPB Project, as well as by Harvard University,
+ Apple Computer, and others. It is published by Yale University
+ Press. Perseus runs on Macintosh computers, under the HyperCard
+ program.
+
+Eric CALALUCA
+
+Chadwyck-Healey embarked last year on two distinct yet related full-text
+humanities database projects.
+
+The English Poetry Full-Text Database and the Patrologia Latina Database
+represent new approaches to linguistic research resources. The size and
+complexity of the projects present problems for electronic publishers,
+but surmountable ones if they remain abreast of the latest possibilities
+in data capture and retrieval software techniques.
+
+The issues which required address prior to the commencement of the
+projects were legion:
+
+ 1. Editorial selection (or exclusion) of materials in each
+ database
+
+ 2. Deciding whether or not to incorporate a normative encoding
+ structure into the databases?
+ A. If one is selected, should it be SGML?
+ B. If SGML, then the TEI?
+
+ 3. Deliver as CD-ROM, magnetic tape, or both?
+
+ 4. Can one produce retrieval software advanced enough for the
+ postdoctoral linguist, yet accessible enough for unattended
+ general use? Should one try?
+
+ 5. Re fair and liberal networking policies, what are the risks to
+ an electronic publisher?
+
+ 6. How does the emergence of national and international education
+ networks affect the use and viability of research projects
+ requiring high investment? Do the new European Community
+ directives concerning database protection necessitate two
+ distinct publishing projects, one for North America and one for
+ overseas?
+
+From new notions of "scholarly fair use" to the future of optical media,
+virtually every issue related to electronic publishing was aired. The
+result is two projects which have been constructed to provide the quality
+research resources with the fewest encumbrances to use by teachers and
+private scholars.
+
+Dorothy TWOHIG
+
+In spring 1988 the editors of the papers of George Washington, John
+Adams, Thomas Jefferson, James Madison, and Benjamin Franklin were
+approached by classics scholar David Packard on behalf of the Packard
+Humanities Foundation with a proposal to produce a CD-ROM edition of the
+complete papers of each of the Founding Fathers. This electronic edition
+will supplement the published volumes, making the documents widely
+available to students and researchers at reasonable cost. We estimate
+that our CD-ROM edition of Washington's Papers will be substantially
+completed within the next two years and ready for publication. Within
+the next ten years or so, similar CD-ROM editions of the Franklin, Adams,
+Jefferson, and Madison papers also will be available. At the Library of
+Congress's session on technology, I would like to discuss not only the
+experience of the Washington Papers in producing the CD-ROM edition, but
+the impact technology has had on these major editorial projects.
+Already, we are editing our volumes with an eye to the material that will
+be readily available in the CD-ROM edition. The completed electronic
+edition will provide immense possibilities for the searching of documents
+for information in a way never possible before. The kind of technical
+innovations that are currently available and on the drawing board will
+soon revolutionize historical research and the production of historical
+documents. Unfortunately, much of this new technology is not being used
+in the planning stages of historical projects, simply because many
+historians are aware only in the vaguest way of its existence. At least
+two major new historical editing projects are considering microfilm
+editions, simply because they are not aware of the possibilities of
+electronic alternatives and the advantages of the new technology in terms
+of flexibility and research potential compared to microfilm. In fact,
+too many of us in history and literature are still at the stage of
+struggling with our PCs. There are many historical editorial projects in
+progress presently, and an equal number of literary projects. While the
+two fields have somewhat different approaches to textual editing, there
+are ways in which electronic technology can be of service to both.
+
+Since few of the editors involved in the Founding Fathers CD-ROM editions
+are technical experts in any sense, I hope to point out in my discussion
+of our experience how many of these electronic innovations can be used
+successfully by scholars who are novices in the world of new technology.
+One of the major concerns of the sponsors of the multitude of new
+scholarly editions is the limited audience reached by the published
+volumes. Most of these editions are being published in small quantities
+and the publishers' price for them puts them out of the reach not only of
+individual scholars but of most public libraries and all but the largest
+educational institutions. However, little attention is being given to
+ways in which technology can bypass conventional publication to make
+historical and literary documents more widely available.
+
+What attracted us most to the CD-ROM edition of The Papers of George
+Washington was the fact that David Packard's aim was to make a complete
+edition of all of the 135,000 documents we have collected available in an
+inexpensive format that would be placed in public libraries, small
+colleges, and even high schools. This would provide an audience far
+beyond our present 1,000-copy, $45 published edition. Since the CD-ROM
+edition will carry none of the explanatory annotation that appears in the
+published volumes, we also feel that the use of the CD-ROM will lead many
+researchers to seek out the published volumes.
+
+In addition to ignorance of new technical advances, I have found that too
+many editors--and historians and literary scholars--are resistant and
+even hostile to suggestions that electronic technology may enhance their
+work. I intend to discuss some of the arguments traditionalists are
+advancing to resist technology, ranging from distrust of the speed with
+which it changes (we are already wondering what is out there that is
+better than CD-ROM) to suspicion of the technical language used to
+describe electronic developments.
+
+Maria LEBRON
+
+The Online Journal of Current Clinical Trials, a joint venture of the
+American Association for the Advancement of Science (AAAS) and the Online
+Computer Library Center, Inc. (OCLC), is the first peer-reviewed journal
+to provide full text, tabular material, and line illustrations on line.
+This presentation will discuss the genesis and start-up period of the
+journal. Topics of discussion will include historical overview,
+day-to-day management of the editorial peer review, and manuscript
+tagging and publication. A demonstration of the journal and its features
+will accompany the presentation.
+
+Lynne PERSONIUS
+
+Cornell University Library, Cornell Information Technologies, and Xerox
+Corporation, with the support of the Commission on Preservation and
+Access, and Sun Microsystems, Inc., have been collaborating in a project
+to test a prototype system for recording brittle books as digital images
+and producing, on demand, high-quality archival paper replacements. The
+project goes beyond that, however, to investigate some of the issues
+surrounding scanning, storing, retrieving, and providing access to
+digital images in a network environment.
+
+The Joint Study in Digital Preservation began in January 1990. Xerox
+provided the College Library Access and Storage System (CLASS) software,
+a prototype 600-dots-per-inch (dpi) scanner, and the hardware necessary
+to support network printing on the DocuTech printer housed in Cornell's
+Computing and Communications Center (CCC).
+
+The Cornell staff using the hardware and software became an integral part
+of the development and testing process for enhancements to the CLASS
+software system. The collaborative nature of this relationship is
+resulting in a system that is specifically tailored to the preservation
+application.
+
+A digital library of 1,000 volumes (or approximately 300,000 images) has
+been created and is stored on an optical jukebox that resides in CCC.
+The library includes a collection of select mathematics monographs that
+provides mathematics faculty with an opportunity to use the electronic
+library. The remaining volumes were chosen for the library to test the
+various capabilities of the scanning system.
+
+One project objective is to provide users of the Cornell library and the
+library staff with the ability to request facsimiles of digitized images
+or to retrieve the actual electronic image for browsing. A prototype
+viewing workstation has been created by Xerox, with input into the design
+by a committee of Cornell librarians and computer professionals. This
+will allow us to experiment with patron access to the images that make up
+the digital library. The viewing station provides search, retrieval, and
+(ultimately) printing functions with enhancements to facilitate
+navigation through multiple documents.
+
+Cornell currently is working to extend access to the digital library to
+readers using workstations from their offices. This year is devoted to
+the development of a network resident image conversion and delivery
+server, and client software that will support readers who use Apple
+Macintosh computers, IBM windows platforms, and Sun workstations.
+Equipment for this development was provided by Sun Microsystems with
+support from the Commission on Preservation and Access.
+
+During the show-and-tell session of the Workshop on Electronic Texts, a
+prototype view station will be demonstrated. In addition, a display of
+original library books that have been digitized will be available for
+review with associated printed copies for comparison. The fifteen-minute
+overview of the project will include a slide presentation that
+constitutes a "tour" of the preservation digitizing process.
+
+The final network-connected version of the viewing station will provide
+library users with another mechanism for accessing the digital library,
+and will also provide the capability of viewing images directly. This
+will not require special software, although a powerful computer with good
+graphics will be needed.
+
+The Joint Study in Digital Preservation has generated a great deal of
+interest in the library community. Unfortunately, or perhaps
+fortunately, this project serves to raise a vast number of other issues
+surrounding the use of digital technology for the preservation and use of
+deteriorating library materials, which subsequent projects will need to
+examine. Much work remains.
+
+SESSION III
+
+Howard BESSER Networking Multimedia Databases
+
+What do we have to consider in building and distributing databases of
+visual materials in a multi-user environment? This presentation examines
+a variety of concerns that need to be addressed before a multimedia
+database can be set up in a networked environment.
+
+In the past it has not been feasible to implement databases of visual
+materials in shared-user environments because of technological barriers.
+Each of the two basic models for multi-user multimedia databases has
+posed its own problem. The analog multimedia storage model (represented
+by Project Athena's parallel analog and digital networks) has required an
+incredibly complex (and expensive) infrastructure. The economies of
+scale that make multi-user setups cheaper per user served do not operate
+in an environment that requires a computer workstation, videodisc player,
+and two display devices for each user.
+
+The digital multimedia storage model has required vast amounts of storage
+space (as much as one gigabyte per thirty still images). In the past the
+cost of such a large amount of storage space made this model a
+prohibitive choice as well. But plunging storage costs are finally
+making this second alternative viable.
+
+If storage no longer poses such an impediment, what do we need to
+consider in building digitally stored multi-user databases of visual
+materials? This presentation will examine the networking and
+telecommunication constraints that must be overcome before such databases
+can become commonplace and useful to a large number of people.
+
+The key problem is the vast size of multimedia documents, and how this
+affects not only storage but telecommunications transmission time.
+Anything slower than T-1 speed is impractical for files of 1 megabyte or
+larger (which is likely to be small for a multimedia document). For
+instance, even on a 56 Kb line it would take three minutes to transfer a
+1-megabyte file. And these figures assume ideal circumstances, and do
+not take into consideration other users contending for network bandwidth,
+disk access time, or the time needed for remote display. Current common
+telephone transmission rates would be completely impractical; few users
+would be willing to wait the hour necessary to transmit a single image at
+2400 baud.
+
+This necessitates compression, which itself raises a number of other
+issues. In order to decrease file sizes significantly, we must employ
+lossy compression algorithms. But how much quality can we afford to
+lose? To date there has been only one significant study done of
+image-quality needs for a particular user group, and this study did not
+look at loss resulting from compression. Only after identifying
+image-quality needs can we begin to address storage and network bandwidth
+needs.
+
+Experience with X-Windows-based applications (such as Imagequery, the
+University of California at Berkeley image database) demonstrates the
+utility of a client-server topology, but also points to the limitation of
+current software for a distributed environment. For example,
+applications like Imagequery can incorporate compression, but current X
+implementations do not permit decompression at the end user's
+workstation. Such decompression at the host computer alleviates storage
+capacity problems while doing nothing to address problems of
+telecommunications bandwidth.
+
+We need to examine the effects on network through-put of moving
+multimedia documents around on a network. We need to examine various
+topologies that will help us avoid bottlenecks around servers and
+gateways. Experience with applications such as these raise still broader
+questions. How closely is the multimedia document tied to the software
+for viewing it? Can it be accessed and viewed from other applications?
+Experience with the MARC format (and more recently with the Z39.50
+protocols) shows how useful it can be to store documents in a form in
+which they can be accessed by a variety of application software.
+
+Finally, from an intellectual-access standpoint, we need to address the
+issue of providing access to these multimedia documents in
+interdisciplinary environments. We need to examine terminology and
+indexing strategies that will allow us to provide access to this material
+in a cross-disciplinary way.
+
+Ronald LARSEN Directions in High-Performance Networking for
+ Libraries
+
+The pace at which computing technology has advanced over the past forty
+years shows no sign of abating. Roughly speaking, each five-year period
+has yielded an order-of-magnitude improvement in price and performance of
+computing equipment. No fundamental hurdles are likely to prevent this
+pace from continuing for at least the next decade. It is only in the
+past five years, though, that computing has become ubiquitous in
+libraries, affecting all staff and patrons, directly or indirectly.
+
+During these same five years, communications rates on the Internet, the
+principal academic computing network, have grown from 56 kbps to 1.5
+Mbps, and the NSFNet backbone is now running 45 Mbps. Over the next five
+years, communication rates on the backbone are expected to exceed 1 Gbps.
+Growth in both the population of network users and the volume of network
+traffic has continued to grow geometrically, at rates approaching 15
+percent per month. This flood of capacity and use, likened by some to
+"drinking from a firehose," creates immense opportunities and challenges
+for libraries. Libraries must anticipate the future implications of this
+technology, participate in its development, and deploy it to ensure
+access to the world's information resources.
+
+The infrastructure for the information age is being put in place.
+Libraries face strategic decisions about their role in the development,
+deployment, and use of this infrastructure. The emerging infrastructure
+is much more than computers and communication lines. It is more than the
+ability to compute at a remote site, send electronic mail to a peer
+across the country, or move a file from one library to another. The next
+five years will witness substantial development of the information
+infrastructure of the network.
+
+In order to provide appropriate leadership, library professionals must
+have a fundamental understanding of and appreciation for computer
+networking, from local area networks to the National Research and
+Education Network (NREN). This presentation addresses these
+fundamentals, and how they relate to libraries today and in the near
+future.
+
+Edwin BROWNRIGG Electronic Library Visions and Realities
+
+The electronic library has been a vision desired by many--and rejected by
+some--since Vannevar Bush coined the term memex to describe an automated,
+intelligent, personal information system. Variations on this vision have
+included Ted Nelson's Xanadau, Alan Kay's Dynabook, and Lancaster's
+"paperless library," with the most recent incarnation being the
+"Knowledge Navigator" described by John Scully of Apple. But the reality
+of library service has been less visionary and the leap to the electronic
+library has eluded universities, publishers, and information technology
+files.
+
+The Memex Research Institute (MemRI), an independent, nonprofit research
+and development organization, has created an Electronic Library Program
+of shared research and development in order to make the collective vision
+more concrete. The program is working toward the creation of large,
+indexed publicly available electronic image collections of published
+documents in academic, special, and public libraries. This strategic
+plan is the result of the first stage of the program, which has been an
+investigation of the information technologies available to support such
+an effort, the economic parameters of electronic service compared to
+traditional library operations, and the business and political factors
+affecting the shift from print distribution to electronic networked
+access.
+
+The strategic plan envisions a combination of publicly searchable access
+databases, image (and text) document collections stored on network "file
+servers," local and remote network access, and an intellectual property
+management-control system. This combination of technology and
+information content is defined in this plan as an E-library or E-library
+collection. Some participating sponsors are already developing projects
+based on MemRI's recommended directions.
+
+The E-library strategy projected in this plan is a visionary one that can
+enable major changes and improvements in academic, public, and special
+library service. This vision is, though, one that can be realized with
+today's technology. At the same time, it will challenge the political
+and social structure within which libraries operate: in academic
+libraries, the traditional emphasis on local collections, extending to
+accreditation issues; in public libraries, the potential of electronic
+branch and central libraries fully available to the public; and for
+special libraries, new opportunities for shared collections and networks.
+
+The environment in which this strategic plan has been developed is, at
+the moment, dominated by a sense of library limits. The continued
+expansion and rapid growth of local academic library collections is now
+clearly at an end. Corporate libraries, and even law libraries, are
+faced with operating within a difficult economic climate, as well as with
+very active competition from commercial information sources. For
+example, public libraries may be seen as a desirable but not critical
+municipal service in a time when the budgets of safety and health
+agencies are being cut back.
+
+Further, libraries in general have a very high labor-to-cost ratio in
+their budgets, and labor costs are still increasing, notwithstanding
+automation investments. It is difficult for libraries to obtain capital,
+startup, or seed funding for innovative activities, and those
+technology-intensive initiatives that offer the potential of decreased
+labor costs can provoke the opposition of library staff.
+
+However, libraries have achieved some considerable successes in the past
+two decades by improving both their service and their credibility within
+their organizations--and these positive changes have been accomplished
+mostly with judicious use of information technologies. The advances in
+computing and information technology have been well-chronicled: the
+continuing precipitous drop in computing costs, the growth of the
+Internet and private networks, and the explosive increase in publicly
+available information databases.
+
+For example, OCLC has become one of the largest computer network
+organizations in the world by creating a cooperative cataloging network
+of more than 6,000 libraries worldwide. On-line public access catalogs
+now serve millions of users on more than 50,000 dedicated terminals in
+the United States alone. The University of California MELVYL on-line
+catalog system has now expanded into an index database reference service
+and supports more than six million searches a year. And, libraries have
+become the largest group of customers of CD-ROM publishing technology;
+more than 30,000 optical media publications such as those offered by
+InfoTrac and Silver Platter are subscribed to by U.S. libraries.
+
+This march of technology continues and in the next decade will result in
+further innovations that are extremely difficult to predict. What is
+clear is that libraries can now go beyond automation of their order files
+and catalogs to automation of their collections themselves--and it is
+possible to circumvent the fiscal limitations that appear to obtain
+today.
+
+This Electronic Library Strategic Plan recommends a paradigm shift in
+library service, and demonstrates the steps necessary to provide improved
+library services with limited capacities and operating investments.
+
+SESSION IV-A
+
+Anne KENNEY
+
+The Cornell/Xerox Joint Study in Digital Preservation resulted in the
+recording of 1,000 brittle books as 600-dpi digital images and the
+production, on demand, of high-quality and archivally sound paper
+replacements. The project, which was supported by the Commission on
+Preservation and Access, also investigated some of the issues surrounding
+scanning, storing, retrieving, and providing access to digital images in
+a network environment.
+
+Anne Kenney will focus on some of the issues surrounding direct scanning
+as identified in the Cornell Xerox Project. Among those to be discussed
+are: image versus text capture; indexing and access; image-capture
+capabilities; a comparison to photocopy and microfilm; production and
+cost analysis; storage formats, protocols, and standards; and the use of
+this scanning technology for preservation purposes.
+
+The 600-dpi digital images produced in the Cornell Xerox Project proved
+highly acceptable for creating paper replacements of deteriorating
+originals. The 1,000 scanned volumes provided an array of image-capture
+challenges that are common to nineteenth-century printing techniques and
+embrittled material, and that defy the use of text-conversion processes.
+These challenges include diminished contrast between text and background,
+fragile and deteriorated pages, uneven printing, elaborate type faces,
+faint and bold text adjacency, handwritten text and annotations, nonRoman
+languages, and a proliferation of illustrated material embedded in text.
+The latter category included high-frequency and low-frequency halftones,
+continuous tone photographs, intricate mathematical drawings, maps,
+etchings, reverse-polarity drawings, and engravings.
+
+The Xerox prototype scanning system provided a number of important
+features for capturing this diverse material. Technicians used multiple
+threshold settings, filters, line art and halftone definitions,
+autosegmentation, windowing, and software-editing programs to optimize
+image capture. At the same time, this project focused on production.
+The goal was to make scanning as affordable and acceptable as
+photocopying and microfilming for preservation reformatting. A
+time-and-cost study conducted during the last three months of this
+project confirmed the economic viability of digital scanning, and these
+findings will be discussed here.
+
+From the outset, the Cornell Xerox Project was predicated on the use of
+nonproprietary standards and the use of common protocols when standards
+did not exist. Digital files were created as TIFF images which were
+compressed prior to storage using Group 4 CCITT compression. The Xerox
+software is MS DOS based and utilizes off-the shelf programs such as
+Microsoft Windows and Wang Image Wizard. The digital library is designed
+to be hardware-independent and to provide interchangeability with other
+institutions through network connections. Access to the digital files
+themselves is two-tiered: Bibliographic records for the computer files
+are created in RLIN and Cornell's local system and access into the actual
+digital images comprising a book is provided through a document control
+structure and a networked image file-server, both of which will be
+described.
+
+The presentation will conclude with a discussion of some of the issues
+surrounding the use of this technology as a preservation tool (storage,
+refreshing, backup).
+
+Pamela ANDRE and Judith ZIDAR
+
+The National Agricultural Library (NAL) has had extensive experience with
+raster scanning of printed materials. Since 1987, the Library has
+participated in the National Agricultural Text Digitizing Project (NATDP)
+a cooperative effort between NAL and forty-five land grant university
+libraries. An overview of the project will be presented, giving its
+history and NAL's strategy for the future.
+
+An in-depth discussion of NATDP will follow, including a description of
+the scanning process, from the gathering of the printed materials to the
+archiving of the electronic pages. The type of equipment required for a
+stand-alone scanning workstation and the importance of file management
+software will be discussed. Issues concerning the images themselves will
+be addressed briefly, such as image format; black and white versus color;
+gray scale versus dithering; and resolution.
+
+Also described will be a study currently in progress by NAL to evaluate
+the usefulness of converting microfilm to electronic images in order to
+improve access. With the cooperation of Tuskegee University, NAL has
+selected three reels of microfilm from a collection of sixty-seven reels
+containing the papers, letters, and drawings of George Washington Carver.
+The three reels were converted into 3,500 electronic images using a
+specialized microfilm scanner. The selection, filming, and indexing of
+this material will be discussed.
+
+Donald WATERS
+
+Project Open Book, the Yale University Library's effort to convert 10,
+000 books from microfilm to digital imagery, is currently in an advanced
+state of planning and organization. The Yale Library has selected a
+major vendor to serve as a partner in the project and as systems
+integrator. In its proposal, the successful vendor helped isolate areas
+of risk and uncertainty as well as key issues to be addressed during the
+life of the project. The Yale Library is now poised to decide what
+material it will convert to digital image form and to seek funding,
+initially for the first phase and then for the entire project.
+
+The proposal that Yale accepted for the implementation of Project Open
+Book will provide at the end of three phases a conversion subsystem,
+browsing stations distributed on the campus network within the Yale
+Library, a subsystem for storing 10,000 books at 200 and 600 dots per
+inch, and network access to the image printers. Pricing for the system
+implementation assumes the existence of Yale's campus ethernet network
+and its high-speed image printers, and includes other requisite hardware
+and software, as well as system integration services. Proposed operating
+costs include hardware and software maintenance, but do not include
+estimates for the facilities management of the storage devices and image
+servers.
+
+Yale selected its vendor partner in a formal process, partly funded by
+the Commission for Preservation and Access. Following a request for
+proposal, the Yale Library selected two vendors as finalists to work with
+Yale staff to generate a detailed analysis of requirements for Project
+Open Book. Each vendor used the results of the requirements analysis to
+generate and submit a formal proposal for the entire project. This
+competitive process not only enabled the Yale Library to select its
+primary vendor partner but also revealed much about the state of the
+imaging industry, about the varying, corporate commitments to the markets
+for imaging technology, and about the varying organizational dynamics
+through which major companies are responding to and seeking to develop
+these markets.
+
+Project Open Book is focused specifically on the conversion of images
+from microfilm to digital form. The technology for scanning microfilm is
+readily available but is changing rapidly. In its project requirements,
+the Yale Library emphasized features of the technology that affect the
+technical quality of digital image production and the costs of creating
+and storing the image library: What levels of digital resolution can be
+achieved by scanning microfilm? How does variation in the quality of
+microfilm, particularly in film produced to preservation standards,
+affect the quality of the digital images? What technologies can an
+operator effectively and economically apply when scanning film to
+separate two-up images and to control for and correct image
+imperfections? How can quality control best be integrated into
+digitizing work flow that includes document indexing and storage?
+
+The actual and expected uses of digital images--storage, browsing,
+printing, and OCR--help determine the standards for measuring their
+quality. Browsing is especially important, but the facilities available
+for readers to browse image documents is perhaps the weakest aspect of
+imaging technology and most in need of development. As it defined its
+requirements, the Yale Library concentrated on some fundamental aspects
+of usability for image documents: Does the system have sufficient
+flexibility to handle the full range of document types, including
+monographs, multi-part and multivolume sets, and serials, as well as
+manuscript collections? What conventions are necessary to identify a
+document uniquely for storage and retrieval? Where is the database of
+record for storing bibliographic information about the image document?
+How are basic internal structures of documents, such as pagination, made
+accessible to the reader? How are the image documents physically
+presented on the screen to the reader?
+
+The Yale Library designed Project Open Book on the assumption that
+microfilm is more than adequate as a medium for preserving the content of
+deteriorated library materials. As planning in the project has advanced,
+it is increasingly clear that the challenge of digital image technology
+and the key to the success of efforts like Project Open Book is to
+provide a means of both preserving and improving access to those
+deteriorated materials.
+
+SESSION IV-B
+
+George THOMA
+
+In the use of electronic imaging for document preservation, there are
+several issues to consider, such as: ensuring adequate image quality,
+maintaining substantial conversion rates (through-put), providing unique
+identification for automated access and retrieval, and accommodating
+bound volumes and fragile material.
+
+To maintain high image quality, image processing functions are required
+to correct the deficiencies in the scanned image. Some commercially
+available systems include these functions, while some do not. The
+scanned raw image must be processed to correct contrast deficiencies--
+both poor overall contrast resulting from light print and/or dark
+background, and variable contrast resulting from stains and
+bleed-through. Furthermore, the scan density must be adequate to allow
+legibility of print and sufficient fidelity in the pseudo-halftoned gray
+material. Borders or page-edge effects must be removed for both
+compactibility and aesthetics. Page skew must be corrected for aesthetic
+reasons and to enable accurate character recognition if desired.
+Compound images consisting of both two-toned text and gray-scale
+illustrations must be processed appropriately to retain the quality of
+each.
+
+SESSION IV-C
+
+Jean BARONAS
+
+Standards publications being developed by scientists, engineers, and
+business managers in Association for Information and Image Management
+(AIIM) standards committees can be applied to electronic image management
+(EIM) processes including: document (image) transfer, retrieval and
+evaluation; optical disk and document scanning; and document design and
+conversion. When combined with EIM system planning and operations,
+standards can assist in generating image databases that are
+interchangeable among a variety of systems. The applications of
+different approaches for image-tagging, indexing, compression, and
+transfer often cause uncertainty concerning EIM system compatibility,
+calibration, performance, and upward compatibility, until standard
+implementation parameters are established. The AIIM standards that are
+being developed for these applications can be used to decrease the
+uncertainty, successfully integrate imaging processes, and promote "open
+systems." AIIM is an accredited American National Standards Institute
+(ANSI) standards developer with more than twenty committees comprised of
+300 volunteers representing users, vendors, and manufacturers. The
+standards publications that are developed in these committees have
+national acceptance and provide the basis for international harmonization
+in the development of new International Organization for Standardization
+(ISO) standards.
+
+This presentation describes the development of AIIM's EIM standards and a
+new effort at AIIM, a database on standards projects in a wide framework
+of imaging industries including capture, recording, processing,
+duplication, distribution, display, evaluation, and preservation. The
+AIIM Imagery Database will cover imaging standards being developed by
+many organizations in many different countries. It will contain
+standards publications' dates, origins, related national and
+international projects, status, key words, and abstracts. The ANSI Image
+Technology Standards Board requested that such a database be established,
+as did the ISO/International Electrotechnical Commission Joint Task Force
+on Imagery. AIIM will take on the leadership role for the database and
+coordinate its development with several standards developers.
+
+Patricia BATTIN
+
+ Characteristics of standards for digital imagery:
+
+ * Nature of digital technology implies continuing volatility.
+
+ * Precipitous standard-setting not possible and probably not
+ desirable.
+
+ * Standards are a complex issue involving the medium, the
+ hardware, the software, and the technical capacity for
+ reproductive fidelity and clarity.
+
+ * The prognosis for reliable archival standards (as defined by
+ librarians) in the foreseeable future is poor.
+
+ Significant potential and attractiveness of digital technology as a
+ preservation medium and access mechanism.
+
+ Productive use of digital imagery for preservation requires a
+ reconceptualizing of preservation principles in a volatile,
+ standardless world.
+
+ Concept of managing continuing access in the digital environment
+ rather than focusing on the permanence of the medium and long-term
+ archival standards developed for the analog world.
+
+ Transition period: How long and what to do?
+
+ * Redefine "archival."
+
+ * Remove the burden of "archival copy" from paper artifacts.
+
+ * Use digital technology for storage, develop management
+ strategies for refreshing medium, hardware and software.
+
+ * Create acid-free paper copies for transition period backup
+ until we develop reliable procedures for ensuring continuing
+ access to digital files.
+
+SESSION IV-D
+
+Stuart WEIBEL The Role of SGML Markup in the CORE Project (6)
+
+The emergence of high-speed telecommunications networks as a basic
+feature of the scholarly workplace is driving the demand for electronic
+document delivery. Three distinct categories of electronic
+publishing/republishing are necessary to support access demands in this
+emerging environment:
+
+ 1.) Conversion of paper or microfilm archives to electronic format
+ 2.) Conversion of electronic files to formats tailored to
+ electronic retrieval and display
+ 3.) Primary electronic publishing (materials for which the
+ electronic version is the primary format)
+
+OCLC has experimental or product development activities in each of these
+areas. Among the challenges that lie ahead is the integration of these
+three types of information stores in coherent distributed systems.
+
+The CORE (Chemistry Online Retrieval Experiment) Project is a model for
+the conversion of large text and graphics collections for which
+electronic typesetting files are available (category 2). The American
+Chemical Society has made available computer typography files dating from
+1980 for its twenty journals. This collection of some 250 journal-years
+is being converted to an electronic format that will be accessible
+through several end-user applications.
+
+The use of Standard Generalized Markup Language (SGML) offers the means
+to capture the structural richness of the original articles in a way that
+will support a variety of retrieval, navigation, and display options
+necessary to navigate effectively in very large text databases.
+
+An SGML document consists of text that is marked up with descriptive tags
+that specify the function of a given element within the document. As a
+formal language construct, an SGML document can be parsed against a
+document-type definition (DTD) that unambiguously defines what elements
+are allowed and where in the document they can (or must) occur. This
+formalized map of article structure allows the user interface design to
+be uncoupled from the underlying database system, an important step
+toward interoperability. Demonstration of this separability is a part of
+the CORE project, wherein user interface designs born of very different
+philosophies will access the same database.
+
+NOTES:
+ (6) The CORE project is a collaboration among Cornell University's
+ Mann Library, Bell Communications Research (Bellcore), the American
+ Chemical Society (ACS), the Chemical Abstracts Service (CAS), and
+ OCLC.
+
+Michael LESK The CORE Electronic Chemistry Library
+
+A major on-line file of chemical journal literature complete with
+graphics is being developed to test the usability of fully electronic
+access to documents, as a joint project of Cornell University, the
+American Chemical Society, the Chemical Abstracts Service, OCLC, and
+Bellcore (with additional support from Sun Microsystems, Springer-Verlag,
+DigitaI Equipment Corporation, Sony Corporation of America, and Apple
+Computers). Our file contains the American Chemical Society's on-line
+journals, supplemented with the graphics from the paper publication. The
+indexing of the articles from Chemical Abstracts Documents is available
+in both image and text format, and several different interfaces can be
+used. Our goals are (1) to assess the effectiveness and acceptability of
+electronic access to primary journals as compared with paper, and (2) to
+identify the most desirable functions of the user interface to an
+electronic system of journals, including in particular a comparison of
+page-image display with ASCII display interfaces. Early experiments with
+chemistry students on a variety of tasks suggest that searching tasks are
+completed much faster with any electronic system than with paper, but
+that for reading all versions of the articles are roughly equivalent.
+
+Pamela ANDRE and Judith ZIDAR
+
+Text conversion is far more expensive and time-consuming than image
+capture alone. NAL's experience with optical character recognition (OCR)
+will be related and compared with the experience of having text rekeyed.
+What factors affect OCR accuracy? How accurate does full text have to be
+in order to be useful? How do different users react to imperfect text?
+These are questions that will be explored. For many, a service bureau
+may be a better solution than performing the work inhouse; this will also
+be discussed.
+
+SESSION VI
+
+Marybeth PETERS
+
+Copyright law protects creative works. Protection granted by the law to
+authors and disseminators of works includes the right to do or authorize
+the following: reproduce the work, prepare derivative works, distribute
+the work to the public, and publicly perform or display the work. In
+addition, copyright owners of sound recordings and computer programs have
+the right to control rental of their works. These rights are not
+unlimited; there are a number of exceptions and limitations.
+
+An electronic environment places strains on the copyright system.
+Copyright owners want to control uses of their work and be paid for any
+use; the public wants quick and easy access at little or no cost. The
+marketplace is working in this area. Contracts, guidelines on electronic
+use, and collective licensing are in use and being refined.
+
+Issues concerning the ability to change works without detection are more
+difficult to deal with. Questions concerning the integrity of the work
+and the status of the changed version under the copyright law are to be
+addressed. These are public policy issues which require informed
+dialogue.
+
+
+ *** *** *** ****** *** *** ***
+
+
+ Appendix III: DIRECTORY OF PARTICIPANTS
+
+
+PRESENTERS:
+
+ Pamela Q.J. Andre
+ Associate Director, Automation
+ National Agricultural Library
+ 10301 Baltimore Boulevard
+ Beltsville, MD 20705-2351
+ Phone: (301) 504-6813
+ Fax: (301) 504-7473
+ E-mail: INTERNET: PANDRE@ASRR.ARSUSDA.GOV
+
+ Jean Baronas, Senior Manager
+ Department of Standards and Technology
+ Association for Information and Image Management (AIIM)
+ 1100 Wayne Avenue, Suite 1100
+ Silver Spring, MD 20910
+ Phone: (301) 587-8202
+ Fax: (301) 587-2711
+
+ Patricia Battin, President
+ The Commission on Preservation and Access
+ 1400 16th Street, N.W.
+ Suite 740
+ Washington, DC 20036-2217
+ Phone: (202) 939-3400
+ Fax: (202) 939-3407
+ E-mail: CPA@GWUVM.BITNET
+
+ Howard Besser
+ Centre Canadien d'Architecture
+ (Canadian Center for Architecture)
+ 1920, rue Baile
+ Montreal, Quebec H3H 2S6
+ CANADA
+ Phone: (514) 939-7001
+ Fax: (514) 939-7020
+ E-mail: howard@lis.pitt.edu
+
+ Edwin B. Brownrigg, Executive Director
+ Memex Research Institute
+ 422 Bonita Avenue
+ Roseville, CA 95678
+ Phone: (916) 784-2298
+ Fax: (916) 786-7559
+ E-mail: BITNET: MEMEX@CALSTATE.2
+
+ Eric M. Calaluca, Vice President
+ Chadwyck-Healey, Inc.
+ 1101 King Street
+ Alexandria, VA 223l4
+ Phone: (800) 752-05l5
+ Fax: (703) 683-7589
+
+ James Daly
+ 4015 Deepwood Road
+ Baltimore, MD 21218-1404
+ Phone: (410) 235-0763
+
+ Ricky Erway, Associate Coordinator
+ American Memory
+ Library of Congress
+ Phone: (202) 707-6233
+ Fax: (202) 707-3764
+
+ Carl Fleischhauer, Coordinator
+ American Memory
+ Library of Congress
+ Phone: (202) 707-6233
+ Fax: (202) 707-3764
+
+ Joanne Freeman
+ 2000 Jefferson Park Avenue, No. 7
+ Charlottesville, VA 22903
+
+ Prosser Gifford
+ Director for Scholarly Programs
+ Library of Congress
+ Phone: (202) 707-1517
+ Fax: (202) 707-9898
+ E-mail: pgif@seq1.loc.gov
+
+ Jacqueline Hess, Director
+ National Demonstration Laboratory
+ for Interactive Information Technologies
+ Library of Congress
+ Phone: (202) 707-4157
+ Fax: (202) 707-2829
+
+ Susan Hockey, Director
+ Center for Electronic Texts in the Humanities (CETH)
+ Alexander Library
+ Rutgers University
+ 169 College Avenue
+ New Brunswick, NJ 08903
+ Phone: (908) 932-1384
+ Fax: (908) 932-1386
+ E-mail: hockey@zodiac.rutgers.edu
+
+ William L. Hooton, Vice President
+ Business & Technical Development
+ Imaging & Information Systems Group
+ I-NET
+ 6430 Rockledge Drive, Suite 400
+ Bethesda, MD 208l7
+ Phone: (301) 564-6750
+ Fax: (513) 564-6867
+
+ Anne R. Kenney, Associate Director
+ Department of Preservation and Conservation
+ 701 Olin Library
+ Cornell University
+ Ithaca, NY 14853
+ Phone: (607) 255-6875
+ Fax: (607) 255-9346
+ E-mail: LYDY@CORNELLA.BITNET
+
+ Ronald L. Larsen
+ Associate Director for Information Technology
+ University of Maryland at College Park
+ Room B0224, McKeldin Library
+ College Park, MD 20742-7011
+ Phone: (301) 405-9194
+ Fax: (301) 314-9865
+ E-mail: rlarsen@libr.umd.edu
+
+ Maria L. Lebron, Managing Editor
+ The Online Journal of Current Clinical Trials
+ l333 H Street, N.W.
+ Washington, DC 20005
+ Phone: (202) 326-6735
+ Fax: (202) 842-2868
+ E-mail: PUBSAAAS@GWUVM.BITNET
+
+ Michael Lesk, Executive Director
+ Computer Science Research
+ Bell Communications Research, Inc.
+ Rm 2A-385
+ 445 South Street
+ Morristown, NJ 07960-l9l0
+ Phone: (201) 829-4070
+ Fax: (201) 829-5981
+ E-mail: lesk@bellcore.com (Internet) or bellcore!lesk (uucp)
+
+ Clifford A. Lynch
+ Director, Library Automation
+ University of California,
+ Office of the President
+ 300 Lakeside Drive, 8th Floor
+ Oakland, CA 94612-3350
+ Phone: (510) 987-0522
+ Fax: (510) 839-3573
+ E-mail: calur@uccmvsa
+
+ Avra Michelson
+ National Archives and Records Administration
+ NSZ Rm. 14N
+ 7th & Pennsylvania, N.W.
+ Washington, D.C. 20408
+ Phone: (202) 501-5544
+ Fax: (202) 501-5533
+ E-mail: tmi@cu.nih.gov
+
+ Elli Mylonas, Managing Editor
+ Perseus Project
+ Department of the Classics
+ Harvard University
+ 319 Boylston Hall
+ Cambridge, MA 02138
+ Phone: (617) 495-9025, (617) 495-0456 (direct)
+ Fax: (617) 496-8886
+ E-mail: Elli@IKAROS.Harvard.EDU or elli@wjh12.harvard.edu
+
+ David Woodley Packard
+ Packard Humanities Institute
+ 300 Second Street, Suite 201
+ Los Altos, CA 94002
+ Phone: (415) 948-0150 (PHI)
+ Fax: (415) 948-5793
+
+ Lynne K. Personius, Assistant Director
+ Cornell Information Technologies for
+ Scholarly Information Sources
+ 502 Olin Library
+ Cornell University
+ Ithaca, NY 14853
+ Phone: (607) 255-3393
+ Fax: (607) 255-9346
+ E-mail: JRN@CORNELLC.BITNET
+
+ Marybeth Peters
+ Policy Planning Adviser to the
+ Register of Copyrights
+ Library of Congress
+ Office LM 403
+ Phone: (202) 707-8350
+ Fax: (202) 707-8366
+
+ C. Michael Sperberg-McQueen
+ Editor, Text Encoding Initiative
+ Computer Center (M/C 135)
+ University of Illinois at Chicago
+ Box 6998
+ Chicago, IL 60680
+ Phone: (312) 413-0317
+ Fax: (312) 996-6834
+ E-mail: u35395@uicvm..cc.uic.edu or u35395@uicvm.bitnet
+
+ George R. Thoma, Chief
+ Communications Engineering Branch
+ National Library of Medicine
+ 8600 Rockville Pike
+ Bethesda, MD 20894
+ Phone: (301) 496-4496
+ Fax: (301) 402-0341
+ E-mail: thoma@lhc.nlm.nih.gov
+
+ Dorothy Twohig, Editor
+ The Papers of George Washington
+ 504 Alderman Library
+ University of Virginia
+ Charlottesville, VA 22903-2498
+ Phone: (804) 924-0523
+ Fax: (804) 924-4337
+
+ Susan H. Veccia, Team leader
+ American Memory, User Evaluation
+ Library of Congress
+ American Memory Evaluation Project
+ Phone: (202) 707-9104
+ Fax: (202) 707-3764
+ E-mail: svec@seq1.loc.gov
+
+ Donald J. Waters, Head
+ Systems Office
+ Yale University Library
+ New Haven, CT 06520
+ Phone: (203) 432-4889
+ Fax: (203) 432-7231
+ E-mail: DWATERS@YALEVM.BITNET or DWATERS@YALEVM.YCC.YALE.EDU
+
+ Stuart Weibel, Senior Research Scientist
+ OCLC
+ 6565 Frantz Road
+ Dublin, OH 43017
+ Phone: (614) 764-608l
+ Fax: (614) 764-2344
+ E-mail: INTERNET: Stu@rsch.oclc.org
+
+ Robert G. Zich
+ Special Assistant to the Associate Librarian
+ for Special Projects
+ Library of Congress
+ Phone: (202) 707-6233
+ Fax: (202) 707-3764
+ E-mail: rzic@seq1.loc.gov
+
+ Judith A. Zidar, Coordinator
+ National Agricultural Text Digitizing Program
+ Information Systems Division
+ National Agricultural Library
+ 10301 Baltimore Boulevard
+ Beltsville, MD 20705-2351
+ Phone: (301) 504-6813 or 504-5853
+ Fax: (301) 504-7473
+ E-mail: INTERNET: JZIDAR@ASRR.ARSUSDA.GOV
+
+
+OBSERVERS:
+
+ Helen Aguera, Program Officer
+ Division of Research
+ Room 318
+ National Endowment for the Humanities
+ 1100 Pennsylvania Avenue, N.W.
+ Washington, D.C. 20506
+ Phone: (202) 786-0358
+ Fax: (202) 786-0243
+
+ M. Ellyn Blanton, Deputy Director
+ National Demonstration Laboratory
+ for Interactive Information Technologies
+ Library of Congress
+ Phone: (202) 707-4157
+ Fax: (202) 707-2829
+
+ Charles M. Dollar
+ National Archives and Records Administration
+ NSZ Rm. 14N
+ 7th & Pennsylvania, N.W.
+ Washington, DC 20408
+ Phone: (202) 501-5532
+ Fax: (202) 501-5512
+
+ Jeffrey Field, Deputy to the Director
+ Division of Preservation and Access
+ Room 802
+ National Endowment for the Humanities
+ 1100 Pennsylvania Avenue, N.W.
+ Washington, DC 20506
+ Phone: (202) 786-0570
+ Fax: (202) 786-0243
+
+ Lorrin Garson
+ American Chemical Society
+ Research and Development Department
+ 1155 16th Street, N.W.
+ Washington, D.C. 20036
+ Phone: (202) 872-4541
+ Fax: E-mail: INTERNET: LRG96@ACS.ORG
+
+ William M. Holmes, Jr.
+ National Archives and Records Administration
+ NSZ Rm. 14N
+ 7th & Pennsylvania, N.W.
+ Washington, DC 20408
+ Phone: (202) 501-5540
+ Fax: (202) 501-5512
+ E-mail: WHOLMES@AMERICAN.EDU
+
+ Sperling Martin
+ Information Resource Management
+ 20030 Doolittle Street
+ Gaithersburg, MD 20879
+ Phone: (301) 924-1803
+
+ Michael Neuman, Director
+ The Center for Text and Technology
+ Academic Computing Center
+ 238 Reiss Science Building
+ Georgetown University
+ Washington, DC 20057
+ Phone: (202) 687-6096
+ Fax: (202) 687-6003
+ E-mail: neuman@guvax.bitnet, neuman@guvax.georgetown.edu
+
+ Barbara Paulson, Program Officer
+ Division of Preservation and Access
+ Room 802
+ National Endowment for the Humanities
+ 1100 Pennsylvania Avenue, N.W.
+ Washington, DC 20506
+ Phone: (202) 786-0577
+ Fax: (202) 786-0243
+
+ Allen H. Renear
+ Senior Academic Planning Analyst
+ Brown University Computing and Information Services
+ 115 Waterman Street
+ Campus Box 1885
+ Providence, R.I. 02912
+ Phone: (401) 863-7312
+ Fax: (401) 863-7329
+ E-mail: BITNET: Allen@BROWNVM or
+ INTERNET: Allen@brownvm.brown.edu
+
+ Susan M. Severtson, President
+ Chadwyck-Healey, Inc.
+ 1101 King Street
+ Alexandria, VA 223l4
+ Phone: (800) 752-05l5
+ Fax: (703) 683-7589
+
+ Frank Withrow
+ U.S. Department of Education
+ 555 New Jersey Avenue, N.W.
+ Washington, DC 20208-5644
+ Phone: (202) 219-2200
+ Fax: (202) 219-2106
+
+
+(LC STAFF)
+
+ Linda L. Arret
+ Machine-Readable Collections Reading Room LJ 132
+ (202) 707-1490
+
+ John D. Byrum, Jr.
+ Descriptive Cataloging Division LM 540
+ (202) 707-5194
+
+ Mary Jane Cavallo
+ Science and Technology Division LA 5210
+ (202) 707-1219
+
+ Susan Thea David
+ Congressional Research Service LM 226
+ (202) 707-7169
+
+ Robert Dierker
+ Senior Adviser for Multimedia Activities LM 608
+ (202) 707-6151
+
+ William W. Ellis
+ Associate Librarian for Science and Technology LM 611
+ (202) 707-6928
+
+ Ronald Gephart
+ Manuscript Division LM 102
+ (202) 707-5097
+
+ James Graber
+ Information Technology Services LM G51
+ (202) 707-9628
+
+ Rich Greenfield
+ American Memory LM 603
+ (202) 707-6233
+
+ Rebecca Guenther
+ Network Development LM 639
+ (202) 707-5092
+
+ Kenneth E. Harris
+ Preservation LM G21
+ (202) 707-5213
+
+ Staley Hitchcock
+ Manuscript Division LM 102
+ (202) 707-5383
+
+ Bohdan Kantor
+ Office of Special Projects LM 612
+ (202) 707-0180
+
+ John W. Kimball, Jr
+ Machine-Readable Collections Reading Room LJ 132
+ (202) 707-6560
+
+ Basil Manns
+ Information Technology Services LM G51
+ (202) 707-8345
+
+ Sally Hart McCallum
+ Network Development LM 639
+ (202) 707-6237
+
+ Dana J. Pratt
+ Publishing Office LM 602
+ (202) 707-6027
+
+ Jane Riefenhauser
+ American Memory LM 603
+ (202) 707-6233
+
+ William Z. Schenck
+ Collections Development LM 650
+ (202) 707-7706
+
+ Chandru J. Shahani
+ Preservation Research and Testing Office (R&T) LM G38
+ (202) 707-5607
+
+ William J. Sittig
+ Collections Development LM 650
+ (202) 707-7050
+
+ Paul Smith
+ Manuscript Division LM 102
+ (202) 707-5097
+
+ James L. Stevens
+ Information Technology Services LM G51
+ (202) 707-9688
+
+ Karen Stuart
+ Manuscript Division LM 130
+ (202) 707-5389
+
+ Tamara Swora
+ Preservation Microfilming Office LM G05
+ (202) 707-6293
+
+ Sarah Thomas
+ Collections Cataloging LM 642
+ (202) 707-5333
+
+
+ END
+ *************************************************************
+
+Note: This file has been edited for use on computer networks. This
+editing required the removal of diacritics, underlining, and fonts such
+as italics and bold.
+
+kde 11/92
+
+[A few of the italics (when used for emphasis) were replaced by CAPS mh]
+
+*End of The Project Gutenberg Etext of LOC WORKSHOP ON ELECTRONIC ETEXTS
+
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/lcet10.txt.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/lcet10.txt.compressed
new file mode 100644
index 000000000..b7d0f633c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/lcet10.txt.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/mapsdatazrh b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/mapsdatazrh
new file mode 100644
index 000000000..037118364
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/mapsdatazrh
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/mapsdatazrh.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/mapsdatazrh.compressed
new file mode 100644
index 000000000..77bfa4717
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/mapsdatazrh.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/monkey b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/monkey
new file mode 100644
index 000000000..47408cd68
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/monkey
@@ -0,0 +1 @@
+znxcvnmz,xvnm.,zxcnv.,xcn.z,vn.zvn.zxcvn.,zxcn.vn.v,znm.,vnzx.,vnzxc.vn.z,vnz.,nv.z,nvmzxc,nvzxcvcnm.,vczxvnzxcnvmxc.zmcnvzm.,nvmc,nzxmc,vn.mnnmzxc,vnxcnmv,znvzxcnmv,.xcnvm,zxcnzxv.zx,qweryweurqioweupropqwutioweupqrioweutiopweuriopweuriopqwurioputiopqwuriowuqerioupqweropuweropqwurweuqriopuropqwuriopuqwriopuqweopruioqweurqweuriouqweopruioupqiytioqtyiowtyqptypryoqweutioioqtweqruowqeytiowquiourowetyoqwupiotweuqiorweuqroipituqwiorqwtioweuriouytuioerytuioweryuitoweytuiweyuityeruirtyuqriqweuropqweiruioqweurioqwuerioqwyuituierwotueryuiotweyrtuiwertyioweryrueioqptyioruyiopqwtjkasdfhlafhlasdhfjklashjkfhasjklfhklasjdfhklasdhfjkalsdhfklasdhjkflahsjdkfhklasfhjkasdfhasfjkasdhfklsdhalghhaf;hdklasfhjklashjklfasdhfasdjklfhsdjklafsd;hkldadfjjklasdhfjasddfjklfhakjklasdjfkl;asdjfasfljasdfhjklasdfhjkaghjkashf;djfklasdjfkljasdklfjklasdjfkljasdfkljaklfj \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/monkey.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/monkey.compressed
new file mode 100644
index 000000000..bbcf13440
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/monkey.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/plrabn12.txt b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/plrabn12.txt
new file mode 100644
index 000000000..34088b82c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/plrabn12.txt
@@ -0,0 +1,10699 @@
+
+This is the February 1992 Project Gutenberg release of:
+
+Paradise Lost by John Milton
+
+The oldest etext known to Project Gutenberg (ca. 1964-1965)
+(If you know of any older ones, please let us know.)
+
+
+Introduction (one page)
+
+This etext was originally created in 1964-1965 according to Dr.
+Joseph Raben of Queens College, NY, to whom it is attributed by
+Project Gutenberg. We had heard of this etext for years but it
+was not until 1991 that we actually managed to track it down to
+a specific location, and then it took months to convince people
+to let us have a copy, then more months for them actually to do
+the copying and get it to us. Then another month to convert to
+something we could massage with our favorite 486 in DOS. After
+that is was only a matter of days to get it into this shape you
+will see below. The original was, of course, in CAPS only, and
+so were all the other etexts of the 60's and early 70's. Don't
+let anyone fool you into thinking any etext with both upper and
+lower case is an original; all those original Project Gutenberg
+etexts were also in upper case and were translated or rewritten
+many times to get them into their current condition. They have
+been worked on by many people throughout the world.
+
+In the course of our searches for Professor Raben and his etext
+we were never able to determine where copies were or which of a
+variety of editions he may have used as a source. We did get a
+little information here and there, but even after we received a
+copy of the etext we were unwilling to release it without first
+determining that it was in fact Public Domain and finding Raben
+to verify this and get his permission. Interested enough, in a
+totally unrelated action to our searches for him, the professor
+subscribed to the Project Gutenberg listserver and we happened,
+by accident, to notice his name. (We don't really look at every
+subscription request as the computers usually handle them.) The
+etext was then properly identified, copyright analyzed, and the
+current edition prepared.
+
+To give you an estimation of the difference in the original and
+what we have today: the original was probably entered on cards
+commonly known at the time as "IBM cards" (Do Not Fold, Spindle
+or Mutilate) and probably took in excess of 100,000 of them. A
+single card could hold 80 characters (hence 80 characters is an
+accepted standard for so many computer margins), and the entire
+original edition we received in all caps was over 800,000 chars
+in length, including line enumeration, symbols for caps and the
+punctuation marks, etc., since they were not available keyboard
+characters at the time (probably the keyboards operated at baud
+rates of around 113, meaning the typists had to type slowly for
+the keyboard to keep up).
+
+This is the second version of Paradise Lost released by Project
+Gutenberg. The first was released as our October, 1991 etext.
+
+
+
+
+
+Paradise Lost
+
+
+
+
+Book I
+
+
+Of Man's first disobedience, and the fruit
+Of that forbidden tree whose mortal taste
+Brought death into the World, and all our woe,
+With loss of Eden, till one greater Man
+Restore us, and regain the blissful seat,
+Sing, Heavenly Muse, that, on the secret top
+Of Oreb, or of Sinai, didst inspire
+That shepherd who first taught the chosen seed
+In the beginning how the heavens and earth
+Rose out of Chaos: or, if Sion hill
+Delight thee more, and Siloa's brook that flowed
+Fast by the oracle of God, I thence
+Invoke thy aid to my adventurous song,
+That with no middle flight intends to soar
+Above th' Aonian mount, while it pursues
+Things unattempted yet in prose or rhyme.
+And chiefly thou, O Spirit, that dost prefer
+Before all temples th' upright heart and pure,
+Instruct me, for thou know'st; thou from the first
+Wast present, and, with mighty wings outspread,
+Dove-like sat'st brooding on the vast Abyss,
+And mad'st it pregnant: what in me is dark
+Illumine, what is low raise and support;
+That, to the height of this great argument,
+I may assert Eternal Providence,
+And justify the ways of God to men.
+ Say first--for Heaven hides nothing from thy view,
+Nor the deep tract of Hell--say first what cause
+Moved our grand parents, in that happy state,
+Favoured of Heaven so highly, to fall off
+From their Creator, and transgress his will
+For one restraint, lords of the World besides.
+Who first seduced them to that foul revolt?
+ Th' infernal Serpent; he it was whose guile,
+Stirred up with envy and revenge, deceived
+The mother of mankind, what time his pride
+Had cast him out from Heaven, with all his host
+Of rebel Angels, by whose aid, aspiring
+To set himself in glory above his peers,
+He trusted to have equalled the Most High,
+If he opposed, and with ambitious aim
+Against the throne and monarchy of God,
+Raised impious war in Heaven and battle proud,
+With vain attempt. Him the Almighty Power
+Hurled headlong flaming from th' ethereal sky,
+With hideous ruin and combustion, down
+To bottomless perdition, there to dwell
+In adamantine chains and penal fire,
+Who durst defy th' Omnipotent to arms.
+ Nine times the space that measures day and night
+To mortal men, he, with his horrid crew,
+Lay vanquished, rolling in the fiery gulf,
+Confounded, though immortal. But his doom
+Reserved him to more wrath; for now the thought
+Both of lost happiness and lasting pain
+Torments him: round he throws his baleful eyes,
+That witnessed huge affliction and dismay,
+Mixed with obdurate pride and steadfast hate.
+At once, as far as Angels ken, he views
+The dismal situation waste and wild.
+A dungeon horrible, on all sides round,
+As one great furnace flamed; yet from those flames
+No light; but rather darkness visible
+Served only to discover sights of woe,
+Regions of sorrow, doleful shades, where peace
+And rest can never dwell, hope never comes
+That comes to all, but torture without end
+Still urges, and a fiery deluge, fed
+With ever-burning sulphur unconsumed.
+Such place Eternal Justice has prepared
+For those rebellious; here their prison ordained
+In utter darkness, and their portion set,
+As far removed from God and light of Heaven
+As from the centre thrice to th' utmost pole.
+Oh how unlike the place from whence they fell!
+There the companions of his fall, o'erwhelmed
+With floods and whirlwinds of tempestuous fire,
+He soon discerns; and, weltering by his side,
+One next himself in power, and next in crime,
+Long after known in Palestine, and named
+Beelzebub. To whom th' Arch-Enemy,
+And thence in Heaven called Satan, with bold words
+Breaking the horrid silence, thus began:--
+ "If thou beest he--but O how fallen! how changed
+From him who, in the happy realms of light
+Clothed with transcendent brightness, didst outshine
+Myriads, though bright!--if he whom mutual league,
+United thoughts and counsels, equal hope
+And hazard in the glorious enterprise
+Joined with me once, now misery hath joined
+In equal ruin; into what pit thou seest
+From what height fallen: so much the stronger proved
+He with his thunder; and till then who knew
+The force of those dire arms? Yet not for those,
+Nor what the potent Victor in his rage
+Can else inflict, do I repent, or change,
+Though changed in outward lustre, that fixed mind,
+And high disdain from sense of injured merit,
+That with the Mightiest raised me to contend,
+And to the fierce contentions brought along
+Innumerable force of Spirits armed,
+That durst dislike his reign, and, me preferring,
+His utmost power with adverse power opposed
+In dubious battle on the plains of Heaven,
+And shook his throne. What though the field be lost?
+All is not lost--the unconquerable will,
+And study of revenge, immortal hate,
+And courage never to submit or yield:
+And what is else not to be overcome?
+That glory never shall his wrath or might
+Extort from me. To bow and sue for grace
+With suppliant knee, and deify his power
+Who, from the terror of this arm, so late
+Doubted his empire--that were low indeed;
+That were an ignominy and shame beneath
+This downfall; since, by fate, the strength of Gods,
+And this empyreal sybstance, cannot fail;
+Since, through experience of this great event,
+In arms not worse, in foresight much advanced,
+We may with more successful hope resolve
+To wage by force or guile eternal war,
+Irreconcilable to our grand Foe,
+Who now triumphs, and in th' excess of joy
+Sole reigning holds the tyranny of Heaven."
+ So spake th' apostate Angel, though in pain,
+Vaunting aloud, but racked with deep despair;
+And him thus answered soon his bold compeer:--
+ "O Prince, O Chief of many throned Powers
+That led th' embattled Seraphim to war
+Under thy conduct, and, in dreadful deeds
+Fearless, endangered Heaven's perpetual King,
+And put to proof his high supremacy,
+Whether upheld by strength, or chance, or fate,
+Too well I see and rue the dire event
+That, with sad overthrow and foul defeat,
+Hath lost us Heaven, and all this mighty host
+In horrible destruction laid thus low,
+As far as Gods and heavenly Essences
+Can perish: for the mind and spirit remains
+Invincible, and vigour soon returns,
+Though all our glory extinct, and happy state
+Here swallowed up in endless misery.
+But what if he our Conqueror (whom I now
+Of force believe almighty, since no less
+Than such could have o'erpowered such force as ours)
+Have left us this our spirit and strength entire,
+Strongly to suffer and support our pains,
+That we may so suffice his vengeful ire,
+Or do him mightier service as his thralls
+By right of war, whate'er his business be,
+Here in the heart of Hell to work in fire,
+Or do his errands in the gloomy Deep?
+What can it the avail though yet we feel
+Strength undiminished, or eternal being
+To undergo eternal punishment?"
+ Whereto with speedy words th' Arch-Fiend replied:--
+"Fallen Cherub, to be weak is miserable,
+Doing or suffering: but of this be sure--
+To do aught good never will be our task,
+But ever to do ill our sole delight,
+As being the contrary to his high will
+Whom we resist. If then his providence
+Out of our evil seek to bring forth good,
+Our labour must be to pervert that end,
+And out of good still to find means of evil;
+Which ofttimes may succeed so as perhaps
+Shall grieve him, if I fail not, and disturb
+His inmost counsels from their destined aim.
+But see! the angry Victor hath recalled
+His ministers of vengeance and pursuit
+Back to the gates of Heaven: the sulphurous hail,
+Shot after us in storm, o'erblown hath laid
+The fiery surge that from the precipice
+Of Heaven received us falling; and the thunder,
+Winged with red lightning and impetuous rage,
+Perhaps hath spent his shafts, and ceases now
+To bellow through the vast and boundless Deep.
+Let us not slip th' occasion, whether scorn
+Or satiate fury yield it from our Foe.
+Seest thou yon dreary plain, forlorn and wild,
+The seat of desolation, void of light,
+Save what the glimmering of these livid flames
+Casts pale and dreadful? Thither let us tend
+From off the tossing of these fiery waves;
+There rest, if any rest can harbour there;
+And, re-assembling our afflicted powers,
+Consult how we may henceforth most offend
+Our enemy, our own loss how repair,
+How overcome this dire calamity,
+What reinforcement we may gain from hope,
+If not, what resolution from despair."
+ Thus Satan, talking to his nearest mate,
+With head uplift above the wave, and eyes
+That sparkling blazed; his other parts besides
+Prone on the flood, extended long and large,
+Lay floating many a rood, in bulk as huge
+As whom the fables name of monstrous size,
+Titanian or Earth-born, that warred on Jove,
+Briareos or Typhon, whom the den
+By ancient Tarsus held, or that sea-beast
+Leviathan, which God of all his works
+Created hugest that swim th' ocean-stream.
+Him, haply slumbering on the Norway foam,
+The pilot of some small night-foundered skiff,
+Deeming some island, oft, as seamen tell,
+With fixed anchor in his scaly rind,
+Moors by his side under the lee, while night
+Invests the sea, and wished morn delays.
+So stretched out huge in length the Arch-fiend lay,
+Chained on the burning lake; nor ever thence
+Had risen, or heaved his head, but that the will
+And high permission of all-ruling Heaven
+Left him at large to his own dark designs,
+That with reiterated crimes he might
+Heap on himself damnation, while he sought
+Evil to others, and enraged might see
+How all his malice served but to bring forth
+Infinite goodness, grace, and mercy, shewn
+On Man by him seduced, but on himself
+Treble confusion, wrath, and vengeance poured.
+ Forthwith upright he rears from off the pool
+His mighty stature; on each hand the flames
+Driven backward slope their pointing spires, and,rolled
+In billows, leave i' th' midst a horrid vale.
+Then with expanded wings he steers his flight
+Aloft, incumbent on the dusky air,
+That felt unusual weight; till on dry land
+He lights--if it were land that ever burned
+With solid, as the lake with liquid fire,
+And such appeared in hue as when the force
+Of subterranean wind transprots a hill
+Torn from Pelorus, or the shattered side
+Of thundering Etna, whose combustible
+And fuelled entrails, thence conceiving fire,
+Sublimed with mineral fury, aid the winds,
+And leave a singed bottom all involved
+With stench and smoke. Such resting found the sole
+Of unblest feet. Him followed his next mate;
+Both glorying to have scaped the Stygian flood
+As gods, and by their own recovered strength,
+Not by the sufferance of supernal Power.
+ "Is this the region, this the soil, the clime,"
+Said then the lost Archangel, "this the seat
+That we must change for Heaven?--this mournful gloom
+For that celestial light? Be it so, since he
+Who now is sovereign can dispose and bid
+What shall be right: farthest from him is best
+Whom reason hath equalled, force hath made supreme
+Above his equals. Farewell, happy fields,
+Where joy for ever dwells! Hail, horrors! hail,
+Infernal world! and thou, profoundest Hell,
+Receive thy new possessor--one who brings
+A mind not to be changed by place or time.
+The mind is its own place, and in itself
+Can make a Heaven of Hell, a Hell of Heaven.
+What matter where, if I be still the same,
+And what I should be, all but less than he
+Whom thunder hath made greater? Here at least
+We shall be free; th' Almighty hath not built
+Here for his envy, will not drive us hence:
+Here we may reigh secure; and, in my choice,
+To reign is worth ambition, though in Hell:
+Better to reign in Hell than serve in Heaven.
+But wherefore let we then our faithful friends,
+Th' associates and co-partners of our loss,
+Lie thus astonished on th' oblivious pool,
+And call them not to share with us their part
+In this unhappy mansion, or once more
+With rallied arms to try what may be yet
+Regained in Heaven, or what more lost in Hell?"
+ So Satan spake; and him Beelzebub
+Thus answered:--"Leader of those armies bright
+Which, but th' Omnipotent, none could have foiled!
+If once they hear that voice, their liveliest pledge
+Of hope in fears and dangers--heard so oft
+In worst extremes, and on the perilous edge
+Of battle, when it raged, in all assaults
+Their surest signal--they will soon resume
+New courage and revive, though now they lie
+Grovelling and prostrate on yon lake of fire,
+As we erewhile, astounded and amazed;
+No wonder, fallen such a pernicious height!"
+ He scare had ceased when the superior Fiend
+Was moving toward the shore; his ponderous shield,
+Ethereal temper, massy, large, and round,
+Behind him cast. The broad circumference
+Hung on his shoulders like the moon, whose orb
+Through optic glass the Tuscan artist views
+At evening, from the top of Fesole,
+Or in Valdarno, to descry new lands,
+Rivers, or mountains, in her spotty globe.
+His spear--to equal which the tallest pine
+Hewn on Norwegian hills, to be the mast
+Of some great ammiral, were but a wand--
+He walked with, to support uneasy steps
+Over the burning marl, not like those steps
+On Heaven's azure; and the torrid clime
+Smote on him sore besides, vaulted with fire.
+Nathless he so endured, till on the beach
+Of that inflamed sea he stood, and called
+His legions--Angel Forms, who lay entranced
+Thick as autumnal leaves that strow the brooks
+In Vallombrosa, where th' Etrurian shades
+High over-arched embower; or scattered sedge
+Afloat, when with fierce winds Orion armed
+Hath vexed the Red-Sea coast, whose waves o'erthrew
+Busiris and his Memphian chivalry,
+While with perfidious hatred they pursued
+The sojourners of Goshen, who beheld
+From the safe shore their floating carcases
+And broken chariot-wheels. So thick bestrown,
+Abject and lost, lay these, covering the flood,
+Under amazement of their hideous change.
+He called so loud that all the hollow deep
+Of Hell resounded:--"Princes, Potentates,
+Warriors, the Flower of Heaven--once yours; now lost,
+If such astonishment as this can seize
+Eternal Spirits! Or have ye chosen this place
+After the toil of battle to repose
+Your wearied virtue, for the ease you find
+To slumber here, as in the vales of Heaven?
+Or in this abject posture have ye sworn
+To adore the Conqueror, who now beholds
+Cherub and Seraph rolling in the flood
+With scattered arms and ensigns, till anon
+His swift pursuers from Heaven-gates discern
+Th' advantage, and, descending, tread us down
+Thus drooping, or with linked thunderbolts
+Transfix us to the bottom of this gulf?
+Awake, arise, or be for ever fallen!"
+ They heard, and were abashed, and up they sprung
+Upon the wing, as when men wont to watch
+On duty, sleeping found by whom they dread,
+Rouse and bestir themselves ere well awake.
+Nor did they not perceive the evil plight
+In which they were, or the fierce pains not feel;
+Yet to their General's voice they soon obeyed
+Innumerable. As when the potent rod
+Of Amram's son, in Egypt's evil day,
+Waved round the coast, up-called a pitchy cloud
+Of locusts, warping on the eastern wind,
+That o'er the realm of impious Pharaoh hung
+Like Night, and darkened all the land of Nile;
+So numberless were those bad Angels seen
+Hovering on wing under the cope of Hell,
+'Twixt upper, nether, and surrounding fires;
+Till, as a signal given, th' uplifted spear
+Of their great Sultan waving to direct
+Their course, in even balance down they light
+On the firm brimstone, and fill all the plain:
+A multitude like which the populous North
+Poured never from her frozen loins to pass
+Rhene or the Danaw, when her barbarous sons
+Came like a deluge on the South, and spread
+Beneath Gibraltar to the Libyan sands.
+Forthwith, form every squadron and each band,
+The heads and leaders thither haste where stood
+Their great Commander--godlike Shapes, and Forms
+Excelling human; princely Dignities;
+And Powers that erst in Heaven sat on thrones,
+Though on their names in Heavenly records now
+Be no memorial, blotted out and rased
+By their rebellion from the Books of Life.
+Nor had they yet among the sons of Eve
+Got them new names, till, wandering o'er the earth,
+Through God's high sufferance for the trial of man,
+By falsities and lies the greatest part
+Of mankind they corrupted to forsake
+God their Creator, and th' invisible
+Glory of him that made them to transform
+Oft to the image of a brute, adorned
+With gay religions full of pomp and gold,
+And devils to adore for deities:
+Then were they known to men by various names,
+And various idols through the heathen world.
+ Say, Muse, their names then known, who first, who last,
+Roused from the slumber on that fiery couch,
+At their great Emperor's call, as next in worth
+Came singly where he stood on the bare strand,
+While the promiscuous crowd stood yet aloof?
+ The chief were those who, from the pit of Hell
+Roaming to seek their prey on Earth, durst fix
+Their seats, long after, next the seat of God,
+Their altars by his altar, gods adored
+Among the nations round, and durst abide
+Jehovah thundering out of Sion, throned
+Between the Cherubim; yea, often placed
+Within his sanctuary itself their shrines,
+Abominations; and with cursed things
+His holy rites and solemn feasts profaned,
+And with their darkness durst affront his light.
+First, Moloch, horrid king, besmeared with blood
+Of human sacrifice, and parents' tears;
+Though, for the noise of drums and timbrels loud,
+Their children's cries unheard that passed through fire
+To his grim idol. Him the Ammonite
+Worshiped in Rabba and her watery plain,
+In Argob and in Basan, to the stream
+Of utmost Arnon. Nor content with such
+Audacious neighbourhood, the wisest heart
+Of Solomon he led by fraoud to build
+His temple right against the temple of God
+On that opprobrious hill, and made his grove
+The pleasant valley of Hinnom, Tophet thence
+And black Gehenna called, the type of Hell.
+Next Chemos, th' obscene dread of Moab's sons,
+From Aroar to Nebo and the wild
+Of southmost Abarim; in Hesebon
+And Horonaim, Seon's real, beyond
+The flowery dale of Sibma clad with vines,
+And Eleale to th' Asphaltic Pool:
+Peor his other name, when he enticed
+Israel in Sittim, on their march from Nile,
+To do him wanton rites, which cost them woe.
+Yet thence his lustful orgies he enlarged
+Even to that hill of scandal, by the grove
+Of Moloch homicide, lust hard by hate,
+Till good Josiah drove them thence to Hell.
+With these came they who, from the bordering flood
+Of old Euphrates to the brook that parts
+Egypt from Syrian ground, had general names
+Of Baalim and Ashtaroth--those male,
+These feminine. For Spirits, when they please,
+Can either sex assume, or both; so soft
+And uncompounded is their essence pure,
+Not tried or manacled with joint or limb,
+Nor founded on the brittle strength of bones,
+Like cumbrous flesh; but, in what shape they choose,
+Dilated or condensed, bright or obscure,
+Can execute their airy purposes,
+And works of love or enmity fulfil.
+For those the race of Israel oft forsook
+Their Living Strength, and unfrequented left
+His righteous altar, bowing lowly down
+To bestial gods; for which their heads as low
+Bowed down in battle, sunk before the spear
+Of despicable foes. With these in troop
+Came Astoreth, whom the Phoenicians called
+Astarte, queen of heaven, with crescent horns;
+To whose bright image nigntly by the moon
+Sidonian virgins paid their vows and songs;
+In Sion also not unsung, where stood
+Her temple on th' offensive mountain, built
+By that uxorious king whose heart, though large,
+Beguiled by fair idolatresses, fell
+To idols foul. Thammuz came next behind,
+Whose annual wound in Lebanon allured
+The Syrian damsels to lament his fate
+In amorous ditties all a summer's day,
+While smooth Adonis from his native rock
+Ran purple to the sea, supposed with blood
+Of Thammuz yearly wounded: the love-tale
+Infected Sion's daughters with like heat,
+Whose wanton passions in the sacred proch
+Ezekiel saw, when, by the vision led,
+His eye surveyed the dark idolatries
+Of alienated Judah. Next came one
+Who mourned in earnest, when the captive ark
+Maimed his brute image, head and hands lopt off,
+In his own temple, on the grunsel-edge,
+Where he fell flat and shamed his worshippers:
+Dagon his name, sea-monster,upward man
+And downward fish; yet had his temple high
+Reared in Azotus, dreaded through the coast
+Of Palestine, in Gath and Ascalon,
+And Accaron and Gaza's frontier bounds.
+Him followed Rimmon, whose delightful seat
+Was fair Damascus, on the fertile banks
+Of Abbana and Pharphar, lucid streams.
+He also against the house of God was bold:
+A leper once he lost, and gained a king--
+Ahaz, his sottish conqueror, whom he drew
+God's altar to disparage and displace
+For one of Syrian mode, whereon to burn
+His odious offerings, and adore the gods
+Whom he had vanquished. After these appeared
+A crew who, under names of old renown--
+Osiris, Isis, Orus, and their train--
+With monstrous shapes and sorceries abused
+Fanatic Egypt and her priests to seek
+Their wandering gods disguised in brutish forms
+Rather than human. Nor did Israel scape
+Th' infection, when their borrowed gold composed
+The calf in Oreb; and the rebel king
+Doubled that sin in Bethel and in Dan,
+Likening his Maker to the grazed ox--
+Jehovah, who, in one night, when he passed
+From Egypt marching, equalled with one stroke
+Both her first-born and all her bleating gods.
+Belial came last; than whom a Spirit more lewd
+Fell not from Heaven, or more gross to love
+Vice for itself. To him no temple stood
+Or altar smoked; yet who more oft than he
+In temples and at altars, when the priest
+Turns atheist, as did Eli's sons, who filled
+With lust and violence the house of God?
+In courts and palaces he also reigns,
+And in luxurious cities, where the noise
+Of riot ascends above their loftiest towers,
+And injury and outrage; and, when night
+Darkens the streets, then wander forth the sons
+Of Belial, flown with insolence and wine.
+Witness the streets of Sodom, and that night
+In Gibeah, when the hospitable door
+Exposed a matron, to avoid worse rape.
+ These were the prime in order and in might:
+The rest were long to tell; though far renowned
+Th' Ionian gods--of Javan's issue held
+Gods, yet confessed later than Heaven and Earth,
+Their boasted parents;--Titan, Heaven's first-born,
+With his enormous brood, and birthright seized
+By younger Saturn: he from mightier Jove,
+His own and Rhea's son, like measure found;
+So Jove usurping reigned. These, first in Crete
+And Ida known, thence on the snowy top
+Of cold Olympus ruled the middle air,
+Their highest heaven; or on the Delphian cliff,
+Or in Dodona, and through all the bounds
+Of Doric land; or who with Saturn old
+Fled over Adria to th' Hesperian fields,
+And o'er the Celtic roamed the utmost Isles.
+ All these and more came flocking; but with looks
+Downcast and damp; yet such wherein appeared
+Obscure some glimpse of joy to have found their Chief
+Not in despair, to have found themselves not lost
+In loss itself; which on his countenance cast
+Like doubtful hue. But he, his wonted pride
+Soon recollecting, with high words, that bore
+Semblance of worth, not substance, gently raised
+Their fainting courage, and dispelled their fears.
+Then straight commands that, at the warlike sound
+Of trumpets loud and clarions, be upreared
+His mighty standard. That proud honour claimed
+Azazel as his right, a Cherub tall:
+Who forthwith from the glittering staff unfurled
+Th' imperial ensign; which, full high advanced,
+Shone like a meteor streaming to the wind,
+With gems and golden lustre rich emblazed,
+Seraphic arms and trophies; all the while
+Sonorous metal blowing martial sounds:
+At which the universal host up-sent
+A shout that tore Hell's concave, and beyond
+Frighted the reign of Chaos and old Night.
+All in a moment through the gloom were seen
+Ten thousand banners rise into the air,
+With orient colours waving: with them rose
+A forest huge of spears; and thronging helms
+Appeared, and serried shields in thick array
+Of depth immeasurable. Anon they move
+In perfect phalanx to the Dorian mood
+Of flutes and soft recorders--such as raised
+To height of noblest temper heroes old
+Arming to battle, and instead of rage
+Deliberate valour breathed, firm, and unmoved
+With dread of death to flight or foul retreat;
+Nor wanting power to mitigate and swage
+With solemn touches troubled thoughts, and chase
+Anguish and doubt and fear and sorrow and pain
+From mortal or immortal minds. Thus they,
+Breathing united force with fixed thought,
+Moved on in silence to soft pipes that charmed
+Their painful steps o'er the burnt soil. And now
+Advanced in view they stand--a horrid front
+Of dreadful length and dazzling arms, in guise
+Of warriors old, with ordered spear and shield,
+Awaiting what command their mighty Chief
+Had to impose. He through the armed files
+Darts his experienced eye, and soon traverse
+The whole battalion views--their order due,
+Their visages and stature as of gods;
+Their number last he sums. And now his heart
+Distends with pride, and, hardening in his strength,
+Glories: for never, since created Man,
+Met such embodied force as, named with these,
+Could merit more than that small infantry
+Warred on by cranes--though all the giant brood
+Of Phlegra with th' heroic race were joined
+That fought at Thebes and Ilium, on each side
+Mixed with auxiliar gods; and what resounds
+In fable or romance of Uther's son,
+Begirt with British and Armoric knights;
+And all who since, baptized or infidel,
+Jousted in Aspramont, or Montalban,
+Damasco, or Marocco, or Trebisond,
+Or whom Biserta sent from Afric shore
+When Charlemain with all his peerage fell
+By Fontarabbia. Thus far these beyond
+Compare of mortal prowess, yet observed
+Their dread Commander. He, above the rest
+In shape and gesture proudly eminent,
+Stood like a tower. His form had yet not lost
+All her original brightness, nor appeared
+Less than Archangel ruined, and th' excess
+Of glory obscured: as when the sun new-risen
+Looks through the horizontal misty air
+Shorn of his beams, or, from behind the moon,
+In dim eclipse, disastrous twilight sheds
+On half the nations, and with fear of change
+Perplexes monarchs. Darkened so, yet shone
+Above them all th' Archangel: but his face
+Deep scars of thunder had intrenched, and care
+Sat on his faded cheek, but under brows
+Of dauntless courage, and considerate pride
+Waiting revenge. Cruel his eye, but cast
+Signs of remorse and passion, to behold
+The fellows of his crime, the followers rather
+(Far other once beheld in bliss), condemned
+For ever now to have their lot in pain--
+Millions of Spirits for his fault amerced
+Of Heaven, and from eteranl splendours flung
+For his revolt--yet faithful how they stood,
+Their glory withered; as, when heaven's fire
+Hath scathed the forest oaks or mountain pines,
+With singed top their stately growth, though bare,
+Stands on the blasted heath. He now prepared
+To speak; whereat their doubled ranks they bend
+From wing to wing, and half enclose him round
+With all his peers: attention held them mute.
+Thrice he assayed, and thrice, in spite of scorn,
+Tears, such as Angels weep, burst forth: at last
+Words interwove with sighs found out their way:--
+ "O myriads of immortal Spirits! O Powers
+Matchless, but with th' Almighth!--and that strife
+Was not inglorious, though th' event was dire,
+As this place testifies, and this dire change,
+Hateful to utter. But what power of mind,
+Forseeing or presaging, from the depth
+Of knowledge past or present, could have feared
+How such united force of gods, how such
+As stood like these, could ever know repulse?
+For who can yet believe, though after loss,
+That all these puissant legions, whose exile
+Hath emptied Heaven, shall fail to re-ascend,
+Self-raised, and repossess their native seat?
+For me, be witness all the host of Heaven,
+If counsels different, or danger shunned
+By me, have lost our hopes. But he who reigns
+Monarch in Heaven till then as one secure
+Sat on his throne, upheld by old repute,
+Consent or custom, and his regal state
+Put forth at full, but still his strength concealed--
+Which tempted our attempt, and wrought our fall.
+Henceforth his might we know, and know our own,
+So as not either to provoke, or dread
+New war provoked: our better part remains
+To work in close design, by fraud or guile,
+What force effected not; that he no less
+At length from us may find, who overcomes
+By force hath overcome but half his foe.
+Space may produce new Worlds; whereof so rife
+There went a fame in Heaven that he ere long
+Intended to create, and therein plant
+A generation whom his choice regard
+Should favour equal to the Sons of Heaven.
+Thither, if but to pry, shall be perhaps
+Our first eruption--thither, or elsewhere;
+For this infernal pit shall never hold
+Celestial Spirits in bondage, nor th' Abyss
+Long under darkness cover. But these thoughts
+Full counsel must mature. Peace is despaired;
+For who can think submission? War, then, war
+Open or understood, must be resolved."
+ He spake; and, to confirm his words, outflew
+Millions of flaming swords, drawn from the thighs
+Of mighty Cherubim; the sudden blaze
+Far round illumined Hell. Highly they raged
+Against the Highest, and fierce with grasped arms
+Clashed on their sounding shields the din of war,
+Hurling defiance toward the vault of Heaven.
+ There stood a hill not far, whose grisly top
+Belched fire and rolling smoke; the rest entire
+Shone with a glossy scurf--undoubted sign
+That in his womb was hid metallic ore,
+The work of sulphur. Thither, winged with speed,
+A numerous brigade hastened: as when bands
+Of pioneers, with spade and pickaxe armed,
+Forerun the royal camp, to trench a field,
+Or cast a rampart. Mammon led them on--
+Mammon, the least erected Spirit that fell
+From Heaven; for even in Heaven his looks and thoughts
+Were always downward bent, admiring more
+The riches of heaven's pavement, trodden gold,
+Than aught divine or holy else enjoyed
+In vision beatific. By him first
+Men also, and by his suggestion taught,
+Ransacked the centre, and with impious hands
+Rifled the bowels of their mother Earth
+For treasures better hid. Soon had his crew
+Opened into the hill a spacious wound,
+And digged out ribs of gold. Let none admire
+That riches grow in Hell; that soil may best
+Deserve the precious bane. And here let those
+Who boast in mortal things, and wondering tell
+Of Babel, and the works of Memphian kings,
+Learn how their greatest monuments of fame
+And strength, and art, are easily outdone
+By Spirits reprobate, and in an hour
+What in an age they, with incessant toil
+And hands innumerable, scarce perform.
+Nigh on the plain, in many cells prepared,
+That underneath had veins of liquid fire
+Sluiced from the lake, a second multitude
+With wondrous art founded the massy ore,
+Severing each kind, and scummed the bullion-dross.
+A third as soon had formed within the ground
+A various mould, and from the boiling cells
+By strange conveyance filled each hollow nook;
+As in an organ, from one blast of wind,
+To many a row of pipes the sound-board breathes.
+Anon out of the earth a fabric huge
+Rose like an exhalation, with the sound
+Of dulcet symphonies and voices sweet--
+Built like a temple, where pilasters round
+Were set, and Doric pillars overlaid
+With golden architrave; nor did there want
+Cornice or frieze, with bossy sculptures graven;
+The roof was fretted gold. Not Babylon
+Nor great Alcairo such magnificence
+Equalled in all their glories, to enshrine
+Belus or Serapis their gods, or seat
+Their kings, when Egypt with Assyria strove
+In wealth and luxury. Th' ascending pile
+Stood fixed her stately height, and straight the doors,
+Opening their brazen folds, discover, wide
+Within, her ample spaces o'er the smooth
+And level pavement: from the arched roof,
+Pendent by subtle magic, many a row
+Of starry lamps and blazing cressets, fed
+With naptha and asphaltus, yielded light
+As from a sky. The hasty multitude
+Admiring entered; and the work some praise,
+And some the architect. His hand was known
+In Heaven by many a towered structure high,
+Where sceptred Angels held their residence,
+And sat as Princes, whom the supreme King
+Exalted to such power, and gave to rule,
+Each in his Hierarchy, the Orders bright.
+Nor was his name unheard or unadored
+In ancient Greece; and in Ausonian land
+Men called him Mulciber; and how he fell
+From Heaven they fabled, thrown by angry Jove
+Sheer o'er the crystal battlements: from morn
+To noon he fell, from noon to dewy eve,
+A summer's day, and with the setting sun
+Dropt from the zenith, like a falling star,
+On Lemnos, th' Aegaean isle. Thus they relate,
+Erring; for he with this rebellious rout
+Fell long before; nor aught aviled him now
+To have built in Heaven high towers; nor did he scape
+By all his engines, but was headlong sent,
+With his industrious crew, to build in Hell.
+ Meanwhile the winged Heralds, by command
+Of sovereign power, with awful ceremony
+And trumpet's sound, throughout the host proclaim
+A solemn council forthwith to be held
+At Pandemonium, the high capital
+Of Satan and his peers. Their summons called
+From every band and squared regiment
+By place or choice the worthiest: they anon
+With hundreds and with thousands trooping came
+Attended. All access was thronged; the gates
+And porches wide, but chief the spacious hall
+(Though like a covered field, where champions bold
+Wont ride in armed, and at the Soldan's chair
+Defied the best of Paynim chivalry
+To mortal combat, or career with lance),
+Thick swarmed, both on the ground and in the air,
+Brushed with the hiss of rustling wings. As bees
+In spring-time, when the Sun with Taurus rides.
+Pour forth their populous youth about the hive
+In clusters; they among fresh dews and flowers
+Fly to and fro, or on the smoothed plank,
+The suburb of their straw-built citadel,
+New rubbed with balm, expatiate, and confer
+Their state-affairs: so thick the airy crowd
+Swarmed and were straitened; till, the signal given,
+Behold a wonder! They but now who seemed
+In bigness to surpass Earth's giant sons,
+Now less than smallest dwarfs, in narrow room
+Throng numberless--like that pygmean race
+Beyond the Indian mount; or faery elves,
+Whose midnight revels, by a forest-side
+Or fountain, some belated peasant sees,
+Or dreams he sees, while overhead the Moon
+Sits arbitress, and nearer to the Earth
+Wheels her pale course: they, on their mirth and dance
+Intent, with jocund music charm his ear;
+At once with joy and fear his heart rebounds.
+Thus incorporeal Spirits to smallest forms
+Reduced their shapes immense, and were at large,
+Though without number still, amidst the hall
+Of that infernal court. But far within,
+And in their own dimensions like themselves,
+The great Seraphic Lords and Cherubim
+In close recess and secret conclave sat,
+A thousand demi-gods on golden seats,
+Frequent and full. After short silence then,
+And summons read, the great consult began.
+
+
+
+Book II
+
+
+High on a throne of royal state, which far
+Outshone the wealth or Ormus and of Ind,
+Or where the gorgeous East with richest hand
+Showers on her kings barbaric pearl and gold,
+Satan exalted sat, by merit raised
+To that bad eminence; and, from despair
+Thus high uplifted beyond hope, aspires
+Beyond thus high, insatiate to pursue
+Vain war with Heaven; and, by success untaught,
+His proud imaginations thus displayed:--
+ "Powers and Dominions, Deities of Heaven!--
+For, since no deep within her gulf can hold
+Immortal vigour, though oppressed and fallen,
+I give not Heaven for lost: from this descent
+Celestial Virtues rising will appear
+More glorious and more dread than from no fall,
+And trust themselves to fear no second fate!--
+Me though just right, and the fixed laws of Heaven,
+Did first create your leader--next, free choice
+With what besides in council or in fight
+Hath been achieved of merit--yet this loss,
+Thus far at least recovered, hath much more
+Established in a safe, unenvied throne,
+Yielded with full consent. The happier state
+In Heaven, which follows dignity, might draw
+Envy from each inferior; but who here
+Will envy whom the highest place exposes
+Foremost to stand against the Thunderer's aim
+Your bulwark, and condemns to greatest share
+Of endless pain? Where there is, then, no good
+For which to strive, no strife can grow up there
+From faction: for none sure will claim in Hell
+Precedence; none whose portion is so small
+Of present pain that with ambitious mind
+Will covet more! With this advantage, then,
+To union, and firm faith, and firm accord,
+More than can be in Heaven, we now return
+To claim our just inheritance of old,
+Surer to prosper than prosperity
+Could have assured us; and by what best way,
+Whether of open war or covert guile,
+We now debate. Who can advise may speak."
+ He ceased; and next him Moloch, sceptred king,
+Stood up--the strongest and the fiercest Spirit
+That fought in Heaven, now fiercer by despair.
+His trust was with th' Eternal to be deemed
+Equal in strength, and rather than be less
+Cared not to be at all; with that care lost
+Went all his fear: of God, or Hell, or worse,
+He recked not, and these words thereafter spake:--
+ "My sentence is for open war. Of wiles,
+More unexpert, I boast not: them let those
+Contrive who need, or when they need; not now.
+For, while they sit contriving, shall the rest--
+Millions that stand in arms, and longing wait
+The signal to ascend--sit lingering here,
+Heaven's fugitives, and for their dwelling-place
+Accept this dark opprobrious den of shame,
+The prison of his ryranny who reigns
+By our delay? No! let us rather choose,
+Armed with Hell-flames and fury, all at once
+O'er Heaven's high towers to force resistless way,
+Turning our tortures into horrid arms
+Against the Torturer; when, to meet the noise
+Of his almighty engine, he shall hear
+Infernal thunder, and, for lightning, see
+Black fire and horror shot with equal rage
+Among his Angels, and his throne itself
+Mixed with Tartarean sulphur and strange fire,
+His own invented torments. But perhaps
+The way seems difficult, and steep to scale
+With upright wing against a higher foe!
+Let such bethink them, if the sleepy drench
+Of that forgetful lake benumb not still,
+That in our porper motion we ascend
+Up to our native seat; descent and fall
+To us is adverse. Who but felt of late,
+When the fierce foe hung on our broken rear
+Insulting, and pursued us through the Deep,
+With what compulsion and laborious flight
+We sunk thus low? Th' ascent is easy, then;
+Th' event is feared! Should we again provoke
+Our stronger, some worse way his wrath may find
+To our destruction, if there be in Hell
+Fear to be worse destroyed! What can be worse
+Than to dwell here, driven out from bliss, condemned
+In this abhorred deep to utter woe!
+Where pain of unextinguishable fire
+Must exercise us without hope of end
+The vassals of his anger, when the scourge
+Inexorably, and the torturing hour,
+Calls us to penance? More destroyed than thus,
+We should be quite abolished, and expire.
+What fear we then? what doubt we to incense
+His utmost ire? which, to the height enraged,
+Will either quite consume us, and reduce
+To nothing this essential--happier far
+Than miserable to have eternal being!--
+Or, if our substance be indeed divine,
+And cannot cease to be, we are at worst
+On this side nothing; and by proof we feel
+Our power sufficient to disturb his Heaven,
+And with perpetual inroads to alarm,
+Though inaccessible, his fatal throne:
+Which, if not victory, is yet revenge."
+ He ended frowning, and his look denounced
+Desperate revenge, and battle dangerous
+To less than gods. On th' other side up rose
+Belial, in act more graceful and humane.
+A fairer person lost not Heaven; he seemed
+For dignity composed, and high exploit.
+But all was false and hollow; though his tongue
+Dropped manna, and could make the worse appear
+The better reason, to perplex and dash
+Maturest counsels: for his thoughts were low--
+ To vice industrious, but to nobler deeds
+Timorous and slothful. Yet he pleased the ear,
+And with persuasive accent thus began:--
+ "I should be much for open war, O Peers,
+As not behind in hate, if what was urged
+Main reason to persuade immediate war
+Did not dissuade me most, and seem to cast
+Ominous conjecture on the whole success;
+When he who most excels in fact of arms,
+In what he counsels and in what excels
+Mistrustful, grounds his courage on despair
+And utter dissolution, as the scope
+Of all his aim, after some dire revenge.
+First, what revenge? The towers of Heaven are filled
+With armed watch, that render all access
+Impregnable: oft on the bodering Deep
+Encamp their legions, or with obscure wing
+Scout far and wide into the realm of Night,
+Scorning surprise. Or, could we break our way
+By force, and at our heels all Hell should rise
+With blackest insurrection to confound
+Heaven's purest light, yet our great Enemy,
+All incorruptible, would on his throne
+Sit unpolluted, and th' ethereal mould,
+Incapable of stain, would soon expel
+Her mischief, and purge off the baser fire,
+Victorious. Thus repulsed, our final hope
+Is flat despair: we must exasperate
+Th' Almighty Victor to spend all his rage;
+And that must end us; that must be our cure--
+To be no more. Sad cure! for who would lose,
+Though full of pain, this intellectual being,
+Those thoughts that wander through eternity,
+To perish rather, swallowed up and lost
+In the wide womb of uncreated Night,
+Devoid of sense and motion? And who knows,
+Let this be good, whether our angry Foe
+Can give it, or will ever? How he can
+Is doubtful; that he never will is sure.
+Will he, so wise, let loose at once his ire,
+Belike through impotence or unaware,
+To give his enemies their wish, and end
+Them in his anger whom his anger saves
+To punish endless? 'Wherefore cease we, then?'
+Say they who counsel war; 'we are decreed,
+Reserved, and destined to eternal woe;
+Whatever doing, what can we suffer more,
+What can we suffer worse?' Is this, then, worst--
+Thus sitting, thus consulting, thus in arms?
+What when we fled amain, pursued and struck
+With Heaven's afflicting thunder, and besought
+The Deep to shelter us? This Hell then seemed
+A refuge from those wounds. Or when we lay
+Chained on the burning lake? That sure was worse.
+What if the breath that kindled those grim fires,
+Awaked, should blow them into sevenfold rage,
+And plunge us in the flames; or from above
+Should intermitted vengeance arm again
+His red right hand to plague us? What if all
+Her stores were opened, and this firmament
+Of Hell should spout her cataracts of fire,
+Impendent horrors, threatening hideous fall
+One day upon our heads; while we perhaps,
+Designing or exhorting glorious war,
+Caught in a fiery tempest, shall be hurled,
+Each on his rock transfixed, the sport and prey
+Or racking whirlwinds, or for ever sunk
+Under yon boiling ocean, wrapt in chains,
+There to converse with everlasting groans,
+Unrespited, unpitied, unreprieved,
+Ages of hopeless end? This would be worse.
+War, therefore, open or concealed, alike
+My voice dissuades; for what can force or guile
+With him, or who deceive his mind, whose eye
+Views all things at one view? He from Heaven's height
+All these our motions vain sees and derides,
+Not more almighty to resist our might
+Than wise to frustrate all our plots and wiles.
+Shall we, then, live thus vile--the race of Heaven
+Thus trampled, thus expelled, to suffer here
+Chains and these torments? Better these than worse,
+By my advice; since fate inevitable
+Subdues us, and omnipotent decree,
+The Victor's will. To suffer, as to do,
+Our strength is equal; nor the law unjust
+That so ordains. This was at first resolved,
+If we were wise, against so great a foe
+Contending, and so doubtful what might fall.
+I laugh when those who at the spear are bold
+And venturous, if that fail them, shrink, and fear
+What yet they know must follow--to endure
+Exile, or igominy, or bonds, or pain,
+The sentence of their Conqueror. This is now
+Our doom; which if we can sustain and bear,
+Our Supreme Foe in time may much remit
+His anger, and perhaps, thus far removed,
+Not mind us not offending, satisfied
+With what is punished; whence these raging fires
+Will slacken, if his breath stir not their flames.
+Our purer essence then will overcome
+Their noxious vapour; or, inured, not feel;
+Or, changed at length, and to the place conformed
+In temper and in nature, will receive
+Familiar the fierce heat; and, void of pain,
+This horror will grow mild, this darkness light;
+Besides what hope the never-ending flight
+Of future days may bring, what chance, what change
+Worth waiting--since our present lot appears
+For happy though but ill, for ill not worst,
+If we procure not to ourselves more woe."
+ Thus Belial, with words clothed in reason's garb,
+Counselled ignoble ease and peaceful sloth,
+Not peace; and after him thus Mammon spake:--
+ "Either to disenthrone the King of Heaven
+We war, if war be best, or to regain
+Our own right lost. Him to unthrone we then
+May hope, when everlasting Fate shall yield
+To fickle Chance, and Chaos judge the strife.
+The former, vain to hope, argues as vain
+The latter; for what place can be for us
+Within Heaven's bound, unless Heaven's Lord supreme
+We overpower? Suppose he should relent
+And publish grace to all, on promise made
+Of new subjection; with what eyes could we
+Stand in his presence humble, and receive
+Strict laws imposed, to celebrate his throne
+With warbled hyms, and to his Godhead sing
+Forced hallelujahs, while he lordly sits
+Our envied sovereign, and his altar breathes
+Ambrosial odours and ambrosial flowers,
+Our servile offerings? This must be our task
+In Heaven, this our delight. How wearisome
+Eternity so spent in worship paid
+To whom we hate! Let us not then pursue,
+By force impossible, by leave obtained
+Unacceptable, though in Heaven, our state
+Of splendid vassalage; but rather seek
+Our own good from ourselves, and from our own
+Live to ourselves, though in this vast recess,
+Free and to none accountable, preferring
+Hard liberty before the easy yoke
+Of servile pomp. Our greatness will appear
+Then most conspicuous when great things of small,
+Useful of hurtful, prosperous of adverse,
+We can create, and in what place soe'er
+Thrive under evil, and work ease out of pain
+Through labour and endurance. This deep world
+Of darkness do we dread? How oft amidst
+Thick clouds and dark doth Heaven's all-ruling Sire
+Choose to reside, his glory unobscured,
+And with the majesty of darkness round
+Covers his throne, from whence deep thunders roar.
+Mustering their rage, and Heaven resembles Hell!
+As he our darkness, cannot we his light
+Imitate when we please? This desert soil
+Wants not her hidden lustre, gems and gold;
+Nor want we skill or art from whence to raise
+Magnificence; and what can Heaven show more?
+Our torments also may, in length of time,
+Become our elements, these piercing fires
+As soft as now severe, our temper changed
+Into their temper; which must needs remove
+The sensible of pain. All things invite
+To peaceful counsels, and the settled state
+Of order, how in safety best we may
+Compose our present evils, with regard
+Of what we are and where, dismissing quite
+All thoughts of war. Ye have what I advise."
+ He scarce had finished, when such murmur filled
+Th' assembly as when hollow rocks retain
+The sound of blustering winds, which all night long
+Had roused the sea, now with hoarse cadence lull
+Seafaring men o'erwatched, whose bark by chance
+Or pinnace, anchors in a craggy bay
+After the tempest. Such applause was heard
+As Mammon ended, and his sentence pleased,
+Advising peace: for such another field
+They dreaded worse than Hell; so much the fear
+Of thunder and the sword of Michael
+Wrought still within them; and no less desire
+To found this nether empire, which might rise,
+By policy and long process of time,
+In emulation opposite to Heaven.
+Which when Beelzebub perceived--than whom,
+Satan except, none higher sat--with grave
+Aspect he rose, and in his rising seemed
+A pillar of state. Deep on his front engraven
+Deliberation sat, and public care;
+And princely counsel in his face yet shone,
+Majestic, though in ruin. Sage he stood
+With Atlantean shoulders, fit to bear
+The weight of mightiest monarchies; his look
+Drew audience and attention still as night
+Or summer's noontide air, while thus he spake:--
+ "Thrones and Imperial Powers, Offspring of Heaven,
+Ethereal Virtues! or these titles now
+Must we renounce, and, changing style, be called
+Princes of Hell? for so the popular vote
+Inclines--here to continue, and build up here
+A growing empire; doubtless! while we dream,
+And know not that the King of Heaven hath doomed
+This place our dungeon, not our safe retreat
+Beyond his potent arm, to live exempt
+From Heaven's high jurisdiction, in new league
+Banded against his throne, but to remain
+In strictest bondage, though thus far removed,
+Under th' inevitable curb, reserved
+His captive multitude. For he, to be sure,
+In height or depth, still first and last will reign
+Sole king, and of his kingdom lose no part
+By our revolt, but over Hell extend
+His empire, and with iron sceptre rule
+Us here, as with his golden those in Heaven.
+What sit we then projecting peace and war?
+War hath determined us and foiled with loss
+Irreparable; terms of peace yet none
+Vouchsafed or sought; for what peace will be given
+To us enslaved, but custody severe,
+And stripes and arbitrary punishment
+Inflicted? and what peace can we return,
+But, to our power, hostility and hate,
+Untamed reluctance, and revenge, though slow,
+Yet ever plotting how the Conqueror least
+May reap his conquest, and may least rejoice
+In doing what we most in suffering feel?
+Nor will occasion want, nor shall we need
+With dangerous expedition to invade
+Heaven, whose high walls fear no assault or siege,
+Or ambush from the Deep. What if we find
+Some easier enterprise? There is a place
+(If ancient and prophetic fame in Heaven
+Err not)--another World, the happy seat
+Of some new race, called Man, about this time
+To be created like to us, though less
+In power and excellence, but favoured more
+Of him who rules above; so was his will
+Pronounced among the Gods, and by an oath
+That shook Heaven's whole circumference confirmed.
+Thither let us bend all our thoughts, to learn
+What creatures there inhabit, of what mould
+Or substance, how endued, and what their power
+And where their weakness: how attempted best,
+By force of subtlety. Though Heaven be shut,
+And Heaven's high Arbitrator sit secure
+In his own strength, this place may lie exposed,
+The utmost border of his kingdom, left
+To their defence who hold it: here, perhaps,
+Some advantageous act may be achieved
+By sudden onset--either with Hell-fire
+To waste his whole creation, or possess
+All as our own, and drive, as we were driven,
+The puny habitants; or, if not drive,
+Seduce them to our party, that their God
+May prove their foe, and with repenting hand
+Abolish his own works. This would surpass
+Common revenge, and interrupt his joy
+In our confusion, and our joy upraise
+In his disturbance; when his darling sons,
+Hurled headlong to partake with us, shall curse
+Their frail original, and faded bliss--
+Faded so soon! Advise if this be worth
+Attempting, or to sit in darkness here
+Hatching vain empires." Thus beelzebub
+Pleaded his devilish counsel--first devised
+By Satan, and in part proposed: for whence,
+But from the author of all ill, could spring
+So deep a malice, to confound the race
+Of mankind in one root, and Earth with Hell
+To mingle and involve, done all to spite
+The great Creator? But their spite still serves
+His glory to augment. The bold design
+Pleased highly those infernal States, and joy
+Sparkled in all their eyes: with full assent
+They vote: whereat his speech he thus renews:--
+"Well have ye judged, well ended long debate,
+Synod of Gods, and, like to what ye are,
+Great things resolved, which from the lowest deep
+Will once more lift us up, in spite of fate,
+Nearer our ancient seat--perhaps in view
+Of those bright confines, whence, with neighbouring arms,
+And opportune excursion, we may chance
+Re-enter Heaven; or else in some mild zone
+Dwell, not unvisited of Heaven's fair light,
+Secure, and at the brightening orient beam
+Purge off this gloom: the soft delicious air,
+To heal the scar of these corrosive fires,
+Shall breathe her balm. But, first, whom shall we send
+In search of this new World? whom shall we find
+Sufficient? who shall tempt with wandering feet
+The dark, unbottomed, infinite Abyss,
+And through the palpable obscure find out
+His uncouth way, or spread his airy flight,
+Upborne with indefatigable wings
+Over the vast abrupt, ere he arrive
+The happy Isle? What strength, what art, can then
+Suffice, or what evasion bear him safe,
+Through the strict senteries and stations thick
+Of Angels watching round? Here he had need
+All circumspection: and we now no less
+Choice in our suffrage; for on whom we send
+The weight of all, and our last hope, relies."
+ This said, he sat; and expectation held
+His look suspense, awaiting who appeared
+To second, or oppose, or undertake
+The perilous attempt. But all sat mute,
+Pondering the danger with deep thoughts; and each
+In other's countenance read his own dismay,
+Astonished. None among the choice and prime
+Of those Heaven-warring champions could be found
+So hardy as to proffer or accept,
+Alone, the dreadful voyage; till, at last,
+Satan, whom now transcendent glory raised
+Above his fellows, with monarchal pride
+Conscious of highest worth, unmoved thus spake:--
+ "O Progeny of Heaven! Empyreal Thrones!
+With reason hath deep silence and demur
+Seized us, though undismayed. Long is the way
+And hard, that out of Hell leads up to light.
+Our prison strong, this huge convex of fire,
+Outrageous to devour, immures us round
+Ninefold; and gates of burning adamant,
+Barred over us, prohibit all egress.
+These passed, if any pass, the void profound
+Of unessential Night receives him next,
+Wide-gaping, and with utter loss of being
+Threatens him, plunged in that abortive gulf.
+If thence he scape, into whatever world,
+Or unknown region, what remains him less
+Than unknown dangers, and as hard escape?
+But I should ill become this throne, O Peers,
+And this imperial sovereignty, adorned
+With splendour, armed with power, if aught proposed
+And judged of public moment in the shape
+Of difficulty or danger, could deter
+Me from attempting. Wherefore do I assume
+These royalties, and not refuse to reign,
+Refusing to accept as great a share
+Of hazard as of honour, due alike
+To him who reigns, and so much to him due
+Of hazard more as he above the rest
+High honoured sits? Go, therefore, mighty Powers,
+Terror of Heaven, though fallen; intend at home,
+While here shall be our home, what best may ease
+The present misery, and render Hell
+More tolerable; if there be cure or charm
+To respite, or deceive, or slack the pain
+Of this ill mansion: intermit no watch
+Against a wakeful foe, while I abroad
+Through all the coasts of dark destruction seek
+Deliverance for us all. This enterprise
+None shall partake with me." Thus saying, rose
+The Monarch, and prevented all reply;
+Prudent lest, from his resolution raised,
+Others among the chief might offer now,
+Certain to be refused, what erst they feared,
+And, so refused, might in opinion stand
+His rivals, winning cheap the high repute
+Which he through hazard huge must earn. But they
+Dreaded not more th' adventure than his voice
+Forbidding; and at once with him they rose.
+Their rising all at once was as the sound
+Of thunder heard remote. Towards him they bend
+With awful reverence prone, and as a God
+Extol him equal to the Highest in Heaven.
+Nor failed they to express how much they praised
+That for the general safety he despised
+His own: for neither do the Spirits damned
+Lose all their virtue; lest bad men should boast
+Their specious deeds on earth, which glory excites,
+Or close ambition varnished o'er with zeal.
+ Thus they their doubtful consultations dark
+Ended, rejoicing in their matchless Chief:
+As, when from mountain-tops the dusky clouds
+Ascending, while the north wind sleeps, o'erspread
+Heaven's cheerful face, the louring element
+Scowls o'er the darkened landscape snow or shower,
+If chance the radiant sun, with farewell sweet,
+Extend his evening beam, the fields revive,
+The birds their notes renew, and bleating herds
+Attest their joy, that hill and valley rings.
+O shame to men! Devil with devil damned
+Firm concord holds; men only disagree
+Of creatures rational, though under hope
+Of heavenly grace, and, God proclaiming peace,
+Yet live in hatred, enmity, and strife
+Among themselves, and levy cruel wars
+Wasting the earth, each other to destroy:
+As if (which might induce us to accord)
+Man had not hellish foes enow besides,
+That day and night for his destruction wait!
+ The Stygian council thus dissolved; and forth
+In order came the grand infernal Peers:
+Midst came their mighty Paramount, and seemed
+Alone th' antagonist of Heaven, nor less
+Than Hell's dread Emperor, with pomp supreme,
+And god-like imitated state: him round
+A globe of fiery Seraphim enclosed
+With bright emblazonry, and horrent arms.
+Then of their session ended they bid cry
+With trumpet's regal sound the great result:
+Toward the four winds four speedy Cherubim
+Put to their mouths the sounding alchemy,
+By herald's voice explained; the hollow Abyss
+Heard far adn wide, and all the host of Hell
+With deafening shout returned them loud acclaim.
+Thence more at ease their minds, and somewhat raised
+By false presumptuous hope, the ranged Powers
+Disband; and, wandering, each his several way
+Pursues, as inclination or sad choice
+Leads him perplexed, where he may likeliest find
+Truce to his restless thoughts, and entertain
+The irksome hours, till his great Chief return.
+Part on the plain, or in the air sublime,
+Upon the wing or in swift race contend,
+As at th' Olympian games or Pythian fields;
+Part curb their fiery steeds, or shun the goal
+With rapid wheels, or fronted brigades form:
+As when, to warn proud cities, war appears
+Waged in the troubled sky, and armies rush
+To battle in the clouds; before each van
+Prick forth the airy knights, and couch their spears,
+Till thickest legions close; with feats of arms
+From either end of heaven the welkin burns.
+Others, with vast Typhoean rage, more fell,
+Rend up both rocks and hills, and ride the air
+In whirlwind; Hell scarce holds the wild uproar:--
+As when Alcides, from Oechalia crowned
+With conquest, felt th' envenomed robe, and tore
+Through pain up by the roots Thessalian pines,
+And Lichas from the top of Oeta threw
+Into th' Euboic sea. Others, more mild,
+Retreated in a silent valley, sing
+With notes angelical to many a harp
+Their own heroic deeds, and hapless fall
+By doom of battle, and complain that Fate
+Free Virtue should enthrall to Force or Chance.
+Their song was partial; but the harmony
+(What could it less when Spirits immortal sing?)
+Suspended Hell, and took with ravishment
+The thronging audience. In discourse more sweet
+(For Eloquence the Soul, Song charms the Sense)
+Others apart sat on a hill retired,
+In thoughts more elevate, and reasoned high
+Of Providence, Foreknowledge, Will, and Fate--
+Fixed fate, free will, foreknowledge absolute,
+And found no end, in wandering mazes lost.
+Of good and evil much they argued then,
+Of happiness and final misery,
+Passion and apathy, and glory and shame:
+Vain wisdom all, and false philosophy!--
+Yet, with a pleasing sorcery, could charm
+Pain for a while or anguish, and excite
+Fallacious hope, or arm th' obdured breast
+With stubborn patience as with triple steel.
+Another part, in squadrons and gross bands,
+On bold adventure to discover wide
+That dismal world, if any clime perhaps
+Might yield them easier habitation, bend
+Four ways their flying march, along the banks
+Of four infernal rivers, that disgorge
+Into the burning lake their baleful streams--
+Abhorred Styx, the flood of deadly hate;
+Sad Acheron of sorrow, black and deep;
+Cocytus, named of lamentation loud
+Heard on the rueful stream; fierce Phlegeton,
+Whose waves of torrent fire inflame with rage.
+Far off from these, a slow and silent stream,
+Lethe, the river of oblivion, rolls
+Her watery labyrinth, whereof who drinks
+Forthwith his former state and being forgets--
+Forgets both joy and grief, pleasure and pain.
+Beyond this flood a frozen continent
+Lies dark and wild, beat with perpetual storms
+Of whirlwind and dire hail, which on firm land
+Thaws not, but gathers heap, and ruin seems
+Of ancient pile; all else deep snow and ice,
+A gulf profound as that Serbonian bog
+Betwixt Damiata and Mount Casius old,
+Where armies whole have sunk: the parching air
+Burns frore, and cold performs th' effect of fire.
+Thither, by harpy-footed Furies haled,
+At certain revolutions all the damned
+Are brought; and feel by turns the bitter change
+Of fierce extremes, extremes by change more fierce,
+From beds of raging fire to starve in ice
+Their soft ethereal warmth, and there to pine
+Immovable, infixed, and frozen round
+Periods of time,--thence hurried back to fire.
+They ferry over this Lethean sound
+Both to and fro, their sorrow to augment,
+And wish and struggle, as they pass, to reach
+The tempting stream, with one small drop to lose
+In sweet forgetfulness all pain and woe,
+All in one moment, and so near the brink;
+But Fate withstands, and, to oppose th' attempt,
+Medusa with Gorgonian terror guards
+The ford, and of itself the water flies
+All taste of living wight, as once it fled
+The lip of Tantalus. Thus roving on
+In confused march forlorn, th' adventurous bands,
+With shuddering horror pale, and eyes aghast,
+Viewed first their lamentable lot, and found
+No rest. Through many a dark and dreary vale
+They passed, and many a region dolorous,
+O'er many a frozen, many a fiery alp,
+Rocks, caves, lakes, fens, bogs, dens, and shades of death--
+A universe of death, which God by curse
+Created evil, for evil only good;
+Where all life dies, death lives, and Nature breeds,
+Perverse, all monstrous, all prodigious things,
+Obominable, inutterable, and worse
+Than fables yet have feigned or fear conceived,
+Gorgons, and Hydras, and Chimeras dire.
+ Meanwhile the Adversary of God and Man,
+Satan, with thoughts inflamed of highest design,
+Puts on swift wings, and toward the gates of Hell
+Explores his solitary flight: sometimes
+He scours the right hand coast, sometimes the left;
+Now shaves with level wing the deep, then soars
+Up to the fiery concave towering high.
+As when far off at sea a fleet descried
+Hangs in the clouds, by equinoctial winds
+Close sailing from Bengala, or the isles
+Of Ternate and Tidore, whence merchants bring
+Their spicy drugs; they on the trading flood,
+Through the wide Ethiopian to the Cape,
+Ply stemming nightly toward the pole: so seemed
+Far off the flying Fiend. At last appear
+Hell-bounds, high reaching to the horrid roof,
+And thrice threefold the gates; three folds were brass,
+Three iron, three of adamantine rock,
+Impenetrable, impaled with circling fire,
+Yet unconsumed. Before the gates there sat
+On either side a formidable Shape.
+The one seemed woman to the waist, and fair,
+But ended foul in many a scaly fold,
+Voluminous and vast--a serpent armed
+With mortal sting. About her middle round
+A cry of Hell-hounds never-ceasing barked
+With wide Cerberean mouths full loud, and rung
+A hideous peal; yet, when they list, would creep,
+If aught disturbed their noise, into her womb,
+And kennel there; yet there still barked and howled
+Within unseen. Far less abhorred than these
+Vexed Scylla, bathing in the sea that parts
+Calabria from the hoarse Trinacrian shore;
+Nor uglier follow the night-hag, when, called
+In secret, riding through the air she comes,
+Lured with the smell of infant blood, to dance
+With Lapland witches, while the labouring moon
+Eclipses at their charms. The other Shape--
+If shape it might be called that shape had none
+Distinguishable in member, joint, or limb;
+Or substance might be called that shadow seemed,
+For each seemed either--black it stood as Night,
+Fierce as ten Furies, terrible as Hell,
+And shook a dreadful dart: what seemed his head
+The likeness of a kingly crown had on.
+Satan was now at hand, and from his seat
+The monster moving onward came as fast
+With horrid strides; Hell trembled as he strode.
+Th' undaunted Fiend what this might be admired--
+Admired, not feared (God and his Son except,
+Created thing naught valued he nor shunned),
+And with disdainful look thus first began:--
+ "Whence and what art thou, execrable Shape,
+That dar'st, though grim and terrible, advance
+Thy miscreated front athwart my way
+To yonder gates? Through them I mean to pass,
+That be assured, without leave asked of thee.
+Retire; or taste thy folly, and learn by proof,
+Hell-born, not to contend with Spirits of Heaven."
+ To whom the Goblin, full of wrath, replied:--
+"Art thou that traitor Angel? art thou he,
+Who first broke peace in Heaven and faith, till then
+Unbroken, and in proud rebellious arms
+Drew after him the third part of Heaven's sons,
+Conjured against the Highest--for which both thou
+And they, outcast from God, are here condemned
+To waste eternal days in woe and pain?
+And reckon'st thou thyself with Spirits of Heaven
+Hell-doomed, and breath'st defiance here and scorn,
+Where I reign king, and, to enrage thee more,
+Thy king and lord? Back to thy punishment,
+False fugitive; and to thy speed add wings,
+Lest with a whip of scorpions I pursue
+Thy lingering, or with one stroke of this dart
+Strange horror seize thee, and pangs unfelt before."
+ So spake the grisly Terror, and in shape,
+So speaking and so threatening, grew tenfold,
+More dreadful and deform. On th' other side,
+Incensed with indignation, Satan stood
+Unterrified, and like a comet burned,
+That fires the length of Ophiuchus huge
+In th' arctic sky, and from his horrid hair
+Shakes pestilence and war. Each at the head
+Levelled his deadly aim; their fatal hands
+No second stroke intend; and such a frown
+Each cast at th' other as when two black clouds,
+With heaven's artillery fraught, came rattling on
+Over the Caspian,--then stand front to front
+Hovering a space, till winds the signal blow
+To join their dark encounter in mid-air.
+So frowned the mighty combatants that Hell
+Grew darker at their frown; so matched they stood;
+For never but once more was wither like
+To meet so great a foe. And now great deeds
+Had been achieved, whereof all Hell had rung,
+Had not the snaky Sorceress, that sat
+Fast by Hell-gate and kept the fatal key,
+Risen, and with hideous outcry rushed between.
+ "O father, what intends thy hand," she cried,
+"Against thy only son? What fury, O son,
+Possesses thee to bend that mortal dart
+Against thy father's head? And know'st for whom?
+For him who sits above, and laughs the while
+At thee, ordained his drudge to execute
+Whate'er his wrath, which he calls justice, bids--
+His wrath, which one day will destroy ye both!"
+ She spake, and at her words the hellish Pest
+Forbore: then these to her Satan returned:--
+ "So strange thy outcry, and thy words so strange
+Thou interposest, that my sudden hand,
+Prevented, spares to tell thee yet by deeds
+What it intends, till first I know of thee
+What thing thou art, thus double-formed, and why,
+In this infernal vale first met, thou call'st
+Me father, and that phantasm call'st my son.
+I know thee not, nor ever saw till now
+Sight more detestable than him and thee."
+ T' whom thus the Portress of Hell-gate replied:--
+"Hast thou forgot me, then; and do I seem
+Now in thine eye so foul?--once deemed so fair
+In Heaven, when at th' assembly, and in sight
+Of all the Seraphim with thee combined
+In bold conspiracy against Heaven's King,
+All on a sudden miserable pain
+Surprised thee, dim thine eyes and dizzy swum
+In darkness, while thy head flames thick and fast
+Threw forth, till on the left side opening wide,
+Likest to thee in shape and countenance bright,
+Then shining heavenly fair, a goddess armed,
+Out of thy head I sprung. Amazement seized
+All th' host of Heaven; back they recoiled afraid
+At first, and called me Sin, and for a sign
+Portentous held me; but, familiar grown,
+I pleased, and with attractive graces won
+The most averse--thee chiefly, who, full oft
+Thyself in me thy perfect image viewing,
+Becam'st enamoured; and such joy thou took'st
+With me in secret that my womb conceived
+A growing burden. Meanwhile war arose,
+And fields were fought in Heaven: wherein remained
+(For what could else?) to our Almighty Foe
+Clear victory; to our part loss and rout
+Through all the Empyrean. Down they fell,
+Driven headlong from the pitch of Heaven, down
+Into this Deep; and in the general fall
+I also: at which time this powerful key
+Into my hands was given, with charge to keep
+These gates for ever shut, which none can pass
+Without my opening. Pensive here I sat
+Alone; but long I sat not, till my womb,
+Pregnant by thee, and now excessive grown,
+Prodigious motion felt and rueful throes.
+At last this odious offspring whom thou seest,
+Thine own begotten, breaking violent way,
+Tore through my entrails, that, with fear and pain
+Distorted, all my nether shape thus grew
+Transformed: but he my inbred enemy
+Forth issued, brandishing his fatal dart,
+Made to destroy. I fled, and cried out Death!
+Hell trembled at the hideous name, and sighed
+From all her caves, and back resounded Death!
+I fled; but he pursued (though more, it seems,
+Inflamed with lust than rage), and, swifter far,
+Me overtook, his mother, all dismayed,
+And, in embraces forcible and foul
+Engendering with me, of that rape begot
+These yelling monsters, that with ceaseless cry
+Surround me, as thou saw'st--hourly conceived
+And hourly born, with sorrow infinite
+To me; for, when they list, into the womb
+That bred them they return, and howl, and gnaw
+My bowels, their repast; then, bursting forth
+Afresh, with conscious terrors vex me round,
+That rest or intermission none I find.
+Before mine eyes in opposition sits
+Grim Death, my son and foe, who set them on,
+And me, his parent, would full soon devour
+For want of other prey, but that he knows
+His end with mine involved, and knows that I
+Should prove a bitter morsel, and his bane,
+Whenever that shall be: so Fate pronounced.
+But thou, O father, I forewarn thee, shun
+His deadly arrow; neither vainly hope
+To be invulnerable in those bright arms,
+Through tempered heavenly; for that mortal dint,
+Save he who reigns above, none can resist."
+ She finished; and the subtle Fiend his lore
+Soon learned, now milder, and thus answered smooth:--
+ "Dear daughter--since thou claim'st me for thy sire,
+And my fair son here show'st me, the dear pledge
+Of dalliance had with thee in Heaven, and joys
+Then sweet, now sad to mention, through dire change
+Befallen us unforeseen, unthought-of--know,
+I come no enemy, but to set free
+From out this dark and dismal house of pain
+Both him and thee, and all the heavenly host
+Of Spirits that, in our just pretences armed,
+Fell with us from on high. From them I go
+This uncouth errand sole, and one for all
+Myself expose, with lonely steps to tread
+Th' unfounded Deep, and through the void immense
+To search, with wandering quest, a place foretold
+Should be--and, by concurring signs, ere now
+Created vast and round--a place of bliss
+In the purlieus of Heaven; and therein placed
+A race of upstart creatures, to supply
+Perhaps our vacant room, though more removed,
+Lest Heaven, surcharged with potent multitude,
+Might hap to move new broils. Be this, or aught
+Than this more secret, now designed, I haste
+To know; and, this once known, shall soon return,
+And bring ye to the place where thou and Death
+Shall dwell at ease, and up and down unseen
+Wing silently the buxom air, embalmed
+With odours. There ye shall be fed and filled
+Immeasurably; all things shall be your prey."
+ He ceased; for both seemed highly pleased, and Death
+Grinned horrible a ghastly smile, to hear
+His famine should be filled, and blessed his maw
+Destined to that good hour. No less rejoiced
+His mother bad, and thus bespake her sire:--
+ "The key of this infernal Pit, by due
+And by command of Heaven's all-powerful King,
+I keep, by him forbidden to unlock
+These adamantine gates; against all force
+Death ready stands to interpose his dart,
+Fearless to be o'ermatched by living might.
+But what owe I to his commands above,
+Who hates me, and hath hither thrust me down
+Into this gloom of Tartarus profound,
+To sit in hateful office here confined,
+Inhabitant of Heaven and heavenly born--
+Here in perpetual agony and pain,
+With terrors and with clamours compassed round
+Of mine own brood, that on my bowels feed?
+Thou art my father, thou my author, thou
+My being gav'st me; whom should I obey
+But thee? whom follow? Thou wilt bring me soon
+To that new world of light and bliss, among
+The gods who live at ease, where I shall reign
+At thy right hand voluptuous, as beseems
+Thy daughter and thy darling, without end."
+ Thus saying, from her side the fatal key,
+Sad instrument of all our woe, she took;
+And, towards the gate rolling her bestial train,
+Forthwith the huge portcullis high up-drew,
+Which, but herself, not all the Stygian Powers
+Could once have moved; then in the key-hole turns
+Th' intricate wards, and every bolt and bar
+Of massy iron or solid rock with ease
+Unfastens. On a sudden open fly,
+With impetuous recoil and jarring sound,
+Th' infernal doors, and on their hinges grate
+Harsh thunder, that the lowest bottom shook
+Of Erebus. She opened; but to shut
+Excelled her power: the gates wide open stood,
+That with extended wings a bannered host,
+Under spread ensigns marching, mibht pass through
+With horse and chariots ranked in loose array;
+So wide they stood, and like a furnace-mouth
+Cast forth redounding smoke and ruddy flame.
+Before their eyes in sudden view appear
+The secrets of the hoary Deep--a dark
+Illimitable ocean, without bound,
+Without dimension; where length, breadth, and height,
+And time, and place, are lost; where eldest Night
+And Chaos, ancestors of Nature, hold
+Eternal anarchy, amidst the noise
+Of endless wars, and by confusion stand.
+For Hot, Cold, Moist, and Dry, four champions fierce,
+Strive here for mastery, and to battle bring
+Their embryon atoms: they around the flag
+Of each his faction, in their several clans,
+Light-armed or heavy, sharp, smooth, swift, or slow,
+Swarm populous, unnumbered as the sands
+Of Barca or Cyrene's torrid soil,
+Levied to side with warring winds, and poise
+Their lighter wings. To whom these most adhere
+He rules a moment: Chaos umpire sits,
+And by decision more embroils the fray
+By which he reigns: next him, high arbiter,
+Chance governs all. Into this wild Abyss,
+The womb of Nature, and perhaps her grave,
+Of neither sea, nor shore, nor air, nor fire,
+But all these in their pregnant causes mixed
+Confusedly, and which thus must ever fight,
+Unless th' Almighty Maker them ordain
+His dark materials to create more worlds--
+Into this wild Abyss the wary Fiend
+Stood on the brink of Hell and looked a while,
+Pondering his voyage; for no narrow frith
+He had to cross. Nor was his ear less pealed
+With noises loud and ruinous (to compare
+Great things with small) than when Bellona storms
+With all her battering engines, bent to rase
+Some capital city; or less than if this frame
+Of Heaven were falling, and these elements
+In mutiny had from her axle torn
+The steadfast Earth. At last his sail-broad vans
+He spread for flight, and, in the surging smoke
+Uplifted, spurns the ground; thence many a league,
+As in a cloudy chair, ascending rides
+Audacious; but, that seat soon failing, meets
+A vast vacuity. All unawares,
+Fluttering his pennons vain, plumb-down he drops
+Ten thousand fathom deep, and to this hour
+Down had been falling, had not, by ill chance,
+The strong rebuff of some tumultuous cloud,
+Instinct with fire and nitre, hurried him
+As many miles aloft. That fury stayed--
+Quenched in a boggy Syrtis, neither sea,
+Nor good dry land--nigh foundered, on he fares,
+Treading the crude consistence, half on foot,
+Half flying; behoves him now both oar and sail.
+As when a gryphon through the wilderness
+With winged course, o'er hill or moory dale,
+Pursues the Arimaspian, who by stealth
+Had from his wakeful custody purloined
+The guarded gold; so eagerly the Fiend
+O'er bog or steep, through strait, rough, dense, or rare,
+With head, hands, wings, or feet, pursues his way,
+And swims, or sinks, or wades, or creeps, or flies.
+At length a universal hubbub wild
+Of stunning sounds, and voices all confused,
+Borne through the hollow dark, assaults his ear
+With loudest vehemence. Thither he plies
+Undaunted, to meet there whatever Power
+Or Spirit of the nethermost Abyss
+Might in that noise reside, of whom to ask
+Which way the nearest coast of darkness lies
+Bordering on light; when straight behold the throne
+Of Chaos, and his dark pavilion spread
+Wide on the wasteful Deep! With him enthroned
+Sat sable-vested Night, eldest of things,
+The consort of his reign; and by them stood
+Orcus and Ades, and the dreaded name
+Of Demogorgon; Rumour next, and Chance,
+And Tumult, and Confusion, all embroiled,
+And Discord with a thousand various mouths.
+ T' whom Satan, turning boldly, thus:--"Ye Powers
+And Spirtis of this nethermost Abyss,
+Chaos and ancient Night, I come no spy
+With purpose to explore or to disturb
+The secrets of your realm; but, by constraint
+Wandering this darksome desert, as my way
+Lies through your spacious empire up to light,
+Alone and without guide, half lost, I seek,
+What readiest path leads where your gloomy bounds
+Confine with Heaven; or, if some other place,
+From your dominion won, th' Ethereal King
+Possesses lately, thither to arrive
+I travel this profound. Direct my course:
+Directed, no mean recompense it brings
+To your behoof, if I that region lost,
+All usurpation thence expelled, reduce
+To her original darkness and your sway
+(Which is my present journey), and once more
+Erect the standard there of ancient Night.
+Yours be th' advantage all, mine the revenge!"
+ Thus Satan; and him thus the Anarch old,
+With faltering speech and visage incomposed,
+Answered: "I know thee, stranger, who thou art-- ***
+That mighty leading Angel, who of late
+Made head against Heaven's King, though overthrown.
+I saw and heard; for such a numerous host
+Fled not in silence through the frighted Deep,
+With ruin upon ruin, rout on rout,
+Confusion worse confounded; and Heaven-gates
+Poured out by millions her victorious bands,
+Pursuing. I upon my frontiers here
+Keep residence; if all I can will serve
+That little which is left so to defend,
+Encroached on still through our intestine broils
+Weakening the sceptre of old Night: first, Hell,
+Your dungeon, stretching far and wide beneath;
+Now lately Heaven and Earth, another world
+Hung o'er my realm, linked in a golden chain
+To that side Heaven from whence your legions fell!
+If that way be your walk, you have not far;
+So much the nearer danger. Go, and speed;
+Havoc, and spoil, and ruin, are my gain."
+ He ceased; and Satan stayed not to reply,
+But, glad that now his sea should find a shore,
+With fresh alacrity and force renewed
+Springs upward, like a pyramid of fire,
+Into the wild expanse, and through the shock
+Of fighting elements, on all sides round
+Environed, wins his way; harder beset
+And more endangered than when Argo passed
+Through Bosporus betwixt the justling rocks,
+Or when Ulysses on the larboard shunned
+Charybdis, and by th' other whirlpool steered.
+So he with difficulty and labour hard
+Moved on, with difficulty and labour he;
+But, he once passed, soon after, when Man fell,
+Strange alteration! Sin and Death amain,
+Following his track (such was the will of Heaven)
+Paved after him a broad and beaten way
+Over the dark Abyss, whose boiling gulf
+Tamely endured a bridge of wondrous length,
+From Hell continued, reaching th' utmost orb
+Of this frail World; by which the Spirits perverse
+With easy intercourse pass to and fro
+To tempt or punish mortals, except whom
+God and good Angels guard by special grace.
+ But now at last the sacred influence
+Of light appears, and from the walls of Heaven
+Shoots far into the bosom of dim Night
+A glimmering dawn. Here Nature first begins
+Her farthest verge, and Chaos to retire,
+As from her outmost works, a broken foe,
+With tumult less and with less hostile din;
+That Satan with less toil, and now with ease,
+Wafts on the calmer wave by dubious light,
+And, like a weather-beaten vessel, holds
+Gladly the port, though shrouds and tackle torn;
+Or in the emptier waste, resembling air,
+Weighs his spread wings, at leisure to behold
+Far off th' empyreal Heaven, extended wide
+In circuit, undetermined square or round,
+With opal towers and battlements adorned
+Of living sapphire, once his native seat;
+And, fast by, hanging in a golden chain,
+This pendent World, in bigness as a star
+Of smallest magnitude close by the moon.
+Thither, full fraught with mischievous revenge,
+Accursed, and in a cursed hour, he hies.
+
+
+
+Book III
+
+
+Hail, holy Light, offspring of Heaven firstborn,
+Or of the Eternal coeternal beam
+May I express thee unblam'd? since God is light,
+And never but in unapproached light
+Dwelt from eternity, dwelt then in thee
+Bright effluence of bright essence increate.
+Or hear"st thou rather pure ethereal stream,
+Whose fountain who shall tell? before the sun,
+Before the Heavens thou wert, and at the voice
+Of God, as with a mantle, didst invest ***
+The rising world of waters dark and deep,
+Won from the void and formless infinite.
+Thee I re-visit now with bolder wing,
+Escap'd the Stygian pool, though long detain'd
+In that obscure sojourn, while in my flight
+Through utter and through middle darkness borne,
+With other notes than to the Orphean lyre
+I sung of Chaos and eternal Night;
+Taught by the heavenly Muse to venture down
+The dark descent, and up to re-ascend,
+Though hard and rare: Thee I revisit safe,
+And feel thy sovran vital lamp; but thou
+Revisit'st not these eyes, that roll in vain
+To find thy piercing ray, and find no dawn;
+So thick a drop serene hath quench'd their orbs,
+Or dim suffusion veil'd. Yet not the more
+Cease I to wander, where the Muses haunt,
+Clear spring, or shady grove, or sunny hill,
+Smit with the love of sacred song; but chief
+Thee, Sion, and the flowery brooks beneath,
+That wash thy hallow'd feet, and warbling flow,
+Nightly I visit: nor sometimes forget
+So were I equall'd with them in renown,
+Thy sovran command, that Man should find grace;
+Blind Thamyris, and blind Maeonides,
+And Tiresias, and Phineus, prophets old:
+Then feed on thoughts, that voluntary move
+Harmonious numbers; as the wakeful bird
+Sings darkling, and in shadiest covert hid
+Tunes her nocturnal note. Thus with the year
+Seasons return; but not to me returns
+Day, or the sweet approach of even or morn,
+Or sight of vernal bloom, or summer's rose,
+Or flocks, or herds, or human face divine;
+But cloud instead, and ever-during dark
+Surrounds me, from the cheerful ways of men
+Cut off, and for the book of knowledge fair
+Presented with a universal blank
+Of nature's works to me expung'd and ras'd,
+And wisdom at one entrance quite shut out.
+So much the rather thou, celestial Light,
+Shine inward, and the mind through all her powers
+Irradiate; there plant eyes, all mist from thence
+Purge and disperse, that I may see and tell
+Of things invisible to mortal sight.
+Now had the Almighty Father from above,
+From the pure empyrean where he sits
+High thron'd above all highth, bent down his eye
+His own works and their works at once to view:
+About him all the Sanctities of Heaven
+Stood thick as stars, and from his sight receiv'd
+Beatitude past utterance; on his right
+The radiant image of his glory sat,
+His only son; on earth he first beheld
+Our two first parents, yet the only two
+Of mankind in the happy garden plac'd
+Reaping immortal fruits of joy and love,
+Uninterrupted joy, unrivall'd love,
+In blissful solitude; he then survey'd
+Hell and the gulf between, and Satan there
+Coasting the wall of Heaven on this side Night
+In the dun air sublime, and ready now
+To stoop with wearied wings, and willing feet,
+On the bare outside of this world, that seem'd
+Firm land imbosom'd, without firmament,
+Uncertain which, in ocean or in air.
+Him God beholding from his prospect high,
+Wherein past, present, future, he beholds,
+Thus to his only Son foreseeing spake.
+Only begotten Son, seest thou what rage
+Transports our Adversary? whom no bounds
+Prescrib'd no bars of Hell, nor all the chains
+Heap'd on him there, nor yet the main abyss
+Wide interrupt, can hold; so bent he seems
+On desperate revenge, that shall redound
+Upon his own rebellious head. And now,
+Through all restraint broke loose, he wings his way
+Not far off Heaven, in the precincts of light,
+Directly towards the new created world,
+And man there plac'd, with purpose to assay
+If him by force he can destroy, or, worse,
+By some false guile pervert; and shall pervert;
+For man will hearken to his glozing lies,
+And easily transgress the sole command,
+Sole pledge of his obedience: So will fall
+He and his faithless progeny: Whose fault?
+Whose but his own? ingrate, he had of me
+All he could have; I made him just and right,
+Sufficient to have stood, though free to fall.
+Such I created all the ethereal Powers
+And Spirits, both them who stood, and them who fail'd;
+Freely they stood who stood, and fell who fell.
+Not free, what proof could they have given sincere
+Of true allegiance, constant faith or love,
+Where only what they needs must do appear'd,
+Not what they would? what praise could they receive?
+What pleasure I from such obedience paid,
+When will and reason (reason also is choice)
+Useless and vain, of freedom both despoil'd,
+Made passive both, had serv'd necessity,
+Not me? they therefore, as to right belong$ 'd,
+So were created, nor can justly accuse
+Their Maker, or their making, or their fate,
+As if predestination over-rul'd
+Their will dispos'd by absolute decree
+Or high foreknowledge they themselves decreed
+Their own revolt, not I; if I foreknew,
+Foreknowledge had no influence on their fault,
+Which had no less proved certain unforeknown.
+So without least impulse or shadow of fate,
+Or aught by me immutably foreseen,
+They trespass, authors to themselves in all
+Both what they judge, and what they choose; for so
+I form'd them free: and free they must remain,
+Till they enthrall themselves; I else must change
+Their nature, and revoke the high decree
+Unchangeable, eternal, which ordain'd
+$THeir freedom: they themselves ordain'd their fall.
+The first sort by their own suggestion fell,
+Self-tempted, self-deprav'd: Man falls, deceiv'd
+By the other first: Man therefore shall find grace,
+The other none: In mercy and justice both,
+Through Heaven and Earth, so shall my glory excel;
+But Mercy, first and last, shall brightest shine.
+Thus while God spake, ambrosial fragrance fill'd
+All Heaven, and in the blessed Spirits elect
+Sense of new joy ineffable diffus'd.
+Beyond compare the Son of God was seen
+Most glorious; in him all his Father shone
+Substantially express'd; and in his face
+Divine compassion visibly appear'd,
+Love without end, and without measure grace,
+Which uttering, thus he to his Father spake.
+O Father, gracious was that word which clos'd
+Thy sovran command, that Man should find grace;
+, that Man should find grace;
+For which both Heaven and earth shall high extol
+Thy praises, with the innumerable sound
+Of hymns and sacred songs, wherewith thy throne
+Encompass'd shall resound thee ever blest.
+For should Man finally be lost, should Man,
+Thy creature late so lov'd, thy youngest son,
+Fall circumvented thus by fraud, though join'd
+With his own folly? that be from thee far,
+That far be from thee, Father, who art judge
+Of all things made, and judgest only right.
+Or shall the Adversary thus obtain
+His end, and frustrate thine? shall he fulfill
+His malice, and thy goodness bring to nought,
+Or proud return, though to his heavier doom,
+Yet with revenge accomplish'd, and to Hell
+Draw after him the whole race of mankind,
+By him corrupted? or wilt thou thyself
+Abolish thy creation, and unmake
+For him, what for thy glory thou hast made?
+So should thy goodness and thy greatness both
+Be question'd and blasphem'd without defence.
+To whom the great Creator thus replied.
+O son, in whom my soul hath chief delight,
+Son of my bosom, Son who art alone.
+My word, my wisdom, and effectual might,
+All hast thou spoken as my thoughts are, all
+As my eternal purpose hath decreed;
+Man shall not quite be lost, but sav'd who will;
+Yet not of will in him, but grace in me
+Freely vouchsaf'd; once more I will renew
+His lapsed powers, though forfeit; and enthrall'd
+By sin to foul exorbitant desires;
+Upheld by me, yet once more he shall stand
+On even ground against his mortal foe;
+By me upheld, that he may know how frail
+His fallen condition is, and to me owe
+All his deliverance, and to none but me.
+Some I have chosen of peculiar grace,
+Elect above the rest; so is my will:
+The rest shall hear me call, and oft be warn'd
+Their sinful state, and to appease betimes
+The incensed Deity, while offer'd grace
+Invites; for I will clear their senses dark,
+What may suffice, and soften stony hearts
+To pray, repent, and bring obedience due.
+To prayer, repentance, and obedience due,
+Though but endeavour'd with sincere intent,
+Mine ear shall not be slow, mine eye not shut.
+And I will place within them as a guide,
+My umpire Conscience; whom if they will hear,
+Light after light, well us'd, they shall attain,
+And to the end, persisting, safe arrive.
+This my long sufferance, and my day of grace,
+They who neglect and scorn, shall never taste;
+But hard be harden'd, blind be blinded more,
+That they may stumble on, and deeper fall;
+And none but such from mercy I exclude.
+But yet all is not done; Man disobeying,
+Disloyal, breaks his fealty, and sins
+Against the high supremacy of Heaven,
+Affecting God-head, and, so losing all,
+To expiate his treason hath nought left,
+But to destruction sacred and devote,
+He, with his whole posterity, must die,
+Die he or justice must; unless for him
+Some other able, and as willing, pay
+The rigid satisfaction, death for death.
+Say, heavenly Powers, where shall we find such love?
+Which of you will be mortal, to redeem
+Man's mortal crime, and just the unjust to save?
+Dwells in all Heaven charity so dear?
+And silence was in Heaven: $ on Man's behalf
+He ask'd, but all the heavenly quire stood mute,
+Patron or intercessour none appear'd,
+Much less that durst upon his own head draw
+The deadly forfeiture, and ransom set.
+And now without redemption all mankind
+Must have been lost, adjudg'd to Death and Hell
+By doom severe, had not the Son of God,
+In whom the fulness dwells of love divine,
+His dearest mediation thus renew'd.
+Father, thy word is past, Man shall find grace;
+And shall grace not find means, that finds her way,
+The speediest of thy winged messengers,
+To visit all thy creatures, and to all
+Comes unprevented, unimplor'd, unsought?
+Happy for Man, so coming; he her aid
+Can never seek, once dead in sins, and lost;
+Atonement for himself, or offering meet,
+Indebted and undone, hath none to bring;
+Behold me then: me for him, life for life
+I offer: on me let thine anger fall;
+Account me Man; I for his sake will leave
+ Thy bosom, and this glory next to thee
+ Freely put off, and for him lastly die
+ Well pleased; on me let Death wreak all his rage.
+ Under his gloomy power I shall not long
+ Lie vanquished. Thou hast given me to possess
+ Life in myself for ever; by thee I live;
+ Though now to Death I yield, and am his due,
+ All that of me can die, yet, that debt paid,
+ $ thou wilt not leave me in the loathsome grave
+ His prey, nor suffer my unspotted soul
+ For ever with corruption there to dwell;
+ But I shall rise victorious, and subdue
+ My vanquisher, spoiled of his vaunted spoil.
+ Death his death's wound shall then receive, and stoop
+ Inglorious, of his mortal sting disarmed;
+ I through the ample air in triumph high
+ Shall lead Hell captive maugre Hell, and show
+The powers of darkness bound. Thou, at the sight
+ Pleased, out of Heaven shalt look down and smile,
+ While, by thee raised, I ruin all my foes;
+ Death last, and with his carcase glut the grave;
+ Then, with the multitude of my redeemed,
+ Shall enter Heaven, long absent, and return,
+ Father, to see thy face, wherein no cloud
+ Of anger shall remain, but peace assured
+ And reconcilement: wrath shall be no more
+ Thenceforth, but in thy presence joy entire.
+ His words here ended; but his meek aspect
+ Silent yet spake, and breathed immortal love
+ To mortal men, above which only shone
+ Filial obedience: as a sacrifice
+ Glad to be offered, he attends the will
+ Of his great Father. Admiration seized
+ All Heaven, what this might mean, and whither tend,
+ Wondering; but soon th' Almighty thus replied.
+ O thou in Heaven and Earth the only peace
+ Found out for mankind under wrath, O thou
+ My sole complacence! Well thou know'st how dear
+ To me are all my works; nor Man the least,
+ Though last created, that for him I spare
+ Thee from my bosom and right hand, to save,
+ By losing thee a while, the whole race lost.
+
+ 00021053
+ Thou, therefore, whom thou only canst redeem,
+ Their nature also to thy nature join;
+ And be thyself Man among men on Earth,
+ Made flesh, when time shall be, of virgin seed,
+ By wondrous birth; be thou in Adam's room
+The head of all mankind, though Adam's son.
+As in him perish all men, so in thee,
+As from a second root, shall be restored
+As many as are restored, without thee none.
+His crime makes guilty all his sons; thy merit,
+Imputed, shall absolve them who renounce
+Their own both righteous and unrighteous deeds,
+And live in thee transplanted, and from thee
+Receive new life. So Man, as is most just,
+Shall satisfy for Man, be judged and die,
+And dying rise, and rising with him raise
+His brethren, ransomed with his own dear life.
+So heavenly love shall outdo hellish hate,
+Giving to death, and dying to redeem,
+So dearly to redeem what hellish hate
+So easily destroyed, and still destroys
+In those who, when they may, accept not grace.
+Nor shalt thou, by descending to assume
+Man's nature, lessen or degrade thine own.
+Because thou hast, though throned in highest bliss
+Equal to God, and equally enjoying
+God-like fruition, quitted all, to save
+A world from utter loss, and hast been found
+By merit more than birthright Son of God,
+Found worthiest to be so by being good,
+Far more than great or high; because in thee
+Love hath abounded more than glory abounds;
+Therefore thy humiliation shall exalt
+With thee thy manhood also to this throne:
+Here shalt thou sit incarnate, here shalt reign
+Both God and Man, Son both of God and Man,
+Anointed universal King; all power
+I give thee; reign for ever, and assume
+Thy merits; under thee, as head supreme,
+Thrones, Princedoms, Powers, Dominions, I reduce:
+All knees to thee shall bow, of them that bide
+In Heaven, or Earth, or under Earth in Hell.
+When thou, attended gloriously from Heaven,
+Shalt in the sky appear, and from thee send
+The summoning Arch-Angels to proclaim
+Thy dread tribunal; forthwith from all winds,
+The living, and forthwith the cited dead
+Of all past ages, to the general doom
+Shall hasten; such a peal shall rouse their sleep.
+Then, all thy saints assembled, thou shalt judge
+Bad Men and Angels; they, arraigned, shall sink
+Beneath thy sentence; Hell, her numbers full,
+Thenceforth shall be for ever shut. Mean while
+The world shall burn, and from her ashes spring
+New Heaven and Earth, wherein the just shall dwell,
+And, after all their tribulations long,
+See golden days, fruitful of golden deeds,
+With joy and peace triumphing, and fair truth.
+Then thou thy regal scepter shalt lay by,
+For regal scepter then no more shall need,
+God shall be all in all. But, all ye Gods,
+Adore him, who to compass all this dies;
+Adore the Son, and honour him as me.
+No sooner had the Almighty ceased, but all
+The multitude of Angels, with a shout
+Loud as from numbers without number, sweet
+As from blest voices, uttering joy, Heaven rung
+With jubilee, and loud Hosannas filled
+The eternal regions: Lowly reverent
+Towards either throne they bow, and to the ground
+With solemn adoration down they cast
+Their crowns inwove with amarant and gold;
+Immortal amarant, a flower which once
+In Paradise, fast by the tree of life,
+Began to bloom; but soon for man's offence
+To Heaven removed, where first it grew, there grows,
+And flowers aloft shading the fount of life,
+And where the river of bliss through midst of Heaven
+Rolls o'er Elysian flowers her amber stream;
+With these that never fade the Spirits elect
+Bind their resplendent locks inwreathed with beams;
+Now in loose garlands thick thrown off, the bright
+Pavement, that like a sea of jasper shone,
+Impurpled with celestial roses smiled.
+Then, crowned again, their golden harps they took,
+Harps ever tuned, that glittering by their side
+Like quivers hung, and with preamble sweet
+Of charming symphony they introduce
+Their sacred song, and waken raptures high;
+No voice exempt, no voice but well could join
+Melodious part, such concord is in Heaven.
+Thee, Father, first they sung Omnipotent,
+Immutable, Immortal, Infinite,
+Eternal King; the Author of all being,
+Fonntain of light, thyself invisible
+Amidst the glorious brightness where thou sit'st
+Throned inaccessible, but when thou shadest
+The full blaze of thy beams, and, through a cloud
+Drawn round about thee like a radiant shrine,
+Dark with excessive bright thy skirts appear,
+Yet dazzle Heaven, that brightest Seraphim
+Approach not, but with both wings veil their eyes.
+Thee next they sang of all creation first,
+Begotten Son, Divine Similitude,
+In whose conspicuous countenance, without cloud
+Made visible, the Almighty Father shines,
+Whom else no creature can behold; on thee
+Impressed the effulgence of his glory abides,
+Transfused on thee his ample Spirit rests.
+He Heaven of Heavens and all the Powers therein
+By thee created; and by thee threw down
+The aspiring Dominations: Thou that day
+Thy Father's dreadful thunder didst not spare,
+Nor stop thy flaming chariot-wheels, that shook
+Heaven's everlasting frame, while o'er the necks
+Thou drovest of warring Angels disarrayed.
+Back from pursuit thy Powers with loud acclaim
+Thee only extolled, Son of thy Father's might,
+To execute fierce vengeance on his foes,
+Not so on Man: Him through their malice fallen,
+Father of mercy and grace, thou didst not doom
+So strictly, but much more to pity incline:
+No sooner did thy dear and only Son
+Perceive thee purposed not to doom frail Man
+So strictly, but much more to pity inclined,
+He to appease thy wrath, and end the strife
+Of mercy and justice in thy face discerned,
+Regardless of the bliss wherein he sat
+Second to thee, offered himself to die
+For Man's offence. O unexampled love,
+Love no where to be found less than Divine!
+Hail, Son of God, Saviour of Men! Thy name
+Shall be the copious matter of my song
+Henceforth, and never shall my heart thy praise
+Forget, nor from thy Father's praise disjoin.
+Thus they in Heaven, above the starry sphere,
+Their happy hours in joy and hymning spent.
+Mean while upon the firm opacous globe
+Of this round world, whose first convex divides
+The luminous inferiour orbs, enclosed
+From Chaos, and the inroad of Darkness old,
+Satan alighted walks: A globe far off
+It seemed, now seems a boundless continent
+Dark, waste, and wild, under the frown of Night
+Starless exposed, and ever-threatening storms
+Of Chaos blustering round, inclement sky;
+Save on that side which from the wall of Heaven,
+Though distant far, some small reflection gains
+Of glimmering air less vexed with tempest loud:
+Here walked the Fiend at large in spacious field.
+As when a vultur on Imaus bred,
+Whose snowy ridge the roving Tartar bounds,
+Dislodging from a region scarce of prey
+To gorge the flesh of lambs or yeanling kids,
+On hills where flocks are fed, flies toward the springs
+Of Ganges or Hydaspes, Indian streams;
+But in his way lights on the barren plains
+Of Sericana, where Chineses drive
+With sails and wind their cany waggons light:
+So, on this windy sea of land, the Fiend
+Walked up and down alone, bent on his prey;
+Alone, for other creature in this place,
+Living or lifeless, to be found was none;
+None yet, but store hereafter from the earth
+Up hither like aereal vapours flew
+Of all things transitory and vain, when sin
+With vanity had filled the works of men:
+Both all things vain, and all who in vain things
+Built their fond hopes of glory or lasting fame,
+Or happiness in this or the other life;
+All who have their reward on earth, the fruits
+Of painful superstition and blind zeal,
+Nought seeking but the praise of men, here find
+Fit retribution, empty as their deeds;
+All the unaccomplished works of Nature's hand,
+Abortive, monstrous, or unkindly mixed,
+Dissolved on earth, fleet hither, and in vain,
+Till final dissolution, wander here;
+Not in the neighbouring moon as some have dreamed;
+Those argent fields more likely habitants,
+Translated Saints, or middle Spirits hold
+Betwixt the angelical and human kind.
+Hither of ill-joined sons and daughters born
+First from the ancient world those giants came
+With many a vain exploit, though then renowned:
+The builders next of Babel on the plain
+Of Sennaar, and still with vain design,
+New Babels, had they wherewithal, would build:
+Others came single; he, who, to be deemed
+A God, leaped fondly into Aetna flames,
+Empedocles; and he, who, to enjoy
+Plato's Elysium, leaped into the sea,
+Cleombrotus; and many more too long,
+Embryos, and idiots, eremites, and friars
+White, black, and gray, with all their trumpery.
+Here pilgrims roam, that strayed so far to seek
+In Golgotha him dead, who lives in Heaven;
+And they, who to be sure of Paradise,
+Dying, put on the weeds of Dominick,
+Or in Franciscan think to pass disguised;
+They pass the planets seven, and pass the fixed,
+And that crystalling sphere whose balance weighs
+The trepidation talked, and that first moved;
+And now Saint Peter at Heaven's wicket seems
+To wait them with his keys, and now at foot
+Of Heaven's ascent they lift their feet, when lo
+A violent cross wind from either coast
+Blows them transverse, ten thousand leagues awry
+Into the devious air: Then might ye see
+Cowls, hoods, and habits, with their wearers, tost
+And fluttered into rags; then reliques, beads,
+Indulgences, dispenses, pardons, bulls,
+The sport of winds: All these, upwhirled aloft,
+Fly o'er the backside of the world far off
+Into a Limbo large and broad, since called
+The Paradise of Fools, to few unknown
+Long after; now unpeopled, and untrod.
+All this dark globe the Fiend found as he passed,
+And long he wandered, till at last a gleam
+Of dawning light turned thither-ward in haste
+His travelled steps: far distant he descries
+Ascending by degrees magnificent
+Up to the wall of Heaven a structure high;
+At top whereof, but far more rich, appeared
+The work as of a kingly palace-gate,
+With frontispiece of diamond and gold
+Embellished; thick with sparkling orient gems
+The portal shone, inimitable on earth
+By model, or by shading pencil, drawn.
+These stairs were such as whereon Jacob saw
+Angels ascending and descending, bands
+Of guardians bright, when he from Esau fled
+To Padan-Aram, in the field of Luz
+Dreaming by night under the open sky
+And waking cried, This is the gate of Heaven.
+Each stair mysteriously was meant, nor stood
+There always, but drawn up to Heaven sometimes
+Viewless; and underneath a bright sea flowed
+Of jasper, or of liquid pearl, whereon
+Who after came from earth, failing arrived
+Wafted by Angels, or flew o'er the lake
+Rapt in a chariot drawn by fiery steeds.
+The stairs were then let down, whether to dare
+The Fiend by easy ascent, or aggravate
+His sad exclusion from the doors of bliss:
+Direct against which opened from beneath,
+Just o'er the blissful seat of Paradise,
+A passage down to the Earth, a passage wide,
+Wider by far than that of after-times
+Over mount Sion, and, though that were large,
+Over the Promised Land to God so dear;
+By which, to visit oft those happy tribes,
+On high behests his angels to and fro
+Passed frequent, and his eye with choice regard
+From Paneas, the fount of Jordan's flood,
+To Beersaba, where the Holy Land
+Borders on Egypt and the Arabian shore;
+So wide the opening seemed, where bounds were set
+To darkness, such as bound the ocean wave.
+Satan from hence, now on the lower stair,
+That scaled by steps of gold to Heaven-gate,
+Looks down with wonder at the sudden view
+Of all this world at once. As when a scout,
+Through dark?;nd desart ways with?oeril gone
+All?might,?;t?kast by break of cheerful dawn
+Obtains the brow of some high-climbing hill,
+Which to his eye discovers unaware
+The goodly prospect of some foreign land
+First seen, or some renowned metropolis
+With glistering spires and pinnacles adorned,
+Which now the rising sun gilds with his beams:
+Such wonder seised, though after Heaven seen,
+The Spirit malign, but much more envy seised,
+At sight of all this world beheld so fair.
+Round he surveys (and well might, where he stood
+So high above the circling canopy
+Of night's extended shade,) from eastern point
+Of Libra to the fleecy star that bears
+Andromeda far off Atlantick seas
+Beyond the horizon; then from pole to pole
+He views in breadth, and without longer pause
+Down right into the world's first region throws
+His flight precipitant, and winds with ease
+Through the pure marble air his oblique way
+Amongst innumerable stars, that shone
+Stars distant, but nigh hand seemed other worlds;
+Or other worlds they seemed, or happy isles,
+Like those Hesperian gardens famed of old,
+Fortunate fields, and groves, and flowery vales,
+Thrice happy isles; but who dwelt happy there
+He staid not to inquire: Above them all
+The golden sun, in splendour likest Heaven,
+Allured his eye; thither his course he bends
+Through the calm firmament, (but up or down,
+By center, or eccentrick, hard to tell,
+Or longitude,) where the great luminary
+Aloof the vulgar constellations thick,
+That from his lordly eye keep distance due,
+Dispenses light from far; they, as they move
+Their starry dance in numbers that compute
+Days, months, and years, towards his all-cheering lamp
+Turn swift their various motions, or are turned
+By his magnetick beam, that gently warms
+The universe, and to each inward part
+With gentle penetration, though unseen,
+Shoots invisible virtue even to the deep;
+So wonderously was set his station bright.
+There lands the Fiend, a spot like which perhaps
+Astronomer in the sun's lucent orb
+Through his glazed optick tube yet never saw.
+The place he found beyond expression bright,
+Compared with aught on earth, metal or stone;
+Not all parts like, but all alike informed
+With radiant light, as glowing iron with fire;
+If metal, part seemed gold, part silver clear;
+If stone, carbuncle most or chrysolite,
+Ruby or topaz, to the twelve that shone
+In Aaron's breast-plate, and a stone besides
+Imagined rather oft than elsewhere seen,
+That stone, or like to that which here below
+Philosophers in vain so long have sought,
+In vain, though by their powerful art they bind
+Volatile Hermes, and call up unbound
+In various shapes old Proteus from the sea,
+Drained through a limbeck to his native form.
+What wonder then if fields and regions here
+Breathe forth Elixir pure, and rivers run
+Potable gold, when with one virtuous touch
+The arch-chemick sun, so far from us remote,
+Produces, with terrestrial humour mixed,
+Here in the dark so many precious things
+Of colour glorious, and effect so rare?
+Here matter new to gaze the Devil met
+Undazzled; far and wide his eye commands;
+For sight no obstacle found here, nor shade,
+But all sun-shine, as when his beams at noon
+Culminate from the equator, as they now
+Shot upward still direct, whence no way round
+Shadow from body opaque can fall; and the air,
+No where so clear, sharpened his visual ray
+To objects distant far, whereby he soon
+Saw within ken a glorious Angel stand,
+The same whom John saw also in the sun:
+His back was turned, but not his brightness hid;
+Of beaming sunny rays a golden tiar
+Circled his head, nor less his locks behind
+Illustrious on his shoulders fledge with wings
+Lay waving round; on some great charge employed
+He seemed, or fixed in cogitation deep.
+Glad was the Spirit impure, as now in hope
+To find who might direct his wandering flight
+To Paradise, the happy seat of Man,
+His journey's end and our beginning woe.
+But first he casts to change his proper shape,
+Which else might work him danger or delay:
+And now a stripling Cherub he appears,
+Not of the prime, yet such as in his face
+Youth smiled celestial, and to every limb
+Suitable grace diffused, so well he feigned:
+Under a coronet his flowing hair
+In curls on either cheek played; wings he wore
+Of many a coloured plume, sprinkled with gold;
+His habit fit for speed succinct, and held
+Before his decent steps a silver wand.
+He drew not nigh unheard; the Angel bright,
+Ere he drew nigh, his radiant visage turned,
+Admonished by his ear, and straight was known
+The Arch-Angel Uriel, one of the seven
+Who in God's presence, nearest to his throne,
+Stand ready at command, and are his eyes
+That run through all the Heavens, or down to the Earth
+Bear his swift errands over moist and dry,
+O'er sea and land: him Satan thus accosts.
+Uriel, for thou of those seven Spirits that stand
+In sight of God's high throne, gloriously bright,
+The first art wont his great authentick will
+Interpreter through highest Heaven to bring,
+Where all his sons thy embassy attend;
+And here art likeliest by supreme decree
+Like honour to obtain, and as his eye
+To visit oft this new creation round;
+Unspeakable desire to see, and know
+All these his wonderous works, but chiefly Man,
+His chief delight and favour, him for whom
+All these his works so wonderous he ordained,
+Hath brought me from the quires of Cherubim
+Alone thus wandering. Brightest Seraph, tell
+In which of all these shining orbs hath Man
+His fixed seat, or fixed seat hath none,
+But all these shining orbs his choice to dwell;
+That I may find him, and with secret gaze
+Or open admiration him behold,
+On whom the great Creator hath bestowed
+Worlds, and on whom hath all these graces poured;
+That both in him and all things, as is meet,
+The universal Maker we may praise;
+Who justly hath driven out his rebel foes
+To deepest Hell, and, to repair that loss,
+Created this new happy race of Men
+To serve him better: Wise are all his ways.
+So spake the false dissembler unperceived;
+For neither Man nor Angel can discern
+Hypocrisy, the only evil that walks
+Invisible, except to God alone,
+By his permissive will, through Heaven and Earth:
+And oft, though wisdom wake, suspicion sleeps
+At wisdom's gate, and to simplicity
+Resigns her charge, while goodness thinks no ill
+Where no ill seems: Which now for once beguiled
+Uriel, though regent of the sun, and held
+The sharpest-sighted Spirit of all in Heaven;
+Who to the fraudulent impostor foul,
+In his uprightness, answer thus returned.
+Fair Angel, thy desire, which tends to know
+The works of God, thereby to glorify
+The great Work-master, leads to no excess
+That reaches blame, but rather merits praise
+The more it seems excess, that led thee hither
+From thy empyreal mansion thus alone,
+To witness with thine eyes what some perhaps,
+Contented with report, hear only in Heaven:
+For wonderful indeed are all his works,
+Pleasant to know, and worthiest to be all
+Had in remembrance always with delight;
+But what created mind can comprehend
+Their number, or the wisdom infinite
+That brought them forth, but hid their causes deep?
+I saw when at his word the formless mass,
+This world's material mould, came to a heap:
+Confusion heard his voice, and wild uproar
+Stood ruled, stood vast infinitude confined;
+Till at his second bidding Darkness fled,
+Light shone, and order from disorder sprung:
+Swift to their several quarters hasted then
+The cumbrous elements, earth, flood, air, fire;
+And this ethereal quintessence of Heaven
+Flew upward, spirited with various forms,
+That rolled orbicular, and turned to stars
+Numberless, as thou seest, and how they move;
+Each had his place appointed, each his course;
+The rest in circuit walls this universe.
+Look downward on that globe, whose hither side
+With light from hence, though but reflected, shines;
+That place is Earth, the seat of Man; that light
+His day, which else, as the other hemisphere,
+Night would invade; but there the neighbouring moon
+So call that opposite fair star) her aid
+Timely interposes, and her monthly round
+Still ending, still renewing, through mid Heaven,
+With borrowed light her countenance triform
+Hence fills and empties to enlighten the Earth,
+And in her pale dominion checks the night.
+That spot, to which I point, is Paradise,
+Adam's abode; those lofty shades, his bower.
+Thy way thou canst not miss, me mine requires.
+Thus said, he turned; and Satan, bowing low,
+As to superiour Spirits is wont in Heaven,
+Where honour due and reverence none neglects,
+Took leave, and toward the coast of earth beneath,
+Down from the ecliptick, sped with hoped success,
+Throws his steep flight in many an aery wheel;
+Nor staid, till on Niphates' top he lights.
+
+
+
+Book IV
+
+
+O, for that warning voice, which he, who saw
+The Apocalypse, heard cry in Heaven aloud,
+Then when the Dragon, put to second rout,
+Came furious down to be revenged on men,
+Woe to the inhabitants on earth! that now,
+While time was, our first parents had been warned
+The coming of their secret foe, and 'scaped,
+Haply so 'scaped his mortal snare: For now
+Satan, now first inflamed with rage, came down,
+The tempter ere the accuser of mankind,
+To wreak on innocent frail Man his loss
+Of that first battle, and his flight to Hell:
+Yet, not rejoicing in his speed, though bold
+Far off and fearless, nor with cause to boast,
+Begins his dire attempt; which nigh the birth
+Now rolling boils in his tumultuous breast,
+And like a devilish engine back recoils
+Upon himself; horrour and doubt distract
+His troubled thoughts, and from the bottom stir
+The Hell within him; for within him Hell
+He brings, and round about him, nor from Hell
+One step, no more than from himself, can fly
+By change of place: Now conscience wakes despair,
+That slumbered; wakes the bitter memory
+Of what he was, what is, and what must be
+Worse; of worse deeds worse sufferings must ensue.
+Sometimes towards Eden, which now in his view
+Lay pleasant, his grieved look he fixes sad;
+Sometimes towards Heaven, and the full-blazing sun,
+Which now sat high in his meridian tower:
+Then, much revolving, thus in sighs began.
+O thou, that, with surpassing glory crowned,
+Lookest from thy sole dominion like the God
+Of this new world; at whose sight all the stars
+Hide their diminished heads; to thee I call,
+But with no friendly voice, and add thy name,
+Of Sun! to tell thee how I hate thy beams,
+That bring to my remembrance from what state
+I fell, how glorious once above thy sphere;
+Till pride and worse ambition threw me down
+Warring in Heaven against Heaven's matchless King:
+Ah, wherefore! he deserved no such return
+From me, whom he created what I was
+In that bright eminence, and with his good
+Upbraided none; nor was his service hard.
+What could be less than to afford him praise,
+The easiest recompence, and pay him thanks,
+How due! yet all his good proved ill in me,
+And wrought but malice; lifted up so high
+I sdeined subjection, and thought one step higher
+Would set me highest, and in a moment quit
+The debt immense of endless gratitude,
+So burdensome still paying, still to owe,
+Forgetful what from him I still received,
+And understood not that a grateful mind
+By owing owes not, but still pays, at once
+Indebted and discharged; what burden then
+O, had his powerful destiny ordained
+Me some inferiour Angel, I had stood
+Then happy; no unbounded hope had raised
+Ambition! Yet why not some other Power
+As great might have aspired, and me, though mean,
+Drawn to his part; but other Powers as great
+Fell not, but stand unshaken, from within
+Or from without, to all temptations armed.
+Hadst thou the same free will and power to stand?
+Thou hadst: whom hast thou then or what to accuse,
+But Heaven's free love dealt equally to all?
+Be then his love accursed, since love or hate,
+To me alike, it deals eternal woe.
+Nay, cursed be thou; since against his thy will
+Chose freely what it now so justly rues.
+Me miserable! which way shall I fly
+Infinite wrath, and infinite despair?
+Which way I fly is Hell; myself am Hell;
+And, in the lowest deep, a lower deep
+Still threatening to devour me opens wide,
+To which the Hell I suffer seems a Heaven.
+O, then, at last relent: Is there no place
+Left for repentance, none for pardon left?
+None left but by submission; and that word
+Disdain forbids me, and my dread of shame
+Among the Spirits beneath, whom I seduced
+With other promises and other vaunts
+Than to submit, boasting I could subdue
+The Omnipotent. Ay me! they little know
+How dearly I abide that boast so vain,
+Under what torments inwardly I groan,
+While they adore me on the throne of Hell.
+With diadem and scepter high advanced,
+The lower still I fall, only supreme
+In misery: Such joy ambition finds.
+But say I could repent, and could obtain,
+By act of grace, my former state; how soon
+Would highth recall high thoughts, how soon unsay
+What feigned submission swore? Ease would recant
+Vows made in pain, as violent and void.
+For never can true reconcilement grow,
+Where wounds of deadly hate have pierced so deep:
+Which would but lead me to a worse relapse
+And heavier fall: so should I purchase dear
+Short intermission bought with double smart.
+This knows my Punisher; therefore as far
+From granting he, as I from begging, peace;
+All hope excluded thus, behold, in stead
+Mankind created, and for him this world.
+So farewell, hope; and with hope farewell, fear;
+Farewell, remorse! all good to me is lost;
+Evil, be thou my good; by thee at least
+Divided empire with Heaven's King I hold,
+By thee, and more than half perhaps will reign;
+As Man ere long, and this new world, shall know.
+Thus while he spake, each passion dimmed his face
+Thrice changed with pale, ire, envy, and despair;
+Which marred his borrowed visage, and betrayed
+Him counterfeit, if any eye beheld.
+For heavenly minds from such distempers foul
+Are ever clear. Whereof he soon aware,
+Each perturbation smoothed with outward calm,
+Artificer of fraud; and was the first
+That practised falsehood under saintly show,
+Deep malice to conceal, couched with revenge:
+Yet not enough had practised to deceive
+Uriel once warned; whose eye pursued him down
+ The way he went, and on the Assyrian mount
+ Saw him disfigured, more than could befall
+ Spirit of happy sort; his gestures fierce
+ He marked and mad demeanour, then alone,
+ As he supposed, all unobserved, unseen.
+ So on he fares, and to the border comes
+ Of Eden, where delicious Paradise,
+ Now nearer, crowns with her enclosure green,
+ As with a rural mound, the champaign head
+ Of a steep wilderness, whose hairy sides
+Access denied; and overhead upgrew
+ Insuperable height of loftiest shade,
+ Cedar, and pine, and fir, and branching palm,
+ A sylvan scene, and, as the ranks ascend,
+ Shade above shade, a woody theatre
+ Of stateliest view. Yet higher than their tops
+ The verdurous wall of Paradise upsprung;
+
+ 00081429
+Which to our general sire gave prospect large
+Into his nether empire neighbouring round.
+And higher than that wall a circling row
+Of goodliest trees, loaden with fairest fruit,
+Blossoms and fruits at once of golden hue,
+Appeared, with gay enamelled colours mixed:
+On which the sun more glad impressed his beams
+Than in fair evening cloud, or humid bow,
+When God hath showered the earth; so lovely seemed
+That landskip: And of pure now purer air
+Meets his approach, and to the heart inspires
+Vernal delight and joy, able to drive
+All sadness but despair: Now gentle gales,
+Fanning their odoriferous wings, dispense
+Native perfumes, and whisper whence they stole
+Those balmy spoils. As when to them who fail
+Beyond the Cape of Hope, and now are past
+Mozambick, off at sea north-east winds blow
+Sabean odours from the spicy shore
+Of Araby the blest; with such delay
+Well pleased they slack their course, and many a league
+Cheered with the grateful smell old Ocean smiles:
+So entertained those odorous sweets the Fiend,
+Who came their bane; though with them better pleased
+Than Asmodeus with the fishy fume
+That drove him, though enamoured, from the spouse
+Of Tobit's son, and with a vengeance sent
+From Media post to Egypt, there fast bound.
+Now to the ascent of that steep savage hill
+Satan had journeyed on, pensive and slow;
+But further way found none, so thick entwined,
+As one continued brake, the undergrowth
+Of shrubs and tangling bushes had perplexed
+All path of man or beast that passed that way.
+One gate there only was, and that looked east
+On the other side: which when the arch-felon saw,
+Due entrance he disdained; and, in contempt,
+At one flight bound high over-leaped all bound
+Of hill or highest wall, and sheer within
+Lights on his feet. As when a prowling wolf,
+Whom hunger drives to seek new haunt for prey,
+Watching where shepherds pen their flocks at eve
+In hurdled cotes amid the field secure,
+Leaps o'er the fence with ease into the fold:
+Or as a thief, bent to unhoard the cash
+Of some rich burgher, whose substantial doors,
+Cross-barred and bolted fast, fear no assault,
+In at the window climbs, or o'er the tiles:
+So clomb this first grand thief into God's fold;
+So since into his church lewd hirelings climb.
+Thence up he flew, and on the tree of life,
+The middle tree and highest there that grew,
+Sat like a cormorant; yet not true life
+Thereby regained, but sat devising death
+To them who lived; nor on the virtue thought
+Of that life-giving plant, but only used
+For prospect, what well used had been the pledge
+Of immortality. So little knows
+Any, but God alone, to value right
+The good before him, but perverts best things
+To worst abuse, or to their meanest use.
+Beneath him with new wonder now he views,
+To all delight of human sense exposed,
+In narrow room, Nature's whole wealth, yea more,
+A Heaven on Earth: For blissful Paradise
+Of God the garden was, by him in the east
+Of Eden planted; Eden stretched her line
+From Auran eastward to the royal towers
+Of great Seleucia, built by Grecian kings,
+Of where the sons of Eden long before
+Dwelt in Telassar: In this pleasant soil
+His far more pleasant garden God ordained;
+Out of the fertile ground he caused to grow
+All trees of noblest kind for sight, smell, taste;
+And all amid them stood the tree of life,
+High eminent, blooming ambrosial fruit
+Of vegetable gold; and next to life,
+Our death, the tree of knowledge, grew fast by,
+Knowledge of good bought dear by knowing ill.
+Southward through Eden went a river large,
+Nor changed his course, but through the shaggy hill
+Passed underneath ingulfed; for God had thrown
+That mountain as his garden-mould high raised
+Upon the rapid current, which, through veins
+Of porous earth with kindly thirst up-drawn,
+Rose a fresh fountain, and with many a rill
+Watered the garden; thence united fell
+Down the steep glade, and met the nether flood,
+Which from his darksome passage now appears,
+And now, divided into four main streams,
+Runs diverse, wandering many a famous realm
+And country, whereof here needs no account;
+But rather to tell how, if Art could tell,
+How from that sapphire fount the crisped brooks,
+Rolling on orient pearl and sands of gold,
+With mazy errour under pendant shades
+Ran nectar, visiting each plant, and fed
+Flowers worthy of Paradise, which not nice Art
+In beds and curious knots, but Nature boon
+Poured forth profuse on hill, and dale, and plain,
+Both where the morning sun first warmly smote
+The open field, and where the unpierced shade
+Imbrowned the noontide bowers: Thus was this place
+A happy rural seat of various view;
+Groves whose rich trees wept odorous gums and balm,
+Others whose fruit, burnished with golden rind,
+Hung amiable, Hesperian fables true,
+If true, here only, and of delicious taste:
+Betwixt them lawns, or level downs, and flocks
+Grazing the tender herb, were interposed,
+Or palmy hillock; or the flowery lap
+Of some irriguous valley spread her store,
+Flowers of all hue, and without thorn the rose:
+Another side, umbrageous grots and caves
+Of cool recess, o'er which the mantling vine
+Lays forth her purple grape, and gently creeps
+Luxuriant; mean while murmuring waters fall
+Down the slope hills, dispersed, or in a lake,
+That to the fringed bank with myrtle crowned
+Her crystal mirrour holds, unite their streams.
+The birds their quire apply; airs, vernal airs,
+Breathing the smell of field and grove, attune
+The trembling leaves, while universal Pan,
+Knit with the Graces and the Hours in dance,
+Led on the eternal Spring. Not that fair field
+Of Enna, where Proserpine gathering flowers,
+Herself a fairer flower by gloomy Dis
+Was gathered, which cost Ceres all that pain
+To seek her through the world; nor that sweet grove
+Of Daphne by Orontes, and the inspired
+Castalian spring, might with this Paradise
+Of Eden strive; nor that Nyseian isle
+Girt with the river Triton, where old Cham,
+Whom Gentiles Ammon call and Libyan Jove,
+Hid Amalthea, and her florid son
+Young Bacchus, from his stepdame Rhea's eye;
+Nor where Abassin kings their issue guard,
+Mount Amara, though this by some supposed
+True Paradise under the Ethiop line
+By Nilus' head, enclosed with shining rock,
+A whole day's journey high, but wide remote
+From this Assyrian garden, where the Fiend
+Saw, undelighted, all delight, all kind
+Of living creatures, new to sight, and strange
+Two of far nobler shape, erect and tall,
+Godlike erect, with native honour clad
+In naked majesty seemed lords of all:
+And worthy seemed; for in their looks divine
+The image of their glorious Maker shone,
+Truth, wisdom, sanctitude severe and pure,
+(Severe, but in true filial freedom placed,)
+Whence true authority in men; though both
+Not equal, as their sex not equal seemed;
+For contemplation he and valour formed;
+For softness she and sweet attractive grace;
+He for God only, she for God in him:
+His fair large front and eye sublime declared
+Absolute rule; and hyacinthine locks
+Round from his parted forelock manly hung
+Clustering, but not beneath his shoulders broad:
+She, as a veil, down to the slender waist
+Her unadorned golden tresses wore
+Dishevelled, but in wanton ringlets waved
+As the vine curls her tendrils, which implied
+Subjection, but required with gentle sway,
+And by her yielded, by him best received,
+Yielded with coy submission, modest pride,
+And sweet, reluctant, amorous delay.
+Nor those mysterious parts were then concealed;
+Then was not guilty shame, dishonest shame
+Of nature's works, honour dishonourable,
+Sin-bred, how have ye troubled all mankind
+With shows instead, mere shows of seeming pure,
+And banished from man's life his happiest life,
+Simplicity and spotless innocence!
+So passed they naked on, nor shunned the sight
+Of God or Angel; for they thought no ill:
+So hand in hand they passed, the loveliest pair,
+That ever since in love's embraces met;
+Adam the goodliest man of men since born
+His sons, the fairest of her daughters Eve.
+Under a tuft of shade that on a green
+Stood whispering soft, by a fresh fountain side
+They sat them down; and, after no more toil
+Of their sweet gardening labour than sufficed
+To recommend cool Zephyr, and made ease
+More easy, wholesome thirst and appetite
+More grateful, to their supper-fruits they fell,
+Nectarine fruits which the compliant boughs
+Yielded them, side-long as they sat recline
+On the soft downy bank damasked with flowers:
+The savoury pulp they chew, and in the rind,
+Still as they thirsted, scoop the brimming stream;
+Nor gentle purpose, nor endearing smiles
+Wanted, nor youthful dalliance, as beseems
+Fair couple, linked in happy nuptial league,
+Alone as they. About them frisking played
+All beasts of the earth, since wild, and of all chase
+In wood or wilderness, forest or den;
+Sporting the lion ramped, and in his paw
+Dandled the kid; bears, tigers, ounces, pards,
+Gambolled before them; the unwieldy elephant,
+To make them mirth, used all his might, and wreathed
+His?kithetmroboscis; close the serpent sly,
+Insinuating, wove with Gordian twine
+His braided train, and of his fatal guile
+Gave proof unheeded; others on the grass
+Couched, and now filled with pasture gazing sat,
+Or bedward ruminating; for the sun,
+Declined, was hasting now with prone career
+To the ocean isles, and in the ascending scale
+Of Heaven the stars that usher evening rose:
+When Satan still in gaze, as first he stood,
+Scarce thus at length failed speech recovered sad.
+O Hell! what do mine eyes with grief behold!
+Into our room of bliss thus high advanced
+Creatures of other mould, earth-born perhaps,
+Not Spirits, yet to heavenly Spirits bright
+Little inferiour; whom my thoughts pursue
+With wonder, and could love, so lively shines
+In them divine resemblance, and such grace
+The hand that formed them on their shape hath poured.
+Ah! gentle pair, ye little think how nigh
+Your change approaches, when all these delights
+Will vanish, and deliver ye to woe;
+More woe, the more your taste is now of joy;
+Happy, but for so happy ill secured
+Long to continue, and this high seat your Heaven
+Ill fenced for Heaven to keep out such a foe
+As now is entered; yet no purposed foe
+To you, whom I could pity thus forlorn,
+Though I unpitied: League with you I seek,
+And mutual amity, so strait, so close,
+That I with you must dwell, or you with me
+Henceforth; my dwelling haply may not please,
+Like this fair Paradise, your sense; yet such
+Accept your Maker's work; he gave it me,
+Which I as freely give: Hell shall unfold,
+To entertain you two, her widest gates,
+And send forth all her kings; there will be room,
+Not like these narrow limits, to receive
+Your numerous offspring; if no better place,
+Thank him who puts me loth to this revenge
+On you who wrong me not for him who wronged.
+And should I at your harmless innocence
+Melt, as I do, yet publick reason just,
+Honour and empire with revenge enlarged,
+By conquering this new world, compels me now
+To do what else, though damned, I should abhor.
+So spake the Fiend, and with necessity,
+The tyrant's plea, excused his devilish deeds.
+Then from his lofty stand on that high tree
+Down he alights among the sportful herd
+Of those four-footed kinds, himself now one,
+Now other, as their shape served best his end
+Nearer to view his prey, and, unespied,
+To mark what of their state he more might learn,
+By word or action marked. About them round
+A lion now he stalks with fiery glare;
+Then as a tiger, who by chance hath spied
+In some purlieu two gentle fawns at play,
+Straight couches close, then, rising, changes oft
+His couchant watch, as one who chose his ground,
+Whence rushing, he might surest seize them both,
+Griped in each paw: when, Adam first of men
+To first of women Eve thus moving speech,
+Turned him, all ear to hear new utterance flow.
+Sole partner, and sole part, of all these joys,
+Dearer thyself than all; needs must the Power
+That made us, and for us this ample world,
+Be infinitely good, and of his good
+As liberal and free as infinite;
+That raised us from the dust, and placed us here
+In all this happiness, who at his hand
+Have nothing merited, nor can perform
+Aught whereof he hath need; he who requires
+From us no other service than to keep
+This one, this easy charge, of all the trees
+In Paradise that bear delicious fruit
+So various, not to taste that only tree
+Of knowledge, planted by the tree of life;
+So near grows death to life, whate'er death is,
+Some dreadful thing no doubt; for well thou knowest
+God hath pronounced it death to taste that tree,
+The only sign of our obedience left,
+Among so many signs of power and rule
+Conferred upon us, and dominion given
+Over all other creatures that possess
+Earth, air, and sea. Then let us not think hard
+One easy prohibition, who enjoy
+Free leave so large to all things else, and choice
+Unlimited of manifold delights:
+But let us ever praise him, and extol
+His bounty, following our delightful task,
+To prune these growing plants, and tend these flowers,
+Which were it toilsome, yet with thee were sweet.
+To whom thus Eve replied. O thou for whom
+And from whom I was formed, flesh of thy flesh,
+And without whom am to no end, my guide
+And head! what thou hast said is just and right.
+For we to him indeed all praises owe,
+And daily thanks; I chiefly, who enjoy
+So far the happier lot, enjoying thee
+Pre-eminent by so much odds, while thou
+Like consort to thyself canst no where find.
+That day I oft remember, when from sleep
+I first awaked, and found myself reposed
+Under a shade on flowers, much wondering where
+And what I was, whence thither brought, and how.
+Not distant far from thence a murmuring sound
+Of waters issued from a cave, and spread
+Into a liquid plain, then stood unmoved
+Pure as the expanse of Heaven; I thither went
+With unexperienced thought, and laid me down
+On the green bank, to look into the clear
+Smooth lake, that to me seemed another sky.
+As I bent down to look, just opposite
+A shape within the watery gleam appeared,
+Bending to look on me: I started back,
+It started back; but pleased I soon returned,
+Pleased it returned as soon with answering looks
+Of sympathy and love: There I had fixed
+Mine eyes till now, and pined with vain desire,
+Had not a voice thus warned me; 'What thou seest,
+'What there thou seest, fair Creature, is thyself;
+'With thee it came and goes: but follow me,
+'And I will bring thee where no shadow stays
+'Thy coming, and thy soft embraces, he
+'Whose image thou art; him thou shalt enjoy
+'Inseparably thine, to him shalt bear
+'Multitudes like thyself, and thence be called
+'Mother of human race.' What could I do,
+But follow straight, invisibly thus led?
+Till I espied thee, fair indeed and tall,
+Under a platane; yet methought less fair,
+Less winning soft, less amiably mild,
+Than that smooth watery image: Back I turned;
+Thou following cryedst aloud, 'Return, fair Eve;
+'Whom flyest thou? whom thou flyest, of him thou art,
+'His flesh, his bone; to give thee being I lent
+'Out of my side to thee, nearest my heart,
+'Substantial life, to have thee by my side
+'Henceforth an individual solace dear;
+'Part of my soul I seek thee, and thee claim
+'My other half:' With that thy gentle hand
+Seised mine: I yielded;and from that time see
+How beauty is excelled by manly grace,
+And wisdom, which alone is truly fair.
+So spake our general mother, and with eyes
+Of conjugal attraction unreproved,
+And meek surrender, half-embracing leaned
+On our first father; half her swelling breast
+Naked met his, under the flowing gold
+Of her loose tresses hid: he in delight
+Both of her beauty, and submissive charms,
+Smiled with superiour love, as Jupiter
+On Juno smiles, when he impregns the clouds
+That shed Mayflowers; and pressed her matron lip
+With kisses pure: Aside the Devil turned
+For envy; yet with jealous leer malign
+Eyed them askance, and to himself thus plained.
+Sight hateful, sight tormenting! thus these two,
+Imparadised in one another's arms,
+The happier Eden, shall enjoy their fill
+Of bliss on bliss; while I to Hell am thrust,
+Where neither joy nor love, but fierce desire,
+Among our other torments not the least,
+Still unfulfilled with pain of longing pines.
+Yet let me not forget what I have gained
+From their own mouths: All is not theirs, it seems;
+One fatal tree there stands, of knowledge called,
+Forbidden them to taste: Knowledge forbidden
+Suspicious, reasonless. Why should their Lord
+Envy them that? Can it be sin to know?
+Can it be death? And do they only stand
+By ignorance? Is that their happy state,
+The proof of their obedience and their faith?
+O fair foundation laid whereon to build
+Their ruin! hence I will excite their minds
+With more desire to know, and to reject
+Envious commands, invented with design
+To keep them low, whom knowledge might exalt
+Equal with Gods: aspiring to be such,
+They taste and die: What likelier can ensue
+But first with narrow search I must walk round
+This garden, and no corner leave unspied;
+A chance but chance may lead where I may meet
+Some wandering Spirit of Heaven by fountain side,
+Or in thick shade retired, from him to draw
+What further would be learned. Live while ye may,
+Yet happy pair; enjoy, till I return,
+Short pleasures, for long woes are to succeed!
+So saying, his proud step he scornful turned,
+But with sly circumspection, and began
+Through wood, through waste, o'er hill, o'er dale, his roam
+Mean while in utmost longitude, where Heaven
+With earth and ocean meets, the setting sun
+Slowly descended, and with right aspect
+Against the eastern gate of Paradise
+Levelled his evening rays: It was a rock
+Of alabaster, piled up to the clouds,
+Conspicuous far, winding with one ascent
+Accessible from earth, one entrance high;
+The rest was craggy cliff, that overhung
+Still as it rose, impossible to climb.
+Betwixt these rocky pillars Gabriel sat,
+Chief of the angelick guards, awaiting night;
+About him exercised heroick games
+The unarmed youth of Heaven, but nigh at hand
+Celestial armoury, shields, helms, and spears,
+Hung high with diamond flaming, and with gold.
+Thither came Uriel, gliding through the even
+On a sun-beam, swift as a shooting star
+In autumn thwarts the night, when vapours fired
+Impress the air, and shows the mariner
+From what point of his compass to beware
+Impetuous winds: He thus began in haste.
+Gabriel, to thee thy course by lot hath given
+Charge and strict watch, that to this happy place
+No evil thing approach or enter in.
+This day at highth of noon came to my sphere
+A Spirit, zealous, as he seemed, to know
+More of the Almighty's works, and chiefly Man,
+God's latest image: I described his way
+Bent all on speed, and marked his aery gait;
+But in the mount that lies from Eden north,
+Where he first lighted, soon discerned his looks
+Alien from Heaven, with passions foul obscured:
+Mine eye pursued him still, but under shade
+Lost sight of him: One of the banished crew,
+I fear, hath ventured from the deep, to raise
+New troubles; him thy care must be to find.
+To whom the winged warriour thus returned.
+Uriel, no wonder if thy perfect sight,
+Amid the sun's bright circle where thou sitst,
+See far and wide: In at this gate none pass
+The vigilance here placed, but such as come
+Well known from Heaven; and since meridian hour
+No creature thence: If Spirit of other sort,
+So minded, have o'er-leaped these earthly bounds
+On purpose, hard thou knowest it to exclude
+Spiritual substance with corporeal bar.
+But if within the circuit of these walks,
+In whatsoever shape he lurk, of whom
+Thou tellest, by morrow dawning I shall know.
+So promised he; and Uriel to his charge
+Returned on that bright beam, whose point now raised
+Bore him slope downward to the sun now fallen
+Beneath the Azores; whether the prime orb,
+Incredible how swift, had thither rolled
+Diurnal, or this less volubil earth,
+By shorter flight to the east, had left him there
+Arraying with reflected purple and gold
+The clouds that on his western throne attend.
+Now came still Evening on, and Twilight gray
+Had in her sober livery all things clad;
+Silence accompanied; for beast and bird,
+They to their grassy couch, these to their nests
+Were slunk, all but the wakeful nightingale;
+She all night long her amorous descant sung;
+Silence was pleased: Now glowed the firmament
+With living sapphires: Hesperus, that led
+The starry host, rode brightest, till the moon,
+Rising in clouded majesty, at length
+Apparent queen unveiled her peerless light,
+And o'er the dark her silver mantle threw.
+When Adam thus to Eve. Fair Consort, the hour
+Of night, and all things now retired to rest,
+Mind us of like repose; since God hath set
+Labour and rest, as day and night, to men
+Successive; and the timely dew of sleep,
+Now falling with soft slumbrous weight, inclines
+Our eye-lids: Other creatures all day long
+Rove idle, unemployed, and less need rest;
+Man hath his daily work of body or mind
+Appointed, which declares his dignity,
+And the regard of Heaven on all his ways;
+While other animals unactive range,
+And of their doings God takes no account.
+To-morrow, ere fresh morning streak the east
+With first approach of light, we must be risen,
+And at our pleasant labour, to reform
+Yon flowery arbours, yonder alleys green,
+Our walk at noon, with branches overgrown,
+That mock our scant manuring, and require
+More hands than ours to lop their wanton growth:
+Those blossoms also, and those dropping gums,
+That lie bestrown, unsightly and unsmooth,
+Ask riddance, if we mean to tread with ease;
+Mean while, as Nature wills, night bids us rest.
+To whom thus Eve, with perfect beauty adorned
+My Author and Disposer, what thou bidst
+Unargued I obey: So God ordains;
+God is thy law, thou mine: To know no more
+Is woman's happiest knowledge, and her praise.
+With thee conversing I forget all time;
+All seasons, and their change, all please alike.
+Sweet is the breath of Morn, her rising sweet,
+With charm of earliest birds: pleasant the sun,
+When first on this delightful land he spreads
+His orient beams, on herb, tree, fruit, and flower,
+Glistering with dew; fragrant the fertile earth
+After soft showers; and sweet the coming on
+Of grateful Evening mild; then silent Night,
+With this her solemn bird, and this fair moon,
+And these the gems of Heaven, her starry train:
+But neither breath of Morn, when she ascends
+With charm of earliest birds; nor rising sun
+On this delightful land; nor herb, fruit, flower,
+Glistering with dew; nor fragrance after showers;
+Nor grateful Evening mild; nor silent Night,
+With this her solemn bird, nor walk by moon,
+Or glittering star-light, without thee is sweet.
+But wherefore all night long shine these? for whom
+This glorious sight, when sleep hath shut all eyes?
+To whom our general ancestor replied.
+Daughter of God and Man, accomplished Eve,
+These have their course to finish round the earth,
+By morrow evening, and from land to land
+In order, though to nations yet unborn,
+Ministring light prepared, they set and rise;
+Lest total Darkness should by night regain
+Her old possession, and extinguish life
+In Nature and all things; which these soft fires
+Not only enlighten, but with kindly heat
+Of various influence foment and warm,
+Temper or nourish, or in part shed down
+Their stellar virtue on all kinds that grow
+On earth, made hereby apter to receive
+Perfection from the sun's more potent ray.
+These then, though unbeheld in deep of night,
+Shine not in vain; nor think, though men were none,
+That Heaven would want spectators, God want praise:
+Millions of spiritual creatures walk the earth
+Unseen, both when we wake, and when we sleep:
+All these with ceaseless praise his works behold
+Both day and night: How often from the steep
+Of echoing hill or thicket have we heard
+Celestial voices to the midnight air,
+Sole, or responsive each to others note,
+Singing their great Creator? oft in bands
+While they keep watch, or nightly rounding walk,
+With heavenly touch of instrumental sounds
+In full harmonick number joined, their songs
+Divide the night, and lift our thoughts to Heaven.
+Thus talking, hand in hand alone they passed
+On to their blissful bower: it was a place
+Chosen by the sovran Planter, when he framed
+All things to Man's delightful use; the roof
+Of thickest covert was inwoven shade
+Laurel and myrtle, and what higher grew
+Of firm and fragrant leaf; on either side
+Acanthus, and each odorous bushy shrub,
+Fenced up the verdant wall; each beauteous flower,
+Iris all hues, roses, and jessamin,
+Reared high their flourished heads between, and wrought
+Mosaick; underfoot the violet,
+Crocus, and hyacinth, with rich inlay
+Broidered the ground, more coloured than with stone
+Of costliest emblem: Other creature here,
+Bird, beast, insect, or worm, durst enter none,
+Such was their awe of Man. In shadier bower
+More sacred and sequestered, though but feigned,
+Pan or Sylvanus never slept, nor Nymph
+Nor Faunus haunted. Here, in close recess,
+With flowers, garlands, and sweet-smelling herbs,
+Espoused Eve decked first her nuptial bed;
+And heavenly quires the hymenaean sung,
+What day the genial Angel to our sire
+Brought her in naked beauty more adorned,
+More lovely, than Pandora, whom the Gods
+Endowed with all their gifts, and O! too like
+In sad event, when to the unwiser son
+Of Japhet brought by Hermes, she ensnared
+Mankind with her fair looks, to be avenged
+On him who had stole Jove's authentick fire.
+Thus, at their shady lodge arrived, both stood,
+Both turned, and under open sky adored
+The God that made both sky, air, earth, and heaven,
+Which they beheld, the moon's resplendent globe,
+And starry pole: Thou also madest the night,
+Maker Omnipotent, and thou the day,
+Which we, in our appointed work employed,
+Have finished, happy in our mutual help
+And mutual love, the crown of all our bliss
+Ordained by thee; and this delicious place
+For us too large, where thy abundance wants
+Partakers, and uncropt falls to the ground.
+But thou hast promised from us two a race
+To fill the earth, who shall with us extol
+Thy goodness infinite, both when we wake,
+And when we seek, as now, thy gift of sleep.
+This said unanimous, and other rites
+Observing none, but adoration pure
+Which God likes best, into their inmost bower
+Handed they went; and, eased the putting off
+These troublesome disguises which we wear,
+Straight side by side were laid; nor turned, I ween,
+Adam from his fair spouse, nor Eve the rites
+Mysterious of connubial love refused:
+Whatever hypocrites austerely talk
+Of purity, and place, and innocence,
+Defaming as impure what God declares
+Pure, and commands to some, leaves free to all.
+Our Maker bids encrease; who bids abstain
+But our Destroyer, foe to God and Man?
+Hail, wedded Love, mysterious law, true source
+Of human offspring, sole propriety
+In Paradise of all things common else!
+By thee adulterous Lust was driven from men
+Among the bestial herds to range; by thee
+Founded in reason, loyal, just, and pure,
+Relations dear, and all the charities
+Of father, son, and brother, first were known.
+Far be it, that I should write thee sin or blame,
+Or think thee unbefitting holiest place,
+Perpetual fountain of domestick sweets,
+Whose bed is undefiled and chaste pronounced,
+Present, or past, as saints and patriarchs used.
+Here Love his golden shafts employs, here lights
+His constant lamp, and waves his purple wings,
+Reigns here and revels; not in the bought smile
+Of harlots, loveless, joyless, unendeared,
+Casual fruition; nor in court-amours,
+Mixed dance, or wanton mask, or midnight ball,
+Or serenate, which the starved lover sings
+To his proud fair, best quitted with disdain.
+These, lulled by nightingales, embracing slept,
+And on their naked limbs the flowery roof
+Showered roses, which the morn repaired. Sleep on,
+Blest pair; and O!yet happiest, if ye seek
+No happier state, and know to know no more.
+Now had night measured with her shadowy cone
+Half way up hill this vast sublunar vault,
+And from their ivory port the Cherubim,
+Forth issuing at the accustomed hour, stood armed
+To their night watches in warlike parade;
+When Gabriel to his next in power thus spake.
+Uzziel, half these draw off, and coast the south
+With strictest watch; these other wheel the north;
+Our circuit meets full west. As flame they part,
+Half wheeling to the shield, half to the spear.
+From these, two strong and subtle Spirits he called
+That near him stood, and gave them thus in charge.
+Ithuriel and Zephon, with winged speed
+Search through this garden, leave unsearched no nook;
+But chiefly where those two fair creatures lodge,
+Now laid perhaps asleep, secure of harm.
+This evening from the sun's decline arrived,
+Who tells of some infernal Spirit seen
+Hitherward bent (who could have thought?) escaped
+The bars of Hell, on errand bad no doubt:
+Such, where ye find, seise fast, and hither bring.
+So saying, on he led his radiant files,
+Dazzling the moon; these to the bower direct
+In search of whom they sought: Him there they found
+Squat like a toad, close at the ear of Eve,
+Assaying by his devilish art to reach
+The organs of her fancy, and with them forge
+Illusions, as he list, phantasms and dreams;
+Or if, inspiring venom, he might taint
+The animal spirits, that from pure blood arise
+Like gentle breaths from rivers pure, thence raise
+At least distempered, discontented thoughts,
+Vain hopes, vain aims, inordinate desires,
+Blown up with high conceits ingendering pride.
+Him thus intent Ithuriel with his spear
+Touched lightly; for no falshood can endure
+Touch of celestial temper, but returns
+Of force to its own likeness: Up he starts
+Discovered and surprised. As when a spark
+Lights on a heap of nitrous powder, laid
+Fit for the tun some magazine to store
+Against a rumoured war, the smutty grain,
+With sudden blaze diffused, inflames the air;
+So started up in his own shape the Fiend.
+Back stept those two fair Angels, half amazed
+So sudden to behold the grisly king;
+Yet thus, unmoved with fear, accost him soon.
+Which of those rebel Spirits adjudged to Hell
+Comest thou, escaped thy prison? and, transformed,
+Why sat'st thou like an enemy in wait,
+Here watching at the head of these that sleep?
+Know ye not then said Satan, filled with scorn,
+Know ye not me? ye knew me once no mate
+For you, there sitting where ye durst not soar:
+Not to know me argues yourselves unknown,
+The lowest of your throng; or, if ye know,
+Why ask ye, and superfluous begin
+Your message, like to end as much in vain?
+To whom thus Zephon, answering scorn with scorn.
+Think not, revolted Spirit, thy shape the same,
+Or undiminished brightness to be known,
+As when thou stoodest in Heaven upright and pure;
+That glory then, when thou no more wast good,
+Departed from thee; and thou resemblest now
+Thy sin and place of doom obscure and foul.
+But come, for thou, be sure, shalt give account
+To him who sent us, whose charge is to keep
+This place inviolable, and these from harm.
+So spake the Cherub; and his grave rebuke,
+Severe in youthful beauty, added grace
+Invincible: Abashed the Devil stood,
+And felt how awful goodness is, and saw
+Virtue in her shape how lovely; saw, and pined
+His loss; but chiefly to find here observed
+His lustre visibly impaired; yet seemed
+Undaunted. If I must contend, said he,
+Best with the best, the sender, not the sent,
+Or all at once; more glory will be won,
+Or less be lost. Thy fear, said Zephon bold,
+Will save us trial what the least can do
+Single against thee wicked, and thence weak.
+The Fiend replied not, overcome with rage;
+But, like a proud steed reined, went haughty on,
+Champing his iron curb: To strive or fly
+He held it vain; awe from above had quelled
+His heart, not else dismayed. Now drew they nigh
+The western point, where those half-rounding guards
+Just met, and closing stood in squadron joined,
+A waiting next command. To whom their Chief,
+Gabriel, from the front thus called aloud.
+O friends! I hear the tread of nimble feet
+Hasting this way, and now by glimpse discern
+Ithuriel and Zephon through the shade;
+And with them comes a third of regal port,
+But faded splendour wan; who by his gait
+And fierce demeanour seems the Prince of Hell,
+Not likely to part hence without contest;
+Stand firm, for in his look defiance lours.
+He scarce had ended, when those two approached,
+And brief related whom they brought, where found,
+How busied, in what form and posture couched.
+To whom with stern regard thus Gabriel spake.
+Why hast thou, Satan, broke the bounds prescribed
+To thy transgressions, and disturbed the charge
+Of others, who approve not to transgress
+By thy example, but have power and right
+To question thy bold entrance on this place;
+Employed, it seems, to violate sleep, and those
+Whose dwelling God hath planted here in bliss!
+To whom thus Satan with contemptuous brow.
+Gabriel? thou hadst in Heaven the esteem of wise,
+And such I held thee; but this question asked
+Puts me in doubt. Lives there who loves his pain!
+Who would not, finding way, break loose from Hell,
+Though thither doomed! Thou wouldst thyself, no doubt
+And boldly venture to whatever place
+Farthest from pain, where thou mightst hope to change
+Torment with ease, and soonest recompense
+Dole with delight, which in this place I sought;
+To thee no reason, who knowest only good,
+But evil hast not tried: and wilt object
+His will who bounds us! Let him surer bar
+His iron gates, if he intends our stay
+In that dark durance: Thus much what was asked.
+The rest is true, they found me where they say;
+But that implies not violence or harm.
+Thus he in scorn. The warlike Angel moved,
+Disdainfully half smiling, thus replied.
+O loss of one in Heaven to judge of wise
+Since Satan fell, whom folly overthrew,
+And now returns him from his prison 'scaped,
+Gravely in doubt whether to hold them wise
+Or not, who ask what boldness brought him hither
+Unlicensed from his bounds in Hell prescribed;
+So wise he judges it to fly from pain
+However, and to 'scape his punishment!
+So judge thou still, presumptuous! till the wrath,
+Which thou incurrest by flying, meet thy flight
+Sevenfold, and scourge that wisdom back to Hell,
+Which taught thee yet no better, that no pain
+Can equal anger infinite provoked.
+But wherefore thou alone? wherefore with thee
+Came not all hell broke loose? or thou than they
+Less hardy to endure? Courageous Chief!
+The first in flight from pain! hadst thou alleged
+To thy deserted host this cause of flight,
+Thou surely hadst not come sole fugitive.
+To which the Fiend thus answered, frowning stern.
+Not that I less endure, or shrink from pain,
+Insulting Angel! well thou knowest I stood
+Thy fiercest, when in battle to thy aid
+The blasting vollied thunder made all speed,
+And seconded thy else not dreaded spear.
+But still thy words at random, as before,
+Argue thy inexperience what behoves
+From hard assays and ill successes past
+A faithful leader, not to hazard all
+Through ways of danger by himself untried:
+I, therefore, I alone first undertook
+To wing the desolate abyss, and spy
+This new created world, whereof in Hell
+Fame is not silent, here in hope to find
+Better abode, and my afflicted Powers
+To settle here on earth, or in mid air;
+Though for possession put to try once more
+What thou and thy gay legions dare against;
+Whose easier business were to serve their Lord
+High up in Heaven, with songs to hymn his throne,
+And practised distances to cringe, not fight,
+To whom the warriour Angel soon replied.
+To say and straight unsay, pretending first
+Wise to fly pain, professing next the spy,
+Argues no leader but a liear traced,
+Satan, and couldst thou faithful add? O name,
+O sacred name of faithfulness profaned!
+Faithful to whom? to thy rebellious crew?
+Army of Fiends, fit body to fit head.
+Was this your discipline and faith engaged,
+Your military obedience, to dissolve
+Allegiance to the acknowledged Power supreme?
+And thou, sly hypocrite, who now wouldst seem
+Patron of liberty, who more than thou
+Once fawned, and cringed, and servily adored
+Heaven's awful Monarch? wherefore, but in hope
+To dispossess him, and thyself to reign?
+But mark what I arreed thee now, Avant;
+Fly neither whence thou fledst! If from this hour
+Within these hallowed limits thou appear,
+Back to the infernal pit I drag thee chained,
+And seal thee so, as henceforth not to scorn
+The facile gates of Hell too slightly barred.
+So threatened he; but Satan to no threats
+Gave heed, but waxing more in rage replied.
+Then when I am thy captive talk of chains,
+Proud limitary Cherub! but ere then
+Far heavier load thyself expect to feel
+From my prevailing arm, though Heaven's King
+Ride on thy wings, and thou with thy compeers,
+Us'd to the yoke, drawest his triumphant wheels
+In progress through the road of Heaven star-paved.
+While thus he spake, the angelick squadron bright
+Turned fiery red, sharpening in mooned horns
+Their phalanx, and began to hem him round
+With ported spears, as thick as when a field
+Of Ceres ripe for harvest waving bends
+Her bearded grove of ears, which way the wind
+Sways them; the careful plowman doubting stands,
+Left on the threshing floor his hopeless sheaves
+Prove chaff. On the other side, Satan, alarmed,
+Collecting all his might, dilated stood,
+Like Teneriff or Atlas, unremoved:
+His stature reached the sky, and on his crest
+Sat Horrour plumed; nor wanted in his grasp
+What seemed both spear and shield: Now dreadful deeds
+Might have ensued, nor only Paradise
+In this commotion, but the starry cope
+Of Heaven perhaps, or all the elements
+At least had gone to wrack, disturbed and torn
+With violence of this conflict, had not soon
+The Eternal, to prevent such horrid fray,
+Hung forth in Heaven his golden scales, yet seen
+Betwixt Astrea and the Scorpion sign,
+Wherein all things created first he weighed,
+The pendulous round earth with balanced air
+In counterpoise, now ponders all events,
+Battles and realms: In these he put two weights,
+The sequel each of parting and of fight:
+The latter quick up flew, and kicked the beam,
+Which Gabriel spying, thus bespake the Fiend.
+Satan, I know thy strength, and thou knowest mine;
+Neither our own, but given: What folly then
+To boast what arms can do? since thine no more
+Than Heaven permits, nor mine, though doubled now
+To trample thee as mire: For proof look up,
+And read thy lot in yon celestial sign;
+Where thou art weighed, and shown how light, how weak,
+If thou resist. The Fiend looked up, and knew
+His mounted scale aloft: Nor more;but fled
+Murmuring, and with him fled the shades of night.
+
+
+
+Book V
+
+
+Now Morn, her rosy steps in the eastern clime
+Advancing, sowed the earth with orient pearl,
+When Adam waked, so customed; for his sleep
+Was aery-light, from pure digestion bred,
+And temperate vapours bland, which the only sound
+Of leaves and fuming rills, Aurora's fan,
+Lightly dispersed, and the shrill matin song
+Of birds on every bough; so much the more
+His wonder was to find unwakened Eve
+With tresses discomposed, and glowing cheek,
+As through unquiet rest: He, on his side
+Leaning half raised, with looks of cordial love
+Hung over her enamoured, and beheld
+Beauty, which, whether waking or asleep,
+Shot forth peculiar graces; then with voice
+Mild, as when Zephyrus on Flora breathes,
+Her hand soft touching, whispered thus. Awake,
+My fairest, my espoused, my latest found,
+Heaven's last best gift, my ever new delight!
+Awake: The morning shines, and the fresh field
+Calls us; we lose the prime, to mark how spring
+Our tender plants, how blows the citron grove,
+What drops the myrrh, and what the balmy reed,
+How nature paints her colours, how the bee
+Sits on the bloom extracting liquid sweet.
+Such whispering waked her, but with startled eye
+On Adam, whom embracing, thus she spake.
+O sole in whom my thoughts find all repose,
+My glory, my perfection! glad I see
+Thy face, and morn returned; for I this night
+(Such night till this I never passed) have dreamed,
+If dreamed, not, as I oft am wont, of thee,
+Works of day past, or morrow's next design,
+But of offence and trouble, which my mind
+Knew never till this irksome night: Methought,
+Close at mine ear one called me forth to walk
+With gentle voice; I thought it thine: It said,
+'Why sleepest thou, Eve? now is the pleasant time,
+'The cool, the silent, save where silence yields
+'To the night-warbling bird, that now awake
+'Tunes sweetest his love-laboured song; now reigns
+'Full-orbed the moon, and with more pleasing light
+'Shadowy sets off the face of things; in vain,
+'If none regard; Heaven wakes with all his eyes,
+'Whom to behold but thee, Nature's desire?
+'In whose sight all things joy, with ravishment
+'Attracted by thy beauty still to gaze.'
+I rose as at thy call, but found thee not;
+To find thee I directed then my walk;
+And on, methought, alone I passed through ways
+That brought me on a sudden to the tree
+Of interdicted knowledge: fair it seemed,
+Much fairer to my fancy than by day:
+And, as I wondering looked, beside it stood
+One shaped and winged like one of those from Heaven
+By us oft seen; his dewy locks distilled
+Ambrosia; on that tree he also gazed;
+And 'O fair plant,' said he, 'with fruit surcharged,
+'Deigns none to ease thy load, and taste thy sweet,
+'Nor God, nor Man? Is knowledge so despised?
+'Or envy, or what reserve forbids to taste?
+'Forbid who will, none shall from me withhold
+'Longer thy offered good; why else set here?
+This said, he paused not, but with venturous arm
+He plucked, he tasted; me damp horrour chilled
+At such bold words vouched with a deed so bold:
+But he thus, overjoyed; 'O fruit divine,
+'Sweet of thyself, but much more sweet thus cropt,
+'Forbidden here, it seems, as only fit
+'For Gods, yet able to make Gods of Men:
+'And why not Gods of Men; since good, the more
+'Communicated, more abundant grows,
+'The author not impaired, but honoured more?
+'Here, happy creature, fair angelick Eve!
+'Partake thou also; happy though thou art,
+'Happier thou mayest be, worthier canst not be:
+'Taste this, and be henceforth among the Gods
+'Thyself a Goddess, not to earth confined,
+'But sometimes in the air, as we, sometimes
+'Ascend to Heaven, by merit thine, and see
+'What life the Gods live there, and such live thou!'
+So saying, he drew nigh, and to me held,
+Even to my mouth of that same fruit held part
+Which he had plucked; the pleasant savoury smell
+So quickened appetite, that I, methought,
+Could not but taste. Forthwith up to the clouds
+With him I flew, and underneath beheld
+The earth outstretched immense, a prospect wide
+And various: Wondering at my flight and change
+To this high exaltation; suddenly
+My guide was gone, and I, methought, sunk down,
+And fell asleep; but O, how glad I waked
+To find this but a dream! Thus Eve her night
+Related, and thus Adam answered sad.
+Best image of myself, and dearer half,
+The trouble of thy thoughts this night in sleep
+Affects me equally; nor can I like
+This uncouth dream, of evil sprung, I fear;
+Yet evil whence? in thee can harbour none,
+Created pure. But know that in the soul
+Are many lesser faculties, that serve
+Reason as chief; among these Fancy next
+Her office holds; of all external things
+Which the five watchful senses represent,
+She forms imaginations, aery shapes,
+Which Reason, joining or disjoining, frames
+All what we affirm or what deny, and call
+Our knowledge or opinion; then retires
+Into her private cell, when nature rests.
+Oft in her absence mimick Fancy wakes
+To imitate her; but, misjoining shapes,
+Wild work produces oft, and most in dreams;
+Ill matching words and deeds long past or late.
+Some such resemblances, methinks, I find
+Of our last evening's talk, in this thy dream,
+But with addition strange; yet be not sad.
+Evil into the mind of God or Man
+May come and go, so unreproved, and leave
+No spot or blame behind: Which gives me hope
+That what in sleep thou didst abhor to dream,
+Waking thou never will consent to do.
+Be not disheartened then, nor cloud those looks,
+That wont to be more cheerful and serene,
+Than when fair morning first smiles on the world;
+And let us to our fresh employments rise
+Among the groves, the fountains, and the flowers
+That open now their choisest bosomed smells,
+Reserved from night, and kept for thee in store.
+So cheered he his fair spouse, and she was cheered;
+But silently a gentle tear let fall
+From either eye, and wiped them with her hair;
+Two other precious drops that ready stood,
+Each in their crystal sluice, he ere they fell
+Kissed, as the gracious signs of sweet remorse
+And pious awe, that feared to have offended.
+So all was cleared, and to the field they haste.
+But first, from under shady arborous roof
+Soon as they forth were come to open sight
+Of day-spring, and the sun, who, scarce up-risen,
+With wheels yet hovering o'er the ocean-brim,
+Shot parallel to the earth his dewy ray,
+Discovering in wide landskip all the east
+Of Paradise and Eden's happy plains,
+Lowly they bowed adoring, and began
+Their orisons, each morning duly paid
+In various style; for neither various style
+Nor holy rapture wanted they to praise
+Their Maker, in fit strains pronounced, or sung
+Unmeditated; such prompt eloquence
+Flowed from their lips, in prose or numerous verse,
+More tuneable than needed lute or harp
+To add more sweetness; and they thus began.
+These are thy glorious works, Parent of good,
+Almighty! Thine this universal frame,
+Thus wonderous fair; Thyself how wonderous then!
+Unspeakable, who sitst above these heavens
+To us invisible, or dimly seen
+In these thy lowest works; yet these declare
+Thy goodness beyond thought, and power divine.
+Speak, ye who best can tell, ye sons of light,
+Angels; for ye behold him, and with songs
+And choral symphonies, day without night,
+Circle his throne rejoicing; ye in Heaven
+On Earth join all ye Creatures to extol
+Him first, him last, him midst, and without end.
+Fairest of stars, last in the train of night,
+If better thou belong not to the dawn,
+Sure pledge of day, that crownest the smiling morn
+With thy bright circlet, praise him in thy sphere,
+While day arises, that sweet hour of prime.
+Thou Sun, of this great world both eye and soul,
+Acknowledge him thy greater; sound his praise
+In thy eternal course, both when thou climbest,
+And when high noon hast gained, and when thou fallest.
+Moon, that now meetest the orient sun, now flyest,
+With the fixed Stars, fixed in their orb that flies;
+And ye five other wandering Fires, that move
+In mystick dance not without song, resound
+His praise, who out of darkness called up light.
+Air, and ye Elements, the eldest birth
+Of Nature's womb, that in quaternion run
+Perpetual circle, multiform; and mix
+And nourish all things; let your ceaseless change
+Vary to our great Maker still new praise.
+Ye Mists and Exhalations, that now rise
+From hill or steaming lake, dusky or gray,
+Till the sun paint your fleecy skirts with gold,
+In honour to the world's great Author rise;
+Whether to deck with clouds the uncoloured sky,
+Or wet the thirsty earth with falling showers,
+Rising or falling still advance his praise.
+His praise, ye Winds, that from four quarters blow,
+Breathe soft or loud; and, wave your tops, ye Pines,
+With every plant, in sign of worship wave.
+Fountains, and ye that warble, as ye flow,
+Melodious murmurs, warbling tune his praise.
+Join voices, all ye living Souls: Ye Birds,
+That singing up to Heaven-gate ascend,
+Bear on your wings and in your notes his praise.
+Ye that in waters glide, and ye that walk
+The earth, and stately tread, or lowly creep;
+Witness if I be silent, morn or even,
+To hill, or valley, fountain, or fresh shade,
+Made vocal by my song, and taught his praise.
+Hail, universal Lord, be bounteous still
+To give us only good; and if the night
+Have gathered aught of evil, or concealed,
+Disperse it, as now light dispels the dark!
+So prayed they innocent, and to their thoughts
+Firm peace recovered soon, and wonted calm.
+On to their morning's rural work they haste,
+Among sweet dews and flowers; where any row
+Of fruit-trees over-woody reached too far
+Their pampered boughs, and needed hands to check
+Fruitless embraces: or they led the vine
+To wed her elm; she, spoused, about him twines
+Her marriageable arms, and with him brings
+Her dower, the adopted clusters, to adorn
+His barren leaves. Them thus employed beheld
+With pity Heaven's high King, and to him called
+Raphael, the sociable Spirit, that deigned
+To travel with Tobias, and secured
+His marriage with the seventimes-wedded maid.
+Raphael, said he, thou hearest what stir on Earth
+Satan, from Hell 'scaped through the darksome gulf,
+Hath raised in Paradise; and how disturbed
+This night the human pair; how he designs
+In them at once to ruin all mankind.
+Go therefore, half this day as friend with friend
+Converse with Adam, in what bower or shade
+Thou findest him from the heat of noon retired,
+To respite his day-labour with repast,
+Or with repose; and such discourse bring on,
+As may advise him of his happy state,
+Happiness in his power left free to will,
+Left to his own free will, his will though free,
+Yet mutable; whence warn him to beware
+He swerve not, too secure: Tell him withal
+His danger, and from whom; what enemy,
+Late fallen himself from Heaven, is plotting now
+The fall of others from like state of bliss;
+By violence? no, for that shall be withstood;
+But by deceit and lies: This let him know,
+Lest, wilfully transgressing, he pretend
+Surprisal, unadmonished, unforewarned.
+So spake the Eternal Father, and fulfilled
+All justice: Nor delayed the winged Saint
+After his charge received; but from among
+Thousand celestial Ardours, where he stood
+Veiled with his gorgeous wings, up springing light,
+Flew through the midst of Heaven; the angelick quires,
+On each hand parting, to his speed gave way
+Through all the empyreal road; till, at the gate
+Of Heaven arrived, the gate self-opened wide
+On golden hinges turning, as by work
+Divine the sovran Architect had framed.
+From hence no cloud, or, to obstruct his sight,
+Star interposed, however small he sees,
+Not unconformed to other shining globes,
+Earth, and the garden of God, with cedars crowned
+Above all hills. As when by night the glass
+Of Galileo, less assured, observes
+Imagined lands and regions in the moon:
+Or pilot, from amidst the Cyclades
+Delos or Samos first appearing, kens
+A cloudy spot. Down thither prone in flight
+He speeds, and through the vast ethereal sky
+Sails between worlds and worlds, with steady wing
+Now on the polar winds, then with quick fan
+Winnows the buxom air; till, within soar
+Of towering eagles, to all the fowls he seems
+A phoenix, gazed by all as that sole bird,
+When, to enshrine his reliques in the Sun's
+Bright temple, to Egyptian Thebes he flies.
+At once on the eastern cliff of Paradise
+He lights, and to his proper shape returns
+A Seraph winged: Six wings he wore, to shade
+His lineaments divine; the pair that clad
+Each shoulder broad, came mantling o'er his breast
+With regal ornament; the middle pair
+Girt like a starry zone his waist, and round
+Skirted his loins and thighs with downy gold
+And colours dipt in Heaven; the third his feet
+Shadowed from either heel with feathered mail,
+Sky-tinctured grain. Like Maia's son he stood,
+And shook his plumes, that heavenly fragrance filled
+The circuit wide. Straight knew him all the bands
+Of Angels under watch; and to his state,
+And to his message high, in honour rise;
+For on some message high they guessed him bound.
+Their glittering tents he passed, and now is come
+Into the blissful field, through groves of myrrh,
+And flowering odours, cassia, nard, and balm;
+A wilderness of sweets; for Nature here
+Wantoned as in her prime, and played at will
+Her virgin fancies pouring forth more sweet,
+Wild above rule or art, enormous bliss.
+Him through the spicy forest onward come
+Adam discerned, as in the door he sat
+Of his cool bower, while now the mounted sun
+Shot down direct his fervid rays to warm
+Earth's inmost womb, more warmth than Adam needs:
+And Eve within, due at her hour prepared
+For dinner savoury fruits, of taste to please
+True appetite, and not disrelish thirst
+Of nectarous draughts between, from milky stream,
+Berry or grape: To whom thus Adam called.
+Haste hither, Eve, and worth thy sight behold
+Eastward among those trees, what glorious shape
+Comes this way moving; seems another morn
+Risen on mid-noon; some great behest from Heaven
+To us perhaps he brings, and will vouchsafe
+This day to be our guest. But go with speed,
+And, what thy stores contain, bring forth, and pour
+Abundance, fit to honour and receive
+Our heavenly stranger: Well we may afford
+Our givers their own gifts, and large bestow
+From large bestowed, where Nature multiplies
+Her fertile growth, and by disburthening grows
+More fruitful, which instructs us not to spare.
+To whom thus Eve. Adam, earth's hallowed mould,
+Of God inspired! small store will serve, where store,
+All seasons, ripe for use hangs on the stalk;
+Save what by frugal storing firmness gains
+To nourish, and superfluous moist consumes:
+But I will haste, and from each bough and brake,
+Each plant and juciest gourd, will pluck such choice
+To entertain our Angel-guest, as he
+Beholding shall confess, that here on Earth
+God hath dispensed his bounties as in Heaven.
+So saying, with dispatchful looks in haste
+She turns, on hospitable thoughts intent
+What choice to choose for delicacy best,
+What order, so contrived as not to mix
+Tastes, not well joined, inelegant, but bring
+Taste after taste upheld with kindliest change;
+Bestirs her then, and from each tender stalk
+Whatever Earth, all-bearing mother, yields
+In India East or West, or middle shore
+In Pontus or the Punick coast, or where
+Alcinous reigned, fruit of all kinds, in coat
+Rough, or smooth rind, or bearded husk, or shell,
+She gathers, tribute large, and on the board
+Heaps with unsparing hand; for drink the grape
+She crushes, inoffensive must, and meaths
+From many a berry, and from sweet kernels pressed
+She tempers dulcet creams; nor these to hold
+Wants her fit vessels pure; then strows the ground
+With rose and odours from the shrub unfumed.
+Mean while our primitive great sire, to meet
+His God-like guest, walks forth, without more train
+Accompanied than with his own complete
+Perfections; in himself was all his state,
+More solemn than the tedious pomp that waits
+On princes, when their rich retinue long
+Of horses led, and grooms besmeared with gold,
+Dazzles the croud, and sets them all agape.
+Nearer his presence Adam, though not awed,
+Yet with submiss approach and reverence meek,
+As to a superiour nature bowing low,
+Thus said. Native of Heaven, for other place
+None can than Heaven such glorious shape contain;
+Since, by descending from the thrones above,
+Those happy places thou hast deigned a while
+To want, and honour these, vouchsafe with us
+Two only, who yet by sovran gift possess
+This spacious ground, in yonder shady bower
+To rest; and what the garden choicest bears
+To sit and taste, till this meridian heat
+Be over, and the sun more cool decline.
+Whom thus the angelick Virtue answered mild.
+Adam, I therefore came; nor art thou such
+Created, or such place hast here to dwell,
+As may not oft invite, though Spirits of Heaven,
+To visit thee; lead on then where thy bower
+O'ershades; for these mid-hours, till evening rise,
+I have at will. So to the sylvan lodge
+They came, that like Pomona's arbour smiled,
+With flowerets decked, and fragrant smells; but Eve,
+Undecked save with herself, more lovely fair
+Than Wood-Nymph, or the fairest Goddess feigned
+Of three that in mount Ida naked strove,
+Stood to entertain her guest from Heaven; no veil
+She needed, virtue-proof; no thought infirm
+Altered her cheek. On whom the Angel Hail
+Bestowed, the holy salutation used
+Long after to blest Mary, second Eve.
+Hail, Mother of Mankind, whose fruitful womb
+Shall fill the world more numerous with thy sons,
+Than with these various fruits the trees of God
+Have heaped this table!--Raised of grassy turf
+Their table was, and mossy seats had round,
+And on her ample square from side to side
+All autumn piled, though spring and autumn here
+Danced hand in hand. A while discourse they hold;
+No fear lest dinner cool; when thus began
+Our author. Heavenly stranger, please to taste
+These bounties, which our Nourisher, from whom
+All perfect good, unmeasured out, descends,
+To us for food and for delight hath caused
+The earth to yield; unsavoury food perhaps
+To spiritual natures; only this I know,
+That one celestial Father gives to all.
+To whom the Angel. Therefore what he gives
+(Whose praise be ever sung) to Man in part
+Spiritual, may of purest Spirits be found
+No ingrateful food: And food alike those pure
+Intelligential substances require,
+As doth your rational; and both contain
+Within them every lower faculty
+Of sense, whereby they hear, see, smell, touch, taste,
+Tasting concoct, digest, assimilate,
+And corporeal to incorporeal turn.
+For know, whatever was created, needs
+To be sustained and fed: Of elements
+The grosser feeds the purer, earth the sea,
+Earth and the sea feed air, the air those fires
+Ethereal, and as lowest first the moon;
+Whence in her visage round those spots, unpurged
+Vapours not yet into her substance turned.
+Nor doth the moon no nourishment exhale
+From her moist continent to higher orbs.
+The sun that light imparts to all, receives
+From all his alimental recompence
+In humid exhalations, and at even
+Sups with the ocean. Though in Heaven the trees
+Of life ambrosial fruitage bear, and vines
+Yield nectar; though from off the boughs each morn
+We brush mellifluous dews, and find the ground
+Covered with pearly grain: Yet God hath here
+Varied his bounty so with new delights,
+As may compare with Heaven; and to taste
+Think not I shall be nice. So down they sat,
+And to their viands fell; nor seemingly
+The Angel, nor in mist, the common gloss
+Of Theologians; but with keen dispatch
+Of real hunger, and concoctive heat
+To transubstantiate: What redounds, transpires
+Through Spirits with ease; nor wonder;if by fire
+Of sooty coal the empirick alchemist
+Can turn, or holds it possible to turn,
+Metals of drossiest ore to perfect gold,
+As from the mine. Mean while at table Eve
+Ministered naked, and their flowing cups
+With pleasant liquours crowned: O innocence
+Deserving Paradise! if ever, then,
+Then had the sons of God excuse to have been
+Enamoured at that sight; but in those hearts
+Love unlibidinous reigned, nor jealousy
+Was understood, the injured lover's hell.
+Thus when with meats and drinks they had sufficed,
+Not burdened nature, sudden mind arose
+In Adam, not to let the occasion pass
+Given him by this great conference to know
+Of things above his world, and of their being
+Who dwell in Heaven, whose excellence he saw
+Transcend his own so far; whose radiant forms,
+Divine effulgence, whose high power, so far
+Exceeded human; and his wary speech
+Thus to the empyreal minister he framed.
+Inhabitant with God, now know I well
+Thy favour, in this honour done to Man;
+Under whose lowly roof thou hast vouchsafed
+To enter, and these earthly fruits to taste,
+Food not of Angels, yet accepted so,
+As that more willingly thou couldst not seem
+At Heaven's high feasts to have fed: yet what compare
+To whom the winged Hierarch replied.
+O Adam, One Almighty is, from whom
+All things proceed, and up to him return,
+If not depraved from good, created all
+Such to perfection, one first matter all,
+Endued with various forms, various degrees
+Of substance, and, in things that live, of life;
+But more refined, more spiritous, and pure,
+As nearer to him placed, or nearer tending
+Each in their several active spheres assigned,
+Till body up to spirit work, in bounds
+Proportioned to each kind. So from the root
+Springs lighter the green stalk, from thence the leaves
+More aery, last the bright consummate flower
+Spirits odorous breathes: flowers and their fruit,
+Man's nourishment, by gradual scale sublimed,
+To vital spirits aspire, to animal,
+To intellectual; give both life and sense,
+Fancy and understanding; whence the soul
+Reason receives, and reason is her being,
+Discursive, or intuitive; discourse
+Is oftest yours, the latter most is ours,
+Differing but in degree, of kind the same.
+Wonder not then, what God for you saw good
+If I refuse not, but convert, as you
+To proper substance. Time may come, when Men
+With Angels may participate, and find
+No inconvenient diet, nor too light fare;
+And from these corporal nutriments perhaps
+Your bodies may at last turn all to spirit,
+Improved by tract of time, and, winged, ascend
+Ethereal, as we; or may, at choice,
+Here or in heavenly Paradises dwell;
+If ye be found obedient, and retain
+Unalterably firm his love entire,
+Whose progeny you are. Mean while enjoy
+Your fill what happiness this happy state
+Can comprehend, incapable of more.
+To whom the patriarch of mankind replied.
+O favourable Spirit, propitious guest,
+Well hast thou taught the way that might direct
+Our knowledge, and the scale of nature set
+From center to circumference; whereon,
+In contemplation of created things,
+By steps we may ascend to God. But say,
+What meant that caution joined, If ye be found
+Obedient? Can we want obedience then
+To him, or possibly his love desert,
+Who formed us from the dust and placed us here
+Full to the utmost measure of what bliss
+Human desires can seek or apprehend?
+To whom the Angel. Son of Heaven and Earth,
+Attend! That thou art happy, owe to God;
+That thou continuest such, owe to thyself,
+That is, to thy obedience; therein stand.
+This was that caution given thee; be advised.
+God made thee perfect, not immutable;
+And good he made thee, but to persevere
+He left it in thy power; ordained thy will
+By nature free, not over-ruled by fate
+Inextricable, or strict necessity:
+Our voluntary service he requires,
+Not our necessitated; such with him
+Finds no acceptance, nor can find; for how
+Can hearts, not free, be tried whether they serve
+Willing or no, who will but what they must
+By destiny, and can no other choose?
+Myself, and all the angelick host, that stand
+In sight of God, enthroned, our happy state
+Hold, as you yours, while our obedience holds;
+On other surety none: Freely we serve,
+Because we freely love, as in our will
+To love or not; in this we stand or fall:
+And some are fallen, to disobedience fallen,
+And so from Heaven to deepest Hell; O fall
+From what high state of bliss, into what woe!
+To whom our great progenitor. Thy words
+Attentive, and with more delighted ear,
+Divine instructer, I have heard, than when
+Cherubick songs by night from neighbouring hills
+Aereal musick send: Nor knew I not
+To be both will and deed created free;
+Yet that we never shall forget to love
+Our Maker, and obey him whose command
+Single is yet so just, my constant thoughts
+Assured me, and still assure: Though what thou tellest
+Hath passed in Heaven, some doubt within me move,
+But more desire to hear, if thou consent,
+The full relation, which must needs be strange,
+Worthy of sacred silence to be heard;
+And we have yet large day, for scarce the sun
+Hath finished half his journey, and scarce begins
+His other half in the great zone of Heaven.
+Thus Adam made request; and Raphael,
+After short pause assenting, thus began.
+High matter thou enjoinest me, O prime of men,
+Sad task and hard: For how shall I relate
+To human sense the invisible exploits
+Of warring Spirits? how, without remorse,
+The ruin of so many glorious once
+And perfect while they stood? how last unfold
+The secrets of another world, perhaps
+Not lawful to reveal? yet for thy good
+This is dispensed; and what surmounts the reach
+Of human sense, I shall delineate so,
+By likening spiritual to corporal forms,
+As may express them best; though what if Earth
+Be but a shadow of Heaven, and things therein
+Each to other like, more than on earth is thought?
+As yet this world was not, and Chaos wild
+Reigned where these Heavens now roll, where Earth now rests
+Upon her center poised; when on a day
+(For time, though in eternity, applied
+To motion, measures all things durable
+By present, past, and future,) on such day
+As Heaven's great year brings forth, the empyreal host
+Of Angels by imperial summons called,
+Innumerable before the Almighty's throne
+Forthwith, from all the ends of Heaven, appeared
+Under their Hierarchs in orders bright:
+Ten thousand thousand ensigns high advanced,
+Standards and gonfalons 'twixt van and rear
+Stream in the air, and for distinction serve
+Of hierarchies, of orders, and degrees;
+Or in their glittering tissues bear imblazed
+Holy memorials, acts of zeal and love
+Recorded eminent. Thus when in orbs
+Of circuit inexpressible they stood,
+Orb within orb, the Father Infinite,
+By whom in bliss imbosomed sat the Son,
+Amidst as from a flaming mount, whose top
+Brightness had made invisible, thus spake.
+Hear, all ye Angels, progeny of light,
+Thrones, Dominations, Princedoms, Virtues, Powers;
+Hear my decree, which unrevoked shall stand.
+This day I have begot whom I declare
+My only Son, and on this holy hill
+Him have anointed, whom ye now behold
+At my right hand; your head I him appoint;
+And by myself have sworn, to him shall bow
+All knees in Heaven, and shall confess him Lord:
+Under his great vice-gerent reign abide
+United, as one individual soul,
+For ever happy: Him who disobeys,
+Me disobeys, breaks union, and that day,
+Cast out from God and blessed vision, falls
+Into utter darkness, deep ingulfed, his place
+Ordained without redemption, without end.
+So spake the Omnipotent, and with his words
+All seemed well pleased; all seemed, but were not all.
+That day, as other solemn days, they spent
+In song and dance about the sacred hill;
+Mystical dance, which yonder starry sphere
+Of planets, and of fixed, in all her wheels
+Resembles nearest, mazes intricate,
+Eccentrick, intervolved, yet regular
+Then most, when most irregular they seem;
+And in their motions harmony divine
+So smooths her charming tones, that God's own ear
+Listens delighted. Evening now approached,
+(For we have also our evening and our morn,
+We ours for change delectable, not need;)
+Forthwith from dance to sweet repast they turn
+Desirous; all in circles as they stood,
+Tables are set, and on a sudden piled
+With Angels food, and rubied nectar flows
+In pearl, in diamond, and massy gold,
+Fruit of delicious vines, the growth of Heaven.
+On flowers reposed, and with fresh flowerets crowned,
+They eat, they drink, and in communion sweet
+Quaff immortality and joy, secure
+Of surfeit, where full measure only bounds
+Excess, before the all-bounteous King, who showered
+With copious hand, rejoicing in their joy.
+Now when ambrosial night with clouds exhaled
+From that high mount of God, whence light and shade
+Spring both, the face of brightest Heaven had changed
+To grateful twilight, (for night comes not there
+In darker veil,) and roseat dews disposed
+All but the unsleeping eyes of God to rest;
+Wide over all the plain, and wider far
+Than all this globous earth in plain outspread,
+(Such are the courts of God) the angelick throng,
+Dispersed in bands and files, their camp extend
+By living streams among the trees of life,
+Pavilions numberless, and sudden reared,
+Celestial tabernacles, where they slept
+Fanned with cool winds; save those, who, in their course,
+Melodious hymns about the sovran throne
+Alternate all night long: but not so waked
+Satan; so call him now, his former name
+Is heard no more in Heaven; he of the first,
+If not the first Arch-Angel, great in power,
+In favour and pre-eminence, yet fraught
+With envy against the Son of God, that day
+Honoured by his great Father, and proclaimed
+Messiah King anointed, could not bear
+Through pride that sight, and thought himself impaired.
+Deep malice thence conceiving and disdain,
+Soon as midnight brought on the dusky hour
+Friendliest to sleep and silence, he resolved
+With all his legions to dislodge, and leave
+Unworshipt, unobeyed, the throne supreme,
+Contemptuous; and his next subordinate
+Awakening, thus to him in secret spake.
+Sleepest thou, Companion dear? What sleep can close
+Thy eye-lids? and rememberest what decree
+Of yesterday, so late hath passed the lips
+Of Heaven's Almighty. Thou to me thy thoughts
+Wast wont, I mine to thee was wont to impart;
+Both waking we were one; how then can now
+Thy sleep dissent? New laws thou seest imposed;
+New laws from him who reigns, new minds may raise
+In us who serve, new counsels to debate
+What doubtful may ensue: More in this place
+To utter is not safe. Assemble thou
+Of all those myriads which we lead the chief;
+Tell them, that by command, ere yet dim night
+Her shadowy cloud withdraws, I am to haste,
+And all who under me their banners wave,
+Homeward, with flying march, where we possess
+The quarters of the north; there to prepare
+Fit entertainment to receive our King,
+The great Messiah, and his new commands,
+Who speedily through all the hierarchies
+Intends to pass triumphant, and give laws.
+So spake the false Arch-Angel, and infused
+Bad influence into the unwary breast
+Of his associate: He together calls,
+Or several one by one, the regent Powers,
+Under him Regent; tells, as he was taught,
+That the Most High commanding, now ere night,
+Now ere dim night had disincumbered Heaven,
+The great hierarchal standard was to move;
+Tells the suggested cause, and casts between
+Ambiguous words and jealousies, to sound
+Or taint integrity: But all obeyed
+The wonted signal, and superiour voice
+Of their great Potentate; for great indeed
+His name, and high was his degree in Heaven;
+His countenance, as the morning-star that guides
+The starry flock, allured them, and with lies
+Drew after him the third part of Heaven's host.
+Mean while the Eternal eye, whose sight discerns
+Abstrusest thoughts, from forth his holy mount,
+And from within the golden lamps that burn
+Nightly before him, saw without their light
+Rebellion rising; saw in whom, how spread
+Among the sons of morn, what multitudes
+Were banded to oppose his high decree;
+And, smiling, to his only Son thus said.
+Son, thou in whom my glory I behold
+In full resplendence, Heir of all my might,
+Nearly it now concerns us to be sure
+Of our Omnipotence, and with what arms
+We mean to hold what anciently we claim
+Of deity or empire: Such a foe
+Is rising, who intends to erect his throne
+Equal to ours, throughout the spacious north;
+Nor so content, hath in his thought to try
+In battle, what our power is, or our right.
+Let us advise, and to this hazard draw
+With speed what force is left, and all employ
+In our defence; lest unawares we lose
+This our high place, our sanctuary, our hill.
+To whom the Son with calm aspect and clear,
+Lightning divine, ineffable, serene,
+Made answer. Mighty Father, thou thy foes
+Justly hast in derision, and, secure,
+Laughest at their vain designs and tumults vain,
+Matter to me of glory, whom their hate
+Illustrates, when they see all regal power
+Given me to quell their pride, and in event
+Know whether I be dextrous to subdue
+Thy rebels, or be found the worst in Heaven.
+So spake the Son; but Satan, with his Powers,
+Far was advanced on winged speed; an host
+Innumerable as the stars of night,
+Or stars of morning, dew-drops, which the sun
+Impearls on every leaf and every flower.
+Regions they passed, the mighty regencies
+Of Seraphim, and Potentates, and Thrones,
+In their triple degrees; regions to which
+All thy dominion, Adam, is no more
+Than what this garden is to all the earth,
+And all the sea, from one entire globose
+Stretched into longitude; which having passed,
+At length into the limits of the north
+They came; and Satan to his royal seat
+High on a hill, far blazing, as a mount
+Raised on a mount, with pyramids and towers
+From diamond quarries hewn, and rocks of gold;
+The palace of great Lucifer, (so call
+That structure in the dialect of men
+Interpreted,) which not long after, he
+Affecting all equality with God,
+In imitation of that mount whereon
+Messiah was declared in sight of Heaven,
+The Mountain of the Congregation called;
+For thither he assembled all his train,
+Pretending so commanded to consult
+About the great reception of their King,
+Thither to come, and with calumnious art
+Of counterfeited truth thus held their ears.
+Thrones, Dominations, Princedoms, Virtues, Powers;
+If these magnifick titles yet remain
+Not merely titular, since by decree
+Another now hath to himself engrossed
+All power, and us eclipsed under the name
+Of King anointed, for whom all this haste
+Of midnight-march, and hurried meeting here,
+This only to consult how we may best,
+With what may be devised of honours new,
+Receive him coming to receive from us
+Knee-tribute yet unpaid, prostration vile!
+Too much to one! but double how endured,
+To one, and to his image now proclaimed?
+But what if better counsels might erect
+Our minds, and teach us to cast off this yoke?
+Will ye submit your necks, and choose to bend
+The supple knee? Ye will not, if I trust
+To know ye right, or if ye know yourselves
+Natives and sons of Heaven possessed before
+By none; and if not equal all, yet free,
+Equally free; for orders and degrees
+Jar not with liberty, but well consist.
+Who can in reason then, or right, assume
+Monarchy over such as live by right
+His equals, if in power and splendour less,
+In freedom equal? or can introduce
+Law and edict on us, who without law
+Err not? much less for this to be our Lord,
+And look for adoration, to the abuse
+Of those imperial titles, which assert
+Our being ordained to govern, not to serve.
+Thus far his bold discourse without controul
+Had audience; when among the Seraphim
+Abdiel, than whom none with more zeal adored
+The Deity, and divine commands obeyed,
+Stood up, and in a flame of zeal severe
+The current of his fury thus opposed.
+O argument blasphemous, false, and proud!
+Words which no ear ever to hear in Heaven
+Expected, least of all from thee, Ingrate,
+In place thyself so high above thy peers.
+Canst thou with impious obloquy condemn
+The just decree of God, pronounced and sworn,
+That to his only Son, by right endued
+With regal scepter, every soul in Heaven
+Shall bend the knee, and in that honour due
+Confess him rightful King? unjust, thou sayest,
+Flatly unjust, to bind with laws the free,
+And equal over equals to let reign,
+One over all with unsucceeded power.
+Shalt thou give law to God? shalt thou dispute
+With him the points of liberty, who made
+Thee what thou art, and formed the Powers of Heaven
+Such as he pleased, and circumscribed their being?
+Yet, by experience taught, we know how good,
+And of our good and of our dignity
+How provident he is; how far from thought
+To make us less, bent rather to exalt
+Our happy state, under one head more near
+United. But to grant it thee unjust,
+That equal over equals monarch reign:
+Thyself, though great and glorious, dost thou count,
+Or all angelick nature joined in one,
+Equal to him begotten Son? by whom,
+As by his Word, the Mighty Father made
+All things, even thee; and all the Spirits of Heaven
+By him created in their bright degrees,
+Crowned them with glory, and to their glory named
+Thrones, Dominations, Princedoms, Virtues, Powers,
+Essential Powers; nor by his reign obscured,
+But more illustrious made; since he the head
+One of our number thus reduced becomes;
+His laws our laws; all honour to him done
+Returns our own. Cease then this impious rage,
+And tempt not these; but hasten to appease
+The incensed Father, and the incensed Son,
+While pardon may be found in time besought.
+So spake the fervent Angel; but his zeal
+None seconded, as out of season judged,
+Or singular and rash: Whereat rejoiced
+The Apostate, and, more haughty, thus replied.
+That we were formed then sayest thou? and the work
+Of secondary hands, by task transferred
+From Father to his Son? strange point and new!
+Doctrine which we would know whence learned: who saw
+When this creation was? rememberest thou
+Thy making, while the Maker gave thee being?
+We know no time when we were not as now;
+Know none before us, self-begot, self-raised
+By our own quickening power, when fatal course
+Had circled his full orb, the birth mature
+Of this our native Heaven, ethereal sons.
+Our puissance is our own; our own right hand
+Shall teach us highest deeds, by proof to try
+Who is our equal: Then thou shalt behold
+Whether by supplication we intend
+Address, and to begirt the almighty throne
+Beseeching or besieging. This report,
+These tidings carry to the anointed King;
+And fly, ere evil intercept thy flight.
+He said; and, as the sound of waters deep,
+Hoarse murmur echoed to his words applause
+Through the infinite host; nor less for that
+The flaming Seraph fearless, though alone
+Encompassed round with foes, thus answered bold.
+O alienate from God, O Spirit accursed,
+Forsaken of all good! I see thy fall
+Determined, and thy hapless crew involved
+In this perfidious fraud, contagion spread
+Both of thy crime and punishment: Henceforth
+No more be troubled how to quit the yoke
+Of God's Messiah; those indulgent laws
+Will not be now vouchsafed; other decrees
+Against thee are gone forth without recall;
+That golden scepter, which thou didst reject,
+Is now an iron rod to bruise and break
+Thy disobedience. Well thou didst advise;
+Yet not for thy advice or threats I fly
+These wicked tents devoted, lest the wrath
+Impendent, raging into sudden flame,
+Distinguish not: For soon expect to feel
+His thunder on thy head, devouring fire.
+Then who created thee lamenting learn,
+When who can uncreate thee thou shalt know.
+So spake the Seraph Abdiel, faithful found
+Among the faithless, faithful only he;
+Among innumerable false, unmoved,
+Unshaken, unseduced, unterrified,
+His loyalty he kept, his love, his zeal;
+Nor number, nor example, with him wrought
+To swerve from truth, or change his constant mind,
+Though single. From amidst them forth he passed,
+Long way through hostile scorn, which he sustained
+Superiour, nor of violence feared aught;
+And, with retorted scorn, his back he turned
+On those proud towers to swift destruction doomed.
+
+
+
+Book VI
+
+
+All night the dreadless Angel, unpursued,
+Through Heaven's wide champain held his way; till Morn,
+Waked by the circling Hours, with rosy hand
+Unbarred the gates of light. There is a cave
+Within the mount of God, fast by his throne,
+Where light and darkness in perpetual round
+Lodge and dislodge by turns, which makes through Heaven
+Grateful vicissitude, like day and night;
+Light issues forth, and at the other door
+Obsequious darkness enters, till her hour
+To veil the Heaven, though darkness there might well
+Seem twilight here: And now went forth the Morn
+Such as in highest Heaven arrayed in gold
+Empyreal; from before her vanished Night,
+Shot through with orient beams; when all the plain
+Covered with thick embattled squadrons bright,
+Chariots, and flaming arms, and fiery steeds,
+Reflecting blaze on blaze, first met his view:
+War he perceived, war in procinct; and found
+Already known what he for news had thought
+To have reported: Gladly then he mixed
+Among those friendly Powers, who him received
+With joy and acclamations loud, that one,
+That of so many myriads fallen, yet one
+Returned not lost. On to the sacred hill
+They led him high applauded, and present
+Before the seat supreme; from whence a voice,
+From midst a golden cloud, thus mild was heard.
+Servant of God. Well done; well hast thou fought
+The better fight, who single hast maintained
+Against revolted multitudes the cause
+Of truth, in word mightier than they in arms;
+And for the testimony of truth hast borne
+Universal reproach, far worse to bear
+Than violence; for this was all thy care
+To stand approved in sight of God, though worlds
+Judged thee perverse: The easier conquest now
+Remains thee, aided by this host of friends,
+Back on thy foes more glorious to return,
+Than scorned thou didst depart; and to subdue
+By force, who reason for their law refuse,
+Right reason for their law, and for their King
+Messiah, who by right of merit reigns.
+Go, Michael, of celestial armies prince,
+And thou, in military prowess next,
+Gabriel, lead forth to battle these my sons
+Invincible; lead forth my armed Saints,
+By thousands and by millions, ranged for fight,
+Equal in number to that Godless crew
+Rebellious: Them with fire and hostile arms
+Fearless assault; and, to the brow of Heaven
+Pursuing, drive them out from God and bliss,
+Into their place of punishment, the gulf
+Of Tartarus, which ready opens wide
+His fiery Chaos to receive their fall.
+So spake the Sovran Voice, and clouds began
+To darken all the hill, and smoke to roll
+In dusky wreaths, reluctant flames, the sign
+Of wrath awaked; nor with less dread the loud
+Ethereal trumpet from on high 'gan blow:
+At which command the Powers militant,
+That stood for Heaven, in mighty quadrate joined
+Of union irresistible, moved on
+In silence their bright legions, to the sound
+Of instrumental harmony, that breathed
+Heroick ardour to adventurous deeds
+Under their God-like leaders, in the cause
+Of God and his Messiah. On they move
+Indissolubly firm; nor obvious hill,
+Nor straitening vale, nor wood, nor stream, divides
+Their perfect ranks; for high above the ground
+Their march was, and the passive air upbore
+Their nimble tread; as when the total kind
+Of birds, in orderly array on wing,
+Came summoned over Eden to receive
+Their names of thee; so over many a tract
+Of Heaven they marched, and many a province wide,
+Tenfold the length of this terrene: At last,
+Far in the horizon to the north appeared
+From skirt to skirt a fiery region, stretched
+In battailous aspect, and nearer view
+Bristled with upright beams innumerable
+Of rigid spears, and helmets thronged, and shields
+Various, with boastful argument portrayed,
+The banded Powers of Satan hasting on
+With furious expedition; for they weened
+That self-same day, by fight or by surprise,
+To win the mount of God, and on his throne
+To set the Envier of his state, the proud
+Aspirer; but their thoughts proved fond and vain
+In the mid way: Though strange to us it seemed
+At first, that Angel should with Angel war,
+And in fierce hosting meet, who wont to meet
+So oft in festivals of joy and love
+Unanimous, as sons of one great Sire,
+Hymning the Eternal Father: But the shout
+Of battle now began, and rushing sound
+Of onset ended soon each milder thought.
+High in the midst, exalted as a God,
+The Apostate in his sun-bright chariot sat,
+Idol of majesty divine, enclosed
+With flaming Cherubim, and golden shields;
+Then lighted from his gorgeous throne, for now
+"twixt host and host but narrow space was left,
+A dreadful interval, and front to front
+Presented stood in terrible array
+Of hideous length: Before the cloudy van,
+On the rough edge of battle ere it joined,
+Satan, with vast and haughty strides advanced,
+Came towering, armed in adamant and gold;
+Abdiel that sight endured not, where he stood
+Among the mightiest, bent on highest deeds,
+And thus his own undaunted heart explores.
+O Heaven! that such resemblance of the Highest
+Should yet remain, where faith and realty
+Remain not: Wherefore should not strength and might
+There fail where virtue fails, or weakest prove
+Where boldest, though to fight unconquerable?
+His puissance, trusting in the Almighty's aid,
+I mean to try, whose reason I have tried
+Unsound and false; nor is it aught but just,
+That he, who in debate of truth hath won,
+Should win in arms, in both disputes alike
+Victor; though brutish that contest and foul,
+When reason hath to deal with force, yet so
+Most reason is that reason overcome.
+So pondering, and from his armed peers
+Forth stepping opposite, half-way he met
+His daring foe, at this prevention more
+Incensed, and thus securely him defied.
+Proud, art thou met? thy hope was to have reached
+The highth of thy aspiring unopposed,
+The throne of God unguarded, and his side
+Abandoned, at the terrour of thy power
+Or potent tongue: Fool!not to think how vain
+Against the Omnipotent to rise in arms;
+Who out of smallest things could, without end,
+Have raised incessant armies to defeat
+Thy folly; or with solitary hand
+Reaching beyond all limit, at one blow,
+Unaided, could have finished thee, and whelmed
+Thy legions under darkness: But thou seest
+All are not of thy train; there be, who faith
+Prefer, and piety to God, though then
+To thee not visible, when I alone
+Seemed in thy world erroneous to dissent
+From all: My sect thou seest;now learn too late
+How few sometimes may know, when thousands err.
+Whom the grand foe, with scornful eye askance,
+Thus answered. Ill for thee, but in wished hour
+Of my revenge, first sought for, thou returnest
+From flight, seditious Angel! to receive
+Thy merited reward, the first assay
+Of this right hand provoked, since first that tongue,
+Inspired with contradiction, durst oppose
+A third part of the Gods, in synod met
+Their deities to assert; who, while they feel
+Vigour divine within them, can allow
+Omnipotence to none. But well thou comest
+Before thy fellows, ambitious to win
+From me some plume, that thy success may show
+Destruction to the rest: This pause between,
+(Unanswered lest thou boast) to let thee know,
+At first I thought that Liberty and Heaven
+To heavenly souls had been all one; but now
+I see that most through sloth had rather serve,
+Ministring Spirits, trained up in feast and song!
+Such hast thou armed, the minstrelsy of Heaven,
+Servility with freedom to contend,
+As both their deeds compared this day shall prove.
+To whom in brief thus Abdiel stern replied.
+Apostate! still thou errest, nor end wilt find
+Of erring, from the path of truth remote:
+Unjustly thou depravest it with the name
+Of servitude, to serve whom God ordains,
+Or Nature: God and Nature bid the same,
+When he who rules is worthiest, and excels
+Them whom he governs. This is servitude,
+To serve the unwise, or him who hath rebelled
+Against his worthier, as thine now serve thee,
+Thyself not free, but to thyself enthralled;
+Yet lewdly darest our ministring upbraid.
+Reign thou in Hell, thy kingdom; let me serve
+In Heaven God ever blest, and his divine
+Behests obey, worthiest to be obeyed;
+Yet chains in Hell, not realms, expect: Mean while
+From me returned, as erst thou saidst, from flight,
+This greeting on thy impious crest receive.
+So saying, a noble stroke he lifted high,
+Which hung not, but so swift with tempest fell
+On the proud crest of Satan, that no sight,
+Nor motion of swift thought, less could his shield,
+Such ruin intercept: Ten paces huge
+He back recoiled; the tenth on bended knee
+His massy spear upstaid; as if on earth
+Winds under ground, or waters forcing way,
+Sidelong had pushed a mountain from his seat,
+Half sunk with all his pines. Amazement seised
+The rebel Thrones, but greater rage, to see
+Thus foiled their mightiest; ours joy filled, and shout,
+Presage of victory, and fierce desire
+Of battle: Whereat Michael bid sound
+The Arch-Angel trumpet; through the vast of Heaven
+It sounded, and the faithful armies rung
+Hosanna to the Highest: Nor stood at gaze
+The adverse legions, nor less hideous joined
+The horrid shock. Now storming fury rose,
+And clamour such as heard in Heaven till now
+Was never; arms on armour clashing brayed
+Horrible discord, and the madding wheels
+Of brazen chariots raged; dire was the noise
+Of conflict; over head the dismal hiss
+Of fiery darts in flaming vollies flew,
+And flying vaulted either host with fire.
+So under fiery cope together rushed
+Both battles main, with ruinous assault
+And inextinguishable rage. All Heaven
+Resounded; and had Earth been then, all Earth
+Had to her center shook. What wonder? when
+Millions of fierce encountering Angels fought
+On either side, the least of whom could wield
+These elements, and arm him with the force
+Of all their regions: How much more of power
+Army against army numberless to raise
+Dreadful combustion warring, and disturb,
+Though not destroy, their happy native seat;
+Had not the Eternal King Omnipotent,
+From his strong hold of Heaven, high over-ruled
+And limited their might; though numbered such
+As each divided legion might have seemed
+A numerous host; in strength each armed hand
+A legion; led in fight, yet leader seemed
+Each warriour single as in chief, expert
+When to advance, or stand, or turn the sway
+Of battle, open when, and when to close
+The ridges of grim war: No thought of flight,
+None of retreat, no unbecoming deed
+That argued fear; each on himself relied,
+As only in his arm the moment lay
+Of victory: Deeds of eternal fame
+Were done, but infinite; for wide was spread
+That war and various; sometimes on firm ground
+A standing fight, then, soaring on main wing,
+Tormented all the air; all air seemed then
+Conflicting fire. Long time in even scale
+The battle hung; till Satan, who that day
+Prodigious power had shown, and met in arms
+No equal, ranging through the dire attack
+Of fighting Seraphim confused, at length
+Saw where the sword of Michael smote, and felled
+Squadrons at once; with huge two-handed sway
+Brandished aloft, the horrid edge came down
+Wide-wasting; such destruction to withstand
+He hasted, and opposed the rocky orb
+Of tenfold adamant, his ample shield,
+A vast circumference. At his approach
+The great Arch-Angel from his warlike toil
+Surceased, and glad, as hoping here to end
+Intestine war in Heaven, the arch-foe subdued
+Or captive dragged in chains, with hostile frown
+And visage all inflamed first thus began.
+Author of evil, unknown till thy revolt,
+Unnamed in Heaven, now plenteous as thou seest
+These acts of hateful strife, hateful to all,
+Though heaviest by just measure on thyself,
+And thy adherents: How hast thou disturbed
+Heaven's blessed peace, and into nature brought
+Misery, uncreated till the crime
+Of thy rebellion! how hast thou instilled
+Thy malice into thousands, once upright
+And faithful, now proved false! But think not here
+To trouble holy rest; Heaven casts thee out
+From all her confines. Heaven, the seat of bliss,
+Brooks not the works of violence and war.
+Hence then, and evil go with thee along,
+Thy offspring, to the place of evil, Hell;
+Thou and thy wicked crew! there mingle broils,
+Ere this avenging sword begin thy doom,
+Or some more sudden vengeance, winged from God,
+Precipitate thee with augmented pain.
+So spake the Prince of Angels; to whom thus
+The Adversary. Nor think thou with wind
+Of aery threats to awe whom yet with deeds
+Thou canst not. Hast thou turned the least of these
+To flight, or if to fall, but that they rise
+Unvanquished, easier to transact with me
+That thou shouldst hope, imperious, and with threats
+To chase me hence? err not, that so shall end
+The strife which thou callest evil, but we style
+The strife of glory; which we mean to win,
+Or turn this Heaven itself into the Hell
+Thou fablest; here however to dwell free,
+If not to reign: Mean while thy utmost force,
+And join him named Almighty to thy aid,
+I fly not, but have sought thee far and nigh.
+They ended parle, and both addressed for fight
+Unspeakable; for who, though with the tongue
+Of Angels, can relate, or to what things
+Liken on earth conspicuous, that may lift
+Human imagination to such highth
+Of Godlike power? for likest Gods they seemed,
+Stood they or moved, in stature, motion, arms,
+Fit to decide the empire of great Heaven.
+Now waved their fiery swords, and in the air
+Made horrid circles; two broad suns their shields
+Blazed opposite, while Expectation stood
+In horrour: From each hand with speed retired,
+Where erst was thickest fight, the angelick throng,
+And left large field, unsafe within the wind
+Of such commotion; such as, to set forth
+Great things by small, if, nature's concord broke,
+Among the constellations war were sprung,
+Two planets, rushing from aspect malign
+Of fiercest opposition, in mid sky
+Should combat, and their jarring spheres confound.
+Together both with next to almighty arm
+Up-lifted imminent, one stroke they aimed
+That might determine, and not need repeat,
+As not of power at once; nor odds appeared
+In might or swift prevention: But the sword
+Of Michael from the armoury of God
+Was given him tempered so, that neither keen
+Nor solid might resist that edge: it met
+The sword of Satan, with steep force to smite
+Descending, and in half cut sheer; nor staid,
+But with swift wheel reverse, deep entering, shared
+All his right side: Then Satan first knew pain,
+And writhed him to and fro convolved; so sore
+The griding sword with discontinuous wound
+Passed through him: But the ethereal substance closed,
+Not long divisible; and from the gash
+A stream of necturous humour issuing flowed
+Sanguine, such as celestial Spirits may bleed,
+And all his armour stained, ere while so bright.
+Forthwith on all sides to his aid was run
+By Angels many and strong, who interposed
+Defence, while others bore him on their shields
+Back to his chariot, where it stood retired
+From off the files of war: There they him laid
+Gnashing for anguish, and despite, and shame,
+To find himself not matchless, and his pride
+Humbled by such rebuke, so far beneath
+His confidence to equal God in power.
+Yet soon he healed; for Spirits that live throughout
+Vital in every part, not as frail man
+In entrails, heart of head, liver or reins,
+Cannot but by annihilating die;
+Nor in their liquid texture mortal wound
+Receive, no more than can the fluid air:
+All heart they live, all head, all eye, all ear,
+All intellect, all sense; and, as they please,
+They limb themselves, and colour, shape, or size
+Assume, as?kikes them best, condense or rare.
+Mean while in other parts like deeds deserved
+Memorial, where the might of Gabriel fought,
+And with fierce ensigns pierced the deep array
+Of Moloch, furious king; who him defied,
+And at his chariot-wheels to drag him bound
+Threatened, nor from the Holy One of Heaven
+Refrained his tongue blasphemous; but anon
+Down cloven to the waist, with shattered arms
+And uncouth pain fled bellowing. On each wing
+Uriel, and Raphael, his vaunting foe,
+Though huge, and in a rock of diamond armed,
+Vanquished Adramelech, and Asmadai,
+Two potent Thrones, that to be less than Gods
+Disdained, but meaner thoughts learned in their flight,
+Mangled with ghastly wounds through plate and mail.
+Nor stood unmindful Abdiel to annoy
+The atheist crew, but with redoubled blow
+Ariel, and Arioch, and the violence
+Of Ramiel scorched and blasted, overthrew.
+I might relate of thousands, and their names
+Eternize here on earth; but those elect
+Angels, contented with their fame in Heaven,
+Seek not the praise of men: The other sort,
+In might though wonderous and in acts of war,
+Nor of renown less eager, yet by doom
+Cancelled from Heaven and sacred memory,
+Nameless in dark oblivion let them dwell.
+For strength from truth divided, and from just,
+Illaudable, nought merits but dispraise
+And ignominy; yet to glory aspires
+Vain-glorious, and through infamy seeks fame:
+Therefore eternal silence be their doom.
+And now, their mightiest quelled, the battle swerved,
+With many an inroad gored; deformed rout
+Entered, and foul disorder; all the ground
+With shivered armour strown, and on a heap
+Chariot and charioteer lay overturned,
+And fiery-foaming steeds; what stood, recoiled
+O'er-wearied, through the faint Satanick host
+Defensive scarce, or with pale fear surprised,
+Then first with fear surprised, and sense of pain,
+Fled ignominious, to such evil brought
+By sin of disobedience; till that hour
+Not liable to fear, or flight, or pain.
+Far otherwise the inviolable Saints,
+In cubick phalanx firm, advanced entire,
+Invulnerable, impenetrably armed;
+Such high advantages their innocence
+Gave them above their foes; not to have sinned,
+Not to have disobeyed; in fight they stood
+Unwearied, unobnoxious to be pained
+By wound, though from their place by violence moved,
+Now Night her course began, and, over Heaven
+Inducing darkness, grateful truce imposed,
+And silence on the odious din of war:
+Under her cloudy covert both retired,
+Victor and vanquished: On the foughten field
+Michael and his Angels prevalent
+Encamping, placed in guard their watches round,
+Cherubick waving fires: On the other part,
+Satan with his rebellious disappeared,
+Far in the dark dislodged; and, void of rest,
+His potentates to council called by night;
+And in the midst thus undismayed began.
+O now in danger tried, now known in arms
+Not to be overpowered, Companions dear,
+Found worthy not of liberty alone,
+Too mean pretence! but what we more affect,
+Honour, dominion, glory, and renown;
+Who have sustained one day in doubtful fight,
+(And if one day, why not eternal days?)
+What Heaven's Lord had powerfullest to send
+Against us from about his throne, and judged
+Sufficient to subdue us to his will,
+But proves not so: Then fallible, it seems,
+Of future we may deem him, though till now
+Omniscient thought. True is, less firmly armed,
+Some disadvantage we endured and pain,
+Till now not known, but, known, as soon contemned;
+Since now we find this our empyreal form
+Incapable of mortal injury,
+Imperishable, and, though pierced with wound,
+Soon closing, and by native vigour healed.
+Of evil then so small as easy think
+The remedy; perhaps more valid arms,
+Weapons more violent, when next we meet,
+May serve to better us, and worse our foes,
+Or equal what between us made the odds,
+In nature none: If other hidden cause
+Left them superiour, while we can preserve
+Unhurt our minds, and understanding sound,
+Due search and consultation will disclose.
+He sat; and in the assembly next upstood
+Nisroch, of Principalities the prime;
+As one he stood escaped from cruel fight,
+Sore toiled, his riven arms to havock hewn,
+And cloudy in aspect thus answering spake.
+Deliverer from new Lords, leader to free
+Enjoyment of our right as Gods; yet hard
+For Gods, and too unequal work we find,
+Against unequal arms to fight in pain,
+Against unpained, impassive; from which evil
+Ruin must needs ensue; for what avails
+Valour or strength, though matchless, quelled with pain
+Which all subdues, and makes remiss the hands
+Of mightiest? Sense of pleasure we may well
+Spare out of life perhaps, and not repine,
+But live content, which is the calmest life:
+But pain is perfect misery, the worst
+Of evils, and, excessive, overturns
+All patience. He, who therefore can invent
+With what more forcible we may offend
+Our yet unwounded enemies, or arm
+Ourselves with like defence, to me deserves
+No less than for deliverance what we owe.
+Whereto with look composed Satan replied.
+Not uninvented that, which thou aright
+Believest so main to our success, I bring.
+Which of us who beholds the bright surface
+Of this ethereous mould whereon we stand,
+This continent of spacious Heaven, adorned
+With plant, fruit, flower ambrosial, gems, and gold;
+Whose eye so superficially surveys
+These things, as not to mind from whence they grow
+Deep under ground, materials dark and crude,
+Of spiritous and fiery spume, till touched
+With Heaven's ray, and tempered, they shoot forth
+So beauteous, opening to the ambient light?
+These in their dark nativity the deep
+Shall yield us, pregnant with infernal flame;
+Which, into hollow engines, long and round,
+Thick rammed, at the other bore with touch of fire
+Dilated and infuriate, shall send forth
+From far, with thundering noise, among our foes
+Such implements of mischief, as shall dash
+To pieces, and o'erwhelm whatever stands
+Adverse, that they shall fear we have disarmed
+The Thunderer of his only dreaded bolt.
+Nor long shall be our labour; yet ere dawn,
+Effect shall end our wish. Mean while revive;
+Abandon fear; to strength and counsel joined
+Think nothing hard, much less to be despaired.
+He ended, and his words their drooping cheer
+Enlightened, and their languished hope revived.
+The invention all admired, and each, how he
+To be the inventer missed; so easy it seemed
+Once found, which yet unfound most would have thought
+Impossible: Yet, haply, of thy race
+In future days, if malice should abound,
+Some one intent on mischief, or inspired
+With devilish machination, might devise
+Like instrument to plague the sons of men
+For sin, on war and mutual slaughter bent.
+Forthwith from council to the work they flew;
+None arguing stood; innumerable hands
+Were ready; in a moment up they turned
+Wide the celestial soil, and saw beneath
+The originals of nature in their crude
+Conception; sulphurous and nitrous foam
+They found, they mingled, and, with subtle art,
+Concocted and adusted they reduced
+To blackest grain, and into store conveyed:
+Part hidden veins digged up (nor hath this earth
+Entrails unlike) of mineral and stone,
+Whereof to found their engines and their balls
+Of missive ruin; part incentive reed
+Provide, pernicious with one touch to fire.
+So all ere day-spring, under conscious night,
+Secret they finished, and in order set,
+With silent circumspection, unespied.
+Now when fair morn orient in Heaven appeared,
+Up rose the victor-Angels, and to arms
+The matin trumpet sung: In arms they stood
+Of golden panoply, refulgent host,
+Soon banded; others from the dawning hills
+Look round, and scouts each coast light-armed scour,
+Each quarter to descry the distant foe,
+Where lodged, or whither fled, or if for fight,
+In motion or in halt: Him soon they met
+Under spread ensigns moving nigh, in slow
+But firm battalion; back with speediest sail
+Zophiel, of Cherubim the swiftest wing,
+Came flying, and in mid air aloud thus cried.
+Arm, Warriours, arm for fight; the foe at hand,
+Whom fled we thought, will save us long pursuit
+This day; fear not his flight;so thick a cloud
+He comes, and settled in his face I see
+Sad resolution, and secure: Let each
+His adamantine coat gird well, and each
+Fit well his helm, gripe fast his orbed shield,
+Borne even or high; for this day will pour down,
+If I conjecture aught, no drizzling shower,
+But rattling storm of arrows barbed with fire.
+So warned he them, aware themselves, and soon
+In order, quit of all impediment;
+Instant without disturb they took alarm,
+And onward moved embattled: When behold!
+Not distant far with heavy pace the foe
+Approaching gross and huge, in hollow cube
+Training his devilish enginery, impaled
+On every side with shadowing squadrons deep,
+To hide the fraud. At interview both stood
+A while; but suddenly at head appeared
+Satan, and thus was heard commanding loud.
+Vanguard, to right and left the front unfold;
+That all may see who hate us, how we seek
+Peace and composure, and with open breast
+Stand ready to receive them, if they like
+Our overture; and turn not back perverse:
+But that I doubt; however witness, Heaven!
+Heaven, witness thou anon! while we discharge
+Freely our part: ye, who appointed stand
+Do as you have in charge, and briefly touch
+What we propound, and loud that all may hear!
+So scoffing in ambiguous words, he scarce
+Had ended; when to right and left the front
+Divided, and to either flank retired:
+Which to our eyes discovered, new and strange,
+A triple mounted row of pillars laid
+On wheels (for like to pillars most they seemed,
+Or hollowed bodies made of oak or fir,
+With branches lopt, in wood or mountain felled,)
+Brass, iron, stony mould, had not their mouths
+With hideous orifice gaped on us wide,
+Portending hollow truce: At each behind
+A Seraph stood, and in his hand a reed
+Stood waving tipt with fire; while we, suspense,
+Collected stood within our thoughts amused,
+Not long; for sudden all at once their reeds
+Put forth, and to a narrow vent applied
+With nicest touch. Immediate in a flame,
+But soon obscured with smoke, all Heaven appeared,
+From those deep-throated engines belched, whose roar
+Embowelled with outrageous noise the air,
+And all her entrails tore, disgorging foul
+Their devilish glut, chained thunderbolts and hail
+Of iron globes; which, on the victor host
+Levelled, with such impetuous fury smote,
+That, whom they hit, none on their feet might stand,
+Though standing else as rocks, but down they fell
+By thousands, Angel on Arch-Angel rolled;
+The sooner for their arms; unarmed, they might
+Have easily, as Spirits, evaded swift
+By quick contraction or remove; but now
+Foul dissipation followed, and forced rout;
+Nor served it to relax their serried files.
+What should they do? if on they rushed, repulse
+Repeated, and indecent overthrow
+Doubled, would render them yet more despised,
+And to their foes a laughter; for in view
+Stood ranked of Seraphim another row,
+In posture to displode their second tire
+Of thunder: Back defeated to return
+They worse abhorred. Satan beheld their plight,
+And to his mates thus in derision called.
+O Friends! why come not on these victors proud
+Ere while they fierce were coming; and when we,
+To entertain them fair with open front
+And breast, (what could we more?) propounded terms
+Of composition, straight they changed their minds,
+Flew off, and into strange vagaries fell,
+As they would dance; yet for a dance they seemed
+Somewhat extravagant and wild; perhaps
+For joy of offered peace: But I suppose,
+If our proposals once again were heard,
+We should compel them to a quick result.
+To whom thus Belial, in like gamesome mood.
+Leader! the terms we sent were terms of weight,
+Of hard contents, and full of force urged home;
+Such as we might perceive amused them all,
+And stumbled many: Who receives them right,
+Had need from head to foot well understand;
+Not understood, this gift they have besides,
+They show us when our foes walk not upright.
+So they among themselves in pleasant vein
+Stood scoffing, hightened in their thoughts beyond
+All doubt of victory: Eternal Might
+To match with their inventions they presumed
+So easy, and of his thunder made a scorn,
+And all his host derided, while they stood
+A while in trouble: But they stood not long;
+Rage prompted them at length, and found them arms
+Against such hellish mischief fit to oppose.
+Forthwith (behold the excellence, the power,
+Which God hath in his mighty Angels placed!)
+Their arms away they threw, and to the hills
+(For Earth hath this variety from Heaven
+Of pleasure situate in hill and dale,)
+Light as the lightning glimpse they ran, they flew;
+From their foundations loosening to and fro,
+They plucked the seated hills, with all their load,
+Rocks, waters, woods, and by the shaggy tops
+Up-lifting bore them in their hands: Amaze,
+Be sure, and terrour, seized the rebel host,
+When coming towards them so dread they saw
+The bottom of the mountains upward turned;
+Till on those cursed engines' triple-row
+They saw them whelmed, and all their confidence
+Under the weight of mountains buried deep;
+Themselves invaded next, and on their heads
+Main promontories flung, which in the air
+Came shadowing, and oppressed whole legions armed;
+Their armour helped their harm, crushed in and bruised
+Into their substance pent, which wrought them pain
+Implacable, and many a dolorous groan;
+Long struggling underneath, ere they could wind
+Out of such prison, though Spirits of purest light,
+Purest at first, now gross by sinning grown.
+The rest, in imitation, to like arms
+Betook them, and the neighbouring hills uptore:
+So hills amid the air encountered hills,
+Hurled to and fro with jaculation dire;
+That under ground they fought in dismal shade;
+Infernal noise! war seemed a civil game
+To this uproar; horrid confusion heaped
+Upon confusion rose: And now all Heaven
+Had gone to wrack, with ruin overspread;
+Had not the Almighty Father, where he sits
+Shrined in his sanctuary of Heaven secure,
+Consulting on the sum of things, foreseen
+This tumult, and permitted all, advised:
+That his great purpose he might so fulfil,
+To honour his anointed Son avenged
+Upon his enemies, and to declare
+All power on him transferred: Whence to his Son,
+The Assessour of his throne, he thus began.
+Effulgence of my glory, Son beloved,
+Son, in whose face invisible is beheld
+Visibly, what by Deity I am;
+And in whose hand what by decree I do,
+Second Omnipotence! two days are past,
+Two days, as we compute the days of Heaven,
+Since Michael and his Powers went forth to tame
+These disobedient: Sore hath been their fight,
+As likeliest was, when two such foes met armed;
+For to themselves I left them; and thou knowest,
+Equal in their creation they were formed,
+Save what sin hath impaired; which yet hath wrought
+Insensibly, for I suspend their doom;
+Whence in perpetual fight they needs must last
+Endless, and no solution will be found:
+War wearied hath performed what war can do,
+And to disordered rage let loose the reins
+With mountains, as with weapons, armed; which makes
+Wild work in Heaven, and dangerous to the main.
+Two days are therefore past, the third is thine;
+For thee I have ordained it; and thus far
+Have suffered, that the glory may be thine
+Of ending this great war, since none but Thou
+Can end it. Into thee such virtue and grace
+Immense I have transfused, that all may know
+In Heaven and Hell thy power above compare;
+And, this perverse commotion governed thus,
+To manifest thee worthiest to be Heir
+Of all things; to be Heir, and to be King
+By sacred unction, thy deserved right.
+Go then, Thou Mightiest, in thy Father's might;
+Ascend my chariot, guide the rapid wheels
+That shake Heaven's basis, bring forth all my war,
+My bow and thunder, my almighty arms
+Gird on, and sword upon thy puissant thigh;
+Pursue these sons of darkness, drive them out
+From all Heaven's bounds into the utter deep:
+There let them learn, as likes them, to despise
+God, and Messiah his anointed King.
+He said, and on his Son with rays direct
+Shone full; he all his Father full expressed
+Ineffably into his face received;
+And thus the Filial Godhead answering spake.
+O Father, O Supreme of heavenly Thrones,
+First, Highest, Holiest, Best; thou always seek'st
+To glorify thy Son, I always thee,
+As is most just: This I my glory account,
+My exaltation, and my whole delight,
+That thou, in me well pleased, declarest thy will
+Fulfilled, which to fulfil is all my bliss.
+Scepter and power, thy giving, I assume,
+And gladlier shall resign, when in the end
+Thou shalt be all in all, and I in thee
+For ever; and in me all whom thou lovest:
+But whom thou hatest, I hate, and can put on
+Thy terrours, as I put thy mildness on,
+Image of thee in all things; and shall soon,
+Armed with thy might, rid Heaven of these rebelled;
+To their prepared ill mansion driven down,
+To chains of darkness, and the undying worm;
+That from thy just obedience could revolt,
+Whom to obey is happiness entire.
+Then shall thy Saints unmixed, and from the impure
+Far separate, circling thy holy mount,
+Unfeigned Halleluiahs to thee sing,
+Hymns of high praise, and I among them Chief.
+So said, he, o'er his scepter bowing, rose
+From the right hand of Glory where he sat;
+And the third sacred morn began to shine,
+Dawning through Heaven. Forth rushed with whirlwind sound
+The chariot of Paternal Deity,
+Flashing thick flames, wheel within wheel undrawn,
+Itself instinct with Spirit, but convoyed
+By four Cherubick shapes; four faces each
+Had wonderous; as with stars, their bodies all
+And wings were set with eyes; with eyes the wheels
+Of beryl, and careering fires between;
+Over their heads a crystal firmament,
+Whereon a sapphire throne, inlaid with pure
+Amber, and colours of the showery arch.
+He, in celestial panoply all armed
+Of radiant Urim, work divinely wrought,
+Ascended; at his right hand Victory
+Sat eagle-winged; beside him hung his bow
+And quiver with three-bolted thunder stored;
+And from about him fierce effusion rolled
+Of smoke, and bickering flame, and sparkles dire:
+Attended with ten thousand thousand Saints,
+He onward came; far off his coming shone;
+And twenty thousand (I their number heard)
+Chariots of God, half on each hand, were seen;
+He on the wings of Cherub rode sublime
+On the crystalline sky, in sapphire throned,
+Illustrious far and wide; but by his own
+First seen: Them unexpected joy surprised,
+When the great ensign of Messiah blazed
+Aloft by Angels borne, his sign in Heaven;
+Under whose conduct Michael soon reduced
+His army, circumfused on either wing,
+Under their Head imbodied all in one.
+Before him Power Divine his way prepared;
+At his command the uprooted hills retired
+Each to his place; they heard his voice, and went
+Obsequious; Heaven his wonted face renewed,
+And with fresh flowerets hill and valley smiled.
+This saw his hapless foes, but stood obdured,
+And to rebellious fight rallied their Powers,
+Insensate, hope conceiving from despair.
+In heavenly Spirits could such perverseness dwell?
+But to convince the proud what signs avail,
+Or wonders move the obdurate to relent?
+They, hardened more by what might most reclaim,
+Grieving to see his glory, at the sight
+Took envy; and, aspiring to his highth,
+Stood re-embattled fierce, by force or fraud
+Weening to prosper, and at length prevail
+Against God and Messiah, or to fall
+In universal ruin last; and now
+To final battle drew, disdaining flight,
+Or faint retreat; when the great Son of God
+To all his host on either hand thus spake.
+Stand still in bright array, ye Saints; here stand,
+Ye Angels armed; this day from battle rest:
+Faithful hath been your warfare, and of God
+Accepted, fearless in his righteous cause;
+And as ye have received, so have ye done,
+Invincibly: But of this cursed crew
+The punishment to other hand belongs;
+Vengeance is his, or whose he sole appoints:
+Number to this day's work is not ordained,
+Nor multitude; stand only, and behold
+God's indignation on these godless poured
+By me; not you, but me, they have despised,
+Yet envied; against me is all their rage,
+Because the Father, to whom in Heaven s'preme
+Kingdom, and power, and glory appertains,
+Hath honoured me, according to his will.
+Therefore to me their doom he hath assigned;
+That they may have their wish, to try with me
+In battle which the stronger proves; they all,
+Or I alone against them; since by strength
+They measure all, of other excellence
+Not emulous, nor care who them excels;
+Nor other strife with them do I vouchsafe.
+So spake the Son, and into terrour changed
+His countenance too severe to be beheld,
+And full of wrath bent on his enemies.
+At once the Four spread out their starry wings
+With dreadful shade contiguous, and the orbs
+Of his fierce chariot rolled, as with the sound
+Of torrent floods, or of a numerous host.
+He on his impious foes right onward drove,
+Gloomy as night; under his burning wheels
+The stedfast empyrean shook throughout,
+All but the throne itself of God. Full soon
+Among them he arrived; in his right hand
+Grasping ten thousand thunders, which he sent
+Before him, such as in their souls infixed
+Plagues: They, astonished, all resistance lost,
+All courage; down their idle weapons dropt:
+O'er shields, and helms, and helmed heads he rode
+Of Thrones and mighty Seraphim prostrate,
+That wished the mountains now might be again
+Thrown on them, as a shelter from his ire.
+Nor less on either side tempestuous fell
+His arrows, from the fourfold-visaged Four
+Distinct with eyes, and from the living wheels
+Distinct alike with multitude of eyes;
+One Spirit in them ruled; and every eye
+Glared lightning, and shot forth pernicious fire
+Among the accursed, that withered all their strength,
+And of their wonted vigour left them drained,
+Exhausted, spiritless, afflicted, fallen.
+Yet half his strength he put not forth, but checked
+His thunder in mid volley; for he meant
+Not to destroy, but root them out of Heaven:
+The overthrown he raised, and as a herd
+Of goats or timorous flock together thronged
+Drove them before him thunder-struck, pursued
+With terrours, and with furies, to the bounds
+And crystal wall of Heaven; which, opening wide,
+Rolled inward, and a spacious gap disclosed
+Into the wasteful deep: The monstrous sight
+Struck them with horrour backward, but far worse
+Urged them behind: Headlong themselves they threw
+Down from the verge of Heaven; eternal wrath
+Burnt after them to the bottomless pit.
+Hell heard the unsufferable noise, Hell saw
+Heaven ruining from Heaven, and would have fled
+Affrighted; but strict Fate had cast too deep
+Her dark foundations, and too fast had bound.
+Nine days they fell: Confounded Chaos roared,
+And felt tenfold confusion in their fall
+Through his wild anarchy, so huge a rout
+Incumbered him with ruin: Hell at last
+Yawning received them whole, and on them closed;
+Hell, their fit habitation, fraught with fire
+Unquenchable, the house of woe and pain.
+Disburdened Heaven rejoiced, and soon repaired
+Her mural breach, returning whence it rolled.
+Sole victor, from the expulsion of his foes,
+Messiah his triumphal chariot turned:
+To meet him all his Saints, who silent stood
+Eye-witnesses of his almighty acts,
+With jubilee advanced; and, as they went,
+Shaded with branching palm, each Order bright,
+Sung triumph, and him sung victorious King,
+Son, Heir, and Lord, to him dominion given,
+Worthiest to reign: He, celebrated, rode
+Triumphant through mid Heaven, into the courts
+And temple of his Mighty Father throned
+On high; who into glory him received,
+Where now he sits at the right hand of bliss.
+Thus, measuring things in Heaven by things on Earth,
+At thy request, and that thou mayest beware
+By what is past, to thee I have revealed
+What might have else to human race been hid;
+The discord which befel, and war in Heaven
+Among the angelick Powers, and the deep fall
+Of those too high aspiring, who rebelled
+With Satan; he who envies now thy state,
+Who now is plotting how he may seduce
+Thee also from obedience, that, with him
+Bereaved of happiness, thou mayest partake
+His punishment, eternal misery;
+Which would be all his solace and revenge,
+As a despite done against the Most High,
+Thee once to gain companion of his woe.
+But listen not to his temptations, warn
+Thy weaker; let it profit thee to have heard,
+By terrible example, the reward
+Of disobedience; firm they might have stood,
+Yet fell; remember, and fear to transgress.
+
+
+
+Book VII
+
+
+Descend from Heaven, Urania, by that name
+If rightly thou art called, whose voice divine
+Following, above the Olympian hill I soar,
+Above the flight of Pegasean wing!
+The meaning, not the name, I call: for thou
+Nor of the Muses nine, nor on the top
+Of old Olympus dwellest; but, heavenly-born,
+Before the hills appeared, or fountain flowed,
+Thou with eternal Wisdom didst converse,
+Wisdom thy sister, and with her didst play
+In presence of the Almighty Father, pleased
+With thy celestial song. Up led by thee
+Into the Heaven of Heavens I have presumed,
+An earthly guest, and drawn empyreal air,
+Thy tempering: with like safety guided down
+Return me to my native element:
+Lest from this flying steed unreined, (as once
+Bellerophon, though from a lower clime,)
+Dismounted, on the Aleian field I fall,
+Erroneous there to wander, and forlorn.
+Half yet remains unsung, but narrower bound
+Within the visible diurnal sphere;
+Standing on earth, not rapt above the pole,
+More safe I sing with mortal voice, unchanged
+To hoarse or mute, though fallen on evil days,
+On evil days though fallen, and evil tongues;
+In darkness, and with dangers compassed round,
+And solitude; yet not alone, while thou
+Visitest my slumbers nightly, or when morn
+Purples the east: still govern thou my song,
+Urania, and fit audience find, though few.
+But drive far off the barbarous dissonance
+Of Bacchus and his revellers, the race
+Of that wild rout that tore the Thracian bard
+In Rhodope, where woods and rocks had ears
+To rapture, till the savage clamour drowned
+Both harp and voice; nor could the Muse defend
+Her son. So fail not thou, who thee implores:
+For thou art heavenly, she an empty dream.
+Say, Goddess, what ensued when Raphael,
+The affable Arch-Angel, had forewarned
+Adam, by dire example, to beware
+Apostasy, by what befel in Heaven
+To those apostates; lest the like befall
+In Paradise to Adam or his race,
+Charged not to touch the interdicted tree,
+If they transgress, and slight that sole command,
+So easily obeyed amid the choice
+Of all tastes else to please their appetite,
+Though wandering. He, with his consorted Eve,
+The story heard attentive, and was filled
+With admiration and deep muse, to hear
+Of things so high and strange; things, to their thought
+So unimaginable, as hate in Heaven,
+And war so near the peace of God in bliss,
+With such confusion: but the evil, soon
+Driven back, redounded as a flood on those
+From whom it sprung; impossible to mix
+With blessedness. Whence Adam soon repealed
+The doubts that in his heart arose: and now
+Led on, yet sinless, with desire to know
+What nearer might concern him, how this world
+Of Heaven and Earth conspicuous first began;
+When, and whereof created; for what cause;
+What within Eden, or without, was done
+Before his memory; as one whose drouth
+Yet scarce allayed still eyes the current stream,
+Whose liquid murmur heard new thirst excites,
+Proceeded thus to ask his heavenly guest.
+Great things, and full of wonder in our ears,
+Far differing from this world, thou hast revealed,
+Divine interpreter! by favour sent
+Down from the empyrean, to forewarn
+Us timely of what might else have been our loss,
+Unknown, which human knowledge could not reach;
+For which to the infinitely Good we owe
+Immortal thanks, and his admonishment
+Receive, with solemn purpose to observe
+Immutably his sovran will, the end
+Of what we are. But since thou hast vouchsafed
+Gently, for our instruction, to impart
+Things above earthly thought, which yet concerned
+Our knowing, as to highest wisdom seemed,
+Deign to descend now lower, and relate
+What may no less perhaps avail us known,
+How first began this Heaven which we behold
+Distant so high, with moving fires adorned
+Innumerable; and this which yields or fills
+All space, the ambient air wide interfused
+Embracing round this floried Earth; what cause
+Moved the Creator, in his holy rest
+Through all eternity, so late to build
+In Chaos; and the work begun, how soon
+Absolved; if unforbid thou mayest unfold
+What we, not to explore the secrets ask
+Of his eternal empire, but the more
+To magnify his works, the more we know.
+And the great light of day yet wants to run
+Much of his race though steep; suspense in Heaven,
+Held by thy voice, thy potent voice, he hears,
+And longer will delay to hear thee tell
+His generation, and the rising birth
+Of Nature from the unapparent Deep:
+Or if the star of evening and the moon
+Haste to thy audience, Night with her will bring,
+Silence; and Sleep, listening to thee, will watch;
+Or we can bid his absence, till thy song
+End, and dismiss thee ere the morning shine.
+Thus Adam his illustrious guest besought:
+And thus the Godlike Angel answered mild.
+This also thy request, with caution asked,
+Obtain; though to recount almighty works
+What words or tongue of Seraph can suffice,
+Or heart of man suffice to comprehend?
+Yet what thou canst attain, which best may serve
+To glorify the Maker, and infer
+Thee also happier, shall not be withheld
+Thy hearing; such commission from above
+I have received, to answer thy desire
+Of knowledge within bounds; beyond, abstain
+To ask; nor let thine own inventions hope
+Things not revealed, which the invisible King,
+Only Omniscient, hath suppressed in night;
+To none communicable in Earth or Heaven:
+Enough is left besides to search and know.
+But knowledge is as food, and needs no less
+Her temperance over appetite, to know
+In measure what the mind may well contain;
+Oppresses else with surfeit, and soon turns
+Wisdom to folly, as nourishment to wind.
+Know then, that, after Lucifer from Heaven
+(So call him, brighter once amidst the host
+Of Angels, than that star the stars among,)
+Fell with his flaming legions through the deep
+Into his place, and the great Son returned
+Victorious with his Saints, the Omnipotent
+Eternal Father from his throne beheld
+Their multitude, and to his Son thus spake.
+At least our envious Foe hath failed, who thought
+All like himself rebellious, by whose aid
+This inaccessible high strength, the seat
+Of Deity supreme, us dispossessed,
+He trusted to have seised, and into fraud
+Drew many, whom their place knows here no more:
+Yet far the greater part have kept, I see,
+Their station; Heaven, yet populous, retains
+Number sufficient to possess her realms
+Though wide, and this high temple to frequent
+With ministeries due, and solemn rites:
+But, lest his heart exalt him in the harm
+Already done, to have dispeopled Heaven,
+My damage fondly deemed, I can repair
+That detriment, if such it be to lose
+Self-lost; and in a moment will create
+Another world, out of one man a race
+Of men innumerable, there to dwell,
+Not here; till, by degrees of merit raised,
+They open to themselves at length the way
+Up hither, under long obedience tried;
+And Earth be changed to Heaven, and Heaven to Earth,
+One kingdom, joy and union without end.
+Mean while inhabit lax, ye Powers of Heaven;
+And thou my Word, begotten Son, by thee
+This I perform; speak thou, and be it done!
+My overshadowing Spirit and Might with thee
+I send along; ride forth, and bid the Deep
+Within appointed bounds be Heaven and Earth;
+Boundless the Deep, because I Am who fill
+Infinitude, nor vacuous the space.
+Though I, uncircumscribed myself, retire,
+And put not forth my goodness, which is free
+To act or not, Necessity and Chance
+Approach not me, and what I will is Fate.
+So spake the Almighty, and to what he spake
+His Word, the Filial Godhead, gave effect.
+Immediate are the acts of God, more swift
+Than time or motion, but to human ears
+Cannot without process of speech be told,
+So told as earthly notion can receive.
+Great triumph and rejoicing was in Heaven,
+When such was heard declared the Almighty's will;
+Glory they sung to the Most High, good will
+To future men, and in their dwellings peace;
+Glory to Him, whose just avenging ire
+Had driven out the ungodly from his sight
+And the habitations of the just; to Him
+Glory and praise, whose wisdom had ordained
+Good out of evil to create; instead
+Of Spirits malign, a better race to bring
+Into their vacant room, and thence diffuse
+His good to worlds and ages infinite.
+So sang the Hierarchies: Mean while the Son
+On his great expedition now appeared,
+Girt with Omnipotence, with radiance crowned
+Of Majesty Divine; sapience and love
+Immense, and all his Father in him shone.
+About his chariot numberless were poured
+Cherub, and Seraph, Potentates, and Thrones,
+And Virtues, winged Spirits, and chariots winged
+From the armoury of God; where stand of old
+Myriads, between two brazen mountains lodged
+Against a solemn day, harnessed at hand,
+Celestial equipage; and now came forth
+Spontaneous, for within them Spirit lived,
+Attendant on their Lord: Heaven opened wide
+Her ever-during gates, harmonious sound
+On golden hinges moving, to let forth
+The King of Glory, in his powerful Word
+And Spirit, coming to create new worlds.
+On heavenly ground they stood; and from the shore
+They viewed the vast immeasurable abyss
+Outrageous as a sea, dark, wasteful, wild,
+Up from the bottom turned by furious winds
+And surging waves, as mountains, to assault
+Heaven's highth, and with the center mix the pole.
+Silence, ye troubled Waves, and thou Deep, peace,
+Said then the Omnifick Word; your discord end!
+Nor staid; but, on the wings of Cherubim
+Uplifted, in paternal glory rode
+Far into Chaos, and the world unborn;
+For Chaos heard his voice: Him all his train
+Followed in bright procession, to behold
+Creation, and the wonders of his might.
+Then staid the fervid wheels, and in his hand
+He took the golden compasses, prepared
+In God's eternal store, to circumscribe
+This universe, and all created things:
+One foot he centered, and the other turned
+Round through the vast profundity obscure;
+And said, Thus far extend, thus far thy bounds,
+This be thy just circumference, O World!
+Thus God the Heaven created, thus the Earth,
+Matter unformed and void: Darkness profound
+Covered the abyss: but on the watery calm
+His brooding wings the Spirit of God outspread,
+And vital virtue infused, and vital warmth
+Throughout the fluid mass; but downward purged
+The black tartareous cold infernal dregs,
+Adverse to life: then founded, then conglobed
+Like things to like; the rest to several place
+Disparted, and between spun out the air;
+And Earth self-balanced on her center hung.
+Let there be light, said God; and forthwith Light
+Ethereal, first of things, quintessence pure,
+Sprung from the deep; and from her native east
+To journey through the aery gloom began,
+Sphered in a radiant cloud, for yet the sun
+Was not; she in a cloudy tabernacle
+Sojourned the while. God saw the light was good;
+And light from darkness by the hemisphere
+Divided: light the Day, and darkness Night,
+He named. Thus was the first day even and morn:
+Nor past uncelebrated, nor unsung
+By the celestial quires, when orient light
+Exhaling first from darkness they beheld;
+Birth-day of Heaven and Earth; with joy and shout
+The hollow universal orb they filled,
+And touched their golden harps, and hymning praised
+God and his works; Creator him they sung,
+Both when first evening was, and when first morn.
+Again, God said, Let there be firmament
+Amid the waters, and let it divide
+The waters from the waters; and God made
+The firmament, expanse of liquid, pure,
+Transparent, elemental air, diffused
+In circuit to the uttermost convex
+Of this great round; partition firm and sure,
+The waters underneath from those above
+Dividing: for as earth, so he the world
+Built on circumfluous waters calm, in wide
+Crystalline ocean, and the loud misrule
+Of Chaos far removed; lest fierce extremes
+Contiguous might distemper the whole frame:
+And Heaven he named the Firmament: So even
+And morning chorus sung the second day.
+The Earth was formed, but in the womb as yet
+Of waters, embryon immature involved,
+Appeared not: over all the face of Earth
+Main ocean flowed, not idle; but, with warm
+Prolifick humour softening all her globe,
+Fermented the great mother to conceive,
+Satiate with genial moisture; when God said,
+Be gathered now ye waters under Heaven
+Into one place, and let dry land appear.
+Immediately the mountains huge appear
+Emergent, and their broad bare backs upheave
+Into the clouds; their tops ascend the sky:
+So high as heaved the tumid hills, so low
+Down sunk a hollow bottom broad and deep,
+Capacious bed of waters: Thither they
+Hasted with glad precipitance, uprolled,
+As drops on dust conglobing from the dry:
+Part rise in crystal wall, or ridge direct,
+For haste; such flight the great command impressed
+On the swift floods: As armies at the call
+Of trumpet (for of armies thou hast heard)
+Troop to their standard; so the watery throng,
+Wave rolling after wave, where way they found,
+If steep, with torrent rapture, if through plain,
+Soft-ebbing; nor withstood them rock or hill;
+But they, or under ground, or circuit wide
+With serpent errour wandering, found their way,
+And on the washy oose deep channels wore;
+Easy, ere God had bid the ground be dry,
+All but within those banks, where rivers now
+Stream, and perpetual draw their humid train.
+The dry land, Earth; and the great receptacle
+Of congregated waters, he called Seas:
+And saw that it was good; and said, Let the Earth
+Put forth the verdant grass, herb yielding seed,
+And fruit-tree yielding fruit after her kind,
+Whose seed is in herself upon the Earth.
+He scarce had said, when the bare Earth, till then
+Desart and bare, unsightly, unadorned,
+Brought forth the tender grass, whose verdure clad
+Her universal face with pleasant green;
+Then herbs of every leaf, that sudden flowered
+Opening their various colours, and made gay
+Her bosom, smelling sweet: and, these scarce blown,
+Forth flourished thick the clustering vine, forth crept
+The swelling gourd, up stood the corny reed
+Embattled in her field, and the humble shrub,
+And bush with frizzled hair implicit: Last
+Rose, as in dance, the stately trees, and spread
+Their branches hung with copious fruit, or gemmed
+Their blossoms: With high woods the hills were crowned;
+With tufts the valleys, and each fountain side;
+With borders long the rivers: that Earth now
+Seemed like to Heaven, a seat where Gods might dwell,
+Or wander with delight, and love to haunt
+Her sacred shades: though God had yet not rained
+Upon the Earth, and man to till the ground
+None was; but from the Earth a dewy mist
+Went up, and watered all the ground, and each
+Plant of the field; which, ere it was in the Earth,
+God made, and every herb, before it grew
+On the green stem: God saw that it was good:
+So even and morn recorded the third day.
+Again the Almighty spake, Let there be lights
+High in the expanse of Heaven, to divide
+The day from night; and let them be for signs,
+For seasons, and for days, and circling years;
+And let them be for lights, as I ordain
+Their office in the firmament of Heaven,
+To give light on the Earth; and it was so.
+And God made two great lights, great for their use
+To Man, the greater to have rule by day,
+The less by night, altern; and made the stars,
+And set them in the firmament of Heaven
+To illuminate the Earth, and rule the day
+In their vicissitude, and rule the night,
+And light from darkness to divide. God saw,
+Surveying his great work, that it was good:
+For of celestial bodies first the sun
+A mighty sphere he framed, unlightsome first,
+Though of ethereal mould: then formed the moon
+Globose, and every magnitude of stars,
+And sowed with stars the Heaven, thick as a field:
+Of light by far the greater part he took,
+Transplanted from her cloudy shrine, and placed
+In the sun's orb, made porous to receive
+And drink the liquid light; firm to retain
+Her gathered beams, great palace now of light.
+Hither, as to their fountain, other stars
+Repairing, in their golden urns draw light,
+And hence the morning-planet gilds her horns;
+By tincture or reflection they augment
+Their small peculiar, though from human sight
+So far remote, with diminution seen,
+First in his east the glorious lamp was seen,
+Regent of day, and all the horizon round
+Invested with bright rays, jocund to run
+His longitude through Heaven's high road; the gray
+Dawn, and the Pleiades, before him danced,
+Shedding sweet influence: Less bright the moon,
+But opposite in levelled west was set,
+His mirrour, with full face borrowing her light
+From him; for other light she needed none
+In that aspect, and still that distance keeps
+Till night; then in the east her turn she shines,
+Revolved on Heaven's great axle, and her reign
+With thousand lesser lights dividual holds,
+With thousand thousand stars, that then appeared
+Spangling the hemisphere: Then first adorned
+With their bright luminaries that set and rose,
+Glad evening and glad morn crowned the fourth day.
+And God said, Let the waters generate
+Reptile with spawn abundant, living soul:
+And let fowl fly above the Earth, with wings
+Displayed on the open firmament of Heaven.
+And God created the great whales, and each
+Soul living, each that crept, which plenteously
+The waters generated by their kinds;
+And every bird of wing after his kind;
+And saw that it was good, and blessed them, saying.
+Be fruitful, multiply, and in the seas,
+And lakes, and running streams, the waters fill;
+And let the fowl be multiplied, on the Earth.
+Forthwith the sounds and seas, each creek and bay,
+With fry innumerable swarm, and shoals
+Of fish that with their fins, and shining scales,
+Glide under the green wave, in sculls that oft
+Bank the mid sea: part single, or with mate,
+Graze the sea-weed their pasture, and through groves
+Of coral stray; or, sporting with quick glance,
+Show to the sun their waved coats dropt with gold;
+Or, in their pearly shells at ease, attend
+Moist nutriment; or under rocks their food
+In jointed armour watch: on smooth the seal
+And bended dolphins play: part huge of bulk
+Wallowing unwieldy, enormous in their gait,
+Tempest the ocean: there leviathan,
+Hugest of living creatures, on the deep
+Stretched like a promontory sleeps or swims,
+And seems a moving land; and at his gills
+Draws in, and at his trunk spouts out, a sea.
+Mean while the tepid caves, and fens, and shores,
+Their brood as numerous hatch, from the egg that soon
+Bursting with kindly rupture forth disclosed
+Their callow young; but feathered soon and fledge
+They summed their pens; and, soaring the air sublime,
+With clang despised the ground, under a cloud
+In prospect; there the eagle and the stork
+On cliffs and cedar tops their eyries build:
+Part loosely wing the region, part more wise
+In common, ranged in figure, wedge their way,
+Intelligent of seasons, and set forth
+Their aery caravan, high over seas
+Flying, and over lands, with mutual wing
+Easing their flight; so steers the prudent crane
+Her annual voyage, borne on winds; the air
+Floats as they pass, fanned with unnumbered plumes:
+From branch to branch the smaller birds with song
+Solaced the woods, and spread their painted wings
+Till even; nor then the solemn nightingale
+Ceased warbling, but all night tun'd her soft lays:
+Others, on silver lakes and rivers, bathed
+Their downy breast; the swan with arched neck,
+Between her white wings mantling proudly, rows
+Her state with oary feet; yet oft they quit
+The dank, and, rising on stiff pennons, tower
+The mid aereal sky: Others on ground
+Walked firm; the crested cock whose clarion sounds
+The silent hours, and the other whose gay train
+Adorns him, coloured with the florid hue
+Of rainbows and starry eyes. The waters thus
+With fish replenished, and the air with fowl,
+Evening and morn solemnized the fifth day.
+The sixth, and of creation last, arose
+With evening harps and matin; when God said,
+Let the Earth bring forth soul living in her kind,
+Cattle, and creeping things, and beast of the Earth,
+Each in their kind. The Earth obeyed, and straight
+Opening her fertile womb teemed at a birth
+Innumerous living creatures, perfect forms,
+Limbed and full grown: Out of the ground up rose,
+As from his lair, the wild beast where he wons
+In forest wild, in thicket, brake, or den;
+Among the trees in pairs they rose, they walked:
+The cattle in the fields and meadows green:
+Those rare and solitary, these in flocks
+Pasturing at once, and in broad herds upsprung.
+The grassy clods now calved; now half appeared
+The tawny lion, pawing to get free
+His hinder parts, then springs as broke from bonds,
+And rampant shakes his brinded mane; the ounce,
+The libbard, and the tiger, as the mole
+Rising, the crumbled earth above them threw
+In hillocks: The swift stag from under ground
+Bore up his branching head: Scarce from his mould
+Behemoth biggest born of earth upheaved
+His vastness: Fleeced the flocks and bleating rose,
+As plants: Ambiguous between sea and land
+The river-horse, and scaly crocodile.
+At once came forth whatever creeps the ground,
+Insect or worm: those waved their limber fans
+For wings, and smallest lineaments exact
+In all the liveries decked of summer's pride
+With spots of gold and purple, azure and green:
+These, as a line, their long dimension drew,
+Streaking the ground with sinuous trace; not all
+Minims of nature; some of serpent-kind,
+Wonderous in length and corpulence, involved
+Their snaky folds, and added wings. First crept
+The parsimonious emmet, provident
+Of future; in small room large heart enclosed;
+Pattern of just equality perhaps
+Hereafter, joined in her popular tribes
+Of commonalty: Swarming next appeared
+The female bee, that feeds her husband drone
+Deliciously, and builds her waxen cells
+With honey stored: The rest are numberless,
+And thou their natures knowest, and gavest them names,
+Needless to thee repeated; nor unknown
+The serpent, subtlest beast of all the field,
+Of huge extent sometimes, with brazen eyes
+And hairy mane terrifick, though to thee
+Not noxious, but obedient at thy call.
+Now Heaven in all her glory shone, and rolled
+Her motions, as the great first Mover's hand
+First wheeled their course: Earth in her rich attire
+Consummate lovely smiled; air, water, earth,
+By fowl, fish, beast, was flown, was swum, was walked,
+Frequent; and of the sixth day yet remained:
+There wanted yet the master-work, the end
+Of all yet done; a creature, who, not prone
+And brute as other creatures, but endued
+With sanctity of reason, might erect
+His stature, and upright with front serene
+Govern the rest, self-knowing; and from thence
+Magnanimous to correspond with Heaven,
+But grateful to acknowledge whence his good
+Descends, thither with heart, and voice, and eyes
+Directed in devotion, to adore
+And worship God Supreme, who made him chief
+Of all his works: therefore the Omnipotent
+Eternal Father (for where is not he
+Present?) thus to his Son audibly spake.
+Let us make now Man in our image, Man
+In our similitude, and let them rule
+Over the fish and fowl of sea and air,
+Beast of the field, and over all the Earth,
+And every creeping thing that creeps the ground.
+This said, he formed thee, Adam, thee, O Man,
+Dust of the ground, and in thy nostrils breathed
+The breath of life; in his own image he
+Created thee, in the image of God
+Express; and thou becamest a living soul.
+Male he created thee; but thy consort
+Female, for race; then blessed mankind, and said,
+Be fruitful, multiply, and fill the Earth;
+Subdue it, and throughout dominion hold
+Over fish of the sea, and fowl of the air,
+And every living thing that moves on the Earth.
+Wherever thus created, for no place
+Is yet distinct by name, thence, as thou knowest,
+He brought thee into this delicious grove,
+This garden, planted with the trees of God,
+Delectable both to behold and taste;
+And freely all their pleasant fruit for food
+Gave thee; all sorts are here that all the Earth yields,
+Variety without end; but of the tree,
+Which, tasted, works knowledge of good and evil,
+Thou mayest not; in the day thou eatest, thou diest;
+Death is the penalty imposed; beware,
+And govern well thy appetite; lest Sin
+Surprise thee, and her black attendant Death.
+Here finished he, and all that he had made
+Viewed, and behold all was entirely good;
+So even and morn accomplished the sixth day:
+Yet not till the Creator from his work
+Desisting, though unwearied, up returned,
+Up to the Heaven of Heavens, his high abode;
+Thence to behold this new created world,
+The addition of his empire, how it showed
+In prospect from his throne, how good, how fair,
+Answering his great idea. Up he rode
+Followed with acclamation, and the sound
+Symphonious of ten thousand harps, that tuned
+Angelick harmonies: The earth, the air
+Resounded, (thou rememberest, for thou heardst,)
+The heavens and all the constellations rung,
+The planets in their station listening stood,
+While the bright pomp ascended jubilant.
+Open, ye everlasting gates! they sung,
+Open, ye Heavens! your living doors;let in
+The great Creator from his work returned
+Magnificent, his six days work, a World;
+Open, and henceforth oft; for God will deign
+To visit oft the dwellings of just men,
+Delighted; and with frequent intercourse
+Thither will send his winged messengers
+On errands of supernal grace. So sung
+The glorious train ascending: He through Heaven,
+That opened wide her blazing portals, led
+To God's eternal house direct the way;
+A broad and ample road, whose dust is gold
+And pavement stars, as stars to thee appear,
+Seen in the galaxy, that milky way,
+Which nightly, as a circling zone, thou seest
+Powdered with stars. And now on Earth the seventh
+Evening arose in Eden, for the sun
+Was set, and twilight from the east came on,
+Forerunning night; when at the holy mount
+Of Heaven's high-seated top, the imperial throne
+Of Godhead, fixed for ever firm and sure,
+The Filial Power arrived, and sat him down
+With his great Father; for he also went
+Invisible, yet staid, (such privilege
+Hath Omnipresence) and the work ordained,
+Author and End of all things; and, from work
+Now resting, blessed and hallowed the seventh day,
+As resting on that day from all his work,
+But not in silence holy kept: the harp
+Had work and rested not; the solemn pipe,
+And dulcimer, all organs of sweet stop,
+All sounds on fret by string or golden wire,
+Tempered soft tunings, intermixed with voice
+Choral or unison: of incense clouds,
+Fuming from golden censers, hid the mount.
+Creation and the six days acts they sung:
+Great are thy works, Jehovah! infinite
+Thy power! what thought can measure thee, or tongue
+Relate thee! Greater now in thy return
+Than from the giant Angels: Thee that day
+Thy thunders magnified; but to create
+Is greater than created to destroy.
+Who can impair thee, Mighty King, or bound
+Thy empire! Easily the proud attempt
+Of Spirits apostate, and their counsels vain,
+Thou hast repelled; while impiously they thought
+Thee to diminish, and from thee withdraw
+The number of thy worshippers. Who seeks
+To lessen thee, against his purpose serves
+To manifest the more thy might: his evil
+Thou usest, and from thence createst more good.
+Witness this new-made world, another Heaven
+From Heaven-gate not far, founded in view
+On the clear hyaline, the glassy sea;
+Of amplitude almost immense, with stars
+Numerous, and every star perhaps a world
+Of destined habitation; but thou knowest
+Their seasons: among these the seat of Men,
+Earth, with her nether ocean circumfused,
+Their pleasant dwelling-place. Thrice happy Men,
+And sons of Men, whom God hath thus advanced!
+Created in his image, there to dwell
+And worship him; and in reward to rule
+Over his works, on earth, in sea, or air,
+And multiply a race of worshippers
+Holy and just: Thrice happy, if they know
+Their happiness, and persevere upright!
+So sung they, and the empyrean rung
+With halleluiahs: Thus was sabbath kept.
+And thy request think now fulfilled, that asked
+How first this world and face of things began,
+And what before thy memory was done
+From the beginning; that posterity,
+Informed by thee, might know: If else thou seekest
+Aught, not surpassing human measure, say.
+
+
+
+Book VIII
+
+
+The Angel ended, and in Adam's ear
+So charming left his voice, that he a while
+Thought him still speaking, still stood fixed to hear;
+Then, as new waked, thus gratefully replied.
+What thanks sufficient, or what recompence
+Equal, have I to render thee, divine
+Historian, who thus largely hast allayed
+The thirst I had of knowledge, and vouchsafed
+This friendly condescension to relate
+Things, else by me unsearchable; now heard
+With wonder, but delight, and, as is due,
+With glory attributed to the high
+Creator! Something yet of doubt remains,
+Which only thy solution can resolve.
+When I behold this goodly frame, this world,
+Of Heaven and Earth consisting; and compute
+Their magnitudes; this Earth, a spot, a grain,
+An atom, with the firmament compared
+And all her numbered stars, that seem to roll
+Spaces incomprehensible, (for such
+Their distance argues, and their swift return
+Diurnal,) merely to officiate light
+Round this opacous Earth, this punctual spot,
+One day and night; in all her vast survey
+Useless besides; reasoning I oft admire,
+How Nature wise and frugal could commit
+Such disproportions, with superfluous hand
+So many nobler bodies to create,
+Greater so manifold, to this one use,
+For aught appears, and on their orbs impose
+Such restless revolution day by day
+Repeated; while the sedentary Earth,
+That better might with far less compass move,
+Served by more noble than herself, attains
+Her end without least motion, and receives,
+As tribute, such a sumless journey brought
+Of incorporeal speed, her warmth and light;
+Speed, to describe whose swiftness number fails.
+So spake our sire, and by his countenance seemed
+Entering on studious thoughts abstruse; which Eve
+Perceiving, where she sat retired in sight,
+With lowliness majestick from her seat,
+And grace that won who saw to wish her stay,
+Rose, and went forth among her fruits and flowers,
+To visit how they prospered, bud and bloom,
+Her nursery; they at her coming sprung,
+And, touched by her fair tendance, gladlier grew.
+Yet went she not, as not with such discourse
+Delighted, or not capable her ear
+Of what was high: such pleasure she reserved,
+Adam relating, she sole auditress;
+Her husband the relater she preferred
+Before the Angel, and of him to ask
+Chose rather; he, she knew, would intermix
+Grateful digressions, and solve high dispute
+With conjugal caresses: from his lip
+Not words alone pleased her. O! when meet now
+Such pairs, in love and mutual honour joined?
+With Goddess-like demeanour forth she went,
+Not unattended; for on her, as Queen,
+A pomp of winning Graces waited still,
+And from about her shot darts of desire
+Into all eyes, to wish her still in sight.
+And Raphael now, to Adam's doubt proposed,
+Benevolent and facile thus replied.
+To ask or search, I blame thee not; for Heaven
+Is as the book of God before thee set,
+Wherein to read his wonderous works, and learn
+His seasons, hours, or days, or months, or years:
+This to attain, whether Heaven move or Earth,
+Imports not, if thou reckon right; the rest
+From Man or Angel the great Architect
+Did wisely to conceal, and not divulge
+His secrets to be scanned by them who ought
+Rather admire; or, if they list to try
+Conjecture, he his fabrick of the Heavens
+Hath left to their disputes, perhaps to move
+His laughter at their quaint opinions wide
+Hereafter; when they come to model Heaven
+And calculate the stars, how they will wield
+The mighty frame; how build, unbuild, contrive
+To save appearances; how gird the sphere
+With centrick and eccentrick scribbled o'er,
+Cycle and epicycle, orb in orb:
+Already by thy reasoning this I guess,
+Who art to lead thy offspring, and supposest
+That bodies bright and greater should not serve
+The less not bright, nor Heaven such journeys run,
+Earth sitting still, when she alone receives
+The benefit: Consider first, that great
+Or bright infers not excellence: the Earth
+Though, in comparison of Heaven, so small,
+Nor glistering, may of solid good contain
+More plenty than the sun that barren shines;
+Whose virtue on itself works no effect,
+But in the fruitful Earth; there first received,
+His beams, unactive else, their vigour find.
+Yet not to Earth are those bright luminaries
+Officious; but to thee, Earth's habitant.
+And for the Heaven's wide circuit, let it speak
+The Maker's high magnificence, who built
+So spacious, and his line stretched out so far;
+That Man may know he dwells not in his own;
+An edifice too large for him to fill,
+Lodged in a small partition; and the rest
+Ordained for uses to his Lord best known.
+The swiftness of those circles attribute,
+Though numberless, to his Omnipotence,
+That to corporeal substances could add
+Speed almost spiritual: Me thou thinkest not slow,
+Who since the morning-hour set out from Heaven
+Where God resides, and ere mid-day arrived
+In Eden; distance inexpressible
+By numbers that have name. But this I urge,
+Admitting motion in the Heavens, to show
+Invalid that which thee to doubt it moved;
+Not that I so affirm, though so it seem
+To thee who hast thy dwelling here on Earth.
+God, to remove his ways from human sense,
+Placed Heaven from Earth so far, that earthly sight,
+If it presume, might err in things too high,
+And no advantage gain. What if the sun
+Be center to the world; and other stars,
+By his attractive virtue and their own
+Incited, dance about him various rounds?
+Their wandering course now high, now low, then hid,
+Progressive, retrograde, or standing still,
+In six thou seest; and what if seventh to these
+The planet earth, so stedfast though she seem,
+Insensibly three different motions move?
+Which else to several spheres thou must ascribe,
+Moved contrary with thwart obliquities;
+Or save the sun his labour, and that swift
+Nocturnal and diurnal rhomb supposed,
+Invisible else above all stars, the wheel
+Of day and night; which needs not thy belief,
+If earth, industrious of herself, fetch day
+Travelling east, and with her part averse
+From the sun's beam meet night, her other part
+Still luminous by his ray. What if that light,
+Sent from her through the wide transpicuous air,
+To the terrestrial moon be as a star,
+Enlightening her by day, as she by night
+This earth? reciprocal, if land be there,
+Fields and inhabitants: Her spots thou seest
+As clouds, and clouds may rain, and rain produce
+Fruits in her softened soil for some to eat
+Allotted there; and other suns perhaps,
+With their attendant moons, thou wilt descry,
+Communicating male and female light;
+Which two great sexes animate the world,
+Stored in each orb perhaps with some that live.
+For such vast room in Nature unpossessed
+By living soul, desart and desolate,
+Only to shine, yet scarce to contribute
+Each orb a glimpse of light, conveyed so far
+Down to this habitable, which returns
+Light back to them, is obvious to dispute.
+But whether thus these things, or whether not;
+But whether the sun, predominant in Heaven,
+Rise on the earth; or earth rise on the sun;
+He from the east his flaming road begin;
+Or she from west her silent course advance,
+With inoffensive pace that spinning sleeps
+On her soft axle, while she paces even,
+And bears thee soft with the smooth hair along;
+Sollicit not thy thoughts with matters hid;
+Leave them to God above; him serve, and fear!
+Of other creatures, as him pleases best,
+Wherever placed, let him dispose; joy thou
+In what he gives to thee, this Paradise
+And thy fair Eve; Heaven is for thee too high
+To know what passes there; be lowly wise:
+Think only what concerns thee, and thy being;
+Dream not of other worlds, what creatures there
+Live, in what state, condition, or degree;
+Contented that thus far hath been revealed
+Not of Earth only, but of highest Heaven.
+To whom thus Adam, cleared of doubt, replied.
+How fully hast thou satisfied me, pure
+Intelligence of Heaven, Angel serene!
+And, freed from intricacies, taught to live
+The easiest way; nor with perplexing thoughts
+To interrupt the sweet of life, from which
+God hath bid dwell far off all anxious cares,
+And not molest us; unless we ourselves
+Seek them with wandering thoughts, and notions vain.
+But apt the mind or fancy is to rove
+Unchecked, and of her roving is no end;
+Till warned, or by experience taught, she learn,
+That, not to know at large of things remote
+From use, obscure and subtle; but, to know
+That which before us lies in daily life,
+Is the prime wisdom: What is more, is fume,
+Or emptiness, or fond impertinence:
+And renders us, in things that most concern,
+Unpractised, unprepared, and still to seek.
+Therefore from this high pitch let us descend
+A lower flight, and speak of things at hand
+Useful; whence, haply, mention may arise
+Of something not unseasonable to ask,
+By sufferance, and thy wonted favour, deigned.
+Thee I have heard relating what was done
+Ere my remembrance: now, hear me relate
+My story, which perhaps thou hast not heard;
+And day is not yet spent; till then thou seest
+How subtly to detain thee I devise;
+Inviting thee to hear while I relate;
+Fond! were it not in hope of thy reply:
+For, while I sit with thee, I seem in Heaven;
+And sweeter thy discourse is to my ear
+Than fruits of palm-tree pleasantest to thirst
+And hunger both, from labour, at the hour
+Of sweet repast; they satiate, and soon fill,
+Though pleasant; but thy words, with grace divine
+Imbued, bring to their sweetness no satiety.
+To whom thus Raphael answered heavenly meek.
+Nor are thy lips ungraceful, Sire of men,
+Nor tongue ineloquent; for God on thee
+Abundantly his gifts hath also poured
+Inward and outward both, his image fair:
+Speaking, or mute, all comeliness and grace
+Attends thee; and each word, each motion, forms;
+Nor less think we in Heaven of thee on Earth
+Than of our fellow-servant, and inquire
+Gladly into the ways of God with Man:
+For God, we see, hath honoured thee, and set
+On Man his equal love: Say therefore on;
+For I that day was absent, as befel,
+Bound on a voyage uncouth and obscure,
+Far on excursion toward the gates of Hell;
+Squared in full legion (such command we had)
+To see that none thence issued forth a spy,
+Or enemy, while God was in his work;
+Lest he, incensed at such eruption bold,
+Destruction with creation might have mixed.
+Not that they durst without his leave attempt;
+But us he sends upon his high behests
+For state, as Sovran King; and to inure
+Our prompt obedience. Fast we found, fast shut,
+The dismal gates, and barricadoed strong;
+But long ere our approaching heard within
+Noise, other than the sound of dance or song,
+Torment, and loud lament, and furious rage.
+Glad we returned up to the coasts of light
+Ere sabbath-evening: so we had in charge.
+But thy relation now; for I attend,
+Pleased with thy words no less than thou with mine.
+So spake the Godlike Power, and thus our Sire.
+For Man to tell how human life began
+Is hard; for who himself beginning knew
+Desire with thee still longer to converse
+Induced me. As new waked from soundest sleep,
+Soft on the flowery herb I found me laid,
+In balmy sweat; which with his beams the sun
+Soon dried, and on the reeking moisture fed.
+Straight toward Heaven my wondering eyes I turned,
+And gazed a while the ample sky; till, raised
+By quick instinctive motion, up I sprung,
+As thitherward endeavouring, and upright
+Stood on my feet: about me round I saw
+Hill, dale, and shady woods, and sunny plains,
+And liquid lapse of murmuring streams; by these,
+Creatures that lived and moved, and walked, or flew;
+Birds on the branches warbling; all things smiled;
+With fragrance and with joy my heart o'erflowed.
+Myself I then perused, and limb by limb
+Surveyed, and sometimes went, and sometimes ran
+With supple joints, as lively vigour led:
+But who I was, or where, or from what cause,
+Knew not; to speak I tried, and forthwith spake;
+My tongue obeyed, and readily could name
+Whate'er I saw. Thou Sun, said I, fair light,
+And thou enlightened Earth, so fresh and gay,
+Ye Hills, and Dales, ye Rivers, Woods, and Plains,
+And ye that live and move, fair Creatures, tell,
+Tell, if ye saw, how I came thus, how here?--
+Not of myself;--by some great Maker then,
+In goodness and in power pre-eminent:
+Tell me, how may I know him, how adore,
+From whom I have that thus I move and live,
+And feel that I am happier than I know.--
+While thus I called, and strayed I knew not whither,
+From where I first drew air, and first beheld
+This happy light; when, answer none returned,
+On a green shady bank, profuse of flowers,
+Pensive I sat me down: There gentle sleep
+First found me, and with soft oppression seised
+My droused sense, untroubled, though I thought
+I then was passing to my former state
+Insensible, and forthwith to dissolve:
+When suddenly stood at my head a dream,
+Whose inward apparition gently moved
+My fancy to believe I yet had being,
+And lived: One came, methought, of shape divine,
+And said, 'Thy mansion wants thee, Adam; rise,
+'First Man, of men innumerable ordained
+'First Father! called by thee, I come thy guide
+'To the garden of bliss, thy seat prepared.'
+So saying, by the hand he took me raised,
+And over fields and waters, as in air
+Smooth-sliding without step, last led me up
+A woody mountain; whose high top was plain,
+A circuit wide, enclosed, with goodliest trees
+Planted, with walks, and bowers; that what I saw
+Of Earth before scarce pleasant seemed. Each tree,
+Loaden with fairest fruit that hung to the eye
+Tempting, stirred in me sudden appetite
+To pluck and eat; whereat I waked, and found
+Before mine eyes all real, as the dream
+Had lively shadowed: Here had new begun
+My wandering, had not he, who was my guide
+Up hither, from among the trees appeared,
+Presence Divine. Rejoicing, but with awe,
+In adoration at his feet I fell
+Submiss: He reared me, and 'Whom thou soughtest I am,'
+Said mildly, 'Author of all this thou seest
+'Above, or round about thee, or beneath.
+'This Paradise I give thee, count it thine
+'To till and keep, and of the fruit to eat:
+'Of every tree that in the garden grows
+'Eat freely with glad heart; fear here no dearth:
+'But of the tree whose operation brings
+'Knowledge of good and ill, which I have set
+'The pledge of thy obedience and thy faith,
+'Amid the garden by the tree of life,
+'Remember what I warn thee, shun to taste,
+'And shun the bitter consequence: for know,
+'The day thou eatest thereof, my sole command
+'Transgressed, inevitably thou shalt die,
+'From that day mortal; and this happy state
+'Shalt lose, expelled from hence into a world
+'Of woe and sorrow.' Sternly he pronounced
+The rigid interdiction, which resounds
+Yet dreadful in mine ear, though in my choice
+Not to incur; but soon his clear aspect
+Returned, and gracious purpose thus renewed.
+'Not only these fair bounds, but all the Earth
+'To thee and to thy race I give; as lords
+'Possess it, and all things that therein live,
+'Or live in sea, or air; beast, fish, and fowl.
+'In sign whereof, each bird and beast behold
+'After their kinds; I bring them to receive
+'From thee their names, and pay thee fealty
+'With low subjection; understand the same
+'Of fish within their watery residence,
+'Not hither summoned, since they cannot change
+'Their element, to draw the thinner air.'
+As thus he spake, each bird and beast behold
+Approaching two and two; these cowering low
+With blandishment; each bird stooped on his wing.
+I named them, as they passed, and understood
+Their nature, with such knowledge God endued
+My sudden apprehension: But in these
+I found not what methought I wanted still;
+And to the heavenly Vision thus presumed.
+O, by what name, for thou above all these,
+Above mankind, or aught than mankind higher,
+Surpassest far my naming; how may I
+Adore thee, Author of this universe,
+And all this good to man? for whose well being
+So amply, and with hands so liberal,
+Thou hast provided all things: But with me
+I see not who partakes. In solitude
+What happiness, who can enjoy alone,
+Or, all enjoying, what contentment find?
+Thus I presumptuous; and the Vision bright,
+As with a smile more brightened, thus replied.
+What callest thou solitude? Is not the Earth
+With various living creatures, and the air
+Replenished, and all these at thy command
+To come and play before thee? Knowest thou not
+Their language and their ways? They also know,
+And reason not contemptibly: With these
+Find pastime, and bear rule; thy realm is large.
+So spake the Universal Lord, and seemed
+So ordering: I, with leave of speech implored,
+And humble deprecation, thus replied.
+Let not my words offend thee, Heavenly Power;
+My Maker, be propitious while I speak.
+Hast thou not made me here thy substitute,
+And these inferiour far beneath me set?
+Among unequals what society
+Can sort, what harmony, or true delight?
+Which must be mutual, in proportion due
+Given and received; but, in disparity
+The one intense, the other still remiss,
+Cannot well suit with either, but soon prove
+Tedious alike: Of fellowship I speak
+Such as I seek, fit to participate
+All rational delight: wherein the brute
+Cannot be human consort: They rejoice
+Each with their kind, lion with lioness;
+So fitly them in pairs thou hast combined:
+Much less can bird with beast, or fish with fowl
+So well converse, nor with the ox the ape;
+Worse then can man with beast, and least of all.
+Whereto the Almighty answered, not displeased.
+A nice and subtle happiness, I see,
+Thou to thyself proposest, in the choice
+Of thy associates, Adam! and wilt taste
+No pleasure, though in pleasure, solitary.
+What thinkest thou then of me, and this my state?
+Seem I to thee sufficiently possessed
+Of happiness, or not? who am alone
+From all eternity; for none I know
+Second to me or like, equal much less.
+How have I then with whom to hold converse,
+Save with the creatures which I made, and those
+To me inferiour, infinite descents
+Beneath what other creatures are to thee?
+He ceased; I lowly answered. To attain
+The highth and depth of thy eternal ways
+All human thoughts come short, Supreme of things!
+Thou in thyself art perfect, and in thee
+Is no deficience found: Not so is Man,
+But in degree; the cause of his desire
+By conversation with his like to help
+Or solace his defects. No need that thou
+Shouldst propagate, already Infinite;
+And through all numbers absolute, though One:
+But Man by number is to manifest
+His single imperfection, and beget
+Like of his like, his image multiplied,
+In unity defective; which requires
+Collateral love, and dearest amity.
+Thou in thy secresy although alone,
+Best with thyself accompanied, seekest not
+Social communication; yet, so pleased,
+Canst raise thy creature to what highth thou wilt
+Of union or communion, deified:
+I, by conversing, cannot these erect
+From prone; nor in their ways complacence find.
+Thus I emboldened spake, and freedom used
+Permissive, and acceptance found; which gained
+This answer from the gracious Voice Divine.
+Thus far to try thee, Adam, I was pleased;
+And find thee knowing, not of beasts alone,
+Which thou hast rightly named, but of thyself;
+Expressing well the spirit within thee free,
+My image, not imparted to the brute;
+Whose fellowship therefore unmeet for thee
+Good reason was thou freely shouldst dislike;
+And be so minded still: I, ere thou spakest,
+Knew it not good for Man to be alone;
+And no such company as then thou sawest
+Intended thee; for trial only brought,
+To see how thou couldest judge of fit and meet:
+What next I bring shall please thee, be assured,
+Thy likeness, thy fit help, thy other self,
+Thy wish exactly to thy heart's desire.
+He ended, or I heard no more; for now
+My earthly by his heavenly overpowered,
+Which it had long stood under, strained to the highth
+In that celestial colloquy sublime,
+As with an object that excels the sense
+Dazzled and spent, sunk down; and sought repair
+Of sleep, which instantly fell on me, called
+By Nature as in aid, and closed mine eyes.
+Mine eyes he closed, but open left the cell
+Of fancy, my internal sight; by which,
+Abstract as in a trance, methought I saw,
+Though sleeping, where I lay, and saw the shape
+Still glorious before whom awake I stood:
+Who stooping opened my left side, and took
+From thence a rib, with cordial spirits warm,
+And life-blood streaming fresh; wide was the wound,
+But suddenly with flesh filled up and healed:
+The rib he formed and fashioned with his hands;
+Under his forming hands a creature grew,
+Man-like, but different sex; so lovely fair,
+That what seemed fair in all the world, seemed now
+Mean, or in her summed up, in her contained
+And in her looks; which from that time infused
+Sweetness into my heart, unfelt before,
+And into all things from her air inspired
+The spirit of love and amorous delight.
+She disappeared, and left me dark; I waked
+To find her, or for ever to deplore
+Her loss, and other pleasures all abjure:
+When out of hope, behold her, not far off,
+Such as I saw her in my dream, adorned
+With what all Earth or Heaven could bestow
+To make her amiable: On she came,
+Led by her heavenly Maker, though unseen,
+And guided by his voice; nor uninformed
+Of nuptial sanctity, and marriage rites:
+Grace was in all her steps, Heaven in her eye,
+In every gesture dignity and love.
+I, overjoyed, could not forbear aloud.
+This turn hath made amends; thou hast fulfilled
+Thy words, Creator bounteous and benign,
+Giver of all things fair! but fairest this
+Of all thy gifts! nor enviest. I now see
+Bone of my bone, flesh of my flesh, myself
+Before me: Woman is her name;of Man
+Extracted: for this cause he shall forego
+Father and mother, and to his wife adhere;
+And they shall be one flesh, one heart, one soul.
+She heard me thus; and though divinely brought,
+Yet innocence, and virgin modesty,
+Her virtue, and the conscience of her worth,
+That would be wooed, and not unsought be won,
+Not obvious, not obtrusive, but, retired,
+The more desirable; or, to say all,
+Nature herself, though pure of sinful thought,
+Wrought in her so, that, seeing me, she turned:
+I followed her; she what was honour knew,
+And with obsequious majesty approved
+My pleaded reason. To the nuptial bower
+I led her blushing like the morn: All Heaven,
+And happy constellations, on that hour
+Shed their selectest influence; the Earth
+Gave sign of gratulation, and each hill;
+Joyous the birds; fresh gales and gentle airs
+Whispered it to the woods, and from their wings
+Flung rose, flung odours from the spicy shrub,
+Disporting, till the amorous bird of night
+Sung spousal, and bid haste the evening-star
+On his hill top, to light the bridal lamp.
+Thus have I told thee all my state, and brought
+My story to the sum of earthly bliss,
+Which I enjoy; and must confess to find
+In all things else delight indeed, but such
+As, used or not, works in the mind no change,
+Nor vehement desire; these delicacies
+I mean of taste, sight, smell, herbs, fruits, and flowers,
+Walks, and the melody of birds: but here
+Far otherwise, transported I behold,
+Transported touch; here passion first I felt,
+Commotion strange! in all enjoyments else
+Superiour and unmoved; here only weak
+Against the charm of Beauty's powerful glance.
+Or Nature failed in me, and left some part
+Not proof enough such object to sustain;
+Or, from my side subducting, took perhaps
+More than enough; at least on her bestowed
+Too much of ornament, in outward show
+Elaborate, of inward less exact.
+For well I understand in the prime end
+Of Nature her the inferiour, in the mind
+And inward faculties, which most excel;
+In outward also her resembling less
+His image who made both, and less expressing
+The character of that dominion given
+O'er other creatures: Yet when I approach
+Her loveliness, so absolute she seems
+And in herself complete, so well to know
+Her own, that what she wills to do or say,
+Seems wisest, virtuousest, discreetest, best:
+All higher knowledge in her presence falls
+Degraded; Wisdom in discourse with her
+Loses discountenanced, and like Folly shows;
+Authority and Reason on her wait,
+As one intended first, not after made
+Occasionally; and, to consummate all,
+Greatness of mind and Nobleness their seat
+Build in her loveliest, and create an awe
+About her, as a guard angelick placed.
+To whom the Angel with contracted brow.
+Accuse not Nature, she hath done her part;
+Do thou but thine; and be not diffident
+Of Wisdom; she deserts thee not, if thou
+Dismiss not her, when most thou needest her nigh,
+By attributing overmuch to things
+Less excellent, as thou thyself perceivest.
+For, what admirest thou, what transports thee so,
+An outside? fair, no doubt, and worthy well
+Thy cherishing, thy honouring, and thy love;
+Not thy subjection: Weigh with her thyself;
+Then value: Oft-times nothing profits more
+Than self-esteem, grounded on just and right
+Well managed; of that skill the more thou knowest,
+The more she will acknowledge thee her head,
+And to realities yield all her shows:
+Made so adorn for thy delight the more,
+So awful, that with honour thou mayest love
+Thy mate, who sees when thou art seen least wise.
+But if the sense of touch, whereby mankind
+Is propagated, seem such dear delight
+Beyond all other; think the same vouchsafed
+To cattle and each beast; which would not be
+To them made common and divulged, if aught
+Therein enjoyed were worthy to subdue
+The soul of man, or passion in him move.
+What higher in her society thou findest
+Attractive, human, rational, love still;
+In loving thou dost well, in passion not,
+Wherein true love consists not: Love refines
+The thoughts, and heart enlarges; hath his seat
+In reason, and is judicious; is the scale
+By which to heavenly love thou mayest ascend,
+Not sunk in carnal pleasure; for which cause,
+Among the beasts no mate for thee was found.
+To whom thus, half abashed, Adam replied.
+Neither her outside formed so fair, nor aught
+In procreation common to all kinds,
+(Though higher of the genial bed by far,
+And with mysterious reverence I deem,)
+So much delights me, as those graceful acts,
+Those thousand decencies, that daily flow
+From all her words and actions mixed with love
+And sweet compliance, which declare unfeigned
+Union of mind, or in us both one soul;
+Harmony to behold in wedded pair
+More grateful than harmonious sound to the ear.
+Yet these subject not; I to thee disclose
+What inward thence I feel, not therefore foiled,
+Who meet with various objects, from the sense
+Variously representing; yet, still free,
+Approve the best, and follow what I approve.
+To love, thou blamest me not; for Love, thou sayest,
+Leads up to Heaven, is both the way and guide;
+Bear with me then, if lawful what I ask:
+Love not the heavenly Spirits, and how their love
+Express they? by looks only? or do they mix
+Irradiance, virtual or immediate touch?
+To whom the Angel, with a smile that glowed
+Celestial rosy red, Love's proper hue,
+Answered. Let it suffice thee that thou knowest
+Us happy, and without love no happiness.
+Whatever pure thou in the body enjoyest,
+(And pure thou wert created) we enjoy
+In eminence; and obstacle find none
+Of membrane, joint, or limb, exclusive bars;
+Easier than air with air, if Spirits embrace,
+Total they mix, union of pure with pure
+Desiring, nor restrained conveyance need,
+As flesh to mix with flesh, or soul with soul.
+But I can now no more; the parting sun
+Beyond the Earth's green Cape and verdant Isles
+Hesperian sets, my signal to depart.
+Be strong, live happy, and love! But, first of all,
+Him, whom to love is to obey, and keep
+His great command; take heed lest passion sway
+Thy judgement to do aught, which else free will
+Would not admit: thine, and of all thy sons,
+The weal or woe in thee is placed; beware!
+I in thy persevering shall rejoice,
+And all the Blest: Stand fast;to stand or fall
+Free in thine own arbitrement it lies.
+Perfect within, no outward aid require;
+And all temptation to transgress repel.
+So saying, he arose; whom Adam thus
+Followed with benediction. Since to part,
+Go, heavenly guest, ethereal Messenger,
+Sent from whose sovran goodness I adore!
+Gentle to me and affable hath been
+Thy condescension, and shall be honoured ever
+With grateful memory: Thou to mankind
+Be good and friendly still, and oft return!
+So parted they; the Angel up to Heaven
+From the thick shade, and Adam to his bower.
+
+
+
+Book IX
+
+
+No more of talk where God or Angel guest
+With Man, as with his friend, familiar us'd,
+To sit indulgent, and with him partake
+Rural repast; permitting him the while
+Venial discourse unblam'd. I now must change
+Those notes to tragick; foul distrust, and breach
+Disloyal on the part of Man, revolt,
+And disobedience: on the part of Heaven
+Now alienated, distance and distaste,
+Anger and just rebuke, and judgement given,
+That brought into this world a world of woe,
+Sin and her shadow Death, and Misery
+Death's harbinger: Sad talk!yet argument
+Not less but more heroick than the wrath
+Of stern Achilles on his foe pursued
+Thrice fugitive about Troy wall; or rage
+Of Turnus for Lavinia disespous'd;
+Or Neptune's ire, or Juno's, that so long
+Perplexed the Greek, and Cytherea's son:
+
+ 00482129
+If answerable style I can obtain
+Of my celestial patroness, who deigns
+Her nightly visitation unimplor'd,
+And dictates to me slumbering; or inspires
+Easy my unpremeditated verse:
+Since first this subject for heroick song
+Pleas'd me long choosing, and beginning late;
+Not sedulous by nature to indite
+Wars, hitherto the only argument
+Heroick deem'd chief mastery to dissect
+With long and tedious havock fabled knights
+In battles feign'd; the better fortitude
+Of patience and heroick martyrdom
+Unsung; or to describe races and games,
+Or tilting furniture, imblazon'd shields,
+Impresses quaint, caparisons and steeds,
+Bases and tinsel trappings, gorgeous knights
+At joust and tournament; then marshall'd feast
+Serv'd up in hall with sewers and seneshals;
+The skill of artifice or office mean,
+Not that which justly gives heroick name
+To person, or to poem. Me, of these
+Nor skill'd nor studious, higher argument
+Remains; sufficient of itself to raise
+That name, unless an age too late, or cold
+Climate, or years, damp my intended wing
+Depress'd; and much they may, if all be mine,
+Not hers, who brings it nightly to my ear.
+The sun was sunk, and after him the star
+Of Hesperus, whose office is to bring
+Twilight upon the earth, short arbiter
+"twixt day and night, and now from end to end
+Night's hemisphere had veil'd the horizon round:
+When satan, who late fled before the threats
+Of Gabriel out of Eden, now improv'd
+In meditated fraud and malice, bent
+On Man's destruction, maugre what might hap
+Of heavier on himself, fearless returned
+From compassing the earth; cautious of day,
+Since Uriel, regent of the sun, descried
+His entrance, and foreworned the Cherubim
+That kept their watch; thence full of anguish driven,
+The space of seven continued nights he rode
+With darkness; thrice the equinoctial line
+He circled; four times crossed the car of night
+From pole to pole, traversing each colure;
+On the eighth returned; and, on the coast averse
+From entrance or Cherubick watch, by stealth
+Found unsuspected way. There was a place,
+Now not, though sin, not time, first wrought the change,
+Where Tigris, at the foot of Paradise,
+Into a gulf shot under ground, till part
+Rose up a fountain by the tree of life:
+In with the river sunk, and with it rose
+Satan, involved in rising mist; then sought
+Where to lie hid; sea he had searched, and land,
+From Eden over Pontus and the pool
+Maeotis, up beyond the river Ob;
+Downward as far antarctick; and in length,
+West from Orontes to the ocean barred
+At Darien ; thence to the land where flows
+Ganges and Indus: Thus the orb he roamed
+With narrow search; and with inspection deep
+Considered every creature, which of all
+Most opportune might serve his wiles; and found
+The Serpent subtlest beast of all the field.
+Him after long debate, irresolute
+Of thoughts revolved, his final sentence chose
+Fit vessel, fittest imp of fraud, in whom
+To enter, and his dark suggestions hide
+From sharpest sight: for, in the wily snake
+Whatever sleights, none would suspicious mark,
+As from his wit and native subtlety
+Proceeding; which, in other beasts observed,
+Doubt might beget of diabolick power
+Active within, beyond the sense of brute.
+Thus he resolved, but first from inward grief
+His bursting passion into plaints thus poured.
+More justly, seat worthier of Gods, as built
+With second thoughts, reforming what was old!
+O Earth, how like to Heaven, if not preferred
+For what God, after better, worse would build?
+Terrestrial Heaven, danced round by other Heavens
+That shine, yet bear their bright officious lamps,
+Light above light, for thee alone, as seems,
+In thee concentring all their precious beams
+Of sacred influence! As God in Heaven
+Is center, yet extends to all; so thou,
+Centring, receivest from all those orbs: in thee,
+Not in themselves, all their known virtue appears
+Productive in herb, plant, and nobler birth
+Of creatures animate with gradual life
+Of growth, sense, reason, all summed up in Man.
+With what delight could I have walked thee round,
+If I could joy in aught, sweet interchange
+Of hill, and valley, rivers, woods, and plains,
+Now land, now sea and shores with forest crowned,
+Rocks, dens, and caves! But I in none of these
+Find place or refuge; and the more I see
+Pleasures about me, so much more I feel
+Torment within me, as from the hateful siege
+Of contraries: all good to me becomes
+Bane, and in Heaven much worse would be my state.
+But neither here seek I, no nor in Heaven
+To dwell, unless by mastering Heaven's Supreme;
+Nor hope to be myself less miserable
+By what I seek, but others to make such
+As I, though thereby worse to me redound:
+For only in destroying I find ease
+To my relentless thoughts; and, him destroyed,
+Or won to what may work his utter loss,
+For whom all this was made, all this will soon
+Follow, as to him linked in weal or woe;
+In woe then; that destruction wide may range:
+To me shall be the glory sole among
+The infernal Powers, in one day to have marred
+What he, Almighty styled, six nights and days
+Continued making; and who knows how long
+Before had been contriving? though perhaps
+Not longer than since I, in one night, freed
+From servitude inglorious well nigh half
+The angelick name, and thinner left the throng
+Of his adorers: He, to be avenged,
+And to repair his numbers thus impaired,
+Whether such virtue spent of old now failed
+More Angels to create, if they at least
+Are his created, or, to spite us more,
+Determined to advance into our room
+A creature formed of earth, and him endow,
+Exalted from so base original,
+With heavenly spoils, our spoils: What he decreed,
+He effected; Man he made, and for him built
+Magnificent this world, and earth his seat,
+Him lord pronounced; and, O indignity!
+Subjected to his service angel-wings,
+And flaming ministers to watch and tend
+Their earthly charge: Of these the vigilance
+I dread; and, to elude, thus wrapt in mist
+Of midnight vapour glide obscure, and pry
+In every bush and brake, where hap may find
+The serpent sleeping; in whose mazy folds
+To hide me, and the dark intent I bring.
+O foul descent! that I, who erst contended
+With Gods to sit the highest, am now constrained
+Into a beast; and, mixed with bestial slime,
+This essence to incarnate and imbrute,
+That to the highth of Deity aspired!
+But what will not ambition and revenge
+Descend to? Who aspires, must down as low
+As high he soared; obnoxious, first or last,
+To basest things. Revenge, at first though sweet,
+Bitter ere long, back on itself recoils:
+Let it; I reck not, so it light well aimed,
+Since higher I fall short, on him who next
+Provokes my envy, this new favourite
+Of Heaven, this man of clay, son of despite,
+Whom, us the more to spite, his Maker raised
+From dust: Spite then with spite is best repaid.
+So saying, through each thicket dank or dry,
+Like a black mist low-creeping, he held on
+His midnight-search, where soonest he might find
+The serpent; him fast-sleeping soon he found
+In labyrinth of many a round self-rolled,
+His head the midst, well stored with subtile wiles:
+Not yet in horrid shade or dismal den,
+Nor nocent yet; but, on the grassy herb,
+Fearless unfeared he slept: in at his mouth
+The Devil entered; and his brutal sense,
+In heart or head, possessing, soon inspired
+With act intelligential; but his sleep
+Disturbed not, waiting close the approach of morn.
+Now, when as sacred light began to dawn
+In Eden on the humid flowers, that breathed
+Their morning incense, when all things, that breathe,
+From the Earth's great altar send up silent praise
+To the Creator, and his nostrils fill
+With grateful smell, forth came the human pair,
+And joined their vocal worship to the quire
+Of creatures wanting voice; that done, partake
+The season prime for sweetest scents and airs:
+Then commune, how that day they best may ply
+Their growing work: for much their work out-grew
+The hands' dispatch of two gardening so wide,
+And Eve first to her husband thus began.
+Adam, well may we labour still to dress
+This garden, still to tend plant, herb, and flower,
+Our pleasant task enjoined; but, till more hands
+Aid us, the work under our labour grows,
+Luxurious by restraint; what we by day
+Lop overgrown, or prune, or prop, or bind,
+One night or two with wanton growth derides
+Tending to wild. Thou therefore now advise,
+Or bear what to my mind first thoughts present:
+Let us divide our labours; thou, where choice
+Leads thee, or where most needs, whether to wind
+The woodbine round this arbour, or direct
+The clasping ivy where to climb; while I,
+In yonder spring of roses intermixed
+With myrtle, find what to redress till noon:
+For, while so near each other thus all day
+Our task we choose, what wonder if so near
+Looks intervene and smiles, or object new
+Casual discourse draw on; which intermits
+Our day's work, brought to little, though begun
+Early, and the hour of supper comes unearned?
+To whom mild answer Adam thus returned.
+Sole Eve, associate sole, to me beyond
+Compare above all living creatures dear!
+Well hast thou motioned, well thy thoughts employed,
+How we might best fulfil the work which here
+God hath assigned us; nor of me shalt pass
+Unpraised: for nothing lovelier can be found
+In woman, than to study houshold good,
+And good works in her husband to promote.
+Yet not so strictly hath our Lord imposed
+Labour, as to debar us when we need
+Refreshment, whether food, or talk between,
+Food of the mind, or this sweet intercourse
+Of looks and smiles; for smiles from reason flow,
+To brute denied, and are of love the food;
+Love, not the lowest end of human life.
+For not to irksome toil, but to delight,
+He made us, and delight to reason joined.
+These paths and bowers doubt not but our joint hands
+Will keep from wilderness with ease, as wide
+As we need walk, till younger hands ere long
+Assist us; But, if much converse perhaps
+Thee satiate, to short absence I could yield:
+For solitude sometimes is best society,
+And short retirement urges sweet return.
+But other doubt possesses me, lest harm
+Befall thee severed from me; for thou knowest
+What hath been warned us, what malicious foe
+Envying our happiness, and of his own
+Despairing, seeks to work us woe and shame
+By sly assault; and somewhere nigh at hand
+Watches, no doubt, with greedy hope to find
+His wish and best advantage, us asunder;
+Hopeless to circumvent us joined, where each
+To other speedy aid might lend at need:
+Whether his first design be to withdraw
+Our fealty from God, or to disturb
+Conjugal love, than which perhaps no bliss
+Enjoyed by us excites his envy more;
+Or this, or worse, leave not the faithful side
+That gave thee being, still shades thee, and protects.
+The wife, where danger or dishonour lurks,
+Safest and seemliest by her husband stays,
+Who guards her, or with her the worst endures.
+To whom the virgin majesty of Eve,
+As one who loves, and some unkindness meets,
+With sweet austere composure thus replied.
+Offspring of Heaven and Earth, and all Earth's Lord!
+That such an enemy we have, who seeks
+Our ruin, both by thee informed I learn,
+And from the parting Angel over-heard,
+As in a shady nook I stood behind,
+Just then returned at shut of evening flowers.
+But, that thou shouldst my firmness therefore doubt
+To God or thee, because we have a foe
+May tempt it, I expected not to hear.
+His violence thou fearest not, being such
+As we, not capable of death or pain,
+Can either not receive, or can repel.
+His fraud is then thy fear; which plain infers
+Thy equal fear, that my firm faith and love
+Can by his fraud be shaken or seduced;
+Thoughts, which how found they harbour in thy breast,
+Adam, mis-thought of her to thee so dear?
+To whom with healing words Adam replied.
+Daughter of God and Man, immortal Eve!
+For such thou art; from sin and blame entire:
+Not diffident of thee do I dissuade
+Thy absence from my sight, but to avoid
+The attempt itself, intended by our foe.
+For he who tempts, though in vain, at least asperses
+The tempted with dishonour foul; supposed
+Not incorruptible of faith, not proof
+Against temptation: Thou thyself with scorn
+And anger wouldst resent the offered wrong,
+Though ineffectual found: misdeem not then,
+If such affront I labour to avert
+From thee alone, which on us both at once
+The enemy, though bold, will hardly dare;
+Or daring, first on me the assault shall light.
+Nor thou his malice and false guile contemn;
+Subtle he needs must be, who could seduce
+Angels; nor think superfluous other's aid.
+I, from the influence of thy looks, receive
+Access in every virtue; in thy sight
+More wise, more watchful, stronger, if need were
+Of outward strength; while shame, thou looking on,
+Shame to be overcome or over-reached,
+Would utmost vigour raise, and raised unite.
+Why shouldst not thou like sense within thee feel
+When I am present, and thy trial choose
+With me, best witness of thy virtue tried?
+So spake domestick Adam in his care
+And matrimonial love; but Eve, who thought
+Less attributed to her faith sincere,
+Thus her reply with accent sweet renewed.
+If this be our condition, thus to dwell
+In narrow circuit straitened by a foe,
+Subtle or violent, we not endued
+Single with like defence, wherever met;
+How are we happy, still in fear of harm?
+But harm precedes not sin: only our foe,
+Tempting, affronts us with his foul esteem
+Of our integrity: his foul esteem
+Sticks no dishonour on our front, but turns
+Foul on himself; then wherefore shunned or feared
+By us? who rather double honour gain
+From his surmise proved false; find peace within,
+Favour from Heaven, our witness, from the event.
+And what is faith, love, virtue, unassayed
+Alone, without exteriour help sustained?
+Let us not then suspect our happy state
+Left so imperfect by the Maker wise,
+As not secure to single or combined.
+Frail is our happiness, if this be so,
+And Eden were no Eden, thus exposed.
+To whom thus Adam fervently replied.
+O Woman, best are all things as the will
+Of God ordained them: His creating hand
+Nothing imperfect or deficient left
+Of all that he created, much less Man,
+Or aught that might his happy state secure,
+Secure from outward force; within himself
+The danger lies, yet lies within his power:
+Against his will he can receive no harm.
+But God left free the will; for what obeys
+Reason, is free; and Reason he made right,
+But bid her well be ware, and still erect;
+Lest, by some fair-appearing good surprised,
+She dictate false; and mis-inform the will
+To do what God expressly hath forbid.
+Not then mistrust, but tender love, enjoins,
+That I should mind thee oft; and mind thou me.
+Firm we subsist, yet possible to swerve;
+Since Reason not impossibly may meet
+Some specious object by the foe suborned,
+And fall into deception unaware,
+Not keeping strictest watch, as she was warned.
+Seek not temptation then, which to avoid
+Were better, and most likely if from me
+Thou sever not: Trial will come unsought.
+Wouldst thou approve thy constancy, approve
+First thy obedience; the other who can know,
+Not seeing thee attempted, who attest?
+But, if thou think, trial unsought may find
+Us both securer than thus warned thou seemest,
+Go; for thy stay, not free, absents thee more;
+Go in thy native innocence, rely
+On what thou hast of virtue; summon all!
+For God towards thee hath done his part, do thine.
+So spake the patriarch of mankind; but Eve
+Persisted; yet submiss, though last, replied.
+With thy permission then, and thus forewarned
+Chiefly by what thy own last reasoning words
+Touched only; that our trial, when least sought,
+May find us both perhaps far less prepared,
+The willinger I go, nor much expect
+A foe so proud will first the weaker seek;
+So bent, the more shall shame him his repulse.
+Thus saying, from her husband's hand her hand
+Soft she withdrew; and, like a Wood-Nymph light,
+Oread or Dryad, or of Delia's train,
+Betook her to the groves; but Delia's self
+In gait surpassed, and Goddess-like deport,
+Though not as she with bow and quiver armed,
+But with such gardening tools as Art yet rude,
+Guiltless of fire, had formed, or Angels brought.
+To Pales, or Pomona, thus adorned,
+Likest she seemed, Pomona when she fled
+Vertumnus, or to Ceres in her prime,
+Yet virgin of Proserpina from Jove.
+Her long with ardent look his eye pursued
+Delighted, but desiring more her stay.
+Oft he to her his charge of quick return
+Repeated; she to him as oft engaged
+To be returned by noon amid the bower,
+And all things in best order to invite
+Noontide repast, or afternoon's repose.
+O much deceived, much failing, hapless Eve,
+Of thy presumed return! event perverse!
+Thou never from that hour in Paradise
+Foundst either sweet repast, or sound repose;
+Such ambush, hid among sweet flowers and shades,
+Waited with hellish rancour imminent
+To intercept thy way, or send thee back
+Despoiled of innocence, of faith, of bliss!
+For now, and since first break of dawn, the Fiend,
+Mere serpent in appearance, forth was come;
+And on his quest, where likeliest he might find
+The only two of mankind, but in them
+The whole included race, his purposed prey.
+In bower and field he sought, where any tuft
+Of grove or garden-plot more pleasant lay,
+Their tendance, or plantation for delight;
+By fountain or by shady rivulet
+He sought them both, but wished his hap might find
+Eve separate; he wished, but not with hope
+Of what so seldom chanced; when to his wish,
+Beyond his hope, Eve separate he spies,
+Veiled in a cloud of fragrance, where she stood,
+Half spied, so thick the roses blushing round
+About her glowed, oft stooping to support
+Each flower of slender stalk, whose head, though gay
+Carnation, purple, azure, or specked with gold,
+Hung drooping unsustained; them she upstays
+Gently with myrtle band, mindless the while
+Herself, though fairest unsupported flower,
+From her best prop so far, and storm so nigh.
+Nearer he drew, and many a walk traversed
+Of stateliest covert, cedar, pine, or palm;
+Then voluble and bold, now hid, now seen,
+Among thick-woven arborets, and flowers
+Imbordered on each bank, the hand of Eve:
+Spot more delicious than those gardens feigned
+Or of revived Adonis, or renowned
+Alcinous, host of old Laertes' son;
+Or that, not mystick, where the sapient king
+Held dalliance with his fair Egyptian spouse.
+Much he the place admired, the person more.
+As one who long in populous city pent,
+Where houses thick and sewers annoy the air,
+Forth issuing on a summer's morn, to breathe
+Among the pleasant villages and farms
+Adjoined, from each thing met conceives delight;
+The smell of grain, or tedded grass, or kine,
+Or dairy, each rural sight, each rural sound;
+If chance, with nymph-like step, fair virgin pass,
+What pleasing seemed, for her now pleases more;
+She most, and in her look sums all delight:
+Such pleasure took the Serpent to behold
+This flowery plat, the sweet recess of Eve
+Thus early, thus alone: Her heavenly form
+Angelick, but more soft, and feminine,
+Her graceful innocence, her every air
+Of gesture, or least action, overawed
+His malice, and with rapine sweet bereaved
+His fierceness of the fierce intent it brought:
+That space the Evil-one abstracted stood
+From his own evil, and for the time remained
+Stupidly good; of enmity disarmed,
+Of guile, of hate, of envy, of revenge:
+But the hot Hell that always in him burns,
+Though in mid Heaven, soon ended his delight,
+And tortures him now more, the more he sees
+Of pleasure, not for him ordained: then soon
+Fierce hate he recollects, and all his thoughts
+Of mischief, gratulating, thus excites.
+Thoughts, whither have ye led me! with what sweet
+Compulsion thus transported, to forget
+What hither brought us! hate, not love;nor hope
+Of Paradise for Hell, hope here to taste
+Of pleasure; but all pleasure to destroy,
+Save what is in destroying; other joy
+To me is lost. Then, let me not let pass
+Occasion which now smiles; behold alone
+The woman, opportune to all attempts,
+Her husband, for I view far round, not nigh,
+Whose higher intellectual more I shun,
+And strength, of courage haughty, and of limb
+Heroick built, though of terrestrial mould;
+Foe not informidable! exempt from wound,
+I not; so much hath Hell debased, and pain
+Enfeebled me, to what I was in Heaven.
+She fair, divinely fair, fit love for Gods!
+Not terrible, though terrour be in love
+And beauty, not approached by stronger hate,
+Hate stronger, under show of love well feigned;
+The way which to her ruin now I tend.
+So spake the enemy of mankind, enclosed
+In serpent, inmate bad! and toward Eve
+Addressed his way: not with indented wave,
+Prone on the ground, as since; but on his rear,
+Circular base of rising folds, that towered
+Fold above fold, a surging maze! his head
+Crested aloft, and carbuncle his eyes;
+With burnished neck of verdant gold, erect
+Amidst his circling spires, that on the grass
+Floated redundant: pleasing was his shape
+And lovely; never since of serpent-kind
+Lovelier, not those that in Illyria changed,
+Hermione and Cadmus, or the god
+In Epidaurus; nor to which transformed
+Ammonian Jove, or Capitoline, was seen;
+He with Olympias; this with her who bore
+Scipio, the highth of Rome. With tract oblique
+At first, as one who sought access, but feared
+To interrupt, side-long he works his way.
+As when a ship, by skilful steersmen wrought
+Nigh river's mouth or foreland, where the wind
+Veers oft, as oft so steers, and shifts her sail:
+So varied he, and of his tortuous train
+Curled many a wanton wreath in sight of Eve,
+To lure her eye; she, busied, heard the sound
+Of rusling leaves, but minded not, as used
+To such disport before her through the field,
+From every beast; more duteous at her call,
+Than at Circean call the herd disguised.
+He, bolder now, uncalled before her stood,
+But as in gaze admiring: oft he bowed
+His turret crest, and sleek enamelled neck,
+Fawning; and licked the ground whereon she trod.
+His gentle dumb expression turned at length
+The eye of Eve to mark his play; he, glad
+Of her attention gained, with serpent-tongue
+Organick, or impulse of vocal air,
+His fraudulent temptation thus began.
+Wonder not, sovran Mistress, if perhaps
+Thou canst, who art sole wonder! much less arm
+Thy looks, the Heaven of mildness, with disdain,
+Displeased that I approach thee thus, and gaze
+Insatiate; I thus single;nor have feared
+Thy awful brow, more awful thus retired.
+Fairest resemblance of thy Maker fair,
+Thee all things living gaze on, all things thine
+By gift, and thy celestial beauty adore
+With ravishment beheld! there best beheld,
+Where universally admired; but here
+In this enclosure wild, these beasts among,
+Beholders rude, and shallow to discern
+Half what in thee is fair, one man except,
+Who sees thee? and what is one? who should be seen
+A Goddess among Gods, adored and served
+By Angels numberless, thy daily train.
+So glozed the Tempter, and his proem tuned:
+Into the heart of Eve his words made way,
+Though at the voice much marvelling; at length,
+Not unamazed, she thus in answer spake.
+What may this mean? language of man pronounced
+By tongue of brute, and human sense expressed?
+The first, at least, of these I thought denied
+To beasts; whom God, on their creation-day,
+Created mute to all articulate sound:
+The latter I demur; for in their looks
+Much reason, and in their actions, oft appears.
+Thee, Serpent, subtlest beast of all the field
+I knew, but not with human voice endued;
+Redouble then this miracle, and say,
+How camest thou speakable of mute, and how
+To me so friendly grown above the rest
+Of brutal kind, that daily are in sight?
+Say, for such wonder claims attention due.
+To whom the guileful Tempter thus replied.
+Empress of this fair world, resplendent Eve!
+Easy to me it is to tell thee all
+What thou commandest; and right thou shouldst be obeyed:
+I was at first as other beasts that graze
+The trodden herb, of abject thoughts and low,
+As was my food; nor aught but food discerned
+Or sex, and apprehended nothing high:
+Till, on a day roving the field, I chanced
+A goodly tree far distant to behold
+Loaden with fruit of fairest colours mixed,
+Ruddy and gold: I nearer drew to gaze;
+When from the boughs a savoury odour blown,
+Grateful to appetite, more pleased my sense
+Than smell of sweetest fennel, or the teats
+Of ewe or goat dropping with milk at even,
+Unsucked of lamb or kid, that tend their play.
+To satisfy the sharp desire I had
+Of tasting those fair apples, I resolved
+Not to defer; hunger and thirst at once,
+Powerful persuaders, quickened at the scent
+Of that alluring fruit, urged me so keen.
+About the mossy trunk I wound me soon;
+For, high from ground, the branches would require
+Thy utmost reach or Adam's: Round the tree
+All other beasts that saw, with like desire
+Longing and envying stood, but could not reach.
+Amid the tree now got, where plenty hung
+Tempting so nigh, to pluck and eat my fill
+I spared not; for, such pleasure till that hour,
+At feed or fountain, never had I found.
+Sated at length, ere long I might perceive
+Strange alteration in me, to degree
+Of reason in my inward powers; and speech
+Wanted not long; though to this shape retained.
+Thenceforth to speculations high or deep
+I turned my thoughts, and with capacious mind
+Considered all things visible in Heaven,
+Or Earth, or Middle; all things fair and good:
+But all that fair and good in thy divine
+Semblance, and in thy beauty's heavenly ray,
+United I beheld; no fair to thine
+Equivalent or second! which compelled
+Me thus, though importune perhaps, to come
+And gaze, and worship thee of right declared
+Sovran of creatures, universal Dame!
+So talked the spirited sly Snake; and Eve,
+Yet more amazed, unwary thus replied.
+Serpent, thy overpraising leaves in doubt
+The virtue of that fruit, in thee first proved:
+But say, where grows the tree? from hence how far?
+For many are the trees of God that grow
+In Paradise, and various, yet unknown
+To us; in such abundance lies our choice,
+As leaves a greater store of fruit untouched,
+Still hanging incorruptible, till men
+Grow up to their provision, and more hands
+Help to disburden Nature of her birth.
+To whom the wily Adder, blithe and glad.
+Empress, the way is ready, and not long;
+Beyond a row of myrtles, on a flat,
+Fast by a fountain, one small thicket past
+Of blowing myrrh and balm: if thou accept
+My conduct, I can bring thee thither soon
+Lead then, said Eve. He, leading, swiftly rolled
+In tangles, and made intricate seem straight,
+To mischief swift. Hope elevates, and joy
+Brightens his crest; as when a wandering fire,
+Compact of unctuous vapour, which the night
+Condenses, and the cold environs round,
+Kindled through agitation to a flame,
+Which oft, they say, some evil Spirit attends,
+Hovering and blazing with delusive light,
+Misleads the amazed night-wanderer from his way
+To bogs and mires, and oft through pond or pool;
+There swallowed up and lost, from succour far.
+So glistered the dire Snake, and into fraud
+Led Eve, our credulous mother, to the tree
+Of prohibition, root of all our woe;
+Which when she saw, thus to her guide she spake.
+Serpent, we might have spared our coming hither,
+Fruitless to me, though fruit be here to excess,
+The credit of whose virtue rest with thee;
+Wonderous indeed, if cause of such effects.
+But of this tree we may not taste nor touch;
+God so commanded, and left that command
+Sole daughter of his voice; the rest, we live
+Law to ourselves; our reason is our law.
+To whom the Tempter guilefully replied.
+Indeed! hath God then said that of the fruit
+Of all these garden-trees ye shall not eat,
+Yet Lords declared of all in earth or air$?
+To whom thus Eve, yet sinless. Of the fruit
+Of each tree in the garden we may eat;
+But of the fruit of this fair tree amidst
+The garden, God hath said, Ye shall not eat
+Thereof, nor shall ye touch it, lest ye die.
+She scarce had said, though brief, when now more bold
+The Tempter, but with show of zeal and love
+To Man, and indignation at his wrong,
+New part puts on; and, as to passion moved,
+Fluctuates disturbed, yet comely and in act
+Raised, as of some great matter to begin.
+As when of old some orator renowned,
+In Athens or free Rome, where eloquence
+Flourished, since mute! to some great cause addressed,
+Stood in himself collected; while each part,
+Motion, each act, won audience ere the tongue;
+Sometimes in highth began, as no delay
+Of preface brooking, through his zeal of right:
+So standing, moving, or to highth up grown,
+The Tempter, all impassioned, thus began.
+O sacred, wise, and wisdom-giving Plant,
+Mother of science! now I feel thy power
+Within me clear; not only to discern
+Things in their causes, but to trace the ways
+Of highest agents, deemed however wise.
+Queen of this universe! do not believe
+Those rigid threats of death: ye shall not die:
+How should you? by the fruit? it gives you life
+To knowledge; by the threatener? look on me,
+Me, who have touched and tasted; yet both live,
+And life more perfect have attained than Fate
+Meant me, by venturing higher than my lot.
+Shall that be shut to Man, which to the Beast
+Is open? or will God incense his ire
+For such a petty trespass? and not praise
+Rather your dauntless virtue, whom the pain
+Of death denounced, whatever thing death be,
+Deterred not from achieving what might lead
+To happier life, knowledge of good and evil;
+Of good, how just? of evil, if what is evil
+Be real, why not known, since easier shunned?
+God therefore cannot hurt ye, and be just;
+Not just, not God; not feared then, nor obeyed:
+Your fear itself of death removes the fear.
+Why then was this forbid? Why, but to awe;
+Why, but to keep ye low and ignorant,
+His worshippers? He knows that in the day
+Ye eat thereof, your eyes that seem so clear,
+Yet are but dim, shall perfectly be then
+Opened and cleared, and ye shall be as Gods,
+Knowing both good and evil, as they know.
+That ye shall be as Gods, since I as Man,
+Internal Man, is but proportion meet;
+I, of brute, human; ye, of human, Gods.
+So ye shall die perhaps, by putting off
+Human, to put on Gods; death to be wished,
+Though threatened, which no worse than this can bring.
+And what are Gods, that Man may not become
+As they, participating God-like food?
+The Gods are first, and that advantage use
+On our belief, that all from them proceeds:
+I question it; for this fair earth I see,
+Warmed by the sun, producing every kind;
+Them, nothing: if they all things, who enclosed
+Knowledge of good and evil in this tree,
+That whoso eats thereof, forthwith attains
+Wisdom without their leave? and wherein lies
+The offence, that Man should thus attain to know?
+What can your knowledge hurt him, or this tree
+Impart against his will, if all be his?
+Or is it envy? and can envy dwell
+In heavenly breasts? These, these, and many more
+Causes import your need of this fair fruit.
+Goddess humane, reach then, and freely taste!
+He ended; and his words, replete with guile,
+Into her heart too easy entrance won:
+Fixed on the fruit she gazed, which to behold
+Might tempt alone; and in her ears the sound
+Yet rung of his persuasive words, impregned
+With reason, to her seeming, and with truth:
+Mean while the hour of noon drew on, and waked
+An eager appetite, raised by the smell
+So savoury of that fruit, which with desire,
+Inclinable now grown to touch or taste,
+Solicited her longing eye; yet first
+Pausing a while, thus to herself she mused.
+Great are thy virtues, doubtless, best of fruits,
+Though kept from man, and worthy to be admired;
+Whose taste, too long forborn, at first assay
+Gave elocution to the mute, and taught
+The tongue not made for speech to speak thy praise:
+Thy praise he also, who forbids thy use,
+Conceals not from us, naming thee the tree
+Of knowledge, knowledge both of good and evil;
+Forbids us then to taste! but his forbidding
+Commends thee more, while it infers the good
+By thee communicated, and our want:
+For good unknown sure is not had; or, had
+And yet unknown, is as not had at all.
+In plain then, what forbids he but to know,
+Forbids us good, forbids us to be wise?
+Such prohibitions bind not. But, if death
+Bind us with after-bands, what profits then
+Our inward freedom? In the day we eat
+Of this fair fruit, our doom is, we shall die!
+How dies the Serpent? he hath eaten and lives,
+And knows, and speaks, and reasons, and discerns,
+Irrational till then. For us alone
+Was death invented? or to us denied
+This intellectual food, for beasts reserved?
+For beasts it seems: yet that one beast which first
+Hath tasted envies not, but brings with joy
+The good befallen him, author unsuspect,
+Friendly to man, far from deceit or guile.
+What fear I then? rather, what know to fear
+Under this ignorance of good and evil,
+Of God or death, of law or penalty?
+Here grows the cure of all, this fruit divine,
+Fair to the eye, inviting to the taste,
+Of virtue to make wise: What hinders then
+To reach, and feed at once both body and mind?
+So saying, her rash hand in evil hour
+Forth reaching to the fruit, she plucked, she eat!
+Earth felt the wound; and Nature from her seat,
+Sighing through all her works, gave signs of woe,
+That all was lost. Back to the thicket slunk
+The guilty Serpent; and well might;for Eve,
+Intent now wholly on her taste, nought else
+Regarded; such delight till then, as seemed,
+In fruit she never tasted, whether true
+Or fancied so, through expectation high
+Of knowledge; not was Godhead from her thought.
+Greedily she ingorged without restraint,
+And knew not eating death: Satiate at length,
+And hightened as with wine, jocund and boon,
+Thus to herself she pleasingly began.
+O sovran, virtuous, precious of all trees
+In Paradise! of operation blest
+To sapience, hitherto obscured, infamed.
+And thy fair fruit let hang, as to no end
+Created; but henceforth my early care,
+Not without song, each morning, and due praise,
+Shall tend thee, and the fertile burden ease
+Of thy full branches offered free to all;
+Till, dieted by thee, I grow mature
+In knowledge, as the Gods, who all things know;
+Though others envy what they cannot give:
+For, had the gift been theirs, it had not here
+Thus grown. Experience, next, to thee I owe,
+Best guide; not following thee, I had remained
+In ignorance; thou openest wisdom's way,
+And givest access, though secret she retire.
+And I perhaps am secret: Heaven is high,
+High, and remote to see from thence distinct
+Each thing on Earth; and other care perhaps
+May have diverted from continual watch
+Our great Forbidder, safe with all his spies
+About him. But to Adam in what sort
+Shall I appear? shall I to him make known
+As yet my change, and give him to partake
+Full happiness with me, or rather not,
+But keeps the odds of knowledge in my power
+Without copartner? so to add what wants
+In female sex, the more to draw his love,
+And render me more equal; and perhaps,
+A thing not undesirable, sometime
+Superiour; for, inferiour, who is free
+This may be well: But what if God have seen,
+And death ensue? then I shall be no more!
+And Adam, wedded to another Eve,
+Shall live with her enjoying, I extinct;
+A death to think! Confirmed then I resolve,
+Adam shall share with me in bliss or woe:
+So dear I love him, that with him all deaths
+I could endure, without him live no life.
+So saying, from the tree her step she turned;
+But first low reverence done, as to the Power
+That dwelt within, whose presence had infused
+Into the plant sciential sap, derived
+From nectar, drink of Gods. Adam the while,
+Waiting desirous her return, had wove
+Of choicest flowers a garland, to adorn
+Her tresses, and her rural labours crown;
+As reapers oft are wont their harvest-queen.
+Great joy he promised to his thoughts, and new
+Solace in her return, so long delayed:
+Yet oft his heart, divine of something ill,
+Misgave him; he the faltering measure felt;
+And forth to meet her went, the way she took
+That morn when first they parted: by the tree
+Of knowledge he must pass; there he her met,
+Scarce from the tree returning; in her hand
+A bough of fairest fruit, that downy smiled,
+New gathered, and ambrosial smell diffused.
+To him she hasted; in her face excuse
+Came prologue, and apology too prompt;
+Which, with bland words at will, she thus addressed.
+Hast thou not wondered, Adam, at my stay?
+Thee I have missed, and thought it long, deprived
+Thy presence; agony of love till now
+Not felt, nor shall be twice; for never more
+Mean I to try, what rash untried I sought,
+The pain of absence from thy sight. But strange
+Hath been the cause, and wonderful to hear:
+This tree is not, as we are told, a tree
+Of danger tasted, nor to evil unknown
+Opening the way, but of divine effect
+To open eyes, and make them Gods who taste;
+And hath been tasted such: The serpent wise,
+Or not restrained as we, or not obeying,
+Hath eaten of the fruit; and is become,
+Not dead, as we are threatened, but thenceforth
+Endued with human voice and human sense,
+Reasoning to admiration; and with me
+Persuasively hath so prevailed, that I
+Have also tasted, and have also found
+The effects to correspond; opener mine eyes,
+Dim erst, dilated spirits, ampler heart,
+And growing up to Godhead; which for thee
+Chiefly I sought, without thee can despise.
+For bliss, as thou hast part, to me is bliss;
+Tedious, unshared with thee, and odious soon.
+Thou therefore also taste, that equal lot
+May join us, equal joy, as equal love;
+Lest, thou not tasting, different degree
+Disjoin us, and I then too late renounce
+Deity for thee, when Fate will not permit.
+Thus Eve with countenance blithe her story told;
+But in her cheek distemper flushing glowed.
+On the other side Adam, soon as he heard
+The fatal trespass done by Eve, amazed,
+Astonied stood and blank, while horrour chill
+Ran through his veins, and all his joints relaxed;
+From his slack hand the garland wreathed for Eve
+Down dropt, and all the faded roses shed:
+Speechless he stood and pale, till thus at length
+First to himself he inward silence broke.
+O fairest of Creation, last and best
+Of all God's works, Creature in whom excelled
+Whatever can to sight or thought be formed,
+Holy, divine, good, amiable, or sweet!
+How art thou lost! how on a sudden lost,
+Defaced, deflowered, and now to death devote!
+Rather, how hast thou yielded to transgress
+The strict forbiddance, how to violate
+The sacred fruit forbidden! Some cursed fraud
+Of enemy hath beguiled thee, yet unknown,
+And me with thee hath ruined; for with thee
+Certain my resolution is to die:
+How can I live without thee! how forego
+Thy sweet converse, and love so dearly joined,
+To live again in these wild woods forlorn!
+Should God create another Eve, and I
+Another rib afford, yet loss of thee
+Would never from my heart: no, no!I feel
+The link of Nature draw me: flesh of flesh,
+Bone of my bone thou art, and from thy state
+Mine never shall be parted, bliss or woe.
+So having said, as one from sad dismay
+Recomforted, and after thoughts disturbed
+Submitting to what seemed remediless,
+Thus in calm mood his words to Eve he turned.
+Bold deed thou hast presumed, adventurous Eve,
+And peril great provoked, who thus hast dared,
+Had it been only coveting to eye
+That sacred fruit, sacred to abstinence,
+Much more to taste it under ban to touch.
+But past who can recall, or done undo?
+Not God Omnipotent, nor Fate; yet so
+Perhaps thou shalt not die, perhaps the fact
+Is not so heinous now, foretasted fruit,
+Profaned first by the serpent, by him first
+Made common, and unhallowed, ere our taste;
+Nor yet on him found deadly; yet he lives;
+Lives, as thou saidst, and gains to live, as Man,
+Higher degree of life; inducement strong
+To us, as likely tasting to attain
+Proportional ascent; which cannot be
+But to be Gods, or Angels, demi-Gods.
+Nor can I think that God, Creator wise,
+Though threatening, will in earnest so destroy
+Us his prime creatures, dignified so high,
+Set over all his works; which in our fall,
+For us created, needs with us must fail,
+Dependant made; so God shall uncreate,
+Be frustrate, do, undo, and labour lose;
+Not well conceived of God, who, though his power
+Creation could repeat, yet would be loth
+Us to abolish, lest the Adversary
+Triumph, and say; "Fickle their state whom God
+"Most favours; who can please him long? Me first
+"He ruined, now Mankind; whom will he next?"
+Matter of scorn, not to be given the Foe.
+However I with thee have fixed my lot,
+Certain to undergo like doom: If death
+Consort with thee, death is to me as life;
+So forcible within my heart I feel
+The bond of Nature draw me to my own;
+My own in thee, for what thou art is mine;
+Our state cannot be severed; we are one,
+One flesh; to lose thee were to lose myself.
+So Adam; and thus Eve to him replied.
+O glorious trial of exceeding love,
+Illustrious evidence, example high!
+Engaging me to emulate; but, short
+Of thy perfection, how shall I attain,
+Adam, from whose dear side I boast me sprung,
+And gladly of our union hear thee speak,
+One heart, one soul in both; whereof good proof
+This day affords, declaring thee resolved,
+Rather than death, or aught than death more dread,
+Shall separate us, linked in love so dear,
+To undergo with me one guilt, one crime,
+If any be, of tasting this fair fruit;
+Whose virtue for of good still good proceeds,
+Direct, or by occasion, hath presented
+This happy trial of thy love, which else
+So eminently never had been known?
+Were it I thought death menaced would ensue
+This my attempt, I would sustain alone
+The worst, and not persuade thee, rather die
+Deserted, than oblige thee with a fact
+Pernicious to thy peace; chiefly assured
+Remarkably so late of thy so true,
+So faithful, love unequalled: but I feel
+Far otherwise the event; not death, but life
+Augmented, opened eyes, new hopes, new joys,
+Taste so divine, that what of sweet before
+Hath touched my sense, flat seems to this, and harsh.
+On my experience, Adam, freely taste,
+And fear of death deliver to the winds.
+So saying, she embraced him, and for joy
+Tenderly wept; much won, that he his love
+Had so ennobled, as of choice to incur
+Divine displeasure for her sake, or death.
+In recompence for such compliance bad
+Such recompence best merits from the bough
+She gave him of that fair enticing fruit
+With liberal hand: he scrupled not to eat,
+Against his better knowledge; not deceived,
+But fondly overcome with female charm.
+Earth trembled from her entrails, as again
+In pangs; and Nature gave a second groan;
+Sky loured; and, muttering thunder, some sad drops
+Wept at completing of the mortal sin
+Original: while Adam took no thought,
+Eating his fill; nor Eve to iterate
+Her former trespass feared, the more to sooth
+Him with her loved society; that now,
+As with new wine intoxicated both,
+They swim in mirth, and fancy that they feel
+Divinity within them breeding wings,
+Wherewith to scorn the earth: But that false fruit
+Far other operation first displayed,
+Carnal desire inflaming; he on Eve
+Began to cast lascivious eyes; she him
+As wantonly repaid; in lust they burn:
+Till Adam thus 'gan Eve to dalliance move.
+Eve, now I see thou art exact of taste,
+And elegant, of sapience no small part;
+Since to each meaning savour we apply,
+And palate call judicious; I the praise
+Yield thee, so well this day thou hast purveyed.
+Much pleasure we have lost, while we abstained
+From this delightful fruit, nor known till now
+True relish, tasting; if such pleasure be
+In things to us forbidden, it might be wished,
+For this one tree had been forbidden ten.
+But come, so well refreshed, now let us play,
+As meet is, after such delicious fare;
+For never did thy beauty, since the day
+I saw thee first and wedded thee, adorned
+With all perfections, so inflame my sense
+With ardour to enjoy thee, fairer now
+Than ever; bounty of this virtuous tree!
+So said he, and forbore not glance or toy
+Of amorous intent; well understood
+Of Eve, whose eye darted contagious fire.
+Her hand he seised; and to a shady bank,
+Thick over-head with verdant roof imbowered,
+He led her nothing loth; flowers were the couch,
+Pansies, and violets, and asphodel,
+And hyacinth; Earth's freshest softest lap.
+There they their fill of love and love's disport
+Took largely, of their mutual guilt the seal,
+The solace of their sin; till dewy sleep
+Oppressed them, wearied with their amorous play,
+Soon as the force of that fallacious fruit,
+That with exhilarating vapour bland
+About their spirits had played, and inmost powers
+Made err, was now exhaled; and grosser sleep,
+Bred of unkindly fumes, with conscious dreams
+Incumbered, now had left them; up they rose
+As from unrest; and, each the other viewing,
+Soon found their eyes how opened, and their minds
+How darkened; innocence, that as a veil
+Had shadowed them from knowing ill, was gone;
+Just confidence, and native righteousness,
+And honour, from about them, naked left
+To guilty Shame; he covered, but his robe
+Uncovered more. So rose the Danite strong,
+Herculean Samson, from the harlot-lap
+Of Philistean Dalilah, and waked
+Shorn of his strength. They destitute and bare
+Of all their virtue: Silent, and in face
+Confounded, long they sat, as strucken mute:
+Till Adam, though not less than Eve abashed,
+At length gave utterance to these words constrained.
+O Eve, in evil hour thou didst give ear
+To that false worm, of whomsoever taught
+To counterfeit Man's voice; true in our fall,
+False in our promised rising; since our eyes
+Opened we find indeed, and find we know
+Both good and evil; good lost, and evil got;
+Bad fruit of knowledge, if this be to know;
+Which leaves us naked thus, of honour void,
+Of innocence, of faith, of purity,
+Our wonted ornaments now soiled and stained,
+And in our faces evident the signs
+Of foul concupiscence; whence evil store;
+Even shame, the last of evils; of the first
+Be sure then.--How shall I behold the face
+Henceforth of God or Angel, erst with joy
+And rapture so oft beheld? Those heavenly shapes
+Will dazzle now this earthly with their blaze
+Insufferably bright. O! might I here
+In solitude live savage; in some glade
+Obscured, where highest woods, impenetrable
+To star or sun-light, spread their umbrage broad
+And brown as evening: Cover me, ye Pines!
+Ye Cedars, with innumerable boughs
+Hide me, where I may never see them more!--
+But let us now, as in bad plight, devise
+What best may for the present serve to hide
+The parts of each from other, that seem most
+To shame obnoxious, and unseemliest seen;
+Some tree, whose broad smooth leaves together sewed,
+And girded on our loins, may cover round
+Those middle parts; that this new comer, Shame,
+There sit not, and reproach us as unclean.
+So counselled he, and both together went
+Into the thickest wood; there soon they chose
+The fig-tree; not that kind for fruit renowned,
+But such as at this day, to Indians known,
+In Malabar or Decan spreads her arms
+Branching so broad and long, that in the ground
+The bended twigs take root, and daughters grow
+About the mother tree, a pillared shade
+High over-arched, and echoing walks between:
+There oft the Indian herdsman, shunning heat,
+Shelters in cool, and tends his pasturing herds
+At loop-holes cut through thickest shade: Those leaves
+They gathered, broad as Amazonian targe;
+And, with what skill they had, together sewed,
+To gird their waist; vain covering, if to hide
+Their guilt and dreaded shame! O, how unlike
+To that first naked glory! Such of late
+Columbus found the American, so girt
+With feathered cincture; naked else, and wild
+Among the trees on isles and woody shores.
+Thus fenced, and, as they thought, their shame in part
+Covered, but not at rest or ease of mind,
+They sat them down to weep; nor only tears
+Rained at their eyes, but high winds worse within
+Began to rise, high passions, anger, hate,
+Mistrust, suspicion, discord; and shook sore
+Their inward state of mind, calm region once
+And full of peace, now tost and turbulent:
+For Understanding ruled not, and the Will
+Heard not her lore; both in subjection now
+To sensual Appetite, who from beneath
+Usurping over sovran Reason claimed
+Superiour sway: From thus distempered breast,
+Adam, estranged in look and altered style,
+Speech intermitted thus to Eve renewed.
+Would thou hadst hearkened to my words, and staid
+With me, as I besought thee, when that strange
+Desire of wandering, this unhappy morn,
+I know not whence possessed thee; we had then
+Remained still happy; not, as now, despoiled
+Of all our good; shamed, naked, miserable!
+Let none henceforth seek needless cause to approve
+The faith they owe; when earnestly they seek
+Such proof, conclude, they then begin to fail.
+To whom, soon moved with touch of blame, thus Eve.
+What words have passed thy lips, Adam severe!
+Imputest thou that to my default, or will
+Of wandering, as thou callest it, which who knows
+But might as ill have happened thou being by,
+Or to thyself perhaps? Hadst thou been there,
+Or here the attempt, thou couldst not have discerned
+Fraud in the Serpent, speaking as he spake;
+No ground of enmity between us known,
+Why he should mean me ill, or seek to harm.
+Was I to have never parted from thy side?
+As good have grown there still a lifeless rib.
+Being as I am, why didst not thou, the head,
+Command me absolutely not to go,
+Going into such danger, as thou saidst?
+Too facile then, thou didst not much gainsay;
+Nay, didst permit, approve, and fair dismiss.
+Hadst thou been firm and fixed in thy dissent,
+Neither had I transgressed, nor thou with me.
+To whom, then first incensed, Adam replied.
+Is this the love, is this the recompence
+Of mine to thee, ingrateful Eve! expressed
+Immutable, when thou wert lost, not I;
+Who might have lived, and joyed immortal bliss,
+Yet willingly chose rather death with thee?
+And am I now upbraided as the cause
+Of thy transgressing? Not enough severe,
+It seems, in thy restraint: What could I more
+I warned thee, I admonished thee, foretold
+The danger, and the lurking enemy
+That lay in wait; beyond this, had been force;
+And force upon free will hath here no place.
+But confidence then bore thee on; secure
+Either to meet no danger, or to find
+Matter of glorious trial; and perhaps
+I also erred, in overmuch admiring
+What seemed in thee so perfect, that I thought
+No evil durst attempt thee; but I rue
+The errour now, which is become my crime,
+And thou the accuser. Thus it shall befall
+Him, who, to worth in women overtrusting,
+Lets her will rule: restraint she will not brook;
+And, left to herself, if evil thence ensue,
+She first his weak indulgence will accuse.
+Thus they in mutual accusation spent
+The fruitless hours, but neither self-condemning;
+And of their vain contest appeared no end.
+
+
+
+Book X
+
+
+Mean while the heinous and despiteful act
+Of Satan, done in Paradise; and how
+He, in the serpent, had perverted Eve,
+Her husband she, to taste the fatal fruit,
+Was known in Heaven; for what can 'scape the eye
+Of God all-seeing, or deceive his heart
+Omniscient? who, in all things wise and just,
+Hindered not Satan to attempt the mind
+Of Man, with strength entire and free will armed,
+Complete to have discovered and repulsed
+Whatever wiles of foe or seeming friend.
+For still they knew, and ought to have still remembered,
+The high injunction, not to taste that fruit,
+Whoever tempted; which they not obeying,
+(Incurred what could they less?) the penalty;
+And, manifold in sin, deserved to fall.
+Up into Heaven from Paradise in haste
+The angelick guards ascended, mute, and sad,
+For Man; for of his state by this they knew,
+Much wondering how the subtle Fiend had stolen
+Entrance unseen. Soon as the unwelcome news
+From Earth arrived at Heaven-gate, displeased
+All were who heard; dim sadness did not spare
+That time celestial visages, yet, mixed
+With pity, violated not their bliss.
+About the new-arrived, in multitudes
+The ethereal people ran, to hear and know
+How all befel: They towards the throne supreme,
+Accountable, made haste, to make appear,
+With righteous plea, their utmost vigilance
+And easily approved; when the Most High
+Eternal Father, from his secret cloud,
+Amidst in thunder uttered thus his voice.
+Assembled Angels, and ye Powers returned
+From unsuccessful charge; be not dismayed,
+Nor troubled at these tidings from the earth,
+Which your sincerest care could not prevent;
+Foretold so lately what would come to pass,
+When first this tempter crossed the gulf from Hell.
+I told ye then he should prevail, and speed
+On his bad errand; Man should be seduced,
+And flattered out of all, believing lies
+Against his Maker; no decree of mine
+Concurring to necessitate his fall,
+Or touch with lightest moment of impulse
+His free will, to her own inclining left
+In even scale. But fallen he is; and now
+What rests, but that the mortal sentence pass
+On his transgression,--death denounced that day?
+Which he presumes already vain and void,
+Because not yet inflicted, as he feared,
+By some immediate stroke; but soon shall find
+Forbearance no acquittance, ere day end.
+Justice shall not return as bounty scorned.
+But whom send I to judge them? whom but thee,
+Vicegerent Son? To thee I have transferred
+All judgement, whether in Heaven, or Earth, or Hell.
+Easy it may be seen that I intend
+Mercy colleague with justice, sending thee
+Man's friend, his Mediator, his designed
+Both ransom and Redeemer voluntary,
+And destined Man himself to judge Man fallen.
+So spake the Father; and, unfolding bright
+Toward the right hand his glory, on the Son
+Blazed forth unclouded Deity: He full
+Resplendent all his Father manifest
+Expressed, and thus divinely answered mild.
+Father Eternal, thine is to decree;
+Mine, both in Heaven and Earth, to do thy will
+Supreme; that thou in me, thy Son beloved,
+Mayest ever rest well pleased. I go to judge
+On earth these thy transgressours; but thou knowest,
+Whoever judged, the worst on me must light,
+When time shall be; for so I undertook
+Before thee; and, not repenting, this obtain
+Of right, that I may mitigate their doom
+On me derived; yet I shall temper so
+Justice with mercy, as may illustrate most
+Them fully satisfied, and thee appease.
+Attendance none shall need, nor train, where none
+Are to behold the judgement, but the judged,
+Those two; the third best absent is condemned,
+Convict by flight, and rebel to all law:
+Conviction to the serpent none belongs.
+Thus saying, from his radiant seat he rose
+Of high collateral glory: Him Thrones, and Powers,
+Princedoms, and Dominations ministrant,
+Accompanied to Heaven-gate; from whence
+Eden, and all the coast, in prospect lay.
+Down he descended straight; the speed of Gods
+Time counts not, though with swiftest minutes winged.
+Now was the sun in western cadence low
+From noon, and gentle airs, due at their hour,
+To fan the earth now waked, and usher in
+The evening cool; when he, from wrath more cool,
+Came the mild Judge, and Intercessour both,
+To sentence Man: The voice of God they heard
+Now walking in the garden, by soft winds
+Brought to their ears, while day declined; they heard,
+And from his presence hid themselves among
+The thickest trees, both man and wife; till God,
+Approaching, thus to Adam called aloud.
+Where art thou, Adam, wont with joy to meet
+My coming seen far off? I miss thee here,
+Not pleased, thus entertained with solitude,
+Where obvious duty ere while appeared unsought:
+Or come I less conspicuous, or what change
+Absents thee, or what chance detains?--Come forth!
+He came; and with him Eve, more loth, though first
+To offend; discountenanced both, and discomposed;
+Love was not in their looks, either to God,
+Or to each other; but apparent guilt,
+And shame, and perturbation, and despair,
+Anger, and obstinacy, and hate, and guile.
+Whence Adam, faltering long, thus answered brief.
+I heard thee in the garden, and of thy voice
+Afraid, being naked, hid myself. To whom
+The gracious Judge without revile replied.
+My voice thou oft hast heard, and hast not feared,
+But still rejoiced; how is it now become
+So dreadful to thee? That thou art naked, who
+Hath told thee? Hast thou eaten of the tree,
+Whereof I gave thee charge thou shouldst not eat?
+To whom thus Adam sore beset replied.
+O Heaven! in evil strait this day I stand
+Before my Judge; either to undergo
+Myself the total crime, or to accuse
+My other self, the partner of my life;
+Whose failing, while her faith to me remains,
+I should conceal, and not expose to blame
+By my complaint: but strict necessity
+Subdues me, and calamitous constraint;
+Lest on my head both sin and punishment,
+However insupportable, be all
+Devolved; though should I hold my peace, yet thou
+Wouldst easily detect what I conceal.--
+This Woman, whom thou madest to be my help,
+And gavest me as thy perfect gift, so good,
+So fit, so acceptable, so divine,
+That from her hand I could suspect no ill,
+And what she did, whatever in itself,
+Her doing seemed to justify the deed;
+She gave me of the tree, and I did eat.
+To whom the Sovran Presence thus replied.
+Was she thy God, that her thou didst obey
+Before his voice? or was she made thy guide,
+Superiour, or but equal, that to her
+Thou didst resign thy manhood, and the place
+Wherein God set thee above her made of thee,
+And for thee, whose perfection far excelled
+Hers in all real dignity? Adorned
+She was indeed, and lovely, to attract
+Thy love, not thy subjection; and her gifts
+Were such, as under government well seemed;
+Unseemly to bear rule; which was thy part
+And person, hadst thou known thyself aright.
+So having said, he thus to Eve in few.
+Say, Woman, what is this which thou hast done?
+To whom sad Eve, with shame nigh overwhelmed,
+Confessing soon, yet not before her Judge
+Bold or loquacious, thus abashed replied.
+The Serpent me beguiled, and I did eat.
+Which when the Lord God heard, without delay
+To judgement he proceeded on the accused
+Serpent, though brute; unable to transfer
+The guilt on him, who made him instrument
+Of mischief, and polluted from the end
+Of his creation; justly then accursed,
+As vitiated in nature: More to know
+Concerned not Man, (since he no further knew)
+Nor altered his offence; yet God at last
+To Satan first in sin his doom applied,
+Though in mysterious terms, judged as then best:
+And on the Serpent thus his curse let fall.
+Because thou hast done this, thou art accursed
+Above all cattle, each beast of the field;
+Upon thy belly groveling thou shalt go,
+And dust shalt eat all the days of thy life.
+Between thee and the woman I will put
+Enmity, and between thine and her seed;
+Her seed shall bruise thy head, thou bruise his heel.
+So spake this oracle, then verified
+When Jesus, Son of Mary, second Eve,
+Saw Satan fall, like lightning, down from Heaven,
+Prince of the air; then, rising from his grave
+Spoiled Principalities and Powers, triumphed
+In open show; and, with ascension bright,
+Captivity led captive through the air,
+The realm itself of Satan, long usurped;
+Whom he shall tread at last under our feet;
+Even he, who now foretold his fatal bruise;
+And to the Woman thus his sentence turned.
+Thy sorrow I will greatly multiply
+By thy conception; children thou shalt bring
+In sorrow forth; and to thy husband's will
+Thine shall submit; he over thee shall rule.
+On Adam last thus judgement he pronounced.
+Because thou hast hearkened to the voice of thy wife,
+And eaten of the tree, concerning which
+I charged thee, saying, Thou shalt not eat thereof:
+Cursed is the ground for thy sake; thou in sorrow
+Shalt eat thereof, all the days of thy life;
+Thorns also and thistles it shall bring thee forth
+Unbid; and thou shalt eat the herb of the field;
+In the sweat of thy face shalt thou eat bread,
+Till thou return unto the ground; for thou
+Out of the ground wast taken, know thy birth,
+For dust thou art, and shalt to dust return.
+So judged he Man, both Judge and Saviour sent;
+And the instant stroke of death, denounced that day,
+Removed far off; then, pitying how they stood
+Before him naked to the air, that now
+Must suffer change, disdained not to begin
+Thenceforth the form of servant to assume;
+As when he washed his servants feet; so now,
+As father of his family, he clad
+Their nakedness with skins of beasts, or slain,
+Or as the snake with youthful coat repaid;
+And thought not much to clothe his enemies;
+Nor he their outward only with the skins
+Of beasts, but inward nakedness, much more.
+Opprobrious, with his robe of righteousness,
+Arraying, covered from his Father's sight.
+To him with swift ascent he up returned,
+Into his blissful bosom reassumed
+In glory, as of old; to him appeased
+All, though all-knowing, what had passed with Man
+Recounted, mixing intercession sweet.
+Mean while, ere thus was sinned and judged on Earth,
+Within the gates of Hell sat Sin and Death,
+In counterview within the gates, that now
+Stood open wide, belching outrageous flame
+Far into Chaos, since the Fiend passed through,
+Sin opening; who thus now to Death began.
+O Son, why sit we here each other viewing
+Idly, while Satan, our great author, thrives
+In other worlds, and happier seat provides
+For us, his offspring dear? It cannot be
+But that success attends him; if mishap,
+Ere this he had returned, with fury driven
+By his avengers; since no place like this
+Can fit his punishment, or their revenge.
+Methinks I feel new strength within me rise,
+Wings growing, and dominion given me large
+Beyond this deep; whatever draws me on,
+Or sympathy, or some connatural force,
+Powerful at greatest distance to unite,
+With secret amity, things of like kind,
+By secretest conveyance. Thou, my shade
+Inseparable, must with me along;
+For Death from Sin no power can separate.
+But, lest the difficulty of passing back
+Stay his return perhaps over this gulf
+Impassable, impervious; let us try
+Adventurous work, yet to thy power and mine
+Not unagreeable, to found a path
+Over this main from Hell to that new world,
+Where Satan now prevails; a monument
+Of merit high to all the infernal host,
+Easing their passage hence, for intercourse,
+Or transmigration, as their lot shall lead.
+Nor can I miss the way, so strongly drawn
+By this new-felt attraction and instinct.
+Whom thus the meager Shadow answered soon.
+Go, whither Fate, and inclination strong,
+Leads thee; I shall not lag behind, nor err
+The way, thou leading; such a scent I draw
+Of carnage, prey innumerable, and taste
+The savour of death from all things there that live:
+Nor shall I to the work thou enterprisest
+Be wanting, but afford thee equal aid.
+So saying, with delight he snuffed the smell
+Of mortal change on earth. As when a flock
+Of ravenous fowl, though many a league remote,
+Against the day of battle, to a field,
+Where armies lie encamped, come flying, lured
+With scent of living carcasses designed
+For death, the following day, in bloody fight:
+So scented the grim Feature, and upturned
+His nostril wide into the murky air;
+Sagacious of his quarry from so far.
+Then both from out Hell-gates, into the waste
+Wide anarchy of Chaos, damp and dark,
+Flew diverse; and with power (their power was great)
+Hovering upon the waters, what they met
+Solid or slimy, as in raging sea
+Tost up and down, together crouded drove,
+From each side shoaling towards the mouth of Hell;
+As when two polar winds, blowing adverse
+Upon the Cronian sea, together drive
+Mountains of ice, that stop the imagined way
+Beyond Petsora eastward, to the rich
+Cathaian coast. The aggregated soil
+Death with his mace petrifick, cold and dry,
+As with a trident, smote; and fixed as firm
+As Delos, floating once; the rest his look
+Bound with Gorgonian rigour not to move;
+And with Asphaltick slime, broad as the gate,
+Deep to the roots of Hell the gathered beach
+They fastened, and the mole immense wrought on
+Over the foaming deep high-arched, a bridge
+Of length prodigious, joining to the wall
+Immoveable of this now fenceless world,
+Forfeit to Death; from hence a passage broad,
+Smooth, easy, inoffensive, down to Hell.
+So, if great things to small may be compared,
+Xerxes, the liberty of Greece to yoke,
+From Susa, his Memnonian palace high,
+Came to the sea: and, over Hellespont
+Bridging his way, Europe with Asia joined,
+And scourged with many a stroke the indignant waves.
+Now had they brought the work by wonderous art
+Pontifical, a ridge of pendant rock,
+Over the vexed abyss, following the track
+Of Satan to the self-same place where he
+First lighted from his wing, and landed safe
+From out of Chaos, to the outside bare
+Of this round world: With pins of adamant
+And chains they made all fast, too fast they made
+And durable! And now in little space
+The confines met of empyrean Heaven,
+And of this World; and, on the left hand, Hell
+With long reach interposed; three several ways
+In sight, to each of these three places led.
+And now their way to Earth they had descried,
+To Paradise first tending; when, behold!
+Satan, in likeness of an Angel bright,
+Betwixt the Centaur and the Scorpion steering
+His zenith, while the sun in Aries rose:
+Disguised he came; but those his children dear
+Their parent soon discerned, though in disguise.
+He, after Eve seduced, unminded slunk
+Into the wood fast by; and, changing shape,
+To observe the sequel, saw his guileful act
+By Eve, though all unweeting, seconded
+Upon her husband; saw their shame that sought
+Vain covertures; but when he saw descend
+The Son of God to judge them, terrified
+He fled; not hoping to escape, but shun
+The present; fearing, guilty, what his wrath
+Might suddenly inflict; that past, returned
+By night, and listening where the hapless pair
+Sat in their sad discourse, and various plaint,
+Thence gathered his own doom; which understood
+Not instant, but of future time, with joy
+And tidings fraught, to Hell he now returned;
+And at the brink of Chaos, near the foot
+Of this new wonderous pontifice, unhoped
+Met, who to meet him came, his offspring dear.
+Great joy was at their meeting, and at sight
+Of that stupendious bridge his joy encreased.
+Long he admiring stood, till Sin, his fair
+Enchanting daughter, thus the silence broke.
+O Parent, these are thy magnifick deeds,
+Thy trophies! which thou viewest as not thine own;
+Thou art their author, and prime architect:
+For I no sooner in my heart divined,
+My heart, which by a secret harmony
+Still moves with thine, joined in connexion sweet,
+That thou on earth hadst prospered, which thy looks
+Now also evidence, but straight I felt,
+Though distant from thee worlds between, yet felt,
+That I must after thee, with this thy son;
+Such fatal consequence unites us three!
+Hell could no longer hold us in our bounds,
+Nor this unvoyageable gulf obscure
+Detain from following thy illustrious track.
+Thou hast achieved our liberty, confined
+Within Hell-gates till now; thou us impowered
+To fortify thus far, and overlay,
+With this portentous bridge, the dark abyss.
+Thine now is all this world; thy virtue hath won
+What thy hands builded not; thy wisdom gained
+With odds what war hath lost, and fully avenged
+Our foil in Heaven; here thou shalt monarch reign,
+There didst not; there let him still victor sway,
+As battle hath adjudged; from this new world
+Retiring, by his own doom alienated;
+And henceforth monarchy with thee divide
+Of all things, parted by the empyreal bounds,
+His quadrature, from thy orbicular world;
+Or try thee now more dangerous to his throne.
+Whom thus the Prince of darkness answered glad.
+Fair Daughter, and thou Son and Grandchild both;
+High proof ye now have given to be the race
+Of Satan (for I glory in the name,
+Antagonist of Heaven's Almighty King,)
+Amply have merited of me, of all
+The infernal empire, that so near Heaven's door
+Triumphal with triumphal act have met,
+Mine, with this glorious work; and made one realm,
+Hell and this world, one realm, one continent
+Of easy thorough-fare. Therefore, while I
+Descend through darkness, on your road with ease,
+To my associate Powers, them to acquaint
+With these successes, and with them rejoice;
+You two this way, among these numerous orbs,
+All yours, right down to Paradise descend;
+There dwell, and reign in bliss; thence on the earth
+Dominion exercise and in the air,
+Chiefly on Man, sole lord of all declared;
+Him first make sure your thrall, and lastly kill.
+My substitutes I send ye, and create
+Plenipotent on earth, of matchless might
+Issuing from me: on your joint vigour now
+My hold of this new kingdom all depends,
+Through Sin to Death exposed by my exploit.
+If your joint power prevail, the affairs of Hell
+No detriment need fear; go, and be strong!
+So saying he dismissed them; they with speed
+Their course through thickest constellations held,
+Spreading their bane; the blasted stars looked wan,
+And planets, planet-struck, real eclipse
+Then suffered. The other way Satan went down
+The causey to Hell-gate: On either side
+Disparted Chaos overbuilt exclaimed,
+And with rebounding surge the bars assailed,
+That scorned his indignation: Through the gate,
+Wide open and unguarded, Satan passed,
+And all about found desolate; for those,
+Appointed to sit there, had left their charge,
+Flown to the upper world; the rest were all
+Far to the inland retired, about the walls
+Of Pandemonium; city and proud seat
+Of Lucifer, so by allusion called
+Of that bright star to Satan paragoned;
+There kept their watch the legions, while the Grand
+In council sat, solicitous what chance
+Might intercept their emperour sent; so he
+Departing gave command, and they observed.
+As when the Tartar from his Russian foe,
+By Astracan, over the snowy plains,
+Retires; or Bactrin Sophi, from the horns
+Of Turkish crescent, leaves all waste beyond
+The realm of Aladule, in his retreat
+To Tauris or Casbeen: So these, the late
+Heaven-banished host, left desart utmost Hell
+Many a dark league, reduced in careful watch
+Round their metropolis; and now expecting
+Each hour their great adventurer, from the search
+Of foreign worlds: He through the midst unmarked,
+In show plebeian Angel militant
+Of lowest order, passed; and from the door
+Of that Plutonian hall, invisible
+Ascended his high throne; which, under state
+Of richest texture spread, at the upper end
+Was placed in regal lustre. Down a while
+He sat, and round about him saw unseen:
+At last, as from a cloud, his fulgent head
+And shape star-bright appeared, or brighter; clad
+With what permissive glory since his fall
+Was left him, or false glitter: All amazed
+At that so sudden blaze the Stygian throng
+Bent their aspect, and whom they wished beheld,
+Their mighty Chief returned: loud was the acclaim:
+Forth rushed in haste the great consulting peers,
+Raised from their dark Divan, and with like joy
+Congratulant approached him; who with hand
+Silence, and with these words attention, won.
+Thrones, Dominations, Princedoms, Virtues, Powers;
+For in possession such, not only of right,
+I call ye, and declare ye now; returned
+Successful beyond hope, to lead ye forth
+Triumphant out of this infernal pit
+Abominable, accursed, the house of woe,
+And dungeon of our tyrant: Now possess,
+As Lords, a spacious world, to our native Heaven
+Little inferiour, by my adventure hard
+With peril great achieved. Long were to tell
+What I have done; what suffered;with what pain
+Voyaged th' unreal, vast, unbounded deep
+Of horrible confusion; over which
+By Sin and Death a broad way now is paved,
+To expedite your glorious march; but I
+Toiled out my uncouth passage, forced to ride
+The untractable abyss, plunged in the womb
+Of unoriginal Night and Chaos wild;
+That, jealous of their secrets, fiercely opposed
+My journey strange, with clamorous uproar
+Protesting Fate supreme; thence how I found
+The new created world, which fame in Heaven
+Long had foretold, a fabrick wonderful
+Of absolute perfection! therein Man
+Placed in a Paradise, by our exile
+Made happy: Him by fraud I have seduced
+From his Creator; and, the more to encrease
+Your wonder, with an apple; he, thereat
+Offended, worth your laughter! hath given up
+Both his beloved Man, and all his world,
+To Sin and Death a prey, and so to us,
+Without our hazard, labour, or alarm;
+To range in, and to dwell, and over Man
+To rule, as over all he should have ruled.
+True is, me also he hath judged, or rather
+Me not, but the brute serpent in whose shape
+Man I deceived: that which to me belongs,
+Is enmity which he will put between
+Me and mankind; I am to bruise his heel;
+His seed, when is not set, shall bruise my head:
+A world who would not purchase with a bruise,
+Or much more grievous pain?--Ye have the account
+Of my performance: What remains, ye Gods,
+But up, and enter now into full bliss?
+So having said, a while he stood, expecting
+Their universal shout, and high applause,
+To fill his ear; when, contrary, he hears
+On all sides, from innumerable tongues,
+A dismal universal hiss, the sound
+Of publick scorn; he wondered, but not long
+Had leisure, wondering at himself now more,
+His visage drawn he felt to sharp and spare;
+His arms clung to his ribs; his legs entwining
+Each other, till supplanted down he fell
+A monstrous serpent on his belly prone,
+Reluctant, but in vain; a greater power
+Now ruled him, punished in the shape he sinned,
+According to his doom: he would have spoke,
+But hiss for hiss returned with forked tongue
+To forked tongue; for now were all transformed
+Alike, to serpents all, as accessories
+To his bold riot: Dreadful was the din
+Of hissing through the hall, thick swarming now
+With complicated monsters head and tail,
+Scorpion, and Asp, and Amphisbaena dire,
+Cerastes horned, Hydrus, and Elops drear,
+And Dipsas; (not so thick swarmed once the soil
+Bedropt with blood of Gorgon, or the isle
+Ophiusa,) but still greatest he the midst,
+Now Dragon grown, larger than whom the sun
+Ingendered in the Pythian vale or slime,
+Huge Python, and his power no less he seemed
+Above the rest still to retain; they all
+Him followed, issuing forth to the open field,
+Where all yet left of that revolted rout,
+Heaven-fallen, in station stood or just array;
+Sublime with expectation when to see
+In triumph issuing forth their glorious Chief;
+They saw, but other sight instead! a croud
+Of ugly serpents; horrour on them fell,
+And horrid sympathy; for, what they saw,
+They felt themselves, now changing; down their arms,
+Down fell both spear and shield; down they as fast;
+And the dire hiss renewed, and the dire form
+Catched, by contagion; like in punishment,
+As in their crime. Thus was the applause they meant,
+Turned to exploding hiss, triumph to shame
+Cast on themselves from their own mouths. There stood
+A grove hard by, sprung up with this their change,
+His will who reigns above, to aggravate
+Their penance, laden with fair fruit, like that
+Which grew in Paradise, the bait of Eve
+Used by the Tempter: on that prospect strange
+Their earnest eyes they fixed, imagining
+For one forbidden tree a multitude
+Now risen, to work them further woe or shame;
+Yet, parched with scalding thirst and hunger fierce,
+Though to delude them sent, could not abstain;
+But on they rolled in heaps, and, up the trees
+Climbing, sat thicker than the snaky locks
+That curled Megaera: greedily they plucked
+The fruitage fair to sight, like that which grew
+Near that bituminous lake where Sodom flamed;
+This more delusive, not the touch, but taste
+Deceived; they, fondly thinking to allay
+Their appetite with gust, instead of fruit
+Chewed bitter ashes, which the offended taste
+With spattering noise rejected: oft they assayed,
+Hunger and thirst constraining; drugged as oft,
+With hatefullest disrelish writhed their jaws,
+With soot and cinders filled; so oft they fell
+Into the same illusion, not as Man
+Whom they triumphed once lapsed. Thus were they plagued
+And worn with famine, long and ceaseless hiss,
+Till their lost shape, permitted, they resumed;
+Yearly enjoined, some say, to undergo,
+This annual humbling certain numbered days,
+To dash their pride, and joy, for Man seduced.
+However, some tradition they dispersed
+Among the Heathen, of their purchase got,
+And fabled how the Serpent, whom they called
+Ophion, with Eurynome, the wide--
+Encroaching Eve perhaps, had first the rule
+Of high Olympus; thence by Saturn driven
+And Ops, ere yet Dictaean Jove was born.
+Mean while in Paradise the hellish pair
+Too soon arrived; Sin, there in power before,
+Once actual; now in body, and to dwell
+Habitual habitant; behind her Death,
+Close following pace for pace, not mounted yet
+On his pale horse: to whom Sin thus began.
+Second of Satan sprung, all-conquering Death!
+What thinkest thou of our empire now, though earned
+With travel difficult, not better far
+Than still at Hell's dark threshold to have sat watch,
+Unnamed, undreaded, and thyself half starved?
+Whom thus the Sin-born monster answered soon.
+To me, who with eternal famine pine,
+Alike is Hell, or Paradise, or Heaven;
+There best, where most with ravine I may meet;
+Which here, though plenteous, all too little seems
+To stuff this maw, this vast unhide-bound corps.
+To whom the incestuous mother thus replied.
+Thou therefore on these herbs, and fruits, and flowers,
+Feed first; on each beast next, and fish, and fowl;
+No homely morsels! and, whatever thing
+The sithe of Time mows down, devour unspared;
+Till I, in Man residing, through the race,
+His thoughts, his looks, words, actions, all infect;
+And season him thy last and sweetest prey.
+This said, they both betook them several ways,
+Both to destroy, or unimmortal make
+All kinds, and for destruction to mature
+Sooner or later; which the Almighty seeing,
+From his transcendent seat the Saints among,
+To those bright Orders uttered thus his voice.
+See, with what heat these dogs of Hell advance
+To waste and havock yonder world, which I
+So fair and good created; and had still
+Kept in that state, had not the folly of Man
+Let in these wasteful furies, who impute
+Folly to me; so doth the Prince of Hell
+And his adherents, that with so much ease
+I suffer them to enter and possess
+A place so heavenly; and, conniving, seem
+To gratify my scornful enemies,
+That laugh, as if, transported with some fit
+Of passion, I to them had quitted all,
+At random yielded up to their misrule;
+And know not that I called, and drew them thither,
+My Hell-hounds, to lick up the draff and filth
+Which Man's polluting sin with taint hath shed
+On what was pure; til, crammed and gorged, nigh burst
+With sucked and glutted offal, at one sling
+Of thy victorious arm, well-pleasing Son,
+Both Sin, and Death, and yawning Grave, at last,
+Through Chaos hurled, obstruct the mouth of Hell
+For ever, and seal up his ravenous jaws.
+Then Heaven and Earth renewed shall be made pure
+To sanctity, that shall receive no stain:
+Till then, the curse pronounced on both precedes.
+He ended, and the heavenly audience loud
+Sung Halleluiah, as the sound of seas,
+Through multitude that sung: Just are thy ways,
+Righteous are thy decrees on all thy works;
+Who can extenuate thee? Next, to the Son,
+Destined Restorer of mankind, by whom
+New Heaven and Earth shall to the ages rise,
+Or down from Heaven descend.--Such was their song;
+While the Creator, calling forth by name
+His mighty Angels, gave them several charge,
+As sorted best with present things. The sun
+Had first his precept so to move, so shine,
+As might affect the earth with cold and heat
+Scarce tolerable; and from the north to call
+Decrepit winter; from the south to bring
+Solstitial summer's heat. To the blanc moon
+Her office they prescribed; to the other five
+Their planetary motions, and aspects,
+In sextile, square, and trine, and opposite,
+Of noxious efficacy, and when to join
+In synod unbenign; and taught the fixed
+Their influence malignant when to shower,
+Which of them rising with the sun, or falling,
+Should prove tempestuous: To the winds they set
+Their corners, when with bluster to confound
+Sea, air, and shore; the thunder when to roll
+With terrour through the dark aereal hall.
+Some say, he bid his Angels turn ascanse
+The poles of earth, twice ten degrees and more,
+From the sun's axle; they with labour pushed
+Oblique the centrick globe: Some say, the sun
+Was bid turn reins from the equinoctial road
+Like distant breadth to Taurus with the seven
+Atlantick Sisters, and the Spartan Twins,
+Up to the Tropick Crab: thence down amain
+By Leo, and the Virgin, and the Scales,
+As deep as Capricorn; to bring in change
+Of seasons to each clime; else had the spring
+Perpetual smiled on earth with vernant flowers,
+Equal in days and nights, except to those
+Beyond the polar circles; to them day
+Had unbenighted shone, while the low sun,
+To recompense his distance, in their sight
+Had rounded still the horizon, and not known
+Or east or west; which had forbid the snow
+From cold Estotiland, and south as far
+Beneath Magellan. At that tasted fruit
+The sun, as from Thyestean banquet, turned
+His course intended; else, how had the world
+Inhabited, though sinless, more than now,
+Avoided pinching cold and scorching heat?
+These changes in the Heavens, though slow, produced
+Like change on sea and land; sideral blast,
+Vapour, and mist, and exhalation hot,
+Corrupt and pestilent: Now from the north
+Of Norumbega, and the Samoed shore,
+Bursting their brazen dungeon, armed with ice,
+And snow, and hail, and stormy gust and flaw,
+Boreas, and Caecias, and Argestes loud,
+And Thrascias, rend the woods, and seas upturn;
+With adverse blast upturns them from the south
+Notus, and Afer black with thunderous clouds
+From Serraliona; thwart of these, as fierce,
+Forth rush the Levant and the Ponent winds,
+Eurus and Zephyr, with their lateral noise,
+Sirocco and Libecchio. Thus began
+Outrage from lifeless things; but Discord first,
+Daughter of Sin, among the irrational
+Death introduced, through fierce antipathy:
+Beast now with beast 'gan war, and fowl with fowl,
+And fish with fish; to graze the herb all leaving,
+Devoured each other; nor stood much in awe
+Of Man, but fled him; or, with countenance grim,
+Glared on him passing. These were from without
+The growing miseries, which Adam saw
+Already in part, though hid in gloomiest shade,
+To sorrow abandoned, but worse felt within;
+And, in a troubled sea of passion tost,
+Thus to disburden sought with sad complaint.
+O miserable of happy! Is this the end
+Of this new glorious world, and me so late
+The glory of that glory, who now become
+Accursed, of blessed? hide me from the face
+Of God, whom to behold was then my highth
+Of happiness!--Yet well, if here would end
+The misery; I deserved it, and would bear
+My own deservings; but this will not serve:
+All that I eat or drink, or shall beget,
+Is propagated curse. O voice, once heard
+Delightfully, Encrease and multiply;
+Now death to hear! for what can I encrease,
+Or multiply, but curses on my head?
+Who of all ages to succeed, but, feeling
+The evil on him brought by me, will curse
+My head? Ill fare our ancestor impure,
+For this we may thank Adam! but his thanks
+Shall be the execration: so, besides
+Mine own that bide upon me, all from me
+Shall with a fierce reflux on me rebound;
+On me, as on their natural center, light
+Heavy, though in their place. O fleeting joys
+Of Paradise, dear bought with lasting woes!
+Did I request thee, Maker, from my clay
+To mould me Man? did I solicit thee
+From darkness to promote me, or here place
+In this delicious garden? As my will
+Concurred not to my being, it were but right
+And equal to reduce me to my dust;
+Desirous to resign and render back
+All I received; unable to perform
+Thy terms too hard, by which I was to hold
+The good I sought not. To the loss of that,
+Sufficient penalty, why hast thou added
+The sense of endless woes? Inexplicable
+Why am I mocked with death, and lengthened out
+To deathless pain? How gladly would I meet
+Mortality my sentence, and be earth
+Insensible! How glad would lay me down
+As in my mother's lap! There I should rest,
+And sleep secure; his dreadful voice no more
+Would thunder in my ears; no fear of worse
+To me, and to my offspring, would torment me
+With cruel expectation. Yet one doubt
+Pursues me still, lest all I cannot die;
+Lest that pure breath of life, the spirit of Man
+Which God inspired, cannot together perish
+With this corporeal clod; then, in the grave,
+Or in some other dismal place, who knows
+But I shall die a living death? O thought
+Horrid, if true! Yet why? It was but breath
+Of life that sinned; what dies but what had life
+And sin? The body properly had neither,
+All of me then shall die: let this appease
+The doubt, since human reach no further knows.
+For though the Lord of all be infinite,
+Is his wrath also? Be it, Man is not so,
+But mortal doomed. How can he exercise
+Wrath without end on Man, whom death must end?
+Can he make deathless death? That were to make
+Strange contradiction, which to God himself
+Impossible is held; as argument
+Of weakness, not of power. Will he draw out,
+For anger's sake, finite to infinite,
+In punished Man, to satisfy his rigour,
+Satisfied never? That were to extend
+His sentence beyond dust and Nature's law;
+By which all causes else, according still
+To the reception of their matter, act;
+Not to the extent of their own sphere. But say
+That death be not one stroke, as I supposed,
+Bereaving sense, but endless misery
+From this day onward; which I feel begun
+Both in me, and without me; and so last
+To perpetuity;--Ay me!that fear
+Comes thundering back with dreadful revolution
+On my defenceless head; both Death and I
+Am found eternal, and incorporate both;
+Nor I on my part single; in me all
+Posterity stands cursed: Fair patrimony
+That I must leave ye, Sons! O, were I able
+To waste it all myself, and leave ye none!
+So disinherited, how would you bless
+Me, now your curse! Ah, why should all mankind,
+For one man's fault, thus guiltless be condemned,
+It guiltless? But from me what can proceed,
+But all corrupt; both mind and will depraved
+Not to do only, but to will the same
+With me? How can they then acquitted stand
+In sight of God? Him, after all disputes,
+Forced I absolve: all my evasions vain,
+And reasonings, though through mazes, lead me still
+But to my own conviction: first and last
+On me, me only, as the source and spring
+Of all corruption, all the blame lights due;
+So might the wrath! Fond wish!couldst thou support
+That burden, heavier than the earth to bear;
+Than all the world much heavier, though divided
+With that bad Woman? Thus, what thou desirest,
+And what thou fearest, alike destroys all hope
+Of refuge, and concludes thee miserable
+Beyond all past example and future;
+To Satan only like both crime and doom.
+O Conscience! into what abyss of fears
+And horrours hast thou driven me; out of which
+I find no way, from deep to deeper plunged!
+Thus Adam to himself lamented loud,
+Through the still night; not now, as ere Man fell,
+Wholesome, and cool, and mild, but with black air
+Accompanied; with damps, and dreadful gloom;
+Which to his evil conscience represented
+All things with double terrour: On the ground
+Outstretched he lay, on the cold ground; and oft
+Cursed his creation; Death as oft accused
+Of tardy execution, since denounced
+The day of his offence. Why comes not Death,
+Said he, with one thrice-acceptable stroke
+To end me? Shall Truth fail to keep her word,
+Justice Divine not hasten to be just?
+But Death comes not at call; Justice Divine
+Mends not her slowest pace for prayers or cries,
+O woods, O fountains, hillocks, dales, and bowers!
+With other echo late I taught your shades
+To answer, and resound far other song.--
+Whom thus afflicted when sad Eve beheld,
+Desolate where she sat, approaching nigh,
+Soft words to his fierce passion she assayed:
+But her with stern regard he thus repelled.
+Out of my sight, thou Serpent! That name best
+Befits thee with him leagued, thyself as false
+And hateful; nothing wants, but that thy shape,
+Like his, and colour serpentine, may show
+Thy inward fraud; to warn all creatures from thee
+Henceforth; lest that too heavenly form, pretended
+To hellish falshood, snare them! But for thee
+I had persisted happy; had not thy pride
+And wandering vanity, when least was safe,
+Rejected my forewarning, and disdained
+Not to be trusted; longing to be seen,
+Though by the Devil himself; him overweening
+To over-reach; but, with the serpent meeting,
+Fooled and beguiled; by him thou, I by thee
+To trust thee from my side; imagined wise,
+Constant, mature, proof against all assaults;
+And understood not all was but a show,
+Rather than solid virtue; all but a rib
+Crooked by nature, bent, as now appears,
+More to the part sinister, from me drawn;
+Well if thrown out, as supernumerary
+To my just number found. O! why did God,
+Creator wise, that peopled highest Heaven
+With Spirits masculine, create at last
+This novelty on earth, this fair defect
+Of nature, and not fill the world at once
+With Men, as Angels, without feminine;
+Or find some other way to generate
+Mankind? This mischief had not been befallen,
+And more that shall befall; innumerable
+Disturbances on earth through female snares,
+And strait conjunction with this sex: for either
+He never shall find out fit mate, but such
+As some misfortune brings him, or mistake;
+Or whom he wishes most shall seldom gain
+Through her perverseness, but shall see her gained
+By a far worse; or, if she love, withheld
+By parents; or his happiest choice too late
+Shall meet, already linked and wedlock-bound
+To a fell adversary, his hate or shame:
+Which infinite calamity shall cause
+To human life, and houshold peace confound.
+He added not, and from her turned; but Eve,
+Not so repulsed, with tears that ceased not flowing
+And tresses all disordered, at his feet
+Fell humble; and, embracing them, besought
+His peace, and thus proceeded in her plaint.
+Forsake me not thus, Adam! witness Heaven
+What love sincere, and reverence in my heart
+I bear thee, and unweeting have offended,
+Unhappily deceived! Thy suppliant
+I beg, and clasp thy knees; bereave me not,
+Whereon I live, thy gentle looks, thy aid,
+Thy counsel, in this uttermost distress,
+My only strength and stay: Forlorn of thee,
+Whither shall I betake me, where subsist?
+While yet we live, scarce one short hour perhaps,
+Between us two let there be peace; both joining,
+As joined in injuries, one enmity
+Against a foe by doom express assigned us,
+That cruel Serpent: On me exercise not
+Thy hatred for this misery befallen;
+On me already lost, me than thyself
+More miserable! Both have sinned;but thou
+Against God only; I against God and thee;
+And to the place of judgement will return,
+There with my cries importune Heaven; that all
+The sentence, from thy head removed, may light
+On me, sole cause to thee of all this woe;
+Me, me only, just object of his ire!
+She ended weeping; and her lowly plight,
+Immoveable, till peace obtained from fault
+Acknowledged and deplored, in Adam wrought
+Commiseration: Soon his heart relented
+Towards her, his life so late, and sole delight,
+Now at his feet submissive in distress;
+Creature so fair his reconcilement seeking,
+His counsel, whom she had displeased, his aid:
+As one disarmed, his anger all he lost,
+And thus with peaceful words upraised her soon.
+Unwary, and too desirous, as before,
+So now of what thou knowest not, who desirest
+The punishment all on thyself; alas!
+Bear thine own first, ill able to sustain
+His full wrath, whose thou feelest as yet least part,
+And my displeasure bearest so ill. If prayers
+Could alter high decrees, I to that place
+Would speed before thee, and be louder heard,
+That on my head all might be visited;
+Thy frailty and infirmer sex forgiven,
+To me committed, and by me exposed.
+But rise;--let us no more contend, nor blame
+Each other, blamed enough elsewhere; but strive
+In offices of love, how we may lighten
+Each other's burden, in our share of woe;
+Since this day's death denounced, if aught I see,
+Will prove no sudden, but a slow-paced evil;
+A long day's dying, to augment our pain;
+And to our seed (O hapless seed!) derived.
+To whom thus Eve, recovering heart, replied.
+Adam, by sad experiment I know
+How little weight my words with thee can find,
+Found so erroneous; thence by just event
+Found so unfortunate: Nevertheless,
+Restored by thee, vile as I am, to place
+Of new acceptance, hopeful to regain
+Thy love, the sole contentment of my heart
+Living or dying, from thee I will not hide
+What thoughts in my unquiet breast are risen,
+Tending to some relief of our extremes,
+Or end; though sharp and sad, yet tolerable,
+As in our evils, and of easier choice.
+If care of our descent perplex us most,
+Which must be born to certain woe, devoured
+By Death at last; and miserable it is
+To be to others cause of misery,
+Our own begotten, and of our loins to bring
+Into this cursed world a woeful race,
+That after wretched life must be at last
+Food for so foul a monster; in thy power
+It lies, yet ere conception to prevent
+The race unblest, to being yet unbegot.
+Childless thou art, childless remain: so Death
+Shall be deceived his glut, and with us two
+Be forced to satisfy his ravenous maw.
+But if thou judge it hard and difficult,
+Conversing, looking, loving, to abstain
+From love's due rights, nuptial embraces sweet;
+And with desire to languish without hope,
+Before the present object languishing
+With like desire; which would be misery
+And torment less than none of what we dread;
+Then, both ourselves and seed at once to free
+From what we fear for both, let us make short, --
+Let us seek Death; -- or, he not found, supply
+With our own hands his office on ourselves:
+Why stand we longer shivering under fears,
+That show no end but death, and have the power,
+Of many ways to die the shortest choosing,
+Destruction with destruction to destroy? --
+She ended here, or vehement despair
+Broke off the rest: so much of death her thoughts
+Had entertained, as dyed her cheeks with pale.
+But Adam, with such counsel nothing swayed,
+To better hopes his more attentive mind
+Labouring had raised; and thus to Eve replied.
+Eve, thy contempt of life and pleasure seems
+To argue in thee something more sublime
+And excellent, than what thy mind contemns;
+But self-destruction therefore sought, refutes
+That excellence thought in thee; and implies,
+Not thy contempt, but anguish and regret
+For loss of life and pleasure overloved.
+Or if thou covet death, as utmost end
+Of misery, so thinking to evade
+The penalty pronounced; doubt not but God
+Hath wiselier armed his vengeful ire, than so
+To be forestalled; much more I fear lest death,
+So snatched, will not exempt us from the pain
+We are by doom to pay; rather, such acts
+Of contumacy will provoke the Highest
+To make death in us live: Then let us seek
+Some safer resolution, which methinks
+I have in view, calling to mind with heed
+Part of our sentence, that thy seed shall bruise
+The Serpent's head; piteous amends! unless
+Be meant, whom I conjecture, our grand foe,
+Satan; who, in the serpent, hath contrived
+Against us this deceit: To crush his head
+Would be revenge indeed! which will be lost
+By death brought on ourselves, or childless days
+Resolved, as thou proposest; so our foe
+Shal 'scape his punishment ordained, and we
+Instead shall double ours upon our heads.
+No more be mentioned then of violence
+Against ourselves; and wilful barrenness,
+That cuts us off from hope; and savours only
+Rancour and pride, impatience and despite,
+Reluctance against God and his just yoke
+Laid on our necks. Remember with what mild
+And gracious temper he both heard, and judged,
+Without wrath or reviling; we expected
+Immediate dissolution, which we thought
+Was meant by death that day; when lo!to thee
+Pains only in child-bearing were foretold,
+And bringing forth; soon recompensed with joy,
+Fruit of thy womb: On me the curse aslope
+Glanced on the ground; with labour I must earn
+My bread; what harm? Idleness had been worse;
+My labour will sustain me; and, lest cold
+Or heat should injure us, his timely care
+Hath, unbesought, provided; and his hands
+Clothed us unworthy, pitying while he judged;
+How much more, if we pray him, will his ear
+Be open, and his heart to pity incline,
+And teach us further by what means to shun
+The inclement seasons, rain, ice, hail, and snow!
+Which now the sky, with various face, begins
+To show us in this mountain; while the winds
+Blow moist and keen, shattering the graceful locks
+Of these fair spreading trees; which bids us seek
+Some better shroud, some better warmth to cherish
+Our limbs benummed, ere this diurnal star
+Leave cold the night, how we his gathered beams
+Reflected may with matter sere foment;
+Or, by collision of two bodies, grind
+The air attrite to fire; as late the clouds
+Justling, or pushed with winds, rude in their shock,
+Tine the slant lightning; whose thwart flame, driven down
+Kindles the gummy bark of fir or pine;
+And sends a comfortable heat from far,
+Which might supply the sun: Such fire to use,
+And what may else be remedy or cure
+To evils which our own misdeeds have wrought,
+He will instruct us praying, and of grace
+Beseeching him; so as we need not fear
+To pass commodiously this life, sustained
+By him with many comforts, till we end
+In dust, our final rest and native home.
+What better can we do, than, to the place
+Repairing where he judged us, prostrate fall
+Before him reverent; and there confess
+Humbly our faults, and pardon beg; with tears
+Watering the ground, and with our sighs the air
+Frequenting, sent from hearts contrite, in sign
+Of sorrow unfeigned, and humiliation meek
+
+
+
+Book XI
+
+
+Undoubtedly he will relent, and turn
+From his displeasure; in whose look serene,
+When angry most he seemed and most severe,
+What else but favour, grace, and mercy, shone?
+So spake our father penitent; nor Eve
+Felt less remorse: they, forthwith to the place
+Repairing where he judged them, prostrate fell
+Before him reverent; and both confessed
+Humbly their faults, and pardon begged; with tears
+Watering the ground, and with their sighs the air
+Frequenting, sent from hearts contrite, in sign
+Of sorrow unfeigned, and humiliation meek.
+Thus they, in lowliest plight, repentant stood
+Praying; for from the mercy-seat above
+Prevenient grace descending had removed
+The stony from their hearts, and made new flesh
+Regenerate grow instead; that sighs now breathed
+Unutterable; which the Spirit of prayer
+Inspired, and winged for Heaven with speedier flight
+Than loudest oratory: Yet their port
+Not of mean suitors; nor important less
+Seemed their petition, than when the ancient pair
+In fables old, less ancient yet than these,
+Deucalion and chaste Pyrrha, to restore
+The race of mankind drowned, before the shrine
+Of Themis stood devout. To Heaven their prayers
+Flew up, nor missed the way, by envious winds
+Blown vagabond or frustrate: in they passed
+Dimensionless through heavenly doors; then clad
+With incense, where the golden altar fumed,
+By their great intercessour, came in sight
+Before the Father's throne: them the glad Son
+Presenting, thus to intercede began.
+See$ Father, what first-fruits on earth are sprung
+From thy implanted grace in Man; these sighs
+And prayers, which in this golden censer mixed
+With incense, I thy priest before thee bring;
+Fruits of more pleasing savour, from thy seed
+Sown with contrition in his heart, than those
+Which, his own hand manuring, all the trees
+Of Paradise could have produced, ere fallen
+From innocence. Now therefore, bend thine ear
+To supplication; hear his sighs, though mute;
+Unskilful with what words to pray, let me
+Interpret for him; me, his advocate
+And propitiation; all his works on me,
+Good, or not good, ingraft; my merit those
+Shall perfect, and for these my death shall pay.
+Accept me; and, in me, from these receive
+The smell of peace toward mankind: let him live
+Before thee reconciled, at least his days
+Numbered, though sad; till death, his doom, (which I
+To mitigate thus plead, not to reverse,)
+To better life shall yield him: where with me
+All my redeemed may dwell in joy and bliss;
+Made one with me, as I with thee am one.
+To whom the Father, without cloud, serene.
+All thy request for Man, accepted Son,
+Obtain; all thy request was my decree:
+But, longer in that Paradise to dwell,
+The law I gave to Nature him forbids:
+Those pure immortal elements, that know,
+No gross, no unharmonious mixture foul,
+Eject him, tainted now; and purge him off,
+As a distemper, gross, to air as gross,
+And mortal food; as may dispose him best
+For dissolution wrought by sin, that first
+Distempered all things, and of incorrupt
+Corrupted. I, at first, with two fair gifts
+Created him endowed; with happiness,
+And immortality: that fondly lost,
+This other served but to eternize woe;
+Till I provided death: so death becomes
+His final remedy; and, after life,
+Tried in sharp tribulation, and refined
+By faith and faithful works, to second life,
+Waked in the renovation of the just,
+Resigns him up with Heaven and Earth renewed.
+But let us call to synod all the Blest,
+Through Heaven's wide bounds: from them I will not hide
+My judgements; how with mankind I proceed,
+As how with peccant Angels late they saw,
+And in their state, though firm, stood more confirmed.
+He ended, and the Son gave signal high
+To the bright minister that watched; he blew
+His trumpet, heard in Oreb since perhaps
+When God descended, and perhaps once more
+To sound at general doom. The angelick blast
+Filled all the regions: from their blisful bowers
+Of amarantine shade, fountain or spring,
+By the waters of life, where'er they sat
+In fellowships of joy, the sons of light
+Hasted, resorting to the summons high;
+And took their seats; till from his throne supreme
+The Almighty thus pronounced his sovran will.
+O Sons, like one of us Man is become
+To know both good and evil, since his taste
+Of that defended fruit; but let him boast
+His knowledge of good lost, and evil got;
+Happier! had it sufficed him to have known
+Good by itself, and evil not at all.
+He sorrows now, repents, and prays contrite,
+My motions in him; longer than they move,
+His heart I know, how variable and vain,
+Self-left. Lest therefore his now bolder hand
+Reach also of the tree of life, and eat,
+And live for ever, dream at least to live
+For ever, to remove him I decree,
+And send him from the garden forth to till
+The ground whence he was taken, fitter soil.
+Michael, this my behest have thou in charge;
+Take to thee from among the Cherubim
+Thy choice of flaming warriours, lest the Fiend,
+Or in behalf of Man, or to invade
+Vacant possession, some new trouble raise:
+Haste thee, and from the Paradise of God
+Without remorse drive out the sinful pair;
+From hallowed ground the unholy; and denounce
+To them, and to their progeny, from thence
+Perpetual banishment. Yet, lest they faint
+At the sad sentence rigorously urged,
+(For I behold them softened, and with tears
+Bewailing their excess,) all terrour hide.
+If patiently thy bidding they obey,
+Dismiss them not disconsolate; reveal
+To Adam what shall come in future days,
+As I shall thee enlighten; intermix
+My covenant in the Woman's seed renewed;
+So send them forth, though sorrowing, yet in peace:
+And on the east side of the garden place,
+Where entrance up from Eden easiest climbs,
+Cherubick watch; and of a sword the flame
+Wide-waving; all approach far off to fright,
+And guard all passage to the tree of life:
+Lest Paradise a receptacle prove
+To Spirits foul, and all my trees their prey;
+With whose stolen fruit Man once more to delude.
+He ceased; and the arch-angelick Power prepared
+For swift descent; with him the cohort bright
+Of watchful Cherubim: four faces each
+Had, like a double Janus; all their shape
+Spangled with eyes more numerous than those
+Of Argus, and more wakeful than to drouse,
+Charmed with Arcadian pipe, the pastoral reed
+Of Hermes, or his opiate rod. Mean while,
+To re-salute the world with sacred light,
+Leucothea waked; and with fresh dews imbalmed
+The earth; when Adam and first matron Eve
+Had ended now their orisons, and found
+Strength added from above; new hope to spring
+Out of despair; joy, but with fear yet linked;
+Which thus to Eve his welcome words renewed.
+Eve, easily my faith admit, that all
+The good which we enjoy from Heaven descends;
+But, that from us aught should ascend to Heaven
+So prevalent as to concern the mind
+Of God high-blest, or to incline his will,
+Hard to belief may seem; yet this will prayer
+Or one short sigh of human breath, upborne
+Even to the seat of God. For since I sought
+By prayer the offended Deity to appease;
+Kneeled, and before him humbled all my heart;
+Methought I saw him placable and mild,
+Bending his ear; persuasion in me grew
+That I was heard with favour; peace returned
+Home to my breast, and to my memory
+His promise, that thy seed shall bruise our foe;
+Which, then not minded in dismay, yet now
+Assures me that the bitterness of death
+Is past, and we shall live. Whence hail to thee,
+Eve rightly called, mother of all mankind,
+Mother of all things living, since by thee
+Man is to live; and all things live for Man.
+To whom thus Eve with sad demeanour meek.
+Ill-worthy I such title should belong
+To me transgressour; who, for thee ordained
+A help, became thy snare; to me reproach
+Rather belongs, distrust, and all dispraise:
+But infinite in pardon was my Judge,
+That I, who first brought death on all, am graced
+The source of life; next favourable thou,
+Who highly thus to entitle me vouchsaf'st,
+Far other name deserving. But the field
+To labour calls us, now with sweat imposed,
+Though after sleepless night; for see!the morn,
+All unconcerned with our unrest, begins
+Her rosy progress smiling: let us forth;
+I never from thy side henceforth to stray,
+Where'er our day's work lies, though now enjoined
+Laborious, till day droop; while here we dwell,
+What can be toilsome in these pleasant walks?
+Here let us live, though in fallen state, content.
+So spake, so wished much humbled Eve; but Fate
+Subscribed not: Nature first gave signs, impressed
+On bird, beast, air; air suddenly eclipsed,
+After short blush of morn; nigh in her sight
+The bird of Jove, stooped from his aery tour,
+Two birds of gayest plume before him drove;
+Down from a hill the beast that reigns in woods,
+First hunter then, pursued a gentle brace,
+Goodliest of all the forest, hart and hind;
+Direct to the eastern gate was bent their flight.
+Adam observed, and with his eye the chase
+Pursuing, not unmoved, to Eve thus spake.
+O Eve, some further change awaits us nigh,
+Which Heaven, by these mute signs in Nature, shows
+Forerunners of his purpose; or to warn
+Us, haply too secure, of our discharge
+From penalty, because from death released
+Some days: how long, and what till then our life,
+Who knows? or more than this, that we are dust,
+And thither must return, and be no more?
+Why else this double object in our sight
+Of flight pursued in the air, and o'er the ground,
+One way the self-same hour? why in the east
+Darkness ere day's mid-course, and morning-light
+More orient in yon western cloud, that draws
+O'er the blue firmament a radiant white,
+And slow descends with something heavenly fraught?
+He erred not; for by this the heavenly bands
+Down from a sky of jasper lighted now
+In Paradise, and on a hill made halt;
+A glorious apparition, had not doubt
+And carnal fear that day dimmed Adam's eye.
+Not that more glorious, when the Angels met
+Jacob in Mahanaim, where he saw
+The field pavilioned with his guardians bright;
+Nor that, which on the flaming mount appeared
+In Dothan, covered with a camp of fire,
+Against the Syrian king, who to surprise
+One man, assassin-like, had levied war,
+War unproclaimed. The princely Hierarch
+In their bright stand there left his Powers, to seise
+Possession of the garden; he alone,
+To find where Adam sheltered, took his way,
+Not unperceived of Adam; who to Eve,
+While the great visitant approached, thus spake.
+Eve$ now expect great tidings, which perhaps
+Of us will soon determine, or impose
+New laws to be observed; for I descry,
+From yonder blazing cloud that veils the hill,
+One of the heavenly host; and, by his gait,
+None of the meanest; some great Potentate
+Or of the Thrones above; such majesty
+Invests him coming! yet not terrible,
+That I should fear; nor sociably mild,
+As Raphael, that I should much confide;
+But solemn and sublime; whom not to offend,
+With reverence I must meet, and thou retire.
+He ended: and the Arch-Angel soon drew nigh,
+Not in his shape celestial, but as man
+Clad to meet man; over his lucid arms
+A military vest of purple flowed,
+Livelier than Meliboean, or the grain
+Of Sarra, worn by kings and heroes old
+In time of truce; Iris had dipt the woof;
+His starry helm unbuckled showed him prime
+In manhood where youth ended; by his side,
+As in a glistering zodiack, hung the sword,
+Satan's dire dread; and in his hand the spear.
+Adam bowed low; he, kingly, from his state
+Inclined not, but his coming thus declared.
+Adam, Heaven's high behest no preface needs:
+Sufficient that thy prayers are heard; and Death,
+Then due by sentence when thou didst transgress,
+Defeated of his seisure many days
+Given thee of grace; wherein thou mayest repent,
+And one bad act with many deeds well done
+Mayest cover: Well may then thy Lord, appeased,
+Redeem thee quite from Death's rapacious claim;
+But longer in this Paradise to dwell
+Permits not: to remove thee I am come,
+And send thee from the garden forth to till
+The ground whence thou wast taken, fitter soil.
+He added not; for Adam at the news
+Heart-struck with chilling gripe of sorrow stood,
+That all his senses bound; Eve, who unseen
+Yet all had heard, with audible lament
+Discovered soon the place of her retire.
+O unexpected stroke, worse than of Death!
+Must I thus leave thee$ Paradise? thus leave
+Thee, native soil! these happy walks and shades,
+Fit haunt of Gods? where I had hope to spend,
+Quiet though sad, the respite of that day
+That must be mortal to us both. O flowers,
+That never will in other climate grow,
+My early visitation, and my last
+ ;t even, which I bred up with tender hand
+From the first opening bud, and gave ye names!
+Who now shall rear ye to the sun, or rank
+Your tribes, and water from the ambrosial fount?
+Thee lastly, nuptial bower! by me adorned
+With what to sight or smell was sweet! from thee
+How shall I part, and whither wander down
+Into a lower world; to this obscure
+And wild? how shall we breathe in other air
+Less pure, accustomed to immortal fruits?
+Whom thus the Angel interrupted mild.
+Lament not, Eve, but patiently resign
+What justly thou hast lost, nor set thy heart,
+Thus over-fond, on that which is not thine:
+Thy going is not lonely; with thee goes
+Thy husband; whom to follow thou art bound;
+Where he abides, think there thy native soil.
+Adam, by this from the cold sudden damp
+Recovering, and his scattered spirits returned,
+To Michael thus his humble words addressed.
+Celestial, whether among the Thrones, or named
+Of them the highest; for such of shape may seem
+Prince above princes! gently hast thou told
+Thy message, which might else in telling wound,
+And in performing end us; what besides
+Of sorrow, and dejection, and despair,
+Our frailty can sustain, thy tidings bring,
+Departure from this happy place, our sweet
+Recess, and only consolation left
+Familiar to our eyes! all places else
+Inhospitable appear, and desolate;
+Nor knowing us, nor known: And, if by prayer
+Incessant I could hope to change the will
+Of Him who all things can, I would not cease
+To weary him with my assiduous cries:
+But prayer against his absolute decree
+No more avails than breath against the wind,
+Blown stifling back on him that breathes it forth:
+Therefore to his great bidding I submit.
+This most afflicts me, that, departing hence,
+As from his face I shall be hid, deprived
+His blessed countenance: Here I could frequent
+With worship place by place where he vouchsafed
+Presence Divine; and to my sons relate,
+'On this mount he appeared; under this tree
+'Stood visible; among these pines his voice
+'I heard; here with him at this fountain talked:
+So many grateful altars I would rear
+Of grassy turf, and pile up every stone
+Of lustre from the brook, in memory,
+Or monument to ages; and theron
+Offer sweet-smelling gums, and fruits, and flowers:
+In yonder nether world where shall I seek
+His bright appearances, or foot-step trace?
+For though I fled him angry, yet recalled
+To life prolonged and promised race, I now
+Gladly behold though but his utmost skirts
+Of glory; and far off his steps adore.
+To whom thus Michael with regard benign.
+Adam, thou knowest Heaven his, and all the Earth;
+Not this rock only; his Omnipresence fills
+Land, sea, and air, and every kind that lives,
+Fomented by his virtual power and warmed:
+All the earth he gave thee to possess and rule,
+No despicable gift; surmise not then
+His presence to these narrow bounds confined
+Of Paradise, or Eden: this had been
+Perhaps thy capital seat, from whence had spread
+All generations; and had hither come
+From all the ends of the earth, to celebrate
+And reverence thee, their great progenitor.
+But this pre-eminence thou hast lost, brought down
+To dwell on even ground now with thy sons:
+Yet doubt not but in valley, and in plain,
+God is, as here; and will be found alike
+Present; and of his presence many a sign
+Still following thee, still compassing thee round
+With goodness and paternal love, his face
+Express, and of his steps the track divine.
+Which that thou mayest believe, and be confirmed
+Ere thou from hence depart; know, I am sent
+To show thee what shall come in future days
+To thee, and to thy offspring: good with bad
+Expect to hear; supernal grace contending
+With sinfulness of men; thereby to learn
+True patience, and to temper joy with fear
+And pious sorrow; equally inured
+By moderation either state to bear,
+Prosperous or adverse: so shalt thou lead
+Safest thy life, and best prepared endure
+Thy mortal passage when it comes.--Ascend
+This hill; let Eve (for I have drenched her eyes)
+Here sleep below; while thou to foresight wakest;
+As once thou sleptst, while she to life was formed.
+To whom thus Adam gratefully replied.
+Ascend, I follow thee, safe Guide, the path
+Thou leadest me; and to the hand of Heaven submit,
+However chastening; to the evil turn
+My obvious breast; arming to overcome
+By suffering, and earn rest from labour won,
+If so I may attain. -- So both ascend
+In the visions of God. It was a hill,
+Of Paradise the highest; from whose top
+The hemisphere of earth, in clearest ken,
+Stretched out to the amplest reach of prospect lay.
+Not higher that hill, nor wider looking round,
+Whereon, for different cause, the Tempter set
+Our second Adam, in the wilderness;
+To show him all Earth's kingdoms, and their glory.
+His eye might there command wherever stood
+City of old or modern fame, the seat
+Of mightiest empire, from the destined walls
+Of Cambalu, seat of Cathaian Can,
+And Samarchand by Oxus, Temir's throne,
+To Paquin of Sinaean kings; and thence
+To Agra and Lahor of great Mogul,
+Down to the golden Chersonese; or where
+The Persian in Ecbatan sat, or since
+In Hispahan; or where the Russian Ksar
+In Mosco; or the Sultan in Bizance,
+Turchestan-born; nor could his eye not ken
+The empire of Negus to his utmost port
+Ercoco, and the less maritim kings
+Mombaza, and Quiloa, and Melind,
+And Sofala, thought Ophir, to the realm
+Of Congo, and Angola farthest south;
+Or thence from Niger flood to Atlas mount
+The kingdoms of Almansor, Fez and Sus,
+Morocco, and Algiers, and Tremisen;
+On Europe thence, and where Rome was to sway
+The world: in spirit perhaps he also saw
+Rich Mexico, the seat of Montezume,
+And Cusco in Peru, the richer seat
+Of Atabalipa; and yet unspoiled
+Guiana, whose great city Geryon's sons
+Call El Dorado. But to nobler sights
+Michael from Adam's eyes the film removed,
+Which that false fruit that promised clearer sight
+Had bred; then purged with euphrasy and rue
+The visual nerve, for he had much to see;
+And from the well of life three drops instilled.
+So deep the power of these ingredients pierced,
+Even to the inmost seat of mental sight,
+That Adam, now enforced to close his eyes,
+Sunk down, and all his spirits became entranced;
+But him the gentle Angel by the hand
+Soon raised, and his attention thus recalled.
+Adam, now ope thine eyes; and first behold
+The effects, which thy original crime hath wrought
+In some to spring from thee; who never touched
+The excepted tree; nor with the snake conspired;
+Nor sinned thy sin; yet from that sin derive
+Corruption, to bring forth more violent deeds.
+His eyes he opened, and beheld a field,
+Part arable and tilth, whereon were sheaves
+New reaped; the other part sheep-walks and folds;
+I' the midst an altar as the land-mark stood,
+Rustick, of grassy sord; thither anon
+A sweaty reaper from his tillage brought
+First fruits, the green ear, and the yellow sheaf,
+Unculled, as came to hand; a shepherd next,
+More meek, came with the firstlings of his flock,
+Choicest and best; then, sacrificing, laid
+The inwards and their fat, with incense strowed,
+On the cleft wood, and all due rights performed:
+His offering soon propitious fire from Heaven
+Consumed with nimble glance, and grateful steam;
+The other's not, for his was not sincere;
+Whereat he inly raged, and, as they talked,
+Smote him into the midriff with a stone
+That beat out life; he fell;and, deadly pale,
+Groaned out his soul with gushing blood effused.
+Much at that sight was Adam in his heart
+Dismayed, and thus in haste to the Angel cried.
+O Teacher, some great mischief hath befallen
+To that meek man, who well had sacrificed;
+Is piety thus and pure devotion paid?
+To whom Michael thus, he also moved, replied.
+These two are brethren, Adam, and to come
+Out of thy loins; the unjust the just hath slain,
+For envy that his brother's offering found
+From Heaven acceptance; but the bloody fact
+Will be avenged; and the other's faith, approved,
+Lose no reward; though here thou see him die,
+Rolling in dust and gore. To which our sire.
+Alas! both for the deed, and for the cause!
+But have I now seen Death? Is this the way
+I must return to native dust? O sight
+Of terrour, foul and ugly to behold,
+Horrid to think, how horrible to feel!
+To whom thus Michael. Death thou hast seen
+In his first shape on Man; but many shapes
+Of Death, and many are the ways that lead
+To his grim cave, all dismal; yet to sense
+More terrible at the entrance, than within.
+Some, as thou sawest, by violent stroke shall die;
+By fire, flood, famine, by intemperance more
+In meats and drinks, which on the earth shall bring
+Diseases dire, of which a monstrous crew
+Before thee shall appear; that thou mayest know
+What misery the inabstinence of Eve
+Shall bring on Men. Immediately a place
+Before his eyes appeared, sad, noisome, dark;
+A lazar-house it seemed; wherein were laid
+Numbers of all diseased; all maladies
+Of ghastly spasm, or racking torture, qualms
+Of heart-sick agony, all feverous kinds,
+Convulsions, epilepsies, fierce catarrhs,
+Intestine stone and ulcer, colick-pangs,
+Demoniack phrenzy, moaping melancholy,
+And moon-struck madness, pining atrophy,
+Marasmus, and wide-wasting pestilence,
+Dropsies, and asthmas, and joint-racking rheums.
+Dire was the tossing, deep the groans; Despair
+Tended the sick busiest from couch to couch;
+And over them triumphant Death his dart
+Shook, but delayed to strike, though oft invoked
+With vows, as their chief good, and final hope.
+Sight so deform what heart of rock could long
+Dry-eyed behold? Adam could not, but wept,
+Though not of woman born; compassion quelled
+His best of man, and gave him up to tears
+A space, till firmer thoughts restrained excess;
+And, scarce recovering words, his plaint renewed.
+O miserable mankind, to what fall
+Degraded, to what wretched state reserved!
+Better end here unborn. Why is life given
+To be thus wrested from us? rather, why
+Obtruded on us thus? who, if we knew
+What we receive, would either no accept
+Life offered, or soon beg to lay it down;
+Glad to be so dismissed in peace. Can thus
+The image of God in Man, created once
+So goodly and erect, though faulty since,
+To such unsightly sufferings be debased
+Under inhuman pains? Why should not Man,
+Retaining still divine similitude
+In part, from such deformities be free,
+And, for his Maker's image sake, exempt?
+Their Maker's image, answered Michael, then
+Forsook them, when themselves they vilified
+To serve ungoverned Appetite; and took
+His image whom they served, a brutish vice,
+Inductive mainly to the sin of Eve.
+Therefore so abject is their punishment,
+Disfiguring not God's likeness, but their own;
+Or if his likeness, by themselves defaced;
+While they pervert pure Nature's healthful rules
+To loathsome sickness; worthily, since they
+God's image did not reverence in themselves.
+I yield it just, said Adam, and submit.
+But is there yet no other way, besides
+These painful passages, how we may come
+To death, and mix with our connatural dust?
+There is, said Michael, if thou well observe
+The rule of Not too much; by temperance taught,
+In what thou eatest and drinkest; seeking from thence
+Due nourishment, not gluttonous delight,
+Till many years over thy head return:
+So mayest thou live; till, like ripe fruit, thou drop
+Into thy mother's lap; or be with ease
+Gathered, nor harshly plucked; for death mature:
+This is Old Age; but then, thou must outlive
+Thy youth, thy strength, thy beauty; which will change
+To withered, weak, and gray; thy senses then,
+Obtuse, all taste of pleasure must forego,
+To what thou hast; and, for the air of youth,
+Hopeful and cheerful, in thy blood will reign
+A melancholy damp of cold and dry
+To weigh thy spirits down, and last consume
+The balm of life. To whom our ancestor.
+Henceforth I fly not death, nor would prolong
+Life much; bent rather, how I may be quit,
+Fairest and easiest, of this cumbrous charge;
+Which I must keep till my appointed day
+Of rendering up, and patiently attend
+My dissolution. Michael replied.
+Nor love thy life, nor hate; but what thou livest
+Live well; how long, or short, permit to Heaven:
+And now prepare thee for another sight.
+He looked, and saw a spacious plain, whereon
+Were tents of various hue; by some, were herds
+Of cattle grazing; others, whence the sound
+Of instruments, that made melodious chime,
+Was heard, of harp and organ; and, who moved
+Their stops and chords, was seen; his volant touch,
+Instinct through all proportions, low and high,
+Fled and pursued transverse the resonant fugue.
+In other part stood one who, at the forge
+Labouring, two massy clods of iron and brass
+Had melted, (whether found where casual fire
+Had wasted woods on mountain or in vale,
+Down to the veins of earth; thence gliding hot
+To some cave's mouth; or whether washed by stream
+From underground;) the liquid ore he drained
+Into fit moulds prepared; from which he formed
+First his own tools; then, what might else be wrought
+Fusil or graven in metal. After these,
+But on the hither side, a different sort
+From the high neighbouring hills, which was their seat,
+Down to the plain descended; by their guise
+Just men they seemed, and all their study bent
+To worship God aright, and know his works
+Not hid; nor those things last, which might preserve
+Freedom and peace to Men; they on the plain
+Long had not walked, when from the tents, behold!
+A bevy of fair women, richly gay
+In gems and wanton dress; to the harp they sung
+Soft amorous ditties, and in dance came on:
+The men, though grave, eyed them; and let their eyes
+Rove without rein; till, in the amorous net
+Fast caught, they liked; and each his liking chose;
+And now of love they treat, till the evening-star,
+Love's harbinger, appeared; then, all in heat
+They light the nuptial torch, and bid invoke
+Hymen, then first to marriage rites invoked:
+With feast and musick all the tents resound.
+Such happy interview, and fair event
+Of love and youth not lost, songs, garlands, flowers,
+And charming symphonies, attached the heart
+Of Adam, soon inclined to admit delight,
+The bent of nature; which he thus expressed.
+True opener of mine eyes, prime Angel blest;
+Much better seems this vision, and more hope
+Of peaceful days portends, than those two past;
+Those were of hate and death, or pain much worse;
+Here Nature seems fulfilled in all her ends.
+To whom thus Michael. Judge not what is best
+By pleasure, though to nature seeming meet;
+Created, as thou art, to nobler end
+Holy and pure, conformity divine.
+Those tents thou sawest so pleasant, were the tents
+Of wickedness, wherein shall dwell his race
+Who slew his brother; studious they appear
+Of arts that polish life, inventers rare;
+Unmindful of their Maker, though his Spirit
+Taught them; but they his gifts acknowledged none.
+Yet they a beauteous offspring shall beget;
+For that fair female troop thou sawest, that seemed
+Of Goddesses, so blithe, so smooth, so gay,
+Yet empty of all good wherein consists
+Woman's domestick honour and chief praise;
+Bred only and completed to the taste
+Of lustful appetence, to sing, to dance,
+To dress, and troll the tongue, and roll the eye:
+To these that sober race of men, whose lives
+Religious titled them the sons of God,
+Shall yield up all their virtue, all their fame
+Ignobly, to the trains and to the smiles
+Of these fair atheists; and now swim in joy,
+Erelong to swim at large; and laugh, for which
+The world erelong a world of tears must weep.
+To whom thus Adam, of short joy bereft.
+O pity and shame, that they, who to live well
+Entered so fair, should turn aside to tread
+Paths indirect, or in the mid way faint!
+But still I see the tenour of Man's woe
+Holds on the same, from Woman to begin.
+From Man's effeminate slackness it begins,
+Said the Angel, who should better hold his place
+By wisdom, and superiour gifts received.
+But now prepare thee for another scene.
+He looked, and saw wide territory spread
+Before him, towns, and rural works between;
+Cities of men with lofty gates and towers,
+Concourse in arms, fierce faces threatening war,
+Giants of mighty bone and bold emprise;
+Part wield their arms, part curb the foaming steed,
+Single or in array of battle ranged
+Both horse and foot, nor idly mustering stood;
+One way a band select from forage drives
+A herd of beeves, fair oxen and fair kine,
+From a fat meadow ground; or fleecy flock,
+Ewes and their bleating lambs over the plain,
+Their booty; scarce with life the shepherds fly,
+But call in aid, which makes a bloody fray;
+With cruel tournament the squadrons join;
+Where cattle pastured late, now scattered lies
+With carcasses and arms the ensanguined field,
+Deserted: Others to a city strong
+Lay siege, encamped; by battery, scale, and mine,
+Assaulting; others from the wall defend
+With dart and javelin, stones, and sulphurous fire;
+On each hand slaughter, and gigantick deeds.
+In other part the sceptered heralds call
+To council, in the city-gates; anon
+Gray-headed men and grave, with warriours mixed,
+Assemble, and harangues are heard; but soon,
+In factious opposition; till at last,
+Of middle age one rising, eminent
+In wise deport, spake much of right and wrong,
+Of justice, or religion, truth, and peace,
+And judgement from above: him old and young
+Exploded, and had seized with violent hands,
+Had not a cloud descending snatched him thence
+Unseen amid the throng: so violence
+Proceeded, and oppression, and sword-law,
+Through all the plain, and refuge none was found.
+Adam was all in tears, and to his guide
+Lamenting turned full sad; O!what are these,
+Death's ministers, not men? who thus deal death
+Inhumanly to men, and multiply
+Ten thousandfold the sin of him who slew
+His brother: for of whom such massacre
+Make they, but of their brethren; men of men
+But who was that just man, whom had not Heaven
+Rescued, had in his righteousness been lost?
+To whom thus Michael. These are the product
+Of those ill-mated marriages thou sawest;
+Where good with bad were matched, who of themselves
+Abhor to join; and, by imprudence mixed,
+Produce prodigious births of body or mind.
+Such were these giants, men of high renown;
+For in those days might only shall be admired,
+And valour and heroick virtue called;
+To overcome in battle, and subdue
+Nations, and bring home spoils with infinite
+Man-slaughter, shall be held the highest pitch
+Of human glory; and for glory done
+Of triumph, to be styled great conquerours
+Patrons of mankind, Gods, and sons of Gods;
+Destroyers rightlier called, and plagues of men.
+Thus fame shall be achieved, renown on earth;
+And what most merits fame, in silence hid.
+But he, the seventh from thee, whom thou beheldst
+The only righteous in a world preverse,
+And therefore hated, therefore so beset
+With foes, for daring single to be just,
+And utter odious truth, that God would come
+To judge them with his Saints; him the Most High
+Rapt in a balmy cloud with winged steeds
+Did, as thou sawest, receive, to walk with God
+High in salvation and the climes of bliss,
+Exempt from death; to show thee what reward
+Awaits the good; the rest what punishment;
+Which now direct thine eyes and soon behold.
+He looked, and saw the face of things quite changed;
+The brazen throat of war had ceased to roar;
+All now was turned to jollity and game,
+To luxury and riot, feast and dance;
+Marrying or prostituting, as befel,
+Rape or adultery, where passing fair
+Allured them; thence from cups to civil broils.
+At length a reverend sire among them came,
+And of their doings great dislike declared,
+And testified against their ways; he oft
+Frequented their assemblies, whereso met,
+Triumphs or festivals; and to them preached
+Conversion and repentance, as to souls
+In prison, under judgements imminent:
+But all in vain: which when he saw, he ceased
+Contending, and removed his tents far off;
+Then, from the mountain hewing timber tall,
+Began to build a vessel of huge bulk;
+Measured by cubit, length, and breadth, and highth;
+Smeared round with pitch; and in the side a door
+Contrived; and of provisions laid in large,
+For man and beast: when lo, a wonder strange!
+Of every beast, and bird, and insect small,
+Came sevens, and pairs; and entered in as taught
+Their order: last the sire and his three sons,
+With their four wives; and God made fast the door.
+Mean while the south-wind rose, and, with black wings
+Wide-hovering, all the clouds together drove
+From under Heaven; the hills to their supply
+Vapour, and exhalation dusk and moist,
+Sent up amain; and now the thickened sky
+Like a dark cieling stood; down rushed the rain
+Impetuous; and continued, till the earth
+No more was seen: the floating vessel swum
+Uplifted, and secure with beaked prow
+Rode tilting o'er the waves; all dwellings else
+Flood overwhelmed, and them with all their pomp
+Deep under water rolled; sea covered sea,
+Sea without shore; and in their palaces,
+Where luxury late reigned, sea-monsters whelped
+And stabled; of mankind, so numerous late,
+All left, in one small bottom swum imbarked.
+How didst thou grieve then, Adam, to behold
+The end of all thy offspring, end so sad,
+Depopulation! Thee another flood,
+Of tears and sorrow a flood, thee also drowned,
+And sunk thee as thy sons; till, gently reared
+By the Angel, on thy feet thou stoodest at last,
+Though comfortless; as when a father mourns
+His children, all in view destroyed at once;
+And scarce to the Angel utter'dst thus thy plaint.
+O visions ill foreseen! Better had I
+Lived ignorant of future! so had borne
+My part of evil only, each day's lot
+Enough to bear; those now, that were dispensed
+The burden of many ages, on me light
+At once, by my foreknowledge gaining birth
+Abortive, to torment me ere their being,
+With thought that they must be. Let no man seek
+Henceforth to be foretold, what shall befall
+Him or his children; evil he may be sure,
+Which neither his foreknowing can prevent;
+And he the future evil shall no less
+In apprehension than in substance feel,
+Grievous to bear: but that care now is past,
+Man is not whom to warn: those few escaped
+Famine and anguish will at last consume,
+Wandering that watery desart: I had hope,
+When violence was ceased, and war on earth,
+All would have then gone well; peace would have crowned
+With length of happy days the race of Man;
+But I was far deceived; for now I see
+Peace to corrupt no less than war to waste.
+How comes it thus? unfold, celestial Guide,
+And whether here the race of Man will end.
+To whom thus Michael. Those, whom last thou sawest
+In triumph and luxurious wealth, are they
+First seen in acts of prowess eminent
+And great exploits, but of true virtue void;
+Who, having spilt much blood, and done much wast
+Subduing nations, and achieved thereby
+Fame in the world, high titles, and rich prey;
+Shall change their course to pleasure, ease, and sloth,
+Surfeit, and lust; till wantonness and pride
+Raise out of friendship hostile deeds in peace.
+The conquered also, and enslaved by war,
+Shall, with their freedom lost, all virtue lose
+And fear of God; from whom their piety feigned
+In sharp contest of battle found no aid
+Against invaders; therefore, cooled in zeal,
+Thenceforth shall practice how to live secure,
+Worldly or dissolute, on what their lords
+Shall leave them to enjoy; for the earth shall bear
+More than enough, that temperance may be tried:
+So all shall turn degenerate, all depraved;
+Justice and temperance, truth and faith, forgot;
+One man except, the only son of light
+In a dark age, against example good,
+Against allurement, custom, and a world
+Offended: fearless of reproach and scorn,
+The grand-child, with twelve sons encreased, departs
+From Canaan, to a land hereafter called
+Egypt, divided by the river Nile;
+See where it flows, disgorging at seven mouths
+Into the sea: To sojourn in that land
+He comes, invited by a younger son
+In time of dearth; a son, whose worthy deeds
+Raise him to be the second in that realm
+Of Pharaoh: There he dies, and leaves his race
+Growing into a nation, and now grown
+Suspected to a sequent king, who seeks
+To stop their overgrowth, as inmate guests
+Or violence, he of their wicked ways
+Shall them admonish; and before them set
+The paths of righteousness, how much more safe
+And full of peace; denouncing wrath to come
+On their impenitence; and shall return
+Of them derided, but of God observed
+The one just man alive; by his command
+Shall build a wonderous ark, as thou beheldst,
+To save himself, and houshold, from amidst
+A world devote to universal wrack.
+No sooner he, with them of man and beast
+Select for life, shall in the ark be lodged,
+And sheltered round; but all the cataracts
+Of Heaven set open on the Earth shall pour
+Rain, day and night; all fountains of the deep,
+Broke up, shall heave the ocean to usurp
+Beyond all bounds; till inundation rise
+Above the highest hills: Then shall this mount
+Of Paradise by might of waves be moved
+Out of his place, pushed by the horned flood,
+With all his verdure spoiled, and trees adrift,
+Down the great river to the opening gulf,
+And there take root an island salt and bare,
+The haunt of seals, and orcs, and sea-mews' clang:
+To teach thee that God attributes to place
+No sanctity, if none be thither brought
+By men who there frequent, or therein dwell.
+And now, what further shall ensue, behold.
+He looked, and saw the ark hull on the flood,
+Which now abated; for the clouds were fled,
+Driven by a keen north-wind, that, blowing dry,
+Wrinkled the face of deluge, as decayed;
+And the clear sun on his wide watery glass
+Gazed hot, and of the fresh wave largely drew,
+As after thirst; which made their flowing shrink
+From standing lake to tripping ebb, that stole
+With soft foot towards the deep; who now had stopt
+His sluces, as the Heaven his windows shut.
+The ark no more now floats, but seems on ground,
+Fast on the top of some high mountain fixed.
+And now the tops of hills, as rocks, appear;
+With clamour thence the rapid currents drive,
+Towards the retreating sea, their furious tide.
+Forthwith from out the ark a raven flies,
+And after him, the surer messenger,
+A dove sent forth once and again to spy
+Green tree or ground, whereon his foot may light:
+The second time returning, in his bill
+An olive-leaf he brings, pacifick sign:
+Anon dry ground appears, and from his ark
+The ancient sire descends, with all his train;
+Then with uplifted hands, and eyes devout,
+Grateful to Heaven, over his head beholds
+A dewy cloud, and in the cloud a bow
+Conspicuous with three lifted colours gay,
+Betokening peace from God, and covenant new.
+Whereat the heart of Adam, erst so sad,
+Greatly rejoiced; and thus his joy broke forth.
+O thou, who future things canst represent
+As present, heavenly Instructer! I revive
+At this last sight; assured that Man shall live,
+With all the creatures, and their seed preserve.
+Far less I now lament for one whole world
+Of wicked sons destroyed, than I rejoice
+For one man found so perfect, and so just,
+That God vouchsafes to raise another world
+From him, and all his anger to forget.
+But say, what mean those coloured streaks in Heaven
+Distended, as the brow of God appeased?
+Or serve they, as a flowery verge, to bind
+The fluid skirts of that same watery cloud,
+Lest it again dissolve, and shower the earth?
+To whom the Arch-Angel. Dextrously thou aimest;
+So willingly doth God remit his ire,
+Though late repenting him of Man depraved;
+Grieved at his heart, when looking down he saw
+The whole earth filled with violence, and all flesh
+Corrupting each their way; yet, those removed,
+Such grace shall one just man find in his sight,
+That he relents, not to blot out mankind;
+And makes a covenant never to destroy
+The earth again by flood; nor let the sea
+Surpass his bounds; nor rain to drown the world,
+With man therein or beast; but, when he brings
+Over the earth a cloud, will therein set
+His triple-coloured bow, whereon to look,
+And call to mind his covenant: Day and night,
+Seed-time and harvest, heat and hoary frost,
+Shall hold their course; till fire purge all things new,
+Both Heaven and Earth, wherein the just shall dwell.
+
+
+
+Book XII
+
+
+As one who in his journey bates at noon,
+Though bent on speed; so here the Arch-Angel paused
+Betwixt the world destroyed and world restored,
+If Adam aught perhaps might interpose;
+Then, with transition sweet, new speech resumes.
+Thus thou hast seen one world begin, and end;
+And Man, as from a second stock, proceed.
+Much thou hast yet to see; but I perceive
+Thy mortal sight to fail; objects divine
+Must needs impair and weary human sense:
+Henceforth what is to come I will relate;
+Thou therefore give due audience, and attend.
+This second source of Men, while yet but few,
+And while the dread of judgement past remains
+Fresh in their minds, fearing the Deity,
+With some regard to what is just and right
+Shall lead their lives, and multiply apace;
+Labouring the soil, and reaping plenteous crop,
+Corn, wine, and oil; and, from the herd or flock,
+Oft sacrificing bullock, lamb, or kid,
+With large wine-offerings poured, and sacred feast,
+Shall spend their days in joy unblamed; and dwell
+Long time in peace, by families and tribes,
+Under paternal rule: till one shall rise
+Of proud ambitious heart; who, not content
+With fair equality, fraternal state,
+Will arrogate dominion undeserved
+Over his brethren, and quite dispossess
+Concord and law of nature from the earth;
+Hunting (and men not beasts shall be his game)
+With war, and hostile snare, such as refuse
+Subjection to his empire tyrannous:
+A mighty hunter thence he shall be styled
+Before the Lord; as in despite of Heaven,
+Or from Heaven, claiming second sovranty;
+And from rebellion shall derive his name,
+Though of rebellion others he accuse.
+He with a crew, whom like ambition joins
+With him or under him to tyrannize,
+Marching from Eden towards the west, shall find
+The plain, wherein a black bituminous gurge
+Boils out from under ground, the mouth of Hell:
+Of brick, and of that stuff, they cast to build
+A city and tower, whose top may reach to Heaven;
+And get themselves a name; lest, far dispersed
+In foreign lands, their memory be lost;
+Regardless whether good or evil fame.
+But God, who oft descends to visit men
+Unseen, and through their habitations walks
+To mark their doings, them beholding soon,
+Comes down to see their city, ere the tower
+Obstruct Heaven-towers, and in derision sets
+Upon their tongues a various spirit, to rase
+Quite out their native language; and, instead,
+To sow a jangling noise of words unknown:
+Forthwith a hideous gabble rises loud,
+Among the builders; each to other calls
+Not understood; till hoarse, and all in rage,
+As mocked they storm: great laughter was in Heaven,
+And looking down, to see the hubbub strange,
+And hear the din: Thus was the building left
+Ridiculous, and the work Confusion named.
+Whereto thus Adam, fatherly displeased.
+O execrable son! so to aspire
+Above his brethren; to himself assuming
+Authority usurped, from God not given:
+He gave us only over beast, fish, fowl,
+Dominion absolute; that right we hold
+By his donation; but man over men
+He made not lord; such title to himself
+Reserving, human left from human free.
+But this usurper his encroachment proud
+Stays not on Man; to God his tower intends
+Siege and defiance: Wretched man!what food
+Will he convey up thither, to sustain
+Himself and his rash army; where thin air
+Above the clouds will pine his entrails gross,
+And famish him of breath, if not of bread?
+To whom thus Michael. Justly thou abhorrest
+That son, who on the quiet state of men
+Such trouble brought, affecting to subdue
+Rational liberty; yet know withal,
+Since thy original lapse, true liberty
+Is lost, which always with right reason dwells
+Twinned, and from her hath no dividual being:
+Reason in man obscured, or not obeyed,
+Immediately inordinate desires,
+And upstart passions, catch the government
+From reason; and to servitude reduce
+Man, till then free. Therefore, since he permits
+Within himself unworthy powers to reign
+Over free reason, God, in judgement just,
+Subjects him from without to violent lords;
+Who oft as undeservedly enthrall
+His outward freedom: Tyranny must be;
+Though to the tyrant thereby no excuse.
+Yet sometimes nations will decline so low
+From virtue, which is reason, that no wrong,
+But justice, and some fatal curse annexed,
+Deprives them of their outward liberty;
+Their inward lost: Witness the irreverent son
+Of him who built the ark; who, for the shame
+Done to his father, heard this heavy curse,
+Servant of servants, on his vicious race.
+Thus will this latter, as the former world,
+Still tend from bad to worse; till God at last,
+Wearied with their iniquities, withdraw
+His presence from among them, and avert
+His holy eyes; resolving from thenceforth
+To leave them to their own polluted ways;
+And one peculiar nation to select
+From all the rest, of whom to be invoked,
+A nation from one faithful man to spring:
+Him on this side Euphrates yet residing,
+Bred up in idol-worship: O, that men
+(Canst thou believe?) should be so stupid grown,
+While yet the patriarch lived, who 'scaped the flood,
+As to forsake the living God, and fall
+To worship their own work in wood and stone
+For Gods! Yet him God the Most High vouchsafes
+To call by vision, from his father's house,
+His kindred, and false Gods, into a land
+Which he will show him; and from him will raise
+A mighty nation; and upon him shower
+His benediction so, that in his seed
+All nations shall be blest: he straight obeys;
+Not knowing to what land, yet firm believes:
+I see him, but thou canst not, with what faith
+He leaves his Gods, his friends, and native soil,
+Ur of Chaldaea, passing now the ford
+To Haran; after him a cumbrous train
+Of herds and flocks, and numerous servitude;
+Not wandering poor, but trusting all his wealth
+With God, who called him, in a land unknown.
+Canaan he now attains; I see his tents
+Pitched about Sechem, and the neighbouring plain
+Of Moreh; there by promise he receives
+Gift to his progeny of all that land,
+From Hameth northward to the Desart south;
+(Things by their names I call, though yet unnamed;)
+From Hermon east to the great western Sea;
+Mount Hermon, yonder sea; each place behold
+In prospect, as I point them; on the shore
+Mount Carmel; here, the double-founted stream,
+Jordan, true limit eastward; but his sons
+Shall dwell to Senir, that long ridge of hills.
+This ponder, that all nations of the earth
+Shall in his seed be blessed: By that seed
+Is meant thy great Deliverer, who shall bruise
+The Serpent's head; whereof to thee anon
+Plainlier shall be revealed. This patriarch blest,
+Whom faithful Abraham due time shall call,
+A son, and of his son a grand-child, leaves;
+Like him in faith, in wisdom, and renown:
+The grandchild, with twelve sons increased, departs
+From Canaan to a land hereafter called
+Egypt, divided by the river Nile
+See where it flows, disgorging at seven mouths
+Into the sea. To sojourn in that land
+He comes, invited by a younger son
+In time of dearth, a son whose worthy deeds
+Raise him to be the second in that realm
+Of Pharaoh. There he dies, and leaves his race
+Growing into a nation, and now grown
+Suspected to a sequent king, who seeks
+To stop their overgrowth, as inmate guests
+Too numerous; whence of guests he makes them slaves
+Inhospitably, and kills their infant males:
+Till by two brethren (these two brethren call
+Moses and Aaron) sent from God to claim
+His people from enthralment, they return,
+With glory and spoil, back to their promised land.
+But first, the lawless tyrant, who denies
+To know their God, or message to regard,
+Must be compelled by signs and judgements dire;
+To blood unshed the rivers must be turned;
+Frogs, lice, and flies, must all his palace fill
+With loathed intrusion, and fill all the land;
+His cattle must of rot and murren die;
+Botches and blains must all his flesh emboss,
+And all his people; thunder mixed with hail,
+Hail mixed with fire, must rend the Egyptians sky,
+And wheel on the earth, devouring where it rolls;
+What it devours not, herb, or fruit, or grain,
+A darksome cloud of locusts swarming down
+Must eat, and on the ground leave nothing green;
+Darkness must overshadow all his bounds,
+Palpable darkness, and blot out three days;
+Last, with one midnight stroke, all the first-born
+Of Egypt must lie dead. Thus with ten wounds
+The river-dragon tamed at length submits
+To let his sojourners depart, and oft
+Humbles his stubborn heart; but still, as ice
+More hardened after thaw; till, in his rage
+Pursuing whom he late dismissed, the sea
+Swallows him with his host; but them lets pass,
+As on dry land, between two crystal walls;
+Awed by the rod of Moses so to stand
+Divided, till his rescued gain their shore:
+Such wondrous power God to his saint will lend,
+Though present in his Angel; who shall go
+Before them in a cloud, and pillar of fire;
+By day a cloud, by night a pillar of fire;
+To guide them in their journey, and remove
+Behind them, while the obdurate king pursues:
+All night he will pursue; but his approach
+Darkness defends between till morning watch;
+Then through the fiery pillar, and the cloud,
+God looking forth will trouble all his host,
+And craze their chariot-wheels: when by command
+Moses once more his potent rod extends
+Over the sea; the sea his rod obeys;
+On their embattled ranks the waves return,
+And overwhelm their war: The race elect
+Safe toward Canaan from the shore advance
+Through the wild Desart, not the readiest way;
+Lest, entering on the Canaanite alarmed,
+War terrify them inexpert, and fear
+Return them back to Egypt, choosing rather
+Inglorious life with servitude; for life
+To noble and ignoble is more sweet
+Untrained in arms, where rashness leads not on.
+This also shall they gain by their delay
+In the wide wilderness; there they shall found
+Their government, and their great senate choose
+Through the twelve tribes, to rule by laws ordained:
+God from the mount of Sinai, whose gray top
+Shall tremble, he descending, will himself
+In thunder, lightning, and loud trumpets' sound,
+Ordain them laws; part, such as appertain
+To civil justice; part, religious rites
+Of sacrifice; informing them, by types
+And shadows, of that destined Seed to bruise
+The Serpent, by what means he shall achieve
+Mankind's deliverance. But the voice of God
+To mortal ear is dreadful: They beseech
+That Moses might report to them his will,
+And terrour cease; he grants what they besought,
+Instructed that to God is no access
+Without Mediator, whose high office now
+Moses in figure bears; to introduce
+One greater, of whose day he shall foretel,
+And all the Prophets in their age the times
+Of great Messiah shall sing. Thus, laws and rites
+Established, such delight hath God in Men
+Obedient to his will, that he vouchsafes
+Among them to set up his tabernacle;
+The Holy One with mortal Men to dwell:
+By his prescript a sanctuary is framed
+Of cedar, overlaid with gold; therein
+An ark, and in the ark his testimony,
+The records of his covenant; over these
+A mercy-seat of gold, between the wings
+Of two bright Cherubim; before him burn
+Seven lamps as in a zodiack representing
+The heavenly fires; over the tent a cloud
+Shall rest by day, a fiery gleam by night;
+Save when they journey, and at length they come,
+Conducted by his Angel, to the land
+Promised to Abraham and his seed:--The rest
+Were long to tell; how many battles fought
+How many kings destroyed; and kingdoms won;
+Or how the sun shall in mid Heaven stand still
+A day entire, and night's due course adjourn,
+Man's voice commanding, 'Sun, in Gibeon stand,
+'And thou moon in the vale of Aialon,
+'Till Israel overcome! so call the third
+From Abraham, son of Isaac; and from him
+His whole descent, who thus shall Canaan win.
+Here Adam interposed. O sent from Heaven,
+Enlightener of my darkness, gracious things
+Thou hast revealed; those chiefly, which concern
+Just Abraham and his seed: now first I find
+Mine eyes true-opening, and my heart much eased;
+Erewhile perplexed with thoughts, what would become
+Of me and all mankind: But now I see
+His day, in whom all nations shall be blest;
+Favour unmerited by me, who sought
+Forbidden knowledge by forbidden means.
+This yet I apprehend not, why to those
+Among whom God will deign to dwell on earth
+So many and so various laws are given;
+So many laws argue so many sins
+Among them; how can God with such reside?
+To whom thus Michael. Doubt not but that sin
+Will reign among them, as of thee begot;
+And therefore was law given them, to evince
+Their natural pravity, by stirring up
+Sin against law to fight: that when they see
+Law can discover sin, but not remove,
+Save by those shadowy expiations weak,
+The blood of bulls and goats, they may conclude
+Some blood more precious must be paid for Man;
+Just for unjust; that, in such righteousness
+To them by faith imputed, they may find
+Justification towards God, and peace
+Of conscience; which the law by ceremonies
+Cannot appease; nor Man the mortal part
+Perform; and, not performing, cannot live.
+So law appears imperfect; and but given
+With purpose to resign them, in full time,
+Up to a better covenant; disciplined
+From shadowy types to truth; from flesh to spirit;
+From imposition of strict laws to free
+Acceptance of large grace; from servile fear
+To filial; works of law to works of faith.
+And therefore shall not Moses, though of God
+Highly beloved, being but the minister
+Of law, his people into Canaan lead;
+But Joshua, whom the Gentiles Jesus call,
+His name and office bearing, who shall quell
+The adversary-Serpent, and bring back
+Through the world's wilderness long-wandered Man
+Safe to eternal Paradise of rest.
+Mean while they, in their earthly Canaan placed,
+Long time shall dwell and prosper, but when sins
+National interrupt their publick peace,
+Provoking God to raise them enemies;
+From whom as oft he saves them penitent
+By Judges first, then under Kings; of whom
+The second, both for piety renowned
+And puissant deeds, a promise shall receive
+Irrevocable, that his regal throne
+For ever shall endure; the like shall sing
+All Prophecy, that of the royal stock
+Of David (so I name this king) shall rise
+A Son, the Woman's seed to thee foretold,
+Foretold to Abraham, as in whom shall trust
+All nations; and to kings foretold, of kings
+The last; for of his reign shall be no end.
+But first, a long succession must ensue;
+And his next son, for wealth and wisdom famed,
+The clouded ark of God, till then in tents
+Wandering, shall in a glorious temple enshrine.
+Such follow him, as shall be registered
+Part good, part bad; of bad the longer scroll;
+Whose foul idolatries, and other faults
+Heaped to the popular sum, will so incense
+God, as to leave them, and expose their land,
+Their city, his temple, and his holy ark,
+With all his sacred things, a scorn and prey
+To that proud city, whose high walls thou sawest
+Left in confusion; Babylon thence called.
+There in captivity he lets them dwell
+The space of seventy years; then brings them back,
+Remembering mercy, and his covenant sworn
+To David, stablished as the days of Heaven.
+Returned from Babylon by leave of kings
+Their lords, whom God disposed, the house of God
+They first re-edify; and for a while
+In mean estate live moderate; till, grown
+In wealth and multitude, factious they grow;
+But first among the priests dissention springs,
+Men who attend the altar, and should most
+Endeavour peace: their strife pollution brings
+Upon the temple itself: at last they seise
+The scepter, and regard not David's sons;
+Then lose it to a stranger, that the true
+Anointed King Messiah might be born
+Barred of his right; yet at his birth a star,
+Unseen before in Heaven, proclaims him come;
+And guides the eastern sages, who inquire
+His place, to offer incense, myrrh, and gold:
+His place of birth a solemn Angel tells
+To simple shepherds, keeping watch by night;
+They gladly thither haste, and by a quire
+Of squadroned Angels hear his carol sung.
+A virgin is his mother, but his sire
+The power of the Most High: He shall ascend
+The throne hereditary, and bound his reign
+With Earth's wide bounds, his glory with the Heavens.
+He ceased, discerning Adam with such joy
+Surcharged, as had like grief been dewed in tears,
+Without the vent of words; which these he breathed.
+O prophet of glad tidings, finisher
+Of utmost hope! now clear I understand
+What oft my steadiest thoughts have searched in vain;
+Why our great Expectation should be called
+The seed of Woman: Virgin Mother, hail,
+High in the love of Heaven; yet from my loins
+Thou shalt proceed, and from thy womb the Son
+Of God Most High: so God with Man unites!
+Needs must the Serpent now his capital bruise
+Expect with mortal pain: Say where and when
+Their fight, what stroke shall bruise the victor's heel.
+To whom thus Michael. Dream not of their fight,
+As of a duel, or the local wounds
+Of head or heel: Not therefore joins the Son
+Manhood to Godhead, with more strength to foil
+Thy enemy; nor so is overcome
+Satan, whose fall from Heaven, a deadlier bruise,
+Disabled, not to give thee thy death's wound:
+Which he, who comes thy Saviour, shall recure,
+Not by destroying Satan, but his works
+In thee, and in thy seed: Nor can this be,
+But by fulfilling that which thou didst want,
+Obedience to the law of God, imposed
+On penalty of death, and suffering death;
+The penalty to thy transgression due,
+And due to theirs which out of thine will grow:
+So only can high Justice rest appaid.
+The law of God exact he shall fulfil
+Both by obedience and by love, though love
+Alone fulfil the law; thy punishment
+He shall endure, by coming in the flesh
+To a reproachful life, and cursed death;
+Proclaiming life to all who shall believe
+In his redemption; and that his obedience,
+Imputed, becomes theirs by faith; his merits
+To save them, not their own, though legal, works.
+For this he shall live hated, be blasphemed,
+Seised on by force, judged, and to death condemned
+A shameful and accursed, nailed to the cross
+By his own nation; slain for bringing life:
+But to the cross he nails thy enemies,
+The law that is against thee, and the sins
+Of all mankind, with him there crucified,
+Never to hurt them more who rightly trust
+In this his satisfaction; so he dies,
+But soon revives; Death over him no power
+Shall long usurp; ere the third dawning light
+Return, the stars of morn shall see him rise
+Out of his grave, fresh as the dawning light,
+Thy ransom paid, which Man from death redeems,
+His death for Man, as many as offered life
+Neglect not, and the benefit embrace
+By faith not void of works: This God-like act
+Annuls thy doom, the death thou shouldest have died,
+In sin for ever lost from life; this act
+Shall bruise the head of Satan, crush his strength,
+Defeating Sin and Death, his two main arms;
+And fix far deeper in his head their stings
+Than temporal death shall bruise the victor's heel,
+Or theirs whom he redeems; a death, like sleep,
+A gentle wafting to immortal life.
+Nor after resurrection shall he stay
+Longer on earth, than certain times to appear
+To his disciples, men who in his life
+Still followed him; to them shall leave in charge
+To teach all nations what of him they learned
+And his salvation; them who shall believe
+Baptizing in the profluent stream, the sign
+Of washing them from guilt of sin to life
+Pure, and in mind prepared, if so befall,
+For death, like that which the Redeemer died.
+All nations they shall teach; for, from that day,
+Not only to the sons of Abraham's loins
+Salvation shall be preached, but to the sons
+Of Abraham's faith wherever through the world;
+So in his seed all nations shall be blest.
+Then to the Heaven of Heavens he shall ascend
+With victory, triumphing through the air
+Over his foes and thine; there shall surprise
+The Serpent, prince of air, and drag in chains
+Through all his realm, and there confounded leave;
+Then enter into glory, and resume
+His seat at God's right hand, exalted high
+Above all names in Heaven; and thence shall come,
+When this world's dissolution shall be ripe,
+With glory and power to judge both quick and dead;
+To judge the unfaithful dead, but to reward
+His faithful, and receive them into bliss,
+Whether in Heaven or Earth; for then the Earth
+Shall all be Paradise, far happier place
+Than this of Eden, and far happier days.
+So spake the Arch-Angel Michael; then paused,
+As at the world's great period; and our sire,
+Replete with joy and wonder, thus replied.
+O Goodness infinite, Goodness immense!
+That all this good of evil shall produce,
+And evil turn to good; more wonderful
+Than that which by creation first brought forth
+Light out of darkness! Full of doubt I stand,
+Whether I should repent me now of sin
+By me done, and occasioned; or rejoice
+Much more, that much more good thereof shall spring;
+To God more glory, more good-will to Men
+From God, and over wrath grace shall abound.
+But say, if our Deliverer up to Heaven
+Must re-ascend, what will betide the few
+His faithful, left among the unfaithful herd,
+The enemies of truth? Who then shall guide
+His people, who defend? Will they not deal
+Worse with his followers than with him they dealt?
+Be sure they will, said the Angel; but from Heaven
+He to his own a Comforter will send,
+The promise of the Father, who shall dwell
+His Spirit within them; and the law of faith,
+Working through love, upon their hearts shall write,
+To guide them in all truth; and also arm
+With spiritual armour, able to resist
+Satan's assaults, and quench his fiery darts;
+What man can do against them, not afraid,
+Though to the death; against such cruelties
+With inward consolations recompensed,
+And oft supported so as shall amaze
+Their proudest persecutors: For the Spirit,
+Poured first on his Apostles, whom he sends
+To evangelize the nations, then on all
+Baptized, shall them with wonderous gifts endue
+To speak all tongues, and do all miracles,
+As did their Lord before them. Thus they win
+Great numbers of each nation to receive
+With joy the tidings brought from Heaven: At length
+Their ministry performed, and race well run,
+Their doctrine and their story written left,
+They die; but in their room, as they forewarn,
+Wolves shall succeed for teachers, grievous wolves,
+Who all the sacred mysteries of Heaven
+To their own vile advantages shall turn
+Of lucre and ambition; and the truth
+With superstitions and traditions taint,
+Left only in those written records pure,
+Though not but by the Spirit understood.
+Then shall they seek to avail themselves of names,
+Places, and titles, and with these to join
+Secular power; though feigning still to act
+By spiritual, to themselves appropriating
+The Spirit of God, promised alike and given
+To all believers; and, from that pretence,
+Spiritual laws by carnal power shall force
+On every conscience; laws which none shall find
+Left them inrolled, or what the Spirit within
+Shall on the heart engrave. What will they then
+But force the Spirit of Grace itself, and bind
+His consort Liberty? what, but unbuild
+His living temples, built by faith to stand,
+Their own faith, not another's? for, on earth,
+Who against faith and conscience can be heard
+Infallible? yet many will presume:
+Whence heavy persecution shall arise
+On all, who in the worship persevere
+Of spirit and truth; the rest, far greater part,
+Will deem in outward rites and specious forms
+Religion satisfied; Truth shall retire
+Bestuck with slanderous darts, and works of faith
+Rarely be found: So shall the world go on,
+To good malignant, to bad men benign;
+Under her own weight groaning; till the day
+Appear of respiration to the just,
+And vengeance to the wicked, at return
+Of him so lately promised to thy aid,
+The Woman's Seed; obscurely then foretold,
+Now ampler known thy Saviour and thy Lord;
+Last, in the clouds, from Heaven to be revealed
+In glory of the Father, to dissolve
+Satan with his perverted world; then raise
+From the conflagrant mass, purged and refined,
+New Heavens, new Earth, ages of endless date,
+Founded in righteousness, and peace, and love;
+To bring forth fruits, joy and eternal bliss.
+He ended; and thus Adam last replied.
+How soon hath thy prediction, Seer blest,
+Measured this transient world, the race of time,
+Till time stand fixed! Beyond is all abyss,
+Eternity, whose end no eye can reach.
+Greatly-instructed I shall hence depart;
+Greatly in peace of thought; and have my fill
+Of knowledge, what this vessel can contain;
+Beyond which was my folly to aspire.
+Henceforth I learn, that to obey is best,
+And love with fear the only God; to walk
+As in his presence; ever to observe
+His providence; and on him sole depend,
+Merciful over all his works, with good
+Still overcoming evil, and by small
+Accomplishing great things, by things deemed weak
+Subverting worldly strong, and worldly wise
+By simply meek: that suffering for truth's sake
+Is fortitude to highest victory,
+And, to the faithful, death the gate of life;
+Taught this by his example, whom I now
+Acknowledge my Redeemer ever blest.
+To whom thus also the Angel last replied.
+This having learned, thou hast attained the sum
+Of wisdom; hope no higher, though all the stars
+Thou knewest by name, and all the ethereal powers,
+All secrets of the deep, all Nature's works,
+Or works of God in Heaven, air, earth, or sea,
+And all the riches of this world enjoyedst,
+And all the rule, one empire; only add
+Deeds to thy knowledge answerable; add faith,
+Add virtue, patience, temperance; add love,
+By name to come called charity, the soul
+Of all the rest: then wilt thou not be loth
+To leave this Paradise, but shalt possess
+A Paradise within thee, happier far.--
+Let us descend now therefore from this top
+Of speculation; for the hour precise
+Exacts our parting hence; and see!the guards,
+By me encamped on yonder hill, expect
+Their motion; at whose front a flaming sword,
+In signal of remove, waves fiercely round:
+We may no longer stay: go, waken Eve;
+Her also I with gentle dreams have calmed
+Portending good, and all her spirits composed
+To meek submission: thou, at season fit,
+Let her with thee partake what thou hast heard;
+Chiefly what may concern her faith to know,
+The great deliverance by her seed to come
+(For by the Woman's seed) on all mankind:
+That ye may live, which will be many days,
+Both in one faith unanimous, though sad,
+With cause, for evils past; yet much more cheered
+With meditation on the happy end.
+He ended, and they both descend the hill;
+Descended, Adam to the bower, where Eve
+Lay sleeping, ran before; but found her waked;
+And thus with words not sad she him received.
+Whence thou returnest, and whither wentest, I know;
+For God is also in sleep; and dreams advise,
+Which he hath sent propitious, some great good
+Presaging, since with sorrow and heart's distress
+Wearied I fell asleep: But now lead on;
+In me is no delay; with thee to go,
+Is to stay here; without thee here to stay,
+Is to go hence unwilling; thou to me
+Art all things under $Heaven, all places thou,
+Who for my wilful crime art banished hence.
+This further consolation yet secure
+I carry hence; though all by me is lost,
+Such favour I unworthy am vouchsafed,
+By me the Promised Seed shall all restore.
+So spake our mother Eve; and Adam heard
+Well pleased, but answered not: For now, too nigh
+The Arch-Angel stood; and, from the other hill
+To their fixed station, all in bright array
+The Cherubim descended; on the ground
+Gliding meteorous, as evening-mist
+Risen from a river o'er the marish glides,
+And gathers ground fast at the labourer's heel
+Homeward returning. High in front advanced,
+The brandished sword of God before them blazed,
+Fierce as a comet; which with torrid heat,
+And vapour as the Libyan air adust,
+Began to parch that temperate clime; whereat
+In either hand the hastening Angel caught
+Our lingering parents, and to the eastern gate
+Led them direct, and down the cliff as fast
+To the subjected plain; then disappeared.
+They, looking back, all the eastern side beheld
+Of Paradise, so late their happy seat,
+Waved over by that flaming brand; the gate
+With dreadful faces thronged, and fiery arms:
+Some natural tears they dropt, but wiped them soon;
+The world was all before them, where to choose
+Their place of rest, and Providence their guide:
+They, hand in hand, with wandering steps and slow,
+Through Eden took their solitary way.
+
+[The End]
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/plrabn12.txt.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/plrabn12.txt.compressed
new file mode 100644
index 000000000..1750fa5c7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/plrabn12.txt.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox
new file mode 100644
index 000000000..ff3bb6394
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox
@@ -0,0 +1 @@
+The quick brown fox jumps over the lazy dog \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox.compressed
new file mode 100644
index 000000000..b5deebc42
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox.compressed
@@ -0,0 +1 @@
+ €The quick brown fox jumps over the lazy dog \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox_repeated b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox_repeated
new file mode 100644
index 000000000..2ed134ebc
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox_repeated
@@ -0,0 +1 @@
+The quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy dog \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox_repeated.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox_repeated.compressed
new file mode 100644
index 000000000..f9d797678
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/quickfox_repeated.compressed
@@ -0,0 +1,2 @@
+[ÿ¯À"y\ûZŒB;ô%UZ’™±5Èžž
+{K¹<˜È @óæÙMäme'‡_¦é0–{<ØS \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/random_chunks b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/random_chunks
new file mode 100644
index 000000000..c014f0b3a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/random_chunks
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/random_org_10k.bin b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/random_org_10k.bin
new file mode 100644
index 000000000..faf8a3a7b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/random_org_10k.bin
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/random_org_10k.bin.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/random_org_10k.bin.compressed
new file mode 100644
index 000000000..5ffbaa049
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/random_org_10k.bin.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/ukkonooa b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/ukkonooa
new file mode 100644
index 000000000..1072b69b4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/ukkonooa
@@ -0,0 +1 @@
+ukko nooa, ukko nooa oli kunnon mies, kun han meni saunaan, pisti laukun naulaan, ukko nooa, ukko nooa oli kunnon mies. \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/ukkonooa.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/ukkonooa.compressed
new file mode 100644
index 000000000..f39f068d7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/ukkonooa.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x
new file mode 100644
index 000000000..500c0709c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x
@@ -0,0 +1 @@
+X \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed
new file mode 100644
index 000000000..2a44b5def
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.00 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.00
new file mode 100644
index 000000000..33e3a98e0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.00
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.01 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.01
new file mode 100644
index 000000000..9c8249b16
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.01
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.02 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.02
new file mode 100644
index 000000000..3a5890db7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.02
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.03 b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.03
new file mode 100644
index 000000000..842e7995c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/x.compressed.03
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/xyzzy b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/xyzzy
new file mode 100644
index 000000000..fbfb23d1e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/xyzzy
@@ -0,0 +1 @@
+Xyzzy \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/xyzzy.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/xyzzy.compressed
new file mode 100644
index 000000000..e6982cef4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/xyzzy.compressed
@@ -0,0 +1 @@
+ €Xyzzy \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/zeros b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/zeros
new file mode 100644
index 000000000..6d23118f0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/zeros
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/zeros.compressed b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/zeros.compressed
new file mode 100644
index 000000000..bf05b53c1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/testdata/zeros.compressed
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/C/Common/BasePeCoff.c b/roms/edk2/BaseTools/Source/C/Common/BasePeCoff.c
new file mode 100644
index 000000000..62fbb2985
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/BasePeCoff.c
@@ -0,0 +1,1469 @@
+/** @file
+
+ Functions to get info and load PE/COFF image.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
+Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Common/UefiBaseTypes.h>
+#include <CommonLib.h>
+#include <IndustryStandard/PeImage.h>
+#include "PeCoffLib.h"
+
+typedef union {
+ VOID *Header;
+ EFI_IMAGE_OPTIONAL_HEADER32 *Optional32;
+ EFI_IMAGE_OPTIONAL_HEADER64 *Optional64;
+} EFI_IMAGE_OPTIONAL_HEADER_POINTER;
+
+STATIC
+RETURN_STATUS
+PeCoffLoaderGetPeHeader (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
+ OUT EFI_IMAGE_OPTIONAL_HEADER_UNION **PeHdr,
+ OUT EFI_TE_IMAGE_HEADER **TeHdr
+ );
+
+STATIC
+RETURN_STATUS
+PeCoffLoaderCheckImageType (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
+ IN EFI_IMAGE_OPTIONAL_HEADER_UNION *PeHdr,
+ IN EFI_TE_IMAGE_HEADER *TeHdr
+ );
+
+STATIC
+VOID *
+PeCoffLoaderImageAddress (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
+ IN UINTN Address
+ );
+
+RETURN_STATUS
+PeCoffLoaderRelocateIa32Image (
+ IN UINT16 *Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
+ );
+
+
+RETURN_STATUS
+PeCoffLoaderRelocateArmImage (
+ IN UINT16 **Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
+ );
+
+RETURN_STATUS
+PeCoffLoaderRelocateRiscVImage (
+ IN UINT16 *Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
+ );
+
+STATIC
+RETURN_STATUS
+PeCoffLoaderGetPeHeader (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
+ OUT EFI_IMAGE_OPTIONAL_HEADER_UNION **PeHdr,
+ OUT EFI_TE_IMAGE_HEADER **TeHdr
+ )
+/*++
+
+Routine Description:
+
+ Retrieves the PE or TE Header from a PE/COFF or TE image
+
+Arguments:
+
+ ImageContext - The context of the image being loaded
+
+ PeHdr - The buffer in which to return the PE header
+
+ TeHdr - The buffer in which to return the TE header
+
+Returns:
+
+ RETURN_SUCCESS if the PE or TE Header is read,
+ Otherwise, the error status from reading the PE/COFF or TE image using the ImageRead function.
+
+--*/
+{
+ RETURN_STATUS Status;
+ EFI_IMAGE_DOS_HEADER DosHdr;
+ UINTN Size;
+
+ ImageContext->IsTeImage = FALSE;
+ //
+ // Read the DOS image headers
+ //
+ Size = sizeof (EFI_IMAGE_DOS_HEADER);
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ 0,
+ &Size,
+ &DosHdr
+ );
+ if (RETURN_ERROR (Status)) {
+ ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+ return Status;
+ }
+
+ ImageContext->PeCoffHeaderOffset = 0;
+ if (DosHdr.e_magic == EFI_IMAGE_DOS_SIGNATURE) {
+ //
+ // DOS image header is present, so read the PE header after the DOS image header
+ //
+ ImageContext->PeCoffHeaderOffset = DosHdr.e_lfanew;
+ }
+ //
+ // Get the PE/COFF Header pointer
+ //
+ *PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) ((UINTN)ImageContext->Handle + ImageContext->PeCoffHeaderOffset);
+ if ((*PeHdr)->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
+ //
+ // Check the PE/COFF Header Signature. If not, then try to get a TE header
+ //
+ *TeHdr = (EFI_TE_IMAGE_HEADER *)*PeHdr;
+ if ((*TeHdr)->Signature != EFI_TE_IMAGE_HEADER_SIGNATURE) {
+ return RETURN_UNSUPPORTED;
+ }
+ ImageContext->IsTeImage = TRUE;
+ }
+
+ return RETURN_SUCCESS;
+}
+
+STATIC
+RETURN_STATUS
+PeCoffLoaderCheckImageType (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
+ IN EFI_IMAGE_OPTIONAL_HEADER_UNION *PeHdr,
+ IN EFI_TE_IMAGE_HEADER *TeHdr
+ )
+/*++
+
+Routine Description:
+
+ Checks the PE or TE header of a PE/COFF or TE image to determine if it supported
+
+Arguments:
+
+ ImageContext - The context of the image being loaded
+
+ PeHdr - The buffer in which to return the PE header
+
+ TeHdr - The buffer in which to return the TE header
+
+Returns:
+
+ RETURN_SUCCESS if the PE/COFF or TE image is supported
+ RETURN_UNSUPPORTED of the PE/COFF or TE image is not supported.
+
+--*/
+{
+ //
+ // See if the machine type is supported.
+ // We support a native machine type (IA-32/Itanium-based)
+ //
+ if (ImageContext->IsTeImage == FALSE) {
+ ImageContext->Machine = PeHdr->Pe32.FileHeader.Machine;
+ } else {
+ ImageContext->Machine = TeHdr->Machine;
+ }
+
+ if (ImageContext->Machine != EFI_IMAGE_MACHINE_IA32 && \
+ ImageContext->Machine != EFI_IMAGE_MACHINE_X64 && \
+ ImageContext->Machine != EFI_IMAGE_MACHINE_ARMT && \
+ ImageContext->Machine != EFI_IMAGE_MACHINE_EBC && \
+ ImageContext->Machine != EFI_IMAGE_MACHINE_AARCH64 && \
+ ImageContext->Machine != EFI_IMAGE_MACHINE_RISCV64) {
+ if (ImageContext->Machine == IMAGE_FILE_MACHINE_ARM) {
+ //
+ // There are two types of ARM images. Pure ARM and ARM/Thumb.
+ // If we see the ARM say it is the ARM/Thumb so there is only
+ // a single machine type we need to check for ARM.
+ //
+ ImageContext->Machine = EFI_IMAGE_MACHINE_ARMT;
+ if (ImageContext->IsTeImage == FALSE) {
+ PeHdr->Pe32.FileHeader.Machine = ImageContext->Machine;
+ } else {
+ TeHdr->Machine = ImageContext->Machine;
+ }
+
+ } else {
+ //
+ // unsupported PeImage machine type
+ //
+ return RETURN_UNSUPPORTED;
+ }
+ }
+
+ //
+ // See if the image type is supported. We support EFI Applications,
+ // EFI Boot Service Drivers, EFI Runtime Drivers and EFI SAL Drivers.
+ //
+ if (ImageContext->IsTeImage == FALSE) {
+ ImageContext->ImageType = PeHdr->Pe32.OptionalHeader.Subsystem;
+ } else {
+ ImageContext->ImageType = (UINT16) (TeHdr->Subsystem);
+ }
+
+ if (ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION && \
+ ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER && \
+ ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER && \
+ ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER) {
+ //
+ // unsupported PeImage subsystem type
+ //
+ return RETURN_UNSUPPORTED;
+ }
+
+ return RETURN_SUCCESS;
+}
+
+RETURN_STATUS
+EFIAPI
+PeCoffLoaderGetImageInfo (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ )
+/*++
+
+Routine Description:
+
+ Retrieves information on a PE/COFF image
+
+Arguments:
+
+ This - Calling context
+ ImageContext - The context of the image being loaded
+
+Returns:
+
+ RETURN_SUCCESS - The information on the PE/COFF image was collected.
+ RETURN_INVALID_PARAMETER - ImageContext is NULL.
+ RETURN_UNSUPPORTED - The PE/COFF image is not supported.
+ Otherwise - The error status from reading the PE/COFF image using the
+ ImageContext->ImageRead() function
+
+--*/
+{
+ RETURN_STATUS Status;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *PeHdr;
+ EFI_TE_IMAGE_HEADER *TeHdr;
+ EFI_IMAGE_DATA_DIRECTORY *DebugDirectoryEntry;
+ UINTN Size;
+ UINTN Index;
+ UINTN DebugDirectoryEntryRva;
+ UINTN DebugDirectoryEntryFileOffset;
+ UINTN SectionHeaderOffset;
+ EFI_IMAGE_SECTION_HEADER SectionHeader;
+ EFI_IMAGE_DEBUG_DIRECTORY_ENTRY DebugEntry;
+ EFI_IMAGE_OPTIONAL_HEADER_POINTER OptionHeader;
+
+ PeHdr = NULL;
+ TeHdr = NULL;
+ DebugDirectoryEntry = NULL;
+ DebugDirectoryEntryRva = 0;
+
+ if (NULL == ImageContext) {
+ return RETURN_INVALID_PARAMETER;
+ }
+ //
+ // Assume success
+ //
+ ImageContext->ImageError = IMAGE_ERROR_SUCCESS;
+
+ Status = PeCoffLoaderGetPeHeader (ImageContext, &PeHdr, &TeHdr);
+ if (RETURN_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Verify machine type
+ //
+ Status = PeCoffLoaderCheckImageType (ImageContext, PeHdr, TeHdr);
+ if (RETURN_ERROR (Status)) {
+ return Status;
+ }
+ OptionHeader.Header = (VOID *) &(PeHdr->Pe32.OptionalHeader);
+
+ //
+ // Retrieve the base address of the image
+ //
+ if (!(ImageContext->IsTeImage)) {
+ if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ ImageContext->ImageAddress = (PHYSICAL_ADDRESS) OptionHeader.Optional32->ImageBase;
+ } else {
+ ImageContext->ImageAddress = (PHYSICAL_ADDRESS) OptionHeader.Optional64->ImageBase;
+ }
+ } else {
+ ImageContext->ImageAddress = (PHYSICAL_ADDRESS) (TeHdr->ImageBase + TeHdr->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER));
+ }
+ //
+ // Initialize the alternate destination address to 0 indicating that it
+ // should not be used.
+ //
+ ImageContext->DestinationAddress = 0;
+
+ //
+ // Initialize the codeview pointer.
+ //
+ ImageContext->CodeView = NULL;
+ ImageContext->PdbPointer = NULL;
+
+ //
+ // Three cases with regards to relocations:
+ // - Image has base relocs, RELOCS_STRIPPED==0 => image is relocatable
+ // - Image has no base relocs, RELOCS_STRIPPED==1 => Image is not relocatable
+ // - Image has no base relocs, RELOCS_STRIPPED==0 => Image is relocatable but
+ // has no base relocs to apply
+ // Obviously having base relocations with RELOCS_STRIPPED==1 is invalid.
+ //
+ // Look at the file header to determine if relocations have been stripped, and
+ // save this info in the image context for later use.
+ //
+ if ((!(ImageContext->IsTeImage)) && ((PeHdr->Pe32.FileHeader.Characteristics & EFI_IMAGE_FILE_RELOCS_STRIPPED) != 0)) {
+ ImageContext->RelocationsStripped = TRUE;
+ } else if ((ImageContext->IsTeImage) && (TeHdr->DataDirectory[0].Size == 0) && (TeHdr->DataDirectory[0].VirtualAddress == 0)) {
+ ImageContext->RelocationsStripped = TRUE;
+ } else {
+ ImageContext->RelocationsStripped = FALSE;
+ }
+
+ if (!(ImageContext->IsTeImage)) {
+
+ if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ ImageContext->ImageSize = (UINT64) OptionHeader.Optional32->SizeOfImage;
+ ImageContext->SectionAlignment = OptionHeader.Optional32->SectionAlignment;
+ ImageContext->SizeOfHeaders = OptionHeader.Optional32->SizeOfHeaders;
+
+ //
+ // Modify ImageSize to contain .PDB file name if required and initialize
+ // PdbRVA field...
+ //
+ if (OptionHeader.Optional32->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
+ DebugDirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *) &(OptionHeader.Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+ DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress;
+ }
+ } else {
+ ImageContext->ImageSize = (UINT64) OptionHeader.Optional64->SizeOfImage;
+ ImageContext->SectionAlignment = OptionHeader.Optional64->SectionAlignment;
+ ImageContext->SizeOfHeaders = OptionHeader.Optional64->SizeOfHeaders;
+
+ //
+ // Modify ImageSize to contain .PDB file name if required and initialize
+ // PdbRVA field...
+ //
+ if (OptionHeader.Optional64->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
+ DebugDirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *) &(OptionHeader.Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+ DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress;
+ }
+ }
+
+ if (DebugDirectoryEntryRva != 0) {
+ //
+ // Determine the file offset of the debug directory... This means we walk
+ // the sections to find which section contains the RVA of the debug
+ // directory
+ //
+ DebugDirectoryEntryFileOffset = 0;
+
+ SectionHeaderOffset = (UINTN)(
+ ImageContext->PeCoffHeaderOffset +
+ sizeof (UINT32) +
+ sizeof (EFI_IMAGE_FILE_HEADER) +
+ PeHdr->Pe32.FileHeader.SizeOfOptionalHeader
+ );
+
+ for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index++) {
+ //
+ // Read section header from file
+ //
+ Size = sizeof (EFI_IMAGE_SECTION_HEADER);
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ SectionHeaderOffset,
+ &Size,
+ &SectionHeader
+ );
+ if (RETURN_ERROR (Status)) {
+ ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+ return Status;
+ }
+
+ if (DebugDirectoryEntryRva >= SectionHeader.VirtualAddress &&
+ DebugDirectoryEntryRva < SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize) {
+ DebugDirectoryEntryFileOffset =
+ DebugDirectoryEntryRva - SectionHeader.VirtualAddress + SectionHeader.PointerToRawData;
+ break;
+ }
+
+ SectionHeaderOffset += sizeof (EFI_IMAGE_SECTION_HEADER);
+ }
+
+ if (DebugDirectoryEntryFileOffset != 0) {
+ for (Index = 0; Index < DebugDirectoryEntry->Size; Index += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)) {
+ //
+ // Read next debug directory entry
+ //
+ Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ DebugDirectoryEntryFileOffset + Index,
+ &Size,
+ &DebugEntry
+ );
+ if (RETURN_ERROR (Status)) {
+ ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+ return Status;
+ }
+
+ if (DebugEntry.Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
+ ImageContext->DebugDirectoryEntryRva = (UINT32) (DebugDirectoryEntryRva + Index);
+ if (DebugEntry.RVA == 0 && DebugEntry.FileOffset != 0) {
+ ImageContext->ImageSize += DebugEntry.SizeOfData;
+ }
+
+ return RETURN_SUCCESS;
+ }
+ }
+ }
+ }
+ } else {
+ ImageContext->ImageSize = 0;
+ ImageContext->SectionAlignment = 4096;
+ ImageContext->SizeOfHeaders = sizeof (EFI_TE_IMAGE_HEADER) + (UINTN) TeHdr->BaseOfCode - (UINTN) TeHdr->StrippedSize;
+
+ DebugDirectoryEntry = &TeHdr->DataDirectory[1];
+ DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress;
+ SectionHeaderOffset = (UINTN) (sizeof (EFI_TE_IMAGE_HEADER));
+
+ DebugDirectoryEntryFileOffset = 0;
+
+ for (Index = 0; Index < TeHdr->NumberOfSections;) {
+ //
+ // Read section header from file
+ //
+ Size = sizeof (EFI_IMAGE_SECTION_HEADER);
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ SectionHeaderOffset,
+ &Size,
+ &SectionHeader
+ );
+ if (RETURN_ERROR (Status)) {
+ ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+ return Status;
+ }
+
+ if (DebugDirectoryEntryRva >= SectionHeader.VirtualAddress &&
+ DebugDirectoryEntryRva < SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize) {
+ DebugDirectoryEntryFileOffset = DebugDirectoryEntryRva -
+ SectionHeader.VirtualAddress +
+ SectionHeader.PointerToRawData +
+ sizeof (EFI_TE_IMAGE_HEADER) -
+ TeHdr->StrippedSize;
+
+ //
+ // File offset of the debug directory was found, if this is not the last
+ // section, then skip to the last section for calculating the image size.
+ //
+ if (Index < (UINTN) TeHdr->NumberOfSections - 1) {
+ SectionHeaderOffset += (TeHdr->NumberOfSections - 1 - Index) * sizeof (EFI_IMAGE_SECTION_HEADER);
+ Index = TeHdr->NumberOfSections - 1;
+ continue;
+ }
+ }
+
+ //
+ // In Te image header there is not a field to describe the ImageSize.
+ // Actually, the ImageSize equals the RVA plus the VirtualSize of
+ // the last section mapped into memory (Must be rounded up to
+ // a multiple of Section Alignment). Per the PE/COFF specification, the
+ // section headers in the Section Table must appear in order of the RVA
+ // values for the corresponding sections. So the ImageSize can be determined
+ // by the RVA and the VirtualSize of the last section header in the
+ // Section Table.
+ //
+ if ((++Index) == (UINTN) TeHdr->NumberOfSections) {
+ ImageContext->ImageSize = (SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize +
+ ImageContext->SectionAlignment - 1) & ~(ImageContext->SectionAlignment - 1);
+ }
+
+ SectionHeaderOffset += sizeof (EFI_IMAGE_SECTION_HEADER);
+ }
+
+ if (DebugDirectoryEntryFileOffset != 0) {
+ for (Index = 0; Index < DebugDirectoryEntry->Size; Index += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)) {
+ //
+ // Read next debug directory entry
+ //
+ Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ DebugDirectoryEntryFileOffset,
+ &Size,
+ &DebugEntry
+ );
+ if (RETURN_ERROR (Status)) {
+ ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+ return Status;
+ }
+
+ if (DebugEntry.Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
+ ImageContext->DebugDirectoryEntryRva = (UINT32) (DebugDirectoryEntryRva + Index);
+ return RETURN_SUCCESS;
+ }
+ }
+ }
+ }
+
+ return RETURN_SUCCESS;
+}
+
+STATIC
+VOID *
+PeCoffLoaderImageAddress (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
+ IN UINTN Address
+ )
+/*++
+
+Routine Description:
+
+ Converts an image address to the loaded address
+
+Arguments:
+
+ ImageContext - The context of the image being loaded
+
+ Address - The address to be converted to the loaded address
+
+Returns:
+
+ NULL if the address can not be converted, otherwise, the converted address
+
+--*/
+{
+ if (Address >= ImageContext->ImageSize) {
+ ImageContext->ImageError = IMAGE_ERROR_INVALID_IMAGE_ADDRESS;
+ return NULL;
+ }
+
+ return (UINT8 *) ((UINTN) ImageContext->ImageAddress + Address);
+}
+
+RETURN_STATUS
+EFIAPI
+PeCoffLoaderRelocateImage (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ )
+/*++
+
+Routine Description:
+
+ Relocates a PE/COFF image in memory
+
+Arguments:
+
+ This - Calling context
+
+ ImageContext - Contains information on the loaded image to relocate
+
+Returns:
+
+ RETURN_SUCCESS if the PE/COFF image was relocated
+ RETURN_LOAD_ERROR if the image is not a valid PE/COFF image
+ RETURN_UNSUPPORTED not support
+
+--*/
+{
+ RETURN_STATUS Status;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *PeHdr;
+ EFI_TE_IMAGE_HEADER *TeHdr;
+ EFI_IMAGE_DATA_DIRECTORY *RelocDir;
+ UINT64 Adjust;
+ EFI_IMAGE_BASE_RELOCATION *RelocBase;
+ EFI_IMAGE_BASE_RELOCATION *RelocBaseEnd;
+ UINT16 *Reloc;
+ UINT16 *RelocEnd;
+ CHAR8 *Fixup;
+ CHAR8 *FixupBase;
+ UINT16 *F16;
+ UINT32 *F32;
+ UINT64 *F64;
+ CHAR8 *FixupData;
+ PHYSICAL_ADDRESS BaseAddress;
+ UINT16 MachineType;
+ EFI_IMAGE_OPTIONAL_HEADER_POINTER OptionHeader;
+
+ PeHdr = NULL;
+ TeHdr = NULL;
+ //
+ // Assume success
+ //
+ ImageContext->ImageError = IMAGE_ERROR_SUCCESS;
+
+ //
+ // If there are no relocation entries, then we are done
+ //
+ if (ImageContext->RelocationsStripped) {
+ return RETURN_SUCCESS;
+ }
+
+ //
+ // Use DestinationAddress field of ImageContext as the relocation address even if it is 0.
+ //
+ BaseAddress = ImageContext->DestinationAddress;
+
+ if (!(ImageContext->IsTeImage)) {
+ PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)((UINTN)ImageContext->ImageAddress +
+ ImageContext->PeCoffHeaderOffset);
+ OptionHeader.Header = (VOID *) &(PeHdr->Pe32.OptionalHeader);
+ if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ Adjust = (UINT64) BaseAddress - OptionHeader.Optional32->ImageBase;
+ OptionHeader.Optional32->ImageBase = (UINT32) BaseAddress;
+ MachineType = ImageContext->Machine;
+ //
+ // Find the relocation block
+ //
+ // Per the PE/COFF spec, you can't assume that a given data directory
+ // is present in the image. You have to check the NumberOfRvaAndSizes in
+ // the optional header to verify a desired directory entry is there.
+ //
+ if (OptionHeader.Optional32->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
+ RelocDir = &OptionHeader.Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+ if ((RelocDir != NULL) && (RelocDir->Size > 0)) {
+ RelocBase = PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress);
+ RelocBaseEnd = PeCoffLoaderImageAddress (
+ ImageContext,
+ RelocDir->VirtualAddress + RelocDir->Size - 1
+ );
+ if (RelocBase == NULL || RelocBaseEnd == NULL || RelocBaseEnd < RelocBase) {
+ ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+ return RETURN_LOAD_ERROR;
+ }
+ } else {
+ //
+ // Set base and end to bypass processing below.
+ //
+ RelocBase = RelocBaseEnd = 0;
+ }
+ } else {
+ //
+ // Set base and end to bypass processing below.
+ //
+ RelocBase = RelocBaseEnd = 0;
+ }
+ } else {
+ Adjust = (UINT64) BaseAddress - OptionHeader.Optional64->ImageBase;
+ OptionHeader.Optional64->ImageBase = BaseAddress;
+ MachineType = ImageContext->Machine;
+ //
+ // Find the relocation block
+ //
+ // Per the PE/COFF spec, you can't assume that a given data directory
+ // is present in the image. You have to check the NumberOfRvaAndSizes in
+ // the optional header to verify a desired directory entry is there.
+ //
+ if (OptionHeader.Optional64->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
+ RelocDir = &OptionHeader.Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+ if ((RelocDir != NULL) && (RelocDir->Size > 0)) {
+ RelocBase = PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress);
+ RelocBaseEnd = PeCoffLoaderImageAddress (
+ ImageContext,
+ RelocDir->VirtualAddress + RelocDir->Size - 1
+ );
+ if (RelocBase == NULL || RelocBaseEnd == NULL || RelocBaseEnd < RelocBase) {
+ ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+ return RETURN_LOAD_ERROR;
+ }
+ } else {
+ //
+ // Set base and end to bypass processing below.
+ //
+ RelocBase = RelocBaseEnd = 0;
+ }
+ } else {
+ //
+ // Set base and end to bypass processing below.
+ //
+ RelocBase = RelocBaseEnd = 0;
+ }
+ }
+ } else {
+ TeHdr = (EFI_TE_IMAGE_HEADER *) (UINTN) (ImageContext->ImageAddress);
+ Adjust = (UINT64) (BaseAddress - TeHdr->ImageBase);
+ TeHdr->ImageBase = (UINT64) (BaseAddress);
+ MachineType = TeHdr->Machine;
+
+ //
+ // Find the relocation block
+ //
+ RelocDir = &TeHdr->DataDirectory[0];
+ RelocBase = (EFI_IMAGE_BASE_RELOCATION *)(UINTN)(
+ ImageContext->ImageAddress +
+ RelocDir->VirtualAddress +
+ sizeof(EFI_TE_IMAGE_HEADER) -
+ TeHdr->StrippedSize
+ );
+ RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *) ((UINTN) RelocBase + (UINTN) RelocDir->Size - 1);
+ }
+
+ //
+ // Run the relocation information and apply the fixups
+ //
+ FixupData = ImageContext->FixupData;
+ while (RelocBase < RelocBaseEnd) {
+
+ Reloc = (UINT16 *) ((CHAR8 *) RelocBase + sizeof (EFI_IMAGE_BASE_RELOCATION));
+ RelocEnd = (UINT16 *) ((CHAR8 *) RelocBase + RelocBase->SizeOfBlock);
+ if (!(ImageContext->IsTeImage)) {
+ FixupBase = PeCoffLoaderImageAddress (ImageContext, RelocBase->VirtualAddress);
+ if (FixupBase == NULL) {
+ ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+ return RETURN_LOAD_ERROR;
+ }
+ } else {
+ FixupBase = (CHAR8 *)(UINTN)(ImageContext->ImageAddress +
+ RelocBase->VirtualAddress +
+ sizeof(EFI_TE_IMAGE_HEADER) -
+ TeHdr->StrippedSize
+ );
+ }
+
+ if ((CHAR8 *) RelocEnd < (CHAR8 *) ((UINTN) ImageContext->ImageAddress) ||
+ (CHAR8 *) RelocEnd > (CHAR8 *)((UINTN)ImageContext->ImageAddress +
+ (UINTN)ImageContext->ImageSize)) {
+ ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+ return RETURN_LOAD_ERROR;
+ }
+
+ //
+ // Run this relocation record
+ //
+ while (Reloc < RelocEnd) {
+
+ Fixup = FixupBase + (*Reloc & 0xFFF);
+ switch ((*Reloc) >> 12) {
+ case EFI_IMAGE_REL_BASED_ABSOLUTE:
+ break;
+
+ case EFI_IMAGE_REL_BASED_HIGH:
+ F16 = (UINT16 *) Fixup;
+ *F16 = (UINT16) (*F16 + ((UINT16) ((UINT32) Adjust >> 16)));
+ if (FixupData != NULL) {
+ *(UINT16 *) FixupData = *F16;
+ FixupData = FixupData + sizeof (UINT16);
+ }
+ break;
+
+ case EFI_IMAGE_REL_BASED_LOW:
+ F16 = (UINT16 *) Fixup;
+ *F16 = (UINT16) (*F16 + (UINT16) Adjust);
+ if (FixupData != NULL) {
+ *(UINT16 *) FixupData = *F16;
+ FixupData = FixupData + sizeof (UINT16);
+ }
+ break;
+
+ case EFI_IMAGE_REL_BASED_HIGHLOW:
+ F32 = (UINT32 *) Fixup;
+ *F32 = *F32 + (UINT32) Adjust;
+ if (FixupData != NULL) {
+ FixupData = ALIGN_POINTER (FixupData, sizeof (UINT32));
+ *(UINT32 *) FixupData = *F32;
+ FixupData = FixupData + sizeof (UINT32);
+ }
+ break;
+
+ case EFI_IMAGE_REL_BASED_DIR64:
+ F64 = (UINT64 *) Fixup;
+ *F64 = *F64 + (UINT64) Adjust;
+ if (FixupData != NULL) {
+ FixupData = ALIGN_POINTER (FixupData, sizeof (UINT64));
+ *(UINT64 *) FixupData = *F64;
+ FixupData = FixupData + sizeof (UINT64);
+ }
+ break;
+
+ case EFI_IMAGE_REL_BASED_HIGHADJ:
+ //
+ // Return the same EFI_UNSUPPORTED return code as
+ // PeCoffLoaderRelocateImageEx() returns if it does not recognize
+ // the relocation type.
+ //
+ ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+ return RETURN_UNSUPPORTED;
+
+ default:
+ switch (MachineType) {
+ case EFI_IMAGE_MACHINE_IA32:
+ Status = PeCoffLoaderRelocateIa32Image (Reloc, Fixup, &FixupData, Adjust);
+ break;
+ case EFI_IMAGE_MACHINE_ARMT:
+ Status = PeCoffLoaderRelocateArmImage (&Reloc, Fixup, &FixupData, Adjust);
+ break;
+ case EFI_IMAGE_MACHINE_RISCV64:
+ Status = PeCoffLoaderRelocateRiscVImage (Reloc, Fixup, &FixupData, Adjust);
+ break;
+ default:
+ Status = RETURN_UNSUPPORTED;
+ break;
+ }
+ if (RETURN_ERROR (Status)) {
+ ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+ return Status;
+ }
+ }
+
+ //
+ // Next relocation record
+ //
+ Reloc += 1;
+ }
+
+ //
+ // Next reloc block
+ //
+ RelocBase = (EFI_IMAGE_BASE_RELOCATION *) RelocEnd;
+ }
+
+ return RETURN_SUCCESS;
+}
+
+RETURN_STATUS
+EFIAPI
+PeCoffLoaderLoadImage (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ )
+/*++
+
+Routine Description:
+
+ Loads a PE/COFF image into memory
+
+Arguments:
+
+ This - Calling context
+
+ ImageContext - Contains information on image to load into memory
+
+Returns:
+
+ RETURN_SUCCESS if the PE/COFF image was loaded
+ RETURN_BUFFER_TOO_SMALL if the caller did not provide a large enough buffer
+ RETURN_LOAD_ERROR if the image is a runtime driver with no relocations
+ RETURN_INVALID_PARAMETER if the image address is invalid
+
+--*/
+{
+ RETURN_STATUS Status;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *PeHdr;
+ EFI_TE_IMAGE_HEADER *TeHdr;
+ PE_COFF_LOADER_IMAGE_CONTEXT CheckContext;
+ EFI_IMAGE_SECTION_HEADER *FirstSection;
+ EFI_IMAGE_SECTION_HEADER *Section;
+ UINTN NumberOfSections;
+ UINTN Index;
+ CHAR8 *Base;
+ CHAR8 *End;
+ CHAR8 *MaxEnd;
+ EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
+ EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
+ UINTN Size;
+ UINT32 TempDebugEntryRva;
+ EFI_IMAGE_OPTIONAL_HEADER_POINTER OptionHeader;
+
+ PeHdr = NULL;
+ TeHdr = NULL;
+ OptionHeader.Header = NULL;
+ //
+ // Assume success
+ //
+ ImageContext->ImageError = IMAGE_ERROR_SUCCESS;
+
+ //
+ // Copy the provided context info into our local version, get what we
+ // can from the original image, and then use that to make sure everything
+ // is legit.
+ //
+ CopyMem (&CheckContext, ImageContext, sizeof (PE_COFF_LOADER_IMAGE_CONTEXT));
+
+ Status = PeCoffLoaderGetImageInfo (&CheckContext);
+ if (RETURN_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Make sure there is enough allocated space for the image being loaded
+ //
+ if (ImageContext->ImageSize < CheckContext.ImageSize) {
+ ImageContext->ImageError = IMAGE_ERROR_INVALID_IMAGE_SIZE;
+ return RETURN_BUFFER_TOO_SMALL;
+ }
+
+ //
+ // If there's no relocations, then make sure it's not a runtime driver,
+ // and that it's being loaded at the linked address.
+ //
+ if (CheckContext.RelocationsStripped) {
+ //
+ // If the image does not contain relocations and it is a runtime driver
+ // then return an error.
+ //
+ if (CheckContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) {
+ ImageContext->ImageError = IMAGE_ERROR_INVALID_SUBSYSTEM;
+ return RETURN_LOAD_ERROR;
+ }
+ //
+ // If the image does not contain relocations, and the requested load address
+ // is not the linked address, then return an error.
+ //
+ if (CheckContext.ImageAddress != ImageContext->ImageAddress) {
+ ImageContext->ImageError = IMAGE_ERROR_INVALID_IMAGE_ADDRESS;
+ return RETURN_INVALID_PARAMETER;
+ }
+ }
+ //
+ // Make sure the allocated space has the proper section alignment
+ //
+ if (!(ImageContext->IsTeImage)) {
+ if ((ImageContext->ImageAddress & (CheckContext.SectionAlignment - 1)) != 0) {
+ ImageContext->ImageError = IMAGE_ERROR_INVALID_SECTION_ALIGNMENT;
+ return RETURN_INVALID_PARAMETER;
+ }
+ }
+ //
+ // Read the entire PE/COFF or TE header into memory
+ //
+ if (!(ImageContext->IsTeImage)) {
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ 0,
+ &ImageContext->SizeOfHeaders,
+ (VOID *) (UINTN) ImageContext->ImageAddress
+ );
+
+ PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)
+ ((UINTN)ImageContext->ImageAddress + ImageContext->PeCoffHeaderOffset);
+
+ OptionHeader.Header = (VOID *) &(PeHdr->Pe32.OptionalHeader);
+
+ FirstSection = (EFI_IMAGE_SECTION_HEADER *) (
+ (UINTN)ImageContext->ImageAddress +
+ ImageContext->PeCoffHeaderOffset +
+ sizeof(UINT32) +
+ sizeof(EFI_IMAGE_FILE_HEADER) +
+ PeHdr->Pe32.FileHeader.SizeOfOptionalHeader
+ );
+ NumberOfSections = (UINTN) (PeHdr->Pe32.FileHeader.NumberOfSections);
+ } else {
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ 0,
+ &ImageContext->SizeOfHeaders,
+ (VOID *) (UINTN) ImageContext->ImageAddress
+ );
+
+ TeHdr = (EFI_TE_IMAGE_HEADER *) (UINTN) (ImageContext->ImageAddress);
+
+ FirstSection = (EFI_IMAGE_SECTION_HEADER *) (
+ (UINTN)ImageContext->ImageAddress +
+ sizeof(EFI_TE_IMAGE_HEADER)
+ );
+ NumberOfSections = (UINTN) (TeHdr->NumberOfSections);
+
+ }
+
+ if (RETURN_ERROR (Status)) {
+ ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+ return RETURN_LOAD_ERROR;
+ }
+
+ //
+ // Load each section of the image
+ //
+ Section = FirstSection;
+ for (Index = 0, MaxEnd = NULL; Index < NumberOfSections; Index++) {
+
+ //
+ // Compute sections address
+ //
+ Base = PeCoffLoaderImageAddress (ImageContext, Section->VirtualAddress);
+ End = PeCoffLoaderImageAddress (
+ ImageContext,
+ Section->VirtualAddress + Section->Misc.VirtualSize - 1
+ );
+
+ //
+ // If the base start or end address resolved to 0, then fail.
+ //
+ if ((Base == NULL) || (End == NULL)) {
+ ImageContext->ImageError = IMAGE_ERROR_SECTION_NOT_LOADED;
+ return RETURN_LOAD_ERROR;
+ }
+
+
+ if (ImageContext->IsTeImage) {
+ Base = (CHAR8 *) ((UINTN) Base + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);
+ End = (CHAR8 *) ((UINTN) End + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);
+ }
+
+ if (End > MaxEnd) {
+ MaxEnd = End;
+ }
+
+ //
+ // Read the section
+ //
+ Size = (UINTN) Section->Misc.VirtualSize;
+ if ((Size == 0) || (Size > Section->SizeOfRawData)) {
+ Size = (UINTN) Section->SizeOfRawData;
+ }
+
+ if (Section->SizeOfRawData) {
+ if (!(ImageContext->IsTeImage)) {
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ Section->PointerToRawData,
+ &Size,
+ Base
+ );
+ } else {
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ Section->PointerToRawData + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize,
+ &Size,
+ Base
+ );
+ }
+
+ if (RETURN_ERROR (Status)) {
+ ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+ return Status;
+ }
+ }
+
+ //
+ // If raw size is less then virt size, zero fill the remaining
+ //
+
+ if (Size < Section->Misc.VirtualSize) {
+ ZeroMem (Base + Size, Section->Misc.VirtualSize - Size);
+ }
+
+ //
+ // Next Section
+ //
+ Section += 1;
+ }
+
+ //
+ // Get image's entry point
+ //
+ if (!(ImageContext->IsTeImage)) {
+ ImageContext->EntryPoint = (PHYSICAL_ADDRESS) (UINTN) PeCoffLoaderImageAddress (
+ ImageContext,
+ PeHdr->Pe32.OptionalHeader.AddressOfEntryPoint
+ );
+ } else {
+ ImageContext->EntryPoint = (UINTN)ImageContext->ImageAddress +
+ (UINTN)TeHdr->AddressOfEntryPoint +
+ (UINTN)sizeof(EFI_TE_IMAGE_HEADER) -
+ (UINTN) TeHdr->StrippedSize;
+ }
+
+ //
+ // Determine the size of the fixup data
+ //
+ // Per the PE/COFF spec, you can't assume that a given data directory
+ // is present in the image. You have to check the NumberOfRvaAndSizes in
+ // the optional header to verify a desired directory entry is there.
+ //
+ if (!(ImageContext->IsTeImage)) {
+ if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ if (OptionHeader.Optional32->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)
+ &OptionHeader.Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+ ImageContext->FixupDataSize = DirectoryEntry->Size / sizeof (UINT16) * sizeof (UINTN);
+ } else {
+ ImageContext->FixupDataSize = 0;
+ }
+ } else {
+ if (OptionHeader.Optional64->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)
+ &OptionHeader.Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+ ImageContext->FixupDataSize = DirectoryEntry->Size / sizeof (UINT16) * sizeof (UINTN);
+ } else {
+ ImageContext->FixupDataSize = 0;
+ }
+ }
+ } else {
+ DirectoryEntry = &TeHdr->DataDirectory[0];
+ ImageContext->FixupDataSize = DirectoryEntry->Size / sizeof (UINT16) * sizeof (UINTN);
+ }
+ //
+ // Consumer must allocate a buffer for the relocation fixup log.
+ // Only used for runtime drivers.
+ //
+ ImageContext->FixupData = NULL;
+
+ //
+ // Load the Codeview info if present
+ //
+ if (ImageContext->DebugDirectoryEntryRva != 0) {
+ if (!(ImageContext->IsTeImage)) {
+ DebugEntry = PeCoffLoaderImageAddress (
+ ImageContext,
+ ImageContext->DebugDirectoryEntryRva
+ );
+ } else {
+ DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)(UINTN)(
+ ImageContext->ImageAddress +
+ ImageContext->DebugDirectoryEntryRva +
+ sizeof(EFI_TE_IMAGE_HEADER) -
+ TeHdr->StrippedSize
+ );
+ }
+
+ if (DebugEntry != NULL) {
+ TempDebugEntryRva = DebugEntry->RVA;
+ if (DebugEntry->RVA == 0 && DebugEntry->FileOffset != 0) {
+ Section--;
+ if ((UINTN) Section->SizeOfRawData < Section->Misc.VirtualSize) {
+ TempDebugEntryRva = Section->VirtualAddress + Section->Misc.VirtualSize;
+ } else {
+ TempDebugEntryRva = Section->VirtualAddress + Section->SizeOfRawData;
+ }
+ }
+
+ if (TempDebugEntryRva != 0) {
+ if (!(ImageContext->IsTeImage)) {
+ ImageContext->CodeView = PeCoffLoaderImageAddress (ImageContext, TempDebugEntryRva);
+ } else {
+ ImageContext->CodeView = (VOID *)(
+ (UINTN)ImageContext->ImageAddress +
+ (UINTN)TempDebugEntryRva +
+ (UINTN)sizeof(EFI_TE_IMAGE_HEADER) -
+ (UINTN) TeHdr->StrippedSize
+ );
+ }
+
+ if (ImageContext->CodeView == NULL) {
+ ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+ return RETURN_LOAD_ERROR;
+ }
+
+ if (DebugEntry->RVA == 0) {
+ Size = DebugEntry->SizeOfData;
+ if (!(ImageContext->IsTeImage)) {
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ DebugEntry->FileOffset,
+ &Size,
+ ImageContext->CodeView
+ );
+ } else {
+ Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ DebugEntry->FileOffset + sizeof (EFI_TE_IMAGE_HEADER) - TeHdr->StrippedSize,
+ &Size,
+ ImageContext->CodeView
+ );
+ //
+ // Should we apply fix up to this field according to the size difference between PE and TE?
+ // Because now we maintain TE header fields unfixed, this field will also remain as they are
+ // in original PE image.
+ //
+ }
+
+ if (RETURN_ERROR (Status)) {
+ ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+ return RETURN_LOAD_ERROR;
+ }
+
+ DebugEntry->RVA = TempDebugEntryRva;
+ }
+
+ switch (*(UINT32 *) ImageContext->CodeView) {
+ case CODEVIEW_SIGNATURE_NB10:
+ ImageContext->PdbPointer = (CHAR8 *) ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY);
+ break;
+
+ case CODEVIEW_SIGNATURE_RSDS:
+ ImageContext->PdbPointer = (CHAR8 *) ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY);
+ break;
+
+ case CODEVIEW_SIGNATURE_MTOC:
+ ImageContext->PdbPointer = (CHAR8 *) ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY);
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Returns a pointer to the PDB file name for a raw PE/COFF image that is not
+ loaded into system memory with the PE/COFF Loader Library functions.
+
+ Returns the PDB file name for the PE/COFF image specified by Pe32Data. If
+ the PE/COFF image specified by Pe32Data is not a valid, then NULL is
+ returned. If the PE/COFF image specified by Pe32Data does not contain a
+ debug directory entry, then NULL is returned. If the debug directory entry
+ in the PE/COFF image specified by Pe32Data does not contain a PDB file name,
+ then NULL is returned.
+ If Pe32Data is NULL, then return NULL.
+
+ @param Pe32Data Pointer to the PE/COFF image that is loaded in system
+ memory.
+
+ @return The PDB file name for the PE/COFF image specified by Pe32Data or NULL
+ if it cannot be retrieved.
+
+**/
+VOID *
+EFIAPI
+PeCoffLoaderGetPdbPointer (
+ IN VOID *Pe32Data
+ )
+{
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
+ EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
+ EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
+ UINTN DirCount;
+ VOID *CodeViewEntryPointer;
+ INTN TEImageAdjust;
+ UINT32 NumberOfRvaAndSizes;
+ UINT16 Magic;
+ EFI_IMAGE_SECTION_HEADER *SectionHeader;
+ UINT32 Index, Index1;
+
+ if (Pe32Data == NULL) {
+ return NULL;
+ }
+
+ TEImageAdjust = 0;
+ DirectoryEntry = NULL;
+ DebugEntry = NULL;
+ NumberOfRvaAndSizes = 0;
+ Index = 0;
+ Index1 = 0;
+ SectionHeader = NULL;
+
+ DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
+ if (EFI_IMAGE_DOS_SIGNATURE == DosHdr->e_magic) {
+ //
+ // DOS image header is present, so read the PE header after the DOS image header.
+ //
+ Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
+ } else {
+ //
+ // DOS image header is not present, so PE header is at the image base.
+ //
+ Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;
+ }
+
+ if (EFI_TE_IMAGE_HEADER_SIGNATURE == Hdr.Te->Signature) {
+ if (Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress != 0) {
+ DirectoryEntry = &Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG];
+ TEImageAdjust = sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize;
+
+ //
+ // Get the DebugEntry offset in the raw data image.
+ //
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);
+ Index = Hdr.Te->NumberOfSections;
+ for (Index1 = 0; Index1 < Index; Index1 ++) {
+ if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
+ (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
+ DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN) Hdr.Te +
+ DirectoryEntry->VirtualAddress -
+ SectionHeader [Index1].VirtualAddress +
+ SectionHeader [Index1].PointerToRawData +
+ TEImageAdjust);
+ break;
+ }
+ }
+ }
+ } else if (EFI_IMAGE_NT_SIGNATURE == Hdr.Pe32->Signature) {
+ //
+ // NOTE: We use Machine field to identify PE32/PE32+, instead of Magic.
+ // It is due to backward-compatibility, for some system might
+ // generate PE32+ image with PE32 Magic.
+ //
+ switch (Hdr.Pe32->FileHeader.Machine) {
+ case EFI_IMAGE_MACHINE_IA32:
+ case EFI_IMAGE_MACHINE_ARMT:
+ //
+ // Assume PE32 image with IA32 Machine field.
+ //
+ Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
+ break;
+ case EFI_IMAGE_MACHINE_X64:
+ //
+ // Assume PE32+ image with X64 Machine field
+ //
+ Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
+ break;
+ default:
+ //
+ // For unknown Machine field, use Magic in optional Header
+ //
+ Magic = Hdr.Pe32->OptionalHeader.Magic;
+ }
+
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
+ (UINT8 *) Hdr.Pe32 +
+ sizeof (UINT32) +
+ sizeof (EFI_IMAGE_FILE_HEADER) +
+ Hdr.Pe32->FileHeader.SizeOfOptionalHeader
+ );
+ Index = Hdr.Pe32->FileHeader.NumberOfSections;
+
+ if (EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC == Magic) {
+ //
+ // Use PE32 offset get Debug Directory Entry
+ //
+ NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+ } else if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
+ //
+ // Use PE32+ offset get Debug Directory Entry
+ //
+ NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+ }
+
+ if (NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_DEBUG || DirectoryEntry->VirtualAddress == 0) {
+ DirectoryEntry = NULL;
+ DebugEntry = NULL;
+ } else {
+ //
+ // Get the DebugEntry offset in the raw data image.
+ //
+ for (Index1 = 0; Index1 < Index; Index1 ++) {
+ if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
+ (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
+ DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (
+ (UINTN) Pe32Data +
+ DirectoryEntry->VirtualAddress -
+ SectionHeader[Index1].VirtualAddress +
+ SectionHeader[Index1].PointerToRawData);
+ break;
+ }
+ }
+ }
+ } else {
+ return NULL;
+ }
+
+ if (NULL == DebugEntry || NULL == DirectoryEntry) {
+ return NULL;
+ }
+
+ //
+ // Scan the directory to find the debug entry.
+ //
+ for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) {
+ if (EFI_IMAGE_DEBUG_TYPE_CODEVIEW == DebugEntry->Type) {
+ if (DebugEntry->SizeOfData > 0) {
+ //
+ // Get the DebugEntry offset in the raw data image.
+ //
+ CodeViewEntryPointer = NULL;
+ for (Index1 = 0; Index1 < Index; Index1 ++) {
+ if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) &&
+ (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
+ CodeViewEntryPointer = (VOID *) (
+ ((UINTN)Pe32Data) +
+ (UINTN) DebugEntry->RVA -
+ SectionHeader[Index1].VirtualAddress +
+ SectionHeader[Index1].PointerToRawData +
+ (UINTN)TEImageAdjust);
+ break;
+ }
+ }
+ if (Index1 >= Index) {
+ //
+ // Can't find CodeViewEntryPointer in raw PE/COFF image.
+ //
+ continue;
+ }
+ switch (* (UINT32 *) CodeViewEntryPointer) {
+ case CODEVIEW_SIGNATURE_NB10:
+ return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));
+ case CODEVIEW_SIGNATURE_RSDS:
+ return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY));
+ case CODEVIEW_SIGNATURE_MTOC:
+ return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY));
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ return NULL;
+}
+
+
+RETURN_STATUS
+EFIAPI
+PeCoffLoaderGetEntryPoint (
+ IN VOID *Pe32Data,
+ OUT VOID **EntryPoint,
+ OUT VOID **BaseOfImage
+ )
+{
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
+
+ DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
+ if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
+ //
+ // DOS image header is present, so read the PE header after the DOS image header.
+ //
+ Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
+ } else {
+ //
+ // DOS image header is not present, so PE header is at the image base.
+ //
+ Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;
+ }
+
+ //
+ // Calculate the entry point relative to the start of the image.
+ // AddressOfEntryPoint is common for PE32 & PE32+
+ //
+ if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
+ *BaseOfImage = (VOID *)(UINTN)(Hdr.Te->ImageBase + Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER));
+ *EntryPoint = (VOID *)((UINTN)*BaseOfImage + (Hdr.Te->AddressOfEntryPoint & 0x0ffffffff) + sizeof(EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize);
+ return RETURN_SUCCESS;
+ } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
+ *EntryPoint = (VOID *)(UINTN)Hdr.Pe32->OptionalHeader.AddressOfEntryPoint;
+ if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ *BaseOfImage = (VOID *)(UINTN)Hdr.Pe32->OptionalHeader.ImageBase;
+ } else {
+ *BaseOfImage = (VOID *)(UINTN)Hdr.Pe32Plus->OptionalHeader.ImageBase;
+ }
+ *EntryPoint = (VOID *)(UINTN)((UINTN)*EntryPoint + (UINTN)*BaseOfImage);
+ return RETURN_SUCCESS;
+ }
+
+ return RETURN_UNSUPPORTED;
+}
diff --git a/roms/edk2/BaseTools/Source/C/Common/BinderFuncs.c b/roms/edk2/BaseTools/Source/C/Common/BinderFuncs.c
new file mode 100644
index 000000000..de835287e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/BinderFuncs.c
@@ -0,0 +1,74 @@
+/** @file
+Binder function implementations for ANSI C libraries.
+
+Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "BinderFuncs.h"
+#include "CommonLib.h"
+#include <stdlib.h>
+#include <string.h>
+
+//
+// Binder Function Implementations
+//
+
+VOID *
+CommonLibBinderAllocate (
+ IN UINTN Size
+ )
+{
+ return (VOID *) malloc (Size);
+}
+
+VOID
+CommonLibBinderFree (
+ IN VOID *Pointer
+ )
+{
+ free (Pointer);
+}
+
+VOID
+CommonLibBinderCopyMem (
+ IN VOID *Destination,
+ IN VOID *Source,
+ IN UINTN Length
+ )
+{
+ memmove (Destination, Source, Length);
+}
+
+VOID
+CommonLibBinderSetMem (
+ IN VOID *Destination,
+ IN UINTN Length,
+ IN UINT8 Value
+ )
+{
+ memset (Destination, Value, Length);
+}
+
+INTN
+CommonLibBinderCompareMem (
+ IN VOID *MemOne,
+ IN VOID *MemTwo,
+ IN UINTN Length
+ )
+{
+ return memcmp (MemOne, MemTwo, Length);
+}
+
+BOOLEAN
+CommonLibBinderCompareGuid (
+ IN EFI_GUID *Guid1,
+ IN EFI_GUID *Guid2
+ )
+{
+ return CompareGuid (Guid1, Guid2) ? FALSE : TRUE;
+}
+
+
+
diff --git a/roms/edk2/BaseTools/Source/C/Common/BinderFuncs.h b/roms/edk2/BaseTools/Source/C/Common/BinderFuncs.h
new file mode 100644
index 000000000..ceaa9cd31
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/BinderFuncs.h
@@ -0,0 +1,61 @@
+/** @file
+Prototypes for binder functions that allow common code to be written which then
+links to implementation of these functions which is appropriate for the specific
+environment that they are running under.
+
+Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef BinderFuncs_h_INCLUDED
+#define BinderFuncs_h_INCLUDED
+
+#include "Common/UefiBaseTypes.h"
+
+//
+// Binder Function Prototypes
+//
+// These binding functions must be implemented externally as appropriate for
+// the environment that the code will be running under.
+//
+
+VOID *
+CommonLibBinderAllocate (
+ IN UINTN Size
+ );
+
+VOID
+CommonLibBinderFree (
+ IN VOID *Pointer
+ );
+
+VOID
+CommonLibBinderCopyMem (
+ IN VOID *Destination,
+ IN VOID *Source,
+ IN UINTN Length
+ );
+
+VOID
+CommonLibBinderSetMem (
+ IN VOID *Destination,
+ IN UINTN Length,
+ IN UINT8 Value
+ );
+
+INTN
+CommonLibBinderCompareMem (
+ IN VOID *MemOne,
+ IN VOID *MemTwo,
+ IN UINTN Length
+ );
+
+BOOLEAN
+CommonLibBinderCompareGuid (
+ IN EFI_GUID *Guid1,
+ IN EFI_GUID *Guid2
+ );
+
+#endif // #ifndef CommonLibs_h_INCLUDED
+
diff --git a/roms/edk2/BaseTools/Source/C/Common/CommonLib.c b/roms/edk2/BaseTools/Source/C/Common/CommonLib.c
new file mode 100644
index 000000000..7fb4ab764
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/CommonLib.c
@@ -0,0 +1,2191 @@
+/** @file
+Common basic Library Functions
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#ifdef __GNUC__
+#include <unistd.h>
+#else
+#include <direct.h>
+#endif
+#include "CommonLib.h"
+#include "EfiUtilityMsgs.h"
+
+#define SAFE_STRING_CONSTRAINT_CHECK(Expression, Status) \
+ do { \
+ ASSERT (Expression); \
+ if (!(Expression)) { \
+ return Status; \
+ } \
+ } while (FALSE)
+
+VOID
+PeiZeroMem (
+ IN VOID *Buffer,
+ IN UINTN Size
+ )
+/*++
+
+Routine Description:
+
+ Set Buffer to zero for Size bytes.
+
+Arguments:
+
+ Buffer - Memory to set.
+
+ Size - Number of bytes to set
+
+Returns:
+
+ None
+
+--*/
+{
+ INT8 *Ptr;
+
+ Ptr = Buffer;
+ while (Size--) {
+ *(Ptr++) = 0;
+ }
+}
+
+VOID
+PeiCopyMem (
+ IN VOID *Destination,
+ IN VOID *Source,
+ IN UINTN Length
+ )
+/*++
+
+Routine Description:
+
+ Copy Length bytes from Source to Destination.
+
+Arguments:
+
+ Destination - Target of copy
+
+ Source - Place to copy from
+
+ Length - Number of bytes to copy
+
+Returns:
+
+ None
+
+--*/
+{
+ CHAR8 *Destination8;
+ CHAR8 *Source8;
+
+ Destination8 = Destination;
+ Source8 = Source;
+ while (Length--) {
+ *(Destination8++) = *(Source8++);
+ }
+}
+
+VOID
+ZeroMem (
+ IN VOID *Buffer,
+ IN UINTN Size
+ )
+{
+ PeiZeroMem (Buffer, Size);
+}
+
+VOID
+CopyMem (
+ IN VOID *Destination,
+ IN VOID *Source,
+ IN UINTN Length
+ )
+{
+ PeiCopyMem (Destination, Source, Length);
+}
+
+INTN
+CompareGuid (
+ IN EFI_GUID *Guid1,
+ IN EFI_GUID *Guid2
+ )
+/*++
+
+Routine Description:
+
+ Compares to GUIDs
+
+Arguments:
+
+ Guid1 - guid to compare
+ Guid2 - guid to compare
+
+Returns:
+ = 0 if Guid1 == Guid2
+ != 0 if Guid1 != Guid2
+
+--*/
+{
+ INT32 *g1;
+ INT32 *g2;
+ INT32 r;
+
+ //
+ // Compare 32 bits at a time
+ //
+ g1 = (INT32 *) Guid1;
+ g2 = (INT32 *) Guid2;
+
+ r = g1[0] - g2[0];
+ r |= g1[1] - g2[1];
+ r |= g1[2] - g2[2];
+ r |= g1[3] - g2[3];
+
+ return r;
+}
+
+
+EFI_STATUS
+GetFileImage (
+ IN CHAR8 *InputFileName,
+ OUT CHAR8 **InputFileImage,
+ OUT UINT32 *BytesRead
+ )
+/*++
+
+Routine Description:
+
+ This function opens a file and reads it into a memory buffer. The function
+ will allocate the memory buffer and returns the size of the buffer.
+
+Arguments:
+
+ InputFileName The name of the file to read.
+ InputFileImage A pointer to the memory buffer.
+ BytesRead The size of the memory buffer.
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully.
+ EFI_INVALID_PARAMETER One of the input parameters was invalid.
+ EFI_ABORTED An error occurred.
+ EFI_OUT_OF_RESOURCES No resource to complete operations.
+
+--*/
+{
+ FILE *InputFile;
+ UINT32 FileSize;
+
+ //
+ // Verify input parameters.
+ //
+ if (InputFileName == NULL || strlen (InputFileName) == 0 || InputFileImage == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Open the file and copy contents into a memory buffer.
+ //
+ //
+ // Open the file
+ //
+ InputFile = fopen (LongFilePath (InputFileName), "rb");
+ if (InputFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening the input file", InputFileName);
+ return EFI_ABORTED;
+ }
+ //
+ // Go to the end so that we can determine the file size
+ //
+ if (fseek (InputFile, 0, SEEK_END)) {
+ Error (NULL, 0, 0004, "Error reading the input file", InputFileName);
+ fclose (InputFile);
+ return EFI_ABORTED;
+ }
+ //
+ // Get the file size
+ //
+ FileSize = ftell (InputFile);
+ if (FileSize == -1) {
+ Error (NULL, 0, 0003, "Error parsing the input file", InputFileName);
+ fclose (InputFile);
+ return EFI_ABORTED;
+ }
+ //
+ // Allocate a buffer
+ //
+ *InputFileImage = malloc (FileSize);
+ if (*InputFileImage == NULL) {
+ fclose (InputFile);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Reset to the beginning of the file
+ //
+ if (fseek (InputFile, 0, SEEK_SET)) {
+ Error (NULL, 0, 0004, "Error reading the input file", InputFileName);
+ fclose (InputFile);
+ free (*InputFileImage);
+ *InputFileImage = NULL;
+ return EFI_ABORTED;
+ }
+ //
+ // Read all of the file contents.
+ //
+ *BytesRead = fread (*InputFileImage, sizeof (UINT8), FileSize, InputFile);
+ if (*BytesRead != sizeof (UINT8) * FileSize) {
+ Error (NULL, 0, 0004, "Error reading the input file", InputFileName);
+ fclose (InputFile);
+ free (*InputFileImage);
+ *InputFileImage = NULL;
+ return EFI_ABORTED;
+ }
+ //
+ // Close the file
+ //
+ fclose (InputFile);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+PutFileImage (
+ IN CHAR8 *OutputFileName,
+ IN CHAR8 *OutputFileImage,
+ IN UINT32 BytesToWrite
+ )
+/*++
+
+Routine Description:
+
+ This function opens a file and writes OutputFileImage into the file.
+
+Arguments:
+
+ OutputFileName The name of the file to write.
+ OutputFileImage A pointer to the memory buffer.
+ BytesToWrite The size of the memory buffer.
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully.
+ EFI_INVALID_PARAMETER One of the input parameters was invalid.
+ EFI_ABORTED An error occurred.
+ EFI_OUT_OF_RESOURCES No resource to complete operations.
+
+--*/
+{
+ FILE *OutputFile;
+ UINT32 BytesWrote;
+
+ //
+ // Verify input parameters.
+ //
+ if (OutputFileName == NULL || strlen (OutputFileName) == 0 || OutputFileImage == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Open the file and copy contents into a memory buffer.
+ //
+ //
+ // Open the file
+ //
+ OutputFile = fopen (LongFilePath (OutputFileName), "wb");
+ if (OutputFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening the output file", OutputFileName);
+ return EFI_ABORTED;
+ }
+
+ //
+ // Write all of the file contents.
+ //
+ BytesWrote = fwrite (OutputFileImage, sizeof (UINT8), BytesToWrite, OutputFile);
+ if (BytesWrote != sizeof (UINT8) * BytesToWrite) {
+ Error (NULL, 0, 0002, "Error writing the output file", OutputFileName);
+ fclose (OutputFile);
+ return EFI_ABORTED;
+ }
+ //
+ // Close the file
+ //
+ fclose (OutputFile);
+
+ return EFI_SUCCESS;
+}
+
+UINT8
+CalculateChecksum8 (
+ IN UINT8 *Buffer,
+ IN UINTN Size
+ )
+/*++
+
+Routine Description:
+
+ This function calculates the value needed for a valid UINT8 checksum
+
+Arguments:
+
+ Buffer Pointer to buffer containing byte data of component.
+ Size Size of the buffer
+
+Returns:
+
+ The 8 bit checksum value needed.
+
+--*/
+{
+ return (UINT8) (0x100 - CalculateSum8 (Buffer, Size));
+}
+
+UINT8
+CalculateSum8 (
+ IN UINT8 *Buffer,
+ IN UINTN Size
+ )
+/*++
+
+Routine Description::
+
+ This function calculates the UINT8 sum for the requested region.
+
+Arguments:
+
+ Buffer Pointer to buffer containing byte data of component.
+ Size Size of the buffer
+
+Returns:
+
+ The 8 bit checksum value needed.
+
+--*/
+{
+ UINTN Index;
+ UINT8 Sum;
+
+ Sum = 0;
+
+ //
+ // Perform the byte sum for buffer
+ //
+ for (Index = 0; Index < Size; Index++) {
+ Sum = (UINT8) (Sum + Buffer[Index]);
+ }
+
+ return Sum;
+}
+
+UINT16
+CalculateChecksum16 (
+ IN UINT16 *Buffer,
+ IN UINTN Size
+ )
+/*++
+
+Routine Description::
+
+ This function calculates the value needed for a valid UINT16 checksum
+
+Arguments:
+
+ Buffer Pointer to buffer containing byte data of component.
+ Size Size of the buffer
+
+Returns:
+
+ The 16 bit checksum value needed.
+
+--*/
+{
+ return (UINT16) (0x10000 - CalculateSum16 (Buffer, Size));
+}
+
+UINT16
+CalculateSum16 (
+ IN UINT16 *Buffer,
+ IN UINTN Size
+ )
+/*++
+
+Routine Description:
+
+ This function calculates the UINT16 sum for the requested region.
+
+Arguments:
+
+ Buffer Pointer to buffer containing byte data of component.
+ Size Size of the buffer
+
+Returns:
+
+ The 16 bit checksum
+
+--*/
+{
+ UINTN Index;
+ UINT16 Sum;
+
+ Sum = 0;
+
+ //
+ // Perform the word sum for buffer
+ //
+ for (Index = 0; Index < Size; Index++) {
+ Sum = (UINT16) (Sum + Buffer[Index]);
+ }
+
+ return (UINT16) Sum;
+}
+
+EFI_STATUS
+PrintGuid (
+ IN EFI_GUID *Guid
+ )
+/*++
+
+Routine Description:
+
+ This function prints a GUID to STDOUT.
+
+Arguments:
+
+ Guid Pointer to a GUID to print.
+
+Returns:
+
+ EFI_SUCCESS The GUID was printed.
+ EFI_INVALID_PARAMETER The input was NULL.
+
+--*/
+{
+ if (Guid == NULL) {
+ Error (NULL, 0, 2000, "Invalid parameter", "PrintGuidToBuffer() called with a NULL value");
+ return EFI_INVALID_PARAMETER;
+ }
+
+ printf (
+ "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
+ (unsigned) Guid->Data1,
+ Guid->Data2,
+ Guid->Data3,
+ Guid->Data4[0],
+ Guid->Data4[1],
+ Guid->Data4[2],
+ Guid->Data4[3],
+ Guid->Data4[4],
+ Guid->Data4[5],
+ Guid->Data4[6],
+ Guid->Data4[7]
+ );
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+PrintGuidToBuffer (
+ IN EFI_GUID *Guid,
+ IN OUT UINT8 *Buffer,
+ IN UINT32 BufferLen,
+ IN BOOLEAN Uppercase
+ )
+/*++
+
+Routine Description:
+
+ This function prints a GUID to a buffer
+
+Arguments:
+
+ Guid - Pointer to a GUID to print.
+ Buffer - Pointer to a user-provided buffer to print to
+ BufferLen - Size of the Buffer
+ Uppercase - If use upper case.
+
+Returns:
+
+ EFI_SUCCESS The GUID was printed.
+ EFI_INVALID_PARAMETER The input was NULL.
+ EFI_BUFFER_TOO_SMALL The input buffer was not big enough
+
+--*/
+{
+ if (Guid == NULL) {
+ Error (NULL, 0, 2000, "Invalid parameter", "PrintGuidToBuffer() called with a NULL value");
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (BufferLen < PRINTED_GUID_BUFFER_SIZE) {
+ Error (NULL, 0, 2000, "Invalid parameter", "PrintGuidToBuffer() called with invalid buffer size");
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ if (Uppercase) {
+ sprintf (
+ (CHAR8 *)Buffer,
+ "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+ (unsigned) Guid->Data1,
+ Guid->Data2,
+ Guid->Data3,
+ Guid->Data4[0],
+ Guid->Data4[1],
+ Guid->Data4[2],
+ Guid->Data4[3],
+ Guid->Data4[4],
+ Guid->Data4[5],
+ Guid->Data4[6],
+ Guid->Data4[7]
+ );
+ } else {
+ sprintf (
+ (CHAR8 *)Buffer,
+ "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ (unsigned) Guid->Data1,
+ Guid->Data2,
+ Guid->Data3,
+ Guid->Data4[0],
+ Guid->Data4[1],
+ Guid->Data4[2],
+ Guid->Data4[3],
+ Guid->Data4[4],
+ Guid->Data4[5],
+ Guid->Data4[6],
+ Guid->Data4[7]
+ );
+ }
+
+ return EFI_SUCCESS;
+}
+
+#ifdef __GNUC__
+
+size_t _filelength(int fd)
+{
+ struct stat stat_buf;
+ fstat(fd, &stat_buf);
+ return stat_buf.st_size;
+}
+
+#ifndef __CYGWIN__
+char *strlwr(char *s)
+{
+ char *p = s;
+ for(;*s;s++) {
+ *s = tolower(*s);
+ }
+ return p;
+}
+#endif
+#endif
+
+#define WINDOWS_EXTENSION_PATH "\\\\?\\"
+#define WINDOWS_UNC_EXTENSION_PATH "\\\\?\\UNC"
+
+//
+// Global data to store full file path. It is not required to be free.
+//
+CHAR8 mCommonLibFullPath[MAX_LONG_FILE_PATH];
+
+CHAR8 *
+LongFilePath (
+ IN CHAR8 *FileName
+ )
+/*++
+
+Routine Description:
+ Convert FileName to the long file path, which can support larger than 260 length.
+
+Arguments:
+ FileName - FileName.
+
+Returns:
+ LongFilePath A pointer to the converted long file path.
+
+--*/
+{
+#ifdef __GNUC__
+ //
+ // __GNUC__ may not be good way to differentiate unix and windows. Need more investigation here.
+ // unix has no limitation on file path. Just return FileName.
+ //
+ return FileName;
+#else
+ CHAR8 *RootPath;
+ CHAR8 *PathPointer;
+ CHAR8 *NextPointer;
+
+ PathPointer = (CHAR8 *) FileName;
+
+ if (FileName != NULL) {
+ //
+ // Add the extension string first to support long file path.
+ //
+ mCommonLibFullPath[0] = 0;
+ strcpy (mCommonLibFullPath, WINDOWS_EXTENSION_PATH);
+
+ if (strlen (FileName) > 1 && FileName[0] == '\\' && FileName[1] == '\\') {
+ //
+ // network path like \\server\share to \\?\UNC\server\share
+ //
+ strcpy (mCommonLibFullPath, WINDOWS_UNC_EXTENSION_PATH);
+ FileName ++;
+ } else if (strlen (FileName) < 3 || FileName[1] != ':' || (FileName[2] != '\\' && FileName[2] != '/')) {
+ //
+ // Relative file path. Convert it to absolute path.
+ //
+ RootPath = getcwd (NULL, 0);
+ if (RootPath != NULL) {
+ if (strlen (mCommonLibFullPath) + strlen (RootPath) > MAX_LONG_FILE_PATH - 1) {
+ Error (NULL, 0, 2000, "Invalid parameter", "RootPath is too long!");
+ free (RootPath);
+ return NULL;
+ }
+ strncat (mCommonLibFullPath, RootPath, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
+ if (FileName[0] != '\\' && FileName[0] != '/') {
+ if (strlen (mCommonLibFullPath) + 1 > MAX_LONG_FILE_PATH - 1) {
+ Error (NULL, 0, 2000, "Invalid parameter", "RootPath is too long!");
+ free (RootPath);
+ return NULL;
+ }
+ //
+ // Attach directory separator
+ //
+ strncat (mCommonLibFullPath, "\\", MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
+ }
+ free (RootPath);
+ }
+ }
+
+ //
+ // Construct the full file path
+ //
+ if (strlen (mCommonLibFullPath) + strlen (FileName) > MAX_LONG_FILE_PATH - 1) {
+ Error (NULL, 0, 2000, "Invalid parameter", "FileName %s is too long!", FileName);
+ return NULL;
+ }
+ strncat (mCommonLibFullPath, FileName, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
+
+ //
+ // Convert directory separator '/' to '\\'
+ //
+ PathPointer = (CHAR8 *) mCommonLibFullPath;
+ do {
+ if (*PathPointer == '/') {
+ *PathPointer = '\\';
+ }
+ } while (*PathPointer ++ != '\0');
+
+ //
+ // Convert ":\\\\" to ":\\", because it doesn't work with WINDOWS_EXTENSION_PATH.
+ //
+ if ((PathPointer = strstr (mCommonLibFullPath, ":\\\\")) != NULL) {
+ *(PathPointer + 2) = '\0';
+ strncat (mCommonLibFullPath, PathPointer + 3, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
+ }
+
+ //
+ // Convert ".\\" to "", because it doesn't work with WINDOWS_EXTENSION_PATH.
+ //
+ while ((PathPointer = strstr (mCommonLibFullPath, ".\\")) != NULL) {
+ *PathPointer = '\0';
+ strncat (mCommonLibFullPath, PathPointer + 2, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
+ }
+
+ //
+ // Convert "\\.\\" to "\\", because it doesn't work with WINDOWS_EXTENSION_PATH.
+ //
+ while ((PathPointer = strstr (mCommonLibFullPath, "\\.\\")) != NULL) {
+ *PathPointer = '\0';
+ strncat (mCommonLibFullPath, PathPointer + 2, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
+ }
+
+ //
+ // Convert "\\..\\" to last directory, because it doesn't work with WINDOWS_EXTENSION_PATH.
+ //
+ while ((PathPointer = strstr (mCommonLibFullPath, "\\..\\")) != NULL) {
+ NextPointer = PathPointer + 3;
+ do {
+ PathPointer --;
+ } while (PathPointer > mCommonLibFullPath && *PathPointer != ':' && *PathPointer != '\\');
+
+ if (*PathPointer == '\\') {
+ //
+ // Skip one directory
+ //
+ *PathPointer = '\0';
+ strncat (mCommonLibFullPath, NextPointer, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
+ } else {
+ //
+ // No directory is found. Just break.
+ //
+ break;
+ }
+ }
+
+ PathPointer = mCommonLibFullPath;
+ }
+
+ return PathPointer;
+#endif
+}
+
+CHAR16
+InternalCharToUpper (
+ CHAR16 Char
+ )
+{
+ if (Char >= L'a' && Char <= L'z') {
+ return (CHAR16) (Char - (L'a' - L'A'));
+ }
+
+ return Char;
+}
+
+UINTN
+StrnLenS (
+ CONST CHAR16 *String,
+ UINTN MaxSize
+ )
+{
+ UINTN Length;
+
+ ASSERT (((UINTN) String & BIT0) == 0);
+
+ //
+ // If String is a null pointer or MaxSize is 0, then the StrnLenS function returns zero.
+ //
+ if ((String == NULL) || (MaxSize == 0)) {
+ return 0;
+ }
+
+ Length = 0;
+ while (String[Length] != 0) {
+ if (Length >= MaxSize - 1) {
+ return MaxSize;
+ }
+ Length++;
+ }
+ return Length;
+}
+
+
+VOID *
+InternalAllocatePool (
+ UINTN AllocationSize
+ )
+{
+ VOID * Memory;
+
+ Memory = malloc(AllocationSize);
+ ASSERT(Memory != NULL);
+ return Memory;
+}
+
+
+VOID *
+InternalReallocatePool (
+ UINTN OldSize,
+ UINTN NewSize,
+ VOID *OldBuffer OPTIONAL
+ )
+{
+ VOID *NewBuffer;
+
+ NewBuffer = AllocateZeroPool (NewSize);
+ if (NewBuffer != NULL && OldBuffer != NULL) {
+ memcpy (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
+ free(OldBuffer);
+ }
+ return NewBuffer;
+}
+
+VOID *
+ReallocatePool (
+ UINTN OldSize,
+ UINTN NewSize,
+ VOID *OldBuffer OPTIONAL
+ )
+{
+ return InternalReallocatePool (OldSize, NewSize, OldBuffer);
+}
+
+/**
+ Returns the length of a Null-terminated Unicode string.
+
+ This function returns the number of Unicode characters in the Null-terminated
+ Unicode string specified by String.
+
+ If String is NULL, then ASSERT().
+ If String is not aligned on a 16-bit boundary, then ASSERT().
+ If PcdMaximumUnicodeStringLength is not zero, and String contains more than
+ PcdMaximumUnicodeStringLength Unicode characters, not including the
+ Null-terminator, then ASSERT().
+
+ @param String A pointer to a Null-terminated Unicode string.
+
+ @return The length of String.
+
+**/
+UINTN
+StrLen (
+ CONST CHAR16 *String
+ )
+{
+ UINTN Length;
+
+ ASSERT (String != NULL);
+ ASSERT (((UINTN) String & BIT0) == 0);
+
+ for (Length = 0; *String != L'\0'; String++, Length++) {
+ //
+ // If PcdMaximumUnicodeStringLength is not zero,
+ // length should not more than PcdMaximumUnicodeStringLength
+ //
+ }
+ return Length;
+}
+
+BOOLEAN
+InternalSafeStringIsOverlap (
+ IN VOID *Base1,
+ IN UINTN Size1,
+ IN VOID *Base2,
+ IN UINTN Size2
+ )
+{
+ if ((((UINTN)Base1 >= (UINTN)Base2) && ((UINTN)Base1 < (UINTN)Base2 + Size2)) ||
+ (((UINTN)Base2 >= (UINTN)Base1) && ((UINTN)Base2 < (UINTN)Base1 + Size1))) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOLEAN
+InternalSafeStringNoStrOverlap (
+ IN CHAR16 *Str1,
+ IN UINTN Size1,
+ IN CHAR16 *Str2,
+ IN UINTN Size2
+ )
+{
+ return !InternalSafeStringIsOverlap (Str1, Size1 * sizeof(CHAR16), Str2, Size2 * sizeof(CHAR16));
+}
+
+/**
+ Convert a Null-terminated Unicode decimal string to a value of type UINT64.
+
+ This function outputs a value of type UINT64 by interpreting the contents of
+ the Unicode string specified by String as a decimal number. The format of the
+ input Unicode string String is:
+
+ [spaces] [decimal digits].
+
+ The valid decimal digit character is in the range [0-9]. The function will
+ ignore the pad space, which includes spaces or tab characters, before
+ [decimal digits]. The running zero in the beginning of [decimal digits] will
+ be ignored. Then, the function stops at the first character that is a not a
+ valid decimal character or a Null-terminator, whichever one comes first.
+
+ If String is NULL, then ASSERT().
+ If Data is NULL, then ASSERT().
+ If String is not aligned in a 16-bit boundary, then ASSERT().
+ If PcdMaximumUnicodeStringLength is not zero, and String contains more than
+ PcdMaximumUnicodeStringLength Unicode characters, not including the
+ Null-terminator, then ASSERT().
+
+ If String has no valid decimal digits in the above format, then 0 is stored
+ at the location pointed to by Data.
+ If the number represented by String exceeds the range defined by UINT64, then
+ MAX_UINT64 is stored at the location pointed to by Data.
+
+ If EndPointer is not NULL, a pointer to the character that stopped the scan
+ is stored at the location pointed to by EndPointer. If String has no valid
+ decimal digits right after the optional pad spaces, the value of String is
+ stored at the location pointed to by EndPointer.
+
+ @param String Pointer to a Null-terminated Unicode string.
+ @param EndPointer Pointer to character that stops scan.
+ @param Data Pointer to the converted value.
+
+ @retval RETURN_SUCCESS Value is translated from String.
+ @retval RETURN_INVALID_PARAMETER If String is NULL.
+ If Data is NULL.
+ If PcdMaximumUnicodeStringLength is not
+ zero, and String contains more than
+ PcdMaximumUnicodeStringLength Unicode
+ characters, not including the
+ Null-terminator.
+ @retval RETURN_UNSUPPORTED If the number represented by String exceeds
+ the range defined by UINT64.
+
+**/
+RETURN_STATUS
+StrDecimalToUint64S (
+ CONST CHAR16 *String,
+ CHAR16 **EndPointer, OPTIONAL
+ UINT64 *Data
+ )
+{
+ ASSERT (((UINTN) String & BIT0) == 0);
+
+ //
+ // 1. Neither String nor Data shall be a null pointer.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER);
+ SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER);
+
+ //
+ // 2. The length of String shall not be greater than RSIZE_MAX.
+ //
+ if (RSIZE_MAX != 0) {
+ SAFE_STRING_CONSTRAINT_CHECK ((StrnLenS (String, RSIZE_MAX + 1) <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
+ }
+
+ if (EndPointer != NULL) {
+ *EndPointer = (CHAR16 *) String;
+ }
+
+ //
+ // Ignore the pad spaces (space or tab)
+ //
+ while ((*String == L' ') || (*String == L'\t')) {
+ String++;
+ }
+
+ //
+ // Ignore leading Zeros after the spaces
+ //
+ while (*String == L'0') {
+ String++;
+ }
+
+ *Data = 0;
+
+ while (InternalIsDecimalDigitCharacter (*String)) {
+ //
+ // If the number represented by String overflows according to the range
+ // defined by UINT64, then MAX_UINT64 is stored in *Data and
+ // RETURN_UNSUPPORTED is returned.
+ //
+ if (*Data > ((MAX_UINT64 - (*String - L'0'))/10)) {
+ *Data = MAX_UINT64;
+ if (EndPointer != NULL) {
+ *EndPointer = (CHAR16 *) String;
+ }
+ return RETURN_UNSUPPORTED;
+ }
+
+ *Data = (*Data) * 10 + (*String - L'0');
+ String++;
+ }
+
+ if (EndPointer != NULL) {
+ *EndPointer = (CHAR16 *) String;
+ }
+ return RETURN_SUCCESS;
+}
+
+/**
+ Convert a Null-terminated Unicode hexadecimal string to a value of type
+ UINT64.
+
+ This function outputs a value of type UINT64 by interpreting the contents of
+ the Unicode string specified by String as a hexadecimal number. The format of
+ the input Unicode string String is:
+
+ [spaces][zeros][x][hexadecimal digits].
+
+ The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
+ The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.
+ If "x" appears in the input string, it must be prefixed with at least one 0.
+ The function will ignore the pad space, which includes spaces or tab
+ characters, before [zeros], [x] or [hexadecimal digit]. The running zero
+ before [x] or [hexadecimal digit] will be ignored. Then, the decoding starts
+ after [x] or the first valid hexadecimal digit. Then, the function stops at
+ the first character that is a not a valid hexadecimal character or NULL,
+ whichever one comes first.
+
+ If String is NULL, then ASSERT().
+ If Data is NULL, then ASSERT().
+ If String is not aligned in a 16-bit boundary, then ASSERT().
+ If PcdMaximumUnicodeStringLength is not zero, and String contains more than
+ PcdMaximumUnicodeStringLength Unicode characters, not including the
+ Null-terminator, then ASSERT().
+
+ If String has no valid hexadecimal digits in the above format, then 0 is
+ stored at the location pointed to by Data.
+ If the number represented by String exceeds the range defined by UINT64, then
+ MAX_UINT64 is stored at the location pointed to by Data.
+
+ If EndPointer is not NULL, a pointer to the character that stopped the scan
+ is stored at the location pointed to by EndPointer. If String has no valid
+ hexadecimal digits right after the optional pad spaces, the value of String
+ is stored at the location pointed to by EndPointer.
+
+ @param String Pointer to a Null-terminated Unicode string.
+ @param EndPointer Pointer to character that stops scan.
+ @param Data Pointer to the converted value.
+
+ @retval RETURN_SUCCESS Value is translated from String.
+ @retval RETURN_INVALID_PARAMETER If String is NULL.
+ If Data is NULL.
+ If PcdMaximumUnicodeStringLength is not
+ zero, and String contains more than
+ PcdMaximumUnicodeStringLength Unicode
+ characters, not including the
+ Null-terminator.
+ @retval RETURN_UNSUPPORTED If the number represented by String exceeds
+ the range defined by UINT64.
+
+**/
+RETURN_STATUS
+StrHexToUint64S (
+ CONST CHAR16 *String,
+ CHAR16 **EndPointer, OPTIONAL
+ UINT64 *Data
+ )
+{
+ ASSERT (((UINTN) String & BIT0) == 0);
+
+ //
+ // 1. Neither String nor Data shall be a null pointer.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER);
+ SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER);
+
+ //
+ // 2. The length of String shall not be greater than RSIZE_MAX.
+ //
+ if (RSIZE_MAX != 0) {
+ SAFE_STRING_CONSTRAINT_CHECK ((StrnLenS (String, RSIZE_MAX + 1) <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
+ }
+
+ if (EndPointer != NULL) {
+ *EndPointer = (CHAR16 *) String;
+ }
+
+ //
+ // Ignore the pad spaces (space or tab)
+ //
+ while ((*String == L' ') || (*String == L'\t')) {
+ String++;
+ }
+
+ //
+ // Ignore leading Zeros after the spaces
+ //
+ while (*String == L'0') {
+ String++;
+ }
+
+ if (InternalCharToUpper (*String) == L'X') {
+ if (*(String - 1) != L'0') {
+ *Data = 0;
+ return RETURN_SUCCESS;
+ }
+ //
+ // Skip the 'X'
+ //
+ String++;
+ }
+
+ *Data = 0;
+
+ while (InternalIsHexaDecimalDigitCharacter (*String)) {
+ //
+ // If the number represented by String overflows according to the range
+ // defined by UINT64, then MAX_UINT64 is stored in *Data and
+ // RETURN_UNSUPPORTED is returned.
+ //
+ if (*Data > ((MAX_UINT64 - InternalHexCharToUintn (*String))>>4)) {
+ *Data = MAX_UINT64;
+ if (EndPointer != NULL) {
+ *EndPointer = (CHAR16 *) String;
+ }
+ return RETURN_UNSUPPORTED;
+ }
+
+ *Data = ((*Data) << 4) + InternalHexCharToUintn (*String);
+ String++;
+ }
+
+ if (EndPointer != NULL) {
+ *EndPointer = (CHAR16 *) String;
+ }
+ return RETURN_SUCCESS;
+}
+
+UINT64
+StrDecimalToUint64 (
+ CONST CHAR16 *String
+ )
+{
+ UINT64 Result;
+
+ StrDecimalToUint64S (String, (CHAR16 **) NULL, &Result);
+ return Result;
+}
+
+
+UINT64
+StrHexToUint64 (
+ CONST CHAR16 *String
+ )
+{
+ UINT64 Result;
+
+ StrHexToUint64S (String, (CHAR16 **) NULL, &Result);
+ return Result;
+}
+
+UINTN
+StrSize (
+ CONST CHAR16 *String
+ )
+{
+ return (StrLen (String) + 1) * sizeof (*String);
+}
+
+
+UINT64
+ReadUnaligned64 (
+ CONST UINT64 *Buffer
+ )
+{
+ ASSERT (Buffer != NULL);
+
+ return *Buffer;
+}
+
+UINT64
+WriteUnaligned64 (
+ UINT64 *Buffer,
+ UINT64 Value
+ )
+{
+ ASSERT (Buffer != NULL);
+
+ return *Buffer = Value;
+}
+
+
+EFI_GUID *
+CopyGuid (
+ EFI_GUID *DestinationGuid,
+ CONST EFI_GUID *SourceGuid
+ )
+{
+ WriteUnaligned64 (
+ (UINT64*)DestinationGuid,
+ ReadUnaligned64 ((CONST UINT64*)SourceGuid)
+ );
+ WriteUnaligned64 (
+ (UINT64*)DestinationGuid + 1,
+ ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1)
+ );
+ return DestinationGuid;
+}
+
+UINT16
+SwapBytes16 (
+ UINT16 Value
+ )
+{
+ return (UINT16) ((Value<< 8) | (Value>> 8));
+}
+
+
+UINT32
+SwapBytes32 (
+ UINT32 Value
+ )
+{
+ UINT32 LowerBytes;
+ UINT32 HigherBytes;
+
+ LowerBytes = (UINT32) SwapBytes16 ((UINT16) Value);
+ HigherBytes = (UINT32) SwapBytes16 ((UINT16) (Value >> 16));
+ return (LowerBytes << 16 | HigherBytes);
+}
+
+BOOLEAN
+InternalIsDecimalDigitCharacter (
+ CHAR16 Char
+ )
+{
+ return (BOOLEAN) (Char >= L'0' && Char <= L'9');
+}
+
+VOID *
+InternalAllocateCopyPool (
+ UINTN AllocationSize,
+ CONST VOID *Buffer
+ )
+{
+ VOID *Memory;
+
+ ASSERT (Buffer != NULL);
+
+ Memory = malloc (AllocationSize);
+ if (Memory != NULL) {
+ Memory = memcpy (Memory, Buffer, AllocationSize);
+ }
+ return Memory;
+}
+
+BOOLEAN
+InternalIsHexaDecimalDigitCharacter (
+ CHAR16 Char
+ )
+{
+
+ return (BOOLEAN) (InternalIsDecimalDigitCharacter (Char) ||
+ (Char >= L'A' && Char <= L'F') ||
+ (Char >= L'a' && Char <= L'f'));
+}
+
+UINTN
+InternalHexCharToUintn (
+ CHAR16 Char
+ )
+{
+ if (InternalIsDecimalDigitCharacter (Char)) {
+ return Char - L'0';
+ }
+
+ return (10 + InternalCharToUpper (Char) - L'A');
+}
+
+
+/**
+ Convert a Null-terminated Unicode hexadecimal string to a byte array.
+
+ This function outputs a byte array by interpreting the contents of
+ the Unicode string specified by String in hexadecimal format. The format of
+ the input Unicode string String is:
+
+ [XX]*
+
+ X is a hexadecimal digit character in the range [0-9], [a-f] and [A-F].
+ The function decodes every two hexadecimal digit characters as one byte. The
+ decoding stops after Length of characters and outputs Buffer containing
+ (Length / 2) bytes.
+
+ If String is not aligned in a 16-bit boundary, then ASSERT().
+
+ If String is NULL, then ASSERT().
+
+ If Buffer is NULL, then ASSERT().
+
+ If Length is not multiple of 2, then ASSERT().
+
+ If PcdMaximumUnicodeStringLength is not zero and Length is greater than
+ PcdMaximumUnicodeStringLength, then ASSERT().
+
+ If MaxBufferSize is less than (Length / 2), then ASSERT().
+
+ @param String Pointer to a Null-terminated Unicode string.
+ @param Length The number of Unicode characters to decode.
+ @param Buffer Pointer to the converted bytes array.
+ @param MaxBufferSize The maximum size of Buffer.
+
+ @retval RETURN_SUCCESS Buffer is translated from String.
+ @retval RETURN_INVALID_PARAMETER If String is NULL.
+ If Data is NULL.
+ If Length is not multiple of 2.
+ If PcdMaximumUnicodeStringLength is not zero,
+ and Length is greater than
+ PcdMaximumUnicodeStringLength.
+ @retval RETURN_UNSUPPORTED If Length of characters from String contain
+ a character that is not valid hexadecimal
+ digit characters, or a Null-terminator.
+ @retval RETURN_BUFFER_TOO_SMALL If MaxBufferSize is less than (Length / 2).
+**/
+RETURN_STATUS
+StrHexToBytes (
+ CONST CHAR16 *String,
+ UINTN Length,
+ UINT8 *Buffer,
+ UINTN MaxBufferSize
+ )
+{
+ UINTN Index;
+
+ ASSERT (((UINTN) String & BIT0) == 0);
+
+ //
+ // 1. None of String or Buffer shall be a null pointer.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER);
+ SAFE_STRING_CONSTRAINT_CHECK ((Buffer != NULL), RETURN_INVALID_PARAMETER);
+
+ //
+ // 2. Length shall not be greater than RSIZE_MAX.
+ //
+ if (RSIZE_MAX != 0) {
+ SAFE_STRING_CONSTRAINT_CHECK ((Length <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
+ }
+
+ //
+ // 3. Length shall not be odd.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK (((Length & BIT0) == 0), RETURN_INVALID_PARAMETER);
+
+ //
+ // 4. MaxBufferSize shall equal to or greater than Length / 2.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK ((MaxBufferSize >= Length / 2), RETURN_BUFFER_TOO_SMALL);
+
+ //
+ // 5. String shall not contains invalid hexadecimal digits.
+ //
+ for (Index = 0; Index < Length; Index++) {
+ if (!InternalIsHexaDecimalDigitCharacter (String[Index])) {
+ break;
+ }
+ }
+ if (Index != Length) {
+ return RETURN_UNSUPPORTED;
+ }
+
+ //
+ // Convert the hex string to bytes.
+ //
+ for(Index = 0; Index < Length; Index++) {
+
+ //
+ // For even characters, write the upper nibble for each buffer byte,
+ // and for even characters, the lower nibble.
+ //
+ if ((Index & BIT0) == 0) {
+ Buffer[Index / 2] = (UINT8) InternalHexCharToUintn (String[Index]) << 4;
+ } else {
+ Buffer[Index / 2] |= (UINT8) InternalHexCharToUintn (String[Index]);
+ }
+ }
+ return RETURN_SUCCESS;
+}
+
+/**
+ Convert a Null-terminated Unicode GUID string to a value of type
+ EFI_GUID.
+
+ This function outputs a GUID value by interpreting the contents of
+ the Unicode string specified by String. The format of the input
+ Unicode string String consists of 36 characters, as follows:
+
+ aabbccdd-eeff-gghh-iijj-kkllmmnnoopp
+
+ The pairs aa - pp are two characters in the range [0-9], [a-f] and
+ [A-F], with each pair representing a single byte hexadecimal value.
+
+ The mapping between String and the EFI_GUID structure is as follows:
+ aa Data1[24:31]
+ bb Data1[16:23]
+ cc Data1[8:15]
+ dd Data1[0:7]
+ ee Data2[8:15]
+ ff Data2[0:7]
+ gg Data3[8:15]
+ hh Data3[0:7]
+ ii Data4[0:7]
+ jj Data4[8:15]
+ kk Data4[16:23]
+ ll Data4[24:31]
+ mm Data4[32:39]
+ nn Data4[40:47]
+ oo Data4[48:55]
+ pp Data4[56:63]
+
+ If String is NULL, then ASSERT().
+ If Guid is NULL, then ASSERT().
+ If String is not aligned in a 16-bit boundary, then ASSERT().
+
+ @param String Pointer to a Null-terminated Unicode string.
+ @param Guid Pointer to the converted GUID.
+
+ @retval RETURN_SUCCESS Guid is translated from String.
+ @retval RETURN_INVALID_PARAMETER If String is NULL.
+ If Data is NULL.
+ @retval RETURN_UNSUPPORTED If String is not as the above format.
+
+**/
+RETURN_STATUS
+StrToGuid (
+ CONST CHAR16 *String,
+ EFI_GUID *Guid
+ )
+{
+ RETURN_STATUS Status;
+ EFI_GUID LocalGuid;
+
+ ASSERT (((UINTN) String & BIT0) == 0);
+
+ //
+ // 1. None of String or Guid shall be a null pointer.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER);
+ SAFE_STRING_CONSTRAINT_CHECK ((Guid != NULL), RETURN_INVALID_PARAMETER);
+
+ //
+ // Get aabbccdd in big-endian.
+ //
+ Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data1), (UINT8 *) &LocalGuid.Data1, sizeof (LocalGuid.Data1));
+ if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data1)] != L'-') {
+ return RETURN_UNSUPPORTED;
+ }
+ //
+ // Convert big-endian to little-endian.
+ //
+ LocalGuid.Data1 = SwapBytes32 (LocalGuid.Data1);
+ String += 2 * sizeof (LocalGuid.Data1) + 1;
+
+ //
+ // Get eeff in big-endian.
+ //
+ Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data2), (UINT8 *) &LocalGuid.Data2, sizeof (LocalGuid.Data2));
+ if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data2)] != L'-') {
+ return RETURN_UNSUPPORTED;
+ }
+ //
+ // Convert big-endian to little-endian.
+ //
+ LocalGuid.Data2 = SwapBytes16 (LocalGuid.Data2);
+ String += 2 * sizeof (LocalGuid.Data2) + 1;
+
+ //
+ // Get gghh in big-endian.
+ //
+ Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data3), (UINT8 *) &LocalGuid.Data3, sizeof (LocalGuid.Data3));
+ if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data3)] != L'-') {
+ return RETURN_UNSUPPORTED;
+ }
+ //
+ // Convert big-endian to little-endian.
+ //
+ LocalGuid.Data3 = SwapBytes16 (LocalGuid.Data3);
+ String += 2 * sizeof (LocalGuid.Data3) + 1;
+
+ //
+ // Get iijj.
+ //
+ Status = StrHexToBytes (String, 2 * 2, &LocalGuid.Data4[0], 2);
+ if (RETURN_ERROR (Status) || String[2 * 2] != L'-') {
+ return RETURN_UNSUPPORTED;
+ }
+ String += 2 * 2 + 1;
+
+ //
+ // Get kkllmmnnoopp.
+ //
+ Status = StrHexToBytes (String, 2 * 6, &LocalGuid.Data4[2], 6);
+ if (RETURN_ERROR (Status)) {
+ return RETURN_UNSUPPORTED;
+ }
+
+ CopyGuid (Guid, &LocalGuid);
+ return RETURN_SUCCESS;
+}
+
+/**
+ Compares up to a specified length the contents of two Null-terminated Unicode strings,
+ and returns the difference between the first mismatched Unicode characters.
+
+ This function compares the Null-terminated Unicode string FirstString to the
+ Null-terminated Unicode string SecondString. At most, Length Unicode
+ characters will be compared. If Length is 0, then 0 is returned. If
+ FirstString is identical to SecondString, then 0 is returned. Otherwise, the
+ value returned is the first mismatched Unicode character in SecondString
+ subtracted from the first mismatched Unicode character in FirstString.
+
+ If Length > 0 and FirstString is NULL, then ASSERT().
+ If Length > 0 and FirstString is not aligned on a 16-bit boundary, then ASSERT().
+ If Length > 0 and SecondString is NULL, then ASSERT().
+ If Length > 0 and SecondString is not aligned on a 16-bit boundary, then ASSERT().
+ If PcdMaximumUnicodeStringLength is not zero, and Length is greater than
+ PcdMaximumUnicodeStringLength, then ASSERT().
+ If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more than
+ PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,
+ then ASSERT().
+ If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more than
+ PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,
+ then ASSERT().
+
+ @param FirstString A pointer to a Null-terminated Unicode string.
+ @param SecondString A pointer to a Null-terminated Unicode string.
+ @param Length The maximum number of Unicode characters to compare.
+
+ @retval 0 FirstString is identical to SecondString.
+ @return others FirstString is not identical to SecondString.
+
+**/
+INTN
+StrnCmp (
+ CONST CHAR16 *FirstString,
+ CONST CHAR16 *SecondString,
+ UINTN Length
+ )
+{
+ if (Length == 0) {
+ return 0;
+ }
+
+ //
+ // ASSERT both strings are less long than PcdMaximumUnicodeStringLength.
+ // Length tests are performed inside StrLen().
+ //
+ ASSERT (StrSize (FirstString) != 0);
+ ASSERT (StrSize (SecondString) != 0);
+
+ while ((*FirstString != L'\0') &&
+ (*SecondString != L'\0') &&
+ (*FirstString == *SecondString) &&
+ (Length > 1)) {
+ FirstString++;
+ SecondString++;
+ Length--;
+ }
+
+ return *FirstString - *SecondString;
+}
+
+VOID *
+AllocateCopyPool (
+ UINTN AllocationSize,
+ CONST VOID *Buffer
+ )
+{
+ return InternalAllocateCopyPool (AllocationSize, Buffer);
+}
+
+INTN
+StrCmp (
+ CONST CHAR16 *FirstString,
+ CONST CHAR16 *SecondString
+ )
+{
+ //
+ // ASSERT both strings are less long than PcdMaximumUnicodeStringLength
+ //
+ ASSERT (StrSize (FirstString) != 0);
+ ASSERT (StrSize (SecondString) != 0);
+
+ while ((*FirstString != L'\0') && (*FirstString == *SecondString)) {
+ FirstString++;
+ SecondString++;
+ }
+ return *FirstString - *SecondString;
+}
+
+UINT64
+SwapBytes64 (
+ UINT64 Value
+ )
+{
+ return InternalMathSwapBytes64 (Value);
+}
+
+UINT64
+InternalMathSwapBytes64 (
+ UINT64 Operand
+ )
+{
+ UINT64 LowerBytes;
+ UINT64 HigherBytes;
+
+ LowerBytes = (UINT64) SwapBytes32 ((UINT32) Operand);
+ HigherBytes = (UINT64) SwapBytes32 ((UINT32) (Operand >> 32));
+
+ return (LowerBytes << 32 | HigherBytes);
+}
+
+RETURN_STATUS
+StrToIpv4Address (
+ CONST CHAR16 *String,
+ CHAR16 **EndPointer,
+ EFI_IPv4_ADDRESS *Address,
+ UINT8 *PrefixLength
+ )
+{
+ RETURN_STATUS Status;
+ UINTN AddressIndex;
+ UINT64 Uint64;
+ EFI_IPv4_ADDRESS LocalAddress;
+ UINT8 LocalPrefixLength;
+ CHAR16 *Pointer;
+
+ LocalPrefixLength = MAX_UINT8;
+ LocalAddress.Addr[0] = 0;
+
+ ASSERT (((UINTN) String & BIT0) == 0);
+
+ //
+ // 1. None of String or Guid shall be a null pointer.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER);
+ SAFE_STRING_CONSTRAINT_CHECK ((Address != NULL), RETURN_INVALID_PARAMETER);
+
+ for (Pointer = (CHAR16 *) String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) {
+ if (!InternalIsDecimalDigitCharacter (*Pointer)) {
+ //
+ // D or P contains invalid characters.
+ //
+ break;
+ }
+
+ //
+ // Get D or P.
+ //
+ Status = StrDecimalToUint64S ((CONST CHAR16 *) Pointer, &Pointer, &Uint64);
+ if (RETURN_ERROR (Status)) {
+ return RETURN_UNSUPPORTED;
+ }
+ if (AddressIndex == ARRAY_SIZE (Address->Addr)) {
+ //
+ // It's P.
+ //
+ if (Uint64 > 32) {
+ return RETURN_UNSUPPORTED;
+ }
+ LocalPrefixLength = (UINT8) Uint64;
+ } else {
+ //
+ // It's D.
+ //
+ if (Uint64 > MAX_UINT8) {
+ return RETURN_UNSUPPORTED;
+ }
+ LocalAddress.Addr[AddressIndex] = (UINT8) Uint64;
+ AddressIndex++;
+ }
+
+ //
+ // Check the '.' or '/', depending on the AddressIndex.
+ //
+ if (AddressIndex == ARRAY_SIZE (Address->Addr)) {
+ if (*Pointer == L'/') {
+ //
+ // '/P' is in the String.
+ // Skip "/" and get P in next loop.
+ //
+ Pointer++;
+ } else {
+ //
+ // '/P' is not in the String.
+ //
+ break;
+ }
+ } else if (AddressIndex < ARRAY_SIZE (Address->Addr)) {
+ if (*Pointer == L'.') {
+ //
+ // D should be followed by '.'
+ //
+ Pointer++;
+ } else {
+ return RETURN_UNSUPPORTED;
+ }
+ }
+ }
+
+ if (AddressIndex < ARRAY_SIZE (Address->Addr)) {
+ return RETURN_UNSUPPORTED;
+ }
+
+ memcpy (Address, &LocalAddress, sizeof (*Address));
+ if (PrefixLength != NULL) {
+ *PrefixLength = LocalPrefixLength;
+ }
+ if (EndPointer != NULL) {
+ *EndPointer = Pointer;
+ }
+
+ return RETURN_SUCCESS;
+}
+
+RETURN_STATUS
+StrToIpv6Address (
+ CONST CHAR16 *String,
+ CHAR16 **EndPointer,
+ EFI_IPv6_ADDRESS *Address,
+ UINT8 *PrefixLength
+ )
+{
+ RETURN_STATUS Status;
+ UINTN AddressIndex;
+ UINT64 Uint64;
+ EFI_IPv6_ADDRESS LocalAddress;
+ UINT8 LocalPrefixLength;
+ CONST CHAR16 *Pointer;
+ CHAR16 *End;
+ UINTN CompressStart;
+ BOOLEAN ExpectPrefix;
+
+ LocalPrefixLength = MAX_UINT8;
+ CompressStart = ARRAY_SIZE (Address->Addr);
+ ExpectPrefix = FALSE;
+
+ ASSERT (((UINTN) String & BIT0) == 0);
+
+ //
+ // 1. None of String or Guid shall be a null pointer.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER);
+ SAFE_STRING_CONSTRAINT_CHECK ((Address != NULL), RETURN_INVALID_PARAMETER);
+
+ for (Pointer = String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) {
+ if (!InternalIsHexaDecimalDigitCharacter (*Pointer)) {
+ if (*Pointer != L':') {
+ //
+ // ":" or "/" should be followed by digit characters.
+ //
+ return RETURN_UNSUPPORTED;
+ }
+
+ //
+ // Meet second ":" after previous ":" or "/"
+ // or meet first ":" in the beginning of String.
+ //
+ if (ExpectPrefix) {
+ //
+ // ":" shall not be after "/"
+ //
+ return RETURN_UNSUPPORTED;
+ }
+
+ if (CompressStart != ARRAY_SIZE (Address->Addr) || AddressIndex == ARRAY_SIZE (Address->Addr)) {
+ //
+ // "::" can only appear once.
+ // "::" can only appear when address is not full length.
+ //
+ return RETURN_UNSUPPORTED;
+ } else {
+ //
+ // Remember the start of zero compressing.
+ //
+ CompressStart = AddressIndex;
+ Pointer++;
+
+ if (CompressStart == 0) {
+ if (*Pointer != L':') {
+ //
+ // Single ":" shall not be in the beginning of String.
+ //
+ return RETURN_UNSUPPORTED;
+ }
+ Pointer++;
+ }
+ }
+ }
+
+ if (!InternalIsHexaDecimalDigitCharacter (*Pointer)) {
+ if (*Pointer == L'/') {
+ //
+ // Might be optional "/P" after "::".
+ //
+ if (CompressStart != AddressIndex) {
+ return RETURN_UNSUPPORTED;
+ }
+ } else {
+ break;
+ }
+ } else {
+ if (!ExpectPrefix) {
+ //
+ // Get X.
+ //
+ Status = StrHexToUint64S (Pointer, &End, &Uint64);
+ if (RETURN_ERROR (Status) || End - Pointer > 4) {
+ //
+ // Number of hexadecimal digit characters is no more than 4.
+ //
+ return RETURN_UNSUPPORTED;
+ }
+ Pointer = End;
+ //
+ // Uint64 won't exceed MAX_UINT16 if number of hexadecimal digit characters is no more than 4.
+ //
+ ASSERT (AddressIndex + 1 < ARRAY_SIZE (Address->Addr));
+ LocalAddress.Addr[AddressIndex] = (UINT8) ((UINT16) Uint64 >> 8);
+ LocalAddress.Addr[AddressIndex + 1] = (UINT8) Uint64;
+ AddressIndex += 2;
+ } else {
+ //
+ // Get P, then exit the loop.
+ //
+ Status = StrDecimalToUint64S (Pointer, &End, &Uint64);
+ if (RETURN_ERROR (Status) || End == Pointer || Uint64 > 128) {
+ //
+ // Prefix length should not exceed 128.
+ //
+ return RETURN_UNSUPPORTED;
+ }
+ LocalPrefixLength = (UINT8) Uint64;
+ Pointer = End;
+ break;
+ }
+ }
+
+ //
+ // Skip ':' or "/"
+ //
+ if (*Pointer == L'/') {
+ ExpectPrefix = TRUE;
+ } else if (*Pointer == L':') {
+ if (AddressIndex == ARRAY_SIZE (Address->Addr)) {
+ //
+ // Meet additional ":" after all 8 16-bit address
+ //
+ break;
+ }
+ } else {
+ //
+ // Meet other character that is not "/" or ":" after all 8 16-bit address
+ //
+ break;
+ }
+ Pointer++;
+ }
+
+ if ((AddressIndex == ARRAY_SIZE (Address->Addr) && CompressStart != ARRAY_SIZE (Address->Addr)) ||
+ (AddressIndex != ARRAY_SIZE (Address->Addr) && CompressStart == ARRAY_SIZE (Address->Addr))
+ ) {
+ //
+ // Full length of address shall not have compressing zeros.
+ // Non-full length of address shall have compressing zeros.
+ //
+ return RETURN_UNSUPPORTED;
+ }
+ memcpy (&Address->Addr[0], &LocalAddress.Addr[0], CompressStart);
+ if (AddressIndex > CompressStart) {
+ memset (&Address->Addr[CompressStart], 0, ARRAY_SIZE (Address->Addr) - AddressIndex);
+ memcpy (
+ &Address->Addr[CompressStart + ARRAY_SIZE (Address->Addr) - AddressIndex],
+ &LocalAddress.Addr[CompressStart],
+ AddressIndex - CompressStart
+ );
+ }
+
+ if (PrefixLength != NULL) {
+ *PrefixLength = LocalPrefixLength;
+ }
+ if (EndPointer != NULL) {
+ *EndPointer = (CHAR16 *) Pointer;
+ }
+
+ return RETURN_SUCCESS;
+}
+
+
+RETURN_STATUS
+UnicodeStrToAsciiStrS (
+ CONST CHAR16 *Source,
+ CHAR8 *Destination,
+ UINTN DestMax
+ )
+{
+ UINTN SourceLen;
+
+ ASSERT (((UINTN) Source & BIT0) == 0);
+
+ //
+ // 1. Neither Destination nor Source shall be a null pointer.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER);
+ SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER);
+
+ //
+ // 2. DestMax shall not be greater than ASCII_RSIZE_MAX or RSIZE_MAX.
+ //
+ if (ASCII_RSIZE_MAX != 0) {
+ SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
+ }
+ if (RSIZE_MAX != 0) {
+ SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
+ }
+
+ //
+ // 3. DestMax shall not equal zero.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER);
+
+ //
+ // 4. DestMax shall be greater than StrnLenS (Source, DestMax).
+ //
+ SourceLen = StrnLenS (Source, DestMax);
+ SAFE_STRING_CONSTRAINT_CHECK ((DestMax > SourceLen), RETURN_BUFFER_TOO_SMALL);
+
+ //
+ // 5. Copying shall not take place between objects that overlap.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax, (VOID *)Source, (SourceLen + 1) * sizeof(CHAR16)), RETURN_ACCESS_DENIED);
+
+ //
+ // convert string
+ //
+ while (*Source != '\0') {
+ //
+ // If any Unicode characters in Source contain
+ // non-zero value in the upper 8 bits, then ASSERT().
+ //
+ ASSERT (*Source < 0x100);
+ *(Destination++) = (CHAR8) *(Source++);
+ }
+ *Destination = '\0';
+
+ return RETURN_SUCCESS;
+}
+
+RETURN_STATUS
+StrCpyS (
+ CHAR16 *Destination,
+ UINTN DestMax,
+ CONST CHAR16 *Source
+ )
+{
+ UINTN SourceLen;
+
+ ASSERT (((UINTN) Destination & BIT0) == 0);
+ ASSERT (((UINTN) Source & BIT0) == 0);
+
+ //
+ // 1. Neither Destination nor Source shall be a null pointer.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER);
+ SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER);
+
+ //
+ // 2. DestMax shall not be greater than RSIZE_MAX.
+ //
+ if (RSIZE_MAX != 0) {
+ SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
+ }
+
+ //
+ // 3. DestMax shall not equal zero.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER);
+
+ //
+ // 4. DestMax shall be greater than StrnLenS(Source, DestMax).
+ //
+ SourceLen = StrnLenS (Source, DestMax);
+ SAFE_STRING_CONSTRAINT_CHECK ((DestMax > SourceLen), RETURN_BUFFER_TOO_SMALL);
+
+ //
+ // 5. Copying shall not take place between objects that overlap.
+ //
+ SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoStrOverlap (Destination, DestMax, (CHAR16 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
+
+ //
+ // The StrCpyS function copies the string pointed to by Source (including the terminating
+ // null character) into the array pointed to by Destination.
+ //
+ while (*Source != 0) {
+ *(Destination++) = *(Source++);
+ }
+ *Destination = 0;
+
+ return RETURN_SUCCESS;
+}
+
+VOID *
+AllocateZeroPool (
+ UINTN AllocationSize
+ )
+{
+ VOID * Memory;
+ Memory = malloc(AllocationSize);
+ ASSERT (Memory != NULL);
+ if (Memory == NULL) {
+ fprintf(stderr, "Not memory for malloc\n");
+ }
+ memset(Memory, 0, AllocationSize);
+ return Memory;
+}
+
+VOID *
+AllocatePool (
+ UINTN AllocationSize
+ )
+{
+ return InternalAllocatePool (AllocationSize);
+}
+
+UINT16
+WriteUnaligned16 (
+ UINT16 *Buffer,
+ UINT16 Value
+ )
+{
+ ASSERT (Buffer != NULL);
+
+ return *Buffer = Value;
+}
+
+UINT16
+ReadUnaligned16 (
+ CONST UINT16 *Buffer
+ )
+{
+ ASSERT (Buffer != NULL);
+
+ return *Buffer;
+}
+/**
+ Return whether the integer string is a hex string.
+
+ @param Str The integer string
+
+ @retval TRUE Hex string
+ @retval FALSE Decimal string
+
+**/
+BOOLEAN
+IsHexStr (
+ CHAR16 *Str
+ )
+{
+ //
+ // skip preceding white space
+ //
+ while ((*Str != 0) && *Str == L' ') {
+ Str ++;
+ }
+ //
+ // skip preceding zeros
+ //
+ while ((*Str != 0) && *Str == L'0') {
+ Str ++;
+ }
+
+ return (BOOLEAN) (*Str == L'x' || *Str == L'X');
+}
+
+/**
+
+ Convert integer string to uint.
+
+ @param Str The integer string. If leading with "0x" or "0X", it's hexadecimal.
+
+ @return A UINTN value represented by Str
+
+**/
+UINTN
+Strtoi (
+ CHAR16 *Str
+ )
+{
+ if (IsHexStr (Str)) {
+ return (UINTN)StrHexToUint64 (Str);
+ } else {
+ return (UINTN)StrDecimalToUint64 (Str);
+ }
+}
+
+/**
+
+ Convert integer string to 64 bit data.
+
+ @param Str The integer string. If leading with "0x" or "0X", it's hexadecimal.
+ @param Data A pointer to the UINT64 value represented by Str
+
+**/
+VOID
+Strtoi64 (
+ CHAR16 *Str,
+ UINT64 *Data
+ )
+{
+ if (IsHexStr (Str)) {
+ *Data = StrHexToUint64 (Str);
+ } else {
+ *Data = StrDecimalToUint64 (Str);
+ }
+}
+
+/**
+ Converts a Unicode string to ASCII string.
+
+ @param Str The equivalent Unicode string
+ @param AsciiStr On input, it points to destination ASCII string buffer; on output, it points
+ to the next ASCII string next to it
+
+**/
+VOID
+StrToAscii (
+ CHAR16 *Str,
+ CHAR8 **AsciiStr
+ )
+{
+ CHAR8 *Dest;
+
+ Dest = *AsciiStr;
+ while (!IS_NULL (*Str)) {
+ *(Dest++) = (CHAR8) *(Str++);
+ }
+ *Dest = 0;
+
+ //
+ // Return the string next to it
+ //
+ *AsciiStr = Dest + 1;
+}
+
+/**
+ Gets current sub-string from a string list, before return
+ the list header is moved to next sub-string. The sub-string is separated
+ by the specified character. For example, the separator is ',', the string
+ list is "2,0,3", it returns "2", the remain list move to "0,3"
+
+ @param List A string list separated by the specified separator
+ @param Separator The separator character
+
+ @return A pointer to the current sub-string
+
+**/
+CHAR16 *
+SplitStr (
+ CHAR16 **List,
+ CHAR16 Separator
+ )
+{
+ CHAR16 *Str;
+ CHAR16 *ReturnStr;
+
+ Str = *List;
+ ReturnStr = Str;
+
+ if (IS_NULL (*Str)) {
+ return ReturnStr;
+ }
+
+ //
+ // Find first occurrence of the separator
+ //
+ while (!IS_NULL (*Str)) {
+ if (*Str == Separator) {
+ break;
+ }
+ Str++;
+ }
+
+ if (*Str == Separator) {
+ //
+ // Find a sub-string, terminate it
+ //
+ *Str = L'\0';
+ Str++;
+ }
+
+ //
+ // Move to next sub-string
+ //
+ *List = Str;
+ return ReturnStr;
+}
+
diff --git a/roms/edk2/BaseTools/Source/C/Common/CommonLib.h b/roms/edk2/BaseTools/Source/C/Common/CommonLib.h
new file mode 100644
index 000000000..e1cce985f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/CommonLib.h
@@ -0,0 +1,461 @@
+/** @file
+Common library assistance routines.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFI_COMMON_LIB_H
+#define _EFI_COMMON_LIB_H
+
+#include <Common/UefiBaseTypes.h>
+#include <Common/BuildVersion.h>
+#include <assert.h>
+#define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination
+
+#define MAX_LONG_FILE_PATH 500
+
+#define MAX_UINT64 ((UINT64)0xFFFFFFFFFFFFFFFFULL)
+#define MAX_UINT32 ((UINT32)0xFFFFFFFF)
+#define MAX_UINT16 ((UINT16)0xFFFF)
+#define MAX_UINT8 ((UINT8)0xFF)
+#define ARRAY_SIZE(Array) (sizeof (Array) / sizeof ((Array)[0]))
+#define ASCII_RSIZE_MAX 1000000
+#undef RSIZE_MAX
+#define RSIZE_MAX 1000000
+
+#define IS_COMMA(a) ((a) == L',')
+#define IS_HYPHEN(a) ((a) == L'-')
+#define IS_DOT(a) ((a) == L'.')
+#define IS_LEFT_PARENTH(a) ((a) == L'(')
+#define IS_RIGHT_PARENTH(a) ((a) == L')')
+#define IS_SLASH(a) ((a) == L'/')
+#define IS_NULL(a) ((a) == L'\0')
+
+#define ASSERT(x) assert(x)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//
+// Function declarations
+//
+VOID
+PeiZeroMem (
+ IN VOID *Buffer,
+ IN UINTN Size
+ )
+;
+
+VOID
+PeiCopyMem (
+ IN VOID *Destination,
+ IN VOID *Source,
+ IN UINTN Length
+ )
+;
+
+VOID
+ZeroMem (
+ IN VOID *Buffer,
+ IN UINTN Size
+ )
+;
+
+VOID
+CopyMem (
+ IN VOID *Destination,
+ IN VOID *Source,
+ IN UINTN Length
+ )
+;
+
+INTN
+CompareGuid (
+ IN EFI_GUID *Guid1,
+ IN EFI_GUID *Guid2
+ )
+;
+
+EFI_STATUS
+GetFileImage (
+ IN CHAR8 *InputFileName,
+ OUT CHAR8 **InputFileImage,
+ OUT UINT32 *BytesRead
+ )
+;
+
+EFI_STATUS
+PutFileImage (
+ IN CHAR8 *OutputFileName,
+ IN CHAR8 *OutputFileImage,
+ IN UINT32 BytesToWrite
+ )
+;
+/*++
+
+Routine Description:
+
+ This function opens a file and writes OutputFileImage into the file.
+
+Arguments:
+
+ OutputFileName The name of the file to write.
+ OutputFileImage A pointer to the memory buffer.
+ BytesToWrite The size of the memory buffer.
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully.
+ EFI_INVALID_PARAMETER One of the input parameters was invalid.
+ EFI_ABORTED An error occurred.
+ EFI_OUT_OF_RESOURCES No resource to complete operations.
+
+**/
+
+UINT8
+CalculateChecksum8 (
+ IN UINT8 *Buffer,
+ IN UINTN Size
+ )
+;
+
+UINT8
+CalculateSum8 (
+ IN UINT8 *Buffer,
+ IN UINTN Size
+ )
+;
+
+UINT16
+CalculateChecksum16 (
+ IN UINT16 *Buffer,
+ IN UINTN Size
+ )
+;
+
+UINT16
+CalculateSum16 (
+ IN UINT16 *Buffer,
+ IN UINTN Size
+ )
+;
+
+EFI_STATUS
+PrintGuid (
+ IN EFI_GUID *Guid
+ )
+;
+
+#define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination
+EFI_STATUS
+PrintGuidToBuffer (
+ IN EFI_GUID *Guid,
+ IN OUT UINT8 *Buffer,
+ IN UINT32 BufferLen,
+ IN BOOLEAN Uppercase
+ )
+;
+
+CHAR8 *
+LongFilePath (
+ IN CHAR8 *FileName
+);
+
+UINTN
+StrLen (
+ CONST CHAR16 *String
+ );
+
+VOID *
+AllocateCopyPool (
+ UINTN AllocationSize,
+ CONST VOID *Buffer
+ );
+
+INTN
+StrnCmp (
+ CONST CHAR16 *FirstString,
+ CONST CHAR16 *SecondString,
+ UINTN Length
+ );
+
+RETURN_STATUS
+StrToGuid (
+ CONST CHAR16 *String,
+ EFI_GUID *Guid
+ );
+
+RETURN_STATUS
+StrHexToBytes (
+ CONST CHAR16 *String,
+ UINTN Length,
+ UINT8 *Buffer,
+ UINTN MaxBufferSize
+ );
+
+UINTN
+InternalHexCharToUintn (
+ CHAR16 Char
+ );
+
+VOID *
+InternalAllocateCopyPool (
+ UINTN AllocationSize,
+ CONST VOID *Buffer
+ );
+
+BOOLEAN
+InternalIsDecimalDigitCharacter (
+ CHAR16 Char
+ );
+
+UINT32
+SwapBytes32 (
+ UINT32 Value
+ );
+
+UINT16
+SwapBytes16 (
+ UINT16 Value
+ );
+
+EFI_GUID *
+CopyGuid (
+ EFI_GUID *DestinationGuid,
+ CONST EFI_GUID *SourceGuid
+ );
+
+UINT64
+WriteUnaligned64 (
+ UINT64 *Buffer,
+ UINT64 Value
+ );
+
+UINT64
+ReadUnaligned64 (
+ CONST UINT64 *Buffer
+ );
+
+UINTN
+StrSize (
+ CONST CHAR16 *String
+ );
+
+UINT64
+StrHexToUint64 (
+ CONST CHAR16 *String
+ );
+
+UINT64
+StrDecimalToUint64 (
+ CONST CHAR16 *String
+ );
+
+RETURN_STATUS
+StrHexToUint64S (
+ CONST CHAR16 *String,
+ CHAR16 **EndPointer,
+ UINT64 *Data
+ );
+
+RETURN_STATUS
+StrDecimalToUint64S (
+ CONST CHAR16 *String,
+ CHAR16 **EndPointer, OPTIONAL
+ UINT64 *Data
+ );
+
+VOID *
+ReallocatePool (
+ UINTN OldSize,
+ UINTN NewSize,
+ VOID *OldBuffer OPTIONAL
+ );
+
+VOID *
+InternalReallocatePool (
+ UINTN OldSize,
+ UINTN NewSize,
+ VOID *OldBuffer OPTIONAL
+ );
+
+VOID *
+InternalAllocateZeroPool (
+ UINTN AllocationSize
+ ) ;
+
+VOID *
+InternalAllocatePool (
+ UINTN AllocationSize
+ );
+
+UINTN
+StrnLenS (
+ CONST CHAR16 *String,
+ UINTN MaxSize
+ );
+
+CHAR16
+InternalCharToUpper (
+ CHAR16 Char
+ );
+
+INTN
+StrCmp (
+ CONST CHAR16 *FirstString,
+ CONST CHAR16 *SecondString
+ );
+
+UINT64
+SwapBytes64 (
+ UINT64 Value
+ );
+
+UINT64
+InternalMathSwapBytes64 (
+ UINT64 Operand
+ );
+
+RETURN_STATUS
+StrToIpv4Address (
+ CONST CHAR16 *String,
+ CHAR16 **EndPointer,
+ EFI_IPv4_ADDRESS *Address,
+ UINT8 *PrefixLength
+ );
+
+RETURN_STATUS
+StrToIpv6Address (
+ CONST CHAR16 *String,
+ CHAR16 **EndPointer,
+ EFI_IPv6_ADDRESS *Address,
+ UINT8 *PrefixLength
+ );
+
+RETURN_STATUS
+StrCpyS (
+ CHAR16 *Destination,
+ UINTN DestMax,
+ CONST CHAR16 *Source
+ );
+
+RETURN_STATUS
+UnicodeStrToAsciiStrS (
+ CONST CHAR16 *Source,
+ CHAR8 *Destination,
+ UINTN DestMax
+ );
+VOID *
+AllocatePool (
+ UINTN AllocationSize
+ );
+
+UINT16
+WriteUnaligned16 (
+ UINT16 *Buffer,
+ UINT16 Value
+ );
+
+UINT16
+ReadUnaligned16 (
+ CONST UINT16 *Buffer
+ );
+
+VOID *
+AllocateZeroPool (
+ UINTN AllocationSize
+ );
+
+BOOLEAN
+InternalIsHexaDecimalDigitCharacter (
+ CHAR16 Char
+ );
+
+BOOLEAN
+InternalSafeStringIsOverlap (
+ IN VOID *Base1,
+ IN UINTN Size1,
+ IN VOID *Base2,
+ IN UINTN Size2
+ );
+
+BOOLEAN
+InternalSafeStringNoStrOverlap (
+ IN CHAR16 *Str1,
+ IN UINTN Size1,
+ IN CHAR16 *Str2,
+ IN UINTN Size2
+ );
+
+BOOLEAN
+IsHexStr (
+ CHAR16 *Str
+ );
+
+UINTN
+Strtoi (
+ CHAR16 *Str
+ );
+
+VOID
+Strtoi64 (
+ CHAR16 *Str,
+ UINT64 *Data
+ );
+
+VOID
+StrToAscii (
+ CHAR16 *Str,
+ CHAR8 **AsciiStr
+ );
+
+CHAR16 *
+SplitStr (
+ CHAR16 **List,
+ CHAR16 Separator
+ );
+
+/*++
+
+Routine Description:
+ Convert FileName to the long file path, which can support larger than 260 length.
+
+Arguments:
+ FileName - FileName.
+
+Returns:
+ LongFilePath A pointer to the converted long file path.
+
+--*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __GNUC__
+#include <stdio.h>
+#include <sys/stat.h>
+#define stricmp strcasecmp
+#define _stricmp strcasecmp
+#define strnicmp strncasecmp
+#define strcmpi strcasecmp
+size_t _filelength(int fd);
+#ifndef __CYGWIN__
+char *strlwr(char *s);
+#endif
+#endif
+
+//
+// On windows, mkdir only has one parameter.
+// On unix, it has two parameters
+//
+#if defined(__GNUC__)
+#define mkdir(dir, perm) mkdir(dir, perm)
+#else
+#define mkdir(dir, perm) mkdir(dir)
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Common/Compress.h b/roms/edk2/BaseTools/Source/C/Common/Compress.h
new file mode 100644
index 000000000..40255a966
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/Compress.h
@@ -0,0 +1,82 @@
+/** @file
+Header file for compression routine.
+Providing both EFI and Tiano Compress algorithms.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _COMPRESS_H_
+#define _COMPRESS_H_
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "CommonLib.h"
+#include <Common/UefiBaseTypes.h>
+/*++
+
+Routine Description:
+
+ Tiano compression routine.
+
+--*/
+EFI_STATUS
+TianoCompress (
+ IN UINT8 *SrcBuffer,
+ IN UINT32 SrcSize,
+ IN UINT8 *DstBuffer,
+ IN OUT UINT32 *DstSize
+ )
+;
+
+/*++
+
+Routine Description:
+
+ Efi compression routine.
+
+--*/
+EFI_STATUS
+EfiCompress (
+ IN UINT8 *SrcBuffer,
+ IN UINT32 SrcSize,
+ IN UINT8 *DstBuffer,
+ IN OUT UINT32 *DstSize
+ )
+;
+
+/*++
+
+Routine Description:
+
+ The compression routine.
+
+Arguments:
+
+ SrcBuffer - The buffer storing the source data
+ SrcSize - The size of source data
+ DstBuffer - The buffer to store the compressed data
+ DstSize - On input, the size of DstBuffer; On output,
+ the size of the actual compressed data.
+
+Returns:
+
+ EFI_BUFFER_TOO_SMALL - The DstBuffer is too small. In this case,
+ DstSize contains the size needed.
+ EFI_SUCCESS - Compression is successful.
+ EFI_OUT_OF_RESOURCES - No resource to complete function.
+ EFI_INVALID_PARAMETER - Parameter supplied is wrong.
+
+--*/
+typedef
+EFI_STATUS
+(*COMPRESS_FUNCTION) (
+ IN UINT8 *SrcBuffer,
+ IN UINT32 SrcSize,
+ IN UINT8 *DstBuffer,
+ IN OUT UINT32 *DstSize
+ );
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Common/Crc32.c b/roms/edk2/BaseTools/Source/C/Common/Crc32.c
new file mode 100644
index 000000000..7281d5f0e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/Crc32.c
@@ -0,0 +1,313 @@
+/** @file
+CalculateCrc32 routine.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <stdlib.h>
+#include "Crc32.h"
+
+UINT32 mCrcTable[256] = {
+ 0x00000000,
+ 0x77073096,
+ 0xEE0E612C,
+ 0x990951BA,
+ 0x076DC419,
+ 0x706AF48F,
+ 0xE963A535,
+ 0x9E6495A3,
+ 0x0EDB8832,
+ 0x79DCB8A4,
+ 0xE0D5E91E,
+ 0x97D2D988,
+ 0x09B64C2B,
+ 0x7EB17CBD,
+ 0xE7B82D07,
+ 0x90BF1D91,
+ 0x1DB71064,
+ 0x6AB020F2,
+ 0xF3B97148,
+ 0x84BE41DE,
+ 0x1ADAD47D,
+ 0x6DDDE4EB,
+ 0xF4D4B551,
+ 0x83D385C7,
+ 0x136C9856,
+ 0x646BA8C0,
+ 0xFD62F97A,
+ 0x8A65C9EC,
+ 0x14015C4F,
+ 0x63066CD9,
+ 0xFA0F3D63,
+ 0x8D080DF5,
+ 0x3B6E20C8,
+ 0x4C69105E,
+ 0xD56041E4,
+ 0xA2677172,
+ 0x3C03E4D1,
+ 0x4B04D447,
+ 0xD20D85FD,
+ 0xA50AB56B,
+ 0x35B5A8FA,
+ 0x42B2986C,
+ 0xDBBBC9D6,
+ 0xACBCF940,
+ 0x32D86CE3,
+ 0x45DF5C75,
+ 0xDCD60DCF,
+ 0xABD13D59,
+ 0x26D930AC,
+ 0x51DE003A,
+ 0xC8D75180,
+ 0xBFD06116,
+ 0x21B4F4B5,
+ 0x56B3C423,
+ 0xCFBA9599,
+ 0xB8BDA50F,
+ 0x2802B89E,
+ 0x5F058808,
+ 0xC60CD9B2,
+ 0xB10BE924,
+ 0x2F6F7C87,
+ 0x58684C11,
+ 0xC1611DAB,
+ 0xB6662D3D,
+ 0x76DC4190,
+ 0x01DB7106,
+ 0x98D220BC,
+ 0xEFD5102A,
+ 0x71B18589,
+ 0x06B6B51F,
+ 0x9FBFE4A5,
+ 0xE8B8D433,
+ 0x7807C9A2,
+ 0x0F00F934,
+ 0x9609A88E,
+ 0xE10E9818,
+ 0x7F6A0DBB,
+ 0x086D3D2D,
+ 0x91646C97,
+ 0xE6635C01,
+ 0x6B6B51F4,
+ 0x1C6C6162,
+ 0x856530D8,
+ 0xF262004E,
+ 0x6C0695ED,
+ 0x1B01A57B,
+ 0x8208F4C1,
+ 0xF50FC457,
+ 0x65B0D9C6,
+ 0x12B7E950,
+ 0x8BBEB8EA,
+ 0xFCB9887C,
+ 0x62DD1DDF,
+ 0x15DA2D49,
+ 0x8CD37CF3,
+ 0xFBD44C65,
+ 0x4DB26158,
+ 0x3AB551CE,
+ 0xA3BC0074,
+ 0xD4BB30E2,
+ 0x4ADFA541,
+ 0x3DD895D7,
+ 0xA4D1C46D,
+ 0xD3D6F4FB,
+ 0x4369E96A,
+ 0x346ED9FC,
+ 0xAD678846,
+ 0xDA60B8D0,
+ 0x44042D73,
+ 0x33031DE5,
+ 0xAA0A4C5F,
+ 0xDD0D7CC9,
+ 0x5005713C,
+ 0x270241AA,
+ 0xBE0B1010,
+ 0xC90C2086,
+ 0x5768B525,
+ 0x206F85B3,
+ 0xB966D409,
+ 0xCE61E49F,
+ 0x5EDEF90E,
+ 0x29D9C998,
+ 0xB0D09822,
+ 0xC7D7A8B4,
+ 0x59B33D17,
+ 0x2EB40D81,
+ 0xB7BD5C3B,
+ 0xC0BA6CAD,
+ 0xEDB88320,
+ 0x9ABFB3B6,
+ 0x03B6E20C,
+ 0x74B1D29A,
+ 0xEAD54739,
+ 0x9DD277AF,
+ 0x04DB2615,
+ 0x73DC1683,
+ 0xE3630B12,
+ 0x94643B84,
+ 0x0D6D6A3E,
+ 0x7A6A5AA8,
+ 0xE40ECF0B,
+ 0x9309FF9D,
+ 0x0A00AE27,
+ 0x7D079EB1,
+ 0xF00F9344,
+ 0x8708A3D2,
+ 0x1E01F268,
+ 0x6906C2FE,
+ 0xF762575D,
+ 0x806567CB,
+ 0x196C3671,
+ 0x6E6B06E7,
+ 0xFED41B76,
+ 0x89D32BE0,
+ 0x10DA7A5A,
+ 0x67DD4ACC,
+ 0xF9B9DF6F,
+ 0x8EBEEFF9,
+ 0x17B7BE43,
+ 0x60B08ED5,
+ 0xD6D6A3E8,
+ 0xA1D1937E,
+ 0x38D8C2C4,
+ 0x4FDFF252,
+ 0xD1BB67F1,
+ 0xA6BC5767,
+ 0x3FB506DD,
+ 0x48B2364B,
+ 0xD80D2BDA,
+ 0xAF0A1B4C,
+ 0x36034AF6,
+ 0x41047A60,
+ 0xDF60EFC3,
+ 0xA867DF55,
+ 0x316E8EEF,
+ 0x4669BE79,
+ 0xCB61B38C,
+ 0xBC66831A,
+ 0x256FD2A0,
+ 0x5268E236,
+ 0xCC0C7795,
+ 0xBB0B4703,
+ 0x220216B9,
+ 0x5505262F,
+ 0xC5BA3BBE,
+ 0xB2BD0B28,
+ 0x2BB45A92,
+ 0x5CB36A04,
+ 0xC2D7FFA7,
+ 0xB5D0CF31,
+ 0x2CD99E8B,
+ 0x5BDEAE1D,
+ 0x9B64C2B0,
+ 0xEC63F226,
+ 0x756AA39C,
+ 0x026D930A,
+ 0x9C0906A9,
+ 0xEB0E363F,
+ 0x72076785,
+ 0x05005713,
+ 0x95BF4A82,
+ 0xE2B87A14,
+ 0x7BB12BAE,
+ 0x0CB61B38,
+ 0x92D28E9B,
+ 0xE5D5BE0D,
+ 0x7CDCEFB7,
+ 0x0BDBDF21,
+ 0x86D3D2D4,
+ 0xF1D4E242,
+ 0x68DDB3F8,
+ 0x1FDA836E,
+ 0x81BE16CD,
+ 0xF6B9265B,
+ 0x6FB077E1,
+ 0x18B74777,
+ 0x88085AE6,
+ 0xFF0F6A70,
+ 0x66063BCA,
+ 0x11010B5C,
+ 0x8F659EFF,
+ 0xF862AE69,
+ 0x616BFFD3,
+ 0x166CCF45,
+ 0xA00AE278,
+ 0xD70DD2EE,
+ 0x4E048354,
+ 0x3903B3C2,
+ 0xA7672661,
+ 0xD06016F7,
+ 0x4969474D,
+ 0x3E6E77DB,
+ 0xAED16A4A,
+ 0xD9D65ADC,
+ 0x40DF0B66,
+ 0x37D83BF0,
+ 0xA9BCAE53,
+ 0xDEBB9EC5,
+ 0x47B2CF7F,
+ 0x30B5FFE9,
+ 0xBDBDF21C,
+ 0xCABAC28A,
+ 0x53B39330,
+ 0x24B4A3A6,
+ 0xBAD03605,
+ 0xCDD70693,
+ 0x54DE5729,
+ 0x23D967BF,
+ 0xB3667A2E,
+ 0xC4614AB8,
+ 0x5D681B02,
+ 0x2A6F2B94,
+ 0xB40BBE37,
+ 0xC30C8EA1,
+ 0x5A05DF1B,
+ 0x2D02EF8D
+};
+
+EFI_STATUS
+CalculateCrc32 (
+ IN UINT8 *Data,
+ IN UINTN DataSize,
+ IN OUT UINT32 *CrcOut
+ )
+/*++
+
+Routine Description:
+
+ The CalculateCrc32 routine.
+
+Arguments:
+
+ Data - The buffer containing the data to be processed
+ DataSize - The size of data to be processed
+ CrcOut - A pointer to the caller allocated UINT32 that on
+ contains the CRC32 checksum of Data
+
+Returns:
+
+ EFI_SUCCESS - Calculation is successful.
+ EFI_INVALID_PARAMETER - Data / CrcOut = NULL, or DataSize = 0
+
+--*/
+{
+ UINT32 Crc;
+ UINTN Index;
+ UINT8 *Ptr;
+
+ if ((DataSize == 0) || (Data == NULL) || (CrcOut == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Crc = 0xffffffff;
+ for (Index = 0, Ptr = Data; Index < DataSize; Index++, Ptr++) {
+ Crc = (Crc >> 8) ^ mCrcTable[(UINT8) Crc ^ *Ptr];
+ }
+
+ *CrcOut = Crc ^ 0xffffffff;
+
+ return EFI_SUCCESS;
+}
diff --git a/roms/edk2/BaseTools/Source/C/Common/Crc32.h b/roms/edk2/BaseTools/Source/C/Common/Crc32.h
new file mode 100644
index 000000000..61f99b96b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/Crc32.h
@@ -0,0 +1,41 @@
+/** @file
+Header file for CalculateCrc32 routine
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _CRC32_H
+#define _CRC32_H
+
+#include <Common/UefiBaseTypes.h>
+
+EFI_STATUS
+CalculateCrc32 (
+ IN UINT8 *Data,
+ IN UINTN DataSize,
+ IN OUT UINT32 *CrcOut
+ )
+/*++
+
+Routine Description:
+
+ The CalculateCrc32 routine.
+
+Arguments:
+
+ Data - The buffer containing the data to be processed
+ DataSize - The size of data to be processed
+ CrcOut - A pointer to the caller allocated UINT32 that on
+ contains the CRC32 checksum of Data
+
+Returns:
+
+ EFI_SUCCESS - Calculation is successful.
+ EFI_INVALID_PARAMETER - Data / CrcOut = NULL, or DataSize = 0
+
+--*/
+;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Common/Decompress.c b/roms/edk2/BaseTools/Source/C/Common/Decompress.c
new file mode 100644
index 000000000..d85098f13
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/Decompress.c
@@ -0,0 +1,1014 @@
+/** @file
+Decompressor. Algorithm Ported from OPSD code (Decomp.asm) for Efi and Tiano
+compress algorithm.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+--*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include "Decompress.h"
+
+//
+// Decompression algorithm begins here
+//
+#define BITBUFSIZ 32
+#define MAXMATCH 256
+#define THRESHOLD 3
+#define CODE_BIT 16
+#define BAD_TABLE - 1
+
+//
+// C: Char&Len Set; P: Position Set; T: exTra Set
+//
+#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
+#define CBIT 9
+#define EFIPBIT 4
+#define MAXPBIT 5
+#define TBIT 5
+#define MAXNP ((1U << MAXPBIT) - 1)
+#define NT (CODE_BIT + 3)
+#if NT > MAXNP
+#define NPT NT
+#else
+#define NPT MAXNP
+#endif
+
+typedef struct {
+ UINT8 *mSrcBase; // Starting address of compressed data
+ UINT8 *mDstBase; // Starting address of decompressed data
+ UINT32 mOutBuf;
+ UINT32 mInBuf;
+
+ UINT16 mBitCount;
+ UINT32 mBitBuf;
+ UINT32 mSubBitBuf;
+ UINT16 mBlockSize;
+ UINT32 mCompSize;
+ UINT32 mOrigSize;
+
+ UINT16 mBadTableFlag;
+
+ UINT16 mLeft[2 * NC - 1];
+ UINT16 mRight[2 * NC - 1];
+ UINT8 mCLen[NC];
+ UINT8 mPTLen[NPT];
+ UINT16 mCTable[4096];
+ UINT16 mPTTable[256];
+} SCRATCH_DATA;
+
+STATIC UINT16 mPbit = EFIPBIT;
+
+STATIC
+VOID
+FillBuf (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 NumOfBits
+ )
+/*++
+
+Routine Description:
+
+ Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
+
+Arguments:
+
+ Sd - The global scratch data
+ NumOfBit - The number of bits to shift and read.
+
+Returns: (VOID)
+
+--*/
+{
+ Sd->mBitBuf = (UINT32) (((UINT64)Sd->mBitBuf) << NumOfBits);
+
+ while (NumOfBits > Sd->mBitCount) {
+
+ Sd->mBitBuf |= (UINT32) (((UINT64)Sd->mSubBitBuf) << (NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount)));
+
+ if (Sd->mCompSize > 0) {
+ //
+ // Get 1 byte into SubBitBuf
+ //
+ Sd->mCompSize--;
+ Sd->mSubBitBuf = 0;
+ Sd->mSubBitBuf = Sd->mSrcBase[Sd->mInBuf++];
+ Sd->mBitCount = 8;
+
+ } else {
+ //
+ // No more bits from the source, just pad zero bit.
+ //
+ Sd->mSubBitBuf = 0;
+ Sd->mBitCount = 8;
+
+ }
+ }
+
+ Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits);
+ Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
+}
+
+STATIC
+UINT32
+GetBits (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 NumOfBits
+ )
+/*++
+
+Routine Description:
+
+ Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
+ NumOfBits of bits from source. Returns NumOfBits of bits that are
+ popped out.
+
+Arguments:
+
+ Sd - The global scratch data.
+ NumOfBits - The number of bits to pop and read.
+
+Returns:
+
+ The bits that are popped out.
+
+--*/
+{
+ UINT32 OutBits;
+
+ OutBits = (UINT32) (Sd->mBitBuf >> (BITBUFSIZ - NumOfBits));
+
+ FillBuf (Sd, NumOfBits);
+
+ return OutBits;
+}
+
+STATIC
+UINT16
+MakeTable (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 NumOfChar,
+ IN UINT8 *BitLen,
+ IN UINT16 TableBits,
+ OUT UINT16 *Table
+ )
+/*++
+
+Routine Description:
+
+ Creates Huffman Code mapping table according to code length array.
+
+Arguments:
+
+ Sd - The global scratch data
+ NumOfChar - Number of symbols in the symbol set
+ BitLen - Code length array
+ TableBits - The width of the mapping table
+ Table - The table
+
+Returns:
+
+ 0 - OK.
+ BAD_TABLE - The table is corrupted.
+
+--*/
+{
+ UINT16 Count[17];
+ UINT16 Weight[17];
+ UINT16 Start[18];
+ UINT16 *Pointer;
+ UINT16 Index3;
+ UINT16 Index;
+ UINT16 Len;
+ UINT16 Char;
+ UINT16 JuBits;
+ UINT16 Avail;
+ UINT16 NextCode;
+ UINT16 Mask;
+ UINT16 MaxTableLength;
+
+ for (Index = 1; Index <= 16; Index++) {
+ Count[Index] = 0;
+ }
+
+ for (Index = 0; Index < NumOfChar; Index++) {
+ if (BitLen[Index] > 16) {
+ return (UINT16) BAD_TABLE;
+ }
+ Count[BitLen[Index]]++;
+ }
+
+ Start[1] = 0;
+
+ for (Index = 1; Index <= 16; Index++) {
+ Start[Index + 1] = (UINT16) (Start[Index] + (Count[Index] << (16 - Index)));
+ }
+
+ if (Start[17] != 0) {
+ /*(1U << 16)*/
+ return (UINT16) BAD_TABLE;
+ }
+
+ JuBits = (UINT16) (16 - TableBits);
+
+ for (Index = 1; Index <= TableBits; Index++) {
+ Start[Index] >>= JuBits;
+ Weight[Index] = (UINT16) (1U << (TableBits - Index));
+ }
+
+ while (Index <= 16) {
+ Weight[Index] = (UINT16) (1U << (16 - Index));
+ Index++;
+ }
+
+ Index = (UINT16) (Start[TableBits + 1] >> JuBits);
+
+ if (Index != 0) {
+ Index3 = (UINT16) (1U << TableBits);
+ while (Index != Index3) {
+ Table[Index++] = 0;
+ }
+ }
+
+ Avail = NumOfChar;
+ Mask = (UINT16) (1U << (15 - TableBits));
+ MaxTableLength = (UINT16) (1U << TableBits);
+
+ for (Char = 0; Char < NumOfChar; Char++) {
+
+ Len = BitLen[Char];
+ if (Len == 0 || Len >= 17) {
+ continue;
+ }
+
+ NextCode = (UINT16) (Start[Len] + Weight[Len]);
+
+ if (Len <= TableBits) {
+
+ if (Start[Len] >= NextCode || NextCode > MaxTableLength){
+ return (UINT16) BAD_TABLE;
+ }
+
+ for (Index = Start[Len]; Index < NextCode; Index++) {
+ Table[Index] = Char;
+ }
+
+ } else {
+
+ Index3 = Start[Len];
+ Pointer = &Table[Index3 >> JuBits];
+ Index = (UINT16) (Len - TableBits);
+
+ while (Index != 0) {
+ if (*Pointer == 0) {
+ Sd->mRight[Avail] = Sd->mLeft[Avail] = 0;
+ *Pointer = Avail++;
+ }
+
+ if (Index3 & Mask) {
+ Pointer = &Sd->mRight[*Pointer];
+ } else {
+ Pointer = &Sd->mLeft[*Pointer];
+ }
+
+ Index3 <<= 1;
+ Index--;
+ }
+
+ *Pointer = Char;
+
+ }
+
+ Start[Len] = NextCode;
+ }
+ //
+ // Succeeds
+ //
+ return 0;
+}
+
+STATIC
+UINT32
+DecodeP (
+ IN SCRATCH_DATA *Sd
+ )
+/*++
+
+Routine Description:
+
+ Decodes a position value.
+
+Arguments:
+
+ Sd - the global scratch data
+
+Returns:
+
+ The position value decoded.
+
+--*/
+{
+ UINT16 Val;
+ UINT32 Mask;
+ UINT32 Pos;
+
+ Val = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
+
+ if (Val >= MAXNP) {
+ Mask = 1U << (BITBUFSIZ - 1 - 8);
+
+ do {
+
+ if (Sd->mBitBuf & Mask) {
+ Val = Sd->mRight[Val];
+ } else {
+ Val = Sd->mLeft[Val];
+ }
+
+ Mask >>= 1;
+ } while (Val >= MAXNP);
+ }
+ //
+ // Advance what we have read
+ //
+ FillBuf (Sd, Sd->mPTLen[Val]);
+
+ Pos = Val;
+ if (Val > 1) {
+ Pos = (UINT32) ((1U << (Val - 1)) + GetBits (Sd, (UINT16) (Val - 1)));
+ }
+
+ return Pos;
+}
+
+STATIC
+UINT16
+ReadPTLen (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 nn,
+ IN UINT16 nbit,
+ IN UINT16 Special
+ )
+/*++
+
+Routine Description:
+
+ Reads code lengths for the Extra Set or the Position Set
+
+Arguments:
+
+ Sd - The global scratch data
+ nn - Number of symbols
+ nbit - Number of bits needed to represent nn
+ Special - The special symbol that needs to be taken care of
+
+Returns:
+
+ 0 - OK.
+ BAD_TABLE - Table is corrupted.
+
+--*/
+{
+ UINT16 Number;
+ UINT16 CharC;
+ UINT16 Index;
+ UINT32 Mask;
+
+ assert (nn <= NPT);
+
+ Number = (UINT16) GetBits (Sd, nbit);
+
+ if (Number == 0) {
+ CharC = (UINT16) GetBits (Sd, nbit);
+
+ for (Index = 0; Index < 256; Index++) {
+ Sd->mPTTable[Index] = CharC;
+ }
+
+ for (Index = 0; Index < nn; Index++) {
+ Sd->mPTLen[Index] = 0;
+ }
+
+ return 0;
+ }
+
+ Index = 0;
+
+ while (Index < Number && Index < NPT) {
+
+ CharC = (UINT16) (Sd->mBitBuf >> (BITBUFSIZ - 3));
+
+ if (CharC == 7) {
+ Mask = 1U << (BITBUFSIZ - 1 - 3);
+ while (Mask & Sd->mBitBuf) {
+ Mask >>= 1;
+ CharC += 1;
+ }
+ }
+
+ FillBuf (Sd, (UINT16) ((CharC < 7) ? 3 : CharC - 3));
+
+ Sd->mPTLen[Index++] = (UINT8) CharC;
+
+ if (Index == Special) {
+ CharC = (UINT16) GetBits (Sd, 2);
+ CharC--;
+ while ((INT16) (CharC) >= 0 && Index < NPT) {
+ Sd->mPTLen[Index++] = 0;
+ CharC--;
+ }
+ }
+ }
+
+ while (Index < nn && Index < NPT) {
+ Sd->mPTLen[Index++] = 0;
+ }
+
+ return MakeTable (Sd, nn, Sd->mPTLen, 8, Sd->mPTTable);
+}
+
+STATIC
+VOID
+ReadCLen (
+ SCRATCH_DATA *Sd
+ )
+/*++
+
+Routine Description:
+
+ Reads code lengths for Char&Len Set.
+
+Arguments:
+
+ Sd - the global scratch data
+
+Returns: (VOID)
+
+--*/
+{
+ UINT16 Number;
+ UINT16 CharC;
+ UINT16 Index;
+ UINT32 Mask;
+
+ Number = (UINT16) GetBits (Sd, CBIT);
+
+ if (Number == 0) {
+ CharC = (UINT16) GetBits (Sd, CBIT);
+
+ for (Index = 0; Index < NC; Index++) {
+ Sd->mCLen[Index] = 0;
+ }
+
+ for (Index = 0; Index < 4096; Index++) {
+ Sd->mCTable[Index] = CharC;
+ }
+
+ return ;
+ }
+
+ Index = 0;
+ while (Index < Number) {
+
+ CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
+ if (CharC >= NT) {
+ Mask = 1U << (BITBUFSIZ - 1 - 8);
+
+ do {
+
+ if (Mask & Sd->mBitBuf) {
+ CharC = Sd->mRight[CharC];
+ } else {
+ CharC = Sd->mLeft[CharC];
+ }
+
+ Mask >>= 1;
+
+ } while (CharC >= NT);
+ }
+ //
+ // Advance what we have read
+ //
+ FillBuf (Sd, Sd->mPTLen[CharC]);
+
+ if (CharC <= 2) {
+
+ if (CharC == 0) {
+ CharC = 1;
+ } else if (CharC == 1) {
+ CharC = (UINT16) (GetBits (Sd, 4) + 3);
+ } else if (CharC == 2) {
+ CharC = (UINT16) (GetBits (Sd, CBIT) + 20);
+ }
+
+ CharC--;
+ while ((INT16) (CharC) >= 0) {
+ Sd->mCLen[Index++] = 0;
+ CharC--;
+ }
+
+ } else {
+
+ Sd->mCLen[Index++] = (UINT8) (CharC - 2);
+
+ }
+ }
+
+ while (Index < NC) {
+ Sd->mCLen[Index++] = 0;
+ }
+
+ MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable);
+
+ return ;
+}
+
+STATIC
+UINT16
+DecodeC (
+ SCRATCH_DATA *Sd
+ )
+/*++
+
+Routine Description:
+
+ Decode a character/length value.
+
+Arguments:
+
+ Sd - The global scratch data.
+
+Returns:
+
+ The value decoded.
+
+--*/
+{
+ UINT16 Index2;
+ UINT32 Mask;
+
+ if (Sd->mBlockSize == 0) {
+ //
+ // Starting a new block
+ //
+ Sd->mBlockSize = (UINT16) GetBits (Sd, 16);
+ Sd->mBadTableFlag = ReadPTLen (Sd, NT, TBIT, 3);
+ if (Sd->mBadTableFlag != 0) {
+ return 0;
+ }
+
+ ReadCLen (Sd);
+
+ Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, mPbit, (UINT16) (-1));
+ if (Sd->mBadTableFlag != 0) {
+ return 0;
+ }
+ }
+
+ Sd->mBlockSize--;
+ Index2 = Sd->mCTable[Sd->mBitBuf >> (BITBUFSIZ - 12)];
+
+ if (Index2 >= NC) {
+ Mask = 1U << (BITBUFSIZ - 1 - 12);
+
+ do {
+ if (Sd->mBitBuf & Mask) {
+ Index2 = Sd->mRight[Index2];
+ } else {
+ Index2 = Sd->mLeft[Index2];
+ }
+
+ Mask >>= 1;
+ } while (Index2 >= NC);
+ }
+ //
+ // Advance what we have read
+ //
+ FillBuf (Sd, Sd->mCLen[Index2]);
+
+ return Index2;
+}
+
+STATIC
+VOID
+Decode (
+ SCRATCH_DATA *Sd
+ )
+/*++
+
+Routine Description:
+
+ Decode the source data and put the resulting data into the destination buffer.
+
+Arguments:
+
+ Sd - The global scratch data
+
+Returns: (VOID)
+
+ --*/
+{
+ UINT16 BytesRemain;
+ UINT32 DataIdx;
+ UINT16 CharC;
+
+ BytesRemain = (UINT16) (-1);
+
+ DataIdx = 0;
+
+ for (;;) {
+ CharC = DecodeC (Sd);
+ if (Sd->mBadTableFlag != 0) {
+ return ;
+ }
+
+ if (CharC < 256) {
+ //
+ // Process an Original character
+ //
+ Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC;
+ if (Sd->mOutBuf >= Sd->mOrigSize) {
+ return ;
+ }
+
+ } else {
+ //
+ // Process a Pointer
+ //
+ CharC = (UINT16) (CharC - (UINT8_MAX + 1 - THRESHOLD));
+
+ BytesRemain = CharC;
+
+ DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1;
+
+ BytesRemain--;
+ while ((INT16) (BytesRemain) >= 0) {
+ if (Sd->mOutBuf >= Sd->mOrigSize) {
+ return ;
+ }
+ if (DataIdx >= Sd->mOrigSize) {
+ Sd->mBadTableFlag = (UINT16) BAD_TABLE;
+ return ;
+ }
+ Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
+
+ BytesRemain--;
+ }
+ //
+ // Once mOutBuf is fully filled, directly return
+ //
+ if (Sd->mOutBuf >= Sd->mOrigSize) {
+ return ;
+ }
+ }
+ }
+
+ return ;
+}
+
+EFI_STATUS
+GetInfo (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ OUT UINT32 *DstSize,
+ OUT UINT32 *ScratchSize
+ )
+/*++
+
+Routine Description:
+
+ The implementation of EFI_DECOMPRESS_PROTOCOL.GetInfo().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ DstSize - The size of destination buffer.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successfully retrieved.
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+--*/
+{
+ UINT8 *Src;
+ UINT32 CompSize;
+
+ *ScratchSize = sizeof (SCRATCH_DATA);
+
+ Src = Source;
+ if (SrcSize < 8) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ CompSize = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
+ *DstSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
+
+ if (SrcSize < CompSize + 8 || (CompSize + 8) < 8) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+Decompress (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
+ )
+/*++
+
+Routine Description:
+
+ The implementation Efi and Tiano Decompress().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ Destination - The destination buffer to store the decompressed data
+ DstSize - The size of destination buffer.
+ Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - Decompression is successful
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+--*/
+{
+ UINT32 Index;
+ UINT32 CompSize;
+ UINT32 OrigSize;
+ EFI_STATUS Status;
+ SCRATCH_DATA *Sd;
+ UINT8 *Src;
+ UINT8 *Dst;
+
+ Status = EFI_SUCCESS;
+ Src = Source;
+ Dst = Destination;
+
+ if (ScratchSize < sizeof (SCRATCH_DATA)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Sd = (SCRATCH_DATA *) Scratch;
+
+ if (SrcSize < 8) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ CompSize = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
+ OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
+
+ if (SrcSize < CompSize + 8 || (CompSize + 8) < 8) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (DstSize != OrigSize) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Src = Src + 8;
+
+ for (Index = 0; Index < sizeof (SCRATCH_DATA); Index++) {
+ ((UINT8 *) Sd)[Index] = 0;
+ }
+
+ Sd->mSrcBase = Src;
+ Sd->mDstBase = Dst;
+ Sd->mCompSize = CompSize;
+ Sd->mOrigSize = OrigSize;
+
+ //
+ // Fill the first BITBUFSIZ bits
+ //
+ FillBuf (Sd, BITBUFSIZ);
+
+ //
+ // Decompress it
+ //
+ Decode (Sd);
+
+ if (Sd->mBadTableFlag != 0) {
+ //
+ // Something wrong with the source
+ //
+ Status = EFI_INVALID_PARAMETER;
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+EfiGetInfo (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ OUT UINT32 *DstSize,
+ OUT UINT32 *ScratchSize
+ )
+/*++
+
+Routine Description:
+
+ The implementation Efi Decompress GetInfo().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ DstSize - The size of destination buffer.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successfully retrieved.
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+--*/
+{
+ return GetInfo (Source, SrcSize, DstSize, ScratchSize);
+}
+
+EFI_STATUS
+TianoGetInfo (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ OUT UINT32 *DstSize,
+ OUT UINT32 *ScratchSize
+ )
+/*++
+
+Routine Description:
+
+ The implementation Tiano Decompress GetInfo().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ DstSize - The size of destination buffer.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successfully retrieved.
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+--*/
+{
+ return GetInfo (Source, SrcSize, DstSize, ScratchSize);
+}
+
+EFI_STATUS
+EfiDecompress (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
+ )
+/*++
+
+Routine Description:
+
+ The implementation of Efi Decompress().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ Destination - The destination buffer to store the decompressed data
+ DstSize - The size of destination buffer.
+ Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - Decompression is successful
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+--*/
+{
+ mPbit = EFIPBIT;
+ return Decompress (Source, SrcSize, Destination, DstSize, Scratch, ScratchSize);
+}
+
+EFI_STATUS
+TianoDecompress (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
+ )
+/*++
+
+Routine Description:
+
+ The implementation of Tiano Decompress().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ Destination - The destination buffer to store the decompressed data
+ DstSize - The size of destination buffer.
+ Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - Decompression is successful
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+--*/
+{
+ mPbit = MAXPBIT;
+ return Decompress (Source, SrcSize, Destination, DstSize, Scratch, ScratchSize);
+}
+
+EFI_STATUS
+Extract (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ OUT VOID **Destination,
+ OUT UINT32 *DstSize,
+ IN UINTN Algorithm
+ )
+{
+ VOID *Scratch;
+ UINT32 ScratchSize;
+ EFI_STATUS Status;
+
+ Scratch = NULL;
+ Status = EFI_SUCCESS;
+
+ switch (Algorithm) {
+ case 0:
+ *Destination = (VOID *)malloc(SrcSize);
+ if (*Destination != NULL) {
+ memcpy(*Destination, Source, SrcSize);
+ } else {
+ Status = EFI_OUT_OF_RESOURCES;
+ }
+ break;
+ case 1:
+ Status = EfiGetInfo(Source, SrcSize, DstSize, &ScratchSize);
+ if (Status == EFI_SUCCESS) {
+ Scratch = (VOID *)malloc(ScratchSize);
+ if (Scratch == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ *Destination = (VOID *)malloc(*DstSize);
+ if (*Destination == NULL) {
+ free (Scratch);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = EfiDecompress(Source, SrcSize, *Destination, *DstSize, Scratch, ScratchSize);
+ }
+ break;
+ case 2:
+ Status = TianoGetInfo(Source, SrcSize, DstSize, &ScratchSize);
+ if (Status == EFI_SUCCESS) {
+ Scratch = (VOID *)malloc(ScratchSize);
+ if (Scratch == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ *Destination = (VOID *)malloc(*DstSize);
+ if (*Destination == NULL) {
+ free (Scratch);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = TianoDecompress(Source, SrcSize, *Destination, *DstSize, Scratch, ScratchSize);
+ }
+ break;
+ default:
+ Status = EFI_INVALID_PARAMETER;
+ }
+
+ if (Scratch != NULL) {
+ free (Scratch);
+ }
+
+ return Status;
+}
+
+
diff --git a/roms/edk2/BaseTools/Source/C/Common/Decompress.h b/roms/edk2/BaseTools/Source/C/Common/Decompress.h
new file mode 100644
index 000000000..983a27d8f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/Decompress.h
@@ -0,0 +1,159 @@
+/** @file
+Header file for compression routine
+
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFI_DECOMPRESS_H
+#define _EFI_DECOMPRESS_H
+
+#include <Common/UefiBaseTypes.h>
+
+EFI_STATUS
+EfiGetInfo (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ OUT UINT32 *DstSize,
+ OUT UINT32 *ScratchSize
+ );
+/**
+
+Routine Description:
+
+ The implementation Efi Decompress GetInfo().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ DstSize - The size of destination buffer.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successfully retrieved.
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+**/
+
+EFI_STATUS
+EfiDecompress (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
+ );
+/**
+
+Routine Description:
+
+ The implementation of Efi Decompress().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ Destination - The destination buffer to store the decompressed data
+ DstSize - The size of destination buffer.
+ Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - Decompression is successful
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+**/
+
+EFI_STATUS
+TianoGetInfo (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ OUT UINT32 *DstSize,
+ OUT UINT32 *ScratchSize
+ );
+/**
+
+Routine Description:
+
+ The implementation Tiano Decompress GetInfo().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ DstSize - The size of destination buffer.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successfully retrieved.
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+**/
+
+EFI_STATUS
+TianoDecompress (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
+ );
+/**
+
+Routine Description:
+
+ The implementation of Tiano Decompress().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ SrcSize - The size of source buffer
+ Destination - The destination buffer to store the decompressed data
+ DstSize - The size of destination buffer.
+ Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
+ ScratchSize - The size of scratch buffer.
+
+Returns:
+
+ EFI_SUCCESS - Decompression is successful
+ EFI_INVALID_PARAMETER - The source data is corrupted
+
+**/
+
+typedef
+EFI_STATUS
+(*GETINFO_FUNCTION) (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ OUT UINT32 *DstSize,
+ OUT UINT32 *ScratchSize
+ );
+
+typedef
+EFI_STATUS
+(*DECOMPRESS_FUNCTION) (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DstSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
+ );
+
+EFI_STATUS
+Extract (
+ IN VOID *Source,
+ IN UINT32 SrcSize,
+ OUT VOID **Destination,
+ OUT UINT32 *DstSize,
+ IN UINTN Algorithm
+ );
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Common/EfiCompress.c b/roms/edk2/BaseTools/Source/C/Common/EfiCompress.c
new file mode 100644
index 000000000..db5ebe315
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/EfiCompress.c
@@ -0,0 +1,1591 @@
+/** @file
+Compression routine. The compression algorithm is a mixture of LZ77 and Huffman
+coding. LZ77 transforms the source data into a sequence of Original Characters
+and Pointers to repeated strings. This sequence is further divided into Blocks
+and Huffman codings are applied to each Block.
+
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "Compress.h"
+
+
+//
+// Macro Definitions
+//
+
+#undef UINT8_MAX
+typedef INT16 NODE;
+#define UINT8_MAX 0xff
+#define UINT8_BIT 8
+#define THRESHOLD 3
+#define INIT_CRC 0
+#define WNDBIT 13
+#define WNDSIZ (1U << WNDBIT)
+#define MAXMATCH 256
+#define PERC_FLAG 0x8000U
+#define CODE_BIT 16
+#define NIL 0
+#define MAX_HASH_VAL (3 * WNDSIZ + (WNDSIZ / 512 + 1) * UINT8_MAX)
+#define HASH(p, c) ((p) + ((c) << (WNDBIT - 9)) + WNDSIZ * 2)
+#define CRCPOLY 0xA001
+#define UPDATE_CRC(c) mCrc = mCrcTable[(mCrc ^ (c)) & 0xFF] ^ (mCrc >> UINT8_BIT)
+
+//
+// C: the Char&Len Set; P: the Position Set; T: the exTra Set
+//
+
+#define NC (UINT8_MAX + MAXMATCH + 2 - THRESHOLD)
+#define CBIT 9
+#define NP (WNDBIT + 1)
+#define PBIT 4
+#define NT (CODE_BIT + 3)
+#define TBIT 5
+#if NT > NP
+ #define NPT NT
+#else
+ #define NPT NP
+#endif
+
+//
+// Function Prototypes
+//
+
+STATIC
+VOID
+PutDword(
+ IN UINT32 Data
+ );
+
+STATIC
+EFI_STATUS
+AllocateMemory (
+ );
+
+STATIC
+VOID
+FreeMemory (
+ );
+
+STATIC
+VOID
+InitSlide (
+ );
+
+STATIC
+NODE
+Child (
+ IN NODE q,
+ IN UINT8 c
+ );
+
+STATIC
+VOID
+MakeChild (
+ IN NODE q,
+ IN UINT8 c,
+ IN NODE r
+ );
+
+STATIC
+VOID
+Split (
+ IN NODE Old
+ );
+
+STATIC
+VOID
+InsertNode (
+ );
+
+STATIC
+VOID
+DeleteNode (
+ );
+
+STATIC
+VOID
+GetNextMatch (
+ );
+
+STATIC
+EFI_STATUS
+Encode (
+ );
+
+STATIC
+VOID
+CountTFreq (
+ );
+
+STATIC
+VOID
+WritePTLen (
+ IN INT32 n,
+ IN INT32 nbit,
+ IN INT32 Special
+ );
+
+STATIC
+VOID
+WriteCLen (
+ );
+
+STATIC
+VOID
+EncodeC (
+ IN INT32 c
+ );
+
+STATIC
+VOID
+EncodeP (
+ IN UINT32 p
+ );
+
+STATIC
+VOID
+SendBlock (
+ );
+
+STATIC
+VOID
+Output (
+ IN UINT32 c,
+ IN UINT32 p
+ );
+
+STATIC
+VOID
+HufEncodeStart (
+ );
+
+STATIC
+VOID
+HufEncodeEnd (
+ );
+
+STATIC
+VOID
+MakeCrcTable (
+ );
+
+STATIC
+VOID
+PutBits (
+ IN INT32 n,
+ IN UINT32 x
+ );
+
+STATIC
+INT32
+FreadCrc (
+ OUT UINT8 *p,
+ IN INT32 n
+ );
+
+STATIC
+VOID
+InitPutBits (
+ );
+
+STATIC
+VOID
+CountLen (
+ IN INT32 i
+ );
+
+STATIC
+VOID
+MakeLen (
+ IN INT32 Root
+ );
+
+STATIC
+VOID
+DownHeap (
+ IN INT32 i
+ );
+
+STATIC
+VOID
+MakeCode (
+ IN INT32 n,
+ IN UINT8 Len[],
+ OUT UINT16 Code[]
+ );
+
+STATIC
+INT32
+MakeTree (
+ IN INT32 NParm,
+ IN UINT16 FreqParm[],
+ OUT UINT8 LenParm[],
+ OUT UINT16 CodeParm[]
+ );
+
+
+//
+// Global Variables
+//
+
+STATIC UINT8 *mSrc, *mDst, *mSrcUpperLimit, *mDstUpperLimit;
+
+STATIC UINT8 *mLevel, *mText, *mChildCount, *mBuf, mCLen[NC], mPTLen[NPT], *mLen;
+STATIC INT16 mHeap[NC + 1];
+STATIC INT32 mRemainder, mMatchLen, mBitCount, mHeapSize, mN;
+STATIC UINT32 mBufSiz = 0, mOutputPos, mOutputMask, mSubBitBuf, mCrc;
+STATIC UINT32 mCompSize, mOrigSize;
+
+STATIC UINT16 *mFreq, *mSortPtr, mLenCnt[17], mLeft[2 * NC - 1], mRight[2 * NC - 1],
+ mCrcTable[UINT8_MAX + 1], mCFreq[2 * NC - 1],mCCode[NC],
+ mPFreq[2 * NP - 1], mPTCode[NPT], mTFreq[2 * NT - 1];
+
+STATIC NODE mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL;
+
+
+//
+// functions
+//
+
+EFI_STATUS
+EfiCompress (
+ IN UINT8 *SrcBuffer,
+ IN UINT32 SrcSize,
+ IN UINT8 *DstBuffer,
+ IN OUT UINT32 *DstSize
+ )
+/*++
+
+Routine Description:
+
+ The main compression routine.
+
+Arguments:
+
+ SrcBuffer - The buffer storing the source data
+ SrcSize - The size of source data
+ DstBuffer - The buffer to store the compressed data
+ DstSize - On input, the size of DstBuffer; On output,
+ the size of the actual compressed data.
+
+Returns:
+
+ EFI_BUFFER_TOO_SMALL - The DstBuffer is too small. In this case,
+ DstSize contains the size needed.
+ EFI_SUCCESS - Compression is successful.
+
+--*/
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ //
+ // Initializations
+ //
+ mBufSiz = 0;
+ mBuf = NULL;
+ mText = NULL;
+ mLevel = NULL;
+ mChildCount = NULL;
+ mPosition = NULL;
+ mParent = NULL;
+ mPrev = NULL;
+ mNext = NULL;
+
+
+ mSrc = SrcBuffer;
+ mSrcUpperLimit = mSrc + SrcSize;
+ mDst = DstBuffer;
+ mDstUpperLimit = mDst + *DstSize;
+
+ PutDword(0L);
+ PutDword(0L);
+
+ MakeCrcTable ();
+
+ mOrigSize = mCompSize = 0;
+ mCrc = INIT_CRC;
+
+ //
+ // Compress it
+ //
+
+ Status = Encode();
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Null terminate the compressed data
+ //
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = 0;
+ }
+
+ //
+ // Fill in compressed size and original size
+ //
+ mDst = DstBuffer;
+ PutDword(mCompSize+1);
+ PutDword(mOrigSize);
+
+ //
+ // Return
+ //
+
+ if (mCompSize + 1 + 8 > *DstSize) {
+ *DstSize = mCompSize + 1 + 8;
+ return EFI_BUFFER_TOO_SMALL;
+ } else {
+ *DstSize = mCompSize + 1 + 8;
+ return EFI_SUCCESS;
+ }
+
+}
+
+STATIC
+VOID
+PutDword(
+ IN UINT32 Data
+ )
+/*++
+
+Routine Description:
+
+ Put a dword to output stream
+
+Arguments:
+
+ Data - the dword to put
+
+Returns: (VOID)
+
+--*/
+{
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = (UINT8)(((UINT8)(Data )) & 0xff);
+ }
+
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = (UINT8)(((UINT8)(Data >> 0x08)) & 0xff);
+ }
+
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = (UINT8)(((UINT8)(Data >> 0x10)) & 0xff);
+ }
+
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = (UINT8)(((UINT8)(Data >> 0x18)) & 0xff);
+ }
+}
+
+STATIC
+EFI_STATUS
+AllocateMemory ()
+/*++
+
+Routine Description:
+
+ Allocate memory spaces for data structures used in compression process
+
+Arguments: (VOID)
+
+Returns:
+
+ EFI_SUCCESS - Memory is allocated successfully
+ EFI_OUT_OF_RESOURCES - Allocation fails
+
+--*/
+{
+ UINT32 i;
+
+ mText = malloc (WNDSIZ * 2 + MAXMATCH);
+ if (mText == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ for (i = 0 ; i < WNDSIZ * 2 + MAXMATCH; i ++) {
+ mText[i] = 0;
+ }
+
+ mLevel = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof(*mLevel));
+ mChildCount = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof(*mChildCount));
+ mPosition = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof(*mPosition));
+ mParent = malloc (WNDSIZ * 2 * sizeof(*mParent));
+ mPrev = malloc (WNDSIZ * 2 * sizeof(*mPrev));
+ mNext = malloc ((MAX_HASH_VAL + 1) * sizeof(*mNext));
+ if (mLevel == NULL || mChildCount == NULL || mPosition == NULL ||
+ mParent == NULL || mPrev == NULL || mNext == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mBufSiz = 16 * 1024U;
+ while ((mBuf = malloc(mBufSiz)) == NULL) {
+ mBufSiz = (mBufSiz / 10U) * 9U;
+ if (mBufSiz < 4 * 1024U) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ }
+ mBuf[0] = 0;
+
+ return EFI_SUCCESS;
+}
+
+VOID
+FreeMemory ()
+/*++
+
+Routine Description:
+
+ Called when compression is completed to free memory previously allocated.
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ if (mText) {
+ free (mText);
+ }
+
+ if (mLevel) {
+ free (mLevel);
+ }
+
+ if (mChildCount) {
+ free (mChildCount);
+ }
+
+ if (mPosition) {
+ free (mPosition);
+ }
+
+ if (mParent) {
+ free (mParent);
+ }
+
+ if (mPrev) {
+ free (mPrev);
+ }
+
+ if (mNext) {
+ free (mNext);
+ }
+
+ if (mBuf) {
+ free (mBuf);
+ }
+
+ return;
+}
+
+
+STATIC
+VOID
+InitSlide ()
+/*++
+
+Routine Description:
+
+ Initialize String Info Log data structures
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ NODE i;
+
+ for (i = WNDSIZ; i <= WNDSIZ + UINT8_MAX; i++) {
+ mLevel[i] = 1;
+ mPosition[i] = NIL; /* sentinel */
+ }
+ for (i = WNDSIZ; i < WNDSIZ * 2; i++) {
+ mParent[i] = NIL;
+ }
+ mAvail = 1;
+ for (i = 1; i < WNDSIZ - 1; i++) {
+ mNext[i] = (NODE)(i + 1);
+ }
+
+ mNext[WNDSIZ - 1] = NIL;
+ for (i = WNDSIZ * 2; i <= MAX_HASH_VAL; i++) {
+ mNext[i] = NIL;
+ }
+}
+
+
+STATIC
+NODE
+Child (
+ IN NODE q,
+ IN UINT8 c
+ )
+/*++
+
+Routine Description:
+
+ Find child node given the parent node and the edge character
+
+Arguments:
+
+ q - the parent node
+ c - the edge character
+
+Returns:
+
+ The child node (NIL if not found)
+
+--*/
+{
+ NODE r;
+
+ r = mNext[HASH(q, c)];
+ mParent[NIL] = q; /* sentinel */
+ while (mParent[r] != q) {
+ r = mNext[r];
+ }
+
+ return r;
+}
+
+STATIC
+VOID
+MakeChild (
+ IN NODE q,
+ IN UINT8 c,
+ IN NODE r
+ )
+/*++
+
+Routine Description:
+
+ Create a new child for a given parent node.
+
+Arguments:
+
+ q - the parent node
+ c - the edge character
+ r - the child node
+
+Returns: (VOID)
+
+--*/
+{
+ NODE h, t;
+
+ h = (NODE)HASH(q, c);
+ t = mNext[h];
+ mNext[h] = r;
+ mNext[r] = t;
+ mPrev[t] = r;
+ mPrev[r] = h;
+ mParent[r] = q;
+ mChildCount[q]++;
+}
+
+STATIC
+VOID
+Split (
+ NODE Old
+ )
+/*++
+
+Routine Description:
+
+ Split a node.
+
+Arguments:
+
+ Old - the node to split
+
+Returns: (VOID)
+
+--*/
+{
+ NODE New, t;
+
+ New = mAvail;
+ mAvail = mNext[New];
+ mChildCount[New] = 0;
+ t = mPrev[Old];
+ mPrev[New] = t;
+ mNext[t] = New;
+ t = mNext[Old];
+ mNext[New] = t;
+ mPrev[t] = New;
+ mParent[New] = mParent[Old];
+ mLevel[New] = (UINT8)mMatchLen;
+ mPosition[New] = mPos;
+ MakeChild(New, mText[mMatchPos + mMatchLen], Old);
+ MakeChild(New, mText[mPos + mMatchLen], mPos);
+}
+
+STATIC
+VOID
+InsertNode ()
+/*++
+
+Routine Description:
+
+ Insert string info for current position into the String Info Log
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ NODE q, r, j, t;
+ UINT8 c, *t1, *t2;
+
+ if (mMatchLen >= 4) {
+
+ //
+ // We have just got a long match, the target tree
+ // can be located by MatchPos + 1. Traverse the tree
+ // from bottom up to get to a proper starting point.
+ // The usage of PERC_FLAG ensures proper node deletion
+ // in DeleteNode() later.
+ //
+
+ mMatchLen--;
+ r = (INT16)((mMatchPos + 1) | WNDSIZ);
+ while ((q = mParent[r]) == NIL) {
+ r = mNext[r];
+ }
+ while (mLevel[q] >= mMatchLen) {
+ r = q; q = mParent[q];
+ }
+ t = q;
+ while (mPosition[t] < 0) {
+ mPosition[t] = mPos;
+ t = mParent[t];
+ }
+ if (t < WNDSIZ) {
+ mPosition[t] = (NODE)(mPos | PERC_FLAG);
+ }
+ } else {
+
+ //
+ // Locate the target tree
+ //
+
+ q = (INT16)(mText[mPos] + WNDSIZ);
+ c = mText[mPos + 1];
+ if ((r = Child(q, c)) == NIL) {
+ MakeChild(q, c, mPos);
+ mMatchLen = 1;
+ return;
+ }
+ mMatchLen = 2;
+ }
+
+ //
+ // Traverse down the tree to find a match.
+ // Update Position value along the route.
+ // Node split or creation is involved.
+ //
+
+ for ( ; ; ) {
+ if (r >= WNDSIZ) {
+ j = MAXMATCH;
+ mMatchPos = r;
+ } else {
+ j = mLevel[r];
+ mMatchPos = (NODE)(mPosition[r] & ~PERC_FLAG);
+ }
+ if (mMatchPos >= mPos) {
+ mMatchPos -= WNDSIZ;
+ }
+ t1 = &mText[mPos + mMatchLen];
+ t2 = &mText[mMatchPos + mMatchLen];
+ while (mMatchLen < j) {
+ if (*t1 != *t2) {
+ Split(r);
+ return;
+ }
+ mMatchLen++;
+ t1++;
+ t2++;
+ }
+ if (mMatchLen >= MAXMATCH) {
+ break;
+ }
+ mPosition[r] = mPos;
+ q = r;
+ if ((r = Child(q, *t1)) == NIL) {
+ MakeChild(q, *t1, mPos);
+ return;
+ }
+ mMatchLen++;
+ }
+ t = mPrev[r];
+ mPrev[mPos] = t;
+ mNext[t] = mPos;
+ t = mNext[r];
+ mNext[mPos] = t;
+ mPrev[t] = mPos;
+ mParent[mPos] = q;
+ mParent[r] = NIL;
+
+ //
+ // Special usage of 'next'
+ //
+ mNext[r] = mPos;
+
+}
+
+STATIC
+VOID
+DeleteNode ()
+/*++
+
+Routine Description:
+
+ Delete outdated string info. (The Usage of PERC_FLAG
+ ensures a clean deletion)
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ NODE q, r, s, t, u;
+
+ if (mParent[mPos] == NIL) {
+ return;
+ }
+
+ r = mPrev[mPos];
+ s = mNext[mPos];
+ mNext[r] = s;
+ mPrev[s] = r;
+ r = mParent[mPos];
+ mParent[mPos] = NIL;
+ if (r >= WNDSIZ || --mChildCount[r] > 1) {
+ return;
+ }
+ t = (NODE)(mPosition[r] & ~PERC_FLAG);
+ if (t >= mPos) {
+ t -= WNDSIZ;
+ }
+ s = t;
+ q = mParent[r];
+ while ((u = mPosition[q]) & PERC_FLAG) {
+ u &= ~PERC_FLAG;
+ if (u >= mPos) {
+ u -= WNDSIZ;
+ }
+ if (u > s) {
+ s = u;
+ }
+ mPosition[q] = (INT16)(s | WNDSIZ);
+ q = mParent[q];
+ }
+ if (q < WNDSIZ) {
+ if (u >= mPos) {
+ u -= WNDSIZ;
+ }
+ if (u > s) {
+ s = u;
+ }
+ mPosition[q] = (INT16)(s | WNDSIZ | PERC_FLAG);
+ }
+ s = Child(r, mText[t + mLevel[r]]);
+ t = mPrev[s];
+ u = mNext[s];
+ mNext[t] = u;
+ mPrev[u] = t;
+ t = mPrev[r];
+ mNext[t] = s;
+ mPrev[s] = t;
+ t = mNext[r];
+ mPrev[t] = s;
+ mNext[s] = t;
+ mParent[s] = mParent[r];
+ mParent[r] = NIL;
+ mNext[r] = mAvail;
+ mAvail = r;
+}
+
+STATIC
+VOID
+GetNextMatch ()
+/*++
+
+Routine Description:
+
+ Advance the current position (read in new data if needed).
+ Delete outdated string info. Find a match string for current position.
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 n;
+
+ mRemainder--;
+ if (++mPos == WNDSIZ * 2) {
+ memmove(&mText[0], &mText[WNDSIZ], WNDSIZ + MAXMATCH);
+ n = FreadCrc(&mText[WNDSIZ + MAXMATCH], WNDSIZ);
+ mRemainder += n;
+ mPos = WNDSIZ;
+ }
+ DeleteNode();
+ InsertNode();
+}
+
+STATIC
+EFI_STATUS
+Encode ()
+/*++
+
+Routine Description:
+
+ The main controlling routine for compression process.
+
+Arguments: (VOID)
+
+Returns:
+
+ EFI_SUCCESS - The compression is successful
+ EFI_OUT_0F_RESOURCES - Not enough memory for compression process
+
+--*/
+{
+ EFI_STATUS Status;
+ INT32 LastMatchLen;
+ NODE LastMatchPos;
+
+ Status = AllocateMemory();
+ if (EFI_ERROR(Status)) {
+ FreeMemory();
+ return Status;
+ }
+
+ InitSlide();
+
+ HufEncodeStart();
+
+ mRemainder = FreadCrc(&mText[WNDSIZ], WNDSIZ + MAXMATCH);
+
+ mMatchLen = 0;
+ mPos = WNDSIZ;
+ InsertNode();
+ if (mMatchLen > mRemainder) {
+ mMatchLen = mRemainder;
+ }
+ while (mRemainder > 0) {
+ LastMatchLen = mMatchLen;
+ LastMatchPos = mMatchPos;
+ GetNextMatch();
+ if (mMatchLen > mRemainder) {
+ mMatchLen = mRemainder;
+ }
+
+ if (mMatchLen > LastMatchLen || LastMatchLen < THRESHOLD) {
+
+ //
+ // Not enough benefits are gained by outputting a pointer,
+ // so just output the original character
+ //
+
+ Output(mText[mPos - 1], 0);
+ } else {
+
+ //
+ // Outputting a pointer is beneficial enough, do it.
+ //
+
+ Output(LastMatchLen + (UINT8_MAX + 1 - THRESHOLD),
+ (mPos - LastMatchPos - 2) & (WNDSIZ - 1));
+ while (--LastMatchLen > 0) {
+ GetNextMatch();
+ }
+ if (mMatchLen > mRemainder) {
+ mMatchLen = mRemainder;
+ }
+ }
+ }
+
+ HufEncodeEnd();
+ FreeMemory();
+ return EFI_SUCCESS;
+}
+
+STATIC
+VOID
+CountTFreq ()
+/*++
+
+Routine Description:
+
+ Count the frequencies for the Extra Set
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 i, k, n, Count;
+
+ for (i = 0; i < NT; i++) {
+ mTFreq[i] = 0;
+ }
+ n = NC;
+ while (n > 0 && mCLen[n - 1] == 0) {
+ n--;
+ }
+ i = 0;
+ while (i < n) {
+ k = mCLen[i++];
+ if (k == 0) {
+ Count = 1;
+ while (i < n && mCLen[i] == 0) {
+ i++;
+ Count++;
+ }
+ if (Count <= 2) {
+ mTFreq[0] = (UINT16)(mTFreq[0] + Count);
+ } else if (Count <= 18) {
+ mTFreq[1]++;
+ } else if (Count == 19) {
+ mTFreq[0]++;
+ mTFreq[1]++;
+ } else {
+ mTFreq[2]++;
+ }
+ } else {
+ mTFreq[k + 2]++;
+ }
+ }
+}
+
+STATIC
+VOID
+WritePTLen (
+ IN INT32 n,
+ IN INT32 nbit,
+ IN INT32 Special
+ )
+/*++
+
+Routine Description:
+
+ Outputs the code length array for the Extra Set or the Position Set.
+
+Arguments:
+
+ n - the number of symbols
+ nbit - the number of bits needed to represent 'n'
+ Special - the special symbol that needs to be take care of
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 i, k;
+
+ while (n > 0 && mPTLen[n - 1] == 0) {
+ n--;
+ }
+ PutBits(nbit, n);
+ i = 0;
+ while (i < n) {
+ k = mPTLen[i++];
+ if (k <= 6) {
+ PutBits(3, k);
+ } else {
+ PutBits(k - 3, (1U << (k - 3)) - 2);
+ }
+ if (i == Special) {
+ while (i < 6 && mPTLen[i] == 0) {
+ i++;
+ }
+ PutBits(2, (i - 3) & 3);
+ }
+ }
+}
+
+STATIC
+VOID
+WriteCLen ()
+/*++
+
+Routine Description:
+
+ Outputs the code length array for Char&Length Set
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 i, k, n, Count;
+
+ n = NC;
+ while (n > 0 && mCLen[n - 1] == 0) {
+ n--;
+ }
+ PutBits(CBIT, n);
+ i = 0;
+ while (i < n) {
+ k = mCLen[i++];
+ if (k == 0) {
+ Count = 1;
+ while (i < n && mCLen[i] == 0) {
+ i++;
+ Count++;
+ }
+ if (Count <= 2) {
+ for (k = 0; k < Count; k++) {
+ PutBits(mPTLen[0], mPTCode[0]);
+ }
+ } else if (Count <= 18) {
+ PutBits(mPTLen[1], mPTCode[1]);
+ PutBits(4, Count - 3);
+ } else if (Count == 19) {
+ PutBits(mPTLen[0], mPTCode[0]);
+ PutBits(mPTLen[1], mPTCode[1]);
+ PutBits(4, 15);
+ } else {
+ PutBits(mPTLen[2], mPTCode[2]);
+ PutBits(CBIT, Count - 20);
+ }
+ } else {
+ PutBits(mPTLen[k + 2], mPTCode[k + 2]);
+ }
+ }
+}
+
+STATIC
+VOID
+EncodeC (
+ IN INT32 c
+ )
+{
+ PutBits(mCLen[c], mCCode[c]);
+}
+
+STATIC
+VOID
+EncodeP (
+ IN UINT32 p
+ )
+{
+ UINT32 c, q;
+
+ c = 0;
+ q = p;
+ while (q) {
+ q >>= 1;
+ c++;
+ }
+ PutBits(mPTLen[c], mPTCode[c]);
+ if (c > 1) {
+ PutBits(c - 1, p & (0xFFFFU >> (17 - c)));
+ }
+}
+
+STATIC
+VOID
+SendBlock ()
+/*++
+
+Routine Description:
+
+ Huffman code the block and output it.
+
+Argument: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ UINT32 i, k, Flags, Root, Pos, Size;
+ Flags = 0;
+
+ Root = MakeTree(NC, mCFreq, mCLen, mCCode);
+ Size = mCFreq[Root];
+ PutBits(16, Size);
+ if (Root >= NC) {
+ CountTFreq();
+ Root = MakeTree(NT, mTFreq, mPTLen, mPTCode);
+ if (Root >= NT) {
+ WritePTLen(NT, TBIT, 3);
+ } else {
+ PutBits(TBIT, 0);
+ PutBits(TBIT, Root);
+ }
+ WriteCLen();
+ } else {
+ PutBits(TBIT, 0);
+ PutBits(TBIT, 0);
+ PutBits(CBIT, 0);
+ PutBits(CBIT, Root);
+ }
+ Root = MakeTree(NP, mPFreq, mPTLen, mPTCode);
+ if (Root >= NP) {
+ WritePTLen(NP, PBIT, -1);
+ } else {
+ PutBits(PBIT, 0);
+ PutBits(PBIT, Root);
+ }
+ Pos = 0;
+ for (i = 0; i < Size; i++) {
+ if (i % UINT8_BIT == 0) {
+ Flags = mBuf[Pos++];
+ } else {
+ Flags <<= 1;
+ }
+ if (Flags & (1U << (UINT8_BIT - 1))) {
+ EncodeC(mBuf[Pos++] + (1U << UINT8_BIT));
+ k = mBuf[Pos++] << UINT8_BIT;
+ k += mBuf[Pos++];
+ EncodeP(k);
+ } else {
+ EncodeC(mBuf[Pos++]);
+ }
+ }
+ for (i = 0; i < NC; i++) {
+ mCFreq[i] = 0;
+ }
+ for (i = 0; i < NP; i++) {
+ mPFreq[i] = 0;
+ }
+}
+
+
+STATIC
+VOID
+Output (
+ IN UINT32 c,
+ IN UINT32 p
+ )
+/*++
+
+Routine Description:
+
+ Outputs an Original Character or a Pointer
+
+Arguments:
+
+ c - The original character or the 'String Length' element of a Pointer
+ p - The 'Position' field of a Pointer
+
+Returns: (VOID)
+
+--*/
+{
+ STATIC UINT32 CPos;
+
+ if ((mOutputMask >>= 1) == 0) {
+ mOutputMask = 1U << (UINT8_BIT - 1);
+ if (mOutputPos >= mBufSiz - 3 * UINT8_BIT) {
+ SendBlock();
+ mOutputPos = 0;
+ }
+ CPos = mOutputPos++;
+ mBuf[CPos] = 0;
+ }
+ mBuf[mOutputPos++] = (UINT8) c;
+ mCFreq[c]++;
+ if (c >= (1U << UINT8_BIT)) {
+ mBuf[CPos] |= mOutputMask;
+ mBuf[mOutputPos++] = (UINT8)(p >> UINT8_BIT);
+ mBuf[mOutputPos++] = (UINT8) p;
+ c = 0;
+ while (p) {
+ p >>= 1;
+ c++;
+ }
+ mPFreq[c]++;
+ }
+}
+
+STATIC
+VOID
+HufEncodeStart ()
+{
+ INT32 i;
+
+ for (i = 0; i < NC; i++) {
+ mCFreq[i] = 0;
+ }
+ for (i = 0; i < NP; i++) {
+ mPFreq[i] = 0;
+ }
+ mOutputPos = mOutputMask = 0;
+ InitPutBits();
+ return;
+}
+
+STATIC
+VOID
+HufEncodeEnd ()
+{
+ SendBlock();
+
+ //
+ // Flush remaining bits
+ //
+ PutBits(UINT8_BIT - 1, 0);
+
+ return;
+}
+
+
+STATIC
+VOID
+MakeCrcTable ()
+{
+ UINT32 i, j, r;
+
+ for (i = 0; i <= UINT8_MAX; i++) {
+ r = i;
+ for (j = 0; j < UINT8_BIT; j++) {
+ if (r & 1) {
+ r = (r >> 1) ^ CRCPOLY;
+ } else {
+ r >>= 1;
+ }
+ }
+ mCrcTable[i] = (UINT16)r;
+ }
+}
+
+STATIC
+VOID
+PutBits (
+ IN INT32 n,
+ IN UINT32 x
+ )
+/*++
+
+Routine Description:
+
+ Outputs rightmost n bits of x
+
+Arguments:
+
+ n - the rightmost n bits of the data is used
+ x - the data
+
+Returns: (VOID)
+
+--*/
+{
+ UINT8 Temp;
+
+ if (n < mBitCount) {
+ mSubBitBuf |= x << (mBitCount -= n);
+ } else {
+
+ Temp = (UINT8)(mSubBitBuf | (x >> (n -= mBitCount)));
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = Temp;
+ }
+ mCompSize++;
+
+ if (n < UINT8_BIT) {
+ mSubBitBuf = x << (mBitCount = UINT8_BIT - n);
+ } else {
+
+ Temp = (UINT8)(x >> (n - UINT8_BIT));
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = Temp;
+ }
+ mCompSize++;
+
+ mSubBitBuf = x << (mBitCount = 2 * UINT8_BIT - n);
+ }
+ }
+}
+
+STATIC
+INT32
+FreadCrc (
+ OUT UINT8 *p,
+ IN INT32 n
+ )
+/*++
+
+Routine Description:
+
+ Read in source data
+
+Arguments:
+
+ p - the buffer to hold the data
+ n - number of bytes to read
+
+Returns:
+
+ number of bytes actually read
+
+--*/
+{
+ INT32 i;
+
+ for (i = 0; mSrc < mSrcUpperLimit && i < n; i++) {
+ *p++ = *mSrc++;
+ }
+ n = i;
+
+ p -= n;
+ mOrigSize += n;
+ while (--i >= 0) {
+ UPDATE_CRC(*p++);
+ }
+ return n;
+}
+
+
+STATIC
+VOID
+InitPutBits ()
+{
+ mBitCount = UINT8_BIT;
+ mSubBitBuf = 0;
+}
+
+STATIC
+VOID
+CountLen (
+ IN INT32 i
+ )
+/*++
+
+Routine Description:
+
+ Count the number of each code length for a Huffman tree.
+
+Arguments:
+
+ i - the top node
+
+Returns: (VOID)
+
+--*/
+{
+ STATIC INT32 Depth = 0;
+
+ if (i < mN) {
+ mLenCnt[(Depth < 16) ? Depth : 16]++;
+ } else {
+ Depth++;
+ CountLen(mLeft [i]);
+ CountLen(mRight[i]);
+ Depth--;
+ }
+}
+
+STATIC
+VOID
+MakeLen (
+ IN INT32 Root
+ )
+/*++
+
+Routine Description:
+
+ Create code length array for a Huffman tree
+
+Arguments:
+
+ Root - the root of the tree
+
+--*/
+{
+ INT32 i, k;
+ UINT32 Cum;
+
+ for (i = 0; i <= 16; i++) {
+ mLenCnt[i] = 0;
+ }
+ CountLen(Root);
+
+ //
+ // Adjust the length count array so that
+ // no code will be generated longer than its designated length
+ //
+
+ Cum = 0;
+ for (i = 16; i > 0; i--) {
+ Cum += mLenCnt[i] << (16 - i);
+ }
+ while (Cum != (1U << 16)) {
+ mLenCnt[16]--;
+ for (i = 15; i > 0; i--) {
+ if (mLenCnt[i] != 0) {
+ mLenCnt[i]--;
+ mLenCnt[i+1] += 2;
+ break;
+ }
+ }
+ Cum--;
+ }
+ for (i = 16; i > 0; i--) {
+ k = mLenCnt[i];
+ while (--k >= 0) {
+ mLen[*mSortPtr++] = (UINT8)i;
+ }
+ }
+}
+
+STATIC
+VOID
+DownHeap (
+ IN INT32 i
+ )
+{
+ INT32 j, k;
+
+ //
+ // priority queue: send i-th entry down heap
+ //
+
+ k = mHeap[i];
+ while ((j = 2 * i) <= mHeapSize) {
+ if (j < mHeapSize && mFreq[mHeap[j]] > mFreq[mHeap[j + 1]]) {
+ j++;
+ }
+ if (mFreq[k] <= mFreq[mHeap[j]]) {
+ break;
+ }
+ mHeap[i] = mHeap[j];
+ i = j;
+ }
+ mHeap[i] = (INT16)k;
+}
+
+STATIC
+VOID
+MakeCode (
+ IN INT32 n,
+ IN UINT8 Len[],
+ OUT UINT16 Code[]
+ )
+/*++
+
+Routine Description:
+
+ Assign code to each symbol based on the code length array
+
+Arguments:
+
+ n - number of symbols
+ Len - the code length array
+ Code - stores codes for each symbol
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 i;
+ UINT16 Start[18];
+
+ Start[1] = 0;
+ for (i = 1; i <= 16; i++) {
+ Start[i + 1] = (UINT16)((Start[i] + mLenCnt[i]) << 1);
+ }
+ for (i = 0; i < n; i++) {
+ Code[i] = Start[Len[i]]++;
+ }
+}
+
+STATIC
+INT32
+MakeTree (
+ IN INT32 NParm,
+ IN UINT16 FreqParm[],
+ OUT UINT8 LenParm[],
+ OUT UINT16 CodeParm[]
+ )
+/*++
+
+Routine Description:
+
+ Generates Huffman codes given a frequency distribution of symbols
+
+Arguments:
+
+ NParm - number of symbols
+ FreqParm - frequency of each symbol
+ LenParm - code length for each symbol
+ CodeParm - code for each symbol
+
+Returns:
+
+ Root of the Huffman tree.
+
+--*/
+{
+ INT32 i, j, k, Avail;
+
+ //
+ // make tree, calculate len[], return root
+ //
+
+ mN = NParm;
+ mFreq = FreqParm;
+ mLen = LenParm;
+ Avail = mN;
+ mHeapSize = 0;
+ mHeap[1] = 0;
+ for (i = 0; i < mN; i++) {
+ mLen[i] = 0;
+ if (mFreq[i]) {
+ mHeap[++mHeapSize] = (INT16)i;
+ }
+ }
+ if (mHeapSize < 2) {
+ CodeParm[mHeap[1]] = 0;
+ return mHeap[1];
+ }
+ for (i = mHeapSize / 2; i >= 1; i--) {
+
+ //
+ // make priority queue
+ //
+ DownHeap(i);
+ }
+ mSortPtr = CodeParm;
+ do {
+ i = mHeap[1];
+ if (i < mN) {
+ *mSortPtr++ = (UINT16)i;
+ }
+ mHeap[1] = mHeap[mHeapSize--];
+ DownHeap(1);
+ j = mHeap[1];
+ if (j < mN) {
+ *mSortPtr++ = (UINT16)j;
+ }
+ k = Avail++;
+ mFreq[k] = (UINT16)(mFreq[i] + mFreq[j]);
+ mHeap[1] = (INT16)k;
+ DownHeap(1);
+ mLeft[k] = (UINT16)i;
+ mRight[k] = (UINT16)j;
+ } while (mHeapSize > 1);
+
+ mSortPtr = CodeParm;
+ MakeLen(k);
+ MakeCode(NParm, LenParm, CodeParm);
+
+ //
+ // return root
+ //
+ return k;
+}
+
diff --git a/roms/edk2/BaseTools/Source/C/Common/EfiUtilityMsgs.c b/roms/edk2/BaseTools/Source/C/Common/EfiUtilityMsgs.c
new file mode 100644
index 000000000..f8d2a40be
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/EfiUtilityMsgs.c
@@ -0,0 +1,902 @@
+/** @file
+EFI tools utility functions to display warning, error, and informational messages
+
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+--*/
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdarg.h>
+#include <time.h>
+
+#include "EfiUtilityMsgs.h"
+
+//
+// Declare module globals for keeping track of the utility's
+// name and other settings.
+//
+STATIC STATUS mStatus = STATUS_SUCCESS;
+STATIC CHAR8 mUtilityName[50] = { 0 };
+STATIC UINT64 mPrintLogLevel = INFO_LOG_LEVEL;
+STATIC CHAR8 *mSourceFileName = NULL;
+STATIC UINT32 mSourceFileLineNum = 0;
+STATIC UINT32 mErrorCount = 0;
+STATIC UINT32 mWarningCount = 0;
+STATIC UINT32 mMaxErrors = 0;
+STATIC UINT32 mMaxWarnings = 0;
+STATIC UINT32 mMaxWarningsPlusErrors = 0;
+STATIC INT8 mPrintLimitsSet = 0;
+
+STATIC
+VOID
+PrintLimitExceeded (
+ VOID
+ );
+
+VOID
+Error (
+ CHAR8 *FileName,
+ UINT32 LineNumber,
+ UINT32 MessageCode,
+ CHAR8 *Text,
+ CHAR8 *MsgFmt,
+ ...
+ )
+/*++
+
+Routine Description:
+ Prints an error message.
+
+Arguments:
+ All arguments are optional, though the printed message may be useless if
+ at least something valid is not specified.
+
+ FileName - name of the file or application. If not specified, then the
+ utility name (as set by the utility calling SetUtilityName()
+ earlier) is used. Otherwise "Unknown utility" is used.
+
+ LineNumber - the line number of error, typically used by parsers. If the
+ utility is not a parser, then 0 should be specified. Otherwise
+ the FileName and LineNumber info can be used to cause
+ MS Visual Studio to jump to the error.
+
+ MessageCode - an application-specific error code that can be referenced in
+ other documentation.
+
+ Text - the text in question, typically used by parsers.
+
+ MsgFmt - the format string for the error message. Can contain formatting
+ controls for use with the varargs.
+
+Returns:
+ None.
+
+Notes:
+ We print the following (similar to the Warn() and Debug()
+ W
+ Typical error/warning message format:
+
+ bin\VfrCompile.cpp(330) : error C2660: 'AddVfrDataStructField' : function does not take 2 parameters
+
+ BUGBUG -- these three utility functions are almost identical, and
+ should be modified to share code.
+
+ Visual Studio does not find error messages with:
+
+ " error :"
+ " error 1:"
+ " error c1:"
+ " error 1000:"
+ " error c100:"
+
+ It does find:
+ " error c1000:"
+--*/
+{
+ va_list List;
+ //
+ // If limits have been set, then check that we have not exceeded them
+ //
+ if (mPrintLimitsSet) {
+ //
+ // See if we've exceeded our total count
+ //
+ if (mMaxWarningsPlusErrors != 0) {
+ if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
+ PrintLimitExceeded ();
+ return ;
+ }
+ }
+ //
+ // See if we've exceeded our error count
+ //
+ if (mMaxErrors != 0) {
+ if (mErrorCount > mMaxErrors) {
+ PrintLimitExceeded ();
+ return ;
+ }
+ }
+ }
+
+ mErrorCount++;
+ va_start (List, MsgFmt);
+ PrintMessage ("ERROR", FileName, LineNumber, MessageCode, Text, MsgFmt, List);
+ va_end (List);
+}
+
+VOID
+ParserError (
+ UINT32 MessageCode,
+ CHAR8 *Text,
+ CHAR8 *MsgFmt,
+ ...
+ )
+/*++
+
+Routine Description:
+ Print a parser error, using the source file name and line number
+ set by a previous call to SetParserPosition().
+
+Arguments:
+ MessageCode - application-specific error code
+ Text - text to print in the error message
+ MsgFmt - format string to print at the end of the error message
+
+Returns:
+ NA
+
+--*/
+{
+ va_list List;
+ //
+ // If limits have been set, then check them
+ //
+ if (mPrintLimitsSet) {
+ //
+ // See if we've exceeded our total count
+ //
+ if (mMaxWarningsPlusErrors != 0) {
+ if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
+ PrintLimitExceeded ();
+ return ;
+ }
+ }
+ //
+ // See if we've exceeded our error count
+ //
+ if (mMaxErrors != 0) {
+ if (mErrorCount > mMaxErrors) {
+ PrintLimitExceeded ();
+ return ;
+ }
+ }
+ }
+
+ mErrorCount++;
+ va_start (List, MsgFmt);
+ PrintMessage ("ERROR", mSourceFileName, mSourceFileLineNum, MessageCode, Text, MsgFmt, List);
+ va_end (List);
+}
+
+VOID
+ParserWarning (
+ UINT32 ErrorCode,
+ CHAR8 *OffendingText,
+ CHAR8 *MsgFmt,
+ ...
+ )
+/*++
+
+Routine Description:
+ Print a parser warning, using the source file name and line number
+ set by a previous call to SetParserPosition().
+
+Arguments:
+ ErrorCode - application-specific error code
+ OffendingText - text to print in the warning message
+ MsgFmt - format string to print at the end of the warning message
+
+Returns:
+ NA
+
+--*/
+{
+ va_list List;
+ //
+ // If limits have been set, then check them
+ //
+ if (mPrintLimitsSet) {
+ //
+ // See if we've exceeded our total count
+ //
+ if (mMaxWarningsPlusErrors != 0) {
+ if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
+ PrintLimitExceeded ();
+ return ;
+ }
+ }
+ //
+ // See if we've exceeded our warning count
+ //
+ if (mMaxWarnings != 0) {
+ if (mWarningCount > mMaxWarnings) {
+ PrintLimitExceeded ();
+ return ;
+ }
+ }
+ }
+
+ mWarningCount++;
+ va_start (List, MsgFmt);
+ PrintMessage ("WARNING", mSourceFileName, mSourceFileLineNum, ErrorCode, OffendingText, MsgFmt, List);
+ va_end (List);
+ //
+ // Don't set warning status accordingly
+ //
+ // if (mStatus < STATUS_WARNING) {
+ // mStatus = STATUS_WARNING;
+ // }
+}
+
+VOID
+Warning (
+ CHAR8 *FileName,
+ UINT32 LineNumber,
+ UINT32 MessageCode,
+ CHAR8 *Text,
+ CHAR8 *MsgFmt,
+ ...
+ )
+/*++
+
+Routine Description:
+ Print a warning message.
+
+Arguments:
+ FileName - name of the file where the warning was detected, or the name
+ of the application that detected the warning
+
+ LineNumber - the line number where the warning was detected (parsers).
+ 0 should be specified if the utility is not a parser.
+
+ MessageCode - an application-specific warning code that can be referenced in
+ other documentation.
+
+ Text - the text in question (parsers)
+
+ MsgFmt - the format string for the warning message. Can contain formatting
+ controls for use with varargs.
+
+Returns:
+ None.
+
+--*/
+{
+ va_list List;
+
+ //
+ // Current Print Level not output warning information.
+ //
+ if (WARNING_LOG_LEVEL < mPrintLogLevel) {
+ return;
+ }
+ //
+ // If limits have been set, then check them
+ //
+ if (mPrintLimitsSet) {
+ //
+ // See if we've exceeded our total count
+ //
+ if (mMaxWarningsPlusErrors != 0) {
+ if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
+ PrintLimitExceeded ();
+ return ;
+ }
+ }
+ //
+ // See if we've exceeded our warning count
+ //
+ if (mMaxWarnings != 0) {
+ if (mWarningCount > mMaxWarnings) {
+ PrintLimitExceeded ();
+ return ;
+ }
+ }
+ }
+
+ mWarningCount++;
+ va_start (List, MsgFmt);
+ PrintMessage ("WARNING", FileName, LineNumber, MessageCode, Text, MsgFmt, List);
+ va_end (List);
+}
+
+VOID
+DebugMsg (
+ CHAR8 *FileName,
+ UINT32 LineNumber,
+ UINT64 MsgLevel,
+ CHAR8 *Text,
+ CHAR8 *MsgFmt,
+ ...
+ )
+/*++
+
+Routine Description:
+ Print a Debug message.
+
+Arguments:
+ FileName - typically the name of the utility printing the debug message, but
+ can be the name of a file being parsed.
+
+ LineNumber - the line number in FileName (parsers)
+
+ MsgLevel - Debug message print level (0~9)
+
+ Text - the text in question (parsers)
+
+ MsgFmt - the format string for the debug message. Can contain formatting
+ controls for use with varargs.
+
+Returns:
+ None.
+
+--*/
+{
+ va_list List;
+ //
+ // If the debug level is less than current print level, then do nothing.
+ //
+ if (MsgLevel < mPrintLogLevel) {
+ return ;
+ }
+
+ va_start (List, MsgFmt);
+ PrintMessage ("DEBUG", FileName, LineNumber, 0, Text, MsgFmt, List);
+ va_end (List);
+}
+
+VOID
+PrintMessage (
+ CHAR8 *Type,
+ CHAR8 *FileName,
+ UINT32 LineNumber,
+ UINT32 MessageCode,
+ CHAR8 *Text,
+ CHAR8 *MsgFmt,
+ va_list List
+ )
+/*++
+
+Routine Description:
+ Worker routine for all the utility printing services. Prints the message in
+ a format that Visual Studio will find when scanning build outputs for
+ errors or warnings.
+
+Arguments:
+ Type - "warning" or "error" string to insert into the message to be
+ printed. The first character of this string (converted to uppercase)
+ is used to precede the MessageCode value in the output string.
+
+ FileName - name of the file where the warning was detected, or the name
+ of the application that detected the warning
+
+ LineNumber - the line number where the warning was detected (parsers).
+ 0 should be specified if the utility is not a parser.
+
+ MessageCode - an application-specific warning code that can be referenced in
+ other documentation.
+
+ Text - part of the message to print
+
+ MsgFmt - the format string for the message. Can contain formatting
+ controls for use with varargs.
+ List - the variable list.
+
+Returns:
+ None.
+
+Notes:
+ If FileName == NULL then this utility will use the string passed into SetUtilityName().
+
+ LineNumber is only used if the caller is a parser, in which case FileName refers to the
+ file being parsed.
+
+ Text and MsgFmt are both optional, though it would be of little use calling this function with
+ them both NULL.
+
+ Output will typically be of the form:
+ <FileName>(<LineNumber>) : <Type> <Type[0]><MessageCode>: <Text> : <MsgFmt>
+
+ Parser (LineNumber != 0)
+ VfrCompile.cpp(330) : error E2660: AddVfrDataStructField : function does not take 2 parameters
+ Generic utility (LineNumber == 0)
+ UtilityName : error E1234 : Text string : MsgFmt string and args
+
+--*/
+{
+ CHAR8 Line[MAX_LINE_LEN];
+ CHAR8 Line2[MAX_LINE_LEN];
+ CHAR8 *Cptr;
+ struct tm *NewTime;
+ time_t CurrentTime;
+
+ //
+ // init local variable
+ //
+ Line[0] = '\0';
+ Line2[0] = '\0';
+
+ //
+ // If given a filename, then add it (and the line number) to the string.
+ // If there's no filename, then use the program name if provided.
+ //
+ if (FileName != NULL) {
+ Cptr = FileName;
+ } else {
+ Cptr = NULL;
+ }
+
+ if (strcmp (Type, "DEBUG") == 0) {
+ //
+ // Debug Message requires current time.
+ //
+ time (&CurrentTime);
+ NewTime = localtime (&CurrentTime);
+ if (NewTime != NULL) {
+ fprintf (stdout, "%04d-%02d-%02d %02d:%02d:%02d",
+ NewTime->tm_year + 1900,
+ NewTime->tm_mon + 1,
+ NewTime->tm_mday,
+ NewTime->tm_hour,
+ NewTime->tm_min,
+ NewTime->tm_sec
+ );
+ }
+ if (Cptr != NULL) {
+ strcpy (Line, ": ");
+ strncat (Line, Cptr, MAX_LINE_LEN - strlen (Line) - 1);
+ if (LineNumber != 0) {
+ sprintf (Line2, "(%u)", (unsigned) LineNumber);
+ strncat (Line, Line2, MAX_LINE_LEN - strlen (Line) - 1);
+ }
+ }
+ } else {
+ //
+ // Error and Warning Information.
+ //
+ if (Cptr != NULL) {
+ if (mUtilityName[0] != '\0') {
+ fprintf (stdout, "%s...\n", mUtilityName);
+ }
+ strncpy (Line, Cptr, MAX_LINE_LEN - 1);
+ Line[MAX_LINE_LEN - 1] = 0;
+ if (LineNumber != 0) {
+ sprintf (Line2, "(%u)", (unsigned) LineNumber);
+ strncat (Line, Line2, MAX_LINE_LEN - strlen (Line) - 1);
+ }
+ } else {
+ if (mUtilityName[0] != '\0') {
+ strncpy (Line, mUtilityName, MAX_LINE_LEN - 1);
+ Line[MAX_LINE_LEN - 1] = 0;
+ }
+ }
+
+ if (strcmp (Type, "ERROR") == 0) {
+ //
+ // Set status accordingly for ERROR information.
+ //
+ if (mStatus < STATUS_ERROR) {
+ mStatus = STATUS_ERROR;
+ }
+ }
+ }
+
+ //
+ // Have to print an error code or Visual Studio won't find the
+ // message for you. It has to be decimal digits too.
+ //
+ strncat (Line, ": ", MAX_LINE_LEN - strlen (Line) - 1);
+ strncat (Line, Type, MAX_LINE_LEN - strlen (Line) - 1);
+ if (MessageCode != 0) {
+ sprintf (Line2, " %04u", (unsigned) MessageCode);
+ strncat (Line, Line2, MAX_LINE_LEN - strlen (Line) - 1);
+ }
+ fprintf (stdout, "%s", Line);
+ //
+ // If offending text was provided, then print it
+ //
+ if (Text != NULL) {
+ fprintf (stdout, ": %s", Text);
+ }
+ fprintf (stdout, "\n");
+
+ //
+ // Print formatted message if provided
+ //
+ if (MsgFmt != NULL) {
+ vsprintf (Line2, MsgFmt, List);
+ fprintf (stdout, " %s\n", Line2);
+ }
+
+}
+
+STATIC
+VOID
+PrintSimpleMessage (
+ CHAR8 *MsgFmt,
+ va_list List
+ )
+/*++
+Routine Description:
+ Print message into stdout.
+
+Arguments:
+ MsgFmt - the format string for the message. Can contain formatting
+ controls for use with varargs.
+ List - the variable list.
+
+Returns:
+ None.
+--*/
+{
+ CHAR8 Line[MAX_LINE_LEN];
+ //
+ // Print formatted message if provided
+ //
+ if (MsgFmt != NULL) {
+ vsprintf (Line, MsgFmt, List);
+ fprintf (stdout, "%s\n", Line);
+ }
+}
+
+VOID
+ParserSetPosition (
+ CHAR8 *SourceFileName,
+ UINT32 LineNum
+ )
+/*++
+
+Routine Description:
+ Set the position in a file being parsed. This can be used to
+ print error messages deeper down in a parser.
+
+Arguments:
+ SourceFileName - name of the source file being parsed
+ LineNum - line number of the source file being parsed
+
+Returns:
+ NA
+
+--*/
+{
+ mSourceFileName = SourceFileName;
+ mSourceFileLineNum = LineNum;
+}
+
+VOID
+SetUtilityName (
+ CHAR8 *UtilityName
+ )
+/*++
+
+Routine Description:
+ All printed error/warning/debug messages follow the same format, and
+ typically will print a filename or utility name followed by the error
+ text. However if a filename is not passed to the print routines, then
+ they'll print the utility name if you call this function early in your
+ app to set the utility name.
+
+Arguments:
+ UtilityName - name of the utility, which will be printed with all
+ error/warning/debug messages.
+
+Returns:
+ NA
+
+--*/
+{
+ //
+ // Save the name of the utility in our local variable. Make sure its
+ // length does not exceed our buffer.
+ //
+ if (UtilityName != NULL) {
+ if (strlen (UtilityName) >= sizeof (mUtilityName)) {
+ Error (UtilityName, 0, 0, "application error", "utility name length exceeds internal buffer size");
+ }
+ strncpy (mUtilityName, UtilityName, sizeof (mUtilityName) - 1);
+ mUtilityName[sizeof (mUtilityName) - 1] = 0;
+ } else {
+ Error (NULL, 0, 0, "application error", "SetUtilityName() called with NULL utility name");
+ }
+}
+
+STATUS
+GetUtilityStatus (
+ VOID
+ )
+/*++
+
+Routine Description:
+ When you call Error() or Warning(), this module keeps track of it and
+ sets a local mStatus to STATUS_ERROR or STATUS_WARNING. When the utility
+ exits, it can call this function to get the status and use it as a return
+ value.
+
+Arguments:
+ None.
+
+Returns:
+ Worst-case status reported, as defined by which print function was called.
+
+--*/
+{
+ return mStatus;
+}
+
+VOID
+SetPrintLevel (
+ UINT64 LogLevel
+ )
+/*++
+
+Routine Description:
+ Set the printing message Level. This is used by the PrintMsg() function
+ to determine when/if a message should be printed.
+
+Arguments:
+ LogLevel - 0~50 to specify the different level message.
+
+Returns:
+ NA
+
+--*/
+{
+ mPrintLogLevel = LogLevel;
+}
+
+VOID
+VerboseMsg (
+ CHAR8 *MsgFmt,
+ ...
+ )
+/*++
+
+Routine Description:
+ Print a verbose level message.
+
+Arguments:
+ MsgFmt - the format string for the message. Can contain formatting
+ controls for use with varargs.
+ List - the variable list.
+
+Returns:
+ NA
+
+--*/
+{
+ va_list List;
+ //
+ // If the debug level is less than current print level, then do nothing.
+ //
+ if (VERBOSE_LOG_LEVEL < mPrintLogLevel) {
+ return ;
+ }
+
+ va_start (List, MsgFmt);
+ PrintSimpleMessage (MsgFmt, List);
+ va_end (List);
+}
+
+VOID
+NormalMsg (
+ CHAR8 *MsgFmt,
+ ...
+ )
+/*++
+
+Routine Description:
+ Print a default level message.
+
+Arguments:
+ MsgFmt - the format string for the message. Can contain formatting
+ controls for use with varargs.
+ List - the variable list.
+
+Returns:
+ NA
+
+--*/
+{
+ va_list List;
+ //
+ // If the debug level is less than current print level, then do nothing.
+ //
+ if (INFO_LOG_LEVEL < mPrintLogLevel) {
+ return ;
+ }
+
+ va_start (List, MsgFmt);
+ PrintSimpleMessage (MsgFmt, List);
+ va_end (List);
+}
+
+VOID
+KeyMsg (
+ CHAR8 *MsgFmt,
+ ...
+ )
+/*++
+
+Routine Description:
+ Print a key level message.
+
+Arguments:
+ MsgFmt - the format string for the message. Can contain formatting
+ controls for use with varargs.
+ List - the variable list.
+
+Returns:
+ NA
+
+--*/
+{
+ va_list List;
+ //
+ // If the debug level is less than current print level, then do nothing.
+ //
+ if (KEY_LOG_LEVEL < mPrintLogLevel) {
+ return ;
+ }
+
+ va_start (List, MsgFmt);
+ PrintSimpleMessage (MsgFmt, List);
+ va_end (List);
+}
+
+VOID
+SetPrintLimits (
+ UINT32 MaxErrors,
+ UINT32 MaxWarnings,
+ UINT32 MaxWarningsPlusErrors
+ )
+/*++
+
+Routine Description:
+ Set the limits of how many errors, warnings, and errors+warnings
+ we will print.
+
+Arguments:
+ MaxErrors - maximum number of error messages to print
+ MaxWarnings - maximum number of warning messages to print
+ MaxWarningsPlusErrors
+ - maximum number of errors+warnings to print
+
+Returns:
+ NA
+
+--*/
+{
+ mMaxErrors = MaxErrors;
+ mMaxWarnings = MaxWarnings;
+ mMaxWarningsPlusErrors = MaxWarningsPlusErrors;
+ mPrintLimitsSet = 1;
+}
+
+STATIC
+VOID
+PrintLimitExceeded (
+ VOID
+ )
+{
+ STATIC INT8 mPrintLimitExceeded = 0;
+ //
+ // If we've already printed the message, do nothing. Otherwise
+ // temporarily increase our print limits so we can pass one
+ // more message through.
+ //
+ if (mPrintLimitExceeded == 0) {
+ mPrintLimitExceeded++;
+ mMaxErrors++;
+ mMaxWarnings++;
+ mMaxWarningsPlusErrors++;
+ Error (NULL, 0, 0, "error/warning print limit exceeded", NULL);
+ mMaxErrors--;
+ mMaxWarnings--;
+ mMaxWarningsPlusErrors--;
+ }
+}
+
+#if 0
+VOID
+TestUtilityMessages (
+ VOID
+ )
+{
+ CHAR8 *ArgStr = "ArgString";
+ int ArgInt;
+
+ ArgInt = 0x12345678;
+ //
+ // Test without setting utility name
+ //
+ fprintf (stdout, "* Testing without setting utility name\n");
+ fprintf (stdout, "** Test debug message not printed\n");
+ DebugMsg (NULL, 0, 0x00000001, NULL, NULL);
+ fprintf (stdout, "** Test warning with two strings and two args\n");
+ Warning (NULL, 0, 1234, "Text1", "Text2 %s 0x%X", ArgStr, ArgInt);
+ fprintf (stdout, "** Test error with two strings and two args\n");
+ Warning (NULL, 0, 1234, "Text1", "Text2 %s 0x%X", ArgStr, ArgInt);
+ fprintf (stdout, "** Test parser warning with nothing\n");
+ ParserWarning (0, NULL, NULL);
+ fprintf (stdout, "** Test parser error with nothing\n");
+ ParserError (0, NULL, NULL);
+ //
+ // Test with utility name set now
+ //
+ fprintf (stdout, "** Testingin with utility name set\n");
+ SetUtilityName ("MyUtilityName");
+ //
+ // Test debug prints
+ //
+ SetDebugMsgMask (2);
+ fprintf (stdout, "** Test debug message with one string\n");
+ DebugMsg (NULL, 0, 0x00000002, "Text1", NULL);
+ fprintf (stdout, "** Test debug message with one string\n");
+ DebugMsg (NULL, 0, 0x00000002, NULL, "Text2");
+ fprintf (stdout, "** Test debug message with two strings\n");
+ DebugMsg (NULL, 0, 0x00000002, "Text1", "Text2");
+ fprintf (stdout, "** Test debug message with two strings and two args\n");
+ DebugMsg (NULL, 0, 0x00000002, "Text1", "Text2 %s 0x%X", ArgStr, ArgInt);
+ //
+ // Test warning prints
+ //
+ fprintf (stdout, "** Test warning with no strings\n");
+ Warning (NULL, 0, 1234, NULL, NULL);
+ fprintf (stdout, "** Test warning with one string\n");
+ Warning (NULL, 0, 1234, "Text1", NULL);
+ fprintf (stdout, "** Test warning with one string\n");
+ Warning (NULL, 0, 1234, NULL, "Text2");
+ fprintf (stdout, "** Test warning with two strings and two args\n");
+ Warning (NULL, 0, 1234, "Text1", "Text2 %s 0x%X", ArgStr, ArgInt);
+ //
+ // Test error prints
+ //
+ fprintf (stdout, "** Test error with no strings\n");
+ Error (NULL, 0, 1234, NULL, NULL);
+ fprintf (stdout, "** Test error with one string\n");
+ Error (NULL, 0, 1234, "Text1", NULL);
+ fprintf (stdout, "** Test error with one string\n");
+ Error (NULL, 0, 1234, NULL, "Text2");
+ fprintf (stdout, "** Test error with two strings and two args\n");
+ Error (NULL, 0, 1234, "Text1", "Text2 %s 0x%X", ArgStr, ArgInt);
+ //
+ // Test parser prints
+ //
+ fprintf (stdout, "** Test parser errors\n");
+ ParserSetPosition (__FILE__, __LINE__ + 1);
+ ParserError (1234, NULL, NULL);
+ ParserSetPosition (__FILE__, __LINE__ + 1);
+ ParserError (1234, "Text1", NULL);
+ ParserSetPosition (__FILE__, __LINE__ + 1);
+ ParserError (1234, NULL, "Text2");
+ ParserSetPosition (__FILE__, __LINE__ + 1);
+ ParserError (1234, "Text1", "Text2");
+ ParserSetPosition (__FILE__, __LINE__ + 1);
+ ParserError (1234, "Text1", "Text2 %s 0x%X", ArgStr, ArgInt);
+
+ fprintf (stdout, "** Test parser warnings\n");
+ ParserSetPosition (__FILE__, __LINE__ + 1);
+ ParserWarning (4321, NULL, NULL);
+ ParserSetPosition (__FILE__, __LINE__ + 1);
+ ParserWarning (4321, "Text1", NULL);
+ ParserSetPosition (__FILE__, __LINE__ + 1);
+ ParserWarning (4321, NULL, "Text2");
+ ParserSetPosition (__FILE__, __LINE__ + 1);
+ ParserWarning (4321, "Text1", "Text2");
+ ParserSetPosition (__FILE__, __LINE__ + 1);
+ ParserWarning (4321, "Text1", "Text2 %s 0x%X", ArgStr, ArgInt);
+}
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Common/EfiUtilityMsgs.h b/roms/edk2/BaseTools/Source/C/Common/EfiUtilityMsgs.h
new file mode 100644
index 000000000..85f018cba
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/EfiUtilityMsgs.h
@@ -0,0 +1,164 @@
+/** @file
+Defines and prototypes for common EFI utility error and debug messages.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFI_UTILITY_MSGS_H_
+#define _EFI_UTILITY_MSGS_H_
+
+#include <Common/UefiBaseTypes.h>
+
+//
+// Log message print Level
+//
+#define VERBOSE_LOG_LEVEL 15
+#define WARNING_LOG_LEVEL 15
+#define INFO_LOG_LEVEL 20
+#define KEY_LOG_LEVEL 40
+#define ERROR_LOG_LEVLE 50
+
+//
+// Status codes returned by EFI utility programs and functions
+//
+#define STATUS_SUCCESS 0
+#define STATUS_WARNING 1
+#define STATUS_ERROR 2
+#define VOID void
+
+typedef int STATUS;
+
+#define MAX_LINE_LEN 0x200
+#define MAXIMUM_INPUT_FILE_NUM 10
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+//
+// When we call Error() or Warning(), the module keeps track of the worst
+// case reported. GetUtilityStatus() will get the worst-case results, which
+// can be used as the return value from the app.
+//
+STATUS
+GetUtilityStatus (
+ VOID
+ );
+
+//
+// If someone prints an error message and didn't specify a source file name,
+// then we print the utility name instead. However they must tell us the
+// utility name early on via this function.
+//
+VOID
+SetUtilityName (
+ CHAR8 *ProgramName
+ )
+;
+
+VOID
+PrintMessage (
+ CHAR8 *Type,
+ CHAR8 *FileName,
+ UINT32 LineNumber,
+ UINT32 MessageCode,
+ CHAR8 *Text,
+ CHAR8 *MsgFmt,
+ va_list List
+ );
+
+VOID
+Error (
+ CHAR8 *FileName,
+ UINT32 LineNumber,
+ UINT32 ErrorCode,
+ CHAR8 *OffendingText,
+ CHAR8 *MsgFmt,
+ ...
+ )
+;
+
+VOID
+Warning (
+ CHAR8 *FileName,
+ UINT32 LineNumber,
+ UINT32 WarningCode,
+ CHAR8 *OffendingText,
+ CHAR8 *MsgFmt,
+ ...
+ )
+;
+
+VOID
+DebugMsg (
+ CHAR8 *FileName,
+ UINT32 LineNumber,
+ UINT64 MsgLevel,
+ CHAR8 *OffendingText,
+ CHAR8 *MsgFmt,
+ ...
+ )
+;
+
+VOID
+VerboseMsg (
+ CHAR8 *MsgFmt,
+ ...
+ );
+
+VOID
+NormalMsg (
+ CHAR8 *MsgFmt,
+ ...
+ );
+
+VOID
+KeyMsg (
+ CHAR8 *MsgFmt,
+ ...
+ );
+
+VOID
+SetPrintLevel (
+ UINT64 LogLevel
+ );
+
+VOID
+ParserSetPosition (
+ CHAR8 *SourceFileName,
+ UINT32 LineNum
+ )
+;
+
+VOID
+ParserError (
+ UINT32 ErrorCode,
+ CHAR8 *OffendingText,
+ CHAR8 *MsgFmt,
+ ...
+ )
+;
+
+VOID
+ParserWarning (
+ UINT32 ErrorCode,
+ CHAR8 *OffendingText,
+ CHAR8 *MsgFmt,
+ ...
+ )
+;
+
+VOID
+SetPrintLimits (
+ UINT32 NumErrors,
+ UINT32 NumWarnings,
+ UINT32 NumWarningsPlusErrors
+ )
+;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // #ifndef _EFI_UTILITY_MSGS_H_
diff --git a/roms/edk2/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c b/roms/edk2/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
new file mode 100644
index 000000000..70741c8af
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
@@ -0,0 +1,1775 @@
+/** @file
+EFI Firmware Volume routines which work on a Fv image in buffers.
+
+Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "FirmwareVolumeBufferLib.h"
+#include "BinderFuncs.h"
+
+//
+// Local macros
+//
+#define EFI_TEST_FFS_ATTRIBUTES_BIT(FvbAttributes, TestAttributes, Bit) \
+ ( \
+ (BOOLEAN) ( \
+ (FvbAttributes & EFI_FVB2_ERASE_POLARITY) ? (((~TestAttributes) & Bit) == Bit) : ((TestAttributes & Bit) == Bit) \
+ ) \
+ )
+
+
+//
+// Local prototypes
+//
+
+STATIC
+UINT32
+FvBufGetSecHdrLen(
+ IN EFI_COMMON_SECTION_HEADER *SectionHeader
+ )
+{
+ if (SectionHeader == NULL) {
+ return 0;
+ }
+ if (FvBufExpand3ByteSize(SectionHeader->Size) == 0xffffff) {
+ return sizeof(EFI_COMMON_SECTION_HEADER2);
+ }
+ return sizeof(EFI_COMMON_SECTION_HEADER);
+}
+
+STATIC
+UINT32
+FvBufGetSecFileLen (
+ IN EFI_COMMON_SECTION_HEADER *SectionHeader
+ )
+{
+ UINT32 Length;
+ if (SectionHeader == NULL) {
+ return 0;
+ }
+ Length = FvBufExpand3ByteSize(SectionHeader->Size);
+ if (Length == 0xffffff) {
+ Length = ((EFI_COMMON_SECTION_HEADER2 *)SectionHeader)->ExtendedSize;
+ }
+ return Length;
+}
+
+//
+// Local prototypes
+//
+
+STATIC
+UINT16
+FvBufCalculateChecksum16 (
+ IN UINT16 *Buffer,
+ IN UINTN Size
+ );
+
+STATIC
+UINT8
+FvBufCalculateChecksum8 (
+ IN UINT8 *Buffer,
+ IN UINTN Size
+ );
+
+//
+// Procedures start
+//
+
+EFI_STATUS
+FvBufRemoveFileNew (
+ IN OUT VOID *Fv,
+ IN EFI_GUID *Name
+ )
+/*++
+
+Routine Description:
+
+ Clears out all files from the Fv buffer in memory
+
+Arguments:
+
+ SourceFv - Address of the Fv in memory, this firmware volume volume will
+ be modified, if SourceFfsFile exists
+ SourceFfsFile - Input FFS file to replace
+
+Returns:
+
+ EFI_SUCCESS
+ EFI_NOT_FOUND
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_FFS_FILE_HEADER* FileToRm;
+ UINTN FileToRmLength;
+
+ Status = FvBufFindFileByName(
+ Fv,
+ Name,
+ (VOID **)&FileToRm
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ FileToRmLength = FvBufGetFfsFileSize (FileToRm);
+
+ CommonLibBinderSetMem (
+ FileToRm,
+ FileToRmLength,
+ (((EFI_FIRMWARE_VOLUME_HEADER*)Fv)->Attributes & EFI_FVB2_ERASE_POLARITY)
+ ? 0xFF : 0
+ );
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+FvBufRemoveFile (
+ IN OUT VOID *Fv,
+ IN EFI_GUID *Name
+ )
+/*++
+
+Routine Description:
+
+ Clears out all files from the Fv buffer in memory
+
+Arguments:
+
+ SourceFv - Address of the Fv in memory, this firmware volume volume will
+ be modified, if SourceFfsFile exists
+ SourceFfsFile - Input FFS file to replace
+
+Returns:
+
+ EFI_SUCCESS
+ EFI_NOT_FOUND
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_FFS_FILE_HEADER *NextFile;
+ EFI_FIRMWARE_VOLUME_HEADER *TempFv;
+ UINTN FileKey;
+ UINTN FvLength;
+
+ Status = FvBufFindFileByName(
+ Fv,
+ Name,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = FvBufGetSize (Fv, &FvLength);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ TempFv = NULL;
+ Status = FvBufDuplicate (Fv, (VOID **)&TempFv);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = FvBufClearAllFiles (TempFv);
+ if (EFI_ERROR (Status)) {
+ CommonLibBinderFree (TempFv);
+ return Status;
+ }
+
+ // TempFv has been allocated. It must now be freed
+ // before returning.
+
+ FileKey = 0;
+ while (TRUE) {
+
+ Status = FvBufFindNextFile (Fv, &FileKey, (VOID **)&NextFile);
+ if (Status == EFI_NOT_FOUND) {
+ break;
+ } else if (EFI_ERROR (Status)) {
+ CommonLibBinderFree (TempFv);
+ return Status;
+ }
+
+ if (CommonLibBinderCompareGuid (Name, &NextFile->Name)) {
+ continue;
+ }
+ else {
+ Status = FvBufAddFile (TempFv, NextFile);
+ if (EFI_ERROR (Status)) {
+ CommonLibBinderFree (TempFv);
+ return Status;
+ }
+ }
+ }
+
+ CommonLibBinderCopyMem (Fv, TempFv, FvLength);
+ CommonLibBinderFree (TempFv);
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+FvBufChecksumFile (
+ IN OUT VOID *FfsFile
+ )
+/*++
+
+Routine Description:
+
+ Clears out all files from the Fv buffer in memory
+
+Arguments:
+
+ SourceFfsFile - Input FFS file to update the checksum for
+
+Returns:
+
+ EFI_SUCCESS
+ EFI_NOT_FOUND
+
+--*/
+{
+ EFI_FFS_FILE_HEADER* File = (EFI_FFS_FILE_HEADER*)FfsFile;
+ EFI_FFS_FILE_STATE StateBackup;
+ UINT32 FileSize;
+
+ FileSize = FvBufGetFfsFileSize (File);
+
+ //
+ // Fill in checksums and state, they must be 0 for checksumming.
+ //
+ File->IntegrityCheck.Checksum.Header = 0;
+ File->IntegrityCheck.Checksum.File = 0;
+ StateBackup = File->State;
+ File->State = 0;
+
+ File->IntegrityCheck.Checksum.Header =
+ FvBufCalculateChecksum8 (
+ (UINT8 *) File,
+ FvBufGetFfsHeaderSize (File)
+ );
+
+ if (File->Attributes & FFS_ATTRIB_CHECKSUM) {
+ File->IntegrityCheck.Checksum.File = FvBufCalculateChecksum8 (
+ (VOID*)((UINT8 *)File + FvBufGetFfsHeaderSize (File)),
+ FileSize - FvBufGetFfsHeaderSize (File)
+ );
+ } else {
+ File->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
+ }
+
+ File->State = StateBackup;
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+FvBufChecksumHeader (
+ IN OUT VOID *Fv
+ )
+/*++
+
+Routine Description:
+
+ Clears out all files from the Fv buffer in memory
+
+Arguments:
+
+ SourceFv - Address of the Fv in memory, this firmware volume volume will
+ be modified, if SourceFfsFile exists
+ SourceFfsFile - Input FFS file to replace
+
+Returns:
+
+ EFI_SUCCESS
+ EFI_NOT_FOUND
+
+--*/
+{
+ EFI_FIRMWARE_VOLUME_HEADER* FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
+
+ FvHeader->Checksum = 0;
+ FvHeader->Checksum =
+ FvBufCalculateChecksum16 (
+ (UINT16*) FvHeader,
+ FvHeader->HeaderLength / sizeof (UINT16)
+ );
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+FvBufDuplicate (
+ IN VOID *SourceFv,
+ IN OUT VOID **DestinationFv
+ )
+/*++
+
+Routine Description:
+
+ Clears out all files from the Fv buffer in memory
+
+Arguments:
+
+ SourceFv - Address of the Fv in memory
+ DestinationFv - Output for destination Fv
+ DestinationFv == NULL - invalid parameter
+ *DestinationFv == NULL - memory will be allocated
+ *DestinationFv != NULL - this address will be the destination
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN size;
+
+ if (DestinationFv == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = FvBufGetSize (SourceFv, &size);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (*DestinationFv == NULL) {
+ *DestinationFv = CommonLibBinderAllocate (size);
+ if (*DestinationFv == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ }
+
+ CommonLibBinderCopyMem (*DestinationFv, SourceFv, size);
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+FvBufExtend (
+ IN VOID **Fv,
+ IN UINTN Size
+ )
+/*++
+
+Routine Description:
+
+ Extends a firmware volume by the given number of bytes.
+
+ BUGBUG: Does not handle the case where the firmware volume has a
+ VTF (Volume Top File). The VTF will not be moved to the
+ end of the extended FV.
+
+Arguments:
+
+ Fv - Source and destination firmware volume.
+ Note: The original firmware volume buffer is freed!
+
+ Size - The minimum size that the firmware volume is to be extended by.
+ The FV may be extended more than this size.
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN OldSize;
+ UINTN NewSize;
+ UINTN BlockCount;
+ VOID* NewFv;
+
+ EFI_FIRMWARE_VOLUME_HEADER* hdr;
+ EFI_FV_BLOCK_MAP_ENTRY* blk;
+
+ Status = FvBufGetSize (*Fv, &OldSize);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Locate the block map in the fv header
+ //
+ hdr = (EFI_FIRMWARE_VOLUME_HEADER*)*Fv;
+ blk = hdr->BlockMap;
+
+ //
+ // Calculate the number of blocks needed to achieve the requested
+ // size extension
+ //
+ BlockCount = ((Size + (blk->Length - 1)) / blk->Length);
+
+ //
+ // Calculate the new size from the number of blocks that will be added
+ //
+ NewSize = OldSize + (BlockCount * blk->Length);
+
+ NewFv = CommonLibBinderAllocate (NewSize);
+ if (NewFv == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Copy the old data
+ //
+ CommonLibBinderCopyMem (NewFv, *Fv, OldSize);
+
+ //
+ // Free the old fv buffer
+ //
+ CommonLibBinderFree (*Fv);
+
+ //
+ // Locate the block map in the new fv header
+ //
+ hdr = (EFI_FIRMWARE_VOLUME_HEADER*)NewFv;
+ hdr->FvLength = NewSize;
+ blk = hdr->BlockMap;
+
+ //
+ // Update the block map for the new fv
+ //
+ blk->NumBlocks += (UINT32)BlockCount;
+
+ //
+ // Update the FV header checksum
+ //
+ FvBufChecksumHeader (NewFv);
+
+ //
+ // Clear out the new area of the FV
+ //
+ CommonLibBinderSetMem (
+ (UINT8*)NewFv + OldSize,
+ (NewSize - OldSize),
+ (hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0
+ );
+
+ //
+ // Set output with new fv that was created
+ //
+ *Fv = NewFv;
+
+ return EFI_SUCCESS;
+
+}
+
+
+EFI_STATUS
+FvBufClearAllFiles (
+ IN OUT VOID *Fv
+ )
+/*++
+
+Routine Description:
+
+ Clears out all files from the Fv buffer in memory
+
+Arguments:
+
+ Fv - Address of the Fv in memory
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+
+{
+ EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
+ EFI_STATUS Status;
+ UINTN size = 0;
+
+ Status = FvBufGetSize (Fv, &size);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ CommonLibBinderSetMem(
+ (UINT8*)hdr + hdr->HeaderLength,
+ size - hdr->HeaderLength,
+ (hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0
+ );
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+FvBufGetSize (
+ IN VOID *Fv,
+ OUT UINTN *Size
+ )
+/*++
+
+Routine Description:
+
+ Clears out all files from the Fv buffer in memory
+
+Arguments:
+
+ Fv - Address of the Fv in memory
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+
+{
+ EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
+ EFI_FV_BLOCK_MAP_ENTRY *blk = hdr->BlockMap;
+
+ *Size = 0;
+
+ while (blk->Length != 0 || blk->NumBlocks != 0) {
+ *Size = *Size + (blk->Length * blk->NumBlocks);
+ if (*Size >= 0x40000000) {
+ // If size is greater than 1GB, then assume it is corrupted
+ return EFI_VOLUME_CORRUPTED;
+ }
+ blk++;
+ }
+
+ if (*Size == 0) {
+ // If size is 0, then assume the volume is corrupted
+ return EFI_VOLUME_CORRUPTED;
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+FvBufAddFile (
+ IN OUT VOID *Fv,
+ IN VOID *File
+ )
+/*++
+
+Routine Description:
+
+ Adds a new FFS file
+
+Arguments:
+
+ Fv - Address of the Fv in memory
+ File - FFS file to add to Fv
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+{
+ EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
+
+ EFI_FFS_FILE_HEADER *fhdr = NULL;
+ EFI_FVB_ATTRIBUTES_2 FvbAttributes;
+ UINTN offset;
+ UINTN fsize;
+ UINTN newSize;
+ UINTN clearLoop;
+
+ EFI_STATUS Status;
+ UINTN fvSize;
+
+ Status = FvBufGetSize (Fv, &fvSize);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ FvbAttributes = hdr->Attributes;
+ newSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
+
+ for(
+ offset = (UINTN)ALIGN_POINTER (hdr->HeaderLength, 8);
+ offset + newSize <= fvSize;
+ offset = (UINTN)ALIGN_POINTER (offset, 8)
+ ) {
+
+ fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + offset);
+
+ if (EFI_TEST_FFS_ATTRIBUTES_BIT(
+ FvbAttributes,
+ fhdr->State,
+ EFI_FILE_HEADER_VALID
+ )
+ ) {
+ // BUGBUG: Need to make sure that the new file does not already
+ // exist.
+
+ fsize = FvBufGetFfsFileSize (fhdr);
+ if (fsize == 0 || (offset + fsize > fvSize)) {
+ return EFI_VOLUME_CORRUPTED;
+ }
+
+ offset = offset + fsize;
+ continue;
+ }
+
+ clearLoop = 0;
+ while ((clearLoop < newSize) &&
+ (((UINT8*)fhdr)[clearLoop] ==
+ (UINT8)((hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0)
+ )
+ ) {
+ clearLoop++;
+ }
+
+ //
+ // We found a place in the FV which is empty and big enough for
+ // the new file
+ //
+ if (clearLoop >= newSize) {
+ break;
+ }
+
+ offset = offset + 1; // Make some forward progress
+ }
+
+ if (offset + newSize > fvSize) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CommonLibBinderCopyMem (fhdr, File, newSize);
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+FvBufAddFileWithExtend (
+ IN OUT VOID **Fv,
+ IN VOID *File
+ )
+/*++
+
+Routine Description:
+
+ Adds a new FFS file. Extends the firmware volume if needed.
+
+Arguments:
+
+ Fv - Source and destination firmware volume.
+ Note: If the FV is extended, then the original firmware volume
+ buffer is freed!
+
+ Size - The minimum size that the firmware volume is to be extended by.
+ The FV may be extended more than this size.
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_FFS_FILE_HEADER* NewFile;
+
+ NewFile = (EFI_FFS_FILE_HEADER*)File;
+
+ //
+ // Try to add to the capsule volume
+ //
+ Status = FvBufAddFile (*Fv, NewFile);
+ if (Status == EFI_OUT_OF_RESOURCES) {
+ //
+ // Try to extend the capsule volume by the size of the file
+ //
+ Status = FvBufExtend (Fv, FvBufExpand3ByteSize (NewFile->Size));
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Now, try to add the file again
+ //
+ Status = FvBufAddFile (*Fv, NewFile);
+ }
+
+ return Status;
+}
+
+
+EFI_STATUS
+FvBufAddVtfFile (
+ IN OUT VOID *Fv,
+ IN VOID *File
+ )
+/*++
+
+Routine Description:
+
+ Adds a new FFS VFT (Volume Top File) file. In other words, adds the
+ file to the end of the firmware volume.
+
+Arguments:
+
+ Fv - Address of the Fv in memory
+ File - FFS file to add to Fv
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+{
+ EFI_STATUS Status;
+
+ EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
+
+ EFI_FFS_FILE_HEADER* NewFile;
+ UINTN NewFileSize;
+
+ UINT8 erasedUint8;
+ UINTN clearLoop;
+
+ EFI_FFS_FILE_HEADER *LastFile;
+ UINTN LastFileSize;
+
+ UINTN fvSize;
+ UINTN Key;
+
+ Status = FvBufGetSize (Fv, &fvSize);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ erasedUint8 = (UINT8)((hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0);
+ NewFileSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
+
+ if (NewFileSize != (UINTN)ALIGN_POINTER (NewFileSize, 8)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Find the last file in the FV
+ //
+ Key = 0;
+ LastFile = NULL;
+ LastFileSize = 0;
+ do {
+ Status = FvBufFindNextFile (Fv, &Key, (VOID **)&LastFile);
+ LastFileSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
+ } while (!EFI_ERROR (Status));
+
+ //
+ // If no files were found, then we start at the beginning of the FV
+ //
+ if (LastFile == NULL) {
+ LastFile = (EFI_FFS_FILE_HEADER*)((UINT8*)hdr + hdr->HeaderLength);
+ }
+
+ //
+ // We want to put the new file (VTF) at the end of the FV
+ //
+ NewFile = (EFI_FFS_FILE_HEADER*)((UINT8*)hdr + (fvSize - NewFileSize));
+
+ //
+ // Check to see if there is enough room for the VTF after the last file
+ // found in the FV
+ //
+ if ((UINT8*)NewFile < ((UINT8*)LastFile + LastFileSize)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Loop to determine if the end of the FV is empty
+ //
+ clearLoop = 0;
+ while ((clearLoop < NewFileSize) &&
+ (((UINT8*)NewFile)[clearLoop] == erasedUint8)
+ ) {
+ clearLoop++;
+ }
+
+ //
+ // Check to see if there was not enough room for the file
+ //
+ if (clearLoop < NewFileSize) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CommonLibBinderCopyMem (NewFile, File, NewFileSize);
+
+ return EFI_SUCCESS;
+}
+
+
+VOID
+FvBufCompact3ByteSize (
+ OUT VOID* SizeDest,
+ IN UINT32 Size
+ )
+/*++
+
+Routine Description:
+
+ Expands the 3 byte size commonly used in Firmware Volume data structures
+
+Arguments:
+
+ Size - Address of the 3 byte array representing the size
+
+Returns:
+
+ UINT32
+
+--*/
+{
+ ((UINT8*)SizeDest)[0] = (UINT8)Size;
+ ((UINT8*)SizeDest)[1] = (UINT8)(Size >> 8);
+ ((UINT8*)SizeDest)[2] = (UINT8)(Size >> 16);
+}
+
+UINT32
+FvBufGetFfsFileSize (
+ IN EFI_FFS_FILE_HEADER *Ffs
+ )
+/*++
+
+Routine Description:
+
+ Get the FFS file size.
+
+Arguments:
+
+ Ffs - Pointer to FFS header
+
+Returns:
+
+ UINT32
+
+--*/
+{
+ if (Ffs == NULL) {
+ return 0;
+ }
+ if (Ffs->Attributes & FFS_ATTRIB_LARGE_FILE) {
+ return (UINT32) ((EFI_FFS_FILE_HEADER2 *)Ffs)->ExtendedSize;
+ }
+ return FvBufExpand3ByteSize(Ffs->Size);
+}
+
+UINT32
+FvBufGetFfsHeaderSize (
+ IN EFI_FFS_FILE_HEADER *Ffs
+ )
+/*++
+
+Routine Description:
+
+ Get the FFS header size.
+
+Arguments:
+
+ Ffs - Pointer to FFS header
+
+Returns:
+
+ UINT32
+
+--*/
+{
+ if (Ffs == NULL) {
+ return 0;
+ }
+ if (Ffs->Attributes & FFS_ATTRIB_LARGE_FILE) {
+ return sizeof(EFI_FFS_FILE_HEADER2);
+ }
+ return sizeof(EFI_FFS_FILE_HEADER);
+}
+
+UINT32
+FvBufExpand3ByteSize (
+ IN VOID* Size
+ )
+/*++
+
+Routine Description:
+
+ Expands the 3 byte size commonly used in Firmware Volume data structures
+
+Arguments:
+
+ Size - Address of the 3 byte array representing the size
+
+Returns:
+
+ UINT32
+
+--*/
+{
+ return (((UINT8*)Size)[2] << 16) +
+ (((UINT8*)Size)[1] << 8) +
+ ((UINT8*)Size)[0];
+}
+
+EFI_STATUS
+FvBufFindNextFile (
+ IN VOID *Fv,
+ IN OUT UINTN *Key,
+ OUT VOID **File
+ )
+/*++
+
+Routine Description:
+
+ Iterates through the files contained within the firmware volume
+
+Arguments:
+
+ Fv - Address of the Fv in memory
+ Key - Should be 0 to get the first file. After that, it should be
+ passed back in without modifying its contents to retrieve
+ subsequent files.
+ File - Output file pointer
+ File == NULL - invalid parameter
+ otherwise - *File will be update to the location of the file
+
+Returns:
+
+ EFI_SUCCESS
+ EFI_NOT_FOUND
+ EFI_VOLUME_CORRUPTED
+
+--*/
+{
+ EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
+
+ EFI_FFS_FILE_HEADER *fhdr = NULL;
+ EFI_FVB_ATTRIBUTES_2 FvbAttributes;
+ UINTN fsize;
+
+ EFI_STATUS Status;
+ UINTN fvSize;
+
+ if (Fv == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = FvBufGetSize (Fv, &fvSize);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (*Key == 0) {
+ *Key = hdr->HeaderLength;
+ }
+
+ FvbAttributes = hdr->Attributes;
+
+ for(
+ *Key = (UINTN)ALIGN_POINTER (*Key, 8);
+ (*Key + sizeof (*fhdr)) < fvSize;
+ *Key = (UINTN)ALIGN_POINTER (*Key, 8)
+ ) {
+
+ fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
+ fsize = FvBufGetFfsFileSize (fhdr);
+
+ if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
+ FvbAttributes,
+ fhdr->State,
+ EFI_FILE_HEADER_VALID
+ ) ||
+ EFI_TEST_FFS_ATTRIBUTES_BIT(
+ FvbAttributes,
+ fhdr->State,
+ EFI_FILE_HEADER_INVALID
+ )
+ ) {
+ *Key = *Key + 1; // Make some forward progress
+ continue;
+ } else if(
+ EFI_TEST_FFS_ATTRIBUTES_BIT(
+ FvbAttributes,
+ fhdr->State,
+ EFI_FILE_MARKED_FOR_UPDATE
+ ) ||
+ EFI_TEST_FFS_ATTRIBUTES_BIT(
+ FvbAttributes,
+ fhdr->State,
+ EFI_FILE_DELETED
+ )
+ ) {
+ *Key = *Key + fsize;
+ continue;
+ } else if (EFI_TEST_FFS_ATTRIBUTES_BIT(
+ FvbAttributes,
+ fhdr->State,
+ EFI_FILE_DATA_VALID
+ )
+ ) {
+ *File = (UINT8*)hdr + *Key;
+ *Key = *Key + fsize;
+ return EFI_SUCCESS;
+ }
+
+ *Key = *Key + 1; // Make some forward progress
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+
+EFI_STATUS
+FvBufFindFileByName (
+ IN VOID *Fv,
+ IN EFI_GUID *Name,
+ OUT VOID **File
+ )
+/*++
+
+Routine Description:
+
+ Searches the Fv for a file by its name
+
+Arguments:
+
+ Fv - Address of the Fv in memory
+ Name - Guid filename to search for in the firmware volume
+ File - Output file pointer
+ File == NULL - Only determine if the file exists, based on return
+ value from the function call.
+ otherwise - *File will be update to the location of the file
+
+Returns:
+
+ EFI_SUCCESS
+ EFI_NOT_FOUND
+ EFI_VOLUME_CORRUPTED
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN Key;
+ EFI_FFS_FILE_HEADER *NextFile;
+
+ Key = 0;
+ while (TRUE) {
+ Status = FvBufFindNextFile (Fv, &Key, (VOID **)&NextFile);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (CommonLibBinderCompareGuid (Name, &NextFile->Name)) {
+ if (File != NULL) {
+ *File = NextFile;
+ }
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+
+EFI_STATUS
+FvBufFindFileByType (
+ IN VOID *Fv,
+ IN EFI_FV_FILETYPE Type,
+ OUT VOID **File
+ )
+/*++
+
+Routine Description:
+
+ Searches the Fv for a file by its type
+
+Arguments:
+
+ Fv - Address of the Fv in memory
+ Type - FFS FILE type to search for
+ File - Output file pointer
+ (File == NULL) -> Only determine if the file exists, based on return
+ value from the function call.
+ otherwise -> *File will be update to the location of the file
+
+Returns:
+
+ EFI_SUCCESS
+ EFI_NOT_FOUND
+ EFI_VOLUME_CORRUPTED
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN Key;
+ EFI_FFS_FILE_HEADER *NextFile;
+
+ Key = 0;
+ while (TRUE) {
+ Status = FvBufFindNextFile (Fv, &Key, (VOID **)&NextFile);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (Type == NextFile->Type) {
+ if (File != NULL) {
+ *File = NextFile;
+ }
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+
+EFI_STATUS
+FvBufGetFileRawData (
+ IN VOID* FfsFile,
+ OUT VOID** RawData,
+ OUT UINTN* RawDataSize
+ )
+/*++
+
+Routine Description:
+
+ Searches the requested file for raw data.
+
+ This routine either returns all the payload of a EFI_FV_FILETYPE_RAW file,
+ or finds the EFI_SECTION_RAW section within the file and returns its data.
+
+Arguments:
+
+ FfsFile - Address of the FFS file in memory
+ RawData - Pointer to the raw data within the file
+ (This is NOT allocated. It is within the file.)
+ RawDataSize - Size of the raw data within the file
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_FFS_FILE_HEADER* File;
+ EFI_RAW_SECTION* Section;
+
+ File = (EFI_FFS_FILE_HEADER*)FfsFile;
+
+ //
+ // Is the file type == EFI_FV_FILETYPE_RAW?
+ //
+ if (File->Type == EFI_FV_FILETYPE_RAW) {
+ //
+ // Raw filetypes don't have sections, so we just return the raw data
+ //
+ *RawData = (VOID*)((UINT8 *)File + FvBufGetFfsHeaderSize (File));
+ *RawDataSize = FvBufGetFfsFileSize (File) - FvBufGetFfsHeaderSize (File);
+ return EFI_SUCCESS;
+ }
+
+ //
+ // Within the file, we now need to find the EFI_SECTION_RAW section.
+ //
+ Status = FvBufFindSectionByType (File, EFI_SECTION_RAW, (VOID **)&Section);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ *RawData = (VOID*)((UINT8 *)Section + FvBufGetSecHdrLen(Section));
+ *RawDataSize =
+ FvBufGetSecFileLen (Section) - FvBufGetSecHdrLen(Section);
+
+ return EFI_SUCCESS;
+
+}
+
+
+EFI_STATUS
+FvBufPackageFreeformRawFile (
+ IN EFI_GUID* Filename,
+ IN VOID* RawData,
+ IN UINTN RawDataSize,
+ OUT VOID** FfsFile
+ )
+/*++
+
+Routine Description:
+
+ Packages up a FFS file containing the input raw data.
+
+ The file created will have a type of EFI_FV_FILETYPE_FREEFORM, and will
+ contain one EFI_FV_FILETYPE_RAW section.
+
+Arguments:
+
+ RawData - Pointer to the raw data to be packed
+ RawDataSize - Size of the raw data to be packed
+ FfsFile - Address of the packaged FFS file.
+ Note: The called must deallocate this memory!
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ EFI_FFS_FILE_HEADER* NewFile;
+ UINT32 NewFileSize;
+ EFI_RAW_SECTION* NewSection;
+ UINT32 NewSectionSize;
+ UINT32 FfsHdrLen;
+ UINT32 SecHdrLen;
+
+ //
+ // The section size is the DataSize + the size of the section header
+ //
+ NewSectionSize = (UINT32)sizeof (EFI_RAW_SECTION) + (UINT32)RawDataSize;
+ SecHdrLen = sizeof (EFI_RAW_SECTION);
+ if (NewSectionSize >= MAX_SECTION_SIZE) {
+ NewSectionSize = (UINT32)sizeof (EFI_RAW_SECTION2) + (UINT32)RawDataSize;
+ SecHdrLen = sizeof (EFI_RAW_SECTION2);
+ }
+
+ //
+ // The file size is the size of the file header + the section size
+ //
+ NewFileSize = sizeof (EFI_FFS_FILE_HEADER) + NewSectionSize;
+ FfsHdrLen = sizeof (EFI_FFS_FILE_HEADER);
+ if (NewFileSize >= MAX_FFS_SIZE) {
+ NewFileSize = sizeof (EFI_FFS_FILE_HEADER2) + NewSectionSize;
+ FfsHdrLen = sizeof (EFI_FFS_FILE_HEADER2);
+ }
+
+ //
+ // Try to allocate a buffer to build the new FFS file in
+ //
+ NewFile = CommonLibBinderAllocate (NewFileSize);
+ if (NewFile == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ CommonLibBinderSetMem (NewFile, NewFileSize, 0);
+
+ //
+ // The NewSection follow right after the FFS file header
+ //
+ NewSection = (EFI_RAW_SECTION*)((UINT8*)NewFile + FfsHdrLen);
+ if (NewSectionSize >= MAX_SECTION_SIZE) {
+ FvBufCompact3ByteSize (NewSection->Size, 0xffffff);
+ ((EFI_RAW_SECTION2 *)NewSection)->ExtendedSize = NewSectionSize;
+ } else {
+ FvBufCompact3ByteSize (NewSection->Size, NewSectionSize);
+ }
+ NewSection->Type = EFI_SECTION_RAW;
+
+ //
+ // Copy the actual file data into the buffer
+ //
+ CommonLibBinderCopyMem ((UINT8 *)NewSection + SecHdrLen, RawData, RawDataSize);
+
+ //
+ // Initialize the FFS file header
+ //
+ CommonLibBinderCopyMem (&NewFile->Name, Filename, sizeof (EFI_GUID));
+ NewFile->Attributes = 0;
+ if (NewFileSize >= MAX_FFS_SIZE) {
+ FvBufCompact3ByteSize (NewFile->Size, 0x0);
+ ((EFI_FFS_FILE_HEADER2 *)NewFile)->ExtendedSize = NewFileSize;
+ NewFile->Attributes |= FFS_ATTRIB_LARGE_FILE;
+ } else {
+ FvBufCompact3ByteSize (NewFile->Size, NewFileSize);
+ }
+ NewFile->Type = EFI_FV_FILETYPE_FREEFORM;
+ NewFile->IntegrityCheck.Checksum.Header =
+ FvBufCalculateChecksum8 ((UINT8*)NewFile, FfsHdrLen);
+ NewFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
+ NewFile->State = (UINT8)~( EFI_FILE_HEADER_CONSTRUCTION |
+ EFI_FILE_HEADER_VALID |
+ EFI_FILE_DATA_VALID
+ );
+
+ *FfsFile = NewFile;
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+FvBufFindNextSection (
+ IN VOID *SectionsStart,
+ IN UINTN TotalSectionsSize,
+ IN OUT UINTN *Key,
+ OUT VOID **Section
+ )
+/*++
+
+Routine Description:
+
+ Iterates through the sections contained within a given array of sections
+
+Arguments:
+
+ SectionsStart - Address of the start of the FFS sections array
+ TotalSectionsSize - Total size of all the sections
+ Key - Should be 0 to get the first section. After that, it should be
+ passed back in without modifying its contents to retrieve
+ subsequent files.
+ Section - Output section pointer
+ (Section == NULL) -> invalid parameter
+ otherwise -> *Section will be update to the location of the file
+
+Returns:
+
+ EFI_SUCCESS
+ EFI_NOT_FOUND
+ EFI_VOLUME_CORRUPTED
+
+--*/
+{
+ EFI_COMMON_SECTION_HEADER *sectionHdr;
+ UINTN sectionSize;
+
+ *Key = (UINTN)ALIGN_POINTER (*Key, 4); // Sections are DWORD aligned
+
+ if ((*Key + sizeof (*sectionHdr)) > TotalSectionsSize) {
+ return EFI_NOT_FOUND;
+ }
+
+ sectionHdr = (EFI_COMMON_SECTION_HEADER*)((UINT8*)SectionsStart + *Key);
+ sectionSize = FvBufGetSecFileLen (sectionHdr);
+
+ if (sectionSize < sizeof (EFI_COMMON_SECTION_HEADER)) {
+ return EFI_NOT_FOUND;
+ }
+
+ if ((*Key + sectionSize) > TotalSectionsSize) {
+ return EFI_NOT_FOUND;
+ }
+
+ *Section = (UINT8*)sectionHdr;
+ *Key = *Key + sectionSize;
+ return EFI_SUCCESS;
+
+}
+
+
+EFI_STATUS
+FvBufCountSections (
+ IN VOID* FfsFile,
+ IN UINTN* Count
+ )
+/*++
+
+Routine Description:
+
+ Searches the FFS file and counts the number of sections found.
+ The sections are NOT recursed.
+
+Arguments:
+
+ FfsFile - Address of the FFS file in memory
+ Count - The location to store the section count in
+
+Returns:
+
+ EFI_SUCCESS
+ EFI_NOT_FOUND
+ EFI_VOLUME_CORRUPTED
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN Key;
+ VOID* SectionStart;
+ UINTN TotalSectionsSize;
+ EFI_COMMON_SECTION_HEADER* NextSection;
+
+ SectionStart = (VOID*)((UINTN)FfsFile + FvBufGetFfsHeaderSize(FfsFile));
+ TotalSectionsSize =
+ FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)FfsFile) -
+ FvBufGetFfsHeaderSize(FfsFile);
+ Key = 0;
+ *Count = 0;
+ while (TRUE) {
+ Status = FvBufFindNextSection (
+ SectionStart,
+ TotalSectionsSize,
+ &Key,
+ (VOID **)&NextSection
+ );
+ if (Status == EFI_NOT_FOUND) {
+ return EFI_SUCCESS;
+ } else if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Increment the section counter
+ //
+ *Count += 1;
+
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+
+EFI_STATUS
+FvBufFindSectionByType (
+ IN VOID *FfsFile,
+ IN UINT8 Type,
+ OUT VOID **Section
+ )
+/*++
+
+Routine Description:
+
+ Searches the FFS file for a section by its type
+
+Arguments:
+
+ FfsFile - Address of the FFS file in memory
+ Type - FFS FILE section type to search for
+ Section - Output section pointer
+ (Section == NULL) -> Only determine if the section exists, based on return
+ value from the function call.
+ otherwise -> *Section will be update to the location of the file
+
+Returns:
+
+ EFI_SUCCESS
+ EFI_NOT_FOUND
+ EFI_VOLUME_CORRUPTED
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN Key;
+ VOID* SectionStart;
+ UINTN TotalSectionsSize;
+ EFI_COMMON_SECTION_HEADER* NextSection;
+
+ SectionStart = (VOID*)((UINTN)FfsFile + FvBufGetFfsHeaderSize(FfsFile));
+ TotalSectionsSize =
+ FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)FfsFile) -
+ FvBufGetFfsHeaderSize(FfsFile);
+ Key = 0;
+ while (TRUE) {
+ Status = FvBufFindNextSection (
+ SectionStart,
+ TotalSectionsSize,
+ &Key,
+ (VOID **)&NextSection
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (Type == NextSection->Type) {
+ if (Section != NULL) {
+ *Section = NextSection;
+ }
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+
+EFI_STATUS
+FvBufShrinkWrap (
+ IN VOID *Fv
+ )
+/*++
+
+Routine Description:
+
+ Shrinks a firmware volume (in place) to provide a minimal FV.
+
+ BUGBUG: Does not handle the case where the firmware volume has a
+ VTF (Volume Top File). The VTF will not be moved to the
+ end of the extended FV.
+
+Arguments:
+
+ Fv - Firmware volume.
+
+Returns:
+
+ EFI_SUCCESS
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN OldSize;
+ UINT32 BlockCount;
+ UINT32 NewBlockSize = 128;
+ UINTN Key;
+ EFI_FFS_FILE_HEADER* FileIt;
+ VOID* EndOfLastFile;
+
+ EFI_FIRMWARE_VOLUME_HEADER* FvHdr;
+
+ Status = FvBufGetSize (Fv, &OldSize);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = FvBufUnifyBlockSizes (Fv, NewBlockSize);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Locate the block map in the fv header
+ //
+ FvHdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
+
+ //
+ // Find the end of the last file
+ //
+ Key = 0;
+ EndOfLastFile = (UINT8*)FvHdr + FvHdr->FvLength;
+ while (!EFI_ERROR (FvBufFindNextFile (Fv, &Key, (VOID **)&FileIt))) {
+ EndOfLastFile =
+ (VOID*)((UINT8*)FileIt + FvBufGetFfsFileSize (FileIt));
+ }
+
+ //
+ // Set the BlockCount to have the minimal number of blocks for the Fv.
+ //
+ BlockCount = (UINT32)((UINTN)EndOfLastFile - (UINTN)Fv);
+ BlockCount = BlockCount + NewBlockSize - 1;
+ BlockCount = BlockCount / NewBlockSize;
+
+ //
+ // Adjust the block count to shrink the Fv in place.
+ //
+ FvHdr->BlockMap[0].NumBlocks = BlockCount;
+ FvHdr->FvLength = BlockCount * NewBlockSize;
+
+ //
+ // Update the FV header checksum
+ //
+ FvBufChecksumHeader (Fv);
+
+ return EFI_SUCCESS;
+
+}
+
+
+EFI_STATUS
+FvBufUnifyBlockSizes (
+ IN OUT VOID *Fv,
+ IN UINTN BlockSize
+ )
+/*++
+
+Routine Description:
+
+ Searches the FFS file for a section by its type
+
+Arguments:
+
+ Fv - Address of the Fv in memory
+ BlockSize - The size of the blocks to convert the Fv to. If the total size
+ of the Fv is not evenly divisible by this size, then
+ EFI_INVALID_PARAMETER will be returned.
+
+Returns:
+
+ EFI_SUCCESS
+ EFI_NOT_FOUND
+ EFI_VOLUME_CORRUPTED
+
+--*/
+{
+ EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
+ EFI_FV_BLOCK_MAP_ENTRY *blk = hdr->BlockMap;
+ UINT32 Size;
+
+ Size = 0;
+
+ //
+ // Scan through the block map list, performing error checking, and adding
+ // up the total Fv size.
+ //
+ while( blk->Length != 0 ||
+ blk->NumBlocks != 0
+ ) {
+ Size = Size + (blk->Length * blk->NumBlocks);
+ blk++;
+ if ((UINT8*)blk > ((UINT8*)hdr + hdr->HeaderLength)) {
+ return EFI_VOLUME_CORRUPTED;
+ }
+ }
+
+ //
+ // Make sure that the Fv size is a multiple of the new block size.
+ //
+ if ((Size % BlockSize) != 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Zero out the entire block map.
+ //
+ CommonLibBinderSetMem (
+ &hdr->BlockMap,
+ (UINTN)blk - (UINTN)&hdr->BlockMap,
+ 0
+ );
+
+ //
+ // Write out the single block map entry.
+ //
+ hdr->BlockMap[0].Length = (UINT32)BlockSize;
+ hdr->BlockMap[0].NumBlocks = Size / (UINT32)BlockSize;
+
+ return EFI_SUCCESS;
+}
+
+STATIC
+UINT16
+FvBufCalculateSum16 (
+ IN UINT16 *Buffer,
+ IN UINTN Size
+ )
+/*++
+
+Routine Description:
+
+ This function calculates the UINT16 sum for the requested region.
+
+Arguments:
+
+ Buffer Pointer to buffer containing byte data of component.
+ Size Size of the buffer
+
+Returns:
+
+ The 16 bit checksum
+
+--*/
+{
+ UINTN Index;
+ UINT16 Sum;
+
+ Sum = 0;
+
+ //
+ // Perform the word sum for buffer
+ //
+ for (Index = 0; Index < Size; Index++) {
+ Sum = (UINT16) (Sum + Buffer[Index]);
+ }
+
+ return (UINT16) Sum;
+}
+
+
+STATIC
+UINT16
+FvBufCalculateChecksum16 (
+ IN UINT16 *Buffer,
+ IN UINTN Size
+ )
+/*++
+
+Routine Description::
+
+ This function calculates the value needed for a valid UINT16 checksum
+
+Arguments:
+
+ Buffer Pointer to buffer containing byte data of component.
+ Size Size of the buffer
+
+Returns:
+
+ The 16 bit checksum value needed.
+
+--*/
+{
+ return (UINT16)(0x10000 - FvBufCalculateSum16 (Buffer, Size));
+}
+
+
+STATIC
+UINT8
+FvBufCalculateSum8 (
+ IN UINT8 *Buffer,
+ IN UINTN Size
+ )
+/*++
+
+Description:
+
+ This function calculates the UINT8 sum for the requested region.
+
+Input:
+
+ Buffer Pointer to buffer containing byte data of component.
+ Size Size of the buffer
+
+Return:
+
+ The 8 bit checksum value needed.
+
+--*/
+{
+ UINTN Index;
+ UINT8 Sum;
+
+ Sum = 0;
+
+ //
+ // Perform the byte sum for buffer
+ //
+ for (Index = 0; Index < Size; Index++) {
+ Sum = (UINT8) (Sum + Buffer[Index]);
+ }
+
+ return Sum;
+}
+
+
+STATIC
+UINT8
+FvBufCalculateChecksum8 (
+ IN UINT8 *Buffer,
+ IN UINTN Size
+ )
+/*++
+
+Description:
+
+ This function calculates the value needed for a valid UINT8 checksum
+
+Input:
+
+ Buffer Pointer to buffer containing byte data of component.
+ Size Size of the buffer
+
+Return:
+
+ The 8 bit checksum value needed.
+
+--*/
+{
+ return (UINT8)(0x100 - FvBufCalculateSum8 (Buffer, Size));
+}
+
+
diff --git a/roms/edk2/BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h b/roms/edk2/BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h
new file mode 100644
index 000000000..6b1caba99
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h
@@ -0,0 +1,163 @@
+/** @file
+EFI Firmware Volume routines which work on a Fv image in buffers.
+
+Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef FirmwareVolumeBuffer_h_INCLUDED
+#define FirmwareVolumeBuffer_h_INCLUDED
+
+#include "Common/UefiBaseTypes.h"
+#include "Common/PiFirmwareFile.h"
+#include "Common/PiFirmwareVolume.h"
+
+EFI_STATUS
+FvBufAddFile (
+ IN OUT VOID *Fv,
+ IN VOID *File
+ );
+
+EFI_STATUS
+FvBufAddFileWithExtend (
+ IN OUT VOID **Fv,
+ IN VOID *File
+ );
+
+EFI_STATUS
+FvBufAddVtfFile (
+ IN OUT VOID *Fv,
+ IN VOID *File
+ );
+
+EFI_STATUS
+FvBufChecksumFile (
+ IN OUT VOID *FfsFile
+ );
+
+EFI_STATUS
+FvBufChecksumHeader (
+ IN OUT VOID *Fv
+ );
+
+EFI_STATUS
+FvBufClearAllFiles (
+ IN OUT VOID *Fv
+ );
+
+VOID
+FvBufCompact3ByteSize (
+ OUT VOID* SizeDest,
+ IN UINT32 Size
+ );
+
+EFI_STATUS
+FvBufCountSections (
+ IN VOID* FfsFile,
+ IN UINTN* Count
+ );
+
+EFI_STATUS
+FvBufDuplicate (
+ IN VOID *SourceFv,
+ IN OUT VOID **DestinationFv
+ );
+
+UINT32
+FvBufExpand3ByteSize (
+ IN VOID* Size
+ );
+
+UINT32
+FvBufGetFfsFileSize (
+ IN EFI_FFS_FILE_HEADER *Ffs
+ );
+
+UINT32
+FvBufGetFfsHeaderSize (
+ IN EFI_FFS_FILE_HEADER *Ffs
+ );
+
+EFI_STATUS
+FvBufExtend (
+ IN VOID **Fv,
+ IN UINTN Size
+ );
+
+EFI_STATUS
+FvBufFindFileByName (
+ IN VOID *Fv,
+ IN EFI_GUID *Name,
+ OUT VOID **File
+ );
+
+EFI_STATUS
+FvBufFindFileByType (
+ IN VOID *Fv,
+ IN EFI_FV_FILETYPE Type,
+ OUT VOID **File
+ );
+
+EFI_STATUS
+FvBufFindNextFile (
+ IN VOID *Fv,
+ IN OUT UINTN *Key,
+ OUT VOID **File
+ );
+
+EFI_STATUS
+FvBufFindNextSection (
+ IN VOID *SectionsStart,
+ IN UINTN TotalSectionsSize,
+ IN OUT UINTN *Key,
+ OUT VOID **Section
+ );
+
+EFI_STATUS
+FvBufFindSectionByType (
+ IN VOID *FfsFile,
+ IN UINT8 Type,
+ OUT VOID **Section
+ );
+
+EFI_STATUS
+FvBufGetFileRawData (
+ IN VOID* FfsFile,
+ OUT VOID** RawData,
+ OUT UINTN* RawDataSize
+ );
+
+EFI_STATUS
+FvBufGetSize (
+ IN VOID *Fv,
+ OUT UINTN *Size
+ );
+
+EFI_STATUS
+FvBufPackageFreeformRawFile (
+ IN EFI_GUID* Filename,
+ IN VOID* RawData,
+ IN UINTN RawDataSize,
+ OUT VOID** FfsFile
+ );
+
+EFI_STATUS
+FvBufRemoveFile (
+ IN OUT VOID *Fv,
+ IN EFI_GUID *Name
+ );
+
+EFI_STATUS
+FvBufUnifyBlockSizes (
+ IN OUT VOID *Fv,
+ IN UINTN BlockSize
+ );
+
+EFI_STATUS
+FvBufShrinkWrap (
+ IN VOID *Fv
+ );
+
+#endif // #ifndef FirmwareVolumeBuffer_h_INCLUDED
+
diff --git a/roms/edk2/BaseTools/Source/C/Common/FvLib.c b/roms/edk2/BaseTools/Source/C/Common/FvLib.c
new file mode 100644
index 000000000..82dc557bb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/FvLib.c
@@ -0,0 +1,927 @@
+/** @file
+These functions assist in parsing and manipulating a Firmware Volume.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+//
+// Include files
+//
+#include "FvLib.h"
+#include "CommonLib.h"
+#include "EfiUtilityMsgs.h"
+
+//
+// Module global variables
+//
+EFI_FIRMWARE_VOLUME_HEADER *mFvHeader = NULL;
+UINT32 mFvLength = 0;
+
+//
+// External function implementations
+//
+EFI_STATUS
+InitializeFvLib (
+ IN VOID *Fv,
+ IN UINT32 FvLength
+ )
+/*++
+
+Routine Description:
+
+ This initializes the FV lib with a pointer to the FV and length. It does not
+ verify the FV in any way.
+
+Arguments:
+
+ Fv Buffer containing the FV.
+ FvLength Length of the FV
+
+Returns:
+
+ EFI_SUCCESS Function Completed successfully.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+
+--*/
+{
+ //
+ // Verify input arguments
+ //
+ if (Fv == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ mFvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) Fv;
+ mFvLength = FvLength;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GetFvHeader (
+ OUT EFI_FIRMWARE_VOLUME_HEADER **FvHeader,
+ OUT UINT32 *FvLength
+ )
+/*++
+
+Routine Description:
+
+ This function returns a pointer to the current FV and the size.
+
+Arguments:
+
+ FvHeader Pointer to the FV buffer.
+ FvLength Length of the FV
+
+Returns:
+
+ EFI_SUCCESS Function Completed successfully.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+ EFI_ABORTED The library needs to be initialized.
+
+--*/
+{
+ //
+ // Verify library has been initialized.
+ //
+ if (mFvHeader == NULL || mFvLength == 0) {
+ return EFI_ABORTED;
+ }
+ //
+ // Verify input arguments
+ //
+ if (FvHeader == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *FvHeader = mFvHeader;
+ *FvLength = mFvLength;
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GetNextFile (
+ IN EFI_FFS_FILE_HEADER *CurrentFile,
+ OUT EFI_FFS_FILE_HEADER **NextFile
+ )
+/*++
+
+Routine Description:
+
+ This function returns the next file. If the current file is NULL, it returns
+ the first file in the FV. If the function returns EFI_SUCCESS and the file
+ pointer is NULL, then there are no more files in the FV.
+
+Arguments:
+
+ CurrentFile Pointer to the current file, must be within the current FV.
+ NextFile Pointer to the next file in the FV.
+
+Returns:
+
+ EFI_SUCCESS Function completed successfully.
+ EFI_INVALID_PARAMETER A required parameter was NULL or is out of range.
+ EFI_ABORTED The library needs to be initialized.
+
+--*/
+{
+ EFI_STATUS Status;
+
+ //
+ // Verify library has been initialized.
+ //
+ if (mFvHeader == NULL || mFvLength == 0) {
+ return EFI_ABORTED;
+ }
+ //
+ // Verify input arguments
+ //
+ if (NextFile == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Verify FV header
+ //
+ Status = VerifyFv (mFvHeader);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+ //
+ // Get first file
+ //
+ if (CurrentFile == NULL) {
+ CurrentFile = (EFI_FFS_FILE_HEADER *) ((UINTN) mFvHeader + mFvHeader->HeaderLength);
+
+ //
+ // Verify file is valid
+ //
+ Status = VerifyFfsFile (CurrentFile);
+ if (EFI_ERROR (Status)) {
+ //
+ // no files in this FV
+ //
+ *NextFile = NULL;
+ return EFI_SUCCESS;
+ } else {
+ //
+ // Verify file is in this FV.
+ //
+ if ((UINTN) CurrentFile + GetFfsFileLength(CurrentFile) > (UINTN) mFvHeader + mFvLength) {
+ *NextFile = NULL;
+ return EFI_SUCCESS;
+ }
+
+ *NextFile = CurrentFile;
+ return EFI_SUCCESS;
+ }
+ }
+ //
+ // Verify current file is in range
+ //
+ if (((UINTN) CurrentFile < (UINTN) mFvHeader + mFvHeader->HeaderLength) ||
+ ((UINTN) CurrentFile + GetFfsFileLength(CurrentFile) > (UINTN) mFvHeader + mFvLength)
+ ) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Get next file, compensate for 8 byte alignment if necessary.
+ //
+ *NextFile = (EFI_FFS_FILE_HEADER *) ((((UINTN) CurrentFile - (UINTN) mFvHeader + GetFfsFileLength(CurrentFile) + 0x07) & (~(UINTN) 7)) + (UINT8 *) mFvHeader);
+
+ //
+ // Verify file is in this FV.
+ //
+ if (((UINTN) *NextFile + GetFfsHeaderLength(*NextFile) >= (UINTN) mFvHeader + mFvLength) ||
+ ((UINTN) *NextFile + GetFfsFileLength (*NextFile) > (UINTN) mFvHeader + mFvLength)
+ ) {
+ *NextFile = NULL;
+ return EFI_SUCCESS;
+ }
+ //
+ // Verify file is valid
+ //
+ Status = VerifyFfsFile (*NextFile);
+ if (EFI_ERROR (Status)) {
+ //
+ // no more files in this FV
+ //
+ *NextFile = NULL;
+ return EFI_SUCCESS;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GetFileByName (
+ IN EFI_GUID *FileName,
+ OUT EFI_FFS_FILE_HEADER **File
+ )
+/*++
+
+Routine Description:
+
+ Find a file by name. The function will return NULL if the file is not found.
+
+Arguments:
+
+ FileName The GUID file name of the file to search for.
+ File Return pointer. In the case of an error, contents are undefined.
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully.
+ EFI_ABORTED An error was encountered.
+ EFI_INVALID_PARAMETER One of the parameters was NULL.
+
+--*/
+{
+ EFI_FFS_FILE_HEADER *CurrentFile;
+ EFI_STATUS Status;
+ CHAR8 FileGuidString[80];
+
+ //
+ // Verify library has been initialized.
+ //
+ if (mFvHeader == NULL || mFvLength == 0) {
+ return EFI_ABORTED;
+ }
+ //
+ // Verify input parameters
+ //
+ if (FileName == NULL || File == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // File Guid String Name
+ //
+ PrintGuidToBuffer (FileName, (UINT8 *)FileGuidString, sizeof (FileGuidString), TRUE);
+ //
+ // Verify FV header
+ //
+ Status = VerifyFv (mFvHeader);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+ //
+ // Get the first file
+ //
+ Status = GetNextFile (NULL, &CurrentFile);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "error parsing FV image", "FFS file with Guid %s can't be found", FileGuidString);
+ return EFI_ABORTED;
+ }
+ //
+ // Loop as long as we have a valid file
+ //
+ while (CurrentFile) {
+ if (!CompareGuid (&CurrentFile->Name, FileName)) {
+ *File = CurrentFile;
+ return EFI_SUCCESS;
+ }
+
+ Status = GetNextFile (CurrentFile, &CurrentFile);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "error parsing FV image", "FFS file with Guid %s can't be found", FileGuidString);
+ return EFI_ABORTED;
+ }
+ }
+ //
+ // File not found in this FV.
+ //
+ *File = NULL;
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GetFileByType (
+ IN EFI_FV_FILETYPE FileType,
+ IN UINTN Instance,
+ OUT EFI_FFS_FILE_HEADER **File
+ )
+/*++
+
+Routine Description:
+
+ Find a file by type and instance. An instance of 1 is the first instance.
+ The function will return NULL if a matching file cannot be found.
+ File type EFI_FV_FILETYPE_ALL means any file type is valid.
+
+Arguments:
+
+ FileType Type of file to search for.
+ Instance Instance of the file type to return.
+ File Return pointer. In the case of an error, contents are undefined.
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully.
+ EFI_ABORTED An error was encountered.
+ EFI_INVALID_PARAMETER One of the parameters was NULL.
+
+--*/
+{
+ EFI_FFS_FILE_HEADER *CurrentFile;
+ EFI_STATUS Status;
+ UINTN FileCount;
+
+ //
+ // Verify library has been initialized.
+ //
+ if (mFvHeader == NULL || mFvLength == 0) {
+ return EFI_ABORTED;
+ }
+ //
+ // Verify input parameters
+ //
+ if (File == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Verify FV header
+ //
+ Status = VerifyFv (mFvHeader);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+ //
+ // Initialize the number of matching files found.
+ //
+ FileCount = 0;
+
+ //
+ // Get the first file
+ //
+ Status = GetNextFile (NULL, &CurrentFile);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "error parsing FV image", "FFS file with FileType 0x%x can't be found", FileType);
+ return EFI_ABORTED;
+ }
+ //
+ // Loop as long as we have a valid file
+ //
+ while (CurrentFile) {
+ if (FileType == EFI_FV_FILETYPE_ALL || CurrentFile->Type == FileType) {
+ FileCount++;
+ }
+
+ if (FileCount == Instance) {
+ *File = CurrentFile;
+ return EFI_SUCCESS;
+ }
+
+ Status = GetNextFile (CurrentFile, &CurrentFile);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "error parsing FV image", "FFS file with FileType 0x%x can't be found", FileType);
+ return EFI_ABORTED;
+ }
+ }
+
+ *File = NULL;
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+SearchSectionByType (
+ IN EFI_FILE_SECTION_POINTER FirstSection,
+ IN UINT8 *SearchEnd,
+ IN EFI_SECTION_TYPE SectionType,
+ IN OUT UINTN *StartIndex,
+ IN UINTN Instance,
+ OUT EFI_FILE_SECTION_POINTER *Section
+ )
+/*++
+
+Routine Description:
+
+ Helper function to search a sequence of sections from the section pointed
+ by FirstSection to SearchEnd for the Instance-th section of type SectionType.
+ The current counter is saved in StartIndex and when the section is found, it's
+ saved in Section. GUID-defined sections, if special processing is not required,
+ are searched recursively in a depth-first manner.
+
+Arguments:
+
+ FirstSection The first section to start searching from.
+ SearchEnd The end address to stop search.
+ SectionType The type of section to search.
+ StartIndex The current counter is saved.
+ Instance The requested n-th section number.
+ Section The found section returned.
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully.
+ EFI_NOT_FOUND The section is not found.
+--*/
+{
+ EFI_FILE_SECTION_POINTER CurrentSection;
+ EFI_FILE_SECTION_POINTER InnerSection;
+ EFI_STATUS Status;
+ UINTN SectionSize;
+ UINT16 GuidSecAttr;
+ UINT16 GuidDataOffset;
+
+ GuidSecAttr = 0;
+ GuidDataOffset = 0;
+ CurrentSection = FirstSection;
+
+ while ((UINTN) CurrentSection.CommonHeader < (UINTN) SearchEnd) {
+ if (CurrentSection.CommonHeader->Type == SectionType) {
+ (*StartIndex)++;
+ }
+
+ if (*StartIndex == Instance) {
+ *Section = CurrentSection;
+ return EFI_SUCCESS;
+ }
+ //
+ // If the requesting section is not GUID-defined and
+ // we find a GUID-defined section that doesn't need
+ // special processing, go ahead to search the requesting
+ // section inside the GUID-defined section.
+ //
+ if (CurrentSection.CommonHeader->Type == EFI_SECTION_GUID_DEFINED) {
+ if (GetLength(CurrentSection.CommonHeader->Size) == 0xffffff) {
+ GuidSecAttr = CurrentSection.GuidDefinedSection2->Attributes;
+ GuidDataOffset = CurrentSection.GuidDefinedSection2->DataOffset;
+ } else {
+ GuidSecAttr = CurrentSection.GuidDefinedSection->Attributes;
+ GuidDataOffset = CurrentSection.GuidDefinedSection->DataOffset;
+ }
+ }
+ if (SectionType != EFI_SECTION_GUID_DEFINED &&
+ CurrentSection.CommonHeader->Type == EFI_SECTION_GUID_DEFINED &&
+ !(GuidSecAttr & EFI_GUIDED_SECTION_PROCESSING_REQUIRED)) {
+ InnerSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *)
+ ((UINTN) CurrentSection.CommonHeader + GuidDataOffset);
+ SectionSize = GetSectionFileLength(CurrentSection.CommonHeader);
+ Status = SearchSectionByType (
+ InnerSection,
+ (UINT8 *) ((UINTN) CurrentSection.CommonHeader + SectionSize),
+ SectionType,
+ StartIndex,
+ Instance,
+ Section
+ );
+ if (!EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ }
+ }
+ //
+ // Find next section (including compensating for alignment issues.
+ //
+ CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *) ((((UINTN) CurrentSection.CommonHeader) + GetSectionFileLength(CurrentSection.CommonHeader) + 0x03) & (~(UINTN) 3));
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+EFI_STATUS
+GetSectionByType (
+ IN EFI_FFS_FILE_HEADER *File,
+ IN EFI_SECTION_TYPE SectionType,
+ IN UINTN Instance,
+ OUT EFI_FILE_SECTION_POINTER *Section
+ )
+/*++
+
+Routine Description:
+
+ Find a section in a file by type and instance. An instance of 1 is the first
+ instance. The function will return NULL if a matching section cannot be found.
+ GUID-defined sections, if special processing is not needed, are handled in a
+ depth-first manner.
+
+Arguments:
+
+ File The file to search.
+ SectionType Type of file to search for.
+ Instance Instance of the section to return.
+ Section Return pointer. In the case of an error, contents are undefined.
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully.
+ EFI_ABORTED An error was encountered.
+ EFI_INVALID_PARAMETER One of the parameters was NULL.
+ EFI_NOT_FOUND No found.
+--*/
+{
+ EFI_FILE_SECTION_POINTER CurrentSection;
+ EFI_STATUS Status;
+ UINTN SectionCount;
+
+ //
+ // Verify input parameters
+ //
+ if (File == NULL || Instance == 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Verify FFS header
+ //
+ Status = VerifyFfsFile (File);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0006, "invalid FFS file", NULL);
+ return EFI_ABORTED;
+ }
+ //
+ // Initialize the number of matching sections found.
+ //
+ SectionCount = 0;
+
+ //
+ // Get the first section
+ //
+ CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *) ((UINTN) File + GetFfsHeaderLength(File));
+
+ //
+ // Depth-first manner to find section file.
+ //
+ Status = SearchSectionByType (
+ CurrentSection,
+ (UINT8 *) ((UINTN) File + GetFfsFileLength (File)),
+ SectionType,
+ &SectionCount,
+ Instance,
+ Section
+ );
+
+ if (!EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ } else {
+ //
+ // Section not found
+ //
+ (*Section).Code16Section = NULL;
+ return EFI_NOT_FOUND;
+ }
+}
+//
+// will not parse compressed sections
+//
+EFI_STATUS
+VerifyFv (
+ IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader
+ )
+/*++
+
+Routine Description:
+
+ Verify the current pointer points to a valid FV header.
+
+Arguments:
+
+ FvHeader Pointer to an alleged FV file.
+
+Returns:
+
+ EFI_SUCCESS The FV header is valid.
+ EFI_VOLUME_CORRUPTED The FV header is not valid.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+ EFI_ABORTED Operation aborted.
+
+--*/
+{
+ UINT16 Checksum;
+
+ //
+ // Verify input parameters
+ //
+ if (FvHeader == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (FvHeader->Signature != EFI_FVH_SIGNATURE) {
+ Error (NULL, 0, 0006, "invalid FV header signature", NULL);
+ return EFI_VOLUME_CORRUPTED;
+ }
+ //
+ // Verify header checksum
+ //
+ Checksum = CalculateSum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
+
+ if (Checksum != 0) {
+ Error (NULL, 0, 0006, "invalid FV header checksum", NULL);
+ return EFI_ABORTED;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+VerifyFfsFile (
+ IN EFI_FFS_FILE_HEADER *FfsHeader
+ )
+/*++
+
+Routine Description:
+
+ Verify the current pointer points to a FFS file header.
+
+Arguments:
+
+ FfsHeader Pointer to an alleged FFS file.
+
+Returns:
+
+ EFI_SUCCESS The Ffs header is valid.
+ EFI_NOT_FOUND This "file" is the beginning of free space.
+ EFI_VOLUME_CORRUPTED The Ffs header is not valid.
+ EFI_ABORTED The erase polarity is not known.
+
+--*/
+{
+ BOOLEAN ErasePolarity;
+ EFI_STATUS Status;
+ EFI_FFS_FILE_HEADER2 BlankHeader;
+ UINT8 Checksum;
+ UINT32 FileLength;
+ UINT8 SavedChecksum;
+ UINT8 SavedState;
+ UINT8 FileGuidString[80];
+ UINT32 FfsHeaderSize;
+
+ //
+ // Verify library has been initialized.
+ //
+ if (mFvHeader == NULL || mFvLength == 0) {
+ return EFI_ABORTED;
+ }
+ //
+ // Verify FV header
+ //
+ Status = VerifyFv (mFvHeader);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+ //
+ // Get the erase polarity.
+ //
+ Status = GetErasePolarity (&ErasePolarity);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+
+ FfsHeaderSize = GetFfsHeaderLength(FfsHeader);
+ //
+ // Check if we have free space
+ //
+ if (ErasePolarity) {
+ memset (&BlankHeader, -1, FfsHeaderSize);
+ } else {
+ memset (&BlankHeader, 0, FfsHeaderSize);
+ }
+
+ if (memcmp (&BlankHeader, FfsHeader, FfsHeaderSize) == 0) {
+ return EFI_NOT_FOUND;
+ }
+ //
+ // Convert the GUID to a string so we can at least report which file
+ // if we find an error.
+ //
+ PrintGuidToBuffer (&FfsHeader->Name, FileGuidString, sizeof (FileGuidString), TRUE);
+ //
+ // Verify file header checksum
+ //
+ SavedState = FfsHeader->State;
+ FfsHeader->State = 0;
+ SavedChecksum = FfsHeader->IntegrityCheck.Checksum.File;
+ FfsHeader->IntegrityCheck.Checksum.File = 0;
+ Checksum = CalculateSum8 ((UINT8 *) FfsHeader, FfsHeaderSize);
+ FfsHeader->State = SavedState;
+ FfsHeader->IntegrityCheck.Checksum.File = SavedChecksum;
+ if (Checksum != 0) {
+ Error (NULL, 0, 0006, "invalid FFS file header checksum", "Ffs file with Guid %s", FileGuidString);
+ return EFI_ABORTED;
+ }
+ //
+ // Verify file checksum
+ //
+ if (FfsHeader->Attributes & FFS_ATTRIB_CHECKSUM) {
+ //
+ // Verify file data checksum
+ //
+ FileLength = GetFfsFileLength (FfsHeader);
+ Checksum = CalculateSum8 ((UINT8 *) ((UINT8 *)FfsHeader + FfsHeaderSize), FileLength - FfsHeaderSize);
+ Checksum = Checksum + FfsHeader->IntegrityCheck.Checksum.File;
+ if (Checksum != 0) {
+ Error (NULL, 0, 0006, "invalid FFS file checksum", "Ffs file with Guid %s", FileGuidString);
+ return EFI_ABORTED;
+ }
+ } else {
+ //
+ // File does not have a checksum
+ // Verify contents are 0xAA as spec'd
+ //
+ if (FfsHeader->IntegrityCheck.Checksum.File != FFS_FIXED_CHECKSUM) {
+ Error (NULL, 0, 0006, "invalid fixed FFS file header checksum", "Ffs file with Guid %s", FileGuidString);
+ return EFI_ABORTED;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+UINT32
+GetFfsHeaderLength(
+ IN EFI_FFS_FILE_HEADER *FfsHeader
+ )
+{
+ if (FfsHeader == NULL) {
+ return 0;
+ }
+ if (FfsHeader->Attributes & FFS_ATTRIB_LARGE_FILE) {
+ return sizeof(EFI_FFS_FILE_HEADER2);
+ }
+ return sizeof(EFI_FFS_FILE_HEADER);
+}
+
+UINT32
+GetSectionHeaderLength(
+ IN EFI_COMMON_SECTION_HEADER *SectionHeader
+ )
+{
+ if (SectionHeader == NULL) {
+ return 0;
+ }
+ if (GetLength(SectionHeader->Size) == 0xffffff) {
+ return sizeof(EFI_COMMON_SECTION_HEADER2);
+ }
+ return sizeof(EFI_COMMON_SECTION_HEADER);
+}
+
+UINT32
+GetFfsFileLength (
+ EFI_FFS_FILE_HEADER *FfsHeader
+ )
+/*++
+
+Routine Description:
+
+ Get FFS file length including FFS header.
+
+Arguments:
+
+ FfsHeader Pointer to EFI_FFS_FILE_HEADER.
+
+Returns:
+
+ UINT32 Length of FFS file header.
+
+--*/
+{
+ if (FfsHeader == NULL) {
+ return 0;
+ }
+ if (FfsHeader->Attributes & FFS_ATTRIB_LARGE_FILE) {
+ return (UINT32) ((EFI_FFS_FILE_HEADER2 *)FfsHeader)->ExtendedSize;
+ } else {
+ return GetLength(FfsHeader->Size);
+ }
+}
+
+UINT32
+GetSectionFileLength (
+ EFI_COMMON_SECTION_HEADER *SectionHeader
+ )
+{
+ UINT32 Length;
+ if (SectionHeader == NULL) {
+ return 0;
+ }
+ Length = GetLength(SectionHeader->Size);
+ if (Length == 0xffffff) {
+ Length = ((EFI_COMMON_SECTION_HEADER2 *)SectionHeader)->ExtendedSize;
+ }
+ return Length;
+}
+
+UINT32
+GetLength (
+ UINT8 *ThreeByteLength
+ )
+/*++
+
+Routine Description:
+
+ Converts a three byte length value into a UINT32.
+
+Arguments:
+
+ ThreeByteLength Pointer to the first of the 3 byte length.
+
+Returns:
+
+ UINT32 Size of the section
+
+--*/
+{
+ UINT32 Length;
+
+ if (ThreeByteLength == NULL) {
+ return 0;
+ }
+
+ Length = *((UINT32 *) ThreeByteLength);
+ Length = Length & 0x00FFFFFF;
+
+ return Length;
+}
+
+EFI_STATUS
+GetErasePolarity (
+ OUT BOOLEAN *ErasePolarity
+ )
+/*++
+
+Routine Description:
+
+ This function returns with the FV erase polarity. If the erase polarity
+ for a bit is 1, the function return TRUE.
+
+Arguments:
+
+ ErasePolarity A pointer to the erase polarity.
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully.
+ EFI_INVALID_PARAMETER One of the input parameters was invalid.
+ EFI_ABORTED Operation aborted.
+
+--*/
+{
+ EFI_STATUS Status;
+
+ //
+ // Verify library has been initialized.
+ //
+ if (mFvHeader == NULL || mFvLength == 0) {
+ return EFI_ABORTED;
+ }
+ //
+ // Verify FV header
+ //
+ Status = VerifyFv (mFvHeader);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+ //
+ // Verify input parameters.
+ //
+ if (ErasePolarity == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (mFvHeader->Attributes & EFI_FVB2_ERASE_POLARITY) {
+ *ErasePolarity = TRUE;
+ } else {
+ *ErasePolarity = FALSE;
+ }
+
+ return EFI_SUCCESS;
+}
+
+UINT8
+GetFileState (
+ IN BOOLEAN ErasePolarity,
+ IN EFI_FFS_FILE_HEADER *FfsHeader
+ )
+/*++
+
+Routine Description:
+
+ This function returns a the highest state bit in the FFS that is set.
+ It in no way validate the FFS file.
+
+Arguments:
+
+ ErasePolarity The erase polarity for the file state bits.
+ FfsHeader Pointer to a FFS file.
+
+Returns:
+
+ UINT8 The hightest set state of the file.
+
+--*/
+{
+ UINT8 FileState;
+ UINT8 HighestBit;
+
+ FileState = FfsHeader->State;
+
+ if (ErasePolarity) {
+ FileState = (UINT8)~FileState;
+ }
+
+ HighestBit = 0x80;
+ while (HighestBit != 0 && (HighestBit & FileState) == 0) {
+ HighestBit >>= 1;
+ }
+
+ return HighestBit;
+}
diff --git a/roms/edk2/BaseTools/Source/C/Common/FvLib.h b/roms/edk2/BaseTools/Source/C/Common/FvLib.h
new file mode 100644
index 000000000..815df6f80
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/FvLib.h
@@ -0,0 +1,189 @@
+/** @file
+These functions assist in parsing and manipulating a Firmware Volume.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFI_FV_LIB_H
+#define _EFI_FV_LIB_H
+
+//
+// Include files
+//
+#include <string.h>
+
+#include <Common/UefiBaseTypes.h>
+#include <Common/PiFirmwareFile.h>
+#include <Common/PiFirmwareVolume.h>
+
+EFI_STATUS
+InitializeFvLib (
+ IN VOID *Fv,
+ IN UINT32 FvLength
+ )
+;
+
+EFI_STATUS
+GetFvHeader (
+ OUT EFI_FIRMWARE_VOLUME_HEADER **FvHeader,
+ OUT UINT32 *FvLength
+ )
+;
+
+EFI_STATUS
+GetNextFile (
+ IN EFI_FFS_FILE_HEADER *CurrentFile,
+ OUT EFI_FFS_FILE_HEADER **NextFile
+ )
+;
+
+EFI_STATUS
+GetFileByName (
+ IN EFI_GUID *FileName,
+ OUT EFI_FFS_FILE_HEADER **File
+ )
+;
+
+EFI_STATUS
+GetFileByType (
+ IN EFI_FV_FILETYPE FileType,
+ IN UINTN Instance,
+ OUT EFI_FFS_FILE_HEADER **File
+ )
+;
+
+EFI_STATUS
+GetSectionByType (
+ IN EFI_FFS_FILE_HEADER *File,
+ IN EFI_SECTION_TYPE SectionType,
+ IN UINTN Instance,
+ OUT EFI_FILE_SECTION_POINTER *Section
+ )
+;
+//
+// will not parse compressed sections
+//
+EFI_STATUS
+VerifyFv (
+ IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader
+ )
+;
+
+EFI_STATUS
+VerifyFfsFile (
+ IN EFI_FFS_FILE_HEADER *FfsHeader
+ )
+;
+
+UINT32
+GetFfsFileLength (
+ EFI_FFS_FILE_HEADER *FfsHeader
+ )
+;
+
+UINT32
+GetSectionFileLength (
+ EFI_COMMON_SECTION_HEADER *SectionHeader
+ )
+;
+
+UINT32
+GetFfsHeaderLength(
+ IN EFI_FFS_FILE_HEADER *FfsHeader
+ )
+;
+
+UINT32
+GetSectionHeaderLength(
+ IN EFI_COMMON_SECTION_HEADER *SectionHeader
+ )
+;
+
+/*++
+
+Routine Description:
+
+ Verify the current pointer points to a FFS file header.
+
+Arguments:
+
+ FfsHeader Pointer to an alleged FFS file.
+
+Returns:
+
+ EFI_SUCCESS The Ffs header is valid.
+ EFI_NOT_FOUND This "file" is the beginning of free space.
+ EFI_VOLUME_CORRUPTED The Ffs header is not valid.
+
+--*/
+UINT32
+GetLength (
+ UINT8 *ThreeByteLength
+ )
+;
+
+/*++
+
+Routine Description:
+
+ Converts a three byte length value into a UINT32.
+
+Arguments:
+
+ ThreeByteLength Pointer to the first of the 3 byte length.
+
+Returns:
+
+ UINT32 Size of the section
+
+--*/
+EFI_STATUS
+GetErasePolarity (
+ OUT BOOLEAN *ErasePolarity
+ )
+;
+
+/*++
+
+Routine Description:
+
+ This function returns with the FV erase polarity. If the erase polarity
+ for a bit is 1, the function return TRUE.
+
+Arguments:
+
+ ErasePolarity A pointer to the erase polarity.
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully.
+ EFI_INVALID_PARAMETER One of the input parameters was invalid.
+
+--*/
+UINT8
+GetFileState (
+ IN BOOLEAN ErasePolarity,
+ IN EFI_FFS_FILE_HEADER *FfsHeader
+ )
+;
+
+/*++
+
+Routine Description:
+
+ This function returns a the highest state bit in the FFS that is set.
+ It in no way validate the FFS file.
+
+Arguments:
+
+ ErasePolarity The erase polarity for the file state bits.
+ FfsHeader Pointer to a FFS file.
+
+Returns:
+
+ UINT8 The hightest set state of the file.
+
+--*/
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Common/GNUmakefile b/roms/edk2/BaseTools/Source/C/Common/GNUmakefile
new file mode 100644
index 000000000..b3eef7460
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/GNUmakefile
@@ -0,0 +1,33 @@
+## @file
+# GNU/Linux makefile for 'Common' module build.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+MAKEROOT ?= ..
+
+# VPATH = ..
+
+LIBNAME = Common
+
+OBJECTS = \
+ BasePeCoff.o \
+ BinderFuncs.o \
+ CommonLib.o \
+ Crc32.o \
+ Decompress.o \
+ EfiCompress.o \
+ EfiUtilityMsgs.o \
+ FirmwareVolumeBuffer.o \
+ FvLib.o \
+ MemoryFile.o \
+ MyAlloc.o \
+ OsPath.o \
+ ParseGuidedSectionTools.o \
+ ParseInf.o \
+ PeCoffLoaderEx.o \
+ SimpleFileParsing.o \
+ StringFuncs.o \
+ TianoCompress.o
+
+include $(MAKEROOT)/Makefiles/lib.makefile
diff --git a/roms/edk2/BaseTools/Source/C/Common/Makefile b/roms/edk2/BaseTools/Source/C/Common/Makefile
new file mode 100644
index 000000000..ec61e45c8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/Makefile
@@ -0,0 +1,36 @@
+## @file
+# Windows makefile for 'Common' module build.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+# VPATH = ..
+
+LIBNAME = Common
+
+OBJECTS = \
+ BasePeCoff.obj \
+ BinderFuncs.obj \
+ CommonLib.obj \
+ Crc32.obj \
+ Decompress.obj \
+ EfiCompress.obj \
+ EfiUtilityMsgs.obj \
+ FirmwareVolumeBuffer.obj \
+ FvLib.obj \
+ MemoryFile.obj \
+ MyAlloc.obj \
+ OsPath.obj \
+ ParseGuidedSectionTools.obj \
+ ParseInf.obj \
+ PeCoffLoaderEx.obj \
+ SimpleFileParsing.obj \
+ StringFuncs.obj \
+ TianoCompress.obj
+
+!INCLUDE ..\Makefiles\ms.lib
+
+
+
diff --git a/roms/edk2/BaseTools/Source/C/Common/MemoryFile.c b/roms/edk2/BaseTools/Source/C/Common/MemoryFile.c
new file mode 100644
index 000000000..8154a3c99
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/MemoryFile.c
@@ -0,0 +1,251 @@
+/** @file
+This contains some useful functions for accessing files.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include "CommonLib.h"
+#include "MemoryFile.h"
+
+
+//
+// Local (static) function prototypes
+//
+STATIC
+VOID
+CheckMemoryFileState (
+ IN EFI_HANDLE InputMemoryFile
+ );
+
+//
+// Function implementations
+//
+
+EFI_STATUS
+GetMemoryFile (
+ IN CHAR8 *InputFileName,
+ OUT EFI_HANDLE *OutputMemoryFile
+ )
+/*++
+
+Routine Description:
+
+ This opens a file, reads it into memory and returns a memory file
+ object.
+
+Arguments:
+
+ InputFile Memory file image.
+ OutputMemoryFile Handle to memory file
+
+Returns:
+
+ EFI_STATUS
+ OutputMemoryFile is valid if !EFI_ERROR
+
+--*/
+{
+ EFI_STATUS Status;
+ CHAR8 *InputFileImage;
+ UINT32 BytesRead;
+ MEMORY_FILE *NewMemoryFile;
+
+ Status = GetFileImage (InputFileName, &InputFileImage, &BytesRead);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ NewMemoryFile = malloc (sizeof (*NewMemoryFile));
+ if (NewMemoryFile == NULL) {
+ free (InputFileImage);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ NewMemoryFile->FileImage = InputFileImage;
+ NewMemoryFile->CurrentFilePointer = InputFileImage;
+ NewMemoryFile->Eof = InputFileImage + BytesRead;
+
+ *OutputMemoryFile = (EFI_HANDLE)NewMemoryFile;
+
+ CheckMemoryFileState (*OutputMemoryFile);
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+FreeMemoryFile (
+ IN EFI_HANDLE InputMemoryFile
+ )
+/*++
+
+Routine Description:
+
+ Frees all memory associated with the input memory file.
+
+Arguments:
+
+ InputMemoryFile Handle to memory file
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ MEMORY_FILE *MemoryFile;
+
+ CheckMemoryFileState (InputMemoryFile);
+
+ MemoryFile = (MEMORY_FILE*)InputMemoryFile;
+
+ free (MemoryFile->FileImage);
+
+ //
+ // Invalidate state of MEMORY_FILE structure to catch invalid usage.
+ //
+ memset (MemoryFile, 0xcc, sizeof (*MemoryFile));
+ MemoryFile->Eof -= 1;
+
+ free (MemoryFile);
+
+ return EFI_SUCCESS;
+}
+
+
+CHAR8 *
+ReadMemoryFileLine (
+ IN EFI_HANDLE InputMemoryFile
+ )
+/*++
+
+Routine Description:
+
+ This function reads a line from the memory file. The newline characters
+ are stripped and a null terminated string is returned.
+
+ If the string pointer returned is non-NULL, then the caller must free the
+ memory associated with this string.
+
+Arguments:
+
+ InputMemoryFile Handle to memory file
+
+Returns:
+
+ NULL if error or EOF
+ NULL character termincated string otherwise (MUST BE FREED BY CALLER)
+
+--*/
+{
+ CHAR8 *EndOfLine;
+ UINTN CharsToCopy;
+ MEMORY_FILE *InputFile;
+ UINTN BytesToEof;
+ CHAR8 *OutputString;
+
+ //
+ // Verify input parameters are not null
+ //
+ CheckMemoryFileState (InputMemoryFile);
+
+ InputFile = (MEMORY_FILE*)InputMemoryFile;
+
+ //
+ // Check for end of file condition
+ //
+ if (InputFile->CurrentFilePointer >= InputFile->Eof) {
+ return NULL;
+ }
+
+ //
+ // Determine the number of bytes remaining until the EOF
+ //
+ BytesToEof = InputFile->Eof - InputFile->CurrentFilePointer;
+
+ //
+ // Find the next newline char
+ //
+ EndOfLine = memchr (InputFile->CurrentFilePointer, '\n', BytesToEof);
+
+ //
+ // Determine the number of characters to copy.
+ //
+ if (EndOfLine == 0) {
+ //
+ // If no newline found, copy to the end of the file.
+ //
+ CharsToCopy = InputFile->Eof - InputFile->CurrentFilePointer;
+ } else {
+ //
+ // Newline found in the file.
+ //
+ CharsToCopy = EndOfLine - InputFile->CurrentFilePointer;
+ }
+
+ OutputString = malloc (CharsToCopy + 1);
+ if (OutputString == NULL) {
+ return NULL;
+ }
+
+ //
+ // Copy the line.
+ //
+ memcpy (OutputString, InputFile->CurrentFilePointer, CharsToCopy);
+
+ //
+ // Add the null termination over the 0x0D
+ //
+ if (OutputString[CharsToCopy - 1] == '\r') {
+
+ OutputString[CharsToCopy - 1] = '\0';
+
+ } else {
+
+ OutputString[CharsToCopy] = '\0';
+
+ }
+
+ //
+ // Increment the current file pointer (include the 0x0A)
+ //
+ InputFile->CurrentFilePointer += CharsToCopy + 1;
+ if (InputFile->CurrentFilePointer > InputFile->Eof) {
+ InputFile->CurrentFilePointer = InputFile->Eof;
+ }
+ CheckMemoryFileState (InputMemoryFile);
+
+ //
+ // Return the string
+ //
+ return OutputString;
+}
+
+
+STATIC
+VOID
+CheckMemoryFileState (
+ IN EFI_HANDLE InputMemoryFile
+ )
+{
+ MEMORY_FILE *MemoryFile;
+
+ assert (InputMemoryFile != NULL);
+
+ MemoryFile = (MEMORY_FILE*)InputMemoryFile;
+
+ assert (MemoryFile->FileImage != NULL);
+ assert (MemoryFile->CurrentFilePointer != NULL);
+ assert (MemoryFile->Eof != NULL);
+ assert (MemoryFile->Eof >= MemoryFile->FileImage);
+ assert (MemoryFile->CurrentFilePointer >= MemoryFile->FileImage);
+ assert (MemoryFile->CurrentFilePointer <= MemoryFile->Eof);
+}
+
+
diff --git a/roms/edk2/BaseTools/Source/C/Common/MemoryFile.h b/roms/edk2/BaseTools/Source/C/Common/MemoryFile.h
new file mode 100644
index 000000000..58fc8bb22
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/MemoryFile.h
@@ -0,0 +1,105 @@
+/** @file
+Header file for helper functions useful for accessing files.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFI_MEMORY_FILE_H
+#define _EFI_MEMORY_FILE_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <Common/UefiBaseTypes.h>
+
+//
+// Common data structures
+//
+typedef struct {
+ CHAR8 *FileImage;
+ CHAR8 *Eof;
+ CHAR8 *CurrentFilePointer;
+} MEMORY_FILE;
+
+
+//
+// Functions declarations
+//
+
+EFI_STATUS
+GetMemoryFile (
+ IN CHAR8 *InputFileName,
+ OUT EFI_HANDLE *OutputMemoryFile
+ )
+;
+/**
+
+Routine Description:
+
+ This opens a file, reads it into memory and returns a memory file
+ object.
+
+Arguments:
+
+ InputFile Memory file image.
+ OutputMemoryFile Handle to memory file
+
+Returns:
+
+ EFI_STATUS
+ OutputMemoryFile is valid if !EFI_ERROR
+
+**/
+
+
+EFI_STATUS
+FreeMemoryFile (
+ IN EFI_HANDLE InputMemoryFile
+ )
+;
+/**
+
+Routine Description:
+
+ Frees all memory associated with the input memory file.
+
+Arguments:
+
+ InputMemoryFile Handle to memory file
+
+Returns:
+
+ EFI_STATUS
+
+**/
+
+
+CHAR8 *
+ReadMemoryFileLine (
+ IN EFI_HANDLE InputMemoryFile
+ )
+;
+/**
+
+Routine Description:
+
+ This function reads a line from the memory file. The newline characters
+ are stripped and a null terminated string is returned.
+
+ If the string pointer returned is non-NULL, then the caller must free the
+ memory associated with this string.
+
+Arguments:
+
+ InputMemoryFile Handle to memory file
+
+Returns:
+
+ NULL if error or EOF
+ NULL character termincated string otherwise (MUST BE FREED BY CALLER)
+
+**/
+
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Common/MyAlloc.c b/roms/edk2/BaseTools/Source/C/Common/MyAlloc.c
new file mode 100644
index 000000000..d104795d4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/MyAlloc.c
@@ -0,0 +1,548 @@
+/** @file
+File for memory allocation tracking functions.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "MyAlloc.h"
+
+#if USE_MYALLOC
+//
+// Get back to original alloc/free calls.
+//
+#undef malloc
+#undef calloc
+#undef realloc
+#undef free
+//
+// Start of allocation list.
+//
+STATIC MY_ALLOC_STRUCT *MyAllocData = NULL;
+
+//
+//
+//
+STATIC UINT32 MyAllocHeadMagik = MYALLOC_HEAD_MAGIK;
+STATIC UINT32 MyAllocTailMagik = MYALLOC_TAIL_MAGIK;
+
+//
+// ////////////////////////////////////////////////////////////////////////////
+//
+//
+VOID
+MyCheck (
+ BOOLEAN Final,
+ UINT8 File[],
+ UINTN Line
+ )
+// *++
+// Description:
+//
+// Check for corruptions in the allocated memory chain. If a corruption
+// is detection program operation stops w/ an exit(1) call.
+//
+// Parameters:
+//
+// Final := When FALSE, MyCheck() returns if the allocated memory chain
+// has not been corrupted. When TRUE, MyCheck() returns if there
+// are no un-freed allocations. If there are un-freed allocations,
+// they are displayed and exit(1) is called.
+//
+//
+// File := Set to __FILE__ by macro expansion.
+//
+// Line := Set to __LINE__ by macro expansion.
+//
+// Returns:
+//
+// n/a
+//
+// --*/
+//
+{
+ MY_ALLOC_STRUCT *Tmp;
+
+ //
+ // Check parameters.
+ //
+ if (File == NULL) {
+ printf (
+ "\nMyCheck(Final=%u, File=NULL, Line=%u)"
+ "Invalid parameter(s).\n",
+ Final,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+
+ if (Line == 0) {
+ printf (
+ "\nMyCheck(Final=%u, File=%s, Line=%u)"
+ "Invalid parameter(s).\n",
+ Final,
+ File,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+
+ if (strlen ((CHAR8 *)File) == 0) {
+ printf (
+ "\nMyCheck(Final=%u, File=%s, Line=%u)"
+ "Invalid parameter.\n",
+ Final,
+ File,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+ //
+ // Check structure contents.
+ //
+ for (Tmp = MyAllocData; Tmp != NULL; Tmp = Tmp->Next) {
+ if (memcmp(Tmp->Buffer, &MyAllocHeadMagik, sizeof MyAllocHeadMagik) ||
+ memcmp(&Tmp->Buffer[Tmp->Size + sizeof(UINT32)], &MyAllocTailMagik, sizeof MyAllocTailMagik)) {
+ break;
+ }
+ }
+ //
+ // If Tmp is not NULL, the structure is corrupt.
+ //
+ if (Tmp != NULL) {
+ printf (
+ "\nMyCheck(Final=%u, File=%s, Line=%u)""\nStructure corrupted!"
+ "\nFile=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",
+ Final,
+ File,
+ (unsigned)Line,
+ Tmp->File,
+ (unsigned) Tmp->Line,
+ (unsigned) Tmp->Size,
+ (unsigned) *(UINT32 *) (Tmp->Buffer),
+ (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
+ );
+
+ exit (1);
+ }
+ //
+ // If Final is TRUE, display the state of the structure chain.
+ //
+ if (Final) {
+ if (MyAllocData != NULL) {
+ printf (
+ "\nMyCheck(Final=%u, File=%s, Line=%u)"
+ "\nSome allocated items have not been freed.\n",
+ Final,
+ File,
+ (unsigned)Line
+ );
+
+ for (Tmp = MyAllocData; Tmp != NULL; Tmp = Tmp->Next) {
+ printf (
+ "File=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",
+ Tmp->File,
+ (unsigned) Tmp->Line,
+ (unsigned) Tmp->Size,
+ (unsigned) *(UINT32 *) (Tmp->Buffer),
+ (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
+ );
+ }
+ }
+ }
+}
+//
+// ////////////////////////////////////////////////////////////////////////////
+//
+//
+VOID *
+MyAlloc (
+ UINTN Size,
+ UINT8 File[],
+ UINTN Line
+ )
+// *++
+// Description:
+//
+// Allocate a new link in the allocation chain along with enough storage
+// for the File[] string, requested Size and alignment overhead. If
+// memory cannot be allocated or the allocation chain has been corrupted,
+// exit(1) will be called.
+//
+// Parameters:
+//
+// Size := Number of bytes (UINT8) requested by the called.
+// Size cannot be zero.
+//
+// File := Set to __FILE__ by macro expansion.
+//
+// Line := Set to __LINE__ by macro expansion.
+//
+// Returns:
+//
+// Pointer to the caller's buffer.
+//
+// --*/
+//
+{
+ MY_ALLOC_STRUCT *Tmp;
+ UINTN Len;
+
+ //
+ // Check for invalid parameters.
+ //
+ if (File == NULL) {
+ printf (
+ "\nMyAlloc(Size=%u, File=NULL, Line=%u)"
+ "\nInvalid parameter(s).\n",
+ (unsigned)Size,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+
+ if (Size == 0 || Line == 0) {
+ printf (
+ "\nMyAlloc(Size=%u, File=%s, Line=%u)"
+ "\nInvalid parameter(s).\n",
+ (unsigned)Size,
+ File,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+
+ Len = strlen ((CHAR8 *)File);
+ if (Len == 0) {
+ printf (
+ "\nMyAlloc(Size=%u, File=%s, Line=%u)"
+ "\nInvalid parameter.\n",
+ (unsigned)Size,
+ File,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+ //
+ // Check the allocation list for corruption.
+ //
+ MyCheck (0, (UINT8 *)__FILE__, __LINE__);
+
+ //
+ // Allocate a new entry.
+ //
+ Tmp = calloc (
+ 1,
+ sizeof (MY_ALLOC_STRUCT) + Len + 1 + sizeof (UINT64) + Size + (sizeof MyAllocHeadMagik) + (sizeof MyAllocTailMagik)
+ );
+
+ if (Tmp == NULL) {
+ printf (
+ "\nMyAlloc(Size=%u, File=%s, Line=%u)"
+ "\nOut of memory.\n",
+ (unsigned)Size,
+ File,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+ //
+ // Fill in the new entry.
+ //
+ Tmp->File = ((UINT8 *) Tmp) + sizeof (MY_ALLOC_STRUCT);
+ strcpy ((CHAR8 *)Tmp->File, (CHAR8 *)File);
+ Tmp->Line = Line;
+ Tmp->Size = Size;
+ Tmp->Buffer = (UINT8 *) (((UINTN) Tmp + Len + 9) &~7);
+
+ memcpy (Tmp->Buffer, &MyAllocHeadMagik, sizeof MyAllocHeadMagik);
+
+ memcpy (
+ &Tmp->Buffer[Size + sizeof (UINT32)],
+ &MyAllocTailMagik,
+ sizeof MyAllocTailMagik
+ );
+
+ Tmp->Next = MyAllocData;
+ Tmp->Cksum = (UINTN) Tmp + (UINTN) (Tmp->Next) + Tmp->Line + Tmp->Size + (UINTN) (Tmp->File) + (UINTN) (Tmp->Buffer);
+
+ MyAllocData = Tmp;
+
+ return Tmp->Buffer + sizeof (UINT32);
+}
+//
+// ////////////////////////////////////////////////////////////////////////////
+//
+//
+VOID *
+MyRealloc (
+ VOID *Ptr,
+ UINTN Size,
+ UINT8 File[],
+ UINTN Line
+ )
+// *++
+// Description:
+//
+// This does a MyAlloc(), memcpy() and MyFree(). There is no optimization
+// for shrinking or expanding buffers. An invalid parameter will cause
+// MyRealloc() to fail with a call to exit(1).
+//
+// Parameters:
+//
+// Ptr := Pointer to the caller's buffer to be re-allocated.
+//
+// Size := Size of new buffer. Size cannot be zero.
+//
+// File := Set to __FILE__ by macro expansion.
+//
+// Line := Set to __LINE__ by macro expansion.
+//
+// Returns:
+//
+// Pointer to new caller's buffer.
+//
+// --*/
+//
+{
+ MY_ALLOC_STRUCT *Tmp;
+ VOID *Buffer;
+
+ //
+ // Check for invalid parameter(s).
+ //
+ if (File == NULL) {
+ printf (
+ "\nMyRealloc(Ptr=%p, Size=%u, File=NULL, Line=%u)"
+ "\nInvalid parameter(s).\n",
+ Ptr,
+ (unsigned)Size,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+
+ if (Size == 0 || Line == 0) {
+ printf (
+ "\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
+ "\nInvalid parameter(s).\n",
+ Ptr,
+ (unsigned)Size,
+ File,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+
+ if (strlen ((CHAR8 *)File) == 0) {
+ printf (
+ "\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
+ "\nInvalid parameter.\n",
+ Ptr,
+ (unsigned)Size,
+ File,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+ //
+ // Find existing buffer in allocation list.
+ //
+ if (Ptr == NULL) {
+ Tmp = NULL;
+ } else if (&MyAllocData->Buffer[sizeof (UINT32)] == Ptr) {
+ Tmp = MyAllocData;
+ } else {
+ for (Tmp = MyAllocData;; Tmp = Tmp->Next) {
+ if (Tmp->Next == NULL) {
+ printf (
+ "\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
+ "\nCould not find buffer.\n",
+ Ptr,
+ (unsigned)Size,
+ File,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+
+ Tmp = Tmp->Next;
+ }
+ }
+ //
+ // Allocate new buffer, copy old data, free old buffer.
+ //
+ Buffer = MyAlloc (Size, File, Line);
+
+ if (Buffer != NULL && Tmp != NULL) {
+ memcpy (
+ Buffer,
+ &Tmp->Buffer[sizeof (UINT32)],
+ ((Size <= Tmp->Size) ? Size : Tmp->Size)
+ );
+
+ MyFree (Ptr, (UINT8 *)__FILE__, __LINE__);
+ }
+
+ return Buffer;
+}
+//
+// ////////////////////////////////////////////////////////////////////////////
+//
+//
+VOID
+MyFree (
+ VOID *Ptr,
+ UINT8 File[],
+ UINTN Line
+ )
+// *++
+// Description:
+//
+// Release a previously allocated buffer. Invalid parameters will cause
+// MyFree() to fail with an exit(1) call.
+//
+// Parameters:
+//
+// Ptr := Pointer to the caller's buffer to be freed.
+// A NULL pointer will be ignored.
+//
+// File := Set to __FILE__ by macro expansion.
+//
+// Line := Set to __LINE__ by macro expansion.
+//
+// Returns:
+//
+// n/a
+//
+// --*/
+//
+{
+ MY_ALLOC_STRUCT *Tmp;
+ MY_ALLOC_STRUCT *Tmp2;
+
+ //
+ // Check for invalid parameter(s).
+ //
+ if (File == NULL) {
+ printf (
+ "\nMyFree(Ptr=%p, File=NULL, Line=%u)"
+ "\nInvalid parameter(s).\n",
+ Ptr,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+
+ if (Line == 0) {
+ printf (
+ "\nMyFree(Ptr=%p, File=%s, Line=%u)"
+ "\nInvalid parameter(s).\n",
+ Ptr,
+ File,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+
+ if (strlen ((CHAR8 *)File) == 0) {
+ printf (
+ "\nMyFree(Ptr=%p, File=%s, Line=%u)"
+ "\nInvalid parameter.\n",
+ Ptr,
+ File,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+ //
+ // Freeing NULL is always valid.
+ //
+ if (Ptr == NULL) {
+ return ;
+ }
+ //
+ // Fail if nothing is allocated.
+ //
+ if (MyAllocData == NULL) {
+ printf (
+ "\nMyFree(Ptr=%p, File=%s, Line=%u)"
+ "\nCalled before memory allocated.\n",
+ Ptr,
+ File,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+ //
+ // Check for corrupted allocation list.
+ //
+ MyCheck (0, (UINT8 *)__FILE__, __LINE__);
+
+ //
+ // Need special check for first item in list.
+ //
+ if (&MyAllocData->Buffer[sizeof (UINT32)] == Ptr) {
+ //
+ // Unlink first item in list.
+ //
+ Tmp = MyAllocData;
+ MyAllocData = MyAllocData->Next;
+ } else {
+ //
+ // Walk list looking for matching item.
+ //
+ for (Tmp = MyAllocData;; Tmp = Tmp->Next) {
+ //
+ // Fail if end of list is reached.
+ //
+ if (Tmp->Next == NULL) {
+ printf (
+ "\nMyFree(Ptr=%p, File=%s, Line=%u)\n"
+ "\nNot found.\n",
+ Ptr,
+ File,
+ (unsigned)Line
+ );
+
+ exit (1);
+ }
+ //
+ // Leave loop when match is found.
+ //
+ if (&Tmp->Next->Buffer[sizeof (UINT32)] == Ptr) {
+ break;
+ }
+ }
+ //
+ // Unlink item from list.
+ //
+ Tmp2 = Tmp->Next;
+ Tmp->Next = Tmp->Next->Next;
+ Tmp = Tmp2;
+ }
+ //
+ // Release item.
+ //
+ free (Tmp);
+}
+
+#endif /* USE_MYALLOC */
+
+/* eof - MyAlloc.c */
diff --git a/roms/edk2/BaseTools/Source/C/Common/MyAlloc.h b/roms/edk2/BaseTools/Source/C/Common/MyAlloc.h
new file mode 100644
index 000000000..aff29d05a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/MyAlloc.h
@@ -0,0 +1,209 @@
+/** @file
+Header file for memory allocation tracking functions.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _MYALLOC_H_
+#define _MYALLOC_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <Common/BaseTypes.h>
+
+//
+// Default operation is to use the memory allocation tracking functions.
+// To over-ride add "#define USE_MYALLOC 0" to your program header and/or
+// source files as needed. Or, just do not include this header file in
+// your project.
+//
+#ifndef USE_MYALLOC
+#define USE_MYALLOC 1
+#endif
+
+#if USE_MYALLOC
+//
+// Replace C library allocation routines with MyAlloc routines.
+//
+#define malloc(size) MyAlloc ((size), __FILE__, __LINE__)
+#define calloc(count, size) MyAlloc ((count) * (size), __FILE__, __LINE__)
+#define realloc(ptr, size) MyRealloc ((ptr), (size), __FILE__, __LINE__)
+#define free(ptr) MyFree ((ptr), __FILE__, __LINE__)
+#define alloc_check(final) MyCheck ((final), __FILE__, __LINE__)
+
+//
+// Structure for checking/tracking memory allocations.
+//
+typedef struct MyAllocStruct {
+ UINTN Cksum;
+ struct MyAllocStruct *Next;
+ UINTN Line;
+ UINTN Size;
+ UINT8 *File;
+ UINT8 *Buffer;
+} MY_ALLOC_STRUCT;
+//
+// Cksum := (UINTN)This + (UINTN)Next + Line + Size + (UINTN)File +
+// (UINTN)Buffer;
+//
+// Next := Pointer to next allocation structure in the list.
+//
+// Line := __LINE__
+//
+// Size := Size of allocation request.
+//
+// File := Pointer to __FILE__ string stored immediately following
+// MY_ALLOC_STRUCT in memory.
+//
+// Buffer := Pointer to UINT32 aligned storage immediately following
+// the NULL terminated __FILE__ string. This is UINT32
+// aligned because the underflow signature is 32-bits and
+// this will place the first caller address on a 64-bit
+// boundary.
+//
+//
+// Signatures used to check for buffer overflow/underflow conditions.
+//
+#define MYALLOC_HEAD_MAGIK 0xBADFACED
+#define MYALLOC_TAIL_MAGIK 0xDEADBEEF
+
+VOID
+MyCheck (
+ BOOLEAN Final,
+ UINT8 File[],
+ UINTN Line
+ )
+;
+//
+// *++
+// Description:
+//
+// Check for corruptions in the allocated memory chain. If a corruption
+// is detection program operation stops w/ an exit(1) call.
+//
+// Parameters:
+//
+// Final := When FALSE, MyCheck() returns if the allocated memory chain
+// has not been corrupted. When TRUE, MyCheck() returns if there
+// are no un-freed allocations. If there are un-freed allocations,
+// they are displayed and exit(1) is called.
+//
+//
+// File := Set to __FILE__ by macro expansion.
+//
+// Line := Set to __LINE__ by macro expansion.
+//
+// Returns:
+//
+// n/a
+//
+// --*/
+//
+VOID *
+MyAlloc (
+ UINTN Size,
+ UINT8 File[],
+ UINTN Line
+ )
+;
+//
+// *++
+// Description:
+//
+// Allocate a new link in the allocation chain along with enough storage
+// for the File[] string, requested Size and alignment overhead. If
+// memory cannot be allocated or the allocation chain has been corrupted,
+// exit(1) will be called.
+//
+// Parameters:
+//
+// Size := Number of bytes (UINT8) requested by the called.
+// Size cannot be zero.
+//
+// File := Set to __FILE__ by macro expansion.
+//
+// Line := Set to __LINE__ by macro expansion.
+//
+// Returns:
+//
+// Pointer to the caller's buffer.
+//
+// --*/
+//
+VOID *
+MyRealloc (
+ VOID *Ptr,
+ UINTN Size,
+ UINT8 File[],
+ UINTN Line
+ )
+;
+//
+// *++
+// Description:
+//
+// This does a MyAlloc(), memcpy() and MyFree(). There is no optimization
+// for shrinking or expanding buffers. An invalid parameter will cause
+// MyRealloc() to fail with a call to exit(1).
+//
+// Parameters:
+//
+// Ptr := Pointer to the caller's buffer to be re-allocated.
+// Ptr cannot be NULL.
+//
+// Size := Size of new buffer. Size cannot be zero.
+//
+// File := Set to __FILE__ by macro expansion.
+//
+// Line := Set to __LINE__ by macro expansion.
+//
+// Returns:
+//
+// Pointer to new caller's buffer.
+//
+// --*/
+//
+VOID
+MyFree (
+ VOID *Ptr,
+ UINT8 File[],
+ UINTN Line
+ )
+;
+//
+// *++
+// Description:
+//
+// Release a previously allocated buffer. Invalid parameters will cause
+// MyFree() to fail with an exit(1) call.
+//
+// Parameters:
+//
+// Ptr := Pointer to the caller's buffer to be freed.
+// A NULL pointer will be ignored.
+//
+// File := Set to __FILE__ by macro expansion.
+//
+// Line := Set to __LINE__ by macro expansion.
+//
+// Returns:
+//
+// n/a
+//
+// --*/
+//
+#else /* USE_MYALLOC */
+
+//
+// Nothing to do when USE_MYALLOC is zero.
+//
+#define alloc_check(final)
+
+#endif /* USE_MYALLOC */
+#endif /* _MYALLOC_H_ */
+
+/* eof - MyAlloc.h */
diff --git a/roms/edk2/BaseTools/Source/C/Common/OsPath.c b/roms/edk2/BaseTools/Source/C/Common/OsPath.c
new file mode 100644
index 000000000..35ca54761
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/OsPath.c
@@ -0,0 +1,295 @@
+/** @file
+Functions useful to operate file directories by parsing file path.
+
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "CommonLib.h"
+#include "OsPath.h"
+
+//
+// Functions implementations
+//
+
+#if 0
+ //
+ // BUGBUG: Not fully implemented yet.
+ //
+CHAR8*
+OsPathDirName (
+ IN CHAR8 *FilePath
+ )
+/*++
+
+Routine Description:
+
+ This function returns the directory path which contains the particular path.
+ Some examples:
+ "a/b/c" -> "a/b"
+ "a/b/c/" -> "a/b"
+ "a" -> "."
+ "." -> ".."
+ "/" -> NULL
+
+ This function does not check for the existence of the file.
+
+ The caller must free the string returned.
+
+Arguments:
+
+ FilePath Path name of file to get the parent directory for.
+
+Returns:
+
+ NULL if error
+
+--*/
+{
+ CHAR8 *Return;
+ CHAR8 *Pos;
+ CHAR8 Char;
+ UINTN Length;
+ INTN Offset;
+
+ Length = strlen (FilePath);
+
+ if (Length == 0) {
+ return NULL;
+ }
+
+ //
+ // Check for the root directory case
+ //
+ if (
+ (Length == 3 && isalpha (FilePath[0]) && (strcmp(FilePath + 1, ":\\") == 0)) ||
+ (strcmp(FilePath, "/") == 0)
+ ) {
+ return NULL;
+ }
+
+ //
+ // If the path ends with a path separator, then just append ".."
+ //
+ Char = FilePath[Length - 1];
+ if (Char == '/' || Char == '\\') {
+ return OsPathJoin (FilePath, "..");
+ }
+
+ //
+ //
+ //
+ for (Offset = Length; Offset > 0; Offset--) {
+ if ((Return[Offset] == '/') || (Return[Offset] == '\\')) {
+ Return[Offset] = '\0';
+ return Return;
+ }
+ }
+}
+#endif
+
+
+#if 0
+ //
+ // BUGBUG: Not fully implemented yet.
+ //
+VOID
+OsPathNormPathInPlace (
+ IN CHAR8 *Path
+ )
+/*++
+
+Routine Description:
+
+ This function returns the directory path which contains the particular path.
+ Some examples:
+ "a/b/../c" -> "a/c"
+ "a/b//c" -> "a/b/c"
+ "a/./b" -> "a/b"
+
+ This function does not check for the existence of the file.
+
+Arguments:
+
+ Path Path name of file to normalize
+
+Returns:
+
+ The string is altered in place.
+
+--*/
+{
+ CHAR8 *Pos;
+ INTN Offset;
+ BOOLEAN TryAgain;
+ UINTN Length;
+ UINTN Remaining;
+ UINTN SubLength;
+
+ do {
+ TryAgain = FALSE;
+ Length = strlen (Path);
+
+ for (Offset = 0; Offset < Length; Offset++) {
+ Remaining = Length - Offset;
+
+ //
+ // Collapse '//' -> '/'
+ //
+ if (
+ (Remaining >= 2) &&
+ ((Offset > 0) || (Path[0] != '\\')) &&
+ IsDirSep (Path[Offset]) && IsDirSep (Path[Offset + 1])
+ ) {
+ memmove (&Path[Offset], &Path[Offset + 1], Remaining);
+ TryAgain = TRUE;
+ break;
+ }
+
+ //
+ // Collapse '/./' -> '/'
+ //
+ if ((Remaining >= 3) && IsDirSep (Path[Offset]) &&
+ (Path[Offset + 1] == '.') && IsDirSep (Path[Offset + 2])
+ ) {
+ memmove (&Path[Offset], &Path[Offset + 1], Remaining);
+ TryAgain = TRUE;
+ break;
+ }
+
+ //
+ // Collapse 'a/../b' -> 'b'
+ //
+ // BUGBUG: Not implemented yet
+
+ }
+
+ } while (TryAgain);
+
+ Return = CloneString (FilePath);
+ if (Return == NULL) {
+ return NULL;
+ }
+
+ Length = strlen (Return);
+
+ //
+ // Check for the root directory case
+ //
+ if (
+ (Length == 3 && isalpha (Return[0]) && (strcmp(Return + 1, ":\\") == 0)) ||
+ (strcmp(Return, "/") == 0)
+ ) {
+ free (Return);
+ return NULL;
+ }
+
+ //
+ //
+ //
+ for (Offset = Length; Offset > 0; Offset--) {
+ if ((Return[Offset] == '/') || (Return[Offset] == '\\')) {
+ Return[Offset] = '\0';
+ return Return;
+ }
+ }
+}
+#endif
+
+
+CHAR8*
+OsPathPeerFilePath (
+ IN CHAR8 *OldPath,
+ IN CHAR8 *Peer
+ )
+/*++
+
+Routine Description:
+
+ This function replaces the final portion of a path with an alternative
+ 'peer' filename. For example:
+ "a/b/../c", "peer" -> "a/b/../peer"
+ "a/b/", "peer" -> "a/b/peer"
+ "/a", "peer" -> "/peer"
+ "a", "peer" -> "peer"
+
+ This function does not check for the existence of the file.
+
+Arguments:
+
+ OldPath Path name of replace the final segment
+ Peer The new path name to concatenate to become the peer path
+
+Returns:
+
+ A CHAR8* string, which must be freed by the caller
+
+--*/
+{
+ CHAR8 *Result;
+ INTN Offset;
+
+ Result = (CHAR8 *) malloc (strlen (OldPath) + strlen (Peer) + 1);
+ if (Result == NULL) {
+ return NULL;
+ }
+
+ strcpy (Result, OldPath);
+
+ //
+ // Search for the last '/' or '\' in the string. If found, replace
+ // everything following it with Peer
+ //
+ for (Offset = strlen (Result); Offset >= 0; Offset--) {
+ if ((Result[Offset] == '/') || (Result[Offset] == '\\')) {
+ Result[Offset + 1] = '\0';
+ strcat (Result, Peer);
+ return Result;
+ }
+ }
+
+ //
+ // Neither a '/' nor a '\' was found. Therefore, we simply return Peer.
+ //
+ strcpy (Result, Peer);
+ return Result;
+}
+
+
+BOOLEAN
+OsPathExists (
+ IN CHAR8 *InputFileName
+ )
+/*++
+
+Routine Description:
+
+ Checks if a file exists
+
+Arguments:
+
+ InputFileName The name of the file to check for existence
+
+Returns:
+
+ TRUE The file exists
+ FALSE The file does not exist
+
+--*/
+{
+ FILE *InputFile;
+ InputFile = fopen (LongFilePath (InputFileName), "rb");
+ if (InputFile == NULL) {
+ return FALSE;
+ } else {
+ fclose (InputFile);
+ return TRUE;
+ }
+}
+
+
+
diff --git a/roms/edk2/BaseTools/Source/C/Common/OsPath.h b/roms/edk2/BaseTools/Source/C/Common/OsPath.h
new file mode 100644
index 000000000..1868103e7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/OsPath.h
@@ -0,0 +1,133 @@
+/** @file
+Header file for helper functions useful to operate file directories by parsing
+file path.
+
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFI_OS_PATH_H
+#define _EFI_OS_PATH_H
+
+#include <Common/UefiBaseTypes.h>
+
+//
+// Functions declarations
+//
+
+CHAR8*
+OsPathDirName (
+ IN CHAR8 *FilePath
+ )
+;
+/**
+
+Routine Description:
+
+ This function returns the directory path which contains the particular path.
+ Some examples:
+ "a/b/c" -> "a/b"
+ "a/b/c/" -> "a/b"
+ "a" -> "."
+ "." -> ".."
+ "/" -> NULL
+
+ This function does not check for the existence of the file.
+
+ The caller must free the string returned.
+
+Arguments:
+
+ FilePath Path name of file to get the parent directory for.
+
+Returns:
+
+ NULL if error
+
+**/
+
+
+VOID
+OsPathNormPathInPlace (
+ IN CHAR8 *Path
+ )
+;
+/**
+
+Routine Description:
+
+ This function returns the directory path which contains the particular path.
+ Some examples:
+ "a/b/../c" -> "a/c"
+ "a/b//c" -> "a/b/c"
+ "a/./b" -> "a/b"
+
+ This function does not check for the existence of the file.
+
+Arguments:
+
+ Path Path name of file to normalize
+
+Returns:
+
+ The string is altered in place.
+
+**/
+
+
+CHAR8*
+OsPathPeerFilePath (
+ IN CHAR8 *OldPath,
+ IN CHAR8 *Peer
+ )
+;
+/**
+
+Routine Description:
+
+ This function replaces the final portion of a path with an alternative
+ 'peer' filename. For example:
+ "a/b/../c", "peer" -> "a/b/../peer"
+ "a/b/", "peer" -> "a/b/peer"
+ "/a", "peer" -> "/peer"
+ "a", "peer" -> "peer"
+
+ This function does not check for the existence of the file.
+
+Arguments:
+
+ OldPath Path name of replace the final segment
+ Peer The new path name to concatenate to become the peer path
+
+Returns:
+
+ A CHAR8* string, which must be freed by the caller
+
+**/
+
+
+BOOLEAN
+OsPathExists (
+ IN CHAR8 *InputFileName
+ )
+;
+/**
+
+Routine Description:
+
+ Checks if a file exists
+
+Arguments:
+
+ InputFileName The name of the file to check for existence
+
+Returns:
+
+ TRUE The file exists
+ FALSE The file does not exist
+
+**/
+
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Common/ParseGuidedSectionTools.c b/roms/edk2/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
new file mode 100644
index 000000000..a34581ecb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
@@ -0,0 +1,205 @@
+/** @file
+Helper functions for parsing GuidedSectionTools.txt
+
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include "MemoryFile.h"
+#include "CommonLib.h"
+#include "EfiUtilityMsgs.h"
+#include "ParseInf.h"
+#include "ParseGuidedSectionTools.h"
+#include "StringFuncs.h"
+
+
+//
+// Local types / structures
+//
+
+typedef struct _GUID_SEC_TOOL_ENTRY {
+ EFI_GUID Guid;
+ CHAR8* Name;
+ CHAR8* Path;
+ struct _GUID_SEC_TOOL_ENTRY *Next;
+} GUID_SEC_TOOL_ENTRY;
+
+//
+// Function Implementation
+//
+
+EFI_HANDLE
+ParseGuidedSectionToolsFile (
+ IN CHAR8 *InputFile
+ )
+/*++
+
+Routine Description:
+
+ This function parses the tools_def.txt file. It returns a
+ EFI_HANDLE object which can be used for the other library
+ functions and should be passed to FreeParsedGuidedSectionToolsHandle
+ to free resources when the tools_def.txt information is no
+ longer needed.
+
+Arguments:
+
+ InputFile Path name of file to read
+
+Returns:
+
+ NULL if error parsing
+ A non-NULL EFI_HANDLE otherwise
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE MemoryFile;
+ EFI_HANDLE ParsedGuidedSectionTools;
+
+ Status = GetMemoryFile (InputFile, &MemoryFile);
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+
+ ParsedGuidedSectionTools = ParseGuidedSectionToolsMemoryFile (MemoryFile);
+
+ FreeMemoryFile (MemoryFile);
+
+ return ParsedGuidedSectionTools;
+}
+
+
+EFI_HANDLE
+ParseGuidedSectionToolsMemoryFile (
+ IN EFI_HANDLE InputFile
+ )
+/*++
+
+Routine Description:
+
+ This function parses the tools_def.txt file. It returns a
+ EFI_HANDLE object which can be used for the other library
+ functions and should be passed to FreeParsedGuidedSectionToolsHandle
+ to free resources when the tools_def.txt information is no
+ longer needed.
+
+Arguments:
+
+ InputFile Memory file image.
+
+Returns:
+
+ NULL if error or EOF
+ InputBuffer otherwise
+
+--*/
+{
+ EFI_STATUS Status;
+ CHAR8 *NextLine;
+ STRING_LIST *Tool;
+ EFI_GUID Guid;
+ GUID_SEC_TOOL_ENTRY *FirstGuidTool;
+ GUID_SEC_TOOL_ENTRY *LastGuidTool;
+ GUID_SEC_TOOL_ENTRY *NewGuidTool;
+
+ FirstGuidTool = NULL;
+ LastGuidTool = NULL;
+
+ while (TRUE) {
+ NextLine = ReadMemoryFileLine (InputFile);
+ if (NextLine == NULL) {
+ break;
+ }
+
+ Status = StripInfDscStringInPlace (NextLine);
+ if (EFI_ERROR (Status)) {
+ free (NextLine);
+ break;
+ }
+
+ if (NextLine[0] == '\0') {
+ free (NextLine);
+ continue;
+ }
+
+ Tool = SplitStringByWhitespace (NextLine);
+ if ((Tool != NULL) &&
+ (Tool->Count == 3)
+ ) {
+ Status = StringToGuid (Tool->Strings[0], &Guid);
+ if (!EFI_ERROR (Status)) {
+ NewGuidTool = malloc (sizeof (GUID_SEC_TOOL_ENTRY));
+ if (NewGuidTool != NULL) {
+ memcpy (&(NewGuidTool->Guid), &Guid, sizeof (Guid));
+ NewGuidTool->Name = CloneString(Tool->Strings[1]);
+ NewGuidTool->Path = CloneString(Tool->Strings[2]);
+ NewGuidTool->Next = NULL;
+
+ if (FirstGuidTool == NULL) {
+ FirstGuidTool = NewGuidTool;
+ } else {
+ LastGuidTool->Next = NewGuidTool;
+ }
+ LastGuidTool = NewGuidTool;
+ }
+ }
+ }
+
+ if (Tool != NULL) {
+ FreeStringList (Tool);
+ }
+ free (NextLine);
+ }
+
+ return FirstGuidTool;
+}
+
+
+CHAR8*
+LookupGuidedSectionToolPath (
+ IN EFI_HANDLE ParsedGuidedSectionToolsHandle,
+ IN EFI_GUID *SectionGuid
+ )
+/*++
+
+Routine Description:
+
+ This function looks up the appropriate tool to use for extracting
+ a GUID defined FV section.
+
+Arguments:
+
+ ParsedGuidedSectionToolsHandle A parsed GUID section tools handle.
+ SectionGuid The GUID for the section.
+
+Returns:
+
+ NULL - if no tool is found or there is another error
+ Non-NULL - The tool to use to access the section contents. (The caller
+ must free the memory associated with this string.)
+
+--*/
+{
+ GUID_SEC_TOOL_ENTRY *GuidTool;
+
+ GuidTool = (GUID_SEC_TOOL_ENTRY*)ParsedGuidedSectionToolsHandle;
+ if (GuidTool == NULL) {
+ return NULL;
+ }
+
+ for ( ; GuidTool != NULL; GuidTool = GuidTool->Next) {
+ if (CompareGuid (&(GuidTool->Guid), SectionGuid) == 0) {
+ return CloneString (GuidTool->Path);
+ }
+ }
+
+ return NULL;
+}
+
+
diff --git a/roms/edk2/BaseTools/Source/C/Common/ParseGuidedSectionTools.h b/roms/edk2/BaseTools/Source/C/Common/ParseGuidedSectionTools.h
new file mode 100644
index 000000000..2714b8ce8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/ParseGuidedSectionTools.h
@@ -0,0 +1,120 @@
+/** @file
+Header file for helper functions for parsing GuidedSectionTools.txt
+
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFI_PARSE_GUIDED_SECTION_TOOLS_H
+#define _EFI_PARSE_GUIDED_SECTION_TOOLS_H
+
+#include <Common/UefiBaseTypes.h>
+
+//
+// Functions declarations
+//
+
+EFI_HANDLE
+ParseGuidedSectionToolsFile (
+ IN CHAR8 *InputFile
+ )
+;
+/**
+
+Routine Description:
+
+ This function parses the tools_def.txt file. It returns a
+ EFI_HANDLE object which can be used for the other library
+ functions and should be passed to FreeParsedToolsDefHandle
+ to free resources when the tools_def.txt information is no
+ longer needed.
+
+Arguments:
+
+ InputFile Path name of file to read
+
+Returns:
+
+ NULL if error parsing
+ A non-NULL EFI_HANDLE otherwise
+
+**/
+
+
+EFI_HANDLE
+ParseGuidedSectionToolsMemoryFile (
+ IN EFI_HANDLE InputFile
+ )
+;
+/**
+
+Routine Description:
+
+ This function parses the tools_def.txt file. It returns a
+ EFI_HANDLE object which can be used for the other library
+ functions and should be passed to FreeParsedToolsDefHandle
+ to free resources when the tools_def.txt information is no
+ longer needed.
+
+Arguments:
+
+ InputFile Memory file image.
+
+Returns:
+
+ NULL if error parsing
+ A non-NULL EFI_HANDLE otherwise
+
+**/
+
+CHAR8*
+LookupGuidedSectionToolPath (
+ IN EFI_HANDLE ParsedGuidedSectionToolsHandle,
+ IN EFI_GUID *SectionGuid
+ )
+;
+/**
+
+Routine Description:
+
+ This function looks up the appropriate tool to use for extracting
+ a GUID defined FV section.
+
+Arguments:
+
+ ParsedGuidedSectionToolsHandle A parsed GUID section tools handle.
+ SectionGuid The GUID for the section.
+
+Returns:
+
+ NULL - if no tool is found or there is another error
+ Non-NULL - The tool to use to access the section contents. (The caller
+ must free the memory associated with this string.)
+
+**/
+
+EFI_STATUS
+FreeParsedGuidedSectionToolsHandle (
+ IN EFI_HANDLE ParsedGuidedSectionToolsHandle
+ )
+;
+/**
+
+Routine Description:
+
+ Frees resources that were allocated by ParseGuidedSectionToolsFile.
+ After freeing these resources, the information that was parsed
+ is no longer accessible.
+
+Arguments:
+
+ ParsedToolDefHandle Handle returned from ParseGuidedSectionToolsFile
+
+Returns:
+
+ EFI_STATUS
+
+**/
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Common/ParseInf.c b/roms/edk2/BaseTools/Source/C/Common/ParseInf.c
new file mode 100644
index 000000000..5ef8f1306
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/ParseInf.c
@@ -0,0 +1,695 @@
+/** @file
+This contains some useful functions for parsing INF files.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include "EfiUtilityMsgs.h"
+#include "ParseInf.h"
+#include "CommonLib.h"
+
+CHAR8 *
+ReadLine (
+ IN MEMORY_FILE *InputFile,
+ IN OUT CHAR8 *InputBuffer,
+ IN UINTN MaxLength
+ )
+/*++
+
+Routine Description:
+
+ This function reads a line, stripping any comments.
+ The function reads a string from the input stream argument and stores it in
+ the input string. ReadLine reads characters from the current file position
+ to and including the first newline character, to the end of the stream, or
+ until the number of characters read is equal to MaxLength - 1, whichever
+ comes first. The newline character, if read, is replaced with a \0.
+
+Arguments:
+
+ InputFile Memory file image.
+ InputBuffer Buffer to read into, must be MaxLength size.
+ MaxLength The maximum size of the input buffer.
+
+Returns:
+
+ NULL if error or EOF
+ InputBuffer otherwise
+
+--*/
+{
+ CHAR8 *CharPtr;
+ CHAR8 *EndOfLine;
+ UINTN CharsToCopy;
+
+ //
+ // Verify input parameters are not null
+ //
+ assert (InputBuffer);
+ assert (InputFile->FileImage);
+ assert (InputFile->Eof);
+ assert (InputFile->CurrentFilePointer);
+
+ //
+ // Check for end of file condition
+ //
+ if (InputFile->CurrentFilePointer >= InputFile->Eof) {
+ return NULL;
+ }
+ //
+ // Find the next newline char
+ //
+ EndOfLine = strchr (InputFile->CurrentFilePointer, '\n');
+
+ //
+ // Determine the number of characters to copy.
+ //
+ if (EndOfLine == 0) {
+ //
+ // If no newline found, copy to the end of the file.
+ //
+ CharsToCopy = InputFile->Eof - InputFile->CurrentFilePointer;
+ } else if (EndOfLine >= InputFile->Eof) {
+ //
+ // If the newline found was beyond the end of file, copy to the eof.
+ //
+ CharsToCopy = InputFile->Eof - InputFile->CurrentFilePointer;
+ } else {
+ //
+ // Newline found in the file.
+ //
+ CharsToCopy = EndOfLine - InputFile->CurrentFilePointer;
+ }
+ //
+ // If the end of line is too big for the current buffer, set it to the max
+ // size of the buffer (leaving room for the \0.
+ //
+ if (CharsToCopy > MaxLength - 1) {
+ CharsToCopy = MaxLength - 1;
+ }
+ //
+ // Copy the line.
+ //
+ memcpy (InputBuffer, InputFile->CurrentFilePointer, CharsToCopy);
+
+ //
+ // Add the null termination over the 0x0D
+ //
+ if (InputBuffer[CharsToCopy - 1] == '\r') {
+
+ InputBuffer[CharsToCopy - 1] = '\0';
+
+ } else {
+
+ InputBuffer[CharsToCopy] = '\0';
+
+ }
+
+ //
+ // Increment the current file pointer (include the 0x0A)
+ //
+ InputFile->CurrentFilePointer += CharsToCopy + 1;
+
+ //
+ // Strip any comments
+ //
+ CharPtr = strstr (InputBuffer, "//");
+ if (CharPtr != 0) {
+ CharPtr[0] = 0;
+ }
+ //
+ // Return the string
+ //
+ return InputBuffer;
+}
+
+BOOLEAN
+FindSection (
+ IN MEMORY_FILE *InputFile,
+ IN CHAR8 *Section
+ )
+/*++
+
+Routine Description:
+
+ This function parses a file from the beginning to find a section.
+ The section string may be anywhere within a line.
+
+Arguments:
+
+ InputFile Memory file image.
+ Section Section to search for
+
+Returns:
+
+ FALSE if error or EOF
+ TRUE if section found
+
+--*/
+{
+ CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
+ CHAR8 *CurrentToken;
+
+ //
+ // Verify input is not NULL
+ //
+ assert (InputFile->FileImage);
+ assert (InputFile->Eof);
+ assert (InputFile->CurrentFilePointer);
+ assert (Section);
+
+ //
+ // Rewind to beginning of file
+ //
+ InputFile->CurrentFilePointer = InputFile->FileImage;
+
+ //
+ // Read lines until the section is found
+ //
+ while (InputFile->CurrentFilePointer < InputFile->Eof) {
+ //
+ // Read a line
+ //
+ ReadLine (InputFile, InputBuffer, MAX_LONG_FILE_PATH);
+
+ //
+ // Check if the section is found
+ //
+ CurrentToken = strstr (InputBuffer, Section);
+ if (CurrentToken != NULL) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+EFI_STATUS
+FindToken (
+ IN MEMORY_FILE *InputFile,
+ IN CHAR8 *Section,
+ IN CHAR8 *Token,
+ IN UINTN Instance,
+ OUT CHAR8 *Value
+ )
+/*++
+
+Routine Description:
+
+ Finds a token value given the section and token to search for.
+
+Arguments:
+
+ InputFile Memory file image.
+ Section The section to search for, a string within [].
+ Token The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
+ Instance The instance of the token to search for. Zero is the first instance.
+ Value The string that holds the value following the =. Must be MAX_LONG_FILE_PATH in size.
+
+Returns:
+
+ EFI_SUCCESS Value found.
+ EFI_ABORTED Format error detected in INF file.
+ EFI_INVALID_PARAMETER Input argument was null.
+ EFI_LOAD_ERROR Error reading from the file.
+ EFI_NOT_FOUND Section/Token/Value not found.
+
+--*/
+{
+ CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
+ CHAR8 *CurrentToken;
+ CHAR8 *Delimiter;
+ BOOLEAN ParseError;
+ BOOLEAN ReadError;
+ UINTN Occurrence;
+
+ //
+ // Check input parameters
+ //
+ if (InputFile->FileImage == NULL ||
+ InputFile->Eof == NULL ||
+ InputFile->CurrentFilePointer == NULL ||
+ Section == NULL ||
+ strlen (Section) == 0 ||
+ Token == NULL ||
+ strlen (Token) == 0 ||
+ Value == NULL
+ ) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Initialize error codes
+ //
+ ParseError = FALSE;
+ ReadError = FALSE;
+
+ //
+ // Initialize our instance counter for the search token
+ //
+ Occurrence = 0;
+
+ if (FindSection (InputFile, Section)) {
+ //
+ // Found the desired section, find and read the desired token
+ //
+ do {
+ //
+ // Read a line from the file
+ //
+ if (ReadLine (InputFile, InputBuffer, MAX_LONG_FILE_PATH) == NULL) {
+ //
+ // Error reading from input file
+ //
+ ReadError = TRUE;
+ break;
+ }
+ //
+ // Get the first non-whitespace string
+ //
+ Delimiter = strchr (InputBuffer, '=');
+ if (Delimiter != NULL) {
+ *Delimiter = 0;
+ }
+
+ CurrentToken = strtok (InputBuffer, " \t\n");
+ if (CurrentToken == NULL || Delimiter == NULL) {
+ //
+ // Whitespace line found (or comment) so continue
+ //
+ CurrentToken = InputBuffer;
+ continue;
+ }
+ //
+ // Make sure we have not reached the end of the current section
+ //
+ if (CurrentToken[0] == '[') {
+ break;
+ }
+ //
+ // Compare the current token with the desired token
+ //
+ if (strcmp (CurrentToken, Token) == 0) {
+ //
+ // Found it
+ //
+ //
+ // Check if it is the correct instance
+ //
+ if (Instance == Occurrence) {
+ //
+ // Copy the contents following the =
+ //
+ CurrentToken = Delimiter + 1;
+ if (*CurrentToken == 0) {
+ //
+ // Nothing found, parsing error
+ //
+ ParseError = TRUE;
+ } else {
+ //
+ // Strip leading white space
+ //
+ while (*CurrentToken == ' ' || *CurrentToken == '\t') {
+ CurrentToken++;
+ }
+ //
+ // Copy the current token to the output value
+ //
+ strcpy (Value, CurrentToken);
+ //
+ // Strip trailing white space
+ //
+ while (strlen(Value) > 0 && (*(Value + strlen(Value) - 1) == ' ' || *(Value + strlen(Value) - 1) == '\t')) {
+ *(Value + strlen(Value) - 1) = 0;
+ }
+ return EFI_SUCCESS;
+ }
+ } else {
+ //
+ // Increment the occurrence found
+ //
+ Occurrence++;
+ }
+ }
+ } while (
+ !ParseError &&
+ !ReadError &&
+ InputFile->CurrentFilePointer < InputFile->Eof &&
+ CurrentToken[0] != '[' &&
+ Occurrence <= Instance
+ );
+ }
+ //
+ // Distinguish between read errors and INF file format errors.
+ //
+ if (ReadError) {
+ return EFI_LOAD_ERROR;
+ }
+
+ if (ParseError) {
+ return EFI_ABORTED;
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+EFI_STATUS
+StringToGuid (
+ IN CHAR8 *AsciiGuidBuffer,
+ OUT EFI_GUID *GuidBuffer
+ )
+/*++
+
+Routine Description:
+
+ Converts a string to an EFI_GUID. The string must be in the
+ xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
+
+Arguments:
+
+ AsciiGuidBuffer - pointer to ascii string
+ GuidBuffer - pointer to destination Guid
+
+Returns:
+
+ EFI_ABORTED Could not convert the string
+ EFI_SUCCESS The string was successfully converted
+ EFI_INVALID_PARAMETER Input parameter is invalid.
+
+--*/
+{
+ INT32 Index;
+ int Data1;
+ int Data2;
+ int Data3;
+ int Data4[8];
+
+ if (AsciiGuidBuffer == NULL || GuidBuffer == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Check Guid Format strictly xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+ //
+ for (Index = 0; AsciiGuidBuffer[Index] != '\0' && Index < 37; Index ++) {
+ if (Index == 8 || Index == 13 || Index == 18 || Index == 23) {
+ if (AsciiGuidBuffer[Index] != '-') {
+ break;
+ }
+ } else {
+ if (((AsciiGuidBuffer[Index] >= '0') && (AsciiGuidBuffer[Index] <= '9')) ||
+ ((AsciiGuidBuffer[Index] >= 'a') && (AsciiGuidBuffer[Index] <= 'f')) ||
+ ((AsciiGuidBuffer[Index] >= 'A') && (AsciiGuidBuffer[Index] <= 'F'))) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ }
+
+ if (Index < 36 || AsciiGuidBuffer[36] != '\0') {
+ Error (NULL, 0, 1003, "Invalid option value", "Incorrect GUID \"%s\"\n Correct Format \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"", AsciiGuidBuffer);
+ return EFI_ABORTED;
+ }
+
+ //
+ // Scan the guid string into the buffer
+ //
+ Index = sscanf (
+ AsciiGuidBuffer,
+ "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ &Data1,
+ &Data2,
+ &Data3,
+ &Data4[0],
+ &Data4[1],
+ &Data4[2],
+ &Data4[3],
+ &Data4[4],
+ &Data4[5],
+ &Data4[6],
+ &Data4[7]
+ );
+
+ //
+ // Verify the correct number of items were scanned.
+ //
+ if (Index != 11) {
+ Error (NULL, 0, 1003, "Invalid option value", "Incorrect GUID \"%s\"\n Correct Format \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"", AsciiGuidBuffer);
+ return EFI_ABORTED;
+ }
+ //
+ // Copy the data into our GUID.
+ //
+ GuidBuffer->Data1 = (UINT32) Data1;
+ GuidBuffer->Data2 = (UINT16) Data2;
+ GuidBuffer->Data3 = (UINT16) Data3;
+ GuidBuffer->Data4[0] = (UINT8) Data4[0];
+ GuidBuffer->Data4[1] = (UINT8) Data4[1];
+ GuidBuffer->Data4[2] = (UINT8) Data4[2];
+ GuidBuffer->Data4[3] = (UINT8) Data4[3];
+ GuidBuffer->Data4[4] = (UINT8) Data4[4];
+ GuidBuffer->Data4[5] = (UINT8) Data4[5];
+ GuidBuffer->Data4[6] = (UINT8) Data4[6];
+ GuidBuffer->Data4[7] = (UINT8) Data4[7];
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+AsciiStringToUint64 (
+ IN CONST CHAR8 *AsciiString,
+ IN BOOLEAN IsHex,
+ OUT UINT64 *ReturnValue
+ )
+/*++
+
+Routine Description:
+
+ Converts a null terminated ascii string that represents a number into a
+ UINT64 value. A hex number may be preceded by a 0x, but may not be
+ succeeded by an h. A number without 0x or 0X is considered to be base 10
+ unless the IsHex input is true.
+
+Arguments:
+
+ AsciiString The string to convert.
+ IsHex Force the string to be treated as a hex number.
+ ReturnValue The return value.
+
+Returns:
+
+ EFI_SUCCESS Number successfully converted.
+ EFI_ABORTED Invalid character encountered.
+
+--*/
+{
+ UINT8 Index;
+ UINT64 Value;
+ CHAR8 CurrentChar;
+
+ //
+ // Initialize the result
+ //
+ Value = 0;
+ Index = 0;
+
+ //
+ // Check input parameter
+ //
+ if (AsciiString == NULL || ReturnValue == NULL || strlen(AsciiString) > 0xFF) {
+ return EFI_INVALID_PARAMETER;
+ }
+ while (AsciiString[Index] == ' ') {
+ Index ++;
+ }
+
+ //
+ // Add each character to the result
+ //
+
+ //
+ // Skip first two chars only if the string starts with '0x' or '0X'
+ //
+ if (AsciiString[Index] == '0' && (AsciiString[Index + 1] == 'x' || AsciiString[Index + 1] == 'X')) {
+ IsHex = TRUE;
+ Index += 2;
+ }
+ if (IsHex) {
+ //
+ // Convert the hex string.
+ //
+ for (; AsciiString[Index] != '\0'; Index++) {
+ CurrentChar = AsciiString[Index];
+ if (CurrentChar == ' ') {
+ break;
+ }
+ //
+ // Verify Hex string
+ //
+ if (isxdigit ((int)CurrentChar) == 0) {
+ return EFI_ABORTED;
+ }
+ //
+ // Add hex value
+ //
+ Value *= 16;
+ if (CurrentChar >= '0' && CurrentChar <= '9') {
+ Value += CurrentChar - '0';
+ } else if (CurrentChar >= 'a' && CurrentChar <= 'f') {
+ Value += CurrentChar - 'a' + 10;
+ } else if (CurrentChar >= 'A' && CurrentChar <= 'F') {
+ Value += CurrentChar - 'A' + 10;
+ }
+ }
+
+ *ReturnValue = Value;
+ } else {
+ //
+ // Convert dec string is a number
+ //
+ for (; Index < strlen (AsciiString); Index++) {
+ CurrentChar = AsciiString[Index];
+ if (CurrentChar == ' ') {
+ break;
+ }
+ //
+ // Verify Dec string
+ //
+ if (isdigit ((int)CurrentChar) == 0) {
+ return EFI_ABORTED;
+ }
+ //
+ // Add dec value
+ //
+ Value = Value * 10;
+ Value += CurrentChar - '0';
+ }
+
+ *ReturnValue = Value;
+ }
+
+ return EFI_SUCCESS;
+}
+
+CHAR8 *
+ReadLineInStream (
+ IN FILE *InputFile,
+ IN OUT CHAR8 *InputBuffer
+ )
+/*++
+
+Routine Description:
+
+ This function reads a line, stripping any comments.
+ // BUGBUG: This is obsolete once genmake goes away...
+
+Arguments:
+
+ InputFile Stream pointer.
+ InputBuffer Buffer to read into, must be MAX_LONG_FILE_PATH size.
+
+Returns:
+
+ NULL if error or EOF
+ InputBuffer otherwise
+
+--*/
+{
+ CHAR8 *CharPtr;
+
+ //
+ // Verify input parameters are not null
+ //
+ assert (InputFile);
+ assert (InputBuffer);
+
+ //
+ // Read a line
+ //
+ if (fgets (InputBuffer, MAX_LONG_FILE_PATH, InputFile) == NULL) {
+ return NULL;
+ }
+ //
+ // Strip any comments
+ //
+ CharPtr = strstr (InputBuffer, "//");
+ if (CharPtr != 0) {
+ CharPtr[0] = 0;
+ }
+
+ CharPtr = strstr (InputBuffer, "#");
+ if (CharPtr != 0) {
+ CharPtr[0] = 0;
+ }
+ //
+ // Return the string
+ //
+ return InputBuffer;
+}
+
+BOOLEAN
+FindSectionInStream (
+ IN FILE *InputFile,
+ IN CHAR8 *Section
+ )
+/*++
+
+Routine Description:
+
+ This function parses a stream file from the beginning to find a section.
+ The section string may be anywhere within a line.
+ // BUGBUG: This is obsolete once genmake goes away...
+
+Arguments:
+
+ InputFile Stream pointer.
+ Section Section to search for
+
+Returns:
+
+ FALSE if error or EOF
+ TRUE if section found
+
+--*/
+{
+ CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
+ CHAR8 *CurrentToken;
+
+ //
+ // Verify input is not NULL
+ //
+ assert (InputFile);
+ assert (Section);
+
+ //
+ // Rewind to beginning of file
+ //
+ if (fseek (InputFile, 0, SEEK_SET) != 0) {
+ return FALSE;
+ }
+ //
+ // Read lines until the section is found
+ //
+ while (feof (InputFile) == 0) {
+ //
+ // Read a line
+ //
+ ReadLineInStream (InputFile, InputBuffer);
+
+ //
+ // Check if the section is found
+ //
+ CurrentToken = strstr (InputBuffer, Section);
+ if (CurrentToken != NULL) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
diff --git a/roms/edk2/BaseTools/Source/C/Common/ParseInf.h b/roms/edk2/BaseTools/Source/C/Common/ParseInf.h
new file mode 100644
index 000000000..596cb3aa3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/ParseInf.h
@@ -0,0 +1,220 @@
+/** @file
+Header file for helper functions useful for parsing INF files.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFI_PARSE_INF_H
+#define _EFI_PARSE_INF_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <Common/UefiBaseTypes.h>
+#include <MemoryFile.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+//
+// Functions declarations
+//
+CHAR8 *
+ReadLine (
+ IN MEMORY_FILE *InputFile,
+ IN OUT CHAR8 *InputBuffer,
+ IN UINTN MaxLength
+ )
+;
+
+/*++
+
+Routine Description:
+
+ This function reads a line, stripping any comments.
+ The function reads a string from the input stream argument and stores it in
+ the input string. ReadLine reads characters from the current file position
+ to and including the first newline character, to the end of the stream, or
+ until the number of characters read is equal to MaxLength - 1, whichever
+ comes first. The newline character, if read, is replaced with a \0.
+
+Arguments:
+
+ InputFile Memory file image.
+ InputBuffer Buffer to read into, must be MaxLength size.
+ MaxLength The maximum size of the input buffer.
+
+Returns:
+
+ NULL if error or EOF
+ InputBuffer otherwise
+
+--*/
+BOOLEAN
+FindSection (
+ IN MEMORY_FILE *InputFile,
+ IN CHAR8 *Section
+ )
+;
+
+/*++
+
+Routine Description:
+
+ This function parses a file from the beginning to find a section.
+ The section string may be anywhere within a line.
+
+Arguments:
+
+ InputFile Memory file image.
+ Section Section to search for
+
+Returns:
+
+ FALSE if error or EOF
+ TRUE if section found
+
+--*/
+EFI_STATUS
+FindToken (
+ IN MEMORY_FILE *InputFile,
+ IN CHAR8 *Section,
+ IN CHAR8 *Token,
+ IN UINTN Instance,
+ OUT CHAR8 *Value
+ )
+;
+
+/*++
+
+Routine Description:
+
+ Finds a token value given the section and token to search for.
+
+Arguments:
+
+ InputFile Memory file image.
+ Section The section to search for, a string within [].
+ Token The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
+ Instance The instance of the token to search for. Zero is the first instance.
+ Value The string that holds the value following the =. Must be MAX_LONG_FILE_PATH in size.
+
+Returns:
+
+ EFI_SUCCESS Value found.
+ EFI_ABORTED Format error detected in INF file.
+ EFI_INVALID_PARAMETER Input argument was null.
+ EFI_LOAD_ERROR Error reading from the file.
+ EFI_NOT_FOUND Section/Token/Value not found.
+
+--*/
+EFI_STATUS
+StringToGuid (
+ IN CHAR8 *AsciiGuidBuffer,
+ OUT EFI_GUID *GuidBuffer
+ )
+;
+
+/*++
+
+Routine Description:
+
+ Converts a string to an EFI_GUID. The string must be in the
+ xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
+
+Arguments:
+
+ GuidBuffer - pointer to destination Guid
+ AsciiGuidBuffer - pointer to ascii string
+
+Returns:
+
+ EFI_ABORTED Could not convert the string
+ EFI_SUCCESS The string was successfully converted
+
+--*/
+EFI_STATUS
+AsciiStringToUint64 (
+ IN CONST CHAR8 *AsciiString,
+ IN BOOLEAN IsHex,
+ OUT UINT64 *ReturnValue
+ )
+;
+
+/*++
+
+Routine Description:
+
+ Converts a null terminated ascii string that represents a number into a
+ UINT64 value. A hex number may be preceded by a 0x, but may not be
+ succeeded by an h. A number without 0x or 0X is considered to be base 10
+ unless the IsHex input is true.
+
+Arguments:
+
+ AsciiString The string to convert.
+ IsHex Force the string to be treated as a hex number.
+ ReturnValue The return value.
+
+Returns:
+
+ EFI_SUCCESS Number successfully converted.
+ EFI_ABORTED Invalid character encountered.
+
+--*/
+CHAR8 *
+ReadLineInStream (
+ IN FILE *InputFile,
+ IN OUT CHAR8 *InputBuffer
+ )
+;
+
+/*++
+
+Routine Description:
+
+ This function reads a line, stripping any comments.
+
+Arguments:
+
+ InputFile Stream pointer.
+ InputBuffer Buffer to read into, must be MAX_LONG_FILE_PATH size.
+
+Returns:
+
+ NULL if error or EOF
+ InputBuffer otherwise
+
+--*/
+BOOLEAN
+FindSectionInStream (
+ IN FILE *InputFile,
+ IN CHAR8 *Section
+ )
+;
+
+/*++
+
+Routine Description:
+
+ This function parses a stream file from the beginning to find a section.
+ The section string may be anywhere within a line.
+
+Arguments:
+
+ InputFile Stream pointer.
+ Section Section to search for
+
+Returns:
+
+ FALSE if error or EOF
+ TRUE if section found
+
+--*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Common/PcdValueCommon.c b/roms/edk2/BaseTools/Source/C/Common/PcdValueCommon.c
new file mode 100644
index 000000000..98023e878
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/PcdValueCommon.c
@@ -0,0 +1,779 @@
+/** @file
+This file contains the PcdValue structure definition.
+
+Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "CommonLib.h"
+#include "PcdValueCommon.h"
+
+typedef enum {
+ PcdDataTypeBoolean,
+ PcdDataTypeUint8,
+ PcdDataTypeUint16,
+ PcdDataTypeUint32,
+ PcdDataTypeUint64,
+ PcdDataTypePointer
+} PCD_DATA_TYPE;
+
+typedef struct {
+ CHAR8 *SkuName;
+ CHAR8 *DefaultValueName;
+ CHAR8 *TokenSpaceGuidName;
+ CHAR8 *TokenName;
+ CHAR8 *DataType;
+ CHAR8 *Value;
+ PCD_DATA_TYPE PcdDataType;
+} PCD_ENTRY;
+
+PCD_ENTRY *PcdList;
+UINT32 PcdListLength;
+
+VOID
+STATIC
+RecordToken (
+ UINT8 *FileBuffer,
+ UINT32 PcdIndex,
+ UINT32 TokenIndex,
+ UINT32 TokenStart,
+ UINT32 TokenEnd
+ )
+/*++
+
+Routine Description:
+
+ Record new token information
+
+Arguments:
+
+ FileBuffer File Buffer to be record
+ PcdIndex Index of PCD in database
+ TokenIndex Index of Token
+ TokenStart Start of Token
+ TokenEnd End of Token
+
+Returns:
+
+ None
+--*/
+{
+ CHAR8 *Token;
+
+ Token = malloc (TokenEnd - TokenStart + 1);
+ if (Token == NULL) {
+ return;
+ }
+ memcpy (Token, &FileBuffer[TokenStart], TokenEnd - TokenStart);
+ Token[TokenEnd - TokenStart] = 0;
+ switch (TokenIndex) {
+ case 0:
+ PcdList[PcdIndex].SkuName = Token;
+ break;
+ case 1:
+ PcdList[PcdIndex].DefaultValueName = Token;
+ break;
+ case 2:
+ PcdList[PcdIndex].TokenSpaceGuidName = Token;
+ break;
+ case 3:
+ PcdList[PcdIndex].TokenName = Token;
+ break;
+ case 4:
+ PcdList[PcdIndex].DataType = Token;
+ if (strcmp (Token, "BOOLEAN") == 0) {
+ PcdList[PcdIndex].PcdDataType = PcdDataTypeBoolean;
+ } else if (strcmp (Token, "UINT8") == 0) {
+ PcdList[PcdIndex].PcdDataType = PcdDataTypeUint8;
+ } else if (strcmp (Token, "UINT16") == 0) {
+ PcdList[PcdIndex].PcdDataType = PcdDataTypeUint16;
+ } else if (strcmp (Token, "UINT32") == 0) {
+ PcdList[PcdIndex].PcdDataType = PcdDataTypeUint32;
+ } else if (strcmp (Token, "UINT64") == 0) {
+ PcdList[PcdIndex].PcdDataType = PcdDataTypeUint64;
+ } else {
+ PcdList[PcdIndex].PcdDataType = PcdDataTypePointer;
+ }
+ break;
+ case 5:
+ PcdList[PcdIndex].Value = Token;
+ break;
+ default:
+ free (Token);
+ break;
+ }
+}
+
+int
+STATIC
+LookupPcdIndex (
+ CHAR8 *SkuName OPTIONAL,
+ CHAR8 *DefaultValueName OPTIONAL,
+ CHAR8 *TokenSpaceGuidName,
+ CHAR8 *TokenName
+ )
+/*++
+
+Routine Description:
+
+ Get PCD index in Pcd database
+
+Arguments:
+
+ SkuName SkuName String
+ DefaultValueName DefaultValueName String
+ TokenSpaceGuidName TokenSpaceGuidName String
+ TokenName TokenName String
+
+Returns:
+
+ Index of PCD in Pcd database
+--*/
+{
+ UINT32 Index;
+
+ if (SkuName == NULL) {
+ SkuName = "DEFAULT";
+ }
+ if (DefaultValueName == NULL) {
+ DefaultValueName = "DEFAULT";
+ }
+ for (Index = 0; Index < PcdListLength; Index++) {
+ if (strcmp(PcdList[Index].TokenSpaceGuidName, TokenSpaceGuidName) != 0) {
+ continue;
+ }
+ if (strcmp(PcdList[Index].TokenName, TokenName) != 0) {
+ continue;
+ }
+ if (strcmp(PcdList[Index].SkuName, SkuName) != 0) {
+ continue;
+ }
+ if (strcmp(PcdList[Index].DefaultValueName, DefaultValueName) != 0) {
+ continue;
+ }
+ return Index;
+ }
+ return -1;
+}
+
+UINT64
+__PcdGet (
+ CHAR8 *SkuName OPTIONAL,
+ CHAR8 *DefaultValueName OPTIONAL,
+ CHAR8 *TokenSpaceGuidName,
+ CHAR8 *TokenName
+ )
+/*++
+
+Routine Description:
+
+ Get PCD value
+
+Arguments:
+
+ SkuName SkuName String
+ DefaultValueName DefaultValueName String
+ TokenSpaceGuidName TokenSpaceGuidName String
+ TokenName TokenName String
+
+Returns:
+
+ PCD value
+--*/
+{
+ int Index;
+ CHAR8 *End;
+
+ Index = LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+ if (Index < 0) {
+ fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+ exit (EXIT_FAILURE);
+ }
+ switch (PcdList[Index].PcdDataType) {
+ case PcdDataTypeBoolean:
+ case PcdDataTypeUint8:
+ case PcdDataTypeUint16:
+ case PcdDataTypeUint32:
+ return (UINT64)strtoul(PcdList[Index].Value, &End, 16);
+ break;
+ case PcdDataTypeUint64:
+ return (UINT64)strtoul(PcdList[Index].Value, &End, 16);
+ break;
+ case PcdDataTypePointer:
+ fprintf (stderr, "PCD %s.%s.%s.%s is structure. Use PcdGetPtr()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+ exit (EXIT_FAILURE);
+ break;
+ }
+ return 0;
+}
+
+VOID
+__PcdSet (
+ CHAR8 *SkuName OPTIONAL,
+ CHAR8 *DefaultValueName OPTIONAL,
+ CHAR8 *TokenSpaceGuidName,
+ CHAR8 *TokenName,
+ UINT64 Value
+ )
+/*++
+
+Routine Description:
+
+ Set PCD value
+
+Arguments:
+
+ SkuName SkuName String
+ DefaultValueName DefaultValueName String
+ TokenSpaceGuidName TokenSpaceGuidName String
+ TokenName TokenName String
+ Value PCD value to be set
+
+Returns:
+
+ None
+--*/
+{
+ int Index;
+
+ Index = LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+ if (Index < 0) {
+ fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+ exit (EXIT_FAILURE);
+ }
+ free(PcdList[Index].Value);
+ PcdList[Index].Value = malloc(20);
+ switch (PcdList[Index].PcdDataType) {
+ case PcdDataTypeBoolean:
+ if (Value == 0) {
+ strcpy (PcdList[Index].Value, "0x00");
+ } else {
+ strcpy (PcdList[Index].Value, "0x01");
+ }
+ break;
+ case PcdDataTypeUint8:
+ sprintf(PcdList[Index].Value, "0x%02x", (UINT8)(Value & 0xff));
+ break;
+ case PcdDataTypeUint16:
+ sprintf(PcdList[Index].Value, "0x%04x", (UINT16)(Value & 0xffff));
+ break;
+ case PcdDataTypeUint32:
+ sprintf(PcdList[Index].Value, "0x%08x", (UINT32)(Value & 0xffffffff));
+ break;
+ case PcdDataTypeUint64:
+ sprintf(PcdList[Index].Value, "0x%016llx", (unsigned long long)Value);
+ break;
+ case PcdDataTypePointer:
+ fprintf (stderr, "PCD %s.%s.%s.%s is structure. Use PcdSetPtr()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+ exit (EXIT_FAILURE);
+ break;
+ }
+}
+
+VOID *
+__PcdGetPtr (
+ CHAR8 *SkuName OPTIONAL,
+ CHAR8 *DefaultValueName OPTIONAL,
+ CHAR8 *TokenSpaceGuidName,
+ CHAR8 *TokenName,
+ UINT32 *Size
+ )
+/*++
+
+Routine Description:
+
+ Get PCD value buffer
+
+Arguments:
+
+ SkuName SkuName String
+ DefaultValueName DefaultValueName String
+ TokenSpaceGuidName TokenSpaceGuidName String
+ TokenName TokenName String
+ Size Size of PCD value buffer
+
+Returns:
+
+ PCD value buffer
+--*/
+{
+ int Index;
+ CHAR8 *Value;
+ UINT8 *Buffer;
+ CHAR8 *End;
+
+ Index = LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+ if (Index < 0) {
+ fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+ exit (EXIT_FAILURE);
+ }
+ switch (PcdList[Index].PcdDataType) {
+ case PcdDataTypeBoolean:
+ case PcdDataTypeUint8:
+ case PcdDataTypeUint16:
+ case PcdDataTypeUint32:
+ case PcdDataTypeUint64:
+ fprintf (stderr, "PCD %s.%s.%s.%s is a value. Use PcdGet()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+ exit (EXIT_FAILURE);
+ break;
+ case PcdDataTypePointer:
+ Value = &PcdList[Index].Value[1];
+ for (*Size = 0, strtoul(Value, &End, 16); Value != End; strtoul(Value, &End, 16), *Size = *Size + 1) {
+ Value = End + 1;
+ }
+ Buffer = malloc(*Size + 1);
+ if (Buffer == NULL) {
+ *Size = 0;
+ return NULL;
+ }
+ Value = &PcdList[Index].Value[1];
+ for (*Size = 0, Buffer[*Size] = (UINT8) strtoul(Value, &End, 16); Value != End; *Size = *Size + 1, Buffer[*Size] = (UINT8) strtoul(Value, &End, 16)) {
+ Value = End + 1;
+ }
+ return Buffer;
+ }
+ *Size = 0;
+ return 0;
+}
+
+VOID
+__PcdSetPtr (
+ CHAR8 *SkuName OPTIONAL,
+ CHAR8 *DefaultValueName OPTIONAL,
+ CHAR8 *TokenSpaceGuidName,
+ CHAR8 *TokenName,
+ UINT32 Size,
+ UINT8 *Value
+ )
+/*++
+
+Routine Description:
+
+ Set PCD value buffer
+
+Arguments:
+
+ SkuName SkuName String
+ DefaultValueName DefaultValueName String
+ TokenSpaceGuidName TokenSpaceGuidName String
+ TokenName TokenName String
+ Size Size of PCD value
+ Value Pointer to the updated PCD value buffer
+
+Returns:
+
+ None
+--*/
+{
+ int Index;
+ UINT32 ValueIndex;
+
+ Index = LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+ if (Index < 0) {
+ fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+ exit (EXIT_FAILURE);
+ }
+ switch (PcdList[Index].PcdDataType) {
+ case PcdDataTypeBoolean:
+ case PcdDataTypeUint8:
+ case PcdDataTypeUint16:
+ case PcdDataTypeUint32:
+ case PcdDataTypeUint64:
+ fprintf (stderr, "PCD %s.%s.%s.%s is a value. Use PcdGet()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+ exit (EXIT_FAILURE);
+ break;
+ case PcdDataTypePointer:
+ free(PcdList[Index].Value);
+ PcdList[Index].Value = malloc(Size * 5 + 3);
+ PcdList[Index].Value[0] = '{';
+ for (ValueIndex = 0; ValueIndex < Size; ValueIndex++) {
+ sprintf(&PcdList[Index].Value[1 + ValueIndex * 5], "0x%02x,", Value[ValueIndex]);
+ }
+ PcdList[Index].Value[1 + Size * 5 - 1] = '}';
+ PcdList[Index].Value[1 + Size * 5 ] = 0;
+ break;
+ }
+}
+
+VOID
+STATIC
+ReadInputFile (
+ CHAR8 *InputFileName,
+ UINT8 **FileBuffer,
+ UINT32 *FileSize
+ )
+/*++
+
+Routine Description:
+
+ Read the file buffer from the input file.
+
+Arguments:
+
+ InputFileName Point to the input file name.
+ FileBuffer Point to the input file buffer.
+ FileSize Size of the file buffer.
+
+Returns:
+
+ None
+--*/
+{
+ FILE *InputFile;
+ UINT32 BytesRead;
+
+ //
+ // Open Input file and read file data.
+ //
+ InputFile = fopen (InputFileName, "rb");
+ if (InputFile == NULL) {
+ fprintf (stderr, "Error opening file %s\n", InputFileName);
+ exit (EXIT_FAILURE);
+ }
+
+ //
+ // Go to the end so that we can determine the file size
+ //
+ if (fseek (InputFile, 0, SEEK_END)) {
+ fprintf (stderr, "Error reading input file %s\n", InputFileName);
+ fclose (InputFile);
+ exit (EXIT_FAILURE);
+ }
+
+ //
+ // Get the file size
+ //
+ *FileSize = ftell (InputFile);
+ if (*FileSize == -1) {
+ fprintf (stderr, "Error parsing the input file %s\n", InputFileName);
+ fclose (InputFile);
+ exit (EXIT_FAILURE);
+ }
+
+ //
+ // Allocate a buffer
+ //
+ *FileBuffer = malloc (*FileSize);
+ if (*FileBuffer == NULL) {
+ fprintf (stderr, "Can not allocate buffer for input input file %s\n", InputFileName);
+ fclose (InputFile);
+ exit (EXIT_FAILURE);
+ }
+
+ //
+ // Reset to the beginning of the file
+ //
+ if (fseek (InputFile, 0, SEEK_SET)) {
+ fprintf (stderr, "Error reading the input file %s\n", InputFileName);
+ fclose (InputFile);
+ free (*FileBuffer);
+ exit (EXIT_FAILURE);
+ }
+
+ //
+ // Read all of the file contents.
+ //
+ BytesRead = (UINT32)fread (*FileBuffer, sizeof (UINT8), *FileSize, InputFile);
+ if (BytesRead != *FileSize * sizeof (UINT8)) {
+ fprintf (stderr, "Error reading the input file %s\n", InputFileName);
+ fclose (InputFile);
+ free (*FileBuffer);
+ exit (EXIT_FAILURE);
+ }
+
+ //
+ // Close the file
+ //
+ fclose (InputFile);
+}
+
+VOID
+STATIC
+ParseFile (
+ UINT8 *FileBuffer,
+ UINT32 FileSize
+ )
+/*++
+
+Routine Description:
+
+ Read the initial PCD value from the input file buffer.
+
+Arguments:
+
+ FileBuffer Point to the input file buffer.
+ FileSize Size of the file buffer.
+
+Returns:
+
+ None
+--*/
+{
+ UINT32 Index;
+ UINT32 NumLines;
+ UINT32 TokenIndex;
+ UINT32 TokenStart;
+
+ for (Index = 0, NumLines = 0; Index < FileSize; Index++) {
+ if (FileBuffer[Index] == '\n') {
+ NumLines++;
+ }
+ }
+ PcdList = malloc((NumLines + 1) * sizeof(PcdList[0]));
+
+ for (Index = 0, TokenIndex = 0, PcdListLength = 0, TokenStart = 0; Index < FileSize; Index++) {
+ if (FileBuffer[Index] == ' ') {
+ continue;
+ }
+ if (FileBuffer[Index] == '|' || FileBuffer[Index] == '.' || FileBuffer[Index] == '\n' || FileBuffer[Index] == '\r') {
+ RecordToken (FileBuffer, PcdListLength, TokenIndex, TokenStart, Index);
+ if (FileBuffer[Index] == '\n' || FileBuffer[Index] == '\r') {
+ if (TokenIndex != 0) {
+ PcdListLength++;
+ TokenIndex = 0;
+ }
+ } else {
+ TokenIndex++;
+ }
+ TokenStart = Index + 1;
+ continue;
+ }
+ }
+ if (Index > TokenStart) {
+ RecordToken (FileBuffer, PcdListLength, TokenIndex, TokenStart, Index);
+ if (TokenIndex != 0) {
+ PcdListLength++;
+ }
+ }
+}
+
+VOID
+STATIC
+WriteOutputFile (
+ CHAR8 *OutputFileName
+ )
+/*++
+
+Routine Description:
+
+ Write the updated PCD value into the output file name.
+
+Arguments:
+
+ OutputFileName Point to the output file name.
+
+Returns:
+
+ None
+--*/
+{
+ FILE *OutputFile;
+ UINT32 Index;
+
+ //
+ // Open output file
+ //
+ OutputFile = fopen (OutputFileName, "wb");
+ if (OutputFile == NULL) {
+ fprintf (stderr, "Error opening file %s\n", OutputFileName);
+ exit (EXIT_FAILURE);
+ }
+
+ for (Index = 0; Index < PcdListLength; Index++) {
+ fprintf (
+ OutputFile,
+ "%s.%s.%s.%s|%s|%s\n",
+ PcdList[Index].SkuName,
+ PcdList[Index].DefaultValueName,
+ PcdList[Index].TokenSpaceGuidName,
+ PcdList[Index].TokenName,
+ PcdList[Index].DataType,
+ PcdList[Index].Value
+ );
+ }
+
+ //
+ // Done, write output file.
+ //
+ if (OutputFile != NULL) {
+ fclose (OutputFile);
+ }
+}
+
+VOID
+STATIC
+Usage (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Displays the utility usage syntax to STDOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ fprintf (stdout, "Usage: -i <input_file> -o <output_file>\n\n");
+ fprintf (stdout, "optional arguments:\n");
+ fprintf (stdout, " -h, --help Show this help message and exit\n");
+ fprintf (stdout, " -i INPUT_FILENAME, --input INPUT_FILENAME\n\
+ PCD Database Input file name\n");
+ fprintf (stdout, " -o OUTPUT_FILENAME, --output OUTPUT_FILENAME\n\
+ PCD Database Output file name\n");
+}
+
+VOID
+STATIC
+ParseArguments (
+ int argc,
+ char *argv[],
+ CHAR8 **InputFileName,
+ CHAR8 **OutputFileName
+ )
+/*++
+
+Routine Description:
+
+ Parse the input parameters to get the input/output file name.
+
+Arguments:
+
+ argc Number of command line parameters.
+ argv Array of pointers to parameter strings.
+ InputFileName Point to the input file name.
+ OutputFileName Point to the output file name.
+
+Returns:
+
+ None
+--*/
+{
+ if (argc == 1) {
+ fprintf (stderr, "Missing options\n");
+ exit (EXIT_FAILURE);
+ }
+
+ //
+ // Parse command line
+ //
+ argc--;
+ argv++;
+
+ if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
+ Usage ();
+ exit (EXIT_SUCCESS);
+ }
+
+ while (argc > 0) {
+ if ((stricmp (argv[0], "-i") == 0) || (stricmp (argv[0], "--input") == 0)) {
+ if (argv[1] == NULL || argv[1][0] == '-') {
+ fprintf (stderr, "Invalid option value. Input File name is missing for -i option\n");
+ exit (EXIT_FAILURE);
+ }
+ *InputFileName = argv[1];
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--output") == 0)) {
+ if (argv[1] == NULL || argv[1][0] == '-') {
+ fprintf (stderr, "Invalid option value. Output File name is missing for -i option\n");
+ exit (EXIT_FAILURE);
+ }
+ *OutputFileName = argv[1];
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if (argv[0][0] == '-') {
+ fprintf (stderr, "Unknown option %s\n", argv[0]);
+ exit (EXIT_FAILURE);
+ }
+ argc --;
+ argv ++;
+ }
+
+ //
+ // Check Input parameters
+ //
+ if (*InputFileName == NULL) {
+ fprintf (stderr, "Missing option. Input files is not specified\n");
+ exit (EXIT_FAILURE);
+ }
+
+ if (*OutputFileName == NULL) {
+ fprintf (stderr, "Missing option. Output file is not specified\n");
+ exit (EXIT_FAILURE);
+ }
+}
+
+int
+PcdValueMain (
+ int argc,
+ char *argv[]
+ )
+/*++
+
+Routine Description:
+
+ Main function updates PCD values.
+
+Arguments:
+
+ argc Number of command line parameters.
+ argv Array of pointers to parameter strings.
+
+Returns:
+ EXIT_SUCCESS
+--*/
+{
+ CHAR8 *InputFileName;
+ CHAR8 *OutputFileName;
+ UINT8 *FileBuffer;
+ UINT32 FileSize;
+
+ InputFileName = NULL;
+ OutputFileName = NULL;
+
+ //
+ // Parse the input arguments
+ //
+ ParseArguments (argc, argv, &InputFileName, &OutputFileName);
+
+ //
+ // Open Input file and read file data.
+ //
+ ReadInputFile (InputFileName, &FileBuffer, &FileSize);
+
+ //
+ // Read the initial Pcd value
+ //
+ ParseFile (FileBuffer, FileSize);
+
+ //
+ // Customize PCD values in the PCD Database
+ //
+ PcdEntryPoint ();
+
+ //
+ // Save the updated PCD value
+ //
+ WriteOutputFile (OutputFileName);
+
+ exit (EXIT_SUCCESS);
+}
diff --git a/roms/edk2/BaseTools/Source/C/Common/PcdValueCommon.h b/roms/edk2/BaseTools/Source/C/Common/PcdValueCommon.h
new file mode 100644
index 000000000..cfd3bb76e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/PcdValueCommon.h
@@ -0,0 +1,185 @@
+/** @file
+Header file for PcdValue structure definition.
+
+Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _PCD_VALUE_COMMON_H
+#define _PCD_VALUE_COMMON_H
+
+#include <Common/UefiBaseTypes.h>
+#include <Common/UefiInternalFormRepresentation.h>
+
+#define __FIELD_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field)
+#define __ARRAY_ELEMENT_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field[0])
+#define __OFFSET_OF(TYPE, Field) ((UINT32) &(((TYPE *)0)->Field))
+#define __FLEXIBLE_SIZE(Size, TYPE, Field, MaxIndex) if (__FIELD_SIZE(TYPE, Field) == 0) Size = MAX((__OFFSET_OF(TYPE, Field) + __ARRAY_ELEMENT_SIZE(TYPE, Field) * (MaxIndex)), Size)
+#define __ARRAY_SIZE(Array) (sizeof(Array)/sizeof(Array[0]))
+
+#if defined(_MSC_EXTENSIONS)
+#define __STATIC_ASSERT static_assert
+#else
+#define __STATIC_ASSERT _Static_assert
+#endif
+
+VOID
+PcdEntryPoint (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Main function updates PCD values. It is auto generated by Build
+
+Arguments:
+
+ None
+
+Returns:
+ None
+--*/
+;
+
+int
+PcdValueMain (
+ int argc,
+ char *argv[]
+ )
+/*++
+
+Routine Description:
+
+ Main function updates PCD values.
+
+Arguments:
+
+ argc Number of command line parameters.
+ argv Array of pointers to parameter strings.
+
+Returns:
+ EXIT_SUCCESS
+--*/
+;
+
+VOID
+__PcdSet (
+ CHAR8 *SkuName OPTIONAL,
+ CHAR8 *DefaultValueName OPTIONAL,
+ CHAR8 *TokenSpaceGuidName,
+ CHAR8 *TokenName,
+ UINT64 Value
+ )
+/*++
+
+Routine Description:
+
+ Get PCD value
+
+Arguments:
+
+ SkuName SkuName String
+ DefaultValueName DefaultValueName String
+ TokenSpaceGuidName TokenSpaceGuidName String
+ TokenName TokenName String
+
+Returns:
+
+ PCD value
+--*/
+;
+
+VOID
+__PcdSet (
+ CHAR8 *SkuName OPTIONAL,
+ CHAR8 *DefaultValueName OPTIONAL,
+ CHAR8 *TokenSpaceGuidName,
+ CHAR8 *TokenName,
+ UINT64 Value
+ )
+/*++
+
+Routine Description:
+
+ Set PCD value
+
+Arguments:
+
+ SkuName SkuName String
+ DefaultValueName DefaultValueName String
+ TokenSpaceGuidName TokenSpaceGuidName String
+ TokenName TokenName String
+ Value PCD value to be set
+
+Returns:
+
+ None
+--*/
+;
+
+VOID *
+__PcdGetPtr (
+ CHAR8 *SkuName OPTIONAL,
+ CHAR8 *DefaultValueName OPTIONAL,
+ CHAR8 *TokenSpaceGuidName,
+ CHAR8 *TokenName,
+ UINT32 *Size
+ )
+/*++
+
+Routine Description:
+
+ Get PCD value buffer
+
+Arguments:
+
+ SkuName SkuName String
+ DefaultValueName DefaultValueName String
+ TokenSpaceGuidName TokenSpaceGuidName String
+ TokenName TokenName String
+ Size Size of PCD value buffer
+
+Returns:
+
+ PCD value buffer
+--*/
+;
+
+VOID
+__PcdSetPtr (
+ CHAR8 *SkuName OPTIONAL,
+ CHAR8 *DefaultValueName OPTIONAL,
+ CHAR8 *TokenSpaceGuidName,
+ CHAR8 *TokenName,
+ UINT32 Size,
+ UINT8 *Value
+ )
+/*++
+
+Routine Description:
+
+ Set PCD value buffer
+
+Arguments:
+
+ SkuName SkuName String
+ DefaultValueName DefaultValueName String
+ TokenSpaceGuidName TokenSpaceGuidName String
+ TokenName TokenName String
+ Size Size of PCD value
+ Value Pointer to the updated PCD value buffer
+
+Returns:
+
+ None
+--*/
+;
+
+#define PcdGet(A, B, C, D) __PcdGet(#A, #B, #C, #D)
+#define PcdSet(A, B, C, D, Value) __PcdSet(#A, #B, #C, #D, Value)
+#define PcdGetPtr(A, B, C, D, Size) __PcdGetPtr(#A, #B, #C, #D, Size)
+#define PcdSetPtr(A, B, C, D, Size, Value) __PcdSetPtr(#A, #B, #C, #D, Size, Value)
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Common/PeCoffLib.h b/roms/edk2/BaseTools/Source/C/Common/PeCoffLib.h
new file mode 100644
index 000000000..dd38f442f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/PeCoffLib.h
@@ -0,0 +1,213 @@
+/** @file
+ Function prototypes and defines on Memory Only PE COFF loader
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ Portion Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __BASE_PE_COFF_LIB_H__
+#define __BASE_PE_COFF_LIB_H__
+
+//
+// Return status codes from the PE/COFF Loader services
+// BUGBUG: Find where used and see if can be replaced by RETURN_STATUS codes
+//
+#define IMAGE_ERROR_SUCCESS 0
+#define IMAGE_ERROR_IMAGE_READ 1
+#define IMAGE_ERROR_INVALID_PE_HEADER_SIGNATURE 2
+#define IMAGE_ERROR_INVALID_MACHINE_TYPE 3
+#define IMAGE_ERROR_INVALID_SUBSYSTEM 4
+#define IMAGE_ERROR_INVALID_IMAGE_ADDRESS 5
+#define IMAGE_ERROR_INVALID_IMAGE_SIZE 6
+#define IMAGE_ERROR_INVALID_SECTION_ALIGNMENT 7
+#define IMAGE_ERROR_SECTION_NOT_LOADED 8
+#define IMAGE_ERROR_FAILED_RELOCATION 9
+#define IMAGE_ERROR_FAILED_ICACHE_FLUSH 10
+
+//
+// Macro definitions for RISC-V architecture.
+//
+#define RV_X(x, s, n) (((x) >> (s)) & ((1<<(n))-1))
+#define RISCV_IMM_BITS 12
+#define RISCV_IMM_REACH (1LL<<RISCV_IMM_BITS)
+#define RISCV_CONST_HIGH_PART(VALUE) \
+ (((VALUE) + (RISCV_IMM_REACH/2)) & ~(RISCV_IMM_REACH-1))
+
+//
+// PE/COFF Loader Read Function passed in by caller
+//
+typedef
+RETURN_STATUS
+(EFIAPI *PE_COFF_LOADER_READ_FILE) (
+ IN VOID *FileHandle,
+ IN UINTN FileOffset,
+ IN OUT UINTN *ReadSize,
+ OUT VOID *Buffer
+ );
+
+//
+// Context structure used while PE/COFF image is being loaded and relocated
+//
+typedef struct {
+ PHYSICAL_ADDRESS ImageAddress;
+ UINT64 ImageSize;
+ PHYSICAL_ADDRESS DestinationAddress;
+ PHYSICAL_ADDRESS EntryPoint;
+ PE_COFF_LOADER_READ_FILE ImageRead;
+ VOID *Handle;
+ VOID *FixupData;
+ UINT32 SectionAlignment;
+ UINT32 PeCoffHeaderOffset;
+ UINT32 DebugDirectoryEntryRva;
+ VOID *CodeView;
+ CHAR8 *PdbPointer;
+ UINTN SizeOfHeaders;
+ UINT32 ImageCodeMemoryType;
+ UINT32 ImageDataMemoryType;
+ UINT32 ImageError;
+ UINTN FixupDataSize;
+ UINT16 Machine;
+ UINT16 ImageType;
+ BOOLEAN RelocationsStripped;
+ BOOLEAN IsTeImage;
+} PE_COFF_LOADER_IMAGE_CONTEXT;
+
+
+/**
+ Retrieves information on a PE/COFF image
+
+ @param ImageContext The context of the image being loaded
+
+ @retval EFI_SUCCESS The information on the PE/COFF image was collected.
+ @retval EFI_INVALID_PARAMETER ImageContext is NULL.
+ @retval EFI_UNSUPPORTED The PE/COFF image is not supported.
+ @retval Otherwise The error status from reading the PE/COFF image using the
+ ImageContext->ImageRead() function
+
+**/
+RETURN_STATUS
+EFIAPI
+PeCoffLoaderGetImageInfo (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ )
+;
+
+/**
+ Relocates a PE/COFF image in memory
+
+ @param ImageContext Contains information on the loaded image to relocate
+
+ @retval EFI_SUCCESS if the PE/COFF image was relocated
+ @retval EFI_LOAD_ERROR if the image is not a valid PE/COFF image
+ @retval EFI_UNSUPPORTED not support
+
+**/
+RETURN_STATUS
+EFIAPI
+PeCoffLoaderRelocateImage (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ )
+;
+
+/**
+ Loads a PE/COFF image into memory
+
+ @param ImageContext Contains information on image to load into memory
+
+ @retval EFI_SUCCESS if the PE/COFF image was loaded
+ @retval EFI_BUFFER_TOO_SMALL if the caller did not provide a large enough buffer
+ @retval EFI_LOAD_ERROR if the image is a runtime driver with no relocations
+ @retval EFI_INVALID_PARAMETER if the image address is invalid
+
+**/
+RETURN_STATUS
+EFIAPI
+PeCoffLoaderLoadImage (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ )
+;
+
+VOID *
+EFIAPI
+PeCoffLoaderGetPdbPointer (
+ IN VOID *Pe32Data
+ )
+;
+
+RETURN_STATUS
+EFIAPI
+PeCoffLoaderGetEntryPoint (
+ IN VOID *Pe32Data,
+ OUT VOID **EntryPoint,
+ OUT VOID **BaseOfImage
+ )
+;
+
+//
+// These functions are used by the ARM PE/COFF relocation code and by
+// the ELF to PE/COFF converter so that is why they are public
+//
+
+/**
+ Pass in a pointer to an ARM MOVT or MOVW immediate instruction and
+ return the immediate data encoded in the instruction
+
+ @param Instruction Pointer to ARM MOVT or MOVW immediate instruction
+
+ @return Immediate address encoded in the instruction
+
+**/
+UINT16
+EFIAPI
+ThumbMovtImmediateAddress (
+ IN UINT16 *Instruction
+ );
+
+/**
+ Update an ARM MOVT or MOVW immediate instruction immediate data.
+
+ @param Instruction Pointer to ARM MOVT or MOVW immediate instruction
+ @param Address New address to patch into the instruction
+
+**/
+VOID
+EFIAPI
+ThumbMovtImmediatePatch (
+ IN OUT UINT16 *Instruction,
+ IN UINT16 Address
+ );
+
+
+/**
+ Pass in a pointer to an ARM MOVW/MOVT instruction pair and
+ return the immediate data encoded in the two` instruction
+
+ @param Instructions Pointer to ARM MOVW/MOVT instruction pair
+
+ @return Immediate address encoded in the instructions
+
+**/
+UINT32
+EFIAPI
+ThumbMovwMovtImmediateAddress (
+ IN UINT16 *Instructions
+ );
+
+/**
+ Update an ARM MOVW/MOVT immediate instruction instruction pair.
+
+ @param Instructions Pointer to ARM MOVW/MOVT instruction pair
+ @param Address New address to patch into the instructions
+**/
+VOID
+EFIAPI
+ThumbMovwMovtImmediatePatch (
+ IN OUT UINT16 *Instructions,
+ IN UINT32 Address
+ );
+
+
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Common/PeCoffLoaderEx.c b/roms/edk2/BaseTools/Source/C/Common/PeCoffLoaderEx.c
new file mode 100644
index 000000000..799f28297
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/PeCoffLoaderEx.c
@@ -0,0 +1,334 @@
+/** @file
+IA32 and X64 Specific relocation fixups
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
+Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+--*/
+
+#include <Common/UefiBaseTypes.h>
+#include <IndustryStandard/PeImage.h>
+#include "PeCoffLib.h"
+#include "CommonLib.h"
+#include "EfiUtilityMsgs.h"
+
+
+#define EXT_IMM64(Value, Address, Size, InstPos, ValPos) \
+ Value |= (((UINT64)((*(Address) >> InstPos) & (((UINT64)1 << Size) - 1))) << ValPos)
+
+#define INS_IMM64(Value, Address, Size, InstPos, ValPos) \
+ *(UINT32*)Address = (*(UINT32*)Address & ~(((1 << Size) - 1) << InstPos)) | \
+ ((UINT32)((((UINT64)Value >> ValPos) & (((UINT64)1 << Size) - 1))) << InstPos)
+
+#define IMM64_IMM7B_INST_WORD_X 3
+#define IMM64_IMM7B_SIZE_X 7
+#define IMM64_IMM7B_INST_WORD_POS_X 4
+#define IMM64_IMM7B_VAL_POS_X 0
+
+#define IMM64_IMM9D_INST_WORD_X 3
+#define IMM64_IMM9D_SIZE_X 9
+#define IMM64_IMM9D_INST_WORD_POS_X 18
+#define IMM64_IMM9D_VAL_POS_X 7
+
+#define IMM64_IMM5C_INST_WORD_X 3
+#define IMM64_IMM5C_SIZE_X 5
+#define IMM64_IMM5C_INST_WORD_POS_X 13
+#define IMM64_IMM5C_VAL_POS_X 16
+
+#define IMM64_IC_INST_WORD_X 3
+#define IMM64_IC_SIZE_X 1
+#define IMM64_IC_INST_WORD_POS_X 12
+#define IMM64_IC_VAL_POS_X 21
+
+#define IMM64_IMM41a_INST_WORD_X 1
+#define IMM64_IMM41a_SIZE_X 10
+#define IMM64_IMM41a_INST_WORD_POS_X 14
+#define IMM64_IMM41a_VAL_POS_X 22
+
+#define IMM64_IMM41b_INST_WORD_X 1
+#define IMM64_IMM41b_SIZE_X 8
+#define IMM64_IMM41b_INST_WORD_POS_X 24
+#define IMM64_IMM41b_VAL_POS_X 32
+
+#define IMM64_IMM41c_INST_WORD_X 2
+#define IMM64_IMM41c_SIZE_X 23
+#define IMM64_IMM41c_INST_WORD_POS_X 0
+#define IMM64_IMM41c_VAL_POS_X 40
+
+#define IMM64_SIGN_INST_WORD_X 3
+#define IMM64_SIGN_SIZE_X 1
+#define IMM64_SIGN_INST_WORD_POS_X 27
+#define IMM64_SIGN_VAL_POS_X 63
+
+UINT32 *RiscVHi20Fixup = NULL;
+
+RETURN_STATUS
+PeCoffLoaderRelocateIa32Image (
+ IN UINT16 *Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
+ )
+/*++
+
+Routine Description:
+
+ Performs an IA-32 specific relocation fixup
+
+Arguments:
+
+ Reloc - Pointer to the relocation record
+
+ Fixup - Pointer to the address to fix up
+
+ FixupData - Pointer to a buffer to log the fixups
+
+ Adjust - The offset to adjust the fixup
+
+Returns:
+
+ EFI_UNSUPPORTED - Unsupported now
+
+--*/
+{
+ return RETURN_UNSUPPORTED;
+}
+
+/*++
+
+Routine Description:
+
+ Performs an RISC-V specific relocation fixup
+
+Arguments:
+
+ Reloc - Pointer to the relocation record
+
+ Fixup - Pointer to the address to fix up
+
+ FixupData - Pointer to a buffer to log the fixups
+
+ Adjust - The offset to adjust the fixup
+
+Returns:
+
+ Status code
+
+--*/
+RETURN_STATUS
+PeCoffLoaderRelocateRiscVImage (
+ IN UINT16 *Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
+ )
+{
+ UINT32 Value;
+ UINT32 Value2;
+
+ switch ((*Reloc) >> 12) {
+ case EFI_IMAGE_REL_BASED_RISCV_HI20:
+ RiscVHi20Fixup = (UINT32 *) Fixup;
+ break;
+
+ case EFI_IMAGE_REL_BASED_RISCV_LOW12I:
+ if (RiscVHi20Fixup != NULL) {
+ Value = (UINT32)(RV_X(*RiscVHi20Fixup, 12, 20) << 12);
+ Value2 = (UINT32)(RV_X(*(UINT32 *)Fixup, 20, 12));
+ if (Value2 & (RISCV_IMM_REACH/2)) {
+ Value2 |= ~(RISCV_IMM_REACH-1);
+ }
+ Value += Value2;
+ Value += (UINT32)Adjust;
+ Value2 = RISCV_CONST_HIGH_PART (Value);
+ *(UINT32 *)RiscVHi20Fixup = (RV_X (Value2, 12, 20) << 12) | \
+ (RV_X (*(UINT32 *)RiscVHi20Fixup, 0, 12));
+ *(UINT32 *)Fixup = (RV_X (Value, 0, 12) << 20) | \
+ (RV_X (*(UINT32 *)Fixup, 0, 20));
+ }
+ RiscVHi20Fixup = NULL;
+ break;
+
+ case EFI_IMAGE_REL_BASED_RISCV_LOW12S:
+ if (RiscVHi20Fixup != NULL) {
+ Value = (UINT32)(RV_X(*RiscVHi20Fixup, 12, 20) << 12);
+ Value2 = (UINT32)(RV_X(*(UINT32 *)Fixup, 7, 5) | (RV_X(*(UINT32 *)Fixup, 25, 7) << 5));
+ if (Value2 & (RISCV_IMM_REACH/2)) {
+ Value2 |= ~(RISCV_IMM_REACH-1);
+ }
+ Value += Value2;
+ Value += (UINT32)Adjust;
+ Value2 = RISCV_CONST_HIGH_PART (Value);
+ *(UINT32 *)RiscVHi20Fixup = (RV_X (Value2, 12, 20) << 12) | \
+ (RV_X (*(UINT32 *)RiscVHi20Fixup, 0, 12));
+ Value2 = *(UINT32 *)Fixup & 0x01fff07f;
+ Value &= RISCV_IMM_REACH - 1;
+ *(UINT32 *)Fixup = Value2 | (UINT32)(((RV_X(Value, 0, 5) << 7) | (RV_X(Value, 5, 7) << 25)));
+ }
+ RiscVHi20Fixup = NULL;
+ break;
+
+ default:
+ return EFI_UNSUPPORTED;
+
+ }
+ return RETURN_SUCCESS;
+}
+
+/**
+ Pass in a pointer to an ARM MOVT or MOVW immediate instruction and
+ return the immediate data encoded in the instruction
+
+ @param Instruction Pointer to ARM MOVT or MOVW immediate instruction
+
+ @return Immediate address encoded in the instruction
+
+**/
+UINT16
+ThumbMovtImmediateAddress (
+ IN UINT16 *Instruction
+ )
+{
+ UINT32 Movt;
+ UINT16 Address;
+
+ // Thumb2 is two 16-bit instructions working together. Not a single 32-bit instruction
+ // Example MOVT R0, #0 is 0x0000f2c0 or 0xf2c0 0x0000
+ Movt = (*Instruction << 16) | (*(Instruction + 1));
+
+ // imm16 = imm4:i:imm3:imm8
+ // imm4 -> Bit19:Bit16
+ // i -> Bit26
+ // imm3 -> Bit14:Bit12
+ // imm8 -> Bit7:Bit0
+ Address = (UINT16)(Movt & 0x000000ff); // imm8
+ Address |= (UINT16)((Movt >> 4) & 0x0000f700); // imm4 imm3
+ Address |= (((Movt & BIT26) != 0) ? BIT11 : 0); // i
+ return Address;
+}
+
+
+/**
+ Update an ARM MOVT or MOVW immediate instruction immediate data.
+
+ @param Instruction Pointer to ARM MOVT or MOVW immediate instruction
+ @param Address New address to patch into the instruction
+**/
+VOID
+ThumbMovtImmediatePatch (
+ IN OUT UINT16 *Instruction,
+ IN UINT16 Address
+ )
+{
+ UINT16 Patch;
+
+ // First 16-bit chunk of instruction
+ Patch = ((Address >> 12) & 0x000f); // imm4
+ Patch |= (((Address & BIT11) != 0) ? BIT10 : 0); // i
+ *Instruction = (*Instruction & ~0x040f) | Patch;
+
+ // Second 16-bit chunk of instruction
+ Patch = Address & 0x000000ff; // imm8
+ Patch |= ((Address << 4) & 0x00007000); // imm3
+ Instruction++;
+ *Instruction = (*Instruction & ~0x70ff) | Patch;
+}
+
+/**
+ Pass in a pointer to an ARM MOVW/MOVT instruction pair and
+ return the immediate data encoded in the two` instruction
+
+ @param Instructions Pointer to ARM MOVW/MOVT instruction pair
+
+ @return Immediate address encoded in the instructions
+
+**/
+UINT32
+EFIAPI
+ThumbMovwMovtImmediateAddress (
+ IN UINT16 *Instructions
+ )
+{
+ UINT16 *Word;
+ UINT16 *Top;
+
+ Word = Instructions; // MOVW
+ Top = Word + 2; // MOVT
+
+ return (ThumbMovtImmediateAddress (Top) << 16) + ThumbMovtImmediateAddress (Word);
+}
+
+
+/**
+ Update an ARM MOVW/MOVT immediate instruction instruction pair.
+
+ @param Instructions Pointer to ARM MOVW/MOVT instruction pair
+ @param Address New address to patch into the instructions
+**/
+VOID
+EFIAPI
+ThumbMovwMovtImmediatePatch (
+ IN OUT UINT16 *Instructions,
+ IN UINT32 Address
+ )
+{
+ UINT16 *Word;
+ UINT16 *Top;
+
+ Word = (UINT16 *)Instructions; // MOVW
+ Top = Word + 2; // MOVT
+
+ ThumbMovtImmediatePatch (Word, (UINT16)(Address & 0xffff));
+ ThumbMovtImmediatePatch (Top, (UINT16)(Address >> 16));
+}
+
+
+/**
+ Performs an ARM-based specific relocation fixup and is a no-op on other
+ instruction sets.
+
+ @param Reloc Pointer to the relocation record.
+ @param Fixup Pointer to the address to fix up.
+ @param FixupData Pointer to a buffer to log the fixups.
+ @param Adjust The offset to adjust the fixup.
+
+ @return Status code.
+
+**/
+RETURN_STATUS
+PeCoffLoaderRelocateArmImage (
+ IN UINT16 **Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
+ )
+{
+ UINT16 *Fixup16;
+ UINT32 FixupVal;
+
+ Fixup16 = (UINT16 *) Fixup;
+
+ switch ((**Reloc) >> 12) {
+
+ case EFI_IMAGE_REL_BASED_ARM_MOV32T:
+ FixupVal = ThumbMovwMovtImmediateAddress (Fixup16) + (UINT32)Adjust;
+ ThumbMovwMovtImmediatePatch (Fixup16, FixupVal);
+
+
+ if (*FixupData != NULL) {
+ *FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
+ CopyMem (*FixupData, Fixup16, sizeof (UINT64));
+ *FixupData = *FixupData + sizeof(UINT64);
+ }
+ break;
+
+ case EFI_IMAGE_REL_BASED_ARM_MOV32A:
+ // break omitted - ARM instruction encoding not implemented
+ default:
+ return RETURN_UNSUPPORTED;
+ }
+
+ return RETURN_SUCCESS;
+}
diff --git a/roms/edk2/BaseTools/Source/C/Common/SimpleFileParsing.c b/roms/edk2/BaseTools/Source/C/Common/SimpleFileParsing.c
new file mode 100644
index 000000000..eb6abea1b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/SimpleFileParsing.c
@@ -0,0 +1,1429 @@
+/** @file
+Generic but simple file parsing routines.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+--*/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+#include "CommonLib.h"
+#include "EfiUtilityMsgs.h"
+#include "SimpleFileParsing.h"
+
+#ifndef MAX_PATH
+#define MAX_PATH 255
+#endif
+//
+// just in case we get in an endless loop.
+//
+#define MAX_NEST_DEPTH 20
+//
+// number of wchars
+//
+#define MAX_STRING_IDENTIFIER_NAME 100
+
+#define T_CHAR_SPACE ' '
+#define T_CHAR_NULL 0
+#define T_CHAR_CR '\r'
+#define T_CHAR_TAB '\t'
+#define T_CHAR_LF '\n'
+#define T_CHAR_SLASH '/'
+#define T_CHAR_BACKSLASH '\\'
+#define T_CHAR_DOUBLE_QUOTE '"'
+#define T_CHAR_LC_X 'x'
+#define T_CHAR_0 '0'
+#define T_CHAR_STAR '*'
+
+//
+// We keep a linked list of these for the source files we process
+//
+typedef struct _SOURCE_FILE {
+ FILE *Fptr;
+ CHAR8 *FileBuffer;
+ CHAR8 *FileBufferPtr;
+ UINTN FileSize;
+ CHAR8 FileName[MAX_PATH];
+ UINTN LineNum;
+ BOOLEAN EndOfFile;
+ BOOLEAN SkipToHash;
+ struct _SOURCE_FILE *Previous;
+ struct _SOURCE_FILE *Next;
+ CHAR8 ControlCharacter;
+} SOURCE_FILE;
+
+typedef struct {
+ CHAR8 *FileBufferPtr;
+} FILE_POSITION;
+
+//
+// Keep all our module globals in this structure
+//
+STATIC struct {
+ SOURCE_FILE SourceFile;
+ BOOLEAN VerboseFile;
+ BOOLEAN VerboseToken;
+} mGlobals;
+
+STATIC
+UINTN
+t_strcmp (
+ CHAR8 *Buffer,
+ CHAR8 *Str
+ );
+
+STATIC
+UINTN
+t_strncmp (
+ CHAR8 *Str1,
+ CHAR8 *Str2,
+ INTN Len
+ );
+
+STATIC
+UINTN
+t_strlen (
+ CHAR8 *Str
+ );
+
+STATIC
+VOID
+RewindFile (
+ SOURCE_FILE *SourceFile
+ );
+
+STATIC
+BOOLEAN
+IsWhiteSpace (
+ SOURCE_FILE *SourceFile
+ );
+
+STATIC
+UINTN
+SkipWhiteSpace (
+ SOURCE_FILE *SourceFile
+ );
+
+STATIC
+BOOLEAN
+EndOfFile (
+ SOURCE_FILE *SourceFile
+ );
+
+STATIC
+VOID
+PreprocessFile (
+ SOURCE_FILE *SourceFile
+ );
+
+STATIC
+CHAR8 *
+t_strcpy (
+ CHAR8 *Dest,
+ CHAR8 *Src
+ );
+
+STATIC
+STATUS
+ProcessIncludeFile (
+ SOURCE_FILE *SourceFile,
+ SOURCE_FILE *ParentSourceFile
+ );
+
+STATIC
+STATUS
+ProcessFile (
+ SOURCE_FILE *SourceFile
+ );
+
+STATIC
+STATUS
+GetFilePosition (
+ FILE_POSITION *Fpos
+ );
+
+STATIC
+STATUS
+SetFilePosition (
+ FILE_POSITION *Fpos
+ );
+
+STATUS
+SFPInit (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+ None.
+
+Returns:
+ STATUS_SUCCESS always
+
+--*/
+{
+ memset ((VOID *) &mGlobals, 0, sizeof (mGlobals));
+ return STATUS_SUCCESS;
+}
+
+UINTN
+SFPGetLineNumber (
+ VOID
+ )
+/*++
+
+Routine Description:
+ Return the line number of the file we're parsing. Used
+ for error reporting purposes.
+
+Arguments:
+ None.
+
+Returns:
+ The line number, or 0 if no file is being processed
+
+--*/
+{
+ return mGlobals.SourceFile.LineNum;
+}
+
+CHAR8 *
+SFPGetFileName (
+ VOID
+ )
+/*++
+
+Routine Description:
+ Return the name of the file we're parsing. Used
+ for error reporting purposes.
+
+Arguments:
+ None.
+
+Returns:
+ A pointer to the file name. Null if no file is being
+ processed.
+
+--*/
+{
+ if (mGlobals.SourceFile.FileName[0]) {
+ return mGlobals.SourceFile.FileName;
+ }
+
+ return NULL;
+}
+
+STATUS
+SFPOpenFile (
+ CHAR8 *FileName
+ )
+/*++
+
+Routine Description:
+ Open a file for parsing.
+
+Arguments:
+ FileName - name of the file to parse
+
+Returns:
+
+
+--*/
+{
+ STATUS Status;
+ t_strcpy (mGlobals.SourceFile.FileName, FileName);
+ Status = ProcessIncludeFile (&mGlobals.SourceFile, NULL);
+ return Status;
+}
+
+BOOLEAN
+SFPIsToken (
+ CHAR8 *Str
+ )
+/*++
+
+Routine Description:
+ Check to see if the specified token is found at
+ the current position in the input file.
+
+Arguments:
+ Str - the token to look for
+
+Returns:
+ TRUE - the token is next
+ FALSE - the token is not next
+
+Notes:
+ We do a simple string comparison on this function. It is
+ the responsibility of the caller to ensure that the token
+ is not a subset of some other token.
+
+ The file pointer is advanced past the token in the input file.
+
+--*/
+{
+ UINTN Len;
+ SkipWhiteSpace (&mGlobals.SourceFile);
+ if (EndOfFile (&mGlobals.SourceFile)) {
+ return FALSE;
+ }
+
+ if ((Len = t_strcmp (mGlobals.SourceFile.FileBufferPtr, Str)) > 0) {
+ mGlobals.SourceFile.FileBufferPtr += Len;
+ if (mGlobals.VerboseToken) {
+ printf ("Token: '%s'\n", Str);
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+BOOLEAN
+SFPIsKeyword (
+ CHAR8 *Str
+ )
+/*++
+
+Routine Description:
+ Check to see if the specified keyword is found at
+ the current position in the input file.
+
+Arguments:
+ Str - keyword to look for
+
+Returns:
+ TRUE - the keyword is next
+ FALSE - the keyword is not next
+
+Notes:
+ A keyword is defined as a "special" string that has a non-alphanumeric
+ character following it.
+
+--*/
+{
+ UINTN Len;
+ SkipWhiteSpace (&mGlobals.SourceFile);
+ if (EndOfFile (&mGlobals.SourceFile)) {
+ return FALSE;
+ }
+
+ if ((Len = t_strcmp (mGlobals.SourceFile.FileBufferPtr, Str)) > 0) {
+ if (isalnum ((int)mGlobals.SourceFile.FileBufferPtr[Len])) {
+ return FALSE;
+ }
+
+ mGlobals.SourceFile.FileBufferPtr += Len;
+ if (mGlobals.VerboseToken) {
+ printf ("Token: '%s'\n", Str);
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+BOOLEAN
+SFPGetNextToken (
+ CHAR8 *Str,
+ UINTN Len
+ )
+/*++
+
+Routine Description:
+ Get the next token from the input stream.
+
+Arguments:
+ Str - pointer to a copy of the next token
+ Len - size of buffer pointed to by Str
+
+Returns:
+ TRUE - next token successfully returned
+ FALSE - otherwise
+
+Notes:
+ Preceding white space is ignored.
+ The parser's buffer pointer is advanced past the end of the
+ token.
+
+--*/
+{
+ UINTN Index;
+ CHAR8 TempChar;
+
+ SkipWhiteSpace (&mGlobals.SourceFile);
+ if (EndOfFile (&mGlobals.SourceFile)) {
+ return FALSE;
+ }
+ //
+ // Have to have enough string for at least one char and a null-terminator
+ //
+ if (Len < 2) {
+ return FALSE;
+ }
+ //
+ // Look at the first character. If it's an identifier, then treat it
+ // as such
+ //
+ TempChar = mGlobals.SourceFile.FileBufferPtr[0];
+ if (((TempChar >= 'a') && (TempChar <= 'z')) || ((TempChar >= 'A') && (TempChar <= 'Z')) || (TempChar == '_')) {
+ Str[0] = TempChar;
+ mGlobals.SourceFile.FileBufferPtr++;
+ Index = 1;
+ while (!EndOfFile (&mGlobals.SourceFile) && (Index < Len)) {
+ TempChar = mGlobals.SourceFile.FileBufferPtr[0];
+ if (((TempChar >= 'a') && (TempChar <= 'z')) ||
+ ((TempChar >= 'A') && (TempChar <= 'Z')) ||
+ ((TempChar >= '0') && (TempChar <= '9')) ||
+ (TempChar == '_')
+ ) {
+ Str[Index] = mGlobals.SourceFile.FileBufferPtr[0];
+ mGlobals.SourceFile.FileBufferPtr++;
+ Index++;
+ } else {
+ //
+ // Invalid character for symbol name, so break out
+ //
+ break;
+ }
+ }
+ //
+ // Null terminate and return success
+ //
+ Str[Index] = 0;
+ return TRUE;
+ } else if ((TempChar == ')') || (TempChar == '(') || (TempChar == '*')) {
+ Str[0] = mGlobals.SourceFile.FileBufferPtr[0];
+ mGlobals.SourceFile.FileBufferPtr++;
+ Str[1] = 0;
+ return TRUE;
+ } else {
+ //
+ // Everything else is white-space (or EOF) separated
+ //
+ Index = 0;
+ while (!EndOfFile (&mGlobals.SourceFile) && (Index < Len)) {
+ if (IsWhiteSpace (&mGlobals.SourceFile)) {
+ if (Index > 0) {
+ Str[Index] = 0;
+ return TRUE;
+ }
+
+ return FALSE;
+ } else {
+ Str[Index] = mGlobals.SourceFile.FileBufferPtr[0];
+ mGlobals.SourceFile.FileBufferPtr++;
+ Index++;
+ }
+ }
+ //
+ // See if we just ran out of file contents, but did find a token
+ //
+ if ((Index > 0) && EndOfFile (&mGlobals.SourceFile)) {
+ Str[Index] = 0;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+BOOLEAN
+SFPGetGuidToken (
+ CHAR8 *Str,
+ UINT32 Len
+ )
+/*++
+
+Routine Description:
+ Parse a GUID from the input stream. Stop when you discover white space.
+
+Arguments:
+ Str - pointer to a copy of the next token
+ Len - size of buffer pointed to by Str
+
+Returns:
+ TRUE - GUID string returned successfully
+ FALSE - otherwise
+
+--*/
+{
+ UINT32 Index;
+ SkipWhiteSpace (&mGlobals.SourceFile);
+ if (EndOfFile (&mGlobals.SourceFile)) {
+ return FALSE;
+ }
+
+ Index = 0;
+ while (!EndOfFile (&mGlobals.SourceFile) && (Index < Len)) {
+ if (IsWhiteSpace (&mGlobals.SourceFile)) {
+ if (Index > 0) {
+ Str[Index] = 0;
+ return TRUE;
+ }
+
+ return FALSE;
+ } else {
+ Str[Index] = mGlobals.SourceFile.FileBufferPtr[0];
+ mGlobals.SourceFile.FileBufferPtr++;
+ Index++;
+ }
+ }
+
+ return FALSE;
+}
+
+BOOLEAN
+SFPSkipToToken (
+ CHAR8 *Str
+ )
+{
+ UINTN Len;
+ CHAR8 *SavePos;
+ Len = t_strlen (Str);
+ SavePos = mGlobals.SourceFile.FileBufferPtr;
+ SkipWhiteSpace (&mGlobals.SourceFile);
+ while (!EndOfFile (&mGlobals.SourceFile)) {
+ if (t_strncmp (Str, mGlobals.SourceFile.FileBufferPtr, Len) == 0) {
+ mGlobals.SourceFile.FileBufferPtr += Len;
+ return TRUE;
+ }
+
+ mGlobals.SourceFile.FileBufferPtr++;
+ SkipWhiteSpace (&mGlobals.SourceFile);
+ }
+
+ mGlobals.SourceFile.FileBufferPtr = SavePos;
+ return FALSE;
+}
+
+BOOLEAN
+SFPGetNumber (
+ UINTN *Value
+ )
+/*++
+
+Routine Description:
+ Check the token at the current file position for a numeric value.
+ May be either decimal or hex.
+
+Arguments:
+ Value - pointer where to store the value
+
+Returns:
+ FALSE - current token is not a number
+ TRUE - current token is a number
+
+--*/
+{
+ int Val;
+
+ SkipWhiteSpace (&mGlobals.SourceFile);
+ if (EndOfFile (&mGlobals.SourceFile)) {
+ return FALSE;
+ }
+
+ if (isdigit ((int)mGlobals.SourceFile.FileBufferPtr[0])) {
+ //
+ // Check for hex value
+ //
+ if ((mGlobals.SourceFile.FileBufferPtr[0] == T_CHAR_0) && (mGlobals.SourceFile.FileBufferPtr[1] == T_CHAR_LC_X)) {
+ if (!isxdigit ((int)mGlobals.SourceFile.FileBufferPtr[2])) {
+ return FALSE;
+ }
+
+ mGlobals.SourceFile.FileBufferPtr += 2;
+ sscanf (mGlobals.SourceFile.FileBufferPtr, "%x", &Val);
+ *Value = (UINT32) Val;
+ while (isxdigit ((int)mGlobals.SourceFile.FileBufferPtr[0])) {
+ mGlobals.SourceFile.FileBufferPtr++;
+ }
+
+ return TRUE;
+ } else {
+ *Value = atoi (mGlobals.SourceFile.FileBufferPtr);
+ while (isdigit ((int)mGlobals.SourceFile.FileBufferPtr[0])) {
+ mGlobals.SourceFile.FileBufferPtr++;
+ }
+
+ return TRUE;
+ }
+ } else {
+ return FALSE;
+ }
+}
+
+STATUS
+SFPCloseFile (
+ VOID
+ )
+/*++
+
+Routine Description:
+ Close the file being parsed.
+
+Arguments:
+ None.
+
+Returns:
+ STATUS_SUCCESS - the file was closed
+ STATUS_ERROR - no file is currently open
+
+--*/
+{
+ if (mGlobals.SourceFile.FileBuffer != NULL) {
+ free (mGlobals.SourceFile.FileBuffer);
+ memset (&mGlobals.SourceFile, 0, sizeof (mGlobals.SourceFile));
+ return STATUS_SUCCESS;
+ }
+
+ return STATUS_ERROR;
+}
+
+STATIC
+STATUS
+ProcessIncludeFile (
+ SOURCE_FILE *SourceFile,
+ SOURCE_FILE *ParentSourceFile
+ )
+/*++
+
+Routine Description:
+
+ Given a source file, open the file and parse it
+
+Arguments:
+
+ SourceFile - name of file to parse
+ ParentSourceFile - for error reporting purposes, the file that #included SourceFile.
+
+Returns:
+
+ Standard status.
+
+--*/
+{
+ STATIC UINTN NestDepth = 0;
+ CHAR8 FoundFileName[MAX_PATH];
+ STATUS Status;
+
+ Status = STATUS_SUCCESS;
+ NestDepth++;
+ //
+ // Print the file being processed. Indent so you can tell the include nesting
+ // depth.
+ //
+ if (mGlobals.VerboseFile) {
+ fprintf (stdout, "%*cProcessing file '%s'\n", (int)NestDepth * 2, ' ', SourceFile->FileName);
+ fprintf (stdout, "Parent source file = '%s'\n", ParentSourceFile->FileName);
+ }
+
+ //
+ // Make sure we didn't exceed our maximum nesting depth
+ //
+ if (NestDepth > MAX_NEST_DEPTH) {
+ Error (NULL, 0, 3001, "Not Supported", "%s exceeds max nesting depth (%u)", SourceFile->FileName, (unsigned) NestDepth);
+ Status = STATUS_ERROR;
+ goto Finish;
+ }
+ //
+ // Try to open the file locally, and if that fails try along our include paths.
+ //
+ strcpy (FoundFileName, SourceFile->FileName);
+ if ((SourceFile->Fptr = fopen (LongFilePath (FoundFileName), "rb")) == NULL) {
+ return STATUS_ERROR;
+ }
+ //
+ // Process the file found
+ //
+ ProcessFile (SourceFile);
+Finish:
+ //
+ // Close open files and return status
+ //
+ if (SourceFile->Fptr != NULL) {
+ fclose (SourceFile->Fptr);
+ SourceFile->Fptr = NULL;
+ }
+
+ return Status;
+}
+
+STATIC
+STATUS
+ProcessFile (
+ SOURCE_FILE *SourceFile
+ )
+/*++
+
+Routine Description:
+
+ Given a source file that's been opened, read the contents into an internal
+ buffer and pre-process it to remove comments.
+
+Arguments:
+
+ SourceFile - structure containing info on the file to process
+
+Returns:
+
+ Standard status.
+
+--*/
+{
+ //
+ // Get the file size, and then read the entire thing into memory.
+ // Allocate extra space for a terminator character.
+ //
+ fseek (SourceFile->Fptr, 0, SEEK_END);
+ SourceFile->FileSize = ftell (SourceFile->Fptr);
+ if (mGlobals.VerboseFile) {
+ printf ("FileSize = %u (0x%X)\n", (unsigned) SourceFile->FileSize, (unsigned) SourceFile->FileSize);
+ }
+
+ fseek (SourceFile->Fptr, 0, SEEK_SET);
+ SourceFile->FileBuffer = (CHAR8 *) malloc (SourceFile->FileSize + sizeof (CHAR8 ));
+ if (SourceFile->FileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource: memory cannot be allocated", NULL);
+ return STATUS_ERROR;
+ }
+
+ fread ((VOID *) SourceFile->FileBuffer, SourceFile->FileSize, 1, SourceFile->Fptr);
+ SourceFile->FileBuffer[(SourceFile->FileSize / sizeof (CHAR8 ))] = T_CHAR_NULL;
+ //
+ // Pre-process the file to replace comments with spaces
+ //
+ PreprocessFile (SourceFile);
+ SourceFile->LineNum = 1;
+ return STATUS_SUCCESS;
+}
+
+STATIC
+VOID
+PreprocessFile (
+ SOURCE_FILE *SourceFile
+ )
+/*++
+
+Routine Description:
+ Preprocess a file to replace all carriage returns with NULLs so
+ we can print lines (as part of error messages) from the file to the screen.
+
+Arguments:
+ SourceFile - structure that we use to keep track of an input file.
+
+Returns:
+ Nothing.
+
+--*/
+{
+ BOOLEAN InComment;
+ BOOLEAN SlashSlashComment;
+ int LineNum;
+
+ RewindFile (SourceFile);
+ InComment = FALSE;
+ SlashSlashComment = FALSE;
+ while (!EndOfFile (SourceFile)) {
+ //
+ // If a line-feed, then no longer in a comment if we're in a // comment
+ //
+ if (SourceFile->FileBufferPtr[0] == T_CHAR_LF) {
+ SourceFile->FileBufferPtr++;
+ SourceFile->LineNum++;
+ if (InComment && SlashSlashComment) {
+ InComment = FALSE;
+ SlashSlashComment = FALSE;
+ }
+ } else if (SourceFile->FileBufferPtr[0] == T_CHAR_CR) {
+ //
+ // Replace all carriage returns with a NULL so we can print stuff
+ //
+ SourceFile->FileBufferPtr[0] = 0;
+ SourceFile->FileBufferPtr++;
+ //
+ // Check for */ comment end
+ //
+ } else if (InComment &&
+ !SlashSlashComment &&
+ (SourceFile->FileBufferPtr[0] == T_CHAR_STAR) &&
+ (SourceFile->FileBufferPtr[1] == T_CHAR_SLASH)
+ ) {
+ SourceFile->FileBufferPtr[0] = T_CHAR_SPACE;
+ SourceFile->FileBufferPtr++;
+ SourceFile->FileBufferPtr[0] = T_CHAR_SPACE;
+ SourceFile->FileBufferPtr++;
+ InComment = FALSE;
+ } else if (InComment) {
+ SourceFile->FileBufferPtr[0] = T_CHAR_SPACE;
+ SourceFile->FileBufferPtr++;
+ //
+ // Check for // comments
+ //
+ } else if ((SourceFile->FileBufferPtr[0] == T_CHAR_SLASH) && (SourceFile->FileBufferPtr[1] == T_CHAR_SLASH)) {
+ InComment = TRUE;
+ SlashSlashComment = TRUE;
+ //
+ // Check for /* comment start
+ //
+ } else if ((SourceFile->FileBufferPtr[0] == T_CHAR_SLASH) && (SourceFile->FileBufferPtr[1] == T_CHAR_STAR)) {
+ SourceFile->FileBufferPtr[0] = T_CHAR_SPACE;
+ SourceFile->FileBufferPtr++;
+ SourceFile->FileBufferPtr[0] = T_CHAR_SPACE;
+ SourceFile->FileBufferPtr++;
+ SlashSlashComment = FALSE;
+ InComment = TRUE;
+ } else {
+ SourceFile->FileBufferPtr++;
+ }
+ }
+ //
+ // Could check for end-of-file and still in a comment, but
+ // should not be necessary. So just restore the file pointers.
+ //
+ RewindFile (SourceFile);
+ //
+ // Dump the reformatted file if verbose mode
+ //
+ if (mGlobals.VerboseFile) {
+ LineNum = 1;
+ printf ("%04d: ", LineNum);
+ while (!EndOfFile (SourceFile)) {
+ if (SourceFile->FileBufferPtr[0] == T_CHAR_LF) {
+ printf ("'\n%04d: '", ++LineNum);
+ } else {
+ printf ("%c", SourceFile->FileBufferPtr[0]);
+ }
+
+ SourceFile->FileBufferPtr++;
+ }
+
+ printf ("'\n");
+ printf ("FileSize = %u (0x%X)\n", (unsigned)SourceFile->FileSize, (unsigned)SourceFile->FileSize);
+ RewindFile (SourceFile);
+ }
+}
+
+BOOLEAN
+SFPGetQuotedString (
+ CHAR8 *Str,
+ INTN Length
+ )
+/*++
+
+Routine Description:
+ Retrieve a quoted-string from the input file.
+
+Arguments:
+ Str - pointer to a copy of the quoted string parsed
+ Length - size of buffer pointed to by Str
+
+Returns:
+ TRUE - next token in input stream was a quoted string, and
+ the string value was returned in Str
+ FALSE - otherwise
+
+--*/
+{
+ SkipWhiteSpace (&mGlobals.SourceFile);
+ if (EndOfFile (&mGlobals.SourceFile)) {
+ return FALSE;
+ }
+
+ if (mGlobals.SourceFile.FileBufferPtr[0] == T_CHAR_DOUBLE_QUOTE) {
+ mGlobals.SourceFile.FileBufferPtr++;
+ while (Length > 0) {
+ if (EndOfFile (&mGlobals.SourceFile)) {
+ return FALSE;
+ }
+ //
+ // Check for closing quote
+ //
+ if (mGlobals.SourceFile.FileBufferPtr[0] == T_CHAR_DOUBLE_QUOTE) {
+ mGlobals.SourceFile.FileBufferPtr++;
+ *Str = 0;
+ return TRUE;
+ }
+
+ *Str = mGlobals.SourceFile.FileBufferPtr[0];
+ Str++;
+ Length--;
+ mGlobals.SourceFile.FileBufferPtr++;
+ }
+ }
+ //
+ // First character was not a quote, or the input string length was
+ // insufficient to contain the quoted string, so return failure code.
+ //
+ return FALSE;
+}
+
+BOOLEAN
+SFPIsEOF (
+ VOID
+ )
+/*++
+
+Routine Description:
+ Return TRUE of FALSE to indicate whether or not we've reached the end of the
+ file we're parsing.
+
+Arguments:
+ NA
+
+Returns:
+ TRUE - EOF reached
+ FALSE - otherwise
+
+--*/
+{
+ SkipWhiteSpace (&mGlobals.SourceFile);
+ return EndOfFile (&mGlobals.SourceFile);
+}
+
+#if 0
+STATIC
+CHAR8 *
+GetQuotedString (
+ SOURCE_FILE *SourceFile,
+ BOOLEAN Optional
+ )
+{
+ CHAR8 *String;
+ CHAR8 *Start;
+ CHAR8 *Ptr;
+ UINTN Len;
+ BOOLEAN PreviousBackslash;
+
+ if (SourceFile->FileBufferPtr[0] != T_CHAR_DOUBLE_QUOTE) {
+ if (Optional == FALSE) {
+ Error (SourceFile->FileName, SourceFile->LineNum, 0, "expected quoted string", "%S", SourceFile->FileBufferPtr);
+ }
+
+ return NULL;
+ }
+
+ Len = 0;
+ SourceFile->FileBufferPtr++;
+ Start = Ptr = SourceFile->FileBufferPtr;
+ PreviousBackslash = FALSE;
+ while (!EndOfFile (SourceFile)) {
+ if ((SourceFile->FileBufferPtr[0] == T_CHAR_DOUBLE_QUOTE) && (PreviousBackslash == FALSE)) {
+ break;
+ } else if (SourceFile->FileBufferPtr[0] == T_CHAR_CR) {
+ Warning (SourceFile->FileName, SourceFile->LineNum, 0, "carriage return found in quoted string", "%S", Start);
+ PreviousBackslash = FALSE;
+ } else if (SourceFile->FileBufferPtr[0] == T_CHAR_BACKSLASH) {
+ PreviousBackslash = TRUE;
+ } else {
+ PreviousBackslash = FALSE;
+ }
+
+ SourceFile->FileBufferPtr++;
+ Len++;
+ }
+
+ if (SourceFile->FileBufferPtr[0] != T_CHAR_DOUBLE_QUOTE) {
+ Warning (SourceFile->FileName, SourceFile->LineNum, 0, "missing closing quote on string", "%S", Start);
+ } else {
+ SourceFile->FileBufferPtr++;
+ }
+ //
+ // Now allocate memory for the string and save it off
+ //
+ String = (CHAR8 *) malloc ((Len + 1) * sizeof (CHAR8 ));
+ if (String == NULL) {
+ Error (NULL, 0, 4001, "Resource: memory cannot be allocated", NULL);
+ return NULL;
+ }
+ //
+ // Copy the string from the file buffer to the local copy.
+ // We do no reformatting of it whatsoever at this point.
+ //
+ Ptr = String;
+ while (Len > 0) {
+ *Ptr = *Start;
+ Start++;
+ Ptr++;
+ Len--;
+ }
+
+ *Ptr = 0;
+ return String;
+}
+#endif
+STATIC
+BOOLEAN
+EndOfFile (
+ SOURCE_FILE *SourceFile
+ )
+{
+ //
+ // The file buffer pointer will typically get updated before the End-of-file flag in the
+ // source file structure, so check it first.
+ //
+ if (SourceFile->FileBufferPtr >= SourceFile->FileBuffer + SourceFile->FileSize / sizeof (CHAR8 )) {
+ SourceFile->EndOfFile = TRUE;
+ return TRUE;
+ }
+
+ if (SourceFile->EndOfFile) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+#if 0
+STATIC
+VOID
+ProcessTokenInclude (
+ SOURCE_FILE *SourceFile
+ )
+{
+ CHAR8 IncludeFileName[MAX_PATH];
+ CHAR8 *To;
+ UINTN Len;
+ BOOLEAN ReportedError;
+ SOURCE_FILE IncludedSourceFile;
+
+ ReportedError = FALSE;
+ if (SkipWhiteSpace (SourceFile) == 0) {
+ Warning (SourceFile->FileName, SourceFile->LineNum, 0, "expected whitespace following #include keyword", NULL);
+ }
+ //
+ // Should be quoted file name
+ //
+ if (SourceFile->FileBufferPtr[0] != T_CHAR_DOUBLE_QUOTE) {
+ Error (SourceFile->FileName, SourceFile->LineNum, 0, "expected quoted include file name", NULL);
+ goto FailDone;
+ }
+
+ SourceFile->FileBufferPtr++;
+ //
+ // Copy the filename as ascii to our local string
+ //
+ To = IncludeFileName;
+ Len = 0;
+ while (!EndOfFile (SourceFile)) {
+ if ((SourceFile->FileBufferPtr[0] == T_CHAR_CR) || (SourceFile->FileBufferPtr[0] == T_CHAR_LF)) {
+ Error (SourceFile->FileName, SourceFile->LineNum, 0, "end-of-line found in quoted include file name", NULL);
+ goto FailDone;
+ }
+
+ if (SourceFile->FileBufferPtr[0] == T_CHAR_DOUBLE_QUOTE) {
+ SourceFile->FileBufferPtr++;
+ break;
+ }
+ //
+ // If too long, then report the error once and process until the closing quote
+ //
+ Len++;
+ if (!ReportedError && (Len >= sizeof (IncludeFileName))) {
+ Error (SourceFile->FileName, SourceFile->LineNum, 0, "length of include file name exceeds limit", NULL);
+ ReportedError = TRUE;
+ }
+
+ if (!ReportedError) {
+ *To = (CHAR8 ) SourceFile->FileBufferPtr[0];
+ To++;
+ }
+
+ SourceFile->FileBufferPtr++;
+ }
+
+ if (!ReportedError) {
+ *To = 0;
+ memset ((CHAR8 *) &IncludedSourceFile, 0, sizeof (SOURCE_FILE));
+ strcpy (IncludedSourceFile.FileName, IncludeFileName);
+ ProcessIncludeFile (&IncludedSourceFile, SourceFile);
+ }
+
+ return ;
+FailDone:
+ //
+ // Error recovery -- skip to next #
+ //
+ SourceFile->SkipToHash = TRUE;
+}
+#endif
+STATIC
+BOOLEAN
+IsWhiteSpace (
+ SOURCE_FILE *SourceFile
+ )
+{
+ switch (*SourceFile->FileBufferPtr) {
+ case T_CHAR_NULL:
+ case T_CHAR_CR:
+ case T_CHAR_SPACE:
+ case T_CHAR_TAB:
+ case T_CHAR_LF:
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+}
+
+UINTN
+SkipWhiteSpace (
+ SOURCE_FILE *SourceFile
+ )
+{
+ UINTN Count;
+
+ Count = 0;
+ while (!EndOfFile (SourceFile)) {
+ Count++;
+ switch (*SourceFile->FileBufferPtr) {
+ case T_CHAR_NULL:
+ case T_CHAR_CR:
+ case T_CHAR_SPACE:
+ case T_CHAR_TAB:
+ SourceFile->FileBufferPtr++;
+ break;
+
+ case T_CHAR_LF:
+ SourceFile->FileBufferPtr++;
+ SourceFile->LineNum++;
+ break;
+
+ default:
+ return Count - 1;
+ }
+ }
+ //
+ // Some tokens require trailing whitespace. If we're at the end of the
+ // file, then we count that as well.
+ //
+ if ((Count == 0) && (EndOfFile (SourceFile))) {
+ Count++;
+ }
+
+ return Count;
+}
+
+STATIC
+UINTN
+t_strcmp (
+ CHAR8 *Buffer,
+ CHAR8 *Str
+ )
+/*++
+
+Routine Description:
+ Compare two strings for equality. The string pointed to by 'Buffer' may or may not be null-terminated,
+ so only compare up to the length of Str.
+
+Arguments:
+ Buffer - pointer to first (possibly not null-terminated) string
+ Str - pointer to null-terminated string to compare to Buffer
+
+Returns:
+ Number of bytes matched if exact match
+ 0 if Buffer does not start with Str
+
+--*/
+{
+ UINTN Len;
+
+ Len = 0;
+ while (*Str && (*Str == *Buffer)) {
+ Buffer++;
+ Str++;
+ Len++;
+ }
+
+ if (*Str) {
+ return 0;
+ }
+
+ return Len;
+}
+
+STATIC
+UINTN
+t_strlen (
+ CHAR8 *Str
+ )
+{
+ UINTN Len;
+ Len = 0;
+ while (*Str) {
+ Len++;
+ Str++;
+ }
+
+ return Len;
+}
+
+STATIC
+UINTN
+t_strncmp (
+ CHAR8 *Str1,
+ CHAR8 *Str2,
+ INTN Len
+ )
+{
+ while (Len > 0) {
+ if (*Str1 != *Str2) {
+ return Len;
+ }
+
+ Len--;
+ Str1++;
+ Str2++;
+ }
+
+ return 0;
+}
+
+STATIC
+CHAR8 *
+t_strcpy (
+ CHAR8 *Dest,
+ CHAR8 *Src
+ )
+{
+ CHAR8 *SaveDest;
+ SaveDest = Dest;
+ while (*Src) {
+ *Dest = *Src;
+ Dest++;
+ Src++;
+ }
+
+ *Dest = 0;
+ return SaveDest;
+}
+
+STATIC
+VOID
+RewindFile (
+ SOURCE_FILE *SourceFile
+ )
+{
+ SourceFile->LineNum = 1;
+ SourceFile->FileBufferPtr = SourceFile->FileBuffer;
+ SourceFile->EndOfFile = 0;
+}
+
+STATIC
+UINT32
+GetHexChars (
+ CHAR8 *Buffer,
+ UINT32 BufferLen
+ )
+{
+ UINT32 Len;
+ Len = 0;
+ while (!EndOfFile (&mGlobals.SourceFile) && (Len < BufferLen)) {
+ if (isxdigit ((int)mGlobals.SourceFile.FileBufferPtr[0])) {
+ Buffer[Len] = mGlobals.SourceFile.FileBufferPtr[0];
+ Len++;
+ mGlobals.SourceFile.FileBufferPtr++;
+ } else {
+ break;
+ }
+ }
+ //
+ // Null terminate if we can
+ //
+ if ((Len > 0) && (Len < BufferLen)) {
+ Buffer[Len] = 0;
+ }
+
+ return Len;
+}
+
+BOOLEAN
+SFPGetGuid (
+ INTN GuidStyle,
+ EFI_GUID *Value
+ )
+/*++
+
+Routine Description:
+ Parse a GUID from the input stream. Stop when you discover white space.
+
+Arguments:
+ GuidStyle - Style of the following GUID token
+ Value - pointer to EFI_GUID struct for output
+
+Returns:
+ TRUE - GUID string parsed successfully
+ FALSE - otherwise
+
+ GUID styles
+ Style[0] 12345678-1234-5678-AAAA-BBBBCCCCDDDD
+
+--*/
+{
+ INT32 Value32;
+ UINT32 Index;
+ FILE_POSITION FPos;
+ CHAR8 TempString[20];
+ CHAR8 TempString2[3];
+ CHAR8 *From;
+ CHAR8 *To;
+ UINT32 Len;
+ BOOLEAN Status;
+
+ Status = FALSE;
+ //
+ // Skip white space, then start parsing
+ //
+ SkipWhiteSpace (&mGlobals.SourceFile);
+ GetFilePosition (&FPos);
+ if (EndOfFile (&mGlobals.SourceFile)) {
+ return FALSE;
+ }
+
+ if (GuidStyle == PARSE_GUID_STYLE_5_FIELDS) {
+ //
+ // Style[0] 12345678-1234-5678-AAAA-BBBBCCCCDDDD
+ //
+ Len = GetHexChars (TempString, sizeof (TempString));
+ if ((Len == 0) || (Len > 8)) {
+ goto Done;
+ }
+
+ sscanf (TempString, "%x", &Value32);
+ Value->Data1 = Value32;
+ //
+ // Next two UINT16 fields
+ //
+ if (mGlobals.SourceFile.FileBufferPtr[0] != '-') {
+ goto Done;
+ }
+
+ mGlobals.SourceFile.FileBufferPtr++;
+ Len = GetHexChars (TempString, sizeof (TempString));
+ if ((Len == 0) || (Len > 4)) {
+ goto Done;
+ }
+
+ sscanf (TempString, "%x", &Value32);
+ Value->Data2 = (UINT16) Value32;
+
+ if (mGlobals.SourceFile.FileBufferPtr[0] != '-') {
+ goto Done;
+ }
+
+ mGlobals.SourceFile.FileBufferPtr++;
+ Len = GetHexChars (TempString, sizeof (TempString));
+ if ((Len == 0) || (Len > 4)) {
+ goto Done;
+ }
+
+ sscanf (TempString, "%x", &Value32);
+ Value->Data3 = (UINT16) Value32;
+ //
+ // Parse the "AAAA" as two bytes
+ //
+ if (mGlobals.SourceFile.FileBufferPtr[0] != '-') {
+ goto Done;
+ }
+
+ mGlobals.SourceFile.FileBufferPtr++;
+ Len = GetHexChars (TempString, sizeof (TempString));
+ if ((Len == 0) || (Len > 4)) {
+ goto Done;
+ }
+
+ sscanf (TempString, "%x", &Value32);
+ Value->Data4[0] = (UINT8) (Value32 >> 8);
+ Value->Data4[1] = (UINT8) Value32;
+ if (mGlobals.SourceFile.FileBufferPtr[0] != '-') {
+ goto Done;
+ }
+
+ mGlobals.SourceFile.FileBufferPtr++;
+ //
+ // Read the last 6 bytes of the GUID
+ //
+ //
+ Len = GetHexChars (TempString, sizeof (TempString));
+ if ((Len == 0) || (Len > 12)) {
+ goto Done;
+ }
+ //
+ // Insert leading 0's to make life easier
+ //
+ if (Len != 12) {
+ From = TempString + Len - 1;
+ To = TempString + 11;
+ TempString[12] = 0;
+ while (From >= TempString) {
+ *To = *From;
+ To--;
+ From--;
+ }
+
+ while (To >= TempString) {
+ *To = '0';
+ To--;
+ }
+ }
+ //
+ // Now parse each byte
+ //
+ TempString2[2] = 0;
+ for (Index = 0; Index < 6; Index++) {
+ //
+ // Copy the two characters from the input string to something
+ // we can parse.
+ //
+ TempString2[0] = TempString[Index * 2];
+ TempString2[1] = TempString[Index * 2 + 1];
+ sscanf (TempString2, "%x", &Value32);
+ Value->Data4[Index + 2] = (UINT8) Value32;
+ }
+
+ Status = TRUE;
+ } else {
+ //
+ // Unsupported GUID style
+ //
+ return FALSE;
+ }
+
+Done:
+ if (Status == FALSE) {
+ SetFilePosition (&FPos);
+ }
+
+ return Status;
+}
+
+STATIC
+STATUS
+GetFilePosition (
+ FILE_POSITION *Fpos
+ )
+{
+ Fpos->FileBufferPtr = mGlobals.SourceFile.FileBufferPtr;
+ return STATUS_SUCCESS;
+}
+
+STATIC
+STATUS
+SetFilePosition (
+ FILE_POSITION *Fpos
+ )
+{
+ //
+ // Should check range of pointer
+ //
+ mGlobals.SourceFile.FileBufferPtr = Fpos->FileBufferPtr;
+ return STATUS_SUCCESS;
+}
diff --git a/roms/edk2/BaseTools/Source/C/Common/SimpleFileParsing.h b/roms/edk2/BaseTools/Source/C/Common/SimpleFileParsing.h
new file mode 100644
index 000000000..2fc52a6c0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/SimpleFileParsing.h
@@ -0,0 +1,104 @@
+/** @file
+Function prototypes and defines for the simple file parsing routines.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _SIMPLE_FILE_PARSING_H_
+#define _SIMPLE_FILE_PARSING_H_
+
+#include <Common/UefiBaseTypes.h>
+
+STATUS
+SFPInit (
+ VOID
+ )
+;
+
+STATUS
+SFPOpenFile (
+ CHAR8 *FileName
+ )
+;
+
+BOOLEAN
+SFPIsKeyword (
+ CHAR8 *Str
+ )
+;
+
+BOOLEAN
+SFPIsToken (
+ CHAR8 *Str
+ )
+;
+
+BOOLEAN
+SFPGetNextToken (
+ CHAR8 *Str,
+ UINTN Len
+ )
+;
+
+BOOLEAN
+SFPGetGuidToken (
+ CHAR8 *Str,
+ UINT32 Len
+ )
+;
+
+#define PARSE_GUID_STYLE_5_FIELDS 0
+
+BOOLEAN
+SFPGetGuid (
+ INTN GuidStyle,
+ EFI_GUID *Value
+ )
+;
+
+BOOLEAN
+SFPSkipToToken (
+ CHAR8 *Str
+ )
+;
+
+BOOLEAN
+SFPGetNumber (
+ UINTN *Value
+ )
+;
+
+BOOLEAN
+SFPGetQuotedString (
+ CHAR8 *Str,
+ INTN Length
+ )
+;
+
+BOOLEAN
+SFPIsEOF (
+ VOID
+ )
+;
+
+STATUS
+SFPCloseFile (
+ VOID
+ )
+;
+
+UINTN
+SFPGetLineNumber (
+ VOID
+ )
+;
+
+CHAR8 *
+SFPGetFileName (
+ VOID
+ )
+;
+
+#endif // #ifndef _SIMPLE_FILE_PARSING_H_
diff --git a/roms/edk2/BaseTools/Source/C/Common/StringFuncs.c b/roms/edk2/BaseTools/Source/C/Common/StringFuncs.c
new file mode 100644
index 000000000..50573fdf0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/StringFuncs.c
@@ -0,0 +1,413 @@
+/** @file
+Function prototypes and defines for string routines.
+
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <string.h>
+#include <ctype.h>
+#include "StringFuncs.h"
+
+//
+// Functions implementations
+//
+
+CHAR8*
+CloneString (
+ IN CHAR8 *String
+ )
+/*++
+
+Routine Description:
+
+ Allocates a new string and copies 'String' to clone it
+
+Arguments:
+
+ String The string to clone
+
+Returns:
+
+ CHAR8* - NULL if there are not enough resources
+
+--*/
+{
+ CHAR8* NewString;
+
+ NewString = malloc (strlen (String) + 1);
+ if (NewString != NULL) {
+ strcpy (NewString, String);
+ }
+
+ return NewString;
+}
+
+
+EFI_STATUS
+StripInfDscStringInPlace (
+ IN CHAR8 *String
+ )
+/*++
+
+Routine Description:
+
+ Remove all comments, leading and trailing whitespace from the string.
+
+Arguments:
+
+ String The string to 'strip'
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ CHAR8 *Pos;
+
+ if (String == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Remove leading whitespace
+ //
+ for (Pos = String; isspace ((int)*Pos); Pos++) {
+ }
+ if (Pos != String) {
+ memmove (String, Pos, strlen (Pos) + 1);
+ }
+
+ //
+ // Comment BUGBUGs!
+ //
+ // What about strings? Comment characters are okay in strings.
+ // What about multiline comments?
+ //
+
+ Pos = (CHAR8 *) strstr (String, "//");
+ if (Pos != NULL) {
+ *Pos = '\0';
+ }
+
+ Pos = (CHAR8 *) strchr (String, '#');
+ if (Pos != NULL) {
+ *Pos = '\0';
+ }
+
+ //
+ // Remove trailing whitespace
+ //
+ for (Pos = String + strlen (String);
+ ((Pos - 1) >= String) && (isspace ((int)*(Pos - 1)));
+ Pos--
+ ) {
+ }
+ *Pos = '\0';
+
+ return EFI_SUCCESS;
+}
+
+
+STRING_LIST*
+SplitStringByWhitespace (
+ IN CHAR8 *String
+ )
+/*++
+
+Routine Description:
+
+ Creates and returns a 'split' STRING_LIST by splitting the string
+ on whitespace boundaries.
+
+Arguments:
+
+ String The string to 'split'
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ CHAR8 *Pos;
+ CHAR8 *EndOfSubString;
+ CHAR8 *EndOfString;
+ STRING_LIST *Output;
+ UINTN Item;
+
+ String = CloneString (String);
+ if (String == NULL) {
+ return NULL;
+ }
+ EndOfString = String + strlen (String);
+
+ Output = NewStringList ();
+
+ for (Pos = String, Item = 0; Pos < EndOfString; Item++) {
+ while (isspace ((int)*Pos)) {
+ Pos++;
+ }
+
+ for (EndOfSubString=Pos;
+ (*EndOfSubString != '\0') && !isspace ((int)*EndOfSubString);
+ EndOfSubString++
+ ) {
+ }
+
+ if (EndOfSubString == Pos) {
+ break;
+ }
+
+ *EndOfSubString = '\0';
+
+ AppendCopyOfStringToList (&Output, Pos);
+
+ Pos = EndOfSubString + 1;
+ }
+
+ free (String);
+ return Output;
+}
+
+
+STRING_LIST*
+NewStringList (
+ )
+/*++
+
+Routine Description:
+
+ Creates a new STRING_LIST with 0 strings.
+
+Returns:
+
+ STRING_LIST* - Null if there is not enough resources to create the object.
+
+--*/
+{
+ STRING_LIST *NewList;
+ NewList = AllocateStringListStruct (0);
+ if (NewList != NULL) {
+ NewList->Count = 0;
+ }
+ return NewList;
+}
+
+
+EFI_STATUS
+AppendCopyOfStringToList (
+ IN OUT STRING_LIST **StringList,
+ IN CHAR8 *String
+ )
+/*++
+
+Routine Description:
+
+ Adds String to StringList. A new copy of String is made before it is
+ added to StringList.
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ STRING_LIST *OldList;
+ STRING_LIST *NewList;
+ CHAR8 *NewString;
+
+ OldList = *StringList;
+ NewList = AllocateStringListStruct (OldList->Count + 1);
+ if (NewList == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ NewString = CloneString (String);
+ if (NewString == NULL) {
+ free (NewList);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ memcpy (
+ NewList->Strings,
+ OldList->Strings,
+ sizeof (OldList->Strings[0]) * OldList->Count
+ );
+ NewList->Count = OldList->Count + 1;
+ NewList->Strings[OldList->Count] = NewString;
+
+ *StringList = NewList;
+ free (OldList);
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+RemoveLastStringFromList (
+ IN STRING_LIST *StringList
+ )
+/*++
+
+Routine Description:
+
+ Removes the last string from StringList and frees the memory associated
+ with it.
+
+Arguments:
+
+ StringList The string list to remove the string from
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ if (StringList->Count == 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ free (StringList->Strings[StringList->Count - 1]);
+ StringList->Count--;
+ return EFI_SUCCESS;
+}
+
+
+STRING_LIST*
+AllocateStringListStruct (
+ IN UINTN StringCount
+ )
+/*++
+
+Routine Description:
+
+ Allocates a STRING_LIST structure that can store StringCount strings.
+
+Arguments:
+
+ StringCount The number of strings that need to be stored
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ return malloc (OFFSET_OF(STRING_LIST, Strings[StringCount + 1]));
+}
+
+
+VOID
+FreeStringList (
+ IN STRING_LIST *StringList
+ )
+/*++
+
+Routine Description:
+
+ Frees all memory associated with StringList.
+
+Arguments:
+
+ StringList The string list to free
+
+Returns:
+
+ VOID
+--*/
+{
+ while (StringList->Count > 0) {
+ RemoveLastStringFromList (StringList);
+ }
+
+ free (StringList);
+}
+
+
+CHAR8*
+StringListToString (
+ IN STRING_LIST *StringList
+ )
+/*++
+
+Routine Description:
+
+ Generates a string that represents the STRING_LIST
+
+Arguments:
+
+ StringList The string list to convert to a string
+
+Returns:
+
+ CHAR8* - The string list represented with a single string. The returned
+ string must be freed by the caller.
+
+--*/
+{
+ UINTN Count;
+ UINTN Length;
+ CHAR8 *NewString;
+
+ Length = 2;
+ for (Count = 0; Count < StringList->Count; Count++) {
+ if (Count > 0) {
+ Length += 2;
+ }
+ Length += strlen (StringList->Strings[Count]) + 2;
+ }
+
+ NewString = malloc (Length + 1);
+ if (NewString == NULL) {
+ return NewString;
+ }
+ NewString[0] = '\0';
+
+ strcat (NewString, "[");
+ for (Count = 0; Count < StringList->Count; Count++) {
+ if (Count > 0) {
+ strcat (NewString, ", ");
+ }
+ strcat (NewString, "\"");
+ strcat (NewString, StringList->Strings[Count]);
+ strcat (NewString, "\"");
+ }
+ strcat (NewString, "]");
+
+ return NewString;
+}
+
+
+VOID
+PrintStringList (
+ IN STRING_LIST *StringList
+ )
+/*++
+
+Routine Description:
+
+ Prints out the string list
+
+Arguments:
+
+ StringList The string list to print
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ CHAR8* String;
+ String = StringListToString (StringList);
+ if (String != NULL) {
+ printf ("%s", String);
+ free (String);
+ }
+}
+
+
diff --git a/roms/edk2/BaseTools/Source/C/Common/StringFuncs.h b/roms/edk2/BaseTools/Source/C/Common/StringFuncs.h
new file mode 100644
index 000000000..8fc616de8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/StringFuncs.h
@@ -0,0 +1,244 @@
+/** @file
+String routines implementation
+
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFI_STRING_FUNCS_H
+#define _EFI_STRING_FUNCS_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <Common/UefiBaseTypes.h>
+
+//
+// Common data structures
+//
+typedef struct {
+ UINTN Count;
+ //
+ // Actually this array can be 0 or more items (based on Count)
+ //
+ CHAR8* Strings[1];
+} STRING_LIST;
+
+
+//
+// Functions declarations
+//
+
+CHAR8*
+CloneString (
+ IN CHAR8 *String
+ )
+;
+/**
+
+Routine Description:
+
+ Allocates a new string and copies 'String' to clone it
+
+Arguments:
+
+ String The string to clone
+
+Returns:
+
+ CHAR8* - NULL if there are not enough resources
+
+**/
+
+
+EFI_STATUS
+StripInfDscStringInPlace (
+ IN CHAR8 *String
+ )
+;
+/**
+
+Routine Description:
+
+ Remove all comments, leading and trailing whitespace from the string.
+
+Arguments:
+
+ String The string to 'strip'
+
+Returns:
+
+ EFI_STATUS
+
+**/
+
+
+STRING_LIST*
+SplitStringByWhitespace (
+ IN CHAR8 *String
+ )
+;
+/**
+
+Routine Description:
+
+ Creates and returns a 'split' STRING_LIST by splitting the string
+ on whitespace boundaries.
+
+Arguments:
+
+ String The string to 'split'
+
+Returns:
+
+ EFI_STATUS
+
+**/
+
+
+STRING_LIST*
+NewStringList (
+ )
+;
+/**
+
+Routine Description:
+
+ Creates a new STRING_LIST with 0 strings.
+
+Returns:
+
+ STRING_LIST* - Null if there is not enough resources to create the object.
+
+**/
+
+
+EFI_STATUS
+AppendCopyOfStringToList (
+ IN OUT STRING_LIST **StringList,
+ IN CHAR8 *String
+ )
+;
+/**
+
+Routine Description:
+
+ Adds String to StringList. A new copy of String is made before it is
+ added to StringList.
+
+Returns:
+
+ EFI_STATUS
+
+**/
+
+
+EFI_STATUS
+RemoveLastStringFromList (
+ IN STRING_LIST *StringList
+ )
+;
+/**
+
+Routine Description:
+
+ Removes the last string from StringList and frees the memory associated
+ with it.
+
+Arguments:
+
+ StringList The string list to remove the string from
+
+Returns:
+
+ EFI_STATUS
+
+**/
+
+
+STRING_LIST*
+AllocateStringListStruct (
+ IN UINTN StringCount
+ )
+;
+/**
+
+Routine Description:
+
+ Allocates a STRING_LIST structure that can store StringCount strings.
+
+Arguments:
+
+ StringCount The number of strings that need to be stored
+
+Returns:
+
+ EFI_STATUS
+
+**/
+
+
+VOID
+FreeStringList (
+ IN STRING_LIST *StringList
+ )
+;
+/**
+
+Routine Description:
+
+ Frees all memory associated with StringList.
+
+Arguments:
+
+ StringList The string list to free
+
+Returns:
+
+ EFI_STATUS
+
+**/
+
+
+CHAR8*
+StringListToString (
+ IN STRING_LIST *StringList
+ )
+;
+/**
+
+Routine Description:
+
+ Generates a string that represents the STRING_LIST
+
+Arguments:
+
+ StringList The string list to convert to a string
+
+Returns:
+
+ CHAR8* - The string list represented with a single string. The returned
+ string must be freed by the caller.
+
+**/
+
+
+VOID
+PrintStringList (
+ IN STRING_LIST *StringList
+ )
+;
+/**
+
+Routine Description:
+
+ Prints out the string list
+
+Arguments:
+
+ StringList The string list to print
+
+**/
+
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Common/TianoCompress.c b/roms/edk2/BaseTools/Source/C/Common/TianoCompress.c
new file mode 100644
index 000000000..030cdca02
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/TianoCompress.c
@@ -0,0 +1,1746 @@
+/** @file
+Compression routine. The compression algorithm is a mixture of LZ77 and Huffman
+coding. LZ77 transforms the source data into a sequence of Original Characters
+and Pointers to repeated strings. This sequence is further divided into Blocks
+and Huffman codings are applied to each Block.
+
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "Compress.h"
+
+//
+// Macro Definitions
+//
+#undef UINT8_MAX
+typedef INT32 NODE;
+#define UINT8_MAX 0xff
+#define UINT8_BIT 8
+#define THRESHOLD 3
+#define INIT_CRC 0
+#define WNDBIT 19
+#define WNDSIZ (1U << WNDBIT)
+#define MAXMATCH 256
+#define BLKSIZ (1U << 14) // 16 * 1024U
+#define PERC_FLAG 0x80000000U
+#define CODE_BIT 16
+#define NIL 0
+#define MAX_HASH_VAL (3 * WNDSIZ + (WNDSIZ / 512 + 1) * UINT8_MAX)
+#define HASH(p, c) ((p) + ((c) << (WNDBIT - 9)) + WNDSIZ * 2)
+#define CRCPOLY 0xA001
+#define UPDATE_CRC(c) mCrc = mCrcTable[(mCrc ^ (c)) & 0xFF] ^ (mCrc >> UINT8_BIT)
+
+//
+// C: the Char&Len Set; P: the Position Set; T: the exTra Set
+//
+#define NC (UINT8_MAX + MAXMATCH + 2 - THRESHOLD)
+#define CBIT 9
+#define NP (WNDBIT + 1)
+#define PBIT 5
+#define NT (CODE_BIT + 3)
+#define TBIT 5
+#if NT > NP
+#define NPT NT
+#else
+#define NPT NP
+#endif
+//
+// Function Prototypes
+//
+
+STATIC
+VOID
+PutDword(
+ IN UINT32 Data
+ );
+
+STATIC
+EFI_STATUS
+AllocateMemory (
+ VOID
+ );
+
+STATIC
+VOID
+FreeMemory (
+ VOID
+ );
+
+STATIC
+VOID
+InitSlide (
+ VOID
+ );
+
+STATIC
+NODE
+Child (
+ IN NODE NodeQ,
+ IN UINT8 CharC
+ );
+
+STATIC
+VOID
+MakeChild (
+ IN NODE NodeQ,
+ IN UINT8 CharC,
+ IN NODE NodeR
+ );
+
+STATIC
+VOID
+Split (
+ IN NODE Old
+ );
+
+STATIC
+VOID
+InsertNode (
+ VOID
+ );
+
+STATIC
+VOID
+DeleteNode (
+ VOID
+ );
+
+STATIC
+VOID
+GetNextMatch (
+ VOID
+ );
+
+STATIC
+EFI_STATUS
+Encode (
+ VOID
+ );
+
+STATIC
+VOID
+CountTFreq (
+ VOID
+ );
+
+STATIC
+VOID
+WritePTLen (
+ IN INT32 Number,
+ IN INT32 nbit,
+ IN INT32 Special
+ );
+
+STATIC
+VOID
+WriteCLen (
+ VOID
+ );
+
+STATIC
+VOID
+EncodeC (
+ IN INT32 Value
+ );
+
+STATIC
+VOID
+EncodeP (
+ IN UINT32 Value
+ );
+
+STATIC
+VOID
+SendBlock (
+ VOID
+ );
+
+STATIC
+VOID
+Output (
+ IN UINT32 c,
+ IN UINT32 p
+ );
+
+STATIC
+VOID
+HufEncodeStart (
+ VOID
+ );
+
+STATIC
+VOID
+HufEncodeEnd (
+ VOID
+ );
+
+STATIC
+VOID
+MakeCrcTable (
+ VOID
+ );
+
+STATIC
+VOID
+PutBits (
+ IN INT32 Number,
+ IN UINT32 Value
+ );
+
+STATIC
+INT32
+FreadCrc (
+ OUT UINT8 *Pointer,
+ IN INT32 Number
+ );
+
+STATIC
+VOID
+InitPutBits (
+ VOID
+ );
+
+STATIC
+VOID
+CountLen (
+ IN INT32 Index
+ );
+
+STATIC
+VOID
+MakeLen (
+ IN INT32 Root
+ );
+
+STATIC
+VOID
+DownHeap (
+ IN INT32 Index
+ );
+
+STATIC
+VOID
+MakeCode (
+ IN INT32 Number,
+ IN UINT8 Len[ ],
+ OUT UINT16 Code[]
+ );
+
+STATIC
+INT32
+MakeTree (
+ IN INT32 NParm,
+ IN UINT16 FreqParm[],
+ OUT UINT8 LenParm[ ],
+ OUT UINT16 CodeParm[]
+ );
+
+//
+// Global Variables
+//
+STATIC UINT8 *mSrc, *mDst, *mSrcUpperLimit, *mDstUpperLimit;
+
+STATIC UINT8 *mLevel, *mText, *mChildCount, *mBuf, mCLen[NC], mPTLen[NPT], *mLen;
+STATIC INT16 mHeap[NC + 1];
+STATIC INT32 mRemainder, mMatchLen, mBitCount, mHeapSize, mN;
+STATIC UINT32 mBufSiz = 0, mOutputPos, mOutputMask, mSubBitBuf, mCrc;
+STATIC UINT32 mCompSize, mOrigSize;
+
+STATIC UINT16 *mFreq, *mSortPtr, mLenCnt[17], mLeft[2 * NC - 1], mRight[2 * NC - 1], mCrcTable[UINT8_MAX + 1],
+ mCFreq[2 * NC - 1], mCCode[NC], mPFreq[2 * NP - 1], mPTCode[NPT], mTFreq[2 * NT - 1];
+
+STATIC NODE mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL;
+
+//
+// functions
+//
+EFI_STATUS
+TianoCompress (
+ IN UINT8 *SrcBuffer,
+ IN UINT32 SrcSize,
+ IN UINT8 *DstBuffer,
+ IN OUT UINT32 *DstSize
+ )
+/*++
+
+Routine Description:
+
+ The internal implementation of [Efi/Tiano]Compress().
+
+Arguments:
+
+ SrcBuffer - The buffer storing the source data
+ SrcSize - The size of source data
+ DstBuffer - The buffer to store the compressed data
+ DstSize - On input, the size of DstBuffer; On output,
+ the size of the actual compressed data.
+ Version - The version of de/compression algorithm.
+ Version 1 for UEFI 2.0 de/compression algorithm.
+ Version 2 for Tiano de/compression algorithm.
+
+Returns:
+
+ EFI_BUFFER_TOO_SMALL - The DstBuffer is too small. In this case,
+ DstSize contains the size needed.
+ EFI_SUCCESS - Compression is successful.
+ EFI_OUT_OF_RESOURCES - No resource to complete function.
+ EFI_INVALID_PARAMETER - Parameter supplied is wrong.
+
+--*/
+{
+ EFI_STATUS Status;
+
+ //
+ // Initializations
+ //
+ mBufSiz = 0;
+ mBuf = NULL;
+ mText = NULL;
+ mLevel = NULL;
+ mChildCount = NULL;
+ mPosition = NULL;
+ mParent = NULL;
+ mPrev = NULL;
+ mNext = NULL;
+
+ mSrc = SrcBuffer;
+ mSrcUpperLimit = mSrc + SrcSize;
+ mDst = DstBuffer;
+ mDstUpperLimit = mDst +*DstSize;
+
+ PutDword (0L);
+ PutDword (0L);
+
+ MakeCrcTable ();
+
+ mOrigSize = mCompSize = 0;
+ mCrc = INIT_CRC;
+
+ //
+ // Compress it
+ //
+ Status = Encode ();
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Null terminate the compressed data
+ //
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = 0;
+ }
+ //
+ // Fill in compressed size and original size
+ //
+ mDst = DstBuffer;
+ PutDword (mCompSize + 1);
+ PutDword (mOrigSize);
+
+ //
+ // Return
+ //
+ if (mCompSize + 1 + 8 > *DstSize) {
+ *DstSize = mCompSize + 1 + 8;
+ return EFI_BUFFER_TOO_SMALL;
+ } else {
+ *DstSize = mCompSize + 1 + 8;
+ return EFI_SUCCESS;
+ }
+
+}
+
+STATIC
+VOID
+PutDword (
+ IN UINT32 Data
+ )
+/*++
+
+Routine Description:
+
+ Put a dword to output stream
+
+Arguments:
+
+ Data - the dword to put
+
+Returns: (VOID)
+
+--*/
+{
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = (UINT8) (((UINT8) (Data)) & 0xff);
+ }
+
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = (UINT8) (((UINT8) (Data >> 0x08)) & 0xff);
+ }
+
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = (UINT8) (((UINT8) (Data >> 0x10)) & 0xff);
+ }
+
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = (UINT8) (((UINT8) (Data >> 0x18)) & 0xff);
+ }
+}
+
+STATIC
+EFI_STATUS
+AllocateMemory (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Allocate memory spaces for data structures used in compression process
+
+Arguments:
+ VOID
+
+Returns:
+
+ EFI_SUCCESS - Memory is allocated successfully
+ EFI_OUT_OF_RESOURCES - Allocation fails
+
+--*/
+{
+ UINT32 Index;
+
+ mText = malloc (WNDSIZ * 2 + MAXMATCH);
+ if (mText == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ for (Index = 0; Index < WNDSIZ * 2 + MAXMATCH; Index++) {
+ mText[Index] = 0;
+ }
+
+ mLevel = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mLevel));
+ mChildCount = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mChildCount));
+ mPosition = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mPosition));
+ mParent = malloc (WNDSIZ * 2 * sizeof (*mParent));
+ mPrev = malloc (WNDSIZ * 2 * sizeof (*mPrev));
+ mNext = malloc ((MAX_HASH_VAL + 1) * sizeof (*mNext));
+ if (mLevel == NULL || mChildCount == NULL || mPosition == NULL ||
+ mParent == NULL || mPrev == NULL || mNext == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mBufSiz = BLKSIZ;
+ mBuf = malloc (mBufSiz);
+ while (mBuf == NULL) {
+ mBufSiz = (mBufSiz / 10U) * 9U;
+ if (mBufSiz < 4 * 1024U) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mBuf = malloc (mBufSiz);
+ }
+
+ mBuf[0] = 0;
+
+ return EFI_SUCCESS;
+}
+
+VOID
+FreeMemory (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Called when compression is completed to free memory previously allocated.
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ if (mText != NULL) {
+ free (mText);
+ }
+
+ if (mLevel != NULL) {
+ free (mLevel);
+ }
+
+ if (mChildCount != NULL) {
+ free (mChildCount);
+ }
+
+ if (mPosition != NULL) {
+ free (mPosition);
+ }
+
+ if (mParent != NULL) {
+ free (mParent);
+ }
+
+ if (mPrev != NULL) {
+ free (mPrev);
+ }
+
+ if (mNext != NULL) {
+ free (mNext);
+ }
+
+ if (mBuf != NULL) {
+ free (mBuf);
+ }
+
+ return ;
+}
+
+STATIC
+VOID
+InitSlide (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Initialize String Info Log data structures
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ NODE Index;
+
+ for (Index = WNDSIZ; Index <= WNDSIZ + UINT8_MAX; Index++) {
+ mLevel[Index] = 1;
+ mPosition[Index] = NIL; /* sentinel */
+ }
+
+ for (Index = WNDSIZ; Index < WNDSIZ * 2; Index++) {
+ mParent[Index] = NIL;
+ }
+
+ mAvail = 1;
+ for (Index = 1; Index < WNDSIZ - 1; Index++) {
+ mNext[Index] = (NODE) (Index + 1);
+ }
+
+ mNext[WNDSIZ - 1] = NIL;
+ for (Index = WNDSIZ * 2; Index <= MAX_HASH_VAL; Index++) {
+ mNext[Index] = NIL;
+ }
+}
+
+STATIC
+NODE
+Child (
+ IN NODE NodeQ,
+ IN UINT8 CharC
+ )
+/*++
+
+Routine Description:
+
+ Find child node given the parent node and the edge character
+
+Arguments:
+
+ NodeQ - the parent node
+ CharC - the edge character
+
+Returns:
+
+ The child node (NIL if not found)
+
+--*/
+{
+ NODE NodeR;
+
+ NodeR = mNext[HASH (NodeQ, CharC)];
+ //
+ // sentinel
+ //
+ mParent[NIL] = NodeQ;
+ while (mParent[NodeR] != NodeQ) {
+ NodeR = mNext[NodeR];
+ }
+
+ return NodeR;
+}
+
+STATIC
+VOID
+MakeChild (
+ IN NODE Parent,
+ IN UINT8 CharC,
+ IN NODE Child
+ )
+/*++
+
+Routine Description:
+
+ Create a new child for a given parent node.
+
+Arguments:
+
+ Parent - the parent node
+ CharC - the edge character
+ Child - the child node
+
+Returns: (VOID)
+
+--*/
+{
+ NODE Node1;
+ NODE Node2;
+
+ Node1 = (NODE) HASH (Parent, CharC);
+ Node2 = mNext[Node1];
+ mNext[Node1] = Child;
+ mNext[Child] = Node2;
+ mPrev[Node2] = Child;
+ mPrev[Child] = Node1;
+ mParent[Child] = Parent;
+ mChildCount[Parent]++;
+}
+
+STATIC
+VOID
+Split (
+ NODE Old
+ )
+/*++
+
+Routine Description:
+
+ Split a node.
+
+Arguments:
+
+ Old - the node to split
+
+Returns: (VOID)
+
+--*/
+{
+ NODE New;
+ NODE TempNode;
+
+ New = mAvail;
+ mAvail = mNext[New];
+ mChildCount[New] = 0;
+ TempNode = mPrev[Old];
+ mPrev[New] = TempNode;
+ mNext[TempNode] = New;
+ TempNode = mNext[Old];
+ mNext[New] = TempNode;
+ mPrev[TempNode] = New;
+ mParent[New] = mParent[Old];
+ mLevel[New] = (UINT8) mMatchLen;
+ mPosition[New] = mPos;
+ MakeChild (New, mText[mMatchPos + mMatchLen], Old);
+ MakeChild (New, mText[mPos + mMatchLen], mPos);
+}
+
+STATIC
+VOID
+InsertNode (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Insert string info for current position into the String Info Log
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ NODE NodeQ;
+ NODE NodeR;
+ NODE Index2;
+ NODE NodeT;
+ UINT8 CharC;
+ UINT8 *t1;
+ UINT8 *t2;
+
+ if (mMatchLen >= 4) {
+ //
+ // We have just got a long match, the target tree
+ // can be located by MatchPos + 1. Traverse the tree
+ // from bottom up to get to a proper starting point.
+ // The usage of PERC_FLAG ensures proper node deletion
+ // in DeleteNode() later.
+ //
+ mMatchLen--;
+ NodeR = (NODE) ((mMatchPos + 1) | WNDSIZ);
+ NodeQ = mParent[NodeR];
+ while (NodeQ == NIL) {
+ NodeR = mNext[NodeR];
+ NodeQ = mParent[NodeR];
+ }
+
+ while (mLevel[NodeQ] >= mMatchLen) {
+ NodeR = NodeQ;
+ NodeQ = mParent[NodeQ];
+ }
+
+ NodeT = NodeQ;
+ while (mPosition[NodeT] < 0) {
+ mPosition[NodeT] = mPos;
+ NodeT = mParent[NodeT];
+ }
+
+ if (NodeT < WNDSIZ) {
+ mPosition[NodeT] = (NODE) (mPos | (UINT32) PERC_FLAG);
+ }
+ } else {
+ //
+ // Locate the target tree
+ //
+ NodeQ = (NODE) (mText[mPos] + WNDSIZ);
+ CharC = mText[mPos + 1];
+ NodeR = Child (NodeQ, CharC);
+ if (NodeR == NIL) {
+ MakeChild (NodeQ, CharC, mPos);
+ mMatchLen = 1;
+ return ;
+ }
+
+ mMatchLen = 2;
+ }
+ //
+ // Traverse down the tree to find a match.
+ // Update Position value along the route.
+ // Node split or creation is involved.
+ //
+ for (;;) {
+ if (NodeR >= WNDSIZ) {
+ Index2 = MAXMATCH;
+ mMatchPos = NodeR;
+ } else {
+ Index2 = mLevel[NodeR];
+ mMatchPos = (NODE) (mPosition[NodeR] & (UINT32)~PERC_FLAG);
+ }
+
+ if (mMatchPos >= mPos) {
+ mMatchPos -= WNDSIZ;
+ }
+
+ t1 = &mText[mPos + mMatchLen];
+ t2 = &mText[mMatchPos + mMatchLen];
+ while (mMatchLen < Index2) {
+ if (*t1 != *t2) {
+ Split (NodeR);
+ return ;
+ }
+
+ mMatchLen++;
+ t1++;
+ t2++;
+ }
+
+ if (mMatchLen >= MAXMATCH) {
+ break;
+ }
+
+ mPosition[NodeR] = mPos;
+ NodeQ = NodeR;
+ NodeR = Child (NodeQ, *t1);
+ if (NodeR == NIL) {
+ MakeChild (NodeQ, *t1, mPos);
+ return ;
+ }
+
+ mMatchLen++;
+ }
+
+ NodeT = mPrev[NodeR];
+ mPrev[mPos] = NodeT;
+ mNext[NodeT] = mPos;
+ NodeT = mNext[NodeR];
+ mNext[mPos] = NodeT;
+ mPrev[NodeT] = mPos;
+ mParent[mPos] = NodeQ;
+ mParent[NodeR] = NIL;
+
+ //
+ // Special usage of 'next'
+ //
+ mNext[NodeR] = mPos;
+
+}
+
+STATIC
+VOID
+DeleteNode (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Delete outdated string info. (The Usage of PERC_FLAG
+ ensures a clean deletion)
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ NODE NodeQ;
+ NODE NodeR;
+ NODE NodeS;
+ NODE NodeT;
+ NODE NodeU;
+
+ if (mParent[mPos] == NIL) {
+ return ;
+ }
+
+ NodeR = mPrev[mPos];
+ NodeS = mNext[mPos];
+ mNext[NodeR] = NodeS;
+ mPrev[NodeS] = NodeR;
+ NodeR = mParent[mPos];
+ mParent[mPos] = NIL;
+ if (NodeR >= WNDSIZ) {
+ return ;
+ }
+
+ mChildCount[NodeR]--;
+ if (mChildCount[NodeR] > 1) {
+ return ;
+ }
+
+ NodeT = (NODE) (mPosition[NodeR] & (UINT32)~PERC_FLAG);
+ if (NodeT >= mPos) {
+ NodeT -= WNDSIZ;
+ }
+
+ NodeS = NodeT;
+ NodeQ = mParent[NodeR];
+ NodeU = mPosition[NodeQ];
+ while (NodeU & (UINT32) PERC_FLAG) {
+ NodeU &= (UINT32)~PERC_FLAG;
+ if (NodeU >= mPos) {
+ NodeU -= WNDSIZ;
+ }
+
+ if (NodeU > NodeS) {
+ NodeS = NodeU;
+ }
+
+ mPosition[NodeQ] = (NODE) (NodeS | WNDSIZ);
+ NodeQ = mParent[NodeQ];
+ NodeU = mPosition[NodeQ];
+ }
+
+ if (NodeQ < WNDSIZ) {
+ if (NodeU >= mPos) {
+ NodeU -= WNDSIZ;
+ }
+
+ if (NodeU > NodeS) {
+ NodeS = NodeU;
+ }
+
+ mPosition[NodeQ] = (NODE) (NodeS | WNDSIZ | (UINT32) PERC_FLAG);
+ }
+
+ NodeS = Child (NodeR, mText[NodeT + mLevel[NodeR]]);
+ NodeT = mPrev[NodeS];
+ NodeU = mNext[NodeS];
+ mNext[NodeT] = NodeU;
+ mPrev[NodeU] = NodeT;
+ NodeT = mPrev[NodeR];
+ mNext[NodeT] = NodeS;
+ mPrev[NodeS] = NodeT;
+ NodeT = mNext[NodeR];
+ mPrev[NodeT] = NodeS;
+ mNext[NodeS] = NodeT;
+ mParent[NodeS] = mParent[NodeR];
+ mParent[NodeR] = NIL;
+ mNext[NodeR] = mAvail;
+ mAvail = NodeR;
+}
+
+STATIC
+VOID
+GetNextMatch (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Advance the current position (read in new data if needed).
+ Delete outdated string info. Find a match string for current position.
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 Number;
+
+ mRemainder--;
+ mPos++;
+ if (mPos == WNDSIZ * 2) {
+ memmove (&mText[0], &mText[WNDSIZ], WNDSIZ + MAXMATCH);
+ Number = FreadCrc (&mText[WNDSIZ + MAXMATCH], WNDSIZ);
+ mRemainder += Number;
+ mPos = WNDSIZ;
+ }
+
+ DeleteNode ();
+ InsertNode ();
+}
+
+STATIC
+EFI_STATUS
+Encode (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ The main controlling routine for compression process.
+
+Arguments: (VOID)
+
+Returns:
+
+ EFI_SUCCESS - The compression is successful
+ EFI_OUT_0F_RESOURCES - Not enough memory for compression process
+
+--*/
+{
+ EFI_STATUS Status;
+ INT32 LastMatchLen;
+ NODE LastMatchPos;
+
+ Status = AllocateMemory ();
+ if (EFI_ERROR (Status)) {
+ FreeMemory ();
+ return Status;
+ }
+
+ InitSlide ();
+
+ HufEncodeStart ();
+
+ mRemainder = FreadCrc (&mText[WNDSIZ], WNDSIZ + MAXMATCH);
+
+ mMatchLen = 0;
+ mPos = WNDSIZ;
+ InsertNode ();
+ if (mMatchLen > mRemainder) {
+ mMatchLen = mRemainder;
+ }
+
+ while (mRemainder > 0) {
+ LastMatchLen = mMatchLen;
+ LastMatchPos = mMatchPos;
+ GetNextMatch ();
+ if (mMatchLen > mRemainder) {
+ mMatchLen = mRemainder;
+ }
+
+ if (mMatchLen > LastMatchLen || LastMatchLen < THRESHOLD) {
+ //
+ // Not enough benefits are gained by outputting a pointer,
+ // so just output the original character
+ //
+ Output (mText[mPos - 1], 0);
+
+ } else {
+
+ if (LastMatchLen == THRESHOLD) {
+ if (((mPos - LastMatchPos - 2) & (WNDSIZ - 1)) > (1U << 11)) {
+ Output (mText[mPos - 1], 0);
+ continue;
+ }
+ }
+ //
+ // Outputting a pointer is beneficial enough, do it.
+ //
+ Output (
+ LastMatchLen + (UINT8_MAX + 1 - THRESHOLD),
+ (mPos - LastMatchPos - 2) & (WNDSIZ - 1)
+ );
+ LastMatchLen--;
+ while (LastMatchLen > 0) {
+ GetNextMatch ();
+ LastMatchLen--;
+ }
+
+ if (mMatchLen > mRemainder) {
+ mMatchLen = mRemainder;
+ }
+ }
+ }
+
+ HufEncodeEnd ();
+ FreeMemory ();
+ return EFI_SUCCESS;
+}
+
+STATIC
+VOID
+CountTFreq (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Count the frequencies for the Extra Set
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 Index;
+ INT32 Index3;
+ INT32 Number;
+ INT32 Count;
+
+ for (Index = 0; Index < NT; Index++) {
+ mTFreq[Index] = 0;
+ }
+
+ Number = NC;
+ while (Number > 0 && mCLen[Number - 1] == 0) {
+ Number--;
+ }
+
+ Index = 0;
+ while (Index < Number) {
+ Index3 = mCLen[Index++];
+ if (Index3 == 0) {
+ Count = 1;
+ while (Index < Number && mCLen[Index] == 0) {
+ Index++;
+ Count++;
+ }
+
+ if (Count <= 2) {
+ mTFreq[0] = (UINT16) (mTFreq[0] + Count);
+ } else if (Count <= 18) {
+ mTFreq[1]++;
+ } else if (Count == 19) {
+ mTFreq[0]++;
+ mTFreq[1]++;
+ } else {
+ mTFreq[2]++;
+ }
+ } else {
+ mTFreq[Index3 + 2]++;
+ }
+ }
+}
+
+STATIC
+VOID
+WritePTLen (
+ IN INT32 Number,
+ IN INT32 nbit,
+ IN INT32 Special
+ )
+/*++
+
+Routine Description:
+
+ Outputs the code length array for the Extra Set or the Position Set.
+
+Arguments:
+
+ Number - the number of symbols
+ nbit - the number of bits needed to represent 'n'
+ Special - the special symbol that needs to be take care of
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 Index;
+ INT32 Index3;
+
+ while (Number > 0 && mPTLen[Number - 1] == 0) {
+ Number--;
+ }
+
+ PutBits (nbit, Number);
+ Index = 0;
+ while (Index < Number) {
+ Index3 = mPTLen[Index++];
+ if (Index3 <= 6) {
+ PutBits (3, Index3);
+ } else {
+ PutBits (Index3 - 3, (1U << (Index3 - 3)) - 2);
+ }
+
+ if (Index == Special) {
+ while (Index < 6 && mPTLen[Index] == 0) {
+ Index++;
+ }
+
+ PutBits (2, (Index - 3) & 3);
+ }
+ }
+}
+
+STATIC
+VOID
+WriteCLen (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Outputs the code length array for Char&Length Set
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 Index;
+ INT32 Index3;
+ INT32 Number;
+ INT32 Count;
+
+ Number = NC;
+ while (Number > 0 && mCLen[Number - 1] == 0) {
+ Number--;
+ }
+
+ PutBits (CBIT, Number);
+ Index = 0;
+ while (Index < Number) {
+ Index3 = mCLen[Index++];
+ if (Index3 == 0) {
+ Count = 1;
+ while (Index < Number && mCLen[Index] == 0) {
+ Index++;
+ Count++;
+ }
+
+ if (Count <= 2) {
+ for (Index3 = 0; Index3 < Count; Index3++) {
+ PutBits (mPTLen[0], mPTCode[0]);
+ }
+ } else if (Count <= 18) {
+ PutBits (mPTLen[1], mPTCode[1]);
+ PutBits (4, Count - 3);
+ } else if (Count == 19) {
+ PutBits (mPTLen[0], mPTCode[0]);
+ PutBits (mPTLen[1], mPTCode[1]);
+ PutBits (4, 15);
+ } else {
+ PutBits (mPTLen[2], mPTCode[2]);
+ PutBits (CBIT, Count - 20);
+ }
+ } else {
+ PutBits (mPTLen[Index3 + 2], mPTCode[Index3 + 2]);
+ }
+ }
+}
+
+STATIC
+VOID
+EncodeC (
+ IN INT32 Value
+ )
+{
+ PutBits (mCLen[Value], mCCode[Value]);
+}
+
+STATIC
+VOID
+EncodeP (
+ IN UINT32 Value
+ )
+{
+ UINT32 Index;
+ UINT32 NodeQ;
+
+ Index = 0;
+ NodeQ = Value;
+ while (NodeQ) {
+ NodeQ >>= 1;
+ Index++;
+ }
+
+ PutBits (mPTLen[Index], mPTCode[Index]);
+ if (Index > 1) {
+ PutBits (Index - 1, Value & (0xFFFFFFFFU >> (32 - Index + 1)));
+ }
+}
+
+STATIC
+VOID
+SendBlock (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Huffman code the block and output it.
+
+Arguments:
+ (VOID)
+
+Returns:
+ (VOID)
+
+--*/
+{
+ UINT32 Index;
+ UINT32 Index2;
+ UINT32 Index3;
+ UINT32 Flags;
+ UINT32 Root;
+ UINT32 Pos;
+ UINT32 Size;
+ Flags = 0;
+
+ Root = MakeTree (NC, mCFreq, mCLen, mCCode);
+ Size = mCFreq[Root];
+ PutBits (16, Size);
+ if (Root >= NC) {
+ CountTFreq ();
+ Root = MakeTree (NT, mTFreq, mPTLen, mPTCode);
+ if (Root >= NT) {
+ WritePTLen (NT, TBIT, 3);
+ } else {
+ PutBits (TBIT, 0);
+ PutBits (TBIT, Root);
+ }
+
+ WriteCLen ();
+ } else {
+ PutBits (TBIT, 0);
+ PutBits (TBIT, 0);
+ PutBits (CBIT, 0);
+ PutBits (CBIT, Root);
+ }
+
+ Root = MakeTree (NP, mPFreq, mPTLen, mPTCode);
+ if (Root >= NP) {
+ WritePTLen (NP, PBIT, -1);
+ } else {
+ PutBits (PBIT, 0);
+ PutBits (PBIT, Root);
+ }
+
+ Pos = 0;
+ for (Index = 0; Index < Size; Index++) {
+ if (Index % UINT8_BIT == 0) {
+ Flags = mBuf[Pos++];
+ } else {
+ Flags <<= 1;
+ }
+
+ if (Flags & (1U << (UINT8_BIT - 1))) {
+ EncodeC (mBuf[Pos++] + (1U << UINT8_BIT));
+ Index3 = mBuf[Pos++];
+ for (Index2 = 0; Index2 < 3; Index2++) {
+ Index3 <<= UINT8_BIT;
+ Index3 += mBuf[Pos++];
+ }
+
+ EncodeP (Index3);
+ } else {
+ EncodeC (mBuf[Pos++]);
+ }
+ }
+
+ for (Index = 0; Index < NC; Index++) {
+ mCFreq[Index] = 0;
+ }
+
+ for (Index = 0; Index < NP; Index++) {
+ mPFreq[Index] = 0;
+ }
+}
+
+STATIC
+VOID
+Output (
+ IN UINT32 CharC,
+ IN UINT32 Pos
+ )
+/*++
+
+Routine Description:
+
+ Outputs an Original Character or a Pointer
+
+Arguments:
+
+ CharC - The original character or the 'String Length' element of a Pointer
+ Pos - The 'Position' field of a Pointer
+
+Returns: (VOID)
+
+--*/
+{
+ STATIC UINT32 CPos;
+
+ if ((mOutputMask >>= 1) == 0) {
+ mOutputMask = 1U << (UINT8_BIT - 1);
+ //
+ // Check the buffer overflow per outputing UINT8_BIT symbols
+ // which is an Original Character or a Pointer. The biggest
+ // symbol is a Pointer which occupies 5 bytes.
+ //
+ if (mOutputPos >= mBufSiz - 5 * UINT8_BIT) {
+ SendBlock ();
+ mOutputPos = 0;
+ }
+
+ CPos = mOutputPos++;
+ mBuf[CPos] = 0;
+ }
+
+ mBuf[mOutputPos++] = (UINT8) CharC;
+ mCFreq[CharC]++;
+ if (CharC >= (1U << UINT8_BIT)) {
+ mBuf[CPos] |= mOutputMask;
+ mBuf[mOutputPos++] = (UINT8) (Pos >> 24);
+ mBuf[mOutputPos++] = (UINT8) (Pos >> 16);
+ mBuf[mOutputPos++] = (UINT8) (Pos >> (UINT8_BIT));
+ mBuf[mOutputPos++] = (UINT8) Pos;
+ CharC = 0;
+ while (Pos) {
+ Pos >>= 1;
+ CharC++;
+ }
+
+ mPFreq[CharC]++;
+ }
+}
+
+STATIC
+VOID
+HufEncodeStart (
+ VOID
+ )
+{
+ INT32 Index;
+
+ for (Index = 0; Index < NC; Index++) {
+ mCFreq[Index] = 0;
+ }
+
+ for (Index = 0; Index < NP; Index++) {
+ mPFreq[Index] = 0;
+ }
+
+ mOutputPos = mOutputMask = 0;
+ InitPutBits ();
+ return ;
+}
+
+STATIC
+VOID
+HufEncodeEnd (
+ VOID
+ )
+{
+ SendBlock ();
+
+ //
+ // Flush remaining bits
+ //
+ PutBits (UINT8_BIT - 1, 0);
+
+ return ;
+}
+
+STATIC
+VOID
+MakeCrcTable (
+ VOID
+ )
+{
+ UINT32 Index;
+ UINT32 Index2;
+ UINT32 Temp;
+
+ for (Index = 0; Index <= UINT8_MAX; Index++) {
+ Temp = Index;
+ for (Index2 = 0; Index2 < UINT8_BIT; Index2++) {
+ if (Temp & 1) {
+ Temp = (Temp >> 1) ^ CRCPOLY;
+ } else {
+ Temp >>= 1;
+ }
+ }
+
+ mCrcTable[Index] = (UINT16) Temp;
+ }
+}
+
+STATIC
+VOID
+PutBits (
+ IN INT32 Number,
+ IN UINT32 Value
+ )
+/*++
+
+Routine Description:
+
+ Outputs rightmost n bits of x
+
+Arguments:
+
+ Number - the rightmost n bits of the data is used
+ x - the data
+
+Returns: (VOID)
+
+--*/
+{
+ UINT8 Temp;
+
+ while (Number >= mBitCount) {
+ //
+ // Number -= mBitCount should never equal to 32
+ //
+ Temp = (UINT8) (mSubBitBuf | (Value >> (Number -= mBitCount)));
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = Temp;
+ }
+
+ mCompSize++;
+ mSubBitBuf = 0;
+ mBitCount = UINT8_BIT;
+ }
+
+ mSubBitBuf |= Value << (mBitCount -= Number);
+}
+
+STATIC
+INT32
+FreadCrc (
+ OUT UINT8 *Pointer,
+ IN INT32 Number
+ )
+/*++
+
+Routine Description:
+
+ Read in source data
+
+Arguments:
+
+ Pointer - the buffer to hold the data
+ Number - number of bytes to read
+
+Returns:
+
+ number of bytes actually read
+
+--*/
+{
+ INT32 Index;
+
+ for (Index = 0; mSrc < mSrcUpperLimit && Index < Number; Index++) {
+ *Pointer++ = *mSrc++;
+ }
+
+ Number = Index;
+
+ Pointer -= Number;
+ mOrigSize += Number;
+ Index--;
+ while (Index >= 0) {
+ UPDATE_CRC (*Pointer++);
+ Index--;
+ }
+
+ return Number;
+}
+
+STATIC
+VOID
+InitPutBits (
+ VOID
+ )
+{
+ mBitCount = UINT8_BIT;
+ mSubBitBuf = 0;
+}
+
+STATIC
+VOID
+CountLen (
+ IN INT32 Index
+ )
+/*++
+
+Routine Description:
+
+ Count the number of each code length for a Huffman tree.
+
+Arguments:
+
+ Index - the top node
+
+Returns: (VOID)
+
+--*/
+{
+ STATIC INT32 Depth = 0;
+
+ if (Index < mN) {
+ mLenCnt[(Depth < 16) ? Depth : 16]++;
+ } else {
+ Depth++;
+ CountLen (mLeft[Index]);
+ CountLen (mRight[Index]);
+ Depth--;
+ }
+}
+
+STATIC
+VOID
+MakeLen (
+ IN INT32 Root
+ )
+/*++
+
+Routine Description:
+
+ Create code length array for a Huffman tree
+
+Arguments:
+
+ Root - the root of the tree
+
+Returns:
+
+ VOID
+
+--*/
+{
+ INT32 Index;
+ INT32 Index3;
+ UINT32 Cum;
+
+ for (Index = 0; Index <= 16; Index++) {
+ mLenCnt[Index] = 0;
+ }
+
+ CountLen (Root);
+
+ //
+ // Adjust the length count array so that
+ // no code will be generated longer than its designated length
+ //
+ Cum = 0;
+ for (Index = 16; Index > 0; Index--) {
+ Cum += mLenCnt[Index] << (16 - Index);
+ }
+
+ while (Cum != (1U << 16)) {
+ mLenCnt[16]--;
+ for (Index = 15; Index > 0; Index--) {
+ if (mLenCnt[Index] != 0) {
+ mLenCnt[Index]--;
+ mLenCnt[Index + 1] += 2;
+ break;
+ }
+ }
+
+ Cum--;
+ }
+
+ for (Index = 16; Index > 0; Index--) {
+ Index3 = mLenCnt[Index];
+ Index3--;
+ while (Index3 >= 0) {
+ mLen[*mSortPtr++] = (UINT8) Index;
+ Index3--;
+ }
+ }
+}
+
+STATIC
+VOID
+DownHeap (
+ IN INT32 Index
+ )
+{
+ INT32 Index2;
+ INT32 Index3;
+
+ //
+ // priority queue: send Index-th entry down heap
+ //
+ Index3 = mHeap[Index];
+ Index2 = 2 * Index;
+ while (Index2 <= mHeapSize) {
+ if (Index2 < mHeapSize && mFreq[mHeap[Index2]] > mFreq[mHeap[Index2 + 1]]) {
+ Index2++;
+ }
+
+ if (mFreq[Index3] <= mFreq[mHeap[Index2]]) {
+ break;
+ }
+
+ mHeap[Index] = mHeap[Index2];
+ Index = Index2;
+ Index2 = 2 * Index;
+ }
+
+ mHeap[Index] = (INT16) Index3;
+}
+
+STATIC
+VOID
+MakeCode (
+ IN INT32 Number,
+ IN UINT8 Len[ ],
+ OUT UINT16 Code[]
+ )
+/*++
+
+Routine Description:
+
+ Assign code to each symbol based on the code length array
+
+Arguments:
+
+ Number - number of symbols
+ Len - the code length array
+ Code - stores codes for each symbol
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 Index;
+ UINT16 Start[18];
+
+ Start[1] = 0;
+ for (Index = 1; Index <= 16; Index++) {
+ Start[Index + 1] = (UINT16) ((Start[Index] + mLenCnt[Index]) << 1);
+ }
+
+ for (Index = 0; Index < Number; Index++) {
+ Code[Index] = Start[Len[Index]]++;
+ }
+}
+
+STATIC
+INT32
+MakeTree (
+ IN INT32 NParm,
+ IN UINT16 FreqParm[],
+ OUT UINT8 LenParm[ ],
+ OUT UINT16 CodeParm[]
+ )
+/*++
+
+Routine Description:
+
+ Generates Huffman codes given a frequency distribution of symbols
+
+Arguments:
+
+ NParm - number of symbols
+ FreqParm - frequency of each symbol
+ LenParm - code length for each symbol
+ CodeParm - code for each symbol
+
+Returns:
+
+ Root of the Huffman tree.
+
+--*/
+{
+ INT32 Index;
+ INT32 Index2;
+ INT32 Index3;
+ INT32 Avail;
+
+ //
+ // make tree, calculate len[], return root
+ //
+ mN = NParm;
+ mFreq = FreqParm;
+ mLen = LenParm;
+ Avail = mN;
+ mHeapSize = 0;
+ mHeap[1] = 0;
+ for (Index = 0; Index < mN; Index++) {
+ mLen[Index] = 0;
+ if (mFreq[Index]) {
+ mHeapSize++;
+ mHeap[mHeapSize] = (INT16) Index;
+ }
+ }
+
+ if (mHeapSize < 2) {
+ CodeParm[mHeap[1]] = 0;
+ return mHeap[1];
+ }
+
+ for (Index = mHeapSize / 2; Index >= 1; Index--) {
+ //
+ // make priority queue
+ //
+ DownHeap (Index);
+ }
+
+ mSortPtr = CodeParm;
+ do {
+ Index = mHeap[1];
+ if (Index < mN) {
+ *mSortPtr++ = (UINT16) Index;
+ }
+
+ mHeap[1] = mHeap[mHeapSize--];
+ DownHeap (1);
+ Index2 = mHeap[1];
+ if (Index2 < mN) {
+ *mSortPtr++ = (UINT16) Index2;
+ }
+
+ Index3 = Avail++;
+ mFreq[Index3] = (UINT16) (mFreq[Index] + mFreq[Index2]);
+ mHeap[1] = (INT16) Index3;
+ DownHeap (1);
+ mLeft[Index3] = (UINT16) Index;
+ mRight[Index3] = (UINT16) Index2;
+ } while (mHeapSize > 1);
+
+ mSortPtr = CodeParm;
+ MakeLen (Index3);
+ MakeCode (NParm, LenParm, CodeParm);
+
+ //
+ // return root
+ //
+ return Index3;
+}
diff --git a/roms/edk2/BaseTools/Source/C/Common/WinNtInclude.h b/roms/edk2/BaseTools/Source/C/Common/WinNtInclude.h
new file mode 100644
index 000000000..181e6ac33
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Common/WinNtInclude.h
@@ -0,0 +1,66 @@
+/** @file
+Include file for the WinNt Library
+
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __WIN_NT_INCLUDE_H__
+#define __WIN_NT_INCLUDE_H__
+
+#define GUID _WINNT_DUP_GUID_____
+#define _LIST_ENTRY _WINNT_DUP_LIST_ENTRY_FORWARD
+#define LIST_ENTRY _WINNT_DUP_LIST_ENTRY
+
+#if (_MSC_VER < 1800)
+#define InterlockedIncrement _WINNT_DUP_InterlockedIncrement
+#define InterlockedDecrement _WINNT_DUP_InterlockedDecrement
+#define InterlockedCompareExchange64 _WINNT_DUP_InterlockedCompareExchange64
+#endif
+
+#undef UNALIGNED
+#undef CONST
+#undef VOID
+
+#ifndef __GNUC__
+#include "windows.h"
+
+//
+// Win32 include files do not compile clean with /W4, so we use the warning
+// pragma to suppress the warnings for Win32 only. This way our code can still
+// compile at /W4 (highest warning level) with /WX (warnings cause build
+// errors).
+//
+#pragma warning(disable : 4115)
+#pragma warning(disable : 4201)
+#pragma warning(disable : 4214)
+#pragma warning(disable : 4028)
+#pragma warning(disable : 4133)
+
+//
+// Set the warnings back on as the EFI code must be /W4.
+//
+#pragma warning(default : 4115)
+#pragma warning(default : 4201)
+#pragma warning(default : 4214)
+
+#endif
+
+#undef GUID
+#undef _LIST_ENTRY
+#undef LIST_ENTRY
+#undef InterlockedIncrement
+#undef InterlockedDecrement
+#undef InterlockedCompareExchange64
+#undef InterlockedCompareExchangePointer
+
+#define VOID void
+
+//
+// Prevent collisions with Windows API name macros that deal with Unicode/Not issues
+//
+#undef LoadImage
+#undef CreateEvent
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/DevicePath/DevicePath.c b/roms/edk2/BaseTools/Source/C/DevicePath/DevicePath.c
new file mode 100644
index 000000000..c4d224ed6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/DevicePath/DevicePath.c
@@ -0,0 +1,194 @@
+/** @file
+ Definition for Device Path Tool.
+
+Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UefiDevicePathLib.h"
+
+//
+// Utility Name
+//
+#define UTILITY_NAME "DevicePath"
+
+//
+// Utility version information
+//
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 1
+
+EFI_GUID gEfiDebugPortProtocolGuid = DEVICE_PATH_MESSAGING_DEBUGPORT;
+EFI_GUID gEfiPcAnsiGuid = EFI_PC_ANSI_GUID;
+EFI_GUID gEfiVT100Guid = EFI_VT_100_GUID;
+EFI_GUID gEfiVT100PlusGuid = EFI_VT_100_PLUS_GUID;
+EFI_GUID gEfiVTUTF8Guid = EFI_VT_UTF8_GUID;
+EFI_GUID gEfiUartDevicePathGuid = EFI_UART_DEVICE_PATH_GUID;
+EFI_GUID gEfiSasDevicePathGuid = EFI_SAS_DEVICE_PATH_GUID;
+EFI_GUID gEfiVirtualDiskGuid = EFI_VIRTUAL_DISK_GUID;
+EFI_GUID gEfiVirtualCdGuid = EFI_VIRTUAL_CD_GUID;
+EFI_GUID gEfiPersistentVirtualDiskGuid = EFI_PERSISTENT_VIRTUAL_DISK_GUID;
+EFI_GUID gEfiPersistentVirtualCdGuid = EFI_PERSISTENT_VIRTUAL_CD_GUID;
+
+STATIC
+VOID
+Version (
+ VOID
+)
+/*++
+
+Routine Description:
+
+ Displays the standard utility information to SDTOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
+}
+
+STATIC
+VOID
+Usage (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Displays the utility usage syntax to STDOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ //
+ // Summary usage
+ //
+ fprintf (stdout, "\nUsage: %s [options]\n\n", UTILITY_NAME);
+
+ //
+ // Copyright declaration
+ //
+ fprintf (stdout, "Copyright (c) 2017, Intel Corporation. All rights reserved.\n\n");
+ //
+ // Details Option
+ //
+ fprintf (stdout, "Options:\n");
+ fprintf (stdout, " DevicePathString Device Path string is specified, no space character.\n"
+ " Example: \"PciRoot(0)/Pci(0,0)\"\n");
+
+ fprintf (stdout, " --version Show program's version number and exit.\n");
+ fprintf (stdout, " -h, --help Show this help message and exit.\n");
+}
+
+
+STATIC
+VOID
+PrintMem (
+ CONST VOID *Buffer,
+ UINTN Count
+ )
+{
+ CONST UINT8 *Bytes;
+ UINTN Idx;
+
+ Bytes = Buffer;
+ for (Idx = 0; Idx < Count; Idx++) {
+ printf("0x%02x ", Bytes[Idx]);
+ }
+}
+
+VOID
+Ascii2UnicodeString (
+ CHAR8 *String,
+ CHAR16 *UniString
+ )
+/*++
+
+Routine Description:
+
+ Write ascii string as unicode string format to FILE
+
+Arguments:
+
+ String - Pointer to string that is written to FILE.
+ UniString - Pointer to unicode string
+
+Returns:
+
+ NULL
+
+--*/
+{
+ while (*String != '\0') {
+ *(UniString++) = (CHAR16) *(String++);
+ }
+ //
+ // End the UniString with a NULL.
+ //
+ *UniString = '\0';
+}
+
+int main(int argc, CHAR8 *argv[])
+{
+ CHAR8 * Str;
+ CHAR16* Str16;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ if (argc == 1) {
+ Error (NULL, 0, 1001, "Missing options", "No input options specified.");
+ Usage ();
+ return STATUS_ERROR;
+ }
+ if ((stricmp (argv[1], "-h") == 0) || (stricmp (argv[1], "--help") == 0)) {
+ Version ();
+ Usage ();
+ return STATUS_SUCCESS;
+ }
+
+ if (stricmp (argv[1], "--version") == 0) {
+ Version ();
+ return STATUS_SUCCESS;
+ }
+ Str = argv[1];
+ if (Str == NULL) {
+ fprintf(stderr, "Invalid option value, Device Path can't be NULL");
+ return STATUS_ERROR;
+ }
+ Str16 = (CHAR16 *)malloc(1024);
+ if (Str16 == NULL) {
+ fprintf(stderr, "Resource, memory cannot be allocated");
+ return STATUS_ERROR;
+ }
+ Ascii2UnicodeString(Str, Str16);
+ DevicePath = UefiDevicePathLibConvertTextToDevicePath(Str16);
+ if (DevicePath == NULL) {
+ fprintf(stderr, "Convert fail, Cannot convert text to a device path");
+ free(Str16);
+ return STATUS_ERROR;
+ }
+ while (!((DevicePath->Type == END_DEVICE_PATH_TYPE) && (DevicePath->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)) )
+ {
+ PrintMem (DevicePath, DevicePath->Length[0] | DevicePath->Length[1] << 8);
+ DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)DevicePath + (DevicePath->Length[0] | DevicePath->Length[1] << 8));
+ }
+ PrintMem (DevicePath, DevicePath->Length[0] | DevicePath->Length[1] << 8);
+ putchar('\n');
+ free(Str16);
+ return STATUS_SUCCESS;
+}
diff --git a/roms/edk2/BaseTools/Source/C/DevicePath/DevicePathFromText.c b/roms/edk2/BaseTools/Source/C/DevicePath/DevicePathFromText.c
new file mode 100644
index 000000000..fc39881c9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/DevicePath/DevicePathFromText.c
@@ -0,0 +1,3520 @@
+/** @file
+ DevicePathFromText protocol as defined in the UEFI 2.0 specification.
+
+Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UefiDevicePathLib.h"
+
+/**
+
+ Duplicates a string.
+
+ @param Src Source string.
+
+ @return The duplicated string.
+
+**/
+CHAR16 *
+UefiDevicePathLibStrDuplicate (
+ CONST CHAR16 *Src
+ )
+{
+ return AllocateCopyPool (StrSize (Src), Src);
+}
+
+/**
+
+ Get parameter in a pair of parentheses follow the given node name.
+ For example, given the "Pci(0,1)" and NodeName "Pci", it returns "0,1".
+
+ @param Str Device Path Text.
+ @param NodeName Name of the node.
+
+ @return Parameter text for the node.
+
+**/
+CHAR16 *
+GetParamByNodeName (
+ CHAR16 *Str,
+ CHAR16 *NodeName
+ )
+{
+ CHAR16 *ParamStr;
+ CHAR16 *StrPointer;
+ UINTN NodeNameLength;
+ UINTN ParameterLength;
+
+ //
+ // Check whether the node name matchs
+ //
+ NodeNameLength = StrLen (NodeName);
+ if (StrnCmp (Str, NodeName, NodeNameLength) != 0) {
+ return NULL;
+ }
+
+ ParamStr = Str + NodeNameLength;
+ if (!IS_LEFT_PARENTH (*ParamStr)) {
+ return NULL;
+ }
+
+ //
+ // Skip the found '(' and find first occurrence of ')'
+ //
+ ParamStr++;
+ ParameterLength = 0;
+ StrPointer = ParamStr;
+ while (!IS_NULL (*StrPointer)) {
+ if (IS_RIGHT_PARENTH (*StrPointer)) {
+ break;
+ }
+ StrPointer++;
+ ParameterLength++;
+ }
+ if (IS_NULL (*StrPointer)) {
+ //
+ // ')' not found
+ //
+ return NULL;
+ }
+
+ ParamStr = AllocateCopyPool ((ParameterLength + 1) * sizeof (CHAR16), ParamStr);
+ if (ParamStr == NULL) {
+ return NULL;
+ }
+ //
+ // Terminate the parameter string
+ //
+ ParamStr[ParameterLength] = L'\0';
+
+ return ParamStr;
+}
+
+/**
+ Gets the next parameter string from the list.
+
+ @param List A string list separated by the specified separator
+
+ @return A pointer to the current sub-string
+
+**/
+CHAR16 *
+GetNextParamStr (
+ CHAR16 **List
+ )
+{
+ //
+ // The separator is comma
+ //
+ return SplitStr (List, L',');
+}
+
+/**
+ Get one device node from entire device path text.
+
+ @param DevicePath On input, the current Device Path node; on output, the next device path node
+ @param IsInstanceEnd This node is the end of a device path instance
+
+ @return A device node text or NULL if no more device node available
+
+**/
+CHAR16 *
+GetNextDeviceNodeStr (
+ CHAR16 **DevicePath,
+ BOOLEAN *IsInstanceEnd
+ )
+{
+ CHAR16 *Str;
+ CHAR16 *ReturnStr;
+ UINTN ParenthesesStack;
+
+ Str = *DevicePath;
+ if (IS_NULL (*Str)) {
+ return NULL;
+ }
+
+ //
+ // Skip the leading '/', '(', ')' and ','
+ //
+ while (!IS_NULL (*Str)) {
+ if (!IS_SLASH (*Str) &&
+ !IS_COMMA (*Str) &&
+ !IS_LEFT_PARENTH (*Str) &&
+ !IS_RIGHT_PARENTH (*Str)) {
+ break;
+ }
+ Str++;
+ }
+
+ ReturnStr = Str;
+
+ //
+ // Scan for the separator of this device node, '/' or ','
+ //
+ ParenthesesStack = 0;
+ while (!IS_NULL (*Str)) {
+ if ((IS_COMMA (*Str) || IS_SLASH (*Str)) && (ParenthesesStack == 0)) {
+ break;
+ }
+
+ if (IS_LEFT_PARENTH (*Str)) {
+ ParenthesesStack++;
+ } else if (IS_RIGHT_PARENTH (*Str)) {
+ ParenthesesStack--;
+ }
+
+ Str++;
+ }
+
+ if (ParenthesesStack != 0) {
+ //
+ // The '(' doesn't pair with ')', invalid device path text
+ //
+ return NULL;
+ }
+
+ if (IS_COMMA (*Str)) {
+ *IsInstanceEnd = TRUE;
+ *Str = L'\0';
+ Str++;
+ } else {
+ *IsInstanceEnd = FALSE;
+ if (!IS_NULL (*Str)) {
+ *Str = L'\0';
+ Str++;
+ }
+ }
+
+ *DevicePath = Str;
+
+ return ReturnStr;
+}
+
+/**
+ Converts a generic text device path node to device path structure.
+
+ @param Type The type of the device path node.
+ @param TextDeviceNode The input text device path node.
+
+ @return A pointer to device path structure.
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextGenericPath (
+ UINT8 Type,
+ CHAR16 *TextDeviceNode
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL *Node;
+ CHAR16 *SubtypeStr;
+ CHAR16 *DataStr;
+ UINTN DataLength;
+
+ SubtypeStr = GetNextParamStr (&TextDeviceNode);
+ DataStr = GetNextParamStr (&TextDeviceNode);
+
+ if (DataStr == NULL) {
+ DataLength = 0;
+ } else {
+ DataLength = StrLen (DataStr) / 2;
+ }
+ Node = CreateDeviceNode (
+ Type,
+ (UINT8) Strtoi (SubtypeStr),
+ (UINT16) (sizeof (EFI_DEVICE_PATH_PROTOCOL) + DataLength)
+ );
+
+ StrHexToBytes (DataStr, DataLength * 2, (UINT8 *) (Node + 1), DataLength);
+ return Node;
+}
+
+/**
+ Converts a generic text device path node to device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextPath (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *TypeStr;
+
+ TypeStr = GetNextParamStr (&TextDeviceNode);
+
+ return DevPathFromTextGenericPath ((UINT8) Strtoi (TypeStr), TextDeviceNode);
+}
+
+/**
+ Converts a generic hardware text device path node to Hardware device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to Hardware device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextHardwarePath (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return DevPathFromTextGenericPath (HARDWARE_DEVICE_PATH, TextDeviceNode);
+}
+
+/**
+ Converts a text device path node to Hardware PCI device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to Hardware PCI device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextPci (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *FunctionStr;
+ CHAR16 *DeviceStr;
+ PCI_DEVICE_PATH *Pci;
+
+ DeviceStr = GetNextParamStr (&TextDeviceNode);
+ FunctionStr = GetNextParamStr (&TextDeviceNode);
+ Pci = (PCI_DEVICE_PATH *) CreateDeviceNode (
+ HARDWARE_DEVICE_PATH,
+ HW_PCI_DP,
+ (UINT16) sizeof (PCI_DEVICE_PATH)
+ );
+
+ Pci->Function = (UINT8) Strtoi (FunctionStr);
+ Pci->Device = (UINT8) Strtoi (DeviceStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Pci;
+}
+
+/**
+ Converts a text device path node to Hardware PC card device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to Hardware PC card device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextPcCard (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *FunctionNumberStr;
+ PCCARD_DEVICE_PATH *Pccard;
+
+ FunctionNumberStr = GetNextParamStr (&TextDeviceNode);
+ Pccard = (PCCARD_DEVICE_PATH *) CreateDeviceNode (
+ HARDWARE_DEVICE_PATH,
+ HW_PCCARD_DP,
+ (UINT16) sizeof (PCCARD_DEVICE_PATH)
+ );
+
+ Pccard->FunctionNumber = (UINT8) Strtoi (FunctionNumberStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Pccard;
+}
+
+/**
+ Converts a text device path node to Hardware memory map device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to Hardware memory map device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextMemoryMapped (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *MemoryTypeStr;
+ CHAR16 *StartingAddressStr;
+ CHAR16 *EndingAddressStr;
+ MEMMAP_DEVICE_PATH *MemMap;
+
+ MemoryTypeStr = GetNextParamStr (&TextDeviceNode);
+ StartingAddressStr = GetNextParamStr (&TextDeviceNode);
+ EndingAddressStr = GetNextParamStr (&TextDeviceNode);
+ MemMap = (MEMMAP_DEVICE_PATH *) CreateDeviceNode (
+ HARDWARE_DEVICE_PATH,
+ HW_MEMMAP_DP,
+ (UINT16) sizeof (MEMMAP_DEVICE_PATH)
+ );
+
+ MemMap->MemoryType = (UINT32) Strtoi (MemoryTypeStr);
+ Strtoi64 (StartingAddressStr, &MemMap->StartingAddress);
+ Strtoi64 (EndingAddressStr, &MemMap->EndingAddress);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) MemMap;
+}
+
+/**
+ Converts a text device path node to Vendor device path structure based on the input Type
+ and SubType.
+
+ @param TextDeviceNode The input Text device path node.
+ @param Type The type of device path node.
+ @param SubType The subtype of device path node.
+
+ @return A pointer to the newly-created Vendor device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+ConvertFromTextVendor (
+ CHAR16 *TextDeviceNode,
+ UINT8 Type,
+ UINT8 SubType
+ )
+{
+ CHAR16 *GuidStr;
+ CHAR16 *DataStr;
+ UINTN Length;
+ VENDOR_DEVICE_PATH *Vendor;
+
+ GuidStr = GetNextParamStr (&TextDeviceNode);
+
+ DataStr = GetNextParamStr (&TextDeviceNode);
+ Length = StrLen (DataStr);
+ //
+ // Two hex characters make up 1 buffer byte
+ //
+ Length = (Length + 1) / 2;
+
+ Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
+ Type,
+ SubType,
+ (UINT16) (sizeof (VENDOR_DEVICE_PATH) + Length)
+ );
+
+ StrToGuid (GuidStr, &Vendor->Guid);
+ StrHexToBytes (DataStr, Length * 2, (UINT8 *) (Vendor + 1), Length);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+}
+
+/**
+ Converts a text device path node to Vendor Hardware device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Vendor Hardware device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextVenHw (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return ConvertFromTextVendor (
+ TextDeviceNode,
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP
+ );
+}
+
+/**
+ Converts a text device path node to Hardware Controller device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Hardware Controller device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextCtrl (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *ControllerStr;
+ CONTROLLER_DEVICE_PATH *Controller;
+
+ ControllerStr = GetNextParamStr (&TextDeviceNode);
+ Controller = (CONTROLLER_DEVICE_PATH *) CreateDeviceNode (
+ HARDWARE_DEVICE_PATH,
+ HW_CONTROLLER_DP,
+ (UINT16) sizeof (CONTROLLER_DEVICE_PATH)
+ );
+ Controller->ControllerNumber = (UINT32) Strtoi (ControllerStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Controller;
+}
+
+/**
+ Converts a text device path node to BMC device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created BMC device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextBmc (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *InterfaceTypeStr;
+ CHAR16 *BaseAddressStr;
+ BMC_DEVICE_PATH *BmcDp;
+
+ InterfaceTypeStr = GetNextParamStr (&TextDeviceNode);
+ BaseAddressStr = GetNextParamStr (&TextDeviceNode);
+ BmcDp = (BMC_DEVICE_PATH *) CreateDeviceNode (
+ HARDWARE_DEVICE_PATH,
+ HW_BMC_DP,
+ (UINT16) sizeof (BMC_DEVICE_PATH)
+ );
+
+ BmcDp->InterfaceType = (UINT8) Strtoi (InterfaceTypeStr);
+ WriteUnaligned64 (
+ (UINT64 *) (&BmcDp->BaseAddress),
+ StrHexToUint64 (BaseAddressStr)
+ );
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) BmcDp;
+}
+
+/**
+ Converts a generic ACPI text device path node to ACPI device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to ACPI device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextAcpiPath (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return DevPathFromTextGenericPath (ACPI_DEVICE_PATH, TextDeviceNode);
+}
+
+/**
+ Converts a string to EisaId.
+
+ @param Text The input string.
+
+ @return UINT32 EISA ID.
+**/
+UINT32
+EisaIdFromText (
+ CHAR16 *Text
+ )
+{
+ return (((Text[0] - 'A' + 1) & 0x1f) << 10)
+ + (((Text[1] - 'A' + 1) & 0x1f) << 5)
+ + (((Text[2] - 'A' + 1) & 0x1f) << 0)
+ + (UINT32) (StrHexToUint64 (&Text[3]) << 16)
+ ;
+}
+
+/**
+ Converts a text device path node to ACPI HID device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created ACPI HID device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextAcpi (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *HIDStr;
+ CHAR16 *UIDStr;
+ ACPI_HID_DEVICE_PATH *Acpi;
+
+ HIDStr = GetNextParamStr (&TextDeviceNode);
+ UIDStr = GetNextParamStr (&TextDeviceNode);
+ Acpi = (ACPI_HID_DEVICE_PATH *) CreateDeviceNode (
+ ACPI_DEVICE_PATH,
+ ACPI_DP,
+ (UINT16) sizeof (ACPI_HID_DEVICE_PATH)
+ );
+
+ Acpi->HID = EisaIdFromText (HIDStr);
+ Acpi->UID = (UINT32) Strtoi (UIDStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Acpi;
+}
+
+/**
+ Converts a text device path node to ACPI HID device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+ @param PnPId The input plug and play identification.
+
+ @return A pointer to the newly-created ACPI HID device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+ConvertFromTextAcpi (
+ CHAR16 *TextDeviceNode,
+ UINT32 PnPId
+ )
+{
+ CHAR16 *UIDStr;
+ ACPI_HID_DEVICE_PATH *Acpi;
+
+ UIDStr = GetNextParamStr (&TextDeviceNode);
+ Acpi = (ACPI_HID_DEVICE_PATH *) CreateDeviceNode (
+ ACPI_DEVICE_PATH,
+ ACPI_DP,
+ (UINT16) sizeof (ACPI_HID_DEVICE_PATH)
+ );
+
+ Acpi->HID = EFI_PNP_ID (PnPId);
+ Acpi->UID = (UINT32) Strtoi (UIDStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Acpi;
+}
+
+/**
+ Converts a text device path node to PCI root device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created PCI root device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextPciRoot (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return ConvertFromTextAcpi (TextDeviceNode, 0x0a03);
+}
+
+/**
+ Converts a text device path node to PCIE root device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created PCIE root device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextPcieRoot (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return ConvertFromTextAcpi (TextDeviceNode, 0x0a08);
+}
+
+/**
+ Converts a text device path node to Floppy device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Floppy device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextFloppy (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return ConvertFromTextAcpi (TextDeviceNode, 0x0604);
+}
+
+/**
+ Converts a text device path node to Keyboard device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Keyboard device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextKeyboard (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return ConvertFromTextAcpi (TextDeviceNode, 0x0301);
+}
+
+/**
+ Converts a text device path node to Serial device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Serial device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextSerial (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return ConvertFromTextAcpi (TextDeviceNode, 0x0501);
+}
+
+/**
+ Converts a text device path node to Parallel Port device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Parallel Port device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextParallelPort (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return ConvertFromTextAcpi (TextDeviceNode, 0x0401);
+}
+
+/**
+ Converts a text device path node to ACPI extension device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created ACPI extension device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextAcpiEx (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *HIDStr;
+ CHAR16 *CIDStr;
+ CHAR16 *UIDStr;
+ CHAR16 *HIDSTRStr;
+ CHAR16 *CIDSTRStr;
+ CHAR16 *UIDSTRStr;
+ CHAR8 *AsciiStr;
+ UINT16 Length;
+ ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx;
+
+ HIDStr = GetNextParamStr (&TextDeviceNode);
+ CIDStr = GetNextParamStr (&TextDeviceNode);
+ UIDStr = GetNextParamStr (&TextDeviceNode);
+ HIDSTRStr = GetNextParamStr (&TextDeviceNode);
+ CIDSTRStr = GetNextParamStr (&TextDeviceNode);
+ UIDSTRStr = GetNextParamStr (&TextDeviceNode);
+
+ Length = (UINT16) (sizeof (ACPI_EXTENDED_HID_DEVICE_PATH) + StrLen (HIDSTRStr) + 1);
+ Length = (UINT16) (Length + StrLen (UIDSTRStr) + 1);
+ Length = (UINT16) (Length + StrLen (CIDSTRStr) + 1);
+ AcpiEx = (ACPI_EXTENDED_HID_DEVICE_PATH *) CreateDeviceNode (
+ ACPI_DEVICE_PATH,
+ ACPI_EXTENDED_DP,
+ Length
+ );
+
+ AcpiEx->HID = EisaIdFromText (HIDStr);
+ AcpiEx->CID = EisaIdFromText (CIDStr);
+ AcpiEx->UID = (UINT32) Strtoi (UIDStr);
+
+ AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
+ StrToAscii (HIDSTRStr, &AsciiStr);
+ StrToAscii (UIDSTRStr, &AsciiStr);
+ StrToAscii (CIDSTRStr, &AsciiStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) AcpiEx;
+}
+
+/**
+ Converts a text device path node to ACPI extension device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created ACPI extension device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextAcpiExp (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *HIDStr;
+ CHAR16 *CIDStr;
+ CHAR16 *UIDSTRStr;
+ CHAR8 *AsciiStr;
+ UINT16 Length;
+ ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx;
+
+ HIDStr = GetNextParamStr (&TextDeviceNode);
+ CIDStr = GetNextParamStr (&TextDeviceNode);
+ UIDSTRStr = GetNextParamStr (&TextDeviceNode);
+ Length = (UINT16) (sizeof (ACPI_EXTENDED_HID_DEVICE_PATH) + StrLen (UIDSTRStr) + 3);
+ AcpiEx = (ACPI_EXTENDED_HID_DEVICE_PATH *) CreateDeviceNode (
+ ACPI_DEVICE_PATH,
+ ACPI_EXTENDED_DP,
+ Length
+ );
+
+ AcpiEx->HID = EisaIdFromText (HIDStr);
+ //
+ // According to UEFI spec, the CID parametr is optional and has a default value of 0.
+ // So when the CID parametr is not specified or specified as 0 in the text device node.
+ // Set the CID to 0 in the ACPI extension device path structure.
+ //
+ if (*CIDStr == L'\0' || *CIDStr == L'0') {
+ AcpiEx->CID = 0;
+ } else {
+ AcpiEx->CID = EisaIdFromText (CIDStr);
+ }
+ AcpiEx->UID = 0;
+
+ AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
+ //
+ // HID string is NULL
+ //
+ *AsciiStr = '\0';
+ //
+ // Convert UID string
+ //
+ AsciiStr++;
+ StrToAscii (UIDSTRStr, &AsciiStr);
+ //
+ // CID string is NULL
+ //
+ *AsciiStr = '\0';
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) AcpiEx;
+}
+
+/**
+ Converts a text device path node to ACPI _ADR device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created ACPI _ADR device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextAcpiAdr (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *DisplayDeviceStr;
+ ACPI_ADR_DEVICE_PATH *AcpiAdr;
+ UINTN Index;
+ UINTN Length;
+
+ AcpiAdr = (ACPI_ADR_DEVICE_PATH *) CreateDeviceNode (
+ ACPI_DEVICE_PATH,
+ ACPI_ADR_DP,
+ (UINT16) sizeof (ACPI_ADR_DEVICE_PATH)
+ );
+ ASSERT (AcpiAdr != NULL);
+
+ for (Index = 0; ; Index++) {
+ DisplayDeviceStr = GetNextParamStr (&TextDeviceNode);
+ if (IS_NULL (*DisplayDeviceStr)) {
+ break;
+ }
+ if (Index > 0) {
+ Length = DevicePathNodeLength (AcpiAdr);
+ AcpiAdr = ReallocatePool (
+ Length,
+ Length + sizeof (UINT32),
+ AcpiAdr
+ );
+ ASSERT (AcpiAdr != NULL);
+ SetDevicePathNodeLength (AcpiAdr, Length + sizeof (UINT32));
+ }
+
+ (&AcpiAdr->ADR)[Index] = (UINT32) Strtoi (DisplayDeviceStr);
+ }
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr;
+}
+
+/**
+ Converts a generic messaging text device path node to messaging device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to messaging device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextMsg (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return DevPathFromTextGenericPath (MESSAGING_DEVICE_PATH, TextDeviceNode);
+}
+
+/**
+ Converts a text device path node to Parallel Port device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Parallel Port device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextAta (
+ CHAR16 *TextDeviceNode
+)
+{
+ CHAR16 *PrimarySecondaryStr;
+ CHAR16 *SlaveMasterStr;
+ CHAR16 *LunStr;
+ ATAPI_DEVICE_PATH *Atapi;
+
+ Atapi = (ATAPI_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_ATAPI_DP,
+ (UINT16) sizeof (ATAPI_DEVICE_PATH)
+ );
+
+ PrimarySecondaryStr = GetNextParamStr (&TextDeviceNode);
+ SlaveMasterStr = GetNextParamStr (&TextDeviceNode);
+ LunStr = GetNextParamStr (&TextDeviceNode);
+
+ if (StrCmp (PrimarySecondaryStr, L"Primary") == 0) {
+ Atapi->PrimarySecondary = 0;
+ } else if (StrCmp (PrimarySecondaryStr, L"Secondary") == 0) {
+ Atapi->PrimarySecondary = 1;
+ } else {
+ Atapi->PrimarySecondary = (UINT8) Strtoi (PrimarySecondaryStr);
+ }
+ if (StrCmp (SlaveMasterStr, L"Master") == 0) {
+ Atapi->SlaveMaster = 0;
+ } else if (StrCmp (SlaveMasterStr, L"Slave") == 0) {
+ Atapi->SlaveMaster = 1;
+ } else {
+ Atapi->SlaveMaster = (UINT8) Strtoi (SlaveMasterStr);
+ }
+
+ Atapi->Lun = (UINT16) Strtoi (LunStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Atapi;
+}
+
+/**
+ Converts a text device path node to SCSI device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created SCSI device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextScsi (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *PunStr;
+ CHAR16 *LunStr;
+ SCSI_DEVICE_PATH *Scsi;
+
+ PunStr = GetNextParamStr (&TextDeviceNode);
+ LunStr = GetNextParamStr (&TextDeviceNode);
+ Scsi = (SCSI_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_SCSI_DP,
+ (UINT16) sizeof (SCSI_DEVICE_PATH)
+ );
+
+ Scsi->Pun = (UINT16) Strtoi (PunStr);
+ Scsi->Lun = (UINT16) Strtoi (LunStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Scsi;
+}
+
+/**
+ Converts a text device path node to Fibre device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Fibre device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextFibre (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *WWNStr;
+ CHAR16 *LunStr;
+ FIBRECHANNEL_DEVICE_PATH *Fibre;
+
+ WWNStr = GetNextParamStr (&TextDeviceNode);
+ LunStr = GetNextParamStr (&TextDeviceNode);
+ Fibre = (FIBRECHANNEL_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_FIBRECHANNEL_DP,
+ (UINT16) sizeof (FIBRECHANNEL_DEVICE_PATH)
+ );
+
+ Fibre->Reserved = 0;
+ Strtoi64 (WWNStr, &Fibre->WWN);
+ Strtoi64 (LunStr, &Fibre->Lun);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Fibre;
+}
+
+/**
+ Converts a text device path node to FibreEx device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created FibreEx device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextFibreEx (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *WWNStr;
+ CHAR16 *LunStr;
+ FIBRECHANNELEX_DEVICE_PATH *FibreEx;
+
+ WWNStr = GetNextParamStr (&TextDeviceNode);
+ LunStr = GetNextParamStr (&TextDeviceNode);
+ FibreEx = (FIBRECHANNELEX_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_FIBRECHANNELEX_DP,
+ (UINT16) sizeof (FIBRECHANNELEX_DEVICE_PATH)
+ );
+
+ FibreEx->Reserved = 0;
+ Strtoi64 (WWNStr, (UINT64 *) (&FibreEx->WWN));
+ Strtoi64 (LunStr, (UINT64 *) (&FibreEx->Lun));
+
+ *(UINT64 *) (&FibreEx->WWN) = SwapBytes64 (*(UINT64 *) (&FibreEx->WWN));
+ *(UINT64 *) (&FibreEx->Lun) = SwapBytes64 (*(UINT64 *) (&FibreEx->Lun));
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) FibreEx;
+}
+
+/**
+ Converts a text device path node to 1394 device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created 1394 device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromText1394 (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *GuidStr;
+ F1394_DEVICE_PATH *F1394DevPath;
+
+ GuidStr = GetNextParamStr (&TextDeviceNode);
+ F1394DevPath = (F1394_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_1394_DP,
+ (UINT16) sizeof (F1394_DEVICE_PATH)
+ );
+
+ F1394DevPath->Reserved = 0;
+ F1394DevPath->Guid = StrHexToUint64 (GuidStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) F1394DevPath;
+}
+
+/**
+ Converts a text device path node to USB device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsb (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *PortStr;
+ CHAR16 *InterfaceStr;
+ USB_DEVICE_PATH *Usb;
+
+ PortStr = GetNextParamStr (&TextDeviceNode);
+ InterfaceStr = GetNextParamStr (&TextDeviceNode);
+ Usb = (USB_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_USB_DP,
+ (UINT16) sizeof (USB_DEVICE_PATH)
+ );
+
+ Usb->ParentPortNumber = (UINT8) Strtoi (PortStr);
+ Usb->InterfaceNumber = (UINT8) Strtoi (InterfaceStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Usb;
+}
+
+/**
+ Converts a text device path node to I20 device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created I20 device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextI2O (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *TIDStr;
+ I2O_DEVICE_PATH *I2ODevPath;
+
+ TIDStr = GetNextParamStr (&TextDeviceNode);
+ I2ODevPath = (I2O_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_I2O_DP,
+ (UINT16) sizeof (I2O_DEVICE_PATH)
+ );
+
+ I2ODevPath->Tid = (UINT32) Strtoi (TIDStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) I2ODevPath;
+}
+
+/**
+ Converts a text device path node to Infini Band device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Infini Band device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextInfiniband (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *FlagsStr;
+ CHAR16 *GuidStr;
+ CHAR16 *SidStr;
+ CHAR16 *TidStr;
+ CHAR16 *DidStr;
+ INFINIBAND_DEVICE_PATH *InfiniBand;
+
+ FlagsStr = GetNextParamStr (&TextDeviceNode);
+ GuidStr = GetNextParamStr (&TextDeviceNode);
+ SidStr = GetNextParamStr (&TextDeviceNode);
+ TidStr = GetNextParamStr (&TextDeviceNode);
+ DidStr = GetNextParamStr (&TextDeviceNode);
+ InfiniBand = (INFINIBAND_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_INFINIBAND_DP,
+ (UINT16) sizeof (INFINIBAND_DEVICE_PATH)
+ );
+
+ InfiniBand->ResourceFlags = (UINT32) Strtoi (FlagsStr);
+ StrToGuid (GuidStr, (EFI_GUID *) InfiniBand->PortGid);
+ Strtoi64 (SidStr, &InfiniBand->ServiceId);
+ Strtoi64 (TidStr, &InfiniBand->TargetPortId);
+ Strtoi64 (DidStr, &InfiniBand->DeviceId);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) InfiniBand;
+}
+
+/**
+ Converts a text device path node to Vendor-Defined Messaging device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Vendor-Defined Messaging device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextVenMsg (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return ConvertFromTextVendor (
+ TextDeviceNode,
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP
+ );
+}
+
+/**
+ Converts a text device path node to Vendor defined PC-ANSI device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Vendor defined PC-ANSI device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextVenPcAnsi (
+ CHAR16 *TextDeviceNode
+ )
+{
+ VENDOR_DEVICE_PATH *Vendor;
+
+ Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16) sizeof (VENDOR_DEVICE_PATH));
+ CopyGuid (&Vendor->Guid, &gEfiPcAnsiGuid);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+}
+
+/**
+ Converts a text device path node to Vendor defined VT100 device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Vendor defined VT100 device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextVenVt100 (
+ CHAR16 *TextDeviceNode
+ )
+{
+ VENDOR_DEVICE_PATH *Vendor;
+
+ Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16) sizeof (VENDOR_DEVICE_PATH));
+ CopyGuid (&Vendor->Guid, &gEfiVT100Guid);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+}
+
+/**
+ Converts a text device path node to Vendor defined VT100 Plus device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Vendor defined VT100 Plus device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextVenVt100Plus (
+ CHAR16 *TextDeviceNode
+ )
+{
+ VENDOR_DEVICE_PATH *Vendor;
+
+ Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16) sizeof (VENDOR_DEVICE_PATH));
+ CopyGuid (&Vendor->Guid, &gEfiVT100PlusGuid);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+}
+
+/**
+ Converts a text device path node to Vendor defined UTF8 device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Vendor defined UTF8 device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextVenUtf8 (
+ CHAR16 *TextDeviceNode
+ )
+{
+ VENDOR_DEVICE_PATH *Vendor;
+
+ Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16) sizeof (VENDOR_DEVICE_PATH));
+ CopyGuid (&Vendor->Guid, &gEfiVTUTF8Guid);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
+}
+
+/**
+ Converts a text device path node to UART Flow Control device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created UART Flow Control device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUartFlowCtrl (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *ValueStr;
+ UART_FLOW_CONTROL_DEVICE_PATH *UartFlowControl;
+
+ ValueStr = GetNextParamStr (&TextDeviceNode);
+ UartFlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16) sizeof (UART_FLOW_CONTROL_DEVICE_PATH)
+ );
+
+ CopyGuid (&UartFlowControl->Guid, &gEfiUartDevicePathGuid);
+ if (StrCmp (ValueStr, L"XonXoff") == 0) {
+ UartFlowControl->FlowControlMap = 2;
+ } else if (StrCmp (ValueStr, L"Hardware") == 0) {
+ UartFlowControl->FlowControlMap = 1;
+ } else {
+ UartFlowControl->FlowControlMap = 0;
+ }
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) UartFlowControl;
+}
+
+/**
+ Converts a text device path node to Serial Attached SCSI device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Serial Attached SCSI device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextSAS (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *AddressStr;
+ CHAR16 *LunStr;
+ CHAR16 *RTPStr;
+ CHAR16 *SASSATAStr;
+ CHAR16 *LocationStr;
+ CHAR16 *ConnectStr;
+ CHAR16 *DriveBayStr;
+ CHAR16 *ReservedStr;
+ UINT16 Info;
+ UINT16 Uint16;
+ SAS_DEVICE_PATH *Sas;
+
+ AddressStr = GetNextParamStr (&TextDeviceNode);
+ LunStr = GetNextParamStr (&TextDeviceNode);
+ RTPStr = GetNextParamStr (&TextDeviceNode);
+ SASSATAStr = GetNextParamStr (&TextDeviceNode);
+ LocationStr = GetNextParamStr (&TextDeviceNode);
+ ConnectStr = GetNextParamStr (&TextDeviceNode);
+ DriveBayStr = GetNextParamStr (&TextDeviceNode);
+ ReservedStr = GetNextParamStr (&TextDeviceNode);
+ Sas = (SAS_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16) sizeof (SAS_DEVICE_PATH)
+ );
+
+ CopyGuid (&Sas->Guid, &gEfiSasDevicePathGuid);
+ Strtoi64 (AddressStr, &Sas->SasAddress);
+ Strtoi64 (LunStr, &Sas->Lun);
+ Sas->RelativeTargetPort = (UINT16) Strtoi (RTPStr);
+
+ if (StrCmp (SASSATAStr, L"NoTopology") == 0) {
+ Info = 0x0;
+
+ } else if ((StrCmp (SASSATAStr, L"SATA") == 0) || (StrCmp (SASSATAStr, L"SAS") == 0)) {
+
+ Uint16 = (UINT16) Strtoi (DriveBayStr);
+ if (Uint16 == 0) {
+ Info = 0x1;
+ } else {
+ Info = (UINT16) (0x2 | ((Uint16 - 1) << 8));
+ }
+
+ if (StrCmp (SASSATAStr, L"SATA") == 0) {
+ Info |= BIT4;
+ }
+
+ //
+ // Location is an integer between 0 and 1 or else
+ // the keyword Internal (0) or External (1).
+ //
+ if (StrCmp (LocationStr, L"External") == 0) {
+ Uint16 = 1;
+ } else if (StrCmp (LocationStr, L"Internal") == 0) {
+ Uint16 = 0;
+ } else {
+ Uint16 = ((UINT16) Strtoi (LocationStr) & BIT0);
+ }
+ Info |= (Uint16 << 5);
+
+ //
+ // Connect is an integer between 0 and 3 or else
+ // the keyword Direct (0) or Expanded (1).
+ //
+ if (StrCmp (ConnectStr, L"Expanded") == 0) {
+ Uint16 = 1;
+ } else if (StrCmp (ConnectStr, L"Direct") == 0) {
+ Uint16 = 0;
+ } else {
+ Uint16 = ((UINT16) Strtoi (ConnectStr) & (BIT0 | BIT1));
+ }
+ Info |= (Uint16 << 6);
+
+ } else {
+ Info = (UINT16) Strtoi (SASSATAStr);
+ }
+
+ Sas->DeviceTopology = Info;
+ Sas->Reserved = (UINT32) Strtoi (ReservedStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Sas;
+}
+
+/**
+ Converts a text device path node to Serial Attached SCSI Ex device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Serial Attached SCSI Ex device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextSasEx (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *AddressStr;
+ CHAR16 *LunStr;
+ CHAR16 *RTPStr;
+ CHAR16 *SASSATAStr;
+ CHAR16 *LocationStr;
+ CHAR16 *ConnectStr;
+ CHAR16 *DriveBayStr;
+ UINT16 Info;
+ UINT16 Uint16;
+ UINT64 SasAddress;
+ UINT64 Lun;
+ SASEX_DEVICE_PATH *SasEx;
+
+ AddressStr = GetNextParamStr (&TextDeviceNode);
+ LunStr = GetNextParamStr (&TextDeviceNode);
+ RTPStr = GetNextParamStr (&TextDeviceNode);
+ SASSATAStr = GetNextParamStr (&TextDeviceNode);
+ LocationStr = GetNextParamStr (&TextDeviceNode);
+ ConnectStr = GetNextParamStr (&TextDeviceNode);
+ DriveBayStr = GetNextParamStr (&TextDeviceNode);
+ SasEx = (SASEX_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_SASEX_DP,
+ (UINT16) sizeof (SASEX_DEVICE_PATH)
+ );
+
+ Strtoi64 (AddressStr, &SasAddress);
+ Strtoi64 (LunStr, &Lun);
+ WriteUnaligned64 ((UINT64 *) &SasEx->SasAddress, SwapBytes64 (SasAddress));
+ WriteUnaligned64 ((UINT64 *) &SasEx->Lun, SwapBytes64 (Lun));
+ SasEx->RelativeTargetPort = (UINT16) Strtoi (RTPStr);
+
+ if (StrCmp (SASSATAStr, L"NoTopology") == 0) {
+ Info = 0x0;
+
+ } else if ((StrCmp (SASSATAStr, L"SATA") == 0) || (StrCmp (SASSATAStr, L"SAS") == 0)) {
+
+ Uint16 = (UINT16) Strtoi (DriveBayStr);
+ if (Uint16 == 0) {
+ Info = 0x1;
+ } else {
+ Info = (UINT16) (0x2 | ((Uint16 - 1) << 8));
+ }
+
+ if (StrCmp (SASSATAStr, L"SATA") == 0) {
+ Info |= BIT4;
+ }
+
+ //
+ // Location is an integer between 0 and 1 or else
+ // the keyword Internal (0) or External (1).
+ //
+ if (StrCmp (LocationStr, L"External") == 0) {
+ Uint16 = 1;
+ } else if (StrCmp (LocationStr, L"Internal") == 0) {
+ Uint16 = 0;
+ } else {
+ Uint16 = ((UINT16) Strtoi (LocationStr) & BIT0);
+ }
+ Info |= (Uint16 << 5);
+
+ //
+ // Connect is an integer between 0 and 3 or else
+ // the keyword Direct (0) or Expanded (1).
+ //
+ if (StrCmp (ConnectStr, L"Expanded") == 0) {
+ Uint16 = 1;
+ } else if (StrCmp (ConnectStr, L"Direct") == 0) {
+ Uint16 = 0;
+ } else {
+ Uint16 = ((UINT16) Strtoi (ConnectStr) & (BIT0 | BIT1));
+ }
+ Info |= (Uint16 << 6);
+
+ } else {
+ Info = (UINT16) Strtoi (SASSATAStr);
+ }
+
+ SasEx->DeviceTopology = Info;
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) SasEx;
+}
+
+/**
+ Converts a text device path node to NVM Express Namespace device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created NVM Express Namespace device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextNVMe (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *NamespaceIdStr;
+ CHAR16 *NamespaceUuidStr;
+ NVME_NAMESPACE_DEVICE_PATH *Nvme;
+ UINT8 *Uuid;
+ UINTN Index;
+
+ NamespaceIdStr = GetNextParamStr (&TextDeviceNode);
+ NamespaceUuidStr = GetNextParamStr (&TextDeviceNode);
+ Nvme = (NVME_NAMESPACE_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_NVME_NAMESPACE_DP,
+ (UINT16) sizeof (NVME_NAMESPACE_DEVICE_PATH)
+ );
+
+ Nvme->NamespaceId = (UINT32) Strtoi (NamespaceIdStr);
+ Uuid = (UINT8 *) &Nvme->NamespaceUuid;
+
+ Index = sizeof (Nvme->NamespaceUuid) / sizeof (UINT8);
+ while (Index-- != 0) {
+ Uuid[Index] = (UINT8) StrHexToUint64 (SplitStr (&NamespaceUuidStr, L'-'));
+ }
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Nvme;
+}
+
+/**
+ Converts a text device path node to UFS device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created UFS device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUfs (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *PunStr;
+ CHAR16 *LunStr;
+ UFS_DEVICE_PATH *Ufs;
+
+ PunStr = GetNextParamStr (&TextDeviceNode);
+ LunStr = GetNextParamStr (&TextDeviceNode);
+ Ufs = (UFS_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_UFS_DP,
+ (UINT16) sizeof (UFS_DEVICE_PATH)
+ );
+
+ Ufs->Pun = (UINT8) Strtoi (PunStr);
+ Ufs->Lun = (UINT8) Strtoi (LunStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Ufs;
+}
+
+/**
+ Converts a text device path node to SD (Secure Digital) device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created SD device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextSd (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *SlotNumberStr;
+ SD_DEVICE_PATH *Sd;
+
+ SlotNumberStr = GetNextParamStr (&TextDeviceNode);
+ Sd = (SD_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_SD_DP,
+ (UINT16) sizeof (SD_DEVICE_PATH)
+ );
+
+ Sd->SlotNumber = (UINT8) Strtoi (SlotNumberStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Sd;
+}
+
+/**
+ Converts a text device path node to EMMC (Embedded MMC) device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created EMMC device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextEmmc (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *SlotNumberStr;
+ EMMC_DEVICE_PATH *Emmc;
+
+ SlotNumberStr = GetNextParamStr (&TextDeviceNode);
+ Emmc = (EMMC_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_EMMC_DP,
+ (UINT16) sizeof (EMMC_DEVICE_PATH)
+ );
+
+ Emmc->SlotNumber = (UINT8) Strtoi (SlotNumberStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Emmc;
+}
+
+/**
+ Converts a text device path node to Debug Port device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Debug Port device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextDebugPort (
+ CHAR16 *TextDeviceNode
+ )
+{
+ VENDOR_DEVICE_PATH *Vend;
+
+ Vend = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT16) sizeof (VENDOR_DEVICE_PATH)
+ );
+
+ CopyGuid (&Vend->Guid, &gEfiDebugPortProtocolGuid);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Vend;
+}
+
+/**
+ Converts a text device path node to MAC device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created MAC device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextMAC (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *AddressStr;
+ CHAR16 *IfTypeStr;
+ UINTN Length;
+ MAC_ADDR_DEVICE_PATH *MACDevPath;
+
+ AddressStr = GetNextParamStr (&TextDeviceNode);
+ IfTypeStr = GetNextParamStr (&TextDeviceNode);
+ MACDevPath = (MAC_ADDR_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_MAC_ADDR_DP,
+ (UINT16) sizeof (MAC_ADDR_DEVICE_PATH)
+ );
+
+ MACDevPath->IfType = (UINT8) Strtoi (IfTypeStr);
+
+ Length = sizeof (EFI_MAC_ADDRESS);
+ if (MACDevPath->IfType == 0x01 || MACDevPath->IfType == 0x00) {
+ Length = 6;
+ }
+
+ StrHexToBytes (AddressStr, Length * 2, MACDevPath->MacAddress.Addr, Length);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) MACDevPath;
+}
+
+
+/**
+ Converts a text format to the network protocol ID.
+
+ @param Text String of protocol field.
+
+ @return Network protocol ID .
+
+**/
+UINTN
+NetworkProtocolFromText (
+ CHAR16 *Text
+ )
+{
+ if (StrCmp (Text, L"UDP") == 0) {
+ return RFC_1700_UDP_PROTOCOL;
+ }
+
+ if (StrCmp (Text, L"TCP") == 0) {
+ return RFC_1700_TCP_PROTOCOL;
+ }
+
+ return Strtoi (Text);
+}
+
+
+/**
+ Converts a text device path node to IPV4 device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created IPV4 device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextIPv4 (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *RemoteIPStr;
+ CHAR16 *ProtocolStr;
+ CHAR16 *TypeStr;
+ CHAR16 *LocalIPStr;
+ CHAR16 *GatewayIPStr;
+ CHAR16 *SubnetMaskStr;
+ IPv4_DEVICE_PATH *IPv4;
+
+ RemoteIPStr = GetNextParamStr (&TextDeviceNode);
+ ProtocolStr = GetNextParamStr (&TextDeviceNode);
+ TypeStr = GetNextParamStr (&TextDeviceNode);
+ LocalIPStr = GetNextParamStr (&TextDeviceNode);
+ GatewayIPStr = GetNextParamStr (&TextDeviceNode);
+ SubnetMaskStr = GetNextParamStr (&TextDeviceNode);
+ IPv4 = (IPv4_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_IPv4_DP,
+ (UINT16) sizeof (IPv4_DEVICE_PATH)
+ );
+
+ StrToIpv4Address (RemoteIPStr, NULL, &IPv4->RemoteIpAddress, NULL);
+ IPv4->Protocol = (UINT16) NetworkProtocolFromText (ProtocolStr);
+ if (StrCmp (TypeStr, L"Static") == 0) {
+ IPv4->StaticIpAddress = TRUE;
+ } else {
+ IPv4->StaticIpAddress = FALSE;
+ }
+
+ StrToIpv4Address (LocalIPStr, NULL, &IPv4->LocalIpAddress, NULL);
+ if (!IS_NULL (*GatewayIPStr) && !IS_NULL (*SubnetMaskStr)) {
+ StrToIpv4Address (GatewayIPStr, NULL, &IPv4->GatewayIpAddress, NULL);
+ StrToIpv4Address (SubnetMaskStr, NULL, &IPv4->SubnetMask, NULL);
+ } else {
+ ZeroMem (&IPv4->GatewayIpAddress, sizeof (IPv4->GatewayIpAddress));
+ ZeroMem (&IPv4->SubnetMask, sizeof (IPv4->SubnetMask));
+ }
+
+ IPv4->LocalPort = 0;
+ IPv4->RemotePort = 0;
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) IPv4;
+}
+
+/**
+ Converts a text device path node to IPV6 device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created IPV6 device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextIPv6 (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *RemoteIPStr;
+ CHAR16 *ProtocolStr;
+ CHAR16 *TypeStr;
+ CHAR16 *LocalIPStr;
+ CHAR16 *GatewayIPStr;
+ CHAR16 *PrefixLengthStr;
+ IPv6_DEVICE_PATH *IPv6;
+
+ RemoteIPStr = GetNextParamStr (&TextDeviceNode);
+ ProtocolStr = GetNextParamStr (&TextDeviceNode);
+ TypeStr = GetNextParamStr (&TextDeviceNode);
+ LocalIPStr = GetNextParamStr (&TextDeviceNode);
+ PrefixLengthStr = GetNextParamStr (&TextDeviceNode);
+ GatewayIPStr = GetNextParamStr (&TextDeviceNode);
+ IPv6 = (IPv6_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_IPv6_DP,
+ (UINT16) sizeof (IPv6_DEVICE_PATH)
+ );
+
+ StrToIpv6Address (RemoteIPStr, NULL, &IPv6->RemoteIpAddress, NULL);
+ IPv6->Protocol = (UINT16) NetworkProtocolFromText (ProtocolStr);
+ if (StrCmp (TypeStr, L"Static") == 0) {
+ IPv6->IpAddressOrigin = 0;
+ } else if (StrCmp (TypeStr, L"StatelessAutoConfigure") == 0) {
+ IPv6->IpAddressOrigin = 1;
+ } else {
+ IPv6->IpAddressOrigin = 2;
+ }
+
+ StrToIpv6Address (LocalIPStr, NULL, &IPv6->LocalIpAddress, NULL);
+ if (!IS_NULL (*GatewayIPStr) && !IS_NULL (*PrefixLengthStr)) {
+ StrToIpv6Address (GatewayIPStr, NULL, &IPv6->GatewayIpAddress, NULL);
+ IPv6->PrefixLength = (UINT8) Strtoi (PrefixLengthStr);
+ } else {
+ ZeroMem (&IPv6->GatewayIpAddress, sizeof (IPv6->GatewayIpAddress));
+ IPv6->PrefixLength = 0;
+ }
+
+ IPv6->LocalPort = 0;
+ IPv6->RemotePort = 0;
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) IPv6;
+}
+
+/**
+ Converts a text device path node to UART device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created UART device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUart (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *BaudStr;
+ CHAR16 *DataBitsStr;
+ CHAR16 *ParityStr;
+ CHAR16 *StopBitsStr;
+ UART_DEVICE_PATH *Uart;
+
+ BaudStr = GetNextParamStr (&TextDeviceNode);
+ DataBitsStr = GetNextParamStr (&TextDeviceNode);
+ ParityStr = GetNextParamStr (&TextDeviceNode);
+ StopBitsStr = GetNextParamStr (&TextDeviceNode);
+ Uart = (UART_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_UART_DP,
+ (UINT16) sizeof (UART_DEVICE_PATH)
+ );
+
+ if (StrCmp (BaudStr, L"DEFAULT") == 0) {
+ Uart->BaudRate = 115200;
+ } else {
+ Strtoi64 (BaudStr, &Uart->BaudRate);
+ }
+ Uart->DataBits = (UINT8) ((StrCmp (DataBitsStr, L"DEFAULT") == 0) ? 8 : Strtoi (DataBitsStr));
+ switch (*ParityStr) {
+ case L'D':
+ Uart->Parity = 0;
+ break;
+
+ case L'N':
+ Uart->Parity = 1;
+ break;
+
+ case L'E':
+ Uart->Parity = 2;
+ break;
+
+ case L'O':
+ Uart->Parity = 3;
+ break;
+
+ case L'M':
+ Uart->Parity = 4;
+ break;
+
+ case L'S':
+ Uart->Parity = 5;
+ break;
+
+ default:
+ Uart->Parity = (UINT8) Strtoi (ParityStr);
+ break;
+ }
+
+ if (StrCmp (StopBitsStr, L"D") == 0) {
+ Uart->StopBits = (UINT8) 0;
+ } else if (StrCmp (StopBitsStr, L"1") == 0) {
+ Uart->StopBits = (UINT8) 1;
+ } else if (StrCmp (StopBitsStr, L"1.5") == 0) {
+ Uart->StopBits = (UINT8) 2;
+ } else if (StrCmp (StopBitsStr, L"2") == 0) {
+ Uart->StopBits = (UINT8) 3;
+ } else {
+ Uart->StopBits = (UINT8) Strtoi (StopBitsStr);
+ }
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Uart;
+}
+
+/**
+ Converts a text device path node to USB class device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+ @param UsbClassText A pointer to USB_CLASS_TEXT structure to be integrated to USB Class Text.
+
+ @return A pointer to the newly-created USB class device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+ConvertFromTextUsbClass (
+ CHAR16 *TextDeviceNode,
+ USB_CLASS_TEXT *UsbClassText
+ )
+{
+ CHAR16 *VIDStr;
+ CHAR16 *PIDStr;
+ CHAR16 *ClassStr;
+ CHAR16 *SubClassStr;
+ CHAR16 *ProtocolStr;
+ USB_CLASS_DEVICE_PATH *UsbClass;
+
+ UsbClass = (USB_CLASS_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_USB_CLASS_DP,
+ (UINT16) sizeof (USB_CLASS_DEVICE_PATH)
+ );
+
+ VIDStr = GetNextParamStr (&TextDeviceNode);
+ PIDStr = GetNextParamStr (&TextDeviceNode);
+ if (UsbClassText->ClassExist) {
+ ClassStr = GetNextParamStr (&TextDeviceNode);
+ if (*ClassStr == L'\0') {
+ UsbClass->DeviceClass = 0xFF;
+ } else {
+ UsbClass->DeviceClass = (UINT8) Strtoi (ClassStr);
+ }
+ } else {
+ UsbClass->DeviceClass = UsbClassText->Class;
+ }
+ if (UsbClassText->SubClassExist) {
+ SubClassStr = GetNextParamStr (&TextDeviceNode);
+ if (*SubClassStr == L'\0') {
+ UsbClass->DeviceSubClass = 0xFF;
+ } else {
+ UsbClass->DeviceSubClass = (UINT8) Strtoi (SubClassStr);
+ }
+ } else {
+ UsbClass->DeviceSubClass = UsbClassText->SubClass;
+ }
+
+ ProtocolStr = GetNextParamStr (&TextDeviceNode);
+
+ if (*VIDStr == L'\0') {
+ UsbClass->VendorId = 0xFFFF;
+ } else {
+ UsbClass->VendorId = (UINT16) Strtoi (VIDStr);
+ }
+ if (*PIDStr == L'\0') {
+ UsbClass->ProductId = 0xFFFF;
+ } else {
+ UsbClass->ProductId = (UINT16) Strtoi (PIDStr);
+ }
+ if (*ProtocolStr == L'\0') {
+ UsbClass->DeviceProtocol = 0xFF;
+ } else {
+ UsbClass->DeviceProtocol = (UINT8) Strtoi (ProtocolStr);
+ }
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) UsbClass;
+}
+
+
+/**
+ Converts a text device path node to USB class device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB class device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbClass (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = TRUE;
+ UsbClassText.SubClassExist = TRUE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB audio device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB audio device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbAudio (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_AUDIO;
+ UsbClassText.SubClassExist = TRUE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB CDC Control device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB CDC Control device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbCDCControl (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_CDCCONTROL;
+ UsbClassText.SubClassExist = TRUE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB HID device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB HID device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbHID (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_HID;
+ UsbClassText.SubClassExist = TRUE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB Image device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB Image device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbImage (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_IMAGE;
+ UsbClassText.SubClassExist = TRUE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB Print device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB Print device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbPrinter (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_PRINTER;
+ UsbClassText.SubClassExist = TRUE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB mass storage device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB mass storage device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbMassStorage (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_MASS_STORAGE;
+ UsbClassText.SubClassExist = TRUE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB HUB device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB HUB device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbHub (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_HUB;
+ UsbClassText.SubClassExist = TRUE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB CDC data device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB CDC data device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbCDCData (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_CDCDATA;
+ UsbClassText.SubClassExist = TRUE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB smart card device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB smart card device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbSmartCard (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_SMART_CARD;
+ UsbClassText.SubClassExist = TRUE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB video device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB video device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbVideo (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_VIDEO;
+ UsbClassText.SubClassExist = TRUE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB diagnostic device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB diagnostic device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbDiagnostic (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_DIAGNOSTIC;
+ UsbClassText.SubClassExist = TRUE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB wireless device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB wireless device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbWireless (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_WIRELESS;
+ UsbClassText.SubClassExist = TRUE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB device firmware update device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB device firmware update device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbDeviceFirmwareUpdate (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_RESERVE;
+ UsbClassText.SubClassExist = FALSE;
+ UsbClassText.SubClass = USB_SUBCLASS_FW_UPDATE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB IRDA bridge device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB IRDA bridge device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbIrdaBridge (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_RESERVE;
+ UsbClassText.SubClassExist = FALSE;
+ UsbClassText.SubClass = USB_SUBCLASS_IRDA_BRIDGE;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB text and measurement device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB text and measurement device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbTestAndMeasurement (
+ CHAR16 *TextDeviceNode
+ )
+{
+ USB_CLASS_TEXT UsbClassText;
+
+ UsbClassText.ClassExist = FALSE;
+ UsbClassText.Class = USB_CLASS_RESERVE;
+ UsbClassText.SubClassExist = FALSE;
+ UsbClassText.SubClass = USB_SUBCLASS_TEST;
+
+ return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
+}
+
+/**
+ Converts a text device path node to USB WWID device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created USB WWID device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUsbWwid (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *VIDStr;
+ CHAR16 *PIDStr;
+ CHAR16 *InterfaceNumStr;
+ CHAR16 *SerialNumberStr;
+ USB_WWID_DEVICE_PATH *UsbWwid;
+ UINTN SerialNumberStrLen;
+
+ VIDStr = GetNextParamStr (&TextDeviceNode);
+ PIDStr = GetNextParamStr (&TextDeviceNode);
+ InterfaceNumStr = GetNextParamStr (&TextDeviceNode);
+ SerialNumberStr = GetNextParamStr (&TextDeviceNode);
+ SerialNumberStrLen = StrLen (SerialNumberStr);
+ if (SerialNumberStrLen >= 2 &&
+ SerialNumberStr[0] == L'\"' &&
+ SerialNumberStr[SerialNumberStrLen - 1] == L'\"'
+ ) {
+ SerialNumberStr[SerialNumberStrLen - 1] = L'\0';
+ SerialNumberStr++;
+ SerialNumberStrLen -= 2;
+ }
+ UsbWwid = (USB_WWID_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_USB_WWID_DP,
+ (UINT16) (sizeof (USB_WWID_DEVICE_PATH) + SerialNumberStrLen * sizeof (CHAR16))
+ );
+ UsbWwid->VendorId = (UINT16) Strtoi (VIDStr);
+ UsbWwid->ProductId = (UINT16) Strtoi (PIDStr);
+ UsbWwid->InterfaceNumber = (UINT16) Strtoi (InterfaceNumStr);
+
+ //
+ // There is no memory allocated in UsbWwid for the '\0' in SerialNumberStr.
+ // Therefore, the '\0' will not be copied.
+ //
+ memcpy (
+ (UINT8 *) UsbWwid + sizeof (USB_WWID_DEVICE_PATH),
+ SerialNumberStr,
+ SerialNumberStrLen * sizeof (CHAR16)
+ );
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) UsbWwid;
+}
+
+/**
+ Converts a text device path node to Logic Unit device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Logic Unit device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUnit (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *LunStr;
+ DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;
+
+ LunStr = GetNextParamStr (&TextDeviceNode);
+ LogicalUnit = (DEVICE_LOGICAL_UNIT_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_DEVICE_LOGICAL_UNIT_DP,
+ (UINT16) sizeof (DEVICE_LOGICAL_UNIT_DEVICE_PATH)
+ );
+
+ LogicalUnit->Lun = (UINT8) Strtoi (LunStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) LogicalUnit;
+}
+
+/**
+ Converts a text device path node to iSCSI device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created iSCSI device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextiSCSI (
+ CHAR16 *TextDeviceNode
+ )
+{
+ UINT16 Options;
+ CHAR16 *NameStr;
+ CHAR16 *PortalGroupStr;
+ CHAR16 *LunStr;
+ CHAR16 *HeaderDigestStr;
+ CHAR16 *DataDigestStr;
+ CHAR16 *AuthenticationStr;
+ CHAR16 *ProtocolStr;
+ CHAR8 *AsciiStr;
+ ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;
+ UINT64 Lun;
+
+ NameStr = GetNextParamStr (&TextDeviceNode);
+ PortalGroupStr = GetNextParamStr (&TextDeviceNode);
+ LunStr = GetNextParamStr (&TextDeviceNode);
+ HeaderDigestStr = GetNextParamStr (&TextDeviceNode);
+ DataDigestStr = GetNextParamStr (&TextDeviceNode);
+ AuthenticationStr = GetNextParamStr (&TextDeviceNode);
+ ProtocolStr = GetNextParamStr (&TextDeviceNode);
+ ISCSIDevPath = (ISCSI_DEVICE_PATH_WITH_NAME *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_ISCSI_DP,
+ (UINT16) (sizeof (ISCSI_DEVICE_PATH_WITH_NAME) + StrLen (NameStr))
+ );
+
+ AsciiStr = ISCSIDevPath->TargetName;
+ StrToAscii (NameStr, &AsciiStr);
+
+ ISCSIDevPath->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr);
+ Strtoi64 (LunStr, &Lun);
+ WriteUnaligned64 ((UINT64 *) &ISCSIDevPath->Lun, SwapBytes64 (Lun));
+
+ Options = 0x0000;
+ if (StrCmp (HeaderDigestStr, L"CRC32C") == 0) {
+ Options |= 0x0002;
+ }
+
+ if (StrCmp (DataDigestStr, L"CRC32C") == 0) {
+ Options |= 0x0008;
+ }
+
+ if (StrCmp (AuthenticationStr, L"None") == 0) {
+ Options |= 0x0800;
+ }
+
+ if (StrCmp (AuthenticationStr, L"CHAP_UNI") == 0) {
+ Options |= 0x1000;
+ }
+
+ ISCSIDevPath->LoginOption = (UINT16) Options;
+
+ if (IS_NULL (*ProtocolStr) || (StrCmp (ProtocolStr, L"TCP") == 0)) {
+ ISCSIDevPath->NetworkProtocol = 0;
+ } else {
+ //
+ // Undefined and reserved.
+ //
+ ISCSIDevPath->NetworkProtocol = 1;
+ }
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) ISCSIDevPath;
+}
+
+/**
+ Converts a text device path node to VLAN device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created VLAN device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextVlan (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *VlanStr;
+ VLAN_DEVICE_PATH *Vlan;
+
+ VlanStr = GetNextParamStr (&TextDeviceNode);
+ Vlan = (VLAN_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_VLAN_DP,
+ (UINT16) sizeof (VLAN_DEVICE_PATH)
+ );
+
+ Vlan->VlanId = (UINT16) Strtoi (VlanStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Vlan;
+}
+
+/**
+ Converts a text device path node to Bluetooth device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Bluetooth device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextBluetooth (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *BluetoothStr;
+ BLUETOOTH_DEVICE_PATH *BluetoothDp;
+
+ BluetoothStr = GetNextParamStr (&TextDeviceNode);
+ BluetoothDp = (BLUETOOTH_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_BLUETOOTH_DP,
+ (UINT16) sizeof (BLUETOOTH_DEVICE_PATH)
+ );
+ StrHexToBytes (
+ BluetoothStr,
+ sizeof (BLUETOOTH_ADDRESS) * 2,
+ BluetoothDp->BD_ADDR.Address,
+ sizeof (BLUETOOTH_ADDRESS)
+ );
+ return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothDp;
+}
+
+/**
+ Converts a text device path node to Wi-Fi device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Wi-Fi device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextWiFi (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *SSIdStr;
+ CHAR8 AsciiStr[33];
+ UINTN DataLen;
+ WIFI_DEVICE_PATH *WiFiDp;
+
+ SSIdStr = GetNextParamStr (&TextDeviceNode);
+ WiFiDp = (WIFI_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_WIFI_DP,
+ (UINT16) sizeof (WIFI_DEVICE_PATH)
+ );
+
+ if (NULL != SSIdStr) {
+ DataLen = StrLen (SSIdStr);
+ if (StrLen (SSIdStr) > 32) {
+ SSIdStr[32] = L'\0';
+ DataLen = 32;
+ }
+
+ UnicodeStrToAsciiStrS (SSIdStr, AsciiStr, sizeof (AsciiStr));
+ memcpy (WiFiDp->SSId, AsciiStr, DataLen);
+ }
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) WiFiDp;
+}
+
+/**
+ Converts a text device path node to Bluetooth LE device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Bluetooth LE device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextBluetoothLE (
+ IN CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *BluetoothLeAddrStr;
+ CHAR16 *BluetoothLeAddrTypeStr;
+ BLUETOOTH_LE_DEVICE_PATH *BluetoothLeDp;
+
+ BluetoothLeAddrStr = GetNextParamStr (&TextDeviceNode);
+ BluetoothLeAddrTypeStr = GetNextParamStr (&TextDeviceNode);
+ BluetoothLeDp = (BLUETOOTH_LE_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_BLUETOOTH_LE_DP,
+ (UINT16) sizeof (BLUETOOTH_LE_DEVICE_PATH)
+ );
+
+ BluetoothLeDp->Address.Type = (UINT8) Strtoi (BluetoothLeAddrTypeStr);
+ StrHexToBytes (
+ BluetoothLeAddrStr, sizeof (BluetoothLeDp->Address.Address) * 2,
+ BluetoothLeDp->Address.Address, sizeof (BluetoothLeDp->Address.Address)
+ );
+ return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothLeDp;
+}
+
+/**
+ Converts a text device path node to DNS device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created DNS device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextDns (
+ IN CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *DeviceNodeStr;
+ CHAR16 *DeviceNodeStrPtr;
+ UINT32 DnsServerIpCount;
+ UINT16 DnsDeviceNodeLength;
+ DNS_DEVICE_PATH *DnsDeviceNode;
+ UINT32 DnsServerIpIndex;
+ CHAR16 *DnsServerIp;
+
+
+ //
+ // Count the DNS server address number.
+ //
+ DeviceNodeStr = UefiDevicePathLibStrDuplicate (TextDeviceNode);
+ if (DeviceNodeStr == NULL) {
+ return NULL;
+ }
+
+ DeviceNodeStrPtr = DeviceNodeStr;
+
+ DnsServerIpCount = 0;
+ while (DeviceNodeStrPtr != NULL && *DeviceNodeStrPtr != L'\0') {
+ GetNextParamStr (&DeviceNodeStrPtr);
+ DnsServerIpCount ++;
+ }
+
+ free (DeviceNodeStr);
+ DeviceNodeStr = NULL;
+
+ //
+ // One or more instances of the DNS server address in EFI_IP_ADDRESS,
+ // otherwise, NULL will be returned.
+ //
+ if (DnsServerIpCount == 0) {
+ return NULL;
+ }
+
+ //
+ // Create the DNS DeviceNode.
+ //
+ DnsDeviceNodeLength = (UINT16) (sizeof (EFI_DEVICE_PATH_PROTOCOL) + sizeof (UINT8) + DnsServerIpCount * sizeof (EFI_IP_ADDRESS));
+ DnsDeviceNode = (DNS_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_DNS_DP,
+ DnsDeviceNodeLength
+ );
+ if (DnsDeviceNode == NULL) {
+ return NULL;
+ }
+
+ //
+ // Confirm the DNS server address is IPv4 or IPv6 type.
+ //
+ DeviceNodeStrPtr = TextDeviceNode;
+ while (!IS_NULL (*DeviceNodeStrPtr)) {
+ if (*DeviceNodeStrPtr == L'.') {
+ DnsDeviceNode->IsIPv6 = 0x00;
+ break;
+ }
+
+ if (*DeviceNodeStrPtr == L':') {
+ DnsDeviceNode->IsIPv6 = 0x01;
+ break;
+ }
+
+ DeviceNodeStrPtr++;
+ }
+
+ for (DnsServerIpIndex = 0; DnsServerIpIndex < DnsServerIpCount; DnsServerIpIndex++) {
+ DnsServerIp = GetNextParamStr (&TextDeviceNode);
+ if (DnsDeviceNode->IsIPv6 == 0x00) {
+ StrToIpv4Address (DnsServerIp, NULL, &(DnsDeviceNode->DnsServerIp[DnsServerIpIndex].v4), NULL);
+ } else {
+ StrToIpv6Address (DnsServerIp, NULL, &(DnsDeviceNode->DnsServerIp[DnsServerIpIndex].v6), NULL);
+ }
+ }
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) DnsDeviceNode;
+}
+
+/**
+ Converts a text device path node to URI device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created URI device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextUri (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *UriStr;
+ UINTN UriLength;
+ URI_DEVICE_PATH *Uri;
+
+ UriStr = GetNextParamStr (&TextDeviceNode);
+ UriLength = StrnLenS (UriStr, MAX_UINT16 - sizeof (URI_DEVICE_PATH));
+ Uri = (URI_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_URI_DP,
+ (UINT16) (sizeof (URI_DEVICE_PATH) + UriLength)
+ );
+
+ while (UriLength-- != 0) {
+ Uri->Uri[UriLength] = (CHAR8) UriStr[UriLength];
+ }
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Uri;
+}
+
+/**
+ Converts a media text device path node to media device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to media device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextMediaPath (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return DevPathFromTextGenericPath (MEDIA_DEVICE_PATH, TextDeviceNode);
+}
+
+/**
+ Converts a text device path node to HD device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created HD device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextHD (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *PartitionStr;
+ CHAR16 *TypeStr;
+ CHAR16 *SignatureStr;
+ CHAR16 *StartStr;
+ CHAR16 *SizeStr;
+ UINT32 Signature32;
+ HARDDRIVE_DEVICE_PATH *Hd;
+
+ PartitionStr = GetNextParamStr (&TextDeviceNode);
+ TypeStr = GetNextParamStr (&TextDeviceNode);
+ SignatureStr = GetNextParamStr (&TextDeviceNode);
+ StartStr = GetNextParamStr (&TextDeviceNode);
+ SizeStr = GetNextParamStr (&TextDeviceNode);
+ Hd = (HARDDRIVE_DEVICE_PATH *) CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_HARDDRIVE_DP,
+ (UINT16) sizeof (HARDDRIVE_DEVICE_PATH)
+ );
+
+ Hd->PartitionNumber = (UINT32) Strtoi (PartitionStr);
+
+ ZeroMem (Hd->Signature, 16);
+ Hd->MBRType = (UINT8) 0;
+
+ if (StrCmp (TypeStr, L"MBR") == 0) {
+ Hd->SignatureType = SIGNATURE_TYPE_MBR;
+ Hd->MBRType = 0x01;
+
+ Signature32 = (UINT32) Strtoi (SignatureStr);
+ memcpy (Hd->Signature, &Signature32, sizeof (UINT32));
+ } else if (StrCmp (TypeStr, L"GPT") == 0) {
+ Hd->SignatureType = SIGNATURE_TYPE_GUID;
+ Hd->MBRType = 0x02;
+
+ StrToGuid (SignatureStr, (EFI_GUID *) Hd->Signature);
+ } else {
+ Hd->SignatureType = (UINT8) Strtoi (TypeStr);
+ }
+
+ Strtoi64 (StartStr, &Hd->PartitionStart);
+ Strtoi64 (SizeStr, &Hd->PartitionSize);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Hd;
+}
+
+/**
+ Converts a text device path node to CDROM device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created CDROM device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextCDROM (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *EntryStr;
+ CHAR16 *StartStr;
+ CHAR16 *SizeStr;
+ CDROM_DEVICE_PATH *CDROMDevPath;
+
+ EntryStr = GetNextParamStr (&TextDeviceNode);
+ StartStr = GetNextParamStr (&TextDeviceNode);
+ SizeStr = GetNextParamStr (&TextDeviceNode);
+ CDROMDevPath = (CDROM_DEVICE_PATH *) CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_CDROM_DP,
+ (UINT16) sizeof (CDROM_DEVICE_PATH)
+ );
+
+ CDROMDevPath->BootEntry = (UINT32) Strtoi (EntryStr);
+ Strtoi64 (StartStr, &CDROMDevPath->PartitionStart);
+ Strtoi64 (SizeStr, &CDROMDevPath->PartitionSize);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) CDROMDevPath;
+}
+
+/**
+ Converts a text device path node to Vendor-defined media device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Vendor-defined media device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextVenMedia (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return ConvertFromTextVendor (
+ TextDeviceNode,
+ MEDIA_DEVICE_PATH,
+ MEDIA_VENDOR_DP
+ );
+}
+
+/**
+ Converts a text device path node to File device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created File device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextFilePath (
+ CHAR16 *TextDeviceNode
+ )
+{
+ FILEPATH_DEVICE_PATH *File;
+
+ File = (FILEPATH_DEVICE_PATH *) CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_FILEPATH_DP,
+ (UINT16) (sizeof (FILEPATH_DEVICE_PATH) + StrLen (TextDeviceNode) * 2)
+ );
+
+ StrCpyS (File->PathName, StrLen (TextDeviceNode) + 1, TextDeviceNode);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) File;
+}
+
+/**
+ Converts a text device path node to Media protocol device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Media protocol device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextMedia (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *GuidStr;
+ MEDIA_PROTOCOL_DEVICE_PATH *Media;
+
+ GuidStr = GetNextParamStr (&TextDeviceNode);
+ Media = (MEDIA_PROTOCOL_DEVICE_PATH *) CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_PROTOCOL_DP,
+ (UINT16) sizeof (MEDIA_PROTOCOL_DEVICE_PATH)
+ );
+
+ StrToGuid (GuidStr, &Media->Protocol);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Media;
+}
+
+/**
+ Converts a text device path node to firmware volume device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created firmware volume device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextFv (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *GuidStr;
+ MEDIA_FW_VOL_DEVICE_PATH *Fv;
+
+ GuidStr = GetNextParamStr (&TextDeviceNode);
+ Fv = (MEDIA_FW_VOL_DEVICE_PATH *) CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_PIWG_FW_VOL_DP,
+ (UINT16) sizeof (MEDIA_FW_VOL_DEVICE_PATH)
+ );
+
+ StrToGuid (GuidStr, &Fv->FvName);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Fv;
+}
+
+/**
+ Converts a text device path node to firmware file device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created firmware file device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextFvFile (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *GuidStr;
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFile;
+
+ GuidStr = GetNextParamStr (&TextDeviceNode);
+ FvFile = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_PIWG_FW_FILE_DP,
+ (UINT16) sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH)
+ );
+
+ StrToGuid (GuidStr, &FvFile->FvFileName);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) FvFile;
+}
+
+/**
+ Converts a text device path node to text relative offset device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Text device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextRelativeOffsetRange (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *StartingOffsetStr;
+ CHAR16 *EndingOffsetStr;
+ MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;
+
+ StartingOffsetStr = GetNextParamStr (&TextDeviceNode);
+ EndingOffsetStr = GetNextParamStr (&TextDeviceNode);
+ Offset = (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *) CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_RELATIVE_OFFSET_RANGE_DP,
+ (UINT16) sizeof (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH)
+ );
+
+ Strtoi64 (StartingOffsetStr, &Offset->StartingOffset);
+ Strtoi64 (EndingOffsetStr, &Offset->EndingOffset);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Offset;
+}
+
+/**
+ Converts a text device path node to text ram disk device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Text device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextRamDisk (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *StartingAddrStr;
+ CHAR16 *EndingAddrStr;
+ CHAR16 *TypeGuidStr;
+ CHAR16 *InstanceStr;
+ MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
+ UINT64 StartingAddr;
+ UINT64 EndingAddr;
+
+ StartingAddrStr = GetNextParamStr (&TextDeviceNode);
+ EndingAddrStr = GetNextParamStr (&TextDeviceNode);
+ InstanceStr = GetNextParamStr (&TextDeviceNode);
+ TypeGuidStr = GetNextParamStr (&TextDeviceNode);
+ RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *) CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_RAM_DISK_DP,
+ (UINT16) sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
+ );
+
+ Strtoi64 (StartingAddrStr, &StartingAddr);
+ WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr);
+ Strtoi64 (EndingAddrStr, &EndingAddr);
+ WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr);
+ RamDisk->Instance = (UINT16) Strtoi (InstanceStr);
+ StrToGuid (TypeGuidStr, &RamDisk->TypeGuid);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk;
+}
+
+/**
+ Converts a text device path node to text virtual disk device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Text device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextVirtualDisk (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *StartingAddrStr;
+ CHAR16 *EndingAddrStr;
+ CHAR16 *InstanceStr;
+ MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
+ UINT64 StartingAddr;
+ UINT64 EndingAddr;
+
+ StartingAddrStr = GetNextParamStr (&TextDeviceNode);
+ EndingAddrStr = GetNextParamStr (&TextDeviceNode);
+ InstanceStr = GetNextParamStr (&TextDeviceNode);
+
+ RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *) CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_RAM_DISK_DP,
+ (UINT16) sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
+ );
+
+ Strtoi64 (StartingAddrStr, &StartingAddr);
+ WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr);
+ Strtoi64 (EndingAddrStr, &EndingAddr);
+ WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr);
+ RamDisk->Instance = (UINT16) Strtoi (InstanceStr);
+ CopyGuid (&RamDisk->TypeGuid, &gEfiVirtualDiskGuid);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk;
+}
+
+/**
+ Converts a text device path node to text virtual cd device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Text device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextVirtualCd (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *StartingAddrStr;
+ CHAR16 *EndingAddrStr;
+ CHAR16 *InstanceStr;
+ MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
+ UINT64 StartingAddr;
+ UINT64 EndingAddr;
+
+ StartingAddrStr = GetNextParamStr (&TextDeviceNode);
+ EndingAddrStr = GetNextParamStr (&TextDeviceNode);
+ InstanceStr = GetNextParamStr (&TextDeviceNode);
+
+ RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *) CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_RAM_DISK_DP,
+ (UINT16) sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
+ );
+
+ Strtoi64 (StartingAddrStr, &StartingAddr);
+ WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr);
+ Strtoi64 (EndingAddrStr, &EndingAddr);
+ WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr);
+ RamDisk->Instance = (UINT16) Strtoi (InstanceStr);
+ CopyGuid (&RamDisk->TypeGuid, &gEfiVirtualCdGuid);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk;
+}
+
+/**
+ Converts a text device path node to text persistent virtual disk device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Text device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextPersistentVirtualDisk (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *StartingAddrStr;
+ CHAR16 *EndingAddrStr;
+ CHAR16 *InstanceStr;
+ MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
+ UINT64 StartingAddr;
+ UINT64 EndingAddr;
+
+ StartingAddrStr = GetNextParamStr (&TextDeviceNode);
+ EndingAddrStr = GetNextParamStr (&TextDeviceNode);
+ InstanceStr = GetNextParamStr (&TextDeviceNode);
+
+ RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *) CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_RAM_DISK_DP,
+ (UINT16) sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
+ );
+
+ Strtoi64 (StartingAddrStr, &StartingAddr);
+ WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr);
+ Strtoi64 (EndingAddrStr, &EndingAddr);
+ WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr);
+ RamDisk->Instance = (UINT16) Strtoi (InstanceStr);
+ CopyGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualDiskGuid);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk;
+}
+
+/**
+ Converts a text device path node to text persistent virtual cd device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Text device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextPersistentVirtualCd (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *StartingAddrStr;
+ CHAR16 *EndingAddrStr;
+ CHAR16 *InstanceStr;
+ MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
+ UINT64 StartingAddr;
+ UINT64 EndingAddr;
+
+ StartingAddrStr = GetNextParamStr (&TextDeviceNode);
+ EndingAddrStr = GetNextParamStr (&TextDeviceNode);
+ InstanceStr = GetNextParamStr (&TextDeviceNode);
+
+ RamDisk = (MEDIA_RAM_DISK_DEVICE_PATH *) CreateDeviceNode (
+ MEDIA_DEVICE_PATH,
+ MEDIA_RAM_DISK_DP,
+ (UINT16) sizeof (MEDIA_RAM_DISK_DEVICE_PATH)
+ );
+
+ Strtoi64 (StartingAddrStr, &StartingAddr);
+ WriteUnaligned64 ((UINT64 *) &(RamDisk->StartingAddr[0]), StartingAddr);
+ Strtoi64 (EndingAddrStr, &EndingAddr);
+ WriteUnaligned64 ((UINT64 *) &(RamDisk->EndingAddr[0]), EndingAddr);
+ RamDisk->Instance = (UINT16) Strtoi (InstanceStr);
+ CopyGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualCdGuid);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) RamDisk;
+}
+
+/**
+ Converts a BBS text device path node to BBS device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to BBS device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextBbsPath (
+ CHAR16 *TextDeviceNode
+ )
+{
+ return DevPathFromTextGenericPath (BBS_DEVICE_PATH, TextDeviceNode);
+}
+
+/**
+ Converts a text device path node to BIOS Boot Specification device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created BIOS Boot Specification device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextBBS (
+ CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *TypeStr;
+ CHAR16 *IdStr;
+ CHAR16 *FlagsStr;
+ CHAR8 *AsciiStr;
+ BBS_BBS_DEVICE_PATH *Bbs;
+
+ TypeStr = GetNextParamStr (&TextDeviceNode);
+ IdStr = GetNextParamStr (&TextDeviceNode);
+ FlagsStr = GetNextParamStr (&TextDeviceNode);
+ Bbs = (BBS_BBS_DEVICE_PATH *) CreateDeviceNode (
+ BBS_DEVICE_PATH,
+ BBS_BBS_DP,
+ (UINT16) (sizeof (BBS_BBS_DEVICE_PATH) + StrLen (IdStr))
+ );
+
+ if (StrCmp (TypeStr, L"Floppy") == 0) {
+ Bbs->DeviceType = BBS_TYPE_FLOPPY;
+ } else if (StrCmp (TypeStr, L"HD") == 0) {
+ Bbs->DeviceType = BBS_TYPE_HARDDRIVE;
+ } else if (StrCmp (TypeStr, L"CDROM") == 0) {
+ Bbs->DeviceType = BBS_TYPE_CDROM;
+ } else if (StrCmp (TypeStr, L"PCMCIA") == 0) {
+ Bbs->DeviceType = BBS_TYPE_PCMCIA;
+ } else if (StrCmp (TypeStr, L"USB") == 0) {
+ Bbs->DeviceType = BBS_TYPE_USB;
+ } else if (StrCmp (TypeStr, L"Network") == 0) {
+ Bbs->DeviceType = BBS_TYPE_EMBEDDED_NETWORK;
+ } else {
+ Bbs->DeviceType = (UINT16) Strtoi (TypeStr);
+ }
+
+ AsciiStr = Bbs->String;
+ StrToAscii (IdStr, &AsciiStr);
+
+ Bbs->StatusFlag = (UINT16) Strtoi (FlagsStr);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Bbs;
+}
+
+/**
+ Converts a text device path node to SATA device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created SATA device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextSata (
+ CHAR16 *TextDeviceNode
+ )
+{
+ SATA_DEVICE_PATH *Sata;
+ CHAR16 *Param1;
+ CHAR16 *Param2;
+ CHAR16 *Param3;
+
+ Param1 = GetNextParamStr (&TextDeviceNode);
+ Param2 = GetNextParamStr (&TextDeviceNode);
+ Param3 = GetNextParamStr (&TextDeviceNode);
+
+ Sata = (SATA_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_SATA_DP,
+ (UINT16) sizeof (SATA_DEVICE_PATH)
+ );
+ Sata->HBAPortNumber = (UINT16) Strtoi (Param1);
+
+ //
+ // According to UEFI spec, if PMPN is not provided, the default is 0xFFFF
+ //
+ if (*Param2 == L'\0' ) {
+ Sata->PortMultiplierPortNumber = 0xFFFF;
+ } else {
+ Sata->PortMultiplierPortNumber = (UINT16) Strtoi (Param2);
+ }
+ Sata->Lun = (UINT16) Strtoi (Param3);
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) Sata;
+}
+
+DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevPathFromTextTable[] = {
+ {L"Path", DevPathFromTextPath },
+
+ {L"HardwarePath", DevPathFromTextHardwarePath },
+ {L"Pci", DevPathFromTextPci },
+ {L"PcCard", DevPathFromTextPcCard },
+ {L"MemoryMapped", DevPathFromTextMemoryMapped },
+ {L"VenHw", DevPathFromTextVenHw },
+ {L"Ctrl", DevPathFromTextCtrl },
+ {L"BMC", DevPathFromTextBmc },
+
+ {L"AcpiPath", DevPathFromTextAcpiPath },
+ {L"Acpi", DevPathFromTextAcpi },
+ {L"PciRoot", DevPathFromTextPciRoot },
+ {L"PcieRoot", DevPathFromTextPcieRoot },
+ {L"Floppy", DevPathFromTextFloppy },
+ {L"Keyboard", DevPathFromTextKeyboard },
+ {L"Serial", DevPathFromTextSerial },
+ {L"ParallelPort", DevPathFromTextParallelPort },
+ {L"AcpiEx", DevPathFromTextAcpiEx },
+ {L"AcpiExp", DevPathFromTextAcpiExp },
+ {L"AcpiAdr", DevPathFromTextAcpiAdr },
+
+ {L"Msg", DevPathFromTextMsg },
+ {L"Ata", DevPathFromTextAta },
+ {L"Scsi", DevPathFromTextScsi },
+ {L"Fibre", DevPathFromTextFibre },
+ {L"FibreEx", DevPathFromTextFibreEx },
+ {L"I1394", DevPathFromText1394 },
+ {L"USB", DevPathFromTextUsb },
+ {L"I2O", DevPathFromTextI2O },
+ {L"Infiniband", DevPathFromTextInfiniband },
+ {L"VenMsg", DevPathFromTextVenMsg },
+ {L"VenPcAnsi", DevPathFromTextVenPcAnsi },
+ {L"VenVt100", DevPathFromTextVenVt100 },
+ {L"VenVt100Plus", DevPathFromTextVenVt100Plus },
+ {L"VenUtf8", DevPathFromTextVenUtf8 },
+ {L"UartFlowCtrl", DevPathFromTextUartFlowCtrl },
+ {L"SAS", DevPathFromTextSAS },
+ {L"SasEx", DevPathFromTextSasEx },
+ {L"NVMe", DevPathFromTextNVMe },
+ {L"UFS", DevPathFromTextUfs },
+ {L"SD", DevPathFromTextSd },
+ {L"eMMC", DevPathFromTextEmmc },
+ {L"DebugPort", DevPathFromTextDebugPort },
+ {L"MAC", DevPathFromTextMAC },
+ {L"IPv4", DevPathFromTextIPv4 },
+ {L"IPv6", DevPathFromTextIPv6 },
+ {L"Uart", DevPathFromTextUart },
+ {L"UsbClass", DevPathFromTextUsbClass },
+ {L"UsbAudio", DevPathFromTextUsbAudio },
+ {L"UsbCDCControl", DevPathFromTextUsbCDCControl },
+ {L"UsbHID", DevPathFromTextUsbHID },
+ {L"UsbImage", DevPathFromTextUsbImage },
+ {L"UsbPrinter", DevPathFromTextUsbPrinter },
+ {L"UsbMassStorage", DevPathFromTextUsbMassStorage },
+ {L"UsbHub", DevPathFromTextUsbHub },
+ {L"UsbCDCData", DevPathFromTextUsbCDCData },
+ {L"UsbSmartCard", DevPathFromTextUsbSmartCard },
+ {L"UsbVideo", DevPathFromTextUsbVideo },
+ {L"UsbDiagnostic", DevPathFromTextUsbDiagnostic },
+ {L"UsbWireless", DevPathFromTextUsbWireless },
+ {L"UsbDeviceFirmwareUpdate", DevPathFromTextUsbDeviceFirmwareUpdate },
+ {L"UsbIrdaBridge", DevPathFromTextUsbIrdaBridge },
+ {L"UsbTestAndMeasurement", DevPathFromTextUsbTestAndMeasurement },
+ {L"UsbWwid", DevPathFromTextUsbWwid },
+ {L"Unit", DevPathFromTextUnit },
+ {L"iSCSI", DevPathFromTextiSCSI },
+ {L"Vlan", DevPathFromTextVlan },
+ {L"Dns", DevPathFromTextDns },
+ {L"Uri", DevPathFromTextUri },
+ {L"Bluetooth", DevPathFromTextBluetooth },
+ {L"Wi-Fi", DevPathFromTextWiFi },
+ {L"BluetoothLE", DevPathFromTextBluetoothLE },
+ {L"MediaPath", DevPathFromTextMediaPath },
+ {L"HD", DevPathFromTextHD },
+ {L"CDROM", DevPathFromTextCDROM },
+ {L"VenMedia", DevPathFromTextVenMedia },
+ {L"Media", DevPathFromTextMedia },
+ {L"Fv", DevPathFromTextFv },
+ {L"FvFile", DevPathFromTextFvFile },
+ {L"Offset", DevPathFromTextRelativeOffsetRange },
+ {L"RamDisk", DevPathFromTextRamDisk },
+ {L"VirtualDisk", DevPathFromTextVirtualDisk },
+ {L"VirtualCD", DevPathFromTextVirtualCd },
+ {L"PersistentVirtualDisk", DevPathFromTextPersistentVirtualDisk },
+ {L"PersistentVirtualCD", DevPathFromTextPersistentVirtualCd },
+
+ {L"BbsPath", DevPathFromTextBbsPath },
+ {L"BBS", DevPathFromTextBBS },
+ {L"Sata", DevPathFromTextSata },
+ {NULL, NULL}
+};
+
+/**
+ Convert text to the binary representation of a device node.
+
+ @param TextDeviceNode TextDeviceNode points to the text representation of a device
+ node. Conversion starts with the first character and continues
+ until the first non-device node character.
+
+ @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was
+ insufficient memory or text unsupported.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibConvertTextToDeviceNode (
+ CONST CHAR16 *TextDeviceNode
+ )
+{
+ DEVICE_PATH_FROM_TEXT FromText;
+ CHAR16 *ParamStr;
+ EFI_DEVICE_PATH_PROTOCOL *DeviceNode;
+ CHAR16 *DeviceNodeStr;
+ UINTN Index;
+
+ if ((TextDeviceNode == NULL) || (IS_NULL (*TextDeviceNode))) {
+ return NULL;
+ }
+
+ ParamStr = NULL;
+ FromText = NULL;
+ DeviceNodeStr = UefiDevicePathLibStrDuplicate (TextDeviceNode);
+ ASSERT (DeviceNodeStr != NULL);
+
+ for (Index = 0; mUefiDevicePathLibDevPathFromTextTable[Index].Function != NULL; Index++) {
+ ParamStr = GetParamByNodeName (DeviceNodeStr, mUefiDevicePathLibDevPathFromTextTable[Index].DevicePathNodeText);
+ if (ParamStr != NULL) {
+ FromText = mUefiDevicePathLibDevPathFromTextTable[Index].Function;
+ break;
+ }
+ }
+
+ if (FromText == NULL) {
+ //
+ // A file path
+ //
+ FromText = DevPathFromTextFilePath;
+ DeviceNode = FromText (DeviceNodeStr);
+ //
+ // According to above logic, if 'FromText' is NULL in the 'if' statement,
+ // then 'ParamStr' must be NULL as well. No memory allocation has been made
+ // in this case.
+ //
+ // The below check is for addressing a false positive potential memory leak
+ // issue raised from static analysis.
+ //
+ if (ParamStr != NULL) {
+ free (ParamStr);
+ }
+ } else {
+ DeviceNode = FromText (ParamStr);
+ free (ParamStr);
+ }
+
+ free (DeviceNodeStr);
+
+ return DeviceNode;
+}
+
+/**
+ Convert text to the binary representation of a device path.
+
+
+ @param TextDevicePath TextDevicePath points to the text representation of a device
+ path. Conversion starts with the first character and continues
+ until the first non-device node character.
+
+ @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or
+ there was insufficient memory.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibConvertTextToDevicePath (
+ CONST CHAR16 *TextDevicePath
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL *DeviceNode;
+ EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
+ CHAR16 *DevicePathStr;
+ CHAR16 *Str;
+ CHAR16 *DeviceNodeStr;
+ BOOLEAN IsInstanceEnd;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ if ((TextDevicePath == NULL) || (IS_NULL (*TextDevicePath))) {
+ return NULL;
+ }
+
+ DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
+ ASSERT (DevicePath != NULL);
+ SetDevicePathEndNode (DevicePath);
+
+ DevicePathStr = UefiDevicePathLibStrDuplicate (TextDevicePath);
+
+ Str = DevicePathStr;
+ while ((DeviceNodeStr = GetNextDeviceNodeStr (&Str, &IsInstanceEnd)) != NULL) {
+ DeviceNode = UefiDevicePathLibConvertTextToDeviceNode (DeviceNodeStr);
+
+ NewDevicePath = AppendDevicePathNode (DevicePath, DeviceNode);
+ free (DevicePath);
+ free (DeviceNode);
+ DevicePath = NewDevicePath;
+
+ if (IsInstanceEnd) {
+ DeviceNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
+ ASSERT (DeviceNode != NULL);
+ SetDevicePathEndNode (DeviceNode);
+ DeviceNode->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
+
+ NewDevicePath = AppendDevicePathNode (DevicePath, DeviceNode);
+ free (DevicePath);
+ free (DeviceNode);
+ DevicePath = NewDevicePath;
+ }
+ }
+
+ free (DevicePathStr);
+ return DevicePath;
+}
diff --git a/roms/edk2/BaseTools/Source/C/DevicePath/DevicePathUtilities.c b/roms/edk2/BaseTools/Source/C/DevicePath/DevicePathUtilities.c
new file mode 100644
index 000000000..2ffefa8ce
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/DevicePath/DevicePathUtilities.c
@@ -0,0 +1,868 @@
+/** @file
+ Device Path services. The thing to remember is device paths are built out of
+ nodes. The device path is terminated by an end node that is length
+ sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is sizeof(EFI_DEVICE_PATH_PROTOCOL)
+ all over this file.
+
+ The only place where multi-instance device paths are supported is in
+ environment variables. Multi-instance device paths should never be placed
+ on a Handle.
+
+ Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UefiDevicePathLib.h"
+#include <Protocol/DevicePathUtilities.h>
+
+//
+// Template for an end-of-device path node.
+//
+CONST EFI_DEVICE_PATH_PROTOCOL mUefiDevicePathLibEndDevicePath = {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ END_DEVICE_PATH_LENGTH,
+ 0
+ }
+};
+
+/**
+ Determine whether a given device path is valid.
+
+ @param DevicePath A pointer to a device path data structure.
+ @param MaxSize The maximum size of the device path data structure.
+
+ @retval TRUE DevicePath is valid.
+ @retval FALSE DevicePath is NULL.
+ @retval FALSE Maxsize is less than sizeof(EFI_DEVICE_PATH_PROTOCOL).
+ @retval FALSE The length of any node node in the DevicePath is less
+ than sizeof (EFI_DEVICE_PATH_PROTOCOL).
+ @retval FALSE If MaxSize is not zero, the size of the DevicePath
+ exceeds MaxSize.
+ @retval FALSE If PcdMaximumDevicePathNodeCount is not zero, the node
+ count of the DevicePath exceeds PcdMaximumDevicePathNodeCount.
+**/
+BOOLEAN
+IsDevicePathValid (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ UINTN MaxSize
+ )
+{
+ UINTN Count;
+ UINTN Size;
+ UINTN NodeLength;
+
+ //
+ // Validate the input whether exists and its size big enough to touch the first node
+ //
+ if (DevicePath == NULL || (MaxSize > 0 && MaxSize < END_DEVICE_PATH_LENGTH)) {
+ return FALSE;
+ }
+
+ if (MaxSize == 0) {
+ MaxSize = MAX_UINT32;
+ }
+
+ for (Count = 0, Size = 0; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) {
+ NodeLength = DevicePathNodeLength (DevicePath);
+ if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
+ return FALSE;
+ }
+
+ if (NodeLength > MAX_UINT32 - Size) {
+ return FALSE;
+ }
+ Size += NodeLength;
+
+ //
+ // Validate next node before touch it.
+ //
+ if (Size > MaxSize - END_DEVICE_PATH_LENGTH ) {
+ return FALSE;
+ }
+
+ Count++;
+ if (Count >= MAX_DEVICE_PATH_NODE_COUNT) {
+ return FALSE;
+ }
+
+ }
+
+ //
+ // Only return TRUE when the End Device Path node is valid.
+ //
+ return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);
+}
+
+
+/**
+ Returns the Type field of a device path node.
+
+ Returns the Type field of the device path node specified by Node.
+
+ If Node is NULL, then ASSERT().
+
+ @param Node A pointer to a device path node data structure.
+
+ @return The Type field of the device path node specified by Node.
+
+**/
+UINT8
+DevicePathType (
+ CONST VOID *Node
+ )
+{
+ ASSERT (Node != NULL);
+ return ((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Type;
+}
+
+/**
+ Returns the SubType field of a device path node.
+
+ Returns the SubType field of the device path node specified by Node.
+
+ If Node is NULL, then ASSERT().
+
+ @param Node A pointer to a device path node data structure.
+
+ @return The SubType field of the device path node specified by Node.
+
+**/
+UINT8
+DevicePathSubType (
+ CONST VOID *Node
+ )
+{
+ ASSERT (Node != NULL);
+ return ((EFI_DEVICE_PATH_PROTOCOL *)(Node))->SubType;
+}
+
+/**
+ Returns the 16-bit Length field of a device path node.
+
+ Returns the 16-bit Length field of the device path node specified by Node.
+ Node is not required to be aligned on a 16-bit boundary, so it is recommended
+ that a function such as ReadUnaligned16() be used to extract the contents of
+ the Length field.
+
+ If Node is NULL, then ASSERT().
+
+ @param Node A pointer to a device path node data structure.
+
+ @return The 16-bit Length field of the device path node specified by Node.
+
+**/
+UINTN
+DevicePathNodeLength (
+ CONST VOID *Node
+ )
+{
+ ASSERT (Node != NULL);
+ return ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]);
+}
+
+/**
+ Returns a pointer to the next node in a device path.
+
+ Returns a pointer to the device path node that follows the device path node
+ specified by Node.
+
+ If Node is NULL, then ASSERT().
+
+ @param Node A pointer to a device path node data structure.
+
+ @return a pointer to the device path node that follows the device path node
+ specified by Node.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+NextDevicePathNode (
+ CONST VOID *Node
+ )
+{
+ ASSERT (Node != NULL);
+ return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node));
+}
+
+/**
+ Determines if a device path node is an end node of a device path.
+ This includes nodes that are the end of a device path instance and nodes that
+ are the end of an entire device path.
+
+ Determines if the device path node specified by Node is an end node of a device path.
+ This includes nodes that are the end of a device path instance and nodes that are the
+ end of an entire device path. If Node represents an end node of a device path,
+ then TRUE is returned. Otherwise, FALSE is returned.
+
+ If Node is NULL, then ASSERT().
+
+ @param Node A pointer to a device path node data structure.
+
+ @retval TRUE The device path node specified by Node is an end node of a
+ device path.
+ @retval FALSE The device path node specified by Node is not an end node of
+ a device path.
+
+**/
+BOOLEAN
+IsDevicePathEndType (
+ CONST VOID *Node
+ )
+{
+ ASSERT (Node != NULL);
+ return (BOOLEAN) (DevicePathType (Node) == END_DEVICE_PATH_TYPE);
+}
+
+/**
+ Determines if a device path node is an end node of an entire device path.
+
+ Determines if a device path node specified by Node is an end node of an entire
+ device path. If Node represents the end of an entire device path, then TRUE is
+ returned. Otherwise, FALSE is returned.
+
+ If Node is NULL, then ASSERT().
+
+ @param Node A pointer to a device path node data structure.
+
+ @retval TRUE The device path node specified by Node is the end of an entire
+ device path.
+ @retval FALSE The device path node specified by Node is not the end of an
+ entire device path.
+
+**/
+BOOLEAN
+IsDevicePathEnd (
+ CONST VOID *Node
+ )
+{
+ ASSERT (Node != NULL);
+ return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE);
+}
+
+/**
+ Determines if a device path node is an end node of a device path instance.
+
+ Determines if a device path node specified by Node is an end node of a device
+ path instance. If Node represents the end of a device path instance, then TRUE
+ is returned. Otherwise, FALSE is returned.
+
+ If Node is NULL, then ASSERT().
+
+ @param Node A pointer to a device path node data structure.
+
+ @retval TRUE The device path node specified by Node is the end of a device
+ path instance.
+ @retval FALSE The device path node specified by Node is not the end of a
+ device path instance.
+
+**/
+BOOLEAN
+IsDevicePathEndInstance (
+ CONST VOID *Node
+ )
+{
+ ASSERT (Node != NULL);
+ return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);
+}
+
+/**
+ Sets the length, in bytes, of a device path node.
+
+ Sets the length of the device path node specified by Node to the value specified
+ by NodeLength. NodeLength is returned. Node is not required to be aligned on
+ a 16-bit boundary, so it is recommended that a function such as WriteUnaligned16()
+ be used to set the contents of the Length field.
+
+ If Node is NULL, then ASSERT().
+ If NodeLength >= SIZE_64KB, then ASSERT().
+ If NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL), then ASSERT().
+
+ @param Node A pointer to a device path node data structure.
+ @param Length The length, in bytes, of the device path node.
+
+ @return Length
+
+**/
+UINT16
+SetDevicePathNodeLength (
+ VOID *Node,
+ UINTN Length
+ )
+{
+ ASSERT (Node != NULL);
+ ASSERT ((Length >= sizeof (EFI_DEVICE_PATH_PROTOCOL)) && (Length < SIZE_64KB));
+ return WriteUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0], (UINT16)(Length));
+}
+
+/**
+ Fills in all the fields of a device path node that is the end of an entire device path.
+
+ Fills in all the fields of a device path node specified by Node so Node represents
+ the end of an entire device path. The Type field of Node is set to
+ END_DEVICE_PATH_TYPE, the SubType field of Node is set to
+ END_ENTIRE_DEVICE_PATH_SUBTYPE, and the Length field of Node is set to
+ END_DEVICE_PATH_LENGTH. Node is not required to be aligned on a 16-bit boundary,
+ so it is recommended that a function such as WriteUnaligned16() be used to set
+ the contents of the Length field.
+
+ If Node is NULL, then ASSERT().
+
+ @param Node A pointer to a device path node data structure.
+
+**/
+VOID
+SetDevicePathEndNode (
+ VOID *Node
+ )
+{
+ ASSERT (Node != NULL);
+ memcpy (Node, &mUefiDevicePathLibEndDevicePath, sizeof (mUefiDevicePathLibEndDevicePath));
+}
+
+/**
+ Returns the size of a device path in bytes.
+
+ This function returns the size, in bytes, of the device path data structure
+ specified by DevicePath including the end of device path node.
+ If DevicePath is NULL or invalid, then 0 is returned.
+
+ @param DevicePath A pointer to a device path data structure.
+
+ @retval 0 If DevicePath is NULL or invalid.
+ @retval Others The size of a device path in bytes.
+
+**/
+UINTN
+UefiDevicePathLibGetDevicePathSize (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ )
+{
+ CONST EFI_DEVICE_PATH_PROTOCOL *Start;
+
+ if (DevicePath == NULL) {
+ return 0;
+ }
+
+ if (!IsDevicePathValid (DevicePath, 0)) {
+ return 0;
+ }
+
+ //
+ // Search for the end of the device path structure
+ //
+ Start = DevicePath;
+ while (!IsDevicePathEnd (DevicePath)) {
+ DevicePath = NextDevicePathNode (DevicePath);
+ }
+
+ //
+ // Compute the size and add back in the size of the end device path structure
+ //
+ return ((UINTN) DevicePath - (UINTN) Start) + DevicePathNodeLength (DevicePath);
+}
+
+/**
+ Creates a new copy of an existing device path.
+
+ This function allocates space for a new copy of the device path specified by DevicePath.
+ If DevicePath is NULL, then NULL is returned. If the memory is successfully
+ allocated, then the contents of DevicePath are copied to the newly allocated
+ buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned.
+ The memory for the new device path is allocated from EFI boot services memory.
+ It is the responsibility of the caller to free the memory allocated.
+
+ @param DevicePath A pointer to a device path data structure.
+
+ @retval NULL DevicePath is NULL or invalid.
+ @retval Others A pointer to the duplicated device path.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibDuplicateDevicePath (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ )
+{
+ UINTN Size;
+
+ //
+ // Compute the size
+ //
+ Size = GetDevicePathSize (DevicePath);
+ if (Size == 0) {
+ return NULL;
+ }
+
+ //
+ // Allocate space for duplicate device path
+ //
+
+ return AllocateCopyPool (Size, DevicePath);
+}
+
+/**
+ Creates a new device path by appending a second device path to a first device path.
+
+ This function creates a new device path by appending a copy of SecondDevicePath
+ to a copy of FirstDevicePath in a newly allocated buffer. Only the end-of-device-path
+ device node from SecondDevicePath is retained. The newly created device path is
+ returned. If FirstDevicePath is NULL, then it is ignored, and a duplicate of
+ SecondDevicePath is returned. If SecondDevicePath is NULL, then it is ignored,
+ and a duplicate of FirstDevicePath is returned. If both FirstDevicePath and
+ SecondDevicePath are NULL, then a copy of an end-of-device-path is returned.
+
+ If there is not enough memory for the newly allocated buffer, then NULL is returned.
+ The memory for the new device path is allocated from EFI boot services memory.
+ It is the responsibility of the caller to free the memory allocated.
+
+ @param FirstDevicePath A pointer to a device path data structure.
+ @param SecondDevicePath A pointer to a device path data structure.
+
+ @retval NULL If there is not enough memory for the newly allocated buffer.
+ @retval NULL If FirstDevicePath or SecondDevicePath is invalid.
+ @retval Others A pointer to the new device path if success.
+ Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibAppendDevicePath (
+ CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,
+ CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath
+ )
+{
+ UINTN Size;
+ UINTN Size1;
+ UINTN Size2;
+ EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath2;
+
+ //
+ // If there's only 1 path, just duplicate it.
+ //
+ if (FirstDevicePath == NULL) {
+ return DuplicateDevicePath ((SecondDevicePath != NULL) ? SecondDevicePath : &mUefiDevicePathLibEndDevicePath);
+ }
+
+ if (SecondDevicePath == NULL) {
+ return DuplicateDevicePath (FirstDevicePath);
+ }
+
+ if (!IsDevicePathValid (FirstDevicePath, 0) || !IsDevicePathValid (SecondDevicePath, 0)) {
+ return NULL;
+ }
+
+ //
+ // Allocate space for the combined device path. It only has one end node of
+ // length EFI_DEVICE_PATH_PROTOCOL.
+ //
+ Size1 = GetDevicePathSize (FirstDevicePath);
+ Size2 = GetDevicePathSize (SecondDevicePath);
+ Size = Size1 + Size2 - END_DEVICE_PATH_LENGTH;
+
+ NewDevicePath = AllocatePool (Size);
+
+ if (NewDevicePath != NULL) {
+ NewDevicePath = memcpy (NewDevicePath, FirstDevicePath, Size1);
+ //
+ // Over write FirstDevicePath EndNode and do the copy
+ //
+ DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath +
+ (Size1 - END_DEVICE_PATH_LENGTH));
+ memcpy (DevicePath2, SecondDevicePath, Size2);
+ }
+
+ return NewDevicePath;
+}
+
+/**
+ Creates a new path by appending the device node to the device path.
+
+ This function creates a new device path by appending a copy of the device node
+ specified by DevicePathNode to a copy of the device path specified by DevicePath
+ in an allocated buffer. The end-of-device-path device node is moved after the
+ end of the appended device node.
+ If DevicePathNode is NULL then a copy of DevicePath is returned.
+ If DevicePath is NULL then a copy of DevicePathNode, followed by an end-of-device
+ path device node is returned.
+ If both DevicePathNode and DevicePath are NULL then a copy of an end-of-device-path
+ device node is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+ of the caller to free the memory allocated.
+
+ @param DevicePath A pointer to a device path data structure.
+ @param DevicePathNode A pointer to a single device path node.
+
+ @retval NULL If there is not enough memory for the new device path.
+ @retval Others A pointer to the new device path if success.
+ A copy of DevicePathNode followed by an end-of-device-path node
+ if both FirstDevicePath and SecondDevicePath are NULL.
+ A copy of an end-of-device-path node if both FirstDevicePath
+ and SecondDevicePath are NULL.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibAppendDevicePathNode (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *NextNode;
+ EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
+ UINTN NodeLength;
+
+ if (DevicePathNode == NULL) {
+ return DuplicateDevicePath ((DevicePath != NULL) ? DevicePath : &mUefiDevicePathLibEndDevicePath);
+ }
+ //
+ // Build a Node that has a terminator on it
+ //
+ NodeLength = DevicePathNodeLength (DevicePathNode);
+
+ TempDevicePath = AllocatePool (NodeLength + END_DEVICE_PATH_LENGTH);
+ if (TempDevicePath == NULL) {
+ return NULL;
+ }
+ TempDevicePath = memcpy (TempDevicePath, DevicePathNode, NodeLength);
+ //
+ // Add and end device path node to convert Node to device path
+ //
+ NextNode = NextDevicePathNode (TempDevicePath);
+ SetDevicePathEndNode (NextNode);
+ //
+ // Append device paths
+ //
+ NewDevicePath = AppendDevicePath (DevicePath, TempDevicePath);
+
+ free (TempDevicePath);
+
+ return NewDevicePath;
+}
+
+/**
+ Creates a new device path by appending the specified device path instance to the specified device
+ path.
+
+ This function creates a new device path by appending a copy of the device path
+ instance specified by DevicePathInstance to a copy of the device path specified
+ by DevicePath in a allocated buffer.
+ The end-of-device-path device node is moved after the end of the appended device
+ path instance and a new end-of-device-path-instance node is inserted between.
+ If DevicePath is NULL, then a copy if DevicePathInstance is returned.
+ If DevicePathInstance is NULL, then NULL is returned.
+ If DevicePath or DevicePathInstance is invalid, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+ of the caller to free the memory allocated.
+
+ @param DevicePath A pointer to a device path data structure.
+ @param DevicePathInstance A pointer to a device path instance.
+
+ @return A pointer to the new device path.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibAppendDevicePathInstance (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
+ UINTN SrcSize;
+ UINTN InstanceSize;
+
+ if (DevicePath == NULL) {
+ return DuplicateDevicePath (DevicePathInstance);
+ }
+
+ if (DevicePathInstance == NULL) {
+ return NULL;
+ }
+
+ if (!IsDevicePathValid (DevicePath, 0) || !IsDevicePathValid (DevicePathInstance, 0)) {
+ return NULL;
+ }
+
+ SrcSize = GetDevicePathSize (DevicePath);
+ InstanceSize = GetDevicePathSize (DevicePathInstance);
+
+ NewDevicePath = AllocatePool (SrcSize + InstanceSize);
+ if (NewDevicePath != NULL) {
+
+ TempDevicePath = memcpy (NewDevicePath, DevicePath, SrcSize);;
+
+ while (!IsDevicePathEnd (TempDevicePath)) {
+ TempDevicePath = NextDevicePathNode (TempDevicePath);
+ }
+
+ TempDevicePath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
+ TempDevicePath = NextDevicePathNode (TempDevicePath);
+ memcpy (TempDevicePath, DevicePathInstance, InstanceSize);
+ }
+
+ return NewDevicePath;
+}
+
+/**
+ Creates a copy of the current device path instance and returns a pointer to the next device path
+ instance.
+
+ This function creates a copy of the current device path instance. It also updates
+ DevicePath to point to the next device path instance in the device path (or NULL
+ if no more) and updates Size to hold the size of the device path instance copy.
+ If DevicePath is NULL, then NULL is returned.
+ If DevicePath points to a invalid device path, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+ of the caller to free the memory allocated.
+ If Size is NULL, then ASSERT().
+
+ @param DevicePath On input, this holds the pointer to the current
+ device path instance. On output, this holds
+ the pointer to the next device path instance
+ or NULL if there are no more device path
+ instances in the device path pointer to a
+ device path data structure.
+ @param Size On output, this holds the size of the device
+ path instance, in bytes or zero, if DevicePath
+ is NULL.
+
+ @return A pointer to the current device path instance.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibGetNextDevicePathInstance (
+ EFI_DEVICE_PATH_PROTOCOL **DevicePath,
+ UINTN *Size
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL *DevPath;
+ EFI_DEVICE_PATH_PROTOCOL *ReturnValue;
+ UINT8 Temp;
+
+ ASSERT (Size != NULL);
+
+ if (DevicePath == NULL || *DevicePath == NULL) {
+ *Size = 0;
+ return NULL;
+ }
+
+ if (!IsDevicePathValid (*DevicePath, 0)) {
+ return NULL;
+ }
+
+ //
+ // Find the end of the device path instance
+ //
+ DevPath = *DevicePath;
+ while (!IsDevicePathEndType (DevPath)) {
+ DevPath = NextDevicePathNode (DevPath);
+ }
+
+ //
+ // Compute the size of the device path instance
+ //
+ *Size = ((UINTN) DevPath - (UINTN) (*DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
+
+ //
+ // Make a copy and return the device path instance
+ //
+ Temp = DevPath->SubType;
+ DevPath->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;
+ ReturnValue = DuplicateDevicePath (*DevicePath);
+ DevPath->SubType = Temp;
+
+ //
+ // If DevPath is the end of an entire device path, then another instance
+ // does not follow, so *DevicePath is set to NULL.
+ //
+ if (DevicePathSubType (DevPath) == END_ENTIRE_DEVICE_PATH_SUBTYPE) {
+ *DevicePath = NULL;
+ } else {
+ *DevicePath = NextDevicePathNode (DevPath);
+ }
+
+ return ReturnValue;
+}
+
+/**
+ Creates a device node.
+
+ This function creates a new device node in a newly allocated buffer of size
+ NodeLength and initializes the device path node header with NodeType and NodeSubType.
+ The new device path node is returned.
+ If NodeLength is smaller than a device path header, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+ of the caller to free the memory allocated.
+
+ @param NodeType The device node type for the new device node.
+ @param NodeSubType The device node sub-type for the new device node.
+ @param NodeLength The length of the new device node.
+
+ @return The new device path.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibCreateDeviceNode (
+ UINT8 NodeType,
+ UINT8 NodeSubType,
+ UINT16 NodeLength
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
+ //
+ // NodeLength is less than the size of the header.
+ //
+ return NULL;
+ }
+
+ DevicePath = AllocateZeroPool (NodeLength);
+ if (DevicePath != NULL) {
+ DevicePath->Type = NodeType;
+ DevicePath->SubType = NodeSubType;
+ SetDevicePathNodeLength (DevicePath, NodeLength);
+ }
+
+ return DevicePath;
+}
+
+/**
+ Determines if a device path is single or multi-instance.
+
+ This function returns TRUE if the device path specified by DevicePath is
+ multi-instance.
+ Otherwise, FALSE is returned.
+ If DevicePath is NULL or invalid, then FALSE is returned.
+
+ @param DevicePath A pointer to a device path data structure.
+
+ @retval TRUE DevicePath is multi-instance.
+ @retval FALSE DevicePath is not multi-instance, or DevicePath
+ is NULL or invalid.
+
+**/
+BOOLEAN
+UefiDevicePathLibIsDevicePathMultiInstance (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ )
+{
+ CONST EFI_DEVICE_PATH_PROTOCOL *Node;
+
+ if (DevicePath == NULL) {
+ return FALSE;
+ }
+
+ if (!IsDevicePathValid (DevicePath, 0)) {
+ return FALSE;
+ }
+
+ Node = DevicePath;
+ while (!IsDevicePathEnd (Node)) {
+ if (IsDevicePathEndInstance (Node)) {
+ return TRUE;
+ }
+
+ Node = NextDevicePathNode (Node);
+ }
+
+ return FALSE;
+}
+
+
+/**
+ Retrieves the device path protocol from a handle.
+
+ This function returns the device path protocol from the handle specified by Handle.
+ If Handle is NULL or Handle does not contain a device path protocol, then NULL
+ is returned.
+
+ @param Handle The handle from which to retrieve the device
+ path protocol.
+
+ @return The device path protocol from the handle specified by Handle.
+
+**/
+/*
+EFI_DEVICE_PATH_PROTOCOL *
+DevicePathFromHandle (
+ EFI_HANDLE Handle
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_STATUS Status;
+
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID *) &DevicePath
+ );
+ if (EFI_ERROR (Status)) {
+ DevicePath = NULL;
+ }
+ return DevicePath;
+}
+*/
+/**
+ Allocates a device path for a file and appends it to an existing device path.
+
+ If Device is a valid device handle that contains a device path protocol, then a device path for
+ the file specified by FileName is allocated and appended to the device path associated with the
+ handle Device. The allocated device path is returned. If Device is NULL or Device is a handle
+ that does not support the device path protocol, then a device path containing a single device
+ path node for the file specified by FileName is allocated and returned.
+ The memory for the new device path is allocated from EFI boot services memory. It is the responsibility
+ of the caller to free the memory allocated.
+
+ If FileName is NULL, then ASSERT().
+ If FileName is not aligned on a 16-bit boundary, then ASSERT().
+
+ @param Device A pointer to a device handle. This parameter
+ is optional and may be NULL.
+ @param FileName A pointer to a Null-terminated Unicode string.
+
+ @return The allocated device path.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+FileDevicePath (
+ EFI_HANDLE Device, OPTIONAL
+ CONST CHAR16 *FileName
+ )
+{
+ UINTN Size;
+ FILEPATH_DEVICE_PATH *FilePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *FileDevicePath;
+
+ DevicePath = NULL;
+
+ Size = StrSize (FileName);
+ FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH);
+ if (FileDevicePath != NULL) {
+ FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
+ FilePath->Header.Type = MEDIA_DEVICE_PATH;
+ FilePath->Header.SubType = MEDIA_FILEPATH_DP;
+ memcpy (&FilePath->PathName, FileName, Size);
+ SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);
+ SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));
+
+ //if (Device != NULL) {
+ // DevicePath = DevicePathFromHandle (Device);
+ //}
+
+ DevicePath = AppendDevicePath (DevicePath, FileDevicePath);
+ free (FileDevicePath);
+ }
+
+ return DevicePath;
+}
diff --git a/roms/edk2/BaseTools/Source/C/DevicePath/GNUmakefile b/roms/edk2/BaseTools/Source/C/DevicePath/GNUmakefile
new file mode 100644
index 000000000..7ca08af96
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/DevicePath/GNUmakefile
@@ -0,0 +1,24 @@
+## @file
+# GNU/Linux makefile for 'DevicePath' module build.
+#
+# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+ARCH ?= IA32
+MAKEROOT ?= ..
+
+APPNAME = DevicePath
+
+OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o DevicePathUtilities.o
+
+include $(MAKEROOT)/Makefiles/app.makefile
+
+LIBS = -lCommon
+ifeq ($(CYGWIN), CYGWIN)
+ LIBS += -L/lib/e2fsprogs -luuid
+endif
+
+ifeq ($(LINUX), Linux)
+ LIBS += -luuid
+endif
+
diff --git a/roms/edk2/BaseTools/Source/C/DevicePath/Makefile b/roms/edk2/BaseTools/Source/C/DevicePath/Makefile
new file mode 100644
index 000000000..177a96dfb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/DevicePath/Makefile
@@ -0,0 +1,18 @@
+## @file
+# Windows makefile for 'DevicePath' module build.
+#
+# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+APPNAME = DevicePath
+
+LIBS = $(LIB_PATH)\Common.lib
+
+OBJECTS = DevicePath.obj UefiDevicePathLib.obj DevicePathFromText.obj DevicePathUtilities.obj
+
+#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
+
+!INCLUDE ..\Makefiles\ms.app
+
diff --git a/roms/edk2/BaseTools/Source/C/DevicePath/UefiDevicePathLib.c b/roms/edk2/BaseTools/Source/C/DevicePath/UefiDevicePathLib.c
new file mode 100644
index 000000000..ad3593f96
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/DevicePath/UefiDevicePathLib.c
@@ -0,0 +1,292 @@
+/** @file
+ Device Path services. The thing to remember is device paths are built out of
+ nodes. The device path is terminated by an end node that is length
+ sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is sizeof(EFI_DEVICE_PATH_PROTOCOL)
+ all over this file.
+
+ The only place where multi-instance device paths are supported is in
+ environment variables. Multi-instance device paths should never be placed
+ on a Handle.
+
+ Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+
+#include "UefiDevicePathLib.h"
+
+/**
+ Returns the size of a device path in bytes.
+
+ This function returns the size, in bytes, of the device path data structure
+ specified by DevicePath including the end of device path node.
+ If DevicePath is NULL or invalid, then 0 is returned.
+
+ @param DevicePath A pointer to a device path data structure.
+
+ @retval 0 If DevicePath is NULL or invalid.
+ @retval Others The size of a device path in bytes.
+
+**/
+UINTN
+GetDevicePathSize (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ )
+{
+ return UefiDevicePathLibGetDevicePathSize (DevicePath);
+}
+
+/**
+ Creates a new copy of an existing device path.
+
+ This function allocates space for a new copy of the device path specified by DevicePath.
+ If DevicePath is NULL, then NULL is returned. If the memory is successfully
+ allocated, then the contents of DevicePath are copied to the newly allocated
+ buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned.
+ The memory for the new device path is allocated from EFI boot services memory.
+ It is the responsibility of the caller to free the memory allocated.
+
+ @param DevicePath A pointer to a device path data structure.
+
+ @retval NULL DevicePath is NULL or invalid.
+ @retval Others A pointer to the duplicated device path.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DuplicateDevicePath (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ )
+{
+ return UefiDevicePathLibDuplicateDevicePath (DevicePath);
+}
+
+/**
+ Creates a new device path by appending a second device path to a first device path.
+
+ This function creates a new device path by appending a copy of SecondDevicePath
+ to a copy of FirstDevicePath in a newly allocated buffer. Only the end-of-device-path
+ device node from SecondDevicePath is retained. The newly created device path is
+ returned. If FirstDevicePath is NULL, then it is ignored, and a duplicate of
+ SecondDevicePath is returned. If SecondDevicePath is NULL, then it is ignored,
+ and a duplicate of FirstDevicePath is returned. If both FirstDevicePath and
+ SecondDevicePath are NULL, then a copy of an end-of-device-path is returned.
+
+ If there is not enough memory for the newly allocated buffer, then NULL is returned.
+ The memory for the new device path is allocated from EFI boot services memory.
+ It is the responsibility of the caller to free the memory allocated.
+
+ @param FirstDevicePath A pointer to a device path data structure.
+ @param SecondDevicePath A pointer to a device path data structure.
+
+ @retval NULL If there is not enough memory for the newly allocated buffer.
+ @retval NULL If FirstDevicePath or SecondDevicePath is invalid.
+ @retval Others A pointer to the new device path if success.
+ Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+AppendDevicePath (
+ CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL
+ CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL
+ )
+{
+ return UefiDevicePathLibAppendDevicePath (FirstDevicePath, SecondDevicePath);
+}
+
+/**
+ Creates a new path by appending the device node to the device path.
+
+ This function creates a new device path by appending a copy of the device node
+ specified by DevicePathNode to a copy of the device path specified by DevicePath
+ in an allocated buffer. The end-of-device-path device node is moved after the
+ end of the appended device node.
+ If DevicePathNode is NULL then a copy of DevicePath is returned.
+ If DevicePath is NULL then a copy of DevicePathNode, followed by an end-of-device
+ path device node is returned.
+ If both DevicePathNode and DevicePath are NULL then a copy of an end-of-device-path
+ device node is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+ of the caller to free the memory allocated.
+
+ @param DevicePath A pointer to a device path data structure.
+ @param DevicePathNode A pointer to a single device path node.
+
+ @retval NULL If there is not enough memory for the new device path.
+ @retval Others A pointer to the new device path if success.
+ A copy of DevicePathNode followed by an end-of-device-path node
+ if both FirstDevicePath and SecondDevicePath are NULL.
+ A copy of an end-of-device-path node if both FirstDevicePath
+ and SecondDevicePath are NULL.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+AppendDevicePathNode (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL
+ )
+{
+ return UefiDevicePathLibAppendDevicePathNode (DevicePath, DevicePathNode);
+}
+
+/**
+ Creates a new device path by appending the specified device path instance to the specified device
+ path.
+
+ This function creates a new device path by appending a copy of the device path
+ instance specified by DevicePathInstance to a copy of the device path specified
+ by DevicePath in a allocated buffer.
+ The end-of-device-path device node is moved after the end of the appended device
+ path instance and a new end-of-device-path-instance node is inserted between.
+ If DevicePath is NULL, then a copy if DevicePathInstance is returned.
+ If DevicePathInstance is NULL, then NULL is returned.
+ If DevicePath or DevicePathInstance is invalid, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+ of the caller to free the memory allocated.
+
+ @param DevicePath A pointer to a device path data structure.
+ @param DevicePathInstance A pointer to a device path instance.
+
+ @return A pointer to the new device path.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+AppendDevicePathInstance (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL
+ )
+{
+ return UefiDevicePathLibAppendDevicePathInstance (DevicePath, DevicePathInstance);
+}
+
+/**
+ Creates a copy of the current device path instance and returns a pointer to the next device path
+ instance.
+
+ This function creates a copy of the current device path instance. It also updates
+ DevicePath to point to the next device path instance in the device path (or NULL
+ if no more) and updates Size to hold the size of the device path instance copy.
+ If DevicePath is NULL, then NULL is returned.
+ If DevicePath points to a invalid device path, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+ of the caller to free the memory allocated.
+ If Size is NULL, then ASSERT().
+
+ @param DevicePath On input, this holds the pointer to the current
+ device path instance. On output, this holds
+ the pointer to the next device path instance
+ or NULL if there are no more device path
+ instances in the device path pointer to a
+ device path data structure.
+ @param Size On output, this holds the size of the device
+ path instance, in bytes or zero, if DevicePath
+ is NULL.
+
+ @return A pointer to the current device path instance.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+GetNextDevicePathInstance (
+ EFI_DEVICE_PATH_PROTOCOL **DevicePath,
+ UINTN *Size
+ )
+{
+ return UefiDevicePathLibGetNextDevicePathInstance (DevicePath, Size);
+}
+
+/**
+ Creates a device node.
+
+ This function creates a new device node in a newly allocated buffer of size
+ NodeLength and initializes the device path node header with NodeType and NodeSubType.
+ The new device path node is returned.
+ If NodeLength is smaller than a device path header, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+ of the caller to free the memory allocated.
+
+ @param NodeType The device node type for the new device node.
+ @param NodeSubType The device node sub-type for the new device node.
+ @param NodeLength The length of the new device node.
+
+ @return The new device path.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+CreateDeviceNode (
+ UINT8 NodeType,
+ UINT8 NodeSubType,
+ UINT16 NodeLength
+ )
+{
+ return UefiDevicePathLibCreateDeviceNode (NodeType, NodeSubType, NodeLength);
+}
+
+/**
+ Determines if a device path is single or multi-instance.
+
+ This function returns TRUE if the device path specified by DevicePath is
+ multi-instance.
+ Otherwise, FALSE is returned.
+ If DevicePath is NULL or invalid, then FALSE is returned.
+
+ @param DevicePath A pointer to a device path data structure.
+
+ @retval TRUE DevicePath is multi-instance.
+ @retval FALSE DevicePath is not multi-instance, or DevicePath
+ is NULL or invalid.
+
+**/
+BOOLEAN
+IsDevicePathMultiInstance (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ )
+{
+ return UefiDevicePathLibIsDevicePathMultiInstance (DevicePath);
+}
+
+/**
+ Convert text to the binary representation of a device node.
+
+ @param TextDeviceNode TextDeviceNode points to the text representation of a device
+ node. Conversion starts with the first character and continues
+ until the first non-device node character.
+
+ @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was
+ insufficient memory or text unsupported.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+ConvertTextToDeviceNode (
+ CONST CHAR16 *TextDeviceNode
+ )
+{
+ return UefiDevicePathLibConvertTextToDeviceNode (TextDeviceNode);
+}
+
+/**
+ Convert text to the binary representation of a device path.
+
+
+ @param TextDevicePath TextDevicePath points to the text representation of a device
+ path. Conversion starts with the first character and continues
+ until the first non-device node character.
+
+ @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or
+ there was insufficient memory.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+ConvertTextToDevicePath (
+ CONST CHAR16 *TextDevicePath
+ )
+{
+ return UefiDevicePathLibConvertTextToDevicePath (TextDevicePath);
+}
diff --git a/roms/edk2/BaseTools/Source/C/DevicePath/UefiDevicePathLib.h b/roms/edk2/BaseTools/Source/C/DevicePath/UefiDevicePathLib.h
new file mode 100644
index 000000000..1c171c808
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/DevicePath/UefiDevicePathLib.h
@@ -0,0 +1,439 @@
+/** @file
+ Definition for Device Path library.
+
+Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#ifndef _UEFI_DEVICE_PATH_LIB_H_
+#define _UEFI_DEVICE_PATH_LIB_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <assert.h>
+#ifdef __GNUC__
+#include <unistd.h>
+#else
+#include <direct.h>
+#endif
+#include <Common/UefiBaseTypes.h>
+#include <Protocol/DevicePath.h>
+#include <Protocol/DevicePathUtilities.h>
+#include "CommonLib.h"
+#include "EfiUtilityMsgs.h"
+
+#define END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL))
+#define MAX_DEVICE_PATH_NODE_COUNT 1024
+#define SIZE_64KB 0x00010000
+
+//
+// Private Data structure
+//
+typedef
+EFI_DEVICE_PATH_PROTOCOL *
+(*DEVICE_PATH_FROM_TEXT) (
+ IN CHAR16 *Str
+ );
+
+typedef struct {
+ CHAR16 *Str;
+ UINTN Count;
+ UINTN Capacity;
+} POOL_PRINT;
+
+
+typedef struct {
+ CHAR16 *DevicePathNodeText;
+ DEVICE_PATH_FROM_TEXT Function;
+} DEVICE_PATH_FROM_TEXT_TABLE;
+
+typedef struct {
+ BOOLEAN ClassExist;
+ UINT8 Class;
+ BOOLEAN SubClassExist;
+ UINT8 SubClass;
+} USB_CLASS_TEXT;
+
+#define USB_CLASS_AUDIO 1
+#define USB_CLASS_CDCCONTROL 2
+#define USB_CLASS_HID 3
+#define USB_CLASS_IMAGE 6
+#define USB_CLASS_PRINTER 7
+#define USB_CLASS_MASS_STORAGE 8
+#define USB_CLASS_HUB 9
+#define USB_CLASS_CDCDATA 10
+#define USB_CLASS_SMART_CARD 11
+#define USB_CLASS_VIDEO 14
+#define USB_CLASS_DIAGNOSTIC 220
+#define USB_CLASS_WIRELESS 224
+
+#define USB_CLASS_RESERVE 254
+#define USB_SUBCLASS_FW_UPDATE 1
+#define USB_SUBCLASS_IRDA_BRIDGE 2
+#define USB_SUBCLASS_TEST 3
+
+#define RFC_1700_UDP_PROTOCOL 17
+#define RFC_1700_TCP_PROTOCOL 6
+
+#pragma pack(1)
+
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ EFI_GUID Guid;
+ UINT8 VendorDefinedData[1];
+} VENDOR_DEFINED_HARDWARE_DEVICE_PATH;
+
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ EFI_GUID Guid;
+ UINT8 VendorDefinedData[1];
+} VENDOR_DEFINED_MESSAGING_DEVICE_PATH;
+
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ EFI_GUID Guid;
+ UINT8 VendorDefinedData[1];
+} VENDOR_DEFINED_MEDIA_DEVICE_PATH;
+
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ UINT32 Hid;
+ UINT32 Uid;
+ UINT32 Cid;
+ CHAR8 HidUidCidStr[3];
+} ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR;
+
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ UINT16 NetworkProtocol;
+ UINT16 LoginOption;
+ UINT64 Lun;
+ UINT16 TargetPortalGroupTag;
+ CHAR8 TargetName[1];
+} ISCSI_DEVICE_PATH_WITH_NAME;
+
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ EFI_GUID Guid;
+ UINT8 VendorDefinedData[1];
+} VENDOR_DEVICE_PATH_WITH_DATA;
+
+#pragma pack()
+
+/**
+ Returns the size of a device path in bytes.
+
+ This function returns the size, in bytes, of the device path data structure
+ specified by DevicePath including the end of device path node.
+ If DevicePath is NULL or invalid, then 0 is returned.
+
+ @param DevicePath A pointer to a device path data structure.
+
+ @retval 0 If DevicePath is NULL or invalid.
+ @retval Others The size of a device path in bytes.
+
+**/
+UINTN
+UefiDevicePathLibGetDevicePathSize (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ );
+
+/**
+ Creates a new copy of an existing device path.
+
+ This function allocates space for a new copy of the device path specified by DevicePath.
+ If DevicePath is NULL, then NULL is returned. If the memory is successfully
+ allocated, then the contents of DevicePath are copied to the newly allocated
+ buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned.
+ The memory for the new device path is allocated from EFI boot services memory.
+ It is the responsibility of the caller to free the memory allocated.
+
+ @param DevicePath A pointer to a device path data structure.
+
+ @retval NULL DevicePath is NULL or invalid.
+ @retval Others A pointer to the duplicated device path.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibDuplicateDevicePath (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ );
+
+/**
+ Creates a new device path by appending a second device path to a first device path.
+
+ This function creates a new device path by appending a copy of SecondDevicePath
+ to a copy of FirstDevicePath in a newly allocated buffer. Only the end-of-device-path
+ device node from SecondDevicePath is retained. The newly created device path is
+ returned. If FirstDevicePath is NULL, then it is ignored, and a duplicate of
+ SecondDevicePath is returned. If SecondDevicePath is NULL, then it is ignored,
+ and a duplicate of FirstDevicePath is returned. If both FirstDevicePath and
+ SecondDevicePath are NULL, then a copy of an end-of-device-path is returned.
+
+ If there is not enough memory for the newly allocated buffer, then NULL is returned.
+ The memory for the new device path is allocated from EFI boot services memory.
+ It is the responsibility of the caller to free the memory allocated.
+
+ @param FirstDevicePath A pointer to a device path data structure.
+ @param SecondDevicePath A pointer to a device path data structure.
+
+ @retval NULL If there is not enough memory for the newly allocated buffer.
+ @retval NULL If FirstDevicePath or SecondDevicePath is invalid.
+ @retval Others A pointer to the new device path if success.
+ Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibAppendDevicePath (
+ CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL
+ CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL
+ );
+
+/**
+ Creates a new path by appending the device node to the device path.
+
+ This function creates a new device path by appending a copy of the device node
+ specified by DevicePathNode to a copy of the device path specified by DevicePath
+ in an allocated buffer. The end-of-device-path device node is moved after the
+ end of the appended device node.
+ If DevicePathNode is NULL then a copy of DevicePath is returned.
+ If DevicePath is NULL then a copy of DevicePathNode, followed by an end-of-device
+ path device node is returned.
+ If both DevicePathNode and DevicePath are NULL then a copy of an end-of-device-path
+ device node is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+ of the caller to free the memory allocated.
+
+ @param DevicePath A pointer to a device path data structure.
+ @param DevicePathNode A pointer to a single device path node.
+
+ @retval NULL If there is not enough memory for the new device path.
+ @retval Others A pointer to the new device path if success.
+ A copy of DevicePathNode followed by an end-of-device-path node
+ if both FirstDevicePath and SecondDevicePath are NULL.
+ A copy of an end-of-device-path node if both FirstDevicePath
+ and SecondDevicePath are NULL.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibAppendDevicePathNode (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL
+ );
+
+/**
+ Creates a new device path by appending the specified device path instance to the specified device
+ path.
+
+ This function creates a new device path by appending a copy of the device path
+ instance specified by DevicePathInstance to a copy of the device path specified
+ by DevicePath in a allocated buffer.
+ The end-of-device-path device node is moved after the end of the appended device
+ path instance and a new end-of-device-path-instance node is inserted between.
+ If DevicePath is NULL, then a copy if DevicePathInstance is returned.
+ If DevicePathInstance is NULL, then NULL is returned.
+ If DevicePath or DevicePathInstance is invalid, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+ of the caller to free the memory allocated.
+
+ @param DevicePath A pointer to a device path data structure.
+ @param DevicePathInstance A pointer to a device path instance.
+
+ @return A pointer to the new device path.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibAppendDevicePathInstance (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL
+ );
+
+/**
+ Creates a copy of the current device path instance and returns a pointer to the next device path
+ instance.
+
+ This function creates a copy of the current device path instance. It also updates
+ DevicePath to point to the next device path instance in the device path (or NULL
+ if no more) and updates Size to hold the size of the device path instance copy.
+ If DevicePath is NULL, then NULL is returned.
+ If DevicePath points to a invalid device path, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+ of the caller to free the memory allocated.
+ If Size is NULL, then ASSERT().
+
+ @param DevicePath On input, this holds the pointer to the current
+ device path instance. On output, this holds
+ the pointer to the next device path instance
+ or NULL if there are no more device path
+ instances in the device path pointer to a
+ device path data structure.
+ @param Size On output, this holds the size of the device
+ path instance, in bytes or zero, if DevicePath
+ is NULL.
+
+ @return A pointer to the current device path instance.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibGetNextDevicePathInstance (
+ EFI_DEVICE_PATH_PROTOCOL **DevicePath,
+ UINTN *Size
+ );
+
+/**
+ Creates a device node.
+
+ This function creates a new device node in a newly allocated buffer of size
+ NodeLength and initializes the device path node header with NodeType and NodeSubType.
+ The new device path node is returned.
+ If NodeLength is smaller than a device path header, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+ of the caller to free the memory allocated.
+
+ @param NodeType The device node type for the new device node.
+ @param NodeSubType The device node sub-type for the new device node.
+ @param NodeLength The length of the new device node.
+
+ @return The new device path.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibCreateDeviceNode (
+ UINT8 NodeType,
+ UINT8 NodeSubType,
+ UINT16 NodeLength
+ );
+
+/**
+ Determines if a device path is single or multi-instance.
+
+ This function returns TRUE if the device path specified by DevicePath is
+ multi-instance.
+ Otherwise, FALSE is returned.
+ If DevicePath is NULL or invalid, then FALSE is returned.
+
+ @param DevicePath A pointer to a device path data structure.
+
+ @retval TRUE DevicePath is multi-instance.
+ @retval FALSE DevicePath is not multi-instance, or DevicePath
+ is NULL or invalid.
+
+**/
+BOOLEAN
+UefiDevicePathLibIsDevicePathMultiInstance (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ );
+
+/**
+ Convert text to the binary representation of a device node.
+
+ @param TextDeviceNode TextDeviceNode points to the text representation of a device
+ node. Conversion starts with the first character and continues
+ until the first non-device node character.
+
+ @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was
+ insufficient memory or text unsupported.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibConvertTextToDeviceNode (
+ CONST CHAR16 *TextDeviceNode
+ );
+
+/**
+ Convert text to the binary representation of a device path.
+
+
+ @param TextDevicePath TextDevicePath points to the text representation of a device
+ path. Conversion starts with the first character and continues
+ until the first non-device node character.
+
+ @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or
+ there was insufficient memory.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibConvertTextToDevicePath (
+ CONST CHAR16 *TextDevicePath
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+CreateDeviceNode (
+ UINT8 NodeType,
+ UINT8 NodeSubType,
+ UINT16 NodeLength
+ );
+
+BOOLEAN
+IsDevicePathMultiInstance (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+GetNextDevicePathInstance (
+ EFI_DEVICE_PATH_PROTOCOL **DevicePath,
+ UINTN *Size
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+AppendDevicePathInstance (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+AppendDevicePathNode (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL
+ );
+EFI_DEVICE_PATH_PROTOCOL *
+AppendDevicePath (
+ CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL
+ CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+DuplicateDevicePath (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ );
+
+UINTN
+GetDevicePathSize (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ );
+
+CHAR16 *
+ConvertDeviceNodeToText (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,
+ BOOLEAN DisplayOnly,
+ BOOLEAN AllowShortcuts
+ );
+
+CHAR16 *
+ConvertDevicePathToText (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ BOOLEAN DisplayOnly,
+ BOOLEAN AllowShortcuts
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+ConvertTextToDeviceNode (
+ CONST CHAR16 *TextDeviceNode
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+ConvertTextToDevicePath (
+ CONST CHAR16 *TextDevicePath
+ );
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/EfiRom/EfiRom.c b/roms/edk2/BaseTools/Source/C/EfiRom/EfiRom.c
new file mode 100644
index 000000000..a7e2839b0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/EfiRom/EfiRom.c
@@ -0,0 +1,1712 @@
+/** @file
+Utility program to create an EFI option ROM image from binary and EFI PE32 files.
+
+Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "EfiUtilityMsgs.h"
+#include "ParseInf.h"
+#include "EfiRom.h"
+
+UINT64 DebugLevel = 0;
+
+int
+main (
+ int Argc,
+ char *Argv[]
+ )
+/*++
+
+Routine Description:
+
+ Given an EFI image filename, create a ROM-able image by creating an option
+ ROM header and PCI data structure, filling them in, and then writing the
+ option ROM header + PCI data structure + EFI image out to the output file.
+
+Arguments:
+
+ Argc - standard C main() argument count
+
+ Argv - standard C main() argument list
+
+Returns:
+
+ 0 success
+ non-zero otherwise
+
+--*/
+{
+ CHAR8 *Ext;
+ FILE *FptrOut;
+ UINT32 Status;
+ FILE_LIST *FList;
+ UINT32 TotalSize;
+ UINT32 Size;
+ CHAR8 *Ptr0;
+
+ SetUtilityName(UTILITY_NAME);
+
+ Status = STATUS_SUCCESS;
+ FptrOut = NULL;
+
+ //
+ // Parse the command line arguments
+ //
+ if (ParseCommandLine (Argc, Argv, &mOptions)) {
+ return STATUS_ERROR;
+ }
+
+ if (mOptions.Quiet) {
+ SetPrintLevel(40);
+ } else if (mOptions.Verbose) {
+ SetPrintLevel(15);
+ } else if (mOptions.Debug) {
+ SetPrintLevel(DebugLevel);
+ }
+
+ if (mOptions.Verbose) {
+ VerboseMsg("%s tool start.\n", UTILITY_NAME);
+ }
+
+ //
+ // If dumping an image, then do that and quit
+ //
+ if (mOptions.DumpOption == 1) {
+ if (mOptions.FileList != NULL) {
+ if ((Ptr0 = strstr ((CONST CHAR8 *) mOptions.FileList->FileName, DEFAULT_OUTPUT_EXTENSION)) != NULL) {
+ DumpImage (mOptions.FileList);
+ goto BailOut;
+ } else {
+ Error (NULL, 0, 1002, "No PciRom input file", "No *.rom input file");
+ goto BailOut;
+ }
+ }
+ }
+ //
+ // Determine the output filename. Either what they specified on
+ // the command line, or the first input filename with a different extension.
+ //
+ if (!mOptions.OutFileName[0]) {
+ if (mOptions.FileList != NULL) {
+ if (strlen (mOptions.FileList->FileName) >= MAX_PATH) {
+ Status = STATUS_ERROR;
+ Error (NULL, 0, 2000, "Invalid parameter", "Input file name is too long - %s.", mOptions.FileList->FileName);
+ goto BailOut;
+ }
+ strncpy (mOptions.OutFileName, mOptions.FileList->FileName, MAX_PATH - 1);
+ mOptions.OutFileName[MAX_PATH - 1] = 0;
+ //
+ // Find the last . on the line and replace the filename extension with
+ // the default
+ //
+ Ext = mOptions.OutFileName + strlen (mOptions.OutFileName) - 1;
+ while (Ext >= mOptions.OutFileName) {
+ if ((*Ext == '.') || (*Ext == '\\')) {
+ break;
+ }
+ Ext--;
+ }
+ //
+ // If dot here, then insert extension here, otherwise append
+ //
+ if (*Ext != '.') {
+ Ext = mOptions.OutFileName + strlen (mOptions.OutFileName);
+ }
+
+ strcpy (Ext, DEFAULT_OUTPUT_EXTENSION);
+ }
+ }
+ //
+ // Make sure we don't have the same filename for input and output files
+ //
+ for (FList = mOptions.FileList; FList != NULL; FList = FList->Next) {
+ if (stricmp (mOptions.OutFileName, FList->FileName) == 0) {
+ Status = STATUS_ERROR;
+ Error (NULL, 0, 1002, "Invalid input parameter", "Input and output file names must be different - %s = %s.", FList->FileName, mOptions.OutFileName);
+ goto BailOut;
+ }
+ }
+ //
+ // Now open our output file
+ //
+ if ((FptrOut = fopen (LongFilePath (mOptions.OutFileName), "wb")) == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", "Error opening file %s", mOptions.OutFileName);
+ goto BailOut;
+ }
+ //
+ // Process all our files
+ //
+ TotalSize = 0;
+ for (FList = mOptions.FileList; FList != NULL; FList = FList->Next) {
+ Size = 0;
+ if ((FList->FileFlags & FILE_FLAG_EFI) != 0) {
+ if (mOptions.Verbose) {
+ VerboseMsg("Processing EFI file %s\n", FList->FileName);
+ }
+
+ Status = ProcessEfiFile (FptrOut, FList, mOptions.VendId, mOptions.DevIdList[0], &Size);
+ } else if ((FList->FileFlags & FILE_FLAG_BINARY) !=0 ) {
+ if (mOptions.Verbose) {
+ VerboseMsg("Processing binary file %s\n", FList->FileName);
+ }
+
+ Status = ProcessBinFile (FptrOut, FList, &Size);
+ } else {
+ Error (NULL, 0, 2000, "Invalid parameter", "File type not specified, it must be either an EFI or binary file: %s.", FList->FileName);
+ Status = STATUS_ERROR;
+ }
+
+ if (mOptions.Verbose) {
+ VerboseMsg(" Output size = 0x%X\n", (unsigned) Size);
+ }
+
+ if (Status != STATUS_SUCCESS) {
+ break;
+ }
+
+ TotalSize += Size;
+ }
+ //
+ // Check total size
+ //
+ if (TotalSize > MAX_OPTION_ROM_SIZE) {
+ Error (NULL, 0, 2000, "Invalid parameter", "Option ROM image size exceeds limit of 0x%X bytes.", MAX_OPTION_ROM_SIZE);
+ Status = STATUS_ERROR;
+ }
+
+BailOut:
+ if (Status == STATUS_SUCCESS) {
+ //
+ // Clean up our file list
+ //
+ while (mOptions.FileList != NULL) {
+ FList = mOptions.FileList->Next;
+ free (mOptions.FileList);
+ mOptions.FileList = FList;
+ }
+
+ //
+ // Clean up device ID list
+ //
+ if (mOptions.DevIdList != NULL) {
+ free (mOptions.DevIdList);
+ }
+ }
+ if (FptrOut != NULL) {
+ fclose (FptrOut);
+ }
+
+ if (mOptions.Verbose) {
+ VerboseMsg("%s tool done with return code is 0x%x.\n", UTILITY_NAME, GetUtilityStatus ());
+ }
+
+ return GetUtilityStatus ();
+}
+
+static
+int
+ProcessBinFile (
+ FILE *OutFptr,
+ FILE_LIST *InFile,
+ UINT32 *Size
+ )
+/*++
+
+Routine Description:
+
+ Process a binary input file.
+
+Arguments:
+
+ OutFptr - file pointer to output binary ROM image file we're creating
+ InFile - structure contains information on the binary file to process
+ Size - pointer to where to return the size added to the output file
+
+Returns:
+
+ 0 - successful
+
+--*/
+{
+ FILE *InFptr;
+ UINT32 TotalSize;
+ UINT32 FileSize;
+ UINT8 *Buffer;
+ UINT32 Status;
+ PCI_EXPANSION_ROM_HEADER *RomHdr;
+ PCI_DATA_STRUCTURE *PciDs23;
+ PCI_3_0_DATA_STRUCTURE *PciDs30;
+ UINT32 Index;
+ UINT8 ByteCheckSum;
+ UINT16 CodeType;
+
+ PciDs23 = NULL;
+ PciDs30 = NULL;
+ Status = STATUS_SUCCESS;
+
+ //
+ // Try to open the input file
+ //
+ if ((InFptr = fopen (LongFilePath (InFile->FileName), "rb")) == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", "%s", InFile->FileName);
+ return STATUS_ERROR;
+ }
+ //
+ // Seek to the end of the input file and get the file size. Then allocate
+ // a buffer to read it in to.
+ //
+ fseek (InFptr, 0, SEEK_END);
+ FileSize = ftell (InFptr);
+ if (mOptions.Verbose) {
+ VerboseMsg(" File size = 0x%X\n", (unsigned) FileSize);
+ }
+
+ fseek (InFptr, 0, SEEK_SET);
+ Buffer = (UINT8 *) malloc (FileSize);
+ if (Buffer == NULL) {
+ Error (NULL, 0, 4003, "Resource", "memory cannot be allocated!");
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+
+ if (fread (Buffer, FileSize, 1, InFptr) != 1) {
+ Error (NULL, 0, 2000, "Invalid", "Failed to read all bytes from input file.");
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+ //
+ // Total size must be an even multiple of 512 bytes, and can't exceed
+ // the option ROM image size.
+ //
+ TotalSize = FileSize;
+ if (TotalSize & 0x1FF) {
+ TotalSize = (TotalSize + 0x200) &~0x1ff;
+ }
+
+ if (TotalSize > MAX_OPTION_ROM_SIZE) {
+ Error (NULL, 0, 3001, "Invalid", "Option ROM image %s size exceeds limit of 0x%X bytes.", InFile->FileName, MAX_OPTION_ROM_SIZE);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+ //
+ // Return the size to the caller so they can keep track of the running total.
+ //
+ *Size = TotalSize;
+
+ //
+ // Crude check to make sure it's a legitimate ROM image
+ //
+ RomHdr = (PCI_EXPANSION_ROM_HEADER *) Buffer;
+ if (RomHdr->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
+ Error (NULL, 0, 2000, "Invalid parameter", "ROM image file has an invalid ROM signature.");
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+ //
+ // Make sure the pointer to the PCI data structure is within the size of the image.
+ // Then check it for valid signature.
+ //
+ if ((RomHdr->PcirOffset > FileSize) || (RomHdr->PcirOffset == 0)) {
+ Error (NULL, 0, 2000, "Invalid parameter", "Invalid PCI data structure offset.");
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+
+ //
+ // Check the header is conform to PCI2.3 or PCI3.0
+ //
+ if (mOptions.Pci23 == 1) {
+ PciDs23 = (PCI_DATA_STRUCTURE *) (Buffer + RomHdr->PcirOffset);
+ if (PciDs23->Signature != PCI_DATA_STRUCTURE_SIGNATURE) {
+ Error (NULL, 0, 2000, "Invalid parameter", "PCI data structure has an invalid signature.");
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+ } else {
+ //
+ // Default setting is PCI3.0 header
+ //
+ PciDs30 = (PCI_3_0_DATA_STRUCTURE *)(Buffer + RomHdr->PcirOffset);
+ if (PciDs30->Signature != PCI_DATA_STRUCTURE_SIGNATURE) {
+ Error (NULL, 0, 2000, "Invalid parameter", "PCI data structure has an invalid signature.");
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+ }
+
+ //
+ // ReSet Option Rom size
+ //
+ if (mOptions.Pci23 == 1) {
+ PciDs23->ImageLength = (UINT16) (TotalSize / 512);
+ CodeType = PciDs23->CodeType;
+ } else {
+ PciDs30->ImageLength = (UINT16) (TotalSize / 512);
+ CodeType = PciDs30->CodeType;
+ }
+
+ //
+ // If this is the last image, then set the LAST bit unless requested not
+ // to via the command-line -n argument. Otherwise, make sure you clear it.
+ //
+ if ((InFile->Next == NULL) && (mOptions.NoLast == 0)) {
+ if (mOptions.Pci23 == 1) {
+ PciDs23->Indicator = INDICATOR_LAST;
+ } else {
+ PciDs30->Indicator = INDICATOR_LAST;
+ }
+ } else {
+ if (mOptions.Pci23 == 1) {
+ PciDs23->Indicator = 0;
+ } else {
+ PciDs30->Indicator = 0;
+ }
+ }
+
+ if (CodeType != PCI_CODE_TYPE_EFI_IMAGE) {
+ ByteCheckSum = 0;
+ for (Index = 0; Index < FileSize - 1; Index++) {
+ ByteCheckSum = (UINT8) (ByteCheckSum + Buffer[Index]);
+ }
+
+ Buffer[FileSize - 1] = (UINT8) ((~ByteCheckSum) + 1);
+ if (mOptions.Verbose) {
+ VerboseMsg(" Checksum = %02x\n\n", Buffer[FileSize - 1]);
+ }
+ }
+
+ //
+ // Now copy the input file contents out to the output file
+ //
+ if (fwrite (Buffer, FileSize, 1, OutFptr) != 1) {
+ Error (NULL, 0, 0005, "Failed to write all file bytes to output file.", NULL);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+
+ TotalSize -= FileSize;
+ //
+ // Pad the rest of the image to make it a multiple of 512 bytes
+ //
+ while (TotalSize > 0) {
+ putc (~0, OutFptr);
+ TotalSize--;
+ }
+
+BailOut:
+ if (InFptr != NULL) {
+ fclose (InFptr);
+ }
+
+ if (Buffer != NULL) {
+ free (Buffer);
+ }
+ //
+ // Print the file name if errors occurred
+ //
+ if (Status != STATUS_SUCCESS) {
+ Error (NULL, 0, 0003, "Error", "Error parsing file: %s", InFile->FileName);
+ }
+
+ return Status;
+}
+
+static
+int
+ProcessEfiFile (
+ FILE *OutFptr,
+ FILE_LIST *InFile,
+ UINT16 VendId,
+ UINT16 DevId,
+ UINT32 *Size
+ )
+/*++
+
+Routine Description:
+
+ Process a PE32 EFI file.
+
+Arguments:
+
+ OutFptr - file pointer to output binary ROM image file we're creating
+ InFile - structure contains information on the PE32 file to process
+ VendId - vendor ID as required in the option ROM header
+ DevId - device ID as required in the option ROM header
+ Size - pointer to where to return the size added to the output file
+
+Returns:
+
+ 0 - successful
+
+--*/
+{
+ UINT32 Status;
+ FILE *InFptr;
+ EFI_PCI_EXPANSION_ROM_HEADER RomHdr;
+ PCI_DATA_STRUCTURE PciDs23;
+ PCI_3_0_DATA_STRUCTURE PciDs30;
+ UINT32 FileSize;
+ UINT32 CompressedFileSize;
+ UINT8 *Buffer;
+ UINT8 *CompressedBuffer;
+ UINT8 *TempBufferPtr;
+ UINT32 TotalSize;
+ UINT32 HeaderSize;
+ UINT16 MachineType;
+ UINT16 SubSystem;
+ UINT32 HeaderPadBytes;
+ UINT32 PadBytesBeforeImage;
+ UINT32 PadBytesAfterImage;
+ UINT32 DevIdListSize;
+
+ //
+ // Try to open the input file
+ //
+ if ((InFptr = fopen (LongFilePath (InFile->FileName), "rb")) == NULL) {
+ Error (NULL, 0, 0001, "Open file error", "Error opening file: %s", InFile->FileName);
+ return STATUS_ERROR;
+ }
+ //
+ // Initialize our buffer pointers to null.
+ //
+ Buffer = NULL;
+ CompressedBuffer = NULL;
+
+ //
+ // Double-check the file to make sure it's what we expect it to be
+ //
+ Status = CheckPE32File (InFptr, &MachineType, &SubSystem);
+ if (Status != STATUS_SUCCESS) {
+ goto BailOut;
+ }
+ //
+ // Seek to the end of the input file and get the file size
+ //
+ fseek (InFptr, 0, SEEK_END);
+ FileSize = ftell (InFptr);
+
+ //
+ // Get the size of the headers we're going to put in front of the image. The
+ // EFI header must be aligned on a 4-byte boundary, so pad accordingly.
+ //
+ if (sizeof (RomHdr) & 0x03) {
+ HeaderPadBytes = 4 - (sizeof (RomHdr) & 0x03);
+ } else {
+ HeaderPadBytes = 0;
+ }
+
+ //
+ // For Pci3.0 to use the different data structure.
+ //
+ if (mOptions.Pci23 == 1) {
+ HeaderSize = sizeof (PCI_DATA_STRUCTURE) + HeaderPadBytes + sizeof (EFI_PCI_EXPANSION_ROM_HEADER);
+ } else {
+ if (mOptions.DevIdCount > 1) {
+ //
+ // Write device ID list when more than one device ID is specified.
+ // Leave space for list plus terminator.
+ //
+ DevIdListSize = (mOptions.DevIdCount + 1) * sizeof (UINT16);
+ } else {
+ DevIdListSize = 0;
+ }
+ HeaderSize = sizeof (PCI_3_0_DATA_STRUCTURE) + HeaderPadBytes + DevIdListSize + sizeof (EFI_PCI_EXPANSION_ROM_HEADER);
+ }
+
+ if (mOptions.Verbose) {
+ VerboseMsg(" File size = 0x%X\n", (unsigned) FileSize);
+ }
+ //
+ // Allocate memory for the entire file (in case we have to compress), then
+ // seek back to the beginning of the file and read it into our buffer.
+ //
+ Buffer = (UINT8 *) malloc (FileSize);
+ if (Buffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+
+ fseek (InFptr, 0, SEEK_SET);
+ if (fread (Buffer, FileSize, 1, InFptr) != 1) {
+ Error (NULL, 0, 0004, "Error reading file", "File %s", InFile->FileName);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+ //
+ // Now determine the size of the final output file. It's either the header size
+ // plus the file's size, or the header size plus the compressed file size.
+ //
+ if ((InFile->FileFlags & FILE_FLAG_COMPRESS) != 0) {
+ //
+ // Allocate a buffer into which we can compress the image, compress it,
+ // and use that size as the new size.
+ //
+ CompressedBuffer = (UINT8 *) malloc (FileSize);
+ if (CompressedBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+
+ CompressedFileSize = FileSize;
+ Status = EfiCompress (Buffer, FileSize, CompressedBuffer, &CompressedFileSize);
+ if (Status != STATUS_SUCCESS) {
+ Error (NULL, 0, 0007, "Error compressing file!", NULL);
+ goto BailOut;
+ }
+ //
+ // Now compute the size, then swap buffer pointers.
+ //
+ if (mOptions.Verbose) {
+ VerboseMsg(" Comp size = 0x%X\n", (unsigned) CompressedFileSize);
+ }
+
+ TotalSize = CompressedFileSize + HeaderSize;
+ FileSize = CompressedFileSize;
+ TempBufferPtr = Buffer;
+ Buffer = CompressedBuffer;
+ CompressedBuffer = TempBufferPtr;
+ } else {
+ TotalSize = FileSize + HeaderSize;
+ }
+ //
+ // Total size must be an even multiple of 512 bytes
+ //
+ if (TotalSize & 0x1FF) {
+ TotalSize = (TotalSize + 0x200) &~0x1ff;
+ }
+ //
+ // Workaround:
+ // If compressed, put the pad bytes after the image,
+ // else put the pad bytes before the image.
+ //
+ if ((InFile->FileFlags & FILE_FLAG_COMPRESS) != 0) {
+ PadBytesBeforeImage = 0;
+ PadBytesAfterImage = TotalSize - (FileSize + HeaderSize);
+ } else {
+ PadBytesBeforeImage = TotalSize - (FileSize + HeaderSize);
+ PadBytesAfterImage = 0;
+ }
+ //
+ // Check size
+ //
+ if (TotalSize > MAX_OPTION_ROM_SIZE) {
+ Error (NULL, 0, 2000, "Invalid", "Option ROM image %s size exceeds limit of 0x%X bytes.", InFile->FileName, MAX_OPTION_ROM_SIZE);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+ //
+ // Return the size to the caller so they can keep track of the running total.
+ //
+ *Size = TotalSize;
+
+ //
+ // Now fill in the ROM header. These values come from chapter 18 of the
+ // EFI 1.02 specification.
+ //
+ memset (&RomHdr, 0, sizeof (RomHdr));
+ RomHdr.Signature = PCI_EXPANSION_ROM_HEADER_SIGNATURE;
+ RomHdr.InitializationSize = (UINT16) (TotalSize / 512);
+ RomHdr.EfiSignature = EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE;
+ RomHdr.EfiSubsystem = SubSystem;
+ RomHdr.EfiMachineType = MachineType;
+ RomHdr.EfiImageHeaderOffset = (UINT16) (HeaderSize + PadBytesBeforeImage);
+ RomHdr.PcirOffset = (UINT16) (sizeof (RomHdr) + HeaderPadBytes);
+ //
+ // Set image as compressed or not
+ //
+ if (InFile->FileFlags & FILE_FLAG_COMPRESS) {
+ RomHdr.CompressionType = EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED;
+ }
+ //
+ // Fill in the PCI data structure
+ //
+ if (mOptions.Pci23 == 1) {
+ memset (&PciDs23, 0, sizeof (PCI_DATA_STRUCTURE));
+ } else {
+ memset (&PciDs30, 0, sizeof (PCI_3_0_DATA_STRUCTURE));
+ }
+
+ if (mOptions.Pci23 == 1) {
+ PciDs23.Signature = PCI_DATA_STRUCTURE_SIGNATURE;
+ PciDs23.VendorId = VendId;
+ PciDs23.DeviceId = DevId;
+ PciDs23.Length = (UINT16) sizeof (PCI_DATA_STRUCTURE);
+ PciDs23.Revision = 0;
+ //
+ // Class code and code revision from the command line (optional)
+ //
+ PciDs23.ClassCode[0] = (UINT8) InFile->ClassCode;
+ PciDs23.ClassCode[1] = (UINT8) (InFile->ClassCode >> 8);
+ PciDs23.ClassCode[2] = (UINT8) (InFile->ClassCode >> 16);
+ PciDs23.ImageLength = RomHdr.InitializationSize;
+ PciDs23.CodeRevision = InFile->CodeRevision;
+ PciDs23.CodeType = PCI_CODE_TYPE_EFI_IMAGE;
+ } else {
+ PciDs30.Signature = PCI_DATA_STRUCTURE_SIGNATURE;
+ PciDs30.VendorId = VendId;
+ PciDs30.DeviceId = DevId;
+ if (mOptions.DevIdCount > 1) {
+ //
+ // Place device list immediately after PCI structure
+ //
+ PciDs30.DeviceListOffset = (UINT16) sizeof (PCI_3_0_DATA_STRUCTURE);
+ } else {
+ PciDs30.DeviceListOffset = 0;
+ }
+ PciDs30.Length = (UINT16) sizeof (PCI_3_0_DATA_STRUCTURE);
+ PciDs30.Revision = 0x3;
+ //
+ // Class code and code revision from the command line (optional)
+ //
+ PciDs30.ClassCode[0] = (UINT8) InFile->ClassCode;
+ PciDs30.ClassCode[1] = (UINT8) (InFile->ClassCode >> 8);
+ PciDs30.ClassCode[2] = (UINT8) (InFile->ClassCode >> 16);
+ PciDs30.ImageLength = RomHdr.InitializationSize;
+ PciDs30.CodeRevision = InFile->CodeRevision;
+ PciDs30.CodeType = PCI_CODE_TYPE_EFI_IMAGE;
+ PciDs30.MaxRuntimeImageLength = 0; // to be fixed
+ PciDs30.ConfigUtilityCodeHeaderOffset = 0; // to be fixed
+ PciDs30.DMTFCLPEntryPointOffset = 0; // to be fixed
+ }
+ //
+ // If this is the last image, then set the LAST bit unless requested not
+ // to via the command-line -n argument.
+ //
+ if ((InFile->Next == NULL) && (mOptions.NoLast == 0)) {
+ if (mOptions.Pci23 == 1) {
+ PciDs23.Indicator = INDICATOR_LAST;
+ } else {
+ PciDs30.Indicator = INDICATOR_LAST;}
+ } else {
+ if (mOptions.Pci23 == 1) {
+ PciDs23.Indicator = 0;
+ } else {
+ PciDs30.Indicator = 0;
+ }
+ }
+ //
+ // Write the ROM header to the output file
+ //
+ if (fwrite (&RomHdr, sizeof (RomHdr), 1, OutFptr) != 1) {
+ Error (NULL, 0, 0002, "Failed to write ROM header to output file!", NULL);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+
+ //
+ // Write pad bytes to align the PciDs
+ //
+ while (HeaderPadBytes > 0) {
+ if (putc (0, OutFptr) == EOF) {
+ Error (NULL, 0, 0002, "Failed to write ROM header pad bytes to output file!", NULL);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+
+ HeaderPadBytes--;
+ }
+ //
+ // Write the PCI data structure header to the output file
+ //
+ if (mOptions.Pci23 == 1) {
+ if (fwrite (&PciDs23, sizeof (PciDs23), 1, OutFptr) != 1) {
+ Error (NULL, 0, 0002, "Failed to write PCI ROM header to output file!", NULL);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+ } else {
+ if (fwrite (&PciDs30, sizeof (PciDs30), 1, OutFptr) != 1) {
+ Error (NULL, 0, 0002, "Failed to write PCI ROM header to output file!", NULL);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+ }
+
+ //
+ // Write the Device ID list to the output file
+ //
+ if (mOptions.DevIdCount > 1) {
+ if (fwrite (mOptions.DevIdList, sizeof (UINT16), mOptions.DevIdCount, OutFptr) != mOptions.DevIdCount) {
+ Error (NULL, 0, 0002, "Failed to write PCI device list to output file!", NULL);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+ //
+ // Write two-byte terminating 0 at the end of the device list
+ //
+ if (putc (0, OutFptr) == EOF || putc (0, OutFptr) == EOF) {
+ Error (NULL, 0, 0002, "Failed to write PCI device list to output file!", NULL);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+ }
+
+
+ //
+ // Pad head to make it a multiple of 512 bytes
+ //
+ while (PadBytesBeforeImage > 0) {
+ if (putc (~0, OutFptr) == EOF) {
+ Error (NULL, 0, 2000, "Failed to write trailing pad bytes output file!", NULL);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+ PadBytesBeforeImage--;
+ }
+ //
+ // Now dump the input file's contents to the output file
+ //
+ if (fwrite (Buffer, FileSize, 1, OutFptr) != 1) {
+ Error (NULL, 0, 0002, "Failed to write all file bytes to output file!", NULL);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+
+ //
+ // Pad the rest of the image to make it a multiple of 512 bytes
+ //
+ while (PadBytesAfterImage > 0) {
+ if (putc (~0, OutFptr) == EOF) {
+ Error (NULL, 0, 2000, "Failed to write trailing pad bytes output file!", NULL);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+
+ PadBytesAfterImage--;
+ }
+
+BailOut:
+ if (InFptr != NULL) {
+ fclose (InFptr);
+ }
+ //
+ // Free up our buffers
+ //
+ if (Buffer != NULL) {
+ free (Buffer);
+ }
+
+ if (CompressedBuffer != NULL) {
+ free (CompressedBuffer);
+ }
+ //
+ // Print the file name if errors occurred
+ //
+ if (Status != STATUS_SUCCESS) {
+ Error (NULL, 0, 0003, "Error parsing", "Error parsing file: %s", InFile->FileName);
+ }
+
+ return Status;
+}
+
+static
+int
+CheckPE32File (
+ FILE *Fptr,
+ UINT16 *MachineType,
+ UINT16 *SubSystem
+ )
+/*++
+
+Routine Description:
+
+ Given a file pointer to a supposed PE32 image file, verify that it is indeed a
+ PE32 image file, and then return the machine type in the supplied pointer.
+
+Arguments:
+
+ Fptr File pointer to the already-opened PE32 file
+ MachineType Location to stuff the machine type of the PE32 file. This is needed
+ because the image may be Itanium-based, IA32, or EBC.
+
+Returns:
+
+ 0 success
+ non-zero otherwise
+
+--*/
+{
+ EFI_IMAGE_DOS_HEADER DosHeader;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION PeHdr;
+
+ //
+ // Position to the start of the file
+ //
+ fseek (Fptr, 0, SEEK_SET);
+
+ //
+ // Read the DOS header
+ //
+ if (fread (&DosHeader, sizeof (DosHeader), 1, Fptr) != 1) {
+ Error (NULL, 0, 0004, "Failed to read the DOS stub from the input file!", NULL);
+ return STATUS_ERROR;
+ }
+ //
+ // Check the magic number (0x5A4D)
+ //
+ if (DosHeader.e_magic != EFI_IMAGE_DOS_SIGNATURE) {
+ Error (NULL, 0, 2000, "Invalid parameter", "Input file does not appear to be a PE32 image (magic number)!");
+ return STATUS_ERROR;
+ }
+ //
+ // Position into the file and check the PE signature
+ //
+ fseek (Fptr, (long) DosHeader.e_lfanew, SEEK_SET);
+
+ //
+ // Read PE headers
+ //
+ if (fread (&PeHdr, sizeof (PeHdr), 1, Fptr) != 1) {
+ Error (NULL, 0, 0004, "Failed to read PE/COFF headers from input file!", NULL);
+ return STATUS_ERROR;
+ }
+
+
+ //
+ // Check the PE signature in the header "PE\0\0"
+ //
+ if (PeHdr.Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
+ Error (NULL, 0, 2000, "Invalid parameter", "Input file does not appear to be a PE32 image (signature)!");
+ return STATUS_ERROR;
+ }
+
+ memcpy ((char *) MachineType, &PeHdr.Pe32.FileHeader.Machine, 2);
+
+ if (PeHdr.Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ *SubSystem = PeHdr.Pe32.OptionalHeader.Subsystem;
+ } else if (PeHdr.Pe32Plus.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
+ *SubSystem = PeHdr.Pe32Plus.OptionalHeader.Subsystem;
+ } else {
+ Error (NULL, 0, 2000, "Invalid parameter", "Unable to find subsystem type!");
+ return STATUS_ERROR;
+ }
+
+ if (mOptions.Verbose) {
+ VerboseMsg(" Got subsystem = 0x%X from image\n", *SubSystem);
+ }
+
+ //
+ // File was successfully identified as a PE32
+ //
+ return STATUS_SUCCESS;
+}
+
+static
+int
+ParseCommandLine (
+ int Argc,
+ char *Argv[],
+ OPTIONS *Options
+ )
+/*++
+
+Routine Description:
+
+ Given the Argc/Argv program arguments, and a pointer to an options structure,
+ parse the command-line options and check their validity.
+
+
+Arguments:
+
+ Argc - standard C main() argument count
+ Argv[] - standard C main() argument list
+ Options - pointer to a structure to store the options in
+
+Returns:
+
+ STATUS_SUCCESS success
+ non-zero otherwise
+
+--*/
+{
+ FILE_LIST *FileList;
+ FILE_LIST *PrevFileList;
+ UINT32 FileFlags;
+ UINT32 ClassCode;
+ UINT32 CodeRevision;
+ EFI_STATUS Status;
+ INTN ReturnStatus;
+ BOOLEAN EfiRomFlag;
+ UINT64 TempValue;
+ char *OptionName;
+ UINT16 *DevIdList;
+
+ ReturnStatus = 0;
+ FileFlags = 0;
+ EfiRomFlag = FALSE;
+
+ //
+ // Clear out the options
+ //
+ memset ((char *) Options, 0, sizeof (OPTIONS));
+
+ //
+ // To avoid compile warnings
+ //
+ FileList = PrevFileList = NULL;
+
+ Options->DevIdList = NULL;
+ Options->DevIdCount = 0;
+
+ ClassCode = 0;
+ CodeRevision = 0;
+ //
+ // Skip over the program name
+ //
+ Argc--;
+ Argv++;
+
+ //
+ // If no arguments, assume they want usage info
+ //
+ if (Argc == 0) {
+ Usage ();
+ return STATUS_ERROR;
+ }
+
+ if ((stricmp(Argv[0], "-h") == 0) || (stricmp(Argv[0], "--help") == 0)) {
+ Usage();
+ return STATUS_ERROR;
+ }
+
+ if ((stricmp(Argv[0], "--version") == 0)) {
+ Version();
+ return STATUS_ERROR;
+ }
+
+ //
+ // Process until no more arguments
+ //
+ while (Argc > 0) {
+ if (Argv[0][0] == '-') {
+ //
+ // Vendor ID specified with -f
+ //
+ if (stricmp (Argv[0], "-f") == 0) {
+ //
+ // Make sure there's another parameter
+ //
+ Status = AsciiStringToUint64(Argv[1], FALSE, &TempValue);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 2000, "Invalid option value", "%s = %s", Argv[0], Argv[1]);
+ ReturnStatus = 1;
+ goto Done;
+ }
+ if (TempValue >= 0x10000) {
+ Error (NULL, 0, 2000, "Invalid option value", "Vendor Id %s out of range!", Argv[1]);
+ ReturnStatus = 1;
+ goto Done;
+ }
+ Options->VendId = (UINT16) TempValue;
+ Options->VendIdValid = 1;
+
+ Argv++;
+ Argc--;
+ } else if (stricmp (Argv[0], "-i") == 0) {
+
+ OptionName = Argv[0];
+
+ //
+ // Device IDs specified with -i
+ // Make sure there's at least one more parameter
+ //
+ if (Argc < 1) {
+ Error (NULL, 0, 2000, "Invalid parameter", "Missing Device Id with %s option!", OptionName);
+ ReturnStatus = 1;
+ goto Done;
+ }
+
+ //
+ // Process until another dash-argument parameter or the end of the list
+ //
+ while (Argc > 1 && Argv[1][0] != '-') {
+ Status = AsciiStringToUint64(Argv[1], FALSE, &TempValue);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 2000, "Invalid option value", "%s = %s", OptionName, Argv[1]);
+ ReturnStatus = 1;
+ goto Done;
+ }
+ //
+ // Don't allow device IDs greater than 16 bits
+ // Don't allow 0, since it is used as a list terminator
+ //
+ if (TempValue >= 0x10000 || TempValue == 0) {
+ Error (NULL, 0, 2000, "Invalid option value", "Device Id %s out of range!", Argv[1]);
+ ReturnStatus = 1;
+ goto Done;
+ }
+
+ DevIdList = (UINT16*) realloc (Options->DevIdList, (Options->DevIdCount + 1) * sizeof (UINT16));
+ if (DevIdList == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!", NULL);
+ ReturnStatus = 1;
+ goto Done;
+ }
+ Options->DevIdList = DevIdList;
+
+ Options->DevIdList[Options->DevIdCount++] = (UINT16) TempValue;
+
+ Argv++;
+ Argc--;
+ }
+
+ } else if ((stricmp (Argv[0], "-o") == 0) || (stricmp (Argv[0], "--output") == 0)) {
+ //
+ // Output filename specified with -o
+ // Make sure there's another parameter
+ //
+ if (Argv[1] == NULL || Argv[1][0] == '-') {
+ Error (NULL, 0, 2000, "Invalid parameter", "Missing output file name with %s option!", Argv[0]);
+ ReturnStatus = STATUS_ERROR;
+ goto Done;
+ }
+ if (strlen (Argv[1]) > MAX_PATH - 1) {
+ Error (NULL, 0, 2000, "Invalid parameter", "Output file name %s is too long!", Argv[1]);
+ ReturnStatus = STATUS_ERROR;
+ goto Done;
+ }
+ strncpy (Options->OutFileName, Argv[1], MAX_PATH - 1);
+ Options->OutFileName[MAX_PATH - 1] = 0;
+
+ Argv++;
+ Argc--;
+ } else if ((stricmp (Argv[0], "-h") == 0) || (stricmp (Argv[0], "--help") == 0)) {
+ //
+ // Help option
+ //
+ Usage ();
+ ReturnStatus = STATUS_ERROR;
+ goto Done;
+ } else if (stricmp (Argv[0], "-b") == 0) {
+ //
+ // Specify binary files with -b
+ //
+ FileFlags = FILE_FLAG_BINARY;
+ } else if ((stricmp (Argv[0], "-e") == 0) || (stricmp (Argv[0], "-ec") == 0)) {
+ //
+ // Specify EFI files with -e. Specify EFI-compressed with -c.
+ //
+ FileFlags = FILE_FLAG_EFI;
+ if ((Argv[0][2] == 'c') || (Argv[0][2] == 'C')) {
+ FileFlags |= FILE_FLAG_COMPRESS;
+ }
+ //
+ // Specify not to set the LAST bit in the last file with -n
+ //
+ } else if (stricmp (Argv[0], "-n") == 0) {
+ Options->NoLast = 1;
+ } else if (((stricmp (Argv[0], "-v") == 0)) || ((stricmp (Argv[0], "--verbose") == 0))) {
+ //
+ // -v for verbose
+ //
+ Options->Verbose = 1;
+ } else if (stricmp (Argv[0], "--debug") == 0) {
+ Status = AsciiStringToUint64(Argv[1], FALSE, &DebugLevel);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 2000, "Invalid option value", "%s = %s", Argv[0], Argv[1]);
+ ReturnStatus = 1;
+ goto Done;
+ }
+ if (DebugLevel > 9) {
+ Error (NULL, 0, 2000, "Invalid option value", "Debug Level range is 0-9, current input level is %d", Argv[1]);
+ ReturnStatus = 1;
+ goto Done;
+ }
+ if (DebugLevel>=5 && DebugLevel<=9) {
+ Options->Debug = TRUE;
+ } else {
+ Options->Debug = FALSE;
+ }
+ Argv++;
+ Argc--;
+ } else if ((stricmp (Argv[0], "--quiet") == 0) || (stricmp (Argv[0], "-q") == 0)) {
+ Options->Quiet = TRUE;
+ } else if ((stricmp (Argv[0], "--dump") == 0) || (stricmp (Argv[0], "-d") == 0)) {
+ //
+ // -dump for dumping a ROM image. In this case, say that the device id
+ // and vendor id are valid so we don't have to specify bogus ones on the
+ // command line.
+ //
+ Options->DumpOption = 1;
+
+ Options->VendIdValid = 1;
+ Options->DevIdCount = 1;
+ FileFlags = FILE_FLAG_BINARY;
+ } else if ((stricmp (Argv[0], "-l") == 0) || (stricmp (Argv[0], "--class-code") == 0)) {
+ //
+ // Class code value for the next file in the list.
+ // Make sure there's another parameter
+ //
+ Status = AsciiStringToUint64(Argv[1], FALSE, &TempValue);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 2000, "Invalid option value", "%s = %s", Argv[0], Argv[1]);
+ ReturnStatus = 1;
+ goto Done;
+ }
+ ClassCode = (UINT32) TempValue;
+ if (ClassCode & 0xFF000000) {
+ Error (NULL, 0, 2000, "Invalid parameter", "Class code %s out of range!", Argv[1]);
+ ReturnStatus = STATUS_ERROR;
+ goto Done;
+ }
+ if (FileList != NULL && FileList->ClassCode == 0) {
+ FileList->ClassCode = ClassCode;
+ }
+ Argv++;
+ Argc--;
+ } else if ((stricmp (Argv[0], "-r") == 0) || (stricmp (Argv[0], "--Revision") == 0)) {
+ //
+ // Code revision in the PCI data structure. The value is for the next
+ // file in the list.
+ // Make sure there's another parameter
+ //
+ Status = AsciiStringToUint64(Argv[1], FALSE, &TempValue);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 2000, "Invalid option value", "%s = %s", Argv[0], Argv[1]);
+ ReturnStatus = 1;
+ goto Done;
+ }
+ CodeRevision = (UINT32) TempValue;
+ if (CodeRevision & 0xFFFF0000) {
+ Error (NULL, 0, 2000, "Invalid parameter", "Code revision %s out of range!", Argv[1]);
+ ReturnStatus = STATUS_ERROR;
+ goto Done;
+ }
+ if (FileList != NULL && FileList->CodeRevision == 0) {
+ FileList->CodeRevision = (UINT16) CodeRevision;
+ }
+ Argv++;
+ Argc--;
+ } else if ((stricmp (Argv[0], "-p") == 0) || (stricmp (Argv[0], "--pci23") == 0)) {
+ //
+ // Default layout meets PCI 3.0 specifications, specifying this flag will for a PCI 2.3 layout.
+ //
+ mOptions.Pci23 = 1;
+ } else {
+ Error (NULL, 0, 2000, "Invalid parameter", "Invalid option specified: %s", Argv[0]);
+ ReturnStatus = STATUS_ERROR;
+ goto Done;
+ }
+ } else {
+ //
+ // Not a slash-option argument. Must be a file name. Make sure they've specified
+ // -e or -b already.
+ //
+ if ((FileFlags & (FILE_FLAG_BINARY | FILE_FLAG_EFI)) == 0) {
+ Error (NULL, 0, 2000, "Invalid parameter", "Missing -e or -b with input file %s!", Argv[0]);
+ ReturnStatus = STATUS_ERROR;
+ goto Done;
+ }
+ //
+ // Check Efi Option RomImage
+ //
+ if ((FileFlags & FILE_FLAG_EFI) == FILE_FLAG_EFI) {
+ EfiRomFlag = TRUE;
+ }
+ //
+ // Create a new file structure
+ //
+ FileList = (FILE_LIST *) malloc (sizeof (FILE_LIST));
+ if (FileList == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!", NULL);
+ ReturnStatus = STATUS_ERROR;
+ goto Done;
+ }
+
+ //
+ // set flag and class code for this image.
+ //
+ memset ((char *) FileList, 0, sizeof (FILE_LIST));
+ FileList->FileName = Argv[0];
+ FileList->FileFlags = FileFlags;
+ FileList->ClassCode = ClassCode;
+ FileList->CodeRevision = (UINT16) CodeRevision;
+ ClassCode = 0;
+ CodeRevision = 0;
+
+ if (Options->FileList == NULL) {
+ Options->FileList = FileList;
+ } else {
+ if (PrevFileList == NULL) {
+ PrevFileList = FileList;
+ } else {
+ PrevFileList->Next = FileList;
+ }
+ }
+
+ PrevFileList = FileList;
+ }
+ //
+ // Next argument
+ //
+ Argv++;
+ Argc--;
+ }
+
+ //
+ // Must have specified some files
+ //
+ if (Options->FileList == NULL) {
+ Error (NULL, 0, 2000, "Invalid parameter", "Missing input file name!");
+ //
+ // No memory allocation, return directly.
+ //
+ return STATUS_ERROR;
+ }
+
+ //
+ // For EFI OptionRom image, Make sure a device ID and vendor ID are both specified.
+ //
+ if (EfiRomFlag) {
+ if (!Options->VendIdValid) {
+ Error (NULL, 0, 2000, "Missing Vendor ID in command line", NULL);
+ ReturnStatus = STATUS_ERROR;
+ goto Done;
+ }
+
+ if (!Options->DevIdCount) {
+ Error (NULL, 0, 2000, "Missing Device ID in command line", NULL);
+ ReturnStatus = STATUS_ERROR;
+ goto Done;
+ }
+ }
+
+ if (Options->DevIdCount > 1 && Options->Pci23) {
+ Error (NULL, 0, 2000, "Invalid parameter", "PCI 3.0 is required when specifying multiple Device IDs");
+ ReturnStatus = STATUS_ERROR;
+ goto Done;
+ }
+
+Done:
+ if (ReturnStatus != 0) {
+ while (Options->FileList != NULL) {
+ FileList = Options->FileList->Next;
+ free (Options->FileList);
+ Options->FileList = FileList;
+ }
+ }
+
+ return ReturnStatus;
+}
+
+static
+void
+Version (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Print version information for this utility.
+
+Arguments:
+
+ None.
+
+Returns:
+
+ Nothing.
+--*/
+{
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
+}
+
+static
+void
+Usage (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Print usage information for this utility.
+
+Arguments:
+
+ None.
+
+Returns:
+
+ Nothing.
+
+--*/
+{
+ //
+ // Summary usage
+ //
+ fprintf (stdout, "Usage: %s -f VendorId -i DeviceId [options] [file name<s>] \n\n", UTILITY_NAME);
+
+ //
+ // Copyright declaration
+ //
+ fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
+
+ //
+ // Details Option
+ //
+ fprintf (stdout, "Options:\n");
+ fprintf (stdout, " -o FileName, --output FileName\n\
+ File will be created to store the output content.\n");
+ fprintf (stdout, " -e EfiFileName\n\
+ EFI PE32 image files.\n");
+ fprintf (stdout, " -ec EfiFileName\n\
+ EFI PE32 image files and will be compressed.\n");
+ fprintf (stdout, " -b BinFileName\n\
+ Legacy binary files.\n");
+ fprintf (stdout, " -l ClassCode\n\
+ Hex ClassCode in the PCI data structure header.\n");
+ fprintf (stdout, " -r Rev Hex Revision in the PCI data structure header.\n");
+ fprintf (stdout, " -n Not to automatically set the LAST bit in the last file.\n");
+ fprintf (stdout, " -f VendorId\n\
+ Hex PCI Vendor ID for the device OpROM, must be specified\n");
+ fprintf (stdout, " -i DeviceId\n\
+ One or more hex PCI Device IDs for the device OpROM, must be specified\n");
+ fprintf (stdout, " -p, --pci23\n\
+ Default layout meets PCI 3.0 specifications\n\
+ specifying this flag will for a PCI 2.3 layout.\n");
+ fprintf (stdout, " -d, --dump\n\
+ Dump the headers of an existing option ROM image.\n");
+ fprintf (stdout, " -v, --verbose\n\
+ Turn on verbose output with informational messages.\n");
+ fprintf (stdout, " --version Show program's version number and exit.\n");
+ fprintf (stdout, " -h, --help\n\
+ Show this help message and exit.\n");
+ fprintf (stdout, " -q, --quiet\n\
+ Disable all messages except FATAL ERRORS.\n");
+ fprintf (stdout, " --debug [#,0-9]\n\
+ Enable debug messages at level #.\n");
+}
+
+static
+void
+DumpImage (
+ FILE_LIST *InFile
+ )
+/*++
+
+Routine Description:
+
+ Dump the headers of an existing option ROM image
+
+Arguments:
+
+ InFile - the file name of an existing option ROM image
+
+Returns:
+
+ none
+
+--*/
+{
+ PCI_EXPANSION_ROM_HEADER PciRomHdr;
+ FILE *InFptr;
+ UINT32 ImageStart;
+ UINT32 ImageCount;
+ EFI_PCI_EXPANSION_ROM_HEADER EfiRomHdr;
+ PCI_DATA_STRUCTURE PciDs23;
+ PCI_3_0_DATA_STRUCTURE PciDs30;
+ UINT16 DevId;
+
+ //
+ // Open the input file
+ //
+ if ((InFptr = fopen (LongFilePath (InFile->FileName), "rb")) == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", InFile->FileName);
+ return ;
+ }
+ //
+ // Go through the image and dump the header stuff for each
+ //
+ ImageCount = 0;
+ for (;;) {
+ //
+ // Save our position in the file, since offsets in the headers
+ // are relative to the particular image.
+ //
+ ImageStart = ftell (InFptr);
+ ImageCount++;
+
+ //
+ // Read the option ROM header. Have to assume a raw binary image for now.
+ //
+ if (fread (&PciRomHdr, sizeof (PciRomHdr), 1, InFptr) != 1) {
+ Error (NULL, 0, 3001, "Not supported", "Failed to read PCI ROM header from file!");
+ goto BailOut;
+ }
+
+ //
+ // Dump the contents of the header
+ //
+ fprintf (stdout, "Image %u -- Offset 0x%X\n", (unsigned) ImageCount, (unsigned) ImageStart);
+ fprintf (stdout, " ROM header contents\n");
+ fprintf (stdout, " Signature 0x%04X\n", PciRomHdr.Signature);
+ fprintf (stdout, " PCIR offset 0x%04X\n", PciRomHdr.PcirOffset);
+ //
+ // Find PCI data structure
+ //
+ if (fseek (InFptr, ImageStart + PciRomHdr.PcirOffset, SEEK_SET)) {
+ Error (NULL, 0, 3001, "Not supported", "Failed to seek to PCI data structure!");
+ goto BailOut;
+ }
+ //
+ // Read and dump the PCI data structure
+ //
+ memset (&PciDs23, 0, sizeof (PciDs23));
+ memset (&PciDs30, 0, sizeof (PciDs30));
+ if (mOptions.Pci23 == 1) {
+ if (fread (&PciDs23, sizeof (PciDs23), 1, InFptr) != 1) {
+ Error (NULL, 0, 3001, "Not supported", "Failed to read PCI data structure from file %s!", InFile->FileName);
+ goto BailOut;
+ }
+ } else {
+ if (fread (&PciDs30, sizeof (PciDs30), 1, InFptr) != 1) {
+ Error (NULL, 0, 3001, "Not supported", "Failed to read PCI data structure from file %s!", InFile->FileName);
+ goto BailOut;
+ }
+ }
+ if (mOptions.Verbose) {
+ VerboseMsg("Read PCI data structure from file %s", InFile->FileName);
+ }
+
+ //fprintf (stdout, " PCI Data Structure\n");
+ if (mOptions.Pci23 == 1) {
+ fprintf (
+ stdout,
+ " Signature %c%c%c%c\n",
+ (char) PciDs23.Signature,
+ (char) (PciDs23.Signature >> 8),
+ (char) (PciDs23.Signature >> 16),
+ (char) (PciDs23.Signature >> 24)
+ );
+ fprintf (stdout, " Vendor ID 0x%04X\n", PciDs23.VendorId);
+ fprintf (stdout, " Device ID 0x%04X\n", PciDs23.DeviceId);
+ fprintf (stdout, " Length 0x%04X\n", PciDs23.Length);
+ fprintf (stdout, " Revision 0x%04X\n", PciDs23.Revision);
+ fprintf (
+ stdout,
+ " Class Code 0x%06X\n",
+ (unsigned) (PciDs23.ClassCode[0] | (PciDs23.ClassCode[1] << 8) | (PciDs23.ClassCode[2] << 16))
+ );
+ fprintf (stdout, " Image size 0x%X\n", (unsigned) PciDs23.ImageLength * 512);
+ fprintf (stdout, " Code revision: 0x%04X\n", PciDs23.CodeRevision);
+ fprintf (stdout, " Indicator 0x%02X", PciDs23.Indicator);
+ } else {
+ fprintf (
+ stdout,
+ " Signature %c%c%c%c\n",
+ (char) PciDs30.Signature,
+ (char) (PciDs30.Signature >> 8),
+ (char) (PciDs30.Signature >> 16),
+ (char) (PciDs30.Signature >> 24)
+ );
+ fprintf (stdout, " Vendor ID 0x%04X\n", PciDs30.VendorId);
+ fprintf (stdout, " Device ID 0x%04X\n", PciDs30.DeviceId);
+ fprintf (stdout, " Length 0x%04X\n", PciDs30.Length);
+ fprintf (stdout, " Revision 0x%04X\n", PciDs30.Revision);
+ fprintf (stdout, " DeviceListOffset 0x%02X\n", PciDs30.DeviceListOffset);
+ if (PciDs30.DeviceListOffset) {
+ //
+ // Print device ID list
+ //
+ fprintf (stdout, " Device list contents\n");
+ if (fseek (InFptr, ImageStart + PciRomHdr.PcirOffset + PciDs30.DeviceListOffset, SEEK_SET)) {
+ Error (NULL, 0, 3001, "Not supported", "Failed to seek to PCI device ID list!");
+ goto BailOut;
+ }
+
+ //
+ // Loop until terminating 0
+ //
+ do {
+ if (fread (&DevId, sizeof (DevId), 1, InFptr) != 1) {
+ Error (NULL, 0, 3001, "Not supported", "Failed to read PCI device ID list from file %s!", InFile->FileName);
+ goto BailOut;
+ }
+ if (DevId) {
+ fprintf (stdout, " 0x%04X\n", DevId);
+ }
+ } while (DevId);
+
+ }
+ fprintf (
+ stdout,
+ " Class Code 0x%06X\n",
+ (unsigned) (PciDs30.ClassCode[0] | (PciDs30.ClassCode[1] << 8) | (PciDs30.ClassCode[2] << 16))
+ );
+ fprintf (stdout, " Image size 0x%X\n", (unsigned) PciDs30.ImageLength * 512);
+ fprintf (stdout, " Code revision: 0x%04X\n", PciDs30.CodeRevision);
+ fprintf (stdout, " MaxRuntimeImageLength 0x%02X\n", PciDs30.MaxRuntimeImageLength);
+ fprintf (stdout, " ConfigUtilityCodeHeaderOffset 0x%02X\n", PciDs30.ConfigUtilityCodeHeaderOffset);
+ fprintf (stdout, " DMTFCLPEntryPointOffset 0x%02X\n", PciDs30.DMTFCLPEntryPointOffset);
+ fprintf (stdout, " Indicator 0x%02X", PciDs30.Indicator);
+ }
+ //
+ // Print the indicator, used to flag the last image
+ //
+ if (PciDs23.Indicator == INDICATOR_LAST || PciDs30.Indicator == INDICATOR_LAST) {
+ fprintf (stdout, " (last image)\n");
+ } else {
+ fprintf (stdout, "\n");
+ }
+ //
+ // Print the code type. If EFI code, then we can provide more info.
+ //
+ if (mOptions.Pci23 == 1) {
+ fprintf (stdout, " Code type 0x%02X", PciDs23.CodeType);
+ } else {
+ fprintf (stdout, " Code type 0x%02X", PciDs30.CodeType);
+ }
+ if (PciDs23.CodeType == PCI_CODE_TYPE_EFI_IMAGE || PciDs30.CodeType == PCI_CODE_TYPE_EFI_IMAGE) {
+ fprintf (stdout, " (EFI image)\n");
+ //
+ // Re-read the header as an EFI ROM header, then dump more info
+ //
+ fprintf (stdout, " EFI ROM header contents\n");
+ if (fseek (InFptr, ImageStart, SEEK_SET)) {
+ Error (NULL, 0, 5001, "Failed to re-seek to ROM header structure!", NULL);
+ goto BailOut;
+ }
+
+ if (fread (&EfiRomHdr, sizeof (EfiRomHdr), 1, InFptr) != 1) {
+ Error (NULL, 0, 5001, "Failed to read EFI PCI ROM header from file!", NULL);
+ goto BailOut;
+ }
+ //
+ // Now dump more info
+ //
+ fprintf (stdout, " EFI Signature 0x%04X\n", (unsigned) EfiRomHdr.EfiSignature);
+ fprintf (
+ stdout,
+ " Compression Type 0x%04X ",
+ EfiRomHdr.CompressionType
+ );
+ if (EfiRomHdr.CompressionType == EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
+ fprintf (stdout, "(compressed)\n");
+ } else {
+ fprintf (stdout, "(not compressed)\n");
+ }
+
+ fprintf (
+ stdout,
+ " Machine type 0x%04X (%s)\n",
+ EfiRomHdr.EfiMachineType,
+ GetMachineTypeStr (EfiRomHdr.EfiMachineType)
+ );
+ fprintf (
+ stdout,
+ " Subsystem 0x%04X (%s)\n",
+ EfiRomHdr.EfiSubsystem,
+ GetSubsystemTypeStr (EfiRomHdr.EfiSubsystem)
+ );
+ fprintf (
+ stdout,
+ " EFI image offset 0x%04X (@0x%X)\n",
+ EfiRomHdr.EfiImageHeaderOffset,
+ EfiRomHdr.EfiImageHeaderOffset + (unsigned) ImageStart
+ );
+
+ } else {
+ //
+ // Not an EFI image
+ //
+ fprintf (stdout, "\n");
+ }
+ //
+ // If code type is EFI image, then dump it as well?
+ //
+ // if (PciDs.CodeType == PCI_CODE_TYPE_EFI_IMAGE) {
+ // }
+ //
+ // If last image, then we're done
+ //
+ if (PciDs23.Indicator == INDICATOR_LAST || PciDs30.Indicator == INDICATOR_LAST) {
+ goto BailOut;
+ }
+ //
+ // Seek to the start of the next image
+ //
+ if (mOptions.Pci23 == 1) {
+ if (fseek (InFptr, ImageStart + (PciDs23.ImageLength * 512), SEEK_SET)) {
+ Error (NULL, 0, 3001, "Not supported", "Failed to seek to next image!");
+ goto BailOut;
+ }
+ } else {
+ if (fseek (InFptr, ImageStart + (PciDs30.ImageLength * 512), SEEK_SET)) {
+ Error (NULL, 0, 3001, "Not supported", "Failed to seek to next image!");
+ goto BailOut;
+ }
+ }
+ }
+
+BailOut:
+ fclose (InFptr);
+}
+
+char *
+GetMachineTypeStr (
+ UINT16 MachineType
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+ MachineType - GC_TODO: add argument description
+
+Returns:
+
+ GC_TODO: add return values
+
+--*/
+{
+ int Index;
+
+ for (Index = 0; mMachineTypes[Index].Name != NULL; Index++) {
+ if (mMachineTypes[Index].Value == MachineType) {
+ return mMachineTypes[Index].Name;
+ }
+ }
+
+ return "unknown";
+}
+
+static
+char *
+GetSubsystemTypeStr (
+ UINT16 SubsystemType
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+ SubsystemType - GC_TODO: add argument description
+
+Returns:
+
+ GC_TODO: add return values
+
+--*/
+{
+ int Index;
+
+ for (Index = 0; mSubsystemTypes[Index].Name != NULL; Index++) {
+ if (mSubsystemTypes[Index].Value == SubsystemType) {
+ return mSubsystemTypes[Index].Name;
+ }
+ }
+
+ return "unknown";
+}
diff --git a/roms/edk2/BaseTools/Source/C/EfiRom/EfiRom.h b/roms/edk2/BaseTools/Source/C/EfiRom/EfiRom.h
new file mode 100644
index 000000000..0b39e2af2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/EfiRom/EfiRom.h
@@ -0,0 +1,353 @@
+/** @file
+This file contains the relevant declarations required to generate Option Rom File
+
+Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __EFI_ROM_H__
+#define __EFI_ROM_H__
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <Common/UefiBaseTypes.h>
+#include <IndustryStandard/PeImage.h> // for PE32 structure definitions
+
+#include <IndustryStandard/pci22.h> // for option ROM header structures
+#include <IndustryStandard/pci30.h>
+
+#include "Compress.h"
+#include "CommonLib.h"
+
+//
+// Version of this utility
+//
+#define UTILITY_NAME "EfiRom"
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 1
+
+//
+// Define the max length of a filename
+//
+#define MAX_PATH 200
+
+//
+// Define the default file extension name
+//
+#define DEFAULT_OUTPUT_EXTENSION ".rom"
+
+//
+// Max size for an option ROM image
+//
+#define MAX_OPTION_ROM_SIZE (1024 * 1024 * 16) // 16MB
+
+//
+// Values for the indicator field in the PCI data structure
+//
+#define INDICATOR_LAST 0x80 // last file in series of files
+
+//
+// Masks for the FILE_LIST.FileFlags field
+//
+#define FILE_FLAG_BINARY 0x01
+#define FILE_FLAG_EFI 0x02
+#define FILE_FLAG_COMPRESS 0x04
+
+//
+// Use this linked list structure to keep track of all the filenames
+// specified on the command line.
+//
+typedef struct _FILE_LIST {
+ struct _FILE_LIST *Next;
+ CHAR8 *FileName;
+ UINT32 FileFlags;
+ UINT32 ClassCode;
+ UINT16 CodeRevision;
+} FILE_LIST;
+
+//
+// Use this to track our command-line options
+//
+typedef struct {
+ CHAR8 OutFileName[MAX_PATH];
+ INT8 NoLast;
+ UINT16 ClassCode;
+ UINT16 PciRevision;
+ UINT16 VendId;
+ UINT16 *DevIdList;
+ UINT32 DevIdCount;
+ UINT8 VendIdValid;
+ INT8 Verbose;
+ INT8 Quiet;
+ INT8 Debug;
+ INT8 Pci23;
+ INT8 Pci30;
+ INT8 DumpOption;
+// INT8 Help;
+// INT8 Version;
+ FILE_LIST *FileList;
+} OPTIONS;
+
+//
+// Make a global structure to keep track of command-line options
+//
+static OPTIONS mOptions;
+
+//
+// Use these to convert from machine type value to a named type
+//
+typedef struct {
+ UINT16 Value;
+ CHAR8 *Name;
+} STRING_LOOKUP;
+
+//
+// Machine Types
+//
+static STRING_LOOKUP mMachineTypes[] = {
+ { EFI_IMAGE_MACHINE_IA32, "IA32" },
+ { EFI_IMAGE_MACHINE_X64, "X64" },
+ { EFI_IMAGE_MACHINE_EBC, "EBC" },
+ { EFI_IMAGE_MACHINE_ARMT, "ARM" },
+ { EFI_IMAGE_MACHINE_AARCH64, "AA64" },
+ { 0, NULL }
+};
+
+//
+// Subsystem Types
+//
+static STRING_LOOKUP mSubsystemTypes[] = {
+ { EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION, "EFI application" },
+ { EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER, "EFI boot service driver" },
+ { EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER, "EFI runtime driver" },
+ { 0, NULL }
+};
+
+//
+// Function prototypes
+//
+static
+void
+Version (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Displays the utility version to STDOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+;
+
+static
+void
+Usage (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Displays the utility usage syntax to STDOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+;
+
+static
+int
+ParseCommandLine (
+ int Argc,
+ char *Argv[],
+ OPTIONS *Options
+ )
+/*++
+
+Routine Description:
+
+ Given the Argc/Argv program arguments, and a pointer to an options structure,
+ parse the command-line options and check their validity.
+
+Arguments:
+
+ Argc - standard C main() argument count
+ Argv[] - standard C main() argument list
+ Options - pointer to a structure to store the options in
+
+Returns:
+
+ STATUS_SUCCESS success
+ non-zero otherwise
+
+--*/
+;
+
+static
+int
+CheckPE32File (
+ FILE *Fptr,
+ UINT16 *MachineType,
+ UINT16 *SubSystem
+ )
+/*++
+
+Routine Description:
+
+ Given the Argc/Argv program arguments, and a pointer to an options structure,
+ parse the command-line options and check their validity.
+
+Arguments:
+
+ Argc - standard C main() argument count
+ Argv[] - standard C main() argument list
+ Options - pointer to a structure to store the options in
+
+Returns:
+
+ STATUS_SUCCESS success
+ non-zero otherwise
+
+--*/
+;
+
+static
+int
+ProcessEfiFile (
+ FILE *OutFptr,
+ FILE_LIST *InFile,
+ UINT16 VendId,
+ UINT16 DevId,
+ UINT32 *Size
+ )
+/*++
+
+Routine Description:
+
+ Process a PE32 EFI file.
+
+Arguments:
+
+ OutFptr - file pointer to output binary ROM image file we're creating
+ InFile - structure contains information on the PE32 file to process
+ VendId - vendor ID as required in the option ROM header
+ DevId - device ID as required in the option ROM header
+ Size - pointer to where to return the size added to the output file
+
+Returns:
+
+ 0 - successful
+
+--*/
+;
+
+static
+int
+ProcessBinFile (
+ FILE *OutFptr,
+ FILE_LIST *InFile,
+ UINT32 *Size
+ )
+/*++
+
+Routine Description:
+
+ Process a binary input file.
+
+Arguments:
+
+ OutFptr - file pointer to output binary ROM image file we're creating
+ InFile - structure contains information on the binary file to process
+ Size - pointer to where to return the size added to the output file
+
+Returns:
+
+ 0 - successful
+
+--*/
+;
+
+static
+void
+DumpImage (
+ FILE_LIST *InFile
+ )
+/*++
+
+Routine Description:
+
+ Dump the headers of an existing option ROM image
+
+Arguments:
+
+ InFile - the file name of an existing option ROM image
+
+Returns:
+
+ none
+
+--*/
+;
+
+char *
+GetMachineTypeStr (
+ UINT16 MachineType
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+ MachineType - GC_TODO: add argument description
+
+Returns:
+
+ GC_TODO: add return values
+
+--*/
+;
+
+static
+char *
+GetSubsystemTypeStr (
+ UINT16 SubsystemType
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+ SubsystemType - GC_TODO: add argument description
+
+Returns:
+
+ GC_TODO: add return values
+
+--*/
+;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/EfiRom/GNUmakefile b/roms/edk2/BaseTools/Source/C/EfiRom/GNUmakefile
new file mode 100644
index 000000000..7220b2ae4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/EfiRom/GNUmakefile
@@ -0,0 +1,15 @@
+## @file
+# GNU/Linux makefile for 'EfiRom' module build.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+MAKEROOT ?= ..
+
+APPNAME = EfiRom
+
+LIBS = -lCommon
+
+OBJECTS = EfiRom.o
+
+include $(MAKEROOT)/Makefiles/app.makefile
diff --git a/roms/edk2/BaseTools/Source/C/EfiRom/Makefile b/roms/edk2/BaseTools/Source/C/EfiRom/Makefile
new file mode 100644
index 000000000..8e4ecab79
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/EfiRom/Makefile
@@ -0,0 +1,16 @@
+## @file
+# Windows makefile for 'EfiRom' module build.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+APPNAME = EfiRom
+
+LIBS = $(LIB_PATH)\Common.lib
+
+OBJECTS = EfiRom.obj
+
+!INCLUDE ..\Makefiles\ms.app
+
diff --git a/roms/edk2/BaseTools/Source/C/GNUmakefile b/roms/edk2/BaseTools/Source/C/GNUmakefile
new file mode 100644
index 000000000..df4eb64ea
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GNUmakefile
@@ -0,0 +1,91 @@
+## @file
+# GNU/Linux makefile for C tools build.
+#
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+ifndef HOST_ARCH
+ #
+ # If HOST_ARCH is not defined, then we use 'uname -m' to attempt
+ # try to figure out the appropriate HOST_ARCH.
+ #
+ uname_m = $(shell uname -m)
+ $(info Attempting to detect HOST_ARCH from 'uname -m': $(uname_m))
+ ifneq (,$(strip $(filter $(uname_m), x86_64 amd64)))
+ HOST_ARCH=X64
+ endif
+ ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)
+ HOST_ARCH=IA32
+ endif
+ ifneq (,$(findstring aarch64,$(uname_m)))
+ HOST_ARCH=AARCH64
+ else ifneq (,$(findstring arm64,$(uname_m)))
+ HOST_ARCH=AARCH64
+ else ifneq (,$(findstring arm,$(uname_m)))
+ HOST_ARCH=ARM
+ endif
+ ifndef HOST_ARCH
+ $(info Could not detected HOST_ARCH from uname results)
+ $(error HOST_ARCH is not defined!)
+ endif
+ $(info Detected HOST_ARCH of $(HOST_ARCH) using uname.)
+endif
+
+export HOST_ARCH
+
+MAKEROOT = .
+
+include Makefiles/header.makefile
+
+all: makerootdir subdirs
+ @echo Finished building BaseTools C Tools with HOST_ARCH=$(HOST_ARCH)
+
+LIBRARIES = Common
+VFRAUTOGEN = VfrCompile/VfrLexer.h
+APPLICATIONS = \
+ BrotliCompress \
+ VfrCompile \
+ EfiRom \
+ GenFfs \
+ GenFv \
+ GenFw \
+ GenSec \
+ GenCrc32 \
+ LzmaCompress \
+ Split \
+ TianoCompress \
+ VolInfo \
+ DevicePath
+
+SUBDIRS := $(LIBRARIES) $(APPLICATIONS)
+
+$(LIBRARIES): $(MAKEROOT)/libs
+$(APPLICATIONS): $(LIBRARIES) $(MAKEROOT)/bin $(VFRAUTOGEN)
+
+.PHONY: outputdirs
+makerootdir:
+ -mkdir -p $(MAKEROOT)
+
+.PHONY: subdirs $(SUBDIRS)
+subdirs: $(SUBDIRS)
+$(SUBDIRS):
+ $(MAKE) -C $@
+
+.PHONY: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
+$(patsubst %,%-clean,$(sort $(SUBDIRS))):
+ -$(MAKE) -C $(@:-clean=) clean
+
+$(VFRAUTOGEN): VfrCompile/VfrSyntax.g
+ $(MAKE) -C VfrCompile VfrLexer.h
+
+clean: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
+
+clean: localClean
+
+localClean:
+ rm -f $(MAKEROOT)/bin/*
+ -rmdir $(MAKEROOT)/libs $(MAKEROOT)/bin
+
+include Makefiles/footer.makefile
diff --git a/roms/edk2/BaseTools/Source/C/GenCrc32/GNUmakefile b/roms/edk2/BaseTools/Source/C/GenCrc32/GNUmakefile
new file mode 100644
index 000000000..fe4575d5f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenCrc32/GNUmakefile
@@ -0,0 +1,15 @@
+## @file
+# GNU/Linux makefile for 'GenCrc32' module build.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+MAKEROOT ?= ..
+
+APPNAME = GenCrc32
+
+LIBS = -lCommon
+
+OBJECTS = GenCrc32.o
+
+include $(MAKEROOT)/Makefiles/app.makefile
diff --git a/roms/edk2/BaseTools/Source/C/GenCrc32/GenCrc32.c b/roms/edk2/BaseTools/Source/C/GenCrc32/GenCrc32.c
new file mode 100644
index 000000000..8c2056e36
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenCrc32/GenCrc32.c
@@ -0,0 +1,361 @@
+/** @file
+Calculate Crc32 value and Verify Crc32 value for input data.
+
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "ParseInf.h"
+#include "EfiUtilityMsgs.h"
+#include "CommonLib.h"
+#include "Crc32.h"
+
+#define UTILITY_NAME "GenCrc32"
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 2
+
+#define CRC32_NULL 0
+#define CRC32_ENCODE 1
+#define CRC32_DECODE 2
+
+VOID
+Version (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Displays the standard utility information to SDTOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
+}
+
+VOID
+Usage (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Displays the utility usage syntax to STDOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ //
+ // Summary usage
+ //
+ fprintf (stdout, "Usage: GenCrc32 -e|-d [options] <input_file>\n\n");
+
+ //
+ // Copyright declaration
+ //
+ fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
+
+ //
+ // Details Option
+ //
+ fprintf (stdout, "optional arguments:\n");
+ fprintf (stdout, " -h, --help Show this help message and exit\n");
+ fprintf (stdout, " --version Show program's version number and exit\n");
+ fprintf (stdout, " --debug [DEBUG] Output DEBUG statements, where DEBUG_LEVEL is 0 (min)\n\
+ - 9 (max)\n");
+ fprintf (stdout, " -v, --verbose Print informational statements\n");
+ fprintf (stdout, " -q, --quiet Returns the exit code, error messages will be\n\
+ displayed\n");
+ fprintf (stdout, " -s, --silent Returns only the exit code; informational and error\n\
+ messages are not displayed\n");
+ fprintf (stdout, " -e, --encode Calculate CRC32 value for the input file\n");
+ fprintf (stdout, " -d, --decode Verify CRC32 value for the input file\n");
+ fprintf (stdout, " -o OUTPUT_FILENAME, --output OUTPUT_FILENAME\n\
+ Output file name\n");
+ fprintf (stdout, " --sfo Reserved for future use\n");
+
+}
+
+int
+main (
+ int argc,
+ CHAR8 *argv[]
+ )
+/*++
+
+Routine Description:
+
+ Main function.
+
+Arguments:
+
+ argc - Number of command line parameters.
+ argv - Array of pointers to parameter strings.
+
+Returns:
+ STATUS_SUCCESS - Utility exits successfully.
+ STATUS_ERROR - Some error occurred during execution.
+
+--*/
+{
+ EFI_STATUS Status;
+ CHAR8 *OutputFileName;
+ CHAR8 *InputFileName;
+ UINT8 *FileBuffer;
+ UINT32 FileSize;
+ UINT64 LogLevel;
+ UINT8 FileAction;
+ UINT32 Crc32Value;
+ FILE *InFile;
+ FILE *OutFile;
+
+ //
+ // Init local variables
+ //
+ LogLevel = 0;
+ Status = EFI_SUCCESS;
+ InputFileName = NULL;
+ OutputFileName = NULL;
+ FileAction = CRC32_NULL;
+ InFile = NULL;
+ OutFile = NULL;
+ Crc32Value = 0;
+ FileBuffer = NULL;
+
+ SetUtilityName (UTILITY_NAME);
+
+ if (argc == 1) {
+ Error (NULL, 0, 1001, "Missing options", "no options input");
+ Usage ();
+ return STATUS_ERROR;
+ }
+
+ //
+ // Parse command line
+ //
+ argc --;
+ argv ++;
+
+ if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
+ Usage ();
+ return STATUS_SUCCESS;
+ }
+
+ if (stricmp (argv[0], "--version") == 0) {
+ Version ();
+ return STATUS_SUCCESS;
+ }
+
+ while (argc > 0) {
+ if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--output") == 0)) {
+ if (argv[1] == NULL || argv[1][0] == '-') {
+ Error (NULL, 0, 1003, "Invalid option value", "Output File name is missing for -o option");
+ goto Finish;
+ }
+ OutputFileName = argv[1];
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-e") == 0) || (stricmp (argv[0], "--encode") == 0)) {
+ FileAction = CRC32_ENCODE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--decode") == 0)) {
+ FileAction = CRC32_DECODE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-v") == 0) || (stricmp (argv[0], "--verbose") == 0)) {
+ SetPrintLevel (VERBOSE_LOG_LEVEL);
+ VerboseMsg ("Verbose output Mode Set!");
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
+ SetPrintLevel (KEY_LOG_LEVEL);
+ KeyMsg ("Quiet output Mode Set!");
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if (stricmp (argv[0], "--debug") == 0) {
+ Status = AsciiStringToUint64 (argv[1], FALSE, &LogLevel);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ if (LogLevel > 9) {
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);
+ goto Finish;
+ }
+ SetPrintLevel (LogLevel);
+ DebugMsg (NULL, 0, 9, "Debug Mode Set", "Debug Output Mode Level %s is set!", argv[1]);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if (argv[0][0] == '-') {
+ Error (NULL, 0, 1000, "Unknown option", argv[0]);
+ goto Finish;
+ }
+
+ //
+ // Get Input file file name.
+ //
+ InputFileName = argv[0];
+ argc --;
+ argv ++;
+ }
+
+ VerboseMsg ("%s tool start.", UTILITY_NAME);
+
+ //
+ // Check Input parameters
+ //
+ if (FileAction == CRC32_NULL) {
+ Error (NULL, 0, 1001, "Missing option", "either the encode or the decode option must be specified!");
+ return STATUS_ERROR;
+ } else if (FileAction == CRC32_ENCODE) {
+ VerboseMsg ("File will be encoded by Crc32");
+ } else if (FileAction == CRC32_DECODE) {
+ VerboseMsg ("File will be decoded by Crc32");
+ }
+
+ if (InputFileName == NULL) {
+ Error (NULL, 0, 1001, "Missing option", "Input files are not specified");
+ goto Finish;
+ } else {
+ VerboseMsg ("Input file name is %s", InputFileName);
+ }
+
+ if (OutputFileName == NULL) {
+ Error (NULL, 0, 1001, "Missing option", "Output file are not specified");
+ goto Finish;
+ } else {
+ VerboseMsg ("Output file name is %s", OutputFileName);
+ }
+
+ //
+ // Open Input file and read file data.
+ //
+ InFile = fopen (LongFilePath (InputFileName), "rb");
+ if (InFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", InputFileName);
+ return STATUS_ERROR;
+ }
+
+ fseek (InFile, 0, SEEK_END);
+ FileSize = ftell (InFile);
+ fseek (InFile, 0, SEEK_SET);
+
+ FileBuffer = (UINT8 *) malloc (FileSize);
+ if (FileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ fclose (InFile);
+ goto Finish;
+ }
+
+ fread (FileBuffer, 1, FileSize, InFile);
+ fclose (InFile);
+ VerboseMsg ("the size of the input file is %u bytes", (unsigned) FileSize);
+
+ //
+ // Open output file
+ //
+ OutFile = fopen (LongFilePath (OutputFileName), "wb");
+ if (OutFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", OutputFileName);
+ goto Finish;
+ }
+
+ //
+ // Calculate Crc32 value
+ //
+ if (FileAction == CRC32_ENCODE) {
+ Status = CalculateCrc32 (FileBuffer, FileSize, &Crc32Value);
+ if (Status != EFI_SUCCESS) {
+ Error (NULL, 0, 3000, "Invalid", "Calculate CRC32 value failed!");
+ goto Finish;
+ }
+ //
+ // Done, write output file.
+ //
+ fwrite (&Crc32Value, 1, sizeof (Crc32Value), OutFile);
+ VerboseMsg ("The calculated CRC32 value is 0x%08x", (unsigned) Crc32Value);
+ fwrite (FileBuffer, 1, FileSize, OutFile);
+ VerboseMsg ("the size of the encoded file is %u bytes", (unsigned) FileSize + sizeof (UINT32));
+ } else {
+ //
+ // Verify Crc32 Value
+ //
+ if (FileSize < sizeof (UINT32)) {
+ Error (NULL, 0, 3000, "Invalid", "Input file is invalid!");
+ goto Finish;
+ }
+ Status = CalculateCrc32 (FileBuffer + sizeof (UINT32), FileSize - sizeof (UINT32), &Crc32Value);
+ if (Status != EFI_SUCCESS) {
+ Error (NULL, 0, 3000, "Invalid", "Calculate CRC32 value failed!");
+ goto Finish;
+ }
+ VerboseMsg ("The calculated CRC32 value is 0x%08x and File Crc32 value is 0x%08x", (unsigned) Crc32Value, (unsigned) (*(UINT32 *)FileBuffer));
+ if (Crc32Value != *(UINT32 *)FileBuffer) {
+ Error (NULL, 0, 3000, "Invalid", "CRC32 value of input file is not correct!");
+ Status = STATUS_ERROR;
+ goto Finish;
+ }
+ //
+ // Done, write output file.
+ //
+ fwrite (FileBuffer + sizeof (UINT32), 1, FileSize - sizeof (UINT32), OutFile);
+ VerboseMsg ("the size of the decoded file is %u bytes", (unsigned) FileSize - sizeof (UINT32));
+ }
+
+Finish:
+ if (FileBuffer != NULL) {
+ free (FileBuffer);
+ }
+
+ if (OutFile != NULL) {
+ fclose (OutFile);
+ }
+
+ VerboseMsg ("%s tool done with return code is 0x%x.", UTILITY_NAME, GetUtilityStatus ());
+
+ return GetUtilityStatus ();
+}
+
+
+
+
diff --git a/roms/edk2/BaseTools/Source/C/GenCrc32/Makefile b/roms/edk2/BaseTools/Source/C/GenCrc32/Makefile
new file mode 100644
index 000000000..6a3d46bc8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenCrc32/Makefile
@@ -0,0 +1,16 @@
+## @file
+# Windows makefile for 'GenCrc32' module build.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+APPNAME = GenCrc32
+
+LIBS = $(LIB_PATH)\Common.lib
+
+OBJECTS = GenCrc32.obj
+
+!INCLUDE ..\Makefiles\ms.app
+
diff --git a/roms/edk2/BaseTools/Source/C/GenFfs/GNUmakefile b/roms/edk2/BaseTools/Source/C/GenFfs/GNUmakefile
new file mode 100644
index 000000000..3d41a5855
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFfs/GNUmakefile
@@ -0,0 +1,16 @@
+## @file
+# GNU/Linux makefile for 'GenFfs' module build.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+MAKEROOT ?= ..
+
+APPNAME = GenFfs
+
+OBJECTS = GenFfs.o
+
+include $(MAKEROOT)/Makefiles/app.makefile
+
+LIBS = -lCommon
+
diff --git a/roms/edk2/BaseTools/Source/C/GenFfs/GenFfs.c b/roms/edk2/BaseTools/Source/C/GenFfs/GenFfs.c
new file mode 100644
index 000000000..fcb911f4f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFfs/GenFfs.c
@@ -0,0 +1,1117 @@
+/** @file
+This file contains functions required to generate a Firmware File System file.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __GNUC__
+#include <windows.h>
+#include <io.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
+#ifdef __GNUC__
+#include <unistd.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <Common/UefiBaseTypes.h>
+#include <Common/PiFirmwareFile.h>
+#include <IndustryStandard/PeImage.h>
+#include <Guid/FfsSectionAlignmentPadding.h>
+
+#include "CommonLib.h"
+#include "ParseInf.h"
+#include "EfiUtilityMsgs.h"
+#include "FvLib.h"
+#include "PeCoffLib.h"
+
+#define UTILITY_NAME "GenFfs"
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 1
+
+STATIC CHAR8 *mFfsFileType[] = {
+ NULL, // 0x00
+ "EFI_FV_FILETYPE_RAW", // 0x01
+ "EFI_FV_FILETYPE_FREEFORM", // 0x02
+ "EFI_FV_FILETYPE_SECURITY_CORE", // 0x03
+ "EFI_FV_FILETYPE_PEI_CORE", // 0x04
+ "EFI_FV_FILETYPE_DXE_CORE", // 0x05
+ "EFI_FV_FILETYPE_PEIM", // 0x06
+ "EFI_FV_FILETYPE_DRIVER", // 0x07
+ "EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER", // 0x08
+ "EFI_FV_FILETYPE_APPLICATION", // 0x09
+ "EFI_FV_FILETYPE_SMM", // 0x0A
+ "EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE",// 0x0B
+ "EFI_FV_FILETYPE_COMBINED_SMM_DXE", // 0x0C
+ "EFI_FV_FILETYPE_SMM_CORE", // 0x0D
+ "EFI_FV_FILETYPE_MM_STANDALONE", // 0x0E
+ "EFI_FV_FILETYPE_MM_CORE_STANDALONE" // 0x0F
+};
+
+STATIC CHAR8 *mAlignName[] = {
+ "1", "2", "4", "8", "16", "32", "64", "128", "256", "512",
+ "1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K",
+ "512K", "1M", "2M", "4M", "8M", "16M"
+ };
+
+STATIC CHAR8 *mFfsValidAlignName[] = {
+ "8", "16", "128", "512", "1K", "4K", "32K", "64K", "128K","256K",
+ "512K", "1M", "2M", "4M", "8M", "16M"
+ };
+
+STATIC UINT32 mFfsValidAlign[] = {0, 8, 16, 128, 512, 1024, 4096, 32768, 65536, 131072, 262144,
+ 524288, 1048576, 2097152, 4194304, 8388608, 16777216};
+
+STATIC EFI_GUID mZeroGuid = {0};
+
+STATIC EFI_GUID mEfiFfsSectionAlignmentPaddingGuid = EFI_FFS_SECTION_ALIGNMENT_PADDING_GUID;
+
+STATIC
+VOID
+Version (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Print out version information for this utility.
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
+}
+
+STATIC
+VOID
+Usage (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Print Error / Help message.
+
+Arguments:
+
+ VOID
+
+Returns:
+
+ None
+
+--*/
+{
+ //
+ // Summary usage
+ //
+ fprintf (stdout, "\nUsage: %s [options]\n\n", UTILITY_NAME);
+
+ //
+ // Copyright declaration
+ //
+ fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
+
+ //
+ // Details Option
+ //
+ fprintf (stdout, "Options:\n");
+ fprintf (stdout, " -o FileName, --outputfile FileName\n\
+ File is FFS file to be created.\n");
+ fprintf (stdout, " -t Type, --filetype Type\n\
+ Type is one FV file type defined in PI spec, which is\n\
+ EFI_FV_FILETYPE_RAW, EFI_FV_FILETYPE_FREEFORM,\n\
+ EFI_FV_FILETYPE_SECURITY_CORE, EFI_FV_FILETYPE_PEIM,\n\
+ EFI_FV_FILETYPE_PEI_CORE, EFI_FV_FILETYPE_DXE_CORE,\n\
+ EFI_FV_FILETYPE_DRIVER, EFI_FV_FILETYPE_APPLICATION,\n\
+ EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER,\n\
+ EFI_FV_FILETYPE_SMM, EFI_FV_FILETYPE_SMM_CORE,\n\
+ EFI_FV_FILETYPE_MM_STANDALONE,\n\
+ EFI_FV_FILETYPE_MM_CORE_STANDALONE,\n\
+ EFI_FV_FILETYPE_COMBINED_SMM_DXE, \n\
+ EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE.\n");
+ fprintf (stdout, " -g FileGuid, --fileguid FileGuid\n\
+ FileGuid is one module guid.\n\
+ Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n");
+ fprintf (stdout, " -x, --fixed Indicates that the file may not be moved\n\
+ from its present location.\n");
+ fprintf (stdout, " -s, --checksum Indicates to calculate file checksum.\n");
+ fprintf (stdout, " -a FileAlign, --align FileAlign\n\
+ FileAlign points to file alignment, which only support\n\
+ the following align: 1,2,4,8,16,128,512,1K,4K,32K,64K\n\
+ 128K,256K,512K,1M,2M,4M,8M,16M\n");
+ fprintf (stdout, " -i SectionFile, --sectionfile SectionFile\n\
+ Section file will be contained in this FFS file.\n");
+ fprintf (stdout, " -oi SectionFile, --optionalsectionfile SectionFile\n\
+ If the Section file exists, it will be contained in this FFS file, otherwise, it will be ignored.\n");
+ fprintf (stdout, " -n SectionAlign, --sectionalign SectionAlign\n\
+ SectionAlign points to section alignment, which support\n\
+ the alignment scope 0~16M. If SectionAlign is specified\n\
+ as 0, tool get alignment value from SectionFile. It is\n\
+ specified together with sectionfile to point its\n\
+ alignment in FFS file.\n");
+ fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n");
+ fprintf (stdout, " -q, --quiet Disable all messages except key message and fatal error\n");
+ fprintf (stdout, " -d, --debug level Enable debug messages, at input debug level.\n");
+ fprintf (stdout, " --version Show program's version number and exit.\n");
+ fprintf (stdout, " -h, --help Show this help message and exit.\n");
+}
+
+STATIC
+EFI_STATUS
+StringtoAlignment (
+ IN CHAR8 *AlignBuffer,
+ OUT UINT32 *AlignNumber
+ )
+/*++
+
+Routine Description:
+
+ Converts Align String to align value (1~16M).
+
+Arguments:
+
+ AlignBuffer - Pointer to Align string.
+ AlignNumber - Pointer to Align value.
+
+Returns:
+
+ EFI_SUCCESS Successfully convert align string to align value.
+ EFI_INVALID_PARAMETER Align string is invalid or align value is not in scope.
+
+--*/
+{
+ UINT32 Index = 0;
+ //
+ // Check AlignBuffer
+ //
+ if (AlignBuffer == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ for (Index = 0; Index < sizeof (mAlignName) / sizeof (CHAR8 *); Index ++) {
+ if (stricmp (AlignBuffer, mAlignName [Index]) == 0) {
+ *AlignNumber = 1 << Index;
+ return EFI_SUCCESS;
+ }
+ }
+ return EFI_INVALID_PARAMETER;
+}
+
+STATIC
+UINT8
+StringToType (
+ IN CHAR8 *String
+ )
+/*++
+
+Routine Description:
+
+ Converts File Type String to value. EFI_FV_FILETYPE_ALL indicates that an
+ unrecognized file type was specified.
+
+Arguments:
+
+ String - File type string
+
+Returns:
+
+ File Type Value
+
+--*/
+{
+ UINT8 Index = 0;
+
+ if (String == NULL) {
+ return EFI_FV_FILETYPE_ALL;
+ }
+
+ for (Index = 0; Index < sizeof (mFfsFileType) / sizeof (CHAR8 *); Index ++) {
+ if (mFfsFileType [Index] != NULL && (stricmp (String, mFfsFileType [Index]) == 0)) {
+ return Index;
+ }
+ }
+ return EFI_FV_FILETYPE_ALL;
+}
+
+STATIC
+EFI_STATUS
+GetSectionContents (
+ IN CHAR8 **InputFileName,
+ IN UINT32 *InputFileAlign,
+ IN UINT32 InputFileNum,
+ IN EFI_FFS_FILE_ATTRIBUTES FfsAttrib,
+ OUT UINT8 *FileBuffer,
+ OUT UINT32 *BufferLength,
+ OUT UINT32 *MaxAlignment,
+ OUT UINT8 *PESectionNum
+ )
+/*++
+
+Routine Description:
+
+ Get the contents of all section files specified in InputFileName
+ into FileBuffer.
+
+Arguments:
+
+ InputFileName - Name of the input file.
+
+ InputFileAlign - Alignment required by the input file data.
+
+ InputFileNum - Number of input files. Should be at least 1.
+
+ FileBuffer - Output buffer to contain data
+
+ BufferLength - On input, this is size of the FileBuffer.
+ On output, this is the actual length of the data.
+
+ MaxAlignment - The max alignment required by all the input file datas.
+
+ PeSectionNum - Calculate the number of Pe/Te Section in this FFS file.
+
+Returns:
+
+ EFI_SUCCESS on successful return
+ EFI_INVALID_PARAMETER if InputFileNum is less than 1 or BufferLength point is NULL.
+ EFI_ABORTED if unable to open input file.
+ EFI_BUFFER_TOO_SMALL FileBuffer is not enough to contain all file data.
+--*/
+{
+ UINT32 Size;
+ UINT32 Offset;
+ UINT32 FileSize;
+ UINT32 Index;
+ FILE *InFile;
+ EFI_FREEFORM_SUBTYPE_GUID_SECTION *SectHeader;
+ EFI_COMMON_SECTION_HEADER2 TempSectHeader;
+ EFI_TE_IMAGE_HEADER TeHeader;
+ UINT32 TeOffset;
+ EFI_GUID_DEFINED_SECTION GuidSectHeader;
+ EFI_GUID_DEFINED_SECTION2 GuidSectHeader2;
+ UINT32 HeaderSize;
+ UINT32 MaxEncounteredAlignment;
+
+ Size = 0;
+ Offset = 0;
+ TeOffset = 0;
+ MaxEncounteredAlignment = 1;
+
+ //
+ // Go through our array of file names and copy their contents
+ // to the output buffer.
+ //
+ for (Index = 0; Index < InputFileNum; Index++) {
+ //
+ // make sure section ends on a DWORD boundary
+ //
+ while ((Size & 0x03) != 0) {
+ Size++;
+ }
+
+ //
+ // Open file and read contents
+ //
+ InFile = fopen (LongFilePath (InputFileName[Index]), "rb");
+ if (InFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", InputFileName[Index]);
+ return EFI_ABORTED;
+ }
+
+ fseek (InFile, 0, SEEK_END);
+ FileSize = ftell (InFile);
+ fseek (InFile, 0, SEEK_SET);
+ DebugMsg (NULL, 0, 9, "Input section files",
+ "the input section name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
+
+ //
+ // Check this section is Te/Pe section, and Calculate the numbers of Te/Pe section.
+ //
+ TeOffset = 0;
+ if (FileSize >= MAX_FFS_SIZE) {
+ HeaderSize = sizeof (EFI_COMMON_SECTION_HEADER2);
+ } else {
+ HeaderSize = sizeof (EFI_COMMON_SECTION_HEADER);
+ }
+ fread (&TempSectHeader, 1, HeaderSize, InFile);
+ if (TempSectHeader.Type == EFI_SECTION_TE) {
+ (*PESectionNum) ++;
+ fread (&TeHeader, 1, sizeof (TeHeader), InFile);
+ if (TeHeader.Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
+ TeOffset = TeHeader.StrippedSize - sizeof (TeHeader);
+ }
+ } else if (TempSectHeader.Type == EFI_SECTION_PE32) {
+ (*PESectionNum) ++;
+ } else if (TempSectHeader.Type == EFI_SECTION_GUID_DEFINED) {
+ fseek (InFile, 0, SEEK_SET);
+ if (FileSize >= MAX_SECTION_SIZE) {
+ fread (&GuidSectHeader2, 1, sizeof (GuidSectHeader2), InFile);
+ if ((GuidSectHeader2.Attributes & EFI_GUIDED_SECTION_PROCESSING_REQUIRED) == 0) {
+ HeaderSize = GuidSectHeader2.DataOffset;
+ }
+ } else {
+ fread (&GuidSectHeader, 1, sizeof (GuidSectHeader), InFile);
+ if ((GuidSectHeader.Attributes & EFI_GUIDED_SECTION_PROCESSING_REQUIRED) == 0) {
+ HeaderSize = GuidSectHeader.DataOffset;
+ }
+ }
+ (*PESectionNum) ++;
+ } else if (TempSectHeader.Type == EFI_SECTION_COMPRESSION ||
+ TempSectHeader.Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) {
+ //
+ // for the encapsulated section, assume it contains Pe/Te section
+ //
+ (*PESectionNum) ++;
+ }
+
+ fseek (InFile, 0, SEEK_SET);
+
+ //
+ // Revert TeOffset to the converse value relative to Alignment
+ // This is to assure the original PeImage Header at Alignment.
+ //
+ if ((TeOffset != 0) && (InputFileAlign [Index] != 0)) {
+ TeOffset = InputFileAlign [Index] - (TeOffset % InputFileAlign [Index]);
+ TeOffset = TeOffset % InputFileAlign [Index];
+ }
+
+ //
+ // make sure section data meet its alignment requirement by adding one pad section.
+ // But the different sections have the different section header. Necessary or not?
+ // Based on section type to adjust offset? Todo
+ //
+ if ((InputFileAlign [Index] != 0) && (((Size + HeaderSize + TeOffset) % InputFileAlign [Index]) != 0)) {
+ Offset = (Size + sizeof (EFI_COMMON_SECTION_HEADER) + HeaderSize + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
+ Offset = Offset - Size - HeaderSize - TeOffset;
+
+ if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) {
+ //
+ // The maximal alignment is 64K, the raw section size must be less than 0xffffff
+ //
+ memset (FileBuffer + Size, 0, Offset);
+ SectHeader = (EFI_FREEFORM_SUBTYPE_GUID_SECTION *) (FileBuffer + Size);
+ SectHeader->CommonHeader.Size[0] = (UINT8) (Offset & 0xff);
+ SectHeader->CommonHeader.Size[1] = (UINT8) ((Offset & 0xff00) >> 8);
+ SectHeader->CommonHeader.Size[2] = (UINT8) ((Offset & 0xff0000) >> 16);
+
+ //
+ // Only add a special reducible padding section if
+ // - this FFS has the FFS_ATTRIB_FIXED attribute,
+ // - none of the preceding sections have alignment requirements,
+ // - the size of the padding is sufficient for the
+ // EFI_SECTION_FREEFORM_SUBTYPE_GUID header.
+ //
+ if ((FfsAttrib & FFS_ATTRIB_FIXED) != 0 &&
+ MaxEncounteredAlignment <= 1 &&
+ Offset >= sizeof (EFI_FREEFORM_SUBTYPE_GUID_SECTION)) {
+ SectHeader->CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID;
+ SectHeader->SubTypeGuid = mEfiFfsSectionAlignmentPaddingGuid;
+ } else {
+ SectHeader->CommonHeader.Type = EFI_SECTION_RAW;
+ }
+ }
+ DebugMsg (NULL, 0, 9, "Pad raw section for section data alignment",
+ "Pad Raw section size is %u", (unsigned) Offset);
+
+ Size = Size + Offset;
+ }
+
+ //
+ // Get the Max alignment of all input file datas
+ //
+ if (MaxEncounteredAlignment < InputFileAlign [Index]) {
+ MaxEncounteredAlignment = InputFileAlign [Index];
+ }
+
+ //
+ // Now read the contents of the file into the buffer
+ // Buffer must be enough to contain the file content.
+ //
+ if ((FileSize > 0) && (FileBuffer != NULL) && ((Size + FileSize) <= *BufferLength)) {
+ if (fread (FileBuffer + Size, (size_t) FileSize, 1, InFile) != 1) {
+ Error (NULL, 0, 0004, "Error reading file", InputFileName[Index]);
+ fclose (InFile);
+ return EFI_ABORTED;
+ }
+ }
+
+ fclose (InFile);
+ Size += FileSize;
+ }
+
+ *MaxAlignment = MaxEncounteredAlignment;
+
+ //
+ // Set the actual length of the data.
+ //
+ if (Size > *BufferLength) {
+ *BufferLength = Size;
+ return EFI_BUFFER_TOO_SMALL;
+ } else {
+ *BufferLength = Size;
+ return EFI_SUCCESS;
+ }
+}
+
+EFI_STATUS
+FfsRebaseImageRead (
+ IN VOID *FileHandle,
+ IN UINTN FileOffset,
+ IN OUT UINT32 *ReadSize,
+ OUT VOID *Buffer
+ )
+ /*++
+
+ Routine Description:
+
+ Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
+
+ Arguments:
+
+ FileHandle - The handle to the PE/COFF file
+
+ FileOffset - The offset, in bytes, into the file to read
+
+ ReadSize - The number of bytes to read from the file starting at FileOffset
+
+ Buffer - A pointer to the buffer to read the data into.
+
+ Returns:
+
+ EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
+
+ --*/
+{
+ CHAR8 *Destination8;
+ CHAR8 *Source8;
+ UINT32 Length;
+
+ Destination8 = Buffer;
+ Source8 = (CHAR8 *) ((UINTN) FileHandle + FileOffset);
+ Length = *ReadSize;
+ while (Length--) {
+ *(Destination8++) = *(Source8++);
+ }
+
+ return EFI_SUCCESS;
+}
+
+STATIC
+EFI_STATUS
+GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
+ /*++
+ InFile is input file for getting alignment
+ return the alignment
+ --*/
+{
+ FILE *InFileHandle;
+ UINT8 *PeFileBuffer;
+ UINTN PeFileSize;
+ UINT32 CurSecHdrSize;
+ PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
+ EFI_COMMON_SECTION_HEADER *CommonHeader;
+ EFI_STATUS Status;
+
+ InFileHandle = NULL;
+ PeFileBuffer = NULL;
+ *Alignment = 0;
+
+ memset (&ImageContext, 0, sizeof (ImageContext));
+
+ InFileHandle = fopen(LongFilePath(InFile), "rb");
+ if (InFileHandle == NULL){
+ Error (NULL, 0, 0001, "Error opening file", InFile);
+ return EFI_ABORTED;
+ }
+ PeFileSize = _filelength (fileno(InFileHandle));
+ PeFileBuffer = (UINT8 *) malloc (PeFileSize);
+ if (PeFileBuffer == NULL) {
+ fclose (InFileHandle);
+ Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
+ fclose (InFileHandle);
+ CommonHeader = (EFI_COMMON_SECTION_HEADER *) PeFileBuffer;
+ CurSecHdrSize = GetSectionHeaderLength(CommonHeader);
+ ImageContext.Handle = (VOID *) ((UINTN)PeFileBuffer + CurSecHdrSize);
+ ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE)FfsRebaseImageRead;
+ Status = PeCoffLoaderGetImageInfo(&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and return status is %x", InFile, (int) Status);
+ return Status;
+ }
+ *Alignment = ImageContext.SectionAlignment;
+ // Free the allocated memory resource
+ if (PeFileBuffer != NULL) {
+ free (PeFileBuffer);
+ PeFileBuffer = NULL;
+ }
+ return EFI_SUCCESS;
+}
+
+int
+main (
+ int argc,
+ CHAR8 *argv[]
+ )
+/*++
+
+Routine Description:
+
+ Main function.
+
+Arguments:
+
+ argc - Number of command line parameters.
+ argv - Array of pointers to parameter strings.
+
+Returns:
+ STATUS_SUCCESS - Utility exits successfully.
+ STATUS_ERROR - Some error occurred during execution.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_FFS_FILE_ATTRIBUTES FfsAttrib;
+ UINT32 FfsAlign;
+ EFI_FV_FILETYPE FfsFiletype;
+ CHAR8 *OutputFileName;
+ EFI_GUID FileGuid = {0};
+ UINT32 InputFileNum;
+ UINT32 *InputFileAlign;
+ CHAR8 **InputFileName;
+ UINT8 *FileBuffer;
+ UINT32 FileSize;
+ UINT32 MaxAlignment;
+ EFI_FFS_FILE_HEADER2 FfsFileHeader;
+ FILE *FfsFile;
+ UINT32 Index;
+ UINT64 LogLevel;
+ UINT8 PeSectionNum;
+ UINT32 HeaderSize;
+ UINT32 Alignment;
+ //
+ // Workaround for static code checkers.
+ // Ensures the size of 'AlignmentBuffer' can hold all the digits of an
+ // unsigned 32-bit integer plus the size unit character.
+ //
+ CHAR8 AlignmentBuffer[16];
+
+ //
+ // Init local variables
+ //
+ LogLevel = 0;
+ Index = 0;
+ FfsAttrib = 0;
+ FfsAlign = 0;
+ FfsFiletype = EFI_FV_FILETYPE_ALL;
+ OutputFileName = NULL;
+ InputFileNum = 0;
+ InputFileName = NULL;
+ InputFileAlign = NULL;
+ FileBuffer = NULL;
+ FileSize = 0;
+ MaxAlignment = 1;
+ FfsFile = NULL;
+ Status = EFI_SUCCESS;
+ PeSectionNum = 0;
+
+ SetUtilityName (UTILITY_NAME);
+
+ if (argc == 1) {
+ Error (NULL, 0, 1001, "Missing options", "no options input");
+ Usage ();
+ return STATUS_ERROR;
+ }
+
+ //
+ // Parse command line
+ //
+ argc --;
+ argv ++;
+
+ if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
+ Version ();
+ Usage ();
+ return STATUS_SUCCESS;
+ }
+
+ if (stricmp (argv[0], "--version") == 0) {
+ Version ();
+ return STATUS_SUCCESS;
+ }
+
+ while (argc > 0) {
+ if ((stricmp (argv[0], "-t") == 0) || (stricmp (argv[0], "--filetype") == 0)) {
+ if (argv[1] == NULL || argv[1][0] == '-') {
+ Error (NULL, 0, 1003, "Invalid option value", "file type is missing for -t option");
+ goto Finish;
+ }
+ FfsFiletype = StringToType (argv[1]);
+ if (FfsFiletype == EFI_FV_FILETYPE_ALL) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s is not a valid file type", argv[1]);
+ goto Finish;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
+ if (argv[1] == NULL || argv[1][0] == '-') {
+ Error (NULL, 0, 1003, "Invalid option value", "Output file is missing for -o option");
+ goto Finish;
+ }
+ OutputFileName = argv[1];
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-g") == 0) || (stricmp (argv[0], "--fileguid") == 0)) {
+ Status = StringToGuid (argv[1], &FileGuid);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-x") == 0) || (stricmp (argv[0], "--fixed") == 0)) {
+ FfsAttrib |= FFS_ATTRIB_FIXED;
+ argc -= 1;
+ argv += 1;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--checksum") == 0)) {
+ FfsAttrib |= FFS_ATTRIB_CHECKSUM;
+ argc -= 1;
+ argv += 1;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-a") == 0) || (stricmp (argv[0], "--align") == 0)) {
+ if (argv[1] == NULL || argv[1][0] == '-') {
+ Error (NULL, 0, 1003, "Invalid option value", "Align value is missing for -a option");
+ goto Finish;
+ }
+ for (Index = 0; Index < sizeof (mFfsValidAlignName) / sizeof (CHAR8 *); Index ++) {
+ if (stricmp (argv[1], mFfsValidAlignName[Index]) == 0) {
+ break;
+ }
+ }
+ if (Index == sizeof (mFfsValidAlignName) / sizeof (CHAR8 *)) {
+ if ((stricmp (argv[1], "1") == 0) || (stricmp (argv[1], "2") == 0) || (stricmp (argv[1], "4") == 0)) {
+ //
+ // 1, 2, 4 byte alignment same to 8 byte alignment
+ //
+ Index = 0;
+ } else {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ }
+ FfsAlign = Index;
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-oi") == 0) || (stricmp (argv[0], "--optionalsectionfile") == 0) || (stricmp (argv[0], "-i") == 0) || (stricmp (argv[0], "--sectionfile") == 0)) {
+ //
+ // Get Input file name and its alignment
+ //
+ if (argv[1] == NULL || argv[1][0] == '-') {
+ Error (NULL, 0, 1003, "Invalid option value", "input section file is missing for -i option");
+ goto Finish;
+ }
+ if ((stricmp (argv[0], "-oi") == 0) || (stricmp (argv[0], "--optionalsectionfile") == 0) ){
+ if (-1 == access(argv[1] , 0)){
+ Warning(NULL, 0, 0001, "File is not found.", argv[1]);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+ }
+ //
+ // Allocate Input file name buffer and its alignment buffer.
+ //
+ if ((InputFileNum == 0) && (InputFileName == NULL)) {
+ InputFileName = (CHAR8 **) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *));
+ if (InputFileName == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return STATUS_ERROR;
+ }
+ memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
+
+ InputFileAlign = (UINT32 *) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32));
+ if (InputFileAlign == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ free (InputFileName);
+ return STATUS_ERROR;
+ }
+ memset (InputFileAlign, 0, MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32));
+ } else if (InputFileNum % MAXIMUM_INPUT_FILE_NUM == 0) {
+ //
+ // InputFileName and alignment buffer too small, need to realloc
+ //
+ InputFileName = (CHAR8 **) realloc (
+ InputFileName,
+ (InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (CHAR8 *)
+ );
+
+ if (InputFileName == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ free (InputFileAlign);
+ return STATUS_ERROR;
+ }
+ memset (&(InputFileName[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
+
+ InputFileAlign = (UINT32 *) realloc (
+ InputFileAlign,
+ (InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (UINT32)
+ );
+
+ if (InputFileAlign == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ free (InputFileName);
+ return STATUS_ERROR;
+ }
+ memset (&(InputFileAlign[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32)));
+ }
+
+ InputFileName[InputFileNum] = argv[1];
+ argc -= 2;
+ argv += 2;
+
+ if (argc <= 0) {
+ InputFileNum ++;
+ break;
+ }
+
+ //
+ // Section File alignment requirement
+ //
+ if ((stricmp (argv[0], "-n") == 0) || (stricmp (argv[0], "--sectionalign") == 0)) {
+ if ((argv[1] != NULL) && (stricmp("0", argv[1]) == 0)) {
+ Status = GetAlignmentFromFile(InputFileName[InputFileNum], &Alignment);
+ if (EFI_ERROR(Status)) {
+ Error (NULL, 0, 1003, "Fail to get Alignment from %s", InputFileName[InputFileNum]);
+ goto Finish;
+ }
+ if (Alignment < 0x400){
+ sprintf (AlignmentBuffer, "%d", Alignment);
+ }
+ else if (Alignment >= 0x400) {
+ if (Alignment >= 0x100000) {
+ sprintf (AlignmentBuffer, "%dM", Alignment/0x100000);
+ } else {
+ sprintf (AlignmentBuffer, "%dK", Alignment/0x400);
+ }
+ }
+ Status = StringtoAlignment (AlignmentBuffer, &(InputFileAlign[InputFileNum]));
+ }
+ else {
+ Status = StringtoAlignment (argv[1], &(InputFileAlign[InputFileNum]));
+ }
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ argc -= 2;
+ argv += 2;
+ }
+ InputFileNum ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-n") == 0) || (stricmp (argv[0], "--sectionalign") == 0)) {
+ Error (NULL, 0, 1000, "Unknown option", "SectionAlign option must be specified with section file.");
+ goto Finish;
+ }
+
+ if ((stricmp (argv[0], "-v") == 0) || (stricmp (argv[0], "--verbose") == 0)) {
+ SetPrintLevel (VERBOSE_LOG_LEVEL);
+ VerboseMsg ("Verbose output Mode Set!");
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
+ SetPrintLevel (KEY_LOG_LEVEL);
+ KeyMsg ("Quiet output Mode Set!");
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--debug") == 0)) {
+ Status = AsciiStringToUint64 (argv[1], FALSE, &LogLevel);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ if (LogLevel > 9) {
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);
+ goto Finish;
+ }
+ SetPrintLevel (LogLevel);
+ DebugMsg (NULL, 0, 9, "Debug Mode Set", "Debug Output Mode Level %s is set!", argv[1]);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ Error (NULL, 0, 1000, "Unknown option", "%s", argv[0]);
+ goto Finish;
+ }
+
+ VerboseMsg ("%s tool start.", UTILITY_NAME);
+
+ //
+ // Check the complete input parameters.
+ //
+ if (FfsFiletype == EFI_FV_FILETYPE_ALL) {
+ Error (NULL, 0, 1001, "Missing option", "filetype");
+ goto Finish;
+ }
+
+ if (CompareGuid (&FileGuid, &mZeroGuid) == 0) {
+ Error (NULL, 0, 1001, "Missing option", "fileguid");
+ goto Finish;
+ }
+
+ if (InputFileNum == 0) {
+ Error (NULL, 0, 1001, "Missing option", "Input files");
+ goto Finish;
+ }
+
+ //
+ // Output input parameter information
+ //
+ VerboseMsg ("Fv File type is %s", mFfsFileType [FfsFiletype]);
+ VerboseMsg ("Output file name is %s", OutputFileName);
+ VerboseMsg ("FFS File Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+ (unsigned) FileGuid.Data1,
+ FileGuid.Data2,
+ FileGuid.Data3,
+ FileGuid.Data4[0],
+ FileGuid.Data4[1],
+ FileGuid.Data4[2],
+ FileGuid.Data4[3],
+ FileGuid.Data4[4],
+ FileGuid.Data4[5],
+ FileGuid.Data4[6],
+ FileGuid.Data4[7]);
+ if ((FfsAttrib & FFS_ATTRIB_FIXED) != 0) {
+ VerboseMsg ("FFS File has the fixed file attribute");
+ }
+ if ((FfsAttrib & FFS_ATTRIB_CHECKSUM) != 0) {
+ VerboseMsg ("FFS File requires the checksum of the whole file");
+ }
+ VerboseMsg ("FFS file alignment is %s", mFfsValidAlignName[FfsAlign]);
+ for (Index = 0; Index < InputFileNum; Index ++) {
+ if (InputFileAlign[Index] == 0) {
+ //
+ // Minimum alignment is 1 byte.
+ //
+ InputFileAlign[Index] = 1;
+ }
+ VerboseMsg ("the %dth input section name is %s and section alignment is %u", Index, InputFileName[Index], (unsigned) InputFileAlign[Index]);
+ }
+
+ //
+ // Calculate the size of all input section files.
+ //
+ Status = GetSectionContents (
+ InputFileName,
+ InputFileAlign,
+ InputFileNum,
+ FfsAttrib,
+ FileBuffer,
+ &FileSize,
+ &MaxAlignment,
+ &PeSectionNum
+ );
+
+ if ((FfsFiletype == EFI_FV_FILETYPE_SECURITY_CORE ||
+ FfsFiletype == EFI_FV_FILETYPE_PEI_CORE ||
+ FfsFiletype == EFI_FV_FILETYPE_DXE_CORE) && (PeSectionNum != 1)) {
+ Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have one and only one Pe or Te section, but %u Pe/Te section are input", mFfsFileType [FfsFiletype], PeSectionNum);
+ goto Finish;
+ }
+
+ if ((FfsFiletype == EFI_FV_FILETYPE_PEIM ||
+ FfsFiletype == EFI_FV_FILETYPE_DRIVER ||
+ FfsFiletype == EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER ||
+ FfsFiletype == EFI_FV_FILETYPE_APPLICATION) && (PeSectionNum < 1)) {
+ Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have at least one Pe or Te section, but no Pe/Te section is input", mFfsFileType [FfsFiletype]);
+ goto Finish;
+ }
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ FileBuffer = (UINT8 *) malloc (FileSize);
+ if (FileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ goto Finish;
+ }
+ memset (FileBuffer, 0, FileSize);
+
+ //
+ // read all input file contents into a buffer
+ //
+ Status = GetSectionContents (
+ InputFileName,
+ InputFileAlign,
+ InputFileNum,
+ FfsAttrib,
+ FileBuffer,
+ &FileSize,
+ &MaxAlignment,
+ &PeSectionNum
+ );
+ }
+
+ if (EFI_ERROR (Status)) {
+ goto Finish;
+ }
+
+ if (FileBuffer == NULL && FileSize != 0) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ goto Finish;
+ }
+
+ //
+ // Create Ffs file header.
+ //
+ memset (&FfsFileHeader, 0, sizeof (EFI_FFS_FILE_HEADER2));
+ memcpy (&FfsFileHeader.Name, &FileGuid, sizeof (EFI_GUID));
+ FfsFileHeader.Type = FfsFiletype;
+ //
+ // Update FFS Alignment based on the max alignment required by input section files
+ //
+ VerboseMsg ("the max alignment of all input sections is %u", (unsigned) MaxAlignment);
+ for (Index = 0; Index < sizeof (mFfsValidAlign) / sizeof (UINT32) - 1; Index ++) {
+ if ((MaxAlignment > mFfsValidAlign [Index]) && (MaxAlignment <= mFfsValidAlign [Index + 1])) {
+ break;
+ }
+ }
+ if (FfsAlign < Index) {
+ FfsAlign = Index;
+ }
+ VerboseMsg ("the alignment of the generated FFS file is %u", (unsigned) mFfsValidAlign [FfsAlign + 1]);
+
+ //
+ // Now FileSize includes the EFI_FFS_FILE_HEADER
+ //
+ if (FileSize + sizeof (EFI_FFS_FILE_HEADER) >= MAX_FFS_SIZE) {
+ HeaderSize = sizeof (EFI_FFS_FILE_HEADER2);
+ FileSize += sizeof (EFI_FFS_FILE_HEADER2);
+ FfsFileHeader.ExtendedSize = FileSize;
+ memset(FfsFileHeader.Size, 0, sizeof (UINT8) * 3);
+ FfsAttrib |= FFS_ATTRIB_LARGE_FILE;
+ } else {
+ HeaderSize = sizeof (EFI_FFS_FILE_HEADER);
+ FileSize += sizeof (EFI_FFS_FILE_HEADER);
+ FfsFileHeader.Size[0] = (UINT8) (FileSize & 0xFF);
+ FfsFileHeader.Size[1] = (UINT8) ((FileSize & 0xFF00) >> 8);
+ FfsFileHeader.Size[2] = (UINT8) ((FileSize & 0xFF0000) >> 16);
+ }
+ VerboseMsg ("the size of the generated FFS file is %u bytes", (unsigned) FileSize);
+
+ //FfsAlign larger than 7, set FFS_ATTRIB_DATA_ALIGNMENT2
+ if (FfsAlign < 8) {
+ FfsFileHeader.Attributes = (EFI_FFS_FILE_ATTRIBUTES) (FfsAttrib | (FfsAlign << 3));
+ } else {
+ FfsFileHeader.Attributes = (EFI_FFS_FILE_ATTRIBUTES) (FfsAttrib | ((FfsAlign & 0x7) << 3) | FFS_ATTRIB_DATA_ALIGNMENT2);
+ }
+
+ //
+ // Fill in checksums and state, these must be zero for checksumming
+ //
+ // FileHeader.IntegrityCheck.Checksum.Header = 0;
+ // FileHeader.IntegrityCheck.Checksum.File = 0;
+ // FileHeader.State = 0;
+ //
+ FfsFileHeader.IntegrityCheck.Checksum.Header = CalculateChecksum8 (
+ (UINT8 *) &FfsFileHeader,
+ HeaderSize
+ );
+
+ if (FfsFileHeader.Attributes & FFS_ATTRIB_CHECKSUM) {
+ //
+ // Ffs header checksum = zero, so only need to calculate ffs body.
+ //
+ FfsFileHeader.IntegrityCheck.Checksum.File = CalculateChecksum8 (
+ FileBuffer,
+ FileSize - HeaderSize
+ );
+ } else {
+ FfsFileHeader.IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
+ }
+
+ FfsFileHeader.State = EFI_FILE_HEADER_CONSTRUCTION | EFI_FILE_HEADER_VALID | EFI_FILE_DATA_VALID;
+
+ //
+ // Open output file to write ffs data.
+ //
+ if (OutputFileName != NULL) {
+ remove(OutputFileName);
+ FfsFile = fopen (LongFilePath (OutputFileName), "wb");
+ if (FfsFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", OutputFileName);
+ goto Finish;
+ }
+ //
+ // write header
+ //
+ fwrite (&FfsFileHeader, 1, HeaderSize, FfsFile);
+ //
+ // write data
+ //
+ if (FileBuffer != NULL) {
+ fwrite (FileBuffer, 1, FileSize - HeaderSize, FfsFile);
+ }
+
+ fclose (FfsFile);
+ }
+
+Finish:
+ if (InputFileName != NULL) {
+ free (InputFileName);
+ }
+ if (InputFileAlign != NULL) {
+ free (InputFileAlign);
+ }
+ if (FileBuffer != NULL) {
+ free (FileBuffer);
+ }
+ //
+ // If any errors were reported via the standard error reporting
+ // routines, then the status has been saved. Get the value and
+ // return it to the caller.
+ //
+ VerboseMsg ("%s tool done with return code is 0x%x.", UTILITY_NAME, GetUtilityStatus ());
+
+ return GetUtilityStatus ();
+}
diff --git a/roms/edk2/BaseTools/Source/C/GenFfs/Makefile b/roms/edk2/BaseTools/Source/C/GenFfs/Makefile
new file mode 100644
index 000000000..8a51b9457
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFfs/Makefile
@@ -0,0 +1,16 @@
+## @file
+# Windows makefile for 'GenFfs' module build.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+APPNAME = GenFfs
+
+LIBS = $(LIB_PATH)\Common.lib
+
+OBJECTS = GenFfs.obj
+
+!INCLUDE ..\Makefiles\ms.app
+
diff --git a/roms/edk2/BaseTools/Source/C/GenFv/GNUmakefile b/roms/edk2/BaseTools/Source/C/GenFv/GNUmakefile
new file mode 100644
index 000000000..7c7b95ba1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFv/GNUmakefile
@@ -0,0 +1,23 @@
+## @file
+# GNU/Linux makefile for 'GenFv' module build.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+MAKEROOT ?= ..
+
+APPNAME = GenFv
+
+OBJECTS = GenFv.o GenFvInternalLib.o
+
+include $(MAKEROOT)/Makefiles/app.makefile
+
+LIBS = -lCommon
+ifeq ($(CYGWIN), CYGWIN)
+ LIBS += -L/lib/e2fsprogs -luuid
+endif
+
+ifeq ($(LINUX), Linux)
+ LIBS += -luuid
+endif
+
diff --git a/roms/edk2/BaseTools/Source/C/GenFv/GenFv.c b/roms/edk2/BaseTools/Source/C/GenFv/GenFv.c
new file mode 100644
index 000000000..43cc5cd3f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFv/GenFv.c
@@ -0,0 +1,696 @@
+/** @file
+ This contains all code necessary to build the GenFvImage.exe utility.
+ This utility relies heavily on the GenFvImage Lib. Definitions for both
+ can be found in the Tiano Firmware Volume Generation Utility
+ Specification, review draft.
+
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+//
+// File included in build
+//
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "GenFvInternalLib.h"
+
+//
+// Utility Name
+//
+#define UTILITY_NAME "GenFv"
+
+//
+// Utility version information
+//
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 1
+
+EFI_GUID mEfiFirmwareFileSystem2Guid = EFI_FIRMWARE_FILE_SYSTEM2_GUID;
+EFI_GUID mEfiFirmwareFileSystem3Guid = EFI_FIRMWARE_FILE_SYSTEM3_GUID;
+
+STATIC
+VOID
+Version (
+ VOID
+)
+/*++
+
+Routine Description:
+
+ Displays the standard utility information to SDTOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
+}
+
+STATIC
+VOID
+Usage (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Displays the utility usage syntax to STDOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ //
+ // Summary usage
+ //
+ fprintf (stdout, "\nUsage: %s [options]\n\n", UTILITY_NAME);
+
+ //
+ // Copyright declaration
+ //
+ fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
+
+ //
+ // Details Option
+ //
+ fprintf (stdout, "Options:\n");
+ fprintf (stdout, " -o FileName, --outputfile FileName\n\
+ File is the FvImage or CapImage to be created.\n");
+ fprintf (stdout, " -i FileName, --inputfile FileName\n\
+ File is the input FV.inf or Cap.inf to specify\n\
+ how to construct FvImage or CapImage.\n");
+ fprintf (stdout, " -b BlockSize, --blocksize BlockSize\n\
+ BlockSize is one HEX or DEC format value\n\
+ BlockSize is required by Fv Image.\n");
+ fprintf (stdout, " -n NumberBlock, --numberblock NumberBlock\n\
+ NumberBlock is one HEX or DEC format value\n\
+ NumberBlock is one optional parameter.\n");
+ fprintf (stdout, " -f FfsFile, --ffsfile FfsFile\n\
+ FfsFile is placed into Fv Image\n\
+ multi files can input one by one\n");
+ fprintf (stdout, " -s FileTakenSize, --filetakensize FileTakenSize\n\
+ FileTakenSize specifies the size of the required\n\
+ space that the input file is placed in Fvimage.\n\
+ It is specified together with the input file.\n");
+ fprintf (stdout, " -r Address, --baseaddr Address\n\
+ Address is the rebase start address for drivers that\n\
+ run in Flash. It supports DEC or HEX digital format.\n\
+ If it is set to zero, no rebase action will be taken\n");
+ fprintf (stdout, " -F ForceRebase, --force-rebase ForceRebase\n\
+ If value is TRUE, will always take rebase action\n\
+ If value is FALSE, will always not take reabse action\n\
+ If not specified, will take rebase action if rebase address greater than zero, \n\
+ will not take rebase action if rebase address is zero.\n");
+ fprintf (stdout, " -a AddressFile, --addrfile AddressFile\n\
+ AddressFile is one file used to record the child\n\
+ FV base address when current FV base address is set.\n");
+ fprintf (stdout, " -m logfile, --map logfile\n\
+ Logfile is the output fv map file name. if it is not\n\
+ given, the FvName.map will be the default map file name\n");
+ fprintf (stdout, " -g Guid, --guid Guid\n\
+ GuidValue is one specific capsule guid value\n\
+ or fv file system guid value.\n\
+ Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n");
+ fprintf (stdout, " --FvNameGuid Guid Guid is used to specify Fv Name.\n\
+ Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n");
+ fprintf (stdout, " --capflag CapFlag Capsule Reset Flag can be PersistAcrossReset,\n\
+ or PopulateSystemTable or InitiateReset or not set\n");
+ fprintf (stdout, " --capoemflag CapOEMFlag\n\
+ Capsule OEM Flag is an integer between 0x0000 and 0xffff\n");
+ fprintf (stdout, " --capheadsize HeadSize\n\
+ HeadSize is one HEX or DEC format value\n\
+ HeadSize is required by Capsule Image.\n");
+ fprintf (stdout, " -c, --capsule Create Capsule Image.\n");
+ fprintf (stdout, " -p, --dump Dump Capsule Image header.\n");
+ fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n");
+ fprintf (stdout, " -q, --quiet Disable all messages except key message and fatal error\n");
+ fprintf (stdout, " -d, --debug level Enable debug messages, at input debug level.\n");
+ fprintf (stdout, " --version Show program's version number and exit.\n");
+ fprintf (stdout, " -h, --help Show this help message and exit.\n");
+}
+
+UINT32 mFvTotalSize;
+UINT32 mFvTakenSize;
+
+int
+main (
+ IN int argc,
+ IN char **argv
+ )
+/*++
+
+Routine Description:
+
+ This utility uses GenFvImage.Lib to build a firmware volume image.
+
+Arguments:
+
+ FvInfFileName The name of an FV image description file or Capsule Image.
+
+ Arguments come in pair in any order.
+ -I FvInfFileName
+
+Returns:
+
+ EFI_SUCCESS No error conditions detected.
+ EFI_INVALID_PARAMETER One or more of the input parameters is invalid.
+ EFI_OUT_OF_RESOURCES A resource required by the utility was unavailable.
+ Most commonly this will be memory allocation
+ or file creation.
+ EFI_LOAD_ERROR GenFvImage.lib could not be loaded.
+ EFI_ABORTED Error executing the GenFvImage lib.
+
+--*/
+{
+ EFI_STATUS Status;
+ CHAR8 *InfFileName;
+ CHAR8 *AddrFileName;
+ CHAR8 *MapFileName;
+ CHAR8 *InfFileImage;
+ UINT32 InfFileSize;
+ CHAR8 *OutFileName;
+ BOOLEAN CapsuleFlag;
+ BOOLEAN DumpCapsule;
+ FILE *FpFile;
+ EFI_CAPSULE_HEADER *CapsuleHeader;
+ UINT64 LogLevel, TempNumber;
+ UINT32 Index;
+
+ InfFileName = NULL;
+ AddrFileName = NULL;
+ InfFileImage = NULL;
+ OutFileName = NULL;
+ MapFileName = NULL;
+ InfFileSize = 0;
+ CapsuleFlag = FALSE;
+ DumpCapsule = FALSE;
+ FpFile = NULL;
+ CapsuleHeader = NULL;
+ LogLevel = 0;
+ TempNumber = 0;
+ Index = 0;
+ mFvTotalSize = 0;
+ mFvTakenSize = 0;
+ Status = EFI_SUCCESS;
+
+ SetUtilityName (UTILITY_NAME);
+
+ if (argc == 1) {
+ Error (NULL, 0, 1001, "Missing options", "No input options specified.");
+ Usage ();
+ return STATUS_ERROR;
+ }
+
+ //
+ // Init global data to Zero
+ //
+ memset (&mFvDataInfo, 0, sizeof (FV_INFO));
+ memset (&mCapDataInfo, 0, sizeof (CAP_INFO));
+ //
+ // Set the default FvGuid
+ //
+ memcpy (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid, sizeof (EFI_GUID));
+ mFvDataInfo.ForceRebase = -1;
+
+ //
+ // Parse command line
+ //
+ argc --;
+ argv ++;
+
+ if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
+ Version ();
+ Usage ();
+ return STATUS_SUCCESS;
+ }
+
+ if (stricmp (argv[0], "--version") == 0) {
+ Version ();
+ return STATUS_SUCCESS;
+ }
+
+ while (argc > 0) {
+ if ((stricmp (argv[0], "-i") == 0) || (stricmp (argv[0], "--inputfile") == 0)) {
+ InfFileName = argv[1];
+ if (InfFileName == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Input file can't be null");
+ return STATUS_ERROR;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-a") == 0) || (stricmp (argv[0], "--addrfile") == 0)) {
+ AddrFileName = argv[1];
+ if (AddrFileName == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Address file can't be null");
+ return STATUS_ERROR;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
+ OutFileName = argv[1];
+ if (OutFileName == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Output file can't be null");
+ return STATUS_ERROR;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-r") == 0) || (stricmp (argv[0], "--baseaddr") == 0)) {
+ Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ return STATUS_ERROR;
+ }
+ mFvDataInfo.BaseAddress = TempNumber;
+ mFvDataInfo.BaseAddressSet = TRUE;
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-b") == 0) || (stricmp (argv[0], "--blocksize") == 0)) {
+ Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ return STATUS_ERROR;
+ }
+ if (TempNumber == 0) {
+ Error (NULL, 0, 1003, "Invalid option value", "Fv block size can't be be set to zero");
+ return STATUS_ERROR;
+ }
+ mFvDataInfo.FvBlocks[0].Length = (UINT32) TempNumber;
+ DebugMsg (NULL, 0, 9, "FV Block Size", "%s = 0x%llx", EFI_BLOCK_SIZE_STRING, (unsigned long long) TempNumber);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-n") == 0) || (stricmp (argv[0], "--numberblock") == 0)) {
+ Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ return STATUS_ERROR;
+ }
+ if (TempNumber == 0) {
+ Error (NULL, 0, 1003, "Invalid option value", "Fv block number can't be set to zero");
+ return STATUS_ERROR;
+ }
+ mFvDataInfo.FvBlocks[0].NumBlocks = (UINT32) TempNumber;
+ DebugMsg (NULL, 0, 9, "FV Number Block", "%s = 0x%llx", EFI_NUM_BLOCKS_STRING, (unsigned long long) TempNumber);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((strcmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--ffsfile") == 0)) {
+ if (argv[1] == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Input Ffsfile can't be null");
+ return STATUS_ERROR;
+ }
+ if (strlen (argv[1]) > MAX_LONG_FILE_PATH - 1) {
+ Error (NULL, 0, 1003, "Invalid option value", "Input Ffsfile name %s is too long!", argv[1]);
+ return STATUS_ERROR;
+ }
+ strncpy (mFvDataInfo.FvFiles[Index], argv[1], MAX_LONG_FILE_PATH - 1);
+ mFvDataInfo.FvFiles[Index][MAX_LONG_FILE_PATH - 1] = 0;
+ DebugMsg (NULL, 0, 9, "FV component file", "the %uth name is %s", (unsigned) Index + 1, argv[1]);
+ argc -= 2;
+ argv += 2;
+
+ if (argc > 0) {
+ if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--filetakensize") == 0)) {
+ if (argv[1] == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Ffsfile Size can't be null");
+ return STATUS_ERROR;
+ }
+ Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ return STATUS_ERROR;
+ }
+ mFvDataInfo.SizeofFvFiles[Index] = (UINT32) TempNumber;
+ DebugMsg (NULL, 0, 9, "FV component file size", "the %uth size is %s", (unsigned) Index + 1, argv[1]);
+ argc -= 2;
+ argv += 2;
+ }
+ }
+ Index ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--filetakensize") == 0)) {
+ Error (NULL, 0, 1003, "Invalid option", "It must be specified together with -f option to specify the file size.");
+ return STATUS_ERROR;
+ }
+
+ if ((stricmp (argv[0], "-c") == 0) || (stricmp (argv[0], "--capsule") == 0)) {
+ CapsuleFlag = TRUE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((strcmp (argv[0], "-F") == 0) || (stricmp (argv[0], "--force-rebase") == 0)) {
+ if (argv[1] == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Froce rebase flag can't be null");
+ return STATUS_ERROR;
+ }
+
+ if (stricmp (argv[1], "TRUE") == 0) {
+ mFvDataInfo.ForceRebase = 1;
+ } else if (stricmp (argv[1], "FALSE") == 0) {
+ mFvDataInfo.ForceRebase = 0;
+ } else {
+ Error (NULL, 0, 1003, "Invalid option value", "froce rebase flag value must be \"TRUE\" or \"FALSE\"");
+ return STATUS_ERROR;
+ }
+
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if (stricmp (argv[0], "--capheadsize") == 0) {
+ //
+ // Get Capsule Image Header Size
+ //
+ Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ return STATUS_ERROR;
+ }
+ mCapDataInfo.HeaderSize = (UINT32) TempNumber;
+ DebugMsg (NULL, 0, 9, "Capsule Header size", "%s = 0x%llx", EFI_CAPSULE_HEADER_SIZE_STRING, (unsigned long long) TempNumber);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if (stricmp (argv[0], "--capflag") == 0) {
+ //
+ // Get Capsule Header
+ //
+ if (argv[1] == NULL) {
+ Error (NULL, 0, 1003, "Option value is not set", "%s = %s", argv[0], argv[1]);
+ return STATUS_ERROR;
+ }
+ if (strcmp (argv[1], "PopulateSystemTable") == 0) {
+ mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE;
+ } else if (strcmp (argv[1], "PersistAcrossReset") == 0) {
+ mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET;
+ } else if (strcmp (argv[1], "InitiateReset") == 0) {
+ mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_INITIATE_RESET;
+ } else {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ return STATUS_ERROR;
+ }
+ DebugMsg (NULL, 0, 9, "Capsule Flag", argv[1]);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if (stricmp (argv[0], "--capoemflag") == 0) {
+ if (argv[1] == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Capsule OEM flag can't be null");
+ }
+ Status = AsciiStringToUint64(argv[1], FALSE, &TempNumber);
+ if (EFI_ERROR (Status) || TempNumber > 0xffff) {
+ Error (NULL, 0, 1003, "Invalid option value", "Capsule OEM flag value must be integer value between 0x0000 and 0xffff");
+ return STATUS_ERROR;
+ }
+ mCapDataInfo.Flags |= TempNumber;
+ DebugMsg( NULL, 0, 9, "Capsule OEM Flags", argv[1]);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if (stricmp (argv[0], "--capguid") == 0) {
+ //
+ // Get the Capsule Guid
+ //
+ Status = StringToGuid (argv[1], &mCapDataInfo.CapGuid);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", EFI_CAPSULE_GUID_STRING, argv[1]);
+ return STATUS_ERROR;
+ }
+ DebugMsg (NULL, 0, 9, "Capsule Guid", "%s = %s", EFI_CAPSULE_GUID_STRING, argv[1]);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-g") == 0) || (stricmp (argv[0], "--guid") == 0)) {
+ //
+ // Get the Capsule or Fv Guid
+ //
+ Status = StringToGuid (argv[1], &mCapDataInfo.CapGuid);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", EFI_GUID_STRING, argv[1]);
+ return STATUS_ERROR;
+ }
+ memcpy (&mFvDataInfo.FvFileSystemGuid, &mCapDataInfo.CapGuid, sizeof (EFI_GUID));
+ mFvDataInfo.FvFileSystemGuidSet = TRUE;
+ DebugMsg (NULL, 0, 9, "Capsule Guid", "%s = %s", EFI_CAPSULE_GUID_STRING, argv[1]);
+ DebugMsg (NULL, 0, 9, "FV Guid", "%s = %s", EFI_FV_FILESYSTEMGUID_STRING, argv[1]);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if (stricmp (argv[0], "--FvNameGuid") == 0) {
+ //
+ // Get Fv Name Guid
+ //
+ Status = StringToGuid (argv[1], &mFvDataInfo.FvNameGuid);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", EFI_GUID_STRING, argv[1]);
+ return STATUS_ERROR;
+ }
+ mFvDataInfo.FvNameGuidSet = TRUE;
+ DebugMsg (NULL, 0, 9, "FV Name Guid", "%s = %s", EFI_FV_NAMEGUID_STRING, argv[1]);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-p") == 0) || (stricmp (argv[0], "--dump") == 0)) {
+ DumpCapsule = TRUE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-m") == 0) || (stricmp (argv[0], "--map") == 0)) {
+ MapFileName = argv[1];
+ if (MapFileName == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Map file can't be null");
+ return STATUS_ERROR;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-v") == 0) || (stricmp (argv[0], "--verbose") == 0)) {
+ SetPrintLevel (VERBOSE_LOG_LEVEL);
+ VerboseMsg ("Verbose output Mode Set!");
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
+ SetPrintLevel (KEY_LOG_LEVEL);
+ KeyMsg ("Quiet output Mode Set!");
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--debug") == 0)) {
+ Status = AsciiStringToUint64 (argv[1], FALSE, &LogLevel);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ return STATUS_ERROR;
+ }
+ if (LogLevel > 9) {
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);
+ return STATUS_ERROR;
+ }
+ SetPrintLevel (LogLevel);
+ DebugMsg (NULL, 0, 9, "Debug Mode Set", "Debug Output Mode Level %s is set!", argv[1]);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ //
+ // Don't recognize the parameter.
+ //
+ Error (NULL, 0, 1000, "Unknown option", "%s", argv[0]);
+ return STATUS_ERROR;
+ }
+
+ VerboseMsg ("%s tool start.", UTILITY_NAME);
+
+ //
+ // check input parameter, InfFileName can be NULL
+ //
+ if (InfFileName == NULL && DumpCapsule) {
+ Error (NULL, 0, 1001, "Missing option", "Input Capsule Image");
+ return STATUS_ERROR;
+ }
+ VerboseMsg ("the input FvInf or CapInf file name is %s", InfFileName);
+
+ if (!DumpCapsule && OutFileName == NULL) {
+ Error (NULL, 0, 1001, "Missing option", "Output File");
+ return STATUS_ERROR;
+ }
+ if (OutFileName != NULL) {
+ VerboseMsg ("the output file name is %s", OutFileName);
+ }
+
+ //
+ // Read the INF file image
+ //
+ if (InfFileName != NULL) {
+ Status = GetFileImage (InfFileName, &InfFileImage, &InfFileSize);
+ if (EFI_ERROR (Status)) {
+ return STATUS_ERROR;
+ }
+ }
+
+ if (DumpCapsule) {
+ VerboseMsg ("Dump the capsule header information for the input capsule image %s", InfFileName);
+ //
+ // Dump Capsule Image Header Information
+ //
+ CapsuleHeader = (EFI_CAPSULE_HEADER *) InfFileImage;
+ if (OutFileName == NULL) {
+ FpFile = stdout;
+ } else {
+ FpFile = fopen (LongFilePath (OutFileName), "w");
+ if (FpFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", OutFileName);
+ return STATUS_ERROR;
+ }
+ }
+ if (FpFile != NULL) {
+ fprintf (FpFile, "Capsule %s Image Header Information\n", InfFileName);
+ fprintf (FpFile, " GUID %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X\n",
+ (unsigned) CapsuleHeader->CapsuleGuid.Data1,
+ (unsigned) CapsuleHeader->CapsuleGuid.Data2,
+ (unsigned) CapsuleHeader->CapsuleGuid.Data3,
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[0],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[1],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[2],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[3],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[4],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[5],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[6],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[7]);
+ fprintf (FpFile, " Header size 0x%08X\n", (unsigned) CapsuleHeader->HeaderSize);
+ fprintf (FpFile, " Flags 0x%08X\n", (unsigned) CapsuleHeader->Flags);
+ fprintf (FpFile, " Capsule image size 0x%08X\n", (unsigned) CapsuleHeader->CapsuleImageSize);
+ fclose (FpFile);
+ }
+ } else if (CapsuleFlag) {
+ VerboseMsg ("Create capsule image");
+ //
+ // Call the GenerateCapImage to generate Capsule Image
+ //
+ for (Index = 0; mFvDataInfo.FvFiles[Index][0] != '\0'; Index ++) {
+ strcpy (mCapDataInfo.CapFiles[Index], mFvDataInfo.FvFiles[Index]);
+ }
+
+ Status = GenerateCapImage (
+ InfFileImage,
+ InfFileSize,
+ OutFileName
+ );
+ } else {
+ VerboseMsg ("Create Fv image and its map file");
+ //
+ // Will take rebase action at below situation:
+ // 1. ForceRebase Flag specified to TRUE;
+ // 2. ForceRebase Flag not specified, BaseAddress greater than zero.
+ //
+ if (((mFvDataInfo.BaseAddress > 0) && (mFvDataInfo.ForceRebase == -1)) || (mFvDataInfo.ForceRebase == 1)) {
+ VerboseMsg ("FvImage Rebase Address is 0x%llX", (unsigned long long) mFvDataInfo.BaseAddress);
+ }
+ //
+ // Call the GenerateFvImage to generate Fv Image
+ //
+ Status = GenerateFvImage (
+ InfFileImage,
+ InfFileSize,
+ OutFileName,
+ MapFileName
+ );
+ }
+
+ //
+ // free InfFileImage memory
+ //
+ if (InfFileImage != NULL) {
+ free (InfFileImage);
+ }
+
+ //
+ // update boot driver address and runtime driver address in address file
+ //
+ if (Status == EFI_SUCCESS && AddrFileName != NULL && mFvBaseAddressNumber > 0) {
+ FpFile = fopen (LongFilePath (AddrFileName), "w");
+ if (FpFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", AddrFileName);
+ return STATUS_ERROR;
+ }
+ fprintf (FpFile, FV_BASE_ADDRESS_STRING);
+ fprintf (FpFile, "\n");
+ for (Index = 0; Index < mFvBaseAddressNumber; Index ++) {
+ fprintf (
+ FpFile,
+ "0x%llx\n",
+ (unsigned long long)mFvBaseAddress[Index]
+ );
+ }
+ fflush (FpFile);
+ fclose (FpFile);
+ }
+
+ if (Status == EFI_SUCCESS) {
+ DebugMsg (NULL, 0, 9, "The Total Fv Size", "%s = 0x%x", EFI_FV_TOTAL_SIZE_STRING, (unsigned) mFvTotalSize);
+ DebugMsg (NULL, 0, 9, "The used Fv Size", "%s = 0x%x", EFI_FV_TAKEN_SIZE_STRING, (unsigned) mFvTakenSize);
+ DebugMsg (NULL, 0, 9, "The space Fv size", "%s = 0x%x", EFI_FV_SPACE_SIZE_STRING, (unsigned) (mFvTotalSize - mFvTakenSize));
+ }
+
+ VerboseMsg ("%s tool done with return code is 0x%x.", UTILITY_NAME, GetUtilityStatus ());
+
+ return GetUtilityStatus ();
+}
diff --git a/roms/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/roms/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c
new file mode 100644
index 000000000..b5ffed93a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c
@@ -0,0 +1,4427 @@
+/** @file
+This file contains the internal functions required to generate a Firmware Volume.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
+Portions Copyright (c) 2016 HP Development Company, L.P.<BR>
+Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+//
+// Include files
+//
+
+#if defined(__FreeBSD__)
+#include <uuid.h>
+#elif defined(__GNUC__)
+#include <uuid/uuid.h>
+#endif
+#ifdef __GNUC__
+#include <sys/stat.h>
+#endif
+#include <string.h>
+#ifndef __GNUC__
+#include <io.h>
+#endif
+#include <assert.h>
+
+#include <Guid/FfsSectionAlignmentPadding.h>
+
+#include "WinNtInclude.h"
+#include "GenFvInternalLib.h"
+#include "FvLib.h"
+#include "PeCoffLib.h"
+
+#define ARMT_UNCONDITIONAL_JUMP_INSTRUCTION 0xEB000000
+#define ARM64_UNCONDITIONAL_JUMP_INSTRUCTION 0x14000000
+
+BOOLEAN mArm = FALSE;
+BOOLEAN mRiscV = FALSE;
+STATIC UINT32 MaxFfsAlignment = 0;
+BOOLEAN VtfFileFlag = FALSE;
+
+EFI_GUID mEfiFirmwareVolumeTopFileGuid = EFI_FFS_VOLUME_TOP_FILE_GUID;
+EFI_GUID mFileGuidArray [MAX_NUMBER_OF_FILES_IN_FV];
+EFI_GUID mZeroGuid = {0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
+EFI_GUID mDefaultCapsuleGuid = {0x3B6686BD, 0x0D76, 0x4030, { 0xB7, 0x0E, 0xB5, 0x51, 0x9E, 0x2F, 0xC5, 0xA0 }};
+EFI_GUID mEfiFfsSectionAlignmentPaddingGuid = EFI_FFS_SECTION_ALIGNMENT_PADDING_GUID;
+
+CHAR8 *mFvbAttributeName[] = {
+ EFI_FVB2_READ_DISABLED_CAP_STRING,
+ EFI_FVB2_READ_ENABLED_CAP_STRING,
+ EFI_FVB2_READ_STATUS_STRING,
+ EFI_FVB2_WRITE_DISABLED_CAP_STRING,
+ EFI_FVB2_WRITE_ENABLED_CAP_STRING,
+ EFI_FVB2_WRITE_STATUS_STRING,
+ EFI_FVB2_LOCK_CAP_STRING,
+ EFI_FVB2_LOCK_STATUS_STRING,
+ NULL,
+ EFI_FVB2_STICKY_WRITE_STRING,
+ EFI_FVB2_MEMORY_MAPPED_STRING,
+ EFI_FVB2_ERASE_POLARITY_STRING,
+ EFI_FVB2_READ_LOCK_CAP_STRING,
+ EFI_FVB2_READ_LOCK_STATUS_STRING,
+ EFI_FVB2_WRITE_LOCK_CAP_STRING,
+ EFI_FVB2_WRITE_LOCK_STATUS_STRING
+};
+
+CHAR8 *mFvbAlignmentName[] = {
+ EFI_FVB2_ALIGNMENT_1_STRING,
+ EFI_FVB2_ALIGNMENT_2_STRING,
+ EFI_FVB2_ALIGNMENT_4_STRING,
+ EFI_FVB2_ALIGNMENT_8_STRING,
+ EFI_FVB2_ALIGNMENT_16_STRING,
+ EFI_FVB2_ALIGNMENT_32_STRING,
+ EFI_FVB2_ALIGNMENT_64_STRING,
+ EFI_FVB2_ALIGNMENT_128_STRING,
+ EFI_FVB2_ALIGNMENT_256_STRING,
+ EFI_FVB2_ALIGNMENT_512_STRING,
+ EFI_FVB2_ALIGNMENT_1K_STRING,
+ EFI_FVB2_ALIGNMENT_2K_STRING,
+ EFI_FVB2_ALIGNMENT_4K_STRING,
+ EFI_FVB2_ALIGNMENT_8K_STRING,
+ EFI_FVB2_ALIGNMENT_16K_STRING,
+ EFI_FVB2_ALIGNMENT_32K_STRING,
+ EFI_FVB2_ALIGNMENT_64K_STRING,
+ EFI_FVB2_ALIGNMENT_128K_STRING,
+ EFI_FVB2_ALIGNMENT_256K_STRING,
+ EFI_FVB2_ALIGNMENT_512K_STRING,
+ EFI_FVB2_ALIGNMENT_1M_STRING,
+ EFI_FVB2_ALIGNMENT_2M_STRING,
+ EFI_FVB2_ALIGNMENT_4M_STRING,
+ EFI_FVB2_ALIGNMENT_8M_STRING,
+ EFI_FVB2_ALIGNMENT_16M_STRING,
+ EFI_FVB2_ALIGNMENT_32M_STRING,
+ EFI_FVB2_ALIGNMENT_64M_STRING,
+ EFI_FVB2_ALIGNMENT_128M_STRING,
+ EFI_FVB2_ALIGNMENT_256M_STRING,
+ EFI_FVB2_ALIGNMENT_512M_STRING,
+ EFI_FVB2_ALIGNMENT_1G_STRING,
+ EFI_FVB2_ALIGNMENT_2G_STRING
+};
+
+//
+// This data array will be located at the base of the Firmware Volume Header (FVH)
+// in the boot block. It must not exceed 14 bytes of code. The last 2 bytes
+// will be used to keep the FVH checksum consistent.
+// This code will be run in response to a startup IPI for HT-enabled systems.
+//
+#define SIZEOF_STARTUP_DATA_ARRAY 0x10
+
+UINT8 m128kRecoveryStartupApDataArray[SIZEOF_STARTUP_DATA_ARRAY] = {
+ //
+ // EA D0 FF 00 F0 ; far jmp F000:FFD0
+ // 0, 0, 0, 0, 0, 0, 0, 0, 0, ; Reserved bytes
+ // 0, 0 ; Checksum Padding
+ //
+ 0xEA,
+ 0xD0,
+ 0xFF,
+ 0x0,
+ 0xF0,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00
+};
+
+UINT8 m64kRecoveryStartupApDataArray[SIZEOF_STARTUP_DATA_ARRAY] = {
+ //
+ // EB CE ; jmp short ($-0x30)
+ // ; (from offset 0x0 to offset 0xFFD0)
+ // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; Reserved bytes
+ // 0, 0 ; Checksum Padding
+ //
+ 0xEB,
+ 0xCE,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00
+};
+
+FV_INFO mFvDataInfo;
+CAP_INFO mCapDataInfo;
+BOOLEAN mIsLargeFfs = FALSE;
+
+EFI_PHYSICAL_ADDRESS mFvBaseAddress[0x10];
+UINT32 mFvBaseAddressNumber = 0;
+
+EFI_STATUS
+ParseFvInf (
+ IN MEMORY_FILE *InfFile,
+ OUT FV_INFO *FvInfo
+ )
+/*++
+
+Routine Description:
+
+ This function parses a FV.INF file and copies info into a FV_INFO structure.
+
+Arguments:
+
+ InfFile Memory file image.
+ FvInfo Information read from INF file.
+
+Returns:
+
+ EFI_SUCCESS INF file information successfully retrieved.
+ EFI_ABORTED INF file has an invalid format.
+ EFI_NOT_FOUND A required string was not found in the INF file.
+--*/
+{
+ CHAR8 Value[MAX_LONG_FILE_PATH];
+ UINT64 Value64;
+ UINTN Index;
+ UINTN Number;
+ EFI_STATUS Status;
+ EFI_GUID GuidValue;
+
+ //
+ // Read the FV base address
+ //
+ if (!mFvDataInfo.BaseAddressSet) {
+ Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_FV_BASE_ADDRESS_STRING, 0, Value);
+ if (Status == EFI_SUCCESS) {
+ //
+ // Get the base address
+ //
+ Status = AsciiStringToUint64 (Value, FALSE, &Value64);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 2000, "Invalid parameter", "%s = %s", EFI_FV_BASE_ADDRESS_STRING, Value);
+ return EFI_ABORTED;
+ }
+ DebugMsg (NULL, 0, 9, "rebase address", "%s = %s", EFI_FV_BASE_ADDRESS_STRING, Value);
+
+ FvInfo->BaseAddress = Value64;
+ FvInfo->BaseAddressSet = TRUE;
+ }
+ }
+
+ //
+ // Read the FV File System Guid
+ //
+ if (!FvInfo->FvFileSystemGuidSet) {
+ Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_FV_FILESYSTEMGUID_STRING, 0, Value);
+ if (Status == EFI_SUCCESS) {
+ //
+ // Get the guid value
+ //
+ Status = StringToGuid (Value, &GuidValue);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 2000, "Invalid parameter", "%s = %s", EFI_FV_FILESYSTEMGUID_STRING, Value);
+ return EFI_ABORTED;
+ }
+ memcpy (&FvInfo->FvFileSystemGuid, &GuidValue, sizeof (EFI_GUID));
+ FvInfo->FvFileSystemGuidSet = TRUE;
+ }
+ }
+
+ //
+ // Read the FV Extension Header File Name
+ //
+ Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FV_EXT_HEADER_FILE_NAME, 0, Value);
+ if (Status == EFI_SUCCESS) {
+ strcpy (FvInfo->FvExtHeaderFile, Value);
+ }
+
+ //
+ // Read the FV file name
+ //
+ Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_FV_FILE_NAME_STRING, 0, Value);
+ if (Status == EFI_SUCCESS) {
+ //
+ // copy the file name
+ //
+ strcpy (FvInfo->FvName, Value);
+ }
+
+ //
+ // Read Fv Attribute
+ //
+ for (Index = 0; Index < sizeof (mFvbAttributeName)/sizeof (CHAR8 *); Index ++) {
+ if ((mFvbAttributeName [Index] != NULL) && \
+ (FindToken (InfFile, ATTRIBUTES_SECTION_STRING, mFvbAttributeName [Index], 0, Value) == EFI_SUCCESS)) {
+ if ((strcmp (Value, TRUE_STRING) == 0) || (strcmp (Value, ONE_STRING) == 0)) {
+ FvInfo->FvAttributes |= 1 << Index;
+ } else if ((strcmp (Value, FALSE_STRING) != 0) && (strcmp (Value, ZERO_STRING) != 0)) {
+ Error (NULL, 0, 2000, "Invalid parameter", "%s expected %s | %s", mFvbAttributeName [Index], TRUE_STRING, FALSE_STRING);
+ return EFI_ABORTED;
+ }
+ }
+ }
+
+ //
+ // Read Fv Alignment
+ //
+ for (Index = 0; Index < sizeof (mFvbAlignmentName)/sizeof (CHAR8 *); Index ++) {
+ if (FindToken (InfFile, ATTRIBUTES_SECTION_STRING, mFvbAlignmentName [Index], 0, Value) == EFI_SUCCESS) {
+ if (strcmp (Value, TRUE_STRING) == 0) {
+ FvInfo->FvAttributes |= Index << 16;
+ DebugMsg (NULL, 0, 9, "FV file alignment", "Align = %s", mFvbAlignmentName [Index]);
+ break;
+ }
+ }
+ }
+
+ //
+ // Read weak alignment flag
+ //
+ Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FV_WEAK_ALIGNMENT_STRING, 0, Value);
+ if (Status == EFI_SUCCESS) {
+ if ((strcmp (Value, TRUE_STRING) == 0) || (strcmp (Value, ONE_STRING) == 0)) {
+ FvInfo->FvAttributes |= EFI_FVB2_WEAK_ALIGNMENT;
+ } else if ((strcmp (Value, FALSE_STRING) != 0) && (strcmp (Value, ZERO_STRING) != 0)) {
+ Error (NULL, 0, 2000, "Invalid parameter", "Weak alignment value expected one of TRUE, FALSE, 1 or 0.");
+ return EFI_ABORTED;
+ }
+ }
+
+ //
+ // Read block maps
+ //
+ for (Index = 0; Index < MAX_NUMBER_OF_FV_BLOCKS; Index++) {
+ if (FvInfo->FvBlocks[Index].Length == 0) {
+ //
+ // Read block size
+ //
+ Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_BLOCK_SIZE_STRING, Index, Value);
+
+ if (Status == EFI_SUCCESS) {
+ //
+ // Update the size of block
+ //
+ Status = AsciiStringToUint64 (Value, FALSE, &Value64);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 2000, "Invalid parameter", "%s = %s", EFI_BLOCK_SIZE_STRING, Value);
+ return EFI_ABORTED;
+ }
+
+ FvInfo->FvBlocks[Index].Length = (UINT32) Value64;
+ DebugMsg (NULL, 0, 9, "FV Block Size", "%s = %s", EFI_BLOCK_SIZE_STRING, Value);
+ } else {
+ //
+ // If there is no blocks size, but there is the number of block, then we have a mismatched pair
+ // and should return an error.
+ //
+ Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_NUM_BLOCKS_STRING, Index, Value);
+ if (!EFI_ERROR (Status)) {
+ Error (NULL, 0, 2000, "Invalid parameter", "both %s and %s must be specified.", EFI_NUM_BLOCKS_STRING, EFI_BLOCK_SIZE_STRING);
+ return EFI_ABORTED;
+ } else {
+ //
+ // We are done
+ //
+ break;
+ }
+ }
+
+ //
+ // Read blocks number
+ //
+ Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_NUM_BLOCKS_STRING, Index, Value);
+
+ if (Status == EFI_SUCCESS) {
+ //
+ // Update the number of blocks
+ //
+ Status = AsciiStringToUint64 (Value, FALSE, &Value64);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 2000, "Invalid parameter", "%s = %s", EFI_NUM_BLOCKS_STRING, Value);
+ return EFI_ABORTED;
+ }
+
+ FvInfo->FvBlocks[Index].NumBlocks = (UINT32) Value64;
+ DebugMsg (NULL, 0, 9, "FV Block Number", "%s = %s", EFI_NUM_BLOCKS_STRING, Value);
+ }
+ }
+ }
+
+ if (Index == 0) {
+ Error (NULL, 0, 2001, "Missing required argument", "block size.");
+ return EFI_ABORTED;
+ }
+
+ //
+ // Read files
+ //
+ Number = 0;
+ for (Number = 0; Number < MAX_NUMBER_OF_FILES_IN_FV; Number ++) {
+ if (FvInfo->FvFiles[Number][0] == '\0') {
+ break;
+ }
+ }
+
+ for (Index = 0; Number + Index < MAX_NUMBER_OF_FILES_IN_FV; Index++) {
+ //
+ // Read the FFS file list
+ //
+ Status = FindToken (InfFile, FILES_SECTION_STRING, EFI_FILE_NAME_STRING, Index, Value);
+
+ if (Status == EFI_SUCCESS) {
+ //
+ // Add the file
+ //
+ strcpy (FvInfo->FvFiles[Number + Index], Value);
+ DebugMsg (NULL, 0, 9, "FV component file", "the %uth name is %s", (unsigned) Index, Value);
+ } else {
+ break;
+ }
+ }
+
+ if ((Index + Number) == 0) {
+ Warning (NULL, 0, 0, "FV components are not specified.", NULL);
+ }
+
+ return EFI_SUCCESS;
+}
+
+VOID
+UpdateFfsFileState (
+ IN EFI_FFS_FILE_HEADER *FfsFile,
+ IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader
+ )
+/*++
+
+Routine Description:
+
+ This function changes the FFS file attributes based on the erase polarity
+ of the FV. Update the reserved bits of State to EFI_FVB2_ERASE_POLARITY.
+
+Arguments:
+
+ FfsFile File header.
+ FvHeader FV header.
+
+Returns:
+
+ None
+
+--*/
+{
+ if (FvHeader->Attributes & EFI_FVB2_ERASE_POLARITY) {
+ FfsFile->State = (UINT8)~(FfsFile->State);
+ // FfsFile->State |= ~(UINT8) EFI_FILE_ALL_STATE_BITS;
+ }
+}
+
+EFI_STATUS
+ReadFfsAlignment (
+ IN EFI_FFS_FILE_HEADER *FfsFile,
+ IN OUT UINT32 *Alignment
+ )
+/*++
+
+Routine Description:
+
+ This function determines the alignment of the FFS input file from the file
+ attributes.
+
+Arguments:
+
+ FfsFile FFS file to parse
+ Alignment The minimum required alignment offset of the FFS file
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully.
+ EFI_INVALID_PARAMETER One of the input parameters was invalid.
+ EFI_ABORTED An error occurred.
+
+--*/
+{
+ //
+ // Verify input parameters.
+ //
+ if (FfsFile == NULL || Alignment == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ switch ((FfsFile->Attributes >> 3) & 0x07) {
+
+ case 0:
+ //
+ // 1 byte alignment
+ //if bit 1 have set, 128K byte alignment
+ //
+ if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {
+ *Alignment = 17;
+ } else {
+ *Alignment = 0;
+ }
+ break;
+
+ case 1:
+ //
+ // 16 byte alignment
+ //if bit 1 have set, 256K byte alignment
+ //
+ if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {
+ *Alignment = 18;
+ } else {
+ *Alignment = 4;
+ }
+ break;
+
+ case 2:
+ //
+ // 128 byte alignment
+ //if bit 1 have set, 512K byte alignment
+ //
+ if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {
+ *Alignment = 19;
+ } else {
+ *Alignment = 7;
+ }
+ break;
+
+ case 3:
+ //
+ // 512 byte alignment
+ //if bit 1 have set, 1M byte alignment
+ //
+ if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {
+ *Alignment = 20;
+ } else {
+ *Alignment = 9;
+ }
+ break;
+
+ case 4:
+ //
+ // 1K byte alignment
+ //if bit 1 have set, 2M byte alignment
+ //
+ if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {
+ *Alignment = 21;
+ } else {
+ *Alignment = 10;
+ }
+ break;
+
+ case 5:
+ //
+ // 4K byte alignment
+ //if bit 1 have set, 4M byte alignment
+ //
+ if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {
+ *Alignment = 22;
+ } else {
+ *Alignment = 12;
+ }
+ break;
+
+ case 6:
+ //
+ // 32K byte alignment
+ //if bit 1 have set , 8M byte alignment
+ //
+ if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {
+ *Alignment = 23;
+ } else {
+ *Alignment = 15;
+ }
+ break;
+
+ case 7:
+ //
+ // 64K byte alignment
+ //if bit 1 have set, 16M alignment
+ //
+ if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {
+ *Alignment = 24;
+ } else {
+ *Alignment = 16;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+AddPadFile (
+ IN OUT MEMORY_FILE *FvImage,
+ IN UINT32 DataAlignment,
+ IN VOID *FvEnd,
+ IN EFI_FIRMWARE_VOLUME_EXT_HEADER *ExtHeader,
+ IN UINT32 NextFfsSize
+ )
+/*++
+
+Routine Description:
+
+ This function adds a pad file to the FV image if it required to align the
+ data of the next file.
+
+Arguments:
+
+ FvImage The memory image of the FV to add it to.
+ The current offset must be valid.
+ DataAlignment The data alignment of the next FFS file.
+ FvEnd End of the empty data in FvImage.
+ ExtHeader PI FvExtHeader Optional
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully.
+ EFI_INVALID_PARAMETER One of the input parameters was invalid.
+ EFI_OUT_OF_RESOURCES Insufficient resources exist in the FV to complete
+ the pad file add.
+
+--*/
+{
+ EFI_FFS_FILE_HEADER *PadFile;
+ UINTN PadFileSize;
+ UINT32 NextFfsHeaderSize;
+ UINT32 CurFfsHeaderSize;
+ UINT32 Index;
+
+ Index = 0;
+ CurFfsHeaderSize = sizeof (EFI_FFS_FILE_HEADER);
+ //
+ // Verify input parameters.
+ //
+ if (FvImage == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Calculate the pad file size
+ //
+
+ //
+ // Append extension header size
+ //
+ if (ExtHeader != NULL) {
+ PadFileSize = ExtHeader->ExtHeaderSize;
+ if (PadFileSize + sizeof (EFI_FFS_FILE_HEADER) >= MAX_FFS_SIZE) {
+ CurFfsHeaderSize = sizeof (EFI_FFS_FILE_HEADER2);
+ }
+ PadFileSize += CurFfsHeaderSize;
+ } else {
+ NextFfsHeaderSize = sizeof (EFI_FFS_FILE_HEADER);
+ if (NextFfsSize >= MAX_FFS_SIZE) {
+ NextFfsHeaderSize = sizeof (EFI_FFS_FILE_HEADER2);
+ }
+ //
+ // Check if a pad file is necessary
+ //
+ if (((UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + NextFfsHeaderSize) % DataAlignment == 0) {
+ return EFI_SUCCESS;
+ }
+ PadFileSize = (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + sizeof (EFI_FFS_FILE_HEADER) + NextFfsHeaderSize;
+ //
+ // Add whatever it takes to get to the next aligned address
+ //
+ while ((PadFileSize % DataAlignment) != 0) {
+ PadFileSize++;
+ }
+ //
+ // Subtract the next file header size
+ //
+ PadFileSize -= NextFfsHeaderSize;
+ //
+ // Subtract the starting offset to get size
+ //
+ PadFileSize -= (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage;
+ }
+
+ //
+ // Verify that we have enough space for the file header
+ //
+ if (((UINTN) FvImage->CurrentFilePointer + PadFileSize) > (UINTN) FvEnd) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Write pad file header
+ //
+ PadFile = (EFI_FFS_FILE_HEADER *) FvImage->CurrentFilePointer;
+
+ //
+ // Write PadFile FFS header with PadType, don't need to set PAD file guid in its header.
+ //
+ PadFile->Type = EFI_FV_FILETYPE_FFS_PAD;
+ PadFile->Attributes = 0;
+
+ //
+ // Write pad file size (calculated size minus next file header size)
+ //
+ if (PadFileSize >= MAX_FFS_SIZE) {
+ memset(PadFile->Size, 0, sizeof(UINT8) * 3);
+ ((EFI_FFS_FILE_HEADER2 *)PadFile)->ExtendedSize = PadFileSize;
+ PadFile->Attributes |= FFS_ATTRIB_LARGE_FILE;
+ } else {
+ PadFile->Size[0] = (UINT8) (PadFileSize & 0xFF);
+ PadFile->Size[1] = (UINT8) ((PadFileSize >> 8) & 0xFF);
+ PadFile->Size[2] = (UINT8) ((PadFileSize >> 16) & 0xFF);
+ }
+
+ //
+ // Fill in checksums and state, they must be 0 for checksumming.
+ //
+ PadFile->IntegrityCheck.Checksum.Header = 0;
+ PadFile->IntegrityCheck.Checksum.File = 0;
+ PadFile->State = 0;
+ PadFile->IntegrityCheck.Checksum.Header = CalculateChecksum8 ((UINT8 *) PadFile, CurFfsHeaderSize);
+ PadFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
+
+ PadFile->State = EFI_FILE_HEADER_CONSTRUCTION | EFI_FILE_HEADER_VALID | EFI_FILE_DATA_VALID;
+ UpdateFfsFileState (
+ (EFI_FFS_FILE_HEADER *) PadFile,
+ (EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage
+ );
+
+ //
+ // Update the current FV pointer
+ //
+ FvImage->CurrentFilePointer += PadFileSize;
+
+ if (ExtHeader != NULL) {
+ //
+ // Copy Fv Extension Header and Set Fv Extension header offset
+ //
+ if (ExtHeader->ExtHeaderSize > sizeof (EFI_FIRMWARE_VOLUME_EXT_HEADER)) {
+ for (Index = sizeof (EFI_FIRMWARE_VOLUME_EXT_HEADER); Index < ExtHeader->ExtHeaderSize;) {
+ if (((EFI_FIRMWARE_VOLUME_EXT_ENTRY *)((UINT8 *)ExtHeader + Index))-> ExtEntryType == EFI_FV_EXT_TYPE_USED_SIZE_TYPE) {
+ if (VtfFileFlag) {
+ ((EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE *)((UINT8 *)ExtHeader + Index))->UsedSize = mFvTotalSize;
+ } else {
+ ((EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE *)((UINT8 *)ExtHeader + Index))->UsedSize = mFvTakenSize;
+ }
+ break;
+ }
+ Index += ((EFI_FIRMWARE_VOLUME_EXT_ENTRY *)((UINT8 *)ExtHeader + Index))-> ExtEntrySize;
+ }
+ }
+ memcpy ((UINT8 *)PadFile + CurFfsHeaderSize, ExtHeader, ExtHeader->ExtHeaderSize);
+ ((EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage)->ExtHeaderOffset = (UINT16) ((UINTN) ((UINT8 *)PadFile + CurFfsHeaderSize) - (UINTN) FvImage->FileImage);
+ //
+ // Make next file start at QWord Boundary
+ //
+ while (((UINTN) FvImage->CurrentFilePointer & (EFI_FFS_FILE_HEADER_ALIGNMENT - 1)) != 0) {
+ FvImage->CurrentFilePointer++;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+BOOLEAN
+IsVtfFile (
+ IN EFI_FFS_FILE_HEADER *FileBuffer
+ )
+/*++
+
+Routine Description:
+
+ This function checks the header to validate if it is a VTF file
+
+Arguments:
+
+ FileBuffer Buffer in which content of a file has been read.
+
+Returns:
+
+ TRUE If this is a VTF file
+ FALSE If this is not a VTF file
+
+--*/
+{
+ if (!memcmp (&FileBuffer->Name, &mEfiFirmwareVolumeTopFileGuid, sizeof (EFI_GUID))) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+EFI_STATUS
+WriteMapFile (
+ IN OUT FILE *FvMapFile,
+ IN CHAR8 *FileName,
+ IN EFI_FFS_FILE_HEADER *FfsFile,
+ IN EFI_PHYSICAL_ADDRESS ImageBaseAddress,
+ IN PE_COFF_LOADER_IMAGE_CONTEXT *pImageContext
+ )
+/*++
+
+Routine Description:
+
+ This function gets the basic debug information (entrypoint, baseaddress, .text, .data section base address)
+ from PE/COFF image and abstracts Pe Map file information and add them into FvMap file for Debug.
+
+Arguments:
+
+ FvMapFile A pointer to FvMap File
+ FileName Ffs File PathName
+ FfsFile A pointer to Ffs file image.
+ ImageBaseAddress PeImage Base Address.
+ pImageContext Image Context Information.
+
+Returns:
+
+ EFI_SUCCESS Added required map information.
+
+--*/
+{
+ CHAR8 PeMapFileName [MAX_LONG_FILE_PATH];
+ CHAR8 *Cptr, *Cptr2;
+ CHAR8 FileGuidName [MAX_LINE_LEN];
+ FILE *PeMapFile;
+ CHAR8 Line [MAX_LINE_LEN];
+ CHAR8 KeyWord [MAX_LINE_LEN];
+ CHAR8 KeyWord2 [MAX_LINE_LEN];
+ CHAR8 FunctionName [MAX_LINE_LEN];
+ EFI_PHYSICAL_ADDRESS FunctionAddress;
+ UINT32 FunctionType;
+ CHAR8 FunctionTypeName [MAX_LINE_LEN];
+ UINT32 Index;
+ UINT32 AddressOfEntryPoint;
+ UINT32 Offset;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
+ EFI_TE_IMAGE_HEADER *TEImageHeader;
+ EFI_IMAGE_SECTION_HEADER *SectionHeader;
+ long long TempLongAddress;
+ UINT32 TextVirtualAddress;
+ UINT32 DataVirtualAddress;
+ EFI_PHYSICAL_ADDRESS LinkTimeBaseAddress;
+ BOOLEAN IsUseClang;
+
+ //
+ // Init local variable
+ //
+ FunctionType = 0;
+ //
+ // Print FileGuid to string buffer.
+ //
+ PrintGuidToBuffer (&FfsFile->Name, (UINT8 *)FileGuidName, MAX_LINE_LEN, TRUE);
+
+ //
+ // Construct Map file Name
+ //
+ if (strlen (FileName) >= MAX_LONG_FILE_PATH) {
+ return EFI_ABORTED;
+ }
+ strncpy (PeMapFileName, FileName, MAX_LONG_FILE_PATH - 1);
+ PeMapFileName[MAX_LONG_FILE_PATH - 1] = 0;
+
+ //
+ // Change '\\' to '/', unified path format.
+ //
+ Cptr = PeMapFileName;
+ while (*Cptr != '\0') {
+ if (*Cptr == '\\') {
+ *Cptr = FILE_SEP_CHAR;
+ }
+ Cptr ++;
+ }
+
+ //
+ // Get Map file
+ //
+ Cptr = PeMapFileName + strlen (PeMapFileName);
+ while ((*Cptr != '.') && (Cptr >= PeMapFileName)) {
+ Cptr --;
+ }
+ if (Cptr < PeMapFileName) {
+ return EFI_NOT_FOUND;
+ } else {
+ *(Cptr + 1) = 'm';
+ *(Cptr + 2) = 'a';
+ *(Cptr + 3) = 'p';
+ *(Cptr + 4) = '\0';
+ }
+
+ //
+ // Get module Name
+ //
+ Cptr2 = Cptr;
+ while ((*Cptr != FILE_SEP_CHAR) && (Cptr >= PeMapFileName)) {
+ Cptr --;
+ }
+ *Cptr2 = '\0';
+ if (strlen (Cptr + 1) >= MAX_LINE_LEN) {
+ return EFI_ABORTED;
+ }
+ strncpy (KeyWord, Cptr + 1, MAX_LINE_LEN - 1);
+ KeyWord[MAX_LINE_LEN - 1] = 0;
+ *Cptr2 = '.';
+
+ //
+ // AddressOfEntryPoint and Offset in Image
+ //
+ if (!pImageContext->IsTeImage) {
+ ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) ((UINT8 *) pImageContext->Handle + pImageContext->PeCoffHeaderOffset);
+ AddressOfEntryPoint = ImgHdr->Pe32.OptionalHeader.AddressOfEntryPoint;
+ Offset = 0;
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
+ (UINT8 *) ImgHdr +
+ sizeof (UINT32) +
+ sizeof (EFI_IMAGE_FILE_HEADER) +
+ ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
+ );
+ Index = ImgHdr->Pe32.FileHeader.NumberOfSections;
+ } else {
+ TEImageHeader = (EFI_TE_IMAGE_HEADER *) pImageContext->Handle;
+ AddressOfEntryPoint = TEImageHeader->AddressOfEntryPoint;
+ Offset = TEImageHeader->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (TEImageHeader + 1);
+ Index = TEImageHeader->NumberOfSections;
+ }
+
+ //
+ // module information output
+ //
+ if (ImageBaseAddress == 0) {
+ fprintf (FvMapFile, "%s (dummy) (", KeyWord);
+ fprintf (FvMapFile, "BaseAddress=%010llx, ", (unsigned long long) ImageBaseAddress);
+ } else {
+ fprintf (FvMapFile, "%s (Fixed Flash Address, ", KeyWord);
+ fprintf (FvMapFile, "BaseAddress=0x%010llx, ", (unsigned long long) (ImageBaseAddress + Offset));
+ }
+
+ fprintf (FvMapFile, "EntryPoint=0x%010llx", (unsigned long long) (ImageBaseAddress + AddressOfEntryPoint));
+ fprintf (FvMapFile, ")\n");
+
+ fprintf (FvMapFile, "(GUID=%s", FileGuidName);
+ TextVirtualAddress = 0;
+ DataVirtualAddress = 0;
+ for (; Index > 0; Index --, SectionHeader ++) {
+ if (stricmp ((CHAR8 *)SectionHeader->Name, ".text") == 0) {
+ TextVirtualAddress = SectionHeader->VirtualAddress;
+ } else if (stricmp ((CHAR8 *)SectionHeader->Name, ".data") == 0) {
+ DataVirtualAddress = SectionHeader->VirtualAddress;
+ } else if (stricmp ((CHAR8 *)SectionHeader->Name, ".sdata") == 0) {
+ DataVirtualAddress = SectionHeader->VirtualAddress;
+ }
+ }
+ fprintf (FvMapFile, " .textbaseaddress=0x%010llx", (unsigned long long) (ImageBaseAddress + TextVirtualAddress));
+ fprintf (FvMapFile, " .databaseaddress=0x%010llx", (unsigned long long) (ImageBaseAddress + DataVirtualAddress));
+ fprintf (FvMapFile, ")\n\n");
+
+ //
+ // Open PeMapFile
+ //
+ PeMapFile = fopen (LongFilePath (PeMapFileName), "r");
+ if (PeMapFile == NULL) {
+ // fprintf (stdout, "can't open %s file to reading\n", PeMapFileName);
+ return EFI_ABORTED;
+ }
+ VerboseMsg ("The map file is %s", PeMapFileName);
+
+ //
+ // Output Functions information into Fv Map file
+ //
+ LinkTimeBaseAddress = 0;
+ IsUseClang = FALSE;
+ while (fgets (Line, MAX_LINE_LEN, PeMapFile) != NULL) {
+ //
+ // Skip blank line
+ //
+ if (Line[0] == 0x0a) {
+ FunctionType = 0;
+ continue;
+ }
+ //
+ // By Address and Static keyword
+ //
+ if (FunctionType == 0) {
+ sscanf (Line, "%s", KeyWord);
+ if (stricmp (KeyWord, "Address") == 0) {
+ sscanf (Line, "%s %s", KeyWord, KeyWord2);
+ if (stricmp (KeyWord2, "Size") == 0) {
+ IsUseClang = TRUE;
+ FunctionType = 1;
+ continue;
+ }
+ //
+ // function list
+ //
+ FunctionType = 1;
+ fgets (Line, MAX_LINE_LEN, PeMapFile);
+ } else if (stricmp (KeyWord, "Static") == 0) {
+ //
+ // static function list
+ //
+ FunctionType = 2;
+ fgets (Line, MAX_LINE_LEN, PeMapFile);
+ } else if (stricmp (KeyWord, "Preferred") ==0) {
+ sscanf (Line + strlen (" Preferred load address is"), "%llx", &TempLongAddress);
+ LinkTimeBaseAddress = (UINT64) TempLongAddress;
+ }
+ continue;
+ }
+ //
+ // Printf Function Information
+ //
+ if (FunctionType == 1) {
+ if (IsUseClang) {
+ sscanf (Line, "%llx %s %s %s", &TempLongAddress, KeyWord, KeyWord2, FunctionTypeName);
+ FunctionAddress = (UINT64) TempLongAddress;
+ if (FunctionTypeName [0] == '_' ) {
+ fprintf (FvMapFile, " 0x%010llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress - LinkTimeBaseAddress));
+ fprintf (FvMapFile, "%s\n", FunctionTypeName);
+ }
+ } else {
+ sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName);
+ FunctionAddress = (UINT64) TempLongAddress;
+ if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) {
+ fprintf (FvMapFile, " 0x%010llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress - LinkTimeBaseAddress));
+ fprintf (FvMapFile, "%s\n", FunctionName);
+ }
+ }
+ } else if (FunctionType == 2) {
+ sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName);
+ FunctionAddress = (UINT64) TempLongAddress;
+ if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) {
+ fprintf (FvMapFile, " 0x%010llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress - LinkTimeBaseAddress));
+ fprintf (FvMapFile, "%s\n", FunctionName);
+ }
+ }
+ }
+ //
+ // Close PeMap file
+ //
+ fprintf (FvMapFile, "\n\n");
+ fclose (PeMapFile);
+
+ return EFI_SUCCESS;
+}
+
+STATIC
+BOOLEAN
+AdjustInternalFfsPadding (
+ IN OUT EFI_FFS_FILE_HEADER *FfsFile,
+ IN OUT MEMORY_FILE *FvImage,
+ IN UINTN Alignment,
+ IN OUT UINTN *FileSize
+ )
+/*++
+
+Routine Description:
+
+ This function looks for a dedicated alignment padding section in the FFS, and
+ shrinks it to the size required to line up subsequent sections correctly.
+
+Arguments:
+
+ FfsFile A pointer to Ffs file image.
+ FvImage The memory image of the FV to adjust it to.
+ Alignment Current file alignment
+ FileSize Reference to a variable holding the size of the FFS file
+
+Returns:
+
+ TRUE Padding section was found and updated successfully
+ FALSE Otherwise
+
+--*/
+{
+ EFI_FILE_SECTION_POINTER PadSection;
+ UINT8 *Remainder;
+ EFI_STATUS Status;
+ UINT32 FfsHeaderLength;
+ UINT32 FfsFileLength;
+ UINT32 PadSize;
+ UINTN Misalignment;
+ EFI_FFS_INTEGRITY_CHECK *IntegrityCheck;
+
+ //
+ // Figure out the misalignment: all FFS sections are aligned relative to the
+ // start of the FFS payload, so use that as the base of the misalignment
+ // computation.
+ //
+ FfsHeaderLength = GetFfsHeaderLength(FfsFile);
+ Misalignment = (UINTN) FvImage->CurrentFilePointer -
+ (UINTN) FvImage->FileImage + FfsHeaderLength;
+ Misalignment &= Alignment - 1;
+ if (Misalignment == 0) {
+ // Nothing to do, return success
+ return TRUE;
+ }
+
+ //
+ // We only apply this optimization to FFS files with the FIXED attribute set,
+ // since the FFS will not be loadable at arbitrary offsets anymore after
+ // we adjust the size of the padding section.
+ //
+ if ((FfsFile->Attributes & FFS_ATTRIB_FIXED) == 0) {
+ return FALSE;
+ }
+
+ //
+ // Look for a dedicated padding section that we can adjust to compensate
+ // for the misalignment. If such a padding section exists, it precedes all
+ // sections with alignment requirements, and so the adjustment will correct
+ // all of them.
+ //
+ Status = GetSectionByType (FfsFile, EFI_SECTION_FREEFORM_SUBTYPE_GUID, 1,
+ &PadSection);
+ if (EFI_ERROR (Status) ||
+ CompareGuid (&PadSection.FreeformSubtypeSection->SubTypeGuid,
+ &mEfiFfsSectionAlignmentPaddingGuid) != 0) {
+ return FALSE;
+ }
+
+ //
+ // Find out if the size of the padding section is sufficient to compensate
+ // for the misalignment.
+ //
+ PadSize = GetSectionFileLength (PadSection.CommonHeader);
+ if (Misalignment > PadSize - sizeof (EFI_FREEFORM_SUBTYPE_GUID_SECTION)) {
+ return FALSE;
+ }
+
+ //
+ // Move the remainder of the FFS file towards the front, and adjust the
+ // file size output parameter.
+ //
+ Remainder = (UINT8 *) PadSection.CommonHeader + PadSize;
+ memmove (Remainder - Misalignment, Remainder,
+ *FileSize - (UINTN) (Remainder - (UINTN) FfsFile));
+ *FileSize -= Misalignment;
+
+ //
+ // Update the padding section's length with the new values. Note that the
+ // padding is always < 64 KB, so we can ignore EFI_COMMON_SECTION_HEADER2
+ // ExtendedSize.
+ //
+ PadSize -= Misalignment;
+ PadSection.CommonHeader->Size[0] = (UINT8) (PadSize & 0xff);
+ PadSection.CommonHeader->Size[1] = (UINT8) ((PadSize & 0xff00) >> 8);
+ PadSection.CommonHeader->Size[2] = (UINT8) ((PadSize & 0xff0000) >> 16);
+
+ //
+ // Update the FFS header with the new overall length
+ //
+ FfsFileLength = GetFfsFileLength (FfsFile) - Misalignment;
+ if (FfsHeaderLength > sizeof(EFI_FFS_FILE_HEADER)) {
+ ((EFI_FFS_FILE_HEADER2 *)FfsFile)->ExtendedSize = FfsFileLength;
+ } else {
+ FfsFile->Size[0] = (UINT8) (FfsFileLength & 0x000000FF);
+ FfsFile->Size[1] = (UINT8) ((FfsFileLength & 0x0000FF00) >> 8);
+ FfsFile->Size[2] = (UINT8) ((FfsFileLength & 0x00FF0000) >> 16);
+ }
+
+ //
+ // Clear the alignment bits: these have become meaningless now that we have
+ // adjusted the padding section.
+ //
+ FfsFile->Attributes &= ~(FFS_ATTRIB_DATA_ALIGNMENT | FFS_ATTRIB_DATA_ALIGNMENT2);
+
+ //
+ // Recalculate the FFS header checksum. Instead of setting Header and State
+ // both to zero, set Header to (UINT8)(-State) so State preserves its original
+ // value
+ //
+ IntegrityCheck = &FfsFile->IntegrityCheck;
+ IntegrityCheck->Checksum.Header = (UINT8) (0x100 - FfsFile->State);
+ IntegrityCheck->Checksum.File = 0;
+
+ IntegrityCheck->Checksum.Header = CalculateChecksum8 (
+ (UINT8 *) FfsFile, FfsHeaderLength);
+
+ if (FfsFile->Attributes & FFS_ATTRIB_CHECKSUM) {
+ //
+ // Ffs header checksum = zero, so only need to calculate ffs body.
+ //
+ IntegrityCheck->Checksum.File = CalculateChecksum8 (
+ (UINT8 *) FfsFile + FfsHeaderLength,
+ FfsFileLength - FfsHeaderLength);
+ } else {
+ IntegrityCheck->Checksum.File = FFS_FIXED_CHECKSUM;
+ }
+
+ return TRUE;
+}
+
+EFI_STATUS
+AddFile (
+ IN OUT MEMORY_FILE *FvImage,
+ IN FV_INFO *FvInfo,
+ IN UINTN Index,
+ IN OUT EFI_FFS_FILE_HEADER **VtfFileImage,
+ IN FILE *FvMapFile,
+ IN FILE *FvReportFile
+ )
+/*++
+
+Routine Description:
+
+ This function adds a file to the FV image. The file will pad to the
+ appropriate alignment if required.
+
+Arguments:
+
+ FvImage The memory image of the FV to add it to. The current offset
+ must be valid.
+ FvInfo Pointer to information about the FV.
+ Index The file in the FvInfo file list to add.
+ VtfFileImage A pointer to the VTF file within the FvImage. If this is equal
+ to the end of the FvImage then no VTF previously found.
+ FvMapFile Pointer to FvMap File
+ FvReportFile Pointer to FvReport File
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully.
+ EFI_INVALID_PARAMETER One of the input parameters was invalid.
+ EFI_ABORTED An error occurred.
+ EFI_OUT_OF_RESOURCES Insufficient resources exist to complete the add.
+
+--*/
+{
+ FILE *NewFile;
+ UINTN FileSize;
+ UINT8 *FileBuffer;
+ UINTN NumBytesRead;
+ UINT32 CurrentFileAlignment;
+ EFI_STATUS Status;
+ UINTN Index1;
+ UINT8 FileGuidString[PRINTED_GUID_BUFFER_SIZE];
+
+ Index1 = 0;
+ //
+ // Verify input parameters.
+ //
+ if (FvImage == NULL || FvInfo == NULL || FvInfo->FvFiles[Index][0] == 0 || VtfFileImage == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Read the file to add
+ //
+ NewFile = fopen (LongFilePath (FvInfo->FvFiles[Index]), "rb");
+
+ if (NewFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", FvInfo->FvFiles[Index]);
+ return EFI_ABORTED;
+ }
+
+ //
+ // Get the file size
+ //
+ FileSize = _filelength (fileno (NewFile));
+
+ //
+ // Read the file into a buffer
+ //
+ FileBuffer = malloc (FileSize);
+ if (FileBuffer == NULL) {
+ fclose (NewFile);
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ NumBytesRead = fread (FileBuffer, sizeof (UINT8), FileSize, NewFile);
+
+ //
+ // Done with the file, from this point on we will just use the buffer read.
+ //
+ fclose (NewFile);
+
+ //
+ // Verify read successful
+ //
+ if (NumBytesRead != sizeof (UINT8) * FileSize) {
+ free (FileBuffer);
+ Error (NULL, 0, 0004, "Error reading file", FvInfo->FvFiles[Index]);
+ return EFI_ABORTED;
+ }
+
+ //
+ // For None PI Ffs file, directly add them into FvImage.
+ //
+ if (!FvInfo->IsPiFvImage) {
+ memcpy (FvImage->CurrentFilePointer, FileBuffer, FileSize);
+ if (FvInfo->SizeofFvFiles[Index] > FileSize) {
+ FvImage->CurrentFilePointer += FvInfo->SizeofFvFiles[Index];
+ } else {
+ FvImage->CurrentFilePointer += FileSize;
+ }
+ goto Done;
+ }
+
+ //
+ // Verify Ffs file
+ //
+ Status = VerifyFfsFile ((EFI_FFS_FILE_HEADER *)FileBuffer);
+ if (EFI_ERROR (Status)) {
+ free (FileBuffer);
+ Error (NULL, 0, 3000, "Invalid", "%s is not a valid FFS file.", FvInfo->FvFiles[Index]);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Verify space exists to add the file
+ //
+ if (FileSize > (UINTN) ((UINTN) *VtfFileImage - (UINTN) FvImage->CurrentFilePointer)) {
+ free (FileBuffer);
+ Error (NULL, 0, 4002, "Resource", "FV space is full, not enough room to add file %s.", FvInfo->FvFiles[Index]);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Verify the input file is the duplicated file in this Fv image
+ //
+ for (Index1 = 0; Index1 < Index; Index1 ++) {
+ if (CompareGuid ((EFI_GUID *) FileBuffer, &mFileGuidArray [Index1]) == 0) {
+ Error (NULL, 0, 2000, "Invalid parameter", "the %dth file and %uth file have the same file GUID.", (unsigned) Index1 + 1, (unsigned) Index + 1);
+ PrintGuid ((EFI_GUID *) FileBuffer);
+ free (FileBuffer);
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+ CopyMem (&mFileGuidArray [Index], FileBuffer, sizeof (EFI_GUID));
+
+ //
+ // Update the file state based on polarity of the FV.
+ //
+ UpdateFfsFileState (
+ (EFI_FFS_FILE_HEADER *) FileBuffer,
+ (EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage
+ );
+
+ //
+ // Check if alignment is required
+ //
+ ReadFfsAlignment ((EFI_FFS_FILE_HEADER *) FileBuffer, &CurrentFileAlignment);
+
+ //
+ // Find the largest alignment of all the FFS files in the FV
+ //
+ if (CurrentFileAlignment > MaxFfsAlignment) {
+ MaxFfsAlignment = CurrentFileAlignment;
+ }
+ //
+ // If we have a VTF file, add it at the top.
+ //
+ if (IsVtfFile ((EFI_FFS_FILE_HEADER *) FileBuffer)) {
+ if ((UINTN) *VtfFileImage == (UINTN) FvImage->Eof) {
+ //
+ // No previous VTF, add this one.
+ //
+ *VtfFileImage = (EFI_FFS_FILE_HEADER *) (UINTN) ((UINTN) FvImage->FileImage + FvInfo->Size - FileSize);
+ //
+ // Sanity check. The file MUST align appropriately
+ //
+ if (((UINTN) *VtfFileImage + GetFfsHeaderLength((EFI_FFS_FILE_HEADER *)FileBuffer) - (UINTN) FvImage->FileImage) % (1 << CurrentFileAlignment)) {
+ Error (NULL, 0, 3000, "Invalid", "VTF file cannot be aligned on a %u-byte boundary.", (unsigned) (1 << CurrentFileAlignment));
+ free (FileBuffer);
+ return EFI_ABORTED;
+ }
+ //
+ // Rebase the PE or TE image in FileBuffer of FFS file for XIP
+ // Rebase for the debug genfvmap tool
+ //
+ Status = FfsRebase (FvInfo, FvInfo->FvFiles[Index], (EFI_FFS_FILE_HEADER *) FileBuffer, (UINTN) *VtfFileImage - (UINTN) FvImage->FileImage, FvMapFile);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "Could not rebase %s.", FvInfo->FvFiles[Index]);
+ return Status;
+ }
+ //
+ // copy VTF File
+ //
+ memcpy (*VtfFileImage, FileBuffer, FileSize);
+
+ PrintGuidToBuffer ((EFI_GUID *) FileBuffer, FileGuidString, sizeof (FileGuidString), TRUE);
+ fprintf (FvReportFile, "0x%08X %s\n", (unsigned)(UINTN) (((UINT8 *)*VtfFileImage) - (UINTN)FvImage->FileImage), FileGuidString);
+
+ free (FileBuffer);
+ DebugMsg (NULL, 0, 9, "Add VTF FFS file in FV image", NULL);
+ return EFI_SUCCESS;
+ } else {
+ //
+ // Already found a VTF file.
+ //
+ Error (NULL, 0, 3000, "Invalid", "multiple VTF files are not permitted within a single FV.");
+ free (FileBuffer);
+ return EFI_ABORTED;
+ }
+ }
+
+ //
+ // Add pad file if necessary
+ //
+ if (!AdjustInternalFfsPadding ((EFI_FFS_FILE_HEADER *) FileBuffer, FvImage,
+ 1 << CurrentFileAlignment, &FileSize)) {
+ Status = AddPadFile (FvImage, 1 << CurrentFileAlignment, *VtfFileImage, NULL, FileSize);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 4002, "Resource", "FV space is full, could not add pad file for data alignment property.");
+ free (FileBuffer);
+ return EFI_ABORTED;
+ }
+ }
+ //
+ // Add file
+ //
+ if ((UINTN) (FvImage->CurrentFilePointer + FileSize) <= (UINTN) (*VtfFileImage)) {
+ //
+ // Rebase the PE or TE image in FileBuffer of FFS file for XIP.
+ // Rebase Bs and Rt drivers for the debug genfvmap tool.
+ //
+ Status = FfsRebase (FvInfo, FvInfo->FvFiles[Index], (EFI_FFS_FILE_HEADER *) FileBuffer, (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage, FvMapFile);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "Could not rebase %s.", FvInfo->FvFiles[Index]);
+ return Status;
+ }
+ //
+ // Copy the file
+ //
+ memcpy (FvImage->CurrentFilePointer, FileBuffer, FileSize);
+ PrintGuidToBuffer ((EFI_GUID *) FileBuffer, FileGuidString, sizeof (FileGuidString), TRUE);
+ fprintf (FvReportFile, "0x%08X %s\n", (unsigned) (FvImage->CurrentFilePointer - FvImage->FileImage), FileGuidString);
+ FvImage->CurrentFilePointer += FileSize;
+ } else {
+ Error (NULL, 0, 4002, "Resource", "FV space is full, cannot add file %s.", FvInfo->FvFiles[Index]);
+ free (FileBuffer);
+ return EFI_ABORTED;
+ }
+ //
+ // Make next file start at QWord Boundary
+ //
+ while (((UINTN) FvImage->CurrentFilePointer & (EFI_FFS_FILE_HEADER_ALIGNMENT - 1)) != 0) {
+ FvImage->CurrentFilePointer++;
+ }
+
+Done:
+ //
+ // Free allocated memory.
+ //
+ free (FileBuffer);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+PadFvImage (
+ IN MEMORY_FILE *FvImage,
+ IN EFI_FFS_FILE_HEADER *VtfFileImage
+ )
+/*++
+
+Routine Description:
+
+ This function places a pad file between the last file in the FV and the VTF
+ file if the VTF file exists.
+
+Arguments:
+
+ FvImage Memory file for the FV memory image
+ VtfFileImage The address of the VTF file. If this is the end of the FV
+ image, no VTF exists and no pad file is needed.
+
+Returns:
+
+ EFI_SUCCESS Completed successfully.
+ EFI_INVALID_PARAMETER One of the input parameters was NULL.
+
+--*/
+{
+ EFI_FFS_FILE_HEADER *PadFile;
+ UINTN FileSize;
+ UINT32 FfsHeaderSize;
+
+ //
+ // If there is no VTF or the VTF naturally follows the previous file without a
+ // pad file, then there's nothing to do
+ //
+ if ((UINTN) VtfFileImage == (UINTN) FvImage->Eof || \
+ ((UINTN) VtfFileImage == (UINTN) FvImage->CurrentFilePointer)) {
+ return EFI_SUCCESS;
+ }
+
+ if ((UINTN) VtfFileImage < (UINTN) FvImage->CurrentFilePointer) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Pad file starts at beginning of free space
+ //
+ PadFile = (EFI_FFS_FILE_HEADER *) FvImage->CurrentFilePointer;
+
+ //
+ // write PadFile FFS header with PadType, don't need to set PAD file guid in its header.
+ //
+ PadFile->Type = EFI_FV_FILETYPE_FFS_PAD;
+ PadFile->Attributes = 0;
+
+ //
+ // FileSize includes the EFI_FFS_FILE_HEADER
+ //
+ FileSize = (UINTN) VtfFileImage - (UINTN) FvImage->CurrentFilePointer;
+ if (FileSize >= MAX_FFS_SIZE) {
+ PadFile->Attributes |= FFS_ATTRIB_LARGE_FILE;
+ memset(PadFile->Size, 0, sizeof(UINT8) * 3);
+ ((EFI_FFS_FILE_HEADER2 *)PadFile)->ExtendedSize = FileSize;
+ FfsHeaderSize = sizeof(EFI_FFS_FILE_HEADER2);
+ mIsLargeFfs = TRUE;
+ } else {
+ PadFile->Size[0] = (UINT8) (FileSize & 0x000000FF);
+ PadFile->Size[1] = (UINT8) ((FileSize & 0x0000FF00) >> 8);
+ PadFile->Size[2] = (UINT8) ((FileSize & 0x00FF0000) >> 16);
+ FfsHeaderSize = sizeof(EFI_FFS_FILE_HEADER);
+ }
+
+ //
+ // Fill in checksums and state, must be zero during checksum calculation.
+ //
+ PadFile->IntegrityCheck.Checksum.Header = 0;
+ PadFile->IntegrityCheck.Checksum.File = 0;
+ PadFile->State = 0;
+ PadFile->IntegrityCheck.Checksum.Header = CalculateChecksum8 ((UINT8 *) PadFile, FfsHeaderSize);
+ PadFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
+
+ PadFile->State = EFI_FILE_HEADER_CONSTRUCTION | EFI_FILE_HEADER_VALID | EFI_FILE_DATA_VALID;
+
+ UpdateFfsFileState (
+ (EFI_FFS_FILE_HEADER *) PadFile,
+ (EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage
+ );
+ //
+ // Update the current FV pointer
+ //
+ FvImage->CurrentFilePointer = FvImage->Eof;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+UpdateResetVector (
+ IN MEMORY_FILE *FvImage,
+ IN FV_INFO *FvInfo,
+ IN EFI_FFS_FILE_HEADER *VtfFile
+ )
+/*++
+
+Routine Description:
+
+ This parses the FV looking for the PEI core and then plugs the address into
+ the SALE_ENTRY point of the BSF/VTF for IPF and does BUGBUG TBD action to
+ complete an IA32 Bootstrap FV.
+
+Arguments:
+
+ FvImage Memory file for the FV memory image
+ FvInfo Information read from INF file.
+ VtfFile Pointer to the VTF file in the FV image.
+
+Returns:
+
+ EFI_SUCCESS Function Completed successfully.
+ EFI_ABORTED Error encountered.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+ EFI_NOT_FOUND PEI Core file not found.
+
+--*/
+{
+ EFI_FFS_FILE_HEADER *PeiCoreFile;
+ EFI_FFS_FILE_HEADER *SecCoreFile;
+ EFI_STATUS Status;
+ EFI_FILE_SECTION_POINTER Pe32Section;
+ UINT32 EntryPoint;
+ UINT32 BaseOfCode;
+ UINT16 MachineType;
+ EFI_PHYSICAL_ADDRESS PeiCorePhysicalAddress;
+ EFI_PHYSICAL_ADDRESS SecCorePhysicalAddress;
+ INT32 Ia32SecEntryOffset;
+ UINT32 *Ia32ResetAddressPtr;
+ UINT8 *BytePointer;
+ UINT8 *BytePointer2;
+ UINT16 *WordPointer;
+ UINT16 CheckSum;
+ UINT32 IpiVector;
+ UINTN Index;
+ EFI_FFS_FILE_STATE SavedState;
+ BOOLEAN Vtf0Detected;
+ UINT32 FfsHeaderSize;
+ UINT32 SecHeaderSize;
+
+ //
+ // Verify input parameters
+ //
+ if (FvImage == NULL || FvInfo == NULL || VtfFile == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Initialize FV library
+ //
+ InitializeFvLib (FvImage->FileImage, FvInfo->Size);
+
+ //
+ // Verify VTF file
+ //
+ Status = VerifyFfsFile (VtfFile);
+ if (EFI_ERROR (Status)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (
+ (((UINTN)FvImage->Eof - (UINTN)FvImage->FileImage) >=
+ IA32_X64_VTF_SIGNATURE_OFFSET) &&
+ (*(UINT32 *)(VOID*)((UINTN) FvImage->Eof -
+ IA32_X64_VTF_SIGNATURE_OFFSET) ==
+ IA32_X64_VTF0_SIGNATURE)
+ ) {
+ Vtf0Detected = TRUE;
+ } else {
+ Vtf0Detected = FALSE;
+ }
+
+ //
+ // Find the Sec Core
+ //
+ Status = GetFileByType (EFI_FV_FILETYPE_SECURITY_CORE, 1, &SecCoreFile);
+ if (EFI_ERROR (Status) || SecCoreFile == NULL) {
+ if (Vtf0Detected) {
+ //
+ // If the SEC core file is not found, but the VTF-0 signature
+ // is found, we'll treat it as a VTF-0 'Volume Top File'.
+ // This means no modifications are required to the VTF.
+ //
+ return EFI_SUCCESS;
+ }
+
+ Error (NULL, 0, 3000, "Invalid", "could not find the SEC core file in the FV.");
+ return EFI_ABORTED;
+ }
+ //
+ // Sec Core found, now find PE32 section
+ //
+ Status = GetSectionByType (SecCoreFile, EFI_SECTION_PE32, 1, &Pe32Section);
+ if (Status == EFI_NOT_FOUND) {
+ Status = GetSectionByType (SecCoreFile, EFI_SECTION_TE, 1, &Pe32Section);
+ }
+
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "could not find a PE32 section in the SEC core file.");
+ return EFI_ABORTED;
+ }
+
+ SecHeaderSize = GetSectionHeaderLength(Pe32Section.CommonHeader);
+ Status = GetPe32Info (
+ (VOID *) ((UINTN) Pe32Section.Pe32Section + SecHeaderSize),
+ &EntryPoint,
+ &BaseOfCode,
+ &MachineType
+ );
+
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "could not get the PE32 entry point for the SEC core.");
+ return EFI_ABORTED;
+ }
+
+ if (
+ Vtf0Detected &&
+ (MachineType == EFI_IMAGE_MACHINE_IA32 ||
+ MachineType == EFI_IMAGE_MACHINE_X64)
+ ) {
+ //
+ // If the SEC core code is IA32 or X64 and the VTF-0 signature
+ // is found, we'll treat it as a VTF-0 'Volume Top File'.
+ // This means no modifications are required to the VTF.
+ //
+ return EFI_SUCCESS;
+ }
+
+ //
+ // Physical address is FV base + offset of PE32 + offset of the entry point
+ //
+ SecCorePhysicalAddress = FvInfo->BaseAddress;
+ SecCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + SecHeaderSize - (UINTN) FvImage->FileImage;
+ SecCorePhysicalAddress += EntryPoint;
+ DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%llX", (unsigned long long) SecCorePhysicalAddress);
+
+ //
+ // Find the PEI Core
+ //
+ PeiCorePhysicalAddress = 0;
+ Status = GetFileByType (EFI_FV_FILETYPE_PEI_CORE, 1, &PeiCoreFile);
+ if (!EFI_ERROR (Status) && (PeiCoreFile != NULL)) {
+ //
+ // PEI Core found, now find PE32 or TE section
+ //
+ Status = GetSectionByType (PeiCoreFile, EFI_SECTION_PE32, 1, &Pe32Section);
+ if (Status == EFI_NOT_FOUND) {
+ Status = GetSectionByType (PeiCoreFile, EFI_SECTION_TE, 1, &Pe32Section);
+ }
+
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "could not find either a PE32 or a TE section in PEI core file.");
+ return EFI_ABORTED;
+ }
+
+ SecHeaderSize = GetSectionHeaderLength(Pe32Section.CommonHeader);
+ Status = GetPe32Info (
+ (VOID *) ((UINTN) Pe32Section.Pe32Section + SecHeaderSize),
+ &EntryPoint,
+ &BaseOfCode,
+ &MachineType
+ );
+
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "could not get the PE32 entry point for the PEI core.");
+ return EFI_ABORTED;
+ }
+ //
+ // Physical address is FV base + offset of PE32 + offset of the entry point
+ //
+ PeiCorePhysicalAddress = FvInfo->BaseAddress;
+ PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + SecHeaderSize - (UINTN) FvImage->FileImage;
+ PeiCorePhysicalAddress += EntryPoint;
+ DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%llX", (unsigned long long) PeiCorePhysicalAddress);
+ }
+
+if (MachineType == EFI_IMAGE_MACHINE_IA32 || MachineType == EFI_IMAGE_MACHINE_X64) {
+ if (PeiCorePhysicalAddress != 0) {
+ //
+ // Get the location to update
+ //
+ Ia32ResetAddressPtr = (UINT32 *) ((UINTN) FvImage->Eof - IA32_PEI_CORE_ENTRY_OFFSET);
+
+ //
+ // Write lower 32 bits of physical address for Pei Core entry
+ //
+ *Ia32ResetAddressPtr = (UINT32) PeiCorePhysicalAddress;
+ }
+ //
+ // Write SecCore Entry point relative address into the jmp instruction in reset vector.
+ //
+ Ia32ResetAddressPtr = (UINT32 *) ((UINTN) FvImage->Eof - IA32_SEC_CORE_ENTRY_OFFSET);
+
+ Ia32SecEntryOffset = (INT32) (SecCorePhysicalAddress - (FV_IMAGES_TOP_ADDRESS - IA32_SEC_CORE_ENTRY_OFFSET + 2));
+ if (Ia32SecEntryOffset <= -65536) {
+ Error (NULL, 0, 3000, "Invalid", "The SEC EXE file size is too large, it must be less than 64K.");
+ return STATUS_ERROR;
+ }
+
+ *(UINT16 *) Ia32ResetAddressPtr = (UINT16) Ia32SecEntryOffset;
+
+ //
+ // Update the BFV base address
+ //
+ Ia32ResetAddressPtr = (UINT32 *) ((UINTN) FvImage->Eof - 4);
+ *Ia32ResetAddressPtr = (UINT32) (FvInfo->BaseAddress);
+ DebugMsg (NULL, 0, 9, "update BFV base address in the top FV image", "BFV base address = 0x%llX.", (unsigned long long) FvInfo->BaseAddress);
+
+ //
+ // Update the Startup AP in the FVH header block ZeroVector region.
+ //
+ BytePointer = (UINT8 *) ((UINTN) FvImage->FileImage);
+ if (FvInfo->Size <= 0x10000) {
+ BytePointer2 = m64kRecoveryStartupApDataArray;
+ } else if (FvInfo->Size <= 0x20000) {
+ BytePointer2 = m128kRecoveryStartupApDataArray;
+ } else {
+ BytePointer2 = m128kRecoveryStartupApDataArray;
+ //
+ // Find the position to place Ap reset vector, the offset
+ // between the position and the end of Fvrecovery.fv file
+ // should not exceed 128kB to prevent Ap reset vector from
+ // outside legacy E and F segment
+ //
+ Status = FindApResetVectorPosition (FvImage, &BytePointer);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "FV image does not have enough space to place AP reset vector. The FV image needs to reserve at least 4KB of unused space.");
+ return EFI_ABORTED;
+ }
+ }
+
+ for (Index = 0; Index < SIZEOF_STARTUP_DATA_ARRAY; Index++) {
+ BytePointer[Index] = BytePointer2[Index];
+ }
+ //
+ // Calculate the checksum
+ //
+ CheckSum = 0x0000;
+ WordPointer = (UINT16 *) (BytePointer);
+ for (Index = 0; Index < SIZEOF_STARTUP_DATA_ARRAY / 2; Index++) {
+ CheckSum = (UINT16) (CheckSum + ((UINT16) *WordPointer));
+ WordPointer++;
+ }
+ //
+ // Update the checksum field
+ //
+ WordPointer = (UINT16 *) (BytePointer + SIZEOF_STARTUP_DATA_ARRAY - 2);
+ *WordPointer = (UINT16) (0x10000 - (UINT32) CheckSum);
+
+ //
+ // IpiVector at the 4k aligned address in the top 2 blocks in the PEI FV.
+ //
+ IpiVector = (UINT32) (FV_IMAGES_TOP_ADDRESS - ((UINTN) FvImage->Eof - (UINTN) BytePointer));
+ DebugMsg (NULL, 0, 9, "Startup AP Vector address", "IpiVector at 0x%X", (unsigned) IpiVector);
+ if ((IpiVector & 0xFFF) != 0) {
+ Error (NULL, 0, 3000, "Invalid", "Startup AP Vector address are not 4K aligned, because the FV size is not 4K aligned");
+ return EFI_ABORTED;
+ }
+ IpiVector = IpiVector >> 12;
+ IpiVector = IpiVector & 0xFF;
+
+ //
+ // Write IPI Vector at Offset FvrecoveryFileSize - 8
+ //
+ Ia32ResetAddressPtr = (UINT32 *) ((UINTN) FvImage->Eof - 8);
+ *Ia32ResetAddressPtr = IpiVector;
+ } else if (MachineType == EFI_IMAGE_MACHINE_ARMT) {
+ //
+ // Since the ARM reset vector is in the FV Header you really don't need a
+ // Volume Top File, but if you have one for some reason don't crash...
+ //
+ } else if (MachineType == EFI_IMAGE_MACHINE_AARCH64) {
+ //
+ // Since the AArch64 reset vector is in the FV Header you really don't need a
+ // Volume Top File, but if you have one for some reason don't crash...
+ //
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "machine type=0x%X in PEI core.", MachineType);
+ return EFI_ABORTED;
+ }
+
+ //
+ // Now update file checksum
+ //
+ SavedState = VtfFile->State;
+ VtfFile->IntegrityCheck.Checksum.File = 0;
+ VtfFile->State = 0;
+ if (VtfFile->Attributes & FFS_ATTRIB_CHECKSUM) {
+ FfsHeaderSize = GetFfsHeaderLength(VtfFile);
+ VtfFile->IntegrityCheck.Checksum.File = CalculateChecksum8 (
+ (UINT8 *) ((UINT8 *)VtfFile + FfsHeaderSize),
+ GetFfsFileLength (VtfFile) - FfsHeaderSize
+ );
+ } else {
+ VtfFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
+ }
+
+ VtfFile->State = SavedState;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+FindCorePeSection(
+ IN VOID *FvImageBuffer,
+ IN UINT64 FvSize,
+ IN EFI_FV_FILETYPE FileType,
+ OUT EFI_FILE_SECTION_POINTER *Pe32Section
+ )
+/*++
+
+Routine Description:
+
+ Recursively searches the FV for the FFS file of specified type (typically
+ SEC or PEI core) and extracts the PE32 section for further processing.
+
+Arguments:
+
+ FvImageBuffer Buffer containing FV data
+ FvSize Size of the FV
+ FileType Type of FFS file to search for
+ Pe32Section PE32 section pointer when FFS file is found.
+
+Returns:
+
+ EFI_SUCCESS Function Completed successfully.
+ EFI_ABORTED Error encountered.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+ EFI_NOT_FOUND Core file not found.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_FIRMWARE_VOLUME_HEADER *OrigFvHeader;
+ UINT32 OrigFvLength;
+ EFI_FFS_FILE_HEADER *CoreFfsFile;
+ UINTN FvImageFileCount;
+ EFI_FFS_FILE_HEADER *FvImageFile;
+ UINTN EncapFvSectionCount;
+ EFI_FILE_SECTION_POINTER EncapFvSection;
+ EFI_FIRMWARE_VOLUME_HEADER *EncapsulatedFvHeader;
+
+ if (Pe32Section == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Initialize FV library, saving previous values
+ //
+ OrigFvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)NULL;
+ GetFvHeader (&OrigFvHeader, &OrigFvLength);
+ InitializeFvLib(FvImageBuffer, (UINT32)FvSize);
+
+ //
+ // First see if we can obtain the file directly in outer FV
+ //
+ Status = GetFileByType(FileType, 1, &CoreFfsFile);
+ if (!EFI_ERROR(Status) && (CoreFfsFile != NULL) ) {
+
+ //
+ // Core found, now find PE32 or TE section
+ //
+ Status = GetSectionByType(CoreFfsFile, EFI_SECTION_PE32, 1, Pe32Section);
+ if (EFI_ERROR(Status)) {
+ Status = GetSectionByType(CoreFfsFile, EFI_SECTION_TE, 1, Pe32Section);
+ }
+
+ if (EFI_ERROR(Status)) {
+ Error(NULL, 0, 3000, "Invalid", "could not find a PE32 section in the core file.");
+ return EFI_ABORTED;
+ }
+
+ //
+ // Core PE/TE section, found, return
+ //
+ Status = EFI_SUCCESS;
+ goto EarlyExit;
+ }
+
+ //
+ // File was not found, look for FV Image file
+ //
+
+ // iterate through all FV image files in outer FV
+ for (FvImageFileCount = 1;; FvImageFileCount++) {
+
+ Status = GetFileByType(EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE, FvImageFileCount, &FvImageFile);
+
+ if (EFI_ERROR(Status) || (FvImageFile == NULL) ) {
+ // exit FV image file loop, no more found
+ break;
+ }
+
+ // Found an fv image file, look for an FV image section. The PI spec does not
+ // preclude multiple FV image sections so we loop accordingly.
+ for (EncapFvSectionCount = 1;; EncapFvSectionCount++) {
+
+ // Look for the next FV image section. The section search code will
+ // iterate into encapsulation sections. For example, it will iterate
+ // into an EFI_SECTION_GUID_DEFINED encapsulation section to find the
+ // EFI_SECTION_FIRMWARE_VOLUME_IMAGE sections contained therein.
+ Status = GetSectionByType(FvImageFile, EFI_SECTION_FIRMWARE_VOLUME_IMAGE, EncapFvSectionCount, &EncapFvSection);
+
+ if (EFI_ERROR(Status)) {
+ // exit section inner loop, no more found
+ break;
+ }
+
+ EncapsulatedFvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINT8 *)EncapFvSection.FVImageSection + GetSectionHeaderLength(EncapFvSection.FVImageSection));
+
+ // recurse to search the encapsulated FV for this core file type
+ Status = FindCorePeSection(EncapsulatedFvHeader, EncapsulatedFvHeader->FvLength, FileType, Pe32Section);
+
+ if (!EFI_ERROR(Status)) {
+ // we found the core in the capsulated image, success
+ goto EarlyExit;
+ }
+
+ } // end encapsulated fv image section loop
+ } // end fv image file loop
+
+ // core was not found
+ Status = EFI_NOT_FOUND;
+
+EarlyExit:
+
+ // restore FV lib values
+ if(OrigFvHeader != NULL) {
+ InitializeFvLib(OrigFvHeader, OrigFvLength);
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+GetCoreMachineType(
+ IN EFI_FILE_SECTION_POINTER Pe32Section,
+ OUT UINT16 *CoreMachineType
+ )
+/*++
+
+Routine Description:
+
+ Returns the machine type of a P32 image, typically SEC or PEI core.
+
+Arguments:
+
+ Pe32Section PE32 section data
+ CoreMachineType The extracted machine type
+
+Returns:
+
+ EFI_SUCCESS Function Completed successfully.
+ EFI_ABORTED Error encountered.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+
+--*/
+{
+ EFI_STATUS Status;
+ UINT32 EntryPoint;
+ UINT32 BaseOfCode;
+
+ if (CoreMachineType == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = GetPe32Info(
+ (VOID *)((UINTN)Pe32Section.Pe32Section + GetSectionHeaderLength(Pe32Section.CommonHeader)),
+ &EntryPoint,
+ &BaseOfCode,
+ CoreMachineType
+ );
+ if (EFI_ERROR(Status)) {
+ Error(NULL, 0, 3000, "Invalid", "could not get the PE32 machine type for the core.");
+ return EFI_ABORTED;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GetCoreEntryPointAddress(
+ IN VOID *FvImageBuffer,
+ IN FV_INFO *FvInfo,
+ IN EFI_FILE_SECTION_POINTER Pe32Section,
+ OUT EFI_PHYSICAL_ADDRESS *CoreEntryAddress
+)
+/*++
+
+Routine Description:
+
+ Returns the physical address of the core (SEC or PEI) entry point.
+
+Arguments:
+
+ FvImageBuffer Pointer to buffer containing FV data
+ FvInfo Info for the parent FV
+ Pe32Section PE32 section data
+ CoreEntryAddress The extracted core entry physical address
+
+Returns:
+
+ EFI_SUCCESS Function Completed successfully.
+ EFI_ABORTED Error encountered.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+
+--*/
+{
+ EFI_STATUS Status;
+ UINT32 EntryPoint;
+ UINT32 BaseOfCode;
+ UINT16 MachineType;
+ EFI_PHYSICAL_ADDRESS EntryPhysicalAddress;
+
+ if (CoreEntryAddress == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = GetPe32Info(
+ (VOID *)((UINTN)Pe32Section.Pe32Section + GetSectionHeaderLength(Pe32Section.CommonHeader)),
+ &EntryPoint,
+ &BaseOfCode,
+ &MachineType
+ );
+ if (EFI_ERROR(Status)) {
+ Error(NULL, 0, 3000, "Invalid", "could not get the PE32 entry point for the core.");
+ return EFI_ABORTED;
+ }
+
+ //
+ // Physical address is FV base + offset of PE32 + offset of the entry point
+ //
+ EntryPhysicalAddress = FvInfo->BaseAddress;
+ EntryPhysicalAddress += (UINTN)Pe32Section.Pe32Section + GetSectionHeaderLength(Pe32Section.CommonHeader) - (UINTN)FvImageBuffer;
+ EntryPhysicalAddress += EntryPoint;
+
+ *CoreEntryAddress = EntryPhysicalAddress;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+UpdateArmResetVectorIfNeeded (
+ IN MEMORY_FILE *FvImage,
+ IN FV_INFO *FvInfo
+ )
+/*++
+
+Routine Description:
+ This parses the FV looking for SEC and patches that address into the
+ beginning of the FV header.
+
+ For ARM32 the reset vector is at 0x00000000 or 0xFFFF0000.
+ For AArch64 the reset vector is at 0x00000000.
+
+ This would commonly map to the first entry in the ROM.
+ ARM32 Exceptions:
+ Reset +0
+ Undefined +4
+ SWI +8
+ Prefetch Abort +12
+ Data Abort +16
+ IRQ +20
+ FIQ +24
+
+ We support two schemes on ARM.
+ 1) Beginning of the FV is the reset vector
+ 2) Reset vector is data bytes FDF file and that code branches to reset vector
+ in the beginning of the FV (fixed size offset).
+
+ Need to have the jump for the reset vector at location zero.
+ We also need to store the address or PEI (if it exists).
+ We stub out a return from interrupt in case the debugger
+ is using SWI (not done for AArch64, not enough space in struct).
+ The optional entry to the common exception handler is
+ to support full featured exception handling from ROM and is currently
+ not support by this tool.
+
+Arguments:
+ FvImage Memory file for the FV memory image
+ FvInfo Information read from INF file.
+
+Returns:
+
+ EFI_SUCCESS Function Completed successfully.
+ EFI_ABORTED Error encountered.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+ EFI_NOT_FOUND PEI Core file not found.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_FILE_SECTION_POINTER SecPe32;
+ EFI_FILE_SECTION_POINTER PeiPe32;
+ BOOLEAN UpdateVectorSec = FALSE;
+ BOOLEAN UpdateVectorPei = FALSE;
+ UINT16 MachineType = 0;
+ EFI_PHYSICAL_ADDRESS SecCoreEntryAddress = 0;
+ UINT16 PeiMachineType = 0;
+ EFI_PHYSICAL_ADDRESS PeiCoreEntryAddress = 0;
+
+ //
+ // Verify input parameters
+ //
+ if (FvImage == NULL || FvInfo == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Locate an SEC Core instance and if found extract the machine type and entry point address
+ //
+ Status = FindCorePeSection(FvImage->FileImage, FvInfo->Size, EFI_FV_FILETYPE_SECURITY_CORE, &SecPe32);
+ if (!EFI_ERROR(Status)) {
+
+ Status = GetCoreMachineType(SecPe32, &MachineType);
+ if (EFI_ERROR(Status)) {
+ Error(NULL, 0, 3000, "Invalid", "Could not get the PE32 machine type for SEC Core.");
+ return EFI_ABORTED;
+ }
+
+ Status = GetCoreEntryPointAddress(FvImage->FileImage, FvInfo, SecPe32, &SecCoreEntryAddress);
+ if (EFI_ERROR(Status)) {
+ Error(NULL, 0, 3000, "Invalid", "Could not get the PE32 entry point address for SEC Core.");
+ return EFI_ABORTED;
+ }
+
+ VerboseMsg("UpdateArmResetVectorIfNeeded found SEC core entry at 0x%llx", (unsigned long long)SecCoreEntryAddress);
+ UpdateVectorSec = TRUE;
+ }
+
+ //
+ // Locate a PEI Core instance and if found extract the machine type and entry point address
+ //
+ Status = FindCorePeSection(FvImage->FileImage, FvInfo->Size, EFI_FV_FILETYPE_PEI_CORE, &PeiPe32);
+ if (!EFI_ERROR(Status)) {
+
+ Status = GetCoreMachineType(PeiPe32, &PeiMachineType);
+ if (EFI_ERROR(Status)) {
+ Error(NULL, 0, 3000, "Invalid", "Could not get the PE32 machine type for PEI Core.");
+ return EFI_ABORTED;
+ }
+
+ Status = GetCoreEntryPointAddress(FvImage->FileImage, FvInfo, PeiPe32, &PeiCoreEntryAddress);
+ if (EFI_ERROR(Status)) {
+ Error(NULL, 0, 3000, "Invalid", "Could not get the PE32 entry point address for PEI Core.");
+ return EFI_ABORTED;
+ }
+
+ VerboseMsg("UpdateArmResetVectorIfNeeded found PEI core entry at 0x%llx", (unsigned long long)PeiCoreEntryAddress);
+
+ // if we previously found an SEC Core make sure machine types match
+ if (UpdateVectorSec && (MachineType != PeiMachineType)) {
+ Error(NULL, 0, 3000, "Invalid", "SEC and PEI machine types do not match, can't update reset vector");
+ return EFI_ABORTED;
+ }
+ else {
+ MachineType = PeiMachineType;
+ }
+
+ UpdateVectorPei = TRUE;
+ }
+
+ if (!UpdateVectorSec && !UpdateVectorPei) {
+ return EFI_SUCCESS;
+ }
+
+ if (MachineType == EFI_IMAGE_MACHINE_ARMT) {
+ // ARM: Array of 4 UINT32s:
+ // 0 - is branch relative to SEC entry point
+ // 1 - PEI Entry Point
+ // 2 - movs pc,lr for a SWI handler
+ // 3 - Place holder for Common Exception Handler
+ UINT32 ResetVector[4];
+
+ memset(ResetVector, 0, sizeof (ResetVector));
+
+ // if we found an SEC core entry point then generate a branch instruction
+ // to it and populate a debugger SWI entry as well
+ if (UpdateVectorSec) {
+
+ VerboseMsg("UpdateArmResetVectorIfNeeded updating ARM SEC vector");
+
+ // B SecEntryPoint - signed_immed_24 part +/-32MB offset
+ // on ARM, the PC is always 8 ahead, so we're not really jumping from the base address, but from base address + 8
+ ResetVector[0] = (INT32)(SecCoreEntryAddress - FvInfo->BaseAddress - 8) >> 2;
+
+ if (ResetVector[0] > 0x00FFFFFF) {
+ Error(NULL, 0, 3000, "Invalid", "SEC Entry point must be within 32MB of the start of the FV");
+ return EFI_ABORTED;
+ }
+
+ // Add opcode for an unconditional branch with no link. i.e.: " B SecEntryPoint"
+ ResetVector[0] |= ARMT_UNCONDITIONAL_JUMP_INSTRUCTION;
+
+ // SWI handler movs pc,lr. Just in case a debugger uses SWI
+ ResetVector[2] = 0xE1B0F07E;
+
+ // Place holder to support a common interrupt handler from ROM.
+ // Currently not supported. For this to be used the reset vector would not be in this FV
+ // and the exception vectors would be hard coded in the ROM and just through this address
+ // to find a common handler in the a module in the FV.
+ ResetVector[3] = 0;
+ }
+
+ // if a PEI core entry was found place its address in the vector area
+ if (UpdateVectorPei) {
+
+ VerboseMsg("UpdateArmResetVectorIfNeeded updating ARM PEI address");
+
+ // Address of PEI Core, if we have one
+ ResetVector[1] = (UINT32)PeiCoreEntryAddress;
+ }
+
+ //
+ // Copy to the beginning of the FV
+ //
+ memcpy(FvImage->FileImage, ResetVector, sizeof (ResetVector));
+
+ } else if (MachineType == EFI_IMAGE_MACHINE_AARCH64) {
+ // AArch64: Used as UINT64 ResetVector[2]
+ // 0 - is branch relative to SEC entry point
+ // 1 - PEI Entry Point
+ UINT64 ResetVector[2];
+
+ memset(ResetVector, 0, sizeof (ResetVector));
+
+ /* NOTE:
+ ARMT above has an entry in ResetVector[2] for SWI. The way we are using the ResetVector
+ array at the moment, for AArch64, does not allow us space for this as the header only
+ allows for a fixed amount of bytes at the start. If we are sure that UEFI will live
+ within the first 4GB of addressable RAM we could potentially adopt the same ResetVector
+ layout as above. But for the moment we replace the four 32bit vectors with two 64bit
+ vectors in the same area of the Image heasder. This allows UEFI to start from a 64bit
+ base.
+ */
+
+ // if we found an SEC core entry point then generate a branch instruction to it
+ if (UpdateVectorSec) {
+
+ VerboseMsg("UpdateArmResetVectorIfNeeded updating AArch64 SEC vector");
+
+ ResetVector[0] = (UINT64)(SecCoreEntryAddress - FvInfo->BaseAddress) >> 2;
+
+ // B SecEntryPoint - signed_immed_26 part +/-128MB offset
+ if (ResetVector[0] > 0x03FFFFFF) {
+ Error(NULL, 0, 3000, "Invalid", "SEC Entry point must be within 128MB of the start of the FV");
+ return EFI_ABORTED;
+ }
+ // Add opcode for an unconditional branch with no link. i.e.: " B SecEntryPoint"
+ ResetVector[0] |= ARM64_UNCONDITIONAL_JUMP_INSTRUCTION;
+ }
+
+ // if a PEI core entry was found place its address in the vector area
+ if (UpdateVectorPei) {
+
+ VerboseMsg("UpdateArmResetVectorIfNeeded updating AArch64 PEI address");
+
+ // Address of PEI Core, if we have one
+ ResetVector[1] = (UINT64)PeiCoreEntryAddress;
+ }
+
+ //
+ // Copy to the beginning of the FV
+ //
+ memcpy(FvImage->FileImage, ResetVector, sizeof (ResetVector));
+
+ } else {
+ Error(NULL, 0, 3000, "Invalid", "Unknown machine type");
+ return EFI_ABORTED;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+UpdateRiscvResetVectorIfNeeded (
+ MEMORY_FILE *FvImage,
+ FV_INFO *FvInfo
+ )
+/*++
+
+Routine Description:
+ This parses the FV looking for SEC and patches that address into the
+ beginning of the FV header.
+
+ For RISC-V ISA, the reset vector is at 0xfff~ff00h or 200h
+
+Arguments:
+ FvImage Memory file for the FV memory image/
+ FvInfo Information read from INF file.
+
+Returns:
+
+ EFI_SUCCESS Function Completed successfully.
+ EFI_ABORTED Error encountered.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+ EFI_NOT_FOUND PEI Core file not found.
+
+--*/
+{
+ EFI_STATUS Status;
+ UINT16 MachineType;
+ EFI_FILE_SECTION_POINTER SecPe32;
+ EFI_PHYSICAL_ADDRESS SecCoreEntryAddress;
+
+ UINT32 bSecCore;
+ UINT32 tmp;
+
+
+ //
+ // Verify input parameters
+ //
+ if (FvImage == NULL || FvInfo == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Initialize FV library
+ //
+ InitializeFvLib (FvImage->FileImage, FvInfo->Size);
+
+ //
+ // Find the Sec Core
+ //
+ Status = FindCorePeSection(FvImage->FileImage, FvInfo->Size, EFI_FV_FILETYPE_SECURITY_CORE, &SecPe32);
+ if(EFI_ERROR(Status)) {
+ printf("skip because Secutiry Core not found\n");
+ return EFI_SUCCESS;
+ }
+
+ DebugMsg (NULL, 0, 9, "Update SEC core in FV Header", NULL);
+
+ Status = GetCoreMachineType(SecPe32, &MachineType);
+ if(EFI_ERROR(Status)) {
+ Error(NULL, 0, 3000, "Invalid", "Could not get the PE32 machine type for SEC core.");
+ return EFI_ABORTED;
+ }
+
+ if (MachineType != EFI_IMAGE_MACHINE_RISCV64) {
+ Error(NULL, 0, 3000, "Invalid", "Could not update SEC core because Machine type is not RiscV.");
+ return EFI_ABORTED;
+ }
+
+ Status = GetCoreEntryPointAddress(FvImage->FileImage, FvInfo, SecPe32, &SecCoreEntryAddress);
+ if(EFI_ERROR(Status)) {
+ Error(NULL, 0, 3000, "Invalid", "Could not get the PE32 entry point address for SEC Core.");
+ return EFI_ABORTED;
+ }
+
+ VerboseMsg("SecCore entry point Address = 0x%llX", (unsigned long long) SecCoreEntryAddress);
+ VerboseMsg("BaseAddress = 0x%llX", (unsigned long long) FvInfo->BaseAddress);
+ bSecCore = (UINT32)(SecCoreEntryAddress - FvInfo->BaseAddress);
+ VerboseMsg("offset = 0x%llX", bSecCore);
+
+ if(bSecCore > 0x0fffff) {
+ Error(NULL, 0, 3000, "Invalid", "SEC Entry point must be within 1MB of start of the FV");
+ return EFI_ABORTED;
+ }
+
+ tmp = bSecCore;
+ bSecCore = 0;
+ //J-type
+ bSecCore = (tmp&0x100000)<<11; //imm[20] at bit[31]
+ bSecCore |= (tmp&0x0007FE)<<20; //imm[10:1] at bit[30:21]
+ bSecCore |= (tmp&0x000800)<<9; //imm[11] at bit[20]
+ bSecCore |= (tmp&0x0FF000); //imm[19:12] at bit[19:12]
+ bSecCore |= 0x6F; //JAL opcode
+
+ memcpy(FvImage->FileImage, &bSecCore, sizeof(bSecCore));
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GetPe32Info (
+ IN UINT8 *Pe32,
+ OUT UINT32 *EntryPoint,
+ OUT UINT32 *BaseOfCode,
+ OUT UINT16 *MachineType
+ )
+/*++
+
+Routine Description:
+
+ Retrieves the PE32 entry point offset and machine type from PE image or TeImage.
+ See EfiImage.h for machine types. The entry point offset is from the beginning
+ of the PE32 buffer passed in.
+
+Arguments:
+
+ Pe32 Beginning of the PE32.
+ EntryPoint Offset from the beginning of the PE32 to the image entry point.
+ BaseOfCode Base address of code.
+ MachineType Magic number for the machine type.
+
+Returns:
+
+ EFI_SUCCESS Function completed successfully.
+ EFI_ABORTED Error encountered.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+ EFI_UNSUPPORTED The operation is unsupported.
+
+--*/
+{
+ EFI_IMAGE_DOS_HEADER *DosHeader;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
+ EFI_TE_IMAGE_HEADER *TeHeader;
+
+ //
+ // Verify input parameters
+ //
+ if (Pe32 == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // First check whether it is one TE Image.
+ //
+ TeHeader = (EFI_TE_IMAGE_HEADER *) Pe32;
+ if (TeHeader->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
+ //
+ // By TeImage Header to get output
+ //
+ *EntryPoint = TeHeader->AddressOfEntryPoint + sizeof (EFI_TE_IMAGE_HEADER) - TeHeader->StrippedSize;
+ *BaseOfCode = TeHeader->BaseOfCode + sizeof (EFI_TE_IMAGE_HEADER) - TeHeader->StrippedSize;
+ *MachineType = TeHeader->Machine;
+ } else {
+
+ //
+ // Then check whether
+ // First is the DOS header
+ //
+ DosHeader = (EFI_IMAGE_DOS_HEADER *) Pe32;
+
+ //
+ // Verify DOS header is expected
+ //
+ if (DosHeader->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
+ Error (NULL, 0, 3000, "Invalid", "Unknown magic number in the DOS header, 0x%04X.", DosHeader->e_magic);
+ return EFI_UNSUPPORTED;
+ }
+ //
+ // Immediately following is the NT header.
+ //
+ ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) ((UINTN) Pe32 + DosHeader->e_lfanew);
+
+ //
+ // Verify NT header is expected
+ //
+ if (ImgHdr->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
+ Error (NULL, 0, 3000, "Invalid", "Unrecognized image signature 0x%08X.", (unsigned) ImgHdr->Pe32.Signature);
+ return EFI_UNSUPPORTED;
+ }
+ //
+ // Get output
+ //
+ *EntryPoint = ImgHdr->Pe32.OptionalHeader.AddressOfEntryPoint;
+ *BaseOfCode = ImgHdr->Pe32.OptionalHeader.BaseOfCode;
+ *MachineType = ImgHdr->Pe32.FileHeader.Machine;
+ }
+
+ //
+ // Verify machine type is supported
+ //
+ if ((*MachineType != EFI_IMAGE_MACHINE_IA32) && (*MachineType != EFI_IMAGE_MACHINE_X64) && (*MachineType != EFI_IMAGE_MACHINE_EBC) &&
+ (*MachineType != EFI_IMAGE_MACHINE_ARMT) && (*MachineType != EFI_IMAGE_MACHINE_AARCH64) &&
+ (*MachineType != EFI_IMAGE_MACHINE_RISCV64)) {
+ Error (NULL, 0, 3000, "Invalid", "Unrecognized machine type in the PE32 file.");
+ return EFI_UNSUPPORTED;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GenerateFvImage (
+ IN CHAR8 *InfFileImage,
+ IN UINTN InfFileSize,
+ IN CHAR8 *FvFileName,
+ IN CHAR8 *MapFileName
+ )
+/*++
+
+Routine Description:
+
+ This is the main function which will be called from application.
+
+Arguments:
+
+ InfFileImage Buffer containing the INF file contents.
+ InfFileSize Size of the contents of the InfFileImage buffer.
+ FvFileName Requested name for the FV file.
+ MapFileName Fv map file to log fv driver information.
+
+Returns:
+
+ EFI_SUCCESS Function completed successfully.
+ EFI_OUT_OF_RESOURCES Could not allocate required resources.
+ EFI_ABORTED Error encountered.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+
+--*/
+{
+ EFI_STATUS Status;
+ MEMORY_FILE InfMemoryFile;
+ MEMORY_FILE FvImageMemoryFile;
+ UINTN Index;
+ EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
+ EFI_FFS_FILE_HEADER *VtfFileImage;
+ UINT8 *FvBufferHeader; // to make sure fvimage header 8 type alignment.
+ UINT8 *FvImage;
+ UINTN FvImageSize;
+ FILE *FvFile;
+ CHAR8 *FvMapName;
+ FILE *FvMapFile;
+ EFI_FIRMWARE_VOLUME_EXT_HEADER *FvExtHeader;
+ FILE *FvExtHeaderFile;
+ UINTN FileSize;
+ CHAR8 *FvReportName;
+ FILE *FvReportFile;
+
+ FvBufferHeader = NULL;
+ FvFile = NULL;
+ FvMapName = NULL;
+ FvMapFile = NULL;
+ FvReportName = NULL;
+ FvReportFile = NULL;
+
+ if (InfFileImage != NULL) {
+ //
+ // Initialize file structures
+ //
+ InfMemoryFile.FileImage = InfFileImage;
+ InfMemoryFile.CurrentFilePointer = InfFileImage;
+ InfMemoryFile.Eof = InfFileImage + InfFileSize;
+
+ //
+ // Parse the FV inf file for header information
+ //
+ Status = ParseFvInf (&InfMemoryFile, &mFvDataInfo);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "Error parsing file", "the input FV INF file.");
+ return Status;
+ }
+ }
+
+ //
+ // Update the file name return values
+ //
+ if (FvFileName == NULL && mFvDataInfo.FvName[0] != '\0') {
+ FvFileName = mFvDataInfo.FvName;
+ }
+
+ if (FvFileName == NULL) {
+ Error (NULL, 0, 1001, "Missing option", "Output file name");
+ return EFI_ABORTED;
+ }
+
+ if (mFvDataInfo.FvBlocks[0].Length == 0) {
+ Error (NULL, 0, 1001, "Missing required argument", "Block Size");
+ return EFI_ABORTED;
+ }
+
+ //
+ // Debug message Fv File System Guid
+ //
+ if (mFvDataInfo.FvFileSystemGuidSet) {
+ DebugMsg (NULL, 0, 9, "FV File System Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+ (unsigned) mFvDataInfo.FvFileSystemGuid.Data1,
+ mFvDataInfo.FvFileSystemGuid.Data2,
+ mFvDataInfo.FvFileSystemGuid.Data3,
+ mFvDataInfo.FvFileSystemGuid.Data4[0],
+ mFvDataInfo.FvFileSystemGuid.Data4[1],
+ mFvDataInfo.FvFileSystemGuid.Data4[2],
+ mFvDataInfo.FvFileSystemGuid.Data4[3],
+ mFvDataInfo.FvFileSystemGuid.Data4[4],
+ mFvDataInfo.FvFileSystemGuid.Data4[5],
+ mFvDataInfo.FvFileSystemGuid.Data4[6],
+ mFvDataInfo.FvFileSystemGuid.Data4[7]);
+ }
+
+ //
+ // Add PI FV extension header
+ //
+ FvExtHeader = NULL;
+ FvExtHeaderFile = NULL;
+ if (mFvDataInfo.FvExtHeaderFile[0] != 0) {
+ //
+ // Open the FV Extension Header file
+ //
+ FvExtHeaderFile = fopen (LongFilePath (mFvDataInfo.FvExtHeaderFile), "rb");
+ if (FvExtHeaderFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", mFvDataInfo.FvExtHeaderFile);
+ return EFI_ABORTED;
+ }
+
+ //
+ // Get the file size
+ //
+ FileSize = _filelength (fileno (FvExtHeaderFile));
+
+ //
+ // Allocate a buffer for the FV Extension Header
+ //
+ FvExtHeader = malloc(FileSize);
+ if (FvExtHeader == NULL) {
+ fclose (FvExtHeaderFile);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Read the FV Extension Header
+ //
+ fread (FvExtHeader, sizeof (UINT8), FileSize, FvExtHeaderFile);
+ fclose (FvExtHeaderFile);
+
+ //
+ // See if there is an override for the FV Name GUID
+ //
+ if (mFvDataInfo.FvNameGuidSet) {
+ memcpy (&FvExtHeader->FvName, &mFvDataInfo.FvNameGuid, sizeof (EFI_GUID));
+ }
+ memcpy (&mFvDataInfo.FvNameGuid, &FvExtHeader->FvName, sizeof (EFI_GUID));
+ mFvDataInfo.FvNameGuidSet = TRUE;
+ } else if (mFvDataInfo.FvNameGuidSet) {
+ //
+ // Allocate a buffer for the FV Extension Header
+ //
+ FvExtHeader = malloc(sizeof (EFI_FIRMWARE_VOLUME_EXT_HEADER));
+ if (FvExtHeader == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ memcpy (&FvExtHeader->FvName, &mFvDataInfo.FvNameGuid, sizeof (EFI_GUID));
+ FvExtHeader->ExtHeaderSize = sizeof (EFI_FIRMWARE_VOLUME_EXT_HEADER);
+ }
+
+ //
+ // Debug message Fv Name Guid
+ //
+ if (mFvDataInfo.FvNameGuidSet) {
+ DebugMsg (NULL, 0, 9, "FV Name Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+ (unsigned) mFvDataInfo.FvNameGuid.Data1,
+ mFvDataInfo.FvNameGuid.Data2,
+ mFvDataInfo.FvNameGuid.Data3,
+ mFvDataInfo.FvNameGuid.Data4[0],
+ mFvDataInfo.FvNameGuid.Data4[1],
+ mFvDataInfo.FvNameGuid.Data4[2],
+ mFvDataInfo.FvNameGuid.Data4[3],
+ mFvDataInfo.FvNameGuid.Data4[4],
+ mFvDataInfo.FvNameGuid.Data4[5],
+ mFvDataInfo.FvNameGuid.Data4[6],
+ mFvDataInfo.FvNameGuid.Data4[7]);
+ }
+
+ if (CompareGuid (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid) == 0 ||
+ CompareGuid (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem3Guid) == 0) {
+ mFvDataInfo.IsPiFvImage = TRUE;
+ }
+
+ //
+ // FvMap file to log the function address of all modules in one Fvimage
+ //
+ if (MapFileName != NULL) {
+ if (strlen (MapFileName) > MAX_LONG_FILE_PATH - 1) {
+ Error (NULL, 0, 1003, "Invalid option value", "MapFileName %s is too long!", MapFileName);
+ Status = EFI_ABORTED;
+ goto Finish;
+ }
+
+ FvMapName = malloc (strlen (MapFileName) + 1);
+ if (FvMapName == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Finish;
+ }
+
+ strcpy (FvMapName, MapFileName);
+ } else {
+ if (strlen (FvFileName) + strlen (".map") > MAX_LONG_FILE_PATH - 1) {
+ Error (NULL, 0, 1003, "Invalid option value", "FvFileName %s is too long!", FvFileName);
+ Status = EFI_ABORTED;
+ goto Finish;
+ }
+
+ FvMapName = malloc (strlen (FvFileName) + strlen (".map") + 1);
+ if (FvMapName == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Finish;
+ }
+
+ strcpy (FvMapName, FvFileName);
+ strcat (FvMapName, ".map");
+ }
+ VerboseMsg ("FV Map file name is %s", FvMapName);
+
+ //
+ // FvReport file to log the FV information in one Fvimage
+ //
+ if (strlen (FvFileName) + strlen (".txt") > MAX_LONG_FILE_PATH - 1) {
+ Error (NULL, 0, 1003, "Invalid option value", "FvFileName %s is too long!", FvFileName);
+ Status = EFI_ABORTED;
+ goto Finish;
+ }
+
+ FvReportName = malloc (strlen (FvFileName) + strlen (".txt") + 1);
+ if (FvReportName == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Finish;
+ }
+
+ strcpy (FvReportName, FvFileName);
+ strcat (FvReportName, ".txt");
+
+ //
+ // Calculate the FV size and Update Fv Size based on the actual FFS files.
+ // And Update mFvDataInfo data.
+ //
+ Status = CalculateFvSize (&mFvDataInfo);
+ if (EFI_ERROR (Status)) {
+ goto Finish;
+ }
+ VerboseMsg ("the generated FV image size is %u bytes", (unsigned) mFvDataInfo.Size);
+
+ //
+ // support fv image and empty fv image
+ //
+ FvImageSize = mFvDataInfo.Size;
+
+ //
+ // Allocate the FV, assure FvImage Header 8 byte alignment
+ //
+ FvBufferHeader = malloc (FvImageSize + sizeof (UINT64));
+ if (FvBufferHeader == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Finish;
+ }
+ FvImage = (UINT8 *) (((UINTN) FvBufferHeader + 7) & ~7);
+
+ //
+ // Initialize the FV to the erase polarity
+ //
+ if (mFvDataInfo.FvAttributes == 0) {
+ //
+ // Set Default Fv Attribute
+ //
+ mFvDataInfo.FvAttributes = FV_DEFAULT_ATTRIBUTE;
+ }
+ if (mFvDataInfo.FvAttributes & EFI_FVB2_ERASE_POLARITY) {
+ memset (FvImage, -1, FvImageSize);
+ } else {
+ memset (FvImage, 0, FvImageSize);
+ }
+
+ //
+ // Initialize FV header
+ //
+ FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) FvImage;
+
+ //
+ // Initialize the zero vector to all zeros.
+ //
+ memset (FvHeader->ZeroVector, 0, 16);
+
+ //
+ // Copy the Fv file system GUID
+ //
+ memcpy (&FvHeader->FileSystemGuid, &mFvDataInfo.FvFileSystemGuid, sizeof (EFI_GUID));
+
+ FvHeader->FvLength = FvImageSize;
+ FvHeader->Signature = EFI_FVH_SIGNATURE;
+ FvHeader->Attributes = mFvDataInfo.FvAttributes;
+ FvHeader->Revision = EFI_FVH_REVISION;
+ FvHeader->ExtHeaderOffset = 0;
+ FvHeader->Reserved[0] = 0;
+
+ //
+ // Copy firmware block map
+ //
+ for (Index = 0; mFvDataInfo.FvBlocks[Index].Length != 0; Index++) {
+ FvHeader->BlockMap[Index].NumBlocks = mFvDataInfo.FvBlocks[Index].NumBlocks;
+ FvHeader->BlockMap[Index].Length = mFvDataInfo.FvBlocks[Index].Length;
+ }
+
+ //
+ // Add block map terminator
+ //
+ FvHeader->BlockMap[Index].NumBlocks = 0;
+ FvHeader->BlockMap[Index].Length = 0;
+
+ //
+ // Complete the header
+ //
+ FvHeader->HeaderLength = (UINT16) (((UINTN) &(FvHeader->BlockMap[Index + 1])) - (UINTN) FvImage);
+ FvHeader->Checksum = 0;
+ FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
+
+ //
+ // If there is no FFS file, generate one empty FV
+ //
+ if (mFvDataInfo.FvFiles[0][0] == 0 && !mFvDataInfo.FvNameGuidSet) {
+ goto WriteFile;
+ }
+
+ //
+ // Initialize our "file" view of the buffer
+ //
+ FvImageMemoryFile.FileImage = (CHAR8 *)FvImage;
+ FvImageMemoryFile.CurrentFilePointer = (CHAR8 *)FvImage + FvHeader->HeaderLength;
+ FvImageMemoryFile.Eof = (CHAR8 *)FvImage + FvImageSize;
+
+ //
+ // Initialize the FV library.
+ //
+ InitializeFvLib (FvImageMemoryFile.FileImage, FvImageSize);
+
+ //
+ // Initialize the VTF file address.
+ //
+ VtfFileImage = (EFI_FFS_FILE_HEADER *) FvImageMemoryFile.Eof;
+
+ //
+ // Open FvMap file
+ //
+ FvMapFile = fopen (LongFilePath (FvMapName), "w");
+ if (FvMapFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", FvMapName);
+ Status = EFI_ABORTED;
+ goto Finish;
+ }
+
+ //
+ // Open FvReport file
+ //
+ FvReportFile = fopen (LongFilePath (FvReportName), "w");
+ if (FvReportFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", FvReportName);
+ Status = EFI_ABORTED;
+ goto Finish;
+ }
+ //
+ // record FV size information into FvMap file.
+ //
+ if (mFvTotalSize != 0) {
+ fprintf (FvMapFile, EFI_FV_TOTAL_SIZE_STRING);
+ fprintf (FvMapFile, " = 0x%x\n", (unsigned) mFvTotalSize);
+ }
+ if (mFvTakenSize != 0) {
+ fprintf (FvMapFile, EFI_FV_TAKEN_SIZE_STRING);
+ fprintf (FvMapFile, " = 0x%x\n", (unsigned) mFvTakenSize);
+ }
+ if (mFvTotalSize != 0 && mFvTakenSize != 0) {
+ fprintf (FvMapFile, EFI_FV_SPACE_SIZE_STRING);
+ fprintf (FvMapFile, " = 0x%x\n\n", (unsigned) (mFvTotalSize - mFvTakenSize));
+ }
+
+ //
+ // record FV size information to FvReportFile.
+ //
+ fprintf (FvReportFile, "%s = 0x%x\n", EFI_FV_TOTAL_SIZE_STRING, (unsigned) mFvTotalSize);
+ fprintf (FvReportFile, "%s = 0x%x\n", EFI_FV_TAKEN_SIZE_STRING, (unsigned) mFvTakenSize);
+
+ //
+ // Add PI FV extension header
+ //
+ if (FvExtHeader != NULL) {
+ //
+ // Add FV Extended Header contents to the FV as a PAD file
+ //
+ AddPadFile (&FvImageMemoryFile, 4, VtfFileImage, FvExtHeader, 0);
+
+ //
+ // Fv Extension header change update Fv Header Check sum
+ //
+ FvHeader->Checksum = 0;
+ FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
+ }
+
+ //
+ // Add files to FV
+ //
+ for (Index = 0; mFvDataInfo.FvFiles[Index][0] != 0; Index++) {
+ //
+ // Add the file
+ //
+ Status = AddFile (&FvImageMemoryFile, &mFvDataInfo, Index, &VtfFileImage, FvMapFile, FvReportFile);
+
+ //
+ // Exit if error detected while adding the file
+ //
+ if (EFI_ERROR (Status)) {
+ goto Finish;
+ }
+ }
+
+ //
+ // If there is a VTF file, some special actions need to occur.
+ //
+ if ((UINTN) VtfFileImage != (UINTN) FvImageMemoryFile.Eof) {
+ //
+ // Pad from the end of the last file to the beginning of the VTF file.
+ // If the left space is less than sizeof (EFI_FFS_FILE_HEADER)?
+ //
+ Status = PadFvImage (&FvImageMemoryFile, VtfFileImage);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 4002, "Resource", "FV space is full, cannot add pad file between the last file and the VTF file.");
+ goto Finish;
+ }
+
+ if (!mArm && !mRiscV) {
+ //
+ // Update reset vector (SALE_ENTRY for IPF)
+ // Now for IA32 and IA64 platform, the fv which has bsf file must have the
+ // EndAddress of 0xFFFFFFFF (unless the section was rebased).
+ // Thus, only this type fv needs to update the reset vector.
+ // If the PEI Core is found, the VTF file will probably get
+ // corrupted by updating the entry point.
+ //
+ if (mFvDataInfo.ForceRebase == 1 ||
+ (mFvDataInfo.BaseAddress + mFvDataInfo.Size) == FV_IMAGES_TOP_ADDRESS) {
+ Status = UpdateResetVector (&FvImageMemoryFile, &mFvDataInfo, VtfFileImage);
+ if (EFI_ERROR(Status)) {
+ Error (NULL, 0, 3000, "Invalid", "Could not update the reset vector.");
+ goto Finish;
+ }
+ DebugMsg (NULL, 0, 9, "Update Reset vector in VTF file", NULL);
+ }
+ }
+ }
+
+ if (mArm) {
+ Status = UpdateArmResetVectorIfNeeded (&FvImageMemoryFile, &mFvDataInfo);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "Could not update the reset vector.");
+ goto Finish;
+ }
+
+ //
+ // Update Checksum for FvHeader
+ //
+ FvHeader->Checksum = 0;
+ FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
+ }
+
+ if (mRiscV) {
+ //
+ // Update RISCV reset vector.
+ //
+ Status = UpdateRiscvResetVectorIfNeeded (&FvImageMemoryFile, &mFvDataInfo);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "Could not update the reset vector for RISC-V.");
+ goto Finish;
+ }
+ //
+ // Update Checksum for FvHeader
+ //
+ FvHeader->Checksum = 0;
+ FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
+ }
+
+ //
+ // Update FV Alignment attribute to the largest alignment of all the FFS files in the FV
+ //
+ if (((FvHeader->Attributes & EFI_FVB2_WEAK_ALIGNMENT) != EFI_FVB2_WEAK_ALIGNMENT) &&
+ (((FvHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16)) < MaxFfsAlignment) {
+ FvHeader->Attributes = ((MaxFfsAlignment << 16) | (FvHeader->Attributes & 0xFFFF));
+ //
+ // Update Checksum for FvHeader
+ //
+ FvHeader->Checksum = 0;
+ FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
+ }
+
+ //
+ // If there are large FFS in FV, the file system GUID should set to system 3 GUID.
+ //
+ if (mIsLargeFfs && CompareGuid (&FvHeader->FileSystemGuid, &mEfiFirmwareFileSystem2Guid) == 0) {
+ memcpy (&FvHeader->FileSystemGuid, &mEfiFirmwareFileSystem3Guid, sizeof (EFI_GUID));
+ FvHeader->Checksum = 0;
+ FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
+ }
+
+WriteFile:
+ //
+ // Write fv file
+ //
+ FvFile = fopen (LongFilePath (FvFileName), "wb");
+ if (FvFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", FvFileName);
+ Status = EFI_ABORTED;
+ goto Finish;
+ }
+
+ if (fwrite (FvImage, 1, FvImageSize, FvFile) != FvImageSize) {
+ Error (NULL, 0, 0002, "Error writing file", FvFileName);
+ Status = EFI_ABORTED;
+ goto Finish;
+ }
+
+Finish:
+ if (FvBufferHeader != NULL) {
+ free (FvBufferHeader);
+ }
+
+ if (FvExtHeader != NULL) {
+ free (FvExtHeader);
+ }
+
+ if (FvMapName != NULL) {
+ free (FvMapName);
+ }
+
+ if (FvReportName != NULL) {
+ free (FvReportName);
+ }
+
+ if (FvFile != NULL) {
+ fflush (FvFile);
+ fclose (FvFile);
+ }
+
+ if (FvMapFile != NULL) {
+ fflush (FvMapFile);
+ fclose (FvMapFile);
+ }
+
+ if (FvReportFile != NULL) {
+ fflush (FvReportFile);
+ fclose (FvReportFile);
+ }
+ return Status;
+}
+
+EFI_STATUS
+UpdatePeiCoreEntryInFit (
+ IN FIT_TABLE *FitTablePtr,
+ IN UINT64 PeiCorePhysicalAddress
+ )
+/*++
+
+Routine Description:
+
+ This function is used to update the Pei Core address in FIT, this can be used by Sec core to pass control from
+ Sec to Pei Core
+
+Arguments:
+
+ FitTablePtr - The pointer of FIT_TABLE.
+ PeiCorePhysicalAddress - The address of Pei Core entry.
+
+Returns:
+
+ EFI_SUCCESS - The PEI_CORE FIT entry was updated successfully.
+ EFI_NOT_FOUND - Not found the PEI_CORE FIT entry.
+
+--*/
+{
+ FIT_TABLE *TmpFitPtr;
+ UINTN Index;
+ UINTN NumFitComponents;
+
+ TmpFitPtr = FitTablePtr;
+ NumFitComponents = TmpFitPtr->CompSize;
+
+ for (Index = 0; Index < NumFitComponents; Index++) {
+ if ((TmpFitPtr->CvAndType & FIT_TYPE_MASK) == COMP_TYPE_FIT_PEICORE) {
+ TmpFitPtr->CompAddress = PeiCorePhysicalAddress;
+ return EFI_SUCCESS;
+ }
+
+ TmpFitPtr++;
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+VOID
+UpdateFitCheckSum (
+ IN FIT_TABLE *FitTablePtr
+ )
+/*++
+
+Routine Description:
+
+ This function is used to update the checksum for FIT.
+
+
+Arguments:
+
+ FitTablePtr - The pointer of FIT_TABLE.
+
+Returns:
+
+ None.
+
+--*/
+{
+ if ((FitTablePtr->CvAndType & CHECKSUM_BIT_MASK) >> 7) {
+ FitTablePtr->CheckSum = 0;
+ FitTablePtr->CheckSum = CalculateChecksum8 ((UINT8 *) FitTablePtr, FitTablePtr->CompSize * 16);
+ }
+}
+
+EFI_STATUS
+CalculateFvSize (
+ FV_INFO *FvInfoPtr
+ )
+/*++
+Routine Description:
+ Calculate the FV size and Update Fv Size based on the actual FFS files.
+ And Update FvInfo data.
+
+Arguments:
+ FvInfoPtr - The pointer to FV_INFO structure.
+
+Returns:
+ EFI_ABORTED - Ffs Image Error
+ EFI_SUCCESS - Successfully update FvSize
+--*/
+{
+ UINTN CurrentOffset;
+ UINTN OrigOffset;
+ UINTN Index;
+ FILE *fpin;
+ UINTN FfsFileSize;
+ UINTN FvExtendHeaderSize;
+ UINT32 FfsAlignment;
+ UINT32 FfsHeaderSize;
+ EFI_FFS_FILE_HEADER FfsHeader;
+ UINTN VtfFileSize;
+ UINTN MaxPadFileSize;
+
+ FvExtendHeaderSize = 0;
+ MaxPadFileSize = 0;
+ VtfFileSize = 0;
+ fpin = NULL;
+ Index = 0;
+
+ //
+ // Compute size for easy access later
+ //
+ FvInfoPtr->Size = 0;
+ for (Index = 0; FvInfoPtr->FvBlocks[Index].NumBlocks > 0 && FvInfoPtr->FvBlocks[Index].Length > 0; Index++) {
+ FvInfoPtr->Size += FvInfoPtr->FvBlocks[Index].NumBlocks * FvInfoPtr->FvBlocks[Index].Length;
+ }
+
+ //
+ // Calculate the required sizes for all FFS files.
+ //
+ CurrentOffset = sizeof (EFI_FIRMWARE_VOLUME_HEADER);
+
+ for (Index = 1;; Index ++) {
+ CurrentOffset += sizeof (EFI_FV_BLOCK_MAP_ENTRY);
+ if (FvInfoPtr->FvBlocks[Index].NumBlocks == 0 || FvInfoPtr->FvBlocks[Index].Length == 0) {
+ break;
+ }
+ }
+
+ //
+ // Calculate PI extension header
+ //
+ if (mFvDataInfo.FvExtHeaderFile[0] != '\0') {
+ fpin = fopen (LongFilePath (mFvDataInfo.FvExtHeaderFile), "rb");
+ if (fpin == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", mFvDataInfo.FvExtHeaderFile);
+ return EFI_ABORTED;
+ }
+ FvExtendHeaderSize = _filelength (fileno (fpin));
+ fclose (fpin);
+ if (sizeof (EFI_FFS_FILE_HEADER) + FvExtendHeaderSize >= MAX_FFS_SIZE) {
+ CurrentOffset += sizeof (EFI_FFS_FILE_HEADER2) + FvExtendHeaderSize;
+ mIsLargeFfs = TRUE;
+ } else {
+ CurrentOffset += sizeof (EFI_FFS_FILE_HEADER) + FvExtendHeaderSize;
+ }
+ CurrentOffset = (CurrentOffset + 7) & (~7);
+ } else if (mFvDataInfo.FvNameGuidSet) {
+ CurrentOffset += sizeof (EFI_FFS_FILE_HEADER) + sizeof (EFI_FIRMWARE_VOLUME_EXT_HEADER);
+ CurrentOffset = (CurrentOffset + 7) & (~7);
+ }
+
+ //
+ // Accumulate every FFS file size.
+ //
+ for (Index = 0; FvInfoPtr->FvFiles[Index][0] != 0; Index++) {
+ //
+ // Open FFS file
+ //
+ fpin = NULL;
+ fpin = fopen (LongFilePath (FvInfoPtr->FvFiles[Index]), "rb");
+ if (fpin == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", FvInfoPtr->FvFiles[Index]);
+ return EFI_ABORTED;
+ }
+ //
+ // Get the file size
+ //
+ FfsFileSize = _filelength (fileno (fpin));
+ if (FfsFileSize >= MAX_FFS_SIZE) {
+ FfsHeaderSize = sizeof(EFI_FFS_FILE_HEADER2);
+ mIsLargeFfs = TRUE;
+ } else {
+ FfsHeaderSize = sizeof(EFI_FFS_FILE_HEADER);
+ }
+ //
+ // Read Ffs File header
+ //
+ fread (&FfsHeader, sizeof (UINT8), sizeof (EFI_FFS_FILE_HEADER), fpin);
+ //
+ // close file
+ //
+ fclose (fpin);
+
+ if (FvInfoPtr->IsPiFvImage) {
+ //
+ // Check whether this ffs file is vtf file
+ //
+ if (IsVtfFile (&FfsHeader)) {
+ if (VtfFileFlag) {
+ //
+ // One Fv image can't have two vtf files.
+ //
+ Error (NULL, 0, 3000,"Invalid", "One Fv image can't have two vtf files.");
+ return EFI_ABORTED;
+ }
+ VtfFileFlag = TRUE;
+ VtfFileSize = FfsFileSize;
+ continue;
+ }
+
+ //
+ // Get the alignment of FFS file
+ //
+ ReadFfsAlignment (&FfsHeader, &FfsAlignment);
+ FfsAlignment = 1 << FfsAlignment;
+ //
+ // Add Pad file
+ //
+ if (((CurrentOffset + FfsHeaderSize) % FfsAlignment) != 0) {
+ //
+ // Only EFI_FFS_FILE_HEADER is needed for a pad section.
+ //
+ OrigOffset = CurrentOffset;
+ CurrentOffset = (CurrentOffset + FfsHeaderSize + sizeof(EFI_FFS_FILE_HEADER) + FfsAlignment - 1) & ~(FfsAlignment - 1);
+ CurrentOffset -= FfsHeaderSize;
+ if ((CurrentOffset - OrigOffset) > MaxPadFileSize) {
+ MaxPadFileSize = CurrentOffset - OrigOffset;
+ }
+ }
+ }
+
+ //
+ // Add ffs file size
+ //
+ if (FvInfoPtr->SizeofFvFiles[Index] > FfsFileSize) {
+ CurrentOffset += FvInfoPtr->SizeofFvFiles[Index];
+ } else {
+ CurrentOffset += FfsFileSize;
+ }
+
+ //
+ // Make next ffs file start at QWord Boundary
+ //
+ if (FvInfoPtr->IsPiFvImage) {
+ CurrentOffset = (CurrentOffset + EFI_FFS_FILE_HEADER_ALIGNMENT - 1) & ~(EFI_FFS_FILE_HEADER_ALIGNMENT - 1);
+ }
+ }
+ CurrentOffset += VtfFileSize;
+ DebugMsg (NULL, 0, 9, "FvImage size", "The calculated fv image size is 0x%x and the current set fv image size is 0x%x", (unsigned) CurrentOffset, (unsigned) FvInfoPtr->Size);
+
+ if (FvInfoPtr->Size == 0) {
+ //
+ // Update FvInfo data
+ //
+ FvInfoPtr->FvBlocks[0].NumBlocks = CurrentOffset / FvInfoPtr->FvBlocks[0].Length + ((CurrentOffset % FvInfoPtr->FvBlocks[0].Length)?1:0);
+ FvInfoPtr->Size = FvInfoPtr->FvBlocks[0].NumBlocks * FvInfoPtr->FvBlocks[0].Length;
+ FvInfoPtr->FvBlocks[1].NumBlocks = 0;
+ FvInfoPtr->FvBlocks[1].Length = 0;
+ } else if (FvInfoPtr->Size < CurrentOffset) {
+ //
+ // Not invalid
+ //
+ Error (NULL, 0, 3000, "Invalid", "the required fv image size 0x%x exceeds the set fv image size 0x%x", (unsigned) CurrentOffset, (unsigned) FvInfoPtr->Size);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Set Fv Size Information
+ //
+ mFvTotalSize = FvInfoPtr->Size;
+ mFvTakenSize = CurrentOffset;
+ if ((mFvTakenSize == mFvTotalSize) && (MaxPadFileSize > 0)) {
+ //
+ // This FV means TOP FFS has been taken. Then, check whether there is padding data for use.
+ //
+ mFvTakenSize = mFvTakenSize - MaxPadFileSize;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+FfsRebaseImageRead (
+ IN VOID *FileHandle,
+ IN UINTN FileOffset,
+ IN OUT UINT32 *ReadSize,
+ OUT VOID *Buffer
+ )
+/*++
+
+Routine Description:
+
+ Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
+
+Arguments:
+
+ FileHandle - The handle to the PE/COFF file
+
+ FileOffset - The offset, in bytes, into the file to read
+
+ ReadSize - The number of bytes to read from the file starting at FileOffset
+
+ Buffer - A pointer to the buffer to read the data into.
+
+Returns:
+
+ EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
+
+--*/
+{
+ CHAR8 *Destination8;
+ CHAR8 *Source8;
+ UINT32 Length;
+
+ Destination8 = Buffer;
+ Source8 = (CHAR8 *) ((UINTN) FileHandle + FileOffset);
+ Length = *ReadSize;
+ while (Length--) {
+ *(Destination8++) = *(Source8++);
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GetChildFvFromFfs (
+ IN FV_INFO *FvInfo,
+ IN EFI_FFS_FILE_HEADER *FfsFile,
+ IN UINTN XipOffset
+ )
+/*++
+
+Routine Description:
+
+ This function gets all child FvImages in the input FfsFile, and records
+ their base address to the parent image.
+
+Arguments:
+ FvInfo A pointer to FV_INFO structure.
+ FfsFile A pointer to Ffs file image that may contain FvImage.
+ XipOffset The offset address to the parent FvImage base.
+
+Returns:
+
+ EFI_SUCCESS Base address of child Fv image is recorded.
+--*/
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ EFI_FILE_SECTION_POINTER SubFvSection;
+ EFI_FIRMWARE_VOLUME_HEADER *SubFvImageHeader;
+ EFI_PHYSICAL_ADDRESS SubFvBaseAddress;
+ EFI_FILE_SECTION_POINTER CorePe32;
+ UINT16 MachineType;
+
+ for (Index = 1;; Index++) {
+ //
+ // Find FV section
+ //
+ Status = GetSectionByType (FfsFile, EFI_SECTION_FIRMWARE_VOLUME_IMAGE, Index, &SubFvSection);
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+ SubFvImageHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINT8 *) SubFvSection.FVImageSection + GetSectionHeaderLength(SubFvSection.FVImageSection));
+
+ //
+ // See if there's an SEC core in the child FV
+ Status = FindCorePeSection(SubFvImageHeader, SubFvImageHeader->FvLength, EFI_FV_FILETYPE_SECURITY_CORE, &CorePe32);
+
+ // if we couldn't find the SEC core, look for a PEI core
+ if (EFI_ERROR(Status)) {
+ Status = FindCorePeSection(SubFvImageHeader, SubFvImageHeader->FvLength, EFI_FV_FILETYPE_PEI_CORE, &CorePe32);
+ }
+
+ if (!EFI_ERROR(Status)) {
+ Status = GetCoreMachineType(CorePe32, &MachineType);
+ if (EFI_ERROR(Status)) {
+ Error(NULL, 0, 3000, "Invalid", "Could not get the PE32 machine type for SEC/PEI Core.");
+ return EFI_ABORTED;
+ }
+
+ // machine type is ARM, set a flag so ARM reset vector processing occurs
+ if ((MachineType == EFI_IMAGE_MACHINE_ARMT) || (MachineType == EFI_IMAGE_MACHINE_AARCH64)) {
+ VerboseMsg("Located ARM/AArch64 SEC/PEI core in child FV");
+ mArm = TRUE;
+ }
+ }
+
+ //
+ // Rebase on Flash
+ //
+ SubFvBaseAddress = FvInfo->BaseAddress + (UINTN) SubFvImageHeader - (UINTN) FfsFile + XipOffset;
+ mFvBaseAddress[mFvBaseAddressNumber ++ ] = SubFvBaseAddress;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+FfsRebase (
+ IN OUT FV_INFO *FvInfo,
+ IN CHAR8 *FileName,
+ IN OUT EFI_FFS_FILE_HEADER *FfsFile,
+ IN UINTN XipOffset,
+ IN FILE *FvMapFile
+ )
+/*++
+
+Routine Description:
+
+ This function determines if a file is XIP and should be rebased. It will
+ rebase any PE32 sections found in the file using the base address.
+
+Arguments:
+
+ FvInfo A pointer to FV_INFO structure.
+ FileName Ffs File PathName
+ FfsFile A pointer to Ffs file image.
+ XipOffset The offset address to use for rebasing the XIP file image.
+ FvMapFile FvMapFile to record the function address in one Fvimage
+
+Returns:
+
+ EFI_SUCCESS The image was properly rebased.
+ EFI_INVALID_PARAMETER An input parameter is invalid.
+ EFI_ABORTED An error occurred while rebasing the input file image.
+ EFI_OUT_OF_RESOURCES Could not allocate a required resource.
+ EFI_NOT_FOUND No compressed sections could be found.
+
+--*/
+{
+ EFI_STATUS Status;
+ PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
+ PE_COFF_LOADER_IMAGE_CONTEXT OrigImageContext;
+ EFI_PHYSICAL_ADDRESS XipBase;
+ EFI_PHYSICAL_ADDRESS NewPe32BaseAddress;
+ UINTN Index;
+ EFI_FILE_SECTION_POINTER CurrentPe32Section;
+ EFI_FFS_FILE_STATE SavedState;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
+ EFI_TE_IMAGE_HEADER *TEImageHeader;
+ UINT8 *MemoryImagePointer;
+ EFI_IMAGE_SECTION_HEADER *SectionHeader;
+ CHAR8 PeFileName [MAX_LONG_FILE_PATH];
+ CHAR8 *Cptr;
+ FILE *PeFile;
+ UINT8 *PeFileBuffer;
+ UINT32 PeFileSize;
+ CHAR8 *PdbPointer;
+ UINT32 FfsHeaderSize;
+ UINT32 CurSecHdrSize;
+
+ Index = 0;
+ MemoryImagePointer = NULL;
+ TEImageHeader = NULL;
+ ImgHdr = NULL;
+ SectionHeader = NULL;
+ Cptr = NULL;
+ PeFile = NULL;
+ PeFileBuffer = NULL;
+
+ //
+ // Don't need to relocate image when BaseAddress is zero and no ForceRebase Flag specified.
+ //
+ if ((FvInfo->BaseAddress == 0) && (FvInfo->ForceRebase == -1)) {
+ return EFI_SUCCESS;
+ }
+
+ //
+ // If ForceRebase Flag specified to FALSE, will always not take rebase action.
+ //
+ if (FvInfo->ForceRebase == 0) {
+ return EFI_SUCCESS;
+ }
+
+
+ XipBase = FvInfo->BaseAddress + XipOffset;
+
+ //
+ // We only process files potentially containing PE32 sections.
+ //
+ switch (FfsFile->Type) {
+ case EFI_FV_FILETYPE_SECURITY_CORE:
+ case EFI_FV_FILETYPE_PEI_CORE:
+ case EFI_FV_FILETYPE_PEIM:
+ case EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER:
+ case EFI_FV_FILETYPE_DRIVER:
+ case EFI_FV_FILETYPE_DXE_CORE:
+ break;
+ case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE:
+ //
+ // Rebase the inside FvImage.
+ //
+ GetChildFvFromFfs (FvInfo, FfsFile, XipOffset);
+
+ //
+ // Search PE/TE section in FV sectin.
+ //
+ break;
+ default:
+ return EFI_SUCCESS;
+ }
+
+ FfsHeaderSize = GetFfsHeaderLength(FfsFile);
+ //
+ // Rebase each PE32 section
+ //
+ Status = EFI_SUCCESS;
+ for (Index = 1;; Index++) {
+ //
+ // Init Value
+ //
+ NewPe32BaseAddress = 0;
+
+ //
+ // Find Pe Image
+ //
+ Status = GetSectionByType (FfsFile, EFI_SECTION_PE32, Index, &CurrentPe32Section);
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+ CurSecHdrSize = GetSectionHeaderLength(CurrentPe32Section.CommonHeader);
+
+ //
+ // Initialize context
+ //
+ memset (&ImageContext, 0, sizeof (ImageContext));
+ ImageContext.Handle = (VOID *) ((UINTN) CurrentPe32Section.Pe32Section + CurSecHdrSize);
+ ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) FfsRebaseImageRead;
+ Status = PeCoffLoaderGetImageInfo (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, (int) Status);
+ return Status;
+ }
+
+ if ( (ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
+ (ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64) ) {
+ mArm = TRUE;
+ }
+
+ if (ImageContext.Machine == EFI_IMAGE_MACHINE_RISCV64) {
+ mRiscV = TRUE;
+ }
+
+ //
+ // Keep Image Context for PE image in FV
+ //
+ memcpy (&OrigImageContext, &ImageContext, sizeof (ImageContext));
+
+ //
+ // Get File PdbPointer
+ //
+ PdbPointer = PeCoffLoaderGetPdbPointer (ImageContext.Handle);
+
+ //
+ // Get PeHeader pointer
+ //
+ ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)((UINTN) CurrentPe32Section.Pe32Section + CurSecHdrSize + ImageContext.PeCoffHeaderOffset);
+
+ //
+ // Calculate the PE32 base address, based on file type
+ //
+ switch (FfsFile->Type) {
+ case EFI_FV_FILETYPE_SECURITY_CORE:
+ case EFI_FV_FILETYPE_PEI_CORE:
+ case EFI_FV_FILETYPE_PEIM:
+ case EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER:
+ //
+ // Check if section-alignment and file-alignment match or not
+ //
+ if ((ImgHdr->Pe32.OptionalHeader.SectionAlignment != ImgHdr->Pe32.OptionalHeader.FileAlignment)) {
+ //
+ // Xip module has the same section alignment and file alignment.
+ //
+ Error (NULL, 0, 3000, "Invalid", "PE image Section-Alignment and File-Alignment do not match : %s.", FileName);
+ return EFI_ABORTED;
+ }
+ //
+ // PeImage has no reloc section. It will try to get reloc data from the original EFI image.
+ //
+ if (ImageContext.RelocationsStripped) {
+ //
+ // Construct the original efi file Name
+ //
+ if (strlen (FileName) >= MAX_LONG_FILE_PATH) {
+ Error (NULL, 0, 2000, "Invalid", "The file name %s is too long.", FileName);
+ return EFI_ABORTED;
+ }
+ strncpy (PeFileName, FileName, MAX_LONG_FILE_PATH - 1);
+ PeFileName[MAX_LONG_FILE_PATH - 1] = 0;
+ Cptr = PeFileName + strlen (PeFileName);
+ while (*Cptr != '.') {
+ Cptr --;
+ }
+ if (*Cptr != '.') {
+ Error (NULL, 0, 3000, "Invalid", "The file %s has no .reloc section.", FileName);
+ return EFI_ABORTED;
+ } else {
+ *(Cptr + 1) = 'e';
+ *(Cptr + 2) = 'f';
+ *(Cptr + 3) = 'i';
+ *(Cptr + 4) = '\0';
+ }
+ PeFile = fopen (LongFilePath (PeFileName), "rb");
+ if (PeFile == NULL) {
+ Warning (NULL, 0, 0, "Invalid", "The file %s has no .reloc section.", FileName);
+ //Error (NULL, 0, 3000, "Invalid", "The file %s has no .reloc section.", FileName);
+ //return EFI_ABORTED;
+ break;
+ }
+ //
+ // Get the file size
+ //
+ PeFileSize = _filelength (fileno (PeFile));
+ PeFileBuffer = (UINT8 *) malloc (PeFileSize);
+ if (PeFileBuffer == NULL) {
+ fclose (PeFile);
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Read Pe File
+ //
+ fread (PeFileBuffer, sizeof (UINT8), PeFileSize, PeFile);
+ //
+ // close file
+ //
+ fclose (PeFile);
+ //
+ // Handle pointer to the original efi image.
+ //
+ ImageContext.Handle = PeFileBuffer;
+ Status = PeCoffLoaderGetImageInfo (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, (int) Status);
+ return Status;
+ }
+ ImageContext.RelocationsStripped = FALSE;
+ }
+
+ NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + CurSecHdrSize - (UINTN)FfsFile;
+ break;
+
+ case EFI_FV_FILETYPE_DRIVER:
+ case EFI_FV_FILETYPE_DXE_CORE:
+ //
+ // Check if section-alignment and file-alignment match or not
+ //
+ if ((ImgHdr->Pe32.OptionalHeader.SectionAlignment != ImgHdr->Pe32.OptionalHeader.FileAlignment)) {
+ //
+ // Xip module has the same section alignment and file alignment.
+ //
+ Error (NULL, 0, 3000, "Invalid", "PE image Section-Alignment and File-Alignment do not match : %s.", FileName);
+ return EFI_ABORTED;
+ }
+ NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + CurSecHdrSize - (UINTN)FfsFile;
+ break;
+
+ default:
+ //
+ // Not supported file type
+ //
+ return EFI_SUCCESS;
+ }
+
+ //
+ // Relocation doesn't exist
+ //
+ if (ImageContext.RelocationsStripped) {
+ Warning (NULL, 0, 0, "Invalid", "The file %s has no .reloc section.", FileName);
+ continue;
+ }
+
+ //
+ // Relocation exist and rebase
+ //
+ //
+ // Load and Relocate Image Data
+ //
+ MemoryImagePointer = (UINT8 *) malloc ((UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
+ if (MemoryImagePointer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ memset ((VOID *) MemoryImagePointer, 0, (UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
+ ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~((UINTN) ImageContext.SectionAlignment - 1));
+
+ Status = PeCoffLoaderLoadImage (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "LocateImage() call failed on rebase of %s", FileName);
+ free ((VOID *) MemoryImagePointer);
+ return Status;
+ }
+
+ ImageContext.DestinationAddress = NewPe32BaseAddress;
+ Status = PeCoffLoaderRelocateImage (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "RelocateImage() call failed on rebase of %s Status=%d", FileName, Status);
+ free ((VOID *) MemoryImagePointer);
+ return Status;
+ }
+
+ //
+ // Copy Relocated data to raw image file.
+ //
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
+ (UINTN) ImgHdr +
+ sizeof (UINT32) +
+ sizeof (EFI_IMAGE_FILE_HEADER) +
+ ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
+ );
+
+ for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
+ CopyMem (
+ (UINT8 *) CurrentPe32Section.Pe32Section + CurSecHdrSize + SectionHeader->PointerToRawData,
+ (VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
+ SectionHeader->SizeOfRawData
+ );
+ }
+
+ free ((VOID *) MemoryImagePointer);
+ MemoryImagePointer = NULL;
+ if (PeFileBuffer != NULL) {
+ free (PeFileBuffer);
+ PeFileBuffer = NULL;
+ }
+
+ //
+ // Update Image Base Address
+ //
+ if (ImgHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ ImgHdr->Pe32.OptionalHeader.ImageBase = (UINT32) NewPe32BaseAddress;
+ } else if (ImgHdr->Pe32Plus.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
+ ImgHdr->Pe32Plus.OptionalHeader.ImageBase = NewPe32BaseAddress;
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "unknown PE magic signature %X in PE32 image %s",
+ ImgHdr->Pe32.OptionalHeader.Magic,
+ FileName
+ );
+ return EFI_ABORTED;
+ }
+
+ //
+ // Now update file checksum
+ //
+ if (FfsFile->Attributes & FFS_ATTRIB_CHECKSUM) {
+ SavedState = FfsFile->State;
+ FfsFile->IntegrityCheck.Checksum.File = 0;
+ FfsFile->State = 0;
+ FfsFile->IntegrityCheck.Checksum.File = CalculateChecksum8 (
+ (UINT8 *) ((UINT8 *)FfsFile + FfsHeaderSize),
+ GetFfsFileLength (FfsFile) - FfsHeaderSize
+ );
+ FfsFile->State = SavedState;
+ }
+
+ //
+ // Get this module function address from ModulePeMapFile and add them into FvMap file
+ //
+
+ //
+ // Default use FileName as map file path
+ //
+ if (PdbPointer == NULL) {
+ PdbPointer = FileName;
+ }
+
+ WriteMapFile (FvMapFile, PdbPointer, FfsFile, NewPe32BaseAddress, &OrigImageContext);
+ }
+
+ if (FfsFile->Type != EFI_FV_FILETYPE_SECURITY_CORE &&
+ FfsFile->Type != EFI_FV_FILETYPE_PEI_CORE &&
+ FfsFile->Type != EFI_FV_FILETYPE_PEIM &&
+ FfsFile->Type != EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER &&
+ FfsFile->Type != EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
+ ) {
+ //
+ // Only Peim code may have a TE section
+ //
+ return EFI_SUCCESS;
+ }
+
+ //
+ // Now process TE sections
+ //
+ for (Index = 1;; Index++) {
+ NewPe32BaseAddress = 0;
+
+ //
+ // Find Te Image
+ //
+ Status = GetSectionByType (FfsFile, EFI_SECTION_TE, Index, &CurrentPe32Section);
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+
+ CurSecHdrSize = GetSectionHeaderLength(CurrentPe32Section.CommonHeader);
+
+ //
+ // Calculate the TE base address, the FFS file base plus the offset of the TE section less the size stripped off
+ // by GenTEImage
+ //
+ TEImageHeader = (EFI_TE_IMAGE_HEADER *) ((UINT8 *) CurrentPe32Section.Pe32Section + CurSecHdrSize);
+
+ //
+ // Initialize context, load image info.
+ //
+ memset (&ImageContext, 0, sizeof (ImageContext));
+ ImageContext.Handle = (VOID *) TEImageHeader;
+ ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) FfsRebaseImageRead;
+ Status = PeCoffLoaderGetImageInfo (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, (int) Status);
+ return Status;
+ }
+
+ if ( (ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
+ (ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64) ) {
+ mArm = TRUE;
+ }
+
+ //
+ // Keep Image Context for TE image in FV
+ //
+ memcpy (&OrigImageContext, &ImageContext, sizeof (ImageContext));
+
+ //
+ // Get File PdbPointer
+ //
+ PdbPointer = PeCoffLoaderGetPdbPointer (ImageContext.Handle);
+
+ //
+ // Set new rebased address.
+ //
+ NewPe32BaseAddress = XipBase + (UINTN) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) \
+ - TEImageHeader->StrippedSize - (UINTN) FfsFile;
+
+ //
+ // if reloc is stripped, try to get the original efi image to get reloc info.
+ //
+ if (ImageContext.RelocationsStripped) {
+ //
+ // Construct the original efi file name
+ //
+ if (strlen (FileName) >= MAX_LONG_FILE_PATH) {
+ Error (NULL, 0, 2000, "Invalid", "The file name %s is too long.", FileName);
+ return EFI_ABORTED;
+ }
+ strncpy (PeFileName, FileName, MAX_LONG_FILE_PATH - 1);
+ PeFileName[MAX_LONG_FILE_PATH - 1] = 0;
+ Cptr = PeFileName + strlen (PeFileName);
+ while (*Cptr != '.') {
+ Cptr --;
+ }
+
+ if (*Cptr != '.') {
+ Error (NULL, 0, 3000, "Invalid", "The file %s has no .reloc section.", FileName);
+ return EFI_ABORTED;
+ } else {
+ *(Cptr + 1) = 'e';
+ *(Cptr + 2) = 'f';
+ *(Cptr + 3) = 'i';
+ *(Cptr + 4) = '\0';
+ }
+
+ PeFile = fopen (LongFilePath (PeFileName), "rb");
+ if (PeFile == NULL) {
+ Warning (NULL, 0, 0, "Invalid", "The file %s has no .reloc section.", FileName);
+ //Error (NULL, 0, 3000, "Invalid", "The file %s has no .reloc section.", FileName);
+ //return EFI_ABORTED;
+ } else {
+ //
+ // Get the file size
+ //
+ PeFileSize = _filelength (fileno (PeFile));
+ PeFileBuffer = (UINT8 *) malloc (PeFileSize);
+ if (PeFileBuffer == NULL) {
+ fclose (PeFile);
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Read Pe File
+ //
+ fread (PeFileBuffer, sizeof (UINT8), PeFileSize, PeFile);
+ //
+ // close file
+ //
+ fclose (PeFile);
+ //
+ // Append reloc section into TeImage
+ //
+ ImageContext.Handle = PeFileBuffer;
+ Status = PeCoffLoaderGetImageInfo (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, (int) Status);
+ return Status;
+ }
+ ImageContext.RelocationsStripped = FALSE;
+ }
+ }
+ //
+ // Relocation doesn't exist
+ //
+ if (ImageContext.RelocationsStripped) {
+ Warning (NULL, 0, 0, "Invalid", "The file %s has no .reloc section.", FileName);
+ continue;
+ }
+
+ //
+ // Relocation exist and rebase
+ //
+ //
+ // Load and Relocate Image Data
+ //
+ MemoryImagePointer = (UINT8 *) malloc ((UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
+ if (MemoryImagePointer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ memset ((VOID *) MemoryImagePointer, 0, (UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
+ ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~((UINTN) ImageContext.SectionAlignment - 1));
+
+ Status = PeCoffLoaderLoadImage (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "LocateImage() call failed on rebase of %s", FileName);
+ free ((VOID *) MemoryImagePointer);
+ return Status;
+ }
+ //
+ // Reloacate TeImage
+ //
+ ImageContext.DestinationAddress = NewPe32BaseAddress;
+ Status = PeCoffLoaderRelocateImage (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "RelocateImage() call failed on rebase of TE image %s", FileName);
+ free ((VOID *) MemoryImagePointer);
+ return Status;
+ }
+
+ //
+ // Copy the relocated image into raw image file.
+ //
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (TEImageHeader + 1);
+ for (Index = 0; Index < TEImageHeader->NumberOfSections; Index ++, SectionHeader ++) {
+ if (!ImageContext.IsTeImage) {
+ CopyMem (
+ (UINT8 *) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->PointerToRawData,
+ (VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
+ SectionHeader->SizeOfRawData
+ );
+ } else {
+ CopyMem (
+ (UINT8 *) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->PointerToRawData,
+ (VOID*) (UINTN) (ImageContext.ImageAddress + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->VirtualAddress),
+ SectionHeader->SizeOfRawData
+ );
+ }
+ }
+
+ //
+ // Free the allocated memory resource
+ //
+ free ((VOID *) MemoryImagePointer);
+ MemoryImagePointer = NULL;
+ if (PeFileBuffer != NULL) {
+ free (PeFileBuffer);
+ PeFileBuffer = NULL;
+ }
+
+ //
+ // Update Image Base Address
+ //
+ TEImageHeader->ImageBase = NewPe32BaseAddress;
+
+ //
+ // Now update file checksum
+ //
+ if (FfsFile->Attributes & FFS_ATTRIB_CHECKSUM) {
+ SavedState = FfsFile->State;
+ FfsFile->IntegrityCheck.Checksum.File = 0;
+ FfsFile->State = 0;
+ FfsFile->IntegrityCheck.Checksum.File = CalculateChecksum8 (
+ (UINT8 *)((UINT8 *)FfsFile + FfsHeaderSize),
+ GetFfsFileLength (FfsFile) - FfsHeaderSize
+ );
+ FfsFile->State = SavedState;
+ }
+ //
+ // Get this module function address from ModulePeMapFile and add them into FvMap file
+ //
+
+ //
+ // Default use FileName as map file path
+ //
+ if (PdbPointer == NULL) {
+ PdbPointer = FileName;
+ }
+
+ WriteMapFile (
+ FvMapFile,
+ PdbPointer,
+ FfsFile,
+ NewPe32BaseAddress,
+ &OrigImageContext
+ );
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+FindApResetVectorPosition (
+ IN MEMORY_FILE *FvImage,
+ OUT UINT8 **Pointer
+ )
+/*++
+
+Routine Description:
+
+ Find the position in this FvImage to place Ap reset vector.
+
+Arguments:
+
+ FvImage Memory file for the FV memory image.
+ Pointer Pointer to pointer to position.
+
+Returns:
+
+ EFI_NOT_FOUND - No satisfied position is found.
+ EFI_SUCCESS - The suitable position is return.
+
+--*/
+{
+ EFI_FFS_FILE_HEADER *PadFile;
+ UINT32 Index;
+ EFI_STATUS Status;
+ UINT8 *FixPoint;
+ UINT32 FileLength;
+
+ for (Index = 1; ;Index ++) {
+ //
+ // Find Pad File to add ApResetVector info
+ //
+ Status = GetFileByType (EFI_FV_FILETYPE_FFS_PAD, Index, &PadFile);
+ if (EFI_ERROR (Status) || (PadFile == NULL)) {
+ //
+ // No Pad file to be found.
+ //
+ break;
+ }
+ //
+ // Get Pad file size.
+ //
+ FileLength = GetFfsFileLength(PadFile);
+ FileLength = (FileLength + EFI_FFS_FILE_HEADER_ALIGNMENT - 1) & ~(EFI_FFS_FILE_HEADER_ALIGNMENT - 1);
+ //
+ // FixPoint must be align on 0x1000 relative to FvImage Header
+ //
+ FixPoint = (UINT8*) PadFile + GetFfsHeaderLength(PadFile);
+ FixPoint = FixPoint + 0x1000 - (((UINTN) FixPoint - (UINTN) FvImage->FileImage) & 0xFFF);
+ //
+ // FixPoint be larger at the last place of one fv image.
+ //
+ while (((UINTN) FixPoint + SIZEOF_STARTUP_DATA_ARRAY - (UINTN) PadFile) <= FileLength) {
+ FixPoint += 0x1000;
+ }
+ FixPoint -= 0x1000;
+
+ if ((UINTN) FixPoint < ((UINTN) PadFile + GetFfsHeaderLength(PadFile))) {
+ //
+ // No alignment FixPoint in this Pad File.
+ //
+ continue;
+ }
+
+ if ((UINTN) FvImage->Eof - (UINTN)FixPoint <= 0x20000) {
+ //
+ // Find the position to place ApResetVector
+ //
+ *Pointer = FixPoint;
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+EFI_STATUS
+ParseCapInf (
+ IN MEMORY_FILE *InfFile,
+ OUT CAP_INFO *CapInfo
+ )
+/*++
+
+Routine Description:
+
+ This function parses a Cap.INF file and copies info into a CAP_INFO structure.
+
+Arguments:
+
+ InfFile Memory file image.
+ CapInfo Information read from INF file.
+
+Returns:
+
+ EFI_SUCCESS INF file information successfully retrieved.
+ EFI_ABORTED INF file has an invalid format.
+ EFI_NOT_FOUND A required string was not found in the INF file.
+--*/
+{
+ CHAR8 Value[MAX_LONG_FILE_PATH];
+ UINT64 Value64;
+ UINTN Index, Number;
+ EFI_STATUS Status;
+
+ //
+ // Initialize Cap info
+ //
+ // memset (CapInfo, 0, sizeof (CAP_INFO));
+ //
+
+ //
+ // Read the Capsule Guid
+ //
+ Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_CAPSULE_GUID_STRING, 0, Value);
+ if (Status == EFI_SUCCESS) {
+ //
+ // Get the Capsule Guid
+ //
+ Status = StringToGuid (Value, &CapInfo->CapGuid);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 2000, "Invalid parameter", "%s = %s", EFI_CAPSULE_GUID_STRING, Value);
+ return EFI_ABORTED;
+ }
+ DebugMsg (NULL, 0, 9, "Capsule Guid", "%s = %s", EFI_CAPSULE_GUID_STRING, Value);
+ }
+
+ //
+ // Read the Capsule Header Size
+ //
+ Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_CAPSULE_HEADER_SIZE_STRING, 0, Value);
+ if (Status == EFI_SUCCESS) {
+ Status = AsciiStringToUint64 (Value, FALSE, &Value64);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 2000, "Invalid parameter", "%s = %s", EFI_CAPSULE_HEADER_SIZE_STRING, Value);
+ return EFI_ABORTED;
+ }
+ CapInfo->HeaderSize = (UINT32) Value64;
+ DebugMsg (NULL, 0, 9, "Capsule Header size", "%s = %s", EFI_CAPSULE_HEADER_SIZE_STRING, Value);
+ }
+
+ //
+ // Read the Capsule Flag
+ //
+ Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_CAPSULE_FLAGS_STRING, 0, Value);
+ if (Status == EFI_SUCCESS) {
+ if (strstr (Value, "PopulateSystemTable") != NULL) {
+ CapInfo->Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE;
+ if (strstr (Value, "InitiateReset") != NULL) {
+ CapInfo->Flags |= CAPSULE_FLAGS_INITIATE_RESET;
+ }
+ } else if (strstr (Value, "PersistAcrossReset") != NULL) {
+ CapInfo->Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET;
+ if (strstr (Value, "InitiateReset") != NULL) {
+ CapInfo->Flags |= CAPSULE_FLAGS_INITIATE_RESET;
+ }
+ } else {
+ Error (NULL, 0, 2000, "Invalid parameter", "invalid Flag setting for %s.", EFI_CAPSULE_FLAGS_STRING);
+ return EFI_ABORTED;
+ }
+ DebugMsg (NULL, 0, 9, "Capsule Flag", Value);
+ }
+
+ Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_OEM_CAPSULE_FLAGS_STRING, 0, Value);
+ if (Status == EFI_SUCCESS) {
+ Status = AsciiStringToUint64 (Value, FALSE, &Value64);
+ if (EFI_ERROR (Status) || Value64 > 0xffff) {
+ Error (NULL, 0, 2000, "Invalid parameter",
+ "invalid Flag setting for %s. Must be integer value between 0x0000 and 0xffff.",
+ EFI_OEM_CAPSULE_FLAGS_STRING);
+ return EFI_ABORTED;
+ }
+ CapInfo->Flags |= Value64;
+ DebugMsg (NULL, 0, 9, "Capsule Extend Flag", Value);
+ }
+
+ //
+ // Read Capsule File name
+ //
+ Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_FILE_NAME_STRING, 0, Value);
+ if (Status == EFI_SUCCESS) {
+ //
+ // Get output file name
+ //
+ strcpy (CapInfo->CapName, Value);
+ }
+
+ //
+ // Read the Capsule FileImage
+ //
+ Number = 0;
+ for (Index = 0; Index < MAX_NUMBER_OF_FILES_IN_CAP; Index++) {
+ if (CapInfo->CapFiles[Index][0] != '\0') {
+ continue;
+ }
+ //
+ // Read the capsule file name
+ //
+ Status = FindToken (InfFile, FILES_SECTION_STRING, EFI_FILE_NAME_STRING, Number++, Value);
+
+ if (Status == EFI_SUCCESS) {
+ //
+ // Add the file
+ //
+ strcpy (CapInfo->CapFiles[Index], Value);
+ DebugMsg (NULL, 0, 9, "Capsule component file", "the %uth file name is %s", (unsigned) Index, CapInfo->CapFiles[Index]);
+ } else {
+ break;
+ }
+ }
+
+ if (Index == 0) {
+ Warning (NULL, 0, 0, "Capsule components are not specified.", NULL);
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GenerateCapImage (
+ IN CHAR8 *InfFileImage,
+ IN UINTN InfFileSize,
+ IN CHAR8 *CapFileName
+ )
+/*++
+
+Routine Description:
+
+ This is the main function which will be called from application to create UEFI Capsule image.
+
+Arguments:
+
+ InfFileImage Buffer containing the INF file contents.
+ InfFileSize Size of the contents of the InfFileImage buffer.
+ CapFileName Requested name for the Cap file.
+
+Returns:
+
+ EFI_SUCCESS Function completed successfully.
+ EFI_OUT_OF_RESOURCES Could not allocate required resources.
+ EFI_ABORTED Error encountered.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+
+--*/
+{
+ UINT32 CapSize;
+ UINT8 *CapBuffer;
+ EFI_CAPSULE_HEADER *CapsuleHeader;
+ MEMORY_FILE InfMemoryFile;
+ UINT32 FileSize;
+ UINT32 Index;
+ FILE *fpin, *fpout;
+ EFI_STATUS Status;
+
+ if (InfFileImage != NULL) {
+ //
+ // Initialize file structures
+ //
+ InfMemoryFile.FileImage = InfFileImage;
+ InfMemoryFile.CurrentFilePointer = InfFileImage;
+ InfMemoryFile.Eof = InfFileImage + InfFileSize;
+
+ //
+ // Parse the Cap inf file for header information
+ //
+ Status = ParseCapInf (&InfMemoryFile, &mCapDataInfo);
+ if (Status != EFI_SUCCESS) {
+ return Status;
+ }
+ }
+
+ if (mCapDataInfo.HeaderSize == 0) {
+ //
+ // make header size align 16 bytes.
+ //
+ mCapDataInfo.HeaderSize = sizeof (EFI_CAPSULE_HEADER);
+ mCapDataInfo.HeaderSize = (mCapDataInfo.HeaderSize + 0xF) & ~0xF;
+ }
+
+ if (mCapDataInfo.HeaderSize < sizeof (EFI_CAPSULE_HEADER)) {
+ Error (NULL, 0, 2000, "Invalid parameter", "The specified HeaderSize cannot be less than the size of EFI_CAPSULE_HEADER.");
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (CapFileName == NULL && mCapDataInfo.CapName[0] != '\0') {
+ CapFileName = mCapDataInfo.CapName;
+ }
+
+ if (CapFileName == NULL) {
+ Error (NULL, 0, 2001, "Missing required argument", "Output Capsule file name");
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Set Default Capsule Guid value
+ //
+ if (CompareGuid (&mCapDataInfo.CapGuid, &mZeroGuid) == 0) {
+ memcpy (&mCapDataInfo.CapGuid, &mDefaultCapsuleGuid, sizeof (EFI_GUID));
+ }
+ //
+ // Calculate the size of capsule image.
+ //
+ Index = 0;
+ FileSize = 0;
+ CapSize = mCapDataInfo.HeaderSize;
+ while (mCapDataInfo.CapFiles [Index][0] != '\0') {
+ fpin = fopen (LongFilePath (mCapDataInfo.CapFiles[Index]), "rb");
+ if (fpin == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", mCapDataInfo.CapFiles[Index]);
+ return EFI_ABORTED;
+ }
+ FileSize = _filelength (fileno (fpin));
+ CapSize += FileSize;
+ fclose (fpin);
+ Index ++;
+ }
+
+ //
+ // Allocate buffer for capsule image.
+ //
+ CapBuffer = (UINT8 *) malloc (CapSize);
+ if (CapBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated for creating the capsule.");
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Initialize the capsule header to zero
+ //
+ memset (CapBuffer, 0, mCapDataInfo.HeaderSize);
+
+ //
+ // create capsule header and get capsule body
+ //
+ CapsuleHeader = (EFI_CAPSULE_HEADER *) CapBuffer;
+ memcpy (&CapsuleHeader->CapsuleGuid, &mCapDataInfo.CapGuid, sizeof (EFI_GUID));
+ CapsuleHeader->HeaderSize = mCapDataInfo.HeaderSize;
+ CapsuleHeader->Flags = mCapDataInfo.Flags;
+ CapsuleHeader->CapsuleImageSize = CapSize;
+
+ Index = 0;
+ FileSize = 0;
+ CapSize = CapsuleHeader->HeaderSize;
+ while (mCapDataInfo.CapFiles [Index][0] != '\0') {
+ fpin = fopen (LongFilePath (mCapDataInfo.CapFiles[Index]), "rb");
+ if (fpin == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", mCapDataInfo.CapFiles[Index]);
+ free (CapBuffer);
+ return EFI_ABORTED;
+ }
+ FileSize = _filelength (fileno (fpin));
+ fread (CapBuffer + CapSize, 1, FileSize, fpin);
+ fclose (fpin);
+ Index ++;
+ CapSize += FileSize;
+ }
+
+ //
+ // write capsule data into the output file
+ //
+ fpout = fopen (LongFilePath (CapFileName), "wb");
+ if (fpout == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", CapFileName);
+ free (CapBuffer);
+ return EFI_ABORTED;
+ }
+
+ fwrite (CapBuffer, 1, CapSize, fpout);
+ fclose (fpout);
+ free (CapBuffer);
+
+ VerboseMsg ("The size of the generated capsule image is %u bytes", (unsigned) CapSize);
+
+ return EFI_SUCCESS;
+}
diff --git a/roms/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.h b/roms/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.h
new file mode 100644
index 000000000..58dadc3fa
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.h
@@ -0,0 +1,402 @@
+/** @file
+This file contains describes the public interfaces to the GenFvImage Library.
+The basic purpose of the library is to create Firmware Volume images.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFI_GEN_FV_INTERNAL_LIB_H
+#define _EFI_GEN_FV_INTERNAL_LIB_H
+
+//
+// Include files
+//
+#include <stdlib.h>
+
+#include <Common/UefiBaseTypes.h>
+#include <Common/UefiCapsule.h>
+
+#include <Common/PiFirmwareFile.h>
+#include <Common/PiFirmwareVolume.h>
+#include <Guid/PiFirmwareFileSystem.h>
+#include <IndustryStandard/PeImage.h>
+
+#include "CommonLib.h"
+#include "ParseInf.h"
+#include "EfiUtilityMsgs.h"
+
+//
+// Different file separator for Linux and Windows
+//
+#define FILE_SEP_CHAR '/'
+
+//
+// The maximum number of Pad file guid entries.
+//
+#define MAX_NUMBER_OF_PAD_FILE_GUIDS 1024
+
+//
+// The maximum number of block map entries supported by the library
+//
+#define MAX_NUMBER_OF_FV_BLOCKS 100
+
+//
+// The maximum number of files in the FV supported by the library
+//
+#define MAX_NUMBER_OF_FILES_IN_FV 1000
+#define MAX_NUMBER_OF_FILES_IN_CAP 1000
+#define EFI_FFS_FILE_HEADER_ALIGNMENT 8
+//
+// INF file strings
+//
+#define OPTIONS_SECTION_STRING "[options]"
+#define ATTRIBUTES_SECTION_STRING "[attributes]"
+#define FILES_SECTION_STRING "[files]"
+#define FV_BASE_ADDRESS_STRING "[FV_BASE_ADDRESS]"
+
+//
+// Options section
+//
+#define EFI_FV_BASE_ADDRESS_STRING "EFI_BASE_ADDRESS"
+#define EFI_FV_FILE_NAME_STRING "EFI_FILE_NAME"
+#define EFI_NUM_BLOCKS_STRING "EFI_NUM_BLOCKS"
+#define EFI_BLOCK_SIZE_STRING "EFI_BLOCK_SIZE"
+#define EFI_GUID_STRING "EFI_GUID"
+#define EFI_FV_FILESYSTEMGUID_STRING "EFI_FV_GUID"
+#define EFI_FV_NAMEGUID_STRING "EFI_FVNAME_GUID"
+#define EFI_CAPSULE_GUID_STRING "EFI_CAPSULE_GUID"
+#define EFI_CAPSULE_HEADER_SIZE_STRING "EFI_CAPSULE_HEADER_SIZE"
+#define EFI_CAPSULE_FLAGS_STRING "EFI_CAPSULE_FLAGS"
+#define EFI_OEM_CAPSULE_FLAGS_STRING "EFI_OEM_CAPSULE_FLAGS"
+#define EFI_CAPSULE_VERSION_STRING "EFI_CAPSULE_VERSION"
+
+#define EFI_FV_TOTAL_SIZE_STRING "EFI_FV_TOTAL_SIZE"
+#define EFI_FV_TAKEN_SIZE_STRING "EFI_FV_TAKEN_SIZE"
+#define EFI_FV_SPACE_SIZE_STRING "EFI_FV_SPACE_SIZE"
+
+//
+// Attributes section
+//
+#define EFI_FVB2_READ_DISABLED_CAP_STRING "EFI_READ_DISABLED_CAP"
+#define EFI_FVB2_READ_ENABLED_CAP_STRING "EFI_READ_ENABLED_CAP"
+#define EFI_FVB2_READ_STATUS_STRING "EFI_READ_STATUS"
+
+#define EFI_FVB2_WRITE_DISABLED_CAP_STRING "EFI_WRITE_DISABLED_CAP"
+#define EFI_FVB2_WRITE_ENABLED_CAP_STRING "EFI_WRITE_ENABLED_CAP"
+#define EFI_FVB2_WRITE_STATUS_STRING "EFI_WRITE_STATUS"
+
+#define EFI_FVB2_LOCK_CAP_STRING "EFI_LOCK_CAP"
+#define EFI_FVB2_LOCK_STATUS_STRING "EFI_LOCK_STATUS"
+
+#define EFI_FVB2_STICKY_WRITE_STRING "EFI_STICKY_WRITE"
+#define EFI_FVB2_MEMORY_MAPPED_STRING "EFI_MEMORY_MAPPED"
+#define EFI_FVB2_ERASE_POLARITY_STRING "EFI_ERASE_POLARITY"
+
+#define EFI_FVB2_READ_LOCK_CAP_STRING "EFI_READ_LOCK_CAP"
+#define EFI_FVB2_READ_LOCK_STATUS_STRING "EFI_READ_LOCK_STATUS"
+#define EFI_FVB2_WRITE_LOCK_CAP_STRING "EFI_WRITE_LOCK_CAP"
+#define EFI_FVB2_WRITE_LOCK_STATUS_STRING "EFI_WRITE_LOCK_STATUS"
+
+#define EFI_FVB2_ALIGNMENT_1_STRING "EFI_FVB2_ALIGNMENT_1"
+#define EFI_FVB2_ALIGNMENT_2_STRING "EFI_FVB2_ALIGNMENT_2"
+#define EFI_FVB2_ALIGNMENT_4_STRING "EFI_FVB2_ALIGNMENT_4"
+#define EFI_FVB2_ALIGNMENT_8_STRING "EFI_FVB2_ALIGNMENT_8"
+#define EFI_FVB2_ALIGNMENT_16_STRING "EFI_FVB2_ALIGNMENT_16"
+#define EFI_FVB2_ALIGNMENT_32_STRING "EFI_FVB2_ALIGNMENT_32"
+#define EFI_FVB2_ALIGNMENT_64_STRING "EFI_FVB2_ALIGNMENT_64"
+#define EFI_FVB2_ALIGNMENT_128_STRING "EFI_FVB2_ALIGNMENT_128"
+#define EFI_FVB2_ALIGNMENT_256_STRING "EFI_FVB2_ALIGNMENT_256"
+#define EFI_FVB2_ALIGNMENT_512_STRING "EFI_FVB2_ALIGNMENT_512"
+#define EFI_FVB2_ALIGNMENT_1K_STRING "EFI_FVB2_ALIGNMENT_1K"
+#define EFI_FVB2_ALIGNMENT_2K_STRING "EFI_FVB2_ALIGNMENT_2K"
+#define EFI_FVB2_ALIGNMENT_4K_STRING "EFI_FVB2_ALIGNMENT_4K"
+#define EFI_FVB2_ALIGNMENT_8K_STRING "EFI_FVB2_ALIGNMENT_8K"
+#define EFI_FVB2_ALIGNMENT_16K_STRING "EFI_FVB2_ALIGNMENT_16K"
+#define EFI_FVB2_ALIGNMENT_32K_STRING "EFI_FVB2_ALIGNMENT_32K"
+#define EFI_FVB2_ALIGNMENT_64K_STRING "EFI_FVB2_ALIGNMENT_64K"
+#define EFI_FVB2_ALIGNMENT_128K_STRING "EFI_FVB2_ALIGNMENT_128K"
+#define EFI_FVB2_ALIGNMENT_256K_STRING "EFI_FVB2_ALIGNMENT_256K"
+#define EFI_FVB2_ALIGNMENT_512K_STRING "EFI_FVB2_ALIGNMENT_512K"
+#define EFI_FVB2_ALIGNMENT_1M_STRING "EFI_FVB2_ALIGNMENT_1M"
+#define EFI_FVB2_ALIGNMENT_2M_STRING "EFI_FVB2_ALIGNMENT_2M"
+#define EFI_FVB2_ALIGNMENT_4M_STRING "EFI_FVB2_ALIGNMENT_4M"
+#define EFI_FVB2_ALIGNMENT_8M_STRING "EFI_FVB2_ALIGNMENT_8M"
+#define EFI_FVB2_ALIGNMENT_16M_STRING "EFI_FVB2_ALIGNMENT_16M"
+#define EFI_FVB2_ALIGNMENT_32M_STRING "EFI_FVB2_ALIGNMENT_32M"
+#define EFI_FVB2_ALIGNMENT_64M_STRING "EFI_FVB2_ALIGNMENT_64M"
+#define EFI_FVB2_ALIGNMENT_128M_STRING "EFI_FVB2_ALIGNMENT_128M"
+#define EFI_FVB2_ALIGNMENT_256M_STRING "EFI_FVB2_ALIGNMENT_256M"
+#define EFI_FVB2_ALIGNMENT_512M_STRING "EFI_FVB2_ALIGNMENT_512M"
+#define EFI_FVB2_ALIGNMENT_1G_STRING "EFI_FVB2_ALIGNMENT_1G"
+#define EFI_FVB2_ALIGNMENT_2G_STRING "EFI_FVB2_ALIGNMENT_2G"
+
+#define EFI_FV_WEAK_ALIGNMENT_STRING "EFI_WEAK_ALIGNMENT"
+
+//
+// File sections
+//
+#define EFI_FILE_NAME_STRING "EFI_FILE_NAME"
+
+#define ONE_STRING "1"
+#define ZERO_STRING "0"
+#define TRUE_STRING "TRUE"
+#define FALSE_STRING "FALSE"
+#define NULL_STRING "NULL"
+
+//
+//
+//
+#define EFI_FV_EXT_HEADER_FILE_NAME "EFI_FV_EXT_HEADER_FILE_NAME"
+
+
+//
+// VTF (Firmware Volume Top File) signatures
+//
+#define IA32_X64_VTF_SIGNATURE_OFFSET 0x14
+#define IA32_X64_VTF0_SIGNATURE SIGNATURE_32('V','T','F',0)
+
+//
+// Defines to calculate the offset for PEI CORE entry points
+//
+#define IA32_PEI_CORE_ENTRY_OFFSET 0x20
+
+//
+// Defines to calculate the offset for IA32 SEC CORE entry point
+//
+#define IA32_SEC_CORE_ENTRY_OFFSET 0xD
+
+//
+// Symbol file definitions, current max size if 512K
+//
+#define SYMBOL_FILE_SIZE 0x80000
+
+#define FV_IMAGES_TOP_ADDRESS 0x100000000ULL
+
+//
+// Following definition is used for FIT in IPF
+//
+#define COMP_TYPE_FIT_PEICORE 0x10
+#define COMP_TYPE_FIT_UNUSED 0x7F
+
+#define FIT_TYPE_MASK 0x7F
+#define CHECKSUM_BIT_MASK 0x80
+
+//
+// Private data types
+//
+//
+// Component information
+//
+typedef struct {
+ UINTN Size;
+ CHAR8 ComponentName[MAX_LONG_FILE_PATH];
+} COMPONENT_INFO;
+
+//
+// FV and capsule information holder
+//
+typedef struct {
+ BOOLEAN BaseAddressSet;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ EFI_GUID FvFileSystemGuid;
+ BOOLEAN FvFileSystemGuidSet;
+ EFI_GUID FvNameGuid;
+ BOOLEAN FvNameGuidSet;
+ CHAR8 FvExtHeaderFile[MAX_LONG_FILE_PATH];
+ UINTN Size;
+ EFI_FVB_ATTRIBUTES_2 FvAttributes;
+ CHAR8 FvName[MAX_LONG_FILE_PATH];
+ EFI_FV_BLOCK_MAP_ENTRY FvBlocks[MAX_NUMBER_OF_FV_BLOCKS];
+ CHAR8 FvFiles[MAX_NUMBER_OF_FILES_IN_FV][MAX_LONG_FILE_PATH];
+ UINT32 SizeofFvFiles[MAX_NUMBER_OF_FILES_IN_FV];
+ BOOLEAN IsPiFvImage;
+ INT8 ForceRebase;
+} FV_INFO;
+
+typedef struct {
+ EFI_GUID CapGuid;
+ UINT32 HeaderSize;
+ UINT32 Flags;
+ CHAR8 CapName[MAX_LONG_FILE_PATH];
+ CHAR8 CapFiles[MAX_NUMBER_OF_FILES_IN_CAP][MAX_LONG_FILE_PATH];
+} CAP_INFO;
+
+#pragma pack(1)
+
+typedef struct {
+ UINT64 CompAddress;
+ UINT32 CompSize;
+ UINT16 CompVersion;
+ UINT8 CvAndType;
+ UINT8 CheckSum;
+} FIT_TABLE;
+
+#pragma pack()
+
+#define FV_DEFAULT_ATTRIBUTE 0x0004FEFF
+extern FV_INFO mFvDataInfo;
+extern CAP_INFO mCapDataInfo;
+extern EFI_GUID mEfiFirmwareFileSystem2Guid;
+extern EFI_GUID mEfiFirmwareFileSystem3Guid;
+extern UINT32 mFvTotalSize;
+extern UINT32 mFvTakenSize;
+
+extern EFI_PHYSICAL_ADDRESS mFvBaseAddress[];
+extern UINT32 mFvBaseAddressNumber;
+//
+// Local function prototypes
+//
+EFI_STATUS
+ParseFvInf (
+ IN MEMORY_FILE *InfFile,
+ OUT FV_INFO *FvInfo
+ )
+;
+
+EFI_STATUS
+UpdatePeiCoreEntryInFit (
+ IN FIT_TABLE *FitTablePtr,
+ IN UINT64 PeiCorePhysicalAddress
+ )
+/*++
+
+Routine Description:
+
+ This function is used to update the Pei Core address in FIT, this can be used by Sec core to pass control from
+ Sec to Pei Core
+
+Arguments:
+
+ FitTablePtr - The pointer of FIT_TABLE.
+ PeiCorePhysicalAddress - The address of Pei Core entry.
+
+Returns:
+
+ EFI_SUCCESS - The PEI_CORE FIT entry was updated successfully.
+ EFI_NOT_FOUND - Not found the PEI_CORE FIT entry.
+
+--*/
+;
+
+VOID
+UpdateFitCheckSum (
+ IN FIT_TABLE *FitTablePtr
+ )
+/*++
+
+Routine Description:
+
+ This function is used to update the checksum for FIT.
+
+
+Arguments:
+
+ FitTablePtr - The pointer of FIT_TABLE.
+
+Returns:
+
+ None.
+
+--*/
+;
+
+EFI_STATUS
+GetPe32Info (
+ IN UINT8 *Pe32,
+ OUT UINT32 *EntryPoint,
+ OUT UINT32 *BaseOfCode,
+ OUT UINT16 *MachineType
+ );
+
+EFI_STATUS
+ParseCapInf (
+ IN MEMORY_FILE *InfFile,
+ OUT CAP_INFO *CapInfo
+ );
+
+EFI_STATUS
+FindApResetVectorPosition (
+ IN MEMORY_FILE *FvImage,
+ OUT UINT8 **Pointer
+ );
+
+EFI_STATUS
+CalculateFvSize (
+ FV_INFO *FvInfoPtr
+ );
+
+EFI_STATUS
+FfsRebase (
+ IN OUT FV_INFO *FvInfo,
+ IN CHAR8 *FileName,
+ IN OUT EFI_FFS_FILE_HEADER *FfsFile,
+ IN UINTN XipOffset,
+ IN FILE *FvMapFile
+ );
+
+//
+// Exported function prototypes
+//
+EFI_STATUS
+GenerateCapImage (
+ IN CHAR8 *InfFileImage,
+ IN UINTN InfFileSize,
+ IN CHAR8 *CapFileName
+ )
+/*++
+
+Routine Description:
+
+ This is the main function which will be called from application to
+ generate UEFI Capsule image.
+
+Arguments:
+
+ InfFileImage Buffer containing the INF file contents.
+ InfFileSize Size of the contents of the InfFileImage buffer.
+ CapFileName Requested name for the Cap file.
+
+Returns:
+
+ EFI_SUCCESS Function completed successfully.
+ EFI_OUT_OF_RESOURCES Could not allocate required resources.
+ EFI_ABORTED Error encountered.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+
+--*/
+;
+
+EFI_STATUS
+GenerateFvImage (
+ IN CHAR8 *InfFileImage,
+ IN UINTN InfFileSize,
+ IN CHAR8 *FvFileName,
+ IN CHAR8 *MapFileName
+ )
+/*++
+
+Routine Description:
+
+ This is the main function which will be called from application to
+ generate Firmware Image conforms to PI spec.
+
+Arguments:
+
+ InfFileImage Buffer containing the INF file contents.
+ InfFileSize Size of the contents of the InfFileImage buffer.
+ FvFileName Requested name for the FV file.
+ MapFileName Fv map file to log fv driver information.
+
+Returns:
+
+ EFI_SUCCESS Function completed successfully.
+ EFI_OUT_OF_RESOURCES Could not allocate required resources.
+ EFI_ABORTED Error encountered.
+ EFI_INVALID_PARAMETER A required parameter was NULL.
+
+--*/
+;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/GenFv/Makefile b/roms/edk2/BaseTools/Source/C/GenFv/Makefile
new file mode 100644
index 000000000..3e496a8a6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFv/Makefile
@@ -0,0 +1,16 @@
+## @file
+# Windows makefile for 'GenFv' module build.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+APPNAME = GenFv
+
+LIBS = $(LIB_PATH)\Common.lib RpcRT4.lib
+
+OBJECTS = GenFv.obj GenFvInternalLib.obj
+
+!INCLUDE ..\Makefiles\ms.app
+
diff --git a/roms/edk2/BaseTools/Source/C/GenFw/Elf32Convert.c b/roms/edk2/BaseTools/Source/C/GenFw/Elf32Convert.c
new file mode 100644
index 000000000..7f351287a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -0,0 +1,1178 @@
+/** @file
+Elf32 Convert solution
+
+Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>
+Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "WinNtInclude.h"
+
+#ifndef __GNUC__
+#include <windows.h>
+#include <io.h>
+#endif
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <ctype.h>
+
+#include <Common/UefiBaseTypes.h>
+#include <IndustryStandard/PeImage.h>
+
+#include "PeCoffLib.h"
+#include "EfiUtilityMsgs.h"
+
+#include "GenFw.h"
+#include "ElfConvert.h"
+#include "Elf32Convert.h"
+
+STATIC
+VOID
+ScanSections32 (
+ VOID
+ );
+
+STATIC
+BOOLEAN
+WriteSections32 (
+ SECTION_FILTER_TYPES FilterType
+ );
+
+STATIC
+VOID
+WriteRelocations32 (
+ VOID
+ );
+
+STATIC
+VOID
+WriteDebug32 (
+ VOID
+ );
+
+STATIC
+VOID
+SetImageSize32 (
+ VOID
+ );
+
+STATIC
+VOID
+CleanUp32 (
+ VOID
+ );
+
+//
+// Rename ELF32 structures to common names to help when porting to ELF64.
+//
+typedef Elf32_Shdr Elf_Shdr;
+typedef Elf32_Ehdr Elf_Ehdr;
+typedef Elf32_Rel Elf_Rel;
+typedef Elf32_Sym Elf_Sym;
+typedef Elf32_Phdr Elf_Phdr;
+typedef Elf32_Dyn Elf_Dyn;
+#define ELFCLASS ELFCLASS32
+#define ELF_R_TYPE(r) ELF32_R_TYPE(r)
+#define ELF_R_SYM(r) ELF32_R_SYM(r)
+
+//
+// Well known ELF structures.
+//
+STATIC Elf_Ehdr *mEhdr;
+STATIC Elf_Shdr *mShdrBase;
+STATIC Elf_Phdr *mPhdrBase;
+
+//
+// Coff information
+//
+STATIC UINT32 mCoffAlignment = 0x20;
+
+//
+// PE section alignment.
+//
+STATIC const UINT16 mCoffNbrSections = 4;
+
+//
+// ELF sections to offset in Coff file.
+//
+STATIC UINT32 *mCoffSectionsOffset = NULL;
+
+//
+// Offsets in COFF file
+//
+STATIC UINT32 mNtHdrOffset;
+STATIC UINT32 mTextOffset;
+STATIC UINT32 mDataOffset;
+STATIC UINT32 mHiiRsrcOffset;
+STATIC UINT32 mRelocOffset;
+STATIC UINT32 mDebugOffset;
+
+//
+// Initialization Function
+//
+BOOLEAN
+InitializeElf32 (
+ UINT8 *FileBuffer,
+ ELF_FUNCTION_TABLE *ElfFunctions
+ )
+{
+ //
+ // Initialize data pointer and structures.
+ //
+ mEhdr = (Elf_Ehdr*) FileBuffer;
+
+ //
+ // Check the ELF32 specific header information.
+ //
+ if (mEhdr->e_ident[EI_CLASS] != ELFCLASS32) {
+ Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFCLASS32");
+ return FALSE;
+ }
+ if (mEhdr->e_ident[EI_DATA] != ELFDATA2LSB) {
+ Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFDATA2LSB");
+ return FALSE;
+ }
+ if ((mEhdr->e_type != ET_EXEC) && (mEhdr->e_type != ET_DYN)) {
+ Error (NULL, 0, 3000, "Unsupported", "ELF e_type not ET_EXEC or ET_DYN");
+ return FALSE;
+ }
+ if (!((mEhdr->e_machine == EM_386) || (mEhdr->e_machine == EM_ARM) || (mEhdr->e_machine == EM_RISCV))) {
+ Error (NULL, 0, 3000, "Unsupported", "ELF e_machine is not Elf32 machine.");
+ return FALSE;
+ }
+ if (mEhdr->e_version != EV_CURRENT) {
+ Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) mEhdr->e_version, EV_CURRENT);
+ return FALSE;
+ }
+
+ //
+ // Update section header pointers
+ //
+ mShdrBase = (Elf_Shdr *)((UINT8 *)mEhdr + mEhdr->e_shoff);
+ mPhdrBase = (Elf_Phdr *)((UINT8 *)mEhdr + mEhdr->e_phoff);
+
+ //
+ // Create COFF Section offset buffer and zero.
+ //
+ mCoffSectionsOffset = (UINT32 *)malloc(mEhdr->e_shnum * sizeof (UINT32));
+ if (mCoffSectionsOffset == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return FALSE;
+ }
+ memset(mCoffSectionsOffset, 0, mEhdr->e_shnum * sizeof(UINT32));
+
+ //
+ // Fill in function pointers.
+ //
+ ElfFunctions->ScanSections = ScanSections32;
+ ElfFunctions->WriteSections = WriteSections32;
+ ElfFunctions->WriteRelocations = WriteRelocations32;
+ ElfFunctions->WriteDebug = WriteDebug32;
+ ElfFunctions->SetImageSize = SetImageSize32;
+ ElfFunctions->CleanUp = CleanUp32;
+
+ return TRUE;
+}
+
+
+//
+// Header by Index functions
+//
+STATIC
+Elf_Shdr*
+GetShdrByIndex (
+ UINT32 Num
+ )
+{
+ if (Num >= mEhdr->e_shnum) {
+ Error (NULL, 0, 3000, "Invalid", "GetShdrByIndex: Index %u is too high.", Num);
+ exit(EXIT_FAILURE);
+ }
+
+ return (Elf_Shdr*)((UINT8*)mShdrBase + Num * mEhdr->e_shentsize);
+}
+
+STATIC
+Elf_Phdr*
+GetPhdrByIndex (
+ UINT32 num
+ )
+{
+ if (num >= mEhdr->e_phnum) {
+ Error (NULL, 0, 3000, "Invalid", "GetPhdrByIndex: Index %u is too high.", num);
+ exit(EXIT_FAILURE);
+ }
+
+ return (Elf_Phdr *)((UINT8*)mPhdrBase + num * mEhdr->e_phentsize);
+}
+
+STATIC
+UINT32
+CoffAlign (
+ UINT32 Offset
+ )
+{
+ return (Offset + mCoffAlignment - 1) & ~(mCoffAlignment - 1);
+}
+
+STATIC
+UINT32
+DebugRvaAlign (
+ UINT32 Offset
+ )
+{
+ return (Offset + 3) & ~3;
+}
+
+//
+// filter functions
+//
+STATIC
+BOOLEAN
+IsTextShdr (
+ Elf_Shdr *Shdr
+ )
+{
+ return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC);
+}
+
+STATIC
+BOOLEAN
+IsHiiRsrcShdr (
+ Elf_Shdr *Shdr
+ )
+{
+ Elf_Shdr *Namedr = GetShdrByIndex(mEhdr->e_shstrndx);
+
+ return (BOOLEAN) (strcmp((CHAR8*)mEhdr + Namedr->sh_offset + Shdr->sh_name, ELF_HII_SECTION_NAME) == 0);
+}
+
+STATIC
+BOOLEAN
+IsDataShdr (
+ Elf_Shdr *Shdr
+ )
+{
+ if (IsHiiRsrcShdr(Shdr)) {
+ return FALSE;
+ }
+ return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE);
+}
+
+STATIC
+BOOLEAN
+IsStrtabShdr (
+ Elf_Shdr *Shdr
+ )
+{
+ Elf_Shdr *Namedr = GetShdrByIndex(mEhdr->e_shstrndx);
+
+ return (BOOLEAN) (strcmp((CHAR8*)mEhdr + Namedr->sh_offset + Shdr->sh_name, ELF_STRTAB_SECTION_NAME) == 0);
+}
+
+STATIC
+Elf_Shdr *
+FindStrtabShdr (
+ VOID
+ )
+{
+ UINT32 i;
+ for (i = 0; i < mEhdr->e_shnum; i++) {
+ Elf_Shdr *shdr = GetShdrByIndex(i);
+ if (IsStrtabShdr(shdr)) {
+ return shdr;
+ }
+ }
+ return NULL;
+}
+
+STATIC
+const UINT8 *
+GetSymName (
+ Elf_Sym *Sym
+ )
+{
+ Elf_Shdr *StrtabShdr;
+ UINT8 *StrtabContents;
+ BOOLEAN foundEnd;
+ UINT32 i;
+
+ if (Sym->st_name == 0) {
+ return NULL;
+ }
+
+ StrtabShdr = FindStrtabShdr();
+ if (StrtabShdr == NULL) {
+ return NULL;
+ }
+
+ assert(Sym->st_name < StrtabShdr->sh_size);
+
+ StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
+
+ foundEnd = FALSE;
+ for (i = Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
+ foundEnd = (BOOLEAN)(StrtabContents[i] == 0);
+ }
+ assert(foundEnd);
+
+ return StrtabContents + Sym->st_name;
+}
+
+//
+// Elf functions interface implementation
+//
+
+STATIC
+VOID
+ScanSections32 (
+ VOID
+ )
+{
+ UINT32 i;
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
+ UINT32 CoffEntry;
+ UINT32 SectionCount;
+ BOOLEAN FoundSection;
+
+ CoffEntry = 0;
+ mCoffOffset = 0;
+
+ //
+ // Coff file start with a DOS header.
+ //
+ mCoffOffset = sizeof(EFI_IMAGE_DOS_HEADER) + 0x40;
+ mNtHdrOffset = mCoffOffset;
+ switch (mEhdr->e_machine) {
+ case EM_386:
+ case EM_ARM:
+ mCoffOffset += sizeof (EFI_IMAGE_NT_HEADERS32);
+ break;
+ default:
+ VerboseMsg ("%s unknown e_machine type. Assume IA-32", (UINTN)mEhdr->e_machine);
+ mCoffOffset += sizeof (EFI_IMAGE_NT_HEADERS32);
+ break;
+ }
+
+ mTableOffset = mCoffOffset;
+ mCoffOffset += mCoffNbrSections * sizeof(EFI_IMAGE_SECTION_HEADER);
+
+ //
+ // Set mCoffAlignment to the maximum alignment of the input sections
+ // we care about
+ //
+ for (i = 0; i < mEhdr->e_shnum; i++) {
+ Elf_Shdr *shdr = GetShdrByIndex(i);
+ if (shdr->sh_addralign <= mCoffAlignment) {
+ continue;
+ }
+ if (IsTextShdr(shdr) || IsDataShdr(shdr) || IsHiiRsrcShdr(shdr)) {
+ mCoffAlignment = (UINT32)shdr->sh_addralign;
+ }
+ }
+
+ //
+ // Check if mCoffAlignment is larger than MAX_COFF_ALIGNMENT
+ //
+ if (mCoffAlignment > MAX_COFF_ALIGNMENT) {
+ Error (NULL, 0, 3000, "Invalid", "Section alignment is larger than MAX_COFF_ALIGNMENT.");
+ assert (FALSE);
+ }
+
+ //
+ // Move the PE/COFF header right before the first section. This will help us
+ // save space when converting to TE.
+ //
+ if (mCoffAlignment > mCoffOffset) {
+ mNtHdrOffset += mCoffAlignment - mCoffOffset;
+ mTableOffset += mCoffAlignment - mCoffOffset;
+ mCoffOffset = mCoffAlignment;
+ }
+
+ //
+ // First text sections.
+ //
+ mCoffOffset = CoffAlign(mCoffOffset);
+ mTextOffset = mCoffOffset;
+ FoundSection = FALSE;
+ SectionCount = 0;
+ for (i = 0; i < mEhdr->e_shnum; i++) {
+ Elf_Shdr *shdr = GetShdrByIndex(i);
+ if (IsTextShdr(shdr)) {
+ if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) {
+ // the alignment field is valid
+ if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) {
+ // if the section address is aligned we must align PE/COFF
+ mCoffOffset = (mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Section address not aligned to its own alignment.");
+ }
+ }
+
+ /* Relocate entry. */
+ if ((mEhdr->e_entry >= shdr->sh_addr) &&
+ (mEhdr->e_entry < shdr->sh_addr + shdr->sh_size)) {
+ CoffEntry = mCoffOffset + mEhdr->e_entry - shdr->sh_addr;
+ }
+
+ //
+ // Set mTextOffset with the offset of the first '.text' section
+ //
+ if (!FoundSection) {
+ mTextOffset = mCoffOffset;
+ FoundSection = TRUE;
+ }
+
+ mCoffSectionsOffset[i] = mCoffOffset;
+ mCoffOffset += shdr->sh_size;
+ SectionCount ++;
+ }
+ }
+
+ if (!FoundSection) {
+ Error (NULL, 0, 3000, "Invalid", "Did not find any '.text' section.");
+ assert (FALSE);
+ }
+
+ mDebugOffset = DebugRvaAlign(mCoffOffset);
+ mCoffOffset = CoffAlign(mCoffOffset);
+
+ if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) {
+ Warning (NULL, 0, 0, NULL, "Multiple sections in %s are merged into 1 text section. Source level debug might not work correctly.", mInImageName);
+ }
+
+ //
+ // Then data sections.
+ //
+ mDataOffset = mCoffOffset;
+ FoundSection = FALSE;
+ SectionCount = 0;
+ for (i = 0; i < mEhdr->e_shnum; i++) {
+ Elf_Shdr *shdr = GetShdrByIndex(i);
+ if (IsDataShdr(shdr)) {
+ if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) {
+ // the alignment field is valid
+ if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) {
+ // if the section address is aligned we must align PE/COFF
+ mCoffOffset = (mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Section address not aligned to its own alignment.");
+ }
+ }
+
+ //
+ // Set mDataOffset with the offset of the first '.data' section
+ //
+ if (!FoundSection) {
+ mDataOffset = mCoffOffset;
+ FoundSection = TRUE;
+ }
+
+ mCoffSectionsOffset[i] = mCoffOffset;
+ mCoffOffset += shdr->sh_size;
+ SectionCount ++;
+ }
+ }
+
+ if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) {
+ Warning (NULL, 0, 0, NULL, "Multiple sections in %s are merged into 1 data section. Source level debug might not work correctly.", mInImageName);
+ }
+
+ //
+ // Make room for .debug data in .data (or .text if .data is empty) instead of
+ // putting it in a section of its own. This is explicitly allowed by the
+ // PE/COFF spec, and prevents bloat in the binary when using large values for
+ // section alignment.
+ //
+ if (SectionCount > 0) {
+ mDebugOffset = DebugRvaAlign(mCoffOffset);
+ }
+ mCoffOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) +
+ sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) +
+ strlen(mInImageName) + 1;
+
+ mCoffOffset = CoffAlign(mCoffOffset);
+ if (SectionCount == 0) {
+ mDataOffset = mCoffOffset;
+ }
+
+ //
+ // The HII resource sections.
+ //
+ mHiiRsrcOffset = mCoffOffset;
+ for (i = 0; i < mEhdr->e_shnum; i++) {
+ Elf_Shdr *shdr = GetShdrByIndex(i);
+ if (IsHiiRsrcShdr(shdr)) {
+ if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) {
+ // the alignment field is valid
+ if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) {
+ // if the section address is aligned we must align PE/COFF
+ mCoffOffset = (mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Section address not aligned to its own alignment.");
+ }
+ }
+ if (shdr->sh_size != 0) {
+ mHiiRsrcOffset = mCoffOffset;
+ mCoffSectionsOffset[i] = mCoffOffset;
+ mCoffOffset += shdr->sh_size;
+ mCoffOffset = CoffAlign(mCoffOffset);
+ SetHiiResourceHeader ((UINT8*) mEhdr + shdr->sh_offset, mHiiRsrcOffset);
+ }
+ break;
+ }
+ }
+
+ mRelocOffset = mCoffOffset;
+
+ //
+ // Allocate base Coff file. Will be expanded later for relocations.
+ //
+ mCoffFile = (UINT8 *)malloc(mCoffOffset);
+ if (mCoffFile == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ }
+ assert (mCoffFile != NULL);
+ memset(mCoffFile, 0, mCoffOffset);
+
+ //
+ // Fill headers.
+ //
+ DosHdr = (EFI_IMAGE_DOS_HEADER *)mCoffFile;
+ DosHdr->e_magic = EFI_IMAGE_DOS_SIGNATURE;
+ DosHdr->e_lfanew = mNtHdrOffset;
+
+ NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION*)(mCoffFile + mNtHdrOffset);
+
+ NtHdr->Pe32.Signature = EFI_IMAGE_NT_SIGNATURE;
+
+ switch (mEhdr->e_machine) {
+ case EM_386:
+ NtHdr->Pe32.FileHeader.Machine = EFI_IMAGE_MACHINE_IA32;
+ NtHdr->Pe32.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
+ break;
+ case EM_ARM:
+ NtHdr->Pe32.FileHeader.Machine = EFI_IMAGE_MACHINE_ARMT;
+ NtHdr->Pe32.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
+ break;
+ default:
+ VerboseMsg ("%s unknown e_machine type %hu. Assume IA-32", mInImageName, mEhdr->e_machine);
+ NtHdr->Pe32.FileHeader.Machine = EFI_IMAGE_MACHINE_IA32;
+ NtHdr->Pe32.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
+ }
+
+ NtHdr->Pe32.FileHeader.NumberOfSections = mCoffNbrSections;
+ NtHdr->Pe32.FileHeader.TimeDateStamp = (UINT32) time(NULL);
+ mImageTimeStamp = NtHdr->Pe32.FileHeader.TimeDateStamp;
+ NtHdr->Pe32.FileHeader.PointerToSymbolTable = 0;
+ NtHdr->Pe32.FileHeader.NumberOfSymbols = 0;
+ NtHdr->Pe32.FileHeader.SizeOfOptionalHeader = sizeof(NtHdr->Pe32.OptionalHeader);
+ NtHdr->Pe32.FileHeader.Characteristics = EFI_IMAGE_FILE_EXECUTABLE_IMAGE
+ | EFI_IMAGE_FILE_LINE_NUMS_STRIPPED
+ | EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED
+ | EFI_IMAGE_FILE_32BIT_MACHINE;
+
+ NtHdr->Pe32.OptionalHeader.SizeOfCode = mDataOffset - mTextOffset;
+ NtHdr->Pe32.OptionalHeader.SizeOfInitializedData = mRelocOffset - mDataOffset;
+ NtHdr->Pe32.OptionalHeader.SizeOfUninitializedData = 0;
+ NtHdr->Pe32.OptionalHeader.AddressOfEntryPoint = CoffEntry;
+
+ NtHdr->Pe32.OptionalHeader.BaseOfCode = mTextOffset;
+
+ NtHdr->Pe32.OptionalHeader.BaseOfData = mDataOffset;
+ NtHdr->Pe32.OptionalHeader.ImageBase = 0;
+ NtHdr->Pe32.OptionalHeader.SectionAlignment = mCoffAlignment;
+ NtHdr->Pe32.OptionalHeader.FileAlignment = mCoffAlignment;
+ NtHdr->Pe32.OptionalHeader.SizeOfImage = 0;
+
+ NtHdr->Pe32.OptionalHeader.SizeOfHeaders = mTextOffset;
+ NtHdr->Pe32.OptionalHeader.NumberOfRvaAndSizes = EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES;
+
+ //
+ // Section headers.
+ //
+ if ((mDataOffset - mTextOffset) > 0) {
+ CreateSectionHeader (".text", mTextOffset, mDataOffset - mTextOffset,
+ EFI_IMAGE_SCN_CNT_CODE
+ | EFI_IMAGE_SCN_MEM_EXECUTE
+ | EFI_IMAGE_SCN_MEM_READ);
+ } else {
+ // Don't make a section of size 0.
+ NtHdr->Pe32.FileHeader.NumberOfSections--;
+ }
+
+ if ((mHiiRsrcOffset - mDataOffset) > 0) {
+ CreateSectionHeader (".data", mDataOffset, mHiiRsrcOffset - mDataOffset,
+ EFI_IMAGE_SCN_CNT_INITIALIZED_DATA
+ | EFI_IMAGE_SCN_MEM_WRITE
+ | EFI_IMAGE_SCN_MEM_READ);
+ } else {
+ // Don't make a section of size 0.
+ NtHdr->Pe32.FileHeader.NumberOfSections--;
+ }
+
+ if ((mRelocOffset - mHiiRsrcOffset) > 0) {
+ CreateSectionHeader (".rsrc", mHiiRsrcOffset, mRelocOffset - mHiiRsrcOffset,
+ EFI_IMAGE_SCN_CNT_INITIALIZED_DATA
+ | EFI_IMAGE_SCN_MEM_READ);
+
+ NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = mRelocOffset - mHiiRsrcOffset;
+ NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = mHiiRsrcOffset;
+ } else {
+ // Don't make a section of size 0.
+ NtHdr->Pe32.FileHeader.NumberOfSections--;
+ }
+
+}
+
+STATIC
+BOOLEAN
+WriteSections32 (
+ SECTION_FILTER_TYPES FilterType
+ )
+{
+ UINT32 Idx;
+ Elf_Shdr *SecShdr;
+ UINT32 SecOffset;
+ BOOLEAN (*Filter)(Elf_Shdr *);
+
+ //
+ // Initialize filter pointer
+ //
+ switch (FilterType) {
+ case SECTION_TEXT:
+ Filter = IsTextShdr;
+ break;
+ case SECTION_HII:
+ Filter = IsHiiRsrcShdr;
+ break;
+ case SECTION_DATA:
+ Filter = IsDataShdr;
+ break;
+ default:
+ return FALSE;
+ }
+
+ //
+ // First: copy sections.
+ //
+ for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) {
+ Elf_Shdr *Shdr = GetShdrByIndex(Idx);
+ if ((*Filter)(Shdr)) {
+ switch (Shdr->sh_type) {
+ case SHT_PROGBITS:
+ /* Copy. */
+ if (Shdr->sh_offset + Shdr->sh_size > mFileBufferSize) {
+ return FALSE;
+ }
+ memcpy(mCoffFile + mCoffSectionsOffset[Idx],
+ (UINT8*)mEhdr + Shdr->sh_offset,
+ Shdr->sh_size);
+ break;
+
+ case SHT_NOBITS:
+ memset(mCoffFile + mCoffSectionsOffset[Idx], 0, Shdr->sh_size);
+ break;
+
+ default:
+ //
+ // Ignore for unknown section type.
+ //
+ VerboseMsg ("%s unknown section type %x. We ignore this unknown section type.", mInImageName, (unsigned)Shdr->sh_type);
+ break;
+ }
+ }
+ }
+
+ //
+ // Second: apply relocations.
+ //
+ for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) {
+ //
+ // Determine if this is a relocation section.
+ //
+ Elf_Shdr *RelShdr = GetShdrByIndex(Idx);
+ if ((RelShdr->sh_type != SHT_REL) && (RelShdr->sh_type != SHT_RELA)) {
+ continue;
+ }
+
+ //
+ // Relocation section found. Now extract section information that the relocations
+ // apply to in the ELF data and the new COFF data.
+ //
+ SecShdr = GetShdrByIndex(RelShdr->sh_info);
+ SecOffset = mCoffSectionsOffset[RelShdr->sh_info];
+
+ //
+ // Only process relocations for the current filter type.
+ //
+ if (RelShdr->sh_type == SHT_REL && (*Filter)(SecShdr)) {
+ UINT32 RelOffset;
+
+ //
+ // Determine the symbol table referenced by the relocation data.
+ //
+ Elf_Shdr *SymtabShdr = GetShdrByIndex(RelShdr->sh_link);
+ UINT8 *Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset;
+
+ //
+ // Process all relocation entries for this section.
+ //
+ for (RelOffset = 0; RelOffset < RelShdr->sh_size; RelOffset += RelShdr->sh_entsize) {
+ //
+ // Set pointer to relocation entry
+ //
+ Elf_Rel *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelOffset);
+
+ //
+ // Set pointer to symbol table entry associated with the relocation entry.
+ //
+ Elf_Sym *Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize);
+
+ Elf_Shdr *SymShdr;
+ UINT8 *Targ;
+ UINT16 Address;
+
+ //
+ // Check section header index found in symbol table and get the section
+ // header location.
+ //
+ if (Sym->st_shndx == SHN_UNDEF
+ || Sym->st_shndx >= mEhdr->e_shnum) {
+ const UINT8 *SymName = GetSymName(Sym);
+ if (SymName == NULL) {
+ SymName = (const UINT8 *)"<unknown>";
+ }
+
+ Error (NULL, 0, 3000, "Invalid",
+ "%s: Bad definition for symbol '%s'@%#x or unsupported symbol type. "
+ "For example, absolute and undefined symbols are not supported.",
+ mInImageName, SymName, Sym->st_value);
+
+ exit(EXIT_FAILURE);
+ }
+ SymShdr = GetShdrByIndex(Sym->st_shndx);
+
+ //
+ // Convert the relocation data to a pointer into the coff file.
+ //
+ // Note:
+ // r_offset is the virtual address of the storage unit to be relocated.
+ // sh_addr is the virtual address for the base of the section.
+ //
+ Targ = mCoffFile + SecOffset + (Rel->r_offset - SecShdr->sh_addr);
+
+ //
+ // Determine how to handle each relocation type based on the machine type.
+ //
+ if (mEhdr->e_machine == EM_386) {
+ switch (ELF_R_TYPE(Rel->r_info)) {
+ case R_386_NONE:
+ break;
+ case R_386_32:
+ //
+ // Absolute relocation.
+ // Converts Targ from a absolute virtual address to the absolute
+ // COFF address.
+ //
+ *(UINT32 *)Targ = *(UINT32 *)Targ - SymShdr->sh_addr
+ + mCoffSectionsOffset[Sym->st_shndx];
+ break;
+ case R_386_PC32:
+ //
+ // Relative relocation: Symbol - Ip + Addend
+ //
+ *(UINT32 *)Targ = *(UINT32 *)Targ
+ + (mCoffSectionsOffset[Sym->st_shndx] - SymShdr->sh_addr)
+ - (SecOffset - SecShdr->sh_addr);
+ break;
+ default:
+ Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_386 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
+ }
+ } else if (mEhdr->e_machine == EM_ARM) {
+ switch (ELF32_R_TYPE(Rel->r_info)) {
+ case R_ARM_RBASE:
+ // No relocation - no action required
+ // break skipped
+
+ case R_ARM_PC24:
+ case R_ARM_REL32:
+ case R_ARM_XPC25:
+ case R_ARM_THM_PC22:
+ case R_ARM_THM_JUMP19:
+ case R_ARM_CALL:
+ case R_ARM_JMP24:
+ case R_ARM_THM_JUMP24:
+ case R_ARM_PREL31:
+ case R_ARM_MOVW_PREL_NC:
+ case R_ARM_MOVT_PREL:
+ case R_ARM_THM_MOVW_PREL_NC:
+ case R_ARM_THM_MOVT_PREL:
+ case R_ARM_THM_JMP6:
+ case R_ARM_THM_ALU_PREL_11_0:
+ case R_ARM_THM_PC12:
+ case R_ARM_REL32_NOI:
+ case R_ARM_ALU_PC_G0_NC:
+ case R_ARM_ALU_PC_G0:
+ case R_ARM_ALU_PC_G1_NC:
+ case R_ARM_ALU_PC_G1:
+ case R_ARM_ALU_PC_G2:
+ case R_ARM_LDR_PC_G1:
+ case R_ARM_LDR_PC_G2:
+ case R_ARM_LDRS_PC_G0:
+ case R_ARM_LDRS_PC_G1:
+ case R_ARM_LDRS_PC_G2:
+ case R_ARM_LDC_PC_G0:
+ case R_ARM_LDC_PC_G1:
+ case R_ARM_LDC_PC_G2:
+ case R_ARM_THM_JUMP11:
+ case R_ARM_THM_JUMP8:
+ case R_ARM_TLS_GD32:
+ case R_ARM_TLS_LDM32:
+ case R_ARM_TLS_IE32:
+ // Thease are all PC-relative relocations and don't require modification
+ // GCC does not seem to have the concept of a application that just needs to get relocated.
+ break;
+
+ case R_ARM_THM_MOVW_ABS_NC:
+ // MOVW is only lower 16-bits of the addres
+ Address = (UINT16)(Sym->st_value - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
+ ThumbMovtImmediatePatch ((UINT16 *)Targ, Address);
+ break;
+
+ case R_ARM_THM_MOVT_ABS:
+ // MOVT is only upper 16-bits of the addres
+ Address = (UINT16)((Sym->st_value - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]) >> 16);
+ ThumbMovtImmediatePatch ((UINT16 *)Targ, Address);
+ break;
+
+ case R_ARM_ABS32:
+ case R_ARM_RABS32:
+ //
+ // Absolute relocation.
+ //
+ *(UINT32 *)Targ = *(UINT32 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx];
+ break;
+
+ default:
+ Error (NULL, 0, 3000, "Invalid", "WriteSections (): %s unsupported ELF EM_ARM relocation 0x%x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info));
+ }
+ }
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+UINTN gMovwOffset = 0;
+
+STATIC
+VOID
+WriteRelocations32 (
+ VOID
+ )
+{
+ UINT32 Index;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
+ EFI_IMAGE_DATA_DIRECTORY *Dir;
+ BOOLEAN FoundRelocations;
+ Elf_Dyn *Dyn;
+ Elf_Rel *Rel;
+ UINTN RelElementSize;
+ UINTN RelSize;
+ UINTN RelOffset;
+ UINTN K;
+ Elf32_Phdr *DynamicSegment;
+
+ for (Index = 0, FoundRelocations = FALSE; Index < mEhdr->e_shnum; Index++) {
+ Elf_Shdr *RelShdr = GetShdrByIndex(Index);
+ if ((RelShdr->sh_type == SHT_REL) || (RelShdr->sh_type == SHT_RELA)) {
+ Elf_Shdr *SecShdr = GetShdrByIndex (RelShdr->sh_info);
+ if (IsTextShdr(SecShdr) || IsDataShdr(SecShdr)) {
+ UINT32 RelIdx;
+
+ FoundRelocations = TRUE;
+ for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) {
+ Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);
+
+ if (mEhdr->e_machine == EM_386) {
+ switch (ELF_R_TYPE(Rel->r_info)) {
+ case R_386_NONE:
+ case R_386_PC32:
+ //
+ // No fixup entry required.
+ //
+ break;
+ case R_386_32:
+ //
+ // Creates a relative relocation entry from the absolute entry.
+ //
+ CoffAddFixup(mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr),
+ EFI_IMAGE_REL_BASED_HIGHLOW);
+ break;
+ default:
+ Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_386 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
+ }
+ } else if (mEhdr->e_machine == EM_ARM) {
+ switch (ELF32_R_TYPE(Rel->r_info)) {
+ case R_ARM_RBASE:
+ // No relocation - no action required
+ // break skipped
+
+ case R_ARM_PC24:
+ case R_ARM_REL32:
+ case R_ARM_XPC25:
+ case R_ARM_THM_PC22:
+ case R_ARM_THM_JUMP19:
+ case R_ARM_CALL:
+ case R_ARM_JMP24:
+ case R_ARM_THM_JUMP24:
+ case R_ARM_PREL31:
+ case R_ARM_MOVW_PREL_NC:
+ case R_ARM_MOVT_PREL:
+ case R_ARM_THM_MOVW_PREL_NC:
+ case R_ARM_THM_MOVT_PREL:
+ case R_ARM_THM_JMP6:
+ case R_ARM_THM_ALU_PREL_11_0:
+ case R_ARM_THM_PC12:
+ case R_ARM_REL32_NOI:
+ case R_ARM_ALU_PC_G0_NC:
+ case R_ARM_ALU_PC_G0:
+ case R_ARM_ALU_PC_G1_NC:
+ case R_ARM_ALU_PC_G1:
+ case R_ARM_ALU_PC_G2:
+ case R_ARM_LDR_PC_G1:
+ case R_ARM_LDR_PC_G2:
+ case R_ARM_LDRS_PC_G0:
+ case R_ARM_LDRS_PC_G1:
+ case R_ARM_LDRS_PC_G2:
+ case R_ARM_LDC_PC_G0:
+ case R_ARM_LDC_PC_G1:
+ case R_ARM_LDC_PC_G2:
+ case R_ARM_THM_JUMP11:
+ case R_ARM_THM_JUMP8:
+ case R_ARM_TLS_GD32:
+ case R_ARM_TLS_LDM32:
+ case R_ARM_TLS_IE32:
+ // Thease are all PC-relative relocations and don't require modification
+ break;
+
+ case R_ARM_THM_MOVW_ABS_NC:
+ CoffAddFixup (
+ mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr),
+ EFI_IMAGE_REL_BASED_ARM_MOV32T
+ );
+
+ // PE/COFF treats MOVW/MOVT relocation as single 64-bit instruction
+ // Track this address so we can log an error for unsupported sequence of MOVW/MOVT
+ gMovwOffset = mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr);
+ break;
+
+ case R_ARM_THM_MOVT_ABS:
+ if ((gMovwOffset + 4) != (mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr))) {
+ Error (NULL, 0, 3000, "Not Supported", "PE/COFF requires MOVW+MOVT instruction sequence %x +4 != %x.", gMovwOffset, mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr));
+ }
+ break;
+
+ case R_ARM_ABS32:
+ case R_ARM_RABS32:
+ CoffAddFixup (
+ mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr),
+ EFI_IMAGE_REL_BASED_HIGHLOW
+ );
+ break;
+
+ default:
+ Error (NULL, 0, 3000, "Invalid", "WriteRelocations(): %s unsupported ELF EM_ARM relocation 0x%x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info));
+ }
+ } else {
+ Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %u (processor type).", (unsigned) mEhdr->e_machine);
+ }
+ }
+ }
+ }
+ }
+
+ if (!FoundRelocations && (mEhdr->e_machine == EM_ARM)) {
+ /* Try again, but look for PT_DYNAMIC instead of SHT_REL */
+
+ for (Index = 0; Index < mEhdr->e_phnum; Index++) {
+ RelElementSize = 0;
+ RelSize = 0;
+ RelOffset = 0;
+
+ DynamicSegment = GetPhdrByIndex (Index);
+
+ if (DynamicSegment->p_type == PT_DYNAMIC) {
+ Dyn = (Elf32_Dyn *) ((UINT8 *)mEhdr + DynamicSegment->p_offset);
+
+ while (Dyn->d_tag != DT_NULL) {
+ switch (Dyn->d_tag) {
+ case DT_REL:
+ RelOffset = Dyn->d_un.d_val;
+ break;
+
+ case DT_RELSZ:
+ RelSize = Dyn->d_un.d_val;
+ break;
+
+ case DT_RELENT:
+ RelElementSize = Dyn->d_un.d_val;
+ break;
+
+ default:
+ break;
+ }
+ Dyn++;
+ }
+ if (( RelOffset == 0 ) || ( RelSize == 0 ) || ( RelElementSize == 0 )) {
+ Error (NULL, 0, 3000, "Invalid", "%s bad ARM dynamic relocations.", mInImageName);
+ }
+
+ for (Index = 0; Index < mEhdr->e_shnum; Index++) {
+ Elf_Shdr *shdr = GetShdrByIndex(Index);
+
+ //
+ // The PT_DYNAMIC section contains DT_REL relocations whose r_offset
+ // field is relative to the base of a segment (or the entire image),
+ // and not to the base of an ELF input section as is the case for
+ // SHT_REL sections. This means that we cannot fix up such relocations
+ // unless we cross-reference ELF sections and segments, considering
+ // that the output placement recorded in mCoffSectionsOffset[] is
+ // section based, not segment based.
+ //
+ // Fortunately, there is a simple way around this: we require that the
+ // in-memory layout of the ELF and PE/COFF versions of the binary is
+ // identical. That way, r_offset will retain its validity as a PE/COFF
+ // image offset, and we can record it in the COFF fixup table
+ // unmodified.
+ //
+ if (shdr->sh_addr != mCoffSectionsOffset[Index]) {
+ Error (NULL, 0, 3000,
+ "Invalid", "%s: PT_DYNAMIC relocations require identical ELF and PE/COFF section offsets.",
+ mInImageName);
+ }
+ }
+
+ for (K = 0; K < RelSize; K += RelElementSize) {
+
+ if (DynamicSegment->p_paddr == 0) {
+ // Older versions of the ARM ELF (SWS ESPC 0003 B-02) specification define DT_REL
+ // as an offset in the dynamic segment. p_paddr is defined to be zero for ARM tools
+ Rel = (Elf32_Rel *) ((UINT8 *) mEhdr + DynamicSegment->p_offset + RelOffset + K);
+ } else {
+ // This is how it reads in the generic ELF specification
+ Rel = (Elf32_Rel *) ((UINT8 *) mEhdr + RelOffset + K);
+ }
+
+ switch (ELF32_R_TYPE (Rel->r_info)) {
+ case R_ARM_RBASE:
+ break;
+
+ case R_ARM_RABS32:
+ CoffAddFixup (Rel->r_offset, EFI_IMAGE_REL_BASED_HIGHLOW);
+ break;
+
+ default:
+ Error (NULL, 0, 3000, "Invalid", "%s bad ARM dynamic relocations, unknown type %d.", mInImageName, ELF32_R_TYPE (Rel->r_info));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ //
+ // Pad by adding empty entries.
+ //
+ while (mCoffOffset & (mCoffAlignment - 1)) {
+ CoffAddFixupEntry(0);
+ }
+
+ NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset);
+ Dir = &NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+ Dir->Size = mCoffOffset - mRelocOffset;
+ if (Dir->Size == 0) {
+ // If no relocations, null out the directory entry and don't add the .reloc section
+ Dir->VirtualAddress = 0;
+ NtHdr->Pe32.FileHeader.NumberOfSections--;
+ } else {
+ Dir->VirtualAddress = mRelocOffset;
+ CreateSectionHeader (".reloc", mRelocOffset, mCoffOffset - mRelocOffset,
+ EFI_IMAGE_SCN_CNT_INITIALIZED_DATA
+ | EFI_IMAGE_SCN_MEM_DISCARDABLE
+ | EFI_IMAGE_SCN_MEM_READ);
+ }
+
+}
+
+STATIC
+VOID
+WriteDebug32 (
+ VOID
+ )
+{
+ UINT32 Len;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
+ EFI_IMAGE_DATA_DIRECTORY *DataDir;
+ EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *Dir;
+ EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY *Nb10;
+
+ Len = strlen(mInImageName) + 1;
+
+ Dir = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY*)(mCoffFile + mDebugOffset);
+ Dir->Type = EFI_IMAGE_DEBUG_TYPE_CODEVIEW;
+ Dir->SizeOfData = sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) + Len;
+ Dir->RVA = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+ Dir->FileOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+
+ Nb10 = (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY*)(Dir + 1);
+ Nb10->Signature = CODEVIEW_SIGNATURE_NB10;
+ strcpy ((char *)(Nb10 + 1), mInImageName);
+
+
+ NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset);
+ DataDir = &NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG];
+ DataDir->VirtualAddress = mDebugOffset;
+ DataDir->Size = sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+}
+
+STATIC
+VOID
+SetImageSize32 (
+ VOID
+ )
+{
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
+
+ //
+ // Set image size
+ //
+ NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset);
+ NtHdr->Pe32.OptionalHeader.SizeOfImage = mCoffOffset;
+}
+
+STATIC
+VOID
+CleanUp32 (
+ VOID
+ )
+{
+ if (mCoffSectionsOffset != NULL) {
+ free (mCoffSectionsOffset);
+ }
+}
+
+
diff --git a/roms/edk2/BaseTools/Source/C/GenFw/Elf32Convert.h b/roms/edk2/BaseTools/Source/C/GenFw/Elf32Convert.h
new file mode 100644
index 000000000..906a4de3c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFw/Elf32Convert.h
@@ -0,0 +1,19 @@
+/** @file
+Header file for Elf32 Convert solution
+
+Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _ELF_32_CONVERT_
+#define _ELF_32_CONVERT_
+
+BOOLEAN
+InitializeElf32 (
+ UINT8 *FileBuffer,
+ ELF_FUNCTION_TABLE *ElfFunctions
+ );
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/GenFw/Elf64Convert.c b/roms/edk2/BaseTools/Source/C/GenFw/Elf64Convert.c
new file mode 100644
index 000000000..4ed6b4477
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -0,0 +1,1657 @@
+/** @file
+Elf64 convert solution
+
+Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+Portions copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
+Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "WinNtInclude.h"
+
+#ifndef __GNUC__
+#include <windows.h>
+#include <io.h>
+#endif
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <ctype.h>
+
+#include <Common/UefiBaseTypes.h>
+#include <IndustryStandard/PeImage.h>
+
+#include "PeCoffLib.h"
+#include "EfiUtilityMsgs.h"
+
+#include "GenFw.h"
+#include "ElfConvert.h"
+#include "Elf64Convert.h"
+
+STATIC
+VOID
+ScanSections64 (
+ VOID
+ );
+
+STATIC
+BOOLEAN
+WriteSections64 (
+ SECTION_FILTER_TYPES FilterType
+ );
+
+STATIC
+VOID
+WriteRelocations64 (
+ VOID
+ );
+
+STATIC
+VOID
+WriteDebug64 (
+ VOID
+ );
+
+STATIC
+VOID
+SetImageSize64 (
+ VOID
+ );
+
+STATIC
+VOID
+CleanUp64 (
+ VOID
+ );
+
+//
+// Rename ELF32 structures to common names to help when porting to ELF64.
+//
+typedef Elf64_Shdr Elf_Shdr;
+typedef Elf64_Ehdr Elf_Ehdr;
+typedef Elf64_Rel Elf_Rel;
+typedef Elf64_Rela Elf_Rela;
+typedef Elf64_Sym Elf_Sym;
+typedef Elf64_Phdr Elf_Phdr;
+typedef Elf64_Dyn Elf_Dyn;
+#define ELFCLASS ELFCLASS64
+#define ELF_R_TYPE(r) ELF64_R_TYPE(r)
+#define ELF_R_SYM(r) ELF64_R_SYM(r)
+
+//
+// Well known ELF structures.
+//
+STATIC Elf_Ehdr *mEhdr;
+STATIC Elf_Shdr *mShdrBase;
+STATIC Elf_Phdr *mPhdrBase;
+
+//
+// GOT information
+//
+STATIC Elf_Shdr *mGOTShdr = NULL;
+STATIC UINT32 mGOTShindex = 0;
+STATIC UINT32 *mGOTCoffEntries = NULL;
+STATIC UINT32 mGOTMaxCoffEntries = 0;
+STATIC UINT32 mGOTNumCoffEntries = 0;
+
+//
+// Coff information
+//
+STATIC UINT32 mCoffAlignment = 0x20;
+
+//
+// PE section alignment.
+//
+STATIC const UINT16 mCoffNbrSections = 4;
+
+//
+// ELF sections to offset in Coff file.
+//
+STATIC UINT32 *mCoffSectionsOffset = NULL;
+
+//
+// Offsets in COFF file
+//
+STATIC UINT32 mNtHdrOffset;
+STATIC UINT32 mTextOffset;
+STATIC UINT32 mDataOffset;
+STATIC UINT32 mHiiRsrcOffset;
+STATIC UINT32 mRelocOffset;
+STATIC UINT32 mDebugOffset;
+
+//
+// Used for RISC-V relocations.
+//
+STATIC UINT8 *mRiscVPass1Targ = NULL;
+STATIC Elf_Shdr *mRiscVPass1Sym = NULL;
+STATIC Elf64_Half mRiscVPass1SymSecIndex = 0;
+
+//
+// Initialization Function
+//
+BOOLEAN
+InitializeElf64 (
+ UINT8 *FileBuffer,
+ ELF_FUNCTION_TABLE *ElfFunctions
+ )
+{
+ //
+ // Initialize data pointer and structures.
+ //
+ VerboseMsg ("Set EHDR");
+ mEhdr = (Elf_Ehdr*) FileBuffer;
+
+ //
+ // Check the ELF64 specific header information.
+ //
+ VerboseMsg ("Check ELF64 Header Information");
+ if (mEhdr->e_ident[EI_CLASS] != ELFCLASS64) {
+ Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFCLASS64");
+ return FALSE;
+ }
+ if (mEhdr->e_ident[EI_DATA] != ELFDATA2LSB) {
+ Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFDATA2LSB");
+ return FALSE;
+ }
+ if ((mEhdr->e_type != ET_EXEC) && (mEhdr->e_type != ET_DYN)) {
+ Error (NULL, 0, 3000, "Unsupported", "ELF e_type not ET_EXEC or ET_DYN");
+ return FALSE;
+ }
+ if (!((mEhdr->e_machine == EM_X86_64) || (mEhdr->e_machine == EM_AARCH64) || (mEhdr->e_machine == EM_RISCV64))) {
+ Error (NULL, 0, 3000, "Unsupported", "ELF e_machine is not Elf64 machine.");
+ return FALSE;
+ }
+ if (mEhdr->e_version != EV_CURRENT) {
+ Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) mEhdr->e_version, EV_CURRENT);
+ return FALSE;
+ }
+
+ //
+ // Update section header pointers
+ //
+ VerboseMsg ("Update Header Pointers");
+ mShdrBase = (Elf_Shdr *)((UINT8 *)mEhdr + mEhdr->e_shoff);
+ mPhdrBase = (Elf_Phdr *)((UINT8 *)mEhdr + mEhdr->e_phoff);
+
+ //
+ // Create COFF Section offset buffer and zero.
+ //
+ VerboseMsg ("Create COFF Section Offset Buffer");
+ mCoffSectionsOffset = (UINT32 *)malloc(mEhdr->e_shnum * sizeof (UINT32));
+ if (mCoffSectionsOffset == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return FALSE;
+ }
+ memset(mCoffSectionsOffset, 0, mEhdr->e_shnum * sizeof(UINT32));
+
+ //
+ // Fill in function pointers.
+ //
+ VerboseMsg ("Fill in Function Pointers");
+ ElfFunctions->ScanSections = ScanSections64;
+ ElfFunctions->WriteSections = WriteSections64;
+ ElfFunctions->WriteRelocations = WriteRelocations64;
+ ElfFunctions->WriteDebug = WriteDebug64;
+ ElfFunctions->SetImageSize = SetImageSize64;
+ ElfFunctions->CleanUp = CleanUp64;
+
+ return TRUE;
+}
+
+
+//
+// Header by Index functions
+//
+STATIC
+Elf_Shdr*
+GetShdrByIndex (
+ UINT32 Num
+ )
+{
+ if (Num >= mEhdr->e_shnum) {
+ Error (NULL, 0, 3000, "Invalid", "GetShdrByIndex: Index %u is too high.", Num);
+ exit(EXIT_FAILURE);
+ }
+
+ return (Elf_Shdr*)((UINT8*)mShdrBase + Num * mEhdr->e_shentsize);
+}
+
+STATIC
+UINT32
+CoffAlign (
+ UINT32 Offset
+ )
+{
+ return (Offset + mCoffAlignment - 1) & ~(mCoffAlignment - 1);
+}
+
+STATIC
+UINT32
+DebugRvaAlign (
+ UINT32 Offset
+ )
+{
+ return (Offset + 3) & ~3;
+}
+
+//
+// filter functions
+//
+STATIC
+BOOLEAN
+IsTextShdr (
+ Elf_Shdr *Shdr
+ )
+{
+ return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC);
+}
+
+STATIC
+BOOLEAN
+IsHiiRsrcShdr (
+ Elf_Shdr *Shdr
+ )
+{
+ Elf_Shdr *Namedr = GetShdrByIndex(mEhdr->e_shstrndx);
+
+ return (BOOLEAN) (strcmp((CHAR8*)mEhdr + Namedr->sh_offset + Shdr->sh_name, ELF_HII_SECTION_NAME) == 0);
+}
+
+STATIC
+BOOLEAN
+IsDataShdr (
+ Elf_Shdr *Shdr
+ )
+{
+ if (IsHiiRsrcShdr(Shdr)) {
+ return FALSE;
+ }
+ return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE);
+}
+
+STATIC
+BOOLEAN
+IsStrtabShdr (
+ Elf_Shdr *Shdr
+ )
+{
+ Elf_Shdr *Namedr = GetShdrByIndex(mEhdr->e_shstrndx);
+
+ return (BOOLEAN) (strcmp((CHAR8*)mEhdr + Namedr->sh_offset + Shdr->sh_name, ELF_STRTAB_SECTION_NAME) == 0);
+}
+
+STATIC
+Elf_Shdr *
+FindStrtabShdr (
+ VOID
+ )
+{
+ UINT32 i;
+ for (i = 0; i < mEhdr->e_shnum; i++) {
+ Elf_Shdr *shdr = GetShdrByIndex(i);
+ if (IsStrtabShdr(shdr)) {
+ return shdr;
+ }
+ }
+ return NULL;
+}
+
+STATIC
+const UINT8 *
+GetSymName (
+ Elf_Sym *Sym
+ )
+{
+ Elf_Shdr *StrtabShdr;
+ UINT8 *StrtabContents;
+ BOOLEAN foundEnd;
+ UINT32 i;
+
+ if (Sym->st_name == 0) {
+ return NULL;
+ }
+
+ StrtabShdr = FindStrtabShdr();
+ if (StrtabShdr == NULL) {
+ return NULL;
+ }
+
+ assert(Sym->st_name < StrtabShdr->sh_size);
+
+ StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
+
+ foundEnd = FALSE;
+ for (i= Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
+ foundEnd = (BOOLEAN)(StrtabContents[i] == 0);
+ }
+ assert(foundEnd);
+
+ return StrtabContents + Sym->st_name;
+}
+
+//
+// Find the ELF section hosting the GOT from an ELF Rva
+// of a single GOT entry. Normally, GOT is placed in
+// ELF .text section, so assume once we find in which
+// section the GOT is, all GOT entries are there, and
+// just verify this.
+//
+STATIC
+VOID
+FindElfGOTSectionFromGOTEntryElfRva (
+ Elf64_Addr GOTEntryElfRva
+ )
+{
+ UINT32 i;
+ if (mGOTShdr != NULL) {
+ if (GOTEntryElfRva >= mGOTShdr->sh_addr &&
+ GOTEntryElfRva < mGOTShdr->sh_addr + mGOTShdr->sh_size) {
+ return;
+ }
+ Error (NULL, 0, 3000, "Unsupported", "FindElfGOTSectionFromGOTEntryElfRva: GOT entries found in multiple sections.");
+ exit(EXIT_FAILURE);
+ }
+ for (i = 0; i < mEhdr->e_shnum; i++) {
+ Elf_Shdr *shdr = GetShdrByIndex(i);
+ if (GOTEntryElfRva >= shdr->sh_addr &&
+ GOTEntryElfRva < shdr->sh_addr + shdr->sh_size) {
+ mGOTShdr = shdr;
+ mGOTShindex = i;
+ return;
+ }
+ }
+ Error (NULL, 0, 3000, "Invalid", "FindElfGOTSectionFromGOTEntryElfRva: ElfRva 0x%016LX for GOT entry not found in any section.", GOTEntryElfRva);
+ exit(EXIT_FAILURE);
+}
+
+//
+// Stores locations of GOT entries in COFF image.
+// Returns TRUE if GOT entry is new.
+// Simple implementation as number of GOT
+// entries is expected to be low.
+//
+
+STATIC
+BOOLEAN
+AccumulateCoffGOTEntries (
+ UINT32 GOTCoffEntry
+ )
+{
+ UINT32 i;
+ if (mGOTCoffEntries != NULL) {
+ for (i = 0; i < mGOTNumCoffEntries; i++) {
+ if (mGOTCoffEntries[i] == GOTCoffEntry) {
+ return FALSE;
+ }
+ }
+ }
+ if (mGOTCoffEntries == NULL) {
+ mGOTCoffEntries = (UINT32*)malloc(5 * sizeof *mGOTCoffEntries);
+ if (mGOTCoffEntries == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ }
+ assert (mGOTCoffEntries != NULL);
+ mGOTMaxCoffEntries = 5;
+ mGOTNumCoffEntries = 0;
+ } else if (mGOTNumCoffEntries == mGOTMaxCoffEntries) {
+ mGOTCoffEntries = (UINT32*)realloc(mGOTCoffEntries, 2 * mGOTMaxCoffEntries * sizeof *mGOTCoffEntries);
+ if (mGOTCoffEntries == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ }
+ assert (mGOTCoffEntries != NULL);
+ mGOTMaxCoffEntries += mGOTMaxCoffEntries;
+ }
+ mGOTCoffEntries[mGOTNumCoffEntries++] = GOTCoffEntry;
+ return TRUE;
+}
+
+//
+// 32-bit Unsigned integer comparator for qsort.
+//
+STATIC
+int
+UINT32Comparator (
+ const void* lhs,
+ const void* rhs
+ )
+{
+ if (*(const UINT32*)lhs < *(const UINT32*)rhs) {
+ return -1;
+ }
+ return *(const UINT32*)lhs > *(const UINT32*)rhs;
+}
+
+//
+// Emit accumulated Coff GOT entry relocations into
+// Coff image. This function performs its job
+// once and then releases the entry list, so
+// it can safely be called multiple times.
+//
+STATIC
+VOID
+EmitGOTRelocations (
+ VOID
+ )
+{
+ UINT32 i;
+ if (mGOTCoffEntries == NULL) {
+ return;
+ }
+ //
+ // Emit Coff relocations with Rvas ordered.
+ //
+ qsort(
+ mGOTCoffEntries,
+ mGOTNumCoffEntries,
+ sizeof *mGOTCoffEntries,
+ UINT32Comparator);
+ for (i = 0; i < mGOTNumCoffEntries; i++) {
+ VerboseMsg ("EFI_IMAGE_REL_BASED_DIR64 Offset: 0x%08X", mGOTCoffEntries[i]);
+ CoffAddFixup(
+ mGOTCoffEntries[i],
+ EFI_IMAGE_REL_BASED_DIR64);
+ }
+ free(mGOTCoffEntries);
+ mGOTCoffEntries = NULL;
+ mGOTMaxCoffEntries = 0;
+ mGOTNumCoffEntries = 0;
+}
+//
+// RISC-V 64 specific Elf WriteSection function.
+//
+STATIC
+VOID
+WriteSectionRiscV64 (
+ Elf_Rela *Rel,
+ UINT8 *Targ,
+ Elf_Shdr *SymShdr,
+ Elf_Sym *Sym
+ )
+{
+ UINT32 Value;
+ UINT32 Value2;
+
+ switch (ELF_R_TYPE(Rel->r_info)) {
+ case R_RISCV_NONE:
+ break;
+
+ case R_RISCV_32:
+ *(UINT32 *)Targ = (UINT32)((UINT64)(*(UINT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
+ break;
+
+ case R_RISCV_64:
+ *(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx];
+ break;
+
+ case R_RISCV_HI20:
+ mRiscVPass1Targ = Targ;
+ mRiscVPass1Sym = SymShdr;
+ mRiscVPass1SymSecIndex = Sym->st_shndx;
+ break;
+
+ case R_RISCV_LO12_I:
+ if (mRiscVPass1Sym == SymShdr && mRiscVPass1Targ != NULL && mRiscVPass1SymSecIndex == Sym->st_shndx && mRiscVPass1SymSecIndex != 0) {
+ Value = (UINT32)(RV_X(*(UINT32 *)mRiscVPass1Targ, 12, 20) << 12);
+ Value2 = (UINT32)(RV_X(*(UINT32 *)Targ, 20, 12));
+ if (Value2 & (RISCV_IMM_REACH/2)) {
+ Value2 |= ~(RISCV_IMM_REACH-1);
+ }
+ Value += Value2;
+ Value = Value - (UINT32)SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx];
+ Value2 = RISCV_CONST_HIGH_PART (Value);
+ *(UINT32 *)mRiscVPass1Targ = (RV_X (Value2, 12, 20) << 12) | \
+ (RV_X (*(UINT32 *)mRiscVPass1Targ, 0, 12));
+ *(UINT32 *)Targ = (RV_X (Value, 0, 12) << 20) | \
+ (RV_X (*(UINT32 *)Targ, 0, 20));
+ }
+ mRiscVPass1Sym = NULL;
+ mRiscVPass1Targ = NULL;
+ mRiscVPass1SymSecIndex = 0;
+ break;
+
+ case R_RISCV_LO12_S:
+ if (mRiscVPass1Sym == SymShdr && mRiscVPass1Targ != NULL && mRiscVPass1SymSecIndex == Sym->st_shndx && mRiscVPass1SymSecIndex != 0) {
+ Value = (UINT32)(RV_X(*(UINT32 *)mRiscVPass1Targ, 12, 20) << 12);
+ Value2 = (UINT32)(RV_X(*(UINT32 *)Targ, 7, 5) | (RV_X(*(UINT32 *)Targ, 25, 7) << 5));
+ if (Value2 & (RISCV_IMM_REACH/2)) {
+ Value2 |= ~(RISCV_IMM_REACH-1);
+ }
+ Value += Value2;
+ Value = Value - (UINT32)SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx];
+ Value2 = RISCV_CONST_HIGH_PART (Value);
+ *(UINT32 *)mRiscVPass1Targ = (RV_X (Value2, 12, 20) << 12) | \
+ (RV_X (*(UINT32 *)mRiscVPass1Targ, 0, 12));
+ Value2 = *(UINT32 *)Targ & 0x01fff07f;
+ Value &= RISCV_IMM_REACH - 1;
+ *(UINT32 *)Targ = Value2 | (UINT32)(((RV_X(Value, 0, 5) << 7) | (RV_X(Value, 5, 7) << 25)));
+ }
+ mRiscVPass1Sym = NULL;
+ mRiscVPass1Targ = NULL;
+ mRiscVPass1SymSecIndex = 0;
+ break;
+
+ case R_RISCV_PCREL_HI20:
+ mRiscVPass1Targ = Targ;
+ mRiscVPass1Sym = SymShdr;
+ mRiscVPass1SymSecIndex = Sym->st_shndx;
+
+ Value = (UINT32)(RV_X(*(UINT32 *)mRiscVPass1Targ, 12, 20));
+ break;
+
+ case R_RISCV_PCREL_LO12_I:
+ if (mRiscVPass1Targ != NULL && mRiscVPass1Sym != NULL && mRiscVPass1SymSecIndex != 0) {
+ int i;
+ Value2 = (UINT32)(RV_X(*(UINT32 *)mRiscVPass1Targ, 12, 20));
+ Value = (UINT32)(RV_X(*(UINT32 *)Targ, 20, 12));
+ if(Value & (RISCV_IMM_REACH/2)) {
+ Value |= ~(RISCV_IMM_REACH-1);
+ }
+ Value = Value - (UINT32)mRiscVPass1Sym->sh_addr + mCoffSectionsOffset[mRiscVPass1SymSecIndex];
+ if(-2048 > (INT32)Value) {
+ i = (((INT32)Value * -1) / 4096);
+ Value2 -= i;
+ Value += 4096 * i;
+ if(-2048 > (INT32)Value) {
+ Value2 -= 1;
+ Value += 4096;
+ }
+ }
+ else if( 2047 < (INT32)Value) {
+ i = (Value / 4096);
+ Value2 += i;
+ Value -= 4096 * i;
+ if(2047 < (INT32)Value) {
+ Value2 += 1;
+ Value -= 4096;
+ }
+ }
+
+ *(UINT32 *)Targ = (RV_X(Value, 0, 12) << 20) | (RV_X(*(UINT32*)Targ, 0, 20));
+ *(UINT32 *)mRiscVPass1Targ = (RV_X(Value2, 0, 20)<<12) | (RV_X(*(UINT32 *)mRiscVPass1Targ, 0, 12));
+ }
+ mRiscVPass1Sym = NULL;
+ mRiscVPass1Targ = NULL;
+ mRiscVPass1SymSecIndex = 0;
+ break;
+
+ case R_RISCV_ADD64:
+ case R_RISCV_SUB64:
+ case R_RISCV_ADD32:
+ case R_RISCV_SUB32:
+ case R_RISCV_BRANCH:
+ case R_RISCV_JAL:
+ case R_RISCV_GPREL_I:
+ case R_RISCV_GPREL_S:
+ case R_RISCV_CALL:
+ case R_RISCV_RVC_BRANCH:
+ case R_RISCV_RVC_JUMP:
+ case R_RISCV_RELAX:
+ case R_RISCV_SUB6:
+ case R_RISCV_SET6:
+ case R_RISCV_SET8:
+ case R_RISCV_SET16:
+ case R_RISCV_SET32:
+ break;
+
+ default:
+ Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s unsupported ELF EM_RISCV64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
+ }
+}
+
+//
+// Elf functions interface implementation
+//
+
+STATIC
+VOID
+ScanSections64 (
+ VOID
+ )
+{
+ UINT32 i;
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
+ UINT32 CoffEntry;
+ UINT32 SectionCount;
+ BOOLEAN FoundSection;
+
+ CoffEntry = 0;
+ mCoffOffset = 0;
+
+ //
+ // Coff file start with a DOS header.
+ //
+ mCoffOffset = sizeof(EFI_IMAGE_DOS_HEADER) + 0x40;
+ mNtHdrOffset = mCoffOffset;
+ switch (mEhdr->e_machine) {
+ case EM_X86_64:
+ case EM_AARCH64:
+ case EM_RISCV64:
+ mCoffOffset += sizeof (EFI_IMAGE_NT_HEADERS64);
+ break;
+ default:
+ VerboseMsg ("%s unknown e_machine type %hu. Assume X64", mInImageName, mEhdr->e_machine);
+ mCoffOffset += sizeof (EFI_IMAGE_NT_HEADERS64);
+ break;
+ }
+
+ mTableOffset = mCoffOffset;
+ mCoffOffset += mCoffNbrSections * sizeof(EFI_IMAGE_SECTION_HEADER);
+
+ //
+ // Set mCoffAlignment to the maximum alignment of the input sections
+ // we care about
+ //
+ for (i = 0; i < mEhdr->e_shnum; i++) {
+ Elf_Shdr *shdr = GetShdrByIndex(i);
+ if (shdr->sh_addralign <= mCoffAlignment) {
+ continue;
+ }
+ if (IsTextShdr(shdr) || IsDataShdr(shdr) || IsHiiRsrcShdr(shdr)) {
+ mCoffAlignment = (UINT32)shdr->sh_addralign;
+ }
+ }
+
+ //
+ // Check if mCoffAlignment is larger than MAX_COFF_ALIGNMENT
+ //
+ if (mCoffAlignment > MAX_COFF_ALIGNMENT) {
+ Error (NULL, 0, 3000, "Invalid", "Section alignment is larger than MAX_COFF_ALIGNMENT.");
+ assert (FALSE);
+ }
+
+
+ //
+ // Move the PE/COFF header right before the first section. This will help us
+ // save space when converting to TE.
+ //
+ if (mCoffAlignment > mCoffOffset) {
+ mNtHdrOffset += mCoffAlignment - mCoffOffset;
+ mTableOffset += mCoffAlignment - mCoffOffset;
+ mCoffOffset = mCoffAlignment;
+ }
+
+ //
+ // First text sections.
+ //
+ mCoffOffset = CoffAlign(mCoffOffset);
+ mTextOffset = mCoffOffset;
+ FoundSection = FALSE;
+ SectionCount = 0;
+ for (i = 0; i < mEhdr->e_shnum; i++) {
+ Elf_Shdr *shdr = GetShdrByIndex(i);
+ if (IsTextShdr(shdr)) {
+ if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) {
+ // the alignment field is valid
+ if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) {
+ // if the section address is aligned we must align PE/COFF
+ mCoffOffset = (UINT32) ((mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1));
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Section address not aligned to its own alignment.");
+ }
+ }
+
+ /* Relocate entry. */
+ if ((mEhdr->e_entry >= shdr->sh_addr) &&
+ (mEhdr->e_entry < shdr->sh_addr + shdr->sh_size)) {
+ CoffEntry = (UINT32) (mCoffOffset + mEhdr->e_entry - shdr->sh_addr);
+ }
+
+ //
+ // Set mTextOffset with the offset of the first '.text' section
+ //
+ if (!FoundSection) {
+ mTextOffset = mCoffOffset;
+ FoundSection = TRUE;
+ }
+
+ mCoffSectionsOffset[i] = mCoffOffset;
+ mCoffOffset += (UINT32) shdr->sh_size;
+ SectionCount ++;
+ }
+ }
+
+ if (!FoundSection) {
+ Error (NULL, 0, 3000, "Invalid", "Did not find any '.text' section.");
+ assert (FALSE);
+ }
+
+ mDebugOffset = DebugRvaAlign(mCoffOffset);
+ mCoffOffset = CoffAlign(mCoffOffset);
+
+ if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) {
+ Warning (NULL, 0, 0, NULL, "Multiple sections in %s are merged into 1 text section. Source level debug might not work correctly.", mInImageName);
+ }
+
+ //
+ // Then data sections.
+ //
+ mDataOffset = mCoffOffset;
+ FoundSection = FALSE;
+ SectionCount = 0;
+ for (i = 0; i < mEhdr->e_shnum; i++) {
+ Elf_Shdr *shdr = GetShdrByIndex(i);
+ if (IsDataShdr(shdr)) {
+ if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) {
+ // the alignment field is valid
+ if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) {
+ // if the section address is aligned we must align PE/COFF
+ mCoffOffset = (UINT32) ((mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1));
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Section address not aligned to its own alignment.");
+ }
+ }
+
+ //
+ // Set mDataOffset with the offset of the first '.data' section
+ //
+ if (!FoundSection) {
+ mDataOffset = mCoffOffset;
+ FoundSection = TRUE;
+ }
+ mCoffSectionsOffset[i] = mCoffOffset;
+ mCoffOffset += (UINT32) shdr->sh_size;
+ SectionCount ++;
+ }
+ }
+
+ //
+ // Make room for .debug data in .data (or .text if .data is empty) instead of
+ // putting it in a section of its own. This is explicitly allowed by the
+ // PE/COFF spec, and prevents bloat in the binary when using large values for
+ // section alignment.
+ //
+ if (SectionCount > 0) {
+ mDebugOffset = DebugRvaAlign(mCoffOffset);
+ }
+ mCoffOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) +
+ sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) +
+ strlen(mInImageName) + 1;
+
+ mCoffOffset = CoffAlign(mCoffOffset);
+ if (SectionCount == 0) {
+ mDataOffset = mCoffOffset;
+ }
+
+ if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) {
+ Warning (NULL, 0, 0, NULL, "Multiple sections in %s are merged into 1 data section. Source level debug might not work correctly.", mInImageName);
+ }
+
+ //
+ // The HII resource sections.
+ //
+ mHiiRsrcOffset = mCoffOffset;
+ for (i = 0; i < mEhdr->e_shnum; i++) {
+ Elf_Shdr *shdr = GetShdrByIndex(i);
+ if (IsHiiRsrcShdr(shdr)) {
+ if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) {
+ // the alignment field is valid
+ if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) {
+ // if the section address is aligned we must align PE/COFF
+ mCoffOffset = (UINT32) ((mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1));
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Section address not aligned to its own alignment.");
+ }
+ }
+ if (shdr->sh_size != 0) {
+ mHiiRsrcOffset = mCoffOffset;
+ mCoffSectionsOffset[i] = mCoffOffset;
+ mCoffOffset += (UINT32) shdr->sh_size;
+ mCoffOffset = CoffAlign(mCoffOffset);
+ SetHiiResourceHeader ((UINT8*) mEhdr + shdr->sh_offset, mHiiRsrcOffset);
+ }
+ break;
+ }
+ }
+
+ mRelocOffset = mCoffOffset;
+
+ //
+ // Allocate base Coff file. Will be expanded later for relocations.
+ //
+ mCoffFile = (UINT8 *)malloc(mCoffOffset);
+ if (mCoffFile == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ }
+ assert (mCoffFile != NULL);
+ memset(mCoffFile, 0, mCoffOffset);
+
+ //
+ // Fill headers.
+ //
+ DosHdr = (EFI_IMAGE_DOS_HEADER *)mCoffFile;
+ DosHdr->e_magic = EFI_IMAGE_DOS_SIGNATURE;
+ DosHdr->e_lfanew = mNtHdrOffset;
+
+ NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION*)(mCoffFile + mNtHdrOffset);
+
+ NtHdr->Pe32Plus.Signature = EFI_IMAGE_NT_SIGNATURE;
+
+ switch (mEhdr->e_machine) {
+ case EM_X86_64:
+ NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_X64;
+ NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
+ break;
+ case EM_AARCH64:
+ NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_AARCH64;
+ NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
+ break;
+ case EM_RISCV64:
+ NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_RISCV64;
+ NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
+ break;
+
+ default:
+ VerboseMsg ("%s unknown e_machine type. Assume X64", (UINTN)mEhdr->e_machine);
+ NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_X64;
+ NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
+ }
+
+ NtHdr->Pe32Plus.FileHeader.NumberOfSections = mCoffNbrSections;
+ NtHdr->Pe32Plus.FileHeader.TimeDateStamp = (UINT32) time(NULL);
+ mImageTimeStamp = NtHdr->Pe32Plus.FileHeader.TimeDateStamp;
+ NtHdr->Pe32Plus.FileHeader.PointerToSymbolTable = 0;
+ NtHdr->Pe32Plus.FileHeader.NumberOfSymbols = 0;
+ NtHdr->Pe32Plus.FileHeader.SizeOfOptionalHeader = sizeof(NtHdr->Pe32Plus.OptionalHeader);
+ NtHdr->Pe32Plus.FileHeader.Characteristics = EFI_IMAGE_FILE_EXECUTABLE_IMAGE
+ | EFI_IMAGE_FILE_LINE_NUMS_STRIPPED
+ | EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED
+ | EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE;
+
+ NtHdr->Pe32Plus.OptionalHeader.SizeOfCode = mDataOffset - mTextOffset;
+ NtHdr->Pe32Plus.OptionalHeader.SizeOfInitializedData = mRelocOffset - mDataOffset;
+ NtHdr->Pe32Plus.OptionalHeader.SizeOfUninitializedData = 0;
+ NtHdr->Pe32Plus.OptionalHeader.AddressOfEntryPoint = CoffEntry;
+
+ NtHdr->Pe32Plus.OptionalHeader.BaseOfCode = mTextOffset;
+
+ NtHdr->Pe32Plus.OptionalHeader.ImageBase = 0;
+ NtHdr->Pe32Plus.OptionalHeader.SectionAlignment = mCoffAlignment;
+ NtHdr->Pe32Plus.OptionalHeader.FileAlignment = mCoffAlignment;
+ NtHdr->Pe32Plus.OptionalHeader.SizeOfImage = 0;
+
+ NtHdr->Pe32Plus.OptionalHeader.SizeOfHeaders = mTextOffset;
+ NtHdr->Pe32Plus.OptionalHeader.NumberOfRvaAndSizes = EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES;
+
+ //
+ // Section headers.
+ //
+ if ((mDataOffset - mTextOffset) > 0) {
+ CreateSectionHeader (".text", mTextOffset, mDataOffset - mTextOffset,
+ EFI_IMAGE_SCN_CNT_CODE
+ | EFI_IMAGE_SCN_MEM_EXECUTE
+ | EFI_IMAGE_SCN_MEM_READ);
+ } else {
+ // Don't make a section of size 0.
+ NtHdr->Pe32Plus.FileHeader.NumberOfSections--;
+ }
+
+ if ((mHiiRsrcOffset - mDataOffset) > 0) {
+ CreateSectionHeader (".data", mDataOffset, mHiiRsrcOffset - mDataOffset,
+ EFI_IMAGE_SCN_CNT_INITIALIZED_DATA
+ | EFI_IMAGE_SCN_MEM_WRITE
+ | EFI_IMAGE_SCN_MEM_READ);
+ } else {
+ // Don't make a section of size 0.
+ NtHdr->Pe32Plus.FileHeader.NumberOfSections--;
+ }
+
+ if ((mRelocOffset - mHiiRsrcOffset) > 0) {
+ CreateSectionHeader (".rsrc", mHiiRsrcOffset, mRelocOffset - mHiiRsrcOffset,
+ EFI_IMAGE_SCN_CNT_INITIALIZED_DATA
+ | EFI_IMAGE_SCN_MEM_READ);
+
+ NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = mRelocOffset - mHiiRsrcOffset;
+ NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = mHiiRsrcOffset;
+ } else {
+ // Don't make a section of size 0.
+ NtHdr->Pe32Plus.FileHeader.NumberOfSections--;
+ }
+
+}
+
+STATIC
+BOOLEAN
+WriteSections64 (
+ SECTION_FILTER_TYPES FilterType
+ )
+{
+ UINT32 Idx;
+ Elf_Shdr *SecShdr;
+ UINT32 SecOffset;
+ BOOLEAN (*Filter)(Elf_Shdr *);
+ Elf64_Addr GOTEntryRva;
+
+ //
+ // Initialize filter pointer
+ //
+ switch (FilterType) {
+ case SECTION_TEXT:
+ Filter = IsTextShdr;
+ break;
+ case SECTION_HII:
+ Filter = IsHiiRsrcShdr;
+ break;
+ case SECTION_DATA:
+ Filter = IsDataShdr;
+ break;
+ default:
+ return FALSE;
+ }
+
+ //
+ // First: copy sections.
+ //
+ for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) {
+ Elf_Shdr *Shdr = GetShdrByIndex(Idx);
+ if ((*Filter)(Shdr)) {
+ switch (Shdr->sh_type) {
+ case SHT_PROGBITS:
+ /* Copy. */
+ if (Shdr->sh_offset + Shdr->sh_size > mFileBufferSize) {
+ return FALSE;
+ }
+ memcpy(mCoffFile + mCoffSectionsOffset[Idx],
+ (UINT8*)mEhdr + Shdr->sh_offset,
+ (size_t) Shdr->sh_size);
+ break;
+
+ case SHT_NOBITS:
+ memset(mCoffFile + mCoffSectionsOffset[Idx], 0, (size_t) Shdr->sh_size);
+ break;
+
+ default:
+ //
+ // Ignore for unknown section type.
+ //
+ VerboseMsg ("%s unknown section type %x. We ignore this unknown section type.", mInImageName, (unsigned)Shdr->sh_type);
+ break;
+ }
+ }
+ }
+
+ //
+ // Second: apply relocations.
+ //
+ VerboseMsg ("Applying Relocations...");
+ for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) {
+ //
+ // Determine if this is a relocation section.
+ //
+ Elf_Shdr *RelShdr = GetShdrByIndex(Idx);
+ if ((RelShdr->sh_type != SHT_REL) && (RelShdr->sh_type != SHT_RELA)) {
+ continue;
+ }
+
+ //
+ // If this is a ET_DYN (PIE) executable, we will encounter a dynamic SHT_RELA
+ // section that applies to the entire binary, and which will have its section
+ // index set to #0 (which is a NULL section with the SHF_ALLOC bit cleared).
+ //
+ // In the absence of GOT based relocations,
+ // this RELA section will contain redundant R_xxx_RELATIVE relocations, one
+ // for every R_xxx_xx64 relocation appearing in the per-section RELA sections.
+ // (i.e., .rela.text and .rela.data)
+ //
+ if (RelShdr->sh_info == 0) {
+ continue;
+ }
+
+ //
+ // Relocation section found. Now extract section information that the relocations
+ // apply to in the ELF data and the new COFF data.
+ //
+ SecShdr = GetShdrByIndex(RelShdr->sh_info);
+ SecOffset = mCoffSectionsOffset[RelShdr->sh_info];
+
+ //
+ // Only process relocations for the current filter type.
+ //
+ if (RelShdr->sh_type == SHT_RELA && (*Filter)(SecShdr)) {
+ UINT64 RelIdx;
+
+ //
+ // Determine the symbol table referenced by the relocation data.
+ //
+ Elf_Shdr *SymtabShdr = GetShdrByIndex(RelShdr->sh_link);
+ UINT8 *Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset;
+
+ //
+ // Process all relocation entries for this section.
+ //
+ for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += (UINT32) RelShdr->sh_entsize) {
+
+ //
+ // Set pointer to relocation entry
+ //
+ Elf_Rela *Rel = (Elf_Rela *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);
+
+ //
+ // Set pointer to symbol table entry associated with the relocation entry.
+ //
+ Elf_Sym *Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize);
+
+ Elf_Shdr *SymShdr;
+ UINT8 *Targ;
+
+ //
+ // Check section header index found in symbol table and get the section
+ // header location.
+ //
+ if (Sym->st_shndx == SHN_UNDEF
+ || Sym->st_shndx >= mEhdr->e_shnum) {
+ const UINT8 *SymName = GetSymName(Sym);
+ if (SymName == NULL) {
+ SymName = (const UINT8 *)"<unknown>";
+ }
+
+ //
+ // Skip error on EM_RISCV64 becasue no symble name is built
+ // from RISC-V toolchain.
+ //
+ if (mEhdr->e_machine != EM_RISCV64) {
+ Error (NULL, 0, 3000, "Invalid",
+ "%s: Bad definition for symbol '%s'@%#llx or unsupported symbol type. "
+ "For example, absolute and undefined symbols are not supported.",
+ mInImageName, SymName, Sym->st_value);
+
+ exit(EXIT_FAILURE);
+ }
+ }
+ SymShdr = GetShdrByIndex(Sym->st_shndx);
+
+ //
+ // Convert the relocation data to a pointer into the coff file.
+ //
+ // Note:
+ // r_offset is the virtual address of the storage unit to be relocated.
+ // sh_addr is the virtual address for the base of the section.
+ //
+ // r_offset in a memory address.
+ // Convert it to a pointer in the coff file.
+ //
+ Targ = mCoffFile + SecOffset + (Rel->r_offset - SecShdr->sh_addr);
+
+ //
+ // Determine how to handle each relocation type based on the machine type.
+ //
+ if (mEhdr->e_machine == EM_X86_64) {
+ switch (ELF_R_TYPE(Rel->r_info)) {
+ case R_X86_64_NONE:
+ break;
+ case R_X86_64_64:
+ //
+ // Absolute relocation.
+ //
+ VerboseMsg ("R_X86_64_64");
+ VerboseMsg ("Offset: 0x%08X, Addend: 0x%016LX",
+ (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
+ *(UINT64 *)Targ);
+ *(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx];
+ VerboseMsg ("Relocation: 0x%016LX", *(UINT64*)Targ);
+ break;
+ case R_X86_64_32:
+ VerboseMsg ("R_X86_64_32");
+ VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
+ (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
+ *(UINT32 *)Targ);
+ *(UINT32 *)Targ = (UINT32)((UINT64)(*(UINT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
+ VerboseMsg ("Relocation: 0x%08X", *(UINT32*)Targ);
+ break;
+ case R_X86_64_32S:
+ VerboseMsg ("R_X86_64_32S");
+ VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
+ (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
+ *(UINT32 *)Targ);
+ *(INT32 *)Targ = (INT32)((INT64)(*(INT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
+ VerboseMsg ("Relocation: 0x%08X", *(UINT32*)Targ);
+ break;
+
+ case R_X86_64_PLT32:
+ //
+ // Treat R_X86_64_PLT32 relocations as R_X86_64_PC32: this is
+ // possible since we know all code symbol references resolve to
+ // definitions in the same module (UEFI has no shared libraries),
+ // and so there is never a reason to jump via a PLT entry,
+ // allowing us to resolve the reference using the symbol directly.
+ //
+ VerboseMsg ("Treating R_X86_64_PLT32 as R_X86_64_PC32 ...");
+ /* fall through */
+ case R_X86_64_PC32:
+ //
+ // Relative relocation: Symbol - Ip + Addend
+ //
+ VerboseMsg ("R_X86_64_PC32");
+ VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
+ (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
+ *(UINT32 *)Targ);
+ *(UINT32 *)Targ = (UINT32) (*(UINT32 *)Targ
+ + (mCoffSectionsOffset[Sym->st_shndx] - SymShdr->sh_addr)
+ - (SecOffset - SecShdr->sh_addr));
+ VerboseMsg ("Relocation: 0x%08X", *(UINT32 *)Targ);
+ break;
+ case R_X86_64_GOTPCREL:
+ case R_X86_64_GOTPCRELX:
+ case R_X86_64_REX_GOTPCRELX:
+ VerboseMsg ("R_X86_64_GOTPCREL family");
+ VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
+ (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
+ *(UINT32 *)Targ);
+ GOTEntryRva = Rel->r_offset - Rel->r_addend + *(INT32 *)Targ;
+ FindElfGOTSectionFromGOTEntryElfRva(GOTEntryRva);
+ *(UINT32 *)Targ = (UINT32) (*(UINT32 *)Targ
+ + (mCoffSectionsOffset[mGOTShindex] - mGOTShdr->sh_addr)
+ - (SecOffset - SecShdr->sh_addr));
+ VerboseMsg ("Relocation: 0x%08X", *(UINT32 *)Targ);
+ GOTEntryRva += (mCoffSectionsOffset[mGOTShindex] - mGOTShdr->sh_addr); // ELF Rva -> COFF Rva
+ if (AccumulateCoffGOTEntries((UINT32)GOTEntryRva)) {
+ //
+ // Relocate GOT entry if it's the first time we run into it
+ //
+ Targ = mCoffFile + GOTEntryRva;
+ //
+ // Limitation: The following three statements assume memory
+ // at *Targ is valid because the section containing the GOT
+ // has already been copied from the ELF image to the Coff image.
+ // This pre-condition presently holds because the GOT is placed
+ // in section .text, and the ELF text sections are all copied
+ // prior to reaching this point.
+ // If the pre-condition is violated in the future, this fixup
+ // either needs to be deferred after the GOT section is copied
+ // to the Coff image, or the fixup should be performed on the
+ // source Elf image instead of the destination Coff image.
+ //
+ VerboseMsg ("Offset: 0x%08X, Addend: 0x%016LX",
+ (UINT32)GOTEntryRva,
+ *(UINT64 *)Targ);
+ *(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx];
+ VerboseMsg ("Relocation: 0x%016LX", *(UINT64*)Targ);
+ }
+ break;
+ default:
+ Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_X86_64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
+ }
+ } else if (mEhdr->e_machine == EM_AARCH64) {
+
+ switch (ELF_R_TYPE(Rel->r_info)) {
+ INT64 Offset;
+
+ case R_AARCH64_LD64_GOT_LO12_NC:
+ //
+ // Convert into an ADD instruction - see R_AARCH64_ADR_GOT_PAGE below.
+ //
+ *(UINT32 *)Targ &= 0x3ff;
+ *(UINT32 *)Targ |= 0x91000000 | ((Sym->st_value & 0xfff) << 10);
+ break;
+
+ case R_AARCH64_ADR_GOT_PAGE:
+ //
+ // This relocation points to the GOT entry that contains the absolute
+ // address of the symbol we are referring to. Since EDK2 only uses
+ // fully linked binaries, we can avoid the indirection, and simply
+ // refer to the symbol directly. This implies having to patch the
+ // subsequent LDR instruction (covered by a R_AARCH64_LD64_GOT_LO12_NC
+ // relocation) into an ADD instruction - this is handled above.
+ //
+ Offset = (Sym->st_value - (Rel->r_offset & ~0xfff)) >> 12;
+
+ *(UINT32 *)Targ &= 0x9000001f;
+ *(UINT32 *)Targ |= ((Offset & 0x1ffffc) << (5 - 2)) | ((Offset & 0x3) << 29);
+
+ /* fall through */
+
+ case R_AARCH64_ADR_PREL_PG_HI21:
+ //
+ // In order to handle Cortex-A53 erratum #843419, the LD linker may
+ // convert ADRP instructions into ADR instructions, but without
+ // updating the static relocation type, and so we may end up here
+ // while the instruction in question is actually ADR. So let's
+ // just disregard it: the section offset check we apply below to
+ // ADR instructions will trigger for its R_AARCH64_xxx_ABS_LO12_NC
+ // companion instruction as well, so it is safe to omit it here.
+ //
+ if ((*(UINT32 *)Targ & BIT31) == 0) {
+ break;
+ }
+
+ //
+ // AArch64 PG_H21 relocations are typically paired with ABS_LO12
+ // relocations, where a PC-relative reference with +/- 4 GB range is
+ // split into a relative high part and an absolute low part. Since
+ // the absolute low part represents the offset into a 4 KB page, we
+ // either have to convert the ADRP into an ADR instruction, or we
+ // need to use a section alignment of at least 4 KB, so that the
+ // binary appears at a correct offset at runtime. In any case, we
+ // have to make sure that the 4 KB relative offsets of both the
+ // section containing the reference as well as the section to which
+ // it refers have not been changed during PE/COFF conversion (i.e.,
+ // in ScanSections64() above).
+ //
+ if (mCoffAlignment < 0x1000) {
+ //
+ // Attempt to convert the ADRP into an ADR instruction.
+ // This is only possible if the symbol is within +/- 1 MB.
+ //
+
+ // Decode the ADRP instruction
+ Offset = (INT32)((*(UINT32 *)Targ & 0xffffe0) << 8);
+ Offset = (Offset << (6 - 5)) | ((*(UINT32 *)Targ & 0x60000000) >> (29 - 12));
+
+ //
+ // ADRP offset is relative to the previous page boundary,
+ // whereas ADR offset is relative to the instruction itself.
+ // So fix up the offset so it points to the page containing
+ // the symbol.
+ //
+ Offset -= (UINTN)(Targ - mCoffFile) & 0xfff;
+
+ if (Offset < -0x100000 || Offset > 0xfffff) {
+ Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s due to its size (> 1 MB), this module requires 4 KB section alignment.",
+ mInImageName);
+ break;
+ }
+
+ // Re-encode the offset as an ADR instruction
+ *(UINT32 *)Targ &= 0x1000001f;
+ *(UINT32 *)Targ |= ((Offset & 0x1ffffc) << (5 - 2)) | ((Offset & 0x3) << 29);
+ }
+ /* fall through */
+
+ case R_AARCH64_ADD_ABS_LO12_NC:
+ case R_AARCH64_LDST8_ABS_LO12_NC:
+ case R_AARCH64_LDST16_ABS_LO12_NC:
+ case R_AARCH64_LDST32_ABS_LO12_NC:
+ case R_AARCH64_LDST64_ABS_LO12_NC:
+ case R_AARCH64_LDST128_ABS_LO12_NC:
+ if (((SecShdr->sh_addr ^ SecOffset) & 0xfff) != 0 ||
+ ((SymShdr->sh_addr ^ mCoffSectionsOffset[Sym->st_shndx]) & 0xfff) != 0) {
+ Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s AARCH64 small code model requires identical ELF and PE/COFF section offsets modulo 4 KB.",
+ mInImageName);
+ break;
+ }
+ /* fall through */
+
+ case R_AARCH64_ADR_PREL_LO21:
+ case R_AARCH64_CONDBR19:
+ case R_AARCH64_LD_PREL_LO19:
+ case R_AARCH64_CALL26:
+ case R_AARCH64_JUMP26:
+ case R_AARCH64_PREL64:
+ case R_AARCH64_PREL32:
+ case R_AARCH64_PREL16:
+ //
+ // The GCC toolchains (i.e., binutils) may corrupt section relative
+ // relocations when emitting relocation sections into fully linked
+ // binaries. More specifically, they tend to fail to take into
+ // account the fact that a '.rodata + XXX' relocation needs to have
+ // its addend recalculated once .rodata is merged into the .text
+ // section, and the relocation emitted into the .rela.text section.
+ //
+ // We cannot really recover from this loss of information, so the
+ // only workaround is to prevent having to recalculate any relative
+ // relocations at all, by using a linker script that ensures that
+ // the offset between the Place and the Symbol is the same in both
+ // the ELF and the PE/COFF versions of the binary.
+ //
+ if ((SymShdr->sh_addr - SecShdr->sh_addr) !=
+ (mCoffSectionsOffset[Sym->st_shndx] - SecOffset)) {
+ Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s AARCH64 relative relocations require identical ELF and PE/COFF section offsets",
+ mInImageName);
+ }
+ break;
+
+ // Absolute relocations.
+ case R_AARCH64_ABS64:
+ *(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx];
+ break;
+
+ default:
+ Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s unsupported ELF EM_AARCH64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
+ }
+ } else if (mEhdr->e_machine == EM_RISCV64) {
+ //
+ // Write section for RISC-V 64 architecture.
+ //
+ WriteSectionRiscV64 (Rel, Targ, SymShdr, Sym);
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Not a supported machine type");
+ }
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+STATIC
+VOID
+WriteRelocations64 (
+ VOID
+ )
+{
+ UINT32 Index;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
+ EFI_IMAGE_DATA_DIRECTORY *Dir;
+ UINT32 RiscVRelType;
+
+ for (Index = 0; Index < mEhdr->e_shnum; Index++) {
+ Elf_Shdr *RelShdr = GetShdrByIndex(Index);
+ if ((RelShdr->sh_type == SHT_REL) || (RelShdr->sh_type == SHT_RELA)) {
+ Elf_Shdr *SecShdr = GetShdrByIndex (RelShdr->sh_info);
+ if (IsTextShdr(SecShdr) || IsDataShdr(SecShdr)) {
+ UINT64 RelIdx;
+
+ for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) {
+ Elf_Rela *Rel = (Elf_Rela *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);
+
+ if (mEhdr->e_machine == EM_X86_64) {
+ switch (ELF_R_TYPE(Rel->r_info)) {
+ case R_X86_64_NONE:
+ case R_X86_64_PC32:
+ case R_X86_64_PLT32:
+ case R_X86_64_GOTPCREL:
+ case R_X86_64_GOTPCRELX:
+ case R_X86_64_REX_GOTPCRELX:
+ break;
+ case R_X86_64_64:
+ VerboseMsg ("EFI_IMAGE_REL_BASED_DIR64 Offset: 0x%08X",
+ mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr));
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_DIR64);
+ break;
+ //
+ // R_X86_64_32 and R_X86_64_32S are ELF64 relocations emitted when using
+ // the SYSV X64 ABI small non-position-independent code model.
+ // R_X86_64_32 is used for unsigned 32-bit immediates with a 32-bit operand
+ // size. The value is either not extended, or zero-extended to 64 bits.
+ // R_X86_64_32S is used for either signed 32-bit non-rip-relative displacements
+ // or signed 32-bit immediates with a 64-bit operand size. The value is
+ // sign-extended to 64 bits.
+ // EFI_IMAGE_REL_BASED_HIGHLOW is a PE relocation that uses 32-bit arithmetic
+ // for rebasing an image.
+ // EFI PE binaries declare themselves EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE and
+ // may load above 2GB. If an EFI PE binary with a converted R_X86_64_32S
+ // relocation is loaded above 2GB, the value will get sign-extended to the
+ // negative part of the 64-bit address space. The negative part of the 64-bit
+ // address space is unmapped, so accessing such an address page-faults.
+ // In order to support R_X86_64_32S, it is necessary to unset
+ // EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE, and the EFI PE loader must implement
+ // this flag and abstain from loading such a PE binary above 2GB.
+ // Since this feature is not supported, support for R_X86_64_32S (and hence
+ // the small non-position-independent code model) is disabled.
+ //
+ // case R_X86_64_32S:
+ case R_X86_64_32:
+ VerboseMsg ("EFI_IMAGE_REL_BASED_HIGHLOW Offset: 0x%08X",
+ mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr));
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_HIGHLOW);
+ break;
+ default:
+ Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_X86_64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
+ }
+ } else if (mEhdr->e_machine == EM_AARCH64) {
+
+ switch (ELF_R_TYPE(Rel->r_info)) {
+ case R_AARCH64_ADR_PREL_LO21:
+ case R_AARCH64_CONDBR19:
+ case R_AARCH64_LD_PREL_LO19:
+ case R_AARCH64_CALL26:
+ case R_AARCH64_JUMP26:
+ case R_AARCH64_PREL64:
+ case R_AARCH64_PREL32:
+ case R_AARCH64_PREL16:
+ case R_AARCH64_ADR_PREL_PG_HI21:
+ case R_AARCH64_ADD_ABS_LO12_NC:
+ case R_AARCH64_LDST8_ABS_LO12_NC:
+ case R_AARCH64_LDST16_ABS_LO12_NC:
+ case R_AARCH64_LDST32_ABS_LO12_NC:
+ case R_AARCH64_LDST64_ABS_LO12_NC:
+ case R_AARCH64_LDST128_ABS_LO12_NC:
+ case R_AARCH64_ADR_GOT_PAGE:
+ case R_AARCH64_LD64_GOT_LO12_NC:
+ //
+ // No fixups are required for relative relocations, provided that
+ // the relative offsets between sections have been preserved in
+ // the ELF to PE/COFF conversion. We have already asserted that
+ // this is the case in WriteSections64 ().
+ //
+ break;
+
+ case R_AARCH64_ABS64:
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_DIR64);
+ break;
+
+ case R_AARCH64_ABS32:
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_HIGHLOW);
+ break;
+
+ default:
+ Error (NULL, 0, 3000, "Invalid", "WriteRelocations64(): %s unsupported ELF EM_AARCH64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
+ }
+ } else if (mEhdr->e_machine == EM_RISCV64) {
+ RiscVRelType = ELF_R_TYPE(Rel->r_info);
+ switch (RiscVRelType) {
+ case R_RISCV_NONE:
+ break;
+
+ case R_RISCV_32:
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_HIGHLOW);
+ break;
+
+ case R_RISCV_64:
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_DIR64);
+ break;
+
+ case R_RISCV_HI20:
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_RISCV_HI20);
+ break;
+
+ case R_RISCV_LO12_I:
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_RISCV_LOW12I);
+ break;
+
+ case R_RISCV_LO12_S:
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_RISCV_LOW12S);
+ break;
+
+ case R_RISCV_ADD64:
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_ABSOLUTE);
+ break;
+
+ case R_RISCV_SUB64:
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_ABSOLUTE);
+ break;
+
+ case R_RISCV_ADD32:
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_ABSOLUTE);
+ break;
+
+ case R_RISCV_SUB32:
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_ABSOLUTE);
+ break;
+
+ case R_RISCV_BRANCH:
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_ABSOLUTE);
+ break;
+
+ case R_RISCV_JAL:
+ CoffAddFixup(
+ (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
+ + (Rel->r_offset - SecShdr->sh_addr)),
+ EFI_IMAGE_REL_BASED_ABSOLUTE);
+ break;
+
+ case R_RISCV_GPREL_I:
+ case R_RISCV_GPREL_S:
+ case R_RISCV_CALL:
+ case R_RISCV_RVC_BRANCH:
+ case R_RISCV_RVC_JUMP:
+ case R_RISCV_RELAX:
+ case R_RISCV_SUB6:
+ case R_RISCV_SET6:
+ case R_RISCV_SET8:
+ case R_RISCV_SET16:
+ case R_RISCV_SET32:
+ case R_RISCV_PCREL_HI20:
+ case R_RISCV_PCREL_LO12_I:
+ break;
+
+ default:
+ Error (NULL, 0, 3000, "Invalid", "WriteRelocations64(): %s unsupported ELF EM_RISCV64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
+ }
+ } else {
+ Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %u (processor type).", (unsigned) mEhdr->e_machine);
+ }
+ }
+ if (mEhdr->e_machine == EM_X86_64 && RelShdr->sh_info == mGOTShindex) {
+ //
+ // Tack relocations for GOT entries after other relocations for
+ // the section the GOT is in, as it's usually found at the end
+ // of the section. This is done in order to maintain Rva order
+ // of Coff relocations.
+ //
+ EmitGOTRelocations();
+ }
+ }
+ }
+ }
+
+ if (mEhdr->e_machine == EM_X86_64) {
+ //
+ // This is a safety net just in case the GOT is in a section
+ // with no other relocations and the first invocation of
+ // EmitGOTRelocations() above was skipped. This invocation
+ // does not maintain Rva order of Coff relocations.
+ // At present, with a single text section, all references to
+ // the GOT and the GOT itself reside in section .text, so
+ // if there's a GOT at all, the first invocation above
+ // is executed.
+ //
+ EmitGOTRelocations();
+ }
+ //
+ // Pad by adding empty entries.
+ //
+ while (mCoffOffset & (mCoffAlignment - 1)) {
+ CoffAddFixupEntry(0);
+ }
+
+ NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset);
+ Dir = &NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+ Dir->Size = mCoffOffset - mRelocOffset;
+ if (Dir->Size == 0) {
+ // If no relocations, null out the directory entry and don't add the .reloc section
+ Dir->VirtualAddress = 0;
+ NtHdr->Pe32Plus.FileHeader.NumberOfSections--;
+ } else {
+ Dir->VirtualAddress = mRelocOffset;
+ CreateSectionHeader (".reloc", mRelocOffset, mCoffOffset - mRelocOffset,
+ EFI_IMAGE_SCN_CNT_INITIALIZED_DATA
+ | EFI_IMAGE_SCN_MEM_DISCARDABLE
+ | EFI_IMAGE_SCN_MEM_READ);
+ }
+}
+
+STATIC
+VOID
+WriteDebug64 (
+ VOID
+ )
+{
+ UINT32 Len;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
+ EFI_IMAGE_DATA_DIRECTORY *DataDir;
+ EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *Dir;
+ EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY *Nb10;
+
+ Len = strlen(mInImageName) + 1;
+
+ Dir = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY*)(mCoffFile + mDebugOffset);
+ Dir->Type = EFI_IMAGE_DEBUG_TYPE_CODEVIEW;
+ Dir->SizeOfData = sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) + Len;
+ Dir->RVA = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+ Dir->FileOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+
+ Nb10 = (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY*)(Dir + 1);
+ Nb10->Signature = CODEVIEW_SIGNATURE_NB10;
+ strcpy ((char *)(Nb10 + 1), mInImageName);
+
+
+ NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset);
+ DataDir = &NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG];
+ DataDir->VirtualAddress = mDebugOffset;
+ DataDir->Size = sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+}
+
+STATIC
+VOID
+SetImageSize64 (
+ VOID
+ )
+{
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
+
+ //
+ // Set image size
+ //
+ NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset);
+ NtHdr->Pe32Plus.OptionalHeader.SizeOfImage = mCoffOffset;
+}
+
+STATIC
+VOID
+CleanUp64 (
+ VOID
+ )
+{
+ if (mCoffSectionsOffset != NULL) {
+ free (mCoffSectionsOffset);
+ }
+}
+
+
diff --git a/roms/edk2/BaseTools/Source/C/GenFw/Elf64Convert.h b/roms/edk2/BaseTools/Source/C/GenFw/Elf64Convert.h
new file mode 100644
index 000000000..330b2a76a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFw/Elf64Convert.h
@@ -0,0 +1,19 @@
+/** @file
+Header file for Elf64 convert solution
+
+Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _ELF_64_CONVERT_
+#define _ELF_64_CONVERT_
+
+BOOLEAN
+InitializeElf64 (
+ UINT8 *FileBuffer,
+ ELF_FUNCTION_TABLE *ElfFunctions
+ );
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/GenFw/ElfConvert.c b/roms/edk2/BaseTools/Source/C/GenFw/ElfConvert.c
new file mode 100644
index 000000000..7db872116
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFw/ElfConvert.c
@@ -0,0 +1,245 @@
+/** @file
+Elf convert solution
+
+Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "WinNtInclude.h"
+
+#ifndef __GNUC__
+#include <windows.h>
+#include <io.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <ctype.h>
+#include <assert.h>
+
+#include <Common/UefiBaseTypes.h>
+#include <IndustryStandard/PeImage.h>
+
+#include "EfiUtilityMsgs.h"
+
+#include "GenFw.h"
+#include "ElfConvert.h"
+#include "Elf32Convert.h"
+#include "Elf64Convert.h"
+
+//
+// Result Coff file in memory.
+//
+UINT8 *mCoffFile = NULL;
+
+//
+// COFF relocation data
+//
+EFI_IMAGE_BASE_RELOCATION *mCoffBaseRel;
+UINT16 *mCoffEntryRel;
+
+//
+// Current offset in coff file.
+//
+UINT32 mCoffOffset;
+
+//
+// Offset in Coff file of headers and sections.
+//
+UINT32 mTableOffset;
+
+//
+//mFileBufferSize
+//
+UINT32 mFileBufferSize;
+
+//
+//*****************************************************************************
+// Common ELF Functions
+//*****************************************************************************
+//
+
+VOID
+CoffAddFixupEntry(
+ UINT16 Val
+ )
+{
+ *mCoffEntryRel = Val;
+ mCoffEntryRel++;
+ mCoffBaseRel->SizeOfBlock += 2;
+ mCoffOffset += 2;
+}
+
+VOID
+CoffAddFixup(
+ UINT32 Offset,
+ UINT8 Type
+ )
+{
+ if (mCoffBaseRel == NULL
+ || mCoffBaseRel->VirtualAddress != (Offset & ~0xfff)) {
+ if (mCoffBaseRel != NULL) {
+ //
+ // Add a null entry (is it required ?)
+ //
+ CoffAddFixupEntry (0);
+
+ //
+ // Pad for alignment.
+ //
+ if (mCoffOffset % 4 != 0)
+ CoffAddFixupEntry (0);
+ }
+
+ mCoffFile = realloc (
+ mCoffFile,
+ mCoffOffset + sizeof(EFI_IMAGE_BASE_RELOCATION) + 2 * MAX_COFF_ALIGNMENT
+ );
+ if (mCoffFile == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ }
+ assert (mCoffFile != NULL);
+ memset (
+ mCoffFile + mCoffOffset, 0,
+ sizeof(EFI_IMAGE_BASE_RELOCATION) + 2 * MAX_COFF_ALIGNMENT
+ );
+
+ mCoffBaseRel = (EFI_IMAGE_BASE_RELOCATION*)(mCoffFile + mCoffOffset);
+ mCoffBaseRel->VirtualAddress = Offset & ~0xfff;
+ mCoffBaseRel->SizeOfBlock = sizeof(EFI_IMAGE_BASE_RELOCATION);
+
+ mCoffEntryRel = (UINT16 *)(mCoffBaseRel + 1);
+ mCoffOffset += sizeof(EFI_IMAGE_BASE_RELOCATION);
+ }
+
+ //
+ // Fill the entry.
+ //
+ CoffAddFixupEntry((UINT16) ((Type << 12) | (Offset & 0xfff)));
+}
+
+VOID
+CreateSectionHeader (
+ const CHAR8 *Name,
+ UINT32 Offset,
+ UINT32 Size,
+ UINT32 Flags
+ )
+{
+ EFI_IMAGE_SECTION_HEADER *Hdr;
+ Hdr = (EFI_IMAGE_SECTION_HEADER*)(mCoffFile + mTableOffset);
+
+ strcpy((char *)Hdr->Name, Name);
+ Hdr->Misc.VirtualSize = Size;
+ Hdr->VirtualAddress = Offset;
+ Hdr->SizeOfRawData = Size;
+ Hdr->PointerToRawData = Offset;
+ Hdr->PointerToRelocations = 0;
+ Hdr->PointerToLinenumbers = 0;
+ Hdr->NumberOfRelocations = 0;
+ Hdr->NumberOfLinenumbers = 0;
+ Hdr->Characteristics = Flags;
+
+ mTableOffset += sizeof (EFI_IMAGE_SECTION_HEADER);
+}
+
+//
+//*****************************************************************************
+// Functions called from GenFw main code.
+//*****************************************************************************
+//
+
+INTN
+IsElfHeader (
+ UINT8 *FileBuffer
+)
+{
+ return (FileBuffer[EI_MAG0] == ELFMAG0 &&
+ FileBuffer[EI_MAG1] == ELFMAG1 &&
+ FileBuffer[EI_MAG2] == ELFMAG2 &&
+ FileBuffer[EI_MAG3] == ELFMAG3);
+}
+
+BOOLEAN
+ConvertElf (
+ UINT8 **FileBuffer,
+ UINT32 *FileLength
+ )
+{
+ ELF_FUNCTION_TABLE ElfFunctions;
+ UINT8 EiClass;
+
+ mFileBufferSize = *FileLength;
+ //
+ // Determine ELF type and set function table pointer correctly.
+ //
+ VerboseMsg ("Check Elf Image Header");
+ EiClass = (*FileBuffer)[EI_CLASS];
+ if (EiClass == ELFCLASS32) {
+ if (!InitializeElf32 (*FileBuffer, &ElfFunctions)) {
+ return FALSE;
+ }
+ } else if (EiClass == ELFCLASS64) {
+ if (!InitializeElf64 (*FileBuffer, &ElfFunctions)) {
+ return FALSE;
+ }
+ } else {
+ Error (NULL, 0, 3000, "Unsupported", "ELF EI_CLASS not supported.");
+ return FALSE;
+ }
+
+ //
+ // Compute sections new address.
+ //
+ VerboseMsg ("Compute sections new address.");
+ ElfFunctions.ScanSections ();
+
+ //
+ // Write and relocate sections.
+ //
+ VerboseMsg ("Write and relocate sections.");
+ if (!ElfFunctions.WriteSections (SECTION_TEXT)) {
+ return FALSE;
+ }
+ if (!ElfFunctions.WriteSections (SECTION_DATA)) {
+ return FALSE;
+ }
+ if (!ElfFunctions.WriteSections (SECTION_HII)) {
+ return FALSE;
+ }
+
+ //
+ // Translate and write relocations.
+ //
+ VerboseMsg ("Translate and write relocations.");
+ ElfFunctions.WriteRelocations ();
+
+ //
+ // Write debug info.
+ //
+ VerboseMsg ("Write debug info.");
+ ElfFunctions.WriteDebug ();
+
+ //
+ // Make sure image size is correct before returning the new image.
+ //
+ VerboseMsg ("Set image size.");
+ ElfFunctions.SetImageSize ();
+
+ //
+ // Replace.
+ //
+ free (*FileBuffer);
+ *FileBuffer = mCoffFile;
+ *FileLength = mCoffOffset;
+
+ //
+ // Free resources used by ELF functions.
+ //
+ ElfFunctions.CleanUp ();
+
+ return TRUE;
+}
diff --git a/roms/edk2/BaseTools/Source/C/GenFw/ElfConvert.h b/roms/edk2/BaseTools/Source/C/GenFw/ElfConvert.h
new file mode 100644
index 000000000..801e8de4a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFw/ElfConvert.h
@@ -0,0 +1,81 @@
+/** @file
+Header file for Elf convert solution
+
+Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _ELF_CONVERT_H_
+#define _ELF_CONVERT_H_
+
+#include "elf_common.h"
+#include "elf32.h"
+#include "elf64.h"
+
+//
+// Externally defined variables
+//
+extern UINT32 mCoffOffset;
+extern CHAR8 *mInImageName;
+extern UINT32 mImageTimeStamp;
+extern UINT8 *mCoffFile;
+extern UINT32 mTableOffset;
+extern UINT32 mOutImageType;
+extern UINT32 mFileBufferSize;
+
+//
+// Common EFI specific data.
+//
+#define ELF_HII_SECTION_NAME ".hii"
+#define ELF_STRTAB_SECTION_NAME ".strtab"
+#define MAX_COFF_ALIGNMENT 0x10000
+
+//
+// Filter Types
+//
+typedef enum {
+ SECTION_TEXT,
+ SECTION_HII,
+ SECTION_DATA
+
+} SECTION_FILTER_TYPES;
+
+//
+// FunctionTable
+//
+typedef struct {
+ VOID (*ScanSections) ();
+ BOOLEAN (*WriteSections) (SECTION_FILTER_TYPES FilterType);
+ VOID (*WriteRelocations) ();
+ VOID (*WriteDebug) ();
+ VOID (*SetImageSize) ();
+ VOID (*CleanUp) ();
+
+} ELF_FUNCTION_TABLE;
+
+//
+// Common functions
+//
+VOID
+CoffAddFixup (
+ UINT32 Offset,
+ UINT8 Type
+ );
+
+VOID
+CoffAddFixupEntry (
+ UINT16 Val
+ );
+
+
+VOID
+CreateSectionHeader (
+ const CHAR8 *Name,
+ UINT32 Offset,
+ UINT32 Size,
+ UINT32 Flags
+ );
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/GenFw/GNUmakefile b/roms/edk2/BaseTools/Source/C/GenFw/GNUmakefile
new file mode 100644
index 000000000..76cda7e7a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFw/GNUmakefile
@@ -0,0 +1,23 @@
+## @file
+# GNU/Linux makefile for 'GenFw' module build.
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+MAKEROOT ?= ..
+
+APPNAME = GenFw
+
+OBJECTS = GenFw.o ElfConvert.o Elf32Convert.o Elf64Convert.o
+
+include $(MAKEROOT)/Makefiles/app.makefile
+
+LIBS = -lCommon
+ifeq ($(CYGWIN), CYGWIN)
+ LIBS += -L/lib/e2fsprogs -luuid
+endif
+
+ifeq ($(LINUX), Linux)
+ LIBS += -luuid
+endif
+
diff --git a/roms/edk2/BaseTools/Source/C/GenFw/GenFw.c b/roms/edk2/BaseTools/Source/C/GenFw/GenFw.c
new file mode 100644
index 000000000..8cab70ba4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFw/GenFw.c
@@ -0,0 +1,3251 @@
+/** @file
+Converts a pe32+ image to an FW, Te image type, or other specific image.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "WinNtInclude.h"
+
+#ifndef __GNUC__
+#include <windows.h>
+#include <io.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <ctype.h>
+
+#include <Common/UefiBaseTypes.h>
+#include <IndustryStandard/PeImage.h>
+#include <Common/UefiInternalFormRepresentation.h>
+
+//
+// Acpi Table definition
+//
+#include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/Acpi1_0.h>
+#include <IndustryStandard/Acpi2_0.h>
+#include <IndustryStandard/Acpi3_0.h>
+#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
+
+#include "CommonLib.h"
+#include "PeCoffLib.h"
+#include "ParseInf.h"
+#include "EfiUtilityMsgs.h"
+
+#include "GenFw.h"
+
+//
+// Version of this utility
+//
+#define UTILITY_NAME "GenFw"
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 2
+
+#define HII_RESOURCE_SECTION_INDEX 1
+#define HII_RESOURCE_SECTION_NAME "HII"
+
+#define DEFAULT_MC_PAD_BYTE_VALUE 0xFF
+#define DEFAULT_MC_ALIGNMENT 16
+
+#define STATUS_IGNORE 0xA
+//
+// Structure definition for a microcode header
+//
+typedef struct {
+ UINT32 HeaderVersion;
+ UINT32 PatchId;
+ UINT32 Date;
+ UINT32 CpuId;
+ UINT32 Checksum;
+ UINT32 LoaderVersion;
+ UINT32 PlatformId;
+ UINT32 DataSize; // if 0, then TotalSize = 2048, and TotalSize field is invalid
+ UINT32 TotalSize; // number of bytes
+ UINT32 Reserved[3];
+} MICROCODE_IMAGE_HEADER;
+
+static EFI_GUID mZeroGuid = {0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
+
+static const char *gHiiPackageRCFileHeader[] = {
+ "//",
+ "// DO NOT EDIT -- auto-generated file",
+ "//",
+ NULL
+};
+
+//
+// Module image information
+//
+CHAR8 *mInImageName;
+UINT32 mImageTimeStamp = 0;
+UINT32 mImageSize = 0;
+UINT32 mOutImageType = FW_DUMMY_IMAGE;
+BOOLEAN mIsConvertXip = FALSE;
+
+
+STATIC
+EFI_STATUS
+ZeroDebugData (
+ IN OUT UINT8 *FileBuffer,
+ BOOLEAN ZeroDebug
+ );
+
+STATIC
+EFI_STATUS
+SetStamp (
+ IN OUT UINT8 *FileBuffer,
+ IN CHAR8 *TimeStamp
+ );
+
+STATIC
+STATUS
+MicrocodeReadData (
+ FILE *InFptr,
+ UINT32 *Data
+ );
+
+STATIC
+VOID
+Version (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Print out version information for this utility.
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
+}
+
+STATIC
+VOID
+Usage (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Print Help message.
+
+Arguments:
+
+ VOID
+
+Returns:
+
+ None
+
+--*/
+{
+ //
+ // Summary usage
+ //
+ fprintf (stdout, "\nUsage: %s [options] <input_file>\n\n", UTILITY_NAME);
+
+ //
+ // Copyright declaration
+ //
+ fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
+
+ //
+ // Details Option
+ //
+ fprintf (stdout, "Options:\n");
+ fprintf (stdout, " -o FileName, --outputfile FileName\n\
+ File will be created to store the output content.\n");
+ fprintf (stdout, " -e EFI_FILETYPE, --efiImage EFI_FILETYPE\n\
+ Create Efi Image. EFI_FILETYPE is one of BASE,SMM_CORE,\n\
+ PEI_CORE, PEIM, DXE_CORE, DXE_DRIVER, UEFI_APPLICATION,\n\
+ SEC, DXE_SAL_DRIVER, UEFI_DRIVER, DXE_RUNTIME_DRIVER,\n\
+ DXE_SMM_DRIVER, SECURITY_CORE, COMBINED_PEIM_DRIVER,\n\
+ MM_STANDALONE, MM_CORE_STANDALONE,\n\
+ PIC_PEIM, RELOCATABLE_PEIM, BS_DRIVER, RT_DRIVER,\n\
+ APPLICATION, SAL_RT_DRIVER to support all module types\n\
+ It can only be used together with --keepexceptiontable,\n\
+ --keepzeropending, --keepoptionalheader, -r, -o option.\n\
+ It is a action option. If it is combined with other action options,\n\
+ the later input action option will override the previous one.\n");
+ fprintf (stdout, " -c, --acpi Create Acpi table.\n\
+ It can't be combined with other action options\n\
+ except for -o, -r option. It is a action option.\n\
+ If it is combined with other action options, the later\n\
+ input action option will override the previous one.\n");
+ fprintf (stdout, " -t, --terse Create Te Image.\n\
+ It can only be used together with --keepexceptiontable,\n\
+ --keepzeropending, --keepoptionalheader, -r, -o option.\n\
+ It is a action option. If it is combined with other action options,\n\
+ the later input action option will override the previous one.\n");
+ fprintf (stdout, " -u, --dump Dump TeImage Header.\n\
+ It can't be combined with other action options\n\
+ except for -o, -r option. It is a action option.\n\
+ If it is combined with other action options, the later\n\
+ input action option will override the previous one.\n");
+ fprintf (stdout, " -z, --zero Zero the Debug Data Fields in the PE input image file.\n\
+ It also zeros the time stamp fields.\n\
+ This option can be used to compare the binary efi image.\n\
+ It can't be combined with other action options\n\
+ except for -o, -r option. It is a action option.\n\
+ If it is combined with other action options, the later\n\
+ input action option will override the previous one.\n");
+ fprintf (stdout, " -b, --exe2bin Convert the input EXE to the output BIN file.\n\
+ It can't be combined with other action options\n\
+ except for -o, -r option. It is a action option.\n\
+ If it is combined with other action options, the later\n\
+ input action option will override the previous one.\n");;
+ fprintf (stdout, " -l, --stripped Strip off the relocation info from PE or TE image.\n\
+ It can't be combined with other action options\n\
+ except for -o, -r option. It is a action option.\n\
+ If it is combined with other action options, the later\n\
+ input action option will override the previous one.\n");
+ fprintf (stdout, " -s timedate, --stamp timedate\n\
+ timedate format is \"yyyy-mm-dd 00:00:00\". if timedata \n\
+ is set to NOW, current system time is used. The support\n\
+ date scope is 1970-01-01 00+timezone:00:00\n\
+ ~ 2038-01-19 03+timezone:14:07\n\
+ The scope is adjusted according to the different zones.\n\
+ It can't be combined with other action options\n\
+ except for -o, -r option. It is a action option.\n\
+ If it is combined with other action options, the later\n\
+ input action option will override the previous one.\n");
+ fprintf (stdout, " -m, --mcifile Convert input microcode txt file to microcode bin file.\n\
+ It can't be combined with other action options\n\
+ except for -o option. It is a action option.\n\
+ If it is combined with other action options, the later\n\
+ input action option will override the previous one.\n");
+ fprintf (stdout, " -j, --join Combine multi microcode bin files to one file.\n\
+ It can be specified with -a, -p, -o option.\n\
+ No other options can be combined with it.\n\
+ If it is combined with other action options, the later\n\
+ input action option will override the previous one.\n");
+ fprintf (stdout, " -a NUM, --align NUM NUM is one HEX or DEC format alignment value.\n\
+ This option is only used together with -j option.\n");
+ fprintf (stdout, " -p NUM, --pad NUM NUM is one HEX or DEC format padding value.\n\
+ This option is only used together with -j option.\n");
+ fprintf (stdout, " --keepexceptiontable Don't clear exception table.\n\
+ This option can be used together with -e or -t.\n\
+ It doesn't work for other options.\n");
+ fprintf (stdout, " --keepoptionalheader Don't zero PE/COFF optional header fields.\n\
+ This option can be used together with -e or -t.\n\
+ It doesn't work for other options.\n");
+ fprintf (stdout, " --keepzeropending Don't strip zero pending of .reloc.\n\
+ This option can be used together with -e or -t.\n\
+ It doesn't work for other options.\n");
+ fprintf (stdout, " -r, --replace Overwrite the input file with the output content.\n\
+ If more input files are specified,\n\
+ the last input file will be as the output file.\n");
+ fprintf (stdout, " -g HiiPackageListGuid, --hiiguid HiiPackageListGuid\n\
+ Guid is used to specify hii package list guid.\n\
+ Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n\
+ If not specified, the first Form FormSet guid is used.\n");
+ fprintf (stdout, " --hiipackage Combine all input binary hii packages into \n\
+ a single package list as the text resource data(RC).\n\
+ It can't be combined with other action options\n\
+ except for -o option. It is a action option.\n\
+ If it is combined with other action options, the later\n\
+ input action option will override the previous one.\n");
+ fprintf (stdout, " --hiibinpackage Combine all input binary hii packages into \n\
+ a single package list as the binary resource section.\n\
+ It can't be combined with other action options\n\
+ except for -o option. It is a action option.\n\
+ If it is combined with other action options, the later\n\
+ input action option will override the previous one.\n");
+ fprintf (stdout, " --rebase NewAddress Rebase image to new base address. New address \n\
+ is also set to the first none code section header.\n\
+ It can't be combined with other action options\n\
+ except for -o or -r option. It is a action option.\n\
+ If it is combined with other action options, the later\n\
+ input action option will override the previous one.\n");
+ fprintf (stdout, " --address NewAddress Set new address into the first none code \n\
+ section header of the input image.\n\
+ It can't be combined with other action options\n\
+ except for -o or -r option. It is a action option.\n\
+ If it is combined with other action options, the later\n\
+ input action option will override the previous one.\n");
+ fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n");
+ fprintf (stdout, " -q, --quiet Disable all messages except key message and fatal error\n");
+ fprintf (stdout, " -d, --debug level Enable debug messages, at input debug level.\n");
+ fprintf (stdout, " --version Show program's version number and exit\n");
+ fprintf (stdout, " -h, --help Show this help message and exit\n");
+}
+
+STATIC
+STATUS
+CheckAcpiTable (
+ VOID *AcpiTable,
+ UINT32 Length
+ )
+/*++
+
+Routine Description:
+
+ Check Acpi Table
+
+Arguments:
+
+ AcpiTable Buffer for AcpiSection
+ Length AcpiSection Length
+
+Returns:
+
+ 0 success
+ non-zero otherwise
+
+--*/
+{
+ EFI_ACPI_DESCRIPTION_HEADER *AcpiHeader;
+ EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs;
+ UINT32 ExpectedLength;
+
+ AcpiHeader = (EFI_ACPI_DESCRIPTION_HEADER *)AcpiTable;
+
+ //
+ // Generic check for AcpiTable length.
+ //
+ if (AcpiHeader->Length > Length) {
+ Error (NULL, 0, 3000, "Invalid", "AcpiTable length check failed.", NULL);
+ return STATUS_ERROR;
+ }
+
+ //
+ // Currently, we only check must-have tables: FADT, FACS, DSDT,
+ // and some important tables: MADT, MCFG.
+ //
+ switch (AcpiHeader->Signature) {
+
+ //
+ // "FACP" Fixed ACPI Description Table
+ //
+ case EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE:
+ switch (AcpiHeader->Revision) {
+ case EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION:
+ ExpectedLength = sizeof(EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE);
+ break;
+ case EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION:
+ ExpectedLength = sizeof(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE);
+ break;
+ case EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION:
+ ExpectedLength = sizeof(EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE);
+ break;
+ default:
+ if (AcpiHeader->Revision > EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
+ ExpectedLength = AcpiHeader->Length;
+ break;
+ }
+ Error (NULL, 0, 3000, "Invalid", "FACP revision check failed.");
+ return STATUS_ERROR;
+ }
+ if (ExpectedLength != AcpiHeader->Length) {
+ Error (NULL, 0, 3000, "Invalid", "FACP length check failed.");
+ return STATUS_ERROR;
+ }
+ break;
+
+ //
+ // "FACS" Firmware ACPI Control Structure
+ //
+ case EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE:
+ Facs = (EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)AcpiTable;
+ if (Facs->Version > EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) {
+ break;
+ }
+ if ((Facs->Version != EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
+ (Facs->Version != EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
+ (Facs->Version != EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION)){
+ Error (NULL, 0, 3000, "Invalid", "FACS version check failed.");
+ return STATUS_ERROR;
+ }
+ if ((Facs->Length != sizeof(EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE)) &&
+ (Facs->Length != sizeof(EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE)) &&
+ (Facs->Length != sizeof(EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE))) {
+ Error (NULL, 0, 3000, "Invalid", "FACS length check failed.");
+ return STATUS_ERROR;
+ }
+ break;
+
+ //
+ // "DSDT" Differentiated System Description Table
+ //
+ case EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE:
+ if (AcpiHeader->Revision > EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_REVISION) {
+ break;
+ }
+ if (AcpiHeader->Length <= sizeof(EFI_ACPI_DESCRIPTION_HEADER)) {
+ Error (NULL, 0, 3000, "Invalid", "DSDT length check failed.");
+ return STATUS_ERROR;
+ }
+ break;
+
+ //
+ // "APIC" Multiple APIC Description Table
+ //
+ case EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE:
+ if (AcpiHeader->Revision > EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) {
+ break;
+ }
+ if ((AcpiHeader->Revision != EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) &&
+ (AcpiHeader->Revision != EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) &&
+ (AcpiHeader->Revision != EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION)) {
+ Error (NULL, 0, 3000, "Invalid", "APIC revision check failed.");
+ return STATUS_ERROR;
+ }
+ if (AcpiHeader->Length <= sizeof(EFI_ACPI_DESCRIPTION_HEADER) + sizeof(UINT32) + sizeof(UINT32)) {
+ Error (NULL, 0, 3000, "Invalid", "APIC length check failed.");
+ return STATUS_ERROR;
+ }
+ break;
+
+ //
+ // "MCFG" PCI Express Memory Mapped Configuration Space Base Address Description Table
+ //
+ case EFI_ACPI_3_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE:
+ if (AcpiHeader->Revision > EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION) {
+ break;
+ }
+ if (AcpiHeader->Revision != EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION) {
+ Error (NULL, 0, 3000, "Invalid", "MCFG revision check failed.");
+ return STATUS_ERROR;
+ }
+ if (AcpiHeader->Length <= sizeof(EFI_ACPI_DESCRIPTION_HEADER) + sizeof(UINT64)) {
+ Error (NULL, 0, 3000, "Invalid", "MCFG length check failed.");
+ return STATUS_ERROR;
+ }
+ break;
+
+ //
+ // Other table pass check
+ //
+ default:
+ break;
+ }
+
+ return STATUS_SUCCESS;
+}
+
+VOID
+SetHiiResourceHeader (
+ UINT8 *HiiBinData,
+ UINT32 OffsetToFile
+ )
+{
+ UINT32 Index;
+ EFI_IMAGE_RESOURCE_DIRECTORY *ResourceDirectory;
+ EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *ResourceDirectoryEntry;
+ EFI_IMAGE_RESOURCE_DIRECTORY_STRING *ResourceDirectoryString;
+ EFI_IMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry;
+
+ //
+ // Fill Resource section entry
+ //
+ ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (HiiBinData);
+ ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);
+ for (Index = 0; Index < ResourceDirectory->NumberOfNamedEntries; Index ++) {
+ if (ResourceDirectoryEntry->u1.s.NameIsString) {
+ ResourceDirectoryString = (EFI_IMAGE_RESOURCE_DIRECTORY_STRING *) (HiiBinData + ResourceDirectoryEntry->u1.s.NameOffset);
+
+ if (ResourceDirectoryString->Length == 3 &&
+ ResourceDirectoryString->String[0] == L'H' &&
+ ResourceDirectoryString->String[1] == L'I' &&
+ ResourceDirectoryString->String[2] == L'I') {
+ //
+ // Resource Type "HII" found
+ //
+ if (ResourceDirectoryEntry->u2.s.DataIsDirectory) {
+ //
+ // Move to next level - resource Name
+ //
+ ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (HiiBinData + ResourceDirectoryEntry->u2.s.OffsetToDirectory);
+ ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);
+
+ if (ResourceDirectoryEntry->u2.s.DataIsDirectory) {
+ //
+ // Move to next level - resource Language
+ //
+ ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (HiiBinData + ResourceDirectoryEntry->u2.s.OffsetToDirectory);
+ ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);
+ }
+ }
+
+ //
+ // Now it ought to be resource Data and update its OffsetToData value
+ //
+ if (!ResourceDirectoryEntry->u2.s.DataIsDirectory) {
+ ResourceDataEntry = (EFI_IMAGE_RESOURCE_DATA_ENTRY *) (HiiBinData + ResourceDirectoryEntry->u2.OffsetToData);
+ ResourceDataEntry->OffsetToData = ResourceDataEntry->OffsetToData + OffsetToFile;
+ break;
+ }
+ }
+ }
+ ResourceDirectoryEntry++;
+ }
+
+ return;
+}
+
+EFI_IMAGE_OPTIONAL_HEADER_UNION *
+GetPeCoffHeader (
+ void *Data
+ )
+{
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *PeHdr;
+
+ //
+ // Read the dos & pe hdrs of the image
+ //
+ DosHdr = (EFI_IMAGE_DOS_HEADER *)Data;
+ if (DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
+ // NO DOS header, check for PE/COFF header
+ PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(Data);
+ if (PeHdr->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
+ return NULL;
+ }
+ } else {
+
+ PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(((UINT8 *)Data) + DosHdr->e_lfanew);
+ if (PeHdr->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
+ return NULL;
+ }
+ }
+
+ return PeHdr;
+}
+
+void
+PeCoffConvertImageToXip (
+ UINT8 **FileBuffer,
+ UINT32 *FileLength
+ )
+{
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *PeHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *NewPeHdr;
+ EFI_IMAGE_SECTION_HEADER *SectionHeader;
+ UINTN TotalNecessaryFileSize;
+ UINTN SectionSize;
+ UINT8 *XipFile;
+ UINT32 XipLength;
+ UINTN Index;
+ UINTN FirstSectionOffset;
+ BOOLEAN ConversionNeeded;
+
+ PeHdr = GetPeCoffHeader ((void *) *FileBuffer);
+ if (PeHdr == NULL) {
+ return;
+ }
+
+ if (PeHdr->Pe32.OptionalHeader.SectionAlignment != PeHdr->Pe32.OptionalHeader.FileAlignment) {
+ //
+ // The only reason to expand zero fill sections is to make them compatible with XIP images.
+ // If SectionAlignment is not equal to FileAlignment then it is not an XIP type image.
+ //
+ return;
+ }
+
+ //
+ // Calculate size of XIP file, and determine if the conversion is needed.
+ //
+ ConversionNeeded = FALSE;
+ XipLength = 0;
+ FirstSectionOffset = *FileLength;
+ TotalNecessaryFileSize = 0;
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader);
+ for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
+ SectionSize = MAX (SectionHeader->Misc.VirtualSize, SectionHeader->SizeOfRawData);
+ TotalNecessaryFileSize += SectionSize;
+ if (SectionSize > 0) {
+ FirstSectionOffset = MIN (FirstSectionOffset, SectionHeader->VirtualAddress);
+ XipLength = MAX (XipLength, SectionHeader->VirtualAddress + SectionSize);
+ if (SectionHeader->VirtualAddress != SectionHeader->PointerToRawData) {
+ ConversionNeeded = TRUE;
+ }
+ }
+ if (SectionHeader->Misc.VirtualSize > SectionHeader->SizeOfRawData) {
+ ConversionNeeded = TRUE;
+ }
+ }
+
+ if (FirstSectionOffset < PeHdr->Pe32.OptionalHeader.SizeOfHeaders) {
+ //
+ // If one of the sections should be loaded to an offset overlapping with
+ // the executable header, then it cannot be made into an XIP image.
+ //
+ VerboseMsg ("PE/COFF conversion to XIP is impossible due to overlap");
+ VerboseMsg ("of section data with the executable header.");
+ return;
+ }
+
+ if (FirstSectionOffset == *FileLength) {
+ //
+ // If we never found a section with a non-zero size, then we
+ // skip the conversion.
+ //
+ return;
+ }
+
+ TotalNecessaryFileSize += FirstSectionOffset;
+
+ if (!ConversionNeeded) {
+ return;
+ }
+
+ if (XipLength > (2 * TotalNecessaryFileSize)) {
+ VerboseMsg ("PE/COFF conversion to XIP appears to be larger than necessary.");
+ VerboseMsg ("The image linking process may have left unused memory ranges.");
+ }
+
+ if (PeHdr->Pe32.FileHeader.PointerToSymbolTable != 0) {
+ //
+ // This field is obsolete and should be zero
+ //
+ PeHdr->Pe32.FileHeader.PointerToSymbolTable = 0;
+ }
+
+ //
+ // Allocate the extra space that we need to grow the image
+ //
+ XipFile = malloc (XipLength);
+ if (XipFile == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return;
+ }
+ memset (XipFile, 0, XipLength);
+
+ //
+ // Copy the file headers
+ //
+ memcpy (XipFile, *FileBuffer, PeHdr->Pe32.OptionalHeader.SizeOfHeaders);
+
+ NewPeHdr = GetPeCoffHeader ((void *)XipFile);
+ if (NewPeHdr == NULL) {
+ free (XipFile);
+ return;
+ }
+
+ //
+ // Copy the section data over to the appropriate XIP offsets
+ //
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(NewPeHdr->Pe32.OptionalHeader) + NewPeHdr->Pe32.FileHeader.SizeOfOptionalHeader);
+ for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
+ if (SectionHeader->SizeOfRawData > 0) {
+ memcpy (
+ XipFile + SectionHeader->VirtualAddress,
+ *FileBuffer + SectionHeader->PointerToRawData,
+ SectionHeader->SizeOfRawData
+ );
+ }
+ //
+ // Make the size of raw data in section header alignment.
+ //
+ SectionSize = (SectionHeader->Misc.VirtualSize + PeHdr->Pe32.OptionalHeader.FileAlignment - 1) & (~(PeHdr->Pe32.OptionalHeader.FileAlignment - 1));
+ if (SectionSize < SectionHeader->SizeOfRawData) {
+ SectionHeader->SizeOfRawData = SectionSize;
+ }
+
+ SectionHeader->PointerToRawData = SectionHeader->VirtualAddress;
+ }
+
+ free (*FileBuffer);
+ *FileLength = XipLength;
+ *FileBuffer = XipFile;
+
+ mIsConvertXip = TRUE;
+}
+
+UINT8 *
+CreateHiiResouceSectionHeader (
+ UINT32 *pSectionHeaderSize,
+ UINT32 HiiDataSize
+ )
+/*++
+
+Routine Description:
+
+ Create COFF resource section header
+
+Arguments:
+
+ pSectionHeaderSize - Pointer to section header size.
+ HiiDataSize - Size of the total HII data in section.
+
+Returns:
+ The created section header buffer.
+
+--*/
+{
+ UINT32 HiiSectionHeaderSize;
+ UINT32 HiiSectionOffset;
+ UINT8 *HiiSectionHeader;
+ EFI_IMAGE_RESOURCE_DIRECTORY *ResourceDirectory;
+ EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *TypeResourceDirectoryEntry;
+ EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *NameResourceDirectoryEntry;
+ EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *LanguageResourceDirectoryEntry;
+ EFI_IMAGE_RESOURCE_DIRECTORY_STRING *ResourceDirectoryString;
+ EFI_IMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry;
+
+ //
+ // Calculate the total size for the resource header (include Type, Name and Language)
+ // then allocate memory for the resource header.
+ //
+ HiiSectionHeaderSize = 3 * (sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY))
+ + 3 * (sizeof (UINT16) + 3 * sizeof (CHAR16))
+ + sizeof (EFI_IMAGE_RESOURCE_DATA_ENTRY);
+ HiiSectionHeader = malloc (HiiSectionHeaderSize);
+ if (HiiSectionHeader == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return NULL;
+ }
+ memset (HiiSectionHeader, 0, HiiSectionHeaderSize);
+
+ HiiSectionOffset = 0;
+ //
+ // Create Type entry
+ //
+ ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (HiiSectionHeader + HiiSectionOffset);
+ HiiSectionOffset += sizeof (EFI_IMAGE_RESOURCE_DIRECTORY);
+ ResourceDirectory->NumberOfNamedEntries = 1;
+ TypeResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (HiiSectionHeader + HiiSectionOffset);
+ HiiSectionOffset += sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY);
+ TypeResourceDirectoryEntry->u1.s.NameIsString = 1;
+ TypeResourceDirectoryEntry->u2.s.DataIsDirectory = 1;
+ TypeResourceDirectoryEntry->u2.s.OffsetToDirectory = HiiSectionOffset;
+ //
+ // Create Name entry
+ //
+ ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (HiiSectionHeader + HiiSectionOffset);
+ HiiSectionOffset += sizeof (EFI_IMAGE_RESOURCE_DIRECTORY);
+ ResourceDirectory->NumberOfNamedEntries = 1;
+ NameResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (HiiSectionHeader + HiiSectionOffset);
+ HiiSectionOffset += sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY);
+ NameResourceDirectoryEntry->u1.s.NameIsString = 1;
+ NameResourceDirectoryEntry->u2.s.DataIsDirectory = 1;
+ NameResourceDirectoryEntry->u2.s.OffsetToDirectory = HiiSectionOffset;
+ //
+ // Create Language entry
+ //
+ ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (HiiSectionHeader + HiiSectionOffset);
+ HiiSectionOffset += sizeof (EFI_IMAGE_RESOURCE_DIRECTORY);
+ ResourceDirectory->NumberOfNamedEntries = 1;
+ LanguageResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (HiiSectionHeader + HiiSectionOffset);
+ HiiSectionOffset += sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY);
+ LanguageResourceDirectoryEntry->u1.s.NameIsString = 1;
+ //
+ // Create string entry for Type
+ //
+ TypeResourceDirectoryEntry->u1.s.NameOffset = HiiSectionOffset;
+ ResourceDirectoryString = (EFI_IMAGE_RESOURCE_DIRECTORY_STRING *) (HiiSectionHeader + HiiSectionOffset);
+ ResourceDirectoryString->Length = 3;
+ ResourceDirectoryString->String[0] = L'H';
+ ResourceDirectoryString->String[1] = L'I';
+ ResourceDirectoryString->String[2] = L'I';
+ HiiSectionOffset = HiiSectionOffset + sizeof (ResourceDirectoryString->Length) + ResourceDirectoryString->Length * sizeof (ResourceDirectoryString->String[0]);
+ //
+ // Create string entry for Name
+ //
+ NameResourceDirectoryEntry->u1.s.NameOffset = HiiSectionOffset;
+ ResourceDirectoryString = (EFI_IMAGE_RESOURCE_DIRECTORY_STRING *) (HiiSectionHeader + HiiSectionOffset);
+ ResourceDirectoryString->Length = 3;
+ ResourceDirectoryString->String[0] = L'E';
+ ResourceDirectoryString->String[1] = L'F';
+ ResourceDirectoryString->String[2] = L'I';
+ HiiSectionOffset = HiiSectionOffset + sizeof (ResourceDirectoryString->Length) + ResourceDirectoryString->Length * sizeof (ResourceDirectoryString->String[0]);
+ //
+ // Create string entry for Language
+ //
+ LanguageResourceDirectoryEntry->u1.s.NameOffset = HiiSectionOffset;
+ ResourceDirectoryString = (EFI_IMAGE_RESOURCE_DIRECTORY_STRING *) (HiiSectionHeader + HiiSectionOffset);
+ ResourceDirectoryString->Length = 3;
+ ResourceDirectoryString->String[0] = L'B';
+ ResourceDirectoryString->String[1] = L'I';
+ ResourceDirectoryString->String[2] = L'N';
+ HiiSectionOffset = HiiSectionOffset + sizeof (ResourceDirectoryString->Length) + ResourceDirectoryString->Length * sizeof (ResourceDirectoryString->String[0]);
+ //
+ // Create Leaf data
+ //
+ LanguageResourceDirectoryEntry->u2.OffsetToData = HiiSectionOffset;
+ ResourceDataEntry = (EFI_IMAGE_RESOURCE_DATA_ENTRY *) (HiiSectionHeader + HiiSectionOffset);
+ HiiSectionOffset += sizeof (EFI_IMAGE_RESOURCE_DATA_ENTRY);
+ ResourceDataEntry->OffsetToData = HiiSectionOffset;
+ ResourceDataEntry->Size = HiiDataSize;
+
+ *pSectionHeaderSize = HiiSectionHeaderSize;
+ return HiiSectionHeader;
+}
+
+EFI_STATUS
+RebaseImageRead (
+ IN VOID *FileHandle,
+ IN UINTN FileOffset,
+ IN OUT UINT32 *ReadSize,
+ OUT VOID *Buffer
+ )
+/*++
+
+Routine Description:
+
+ Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
+
+Arguments:
+
+ FileHandle - The handle to the PE/COFF file
+
+ FileOffset - The offset, in bytes, into the file to read
+
+ ReadSize - The number of bytes to read from the file starting at FileOffset
+
+ Buffer - A pointer to the buffer to read the data into.
+
+Returns:
+
+ EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
+
+--*/
+{
+ CHAR8 *Destination8;
+ CHAR8 *Source8;
+ UINT32 Length;
+
+ Destination8 = Buffer;
+ Source8 = (CHAR8 *) ((UINTN) FileHandle + FileOffset);
+ Length = *ReadSize;
+ while (Length--) {
+ *(Destination8++) = *(Source8++);
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+SetAddressToSectionHeader (
+ IN CHAR8 *FileName,
+ IN OUT UINT8 *FileBuffer,
+ IN UINT64 NewPe32BaseAddress
+ )
+/*++
+
+Routine Description:
+
+ Set new base address into the section header of PeImage
+
+Arguments:
+
+ FileName - Name of file
+ FileBuffer - Pointer to PeImage.
+ NewPe32BaseAddress - New Base Address for PE image.
+
+Returns:
+
+ EFI_SUCCESS Set new base address into this image successfully.
+
+--*/
+{
+ EFI_STATUS Status;
+ PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
+ UINTN Index;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
+ EFI_IMAGE_SECTION_HEADER *SectionHeader;
+
+ //
+ // Initialize context
+ //
+ memset (&ImageContext, 0, sizeof (ImageContext));
+ ImageContext.Handle = (VOID *) FileBuffer;
+ ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) RebaseImageRead;
+ Status = PeCoffLoaderGetImageInfo (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "The input PeImage %s is not valid", FileName);
+ return Status;
+ }
+
+ if (ImageContext.RelocationsStripped) {
+ Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
+ return Status;
+ }
+
+ //
+ // Get PeHeader pointer
+ //
+ ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(FileBuffer + ImageContext.PeCoffHeaderOffset);
+
+ //
+ // Get section header list
+ //
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
+ (UINTN) ImgHdr +
+ sizeof (UINT32) +
+ sizeof (EFI_IMAGE_FILE_HEADER) +
+ ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
+ );
+
+ //
+ // Set base address into the first section header that doesn't point to code section.
+ //
+ for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
+ if ((SectionHeader->Characteristics & EFI_IMAGE_SCN_CNT_CODE) == 0) {
+ *(UINT64 *) &SectionHeader->PointerToRelocations = NewPe32BaseAddress;
+ break;
+ }
+ }
+
+ //
+ // BaseAddress is set to section header.
+ //
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+RebaseImage (
+ IN CHAR8 *FileName,
+ IN OUT UINT8 *FileBuffer,
+ IN UINT64 NewPe32BaseAddress
+ )
+/*++
+
+Routine Description:
+
+ Set new base address into PeImage, and fix up PeImage based on new address.
+
+Arguments:
+
+ FileName - Name of file
+ FileBuffer - Pointer to PeImage.
+ NewPe32BaseAddress - New Base Address for PE image.
+
+Returns:
+
+ EFI_INVALID_PARAMETER - BaseAddress is not valid.
+ EFI_SUCCESS - Update PeImage is correctly.
+
+--*/
+{
+ EFI_STATUS Status;
+ PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
+ UINTN Index;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
+ UINT8 *MemoryImagePointer;
+ EFI_IMAGE_SECTION_HEADER *SectionHeader;
+
+ //
+ // Initialize context
+ //
+ memset (&ImageContext, 0, sizeof (ImageContext));
+ ImageContext.Handle = (VOID *) FileBuffer;
+ ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) RebaseImageRead;
+ Status = PeCoffLoaderGetImageInfo (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "The input PeImage %s is not valid", FileName);
+ return Status;
+ }
+
+ if (ImageContext.RelocationsStripped) {
+ Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
+ return Status;
+ }
+
+ //
+ // Get PeHeader pointer
+ //
+ ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(FileBuffer + ImageContext.PeCoffHeaderOffset);
+
+ //
+ // Load and Relocate Image Data
+ //
+ MemoryImagePointer = (UINT8 *) malloc ((UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
+ if (MemoryImagePointer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ memset ((VOID *) MemoryImagePointer, 0, (UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
+ ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~((INT64)ImageContext.SectionAlignment - 1));
+
+ Status = PeCoffLoaderLoadImage (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "LocateImage() call failed on rebase of %s", FileName);
+ free ((VOID *) MemoryImagePointer);
+ return Status;
+ }
+
+ ImageContext.DestinationAddress = NewPe32BaseAddress;
+ Status = PeCoffLoaderRelocateImage (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "RelocateImage() call failed on rebase of %s", FileName);
+ free ((VOID *) MemoryImagePointer);
+ return Status;
+ }
+
+ //
+ // Copy Relocated data to raw image file.
+ //
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
+ (UINTN) ImgHdr +
+ sizeof (UINT32) +
+ sizeof (EFI_IMAGE_FILE_HEADER) +
+ ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
+ );
+
+ for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
+ CopyMem (
+ FileBuffer + SectionHeader->PointerToRawData,
+ (VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
+ SectionHeader->SizeOfRawData < SectionHeader->Misc.VirtualSize ? SectionHeader->SizeOfRawData : SectionHeader->Misc.VirtualSize
+ );
+ }
+
+ free ((VOID *) MemoryImagePointer);
+
+ //
+ // Update Image Base Address
+ //
+ if (ImgHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ ImgHdr->Pe32.OptionalHeader.ImageBase = (UINT32) NewPe32BaseAddress;
+ } else if (ImgHdr->Pe32Plus.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
+ ImgHdr->Pe32Plus.OptionalHeader.ImageBase = NewPe32BaseAddress;
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "unknown PE magic signature %X in PE32 image %s",
+ ImgHdr->Pe32.OptionalHeader.Magic,
+ FileName
+ );
+ return EFI_ABORTED;
+ }
+
+ //
+ // Set new base address into section header
+ //
+ Status = SetAddressToSectionHeader (FileName, FileBuffer, NewPe32BaseAddress);
+
+ return Status;
+}
+
+int
+main (
+ int argc,
+ char *argv[]
+ )
+/*++
+
+Routine Description:
+
+ Main function.
+
+Arguments:
+
+ argc - Number of command line parameters.
+ argv - Array of pointers to command line parameter strings.
+
+Returns:
+ STATUS_SUCCESS - Utility exits successfully.
+ STATUS_ERROR - Some error occurred during execution.
+
+--*/
+{
+ UINT32 Type;
+ UINT32 InputFileNum;
+ CHAR8 **InputFileName;
+ char *OutImageName;
+ char *ModuleType;
+ CHAR8 *TimeStamp;
+ FILE *fpIn;
+ FILE *fpOut;
+ FILE *fpInOut;
+ UINT32 Data;
+ UINT32 *DataPointer;
+ UINT32 *OldDataPointer;
+ UINT32 CheckSum;
+ UINT32 Index;
+ UINT32 Index1;
+ UINT32 Index2;
+ UINT64 Temp64;
+ UINT32 MciAlignment;
+ UINT8 MciPadValue;
+ UINT32 AllignedRelocSize;
+ UINT8 *FileBuffer;
+ UINT32 FileLength;
+ UINT8 *OutputFileBuffer;
+ UINT32 OutputFileLength;
+ UINT8 *InputFileBuffer;
+ UINT32 InputFileLength;
+ RUNTIME_FUNCTION *RuntimeFunction;
+ UNWIND_INFO *UnwindInfo;
+ STATUS Status;
+ BOOLEAN ReplaceFlag;
+ BOOLEAN KeepExceptionTableFlag;
+ BOOLEAN KeepOptionalHeaderFlag;
+ BOOLEAN KeepZeroPendingFlag;
+ UINT64 LogLevel;
+ EFI_TE_IMAGE_HEADER TEImageHeader;
+ EFI_TE_IMAGE_HEADER *TeHdr;
+ EFI_IMAGE_SECTION_HEADER *SectionHeader;
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *PeHdr;
+ EFI_IMAGE_OPTIONAL_HEADER32 *Optional32;
+ EFI_IMAGE_OPTIONAL_HEADER64 *Optional64;
+ EFI_IMAGE_DOS_HEADER BackupDosHdr;
+ MICROCODE_IMAGE_HEADER *MciHeader;
+ UINT8 *HiiPackageListBuffer;
+ UINT8 *HiiPackageDataPointer;
+ EFI_GUID HiiPackageListGuid;
+ EFI_HII_PACKAGE_LIST_HEADER HiiPackageListHeader;
+ EFI_HII_PACKAGE_HEADER HiiPackageHeader;
+ EFI_IFR_FORM_SET IfrFormSet;
+ UINT8 NumberOfFormPackage;
+ EFI_HII_PACKAGE_HEADER EndPackage;
+ UINT32 HiiSectionHeaderSize;
+ UINT8 *HiiSectionHeader;
+ UINT64 NewBaseAddress;
+ BOOLEAN NegativeAddr;
+ FILE *ReportFile;
+ CHAR8 *ReportFileName;
+ UINTN FileLen;
+ time_t InputFileTime;
+ time_t OutputFileTime;
+ struct stat Stat_Buf;
+ BOOLEAN ZeroDebugFlag;
+
+ SetUtilityName (UTILITY_NAME);
+
+ //
+ // Assign to fix compile warning
+ //
+ FileLen = 0;
+ InputFileNum = 0;
+ InputFileName = NULL;
+ mInImageName = NULL;
+ OutImageName = NULL;
+ ModuleType = NULL;
+ Type = 0;
+ Status = STATUS_SUCCESS;
+ FileBuffer = NULL;
+ fpIn = NULL;
+ fpOut = NULL;
+ fpInOut = NULL;
+ TimeStamp = NULL;
+ MciAlignment = DEFAULT_MC_ALIGNMENT;
+ MciPadValue = DEFAULT_MC_PAD_BYTE_VALUE;
+ FileLength = 0;
+ MciHeader = NULL;
+ CheckSum = 0;
+ ReplaceFlag = FALSE;
+ LogLevel = 0;
+ OutputFileBuffer = NULL;
+ OutputFileLength = 0;
+ InputFileBuffer = NULL;
+ InputFileLength = 0;
+ Optional32 = NULL;
+ Optional64 = NULL;
+ KeepExceptionTableFlag = FALSE;
+ KeepOptionalHeaderFlag = FALSE;
+ KeepZeroPendingFlag = FALSE;
+ NumberOfFormPackage = 0;
+ HiiPackageListBuffer = NULL;
+ HiiPackageDataPointer = NULL;
+ EndPackage.Length = sizeof (EFI_HII_PACKAGE_HEADER);
+ EndPackage.Type = EFI_HII_PACKAGE_END;
+ memset (&HiiPackageListGuid, 0, sizeof (HiiPackageListGuid));
+ HiiSectionHeaderSize = 0;
+ HiiSectionHeader = NULL;
+ NewBaseAddress = 0;
+ NegativeAddr = FALSE;
+ InputFileTime = 0;
+ OutputFileTime = 0;
+ ZeroDebugFlag = FALSE;
+
+ if (argc == 1) {
+ Error (NULL, 0, 1001, "Missing options", "No input options.");
+ Usage ();
+ return STATUS_ERROR;
+ }
+
+ argc --;
+ argv ++;
+
+ if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
+ Version ();
+ Usage ();
+ return STATUS_SUCCESS;
+ }
+
+ if (stricmp (argv[0], "--version") == 0) {
+ Version ();
+ return STATUS_SUCCESS;
+ }
+
+ while (argc > 0) {
+ if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
+ if (argv[1] == NULL || argv[1][0] == '-') {
+ Error (NULL, 0, 1003, "Invalid option value", "Output file name is missing for -o option");
+ goto Finish;
+ }
+ OutImageName = argv[1];
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-e") == 0) || (stricmp (argv[0], "--efiImage") == 0)) {
+ if (argv[1] == NULL || argv[1][0] == '-') {
+ Error (NULL, 0, 1003, "Invalid option value", "Module Type is missing for -o option");
+ goto Finish;
+ }
+ ModuleType = argv[1];
+ if (mOutImageType == FW_ZERO_DEBUG_IMAGE) {
+ ZeroDebugFlag = TRUE;
+ }
+ if (mOutImageType != FW_TE_IMAGE) {
+ mOutImageType = FW_EFI_IMAGE;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-l") == 0) || (stricmp (argv[0], "--stripped") == 0)) {
+ mOutImageType = FW_RELOC_STRIPEED_IMAGE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-c") == 0) || (stricmp (argv[0], "--acpi") == 0)) {
+ mOutImageType = FW_ACPI_IMAGE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-t") == 0) || (stricmp (argv[0], "--terse") == 0)) {
+ if (mOutImageType == FW_ZERO_DEBUG_IMAGE) {
+ ZeroDebugFlag = TRUE;
+ }
+ mOutImageType = FW_TE_IMAGE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-u") == 0) || (stricmp (argv[0], "--dump") == 0)) {
+ mOutImageType = DUMP_TE_HEADER;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-b") == 0) || (stricmp (argv[0], "--exe2bin") == 0)) {
+ mOutImageType = FW_BIN_IMAGE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-z") == 0) || (stricmp (argv[0], "--zero") == 0)) {
+ if (mOutImageType == FW_DUMMY_IMAGE) {
+ mOutImageType = FW_ZERO_DEBUG_IMAGE;
+ }
+ if (mOutImageType == FW_TE_IMAGE || mOutImageType == FW_EFI_IMAGE) {
+ ZeroDebugFlag = TRUE;
+ }
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--stamp") == 0)) {
+ mOutImageType = FW_SET_STAMP_IMAGE;
+ if (argv[1] == NULL || argv[1][0] == '-') {
+ Error (NULL, 0, 1003, "Invalid option value", "time stamp is missing for -s option");
+ goto Finish;
+ }
+ TimeStamp = argv[1];
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-r") == 0) || (stricmp (argv[0], "--replace") == 0)) {
+ ReplaceFlag = TRUE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if (stricmp (argv[0], "--keepexceptiontable") == 0) {
+ KeepExceptionTableFlag = TRUE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if (stricmp(argv[0], "--keepoptionalheader") == 0) {
+ KeepOptionalHeaderFlag = TRUE;
+ argc--;
+ argv++;
+ continue;
+ }
+
+ if (stricmp (argv[0], "--keepzeropending") == 0) {
+ KeepZeroPendingFlag = TRUE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-m") == 0) || (stricmp (argv[0], "--mcifile") == 0)) {
+ mOutImageType = FW_MCI_IMAGE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-j") == 0) || (stricmp (argv[0], "--join") == 0)) {
+ mOutImageType = FW_MERGE_IMAGE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-a") == 0) || (stricmp (argv[0], "--align") == 0)) {
+ if (AsciiStringToUint64 (argv[1], FALSE, &Temp64) != EFI_SUCCESS) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ MciAlignment = (UINT32) Temp64;
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "--rebase") == 0)) {
+ if (argv[1][0] == '-') {
+ NegativeAddr = TRUE;
+ Status = AsciiStringToUint64 (argv[1] + 1, FALSE, &Temp64);
+ } else {
+ NegativeAddr = FALSE;
+ Status = AsciiStringToUint64 (argv[1], FALSE, &Temp64);
+ }
+ if (Status != EFI_SUCCESS) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ mOutImageType = FW_REBASE_IMAGE;
+ NewBaseAddress = (UINT64) Temp64;
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "--address") == 0)) {
+ if (argv[1][0] == '-') {
+ NegativeAddr = TRUE;
+ Status = AsciiStringToUint64 (argv[1] + 1, FALSE, &Temp64);
+ } else {
+ NegativeAddr = FALSE;
+ Status = AsciiStringToUint64 (argv[1], FALSE, &Temp64);
+ }
+ if (Status != EFI_SUCCESS) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ mOutImageType = FW_SET_ADDRESS_IMAGE;
+ NewBaseAddress = (UINT64) Temp64;
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-p") == 0) || (stricmp (argv[0], "--pad") == 0)) {
+ if (AsciiStringToUint64 (argv[1], FALSE, &Temp64) != EFI_SUCCESS) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ MciPadValue = (UINT8) Temp64;
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-v") == 0) || (stricmp (argv[0], "--verbose") == 0)) {
+ SetPrintLevel (VERBOSE_LOG_LEVEL);
+ VerboseMsg ("Verbose output Mode Set!");
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
+ SetPrintLevel (KEY_LOG_LEVEL);
+ KeyMsg ("Quiet output Mode Set!");
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--debug") == 0)) {
+ Status = AsciiStringToUint64 (argv[1], FALSE, &LogLevel);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ if (LogLevel > 9) {
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);
+ goto Finish;
+ }
+ SetPrintLevel (LogLevel);
+ DebugMsg (NULL, 0, 9, "Debug Mode Set", "Debug Output Mode Level %s is set!", argv[1]);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-g") == 0) || (stricmp (argv[0], "--hiiguid") == 0)) {
+ Status = StringToGuid (argv[1], &HiiPackageListGuid);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if (stricmp (argv[0], "--hiipackage") == 0) {
+ mOutImageType = FW_HII_PACKAGE_LIST_RCIMAGE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if (stricmp (argv[0], "--hiibinpackage") == 0) {
+ mOutImageType = FW_HII_PACKAGE_LIST_BINIMAGE;
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if (argv[0][0] == '-') {
+ Error (NULL, 0, 1000, "Unknown option", argv[0]);
+ goto Finish;
+ }
+ //
+ // Get Input file name
+ //
+ if ((InputFileNum == 0) && (InputFileName == NULL)) {
+ InputFileName = (CHAR8 **) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *));
+ if (InputFileName == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ goto Finish;
+ }
+
+ memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
+ } else if (InputFileNum % MAXIMUM_INPUT_FILE_NUM == 0) {
+ //
+ // InputFileName buffer too small, need to realloc
+ //
+ InputFileName = (CHAR8 **) realloc (
+ InputFileName,
+ (InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (CHAR8 *)
+ );
+
+ if (InputFileName == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ goto Finish;
+ }
+
+ memset (&(InputFileName[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
+ }
+
+ InputFileName [InputFileNum ++] = argv[0];
+ argc --;
+ argv ++;
+ }
+
+ VerboseMsg ("%s tool start.", UTILITY_NAME);
+
+ if (mOutImageType == FW_DUMMY_IMAGE) {
+ Error (NULL, 0, 1001, "Missing option", "No create file action specified; pls specify -e, -c or -t option to create efi image, or acpi table or TeImage!");
+ if (ReplaceFlag) {
+ Error (NULL, 0, 1001, "Missing option", "-r option is not supported as the independent option. It can be used together with other create file option specified at the above.");
+ }
+ goto Finish;
+ }
+
+ //
+ // check input files
+ //
+ if (InputFileNum == 0) {
+ Error (NULL, 0, 1001, "Missing option", "Input files");
+ goto Finish;
+ }
+
+ //
+ // Combine MciBinary files to one file
+ //
+ if ((mOutImageType == FW_MERGE_IMAGE) && ReplaceFlag) {
+ Error (NULL, 0, 1002, "Conflicting option", "-r replace option cannot be used with -j merge files option.");
+ goto Finish;
+ }
+
+ //
+ // Combine HiiBinary packages to a single package list
+ //
+ if ((mOutImageType == FW_HII_PACKAGE_LIST_RCIMAGE) && ReplaceFlag) {
+ Error (NULL, 0, 1002, "Conflicting option", "-r replace option cannot be used with --hiipackage merge files option.");
+ goto Finish;
+ }
+
+ if ((mOutImageType == FW_HII_PACKAGE_LIST_BINIMAGE) && ReplaceFlag) {
+ Error (NULL, 0, 1002, "Conflicting option", "-r replace option cannot be used with --hiibinpackage merge files option.");
+ goto Finish;
+ }
+
+ //
+ // Input image file
+ //
+ mInImageName = InputFileName [InputFileNum - 1];
+ VerboseMsg ("the input file name is %s", mInImageName);
+
+ //
+ // Action will be taken for the input file.
+ //
+ switch (mOutImageType) {
+ case FW_EFI_IMAGE:
+ VerboseMsg ("Create efi image on module type %s based on the input PE image.", ModuleType);
+ break;
+ case FW_TE_IMAGE:
+ VerboseMsg ("Create Te Image based on the input PE image.");
+ break;
+ case FW_ACPI_IMAGE:
+ VerboseMsg ("Get acpi table data from the input PE image.");
+ break;
+ case FW_RELOC_STRIPEED_IMAGE:
+ VerboseMsg ("Remove relocation section from Pe or Te image.");
+ break;
+ case FW_BIN_IMAGE:
+ VerboseMsg ("Convert the input EXE to the output BIN file.");
+ break;
+ case FW_ZERO_DEBUG_IMAGE:
+ VerboseMsg ("Zero the Debug Data Fields and Time Stamp in input PE image.");
+ break;
+ case FW_SET_STAMP_IMAGE:
+ VerboseMsg ("Set new time stamp %s in the input PE image.", TimeStamp);
+ break;
+ case DUMP_TE_HEADER:
+ VerboseMsg ("Dump the TE header information of the input TE image.");
+ break;
+ case FW_MCI_IMAGE:
+ VerboseMsg ("Convert input MicroCode.txt file to MicroCode.bin file.");
+ break;
+ case FW_MERGE_IMAGE:
+ VerboseMsg ("Combine the input multi microcode bin files to one bin file.");
+ break;
+ case FW_HII_PACKAGE_LIST_RCIMAGE:
+ VerboseMsg ("Combine the input multi hii bin packages to one text package list RC file.");
+ break;
+ case FW_HII_PACKAGE_LIST_BINIMAGE:
+ VerboseMsg ("Combine the input multi hii bin packages to one binary package list file.");
+ break;
+ case FW_REBASE_IMAGE:
+ VerboseMsg ("Rebase the input image to new base address.");
+ break;
+ case FW_SET_ADDRESS_IMAGE:
+ VerboseMsg ("Set the preferred address into the section header of the input image");
+ break;
+ default:
+ break;
+ }
+
+ if (ReplaceFlag) {
+ VerboseMsg ("Overwrite the input file with the output content.");
+ }
+
+ //
+ // Open output file and Write image into the output file.
+ //
+ if (OutImageName != NULL) {
+ fpOut = fopen (LongFilePath (OutImageName), "rb");
+ if (fpOut != NULL) {
+ //
+ // Get Output file time stamp
+ //
+ fstat(fileno (fpOut), &Stat_Buf);
+ OutputFileTime = Stat_Buf.st_mtime;
+ //
+ // Get Output file data
+ //
+ OutputFileLength = _filelength (fileno (fpOut));
+ OutputFileBuffer = malloc (OutputFileLength);
+ if (OutputFileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ fclose (fpOut);
+ fpOut = NULL;
+ goto Finish;
+ }
+ fread (OutputFileBuffer, 1, OutputFileLength, fpOut);
+ fclose (fpOut);
+ fpOut = NULL;
+ }
+ VerboseMsg ("Output file name is %s", OutImageName);
+ } else if (!ReplaceFlag && mOutImageType != DUMP_TE_HEADER) {
+ Error (NULL, 0, 1001, "Missing option", "output file");
+ goto Finish;
+ }
+
+ //
+ // Open input file and read file data into file buffer.
+ //
+ fpIn = fopen (LongFilePath (mInImageName), "rb");
+ if (fpIn == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", mInImageName);
+ goto Finish;
+ }
+ //
+ // Get Iutput file time stamp
+ //
+ fstat(fileno (fpIn), &Stat_Buf);
+ InputFileTime = Stat_Buf.st_mtime;
+ //
+ // Get Input file data
+ //
+ InputFileLength = _filelength (fileno (fpIn));
+ InputFileBuffer = malloc (InputFileLength);
+ if (InputFileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ fclose (fpIn);
+ goto Finish;
+ }
+ fread (InputFileBuffer, 1, InputFileLength, fpIn);
+ fclose (fpIn);
+ DebugMsg (NULL, 0, 9, "input file info", "the input file size is %u bytes", (unsigned) InputFileLength);
+
+ //
+ // Combine multi binary HII package files.
+ //
+ if (mOutImageType == FW_HII_PACKAGE_LIST_RCIMAGE || mOutImageType == FW_HII_PACKAGE_LIST_BINIMAGE) {
+ //
+ // Open output file handle.
+ //
+ fpOut = fopen (LongFilePath (OutImageName), "wb");
+ if (!fpOut) {
+ Error (NULL, 0, 0001, "Error opening output file", OutImageName);
+ goto Finish;
+ }
+ //
+ // Get hii package list length
+ //
+ HiiPackageListHeader.PackageLength = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
+ for (Index = 0; Index < InputFileNum; Index ++) {
+ fpIn = fopen (LongFilePath (InputFileName [Index]), "rb");
+ if (fpIn == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", InputFileName [Index]);
+ goto Finish;
+ }
+ FileLength = _filelength (fileno (fpIn));
+ fread (&HiiPackageHeader, 1, sizeof (HiiPackageHeader), fpIn);
+ if (HiiPackageHeader.Type == EFI_HII_PACKAGE_FORM) {
+ if (HiiPackageHeader.Length != FileLength) {
+ Error (NULL, 0, 3000, "Invalid", "The wrong package size is in HII package file %s", InputFileName [Index]);
+ fclose (fpIn);
+ goto Finish;
+ }
+ if (memcmp (&HiiPackageListGuid, &mZeroGuid, sizeof (EFI_GUID)) == 0) {
+ fread (&IfrFormSet, 1, sizeof (IfrFormSet), fpIn);
+ memcpy (&HiiPackageListGuid, &IfrFormSet.Guid, sizeof (EFI_GUID));
+ }
+ NumberOfFormPackage ++;
+ }
+ HiiPackageListHeader.PackageLength += FileLength;
+ fclose (fpIn);
+ }
+ HiiPackageListHeader.PackageLength += sizeof (EndPackage);
+ //
+ // Check whether hii packages are valid
+ //
+ if (NumberOfFormPackage > 1) {
+ Error (NULL, 0, 3000, "Invalid", "The input hii packages contains more than one hii form package");
+ goto Finish;
+ }
+ if (memcmp (&HiiPackageListGuid, &mZeroGuid, sizeof (EFI_GUID)) == 0) {
+ Error (NULL, 0, 3000, "Invalid", "HII package list guid is not specified!");
+ goto Finish;
+ }
+ memcpy (&HiiPackageListHeader.PackageListGuid, &HiiPackageListGuid, sizeof (EFI_GUID));
+ //
+ // read hii packages
+ //
+ HiiPackageListBuffer = malloc (HiiPackageListHeader.PackageLength);
+ if (HiiPackageListBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ goto Finish;
+ }
+ memcpy (HiiPackageListBuffer, &HiiPackageListHeader, sizeof (HiiPackageListHeader));
+ HiiPackageDataPointer = HiiPackageListBuffer + sizeof (HiiPackageListHeader);
+ for (Index = 0; Index < InputFileNum; Index ++) {
+ fpIn = fopen (LongFilePath (InputFileName [Index]), "rb");
+ if (fpIn == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", InputFileName [Index]);
+ free (HiiPackageListBuffer);
+ goto Finish;
+ }
+
+ FileLength = _filelength (fileno (fpIn));
+ fread (HiiPackageDataPointer, 1, FileLength, fpIn);
+ fclose (fpIn);
+ HiiPackageDataPointer = HiiPackageDataPointer + FileLength;
+ }
+ memcpy (HiiPackageDataPointer, &EndPackage, sizeof (EndPackage));
+
+ //
+ // write the hii package into the binary package list file with the resource section header
+ //
+ if (mOutImageType == FW_HII_PACKAGE_LIST_BINIMAGE) {
+ //
+ // Create the resource section header
+ //
+ HiiSectionHeader = CreateHiiResouceSectionHeader (&HiiSectionHeaderSize, HiiPackageListHeader.PackageLength);
+ if (HiiSectionHeader == NULL) {
+ free (HiiPackageListBuffer);
+ goto Finish;
+ }
+ //
+ // Wrtie section header and HiiData into File.
+ //
+ fwrite (HiiSectionHeader, 1, HiiSectionHeaderSize, fpOut);
+ fwrite (HiiPackageListBuffer, 1, HiiPackageListHeader.PackageLength, fpOut);
+ //
+ // Free allocated resources.
+ //
+ free (HiiSectionHeader);
+ free (HiiPackageListBuffer);
+ //
+ // Done successfully
+ //
+ goto Finish;
+ }
+
+ //
+ // write the hii package into the text package list rc file.
+ //
+ if (mOutImageType == FW_HII_PACKAGE_LIST_RCIMAGE) {
+ for (Index = 0; gHiiPackageRCFileHeader[Index] != NULL; Index++) {
+ fprintf (fpOut, "%s\n", gHiiPackageRCFileHeader[Index]);
+ }
+ fprintf (fpOut, "\n%d %s\n{", HII_RESOURCE_SECTION_INDEX, HII_RESOURCE_SECTION_NAME);
+
+ HiiPackageDataPointer = HiiPackageListBuffer;
+ for (Index = 0; Index + 2 < HiiPackageListHeader.PackageLength; Index += 2) {
+ if (Index % 16 == 0) {
+ fprintf (fpOut, "\n ");
+ }
+ fprintf (fpOut, " 0x%04X,", *(UINT16 *) HiiPackageDataPointer);
+ HiiPackageDataPointer += 2;
+ }
+
+ if (Index % 16 == 0) {
+ fprintf (fpOut, "\n ");
+ }
+ if ((Index + 2) == HiiPackageListHeader.PackageLength) {
+ fprintf (fpOut, " 0x%04X\n}\n", *(UINT16 *) HiiPackageDataPointer);
+ }
+ if ((Index + 1) == HiiPackageListHeader.PackageLength) {
+ fprintf (fpOut, " 0x%04X\n}\n", *(UINT8 *) HiiPackageDataPointer);
+ }
+ free (HiiPackageListBuffer);
+ //
+ // Done successfully
+ //
+ goto Finish;
+ }
+ }
+
+ //
+ // Combine MciBinary files to one file
+ //
+ if (mOutImageType == FW_MERGE_IMAGE) {
+ //
+ // Open output file handle.
+ //
+ fpOut = fopen (LongFilePath (OutImageName), "wb");
+ if (!fpOut) {
+ Error (NULL, 0, 0001, "Error opening output file", OutImageName);
+ goto Finish;
+ }
+ for (Index = 0; Index < InputFileNum; Index ++) {
+ fpIn = fopen (LongFilePath (InputFileName [Index]), "rb");
+ if (!fpIn) {
+ Error (NULL, 0, 0001, "Error opening file", InputFileName [Index]);
+ goto Finish;
+ }
+
+ FileLength = _filelength (fileno (fpIn));
+ FileBuffer = malloc (FileLength);
+ if (FileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ fclose (fpIn);
+ goto Finish;
+ }
+
+ fread (FileBuffer, 1, FileLength, fpIn);
+ fclose (fpIn);
+ //
+ // write input file to out file
+ //
+ fwrite (FileBuffer, 1, FileLength, fpOut);
+ //
+ // write pad value to out file.
+ //
+ while (FileLength ++ % MciAlignment != 0) {
+ fwrite (&MciPadValue, 1, 1, fpOut);
+ }
+ //
+ // free allocated memory space
+ //
+ free (FileBuffer);
+ FileBuffer = NULL;
+ }
+ //
+ // Done successfully
+ //
+ goto Finish;
+ }
+
+ //
+ // Convert MicroCode.txt file to MicroCode.bin file
+ //
+ if (mOutImageType == FW_MCI_IMAGE) {
+ fpIn = fopen (LongFilePath (mInImageName), "r");
+ if (fpIn == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", mInImageName);
+ goto Finish;
+ }
+
+ //
+ // The first pass is to determine
+ // how much data is in the file so we can allocate a working buffer.
+ //
+ FileLength = 0;
+ do {
+ Status = MicrocodeReadData (fpIn, &Data);
+ if (Status == STATUS_SUCCESS) {
+ FileLength += sizeof (Data);
+ }
+ if (Status == STATUS_IGNORE) {
+ Status = STATUS_SUCCESS;
+ }
+ } while (Status == STATUS_SUCCESS);
+ //
+ // Error if no data.
+ //
+ if (FileLength == 0) {
+ Error (NULL, 0, 3000, "Invalid", "no parseable data found in file %s", mInImageName);
+ goto Finish;
+ }
+ if (FileLength < sizeof (MICROCODE_IMAGE_HEADER)) {
+ Error (NULL, 0, 3000, "Invalid", "amount of parseable data in %s is insufficient to contain a microcode header", mInImageName);
+ goto Finish;
+ }
+
+ //
+ // Allocate a buffer for the data
+ //
+ FileBuffer = malloc (FileLength);
+ if (FileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ goto Finish;
+ }
+ //
+ // Re-read the file, storing the data into our buffer
+ //
+ fseek (fpIn, 0, SEEK_SET);
+ DataPointer = (UINT32 *) FileBuffer;
+ OldDataPointer = DataPointer;
+ do {
+ OldDataPointer = DataPointer;
+ Status = MicrocodeReadData (fpIn, DataPointer++);
+ if (Status == STATUS_IGNORE) {
+ DataPointer = OldDataPointer;
+ Status = STATUS_SUCCESS;
+ }
+ } while (Status == STATUS_SUCCESS);
+ //
+ // close input file after read data
+ //
+ fclose (fpIn);
+
+ //
+ // Can't do much checking on the header because, per the spec, the
+ // DataSize field may be 0, which means DataSize = 2000 and TotalSize = 2K,
+ // and the TotalSize field is invalid (actually missing). Thus we can't
+ // even verify the Reserved fields are 0.
+ //
+ MciHeader = (MICROCODE_IMAGE_HEADER *) FileBuffer;
+ if (MciHeader->DataSize == 0) {
+ Index = 2048;
+ } else {
+ Index = MciHeader->TotalSize;
+ }
+
+ if (Index != FileLength) {
+ Error (NULL, 0, 3000, "Invalid", "file length of %s (0x%x) does not equal expected TotalSize: 0x%04X.", mInImageName, (unsigned) FileLength, (unsigned) Index);
+ goto Finish;
+ }
+
+ //
+ // Checksum the contents
+ //
+ DataPointer = (UINT32 *) FileBuffer;
+ CheckSum = 0;
+ Index = 0;
+ while (Index < FileLength) {
+ CheckSum += *DataPointer;
+ DataPointer ++;
+ Index += sizeof (*DataPointer);
+ }
+ if (CheckSum != 0) {
+ Error (NULL, 0, 3000, "Invalid", "checksum (0x%x) failed on file %s.", (unsigned) CheckSum, mInImageName);
+ goto Finish;
+ }
+ //
+ // Open the output file and write the buffer contents
+ //
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
+ goto WriteFile;
+ }
+
+ //
+ // Open input file and read file data into file buffer.
+ //
+ FileLength = InputFileLength;
+ FileBuffer = malloc (FileLength);
+ if (FileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ goto Finish;
+ }
+ memcpy (FileBuffer, InputFileBuffer, InputFileLength);
+
+ //
+ // Dump TeImage Header into output file.
+ //
+ if (mOutImageType == DUMP_TE_HEADER) {
+ memcpy (&TEImageHeader, FileBuffer, sizeof (TEImageHeader));
+ if (TEImageHeader.Signature != EFI_TE_IMAGE_HEADER_SIGNATURE) {
+ Error (NULL, 0, 3000, "Invalid", "TE header signature of file %s is not correct.", mInImageName);
+ goto Finish;
+ }
+ //
+ // Open the output file handle.
+ //
+ if (ReplaceFlag) {
+ fpInOut = fopen (LongFilePath (mInImageName), "wb");
+ if (fpInOut == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", mInImageName);
+ goto Finish;
+ }
+ } else {
+ if (OutImageName != NULL) {
+ fpOut = fopen (LongFilePath (OutImageName), "wb");
+ } else {
+ fpOut = stdout;
+ }
+ if (fpOut == NULL) {
+ Error (NULL, 0, 0001, "Error opening output file", OutImageName);
+ goto Finish;
+ }
+ }
+ if (fpInOut != NULL) {
+ fprintf (fpInOut, "Dump of file %s\n\n", mInImageName);
+ fprintf (fpInOut, "TE IMAGE HEADER VALUES\n");
+ fprintf (fpInOut, "%17X machine\n", TEImageHeader.Machine);
+ fprintf (fpInOut, "%17X number of sections\n", TEImageHeader.NumberOfSections);
+ fprintf (fpInOut, "%17X subsystems\n", TEImageHeader.Subsystem);
+ fprintf (fpInOut, "%17X stripped size\n", TEImageHeader.StrippedSize);
+ fprintf (fpInOut, "%17X entry point\n", (unsigned) TEImageHeader.AddressOfEntryPoint);
+ fprintf (fpInOut, "%17X base of code\n", (unsigned) TEImageHeader.BaseOfCode);
+ fprintf (fpInOut, "%17llX image base\n", (unsigned long long)TEImageHeader.ImageBase);
+ fprintf (fpInOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", (unsigned) TEImageHeader.DataDirectory[0].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[0].Size);
+ fprintf (fpInOut, "%17X [%8X] RVA [size] of Debug Directory\n", (unsigned) TEImageHeader.DataDirectory[1].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[1].Size);
+ }
+ if (fpOut != NULL) {
+ fprintf (fpOut, "Dump of file %s\n\n", mInImageName);
+ fprintf (fpOut, "TE IMAGE HEADER VALUES\n");
+ fprintf (fpOut, "%17X machine\n", TEImageHeader.Machine);
+ fprintf (fpOut, "%17X number of sections\n", TEImageHeader.NumberOfSections);
+ fprintf (fpOut, "%17X subsystems\n", TEImageHeader.Subsystem);
+ fprintf (fpOut, "%17X stripped size\n", TEImageHeader.StrippedSize);
+ fprintf (fpOut, "%17X entry point\n", (unsigned) TEImageHeader.AddressOfEntryPoint);
+ fprintf (fpOut, "%17X base of code\n", (unsigned) TEImageHeader.BaseOfCode);
+ fprintf (fpOut, "%17llX image base\n", (unsigned long long)TEImageHeader.ImageBase);
+ fprintf (fpOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", (unsigned) TEImageHeader.DataDirectory[0].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[0].Size);
+ fprintf (fpOut, "%17X [%8X] RVA [size] of Debug Directory\n", (unsigned) TEImageHeader.DataDirectory[1].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[1].Size);
+ }
+ goto Finish;
+ }
+
+ //
+ // Following code to convert dll to efi image or te image.
+ // Get new image type
+ //
+ if ((mOutImageType == FW_EFI_IMAGE) || (mOutImageType == FW_TE_IMAGE)) {
+ if (ModuleType == NULL) {
+ if (mOutImageType == FW_EFI_IMAGE) {
+ Error (NULL, 0, 1001, "Missing option", "EFI_FILETYPE");
+ goto Finish;
+ } else if (mOutImageType == FW_TE_IMAGE) {
+ //
+ // Default TE Image Type is Boot service driver
+ //
+ Type = EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER;
+ VerboseMsg ("Efi Image subsystem type is efi boot service driver.");
+ }
+ } else {
+ if (stricmp (ModuleType, "BASE") == 0 ||
+ stricmp (ModuleType, "SEC") == 0 ||
+ stricmp (ModuleType, "SECURITY_CORE") == 0 ||
+ stricmp (ModuleType, "PEI_CORE") == 0 ||
+ stricmp (ModuleType, "PEIM") == 0 ||
+ stricmp (ModuleType, "COMBINED_PEIM_DRIVER") == 0 ||
+ stricmp (ModuleType, "PIC_PEIM") == 0 ||
+ stricmp (ModuleType, "RELOCATABLE_PEIM") == 0 ||
+ stricmp (ModuleType, "DXE_CORE") == 0 ||
+ stricmp (ModuleType, "BS_DRIVER") == 0 ||
+ stricmp (ModuleType, "DXE_DRIVER") == 0 ||
+ stricmp (ModuleType, "DXE_SMM_DRIVER") == 0 ||
+ stricmp (ModuleType, "UEFI_DRIVER") == 0 ||
+ stricmp (ModuleType, "SMM_CORE") == 0 ||
+ stricmp (ModuleType, "MM_STANDALONE") == 0 ||
+ stricmp (ModuleType, "MM_CORE_STANDALONE") == 0) {
+ Type = EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER;
+ VerboseMsg ("Efi Image subsystem type is efi boot service driver.");
+
+ } else if (stricmp (ModuleType, "UEFI_APPLICATION") == 0 ||
+ stricmp (ModuleType, "APPLICATION") == 0) {
+ Type = EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION;
+ VerboseMsg ("Efi Image subsystem type is efi application.");
+
+ } else if (stricmp (ModuleType, "DXE_RUNTIME_DRIVER") == 0 ||
+ stricmp (ModuleType, "RT_DRIVER") == 0) {
+ Type = EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER;
+ VerboseMsg ("Efi Image subsystem type is efi runtime driver.");
+
+ } else if (stricmp (ModuleType, "DXE_SAL_DRIVER") == 0 ||
+ stricmp (ModuleType, "SAL_RT_DRIVER") == 0) {
+ Type = EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER;
+ VerboseMsg ("Efi Image subsystem type is efi sal runtime driver.");
+
+ } else {
+ Error (NULL, 0, 1003, "Invalid option value", "EFI_FILETYPE = %s", ModuleType);
+ goto Finish;
+ }
+ }
+ }
+
+ //
+ // Convert ELF image to PeImage
+ //
+ if (IsElfHeader(FileBuffer)) {
+ VerboseMsg ("Convert %s from ELF to PE/COFF.", mInImageName);
+ if (!ConvertElf(&FileBuffer, &FileLength)) {
+ Error (NULL, 0, 3000, "Invalid", "Unable to convert %s from ELF to PE/COFF.", mInImageName);
+ goto Finish;
+ }
+ }
+
+ //
+ // Make sure File Offsets and Virtual Offsets are the same in the image so it is XIP
+ // XIP == eXecute In Place
+ //
+ PeCoffConvertImageToXip (&FileBuffer, &FileLength);
+
+ //
+ // Remove reloc section from PE or TE image
+ //
+ if (mOutImageType == FW_RELOC_STRIPEED_IMAGE) {
+ //
+ // Check TeImage
+ //
+ TeHdr = (EFI_TE_IMAGE_HEADER *) FileBuffer;
+ if (TeHdr->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (TeHdr + 1);
+ for (Index = 0; Index < TeHdr->NumberOfSections; Index ++, SectionHeader ++) {
+ if (strcmp ((char *)SectionHeader->Name, ".reloc") == 0) {
+ //
+ // Check the reloc section is in the end of image.
+ //
+ if ((SectionHeader->PointerToRawData + SectionHeader->SizeOfRawData) ==
+ (FileLength + TeHdr->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER))) {
+ //
+ // Remove .reloc section and update TeImage Header
+ //
+ FileLength = FileLength - SectionHeader->SizeOfRawData;
+ SectionHeader->SizeOfRawData = 0;
+ SectionHeader->Misc.VirtualSize = 0;
+ TeHdr->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = 0;
+ TeHdr->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size = 0;
+ break;
+ }
+ }
+ }
+ } else {
+ //
+ // Check PE Image
+ //
+ DosHdr = (EFI_IMAGE_DOS_HEADER *) FileBuffer;
+ if (DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
+ PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(FileBuffer);
+ if (PeHdr->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
+ Error (NULL, 0, 3000, "Invalid", "TE and DOS header signatures were not found in %s image.", mInImageName);
+ goto Finish;
+ }
+ DosHdr = NULL;
+ } else {
+ PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(FileBuffer + DosHdr->e_lfanew);
+ if (PeHdr->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
+ Error (NULL, 0, 3000, "Invalid", "PE header signature was not found in %s image.", mInImageName);
+ goto Finish;
+ }
+ }
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader);
+ for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
+ if (strcmp ((char *)SectionHeader->Name, ".reloc") == 0) {
+ //
+ // Check the reloc section is in the end of image.
+ //
+ if ((SectionHeader->PointerToRawData + SectionHeader->SizeOfRawData) == FileLength) {
+ //
+ // Remove .reloc section and update PeImage Header
+ //
+ FileLength = FileLength - SectionHeader->SizeOfRawData;
+
+ PeHdr->Pe32.FileHeader.Characteristics |= EFI_IMAGE_FILE_RELOCS_STRIPPED;
+ if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ Optional32 = (EFI_IMAGE_OPTIONAL_HEADER32 *)&PeHdr->Pe32.OptionalHeader;
+ Optional32->SizeOfImage -= SectionHeader->SizeOfRawData;
+ Optional32->SizeOfInitializedData -= SectionHeader->SizeOfRawData;
+ if (Optional32->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
+ Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = 0;
+ Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size = 0;
+ }
+ }
+ if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
+ Optional64 = (EFI_IMAGE_OPTIONAL_HEADER64 *)&PeHdr->Pe32.OptionalHeader;
+ Optional64->SizeOfImage -= SectionHeader->SizeOfRawData;
+ Optional64->SizeOfInitializedData -= SectionHeader->SizeOfRawData;
+ if (Optional64->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
+ Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = 0;
+ Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size = 0;
+ }
+ }
+ SectionHeader->Misc.VirtualSize = 0;
+ SectionHeader->SizeOfRawData = 0;
+ break;
+ }
+ }
+ }
+ }
+ //
+ // Write file
+ //
+ goto WriteFile;
+ }
+ //
+ // Read the dos & pe hdrs of the image
+ //
+ DosHdr = (EFI_IMAGE_DOS_HEADER *)FileBuffer;
+ if (DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
+ // NO DOS header, check for PE/COFF header
+ PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(FileBuffer);
+ if (PeHdr->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
+ Error (NULL, 0, 3000, "Invalid", "DOS header signature was not found in %s image.", mInImageName);
+ goto Finish;
+ }
+ DosHdr = NULL;
+ } else {
+
+ PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(FileBuffer + DosHdr->e_lfanew);
+ if (PeHdr->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
+ Error (NULL, 0, 3000, "Invalid", "PE header signature was not found in %s image.", mInImageName);
+ goto Finish;
+ }
+ }
+
+ if (PeHdr->Pe32.FileHeader.Machine == IMAGE_FILE_MACHINE_ARM) {
+ // Some tools kick out IMAGE_FILE_MACHINE_ARM (0x1c0) vs IMAGE_FILE_MACHINE_ARMT (0x1c2)
+ // so patch back to the official UEFI value.
+ PeHdr->Pe32.FileHeader.Machine = IMAGE_FILE_MACHINE_ARMT;
+ }
+
+ //
+ // Set new base address into image
+ //
+ if (mOutImageType == FW_REBASE_IMAGE || mOutImageType == FW_SET_ADDRESS_IMAGE) {
+ if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ if (NewBaseAddress >= 0x100000000ULL) {
+ Error (NULL, 0, 3000, "Invalid", "New base address is larger than 4G for 32bit PE image");
+ goto Finish;
+ }
+ }
+
+ if (NegativeAddr) {
+ //
+ // Set Base Address to a negative value.
+ //
+ NewBaseAddress = (UINT64) (0 - NewBaseAddress);
+ }
+ if (mOutImageType == FW_REBASE_IMAGE) {
+ Status = RebaseImage (mInImageName, FileBuffer, NewBaseAddress);
+ } else {
+ Status = SetAddressToSectionHeader (mInImageName, FileBuffer, NewBaseAddress);
+ }
+ if (EFI_ERROR (Status)) {
+ if (NegativeAddr) {
+ Error (NULL, 0, 3000, "Invalid", "Rebase/Set Image %s to Base address -0x%llx can't success", mInImageName, 0 - NewBaseAddress);
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Rebase/Set Image %s to Base address 0x%llx can't success", mInImageName, NewBaseAddress);
+ }
+ goto Finish;
+ }
+
+ //
+ // Write file
+ //
+ goto WriteFile;
+ }
+
+ //
+ // Extract bin data from Pe image.
+ //
+ if (mOutImageType == FW_BIN_IMAGE) {
+ if (FileLength < PeHdr->Pe32.OptionalHeader.SizeOfHeaders) {
+ Error (NULL, 0, 3000, "Invalid", "FileSize of %s is not a legal size.", mInImageName);
+ goto Finish;
+ }
+ //
+ // Output bin data from exe file
+ //
+ FileLength = FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders;
+ memmove (FileBuffer, FileBuffer + PeHdr->Pe32.OptionalHeader.SizeOfHeaders, FileLength);
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
+ goto WriteFile;
+ }
+
+ //
+ // Zero Debug Information of Pe Image
+ //
+ if (mOutImageType == FW_ZERO_DEBUG_IMAGE) {
+ Status = ZeroDebugData (FileBuffer, TRUE);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "Zero DebugData Error status is 0x%x", (int) Status);
+ goto Finish;
+ }
+
+ //
+ // Write the updated Image
+ //
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
+ goto WriteFile;
+ }
+
+ //
+ // Set Time Stamp of Pe Image
+ //
+ if (mOutImageType == FW_SET_STAMP_IMAGE) {
+ Status = SetStamp (FileBuffer, TimeStamp);
+ if (EFI_ERROR (Status)) {
+ goto Finish;
+ }
+
+ //
+ // Write the updated Image
+ //
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
+ goto WriteFile;
+ }
+
+ //
+ // Extract acpi data from pe image.
+ //
+ if (mOutImageType == FW_ACPI_IMAGE) {
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader);
+ for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
+ if (strcmp ((char *)SectionHeader->Name, ".data") == 0 || strcmp ((char *)SectionHeader->Name, ".sdata") == 0) {
+ //
+ // Check Acpi Table
+ //
+ if (SectionHeader->Misc.VirtualSize < SectionHeader->SizeOfRawData) {
+ FileLength = SectionHeader->Misc.VirtualSize;
+ } else {
+ FileLength = SectionHeader->SizeOfRawData;
+ }
+
+ if (CheckAcpiTable (FileBuffer + SectionHeader->PointerToRawData, FileLength) != STATUS_SUCCESS) {
+ Error (NULL, 0, 3000, "Invalid", "ACPI table check failed in %s.", mInImageName);
+ goto Finish;
+ }
+
+ //
+ // Output Apci data to file
+ //
+ memmove (FileBuffer, FileBuffer + SectionHeader->PointerToRawData, FileLength);
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
+ goto WriteFile;
+ }
+ }
+ Error (NULL, 0, 3000, "Invalid", "failed to get ACPI table from %s.", mInImageName);
+ goto Finish;
+ }
+ //
+ // Zero all unused fields of the DOS header
+ //
+ if (DosHdr != NULL) {
+ memcpy (&BackupDosHdr, DosHdr, sizeof (EFI_IMAGE_DOS_HEADER));
+ memset (DosHdr, 0, sizeof (EFI_IMAGE_DOS_HEADER));
+ DosHdr->e_magic = BackupDosHdr.e_magic;
+ DosHdr->e_lfanew = BackupDosHdr.e_lfanew;
+
+ for (Index = sizeof (EFI_IMAGE_DOS_HEADER); Index < (UINT32 ) DosHdr->e_lfanew; Index++) {
+ FileBuffer[Index] = (UINT8) DosHdr->e_cp;
+ }
+ }
+
+ //
+ // Initialize TeImage Header
+ //
+ memset (&TEImageHeader, 0, sizeof (EFI_TE_IMAGE_HEADER));
+ TEImageHeader.Signature = EFI_TE_IMAGE_HEADER_SIGNATURE;
+ TEImageHeader.Machine = PeHdr->Pe32.FileHeader.Machine;
+ TEImageHeader.NumberOfSections = (UINT8) PeHdr->Pe32.FileHeader.NumberOfSections;
+ TEImageHeader.StrippedSize = (UINT16) ((UINTN) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader) - (UINTN) FileBuffer);
+ TEImageHeader.Subsystem = (UINT8) Type;
+
+ //
+ // Patch the PE header
+ //
+ PeHdr->Pe32.OptionalHeader.Subsystem = (UINT16) Type;
+
+ if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ Optional32 = (EFI_IMAGE_OPTIONAL_HEADER32 *)&PeHdr->Pe32.OptionalHeader;
+ if (!KeepOptionalHeaderFlag) {
+ Optional32->MajorOperatingSystemVersion = 0;
+ Optional32->MinorOperatingSystemVersion = 0;
+ Optional32->MajorImageVersion = 0;
+ Optional32->MinorImageVersion = 0;
+ Optional32->MajorSubsystemVersion = 0;
+ Optional32->MinorSubsystemVersion = 0;
+ Optional32->Win32VersionValue = 0;
+ Optional32->CheckSum = 0;
+ Optional32->SizeOfStackReserve = 0;
+ Optional32->SizeOfStackCommit = 0;
+ Optional32->SizeOfHeapReserve = 0;
+ Optional32->SizeOfHeapCommit = 0;
+ }
+ TEImageHeader.AddressOfEntryPoint = Optional32->AddressOfEntryPoint;
+ TEImageHeader.BaseOfCode = Optional32->BaseOfCode;
+ TEImageHeader.ImageBase = (UINT64) (Optional32->ImageBase);
+
+ if (Optional32->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
+ TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress;
+ TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size = Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
+ }
+
+ if (Optional32->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
+ TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress = Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
+ TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].Size = Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
+ }
+
+ //
+ // Zero .pdata section data.
+ //
+ if (!KeepExceptionTableFlag && Optional32->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION &&
+ Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION].VirtualAddress != 0 &&
+ Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION].Size != 0) {
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader);
+ for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index++, SectionHeader++) {
+ if (SectionHeader->VirtualAddress == Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION].VirtualAddress) {
+ //
+ // Zero .pdata Section data
+ //
+ memset (FileBuffer + SectionHeader->PointerToRawData, 0, SectionHeader->SizeOfRawData);
+ //
+ // Zero .pdata Section header name
+ //
+ memset (SectionHeader->Name, 0, sizeof (SectionHeader->Name));
+ //
+ // Zero Exception Table
+ //
+ Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION].VirtualAddress = 0;
+ Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION].Size = 0;
+ DebugMsg (NULL, 0, 9, "Zero the .pdata section for PE image", NULL);
+ break;
+ }
+ }
+ }
+
+ //
+ // Strip zero padding at the end of the .reloc section
+ //
+ if (!KeepZeroPendingFlag && Optional32->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
+ if (Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size != 0) {
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader);
+ for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index++, SectionHeader++) {
+ //
+ // Look for the Section Header that starts as the same virtual address as the Base Relocation Data Directory
+ //
+ if (SectionHeader->VirtualAddress == Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress) {
+ SectionHeader->Misc.VirtualSize = Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
+ AllignedRelocSize = (Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size + Optional32->FileAlignment - 1) & (~(Optional32->FileAlignment - 1));
+ //
+ // Check to see if there is zero padding at the end of the base relocations
+ //
+ if (AllignedRelocSize < SectionHeader->SizeOfRawData) {
+ //
+ // Check to see if the base relocations are at the end of the file
+ //
+ if (SectionHeader->PointerToRawData + SectionHeader->SizeOfRawData == Optional32->SizeOfImage) {
+ //
+ // All the required conditions are met to strip the zero padding of the end of the base relocations section
+ //
+ Optional32->SizeOfImage -= (SectionHeader->SizeOfRawData - AllignedRelocSize);
+ Optional32->SizeOfInitializedData -= (SectionHeader->SizeOfRawData - AllignedRelocSize);
+ SectionHeader->SizeOfRawData = AllignedRelocSize;
+ FileLength = Optional32->SizeOfImage;
+ DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %u", (unsigned) (SectionHeader->SizeOfRawData - AllignedRelocSize));
+ }
+ }
+ }
+ }
+ }
+ }
+ } else if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
+ Optional64 = (EFI_IMAGE_OPTIONAL_HEADER64 *)&PeHdr->Pe32.OptionalHeader;
+ if (!KeepOptionalHeaderFlag) {
+ Optional64->MajorOperatingSystemVersion = 0;
+ Optional64->MinorOperatingSystemVersion = 0;
+ Optional64->MajorImageVersion = 0;
+ Optional64->MinorImageVersion = 0;
+ Optional64->MajorSubsystemVersion = 0;
+ Optional64->MinorSubsystemVersion = 0;
+ Optional64->Win32VersionValue = 0;
+ Optional64->CheckSum = 0;
+ Optional64->SizeOfStackReserve = 0;
+ Optional64->SizeOfStackCommit = 0;
+ Optional64->SizeOfHeapReserve = 0;
+ Optional64->SizeOfHeapCommit = 0;
+ }
+ TEImageHeader.AddressOfEntryPoint = Optional64->AddressOfEntryPoint;
+ TEImageHeader.BaseOfCode = Optional64->BaseOfCode;
+ TEImageHeader.ImageBase = (UINT64) (Optional64->ImageBase);
+
+ if (Optional64->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
+ TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress;
+ TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size = Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
+ }
+
+ if (Optional64->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
+ TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress = Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
+ TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].Size = Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
+ }
+
+ //
+ // Zero the .pdata section for X64 machine and don't check the Debug Directory is empty
+ // For Itaninum and X64 Image, remove .pdata section.
+ //
+ if ((!KeepExceptionTableFlag && PeHdr->Pe32.FileHeader.Machine == IMAGE_FILE_MACHINE_X64)) {
+ if (Optional64->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION &&
+ Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION].VirtualAddress != 0 &&
+ Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION].Size != 0) {
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader);
+ for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index++, SectionHeader++) {
+ if (SectionHeader->VirtualAddress == Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION].VirtualAddress) {
+ //
+ // Zero .pdata Section header name
+ //
+ memset (SectionHeader->Name, 0, sizeof (SectionHeader->Name));
+
+ RuntimeFunction = (RUNTIME_FUNCTION *)(FileBuffer + SectionHeader->PointerToRawData);
+ for (Index1 = 0; Index1 < Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION].Size / sizeof (RUNTIME_FUNCTION); Index1++, RuntimeFunction++) {
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader);
+ for (Index2 = 0; Index2 < PeHdr->Pe32.FileHeader.NumberOfSections; Index2++, SectionHeader++) {
+ if (RuntimeFunction->UnwindInfoAddress >= SectionHeader->VirtualAddress && RuntimeFunction->UnwindInfoAddress < (SectionHeader->VirtualAddress + SectionHeader->SizeOfRawData)) {
+ UnwindInfo = (UNWIND_INFO *)(FileBuffer + SectionHeader->PointerToRawData + (RuntimeFunction->UnwindInfoAddress - SectionHeader->VirtualAddress));
+ if (UnwindInfo->Version == 1) {
+ memset (UnwindInfo + 1, 0, UnwindInfo->CountOfUnwindCodes * sizeof (UINT16));
+ memset (UnwindInfo, 0, sizeof (UNWIND_INFO));
+ }
+ break;
+ }
+ }
+ memset (RuntimeFunction, 0, sizeof (RUNTIME_FUNCTION));
+ }
+ //
+ // Zero Exception Table
+ //
+ Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION].Size = 0;
+ Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION].VirtualAddress = 0;
+ DebugMsg (NULL, 0, 9, "Zero the .pdata section if the machine type is X64 for PE32+ image", NULL);
+ break;
+ }
+ }
+ }
+ }
+
+ //
+ // Strip zero padding at the end of the .reloc section
+ //
+ if (!KeepZeroPendingFlag && Optional64->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
+ if (Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size != 0) {
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader);
+ for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index++, SectionHeader++) {
+ //
+ // Look for the Section Header that starts as the same virtual address as the Base Relocation Data Directory
+ //
+ if (SectionHeader->VirtualAddress == Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress) {
+ SectionHeader->Misc.VirtualSize = Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
+ AllignedRelocSize = (Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size + Optional64->FileAlignment - 1) & (~(Optional64->FileAlignment - 1));
+ //
+ // Check to see if there is zero padding at the end of the base relocations
+ //
+ if (AllignedRelocSize < SectionHeader->SizeOfRawData) {
+ //
+ // Check to see if the base relocations are at the end of the file
+ //
+ if (SectionHeader->PointerToRawData + SectionHeader->SizeOfRawData == Optional64->SizeOfImage) {
+ //
+ // All the required conditions are met to strip the zero padding of the end of the base relocations section
+ //
+ Optional64->SizeOfImage -= (SectionHeader->SizeOfRawData - AllignedRelocSize);
+ Optional64->SizeOfInitializedData -= (SectionHeader->SizeOfRawData - AllignedRelocSize);
+ SectionHeader->SizeOfRawData = AllignedRelocSize;
+ FileLength = Optional64->SizeOfImage;
+ DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %u", (unsigned) (SectionHeader->SizeOfRawData - AllignedRelocSize));
+ }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "Magic 0x%x of PeImage %s is unknown.", PeHdr->Pe32.OptionalHeader.Magic, mInImageName);
+ goto Finish;
+ }
+
+ if (((PeHdr->Pe32.FileHeader.Characteristics & EFI_IMAGE_FILE_RELOCS_STRIPPED) == 0) && \
+ (TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress == 0) && \
+ (TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size == 0)) {
+ //
+ // PeImage can be loaded into memory, but it has no relocation section.
+ // Fix TeImage Header to set VA of relocation data directory to not zero, the size is still zero.
+ //
+ if (Optional32 != NULL) {
+ TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = Optional32->SizeOfImage - sizeof (EFI_IMAGE_BASE_RELOCATION);
+ } else if (Optional64 != NULL) {
+ TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = Optional64->SizeOfImage - sizeof (EFI_IMAGE_BASE_RELOCATION);
+ }
+ }
+
+ //
+ // Fill HII section data
+ //
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader);
+ for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index++) {
+ if (stricmp ((char *)SectionHeader[Index].Name, ".hii") == 0) {
+ //
+ // Update resource section header offset
+ //
+ SetHiiResourceHeader ((UINT8*) FileBuffer + SectionHeader[Index].PointerToRawData, SectionHeader[Index].VirtualAddress);
+ //
+ // Update resource section name
+ //
+ strcpy((char *) SectionHeader[Index].Name, ".rsrc");
+ //
+ // Update resource data directory.
+ //
+ if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ Optional32 = (EFI_IMAGE_OPTIONAL_HEADER32 *)&PeHdr->Pe32.OptionalHeader;
+ Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = SectionHeader[Index].VirtualAddress;
+ Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = SectionHeader[Index].Misc.VirtualSize;
+ } else if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
+ Optional64 = (EFI_IMAGE_OPTIONAL_HEADER64 *)&PeHdr->Pe32.OptionalHeader;
+ Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = SectionHeader[Index].VirtualAddress;
+ Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = SectionHeader[Index].Misc.VirtualSize;
+ }
+ break;
+ }
+ }
+
+ //
+ // Zero ExceptionTable Xdata
+ //
+ if (!KeepExceptionTableFlag) {
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader);
+ for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index++) {
+ if (stricmp ((char *)SectionHeader[Index].Name, ".xdata") == 0) {
+ //
+ // zero .xdata section
+ //
+ memset (FileBuffer + SectionHeader[Index].PointerToRawData, 0, SectionHeader[Index].SizeOfRawData);
+ DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", (unsigned) SectionHeader[Index].PointerToRawData, (unsigned) SectionHeader[Index].SizeOfRawData);
+ break;
+ }
+ }
+ }
+
+ //
+ // Zero Time/Data field
+ //
+ ZeroDebugData (FileBuffer, ZeroDebugFlag);
+
+ if (mOutImageType == FW_TE_IMAGE) {
+ if ((PeHdr->Pe32.FileHeader.NumberOfSections &~0xFF) || (Type &~0xFF)) {
+ //
+ // Pack the subsystem and NumberOfSections into 1 byte. Make sure they fit both.
+ //
+ Error (NULL, 0, 3000, "Invalid", "Image's subsystem or NumberOfSections of PeImage %s cannot be packed into 1 byte.", mInImageName);
+ goto Finish;
+ }
+
+ if ((PeHdr->Pe32.OptionalHeader.SectionAlignment != PeHdr->Pe32.OptionalHeader.FileAlignment)) {
+ //
+ // TeImage has the same section alignment and file alignment.
+ //
+ Error (NULL, 0, 3000, "Invalid", "Section-Alignment and File-Alignment of PeImage %s do not match, they must be equal for a TeImage.", mInImageName);
+ goto Finish;
+ }
+
+ DebugMsg (NULL, 0, 9, "TeImage Header Info", "Machine type is %X, Number of sections is %X, Stripped size is %X, EntryPoint is %X, BaseOfCode is %X, ImageBase is %llX",
+ TEImageHeader.Machine, TEImageHeader.NumberOfSections, TEImageHeader.StrippedSize, (unsigned) TEImageHeader.AddressOfEntryPoint, (unsigned) TEImageHeader.BaseOfCode, (unsigned long long) TEImageHeader.ImageBase);
+ //
+ // Update Image to TeImage
+ //
+ FileLength = FileLength - TEImageHeader.StrippedSize;
+ memmove (FileBuffer + sizeof (EFI_TE_IMAGE_HEADER), FileBuffer + TEImageHeader.StrippedSize, FileLength);
+ FileLength = FileLength + sizeof (EFI_TE_IMAGE_HEADER);
+ memcpy (FileBuffer, &TEImageHeader, sizeof (EFI_TE_IMAGE_HEADER));
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) (FileLength));
+ } else {
+
+ //
+ // Following codes are to fix the objcopy's issue:
+ // objcopy in binutil 2.50.18 will set PE image's charactices to "RELOC_STRIPPED" if image has no ".reloc" section
+ // It cause issue for EFI image which has no ".reloc" sections.
+ // Following codes will be removed when objcopy in binutil fix this problem for PE image.
+ //
+ if ((PeHdr->Pe32.FileHeader.Characteristics & EFI_IMAGE_FILE_RELOCS_STRIPPED) != 0) {
+ if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ Optional32 = (EFI_IMAGE_OPTIONAL_HEADER32 *)&PeHdr->Pe32.OptionalHeader;
+ if (Optional32->ImageBase == 0) {
+ PeHdr->Pe32.FileHeader.Characteristics &= ~EFI_IMAGE_FILE_RELOCS_STRIPPED;
+ }
+ } else if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
+ Optional64 = (EFI_IMAGE_OPTIONAL_HEADER64 *)&PeHdr->Pe32.OptionalHeader;
+ if (Optional64->ImageBase == 0) {
+ PeHdr->Pe32.FileHeader.Characteristics &= ~EFI_IMAGE_FILE_RELOCS_STRIPPED;
+ }
+ }
+ }
+ }
+
+WriteFile:
+ //
+ // Update Image to EfiImage or TE image
+ //
+ if (ReplaceFlag) {
+ if ((FileLength != InputFileLength) || (memcmp (FileBuffer, InputFileBuffer, FileLength) != 0)) {
+ //
+ // Update File when File is changed.
+ //
+ fpInOut = fopen (LongFilePath (mInImageName), "wb");
+ if (fpInOut == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", mInImageName);
+ goto Finish;
+ }
+ fwrite (FileBuffer, 1, FileLength, fpInOut);
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
+ }
+ } else {
+ if ((OutputFileTime < InputFileTime) || (FileLength != OutputFileLength) || (memcmp (FileBuffer, OutputFileBuffer, FileLength) != 0)) {
+ //
+ // Update File when File is changed or File is old.
+ //
+ fpOut = fopen (LongFilePath (OutImageName), "wb");
+ if (fpOut == NULL) {
+ Error (NULL, 0, 0001, "Error opening output file", OutImageName);
+ goto Finish;
+ }
+ fwrite (FileBuffer, 1, FileLength, fpOut);
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
+ }
+ }
+ mImageSize = FileLength;
+
+Finish:
+ if (fpInOut != NULL) {
+ if (GetUtilityStatus () != STATUS_SUCCESS) {
+ //
+ // when file updates failed, original file is still recovered.
+ //
+ fwrite (InputFileBuffer, 1, InputFileLength, fpInOut);
+ }
+ //
+ // Write converted data into fpInOut file and close input file.
+ //
+ fclose (fpInOut);
+ }
+
+ if (FileBuffer != NULL) {
+ free (FileBuffer);
+ }
+
+ if (InputFileName != NULL) {
+ free (InputFileName);
+ }
+
+ if (fpOut != NULL) {
+ //
+ // Write converted data into fpOut file and close output file.
+ //
+ fclose (fpOut);
+ if (GetUtilityStatus () != STATUS_SUCCESS) {
+ if (OutputFileBuffer == NULL) {
+ remove (OutImageName);
+ } else {
+ fpOut = fopen (LongFilePath (OutImageName), "wb");
+ fwrite (OutputFileBuffer, 1, OutputFileLength, fpOut);
+ fclose (fpOut);
+ }
+ }
+ }
+
+ if (InputFileBuffer != NULL) {
+ free (InputFileBuffer);
+ }
+
+ if (OutputFileBuffer != NULL) {
+ free (OutputFileBuffer);
+ }
+
+ //
+ // Write module size and time stamp to report file.
+ //
+ if (OutImageName != NULL) {
+ FileLen = strlen (OutImageName);
+ }
+ if (FileLen >= 4 && strcmp (OutImageName + (FileLen - 4), ".efi") == 0) {
+ ReportFileName = (CHAR8 *) malloc (FileLen + 1);
+ if (ReportFileName != NULL) {
+ strcpy (ReportFileName, OutImageName);
+ strcpy (ReportFileName + (FileLen - 4), ".txt");
+ ReportFile = fopen (LongFilePath (ReportFileName), "w+");
+ if (ReportFile != NULL) {
+ fprintf (ReportFile, "MODULE_SIZE = %u\n", (unsigned) mImageSize);
+ fprintf (ReportFile, "TIME_STAMP = %u\n", (unsigned) mImageTimeStamp);
+ fclose(ReportFile);
+ }
+ free (ReportFileName);
+ }
+ }
+ VerboseMsg ("%s tool done with return code is 0x%x.", UTILITY_NAME, GetUtilityStatus ());
+
+ return GetUtilityStatus ();
+}
+
+STATIC
+EFI_STATUS
+ZeroDebugData (
+ IN OUT UINT8 *FileBuffer,
+ BOOLEAN ZeroDebugFlag
+ )
+/*++
+
+Routine Description:
+
+ Zero debug information in PeImage.
+
+Arguments:
+
+ FileBuffer - Pointer to PeImage.
+ ZeroDebugFlag - TRUE to zero Debug information, FALSE to only zero time/stamp
+
+Returns:
+
+ EFI_ABORTED - PeImage is invalid.
+ EFI_SUCCESS - Zero debug data successfully.
+
+--*/
+{
+ UINT32 Index;
+ UINT32 DebugDirectoryEntryRva;
+ UINT32 DebugDirectoryEntrySize;
+ UINT32 DebugDirectoryEntryFileOffset;
+ UINT32 ExportDirectoryEntryRva;
+ UINT32 ExportDirectoryEntryFileOffset;
+ UINT32 ResourceDirectoryEntryRva;
+ UINT32 ResourceDirectoryEntryFileOffset;
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_FILE_HEADER *FileHdr;
+ EFI_IMAGE_OPTIONAL_HEADER32 *Optional32Hdr;
+ EFI_IMAGE_OPTIONAL_HEADER64 *Optional64Hdr;
+ EFI_IMAGE_SECTION_HEADER *SectionHeader;
+ EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
+ EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY *RsdsEntry;
+ UINT32 *NewTimeStamp;
+
+ //
+ // Init variable.
+ //
+ DebugDirectoryEntryRva = 0;
+ DebugDirectoryEntrySize = 0;
+ ExportDirectoryEntryRva = 0;
+ ResourceDirectoryEntryRva = 0;
+ DebugDirectoryEntryFileOffset = 0;
+ ExportDirectoryEntryFileOffset = 0;
+ ResourceDirectoryEntryFileOffset = 0;
+ DosHdr = (EFI_IMAGE_DOS_HEADER *) FileBuffer;
+ FileHdr = (EFI_IMAGE_FILE_HEADER *) (FileBuffer + DosHdr->e_lfanew + sizeof (UINT32));
+
+
+ DosHdr = (EFI_IMAGE_DOS_HEADER *)FileBuffer;
+ if (DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
+ // NO DOS header, must start with PE/COFF header
+ FileHdr = (EFI_IMAGE_FILE_HEADER *)(FileBuffer + sizeof (UINT32));
+ } else {
+ FileHdr = (EFI_IMAGE_FILE_HEADER *)(FileBuffer + DosHdr->e_lfanew + sizeof (UINT32));
+ }
+
+ //
+ // Get Debug, Export and Resource EntryTable RVA address.
+ // Resource Directory entry need to review.
+ //
+ Optional32Hdr = (EFI_IMAGE_OPTIONAL_HEADER32 *) ((UINT8*) FileHdr + sizeof (EFI_IMAGE_FILE_HEADER));
+ Optional64Hdr = (EFI_IMAGE_OPTIONAL_HEADER64 *) ((UINT8*) FileHdr + sizeof (EFI_IMAGE_FILE_HEADER));
+ if (Optional32Hdr->Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) Optional32Hdr + FileHdr->SizeOfOptionalHeader);
+ if (Optional32Hdr->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_EXPORT && \
+ Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT].Size != 0) {
+ ExportDirectoryEntryRva = Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
+ }
+ if (Optional32Hdr->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE && \
+ Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].Size != 0) {
+ ResourceDirectoryEntryRva = Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress;
+ }
+ if (Optional32Hdr->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG && \
+ Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size != 0) {
+ DebugDirectoryEntryRva = Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
+ DebugDirectoryEntrySize = Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
+ if (ZeroDebugFlag) {
+ Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size = 0;
+ Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress = 0;
+ }
+ }
+ } else {
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) Optional64Hdr + FileHdr->SizeOfOptionalHeader);
+ if (Optional64Hdr->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_EXPORT && \
+ Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT].Size != 0) {
+ ExportDirectoryEntryRva = Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
+ }
+ if (Optional64Hdr->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE && \
+ Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].Size != 0) {
+ ResourceDirectoryEntryRva = Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress;
+ }
+ if (Optional64Hdr->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG && \
+ Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size != 0) {
+ DebugDirectoryEntryRva = Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
+ DebugDirectoryEntrySize = Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
+ if (ZeroDebugFlag) {
+ Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size = 0;
+ Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress = 0;
+ }
+ }
+ }
+
+ //
+ // Get DirectoryEntryTable file offset.
+ //
+ for (Index = 0; Index < FileHdr->NumberOfSections; Index ++, SectionHeader ++) {
+ if (DebugDirectoryEntryRva >= SectionHeader->VirtualAddress &&
+ DebugDirectoryEntryRva < SectionHeader->VirtualAddress + SectionHeader->Misc.VirtualSize) {
+ DebugDirectoryEntryFileOffset =
+ DebugDirectoryEntryRva - SectionHeader->VirtualAddress + SectionHeader->PointerToRawData;
+ }
+ if (ExportDirectoryEntryRva >= SectionHeader->VirtualAddress &&
+ ExportDirectoryEntryRva < SectionHeader->VirtualAddress + SectionHeader->Misc.VirtualSize) {
+ ExportDirectoryEntryFileOffset =
+ ExportDirectoryEntryRva - SectionHeader->VirtualAddress + SectionHeader->PointerToRawData;
+ }
+ if (ResourceDirectoryEntryRva >= SectionHeader->VirtualAddress &&
+ ResourceDirectoryEntryRva < SectionHeader->VirtualAddress + SectionHeader->Misc.VirtualSize) {
+ ResourceDirectoryEntryFileOffset =
+ ResourceDirectoryEntryRva - SectionHeader->VirtualAddress + SectionHeader->PointerToRawData;
+ }
+ }
+
+ //
+ //Zero Debug Data and TimeStamp
+ //
+ FileHdr->TimeDateStamp = 0;
+ mImageTimeStamp = 0;
+ if (ExportDirectoryEntryFileOffset != 0) {
+ NewTimeStamp = (UINT32 *) (FileBuffer + ExportDirectoryEntryFileOffset + sizeof (UINT32));
+ *NewTimeStamp = 0;
+ }
+
+ if (ResourceDirectoryEntryFileOffset != 0) {
+ NewTimeStamp = (UINT32 *) (FileBuffer + ResourceDirectoryEntryFileOffset + sizeof (UINT32));
+ *NewTimeStamp = 0;
+ }
+
+ if (DebugDirectoryEntryFileOffset != 0) {
+ DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (FileBuffer + DebugDirectoryEntryFileOffset);
+ Index = 0;
+ for (Index=0; Index < DebugDirectoryEntrySize / sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); Index ++, DebugEntry ++) {
+ DebugEntry->TimeDateStamp = 0;
+ if (mIsConvertXip) {
+ DebugEntry->FileOffset = DebugEntry->RVA;
+ }
+ if (ZeroDebugFlag || DebugEntry->Type != EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
+ memset (FileBuffer + DebugEntry->FileOffset, 0, DebugEntry->SizeOfData);
+ memset (DebugEntry, 0, sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY));
+ }
+ if (DebugEntry->Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
+ RsdsEntry = (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY *) (FileBuffer + DebugEntry->FileOffset);
+ if (RsdsEntry->Signature == CODEVIEW_SIGNATURE_MTOC) {
+ // MTOC sets DebugDirectoryEntrySize to size of the .debug section, so fix it.
+ if (!ZeroDebugFlag) {
+ if (Optional32Hdr->Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+ } else {
+ Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+STATIC
+EFI_STATUS
+SetStamp (
+ IN OUT UINT8 *FileBuffer,
+ IN CHAR8 *TimeStamp
+ )
+/*++
+
+Routine Description:
+
+ Set new time stamp into PeImage FileHdr and Directory table:
+ Debug, Export and Resource.
+
+Arguments:
+
+ FileBuffer - Pointer to PeImage.
+ TimeStamp - Time stamp string.
+
+Returns:
+
+ EFI_INVALID_PARAMETER - TimeStamp format is not recognized.
+ EFI_SUCCESS - Set new time stamp in this image successfully.
+
+--*/
+{
+ struct tm stime;
+ struct tm *ptime;
+ time_t newtime;
+ UINT32 Index;
+ UINT32 DebugDirectoryEntryRva;
+ UINT32 DebugDirectoryEntryFileOffset;
+ UINT32 ExportDirectoryEntryRva;
+ UINT32 ExportDirectoryEntryFileOffset;
+ UINT32 ResourceDirectoryEntryRva;
+ UINT32 ResourceDirectoryEntryFileOffset;
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_FILE_HEADER *FileHdr;
+ EFI_IMAGE_OPTIONAL_HEADER32 *Optional32Hdr;
+ EFI_IMAGE_OPTIONAL_HEADER64 *Optional64Hdr;
+ EFI_IMAGE_SECTION_HEADER *SectionHeader;
+ UINT32 *NewTimeStamp;
+
+ //
+ // Init variable.
+ //
+ DebugDirectoryEntryRva = 0;
+ DebugDirectoryEntryFileOffset = 0;
+ ExportDirectoryEntryRva = 0;
+ ExportDirectoryEntryFileOffset = 0;
+ ResourceDirectoryEntryRva = 0;
+ ResourceDirectoryEntryFileOffset = 0;
+ //
+ // Get time and date that will be set.
+ //
+ if (TimeStamp == NULL) {
+ Error (NULL, 0, 3000, "Invalid", "TimeStamp cannot be NULL.");
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // compare the value with "NOW", if yes, current system time is set.
+ //
+ if (stricmp (TimeStamp, "NOW") == 0) {
+ //
+ // get system current time and date
+ //
+ time (&newtime);
+ } else {
+ //
+ // Check Time Format strictly yyyy-mm-dd 00:00:00
+ //
+ for (Index = 0; TimeStamp[Index] != '\0' && Index < 20; Index ++) {
+ if (Index == 4 || Index == 7) {
+ if (TimeStamp[Index] == '-') {
+ continue;
+ }
+ } else if (Index == 13 || Index == 16) {
+ if (TimeStamp[Index] == ':') {
+ continue;
+ }
+ } else if (Index == 10 && TimeStamp[Index] == ' ') {
+ continue;
+ } else if ((TimeStamp[Index] < '0') || (TimeStamp[Index] > '9')) {
+ break;
+ }
+ }
+
+ if (Index < 19 || TimeStamp[19] != '\0') {
+ Error (NULL, 0, 1003, "Invalid option value", "Incorrect Time \"%s\"\n Correct Format \"yyyy-mm-dd 00:00:00\"", TimeStamp);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // get the date and time from TimeStamp
+ //
+ if (sscanf (TimeStamp, "%d-%d-%d %d:%d:%d",
+ &stime.tm_year,
+ &stime.tm_mon,
+ &stime.tm_mday,
+ &stime.tm_hour,
+ &stime.tm_min,
+ &stime.tm_sec
+ ) != 6) {
+ Error (NULL, 0, 1003, "Invalid option value", "Incorrect Tiem \"%s\"\n Correct Format \"yyyy-mm-dd 00:00:00\"", TimeStamp);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // in struct, Month (0 - 11; Jan = 0). So decrease 1 from it
+ //
+ if (stime.tm_mon <= 0 || stime.tm_mday <=0) {
+ Error (NULL, 0, 3000, "Invalid", "%s Invalid date!", TimeStamp);
+ return EFI_INVALID_PARAMETER;
+ }
+ stime.tm_mon -= 1;
+
+ //
+ // in struct, Year (current year minus 1900)
+ // and only the dates can be handled from Jan 1, 1970 to Jan 18, 2038
+ //
+ //
+ // convert 0 -> 100 (2000), 1 -> 101 (2001), ..., 38 -> 138 (2038)
+ //
+ if (stime.tm_year >= 1970 && stime.tm_year <= 2038) {
+ //
+ // convert 1970 -> 70, 2000 -> 100, ...
+ //
+ stime.tm_year -= 1900;
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "%s Invalid or unsupported datetime!", TimeStamp);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // convert the date and time to time_t format
+ //
+ newtime = mktime (&stime);
+ if (newtime == (time_t) - 1) {
+ Error (NULL, 0, 3000, "Invalid", "%s Invalid or unsupported datetime!", TimeStamp);
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ ptime = localtime (&newtime);
+ if (ptime != NULL) {
+ DebugMsg (NULL, 0, 9, "New Image Time Stamp", "%04d-%02d-%02d %02d:%02d:%02d",
+ ptime->tm_year + 1900, ptime->tm_mon + 1, ptime->tm_mday, ptime->tm_hour, ptime->tm_min, ptime->tm_sec);
+ }
+ //
+ // Set new time and data into PeImage.
+ //
+ DosHdr = (EFI_IMAGE_DOS_HEADER *)FileBuffer;
+ if (DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
+ // NO DOS header, must start with PE/COFF header
+ FileHdr = (EFI_IMAGE_FILE_HEADER *)(FileBuffer + sizeof (UINT32));
+ } else {
+ FileHdr = (EFI_IMAGE_FILE_HEADER *)(FileBuffer + DosHdr->e_lfanew + sizeof (UINT32));
+ }
+
+ //
+ // Get Debug, Export and Resource EntryTable RVA address.
+ // Resource Directory entry need to review.
+ //
+ if (FileHdr->Machine == EFI_IMAGE_MACHINE_IA32) {
+ Optional32Hdr = (EFI_IMAGE_OPTIONAL_HEADER32 *) ((UINT8*) FileHdr + sizeof (EFI_IMAGE_FILE_HEADER));
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) Optional32Hdr + FileHdr->SizeOfOptionalHeader);
+ if (Optional32Hdr->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_EXPORT && \
+ Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT].Size != 0) {
+ ExportDirectoryEntryRva = Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
+ }
+ if (Optional32Hdr->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE && \
+ Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].Size != 0) {
+ ResourceDirectoryEntryRva = Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress;
+ }
+ if (Optional32Hdr->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG && \
+ Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size != 0) {
+ DebugDirectoryEntryRva = Optional32Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
+ }
+ } else {
+ Optional64Hdr = (EFI_IMAGE_OPTIONAL_HEADER64 *) ((UINT8*) FileHdr + sizeof (EFI_IMAGE_FILE_HEADER));
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) Optional64Hdr + FileHdr->SizeOfOptionalHeader);
+ if (Optional64Hdr->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_EXPORT && \
+ Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT].Size != 0) {
+ ExportDirectoryEntryRva = Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
+ }
+ if (Optional64Hdr->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE && \
+ Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].Size != 0) {
+ ResourceDirectoryEntryRva = Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress;
+ }
+ if (Optional64Hdr->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG && \
+ Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size != 0) {
+ DebugDirectoryEntryRva = Optional64Hdr->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
+ }
+ }
+
+ //
+ // Get DirectoryEntryTable file offset.
+ //
+ for (Index = 0; Index < FileHdr->NumberOfSections; Index ++, SectionHeader ++) {
+ if (DebugDirectoryEntryRva >= SectionHeader->VirtualAddress &&
+ DebugDirectoryEntryRva < SectionHeader->VirtualAddress + SectionHeader->Misc.VirtualSize) {
+ DebugDirectoryEntryFileOffset =
+ DebugDirectoryEntryRva - SectionHeader->VirtualAddress + SectionHeader->PointerToRawData;
+ }
+ if (ExportDirectoryEntryRva >= SectionHeader->VirtualAddress &&
+ ExportDirectoryEntryRva < SectionHeader->VirtualAddress + SectionHeader->Misc.VirtualSize) {
+ ExportDirectoryEntryFileOffset =
+ ExportDirectoryEntryRva - SectionHeader->VirtualAddress + SectionHeader->PointerToRawData;
+ }
+ if (ResourceDirectoryEntryRva >= SectionHeader->VirtualAddress &&
+ ResourceDirectoryEntryRva < SectionHeader->VirtualAddress + SectionHeader->Misc.VirtualSize) {
+ ResourceDirectoryEntryFileOffset =
+ ResourceDirectoryEntryRva - SectionHeader->VirtualAddress + SectionHeader->PointerToRawData;
+ }
+ }
+
+ //
+ // Set new stamp
+ //
+ FileHdr->TimeDateStamp = (UINT32) newtime;
+ mImageTimeStamp = (UINT32) newtime;
+ if (ExportDirectoryEntryRva != 0) {
+ NewTimeStamp = (UINT32 *) (FileBuffer + ExportDirectoryEntryFileOffset + sizeof (UINT32));
+ *NewTimeStamp = (UINT32) newtime;
+ }
+
+ if (ResourceDirectoryEntryRva != 0) {
+ NewTimeStamp = (UINT32 *) (FileBuffer + ResourceDirectoryEntryFileOffset + sizeof (UINT32));
+ *NewTimeStamp = (UINT32) newtime;
+ }
+
+ if (DebugDirectoryEntryRva != 0) {
+ NewTimeStamp = (UINT32 *) (FileBuffer + DebugDirectoryEntryFileOffset + sizeof (UINT32));
+ *NewTimeStamp = (UINT32) newtime;
+ }
+
+ return EFI_SUCCESS;
+}
+
+STATIC
+STATUS
+MicrocodeReadData (
+ FILE *InFptr,
+ UINT32 *Data
+ )
+/*++
+
+Routine Description:
+ Read a 32-bit microcode data value from a text file and convert to raw binary form.
+
+Arguments:
+ InFptr - file pointer to input text file
+ Data - pointer to where to return the data parsed
+
+Returns:
+ STATUS_SUCCESS - no errors or warnings, Data contains valid information
+ STATUS_ERROR - errors were encountered
+
+--*/
+{
+ CHAR8 Line[MAX_LINE_LEN];
+ CHAR8 *cptr;
+ int ScannedData = 0;
+
+ Line[MAX_LINE_LEN - 1] = 0;
+ while (1) {
+ if (fgets (Line, MAX_LINE_LEN, InFptr) == NULL) {
+ return STATUS_ERROR;
+ }
+ //
+ // If it was a binary file, then it may have overwritten our null terminator
+ //
+ if (Line[MAX_LINE_LEN - 1] != 0) {
+ return STATUS_ERROR;
+ }
+
+ //
+ // strip space
+ //
+ for (cptr = Line; *cptr && isspace((int)*cptr); cptr++) {
+ }
+
+ // Skip Blank Lines and Comment Lines
+ if ((strlen(cptr) != 0) && (*cptr != ';')) {
+ break;
+ }
+ }
+
+ // Look for
+ // dd 000000001h ; comment
+ // dd XXXXXXXX
+ // DD XXXXXXXXX
+ // DD XXXXXXXXX
+ //
+ if ((tolower((int)cptr[0]) == 'd') && (tolower((int)cptr[1]) == 'd') && isspace ((int)cptr[2])) {
+ //
+ // Skip blanks and look for a hex digit
+ //
+ cptr += 3;
+ for (; *cptr && isspace((int)*cptr); cptr++) {
+ }
+ if (isxdigit ((int)*cptr)) {
+ if (sscanf (cptr, "%X", &ScannedData) != 1) {
+ return STATUS_ERROR;
+ }
+ }
+ *Data = (UINT32) ScannedData;
+ return STATUS_SUCCESS;
+ }
+
+ return STATUS_ERROR;
+}
diff --git a/roms/edk2/BaseTools/Source/C/GenFw/GenFw.h b/roms/edk2/BaseTools/Source/C/GenFw/GenFw.h
new file mode 100644
index 000000000..469017602
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFw/GenFw.h
@@ -0,0 +1,50 @@
+/** @file
+Header file for GenFw
+
+Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _GEN_FW_H_
+#define _GEN_FW_H_
+
+//
+// Action for this tool.
+//
+#define FW_DUMMY_IMAGE 0
+#define FW_EFI_IMAGE 1
+#define FW_TE_IMAGE 2
+#define FW_ACPI_IMAGE 3
+#define FW_BIN_IMAGE 4
+#define FW_ZERO_DEBUG_IMAGE 5
+#define FW_SET_STAMP_IMAGE 6
+#define FW_MCI_IMAGE 7
+#define FW_MERGE_IMAGE 8
+#define FW_RELOC_STRIPEED_IMAGE 9
+#define FW_HII_PACKAGE_LIST_RCIMAGE 10
+#define FW_HII_PACKAGE_LIST_BINIMAGE 11
+#define FW_REBASE_IMAGE 12
+#define FW_SET_ADDRESS_IMAGE 13
+
+#define DUMP_TE_HEADER 0x11
+
+VOID
+SetHiiResourceHeader (
+ UINT8 *HiiBinData,
+ UINT32 OffsetToFile
+ );
+
+INTN
+IsElfHeader (
+ UINT8 *FileBuffer
+ );
+
+BOOLEAN
+ConvertElf (
+ UINT8 **FileBuffer,
+ UINT32 *FileLength
+ );
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/GenFw/Makefile b/roms/edk2/BaseTools/Source/C/GenFw/Makefile
new file mode 100644
index 000000000..08626c8f3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFw/Makefile
@@ -0,0 +1,18 @@
+## @file
+# Windows makefile for 'GenFw' module build.
+#
+# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+APPNAME = GenFw
+
+LIBS = $(LIB_PATH)\Common.lib
+
+OBJECTS = GenFw.obj ElfConvert.obj Elf32Convert.obj Elf64Convert.obj
+
+#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
+
+!INCLUDE ..\Makefiles\ms.app
+
diff --git a/roms/edk2/BaseTools/Source/C/GenFw/elf32.h b/roms/edk2/BaseTools/Source/C/GenFw/elf32.h
new file mode 100644
index 000000000..e8a56ff34
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFw/elf32.h
@@ -0,0 +1,252 @@
+/** @file
+Ported ELF include files from FreeBSD
+
+Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+
+**/
+/*-
+ * Copyright (c) 1996-1998 John D. Polstra.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/sys/sys/elf32.h,v 1.8.14.2 2007/12/03 21:30:36 marius Exp $
+ */
+
+#ifndef _SYS_ELF32_H_
+#define _SYS_ELF32_H_ 1
+
+
+/*
+ * ELF definitions common to all 32-bit architectures.
+ */
+
+typedef UINT32 Elf32_Addr;
+typedef UINT16 Elf32_Half;
+typedef UINT32 Elf32_Off;
+typedef INT32 Elf32_Sword;
+typedef UINT32 Elf32_Word;
+typedef UINT64 Elf32_Lword;
+
+typedef Elf32_Word Elf32_Hashelt;
+
+/* Non-standard class-dependent datatype used for abstraction. */
+typedef Elf32_Word Elf32_Size;
+typedef Elf32_Sword Elf32_Ssize;
+
+/*
+ * ELF header.
+ */
+
+typedef struct {
+ unsigned char e_ident[EI_NIDENT]; /* File identification. */
+ Elf32_Half e_type; /* File type. */
+ Elf32_Half e_machine; /* Machine architecture. */
+ Elf32_Word e_version; /* ELF format version. */
+ Elf32_Addr e_entry; /* Entry point. */
+ Elf32_Off e_phoff; /* Program header file offset. */
+ Elf32_Off e_shoff; /* Section header file offset. */
+ Elf32_Word e_flags; /* Architecture-specific flags. */
+ Elf32_Half e_ehsize; /* Size of ELF header in bytes. */
+ Elf32_Half e_phentsize; /* Size of program header entry. */
+ Elf32_Half e_phnum; /* Number of program header entries. */
+ Elf32_Half e_shentsize; /* Size of section header entry. */
+ Elf32_Half e_shnum; /* Number of section header entries. */
+ Elf32_Half e_shstrndx; /* Section name strings section. */
+} Elf32_Ehdr;
+
+/*
+ * Section header.
+ */
+
+typedef struct {
+ Elf32_Word sh_name; /* Section name (index into the
+ section header string table). */
+ Elf32_Word sh_type; /* Section type. */
+ Elf32_Word sh_flags; /* Section flags. */
+ Elf32_Addr sh_addr; /* Address in memory image. */
+ Elf32_Off sh_offset; /* Offset in file. */
+ Elf32_Word sh_size; /* Size in bytes. */
+ Elf32_Word sh_link; /* Index of a related section. */
+ Elf32_Word sh_info; /* Depends on section type. */
+ Elf32_Word sh_addralign; /* Alignment in bytes. */
+ Elf32_Word sh_entsize; /* Size of each entry in section. */
+} Elf32_Shdr;
+
+/*
+ * Program header.
+ */
+
+typedef struct {
+ Elf32_Word p_type; /* Entry type. */
+ Elf32_Off p_offset; /* File offset of contents. */
+ Elf32_Addr p_vaddr; /* Virtual address in memory image. */
+ Elf32_Addr p_paddr; /* Physical address (not used). */
+ Elf32_Word p_filesz; /* Size of contents in file. */
+ Elf32_Word p_memsz; /* Size of contents in memory. */
+ Elf32_Word p_flags; /* Access permission flags. */
+ Elf32_Word p_align; /* Alignment in memory and file. */
+} Elf32_Phdr;
+
+/*
+ * Dynamic structure. The ".dynamic" section contains an array of them.
+ */
+
+typedef struct {
+ Elf32_Sword d_tag; /* Entry type. */
+ union {
+ Elf32_Word d_val; /* Integer value. */
+ Elf32_Addr d_ptr; /* Address value. */
+ } d_un;
+} Elf32_Dyn;
+
+/*
+ * Relocation entries.
+ */
+
+/* Relocations that don't need an addend field. */
+typedef struct {
+ Elf32_Addr r_offset; /* Location to be relocated. */
+ Elf32_Word r_info; /* Relocation type and symbol index. */
+} Elf32_Rel;
+
+/* Relocations that need an addend field. */
+typedef struct {
+ Elf32_Addr r_offset; /* Location to be relocated. */
+ Elf32_Word r_info; /* Relocation type and symbol index. */
+ Elf32_Sword r_addend; /* Addend. */
+} Elf32_Rela;
+
+/* Macros for accessing the fields of r_info. */
+#define ELF32_R_SYM(info) ((info) >> 8)
+#define ELF32_R_TYPE(info) ((unsigned char)(info))
+
+/* Macro for constructing r_info from field values. */
+#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
+
+/*
+ * Note entry header
+ */
+typedef Elf_Note Elf32_Nhdr;
+
+/*
+ * Move entry
+ */
+typedef struct {
+ Elf32_Lword m_value; /* symbol value */
+ Elf32_Word m_info; /* size + index */
+ Elf32_Word m_poffset; /* symbol offset */
+ Elf32_Half m_repeat; /* repeat count */
+ Elf32_Half m_stride; /* stride info */
+} Elf32_Move;
+
+/*
+ * The macros compose and decompose values for Move.r_info
+ *
+ * sym = ELF32_M_SYM(M.m_info)
+ * size = ELF32_M_SIZE(M.m_info)
+ * M.m_info = ELF32_M_INFO(sym, size)
+ */
+#define ELF32_M_SYM(info) ((info)>>8)
+#define ELF32_M_SIZE(info) ((unsigned char)(info))
+#define ELF32_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
+
+/*
+ * Hardware/Software capabilities entry
+ */
+typedef struct {
+ Elf32_Word c_tag; /* how to interpret value */
+ union {
+ Elf32_Word c_val;
+ Elf32_Addr c_ptr;
+ } c_un;
+} Elf32_Cap;
+
+/*
+ * Symbol table entries.
+ */
+
+typedef struct {
+ Elf32_Word st_name; /* String table index of name. */
+ Elf32_Addr st_value; /* Symbol value. */
+ Elf32_Word st_size; /* Size of associated object. */
+ unsigned char st_info; /* Type and binding information. */
+ unsigned char st_other; /* Reserved (not used). */
+ Elf32_Half st_shndx; /* Section index of symbol. */
+} Elf32_Sym;
+
+/* Macros for accessing the fields of st_info. */
+#define ELF32_ST_BIND(info) ((info) >> 4)
+#define ELF32_ST_TYPE(info) ((info) & 0xf)
+
+/* Macro for constructing st_info from field values. */
+#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
+
+/* Macro for accessing the fields of st_other. */
+#define ELF32_ST_VISIBILITY(oth) ((oth) & 0x3)
+
+/* Structures used by Sun & GNU symbol versioning. */
+typedef struct
+{
+ Elf32_Half vd_version;
+ Elf32_Half vd_flags;
+ Elf32_Half vd_ndx;
+ Elf32_Half vd_cnt;
+ Elf32_Word vd_hash;
+ Elf32_Word vd_aux;
+ Elf32_Word vd_next;
+} Elf32_Verdef;
+
+typedef struct
+{
+ Elf32_Word vda_name;
+ Elf32_Word vda_next;
+} Elf32_Verdaux;
+
+typedef struct
+{
+ Elf32_Half vn_version;
+ Elf32_Half vn_cnt;
+ Elf32_Word vn_file;
+ Elf32_Word vn_aux;
+ Elf32_Word vn_next;
+} Elf32_Verneed;
+
+typedef struct
+{
+ Elf32_Word vna_hash;
+ Elf32_Half vna_flags;
+ Elf32_Half vna_other;
+ Elf32_Word vna_name;
+ Elf32_Word vna_next;
+} Elf32_Vernaux;
+
+typedef Elf32_Half Elf32_Versym;
+
+typedef struct {
+ Elf32_Half si_boundto; /* direct bindings - symbol bound to */
+ Elf32_Half si_flags; /* per symbol flags */
+} Elf32_Syminfo;
+
+#endif /* !_SYS_ELF32_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/GenFw/elf64.h b/roms/edk2/BaseTools/Source/C/GenFw/elf64.h
new file mode 100644
index 000000000..1ec0c2b29
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFw/elf64.h
@@ -0,0 +1,254 @@
+/** @file
+Ported ELF include files from FreeBSD
+
+Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+/*-
+ * Copyright (c) 1996-1998 John D. Polstra.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.2 2007/12/03 21:30:36 marius Exp $
+ */
+
+#ifndef _SYS_ELF64_H_
+#define _SYS_ELF64_H_ 1
+
+
+/*
+ * ELF definitions common to all 64-bit architectures.
+ */
+
+typedef UINT64 Elf64_Addr;
+typedef UINT16 Elf64_Half;
+typedef UINT64 Elf64_Off;
+typedef INT32 Elf64_Sword;
+typedef INT64 Elf64_Sxword;
+typedef UINT32 Elf64_Word;
+typedef UINT64 Elf64_Lword;
+typedef UINT64 Elf64_Xword;
+
+/*
+ * Types of dynamic symbol hash table bucket and chain elements.
+ *
+ * This is inconsistent among 64 bit architectures, so a machine dependent
+ * typedef is required.
+ */
+
+typedef Elf64_Word Elf64_Hashelt;
+
+/* Non-standard class-dependent datatype used for abstraction. */
+typedef Elf64_Xword Elf64_Size;
+typedef Elf64_Sxword Elf64_Ssize;
+
+/*
+ * ELF header.
+ */
+
+typedef struct {
+ unsigned char e_ident[EI_NIDENT]; /* File identification. */
+ Elf64_Half e_type; /* File type. */
+ Elf64_Half e_machine; /* Machine architecture. */
+ Elf64_Word e_version; /* ELF format version. */
+ Elf64_Addr e_entry; /* Entry point. */
+ Elf64_Off e_phoff; /* Program header file offset. */
+ Elf64_Off e_shoff; /* Section header file offset. */
+ Elf64_Word e_flags; /* Architecture-specific flags. */
+ Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
+ Elf64_Half e_phentsize; /* Size of program header entry. */
+ Elf64_Half e_phnum; /* Number of program header entries. */
+ Elf64_Half e_shentsize; /* Size of section header entry. */
+ Elf64_Half e_shnum; /* Number of section header entries. */
+ Elf64_Half e_shstrndx; /* Section name strings section. */
+} Elf64_Ehdr;
+
+/*
+ * Section header.
+ */
+
+typedef struct {
+ Elf64_Word sh_name; /* Section name (index into the
+ section header string table). */
+ Elf64_Word sh_type; /* Section type. */
+ Elf64_Xword sh_flags; /* Section flags. */
+ Elf64_Addr sh_addr; /* Address in memory image. */
+ Elf64_Off sh_offset; /* Offset in file. */
+ Elf64_Xword sh_size; /* Size in bytes. */
+ Elf64_Word sh_link; /* Index of a related section. */
+ Elf64_Word sh_info; /* Depends on section type. */
+ Elf64_Xword sh_addralign; /* Alignment in bytes. */
+ Elf64_Xword sh_entsize; /* Size of each entry in section. */
+} Elf64_Shdr;
+
+/*
+ * Program header.
+ */
+
+typedef struct {
+ Elf64_Word p_type; /* Entry type. */
+ Elf64_Word p_flags; /* Access permission flags. */
+ Elf64_Off p_offset; /* File offset of contents. */
+ Elf64_Addr p_vaddr; /* Virtual address in memory image. */
+ Elf64_Addr p_paddr; /* Physical address (not used). */
+ Elf64_Xword p_filesz; /* Size of contents in file. */
+ Elf64_Xword p_memsz; /* Size of contents in memory. */
+ Elf64_Xword p_align; /* Alignment in memory and file. */
+} Elf64_Phdr;
+
+/*
+ * Dynamic structure. The ".dynamic" section contains an array of them.
+ */
+
+typedef struct {
+ Elf64_Sxword d_tag; /* Entry type. */
+ union {
+ Elf64_Xword d_val; /* Integer value. */
+ Elf64_Addr d_ptr; /* Address value. */
+ } d_un;
+} Elf64_Dyn;
+
+/*
+ * Relocation entries.
+ */
+
+/* Relocations that don't need an addend field. */
+typedef struct {
+ Elf64_Addr r_offset; /* Location to be relocated. */
+ Elf64_Xword r_info; /* Relocation type and symbol index. */
+} Elf64_Rel;
+
+/* Relocations that need an addend field. */
+typedef struct {
+ Elf64_Addr r_offset; /* Location to be relocated. */
+ Elf64_Xword r_info; /* Relocation type and symbol index. */
+ Elf64_Sxword r_addend; /* Addend. */
+} Elf64_Rela;
+
+/* Macros for accessing the fields of r_info. */
+#define ELF64_R_SYM(info) ((info) >> 32)
+#define ELF64_R_TYPE(info) ((info) & 0xffffffffL)
+
+/* Macro for constructing r_info from field values. */
+#define ELF64_R_INFO(sym, type) (((sym) << 32) + ((type) & 0xffffffffL))
+
+#define ELF64_R_TYPE_DATA(info) (((Elf64_Xword)(info)<<32)>>40)
+#define ELF64_R_TYPE_ID(info) (((Elf64_Xword)(info)<<56)>>56)
+#define ELF64_R_TYPE_INFO(data, type) \
+ (((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
+
+/*
+ * Note entry header
+ */
+typedef Elf_Note Elf64_Nhdr;
+
+/*
+ * Move entry
+ */
+typedef struct {
+ Elf64_Lword m_value; /* symbol value */
+ Elf64_Xword m_info; /* size + index */
+ Elf64_Xword m_poffset; /* symbol offset */
+ Elf64_Half m_repeat; /* repeat count */
+ Elf64_Half m_stride; /* stride info */
+} Elf64_Move;
+
+#define ELF64_M_SYM(info) ((info)>>8)
+#define ELF64_M_SIZE(info) ((unsigned char)(info))
+#define ELF64_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
+
+/*
+ * Hardware/Software capabilities entry
+ */
+typedef struct {
+ Elf64_Xword c_tag; /* how to interpret value */
+ union {
+ Elf64_Xword c_val;
+ Elf64_Addr c_ptr;
+ } c_un;
+} Elf64_Cap;
+
+/*
+ * Symbol table entries.
+ */
+
+typedef struct {
+ Elf64_Word st_name; /* String table index of name. */
+ unsigned char st_info; /* Type and binding information. */
+ unsigned char st_other; /* Reserved (not used). */
+ Elf64_Half st_shndx; /* Section index of symbol. */
+ Elf64_Addr st_value; /* Symbol value. */
+ Elf64_Xword st_size; /* Size of associated object. */
+} Elf64_Sym;
+
+/* Macros for accessing the fields of st_info. */
+#define ELF64_ST_BIND(info) ((info) >> 4)
+#define ELF64_ST_TYPE(info) ((info) & 0xf)
+
+/* Macro for constructing st_info from field values. */
+#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
+
+/* Macro for accessing the fields of st_other. */
+#define ELF64_ST_VISIBILITY(oth) ((oth) & 0x3)
+
+/* Structures used by Sun & GNU-style symbol versioning. */
+typedef struct {
+ Elf64_Half vd_version;
+ Elf64_Half vd_flags;
+ Elf64_Half vd_ndx;
+ Elf64_Half vd_cnt;
+ Elf64_Word vd_hash;
+ Elf64_Word vd_aux;
+ Elf64_Word vd_next;
+} Elf64_Verdef;
+
+typedef struct {
+ Elf64_Word vda_name;
+ Elf64_Word vda_next;
+} Elf64_Verdaux;
+
+typedef struct {
+ Elf64_Half vn_version;
+ Elf64_Half vn_cnt;
+ Elf64_Word vn_file;
+ Elf64_Word vn_aux;
+ Elf64_Word vn_next;
+} Elf64_Verneed;
+
+typedef struct {
+ Elf64_Word vna_hash;
+ Elf64_Half vna_flags;
+ Elf64_Half vna_other;
+ Elf64_Word vna_name;
+ Elf64_Word vna_next;
+} Elf64_Vernaux;
+
+typedef Elf64_Half Elf64_Versym;
+
+typedef struct {
+ Elf64_Half si_boundto; /* direct bindings - symbol bound to */
+ Elf64_Half si_flags; /* per symbol flags */
+} Elf64_Syminfo;
+
+#endif /* !_SYS_ELF64_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/GenFw/elf_common.h b/roms/edk2/BaseTools/Source/C/GenFw/elf_common.h
new file mode 100644
index 000000000..b67f59e7a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenFw/elf_common.h
@@ -0,0 +1,1045 @@
+/** @file
+Ported ELF include files from FreeBSD
+
+Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
+Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
+Portion Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+
+**/
+/*-
+ * Copyright (c) 1998 John D. Polstra.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/sys/sys/elf_common.h,v 1.15.8.2 2007/12/03 21:30:36 marius Exp $
+ */
+
+#ifndef _SYS_ELF_COMMON_H_
+#define _SYS_ELF_COMMON_H_ 1
+
+/*
+ * ELF definitions that are independent of architecture or word size.
+ */
+
+/*
+ * Note header. The ".note" section contains an array of notes. Each
+ * begins with this header, aligned to a word boundary. Immediately
+ * following the note header is n_namesz bytes of name, padded to the
+ * next word boundary. Then comes n_descsz bytes of descriptor, again
+ * padded to a word boundary. The values of n_namesz and n_descsz do
+ * not include the padding.
+ */
+
+typedef struct {
+ UINT32 n_namesz; /* Length of name. */
+ UINT32 n_descsz; /* Length of descriptor. */
+ UINT32 n_type; /* Type of this note. */
+} Elf_Note;
+
+/* Indexes into the e_ident array. Keep synced with
+ http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
+#define EI_MAG0 0 /* Magic number, byte 0. */
+#define EI_MAG1 1 /* Magic number, byte 1. */
+#define EI_MAG2 2 /* Magic number, byte 2. */
+#define EI_MAG3 3 /* Magic number, byte 3. */
+#define EI_CLASS 4 /* Class of machine. */
+#define EI_DATA 5 /* Data format. */
+#define EI_VERSION 6 /* ELF format version. */
+#define EI_OSABI 7 /* Operating system / ABI identification */
+#define EI_ABIVERSION 8 /* ABI version */
+#define OLD_EI_BRAND 8 /* Start of architecture identification. */
+#define EI_PAD 9 /* Start of padding (per SVR4 ABI). */
+#define EI_NIDENT 16 /* Size of e_ident array. */
+
+/* Values for the magic number bytes. */
+#define ELFMAG0 0x7f
+#define ELFMAG1 'E'
+#define ELFMAG2 'L'
+#define ELFMAG3 'F'
+#define ELFMAG "\177ELF" /* magic string */
+#define SELFMAG 4 /* magic string size */
+
+/* Values for e_ident[EI_VERSION] and e_version. */
+#define EV_NONE 0
+#define EV_CURRENT 1
+
+/* Values for e_ident[EI_CLASS]. */
+#define ELFCLASSNONE 0 /* Unknown class. */
+#define ELFCLASS32 1 /* 32-bit architecture. */
+#define ELFCLASS64 2 /* 64-bit architecture. */
+
+/* Values for e_ident[EI_DATA]. */
+#define ELFDATANONE 0 /* Unknown data format. */
+#define ELFDATA2LSB 1 /* 2's complement little-endian. */
+#define ELFDATA2MSB 2 /* 2's complement big-endian. */
+
+/* Values for e_ident[EI_OSABI]. */
+#define ELFOSABI_NONE 0 /* UNIX System V ABI */
+#define ELFOSABI_HPUX 1 /* HP-UX operating system */
+#define ELFOSABI_NETBSD 2 /* NetBSD */
+#define ELFOSABI_LINUX 3 /* GNU/Linux */
+#define ELFOSABI_HURD 4 /* GNU/Hurd */
+#define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */
+#define ELFOSABI_SOLARIS 6 /* Solaris */
+#define ELFOSABI_AIX 7 /* AIX */
+#define ELFOSABI_IRIX 8 /* IRIX */
+#define ELFOSABI_FREEBSD 9 /* FreeBSD */
+#define ELFOSABI_TRU64 10 /* TRU64 UNIX */
+#define ELFOSABI_MODESTO 11 /* Novell Modesto */
+#define ELFOSABI_OPENBSD 12 /* OpenBSD */
+#define ELFOSABI_OPENVMS 13 /* Open VMS */
+#define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */
+#define ELFOSABI_ARM 97 /* ARM */
+#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
+
+#define ELFOSABI_SYSV ELFOSABI_NONE /* symbol used in old spec */
+#define ELFOSABI_MONTEREY ELFOSABI_AIX /* Monterey */
+
+/* e_ident */
+#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
+ (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
+ (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
+ (ehdr).e_ident[EI_MAG3] == ELFMAG3)
+
+/* Values for e_type. */
+#define ET_NONE 0 /* Unknown type. */
+#define ET_REL 1 /* Relocatable. */
+#define ET_EXEC 2 /* Executable. */
+#define ET_DYN 3 /* Shared object. */
+#define ET_CORE 4 /* Core file. */
+#define ET_LOOS 0xfe00 /* First operating system specific. */
+#define ET_HIOS 0xfeff /* Last operating system-specific. */
+#define ET_LOPROC 0xff00 /* First processor-specific. */
+#define ET_HIPROC 0xffff /* Last processor-specific. */
+
+/* Values for e_machine. */
+#define EM_NONE 0 /* Unknown machine. */
+#define EM_M32 1 /* AT&T WE32100. */
+#define EM_SPARC 2 /* Sun SPARC. */
+#define EM_386 3 /* Intel i386. */
+#define EM_68K 4 /* Motorola 68000. */
+#define EM_88K 5 /* Motorola 88000. */
+#define EM_860 7 /* Intel i860. */
+#define EM_MIPS 8 /* MIPS R3000 Big-Endian only. */
+#define EM_S370 9 /* IBM System/370. */
+#define EM_MIPS_RS3_LE 10 /* MIPS R3000 Little-Endian. */
+#define EM_PARISC 15 /* HP PA-RISC. */
+#define EM_VPP500 17 /* Fujitsu VPP500. */
+#define EM_SPARC32PLUS 18 /* SPARC v8plus. */
+#define EM_960 19 /* Intel 80960. */
+#define EM_PPC 20 /* PowerPC 32-bit. */
+#define EM_PPC64 21 /* PowerPC 64-bit. */
+#define EM_S390 22 /* IBM System/390. */
+#define EM_V800 36 /* NEC V800. */
+#define EM_FR20 37 /* Fujitsu FR20. */
+#define EM_RH32 38 /* TRW RH-32. */
+#define EM_RCE 39 /* Motorola RCE. */
+#define EM_ARM 40 /* ARM. */
+#define EM_SH 42 /* Hitachi SH. */
+#define EM_SPARCV9 43 /* SPARC v9 64-bit. */
+#define EM_TRICORE 44 /* Siemens TriCore embedded processor. */
+#define EM_ARC 45 /* Argonaut RISC Core. */
+#define EM_H8_300 46 /* Hitachi H8/300. */
+#define EM_H8_300H 47 /* Hitachi H8/300H. */
+#define EM_H8S 48 /* Hitachi H8S. */
+#define EM_H8_500 49 /* Hitachi H8/500. */
+#define EM_MIPS_X 51 /* Stanford MIPS-X. */
+#define EM_COLDFIRE 52 /* Motorola ColdFire. */
+#define EM_68HC12 53 /* Motorola M68HC12. */
+#define EM_MMA 54 /* Fujitsu MMA. */
+#define EM_PCP 55 /* Siemens PCP. */
+#define EM_NCPU 56 /* Sony nCPU. */
+#define EM_NDR1 57 /* Denso NDR1 microprocessor. */
+#define EM_STARCORE 58 /* Motorola Star*Core processor. */
+#define EM_ME16 59 /* Toyota ME16 processor. */
+#define EM_ST100 60 /* STMicroelectronics ST100 processor. */
+#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ processor. */
+#define EM_X86_64 62 /* Advanced Micro Devices x86-64 */
+#define EM_AMD64 EM_X86_64 /* Advanced Micro Devices x86-64 (compat) */
+#define EM_AARCH64 183 /* ARM 64bit Architecture */
+#define EM_RISCV64 243 /* 64bit RISC-V Architecture */
+#define EM_RISCV 244 /* 32bit RISC-V Architecture */
+
+/* Non-standard or deprecated. */
+#define EM_486 6 /* Intel i486. */
+#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */
+#define EM_ALPHA_STD 41 /* Digital Alpha (standard value). */
+#define EM_ALPHA 0x9026 /* Alpha (written in the absence of an ABI) */
+
+/* Special section indexes. */
+#define SHN_UNDEF 0 /* Undefined, missing, irrelevant. */
+#define SHN_LORESERVE 0xff00 /* First of reserved range. */
+#define SHN_LOPROC 0xff00 /* First processor-specific. */
+#define SHN_HIPROC 0xff1f /* Last processor-specific. */
+#define SHN_LOOS 0xff20 /* First operating system-specific. */
+#define SHN_HIOS 0xff3f /* Last operating system-specific. */
+#define SHN_ABS 0xfff1 /* Absolute values. */
+#define SHN_COMMON 0xfff2 /* Common data. */
+#define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere. */
+#define SHN_HIRESERVE 0xffff /* Last of reserved range. */
+
+/* sh_type */
+#define SHT_NULL 0 /* inactive */
+#define SHT_PROGBITS 1 /* program defined information */
+#define SHT_SYMTAB 2 /* symbol table section */
+#define SHT_STRTAB 3 /* string table section */
+#define SHT_RELA 4 /* relocation section with addends */
+#define SHT_HASH 5 /* symbol hash table section */
+#define SHT_DYNAMIC 6 /* dynamic section */
+#define SHT_NOTE 7 /* note section */
+#define SHT_NOBITS 8 /* no space section */
+#define SHT_REL 9 /* relocation section - no addends */
+#define SHT_SHLIB 10 /* reserved - purpose unknown */
+#define SHT_DYNSYM 11 /* dynamic symbol table section */
+#define SHT_INIT_ARRAY 14 /* Initialization function pointers. */
+#define SHT_FINI_ARRAY 15 /* Termination function pointers. */
+#define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs. */
+#define SHT_GROUP 17 /* Section group. */
+#define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX). */
+#define SHT_LOOS 0x60000000 /* First of OS specific semantics */
+#define SHT_LOSUNW 0x6ffffff4
+#define SHT_SUNW_dof 0x6ffffff4
+#define SHT_SUNW_cap 0x6ffffff5
+#define SHT_SUNW_SIGNATURE 0x6ffffff6
+#define SHT_SUNW_ANNOTATE 0x6ffffff7
+#define SHT_SUNW_DEBUGSTR 0x6ffffff8
+#define SHT_SUNW_DEBUG 0x6ffffff9
+#define SHT_SUNW_move 0x6ffffffa
+#define SHT_SUNW_COMDAT 0x6ffffffb
+#define SHT_SUNW_syminfo 0x6ffffffc
+#define SHT_SUNW_verdef 0x6ffffffd
+#define SHT_GNU_verdef 0x6ffffffd /* Symbol versions provided */
+#define SHT_SUNW_verneed 0x6ffffffe
+#define SHT_GNU_verneed 0x6ffffffe /* Symbol versions required */
+#define SHT_SUNW_versym 0x6fffffff
+#define SHT_GNU_versym 0x6fffffff /* Symbol version table */
+#define SHT_HISUNW 0x6fffffff
+#define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */
+#define SHT_LOPROC 0x70000000 /* reserved range for processor */
+#define SHT_AMD64_UNWIND 0x70000001 /* unwind information */
+#define SHT_HIPROC 0x7fffffff /* specific section header types */
+#define SHT_LOUSER 0x80000000 /* reserved range for application */
+#define SHT_HIUSER 0xffffffff /* specific indexes */
+
+/* Flags for sh_flags. */
+#define SHF_WRITE 0x1 /* Section contains writable data. */
+#define SHF_ALLOC 0x2 /* Section occupies memory. */
+#define SHF_EXECINSTR 0x4 /* Section contains instructions. */
+#define SHF_MERGE 0x10 /* Section may be merged. */
+#define SHF_STRINGS 0x20 /* Section contains strings. */
+#define SHF_INFO_LINK 0x40 /* sh_info holds section index. */
+#define SHF_LINK_ORDER 0x80 /* Special ordering requirements. */
+#define SHF_OS_NONCONFORMING 0x100 /* OS-specific processing required. */
+#define SHF_GROUP 0x200 /* Member of section group. */
+#define SHF_TLS 0x400 /* Section contains TLS data. */
+#define SHF_MASKOS 0x0ff00000 /* OS-specific semantics. */
+#define SHF_MASKPROC 0xf0000000 /* Processor-specific semantics. */
+
+/* Values for p_type. */
+#define PT_NULL 0 /* Unused entry. */
+#define PT_LOAD 1 /* Loadable segment. */
+#define PT_DYNAMIC 2 /* Dynamic linking information segment. */
+#define PT_INTERP 3 /* Pathname of interpreter. */
+#define PT_NOTE 4 /* Auxiliary information. */
+#define PT_SHLIB 5 /* Reserved (not used). */
+#define PT_PHDR 6 /* Location of program header itself. */
+#define PT_TLS 7 /* Thread local storage segment */
+#define PT_LOOS 0x60000000 /* First OS-specific. */
+#define PT_SUNW_UNWIND 0x6464e550 /* amd64 UNWIND program header */
+#define PT_GNU_EH_FRAME 0x6474e550
+#define PT_LOSUNW 0x6ffffffa
+#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
+#define PT_SUNWSTACK 0x6ffffffb /* describes the stack segment */
+#define PT_SUNWDTRACE 0x6ffffffc /* private */
+#define PT_SUNWCAP 0x6ffffffd /* hard/soft capabilities segment */
+#define PT_HISUNW 0x6fffffff
+#define PT_HIOS 0x6fffffff /* Last OS-specific. */
+#define PT_LOPROC 0x70000000 /* First processor-specific type. */
+#define PT_HIPROC 0x7fffffff /* Last processor-specific type. */
+
+/* Values for p_flags. */
+#define PF_X 0x1 /* Executable. */
+#define PF_W 0x2 /* Writable. */
+#define PF_R 0x4 /* Readable. */
+#define PF_MASKOS 0x0ff00000 /* Operating system-specific. */
+#define PF_MASKPROC 0xf0000000 /* Processor-specific. */
+
+/* Extended program header index. */
+#define PN_XNUM 0xffff
+
+/* Values for d_tag. */
+#define DT_NULL 0 /* Terminating entry. */
+#define DT_NEEDED 1 /* String table offset of a needed shared
+ library. */
+#define DT_PLTRELSZ 2 /* Total size in bytes of PLT relocations. */
+#define DT_PLTGOT 3 /* Processor-dependent address. */
+#define DT_HASH 4 /* Address of symbol hash table. */
+#define DT_STRTAB 5 /* Address of string table. */
+#define DT_SYMTAB 6 /* Address of symbol table. */
+#define DT_RELA 7 /* Address of ElfNN_Rela relocations. */
+#define DT_RELASZ 8 /* Total size of ElfNN_Rela relocations. */
+#define DT_RELAENT 9 /* Size of each ElfNN_Rela relocation entry. */
+#define DT_STRSZ 10 /* Size of string table. */
+#define DT_SYMENT 11 /* Size of each symbol table entry. */
+#define DT_INIT 12 /* Address of initialization function. */
+#define DT_FINI 13 /* Address of finalization function. */
+#define DT_SONAME 14 /* String table offset of shared object
+ name. */
+#define DT_RPATH 15 /* String table offset of library path. [sup] */
+#define DT_SYMBOLIC 16 /* Indicates "symbolic" linking. [sup] */
+#define DT_REL 17 /* Address of ElfNN_Rel relocations. */
+#define DT_RELSZ 18 /* Total size of ElfNN_Rel relocations. */
+#define DT_RELENT 19 /* Size of each ElfNN_Rel relocation. */
+#define DT_PLTREL 20 /* Type of relocation used for PLT. */
+#define DT_DEBUG 21 /* Reserved (not used). */
+#define DT_TEXTREL 22 /* Indicates there may be relocations in
+ non-writable segments. [sup] */
+#define DT_JMPREL 23 /* Address of PLT relocations. */
+#define DT_BIND_NOW 24 /* [sup] */
+#define DT_INIT_ARRAY 25 /* Address of the array of pointers to
+ initialization functions */
+#define DT_FINI_ARRAY 26 /* Address of the array of pointers to
+ termination functions */
+#define DT_INIT_ARRAYSZ 27 /* Size in bytes of the array of
+ initialization functions. */
+#define DT_FINI_ARRAYSZ 28 /* Size in bytes of the array of
+ terminationfunctions. */
+#define DT_RUNPATH 29 /* String table offset of a null-terminated
+ library search path string. */
+#define DT_FLAGS 30 /* Object specific flag values. */
+#define DT_ENCODING 32 /* Values greater than or equal to DT_ENCODING
+ and less than DT_LOOS follow the rules for
+ the interpretation of the d_un union
+ as follows: even == 'd_ptr', even == 'd_val'
+ or none */
+#define DT_PREINIT_ARRAY 32 /* Address of the array of pointers to
+ pre-initialization functions. */
+#define DT_PREINIT_ARRAYSZ 33 /* Size in bytes of the array of
+ pre-initialization functions. */
+#define DT_MAXPOSTAGS 34 /* number of positive tags */
+#define DT_LOOS 0x6000000d /* First OS-specific */
+#define DT_SUNW_AUXILIARY 0x6000000d /* symbol auxiliary name */
+#define DT_SUNW_RTLDINF 0x6000000e /* ld.so.1 info (private) */
+#define DT_SUNW_FILTER 0x6000000f /* symbol filter name */
+#define DT_SUNW_CAP 0x60000010 /* hardware/software */
+#define DT_HIOS 0x6ffff000 /* Last OS-specific */
+
+/*
+ * DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
+ * Dyn.d_un.d_val field of the Elf*_Dyn structure.
+ */
+#define DT_VALRNGLO 0x6ffffd00
+#define DT_CHECKSUM 0x6ffffdf8 /* elf checksum */
+#define DT_PLTPADSZ 0x6ffffdf9 /* pltpadding size */
+#define DT_MOVEENT 0x6ffffdfa /* move table entry size */
+#define DT_MOVESZ 0x6ffffdfb /* move table size */
+#define DT_FEATURE_1 0x6ffffdfc /* feature holder */
+#define DT_POSFLAG_1 0x6ffffdfd /* flags for DT_* entries, effecting */
+ /* the following DT_* entry. */
+ /* See DF_P1_* definitions */
+#define DT_SYMINSZ 0x6ffffdfe /* syminfo table size (in bytes) */
+#define DT_SYMINENT 0x6ffffdff /* syminfo entry size (in bytes) */
+#define DT_VALRNGHI 0x6ffffdff
+
+/*
+ * DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
+ * Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
+ *
+ * If any adjustment is made to the ELF object after it has been
+ * built, these entries will need to be adjusted.
+ */
+#define DT_ADDRRNGLO 0x6ffffe00
+#define DT_CONFIG 0x6ffffefa /* configuration information */
+#define DT_DEPAUDIT 0x6ffffefb /* dependency auditing */
+#define DT_AUDIT 0x6ffffefc /* object auditing */
+#define DT_PLTPAD 0x6ffffefd /* pltpadding (sparcv9) */
+#define DT_MOVETAB 0x6ffffefe /* move table */
+#define DT_SYMINFO 0x6ffffeff /* syminfo table */
+#define DT_ADDRRNGHI 0x6ffffeff
+
+#define DT_VERSYM 0x6ffffff0 /* Address of versym section. */
+#define DT_RELACOUNT 0x6ffffff9 /* number of RELATIVE relocations */
+#define DT_RELCOUNT 0x6ffffffa /* number of RELATIVE relocations */
+#define DT_FLAGS_1 0x6ffffffb /* state flags - see DF_1_* defs */
+#define DT_VERDEF 0x6ffffffc /* Address of verdef section. */
+#define DT_VERDEFNUM 0x6ffffffd /* Number of elems in verdef section */
+#define DT_VERNEED 0x6ffffffe /* Address of verneed section. */
+#define DT_VERNEEDNUM 0x6fffffff /* Number of elems in verneed section */
+
+#define DT_LOPROC 0x70000000 /* First processor-specific type. */
+#define DT_DEPRECATED_SPARC_REGISTER 0x7000001
+#define DT_AUXILIARY 0x7ffffffd /* shared library auxiliary name */
+#define DT_USED 0x7ffffffe /* ignored - same as needed */
+#define DT_FILTER 0x7fffffff /* shared library filter name */
+#define DT_HIPROC 0x7fffffff /* Last processor-specific type. */
+
+/* Values for DT_FLAGS */
+#define DF_ORIGIN 0x0001 /* Indicates that the object being loaded may
+ make reference to the $ORIGIN substitution
+ string */
+#define DF_SYMBOLIC 0x0002 /* Indicates "symbolic" linking. */
+#define DF_TEXTREL 0x0004 /* Indicates there may be relocations in
+ non-writable segments. */
+#define DF_BIND_NOW 0x0008 /* Indicates that the dynamic linker should
+ process all relocations for the object
+ containing this entry before transferring
+ control to the program. */
+#define DF_STATIC_TLS 0x0010 /* Indicates that the shared object or
+ executable contains code using a static
+ thread-local storage scheme. */
+
+/* Values for n_type. Used in core files. */
+#define NT_PRSTATUS 1 /* Process status. */
+#define NT_FPREGSET 2 /* Floating point registers. */
+#define NT_PRPSINFO 3 /* Process state info. */
+
+/* Symbol Binding - ELFNN_ST_BIND - st_info */
+#define STB_LOCAL 0 /* Local symbol */
+#define STB_GLOBAL 1 /* Global symbol */
+#define STB_WEAK 2 /* like global - lower precedence */
+#define STB_LOOS 10 /* Reserved range for operating system */
+#define STB_HIOS 12 /* specific semantics. */
+#define STB_LOPROC 13 /* reserved range for processor */
+#define STB_HIPROC 15 /* specific semantics. */
+
+/* Symbol type - ELFNN_ST_TYPE - st_info */
+#define STT_NOTYPE 0 /* Unspecified type. */
+#define STT_OBJECT 1 /* Data object. */
+#define STT_FUNC 2 /* Function. */
+#define STT_SECTION 3 /* Section. */
+#define STT_FILE 4 /* Source file. */
+#define STT_COMMON 5 /* Uninitialized common block. */
+#define STT_TLS 6 /* TLS object. */
+#define STT_NUM 7
+#define STT_LOOS 10 /* Reserved range for operating system */
+#define STT_HIOS 12 /* specific semantics. */
+#define STT_LOPROC 13 /* reserved range for processor */
+#define STT_HIPROC 15 /* specific semantics. */
+
+/* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */
+#define STV_DEFAULT 0x0 /* Default visibility (see binding). */
+#define STV_INTERNAL 0x1 /* Special meaning in relocatable objects. */
+#define STV_HIDDEN 0x2 /* Not visible. */
+#define STV_PROTECTED 0x3 /* Visible but not preemptible. */
+
+/* Special symbol table indexes. */
+#define STN_UNDEF 0 /* Undefined symbol index. */
+
+/* Symbol versioning flags. */
+#define VER_DEF_CURRENT 1
+#define VER_DEF_IDX(x) VER_NDX(x)
+
+#define VER_FLG_BASE 0x01
+#define VER_FLG_WEAK 0x02
+
+#define VER_NEED_CURRENT 1
+#define VER_NEED_WEAK (1u << 15)
+#define VER_NEED_HIDDEN VER_NDX_HIDDEN
+#define VER_NEED_IDX(x) VER_NDX(x)
+
+#define VER_NDX_LOCAL 0
+#define VER_NDX_GLOBAL 1
+#define VER_NDX_GIVEN 2
+
+#define VER_NDX_HIDDEN (1u << 15)
+#define VER_NDX(x) ((x) & ~(1u << 15))
+
+#define CA_SUNW_NULL 0
+#define CA_SUNW_HW_1 1 /* first hardware capabilities entry */
+#define CA_SUNW_SF_1 2 /* first software capabilities entry */
+
+/*
+ * Syminfo flag values
+ */
+#define SYMINFO_FLG_DIRECT 0x0001 /* symbol ref has direct association */
+ /* to object containing defn. */
+#define SYMINFO_FLG_PASSTHRU 0x0002 /* ignored - see SYMINFO_FLG_FILTER */
+#define SYMINFO_FLG_COPY 0x0004 /* symbol is a copy-reloc */
+#define SYMINFO_FLG_LAZYLOAD 0x0008 /* object containing defn should be */
+ /* lazily-loaded */
+#define SYMINFO_FLG_DIRECTBIND 0x0010 /* ref should be bound directly to */
+ /* object containing defn. */
+#define SYMINFO_FLG_NOEXTDIRECT 0x0020 /* don't let an external reference */
+ /* directly bind to this symbol */
+#define SYMINFO_FLG_FILTER 0x0002 /* symbol ref is associated to a */
+#define SYMINFO_FLG_AUXILIARY 0x0040 /* standard or auxiliary filter */
+
+/*
+ * Syminfo.si_boundto values.
+ */
+#define SYMINFO_BT_SELF 0xffff /* symbol bound to self */
+#define SYMINFO_BT_PARENT 0xfffe /* symbol bound to parent */
+#define SYMINFO_BT_NONE 0xfffd /* no special symbol binding */
+#define SYMINFO_BT_EXTERN 0xfffc /* symbol defined as external */
+#define SYMINFO_BT_LOWRESERVE 0xff00 /* beginning of reserved entries */
+
+/*
+ * Syminfo version values.
+ */
+#define SYMINFO_NONE 0 /* Syminfo version */
+#define SYMINFO_CURRENT 1
+#define SYMINFO_NUM 2
+
+/*
+ * Relocation types.
+ *
+ * All machine architectures are defined here to allow tools on one to
+ * handle others.
+ */
+
+#define R_386_NONE 0 /* No relocation. */
+#define R_386_32 1 /* Add symbol value. */
+#define R_386_PC32 2 /* Add PC-relative symbol value. */
+#define R_386_GOT32 3 /* Add PC-relative GOT offset. */
+#define R_386_PLT32 4 /* Add PC-relative PLT offset. */
+#define R_386_COPY 5 /* Copy data from shared object. */
+#define R_386_GLOB_DAT 6 /* Set GOT entry to data address. */
+#define R_386_JMP_SLOT 7 /* Set GOT entry to code address. */
+#define R_386_RELATIVE 8 /* Add load address of shared object. */
+#define R_386_GOTOFF 9 /* Add GOT-relative symbol address. */
+#define R_386_GOTPC 10 /* Add PC-relative GOT table address. */
+#define R_386_TLS_TPOFF 14 /* Negative offset in static TLS block */
+#define R_386_TLS_IE 15 /* Absolute address of GOT for -ve static TLS */
+#define R_386_TLS_GOTIE 16 /* GOT entry for negative static TLS block */
+#define R_386_TLS_LE 17 /* Negative offset relative to static TLS */
+#define R_386_TLS_GD 18 /* 32 bit offset to GOT (index,off) pair */
+#define R_386_TLS_LDM 19 /* 32 bit offset to GOT (index,zero) pair */
+#define R_386_TLS_GD_32 24 /* 32 bit offset to GOT (index,off) pair */
+#define R_386_TLS_GD_PUSH 25 /* pushl instruction for Sun ABI GD sequence */
+#define R_386_TLS_GD_CALL 26 /* call instruction for Sun ABI GD sequence */
+#define R_386_TLS_GD_POP 27 /* popl instruction for Sun ABI GD sequence */
+#define R_386_TLS_LDM_32 28 /* 32 bit offset to GOT (index,zero) pair */
+#define R_386_TLS_LDM_PUSH 29 /* pushl instruction for Sun ABI LD sequence */
+#define R_386_TLS_LDM_CALL 30 /* call instruction for Sun ABI LD sequence */
+#define R_386_TLS_LDM_POP 31 /* popl instruction for Sun ABI LD sequence */
+#define R_386_TLS_LDO_32 32 /* 32 bit offset from start of TLS block */
+#define R_386_TLS_IE_32 33 /* 32 bit offset to GOT static TLS offset entry */
+#define R_386_TLS_LE_32 34 /* 32 bit offset within static TLS block */
+#define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */
+#define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */
+#define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */
+
+/* Null relocation */
+#define R_AARCH64_NONE 256 /* No relocation */
+/* Static AArch64 relocations */
+ /* Static data relocations */
+#define R_AARCH64_ABS64 257 /* S + A */
+#define R_AARCH64_ABS32 258 /* S + A */
+#define R_AARCH64_ABS16 259 /* S + A */
+#define R_AARCH64_PREL64 260 /* S + A - P */
+#define R_AARCH64_PREL32 261 /* S + A - P */
+#define R_AARCH64_PREL16 262 /* S + A - P */
+ /* Group relocations to create a 16, 32, 48, or 64 bit unsigned data value or address inline */
+#define R_AARCH64_MOVW_UABS_G0 263 /* S + A */
+#define R_AARCH64_MOVW_UABS_G0_NC 264 /* S + A */
+#define R_AARCH64_MOVW_UABS_G1 265 /* S + A */
+#define R_AARCH64_MOVW_UABS_G1_NC 266 /* S + A */
+#define R_AARCH64_MOVW_UABS_G2 267 /* S + A */
+#define R_AARCH64_MOVW_UABS_G2_NC 268 /* S + A */
+#define R_AARCH64_MOVW_UABS_G3 269 /* S + A */
+ /* Group relocations to create a 16, 32, 48, or 64 bit signed data or offset value inline */
+#define R_AARCH64_MOVW_SABS_G0 270 /* S + A */
+#define R_AARCH64_MOVW_SABS_G1 271 /* S + A */
+#define R_AARCH64_MOVW_SABS_G2 272 /* S + A */
+ /* Relocations to generate 19, 21 and 33 bit PC-relative addresses */
+#define R_AARCH64_LD_PREL_LO19 273 /* S + A - P */
+#define R_AARCH64_ADR_PREL_LO21 274 /* S + A - P */
+#define R_AARCH64_ADR_PREL_PG_HI21 275 /* Page(S+A) - Page(P) */
+#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 /* Page(S+A) - Page(P) */
+#define R_AARCH64_ADD_ABS_LO12_NC 277 /* S + A */
+#define R_AARCH64_LDST8_ABS_LO12_NC 278 /* S + A */
+#define R_AARCH64_LDST16_ABS_LO12_NC 284 /* S + A */
+#define R_AARCH64_LDST32_ABS_LO12_NC 285 /* S + A */
+#define R_AARCH64_LDST64_ABS_LO12_NC 286 /* S + A */
+#define R_AARCH64_LDST128_ABS_LO12_NC 299 /* S + A */
+ /* Relocations for control-flow instructions - all offsets are a multiple of 4 */
+#define R_AARCH64_TSTBR14 279 /* S+A-P */
+#define R_AARCH64_CONDBR19 280 /* S+A-P */
+#define R_AARCH64_JUMP26 282 /* S+A-P */
+#define R_AARCH64_CALL26 283 /* S+A-P */
+ /* Group relocations to create a 16, 32, 48, or 64 bit PC-relative offset inline */
+#define R_AARCH64_MOVW_PREL_G0 287 /* S+A-P */
+#define R_AARCH64_MOVW_PREL_G0_NC 288 /* S+A-P */
+#define R_AARCH64_MOVW_PREL_G1 289 /* S+A-P */
+#define R_AARCH64_MOVW_PREL_G1_NC 290 /* S+A-P */
+#define R_AARCH64_MOVW_PREL_G2 291 /* S+A-P */
+#define R_AARCH64_MOVW_PREL_G2_NC 292 /* S+A-P */
+#define R_AARCH64_MOVW_PREL_G3 293 /* S+A-P */
+ /* Group relocations to create a 16, 32, 48, or 64 bit GOT-relative offsets inline */
+#define R_AARCH64_MOVW_GOTOFF_G0 300 /* G(S)-GOT */
+#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 /* G(S)-GOT */
+#define R_AARCH64_MOVW_GOTOFF_G1 302 /* G(S)-GOT */
+#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 /* G(S)-GOT */
+#define R_AARCH64_MOVW_GOTOFF_G2 304 /* G(S)-GOT */
+#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 /* G(S)-GOT */
+#define R_AARCH64_MOVW_GOTOFF_G3 306 /* G(S)-GOT */
+ /* GOT-relative data relocations */
+#define R_AARCH64_GOTREL64 307 /* S+A-GOT */
+#define R_AARCH64_GOTREL32 308 /* S+A-GOT */
+ /* GOT-relative instruction relocations */
+#define R_AARCH64_GOT_LD_PREL19 309 /* G(S)-P */
+#define R_AARCH64_LD64_GOTOFF_LO15 310 /* G(S)-GOT */
+#define R_AARCH64_ADR_GOT_PAGE 311 /* Page(G(S))-Page(P) */
+#define R_AARCH64_LD64_GOT_LO12_NC 312 /* G(S) */
+#define R_AARCH64_LD64_GOTPAGE_LO15 313 /* G(S)-Page(GOT) */
+/* Relocations for thread-local storage */
+ /* General Dynamic TLS relocations */
+#define R_AARCH64_TLSGD_ADR_PREL21 512 /* G(TLSIDX(S+A)) - P */
+#define R_AARCH64_TLSGD_ADR_PAGE21 513 /* Page(G(TLSIDX(S+A))) - Page(P) */
+#define R_AARCH64_TLSGD_ADD_LO12_NC 514 /* G(TLSIDX(S+A)) */
+#define R_AARCH64_TLSGD_MOVW_G1 515 /* G(TLSIDX(S+A)) - GOT */
+#define R_AARCH64_TLSGD_MOVW_G0_NC 516 /* G(TLSIDX(S+A)) - GOT */
+ /* Local Dynamic TLS relocations */
+#define R_AARCH64_TLSLD_ADR_PREL21 517 /* G(LDM(S))) - P */
+#define R_AARCH64_TLSLD_ADR_PAGE21 518 /* Page(G(LDM(S)))-Page(P) */
+#define R_AARCH64_TLSLD_ADD_LO12_NC 519 /* G(LDM(S)) */
+#define R_AARCH64_TLSLD_MOVW_G1 520 /* G(LDM(S)) - GOT */
+#define R_AARCH64_TLSLD_MOVW_G0_NC 521 /* G(LDM(S)) - GOT */
+#define R_AARCH64_TLSLD_LD_PREL19 522 /* G(LDM(S)) - P */
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 /* DTPREL(S+A) */
+#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 /* DTPREL(S+A) */
+ /* Initial Exec TLS relocations */
+#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 /* G(TPREL(S+A)) - GOT */
+#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 /* G(TPREL(S+A)) - GOT */
+#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 /* Page(G(TPREL(S+A))) - Page(P) */
+#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 /* G(TPREL(S+A)) */
+#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 /* G(TPREL(S+A)) - P */
+ /* Local Exec TLS relocations */
+#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 /* TPREL(S+A) */
+#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 /* TPREL(S+A) */
+/* Dynamic relocations */
+ /* Dynamic relocations */
+#define R_AARCH64_COPY 1024
+#define R_AARCH64_GLOB_DAT 1025 /* S + A */
+#define R_AARCH64_JUMP_SLOT 1026 /* S + A */
+#define R_AARCH64_RELATIVE 1027 /* Delta(S) + A , Delta(P) + A */
+#define R_AARCH64_TLS_DTPREL64 1028 /* DTPREL(S+A) */
+#define R_AARCH64_TLS_DTPMOD64 1029 /* LDM(S) */
+#define R_AARCH64_TLS_TPREL64 1030 /* TPREL(S+A) */
+#define R_AARCH64_TLS_DTPREL32 1031 /* DTPREL(S+A) */
+#define R_AARCH64_TLS_DTPMOD32 1032 /* LDM(S) */
+#define R_AARCH64_TLS_TPREL32 1033 /* DTPREL(S+A) */
+
+#define R_ALPHA_NONE 0 /* No reloc */
+#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
+#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
+#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
+#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
+#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
+#define R_ALPHA_GPDISP 6 /* Add displacement to GP */
+#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
+#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
+#define R_ALPHA_SREL16 9 /* PC relative 16 bit */
+#define R_ALPHA_SREL32 10 /* PC relative 32 bit */
+#define R_ALPHA_SREL64 11 /* PC relative 64 bit */
+#define R_ALPHA_OP_PUSH 12 /* OP stack push */
+#define R_ALPHA_OP_STORE 13 /* OP stack pop and store */
+#define R_ALPHA_OP_PSUB 14 /* OP stack subtract */
+#define R_ALPHA_OP_PRSHIFT 15 /* OP stack right shift */
+#define R_ALPHA_GPVALUE 16
+#define R_ALPHA_GPRELHIGH 17
+#define R_ALPHA_GPRELLOW 18
+#define R_ALPHA_IMMED_GP_16 19
+#define R_ALPHA_IMMED_GP_HI32 20
+#define R_ALPHA_IMMED_SCN_HI32 21
+#define R_ALPHA_IMMED_BR_HI32 22
+#define R_ALPHA_IMMED_LO32 23
+#define R_ALPHA_COPY 24 /* Copy symbol at runtime */
+#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
+#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
+#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
+
+#define R_ARM_NONE 0 /* No relocation. */
+#define R_ARM_PC24 1
+#define R_ARM_ABS32 2
+#define R_ARM_REL32 3
+#define R_ARM_PC13 4
+#define R_ARM_ABS16 5
+#define R_ARM_ABS12 6
+#define R_ARM_THM_ABS5 7
+#define R_ARM_ABS8 8
+#define R_ARM_SBREL32 9
+#define R_ARM_THM_PC22 10
+#define R_ARM_THM_PC8 11
+#define R_ARM_AMP_VCALL9 12
+#define R_ARM_SWI24 13
+#define R_ARM_THM_SWI8 14
+#define R_ARM_XPC25 15
+#define R_ARM_THM_XPC22 16
+#define R_ARM_COPY 20 /* Copy data from shared object. */
+#define R_ARM_GLOB_DAT 21 /* Set GOT entry to data address. */
+#define R_ARM_JUMP_SLOT 22 /* Set GOT entry to code address. */
+#define R_ARM_RELATIVE 23 /* Add load address of shared object. */
+#define R_ARM_GOTOFF 24 /* Add GOT-relative symbol address. */
+#define R_ARM_GOTPC 25 /* Add PC-relative GOT table address. */
+#define R_ARM_GOT32 26 /* Add PC-relative GOT offset. */
+#define R_ARM_PLT32 27 /* Add PC-relative PLT offset. */
+#define R_ARM_CALL 28
+#define R_ARM_JMP24 29
+#define R_ARM_THM_MOVW_ABS_NC 47
+#define R_ARM_THM_MOVT_ABS 48
+
+// Block of PC-relative relocations added to work around gcc putting
+// object relocations in static executables.
+#define R_ARM_THM_JUMP24 30
+#define R_ARM_PREL31 42
+#define R_ARM_MOVW_PREL_NC 45
+#define R_ARM_MOVT_PREL 46
+#define R_ARM_THM_MOVW_PREL_NC 49
+#define R_ARM_THM_MOVT_PREL 50
+#define R_ARM_THM_JMP6 52
+#define R_ARM_THM_ALU_PREL_11_0 53
+#define R_ARM_THM_PC12 54
+#define R_ARM_REL32_NOI 56
+#define R_ARM_ALU_PC_G0_NC 57
+#define R_ARM_ALU_PC_G0 58
+#define R_ARM_ALU_PC_G1_NC 59
+#define R_ARM_ALU_PC_G1 60
+#define R_ARM_ALU_PC_G2 61
+#define R_ARM_LDR_PC_G1 62
+#define R_ARM_LDR_PC_G2 63
+#define R_ARM_LDRS_PC_G0 64
+#define R_ARM_LDRS_PC_G1 65
+#define R_ARM_LDRS_PC_G2 66
+#define R_ARM_LDC_PC_G0 67
+#define R_ARM_LDC_PC_G1 68
+#define R_ARM_LDC_PC_G2 69
+#define R_ARM_GOT_PREL 96
+#define R_ARM_THM_JUMP11 102
+#define R_ARM_THM_JUMP8 103
+#define R_ARM_TLS_GD32 104
+#define R_ARM_TLS_LDM32 105
+#define R_ARM_TLS_IE32 107
+
+#define R_ARM_THM_JUMP19 51
+#define R_ARM_GNU_VTENTRY 100
+#define R_ARM_GNU_VTINHERIT 101
+#define R_ARM_RSBREL32 250
+#define R_ARM_THM_RPC22 251
+#define R_ARM_RREL32 252
+#define R_ARM_RABS32 253
+#define R_ARM_RPC24 254
+#define R_ARM_RBASE 255
+
+#define R_PPC_NONE 0 /* No relocation. */
+#define R_PPC_ADDR32 1
+#define R_PPC_ADDR24 2
+#define R_PPC_ADDR16 3
+#define R_PPC_ADDR16_LO 4
+#define R_PPC_ADDR16_HI 5
+#define R_PPC_ADDR16_HA 6
+#define R_PPC_ADDR14 7
+#define R_PPC_ADDR14_BRTAKEN 8
+#define R_PPC_ADDR14_BRNTAKEN 9
+#define R_PPC_REL24 10
+#define R_PPC_REL14 11
+#define R_PPC_REL14_BRTAKEN 12
+#define R_PPC_REL14_BRNTAKEN 13
+#define R_PPC_GOT16 14
+#define R_PPC_GOT16_LO 15
+#define R_PPC_GOT16_HI 16
+#define R_PPC_GOT16_HA 17
+#define R_PPC_PLTREL24 18
+#define R_PPC_COPY 19
+#define R_PPC_GLOB_DAT 20
+#define R_PPC_JMP_SLOT 21
+#define R_PPC_RELATIVE 22
+#define R_PPC_LOCAL24PC 23
+#define R_PPC_UADDR32 24
+#define R_PPC_UADDR16 25
+#define R_PPC_REL32 26
+#define R_PPC_PLT32 27
+#define R_PPC_PLTREL32 28
+#define R_PPC_PLT16_LO 29
+#define R_PPC_PLT16_HI 30
+#define R_PPC_PLT16_HA 31
+#define R_PPC_SDAREL16 32
+#define R_PPC_SECTOFF 33
+#define R_PPC_SECTOFF_LO 34
+#define R_PPC_SECTOFF_HI 35
+#define R_PPC_SECTOFF_HA 36
+
+/*
+ * TLS relocations
+ */
+#define R_PPC_TLS 67
+#define R_PPC_DTPMOD32 68
+#define R_PPC_TPREL16 69
+#define R_PPC_TPREL16_LO 70
+#define R_PPC_TPREL16_HI 71
+#define R_PPC_TPREL16_HA 72
+#define R_PPC_TPREL32 73
+#define R_PPC_DTPREL16 74
+#define R_PPC_DTPREL16_LO 75
+#define R_PPC_DTPREL16_HI 76
+#define R_PPC_DTPREL16_HA 77
+#define R_PPC_DTPREL32 78
+#define R_PPC_GOT_TLSGD16 79
+#define R_PPC_GOT_TLSGD16_LO 80
+#define R_PPC_GOT_TLSGD16_HI 81
+#define R_PPC_GOT_TLSGD16_HA 82
+#define R_PPC_GOT_TLSLD16 83
+#define R_PPC_GOT_TLSLD16_LO 84
+#define R_PPC_GOT_TLSLD16_HI 85
+#define R_PPC_GOT_TLSLD16_HA 86
+#define R_PPC_GOT_TPREL16 87
+#define R_PPC_GOT_TPREL16_LO 88
+#define R_PPC_GOT_TPREL16_HI 89
+#define R_PPC_GOT_TPREL16_HA 90
+
+/*
+ * The remaining relocs are from the Embedded ELF ABI, and are not in the
+ * SVR4 ELF ABI.
+ */
+
+#define R_PPC_EMB_NADDR32 101
+#define R_PPC_EMB_NADDR16 102
+#define R_PPC_EMB_NADDR16_LO 103
+#define R_PPC_EMB_NADDR16_HI 104
+#define R_PPC_EMB_NADDR16_HA 105
+#define R_PPC_EMB_SDAI16 106
+#define R_PPC_EMB_SDA2I16 107
+#define R_PPC_EMB_SDA2REL 108
+#define R_PPC_EMB_SDA21 109
+#define R_PPC_EMB_MRKREF 110
+#define R_PPC_EMB_RELSEC16 111
+#define R_PPC_EMB_RELST_LO 112
+#define R_PPC_EMB_RELST_HI 113
+#define R_PPC_EMB_RELST_HA 114
+#define R_PPC_EMB_BIT_FLD 115
+#define R_PPC_EMB_RELSDA 116
+
+#define R_SPARC_NONE 0
+#define R_SPARC_8 1
+#define R_SPARC_16 2
+#define R_SPARC_32 3
+#define R_SPARC_DISP8 4
+#define R_SPARC_DISP16 5
+#define R_SPARC_DISP32 6
+#define R_SPARC_WDISP30 7
+#define R_SPARC_WDISP22 8
+#define R_SPARC_HI22 9
+#define R_SPARC_22 10
+#define R_SPARC_13 11
+#define R_SPARC_LO10 12
+#define R_SPARC_GOT10 13
+#define R_SPARC_GOT13 14
+#define R_SPARC_GOT22 15
+#define R_SPARC_PC10 16
+#define R_SPARC_PC22 17
+#define R_SPARC_WPLT30 18
+#define R_SPARC_COPY 19
+#define R_SPARC_GLOB_DAT 20
+#define R_SPARC_JMP_SLOT 21
+#define R_SPARC_RELATIVE 22
+#define R_SPARC_UA32 23
+#define R_SPARC_PLT32 24
+#define R_SPARC_HIPLT22 25
+#define R_SPARC_LOPLT10 26
+#define R_SPARC_PCPLT32 27
+#define R_SPARC_PCPLT22 28
+#define R_SPARC_PCPLT10 29
+#define R_SPARC_10 30
+#define R_SPARC_11 31
+#define R_SPARC_64 32
+#define R_SPARC_OLO10 33
+#define R_SPARC_HH22 34
+#define R_SPARC_HM10 35
+#define R_SPARC_LM22 36
+#define R_SPARC_PC_HH22 37
+#define R_SPARC_PC_HM10 38
+#define R_SPARC_PC_LM22 39
+#define R_SPARC_WDISP16 40
+#define R_SPARC_WDISP19 41
+#define R_SPARC_GLOB_JMP 42
+#define R_SPARC_7 43
+#define R_SPARC_5 44
+#define R_SPARC_6 45
+#define R_SPARC_DISP64 46
+#define R_SPARC_PLT64 47
+#define R_SPARC_HIX22 48
+#define R_SPARC_LOX10 49
+#define R_SPARC_H44 50
+#define R_SPARC_M44 51
+#define R_SPARC_L44 52
+#define R_SPARC_REGISTER 53
+#define R_SPARC_UA64 54
+#define R_SPARC_UA16 55
+#define R_SPARC_TLS_GD_HI22 56
+#define R_SPARC_TLS_GD_LO10 57
+#define R_SPARC_TLS_GD_ADD 58
+#define R_SPARC_TLS_GD_CALL 59
+#define R_SPARC_TLS_LDM_HI22 60
+#define R_SPARC_TLS_LDM_LO10 61
+#define R_SPARC_TLS_LDM_ADD 62
+#define R_SPARC_TLS_LDM_CALL 63
+#define R_SPARC_TLS_LDO_HIX22 64
+#define R_SPARC_TLS_LDO_LOX10 65
+#define R_SPARC_TLS_LDO_ADD 66
+#define R_SPARC_TLS_IE_HI22 67
+#define R_SPARC_TLS_IE_LO10 68
+#define R_SPARC_TLS_IE_LD 69
+#define R_SPARC_TLS_IE_LDX 70
+#define R_SPARC_TLS_IE_ADD 71
+#define R_SPARC_TLS_LE_HIX22 72
+#define R_SPARC_TLS_LE_LOX10 73
+#define R_SPARC_TLS_DTPMOD32 74
+#define R_SPARC_TLS_DTPMOD64 75
+#define R_SPARC_TLS_DTPOFF32 76
+#define R_SPARC_TLS_DTPOFF64 77
+#define R_SPARC_TLS_TPOFF32 78
+#define R_SPARC_TLS_TPOFF64 79
+
+#define R_X86_64_NONE 0 /* No relocation. */
+#define R_X86_64_64 1 /* Add 64 bit symbol value. */
+#define R_X86_64_PC32 2 /* PC-relative 32 bit signed sym value. */
+#define R_X86_64_GOT32 3 /* PC-relative 32 bit GOT offset. */
+#define R_X86_64_PLT32 4 /* PC-relative 32 bit PLT offset. */
+#define R_X86_64_COPY 5 /* Copy data from shared object. */
+#define R_X86_64_GLOB_DAT 6 /* Set GOT entry to data address. */
+#define R_X86_64_JMP_SLOT 7 /* Set GOT entry to code address. */
+#define R_X86_64_RELATIVE 8 /* Add load address of shared object. */
+#define R_X86_64_GOTPCREL 9 /* Add 32 bit signed pcrel offset to GOT. */
+#define R_X86_64_32 10 /* Add 32 bit zero extended symbol value */
+#define R_X86_64_32S 11 /* Add 32 bit sign extended symbol value */
+#define R_X86_64_16 12 /* Add 16 bit zero extended symbol value */
+#define R_X86_64_PC16 13 /* Add 16 bit signed extended pc relative symbol value */
+#define R_X86_64_8 14 /* Add 8 bit zero extended symbol value */
+#define R_X86_64_PC8 15 /* Add 8 bit signed extended pc relative symbol value */
+#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
+#define R_X86_64_DTPOFF64 17 /* Offset in TLS block */
+#define R_X86_64_TPOFF64 18 /* Offset in static TLS block */
+#define R_X86_64_TLSGD 19 /* PC relative offset to GD GOT entry */
+#define R_X86_64_TLSLD 20 /* PC relative offset to LD GOT entry */
+#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
+#define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */
+#define R_X86_64_TPOFF32 23 /* Offset in static TLS block */
+#define R_X86_64_PC64 24 /* PC relative 64 bit */
+#define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */
+#define R_X86_64_GOTPC3 26 /* 32 bit signed pc relative offset to GOT */
+#define R_X86_64_GOT64 27 /* 64-bit GOT entry offset */
+#define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset to GOT entry */
+#define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT */
+#define R_X86_64_GOTPLT64 30 /* like GOT64, says PLT entry needed */
+#define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset to PLT entry */
+#define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend */
+#define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend */
+#define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */
+#define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS descriptor. */
+#define R_X86_64_TLSDESC 36 /* TLS descriptor. */
+#define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */
+#define R_X86_64_RELATIVE64 38 /* 64-bit adjust by program base */
+#define R_X86_64_GOTPCRELX 41 /* Load from 32 bit signed pc relative offset to GOT entry without REX prefix, relaxable. */
+#define R_X86_64_REX_GOTPCRELX 42 /* Load from 32 bit signed pc relative offset to GOT entry with REX prefix, relaxable. */
+
+/*
+ * RISC-V relocation types
+ */
+
+/* Relocation types used by the dynamic linker */
+#define R_RISCV_NONE 0
+#define R_RISCV_32 1
+#define R_RISCV_64 2
+#define R_RISCV_RELATIVE 3
+#define R_RISCV_COPY 4
+#define R_RISCV_JUMP_SLOT 5
+#define R_RISCV_TLS_DTPMOD32 6
+#define R_RISCV_TLS_DTPMOD64 7
+#define R_RISCV_TLS_DTPREL32 8
+#define R_RISCV_TLS_DTPREL64 9
+#define R_RISCV_TLS_TPREL32 10
+#define R_RISCV_TLS_TPREL64 11
+
+/* Relocation types not used by the dynamic linker */
+#define R_RISCV_BRANCH 16
+#define R_RISCV_JAL 17
+#define R_RISCV_CALL 18
+#define R_RISCV_CALL_PLT 19
+#define R_RISCV_GOT_HI20 20
+#define R_RISCV_TLS_GOT_HI20 21
+#define R_RISCV_TLS_GD_HI20 22
+#define R_RISCV_PCREL_HI20 23
+#define R_RISCV_PCREL_LO12_I 24
+#define R_RISCV_PCREL_LO12_S 25
+#define R_RISCV_HI20 26
+#define R_RISCV_LO12_I 27
+#define R_RISCV_LO12_S 28
+#define R_RISCV_TPREL_HI20 29
+#define R_RISCV_TPREL_LO12_I 30
+#define R_RISCV_TPREL_LO12_S 31
+#define R_RISCV_TPREL_ADD 32
+#define R_RISCV_ADD8 33
+#define R_RISCV_ADD16 34
+#define R_RISCV_ADD32 35
+#define R_RISCV_ADD64 36
+#define R_RISCV_SUB8 37
+#define R_RISCV_SUB16 38
+#define R_RISCV_SUB32 39
+#define R_RISCV_SUB64 40
+#define R_RISCV_GNU_VTINHERIT 41
+#define R_RISCV_GNU_VTENTRY 42
+#define R_RISCV_ALIGN 43
+#define R_RISCV_RVC_BRANCH 44
+#define R_RISCV_RVC_JUMP 45
+#define R_RISCV_RVC_LUI 46
+#define R_RISCV_GPREL_I 47
+#define R_RISCV_GPREL_S 48
+#define R_RISCV_TPREL_I 49
+#define R_RISCV_TPREL_S 50
+#define R_RISCV_RELAX 51
+#define R_RISCV_SUB6 52
+#define R_RISCV_SET6 53
+#define R_RISCV_SET8 54
+#define R_RISCV_SET16 55
+#define R_RISCV_SET32 56
+#endif /* !_SYS_ELF_COMMON_H_ */
diff --git a/roms/edk2/BaseTools/Source/C/GenSec/GNUmakefile b/roms/edk2/BaseTools/Source/C/GenSec/GNUmakefile
new file mode 100644
index 000000000..9f0844c1b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenSec/GNUmakefile
@@ -0,0 +1,23 @@
+## @file
+# GNU/Linux makefile for 'GenSec' module build.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+MAKEROOT ?= ..
+
+APPNAME = GenSec
+
+OBJECTS = GenSec.o
+
+include $(MAKEROOT)/Makefiles/app.makefile
+
+LIBS = -lCommon
+ifeq ($(CYGWIN), CYGWIN)
+ LIBS += -L/lib/e2fsprogs -luuid
+endif
+
+ifeq ($(LINUX), Linux)
+ LIBS += -luuid
+endif
+
diff --git a/roms/edk2/BaseTools/Source/C/GenSec/GenSec.c b/roms/edk2/BaseTools/Source/C/GenSec/GenSec.c
new file mode 100644
index 000000000..d54a4f9e0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenSec/GenSec.c
@@ -0,0 +1,1811 @@
+/** @file
+Creates output file that is a properly formed section per the PI spec.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#ifndef __GNUC__
+#include <windows.h>
+#include <io.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <Common/UefiBaseTypes.h>
+#include <Common/PiFirmwareFile.h>
+#include <Protocol/GuidedSectionExtraction.h>
+#include <IndustryStandard/PeImage.h>
+
+#include "CommonLib.h"
+#include "Compress.h"
+#include "Crc32.h"
+#include "EfiUtilityMsgs.h"
+#include "ParseInf.h"
+#include "FvLib.h"
+#include "PeCoffLib.h"
+
+//
+// GenSec Tool Information
+//
+#define UTILITY_NAME "GenSec"
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 1
+
+STATIC CHAR8 *mSectionTypeName[] = {
+ NULL, // 0x00 - reserved
+ "EFI_SECTION_COMPRESSION", // 0x01
+ "EFI_SECTION_GUID_DEFINED", // 0x02
+ NULL, // 0x03 - reserved
+ NULL, // 0x04 - reserved
+ NULL, // 0x05 - reserved
+ NULL, // 0x06 - reserved
+ NULL, // 0x07 - reserved
+ NULL, // 0x08 - reserved
+ NULL, // 0x09 - reserved
+ NULL, // 0x0A - reserved
+ NULL, // 0x0B - reserved
+ NULL, // 0x0C - reserved
+ NULL, // 0x0D - reserved
+ NULL, // 0x0E - reserved
+ NULL, // 0x0F - reserved
+ "EFI_SECTION_PE32", // 0x10
+ "EFI_SECTION_PIC", // 0x11
+ "EFI_SECTION_TE", // 0x12
+ "EFI_SECTION_DXE_DEPEX", // 0x13
+ "EFI_SECTION_VERSION", // 0x14
+ "EFI_SECTION_USER_INTERFACE", // 0x15
+ "EFI_SECTION_COMPATIBILITY16", // 0x16
+ "EFI_SECTION_FIRMWARE_VOLUME_IMAGE", // 0x17
+ "EFI_SECTION_FREEFORM_SUBTYPE_GUID", // 0x18
+ "EFI_SECTION_RAW", // 0x19
+ NULL, // 0x1A
+ "EFI_SECTION_PEI_DEPEX", // 0x1B
+ "EFI_SECTION_SMM_DEPEX" // 0x1C
+};
+
+STATIC CHAR8 *mCompressionTypeName[] = { "PI_NONE", "PI_STD" };
+
+#define EFI_GUIDED_SECTION_NONE 0x80
+STATIC CHAR8 *mGUIDedSectionAttribue[] = { "NONE", "PROCESSING_REQUIRED", "AUTH_STATUS_VALID"};
+
+STATIC CHAR8 *mAlignName[] = {
+ "1", "2", "4", "8", "16", "32", "64", "128", "256", "512",
+ "1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K",
+ "512K", "1M", "2M", "4M", "8M", "16M"
+};
+
+//
+// Crc32 GUID section related definitions.
+//
+typedef struct {
+ EFI_GUID_DEFINED_SECTION GuidSectionHeader;
+ UINT32 CRC32Checksum;
+} CRC32_SECTION_HEADER;
+
+typedef struct {
+ EFI_GUID_DEFINED_SECTION2 GuidSectionHeader;
+ UINT32 CRC32Checksum;
+} CRC32_SECTION_HEADER2;
+
+STATIC EFI_GUID mZeroGuid = {0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
+STATIC EFI_GUID mEfiCrc32SectionGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;
+
+STATIC
+VOID
+Version (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Print out version information for this utility.
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
+}
+
+STATIC
+VOID
+Usage (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Print Help message.
+
+Arguments:
+
+ VOID
+
+Returns:
+
+ None
+
+--*/
+{
+ //
+ // Summary usage
+ //
+ fprintf (stdout, "\nUsage: %s [options] [input_file]\n\n", UTILITY_NAME);
+
+ //
+ // Copyright declaration
+ //
+ fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
+
+ //
+ // Details Option
+ //
+ fprintf (stdout, "Options:\n");
+ fprintf (stdout, " -o FileName, --outputfile FileName\n\
+ File is the SectionFile to be created.\n");
+ fprintf (stdout, " -s [SectionType], --sectiontype [SectionType]\n\
+ SectionType defined in PI spec is one type of\n\
+ EFI_SECTION_COMPRESSION, EFI_SECTION_GUID_DEFINED,\n\
+ EFI_SECTION_PE32, EFI_SECTION_PIC, EFI_SECTION_TE,\n\
+ EFI_SECTION_DXE_DEPEX, EFI_SECTION_COMPATIBILITY16,\n\
+ EFI_SECTION_USER_INTERFACE, EFI_SECTION_VERSION,\n\
+ EFI_SECTION_FIRMWARE_VOLUME_IMAGE, EFI_SECTION_RAW,\n\
+ EFI_SECTION_FREEFORM_SUBTYPE_GUID,\n\
+ EFI_SECTION_PEI_DEPEX, EFI_SECTION_SMM_DEPEX.\n\
+ if -s option is not given, \n\
+ EFI_SECTION_ALL is default section type.\n");
+ fprintf (stdout, " -c [Type], --compress [Type]\n\
+ Compress method type can be PI_NONE or PI_STD.\n\
+ if -c option is not given, PI_STD is default type.\n");
+ fprintf (stdout, " -g GuidValue, --vendor GuidValue\n\
+ GuidValue is one specific vendor guid value.\n\
+ Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n");
+ fprintf (stdout, " -l GuidHeaderLength, --HeaderLength GuidHeaderLength\n\
+ GuidHeaderLength is the size of header of guided data\n");
+ fprintf (stdout, " -r GuidAttr, --attributes GuidAttr\n\
+ GuidAttr is guid section attributes, which may be\n\
+ PROCESSING_REQUIRED, AUTH_STATUS_VALID and NONE. \n\
+ if -r option is not given, default PROCESSING_REQUIRED\n");
+ fprintf (stdout, " -n String, --name String\n\
+ String is a NULL terminated string used in Ui section.\n");
+ fprintf (stdout, " -j Number, --buildnumber Number\n\
+ Number is an integer value between 0 and 65535\n\
+ used in Ver section.\n");
+ fprintf (stdout, " --sectionalign SectionAlign\n\
+ SectionAlign points to section alignment, which support\n\
+ the alignment scope 0~16M. If SectionAlign is specified\n\
+ as 0, tool get alignment value from SectionFile. It is\n\
+ specified in same order that the section file is input.\n");
+ fprintf (stdout, " --dummy dummyfile\n\
+ compare dummpyfile with input_file to decide whether\n\
+ need to set PROCESSING_REQUIRED attribute.\n");
+ fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n");
+ fprintf (stdout, " -q, --quiet Disable all messages except key message and fatal error\n");
+ fprintf (stdout, " -d, --debug level Enable debug messages, at input debug level.\n");
+ fprintf (stdout, " --version Show program's version number and exit.\n");
+ fprintf (stdout, " -h, --help Show this help message and exit.\n");
+}
+
+VOID
+Ascii2UnicodeString (
+ CHAR8 *String,
+ CHAR16 *UniString
+ )
+/*++
+
+Routine Description:
+
+ Write ascii string as unicode string format to FILE
+
+Arguments:
+
+ String - Pointer to string that is written to FILE.
+ UniString - Pointer to unicode string
+
+Returns:
+
+ NULL
+
+--*/
+{
+ while (*String != '\0') {
+ *(UniString++) = (CHAR16) *(String++);
+ }
+ //
+ // End the UniString with a NULL.
+ //
+ *UniString = '\0';
+}
+
+STATUS
+GenSectionCommonLeafSection (
+ CHAR8 **InputFileName,
+ UINT32 InputFileNum,
+ UINT8 SectionType,
+ UINT8 **OutFileBuffer
+ )
+/*++
+
+Routine Description:
+
+ Generate a leaf section of type other than EFI_SECTION_VERSION
+ and EFI_SECTION_USER_INTERFACE. Input file must be well formed.
+ The function won't validate the input file's contents. For
+ common leaf sections, the input file may be a binary file.
+ The utility will add section header to the file.
+
+Arguments:
+
+ InputFileName - Name of the input file.
+
+ InputFileNum - Number of input files. Should be 1 for leaf section.
+
+ SectionType - A valid section type string
+
+ OutFileBuffer - Buffer pointer to Output file contents
+
+Returns:
+
+ STATUS_ERROR - can't continue
+ STATUS_SUCCESS - successful return
+
+--*/
+{
+ UINT32 InputFileLength;
+ FILE *InFile;
+ UINT8 *Buffer;
+ UINT32 TotalLength;
+ UINT32 HeaderLength;
+ EFI_COMMON_SECTION_HEADER *CommonSect;
+ STATUS Status;
+
+ if (InputFileNum > 1) {
+ Error (NULL, 0, 2000, "Invalid parameter", "more than one input file specified");
+ return STATUS_ERROR;
+ } else if (InputFileNum < 1) {
+ Error (NULL, 0, 2000, "Invalid parameter", "no input file specified");
+ return STATUS_ERROR;
+ }
+ //
+ // Open the input file
+ //
+ InFile = fopen (LongFilePath (InputFileName[0]), "rb");
+ if (InFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", InputFileName[0]);
+ return STATUS_ERROR;
+ }
+
+ Status = STATUS_ERROR;
+ Buffer = NULL;
+ //
+ // Seek to the end of the input file so we can determine its size
+ //
+ fseek (InFile, 0, SEEK_END);
+ InputFileLength = ftell (InFile);
+ fseek (InFile, 0, SEEK_SET);
+ DebugMsg (NULL, 0, 9, "Input file", "File name is %s and File size is %u bytes", InputFileName[0], (unsigned) InputFileLength);
+ TotalLength = sizeof (EFI_COMMON_SECTION_HEADER) + InputFileLength;
+ //
+ // Size must fit in 3 bytes
+ //
+ //if (TotalLength >= MAX_SECTION_SIZE) {
+ // Error (NULL, 0, 2000, "Invalid parameter", "%s file size (0x%X) exceeds section size limit(%uM).", InputFileName[0], (unsigned) TotalLength, MAX_SECTION_SIZE>>20);
+ // goto Done;
+ //}
+ HeaderLength = sizeof (EFI_COMMON_SECTION_HEADER);
+ if (TotalLength >= MAX_SECTION_SIZE) {
+ TotalLength = sizeof (EFI_COMMON_SECTION_HEADER2) + InputFileLength;
+ HeaderLength = sizeof (EFI_COMMON_SECTION_HEADER2);
+ }
+ VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);
+ //
+ // Fill in the fields in the local section header structure
+ //
+ Buffer = (UINT8 *) malloc ((size_t) TotalLength);
+ if (Buffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated");
+ goto Done;
+ }
+ CommonSect = (EFI_COMMON_SECTION_HEADER *) Buffer;
+ CommonSect->Type = SectionType;
+ if (TotalLength < MAX_SECTION_SIZE) {
+ CommonSect->Size[0] = (UINT8) (TotalLength & 0xff);
+ CommonSect->Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);
+ CommonSect->Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);
+ } else {
+ memset(CommonSect->Size, 0xff, sizeof(UINT8) * 3);
+ ((EFI_COMMON_SECTION_HEADER2 *)CommonSect)->ExtendedSize = TotalLength;
+ }
+
+ //
+ // read data from the input file.
+ //
+ if (InputFileLength != 0) {
+ if (fread (Buffer + HeaderLength, (size_t) InputFileLength, 1, InFile) != 1) {
+ Error (NULL, 0, 0004, "Error reading file", InputFileName[0]);
+ goto Done;
+ }
+ }
+
+ //
+ // Set OutFileBuffer
+ //
+ *OutFileBuffer = Buffer;
+ Status = STATUS_SUCCESS;
+
+Done:
+ fclose (InFile);
+
+ return Status;
+}
+
+STATIC
+EFI_STATUS
+StringtoAlignment (
+ IN CHAR8 *AlignBuffer,
+ OUT UINT32 *AlignNumber
+ )
+/*++
+
+Routine Description:
+
+ Converts Align String to align value (1~16M).
+
+Arguments:
+
+ AlignBuffer - Pointer to Align string.
+ AlignNumber - Pointer to Align value.
+
+Returns:
+
+ EFI_SUCCESS Successfully convert align string to align value.
+ EFI_INVALID_PARAMETER Align string is invalid or align value is not in scope.
+
+--*/
+{
+ UINT32 Index = 0;
+ //
+ // Check AlignBuffer
+ //
+ if (AlignBuffer == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ for (Index = 0; Index < sizeof (mAlignName) / sizeof (CHAR8 *); Index ++) {
+ if (stricmp (AlignBuffer, mAlignName [Index]) == 0) {
+ *AlignNumber = 1 << Index;
+ return EFI_SUCCESS;
+ }
+ }
+ return EFI_INVALID_PARAMETER;
+}
+
+EFI_STATUS
+GetSectionContents (
+ CHAR8 **InputFileName,
+ UINT32 *InputFileAlign,
+ UINT32 InputFileNum,
+ UINT8 *FileBuffer,
+ UINT32 *BufferLength
+ )
+/*++
+
+Routine Description:
+
+ Get the contents of all section files specified in InputFileName
+ into FileBuffer.
+
+Arguments:
+
+ InputFileName - Name of the input file.
+
+ InputFileAlign - Alignment required by the input file data.
+
+ InputFileNum - Number of input files. Should be at least 1.
+
+ FileBuffer - Output buffer to contain data
+
+ BufferLength - On input, this is size of the FileBuffer.
+ On output, this is the actual length of the data.
+
+Returns:
+
+ EFI_SUCCESS on successful return
+ EFI_INVALID_PARAMETER if InputFileNum is less than 1 or BufferLength point is NULL.
+ EFI_ABORTED if unable to open input file.
+ EFI_BUFFER_TOO_SMALL FileBuffer is not enough to contain all file data.
+--*/
+{
+ UINT32 Size;
+ UINT32 Offset;
+ UINT32 FileSize;
+ UINT32 Index;
+ FILE *InFile;
+ EFI_COMMON_SECTION_HEADER *SectHeader;
+ EFI_COMMON_SECTION_HEADER2 TempSectHeader;
+ EFI_TE_IMAGE_HEADER TeHeader;
+ UINT32 TeOffset;
+ EFI_GUID_DEFINED_SECTION GuidSectHeader;
+ EFI_GUID_DEFINED_SECTION2 GuidSectHeader2;
+ UINT32 HeaderSize;
+
+ if (InputFileNum < 1) {
+ Error (NULL, 0, 2000, "Invalid parameter", "must specify at least one input file");
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (BufferLength == NULL) {
+ Error (NULL, 0, 2000, "Invalid parameter", "BufferLength can't be NULL");
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Size = 0;
+ Offset = 0;
+ TeOffset = 0;
+ //
+ // Go through our array of file names and copy their contents
+ // to the output buffer.
+ //
+ for (Index = 0; Index < InputFileNum; Index++) {
+ //
+ // make sure section ends on a DWORD boundary
+ //
+ while ((Size & 0x03) != 0) {
+ if (FileBuffer != NULL && Size < *BufferLength) {
+ FileBuffer[Size] = 0;
+ }
+ Size++;
+ }
+
+ //
+ // Open file and read contents
+ //
+ InFile = fopen (LongFilePath (InputFileName[Index]), "rb");
+ if (InFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", InputFileName[Index]);
+ return EFI_ABORTED;
+ }
+
+ fseek (InFile, 0, SEEK_END);
+ FileSize = ftell (InFile);
+ fseek (InFile, 0, SEEK_SET);
+ DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
+ //
+ // Adjust section buffer when section alignment is required.
+ //
+ if (InputFileAlign != NULL) {
+ //
+ // Check this section is Te/Pe section, and Calculate the numbers of Te/Pe section.
+ //
+ TeOffset = 0;
+ //
+ // The section might be EFI_COMMON_SECTION_HEADER2
+ // But only Type needs to be checked
+ //
+ if (FileSize >= MAX_SECTION_SIZE) {
+ HeaderSize = sizeof (EFI_COMMON_SECTION_HEADER2);
+ } else {
+ HeaderSize = sizeof (EFI_COMMON_SECTION_HEADER);
+ }
+ fread (&TempSectHeader, 1, HeaderSize, InFile);
+ if (TempSectHeader.Type == EFI_SECTION_TE) {
+ fread (&TeHeader, 1, sizeof (TeHeader), InFile);
+ if (TeHeader.Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
+ TeOffset = TeHeader.StrippedSize - sizeof (TeHeader);
+ }
+ } else if (TempSectHeader.Type == EFI_SECTION_GUID_DEFINED) {
+ fseek (InFile, 0, SEEK_SET);
+ if (FileSize >= MAX_SECTION_SIZE) {
+ fread (&GuidSectHeader2, 1, sizeof (GuidSectHeader2), InFile);
+ if ((GuidSectHeader2.Attributes & EFI_GUIDED_SECTION_PROCESSING_REQUIRED) == 0) {
+ HeaderSize = GuidSectHeader2.DataOffset;
+ }
+ } else {
+ fread (&GuidSectHeader, 1, sizeof (GuidSectHeader), InFile);
+ if ((GuidSectHeader.Attributes & EFI_GUIDED_SECTION_PROCESSING_REQUIRED) == 0) {
+ HeaderSize = GuidSectHeader.DataOffset;
+ }
+ }
+ }
+
+ fseek (InFile, 0, SEEK_SET);
+
+ //
+ // Revert TeOffset to the converse value relative to Alignment
+ // This is to assure the original PeImage Header at Alignment.
+ //
+ if (TeOffset != 0) {
+ TeOffset = InputFileAlign [Index] - (TeOffset % InputFileAlign [Index]);
+ TeOffset = TeOffset % InputFileAlign [Index];
+ }
+
+ //
+ // make sure section data meet its alignment requirement by adding one raw pad section.
+ //
+ if ((InputFileAlign [Index] != 0) && (((Size + HeaderSize + TeOffset) % InputFileAlign [Index]) != 0)) {
+ Offset = (Size + sizeof (EFI_COMMON_SECTION_HEADER) + HeaderSize + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
+ Offset = Offset - Size - HeaderSize - TeOffset;
+
+ if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) {
+ //
+ // The maximal alignment is 64K, the raw section size must be less than 0xffffff
+ //
+ memset (FileBuffer + Size, 0, Offset);
+ SectHeader = (EFI_COMMON_SECTION_HEADER *) (FileBuffer + Size);
+ SectHeader->Type = EFI_SECTION_RAW;
+ SectHeader->Size[0] = (UINT8) (Offset & 0xff);
+ SectHeader->Size[1] = (UINT8) ((Offset & 0xff00) >> 8);
+ SectHeader->Size[2] = (UINT8) ((Offset & 0xff0000) >> 16);
+ }
+ DebugMsg (NULL, 0, 9, "Pad raw section for section data alignment", "Pad Raw section size is %u", (unsigned) Offset);
+
+ Size = Size + Offset;
+ }
+ }
+
+ //
+ // Now read the contents of the file into the buffer
+ // Buffer must be enough to contain the file content.
+ //
+ if ((FileSize > 0) && (FileBuffer != NULL) && ((Size + FileSize) <= *BufferLength)) {
+ if (fread (FileBuffer + Size, (size_t) FileSize, 1, InFile) != 1) {
+ Error (NULL, 0, 0004, "Error reading file", InputFileName[Index]);
+ fclose (InFile);
+ return EFI_ABORTED;
+ }
+ }
+
+ fclose (InFile);
+ Size += FileSize;
+ }
+
+ //
+ // Set the real required buffer size.
+ //
+ if (Size > *BufferLength) {
+ *BufferLength = Size;
+ return EFI_BUFFER_TOO_SMALL;
+ } else {
+ *BufferLength = Size;
+ return EFI_SUCCESS;
+ }
+}
+
+EFI_STATUS
+GenSectionCompressionSection (
+ CHAR8 **InputFileName,
+ UINT32 *InputFileAlign,
+ UINT32 InputFileNum,
+ UINT8 SectCompSubType,
+ UINT8 **OutFileBuffer
+ )
+/*++
+
+Routine Description:
+
+ Generate an encapsulating section of type EFI_SECTION_COMPRESSION
+ Input file must be already sectioned. The function won't validate
+ the input files' contents. Caller should hand in files already
+ with section header.
+
+Arguments:
+
+ InputFileName - Name of the input file.
+
+ InputFileAlign - Alignment required by the input file data.
+
+ InputFileNum - Number of input files. Should be at least 1.
+
+ SectCompSubType - Specify the compression algorithm requested.
+
+ OutFileBuffer - Buffer pointer to Output file contents
+
+Returns:
+
+ EFI_SUCCESS on successful return
+ EFI_INVALID_PARAMETER if InputFileNum is less than 1
+ EFI_ABORTED if unable to open input file.
+ EFI_OUT_OF_RESOURCES No resource to complete the operation.
+--*/
+{
+ UINT32 TotalLength;
+ UINT32 InputLength;
+ UINT32 CompressedLength;
+ UINT32 HeaderLength;
+ UINT8 *FileBuffer;
+ UINT8 *OutputBuffer;
+ EFI_STATUS Status;
+ EFI_COMPRESSION_SECTION *CompressionSect;
+ EFI_COMPRESSION_SECTION2 *CompressionSect2;
+ COMPRESS_FUNCTION CompressFunction;
+
+ InputLength = 0;
+ FileBuffer = NULL;
+ OutputBuffer = NULL;
+ CompressedLength = 0;
+ TotalLength = 0;
+ //
+ // read all input file contents into a buffer
+ // first get the size of all file contents
+ //
+ Status = GetSectionContents (
+ InputFileName,
+ InputFileAlign,
+ InputFileNum,
+ FileBuffer,
+ &InputLength
+ );
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ FileBuffer = (UINT8 *) malloc (InputLength);
+ if (FileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated");
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // read all input file contents into a buffer
+ //
+ Status = GetSectionContents (
+ InputFileName,
+ InputFileAlign,
+ InputFileNum,
+ FileBuffer,
+ &InputLength
+ );
+ }
+
+ if (EFI_ERROR (Status)) {
+ if (FileBuffer != NULL) {
+ free (FileBuffer);
+ }
+ return Status;
+ }
+
+ if (FileBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CompressFunction = NULL;
+
+ //
+ // Now data is in FileBuffer, compress the data
+ //
+ switch (SectCompSubType) {
+ case EFI_NOT_COMPRESSED:
+ CompressedLength = InputLength;
+ HeaderLength = sizeof (EFI_COMPRESSION_SECTION);
+ if (CompressedLength + HeaderLength >= MAX_SECTION_SIZE) {
+ HeaderLength = sizeof (EFI_COMPRESSION_SECTION2);
+ }
+ TotalLength = CompressedLength + HeaderLength;
+ //
+ // Copy file buffer to the none compressed data.
+ //
+ OutputBuffer = malloc (TotalLength);
+ if (OutputBuffer == NULL) {
+ free (FileBuffer);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ memcpy (OutputBuffer + HeaderLength, FileBuffer, CompressedLength);
+ free (FileBuffer);
+ FileBuffer = OutputBuffer;
+ break;
+
+ case EFI_STANDARD_COMPRESSION:
+ CompressFunction = (COMPRESS_FUNCTION) EfiCompress;
+ break;
+
+ default:
+ Error (NULL, 0, 2000, "Invalid parameter", "unknown compression type");
+ free (FileBuffer);
+ return EFI_ABORTED;
+ }
+
+ if (CompressFunction != NULL) {
+
+ Status = CompressFunction (FileBuffer, InputLength, OutputBuffer, &CompressedLength);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ HeaderLength = sizeof (EFI_COMPRESSION_SECTION);
+ if (CompressedLength + HeaderLength >= MAX_SECTION_SIZE) {
+ HeaderLength = sizeof (EFI_COMPRESSION_SECTION2);
+ }
+ TotalLength = CompressedLength + HeaderLength;
+ OutputBuffer = malloc (TotalLength);
+ if (!OutputBuffer) {
+ free (FileBuffer);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = CompressFunction (FileBuffer, InputLength, OutputBuffer + HeaderLength, &CompressedLength);
+ }
+
+ free (FileBuffer);
+ FileBuffer = OutputBuffer;
+
+ if (EFI_ERROR (Status)) {
+ if (FileBuffer != NULL) {
+ free (FileBuffer);
+ }
+
+ return Status;
+ }
+
+ if (FileBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ }
+
+ DebugMsg (NULL, 0, 9, "comprss file size",
+ "the original section size is %d bytes and the compressed section size is %u bytes", (unsigned) InputLength, (unsigned) CompressedLength);
+
+ //if (TotalLength >= MAX_SECTION_SIZE) {
+ // Error (NULL, 0, 2000, "Invalid parameter", "The size of all files exceeds section size limit(%uM).", MAX_SECTION_SIZE>>20);
+ // if (FileBuffer != NULL) {
+ // free (FileBuffer);
+ // }
+ // if (OutputBuffer != NULL) {
+ // free (OutputBuffer);
+ // }
+ // return STATUS_ERROR;
+ //}
+ VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);
+
+ //
+ // Add the section header for the compressed data
+ //
+ if (TotalLength >= MAX_SECTION_SIZE) {
+ CompressionSect2 = (EFI_COMPRESSION_SECTION2 *)FileBuffer;
+
+ memset(CompressionSect2->CommonHeader.Size, 0xff, sizeof(UINT8) * 3);
+ CompressionSect2->CommonHeader.Type = EFI_SECTION_COMPRESSION;
+ CompressionSect2->CommonHeader.ExtendedSize = TotalLength;
+ CompressionSect2->CompressionType = SectCompSubType;
+ CompressionSect2->UncompressedLength = InputLength;
+ } else {
+ CompressionSect = (EFI_COMPRESSION_SECTION *) FileBuffer;
+
+ CompressionSect->CommonHeader.Type = EFI_SECTION_COMPRESSION;
+ CompressionSect->CommonHeader.Size[0] = (UINT8) (TotalLength & 0xff);
+ CompressionSect->CommonHeader.Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);
+ CompressionSect->CommonHeader.Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);
+ CompressionSect->CompressionType = SectCompSubType;
+ CompressionSect->UncompressedLength = InputLength;
+ }
+
+ //
+ // Set OutFileBuffer
+ //
+ *OutFileBuffer = FileBuffer;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GenSectionGuidDefinedSection (
+ CHAR8 **InputFileName,
+ UINT32 *InputFileAlign,
+ UINT32 InputFileNum,
+ EFI_GUID *VendorGuid,
+ UINT16 DataAttribute,
+ UINT32 DataHeaderSize,
+ UINT8 **OutFileBuffer
+ )
+/*++
+
+Routine Description:
+
+ Generate an encapsulating section of type EFI_SECTION_GUID_DEFINED
+ Input file must be already sectioned. The function won't validate
+ the input files' contents. Caller should hand in files already
+ with section header.
+
+Arguments:
+
+ InputFileName - Name of the input file.
+
+ InputFileAlign - Alignment required by the input file data.
+
+ InputFileNum - Number of input files. Should be at least 1.
+
+ VendorGuid - Specify vendor guid value.
+
+ DataAttribute - Specify attribute for the vendor guid data.
+
+ DataHeaderSize- Guided Data Header Size
+
+ OutFileBuffer - Buffer pointer to Output file contents
+
+Returns:
+
+ EFI_SUCCESS on successful return
+ EFI_INVALID_PARAMETER if InputFileNum is less than 1
+ EFI_ABORTED if unable to open input file.
+ EFI_OUT_OF_RESOURCES No resource to complete the operation.
+
+--*/
+{
+ UINT32 TotalLength;
+ UINT32 InputLength;
+ UINT32 Offset;
+ UINT8 *FileBuffer;
+ UINT32 Crc32Checksum;
+ EFI_STATUS Status;
+ CRC32_SECTION_HEADER *Crc32GuidSect;
+ CRC32_SECTION_HEADER2 *Crc32GuidSect2;
+ EFI_GUID_DEFINED_SECTION *VendorGuidSect;
+ EFI_GUID_DEFINED_SECTION2 *VendorGuidSect2;
+
+ InputLength = 0;
+ Offset = 0;
+ FileBuffer = NULL;
+ TotalLength = 0;
+
+ //
+ // read all input file contents into a buffer
+ // first get the size of all file contents
+ //
+ Status = GetSectionContents (
+ InputFileName,
+ InputFileAlign,
+ InputFileNum,
+ FileBuffer,
+ &InputLength
+ );
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ if (CompareGuid (VendorGuid, &mZeroGuid) == 0) {
+ Offset = sizeof (CRC32_SECTION_HEADER);
+ if (InputLength + Offset >= MAX_SECTION_SIZE) {
+ Offset = sizeof (CRC32_SECTION_HEADER2);
+ }
+ } else {
+ Offset = sizeof (EFI_GUID_DEFINED_SECTION);
+ if (InputLength + Offset >= MAX_SECTION_SIZE) {
+ Offset = sizeof (EFI_GUID_DEFINED_SECTION2);
+ }
+ }
+ TotalLength = InputLength + Offset;
+
+ FileBuffer = (UINT8 *) malloc (InputLength + Offset);
+ if (FileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated");
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // read all input file contents into a buffer
+ //
+ Status = GetSectionContents (
+ InputFileName,
+ InputFileAlign,
+ InputFileNum,
+ FileBuffer + Offset,
+ &InputLength
+ );
+ }
+
+ if (EFI_ERROR (Status)) {
+ if (FileBuffer != NULL) {
+ free (FileBuffer);
+ }
+ Error (NULL, 0, 0001, "Error opening file for reading", InputFileName[0]);
+ return Status;
+ }
+
+ if (InputLength == 0) {
+ if (FileBuffer != NULL) {
+ free (FileBuffer);
+ }
+ Error (NULL, 0, 2000, "Invalid parameter", "the size of input file %s can't be zero", InputFileName);
+ return EFI_NOT_FOUND;
+ }
+
+ //
+ // InputLength != 0, but FileBuffer == NULL means out of resources.
+ //
+ if (FileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated");
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Now data is in FileBuffer + Offset
+ //
+ if (CompareGuid (VendorGuid, &mZeroGuid) == 0) {
+ //
+ // Default Guid section is CRC32.
+ //
+ Crc32Checksum = 0;
+ CalculateCrc32 (FileBuffer + Offset, InputLength, &Crc32Checksum);
+
+ if (TotalLength >= MAX_SECTION_SIZE) {
+ Crc32GuidSect2 = (CRC32_SECTION_HEADER2 *) FileBuffer;
+ Crc32GuidSect2->GuidSectionHeader.CommonHeader.Type = EFI_SECTION_GUID_DEFINED;
+ Crc32GuidSect2->GuidSectionHeader.CommonHeader.Size[0] = (UINT8) 0xff;
+ Crc32GuidSect2->GuidSectionHeader.CommonHeader.Size[1] = (UINT8) 0xff;
+ Crc32GuidSect2->GuidSectionHeader.CommonHeader.Size[2] = (UINT8) 0xff;
+ Crc32GuidSect2->GuidSectionHeader.CommonHeader.ExtendedSize = TotalLength;
+ memcpy (&(Crc32GuidSect2->GuidSectionHeader.SectionDefinitionGuid), &mEfiCrc32SectionGuid, sizeof (EFI_GUID));
+ Crc32GuidSect2->GuidSectionHeader.Attributes = EFI_GUIDED_SECTION_AUTH_STATUS_VALID;
+ Crc32GuidSect2->GuidSectionHeader.DataOffset = sizeof (CRC32_SECTION_HEADER2);
+ Crc32GuidSect2->CRC32Checksum = Crc32Checksum;
+ DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %u", Crc32GuidSect2->GuidSectionHeader.DataOffset);
+ } else {
+ Crc32GuidSect = (CRC32_SECTION_HEADER *) FileBuffer;
+ Crc32GuidSect->GuidSectionHeader.CommonHeader.Type = EFI_SECTION_GUID_DEFINED;
+ Crc32GuidSect->GuidSectionHeader.CommonHeader.Size[0] = (UINT8) (TotalLength & 0xff);
+ Crc32GuidSect->GuidSectionHeader.CommonHeader.Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);
+ Crc32GuidSect->GuidSectionHeader.CommonHeader.Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);
+ memcpy (&(Crc32GuidSect->GuidSectionHeader.SectionDefinitionGuid), &mEfiCrc32SectionGuid, sizeof (EFI_GUID));
+ Crc32GuidSect->GuidSectionHeader.Attributes = EFI_GUIDED_SECTION_AUTH_STATUS_VALID;
+ Crc32GuidSect->GuidSectionHeader.DataOffset = sizeof (CRC32_SECTION_HEADER);
+ Crc32GuidSect->CRC32Checksum = Crc32Checksum;
+ DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %u", Crc32GuidSect->GuidSectionHeader.DataOffset);
+ }
+ } else {
+ if (TotalLength >= MAX_SECTION_SIZE) {
+ VendorGuidSect2 = (EFI_GUID_DEFINED_SECTION2 *) FileBuffer;
+ VendorGuidSect2->CommonHeader.Type = EFI_SECTION_GUID_DEFINED;
+ VendorGuidSect2->CommonHeader.Size[0] = (UINT8) 0xff;
+ VendorGuidSect2->CommonHeader.Size[1] = (UINT8) 0xff;
+ VendorGuidSect2->CommonHeader.Size[2] = (UINT8) 0xff;
+ VendorGuidSect2->CommonHeader.ExtendedSize = InputLength + sizeof (EFI_GUID_DEFINED_SECTION2);
+ memcpy (&(VendorGuidSect2->SectionDefinitionGuid), VendorGuid, sizeof (EFI_GUID));
+ VendorGuidSect2->Attributes = DataAttribute;
+ VendorGuidSect2->DataOffset = (UINT16) (sizeof (EFI_GUID_DEFINED_SECTION2) + DataHeaderSize);
+ DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %u", VendorGuidSect2->DataOffset);
+ } else {
+ VendorGuidSect = (EFI_GUID_DEFINED_SECTION *) FileBuffer;
+ VendorGuidSect->CommonHeader.Type = EFI_SECTION_GUID_DEFINED;
+ VendorGuidSect->CommonHeader.Size[0] = (UINT8) (TotalLength & 0xff);
+ VendorGuidSect->CommonHeader.Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);
+ VendorGuidSect->CommonHeader.Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);
+ memcpy (&(VendorGuidSect->SectionDefinitionGuid), VendorGuid, sizeof (EFI_GUID));
+ VendorGuidSect->Attributes = DataAttribute;
+ VendorGuidSect->DataOffset = (UINT16) (sizeof (EFI_GUID_DEFINED_SECTION) + DataHeaderSize);
+ DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %u", VendorGuidSect->DataOffset);
+ }
+ }
+ VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);
+
+ //
+ // Set OutFileBuffer
+ //
+ *OutFileBuffer = FileBuffer;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+FfsRebaseImageRead (
+ IN VOID *FileHandle,
+ IN UINTN FileOffset,
+ IN OUT UINT32 *ReadSize,
+ OUT VOID *Buffer
+ )
+ /*++
+
+ Routine Description:
+
+ Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
+
+ Arguments:
+
+ FileHandle - The handle to the PE/COFF file
+
+ FileOffset - The offset, in bytes, into the file to read
+
+ ReadSize - The number of bytes to read from the file starting at FileOffset
+
+ Buffer - A pointer to the buffer to read the data into.
+
+ Returns:
+
+ EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
+
+ --*/
+{
+ CHAR8 *Destination8;
+ CHAR8 *Source8;
+ UINT32 Length;
+
+ Destination8 = Buffer;
+ Source8 = (CHAR8 *) ((UINTN) FileHandle + FileOffset);
+ Length = *ReadSize;
+ while (Length--) {
+ *(Destination8++) = *(Source8++);
+ }
+
+ return EFI_SUCCESS;
+}
+
+STATIC
+EFI_STATUS
+GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
+ /*
+ InFile is input file for getting alignment
+ return the alignment
+ */
+{
+ FILE *InFileHandle;
+ UINT8 *PeFileBuffer;
+ UINTN PeFileSize;
+ UINT32 CurSecHdrSize;
+ PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
+ EFI_COMMON_SECTION_HEADER *CommonHeader;
+ EFI_STATUS Status;
+
+ InFileHandle = NULL;
+ PeFileBuffer = NULL;
+ *Alignment = 0;
+
+ memset (&ImageContext, 0, sizeof (ImageContext));
+
+ InFileHandle = fopen(LongFilePath(InFile), "rb");
+ if (InFileHandle == NULL){
+ Error (NULL, 0, 0001, "Error opening file", InFile);
+ return EFI_ABORTED;
+ }
+ PeFileSize = _filelength (fileno(InFileHandle));
+ PeFileBuffer = (UINT8 *) malloc (PeFileSize);
+ if (PeFileBuffer == NULL) {
+ fclose (InFileHandle);
+ Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
+ fclose (InFileHandle);
+ CommonHeader = (EFI_COMMON_SECTION_HEADER *) PeFileBuffer;
+ CurSecHdrSize = GetSectionHeaderLength(CommonHeader);
+ ImageContext.Handle = (VOID *) ((UINTN)PeFileBuffer + CurSecHdrSize);
+ ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE)FfsRebaseImageRead;
+ Status = PeCoffLoaderGetImageInfo(&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and return status is %x", InFile, (int) Status);
+ return Status;
+ }
+ *Alignment = ImageContext.SectionAlignment;
+ // Free the allocated memory resource
+ if (PeFileBuffer != NULL) {
+ free (PeFileBuffer);
+ PeFileBuffer = NULL;
+ }
+ return EFI_SUCCESS;
+}
+
+int
+main (
+ int argc,
+ char *argv[]
+ )
+/*++
+
+Routine Description:
+
+ Main
+
+Arguments:
+
+ command line parameters
+
+Returns:
+
+ EFI_SUCCESS Section header successfully generated and section concatenated.
+ EFI_ABORTED Could not generate the section
+ EFI_OUT_OF_RESOURCES No resource to complete the operation.
+
+--*/
+{
+ UINT32 Index;
+ UINT32 InputFileNum;
+ FILE *OutFile;
+ CHAR8 **InputFileName;
+ CHAR8 *OutputFileName;
+ CHAR8 *SectionName;
+ CHAR8 *CompressionName;
+ CHAR8 *StringBuffer;
+ EFI_GUID VendorGuid = mZeroGuid;
+ int VersionNumber;
+ UINT8 SectType;
+ UINT8 SectCompSubType;
+ UINT16 SectGuidAttribute;
+ UINT64 SectGuidHeaderLength;
+ EFI_VERSION_SECTION *VersionSect;
+ EFI_USER_INTERFACE_SECTION *UiSect;
+ UINT32 InputLength;
+ UINT8 *OutFileBuffer;
+ EFI_STATUS Status;
+ UINT64 LogLevel;
+ UINT32 *InputFileAlign;
+ UINT32 InputFileAlignNum;
+ EFI_COMMON_SECTION_HEADER *SectionHeader;
+ CHAR8 *DummyFileName;
+ FILE *DummyFile;
+ UINTN DummyFileSize;
+ UINT8 *DummyFileBuffer;
+ FILE *InFile;
+ UINT8 *InFileBuffer;
+ UINTN InFileSize;
+
+ InputFileAlign = NULL;
+ InputFileAlignNum = 0;
+ InputFileName = NULL;
+ OutputFileName = NULL;
+ SectionName = NULL;
+ CompressionName = NULL;
+ StringBuffer = "";
+ OutFile = NULL;
+ VersionNumber = 0;
+ InputFileNum = 0;
+ SectType = EFI_SECTION_ALL;
+ SectCompSubType = 0;
+ SectGuidAttribute = EFI_GUIDED_SECTION_NONE;
+ OutFileBuffer = NULL;
+ InputLength = 0;
+ Status = STATUS_SUCCESS;
+ LogLevel = 0;
+ SectGuidHeaderLength = 0;
+ VersionSect = NULL;
+ UiSect = NULL;
+ DummyFileSize = 0;
+ DummyFileName = NULL;
+ DummyFile = NULL;
+ DummyFileBuffer = NULL;
+ InFile = NULL;
+ InFileSize = 0;
+ InFileBuffer = NULL;
+
+ SetUtilityName (UTILITY_NAME);
+
+ if (argc == 1) {
+ Error (NULL, 0, 1001, "Missing options", "No options input");
+ Usage ();
+ return STATUS_ERROR;
+ }
+
+ //
+ // Parse command line
+ //
+ argc --;
+ argv ++;
+
+ if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
+ Version ();
+ Usage ();
+ return STATUS_SUCCESS;
+ }
+
+ if (stricmp (argv[0], "--version") == 0) {
+ Version ();
+ return STATUS_SUCCESS;
+ }
+
+ while (argc > 0) {
+ if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--SectionType") == 0)) {
+ SectionName = argv[1];
+ if (SectionName == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Section Type can't be NULL");
+ goto Finish;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
+ OutputFileName = argv[1];
+ if (OutputFileName == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Output file can't be NULL");
+ goto Finish;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-c") == 0) || (stricmp (argv[0], "--compress") == 0)) {
+ CompressionName = argv[1];
+ if (CompressionName == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Compression Type can't be NULL");
+ goto Finish;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-g") == 0) || (stricmp (argv[0], "--vendor") == 0)) {
+ Status = StringToGuid (argv[1], &VendorGuid);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+ if (stricmp (argv[0], "--dummy") == 0) {
+ DummyFileName = argv[1];
+ if (DummyFileName == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Dummy file can't be NULL");
+ goto Finish;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-r") == 0) || (stricmp (argv[0], "--attributes") == 0)) {
+ if (argv[1] == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Guid section attributes can't be NULL");
+ goto Finish;
+ }
+ if (stricmp (argv[1], mGUIDedSectionAttribue[EFI_GUIDED_SECTION_PROCESSING_REQUIRED]) == 0) {
+ SectGuidAttribute |= EFI_GUIDED_SECTION_PROCESSING_REQUIRED;
+ } else if (stricmp (argv[1], mGUIDedSectionAttribue[EFI_GUIDED_SECTION_AUTH_STATUS_VALID]) == 0) {
+ SectGuidAttribute |= EFI_GUIDED_SECTION_AUTH_STATUS_VALID;
+ } else if (stricmp (argv[1], mGUIDedSectionAttribue[0]) == 0) {
+ //
+ // NONE attribute
+ //
+ SectGuidAttribute |= EFI_GUIDED_SECTION_NONE;
+ } else {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-l") == 0) || (stricmp (argv[0], "--HeaderLength") == 0)) {
+ Status = AsciiStringToUint64 (argv[1], FALSE, &SectGuidHeaderLength);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value for GuidHeaderLength", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-n") == 0) || (stricmp (argv[0], "--name") == 0)) {
+ StringBuffer = argv[1];
+ if (StringBuffer == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Name can't be NULL");
+ goto Finish;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-j") == 0) || (stricmp (argv[0], "--buildnumber") == 0)) {
+ if (argv[1] == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "build number can't be NULL");
+ goto Finish;
+ }
+ //
+ // Verify string is a integrator number
+ //
+ for (Index = 0; Index < strlen (argv[1]); Index++) {
+ if ((argv[1][Index] != '-') && (isdigit ((int)argv[1][Index]) == 0)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ }
+
+ sscanf (argv[1], "%d", &VersionNumber);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-v") == 0) || (stricmp (argv[0], "--verbose") == 0)) {
+ SetPrintLevel (VERBOSE_LOG_LEVEL);
+ VerboseMsg ("Verbose output Mode Set!");
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
+ SetPrintLevel (KEY_LOG_LEVEL);
+ KeyMsg ("Quiet output Mode Set!");
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--debug") == 0)) {
+ Status = AsciiStringToUint64 (argv[1], FALSE, &LogLevel);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ if (LogLevel > 9) {
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0~9, current input level is %d", (int) LogLevel);
+ goto Finish;
+ }
+ SetPrintLevel (LogLevel);
+ DebugMsg (NULL, 0, 9, "Debug Mode Set", "Debug Output Mode Level %s is set!", argv[1]);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ //
+ // Section File alignment requirement
+ //
+ if (stricmp (argv[0], "--sectionalign") == 0) {
+ if (InputFileAlignNum == 0) {
+ InputFileAlign = (UINT32 *) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32));
+ if (InputFileAlign == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ goto Finish;
+ }
+ memset (InputFileAlign, 1, MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32));
+ } else if (InputFileAlignNum % MAXIMUM_INPUT_FILE_NUM == 0) {
+ InputFileAlign = (UINT32 *) realloc (
+ InputFileAlign,
+ (InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (UINT32)
+ );
+
+ if (InputFileAlign == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ goto Finish;
+ }
+ memset (&(InputFileAlign[InputFileNum]), 1, (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32)));
+ }
+ if (stricmp(argv[1], "0") == 0) {
+ InputFileAlign[InputFileAlignNum] = 0;
+ } else {
+ Status = StringtoAlignment (argv[1], &(InputFileAlign[InputFileAlignNum]));
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ goto Finish;
+ }
+ }
+ argc -= 2;
+ argv += 2;
+ InputFileAlignNum ++;
+ continue;
+ }
+
+ //
+ // Get Input file name
+ //
+ if ((InputFileNum == 0) && (InputFileName == NULL)) {
+ InputFileName = (CHAR8 **) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *));
+ if (InputFileName == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated");
+ goto Finish;
+ }
+ memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
+ } else if (InputFileNum % MAXIMUM_INPUT_FILE_NUM == 0) {
+ //
+ // InputFileName buffer too small, need to realloc
+ //
+ InputFileName = (CHAR8 **) realloc (
+ InputFileName,
+ (InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (CHAR8 *)
+ );
+
+ if (InputFileName == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated");
+ goto Finish;
+ }
+ memset (&(InputFileName[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
+ }
+
+ InputFileName[InputFileNum++] = argv[0];
+ argc --;
+ argv ++;
+ }
+
+ if (InputFileAlignNum > 0 && InputFileAlignNum != InputFileNum) {
+ Error (NULL, 0, 1003, "Invalid option", "section alignment must be set for each section");
+ goto Finish;
+ }
+ for (Index = 0; Index < InputFileAlignNum; Index++)
+ {
+ if (InputFileAlign[Index] == 0) {
+ Status = GetAlignmentFromFile(InputFileName[Index], &(InputFileAlign[Index]));
+ if (EFI_ERROR(Status)) {
+ Error (NULL, 0, 1003, "Fail to get Alignment from %s", InputFileName[InputFileNum]);
+ goto Finish;
+ }
+ }
+ }
+
+ VerboseMsg ("%s tool start.", UTILITY_NAME);
+
+ if (DummyFileName != NULL) {
+ //
+ // Open file and read contents
+ //
+ DummyFile = fopen (LongFilePath (DummyFileName), "rb");
+ if (DummyFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", DummyFileName);
+ goto Finish;
+ }
+
+ fseek (DummyFile, 0, SEEK_END);
+ DummyFileSize = ftell (DummyFile);
+ fseek (DummyFile, 0, SEEK_SET);
+ DummyFileBuffer = (UINT8 *) malloc (DummyFileSize);
+ if (DummyFileBuffer == NULL) {
+ fclose(DummyFile);
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated");
+ goto Finish;
+ }
+
+ fread(DummyFileBuffer, 1, DummyFileSize, DummyFile);
+ fclose(DummyFile);
+ DebugMsg (NULL, 0, 9, "Dummy files", "the dummy file name is %s and the size is %u bytes", DummyFileName, (unsigned) DummyFileSize);
+
+ if (InputFileName == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated");
+ goto Finish;
+ }
+ InFile = fopen(LongFilePath(InputFileName[0]), "rb");
+ if (InFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", InputFileName[0]);
+ goto Finish;
+ }
+
+ fseek (InFile, 0, SEEK_END);
+ InFileSize = ftell (InFile);
+ fseek (InFile, 0, SEEK_SET);
+ InFileBuffer = (UINT8 *) malloc (InFileSize);
+ if (InFileBuffer == NULL) {
+ fclose(InFile);
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated");
+ goto Finish;
+ }
+
+ fread(InFileBuffer, 1, InFileSize, InFile);
+ fclose(InFile);
+ DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[0], (unsigned) InFileSize);
+ if (InFileSize > DummyFileSize){
+ if (stricmp((CHAR8 *)DummyFileBuffer, (CHAR8 *)(InFileBuffer + (InFileSize - DummyFileSize))) == 0){
+ SectGuidHeaderLength = InFileSize - DummyFileSize;
+ }
+ }
+ if (SectGuidHeaderLength == 0) {
+ SectGuidAttribute |= EFI_GUIDED_SECTION_PROCESSING_REQUIRED;
+ }
+ if (DummyFileBuffer != NULL) {
+ free (DummyFileBuffer);
+ DummyFileBuffer = NULL;
+ }
+ if (InFileBuffer != NULL) {
+ free (InFileBuffer);
+ }
+ }
+
+ //
+ // Parse all command line parameters to get the corresponding section type.
+ //
+ VerboseMsg ("Section type is %s", SectionName);
+ if (SectionName == NULL) {
+ //
+ // No specified Section type, default is SECTION_ALL.
+ //
+ SectType = EFI_SECTION_ALL;
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_COMPRESSION]) == 0) {
+ SectType = EFI_SECTION_COMPRESSION;
+ if (CompressionName == NULL) {
+ //
+ // Default is PI_STD compression algorithm.
+ //
+ SectCompSubType = EFI_STANDARD_COMPRESSION;
+ } else if (stricmp (CompressionName, mCompressionTypeName[EFI_NOT_COMPRESSED]) == 0) {
+ SectCompSubType = EFI_NOT_COMPRESSED;
+ } else if (stricmp (CompressionName, mCompressionTypeName[EFI_STANDARD_COMPRESSION]) == 0) {
+ SectCompSubType = EFI_STANDARD_COMPRESSION;
+ } else {
+ Error (NULL, 0, 1003, "Invalid option value", "--compress = %s", CompressionName);
+ goto Finish;
+ }
+ VerboseMsg ("Compress method is %s", mCompressionTypeName [SectCompSubType]);
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_GUID_DEFINED]) == 0) {
+ SectType = EFI_SECTION_GUID_DEFINED;
+
+ if ((SectGuidAttribute & EFI_GUIDED_SECTION_NONE) != 0) {
+ //
+ // NONE attribute, clear attribute value.
+ //
+ SectGuidAttribute = SectGuidAttribute & ~EFI_GUIDED_SECTION_NONE;
+ }
+ VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+ (unsigned) VendorGuid.Data1,
+ VendorGuid.Data2,
+ VendorGuid.Data3,
+ VendorGuid.Data4[0],
+ VendorGuid.Data4[1],
+ VendorGuid.Data4[2],
+ VendorGuid.Data4[3],
+ VendorGuid.Data4[4],
+ VendorGuid.Data4[5],
+ VendorGuid.Data4[6],
+ VendorGuid.Data4[7]);
+ if ((SectGuidAttribute & EFI_GUIDED_SECTION_PROCESSING_REQUIRED) != 0) {
+ VerboseMsg ("Guid Attribute is %s", mGUIDedSectionAttribue[EFI_GUIDED_SECTION_PROCESSING_REQUIRED]);
+ }
+ if ((SectGuidAttribute & EFI_GUIDED_SECTION_AUTH_STATUS_VALID) != 0) {
+ VerboseMsg ("Guid Attribute is %s", mGUIDedSectionAttribue[EFI_GUIDED_SECTION_AUTH_STATUS_VALID]);
+ }
+ if (SectGuidHeaderLength != 0) {
+ VerboseMsg ("Guid Data Header size is 0x%llx", (unsigned long long) SectGuidHeaderLength);
+ }
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_PE32]) == 0) {
+ SectType = EFI_SECTION_PE32;
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_PIC]) == 0) {
+ SectType = EFI_SECTION_PIC;
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_TE]) == 0) {
+ SectType = EFI_SECTION_TE;
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_DXE_DEPEX]) == 0) {
+ SectType = EFI_SECTION_DXE_DEPEX;
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_SMM_DEPEX]) == 0) {
+ SectType = EFI_SECTION_SMM_DEPEX;
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_VERSION]) == 0) {
+ SectType = EFI_SECTION_VERSION;
+ if (VersionNumber < 0 || VersionNumber > 65535) {
+ Error (NULL, 0, 1003, "Invalid option value", "%d is not in 0~65535", VersionNumber);
+ goto Finish;
+ }
+ VerboseMsg ("Version section number is %d", VersionNumber);
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_USER_INTERFACE]) == 0) {
+ SectType = EFI_SECTION_USER_INTERFACE;
+ if (StringBuffer[0] == '\0') {
+ Error (NULL, 0, 1001, "Missing option", "user interface string");
+ goto Finish;
+ }
+ VerboseMsg ("UI section string name is %s", StringBuffer);
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_COMPATIBILITY16]) == 0) {
+ SectType = EFI_SECTION_COMPATIBILITY16;
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_FIRMWARE_VOLUME_IMAGE]) == 0) {
+ SectType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_FREEFORM_SUBTYPE_GUID]) == 0) {
+ SectType = EFI_SECTION_FREEFORM_SUBTYPE_GUID;
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_RAW]) == 0) {
+ SectType = EFI_SECTION_RAW;
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_PEI_DEPEX]) == 0) {
+ SectType = EFI_SECTION_PEI_DEPEX;
+ } else {
+ Error (NULL, 0, 1003, "Invalid option value", "SectionType = %s", SectionName);
+ goto Finish;
+ }
+
+ //
+ // GuidValue is only required by Guided section.
+ //
+ if ((SectType != EFI_SECTION_GUID_DEFINED) &&
+ (SectionName != NULL) &&
+ (CompareGuid (&VendorGuid, &mZeroGuid) != 0)) {
+ fprintf (stdout, "Warning: the input guid value is not required for this section type %s\n", SectionName);
+ }
+
+ //
+ // Check whether there is input file
+ //
+ if ((SectType != EFI_SECTION_VERSION) && (SectType != EFI_SECTION_USER_INTERFACE)) {
+ //
+ // The input file are required for other section type.
+ //
+ if (InputFileNum == 0) {
+ Error (NULL, 0, 1001, "Missing options", "Input files");
+ goto Finish;
+ }
+ }
+ //
+ // Check whether there is output file
+ //
+ for (Index = 0; Index < InputFileNum; Index ++) {
+ VerboseMsg ("the %uth input file name is %s", (unsigned) Index, InputFileName[Index]);
+ }
+ if (OutputFileName == NULL) {
+ Error (NULL, 0, 1001, "Missing options", "Output file");
+ goto Finish;
+ // OutFile = stdout;
+ }
+ VerboseMsg ("Output file name is %s", OutputFileName);
+
+ //
+ // At this point, we've fully validated the command line, and opened appropriate
+ // files, so let's go and do what we've been asked to do...
+ //
+ //
+ // Within this switch, build and write out the section header including any
+ // section type specific pieces. If there's an input file, it's tacked on later
+ //
+ switch (SectType) {
+ case EFI_SECTION_COMPRESSION:
+ if (InputFileAlign != NULL) {
+ free (InputFileAlign);
+ InputFileAlign = NULL;
+ }
+ Status = GenSectionCompressionSection (
+ InputFileName,
+ InputFileAlign,
+ InputFileNum,
+ SectCompSubType,
+ &OutFileBuffer
+ );
+ break;
+
+ case EFI_SECTION_GUID_DEFINED:
+ if (InputFileAlign != NULL && (CompareGuid (&VendorGuid, &mZeroGuid) != 0)) {
+ //
+ // Only process alignment for the default known CRC32 guided section.
+ // For the unknown guided section, the alignment is processed when the dummy all section (EFI_SECTION_ALL) is generated.
+ //
+ free (InputFileAlign);
+ InputFileAlign = NULL;
+ }
+ Status = GenSectionGuidDefinedSection (
+ InputFileName,
+ InputFileAlign,
+ InputFileNum,
+ &VendorGuid,
+ SectGuidAttribute,
+ (UINT32) SectGuidHeaderLength,
+ &OutFileBuffer
+ );
+ break;
+
+ case EFI_SECTION_VERSION:
+ Index = sizeof (EFI_COMMON_SECTION_HEADER);
+ //
+ // 2 bytes for the build number UINT16
+ //
+ Index += 2;
+ //
+ // StringBuffer is ascii.. unicode is 2X + 2 bytes for terminating unicode null.
+ //
+ Index += (strlen (StringBuffer) * 2) + 2;
+ OutFileBuffer = (UINT8 *) malloc (Index);
+ if (OutFileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated");
+ goto Finish;
+ }
+ VersionSect = (EFI_VERSION_SECTION *) OutFileBuffer;
+ VersionSect->CommonHeader.Type = SectType;
+ VersionSect->CommonHeader.Size[0] = (UINT8) (Index & 0xff);
+ VersionSect->CommonHeader.Size[1] = (UINT8) ((Index & 0xff00) >> 8);
+ VersionSect->CommonHeader.Size[2] = (UINT8) ((Index & 0xff0000) >> 16);
+ VersionSect->BuildNumber = (UINT16) VersionNumber;
+ Ascii2UnicodeString (StringBuffer, VersionSect->VersionString);
+ VerboseMsg ("the size of the created section file is %u bytes", (unsigned) Index);
+ break;
+
+ case EFI_SECTION_USER_INTERFACE:
+ Index = sizeof (EFI_COMMON_SECTION_HEADER);
+ //
+ // StringBuffer is ascii.. unicode is 2X + 2 bytes for terminating unicode null.
+ //
+ Index += (strlen (StringBuffer) * 2) + 2;
+ OutFileBuffer = (UINT8 *) malloc (Index);
+ if (OutFileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated");
+ goto Finish;
+ }
+ UiSect = (EFI_USER_INTERFACE_SECTION *) OutFileBuffer;
+ UiSect->CommonHeader.Type = SectType;
+ UiSect->CommonHeader.Size[0] = (UINT8) (Index & 0xff);
+ UiSect->CommonHeader.Size[1] = (UINT8) ((Index & 0xff00) >> 8);
+ UiSect->CommonHeader.Size[2] = (UINT8) ((Index & 0xff0000) >> 16);
+ Ascii2UnicodeString (StringBuffer, UiSect->FileNameString);
+ VerboseMsg ("the size of the created section file is %u bytes", (unsigned) Index);
+ break;
+
+ case EFI_SECTION_ALL:
+ //
+ // read all input file contents into a buffer
+ // first get the size of all file contents
+ //
+ Status = GetSectionContents (
+ InputFileName,
+ InputFileAlign,
+ InputFileNum,
+ OutFileBuffer,
+ &InputLength
+ );
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ OutFileBuffer = (UINT8 *) malloc (InputLength);
+ if (OutFileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated");
+ goto Finish;
+ }
+ //
+ // read all input file contents into a buffer
+ //
+ Status = GetSectionContents (
+ InputFileName,
+ InputFileAlign,
+ InputFileNum,
+ OutFileBuffer,
+ &InputLength
+ );
+ }
+ VerboseMsg ("the size of the created section file is %u bytes", (unsigned) InputLength);
+ break;
+ default:
+ //
+ // All other section types are caught by default (they're all the same)
+ //
+ Status = GenSectionCommonLeafSection (
+ InputFileName,
+ InputFileNum,
+ SectType,
+ &OutFileBuffer
+ );
+ break;
+ }
+
+ if (Status != EFI_SUCCESS || OutFileBuffer == NULL) {
+ Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (int) Status);
+ goto Finish;
+ }
+
+ //
+ // Get output file length
+ //
+ if (SectType != EFI_SECTION_ALL) {
+ SectionHeader = (EFI_COMMON_SECTION_HEADER *)OutFileBuffer;
+ InputLength = *(UINT32 *)SectionHeader->Size & 0x00ffffff;
+ if (InputLength == 0xffffff) {
+ InputLength = ((EFI_COMMON_SECTION_HEADER2 *)SectionHeader)->ExtendedSize;
+ }
+ }
+
+ //
+ // Write the output file
+ //
+ OutFile = fopen (LongFilePath (OutputFileName), "wb");
+ if (OutFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file for writing", OutputFileName);
+ goto Finish;
+ }
+
+ fwrite (OutFileBuffer, InputLength, 1, OutFile);
+
+Finish:
+ if (InputFileName != NULL) {
+ free (InputFileName);
+ }
+
+ if (InputFileAlign != NULL) {
+ free (InputFileAlign);
+ }
+
+ if (OutFileBuffer != NULL) {
+ free (OutFileBuffer);
+ }
+
+ if (OutFile != NULL) {
+ fclose (OutFile);
+ }
+
+ if (DummyFileBuffer != NULL) {
+ free (DummyFileBuffer);
+ }
+
+ VerboseMsg ("%s tool done with return code is 0x%x.", UTILITY_NAME, GetUtilityStatus ());
+
+ return GetUtilityStatus ();
+}
diff --git a/roms/edk2/BaseTools/Source/C/GenSec/Makefile b/roms/edk2/BaseTools/Source/C/GenSec/Makefile
new file mode 100644
index 000000000..dcb10ae9e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/GenSec/Makefile
@@ -0,0 +1,18 @@
+## @file
+# Windows makefile for 'GenSec' module build.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+APPNAME = GenSec
+
+LIBS = $(LIB_PATH)\Common.lib
+
+OBJECTS = GenSec.obj
+
+#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
+
+!INCLUDE ..\Makefiles\ms.app
+
diff --git a/roms/edk2/BaseTools/Source/C/Include/AArch64/ProcessorBind.h b/roms/edk2/BaseTools/Source/C/Include/AArch64/ProcessorBind.h
new file mode 100644
index 000000000..dfa725b2e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/AArch64/ProcessorBind.h
@@ -0,0 +1,148 @@
+/** @file
+ Processor or Compiler specific defines and types for AArch64.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+ Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PROCESSOR_BIND_H__
+#define __PROCESSOR_BIND_H__
+
+///
+/// Define the processor type so other code can make processor based choices
+///
+#define MDE_CPU_AARCH64
+
+//
+// Make sure we are using the correct packing rules per EFI specification
+//
+#ifndef __GNUC__
+#pragma pack()
+#endif
+
+#if _MSC_EXTENSIONS
+ //
+ // use Microsoft* C compiler dependent integer width types
+ //
+ typedef unsigned __int64 UINT64;
+ typedef __int64 INT64;
+ typedef unsigned __int32 UINT32;
+ typedef __int32 INT32;
+ typedef unsigned short UINT16;
+ typedef unsigned short CHAR16;
+ typedef short INT16;
+ typedef unsigned char BOOLEAN;
+ typedef unsigned char UINT8;
+ typedef char CHAR8;
+ typedef signed char INT8;
+#else
+ //
+ // Use ANSI C 2000 stdint.h integer width declarations
+ //
+ #include <stdint.h>
+ typedef uint8_t BOOLEAN;
+ typedef int8_t INT8;
+ typedef uint8_t UINT8;
+ typedef int16_t INT16;
+ typedef uint16_t UINT16;
+ typedef int32_t INT32;
+ typedef uint32_t UINT32;
+ typedef int64_t INT64;
+ typedef uint64_t UINT64;
+ typedef char CHAR8;
+ typedef uint16_t CHAR16;
+
+#endif
+
+///
+/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
+/// 8 bytes on supported 64-bit processor instructions)
+///
+typedef UINT64 UINTN;
+
+///
+/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
+/// 8 bytes on supported 64-bit processor instructions)
+///
+typedef INT64 INTN;
+
+//
+// Processor specific defines
+//
+
+///
+/// A value of native width with the highest bit set.
+///
+#define MAX_BIT 0x8000000000000000
+
+///
+/// A value of native width with the two highest bits set.
+///
+#define MAX_2_BITS 0xC000000000000000
+
+///
+/// The stack alignment required for AARCH64
+///
+#define CPU_STACK_ALIGNMENT 16
+
+//
+// Modifier to ensure that all protocol member functions and EFI intrinsics
+// use the correct C calling convention. All protocol member functions and
+// EFI intrinsics are required to modify their member functions with EFIAPI.
+//
+#define EFIAPI
+
+#if defined(__GNUC__)
+ ///
+ /// For GNU assembly code, .global or .globl can declare global symbols.
+ /// Define this macro to unify the usage.
+ ///
+ #define ASM_GLOBAL .globl
+
+ #if !defined(__APPLE__)
+ ///
+ /// ARM EABI defines that the linker should not manipulate call relocations
+ /// (do bl/blx conversion) unless the target symbol has function type.
+ /// CodeSourcery 2010.09 started requiring the .type to function properly
+ ///
+ #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
+
+ #define GCC_ASM_EXPORT(func__) \
+ .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
+ .type ASM_PFX(func__), %function
+
+ #define GCC_ASM_IMPORT(func__) \
+ .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
+
+ #else
+ //
+ // .type not supported by Apple Xcode tools
+ //
+ #define INTERWORK_FUNC(func__)
+
+ #define GCC_ASM_EXPORT(func__) \
+ .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
+
+ #define GCC_ASM_IMPORT(name)
+
+ #endif
+#endif
+
+/**
+ Return the pointer to the first instruction of a function given a function pointer.
+ On ARM CPU architectures, these two pointer values are the same,
+ so the implementation of this macro is very simple.
+
+ @param FunctionPointer A pointer to a function.
+
+ @return The pointer to the first instruction of a function given a function pointer.
+
+**/
+#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
+
+#endif
+
diff --git a/roms/edk2/BaseTools/Source/C/Include/Arm/ProcessorBind.h b/roms/edk2/BaseTools/Source/C/Include/Arm/ProcessorBind.h
new file mode 100644
index 000000000..8fe4d5f16
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Arm/ProcessorBind.h
@@ -0,0 +1,147 @@
+/** @file
+ Processor or Compiler specific defines and types for ARM.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PROCESSOR_BIND_H__
+#define __PROCESSOR_BIND_H__
+
+///
+/// Define the processor type so other code can make processor based choices
+///
+#define MDE_CPU_ARM
+
+//
+// Make sure we are using the correct packing rules per EFI specification
+//
+#ifndef __GNUC__
+#pragma pack()
+#endif
+
+#if _MSC_EXTENSIONS
+ //
+ // use Microsoft* C compiler dependent integer width types
+ //
+ typedef unsigned __int64 UINT64;
+ typedef __int64 INT64;
+ typedef unsigned __int32 UINT32;
+ typedef __int32 INT32;
+ typedef unsigned short UINT16;
+ typedef unsigned short CHAR16;
+ typedef short INT16;
+ typedef unsigned char BOOLEAN;
+ typedef unsigned char UINT8;
+ typedef char CHAR8;
+ typedef signed char INT8;
+#else
+ //
+ // Assume standard ARM alignment.
+ //
+ typedef unsigned long long UINT64;
+ typedef long long INT64;
+ typedef unsigned int UINT32;
+ typedef int INT32;
+ typedef unsigned short UINT16;
+ typedef unsigned short CHAR16;
+ typedef short INT16;
+ typedef unsigned char BOOLEAN;
+ typedef unsigned char UINT8;
+ typedef char CHAR8;
+ typedef signed char INT8;
+
+ #define UINT8_MAX 0xff
+#endif
+
+///
+/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
+/// 8 bytes on supported 64-bit processor instructions)
+///
+typedef UINT32 UINTN;
+
+///
+/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
+/// 8 bytes on supported 64-bit processor instructions)
+///
+typedef INT32 INTN;
+
+//
+// Processor specific defines
+//
+
+///
+/// A value of native width with the highest bit set.
+///
+#define MAX_BIT 0x80000000
+
+///
+/// A value of native width with the two highest bits set.
+///
+#define MAX_2_BITS 0xC0000000
+
+///
+/// The stack alignment required for ARM
+///
+#define CPU_STACK_ALIGNMENT sizeof(UINT64)
+
+//
+// Modifier to ensure that all protocol member functions and EFI intrinsics
+// use the correct C calling convention. All protocol member functions and
+// EFI intrinsics are required to modify their member functions with EFIAPI.
+//
+#define EFIAPI
+
+#if defined(__GNUC__)
+ ///
+ /// For GNU assembly code, .global or .globl can declare global symbols.
+ /// Define this macro to unify the usage.
+ ///
+ #define ASM_GLOBAL .globl
+
+ #if !defined(__APPLE__)
+ ///
+ /// ARM EABI defines that the linker should not manipulate call relocations
+ /// (do bl/blx conversion) unless the target symbol has function type.
+ /// CodeSourcery 2010.09 started requiring the .type to function properly
+ ///
+ #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
+
+ #define GCC_ASM_EXPORT(func__) \
+ .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
+ .type ASM_PFX(func__), %function
+
+ #define GCC_ASM_IMPORT(func__) \
+ .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
+
+ #else
+ //
+ // .type not supported by Apple Xcode tools
+ //
+ #define INTERWORK_FUNC(func__)
+
+ #define GCC_ASM_EXPORT(func__) \
+ .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
+
+ #define GCC_ASM_IMPORT(name)
+
+ #endif
+#endif
+
+/**
+ Return the pointer to the first instruction of a function given a function pointer.
+ On ARM CPU architectures, these two pointer values are the same,
+ so the implementation of this macro is very simple.
+
+ @param FunctionPointer A pointer to a function.
+
+ @return The pointer to the first instruction of a function given a function pointer.
+
+**/
+#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
+
+#endif
+
+
diff --git a/roms/edk2/BaseTools/Source/C/Include/Common/BaseTypes.h b/roms/edk2/BaseTools/Source/C/Include/Common/BaseTypes.h
new file mode 100644
index 000000000..31d066208
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Common/BaseTypes.h
@@ -0,0 +1,308 @@
+/** @file
+ Processor or Compiler specific defines for all supported processors.
+
+ This file is stand alone self consistent set of definitions.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __BASE_TYPES_H__
+#define __BASE_TYPES_H__
+
+//
+// Include processor specific binding
+//
+#include <ProcessorBind.h>
+#include <stdarg.h>
+
+//
+// Modifiers to abstract standard types to aid in debug of problems
+//
+#define CONST const
+#define STATIC static
+#define VOID void
+
+//
+// Modifiers for Data Types used to self document code.
+// This concept is borrowed for UEFI specification.
+//
+#ifndef IN
+//
+// Some other environments use this construct, so #ifndef to prevent
+// multiple definition.
+//
+#define IN
+#define OUT
+#define OPTIONAL
+#endif
+
+//
+// Constants. They may exist in other build structures, so #ifndef them.
+//
+#ifndef TRUE
+//
+// BugBug: UEFI specification claims 1 and 0. We are concerned about the
+// compiler portability so we did it this way.
+//
+#define TRUE ((BOOLEAN)(1==1))
+#endif
+
+#ifndef FALSE
+#define FALSE ((BOOLEAN)(0==1))
+#endif
+
+#ifndef NULL
+#define NULL ((VOID *) 0)
+#endif
+
+//
+// Support for variable length argument lists using the ANSI standard.
+//
+// Since we are using the ANSI standard we used the standard naming and
+// did not follow the coding convention
+//
+// VA_LIST - typedef for argument list.
+// VA_START (VA_LIST Marker, argument before the ...) - Init Marker for use.
+// VA_END (VA_LIST Marker) - Clear Marker
+// VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argument from
+// the ... list. You must know the size and pass it in this macro.
+//
+// example:
+//
+// UINTN
+// ExampleVarArg (
+// IN UINTN NumberOfArgs,
+// ...
+// )
+// {
+// VA_LIST Marker;
+// UINTN Index;
+// UINTN Result;
+//
+// //
+// // Initialize the Marker
+// //
+// VA_START (Marker, NumberOfArgs);
+// for (Index = 0, Result = 0; Index < NumberOfArgs; Index++) {
+// //
+// // The ... list is a series of UINTN values, so average them up.
+// //
+// Result += VA_ARG (Marker, UINTN);
+// }
+//
+// VA_END (Marker);
+// return Result
+// }
+//
+
+#define _INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))
+
+//
+// Also support coding convention rules for var arg macros
+//
+#ifndef VA_START
+
+// typedef CHAR8 *VA_LIST;
+// #define VA_START(ap, v) (ap = (VA_LIST) & (v) + _INT_SIZE_OF (v))
+// #define VA_ARG(ap, t) (*(t *) ((ap += _INT_SIZE_OF (t)) - _INT_SIZE_OF (t)))
+// #define VA_END(ap) (ap = (VA_LIST) 0)
+// Use the native arguments for tools.
+#define VA_START va_start
+#define VA_ARG va_arg
+#define VA_END va_end
+#define VA_LIST va_list
+
+#endif
+
+#ifndef GUID_DEFINED
+#define GUID_DEFINED
+///
+/// 128 bit buffer containing a unique identifier value.
+/// Unless otherwise specified, aligned on a 64 bit boundary.
+///
+typedef struct {
+ UINT32 Data1;
+ UINT16 Data2;
+ UINT16 Data3;
+ UINT8 Data4[8];
+} GUID;
+#endif
+
+///
+/// 4-byte buffer. An IPv4 internet protocol address.
+///
+typedef struct {
+ UINT8 Addr[4];
+} IPv4_ADDRESS;
+
+///
+/// 16-byte buffer. An IPv6 internet protocol address.
+///
+typedef struct {
+ UINT8 Addr[16];
+} IPv6_ADDRESS;
+
+//
+// Macro that returns the byte offset of a field in a data structure.
+//
+#define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
+
+///
+/// _CR - returns a pointer to the structure
+/// from one of its elements.
+///
+#define _CR(Record, TYPE, Field) ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
+
+///
+/// ALIGN_POINTER - aligns a pointer to the lowest boundary
+///
+#define ALIGN_POINTER(p, s) ((VOID *) ((UINTN)(p) + (((s) - ((UINTN) (p))) & ((s) - 1))))
+
+///
+/// ALIGN_VARIABLE - aligns a variable up to the next natural boundary for int size of a processor
+///
+#define ALIGN_VARIABLE(Value, Adjustment) \
+ Adjustment = 0U; \
+ if ((UINTN) (Value) % sizeof (UINTN)) { \
+ (Adjustment) = (UINTN)(sizeof (UINTN) - ((UINTN) (Value) % sizeof (UINTN))); \
+ } \
+ (Value) = (UINTN)((UINTN) (Value) + (UINTN) (Adjustment))
+
+//
+// Return the maximum of two operands.
+// This macro returns the maximum of two operand specified by a and b.
+// Both a and b must be the same numerical types, signed or unsigned.
+//
+#define MAX(a, b) \
+ (((a) > (b)) ? (a) : (b))
+
+
+//
+// Return the minimum of two operands.
+// This macro returns the minimal of two operand specified by a and b.
+// Both a and b must be the same numerical types, signed or unsigned.
+//
+#define MIN(a, b) \
+ (((a) < (b)) ? (a) : (b))
+
+
+//
+// EFI Error Codes common to all execution phases
+//
+
+typedef UINTN RETURN_STATUS;
+
+///
+/// Set the upper bit to indicate EFI Error.
+///
+#define ENCODE_ERROR(a) ((RETURN_STATUS)(MAX_BIT | (a)))
+
+#define ENCODE_WARNING(a) ((RETURN_STATUS)(a))
+#define RETURN_ERROR(a) (((INTN)(RETURN_STATUS)(a)) < 0)
+
+#define RETURN_SUCCESS 0
+#define RETURN_LOAD_ERROR ENCODE_ERROR (1)
+#define RETURN_INVALID_PARAMETER ENCODE_ERROR (2)
+#define RETURN_UNSUPPORTED ENCODE_ERROR (3)
+#define RETURN_BAD_BUFFER_SIZE ENCODE_ERROR (4)
+#define RETURN_BUFFER_TOO_SMALL ENCODE_ERROR (5)
+#define RETURN_NOT_READY ENCODE_ERROR (6)
+#define RETURN_DEVICE_ERROR ENCODE_ERROR (7)
+#define RETURN_WRITE_PROTECTED ENCODE_ERROR (8)
+#define RETURN_OUT_OF_RESOURCES ENCODE_ERROR (9)
+#define RETURN_VOLUME_CORRUPTED ENCODE_ERROR (10)
+#define RETURN_VOLUME_FULL ENCODE_ERROR (11)
+#define RETURN_NO_MEDIA ENCODE_ERROR (12)
+#define RETURN_MEDIA_CHANGED ENCODE_ERROR (13)
+#define RETURN_NOT_FOUND ENCODE_ERROR (14)
+#define RETURN_ACCESS_DENIED ENCODE_ERROR (15)
+#define RETURN_NO_RESPONSE ENCODE_ERROR (16)
+#define RETURN_NO_MAPPING ENCODE_ERROR (17)
+#define RETURN_TIMEOUT ENCODE_ERROR (18)
+#define RETURN_NOT_STARTED ENCODE_ERROR (19)
+#define RETURN_ALREADY_STARTED ENCODE_ERROR (20)
+#define RETURN_ABORTED ENCODE_ERROR (21)
+#define RETURN_ICMP_ERROR ENCODE_ERROR (22)
+#define RETURN_TFTP_ERROR ENCODE_ERROR (23)
+#define RETURN_PROTOCOL_ERROR ENCODE_ERROR (24)
+#define RETURN_INCOMPATIBLE_VERSION ENCODE_ERROR (25)
+#define RETURN_SECURITY_VIOLATION ENCODE_ERROR (26)
+#define RETURN_CRC_ERROR ENCODE_ERROR (27)
+#define RETURN_END_OF_MEDIA ENCODE_ERROR (28)
+#define RETURN_END_OF_FILE ENCODE_ERROR (31)
+
+#define RETURN_WARN_UNKNOWN_GLYPH ENCODE_WARNING (1)
+#define RETURN_WARN_DELETE_FAILURE ENCODE_WARNING (2)
+#define RETURN_WARN_WRITE_FAILURE ENCODE_WARNING (3)
+#define RETURN_WARN_BUFFER_TOO_SMALL ENCODE_WARNING (4)
+
+typedef UINT64 PHYSICAL_ADDRESS;
+
+#define BIT0 0x00000001
+#define BIT1 0x00000002
+#define BIT2 0x00000004
+#define BIT3 0x00000008
+#define BIT4 0x00000010
+#define BIT5 0x00000020
+#define BIT6 0x00000040
+#define BIT7 0x00000080
+#define BIT8 0x00000100
+#define BIT9 0x00000200
+#define BIT10 0x00000400
+#define BIT11 0x00000800
+#define BIT12 0x00001000
+#define BIT13 0x00002000
+#define BIT14 0x00004000
+#define BIT15 0x00008000
+#define BIT16 0x00010000
+#define BIT17 0x00020000
+#define BIT18 0x00040000
+#define BIT19 0x00080000
+#define BIT20 0x00100000
+#define BIT21 0x00200000
+#define BIT22 0x00400000
+#define BIT23 0x00800000
+#define BIT24 0x01000000
+#define BIT25 0x02000000
+#define BIT26 0x04000000
+#define BIT27 0x08000000
+#define BIT28 0x10000000
+#define BIT29 0x20000000
+#define BIT30 0x40000000
+#define BIT31 0x80000000
+#define BIT32 0x0000000100000000ULL
+#define BIT33 0x0000000200000000ULL
+#define BIT34 0x0000000400000000ULL
+#define BIT35 0x0000000800000000ULL
+#define BIT36 0x0000001000000000ULL
+#define BIT37 0x0000002000000000ULL
+#define BIT38 0x0000004000000000ULL
+#define BIT39 0x0000008000000000ULL
+#define BIT40 0x0000010000000000ULL
+#define BIT41 0x0000020000000000ULL
+#define BIT42 0x0000040000000000ULL
+#define BIT43 0x0000080000000000ULL
+#define BIT44 0x0000100000000000ULL
+#define BIT45 0x0000200000000000ULL
+#define BIT46 0x0000400000000000ULL
+#define BIT47 0x0000800000000000ULL
+#define BIT48 0x0001000000000000ULL
+#define BIT49 0x0002000000000000ULL
+#define BIT50 0x0004000000000000ULL
+#define BIT51 0x0008000000000000ULL
+#define BIT52 0x0010000000000000ULL
+#define BIT53 0x0020000000000000ULL
+#define BIT54 0x0040000000000000ULL
+#define BIT55 0x0080000000000000ULL
+#define BIT56 0x0100000000000000ULL
+#define BIT57 0x0200000000000000ULL
+#define BIT58 0x0400000000000000ULL
+#define BIT59 0x0800000000000000ULL
+#define BIT60 0x1000000000000000ULL
+#define BIT61 0x2000000000000000ULL
+#define BIT62 0x4000000000000000ULL
+#define BIT63 0x8000000000000000ULL
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Common/BuildVersion.h b/roms/edk2/BaseTools/Source/C/Include/Common/BuildVersion.h
new file mode 100644
index 000000000..1958acb43
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Common/BuildVersion.h
@@ -0,0 +1,9 @@
+/** @file
+This file is for build version number auto generation
+
+Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#define __BUILD_VERSION "Developer Build based on Revision: Unknown"
diff --git a/roms/edk2/BaseTools/Source/C/Include/Common/MdeModuleHii.h b/roms/edk2/BaseTools/Source/C/Include/Common/MdeModuleHii.h
new file mode 100644
index 000000000..d4944efe4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Common/MdeModuleHii.h
@@ -0,0 +1,233 @@
+/** @file
+ EDK II specific HII relative definition.
+
+ Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _MDEMODULE_HII_H
+#define _MDEMODULE_HII_H
+
+#define NARROW_CHAR 0xFFF0
+#define WIDE_CHAR 0xFFF1
+#define NON_BREAKING_CHAR 0xFFF2
+
+///
+/// State defined for password statemachine .
+///
+#define BROWSER_STATE_VALIDATE_PASSWORD 0
+#define BROWSER_STATE_SET_PASSWORD 1
+
+///
+/// GUIDed opcodes defined for EDKII implementation.
+///
+#define EFI_IFR_TIANO_GUID \
+ { 0xf0b1735, 0x87a0, 0x4193, {0xb2, 0x66, 0x53, 0x8c, 0x38, 0xaf, 0x48, 0xce} }
+
+#pragma pack(1)
+
+///
+/// EDKII implementation extension opcodes, new extension can be added here later.
+///
+#define EFI_IFR_EXTEND_OP_LABEL 0x0
+#define EFI_IFR_EXTEND_OP_BANNER 0x1
+#define EFI_IFR_EXTEND_OP_TIMEOUT 0x2
+#define EFI_IFR_EXTEND_OP_CLASS 0x3
+#define EFI_IFR_EXTEND_OP_SUBCLASS 0x4
+
+///
+/// Label opcode.
+///
+typedef struct _EFI_IFR_GUID_LABEL {
+ EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_TIANO_GUID.
+ ///
+ EFI_GUID Guid;
+ ///
+ /// EFI_IFR_EXTEND_OP_LABEL.
+ ///
+ UINT8 ExtendOpCode;
+ ///
+ /// Label Number.
+ ///
+ UINT16 Number;
+} EFI_IFR_GUID_LABEL;
+
+#define EFI_IFR_BANNER_ALIGN_LEFT 0
+#define EFI_IFR_BANNER_ALIGN_CENTER 1
+#define EFI_IFR_BANNER_ALIGN_RIGHT 2
+
+///
+/// Banner opcode.
+///
+typedef struct _EFI_IFR_GUID_BANNER {
+ EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_TIANO_GUID.
+ ///
+ EFI_GUID Guid;
+ ///
+ /// EFI_IFR_EXTEND_OP_BANNER
+ ///
+ UINT8 ExtendOpCode;
+ EFI_STRING_ID Title; ///< The string token for the banner title.
+ UINT16 LineNumber; ///< 1-based line number.
+ UINT8 Alignment; ///< left, center, or right-aligned.
+} EFI_IFR_GUID_BANNER;
+
+///
+/// Timeout opcode.
+///
+typedef struct _EFI_IFR_GUID_TIMEOUT {
+ EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_TIANO_GUID.
+ ///
+ EFI_GUID Guid;
+ ///
+ /// EFI_IFR_EXTEND_OP_TIMEOUT.
+ ///
+ UINT8 ExtendOpCode;
+ UINT16 TimeOut; ///< TimeOut Value.
+} EFI_IFR_GUID_TIMEOUT;
+
+#define EFI_NON_DEVICE_CLASS 0x00
+#define EFI_DISK_DEVICE_CLASS 0x01
+#define EFI_VIDEO_DEVICE_CLASS 0x02
+#define EFI_NETWORK_DEVICE_CLASS 0x04
+#define EFI_INPUT_DEVICE_CLASS 0x08
+#define EFI_ON_BOARD_DEVICE_CLASS 0x10
+#define EFI_OTHER_DEVICE_CLASS 0x20
+
+///
+/// Device Class opcode.
+///
+typedef struct _EFI_IFR_GUID_CLASS {
+ EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_TIANO_GUID.
+ ///
+ EFI_GUID Guid;
+ ///
+ /// EFI_IFR_EXTEND_OP_CLASS.
+ ///
+ UINT8 ExtendOpCode;
+ UINT16 Class; ///< Device Class from the above.
+} EFI_IFR_GUID_CLASS;
+
+#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
+#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
+#define EFI_FRONT_PAGE_SUBCLASS 0x02
+#define EFI_SINGLE_USE_SUBCLASS 0x03
+
+///
+/// SubClass opcode
+///
+typedef struct _EFI_IFR_GUID_SUBCLASS {
+ EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_TIANO_GUID.
+ ///
+ EFI_GUID Guid;
+ ///
+ /// EFI_IFR_EXTEND_OP_SUBCLASS.
+ ///
+ UINT8 ExtendOpCode;
+ UINT16 SubClass; ///< Sub Class type from the above.
+} EFI_IFR_GUID_SUBCLASS;
+
+///
+/// GUIDed opcodes support for framework vfr.
+///
+#define EFI_IFR_FRAMEWORK_GUID \
+ { 0x31ca5d1a, 0xd511, 0x4931, { 0xb7, 0x82, 0xae, 0x6b, 0x2b, 0x17, 0x8c, 0xd7 } }
+
+///
+/// Two extended opcodes are added, and new extensions can be added here later.
+/// One is for framework OneOf question Option Key value;
+/// another is for framework vareqval.
+///
+#define EFI_IFR_EXTEND_OP_OPTIONKEY 0x0
+#define EFI_IFR_EXTEND_OP_VAREQNAME 0x1
+
+///
+/// Store the framework vfr option key value.
+///
+typedef struct _EFI_IFR_GUID_OPTIONKEY {
+ EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_FRAMEWORK_GUID.
+ ///
+ EFI_GUID Guid;
+ ///
+ /// EFI_IFR_EXTEND_OP_OPTIONKEY.
+ ///
+ UINT8 ExtendOpCode;
+ ///
+ /// OneOf Questiond ID binded by OneOf Option.
+ ///
+ EFI_QUESTION_ID QuestionId;
+ ///
+ /// The OneOf Option Value.
+ ///
+ EFI_IFR_TYPE_VALUE OptionValue;
+ ///
+ /// The Framework OneOf Option Key Value.
+ ///
+ UINT16 KeyValue;
+} EFI_IFR_GUID_OPTIONKEY;
+
+///
+/// Store the framework vfr vareqval name number.
+///
+typedef struct _EFI_IFR_GUID_VAREQNAME {
+ EFI_IFR_OP_HEADER Header;
+ ///
+ /// EFI_IFR_FRAMEWORK_GUID.
+ ///
+ EFI_GUID Guid;
+ ///
+ /// EFI_IFR_EXTEND_OP_VAREQNAME.
+ ///
+ UINT8 ExtendOpCode;
+ ///
+ /// Question ID of the Numeric Opcode created.
+ ///
+ EFI_QUESTION_ID QuestionId;
+ ///
+ /// For vareqval (0x100), NameId is 0x100.
+ /// This value will convert to a Unicode String following this rule;
+ /// sprintf(StringBuffer, "%d", NameId) .
+ /// The Unicode String will be used as a EFI Variable Name.
+ ///
+ UINT16 NameId;
+} EFI_IFR_GUID_VAREQNAME;
+
+///
+/// EDKII implementation extension GUID, used to indicate there are bit fields in the varstore.
+///
+#define EDKII_IFR_BIT_VARSTORE_GUID \
+ { 0x82DDD68B, 0x9163, 0x4187, {0x9B, 0x27, 0x20, 0xA8, 0xFD, 0x60 ,0xA7, 0x1D}}
+
+///
+/// EDKII implementation extension flags, used to indicate the display style and bit width for bit filed storage.
+/// Two high bits for display style and the low six bits for bit width.
+///
+#define EDKII_IFR_DISPLAY_BIT 0xC0
+#define EDKII_IFR_DISPLAY_INT_DEC_BIT 0x00
+#define EDKII_IFR_DISPLAY_UINT_DEC_BIT 0x40
+#define EDKII_IFR_DISPLAY_UINT_HEX_BIT 0x80
+
+#define EDKII_IFR_NUMERIC_SIZE_BIT 0x3F
+
+#pragma pack()
+
+extern EFI_GUID gEfiIfrTianoGuid;
+extern EFI_GUID gEfiIfrFrameworkGuid;
+extern EFI_GUID gEdkiiIfrBitVarStoreGuid;
+
+#endif
+
diff --git a/roms/edk2/BaseTools/Source/C/Include/Common/PiFirmwareFile.h b/roms/edk2/BaseTools/Source/C/Include/Common/PiFirmwareFile.h
new file mode 100644
index 000000000..7d8acb669
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Common/PiFirmwareFile.h
@@ -0,0 +1,350 @@
+/** @file
+ The firmware file related definitions in PI.
+
+ @par Revision Reference:
+ Version 1.4.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PI_FIRMWARE_FILE_H__
+#define __PI_FIRMWARE_FILE_H__
+
+#pragma pack(1)
+//
+// Used to verify the integrity of the file.
+//
+typedef union {
+ struct {
+ UINT8 Header;
+ UINT8 File;
+ } Checksum;
+ UINT16 Checksum16;
+} EFI_FFS_INTEGRITY_CHECK;
+
+typedef UINT8 EFI_FV_FILETYPE;
+typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;
+typedef UINT8 EFI_FFS_FILE_STATE;
+
+//
+// File Types Definitions
+//
+#define EFI_FV_FILETYPE_ALL 0x00
+#define EFI_FV_FILETYPE_RAW 0x01
+#define EFI_FV_FILETYPE_FREEFORM 0x02
+#define EFI_FV_FILETYPE_SECURITY_CORE 0x03
+#define EFI_FV_FILETYPE_PEI_CORE 0x04
+#define EFI_FV_FILETYPE_DXE_CORE 0x05
+#define EFI_FV_FILETYPE_PEIM 0x06
+#define EFI_FV_FILETYPE_DRIVER 0x07
+#define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER 0x08
+#define EFI_FV_FILETYPE_APPLICATION 0x09
+#define EFI_FV_FILETYPE_SMM 0x0A
+#define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B
+#define EFI_FV_FILETYPE_COMBINED_SMM_DXE 0x0C
+#define EFI_FV_FILETYPE_SMM_CORE 0x0D
+#define EFI_FV_FILETYPE_MM_STANDALONE 0x0E
+#define EFI_FV_FILETYPE_MM_CORE_STANDALONE 0x0F
+#define EFI_FV_FILETYPE_OEM_MIN 0xc0
+#define EFI_FV_FILETYPE_OEM_MAX 0xdf
+#define EFI_FV_FILETYPE_DEBUG_MIN 0xe0
+#define EFI_FV_FILETYPE_DEBUG_MAX 0xef
+#define EFI_FV_FILETYPE_FFS_MIN 0xf0
+#define EFI_FV_FILETYPE_FFS_MAX 0xff
+#define EFI_FV_FILETYPE_FFS_PAD 0xf0
+//
+// FFS File Attributes.
+//
+#define FFS_ATTRIB_LARGE_FILE 0x01
+#define FFS_ATTRIB_DATA_ALIGNMENT2 0x02
+#define FFS_ATTRIB_FIXED 0x04
+#define FFS_ATTRIB_DATA_ALIGNMENT 0x38
+#define FFS_ATTRIB_CHECKSUM 0x40
+//
+// FFS_FIXED_CHECKSUM is the checksum value used when the
+// FFS_ATTRIB_CHECKSUM attribute bit is clear
+//
+#define FFS_FIXED_CHECKSUM 0xAA
+
+//
+// FFS File State Bits.
+//
+#define EFI_FILE_HEADER_CONSTRUCTION 0x01
+#define EFI_FILE_HEADER_VALID 0x02
+#define EFI_FILE_DATA_VALID 0x04
+#define EFI_FILE_MARKED_FOR_UPDATE 0x08
+#define EFI_FILE_DELETED 0x10
+#define EFI_FILE_HEADER_INVALID 0x20
+
+#define EFI_FILE_ALL_STATE_BITS (EFI_FILE_HEADER_CONSTRUCTION | \
+ EFI_FILE_HEADER_VALID | \
+ EFI_FILE_DATA_VALID | \
+ EFI_FILE_MARKED_FOR_UPDATE | \
+ EFI_FILE_DELETED | \
+ EFI_FILE_HEADER_INVALID \
+ )
+
+//
+// Each file begins with the header that describe the
+// contents and state of the files.
+//
+typedef struct {
+ EFI_GUID Name;
+ EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
+ EFI_FV_FILETYPE Type;
+ EFI_FFS_FILE_ATTRIBUTES Attributes;
+ UINT8 Size[3];
+ EFI_FFS_FILE_STATE State;
+} EFI_FFS_FILE_HEADER;
+
+typedef struct {
+ EFI_GUID Name;
+ EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
+ EFI_FV_FILETYPE Type;
+ EFI_FFS_FILE_ATTRIBUTES Attributes;
+ UINT8 Size[3];
+ EFI_FFS_FILE_STATE State;
+ UINT64 ExtendedSize;
+} EFI_FFS_FILE_HEADER2;
+
+#define MAX_FFS_SIZE 0x1000000
+
+typedef UINT8 EFI_SECTION_TYPE;
+
+//
+// Pseudo type. It is
+// used as a wild card when retrieving sections. The section
+// type EFI_SECTION_ALL matches all section types.
+//
+#define EFI_SECTION_ALL 0x00
+
+//
+// Encapsulation section Type values
+//
+#define EFI_SECTION_COMPRESSION 0x01
+
+#define EFI_SECTION_GUID_DEFINED 0x02
+
+//
+// Leaf section Type values
+//
+#define EFI_SECTION_PE32 0x10
+#define EFI_SECTION_PIC 0x11
+#define EFI_SECTION_TE 0x12
+#define EFI_SECTION_DXE_DEPEX 0x13
+#define EFI_SECTION_VERSION 0x14
+#define EFI_SECTION_USER_INTERFACE 0x15
+#define EFI_SECTION_COMPATIBILITY16 0x16
+#define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17
+#define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18
+#define EFI_SECTION_RAW 0x19
+#define EFI_SECTION_PEI_DEPEX 0x1B
+#define EFI_SECTION_SMM_DEPEX 0x1C
+
+typedef struct {
+ UINT8 Size[3];
+ EFI_SECTION_TYPE Type;
+} EFI_COMMON_SECTION_HEADER;
+
+typedef struct {
+ UINT8 Size[3];
+ EFI_SECTION_TYPE Type;
+ UINT32 ExtendedSize;
+} EFI_COMMON_SECTION_HEADER2;
+
+#define MAX_SECTION_SIZE 0x1000000
+
+//
+// Leaf section type that contains an
+// IA-32 16-bit executable image.
+//
+typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;
+typedef EFI_COMMON_SECTION_HEADER2 EFI_COMPATIBILITY16_SECTION2;
+
+//
+// CompressionType of EFI_COMPRESSION_SECTION.
+//
+#define EFI_NOT_COMPRESSED 0x00
+#define EFI_STANDARD_COMPRESSION 0x01
+//
+// An encapsulation section type in which the
+// section data is compressed.
+//
+typedef struct {
+ EFI_COMMON_SECTION_HEADER CommonHeader;
+ UINT32 UncompressedLength;
+ UINT8 CompressionType;
+} EFI_COMPRESSION_SECTION;
+
+typedef struct {
+ EFI_COMMON_SECTION_HEADER2 CommonHeader;
+ UINT32 UncompressedLength;
+ UINT8 CompressionType;
+} EFI_COMPRESSION_SECTION2;
+
+//
+// Leaf section which could be used to determine the dispatch order of DXEs.
+//
+typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;
+typedef EFI_COMMON_SECTION_HEADER2 EFI_DXE_DEPEX_SECTION2;
+
+//
+// Leaf section witch contains a PI FV.
+//
+typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
+typedef EFI_COMMON_SECTION_HEADER2 EFI_FIRMWARE_VOLUME_IMAGE_SECTION2;
+
+//
+// Leaf section which contains a single GUID.
+//
+typedef struct {
+ EFI_COMMON_SECTION_HEADER CommonHeader;
+ EFI_GUID SubTypeGuid;
+} EFI_FREEFORM_SUBTYPE_GUID_SECTION;
+
+typedef struct {
+ EFI_COMMON_SECTION_HEADER2 CommonHeader;
+ EFI_GUID SubTypeGuid;
+} EFI_FREEFORM_SUBTYPE_GUID_SECTION2;
+
+//
+// Attributes of EFI_GUID_DEFINED_SECTION
+//
+#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01
+#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02
+//
+// Leaf section which is encapsulation defined by specific GUID
+//
+typedef struct {
+ EFI_COMMON_SECTION_HEADER CommonHeader;
+ EFI_GUID SectionDefinitionGuid;
+ UINT16 DataOffset;
+ UINT16 Attributes;
+} EFI_GUID_DEFINED_SECTION;
+
+typedef struct {
+ EFI_COMMON_SECTION_HEADER2 CommonHeader;
+ EFI_GUID SectionDefinitionGuid;
+ UINT16 DataOffset;
+ UINT16 Attributes;
+} EFI_GUID_DEFINED_SECTION2;
+
+//
+// Leaf section which contains PE32+ image.
+//
+typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;
+typedef EFI_COMMON_SECTION_HEADER2 EFI_PE32_SECTION2;
+
+//
+// Leaf section which contains PIC image.
+//
+typedef EFI_COMMON_SECTION_HEADER EFI_PIC_SECTION;
+typedef EFI_COMMON_SECTION_HEADER2 EFI_PIC_SECTION2;
+
+//
+// Leaf section which used to determine the dispatch order of PEIMs.
+//
+typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;
+typedef EFI_COMMON_SECTION_HEADER2 EFI_PEI_DEPEX_SECTION2;
+
+//
+// Leaf section which constains the position-independent-code image.
+//
+typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;
+typedef EFI_COMMON_SECTION_HEADER2 EFI_TE_SECTION2;
+
+//
+// Leaf section which contains an array of zero or more bytes.
+//
+typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;
+typedef EFI_COMMON_SECTION_HEADER2 EFI_RAW_SECTION2;
+
+//
+// Leaf section which contains a unicode string that
+// is human readable file name.
+//
+typedef struct {
+ EFI_COMMON_SECTION_HEADER CommonHeader;
+
+ //
+ // Array of unicode string.
+ //
+ CHAR16 FileNameString[1];
+} EFI_USER_INTERFACE_SECTION;
+
+typedef struct {
+ EFI_COMMON_SECTION_HEADER2 CommonHeader;
+
+ //
+ // Array of unicode string.
+ //
+ CHAR16 FileNameString[1];
+} EFI_USER_INTERFACE_SECTION2;
+
+//
+// Leaf section which contains a numeric build number and
+// an optional unicode string that represent the file revision.
+//
+typedef struct {
+ EFI_COMMON_SECTION_HEADER CommonHeader;
+ UINT16 BuildNumber;
+ CHAR16 VersionString[1];
+} EFI_VERSION_SECTION;
+
+typedef struct {
+ EFI_COMMON_SECTION_HEADER2 CommonHeader;
+ UINT16 BuildNumber;
+ CHAR16 VersionString[1];
+} EFI_VERSION_SECTION2;
+
+//
+// The argument passed as the SectionHeaderPtr parameter to the SECTION_SIZE()
+// function-like macro below must not have side effects: SectionHeaderPtr is
+// evaluated multiple times.
+//
+#define SECTION_SIZE(SectionHeaderPtr) ((UINT32) ( \
+ (((EFI_COMMON_SECTION_HEADER *) (SectionHeaderPtr))->Size[0] ) | \
+ (((EFI_COMMON_SECTION_HEADER *) (SectionHeaderPtr))->Size[1] << 8) | \
+ (((EFI_COMMON_SECTION_HEADER *) (SectionHeaderPtr))->Size[2] << 16)))
+
+#pragma pack()
+
+typedef union {
+ EFI_COMMON_SECTION_HEADER *CommonHeader;
+ EFI_COMPRESSION_SECTION *CompressionSection;
+ EFI_GUID_DEFINED_SECTION *GuidDefinedSection;
+ EFI_PE32_SECTION *Pe32Section;
+ EFI_PIC_SECTION *PicSection;
+ EFI_TE_SECTION *TeSection;
+ EFI_PEI_DEPEX_SECTION *PeimHeaderSection;
+ EFI_DXE_DEPEX_SECTION *DependencySection;
+ EFI_VERSION_SECTION *VersionSection;
+ EFI_USER_INTERFACE_SECTION *UISection;
+ EFI_COMPATIBILITY16_SECTION *Code16Section;
+ EFI_FIRMWARE_VOLUME_IMAGE_SECTION *FVImageSection;
+ EFI_FREEFORM_SUBTYPE_GUID_SECTION *FreeformSubtypeSection;
+ EFI_RAW_SECTION *RawSection;
+ //
+ // For section whose size is equal or greater than 0x1000000
+ //
+ EFI_COMMON_SECTION_HEADER2 *CommonHeader2;
+ EFI_COMPRESSION_SECTION2 *CompressionSection2;
+ EFI_GUID_DEFINED_SECTION2 *GuidDefinedSection2;
+ EFI_PE32_SECTION2 *Pe32Section2;
+ EFI_PIC_SECTION2 *PicSection2;
+ EFI_TE_SECTION2 *TeSection2;
+ EFI_PEI_DEPEX_SECTION2 *PeimHeaderSection2;
+ EFI_DXE_DEPEX_SECTION2 *DependencySection2;
+ EFI_VERSION_SECTION2 *VersionSection2;
+ EFI_USER_INTERFACE_SECTION2 *UISection2;
+ EFI_COMPATIBILITY16_SECTION2 *Code16Section2;
+ EFI_FIRMWARE_VOLUME_IMAGE_SECTION2 *FVImageSection2;
+ EFI_FREEFORM_SUBTYPE_GUID_SECTION2 *FreeformSubtypeSection2;
+ EFI_RAW_SECTION2 *RawSection2;
+} EFI_FILE_SECTION_POINTER;
+
+#endif
+
diff --git a/roms/edk2/BaseTools/Source/C/Include/Common/PiFirmwareVolume.h b/roms/edk2/BaseTools/Source/C/Include/Common/PiFirmwareVolume.h
new file mode 100644
index 000000000..35afbdf00
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Common/PiFirmwareVolume.h
@@ -0,0 +1,157 @@
+/** @file
+ The firmware volume related definitions in PI.
+
+ @par Revision Reference:
+ Version 1.2C
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PI_FIRMWAREVOLUME_H__
+#define __PI_FIRMWAREVOLUME_H__
+
+//
+// EFI_FV_FILE_ATTRIBUTES
+//
+typedef UINT32 EFI_FV_FILE_ATTRIBUTES;
+
+//
+// Value of EFI_FV_FILE_ATTRIBUTES.
+//
+#define EFI_FV_FILE_ATTRIB_ALIGNMENT 0x0000001F
+#define EFI_FV_FILE_ATTRIB_FIXED 0x00000100
+#define EFI_FV_FILE_ATTRIB_MEMORY_MAPPED 0x00000200
+
+typedef UINT32 EFI_FVB_ATTRIBUTES_2;
+
+//
+// Attributes bit definitions
+//
+#define EFI_FVB2_READ_DISABLED_CAP 0x00000001
+#define EFI_FVB2_READ_ENABLED_CAP 0x00000002
+#define EFI_FVB2_READ_STATUS 0x00000004
+#define EFI_FVB2_WRITE_DISABLED_CAP 0x00000008
+#define EFI_FVB2_WRITE_ENABLED_CAP 0x00000010
+#define EFI_FVB2_WRITE_STATUS 0x00000020
+#define EFI_FVB2_LOCK_CAP 0x00000040
+#define EFI_FVB2_LOCK_STATUS 0x00000080
+#define EFI_FVB2_STICKY_WRITE 0x00000200
+#define EFI_FVB2_MEMORY_MAPPED 0x00000400
+#define EFI_FVB2_ERASE_POLARITY 0x00000800
+#define EFI_FVB2_READ_LOCK_CAP 0x00001000
+#define EFI_FVB2_READ_LOCK_STATUS 0x00002000
+#define EFI_FVB2_WRITE_LOCK_CAP 0x00004000
+#define EFI_FVB2_WRITE_LOCK_STATUS 0x00008000
+#define EFI_FVB2_ALIGNMENT 0x001F0000
+#define EFI_FVB2_WEAK_ALIGNMENT 0x80000000
+#define EFI_FVB2_ALIGNMENT_1 0x00000000
+#define EFI_FVB2_ALIGNMENT_2 0x00010000
+#define EFI_FVB2_ALIGNMENT_4 0x00020000
+#define EFI_FVB2_ALIGNMENT_8 0x00030000
+#define EFI_FVB2_ALIGNMENT_16 0x00040000
+#define EFI_FVB2_ALIGNMENT_32 0x00050000
+#define EFI_FVB2_ALIGNMENT_64 0x00060000
+#define EFI_FVB2_ALIGNMENT_128 0x00070000
+#define EFI_FVB2_ALIGNMENT_256 0x00080000
+#define EFI_FVB2_ALIGNMENT_512 0x00090000
+#define EFI_FVB2_ALIGNMENT_1K 0x000A0000
+#define EFI_FVB2_ALIGNMENT_2K 0x000B0000
+#define EFI_FVB2_ALIGNMENT_4K 0x000C0000
+#define EFI_FVB2_ALIGNMENT_8K 0x000D0000
+#define EFI_FVB2_ALIGNMENT_16K 0x000E0000
+#define EFI_FVB2_ALIGNMENT_32K 0x000F0000
+#define EFI_FVB2_ALIGNMENT_64K 0x00100000
+#define EFI_FVB2_ALIGNMENT_128K 0x00110000
+#define EFI_FVB2_ALIGNMENT_256K 0x00120000
+#define EFI_FVB2_ALIGNMENT_512K 0x00130000
+#define EFI_FVB2_ALIGNMENT_1M 0x00140000
+#define EFI_FVB2_ALIGNMENT_2M 0x00150000
+#define EFI_FVB2_ALIGNMENT_4M 0x00160000
+#define EFI_FVB2_ALIGNMENT_8M 0x00170000
+#define EFI_FVB2_ALIGNMENT_16M 0x00180000
+#define EFI_FVB2_ALIGNMENT_32M 0x00190000
+#define EFI_FVB2_ALIGNMENT_64M 0x001A0000
+#define EFI_FVB2_ALIGNMENT_128M 0x001B0000
+#define EFI_FVB2_ALIGNMENT_256M 0x001C0000
+#define EFI_FVB2_ALIGNMENT_512M 0x001D0000
+#define EFI_FVB2_ALIGNMENT_1G 0x001E0000
+#define EFI_FVB2_ALIGNMENT_2G 0x001F0000
+
+
+typedef struct {
+ UINT32 NumBlocks;
+ UINT32 Length;
+} EFI_FV_BLOCK_MAP_ENTRY;
+
+//
+// Describes the features and layout of the firmware volume.
+//
+typedef struct {
+ UINT8 ZeroVector[16];
+ EFI_GUID FileSystemGuid;
+ UINT64 FvLength;
+ UINT32 Signature;
+ EFI_FVB_ATTRIBUTES_2 Attributes;
+ UINT16 HeaderLength;
+ UINT16 Checksum;
+ UINT16 ExtHeaderOffset;
+ UINT8 Reserved[1];
+ UINT8 Revision;
+ EFI_FV_BLOCK_MAP_ENTRY BlockMap[1];
+} EFI_FIRMWARE_VOLUME_HEADER;
+
+#define EFI_FVH_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', 'H')
+
+///
+/// Firmware Volume Header Revision definition
+///
+#define EFI_FVH_REVISION 0x02
+
+//
+// Extension header pointed by ExtHeaderOffset of volume header.
+//
+typedef struct {
+ EFI_GUID FvName;
+ UINT32 ExtHeaderSize;
+} EFI_FIRMWARE_VOLUME_EXT_HEADER;
+
+typedef struct {
+ UINT16 ExtEntrySize;
+ UINT16 ExtEntryType;
+} EFI_FIRMWARE_VOLUME_EXT_ENTRY;
+
+#define EFI_FV_EXT_TYPE_OEM_TYPE 0x01
+typedef struct {
+ EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;
+ UINT32 TypeMask;
+
+ //
+ // Array of GUIDs.
+ // Each GUID represents an OEM file type.
+ //
+ // EFI_GUID Types[1];
+ //
+} EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE;
+
+#define EFI_FV_EXT_TYPE_GUID_TYPE 0x0002
+typedef struct {
+ EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;
+ EFI_GUID FormatType;
+
+ //
+ // An array of bytes of length Length.
+ //
+ // UINT8 Data[1];
+ //
+} EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE;
+
+#define EFI_FV_EXT_TYPE_USED_SIZE_TYPE 0x03
+typedef struct {
+ EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;
+ UINT32 UsedSize;
+} EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Common/UefiBaseTypes.h b/roms/edk2/BaseTools/Source/C/Include/Common/UefiBaseTypes.h
new file mode 100644
index 000000000..acf179af2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Common/UefiBaseTypes.h
@@ -0,0 +1,168 @@
+/** @file
+ Defines data types and constants introduced in UEFI.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __UEFI_BASETYPE_H__
+#define __UEFI_BASETYPE_H__
+
+#include <Common/BaseTypes.h>
+
+//
+// Basical data type definitions introduced in UEFI.
+//
+typedef struct {
+ UINT32 Data1;
+ UINT16 Data2;
+ UINT16 Data3;
+ UINT8 Data4[8];
+} EFI_GUID;
+
+typedef RETURN_STATUS EFI_STATUS;
+typedef VOID *EFI_HANDLE;
+
+typedef VOID *EFI_EVENT;
+
+typedef UINTN EFI_TPL;
+
+
+typedef UINT64 EFI_LBA;
+
+
+typedef UINT16 STRING_REF;
+
+typedef UINT64 EFI_PHYSICAL_ADDRESS;
+typedef UINT64 EFI_VIRTUAL_ADDRESS;
+
+//
+// EFI Time Abstraction:
+// Year: 2000 - 20XX
+// Month: 1 - 12
+// Day: 1 - 31
+// Hour: 0 - 23
+// Minute: 0 - 59
+// Second: 0 - 59
+// Nanosecond: 0 - 999,999,999
+// TimeZone: -1440 to 1440 or 2047
+//
+typedef struct {
+ UINT16 Year;
+ UINT8 Month;
+ UINT8 Day;
+ UINT8 Hour;
+ UINT8 Minute;
+ UINT8 Second;
+ UINT8 Pad1;
+ UINT32 Nanosecond;
+ INT16 TimeZone;
+ UINT8 Daylight;
+ UINT8 Pad2;
+} EFI_TIME;
+
+
+//
+// Networking Definitions
+//
+typedef struct {
+ UINT8 Addr[4];
+} EFI_IPv4_ADDRESS;
+
+typedef struct {
+ UINT8 Addr[16];
+} EFI_IPv6_ADDRESS;
+
+typedef struct {
+ UINT8 Addr[32];
+} EFI_MAC_ADDRESS;
+
+typedef union {
+ UINT32 Addr[4];
+ EFI_IPv4_ADDRESS v4;
+ EFI_IPv6_ADDRESS v6;
+} EFI_IP_ADDRESS;
+
+
+//
+// Enumeration of EFI_STATUS.
+//
+#define EFI_SUCCESS RETURN_SUCCESS
+#define EFI_LOAD_ERROR RETURN_LOAD_ERROR
+#define EFI_INVALID_PARAMETER RETURN_INVALID_PARAMETER
+#define EFI_UNSUPPORTED RETURN_UNSUPPORTED
+#define EFI_BAD_BUFFER_SIZE RETURN_BAD_BUFFER_SIZE
+#define EFI_BUFFER_TOO_SMALL RETURN_BUFFER_TOO_SMALL
+#define EFI_NOT_READY RETURN_NOT_READY
+#define EFI_DEVICE_ERROR RETURN_DEVICE_ERROR
+#define EFI_WRITE_PROTECTED RETURN_WRITE_PROTECTED
+#define EFI_OUT_OF_RESOURCES RETURN_OUT_OF_RESOURCES
+#define EFI_VOLUME_CORRUPTED RETURN_VOLUME_CORRUPTED
+#define EFI_VOLUME_FULL RETURN_VOLUME_FULL
+#define EFI_NO_MEDIA RETURN_NO_MEDIA
+#define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED
+#define EFI_NOT_FOUND RETURN_NOT_FOUND
+#define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED
+#define EFI_NO_RESPONSE RETURN_NO_RESPONSE
+#define EFI_NO_MAPPING RETURN_NO_MAPPING
+#define EFI_TIMEOUT RETURN_TIMEOUT
+#define EFI_NOT_STARTED RETURN_NOT_STARTED
+#define EFI_ALREADY_STARTED RETURN_ALREADY_STARTED
+#define EFI_ABORTED RETURN_ABORTED
+#define EFI_ICMP_ERROR RETURN_ICMP_ERROR
+#define EFI_TFTP_ERROR RETURN_TFTP_ERROR
+#define EFI_PROTOCOL_ERROR RETURN_PROTOCOL_ERROR
+#define EFI_INCOMPATIBLE_VERSION RETURN_INCOMPATIBLE_VERSION
+#define EFI_SECURITY_VIOLATION RETURN_SECURITY_VIOLATION
+#define EFI_CRC_ERROR RETURN_CRC_ERROR
+#define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA
+#define EFI_END_OF_FILE RETURN_END_OF_FILE
+
+#define EFI_WARN_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH
+#define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE
+#define EFI_WARN_WRITE_FAILURE RETURN_WARN_WRITE_FAILURE
+#define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL
+
+
+#define NULL_HANDLE ((VOID *) 0)
+
+//
+// Define macro to encode the status code.
+//
+#define EFIERR(_a) ENCODE_ERROR(_a)
+
+#define EFI_ERROR(A) RETURN_ERROR(A)
+
+//
+// Define macros to build data structure signatures from characters.
+//
+#define SIGNATURE_16(A, B) ((A) | (B << 8))
+#define SIGNATURE_32(A, B, C, D) (SIGNATURE_16 (A, B) | (SIGNATURE_16 (C, D) << 16))
+#define SIGNATURE_64(A, B, C, D, E, F, G, H) \
+ (SIGNATURE_32 (A, B, C, D) | ((UINT64) (SIGNATURE_32 (E, F, G, H)) << 32))
+
+
+//
+// Returns the byte offset to a field within a structure
+//
+#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field)))
+
+//
+// The EFI memory allocation functions work in units of EFI_PAGEs that are
+// 4K. This should in no way be confused with the page size of the processor.
+// An EFI_PAGE is just the quanta of memory in EFI.
+//
+#define EFI_PAGE_SIZE 0x1000
+#define EFI_PAGE_MASK 0xFFF
+#define EFI_PAGE_SHIFT 12
+
+#define EFI_SIZE_TO_PAGES(a) (((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0))
+
+#define EFI_PAGES_TO_SIZE(a) ( (a) << EFI_PAGE_SHIFT)
+
+
+#define EFI_MAX_BIT MAX_BIT
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Common/UefiCapsule.h b/roms/edk2/BaseTools/Source/C/Include/Common/UefiCapsule.h
new file mode 100644
index 000000000..ecfe3a0a7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Common/UefiCapsule.h
@@ -0,0 +1,26 @@
+/** @file
+ Defines for the EFI Capsule functionality.
+ @par Revision Reference:
+ These definitions are from Uefi Spec.
+
+ Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFI_CAPSULE_H_
+#define _EFI_CAPSULE_H_
+
+typedef struct {
+ EFI_GUID CapsuleGuid;
+ UINT32 HeaderSize;
+ UINT32 Flags;
+ UINT32 CapsuleImageSize;
+} EFI_CAPSULE_HEADER;
+
+#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000
+#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000
+#define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
+
+#endif // #ifndef _EFI_CAPSULE_H_
diff --git a/roms/edk2/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h b/roms/edk2/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h
new file mode 100644
index 000000000..b9fa8c39a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h
@@ -0,0 +1,1680 @@
+/** @file
+ This file defines the encoding for the VFR (Visual Form Representation) language.
+ IFR is primarily consumed by the EFI presentation engine, and produced by EFI
+ internal application and drivers as well as all add-in card option-ROM drivers
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Revision Reference:
+ These definitions are from UEFI 2.6
+
+**/
+
+#ifndef __UEFI_INTERNAL_FORMREPRESENTATION_H__
+#define __UEFI_INTERNAL_FORMREPRESENTATION_H__
+
+
+#define EFI_HII_PLATFORM_SETUP_FORMSET_GUID \
+ { 0x93039971, 0x8545, 0x4b04, { 0xb4, 0x5e, 0x32, 0xeb, 0x83, 0x26, 0x4, 0xe } }
+
+//
+// The following types are currently defined:
+//
+typedef UINT32 RELOFST;
+
+typedef VOID* EFI_HII_HANDLE;
+typedef CHAR16* EFI_STRING;
+typedef UINT16 EFI_IMAGE_ID;
+typedef UINT16 EFI_QUESTION_ID;
+typedef UINT16 EFI_STRING_ID;
+typedef UINT16 EFI_FORM_ID;
+typedef UINT16 EFI_VARSTORE_ID;
+typedef UINT16 EFI_DEFAULT_ID;
+typedef UINT32 EFI_HII_FONT_STYLE;
+
+
+
+#pragma pack(1)
+
+
+//
+// HII package list
+//
+typedef struct {
+ EFI_GUID PackageListGuid;
+ UINT32 PackageLength;
+} EFI_HII_PACKAGE_LIST_HEADER;
+
+/**
+
+ Each package starts with a header, as defined above, which
+ indicates the size and type of the package. When added to a
+ pointer pointing to the start of the header, Length points at
+ the next package. The package lists form a package list when
+ concatenated together and terminated with an
+ EFI_HII_PACKAGE_HEADER with a Type of EFI_HII_PACKAGE_END. The
+ type EFI_HII_PACKAGE_TYPE_GUID is used for vendor-defined HII
+ packages, whose contents are determined by the Guid. The range
+ of package types starting with EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN
+ through EFI_HII_PACKAGE_TYPE_SYSTEM_END are reserved for system
+ firmware implementers.
+
+ @param Length The size of the package in bytes.
+
+ @param Type The package type. See EFI_HII_PACKAGE_TYPE_x,
+ below.
+
+ @param Data The package data, the format of which is
+ determined by Type.
+
+**/
+typedef struct {
+ UINT32 Length:24;
+ UINT32 Type:8;
+ // UINT8 Data[...];
+} EFI_HII_PACKAGE_HEADER;
+
+//
+// EFI_HII_PACKAGE_TYPE_x.
+//
+#define EFI_HII_PACKAGE_TYPE_ALL 0x00
+#define EFI_HII_PACKAGE_TYPE_GUID 0x01
+#define EFI_HII_PACKAGE_FORM 0x02
+#define EFI_HII_PACKAGE_KEYBOARD_LAYOUT 0x03
+#define EFI_HII_PACKAGE_STRINGS 0x04
+#define EFI_HII_PACKAGE_FONTS 0x05
+#define EFI_HII_PACKAGE_IMAGES 0x06
+#define EFI_HII_PACKAGE_SIMPLE_FONTS 0x07
+#define EFI_HII_PACKAGE_DEVICE_PATH 0x08
+#define EFI_HII_PACKAGE_END 0xDF
+#define EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN 0xE0
+#define EFI_HII_PACKAGE_TYPE_SYSTEM_END 0xFF
+
+//
+// Simplified Font Package
+//
+
+#define EFI_GLYPH_HEIGHT 19
+#define EFI_GLYPH_WIDTH 8
+//
+// Contents of EFI_NARROW_GLYPH.Attributes
+//
+#define EFI_GLYPH_NON_SPACING 0x01
+#define EFI_GLYPH_WIDE 0x02
+
+typedef struct {
+ CHAR16 UnicodeWeight;
+ UINT8 Attributes;
+ UINT8 GlyphCol1[EFI_GLYPH_HEIGHT];
+} EFI_NARROW_GLYPH;
+
+typedef struct {
+ CHAR16 UnicodeWeight;
+ UINT8 Attributes;
+ UINT8 GlyphCol1[EFI_GLYPH_HEIGHT];
+ UINT8 GlyphCol2[EFI_GLYPH_HEIGHT];
+ UINT8 Pad[3];
+} EFI_WIDE_GLYPH;
+
+
+typedef struct _EFI_HII_SIMPLE_FONT_PACKAGE_HDR {
+ EFI_HII_PACKAGE_HEADER Header;
+ UINT16 NumberOfNarrowGlyphs;
+ UINT16 NumberOfWideGlyphs;
+ // EFI_NARROW_GLYPH NarrowGlyphs[];
+ // EFI_WIDE_GLYPH WideGlyphs[];
+} EFI_HII_SIMPLE_FONT_PACKAGE_HDR;
+
+//
+// Font Package
+//
+
+#define EFI_HII_FONT_STYLE_BOLD 0x00000001
+#define EFI_HII_FONT_STYLE_ITALIC 0x00000002
+#define EFI_HII_FONT_STYLE_EMBOSS 0x00010000
+#define EFI_HII_FONT_STYLE_OUTLINE 0x00020000
+#define EFI_HII_FONT_STYLE_SHADOW 0x00040000
+#define EFI_HII_FONT_STYLE_UNDERLINE 0x00080000
+#define EFI_HII_FONT_STYLE_DBL_UNDER 0x00100000
+
+typedef struct _EFI_HII_GLYPH_INFO {
+ UINT16 Width;
+ UINT16 Height;
+ INT16 OffsetX;
+ INT16 OffsetY;
+ INT16 AdvanceX;
+} EFI_HII_GLYPH_INFO;
+
+typedef struct _EFI_HII_FONT_PACKAGE_HDR {
+ EFI_HII_PACKAGE_HEADER Header;
+ UINT32 HdrSize;
+ UINT32 GlyphBlockOffset;
+ EFI_HII_GLYPH_INFO Cell;
+ EFI_HII_FONT_STYLE FontStyle;
+ CHAR16 FontFamily[1];
+} EFI_HII_FONT_PACKAGE_HDR;
+
+#define EFI_HII_GIBT_END 0x00
+#define EFI_HII_GIBT_GLYPH 0x10
+#define EFI_HII_GIBT_GLYPHS 0x11
+#define EFI_HII_GIBT_GLYPH_DEFAULT 0x12
+#define EFI_HII_GIBT_GLYPHS_DEFAULT 0x13
+#define EFI_HII_GIBT_GLYPH_VARIABILITY 0x14
+#define EFI_HII_GIBT_DUPLICATE 0x20
+#define EFI_HII_GIBT_SKIP2 0x21
+#define EFI_HII_GIBT_SKIP1 0x22
+#define EFI_HII_GIBT_DEFAULTS 0x23
+#define EFI_HII_GIBT_EXT1 0x30
+#define EFI_HII_GIBT_EXT2 0x31
+#define EFI_HII_GIBT_EXT4 0x32
+
+typedef struct _EFI_HII_GLYPH_BLOCK {
+ UINT8 BlockType;
+} EFI_HII_GLYPH_BLOCK;
+
+typedef struct _EFI_HII_GIBT_DEFAULTS_BLOCK {
+ EFI_HII_GLYPH_BLOCK Header;
+ EFI_HII_GLYPH_INFO Cell;
+} EFI_HII_GIBT_DEFAULTS_BLOCK;
+
+typedef struct _EFI_HII_GIBT_DUPLICATE_BLOCK {
+ EFI_HII_GLYPH_BLOCK Header;
+ CHAR16 CharValue;
+} EFI_HII_GIBT_DUPLICATE_BLOCK;
+
+typedef struct _EFI_GLYPH_GIBT_END_BLOCK {
+ EFI_HII_GLYPH_BLOCK Header;
+} EFI_GLYPH_GIBT_END_BLOCK;
+
+typedef struct _EFI_HII_GIBT_EXT1_BLOCK {
+ EFI_HII_GLYPH_BLOCK Header;
+ UINT8 BlockType2;
+ UINT8 Length;
+} EFI_HII_GIBT_EXT1_BLOCK;
+
+typedef struct _EFI_HII_GIBT_EXT2_BLOCK {
+ EFI_HII_GLYPH_BLOCK Header;
+ UINT8 BlockType2;
+ UINT16 Length;
+} EFI_HII_GIBT_EXT2_BLOCK;
+
+typedef struct _EFI_HII_GIBT_EXT4_BLOCK {
+ EFI_HII_GLYPH_BLOCK Header;
+ UINT8 BlockType2;
+ UINT32 Length;
+} EFI_HII_GIBT_EXT4_BLOCK;
+
+typedef struct _EFI_HII_GIBT_GLYPH_BLOCK {
+ EFI_HII_GLYPH_BLOCK Header;
+ EFI_HII_GLYPH_INFO Cell;
+ UINT8 BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Cell.Width+7)/8)*Cell.Height
+} EFI_HII_GIBT_GLYPH_BLOCK;
+
+typedef struct _EFI_HII_GIBT_GLYPHS_BLOCK {
+ EFI_HII_GLYPH_BLOCK Header;
+ EFI_HII_GLYPH_INFO Cell;
+ UINT16 Count;
+ UINT8 BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Cell.Width+7)/8)*Cell.Height
+} EFI_HII_GIBT_GLYPHS_BLOCK;
+
+typedef struct _EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK {
+ EFI_HII_GLYPH_BLOCK Header;
+ UINT8 BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Global.Cell.Width+7)/8)*Global.Cell.Height
+} EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK;
+
+typedef struct _EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK {
+ EFI_HII_GLYPH_BLOCK Header;
+ UINT16 Count;
+ UINT8 BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Global.Cell.Width+7)/8)*Global.Cell.Height
+} EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK;
+
+typedef struct _EFI_HII_GIBT_VARIABILITY_BLOCK {
+ EFI_HII_GLYPH_BLOCK Header;
+ EFI_HII_GLYPH_INFO Cell;
+ UINT8 GlyphPackInBits;
+ UINT8 BitmapData [1];
+} EFI_HII_GIBT_VARIABILITY_BLOCK;
+
+typedef struct _EFI_HII_GIBT_SKIP1_BLOCK {
+ EFI_HII_GLYPH_BLOCK Header;
+ UINT8 SkipCount;
+} EFI_HII_GIBT_SKIP1_BLOCK;
+
+typedef struct _EFI_HII_GIBT_SKIP2_BLOCK {
+ EFI_HII_GLYPH_BLOCK Header;
+ UINT16 SkipCount;
+} EFI_HII_GIBT_SKIP2_BLOCK;
+
+//
+// Device Path Package
+//
+typedef struct _EFI_HII_DEVICE_PATH_PACKAGE {
+ EFI_HII_PACKAGE_HEADER Header;
+ // EFI_DEVICE_PATH_PROTOCOL DevicePath[];
+} EFI_HII_DEVICE_PATH_PACKAGE;
+
+//
+// GUID Package
+//
+typedef struct _EFI_HII_GUID_PACKAGE_HDR {
+ EFI_HII_PACKAGE_HEADER Header;
+ EFI_GUID Guid;
+ // Data per GUID definition may follow
+} EFI_HII_GUID_PACKAGE_HDR;
+
+//
+// String Package
+//
+
+#define UEFI_CONFIG_LANG "x-UEFI"
+#define UEFI_CONFIG_LANG2 "x-i-UEFI"
+
+typedef struct _EFI_HII_STRING_PACKAGE_HDR {
+ EFI_HII_PACKAGE_HEADER Header;
+ UINT32 HdrSize;
+ UINT32 StringInfoOffset;
+ CHAR16 LanguageWindow[16];
+ EFI_STRING_ID LanguageName;
+ CHAR8 Language[1];
+} EFI_HII_STRING_PACKAGE_HDR;
+
+typedef struct {
+ UINT8 BlockType;
+} EFI_HII_STRING_BLOCK;
+
+#define EFI_HII_SIBT_END 0x00
+#define EFI_HII_SIBT_STRING_SCSU 0x10
+#define EFI_HII_SIBT_STRING_SCSU_FONT 0x11
+#define EFI_HII_SIBT_STRINGS_SCSU 0x12
+#define EFI_HII_SIBT_STRINGS_SCSU_FONT 0x13
+#define EFI_HII_SIBT_STRING_UCS2 0x14
+#define EFI_HII_SIBT_STRING_UCS2_FONT 0x15
+#define EFI_HII_SIBT_STRINGS_UCS2 0x16
+#define EFI_HII_SIBT_STRINGS_UCS2_FONT 0x17
+#define EFI_HII_SIBT_DUPLICATE 0x20
+#define EFI_HII_SIBT_SKIP2 0x21
+#define EFI_HII_SIBT_SKIP1 0x22
+#define EFI_HII_SIBT_EXT1 0x30
+#define EFI_HII_SIBT_EXT2 0x31
+#define EFI_HII_SIBT_EXT4 0x32
+#define EFI_HII_SIBT_FONT 0x40
+
+typedef struct _EFI_HII_SIBT_DUPLICATE_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ EFI_STRING_ID StringId;
+} EFI_HII_SIBT_DUPLICATE_BLOCK;
+
+typedef struct _EFI_HII_SIBT_END_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+} EFI_HII_SIBT_END_BLOCK;
+
+typedef struct _EFI_HII_SIBT_EXT1_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ UINT8 BlockType2;
+ UINT8 Length;
+} EFI_HII_SIBT_EXT1_BLOCK;
+
+typedef struct _EFI_HII_SIBT_EXT2_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ UINT8 BlockType2;
+ UINT16 Length;
+} EFI_HII_SIBT_EXT2_BLOCK;
+
+typedef struct _EFI_HII_SIBT_EXT4_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ UINT8 BlockType2;
+ UINT32 Length;
+} EFI_HII_SIBT_EXT4_BLOCK;
+
+typedef struct _EFI_HII_SIBT_FONT_BLOCK {
+ EFI_HII_SIBT_EXT2_BLOCK Header;
+ UINT8 FontId;
+ UINT16 FontSize;
+ EFI_HII_FONT_STYLE FontStyle;
+ CHAR16 FontName[1];
+} EFI_HII_SIBT_FONT_BLOCK;
+
+typedef struct _EFI_HII_SIBT_SKIP1_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ UINT8 SkipCount;
+} EFI_HII_SIBT_SKIP1_BLOCK;
+
+typedef struct _EFI_HII_SIBT_SKIP2_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ UINT16 SkipCount;
+} EFI_HII_SIBT_SKIP2_BLOCK;
+
+typedef struct _EFI_HII_SIBT_STRING_SCSU_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ UINT8 StringText[1];
+} EFI_HII_SIBT_STRING_SCSU_BLOCK;
+
+typedef struct _EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ UINT8 FontIdentifier;
+ UINT8 StringText[1];
+} EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK;
+
+typedef struct _EFI_HII_SIBT_STRINGS_SCSU_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ UINT16 StringCount;
+ UINT8 StringText[1];
+} EFI_HII_SIBT_STRINGS_SCSU_BLOCK;
+
+typedef struct _EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ UINT8 FontIdentifier;
+ UINT16 StringCount;
+ UINT8 StringText[1];
+} EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK;
+
+typedef struct _EFI_HII_SIBT_STRING_UCS2_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ CHAR16 StringText[1];
+} EFI_HII_SIBT_STRING_UCS2_BLOCK;
+
+typedef struct _EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ UINT8 FontIdentifier;
+ CHAR16 StringText[1];
+} EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK;
+
+typedef struct _EFI_HII_SIBT_STRINGS_UCS2_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ UINT16 StringCount;
+ CHAR16 StringText[1];
+} EFI_HII_SIBT_STRINGS_UCS2_BLOCK;
+
+typedef struct _EFI_HII_SIBT_STRINGS_UCS2_FONT_BLOCK {
+ EFI_HII_STRING_BLOCK Header;
+ UINT8 FontIdentifier;
+ UINT16 StringCount;
+ CHAR16 StringText[1];
+} EFI_HII_SIBT_STRINGS_UCS2_FONT_BLOCK;
+
+//
+// Image Packages
+//
+
+typedef struct _EFI_HII_IMAGE_PACKAGE_HDR {
+ EFI_HII_PACKAGE_HEADER Header;
+ UINT32 ImageInfoOffset;
+ UINT32 PaletteInfoOffset;
+} EFI_HII_IMAGE_PACKAGE_HDR;
+
+typedef struct _EFI_HII_IMAGE_BLOCK {
+ UINT8 BlockType;
+} EFI_HII_IMAGE_BLOCK;
+
+#define EFI_HII_IIBT_END 0x00
+#define EFI_HII_IIBT_IMAGE_1BIT 0x10
+#define EFI_HII_IIBT_IMAGE_1BIT_TRANS 0x11
+#define EFI_HII_IIBT_IMAGE_4BIT 0x12
+#define EFI_HII_IIBT_IMAGE_4BIT_TRANS 0x13
+#define EFI_HII_IIBT_IMAGE_8BIT 0x14
+#define EFI_HII_IIBT_IMAGE_8BIT_TRANS 0x15
+#define EFI_HII_IIBT_IMAGE_24BIT 0x16
+#define EFI_HII_IIBT_IMAGE_24BIT_TRANS 0x17
+#define EFI_HII_IIBT_IMAGE_JPEG 0x18
+#define EFI_HII_IIBT_IMAGE_PNG 0x19
+#define EFI_HII_IIBT_DUPLICATE 0x20
+#define EFI_HII_IIBT_SKIP2 0x21
+#define EFI_HII_IIBT_SKIP1 0x22
+#define EFI_HII_IIBT_EXT1 0x30
+#define EFI_HII_IIBT_EXT2 0x31
+#define EFI_HII_IIBT_EXT4 0x32
+
+typedef struct _EFI_HII_IIBT_END_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+} EFI_HII_IIBT_END_BLOCK;
+
+typedef struct _EFI_HII_IIBT_EXT1_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ UINT8 BlockType2;
+ UINT8 Length;
+} EFI_HII_IIBT_EXT1_BLOCK;
+
+typedef struct _EFI_HII_IIBT_EXT2_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ UINT8 BlockType2;
+ UINT16 Length;
+} EFI_HII_IIBT_EXT2_BLOCK;
+
+typedef struct _EFI_HII_IIBT_EXT4_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ UINT8 BlockType2;
+ UINT32 Length;
+} EFI_HII_IIBT_EXT4_BLOCK;
+
+typedef struct _EFI_HII_IIBT_IMAGE_1BIT_BASE {
+ UINT16 Width;
+ UINT16 Height;
+ UINT8 Data[1];
+} EFI_HII_IIBT_IMAGE_1BIT_BASE;
+
+typedef struct _EFI_HII_IIBT_IMAGE_1BIT_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ UINT8 PaletteIndex;
+ EFI_HII_IIBT_IMAGE_1BIT_BASE Bitmap;
+} EFI_HII_IIBT_IMAGE_1BIT_BLOCK;
+
+typedef struct _EFI_HII_IIBT_IMAGE_1BIT_TRANS_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ UINT8 PaletteIndex;
+ EFI_HII_IIBT_IMAGE_1BIT_BASE Bitmap;
+} EFI_HII_IIBT_IMAGE_1BIT_TRANS_BLOCK;
+
+typedef struct _EFI_HII_RGB_PIXEL {
+ UINT8 b;
+ UINT8 g;
+ UINT8 r;
+} EFI_HII_RGB_PIXEL;
+
+typedef struct _EFI_HII_IIBT_IMAGE_24BIT_BASE {
+ UINT16 Width;
+ UINT16 Height;
+ EFI_HII_RGB_PIXEL Bitmap[1];
+} EFI_HII_IIBT_IMAGE_24BIT_BASE;
+
+typedef struct _EFI_HII_IIBT_IMAGE_24BIT_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ EFI_HII_IIBT_IMAGE_24BIT_BASE Bitmap;
+} EFI_HII_IIBT_IMAGE_24BIT_BLOCK;
+
+typedef struct _EFI_HII_IIBT_IMAGE_24BIT_TRANS_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ EFI_HII_IIBT_IMAGE_24BIT_BASE Bitmap;
+} EFI_HII_IIBT_IMAGE_24BIT_TRANS_BLOCK;
+
+typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BASE {
+ UINT16 Width;
+ UINT16 Height;
+ UINT8 Data[1];
+} EFI_HII_IIBT_IMAGE_4BIT_BASE;
+
+typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ UINT8 PaletteIndex;
+ EFI_HII_IIBT_IMAGE_4BIT_BASE Bitmap;
+} EFI_HII_IIBT_IMAGE_4BIT_BLOCK;
+
+typedef struct _EFI_HII_IIBT_IMAGE_4BIT_TRANS_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ UINT8 PaletteIndex;
+ EFI_HII_IIBT_IMAGE_4BIT_BASE Bitmap;
+} EFI_HII_IIBT_IMAGE_4BIT_TRANS_BLOCK;
+
+typedef struct _EFI_HII_IIBT_IMAGE_8BIT_BASE {
+ UINT16 Width;
+ UINT16 Height;
+ UINT8 Data[1];
+} EFI_HII_IIBT_IMAGE_8BIT_BASE;
+
+typedef struct _EFI_HII_IIBT_IMAGE_8BIT_PALETTE_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ UINT8 PaletteIndex;
+ EFI_HII_IIBT_IMAGE_8BIT_BASE Bitmap;
+} EFI_HII_IIBT_IMAGE_8BIT_BLOCK;
+
+typedef struct _EFI_HII_IIBT_IMAGE_8BIT_TRANS_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ UINT8 PaletteIndex;
+ EFI_HII_IIBT_IMAGE_8BIT_BASE Bitmap;
+} EFI_HII_IIBT_IMAGE_8BIT_TRAN_BLOCK;
+
+typedef struct _EFI_HII_IIBT_DUPLICATE_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ EFI_IMAGE_ID ImageId;
+} EFI_HII_IIBT_DUPLICATE_BLOCK;
+
+typedef struct _EFI_HII_IIBT_JPEG_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ UINT32 Size;
+ UINT8 Data[1];
+} EFI_HII_IIBT_JPEG_BLOCK;
+
+typedef struct _EFI_HII_IIBT_PNG_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ UINT32 Size;
+ UINT8 Data[1];
+} EFI_HII_IIBT_PNG_BLOCK;
+
+typedef struct _EFI_HII_IIBT_SKIP1_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ UINT8 SkipCount;
+} EFI_HII_IIBT_SKIP1_BLOCK;
+
+typedef struct _EFI_HII_IIBT_SKIP2_BLOCK {
+ EFI_HII_IMAGE_BLOCK Header;
+ UINT16 SkipCount;
+} EFI_HII_IIBT_SKIP2_BLOCK;
+
+typedef struct _EFI_HII_IMAGE_PALETTE_INFO_HEADER {
+ UINT16 PaletteCount;
+} EFI_HII_IMAGE_PALETTE_INFO_HEADER;
+
+typedef struct _EFI_HII_IMAGE_PALETTE_INFO {
+ UINT16 PaletteSize;
+ EFI_HII_RGB_PIXEL PaletteValue[1];
+} EFI_HII_IMAGE_PALETTE_INFO;
+
+//
+// Forms Package
+//
+
+typedef struct _EFI_HII_FORM_PACKAGE {
+ EFI_HII_PACKAGE_HEADER Header;
+ // EFI_IFR_OP_HEADER OpCodeHeader;
+ // More op-codes follow
+} EFI_HII_FORM_PACKAGE;
+
+typedef struct {
+ UINT8 Hour;
+ UINT8 Minute;
+ UINT8 Second;
+} EFI_HII_TIME;
+
+typedef struct {
+ UINT16 Year;
+ UINT8 Month;
+ UINT8 Day;
+} EFI_HII_DATE;
+
+typedef struct {
+ EFI_QUESTION_ID QuestionId;
+ EFI_FORM_ID FormId;
+ EFI_GUID FormSetGuid;
+ EFI_STRING_ID DevicePath;
+} EFI_HII_REF;
+
+typedef union {
+ UINT8 u8;
+ UINT16 u16;
+ UINT32 u32;
+ UINT64 u64;
+ BOOLEAN b;
+ EFI_HII_TIME time;
+ EFI_HII_DATE date;
+ EFI_STRING_ID string;
+ EFI_HII_REF ref;
+} EFI_IFR_TYPE_VALUE;
+
+#define EFI_IFR_FORM_OP 0x01
+#define EFI_IFR_SUBTITLE_OP 0x02
+#define EFI_IFR_TEXT_OP 0x03
+#define EFI_IFR_IMAGE_OP 0x04
+#define EFI_IFR_ONE_OF_OP 0x05
+#define EFI_IFR_CHECKBOX_OP 0x06
+#define EFI_IFR_NUMERIC_OP 0x07
+#define EFI_IFR_PASSWORD_OP 0x08
+#define EFI_IFR_ONE_OF_OPTION_OP 0x09
+#define EFI_IFR_SUPPRESS_IF_OP 0x0A
+#define EFI_IFR_LOCKED_OP 0x0B
+#define EFI_IFR_ACTION_OP 0x0C
+#define EFI_IFR_RESET_BUTTON_OP 0x0D
+#define EFI_IFR_FORM_SET_OP 0x0E
+#define EFI_IFR_REF_OP 0x0F
+#define EFI_IFR_NO_SUBMIT_IF_OP 0x10
+#define EFI_IFR_INCONSISTENT_IF_OP 0x11
+#define EFI_IFR_EQ_ID_VAL_OP 0x12
+#define EFI_IFR_EQ_ID_ID_OP 0x13
+#define EFI_IFR_EQ_ID_VAL_LIST_OP 0x14
+#define EFI_IFR_AND_OP 0x15
+#define EFI_IFR_OR_OP 0x16
+#define EFI_IFR_NOT_OP 0x17
+#define EFI_IFR_RULE_OP 0x18
+#define EFI_IFR_GRAY_OUT_IF_OP 0x19
+#define EFI_IFR_DATE_OP 0x1A
+#define EFI_IFR_TIME_OP 0x1B
+#define EFI_IFR_STRING_OP 0x1C
+#define EFI_IFR_REFRESH_OP 0x1D
+#define EFI_IFR_DISABLE_IF_OP 0x1E
+#define EFI_IFR_TO_LOWER_OP 0x20
+#define EFI_IFR_TO_UPPER_OP 0x21
+#define EFI_IFR_MAP_OP 0x22
+#define EFI_IFR_ORDERED_LIST_OP 0x23
+#define EFI_IFR_VARSTORE_OP 0x24
+#define EFI_IFR_VARSTORE_NAME_VALUE_OP 0x25
+#define EFI_IFR_VARSTORE_EFI_OP 0x26
+#define EFI_IFR_VARSTORE_DEVICE_OP 0x27
+#define EFI_IFR_VERSION_OP 0x28
+#define EFI_IFR_END_OP 0x29
+#define EFI_IFR_MATCH_OP 0x2A
+#define EFI_IFR_GET_OP 0x2B
+#define EFI_IFR_SET_OP 0x2C
+#define EFI_IFR_READ_OP 0x2D
+#define EFI_IFR_WRITE_OP 0x2E
+#define EFI_IFR_EQUAL_OP 0x2F
+#define EFI_IFR_NOT_EQUAL_OP 0x30
+#define EFI_IFR_GREATER_THAN_OP 0x31
+#define EFI_IFR_GREATER_EQUAL_OP 0x32
+#define EFI_IFR_LESS_THAN_OP 0x33
+#define EFI_IFR_LESS_EQUAL_OP 0x34
+#define EFI_IFR_BITWISE_AND_OP 0x35
+#define EFI_IFR_BITWISE_OR_OP 0x36
+#define EFI_IFR_BITWISE_NOT_OP 0x37
+#define EFI_IFR_SHIFT_LEFT_OP 0x38
+#define EFI_IFR_SHIFT_RIGHT_OP 0x39
+#define EFI_IFR_ADD_OP 0x3A
+#define EFI_IFR_SUBTRACT_OP 0x3B
+#define EFI_IFR_MULTIPLY_OP 0x3C
+#define EFI_IFR_DIVIDE_OP 0x3D
+#define EFI_IFR_MODULO_OP 0x3E
+#define EFI_IFR_RULE_REF_OP 0x3F
+#define EFI_IFR_QUESTION_REF1_OP 0x40
+#define EFI_IFR_QUESTION_REF2_OP 0x41
+#define EFI_IFR_UINT8_OP 0x42
+#define EFI_IFR_UINT16_OP 0x43
+#define EFI_IFR_UINT32_OP 0x44
+#define EFI_IFR_UINT64_OP 0x45
+#define EFI_IFR_TRUE_OP 0x46
+#define EFI_IFR_FALSE_OP 0x47
+#define EFI_IFR_TO_UINT_OP 0x48
+#define EFI_IFR_TO_STRING_OP 0x49
+#define EFI_IFR_TO_BOOLEAN_OP 0x4A
+#define EFI_IFR_MID_OP 0x4B
+#define EFI_IFR_FIND_OP 0x4C
+#define EFI_IFR_TOKEN_OP 0x4D
+#define EFI_IFR_STRING_REF1_OP 0x4E
+#define EFI_IFR_STRING_REF2_OP 0x4F
+#define EFI_IFR_CONDITIONAL_OP 0x50
+#define EFI_IFR_QUESTION_REF3_OP 0x51
+#define EFI_IFR_ZERO_OP 0x52
+#define EFI_IFR_ONE_OP 0x53
+#define EFI_IFR_ONES_OP 0x54
+#define EFI_IFR_UNDEFINED_OP 0x55
+#define EFI_IFR_LENGTH_OP 0x56
+#define EFI_IFR_DUP_OP 0x57
+#define EFI_IFR_THIS_OP 0x58
+#define EFI_IFR_SPAN_OP 0x59
+#define EFI_IFR_VALUE_OP 0x5A
+#define EFI_IFR_DEFAULT_OP 0x5B
+#define EFI_IFR_DEFAULTSTORE_OP 0x5C
+#define EFI_IFR_FORM_MAP_OP 0x5D
+#define EFI_IFR_CATENATE_OP 0x5E
+#define EFI_IFR_GUID_OP 0x5F
+#define EFI_IFR_SECURITY_OP 0x60
+#define EFI_IFR_MODAL_TAG_OP 0x61
+#define EFI_IFR_REFRESH_ID_OP 0x62
+#define EFI_IFR_WARNING_IF_OP 0x63
+#define EFI_IFR_MATCH2_OP 0x64
+
+
+typedef struct _EFI_IFR_OP_HEADER {
+ UINT8 OpCode;
+ UINT8 Length:7;
+ UINT8 Scope:1;
+} EFI_IFR_OP_HEADER;
+
+typedef struct _EFI_IFR_STATEMENT_HEADER {
+ EFI_STRING_ID Prompt;
+ EFI_STRING_ID Help;
+} EFI_IFR_STATEMENT_HEADER;
+
+typedef struct _EFI_IFR_QUESTION_HEADER {
+ EFI_IFR_STATEMENT_HEADER Header;
+ EFI_QUESTION_ID QuestionId;
+ EFI_VARSTORE_ID VarStoreId;
+ union {
+ EFI_STRING_ID VarName;
+ UINT16 VarOffset;
+ } VarStoreInfo;
+ UINT8 Flags;
+} EFI_IFR_QUESTION_HEADER;
+
+#define EFI_IFR_FLAG_READ_ONLY 0x01
+#define EFI_IFR_FLAG_CALLBACK 0x04
+#define EFI_IFR_FLAG_RESET_REQUIRED 0x10
+#define EFI_IFR_FLAG_REST_STYLE 0x20
+#define EFI_IFR_FLAG_RECONNECT_REQUIRED 0x40
+#define EFI_IFR_FLAG_OPTIONS_ONLY 0x80
+
+typedef struct _EFI_IFR_DEFAULTSTORE {
+ EFI_IFR_OP_HEADER Header;
+ EFI_STRING_ID DefaultName;
+ UINT16 DefaultId;
+} EFI_IFR_DEFAULTSTORE;
+
+#define EFI_HII_DEFAULT_CLASS_STANDARD 0x0000
+#define EFI_HII_DEFAULT_CLASS_MANUFACTURING 0x0001
+#define EFI_HII_DEFAULT_CLASS_SAFE 0x0002
+#define EFI_HII_DEFAULT_CLASS_PLATFORM_BEGIN 0x4000
+#define EFI_HII_DEFAULT_CLASS_PLATFORM_END 0x7fff
+#define EFI_HII_DEFAULT_CLASS_HARDWARE_BEGIN 0x8000
+#define EFI_HII_DEFAULT_CLASS_HARDWARE_END 0xbfff
+#define EFI_HII_DEFAULT_CLASS_FIRMWARE_BEGIN 0xc000
+#define EFI_HII_DEFAULT_CLASS_FIRMWARE_END 0xffff
+
+typedef struct _EFI_IFR_VARSTORE {
+ EFI_IFR_OP_HEADER Header;
+ EFI_GUID Guid;
+ EFI_VARSTORE_ID VarStoreId;
+ UINT16 Size;
+ UINT8 Name[1];
+} EFI_IFR_VARSTORE;
+
+typedef struct _EFI_IFR_VARSTORE_EFI {
+ EFI_IFR_OP_HEADER Header;
+ EFI_VARSTORE_ID VarStoreId;
+ EFI_GUID Guid;
+ UINT32 Attributes;
+ UINT16 Size;
+ UINT8 Name[1];
+} EFI_IFR_VARSTORE_EFI;
+
+typedef struct _EFI_IFR_VARSTORE_NAME_VALUE {
+ EFI_IFR_OP_HEADER Header;
+ EFI_VARSTORE_ID VarStoreId;
+ EFI_GUID Guid;
+} EFI_IFR_VARSTORE_NAME_VALUE;
+
+typedef struct _EFI_IFR_FORM_SET {
+ EFI_IFR_OP_HEADER Header;
+ EFI_GUID Guid;
+ EFI_STRING_ID FormSetTitle;
+ EFI_STRING_ID Help;
+ UINT8 Flags;
+ // EFI_GUID ClassGuid[];
+} EFI_IFR_FORM_SET;
+
+typedef struct _EFI_IFR_END {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_END;
+
+typedef struct _EFI_IFR_FORM {
+ EFI_IFR_OP_HEADER Header;
+ UINT16 FormId;
+ EFI_STRING_ID FormTitle;
+} EFI_IFR_FORM;
+
+typedef struct _EFI_IFR_IMAGE {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IMAGE_ID Id;
+} EFI_IFR_IMAGE;
+
+typedef struct _EFI_IFR_MODAL_TAG {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_MODAL_TAG;
+
+typedef struct _EFI_IFR_LOCKED {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_LOCKED;
+
+typedef struct _EFI_IFR_RULE {
+ EFI_IFR_OP_HEADER Header;
+ UINT8 RuleId;
+} EFI_IFR_RULE;
+
+typedef struct _EFI_IFR_DEFAULT {
+ EFI_IFR_OP_HEADER Header;
+ UINT16 DefaultId;
+ UINT8 Type;
+ EFI_IFR_TYPE_VALUE Value;
+} EFI_IFR_DEFAULT;
+
+typedef struct _EFI_IFR_DEFAULT_2 {
+ EFI_IFR_OP_HEADER Header;
+ UINT16 DefaultId;
+ UINT8 Type;
+} EFI_IFR_DEFAULT_2;
+
+typedef struct _EFI_IFR_VALUE {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_VALUE;
+
+typedef struct _EFI_IFR_SUBTITLE {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_STATEMENT_HEADER Statement;
+ UINT8 Flags;
+} EFI_IFR_SUBTITLE;
+
+#define EFI_IFR_FLAGS_HORIZONTAL 0x01
+
+typedef struct _EFI_IFR_CHECKBOX {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+ UINT8 Flags;
+} EFI_IFR_CHECKBOX;
+
+#define EFI_IFR_CHECKBOX_DEFAULT 0x01
+#define EFI_IFR_CHECKBOX_DEFAULT_MFG 0x02
+
+typedef struct _EFI_IFR_TEXT {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_STATEMENT_HEADER Statement;
+ EFI_STRING_ID TextTwo;
+} EFI_IFR_TEXT;
+
+typedef struct _EFI_IFR_REF {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+ EFI_FORM_ID FormId;
+} EFI_IFR_REF;
+
+typedef struct _EFI_IFR_REF2 {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+ EFI_FORM_ID FormId;
+ EFI_QUESTION_ID QuestionId;
+} EFI_IFR_REF2;
+
+typedef struct _EFI_IFR_REF3 {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+ EFI_FORM_ID FormId;
+ EFI_QUESTION_ID QuestionId;
+ EFI_GUID FormSetId;
+} EFI_IFR_REF3;
+
+typedef struct _EFI_IFR_REF4 {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+ EFI_FORM_ID FormId;
+ EFI_QUESTION_ID QuestionId;
+ EFI_GUID FormSetId;
+ EFI_STRING_ID DevicePath;
+} EFI_IFR_REF4;
+
+typedef struct _EFI_IFR_REF5 {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+} EFI_IFR_REF5;
+
+typedef struct _EFI_IFR_RESET_BUTTON {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_STATEMENT_HEADER Statement;
+ EFI_DEFAULT_ID DefaultId;
+} EFI_IFR_RESET_BUTTON;
+
+typedef struct _EFI_IFR_ACTION {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+ EFI_STRING_ID QuestionConfig;
+} EFI_IFR_ACTION;
+
+typedef struct _EFI_IFR_ACTION_1 {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+} EFI_IFR_ACTION_1;
+
+typedef struct _EFI_IFR_DATE {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+ UINT8 Flags;
+} EFI_IFR_DATE;
+
+#define EFI_QF_DATE_YEAR_SUPPRESS 0x01
+#define EFI_QF_DATE_MONTH_SUPPRESS 0x02
+#define EFI_QF_DATE_DAY_SUPPRESS 0x04
+
+#define EFI_QF_DATE_STORAGE 0x30
+#define QF_DATE_STORAGE_NORMAL 0x00
+#define QF_DATE_STORAGE_TIME 0x10
+#define QF_DATE_STORAGE_WAKEUP 0x20
+
+typedef union {
+ struct {
+ UINT8 MinValue;
+ UINT8 MaxValue;
+ UINT8 Step;
+ } u8;
+ struct {
+ UINT16 MinValue;
+ UINT16 MaxValue;
+ UINT16 Step;
+ } u16;
+ struct {
+ UINT32 MinValue;
+ UINT32 MaxValue;
+ UINT32 Step;
+ } u32;
+ struct {
+ UINT64 MinValue;
+ UINT64 MaxValue;
+ UINT64 Step;
+ } u64;
+} MINMAXSTEP_DATA;
+
+typedef struct _EFI_IFR_NUMERIC {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+ UINT8 Flags;
+ MINMAXSTEP_DATA data;
+} EFI_IFR_NUMERIC;
+
+#define EFI_IFR_NUMERIC_SIZE 0x03
+#define EFI_IFR_NUMERIC_SIZE_1 0x00
+#define EFI_IFR_NUMERIC_SIZE_2 0x01
+#define EFI_IFR_NUMERIC_SIZE_4 0x02
+#define EFI_IFR_NUMERIC_SIZE_8 0x03
+
+#define EFI_IFR_DISPLAY 0x30
+#define EFI_IFR_DISPLAY_INT_DEC 0x00
+#define EFI_IFR_DISPLAY_UINT_DEC 0x10
+#define EFI_IFR_DISPLAY_UINT_HEX 0x20
+
+typedef struct _EFI_IFR_ONE_OF {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+ UINT8 Flags;
+ MINMAXSTEP_DATA data;
+} EFI_IFR_ONE_OF;
+
+typedef struct _EFI_IFR_STRING {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+ UINT8 MinSize;
+ UINT8 MaxSize;
+ UINT8 Flags;
+} EFI_IFR_STRING;
+
+#define EFI_IFR_STRING_MULTI_LINE 0x01
+
+typedef struct _EFI_IFR_PASSWORD {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+ UINT16 MinSize;
+ UINT16 MaxSize;
+} EFI_IFR_PASSWORD;
+
+typedef struct _EFI_IFR_ORDERED_LIST {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+ UINT8 MaxContainers;
+ UINT8 Flags;
+} EFI_IFR_ORDERED_LIST;
+
+#define EFI_IFR_UNIQUE_SET 0x01
+#define EFI_IFR_NO_EMPTY_SET 0x02
+
+typedef struct _EFI_IFR_TIME {
+ EFI_IFR_OP_HEADER Header;
+ EFI_IFR_QUESTION_HEADER Question;
+ UINT8 Flags;
+} EFI_IFR_TIME;
+
+#define QF_TIME_HOUR_SUPPRESS 0x01
+#define QF_TIME_MINUTE_SUPPRESS 0x02
+#define QF_TIME_SECOND_SUPPRESS 0x04
+
+#define QF_TIME_STORAGE 0x30
+#define QF_TIME_STORAGE_NORMAL 0x00
+#define QF_TIME_STORAGE_TIME 0x10
+#define QF_TIME_STORAGE_WAKEUP 0x20
+
+typedef struct _EFI_IFR_DISABLE_IF {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_DISABLE_IF;
+
+typedef struct _EFI_IFR_SUPPRESS_IF {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_SUPPRESS_IF;
+
+typedef struct _EFI_IFR_GRAY_OUT_IF {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_GRAY_OUT_IF;
+
+typedef struct _EFI_IFR_INCONSISTENT_IF {
+ EFI_IFR_OP_HEADER Header;
+ EFI_STRING_ID Error;
+} EFI_IFR_INCONSISTENT_IF;
+
+typedef struct _EFI_IFR_NO_SUBMIT_IF {
+ EFI_IFR_OP_HEADER Header;
+ EFI_STRING_ID Error;
+} EFI_IFR_NO_SUBMIT_IF;
+
+typedef struct _EFI_IFR_WARNING_IF {
+ EFI_IFR_OP_HEADER Header;
+ EFI_STRING_ID Warning;
+ UINT8 TimeOut;
+} EFI_IFR_WARNING_IF;
+
+typedef struct _EFI_IFR_REFRESH {
+ EFI_IFR_OP_HEADER Header;
+ UINT8 RefreshInterval;
+} EFI_IFR_REFRESH;
+
+typedef struct _EFI_IFR_REFRESH_ID {
+ EFI_IFR_OP_HEADER Header;
+ EFI_GUID RefreshEventGroupId;
+} EFI_IFR_REFRESH_ID;
+
+typedef struct _EFI_IFR_VARSTORE_DEVICE {
+ EFI_IFR_OP_HEADER Header;
+ EFI_STRING_ID DevicePath;
+} EFI_IFR_VARSTORE_DEVICE;
+
+typedef struct _EFI_IFR_ONE_OF_OPTION {
+ EFI_IFR_OP_HEADER Header;
+ EFI_STRING_ID Option;
+ UINT8 Flags;
+ UINT8 Type;
+ EFI_IFR_TYPE_VALUE Value;
+} EFI_IFR_ONE_OF_OPTION;
+
+#define EFI_IFR_TYPE_NUM_SIZE_8 0x00
+#define EFI_IFR_TYPE_NUM_SIZE_16 0x01
+#define EFI_IFR_TYPE_NUM_SIZE_32 0x02
+#define EFI_IFR_TYPE_NUM_SIZE_64 0x03
+#define EFI_IFR_TYPE_BOOLEAN 0x04
+#define EFI_IFR_TYPE_TIME 0x05
+#define EFI_IFR_TYPE_DATE 0x06
+#define EFI_IFR_TYPE_STRING 0x07
+#define EFI_IFR_TYPE_OTHER 0x08
+#define EFI_IFR_TYPE_UNDEFINED 0x09
+#define EFI_IFR_TYPE_ACTION 0x0A
+#define EFI_IFR_TYPE_BUFFER 0x0B
+#define EFI_IFR_TYPE_REF 0x0C
+
+#define EFI_IFR_OPTION_DEFAULT 0x10
+#define EFI_IFR_OPTION_DEFAULT_MFG 0x20
+
+typedef struct _EFI_IFR_GUID {
+ EFI_IFR_OP_HEADER Header;
+ EFI_GUID Guid;
+ //Optional Data Follows
+} EFI_IFR_GUID;
+
+typedef struct _EFI_IFR_DUP {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_DUP;
+
+typedef struct _EFI_IFR_EQ_ID_ID {
+ EFI_IFR_OP_HEADER Header;
+ EFI_QUESTION_ID QuestionId1;
+ EFI_QUESTION_ID QuestionId2;
+} EFI_IFR_EQ_ID_ID;
+
+typedef struct _EFI_IFR_EQ_ID_VAL {
+ EFI_IFR_OP_HEADER Header;
+ EFI_QUESTION_ID QuestionId;
+ UINT16 Value;
+} EFI_IFR_EQ_ID_VAL;
+
+typedef struct _EFI_IFR_EQ_ID_VAL_LIST {
+ EFI_IFR_OP_HEADER Header;
+ EFI_QUESTION_ID QuestionId;
+ UINT16 ListLength;
+ UINT16 ValueList[1];
+} EFI_IFR_EQ_ID_VAL_LIST;
+
+typedef struct _EFI_IFR_QUESTION_REF1 {
+ EFI_IFR_OP_HEADER Header;
+ EFI_QUESTION_ID QuestionId;
+} EFI_IFR_QUESTION_REF1;
+
+typedef struct _EFI_IFR_UINT8 {
+ EFI_IFR_OP_HEADER Header;
+ UINT8 Value;
+} EFI_IFR_UINT8;
+
+typedef struct _EFI_IFR_UINT16 {
+ EFI_IFR_OP_HEADER Header;
+ UINT16 Value;
+} EFI_IFR_UINT16;
+
+typedef struct _EFI_IFR_QUESTION_REF2 {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_QUESTION_REF2;
+
+typedef struct _EFI_IFR_UINT32 {
+ EFI_IFR_OP_HEADER Header;
+ UINT32 Value;
+} EFI_IFR_UINT32;
+
+typedef struct _EFI_IFR_UINT64 {
+ EFI_IFR_OP_HEADER Header;
+ UINT64 Value;
+} EFI_IFR_UINT64;
+
+typedef struct _EFI_IFR_QUESTION_REF3 {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_QUESTION_REF3;
+
+typedef struct _EFI_IFR_QUESTION_REF3_2 {
+ EFI_IFR_OP_HEADER Header;
+ EFI_STRING_ID DevicePath;
+} EFI_IFR_QUESTION_REF3_2;
+
+typedef struct _EFI_IFR_QUESTION_REF3_3 {
+ EFI_IFR_OP_HEADER Header;
+ EFI_STRING_ID DevicePath;
+ EFI_GUID Guid;
+} EFI_IFR_QUESTION_REF3_3;
+
+typedef struct _EFI_IFR_RULE_REF {
+ EFI_IFR_OP_HEADER Header;
+ UINT8 RuleId;
+} EFI_IFR_RULE_REF;
+
+typedef struct _EFI_IFR_STRING_REF1 {
+ EFI_IFR_OP_HEADER Header;
+ EFI_STRING_ID StringId;
+} EFI_IFR_STRING_REF1;
+
+typedef struct _EFI_IFR_STRING_REF2 {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_STRING_REF2;
+
+typedef struct _EFI_IFR_THIS {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_THIS;
+
+typedef struct _EFI_IFR_TRUE {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_TRUE;
+
+typedef struct _EFI_IFR_FALSE {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_FALSE;
+
+typedef struct _EFI_IFR_ONE {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_ONE;
+
+typedef struct _EFI_IFR_ONES {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_ONES;
+
+typedef struct _EFI_IFR_ZERO {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_ZERO;
+
+typedef struct _EFI_IFR_UNDEFINED {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_UNDEFINED;
+
+typedef struct _EFI_IFR_VERSION {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_VERSION;
+
+typedef struct _EFI_IFR_LENGTH {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_LENGTH;
+
+typedef struct _EFI_IFR_NOT {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_NOT;
+
+typedef struct _EFI_IFR_BITWISE_NOT {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_BITWISE_NOT;
+
+typedef struct _EFI_IFR_TO_BOOLEAN {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_TO_BOOLEAN;
+
+#define EFI_IFR_STRING_UNSIGNED_DEC 0
+#define EFI_IFR_STRING_SIGNED_DEC 1
+#define EFI_IFR_STRING_LOWERCASE_HEX 2
+#define EFI_IFR_STRING_UPPERCASE_HEX 3
+
+#define EFI_IFR_STRING_ASCII 0
+#define EFI_IFR_STRING_UNICODE 8
+
+typedef struct _EFI_IFR_TO_STRING {
+ EFI_IFR_OP_HEADER Header;
+ UINT8 Format;
+} EFI_IFR_TO_STRING;
+
+typedef struct _EFI_IFR_TO_UINT {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_TO_UINT;
+
+typedef struct _EFI_IFR_TO_UPPER {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_TO_UPPER;
+
+typedef struct _EFI_IFR_TO_LOWER {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_TO_LOWER;
+
+typedef struct _EFI_IFR_ADD {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_ADD;
+
+typedef struct _EFI_IFR_AND {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_AND;
+
+typedef struct _EFI_IFR_BITWISE_AND {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_BITWISE_AND;
+
+typedef struct _EFI_IFR_BITWISE_OR {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_BITWISE_OR;
+
+typedef struct _EFI_IFR_CATENATE {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_CATENATE;
+
+typedef struct _EFI_IFR_DIVIDE {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_DIVIDE;
+
+typedef struct _EFI_IFR_EQUAL {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_EQUAL;
+
+typedef struct _EFI_IFR_GREATER_EQUAL {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_GREATER_EQUAL;
+
+typedef struct _EFI_IFR_GREATER_THAN {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_GREATER_THAN;
+
+typedef struct _EFI_IFR_LESS_EQUAL {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_LESS_EQUAL;
+
+typedef struct _EFI_IFR_LESS_THAN {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_LESS_THAN;
+
+typedef struct _EFI_IFR_MATCH {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_MATCH;
+
+typedef struct _EFI_IFR_MATCH2 {
+ EFI_IFR_OP_HEADER Header;
+ EFI_GUID SyntaxType;
+} EFI_IFR_MATCH2;
+
+typedef struct _EFI_IFR_MULTIPLY {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_MULTIPLY;
+
+typedef struct _EFI_IFR_MODULO {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_MODULO;
+
+typedef struct _EFI_IFR_NOT_EQUAL {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_NOT_EQUAL;
+
+typedef struct _EFI_IFR_OR {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_OR;
+
+typedef struct _EFI_IFR_SHIFT_LEFT {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_SHIFT_LEFT;
+
+typedef struct _EFI_IFR_SHIFT_RIGHT {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_SHIFT_RIGHT;
+
+typedef struct _EFI_IFR_SUBTRACT {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_SUBTRACT;
+
+typedef struct _EFI_IFR_CONDITIONAL {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_CONDITIONAL;
+
+#define EFI_IFR_FF_CASE_SENSITIVE 0x00
+#define EFI_IFR_FF_CASE_INSENSITIVE 0x01
+
+typedef struct _EFI_IFR_FIND {
+ EFI_IFR_OP_HEADER Header;
+ UINT8 Format;
+} EFI_IFR_FIND;
+
+typedef struct _EFI_IFR_MID {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_MID;
+
+typedef struct _EFI_IFR_TOKEN {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_TOKEN;
+
+#define EFI_IFR_FLAGS_FIRST_MATCHING 0x00
+#define EFI_IFR_FLAGS_FIRST_NON_MATCHING 0x01
+
+typedef struct _EFI_IFR_SPAN {
+ EFI_IFR_OP_HEADER Header;
+ UINT8 Flags;
+} EFI_IFR_SPAN;
+
+typedef struct _EFI_IFR_SECURITY {
+ ///
+ /// Standard opcode header, where Header.Op = EFI_IFR_SECURITY_OP.
+ ///
+ EFI_IFR_OP_HEADER Header;
+ ///
+ /// Security permission level.
+ ///
+ EFI_GUID Permissions;
+} EFI_IFR_SECURITY;
+
+typedef struct _EFI_IFR_FORM_MAP_METHOD {
+ ///
+ /// The string identifier which provides the human-readable name of
+ /// the configuration method for this standards map form.
+ ///
+ EFI_STRING_ID MethodTitle;
+ ///
+ /// Identifier which uniquely specifies the configuration methods
+ /// associated with this standards map form.
+ ///
+ EFI_GUID MethodIdentifier;
+} EFI_IFR_FORM_MAP_METHOD;
+
+typedef struct _EFI_IFR_FORM_MAP {
+ ///
+ /// The sequence that defines the type of opcode as well as the length
+ /// of the opcode being defined. Header.OpCode = EFI_IFR_FORM_MAP_OP.
+ ///
+ EFI_IFR_OP_HEADER Header;
+ ///
+ /// The unique identifier for this particular form.
+ ///
+ EFI_FORM_ID FormId;
+ ///
+ /// One or more configuration method's name and unique identifier.
+ ///
+ // EFI_IFR_FORM_MAP_METHOD Methods[];
+} EFI_IFR_FORM_MAP;
+
+typedef struct _EFI_IFR_SET {
+ ///
+ /// The sequence that defines the type of opcode as well as the length
+ /// of the opcode being defined. Header.OpCode = EFI_IFR_SET_OP.
+ ///
+ EFI_IFR_OP_HEADER Header;
+ ///
+ /// Specifies the identifier of a previously declared variable store to
+ /// use when storing the question's value.
+ ///
+ EFI_VARSTORE_ID VarStoreId;
+ union {
+ ///
+ /// A 16-bit Buffer Storage offset.
+ ///
+ EFI_STRING_ID VarName;
+ ///
+ /// A Name Value or EFI Variable name (VarName).
+ ///
+ UINT16 VarOffset;
+ } VarStoreInfo;
+ ///
+ /// Specifies the type used for storage.
+ ///
+ UINT8 VarStoreType;
+} EFI_IFR_SET;
+
+typedef struct _EFI_IFR_GET {
+ ///
+ /// The sequence that defines the type of opcode as well as the length
+ /// of the opcode being defined. Header.OpCode = EFI_IFR_GET_OP.
+ ///
+ EFI_IFR_OP_HEADER Header;
+ ///
+ /// Specifies the identifier of a previously declared variable store to
+ /// use when retrieving the value.
+ ///
+ EFI_VARSTORE_ID VarStoreId;
+ union {
+ ///
+ /// A 16-bit Buffer Storage offset.
+ ///
+ EFI_STRING_ID VarName;
+ ///
+ /// A Name Value or EFI Variable name (VarName).
+ ///
+ UINT16 VarOffset;
+ } VarStoreInfo;
+ ///
+ /// Specifies the type used for storage.
+ ///
+ UINT8 VarStoreType;
+} EFI_IFR_GET;
+
+typedef struct _EFI_IFR_READ {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_READ;
+
+typedef struct _EFI_IFR_WRITE {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_WRITE;
+
+typedef struct _EFI_IFR_MAP {
+ EFI_IFR_OP_HEADER Header;
+} EFI_IFR_MAP;
+//
+// Keyboard Package
+//
+
+typedef enum {
+ EfiKeyLCtrl,
+ EfiKeyA0,
+ EfiKeyLAlt,
+ EfiKeySpaceBar,
+ EfiKeyA2,
+ EfiKeyA3,
+ EfiKeyA4,
+ EfiKeyRCtrl,
+ EfiKeyLeftArrow,
+ EfiKeyDownArrow,
+ EfiKeyRightArrow,
+ EfiKeyZero,
+ EfiKeyPeriod,
+ EfiKeyEnter,
+ EfiKeyLShift,
+ EfiKeyB0,
+ EfiKeyB1,
+ EfiKeyB2,
+ EfiKeyB3,
+ EfiKeyB4,
+ EfiKeyB5,
+ EfiKeyB6,
+ EfiKeyB7,
+ EfiKeyB8,
+ EfiKeyB9,
+ EfiKeyB10,
+ EfiKeyRshift,
+ EfiKeyUpArrow,
+ EfiKeyOne,
+ EfiKeyTwo,
+ EfiKeyThree,
+ EfiKeyCapsLock,
+ EfiKeyC1,
+ EfiKeyC2,
+ EfiKeyC3,
+ EfiKeyC4,
+ EfiKeyC5,
+ EfiKeyC6,
+ EfiKeyC7,
+ EfiKeyC8,
+ EfiKeyC9,
+ EfiKeyC10,
+ EfiKeyC11,
+ EfiKeyC12,
+ EfiKeyFour,
+ EfiKeyFive,
+ EfiKeySix,
+ EfiKeyPlus,
+ EfiKeyTab,
+ EfiKeyD1,
+ EfiKeyD2,
+ EfiKeyD3,
+ EfiKeyD4,
+ EfiKeyD5,
+ EfiKeyD6,
+ EfiKeyD7,
+ EfiKeyD8,
+ EfiKeyD9,
+ EfiKeyD10,
+ EfiKeyD11,
+ EfiKeyD12,
+ EfiKeyD13,
+ EfiKeyDel,
+ EfiKeyEnd,
+ EfiKeyPgDn,
+ EfiKeySeven,
+ EfiKeyEight,
+ EfiKeyNine,
+ EfiKeyE0,
+ EfiKeyE1,
+ EfiKeyE2,
+ EfiKeyE3,
+ EfiKeyE4,
+ EfiKeyE5,
+ EfiKeyE6,
+ EfiKeyE7,
+ EfiKeyE8,
+ EfiKeyE9,
+ EfiKeyE10,
+ EfiKeyE11,
+ EfiKeyE12,
+ EfiKeyBackSpace,
+ EfiKeyIns,
+ EfiKeyHome,
+ EfiKeyPgUp,
+ EfiKeyNLck,
+ EfiKeySlash,
+ EfiKeyAsterisk,
+ EfiKeyMinus,
+ EfiKeyEsc,
+ EfiKeyF1,
+ EfiKeyF2,
+ EfiKeyF3,
+ EfiKeyF4,
+ EfiKeyF5,
+ EfiKeyF6,
+ EfiKeyF7,
+ EfiKeyF8,
+ EfiKeyF9,
+ EfiKeyF10,
+ EfiKeyF11,
+ EfiKeyF12,
+ EfiKeyPrint,
+ EfiKeySLck,
+ EfiKeyPause
+} EFI_KEY;
+
+typedef struct {
+ EFI_KEY Key;
+ CHAR16 Unicode;
+ CHAR16 ShiftedUnicode;
+ CHAR16 AltGrUnicode;
+ CHAR16 ShiftedAltGrUnicode;
+ UINT16 Modifier;
+ UINT16 AffectedAttribute;
+} EFI_KEY_DESCRIPTOR;
+
+//
+// A key which is affected by all the standard shift modifiers.
+// Most keys would be expected to have this bit active.
+//
+#define EFI_AFFECTED_BY_STANDARD_SHIFT 0x0001
+//
+// This key is affected by the caps lock so that if a keyboard driver
+// would need to disambiguate between a key which had a "1" defined
+// versus a "a" character. Having this bit turned on would tell
+// the keyboard driver to use the appropriate shifted state or not.
+//
+#define EFI_AFFECTED_BY_CAPS_LOCK 0x0002
+//
+// Similar to the case of CAPS lock, if this bit is active, the key
+// is affected by the num lock being turned on.
+//
+#define EFI_AFFECTED_BY_NUM_LOCK 0x0004
+
+typedef struct {
+ UINT16 LayoutLength;
+ EFI_GUID Guid;
+ UINT32 LayoutDescriptorStringOffset;
+ UINT8 DescriptorCount;
+ // EFI_KEY_DESCRIPTOR Descriptors[];
+} EFI_HII_KEYBOARD_LAYOUT;
+
+typedef struct {
+ EFI_HII_PACKAGE_HEADER Header;
+ UINT16 LayoutCount;
+ // EFI_HII_KEYBOARD_LAYOUT Layout[];
+} EFI_HII_KEYBOARD_PACKAGE_HDR;
+
+typedef struct {
+ CHAR16 Language[3];
+ CHAR16 Space;
+ CHAR16 DescriptionString[1];
+} EFI_DESCRIPTION_STRING;
+
+typedef struct {
+ UINT16 DescriptionCount;
+ EFI_DESCRIPTION_STRING DescriptionString[1];
+} EFI_DESCRIPTION_STRING_BUNDLE;
+
+//
+// Modifier values
+//
+#define EFI_NULL_MODIFIER 0x0000
+#define EFI_LEFT_CONTROL_MODIFIER 0x0001
+#define EFI_RIGHT_CONTROL_MODIFIER 0x0002
+#define EFI_LEFT_ALT_MODIFIER 0x0003
+#define EFI_RIGHT_ALT_MODIFIER 0x0004
+#define EFI_ALT_GR_MODIFIER 0x0005
+#define EFI_INSERT_MODIFIER 0x0006
+#define EFI_DELETE_MODIFIER 0x0007
+#define EFI_PAGE_DOWN_MODIFIER 0x0008
+#define EFI_PAGE_UP_MODIFIER 0x0009
+#define EFI_HOME_MODIFIER 0x000A
+#define EFI_END_MODIFIER 0x000B
+#define EFI_LEFT_SHIFT_MODIFIER 0x000C
+#define EFI_RIGHT_SHIFT_MODIFIER 0x000D
+#define EFI_CAPS_LOCK_MODIFIER 0x000E
+#define EFI_NUM_LOCK _MODIFIER 0x000F
+#define EFI_LEFT_ARROW_MODIFIER 0x0010
+#define EFI_RIGHT_ARROW_MODIFIER 0x0011
+#define EFI_DOWN_ARROW_MODIFIER 0x0012
+#define EFI_UP_ARROW_MODIFIER 0x0013
+#define EFI_NS_KEY_MODIFIER 0x0014
+#define EFI_NS_KEY_DEPENDENCY_MODIFIER 0x0015
+#define EFI_FUNCTION_KEY_ONE_MODIFIER 0x0016
+#define EFI_FUNCTION_KEY_TWO_MODIFIER 0x0017
+#define EFI_FUNCTION_KEY_THREE_MODIFIER 0x0018
+#define EFI_FUNCTION_KEY_FOUR_MODIFIER 0x0019
+#define EFI_FUNCTION_KEY_FIVE_MODIFIER 0x001A
+#define EFI_FUNCTION_KEY_SIX_MODIFIER 0x001B
+#define EFI_FUNCTION_KEY_SEVEN_MODIFIER 0x001C
+#define EFI_FUNCTION_KEY_EIGHT_MODIFIER 0x001D
+#define EFI_FUNCTION_KEY_NINE_MODIFIER 0x001E
+#define EFI_FUNCTION_KEY_TEN_MODIFIER 0x001F
+#define EFI_FUNCTION_KEY_ELEVEN_MODIFIER 0x0020
+#define EFI_FUNCTION_KEY_TWELVE_MODIFIER 0x0021
+
+//
+// Keys that have multiple control functions based on modifier
+// settings are handled in the keyboard driver implementation.
+// For instance PRINT_KEY might have a modifier held down and
+// is still a nonprinting character, but might have an alternate
+// control function like SYSREQUEST
+//
+#define EFI_PRINT_MODIFIER 0x0022
+#define EFI_SYS_REQUEST_MODIFIER 0x0023
+#define EFI_SCROLL_LOCK_MODIFIER 0x0024
+#define EFI_PAUSE_MODIFIER 0x0025
+#define EFI_BREAK_MODIFIER 0x0026
+
+#pragma pack()
+
+
+
+//
+// References to string tokens must use this macro to enable scanning for
+// token usages.
+//
+//
+// STRING_TOKEN is not defined in UEFI specification. But it is placed
+// here for the easy access by C files and VFR source files.
+//
+#define STRING_TOKEN(t) t
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Common/UefiMultiPhase.h b/roms/edk2/BaseTools/Source/C/Include/Common/UefiMultiPhase.h
new file mode 100644
index 000000000..b889508b8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Common/UefiMultiPhase.h
@@ -0,0 +1,226 @@
+/** @file
+ This includes some definitions introduced in UEFI that will be used in both PEI
+ and DXE phases.
+
+ (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __UEFI_MULTIPHASE_H__
+#define __UEFI_MULTIPHASE_H__
+
+//
+// Enumeration of memory types introduced in UEFI.
+//
+typedef enum {
+ EfiReservedMemoryType,
+ EfiLoaderCode,
+ EfiLoaderData,
+ EfiBootServicesCode,
+ EfiBootServicesData,
+ EfiRuntimeServicesCode,
+ EfiRuntimeServicesData,
+ EfiConventionalMemory,
+ EfiUnusableMemory,
+ EfiACPIReclaimMemory,
+ EfiACPIMemoryNVS,
+ EfiMemoryMappedIO,
+ EfiMemoryMappedIOPortSpace,
+ EfiPalCode,
+ EfiPersistentMemory,
+ EfiMaxMemoryType
+} EFI_MEMORY_TYPE;
+
+
+//
+// Data structure that precedes all of the standard EFI table types.
+//
+typedef struct {
+ UINT64 Signature;
+ UINT32 Revision;
+ UINT32 HeaderSize;
+ UINT32 CRC32;
+ UINT32 Reserved;
+} EFI_TABLE_HEADER;
+
+//
+// Attributes of variable.
+//
+#define EFI_VARIABLE_NON_VOLATILE 0x00000001
+#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
+#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
+#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008
+
+//
+// This attribute is identified by the mnemonic 'HR'
+// elsewhere in this specification.
+//
+#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010
+
+
+
+//
+// _WIN_CERTIFICATE.wCertificateType
+//
+#define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0
+#define WIN_CERT_TYPE_EFI_GUID 0x0EF1
+
+/**
+
+ The WIN_CERTIFICATE structure is part of the PE/COFF
+ specification and has the following definition:
+
+ @param dwLength The length of the entire certificate,
+ including the length of the header, in
+ bytes.
+
+ @param wRevision The revision level of the WIN_CERTIFICATE
+ structure. The current revision level is
+ 0x0200.
+
+ @param wCertificateType The certificate type. See
+ WIN_CERT_TYPE_xxx for the UEFI
+ certificate types. The UEFI
+ specification reserves the range of
+ certificate type values from 0x0EF0
+ to 0x0EFF.
+
+ @param bCertificate The actual certificate. The format of
+ the certificate depends on
+ wCertificateType. The format of the UEFI
+ certificates is defined below.
+
+
+**/
+typedef struct _WIN_CERTIFICATE {
+ UINT32 dwLength;
+ UINT16 wRevision;
+ UINT16 wCertificateType;
+ //UINT8 bCertificate[ANYSIZE_ARRAY];
+} WIN_CERTIFICATE;
+
+//
+// WIN_CERTIFICATE_UEFI_GUID.CertType
+//
+#define EFI_CERT_TYPE_RSA2048_SHA256_GUID \
+ {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }
+
+//
+// WIN_CERTIFICATE_UEFI_GUID.CertData
+//
+typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
+ EFI_GUID HashType;
+ UINT8 PublicKey[256];
+ UINT8 Signature[256];
+} EFI_CERT_BLOCK_RSA_2048_SHA256;
+
+
+/**
+
+ @param Hdr This is the standard WIN_CERTIFICATE header, where
+ wCertificateType is set to
+ WIN_CERT_TYPE_EFI_GUID.
+
+ @param CertType This is the unique id which determines the
+ format of the CertData. In this case, the
+ value is EFI_CERT_TYPE_RSA2048_SHA256_GUID.
+
+ @param CertData This is the certificate data. The format of
+ the data is determined by the CertType. In
+ this case the value is
+ EFI_CERT_BLOCK_RSA_2048_SHA256.
+
+ @param Information The WIN_CERTIFICATE_UEFI_GUID certificate
+ type allows new types of certificates to
+ be developed for driver authentication
+ without requiring a new certificate type.
+ The CertType defines the format of the
+ CertData, which length is defined by the
+ size of the certificate less the fixed
+ size of the WIN_CERTIFICATE_UEFI_GUID
+ structure.
+
+**/
+typedef struct _WIN_CERTIFICATE_UEFI_GUID {
+ WIN_CERTIFICATE Hdr;
+ EFI_GUID CertType;
+ UINT8 CertData[1];
+} WIN_CERTIFICATE_UEFI_GUID;
+
+
+/**
+
+ Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital
+ signature.
+
+ The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from
+ WIN_CERTIFICATE and encapsulate the information needed to
+ implement the RSASSA-PKCS1-v1_5 digital signature algorithm as
+ specified in RFC2437.
+
+ @param Hdr This is the standard WIN_CERTIFICATE header, where
+ wCertificateType is set to
+ WIN_CERT_TYPE_UEFI_PKCS1_15.
+
+ @param HashAlgorithm This is the hashing algorithm which was
+ performed on the UEFI executable when
+ creating the digital signature. It is
+ one of the enumerated values pre-defined
+ in Section 26.4.1. See
+ EFI_HASH_ALGORITHM_x.
+
+ @param Signature This is the actual digital signature. The
+ size of the signature is the same size as
+ the key (1024-bit key is 128 bytes) and can
+ be determined by subtracting the length of
+ the other parts of this header from the
+ total length of the certificate as found in
+ Hdr.dwLength.
+
+**/
+typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 {
+ WIN_CERTIFICATE Hdr;
+ EFI_GUID HashAlgorithm;
+ // UINT8 Signature[ANYSIZE_ARRAY];
+} WIN_CERTIFICATE_EFI_PKCS1_15;
+
+
+/**
+
+ AuthInfo is a WIN_CERTIFICATE using the wCertificateType
+ WIN_CERTIFICATE_UEFI_GUID and the CertType
+ EFI_CERT_TYPE_RSA2048_SHA256. If the attribute specifies
+ authenticated access, then the Data buffer should begin with an
+ authentication descriptor prior to the data payload and DataSize
+ should reflect the data.and descriptor size. The caller
+ shall digest the Monotonic Count value and the associated data
+ for the variable update using the SHA-256 1-way hash algorithm.
+ The ensuing the 32-byte digest will be signed using the private
+ key associated w/ the public/private 2048-bit RSA key-pair. The
+ WIN_CERTIFICATE shall be used to describe the signature of the
+ Variable data *Data. In addition, the signature will also
+ include the MonotonicCount value to guard against replay attacks
+
+ @param MonotonicCount Included in the signature of
+ AuthInfo.Used to ensure freshness/no
+ replay. Incremented during each
+ "Write" access.
+
+ @param AuthInfo Provides the authorization for the variable
+ access. It is a signature across the
+ variable data and the Monotonic Count
+ value. Caller uses Private key that is
+ associated with a public key that has been
+ provisioned via the key exchange.
+
+**/
+typedef struct {
+ UINT64 MonotonicCount;
+ WIN_CERTIFICATE_UEFI_GUID AuthInfo;
+} EFI_VARIABLE_AUTHENTICATION;
+
+#endif
+
diff --git a/roms/edk2/BaseTools/Source/C/Include/Common/VariableFormat.h b/roms/edk2/BaseTools/Source/C/Include/Common/VariableFormat.h
new file mode 100644
index 000000000..096db88bc
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Common/VariableFormat.h
@@ -0,0 +1,44 @@
+/**@file
+ Header file for EFI Variable Services.
+
+ Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __VARIABLE_FORMAT_H__
+#define __VARIABLE_FORMAT_H__
+
+#define VARIABLE_DATA 0x55AA
+
+//
+// Variable Store Header flags
+//
+#define VARIABLE_STORE_FORMATTED 0x5a
+#define VARIABLE_STORE_HEALTHY 0xfe
+
+#pragma pack(1)
+
+typedef struct {
+ EFI_GUID Signature;
+ UINT32 Size;
+ UINT8 Format;
+ UINT8 State;
+ UINT16 Reserved;
+ UINT32 Reserved1;
+} VARIABLE_STORE_HEADER;
+
+typedef struct {
+ UINT16 StartId;
+ UINT8 State;
+ UINT8 Reserved;
+ UINT32 Attributes;
+ UINT32 NameSize;
+ UINT32 DataSize;
+ EFI_GUID VendorGuid;
+} VARIABLE_HEADER;
+
+#pragma pack()
+
+#endif // _EFI_VARIABLE_H_
diff --git a/roms/edk2/BaseTools/Source/C/Include/Common/WorkingBlockHeader.h b/roms/edk2/BaseTools/Source/C/Include/Common/WorkingBlockHeader.h
new file mode 100644
index 000000000..a1b77dd3e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Common/WorkingBlockHeader.h
@@ -0,0 +1,35 @@
+/** @file
+ Defines data structure that is the headers found at the runtime
+ updatable firmware volumes, such as the FileSystemGuid of the
+ working block, the header structure of the variable block, FTW
+ working block, or event log block.
+
+ Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __EFI_WORKING_BLOCK_HEADER_H__
+#define __EFI_WORKING_BLOCK_HEADER_H__
+
+//
+// EFI Fault tolerant working block header
+// The header is immediately followed by the write queue.
+//
+typedef struct {
+ EFI_GUID Signature;
+ UINT32 Crc;
+ UINT8 WorkingBlockValid : 1;
+ UINT8 WorkingBlockInvalid : 1;
+#define WORKING_BLOCK_VALID 0x1
+#define WORKING_BLOCK_INVALID 0x2
+ UINT8 Reserved : 6;
+ UINT8 Reserved3[3];
+ UINT64 WriteQueueSize;
+ //
+ // UINT8 WriteQueue[WriteQueueSize];
+ //
+} EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Guid/FfsSectionAlignmentPadding.h b/roms/edk2/BaseTools/Source/C/Include/Guid/FfsSectionAlignmentPadding.h
new file mode 100644
index 000000000..5cf3d2139
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Guid/FfsSectionAlignmentPadding.h
@@ -0,0 +1,16 @@
+/** @file
+ Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __FFS_SECTION_ALIGNMENT_PADDING_GUID_H__
+#define __FFS_SECTION_ALIGNMENT_PADDING_GUID_H__
+
+#define EFI_FFS_SECTION_ALIGNMENT_PADDING_GUID \
+ { \
+ 0x04132C8D, 0x0A22, 0x4FA8, {0x82, 0x6E, 0x8B, 0xBF, 0xEF, 0xDB, 0x83, 0x6C } \
+ }
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Guid/PcAnsi.h b/roms/edk2/BaseTools/Source/C/Include/Guid/PcAnsi.h
new file mode 100644
index 000000000..697cf418b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Guid/PcAnsi.h
@@ -0,0 +1,52 @@
+/** @file
+ Terminal Device Path Vendor Guid.
+ @par Revision Reference:
+ GUIDs defined in UEFI 2.0 spec.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PC_ANSI_H__
+#define __PC_ANSI_H__
+
+#define EFI_PC_ANSI_GUID \
+ { \
+ 0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
+ }
+
+#define EFI_VT_100_GUID \
+ { \
+ 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
+ }
+
+#define EFI_VT_100_PLUS_GUID \
+ { \
+ 0x7baec70b, 0x57e0, 0x4c76, {0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43 } \
+ }
+
+#define EFI_VT_UTF8_GUID \
+ { \
+ 0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 } \
+ }
+
+#define EFI_UART_DEVICE_PATH_GUID \
+ { \
+ 0x37499a9d, 0x542f, 0x4c89, {0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 } \
+ }
+
+#define EFI_SAS_DEVICE_PATH_GUID \
+ { \
+ 0xd487ddb4, 0x008b, 0x11d9, {0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \
+ }
+
+extern EFI_GUID gEfiPcAnsiGuid;
+extern EFI_GUID gEfiVT100Guid;
+extern EFI_GUID gEfiVT100PlusGuid;
+extern EFI_GUID gEfiVTUTF8Guid;
+extern EFI_GUID gEfiUartDevicePathGuid;
+extern EFI_GUID gEfiSasDevicePathGuid;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Guid/PiFirmwareFileSystem.h b/roms/edk2/BaseTools/Source/C/Include/Guid/PiFirmwareFileSystem.h
new file mode 100644
index 000000000..0483966be
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Guid/PiFirmwareFileSystem.h
@@ -0,0 +1,39 @@
+/** @file
+ Guid used to define the Firmware File System. See PI spec volume 3 for more
+ details.
+
+ @par Revision Reference:
+ Guids defined in PI Spec Volume 3
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __FIRMWARE_FILE_SYSTEM2_GUID_H__
+#define __FIRMWARE_FILE_SYSTEM2_GUID_H__
+
+//
+// GUIDs defined by the PI specification.
+//
+#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \
+ { \
+ 0x8c8ce578, 0x8a3d, 0x4f1c, {0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2d, 0xd3 } \
+ }
+
+#define EFI_FIRMWARE_FILE_SYSTEM3_GUID \
+ { \
+ 0x5473c07a, 0x3dcb, 0x4dca, {0xbd, 0x6f, 0x1e, 0x96, 0x89, 0xe7, 0x34, 0x9a } \
+ }
+
+#define EFI_FFS_VOLUME_TOP_FILE_GUID \
+ { \
+ 0x1BA0062E, 0xC779, 0x4582, {0x85, 0x66, 0x33, 0x6A, 0xE8, 0xF7, 0x8F, 0x09 } \
+ }
+
+extern EFI_GUID gEfiFirmwareFileSystem2Guid;
+extern EFI_GUID gEfiFirmwareFileSystem3Guid;
+extern EFI_GUID gEfiFirmwareVolumeTopFileGuid;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Ia32/ProcessorBind.h b/roms/edk2/BaseTools/Source/C/Include/Ia32/ProcessorBind.h
new file mode 100644
index 000000000..d1b77ad04
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Ia32/ProcessorBind.h
@@ -0,0 +1,155 @@
+/** @file
+ Processor or Compiler specific defines and types for x64.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PROCESSOR_BIND_H__
+#define __PROCESSOR_BIND_H__
+
+//
+// Define the processor type so other code can make processor based choices
+//
+#define MDE_CPU_IA32
+
+//
+// Make sure we are useing the correct packing rules per EFI specification
+//
+#ifndef __GNUC__
+#pragma pack()
+#endif
+
+#if _MSC_EXTENSIONS
+
+//
+// Disable warning that make it impossible to compile at /W4
+// This only works for Microsoft* tools
+//
+
+//
+// Disabling bitfield type checking warnings.
+//
+#pragma warning ( disable : 4214 )
+
+//
+// Disabling the unreferenced formal parameter warnings.
+//
+#pragma warning ( disable : 4100 )
+
+//
+// Disable slightly different base types warning as CHAR8 * can not be set
+// to a constant string.
+//
+#pragma warning ( disable : 4057 )
+
+//
+// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
+//
+#pragma warning ( disable : 4127 )
+
+
+#endif
+
+
+#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
+ //
+ // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
+ //
+
+ #if _MSC_EXTENSIONS
+
+ //
+ // use Microsoft* C compiler dependent integer width types
+ //
+ typedef unsigned __int64 UINT64;
+ typedef __int64 INT64;
+ typedef unsigned __int32 UINT32;
+ typedef __int32 INT32;
+ typedef unsigned short UINT16;
+ typedef unsigned short CHAR16;
+ typedef short INT16;
+ typedef unsigned char BOOLEAN;
+ typedef unsigned char UINT8;
+ typedef char CHAR8;
+ typedef char INT8;
+ #else
+
+ //
+ // Assume standard IA-32 alignment.
+ // BugBug: Need to check portability of long long
+ //
+ typedef unsigned long long UINT64;
+ typedef long long INT64;
+ typedef unsigned int UINT32;
+ typedef int INT32;
+ typedef unsigned short UINT16;
+ typedef unsigned short CHAR16;
+ typedef short INT16;
+ typedef unsigned char BOOLEAN;
+ typedef unsigned char UINT8;
+ typedef char CHAR8;
+ typedef char INT8;
+ #endif
+
+ #define UINT8_MAX 0xff
+
+#else
+ //
+ // Use ANSI C 2000 stdint.h integer width declarations
+ //
+ #include "stdint.h"
+ typedef uint8_t BOOLEAN;
+ typedef int8_t INT8;
+ typedef uint8_t UINT8;
+ typedef int16_t INT16;
+ typedef uint16_t UINT16;
+ typedef int32_t INT32;
+ typedef uint32_t UINT32;
+ typedef int64_t INT64;
+ typedef uint64_t UINT64;
+ typedef char CHAR8;
+ typedef uint16_t CHAR16;
+
+#endif
+
+typedef UINT32 UINTN;
+typedef INT32 INTN;
+
+
+//
+// Processor specific defines
+//
+#define MAX_BIT 0x80000000
+#define MAX_2_BITS 0xC0000000
+
+//
+// Modifier to ensure that all protocol member functions and EFI intrinsics
+// use the correct C calling convention. All protocol member functions and
+// EFI intrinsics are required to modify their member functions with EFIAPI.
+//
+#if _MSC_EXTENSIONS
+ //
+ // Microsoft* compiler requires _EFIAPI usage, __cdecl is Microsoft* specific C.
+ //
+ #define EFIAPI __cdecl
+#endif
+
+#if __GNUC__
+ #define EFIAPI __attribute__((cdecl))
+#endif
+
+//
+// The Microsoft* C compiler can removed references to unreferenced data items
+// if the /OPT:REF linker option is used. We defined a macro as this is a
+// a non standard extension
+//
+#if _MSC_EXTENSIONS
+ #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
+#else
+ #define GLOBAL_REMOVE_IF_UNREFERENCED
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi.h b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi.h
new file mode 100644
index 000000000..3516478ce
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi.h
@@ -0,0 +1,117 @@
+/** @file
+ This file contains some basic ACPI definitions that are consumed by drivers
+ that do not care about ACPI versions.
+
+ Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _ACPI_H_
+#define _ACPI_H_
+
+//
+// Common table header, this prefaces all ACPI tables, including FACS, but
+// excluding the RSD PTR structure
+//
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+} EFI_ACPI_COMMON_HEADER;
+
+//
+// Common ACPI description table header. This structure prefaces most ACPI tables.
+//
+#pragma pack(1)
+
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+ UINT8 Revision;
+ UINT8 Checksum;
+ UINT8 OemId[6];
+ UINT64 OemTableId;
+ UINT32 OemRevision;
+ UINT32 CreatorId;
+ UINT32 CreatorRevision;
+} EFI_ACPI_DESCRIPTION_HEADER;
+
+#pragma pack()
+//
+// Define for Pci Host Bridge Resource Allocation
+//
+#define ACPI_ADDRESS_SPACE_DESCRIPTOR 0x8A
+#define ACPI_END_TAG_DESCRIPTOR 0x79
+
+#define ACPI_ADDRESS_SPACE_TYPE_MEM 0x00
+#define ACPI_ADDRESS_SPACE_TYPE_IO 0x01
+#define ACPI_ADDRESS_SPACE_TYPE_BUS 0x02
+
+//
+// Power Management Timer frequency is fixed at 3.579545MHz
+//
+#define ACPI_TIMER_FREQUENCY 3579545
+
+//
+// Make sure structures match spec
+//
+#pragma pack(1)
+
+typedef struct {
+ UINT8 Desc;
+ UINT16 Len;
+ UINT8 ResType;
+ UINT8 GenFlag;
+ UINT8 SpecificFlag;
+ UINT64 AddrSpaceGranularity;
+ UINT64 AddrRangeMin;
+ UINT64 AddrRangeMax;
+ UINT64 AddrTranslationOffset;
+ UINT64 AddrLen;
+} EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR;
+
+typedef struct {
+ UINT8 Desc;
+ UINT8 Checksum;
+} EFI_ACPI_END_TAG_DESCRIPTOR;
+
+//
+// General use definitions
+//
+#define EFI_ACPI_RESERVED_BYTE 0x00
+#define EFI_ACPI_RESERVED_WORD 0x0000
+#define EFI_ACPI_RESERVED_DWORD 0x00000000
+#define EFI_ACPI_RESERVED_QWORD 0x0000000000000000
+
+//
+// Resource Type Specific Flags
+// Ref ACPI specification 6.4.3.5.5
+//
+// Bit [0] : Write Status, _RW
+//
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_WRITE (1 << 0)
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_ONLY (0 << 0)
+//
+// Bit [2:1] : Memory Attributes, _MEM
+//
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_NON_CACHEABLE (0 << 1)
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE (1 << 1)
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_WRITE_COMBINING (2 << 1)
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE (3 << 1)
+//
+// Bit [4:3] : Memory Attributes, _MTP
+//
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_MEMORY (0 << 3)
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_RESERVED (1 << 3)
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_ACPI (2 << 3)
+#define EFI_APCI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_NVS (3 << 3)
+//
+// Bit [5] : Memory to I/O Translation, _TTP
+//
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_TRANSLATION (1 << 5)
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_STATIC (0 << 5)
+
+#pragma pack()
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h
new file mode 100644
index 000000000..62bd9f477
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h
@@ -0,0 +1,285 @@
+/** @file
+ ACPI 1.0b definitions from the ACPI Specification, revision 1.0b
+
+ Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _ACPI_1_0_H_
+#define _ACPI_1_0_H_
+
+#include "IndustryStandard/Acpi.h"
+
+//
+// Ensure proper structure formats
+//
+#pragma pack(1)
+//
+// ACPI 1.0b table structures
+//
+//
+// Root System Description Pointer Structure
+//
+typedef struct {
+ UINT64 Signature;
+ UINT8 Checksum;
+ UINT8 OemId[6];
+ UINT8 Reserved;
+ UINT32 RsdtAddress;
+} EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER;
+
+//
+// Root System Description Table
+// No definition needed as it is a common description table header followed by a
+// variable number of UINT32 table pointers.
+//
+//
+// RSDT Revision (as defined in ACPI 1.0b spec.)
+//
+#define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Fixed ACPI Description Table Structure (FADT)
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 FirmwareCtrl;
+ UINT32 Dsdt;
+ UINT8 IntModel;
+ UINT8 Reserved1;
+ UINT16 SciInt;
+ UINT32 SmiCmd;
+ UINT8 AcpiEnable;
+ UINT8 AcpiDisable;
+ UINT8 S4BiosReq;
+ UINT8 Reserved2;
+ UINT32 Pm1aEvtBlk;
+ UINT32 Pm1bEvtBlk;
+ UINT32 Pm1aCntBlk;
+ UINT32 Pm1bCntBlk;
+ UINT32 Pm2CntBlk;
+ UINT32 PmTmrBlk;
+ UINT32 Gpe0Blk;
+ UINT32 Gpe1Blk;
+ UINT8 Pm1EvtLen;
+ UINT8 Pm1CntLen;
+ UINT8 Pm2CntLen;
+ UINT8 PmTmLen;
+ UINT8 Gpe0BlkLen;
+ UINT8 Gpe1BlkLen;
+ UINT8 Gpe1Base;
+ UINT8 Reserved3;
+ UINT16 PLvl2Lat;
+ UINT16 PLvl3Lat;
+ UINT16 FlushSize;
+ UINT16 FlushStride;
+ UINT8 DutyOffset;
+ UINT8 DutyWidth;
+ UINT8 DayAlrm;
+ UINT8 MonAlrm;
+ UINT8 Century;
+ UINT8 Reserved4;
+ UINT8 Reserved5;
+ UINT8 Reserved6;
+ UINT32 Flags;
+} EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE;
+
+//
+// FADT Version (as defined in ACPI 1.0b spec.)
+//
+#define EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Fixed ACPI Description Table Fixed Feature Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_1_0_WBINVD (1 << 0)
+#define EFI_ACPI_1_0_WBINVD_FLUSH (1 << 1)
+#define EFI_ACPI_1_0_PROC_C1 (1 << 2)
+#define EFI_ACPI_1_0_P_LVL2_UP (1 << 3)
+#define EFI_ACPI_1_0_PWR_BUTTON (1 << 4)
+#define EFI_ACPI_1_0_SLP_BUTTON (1 << 5)
+#define EFI_ACPI_1_0_FIX_RTC (1 << 6)
+#define EFI_ACPI_1_0_RTC_S4 (1 << 7)
+#define EFI_ACPI_1_0_TMR_VAL_EXT (1 << 8)
+#define EFI_ACPI_1_0_DCK_CAP (1 << 9)
+
+#define EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION 0x0
+//
+// Firmware ACPI Control Structure
+//
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+ UINT32 HardwareSignature;
+ UINT32 FirmwareWakingVector;
+ UINT32 GlobalLock;
+ UINT32 Flags;
+ UINT8 Reserved[40];
+} EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE;
+
+//
+// Firmware Control Structure Feature Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_1_0_S4BIOS_F (1 << 0)
+
+//
+// Multiple APIC Description Table header definition. The rest of the table
+// must be defined in a platform specific manner.
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 LocalApicAddress;
+ UINT32 Flags;
+} EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
+
+//
+// MADT Revision (as defined in ACPI 1.0b spec.)
+//
+#define EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Multiple APIC Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_1_0_PCAT_COMPAT (1 << 0)
+
+//
+// Multiple APIC Description Table APIC structure types
+// All other values between 0x09 an 0xFF are reserved and
+// will be ignored by OSPM.
+//
+#define EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC 0x00
+#define EFI_ACPI_1_0_IO_APIC 0x01
+#define EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE 0x02
+#define EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE 0x03
+#define EFI_ACPI_1_0_LOCAL_APIC_NMI 0x04
+
+//
+// APIC Structure Definitions
+//
+//
+// Processor Local APIC Structure Definition
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT8 ApicId;
+ UINT32 Flags;
+} EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE;
+
+//
+// Local APIC Flags. All other bits are reserved and must be 0.
+//
+#define EFI_ACPI_1_0_LOCAL_APIC_ENABLED (1 << 0)
+
+//
+// IO APIC Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 IoApicId;
+ UINT8 Reserved;
+ UINT32 IoApicAddress;
+ UINT32 SystemVectorBase;
+} EFI_ACPI_1_0_IO_APIC_STRUCTURE;
+
+//
+// Interrupt Source Override Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 Bus;
+ UINT8 Source;
+ UINT32 GlobalSystemInterruptVector;
+ UINT16 Flags;
+} EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
+
+//
+// Non-Maskable Interrupt Source Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT32 GlobalSystemInterruptVector;
+} EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
+
+//
+// Local APIC NMI Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT16 Flags;
+ UINT8 LocalApicInti;
+} EFI_ACPI_1_0_LOCAL_APIC_NMI_STRUCTURE;
+
+//
+// Smart Battery Description Table (SBST)
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 WarningEnergyLevel;
+ UINT32 LowEnergyLevel;
+ UINT32 CriticalEnergyLevel;
+} EFI_ACPI_1_0_SMART_BATTERY_DESCRIPTION_TABLE;
+
+//
+// Known table signatures
+//
+//
+// "RSD PTR " Root System Description Pointer
+//
+#define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE 0x2052545020445352ULL
+
+//
+// "APIC" Multiple APIC Description Table
+//
+#define EFI_ACPI_1_0_APIC_SIGNATURE 0x43495041
+
+//
+// "DSDT" Differentiated System Description Table
+//
+#define EFI_ACPI_1_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445344
+
+//
+// "FACS" Firmware ACPI Control Structure
+//
+#define EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE 0x53434146
+
+//
+// "FACP" Fixed ACPI Description Table
+//
+#define EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE 0x50434146
+
+//
+// "PSDT" Persistent System Description Table
+//
+#define EFI_ACPI_1_0_PERSISTENT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445350
+
+//
+// "RSDT" Root System Description Table
+//
+#define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445352
+
+//
+// "SBST" Smart Battery Specification Table
+//
+#define EFI_ACPI_1_0_SMART_BATTERY_SPECIFICATION_TABLE_SIGNATURE 0x54534253
+
+//
+// "SSDT" Secondary System Description Table
+//
+#define EFI_ACPI_1_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445353
+
+#pragma pack()
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi2_0.h b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi2_0.h
new file mode 100644
index 000000000..c95c996c0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi2_0.h
@@ -0,0 +1,520 @@
+/** @file
+ ACPI 2.0 definitions from the ACPI Specification, revision 2.0
+
+ Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _ACPI_2_0_H_
+#define _ACPI_2_0_H_
+
+#include "IndustryStandard/Acpi.h"
+
+//
+// Ensure proper structure formats
+//
+#pragma pack(1)
+//
+// ACPI Specification Revision
+//
+#define EFI_ACPI_2_0_REVISION 0x02
+
+//
+// BUGBUG: OEM values need to be moved somewhere else, probably read from data hub
+// and produced by a platform specific driver.
+//
+//
+// ACPI OEM ID
+//
+#define EFI_ACPI_2_0_OEM_ID "INTEL "
+#define EFI_ACPI_2_0_OEM_TABLE_ID 0x5034303738543245 // "E2T8704P"
+//
+// ACPI OEM Revision
+//
+#define EFI_ACPI_2_0_OEM_REVISION 0x00000002
+
+//
+// ACPI table creator ID
+//
+#define EFI_ACPI_2_0_CREATOR_ID 0x5446534D // TBD "MSFT"
+//
+// ACPI table creator revision
+//
+#define EFI_ACPI_2_0_CREATOR_REVISION 0x01000013 // TBD
+//
+// ACPI 2.0 Generic Address Space definition
+//
+typedef struct {
+ UINT8 AddressSpaceId;
+ UINT8 RegisterBitWidth;
+ UINT8 RegisterBitOffset;
+ UINT8 Reserved;
+ UINT64 Address;
+} EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE;
+
+//
+// Generic Address Space Address IDs
+//
+#define EFI_ACPI_2_0_SYSTEM_MEMORY 0
+#define EFI_ACPI_2_0_SYSTEM_IO 1
+#define EFI_ACPI_2_0_PCI_CONFIGURATION_SPACE 2
+#define EFI_ACPI_2_0_EMBEDDED_CONTROLLER 3
+#define EFI_ACPI_2_0_SMBUS 4
+#define EFI_ACPI_2_0_FUNCTIONAL_FIXED_HARDWARE 0x7F
+
+//
+// ACPI 2.0 table structures
+//
+//
+// Root System Description Pointer Structure
+//
+typedef struct {
+ UINT64 Signature;
+ UINT8 Checksum;
+ UINT8 OemId[6];
+ UINT8 Revision;
+ UINT32 RsdtAddress;
+ UINT32 Length;
+ UINT64 XsdtAddress;
+ UINT8 ExtendedChecksum;
+ UINT8 Reserved[3];
+} EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER;
+
+//
+// RSD_PTR Revision (as defined in ACPI 2.0 spec.)
+//
+#define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION 0x02
+
+//
+// Common table header, this prefaces all ACPI tables, including FACS, but
+// excluding the RSD PTR structure
+//
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+} EFI_ACPI_2_0_COMMON_HEADER;
+
+//
+// Root System Description Table
+// No definition needed as it is a common description table header followed by a
+// variable number of UINT32 table pointers.
+//
+//
+// RSDT Revision (as defined in ACPI 2.0 spec.)
+//
+#define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Extended System Description Table
+// No definition needed as it is a common description table header followed by a
+// variable number of UINT64 table pointers.
+//
+//
+// XSDT Revision (as defined in ACPI 2.0 spec.)
+//
+#define EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Fixed ACPI Description Table Structure (FADT)
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 FirmwareCtrl;
+ UINT32 Dsdt;
+ UINT8 Reserved0;
+ UINT8 PreferredPmProfile;
+ UINT16 SciInt;
+ UINT32 SmiCmd;
+ UINT8 AcpiEnable;
+ UINT8 AcpiDisable;
+ UINT8 S4BiosReq;
+ UINT8 PstateCnt;
+ UINT32 Pm1aEvtBlk;
+ UINT32 Pm1bEvtBlk;
+ UINT32 Pm1aCntBlk;
+ UINT32 Pm1bCntBlk;
+ UINT32 Pm2CntBlk;
+ UINT32 PmTmrBlk;
+ UINT32 Gpe0Blk;
+ UINT32 Gpe1Blk;
+ UINT8 Pm1EvtLen;
+ UINT8 Pm1CntLen;
+ UINT8 Pm2CntLen;
+ UINT8 PmTmrLen;
+ UINT8 Gpe0BlkLen;
+ UINT8 Gpe1BlkLen;
+ UINT8 Gpe1Base;
+ UINT8 CstCnt;
+ UINT16 PLvl2Lat;
+ UINT16 PLvl3Lat;
+ UINT16 FlushSize;
+ UINT16 FlushStride;
+ UINT8 DutyOffset;
+ UINT8 DutyWidth;
+ UINT8 DayAlrm;
+ UINT8 MonAlrm;
+ UINT8 Century;
+ UINT16 IaPcBootArch;
+ UINT8 Reserved1;
+ UINT32 Flags;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE ResetReg;
+ UINT8 ResetValue;
+ UINT8 Reserved2[3];
+ UINT64 XFirmwareCtrl;
+ UINT64 XDsdt;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XGpe0Blk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XGpe1Blk;
+} EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE;
+
+//
+// FADT Version (as defined in ACPI 2.0 spec.)
+//
+#define EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION 0x03
+
+//
+// Fixed ACPI Description Table Boot Architecture Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_2_0_LEGACY_DEVICES (1 << 0)
+#define EFI_ACPI_2_0_8042 (1 << 1)
+
+//
+// Fixed ACPI Description Table Fixed Feature Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_2_0_WBINVD (1 << 0)
+#define EFI_ACPI_2_0_WBINVD_FLUSH (1 << 1)
+#define EFI_ACPI_2_0_PROC_C1 (1 << 2)
+#define EFI_ACPI_2_0_P_LVL2_UP (1 << 3)
+#define EFI_ACPI_2_0_PWR_BUTTON (1 << 4)
+#define EFI_ACPI_2_0_SLP_BUTTON (1 << 5)
+#define EFI_ACPI_2_0_FIX_RTC (1 << 6)
+#define EFI_ACPI_2_0_RTC_S4 (1 << 7)
+#define EFI_ACPI_2_0_TMR_VAL_EXT (1 << 8)
+#define EFI_ACPI_2_0_DCK_CAP (1 << 9)
+#define EFI_ACPI_2_0_RESET_REG_SUP (1 << 10)
+#define EFI_ACPI_2_0_SEALED_CASE (1 << 11)
+#define EFI_ACPI_2_0_HEADLESS (1 << 12)
+#define EFI_ACPI_2_0_CPU_SW_SLP (1 << 13)
+
+//
+// Firmware ACPI Control Structure
+//
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+ UINT32 HardwareSignature;
+ UINT32 FirmwareWakingVector;
+ UINT32 GlobalLock;
+ UINT32 Flags;
+ UINT64 XFirmwareWakingVector;
+ UINT8 Version;
+ UINT8 Reserved[31];
+} EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE;
+
+//
+// FACS Version (as defined in ACPI 2.0 spec.)
+//
+#define EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION 0x01
+
+//
+// Firmware Control Structure Feature Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_2_0_S4BIOS_F (1 << 0)
+
+//
+// Multiple APIC Description Table header definition. The rest of the table
+// must be defined in a platform specific manner.
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 LocalApicAddress;
+ UINT32 Flags;
+} EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
+
+//
+// MADT Revision (as defined in ACPI 2.0 spec.)
+//
+#define EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Multiple APIC Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_2_0_PCAT_COMPAT (1 << 0)
+
+//
+// Multiple APIC Description Table APIC structure types
+// All other values between 0x09 an 0xFF are reserved and
+// will be ignored by OSPM.
+//
+#define EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC 0x00
+#define EFI_ACPI_2_0_IO_APIC 0x01
+#define EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE 0x02
+#define EFI_ACPI_2_0_NON_MASKABLE_INTERRUPT_SOURCE 0x03
+#define EFI_ACPI_2_0_LOCAL_APIC_NMI 0x04
+#define EFI_ACPI_2_0_LOCAL_APIC_ADDRESS_OVERRIDE 0x05
+#define EFI_ACPI_2_0_IO_SAPIC 0x06
+#define EFI_ACPI_2_0_PROCESSOR_LOCAL_SAPIC 0x07
+#define EFI_ACPI_2_0_PLATFORM_INTERRUPT_SOURCES 0x08
+
+//
+// APIC Structure Definitions
+//
+//
+// Processor Local APIC Structure Definition
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT8 ApicId;
+ UINT32 Flags;
+} EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE;
+
+//
+// Local APIC Flags. All other bits are reserved and must be 0.
+//
+#define EFI_ACPI_2_0_LOCAL_APIC_ENABLED (1 << 0)
+
+//
+// IO APIC Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 IoApicId;
+ UINT8 Reserved;
+ UINT32 IoApicAddress;
+ UINT32 GlobalSystemInterruptBase;
+} EFI_ACPI_2_0_IO_APIC_STRUCTURE;
+
+//
+// Interrupt Source Override Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 Bus;
+ UINT8 Source;
+ UINT32 GlobalSystemInterrupt;
+ UINT16 Flags;
+} EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
+
+//
+// Non-Maskable Interrupt Source Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT32 GlobalSystemInterrupt;
+} EFI_ACPI_2_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
+
+//
+// Local APIC NMI Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT16 Flags;
+ UINT8 LocalApicLint;
+} EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE;
+
+//
+// Local APIC Address Override Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Reserved;
+ UINT64 LocalApicAddress;
+} EFI_ACPI_2_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE;
+
+//
+// IO SAPIC Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 IoApicId;
+ UINT8 Reserved;
+ UINT32 GlobalSystemInterruptBase;
+ UINT64 IoSapicAddress;
+} EFI_ACPI_2_0_IO_SAPIC_STRUCTURE;
+
+//
+// Local SAPIC Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT8 LocalSapicId;
+ UINT8 LocalSapicEid;
+ UINT8 Reserved[3];
+ UINT32 Flags;
+} EFI_ACPI_2_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE;
+
+//
+// Platform Interrupt Sources Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT8 InterruptType;
+ UINT8 ProcessorId;
+ UINT8 ProcessorEid;
+ UINT8 IoSapicVector;
+ UINT32 GlobalSystemInterrupt;
+ UINT32 Reserved;
+} EFI_ACPI_2_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE;
+
+//
+// Smart Battery Description Table (SBST)
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 WarningEnergyLevel;
+ UINT32 LowEnergyLevel;
+ UINT32 CriticalEnergyLevel;
+} EFI_ACPI_2_0_SMART_BATTERY_DESCRIPTION_TABLE;
+
+//
+// SBST Version (as defined in ACPI 2.0 spec.)
+//
+#define EFI_ACPI_2_0_SMART_BATTERY_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Embedded Controller Boot Resources Table (ECDT)
+// The table is followed by a null terminated ASCII string that contains
+// a fully qualified reference to the name space object.
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE EcControl;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE EcData;
+ UINT32 Uid;
+ UINT8 GpeBit;
+} EFI_ACPI_2_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE;
+
+//
+// ECDT Version (as defined in ACPI 2.0 spec.)
+//
+#define EFI_ACPI_2_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_REVISION 0x01
+
+//
+// Known table signatures
+//
+//
+// "RSD PTR " Root System Description Pointer
+//
+#define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE 0x2052545020445352
+
+//
+// "SPIC" Multiple SAPIC Description Table
+//
+// BUGBUG: Don't know where this came from except SR870BN4 uses it.
+// #define EFI_ACPI_2_0_MULTIPLE_SAPIC_DESCRIPTION_TABLE_SIGNATURE 0x43495053
+//
+#define EFI_ACPI_2_0_MULTIPLE_SAPIC_DESCRIPTION_TABLE_SIGNATURE 0x43495041
+
+//
+// "BOOT" MS Simple Boot Spec
+//
+#define EFI_ACPI_2_0_SIMPLE_BOOT_FLAG_TABLE_SIGNATURE 0x544F4F42
+
+//
+// "DBGP" MS Bebug Port Spec
+//
+#define EFI_ACPI_2_0_DEBUG_PORT_TABLE_SIGNATURE 0x50474244
+
+//
+// "DSDT" Differentiated System Description Table
+//
+#define EFI_ACPI_2_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445344
+
+//
+// "ECDT" Embedded Controller Boot Resources Table
+//
+#define EFI_ACPI_2_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_SIGNATURE 0x54444345
+
+//
+// "ETDT" Event Timer Description Table
+//
+#define EFI_ACPI_2_0_EVENT_TIMER_DESCRIPTION_TABLE_SIGNATURE 0x54445445
+
+//
+// "FACS" Firmware ACPI Control Structure
+//
+#define EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE 0x53434146
+
+//
+// "FACP" Fixed ACPI Description Table
+//
+#define EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE 0x50434146
+
+//
+// "APIC" Multiple APIC Description Table
+//
+#define EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE 0x43495041
+
+//
+// "PSDT" Persistent System Description Table
+//
+#define EFI_ACPI_2_0_PERSISTENT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445350
+
+//
+// "RSDT" Root System Description Table
+//
+#define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445352
+
+//
+// "SBST" Smart Battery Specification Table
+//
+#define EFI_ACPI_2_0_SMART_BATTERY_SPECIFICATION_TABLE_SIGNATURE 0x54534253
+
+//
+// "SLIT" System Locality Information Table
+//
+#define EFI_ACPI_2_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE 0x54494C53
+
+//
+// "SPCR" Serial Port Console Redirection Table
+//
+#define EFI_ACPI_2_0_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE 0x52435053
+
+//
+// "SRAT" Static Resource Affinity Table
+//
+#define EFI_ACPI_2_0_STATIC_RESOURCE_AFFINITY_TABLE_SIGNATURE 0x54415253
+
+//
+// "SSDT" Secondary System Description Table
+//
+#define EFI_ACPI_2_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445353
+
+//
+// "SPMI" Server Platform Management Interface Table
+//
+#define EFI_ACPI_2_0_SERVER_PLATFORM_MANAGEMENT_INTERFACE_SIGNATURE 0x494D5053
+
+//
+// "XSDT" Extended System Description Table
+//
+#define EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445358
+
+#pragma pack()
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi3_0.h b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi3_0.h
new file mode 100644
index 000000000..6c6e52f6b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Acpi3_0.h
@@ -0,0 +1,668 @@
+/** @file
+ ACPI 3.0 definitions from the ACPI Specification Revision 3.0 September 2, 2004
+
+ Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _ACPI_3_0_H_
+#define _ACPI_3_0_H_
+
+#include "IndustryStandard/Acpi.h"
+
+//
+// Ensure proper structure formats
+//
+#pragma pack(1)
+//
+// ACPI Specification Revision
+//
+#define EFI_ACPI_3_0_REVISION 0x03 // BUGBUG: Not in spec yet.
+//
+// BUGBUG: OEM values need to be moved somewhere else, probably read from data hub
+// and produced by a platform specific driver.
+//
+//
+// ACPI 3.0 Generic Address Space definition
+//
+typedef struct {
+ UINT8 AddressSpaceId;
+ UINT8 RegisterBitWidth;
+ UINT8 RegisterBitOffset;
+ UINT8 AccessSize;
+ UINT64 Address;
+} EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE;
+
+//
+// Generic Address Space Address IDs
+//
+#define EFI_ACPI_3_0_SYSTEM_MEMORY 0
+#define EFI_ACPI_3_0_SYSTEM_IO 1
+#define EFI_ACPI_3_0_PCI_CONFIGURATION_SPACE 2
+#define EFI_ACPI_3_0_EMBEDDED_CONTROLLER 3
+#define EFI_ACPI_3_0_SMBUS 4
+#define EFI_ACPI_3_0_FUNCTIONAL_FIXED_HARDWARE 0x7F
+
+//
+// Generic Address Space Access Sizes
+//
+#define EFI_ACPI_3_0_UNDEFINED 0
+#define EFI_ACPI_3_0_BYTE 1
+#define EFI_ACPI_3_0_WORD 2
+#define EFI_ACPI_3_0_DWORD 3
+#define EFI_ACPI_3_0_QWORD 4
+
+//
+// ACPI 3.0 table structures
+//
+//
+// Root System Description Pointer Structure
+//
+typedef struct {
+ UINT64 Signature;
+ UINT8 Checksum;
+ UINT8 OemId[6];
+ UINT8 Revision;
+ UINT32 RsdtAddress;
+ UINT32 Length;
+ UINT64 XsdtAddress;
+ UINT8 ExtendedChecksum;
+ UINT8 Reserved[3];
+} EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER;
+
+//
+// RSD_PTR Revision (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION 0x02 // ACPISpec30 (Revision 3.0 September 2, 2004) says current value is 2
+//
+// Common table header, this prefaces all ACPI tables, including FACS, but
+// excluding the RSD PTR structure
+//
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+} EFI_ACPI_3_0_COMMON_HEADER;
+
+//
+// Root System Description Table
+// No definition needed as it is a common description table header followed by a
+// variable number of UINT32 table pointers.
+//
+//
+// RSDT Revision (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Extended System Description Table
+// No definition needed as it is a common description table header followed by a
+// variable number of UINT64 table pointers.
+//
+//
+// XSDT Revision (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Fixed ACPI Description Table Structure (FADT)
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 FirmwareCtrl;
+ UINT32 Dsdt;
+ UINT8 Reserved0;
+ UINT8 PreferredPmProfile;
+ UINT16 SciInt;
+ UINT32 SmiCmd;
+ UINT8 AcpiEnable;
+ UINT8 AcpiDisable;
+ UINT8 S4BiosReq;
+ UINT8 PstateCnt;
+ UINT32 Pm1aEvtBlk;
+ UINT32 Pm1bEvtBlk;
+ UINT32 Pm1aCntBlk;
+ UINT32 Pm1bCntBlk;
+ UINT32 Pm2CntBlk;
+ UINT32 PmTmrBlk;
+ UINT32 Gpe0Blk;
+ UINT32 Gpe1Blk;
+ UINT8 Pm1EvtLen;
+ UINT8 Pm1CntLen;
+ UINT8 Pm2CntLen;
+ UINT8 PmTmrLen;
+ UINT8 Gpe0BlkLen;
+ UINT8 Gpe1BlkLen;
+ UINT8 Gpe1Base;
+ UINT8 CstCnt;
+ UINT16 PLvl2Lat;
+ UINT16 PLvl3Lat;
+ UINT16 FlushSize;
+ UINT16 FlushStride;
+ UINT8 DutyOffset;
+ UINT8 DutyWidth;
+ UINT8 DayAlrm;
+ UINT8 MonAlrm;
+ UINT8 Century;
+ UINT16 IaPcBootArch;
+ UINT8 Reserved1;
+ UINT32 Flags;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE ResetReg;
+ UINT8 ResetValue;
+ UINT8 Reserved2[3];
+ UINT64 XFirmwareCtrl;
+ UINT64 XDsdt;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XGpe0Blk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XGpe1Blk;
+} EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE;
+
+//
+// FADT Version (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION 0x04
+
+//
+// Fixed ACPI Description Table Preferred Power Management Profile
+//
+#define EFI_ACPI_3_0_PM_PROFILE_UNSPECIFIED 0
+#define EFI_ACPI_3_0_PM_PROFILE_DESKTOP 1
+#define EFI_ACPI_3_0_PM_PROFILE_MOBILE 2
+#define EFI_ACPI_3_0_PM_PROFILE_WORKSTATION 3
+#define EFI_ACPI_3_0_PM_PROFILE_ENTERPRISE_SERVER 4
+#define EFI_ACPI_3_0_PM_PROFILE_SOHO_SERVER 5
+#define EFI_ACPI_3_0_PM_PROFILE_APPLIANCE_PC 6
+#define EFI_ACPI_3_0_PM_PROFILE_PERFORMANCE_SERVER 7
+
+//
+// Fixed ACPI Description Table Boot Architecture Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_LEGACY_DEVICES (1 << 0)
+#define EFI_ACPI_3_0_8042 (1 << 1)
+#define EFI_ACPI_3_0_VGA_NOT_PRESENT (1 << 2)
+#define EFI_ACPI_3_0_MSI_NOT_SUPPORTED (1 << 3)
+//
+// Fixed ACPI Description Table Fixed Feature Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_WBINVD (1 << 0)
+#define EFI_ACPI_3_0_WBINVD_FLUSH (1 << 1)
+#define EFI_ACPI_3_0_PROC_C1 (1 << 2)
+#define EFI_ACPI_3_0_P_LVL2_UP (1 << 3)
+#define EFI_ACPI_3_0_PWR_BUTTON (1 << 4)
+#define EFI_ACPI_3_0_SLP_BUTTON (1 << 5)
+#define EFI_ACPI_3_0_FIX_RTC (1 << 6)
+#define EFI_ACPI_3_0_RTC_S4 (1 << 7)
+#define EFI_ACPI_3_0_TMR_VAL_EXT (1 << 8)
+#define EFI_ACPI_3_0_DCK_CAP (1 << 9)
+#define EFI_ACPI_3_0_RESET_REG_SUP (1 << 10)
+#define EFI_ACPI_3_0_SEALED_CASE (1 << 11)
+#define EFI_ACPI_3_0_HEADLESS (1 << 12)
+#define EFI_ACPI_3_0_CPU_SW_SLP (1 << 13)
+#define EFI_ACPI_3_0_PCI_EXP_WAK (1 << 14)
+#define EFI_ACPI_3_0_USE_PLATFORM_CLOCK (1 << 15)
+#define EFI_ACPI_3_0_S4_RTC_STS_VALID (1 << 16)
+#define EFI_ACPI_3_0_REMOTE_POWER_ON_CAPABLE (1 << 17)
+#define EFI_ACPI_3_0_FORCE_APIC_CLUSTER_MODEL (1 << 18)
+#define EFI_ACPI_3_0_FORCE_APIC_PHYSICAL_DESTINATION_MODE (1 << 19)
+
+//
+// Firmware ACPI Control Structure
+//
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+ UINT32 HardwareSignature;
+ UINT32 FirmwareWakingVector;
+ UINT32 GlobalLock;
+ UINT32 Flags;
+ UINT64 XFirmwareWakingVector;
+ UINT8 Version;
+ UINT8 Reserved[31];
+} EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE;
+
+//
+// FACS Version (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION 0x01
+
+//
+// Firmware Control Structure Feature Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_S4BIOS_F (1 << 0)
+
+//
+// Differentiated System Description Table,
+// Secondary System Description Table
+// and Persistent System Description Table,
+// no definition needed as they are common description table header followed by a
+// definition block.
+//
+#define EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x02
+#define EFI_ACPI_3_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_REVISION 0x02
+
+//
+// Multiple APIC Description Table header definition. The rest of the table
+// must be defined in a platform specific manner.
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 LocalApicAddress;
+ UINT32 Flags;
+} EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
+
+//
+// MADT Revision (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x02
+
+//
+// Multiple APIC Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_PCAT_COMPAT (1 << 0)
+
+//
+// Multiple APIC Description Table APIC structure types
+// All other values between 0x09 an 0xFF are reserved and
+// will be ignored by OSPM.
+//
+#define EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC 0x00
+#define EFI_ACPI_3_0_IO_APIC 0x01
+#define EFI_ACPI_3_0_INTERRUPT_SOURCE_OVERRIDE 0x02
+#define EFI_ACPI_3_0_NON_MASKABLE_INTERRUPT_SOURCE 0x03
+#define EFI_ACPI_3_0_LOCAL_APIC_NMI 0x04
+#define EFI_ACPI_3_0_LOCAL_APIC_ADDRESS_OVERRIDE 0x05
+#define EFI_ACPI_3_0_IO_SAPIC 0x06
+#define EFI_ACPI_3_0_LOCAL_SAPIC 0x07
+#define EFI_ACPI_3_0_PLATFORM_INTERRUPT_SOURCES 0x08
+
+//
+// APIC Structure Definitions
+//
+//
+// Processor Local APIC Structure Definition
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT8 ApicId;
+ UINT32 Flags;
+} EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_STRUCTURE;
+
+//
+// Local APIC Flags. All other bits are reserved and must be 0.
+//
+#define EFI_ACPI_3_0_LOCAL_APIC_ENABLED (1 << 0)
+
+//
+// IO APIC Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 IoApicId;
+ UINT8 Reserved;
+ UINT32 IoApicAddress;
+ UINT32 GlobalSystemInterruptBase;
+} EFI_ACPI_3_0_IO_APIC_STRUCTURE;
+
+//
+// Interrupt Source Override Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 Bus;
+ UINT8 Source;
+ UINT32 GlobalSystemInterrupt;
+ UINT16 Flags;
+} EFI_ACPI_3_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
+
+//
+// Platform Interrupt Sources Structure Definition
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT8 InterruptType;
+ UINT8 ProcessorId;
+ UINT8 ProcessorEid;
+ UINT8 IoSapicVector;
+ UINT32 GlobalSystemInterrupt;
+ UINT32 PlatformInterruptSourceFlags;
+ UINT8 CpeiProcessorOverride;
+ UINT8 Reserved[31];
+} EFI_ACPI_3_0_PLATFORM_INTERRUPT_APIC_STRUCTURE;
+
+//
+// MPS INTI flags.
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_POLARITY (3 << 0)
+#define EFI_ACPI_3_0_TRIGGER_MODE (3 << 2)
+
+//
+// Non-Maskable Interrupt Source Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT32 GlobalSystemInterrupt;
+} EFI_ACPI_3_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
+
+//
+// Local APIC NMI Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT16 Flags;
+ UINT8 LocalApicLint;
+} EFI_ACPI_3_0_LOCAL_APIC_NMI_STRUCTURE;
+
+//
+// Local APIC Address Override Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Reserved;
+ UINT64 LocalApicAddress;
+} EFI_ACPI_3_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE;
+
+//
+// IO SAPIC Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 IoApicId;
+ UINT8 Reserved;
+ UINT32 GlobalSystemInterruptBase;
+ UINT64 IoSapicAddress;
+} EFI_ACPI_3_0_IO_SAPIC_STRUCTURE;
+
+//
+// Local SAPIC Structure
+// This struct followed by a null-terminated ASCII string - ACPI Processor UID String
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT8 LocalSapicId;
+ UINT8 LocalSapicEid;
+ UINT8 Reserved[3];
+ UINT32 Flags;
+ UINT32 ACPIProcessorUIDValue;
+} EFI_ACPI_3_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE;
+
+//
+// Platform Interrupt Sources Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT8 InterruptType;
+ UINT8 ProcessorId;
+ UINT8 ProcessorEid;
+ UINT8 IoSapicVector;
+ UINT32 GlobalSystemInterrupt;
+ UINT32 PlatformInterruptSourceFlags;
+} EFI_ACPI_3_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE;
+
+//
+// Platform Interrupt Source Flags.
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_CPEI_PROCESSOR_OVERRIDE (1 << 0)
+
+//
+// Smart Battery Description Table (SBST)
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 WarningEnergyLevel;
+ UINT32 LowEnergyLevel;
+ UINT32 CriticalEnergyLevel;
+} EFI_ACPI_3_0_SMART_BATTERY_DESCRIPTION_TABLE;
+
+//
+// SBST Version (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_SMART_BATTERY_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Embedded Controller Boot Resources Table (ECDT)
+// The table is followed by a null terminated ASCII string that contains
+// a fully qualified reference to the name space object.
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE EcControl;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE EcData;
+ UINT32 Uid;
+ UINT8 GpeBit;
+} EFI_ACPI_3_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE;
+
+//
+// ECDT Version (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_REVISION 0x01
+
+//
+// System Resource Affinity Table (SRAT. The rest of the table
+// must be defined in a platform specific manner.
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 Reserved1; // Must be set to 1
+ UINT64 Reserved2;
+} EFI_ACPI_3_0_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER;
+
+//
+// SRAT Version (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_SYSTEM_RESOURCE_AFFINITY_TABLE_REVISION 0x02
+
+//
+// SRAT structure types.
+// All other values between 0x02 an 0xFF are reserved and
+// will be ignored by OSPM.
+//
+#define EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY 0x00
+#define EFI_ACPI_3_0_MEMORY_AFFINITY 0x01
+
+//
+// Processor Local APIC/SAPIC Affinity Structure Definition
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 ProximityDomain7To0;
+ UINT8 ApicId;
+ UINT32 Flags;
+ UINT8 LocalSapicEid;
+ UINT8 ProximityDomain31To8[3];
+ UINT8 Reserved[4];
+} EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY_STRUCTURE;
+
+//
+// Local APIC/SAPIC Flags. All other bits are reserved and must be 0.
+//
+#define EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_SAPIC_ENABLED (1 << 0)
+
+//
+// Memory Affinity Structure Definition
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT32 ProximityDomain;
+ UINT16 Reserved1;
+ UINT32 AddressBaseLow;
+ UINT32 AddressBaseHigh;
+ UINT32 LengthLow;
+ UINT32 LengthHigh;
+ UINT32 Reserved2;
+ UINT32 Flags;
+ UINT64 Reserved3;
+} EFI_ACPI_3_0_MEMORY_AFFINITY_STRUCTURE;
+
+//
+// Memory Flags. All other bits are reserved and must be 0.
+//
+#define EFI_ACPI_3_0_MEMORY_ENABLED (1 << 0)
+#define EFI_ACPI_3_0_MEMORY_HOT_PLUGGABLE (1 << 1)
+#define EFI_ACPI_3_0_MEMORY_NONVOLATILE (1 << 2)
+
+//
+// System Locality Distance Information Table (SLIT).
+// The rest of the table is a matrix.
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT64 NumberOfSystemLocalities;
+} EFI_ACPI_3_0_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_HEADER;
+
+//
+// SLIT Version (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_REVISION 0x01
+
+//
+// Known table signatures
+//
+//
+// "RSD PTR " Root System Description Pointer
+//
+#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE 0x2052545020445352ULL
+
+//
+// "APIC" Multiple APIC Description Table
+//
+#define EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE 0x43495041
+
+//
+// "DSDT" Differentiated System Description Table
+//
+#define EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445344
+
+//
+// "ECDT" Embedded Controller Boot Resources Table
+//
+#define EFI_ACPI_3_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_SIGNATURE 0x54444345
+
+//
+// "FACP" Fixed ACPI Description Table
+//
+#define EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE 0x50434146
+
+//
+// "FACS" Firmware ACPI Control Structure
+//
+#define EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE 0x53434146
+
+//
+// "PSDT" Persistent System Description Table
+//
+#define EFI_ACPI_3_0_PERSISTENT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445350
+
+//
+// "RSDT" Root System Description Table
+//
+#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445352
+
+//
+// "SBST" Smart Battery Specification Table
+//
+#define EFI_ACPI_3_0_SMART_BATTERY_SPECIFICATION_TABLE_SIGNATURE 0x54534253
+
+//
+// "SLIT" System Locality Information Table
+//
+#define EFI_ACPI_3_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE 0x54494C53
+
+//
+// "SRAT" System Resource Affinity Table
+//
+#define EFI_ACPI_3_0_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE 0x54415253
+
+//
+// "SSDT" Secondary System Description Table
+//
+#define EFI_ACPI_3_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445353
+
+//
+// "XSDT" Extended System Description Table
+//
+#define EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445358
+
+//
+// "BOOT" MS Simple Boot Spec
+//
+#define EFI_ACPI_3_0_SIMPLE_BOOT_FLAG_TABLE_SIGNATURE 0x544F4F42
+
+//
+// "CPEP" Corrected Platform Error Polling Table
+// See
+//
+#define EFI_ACPI_3_0_CORRECTED_PLATFORM_ERROR_POLLING_TABLE_SIGNATURE 0x50455043
+
+//
+// "DBGP" MS Debug Port Spec
+//
+#define EFI_ACPI_3_0_DEBUG_PORT_TABLE_SIGNATURE 0x50474244
+
+//
+// "ETDT" Event Timer Description Table
+//
+#define EFI_ACPI_3_0_EVENT_TIMER_DESCRIPTION_TABLE_SIGNATURE 0x54445445
+
+//
+// "HPET" IA-PC High Precision Event Timer Table
+//
+#define EFI_ACPI_3_0_HIGH_PRECISION_EVENT_TIMER_TABLE_SIGNATURE 0x54455048
+
+//
+// "MCFG" PCI Express Memory Mapped Configuration Space Base Address Description Table
+//
+#define EFI_ACPI_3_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE 0x4746434D
+
+//
+// "SPCR" Serial Port Console Redirection Table
+//
+#define EFI_ACPI_3_0_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE 0x52435053
+
+//
+// "SPMI" Server Platform Management Interface Table
+//
+#define EFI_ACPI_3_0_SERVER_PLATFORM_MANAGEMENT_INTERFACE_TABLE_SIGNATURE 0x494D5053
+
+//
+// "TCPA" Trusted Computing Platform Alliance Capabilities Table
+//
+#define EFI_ACPI_3_0_TRUSTED_COMPUTING_PLATFORM_ALLIANCE_CAPABILITIES_TABLE_SIGNATURE 0x41504354
+
+//
+// "WDRT" Watchdog Resource Table
+//
+#define EFI_ACPI_3_0_WATCHDOG_RESOURCE_TABLE_SIGNATURE 0x54524457
+
+#pragma pack()
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Bluetooth.h b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Bluetooth.h
new file mode 100644
index 000000000..82f5e6299
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/Bluetooth.h
@@ -0,0 +1,56 @@
+/** @file
+ This file contains the Bluetooth definitions that are consumed by drivers.
+ These definitions are from Bluetooth Core Specification Version 4.0 June, 2010
+
+ Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _BLUETOOTH_H_
+#define _BLUETOOTH_H_
+
+#pragma pack(1)
+
+///
+/// BLUETOOTH_ADDRESS
+///
+typedef struct {
+ ///
+ /// 48bit Bluetooth device address.
+ ///
+ UINT8 Address[6];
+} BLUETOOTH_ADDRESS;
+
+///
+/// BLUETOOTH_CLASS_OF_DEVICE. See Bluetooth specification for detail.
+///
+typedef struct {
+ UINT8 FormatType:2;
+ UINT8 MinorDeviceClass: 6;
+ UINT16 MajorDeviceClass: 5;
+ UINT16 MajorServiceClass:11;
+} BLUETOOTH_CLASS_OF_DEVICE;
+
+///
+/// BLUETOOTH_LE_ADDRESS
+///
+typedef struct {
+ ///
+ /// 48-bit Bluetooth device address
+ ///
+ UINT8 Address[6];
+ ///
+ /// 0x00 - Public Device Address
+ /// 0x01 - Random Device Address
+ ///
+ UINT8 Type;
+} BLUETOOTH_LE_ADDRESS;
+
+#pragma pack()
+
+#define BLUETOOTH_HCI_COMMAND_LOCAL_READABLE_NAME_MAX_SIZE 248
+
+#define BLUETOOTH_HCI_LINK_KEY_SIZE 16
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/EfiPci.h b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/EfiPci.h
new file mode 100644
index 000000000..aab27f9bf
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/EfiPci.h
@@ -0,0 +1,51 @@
+/** @file
+ Support for EFI PCI specification.
+
+ Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFI_PCI_H_
+#define _EFI_PCI_H_
+
+//#include "pci22.h"
+//#include "pci23.h"
+//#include "pci30.h"
+
+#pragma pack(push, 1)
+
+typedef struct {
+ UINT8 Register;
+ UINT8 Function;
+ UINT8 Device;
+ UINT8 Bus;
+ UINT8 Reserved[4];
+} DEFIO_PCI_ADDR;
+
+#define EFI_ROOT_BRIDGE_LIST 'eprb'
+#define EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE 0x0EF1
+
+typedef struct {
+ UINT16 Signature; // 0xaa55
+ UINT16 InitializationSize;
+ UINT32 EfiSignature; // 0x0EF1
+ UINT16 EfiSubsystem;
+ UINT16 EfiMachineType;
+ UINT16 CompressionType;
+ UINT8 Reserved[8];
+ UINT16 EfiImageHeaderOffset;
+ UINT16 PcirOffset;
+} EFI_PCI_EXPANSION_ROM_HEADER;
+
+typedef union {
+ UINT8 *Raw;
+ PCI_EXPANSION_ROM_HEADER *Generic;
+ EFI_PCI_EXPANSION_ROM_HEADER *Efi;
+ EFI_LEGACY_EXPANSION_ROM_HEADER *PcAt;
+} EFI_PCI_ROM_HEADER;
+
+#pragma pack(pop)
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h
new file mode 100644
index 000000000..3d435001f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h
@@ -0,0 +1,39 @@
+/** @file
+ ACPI memory mapped configuration space access table definition, defined at
+ in the PCI Firmware Specification, version 3.0 draft version 0.5.
+ Specification is available at http://www.pcisig.com.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_H_
+#define _MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_H_
+
+//
+// Ensure proper structure formats
+//
+#pragma pack(1)
+//
+// Memory Mapped Configuration Space Access Table (MCFG)
+// This table is a basic description table header followed by
+// a number of base address allocation structures.
+//
+typedef struct {
+ UINT64 BaseAddress;
+ UINT16 PciSegmentGroupNumber;
+ UINT8 StartBusNumber;
+ UINT8 EndBusNumber;
+ UINT32 Reserved;
+} EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE;
+
+//
+// MCFG Revision (defined in spec)
+//
+#define EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION 0x01
+
+#pragma pack()
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/PeImage.h b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/PeImage.h
new file mode 100644
index 000000000..f17b8ee19
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/PeImage.h
@@ -0,0 +1,766 @@
+/** @file
+ EFI image format for PE32+. Please note some data structures are different
+ for IA-32 and Itanium-based images, look for UINTN and the #ifdef EFI_IA64
+
+ @bug Fix text - doc as defined in MSFT EFI specification.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
+ Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PE_IMAGE_H__
+#define __PE_IMAGE_H__
+
+//
+// PE32+ Subsystem type for EFI images
+//
+#define EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION 10
+#define EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
+#define EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
+#define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER 13
+
+//
+// BugBug: Need to get a real answer for this problem. This is not in the
+// PE specification.
+//
+// A SAL runtime driver does not get fixed up when a transition to
+// virtual mode is made. In all other cases it should be treated
+// like a EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER image
+//
+#define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER 13
+
+//
+// PE32+ Machine type for EFI images
+//
+#define IMAGE_FILE_MACHINE_I386 0x014c
+#define IMAGE_FILE_MACHINE_EBC 0x0EBC
+#define IMAGE_FILE_MACHINE_X64 0x8664
+#define IMAGE_FILE_MACHINE_ARM 0x01c0 // Thumb only
+#define IMAGE_FILE_MACHINE_ARMT 0x01c2 // 32bit Mixed ARM and Thumb/Thumb 2 Little Endian
+#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // 64bit ARM Architecture, Little Endian
+#define IMAGE_FILE_MACHINE_RISCV64 0x5064 // 64bit RISC-V ISA
+
+//
+// Support old names for backward compatible
+//
+#define EFI_IMAGE_MACHINE_IA32 IMAGE_FILE_MACHINE_I386
+#define EFI_IMAGE_MACHINE_EBC IMAGE_FILE_MACHINE_EBC
+#define EFI_IMAGE_MACHINE_X64 IMAGE_FILE_MACHINE_X64
+#define EFI_IMAGE_MACHINE_ARMT IMAGE_FILE_MACHINE_ARMT
+#define EFI_IMAGE_MACHINE_AARCH64 IMAGE_FILE_MACHINE_ARM64
+#define EFI_IMAGE_MACHINE_RISCV64 IMAGE_FILE_MACHINE_RISCV64
+
+#define EFI_IMAGE_DOS_SIGNATURE 0x5A4D // MZ
+#define EFI_IMAGE_OS2_SIGNATURE 0x454E // NE
+#define EFI_IMAGE_OS2_SIGNATURE_LE 0x454C // LE
+#define EFI_IMAGE_NT_SIGNATURE 0x00004550 // PE00
+#define EFI_IMAGE_EDOS_SIGNATURE 0x44454550 // PEED
+
+///
+/// PE images can start with an optional DOS header, so if an image is run
+/// under DOS it can print an error message.
+///
+typedef struct {
+ UINT16 e_magic; // Magic number
+ UINT16 e_cblp; // Bytes on last page of file
+ UINT16 e_cp; // Pages in file
+ UINT16 e_crlc; // Relocations
+ UINT16 e_cparhdr; // Size of header in paragraphs
+ UINT16 e_minalloc; // Minimum extra paragraphs needed
+ UINT16 e_maxalloc; // Maximum extra paragraphs needed
+ UINT16 e_ss; // Initial (relative) SS value
+ UINT16 e_sp; // Initial SP value
+ UINT16 e_csum; // Checksum
+ UINT16 e_ip; // Initial IP value
+ UINT16 e_cs; // Initial (relative) CS value
+ UINT16 e_lfarlc; // File address of relocation table
+ UINT16 e_ovno; // Overlay number
+ UINT16 e_res[4]; // Reserved words
+ UINT16 e_oemid; // OEM identifier (for e_oeminfo)
+ UINT16 e_oeminfo; // OEM information; e_oemid specific
+ UINT16 e_res2[10]; // Reserved words
+ UINT32 e_lfanew; // File address of new exe header
+} EFI_IMAGE_DOS_HEADER;
+
+///
+/// File header format.
+///
+typedef struct {
+ UINT16 Machine;
+ UINT16 NumberOfSections;
+ UINT32 TimeDateStamp;
+ UINT32 PointerToSymbolTable;
+ UINT32 NumberOfSymbols;
+ UINT16 SizeOfOptionalHeader;
+ UINT16 Characteristics;
+} EFI_IMAGE_FILE_HEADER;
+
+#define EFI_IMAGE_SIZEOF_FILE_HEADER 20
+
+#define EFI_IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file.
+#define EFI_IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references).
+#define EFI_IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file.
+#define EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file.
+#define EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020 // Supports addresses > 2-GB
+#define EFI_IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed.
+#define EFI_IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine.
+#define EFI_IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file
+#define EFI_IMAGE_FILE_SYSTEM 0x1000 // System File.
+#define EFI_IMAGE_FILE_DLL 0x2000 // File is a DLL.
+#define EFI_IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed.
+#define EFI_IMAGE_FILE_MACHINE_UNKNOWN 0
+#define EFI_IMAGE_FILE_MACHINE_I386 0x14c // Intel 386.
+#define EFI_IMAGE_FILE_MACHINE_R3000 0x162 // MIPS* little-endian, 0540 big-endian
+#define EFI_IMAGE_FILE_MACHINE_R4000 0x166 // MIPS* little-endian
+#define EFI_IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP*
+#define EFI_IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM* PowerPC Little-Endian
+#define EFI_IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine
+//
+// * Other names and brands may be claimed as the property of others.
+//
+
+///
+/// Directory format.
+///
+typedef struct {
+ UINT32 VirtualAddress;
+ UINT32 Size;
+} EFI_IMAGE_DATA_DIRECTORY;
+
+#define EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES 16
+
+typedef struct {
+ UINT16 Magic;
+ UINT8 MajorLinkerVersion;
+ UINT8 MinorLinkerVersion;
+ UINT32 SizeOfCode;
+ UINT32 SizeOfInitializedData;
+ UINT32 SizeOfUninitializedData;
+ UINT32 AddressOfEntryPoint;
+ UINT32 BaseOfCode;
+ UINT32 BaseOfData;
+ UINT32 BaseOfBss;
+ UINT32 GprMask;
+ UINT32 CprMask[4];
+ UINT32 GpValue;
+} EFI_IMAGE_ROM_OPTIONAL_HEADER;
+
+#define EFI_IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
+#define EFI_IMAGE_SIZEOF_ROM_OPTIONAL_HEADER sizeof (EFI_IMAGE_ROM_OPTIONAL_HEADER)
+
+typedef struct {
+ EFI_IMAGE_FILE_HEADER FileHeader;
+ EFI_IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
+} EFI_IMAGE_ROM_HEADERS;
+
+///
+/// @attention
+/// EFI_IMAGE_OPTIONAL_HEADER32 and EFI_IMAGE_OPTIONAL_HEADER64
+/// are for use ONLY by tools. All proper EFI code MUST use
+/// EFI_IMAGE_OPTIONAL_HEADER ONLY!!!
+///
+#define EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
+
+typedef struct {
+ //
+ // Standard fields.
+ //
+ UINT16 Magic;
+ UINT8 MajorLinkerVersion;
+ UINT8 MinorLinkerVersion;
+ UINT32 SizeOfCode;
+ UINT32 SizeOfInitializedData;
+ UINT32 SizeOfUninitializedData;
+ UINT32 AddressOfEntryPoint;
+ UINT32 BaseOfCode;
+ UINT32 BaseOfData;
+ //
+ // NT additional fields.
+ //
+ UINT32 ImageBase;
+ UINT32 SectionAlignment;
+ UINT32 FileAlignment;
+ UINT16 MajorOperatingSystemVersion;
+ UINT16 MinorOperatingSystemVersion;
+ UINT16 MajorImageVersion;
+ UINT16 MinorImageVersion;
+ UINT16 MajorSubsystemVersion;
+ UINT16 MinorSubsystemVersion;
+ UINT32 Win32VersionValue;
+ UINT32 SizeOfImage;
+ UINT32 SizeOfHeaders;
+ UINT32 CheckSum;
+ UINT16 Subsystem;
+ UINT16 DllCharacteristics;
+ UINT32 SizeOfStackReserve;
+ UINT32 SizeOfStackCommit;
+ UINT32 SizeOfHeapReserve;
+ UINT32 SizeOfHeapCommit;
+ UINT32 LoaderFlags;
+ UINT32 NumberOfRvaAndSizes;
+ EFI_IMAGE_DATA_DIRECTORY DataDirectory[EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES];
+} EFI_IMAGE_OPTIONAL_HEADER32;
+
+///
+/// @attention
+/// EFI_IMAGE_OPTIONAL_HEADER32 and EFI_IMAGE_OPTIONAL_HEADER64
+/// are for use ONLY by tools. All proper EFI code MUST use
+/// EFI_IMAGE_OPTIONAL_HEADER ONLY!!!
+///
+#define EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
+
+typedef struct {
+ //
+ // Standard fields.
+ //
+ UINT16 Magic;
+ UINT8 MajorLinkerVersion;
+ UINT8 MinorLinkerVersion;
+ UINT32 SizeOfCode;
+ UINT32 SizeOfInitializedData;
+ UINT32 SizeOfUninitializedData;
+ UINT32 AddressOfEntryPoint;
+ UINT32 BaseOfCode;
+ //
+ // NT additional fields.
+ //
+ UINT64 ImageBase;
+ UINT32 SectionAlignment;
+ UINT32 FileAlignment;
+ UINT16 MajorOperatingSystemVersion;
+ UINT16 MinorOperatingSystemVersion;
+ UINT16 MajorImageVersion;
+ UINT16 MinorImageVersion;
+ UINT16 MajorSubsystemVersion;
+ UINT16 MinorSubsystemVersion;
+ UINT32 Win32VersionValue;
+ UINT32 SizeOfImage;
+ UINT32 SizeOfHeaders;
+ UINT32 CheckSum;
+ UINT16 Subsystem;
+ UINT16 DllCharacteristics;
+ UINT64 SizeOfStackReserve;
+ UINT64 SizeOfStackCommit;
+ UINT64 SizeOfHeapReserve;
+ UINT64 SizeOfHeapCommit;
+ UINT32 LoaderFlags;
+ UINT32 NumberOfRvaAndSizes;
+ EFI_IMAGE_DATA_DIRECTORY DataDirectory[EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES];
+} EFI_IMAGE_OPTIONAL_HEADER64;
+
+///
+/// @attention
+/// EFI_IMAGE_NT_HEADERS32 and EFI_IMAGE_HEADERS64 are for use ONLY
+/// by tools. All proper EFI code MUST use EFI_IMAGE_NT_HEADERS ONLY!!!
+///
+typedef struct {
+ UINT32 Signature;
+ EFI_IMAGE_FILE_HEADER FileHeader;
+ EFI_IMAGE_OPTIONAL_HEADER32 OptionalHeader;
+} EFI_IMAGE_NT_HEADERS32;
+
+#define EFI_IMAGE_SIZEOF_NT_OPTIONAL32_HEADER sizeof (EFI_IMAGE_NT_HEADERS32)
+
+typedef struct {
+ UINT32 Signature;
+ EFI_IMAGE_FILE_HEADER FileHeader;
+ EFI_IMAGE_OPTIONAL_HEADER64 OptionalHeader;
+} EFI_IMAGE_NT_HEADERS64;
+
+#define EFI_IMAGE_SIZEOF_NT_OPTIONAL64_HEADER sizeof (EFI_IMAGE_NT_HEADERS64)
+
+//
+// Subsystem Values
+//
+#define EFI_IMAGE_SUBSYSTEM_UNKNOWN 0
+#define EFI_IMAGE_SUBSYSTEM_NATIVE 1
+#define EFI_IMAGE_SUBSYSTEM_WINDOWS_GUI 2
+#define EFI_IMAGE_SUBSYSTEM_WINDOWS_CUI 3.
+#define EFI_IMAGE_SUBSYSTEM_OS2_CUI 5
+#define EFI_IMAGE_SUBSYSTEM_POSIX_CUI 7
+
+//
+// Directory Entries
+//
+#define EFI_IMAGE_DIRECTORY_ENTRY_EXPORT 0
+#define EFI_IMAGE_DIRECTORY_ENTRY_IMPORT 1
+#define EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE 2
+#define EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
+#define EFI_IMAGE_DIRECTORY_ENTRY_SECURITY 4
+#define EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC 5
+#define EFI_IMAGE_DIRECTORY_ENTRY_DEBUG 6
+#define EFI_IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
+#define EFI_IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
+#define EFI_IMAGE_DIRECTORY_ENTRY_TLS 9
+#define EFI_IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
+
+//
+// Section header format.
+//
+#define EFI_IMAGE_SIZEOF_SHORT_NAME 8
+
+typedef struct {
+ UINT8 Name[EFI_IMAGE_SIZEOF_SHORT_NAME];
+ union {
+ UINT32 PhysicalAddress;
+ UINT32 VirtualSize;
+ } Misc;
+ UINT32 VirtualAddress;
+ UINT32 SizeOfRawData;
+ UINT32 PointerToRawData;
+ UINT32 PointerToRelocations;
+ UINT32 PointerToLinenumbers;
+ UINT16 NumberOfRelocations;
+ UINT16 NumberOfLinenumbers;
+ UINT32 Characteristics;
+} EFI_IMAGE_SECTION_HEADER;
+
+#define EFI_IMAGE_SIZEOF_SECTION_HEADER 40
+
+#define EFI_IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved.
+#define EFI_IMAGE_SCN_CNT_CODE 0x00000020
+#define EFI_IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
+#define EFI_IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
+
+#define EFI_IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved.
+#define EFI_IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information.
+#define EFI_IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image.
+#define EFI_IMAGE_SCN_LNK_COMDAT 0x00001000
+
+#define EFI_IMAGE_SCN_ALIGN_1BYTES 0x00100000
+#define EFI_IMAGE_SCN_ALIGN_2BYTES 0x00200000
+#define EFI_IMAGE_SCN_ALIGN_4BYTES 0x00300000
+#define EFI_IMAGE_SCN_ALIGN_8BYTES 0x00400000
+#define EFI_IMAGE_SCN_ALIGN_16BYTES 0x00500000
+#define EFI_IMAGE_SCN_ALIGN_32BYTES 0x00600000
+#define EFI_IMAGE_SCN_ALIGN_64BYTES 0x00700000
+
+#define EFI_IMAGE_SCN_MEM_DISCARDABLE 0x02000000
+#define EFI_IMAGE_SCN_MEM_NOT_CACHED 0x04000000
+#define EFI_IMAGE_SCN_MEM_NOT_PAGED 0x08000000
+#define EFI_IMAGE_SCN_MEM_SHARED 0x10000000
+#define EFI_IMAGE_SCN_MEM_EXECUTE 0x20000000
+#define EFI_IMAGE_SCN_MEM_READ 0x40000000
+#define EFI_IMAGE_SCN_MEM_WRITE 0x80000000
+
+///
+/// Symbol format.
+///
+#define EFI_IMAGE_SIZEOF_SYMBOL 18
+
+//
+// Section values.
+//
+// Symbols have a section number of the section in which they are
+// defined. Otherwise, section numbers have the following meanings:
+//
+#define EFI_IMAGE_SYM_UNDEFINED (UINT16) 0 // Symbol is undefined or is common.
+#define EFI_IMAGE_SYM_ABSOLUTE (UINT16) -1 // Symbol is an absolute value.
+#define EFI_IMAGE_SYM_DEBUG (UINT16) -2 // Symbol is a special debug item.
+//
+// Type (fundamental) values.
+//
+#define EFI_IMAGE_SYM_TYPE_NULL 0 // no type.
+#define EFI_IMAGE_SYM_TYPE_VOID 1 //
+#define EFI_IMAGE_SYM_TYPE_CHAR 2 // type character.
+#define EFI_IMAGE_SYM_TYPE_SHORT 3 // type short integer.
+#define EFI_IMAGE_SYM_TYPE_INT 4
+#define EFI_IMAGE_SYM_TYPE_LONG 5
+#define EFI_IMAGE_SYM_TYPE_FLOAT 6
+#define EFI_IMAGE_SYM_TYPE_DOUBLE 7
+#define EFI_IMAGE_SYM_TYPE_STRUCT 8
+#define EFI_IMAGE_SYM_TYPE_UNION 9
+#define EFI_IMAGE_SYM_TYPE_ENUM 10 // enumeration.
+#define EFI_IMAGE_SYM_TYPE_MOE 11 // member of enumeration.
+#define EFI_IMAGE_SYM_TYPE_BYTE 12
+#define EFI_IMAGE_SYM_TYPE_WORD 13
+#define EFI_IMAGE_SYM_TYPE_UINT 14
+#define EFI_IMAGE_SYM_TYPE_DWORD 15
+
+//
+// Type (derived) values.
+//
+#define EFI_IMAGE_SYM_DTYPE_NULL 0 // no derived type.
+#define EFI_IMAGE_SYM_DTYPE_POINTER 1
+#define EFI_IMAGE_SYM_DTYPE_FUNCTION 2
+#define EFI_IMAGE_SYM_DTYPE_ARRAY 3
+
+//
+// Storage classes.
+//
+#define EFI_IMAGE_SYM_CLASS_END_OF_FUNCTION (UINT8) -1
+#define EFI_IMAGE_SYM_CLASS_NULL 0
+#define EFI_IMAGE_SYM_CLASS_AUTOMATIC 1
+#define EFI_IMAGE_SYM_CLASS_EXTERNAL 2
+#define EFI_IMAGE_SYM_CLASS_STATIC 3
+#define EFI_IMAGE_SYM_CLASS_REGISTER 4
+#define EFI_IMAGE_SYM_CLASS_EXTERNAL_DEF 5
+#define EFI_IMAGE_SYM_CLASS_LABEL 6
+#define EFI_IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
+#define EFI_IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
+#define EFI_IMAGE_SYM_CLASS_ARGUMENT 9
+#define EFI_IMAGE_SYM_CLASS_STRUCT_TAG 10
+#define EFI_IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
+#define EFI_IMAGE_SYM_CLASS_UNION_TAG 12
+#define EFI_IMAGE_SYM_CLASS_TYPE_DEFINITION 13
+#define EFI_IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
+#define EFI_IMAGE_SYM_CLASS_ENUM_TAG 15
+#define EFI_IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
+#define EFI_IMAGE_SYM_CLASS_REGISTER_PARAM 17
+#define EFI_IMAGE_SYM_CLASS_BIT_FIELD 18
+#define EFI_IMAGE_SYM_CLASS_BLOCK 100
+#define EFI_IMAGE_SYM_CLASS_FUNCTION 101
+#define EFI_IMAGE_SYM_CLASS_END_OF_STRUCT 102
+#define EFI_IMAGE_SYM_CLASS_FILE 103
+#define EFI_IMAGE_SYM_CLASS_SECTION 104
+#define EFI_IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
+
+//
+// type packing constants
+//
+#define EFI_IMAGE_N_BTMASK 017
+#define EFI_IMAGE_N_TMASK 060
+#define EFI_IMAGE_N_TMASK1 0300
+#define EFI_IMAGE_N_TMASK2 0360
+#define EFI_IMAGE_N_BTSHFT 4
+#define EFI_IMAGE_N_TSHIFT 2
+
+//
+// Communal selection types.
+//
+#define EFI_IMAGE_COMDAT_SELECT_NODUPLICATES 1
+#define EFI_IMAGE_COMDAT_SELECT_ANY 2
+#define EFI_IMAGE_COMDAT_SELECT_SAME_SIZE 3
+#define EFI_IMAGE_COMDAT_SELECT_EXACT_MATCH 4
+#define EFI_IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
+
+#define EFI_IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
+#define EFI_IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
+#define EFI_IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
+
+///
+/// Relocation format.
+///
+typedef struct {
+ UINT32 VirtualAddress;
+ UINT32 SymbolTableIndex;
+ UINT16 Type;
+} EFI_IMAGE_RELOCATION;
+
+#define EFI_IMAGE_SIZEOF_RELOCATION 10
+
+//
+// I386 relocation types.
+//
+#define EFI_IMAGE_REL_I386_ABSOLUTE 0 // Reference is absolute, no relocation is necessary
+#define EFI_IMAGE_REL_I386_DIR16 01 // Direct 16-bit reference to the symbols virtual address
+#define EFI_IMAGE_REL_I386_REL16 02 // PC-relative 16-bit reference to the symbols virtual address
+#define EFI_IMAGE_REL_I386_DIR32 06 // Direct 32-bit reference to the symbols virtual address
+#define EFI_IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit reference to the symbols virtual address, base not included
+#define EFI_IMAGE_REL_I386_SEG12 09 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
+#define EFI_IMAGE_REL_I386_SECTION 010
+#define EFI_IMAGE_REL_I386_SECREL 011
+#define EFI_IMAGE_REL_I386_REL32 020 // PC-relative 32-bit reference to the symbols virtual address
+
+//
+// x64 processor relocation types.
+//
+#define IMAGE_REL_AMD64_ABSOLUTE 0x0000
+#define IMAGE_REL_AMD64_ADDR64 0x0001
+#define IMAGE_REL_AMD64_ADDR32 0x0002
+#define IMAGE_REL_AMD64_ADDR32NB 0x0003
+#define IMAGE_REL_AMD64_REL32 0x0004
+#define IMAGE_REL_AMD64_REL32_1 0x0005
+#define IMAGE_REL_AMD64_REL32_2 0x0006
+#define IMAGE_REL_AMD64_REL32_3 0x0007
+#define IMAGE_REL_AMD64_REL32_4 0x0008
+#define IMAGE_REL_AMD64_REL32_5 0x0009
+#define IMAGE_REL_AMD64_SECTION 0x000A
+#define IMAGE_REL_AMD64_SECREL 0x000B
+#define IMAGE_REL_AMD64_SECREL7 0x000C
+#define IMAGE_REL_AMD64_TOKEN 0x000D
+#define IMAGE_REL_AMD64_SREL32 0x000E
+#define IMAGE_REL_AMD64_PAIR 0x000F
+#define IMAGE_REL_AMD64_SSPAN32 0x0010
+
+///
+/// Based relocation format.
+///
+typedef struct {
+ UINT32 VirtualAddress;
+ UINT32 SizeOfBlock;
+} EFI_IMAGE_BASE_RELOCATION;
+
+#define EFI_IMAGE_SIZEOF_BASE_RELOCATION 8
+
+//
+// Based relocation types.
+//
+#define EFI_IMAGE_REL_BASED_ABSOLUTE 0
+#define EFI_IMAGE_REL_BASED_HIGH 1
+#define EFI_IMAGE_REL_BASED_LOW 2
+#define EFI_IMAGE_REL_BASED_HIGHLOW 3
+#define EFI_IMAGE_REL_BASED_HIGHADJ 4
+#define EFI_IMAGE_REL_BASED_MIPS_JMPADDR 5
+#define EFI_IMAGE_REL_BASED_ARM_MOV32A 5
+#define EFI_IMAGE_REL_BASED_RISCV_HI20 5
+#define EFI_IMAGE_REL_BASED_ARM_MOV32T 7
+#define EFI_IMAGE_REL_BASED_RISCV_LOW12I 7
+#define EFI_IMAGE_REL_BASED_RISCV_LOW12S 8
+#define EFI_IMAGE_REL_BASED_IA64_IMM64 9
+#define EFI_IMAGE_REL_BASED_DIR64 10
+
+
+///
+/// Line number format.
+///
+typedef struct {
+ union {
+ UINT32 SymbolTableIndex; // Symbol table index of function name if Linenumber is 0.
+ UINT32 VirtualAddress; // Virtual address of line number.
+ } Type;
+ UINT16 Linenumber; // Line number.
+} EFI_IMAGE_LINENUMBER;
+
+#define EFI_IMAGE_SIZEOF_LINENUMBER 6
+
+//
+// Archive format.
+//
+#define EFI_IMAGE_ARCHIVE_START_SIZE 8
+#define EFI_IMAGE_ARCHIVE_START "!<arch>\n"
+#define EFI_IMAGE_ARCHIVE_END "`\n"
+#define EFI_IMAGE_ARCHIVE_PAD "\n"
+#define EFI_IMAGE_ARCHIVE_LINKER_MEMBER "/ "
+#define EFI_IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
+
+typedef struct {
+ UINT8 Name[16]; // File member name - `/' terminated.
+ UINT8 Date[12]; // File member date - decimal.
+ UINT8 UserID[6]; // File member user id - decimal.
+ UINT8 GroupID[6]; // File member group id - decimal.
+ UINT8 Mode[8]; // File member mode - octal.
+ UINT8 Size[10]; // File member size - decimal.
+ UINT8 EndHeader[2]; // String to end header.
+} EFI_IMAGE_ARCHIVE_MEMBER_HEADER;
+
+#define EFI_IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
+
+//
+// DLL support.
+//
+
+///
+/// DLL Export Format
+///
+typedef struct {
+ UINT32 Characteristics;
+ UINT32 TimeDateStamp;
+ UINT16 MajorVersion;
+ UINT16 MinorVersion;
+ UINT32 Name;
+ UINT32 Base;
+ UINT32 NumberOfFunctions;
+ UINT32 NumberOfNames;
+ UINT32 AddressOfFunctions;
+ UINT32 AddressOfNames;
+ UINT32 AddressOfNameOrdinals;
+} EFI_IMAGE_EXPORT_DIRECTORY;
+
+///
+/// DLL support.
+/// Import Format
+///
+typedef struct {
+ UINT16 Hint;
+ UINT8 Name[1];
+} EFI_IMAGE_IMPORT_BY_NAME;
+
+typedef struct {
+ union {
+ UINT32 Function;
+ UINT32 Ordinal;
+ EFI_IMAGE_IMPORT_BY_NAME *AddressOfData;
+ } u1;
+} EFI_IMAGE_THUNK_DATA;
+
+#define EFI_IMAGE_ORDINAL_FLAG 0x80000000
+#define EFI_IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & EFI_IMAGE_ORDINAL_FLAG) != 0)
+#define EFI_IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
+
+typedef struct {
+ UINT32 Characteristics;
+ UINT32 TimeDateStamp;
+ UINT32 ForwarderChain;
+ UINT32 Name;
+ EFI_IMAGE_THUNK_DATA *FirstThunk;
+} EFI_IMAGE_IMPORT_DESCRIPTOR;
+
+///
+/// Debug Format
+///
+#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW 2
+
+typedef struct {
+ UINT32 Characteristics;
+ UINT32 TimeDateStamp;
+ UINT16 MajorVersion;
+ UINT16 MinorVersion;
+ UINT32 Type;
+ UINT32 SizeOfData;
+ UINT32 RVA;
+ UINT32 FileOffset;
+} EFI_IMAGE_DEBUG_DIRECTORY_ENTRY;
+
+#define CODEVIEW_SIGNATURE_NB10 0x3031424E // "NB10"
+typedef struct {
+ UINT32 Signature; // "NB10"
+ UINT32 Unknown;
+ UINT32 Unknown2;
+ UINT32 Unknown3;
+ //
+ // Filename of .PDB goes here
+ //
+} EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY;
+
+#define CODEVIEW_SIGNATURE_RSDS 0x53445352 // "RSDS"
+typedef struct {
+ UINT32 Signature; // "RSDS"
+ UINT32 Unknown;
+ UINT32 Unknown2;
+ UINT32 Unknown3;
+ UINT32 Unknown4;
+ UINT32 Unknown5;
+ //
+ // Filename of .PDB goes here
+ //
+} EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY;
+
+///
+/// Debug Data Structure defined by Apple Mach-O to Coff utility
+///
+#define CODEVIEW_SIGNATURE_MTOC SIGNATURE_32('M', 'T', 'O', 'C')
+typedef struct {
+ UINT32 Signature; ///< "MTOC"
+ EFI_GUID MachOUuid;
+ //
+ // Filename of .DLL (Mach-O with debug info) goes here
+ //
+} EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY;
+
+//
+// .pdata entries for X64
+//
+typedef struct {
+ UINT32 FunctionStartAddress;
+ UINT32 FunctionEndAddress;
+ UINT32 UnwindInfoAddress;
+} RUNTIME_FUNCTION;
+
+typedef struct {
+ UINT8 Version:3;
+ UINT8 Flags:5;
+ UINT8 SizeOfProlog;
+ UINT8 CountOfUnwindCodes;
+ UINT8 FrameRegister:4;
+ UINT8 FrameRegisterOffset:4;
+} UNWIND_INFO;
+
+///
+/// Resource format.
+///
+typedef struct {
+ UINT32 Characteristics;
+ UINT32 TimeDateStamp;
+ UINT16 MajorVersion;
+ UINT16 MinorVersion;
+ UINT16 NumberOfNamedEntries;
+ UINT16 NumberOfIdEntries;
+ //
+ // Array of EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY entries goes here.
+ //
+} EFI_IMAGE_RESOURCE_DIRECTORY;
+
+///
+/// Resource directory entry format.
+///
+typedef struct {
+ union {
+ struct {
+ UINT32 NameOffset:31;
+ UINT32 NameIsString:1;
+ } s;
+ UINT32 Id;
+ } u1;
+ union {
+ UINT32 OffsetToData;
+ struct {
+ UINT32 OffsetToDirectory:31;
+ UINT32 DataIsDirectory:1;
+ } s;
+ } u2;
+} EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY;
+
+///
+/// Resource directory entry for string.
+///
+typedef struct {
+ UINT16 Length;
+ CHAR16 String[1];
+} EFI_IMAGE_RESOURCE_DIRECTORY_STRING;
+
+///
+/// Resource directory entry for data array.
+///
+typedef struct {
+ UINT32 OffsetToData;
+ UINT32 Size;
+ UINT32 CodePage;
+ UINT32 Reserved;
+} EFI_IMAGE_RESOURCE_DATA_ENTRY;
+
+///
+/// Header format for TE images
+///
+typedef struct {
+ UINT16 Signature; // signature for TE format = "VZ"
+ UINT16 Machine; // from the original file header
+ UINT8 NumberOfSections; // from the original file header
+ UINT8 Subsystem; // from original optional header
+ UINT16 StrippedSize; // how many bytes we removed from the header
+ UINT32 AddressOfEntryPoint; // offset to entry point -- from original optional header
+ UINT32 BaseOfCode; // from original image -- required for ITP debug
+ UINT64 ImageBase; // from original file header
+ EFI_IMAGE_DATA_DIRECTORY DataDirectory[2]; // only base relocation and debug directory
+} EFI_TE_IMAGE_HEADER;
+
+#define EFI_TE_IMAGE_HEADER_SIGNATURE 0x5A56 // "VZ"
+
+//
+// Data directory indexes in our TE image header
+//
+#define EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC 0
+#define EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG 1
+
+
+//
+// Union of PE32, PE32+, and TE headers
+//
+typedef union {
+ EFI_IMAGE_NT_HEADERS32 Pe32;
+ EFI_IMAGE_NT_HEADERS64 Pe32Plus;
+ EFI_TE_IMAGE_HEADER Te;
+} EFI_IMAGE_OPTIONAL_HEADER_UNION;
+
+typedef union {
+ EFI_IMAGE_NT_HEADERS32 *Pe32;
+ EFI_IMAGE_NT_HEADERS64 *Pe32Plus;
+ EFI_TE_IMAGE_HEADER *Te;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *Union;
+} EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/pci22.h b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/pci22.h
new file mode 100644
index 000000000..b43d74885
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/pci22.h
@@ -0,0 +1,536 @@
+/** @file
+ Support for PCI 2.2 standard.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _PCI22_H
+#define _PCI22_H
+
+#define PCI_MAX_SEGMENT 0
+
+#define PCI_MAX_BUS 255
+
+#define PCI_MAX_DEVICE 31
+#define PCI_MAX_FUNC 7
+
+//
+// Command
+//
+#define PCI_VGA_PALETTE_SNOOP_DISABLED 0x20
+
+#pragma pack(push, 1)
+typedef struct {
+ UINT16 VendorId;
+ UINT16 DeviceId;
+ UINT16 Command;
+ UINT16 Status;
+ UINT8 RevisionID;
+ UINT8 ClassCode[3];
+ UINT8 CacheLineSize;
+ UINT8 LatencyTimer;
+ UINT8 HeaderType;
+ UINT8 BIST;
+} PCI_DEVICE_INDEPENDENT_REGION;
+
+typedef struct {
+ UINT32 Bar[6];
+ UINT32 CISPtr;
+ UINT16 SubsystemVendorID;
+ UINT16 SubsystemID;
+ UINT32 ExpansionRomBar;
+ UINT8 CapabilityPtr;
+ UINT8 Reserved1[3];
+ UINT32 Reserved2;
+ UINT8 InterruptLine;
+ UINT8 InterruptPin;
+ UINT8 MinGnt;
+ UINT8 MaxLat;
+} PCI_DEVICE_HEADER_TYPE_REGION;
+
+typedef struct {
+ PCI_DEVICE_INDEPENDENT_REGION Hdr;
+ PCI_DEVICE_HEADER_TYPE_REGION Device;
+} PCI_TYPE00;
+
+typedef struct {
+ UINT32 Bar[2];
+ UINT8 PrimaryBus;
+ UINT8 SecondaryBus;
+ UINT8 SubordinateBus;
+ UINT8 SecondaryLatencyTimer;
+ UINT8 IoBase;
+ UINT8 IoLimit;
+ UINT16 SecondaryStatus;
+ UINT16 MemoryBase;
+ UINT16 MemoryLimit;
+ UINT16 PrefetchableMemoryBase;
+ UINT16 PrefetchableMemoryLimit;
+ UINT32 PrefetchableBaseUpper32;
+ UINT32 PrefetchableLimitUpper32;
+ UINT16 IoBaseUpper16;
+ UINT16 IoLimitUpper16;
+ UINT8 CapabilityPtr;
+ UINT8 Reserved[3];
+ UINT32 ExpansionRomBAR;
+ UINT8 InterruptLine;
+ UINT8 InterruptPin;
+ UINT16 BridgeControl;
+} PCI_BRIDGE_CONTROL_REGISTER;
+
+typedef struct {
+ PCI_DEVICE_INDEPENDENT_REGION Hdr;
+ PCI_BRIDGE_CONTROL_REGISTER Bridge;
+} PCI_TYPE01;
+
+typedef union {
+ PCI_TYPE00 Device;
+ PCI_TYPE01 Bridge;
+} PCI_TYPE_GENERIC;
+
+typedef struct {
+ UINT32 CardBusSocketReg; // Cardbus Socket/ExCA Base
+ // Address Register
+ //
+ UINT16 Reserved;
+ UINT16 SecondaryStatus; // Secondary Status
+ UINT8 PciBusNumber; // PCI Bus Number
+ UINT8 CardBusBusNumber; // CardBus Bus Number
+ UINT8 SubordinateBusNumber; // Subordinate Bus Number
+ UINT8 CardBusLatencyTimer; // CardBus Latency Timer
+ UINT32 MemoryBase0; // Memory Base Register 0
+ UINT32 MemoryLimit0; // Memory Limit Register 0
+ UINT32 MemoryBase1;
+ UINT32 MemoryLimit1;
+ UINT32 IoBase0;
+ UINT32 IoLimit0; // I/O Base Register 0
+ UINT32 IoBase1; // I/O Limit Register 0
+ UINT32 IoLimit1;
+ UINT8 InterruptLine; // Interrupt Line
+ UINT8 InterruptPin; // Interrupt Pin
+ UINT16 BridgeControl; // Bridge Control
+} PCI_CARDBUS_CONTROL_REGISTER;
+
+//
+// Definitions of PCI class bytes and manipulation macros.
+//
+#define PCI_CLASS_OLD 0x00
+#define PCI_CLASS_OLD_OTHER 0x00
+#define PCI_CLASS_OLD_VGA 0x01
+
+#define PCI_CLASS_MASS_STORAGE 0x01
+#define PCI_CLASS_MASS_STORAGE_SCSI 0x00
+#define PCI_CLASS_MASS_STORAGE_IDE 0x01 // obsolete
+#define PCI_CLASS_IDE 0x01
+#define PCI_CLASS_MASS_STORAGE_FLOPPY 0x02
+#define PCI_CLASS_MASS_STORAGE_IPI 0x03
+#define PCI_CLASS_MASS_STORAGE_RAID 0x04
+#define PCI_CLASS_MASS_STORAGE_OTHER 0x80
+
+#define PCI_CLASS_NETWORK 0x02
+#define PCI_CLASS_NETWORK_ETHERNET 0x00
+#define PCI_CLASS_ETHERNET 0x00 // obsolete
+#define PCI_CLASS_NETWORK_TOKENRING 0x01
+#define PCI_CLASS_NETWORK_FDDI 0x02
+#define PCI_CLASS_NETWORK_ATM 0x03
+#define PCI_CLASS_NETWORK_ISDN 0x04
+#define PCI_CLASS_NETWORK_OTHER 0x80
+
+#define PCI_CLASS_DISPLAY 0x03
+#define PCI_CLASS_DISPLAY_CTRL 0x03 // obsolete
+#define PCI_CLASS_DISPLAY_VGA 0x00
+#define PCI_CLASS_VGA 0x00 // obsolete
+#define PCI_CLASS_DISPLAY_XGA 0x01
+#define PCI_CLASS_DISPLAY_3D 0x02
+#define PCI_CLASS_DISPLAY_OTHER 0x80
+#define PCI_CLASS_DISPLAY_GFX 0x80
+#define PCI_CLASS_GFX 0x80 // obsolete
+#define PCI_CLASS_BRIDGE 0x06
+#define PCI_CLASS_BRIDGE_HOST 0x00
+#define PCI_CLASS_BRIDGE_ISA 0x01
+#define PCI_CLASS_ISA 0x01 // obsolete
+#define PCI_CLASS_BRIDGE_EISA 0x02
+#define PCI_CLASS_BRIDGE_MCA 0x03
+#define PCI_CLASS_BRIDGE_P2P 0x04
+#define PCI_CLASS_BRIDGE_PCMCIA 0x05
+#define PCI_CLASS_BRIDGE_NUBUS 0x06
+#define PCI_CLASS_BRIDGE_CARDBUS 0x07
+#define PCI_CLASS_BRIDGE_RACEWAY 0x08
+#define PCI_CLASS_BRIDGE_ISA_PDECODE 0x80
+#define PCI_CLASS_ISA_POSITIVE_DECODE 0x80 // obsolete
+
+#define PCI_CLASS_SCC 0x07 // Simple communications controllers
+#define PCI_SUBCLASS_SERIAL 0x00
+#define PCI_IF_GENERIC_XT 0x00
+#define PCI_IF_16450 0x01
+#define PCI_IF_16550 0x02
+#define PCI_IF_16650 0x03
+#define PCI_IF_16750 0x04
+#define PCI_IF_16850 0x05
+#define PCI_IF_16950 0x06
+#define PCI_SUBCLASS_PARALLEL 0x01
+#define PCI_IF_PARALLEL_PORT 0x00
+#define PCI_IF_BI_DIR_PARALLEL_PORT 0x01
+#define PCI_IF_ECP_PARALLEL_PORT 0x02
+#define PCI_IF_1284_CONTROLLER 0x03
+#define PCI_IF_1284_DEVICE 0xFE
+#define PCI_SUBCLASS_MULTIPORT_SERIAL 0x02
+#define PCI_SUBCLASS_MODEM 0x03
+#define PCI_IF_GENERIC_MODEM 0x00
+#define PCI_IF_16450_MODEM 0x01
+#define PCI_IF_16550_MODEM 0x02
+#define PCI_IF_16650_MODEM 0x03
+#define PCI_IF_16750_MODEM 0x04
+#define PCI_SUBCLASS_OTHER 0x80
+
+#define PCI_CLASS_SYSTEM_PERIPHERAL 0x08
+#define PCI_SUBCLASS_PIC 0x00
+#define PCI_IF_8259_PIC 0x00
+#define PCI_IF_ISA_PIC 0x01
+#define PCI_IF_EISA_PIC 0x02
+#define PCI_IF_APIC_CONTROLLER 0x10 // I/O APIC interrupt controller , 32 byte none-prefetchable memory.
+#define PCI_IF_APIC_CONTROLLER2 0x20
+#define PCI_SUBCLASS_TIMER 0x02
+#define PCI_IF_8254_TIMER 0x00
+#define PCI_IF_ISA_TIMER 0x01
+#define PCI_EISA_TIMER 0x02
+#define PCI_SUBCLASS_RTC 0x03
+#define PCI_IF_GENERIC_RTC 0x00
+#define PCI_IF_ISA_RTC 0x00
+#define PCI_SUBCLASS_PNP_CONTROLLER 0x04 // HotPlug Controller
+
+#define PCI_CLASS_INPUT_DEVICE 0x09
+#define PCI_SUBCLASS_KEYBOARD 0x00
+#define PCI_SUBCLASS_PEN 0x01
+#define PCI_SUBCLASS_MOUSE_CONTROLLER 0x02
+#define PCI_SUBCLASS_SCAN_CONTROLLER 0x03
+#define PCI_SUBCLASS_GAMEPORT 0x04
+
+#define PCI_CLASS_DOCKING_STATION 0x0A
+
+#define PCI_CLASS_PROCESSOR 0x0B
+#define PCI_SUBCLASS_PROC_386 0x00
+#define PCI_SUBCLASS_PROC_486 0x01
+#define PCI_SUBCLASS_PROC_PENTIUM 0x02
+#define PCI_SUBCLASS_PROC_ALPHA 0x10
+#define PCI_SUBCLASS_PROC_POWERPC 0x20
+#define PCI_SUBCLASS_PROC_MIPS 0x30
+#define PCI_SUBCLASS_PROC_CO_PORC 0x40 // Co-Processor
+
+#define PCI_CLASS_SERIAL 0x0C
+#define PCI_CLASS_SERIAL_FIREWIRE 0x00
+#define PCI_CLASS_SERIAL_ACCESS_BUS 0x01
+#define PCI_CLASS_SERIAL_SSA 0x02
+#define PCI_CLASS_SERIAL_USB 0x03
+#define PCI_CLASS_SERIAL_FIBRECHANNEL 0x04
+#define PCI_CLASS_SERIAL_SMB 0x05
+
+#define PCI_CLASS_WIRELESS 0x0D
+#define PCI_SUBCLASS_IRDA 0x00
+#define PCI_SUBCLASS_IR 0x01
+#define PCI_SUBCLASS_RF 0x02
+
+#define PCI_CLASS_INTELLIGENT_IO 0x0E
+
+#define PCI_CLASS_SATELLITE 0x0F
+#define PCI_SUBCLASS_TV 0x01
+#define PCI_SUBCLASS_AUDIO 0x02
+#define PCI_SUBCLASS_VOICE 0x03
+#define PCI_SUBCLASS_DATA 0x04
+
+#define PCI_SECURITY_CONTROLLER 0x10 // Encryption and decryption controller
+#define PCI_SUBCLASS_NET_COMPUT 0x00
+#define PCI_SUBCLASS_ENTERTAINMENT 0x10
+
+#define PCI_CLASS_DPIO 0x11
+
+#define IS_CLASS1(_p, c) ((_p)->Hdr.ClassCode[2] == (c))
+#define IS_CLASS2(_p, c, s) (IS_CLASS1 (_p, c) && ((_p)->Hdr.ClassCode[1] == (s)))
+#define IS_CLASS3(_p, c, s, p) (IS_CLASS2 (_p, c, s) && ((_p)->Hdr.ClassCode[0] == (p)))
+
+#define IS_PCI_DISPLAY(_p) IS_CLASS1 (_p, PCI_CLASS_DISPLAY)
+#define IS_PCI_VGA(_p) IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, 0)
+#define IS_PCI_8514(_p) IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, 1)
+#define IS_PCI_GFX(_p) IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_GFX, 0)
+#define IS_PCI_OLD(_p) IS_CLASS1 (_p, PCI_CLASS_OLD)
+#define IS_PCI_OLD_VGA(_p) IS_CLASS2 (_p, PCI_CLASS_OLD, PCI_CLASS_OLD_VGA)
+#define IS_PCI_IDE(_p) IS_CLASS2 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_IDE)
+#define IS_PCI_SCSI(_p) IS_CLASS3 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_SCSI, 0)
+#define IS_PCI_RAID(_p) IS_CLASS3 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_RAID, 0)
+#define IS_PCI_LPC(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA, 0)
+#define IS_PCI_P2P(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, 0)
+#define IS_PCI_P2P_SUB(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, 1)
+#define IS_PCI_USB(_p) IS_CLASS2 (_p, PCI_CLASS_SERIAL, PCI_CLASS_SERIAL_USB)
+
+#define HEADER_TYPE_DEVICE 0x00
+#define HEADER_TYPE_PCI_TO_PCI_BRIDGE 0x01
+#define HEADER_TYPE_CARDBUS_BRIDGE 0x02
+
+#define HEADER_TYPE_MULTI_FUNCTION 0x80
+#define HEADER_LAYOUT_CODE 0x7f
+
+#define IS_PCI_BRIDGE(_p) (((_p)->Hdr.HeaderType & HEADER_LAYOUT_CODE) == (HEADER_TYPE_PCI_TO_PCI_BRIDGE))
+#define IS_CARDBUS_BRIDGE(_p) (((_p)->Hdr.HeaderType & HEADER_LAYOUT_CODE) == (HEADER_TYPE_CARDBUS_BRIDGE))
+#define IS_PCI_MULTI_FUNC(_p) ((_p)->Hdr.HeaderType & HEADER_TYPE_MULTI_FUNCTION)
+
+#define PCI_DEVICE_ROMBAR 0x30
+#define PCI_BRIDGE_ROMBAR 0x38
+
+#define PCI_MAX_BAR 0x0006
+#define PCI_MAX_CONFIG_OFFSET 0x0100
+
+#define PCI_VENDOR_ID_OFFSET 0x00
+#define PCI_DEVICE_ID_OFFSET 0x02
+#define PCI_COMMAND_OFFSET 0x04
+#define PCI_PRIMARY_STATUS_OFFSET 0x06
+#define PCI_REVISION_ID_OFFSET 0x08
+#define PCI_CLASSCODE_OFFSET 0x09
+#define PCI_CACHELINE_SIZE_OFFSET 0x0C
+#define PCI_LATENCY_TIMER_OFFSET 0x0D
+#define PCI_HEADER_TYPE_OFFSET 0x0E
+#define PCI_BIST_OFFSET 0x0F
+#define PCI_BASE_ADDRESSREG_OFFSET 0x10
+#define PCI_CARDBUS_CIS_OFFSET 0x28
+#define PCI_SVID_OFFSET 0x2C // SubSystem Vendor id
+#define PCI_SUBSYSTEM_VENDOR_ID_OFFSET 0x2C
+#define PCI_SID_OFFSET 0x2E // SubSystem ID
+#define PCI_SUBSYSTEM_ID_OFFSET 0x2E
+#define PCI_EXPANSION_ROM_BASE 0x30
+#define PCI_CAPBILITY_POINTER_OFFSET 0x34
+#define PCI_INT_LINE_OFFSET 0x3C // Interrupt Line Register
+#define PCI_INT_PIN_OFFSET 0x3D // Interrupt Pin Register
+#define PCI_MAXGNT_OFFSET 0x3E // Max Grant Register
+#define PCI_MAXLAT_OFFSET 0x3F // Max Latency Register
+
+#define PCI_BRIDGE_CONTROL_REGISTER_OFFSET 0x3E
+#define PCI_BRIDGE_STATUS_REGISTER_OFFSET 0x1E
+
+#define PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET 0x18
+#define PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET 0x19
+#define PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET 0x1a
+
+typedef union {
+ struct {
+ UINT32 Reg : 8;
+ UINT32 Func : 3;
+ UINT32 Dev : 5;
+ UINT32 Bus : 8;
+ UINT32 Reserved : 7;
+ UINT32 Enable : 1;
+ } Bits;
+ UINT32 Uint32;
+} PCI_CONFIG_ACCESS_CF8;
+
+#pragma pack()
+
+#define PCI_EXPANSION_ROM_HEADER_SIGNATURE 0xaa55
+#define PCI_DATA_STRUCTURE_SIGNATURE SIGNATURE_32 ('P', 'C', 'I', 'R')
+#define PCI_CODE_TYPE_PCAT_IMAGE 0x00
+#define PCI_CODE_TYPE_EFI_IMAGE 0x03
+#define EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED 0x0001
+
+#define EFI_PCI_COMMAND_IO_SPACE 0x0001
+#define EFI_PCI_COMMAND_MEMORY_SPACE 0x0002
+#define EFI_PCI_COMMAND_BUS_MASTER 0x0004
+#define EFI_PCI_COMMAND_SPECIAL_CYCLE 0x0008
+#define EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE 0x0010
+#define EFI_PCI_COMMAND_VGA_PALETTE_SNOOP 0x0020
+#define EFI_PCI_COMMAND_PARITY_ERROR_RESPOND 0x0040
+#define EFI_PCI_COMMAND_STEPPING_CONTROL 0x0080
+#define EFI_PCI_COMMAND_SERR 0x0100
+#define EFI_PCI_COMMAND_FAST_BACK_TO_BACK 0x0200
+
+#define EFI_PCI_BRIDGE_CONTROL_PARITY_ERROR_RESPONSE 0x0001
+#define EFI_PCI_BRIDGE_CONTROL_SERR 0x0002
+#define EFI_PCI_BRIDGE_CONTROL_ISA 0x0004
+#define EFI_PCI_BRIDGE_CONTROL_VGA 0x0008
+#define EFI_PCI_BRIDGE_CONTROL_VGA_16 0x0010
+#define EFI_PCI_BRIDGE_CONTROL_MASTER_ABORT 0x0020
+#define EFI_PCI_BRIDGE_CONTROL_RESET_SECONDARY_BUS 0x0040
+#define EFI_PCI_BRIDGE_CONTROL_FAST_BACK_TO_BACK 0x0080
+#define EFI_PCI_BRIDGE_CONTROL_PRIMARY_DISCARD_TIMER 0x0100
+#define EFI_PCI_BRIDGE_CONTROL_SECONDARY_DISCARD_TIMER 0x0200
+#define EFI_PCI_BRIDGE_CONTROL_TIMER_STATUS 0x0400
+#define EFI_PCI_BRIDGE_CONTROL_DISCARD_TIMER_SERR 0x0800
+
+//
+// Following are the PCI-CARDBUS bridge control bit
+//
+#define EFI_PCI_BRIDGE_CONTROL_IREQINT_ENABLE 0x0080
+#define EFI_PCI_BRIDGE_CONTROL_RANGE0_MEMORY_TYPE 0x0100
+#define EFI_PCI_BRIDGE_CONTROL_RANGE1_MEMORY_TYPE 0x0200
+#define EFI_PCI_BRIDGE_CONTROL_WRITE_POSTING_ENABLE 0x0400
+
+//
+// Following are the PCI status control bit
+//
+#define EFI_PCI_STATUS_CAPABILITY 0x0010
+#define EFI_PCI_STATUS_66MZ_CAPABLE 0x0020
+#define EFI_PCI_FAST_BACK_TO_BACK_CAPABLE 0x0080
+#define EFI_PCI_MASTER_DATA_PARITY_ERROR 0x0100
+
+#define EFI_PCI_CAPABILITY_PTR 0x34
+#define EFI_PCI_CARDBUS_BRIDGE_CAPABILITY_PTR 0x14
+
+#pragma pack(1)
+typedef struct {
+ UINT16 Signature; // 0xaa55
+ UINT8 Reserved[0x16];
+ UINT16 PcirOffset;
+} PCI_EXPANSION_ROM_HEADER;
+
+typedef struct {
+ UINT16 Signature; // 0xaa55
+ UINT8 Size512;
+ UINT8 InitEntryPoint[3];
+ UINT8 Reserved[0x12];
+ UINT16 PcirOffset;
+} EFI_LEGACY_EXPANSION_ROM_HEADER;
+
+typedef struct {
+ UINT32 Signature; // "PCIR"
+ UINT16 VendorId;
+ UINT16 DeviceId;
+ UINT16 Reserved0;
+ UINT16 Length;
+ UINT8 Revision;
+ UINT8 ClassCode[3];
+ UINT16 ImageLength;
+ UINT16 CodeRevision;
+ UINT8 CodeType;
+ UINT8 Indicator;
+ UINT16 Reserved1;
+} PCI_DATA_STRUCTURE;
+
+//
+// PCI Capability List IDs and records
+//
+#define EFI_PCI_CAPABILITY_ID_PMI 0x01
+#define EFI_PCI_CAPABILITY_ID_AGP 0x02
+#define EFI_PCI_CAPABILITY_ID_VPD 0x03
+#define EFI_PCI_CAPABILITY_ID_SLOTID 0x04
+#define EFI_PCI_CAPABILITY_ID_MSI 0x05
+#define EFI_PCI_CAPABILITY_ID_HOTPLUG 0x06
+#define EFI_PCI_CAPABILITY_ID_PCIX 0x07
+
+typedef struct {
+ UINT8 CapabilityID;
+ UINT8 NextItemPtr;
+} EFI_PCI_CAPABILITY_HDR;
+
+//
+// Capability EFI_PCI_CAPABILITY_ID_PMI
+//
+typedef struct {
+ EFI_PCI_CAPABILITY_HDR Hdr;
+ UINT16 PMC;
+ UINT16 PMCSR;
+ UINT8 BridgeExtention;
+ UINT8 Data;
+} EFI_PCI_CAPABILITY_PMI;
+
+//
+// Capability EFI_PCI_CAPABILITY_ID_AGP
+//
+typedef struct {
+ EFI_PCI_CAPABILITY_HDR Hdr;
+ UINT8 Rev;
+ UINT8 Reserved;
+ UINT32 Status;
+ UINT32 Command;
+} EFI_PCI_CAPABILITY_AGP;
+
+//
+// Capability EFI_PCI_CAPABILITY_ID_VPD
+//
+typedef struct {
+ EFI_PCI_CAPABILITY_HDR Hdr;
+ UINT16 AddrReg;
+ UINT32 DataReg;
+} EFI_PCI_CAPABILITY_VPD;
+
+//
+// Capability EFI_PCI_CAPABILITY_ID_SLOTID
+//
+typedef struct {
+ EFI_PCI_CAPABILITY_HDR Hdr;
+ UINT8 ExpnsSlotReg;
+ UINT8 ChassisNo;
+} EFI_PCI_CAPABILITY_SLOTID;
+
+//
+// Capability EFI_PCI_CAPABILITY_ID_MSI
+//
+typedef struct {
+ EFI_PCI_CAPABILITY_HDR Hdr;
+ UINT16 MsgCtrlReg;
+ UINT32 MsgAddrReg;
+ UINT16 MsgDataReg;
+} EFI_PCI_CAPABILITY_MSI32;
+
+typedef struct {
+ EFI_PCI_CAPABILITY_HDR Hdr;
+ UINT16 MsgCtrlReg;
+ UINT32 MsgAddrRegLsdw;
+ UINT32 MsgAddrRegMsdw;
+ UINT16 MsgDataReg;
+} EFI_PCI_CAPABILITY_MSI64;
+
+//
+// Capability EFI_PCI_CAPABILITY_ID_HOTPLUG
+//
+typedef struct {
+ EFI_PCI_CAPABILITY_HDR Hdr;
+ //
+ // not finished - fields need to go here
+ //
+} EFI_PCI_CAPABILITY_HOTPLUG;
+
+//
+// Capability EFI_PCI_CAPABILITY_ID_PCIX
+//
+typedef struct {
+ EFI_PCI_CAPABILITY_HDR Hdr;
+ UINT16 CommandReg;
+ UINT32 StatusReg;
+} EFI_PCI_CAPABILITY_PCIX;
+
+typedef struct {
+ EFI_PCI_CAPABILITY_HDR Hdr;
+ UINT16 SecStatusReg;
+ UINT32 StatusReg;
+ UINT32 SplitTransCtrlRegUp;
+ UINT32 SplitTransCtrlRegDn;
+} EFI_PCI_CAPABILITY_PCIX_BRDG;
+
+#define DEVICE_ID_NOCARE 0xFFFF
+
+#define PCI_ACPI_UNUSED 0
+#define PCI_BAR_NOCHANGE 0
+#define PCI_BAR_OLD_ALIGN 0xFFFFFFFFFFFFFFFFULL
+#define PCI_BAR_EVEN_ALIGN 0xFFFFFFFFFFFFFFFEULL
+#define PCI_BAR_SQUAD_ALIGN 0xFFFFFFFFFFFFFFFDULL
+#define PCI_BAR_DQUAD_ALIGN 0xFFFFFFFFFFFFFFFCULL
+
+#define PCI_BAR_IDX0 0x00
+#define PCI_BAR_IDX1 0x01
+#define PCI_BAR_IDX2 0x02
+#define PCI_BAR_IDX3 0x03
+#define PCI_BAR_IDX4 0x04
+#define PCI_BAR_IDX5 0x05
+#define PCI_BAR_ALL 0xFF
+
+#pragma pack(pop)
+
+//
+// NOTE: The following header files are included here for
+// compatibility consideration.
+//
+#include "pci23.h"
+#include "pci30.h"
+#include "EfiPci.h"
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/pci23.h b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/pci23.h
new file mode 100644
index 000000000..7b8cea3e8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/pci23.h
@@ -0,0 +1,18 @@
+/** @file
+ Support for PCI 2.3 standard.
+
+ Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _PCI23_H
+#define _PCI23_H
+
+//#include "pci22.h"
+
+#define PCI_EXP_MAX_CONFIG_OFFSET 0x1000
+#define EFI_PCI_CAPABILITY_ID_PCIEXP 0x10
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/pci30.h b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/pci30.h
new file mode 100644
index 000000000..e39df6da7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/IndustryStandard/pci30.h
@@ -0,0 +1,38 @@
+/** @file
+ Support for PCI 3.0 standard.
+
+ Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _PCI30_H
+#define _PCI30_H
+
+//#include "pci23.h"
+
+#define PCI_CLASS_MASS_STORAGE_SATADPA 0x06
+
+#pragma pack(push, 1)
+
+typedef struct {
+ UINT32 Signature; // "PCIR"
+ UINT16 VendorId;
+ UINT16 DeviceId;
+ UINT16 DeviceListOffset;
+ UINT16 Length;
+ UINT8 Revision;
+ UINT8 ClassCode[3];
+ UINT16 ImageLength;
+ UINT16 CodeRevision;
+ UINT8 CodeType;
+ UINT8 Indicator;
+ UINT16 MaxRuntimeImageLength;
+ UINT16 ConfigUtilityCodeHeaderOffset;
+ UINT16 DMTFCLPEntryPointOffset;
+} PCI_3_0_DATA_STRUCTURE;
+
+#pragma pack(pop)
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Protocol/DevicePath.h b/roms/edk2/BaseTools/Source/C/Include/Protocol/DevicePath.h
new file mode 100644
index 000000000..27f813579
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Protocol/DevicePath.h
@@ -0,0 +1,1404 @@
+/** @file
+ The device path protocol as defined in UEFI 2.0.
+
+ The device path represents a programmatic path to a device,
+ from a software point of view. The path must persist from boot to boot, so
+ it can not contain things like PCI bus numbers that change from boot to boot.
+
+Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __EFI_DEVICE_PATH_H__
+#define __EFI_DEVICE_PATH_H__
+
+#include <Guid/PcAnsi.h>
+#include <IndustryStandard/Acpi3_0.h>
+#include <IndustryStandard/Bluetooth.h>
+
+///
+/// Device Path protocol.
+///
+#define EFI_DEVICE_PATH_PROTOCOL_GUID \
+ { \
+ 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
+ }
+
+///
+/// Device Path guid definition for backward-compatible with EFI1.1.
+///
+#define DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH_PROTOCOL_GUID
+
+#pragma pack(1)
+
+#if defined(_MSC_EXTENSIONS)
+//
+// Disable warning when last field of data structure is a zero sized array.
+//
+#pragma warning ( disable : 4200 )
+#endif
+
+/**
+ This protocol can be used on any device handle to obtain generic path/location
+ information concerning the physical device or logical device. If the handle does
+ not logically map to a physical device, the handle may not necessarily support
+ the device path protocol. The device path describes the location of the device
+ the handle is for. The size of the Device Path can be determined from the structures
+ that make up the Device Path.
+**/
+typedef struct {
+ UINT8 Type; ///< 0x01 Hardware Device Path.
+ ///< 0x02 ACPI Device Path.
+ ///< 0x03 Messaging Device Path.
+ ///< 0x04 Media Device Path.
+ ///< 0x05 BIOS Boot Specification Device Path.
+ ///< 0x7F End of Hardware Device Path.
+
+ UINT8 SubType; ///< Varies by Type
+ ///< 0xFF End Entire Device Path, or
+ ///< 0x01 End This Instance of a Device Path and start a new
+ ///< Device Path.
+
+ UINT8 Length[2]; ///< Specific Device Path data. Type and Sub-Type define
+ ///< type of data. Size of data is included in Length.
+
+} EFI_DEVICE_PATH_PROTOCOL;
+
+///
+/// Device Path protocol definition for backward-compatible with EFI1.1.
+///
+typedef EFI_DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH;
+
+///
+/// Hardware Device Paths.
+///
+#define HARDWARE_DEVICE_PATH 0x01
+
+///
+/// PCI Device Path SubType.
+///
+#define HW_PCI_DP 0x01
+
+///
+/// PCI Device Path.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// PCI Function Number.
+ ///
+ UINT8 Function;
+ ///
+ /// PCI Device Number.
+ ///
+ UINT8 Device;
+} PCI_DEVICE_PATH;
+
+///
+/// PCCARD Device Path SubType.
+///
+#define HW_PCCARD_DP 0x02
+
+///
+/// PCCARD Device Path.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Function Number (0 = First Function).
+ ///
+ UINT8 FunctionNumber;
+} PCCARD_DEVICE_PATH;
+
+///
+/// Memory Mapped Device Path SubType.
+///
+#define HW_MEMMAP_DP 0x03
+
+///
+/// Memory Mapped Device Path.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// EFI_MEMORY_TYPE
+ ///
+ UINT32 MemoryType;
+ ///
+ /// Starting Memory Address.
+ ///
+ EFI_PHYSICAL_ADDRESS StartingAddress;
+ ///
+ /// Ending Memory Address.
+ ///
+ EFI_PHYSICAL_ADDRESS EndingAddress;
+} MEMMAP_DEVICE_PATH;
+
+///
+/// Hardware Vendor Device Path SubType.
+///
+#define HW_VENDOR_DP 0x04
+
+///
+/// The Vendor Device Path allows the creation of vendor-defined Device Paths. A vendor must
+/// allocate a Vendor GUID for a Device Path. The Vendor GUID can then be used to define the
+/// contents on the n bytes that follow in the Vendor Device Path node.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Vendor-assigned GUID that defines the data that follows.
+ ///
+ EFI_GUID Guid;
+ ///
+ /// Vendor-defined variable size data.
+ ///
+} VENDOR_DEVICE_PATH;
+
+///
+/// Controller Device Path SubType.
+///
+#define HW_CONTROLLER_DP 0x05
+
+///
+/// Controller Device Path.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Controller number.
+ ///
+ UINT32 ControllerNumber;
+} CONTROLLER_DEVICE_PATH;
+
+///
+/// BMC Device Path SubType.
+///
+#define HW_BMC_DP 0x06
+
+///
+/// BMC Device Path.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Interface Type.
+ ///
+ UINT8 InterfaceType;
+ ///
+ /// Base Address.
+ ///
+ UINT8 BaseAddress[8];
+} BMC_DEVICE_PATH;
+
+///
+/// ACPI Device Paths.
+///
+#define ACPI_DEVICE_PATH 0x02
+
+///
+/// ACPI Device Path SubType.
+///
+#define ACPI_DP 0x01
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Device's PnP hardware ID stored in a numeric 32-bit
+ /// compressed EISA-type ID. This value must match the
+ /// corresponding _HID in the ACPI name space.
+ ///
+ UINT32 HID;
+ ///
+ /// Unique ID that is required by ACPI if two devices have the
+ /// same _HID. This value must also match the corresponding
+ /// _UID/_HID pair in the ACPI name space. Only the 32-bit
+ /// numeric value type of _UID is supported. Thus, strings must
+ /// not be used for the _UID in the ACPI name space.
+ ///
+ UINT32 UID;
+} ACPI_HID_DEVICE_PATH;
+
+///
+/// Expanded ACPI Device Path SubType.
+///
+#define ACPI_EXTENDED_DP 0x02
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Device's PnP hardware ID stored in a numeric 32-bit
+ /// compressed EISA-type ID. This value must match the
+ /// corresponding _HID in the ACPI name space.
+ ///
+ UINT32 HID;
+ ///
+ /// Unique ID that is required by ACPI if two devices have the
+ /// same _HID. This value must also match the corresponding
+ /// _UID/_HID pair in the ACPI name space.
+ ///
+ UINT32 UID;
+ ///
+ /// Device's compatible PnP hardware ID stored in a numeric
+ /// 32-bit compressed EISA-type ID. This value must match at
+ /// least one of the compatible device IDs returned by the
+ /// corresponding _CID in the ACPI name space.
+ ///
+ UINT32 CID;
+ ///
+ /// Optional variable length _HIDSTR.
+ /// Optional variable length _UIDSTR.
+ /// Optional variable length _CIDSTR.
+ ///
+} ACPI_EXTENDED_HID_DEVICE_PATH;
+
+//
+// EISA ID Macro
+// EISA ID Definition 32-bits
+// bits[15:0] - three character compressed ASCII EISA ID.
+// bits[31:16] - binary number
+// Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
+//
+#define PNP_EISA_ID_CONST 0x41d0
+#define EISA_ID(_Name, _Num) ((UINT32)((_Name) | (_Num) << 16))
+#define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
+#define EFI_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
+
+#define PNP_EISA_ID_MASK 0xffff
+#define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)
+
+///
+/// ACPI _ADR Device Path SubType.
+///
+#define ACPI_ADR_DP 0x03
+
+///
+/// The _ADR device path is used to contain video output device attributes to support the Graphics
+/// Output Protocol. The device path can contain multiple _ADR entries if multiple video output
+/// devices are displaying the same output.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// _ADR value. For video output devices the value of this
+ /// field comes from Table B-2 of the ACPI 3.0 specification. At
+ /// least one _ADR value is required.
+ ///
+ UINT32 ADR;
+ //
+ // This device path may optionally contain more than one _ADR entry.
+ //
+} ACPI_ADR_DEVICE_PATH;
+
+#define ACPI_ADR_DISPLAY_TYPE_OTHER 0
+#define ACPI_ADR_DISPLAY_TYPE_VGA 1
+#define ACPI_ADR_DISPLAY_TYPE_TV 2
+#define ACPI_ADR_DISPLAY_TYPE_EXTERNAL_DIGITAL 3
+#define ACPI_ADR_DISPLAY_TYPE_INTERNAL_DIGITAL 4
+
+#define ACPI_DISPLAY_ADR(_DeviceIdScheme, _HeadId, _NonVgaOutput, _BiosCanDetect, _VendorInfo, _Type, _Port, _Index) \
+ ((UINT32)( ((UINT32)((_DeviceIdScheme) & 0x1) << 31) | \
+ (((_HeadId) & 0x7) << 18) | \
+ (((_NonVgaOutput) & 0x1) << 17) | \
+ (((_BiosCanDetect) & 0x1) << 16) | \
+ (((_VendorInfo) & 0xf) << 12) | \
+ (((_Type) & 0xf) << 8) | \
+ (((_Port) & 0xf) << 4) | \
+ ((_Index) & 0xf) ))
+
+///
+/// Messaging Device Paths.
+/// This Device Path is used to describe the connection of devices outside the resource domain of the
+/// system. This Device Path can describe physical messaging information like SCSI ID, or abstract
+/// information like networking protocol IP addresses.
+///
+#define MESSAGING_DEVICE_PATH 0x03
+
+///
+/// ATAPI Device Path SubType
+///
+#define MSG_ATAPI_DP 0x01
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Set to zero for primary, or one for secondary.
+ ///
+ UINT8 PrimarySecondary;
+ ///
+ /// Set to zero for master, or one for slave mode.
+ ///
+ UINT8 SlaveMaster;
+ ///
+ /// Logical Unit Number.
+ ///
+ UINT16 Lun;
+} ATAPI_DEVICE_PATH;
+
+///
+/// SCSI Device Path SubType.
+///
+#define MSG_SCSI_DP 0x02
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Target ID on the SCSI bus (PUN).
+ ///
+ UINT16 Pun;
+ ///
+ /// Logical Unit Number (LUN).
+ ///
+ UINT16 Lun;
+} SCSI_DEVICE_PATH;
+
+///
+/// Fibre Channel SubType.
+///
+#define MSG_FIBRECHANNEL_DP 0x03
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Reserved for the future.
+ ///
+ UINT32 Reserved;
+ ///
+ /// Fibre Channel World Wide Number.
+ ///
+ UINT64 WWN;
+ ///
+ /// Fibre Channel Logical Unit Number.
+ ///
+ UINT64 Lun;
+} FIBRECHANNEL_DEVICE_PATH;
+
+///
+/// Fibre Channel Ex SubType.
+///
+#define MSG_FIBRECHANNELEX_DP 0x15
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Reserved for the future.
+ ///
+ UINT32 Reserved;
+ ///
+ /// 8 byte array containing Fibre Channel End Device Port Name.
+ ///
+ UINT8 WWN[8];
+ ///
+ /// 8 byte array containing Fibre Channel Logical Unit Number.
+ ///
+ UINT8 Lun[8];
+} FIBRECHANNELEX_DEVICE_PATH;
+
+///
+/// 1394 Device Path SubType
+///
+#define MSG_1394_DP 0x04
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Reserved for the future.
+ ///
+ UINT32 Reserved;
+ ///
+ /// 1394 Global Unique ID (GUID).
+ ///
+ UINT64 Guid;
+} F1394_DEVICE_PATH;
+
+///
+/// USB Device Path SubType.
+///
+#define MSG_USB_DP 0x05
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// USB Parent Port Number.
+ ///
+ UINT8 ParentPortNumber;
+ ///
+ /// USB Interface Number.
+ ///
+ UINT8 InterfaceNumber;
+} USB_DEVICE_PATH;
+
+///
+/// USB Class Device Path SubType.
+///
+#define MSG_USB_CLASS_DP 0x0f
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Vendor ID assigned by USB-IF. A value of 0xFFFF will
+ /// match any Vendor ID.
+ ///
+ UINT16 VendorId;
+ ///
+ /// Product ID assigned by USB-IF. A value of 0xFFFF will
+ /// match any Product ID.
+ ///
+ UINT16 ProductId;
+ ///
+ /// The class code assigned by the USB-IF. A value of 0xFF
+ /// will match any class code.
+ ///
+ UINT8 DeviceClass;
+ ///
+ /// The subclass code assigned by the USB-IF. A value of
+ /// 0xFF will match any subclass code.
+ ///
+ UINT8 DeviceSubClass;
+ ///
+ /// The protocol code assigned by the USB-IF. A value of
+ /// 0xFF will match any protocol code.
+ ///
+ UINT8 DeviceProtocol;
+} USB_CLASS_DEVICE_PATH;
+
+///
+/// USB WWID Device Path SubType.
+///
+#define MSG_USB_WWID_DP 0x10
+
+///
+/// This device path describes a USB device using its serial number.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// USB interface number.
+ ///
+ UINT16 InterfaceNumber;
+ ///
+ /// USB vendor id of the device.
+ ///
+ UINT16 VendorId;
+ ///
+ /// USB product id of the device.
+ ///
+ UINT16 ProductId;
+ ///
+ /// Last 64-or-fewer UTF-16 characters of the USB
+ /// serial number. The length of the string is
+ /// determined by the Length field less the offset of the
+ /// Serial Number field (10)
+ ///
+ /// CHAR16 SerialNumber[...];
+} USB_WWID_DEVICE_PATH;
+
+///
+/// Device Logical Unit SubType.
+///
+#define MSG_DEVICE_LOGICAL_UNIT_DP 0x11
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Logical Unit Number for the interface.
+ ///
+ UINT8 Lun;
+} DEVICE_LOGICAL_UNIT_DEVICE_PATH;
+
+///
+/// SATA Device Path SubType.
+///
+#define MSG_SATA_DP 0x12
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// The HBA port number that facilitates the connection to the
+ /// device or a port multiplier. The value 0xFFFF is reserved.
+ ///
+ UINT16 HBAPortNumber;
+ ///
+ /// The Port multiplier port number that facilitates the connection
+ /// to the device. Must be set to 0xFFFF if the device is directly
+ /// connected to the HBA.
+ ///
+ UINT16 PortMultiplierPortNumber;
+ ///
+ /// Logical Unit Number.
+ ///
+ UINT16 Lun;
+} SATA_DEVICE_PATH;
+
+///
+/// Flag for if the device is directly connected to the HBA.
+///
+#define SATA_HBA_DIRECT_CONNECT_FLAG 0x8000
+
+///
+/// I2O Device Path SubType.
+///
+#define MSG_I2O_DP 0x06
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Target ID (TID) for a device.
+ ///
+ UINT32 Tid;
+} I2O_DEVICE_PATH;
+
+///
+/// MAC Address Device Path SubType.
+///
+#define MSG_MAC_ADDR_DP 0x0b
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// The MAC address for a network interface padded with 0s.
+ ///
+ EFI_MAC_ADDRESS MacAddress;
+ ///
+ /// Network interface type(i.e. 802.3, FDDI).
+ ///
+ UINT8 IfType;
+} MAC_ADDR_DEVICE_PATH;
+
+///
+/// IPv4 Device Path SubType
+///
+#define MSG_IPv4_DP 0x0c
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// The local IPv4 address.
+ ///
+ EFI_IPv4_ADDRESS LocalIpAddress;
+ ///
+ /// The remote IPv4 address.
+ ///
+ EFI_IPv4_ADDRESS RemoteIpAddress;
+ ///
+ /// The local port number.
+ ///
+ UINT16 LocalPort;
+ ///
+ /// The remote port number.
+ ///
+ UINT16 RemotePort;
+ ///
+ /// The network protocol(i.e. UDP, TCP).
+ ///
+ UINT16 Protocol;
+ ///
+ /// 0x00 - The Source IP Address was assigned though DHCP.
+ /// 0x01 - The Source IP Address is statically bound.
+ ///
+ BOOLEAN StaticIpAddress;
+ ///
+ /// The gateway IP address
+ ///
+ EFI_IPv4_ADDRESS GatewayIpAddress;
+ ///
+ /// The subnet mask
+ ///
+ EFI_IPv4_ADDRESS SubnetMask;
+} IPv4_DEVICE_PATH;
+
+///
+/// IPv6 Device Path SubType.
+///
+#define MSG_IPv6_DP 0x0d
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// The local IPv6 address.
+ ///
+ EFI_IPv6_ADDRESS LocalIpAddress;
+ ///
+ /// The remote IPv6 address.
+ ///
+ EFI_IPv6_ADDRESS RemoteIpAddress;
+ ///
+ /// The local port number.
+ ///
+ UINT16 LocalPort;
+ ///
+ /// The remote port number.
+ ///
+ UINT16 RemotePort;
+ ///
+ /// The network protocol(i.e. UDP, TCP).
+ ///
+ UINT16 Protocol;
+ ///
+ /// 0x00 - The Local IP Address was manually configured.
+ /// 0x01 - The Local IP Address is assigned through IPv6
+ /// stateless auto-configuration.
+ /// 0x02 - The Local IP Address is assigned through IPv6
+ /// stateful configuration.
+ ///
+ UINT8 IpAddressOrigin;
+ ///
+ /// The prefix length
+ ///
+ UINT8 PrefixLength;
+ ///
+ /// The gateway IP address
+ ///
+ EFI_IPv6_ADDRESS GatewayIpAddress;
+} IPv6_DEVICE_PATH;
+
+///
+/// InfiniBand Device Path SubType.
+///
+#define MSG_INFINIBAND_DP 0x09
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Flags to help identify/manage InfiniBand device path elements:
+ /// Bit 0 - IOC/Service (0b = IOC, 1b = Service).
+ /// Bit 1 - Extend Boot Environment.
+ /// Bit 2 - Console Protocol.
+ /// Bit 3 - Storage Protocol.
+ /// Bit 4 - Network Protocol.
+ /// All other bits are reserved.
+ ///
+ UINT32 ResourceFlags;
+ ///
+ /// 128-bit Global Identifier for remote fabric port.
+ ///
+ UINT8 PortGid[16];
+ ///
+ /// 64-bit unique identifier to remote IOC or server process.
+ /// Interpretation of field specified by Resource Flags (bit 0).
+ ///
+ UINT64 ServiceId;
+ ///
+ /// 64-bit persistent ID of remote IOC port.
+ ///
+ UINT64 TargetPortId;
+ ///
+ /// 64-bit persistent ID of remote device.
+ ///
+ UINT64 DeviceId;
+} INFINIBAND_DEVICE_PATH;
+
+#define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE 0x01
+#define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT 0x02
+#define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL 0x04
+#define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL 0x08
+#define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL 0x10
+
+///
+/// UART Device Path SubType.
+///
+#define MSG_UART_DP 0x0e
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Reserved.
+ ///
+ UINT32 Reserved;
+ ///
+ /// The baud rate setting for the UART style device. A value of 0
+ /// means that the device's default baud rate will be used.
+ ///
+ UINT64 BaudRate;
+ ///
+ /// The number of data bits for the UART style device. A value
+ /// of 0 means that the device's default number of data bits will be used.
+ ///
+ UINT8 DataBits;
+ ///
+ /// The parity setting for the UART style device.
+ /// Parity 0x00 - Default Parity.
+ /// Parity 0x01 - No Parity.
+ /// Parity 0x02 - Even Parity.
+ /// Parity 0x03 - Odd Parity.
+ /// Parity 0x04 - Mark Parity.
+ /// Parity 0x05 - Space Parity.
+ ///
+ UINT8 Parity;
+ ///
+ /// The number of stop bits for the UART style device.
+ /// Stop Bits 0x00 - Default Stop Bits.
+ /// Stop Bits 0x01 - 1 Stop Bit.
+ /// Stop Bits 0x02 - 1.5 Stop Bits.
+ /// Stop Bits 0x03 - 2 Stop Bits.
+ ///
+ UINT8 StopBits;
+} UART_DEVICE_PATH;
+
+///
+/// NVDIMM Namespace Device Path SubType.
+///
+#define NVDIMM_NAMESPACE_DP 0x20
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Namespace unique label identifier UUID.
+ ///
+ EFI_GUID Uuid;
+} NVDIMM_NAMESPACE_DEVICE_PATH;
+
+//
+// Use VENDOR_DEVICE_PATH struct
+//
+#define MSG_VENDOR_DP 0x0a
+typedef VENDOR_DEVICE_PATH VENDOR_DEFINED_DEVICE_PATH;
+
+#define DEVICE_PATH_MESSAGING_PC_ANSI EFI_PC_ANSI_GUID
+#define DEVICE_PATH_MESSAGING_VT_100 EFI_VT_100_GUID
+#define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID
+#define DEVICE_PATH_MESSAGING_VT_UTF8 EFI_VT_UTF8_GUID
+
+///
+/// A new device path node is defined to declare flow control characteristics.
+/// UART Flow Control Messaging Device Path
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL GUID.
+ ///
+ EFI_GUID Guid;
+ ///
+ /// Bitmap of supported flow control types.
+ /// Bit 0 set indicates hardware flow control.
+ /// Bit 1 set indicates Xon/Xoff flow control.
+ /// All other bits are reserved and are clear.
+ ///
+ UINT32 FlowControlMap;
+} UART_FLOW_CONTROL_DEVICE_PATH;
+
+#define UART_FLOW_CONTROL_HARDWARE 0x00000001
+#define UART_FLOW_CONTROL_XON_XOFF 0x00000010
+
+#define DEVICE_PATH_MESSAGING_SAS EFI_SAS_DEVICE_PATH_GUID
+///
+/// Serial Attached SCSI (SAS) Device Path.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// DEVICE_PATH_MESSAGING_SAS GUID.
+ ///
+ EFI_GUID Guid;
+ ///
+ /// Reserved for future use.
+ ///
+ UINT32 Reserved;
+ ///
+ /// SAS Address for Serial Attached SCSI Target.
+ ///
+ UINT64 SasAddress;
+ ///
+ /// SAS Logical Unit Number.
+ ///
+ UINT64 Lun;
+ ///
+ /// More Information about the device and its interconnect.
+ ///
+ UINT16 DeviceTopology;
+ ///
+ /// Relative Target Port (RTP).
+ ///
+ UINT16 RelativeTargetPort;
+} SAS_DEVICE_PATH;
+
+///
+/// Serial Attached SCSI (SAS) Ex Device Path SubType
+///
+#define MSG_SASEX_DP 0x16
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// 8-byte array of the SAS Address for Serial Attached SCSI Target Port.
+ ///
+ UINT8 SasAddress[8];
+ ///
+ /// 8-byte array of the SAS Logical Unit Number.
+ ///
+ UINT8 Lun[8];
+ ///
+ /// More Information about the device and its interconnect.
+ ///
+ UINT16 DeviceTopology;
+ ///
+ /// Relative Target Port (RTP).
+ ///
+ UINT16 RelativeTargetPort;
+} SASEX_DEVICE_PATH;
+
+///
+/// NvmExpress Namespace Device Path SubType.
+///
+#define MSG_NVME_NAMESPACE_DP 0x17
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ UINT32 NamespaceId;
+ UINT64 NamespaceUuid;
+} NVME_NAMESPACE_DEVICE_PATH;
+
+///
+/// DNS Device Path SubType
+///
+#define MSG_DNS_DP 0x1F
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Indicates the DNS server address is IPv4 or IPv6 address.
+ ///
+ UINT8 IsIPv6;
+ ///
+ /// Instance of the DNS server address.
+ ///
+ EFI_IP_ADDRESS DnsServerIp[];
+} DNS_DEVICE_PATH;
+
+///
+/// Uniform Resource Identifiers (URI) Device Path SubType
+///
+#define MSG_URI_DP 0x18
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Instance of the URI pursuant to RFC 3986.
+ ///
+ CHAR8 Uri[];
+} URI_DEVICE_PATH;
+
+///
+/// Universal Flash Storage (UFS) Device Path SubType.
+///
+#define MSG_UFS_DP 0x19
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Target ID on the UFS bus (PUN).
+ ///
+ UINT8 Pun;
+ ///
+ /// Logical Unit Number (LUN).
+ ///
+ UINT8 Lun;
+} UFS_DEVICE_PATH;
+
+///
+/// SD (Secure Digital) Device Path SubType.
+///
+#define MSG_SD_DP 0x1A
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ UINT8 SlotNumber;
+} SD_DEVICE_PATH;
+
+///
+/// EMMC (Embedded MMC) Device Path SubType.
+///
+#define MSG_EMMC_DP 0x1D
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ UINT8 SlotNumber;
+} EMMC_DEVICE_PATH;
+
+///
+/// iSCSI Device Path SubType
+///
+#define MSG_ISCSI_DP 0x13
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Network Protocol (0 = TCP, 1+ = reserved).
+ ///
+ UINT16 NetworkProtocol;
+ ///
+ /// iSCSI Login Options.
+ ///
+ UINT16 LoginOption;
+ ///
+ /// iSCSI Logical Unit Number.
+ ///
+ UINT64 Lun;
+ ///
+ /// iSCSI Target Portal group tag the initiator intends
+ /// to establish a session with.
+ ///
+ UINT16 TargetPortalGroupTag;
+ ///
+ /// iSCSI NodeTarget Name. The length of the name
+ /// is determined by subtracting the offset of this field from Length.
+ ///
+ /// CHAR8 iSCSI Target Name.
+} ISCSI_DEVICE_PATH;
+
+#define ISCSI_LOGIN_OPTION_NO_HEADER_DIGEST 0x0000
+#define ISCSI_LOGIN_OPTION_HEADER_DIGEST_USING_CRC32C 0x0002
+#define ISCSI_LOGIN_OPTION_NO_DATA_DIGEST 0x0000
+#define ISCSI_LOGIN_OPTION_DATA_DIGEST_USING_CRC32C 0x0008
+#define ISCSI_LOGIN_OPTION_AUTHMETHOD_CHAP 0x0000
+#define ISCSI_LOGIN_OPTION_AUTHMETHOD_NON 0x1000
+#define ISCSI_LOGIN_OPTION_CHAP_BI 0x0000
+#define ISCSI_LOGIN_OPTION_CHAP_UNI 0x2000
+
+///
+/// VLAN Device Path SubType.
+///
+#define MSG_VLAN_DP 0x14
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// VLAN identifier (0-4094).
+ ///
+ UINT16 VlanId;
+} VLAN_DEVICE_PATH;
+
+///
+/// Bluetooth Device Path SubType.
+///
+#define MSG_BLUETOOTH_DP 0x1b
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// 48bit Bluetooth device address.
+ ///
+ BLUETOOTH_ADDRESS BD_ADDR;
+} BLUETOOTH_DEVICE_PATH;
+
+///
+/// Wi-Fi Device Path SubType.
+///
+#define MSG_WIFI_DP 0x1C
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Service set identifier. A 32-byte octets string.
+ ///
+ UINT8 SSId[32];
+} WIFI_DEVICE_PATH;
+
+///
+/// Bluetooth LE Device Path SubType.
+///
+#define MSG_BLUETOOTH_LE_DP 0x1E
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ BLUETOOTH_LE_ADDRESS Address;
+} BLUETOOTH_LE_DEVICE_PATH;
+
+//
+// Media Device Path
+//
+#define MEDIA_DEVICE_PATH 0x04
+
+///
+/// Hard Drive Media Device Path SubType.
+///
+#define MEDIA_HARDDRIVE_DP 0x01
+
+///
+/// The Hard Drive Media Device Path is used to represent a partition on a hard drive.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Describes the entry in a partition table, starting with entry 1.
+ /// Partition number zero represents the entire device. Valid
+ /// partition numbers for a MBR partition are [1, 4]. Valid
+ /// partition numbers for a GPT partition are [1, NumberOfPartitionEntries].
+ ///
+ UINT32 PartitionNumber;
+ ///
+ /// Starting LBA of the partition on the hard drive.
+ ///
+ UINT64 PartitionStart;
+ ///
+ /// Size of the partition in units of Logical Blocks.
+ ///
+ UINT64 PartitionSize;
+ ///
+ /// Signature unique to this partition:
+ /// If SignatureType is 0, this field has to be initialized with 16 zeros.
+ /// If SignatureType is 1, the MBR signature is stored in the first 4 bytes of this field.
+ /// The other 12 bytes are initialized with zeros.
+ /// If SignatureType is 2, this field contains a 16 byte signature.
+ ///
+ UINT8 Signature[16];
+ ///
+ /// Partition Format: (Unused values reserved).
+ /// 0x01 - PC-AT compatible legacy MBR.
+ /// 0x02 - GUID Partition Table.
+ ///
+ UINT8 MBRType;
+ ///
+ /// Type of Disk Signature: (Unused values reserved).
+ /// 0x00 - No Disk Signature.
+ /// 0x01 - 32-bit signature from address 0x1b8 of the type 0x01 MBR.
+ /// 0x02 - GUID signature.
+ ///
+ UINT8 SignatureType;
+} HARDDRIVE_DEVICE_PATH;
+
+#define MBR_TYPE_PCAT 0x01
+#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
+
+#define NO_DISK_SIGNATURE 0x00
+#define SIGNATURE_TYPE_MBR 0x01
+#define SIGNATURE_TYPE_GUID 0x02
+
+///
+/// CD-ROM Media Device Path SubType.
+///
+#define MEDIA_CDROM_DP 0x02
+
+///
+/// The CD-ROM Media Device Path is used to define a system partition that exists on a CD-ROM.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Boot Entry number from the Boot Catalog. The Initial/Default entry is defined as zero.
+ ///
+ UINT32 BootEntry;
+ ///
+ /// Starting RBA of the partition on the medium. CD-ROMs use Relative logical Block Addressing.
+ ///
+ UINT64 PartitionStart;
+ ///
+ /// Size of the partition in units of Blocks, also called Sectors.
+ ///
+ UINT64 PartitionSize;
+} CDROM_DEVICE_PATH;
+
+//
+// Use VENDOR_DEVICE_PATH struct
+//
+#define MEDIA_VENDOR_DP 0x03 ///< Media vendor device path subtype.
+
+///
+/// File Path Media Device Path SubType
+///
+#define MEDIA_FILEPATH_DP 0x04
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// A NULL-terminated Path string including directory and file names.
+ ///
+ CHAR16 PathName[1];
+} FILEPATH_DEVICE_PATH;
+
+#define SIZE_OF_FILEPATH_DEVICE_PATH OFFSET_OF(FILEPATH_DEVICE_PATH,PathName)
+
+///
+/// Media Protocol Device Path SubType.
+///
+#define MEDIA_PROTOCOL_DP 0x05
+
+///
+/// The Media Protocol Device Path is used to denote the protocol that is being
+/// used in a device path at the location of the path specified.
+/// Many protocols are inherent to the style of device path.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// The ID of the protocol.
+ ///
+ EFI_GUID Protocol;
+} MEDIA_PROTOCOL_DEVICE_PATH;
+
+///
+/// PIWG Firmware File SubType.
+///
+#define MEDIA_PIWG_FW_FILE_DP 0x06
+
+///
+/// This device path is used by systems implementing the UEFI PI Specification 1.0 to describe a firmware file.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Firmware file name
+ ///
+ EFI_GUID FvFileName;
+} MEDIA_FW_VOL_FILEPATH_DEVICE_PATH;
+
+///
+/// PIWG Firmware Volume Device Path SubType.
+///
+#define MEDIA_PIWG_FW_VOL_DP 0x07
+
+///
+/// This device path is used by systems implementing the UEFI PI Specification 1.0 to describe a firmware volume.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Firmware volume name.
+ ///
+ EFI_GUID FvName;
+} MEDIA_FW_VOL_DEVICE_PATH;
+
+///
+/// Media relative offset range device path.
+///
+#define MEDIA_RELATIVE_OFFSET_RANGE_DP 0x08
+
+///
+/// Used to describe the offset range of media relative.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ UINT32 Reserved;
+ UINT64 StartingOffset;
+ UINT64 EndingOffset;
+} MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH;
+
+///
+/// This GUID defines a RAM Disk supporting a raw disk format in volatile memory.
+///
+#define EFI_VIRTUAL_DISK_GUID \
+ { \
+ 0x77AB535A, 0x45FC, 0x624B, {0x55, 0x60, 0xF7, 0xB2, 0x81, 0xD1, 0xF9, 0x6E } \
+ }
+
+extern EFI_GUID gEfiVirtualDiskGuid;
+
+///
+/// This GUID defines a RAM Disk supporting an ISO image in volatile memory.
+///
+#define EFI_VIRTUAL_CD_GUID \
+ { \
+ 0x3D5ABD30, 0x4175, 0x87CE, {0x6D, 0x64, 0xD2, 0xAD, 0xE5, 0x23, 0xC4, 0xBB } \
+ }
+extern EFI_GUID gEfiVirtualCdGuid;
+
+///
+/// This GUID defines a RAM Disk supporting a raw disk format in persistent memory.
+///
+#define EFI_PERSISTENT_VIRTUAL_DISK_GUID \
+ { \
+ 0x5CEA02C9, 0x4D07, 0x69D3, {0x26, 0x9F ,0x44, 0x96, 0xFB, 0xE0, 0x96, 0xF9 } \
+ }
+
+extern EFI_GUID gEfiPersistentVirtualDiskGuid;
+
+///
+/// This GUID defines a RAM Disk supporting an ISO image in persistent memory.
+///
+#define EFI_PERSISTENT_VIRTUAL_CD_GUID \
+ { \
+ 0x08018188, 0x42CD, 0xBB48, {0x10, 0x0F, 0x53, 0x87, 0xD5, 0x3D, 0xED, 0x3D } \
+ }
+
+extern EFI_GUID gEfiPersistentVirtualCdGuid;
+
+///
+/// Media ram disk device path.
+///
+#define MEDIA_RAM_DISK_DP 0x09
+
+///
+/// Used to describe the ram disk device path.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Starting Memory Address.
+ ///
+ UINT32 StartingAddr[2];
+ ///
+ /// Ending Memory Address.
+ ///
+ UINT32 EndingAddr[2];
+ ///
+ /// GUID that defines the type of the RAM Disk.
+ ///
+ EFI_GUID TypeGuid;
+ ///
+ /// RAM Diskinstance number, if supported. The default value is zero.
+ ///
+ UINT16 Instance;
+} MEDIA_RAM_DISK_DEVICE_PATH;
+
+///
+/// BIOS Boot Specification Device Path.
+///
+#define BBS_DEVICE_PATH 0x05
+
+///
+/// BIOS Boot Specification Device Path SubType.
+///
+#define BBS_BBS_DP 0x01
+
+///
+/// This Device Path is used to describe the booting of non-EFI-aware operating systems.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Device Type as defined by the BIOS Boot Specification.
+ ///
+ UINT16 DeviceType;
+ ///
+ /// Status Flags as defined by the BIOS Boot Specification.
+ ///
+ UINT16 StatusFlag;
+ ///
+ /// Null-terminated ASCII string that describes the boot device to a user.
+ ///
+ CHAR8 String[1];
+} BBS_BBS_DEVICE_PATH;
+
+//
+// DeviceType definitions - from BBS specification
+//
+#define BBS_TYPE_FLOPPY 0x01
+#define BBS_TYPE_HARDDRIVE 0x02
+#define BBS_TYPE_CDROM 0x03
+#define BBS_TYPE_PCMCIA 0x04
+#define BBS_TYPE_USB 0x05
+#define BBS_TYPE_EMBEDDED_NETWORK 0x06
+#define BBS_TYPE_BEV 0x80
+#define BBS_TYPE_UNKNOWN 0xFF
+
+
+///
+/// Union of all possible Device Paths and pointers to Device Paths.
+///
+typedef union {
+ EFI_DEVICE_PATH_PROTOCOL DevPath;
+ PCI_DEVICE_PATH Pci;
+ PCCARD_DEVICE_PATH PcCard;
+ MEMMAP_DEVICE_PATH MemMap;
+ VENDOR_DEVICE_PATH Vendor;
+
+ CONTROLLER_DEVICE_PATH Controller;
+ BMC_DEVICE_PATH Bmc;
+ ACPI_HID_DEVICE_PATH Acpi;
+ ACPI_EXTENDED_HID_DEVICE_PATH ExtendedAcpi;
+ ACPI_ADR_DEVICE_PATH AcpiAdr;
+
+ ATAPI_DEVICE_PATH Atapi;
+ SCSI_DEVICE_PATH Scsi;
+ ISCSI_DEVICE_PATH Iscsi;
+ FIBRECHANNEL_DEVICE_PATH FibreChannel;
+ FIBRECHANNELEX_DEVICE_PATH FibreChannelEx;
+
+ F1394_DEVICE_PATH F1394;
+ USB_DEVICE_PATH Usb;
+ SATA_DEVICE_PATH Sata;
+ USB_CLASS_DEVICE_PATH UsbClass;
+ USB_WWID_DEVICE_PATH UsbWwid;
+ DEVICE_LOGICAL_UNIT_DEVICE_PATH LogicUnit;
+ I2O_DEVICE_PATH I2O;
+ MAC_ADDR_DEVICE_PATH MacAddr;
+ IPv4_DEVICE_PATH Ipv4;
+ IPv6_DEVICE_PATH Ipv6;
+ VLAN_DEVICE_PATH Vlan;
+ INFINIBAND_DEVICE_PATH InfiniBand;
+ UART_DEVICE_PATH Uart;
+ UART_FLOW_CONTROL_DEVICE_PATH UartFlowControl;
+ SAS_DEVICE_PATH Sas;
+ SASEX_DEVICE_PATH SasEx;
+ NVME_NAMESPACE_DEVICE_PATH NvmeNamespace;
+ DNS_DEVICE_PATH Dns;
+ URI_DEVICE_PATH Uri;
+ BLUETOOTH_DEVICE_PATH Bluetooth;
+ WIFI_DEVICE_PATH WiFi;
+ UFS_DEVICE_PATH Ufs;
+ SD_DEVICE_PATH Sd;
+ EMMC_DEVICE_PATH Emmc;
+ HARDDRIVE_DEVICE_PATH HardDrive;
+ CDROM_DEVICE_PATH CD;
+
+ FILEPATH_DEVICE_PATH FilePath;
+ MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol;
+
+ MEDIA_FW_VOL_DEVICE_PATH FirmwareVolume;
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FirmwareFile;
+ MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH Offset;
+ MEDIA_RAM_DISK_DEVICE_PATH RamDisk;
+ BBS_BBS_DEVICE_PATH Bbs;
+} EFI_DEV_PATH;
+
+
+
+typedef union {
+ EFI_DEVICE_PATH_PROTOCOL *DevPath;
+ PCI_DEVICE_PATH *Pci;
+ PCCARD_DEVICE_PATH *PcCard;
+ MEMMAP_DEVICE_PATH *MemMap;
+ VENDOR_DEVICE_PATH *Vendor;
+
+ CONTROLLER_DEVICE_PATH *Controller;
+ BMC_DEVICE_PATH *Bmc;
+ ACPI_HID_DEVICE_PATH *Acpi;
+ ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi;
+ ACPI_ADR_DEVICE_PATH *AcpiAdr;
+
+ ATAPI_DEVICE_PATH *Atapi;
+ SCSI_DEVICE_PATH *Scsi;
+ ISCSI_DEVICE_PATH *Iscsi;
+ FIBRECHANNEL_DEVICE_PATH *FibreChannel;
+ FIBRECHANNELEX_DEVICE_PATH *FibreChannelEx;
+
+ F1394_DEVICE_PATH *F1394;
+ USB_DEVICE_PATH *Usb;
+ SATA_DEVICE_PATH *Sata;
+ USB_CLASS_DEVICE_PATH *UsbClass;
+ USB_WWID_DEVICE_PATH *UsbWwid;
+ DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicUnit;
+ I2O_DEVICE_PATH *I2O;
+ MAC_ADDR_DEVICE_PATH *MacAddr;
+ IPv4_DEVICE_PATH *Ipv4;
+ IPv6_DEVICE_PATH *Ipv6;
+ VLAN_DEVICE_PATH *Vlan;
+ INFINIBAND_DEVICE_PATH *InfiniBand;
+ UART_DEVICE_PATH *Uart;
+ UART_FLOW_CONTROL_DEVICE_PATH *UartFlowControl;
+ SAS_DEVICE_PATH *Sas;
+ SASEX_DEVICE_PATH *SasEx;
+ NVME_NAMESPACE_DEVICE_PATH *NvmeNamespace;
+ DNS_DEVICE_PATH *Dns;
+ URI_DEVICE_PATH *Uri;
+ BLUETOOTH_DEVICE_PATH *Bluetooth;
+ WIFI_DEVICE_PATH *WiFi;
+ UFS_DEVICE_PATH *Ufs;
+ SD_DEVICE_PATH *Sd;
+ EMMC_DEVICE_PATH *Emmc;
+ HARDDRIVE_DEVICE_PATH *HardDrive;
+ CDROM_DEVICE_PATH *CD;
+
+ FILEPATH_DEVICE_PATH *FilePath;
+ MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol;
+
+ MEDIA_FW_VOL_DEVICE_PATH *FirmwareVolume;
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FirmwareFile;
+ MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;
+ MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
+ BBS_BBS_DEVICE_PATH *Bbs;
+ UINT8 *Raw;
+} EFI_DEV_PATH_PTR;
+
+#define EFI_DEBUGPORT_PROTOCOL_GUID \
+ { \
+ 0xEBA4E8D2, 0x3858, 0x41EC, {0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 } \
+ }
+//
+// DEBUGPORT variable definitions...
+//
+#define EFI_DEBUGPORT_VARIABLE_NAME L"DEBUGPORT"
+#define EFI_DEBUGPORT_VARIABLE_GUID EFI_DEBUGPORT_PROTOCOL_GUID
+extern EFI_GUID gEfiDebugPortVariableGuid;
+
+//
+// DebugPort device path definitions...
+//
+#define DEVICE_PATH_MESSAGING_DEBUGPORT EFI_DEBUGPORT_PROTOCOL_GUID
+extern EFI_GUID gEfiDebugPortProtocolGuid;
+
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ EFI_GUID Guid;
+} DEBUGPORT_DEVICE_PATH;
+
+#pragma pack()
+
+#define END_DEVICE_PATH_TYPE 0x7f
+#define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xFF
+#define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01
+
+extern EFI_GUID gEfiDevicePathProtocolGuid;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Protocol/DevicePathUtilities.h b/roms/edk2/BaseTools/Source/C/Include/Protocol/DevicePathUtilities.h
new file mode 100644
index 000000000..b2fd6b283
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Protocol/DevicePathUtilities.h
@@ -0,0 +1,288 @@
+/** @file
+ EFI_DEVICE_PATH_UTILITIES_PROTOCOL as defined in UEFI 2.0.
+ Use to create and manipulate device paths and device nodes.
+
+ Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __DEVICE_PATH_UTILITIES_H__
+#define __DEVICE_PATH_UTILITIES_H__
+
+///
+/// Device Path Utilities protocol
+///
+#define EFI_DEVICE_PATH_UTILITIES_GUID \
+ { \
+ 0x379be4e, 0xd706, 0x437d, {0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } \
+ }
+
+/**
+ Returns the size of the device path, in bytes.
+
+ @param DevicePath Points to the start of the EFI device path.
+
+ @return Size Size of the specified device path, in bytes, including the end-of-path tag.
+ @retval 0 DevicePath is NULL
+
+**/
+typedef
+UINTN
+( *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE)(
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ );
+
+
+/**
+ Create a duplicate of the specified path.
+
+ @param DevicePath Points to the source EFI device path.
+
+ @retval Pointer A pointer to the duplicate device path.
+ @retval NULL insufficient memory or DevicePath is NULL
+
+**/
+typedef
+EFI_DEVICE_PATH_PROTOCOL*
+( *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH)(
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ );
+
+/**
+ Create a new path by appending the second device path to the first.
+ If Src1 is NULL and Src2 is non-NULL, then a duplicate of Src2 is returned.
+ If Src1 is non-NULL and Src2 is NULL, then a duplicate of Src1 is returned.
+ If Src1 and Src2 are both NULL, then a copy of an end-of-device-path is returned.
+
+ @param Src1 Points to the first device path.
+ @param Src2 Points to the second device path.
+
+ @retval Pointer A pointer to the newly created device path.
+ @retval NULL Memory could not be allocated
+
+**/
+typedef
+EFI_DEVICE_PATH_PROTOCOL*
+( *EFI_DEVICE_PATH_UTILS_APPEND_PATH)(
+ CONST EFI_DEVICE_PATH_PROTOCOL *Src1,
+ CONST EFI_DEVICE_PATH_PROTOCOL *Src2
+ );
+
+/**
+ Creates a new path by appending the device node to the device path.
+ If DeviceNode is NULL then a copy of DevicePath is returned.
+ If DevicePath is NULL then a copy of DeviceNode, followed by an end-of-device path device node is returned.
+ If both DeviceNode and DevicePath are NULL then a copy of an end-of-device-path device node is returned.
+
+ @param DevicePath Points to the device path.
+ @param DeviceNode Points to the device node.
+
+ @retval Pointer A pointer to the allocated device node.
+ @retval NULL There was insufficient memory.
+
+**/
+typedef
+EFI_DEVICE_PATH_PROTOCOL*
+( *EFI_DEVICE_PATH_UTILS_APPEND_NODE)(
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
+ );
+
+/**
+ Creates a new path by appending the specified device path instance to the specified device path.
+
+ @param DevicePath Points to the device path. If NULL, then ignored.
+ @param DevicePathInstance Points to the device path instance.
+
+ @retval Pointer A pointer to the newly created device path
+ @retval NULL Memory could not be allocated or DevicePathInstance is NULL.
+
+**/
+typedef
+EFI_DEVICE_PATH_PROTOCOL*
+( *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE)(
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
+ );
+
+/**
+ Creates a copy of the current device path instance and returns a pointer to the next device path
+ instance.
+
+ @param DevicePathInstance On input, this holds the pointer to the current device path
+ instance. On output, this holds the pointer to the next
+ device path instance or NULL if there are no more device
+ path instances in the device path.
+ @param DevicePathInstanceSize On output, this holds the size of the device path instance,
+ in bytes or zero, if DevicePathInstance is NULL.
+ If NULL, then the instance size is not output.
+
+ @retval Pointer A pointer to the copy of the current device path instance.
+ @retval NULL DevicePathInstance was NULL on entry or there was insufficient memory.
+
+**/
+typedef
+EFI_DEVICE_PATH_PROTOCOL*
+( *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE)(
+ EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
+ UINTN *DevicePathInstanceSize
+ );
+
+/**
+ Creates a device node
+
+ @param NodeType NodeType is the device node type (EFI_DEVICE_PATH.Type) for
+ the new device node.
+ @param NodeSubType NodeSubType is the device node sub-type
+ EFI_DEVICE_PATH.SubType) for the new device node.
+ @param NodeLength NodeLength is the length of the device node
+ (EFI_DEVICE_PATH.Length) for the new device node.
+
+ @retval Pointer A pointer to the newly created device node.
+ @retval NULL NodeLength is less than
+ the size of the header or there was insufficient memory.
+
+**/
+typedef
+EFI_DEVICE_PATH_PROTOCOL*
+( *EFI_DEVICE_PATH_UTILS_CREATE_NODE)(
+ UINT8 NodeType,
+ UINT8 NodeSubType,
+ UINT16 NodeLength
+);
+
+/**
+ Returns whether a device path is multi-instance.
+
+ @param DevicePath Points to the device path. If NULL, then ignored.
+
+ @retval TRUE The device path has more than one instance
+ @retval FALSE The device path is empty or contains only a single instance.
+
+**/
+typedef
+BOOLEAN
+( *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE)(
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ );
+
+///
+/// This protocol is used to creates and manipulates device paths and device nodes.
+///
+typedef struct {
+ EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;
+ EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath;
+ EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath;
+ EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode;
+ EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance;
+ EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance;
+ EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance;
+ EFI_DEVICE_PATH_UTILS_CREATE_NODE CreateDeviceNode;
+} EFI_DEVICE_PATH_UTILITIES_PROTOCOL;
+
+extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid;
+
+VOID
+SetDevicePathEndNode (
+ VOID *Node
+ );
+
+BOOLEAN
+IsDevicePathValid (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ UINTN MaxSize
+ );
+
+UINT8
+DevicePathType (
+ CONST VOID *Node
+ );
+
+UINT8
+DevicePathSubType (
+ CONST VOID *Node
+ );
+
+UINTN
+DevicePathNodeLength (
+ CONST VOID *Node
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+NextDevicePathNode (
+ CONST VOID *Node
+ );
+
+BOOLEAN
+IsDevicePathEndType (
+ CONST VOID *Node
+ );
+
+BOOLEAN
+IsDevicePathEnd (
+ CONST VOID *Node
+ );
+BOOLEAN
+IsDevicePathEndInstance (
+ CONST VOID *Node
+ );
+
+UINT16
+SetDevicePathNodeLength (
+ VOID *Node,
+ UINTN Length
+ );
+
+VOID
+SetDevicePathEndNode (
+ VOID *Node
+ );
+
+UINTN
+UefiDevicePathLibGetDevicePathSize (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibDuplicateDevicePath (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibAppendDevicePath (
+ CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,
+ CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibAppendDevicePathNode (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibAppendDevicePathInstance (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibGetNextDevicePathInstance (
+ EFI_DEVICE_PATH_PROTOCOL **DevicePath,
+ UINTN *Size
+ );
+
+EFI_DEVICE_PATH_PROTOCOL *
+UefiDevicePathLibCreateDeviceNode (
+ UINT8 NodeType,
+ UINT8 NodeSubType,
+ UINT16 NodeLength
+ );
+
+BOOLEAN
+UefiDevicePathLibIsDevicePathMultiInstance (
+ CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ );
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Protocol/GraphicsOutput.h b/roms/edk2/BaseTools/Source/C/Include/Protocol/GraphicsOutput.h
new file mode 100644
index 000000000..5a10ac72a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Protocol/GraphicsOutput.h
@@ -0,0 +1,187 @@
+/** @file
+ Graphics Output Protocol from the UEFI 2.0 specification.
+
+ Abstraction of a very simple graphics device.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __GRAPHICS_OUTPUT_H__
+#define __GRAPHICS_OUTPUT_H__
+
+#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
+ { \
+ 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \
+ }
+
+typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;
+
+typedef struct {
+ UINT32 RedMask;
+ UINT32 GreenMask;
+ UINT32 BlueMask;
+ UINT32 ReservedMask;
+} EFI_PIXEL_BITMASK;
+
+typedef enum {
+ PixelRedGreenBlueReserved8BitPerColor,
+ PixelBlueGreenRedReserved8BitPerColor,
+ PixelBitMask,
+ PixelBltOnly,
+ PixelFormatMax
+} EFI_GRAPHICS_PIXEL_FORMAT;
+
+typedef struct {
+ UINT32 Version;
+ UINT32 HorizontalResolution;
+ UINT32 VerticalResolution;
+ EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
+ EFI_PIXEL_BITMASK PixelInformation;
+ UINT32 PixelsPerScanLine;
+} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
+
+/**
+ Return the current video mode information.
+
+ @param This Protocol instance pointer.
+ @param ModeNumber The mode number to return information on.
+ @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.
+ @param Info A pointer to callee allocated buffer that returns information about ModeNumber.
+
+ @retval EFI_SUCCESS Mode information returned.
+ @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.
+ @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.
+ @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
+ @retval EFI_INVALID_PARAMETER One of the input args was NULL.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
+ IN UINT32 ModeNumber,
+ OUT UINTN *SizeOfInfo,
+ OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
+ )
+;
+
+/**
+ Return the current video mode information.
+
+ @param This Protocol instance pointer.
+ @param ModeNumber The mode number to be set.
+
+ @retval EFI_SUCCESS Graphics mode was changed.
+ @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
+ @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
+ IN UINT32 ModeNumber
+ )
+;
+
+typedef struct {
+ UINT8 Blue;
+ UINT8 Green;
+ UINT8 Red;
+ UINT8 Reserved;
+} EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
+
+typedef union {
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
+ UINT32 Raw;
+} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
+
+typedef enum {
+ EfiBltVideoFill,
+ EfiBltVideoToBltBuffer,
+ EfiBltBufferToVideo,
+ EfiBltVideoToVideo,
+ EfiGraphicsOutputBltOperationMax
+} EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
+
+/**
+ The following table defines actions for BltOperations:
+
+ <B>EfiBltVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
+ directly to every pixel of the video display rectangle
+ (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
+ Only one pixel will be used from the BltBuffer. Delta is NOT used.
+
+ <B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
+ (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
+ the BltBuffer rectangle (DestinationX, DestinationY )
+ (DestinationX + Width, DestinationY + Height). If DestinationX or
+ DestinationY is not zero then Delta must be set to the length in bytes
+ of a row in the BltBuffer.
+
+ <B>EfiBltBufferToVideo</B> - Write data from the BltBuffer rectangle
+ (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
+ video display rectangle (DestinationX, DestinationY)
+ (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
+ not zero then Delta must be set to the length in bytes of a row in the
+ BltBuffer.
+
+ <B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
+ (SourceX + Width, SourceY + Height) .to the video display rectangle
+ (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
+ The BltBuffer and Delta are not used in this mode.
+
+ @param This Protocol instance pointer.
+ @param BltBuffer Buffer containing data to blit into video buffer. This
+ buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ @param BltOperation Operation to perform on BlitBuffer and video memory
+ @param SourceX X coordinate of source for the BltBuffer.
+ @param SourceY Y coordinate of source for the BltBuffer.
+ @param DestinationX X coordinate of destination for the BltBuffer.
+ @param DestinationY Y coordinate of destination for the BltBuffer.
+ @param Width Width of rectangle in BltBuffer in pixels.
+ @param Height Height of rectangle in BltBuffer in pixels.
+ @param Delta OPTIONAL
+
+ @retval EFI_SUCCESS The Blt operation completed.
+ @retval EFI_INVALID_PARAMETER BltOperation is not valid.
+ @retval EFI_DEVICE_ERROR A hardware error occurred writing to the video buffer.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
+ IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
+ IN UINTN SourceX,
+ IN UINTN SourceY,
+ IN UINTN DestinationX,
+ IN UINTN DestinationY,
+ IN UINTN Width,
+ IN UINTN Height,
+ IN UINTN Delta OPTIONAL
+ );
+
+typedef struct {
+ UINT32 MaxMode;
+ UINT32 Mode;
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
+ UINTN SizeOfInfo;
+ EFI_PHYSICAL_ADDRESS FrameBufferBase;
+ UINTN FrameBufferSize;
+} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
+
+struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
+};
+
+extern EFI_GUID gEfiGraphicsOutputProtocolGuid;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Protocol/GuidedSectionExtraction.h b/roms/edk2/BaseTools/Source/C/Include/Protocol/GuidedSectionExtraction.h
new file mode 100644
index 000000000..f62954625
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Protocol/GuidedSectionExtraction.h
@@ -0,0 +1,145 @@
+/** @file
+ This file declares GUIDed section extraction protocol.
+
+ This interface provides a means of decoding a GUID defined encapsulation
+ section. There may be multiple different GUIDs associated with the GUIDed
+ section extraction protocol. That is, all instances of the GUIDed section
+ extraction protocol must have the same interface structure.
+
+ @par Revision Reference: PI
+ Version 1.00.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL_H__
+#define __EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL_H__
+
+//
+// Forward reference for pure ANSI compatibility
+
+typedef struct _EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL;
+
+
+/**
+ The ExtractSection() function processes the input section and
+ allocates a buffer from the pool in which it returns the section
+ contents. If the section being extracted contains
+ authentication information (the section's
+ GuidedSectionHeader.Attributes field has the
+ EFI_GUIDED_SECTION_AUTH_STATUS_VALID bit set), the values
+ returned in AuthenticationStatus must reflect the results of
+ the authentication operation. Depending on the algorithm and
+ size of the encapsulated data, the time that is required to do
+ a full authentication may be prohibitively long for some
+ classes of systems. To indicate this, use
+ EFI_SECURITY_POLICY_PROTOCOL_GUID, which may be published by
+ the security policy driver (see the Platform Initialization
+ Driver Execution Environment Core Interface Specification for
+ more details and the GUID definition). If the
+ EFI_SECURITY_POLICY_PROTOCOL_GUID exists in the handle
+ database, then, if possible, full authentication should be
+ skipped and the section contents simply returned in the
+ OutputBuffer. In this case, the
+ EFI_AUTH_STATUS_PLATFORM_OVERRIDE bit AuthenticationStatus
+ must be set on return. ExtractSection() is callable only from
+ TPL_NOTIFY and below. Behavior of ExtractSection() at any
+ EFI_TPL above TPL_NOTIFY is undefined. Type EFI_TPL is
+ defined in RaiseTPL() in the UEFI 2.0 specification.
+
+
+ @param This Indicates the
+ EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.
+
+ @param InputSection Buffer containing the input GUIDed section
+ to be processed. OutputBuffer OutputBuffer
+ is allocated from boot services pool
+ memory and contains the new section
+ stream. The caller is responsible for
+ freeing this buffer.
+
+ @param OutputSize A pointer to a caller-allocated UINTN in
+ which the size of OutputBuffer allocation
+ is stored. If the function returns
+ anything other than EFI_SUCCESS, the value
+ of OutputSize is undefined.
+
+ @param AuthenticationStatus A pointer to a caller-allocated
+ UINT32 that indicates the
+ authentication status of the
+ output buffer. If the input
+ section's
+ GuidedSectionHeader.Attributes
+ field has the
+ EFI_GUIDED_SECTION_AUTH_STATUS_VAL
+ bit as clear, AuthenticationStatus
+ must return zero. Both local bits
+ (19:16) and aggregate bits (3:0)
+ in AuthenticationStatus are
+ returned by ExtractSection().
+ These bits reflect the status of
+ the extraction operation. The bit
+ pattern in both regions must be
+ the same, as the local and
+ aggregate authentication statuses
+ have equivalent meaning at this
+ level. If the function returns
+ anything other than EFI_SUCCESS,
+ the value of AuthenticationStatus
+ is undefined.
+
+
+ @retval EFI_SUCCESS The InputSection was successfully
+ processed and the section contents were
+ returned.
+
+ @retval EFI_OUT_OF_RESOURCES The system has insufficient
+ resources to process the
+ request.
+
+ @retval EFI_INVALID_PARAMETER The GUID in InputSection does
+ not match this instance of the
+ GUIDed Section Extraction
+ Protocol.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_EXTRACT_GUIDED_SECTION)(
+ IN CONST EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *This,
+ IN CONST VOID *InputSection,
+ OUT VOID **OutputBuffer,
+ OUT UINTN *OutputSize,
+ OUT UINT32 *AuthenticationStatus
+);
+
+
+/**
+
+ Takes the GUIDed section as input and produces the section
+ stream data. See the ExtractSection() function description.
+
+**/
+struct _EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL {
+ EFI_EXTRACT_GUIDED_SECTION ExtractSection;
+};
+
+//
+// Protocol GUID definition. Each GUIDed section extraction protocol has the
+// same interface but with different GUID. All the GUIDs is defined here.
+// May add multiple GUIDs here.
+//
+#define EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID \
+ { \
+ 0xFC1BCDB0, 0x7D31, 0x49aa, {0x93, 0x6A, 0xA4, 0x60, 0x0D, 0x9D, 0xD0, 0x83 } \
+ }
+
+//
+// may add other GUID here
+//
+extern EFI_GUID gEfiCrc32GuidedSectionExtractionProtocolGuid;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Protocol/HiiFramework.h b/roms/edk2/BaseTools/Source/C/Include/Protocol/HiiFramework.h
new file mode 100644
index 000000000..448350967
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Protocol/HiiFramework.h
@@ -0,0 +1,944 @@
+/** @file
+ This file defines the Human Interface Infrastructure protocol which will
+ be used by resources which want to publish IFR/Font/String data and have it
+ collected by the Configuration engine.
+
+ @par Revision Reference:
+ This protocol is defined in HII spec 0.92.
+
+ Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _FRAMEWORK_HII_H_
+#define _FRAMEWORK_HII_H_
+
+//#include <PiDxe.h>
+
+//
+// To get EFI_GRAPHICS_OUTPUT_BLT_PIXEL,
+// is defined in MdePkg/Protocol/GraphicsOutput.h
+//
+#include <Protocol/GraphicsOutput.h>
+
+#define EFI_HII_PROTOCOL_GUID \
+ { \
+ 0xd7ad636e, 0xb997, 0x459b, {0xbf, 0x3f, 0x88, 0x46, 0x89, 0x79, 0x80, 0xe1} \
+ }
+
+// BugBug:
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// If UGA goes away we need to put this some place. I'm not sure where?
+//
+//typedef struct {
+// UINT8 Blue;
+// UINT8 Green;
+// UINT8 Red;
+// UINT8 Reserved;
+//} EFI_UGA_PIXEL;
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+
+typedef struct _EFI_HII_PROTOCOL EFI_HII_PROTOCOL;
+
+//
+// Global definition
+//
+#define NARROW_CHAR 0xFFF0
+#define WIDE_CHAR 0xFFF1
+#define NON_BREAKING_CHAR 0xFFF2
+#define GLYPH_WIDTH 8
+#define GLYPH_HEIGHT 19
+
+#define EFI_HII_FONT 1
+#define EFI_HII_STRING 2
+#define EFI_HII_IFR 3
+#define EFI_HII_KEYBOARD 4
+#define EFI_HII_HANDLES 5
+#define EFI_HII_VARIABLE 6
+#define EFI_HII_DEVICE_PATH 7
+
+
+// References to string tokens must use this macro to enable scanning for
+// token usages.
+//
+#define STRING_TOKEN(t) t
+
+//
+// The following types are currently defined:
+// EFI_FROM_ID has been defined in UEFI spec.
+//
+typedef UINT16 EFI_FORM_LABEL;
+
+#pragma pack(1)
+
+typedef struct {
+ UINT32 Length;
+ UINT16 Type;
+} EFI_HII_PACK_HEADER;
+
+//
+// A form list consists of a large variety of structure
+// possibilities so to represent the binary blob of data
+// associated with a package of forms, we will assume a
+// pointer to a self-describing data buffer.
+//
+typedef struct {
+ EFI_HII_PACK_HEADER Header;
+} EFI_HII_IFR_PACK;
+
+typedef struct {
+ EFI_HII_PACK_HEADER Header; // Must be filled in
+ EFI_HANDLE ImageHandle; // Must be filled in
+ EFI_HANDLE DeviceHandle; // Optional
+ EFI_HANDLE ControllerHandle; // Optional
+ EFI_HANDLE CallbackHandle; // Optional
+ EFI_HANDLE COBExportHandle; // Optional
+} EFI_HII_HANDLE_PACK;
+
+//
+// ********************************************************
+// EFI_VARIABLE_CONTENTS
+// ********************************************************
+//
+typedef struct {
+ EFI_HII_PACK_HEADER Header;
+ EFI_GUID VariableGuid;
+ UINT32 VariableNameLength;
+ UINT16 VariableId;
+ //
+ // CHAR16 VariableName[]; //Null-terminated
+ //
+} EFI_HII_VARIABLE_PACK;
+
+//
+// ********************************************************
+// EFI_DEVICE_PATH_PACK
+// ********************************************************
+//
+typedef struct {
+ EFI_HII_PACK_HEADER Header;
+ //
+ // EFI_DEVICE_PATH DevicePath[];
+ //
+} EFI_HII_DEVICE_PATH_PACK;
+
+//
+// ********************************************************
+// EFI_HII_DATA_TABLE
+// ********************************************************
+//
+typedef struct {
+ EFI_HII_HANDLE HiiHandle;
+ EFI_GUID PackageGuid;
+ UINT32 DataTableSize;
+ UINT32 IfrDataOffset;
+ UINT32 StringDataOffset;
+ UINT32 VariableDataOffset;
+ UINT32 DevicePathOffset;
+ UINT32 NumberOfVariableData;
+ UINT32 NumberOfLanguages;
+ //
+ // EFI_HII_DEVICE_PATH_PACK DevicePath[];
+ // EFI_HII_VARIABLE_PACK VariableData[];
+ // EFI_HII_IFR_PACK IfrData;
+ // EFI_HII_STRING_PACK StringData[];
+ //
+} EFI_HII_DATA_TABLE;
+
+//
+// ********************************************************
+// EFI_HII_EXPORT_TABLE
+// ********************************************************
+//
+typedef struct {
+ UINT32 NumberOfHiiDataTables;
+ EFI_GUID Revision;
+ //
+ // EFI_HII_DATA_TABLE HiiDataTable[];
+ //
+} EFI_HII_EXPORT_TABLE;
+
+typedef struct {
+ BOOLEAN FormSetUpdate; // If TRUE, next variable is significant
+ EFI_PHYSICAL_ADDRESS FormCallbackHandle; // If not 0, will update Formset with this info
+ BOOLEAN FormUpdate; // If TRUE, next variable is significant
+ UINT16 FormValue; // specify which form is to be updated if FormUpdate value is TRUE.
+ STRING_REF FormTitle; // If not 0, will update Form with this info
+ UINT16 DataCount; // The number of Data entries in this structure
+ UINT8 *Data; // An array of 1+ op-codes, specified by DataCount
+} EFI_HII_UPDATE_DATA;
+
+//
+// String attributes
+//
+#define LANG_RIGHT_TO_LEFT 0x00000001
+
+//
+// A string package is used to localize strings to a particular
+// language. The package is associated with a particular driver
+// or set of drivers. Tools are used to associate tokens with
+// string references in forms and in programs. These tokens are
+// language agnostic. When paired with a language pack (directly
+// or indirectly), the string token resolves into an actual
+// UNICODE string. The NumStringPointers determines how many
+// StringPointers (offset values) there are as well as the total
+// number of Strings that are defined.
+//
+typedef struct {
+ EFI_HII_PACK_HEADER Header;
+ RELOFST LanguageNameString;
+ RELOFST PrintableLanguageName;
+ UINT32 NumStringPointers;
+ UINT32 Attributes;
+ //
+ // RELOFST StringPointers[];
+ // EFI_STRING Strings[];
+ //
+} EFI_HII_STRING_PACK;
+
+//
+// Glyph Attributes
+//
+#define EFI_GLYPH_NON_SPACING 1
+#define EFI_GLYPH_WIDE 2
+
+typedef struct {
+ CHAR16 UnicodeWeight;
+ UINT8 Attributes;
+ UINT8 GlyphCol1[GLYPH_HEIGHT];
+} EFI_NARROW_GLYPH;
+
+typedef struct {
+ CHAR16 UnicodeWeight;
+ UINT8 Attributes;
+ UINT8 GlyphCol1[GLYPH_HEIGHT];
+ UINT8 GlyphCol2[GLYPH_HEIGHT];
+ UINT8 Pad[3];
+} EFI_WIDE_GLYPH;
+
+//
+// A font list consists of a font header followed by a series
+// of glyph structures. Note that fonts are not language specific.
+//
+typedef struct {
+ EFI_HII_PACK_HEADER Header;
+ UINT16 NumberOfNarrowGlyphs;
+ UINT16 NumberOfWideGlyphs;
+} EFI_HII_FONT_PACK;
+
+//
+// The IfrData in the EFI_HII_IFR_PACK structure definition
+// is variable length, and not really part of the header. To
+// simplify from code the size of the header, define an
+// identical structure that does not include the IfrData field.
+// Then use sizeof() this new structure to determine the
+// actual size of the header.
+//
+typedef struct {
+ EFI_HII_PACK_HEADER Header;
+} EFI_HII_IFR_PACK_HEADER;
+
+//
+// pedef EFI_HII_PACK_HEADER EFI_HII_IFR_PACK_HEADER;
+//
+typedef enum {
+ EfiKeyLCtrl,
+ EfiKeyA0,
+ EfiKeyLAlt,
+ EfiKeySpaceBar,
+ EfiKeyA2,
+ EfiKeyA3,
+ EfiKeyA4,
+ EfiKeyRCtrl,
+ EfiKeyLeftArrow,
+ EfiKeyDownArrow,
+ EfiKeyRightArrow,
+ EfiKeyZero,
+ EfiKeyPeriod,
+ EfiKeyEnter,
+ EfiKeyLShift,
+ EfiKeyB0,
+ EfiKeyB1,
+ EfiKeyB2,
+ EfiKeyB3,
+ EfiKeyB4,
+ EfiKeyB5,
+ EfiKeyB6,
+ EfiKeyB7,
+ EfiKeyB8,
+ EfiKeyB9,
+ EfiKeyB10,
+ EfiKeyRshift,
+ EfiKeyUpArrow,
+ EfiKeyOne,
+ EfiKeyTwo,
+ EfiKeyThree,
+ EfiKeyCapsLock,
+ EfiKeyC1,
+ EfiKeyC2,
+ EfiKeyC3,
+ EfiKeyC4,
+ EfiKeyC5,
+ EfiKeyC6,
+ EfiKeyC7,
+ EfiKeyC8,
+ EfiKeyC9,
+ EfiKeyC10,
+ EfiKeyC11,
+ EfiKeyC12,
+ EfiKeyFour,
+ EfiKeyFive,
+ EfiKeySix,
+ EfiKeyPlus,
+ EfiKeyTab,
+ EfiKeyD1,
+ EfiKeyD2,
+ EfiKeyD3,
+ EfiKeyD4,
+ EfiKeyD5,
+ EfiKeyD6,
+ EfiKeyD7,
+ EfiKeyD8,
+ EfiKeyD9,
+ EfiKeyD10,
+ EfiKeyD11,
+ EfiKeyD12,
+ EfiKeyD13,
+ EfiKeyDel,
+ EfiKeyEnd,
+ EfiKeyPgDn,
+ EfiKeySeven,
+ EfiKeyEight,
+ EfiKeyNine,
+ EfiKeyE0,
+ EfiKeyE1,
+ EfiKeyE2,
+ EfiKeyE3,
+ EfiKeyE4,
+ EfiKeyE5,
+ EfiKeyE6,
+ EfiKeyE7,
+ EfiKeyE8,
+ EfiKeyE9,
+ EfiKeyE10,
+ EfiKeyE11,
+ EfiKeyE12,
+ EfiKeyBackSpace,
+ EfiKeyIns,
+ EfiKeyHome,
+ EfiKeyPgUp,
+ EfiKeyNLck,
+ EfiKeySlash,
+ EfiKeyAsterisk,
+ EfiKeyMinus,
+ EfiKeyEsc,
+ EfiKeyF1,
+ EfiKeyF2,
+ EfiKeyF3,
+ EfiKeyF4,
+ EfiKeyF5,
+ EfiKeyF6,
+ EfiKeyF7,
+ EfiKeyF8,
+ EfiKeyF9,
+ EfiKeyF10,
+ EfiKeyF11,
+ EfiKeyF12,
+ EfiKeyPrint,
+ EfiKeySLck,
+ EfiKeyPause
+} EFI_KEY;
+
+typedef struct {
+ EFI_KEY Key;
+ CHAR16 Unicode;
+ CHAR16 ShiftedUnicode;
+ CHAR16 AltGrUnicode;
+ CHAR16 ShiftedAltGrUnicode;
+ UINT16 Modifier;
+} EFI_KEY_DESCRIPTOR;
+
+//
+// This structure allows a sparse set of keys to be redefined
+// or a complete redefinition of the keyboard layout. Most
+// keyboards have a lot of commonality in their layouts, therefore
+// only defining those keys that need to change from the default
+// minimizes the passed in information.
+//
+// Additionally, when an update occurs, the active keyboard layout
+// will be switched to the newly updated keyboard layout. This
+// allows for situations that when a keyboard layout driver is
+// loaded as part of system initialization, the system will default
+// the keyboard behavior to the new layout.
+//
+// Each call to update the keyboard mapping should contain the
+// complete set of key descriptors to be updated, since every
+// call to the HII which contains an EFI_HII_KEYBOARD_PACK will
+// wipe the previous set of overrides. A call to
+//
+typedef struct {
+ EFI_HII_PACK_HEADER Header;
+ EFI_KEY_DESCRIPTOR *Descriptor;
+ UINT8 DescriptorCount;
+} EFI_HII_KEYBOARD_PACK;
+
+//
+// The EFI_HII_PACKAGES can contain different types of packages just
+// after the structure as inline data.
+//
+typedef struct {
+ UINTN NumberOfPackages;
+ EFI_GUID *GuidId;
+ //
+ // EFI_HII_HANDLE_PACK *HandlePack; // Only one pack.
+ // EFI_HII_IFR_PACK *IfrPack; // Only one pack.
+ // EFI_HII_FONT_PACK *FontPack[]; // Multiple packs ok
+ // EFI_HII_STRING_PACK *StringPack[]; // Multiple packs ok
+ // EFI_HII_KEYBOARD_PACK *KeyboardPack[]; // Multiple packs ok
+ //
+} EFI_HII_PACKAGES;
+
+typedef struct _EFI_HII_VARIABLE_PACK_LIST {
+ struct _EFI_HII_VARIABLE_PACK_LIST *NextVariablePack;
+ EFI_HII_VARIABLE_PACK *VariablePack;
+} EFI_HII_VARIABLE_PACK_LIST;
+
+
+#pragma pack()
+
+/**
+ Registers the various packs that are passed in via the Packages parameter.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Packages A pointer to an EFI_HII_PACKAGES package instance.
+ @param Handle A pointer to the EFI_HII_HANDLE instance.
+
+ @retval EFI_SUCCESS Data was extracted from Packages, the database
+ was updated with the data, and Handle returned successfully.
+ @retval EFI_INVALID_PARAMETER The content of Packages was invalid.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_NEW_PACK) (
+ IN EFI_HII_PROTOCOL *This,
+ IN EFI_HII_PACKAGES *Packages,
+ OUT EFI_HII_HANDLE *Handle
+ );
+
+/**
+ Removes a package from the HII database.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle The handle that was registered to the data that is requested
+ for removal.
+
+ @retval EFI_SUCCESS The data associated with the Handle was removed
+ from the HII database.
+ @retval EFI_INVALID_PARAMETER The Handle was not valid.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_REMOVE_PACK) (
+ IN EFI_HII_PROTOCOL *This,
+ IN EFI_HII_HANDLE Handle
+ );
+
+/**
+ Determines the handles that are currently active in the database.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param HandleBufferLength On input, a pointer to the length of the handle
+ buffer. On output, the length of the handle buffer that is required
+ for the handles found.
+ @param Handle An array of EFI_HII_HANDLE instances returned.
+
+ @retval EFI_SUCCESS Handle was updated successfully.
+ @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter indicates
+ that Handle is too small to support the number of handles.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_FIND_HANDLES) (
+ IN EFI_HII_PROTOCOL *This,
+ IN OUT UINT16 *HandleBufferLength,
+ OUT EFI_HII_HANDLE *Handle
+ );
+
+/**
+ Exports the contents of the database into a buffer.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle An EFI_HII_HANDLE that corresponds to the desired
+ handle to export. If the value is 0, the entire database will be exported.
+ In either case, the data will be exported in a format described by the
+ structure definition of EFI_HII_EXPORT_TABLE.
+ @param BufferSize
+ On input, a pointer to the length of the buffer. On output, the length
+ of the buffer that is required for the export data.
+ @param Buffer A pointer to a buffer that will contain the results of the export function.
+
+ @retval EFI_SUCCESS The buffer was successfully filled with BufferSize amount of data.
+ @retval EFI_BUFFER_TOO_SMALL The value in BufferSize was too small to contain the export data.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_EXPORT) (
+ IN EFI_HII_PROTOCOL *This,
+ IN EFI_HII_HANDLE Handle,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
+ );
+
+/**
+ Remove any new strings that were added after the initial string export
+ for this handle.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle The handle on which the string resides.
+
+ @retval EFI_SUCCESS Remove strings from the handle successfully.
+ @retval EFI_INVALID_PARAMETER The Handle was unknown.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_RESET_STRINGS) (
+ IN EFI_HII_PROTOCOL *This,
+ IN EFI_HII_HANDLE Handle
+ );
+
+/**
+ Tests if all of the characters in a string have corresponding font characters.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param StringToTest A pointer to a Unicode string.
+ @param FirstMissing A pointer to an index into the string. On input,
+ the index of the first character in the StringToTest to examine. On exit,
+ the index of the first character encountered for which a glyph is unavailable.
+ If all glyphs in the string are available, the index is the index of the
+ terminator of the string.
+ @param GlyphBufferSize A pointer to a value. On output, if the function
+ returns EFI_SUCCESS, it contains the amount of memory that is required to
+ store the string's glyph equivalent.
+
+ @retval EFI_SUCCESS All glyphs are available. Note that an empty string
+ always returns this value.
+ @retval EFI_NOT_FOUND A glyph was not found for a character.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_TEST_STRING) (
+ IN EFI_HII_PROTOCOL *This,
+ IN CHAR16 *StringToTest,
+ IN OUT UINT32 *FirstMissing,
+ OUT UINT32 *GlyphBufferSize
+ );
+
+/**
+ Translates a Unicode character into the corresponding font glyph.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Source A pointer to a Unicode string.
+ @param Index On input, the offset into the string from which to fetch
+ the character.On successful completion, the index is updated to the first
+ character past the character(s) making up the just extracted glyph.
+ @param GlyphBuffer Pointer to an array where the glyphs corresponding
+ to the characters in the source may be stored. GlyphBuffer is assumed
+ to be wide enough to accept a wide glyph character.
+ @param BitWidth If EFI_SUCCESS was returned, the UINT16 pointed to by
+ this value is filled with the length of the glyph in pixels. It is unchanged
+ if the call was unsuccessful.
+ @param InternalStatus The cell pointed to by this parameter must be
+ initialized to zero prior to invoking the call the first time for any string.
+
+ @retval EFI_SUCCESS It worked.
+ @retval EFI_NOT_FOUND A glyph for a character was not found.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_GET_GLYPH) (
+ IN EFI_HII_PROTOCOL *This,
+ IN CHAR16 *Source,
+ IN OUT UINT16 *Index,
+ OUT UINT8 **GlyphBuffer,
+ OUT UINT16 *BitWidth,
+ IN OUT UINT32 *InternalStatus
+ );
+
+/**
+ Translates a glyph into the format required for input to the Universal
+ Graphics Adapter (UGA) Block Transfer (BLT) routines.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param GlyphBuffer A pointer to the buffer that contains glyph data.
+ @param Foreground The foreground setting requested to be used for the
+ generated BltBuffer data.
+ @param Background The background setting requested to be used for the
+ generated BltBuffer data.
+ @param Count The entry in the BltBuffer upon which to act.
+ @param Width The width in bits of the glyph being converted.
+ @param Height The height in bits of the glyph being converted
+ @param BltBuffer A pointer to the buffer that contains the data that is
+ ready to be used by the UGA BLT routines.
+
+ @retval EFI_SUCCESS It worked.
+ @retval EFI_NOT_FOUND A glyph for a character was not found.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_GLYPH_TO_BLT) (
+ IN EFI_HII_PROTOCOL *This,
+ IN UINT8 *GlyphBuffer,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
+ IN UINTN Count,
+ IN UINTN Width,
+ IN UINTN Height,
+ IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
+ );
+
+/**
+ Allows a new string to be added to an already existing string package.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Pointer to a NULL-terminated string containing a single ISO 639-2
+ language identifier, indicating the language in which the string is translated.
+ @param Handle The handle of the language pack to which the string is to be added.
+ @param Reference The identifier of the string to be added. If the reference
+ value is zero, then the string will be assigned a new identifier on that
+ handle for the language specified. Otherwise, the string will be updated
+ with the NewString Value.
+ @param NewString The string to be added.
+
+ @retval EFI_SUCCESS The string was effectively registered.
+ @retval EFI_INVALID_PARAMETER The Handle was unknown.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_NEW_STRING) (
+ IN EFI_HII_PROTOCOL *This,
+ IN CHAR16 *Language,
+ IN EFI_HII_HANDLE Handle,
+ IN OUT STRING_REF *Reference,
+ IN CHAR16 *NewString
+ );
+
+/**
+ Allows a program to determine the primary languages that are supported
+ on a given handle.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle The handle on which the strings reside.
+ @param LanguageString A string allocated by GetPrimaryLanguages() that
+ contains a list of all primary languages registered on the handle.
+
+ @retval EFI_SUCCESS LanguageString was correctly returned.
+ @retval EFI_INVALID_PARAMETER The Handle was unknown.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_GET_PRI_LANGUAGES) (
+ IN EFI_HII_PROTOCOL *This,
+ IN EFI_HII_HANDLE Handle,
+ OUT EFI_STRING *LanguageString
+ );
+
+/**
+ Allows a program to determine which secondary languages are supported
+ on a given handle for a given primary language.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle The handle on which the strings reside.
+ @param PrimaryLanguage Pointer to a NULL-terminated string containing a single
+ ISO 639-2 language identifier, indicating the primary language.
+ @param LanguageString A string allocated by GetSecondaryLanguages()
+ containing a list of all secondary languages registered on the handle.
+
+ @retval EFI_SUCCESS LanguageString was correctly returned.
+ @retval EFI_INVALID_PARAMETER The Handle was unknown.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_GET_SEC_LANGUAGES) (
+ IN EFI_HII_PROTOCOL *This,
+ IN EFI_HII_HANDLE Handle,
+ IN CHAR16 *PrimaryLanguage,
+ OUT EFI_STRING *LanguageString
+ );
+
+/**
+ Extracts a string from a package already registered with the EFI HII database.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle The handle on which the string resides.
+ @param Token The string token assigned to the string.
+ @param Raw If TRUE, the string is returned unedited in the internal
+ storage format described above. If false, the string returned is edited
+ by replacing <cr> with <space> and by removing special characters such
+ as the <wide> prefix.
+ @param LanguageString Pointer to a NULL-terminated string containing a
+ single ISO 639-2 language identifier, indicating the language to print.
+ If the LanguageString is empty (starts with a NULL), the default system
+ language will be used to determine the language.
+ @param BufferLength Length of the StringBuffer.
+ @param StringBuffer The buffer designed to receive the characters in the string.
+
+ @retval EFI_SUCCESS StringBuffer is filled with a NULL-terminated string.
+ @retval EFI_INVALID_PARAMETER The handle or string token is unknown.
+ @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough to
+ allow the entire string to be stored.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_GET_STRING) (
+ IN EFI_HII_PROTOCOL *This,
+ IN EFI_HII_HANDLE Handle,
+ IN STRING_REF Token,
+ IN BOOLEAN Raw,
+ IN CHAR16 *LanguageString,
+ IN OUT UINTN *BufferLength,
+ OUT EFI_STRING StringBuffer
+ );
+
+/**
+ Allows a program to extract a part of a string of not more than a given width.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle The handle on which the string resides.
+ @param Token The string token assigned to the string.
+ @param Index On input, the offset into the string where the line is to start.
+ On output, the index is updated to point to beyond the last character returned
+ in the call.
+ @param LineWidth The maximum width of the line in units of narrow glyphs.
+ @param LanguageString Pointer to a NULL-terminated string containing a
+ single ISO 639-2 language identifier, indicating the language to print.
+ @param BufferLength Pointer to the length of the StringBuffer.
+ @param StringBuffer The buffer designed to receive the characters in the string.
+
+ @retval EFI_SUCCESS StringBuffer filled with characters that will fit on the line.
+ @retval EFI_NOT_FOUND The font glyph for at least one of the characters in
+ the string is not in the font database.
+ @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough
+ to allow the entire string to be stored.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_GET_LINE) (
+ IN EFI_HII_PROTOCOL *This,
+ IN EFI_HII_HANDLE Handle,
+ IN STRING_REF Token,
+ IN OUT UINT16 *Index,
+ IN UINT16 LineWidth,
+ IN CHAR16 *LanguageString,
+ IN OUT UINT16 *BufferLength,
+ OUT EFI_STRING StringBuffer
+ );
+
+/**
+ Allows a program to extract a form or form package that has previously
+ been registered with the HII database.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle Handle on which the form resides.
+ @param FormId The ID of the form to return. If the ID is zero,
+ the entire form package is returned.
+ @param BufferLength On input, the length of the Buffer. On output,
+ the length of the returned buffer,
+ @param Buffer The buffer designed to receive the form(s).
+
+ @retval EFI_SUCCESS Buffer filled with the requested forms. BufferLength
+ was updated.
+ @retval EFI_INVALID_PARAMETER The handle is unknown.
+ @retval EFI_NOT_FOUND A form on the requested handle cannot be found with
+ the requested FormId.
+ @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough
+ to allow the form to be stored.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_GET_FORMS) (
+ IN EFI_HII_PROTOCOL *This,
+ IN EFI_HII_HANDLE Handle,
+ IN EFI_FORM_ID FormId,
+ IN OUT UINTN *BufferLength,
+ OUT UINT8 *Buffer
+ );
+
+/**
+ Extracts the defaults that are associated with a given handle in the HII database.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle The HII handle from which will have default data retrieved.
+ @param DefaultMask The mask used to specify some type of default override when extracting
+ the default image data.
+ @param VariablePackList A indirect pointer to the first entry of a link list with
+ type EFI_HII_VARIABLE_PACK_LIST.
+
+ @retval EFI_SUCCESS The VariablePackList was populated with the appropriate
+ default setting data.
+ @retval EFI_NOT_FOUND The IFR does not have any explicit or default map(s).
+ @retval EFI_INVALID_PARAMETER The HII database entry associated with Handle
+ contain invalid data.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_GET_DEFAULT_IMAGE) (
+ IN EFI_HII_PROTOCOL *This,
+ IN EFI_HII_HANDLE Handle,
+ IN UINTN DefaultMask,
+ OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList
+ );
+
+/**
+ Allows the caller to update a form or form package that has previously been
+ registered with the EFI HII database.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle Handle of the package where the form to be updated resides.
+ @param Label The label inside the form package where the update is to take place.
+ @param AddData If TRUE, adding data at a given Label; otherwise,
+ if FALSE, removing data at a given Label.
+ @param Data The buffer containing the new tags to insert after the Label
+
+ @retval EFI_SUCCESS The form was updated with the new tags.
+ @retval EFI_INVALID_PARAMETER The buffer for the buffer length does not
+ contain an integral number of tags.
+ @retval EFI_NOT_FOUND The Handle, Label, or FormId was not found.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_UPDATE_FORM) (
+ IN EFI_HII_PROTOCOL *This,
+ IN EFI_HII_HANDLE Handle,
+ IN EFI_FORM_LABEL Label,
+ IN BOOLEAN AddData,
+ IN EFI_HII_UPDATE_DATA *Data
+ );
+
+/**
+ Retrieves the current keyboard layout.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param DescriptorCount A pointer to the number of Descriptor entries being
+ described in the keyboard layout being retrieved.
+ @param Descriptor A pointer to a buffer containing an array of EFI_KEY_DESCRIPTOR
+ entries. Each entry will reflect the definition of a specific physical key.
+
+ @retval EFI_SUCCESS The keyboard layout was retrieved successfully.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT) (
+ IN EFI_HII_PROTOCOL *This,
+ OUT UINT16 *DescriptorCount,
+ OUT EFI_KEY_DESCRIPTOR *Descriptor
+ );
+
+/**
+ @par Protocol Description:
+ The HII Protocol manages the HII database, which is a repository for data
+ having to do with fonts, strings, forms, keyboards, and other future human
+ interface items.
+
+ @param NewPack
+ Extracts the various packs from a package list.
+
+ @param RemovePack
+ Removes a package from the HII database.
+
+ @param FindHandles
+ Determines the handles that are currently active in the database.
+
+ @param ExportDatabase
+ Export the entire contents of the database to a buffer.
+
+ @param TestString
+ Tests if all of the characters in a string have corresponding font characters.
+
+ @param GetGlyph
+ Translates a Unicode character into the corresponding font glyph.
+
+ @param GlyphToBlt
+ Converts a glyph value into a format that is ready for a UGA BLT command.
+
+ @param NewString
+ Allows a new string to be added to an already existing string package.
+
+ @param GetPrimaryLanguages
+ Allows a program to determine the primary languages that are supported
+ on a given handle.
+
+ @param GetSecondaryLanguages
+ Allows a program to determine which secondary languages are supported
+ on a given handle for a given primary language.
+
+ @param GetString
+ Extracts a string from a package that is already registered with the
+ EFI HII database.
+
+ @param ResetString
+ Remove any new strings that were added after the initial string export
+ for this handle.
+
+ @param GetLine
+ Allows a program to extract a part of a string of not more than a given width.
+
+ @param GetForms
+ Allows a program to extract a form or form package that has been previously registered.
+
+ @param GetDefaultImage
+ Allows a program to extract the nonvolatile image that represents the default storage image.
+
+ @param UpdateForm
+ Allows a program to update a previously registered form.
+
+ @param GetKeyboardLayout
+ Allows a program to extract the current keyboard layout.
+
+**/
+struct _EFI_HII_PROTOCOL {
+ EFI_HII_NEW_PACK NewPack;
+ EFI_HII_REMOVE_PACK RemovePack;
+ EFI_HII_FIND_HANDLES FindHandles;
+ EFI_HII_EXPORT ExportDatabase;
+
+ EFI_HII_TEST_STRING TestString;
+ EFI_HII_GET_GLYPH GetGlyph;
+ EFI_HII_GLYPH_TO_BLT GlyphToBlt;
+
+ EFI_HII_NEW_STRING NewString;
+ EFI_HII_GET_PRI_LANGUAGES GetPrimaryLanguages;
+ EFI_HII_GET_SEC_LANGUAGES GetSecondaryLanguages;
+ EFI_HII_GET_STRING GetString;
+ EFI_HII_RESET_STRINGS ResetStrings;
+ EFI_HII_GET_LINE GetLine;
+ EFI_HII_GET_FORMS GetForms;
+ EFI_HII_GET_DEFAULT_IMAGE GetDefaultImage;
+ EFI_HII_UPDATE_FORM UpdateForm;
+
+ EFI_HII_GET_KEYBOARD_LAYOUT GetKeyboardLayout;
+};
+
+extern EFI_GUID gEfiHiiProtocolGuid;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/Protocol/UgaDraw.h b/roms/edk2/BaseTools/Source/C/Include/Protocol/UgaDraw.h
new file mode 100644
index 000000000..412b000ae
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/Protocol/UgaDraw.h
@@ -0,0 +1,161 @@
+/** @file
+ UGA Draw protocol from the EFI 1.1 specification.
+
+ Abstraction of a very simple graphics device.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __UGA_DRAW_H__
+#define __UGA_DRAW_H__
+
+#define EFI_UGA_DRAW_PROTOCOL_GUID \
+ { \
+ 0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \
+ }
+
+typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL;
+
+/**
+ Return the current video mode information.
+
+ @param This Protocol instance pointer.
+ @param HorizontalResolution Current video horizontal resolution in pixels
+ @param VerticalResolution Current video vertical resolution in pixels
+ @param ColorDepth Current video color depth in bits per pixel
+ @param RefreshRate Current video refresh rate in Hz.
+
+ @retval EFI_SUCCESS Mode information returned.
+ @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
+ @retval EFI_INVALID_PARAMETER One of the input args was NULL.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UGA_DRAW_PROTOCOL_GET_MODE) (
+ IN EFI_UGA_DRAW_PROTOCOL *This,
+ OUT UINT32 *HorizontalResolution,
+ OUT UINT32 *VerticalResolution,
+ OUT UINT32 *ColorDepth,
+ OUT UINT32 *RefreshRate
+ )
+;
+
+/**
+ Return the current video mode information.
+
+ @param This Protocol instance pointer.
+ @param HorizontalResolution Current video horizontal resolution in pixels
+ @param VerticalResolution Current video vertical resolution in pixels
+ @param ColorDepth Current video color depth in bits per pixel
+ @param RefreshRate Current video refresh rate in Hz.
+
+ @retval EFI_SUCCESS Mode information returned.
+ @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UGA_DRAW_PROTOCOL_SET_MODE) (
+ IN EFI_UGA_DRAW_PROTOCOL *This,
+ IN UINT32 HorizontalResolution,
+ IN UINT32 VerticalResolution,
+ IN UINT32 ColorDepth,
+ IN UINT32 RefreshRate
+ )
+;
+
+typedef struct {
+ UINT8 Blue;
+ UINT8 Green;
+ UINT8 Red;
+ UINT8 Reserved;
+} EFI_UGA_PIXEL;
+
+typedef union {
+ EFI_UGA_PIXEL Pixel;
+ UINT32 Raw;
+} EFI_UGA_PIXEL_UNION;
+
+typedef enum {
+ EfiUgaVideoFill,
+ EfiUgaVideoToBltBuffer,
+ EfiUgaBltBufferToVideo,
+ EfiUgaVideoToVideo,
+ EfiUgaBltMax
+} EFI_UGA_BLT_OPERATION;
+
+/**
+ Type specifying a pointer to a function to perform an UGA Blt operation.
+
+ The following table defines actions for BltOperations:
+
+ <B>EfiUgaVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
+ directly to every pixel of the video display rectangle
+ (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
+ Only one pixel will be used from the BltBuffer. Delta is NOT used.
+
+ <B>EfiUgaVideoToBltBuffer</B> - Read data from the video display rectangle
+ (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
+ the BltBuffer rectangle (DestinationX, DestinationY )
+ (DestinationX + Width, DestinationY + Height). If DestinationX or
+ DestinationY is not zero then Delta must be set to the length in bytes
+ of a row in the BltBuffer.
+
+ <B>EfiUgaBltBufferToVideo</B> - Write data from the BltBuffer rectangle
+ (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
+ video display rectangle (DestinationX, DestinationY)
+ (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
+ not zero then Delta must be set to the length in bytes of a row in the
+ BltBuffer.
+
+ <B>EfiUgaVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
+ (SourceX + Width, SourceY + Height) .to the video display rectangle
+ (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
+ The BltBuffer and Delta are not used in this mode.
+
+
+ @param[in] This - Protocol instance pointer.
+ @param[in] BltBuffer - Buffer containing data to blit into video buffer. This
+ buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)
+ @param[in] BltOperation - Operation to perform on BlitBuffer and video memory
+ @param[in] SourceX - X coordinate of source for the BltBuffer.
+ @param[in] SourceY - Y coordinate of source for the BltBuffer.
+ @param[in] DestinationX - X coordinate of destination for the BltBuffer.
+ @param[in] DestinationY - Y coordinate of destination for the BltBuffer.
+ @param[in] Width - Width of rectangle in BltBuffer in pixels.
+ @param[in] Height - Height of rectangle in BltBuffer in pixels.
+ @param[in] Delta - OPTIONAL
+
+ @retval EFI_SUCCESS - The Blt operation completed.
+ @retval EFI_INVALID_PARAMETER - BltOperation is not valid.
+ @retval EFI_DEVICE_ERROR - A hardware error occurred writing to the video buffer.
+
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UGA_DRAW_PROTOCOL_BLT) (
+ IN EFI_UGA_DRAW_PROTOCOL * This,
+ IN EFI_UGA_PIXEL * BltBuffer, OPTIONAL
+ IN EFI_UGA_BLT_OPERATION BltOperation,
+ IN UINTN SourceX,
+ IN UINTN SourceY,
+ IN UINTN DestinationX,
+ IN UINTN DestinationY,
+ IN UINTN Width,
+ IN UINTN Height,
+ IN UINTN Delta OPTIONAL
+ );
+
+struct _EFI_UGA_DRAW_PROTOCOL {
+ EFI_UGA_DRAW_PROTOCOL_GET_MODE GetMode;
+ EFI_UGA_DRAW_PROTOCOL_SET_MODE SetMode;
+ EFI_UGA_DRAW_PROTOCOL_BLT Blt;
+};
+
+extern EFI_GUID gEfiUgaDrawProtocolGuid;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/Include/X64/ProcessorBind.h b/roms/edk2/BaseTools/Source/C/Include/X64/ProcessorBind.h
new file mode 100644
index 000000000..fce179fe7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Include/X64/ProcessorBind.h
@@ -0,0 +1,183 @@
+/** @file
+ Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PROCESSOR_BIND_H__
+#define __PROCESSOR_BIND_H__
+
+//
+// Define the processor type so other code can make processor based choices
+//
+#define MDE_CPU_X64
+
+
+//
+// Make sure we are useing the correct packing rules per EFI specification
+//
+#ifndef __GNUC__
+#pragma pack()
+#endif
+
+
+#if _MSC_EXTENSIONS
+
+//
+// Disable warning that make it impossible to compile at /W4
+// This only works for Microsoft* tools
+//
+
+//
+// Disabling bitfield type checking warnings.
+//
+#pragma warning ( disable : 4214 )
+
+//
+// Disabling the unreferenced formal parameter warnings.
+//
+#pragma warning ( disable : 4100 )
+
+//
+// Disable slightly different base types warning as CHAR8 * can not be set
+// to a constant string.
+//
+#pragma warning ( disable : 4057 )
+
+//
+// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
+//
+#pragma warning ( disable : 4127 )
+
+
+#endif
+
+
+#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
+ //
+ // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
+ //
+
+ #if _MSC_EXTENSIONS
+
+
+ //
+ // use Microsoft C compiler dependent integer width types
+ //
+ typedef unsigned __int64 UINT64;
+ typedef __int64 INT64;
+ typedef unsigned __int32 UINT32;
+ typedef __int32 INT32;
+ typedef unsigned short UINT16;
+ typedef unsigned short CHAR16;
+ typedef short INT16;
+ typedef unsigned char BOOLEAN;
+ typedef unsigned char UINT8;
+ typedef char CHAR8;
+ typedef char INT8;
+ #else
+ #ifdef _EFI_P64
+ //
+ // P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints
+ // are 32-bits
+ //
+ typedef unsigned long long UINT64;
+ typedef long long INT64;
+ typedef unsigned int UINT32;
+ typedef int INT32;
+ typedef unsigned short CHAR16;
+ typedef unsigned short UINT16;
+ typedef short INT16;
+ typedef unsigned char BOOLEAN;
+ typedef unsigned char UINT8;
+ typedef char CHAR8;
+ typedef char INT8;
+ #else
+ //
+ // Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.
+ //
+ typedef unsigned long UINT64;
+ typedef long INT64;
+ typedef unsigned int UINT32;
+ typedef int INT32;
+ typedef unsigned short UINT16;
+ typedef unsigned short CHAR16;
+ typedef short INT16;
+ typedef unsigned char BOOLEAN;
+ typedef unsigned char UINT8;
+ typedef char CHAR8;
+ typedef char INT8;
+ #endif
+ #endif
+
+ #define UINT8_MAX 0xff
+
+#else
+ //
+ // Use ANSI C 2000 stdint.h integer width declarations
+ //
+ #include <stdint.h>
+ typedef uint8_t BOOLEAN;
+ typedef int8_t INT8;
+ typedef uint8_t UINT8;
+ typedef int16_t INT16;
+ typedef uint16_t UINT16;
+ typedef int32_t INT32;
+ typedef uint32_t UINT32;
+ typedef int64_t INT64;
+ typedef uint64_t UINT64;
+ typedef char CHAR8;
+ typedef uint16_t CHAR16;
+
+#endif
+
+typedef UINT64 UINTN;
+typedef INT64 INTN;
+
+
+//
+// Processor specific defines
+//
+#define MAX_BIT 0x8000000000000000ULL
+#define MAX_2_BITS 0xC000000000000000ULL
+
+//
+// Modifier to ensure that all protocol member functions and EFI intrinsics
+// use the correct C calling convention. All protocol member functions and
+// EFI intrinsics are required to modify their member functions with EFIAPI.
+//
+#if _MSC_EXTENSIONS
+ ///
+ /// Define the standard calling convention regardless of optimization level.
+ /// __cdecl is Microsoft* specific C extension.
+ ///
+ #define EFIAPI __cdecl
+#elif __GNUC__
+ ///
+ /// Define the standard calling convention regardless of optimization level.
+ /// efidecl is an extension to GCC that supports the differnece between x64
+ /// GCC ABI and x64 Microsoft* ABI. EFI is closer to the Microsoft* ABI and
+ /// EFIAPI makes sure the right ABI is used for public interfaces.
+ /// eficecl is a work in progress and we do not yet have the compiler
+ ///
+ #define EFIAPI
+#else
+ #define EFIAPI
+#endif
+
+//
+// The Microsoft* C compiler can removed references to unreferenced data items
+// if the /OPT:REF linker option is used. We defined a macro as this is a
+// a non standard extension
+//
+#if _MSC_EXTENSIONS
+ #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
+#else
+ #define GLOBAL_REMOVE_IF_UNREFERENCED
+#endif
+
+#endif
+
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/GNUmakefile b/roms/edk2/BaseTools/Source/C/LzmaCompress/GNUmakefile
new file mode 100644
index 000000000..c837e7782
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/GNUmakefile
@@ -0,0 +1,27 @@
+## @file
+# GNU/Linux makefile for 'LzmaCompress' module build.
+#
+# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+MAKEROOT ?= ..
+
+APPNAME = LzmaCompress
+
+LIBS = -lCommon
+
+SDK_C = Sdk/C
+
+OBJECTS = \
+ LzmaCompress.o \
+ $(SDK_C)/Alloc.o \
+ $(SDK_C)/LzFind.o \
+ $(SDK_C)/LzmaDec.o \
+ $(SDK_C)/LzmaEnc.o \
+ $(SDK_C)/7zFile.o \
+ $(SDK_C)/7zStream.o \
+ $(SDK_C)/Bra86.o
+
+include $(MAKEROOT)/Makefiles/app.makefile
+
+BUILD_CFLAGS += -D_7ZIP_ST
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/LZMA-SDK-README.txt b/roms/edk2/BaseTools/Source/C/LzmaCompress/LZMA-SDK-README.txt
new file mode 100644
index 000000000..7cf967a77
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/LZMA-SDK-README.txt
@@ -0,0 +1,3 @@
+LzmaCompress is based on the LZMA SDK 18.05. LZMA SDK 18.05
+was placed in the public domain on 2018-04-30. It was
+released on the http://www.7-zip.org/sdk.html website.
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/LzmaCompress.c b/roms/edk2/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
new file mode 100644
index 000000000..bebdb9aa8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
@@ -0,0 +1,403 @@
+/** @file
+ LZMA Compress/Decompress tool (LzmaCompress)
+
+ Based on LZMA SDK 18.05:
+ LzmaUtil.c -- Test application for LZMA compression
+ 2018-04-30 : Igor Pavlov : Public domain
+
+ Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#define _CRT_SECURE_NO_WARNINGS
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "Sdk/C/Alloc.h"
+#include "Sdk/C/7zFile.h"
+#include "Sdk/C/7zVersion.h"
+#include "Sdk/C/LzmaDec.h"
+#include "Sdk/C/LzmaEnc.h"
+#include "Sdk/C/Bra.h"
+#include "CommonLib.h"
+#include "ParseInf.h"
+
+#define LZMA_HEADER_SIZE (LZMA_PROPS_SIZE + 8)
+
+typedef enum {
+ NoConverter,
+ X86Converter,
+ MaxConverter
+} CONVERTER_TYPE;
+
+const char *kCantReadMessage = "Can not read input file";
+const char *kCantWriteMessage = "Can not write output file";
+const char *kCantAllocateMessage = "Can not allocate memory";
+const char *kDataErrorMessage = "Data error";
+const char *kInvalidParamValMessage = "Invalid parameter value";
+
+static Bool mQuietMode = False;
+static CONVERTER_TYPE mConType = NoConverter;
+
+UINT64 mDictionarySize = 28;
+UINT64 mCompressionMode = 2;
+
+#define UTILITY_NAME "LzmaCompress"
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 2
+#define INTEL_COPYRIGHT \
+ "Copyright (c) 2009-2018, Intel Corporation. All rights reserved."
+void PrintHelp(char *buffer)
+{
+ strcat(buffer,
+ "\n" UTILITY_NAME " - " INTEL_COPYRIGHT "\n"
+ "Based on LZMA Utility " MY_VERSION_COPYRIGHT_DATE "\n"
+ "\nUsage: LzmaCompress -e|-d [options] <inputFile>\n"
+ " -e: encode file\n"
+ " -d: decode file\n"
+ " -o FileName, --output FileName: specify the output filename\n"
+ " --f86: enable converter for x86 code\n"
+ " -v, --verbose: increase output messages\n"
+ " -q, --quiet: reduce output messages\n"
+ " --debug [0-9]: set debug level\n"
+ " -a: set compression mode 0 = fast, 1 = normal, default: 1 (normal)\n"
+ " d: sets Dictionary size - [0, 27], default: 24 (16MB)\n"
+ " --version: display the program version and exit\n"
+ " -h, --help: display this help text\n"
+ );
+}
+
+int PrintError(char *buffer, const char *message)
+{
+ strcat(buffer, "\nError: ");
+ strcat(buffer, message);
+ strcat(buffer, "\n");
+ return 1;
+}
+
+int PrintErrorNumber(char *buffer, SRes val)
+{
+ sprintf(buffer + strlen(buffer), "\nError code: %x\n", (unsigned)val);
+ return 1;
+}
+
+int PrintUserError(char *buffer)
+{
+ return PrintError(buffer, "Incorrect command");
+}
+
+void PrintVersion(char *buffer)
+{
+ sprintf (buffer, "%s Version %d.%d %s ", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
+}
+
+static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 fileSize, CLzmaEncProps *props)
+{
+ SRes res;
+ size_t inSize = (size_t)fileSize;
+ Byte *inBuffer = 0;
+ Byte *outBuffer = 0;
+ Byte *filteredStream = 0;
+ size_t outSize;
+
+ if (inSize != 0) {
+ inBuffer = (Byte *)MyAlloc(inSize);
+ if (inBuffer == 0)
+ return SZ_ERROR_MEM;
+ } else {
+ return SZ_ERROR_INPUT_EOF;
+ }
+
+ if (SeqInStream_Read(inStream, inBuffer, inSize) != SZ_OK) {
+ res = SZ_ERROR_READ;
+ goto Done;
+ }
+
+ // we allocate 105% of original size + 64KB for output buffer
+ outSize = (size_t)fileSize / 20 * 21 + (1 << 16);
+ outBuffer = (Byte *)MyAlloc(outSize);
+ if (outBuffer == 0) {
+ res = SZ_ERROR_MEM;
+ goto Done;
+ }
+
+ {
+ int i;
+ for (i = 0; i < 8; i++)
+ outBuffer[i + LZMA_PROPS_SIZE] = (Byte)(fileSize >> (8 * i));
+ }
+
+ if (mConType != NoConverter)
+ {
+ filteredStream = (Byte *)MyAlloc(inSize);
+ if (filteredStream == 0) {
+ res = SZ_ERROR_MEM;
+ goto Done;
+ }
+ memcpy(filteredStream, inBuffer, inSize);
+
+ if (mConType == X86Converter) {
+ {
+ UInt32 x86State;
+ x86_Convert_Init(x86State);
+ x86_Convert(filteredStream, (SizeT) inSize, 0, &x86State, 1);
+ }
+ }
+ }
+
+ {
+ size_t outSizeProcessed = outSize - LZMA_HEADER_SIZE;
+ size_t outPropsSize = LZMA_PROPS_SIZE;
+
+ res = LzmaEncode(outBuffer + LZMA_HEADER_SIZE, &outSizeProcessed,
+ mConType != NoConverter ? filteredStream : inBuffer, inSize,
+ props, outBuffer, &outPropsSize, 0,
+ NULL, &g_Alloc, &g_Alloc);
+
+ if (res != SZ_OK)
+ goto Done;
+
+ outSize = LZMA_HEADER_SIZE + outSizeProcessed;
+ }
+
+ if (outStream->Write(outStream, outBuffer, outSize) != outSize)
+ res = SZ_ERROR_WRITE;
+
+Done:
+ MyFree(outBuffer);
+ MyFree(inBuffer);
+ MyFree(filteredStream);
+
+ return res;
+}
+
+static SRes Decode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 fileSize)
+{
+ SRes res;
+ size_t inSize = (size_t)fileSize;
+ Byte *inBuffer = 0;
+ Byte *outBuffer = 0;
+ size_t outSize = 0;
+ size_t inSizePure;
+ ELzmaStatus status;
+ UInt64 outSize64 = 0;
+
+ int i;
+
+ if (inSize < LZMA_HEADER_SIZE)
+ return SZ_ERROR_INPUT_EOF;
+
+ inBuffer = (Byte *)MyAlloc(inSize);
+ if (inBuffer == 0)
+ return SZ_ERROR_MEM;
+
+ if (SeqInStream_Read(inStream, inBuffer, inSize) != SZ_OK) {
+ res = SZ_ERROR_READ;
+ goto Done;
+ }
+
+ for (i = 0; i < 8; i++)
+ outSize64 += ((UInt64)inBuffer[LZMA_PROPS_SIZE + i]) << (i * 8);
+
+ outSize = (size_t)outSize64;
+ if (outSize != 0) {
+ outBuffer = (Byte *)MyAlloc(outSize);
+ if (outBuffer == 0) {
+ res = SZ_ERROR_MEM;
+ goto Done;
+ }
+ } else {
+ res = SZ_OK;
+ goto Done;
+ }
+
+ inSizePure = inSize - LZMA_HEADER_SIZE;
+ res = LzmaDecode(outBuffer, &outSize, inBuffer + LZMA_HEADER_SIZE, &inSizePure,
+ inBuffer, LZMA_PROPS_SIZE, LZMA_FINISH_END, &status, &g_Alloc);
+
+ if (res != SZ_OK)
+ goto Done;
+
+ if (mConType == X86Converter)
+ {
+ UInt32 x86State;
+ x86_Convert_Init(x86State);
+ x86_Convert(outBuffer, (SizeT) outSize, 0, &x86State, 0);
+ }
+
+ if (outStream->Write(outStream, outBuffer, outSize) != outSize)
+ res = SZ_ERROR_WRITE;
+
+Done:
+ MyFree(outBuffer);
+ MyFree(inBuffer);
+
+ return res;
+}
+
+int main2(int numArgs, const char *args[], char *rs)
+{
+ CFileSeqInStream inStream;
+ CFileOutStream outStream;
+ int res;
+ int encodeMode = 0;
+ Bool modeWasSet = False;
+ const char *inputFile = NULL;
+ const char *outputFile = "file.tmp";
+ int param;
+ UInt64 fileSize;
+ CLzmaEncProps props;
+
+ LzmaEncProps_Init(&props);
+ LzmaEncProps_Normalize(&props);
+
+ FileSeqInStream_CreateVTable(&inStream);
+ File_Construct(&inStream.file);
+
+ FileOutStream_CreateVTable(&outStream);
+ File_Construct(&outStream.file);
+
+ if (numArgs == 1)
+ {
+ PrintHelp(rs);
+ return 0;
+ }
+
+ for (param = 1; param < numArgs; param++) {
+ if (strcmp(args[param], "-e") == 0 || strcmp(args[param], "-d") == 0) {
+ encodeMode = (args[param][1] == 'e');
+ modeWasSet = True;
+ } else if (strcmp(args[param], "--f86") == 0) {
+ mConType = X86Converter;
+ } else if (strcmp(args[param], "-o") == 0 ||
+ strcmp(args[param], "--output") == 0) {
+ if (numArgs < (param + 2)) {
+ return PrintUserError(rs);
+ }
+ outputFile = args[++param];
+ } else if (strcmp(args[param], "--debug") == 0) {
+ if (numArgs < (param + 2)) {
+ return PrintUserError(rs);
+ }
+ //
+ // For now we silently ignore this parameter to achieve command line
+ // parameter compatibility with other build tools.
+ //
+ param++;
+ } else if (strcmp(args[param], "-a") == 0) {
+ AsciiStringToUint64(args[param + 1],FALSE,&mCompressionMode);
+ if ((mCompressionMode == 0)||(mCompressionMode == 1)){
+ props.algo = (int)mCompressionMode;
+ param++;
+ continue;
+ } else {
+ return PrintError(rs, kInvalidParamValMessage);
+ }
+ } else if (strcmp(args[param], "d") == 0) {
+ AsciiStringToUint64(args[param + 1],FALSE,&mDictionarySize);
+ if (mDictionarySize <= 27) {
+ if (mDictionarySize == 0) {
+ props.dictSize = 0;
+ } else {
+ props.dictSize = (1 << mDictionarySize);
+ }
+ param++;
+ continue;
+ } else {
+ return PrintError(rs, kInvalidParamValMessage);
+ }
+ } else if (
+ strcmp(args[param], "-h") == 0 ||
+ strcmp(args[param], "--help") == 0
+ ) {
+ PrintHelp(rs);
+ return 0;
+ } else if (
+ strcmp(args[param], "-v") == 0 ||
+ strcmp(args[param], "--verbose") == 0
+ ) {
+ //
+ // For now we silently ignore this parameter to achieve command line
+ // parameter compatibility with other build tools.
+ //
+ } else if (
+ strcmp(args[param], "-q") == 0 ||
+ strcmp(args[param], "--quiet") == 0
+ ) {
+ mQuietMode = True;
+ } else if (strcmp(args[param], "--version") == 0) {
+ PrintVersion(rs);
+ return 0;
+ } else if (inputFile == NULL) {
+ inputFile = args[param];
+ } else {
+ return PrintUserError(rs);
+ }
+ }
+
+ if ((inputFile == NULL) || !modeWasSet) {
+ return PrintUserError(rs);
+ }
+
+ {
+ size_t t4 = sizeof(UInt32);
+ size_t t8 = sizeof(UInt64);
+ if (t4 != 4 || t8 != 8)
+ return PrintError(rs, "Incorrect UInt32 or UInt64");
+ }
+
+ if (InFile_Open(&inStream.file, inputFile) != 0)
+ return PrintError(rs, "Can not open input file");
+
+ if (OutFile_Open(&outStream.file, outputFile) != 0) {
+ File_Close(&inStream.file);
+ return PrintError(rs, "Can not open output file");
+ }
+
+ File_GetLength(&inStream.file, &fileSize);
+
+ if (encodeMode)
+ {
+ if (!mQuietMode) {
+ printf("Encoding\n");
+ }
+ res = Encode(&outStream.vt, &inStream.vt, fileSize, &props);
+ }
+ else
+ {
+ if (!mQuietMode) {
+ printf("Decoding\n");
+ }
+ res = Decode(&outStream.vt, &inStream.vt, fileSize);
+ }
+
+ File_Close(&outStream.file);
+ File_Close(&inStream.file);
+
+ if (res != SZ_OK)
+ {
+ if (res == SZ_ERROR_MEM)
+ return PrintError(rs, kCantAllocateMessage);
+ else if (res == SZ_ERROR_DATA)
+ return PrintError(rs, kDataErrorMessage);
+ else if (res == SZ_ERROR_WRITE)
+ return PrintError(rs, kCantWriteMessage);
+ else if (res == SZ_ERROR_READ)
+ return PrintError(rs, kCantReadMessage);
+ return PrintErrorNumber(rs, res);
+ }
+ return 0;
+}
+
+int MY_CDECL main(int numArgs, const char *args[])
+{
+ char rs[2000] = { 0 };
+ int res = main2(numArgs, args, rs);
+ if (strlen(rs) > 0) {
+ puts(rs);
+ }
+ return res;
+}
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/LzmaF86Compress.bat b/roms/edk2/BaseTools/Source/C/LzmaCompress/LzmaF86Compress.bat
new file mode 100644
index 000000000..95b96564e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/LzmaF86Compress.bat
@@ -0,0 +1,26 @@
+@REM @file
+@REM This script will exec LzmaCompress tool with --f86 option that enables
+@REM converter for x86 code.
+@REM
+@REM Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
+@REM SPDX-License-Identifier: BSD-2-Clause-Patent
+@REM
+
+@echo off
+@setlocal
+
+:Begin
+if "%1"=="" goto End
+if "%1"=="-e" (
+ set FLAG=--f86
+)
+if "%1"=="-d" (
+ set FLAG=--f86
+)
+set ARGS=%ARGS% %1
+shift
+goto Begin
+
+:End
+LzmaCompress %ARGS% %FLAG%
+@echo on
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Makefile b/roms/edk2/BaseTools/Source/C/LzmaCompress/Makefile
new file mode 100644
index 000000000..055f5d3ac
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Makefile
@@ -0,0 +1,37 @@
+## @file
+# Windows makefile for 'LzmaCompress' module build.
+#
+# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+APPNAME = LzmaCompress
+
+LIBS = $(LIB_PATH)\Common.lib
+
+SDK_C = Sdk\C
+
+OBJECTS = \
+ LzmaCompress.obj \
+ $(SDK_C)\Alloc.obj \
+ $(SDK_C)\LzFind.obj \
+ $(SDK_C)\LzmaDec.obj \
+ $(SDK_C)\LzmaEnc.obj \
+ $(SDK_C)\7zFile.obj \
+ $(SDK_C)\7zStream.obj \
+ $(SDK_C)\Bra86.obj \
+ $(SDK_C)\LzFindMt.obj \
+ $(SDK_C)\Threads.obj
+
+!INCLUDE ..\Makefiles\ms.app
+
+all: $(BIN_PATH)\LzmaF86Compress.bat
+
+$(BIN_PATH)\LzmaF86Compress.bat: LzmaF86Compress.bat
+ copy LzmaF86Compress.bat $(BIN_PATH)\LzmaF86Compress.bat /Y
+
+cleanall: localCleanall
+
+localCleanall:
+ del /f /q $(BIN_PATH)\LzmaF86Compress.bat > nul
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zFile.c b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zFile.c
new file mode 100644
index 000000000..e486901e3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zFile.c
@@ -0,0 +1,286 @@
+/* 7zFile.c -- File IO
+2017-04-03 : Igor Pavlov : Public domain */
+
+#include "Precomp.h"
+
+#include "7zFile.h"
+
+#ifndef USE_WINDOWS_FILE
+
+#ifndef UNDER_CE
+#include <errno.h>
+#endif
+
+#else
+
+/*
+ ReadFile and WriteFile functions in Windows have BUG:
+ If you Read or Write 64MB or more (probably min_failure_size = 64MB - 32KB + 1)
+ from/to Network file, it returns ERROR_NO_SYSTEM_RESOURCES
+ (Insufficient system resources exist to complete the requested service).
+ Probably in some version of Windows there are problems with other sizes:
+ for 32 MB (maybe also for 16 MB).
+ And message can be "Network connection was lost"
+*/
+
+#define kChunkSizeMax (1 << 22)
+
+#endif
+
+void File_Construct(CSzFile *p)
+{
+ #ifdef USE_WINDOWS_FILE
+ p->handle = INVALID_HANDLE_VALUE;
+ #else
+ p->file = NULL;
+ #endif
+}
+
+#if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE)
+static WRes File_Open(CSzFile *p, const char *name, int writeMode)
+{
+ #ifdef USE_WINDOWS_FILE
+ p->handle = CreateFileA(name,
+ writeMode ? GENERIC_WRITE : GENERIC_READ,
+ FILE_SHARE_READ, NULL,
+ writeMode ? CREATE_ALWAYS : OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL, NULL);
+ return (p->handle != INVALID_HANDLE_VALUE) ? 0 : GetLastError();
+ #else
+ p->file = fopen(name, writeMode ? "wb+" : "rb");
+ return (p->file != 0) ? 0 :
+ #ifdef UNDER_CE
+ 2; /* ENOENT */
+ #else
+ errno;
+ #endif
+ #endif
+}
+
+WRes InFile_Open(CSzFile *p, const char *name) { return File_Open(p, name, 0); }
+WRes OutFile_Open(CSzFile *p, const char *name) { return File_Open(p, name, 1); }
+#endif
+
+#ifdef USE_WINDOWS_FILE
+static WRes File_OpenW(CSzFile *p, const WCHAR *name, int writeMode)
+{
+ p->handle = CreateFileW(name,
+ writeMode ? GENERIC_WRITE : GENERIC_READ,
+ FILE_SHARE_READ, NULL,
+ writeMode ? CREATE_ALWAYS : OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL, NULL);
+ return (p->handle != INVALID_HANDLE_VALUE) ? 0 : GetLastError();
+}
+WRes InFile_OpenW(CSzFile *p, const WCHAR *name) { return File_OpenW(p, name, 0); }
+WRes OutFile_OpenW(CSzFile *p, const WCHAR *name) { return File_OpenW(p, name, 1); }
+#endif
+
+WRes File_Close(CSzFile *p)
+{
+ #ifdef USE_WINDOWS_FILE
+ if (p->handle != INVALID_HANDLE_VALUE)
+ {
+ if (!CloseHandle(p->handle))
+ return GetLastError();
+ p->handle = INVALID_HANDLE_VALUE;
+ }
+ #else
+ if (p->file != NULL)
+ {
+ int res = fclose(p->file);
+ if (res != 0)
+ return res;
+ p->file = NULL;
+ }
+ #endif
+ return 0;
+}
+
+WRes File_Read(CSzFile *p, void *data, size_t *size)
+{
+ size_t originalSize = *size;
+ if (originalSize == 0)
+ return 0;
+
+ #ifdef USE_WINDOWS_FILE
+
+ *size = 0;
+ do
+ {
+ DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize;
+ DWORD processed = 0;
+ BOOL res = ReadFile(p->handle, data, curSize, &processed, NULL);
+ data = (void *)((Byte *)data + processed);
+ originalSize -= processed;
+ *size += processed;
+ if (!res)
+ return GetLastError();
+ if (processed == 0)
+ break;
+ }
+ while (originalSize > 0);
+ return 0;
+
+ #else
+
+ *size = fread(data, 1, originalSize, p->file);
+ if (*size == originalSize)
+ return 0;
+ return ferror(p->file);
+
+ #endif
+}
+
+WRes File_Write(CSzFile *p, const void *data, size_t *size)
+{
+ size_t originalSize = *size;
+ if (originalSize == 0)
+ return 0;
+
+ #ifdef USE_WINDOWS_FILE
+
+ *size = 0;
+ do
+ {
+ DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize;
+ DWORD processed = 0;
+ BOOL res = WriteFile(p->handle, data, curSize, &processed, NULL);
+ data = (void *)((Byte *)data + processed);
+ originalSize -= processed;
+ *size += processed;
+ if (!res)
+ return GetLastError();
+ if (processed == 0)
+ break;
+ }
+ while (originalSize > 0);
+ return 0;
+
+ #else
+
+ *size = fwrite(data, 1, originalSize, p->file);
+ if (*size == originalSize)
+ return 0;
+ return ferror(p->file);
+
+ #endif
+}
+
+WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
+{
+ #ifdef USE_WINDOWS_FILE
+
+ LARGE_INTEGER value;
+ DWORD moveMethod;
+ value.LowPart = (DWORD)*pos;
+ value.HighPart = (LONG)((UInt64)*pos >> 16 >> 16); /* for case when UInt64 is 32-bit only */
+ switch (origin)
+ {
+ case SZ_SEEK_SET: moveMethod = FILE_BEGIN; break;
+ case SZ_SEEK_CUR: moveMethod = FILE_CURRENT; break;
+ case SZ_SEEK_END: moveMethod = FILE_END; break;
+ default: return ERROR_INVALID_PARAMETER;
+ }
+ value.LowPart = SetFilePointer(p->handle, value.LowPart, &value.HighPart, moveMethod);
+ if (value.LowPart == 0xFFFFFFFF)
+ {
+ WRes res = GetLastError();
+ if (res != NO_ERROR)
+ return res;
+ }
+ *pos = ((Int64)value.HighPart << 32) | value.LowPart;
+ return 0;
+
+ #else
+
+ int moveMethod;
+ int res;
+ switch (origin)
+ {
+ case SZ_SEEK_SET: moveMethod = SEEK_SET; break;
+ case SZ_SEEK_CUR: moveMethod = SEEK_CUR; break;
+ case SZ_SEEK_END: moveMethod = SEEK_END; break;
+ default: return 1;
+ }
+ res = fseek(p->file, (long)*pos, moveMethod);
+ *pos = ftell(p->file);
+ return res;
+
+ #endif
+}
+
+WRes File_GetLength(CSzFile *p, UInt64 *length)
+{
+ #ifdef USE_WINDOWS_FILE
+
+ DWORD sizeHigh;
+ DWORD sizeLow = GetFileSize(p->handle, &sizeHigh);
+ if (sizeLow == 0xFFFFFFFF)
+ {
+ DWORD res = GetLastError();
+ if (res != NO_ERROR)
+ return res;
+ }
+ *length = (((UInt64)sizeHigh) << 32) + sizeLow;
+ return 0;
+
+ #else
+
+ long pos = ftell(p->file);
+ int res = fseek(p->file, 0, SEEK_END);
+ *length = ftell(p->file);
+ fseek(p->file, pos, SEEK_SET);
+ return res;
+
+ #endif
+}
+
+
+/* ---------- FileSeqInStream ---------- */
+
+static SRes FileSeqInStream_Read(const ISeqInStream *pp, void *buf, size_t *size)
+{
+ CFileSeqInStream *p = CONTAINER_FROM_VTBL(pp, CFileSeqInStream, vt);
+ return File_Read(&p->file, buf, size) == 0 ? SZ_OK : SZ_ERROR_READ;
+}
+
+void FileSeqInStream_CreateVTable(CFileSeqInStream *p)
+{
+ p->vt.Read = FileSeqInStream_Read;
+}
+
+
+/* ---------- FileInStream ---------- */
+
+static SRes FileInStream_Read(const ISeekInStream *pp, void *buf, size_t *size)
+{
+ CFileInStream *p = CONTAINER_FROM_VTBL(pp, CFileInStream, vt);
+ return (File_Read(&p->file, buf, size) == 0) ? SZ_OK : SZ_ERROR_READ;
+}
+
+static SRes FileInStream_Seek(const ISeekInStream *pp, Int64 *pos, ESzSeek origin)
+{
+ CFileInStream *p = CONTAINER_FROM_VTBL(pp, CFileInStream, vt);
+ return File_Seek(&p->file, pos, origin);
+}
+
+void FileInStream_CreateVTable(CFileInStream *p)
+{
+ p->vt.Read = FileInStream_Read;
+ p->vt.Seek = FileInStream_Seek;
+}
+
+
+/* ---------- FileOutStream ---------- */
+
+static size_t FileOutStream_Write(const ISeqOutStream *pp, const void *data, size_t size)
+{
+ CFileOutStream *p = CONTAINER_FROM_VTBL(pp, CFileOutStream, vt);
+ File_Write(&p->file, data, &size);
+ return size;
+}
+
+void FileOutStream_CreateVTable(CFileOutStream *p)
+{
+ p->vt.Write = FileOutStream_Write;
+}
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zFile.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zFile.h
new file mode 100644
index 000000000..7e263bea1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zFile.h
@@ -0,0 +1,83 @@
+/* 7zFile.h -- File IO
+2017-04-03 : Igor Pavlov : Public domain */
+
+#ifndef __7Z_FILE_H
+#define __7Z_FILE_H
+
+#ifdef _WIN32
+#define USE_WINDOWS_FILE
+#endif
+
+#ifdef USE_WINDOWS_FILE
+#include <windows.h>
+#else
+#include <stdio.h>
+#endif
+
+#include "7zTypes.h"
+
+EXTERN_C_BEGIN
+
+/* ---------- File ---------- */
+
+typedef struct
+{
+ #ifdef USE_WINDOWS_FILE
+ HANDLE handle;
+ #else
+ FILE *file;
+ #endif
+} CSzFile;
+
+void File_Construct(CSzFile *p);
+#if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE)
+WRes InFile_Open(CSzFile *p, const char *name);
+WRes OutFile_Open(CSzFile *p, const char *name);
+#endif
+#ifdef USE_WINDOWS_FILE
+WRes InFile_OpenW(CSzFile *p, const WCHAR *name);
+WRes OutFile_OpenW(CSzFile *p, const WCHAR *name);
+#endif
+WRes File_Close(CSzFile *p);
+
+/* reads max(*size, remain file's size) bytes */
+WRes File_Read(CSzFile *p, void *data, size_t *size);
+
+/* writes *size bytes */
+WRes File_Write(CSzFile *p, const void *data, size_t *size);
+
+WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin);
+WRes File_GetLength(CSzFile *p, UInt64 *length);
+
+
+/* ---------- FileInStream ---------- */
+
+typedef struct
+{
+ ISeqInStream vt;
+ CSzFile file;
+} CFileSeqInStream;
+
+void FileSeqInStream_CreateVTable(CFileSeqInStream *p);
+
+
+typedef struct
+{
+ ISeekInStream vt;
+ CSzFile file;
+} CFileInStream;
+
+void FileInStream_CreateVTable(CFileInStream *p);
+
+
+typedef struct
+{
+ ISeqOutStream vt;
+ CSzFile file;
+} CFileOutStream;
+
+void FileOutStream_CreateVTable(CFileOutStream *p);
+
+EXTERN_C_END
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zStream.c b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zStream.c
new file mode 100644
index 000000000..579741fad
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zStream.c
@@ -0,0 +1,176 @@
+/* 7zStream.c -- 7z Stream functions
+2017-04-03 : Igor Pavlov : Public domain */
+
+#include "Precomp.h"
+
+#include <string.h>
+
+#include "7zTypes.h"
+
+SRes SeqInStream_Read2(const ISeqInStream *stream, void *buf, size_t size, SRes errorType)
+{
+ while (size != 0)
+ {
+ size_t processed = size;
+ RINOK(ISeqInStream_Read(stream, buf, &processed));
+ if (processed == 0)
+ return errorType;
+ buf = (void *)((Byte *)buf + processed);
+ size -= processed;
+ }
+ return SZ_OK;
+}
+
+SRes SeqInStream_Read(const ISeqInStream *stream, void *buf, size_t size)
+{
+ return SeqInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
+}
+
+SRes SeqInStream_ReadByte(const ISeqInStream *stream, Byte *buf)
+{
+ size_t processed = 1;
+ RINOK(ISeqInStream_Read(stream, buf, &processed));
+ return (processed == 1) ? SZ_OK : SZ_ERROR_INPUT_EOF;
+}
+
+
+
+SRes LookInStream_SeekTo(const ILookInStream *stream, UInt64 offset)
+{
+ Int64 t = offset;
+ return ILookInStream_Seek(stream, &t, SZ_SEEK_SET);
+}
+
+SRes LookInStream_LookRead(const ILookInStream *stream, void *buf, size_t *size)
+{
+ const void *lookBuf;
+ if (*size == 0)
+ return SZ_OK;
+ RINOK(ILookInStream_Look(stream, &lookBuf, size));
+ memcpy(buf, lookBuf, *size);
+ return ILookInStream_Skip(stream, *size);
+}
+
+SRes LookInStream_Read2(const ILookInStream *stream, void *buf, size_t size, SRes errorType)
+{
+ while (size != 0)
+ {
+ size_t processed = size;
+ RINOK(ILookInStream_Read(stream, buf, &processed));
+ if (processed == 0)
+ return errorType;
+ buf = (void *)((Byte *)buf + processed);
+ size -= processed;
+ }
+ return SZ_OK;
+}
+
+SRes LookInStream_Read(const ILookInStream *stream, void *buf, size_t size)
+{
+ return LookInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
+}
+
+
+
+#define GET_LookToRead2 CLookToRead2 *p = CONTAINER_FROM_VTBL(pp, CLookToRead2, vt);
+
+static SRes LookToRead2_Look_Lookahead(const ILookInStream *pp, const void **buf, size_t *size)
+{
+ SRes res = SZ_OK;
+ GET_LookToRead2
+ size_t size2 = p->size - p->pos;
+ if (size2 == 0 && *size != 0)
+ {
+ p->pos = 0;
+ p->size = 0;
+ size2 = p->bufSize;
+ res = ISeekInStream_Read(p->realStream, p->buf, &size2);
+ p->size = size2;
+ }
+ if (*size > size2)
+ *size = size2;
+ *buf = p->buf + p->pos;
+ return res;
+}
+
+static SRes LookToRead2_Look_Exact(const ILookInStream *pp, const void **buf, size_t *size)
+{
+ SRes res = SZ_OK;
+ GET_LookToRead2
+ size_t size2 = p->size - p->pos;
+ if (size2 == 0 && *size != 0)
+ {
+ p->pos = 0;
+ p->size = 0;
+ if (*size > p->bufSize)
+ *size = p->bufSize;
+ res = ISeekInStream_Read(p->realStream, p->buf, size);
+ size2 = p->size = *size;
+ }
+ if (*size > size2)
+ *size = size2;
+ *buf = p->buf + p->pos;
+ return res;
+}
+
+static SRes LookToRead2_Skip(const ILookInStream *pp, size_t offset)
+{
+ GET_LookToRead2
+ p->pos += offset;
+ return SZ_OK;
+}
+
+static SRes LookToRead2_Read(const ILookInStream *pp, void *buf, size_t *size)
+{
+ GET_LookToRead2
+ size_t rem = p->size - p->pos;
+ if (rem == 0)
+ return ISeekInStream_Read(p->realStream, buf, size);
+ if (rem > *size)
+ rem = *size;
+ memcpy(buf, p->buf + p->pos, rem);
+ p->pos += rem;
+ *size = rem;
+ return SZ_OK;
+}
+
+static SRes LookToRead2_Seek(const ILookInStream *pp, Int64 *pos, ESzSeek origin)
+{
+ GET_LookToRead2
+ p->pos = p->size = 0;
+ return ISeekInStream_Seek(p->realStream, pos, origin);
+}
+
+void LookToRead2_CreateVTable(CLookToRead2 *p, int lookahead)
+{
+ p->vt.Look = lookahead ?
+ LookToRead2_Look_Lookahead :
+ LookToRead2_Look_Exact;
+ p->vt.Skip = LookToRead2_Skip;
+ p->vt.Read = LookToRead2_Read;
+ p->vt.Seek = LookToRead2_Seek;
+}
+
+
+
+static SRes SecToLook_Read(const ISeqInStream *pp, void *buf, size_t *size)
+{
+ CSecToLook *p = CONTAINER_FROM_VTBL(pp, CSecToLook, vt);
+ return LookInStream_LookRead(p->realStream, buf, size);
+}
+
+void SecToLook_CreateVTable(CSecToLook *p)
+{
+ p->vt.Read = SecToLook_Read;
+}
+
+static SRes SecToRead_Read(const ISeqInStream *pp, void *buf, size_t *size)
+{
+ CSecToRead *p = CONTAINER_FROM_VTBL(pp, CSecToRead, vt);
+ return ILookInStream_Read(p->realStream, buf, size);
+}
+
+void SecToRead_CreateVTable(CSecToRead *p)
+{
+ p->vt.Read = SecToRead_Read;
+}
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zTypes.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zTypes.h
new file mode 100644
index 000000000..4977cdaa6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zTypes.h
@@ -0,0 +1,374 @@
+/* 7zTypes.h -- Basic types
+2017-07-17 : Igor Pavlov : Public domain */
+
+#ifndef __7Z_TYPES_H
+#define __7Z_TYPES_H
+
+#ifdef _WIN32
+/* #include <windows.h> */
+#endif
+
+#include <stddef.h>
+
+#ifndef EXTERN_C_BEGIN
+#ifdef __cplusplus
+#define EXTERN_C_BEGIN extern "C" {
+#define EXTERN_C_END }
+#else
+#define EXTERN_C_BEGIN
+#define EXTERN_C_END
+#endif
+#endif
+
+EXTERN_C_BEGIN
+
+#define SZ_OK 0
+
+#define SZ_ERROR_DATA 1
+#define SZ_ERROR_MEM 2
+#define SZ_ERROR_CRC 3
+#define SZ_ERROR_UNSUPPORTED 4
+#define SZ_ERROR_PARAM 5
+#define SZ_ERROR_INPUT_EOF 6
+#define SZ_ERROR_OUTPUT_EOF 7
+#define SZ_ERROR_READ 8
+#define SZ_ERROR_WRITE 9
+#define SZ_ERROR_PROGRESS 10
+#define SZ_ERROR_FAIL 11
+#define SZ_ERROR_THREAD 12
+
+#define SZ_ERROR_ARCHIVE 16
+#define SZ_ERROR_NO_ARCHIVE 17
+
+typedef int SRes;
+
+
+#ifdef _WIN32
+
+/* typedef DWORD WRes; */
+typedef unsigned WRes;
+#define MY_SRes_HRESULT_FROM_WRes(x) HRESULT_FROM_WIN32(x)
+
+#else
+
+typedef int WRes;
+#define MY__FACILITY_WIN32 7
+#define MY__FACILITY__WRes MY__FACILITY_WIN32
+#define MY_SRes_HRESULT_FROM_WRes(x) ((HRESULT)(x) <= 0 ? ((HRESULT)(x)) : ((HRESULT) (((x) & 0x0000FFFF) | (MY__FACILITY__WRes << 16) | 0x80000000)))
+
+#endif
+
+
+#ifndef RINOK
+#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
+#endif
+
+typedef unsigned char Byte;
+typedef short Int16;
+typedef unsigned short UInt16;
+
+#ifdef _LZMA_UINT32_IS_ULONG
+typedef long Int32;
+typedef unsigned long UInt32;
+#else
+typedef int Int32;
+typedef unsigned int UInt32;
+#endif
+
+#ifdef _SZ_NO_INT_64
+
+/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
+ NOTES: Some code will work incorrectly in that case! */
+
+typedef long Int64;
+typedef unsigned long UInt64;
+
+#else
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+typedef __int64 Int64;
+typedef unsigned __int64 UInt64;
+#define UINT64_CONST(n) n
+#else
+typedef long long int Int64;
+typedef unsigned long long int UInt64;
+#define UINT64_CONST(n) n ## ULL
+#endif
+
+#endif
+
+#ifdef _LZMA_NO_SYSTEM_SIZE_T
+typedef UInt32 SizeT;
+#else
+typedef size_t SizeT;
+#endif
+
+typedef int Bool;
+#define True 1
+#define False 0
+
+
+#ifdef _WIN32
+#define MY_STD_CALL __stdcall
+#else
+#define MY_STD_CALL
+#endif
+
+#ifdef _MSC_VER
+
+#if _MSC_VER >= 1300
+#define MY_NO_INLINE __declspec(noinline)
+#else
+#define MY_NO_INLINE
+#endif
+
+#define MY_FORCE_INLINE __forceinline
+
+#define MY_CDECL __cdecl
+#define MY_FAST_CALL __fastcall
+
+#else
+
+#define MY_NO_INLINE
+#define MY_FORCE_INLINE
+#define MY_CDECL
+#define MY_FAST_CALL
+
+/* inline keyword : for C++ / C99 */
+
+/* GCC, clang: */
+/*
+#if defined (__GNUC__) && (__GNUC__ >= 4)
+#define MY_FORCE_INLINE __attribute__((always_inline))
+#define MY_NO_INLINE __attribute__((noinline))
+#endif
+*/
+
+#endif
+
+
+/* The following interfaces use first parameter as pointer to structure */
+
+typedef struct IByteIn IByteIn;
+struct IByteIn
+{
+ Byte (*Read)(const IByteIn *p); /* reads one byte, returns 0 in case of EOF or error */
+};
+#define IByteIn_Read(p) (p)->Read(p)
+
+
+typedef struct IByteOut IByteOut;
+struct IByteOut
+{
+ void (*Write)(const IByteOut *p, Byte b);
+};
+#define IByteOut_Write(p, b) (p)->Write(p, b)
+
+
+typedef struct ISeqInStream ISeqInStream;
+struct ISeqInStream
+{
+ SRes (*Read)(const ISeqInStream *p, void *buf, size_t *size);
+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
+ (output(*size) < input(*size)) is allowed */
+};
+#define ISeqInStream_Read(p, buf, size) (p)->Read(p, buf, size)
+
+/* it can return SZ_ERROR_INPUT_EOF */
+SRes SeqInStream_Read(const ISeqInStream *stream, void *buf, size_t size);
+SRes SeqInStream_Read2(const ISeqInStream *stream, void *buf, size_t size, SRes errorType);
+SRes SeqInStream_ReadByte(const ISeqInStream *stream, Byte *buf);
+
+
+typedef struct ISeqOutStream ISeqOutStream;
+struct ISeqOutStream
+{
+ size_t (*Write)(const ISeqOutStream *p, const void *buf, size_t size);
+ /* Returns: result - the number of actually written bytes.
+ (result < size) means error */
+};
+#define ISeqOutStream_Write(p, buf, size) (p)->Write(p, buf, size)
+
+typedef enum
+{
+ SZ_SEEK_SET = 0,
+ SZ_SEEK_CUR = 1,
+ SZ_SEEK_END = 2
+} ESzSeek;
+
+
+typedef struct ISeekInStream ISeekInStream;
+struct ISeekInStream
+{
+ SRes (*Read)(const ISeekInStream *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
+ SRes (*Seek)(const ISeekInStream *p, Int64 *pos, ESzSeek origin);
+};
+#define ISeekInStream_Read(p, buf, size) (p)->Read(p, buf, size)
+#define ISeekInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
+
+
+typedef struct ILookInStream ILookInStream;
+struct ILookInStream
+{
+ SRes (*Look)(const ILookInStream *p, const void **buf, size_t *size);
+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
+ (output(*size) > input(*size)) is not allowed
+ (output(*size) < input(*size)) is allowed */
+ SRes (*Skip)(const ILookInStream *p, size_t offset);
+ /* offset must be <= output(*size) of Look */
+
+ SRes (*Read)(const ILookInStream *p, void *buf, size_t *size);
+ /* reads directly (without buffer). It's same as ISeqInStream::Read */
+ SRes (*Seek)(const ILookInStream *p, Int64 *pos, ESzSeek origin);
+};
+
+#define ILookInStream_Look(p, buf, size) (p)->Look(p, buf, size)
+#define ILookInStream_Skip(p, offset) (p)->Skip(p, offset)
+#define ILookInStream_Read(p, buf, size) (p)->Read(p, buf, size)
+#define ILookInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
+
+
+SRes LookInStream_LookRead(const ILookInStream *stream, void *buf, size_t *size);
+SRes LookInStream_SeekTo(const ILookInStream *stream, UInt64 offset);
+
+/* reads via ILookInStream::Read */
+SRes LookInStream_Read2(const ILookInStream *stream, void *buf, size_t size, SRes errorType);
+SRes LookInStream_Read(const ILookInStream *stream, void *buf, size_t size);
+
+
+
+typedef struct
+{
+ ILookInStream vt;
+ const ISeekInStream *realStream;
+
+ size_t pos;
+ size_t size; /* it's data size */
+
+ /* the following variables must be set outside */
+ Byte *buf;
+ size_t bufSize;
+} CLookToRead2;
+
+void LookToRead2_CreateVTable(CLookToRead2 *p, int lookahead);
+
+#define LookToRead2_Init(p) { (p)->pos = (p)->size = 0; }
+
+
+typedef struct
+{
+ ISeqInStream vt;
+ const ILookInStream *realStream;
+} CSecToLook;
+
+void SecToLook_CreateVTable(CSecToLook *p);
+
+
+
+typedef struct
+{
+ ISeqInStream vt;
+ const ILookInStream *realStream;
+} CSecToRead;
+
+void SecToRead_CreateVTable(CSecToRead *p);
+
+
+typedef struct ICompressProgress ICompressProgress;
+
+struct ICompressProgress
+{
+ SRes (*Progress)(const ICompressProgress *p, UInt64 inSize, UInt64 outSize);
+ /* Returns: result. (result != SZ_OK) means break.
+ Value (UInt64)(Int64)-1 for size means unknown value. */
+};
+#define ICompressProgress_Progress(p, inSize, outSize) (p)->Progress(p, inSize, outSize)
+
+
+
+typedef struct ISzAlloc ISzAlloc;
+typedef const ISzAlloc * ISzAllocPtr;
+
+struct ISzAlloc
+{
+ void *(*Alloc)(ISzAllocPtr p, size_t size);
+ void (*Free)(ISzAllocPtr p, void *address); /* address can be 0 */
+};
+
+#define ISzAlloc_Alloc(p, size) (p)->Alloc(p, size)
+#define ISzAlloc_Free(p, a) (p)->Free(p, a)
+
+/* deprecated */
+#define IAlloc_Alloc(p, size) ISzAlloc_Alloc(p, size)
+#define IAlloc_Free(p, a) ISzAlloc_Free(p, a)
+
+
+
+
+
+#ifndef MY_offsetof
+ #ifdef offsetof
+ #define MY_offsetof(type, m) offsetof(type, m)
+ /*
+ #define MY_offsetof(type, m) FIELD_OFFSET(type, m)
+ */
+ #else
+ #define MY_offsetof(type, m) ((size_t)&(((type *)0)->m))
+ #endif
+#endif
+
+
+
+#ifndef MY_container_of
+
+/*
+#define MY_container_of(ptr, type, m) container_of(ptr, type, m)
+#define MY_container_of(ptr, type, m) CONTAINING_RECORD(ptr, type, m)
+#define MY_container_of(ptr, type, m) ((type *)((char *)(ptr) - offsetof(type, m)))
+#define MY_container_of(ptr, type, m) (&((type *)0)->m == (ptr), ((type *)(((char *)(ptr)) - MY_offsetof(type, m))))
+*/
+
+/*
+ GCC shows warning: "perhaps the 'offsetof' macro was used incorrectly"
+ GCC 3.4.4 : classes with constructor
+ GCC 4.8.1 : classes with non-public variable members"
+*/
+
+#define MY_container_of(ptr, type, m) ((type *)((char *)(1 ? (ptr) : &((type *)0)->m) - MY_offsetof(type, m)))
+
+
+#endif
+
+#define CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m) ((type *)(ptr))
+
+/*
+#define CONTAINER_FROM_VTBL(ptr, type, m) CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
+*/
+#define CONTAINER_FROM_VTBL(ptr, type, m) MY_container_of(ptr, type, m)
+
+#define CONTAINER_FROM_VTBL_CLS(ptr, type, m) CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
+/*
+#define CONTAINER_FROM_VTBL_CLS(ptr, type, m) CONTAINER_FROM_VTBL(ptr, type, m)
+*/
+
+
+
+#ifdef _WIN32
+
+#define CHAR_PATH_SEPARATOR '\\'
+#define WCHAR_PATH_SEPARATOR L'\\'
+#define STRING_PATH_SEPARATOR "\\"
+#define WSTRING_PATH_SEPARATOR L"\\"
+
+#else
+
+#define CHAR_PATH_SEPARATOR '/'
+#define WCHAR_PATH_SEPARATOR L'/'
+#define STRING_PATH_SEPARATOR "/"
+#define WSTRING_PATH_SEPARATOR L"/"
+
+#endif
+
+EXTERN_C_END
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zVersion.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zVersion.h
new file mode 100644
index 000000000..ed3aa9427
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/7zVersion.h
@@ -0,0 +1,27 @@
+#define MY_VER_MAJOR 18
+#define MY_VER_MINOR 05
+#define MY_VER_BUILD 0
+#define MY_VERSION_NUMBERS "18.05"
+#define MY_VERSION MY_VERSION_NUMBERS
+
+#ifdef MY_CPU_NAME
+ #define MY_VERSION_CPU MY_VERSION " (" MY_CPU_NAME ")"
+#else
+ #define MY_VERSION_CPU MY_VERSION
+#endif
+
+#define MY_DATE "2018-04-30"
+#undef MY_COPYRIGHT
+#undef MY_VERSION_COPYRIGHT_DATE
+#define MY_AUTHOR_NAME "Igor Pavlov"
+#define MY_COPYRIGHT_PD "Igor Pavlov : Public domain"
+#define MY_COPYRIGHT_CR "Copyright (c) 1999-2018 Igor Pavlov"
+
+#ifdef USE_COPYRIGHT_CR
+ #define MY_COPYRIGHT MY_COPYRIGHT_CR
+#else
+ #define MY_COPYRIGHT MY_COPYRIGHT_PD
+#endif
+
+#define MY_COPYRIGHT_DATE MY_COPYRIGHT " : " MY_DATE
+#define MY_VERSION_COPYRIGHT_DATE MY_VERSION_CPU " : " MY_COPYRIGHT " : " MY_DATE
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Alloc.c b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Alloc.c
new file mode 100644
index 000000000..30b499e5f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Alloc.c
@@ -0,0 +1,455 @@
+/* Alloc.c -- Memory allocation functions
+2018-04-27 : Igor Pavlov : Public domain */
+
+#include "Precomp.h"
+
+#include <stdio.h>
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+#include <stdlib.h>
+
+#include "Alloc.h"
+
+/* #define _SZ_ALLOC_DEBUG */
+
+/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
+#ifdef _SZ_ALLOC_DEBUG
+
+#include <stdio.h>
+int g_allocCount = 0;
+int g_allocCountMid = 0;
+int g_allocCountBig = 0;
+
+
+#define CONVERT_INT_TO_STR(charType, tempSize) \
+ unsigned char temp[tempSize]; unsigned i = 0; \
+ while (val >= 10) { temp[i++] = (unsigned char)('0' + (unsigned)(val % 10)); val /= 10; } \
+ *s++ = (charType)('0' + (unsigned)val); \
+ while (i != 0) { i--; *s++ = temp[i]; } \
+ *s = 0;
+
+static void ConvertUInt64ToString(UInt64 val, char *s)
+{
+ CONVERT_INT_TO_STR(char, 24);
+}
+
+#define GET_HEX_CHAR(t) ((char)(((t < 10) ? ('0' + t) : ('A' + (t - 10)))))
+
+static void ConvertUInt64ToHex(UInt64 val, char *s)
+{
+ UInt64 v = val;
+ unsigned i;
+ for (i = 1;; i++)
+ {
+ v >>= 4;
+ if (v == 0)
+ break;
+ }
+ s[i] = 0;
+ do
+ {
+ unsigned t = (unsigned)(val & 0xF);
+ val >>= 4;
+ s[--i] = GET_HEX_CHAR(t);
+ }
+ while (i);
+}
+
+#define DEBUG_OUT_STREAM stderr
+
+static void Print(const char *s)
+{
+ fputs(s, DEBUG_OUT_STREAM);
+}
+
+static void PrintAligned(const char *s, size_t align)
+{
+ size_t len = strlen(s);
+ for(;;)
+ {
+ fputc(' ', DEBUG_OUT_STREAM);
+ if (len >= align)
+ break;
+ ++len;
+ }
+ Print(s);
+}
+
+static void PrintLn()
+{
+ Print("\n");
+}
+
+static void PrintHex(UInt64 v, size_t align)
+{
+ char s[32];
+ ConvertUInt64ToHex(v, s);
+ PrintAligned(s, align);
+}
+
+static void PrintDec(UInt64 v, size_t align)
+{
+ char s[32];
+ ConvertUInt64ToString(v, s);
+ PrintAligned(s, align);
+}
+
+static void PrintAddr(void *p)
+{
+ PrintHex((UInt64)(size_t)(ptrdiff_t)p, 12);
+}
+
+
+#define PRINT_ALLOC(name, cnt, size, ptr) \
+ Print(name " "); \
+ PrintDec(cnt++, 10); \
+ PrintHex(size, 10); \
+ PrintAddr(ptr); \
+ PrintLn();
+
+#define PRINT_FREE(name, cnt, ptr) if (ptr) { \
+ Print(name " "); \
+ PrintDec(--cnt, 10); \
+ PrintAddr(ptr); \
+ PrintLn(); }
+
+#else
+
+#define PRINT_ALLOC(name, cnt, size, ptr)
+#define PRINT_FREE(name, cnt, ptr)
+#define Print(s)
+#define PrintLn()
+#define PrintHex(v, align)
+#define PrintDec(v, align)
+#define PrintAddr(p)
+
+#endif
+
+
+
+void *MyAlloc(size_t size)
+{
+ if (size == 0)
+ return NULL;
+ #ifdef _SZ_ALLOC_DEBUG
+ {
+ void *p = malloc(size);
+ PRINT_ALLOC("Alloc ", g_allocCount, size, p);
+ return p;
+ }
+ #else
+ return malloc(size);
+ #endif
+}
+
+void MyFree(void *address)
+{
+ PRINT_FREE("Free ", g_allocCount, address);
+
+ free(address);
+}
+
+#ifdef _WIN32
+
+void *MidAlloc(size_t size)
+{
+ if (size == 0)
+ return NULL;
+
+ PRINT_ALLOC("Alloc-Mid", g_allocCountMid, size, NULL);
+
+ return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
+}
+
+void MidFree(void *address)
+{
+ PRINT_FREE("Free-Mid", g_allocCountMid, address);
+
+ if (!address)
+ return;
+ VirtualFree(address, 0, MEM_RELEASE);
+}
+
+#ifndef MEM_LARGE_PAGES
+#undef _7ZIP_LARGE_PAGES
+#endif
+
+#ifdef _7ZIP_LARGE_PAGES
+SIZE_T g_LargePageSize = 0;
+typedef SIZE_T (WINAPI *GetLargePageMinimumP)();
+#endif
+
+void SetLargePageSize()
+{
+ #ifdef _7ZIP_LARGE_PAGES
+ SIZE_T size;
+ GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP)
+ GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum");
+ if (!largePageMinimum)
+ return;
+ size = largePageMinimum();
+ if (size == 0 || (size & (size - 1)) != 0)
+ return;
+ g_LargePageSize = size;
+ #endif
+}
+
+
+void *BigAlloc(size_t size)
+{
+ if (size == 0)
+ return NULL;
+
+ PRINT_ALLOC("Alloc-Big", g_allocCountBig, size, NULL);
+
+ #ifdef _7ZIP_LARGE_PAGES
+ {
+ SIZE_T ps = g_LargePageSize;
+ if (ps != 0 && ps <= (1 << 30) && size > (ps / 2))
+ {
+ size_t size2;
+ ps--;
+ size2 = (size + ps) & ~ps;
+ if (size2 >= size)
+ {
+ void *res = VirtualAlloc(NULL, size2, MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE);
+ if (res)
+ return res;
+ }
+ }
+ }
+ #endif
+
+ return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
+}
+
+void BigFree(void *address)
+{
+ PRINT_FREE("Free-Big", g_allocCountBig, address);
+
+ if (!address)
+ return;
+ VirtualFree(address, 0, MEM_RELEASE);
+}
+
+#endif
+
+
+static void *SzAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p); return MyAlloc(size); }
+static void SzFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p); MyFree(address); }
+const ISzAlloc g_Alloc = { SzAlloc, SzFree };
+
+static void *SzMidAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p); return MidAlloc(size); }
+static void SzMidFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p); MidFree(address); }
+const ISzAlloc g_MidAlloc = { SzMidAlloc, SzMidFree };
+
+static void *SzBigAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p); return BigAlloc(size); }
+static void SzBigFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p); BigFree(address); }
+const ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree };
+
+
+/*
+ uintptr_t : <stdint.h> C99 (optional)
+ : unsupported in VS6
+*/
+
+#ifdef _WIN32
+ typedef UINT_PTR UIntPtr;
+#else
+ /*
+ typedef uintptr_t UIntPtr;
+ */
+ typedef ptrdiff_t UIntPtr;
+#endif
+
+
+#define ADJUST_ALLOC_SIZE 0
+/*
+#define ADJUST_ALLOC_SIZE (sizeof(void *) - 1)
+*/
+/*
+ Use (ADJUST_ALLOC_SIZE = (sizeof(void *) - 1)), if
+ MyAlloc() can return address that is NOT multiple of sizeof(void *).
+*/
+
+
+/*
+#define MY_ALIGN_PTR_DOWN(p, align) ((void *)((char *)(p) - ((size_t)(UIntPtr)(p) & ((align) - 1))))
+*/
+#define MY_ALIGN_PTR_DOWN(p, align) ((void *)((((UIntPtr)(p)) & ~((UIntPtr)(align) - 1))))
+
+#define MY_ALIGN_PTR_UP_PLUS(p, align) MY_ALIGN_PTR_DOWN(((char *)(p) + (align) + ADJUST_ALLOC_SIZE), align)
+
+
+#if (_POSIX_C_SOURCE >= 200112L) && !defined(_WIN32)
+ #define USE_posix_memalign
+#endif
+
+/*
+ This posix_memalign() is for test purposes only.
+ We also need special Free() function instead of free(),
+ if this posix_memalign() is used.
+*/
+
+/*
+static int posix_memalign(void **ptr, size_t align, size_t size)
+{
+ size_t newSize = size + align;
+ void *p;
+ void *pAligned;
+ *ptr = NULL;
+ if (newSize < size)
+ return 12; // ENOMEM
+ p = MyAlloc(newSize);
+ if (!p)
+ return 12; // ENOMEM
+ pAligned = MY_ALIGN_PTR_UP_PLUS(p, align);
+ ((void **)pAligned)[-1] = p;
+ *ptr = pAligned;
+ return 0;
+}
+*/
+
+/*
+ ALLOC_ALIGN_SIZE >= sizeof(void *)
+ ALLOC_ALIGN_SIZE >= cache_line_size
+*/
+
+#define ALLOC_ALIGN_SIZE ((size_t)1 << 7)
+
+static void *SzAlignedAlloc(ISzAllocPtr pp, size_t size)
+{
+ #ifndef USE_posix_memalign
+
+ void *p;
+ void *pAligned;
+ size_t newSize;
+ UNUSED_VAR(pp);
+
+ /* also we can allocate additional dummy ALLOC_ALIGN_SIZE bytes after aligned
+ block to prevent cache line sharing with another allocated blocks */
+
+ newSize = size + ALLOC_ALIGN_SIZE * 1 + ADJUST_ALLOC_SIZE;
+ if (newSize < size)
+ return NULL;
+
+ p = MyAlloc(newSize);
+
+ if (!p)
+ return NULL;
+ pAligned = MY_ALIGN_PTR_UP_PLUS(p, ALLOC_ALIGN_SIZE);
+
+ Print(" size="); PrintHex(size, 8);
+ Print(" a_size="); PrintHex(newSize, 8);
+ Print(" ptr="); PrintAddr(p);
+ Print(" a_ptr="); PrintAddr(pAligned);
+ PrintLn();
+
+ ((void **)pAligned)[-1] = p;
+
+ return pAligned;
+
+ #else
+
+ void *p;
+ UNUSED_VAR(pp);
+ if (posix_memalign(&p, ALLOC_ALIGN_SIZE, size))
+ return NULL;
+
+ Print(" posix_memalign="); PrintAddr(p);
+ PrintLn();
+
+ return p;
+
+ #endif
+}
+
+
+static void SzAlignedFree(ISzAllocPtr pp, void *address)
+{
+ UNUSED_VAR(pp);
+ #ifndef USE_posix_memalign
+ if (address)
+ MyFree(((void **)address)[-1]);
+ #else
+ free(address);
+ #endif
+}
+
+
+const ISzAlloc g_AlignedAlloc = { SzAlignedAlloc, SzAlignedFree };
+
+
+
+#define MY_ALIGN_PTR_DOWN_1(p) MY_ALIGN_PTR_DOWN(p, sizeof(void *))
+
+/* we align ptr to support cases where CAlignOffsetAlloc::offset is not multiply of sizeof(void *) */
+#define REAL_BLOCK_PTR_VAR(p) ((void **)MY_ALIGN_PTR_DOWN_1(p))[-1]
+/*
+#define REAL_BLOCK_PTR_VAR(p) ((void **)(p))[-1]
+*/
+
+static void *AlignOffsetAlloc_Alloc(ISzAllocPtr pp, size_t size)
+{
+ CAlignOffsetAlloc *p = CONTAINER_FROM_VTBL(pp, CAlignOffsetAlloc, vt);
+ void *adr;
+ void *pAligned;
+ size_t newSize;
+ size_t extra;
+ size_t alignSize = (size_t)1 << p->numAlignBits;
+
+ if (alignSize < sizeof(void *))
+ alignSize = sizeof(void *);
+
+ if (p->offset >= alignSize)
+ return NULL;
+
+ /* also we can allocate additional dummy ALLOC_ALIGN_SIZE bytes after aligned
+ block to prevent cache line sharing with another allocated blocks */
+ extra = p->offset & (sizeof(void *) - 1);
+ newSize = size + alignSize + extra + ADJUST_ALLOC_SIZE;
+ if (newSize < size)
+ return NULL;
+
+ adr = ISzAlloc_Alloc(p->baseAlloc, newSize);
+
+ if (!adr)
+ return NULL;
+
+ pAligned = (char *)MY_ALIGN_PTR_DOWN((char *)adr +
+ alignSize - p->offset + extra + ADJUST_ALLOC_SIZE, alignSize) + p->offset;
+
+ PrintLn();
+ Print("- Aligned: ");
+ Print(" size="); PrintHex(size, 8);
+ Print(" a_size="); PrintHex(newSize, 8);
+ Print(" ptr="); PrintAddr(adr);
+ Print(" a_ptr="); PrintAddr(pAligned);
+ PrintLn();
+
+ REAL_BLOCK_PTR_VAR(pAligned) = adr;
+
+ return pAligned;
+}
+
+
+static void AlignOffsetAlloc_Free(ISzAllocPtr pp, void *address)
+{
+ if (address)
+ {
+ CAlignOffsetAlloc *p = CONTAINER_FROM_VTBL(pp, CAlignOffsetAlloc, vt);
+ PrintLn();
+ Print("- Aligned Free: ");
+ PrintLn();
+ ISzAlloc_Free(p->baseAlloc, REAL_BLOCK_PTR_VAR(address));
+ }
+}
+
+
+void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p)
+{
+ p->vt.Alloc = AlignOffsetAlloc_Alloc;
+ p->vt.Free = AlignOffsetAlloc_Free;
+}
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Alloc.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Alloc.h
new file mode 100644
index 000000000..3d796e5ee
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Alloc.h
@@ -0,0 +1,51 @@
+/* Alloc.h -- Memory allocation functions
+2018-02-19 : Igor Pavlov : Public domain */
+
+#ifndef __COMMON_ALLOC_H
+#define __COMMON_ALLOC_H
+
+#include "7zTypes.h"
+
+EXTERN_C_BEGIN
+
+void *MyAlloc(size_t size);
+void MyFree(void *address);
+
+#ifdef _WIN32
+
+void SetLargePageSize();
+
+void *MidAlloc(size_t size);
+void MidFree(void *address);
+void *BigAlloc(size_t size);
+void BigFree(void *address);
+
+#else
+
+#define MidAlloc(size) MyAlloc(size)
+#define MidFree(address) MyFree(address)
+#define BigAlloc(size) MyAlloc(size)
+#define BigFree(address) MyFree(address)
+
+#endif
+
+extern const ISzAlloc g_Alloc;
+extern const ISzAlloc g_BigAlloc;
+extern const ISzAlloc g_MidAlloc;
+extern const ISzAlloc g_AlignedAlloc;
+
+
+typedef struct
+{
+ ISzAlloc vt;
+ ISzAllocPtr baseAlloc;
+ unsigned numAlignBits; /* ((1 << numAlignBits) >= sizeof(void *)) */
+ size_t offset; /* (offset == (k * sizeof(void *)) && offset < (1 << numAlignBits) */
+} CAlignOffsetAlloc;
+
+void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p);
+
+
+EXTERN_C_END
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Bra.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Bra.h
new file mode 100644
index 000000000..aba8dce14
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Bra.h
@@ -0,0 +1,64 @@
+/* Bra.h -- Branch converters for executables
+2013-01-18 : Igor Pavlov : Public domain */
+
+#ifndef __BRA_H
+#define __BRA_H
+
+#include "7zTypes.h"
+
+EXTERN_C_BEGIN
+
+/*
+These functions convert relative addresses to absolute addresses
+in CALL instructions to increase the compression ratio.
+
+ In:
+ data - data buffer
+ size - size of data
+ ip - current virtual Instruction Pinter (IP) value
+ state - state variable for x86 converter
+ encoding - 0 (for decoding), 1 (for encoding)
+
+ Out:
+ state - state variable for x86 converter
+
+ Returns:
+ The number of processed bytes. If you call these functions with multiple calls,
+ you must start next call with first byte after block of processed bytes.
+
+ Type Endian Alignment LookAhead
+
+ x86 little 1 4
+ ARMT little 2 2
+ ARM little 4 0
+ PPC big 4 0
+ SPARC big 4 0
+ IA64 little 16 0
+
+ size must be >= Alignment + LookAhead, if it's not last block.
+ If (size < Alignment + LookAhead), converter returns 0.
+
+ Example:
+
+ UInt32 ip = 0;
+ for ()
+ {
+ ; size must be >= Alignment + LookAhead, if it's not last block
+ SizeT processed = Convert(data, size, ip, 1);
+ data += processed;
+ size -= processed;
+ ip += processed;
+ }
+*/
+
+#define x86_Convert_Init(state) { state = 0; }
+SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding);
+SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
+SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
+SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
+SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
+SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
+
+EXTERN_C_END
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Bra86.c b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Bra86.c
new file mode 100644
index 000000000..a6463c63b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Bra86.c
@@ -0,0 +1,82 @@
+/* Bra86.c -- Converter for x86 code (BCJ)
+2017-04-03 : Igor Pavlov : Public domain */
+
+#include "Precomp.h"
+
+#include "Bra.h"
+
+#define Test86MSByte(b) ((((b) + 1) & 0xFE) == 0)
+
+SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding)
+{
+ SizeT pos = 0;
+ UInt32 mask = *state & 7;
+ if (size < 5)
+ return 0;
+ size -= 4;
+ ip += 5;
+
+ for (;;)
+ {
+ Byte *p = data + pos;
+ const Byte *limit = data + size;
+ for (; p < limit; p++)
+ if ((*p & 0xFE) == 0xE8)
+ break;
+
+ {
+ SizeT d = (SizeT)(p - data - pos);
+ pos = (SizeT)(p - data);
+ if (p >= limit)
+ {
+ *state = (d > 2 ? 0 : mask >> (unsigned)d);
+ return pos;
+ }
+ if (d > 2)
+ mask = 0;
+ else
+ {
+ mask >>= (unsigned)d;
+ if (mask != 0 && (mask > 4 || mask == 3 || Test86MSByte(p[(size_t)(mask >> 1) + 1])))
+ {
+ mask = (mask >> 1) | 4;
+ pos++;
+ continue;
+ }
+ }
+ }
+
+ if (Test86MSByte(p[4]))
+ {
+ UInt32 v = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]);
+ UInt32 cur = ip + (UInt32)pos;
+ pos += 5;
+ if (encoding)
+ v += cur;
+ else
+ v -= cur;
+ if (mask != 0)
+ {
+ unsigned sh = (mask & 6) << 2;
+ if (Test86MSByte((Byte)(v >> sh)))
+ {
+ v ^= (((UInt32)0x100 << sh) - 1);
+ if (encoding)
+ v += cur;
+ else
+ v -= cur;
+ }
+ mask = 0;
+ }
+ p[1] = (Byte)v;
+ p[2] = (Byte)(v >> 8);
+ p[3] = (Byte)(v >> 16);
+ p[4] = (Byte)(0 - ((v >> 24) & 1));
+ }
+ else
+ {
+ mask = (mask >> 1) | 4;
+ pos++;
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Compiler.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Compiler.h
new file mode 100644
index 000000000..c788648cd
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Compiler.h
@@ -0,0 +1,33 @@
+/* Compiler.h
+2017-04-03 : Igor Pavlov : Public domain */
+
+#ifndef __7Z_COMPILER_H
+#define __7Z_COMPILER_H
+
+#ifdef _MSC_VER
+
+ #ifdef UNDER_CE
+ #define RPC_NO_WINDOWS_H
+ /* #pragma warning(disable : 4115) // '_RPC_ASYNC_STATE' : named type definition in parentheses */
+ #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union
+ #pragma warning(disable : 4214) // nonstandard extension used : bit field types other than int
+ #endif
+
+ #if _MSC_VER >= 1300
+ #pragma warning(disable : 4996) // This function or variable may be unsafe
+ #else
+ #pragma warning(disable : 4511) // copy constructor could not be generated
+ #pragma warning(disable : 4512) // assignment operator could not be generated
+ #pragma warning(disable : 4514) // unreferenced inline function has been removed
+ #pragma warning(disable : 4702) // unreachable code
+ #pragma warning(disable : 4710) // not inlined
+ #pragma warning(disable : 4714) // function marked as __forceinline not inlined
+ #pragma warning(disable : 4786) // identifier was truncated to '255' characters in the debug information
+ #endif
+
+#endif
+
+#define UNUSED_VAR(x) (void)x;
+/* #define UNUSED_VAR(x) x=x; */
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/CpuArch.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/CpuArch.h
new file mode 100644
index 000000000..7fb27282c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/CpuArch.h
@@ -0,0 +1,335 @@
+/* CpuArch.h -- CPU specific code
+2017-09-04 : Igor Pavlov : Public domain */
+
+#ifndef __CPU_ARCH_H
+#define __CPU_ARCH_H
+
+#include "7zTypes.h"
+
+EXTERN_C_BEGIN
+
+/*
+MY_CPU_LE means that CPU is LITTLE ENDIAN.
+MY_CPU_BE means that CPU is BIG ENDIAN.
+If MY_CPU_LE and MY_CPU_BE are not defined, we don't know about ENDIANNESS of platform.
+
+MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses.
+*/
+
+#if defined(_M_X64) \
+ || defined(_M_AMD64) \
+ || defined(__x86_64__) \
+ || defined(__AMD64__) \
+ || defined(__amd64__)
+ #define MY_CPU_AMD64
+ #ifdef __ILP32__
+ #define MY_CPU_NAME "x32"
+ #else
+ #define MY_CPU_NAME "x64"
+ #endif
+ #define MY_CPU_64BIT
+#endif
+
+
+#if defined(_M_IX86) \
+ || defined(__i386__)
+ #define MY_CPU_X86
+ #define MY_CPU_NAME "x86"
+ #define MY_CPU_32BIT
+#endif
+
+
+#if defined(_M_ARM64) \
+ || defined(__AARCH64EL__) \
+ || defined(__AARCH64EB__) \
+ || defined(__aarch64__)
+ #define MY_CPU_ARM64
+ #define MY_CPU_NAME "arm64"
+ #define MY_CPU_64BIT
+#endif
+
+
+#if defined(_M_ARM) \
+ || defined(_M_ARM_NT) \
+ || defined(_M_ARMT) \
+ || defined(__arm__) \
+ || defined(__thumb__) \
+ || defined(__ARMEL__) \
+ || defined(__ARMEB__) \
+ || defined(__THUMBEL__) \
+ || defined(__THUMBEB__)
+ #define MY_CPU_ARM
+ #define MY_CPU_NAME "arm"
+ #define MY_CPU_32BIT
+#endif
+
+
+#if defined(_M_IA64) \
+ || defined(__ia64__)
+ #define MY_CPU_IA64
+ #define MY_CPU_NAME "ia64"
+ #define MY_CPU_64BIT
+#endif
+
+
+#if defined(__mips64) \
+ || defined(__mips64__) \
+ || (defined(__mips) && (__mips == 64 || __mips == 4 || __mips == 3))
+ #define MY_CPU_NAME "mips64"
+ #define MY_CPU_64BIT
+#elif defined(__mips__)
+ #define MY_CPU_NAME "mips"
+ /* #define MY_CPU_32BIT */
+#endif
+
+
+#if defined(__ppc64__) \
+ || defined(__powerpc64__)
+ #ifdef __ILP32__
+ #define MY_CPU_NAME "ppc64-32"
+ #else
+ #define MY_CPU_NAME "ppc64"
+ #endif
+ #define MY_CPU_64BIT
+#elif defined(__ppc__) \
+ || defined(__powerpc__)
+ #define MY_CPU_NAME "ppc"
+ #define MY_CPU_32BIT
+#endif
+
+
+#if defined(__sparc64__)
+ #define MY_CPU_NAME "sparc64"
+ #define MY_CPU_64BIT
+#elif defined(__sparc__)
+ #define MY_CPU_NAME "sparc"
+ /* #define MY_CPU_32BIT */
+#endif
+
+
+#if defined(MY_CPU_X86) || defined(MY_CPU_AMD64)
+#define MY_CPU_X86_OR_AMD64
+#endif
+
+
+#ifdef _WIN32
+
+ #ifdef MY_CPU_ARM
+ #define MY_CPU_ARM_LE
+ #endif
+
+ #ifdef MY_CPU_ARM64
+ #define MY_CPU_ARM64_LE
+ #endif
+
+ #ifdef _M_IA64
+ #define MY_CPU_IA64_LE
+ #endif
+
+#endif
+
+
+#if defined(MY_CPU_X86_OR_AMD64) \
+ || defined(MY_CPU_ARM_LE) \
+ || defined(MY_CPU_ARM64_LE) \
+ || defined(MY_CPU_IA64_LE) \
+ || defined(__LITTLE_ENDIAN__) \
+ || defined(__ARMEL__) \
+ || defined(__THUMBEL__) \
+ || defined(__AARCH64EL__) \
+ || defined(__MIPSEL__) \
+ || defined(__MIPSEL) \
+ || defined(_MIPSEL) \
+ || defined(__BFIN__) \
+ || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
+ #define MY_CPU_LE
+#endif
+
+#if defined(__BIG_ENDIAN__) \
+ || defined(__ARMEB__) \
+ || defined(__THUMBEB__) \
+ || defined(__AARCH64EB__) \
+ || defined(__MIPSEB__) \
+ || defined(__MIPSEB) \
+ || defined(_MIPSEB) \
+ || defined(__m68k__) \
+ || defined(__s390__) \
+ || defined(__s390x__) \
+ || defined(__zarch__) \
+ || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
+ #define MY_CPU_BE
+#endif
+
+
+#if defined(MY_CPU_LE) && defined(MY_CPU_BE)
+ #error Stop_Compiling_Bad_Endian
+#endif
+
+
+#if defined(MY_CPU_32BIT) && defined(MY_CPU_64BIT)
+ #error Stop_Compiling_Bad_32_64_BIT
+#endif
+
+
+#ifndef MY_CPU_NAME
+ #ifdef MY_CPU_LE
+ #define MY_CPU_NAME "LE"
+ #elif defined(MY_CPU_BE)
+ #define MY_CPU_NAME "BE"
+ #else
+ /*
+ #define MY_CPU_NAME ""
+ */
+ #endif
+#endif
+
+
+
+
+
+#ifdef MY_CPU_LE
+ #if defined(MY_CPU_X86_OR_AMD64) \
+ || defined(MY_CPU_ARM64) \
+ || defined(__ARM_FEATURE_UNALIGNED)
+ #define MY_CPU_LE_UNALIGN
+ #endif
+#endif
+
+
+#ifdef MY_CPU_LE_UNALIGN
+
+#define GetUi16(p) (*(const UInt16 *)(const void *)(p))
+#define GetUi32(p) (*(const UInt32 *)(const void *)(p))
+#define GetUi64(p) (*(const UInt64 *)(const void *)(p))
+
+#define SetUi16(p, v) { *(UInt16 *)(p) = (v); }
+#define SetUi32(p, v) { *(UInt32 *)(p) = (v); }
+#define SetUi64(p, v) { *(UInt64 *)(p) = (v); }
+
+#else
+
+#define GetUi16(p) ( (UInt16) ( \
+ ((const Byte *)(p))[0] | \
+ ((UInt16)((const Byte *)(p))[1] << 8) ))
+
+#define GetUi32(p) ( \
+ ((const Byte *)(p))[0] | \
+ ((UInt32)((const Byte *)(p))[1] << 8) | \
+ ((UInt32)((const Byte *)(p))[2] << 16) | \
+ ((UInt32)((const Byte *)(p))[3] << 24))
+
+#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
+
+#define SetUi16(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \
+ _ppp_[0] = (Byte)_vvv_; \
+ _ppp_[1] = (Byte)(_vvv_ >> 8); }
+
+#define SetUi32(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \
+ _ppp_[0] = (Byte)_vvv_; \
+ _ppp_[1] = (Byte)(_vvv_ >> 8); \
+ _ppp_[2] = (Byte)(_vvv_ >> 16); \
+ _ppp_[3] = (Byte)(_vvv_ >> 24); }
+
+#define SetUi64(p, v) { Byte *_ppp2_ = (Byte *)(p); UInt64 _vvv2_ = (v); \
+ SetUi32(_ppp2_ , (UInt32)_vvv2_); \
+ SetUi32(_ppp2_ + 4, (UInt32)(_vvv2_ >> 32)); }
+
+#endif
+
+#ifdef __has_builtin
+ #define MY__has_builtin(x) __has_builtin(x)
+#else
+ #define MY__has_builtin(x) 0
+#endif
+
+#if defined(MY_CPU_LE_UNALIGN) && /* defined(_WIN64) && */ (_MSC_VER >= 1300)
+
+/* Note: we use bswap instruction, that is unsupported in 386 cpu */
+
+#include <stdlib.h>
+
+#pragma intrinsic(_byteswap_ushort)
+#pragma intrinsic(_byteswap_ulong)
+#pragma intrinsic(_byteswap_uint64)
+
+/* #define GetBe16(p) _byteswap_ushort(*(const UInt16 *)(const Byte *)(p)) */
+#define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p))
+#define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const Byte *)(p))
+
+#define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = _byteswap_ulong(v)
+
+#elif defined(MY_CPU_LE_UNALIGN) && ( \
+ (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) \
+ || (defined(__clang__) && MY__has_builtin(__builtin_bswap16)) )
+
+/* #define GetBe16(p) __builtin_bswap16(*(const UInt16 *)(const Byte *)(p)) */
+#define GetBe32(p) __builtin_bswap32(*(const UInt32 *)(const Byte *)(p))
+#define GetBe64(p) __builtin_bswap64(*(const UInt64 *)(const Byte *)(p))
+
+#define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = __builtin_bswap32(v)
+
+#else
+
+#define GetBe32(p) ( \
+ ((UInt32)((const Byte *)(p))[0] << 24) | \
+ ((UInt32)((const Byte *)(p))[1] << 16) | \
+ ((UInt32)((const Byte *)(p))[2] << 8) | \
+ ((const Byte *)(p))[3] )
+
+#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4))
+
+#define SetBe32(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \
+ _ppp_[0] = (Byte)(_vvv_ >> 24); \
+ _ppp_[1] = (Byte)(_vvv_ >> 16); \
+ _ppp_[2] = (Byte)(_vvv_ >> 8); \
+ _ppp_[3] = (Byte)_vvv_; }
+
+#endif
+
+
+#ifndef GetBe16
+
+#define GetBe16(p) ( (UInt16) ( \
+ ((UInt16)((const Byte *)(p))[0] << 8) | \
+ ((const Byte *)(p))[1] ))
+
+#endif
+
+
+
+#ifdef MY_CPU_X86_OR_AMD64
+
+typedef struct
+{
+ UInt32 maxFunc;
+ UInt32 vendor[3];
+ UInt32 ver;
+ UInt32 b;
+ UInt32 c;
+ UInt32 d;
+} Cx86cpuid;
+
+enum
+{
+ CPU_FIRM_INTEL,
+ CPU_FIRM_AMD,
+ CPU_FIRM_VIA
+};
+
+void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d);
+
+Bool x86cpuid_CheckAndRead(Cx86cpuid *p);
+int x86cpuid_GetFirm(const Cx86cpuid *p);
+
+#define x86cpuid_GetFamily(ver) (((ver >> 16) & 0xFF0) | ((ver >> 8) & 0xF))
+#define x86cpuid_GetModel(ver) (((ver >> 12) & 0xF0) | ((ver >> 4) & 0xF))
+#define x86cpuid_GetStepping(ver) (ver & 0xF)
+
+Bool CPU_Is_InOrder();
+Bool CPU_Is_Aes_Supported();
+
+#endif
+
+EXTERN_C_END
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.c b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.c
new file mode 100644
index 000000000..6ea82a9b5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.c
@@ -0,0 +1,1069 @@
+/* LzFind.c -- Match finder for LZ algorithms
+2017-06-10 : Igor Pavlov : Public domain */
+
+#include "Precomp.h"
+
+#include <string.h>
+
+#include "LzFind.h"
+#include "LzHash.h"
+
+#define kEmptyHashValue 0
+#define kMaxValForNormalize ((UInt32)0xFFFFFFFF)
+#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */
+#define kNormalizeMask (~(UInt32)(kNormalizeStepMin - 1))
+#define kMaxHistorySize ((UInt32)7 << 29)
+
+#define kStartMaxLen 3
+
+static void LzInWindow_Free(CMatchFinder *p, ISzAllocPtr alloc)
+{
+ if (!p->directInput)
+ {
+ ISzAlloc_Free(alloc, p->bufferBase);
+ p->bufferBase = NULL;
+ }
+}
+
+/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */
+
+static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAllocPtr alloc)
+{
+ UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv;
+ if (p->directInput)
+ {
+ p->blockSize = blockSize;
+ return 1;
+ }
+ if (!p->bufferBase || p->blockSize != blockSize)
+ {
+ LzInWindow_Free(p, alloc);
+ p->blockSize = blockSize;
+ p->bufferBase = (Byte *)ISzAlloc_Alloc(alloc, (size_t)blockSize);
+ }
+ return (p->bufferBase != NULL);
+}
+
+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
+
+UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
+
+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
+{
+ p->posLimit -= subValue;
+ p->pos -= subValue;
+ p->streamPos -= subValue;
+}
+
+static void MatchFinder_ReadBlock(CMatchFinder *p)
+{
+ if (p->streamEndWasReached || p->result != SZ_OK)
+ return;
+
+ /* We use (p->streamPos - p->pos) value. (p->streamPos < p->pos) is allowed. */
+
+ if (p->directInput)
+ {
+ UInt32 curSize = 0xFFFFFFFF - (p->streamPos - p->pos);
+ if (curSize > p->directInputRem)
+ curSize = (UInt32)p->directInputRem;
+ p->directInputRem -= curSize;
+ p->streamPos += curSize;
+ if (p->directInputRem == 0)
+ p->streamEndWasReached = 1;
+ return;
+ }
+
+ for (;;)
+ {
+ Byte *dest = p->buffer + (p->streamPos - p->pos);
+ size_t size = (p->bufferBase + p->blockSize - dest);
+ if (size == 0)
+ return;
+
+ p->result = ISeqInStream_Read(p->stream, dest, &size);
+ if (p->result != SZ_OK)
+ return;
+ if (size == 0)
+ {
+ p->streamEndWasReached = 1;
+ return;
+ }
+ p->streamPos += (UInt32)size;
+ if (p->streamPos - p->pos > p->keepSizeAfter)
+ return;
+ }
+}
+
+void MatchFinder_MoveBlock(CMatchFinder *p)
+{
+ memmove(p->bufferBase,
+ p->buffer - p->keepSizeBefore,
+ (size_t)(p->streamPos - p->pos) + p->keepSizeBefore);
+ p->buffer = p->bufferBase + p->keepSizeBefore;
+}
+
+int MatchFinder_NeedMove(CMatchFinder *p)
+{
+ if (p->directInput)
+ return 0;
+ /* if (p->streamEndWasReached) return 0; */
+ return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
+}
+
+void MatchFinder_ReadIfRequired(CMatchFinder *p)
+{
+ if (p->streamEndWasReached)
+ return;
+ if (p->keepSizeAfter >= p->streamPos - p->pos)
+ MatchFinder_ReadBlock(p);
+}
+
+static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p)
+{
+ if (MatchFinder_NeedMove(p))
+ MatchFinder_MoveBlock(p);
+ MatchFinder_ReadBlock(p);
+}
+
+static void MatchFinder_SetDefaultSettings(CMatchFinder *p)
+{
+ p->cutValue = 32;
+ p->btMode = 1;
+ p->numHashBytes = 4;
+ p->bigHash = 0;
+}
+
+#define kCrcPoly 0xEDB88320
+
+void MatchFinder_Construct(CMatchFinder *p)
+{
+ UInt32 i;
+ p->bufferBase = NULL;
+ p->directInput = 0;
+ p->hash = NULL;
+ p->expectedDataSize = (UInt64)(Int64)-1;
+ MatchFinder_SetDefaultSettings(p);
+
+ for (i = 0; i < 256; i++)
+ {
+ UInt32 r = i;
+ unsigned j;
+ for (j = 0; j < 8; j++)
+ r = (r >> 1) ^ (kCrcPoly & ((UInt32)0 - (r & 1)));
+ p->crc[i] = r;
+ }
+}
+
+static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAllocPtr alloc)
+{
+ ISzAlloc_Free(alloc, p->hash);
+ p->hash = NULL;
+}
+
+void MatchFinder_Free(CMatchFinder *p, ISzAllocPtr alloc)
+{
+ MatchFinder_FreeThisClassMemory(p, alloc);
+ LzInWindow_Free(p, alloc);
+}
+
+static CLzRef* AllocRefs(size_t num, ISzAllocPtr alloc)
+{
+ size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
+ if (sizeInBytes / sizeof(CLzRef) != num)
+ return NULL;
+ return (CLzRef *)ISzAlloc_Alloc(alloc, sizeInBytes);
+}
+
+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
+ ISzAllocPtr alloc)
+{
+ UInt32 sizeReserv;
+
+ if (historySize > kMaxHistorySize)
+ {
+ MatchFinder_Free(p, alloc);
+ return 0;
+ }
+
+ sizeReserv = historySize >> 1;
+ if (historySize >= ((UInt32)3 << 30)) sizeReserv = historySize >> 3;
+ else if (historySize >= ((UInt32)2 << 30)) sizeReserv = historySize >> 2;
+
+ sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19);
+
+ p->keepSizeBefore = historySize + keepAddBufferBefore + 1;
+ p->keepSizeAfter = matchMaxLen + keepAddBufferAfter;
+
+ /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */
+
+ if (LzInWindow_Create(p, sizeReserv, alloc))
+ {
+ UInt32 newCyclicBufferSize = historySize + 1;
+ UInt32 hs;
+ p->matchMaxLen = matchMaxLen;
+ {
+ p->fixedHashSize = 0;
+ if (p->numHashBytes == 2)
+ hs = (1 << 16) - 1;
+ else
+ {
+ hs = historySize;
+ if (hs > p->expectedDataSize)
+ hs = (UInt32)p->expectedDataSize;
+ if (hs != 0)
+ hs--;
+ hs |= (hs >> 1);
+ hs |= (hs >> 2);
+ hs |= (hs >> 4);
+ hs |= (hs >> 8);
+ hs >>= 1;
+ hs |= 0xFFFF; /* don't change it! It's required for Deflate */
+ if (hs > (1 << 24))
+ {
+ if (p->numHashBytes == 3)
+ hs = (1 << 24) - 1;
+ else
+ hs >>= 1;
+ /* if (bigHash) mode, GetHeads4b() in LzFindMt.c needs (hs >= ((1 << 24) - 1))) */
+ }
+ }
+ p->hashMask = hs;
+ hs++;
+ if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size;
+ if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size;
+ if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size;
+ hs += p->fixedHashSize;
+ }
+
+ {
+ size_t newSize;
+ size_t numSons;
+ p->historySize = historySize;
+ p->hashSizeSum = hs;
+ p->cyclicBufferSize = newCyclicBufferSize;
+
+ numSons = newCyclicBufferSize;
+ if (p->btMode)
+ numSons <<= 1;
+ newSize = hs + numSons;
+
+ if (p->hash && p->numRefs == newSize)
+ return 1;
+
+ MatchFinder_FreeThisClassMemory(p, alloc);
+ p->numRefs = newSize;
+ p->hash = AllocRefs(newSize, alloc);
+
+ if (p->hash)
+ {
+ p->son = p->hash + p->hashSizeSum;
+ return 1;
+ }
+ }
+ }
+
+ MatchFinder_Free(p, alloc);
+ return 0;
+}
+
+static void MatchFinder_SetLimits(CMatchFinder *p)
+{
+ UInt32 limit = kMaxValForNormalize - p->pos;
+ UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos;
+
+ if (limit2 < limit)
+ limit = limit2;
+ limit2 = p->streamPos - p->pos;
+
+ if (limit2 <= p->keepSizeAfter)
+ {
+ if (limit2 > 0)
+ limit2 = 1;
+ }
+ else
+ limit2 -= p->keepSizeAfter;
+
+ if (limit2 < limit)
+ limit = limit2;
+
+ {
+ UInt32 lenLimit = p->streamPos - p->pos;
+ if (lenLimit > p->matchMaxLen)
+ lenLimit = p->matchMaxLen;
+ p->lenLimit = lenLimit;
+ }
+ p->posLimit = p->pos + limit;
+}
+
+
+void MatchFinder_Init_LowHash(CMatchFinder *p)
+{
+ size_t i;
+ CLzRef *items = p->hash;
+ size_t numItems = p->fixedHashSize;
+ for (i = 0; i < numItems; i++)
+ items[i] = kEmptyHashValue;
+}
+
+
+void MatchFinder_Init_HighHash(CMatchFinder *p)
+{
+ size_t i;
+ CLzRef *items = p->hash + p->fixedHashSize;
+ size_t numItems = (size_t)p->hashMask + 1;
+ for (i = 0; i < numItems; i++)
+ items[i] = kEmptyHashValue;
+}
+
+
+void MatchFinder_Init_3(CMatchFinder *p, int readData)
+{
+ p->cyclicBufferPos = 0;
+ p->buffer = p->bufferBase;
+ p->pos =
+ p->streamPos = p->cyclicBufferSize;
+ p->result = SZ_OK;
+ p->streamEndWasReached = 0;
+
+ if (readData)
+ MatchFinder_ReadBlock(p);
+
+ MatchFinder_SetLimits(p);
+}
+
+
+void MatchFinder_Init(CMatchFinder *p)
+{
+ MatchFinder_Init_HighHash(p);
+ MatchFinder_Init_LowHash(p);
+ MatchFinder_Init_3(p, True);
+}
+
+
+static UInt32 MatchFinder_GetSubValue(CMatchFinder *p)
+{
+ return (p->pos - p->historySize - 1) & kNormalizeMask;
+}
+
+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems)
+{
+ size_t i;
+ for (i = 0; i < numItems; i++)
+ {
+ UInt32 value = items[i];
+ if (value <= subValue)
+ value = kEmptyHashValue;
+ else
+ value -= subValue;
+ items[i] = value;
+ }
+}
+
+static void MatchFinder_Normalize(CMatchFinder *p)
+{
+ UInt32 subValue = MatchFinder_GetSubValue(p);
+ MatchFinder_Normalize3(subValue, p->hash, p->numRefs);
+ MatchFinder_ReduceOffsets(p, subValue);
+}
+
+static void MatchFinder_CheckLimits(CMatchFinder *p)
+{
+ if (p->pos == kMaxValForNormalize)
+ MatchFinder_Normalize(p);
+ if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos)
+ MatchFinder_CheckAndMoveAndRead(p);
+ if (p->cyclicBufferPos == p->cyclicBufferSize)
+ p->cyclicBufferPos = 0;
+ MatchFinder_SetLimits(p);
+}
+
+static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
+ UInt32 *distances, UInt32 maxLen)
+{
+ son[_cyclicBufferPos] = curMatch;
+ for (;;)
+ {
+ UInt32 delta = pos - curMatch;
+ if (cutValue-- == 0 || delta >= _cyclicBufferSize)
+ return distances;
+ {
+ const Byte *pb = cur - delta;
+ curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
+ if (pb[maxLen] == cur[maxLen] && *pb == *cur)
+ {
+ UInt32 len = 0;
+ while (++len != lenLimit)
+ if (pb[len] != cur[len])
+ break;
+ if (maxLen < len)
+ {
+ *distances++ = maxLen = len;
+ *distances++ = delta - 1;
+ if (len == lenLimit)
+ return distances;
+ }
+ }
+ }
+ }
+}
+
+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
+ UInt32 *distances, UInt32 maxLen)
+{
+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
+ UInt32 len0 = 0, len1 = 0;
+ for (;;)
+ {
+ UInt32 delta = pos - curMatch;
+ if (cutValue-- == 0 || delta >= _cyclicBufferSize)
+ {
+ *ptr0 = *ptr1 = kEmptyHashValue;
+ return distances;
+ }
+ {
+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
+ const Byte *pb = cur - delta;
+ UInt32 len = (len0 < len1 ? len0 : len1);
+ if (pb[len] == cur[len])
+ {
+ if (++len != lenLimit && pb[len] == cur[len])
+ while (++len != lenLimit)
+ if (pb[len] != cur[len])
+ break;
+ if (maxLen < len)
+ {
+ *distances++ = maxLen = len;
+ *distances++ = delta - 1;
+ if (len == lenLimit)
+ {
+ *ptr1 = pair[0];
+ *ptr0 = pair[1];
+ return distances;
+ }
+ }
+ }
+ if (pb[len] < cur[len])
+ {
+ *ptr1 = curMatch;
+ ptr1 = pair + 1;
+ curMatch = *ptr1;
+ len1 = len;
+ }
+ else
+ {
+ *ptr0 = curMatch;
+ ptr0 = pair;
+ curMatch = *ptr0;
+ len0 = len;
+ }
+ }
+ }
+}
+
+static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue)
+{
+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
+ UInt32 len0 = 0, len1 = 0;
+ for (;;)
+ {
+ UInt32 delta = pos - curMatch;
+ if (cutValue-- == 0 || delta >= _cyclicBufferSize)
+ {
+ *ptr0 = *ptr1 = kEmptyHashValue;
+ return;
+ }
+ {
+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
+ const Byte *pb = cur - delta;
+ UInt32 len = (len0 < len1 ? len0 : len1);
+ if (pb[len] == cur[len])
+ {
+ while (++len != lenLimit)
+ if (pb[len] != cur[len])
+ break;
+ {
+ if (len == lenLimit)
+ {
+ *ptr1 = pair[0];
+ *ptr0 = pair[1];
+ return;
+ }
+ }
+ }
+ if (pb[len] < cur[len])
+ {
+ *ptr1 = curMatch;
+ ptr1 = pair + 1;
+ curMatch = *ptr1;
+ len1 = len;
+ }
+ else
+ {
+ *ptr0 = curMatch;
+ ptr0 = pair;
+ curMatch = *ptr0;
+ len0 = len;
+ }
+ }
+ }
+}
+
+#define MOVE_POS \
+ ++p->cyclicBufferPos; \
+ p->buffer++; \
+ if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p);
+
+#define MOVE_POS_RET MOVE_POS return offset;
+
+static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; }
+
+#define GET_MATCHES_HEADER2(minLen, ret_op) \
+ UInt32 lenLimit; UInt32 hv; const Byte *cur; UInt32 curMatch; \
+ lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
+ cur = p->buffer;
+
+#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0)
+#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue)
+
+#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue
+
+#define GET_MATCHES_FOOTER(offset, maxLen) \
+ offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \
+ distances + offset, maxLen) - distances); MOVE_POS_RET;
+
+#define SKIP_FOOTER \
+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;
+
+#define UPDATE_maxLen { \
+ ptrdiff_t diff = (ptrdiff_t)0 - d2; \
+ const Byte *c = cur + maxLen; \
+ const Byte *lim = cur + lenLimit; \
+ for (; c != lim; c++) if (*(c + diff) != *c) break; \
+ maxLen = (UInt32)(c - cur); }
+
+static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 offset;
+ GET_MATCHES_HEADER(2)
+ HASH2_CALC;
+ curMatch = p->hash[hv];
+ p->hash[hv] = p->pos;
+ offset = 0;
+ GET_MATCHES_FOOTER(offset, 1)
+}
+
+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 offset;
+ GET_MATCHES_HEADER(3)
+ HASH_ZIP_CALC;
+ curMatch = p->hash[hv];
+ p->hash[hv] = p->pos;
+ offset = 0;
+ GET_MATCHES_FOOTER(offset, 2)
+}
+
+static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 h2, d2, maxLen, offset, pos;
+ UInt32 *hash;
+ GET_MATCHES_HEADER(3)
+
+ HASH3_CALC;
+
+ hash = p->hash;
+ pos = p->pos;
+
+ d2 = pos - hash[h2];
+
+ curMatch = (hash + kFix3HashSize)[hv];
+
+ hash[h2] = pos;
+ (hash + kFix3HashSize)[hv] = pos;
+
+ maxLen = 2;
+ offset = 0;
+
+ if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur)
+ {
+ UPDATE_maxLen
+ distances[0] = maxLen;
+ distances[1] = d2 - 1;
+ offset = 2;
+ if (maxLen == lenLimit)
+ {
+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
+ MOVE_POS_RET;
+ }
+ }
+
+ GET_MATCHES_FOOTER(offset, maxLen)
+}
+
+static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 h2, h3, d2, d3, maxLen, offset, pos;
+ UInt32 *hash;
+ GET_MATCHES_HEADER(4)
+
+ HASH4_CALC;
+
+ hash = p->hash;
+ pos = p->pos;
+
+ d2 = pos - hash[ h2];
+ d3 = pos - (hash + kFix3HashSize)[h3];
+
+ curMatch = (hash + kFix4HashSize)[hv];
+
+ hash[ h2] = pos;
+ (hash + kFix3HashSize)[h3] = pos;
+ (hash + kFix4HashSize)[hv] = pos;
+
+ maxLen = 0;
+ offset = 0;
+
+ if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur)
+ {
+ distances[0] = maxLen = 2;
+ distances[1] = d2 - 1;
+ offset = 2;
+ }
+
+ if (d2 != d3 && d3 < p->cyclicBufferSize && *(cur - d3) == *cur)
+ {
+ maxLen = 3;
+ distances[(size_t)offset + 1] = d3 - 1;
+ offset += 2;
+ d2 = d3;
+ }
+
+ if (offset != 0)
+ {
+ UPDATE_maxLen
+ distances[(size_t)offset - 2] = maxLen;
+ if (maxLen == lenLimit)
+ {
+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
+ MOVE_POS_RET;
+ }
+ }
+
+ if (maxLen < 3)
+ maxLen = 3;
+
+ GET_MATCHES_FOOTER(offset, maxLen)
+}
+
+/*
+static UInt32 Bt5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 h2, h3, h4, d2, d3, d4, maxLen, offset, pos;
+ UInt32 *hash;
+ GET_MATCHES_HEADER(5)
+
+ HASH5_CALC;
+
+ hash = p->hash;
+ pos = p->pos;
+
+ d2 = pos - hash[ h2];
+ d3 = pos - (hash + kFix3HashSize)[h3];
+ d4 = pos - (hash + kFix4HashSize)[h4];
+
+ curMatch = (hash + kFix5HashSize)[hv];
+
+ hash[ h2] = pos;
+ (hash + kFix3HashSize)[h3] = pos;
+ (hash + kFix4HashSize)[h4] = pos;
+ (hash + kFix5HashSize)[hv] = pos;
+
+ maxLen = 0;
+ offset = 0;
+
+ if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur)
+ {
+ distances[0] = maxLen = 2;
+ distances[1] = d2 - 1;
+ offset = 2;
+ if (*(cur - d2 + 2) == cur[2])
+ distances[0] = maxLen = 3;
+ else if (d3 < p->cyclicBufferSize && *(cur - d3) == *cur)
+ {
+ distances[2] = maxLen = 3;
+ distances[3] = d3 - 1;
+ offset = 4;
+ d2 = d3;
+ }
+ }
+ else if (d3 < p->cyclicBufferSize && *(cur - d3) == *cur)
+ {
+ distances[0] = maxLen = 3;
+ distances[1] = d3 - 1;
+ offset = 2;
+ d2 = d3;
+ }
+
+ if (d2 != d4 && d4 < p->cyclicBufferSize
+ && *(cur - d4) == *cur
+ && *(cur - d4 + 3) == *(cur + 3))
+ {
+ maxLen = 4;
+ distances[(size_t)offset + 1] = d4 - 1;
+ offset += 2;
+ d2 = d4;
+ }
+
+ if (offset != 0)
+ {
+ UPDATE_maxLen
+ distances[(size_t)offset - 2] = maxLen;
+ if (maxLen == lenLimit)
+ {
+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
+ MOVE_POS_RET;
+ }
+ }
+
+ if (maxLen < 4)
+ maxLen = 4;
+
+ GET_MATCHES_FOOTER(offset, maxLen)
+}
+*/
+
+static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 h2, h3, d2, d3, maxLen, offset, pos;
+ UInt32 *hash;
+ GET_MATCHES_HEADER(4)
+
+ HASH4_CALC;
+
+ hash = p->hash;
+ pos = p->pos;
+
+ d2 = pos - hash[ h2];
+ d3 = pos - (hash + kFix3HashSize)[h3];
+
+ curMatch = (hash + kFix4HashSize)[hv];
+
+ hash[ h2] = pos;
+ (hash + kFix3HashSize)[h3] = pos;
+ (hash + kFix4HashSize)[hv] = pos;
+
+ maxLen = 0;
+ offset = 0;
+
+ if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur)
+ {
+ distances[0] = maxLen = 2;
+ distances[1] = d2 - 1;
+ offset = 2;
+ }
+
+ if (d2 != d3 && d3 < p->cyclicBufferSize && *(cur - d3) == *cur)
+ {
+ maxLen = 3;
+ distances[(size_t)offset + 1] = d3 - 1;
+ offset += 2;
+ d2 = d3;
+ }
+
+ if (offset != 0)
+ {
+ UPDATE_maxLen
+ distances[(size_t)offset - 2] = maxLen;
+ if (maxLen == lenLimit)
+ {
+ p->son[p->cyclicBufferPos] = curMatch;
+ MOVE_POS_RET;
+ }
+ }
+
+ if (maxLen < 3)
+ maxLen = 3;
+
+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
+ distances + offset, maxLen) - (distances));
+ MOVE_POS_RET
+}
+
+/*
+static UInt32 Hc5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 h2, h3, h4, d2, d3, d4, maxLen, offset, pos
+ UInt32 *hash;
+ GET_MATCHES_HEADER(5)
+
+ HASH5_CALC;
+
+ hash = p->hash;
+ pos = p->pos;
+
+ d2 = pos - hash[ h2];
+ d3 = pos - (hash + kFix3HashSize)[h3];
+ d4 = pos - (hash + kFix4HashSize)[h4];
+
+ curMatch = (hash + kFix5HashSize)[hv];
+
+ hash[ h2] = pos;
+ (hash + kFix3HashSize)[h3] = pos;
+ (hash + kFix4HashSize)[h4] = pos;
+ (hash + kFix5HashSize)[hv] = pos;
+
+ maxLen = 0;
+ offset = 0;
+
+ if (d2 < p->cyclicBufferSize && *(cur - d2) == *cur)
+ {
+ distances[0] = maxLen = 2;
+ distances[1] = d2 - 1;
+ offset = 2;
+ if (*(cur - d2 + 2) == cur[2])
+ distances[0] = maxLen = 3;
+ else if (d3 < p->cyclicBufferSize && *(cur - d3) == *cur)
+ {
+ distances[2] = maxLen = 3;
+ distances[3] = d3 - 1;
+ offset = 4;
+ d2 = d3;
+ }
+ }
+ else if (d3 < p->cyclicBufferSize && *(cur - d3) == *cur)
+ {
+ distances[0] = maxLen = 3;
+ distances[1] = d3 - 1;
+ offset = 2;
+ d2 = d3;
+ }
+
+ if (d2 != d4 && d4 < p->cyclicBufferSize
+ && *(cur - d4) == *cur
+ && *(cur - d4 + 3) == *(cur + 3))
+ {
+ maxLen = 4;
+ distances[(size_t)offset + 1] = d4 - 1;
+ offset += 2;
+ d2 = d4;
+ }
+
+ if (offset != 0)
+ {
+ UPDATE_maxLen
+ distances[(size_t)offset - 2] = maxLen;
+ if (maxLen == lenLimit)
+ {
+ p->son[p->cyclicBufferPos] = curMatch;
+ MOVE_POS_RET;
+ }
+ }
+
+ if (maxLen < 4)
+ maxLen = 4;
+
+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
+ distances + offset, maxLen) - (distances));
+ MOVE_POS_RET
+}
+*/
+
+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+ UInt32 offset;
+ GET_MATCHES_HEADER(3)
+ HASH_ZIP_CALC;
+ curMatch = p->hash[hv];
+ p->hash[hv] = p->pos;
+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
+ distances, 2) - (distances));
+ MOVE_POS_RET
+}
+
+static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ SKIP_HEADER(2)
+ HASH2_CALC;
+ curMatch = p->hash[hv];
+ p->hash[hv] = p->pos;
+ SKIP_FOOTER
+ }
+ while (--num != 0);
+}
+
+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ SKIP_HEADER(3)
+ HASH_ZIP_CALC;
+ curMatch = p->hash[hv];
+ p->hash[hv] = p->pos;
+ SKIP_FOOTER
+ }
+ while (--num != 0);
+}
+
+static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ UInt32 h2;
+ UInt32 *hash;
+ SKIP_HEADER(3)
+ HASH3_CALC;
+ hash = p->hash;
+ curMatch = (hash + kFix3HashSize)[hv];
+ hash[h2] =
+ (hash + kFix3HashSize)[hv] = p->pos;
+ SKIP_FOOTER
+ }
+ while (--num != 0);
+}
+
+static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ UInt32 h2, h3;
+ UInt32 *hash;
+ SKIP_HEADER(4)
+ HASH4_CALC;
+ hash = p->hash;
+ curMatch = (hash + kFix4HashSize)[hv];
+ hash[ h2] =
+ (hash + kFix3HashSize)[h3] =
+ (hash + kFix4HashSize)[hv] = p->pos;
+ SKIP_FOOTER
+ }
+ while (--num != 0);
+}
+
+/*
+static void Bt5_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ UInt32 h2, h3, h4;
+ UInt32 *hash;
+ SKIP_HEADER(5)
+ HASH5_CALC;
+ hash = p->hash;
+ curMatch = (hash + kFix5HashSize)[hv];
+ hash[ h2] =
+ (hash + kFix3HashSize)[h3] =
+ (hash + kFix4HashSize)[h4] =
+ (hash + kFix5HashSize)[hv] = p->pos;
+ SKIP_FOOTER
+ }
+ while (--num != 0);
+}
+*/
+
+static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ UInt32 h2, h3;
+ UInt32 *hash;
+ SKIP_HEADER(4)
+ HASH4_CALC;
+ hash = p->hash;
+ curMatch = (hash + kFix4HashSize)[hv];
+ hash[ h2] =
+ (hash + kFix3HashSize)[h3] =
+ (hash + kFix4HashSize)[hv] = p->pos;
+ p->son[p->cyclicBufferPos] = curMatch;
+ MOVE_POS
+ }
+ while (--num != 0);
+}
+
+/*
+static void Hc5_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ UInt32 h2, h3, h4;
+ UInt32 *hash;
+ SKIP_HEADER(5)
+ HASH5_CALC;
+ hash = p->hash;
+ curMatch = hash + kFix5HashSize)[hv];
+ hash[ h2] =
+ (hash + kFix3HashSize)[h3] =
+ (hash + kFix4HashSize)[h4] =
+ (hash + kFix5HashSize)[hv] = p->pos;
+ p->son[p->cyclicBufferPos] = curMatch;
+ MOVE_POS
+ }
+ while (--num != 0);
+}
+*/
+
+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+ do
+ {
+ SKIP_HEADER(3)
+ HASH_ZIP_CALC;
+ curMatch = p->hash[hv];
+ p->hash[hv] = p->pos;
+ p->son[p->cyclicBufferPos] = curMatch;
+ MOVE_POS
+ }
+ while (--num != 0);
+}
+
+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
+{
+ vTable->Init = (Mf_Init_Func)MatchFinder_Init;
+ vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes;
+ vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos;
+ if (!p->btMode)
+ {
+ /* if (p->numHashBytes <= 4) */
+ {
+ vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches;
+ vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip;
+ }
+ /*
+ else
+ {
+ vTable->GetMatches = (Mf_GetMatches_Func)Hc5_MatchFinder_GetMatches;
+ vTable->Skip = (Mf_Skip_Func)Hc5_MatchFinder_Skip;
+ }
+ */
+ }
+ else if (p->numHashBytes == 2)
+ {
+ vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches;
+ vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip;
+ }
+ else if (p->numHashBytes == 3)
+ {
+ vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches;
+ vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip;
+ }
+ else /* if (p->numHashBytes == 4) */
+ {
+ vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
+ vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
+ }
+ /*
+ else
+ {
+ vTable->GetMatches = (Mf_GetMatches_Func)Bt5_MatchFinder_GetMatches;
+ vTable->Skip = (Mf_Skip_Func)Bt5_MatchFinder_Skip;
+ }
+ */
+}
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.h
new file mode 100644
index 000000000..c77added7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.h
@@ -0,0 +1,121 @@
+/* LzFind.h -- Match finder for LZ algorithms
+2017-06-10 : Igor Pavlov : Public domain */
+
+#ifndef __LZ_FIND_H
+#define __LZ_FIND_H
+
+#include "7zTypes.h"
+
+EXTERN_C_BEGIN
+
+typedef UInt32 CLzRef;
+
+typedef struct _CMatchFinder
+{
+ Byte *buffer;
+ UInt32 pos;
+ UInt32 posLimit;
+ UInt32 streamPos;
+ UInt32 lenLimit;
+
+ UInt32 cyclicBufferPos;
+ UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
+
+ Byte streamEndWasReached;
+ Byte btMode;
+ Byte bigHash;
+ Byte directInput;
+
+ UInt32 matchMaxLen;
+ CLzRef *hash;
+ CLzRef *son;
+ UInt32 hashMask;
+ UInt32 cutValue;
+
+ Byte *bufferBase;
+ ISeqInStream *stream;
+
+ UInt32 blockSize;
+ UInt32 keepSizeBefore;
+ UInt32 keepSizeAfter;
+
+ UInt32 numHashBytes;
+ size_t directInputRem;
+ UInt32 historySize;
+ UInt32 fixedHashSize;
+ UInt32 hashSizeSum;
+ SRes result;
+ UInt32 crc[256];
+ size_t numRefs;
+
+ UInt64 expectedDataSize;
+} CMatchFinder;
+
+#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
+
+#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
+
+#define Inline_MatchFinder_IsFinishedOK(p) \
+ ((p)->streamEndWasReached \
+ && (p)->streamPos == (p)->pos \
+ && (!(p)->directInput || (p)->directInputRem == 0))
+
+int MatchFinder_NeedMove(CMatchFinder *p);
+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
+void MatchFinder_MoveBlock(CMatchFinder *p);
+void MatchFinder_ReadIfRequired(CMatchFinder *p);
+
+void MatchFinder_Construct(CMatchFinder *p);
+
+/* Conditions:
+ historySize <= 3 GB
+ keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
+*/
+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
+ ISzAllocPtr alloc);
+void MatchFinder_Free(CMatchFinder *p, ISzAllocPtr alloc);
+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems);
+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
+
+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
+ UInt32 *distances, UInt32 maxLen);
+
+/*
+Conditions:
+ Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
+ Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
+*/
+
+typedef void (*Mf_Init_Func)(void *object);
+typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
+typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
+typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
+typedef void (*Mf_Skip_Func)(void *object, UInt32);
+
+typedef struct _IMatchFinder
+{
+ Mf_Init_Func Init;
+ Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
+ Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
+ Mf_GetMatches_Func GetMatches;
+ Mf_Skip_Func Skip;
+} IMatchFinder;
+
+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
+
+void MatchFinder_Init_LowHash(CMatchFinder *p);
+void MatchFinder_Init_HighHash(CMatchFinder *p);
+void MatchFinder_Init_3(CMatchFinder *p, int readData);
+void MatchFinder_Init(CMatchFinder *p);
+
+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
+
+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
+
+EXTERN_C_END
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.c b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.c
new file mode 100644
index 000000000..2563824fc
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.c
@@ -0,0 +1,820 @@
+/* LzFindMt.c -- multithreaded Match finder for LZ algorithms
+2017-06-10 : Igor Pavlov : Public domain */
+
+#include "Precomp.h"
+
+#include "LzHash.h"
+
+#include "LzFindMt.h"
+
+static void MtSync_Construct(CMtSync *p)
+{
+ p->wasCreated = False;
+ p->csWasInitialized = False;
+ p->csWasEntered = False;
+ Thread_Construct(&p->thread);
+ Event_Construct(&p->canStart);
+ Event_Construct(&p->wasStarted);
+ Event_Construct(&p->wasStopped);
+ Semaphore_Construct(&p->freeSemaphore);
+ Semaphore_Construct(&p->filledSemaphore);
+}
+
+static void MtSync_GetNextBlock(CMtSync *p)
+{
+ if (p->needStart)
+ {
+ p->numProcessedBlocks = 1;
+ p->needStart = False;
+ p->stopWriting = False;
+ p->exit = False;
+ Event_Reset(&p->wasStarted);
+ Event_Reset(&p->wasStopped);
+
+ Event_Set(&p->canStart);
+ Event_Wait(&p->wasStarted);
+
+ // if (mt) MatchFinder_Init_LowHash(mt->MatchFinder);
+ }
+ else
+ {
+ CriticalSection_Leave(&p->cs);
+ p->csWasEntered = False;
+ p->numProcessedBlocks++;
+ Semaphore_Release1(&p->freeSemaphore);
+ }
+ Semaphore_Wait(&p->filledSemaphore);
+ CriticalSection_Enter(&p->cs);
+ p->csWasEntered = True;
+}
+
+/* MtSync_StopWriting must be called if Writing was started */
+
+static void MtSync_StopWriting(CMtSync *p)
+{
+ UInt32 myNumBlocks = p->numProcessedBlocks;
+ if (!Thread_WasCreated(&p->thread) || p->needStart)
+ return;
+ p->stopWriting = True;
+ if (p->csWasEntered)
+ {
+ CriticalSection_Leave(&p->cs);
+ p->csWasEntered = False;
+ }
+ Semaphore_Release1(&p->freeSemaphore);
+
+ Event_Wait(&p->wasStopped);
+
+ while (myNumBlocks++ != p->numProcessedBlocks)
+ {
+ Semaphore_Wait(&p->filledSemaphore);
+ Semaphore_Release1(&p->freeSemaphore);
+ }
+ p->needStart = True;
+}
+
+static void MtSync_Destruct(CMtSync *p)
+{
+ if (Thread_WasCreated(&p->thread))
+ {
+ MtSync_StopWriting(p);
+ p->exit = True;
+ if (p->needStart)
+ Event_Set(&p->canStart);
+ Thread_Wait(&p->thread);
+ Thread_Close(&p->thread);
+ }
+ if (p->csWasInitialized)
+ {
+ CriticalSection_Delete(&p->cs);
+ p->csWasInitialized = False;
+ }
+
+ Event_Close(&p->canStart);
+ Event_Close(&p->wasStarted);
+ Event_Close(&p->wasStopped);
+ Semaphore_Close(&p->freeSemaphore);
+ Semaphore_Close(&p->filledSemaphore);
+
+ p->wasCreated = False;
+}
+
+#define RINOK_THREAD(x) { if ((x) != 0) return SZ_ERROR_THREAD; }
+
+static SRes MtSync_Create2(CMtSync *p, THREAD_FUNC_TYPE startAddress, void *obj, UInt32 numBlocks)
+{
+ if (p->wasCreated)
+ return SZ_OK;
+
+ RINOK_THREAD(CriticalSection_Init(&p->cs));
+ p->csWasInitialized = True;
+
+ RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canStart));
+ RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStarted));
+ RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStopped));
+
+ RINOK_THREAD(Semaphore_Create(&p->freeSemaphore, numBlocks, numBlocks));
+ RINOK_THREAD(Semaphore_Create(&p->filledSemaphore, 0, numBlocks));
+
+ p->needStart = True;
+
+ RINOK_THREAD(Thread_Create(&p->thread, startAddress, obj));
+ p->wasCreated = True;
+ return SZ_OK;
+}
+
+static SRes MtSync_Create(CMtSync *p, THREAD_FUNC_TYPE startAddress, void *obj, UInt32 numBlocks)
+{
+ SRes res = MtSync_Create2(p, startAddress, obj, numBlocks);
+ if (res != SZ_OK)
+ MtSync_Destruct(p);
+ return res;
+}
+
+void MtSync_Init(CMtSync *p) { p->needStart = True; }
+
+#define kMtMaxValForNormalize 0xFFFFFFFF
+
+#define DEF_GetHeads2(name, v, action) \
+ static void GetHeads ## name(const Byte *p, UInt32 pos, \
+ UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc) \
+ { action; for (; numHeads != 0; numHeads--) { \
+ const UInt32 value = (v); p++; *heads++ = pos - hash[value]; hash[value] = pos++; } }
+
+#define DEF_GetHeads(name, v) DEF_GetHeads2(name, v, ;)
+
+DEF_GetHeads2(2, (p[0] | ((UInt32)p[1] << 8)), UNUSED_VAR(hashMask); UNUSED_VAR(crc); )
+DEF_GetHeads(3, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8)) & hashMask)
+DEF_GetHeads(4, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ (crc[p[3]] << 5)) & hashMask)
+DEF_GetHeads(4b, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ ((UInt32)p[3] << 16)) & hashMask)
+/* DEF_GetHeads(5, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ (crc[p[3]] << 5) ^ (crc[p[4]] << 3)) & hashMask) */
+
+static void HashThreadFunc(CMatchFinderMt *mt)
+{
+ CMtSync *p = &mt->hashSync;
+ for (;;)
+ {
+ UInt32 numProcessedBlocks = 0;
+ Event_Wait(&p->canStart);
+ Event_Set(&p->wasStarted);
+
+ MatchFinder_Init_HighHash(mt->MatchFinder);
+
+ for (;;)
+ {
+ if (p->exit)
+ return;
+ if (p->stopWriting)
+ {
+ p->numProcessedBlocks = numProcessedBlocks;
+ Event_Set(&p->wasStopped);
+ break;
+ }
+
+ {
+ CMatchFinder *mf = mt->MatchFinder;
+ if (MatchFinder_NeedMove(mf))
+ {
+ CriticalSection_Enter(&mt->btSync.cs);
+ CriticalSection_Enter(&mt->hashSync.cs);
+ {
+ const Byte *beforePtr = Inline_MatchFinder_GetPointerToCurrentPos(mf);
+ ptrdiff_t offset;
+ MatchFinder_MoveBlock(mf);
+ offset = beforePtr - Inline_MatchFinder_GetPointerToCurrentPos(mf);
+ mt->pointerToCurPos -= offset;
+ mt->buffer -= offset;
+ }
+ CriticalSection_Leave(&mt->btSync.cs);
+ CriticalSection_Leave(&mt->hashSync.cs);
+ continue;
+ }
+
+ Semaphore_Wait(&p->freeSemaphore);
+
+ MatchFinder_ReadIfRequired(mf);
+ if (mf->pos > (kMtMaxValForNormalize - kMtHashBlockSize))
+ {
+ UInt32 subValue = (mf->pos - mf->historySize - 1);
+ MatchFinder_ReduceOffsets(mf, subValue);
+ MatchFinder_Normalize3(subValue, mf->hash + mf->fixedHashSize, (size_t)mf->hashMask + 1);
+ }
+ {
+ UInt32 *heads = mt->hashBuf + ((numProcessedBlocks++) & kMtHashNumBlocksMask) * kMtHashBlockSize;
+ UInt32 num = mf->streamPos - mf->pos;
+ heads[0] = 2;
+ heads[1] = num;
+ if (num >= mf->numHashBytes)
+ {
+ num = num - mf->numHashBytes + 1;
+ if (num > kMtHashBlockSize - 2)
+ num = kMtHashBlockSize - 2;
+ mt->GetHeadsFunc(mf->buffer, mf->pos, mf->hash + mf->fixedHashSize, mf->hashMask, heads + 2, num, mf->crc);
+ heads[0] = 2 + num;
+ }
+ mf->pos += num;
+ mf->buffer += num;
+ }
+ }
+
+ Semaphore_Release1(&p->filledSemaphore);
+ }
+ }
+}
+
+static void MatchFinderMt_GetNextBlock_Hash(CMatchFinderMt *p)
+{
+ MtSync_GetNextBlock(&p->hashSync);
+ p->hashBufPosLimit = p->hashBufPos = ((p->hashSync.numProcessedBlocks - 1) & kMtHashNumBlocksMask) * kMtHashBlockSize;
+ p->hashBufPosLimit += p->hashBuf[p->hashBufPos++];
+ p->hashNumAvail = p->hashBuf[p->hashBufPos++];
+}
+
+#define kEmptyHashValue 0
+
+/* #define MFMT_GM_INLINE */
+
+#ifdef MFMT_GM_INLINE
+
+#define NO_INLINE MY_FAST_CALL
+
+static Int32 NO_INLINE GetMatchesSpecN(UInt32 lenLimit, UInt32 pos, const Byte *cur, CLzRef *son,
+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
+ UInt32 *_distances, UInt32 _maxLen, const UInt32 *hash, Int32 limit, UInt32 size, UInt32 *posRes)
+{
+ do
+ {
+ UInt32 *distances = _distances + 1;
+ UInt32 curMatch = pos - *hash++;
+
+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
+ UInt32 len0 = 0, len1 = 0;
+ UInt32 cutValue = _cutValue;
+ UInt32 maxLen = _maxLen;
+ for (;;)
+ {
+ UInt32 delta = pos - curMatch;
+ if (cutValue-- == 0 || delta >= _cyclicBufferSize)
+ {
+ *ptr0 = *ptr1 = kEmptyHashValue;
+ break;
+ }
+ {
+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
+ const Byte *pb = cur - delta;
+ UInt32 len = (len0 < len1 ? len0 : len1);
+ if (pb[len] == cur[len])
+ {
+ if (++len != lenLimit && pb[len] == cur[len])
+ while (++len != lenLimit)
+ if (pb[len] != cur[len])
+ break;
+ if (maxLen < len)
+ {
+ *distances++ = maxLen = len;
+ *distances++ = delta - 1;
+ if (len == lenLimit)
+ {
+ *ptr1 = pair[0];
+ *ptr0 = pair[1];
+ break;
+ }
+ }
+ }
+ if (pb[len] < cur[len])
+ {
+ *ptr1 = curMatch;
+ ptr1 = pair + 1;
+ curMatch = *ptr1;
+ len1 = len;
+ }
+ else
+ {
+ *ptr0 = curMatch;
+ ptr0 = pair;
+ curMatch = *ptr0;
+ len0 = len;
+ }
+ }
+ }
+ pos++;
+ _cyclicBufferPos++;
+ cur++;
+ {
+ UInt32 num = (UInt32)(distances - _distances);
+ *_distances = num - 1;
+ _distances += num;
+ limit -= num;
+ }
+ }
+ while (limit > 0 && --size != 0);
+ *posRes = pos;
+ return limit;
+}
+
+#endif
+
+static void BtGetMatches(CMatchFinderMt *p, UInt32 *distances)
+{
+ UInt32 numProcessed = 0;
+ UInt32 curPos = 2;
+ UInt32 limit = kMtBtBlockSize - (p->matchMaxLen * 2);
+
+ distances[1] = p->hashNumAvail;
+
+ while (curPos < limit)
+ {
+ if (p->hashBufPos == p->hashBufPosLimit)
+ {
+ MatchFinderMt_GetNextBlock_Hash(p);
+ distances[1] = numProcessed + p->hashNumAvail;
+ if (p->hashNumAvail >= p->numHashBytes)
+ continue;
+ distances[0] = curPos + p->hashNumAvail;
+ distances += curPos;
+ for (; p->hashNumAvail != 0; p->hashNumAvail--)
+ *distances++ = 0;
+ return;
+ }
+ {
+ UInt32 size = p->hashBufPosLimit - p->hashBufPos;
+ UInt32 lenLimit = p->matchMaxLen;
+ UInt32 pos = p->pos;
+ UInt32 cyclicBufferPos = p->cyclicBufferPos;
+ if (lenLimit >= p->hashNumAvail)
+ lenLimit = p->hashNumAvail;
+ {
+ UInt32 size2 = p->hashNumAvail - lenLimit + 1;
+ if (size2 < size)
+ size = size2;
+ size2 = p->cyclicBufferSize - cyclicBufferPos;
+ if (size2 < size)
+ size = size2;
+ }
+
+ #ifndef MFMT_GM_INLINE
+ while (curPos < limit && size-- != 0)
+ {
+ UInt32 *startDistances = distances + curPos;
+ UInt32 num = (UInt32)(GetMatchesSpec1(lenLimit, pos - p->hashBuf[p->hashBufPos++],
+ pos, p->buffer, p->son, cyclicBufferPos, p->cyclicBufferSize, p->cutValue,
+ startDistances + 1, p->numHashBytes - 1) - startDistances);
+ *startDistances = num - 1;
+ curPos += num;
+ cyclicBufferPos++;
+ pos++;
+ p->buffer++;
+ }
+ #else
+ {
+ UInt32 posRes;
+ curPos = limit - GetMatchesSpecN(lenLimit, pos, p->buffer, p->son, cyclicBufferPos, p->cyclicBufferSize, p->cutValue,
+ distances + curPos, p->numHashBytes - 1, p->hashBuf + p->hashBufPos, (Int32)(limit - curPos), size, &posRes);
+ p->hashBufPos += posRes - pos;
+ cyclicBufferPos += posRes - pos;
+ p->buffer += posRes - pos;
+ pos = posRes;
+ }
+ #endif
+
+ numProcessed += pos - p->pos;
+ p->hashNumAvail -= pos - p->pos;
+ p->pos = pos;
+ if (cyclicBufferPos == p->cyclicBufferSize)
+ cyclicBufferPos = 0;
+ p->cyclicBufferPos = cyclicBufferPos;
+ }
+ }
+
+ distances[0] = curPos;
+}
+
+static void BtFillBlock(CMatchFinderMt *p, UInt32 globalBlockIndex)
+{
+ CMtSync *sync = &p->hashSync;
+ if (!sync->needStart)
+ {
+ CriticalSection_Enter(&sync->cs);
+ sync->csWasEntered = True;
+ }
+
+ BtGetMatches(p, p->btBuf + (globalBlockIndex & kMtBtNumBlocksMask) * kMtBtBlockSize);
+
+ if (p->pos > kMtMaxValForNormalize - kMtBtBlockSize)
+ {
+ UInt32 subValue = p->pos - p->cyclicBufferSize;
+ MatchFinder_Normalize3(subValue, p->son, (size_t)p->cyclicBufferSize * 2);
+ p->pos -= subValue;
+ }
+
+ if (!sync->needStart)
+ {
+ CriticalSection_Leave(&sync->cs);
+ sync->csWasEntered = False;
+ }
+}
+
+void BtThreadFunc(CMatchFinderMt *mt)
+{
+ CMtSync *p = &mt->btSync;
+ for (;;)
+ {
+ UInt32 blockIndex = 0;
+ Event_Wait(&p->canStart);
+ Event_Set(&p->wasStarted);
+ for (;;)
+ {
+ if (p->exit)
+ return;
+ if (p->stopWriting)
+ {
+ p->numProcessedBlocks = blockIndex;
+ MtSync_StopWriting(&mt->hashSync);
+ Event_Set(&p->wasStopped);
+ break;
+ }
+ Semaphore_Wait(&p->freeSemaphore);
+ BtFillBlock(mt, blockIndex++);
+ Semaphore_Release1(&p->filledSemaphore);
+ }
+ }
+}
+
+void MatchFinderMt_Construct(CMatchFinderMt *p)
+{
+ p->hashBuf = NULL;
+ MtSync_Construct(&p->hashSync);
+ MtSync_Construct(&p->btSync);
+}
+
+static void MatchFinderMt_FreeMem(CMatchFinderMt *p, ISzAllocPtr alloc)
+{
+ ISzAlloc_Free(alloc, p->hashBuf);
+ p->hashBuf = NULL;
+}
+
+void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAllocPtr alloc)
+{
+ MtSync_Destruct(&p->hashSync);
+ MtSync_Destruct(&p->btSync);
+ MatchFinderMt_FreeMem(p, alloc);
+}
+
+#define kHashBufferSize (kMtHashBlockSize * kMtHashNumBlocks)
+#define kBtBufferSize (kMtBtBlockSize * kMtBtNumBlocks)
+
+static THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE HashThreadFunc2(void *p) { HashThreadFunc((CMatchFinderMt *)p); return 0; }
+static THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE BtThreadFunc2(void *p)
+{
+ Byte allocaDummy[0x180];
+ unsigned i = 0;
+ for (i = 0; i < 16; i++)
+ allocaDummy[i] = (Byte)0;
+ if (allocaDummy[0] == 0)
+ BtThreadFunc((CMatchFinderMt *)p);
+ return 0;
+}
+
+SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore,
+ UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAllocPtr alloc)
+{
+ CMatchFinder *mf = p->MatchFinder;
+ p->historySize = historySize;
+ if (kMtBtBlockSize <= matchMaxLen * 4)
+ return SZ_ERROR_PARAM;
+ if (!p->hashBuf)
+ {
+ p->hashBuf = (UInt32 *)ISzAlloc_Alloc(alloc, (kHashBufferSize + kBtBufferSize) * sizeof(UInt32));
+ if (!p->hashBuf)
+ return SZ_ERROR_MEM;
+ p->btBuf = p->hashBuf + kHashBufferSize;
+ }
+ keepAddBufferBefore += (kHashBufferSize + kBtBufferSize);
+ keepAddBufferAfter += kMtHashBlockSize;
+ if (!MatchFinder_Create(mf, historySize, keepAddBufferBefore, matchMaxLen, keepAddBufferAfter, alloc))
+ return SZ_ERROR_MEM;
+
+ RINOK(MtSync_Create(&p->hashSync, HashThreadFunc2, p, kMtHashNumBlocks));
+ RINOK(MtSync_Create(&p->btSync, BtThreadFunc2, p, kMtBtNumBlocks));
+ return SZ_OK;
+}
+
+/* Call it after ReleaseStream / SetStream */
+static void MatchFinderMt_Init(CMatchFinderMt *p)
+{
+ CMatchFinder *mf = p->MatchFinder;
+
+ p->btBufPos =
+ p->btBufPosLimit = 0;
+ p->hashBufPos =
+ p->hashBufPosLimit = 0;
+
+ /* Init without data reading. We don't want to read data in this thread */
+ MatchFinder_Init_3(mf, False);
+ MatchFinder_Init_LowHash(mf);
+
+ p->pointerToCurPos = Inline_MatchFinder_GetPointerToCurrentPos(mf);
+ p->btNumAvailBytes = 0;
+ p->lzPos = p->historySize + 1;
+
+ p->hash = mf->hash;
+ p->fixedHashSize = mf->fixedHashSize;
+ p->crc = mf->crc;
+
+ p->son = mf->son;
+ p->matchMaxLen = mf->matchMaxLen;
+ p->numHashBytes = mf->numHashBytes;
+ p->pos = mf->pos;
+ p->buffer = mf->buffer;
+ p->cyclicBufferPos = mf->cyclicBufferPos;
+ p->cyclicBufferSize = mf->cyclicBufferSize;
+ p->cutValue = mf->cutValue;
+}
+
+/* ReleaseStream is required to finish multithreading */
+void MatchFinderMt_ReleaseStream(CMatchFinderMt *p)
+{
+ MtSync_StopWriting(&p->btSync);
+ /* p->MatchFinder->ReleaseStream(); */
+}
+
+static void MatchFinderMt_Normalize(CMatchFinderMt *p)
+{
+ MatchFinder_Normalize3(p->lzPos - p->historySize - 1, p->hash, p->fixedHashSize);
+ p->lzPos = p->historySize + 1;
+}
+
+static void MatchFinderMt_GetNextBlock_Bt(CMatchFinderMt *p)
+{
+ UInt32 blockIndex;
+ MtSync_GetNextBlock(&p->btSync);
+ blockIndex = ((p->btSync.numProcessedBlocks - 1) & kMtBtNumBlocksMask);
+ p->btBufPosLimit = p->btBufPos = blockIndex * kMtBtBlockSize;
+ p->btBufPosLimit += p->btBuf[p->btBufPos++];
+ p->btNumAvailBytes = p->btBuf[p->btBufPos++];
+ if (p->lzPos >= kMtMaxValForNormalize - kMtBtBlockSize)
+ MatchFinderMt_Normalize(p);
+}
+
+static const Byte * MatchFinderMt_GetPointerToCurrentPos(CMatchFinderMt *p)
+{
+ return p->pointerToCurPos;
+}
+
+#define GET_NEXT_BLOCK_IF_REQUIRED if (p->btBufPos == p->btBufPosLimit) MatchFinderMt_GetNextBlock_Bt(p);
+
+static UInt32 MatchFinderMt_GetNumAvailableBytes(CMatchFinderMt *p)
+{
+ GET_NEXT_BLOCK_IF_REQUIRED;
+ return p->btNumAvailBytes;
+}
+
+static UInt32 * MixMatches2(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
+{
+ UInt32 h2, curMatch2;
+ UInt32 *hash = p->hash;
+ const Byte *cur = p->pointerToCurPos;
+ UInt32 lzPos = p->lzPos;
+ MT_HASH2_CALC
+
+ curMatch2 = hash[h2];
+ hash[h2] = lzPos;
+
+ if (curMatch2 >= matchMinPos)
+ if (cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
+ {
+ *distances++ = 2;
+ *distances++ = lzPos - curMatch2 - 1;
+ }
+
+ return distances;
+}
+
+static UInt32 * MixMatches3(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
+{
+ UInt32 h2, h3, curMatch2, curMatch3;
+ UInt32 *hash = p->hash;
+ const Byte *cur = p->pointerToCurPos;
+ UInt32 lzPos = p->lzPos;
+ MT_HASH3_CALC
+
+ curMatch2 = hash[ h2];
+ curMatch3 = (hash + kFix3HashSize)[h3];
+
+ hash[ h2] = lzPos;
+ (hash + kFix3HashSize)[h3] = lzPos;
+
+ if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
+ {
+ distances[1] = lzPos - curMatch2 - 1;
+ if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2])
+ {
+ distances[0] = 3;
+ return distances + 2;
+ }
+ distances[0] = 2;
+ distances += 2;
+ }
+
+ if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0])
+ {
+ *distances++ = 3;
+ *distances++ = lzPos - curMatch3 - 1;
+ }
+
+ return distances;
+}
+
+/*
+static UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
+{
+ UInt32 h2, h3, h4, curMatch2, curMatch3, curMatch4;
+ UInt32 *hash = p->hash;
+ const Byte *cur = p->pointerToCurPos;
+ UInt32 lzPos = p->lzPos;
+ MT_HASH4_CALC
+
+ curMatch2 = hash[ h2];
+ curMatch3 = (hash + kFix3HashSize)[h3];
+ curMatch4 = (hash + kFix4HashSize)[h4];
+
+ hash[ h2] = lzPos;
+ (hash + kFix3HashSize)[h3] = lzPos;
+ (hash + kFix4HashSize)[h4] = lzPos;
+
+ if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
+ {
+ distances[1] = lzPos - curMatch2 - 1;
+ if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2])
+ {
+ distances[0] = (cur[(ptrdiff_t)curMatch2 - lzPos + 3] == cur[3]) ? 4 : 3;
+ return distances + 2;
+ }
+ distances[0] = 2;
+ distances += 2;
+ }
+
+ if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0])
+ {
+ distances[1] = lzPos - curMatch3 - 1;
+ if (cur[(ptrdiff_t)curMatch3 - lzPos + 3] == cur[3])
+ {
+ distances[0] = 4;
+ return distances + 2;
+ }
+ distances[0] = 3;
+ distances += 2;
+ }
+
+ if (curMatch4 >= matchMinPos)
+ if (
+ cur[(ptrdiff_t)curMatch4 - lzPos] == cur[0] &&
+ cur[(ptrdiff_t)curMatch4 - lzPos + 3] == cur[3]
+ )
+ {
+ *distances++ = 4;
+ *distances++ = lzPos - curMatch4 - 1;
+ }
+
+ return distances;
+}
+*/
+
+#define INCREASE_LZ_POS p->lzPos++; p->pointerToCurPos++;
+
+static UInt32 MatchFinderMt2_GetMatches(CMatchFinderMt *p, UInt32 *distances)
+{
+ const UInt32 *btBuf = p->btBuf + p->btBufPos;
+ UInt32 len = *btBuf++;
+ p->btBufPos += 1 + len;
+ p->btNumAvailBytes--;
+ {
+ UInt32 i;
+ for (i = 0; i < len; i += 2)
+ {
+ UInt32 v0 = btBuf[0];
+ UInt32 v1 = btBuf[1];
+ btBuf += 2;
+ distances[0] = v0;
+ distances[1] = v1;
+ distances += 2;
+ }
+ }
+ INCREASE_LZ_POS
+ return len;
+}
+
+static UInt32 MatchFinderMt_GetMatches(CMatchFinderMt *p, UInt32 *distances)
+{
+ const UInt32 *btBuf = p->btBuf + p->btBufPos;
+ UInt32 len = *btBuf++;
+ p->btBufPos += 1 + len;
+
+ if (len == 0)
+ {
+ /* change for bt5 ! */
+ if (p->btNumAvailBytes-- >= 4)
+ len = (UInt32)(p->MixMatchesFunc(p, p->lzPos - p->historySize, distances) - (distances));
+ }
+ else
+ {
+ /* Condition: there are matches in btBuf with length < p->numHashBytes */
+ UInt32 *distances2;
+ p->btNumAvailBytes--;
+ distances2 = p->MixMatchesFunc(p, p->lzPos - btBuf[1], distances);
+ do
+ {
+ UInt32 v0 = btBuf[0];
+ UInt32 v1 = btBuf[1];
+ btBuf += 2;
+ distances2[0] = v0;
+ distances2[1] = v1;
+ distances2 += 2;
+ }
+ while ((len -= 2) != 0);
+ len = (UInt32)(distances2 - (distances));
+ }
+ INCREASE_LZ_POS
+ return len;
+}
+
+#define SKIP_HEADER2_MT do { GET_NEXT_BLOCK_IF_REQUIRED
+#define SKIP_HEADER_MT(n) SKIP_HEADER2_MT if (p->btNumAvailBytes-- >= (n)) { const Byte *cur = p->pointerToCurPos; UInt32 *hash = p->hash;
+#define SKIP_FOOTER_MT } INCREASE_LZ_POS p->btBufPos += p->btBuf[p->btBufPos] + 1; } while (--num != 0);
+
+static void MatchFinderMt0_Skip(CMatchFinderMt *p, UInt32 num)
+{
+ SKIP_HEADER2_MT { p->btNumAvailBytes--;
+ SKIP_FOOTER_MT
+}
+
+static void MatchFinderMt2_Skip(CMatchFinderMt *p, UInt32 num)
+{
+ SKIP_HEADER_MT(2)
+ UInt32 h2;
+ MT_HASH2_CALC
+ hash[h2] = p->lzPos;
+ SKIP_FOOTER_MT
+}
+
+static void MatchFinderMt3_Skip(CMatchFinderMt *p, UInt32 num)
+{
+ SKIP_HEADER_MT(3)
+ UInt32 h2, h3;
+ MT_HASH3_CALC
+ (hash + kFix3HashSize)[h3] =
+ hash[ h2] =
+ p->lzPos;
+ SKIP_FOOTER_MT
+}
+
+/*
+static void MatchFinderMt4_Skip(CMatchFinderMt *p, UInt32 num)
+{
+ SKIP_HEADER_MT(4)
+ UInt32 h2, h3, h4;
+ MT_HASH4_CALC
+ (hash + kFix4HashSize)[h4] =
+ (hash + kFix3HashSize)[h3] =
+ hash[ h2] =
+ p->lzPos;
+ SKIP_FOOTER_MT
+}
+*/
+
+void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable)
+{
+ vTable->Init = (Mf_Init_Func)MatchFinderMt_Init;
+ vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinderMt_GetNumAvailableBytes;
+ vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinderMt_GetPointerToCurrentPos;
+ vTable->GetMatches = (Mf_GetMatches_Func)MatchFinderMt_GetMatches;
+
+ switch (p->MatchFinder->numHashBytes)
+ {
+ case 2:
+ p->GetHeadsFunc = GetHeads2;
+ p->MixMatchesFunc = (Mf_Mix_Matches)NULL;
+ vTable->Skip = (Mf_Skip_Func)MatchFinderMt0_Skip;
+ vTable->GetMatches = (Mf_GetMatches_Func)MatchFinderMt2_GetMatches;
+ break;
+ case 3:
+ p->GetHeadsFunc = GetHeads3;
+ p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches2;
+ vTable->Skip = (Mf_Skip_Func)MatchFinderMt2_Skip;
+ break;
+ default:
+ /* case 4: */
+ p->GetHeadsFunc = p->MatchFinder->bigHash ? GetHeads4b : GetHeads4;
+ p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches3;
+ vTable->Skip = (Mf_Skip_Func)MatchFinderMt3_Skip;
+ break;
+ /*
+ default:
+ p->GetHeadsFunc = GetHeads5;
+ p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches4;
+ vTable->Skip = (Mf_Skip_Func)MatchFinderMt4_Skip;
+ break;
+ */
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.h
new file mode 100644
index 000000000..3d86c788f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.h
@@ -0,0 +1,101 @@
+/* LzFindMt.h -- multithreaded Match finder for LZ algorithms
+2017-04-03 : Igor Pavlov : Public domain */
+
+#ifndef __LZ_FIND_MT_H
+#define __LZ_FIND_MT_H
+
+#include "LzFind.h"
+#include "Threads.h"
+
+EXTERN_C_BEGIN
+
+#define kMtHashBlockSize (1 << 13)
+#define kMtHashNumBlocks (1 << 3)
+#define kMtHashNumBlocksMask (kMtHashNumBlocks - 1)
+
+#define kMtBtBlockSize (1 << 14)
+#define kMtBtNumBlocks (1 << 6)
+#define kMtBtNumBlocksMask (kMtBtNumBlocks - 1)
+
+typedef struct _CMtSync
+{
+ Bool wasCreated;
+ Bool needStart;
+ Bool exit;
+ Bool stopWriting;
+
+ CThread thread;
+ CAutoResetEvent canStart;
+ CAutoResetEvent wasStarted;
+ CAutoResetEvent wasStopped;
+ CSemaphore freeSemaphore;
+ CSemaphore filledSemaphore;
+ Bool csWasInitialized;
+ Bool csWasEntered;
+ CCriticalSection cs;
+ UInt32 numProcessedBlocks;
+} CMtSync;
+
+typedef UInt32 * (*Mf_Mix_Matches)(void *p, UInt32 matchMinPos, UInt32 *distances);
+
+/* kMtCacheLineDummy must be >= size_of_CPU_cache_line */
+#define kMtCacheLineDummy 128
+
+typedef void (*Mf_GetHeads)(const Byte *buffer, UInt32 pos,
+ UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc);
+
+typedef struct _CMatchFinderMt
+{
+ /* LZ */
+ const Byte *pointerToCurPos;
+ UInt32 *btBuf;
+ UInt32 btBufPos;
+ UInt32 btBufPosLimit;
+ UInt32 lzPos;
+ UInt32 btNumAvailBytes;
+
+ UInt32 *hash;
+ UInt32 fixedHashSize;
+ UInt32 historySize;
+ const UInt32 *crc;
+
+ Mf_Mix_Matches MixMatchesFunc;
+
+ /* LZ + BT */
+ CMtSync btSync;
+ Byte btDummy[kMtCacheLineDummy];
+
+ /* BT */
+ UInt32 *hashBuf;
+ UInt32 hashBufPos;
+ UInt32 hashBufPosLimit;
+ UInt32 hashNumAvail;
+
+ CLzRef *son;
+ UInt32 matchMaxLen;
+ UInt32 numHashBytes;
+ UInt32 pos;
+ const Byte *buffer;
+ UInt32 cyclicBufferPos;
+ UInt32 cyclicBufferSize; /* it must be historySize + 1 */
+ UInt32 cutValue;
+
+ /* BT + Hash */
+ CMtSync hashSync;
+ /* Byte hashDummy[kMtCacheLineDummy]; */
+
+ /* Hash */
+ Mf_GetHeads GetHeadsFunc;
+ CMatchFinder *MatchFinder;
+} CMatchFinderMt;
+
+void MatchFinderMt_Construct(CMatchFinderMt *p);
+void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAllocPtr alloc);
+SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore,
+ UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAllocPtr alloc);
+void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable);
+void MatchFinderMt_ReleaseStream(CMatchFinderMt *p);
+
+EXTERN_C_END
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzHash.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzHash.h
new file mode 100644
index 000000000..219144407
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzHash.h
@@ -0,0 +1,57 @@
+/* LzHash.h -- HASH functions for LZ algorithms
+2015-04-12 : Igor Pavlov : Public domain */
+
+#ifndef __LZ_HASH_H
+#define __LZ_HASH_H
+
+#define kHash2Size (1 << 10)
+#define kHash3Size (1 << 16)
+#define kHash4Size (1 << 20)
+
+#define kFix3HashSize (kHash2Size)
+#define kFix4HashSize (kHash2Size + kHash3Size)
+#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
+
+#define HASH2_CALC hv = cur[0] | ((UInt32)cur[1] << 8);
+
+#define HASH3_CALC { \
+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+ h2 = temp & (kHash2Size - 1); \
+ hv = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
+
+#define HASH4_CALC { \
+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+ h2 = temp & (kHash2Size - 1); \
+ temp ^= ((UInt32)cur[2] << 8); \
+ h3 = temp & (kHash3Size - 1); \
+ hv = (temp ^ (p->crc[cur[3]] << 5)) & p->hashMask; }
+
+#define HASH5_CALC { \
+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+ h2 = temp & (kHash2Size - 1); \
+ temp ^= ((UInt32)cur[2] << 8); \
+ h3 = temp & (kHash3Size - 1); \
+ temp ^= (p->crc[cur[3]] << 5); \
+ h4 = temp & (kHash4Size - 1); \
+ hv = (temp ^ (p->crc[cur[4]] << 3)) & p->hashMask; }
+
+/* #define HASH_ZIP_CALC hv = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */
+#define HASH_ZIP_CALC hv = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
+
+
+#define MT_HASH2_CALC \
+ h2 = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1);
+
+#define MT_HASH3_CALC { \
+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+ h2 = temp & (kHash2Size - 1); \
+ h3 = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
+
+#define MT_HASH4_CALC { \
+ UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+ h2 = temp & (kHash2Size - 1); \
+ temp ^= ((UInt32)cur[2] << 8); \
+ h3 = temp & (kHash3Size - 1); \
+ h4 = (temp ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); }
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c
new file mode 100644
index 000000000..962b94bb6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c
@@ -0,0 +1,1185 @@
+/* LzmaDec.c -- LZMA Decoder
+2018-02-28 : Igor Pavlov : Public domain */
+
+#include "Precomp.h"
+
+/* #include "CpuArch.h" */
+#include "LzmaDec.h"
+
+#include <string.h>
+
+#define kNumTopBits 24
+#define kTopValue ((UInt32)1 << kNumTopBits)
+
+#define kNumBitModelTotalBits 11
+#define kBitModelTotal (1 << kNumBitModelTotalBits)
+#define kNumMoveBits 5
+
+#define RC_INIT_SIZE 5
+
+#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
+
+#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
+#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
+#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits));
+#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \
+ { UPDATE_0(p); i = (i + i); A0; } else \
+ { UPDATE_1(p); i = (i + i) + 1; A1; }
+
+#define TREE_GET_BIT(probs, i) { GET_BIT2(probs + i, i, ;, ;); }
+
+#define REV_BIT(p, i, A0, A1) IF_BIT_0(p + i) \
+ { UPDATE_0(p + i); A0; } else \
+ { UPDATE_1(p + i); A1; }
+#define REV_BIT_VAR( p, i, m) REV_BIT(p, i, i += m; m += m, m += m; i += m; )
+#define REV_BIT_CONST(p, i, m) REV_BIT(p, i, i += m; , i += m * 2; )
+#define REV_BIT_LAST( p, i, m) REV_BIT(p, i, i -= m , ; )
+
+#define TREE_DECODE(probs, limit, i) \
+ { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; }
+
+/* #define _LZMA_SIZE_OPT */
+
+#ifdef _LZMA_SIZE_OPT
+#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i)
+#else
+#define TREE_6_DECODE(probs, i) \
+ { i = 1; \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ i -= 0x40; }
+#endif
+
+#define NORMAL_LITER_DEC TREE_GET_BIT(prob, symbol)
+#define MATCHED_LITER_DEC \
+ matchByte += matchByte; \
+ bit = offs; \
+ offs &= matchByte; \
+ probLit = prob + (offs + bit + symbol); \
+ GET_BIT2(probLit, symbol, offs ^= bit; , ;)
+
+
+
+#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); }
+
+#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
+#define UPDATE_0_CHECK range = bound;
+#define UPDATE_1_CHECK range -= bound; code -= bound;
+#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \
+ { UPDATE_0_CHECK; i = (i + i); A0; } else \
+ { UPDATE_1_CHECK; i = (i + i) + 1; A1; }
+#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;)
+#define TREE_DECODE_CHECK(probs, limit, i) \
+ { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
+
+
+#define REV_BIT_CHECK(p, i, m) IF_BIT_0_CHECK(p + i) \
+ { UPDATE_0_CHECK; i += m; m += m; } else \
+ { UPDATE_1_CHECK; m += m; i += m; }
+
+
+#define kNumPosBitsMax 4
+#define kNumPosStatesMax (1 << kNumPosBitsMax)
+
+#define kLenNumLowBits 3
+#define kLenNumLowSymbols (1 << kLenNumLowBits)
+#define kLenNumHighBits 8
+#define kLenNumHighSymbols (1 << kLenNumHighBits)
+
+#define LenLow 0
+#define LenHigh (LenLow + 2 * (kNumPosStatesMax << kLenNumLowBits))
+#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
+
+#define LenChoice LenLow
+#define LenChoice2 (LenLow + (1 << kLenNumLowBits))
+
+#define kNumStates 12
+#define kNumStates2 16
+#define kNumLitStates 7
+
+#define kStartPosModelIndex 4
+#define kEndPosModelIndex 14
+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
+
+#define kNumPosSlotBits 6
+#define kNumLenToPosStates 4
+
+#define kNumAlignBits 4
+#define kAlignTableSize (1 << kNumAlignBits)
+
+#define kMatchMinLen 2
+#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols * 2 + kLenNumHighSymbols)
+
+/* External ASM code needs same CLzmaProb array layout. So don't change it. */
+
+/* (probs_1664) is faster and better for code size at some platforms */
+/*
+#ifdef MY_CPU_X86_OR_AMD64
+*/
+#define kStartOffset 1664
+#define GET_PROBS p->probs_1664
+/*
+#define GET_PROBS p->probs + kStartOffset
+#else
+#define kStartOffset 0
+#define GET_PROBS p->probs
+#endif
+*/
+
+#define SpecPos (-kStartOffset)
+#define IsRep0Long (SpecPos + kNumFullDistances)
+#define RepLenCoder (IsRep0Long + (kNumStates2 << kNumPosBitsMax))
+#define LenCoder (RepLenCoder + kNumLenProbs)
+#define IsMatch (LenCoder + kNumLenProbs)
+#define Align (IsMatch + (kNumStates2 << kNumPosBitsMax))
+#define IsRep (Align + kAlignTableSize)
+#define IsRepG0 (IsRep + kNumStates)
+#define IsRepG1 (IsRepG0 + kNumStates)
+#define IsRepG2 (IsRepG1 + kNumStates)
+#define PosSlot (IsRepG2 + kNumStates)
+#define Literal (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
+#define NUM_BASE_PROBS (Literal + kStartOffset)
+
+#if Align != 0 && kStartOffset != 0
+ #error Stop_Compiling_Bad_LZMA_kAlign
+#endif
+
+#if NUM_BASE_PROBS != 1984
+ #error Stop_Compiling_Bad_LZMA_PROBS
+#endif
+
+
+#define LZMA_LIT_SIZE 0x300
+
+#define LzmaProps_GetNumProbs(p) (NUM_BASE_PROBS + ((UInt32)LZMA_LIT_SIZE << ((p)->lc + (p)->lp)))
+
+
+#define CALC_POS_STATE(processedPos, pbMask) (((processedPos) & (pbMask)) << 4)
+#define COMBINED_PS_STATE (posState + state)
+#define GET_LEN_STATE (posState)
+
+#define LZMA_DIC_MIN (1 << 12)
+
+/*
+p->remainLen : shows status of LZMA decoder:
+ < kMatchSpecLenStart : normal remain
+ = kMatchSpecLenStart : finished
+ = kMatchSpecLenStart + 1 : need init range coder
+ = kMatchSpecLenStart + 2 : need init range coder and state
+*/
+
+/* ---------- LZMA_DECODE_REAL ---------- */
+/*
+LzmaDec_DecodeReal_3() can be implemented in external ASM file.
+3 - is the code compatibility version of that function for check at link time.
+*/
+
+#define LZMA_DECODE_REAL LzmaDec_DecodeReal_3
+
+/*
+LZMA_DECODE_REAL()
+In:
+ RangeCoder is normalized
+ if (p->dicPos == limit)
+ {
+ LzmaDec_TryDummy() was called before to exclude LITERAL and MATCH-REP cases.
+ So first symbol can be only MATCH-NON-REP. And if that MATCH-NON-REP symbol
+ is not END_OF_PAYALOAD_MARKER, then function returns error code.
+ }
+
+Processing:
+ first LZMA symbol will be decoded in any case
+ All checks for limits are at the end of main loop,
+ It will decode new LZMA-symbols while (p->buf < bufLimit && dicPos < limit),
+ RangeCoder is still without last normalization when (p->buf < bufLimit) is being checked.
+
+Out:
+ RangeCoder is normalized
+ Result:
+ SZ_OK - OK
+ SZ_ERROR_DATA - Error
+ p->remainLen:
+ < kMatchSpecLenStart : normal remain
+ = kMatchSpecLenStart : finished
+*/
+
+
+#ifdef _LZMA_DEC_OPT
+
+int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit);
+
+#else
+
+static
+int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
+{
+ CLzmaProb *probs = GET_PROBS;
+ unsigned state = (unsigned)p->state;
+ UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3];
+ unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1;
+ unsigned lc = p->prop.lc;
+ unsigned lpMask = ((unsigned)0x100 << p->prop.lp) - ((unsigned)0x100 >> lc);
+
+ Byte *dic = p->dic;
+ SizeT dicBufSize = p->dicBufSize;
+ SizeT dicPos = p->dicPos;
+
+ UInt32 processedPos = p->processedPos;
+ UInt32 checkDicSize = p->checkDicSize;
+ unsigned len = 0;
+
+ const Byte *buf = p->buf;
+ UInt32 range = p->range;
+ UInt32 code = p->code;
+
+ do
+ {
+ CLzmaProb *prob;
+ UInt32 bound;
+ unsigned ttt;
+ unsigned posState = CALC_POS_STATE(processedPos, pbMask);
+
+ prob = probs + IsMatch + COMBINED_PS_STATE;
+ IF_BIT_0(prob)
+ {
+ unsigned symbol;
+ UPDATE_0(prob);
+ prob = probs + Literal;
+ if (processedPos != 0 || checkDicSize != 0)
+ prob += (UInt32)3 * ((((processedPos << 8) + dic[(dicPos == 0 ? dicBufSize : dicPos) - 1]) & lpMask) << lc);
+ processedPos++;
+
+ if (state < kNumLitStates)
+ {
+ state -= (state < 4) ? state : 3;
+ symbol = 1;
+ #ifdef _LZMA_SIZE_OPT
+ do { NORMAL_LITER_DEC } while (symbol < 0x100);
+ #else
+ NORMAL_LITER_DEC
+ NORMAL_LITER_DEC
+ NORMAL_LITER_DEC
+ NORMAL_LITER_DEC
+ NORMAL_LITER_DEC
+ NORMAL_LITER_DEC
+ NORMAL_LITER_DEC
+ NORMAL_LITER_DEC
+ #endif
+ }
+ else
+ {
+ unsigned matchByte = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)];
+ unsigned offs = 0x100;
+ state -= (state < 10) ? 3 : 6;
+ symbol = 1;
+ #ifdef _LZMA_SIZE_OPT
+ do
+ {
+ unsigned bit;
+ CLzmaProb *probLit;
+ MATCHED_LITER_DEC
+ }
+ while (symbol < 0x100);
+ #else
+ {
+ unsigned bit;
+ CLzmaProb *probLit;
+ MATCHED_LITER_DEC
+ MATCHED_LITER_DEC
+ MATCHED_LITER_DEC
+ MATCHED_LITER_DEC
+ MATCHED_LITER_DEC
+ MATCHED_LITER_DEC
+ MATCHED_LITER_DEC
+ MATCHED_LITER_DEC
+ }
+ #endif
+ }
+
+ dic[dicPos++] = (Byte)symbol;
+ continue;
+ }
+
+ {
+ UPDATE_1(prob);
+ prob = probs + IsRep + state;
+ IF_BIT_0(prob)
+ {
+ UPDATE_0(prob);
+ state += kNumStates;
+ prob = probs + LenCoder;
+ }
+ else
+ {
+ UPDATE_1(prob);
+ /*
+ // that case was checked before with kBadRepCode
+ if (checkDicSize == 0 && processedPos == 0)
+ return SZ_ERROR_DATA;
+ */
+ prob = probs + IsRepG0 + state;
+ IF_BIT_0(prob)
+ {
+ UPDATE_0(prob);
+ prob = probs + IsRep0Long + COMBINED_PS_STATE;
+ IF_BIT_0(prob)
+ {
+ UPDATE_0(prob);
+ dic[dicPos] = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)];
+ dicPos++;
+ processedPos++;
+ state = state < kNumLitStates ? 9 : 11;
+ continue;
+ }
+ UPDATE_1(prob);
+ }
+ else
+ {
+ UInt32 distance;
+ UPDATE_1(prob);
+ prob = probs + IsRepG1 + state;
+ IF_BIT_0(prob)
+ {
+ UPDATE_0(prob);
+ distance = rep1;
+ }
+ else
+ {
+ UPDATE_1(prob);
+ prob = probs + IsRepG2 + state;
+ IF_BIT_0(prob)
+ {
+ UPDATE_0(prob);
+ distance = rep2;
+ }
+ else
+ {
+ UPDATE_1(prob);
+ distance = rep3;
+ rep3 = rep2;
+ }
+ rep2 = rep1;
+ }
+ rep1 = rep0;
+ rep0 = distance;
+ }
+ state = state < kNumLitStates ? 8 : 11;
+ prob = probs + RepLenCoder;
+ }
+
+ #ifdef _LZMA_SIZE_OPT
+ {
+ unsigned lim, offset;
+ CLzmaProb *probLen = prob + LenChoice;
+ IF_BIT_0(probLen)
+ {
+ UPDATE_0(probLen);
+ probLen = prob + LenLow + GET_LEN_STATE;
+ offset = 0;
+ lim = (1 << kLenNumLowBits);
+ }
+ else
+ {
+ UPDATE_1(probLen);
+ probLen = prob + LenChoice2;
+ IF_BIT_0(probLen)
+ {
+ UPDATE_0(probLen);
+ probLen = prob + LenLow + GET_LEN_STATE + (1 << kLenNumLowBits);
+ offset = kLenNumLowSymbols;
+ lim = (1 << kLenNumLowBits);
+ }
+ else
+ {
+ UPDATE_1(probLen);
+ probLen = prob + LenHigh;
+ offset = kLenNumLowSymbols * 2;
+ lim = (1 << kLenNumHighBits);
+ }
+ }
+ TREE_DECODE(probLen, lim, len);
+ len += offset;
+ }
+ #else
+ {
+ CLzmaProb *probLen = prob + LenChoice;
+ IF_BIT_0(probLen)
+ {
+ UPDATE_0(probLen);
+ probLen = prob + LenLow + GET_LEN_STATE;
+ len = 1;
+ TREE_GET_BIT(probLen, len);
+ TREE_GET_BIT(probLen, len);
+ TREE_GET_BIT(probLen, len);
+ len -= 8;
+ }
+ else
+ {
+ UPDATE_1(probLen);
+ probLen = prob + LenChoice2;
+ IF_BIT_0(probLen)
+ {
+ UPDATE_0(probLen);
+ probLen = prob + LenLow + GET_LEN_STATE + (1 << kLenNumLowBits);
+ len = 1;
+ TREE_GET_BIT(probLen, len);
+ TREE_GET_BIT(probLen, len);
+ TREE_GET_BIT(probLen, len);
+ }
+ else
+ {
+ UPDATE_1(probLen);
+ probLen = prob + LenHigh;
+ TREE_DECODE(probLen, (1 << kLenNumHighBits), len);
+ len += kLenNumLowSymbols * 2;
+ }
+ }
+ }
+ #endif
+
+ if (state >= kNumStates)
+ {
+ UInt32 distance;
+ prob = probs + PosSlot +
+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits);
+ TREE_6_DECODE(prob, distance);
+ if (distance >= kStartPosModelIndex)
+ {
+ unsigned posSlot = (unsigned)distance;
+ unsigned numDirectBits = (unsigned)(((distance >> 1) - 1));
+ distance = (2 | (distance & 1));
+ if (posSlot < kEndPosModelIndex)
+ {
+ distance <<= numDirectBits;
+ prob = probs + SpecPos;
+ {
+ UInt32 m = 1;
+ distance++;
+ do
+ {
+ REV_BIT_VAR(prob, distance, m);
+ }
+ while (--numDirectBits);
+ distance -= m;
+ }
+ }
+ else
+ {
+ numDirectBits -= kNumAlignBits;
+ do
+ {
+ NORMALIZE
+ range >>= 1;
+
+ {
+ UInt32 t;
+ code -= range;
+ t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */
+ distance = (distance << 1) + (t + 1);
+ code += range & t;
+ }
+ /*
+ distance <<= 1;
+ if (code >= range)
+ {
+ code -= range;
+ distance |= 1;
+ }
+ */
+ }
+ while (--numDirectBits);
+ prob = probs + Align;
+ distance <<= kNumAlignBits;
+ {
+ unsigned i = 1;
+ REV_BIT_CONST(prob, i, 1);
+ REV_BIT_CONST(prob, i, 2);
+ REV_BIT_CONST(prob, i, 4);
+ REV_BIT_LAST (prob, i, 8);
+ distance |= i;
+ }
+ if (distance == (UInt32)0xFFFFFFFF)
+ {
+ len = kMatchSpecLenStart;
+ state -= kNumStates;
+ break;
+ }
+ }
+ }
+
+ rep3 = rep2;
+ rep2 = rep1;
+ rep1 = rep0;
+ rep0 = distance + 1;
+ state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
+ if (distance >= (checkDicSize == 0 ? processedPos: checkDicSize))
+ {
+ p->dicPos = dicPos;
+ return SZ_ERROR_DATA;
+ }
+ }
+
+ len += kMatchMinLen;
+
+ {
+ SizeT rem;
+ unsigned curLen;
+ SizeT pos;
+
+ if ((rem = limit - dicPos) == 0)
+ {
+ p->dicPos = dicPos;
+ return SZ_ERROR_DATA;
+ }
+
+ curLen = ((rem < len) ? (unsigned)rem : len);
+ pos = dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0);
+
+ processedPos += curLen;
+
+ len -= curLen;
+ if (curLen <= dicBufSize - pos)
+ {
+ Byte *dest = dic + dicPos;
+ ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos;
+ const Byte *lim = dest + curLen;
+ dicPos += curLen;
+ do
+ *(dest) = (Byte)*(dest + src);
+ while (++dest != lim);
+ }
+ else
+ {
+ do
+ {
+ dic[dicPos++] = dic[pos];
+ if (++pos == dicBufSize)
+ pos = 0;
+ }
+ while (--curLen != 0);
+ }
+ }
+ }
+ }
+ while (dicPos < limit && buf < bufLimit);
+
+ NORMALIZE;
+
+ p->buf = buf;
+ p->range = range;
+ p->code = code;
+ p->remainLen = len;
+ p->dicPos = dicPos;
+ p->processedPos = processedPos;
+ p->reps[0] = rep0;
+ p->reps[1] = rep1;
+ p->reps[2] = rep2;
+ p->reps[3] = rep3;
+ p->state = state;
+
+ return SZ_OK;
+}
+#endif
+
+static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
+{
+ if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart)
+ {
+ Byte *dic = p->dic;
+ SizeT dicPos = p->dicPos;
+ SizeT dicBufSize = p->dicBufSize;
+ unsigned len = (unsigned)p->remainLen;
+ SizeT rep0 = p->reps[0]; /* we use SizeT to avoid the BUG of VC14 for AMD64 */
+ SizeT rem = limit - dicPos;
+ if (rem < len)
+ len = (unsigned)(rem);
+
+ if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len)
+ p->checkDicSize = p->prop.dicSize;
+
+ p->processedPos += len;
+ p->remainLen -= len;
+ while (len != 0)
+ {
+ len--;
+ dic[dicPos] = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)];
+ dicPos++;
+ }
+ p->dicPos = dicPos;
+ }
+}
+
+
+#define kRange0 0xFFFFFFFF
+#define kBound0 ((kRange0 >> kNumBitModelTotalBits) << (kNumBitModelTotalBits - 1))
+#define kBadRepCode (kBound0 + (((kRange0 - kBound0) >> kNumBitModelTotalBits) << (kNumBitModelTotalBits - 1)))
+#if kBadRepCode != (0xC0000000 - 0x400)
+ #error Stop_Compiling_Bad_LZMA_Check
+#endif
+
+static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
+{
+ do
+ {
+ SizeT limit2 = limit;
+ if (p->checkDicSize == 0)
+ {
+ UInt32 rem = p->prop.dicSize - p->processedPos;
+ if (limit - p->dicPos > rem)
+ limit2 = p->dicPos + rem;
+
+ if (p->processedPos == 0)
+ if (p->code >= kBadRepCode)
+ return SZ_ERROR_DATA;
+ }
+
+ RINOK(LZMA_DECODE_REAL(p, limit2, bufLimit));
+
+ if (p->checkDicSize == 0 && p->processedPos >= p->prop.dicSize)
+ p->checkDicSize = p->prop.dicSize;
+
+ LzmaDec_WriteRem(p, limit);
+ }
+ while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart);
+
+ return 0;
+}
+
+typedef enum
+{
+ DUMMY_ERROR, /* unexpected end of input stream */
+ DUMMY_LIT,
+ DUMMY_MATCH,
+ DUMMY_REP
+} ELzmaDummy;
+
+static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize)
+{
+ UInt32 range = p->range;
+ UInt32 code = p->code;
+ const Byte *bufLimit = buf + inSize;
+ const CLzmaProb *probs = GET_PROBS;
+ unsigned state = (unsigned)p->state;
+ ELzmaDummy res;
+
+ {
+ const CLzmaProb *prob;
+ UInt32 bound;
+ unsigned ttt;
+ unsigned posState = CALC_POS_STATE(p->processedPos, (1 << p->prop.pb) - 1);
+
+ prob = probs + IsMatch + COMBINED_PS_STATE;
+ IF_BIT_0_CHECK(prob)
+ {
+ UPDATE_0_CHECK
+
+ /* if (bufLimit - buf >= 7) return DUMMY_LIT; */
+
+ prob = probs + Literal;
+ if (p->checkDicSize != 0 || p->processedPos != 0)
+ prob += ((UInt32)LZMA_LIT_SIZE *
+ ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) +
+ (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc))));
+
+ if (state < kNumLitStates)
+ {
+ unsigned symbol = 1;
+ do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100);
+ }
+ else
+ {
+ unsigned matchByte = p->dic[p->dicPos - p->reps[0] +
+ (p->dicPos < p->reps[0] ? p->dicBufSize : 0)];
+ unsigned offs = 0x100;
+ unsigned symbol = 1;
+ do
+ {
+ unsigned bit;
+ const CLzmaProb *probLit;
+ matchByte += matchByte;
+ bit = offs;
+ offs &= matchByte;
+ probLit = prob + (offs + bit + symbol);
+ GET_BIT2_CHECK(probLit, symbol, offs ^= bit; , ; )
+ }
+ while (symbol < 0x100);
+ }
+ res = DUMMY_LIT;
+ }
+ else
+ {
+ unsigned len;
+ UPDATE_1_CHECK;
+
+ prob = probs + IsRep + state;
+ IF_BIT_0_CHECK(prob)
+ {
+ UPDATE_0_CHECK;
+ state = 0;
+ prob = probs + LenCoder;
+ res = DUMMY_MATCH;
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ res = DUMMY_REP;
+ prob = probs + IsRepG0 + state;
+ IF_BIT_0_CHECK(prob)
+ {
+ UPDATE_0_CHECK;
+ prob = probs + IsRep0Long + COMBINED_PS_STATE;
+ IF_BIT_0_CHECK(prob)
+ {
+ UPDATE_0_CHECK;
+ NORMALIZE_CHECK;
+ return DUMMY_REP;
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ }
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ prob = probs + IsRepG1 + state;
+ IF_BIT_0_CHECK(prob)
+ {
+ UPDATE_0_CHECK;
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ prob = probs + IsRepG2 + state;
+ IF_BIT_0_CHECK(prob)
+ {
+ UPDATE_0_CHECK;
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ }
+ }
+ }
+ state = kNumStates;
+ prob = probs + RepLenCoder;
+ }
+ {
+ unsigned limit, offset;
+ const CLzmaProb *probLen = prob + LenChoice;
+ IF_BIT_0_CHECK(probLen)
+ {
+ UPDATE_0_CHECK;
+ probLen = prob + LenLow + GET_LEN_STATE;
+ offset = 0;
+ limit = 1 << kLenNumLowBits;
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ probLen = prob + LenChoice2;
+ IF_BIT_0_CHECK(probLen)
+ {
+ UPDATE_0_CHECK;
+ probLen = prob + LenLow + GET_LEN_STATE + (1 << kLenNumLowBits);
+ offset = kLenNumLowSymbols;
+ limit = 1 << kLenNumLowBits;
+ }
+ else
+ {
+ UPDATE_1_CHECK;
+ probLen = prob + LenHigh;
+ offset = kLenNumLowSymbols * 2;
+ limit = 1 << kLenNumHighBits;
+ }
+ }
+ TREE_DECODE_CHECK(probLen, limit, len);
+ len += offset;
+ }
+
+ if (state < 4)
+ {
+ unsigned posSlot;
+ prob = probs + PosSlot +
+ ((len < kNumLenToPosStates - 1 ? len : kNumLenToPosStates - 1) <<
+ kNumPosSlotBits);
+ TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot);
+ if (posSlot >= kStartPosModelIndex)
+ {
+ unsigned numDirectBits = ((posSlot >> 1) - 1);
+
+ /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */
+
+ if (posSlot < kEndPosModelIndex)
+ {
+ prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits);
+ }
+ else
+ {
+ numDirectBits -= kNumAlignBits;
+ do
+ {
+ NORMALIZE_CHECK
+ range >>= 1;
+ code -= range & (((code - range) >> 31) - 1);
+ /* if (code >= range) code -= range; */
+ }
+ while (--numDirectBits);
+ prob = probs + Align;
+ numDirectBits = kNumAlignBits;
+ }
+ {
+ unsigned i = 1;
+ unsigned m = 1;
+ do
+ {
+ REV_BIT_CHECK(prob, i, m);
+ }
+ while (--numDirectBits);
+ }
+ }
+ }
+ }
+ }
+ NORMALIZE_CHECK;
+ return res;
+}
+
+
+void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
+{
+ p->remainLen = kMatchSpecLenStart + 1;
+ p->tempBufSize = 0;
+
+ if (initDic)
+ {
+ p->processedPos = 0;
+ p->checkDicSize = 0;
+ p->remainLen = kMatchSpecLenStart + 2;
+ }
+ if (initState)
+ p->remainLen = kMatchSpecLenStart + 2;
+}
+
+void LzmaDec_Init(CLzmaDec *p)
+{
+ p->dicPos = 0;
+ LzmaDec_InitDicAndState(p, True, True);
+}
+
+
+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
+ ELzmaFinishMode finishMode, ELzmaStatus *status)
+{
+ SizeT inSize = *srcLen;
+ (*srcLen) = 0;
+
+ *status = LZMA_STATUS_NOT_SPECIFIED;
+
+ if (p->remainLen > kMatchSpecLenStart)
+ {
+ for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--)
+ p->tempBuf[p->tempBufSize++] = *src++;
+ if (p->tempBufSize != 0 && p->tempBuf[0] != 0)
+ return SZ_ERROR_DATA;
+ if (p->tempBufSize < RC_INIT_SIZE)
+ {
+ *status = LZMA_STATUS_NEEDS_MORE_INPUT;
+ return SZ_OK;
+ }
+ p->code =
+ ((UInt32)p->tempBuf[1] << 24)
+ | ((UInt32)p->tempBuf[2] << 16)
+ | ((UInt32)p->tempBuf[3] << 8)
+ | ((UInt32)p->tempBuf[4]);
+ p->range = 0xFFFFFFFF;
+ p->tempBufSize = 0;
+
+ if (p->remainLen > kMatchSpecLenStart + 1)
+ {
+ SizeT numProbs = LzmaProps_GetNumProbs(&p->prop);
+ SizeT i;
+ CLzmaProb *probs = p->probs;
+ for (i = 0; i < numProbs; i++)
+ probs[i] = kBitModelTotal >> 1;
+ p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1;
+ p->state = 0;
+ }
+
+ p->remainLen = 0;
+ }
+
+ LzmaDec_WriteRem(p, dicLimit);
+
+ while (p->remainLen != kMatchSpecLenStart)
+ {
+ int checkEndMarkNow = 0;
+
+ if (p->dicPos >= dicLimit)
+ {
+ if (p->remainLen == 0 && p->code == 0)
+ {
+ *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK;
+ return SZ_OK;
+ }
+ if (finishMode == LZMA_FINISH_ANY)
+ {
+ *status = LZMA_STATUS_NOT_FINISHED;
+ return SZ_OK;
+ }
+ if (p->remainLen != 0)
+ {
+ *status = LZMA_STATUS_NOT_FINISHED;
+ return SZ_ERROR_DATA;
+ }
+ checkEndMarkNow = 1;
+ }
+
+ if (p->tempBufSize == 0)
+ {
+ SizeT processed;
+ const Byte *bufLimit;
+ if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
+ {
+ int dummyRes = LzmaDec_TryDummy(p, src, inSize);
+ if (dummyRes == DUMMY_ERROR)
+ {
+ memcpy(p->tempBuf, src, inSize);
+ p->tempBufSize = (unsigned)inSize;
+ (*srcLen) += inSize;
+ *status = LZMA_STATUS_NEEDS_MORE_INPUT;
+ return SZ_OK;
+ }
+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
+ {
+ *status = LZMA_STATUS_NOT_FINISHED;
+ return SZ_ERROR_DATA;
+ }
+ bufLimit = src;
+ }
+ else
+ bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX;
+ p->buf = src;
+ if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0)
+ return SZ_ERROR_DATA;
+ processed = (SizeT)(p->buf - src);
+ (*srcLen) += processed;
+ src += processed;
+ inSize -= processed;
+ }
+ else
+ {
+ unsigned rem = p->tempBufSize, lookAhead = 0;
+ while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize)
+ p->tempBuf[rem++] = src[lookAhead++];
+ p->tempBufSize = rem;
+ if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
+ {
+ int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem);
+ if (dummyRes == DUMMY_ERROR)
+ {
+ (*srcLen) += lookAhead;
+ *status = LZMA_STATUS_NEEDS_MORE_INPUT;
+ return SZ_OK;
+ }
+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
+ {
+ *status = LZMA_STATUS_NOT_FINISHED;
+ return SZ_ERROR_DATA;
+ }
+ }
+ p->buf = p->tempBuf;
+ if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0)
+ return SZ_ERROR_DATA;
+
+ {
+ unsigned kkk = (unsigned)(p->buf - p->tempBuf);
+ if (rem < kkk)
+ return SZ_ERROR_FAIL; /* some internal error */
+ rem -= kkk;
+ if (lookAhead < rem)
+ return SZ_ERROR_FAIL; /* some internal error */
+ lookAhead -= rem;
+ }
+ (*srcLen) += lookAhead;
+ src += lookAhead;
+ inSize -= lookAhead;
+ p->tempBufSize = 0;
+ }
+ }
+
+ if (p->code != 0)
+ return SZ_ERROR_DATA;
+ *status = LZMA_STATUS_FINISHED_WITH_MARK;
+ return SZ_OK;
+}
+
+
+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
+{
+ SizeT outSize = *destLen;
+ SizeT inSize = *srcLen;
+ *srcLen = *destLen = 0;
+ for (;;)
+ {
+ SizeT inSizeCur = inSize, outSizeCur, dicPos;
+ ELzmaFinishMode curFinishMode;
+ SRes res;
+ if (p->dicPos == p->dicBufSize)
+ p->dicPos = 0;
+ dicPos = p->dicPos;
+ if (outSize > p->dicBufSize - dicPos)
+ {
+ outSizeCur = p->dicBufSize;
+ curFinishMode = LZMA_FINISH_ANY;
+ }
+ else
+ {
+ outSizeCur = dicPos + outSize;
+ curFinishMode = finishMode;
+ }
+
+ res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status);
+ src += inSizeCur;
+ inSize -= inSizeCur;
+ *srcLen += inSizeCur;
+ outSizeCur = p->dicPos - dicPos;
+ memcpy(dest, p->dic + dicPos, outSizeCur);
+ dest += outSizeCur;
+ outSize -= outSizeCur;
+ *destLen += outSizeCur;
+ if (res != 0)
+ return res;
+ if (outSizeCur == 0 || outSize == 0)
+ return SZ_OK;
+ }
+}
+
+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAllocPtr alloc)
+{
+ ISzAlloc_Free(alloc, p->probs);
+ p->probs = NULL;
+}
+
+static void LzmaDec_FreeDict(CLzmaDec *p, ISzAllocPtr alloc)
+{
+ ISzAlloc_Free(alloc, p->dic);
+ p->dic = NULL;
+}
+
+void LzmaDec_Free(CLzmaDec *p, ISzAllocPtr alloc)
+{
+ LzmaDec_FreeProbs(p, alloc);
+ LzmaDec_FreeDict(p, alloc);
+}
+
+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
+{
+ UInt32 dicSize;
+ Byte d;
+
+ if (size < LZMA_PROPS_SIZE)
+ return SZ_ERROR_UNSUPPORTED;
+ else
+ dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24);
+
+ if (dicSize < LZMA_DIC_MIN)
+ dicSize = LZMA_DIC_MIN;
+ p->dicSize = dicSize;
+
+ d = data[0];
+ if (d >= (9 * 5 * 5))
+ return SZ_ERROR_UNSUPPORTED;
+
+ p->lc = (Byte)(d % 9);
+ d /= 9;
+ p->pb = (Byte)(d / 5);
+ p->lp = (Byte)(d % 5);
+
+ return SZ_OK;
+}
+
+static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAllocPtr alloc)
+{
+ UInt32 numProbs = LzmaProps_GetNumProbs(propNew);
+ if (!p->probs || numProbs != p->numProbs)
+ {
+ LzmaDec_FreeProbs(p, alloc);
+ p->probs = (CLzmaProb *)ISzAlloc_Alloc(alloc, numProbs * sizeof(CLzmaProb));
+ if (!p->probs)
+ return SZ_ERROR_MEM;
+ p->probs_1664 = p->probs + 1664;
+ p->numProbs = numProbs;
+ }
+ return SZ_OK;
+}
+
+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc)
+{
+ CLzmaProps propNew;
+ RINOK(LzmaProps_Decode(&propNew, props, propsSize));
+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
+ p->prop = propNew;
+ return SZ_OK;
+}
+
+SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc)
+{
+ CLzmaProps propNew;
+ SizeT dicBufSize;
+ RINOK(LzmaProps_Decode(&propNew, props, propsSize));
+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
+
+ {
+ UInt32 dictSize = propNew.dicSize;
+ SizeT mask = ((UInt32)1 << 12) - 1;
+ if (dictSize >= ((UInt32)1 << 30)) mask = ((UInt32)1 << 22) - 1;
+ else if (dictSize >= ((UInt32)1 << 22)) mask = ((UInt32)1 << 20) - 1;;
+ dicBufSize = ((SizeT)dictSize + mask) & ~mask;
+ if (dicBufSize < dictSize)
+ dicBufSize = dictSize;
+ }
+
+ if (!p->dic || dicBufSize != p->dicBufSize)
+ {
+ LzmaDec_FreeDict(p, alloc);
+ p->dic = (Byte *)ISzAlloc_Alloc(alloc, dicBufSize);
+ if (!p->dic)
+ {
+ LzmaDec_FreeProbs(p, alloc);
+ return SZ_ERROR_MEM;
+ }
+ }
+ p->dicBufSize = dicBufSize;
+ p->prop = propNew;
+ return SZ_OK;
+}
+
+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
+ ELzmaStatus *status, ISzAllocPtr alloc)
+{
+ CLzmaDec p;
+ SRes res;
+ SizeT outSize = *destLen, inSize = *srcLen;
+ *destLen = *srcLen = 0;
+ *status = LZMA_STATUS_NOT_SPECIFIED;
+ if (inSize < RC_INIT_SIZE)
+ return SZ_ERROR_INPUT_EOF;
+ LzmaDec_Construct(&p);
+ RINOK(LzmaDec_AllocateProbs(&p, propData, propSize, alloc));
+ p.dic = dest;
+ p.dicBufSize = outSize;
+ LzmaDec_Init(&p);
+ *srcLen = inSize;
+ res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status);
+ *destLen = p.dicPos;
+ if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT)
+ res = SZ_ERROR_INPUT_EOF;
+ LzmaDec_FreeProbs(&p, alloc);
+ return res;
+}
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.h
new file mode 100644
index 000000000..28ce60c3e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.h
@@ -0,0 +1,234 @@
+/* LzmaDec.h -- LZMA Decoder
+2018-04-21 : Igor Pavlov : Public domain */
+
+#ifndef __LZMA_DEC_H
+#define __LZMA_DEC_H
+
+#include "7zTypes.h"
+
+EXTERN_C_BEGIN
+
+/* #define _LZMA_PROB32 */
+/* _LZMA_PROB32 can increase the speed on some CPUs,
+ but memory usage for CLzmaDec::probs will be doubled in that case */
+
+typedef
+#ifdef _LZMA_PROB32
+ UInt32
+#else
+ UInt16
+#endif
+ CLzmaProb;
+
+
+/* ---------- LZMA Properties ---------- */
+
+#define LZMA_PROPS_SIZE 5
+
+typedef struct _CLzmaProps
+{
+ Byte lc;
+ Byte lp;
+ Byte pb;
+ Byte _pad_;
+ UInt32 dicSize;
+} CLzmaProps;
+
+/* LzmaProps_Decode - decodes properties
+Returns:
+ SZ_OK
+ SZ_ERROR_UNSUPPORTED - Unsupported properties
+*/
+
+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
+
+
+/* ---------- LZMA Decoder state ---------- */
+
+/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
+ Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
+
+#define LZMA_REQUIRED_INPUT_MAX 20
+
+typedef struct
+{
+ /* Don't change this structure. ASM code can use it. */
+ CLzmaProps prop;
+ CLzmaProb *probs;
+ CLzmaProb *probs_1664;
+ Byte *dic;
+ SizeT dicBufSize;
+ SizeT dicPos;
+ const Byte *buf;
+ UInt32 range;
+ UInt32 code;
+ UInt32 processedPos;
+ UInt32 checkDicSize;
+ UInt32 reps[4];
+ UInt32 state;
+ UInt32 remainLen;
+
+ UInt32 numProbs;
+ unsigned tempBufSize;
+ Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
+} CLzmaDec;
+
+#define LzmaDec_Construct(p) { (p)->dic = NULL; (p)->probs = NULL; }
+
+void LzmaDec_Init(CLzmaDec *p);
+
+/* There are two types of LZMA streams:
+ - Stream with end mark. That end mark adds about 6 bytes to compressed size.
+ - Stream without end mark. You must know exact uncompressed size to decompress such stream. */
+
+typedef enum
+{
+ LZMA_FINISH_ANY, /* finish at any point */
+ LZMA_FINISH_END /* block must be finished at the end */
+} ELzmaFinishMode;
+
+/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!!
+
+ You must use LZMA_FINISH_END, when you know that current output buffer
+ covers last bytes of block. In other cases you must use LZMA_FINISH_ANY.
+
+ If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK,
+ and output value of destLen will be less than output buffer size limit.
+ You can check status result also.
+
+ You can use multiple checks to test data integrity after full decompression:
+ 1) Check Result and "status" variable.
+ 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
+ 3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
+ You must use correct finish mode in that case. */
+
+typedef enum
+{
+ LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */
+ LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */
+ LZMA_STATUS_NOT_FINISHED, /* stream was not finished */
+ LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */
+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */
+} ELzmaStatus;
+
+/* ELzmaStatus is used only as output value for function call */
+
+
+/* ---------- Interfaces ---------- */
+
+/* There are 3 levels of interfaces:
+ 1) Dictionary Interface
+ 2) Buffer Interface
+ 3) One Call Interface
+ You can select any of these interfaces, but don't mix functions from different
+ groups for same object. */
+
+
+/* There are two variants to allocate state for Dictionary Interface:
+ 1) LzmaDec_Allocate / LzmaDec_Free
+ 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
+ You can use variant 2, if you set dictionary buffer manually.
+ For Buffer Interface you must always use variant 1.
+
+LzmaDec_Allocate* can return:
+ SZ_OK
+ SZ_ERROR_MEM - Memory allocation error
+ SZ_ERROR_UNSUPPORTED - Unsupported properties
+*/
+
+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc);
+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAllocPtr alloc);
+
+SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc);
+void LzmaDec_Free(CLzmaDec *p, ISzAllocPtr alloc);
+
+/* ---------- Dictionary Interface ---------- */
+
+/* You can use it, if you want to eliminate the overhead for data copying from
+ dictionary to some other external buffer.
+ You must work with CLzmaDec variables directly in this interface.
+
+ STEPS:
+ LzmaDec_Construct()
+ LzmaDec_Allocate()
+ for (each new stream)
+ {
+ LzmaDec_Init()
+ while (it needs more decompression)
+ {
+ LzmaDec_DecodeToDic()
+ use data from CLzmaDec::dic and update CLzmaDec::dicPos
+ }
+ }
+ LzmaDec_Free()
+*/
+
+/* LzmaDec_DecodeToDic
+
+ The decoding to internal dictionary buffer (CLzmaDec::dic).
+ You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
+
+finishMode:
+ It has meaning only if the decoding reaches output limit (dicLimit).
+ LZMA_FINISH_ANY - Decode just dicLimit bytes.
+ LZMA_FINISH_END - Stream must be finished after dicLimit.
+
+Returns:
+ SZ_OK
+ status:
+ LZMA_STATUS_FINISHED_WITH_MARK
+ LZMA_STATUS_NOT_FINISHED
+ LZMA_STATUS_NEEDS_MORE_INPUT
+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
+ SZ_ERROR_DATA - Data error
+*/
+
+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
+ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
+
+
+/* ---------- Buffer Interface ---------- */
+
+/* It's zlib-like interface.
+ See LzmaDec_DecodeToDic description for information about STEPS and return results,
+ but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
+ to work with CLzmaDec variables manually.
+
+finishMode:
+ It has meaning only if the decoding reaches output limit (*destLen).
+ LZMA_FINISH_ANY - Decode just destLen bytes.
+ LZMA_FINISH_END - Stream must be finished after (*destLen).
+*/
+
+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
+ const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
+
+
+/* ---------- One Call Interface ---------- */
+
+/* LzmaDecode
+
+finishMode:
+ It has meaning only if the decoding reaches output limit (*destLen).
+ LZMA_FINISH_ANY - Decode just destLen bytes.
+ LZMA_FINISH_END - Stream must be finished after (*destLen).
+
+Returns:
+ SZ_OK
+ status:
+ LZMA_STATUS_FINISHED_WITH_MARK
+ LZMA_STATUS_NOT_FINISHED
+ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
+ SZ_ERROR_DATA - Data error
+ SZ_ERROR_MEM - Memory allocation error
+ SZ_ERROR_UNSUPPORTED - Unsupported properties
+ SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
+*/
+
+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
+ ELzmaStatus *status, ISzAllocPtr alloc);
+
+EXTERN_C_END
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
new file mode 100644
index 000000000..e281716fe
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
@@ -0,0 +1,2789 @@
+/* LzmaEnc.c -- LZMA Encoder
+2018-04-29 : Igor Pavlov : Public domain */
+
+#include "Precomp.h"
+
+#include <string.h>
+
+/* #define SHOW_STAT */
+/* #define SHOW_STAT2 */
+
+#if defined(SHOW_STAT) || defined(SHOW_STAT2)
+#include <stdio.h>
+#endif
+
+#include "LzmaEnc.h"
+
+#include "LzFind.h"
+#ifndef _7ZIP_ST
+#include "LzFindMt.h"
+#endif
+
+#ifdef SHOW_STAT
+static unsigned g_STAT_OFFSET = 0;
+#endif
+
+#define kLzmaMaxHistorySize ((UInt32)3 << 29)
+/* #define kLzmaMaxHistorySize ((UInt32)7 << 29) */
+
+#define kNumTopBits 24
+#define kTopValue ((UInt32)1 << kNumTopBits)
+
+#define kNumBitModelTotalBits 11
+#define kBitModelTotal (1 << kNumBitModelTotalBits)
+#define kNumMoveBits 5
+#define kProbInitValue (kBitModelTotal >> 1)
+
+#define kNumMoveReducingBits 4
+#define kNumBitPriceShiftBits 4
+#define kBitPrice (1 << kNumBitPriceShiftBits)
+
+void LzmaEncProps_Init(CLzmaEncProps *p)
+{
+ p->level = 5;
+ p->dictSize = p->mc = 0;
+ p->reduceSize = (UInt64)(Int64)-1;
+ p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1;
+ p->writeEndMark = 0;
+}
+
+void LzmaEncProps_Normalize(CLzmaEncProps *p)
+{
+ int level = p->level;
+ if (level < 0) level = 5;
+ p->level = level;
+
+ if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level <= 7 ? (1 << 25) : (1 << 26)));
+ if (p->dictSize > p->reduceSize)
+ {
+ unsigned i;
+ UInt32 reduceSize = (UInt32)p->reduceSize;
+ for (i = 11; i <= 30; i++)
+ {
+ if (reduceSize <= ((UInt32)2 << i)) { p->dictSize = ((UInt32)2 << i); break; }
+ if (reduceSize <= ((UInt32)3 << i)) { p->dictSize = ((UInt32)3 << i); break; }
+ }
+ }
+
+ if (p->lc < 0) p->lc = 3;
+ if (p->lp < 0) p->lp = 0;
+ if (p->pb < 0) p->pb = 2;
+
+ if (p->algo < 0) p->algo = (level < 5 ? 0 : 1);
+ if (p->fb < 0) p->fb = (level < 7 ? 32 : 64);
+ if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1);
+ if (p->numHashBytes < 0) p->numHashBytes = 4;
+ if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1);
+
+ if (p->numThreads < 0)
+ p->numThreads =
+ #ifndef _7ZIP_ST
+ ((p->btMode && p->algo) ? 2 : 1);
+ #else
+ 1;
+ #endif
+}
+
+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
+{
+ CLzmaEncProps props = *props2;
+ LzmaEncProps_Normalize(&props);
+ return props.dictSize;
+}
+
+#if (_MSC_VER >= 1400)
+/* BSR code is fast for some new CPUs */
+/* #define LZMA_LOG_BSR */
+#endif
+
+#ifdef LZMA_LOG_BSR
+
+#define kDicLogSizeMaxCompress 32
+
+#define BSR2_RET(pos, res) { unsigned long zz; _BitScanReverse(&zz, (pos)); res = (zz + zz) + ((pos >> (zz - 1)) & 1); }
+
+static unsigned GetPosSlot1(UInt32 pos)
+{
+ unsigned res;
+ BSR2_RET(pos, res);
+ return res;
+}
+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
+#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); }
+
+#else
+
+#define kNumLogBits (9 + sizeof(size_t) / 2)
+/* #define kNumLogBits (11 + sizeof(size_t) / 8 * 3) */
+
+#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
+
+static void LzmaEnc_FastPosInit(Byte *g_FastPos)
+{
+ unsigned slot;
+ g_FastPos[0] = 0;
+ g_FastPos[1] = 1;
+ g_FastPos += 2;
+
+ for (slot = 2; slot < kNumLogBits * 2; slot++)
+ {
+ size_t k = ((size_t)1 << ((slot >> 1) - 1));
+ size_t j;
+ for (j = 0; j < k; j++)
+ g_FastPos[j] = (Byte)slot;
+ g_FastPos += k;
+ }
+}
+
+/* we can use ((limit - pos) >> 31) only if (pos < ((UInt32)1 << 31)) */
+/*
+#define BSR2_RET(pos, res) { unsigned zz = 6 + ((kNumLogBits - 1) & \
+ (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \
+ res = p->g_FastPos[pos >> zz] + (zz * 2); }
+*/
+
+/*
+#define BSR2_RET(pos, res) { unsigned zz = 6 + ((kNumLogBits - 1) & \
+ (0 - (((((UInt32)1 << (kNumLogBits)) - 1) - (pos >> 6)) >> 31))); \
+ res = p->g_FastPos[pos >> zz] + (zz * 2); }
+*/
+
+#define BSR2_RET(pos, res) { unsigned zz = (pos < (1 << (kNumLogBits + 6))) ? 6 : 6 + kNumLogBits - 1; \
+ res = p->g_FastPos[pos >> zz] + (zz * 2); }
+
+/*
+#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \
+ p->g_FastPos[pos >> 6] + 12 : \
+ p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; }
+*/
+
+#define GetPosSlot1(pos) p->g_FastPos[pos]
+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
+#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos & (kNumFullDistances - 1)]; else BSR2_RET(pos, res); }
+
+#endif
+
+
+#define LZMA_NUM_REPS 4
+
+typedef UInt16 CState;
+typedef UInt16 CExtra;
+
+typedef struct
+{
+ UInt32 price;
+ CState state;
+ CExtra extra;
+ // 0 : normal
+ // 1 : LIT : MATCH
+ // > 1 : MATCH (extra-1) : LIT : REP0 (len)
+ UInt32 len;
+ UInt32 dist;
+ UInt32 reps[LZMA_NUM_REPS];
+} COptimal;
+
+
+#define kNumOpts (1 << 12)
+#define kPackReserve (1 + kNumOpts * 2)
+
+#define kNumLenToPosStates 4
+#define kNumPosSlotBits 6
+#define kDicLogSizeMin 0
+#define kDicLogSizeMax 32
+#define kDistTableSizeMax (kDicLogSizeMax * 2)
+
+#define kNumAlignBits 4
+#define kAlignTableSize (1 << kNumAlignBits)
+#define kAlignMask (kAlignTableSize - 1)
+
+#define kStartPosModelIndex 4
+#define kEndPosModelIndex 14
+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
+
+typedef
+#ifdef _LZMA_PROB32
+ UInt32
+#else
+ UInt16
+#endif
+ CLzmaProb;
+
+#define LZMA_PB_MAX 4
+#define LZMA_LC_MAX 8
+#define LZMA_LP_MAX 4
+
+#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX)
+
+#define kLenNumLowBits 3
+#define kLenNumLowSymbols (1 << kLenNumLowBits)
+#define kLenNumHighBits 8
+#define kLenNumHighSymbols (1 << kLenNumHighBits)
+#define kLenNumSymbolsTotal (kLenNumLowSymbols * 2 + kLenNumHighSymbols)
+
+#define LZMA_MATCH_LEN_MIN 2
+#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1)
+
+#define kNumStates 12
+
+
+typedef struct
+{
+ CLzmaProb low[LZMA_NUM_PB_STATES_MAX << (kLenNumLowBits + 1)];
+ CLzmaProb high[kLenNumHighSymbols];
+} CLenEnc;
+
+
+typedef struct
+{
+ unsigned tableSize;
+ unsigned counters[LZMA_NUM_PB_STATES_MAX];
+ UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal];
+} CLenPriceEnc;
+
+
+typedef struct
+{
+ UInt32 range;
+ unsigned cache;
+ UInt64 low;
+ UInt64 cacheSize;
+ Byte *buf;
+ Byte *bufLim;
+ Byte *bufBase;
+ ISeqOutStream *outStream;
+ UInt64 processed;
+ SRes res;
+} CRangeEnc;
+
+
+typedef struct
+{
+ CLzmaProb *litProbs;
+
+ unsigned state;
+ UInt32 reps[LZMA_NUM_REPS];
+
+ CLzmaProb posAlignEncoder[1 << kNumAlignBits];
+ CLzmaProb isRep[kNumStates];
+ CLzmaProb isRepG0[kNumStates];
+ CLzmaProb isRepG1[kNumStates];
+ CLzmaProb isRepG2[kNumStates];
+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
+
+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
+ CLzmaProb posEncoders[kNumFullDistances];
+
+ CLenEnc lenProbs;
+ CLenEnc repLenProbs;
+
+} CSaveState;
+
+
+typedef UInt32 CProbPrice;
+
+
+typedef struct
+{
+ void *matchFinderObj;
+ IMatchFinder matchFinder;
+
+ unsigned optCur;
+ unsigned optEnd;
+
+ unsigned longestMatchLen;
+ unsigned numPairs;
+ UInt32 numAvail;
+
+ unsigned state;
+ unsigned numFastBytes;
+ unsigned additionalOffset;
+ UInt32 reps[LZMA_NUM_REPS];
+ unsigned lpMask, pbMask;
+ CLzmaProb *litProbs;
+ CRangeEnc rc;
+
+ UInt32 backRes;
+
+ unsigned lc, lp, pb;
+ unsigned lclp;
+
+ Bool fastMode;
+ Bool writeEndMark;
+ Bool finished;
+ Bool multiThread;
+ Bool needInit;
+
+ UInt64 nowPos64;
+
+ unsigned matchPriceCount;
+ unsigned alignPriceCount;
+
+ unsigned distTableSize;
+
+ UInt32 dictSize;
+ SRes result;
+
+ #ifndef _7ZIP_ST
+ Bool mtMode;
+ // begin of CMatchFinderMt is used in LZ thread
+ CMatchFinderMt matchFinderMt;
+ // end of CMatchFinderMt is used in BT and HASH threads
+ #endif
+
+ CMatchFinder matchFinderBase;
+
+ #ifndef _7ZIP_ST
+ Byte pad[128];
+ #endif
+
+ // LZ thread
+ CProbPrice ProbPrices[kBitModelTotal >> kNumMoveReducingBits];
+
+ UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1];
+
+ UInt32 alignPrices[kAlignTableSize];
+ UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax];
+ UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances];
+
+ CLzmaProb posAlignEncoder[1 << kNumAlignBits];
+ CLzmaProb isRep[kNumStates];
+ CLzmaProb isRepG0[kNumStates];
+ CLzmaProb isRepG1[kNumStates];
+ CLzmaProb isRepG2[kNumStates];
+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
+ CLzmaProb posEncoders[kNumFullDistances];
+
+ CLenEnc lenProbs;
+ CLenEnc repLenProbs;
+
+ #ifndef LZMA_LOG_BSR
+ Byte g_FastPos[1 << kNumLogBits];
+ #endif
+
+ CLenPriceEnc lenEnc;
+ CLenPriceEnc repLenEnc;
+
+ COptimal opt[kNumOpts];
+
+ CSaveState saveState;
+
+ #ifndef _7ZIP_ST
+ Byte pad2[128];
+ #endif
+} CLzmaEnc;
+
+
+
+#define COPY_ARR(dest, src, arr) memcpy(dest->arr, src->arr, sizeof(src->arr));
+
+void LzmaEnc_SaveState(CLzmaEncHandle pp)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ CSaveState *dest = &p->saveState;
+
+ dest->state = p->state;
+
+ dest->lenProbs = p->lenProbs;
+ dest->repLenProbs = p->repLenProbs;
+
+ COPY_ARR(dest, p, reps);
+
+ COPY_ARR(dest, p, posAlignEncoder);
+ COPY_ARR(dest, p, isRep);
+ COPY_ARR(dest, p, isRepG0);
+ COPY_ARR(dest, p, isRepG1);
+ COPY_ARR(dest, p, isRepG2);
+ COPY_ARR(dest, p, isMatch);
+ COPY_ARR(dest, p, isRep0Long);
+ COPY_ARR(dest, p, posSlotEncoder);
+ COPY_ARR(dest, p, posEncoders);
+
+ memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << p->lclp) * sizeof(CLzmaProb));
+}
+
+
+void LzmaEnc_RestoreState(CLzmaEncHandle pp)
+{
+ CLzmaEnc *dest = (CLzmaEnc *)pp;
+ const CSaveState *p = &dest->saveState;
+
+ dest->state = p->state;
+
+ dest->lenProbs = p->lenProbs;
+ dest->repLenProbs = p->repLenProbs;
+
+ COPY_ARR(dest, p, reps);
+
+ COPY_ARR(dest, p, posAlignEncoder);
+ COPY_ARR(dest, p, isRep);
+ COPY_ARR(dest, p, isRepG0);
+ COPY_ARR(dest, p, isRepG1);
+ COPY_ARR(dest, p, isRepG2);
+ COPY_ARR(dest, p, isMatch);
+ COPY_ARR(dest, p, isRep0Long);
+ COPY_ARR(dest, p, posSlotEncoder);
+ COPY_ARR(dest, p, posEncoders);
+
+ memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << dest->lclp) * sizeof(CLzmaProb));
+}
+
+
+
+SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ CLzmaEncProps props = *props2;
+ LzmaEncProps_Normalize(&props);
+
+ if (props.lc > LZMA_LC_MAX
+ || props.lp > LZMA_LP_MAX
+ || props.pb > LZMA_PB_MAX
+ || props.dictSize > ((UInt64)1 << kDicLogSizeMaxCompress)
+ || props.dictSize > kLzmaMaxHistorySize)
+ return SZ_ERROR_PARAM;
+
+ p->dictSize = props.dictSize;
+ {
+ unsigned fb = props.fb;
+ if (fb < 5)
+ fb = 5;
+ if (fb > LZMA_MATCH_LEN_MAX)
+ fb = LZMA_MATCH_LEN_MAX;
+ p->numFastBytes = fb;
+ }
+ p->lc = props.lc;
+ p->lp = props.lp;
+ p->pb = props.pb;
+ p->fastMode = (props.algo == 0);
+ p->matchFinderBase.btMode = (Byte)(props.btMode ? 1 : 0);
+ {
+ unsigned numHashBytes = 4;
+ if (props.btMode)
+ {
+ if (props.numHashBytes < 2)
+ numHashBytes = 2;
+ else if (props.numHashBytes < 4)
+ numHashBytes = props.numHashBytes;
+ }
+ p->matchFinderBase.numHashBytes = numHashBytes;
+ }
+
+ p->matchFinderBase.cutValue = props.mc;
+
+ p->writeEndMark = props.writeEndMark;
+
+ #ifndef _7ZIP_ST
+ /*
+ if (newMultiThread != _multiThread)
+ {
+ ReleaseMatchFinder();
+ _multiThread = newMultiThread;
+ }
+ */
+ p->multiThread = (props.numThreads > 1);
+ #endif
+
+ return SZ_OK;
+}
+
+
+void LzmaEnc_SetDataSize(CLzmaEncHandle pp, UInt64 expectedDataSiize)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ p->matchFinderBase.expectedDataSize = expectedDataSiize;
+}
+
+
+#define kState_Start 0
+#define kState_LitAfterMatch 4
+#define kState_LitAfterRep 5
+#define kState_MatchAfterLit 7
+#define kState_RepAfterLit 8
+
+static const Byte kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5};
+static const Byte kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
+static const Byte kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
+static const Byte kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
+
+#define IsLitState(s) ((s) < 7)
+#define GetLenToPosState2(len) (((len) < kNumLenToPosStates - 1) ? (len) : kNumLenToPosStates - 1)
+#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1)
+
+#define kInfinityPrice (1 << 30)
+
+static void RangeEnc_Construct(CRangeEnc *p)
+{
+ p->outStream = NULL;
+ p->bufBase = NULL;
+}
+
+#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize)
+#define RangeEnc_GetProcessed_sizet(p) ((size_t)(p)->processed + ((p)->buf - (p)->bufBase) + (size_t)(p)->cacheSize)
+
+#define RC_BUF_SIZE (1 << 16)
+
+static int RangeEnc_Alloc(CRangeEnc *p, ISzAllocPtr alloc)
+{
+ if (!p->bufBase)
+ {
+ p->bufBase = (Byte *)ISzAlloc_Alloc(alloc, RC_BUF_SIZE);
+ if (!p->bufBase)
+ return 0;
+ p->bufLim = p->bufBase + RC_BUF_SIZE;
+ }
+ return 1;
+}
+
+static void RangeEnc_Free(CRangeEnc *p, ISzAllocPtr alloc)
+{
+ ISzAlloc_Free(alloc, p->bufBase);
+ p->bufBase = 0;
+}
+
+static void RangeEnc_Init(CRangeEnc *p)
+{
+ /* Stream.Init(); */
+ p->range = 0xFFFFFFFF;
+ p->cache = 0;
+ p->low = 0;
+ p->cacheSize = 0;
+
+ p->buf = p->bufBase;
+
+ p->processed = 0;
+ p->res = SZ_OK;
+}
+
+MY_NO_INLINE static void RangeEnc_FlushStream(CRangeEnc *p)
+{
+ size_t num;
+ if (p->res != SZ_OK)
+ return;
+ num = p->buf - p->bufBase;
+ if (num != ISeqOutStream_Write(p->outStream, p->bufBase, num))
+ p->res = SZ_ERROR_WRITE;
+ p->processed += num;
+ p->buf = p->bufBase;
+}
+
+MY_NO_INLINE static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p)
+{
+ UInt32 low = (UInt32)p->low;
+ unsigned high = (unsigned)(p->low >> 32);
+ p->low = (UInt32)(low << 8);
+ if (low < (UInt32)0xFF000000 || high != 0)
+ {
+ {
+ Byte *buf = p->buf;
+ *buf++ = (Byte)(p->cache + high);
+ p->cache = (unsigned)(low >> 24);
+ p->buf = buf;
+ if (buf == p->bufLim)
+ RangeEnc_FlushStream(p);
+ if (p->cacheSize == 0)
+ return;
+ }
+ high += 0xFF;
+ for (;;)
+ {
+ Byte *buf = p->buf;
+ *buf++ = (Byte)(high);
+ p->buf = buf;
+ if (buf == p->bufLim)
+ RangeEnc_FlushStream(p);
+ if (--p->cacheSize == 0)
+ return;
+ }
+ }
+ p->cacheSize++;
+}
+
+static void RangeEnc_FlushData(CRangeEnc *p)
+{
+ int i;
+ for (i = 0; i < 5; i++)
+ RangeEnc_ShiftLow(p);
+}
+
+#define RC_NORM(p) if (range < kTopValue) { range <<= 8; RangeEnc_ShiftLow(p); }
+
+#define RC_BIT_PRE(p, prob) \
+ ttt = *(prob); \
+ newBound = (range >> kNumBitModelTotalBits) * ttt;
+
+// #define _LZMA_ENC_USE_BRANCH
+
+#ifdef _LZMA_ENC_USE_BRANCH
+
+#define RC_BIT(p, prob, symbol) { \
+ RC_BIT_PRE(p, prob) \
+ if (symbol == 0) { range = newBound; ttt += (kBitModelTotal - ttt) >> kNumMoveBits; } \
+ else { (p)->low += newBound; range -= newBound; ttt -= ttt >> kNumMoveBits; } \
+ *(prob) = (CLzmaProb)ttt; \
+ RC_NORM(p) \
+ }
+
+#else
+
+#define RC_BIT(p, prob, symbol) { \
+ UInt32 mask; \
+ RC_BIT_PRE(p, prob) \
+ mask = 0 - (UInt32)symbol; \
+ range &= mask; \
+ mask &= newBound; \
+ range -= mask; \
+ (p)->low += mask; \
+ mask = (UInt32)symbol - 1; \
+ range += newBound & mask; \
+ mask &= (kBitModelTotal - ((1 << kNumMoveBits) - 1)); \
+ mask += ((1 << kNumMoveBits) - 1); \
+ ttt += (Int32)(mask - ttt) >> kNumMoveBits; \
+ *(prob) = (CLzmaProb)ttt; \
+ RC_NORM(p) \
+ }
+
+#endif
+
+
+
+
+#define RC_BIT_0_BASE(p, prob) \
+ range = newBound; *(prob) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
+
+#define RC_BIT_1_BASE(p, prob) \
+ range -= newBound; (p)->low += newBound; *(prob) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); \
+
+#define RC_BIT_0(p, prob) \
+ RC_BIT_0_BASE(p, prob) \
+ RC_NORM(p)
+
+#define RC_BIT_1(p, prob) \
+ RC_BIT_1_BASE(p, prob) \
+ RC_NORM(p)
+
+static void RangeEnc_EncodeBit_0(CRangeEnc *p, CLzmaProb *prob)
+{
+ UInt32 range, ttt, newBound;
+ range = p->range;
+ RC_BIT_PRE(p, prob)
+ RC_BIT_0(p, prob)
+ p->range = range;
+}
+
+static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol)
+{
+ UInt32 range = p->range;
+ symbol |= 0x100;
+ do
+ {
+ UInt32 ttt, newBound;
+ // RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1);
+ CLzmaProb *prob = probs + (symbol >> 8);
+ UInt32 bit = (symbol >> 7) & 1;
+ symbol <<= 1;
+ RC_BIT(p, prob, bit);
+ }
+ while (symbol < 0x10000);
+ p->range = range;
+}
+
+static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte)
+{
+ UInt32 range = p->range;
+ UInt32 offs = 0x100;
+ symbol |= 0x100;
+ do
+ {
+ UInt32 ttt, newBound;
+ CLzmaProb *prob;
+ UInt32 bit;
+ matchByte <<= 1;
+ // RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1);
+ prob = probs + (offs + (matchByte & offs) + (symbol >> 8));
+ bit = (symbol >> 7) & 1;
+ symbol <<= 1;
+ offs &= ~(matchByte ^ symbol);
+ RC_BIT(p, prob, bit);
+ }
+ while (symbol < 0x10000);
+ p->range = range;
+}
+
+
+
+static void LzmaEnc_InitPriceTables(CProbPrice *ProbPrices)
+{
+ UInt32 i;
+ for (i = 0; i < (kBitModelTotal >> kNumMoveReducingBits); i++)
+ {
+ const unsigned kCyclesBits = kNumBitPriceShiftBits;
+ UInt32 w = (i << kNumMoveReducingBits) + (1 << (kNumMoveReducingBits - 1));
+ unsigned bitCount = 0;
+ unsigned j;
+ for (j = 0; j < kCyclesBits; j++)
+ {
+ w = w * w;
+ bitCount <<= 1;
+ while (w >= ((UInt32)1 << 16))
+ {
+ w >>= 1;
+ bitCount++;
+ }
+ }
+ ProbPrices[i] = (CProbPrice)((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount);
+ // printf("\n%3d: %5d", i, ProbPrices[i]);
+ }
+}
+
+
+#define GET_PRICE(prob, symbol) \
+ p->ProbPrices[((prob) ^ (unsigned)(((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
+
+#define GET_PRICEa(prob, symbol) \
+ ProbPrices[((prob) ^ (unsigned)((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
+
+#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits]
+#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
+
+#define GET_PRICEa_0(prob) ProbPrices[(prob) >> kNumMoveReducingBits]
+#define GET_PRICEa_1(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
+
+
+static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, const CProbPrice *ProbPrices)
+{
+ UInt32 price = 0;
+ symbol |= 0x100;
+ do
+ {
+ unsigned bit = symbol & 1;
+ symbol >>= 1;
+ price += GET_PRICEa(probs[symbol], bit);
+ }
+ while (symbol >= 2);
+ return price;
+}
+
+
+static UInt32 LitEnc_Matched_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, const CProbPrice *ProbPrices)
+{
+ UInt32 price = 0;
+ UInt32 offs = 0x100;
+ symbol |= 0x100;
+ do
+ {
+ matchByte <<= 1;
+ price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1);
+ symbol <<= 1;
+ offs &= ~(matchByte ^ symbol);
+ }
+ while (symbol < 0x10000);
+ return price;
+}
+
+
+static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, unsigned numBits, UInt32 symbol)
+{
+ UInt32 range = rc->range;
+ unsigned m = 1;
+ do
+ {
+ UInt32 ttt, newBound;
+ unsigned bit = symbol & 1;
+ // RangeEnc_EncodeBit(rc, probs + m, bit);
+ symbol >>= 1;
+ RC_BIT(rc, probs + m, bit);
+ m = (m << 1) | bit;
+ }
+ while (--numBits);
+ rc->range = range;
+}
+
+
+
+static void LenEnc_Init(CLenEnc *p)
+{
+ unsigned i;
+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << (kLenNumLowBits + 1)); i++)
+ p->low[i] = kProbInitValue;
+ for (i = 0; i < kLenNumHighSymbols; i++)
+ p->high[i] = kProbInitValue;
+}
+
+static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, unsigned symbol, unsigned posState)
+{
+ UInt32 range, ttt, newBound;
+ CLzmaProb *probs = p->low;
+ range = rc->range;
+ RC_BIT_PRE(rc, probs);
+ if (symbol >= kLenNumLowSymbols)
+ {
+ RC_BIT_1(rc, probs);
+ probs += kLenNumLowSymbols;
+ RC_BIT_PRE(rc, probs);
+ if (symbol >= kLenNumLowSymbols * 2)
+ {
+ RC_BIT_1(rc, probs);
+ rc->range = range;
+ // RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols * 2);
+ LitEnc_Encode(rc, p->high, symbol - kLenNumLowSymbols * 2);
+ return;
+ }
+ symbol -= kLenNumLowSymbols;
+ }
+
+ // RcTree_Encode(rc, probs + (posState << kLenNumLowBits), kLenNumLowBits, symbol);
+ {
+ unsigned m;
+ unsigned bit;
+ RC_BIT_0(rc, probs);
+ probs += (posState << (1 + kLenNumLowBits));
+ bit = (symbol >> 2) ; RC_BIT(rc, probs + 1, bit); m = (1 << 1) + bit;
+ bit = (symbol >> 1) & 1; RC_BIT(rc, probs + m, bit); m = (m << 1) + bit;
+ bit = symbol & 1; RC_BIT(rc, probs + m, bit);
+ rc->range = range;
+ }
+}
+
+static void SetPrices_3(const CLzmaProb *probs, UInt32 startPrice, UInt32 *prices, const CProbPrice *ProbPrices)
+{
+ unsigned i;
+ for (i = 0; i < 8; i += 2)
+ {
+ UInt32 price = startPrice;
+ UInt32 prob;
+ price += GET_PRICEa(probs[1 ], (i >> 2));
+ price += GET_PRICEa(probs[2 + (i >> 2)], (i >> 1) & 1);
+ prob = probs[4 + (i >> 1)];
+ prices[i ] = price + GET_PRICEa_0(prob);
+ prices[i + 1] = price + GET_PRICEa_1(prob);
+ }
+}
+
+
+MY_NO_INLINE static void MY_FAST_CALL LenPriceEnc_UpdateTable(
+ CLenPriceEnc *p, unsigned posState,
+ const CLenEnc *enc,
+ const CProbPrice *ProbPrices)
+{
+ // int y; for (y = 0; y < 100; y++) {
+ UInt32 a;
+ unsigned i, numSymbols;
+
+ UInt32 *prices = p->prices[posState];
+ {
+ const CLzmaProb *probs = enc->low + (posState << (1 + kLenNumLowBits));
+ SetPrices_3(probs, GET_PRICEa_0(enc->low[0]), prices, ProbPrices);
+ a = GET_PRICEa_1(enc->low[0]);
+ SetPrices_3(probs + kLenNumLowSymbols, a + GET_PRICEa_0(enc->low[kLenNumLowSymbols]), prices + kLenNumLowSymbols, ProbPrices);
+ a += GET_PRICEa_1(enc->low[kLenNumLowSymbols]);
+ }
+ numSymbols = p->tableSize;
+ p->counters[posState] = numSymbols;
+ for (i = kLenNumLowSymbols * 2; i < numSymbols; i += 1)
+ {
+ prices[i] = a +
+ // RcTree_GetPrice(enc->high, kLenNumHighBits, i - kLenNumLowSymbols * 2, ProbPrices);
+ LitEnc_GetPrice(enc->high, i - kLenNumLowSymbols * 2, ProbPrices);
+ /*
+ unsigned sym = (i - kLenNumLowSymbols * 2) >> 1;
+ UInt32 price = a + RcTree_GetPrice(enc->high, kLenNumHighBits - 1, sym, ProbPrices);
+ UInt32 prob = enc->high[(1 << 7) + sym];
+ prices[i ] = price + GET_PRICEa_0(prob);
+ prices[i + 1] = price + GET_PRICEa_1(prob);
+ */
+ }
+ // }
+}
+
+static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, unsigned numPosStates,
+ const CLenEnc *enc,
+ const CProbPrice *ProbPrices)
+{
+ unsigned posState;
+ for (posState = 0; posState < numPosStates; posState++)
+ LenPriceEnc_UpdateTable(p, posState, enc, ProbPrices);
+}
+
+
+/*
+ #ifdef SHOW_STAT
+ g_STAT_OFFSET += num;
+ printf("\n MovePos %u", num);
+ #endif
+*/
+
+#define MOVE_POS(p, num) { \
+ p->additionalOffset += (num); \
+ p->matchFinder.Skip(p->matchFinderObj, (num)); }
+
+
+static unsigned ReadMatchDistances(CLzmaEnc *p, unsigned *numPairsRes)
+{
+ unsigned numPairs;
+
+ p->additionalOffset++;
+ p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
+ numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches);
+ *numPairsRes = numPairs;
+
+ #ifdef SHOW_STAT
+ printf("\n i = %u numPairs = %u ", g_STAT_OFFSET, numPairs / 2);
+ g_STAT_OFFSET++;
+ {
+ unsigned i;
+ for (i = 0; i < numPairs; i += 2)
+ printf("%2u %6u | ", p->matches[i], p->matches[i + 1]);
+ }
+ #endif
+
+ if (numPairs == 0)
+ return 0;
+ {
+ unsigned len = p->matches[(size_t)numPairs - 2];
+ if (len != p->numFastBytes)
+ return len;
+ {
+ UInt32 numAvail = p->numAvail;
+ if (numAvail > LZMA_MATCH_LEN_MAX)
+ numAvail = LZMA_MATCH_LEN_MAX;
+ {
+ const Byte *p1 = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
+ const Byte *p2 = p1 + len;
+ ptrdiff_t dif = (ptrdiff_t)-1 - p->matches[(size_t)numPairs - 1];
+ const Byte *lim = p1 + numAvail;
+ for (; p2 != lim && *p2 == p2[dif]; p2++);
+ return (unsigned)(p2 - p1);
+ }
+ }
+ }
+}
+
+#define MARK_LIT ((UInt32)(Int32)-1)
+
+#define MakeAs_Lit(p) { (p)->dist = MARK_LIT; (p)->extra = 0; }
+#define MakeAs_ShortRep(p) { (p)->dist = 0; (p)->extra = 0; }
+#define IsShortRep(p) ((p)->dist == 0)
+
+
+#define GetPrice_ShortRep(p, state, posState) \
+ ( GET_PRICE_0(p->isRepG0[state]) + GET_PRICE_0(p->isRep0Long[state][posState]))
+
+#define GetPrice_Rep_0(p, state, posState) ( \
+ GET_PRICE_1(p->isMatch[state][posState]) \
+ + GET_PRICE_1(p->isRep0Long[state][posState])) \
+ + GET_PRICE_1(p->isRep[state]) \
+ + GET_PRICE_0(p->isRepG0[state])
+
+
+static UInt32 GetPrice_PureRep(const CLzmaEnc *p, unsigned repIndex, size_t state, size_t posState)
+{
+ UInt32 price;
+ UInt32 prob = p->isRepG0[state];
+ if (repIndex == 0)
+ {
+ price = GET_PRICE_0(prob);
+ price += GET_PRICE_1(p->isRep0Long[state][posState]);
+ }
+ else
+ {
+ price = GET_PRICE_1(prob);
+ prob = p->isRepG1[state];
+ if (repIndex == 1)
+ price += GET_PRICE_0(prob);
+ else
+ {
+ price += GET_PRICE_1(prob);
+ price += GET_PRICE(p->isRepG2[state], repIndex - 2);
+ }
+ }
+ return price;
+}
+
+
+static unsigned Backward(CLzmaEnc *p, unsigned cur)
+{
+ unsigned wr = cur + 1;
+ p->optEnd = wr;
+
+ for (;;)
+ {
+ UInt32 dist = p->opt[cur].dist;
+ UInt32 len = p->opt[cur].len;
+ UInt32 extra = p->opt[cur].extra;
+ cur -= len;
+
+ if (extra)
+ {
+ wr--;
+ p->opt[wr].len = len;
+ cur -= extra;
+ len = extra;
+ if (extra == 1)
+ {
+ p->opt[wr].dist = dist;
+ dist = MARK_LIT;
+ }
+ else
+ {
+ p->opt[wr].dist = 0;
+ len--;
+ wr--;
+ p->opt[wr].dist = MARK_LIT;
+ p->opt[wr].len = 1;
+ }
+ }
+
+ if (cur == 0)
+ {
+ p->backRes = dist;
+ p->optCur = wr;
+ return len;
+ }
+
+ wr--;
+ p->opt[wr].dist = dist;
+ p->opt[wr].len = len;
+ }
+}
+
+
+
+#define LIT_PROBS(pos, prevByte) \
+ (p->litProbs + (UInt32)3 * (((((pos) << 8) + (prevByte)) & p->lpMask) << p->lc))
+
+
+static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
+{
+ unsigned last, cur;
+ UInt32 reps[LZMA_NUM_REPS];
+ unsigned repLens[LZMA_NUM_REPS];
+ UInt32 *matches;
+
+ {
+ UInt32 numAvail;
+ unsigned numPairs, mainLen, repMaxIndex, i, posState;
+ UInt32 matchPrice, repMatchPrice;
+ const Byte *data;
+ Byte curByte, matchByte;
+
+ p->optCur = p->optEnd = 0;
+
+ if (p->additionalOffset == 0)
+ mainLen = ReadMatchDistances(p, &numPairs);
+ else
+ {
+ mainLen = p->longestMatchLen;
+ numPairs = p->numPairs;
+ }
+
+ numAvail = p->numAvail;
+ if (numAvail < 2)
+ {
+ p->backRes = MARK_LIT;
+ return 1;
+ }
+ if (numAvail > LZMA_MATCH_LEN_MAX)
+ numAvail = LZMA_MATCH_LEN_MAX;
+
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
+ repMaxIndex = 0;
+
+ for (i = 0; i < LZMA_NUM_REPS; i++)
+ {
+ unsigned len;
+ const Byte *data2;
+ reps[i] = p->reps[i];
+ data2 = data - reps[i];
+ if (data[0] != data2[0] || data[1] != data2[1])
+ {
+ repLens[i] = 0;
+ continue;
+ }
+ for (len = 2; len < numAvail && data[len] == data2[len]; len++);
+ repLens[i] = len;
+ if (len > repLens[repMaxIndex])
+ repMaxIndex = i;
+ }
+
+ if (repLens[repMaxIndex] >= p->numFastBytes)
+ {
+ unsigned len;
+ p->backRes = repMaxIndex;
+ len = repLens[repMaxIndex];
+ MOVE_POS(p, len - 1)
+ return len;
+ }
+
+ matches = p->matches;
+
+ if (mainLen >= p->numFastBytes)
+ {
+ p->backRes = matches[(size_t)numPairs - 1] + LZMA_NUM_REPS;
+ MOVE_POS(p, mainLen - 1)
+ return mainLen;
+ }
+
+ curByte = *data;
+ matchByte = *(data - reps[0]);
+
+ if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2)
+ {
+ p->backRes = MARK_LIT;
+ return 1;
+ }
+
+ p->opt[0].state = (CState)p->state;
+
+ posState = (position & p->pbMask);
+
+ {
+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
+ p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) +
+ (!IsLitState(p->state) ?
+ LitEnc_Matched_GetPrice(probs, curByte, matchByte, p->ProbPrices) :
+ LitEnc_GetPrice(probs, curByte, p->ProbPrices));
+ }
+
+ MakeAs_Lit(&p->opt[1]);
+
+ matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]);
+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]);
+
+ if (matchByte == curByte)
+ {
+ UInt32 shortRepPrice = repMatchPrice + GetPrice_ShortRep(p, p->state, posState);
+ if (shortRepPrice < p->opt[1].price)
+ {
+ p->opt[1].price = shortRepPrice;
+ MakeAs_ShortRep(&p->opt[1]);
+ }
+ }
+
+ last = (mainLen >= repLens[repMaxIndex] ? mainLen : repLens[repMaxIndex]);
+
+ if (last < 2)
+ {
+ p->backRes = p->opt[1].dist;
+ return 1;
+ }
+
+ p->opt[1].len = 1;
+
+ p->opt[0].reps[0] = reps[0];
+ p->opt[0].reps[1] = reps[1];
+ p->opt[0].reps[2] = reps[2];
+ p->opt[0].reps[3] = reps[3];
+
+ {
+ unsigned len = last;
+ do
+ p->opt[len--].price = kInfinityPrice;
+ while (len >= 2);
+ }
+
+ // ---------- REP ----------
+
+ for (i = 0; i < LZMA_NUM_REPS; i++)
+ {
+ unsigned repLen = repLens[i];
+ UInt32 price;
+ if (repLen < 2)
+ continue;
+ price = repMatchPrice + GetPrice_PureRep(p, i, p->state, posState);
+ do
+ {
+ UInt32 price2 = price + p->repLenEnc.prices[posState][(size_t)repLen - 2];
+ COptimal *opt = &p->opt[repLen];
+ if (price2 < opt->price)
+ {
+ opt->price = price2;
+ opt->len = repLen;
+ opt->dist = i;
+ opt->extra = 0;
+ }
+ }
+ while (--repLen >= 2);
+ }
+
+
+ // ---------- MATCH ----------
+ {
+ unsigned len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2);
+ if (len <= mainLen)
+ {
+ unsigned offs = 0;
+ UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]);
+
+ while (len > matches[offs])
+ offs += 2;
+
+ for (; ; len++)
+ {
+ COptimal *opt;
+ UInt32 dist = matches[(size_t)offs + 1];
+ UInt32 price2 = normalMatchPrice + p->lenEnc.prices[posState][(size_t)len - LZMA_MATCH_LEN_MIN];
+ unsigned lenToPosState = GetLenToPosState(len);
+
+ if (dist < kNumFullDistances)
+ price2 += p->distancesPrices[lenToPosState][dist & (kNumFullDistances - 1)];
+ else
+ {
+ unsigned slot;
+ GetPosSlot2(dist, slot);
+ price2 += p->alignPrices[dist & kAlignMask];
+ price2 += p->posSlotPrices[lenToPosState][slot];
+ }
+
+ opt = &p->opt[len];
+
+ if (price2 < opt->price)
+ {
+ opt->price = price2;
+ opt->len = len;
+ opt->dist = dist + LZMA_NUM_REPS;
+ opt->extra = 0;
+ }
+
+ if (len == matches[offs])
+ {
+ offs += 2;
+ if (offs == numPairs)
+ break;
+ }
+ }
+ }
+ }
+
+
+ cur = 0;
+
+ #ifdef SHOW_STAT2
+ /* if (position >= 0) */
+ {
+ unsigned i;
+ printf("\n pos = %4X", position);
+ for (i = cur; i <= last; i++)
+ printf("\nprice[%4X] = %u", position - cur + i, p->opt[i].price);
+ }
+ #endif
+ }
+
+
+
+ // ---------- Optimal Parsing ----------
+
+ for (;;)
+ {
+ UInt32 numAvail, numAvailFull;
+ unsigned newLen, numPairs, prev, state, posState, startLen;
+ UInt32 curPrice, litPrice, matchPrice, repMatchPrice;
+ Bool nextIsLit;
+ Byte curByte, matchByte;
+ const Byte *data;
+ COptimal *curOpt, *nextOpt;
+
+ if (++cur == last)
+ return Backward(p, cur);
+
+ newLen = ReadMatchDistances(p, &numPairs);
+
+ if (newLen >= p->numFastBytes)
+ {
+ p->numPairs = numPairs;
+ p->longestMatchLen = newLen;
+ return Backward(p, cur);
+ }
+
+ curOpt = &p->opt[cur];
+ prev = cur - curOpt->len;
+
+ if (curOpt->len == 1)
+ {
+ state = p->opt[prev].state;
+ if (IsShortRep(curOpt))
+ state = kShortRepNextStates[state];
+ else
+ state = kLiteralNextStates[state];
+ }
+ else
+ {
+ const COptimal *prevOpt;
+ UInt32 b0;
+ UInt32 dist = curOpt->dist;
+
+ if (curOpt->extra)
+ {
+ prev -= curOpt->extra;
+ state = kState_RepAfterLit;
+ if (curOpt->extra == 1)
+ state = (dist < LZMA_NUM_REPS) ? kState_RepAfterLit : kState_MatchAfterLit;
+ }
+ else
+ {
+ state = p->opt[prev].state;
+ if (dist < LZMA_NUM_REPS)
+ state = kRepNextStates[state];
+ else
+ state = kMatchNextStates[state];
+ }
+
+ prevOpt = &p->opt[prev];
+ b0 = prevOpt->reps[0];
+
+ if (dist < LZMA_NUM_REPS)
+ {
+ if (dist == 0)
+ {
+ reps[0] = b0;
+ reps[1] = prevOpt->reps[1];
+ reps[2] = prevOpt->reps[2];
+ reps[3] = prevOpt->reps[3];
+ }
+ else
+ {
+ reps[1] = b0;
+ b0 = prevOpt->reps[1];
+ if (dist == 1)
+ {
+ reps[0] = b0;
+ reps[2] = prevOpt->reps[2];
+ reps[3] = prevOpt->reps[3];
+ }
+ else
+ {
+ reps[2] = b0;
+ reps[0] = prevOpt->reps[dist];
+ reps[3] = prevOpt->reps[dist ^ 1];
+ }
+ }
+ }
+ else
+ {
+ reps[0] = (dist - LZMA_NUM_REPS + 1);
+ reps[1] = b0;
+ reps[2] = prevOpt->reps[1];
+ reps[3] = prevOpt->reps[2];
+ }
+ }
+
+ curOpt->state = (CState)state;
+ curOpt->reps[0] = reps[0];
+ curOpt->reps[1] = reps[1];
+ curOpt->reps[2] = reps[2];
+ curOpt->reps[3] = reps[3];
+
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
+ curByte = *data;
+ matchByte = *(data - reps[0]);
+
+ position++;
+ posState = (position & p->pbMask);
+
+ /*
+ The order of Price checks:
+ < LIT
+ <= SHORT_REP
+ < LIT : REP_0
+ < REP [ : LIT : REP_0 ]
+ < MATCH [ : LIT : REP_0 ]
+ */
+
+ curPrice = curOpt->price;
+ litPrice = curPrice + GET_PRICE_0(p->isMatch[state][posState]);
+
+ nextOpt = &p->opt[(size_t)cur + 1];
+ nextIsLit = False;
+
+ // if (litPrice >= nextOpt->price) litPrice = 0; else // 18.new
+ {
+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
+ litPrice += (!IsLitState(state) ?
+ LitEnc_Matched_GetPrice(probs, curByte, matchByte, p->ProbPrices) :
+ LitEnc_GetPrice(probs, curByte, p->ProbPrices));
+
+ if (litPrice < nextOpt->price)
+ {
+ nextOpt->price = litPrice;
+ nextOpt->len = 1;
+ MakeAs_Lit(nextOpt);
+ nextIsLit = True;
+ }
+ }
+
+ matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]);
+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]);
+
+ // ---------- SHORT_REP ----------
+ // if (IsLitState(state)) // 18.new
+ if (matchByte == curByte)
+ // if (repMatchPrice < nextOpt->price) // 18.new
+ if (nextOpt->len < 2
+ || (nextOpt->dist != 0
+ && nextOpt->extra <= 1 // 17.old
+ ))
+ {
+ UInt32 shortRepPrice = repMatchPrice + GetPrice_ShortRep(p, state, posState);
+ if (shortRepPrice <= nextOpt->price) // 17.old
+ // if (shortRepPrice < nextOpt->price) // 18.new
+ {
+ nextOpt->price = shortRepPrice;
+ nextOpt->len = 1;
+ MakeAs_ShortRep(nextOpt);
+ nextIsLit = False;
+ }
+ }
+
+ numAvailFull = p->numAvail;
+ {
+ UInt32 temp = kNumOpts - 1 - cur;
+ if (numAvailFull > temp)
+ numAvailFull = temp;
+ }
+
+ if (numAvailFull < 2)
+ continue;
+ numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes);
+
+ // numAvail <= p->numFastBytes
+
+ // ---------- LIT : REP_0 ----------
+
+ if (
+ // litPrice != 0 && // 18.new
+ !nextIsLit
+ && matchByte != curByte
+ && numAvailFull > 2)
+ {
+ const Byte *data2 = data - reps[0];
+ if (data[1] == data2[1] && data[2] == data2[2])
+ {
+ unsigned len;
+ unsigned limit = p->numFastBytes + 1;
+ if (limit > numAvailFull)
+ limit = numAvailFull;
+ for (len = 3; len < limit && data[len] == data2[len]; len++)
+ {
+ }
+
+ {
+ unsigned state2 = kLiteralNextStates[state];
+ unsigned posState2 = (position + 1) & p->pbMask;
+ UInt32 price = litPrice + GetPrice_Rep_0(p, state2, posState2);
+ {
+ unsigned offset = cur + len;
+ while (last < offset)
+ p->opt[++last].price = kInfinityPrice;
+
+ // do
+ {
+ UInt32 price2;
+ COptimal *opt;
+ len--;
+ // price2 = price + GetPrice_Len_Rep_0(p, len, state2, posState2);
+ price2 = price + p->repLenEnc.prices[posState2][len - LZMA_MATCH_LEN_MIN];
+
+ opt = &p->opt[offset];
+ // offset--;
+ if (price2 < opt->price)
+ {
+ opt->price = price2;
+ opt->len = len;
+ opt->dist = 0;
+ opt->extra = 1;
+ }
+ }
+ // while (len >= 3);
+ }
+ }
+ }
+ }
+
+ startLen = 2; /* speed optimization */
+ {
+ // ---------- REP ----------
+ unsigned repIndex = 0; // 17.old
+ // unsigned repIndex = IsLitState(state) ? 0 : 1; // 18.notused
+ for (; repIndex < LZMA_NUM_REPS; repIndex++)
+ {
+ unsigned len;
+ UInt32 price;
+ const Byte *data2 = data - reps[repIndex];
+ if (data[0] != data2[0] || data[1] != data2[1])
+ continue;
+
+ for (len = 2; len < numAvail && data[len] == data2[len]; len++);
+
+ // if (len < startLen) continue; // 18.new: speed optimization
+
+ while (last < cur + len)
+ p->opt[++last].price = kInfinityPrice;
+ {
+ unsigned len2 = len;
+ price = repMatchPrice + GetPrice_PureRep(p, repIndex, state, posState);
+ do
+ {
+ UInt32 price2 = price + p->repLenEnc.prices[posState][(size_t)len2 - 2];
+ COptimal *opt = &p->opt[cur + len2];
+ if (price2 < opt->price)
+ {
+ opt->price = price2;
+ opt->len = len2;
+ opt->dist = repIndex;
+ opt->extra = 0;
+ }
+ }
+ while (--len2 >= 2);
+ }
+
+ if (repIndex == 0) startLen = len + 1; // 17.old
+ // startLen = len + 1; // 18.new
+
+ /* if (_maxMode) */
+ {
+ // ---------- REP : LIT : REP_0 ----------
+ // numFastBytes + 1 + numFastBytes
+
+ unsigned len2 = len + 1;
+ unsigned limit = len2 + p->numFastBytes;
+ if (limit > numAvailFull)
+ limit = numAvailFull;
+
+ for (; len2 < limit && data[len2] == data2[len2]; len2++);
+
+ len2 -= len;
+ if (len2 >= 3)
+ {
+ unsigned state2 = kRepNextStates[state];
+ unsigned posState2 = (position + len) & p->pbMask;
+ price +=
+ p->repLenEnc.prices[posState][(size_t)len - 2]
+ + GET_PRICE_0(p->isMatch[state2][posState2])
+ + LitEnc_Matched_GetPrice(LIT_PROBS(position + len, data[(size_t)len - 1]),
+ data[len], data2[len], p->ProbPrices);
+
+ // state2 = kLiteralNextStates[state2];
+ state2 = kState_LitAfterRep;
+ posState2 = (posState2 + 1) & p->pbMask;
+
+
+ price += GetPrice_Rep_0(p, state2, posState2);
+ {
+ unsigned offset = cur + len + len2;
+ while (last < offset)
+ p->opt[++last].price = kInfinityPrice;
+ // do
+ {
+ unsigned price2;
+ COptimal *opt;
+ len2--;
+ // price2 = price + GetPrice_Len_Rep_0(p, len2, state2, posState2);
+ price2 = price + p->repLenEnc.prices[posState2][len2 - LZMA_MATCH_LEN_MIN];
+
+ opt = &p->opt[offset];
+ // offset--;
+ if (price2 < opt->price)
+ {
+ opt->price = price2;
+ opt->len = len2;
+ opt->extra = (CExtra)(len + 1);
+ opt->dist = repIndex;
+ }
+ }
+ // while (len2 >= 3);
+ }
+ }
+ }
+ }
+ }
+
+
+ // ---------- MATCH ----------
+ /* for (unsigned len = 2; len <= newLen; len++) */
+ if (newLen > numAvail)
+ {
+ newLen = numAvail;
+ for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2);
+ matches[numPairs] = newLen;
+ numPairs += 2;
+ }
+
+ if (newLen >= startLen)
+ {
+ UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]);
+ UInt32 dist;
+ unsigned offs, posSlot, len;
+ while (last < cur + newLen)
+ p->opt[++last].price = kInfinityPrice;
+
+ offs = 0;
+ while (startLen > matches[offs])
+ offs += 2;
+ dist = matches[(size_t)offs + 1];
+
+ // if (dist >= kNumFullDistances)
+ GetPosSlot2(dist, posSlot);
+
+ for (len = /*2*/ startLen; ; len++)
+ {
+ UInt32 price = normalMatchPrice + p->lenEnc.prices[posState][(size_t)len - LZMA_MATCH_LEN_MIN];
+ {
+ COptimal *opt;
+ unsigned lenToPosState = len - 2; lenToPosState = GetLenToPosState2(lenToPosState);
+ if (dist < kNumFullDistances)
+ price += p->distancesPrices[lenToPosState][dist & (kNumFullDistances - 1)];
+ else
+ price += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[dist & kAlignMask];
+
+ opt = &p->opt[cur + len];
+ if (price < opt->price)
+ {
+ opt->price = price;
+ opt->len = len;
+ opt->dist = dist + LZMA_NUM_REPS;
+ opt->extra = 0;
+ }
+ }
+
+ if (/*_maxMode && */ len == matches[offs])
+ {
+ // MATCH : LIT : REP_0
+
+ const Byte *data2 = data - dist - 1;
+ unsigned len2 = len + 1;
+ unsigned limit = len2 + p->numFastBytes;
+ if (limit > numAvailFull)
+ limit = numAvailFull;
+
+ for (; len2 < limit && data[len2] == data2[len2]; len2++);
+
+ len2 -= len;
+
+ if (len2 >= 3)
+ {
+ unsigned state2 = kMatchNextStates[state];
+ unsigned posState2 = (position + len) & p->pbMask;
+ unsigned offset;
+ price += GET_PRICE_0(p->isMatch[state2][posState2]);
+ price += LitEnc_Matched_GetPrice(LIT_PROBS(position + len, data[(size_t)len - 1]),
+ data[len], data2[len], p->ProbPrices);
+
+ // state2 = kLiteralNextStates[state2];
+ state2 = kState_LitAfterMatch;
+
+ posState2 = (posState2 + 1) & p->pbMask;
+ price += GetPrice_Rep_0(p, state2, posState2);
+
+ offset = cur + len + len2;
+ while (last < offset)
+ p->opt[++last].price = kInfinityPrice;
+ // do
+ {
+ UInt32 price2;
+ COptimal *opt;
+ len2--;
+ // price2 = price + GetPrice_Len_Rep_0(p, len2, state2, posState2);
+ price2 = price + p->repLenEnc.prices[posState2][len2 - LZMA_MATCH_LEN_MIN];
+ opt = &p->opt[offset];
+ // offset--;
+ if (price2 < opt->price)
+ {
+ opt->price = price2;
+ opt->len = len2;
+ opt->extra = (CExtra)(len + 1);
+ opt->dist = dist + LZMA_NUM_REPS;
+ }
+ }
+ // while (len2 >= 3);
+ }
+
+ offs += 2;
+ if (offs == numPairs)
+ break;
+ dist = matches[(size_t)offs + 1];
+ // if (dist >= kNumFullDistances)
+ GetPosSlot2(dist, posSlot);
+ }
+ }
+ }
+ }
+}
+
+
+
+#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist))
+
+
+
+static unsigned GetOptimumFast(CLzmaEnc *p)
+{
+ UInt32 numAvail, mainDist;
+ unsigned mainLen, numPairs, repIndex, repLen, i;
+ const Byte *data;
+
+ if (p->additionalOffset == 0)
+ mainLen = ReadMatchDistances(p, &numPairs);
+ else
+ {
+ mainLen = p->longestMatchLen;
+ numPairs = p->numPairs;
+ }
+
+ numAvail = p->numAvail;
+ p->backRes = MARK_LIT;
+ if (numAvail < 2)
+ return 1;
+ if (numAvail > LZMA_MATCH_LEN_MAX)
+ numAvail = LZMA_MATCH_LEN_MAX;
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
+ repLen = repIndex = 0;
+
+ for (i = 0; i < LZMA_NUM_REPS; i++)
+ {
+ unsigned len;
+ const Byte *data2 = data - p->reps[i];
+ if (data[0] != data2[0] || data[1] != data2[1])
+ continue;
+ for (len = 2; len < numAvail && data[len] == data2[len]; len++);
+ if (len >= p->numFastBytes)
+ {
+ p->backRes = i;
+ MOVE_POS(p, len - 1)
+ return len;
+ }
+ if (len > repLen)
+ {
+ repIndex = i;
+ repLen = len;
+ }
+ }
+
+ if (mainLen >= p->numFastBytes)
+ {
+ p->backRes = p->matches[(size_t)numPairs - 1] + LZMA_NUM_REPS;
+ MOVE_POS(p, mainLen - 1)
+ return mainLen;
+ }
+
+ mainDist = 0; /* for GCC */
+
+ if (mainLen >= 2)
+ {
+ mainDist = p->matches[(size_t)numPairs - 1];
+ while (numPairs > 2)
+ {
+ UInt32 dist2;
+ if (mainLen != p->matches[(size_t)numPairs - 4] + 1)
+ break;
+ dist2 = p->matches[(size_t)numPairs - 3];
+ if (!ChangePair(dist2, mainDist))
+ break;
+ numPairs -= 2;
+ mainLen--;
+ mainDist = dist2;
+ }
+ if (mainLen == 2 && mainDist >= 0x80)
+ mainLen = 1;
+ }
+
+ if (repLen >= 2)
+ if ( repLen + 1 >= mainLen
+ || (repLen + 2 >= mainLen && mainDist >= (1 << 9))
+ || (repLen + 3 >= mainLen && mainDist >= (1 << 15)))
+ {
+ p->backRes = repIndex;
+ MOVE_POS(p, repLen - 1)
+ return repLen;
+ }
+
+ if (mainLen < 2 || numAvail <= 2)
+ return 1;
+
+ {
+ unsigned len1 = ReadMatchDistances(p, &p->numPairs);
+ p->longestMatchLen = len1;
+
+ if (len1 >= 2)
+ {
+ UInt32 newDist = p->matches[(size_t)p->numPairs - 1];
+ if ( (len1 >= mainLen && newDist < mainDist)
+ || (len1 == mainLen + 1 && !ChangePair(mainDist, newDist))
+ || (len1 > mainLen + 1)
+ || (len1 + 1 >= mainLen && mainLen >= 3 && ChangePair(newDist, mainDist)))
+ return 1;
+ }
+ }
+
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
+
+ for (i = 0; i < LZMA_NUM_REPS; i++)
+ {
+ unsigned len, limit;
+ const Byte *data2 = data - p->reps[i];
+ if (data[0] != data2[0] || data[1] != data2[1])
+ continue;
+ limit = mainLen - 1;
+ for (len = 2;; len++)
+ {
+ if (len >= limit)
+ return 1;
+ if (data[len] != data2[len])
+ break;
+ }
+ }
+
+ p->backRes = mainDist + LZMA_NUM_REPS;
+ if (mainLen != 2)
+ {
+ MOVE_POS(p, mainLen - 2)
+ }
+ return mainLen;
+}
+
+
+
+
+static void WriteEndMarker(CLzmaEnc *p, unsigned posState)
+{
+ UInt32 range;
+ range = p->rc.range;
+ {
+ UInt32 ttt, newBound;
+ CLzmaProb *prob = &p->isMatch[p->state][posState];
+ RC_BIT_PRE(&p->rc, prob)
+ RC_BIT_1(&p->rc, prob)
+ prob = &p->isRep[p->state];
+ RC_BIT_PRE(&p->rc, prob)
+ RC_BIT_0(&p->rc, prob)
+ }
+ p->state = kMatchNextStates[p->state];
+
+ p->rc.range = range;
+ LenEnc_Encode(&p->lenProbs, &p->rc, 0, posState);
+ range = p->rc.range;
+
+ {
+ // RcTree_Encode_PosSlot(&p->rc, p->posSlotEncoder[0], (1 << kNumPosSlotBits) - 1);
+ CLzmaProb *probs = p->posSlotEncoder[0];
+ unsigned m = 1;
+ do
+ {
+ UInt32 ttt, newBound;
+ RC_BIT_PRE(p, probs + m)
+ RC_BIT_1(&p->rc, probs + m);
+ m = (m << 1) + 1;
+ }
+ while (m < (1 << kNumPosSlotBits));
+ }
+ {
+ // RangeEnc_EncodeDirectBits(&p->rc, ((UInt32)1 << (30 - kNumAlignBits)) - 1, 30 - kNumAlignBits); UInt32 range = p->range;
+ unsigned numBits = 30 - kNumAlignBits;
+ do
+ {
+ range >>= 1;
+ p->rc.low += range;
+ RC_NORM(&p->rc)
+ }
+ while (--numBits);
+ }
+
+ {
+ // RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask);
+ CLzmaProb *probs = p->posAlignEncoder;
+ unsigned m = 1;
+ do
+ {
+ UInt32 ttt, newBound;
+ RC_BIT_PRE(p, probs + m)
+ RC_BIT_1(&p->rc, probs + m);
+ m = (m << 1) + 1;
+ }
+ while (m < kAlignTableSize);
+ }
+ p->rc.range = range;
+}
+
+
+static SRes CheckErrors(CLzmaEnc *p)
+{
+ if (p->result != SZ_OK)
+ return p->result;
+ if (p->rc.res != SZ_OK)
+ p->result = SZ_ERROR_WRITE;
+ if (p->matchFinderBase.result != SZ_OK)
+ p->result = SZ_ERROR_READ;
+ if (p->result != SZ_OK)
+ p->finished = True;
+ return p->result;
+}
+
+
+MY_NO_INLINE static SRes Flush(CLzmaEnc *p, UInt32 nowPos)
+{
+ /* ReleaseMFStream(); */
+ p->finished = True;
+ if (p->writeEndMark)
+ WriteEndMarker(p, nowPos & p->pbMask);
+ RangeEnc_FlushData(&p->rc);
+ RangeEnc_FlushStream(&p->rc);
+ return CheckErrors(p);
+}
+
+
+
+static void FillAlignPrices(CLzmaEnc *p)
+{
+ unsigned i;
+ const CProbPrice *ProbPrices = p->ProbPrices;
+ const CLzmaProb *probs = p->posAlignEncoder;
+ p->alignPriceCount = 0;
+ for (i = 0; i < kAlignTableSize / 2; i++)
+ {
+ UInt32 price = 0;
+ unsigned symbol = i;
+ unsigned m = 1;
+ unsigned bit;
+ UInt32 prob;
+ bit = symbol & 1; symbol >>= 1; price += GET_PRICEa(probs[m], bit); m = (m << 1) + bit;
+ bit = symbol & 1; symbol >>= 1; price += GET_PRICEa(probs[m], bit); m = (m << 1) + bit;
+ bit = symbol & 1; symbol >>= 1; price += GET_PRICEa(probs[m], bit); m = (m << 1) + bit;
+ prob = probs[m];
+ p->alignPrices[i ] = price + GET_PRICEa_0(prob);
+ p->alignPrices[i + 8] = price + GET_PRICEa_1(prob);
+ // p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices);
+ }
+}
+
+
+static void FillDistancesPrices(CLzmaEnc *p)
+{
+ UInt32 tempPrices[kNumFullDistances];
+ unsigned i, lenToPosState;
+
+ const CProbPrice *ProbPrices = p->ProbPrices;
+ p->matchPriceCount = 0;
+
+ for (i = kStartPosModelIndex; i < kNumFullDistances; i++)
+ {
+ unsigned posSlot = GetPosSlot1(i);
+ unsigned footerBits = ((posSlot >> 1) - 1);
+ unsigned base = ((2 | (posSlot & 1)) << footerBits);
+ // tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base, footerBits, i - base, p->ProbPrices);
+
+ const CLzmaProb *probs = p->posEncoders + base;
+ UInt32 price = 0;
+ unsigned m = 1;
+ unsigned symbol = i - base;
+ do
+ {
+ unsigned bit = symbol & 1;
+ symbol >>= 1;
+ price += GET_PRICEa(probs[m], bit);
+ m = (m << 1) + bit;
+ }
+ while (--footerBits);
+ tempPrices[i] = price;
+ }
+
+ for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++)
+ {
+ unsigned posSlot;
+ const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState];
+ UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState];
+ unsigned distTableSize = p->distTableSize;
+ const CLzmaProb *probs = encoder;
+ for (posSlot = 0; posSlot < distTableSize; posSlot += 2)
+ {
+ // posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices);
+ UInt32 price = 0;
+ unsigned bit;
+ unsigned symbol = (posSlot >> 1) + (1 << (kNumPosSlotBits - 1));
+ UInt32 prob;
+ bit = symbol & 1; symbol >>= 1; price += GET_PRICEa(probs[symbol], bit);
+ bit = symbol & 1; symbol >>= 1; price += GET_PRICEa(probs[symbol], bit);
+ bit = symbol & 1; symbol >>= 1; price += GET_PRICEa(probs[symbol], bit);
+ bit = symbol & 1; symbol >>= 1; price += GET_PRICEa(probs[symbol], bit);
+ bit = symbol & 1; symbol >>= 1; price += GET_PRICEa(probs[symbol], bit);
+ prob = probs[(posSlot >> 1) + (1 << (kNumPosSlotBits - 1))];
+ posSlotPrices[posSlot ] = price + GET_PRICEa_0(prob);
+ posSlotPrices[posSlot + 1] = price + GET_PRICEa_1(prob);
+ }
+ for (posSlot = kEndPosModelIndex; posSlot < distTableSize; posSlot++)
+ posSlotPrices[posSlot] += ((UInt32)(((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits);
+
+ {
+ UInt32 *distancesPrices = p->distancesPrices[lenToPosState];
+ {
+ distancesPrices[0] = posSlotPrices[0];
+ distancesPrices[1] = posSlotPrices[1];
+ distancesPrices[2] = posSlotPrices[2];
+ distancesPrices[3] = posSlotPrices[3];
+ }
+ for (i = 4; i < kNumFullDistances; i += 2)
+ {
+ UInt32 slotPrice = posSlotPrices[GetPosSlot1(i)];
+ distancesPrices[i ] = slotPrice + tempPrices[i];
+ distancesPrices[i + 1] = slotPrice + tempPrices[i + 1];
+ }
+ }
+ }
+}
+
+
+
+void LzmaEnc_Construct(CLzmaEnc *p)
+{
+ RangeEnc_Construct(&p->rc);
+ MatchFinder_Construct(&p->matchFinderBase);
+
+ #ifndef _7ZIP_ST
+ MatchFinderMt_Construct(&p->matchFinderMt);
+ p->matchFinderMt.MatchFinder = &p->matchFinderBase;
+ #endif
+
+ {
+ CLzmaEncProps props;
+ LzmaEncProps_Init(&props);
+ LzmaEnc_SetProps(p, &props);
+ }
+
+ #ifndef LZMA_LOG_BSR
+ LzmaEnc_FastPosInit(p->g_FastPos);
+ #endif
+
+ LzmaEnc_InitPriceTables(p->ProbPrices);
+ p->litProbs = NULL;
+ p->saveState.litProbs = NULL;
+
+}
+
+CLzmaEncHandle LzmaEnc_Create(ISzAllocPtr alloc)
+{
+ void *p;
+ p = ISzAlloc_Alloc(alloc, sizeof(CLzmaEnc));
+ if (p)
+ LzmaEnc_Construct((CLzmaEnc *)p);
+ return p;
+}
+
+void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAllocPtr alloc)
+{
+ ISzAlloc_Free(alloc, p->litProbs);
+ ISzAlloc_Free(alloc, p->saveState.litProbs);
+ p->litProbs = NULL;
+ p->saveState.litProbs = NULL;
+}
+
+void LzmaEnc_Destruct(CLzmaEnc *p, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+{
+ #ifndef _7ZIP_ST
+ MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
+ #endif
+
+ MatchFinder_Free(&p->matchFinderBase, allocBig);
+ LzmaEnc_FreeLits(p, alloc);
+ RangeEnc_Free(&p->rc, alloc);
+}
+
+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+{
+ LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig);
+ ISzAlloc_Free(alloc, p);
+}
+
+
+static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpackSize)
+{
+ UInt32 nowPos32, startPos32;
+ if (p->needInit)
+ {
+ p->matchFinder.Init(p->matchFinderObj);
+ p->needInit = 0;
+ }
+
+ if (p->finished)
+ return p->result;
+ RINOK(CheckErrors(p));
+
+ nowPos32 = (UInt32)p->nowPos64;
+ startPos32 = nowPos32;
+
+ if (p->nowPos64 == 0)
+ {
+ unsigned numPairs;
+ Byte curByte;
+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
+ return Flush(p, nowPos32);
+ ReadMatchDistances(p, &numPairs);
+ RangeEnc_EncodeBit_0(&p->rc, &p->isMatch[kState_Start][0]);
+ // p->state = kLiteralNextStates[p->state];
+ curByte = *(p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset);
+ LitEnc_Encode(&p->rc, p->litProbs, curByte);
+ p->additionalOffset--;
+ nowPos32++;
+ }
+
+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0)
+
+ for (;;)
+ {
+ UInt32 dist;
+ unsigned len, posState;
+ UInt32 range, ttt, newBound;
+ CLzmaProb *probs;
+
+ if (p->fastMode)
+ len = GetOptimumFast(p);
+ else
+ {
+ unsigned oci = p->optCur;
+ if (p->optEnd == oci)
+ len = GetOptimum(p, nowPos32);
+ else
+ {
+ const COptimal *opt = &p->opt[oci];
+ len = opt->len;
+ p->backRes = opt->dist;
+ p->optCur = oci + 1;
+ }
+ }
+
+ posState = (unsigned)nowPos32 & p->pbMask;
+ range = p->rc.range;
+ probs = &p->isMatch[p->state][posState];
+
+ RC_BIT_PRE(&p->rc, probs)
+
+ dist = p->backRes;
+
+ #ifdef SHOW_STAT2
+ printf("\n pos = %6X, len = %3u pos = %6u", nowPos32, len, dist);
+ #endif
+
+ if (dist == MARK_LIT)
+ {
+ Byte curByte;
+ const Byte *data;
+ unsigned state;
+
+ RC_BIT_0(&p->rc, probs);
+ p->rc.range = range;
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
+ probs = LIT_PROBS(nowPos32, *(data - 1));
+ curByte = *data;
+ state = p->state;
+ p->state = kLiteralNextStates[state];
+ if (IsLitState(state))
+ LitEnc_Encode(&p->rc, probs, curByte);
+ else
+ LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0]));
+ }
+ else
+ {
+ RC_BIT_1(&p->rc, probs);
+ probs = &p->isRep[p->state];
+ RC_BIT_PRE(&p->rc, probs)
+
+ if (dist < LZMA_NUM_REPS)
+ {
+ RC_BIT_1(&p->rc, probs);
+ probs = &p->isRepG0[p->state];
+ RC_BIT_PRE(&p->rc, probs)
+ if (dist == 0)
+ {
+ RC_BIT_0(&p->rc, probs);
+ probs = &p->isRep0Long[p->state][posState];
+ RC_BIT_PRE(&p->rc, probs)
+ if (len != 1)
+ {
+ RC_BIT_1_BASE(&p->rc, probs);
+ }
+ else
+ {
+ RC_BIT_0_BASE(&p->rc, probs);
+ p->state = kShortRepNextStates[p->state];
+ }
+ }
+ else
+ {
+ RC_BIT_1(&p->rc, probs);
+ probs = &p->isRepG1[p->state];
+ RC_BIT_PRE(&p->rc, probs)
+ if (dist == 1)
+ {
+ RC_BIT_0_BASE(&p->rc, probs);
+ dist = p->reps[1];
+ }
+ else
+ {
+ RC_BIT_1(&p->rc, probs);
+ probs = &p->isRepG2[p->state];
+ RC_BIT_PRE(&p->rc, probs)
+ if (dist == 2)
+ {
+ RC_BIT_0_BASE(&p->rc, probs);
+ dist = p->reps[2];
+ }
+ else
+ {
+ RC_BIT_1_BASE(&p->rc, probs);
+ dist = p->reps[3];
+ p->reps[3] = p->reps[2];
+ }
+ p->reps[2] = p->reps[1];
+ }
+ p->reps[1] = p->reps[0];
+ p->reps[0] = dist;
+ }
+
+ RC_NORM(&p->rc)
+
+ p->rc.range = range;
+
+ if (len != 1)
+ {
+ LenEnc_Encode(&p->repLenProbs, &p->rc, len - LZMA_MATCH_LEN_MIN, posState);
+ if (!p->fastMode)
+ if (--p->repLenEnc.counters[posState] == 0)
+ LenPriceEnc_UpdateTable(&p->repLenEnc, posState, &p->repLenProbs, p->ProbPrices);
+
+ p->state = kRepNextStates[p->state];
+ }
+ }
+ else
+ {
+ unsigned posSlot;
+ RC_BIT_0(&p->rc, probs);
+ p->rc.range = range;
+ p->state = kMatchNextStates[p->state];
+
+ LenEnc_Encode(&p->lenProbs, &p->rc, len - LZMA_MATCH_LEN_MIN, posState);
+ if (!p->fastMode)
+ if (--p->lenEnc.counters[posState] == 0)
+ LenPriceEnc_UpdateTable(&p->lenEnc, posState, &p->lenProbs, p->ProbPrices);
+
+ dist -= LZMA_NUM_REPS;
+ p->reps[3] = p->reps[2];
+ p->reps[2] = p->reps[1];
+ p->reps[1] = p->reps[0];
+ p->reps[0] = dist + 1;
+
+ p->matchPriceCount++;
+ GetPosSlot(dist, posSlot);
+ // RcTree_Encode_PosSlot(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], posSlot);
+ {
+ UInt32 symbol = posSlot + (1 << kNumPosSlotBits);
+ range = p->rc.range;
+ probs = p->posSlotEncoder[GetLenToPosState(len)];
+ do
+ {
+ CLzmaProb *prob = probs + (symbol >> kNumPosSlotBits);
+ UInt32 bit = (symbol >> (kNumPosSlotBits - 1)) & 1;
+ symbol <<= 1;
+ RC_BIT(&p->rc, prob, bit);
+ }
+ while (symbol < (1 << kNumPosSlotBits * 2));
+ p->rc.range = range;
+ }
+
+ if (dist >= kStartPosModelIndex)
+ {
+ unsigned footerBits = ((posSlot >> 1) - 1);
+
+ if (dist < kNumFullDistances)
+ {
+ unsigned base = ((2 | (posSlot & 1)) << footerBits);
+ RcTree_ReverseEncode(&p->rc, p->posEncoders + base, footerBits, dist - base);
+ }
+ else
+ {
+ UInt32 pos2 = (dist | 0xF) << (32 - footerBits);
+ range = p->rc.range;
+ // RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits);
+ /*
+ do
+ {
+ range >>= 1;
+ p->rc.low += range & (0 - ((dist >> --footerBits) & 1));
+ RC_NORM(&p->rc)
+ }
+ while (footerBits > kNumAlignBits);
+ */
+ do
+ {
+ range >>= 1;
+ p->rc.low += range & (0 - (pos2 >> 31));
+ pos2 += pos2;
+ RC_NORM(&p->rc)
+ }
+ while (pos2 != 0xF0000000);
+
+
+ // RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask);
+
+ {
+ unsigned m = 1;
+ unsigned bit;
+ bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit;
+ bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit;
+ bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit;
+ bit = dist & 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit);
+ p->rc.range = range;
+ p->alignPriceCount++;
+ }
+ }
+ }
+ }
+ }
+
+ nowPos32 += len;
+ p->additionalOffset -= len;
+
+ if (p->additionalOffset == 0)
+ {
+ UInt32 processed;
+
+ if (!p->fastMode)
+ {
+ if (p->matchPriceCount >= (1 << 7))
+ FillDistancesPrices(p);
+ if (p->alignPriceCount >= kAlignTableSize)
+ FillAlignPrices(p);
+ }
+
+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
+ break;
+ processed = nowPos32 - startPos32;
+
+ if (maxPackSize)
+ {
+ if (processed + kNumOpts + 300 >= maxUnpackSize
+ || RangeEnc_GetProcessed_sizet(&p->rc) + kPackReserve >= maxPackSize)
+ break;
+ }
+ else if (processed >= (1 << 17))
+ {
+ p->nowPos64 += nowPos32 - startPos32;
+ return CheckErrors(p);
+ }
+ }
+ }
+
+ p->nowPos64 += nowPos32 - startPos32;
+ return Flush(p, nowPos32);
+}
+
+
+
+#define kBigHashDicLimit ((UInt32)1 << 24)
+
+static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+{
+ UInt32 beforeSize = kNumOpts;
+ if (!RangeEnc_Alloc(&p->rc, alloc))
+ return SZ_ERROR_MEM;
+
+ #ifndef _7ZIP_ST
+ p->mtMode = (p->multiThread && !p->fastMode && (p->matchFinderBase.btMode != 0));
+ #endif
+
+ {
+ unsigned lclp = p->lc + p->lp;
+ if (!p->litProbs || !p->saveState.litProbs || p->lclp != lclp)
+ {
+ LzmaEnc_FreeLits(p, alloc);
+ p->litProbs = (CLzmaProb *)ISzAlloc_Alloc(alloc, ((UInt32)0x300 << lclp) * sizeof(CLzmaProb));
+ p->saveState.litProbs = (CLzmaProb *)ISzAlloc_Alloc(alloc, ((UInt32)0x300 << lclp) * sizeof(CLzmaProb));
+ if (!p->litProbs || !p->saveState.litProbs)
+ {
+ LzmaEnc_FreeLits(p, alloc);
+ return SZ_ERROR_MEM;
+ }
+ p->lclp = lclp;
+ }
+ }
+
+ p->matchFinderBase.bigHash = (Byte)(p->dictSize > kBigHashDicLimit ? 1 : 0);
+
+ if (beforeSize + p->dictSize < keepWindowSize)
+ beforeSize = keepWindowSize - p->dictSize;
+
+ #ifndef _7ZIP_ST
+ if (p->mtMode)
+ {
+ RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes,
+ LZMA_MATCH_LEN_MAX
+ + 1 /* 18.04 */
+ , allocBig));
+ p->matchFinderObj = &p->matchFinderMt;
+ p->matchFinderBase.bigHash = (Byte)(
+ (p->dictSize > kBigHashDicLimit && p->matchFinderBase.hashMask >= 0xFFFFFF) ? 1 : 0);
+ MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder);
+ }
+ else
+ #endif
+ {
+ if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig))
+ return SZ_ERROR_MEM;
+ p->matchFinderObj = &p->matchFinderBase;
+ MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder);
+ }
+
+ return SZ_OK;
+}
+
+void LzmaEnc_Init(CLzmaEnc *p)
+{
+ unsigned i;
+ p->state = 0;
+ p->reps[0] =
+ p->reps[1] =
+ p->reps[2] =
+ p->reps[3] = 1;
+
+ RangeEnc_Init(&p->rc);
+
+ for (i = 0; i < (1 << kNumAlignBits); i++)
+ p->posAlignEncoder[i] = kProbInitValue;
+
+ for (i = 0; i < kNumStates; i++)
+ {
+ unsigned j;
+ for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++)
+ {
+ p->isMatch[i][j] = kProbInitValue;
+ p->isRep0Long[i][j] = kProbInitValue;
+ }
+ p->isRep[i] = kProbInitValue;
+ p->isRepG0[i] = kProbInitValue;
+ p->isRepG1[i] = kProbInitValue;
+ p->isRepG2[i] = kProbInitValue;
+ }
+
+ {
+ for (i = 0; i < kNumLenToPosStates; i++)
+ {
+ CLzmaProb *probs = p->posSlotEncoder[i];
+ unsigned j;
+ for (j = 0; j < (1 << kNumPosSlotBits); j++)
+ probs[j] = kProbInitValue;
+ }
+ }
+ {
+ for (i = 0; i < kNumFullDistances; i++)
+ p->posEncoders[i] = kProbInitValue;
+ }
+
+ {
+ UInt32 num = (UInt32)0x300 << (p->lp + p->lc);
+ UInt32 k;
+ CLzmaProb *probs = p->litProbs;
+ for (k = 0; k < num; k++)
+ probs[k] = kProbInitValue;
+ }
+
+
+ LenEnc_Init(&p->lenProbs);
+ LenEnc_Init(&p->repLenProbs);
+
+ p->optEnd = 0;
+ p->optCur = 0;
+ p->additionalOffset = 0;
+
+ p->pbMask = (1 << p->pb) - 1;
+ p->lpMask = ((UInt32)0x100 << p->lp) - ((unsigned)0x100 >> p->lc);
+}
+
+void LzmaEnc_InitPrices(CLzmaEnc *p)
+{
+ if (!p->fastMode)
+ {
+ FillDistancesPrices(p);
+ FillAlignPrices(p);
+ }
+
+ p->lenEnc.tableSize =
+ p->repLenEnc.tableSize =
+ p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN;
+ LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, &p->lenProbs, p->ProbPrices);
+ LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, &p->repLenProbs, p->ProbPrices);
+}
+
+static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+{
+ unsigned i;
+ for (i = kEndPosModelIndex / 2; i < kDicLogSizeMax; i++)
+ if (p->dictSize <= ((UInt32)1 << i))
+ break;
+ p->distTableSize = i * 2;
+
+ p->finished = False;
+ p->result = SZ_OK;
+ RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig));
+ LzmaEnc_Init(p);
+ LzmaEnc_InitPrices(p);
+ p->nowPos64 = 0;
+ return SZ_OK;
+}
+
+static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream,
+ ISzAllocPtr alloc, ISzAllocPtr allocBig)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ p->matchFinderBase.stream = inStream;
+ p->needInit = 1;
+ p->rc.outStream = outStream;
+ return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
+}
+
+SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp,
+ ISeqInStream *inStream, UInt32 keepWindowSize,
+ ISzAllocPtr alloc, ISzAllocPtr allocBig)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ p->matchFinderBase.stream = inStream;
+ p->needInit = 1;
+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
+}
+
+static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen)
+{
+ p->matchFinderBase.directInput = 1;
+ p->matchFinderBase.bufferBase = (Byte *)src;
+ p->matchFinderBase.directInputRem = srcLen;
+}
+
+SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
+ UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ LzmaEnc_SetInputBuf(p, src, srcLen);
+ p->needInit = 1;
+
+ LzmaEnc_SetDataSize(pp, srcLen);
+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
+}
+
+void LzmaEnc_Finish(CLzmaEncHandle pp)
+{
+ #ifndef _7ZIP_ST
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ if (p->mtMode)
+ MatchFinderMt_ReleaseStream(&p->matchFinderMt);
+ #else
+ UNUSED_VAR(pp);
+ #endif
+}
+
+
+typedef struct
+{
+ ISeqOutStream vt;
+ Byte *data;
+ SizeT rem;
+ Bool overflow;
+} CLzmaEnc_SeqOutStreamBuf;
+
+static size_t SeqOutStreamBuf_Write(const ISeqOutStream *pp, const void *data, size_t size)
+{
+ CLzmaEnc_SeqOutStreamBuf *p = CONTAINER_FROM_VTBL(pp, CLzmaEnc_SeqOutStreamBuf, vt);
+ if (p->rem < size)
+ {
+ size = p->rem;
+ p->overflow = True;
+ }
+ memcpy(p->data, data, size);
+ p->rem -= size;
+ p->data += size;
+ return size;
+}
+
+
+UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
+{
+ const CLzmaEnc *p = (CLzmaEnc *)pp;
+ return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
+}
+
+
+const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
+{
+ const CLzmaEnc *p = (CLzmaEnc *)pp;
+ return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
+}
+
+
+SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
+ Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ UInt64 nowPos64;
+ SRes res;
+ CLzmaEnc_SeqOutStreamBuf outStream;
+
+ outStream.vt.Write = SeqOutStreamBuf_Write;
+ outStream.data = dest;
+ outStream.rem = *destLen;
+ outStream.overflow = False;
+
+ p->writeEndMark = False;
+ p->finished = False;
+ p->result = SZ_OK;
+
+ if (reInit)
+ LzmaEnc_Init(p);
+ LzmaEnc_InitPrices(p);
+
+ nowPos64 = p->nowPos64;
+ RangeEnc_Init(&p->rc);
+ p->rc.outStream = &outStream.vt;
+
+ if (desiredPackSize == 0)
+ return SZ_ERROR_OUTPUT_EOF;
+
+ res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
+
+ *unpackSize = (UInt32)(p->nowPos64 - nowPos64);
+ *destLen -= outStream.rem;
+ if (outStream.overflow)
+ return SZ_ERROR_OUTPUT_EOF;
+
+ return res;
+}
+
+
+static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
+{
+ SRes res = SZ_OK;
+
+ #ifndef _7ZIP_ST
+ Byte allocaDummy[0x300];
+ allocaDummy[0] = 0;
+ allocaDummy[1] = allocaDummy[0];
+ #endif
+
+ for (;;)
+ {
+ res = LzmaEnc_CodeOneBlock(p, 0, 0);
+ if (res != SZ_OK || p->finished)
+ break;
+ if (progress)
+ {
+ res = ICompressProgress_Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc));
+ if (res != SZ_OK)
+ {
+ res = SZ_ERROR_PROGRESS;
+ break;
+ }
+ }
+ }
+
+ LzmaEnc_Finish(p);
+
+ /*
+ if (res == SZ_OK && !Inline_MatchFinder_IsFinishedOK(&p->matchFinderBase))
+ res = SZ_ERROR_FAIL;
+ }
+ */
+
+ return res;
+}
+
+
+SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress,
+ ISzAllocPtr alloc, ISzAllocPtr allocBig)
+{
+ RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig));
+ return LzmaEnc_Encode2((CLzmaEnc *)pp, progress);
+}
+
+
+SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size)
+{
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+ unsigned i;
+ UInt32 dictSize = p->dictSize;
+ if (*size < LZMA_PROPS_SIZE)
+ return SZ_ERROR_PARAM;
+ *size = LZMA_PROPS_SIZE;
+ props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc);
+
+ if (dictSize >= ((UInt32)1 << 22))
+ {
+ UInt32 kDictMask = ((UInt32)1 << 20) - 1;
+ if (dictSize < (UInt32)0xFFFFFFFF - kDictMask)
+ dictSize = (dictSize + kDictMask) & ~kDictMask;
+ }
+ else for (i = 11; i <= 30; i++)
+ {
+ if (dictSize <= ((UInt32)2 << i)) { dictSize = (2 << i); break; }
+ if (dictSize <= ((UInt32)3 << i)) { dictSize = (3 << i); break; }
+ }
+
+ for (i = 0; i < 4; i++)
+ props[1 + i] = (Byte)(dictSize >> (8 * i));
+ return SZ_OK;
+}
+
+
+unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle pp)
+{
+ return ((CLzmaEnc *)pp)->writeEndMark;
+}
+
+
+SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+ int writeEndMark, ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+{
+ SRes res;
+ CLzmaEnc *p = (CLzmaEnc *)pp;
+
+ CLzmaEnc_SeqOutStreamBuf outStream;
+
+ outStream.vt.Write = SeqOutStreamBuf_Write;
+ outStream.data = dest;
+ outStream.rem = *destLen;
+ outStream.overflow = False;
+
+ p->writeEndMark = writeEndMark;
+ p->rc.outStream = &outStream.vt;
+
+ res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig);
+
+ if (res == SZ_OK)
+ {
+ res = LzmaEnc_Encode2(p, progress);
+ if (res == SZ_OK && p->nowPos64 != srcLen)
+ res = SZ_ERROR_FAIL;
+ }
+
+ *destLen -= outStream.rem;
+ if (outStream.overflow)
+ return SZ_ERROR_OUTPUT_EOF;
+ return res;
+}
+
+
+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
+ ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+{
+ CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc);
+ SRes res;
+ if (!p)
+ return SZ_ERROR_MEM;
+
+ res = LzmaEnc_SetProps(p, props);
+ if (res == SZ_OK)
+ {
+ res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize);
+ if (res == SZ_OK)
+ res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen,
+ writeEndMark, progress, alloc, allocBig);
+ }
+
+ LzmaEnc_Destroy(p, alloc, allocBig);
+ return res;
+}
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.h
new file mode 100644
index 000000000..0ec95b50c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.h
@@ -0,0 +1,76 @@
+/* LzmaEnc.h -- LZMA Encoder
+2017-07-27 : Igor Pavlov : Public domain */
+
+#ifndef __LZMA_ENC_H
+#define __LZMA_ENC_H
+
+#include "7zTypes.h"
+
+EXTERN_C_BEGIN
+
+#define LZMA_PROPS_SIZE 5
+
+typedef struct _CLzmaEncProps
+{
+ int level; /* 0 <= level <= 9 */
+ UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
+ (1 << 12) <= dictSize <= (3 << 29) for 64-bit version
+ default = (1 << 24) */
+ int lc; /* 0 <= lc <= 8, default = 3 */
+ int lp; /* 0 <= lp <= 4, default = 0 */
+ int pb; /* 0 <= pb <= 4, default = 2 */
+ int algo; /* 0 - fast, 1 - normal, default = 1 */
+ int fb; /* 5 <= fb <= 273, default = 32 */
+ int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
+ int numHashBytes; /* 2, 3 or 4, default = 4 */
+ UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */
+ unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
+ int numThreads; /* 1 or 2, default = 2 */
+
+ UInt64 reduceSize; /* estimated size of data that will be compressed. default = (UInt64)(Int64)-1.
+ Encoder uses this value to reduce dictionary size */
+} CLzmaEncProps;
+
+void LzmaEncProps_Init(CLzmaEncProps *p);
+void LzmaEncProps_Normalize(CLzmaEncProps *p);
+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
+
+
+/* ---------- CLzmaEncHandle Interface ---------- */
+
+/* LzmaEnc* functions can return the following exit codes:
+SRes:
+ SZ_OK - OK
+ SZ_ERROR_MEM - Memory allocation error
+ SZ_ERROR_PARAM - Incorrect parameter in props
+ SZ_ERROR_WRITE - ISeqOutStream write callback error
+ SZ_ERROR_OUTPUT_EOF - output buffer overflow - version with (Byte *) output
+ SZ_ERROR_PROGRESS - some break from progress callback
+ SZ_ERROR_THREAD - error in multithreading functions (only for Mt version)
+*/
+
+typedef void * CLzmaEncHandle;
+
+CLzmaEncHandle LzmaEnc_Create(ISzAllocPtr alloc);
+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig);
+
+SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
+void LzmaEnc_SetDataSize(CLzmaEncHandle p, UInt64 expectedDataSiize);
+SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
+unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle p);
+
+SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
+ ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
+SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+ int writeEndMark, ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
+
+
+/* ---------- One Call Interface ---------- */
+
+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
+ ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
+
+EXTERN_C_END
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Precomp.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Precomp.h
new file mode 100644
index 000000000..edb581443
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Precomp.h
@@ -0,0 +1,10 @@
+/* Precomp.h -- StdAfx
+2013-11-12 : Igor Pavlov : Public domain */
+
+#ifndef __7Z_PRECOMP_H
+#define __7Z_PRECOMP_H
+
+#include "Compiler.h"
+/* #include "7zTypes.h" */
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Threads.c b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Threads.c
new file mode 100644
index 000000000..8fd86f224
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Threads.c
@@ -0,0 +1,95 @@
+/* Threads.c -- multithreading library
+2017-06-26 : Igor Pavlov : Public domain */
+
+#include "Precomp.h"
+
+#ifndef UNDER_CE
+#include <process.h>
+#endif
+
+#include "Threads.h"
+
+static WRes GetError()
+{
+ DWORD res = GetLastError();
+ return res ? (WRes)res : 1;
+}
+
+static WRes HandleToWRes(HANDLE h) { return (h != NULL) ? 0 : GetError(); }
+static WRes BOOLToWRes(BOOL v) { return v ? 0 : GetError(); }
+
+WRes HandlePtr_Close(HANDLE *p)
+{
+ if (*p != NULL)
+ {
+ if (!CloseHandle(*p))
+ return GetError();
+ *p = NULL;
+ }
+ return 0;
+}
+
+WRes Handle_WaitObject(HANDLE h) { return (WRes)WaitForSingleObject(h, INFINITE); }
+
+WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param)
+{
+ /* Windows Me/98/95: threadId parameter may not be NULL in _beginthreadex/CreateThread functions */
+
+ #ifdef UNDER_CE
+
+ DWORD threadId;
+ *p = CreateThread(0, 0, func, param, 0, &threadId);
+
+ #else
+
+ unsigned threadId;
+ *p = (HANDLE)_beginthreadex(NULL, 0, func, param, 0, &threadId);
+
+ #endif
+
+ /* maybe we must use errno here, but probably GetLastError() is also OK. */
+ return HandleToWRes(*p);
+}
+
+static WRes Event_Create(CEvent *p, BOOL manualReset, int signaled)
+{
+ *p = CreateEvent(NULL, manualReset, (signaled ? TRUE : FALSE), NULL);
+ return HandleToWRes(*p);
+}
+
+WRes Event_Set(CEvent *p) { return BOOLToWRes(SetEvent(*p)); }
+WRes Event_Reset(CEvent *p) { return BOOLToWRes(ResetEvent(*p)); }
+
+WRes ManualResetEvent_Create(CManualResetEvent *p, int signaled) { return Event_Create(p, TRUE, signaled); }
+WRes AutoResetEvent_Create(CAutoResetEvent *p, int signaled) { return Event_Create(p, FALSE, signaled); }
+WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *p) { return ManualResetEvent_Create(p, 0); }
+WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *p) { return AutoResetEvent_Create(p, 0); }
+
+
+WRes Semaphore_Create(CSemaphore *p, UInt32 initCount, UInt32 maxCount)
+{
+ *p = CreateSemaphore(NULL, (LONG)initCount, (LONG)maxCount, NULL);
+ return HandleToWRes(*p);
+}
+
+static WRes Semaphore_Release(CSemaphore *p, LONG releaseCount, LONG *previousCount)
+ { return BOOLToWRes(ReleaseSemaphore(*p, releaseCount, previousCount)); }
+WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 num)
+ { return Semaphore_Release(p, (LONG)num, NULL); }
+WRes Semaphore_Release1(CSemaphore *p) { return Semaphore_ReleaseN(p, 1); }
+
+WRes CriticalSection_Init(CCriticalSection *p)
+{
+ /* InitializeCriticalSection can raise only STATUS_NO_MEMORY exception */
+ #ifdef _MSC_VER
+ __try
+ #endif
+ {
+ InitializeCriticalSection(p);
+ /* InitializeCriticalSectionAndSpinCount(p, 0); */
+ }
+ #ifdef _MSC_VER
+ __except (EXCEPTION_EXECUTE_HANDLER) { return 1; }
+ #endif
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Threads.h b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Threads.h
new file mode 100644
index 000000000..f913241ae
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/Threads.h
@@ -0,0 +1,68 @@
+/* Threads.h -- multithreading library
+2017-06-18 : Igor Pavlov : Public domain */
+
+#ifndef __7Z_THREADS_H
+#define __7Z_THREADS_H
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#include "7zTypes.h"
+
+EXTERN_C_BEGIN
+
+WRes HandlePtr_Close(HANDLE *h);
+WRes Handle_WaitObject(HANDLE h);
+
+typedef HANDLE CThread;
+#define Thread_Construct(p) *(p) = NULL
+#define Thread_WasCreated(p) (*(p) != NULL)
+#define Thread_Close(p) HandlePtr_Close(p)
+#define Thread_Wait(p) Handle_WaitObject(*(p))
+
+typedef
+#ifdef UNDER_CE
+ DWORD
+#else
+ unsigned
+#endif
+ THREAD_FUNC_RET_TYPE;
+
+#define THREAD_FUNC_CALL_TYPE MY_STD_CALL
+#define THREAD_FUNC_DECL THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE
+typedef THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE * THREAD_FUNC_TYPE)(void *);
+WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param);
+
+typedef HANDLE CEvent;
+typedef CEvent CAutoResetEvent;
+typedef CEvent CManualResetEvent;
+#define Event_Construct(p) *(p) = NULL
+#define Event_IsCreated(p) (*(p) != NULL)
+#define Event_Close(p) HandlePtr_Close(p)
+#define Event_Wait(p) Handle_WaitObject(*(p))
+WRes Event_Set(CEvent *p);
+WRes Event_Reset(CEvent *p);
+WRes ManualResetEvent_Create(CManualResetEvent *p, int signaled);
+WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *p);
+WRes AutoResetEvent_Create(CAutoResetEvent *p, int signaled);
+WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *p);
+
+typedef HANDLE CSemaphore;
+#define Semaphore_Construct(p) *(p) = NULL
+#define Semaphore_IsCreated(p) (*(p) != NULL)
+#define Semaphore_Close(p) HandlePtr_Close(p)
+#define Semaphore_Wait(p) Handle_WaitObject(*(p))
+WRes Semaphore_Create(CSemaphore *p, UInt32 initCount, UInt32 maxCount);
+WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 num);
+WRes Semaphore_Release1(CSemaphore *p);
+
+typedef CRITICAL_SECTION CCriticalSection;
+WRes CriticalSection_Init(CCriticalSection *p);
+#define CriticalSection_Delete(p) DeleteCriticalSection(p)
+#define CriticalSection_Enter(p) EnterCriticalSection(p)
+#define CriticalSection_Leave(p) LeaveCriticalSection(p)
+
+EXTERN_C_END
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-history.txt b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-history.txt
new file mode 100644
index 000000000..d7426d38a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-history.txt
@@ -0,0 +1,424 @@
+HISTORY of the LZMA SDK
+-----------------------
+
+18.05 2018-04-30
+-------------------------
+- The speed for LZMA/LZMA2 compressing was increased
+ by 8% for fastest/fast compression levels and
+ by 3% for normal/maximum compression levels.
+- Previous versions of 7-Zip could work incorrectly in "Large memory pages" mode in
+ Windows 10 because of some BUG with "Large Pages" in Windows 10.
+ Now 7-Zip doesn't use "Large Pages" on Windows 10 up to revision 1709 (16299).
+- The BUG was fixed in Lzma2Enc.c
+ Lzma2Enc_Encode2() function worked incorretly,
+ if (inStream == NULL) and the number of block threads is more than 1.
+
+
+18.03 beta 2018-03-04
+-------------------------
+- Asm\x86\LzmaDecOpt.asm: new optimized LZMA decoder written in asm
+ for x64 with about 30% higher speed than main version of LZMA decoder written in C.
+- The speed for single-thread LZMA/LZMA2 decoder written in C was increased by 3%.
+- 7-Zip now can use multi-threading for 7z/LZMA2 decoding,
+ if there are multiple independent data chunks in LZMA2 stream.
+- 7-Zip now can use multi-threading for xz decoding,
+ if there are multiple blocks in xz stream.
+
+
+18.01 2019-01-28
+-------------------------
+- The BUG in 17.01 - 18.00 beta was fixed:
+ XzDec.c : random block unpacking and XzUnpacker_IsBlockFinished()
+ didn't work correctly for xz archives without checksum (CRC).
+
+
+18.00 beta 2019-01-10
+-------------------------
+- The BUG in xz encoder was fixed:
+ There was memory leak of 16 KB for each file compressed with
+ xz compression method, if additional filter was used.
+
+
+17.01 beta 2017-08-28
+-------------------------
+- Minor speed optimization for LZMA2 (xz and 7z) multi-threading compression.
+ 7-Zip now uses additional memory buffers for multi-block LZMA2 compression.
+ CPU utilization was slightly improved.
+- 7-zip now creates multi-block xz archives by default. Block size can be
+ specified with -ms[Size]{m|g} switch.
+- xz decoder now can unpack random block from multi-block xz archives.
+- 7-Zip command line: @listfile now doesn't work after -- switch.
+ Use -i@listfile before -- switch instead.
+- The BUGs were fixed:
+ 7-Zip 17.00 beta crashed for commands that write anti-item to 7z archive.
+
+
+17.00 beta 2017-04-29
+-------------------------
+- NewHandler.h / NewHandler.cpp:
+ now it redefines operator new() only for old MSVC compilers (_MSC_VER < 1900).
+- C/7zTypes.h : the names of variables in interface structures were changed (vt).
+- Some bugs were fixed. 7-Zip could crash in some cases.
+- Some internal changes in code.
+
+
+16.04 2016-10-04
+-------------------------
+- The bug was fixed in DllSecur.c.
+
+
+16.03 2016-09-28
+-------------------------
+- SFX modules now use some protection against DLL preloading attack.
+- Some bugs in 7z code were fixed.
+
+
+16.02 2016-05-21
+-------------------------
+- The BUG in 16.00 - 16.01 was fixed:
+ Split Handler (SplitHandler.cpp) returned incorrect
+ total size value (kpidSize) for split archives.
+
+
+16.01 2016-05-19
+-------------------------
+- Some internal changes to reduce the number of compiler warnings.
+
+
+16.00 2016-05-10
+-------------------------
+- Some bugs were fixed.
+
+
+15.12 2015-11-19
+-------------------------
+- The BUG in C version of 7z decoder was fixed:
+ 7zDec.c : SzDecodeLzma2()
+ 7z decoder could mistakenly report about decoding error for some 7z archives
+ that use LZMA2 compression method.
+ The probability to get that mistaken decoding error report was about
+ one error per 16384 solid blocks for solid blocks larger than 16 KB (compressed size).
+- The BUG (in 9.26-15.11) in C version of 7z decoder was fixed:
+ 7zArcIn.c : SzReadHeader2()
+ 7z decoder worked incorrectly for 7z archives that contain
+ empty solid blocks, that can be placed to 7z archive, if some file is
+ unavailable for reading during archive creation.
+
+
+15.09 beta 2015-10-16
+-------------------------
+- The BUG in LZMA / LZMA2 encoding code was fixed.
+ The BUG in LzFind.c::MatchFinder_ReadBlock() function.
+ If input data size is larger than (4 GiB - dictionary_size),
+ the following code worked incorrectly:
+ - LZMA : LzmaEnc_MemEncode(), LzmaEncode() : LZMA encoding functions
+ for compressing from memory to memory.
+ That BUG is not related to LZMA encoder version that works via streams.
+ - LZMA2 : multi-threaded version of LZMA2 encoder worked incorrectly, if
+ default value of chunk size (CLzma2EncProps::blockSize) is changed
+ to value larger than (4 GiB - dictionary_size).
+
+
+9.38 beta 2015-01-03
+-------------------------
+- The BUG in 9.31-9.37 was fixed:
+ IArchiveGetRawProps interface was disabled for 7z archives.
+- The BUG in 9.26-9.36 was fixed:
+ Some code in CPP\7zip\Archive\7z\ worked correctly only under Windows.
+
+
+9.36 beta 2014-12-26
+-------------------------
+- The BUG in command line version was fixed:
+ 7-Zip created temporary archive in current folder during update archive
+ operation, if -w{Path} switch was not specified.
+ The fixed 7-Zip creates temporary archive in folder that contains updated archive.
+- The BUG in 9.33-9.35 was fixed:
+ 7-Zip silently ignored file reading errors during 7z or gz archive creation,
+ and the created archive contained only part of file that was read before error.
+ The fixed 7-Zip stops archive creation and it reports about error.
+
+
+9.35 beta 2014-12-07
+-------------------------
+- 7zr.exe now support AES encryption.
+- SFX modules were added to LZMA SDK
+- Some bugs were fixed.
+
+
+9.21 beta 2011-04-11
+-------------------------
+- New class FString for file names at file systems.
+- Speed optimization in CRC code for big-endian CPUs.
+- The BUG in Lzma2Dec.c was fixed:
+ Lzma2Decode function didn't work.
+
+
+9.18 beta 2010-11-02
+-------------------------
+- New small SFX module for installers (SfxSetup).
+
+
+9.12 beta 2010-03-24
+-------------------------
+- The BUG in LZMA SDK 9.* was fixed: LZMA2 codec didn't work,
+ if more than 10 threads were used (or more than 20 threads in some modes).
+
+
+9.11 beta 2010-03-15
+-------------------------
+- PPMd compression method support
+
+
+9.09 2009-12-12
+-------------------------
+- The bug was fixed:
+ Utf16_To_Utf8 funstions in UTFConvert.cpp and 7zMain.c
+ incorrectly converted surrogate characters (the code >= 0x10000) to UTF-8.
+- Some bugs were fixed
+
+
+9.06 2009-08-17
+-------------------------
+- Some changes in ANSI-C 7z Decoder interfaces.
+
+
+9.04 2009-05-30
+-------------------------
+- LZMA2 compression method support
+- xz format support
+
+
+4.65 2009-02-03
+-------------------------
+- Some minor fixes
+
+
+4.63 2008-12-31
+-------------------------
+- Some minor fixes
+
+
+4.61 beta 2008-11-23
+-------------------------
+- The bug in ANSI-C LZMA Decoder was fixed:
+ If encoded stream was corrupted, decoder could access memory
+ outside of allocated range.
+- Some changes in ANSI-C 7z Decoder interfaces.
+- LZMA SDK is placed in the public domain.
+
+
+4.60 beta 2008-08-19
+-------------------------
+- Some minor fixes.
+
+
+4.59 beta 2008-08-13
+-------------------------
+- The bug was fixed:
+ LZMA Encoder in fast compression mode could access memory outside of
+ allocated range in some rare cases.
+
+
+4.58 beta 2008-05-05
+-------------------------
+- ANSI-C LZMA Decoder was rewritten for speed optimizations.
+- ANSI-C LZMA Encoder was included to LZMA SDK.
+- C++ LZMA code now is just wrapper over ANSI-C code.
+
+
+4.57 2007-12-12
+-------------------------
+- Speed optimizations in ?++ LZMA Decoder.
+- Small changes for more compatibility with some C/C++ compilers.
+
+
+4.49 beta 2007-07-05
+-------------------------
+- .7z ANSI-C Decoder:
+ - now it supports BCJ and BCJ2 filters
+ - now it supports files larger than 4 GB.
+ - now it supports "Last Write Time" field for files.
+- C++ code for .7z archives compressing/decompressing from 7-zip
+ was included to LZMA SDK.
+
+
+4.43 2006-06-04
+-------------------------
+- Small changes for more compatibility with some C/C++ compilers.
+
+
+4.42 2006-05-15
+-------------------------
+- Small changes in .h files in ANSI-C version.
+
+
+4.39 beta 2006-04-14
+-------------------------
+- The bug in versions 4.33b:4.38b was fixed:
+ C++ version of LZMA encoder could not correctly compress
+ files larger than 2 GB with HC4 match finder (-mfhc4).
+
+
+4.37 beta 2005-04-06
+-------------------------
+- Fixes in C++ code: code could no be compiled if _NO_EXCEPTIONS was defined.
+
+
+4.35 beta 2005-03-02
+-------------------------
+- The bug was fixed in C++ version of LZMA Decoder:
+ If encoded stream was corrupted, decoder could access memory
+ outside of allocated range.
+
+
+4.34 beta 2006-02-27
+-------------------------
+- Compressing speed and memory requirements for compressing were increased
+- LZMA now can use only these match finders: HC4, BT2, BT3, BT4
+
+
+4.32 2005-12-09
+-------------------------
+- Java version of LZMA SDK was included
+
+
+4.30 2005-11-20
+-------------------------
+- Compression ratio was improved in -a2 mode
+- Speed optimizations for compressing in -a2 mode
+- -fb switch now supports values up to 273
+- The bug in 7z_C (7zIn.c) was fixed:
+ It used Alloc/Free functions from different memory pools.
+ So if program used two memory pools, it worked incorrectly.
+- 7z_C: .7z format supporting was improved
+- LZMA# SDK (C#.NET version) was included
+
+
+4.27 (Updated) 2005-09-21
+-------------------------
+- Some GUIDs/interfaces in C++ were changed.
+ IStream.h:
+ ISequentialInStream::Read now works as old ReadPart
+ ISequentialOutStream::Write now works as old WritePart
+
+
+4.27 2005-08-07
+-------------------------
+- The bug in LzmaDecodeSize.c was fixed:
+ if _LZMA_IN_CB and _LZMA_OUT_READ were defined,
+ decompressing worked incorrectly.
+
+
+4.26 2005-08-05
+-------------------------
+- Fixes in 7z_C code and LzmaTest.c:
+ previous versions could work incorrectly,
+ if malloc(0) returns 0
+
+
+4.23 2005-06-29
+-------------------------
+- Small fixes in C++ code
+
+
+4.22 2005-06-10
+-------------------------
+- Small fixes
+
+
+4.21 2005-06-08
+-------------------------
+- Interfaces for ANSI-C LZMA Decoder (LzmaDecode.c) were changed
+- New additional version of ANSI-C LZMA Decoder with zlib-like interface:
+ - LzmaStateDecode.h
+ - LzmaStateDecode.c
+ - LzmaStateTest.c
+- ANSI-C LZMA Decoder now can decompress files larger than 4 GB
+
+
+4.17 2005-04-18
+-------------------------
+- New example for RAM->RAM compressing/decompressing:
+ LZMA + BCJ (filter for x86 code):
+ - LzmaRam.h
+ - LzmaRam.cpp
+ - LzmaRamDecode.h
+ - LzmaRamDecode.c
+ - -f86 switch for lzma.exe
+
+
+4.16 2005-03-29
+-------------------------
+- The bug was fixed in LzmaDecode.c (ANSI-C LZMA Decoder):
+ If _LZMA_OUT_READ was defined, and if encoded stream was corrupted,
+ decoder could access memory outside of allocated range.
+- Speed optimization of ANSI-C LZMA Decoder (now it's about 20% faster).
+ Old version of LZMA Decoder now is in file LzmaDecodeSize.c.
+ LzmaDecodeSize.c can provide slightly smaller code than LzmaDecode.c
+- Small speed optimization in LZMA C++ code
+- filter for SPARC's code was added
+- Simplified version of .7z ANSI-C Decoder was included
+
+
+4.06 2004-09-05
+-------------------------
+- The bug in v4.05 was fixed:
+ LZMA-Encoder didn't release output stream in some cases.
+
+
+4.05 2004-08-25
+-------------------------
+- Source code of filters for x86, IA-64, ARM, ARM-Thumb
+ and PowerPC code was included to SDK
+- Some internal minor changes
+
+
+4.04 2004-07-28
+-------------------------
+- More compatibility with some C++ compilers
+
+
+4.03 2004-06-18
+-------------------------
+- "Benchmark" command was added. It measures compressing
+ and decompressing speed and shows rating values.
+ Also it checks hardware errors.
+
+
+4.02 2004-06-10
+-------------------------
+- C++ LZMA Encoder/Decoder code now is more portable
+ and it can be compiled by GCC on Linux.
+
+
+4.01 2004-02-15
+-------------------------
+- Some detection of data corruption was enabled.
+ LzmaDecode.c / RangeDecoderReadByte
+ .....
+ {
+ rd->ExtraBytes = 1;
+ return 0xFF;
+ }
+
+
+4.00 2004-02-13
+-------------------------
+- Original version of LZMA SDK
+
+
+
+HISTORY of the LZMA
+-------------------
+ 2001-2008: Improvements to LZMA compressing/decompressing code,
+ keeping compatibility with original LZMA format
+ 1996-2001: Development of LZMA compression format
+
+ Some milestones:
+
+ 2001-08-30: LZMA compression was added to 7-Zip
+ 1999-01-02: First version of 7-Zip was released
+
+
+End of document
diff --git a/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-sdk.txt b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-sdk.txt
new file mode 100644
index 000000000..a3deb2094
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-sdk.txt
@@ -0,0 +1,357 @@
+LZMA SDK 18.05
+--------------
+
+LZMA SDK provides the documentation, samples, header files,
+libraries, and tools you need to develop applications that
+use 7z / LZMA / LZMA2 / XZ compression.
+
+LZMA is an improved version of famous LZ77 compression algorithm.
+It was improved in way of maximum increasing of compression ratio,
+keeping high decompression speed and low memory requirements for
+decompressing.
+
+LZMA2 is a LZMA based compression method. LZMA2 provides better
+multithreading support for compression than LZMA and some other improvements.
+
+7z is a file format for data compression and file archiving.
+7z is a main file format for 7-Zip compression program (www.7-zip.org).
+7z format supports different compression methods: LZMA, LZMA2 and others.
+7z also supports AES-256 based encryption.
+
+XZ is a file format for data compression that uses LZMA2 compression.
+XZ format provides additional features: SHA/CRC check, filters for
+improved compression ratio, splitting to blocks and streams,
+
+
+
+LICENSE
+-------
+
+LZMA SDK is written and placed in the public domain by Igor Pavlov.
+
+Some code in LZMA SDK is based on public domain code from another developers:
+ 1) PPMd var.H (2001): Dmitry Shkarin
+ 2) SHA-256: Wei Dai (Crypto++ library)
+
+Anyone is free to copy, modify, publish, use, compile, sell, or distribute the
+original LZMA SDK code, either in source code form or as a compiled binary, for
+any purpose, commercial or non-commercial, and by any means.
+
+LZMA SDK code is compatible with open source licenses, for example, you can
+include it to GNU GPL or GNU LGPL code.
+
+
+LZMA SDK Contents
+-----------------
+
+ Source code:
+
+ - C / C++ / C# / Java - LZMA compression and decompression
+ - C / C++ - LZMA2 compression and decompression
+ - C / C++ - XZ compression and decompression
+ - C - 7z decompression
+ - C++ - 7z compression and decompression
+ - C - small SFXs for installers (7z decompression)
+ - C++ - SFXs and SFXs for installers (7z decompression)
+
+ Precompiled binaries:
+
+ - console programs for lzma / 7z / xz compression and decompression
+ - SFX modules for installers.
+
+
+UNIX/Linux version
+------------------
+To compile C++ version of file->file LZMA encoding, go to directory
+CPP/7zip/Bundles/LzmaCon
+and call make to recompile it:
+ make -f makefile.gcc clean all
+
+In some UNIX/Linux versions you must compile LZMA with static libraries.
+To compile with static libraries, you can use
+LIB = -lm -static
+
+Also you can use p7zip (port of 7-Zip for POSIX systems like Unix or Linux):
+
+ http://p7zip.sourceforge.net/
+
+
+Files
+-----
+
+DOC/7zC.txt - 7z ANSI-C Decoder description
+DOC/7zFormat.txt - 7z Format description
+DOC/installer.txt - information about 7-Zip for installers
+DOC/lzma.txt - LZMA compression description
+DOC/lzma-sdk.txt - LZMA SDK description (this file)
+DOC/lzma-history.txt - history of LZMA SDK
+DOC/lzma-specification.txt - Specification of LZMA
+DOC/Methods.txt - Compression method IDs for .7z
+
+bin/installer/ - example script to create installer that uses SFX module,
+
+bin/7zdec.exe - simplified 7z archive decoder
+bin/7zr.exe - 7-Zip console program (reduced version)
+bin/x64/7zr.exe - 7-Zip console program (reduced version) (x64 version)
+bin/lzma.exe - file->file LZMA encoder/decoder for Windows
+bin/7zS2.sfx - small SFX module for installers (GUI version)
+bin/7zS2con.sfx - small SFX module for installers (Console version)
+bin/7zSD.sfx - SFX module for installers.
+
+
+7zDec.exe
+---------
+7zDec.exe is simplified 7z archive decoder.
+It supports only LZMA, LZMA2, and PPMd methods.
+7zDec decodes whole solid block from 7z archive to RAM.
+The RAM consumption can be high.
+
+
+
+
+Source code structure
+---------------------
+
+
+Asm/ - asm files (optimized code for CRC calculation and Intel-AES encryption)
+
+C/ - C files (compression / decompression and other)
+ Util/
+ 7z - 7z decoder program (decoding 7z files)
+ Lzma - LZMA program (file->file LZMA encoder/decoder).
+ LzmaLib - LZMA library (.DLL for Windows)
+ SfxSetup - small SFX module for installers
+
+CPP/ -- CPP files
+
+ Common - common files for C++ projects
+ Windows - common files for Windows related code
+
+ 7zip - files related to 7-Zip
+
+ Archive - files related to archiving
+
+ Common - common files for archive handling
+ 7z - 7z C++ Encoder/Decoder
+
+ Bundles - Modules that are bundles of other modules (files)
+
+ Alone7z - 7zr.exe: Standalone 7-Zip console program (reduced version)
+ Format7zExtractR - 7zxr.dll: Reduced version of 7z DLL: extracting from 7z/LZMA/BCJ/BCJ2.
+ Format7zR - 7zr.dll: Reduced version of 7z DLL: extracting/compressing to 7z/LZMA/BCJ/BCJ2
+ LzmaCon - lzma.exe: LZMA compression/decompression
+ LzmaSpec - example code for LZMA Specification
+ SFXCon - 7zCon.sfx: Console 7z SFX module
+ SFXSetup - 7zS.sfx: 7z SFX module for installers
+ SFXWin - 7z.sfx: GUI 7z SFX module
+
+ Common - common files for 7-Zip
+
+ Compress - files for compression/decompression
+
+ Crypto - files for encryption / decompression
+
+ UI - User Interface files
+
+ Client7z - Test application for 7za.dll, 7zr.dll, 7zxr.dll
+ Common - Common UI files
+ Console - Code for console program (7z.exe)
+ Explorer - Some code from 7-Zip Shell extension
+ FileManager - Some GUI code from 7-Zip File Manager
+ GUI - Some GUI code from 7-Zip
+
+
+CS/ - C# files
+ 7zip
+ Common - some common files for 7-Zip
+ Compress - files related to compression/decompression
+ LZ - files related to LZ (Lempel-Ziv) compression algorithm
+ LZMA - LZMA compression/decompression
+ LzmaAlone - file->file LZMA compression/decompression
+ RangeCoder - Range Coder (special code of compression/decompression)
+
+Java/ - Java files
+ SevenZip
+ Compression - files related to compression/decompression
+ LZ - files related to LZ (Lempel-Ziv) compression algorithm
+ LZMA - LZMA compression/decompression
+ RangeCoder - Range Coder (special code of compression/decompression)
+
+
+Note:
+ Asm / C / C++ source code of LZMA SDK is part of 7-Zip's source code.
+ 7-Zip's source code can be downloaded from 7-Zip's SourceForge page:
+
+ http://sourceforge.net/projects/sevenzip/
+
+
+
+LZMA features
+-------------
+ - Variable dictionary size (up to 1 GB)
+ - Estimated compressing speed: about 2 MB/s on 2 GHz CPU
+ - Estimated decompressing speed:
+ - 20-30 MB/s on modern 2 GHz cpu
+ - 1-2 MB/s on 200 MHz simple RISC cpu: (ARM, MIPS, PowerPC)
+ - Small memory requirements for decompressing (16 KB + DictionarySize)
+ - Small code size for decompressing: 5-8 KB
+
+LZMA decoder uses only integer operations and can be
+implemented in any modern 32-bit CPU (or on 16-bit CPU with some conditions).
+
+Some critical operations that affect the speed of LZMA decompression:
+ 1) 32*16 bit integer multiply
+ 2) Mispredicted branches (penalty mostly depends from pipeline length)
+ 3) 32-bit shift and arithmetic operations
+
+The speed of LZMA decompressing mostly depends from CPU speed.
+Memory speed has no big meaning. But if your CPU has small data cache,
+overall weight of memory speed will slightly increase.
+
+
+How To Use
+----------
+
+Using LZMA encoder/decoder executable
+--------------------------------------
+
+Usage: LZMA <e|d> inputFile outputFile [<switches>...]
+
+ e: encode file
+
+ d: decode file
+
+ b: Benchmark. There are two tests: compressing and decompressing
+ with LZMA method. Benchmark shows rating in MIPS (million
+ instructions per second). Rating value is calculated from
+ measured speed and it is normalized with Intel's Core 2 results.
+ Also Benchmark checks possible hardware errors (RAM
+ errors in most cases). Benchmark uses these settings:
+ (-a1, -d21, -fb32, -mfbt4). You can change only -d parameter.
+ Also you can change the number of iterations. Example for 30 iterations:
+ LZMA b 30
+ Default number of iterations is 10.
+
+<Switches>
+
+
+ -a{N}: set compression mode 0 = fast, 1 = normal
+ default: 1 (normal)
+
+ d{N}: Sets Dictionary size - [0, 30], default: 23 (8MB)
+ The maximum value for dictionary size is 1 GB = 2^30 bytes.
+ Dictionary size is calculated as DictionarySize = 2^N bytes.
+ For decompressing file compressed by LZMA method with dictionary
+ size D = 2^N you need about D bytes of memory (RAM).
+
+ -fb{N}: set number of fast bytes - [5, 273], default: 128
+ Usually big number gives a little bit better compression ratio
+ and slower compression process.
+
+ -lc{N}: set number of literal context bits - [0, 8], default: 3
+ Sometimes lc=4 gives gain for big files.
+
+ -lp{N}: set number of literal pos bits - [0, 4], default: 0
+ lp switch is intended for periodical data when period is
+ equal 2^N. For example, for 32-bit (4 bytes)
+ periodical data you can use lp=2. Often it's better to set lc0,
+ if you change lp switch.
+
+ -pb{N}: set number of pos bits - [0, 4], default: 2
+ pb switch is intended for periodical data
+ when period is equal 2^N.
+
+ -mf{MF_ID}: set Match Finder. Default: bt4.
+ Algorithms from hc* group doesn't provide good compression
+ ratio, but they often works pretty fast in combination with
+ fast mode (-a0).
+
+ Memory requirements depend from dictionary size
+ (parameter "d" in table below).
+
+ MF_ID Memory Description
+
+ bt2 d * 9.5 + 4MB Binary Tree with 2 bytes hashing.
+ bt3 d * 11.5 + 4MB Binary Tree with 3 bytes hashing.
+ bt4 d * 11.5 + 4MB Binary Tree with 4 bytes hashing.
+ hc4 d * 7.5 + 4MB Hash Chain with 4 bytes hashing.
+
+ -eos: write End Of Stream marker. By default LZMA doesn't write
+ eos marker, since LZMA decoder knows uncompressed size
+ stored in .lzma file header.
+
+ -si: Read data from stdin (it will write End Of Stream marker).
+ -so: Write data to stdout
+
+
+Examples:
+
+1) LZMA e file.bin file.lzma -d16 -lc0
+
+compresses file.bin to file.lzma with 64 KB dictionary (2^16=64K)
+and 0 literal context bits. -lc0 allows to reduce memory requirements
+for decompression.
+
+
+2) LZMA e file.bin file.lzma -lc0 -lp2
+
+compresses file.bin to file.lzma with settings suitable
+for 32-bit periodical data (for example, ARM or MIPS code).
+
+3) LZMA d file.lzma file.bin
+
+decompresses file.lzma to file.bin.
+
+
+Compression ratio hints
+-----------------------
+
+Recommendations
+---------------
+
+To increase the compression ratio for LZMA compressing it's desirable
+to have aligned data (if it's possible) and also it's desirable to locate
+data in such order, where code is grouped in one place and data is
+grouped in other place (it's better than such mixing: code, data, code,
+data, ...).
+
+
+Filters
+-------
+You can increase the compression ratio for some data types, using
+special filters before compressing. For example, it's possible to
+increase the compression ratio on 5-10% for code for those CPU ISAs:
+x86, IA-64, ARM, ARM-Thumb, PowerPC, SPARC.
+
+You can find C source code of such filters in C/Bra*.* files
+
+You can check the compression ratio gain of these filters with such
+7-Zip commands (example for ARM code):
+No filter:
+ 7z a a1.7z a.bin -m0=lzma
+
+With filter for little-endian ARM code:
+ 7z a a2.7z a.bin -m0=arm -m1=lzma
+
+It works in such manner:
+Compressing = Filter_encoding + LZMA_encoding
+Decompressing = LZMA_decoding + Filter_decoding
+
+Compressing and decompressing speed of such filters is very high,
+so it will not increase decompressing time too much.
+Moreover, it reduces decompression time for LZMA_decoding,
+since compression ratio with filtering is higher.
+
+These filters convert CALL (calling procedure) instructions
+from relative offsets to absolute addresses, so such data becomes more
+compressible.
+
+For some ISAs (for example, for MIPS) it's impossible to get gain from such filter.
+
+
+
+---
+
+http://www.7-zip.org
+http://www.7-zip.org/sdk.html
+http://www.7-zip.org/support.html
diff --git a/roms/edk2/BaseTools/Source/C/Makefile b/roms/edk2/BaseTools/Source/C/Makefile
new file mode 100644
index 000000000..e8f8abe59
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Makefile
@@ -0,0 +1,70 @@
+## @file
+# Windows makefile for C tools build.
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+HOST_ARCH = IA32
+
+!INCLUDE Makefiles\ms.common
+
+LIBRARIES = Common
+APPLICATIONS = \
+ VfrCompile \
+ BrotliCompress \
+ EfiRom \
+ GenCrc32 \
+ GenFfs \
+ GenFv \
+ GenFw \
+ GenSec \
+ LzmaCompress \
+ Split \
+ TianoCompress \
+ VolInfo \
+ DevicePath
+
+all: libs apps install
+
+libs: $(LIBRARIES)
+ @echo.
+ @echo ######################
+ @echo # Build libraries
+ @echo ######################
+ @if not exist $(LIB_PATH) mkdir $(LIB_PATH)
+ @if defined PYTHON_COMMAND $(PYTHON_COMMAND) Makefiles\NmakeSubdirs.py all $**
+ @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py all $**
+
+apps: $(APPLICATIONS)
+ @echo.
+ @echo ######################
+ @echo # Build executables
+ @echo ######################
+ @if not exist $(BIN_PATH) mkdir $(BIN_PATH)
+ @if defined PYTHON_COMMAND $(PYTHON_COMMAND) Makefiles\NmakeSubdirs.py all $**
+ @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py all $**
+
+install: $(LIB_PATH) $(BIN_PATH)
+ @echo.
+ @echo ######################
+ @echo # Install to $(SYS_LIB_PATH)
+ @echo # Install to $(SYS_BIN_PATH)
+ @echo ######################
+ @-xcopy $(LIB_PATH)\*.lib $(SYS_LIB_PATH) /I /D /E /F /Y > NUL 2>&1
+ @-xcopy $(BIN_PATH)\*.exe $(SYS_BIN_PATH) /I /D /E /F /Y > NUL 2>&1
+ @-xcopy $(BIN_PATH)\*.bat $(SYS_BIN_PATH) /I /D /E /F /Y > NUL 2>&1
+
+.PHONY: clean
+clean:
+ @if defined PYTHON_COMMAND $(PYTHON_COMMAND) Makefiles\NmakeSubdirs.py clean $(LIBRARIES) $(APPLICATIONS)
+ @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py clean $(LIBRARIES) $(APPLICATIONS)
+
+.PHONY: cleanall
+cleanall:
+ @if defined PYTHON_COMMAND $(PYTHON_COMMAND) Makefiles\NmakeSubdirs.py cleanall $(LIBRARIES) $(APPLICATIONS)
+ @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py cleanall $(LIBRARIES) $(APPLICATIONS)
+# Next line protects the libs pseudo target from inadvertent GNU make activity
+ if exist libs RMDIR /S /Q libs
+
+!INCLUDE Makefiles\ms.rule
+
diff --git a/roms/edk2/BaseTools/Source/C/Makefiles/NmakeSubdirs.bat b/roms/edk2/BaseTools/Source/C/Makefiles/NmakeSubdirs.bat
new file mode 100644
index 000000000..2ea3cf8a5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Makefiles/NmakeSubdirs.bat
@@ -0,0 +1,40 @@
+@REM ## @file
+@REM # Makefile
+@REM #
+@REM # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+@REM # SPDX-License-Identifier: BSD-2-Clause-Patent
+@REM #
+
+@echo off
+setlocal
+set TOOL_ERROR=0
+SET NMAKE_COMMAND=%1
+SHIFT
+
+:loop
+if "%1"=="" goto success
+
+ECHO Building %1
+pushd %1
+nmake %NMAKE_COMMAND%
+if ERRORLEVEL 1 (
+ set /A TOOL_ERROR= %TOOL_ERROR% + %ERRORLEVEL%
+ goto error
+)
+ECHO %1 built successfully (%NMAKE_COMMAND%)
+ECHO.
+shift
+popd
+goto loop
+
+:success
+goto exit
+
+:error
+popd
+set /A TOOL_ERROR=%TOOL_ERROR%+%ERRORLEVEL%
+ECHO Error while making %1!
+VERIFY OTHER 2>NUL
+
+:exit
+exit /B %TOOL_ERROR%
diff --git a/roms/edk2/BaseTools/Source/C/Makefiles/NmakeSubdirs.py b/roms/edk2/BaseTools/Source/C/Makefiles/NmakeSubdirs.py
new file mode 100644
index 000000000..9b699ea08
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Makefiles/NmakeSubdirs.py
@@ -0,0 +1,163 @@
+# @file NmakeSubdirs.py
+# This script support parallel build for nmake in windows environment.
+# It supports Python2.x and Python3.x both.
+#
+# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+#
+# Import Modules
+#
+
+from __future__ import print_function
+import argparse
+import threading
+import time
+import os
+import subprocess
+import multiprocessing
+import copy
+import sys
+__prog__ = 'NmakeSubdirs'
+__version__ = '%s Version %s' % (__prog__, '0.10 ')
+__copyright__ = 'Copyright (c) 2018, Intel Corporation. All rights reserved.'
+__description__ = 'Replace for NmakeSubdirs.bat in windows ,support parallel build for nmake.\n'
+
+cpu_count = multiprocessing.cpu_count()
+output_lock = threading.Lock()
+def RunCommand(WorkDir=None, *Args, **kwargs):
+ if WorkDir is None:
+ WorkDir = os.curdir
+ if "stderr" not in kwargs:
+ kwargs["stderr"] = subprocess.STDOUT
+ if "stdout" not in kwargs:
+ kwargs["stdout"] = subprocess.PIPE
+ p = subprocess.Popen(Args, cwd=WorkDir, stderr=kwargs["stderr"], stdout=kwargs["stdout"])
+ stdout, stderr = p.communicate()
+ message = ""
+ if stdout is not None:
+ message = stdout.decode(errors='ignore') #for compatibility in python 2 and 3
+
+ if p.returncode != 0:
+ raise RuntimeError("Error while execute command \'{0}\' in direcotry {1}\n{2}".format(" ".join(Args), WorkDir, message))
+
+ output_lock.acquire(True)
+ print("execute command \"{0}\" in directory {1}".format(" ".join(Args), WorkDir))
+ print(message)
+ output_lock.release()
+
+ return p.returncode, stdout
+
+class TaskUnit(object):
+ def __init__(self, func, args, kwargs):
+ self.func = func
+ self.args = args
+ self.kwargs = kwargs
+
+ def __eq__(self, other):
+ return id(self).__eq__(id(other))
+
+ def run(self):
+ return self.func(*self.args, **self.kwargs)
+
+ def __str__(self):
+ para = list(self.args)
+ para.extend("{0}={1}".format(k, v)for k, v in self.kwargs.items())
+
+ return "{0}({1})".format(self.func.__name__, ",".join(para))
+
+class ThreadControl(object):
+
+ def __init__(self, maxthread):
+ self._processNum = maxthread
+ self.pending = []
+ self.running = []
+ self.pendingLock = threading.Lock()
+ self.runningLock = threading.Lock()
+ self.error = False
+ self.errorLock = threading.Lock()
+ self.errorMsg = "errorMsg"
+
+ def addTask(self, func, *args, **kwargs):
+ self.pending.append(TaskUnit(func, args, kwargs))
+
+ def waitComplete(self):
+ self._schedule.join()
+
+ def startSchedule(self):
+ self._schedule = threading.Thread(target=self.Schedule)
+ self._schedule.start()
+
+ def Schedule(self):
+ for i in range(self._processNum):
+ task = threading.Thread(target=self.startTask)
+ task.daemon = False
+ self.running.append(task)
+
+ self.runningLock.acquire(True)
+ for thread in self.running:
+ thread.start()
+ self.runningLock.release()
+
+ while len(self.running) > 0:
+ time.sleep(0.1)
+ if self.error:
+ print("subprocess not exit successfully")
+ print(self.errorMsg)
+
+ def startTask(self):
+ while True:
+ if self.error:
+ break
+ self.pendingLock.acquire(True)
+ if len(self.pending) == 0:
+ self.pendingLock.release()
+ break
+ task = self.pending.pop(0)
+ self.pendingLock.release()
+ try:
+ task.run()
+ except RuntimeError as e:
+ if self.error: break
+ self.errorLock.acquire(True)
+ self.error = True
+ self.errorMsg = str(e)
+ time.sleep(0.1)
+ self.errorLock.release()
+ break
+
+ self.runningLock.acquire(True)
+ self.running.remove(threading.currentThread())
+ self.runningLock.release()
+
+def Run():
+ curdir = os.path.abspath(os.curdir)
+ if len(args.subdirs) == 1:
+ args.jobs = 1
+ if args.jobs == 1:
+ try:
+ for dir in args.subdirs:
+ RunCommand(os.path.join(curdir, dir), "nmake", args.target, stdout=sys.stdout, stderr=subprocess.STDOUT)
+ except RuntimeError:
+ exit(1)
+ else:
+ controller = ThreadControl(args.jobs)
+ for dir in args.subdirs:
+ controller.addTask(RunCommand, os.path.join(curdir, dir), "nmake", args.target)
+ controller.startSchedule()
+ controller.waitComplete()
+ if controller.error:
+ exit(1)
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(prog=__prog__, description=__description__ + __copyright__, conflict_handler='resolve')
+
+ parser.add_argument("target", help="the target for nmake")
+ parser.add_argument("subdirs", nargs="+", help="the relative dir path of makefile")
+ parser.add_argument("--jobs", type=int, dest="jobs", default=cpu_count, help="thread number")
+ parser.add_argument('--version', action='version', version=__version__)
+ args = parser.parse_args()
+ Run()
+
diff --git a/roms/edk2/BaseTools/Source/C/Makefiles/app.makefile b/roms/edk2/BaseTools/Source/C/Makefiles/app.makefile
new file mode 100644
index 000000000..6a2a8f5e8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Makefiles/app.makefile
@@ -0,0 +1,22 @@
+## @file
+# Makefiles
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+MAKEROOT ?= ../..
+
+include $(MAKEROOT)/Makefiles/header.makefile
+
+APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
+
+.PHONY:all
+all: $(MAKEROOT)/bin $(APPLICATION)
+
+$(APPLICATION): $(OBJECTS)
+ $(LINKER) -o $(APPLICATION) $(BUILD_LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS)
+
+$(OBJECTS): $(MAKEROOT)/Include/Common/BuildVersion.h
+
+include $(MAKEROOT)/Makefiles/footer.makefile
diff --git a/roms/edk2/BaseTools/Source/C/Makefiles/footer.makefile b/roms/edk2/BaseTools/Source/C/Makefiles/footer.makefile
new file mode 100644
index 000000000..85c337422
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Makefiles/footer.makefile
@@ -0,0 +1,30 @@
+## @file
+# Makefile
+#
+# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+DEPFILES = $(OBJECTS:%.o=%.d)
+
+$(MAKEROOT)/libs-$(HOST_ARCH):
+ mkdir -p $(MAKEROOT)/libs-$(HOST_ARCH)
+
+.PHONY: install
+install: $(MAKEROOT)/libs-$(HOST_ARCH) $(LIBRARY)
+ cp $(LIBRARY) $(MAKEROOT)/libs-$(HOST_ARCH)
+
+$(LIBRARY): $(OBJECTS)
+ $(BUILD_AR) crs $@ $^
+
+%.o : %.c
+ $(BUILD_CC) -c $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) $< -o $@
+
+%.o : %.cpp
+ $(BUILD_CXX) -c $(BUILD_CPPFLAGS) $(BUILD_CXXFLAGS) $< -o $@
+
+.PHONY: clean
+clean:
+ @rm -f $(OBJECTS) $(LIBRARY) $(DEPFILES)
+
+-include $(DEPFILES)
diff --git a/roms/edk2/BaseTools/Source/C/Makefiles/header.makefile b/roms/edk2/BaseTools/Source/C/Makefiles/header.makefile
new file mode 100644
index 000000000..1c105ee7d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Makefiles/header.makefile
@@ -0,0 +1,131 @@
+## @file
+#
+# The makefile can be invoked with
+# HOST_ARCH = x86_64 or x64 for EM64T build
+# HOST_ARCH = ia32 or IA32 for IA32 build
+# HOST_ARCH = Arm or ARM for ARM build
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ifndef HOST_ARCH
+ #
+ # If HOST_ARCH is not defined, then we use 'uname -m' to attempt
+ # try to figure out the appropriate HOST_ARCH.
+ #
+ uname_m = $(shell uname -m)
+ $(info Attempting to detect HOST_ARCH from 'uname -m': $(uname_m))
+ ifneq (,$(strip $(filter $(uname_m), x86_64 amd64)))
+ HOST_ARCH=X64
+ endif
+ ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)
+ HOST_ARCH=IA32
+ endif
+ ifneq (,$(findstring aarch64,$(uname_m)))
+ HOST_ARCH=AARCH64
+ else ifneq (,$(findstring arm64,$(uname_m)))
+ HOST_ARCH=AARCH64
+ else ifneq (,$(findstring arm,$(uname_m)))
+ HOST_ARCH=ARM
+ endif
+ ifndef HOST_ARCH
+ $(info Could not detected HOST_ARCH from uname results)
+ $(error HOST_ARCH is not defined!)
+ endif
+ $(info Detected HOST_ARCH of $(HOST_ARCH) using uname.)
+endif
+
+CYGWIN:=$(findstring CYGWIN, $(shell uname -s))
+LINUX:=$(findstring Linux, $(shell uname -s))
+DARWIN:=$(findstring Darwin, $(shell uname -s))
+ifeq ($(CXX), llvm)
+BUILD_CC ?= $(CLANG_BIN)clang
+BUILD_CXX ?= $(CLANG_BIN)clang++
+BUILD_AS ?= $(CLANG_BIN)clang
+BUILD_AR ?= $(CLANG_BIN)llvm-ar
+BUILD_LD ?= $(CLANG_BIN)llvm-ld
+else
+BUILD_CC ?= gcc
+BUILD_CXX ?= g++
+BUILD_AS ?= gcc
+BUILD_AR ?= ar
+BUILD_LD ?= ld
+endif
+LINKER ?= $(BUILD_CC)
+ifeq ($(HOST_ARCH), IA32)
+ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/
+
+else ifeq ($(HOST_ARCH), X64)
+ARCH_INCLUDE = -I $(MAKEROOT)/Include/X64/
+
+else ifeq ($(HOST_ARCH), ARM)
+ARCH_INCLUDE = -I $(MAKEROOT)/Include/Arm/
+
+else ifeq ($(HOST_ARCH), AARCH64)
+ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/
+
+else
+$(error Bad HOST_ARCH)
+endif
+
+INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
+BUILD_CPPFLAGS = $(INCLUDE)
+
+# keep EXTRA_OPTFLAGS last
+BUILD_OPTFLAGS = -O2 $(EXTRA_OPTFLAGS)
+
+ifeq ($(DARWIN),Darwin)
+# assume clang or clang compatible flags on OS X
+BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \
+-Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -g
+else
+ifeq ($(CXX), llvm)
+BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
+-fno-delete-null-pointer-checks -Wall -Werror \
+-Wno-deprecated-declarations -Wno-self-assign \
+-Wno-unused-result -nostdlib -g
+else
+BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
+-fno-delete-null-pointer-checks -Wall -Werror \
+-Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict \
+-Wno-unused-result -nostdlib -g
+endif
+endif
+ifeq ($(CXX), llvm)
+BUILD_LFLAGS =
+BUILD_CXXFLAGS = -Wno-deprecated-register -Wno-unused-result
+else
+BUILD_LFLAGS =
+BUILD_CXXFLAGS = -Wno-unused-result
+endif
+ifeq ($(HOST_ARCH), IA32)
+#
+# Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults
+# to x86_64. So make sure tools match uname -m. You can manual have a 64-bit kernal on Snow Leopard
+# so only do this is uname -m returns i386.
+#
+ifeq ($(DARWIN),Darwin)
+ BUILD_CFLAGS += -arch i386
+ BUILD_CPPFLAGS += -arch i386
+ BUILD_LFLAGS += -arch i386
+endif
+endif
+
+# keep BUILD_OPTFLAGS last
+BUILD_CFLAGS += $(BUILD_OPTFLAGS)
+BUILD_CXXFLAGS += $(BUILD_OPTFLAGS)
+
+# keep EXTRA_LDFLAGS last
+BUILD_LFLAGS += $(EXTRA_LDFLAGS)
+
+.PHONY: all
+.PHONY: install
+.PHONY: clean
+
+all:
+
+$(MAKEROOT)/libs:
+ mkdir $(MAKEROOT)/libs
+
+$(MAKEROOT)/bin:
+ mkdir $(MAKEROOT)/bin
diff --git a/roms/edk2/BaseTools/Source/C/Makefiles/lib.makefile b/roms/edk2/BaseTools/Source/C/Makefiles/lib.makefile
new file mode 100644
index 000000000..2577c1538
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Makefiles/lib.makefile
@@ -0,0 +1,14 @@
+## @file
+# Makefiles
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+include $(MAKEROOT)/Makefiles/header.makefile
+
+LIBRARY = $(MAKEROOT)/libs/lib$(LIBNAME).a
+
+all: $(MAKEROOT)/libs $(LIBRARY)
+
+include $(MAKEROOT)/Makefiles/footer.makefile
diff --git a/roms/edk2/BaseTools/Source/C/Makefiles/ms.app b/roms/edk2/BaseTools/Source/C/Makefiles/ms.app
new file mode 100644
index 000000000..aecae3739
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Makefiles/ms.app
@@ -0,0 +1,28 @@
+## @file
+# Makefile
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+APPLICATION = $(BIN_PATH)\$(APPNAME).exe
+
+all: $(APPLICATION)
+
+$(APPLICATION) : $(OBJECTS)
+ -@if not exist $(BIN_PATH) mkdir $(BIN_PATH)
+ $(LD) /nologo /debug /OPT:REF /OPT:ICF=10 /incremental:no /nodefaultlib:libc.lib /out:$@ $(LIBS) $**
+
+$(OBJECTS) : $(SOURCE_PATH)\Include\Common\BuildVersion.h
+
+.PHONY:clean
+.PHONY:cleanall
+
+clean:
+ del /f /q $(OBJECTS) *.pdb > nul
+
+cleanall:
+ del /f /q $(OBJECTS) $(APPLICATION) *.pdb $(BIN_PATH)\$(APPNAME).pdb > nul
+
+!INCLUDE $(SOURCE_PATH)\Makefiles\ms.rule
+
diff --git a/roms/edk2/BaseTools/Source/C/Makefiles/ms.common b/roms/edk2/BaseTools/Source/C/Makefiles/ms.common
new file mode 100644
index 000000000..f5f77fdc0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Makefiles/ms.common
@@ -0,0 +1,62 @@
+## @file
+# Makefile
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+!IFNDEF EDK_TOOLS_PATH
+!ERROR "Please set your EDK_TOOLS_PATH!"
+!ENDIF
+
+!IFNDEF BASE_TOOLS_PATH
+!ERROR "BASE_TOOLS_PATH is not set! Please run build_tools.bat at first!"
+!ENDIF
+
+!IFNDEF HOST_ARCH
+HOST_ARCH = IA32
+!ENDIF
+
+MAKE = nmake -nologo
+
+# DOS del command doesn't support ":\\" in the file path, such as j:\\BaseTools. Convert ":\\" to ":\"
+BASE_TOOLS_PATH = $(BASE_TOOLS_PATH::\\=:\)
+EDK_TOOLS_PATH = $(EDK_TOOLS_PATH::\\=:\)
+
+SOURCE_PATH = $(BASE_TOOLS_PATH)\Source\C
+BIN_PATH = $(BASE_TOOLS_PATH)\Bin
+LIB_PATH = $(BASE_TOOLS_PATH)\Lib
+
+SYS_BIN_PATH=$(EDK_TOOLS_PATH)\Bin
+SYS_LIB_PATH=$(EDK_TOOLS_PATH)\Lib
+
+!IF "$(HOST_ARCH)"=="IA32"
+ARCH_INCLUDE = $(SOURCE_PATH)\Include\Ia32
+BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32
+LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32
+SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32
+SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32
+
+!ELSEIF "$(HOST_ARCH)"=="X64"
+ARCH_INCLUDE = $(SOURCE_PATH)\Include\X64
+BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64
+LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
+SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
+SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64
+
+!ELSE
+!ERROR "Bad HOST_ARCH"
+!ENDIF
+
+CC = cl.exe
+CXX = cl.exe
+AS = ml.exe
+AR = lib.exe
+LD = link.exe
+LINKER = $(LD)
+
+INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC)
+
+CFLAGS = $(CFLAGS) /nologo /Zi /c /O2 /MT /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
+CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /Zi /c /O2 /MT /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
+
diff --git a/roms/edk2/BaseTools/Source/C/Makefiles/ms.lib b/roms/edk2/BaseTools/Source/C/Makefiles/ms.lib
new file mode 100644
index 000000000..ebb516535
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Makefiles/ms.lib
@@ -0,0 +1,25 @@
+## @file
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+!INCLUDE ..\Makefiles\ms.common
+
+LIBRARY = $(LIB_PATH)\$(LIBNAME).lib
+
+all: $(LIBRARY)
+
+$(LIBRARY) : $(OBJECTS)
+ -@if not exist $(LIB_PATH) mkdir $(LIB_PATH)
+ $(AR) /nologo /out:$@ $**
+
+.PHONY:clean
+clean:
+ del /f /q $(OBJECTS) *.pdb > nul
+
+.PHONY:cleanall
+cleanall:
+ del /f /q $(OBJECTS) $(LIBRARY) *.pdb > nul
+
+!INCLUDE ..\Makefiles\ms.rule
+
diff --git a/roms/edk2/BaseTools/Source/C/Makefiles/ms.rule b/roms/edk2/BaseTools/Source/C/Makefiles/ms.rule
new file mode 100644
index 000000000..7d53316c4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Makefiles/ms.rule
@@ -0,0 +1,20 @@
+## @file
+# Makefile
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+#DEPFILES = $(OBJECTS:%.o=%.d)
+
+.c.obj :
+ $(CC) -c $(CFLAGS) $(INC) $< -Fo$@
+
+.S.obj :
+ $(AS) -c $(ASFLAGS) $< -Fo$@
+
+.cpp.obj :
+ $(CXX) -c $(CPPFLAGS) $(INC) $< -Fo$@
+
+#-include $(DEPFILES)
+
diff --git a/roms/edk2/BaseTools/Source/C/PyEfiCompressor/EfiCompressor.c b/roms/edk2/BaseTools/Source/C/PyEfiCompressor/EfiCompressor.c
new file mode 100644
index 000000000..74ca2cfc1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/PyEfiCompressor/EfiCompressor.c
@@ -0,0 +1,206 @@
+/** @file
+Efi Compressor
+
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Python.h>
+#include <Decompress.h>
+
+/*
+ UefiDecompress(data_buffer, size, original_size)
+*/
+STATIC
+PyObject*
+UefiDecompress(
+ PyObject *Self,
+ PyObject *Args
+ )
+{
+ PyObject *SrcData;
+ UINT32 SrcDataSize;
+ UINT32 DstDataSize;
+ UINTN Status;
+ UINT8 *SrcBuf;
+ UINT8 *DstBuf;
+ UINT8 *TmpBuf;
+ Py_ssize_t SegNum;
+ Py_ssize_t Index;
+
+ Status = PyArg_ParseTuple(
+ Args,
+ "Oi",
+ &SrcData,
+ &SrcDataSize
+ );
+ if (Status == 0) {
+ return NULL;
+ }
+
+ if (SrcData->ob_type->tp_as_buffer == NULL
+ || SrcData->ob_type->tp_as_buffer->bf_getreadbuffer == NULL
+ || SrcData->ob_type->tp_as_buffer->bf_getsegcount == NULL) {
+ PyErr_SetString(PyExc_Exception, "First argument is not a buffer\n");
+ return NULL;
+ }
+
+ // Because some Python objects which support "buffer" protocol have more than one
+ // memory segment, we have to copy them into a contiguous memory.
+ SrcBuf = PyMem_Malloc(SrcDataSize);
+ if (SrcBuf == NULL) {
+ PyErr_SetString(PyExc_Exception, "Not enough memory\n");
+ goto ERROR;
+ }
+
+ SegNum = SrcData->ob_type->tp_as_buffer->bf_getsegcount((PyObject *)SrcData, NULL);
+ TmpBuf = SrcBuf;
+ for (Index = 0; Index < SegNum; ++Index) {
+ VOID *BufSeg;
+ Py_ssize_t Len;
+
+ Len = SrcData->ob_type->tp_as_buffer->bf_getreadbuffer((PyObject *)SrcData, Index, &BufSeg);
+ if (Len < 0) {
+ PyErr_SetString(PyExc_Exception, "Buffer segment is not available\n");
+ goto ERROR;
+ }
+ memcpy(TmpBuf, BufSeg, Len);
+ TmpBuf += Len;
+ }
+
+ Status = Extract((VOID *)SrcBuf, SrcDataSize, (VOID **)&DstBuf, &DstDataSize, 1);
+ if (Status != EFI_SUCCESS) {
+ PyErr_SetString(PyExc_Exception, "Failed to decompress\n");
+ goto ERROR;
+ }
+
+ return PyBuffer_FromMemory(DstBuf, (Py_ssize_t)DstDataSize);
+
+ERROR:
+ if (SrcBuf != NULL) {
+ free(SrcBuf);
+ }
+
+ if (DstBuf != NULL) {
+ free(DstBuf);
+ }
+ return NULL;
+}
+
+
+STATIC
+PyObject*
+FrameworkDecompress(
+ PyObject *Self,
+ PyObject *Args
+ )
+{
+ PyObject *SrcData;
+ UINT32 SrcDataSize;
+ UINT32 DstDataSize;
+ UINTN Status;
+ UINT8 *SrcBuf;
+ UINT8 *DstBuf;
+ UINT8 *TmpBuf;
+ Py_ssize_t SegNum;
+ Py_ssize_t Index;
+
+ Status = PyArg_ParseTuple(
+ Args,
+ "Oi",
+ &SrcData,
+ &SrcDataSize
+ );
+ if (Status == 0) {
+ return NULL;
+ }
+
+ if (SrcData->ob_type->tp_as_buffer == NULL
+ || SrcData->ob_type->tp_as_buffer->bf_getreadbuffer == NULL
+ || SrcData->ob_type->tp_as_buffer->bf_getsegcount == NULL) {
+ PyErr_SetString(PyExc_Exception, "First argument is not a buffer\n");
+ return NULL;
+ }
+
+ // Because some Python objects which support "buffer" protocol have more than one
+ // memory segment, we have to copy them into a contiguous memory.
+ SrcBuf = PyMem_Malloc(SrcDataSize);
+ if (SrcBuf == NULL) {
+ PyErr_SetString(PyExc_Exception, "Not enough memory\n");
+ goto ERROR;
+ }
+
+ SegNum = SrcData->ob_type->tp_as_buffer->bf_getsegcount((PyObject *)SrcData, NULL);
+ TmpBuf = SrcBuf;
+ for (Index = 0; Index < SegNum; ++Index) {
+ VOID *BufSeg;
+ Py_ssize_t Len;
+
+ Len = SrcData->ob_type->tp_as_buffer->bf_getreadbuffer((PyObject *)SrcData, Index, &BufSeg);
+ if (Len < 0) {
+ PyErr_SetString(PyExc_Exception, "Buffer segment is not available\n");
+ goto ERROR;
+ }
+ memcpy(TmpBuf, BufSeg, Len);
+ TmpBuf += Len;
+ }
+
+ Status = Extract((VOID *)SrcBuf, SrcDataSize, (VOID **)&DstBuf, &DstDataSize, 2);
+ if (Status != EFI_SUCCESS) {
+ PyErr_SetString(PyExc_Exception, "Failed to decompress\n");
+ goto ERROR;
+ }
+
+ return PyString_FromStringAndSize((CONST INT8*)DstBuf, (Py_ssize_t)DstDataSize);
+
+ERROR:
+ if (SrcBuf != NULL) {
+ free(SrcBuf);
+ }
+
+ if (DstBuf != NULL) {
+ free(DstBuf);
+ }
+ return NULL;
+}
+
+
+STATIC
+PyObject*
+UefiCompress(
+ PyObject *Self,
+ PyObject *Args
+ )
+{
+ return NULL;
+}
+
+
+STATIC
+PyObject*
+FrameworkCompress(
+ PyObject *Self,
+ PyObject *Args
+ )
+{
+ return NULL;
+}
+
+STATIC INT8 DecompressDocs[] = "Decompress(): Decompress data using UEFI standard algorithm\n";
+STATIC INT8 CompressDocs[] = "Compress(): Compress data using UEFI standard algorithm\n";
+
+STATIC PyMethodDef EfiCompressor_Funcs[] = {
+ {"UefiDecompress", (PyCFunction)UefiDecompress, METH_VARARGS, DecompressDocs},
+ {"UefiCompress", (PyCFunction)UefiCompress, METH_VARARGS, DecompressDocs},
+ {"FrameworkDecompress", (PyCFunction)FrameworkDecompress, METH_VARARGS, DecompressDocs},
+ {"FrameworkCompress", (PyCFunction)FrameworkCompress, METH_VARARGS, DecompressDocs},
+ {NULL, NULL, 0, NULL}
+};
+
+PyMODINIT_FUNC
+initEfiCompressor(VOID) {
+ Py_InitModule3("EfiCompressor", EfiCompressor_Funcs, "EFI Compression Algorithm Extension Module");
+}
+
+
diff --git a/roms/edk2/BaseTools/Source/C/PyEfiCompressor/Makefile b/roms/edk2/BaseTools/Source/C/PyEfiCompressor/Makefile
new file mode 100644
index 000000000..dd1669cda
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/PyEfiCompressor/Makefile
@@ -0,0 +1,18 @@
+## @file
+# Makefile
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+!INCLUDE ..\Makefiles\ms.common
+
+APPNAME = GenSec
+
+LIBS = $(LIB_PATH)\Common.lib
+
+OBJECTS = GenSec.obj
+
+#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
+
+!INCLUDE ..\Makefiles\ms.app
+
diff --git a/roms/edk2/BaseTools/Source/C/PyEfiCompressor/setup.py b/roms/edk2/BaseTools/Source/C/PyEfiCompressor/setup.py
new file mode 100644
index 000000000..3daf178b5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/PyEfiCompressor/setup.py
@@ -0,0 +1,37 @@
+## @file
+# package and install PyEfiCompressor extension
+#
+# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from distutils.core import setup, Extension
+import os
+
+if 'BASE_TOOLS_PATH' not in os.environ:
+ raise "Please define BASE_TOOLS_PATH to the root of base tools tree"
+
+BaseToolsDir = os.environ['BASE_TOOLS_PATH']
+setup(
+ name="EfiCompressor",
+ version="0.01",
+ ext_modules=[
+ Extension(
+ 'EfiCompressor',
+ sources=[
+ os.path.join(BaseToolsDir, 'Source', 'C', 'Common', 'Decompress.c'),
+ 'EfiCompressor.c'
+ ],
+ include_dirs=[
+ os.path.join(BaseToolsDir, 'Source', 'C', 'Include'),
+ os.path.join(BaseToolsDir, 'Source', 'C', 'Include', 'Ia32'),
+ os.path.join(BaseToolsDir, 'Source', 'C', 'Common')
+ ],
+ )
+ ],
+ )
+
diff --git a/roms/edk2/BaseTools/Source/C/Split/GNUmakefile b/roms/edk2/BaseTools/Source/C/Split/GNUmakefile
new file mode 100644
index 000000000..b3d4dff51
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Split/GNUmakefile
@@ -0,0 +1,17 @@
+## @file
+# GNU/Linux makefile for 'Split' module build.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+MAKEROOT ?= ..
+
+APPNAME = Split
+
+OBJECTS = Split.o
+
+include $(MAKEROOT)/Makefiles/app.makefile
+
+LIBS = -lCommon
+
+
diff --git a/roms/edk2/BaseTools/Source/C/Split/Makefile b/roms/edk2/BaseTools/Source/C/Split/Makefile
new file mode 100644
index 000000000..19d3e31a7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Split/Makefile
@@ -0,0 +1,16 @@
+## @file
+# Windows makefile for 'Split' module build.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+APPNAME = Split
+
+LIBS = $(LIB_PATH)\Common.lib
+
+OBJECTS = Split.obj
+
+!INCLUDE ..\Makefiles\ms.app
+
diff --git a/roms/edk2/BaseTools/Source/C/Split/Split.c b/roms/edk2/BaseTools/Source/C/Split/Split.c
new file mode 100644
index 000000000..be0ee124b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/Split/Split.c
@@ -0,0 +1,466 @@
+/** @file
+
+ Split a file into two pieces at the request offset.
+
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+// GC_TODO: fix comment to start with /*++
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#ifdef __GNUC__
+#include <unistd.h>
+#else
+#include <direct.h>
+#endif
+#include <ctype.h>
+#include "ParseInf.h"
+#include "CommonLib.h"
+#include "EfiUtilityMsgs.h"
+//
+// Utility Name
+//
+#define UTILITY_NAME "Split"
+
+//
+// Utility version information
+//
+#define UTILITY_MAJOR_VERSION 1
+#define UTILITY_MINOR_VERSION 0
+
+void
+Version (
+ void
+ )
+/*++
+
+Routine Description:
+
+ Displays the standard utility information to SDTOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ printf ("%s Version %d.%d Build %s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
+}
+
+void
+Usage (
+ void
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+
+Returns:
+
+ GC_TODO: add return values
+
+--*/
+{
+ Version();
+ printf ("Copyright (c) 1999-2017 Intel Corporation. All rights reserved.\n");
+ printf ("\n SplitFile creates two Binary files either in the same directory as the current working\n");
+ printf (" directory or in the specified directory.\n");
+ printf ("\nUsage: \n\
+ Split\n\
+ -f, --filename inputFile to split\n\
+ -s, --split VALUE the number of bytes in the first file\n\
+ [-p, --prefix OutputDir]\n\
+ [-o, --firstfile Filename1]\n\
+ [-t, --secondfile Filename2]\n\
+ [-v, --verbose]\n\
+ [--version]\n\
+ [-q, --quiet disable all messages except fatal errors]\n\
+ [-d, --debug[#]\n\
+ [-h, --help]\n");
+}
+
+EFI_STATUS
+GetSplitValue (
+ IN CONST CHAR8* SplitValueString,
+ OUT UINT64 *ReturnValue
+)
+{
+ UINT64 len = 0;
+ UINT64 base = 1;
+ UINT64 index = 0;
+ UINT64 number = 0;
+ CHAR8 lastCHAR = 0;
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ if (SplitValueString != NULL){
+ len = strlen(SplitValueString);
+ }
+
+ if (len == 0) {
+ return EFI_ABORTED;
+ }
+
+ Status = AsciiStringToUint64 (SplitValueString, FALSE, ReturnValue);
+ if (!EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (SplitValueString[0] == '0' && (SplitValueString[1] == 'x' || SplitValueString[1] == 'X')) {
+ Status = AsciiStringToUint64 (SplitValueString, TRUE, ReturnValue);
+ if (!EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ lastCHAR = (CHAR8)toupper((int)SplitValueString[len - 1]);
+
+ if (lastCHAR != 'K' && lastCHAR != 'M' && lastCHAR != 'G') {
+ return STATUS_ERROR;
+ }
+
+ for (;index < len - 1; ++index) {
+ if (!isdigit((int)SplitValueString[index])) {
+ return EFI_ABORTED;
+ }
+ }
+
+ number = atol (SplitValueString);
+ if (lastCHAR == 'K')
+ base = 1024;
+ else if (lastCHAR == 'M')
+ base = 1024*1024;
+ else
+ base = 1024*1024*1024;
+
+ *ReturnValue = number*base;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+CountVerboseLevel (
+ IN CONST CHAR8* VerboseLevelString,
+ IN CONST UINT64 Length,
+ OUT UINT64 *ReturnValue
+)
+{
+ UINT64 i = 0;
+ for (;i < Length; ++i) {
+ if (VerboseLevelString[i] != 'v' && VerboseLevelString[i] != 'V') {
+ return EFI_ABORTED;
+ }
+ ++(*ReturnValue);
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+CreateDir (
+ IN OUT CHAR8** FullFileName
+)
+{
+ CHAR8* temp = *FullFileName;
+ CHAR8* start = temp;
+ CHAR8 tempchar;
+ UINT64 index = 0;
+
+ for (;index < strlen(temp); ++index) {
+ if (temp[index] == '\\' || temp[index] == '/') {
+ if (temp[index + 1] != '\0') {
+ tempchar = temp[index + 1];
+ temp[index + 1] = 0;
+ if (chdir(start)) {
+ if (mkdir(start, S_IRWXU | S_IRWXG | S_IRWXO) != 0) {
+ return EFI_ABORTED;
+ }
+ chdir(start);
+ }
+ start = temp + index + 1;
+ temp[index] = '/';
+ temp[index + 1] = tempchar;
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+int
+main (
+ int argc,
+ char*argv[]
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+ argc - GC_TODO: add argument description
+ ] - GC_TODO: add argument description
+
+Returns:
+
+ GC_TODO: add return values
+
+--*/
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ INTN ReturnStatus = STATUS_SUCCESS;
+ FILE *In;
+ CHAR8 *InputFileName = NULL;
+ CHAR8 *OutputDir = NULL;
+ CHAR8 *OutFileName1 = NULL;
+ CHAR8 *OutFileName2 = NULL;
+ UINT64 SplitValue = (UINT64) -1;
+ FILE *Out1 = NULL;
+ FILE *Out2 = NULL;
+ CHAR8 *OutName1 = NULL;
+ CHAR8 *OutName2 = NULL;
+ CHAR8 *CurrentDir = NULL;
+ UINT64 Index;
+ CHAR8 CharC;
+ UINT64 DebugLevel = 0;
+ UINT64 VerboseLevel = 0;
+
+ SetUtilityName(UTILITY_NAME);
+ if (argc == 1) {
+ Usage();
+ return STATUS_ERROR;
+ }
+
+ argc --;
+ argv ++;
+
+ if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
+ Usage();
+ return STATUS_SUCCESS;
+ }
+
+ if (stricmp (argv[0], "--version") == 0) {
+ Version();
+ return STATUS_SUCCESS;
+ }
+
+ while (argc > 0) {
+ if ((stricmp (argv[0], "-p") == 0) || (stricmp (argv[0], "--prefix") == 0)) {
+ OutputDir = argv[1];
+ if (OutputDir == NULL) {
+ Warning (NULL, 0, 0, "NO output directory specified.", NULL);
+ return STATUS_ERROR;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--filename") == 0)) {
+ InputFileName = argv[1];
+ if (InputFileName == NULL) {
+ Error (NULL, 0, 0x1001, "NO Input file specified.", NULL);
+ return STATUS_ERROR;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--split") == 0)) {
+ Status = GetSplitValue(argv[1], &SplitValue);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0x1003, "Input split value is not one valid integer.", NULL);
+ return STATUS_ERROR;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--firstfile") == 0)) {
+ OutFileName1 = argv[1];
+ if (OutFileName1 == NULL) {
+ Warning (NULL, 0, 0, NULL, "No output file1 specified.");
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-t") == 0) || (stricmp (argv[0], "--secondfile") == 0)) {
+ OutFileName2 = argv[1];
+ if (OutFileName2 == NULL) {
+ Warning (NULL, 0, 0, NULL, "No output file2 specified.");
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((strlen(argv[0]) >= 2 && argv[0][0] == '-' && (argv[0][1] == 'v' || argv[0][1] == 'V')) || (stricmp (argv[0], "--verbose") == 0)) {
+ VerboseLevel = 1;
+ if (strlen(argv[0]) > 2) {
+ Status = CountVerboseLevel (&argv[0][2], strlen(argv[0]) - 2, &VerboseLevel);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0x1003, NULL, "%s is invalid parameter!", argv[0]);
+ return STATUS_ERROR;
+ }
+ }
+
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--debug") == 0)) {
+ Status = AsciiStringToUint64 (argv[1], FALSE, &DebugLevel);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0x1003, "Input debug level is not one valid integrator.", NULL);
+ return STATUS_ERROR;
+ }
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+ //
+ // Don't recognize the parameter.
+ //
+ Error (NULL, 0, 0x1003, NULL, "%s is invalid parameter!", argv[0]);
+ return STATUS_ERROR;
+ }
+
+ if (InputFileName == NULL) {
+ Error (NULL, 0, 0x1001, "NO Input file specified.", NULL);
+ return STATUS_ERROR;
+ }
+
+ In = fopen (LongFilePath (InputFileName), "rb");
+ if (In == NULL) {
+ // ("Unable to open file \"%s\"\n", InputFileName);
+ Error (InputFileName, 0, 1, "File open failure", NULL);
+ return STATUS_ERROR;
+ }
+
+ if (OutFileName1 == NULL) {
+ OutName1 = (CHAR8*)malloc(strlen(InputFileName) + 16);
+ if (OutName1 == NULL) {
+ Warning (NULL, 0, 0, NULL, "Memory Allocation Fail.");
+ ReturnStatus = STATUS_ERROR;
+ goto Finish;
+ }
+ strcpy (OutName1, InputFileName);
+ strcat (OutName1, "1");
+ OutFileName1 = OutName1;
+
+ }
+ if (OutFileName2 == NULL) {
+ OutName2 = (CHAR8*)malloc(strlen(InputFileName) + 16);
+ if (OutName2 == NULL) {
+ Warning (NULL, 0, 0, NULL, "Memory Allocation Fail.");
+ ReturnStatus = STATUS_ERROR;
+ goto Finish;
+ }
+ strcpy (OutName2, InputFileName);
+ strcat (OutName2, "2");
+ OutFileName2 = OutName2;
+
+ }
+
+ if (OutputDir != NULL) {
+ //OutputDirSpecified = TRUE;
+ if (chdir(OutputDir) != 0) {
+ Warning (NULL, 0, 0, NULL, "Change dir to OutputDir Fail.");
+ ReturnStatus = STATUS_ERROR;
+ goto Finish;
+ }
+ }
+
+ CurrentDir = (CHAR8*)getcwd((CHAR8*)0, 0);
+ if (EFI_ERROR(CreateDir(&OutFileName1))) {
+ Error (OutFileName1, 0, 5, "Create Dir for File1 Fail.", NULL);
+ ReturnStatus = STATUS_ERROR;
+ goto Finish;
+ }
+ chdir(CurrentDir);
+
+ if (EFI_ERROR(CreateDir(&OutFileName2))) {
+ Error (OutFileName2, 0, 5, "Create Dir for File2 Fail.", NULL);
+ ReturnStatus = STATUS_ERROR;
+ goto Finish;
+ }
+ chdir(CurrentDir);
+ free(CurrentDir);
+
+ Out1 = fopen (LongFilePath (OutFileName1), "wb");
+ if (Out1 == NULL) {
+ // ("Unable to open file \"%s\"\n", OutFileName1);
+ Error (OutFileName1, 0, 1, "File open failure", NULL);
+ ReturnStatus = STATUS_ERROR;
+ goto Finish;
+ }
+
+ Out2 = fopen (LongFilePath (OutFileName2), "wb");
+ if (Out2 == NULL) {
+ // ("Unable to open file \"%s\"\n", OutFileName2);
+ Error (OutFileName2, 0, 1, "File open failure", NULL);
+ ReturnStatus = STATUS_ERROR;
+ goto Finish;
+ }
+
+ for (Index = 0; Index < SplitValue; Index++) {
+ CharC = (CHAR8) fgetc (In);
+ if (feof (In)) {
+ break;
+ }
+
+ fputc (CharC, Out1);
+ }
+
+ for (;;) {
+ CharC = (CHAR8) fgetc (In);
+ if (feof (In)) {
+ break;
+ }
+
+ fputc (CharC, Out2);
+ }
+
+Finish:
+ if (OutName1 != NULL) {
+ free(OutName1);
+ }
+ if (OutName2 != NULL) {
+ free(OutName2);
+ }
+ if (In != NULL) {
+ fclose (In);
+ }
+ if (Out1 != NULL) {
+ fclose (Out1);
+ }
+ if (Out2 != NULL) {
+ fclose (Out2);
+ }
+
+ return ReturnStatus;
+}
diff --git a/roms/edk2/BaseTools/Source/C/TianoCompress/GNUmakefile b/roms/edk2/BaseTools/Source/C/TianoCompress/GNUmakefile
new file mode 100644
index 000000000..d164d37b3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/TianoCompress/GNUmakefile
@@ -0,0 +1,15 @@
+## @file
+# GNU/Linux makefile for 'TianoCompress' module build.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+MAKEROOT ?= ..
+
+APPNAME = TianoCompress
+
+LIBS = -lCommon
+
+OBJECTS = TianoCompress.o
+
+include $(MAKEROOT)/Makefiles/app.makefile
diff --git a/roms/edk2/BaseTools/Source/C/TianoCompress/Makefile b/roms/edk2/BaseTools/Source/C/TianoCompress/Makefile
new file mode 100644
index 000000000..953695846
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/TianoCompress/Makefile
@@ -0,0 +1,16 @@
+## @file
+# Windows makefile for 'TianoCompress' module build.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+APPNAME = TianoCompress
+
+LIBS = $(LIB_PATH)\Common.lib
+
+OBJECTS = TianoCompress.obj
+
+!INCLUDE ..\Makefiles\ms.app
+
diff --git a/roms/edk2/BaseTools/Source/C/TianoCompress/TianoCompress.c b/roms/edk2/BaseTools/Source/C/TianoCompress/TianoCompress.c
new file mode 100644
index 000000000..56a9f14c8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/TianoCompress/TianoCompress.c
@@ -0,0 +1,2795 @@
+/** @file
+Compression routine. The compression algorithm is a mixture of LZ77 and Huffman
+coding. LZ77 transforms the source data into a sequence of Original Characters
+and Pointers to repeated strings.
+This sequence is further divided into Blocks and Huffman codings are applied to
+each Block.
+
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "Compress.h"
+#include "Decompress.h"
+#include "TianoCompress.h"
+#include "EfiUtilityMsgs.h"
+#include "ParseInf.h"
+#include <stdio.h>
+#include "assert.h"
+
+//
+// Macro Definitions
+//
+static BOOLEAN VerboseMode = FALSE;
+static BOOLEAN QuietMode = FALSE;
+#undef UINT8_MAX
+#define UINT8_MAX 0xff
+#define UINT8_BIT 8
+#define THRESHOLD 3
+#define INIT_CRC 0
+#define WNDBIT 19
+#define WNDSIZ (1U << WNDBIT)
+#define MAXMATCH 256
+#define BLKSIZ (1U << 14) // 16 * 1024U
+#define PERC_FLAG 0x80000000U
+#define CODE_BIT 16
+#define NIL 0
+#define MAX_HASH_VAL (3 * WNDSIZ + (WNDSIZ / 512 + 1) * UINT8_MAX)
+#define HASH(p, c) ((p) + ((c) << (WNDBIT - 9)) + WNDSIZ * 2)
+#define CRCPOLY 0xA001
+#define UPDATE_CRC(c) mCrc = mCrcTable[(mCrc ^ (c)) & 0xFF] ^ (mCrc >> UINT8_BIT)
+
+//
+// C: the Char&Len Set; P: the Position Set; T: the exTra Set
+//
+//#define NC (UINT8_MAX + MAXMATCH + 2 - THRESHOLD)
+#define CBIT 9
+#define NP (WNDBIT + 1)
+#define PBIT 5
+//#define NT (CODE_BIT + 3)
+//#define TBIT 5
+//#if NT > NP
+//#define NPT NT
+//#else
+//#define NPT NP
+//#endif
+
+//
+// Global Variables
+//
+STATIC BOOLEAN ENCODE = FALSE;
+STATIC BOOLEAN DECODE = FALSE;
+STATIC BOOLEAN UEFIMODE = FALSE;
+STATIC UINT8 *mSrc, *mDst, *mSrcUpperLimit, *mDstUpperLimit;
+STATIC UINT8 *mLevel, *mText, *mChildCount, *mBuf, mCLen[NC], mPTLen[NPT], *mLen;
+STATIC INT16 mHeap[NC + 1];
+STATIC INT32 mRemainder, mMatchLen, mBitCount, mHeapSize, mN;
+STATIC UINT32 mBufSiz = 0, mOutputPos, mOutputMask, mSubBitBuf, mCrc;
+STATIC UINT32 mCompSize, mOrigSize;
+
+STATIC UINT16 *mFreq, *mSortPtr, mLenCnt[17], mLeft[2 * NC - 1], mRight[2 * NC - 1], mCrcTable[UINT8_MAX + 1],
+ mCFreq[2 * NC - 1], mCCode[NC], mPFreq[2 * NP - 1], mPTCode[NPT], mTFreq[2 * NT - 1];
+
+STATIC NODE mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL;
+
+static UINT64 DebugLevel;
+static BOOLEAN DebugMode;
+//
+// functions
+//
+EFI_STATUS
+TianoCompress (
+ IN UINT8 *SrcBuffer,
+ IN UINT32 SrcSize,
+ IN UINT8 *DstBuffer,
+ IN OUT UINT32 *DstSize
+ )
+/*++
+
+Routine Description:
+
+ The internal implementation of [Efi/Tiano]Compress().
+
+Arguments:
+
+ SrcBuffer - The buffer storing the source data
+ SrcSize - The size of source data
+ DstBuffer - The buffer to store the compressed data
+
+ Version - The version of de/compression algorithm.
+ Version 1 for EFI 1.1 de/compression algorithm.
+ Version 2 for Tiano de/compression algorithm.
+
+Returns:
+
+ EFI_BUFFER_TOO_SMALL - The DstBuffer is too small. In this case,
+ DstSize contains the size needed.
+ EFI_SUCCESS - Compression is successful.
+ EFI_OUT_OF_RESOURCES - No resource to complete function.
+ EFI_INVALID_PARAMETER - Parameter supplied is wrong.
+
+--*/
+{
+ EFI_STATUS Status;
+
+ //
+ // Initializations
+ //
+ mBufSiz = 0;
+ mBuf = NULL;
+ mText = NULL;
+ mLevel = NULL;
+ mChildCount = NULL;
+ mPosition = NULL;
+ mParent = NULL;
+ mPrev = NULL;
+ mNext = NULL;
+
+
+ mSrc = SrcBuffer;
+ mSrcUpperLimit = mSrc + SrcSize;
+ mDst = DstBuffer;
+ mDstUpperLimit = mDst +*DstSize;
+
+ PutDword (0L);
+ PutDword (0L);
+
+ MakeCrcTable ();
+
+ mOrigSize = mCompSize = 0;
+ mCrc = INIT_CRC;
+
+ //
+ // Compress it
+ //
+ Status = Encode ();
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Null terminate the compressed data
+ //
+
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = 0;
+ }
+
+ //
+ // Fill in compressed size and original size
+ //
+ mDst = DstBuffer;
+
+ PutDword (mCompSize + 1);
+ PutDword (mOrigSize);
+ //
+ // Return
+ //
+
+ if (mCompSize + 1 + 8 > *DstSize) {
+ *DstSize = mCompSize + 1 + 8;
+ return EFI_BUFFER_TOO_SMALL;
+ } else {
+ *DstSize = mCompSize + 1 + 8;
+ return EFI_SUCCESS;
+ }
+}
+
+STATIC
+VOID
+PutDword (
+ IN UINT32 Data
+ )
+/*++
+
+Routine Description:
+
+ Put a dword to output stream
+
+Arguments:
+
+ Data - the dword to put
+
+Returns: (VOID)
+
+--*/
+{
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = (UINT8) (((UINT8) (Data)) & 0xff);
+ }
+
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = (UINT8) (((UINT8) (Data >> 0x08)) & 0xff);
+ }
+
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = (UINT8) (((UINT8) (Data >> 0x10)) & 0xff);
+ }
+
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = (UINT8) (((UINT8) (Data >> 0x18)) & 0xff);
+ }
+}
+
+STATIC
+EFI_STATUS
+AllocateMemory (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Allocate memory spaces for data structures used in compression process
+
+Arguments:
+ VOID
+
+Returns:
+
+ EFI_SUCCESS - Memory is allocated successfully
+ EFI_OUT_OF_RESOURCES - Allocation fails
+
+--*/
+{
+ UINT32 Index;
+
+ mText = malloc (WNDSIZ * 2 + MAXMATCH);
+ if (mText == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return EFI_OUT_OF_RESOURCES;
+ }
+ for (Index = 0; Index < WNDSIZ * 2 + MAXMATCH; Index++) {
+ mText[Index] = 0;
+ }
+
+ mLevel = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mLevel));
+ mChildCount = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mChildCount));
+ mPosition = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mPosition));
+ mParent = malloc (WNDSIZ * 2 * sizeof (*mParent));
+ mPrev = malloc (WNDSIZ * 2 * sizeof (*mPrev));
+ mNext = malloc ((MAX_HASH_VAL + 1) * sizeof (*mNext));
+ if (mLevel == NULL || mChildCount == NULL || mPosition == NULL ||
+ mParent == NULL || mPrev == NULL || mNext == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mBufSiz = BLKSIZ;
+ mBuf = malloc (mBufSiz);
+ while (mBuf == NULL) {
+ mBufSiz = (mBufSiz / 10U) * 9U;
+ if (mBufSiz < 4 * 1024U) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mBuf = malloc (mBufSiz);
+ }
+
+ mBuf[0] = 0;
+
+ return EFI_SUCCESS;
+}
+
+VOID
+FreeMemory (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Called when compression is completed to free memory previously allocated.
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ if (mText != NULL) {
+ free (mText);
+ }
+
+ if (mLevel != NULL) {
+ free (mLevel);
+ }
+
+ if (mChildCount != NULL) {
+ free (mChildCount);
+ }
+
+ if (mPosition != NULL) {
+ free (mPosition);
+ }
+
+ if (mParent != NULL) {
+ free (mParent);
+ }
+
+ if (mPrev != NULL) {
+ free (mPrev);
+ }
+
+ if (mNext != NULL) {
+ free (mNext);
+ }
+
+ if (mBuf != NULL) {
+ free (mBuf);
+ }
+
+ return ;
+}
+
+STATIC
+VOID
+InitSlide (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Initialize String Info Log data structures
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ NODE Index;
+
+ for (Index = WNDSIZ; Index <= WNDSIZ + UINT8_MAX; Index++) {
+ mLevel[Index] = 1;
+ mPosition[Index] = NIL; // sentinel
+ }
+
+ for (Index = WNDSIZ; Index < WNDSIZ * 2; Index++) {
+ mParent[Index] = NIL;
+ }
+
+ mAvail = 1;
+ for (Index = 1; Index < WNDSIZ - 1; Index++) {
+ mNext[Index] = (NODE) (Index + 1);
+ }
+
+ mNext[WNDSIZ - 1] = NIL;
+ for (Index = WNDSIZ * 2; Index <= MAX_HASH_VAL; Index++) {
+ mNext[Index] = NIL;
+ }
+}
+
+STATIC
+NODE
+Child (
+ IN NODE NodeQ,
+ IN UINT8 CharC
+ )
+/*++
+
+Routine Description:
+
+ Find child node given the parent node and the edge character
+
+Arguments:
+
+ NodeQ - the parent node
+ CharC - the edge character
+
+Returns:
+
+ The child node (NIL if not found)
+
+--*/
+{
+ NODE NodeR;
+
+ NodeR = mNext[HASH (NodeQ, CharC)];
+ //
+ // sentinel
+ //
+ mParent[NIL] = NodeQ;
+ while (mParent[NodeR] != NodeQ) {
+ NodeR = mNext[NodeR];
+ }
+
+ return NodeR;
+}
+
+STATIC
+VOID
+MakeChild (
+ IN NODE Parent,
+ IN UINT8 CharC,
+ IN NODE Child
+ )
+/*++
+
+Routine Description:
+
+ Create a new child for a given parent node.
+
+Arguments:
+
+ Parent - the parent node
+ CharC - the edge character
+ Child - the child node
+
+Returns: (VOID)
+
+--*/
+{
+ NODE Node1;
+ NODE Node2;
+
+ Node1 = (NODE) HASH (Parent, CharC);
+ Node2 = mNext[Node1];
+ mNext[Node1] = Child;
+ mNext[Child] = Node2;
+ mPrev[Node2] = Child;
+ mPrev[Child] = Node1;
+ mParent[Child] = Parent;
+ mChildCount[Parent]++;
+}
+
+STATIC
+VOID
+Split (
+ NODE Old
+ )
+/*++
+
+Routine Description:
+
+ Split a node.
+
+Arguments:
+
+ Old - the node to split
+
+Returns: (VOID)
+
+--*/
+{
+ NODE New;
+ NODE TempNode;
+
+ New = mAvail;
+ mAvail = mNext[New];
+ mChildCount[New] = 0;
+ TempNode = mPrev[Old];
+ mPrev[New] = TempNode;
+ mNext[TempNode] = New;
+ TempNode = mNext[Old];
+ mNext[New] = TempNode;
+ mPrev[TempNode] = New;
+ mParent[New] = mParent[Old];
+ mLevel[New] = (UINT8) mMatchLen;
+ mPosition[New] = mPos;
+ MakeChild (New, mText[mMatchPos + mMatchLen], Old);
+ MakeChild (New, mText[mPos + mMatchLen], mPos);
+}
+
+STATIC
+VOID
+InsertNode (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Insert string info for current position into the String Info Log
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ NODE NodeQ;
+ NODE NodeR;
+ NODE Index2;
+ NODE NodeT;
+ UINT8 CharC;
+ UINT8 *t1;
+ UINT8 *t2;
+
+ if (mMatchLen >= 4) {
+ //
+ // We have just got a long match, the target tree
+ // can be located by MatchPos + 1. Traverse the tree
+ // from bottom up to get to a proper starting point.
+ // The usage of PERC_FLAG ensures proper node deletion
+ // in DeleteNode() later.
+ //
+ mMatchLen--;
+ NodeR = (NODE) ((mMatchPos + 1) | WNDSIZ);
+ NodeQ = mParent[NodeR];
+ while (NodeQ == NIL) {
+ NodeR = mNext[NodeR];
+ NodeQ = mParent[NodeR];
+ }
+
+ while (mLevel[NodeQ] >= mMatchLen) {
+ NodeR = NodeQ;
+ NodeQ = mParent[NodeQ];
+ }
+
+ NodeT = NodeQ;
+ while (mPosition[NodeT] < 0) {
+ mPosition[NodeT] = mPos;
+ NodeT = mParent[NodeT];
+ }
+
+ if (NodeT < WNDSIZ) {
+ mPosition[NodeT] = (NODE) (mPos | (UINT32) PERC_FLAG);
+ }
+ } else {
+ //
+ // Locate the target tree
+ //
+ NodeQ = (NODE) (mText[mPos] + WNDSIZ);
+ CharC = mText[mPos + 1];
+ NodeR = Child (NodeQ, CharC);
+ if (NodeR == NIL) {
+ MakeChild (NodeQ, CharC, mPos);
+ mMatchLen = 1;
+ return ;
+ }
+
+ mMatchLen = 2;
+ }
+ //
+ // Traverse down the tree to find a match.
+ // Update Position value along the route.
+ // Node split or creation is involved.
+ //
+ for (;;) {
+ if (NodeR >= WNDSIZ) {
+ Index2 = MAXMATCH;
+ mMatchPos = NodeR;
+ } else {
+ Index2 = mLevel[NodeR];
+ mMatchPos = (NODE) (mPosition[NodeR] & (UINT32)~PERC_FLAG);
+ }
+
+ if (mMatchPos >= mPos) {
+ mMatchPos -= WNDSIZ;
+ }
+
+ t1 = &mText[mPos + mMatchLen];
+ t2 = &mText[mMatchPos + mMatchLen];
+ while (mMatchLen < Index2) {
+ if (*t1 != *t2) {
+ Split (NodeR);
+ return ;
+ }
+
+ mMatchLen++;
+ t1++;
+ t2++;
+ }
+
+ if (mMatchLen >= MAXMATCH) {
+ break;
+ }
+
+ mPosition[NodeR] = mPos;
+ NodeQ = NodeR;
+ NodeR = Child (NodeQ, *t1);
+ if (NodeR == NIL) {
+ MakeChild (NodeQ, *t1, mPos);
+ return ;
+ }
+
+ mMatchLen++;
+ }
+
+ NodeT = mPrev[NodeR];
+ mPrev[mPos] = NodeT;
+ mNext[NodeT] = mPos;
+ NodeT = mNext[NodeR];
+ mNext[mPos] = NodeT;
+ mPrev[NodeT] = mPos;
+ mParent[mPos] = NodeQ;
+ mParent[NodeR] = NIL;
+
+ //
+ // Special usage of 'next'
+ //
+ mNext[NodeR] = mPos;
+
+}
+
+STATIC
+VOID
+DeleteNode (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Delete outdated string info. (The Usage of PERC_FLAG
+ ensures a clean deletion)
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ NODE NodeQ;
+ NODE NodeR;
+ NODE NodeS;
+ NODE NodeT;
+ NODE NodeU;
+
+ if (mParent[mPos] == NIL) {
+ return ;
+ }
+
+ NodeR = mPrev[mPos];
+ NodeS = mNext[mPos];
+ mNext[NodeR] = NodeS;
+ mPrev[NodeS] = NodeR;
+ NodeR = mParent[mPos];
+ mParent[mPos] = NIL;
+ if (NodeR >= WNDSIZ) {
+ return ;
+ }
+
+ mChildCount[NodeR]--;
+ if (mChildCount[NodeR] > 1) {
+ return ;
+ }
+
+ NodeT = (NODE) (mPosition[NodeR] & (UINT32)~PERC_FLAG);
+ if (NodeT >= mPos) {
+ NodeT -= WNDSIZ;
+ }
+
+ NodeS = NodeT;
+ NodeQ = mParent[NodeR];
+ NodeU = mPosition[NodeQ];
+ while (NodeU & (UINT32) PERC_FLAG) {
+ NodeU &= (UINT32)~PERC_FLAG;
+ if (NodeU >= mPos) {
+ NodeU -= WNDSIZ;
+ }
+
+ if (NodeU > NodeS) {
+ NodeS = NodeU;
+ }
+
+ mPosition[NodeQ] = (NODE) (NodeS | WNDSIZ);
+ NodeQ = mParent[NodeQ];
+ NodeU = mPosition[NodeQ];
+ }
+
+ if (NodeQ < WNDSIZ) {
+ if (NodeU >= mPos) {
+ NodeU -= WNDSIZ;
+ }
+
+ if (NodeU > NodeS) {
+ NodeS = NodeU;
+ }
+
+ mPosition[NodeQ] = (NODE) (NodeS | WNDSIZ | (UINT32) PERC_FLAG);
+ }
+
+ NodeS = Child (NodeR, mText[NodeT + mLevel[NodeR]]);
+ NodeT = mPrev[NodeS];
+ NodeU = mNext[NodeS];
+ mNext[NodeT] = NodeU;
+ mPrev[NodeU] = NodeT;
+ NodeT = mPrev[NodeR];
+ mNext[NodeT] = NodeS;
+ mPrev[NodeS] = NodeT;
+ NodeT = mNext[NodeR];
+ mPrev[NodeT] = NodeS;
+ mNext[NodeS] = NodeT;
+ mParent[NodeS] = mParent[NodeR];
+ mParent[NodeR] = NIL;
+ mNext[NodeR] = mAvail;
+ mAvail = NodeR;
+}
+
+STATIC
+VOID
+GetNextMatch (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Advance the current position (read in new data if needed).
+ Delete outdated string info. Find a match string for current position.
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 Number;
+
+ mRemainder--;
+ mPos++;
+ if (mPos == WNDSIZ * 2) {
+ memmove (&mText[0], &mText[WNDSIZ], WNDSIZ + MAXMATCH);
+ Number = FreadCrc (&mText[WNDSIZ + MAXMATCH], WNDSIZ);
+ mRemainder += Number;
+ mPos = WNDSIZ;
+ }
+
+ DeleteNode ();
+ InsertNode ();
+}
+
+STATIC
+EFI_STATUS
+Encode (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ The main controlling routine for compression process.
+
+Arguments: (VOID)
+
+Returns:
+
+ EFI_SUCCESS - The compression is successful
+ EFI_OUT_0F_RESOURCES - Not enough memory for compression process
+
+--*/
+{
+ EFI_STATUS Status;
+ INT32 LastMatchLen;
+ NODE LastMatchPos;
+
+ Status = AllocateMemory ();
+ if (EFI_ERROR (Status)) {
+ FreeMemory ();
+ return Status;
+ }
+
+ InitSlide ();
+
+ HufEncodeStart ();
+
+ mRemainder = FreadCrc (&mText[WNDSIZ], WNDSIZ + MAXMATCH);
+
+ mMatchLen = 0;
+ mPos = WNDSIZ;
+ InsertNode ();
+ if (mMatchLen > mRemainder) {
+ mMatchLen = mRemainder;
+ }
+
+ while (mRemainder > 0) {
+ LastMatchLen = mMatchLen;
+ LastMatchPos = mMatchPos;
+ GetNextMatch ();
+ if (mMatchLen > mRemainder) {
+ mMatchLen = mRemainder;
+ }
+
+ if (mMatchLen > LastMatchLen || LastMatchLen < THRESHOLD) {
+ //
+ // Not enough benefits are gained by outputting a pointer,
+ // so just output the original character
+ //
+ Output (mText[mPos - 1], 0);
+
+ } else {
+
+ if (LastMatchLen == THRESHOLD) {
+ if (((mPos - LastMatchPos - 2) & (WNDSIZ - 1)) > (1U << 11)) {
+ Output (mText[mPos - 1], 0);
+ continue;
+ }
+ }
+ //
+ // Outputting a pointer is beneficial enough, do it.
+ //
+ Output (
+ LastMatchLen + (UINT8_MAX + 1 - THRESHOLD),
+ (mPos - LastMatchPos - 2) & (WNDSIZ - 1)
+ );
+ LastMatchLen--;
+ while (LastMatchLen > 0) {
+ GetNextMatch ();
+ LastMatchLen--;
+ }
+
+ if (mMatchLen > mRemainder) {
+ mMatchLen = mRemainder;
+ }
+ }
+ }
+
+ HufEncodeEnd ();
+ FreeMemory ();
+ return EFI_SUCCESS;
+}
+
+STATIC
+VOID
+CountTFreq (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Count the frequencies for the Extra Set
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 Index;
+ INT32 Index3;
+ INT32 Number;
+ INT32 Count;
+
+ for (Index = 0; Index < NT; Index++) {
+ mTFreq[Index] = 0;
+ }
+
+ Number = NC;
+ while (Number > 0 && mCLen[Number - 1] == 0) {
+ Number--;
+ }
+
+ Index = 0;
+ while (Index < Number) {
+ Index3 = mCLen[Index++];
+ if (Index3 == 0) {
+ Count = 1;
+ while (Index < Number && mCLen[Index] == 0) {
+ Index++;
+ Count++;
+ }
+
+ if (Count <= 2) {
+ mTFreq[0] = (UINT16) (mTFreq[0] + Count);
+ } else if (Count <= 18) {
+ mTFreq[1]++;
+ } else if (Count == 19) {
+ mTFreq[0]++;
+ mTFreq[1]++;
+ } else {
+ mTFreq[2]++;
+ }
+ } else {
+ mTFreq[Index3 + 2]++;
+ }
+ }
+}
+
+STATIC
+VOID
+WritePTLen (
+ IN INT32 Number,
+ IN INT32 nbit,
+ IN INT32 Special
+ )
+/*++
+
+Routine Description:
+
+ Outputs the code length array for the Extra Set or the Position Set.
+
+Arguments:
+
+ Number - the number of symbols
+ nbit - the number of bits needed to represent 'n'
+ Special - the special symbol that needs to be take care of
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 Index;
+ INT32 Index3;
+
+ while (Number > 0 && mPTLen[Number - 1] == 0) {
+ Number--;
+ }
+
+ PutBits (nbit, Number);
+ Index = 0;
+ while (Index < Number) {
+ Index3 = mPTLen[Index++];
+ if (Index3 <= 6) {
+ PutBits (3, Index3);
+ } else {
+ PutBits (Index3 - 3, (1U << (Index3 - 3)) - 2);
+ }
+
+ if (Index == Special) {
+ while (Index < 6 && mPTLen[Index] == 0) {
+ Index++;
+ }
+
+ PutBits (2, (Index - 3) & 3);
+ }
+ }
+}
+
+STATIC
+VOID
+WriteCLen (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Outputs the code length array for Char&Length Set
+
+Arguments: (VOID)
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 Index;
+ INT32 Index3;
+ INT32 Number;
+ INT32 Count;
+
+ Number = NC;
+ while (Number > 0 && mCLen[Number - 1] == 0) {
+ Number--;
+ }
+
+ PutBits (CBIT, Number);
+ Index = 0;
+ while (Index < Number) {
+ Index3 = mCLen[Index++];
+ if (Index3 == 0) {
+ Count = 1;
+ while (Index < Number && mCLen[Index] == 0) {
+ Index++;
+ Count++;
+ }
+
+ if (Count <= 2) {
+ for (Index3 = 0; Index3 < Count; Index3++) {
+ PutBits (mPTLen[0], mPTCode[0]);
+ }
+ } else if (Count <= 18) {
+ PutBits (mPTLen[1], mPTCode[1]);
+ PutBits (4, Count - 3);
+ } else if (Count == 19) {
+ PutBits (mPTLen[0], mPTCode[0]);
+ PutBits (mPTLen[1], mPTCode[1]);
+ PutBits (4, 15);
+ } else {
+ PutBits (mPTLen[2], mPTCode[2]);
+ PutBits (CBIT, Count - 20);
+ }
+ } else {
+ PutBits (mPTLen[Index3 + 2], mPTCode[Index3 + 2]);
+ }
+ }
+}
+
+STATIC
+VOID
+EncodeC (
+ IN INT32 Value
+ )
+{
+ PutBits (mCLen[Value], mCCode[Value]);
+}
+
+STATIC
+VOID
+EncodeP (
+ IN UINT32 Value
+ )
+{
+ UINT32 Index;
+ UINT32 NodeQ;
+
+ Index = 0;
+ NodeQ = Value;
+ while (NodeQ) {
+ NodeQ >>= 1;
+ Index++;
+ }
+
+ PutBits (mPTLen[Index], mPTCode[Index]);
+ if (Index > 1) {
+ PutBits (Index - 1, Value & (0xFFFFFFFFU >> (32 - Index + 1)));
+ }
+}
+
+STATIC
+VOID
+SendBlock (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Huffman code the block and output it.
+
+Arguments:
+ (VOID)
+
+Returns:
+ (VOID)
+
+--*/
+{
+ UINT32 Index;
+ UINT32 Index2;
+ UINT32 Index3;
+ UINT32 Flags;
+ UINT32 Root;
+ UINT32 Pos;
+ UINT32 Size;
+ Flags = 0;
+
+ Root = MakeTree (NC, mCFreq, mCLen, mCCode);
+ Size = mCFreq[Root];
+
+ PutBits (16, Size);
+ if (Root >= NC) {
+ CountTFreq ();
+ Root = MakeTree (NT, mTFreq, mPTLen, mPTCode);
+ if (Root >= NT) {
+ WritePTLen (NT, TBIT, 3);
+ } else {
+ PutBits (TBIT, 0);
+ PutBits (TBIT, Root);
+ }
+
+ WriteCLen ();
+ } else {
+ PutBits (TBIT, 0);
+ PutBits (TBIT, 0);
+ PutBits (CBIT, 0);
+ PutBits (CBIT, Root);
+ }
+
+ Root = MakeTree (NP, mPFreq, mPTLen, mPTCode);
+ if (Root >= NP) {
+ WritePTLen (NP, PBIT, -1);
+ } else {
+ PutBits (PBIT, 0);
+ PutBits (PBIT, Root);
+ }
+
+ Pos = 0;
+ for (Index = 0; Index < Size; Index++) {
+ if (Index % UINT8_BIT == 0) {
+ Flags = mBuf[Pos++];
+ } else {
+ Flags <<= 1;
+ }
+
+ if (Flags & (1U << (UINT8_BIT - 1))) {
+ EncodeC (mBuf[Pos++] + (1U << UINT8_BIT));
+ Index3 = mBuf[Pos++];
+ for (Index2 = 0; Index2 < 3; Index2++) {
+ Index3 <<= UINT8_BIT;
+ Index3 += mBuf[Pos++];
+ }
+
+ EncodeP (Index3);
+ } else {
+ EncodeC (mBuf[Pos++]);
+ }
+ }
+
+ for (Index = 0; Index < NC; Index++) {
+ mCFreq[Index] = 0;
+ }
+
+ for (Index = 0; Index < NP; Index++) {
+ mPFreq[Index] = 0;
+ }
+}
+
+STATIC
+VOID
+Output (
+ IN UINT32 CharC,
+ IN UINT32 Pos
+ )
+/*++
+
+Routine Description:
+
+ Outputs an Original Character or a Pointer
+
+Arguments:
+
+ CharC - The original character or the 'String Length' element of a Pointer
+ Pos - The 'Position' field of a Pointer
+
+Returns: (VOID)
+
+--*/
+{
+ STATIC UINT32 CPos;
+
+ if ((mOutputMask >>= 1) == 0) {
+ mOutputMask = 1U << (UINT8_BIT - 1);
+ //
+ // Check the buffer overflow per outputing UINT8_BIT symbols
+ // which is an Original Character or a Pointer. The biggest
+ // symbol is a Pointer which occupies 5 bytes.
+ //
+ if (mOutputPos >= mBufSiz - 5 * UINT8_BIT) {
+ SendBlock ();
+ mOutputPos = 0;
+ }
+
+ CPos = mOutputPos++;
+ mBuf[CPos] = 0;
+ }
+
+ mBuf[mOutputPos++] = (UINT8) CharC;
+ mCFreq[CharC]++;
+ if (CharC >= (1U << UINT8_BIT)) {
+ mBuf[CPos] |= mOutputMask;
+ mBuf[mOutputPos++] = (UINT8) (Pos >> 24);
+ mBuf[mOutputPos++] = (UINT8) (Pos >> 16);
+ mBuf[mOutputPos++] = (UINT8) (Pos >> (UINT8_BIT));
+ mBuf[mOutputPos++] = (UINT8) Pos;
+ CharC = 0;
+ while (Pos) {
+ Pos >>= 1;
+ CharC++;
+ }
+
+ mPFreq[CharC]++;
+ }
+}
+
+STATIC
+VOID
+HufEncodeStart (
+ VOID
+ )
+{
+ INT32 Index;
+
+ for (Index = 0; Index < NC; Index++) {
+ mCFreq[Index] = 0;
+ }
+
+ for (Index = 0; Index < NP; Index++) {
+ mPFreq[Index] = 0;
+ }
+
+ mOutputPos = mOutputMask = 0;
+ InitPutBits ();
+ return ;
+}
+
+STATIC
+VOID
+HufEncodeEnd (
+ VOID
+ )
+{
+ SendBlock ();
+
+ //
+ // Flush remaining bits
+ //
+ PutBits (UINT8_BIT - 1, 0);
+
+ return ;
+}
+
+STATIC
+VOID
+MakeCrcTable (
+ VOID
+ )
+{
+ UINT32 Index;
+ UINT32 Index2;
+ UINT32 Temp;
+
+ for (Index = 0; Index <= UINT8_MAX; Index++) {
+ Temp = Index;
+ for (Index2 = 0; Index2 < UINT8_BIT; Index2++) {
+ if (Temp & 1) {
+ Temp = (Temp >> 1) ^ CRCPOLY;
+ } else {
+ Temp >>= 1;
+ }
+ }
+
+ mCrcTable[Index] = (UINT16) Temp;
+ }
+}
+
+STATIC
+VOID
+PutBits (
+ IN INT32 Number,
+ IN UINT32 Value
+ )
+/*++
+
+Routine Description:
+
+ Outputs rightmost n bits of x
+
+Arguments:
+
+ Number - the rightmost n bits of the data is used
+ x - the data
+
+Returns: (VOID)
+
+--*/
+{
+ UINT8 Temp;
+
+ while (Number >= mBitCount) {
+ //
+ // Number -= mBitCount should never equal to 32
+ //
+ Temp = (UINT8) (mSubBitBuf | (Value >> (Number -= mBitCount)));
+
+ if (mDst < mDstUpperLimit) {
+ *mDst++ = Temp;
+ }
+
+ mCompSize++;
+ mSubBitBuf = 0;
+ mBitCount = UINT8_BIT;
+ }
+
+ mSubBitBuf |= Value << (mBitCount -= Number);
+}
+
+STATIC
+INT32
+FreadCrc (
+ OUT UINT8 *Pointer,
+ IN INT32 Number
+ )
+/*++
+
+Routine Description:
+
+ Read in source data
+
+Arguments:
+
+ Pointer - the buffer to hold the data
+ Number - number of bytes to read
+
+Returns:
+
+ number of bytes actually read
+
+--*/
+{
+ INT32 Index;
+
+ for (Index = 0; mSrc < mSrcUpperLimit && Index < Number; Index++) {
+ *Pointer++ = *mSrc++;
+ }
+
+ Number = Index;
+
+ Pointer -= Number;
+ mOrigSize += Number;
+
+ Index--;
+ while (Index >= 0) {
+ UPDATE_CRC (*Pointer++);
+ Index--;
+ }
+
+ return Number;
+}
+
+STATIC
+VOID
+InitPutBits (
+ VOID
+ )
+{
+ mBitCount = UINT8_BIT;
+ mSubBitBuf = 0;
+}
+
+STATIC
+VOID
+CountLen (
+ IN INT32 Index
+ )
+/*++
+
+Routine Description:
+
+ Count the number of each code length for a Huffman tree.
+
+Arguments:
+
+ Index - the top node
+
+Returns: (VOID)
+
+--*/
+{
+ STATIC INT32 Depth = 0;
+
+ if (Index < mN) {
+ mLenCnt[(Depth < 16) ? Depth : 16]++;
+ } else {
+ Depth++;
+ CountLen (mLeft[Index]);
+ CountLen (mRight[Index]);
+ Depth--;
+ }
+}
+
+STATIC
+VOID
+MakeLen (
+ IN INT32 Root
+ )
+/*++
+
+Routine Description:
+
+ Create code length array for a Huffman tree
+
+Arguments:
+
+ Root - the root of the tree
+
+Returns:
+
+ VOID
+
+--*/
+{
+ INT32 Index;
+ INT32 Index3;
+ UINT32 Cum;
+
+ for (Index = 0; Index <= 16; Index++) {
+ mLenCnt[Index] = 0;
+ }
+
+ CountLen (Root);
+
+ //
+ // Adjust the length count array so that
+ // no code will be generated longer than its designated length
+ //
+ Cum = 0;
+ for (Index = 16; Index > 0; Index--) {
+ Cum += mLenCnt[Index] << (16 - Index);
+ }
+
+ while (Cum != (1U << 16)) {
+ mLenCnt[16]--;
+ for (Index = 15; Index > 0; Index--) {
+ if (mLenCnt[Index] != 0) {
+ mLenCnt[Index]--;
+ mLenCnt[Index + 1] += 2;
+ break;
+ }
+ }
+
+ Cum--;
+ }
+
+ for (Index = 16; Index > 0; Index--) {
+ Index3 = mLenCnt[Index];
+ Index3--;
+ while (Index3 >= 0) {
+ mLen[*mSortPtr++] = (UINT8) Index;
+ Index3--;
+ }
+ }
+}
+
+STATIC
+VOID
+DownHeap (
+ IN INT32 Index
+ )
+{
+ INT32 Index2;
+ INT32 Index3;
+
+ //
+ // priority queue: send Index-th entry down heap
+ //
+ Index3 = mHeap[Index];
+ Index2 = 2 * Index;
+ while (Index2 <= mHeapSize) {
+ if (Index2 < mHeapSize && mFreq[mHeap[Index2]] > mFreq[mHeap[Index2 + 1]]) {
+ Index2++;
+ }
+
+ if (mFreq[Index3] <= mFreq[mHeap[Index2]]) {
+ break;
+ }
+
+ mHeap[Index] = mHeap[Index2];
+ Index = Index2;
+ Index2 = 2 * Index;
+ }
+
+ mHeap[Index] = (INT16) Index3;
+}
+
+STATIC
+VOID
+MakeCode (
+ IN INT32 Number,
+ IN UINT8 Len[ ],
+ OUT UINT16 Code[]
+ )
+/*++
+
+Routine Description:
+
+ Assign code to each symbol based on the code length array
+
+Arguments:
+
+ Number - number of symbols
+ Len - the code length array
+ Code - stores codes for each symbol
+
+Returns: (VOID)
+
+--*/
+{
+ INT32 Index;
+ UINT16 Start[18];
+
+ Start[1] = 0;
+ for (Index = 1; Index <= 16; Index++) {
+ Start[Index + 1] = (UINT16) ((Start[Index] + mLenCnt[Index]) << 1);
+ }
+
+ for (Index = 0; Index < Number; Index++) {
+ Code[Index] = Start[Len[Index]]++;
+ }
+}
+
+STATIC
+INT32
+MakeTree (
+ IN INT32 NParm,
+ IN UINT16 FreqParm[],
+ OUT UINT8 LenParm[ ],
+ OUT UINT16 CodeParm[]
+ )
+/*++
+
+Routine Description:
+
+ Generates Huffman codes given a frequency distribution of symbols
+
+Arguments:
+
+ NParm - number of symbols
+ FreqParm - frequency of each symbol
+ LenParm - code length for each symbol
+ CodeParm - code for each symbol
+
+Returns:
+
+ Root of the Huffman tree.
+
+--*/
+{
+ INT32 Index;
+ INT32 Index2;
+ INT32 Index3;
+ INT32 Avail;
+
+ //
+ // make tree, calculate len[], return root
+ //
+ mN = NParm;
+ mFreq = FreqParm;
+ mLen = LenParm;
+ Avail = mN;
+ mHeapSize = 0;
+ mHeap[1] = 0;
+ for (Index = 0; Index < mN; Index++) {
+ mLen[Index] = 0;
+ if (mFreq[Index]) {
+ mHeapSize++;
+ mHeap[mHeapSize] = (INT16) Index;
+ }
+ }
+
+ if (mHeapSize < 2) {
+ CodeParm[mHeap[1]] = 0;
+ return mHeap[1];
+ }
+
+ for (Index = mHeapSize / 2; Index >= 1; Index--) {
+ //
+ // make priority queue
+ //
+ DownHeap (Index);
+ }
+
+ mSortPtr = CodeParm;
+ do {
+ Index = mHeap[1];
+ if (Index < mN) {
+ *mSortPtr++ = (UINT16) Index;
+ }
+
+ mHeap[1] = mHeap[mHeapSize--];
+ DownHeap (1);
+ Index2 = mHeap[1];
+ if (Index2 < mN) {
+ *mSortPtr++ = (UINT16) Index2;
+ }
+
+ Index3 = Avail++;
+ mFreq[Index3] = (UINT16) (mFreq[Index] + mFreq[Index2]);
+ mHeap[1] = (INT16) Index3;
+ DownHeap (1);
+ mLeft[Index3] = (UINT16) Index;
+ mRight[Index3] = (UINT16) Index2;
+ } while (mHeapSize > 1);
+
+ mSortPtr = CodeParm;
+ MakeLen (Index3);
+ MakeCode (NParm, LenParm, CodeParm);
+
+ //
+ // return root
+ //
+ return Index3;
+}
+
+EFI_STATUS
+GetFileContents (
+ IN char *InputFileName,
+ OUT UINT8 *FileBuffer,
+ OUT UINT32 *BufferLength
+ )
+/*++
+
+Routine Description:
+
+ Get the contents of file specified in InputFileName
+ into FileBuffer.
+
+Arguments:
+
+ InputFileName - Name of the input file.
+
+ FileBuffer - Output buffer to contain data
+
+ BufferLength - Actual length of the data
+
+Returns:
+
+ EFI_SUCCESS on successful return
+ EFI_ABORTED if unable to open input file.
+
+--*/
+{
+ UINTN Size;
+ UINTN FileSize;
+ FILE *InputFile;
+
+ Size = 0;
+ //
+ // Copy the file contents to the output buffer.
+ //
+ InputFile = fopen (LongFilePath (InputFileName), "rb");
+ if (InputFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file: %s", InputFileName);
+ return EFI_ABORTED;
+ }
+
+ fseek (InputFile, 0, SEEK_END);
+ FileSize = ftell (InputFile);
+ fseek (InputFile, 0, SEEK_SET);
+ //
+ // Now read the contents of the file into the buffer
+ //
+ if (FileSize > 0 && FileBuffer != NULL) {
+ if (fread (FileBuffer, FileSize, 1, InputFile) != 1) {
+ Error (NULL, 0, 0004, "Error reading contents of input file: %s", InputFileName);
+ fclose (InputFile);
+ return EFI_ABORTED;
+ }
+ }
+
+ fclose (InputFile);
+ Size += (UINTN) FileSize;
+ *BufferLength = Size;
+
+ if (FileBuffer != NULL) {
+ return EFI_SUCCESS;
+ } else {
+ return EFI_BUFFER_TOO_SMALL;
+ }
+}
+
+VOID
+Version (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Displays the standard utility information to SDTOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
+}
+
+VOID
+Usage (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Displays the utility usage syntax to STDOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ //
+ // Summary usage
+ //
+ fprintf (stdout, "Usage: %s -e|-d [options] <input_file>\n\n", UTILITY_NAME);
+
+ //
+ // Copyright declaration
+ //
+ fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
+
+ //
+ // Details Option
+ //
+ fprintf (stdout, "Options:\n");
+ fprintf (stdout, " --uefi\n\
+ Enable UefiCompress, use TianoCompress when without this option\n");
+ fprintf (stdout, " -o FileName, --output FileName\n\
+ File will be created to store the output content.\n");
+ fprintf (stdout, " -v, --verbose\n\
+ Turn on verbose output with informational messages.\n");
+ fprintf (stdout, " -q, --quiet\n\
+ Disable all messages except key message and fatal error\n");
+ fprintf (stdout, " --debug [0-9]\n\
+ Enable debug messages, at input debug level.\n");
+ fprintf (stdout, " --version\n\
+ Show program's version number and exit.\n");
+ fprintf (stdout, " -h, --help\n\
+ Show this help message and exit.\n");
+}
+
+
+int
+main (
+ int argc,
+ char *argv[]
+ )
+/*++
+
+Routine Description:
+
+ Main
+
+Arguments:
+
+ command line parameters
+
+Returns:
+
+ EFI_SUCCESS Section header successfully generated and section concatenated.
+ EFI_ABORTED Could not generate the section
+ EFI_OUT_OF_RESOURCES No resource to complete the operation.
+
+--*/
+{
+ FILE *OutputFile;
+ char *OutputFileName;
+ char *InputFileName;
+ FILE *InputFile;
+ EFI_STATUS Status;
+ UINT8 *FileBuffer;
+ UINT8 *OutBuffer;
+ UINT32 InputLength;
+ UINT32 DstSize;
+ SCRATCH_DATA *Scratch;
+ UINT8 *Src;
+ UINT32 OrigSize;
+ UINT32 CompSize;
+
+ SetUtilityName(UTILITY_NAME);
+
+ FileBuffer = NULL;
+ Src = NULL;
+ OutBuffer = NULL;
+ Scratch = NULL;
+ OrigSize = 0;
+ CompSize = 0;
+ InputLength = 0;
+ InputFileName = NULL;
+ OutputFileName = NULL;
+ InputFile = NULL;
+ OutputFile = NULL;
+ DstSize=0;
+ DebugLevel = 0;
+ DebugMode = FALSE;
+
+ //
+ // Verify the correct number of arguments
+ //
+ if (argc == 1) {
+ Error (NULL, 0, 1001, "Missing options", "No input options specified.");
+ Usage();
+ return 0;
+ }
+
+ if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0)) {
+ Usage();
+ return 0;
+ }
+
+ if ((strcmp(argv[1], "--version") == 0)) {
+ Version();
+ return 0;
+ }
+
+ argc--;
+ argv++;
+ if (strcmp(argv[0],"-e") == 0) {
+ //
+ // encode the input file
+ //
+ ENCODE = TRUE;
+ argc--;
+ argv++;
+ } else if (strcmp(argv[0], "-d") == 0) {
+ //
+ // decode the input file
+ //
+ DECODE = TRUE;
+ argc--;
+ argv++;
+ } else {
+ //
+ // Error command line
+ //
+ Error (NULL, 0, 1003, "Invalid option value", "the options specified are not recognized.");
+ Usage();
+ return 1;
+ }
+
+ while (argc > 0) {
+ if ((strcmp(argv[0], "-v") == 0) || (stricmp(argv[0], "--verbose") == 0)) {
+ VerboseMode = TRUE;
+ argc--;
+ argv++;
+ continue;
+ }
+
+ if (stricmp(argv[0], "--uefi") == 0) {
+ UEFIMODE = TRUE;
+ argc--;
+ argv++;
+ continue;
+ }
+
+ if (stricmp (argv[0], "--debug") == 0) {
+ argc-=2;
+ argv++;
+ Status = AsciiStringToUint64(argv[0], FALSE, &DebugLevel);
+ if (DebugLevel > 9) {
+ Error (NULL, 0 ,2000, "Invalid parameter", "Unrecognized argument %s", argv[0]);
+ goto ERROR;
+ }
+ if (DebugLevel>=5 && DebugLevel <=9){
+ DebugMode = TRUE;
+ } else {
+ DebugMode = FALSE;
+ }
+ argv++;
+ continue;
+ }
+
+ if ((strcmp(argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
+ QuietMode = TRUE;
+ argc--;
+ argv++;
+ continue;
+ }
+
+ if ((strcmp(argv[0], "-o") == 0) || (stricmp (argv[0], "--output") == 0)) {
+ if (argv[1] == NULL || argv[1][0] == '-') {
+ Error (NULL, 0, 1003, "Invalid option value", "Output File name is missing for -o option");
+ goto ERROR;
+ }
+ OutputFileName = argv[1];
+ argc -=2;
+ argv +=2;
+ continue;
+ }
+
+ if (argv[0][0]!='-') {
+ InputFileName = argv[0];
+ argc--;
+ argv++;
+ continue;
+ }
+
+ Error (NULL, 0, 1000, "Unknown option", argv[0]);
+ goto ERROR;
+ }
+
+ if (InputFileName == NULL) {
+ Error (NULL, 0, 1001, "Missing options", "No input files specified.");
+ goto ERROR;
+ }
+
+//
+// All Parameters has been parsed, now set the message print level
+//
+ if (QuietMode) {
+ SetPrintLevel(40);
+ } else if (VerboseMode) {
+ SetPrintLevel(15);
+ } else if (DebugMode) {
+ SetPrintLevel(DebugLevel);
+ }
+
+ if (VerboseMode) {
+ VerboseMsg("%s tool start.\n", UTILITY_NAME);
+ }
+ Scratch = (SCRATCH_DATA *)malloc(sizeof(SCRATCH_DATA));
+ if (Scratch == NULL) {
+ Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
+ goto ERROR;
+ }
+
+ InputFile = fopen (LongFilePath (InputFileName), "rb");
+ if (InputFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening input file", InputFileName);
+ goto ERROR;
+ }
+
+ Status = GetFileContents(
+ InputFileName,
+ FileBuffer,
+ &InputLength);
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ FileBuffer = (UINT8 *) malloc (InputLength);
+ if (FileBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
+ goto ERROR;
+ }
+
+ Status = GetFileContents (
+ InputFileName,
+ FileBuffer,
+ &InputLength
+ );
+ }
+
+ if (EFI_ERROR(Status)) {
+ Error (NULL, 0, 0004, "Error getting contents of file: %s", InputFileName);
+ goto ERROR;
+ }
+
+ if (OutputFileName == NULL) {
+ OutputFileName = DEFAULT_OUTPUT_FILE;
+ }
+ OutputFile = fopen (LongFilePath (OutputFileName), "wb");
+ if (OutputFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening output file for writing", OutputFileName);
+ goto ERROR;
+ }
+
+ if (ENCODE) {
+ //
+ // First call TianoCompress to get DstSize
+ //
+ if (DebugMode) {
+ DebugMsg(UTILITY_NAME, 0, DebugLevel, "Encoding", NULL);
+ }
+ if (UEFIMODE) {
+ Status = EfiCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, &DstSize);
+ } else {
+ Status = TianoCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, &DstSize);
+ }
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ OutBuffer = (UINT8 *) malloc (DstSize);
+ if (OutBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
+ goto ERROR;
+ }
+ }
+
+ if (UEFIMODE) {
+ Status = EfiCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, &DstSize);
+ } else {
+ Status = TianoCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, &DstSize);
+ }
+ if (Status != EFI_SUCCESS) {
+ Error (NULL, 0, 0007, "Error compressing file", NULL);
+ goto ERROR;
+ }
+
+ if (OutBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
+ goto ERROR;
+ }
+
+ fwrite(OutBuffer,(size_t)DstSize, 1, OutputFile);
+ fclose(OutputFile);
+ fclose(InputFile);
+ free(Scratch);
+ free(FileBuffer);
+ free(OutBuffer);
+
+ if (DebugMode) {
+ DebugMsg(UTILITY_NAME, 0, DebugLevel, "Encoding Successful!\n", NULL);
+ }
+ if (VerboseMode) {
+ VerboseMsg("Encoding successful\n");
+ }
+ return 0;
+ }
+ else if (DECODE) {
+ if (DebugMode) {
+ DebugMsg(UTILITY_NAME, 0, DebugLevel, "Decoding\n", NULL);
+ }
+
+ if (UEFIMODE) {
+ Status = Extract((VOID *)FileBuffer, InputLength, (VOID *)&OutBuffer, &DstSize, 1);
+ if (Status != EFI_SUCCESS) {
+ goto ERROR;
+ }
+ fwrite(OutBuffer, (size_t)(DstSize), 1, OutputFile);
+ } else {
+ if (InputLength < 8){
+ Error (NULL, 0, 3000, "Invalid", "The input file %s is too small.", InputFileName);
+ goto ERROR;
+ }
+ //
+ // Get Compressed file original size
+ //
+ Src = (UINT8 *)FileBuffer;
+ OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
+ CompSize = Src[0] + (Src[1] << 8) + (Src[2] <<16) + (Src[3] <<24);
+
+ //
+ // Allocate OutputBuffer
+ //
+ if (InputLength < CompSize + 8 || (CompSize + 8) < 8) {
+ Error (NULL, 0, 3000, "Invalid", "The input file %s data is invalid.", InputFileName);
+ goto ERROR;
+ }
+ OutBuffer = (UINT8 *)malloc(OrigSize);
+ if (OutBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
+ goto ERROR;
+ }
+
+ Status = TDecompress((VOID *)FileBuffer, (VOID *)OutBuffer, (VOID *)Scratch, 2);
+ if (Status != EFI_SUCCESS) {
+ goto ERROR;
+ }
+ fwrite(OutBuffer, (size_t)(Scratch->mOrigSize), 1, OutputFile);
+ }
+ fclose(OutputFile);
+ fclose(InputFile);
+ if (Scratch != NULL) {
+ free(Scratch);
+ }
+ if (FileBuffer != NULL) {
+ free(FileBuffer);
+ }
+ if (OutBuffer != NULL) {
+ free(OutBuffer);
+ }
+
+ if (DebugMode) {
+ DebugMsg(UTILITY_NAME, 0, DebugLevel, "Encoding successful!\n", NULL);
+ }
+
+ if (VerboseMode) {
+ VerboseMsg("Decoding successful\n");
+ }
+ return 0;
+ }
+
+ERROR:
+ if (DebugMode) {
+ if (ENCODE) {
+ DebugMsg(UTILITY_NAME, 0, DebugLevel, "Encoding Error\n", NULL);
+ } else if (DECODE) {
+ DebugMsg(UTILITY_NAME, 0, DebugLevel, "Decoding Error\n", NULL);
+ }
+ }
+ if (OutputFile != NULL) {
+ fclose(OutputFile);
+ }
+ if (InputFile != NULL) {
+ fclose (InputFile);
+ }
+ if (Scratch != NULL) {
+ free(Scratch);
+ }
+ if (FileBuffer != NULL) {
+ free(FileBuffer);
+ }
+ if (OutBuffer != NULL) {
+ free(OutBuffer);
+ }
+
+ if (VerboseMode) {
+ VerboseMsg("%s tool done with return code is 0x%x.\n", UTILITY_NAME, GetUtilityStatus ());
+ }
+ return GetUtilityStatus ();
+}
+
+VOID
+FillBuf (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 NumOfBits
+ )
+/*++
+
+Routine Description:
+
+ Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
+
+Arguments:
+
+ Sd - The global scratch data
+ NumOfBits - The number of bits to shift and read.
+
+Returns: (VOID)
+
+--*/
+{
+ Sd->mBitBuf = (UINT32) (((UINT64)Sd->mBitBuf) << NumOfBits);
+
+ while (NumOfBits > Sd->mBitCount) {
+
+ Sd->mBitBuf |= (UINT32) (((UINT64)Sd->mSubBitBuf) << (NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount)));
+
+ if (Sd->mCompSize > 0) {
+ //
+ // Get 1 byte into SubBitBuf
+ //
+ Sd->mCompSize--;
+ Sd->mSubBitBuf = 0;
+ Sd->mSubBitBuf = Sd->mSrcBase[Sd->mInBuf++];
+ Sd->mBitCount = 8;
+
+ } else {
+ //
+ // No more bits from the source, just pad zero bit.
+ //
+ Sd->mSubBitBuf = 0;
+ Sd->mBitCount = 8;
+
+ }
+ }
+
+ Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits);
+ Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
+}
+
+UINT32
+GetBits (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 NumOfBits
+ )
+/*++
+
+Routine Description:
+
+ Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
+ NumOfBits of bits from source. Returns NumOfBits of bits that are
+ popped out.
+
+Arguments:
+
+ Sd - The global scratch data.
+ NumOfBits - The number of bits to pop and read.
+
+Returns:
+
+ The bits that are popped out.
+
+--*/
+{
+ UINT32 OutBits;
+
+ OutBits = (UINT32) (Sd->mBitBuf >> (BITBUFSIZ - NumOfBits));
+
+ FillBuf (Sd, NumOfBits);
+
+ return OutBits;
+}
+
+UINT16
+MakeTable (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 NumOfChar,
+ IN UINT8 *BitLen,
+ IN UINT16 TableBits,
+ OUT UINT16 *Table
+ )
+/*++
+
+Routine Description:
+
+ Creates Huffman Code mapping table according to code length array.
+
+Arguments:
+
+ Sd - The global scratch data
+ NumOfChar - Number of symbols in the symbol set
+ BitLen - Code length array
+ TableBits - The width of the mapping table
+ Table - The table
+
+Returns:
+
+ 0 - OK.
+ BAD_TABLE - The table is corrupted.
+
+--*/
+{
+ UINT16 Count[17];
+ UINT16 Weight[17];
+ UINT16 Start[18];
+ UINT16 *Pointer;
+ UINT16 Index3;
+ UINT16 Index;
+ UINT16 Len;
+ UINT16 Char;
+ UINT16 JuBits;
+ UINT16 Avail;
+ UINT16 NextCode;
+ UINT16 Mask;
+ UINT16 WordOfStart;
+ UINT16 WordOfCount;
+ UINT16 MaxTableLength;
+
+ for (Index = 0; Index <= 16; Index++) {
+ Count[Index] = 0;
+ }
+
+ for (Index = 0; Index < NumOfChar; Index++) {
+ if (BitLen[Index] > 16) {
+ return (UINT16) BAD_TABLE;
+ }
+ Count[BitLen[Index]]++;
+ }
+
+ Start[0] = 0;
+ Start[1] = 0;
+
+ for (Index = 1; Index <= 16; Index++) {
+ WordOfStart = Start[Index];
+ WordOfCount = Count[Index];
+ Start[Index + 1] = (UINT16) (WordOfStart + (WordOfCount << (16 - Index)));
+ }
+
+ if (Start[17] != 0) {
+ //
+ //(1U << 16)
+ //
+ return (UINT16) BAD_TABLE;
+ }
+
+ JuBits = (UINT16) (16 - TableBits);
+
+ Weight[0] = 0;
+ for (Index = 1; Index <= TableBits; Index++) {
+ Start[Index] >>= JuBits;
+ Weight[Index] = (UINT16) (1U << (TableBits - Index));
+ }
+
+ while (Index <= 16) {
+ Weight[Index] = (UINT16) (1U << (16 - Index));
+ Index++;
+ }
+
+ Index = (UINT16) (Start[TableBits + 1] >> JuBits);
+
+ if (Index != 0) {
+ Index3 = (UINT16) (1U << TableBits);
+ while (Index != Index3) {
+ Table[Index++] = 0;
+ }
+ }
+
+ Avail = NumOfChar;
+ Mask = (UINT16) (1U << (15 - TableBits));
+ MaxTableLength = (UINT16) (1U << TableBits);
+
+ for (Char = 0; Char < NumOfChar; Char++) {
+
+ Len = BitLen[Char];
+ if (Len == 0 || Len >= 17) {
+ continue;
+ }
+
+ NextCode = (UINT16) (Start[Len] + Weight[Len]);
+
+ if (Len <= TableBits) {
+
+ if (Start[Len] >= NextCode || NextCode > MaxTableLength){
+ return (UINT16) BAD_TABLE;
+ }
+
+ for (Index = Start[Len]; Index < NextCode; Index++) {
+ Table[Index] = Char;
+ }
+
+ } else {
+
+ Index3 = Start[Len];
+ Pointer = &Table[Index3 >> JuBits];
+ Index = (UINT16) (Len - TableBits);
+
+ while (Index != 0) {
+ if (*Pointer == 0) {
+ Sd->mRight[Avail] = Sd->mLeft[Avail] = 0;
+ *Pointer = Avail++;
+ }
+
+ if (Index3 & Mask) {
+ Pointer = &Sd->mRight[*Pointer];
+ } else {
+ Pointer = &Sd->mLeft[*Pointer];
+ }
+
+ Index3 <<= 1;
+ Index--;
+ }
+
+ *Pointer = Char;
+
+ }
+
+ Start[Len] = NextCode;
+ }
+ //
+ // Succeeds
+ //
+ return 0;
+}
+
+UINT32
+DecodeP (
+ IN SCRATCH_DATA *Sd
+ )
+/*++
+
+Routine Description:
+
+ Decodes a position value.
+
+Arguments:
+
+ Sd - the global scratch data
+
+Returns:
+
+ The position value decoded.
+
+--*/
+{
+ UINT16 Val;
+ UINT32 Mask;
+ UINT32 Pos;
+
+ Val = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
+
+ if (Val >= MAXNP) {
+ Mask = 1U << (BITBUFSIZ - 1 - 8);
+
+ do {
+
+ if (Sd->mBitBuf & Mask) {
+ Val = Sd->mRight[Val];
+ } else {
+ Val = Sd->mLeft[Val];
+ }
+
+ Mask >>= 1;
+ } while (Val >= MAXNP);
+ }
+ //
+ // Advance what we have read
+ //
+ FillBuf (Sd, Sd->mPTLen[Val]);
+
+ Pos = Val;
+ if (Val > 1) {
+ Pos = (UINT32) ((1U << (Val - 1)) + GetBits (Sd, (UINT16) (Val - 1)));
+ }
+
+ return Pos;
+}
+
+UINT16
+ReadPTLen (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 nn,
+ IN UINT16 nbit,
+ IN UINT16 Special
+ )
+/*++
+
+Routine Description:
+
+ Reads code lengths for the Extra Set or the Position Set
+
+Arguments:
+
+ Sd - The global scratch data
+ nn - Number of symbols
+ nbit - Number of bits needed to represent nn
+ Special - The special symbol that needs to be taken care of
+
+Returns:
+
+ 0 - OK.
+ BAD_TABLE - Table is corrupted.
+
+--*/
+{
+ UINT16 Number;
+ UINT16 CharC;
+ volatile UINT16 Index;
+ UINT32 Mask;
+
+ assert (nn <= NPT);
+
+ Number = (UINT16) GetBits (Sd, nbit);
+
+ if (Number == 0) {
+ CharC = (UINT16) GetBits (Sd, nbit);
+
+ for (Index = 0; Index < 256; Index++) {
+ Sd->mPTTable[Index] = CharC;
+ }
+
+ for (Index = 0; Index < nn; Index++) {
+ Sd->mPTLen[Index] = 0;
+ }
+
+ return 0;
+ }
+
+ Index = 0;
+
+ while (Index < Number) {
+
+ CharC = (UINT16) (Sd->mBitBuf >> (BITBUFSIZ - 3));
+
+ if (CharC == 7) {
+ Mask = 1U << (BITBUFSIZ - 1 - 3);
+ while (Mask & Sd->mBitBuf) {
+ Mask >>= 1;
+ CharC += 1;
+ }
+ }
+
+ FillBuf (Sd, (UINT16) ((CharC < 7) ? 3 : CharC - 3));
+
+ Sd->mPTLen[Index++] = (UINT8) CharC;
+
+ if (Index == Special) {
+ CharC = (UINT16) GetBits (Sd, 2);
+ while ((INT16) (--CharC) >= 0) {
+ Sd->mPTLen[Index++] = 0;
+ }
+ }
+ }
+
+ while (Index < nn) {
+ Sd->mPTLen[Index++] = 0;
+ }
+
+ return MakeTable (Sd, nn, Sd->mPTLen, 8, Sd->mPTTable);
+}
+
+VOID
+ReadCLen (
+ SCRATCH_DATA *Sd
+ )
+/*++
+
+Routine Description:
+
+ Reads code lengths for Char&Len Set.
+
+Arguments:
+
+ Sd - the global scratch data
+
+Returns: (VOID)
+
+--*/
+{
+ UINT16 Number;
+ UINT16 CharC;
+ volatile UINT16 Index;
+ UINT32 Mask;
+
+ Number = (UINT16) GetBits (Sd, CBIT);
+
+ if (Number == 0) {
+ CharC = (UINT16) GetBits (Sd, CBIT);
+
+ for (Index = 0; Index < NC; Index++) {
+ Sd->mCLen[Index] = 0;
+ }
+
+ for (Index = 0; Index < 4096; Index++) {
+ Sd->mCTable[Index] = CharC;
+ }
+
+ return ;
+ }
+
+ Index = 0;
+ while (Index < Number) {
+
+ CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
+ if (CharC >= NT) {
+ Mask = 1U << (BITBUFSIZ - 1 - 8);
+
+ do {
+
+ if (Mask & Sd->mBitBuf) {
+ CharC = Sd->mRight[CharC];
+ } else {
+ CharC = Sd->mLeft[CharC];
+ }
+
+ Mask >>= 1;
+
+ } while (CharC >= NT);
+ }
+ //
+ // Advance what we have read
+ //
+ FillBuf (Sd, Sd->mPTLen[CharC]);
+
+ if (CharC <= 2) {
+
+ if (CharC == 0) {
+ CharC = 1;
+ } else if (CharC == 1) {
+ CharC = (UINT16) (GetBits (Sd, 4) + 3);
+ } else if (CharC == 2) {
+ CharC = (UINT16) (GetBits (Sd, CBIT) + 20);
+ }
+
+ while ((INT16) (--CharC) >= 0) {
+ Sd->mCLen[Index++] = 0;
+ }
+
+ } else {
+
+ Sd->mCLen[Index++] = (UINT8) (CharC - 2);
+
+ }
+ }
+
+ while (Index < NC) {
+ Sd->mCLen[Index++] = 0;
+ }
+
+ MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable);
+
+ return ;
+}
+
+UINT16
+DecodeC (
+ SCRATCH_DATA *Sd
+ )
+/*++
+
+Routine Description:
+
+ Decode a character/length value.
+
+Arguments:
+
+ Sd - The global scratch data.
+
+Returns:
+
+ The value decoded.
+
+--*/
+{
+ UINT16 Index2;
+ UINT32 Mask;
+
+ if (Sd->mBlockSize == 0) {
+ //
+ // Starting a new block
+ //
+ Sd->mBlockSize = (UINT16) GetBits (Sd, 16);
+ Sd->mBadTableFlag = ReadPTLen (Sd, NT, TBIT, 3);
+ if (Sd->mBadTableFlag != 0) {
+ return 0;
+ }
+
+ ReadCLen (Sd);
+
+ Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, Sd->mPBit, (UINT16) (-1));
+ if (Sd->mBadTableFlag != 0) {
+ return 0;
+ }
+ }
+
+ Sd->mBlockSize--;
+ Index2 = Sd->mCTable[Sd->mBitBuf >> (BITBUFSIZ - 12)];
+
+ if (Index2 >= NC) {
+ Mask = 1U << (BITBUFSIZ - 1 - 12);
+
+ do {
+ if (Sd->mBitBuf & Mask) {
+ Index2 = Sd->mRight[Index2];
+ } else {
+ Index2 = Sd->mLeft[Index2];
+ }
+
+ Mask >>= 1;
+ } while (Index2 >= NC);
+ }
+ //
+ // Advance what we have read
+ //
+ FillBuf (Sd, Sd->mCLen[Index2]);
+
+ return Index2;
+}
+
+VOID
+Decode (
+ SCRATCH_DATA *Sd
+ )
+/*++
+
+Routine Description:
+
+ Decode the source data and put the resulting data into the destination buffer.
+
+Arguments:
+
+ Sd - The global scratch data
+
+Returns: (VOID)
+
+ --*/
+{
+ UINT16 BytesRemain;
+ UINT32 DataIdx;
+ UINT16 CharC;
+
+ BytesRemain = (UINT16) (-1);
+
+ DataIdx = 0;
+
+ for (;;) {
+ CharC = DecodeC (Sd);
+ if (Sd->mBadTableFlag != 0) {
+ goto Done ;
+ }
+
+ if (CharC < 256) {
+ //
+ // Process an Original character
+ //
+ if (Sd->mOutBuf >= Sd->mOrigSize) {
+ goto Done ;
+ } else {
+ Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC;
+ }
+
+ } else {
+ //
+ // Process a Pointer
+ //
+ CharC = (UINT16) (CharC - (UINT8_MAX + 1 - THRESHOLD));
+
+ BytesRemain = CharC;
+
+ DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1;
+
+ BytesRemain--;
+
+ while ((INT16) (BytesRemain) >= 0) {
+ if (Sd->mOutBuf >= Sd->mOrigSize) {
+ goto Done ;
+ }
+ if (DataIdx >= Sd->mOrigSize) {
+ Sd->mBadTableFlag = (UINT16) BAD_TABLE;
+ goto Done ;
+ }
+ Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
+
+ BytesRemain--;
+ }
+ //
+ // Once mOutBuf is fully filled, directly return
+ //
+ if (Sd->mOutBuf >= Sd->mOrigSize) {
+ goto Done ;
+ }
+ }
+ }
+
+Done:
+ return ;
+}
+
+RETURN_STATUS
+EFIAPI
+TDecompress (
+ IN VOID *Source,
+ IN OUT VOID *Destination,
+ IN OUT VOID *Scratch,
+ IN UINT32 Version
+ )
+/*++
+
+Routine Description:
+
+ The internal implementation of Decompress().
+
+Arguments:
+
+ Source - The source buffer containing the compressed data.
+ Destination - The destination buffer to store the decompressed data
+ Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
+ Version - 1 for EFI1.1 Decompress algorithm, 2 for Tiano Decompress algorithm
+
+Returns:
+
+ RETURN_SUCCESS - Decompression is successful
+ RETURN_INVALID_PARAMETER - The source data is corrupted
+
+--*/
+{
+ volatile UINT32 Index;
+ UINT32 CompSize;
+ UINT32 OrigSize;
+ SCRATCH_DATA *Sd;
+ CONST UINT8 *Src;
+ UINT8 *Dst;
+
+ //
+ // Verify input is not NULL
+ //
+ assert(Source);
+// assert(Destination);
+ assert(Scratch);
+
+ Src = (UINT8 *)Source;
+ Dst = (UINT8 *)Destination;
+
+ Sd = (SCRATCH_DATA *) Scratch;
+ CompSize = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
+ OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
+
+ //
+ // If compressed file size is 0, return
+ //
+ if (OrigSize == 0) {
+ return RETURN_SUCCESS;
+ }
+
+ Src = Src + 8;
+
+ for (Index = 0; Index < sizeof (SCRATCH_DATA); Index++) {
+ ((UINT8 *) Sd)[Index] = 0;
+ }
+ //
+ // The length of the field 'Position Set Code Length Array Size' in Block Header.
+ // For EFI 1.1 de/compression algorithm(Version 1), mPBit = 4
+ // For Tiano de/compression algorithm(Version 2), mPBit = 5
+ //
+ switch (Version) {
+ case 1 :
+ Sd->mPBit = 4;
+ break;
+ case 2 :
+ Sd->mPBit = 5;
+ break;
+ default:
+ assert(FALSE);
+ }
+ Sd->mSrcBase = (UINT8 *)Src;
+ Sd->mDstBase = Dst;
+ Sd->mCompSize = CompSize;
+ Sd->mOrigSize = OrigSize;
+
+ //
+ // Fill the first BITBUFSIZ bits
+ //
+ FillBuf (Sd, BITBUFSIZ);
+
+ //
+ // Decompress it
+ //
+
+ Decode (Sd);
+
+ if (Sd->mBadTableFlag != 0) {
+ //
+ // Something wrong with the source
+ //
+ return RETURN_INVALID_PARAMETER;
+ }
+
+ return RETURN_SUCCESS;
+}
+
+
diff --git a/roms/edk2/BaseTools/Source/C/TianoCompress/TianoCompress.h b/roms/edk2/BaseTools/Source/C/TianoCompress/TianoCompress.h
new file mode 100644
index 000000000..abbd5a1e7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/TianoCompress/TianoCompress.h
@@ -0,0 +1,431 @@
+/** @file
+ Internal include file for Tiano Decompress Library.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __TIANO_DECOMPRESS_H__
+#define __TIANO_DECOMPRESS_H__
+
+#include <stdio.h>
+#include <assert.h>
+#include <Common/UefiBaseTypes.h>
+
+
+//
+// Decompression algorithm begins here
+//
+#define UTILITY_NAME "TianoCompress"
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 1
+
+//
+// Default output file name
+//
+#define DEFAULT_OUTPUT_FILE "file.tmp"
+
+#define BITBUFSIZ 32
+#define MAXMATCH 256
+#define THRESHOLD 3
+#define CODE_BIT 16
+#define BAD_TABLE - 1
+
+typedef INT32 NODE;
+
+//
+// C: Char&Len Set; P: Position Set; T: exTra Set
+//
+#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
+#define CBIT 9
+#define MAXPBIT 5
+#define TBIT 5
+#define MAXNP ((1U << MAXPBIT) - 1)
+#define NT (CODE_BIT + 3)
+#if NT > MAXNP
+#define NPT NT
+#else
+#define NPT MAXNP
+#endif
+
+typedef struct {
+ UINT8 *mSrcBase; // Starting address of compressed data
+ UINT8 *mDstBase; // Starting address of decompressed data
+ UINT32 mOutBuf;
+ UINT32 mInBuf;
+
+ UINT16 mBitCount;
+ UINT32 mBitBuf;
+ UINT32 mSubBitBuf;
+ UINT16 mBlockSize;
+ UINT32 mCompSize;
+ UINT32 mOrigSize;
+
+ UINT16 mBadTableFlag;
+
+ UINT16 mLeft[2 * NC - 1];
+ UINT16 mRight[2 * NC - 1];
+ UINT8 mCLen[NC];
+ UINT8 mPTLen[NPT];
+ UINT16 mCTable[4096];
+ UINT16 mPTTable[256];
+
+ //
+ // The length of the field 'Position Set Code Length Array Size' in Block Header.
+ // For EFI 1.1 de/compression algorithm, mPBit = 4
+ // For Tiano de/compression algorithm, mPBit = 5
+ //
+ UINT8 mPBit;
+} SCRATCH_DATA;
+
+//
+// Function Prototypes
+//
+
+EFI_STATUS
+GetFileContents (
+ IN char *InputFileName,
+ OUT UINT8 *FileBuffer,
+ OUT UINT32 *BufferLength
+ );
+
+STATIC
+VOID
+PutDword(
+ IN UINT32 Data
+ );
+
+STATIC
+EFI_STATUS
+AllocateMemory (
+ VOID
+ );
+
+STATIC
+VOID
+FreeMemory (
+ VOID
+ );
+
+STATIC
+VOID
+InitSlide (
+ VOID
+ );
+
+STATIC
+NODE
+Child (
+ IN NODE NodeQ,
+ IN UINT8 CharC
+ );
+
+STATIC
+VOID
+MakeChild (
+ IN NODE NodeQ,
+ IN UINT8 CharC,
+ IN NODE NodeR
+ );
+
+STATIC
+VOID
+Split (
+ IN NODE Old
+ );
+
+STATIC
+VOID
+InsertNode (
+ VOID
+ );
+
+STATIC
+VOID
+DeleteNode (
+ VOID
+ );
+
+STATIC
+VOID
+GetNextMatch (
+ VOID
+ );
+
+STATIC
+EFI_STATUS
+Encode (
+ VOID
+ );
+
+STATIC
+VOID
+CountTFreq (
+ VOID
+ );
+
+STATIC
+VOID
+WritePTLen (
+ IN INT32 Number,
+ IN INT32 nbit,
+ IN INT32 Special
+ );
+
+STATIC
+VOID
+WriteCLen (
+ VOID
+ );
+
+STATIC
+VOID
+EncodeC (
+ IN INT32 Value
+ );
+
+STATIC
+VOID
+EncodeP (
+ IN UINT32 Value
+ );
+
+STATIC
+VOID
+SendBlock (
+ VOID
+ );
+
+STATIC
+VOID
+Output (
+ IN UINT32 c,
+ IN UINT32 p
+ );
+
+STATIC
+VOID
+HufEncodeStart (
+ VOID
+ );
+
+STATIC
+VOID
+HufEncodeEnd (
+ VOID
+ );
+
+STATIC
+VOID
+MakeCrcTable (
+ VOID
+ );
+
+
+STATIC
+VOID
+PutBits (
+ IN INT32 Number,
+ IN UINT32 Value
+ );
+
+STATIC
+INT32
+FreadCrc (
+ OUT UINT8 *Pointer,
+ IN INT32 Number
+ );
+
+STATIC
+VOID
+InitPutBits (
+ VOID
+ );
+
+STATIC
+VOID
+CountLen (
+ IN INT32 Index
+ );
+
+STATIC
+VOID
+MakeLen (
+ IN INT32 Root
+ );
+
+STATIC
+VOID
+DownHeap (
+ IN INT32 Index
+ );
+
+STATIC
+VOID
+MakeCode (
+ IN INT32 Number,
+ IN UINT8 Len[ ],
+ OUT UINT16 Code[]
+ );
+
+STATIC
+INT32
+MakeTree (
+ IN INT32 NParm,
+ IN UINT16 FreqParm[],
+ OUT UINT8 LenParm[ ],
+ OUT UINT16 CodeParm[]
+ );
+
+/**
+ Read NumOfBit of bits from source into mBitBuf
+
+ Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
+
+ @param Sd The global scratch data
+ @param NumOfBits The number of bits to shift and read.
+
+**/
+VOID
+FillBuf (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 NumOfBits
+ );
+
+/**
+ Get NumOfBits of bits out from mBitBuf
+
+ Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
+ NumOfBits of bits from source. Returns NumOfBits of bits that are
+ popped out.
+
+ @param Sd The global scratch data.
+ @param NumOfBits The number of bits to pop and read.
+
+ @return The bits that are popped out.
+
+**/
+UINT32
+GetBits (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 NumOfBits
+ );
+
+/**
+ Creates Huffman Code mapping table according to code length array.
+
+ Creates Huffman Code mapping table for Extra Set, Char&Len Set
+ and Position Set according to code length array.
+
+ @param Sd The global scratch data
+ @param NumOfChar Number of symbols in the symbol set
+ @param BitLen Code length array
+ @param TableBits The width of the mapping table
+ @param Table The table
+
+ @retval 0 OK.
+ @retval BAD_TABLE The table is corrupted.
+
+**/
+UINT16
+MakeTable (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 NumOfChar,
+ IN UINT8 *BitLen,
+ IN UINT16 TableBits,
+ OUT UINT16 *Table
+ );
+
+/**
+ Decodes a position value.
+
+ Get a position value according to Position Huffman Table.
+
+ @param Sd the global scratch data
+
+ @return The position value decoded.
+
+**/
+UINT32
+DecodeP (
+ IN SCRATCH_DATA *Sd
+ );
+
+/**
+ Reads code lengths for the Extra Set or the Position Set.
+
+ Read in the Extra Set or Position Set Length Array, then
+ generate the Huffman code mapping for them.
+
+ @param Sd The global scratch data.
+ @param nn Number of symbols.
+ @param nbit Number of bits needed to represent nn.
+ @param Special The special symbol that needs to be taken care of.
+
+ @retval 0 OK.
+ @retval BAD_TABLE Table is corrupted.
+
+**/
+UINT16
+ReadPTLen (
+ IN SCRATCH_DATA *Sd,
+ IN UINT16 nn,
+ IN UINT16 nbit,
+ IN UINT16 Special
+ );
+
+/**
+ Reads code lengths for Char&Len Set.
+
+ Read in and decode the Char&Len Set Code Length Array, then
+ generate the Huffman Code mapping table for the Char&Len Set.
+
+ @param Sd the global scratch data
+
+**/
+VOID
+ReadCLen (
+ SCRATCH_DATA *Sd
+ );
+
+/**
+ Decode a character/length value.
+
+ Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
+ Huffman code mapping table for Extra Set, Code&Len Set and
+ Position Set.
+
+ @param Sd The global scratch data.
+
+ @return The value decoded.
+
+**/
+UINT16
+DecodeC (
+ SCRATCH_DATA *Sd
+ );
+
+/**
+ Decode the source data and put the resulting data into the destination buffer.
+
+ Decode the source data and put the resulting data into the destination buffer.
+
+ @param Sd The global scratch data
+
+**/
+VOID
+Decode (
+ SCRATCH_DATA *Sd
+ );
+
+RETURN_STATUS
+EFIAPI
+TDecompress (
+ IN VOID *Source,
+ IN OUT VOID *Destination,
+ IN OUT VOID *Scratch,
+ IN UINT32 Version
+ );
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/EfiVfr.h b/roms/edk2/BaseTools/Source/C/VfrCompile/EfiVfr.h
new file mode 100644
index 000000000..2dda658af
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/EfiVfr.h
@@ -0,0 +1,44 @@
+/** @file
+Defines and prototypes for the UEFI VFR compiler internal use.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFIVFR_H_
+#define _EFIVFR_H_
+
+#include "Common/UefiBaseTypes.h"
+#include "Common/UefiInternalFormRepresentation.h"
+#include "Common/MdeModuleHii.h"
+
+#define MAX_VFR_LINE_LEN 4096
+
+#define EFI_IFR_MAX_LENGTH 0xFF
+#define MAX_IFR_EXPRESSION_DEPTH 0x9
+
+#define EFI_VARSTORE_ID_INVALID 0
+#define EFI_VAROFFSET_INVALID 0xFFFF
+#define EFI_VARSTORE_ID_START 0x20
+#define EFI_STRING_ID_INVALID 0x0
+#define EFI_IMAGE_ID_INVALID 0xFFFF
+
+#define EFI_IFR_MAX_DEFAULT_TYPE 0x10
+
+typedef enum {
+ QUESTION_NORMAL,
+ QUESTION_DATE,
+ QUESTION_TIME,
+ QUESTION_REF,
+} EFI_QUESION_TYPE;
+
+typedef enum {
+ EQUAL,
+ LESS_EQUAL,
+ LESS_THAN,
+ GREATER_THAN,
+ GREATER_EQUAL
+} EFI_COMPARE_TYPE;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/GNUmakefile b/roms/edk2/BaseTools/Source/C/VfrCompile/GNUmakefile
new file mode 100644
index 000000000..fc329944b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/GNUmakefile
@@ -0,0 +1,80 @@
+## @file
+# GNU/Linux makefile for 'VfrCompile' module build.
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+MAKEROOT ?= ..
+
+APPNAME = VfrCompile
+
+LIBS = -lCommon
+
+TOOL_INCLUDE = -I Pccts/h
+
+#OBJECTS = VfrSyntax.o VfrServices.o DLGLexer.o EfiVfrParser.o ATokenBuffer.o DLexerBase.o AParser.o
+OBJECTS = AParser.o DLexerBase.o ATokenBuffer.o EfiVfrParser.o VfrLexer.o VfrSyntax.o \
+ VfrFormPkg.o VfrError.o VfrUtilityLib.o VfrCompiler.o
+ifeq ($(CXX), llvm)
+VFR_CPPFLAGS = -Wno-deprecated-register -DPCCTS_USE_NAMESPACE_STD $(BUILD_CPPFLAGS)
+else
+VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(BUILD_CPPFLAGS)
+endif
+# keep BUILD_OPTFLAGS last
+VFR_CXXFLAGS = $(BUILD_OPTFLAGS)
+
+# keep EXTRA_LDFLAGS last
+VFR_LFLAGS = $(EXTRA_LDFLAGS)
+
+LINKER = $(BUILD_CXX)
+
+EXTRA_CLEAN_OBJECTS = EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h VfrLexer.cpp VfrLexer.h VfrSyntax.cpp tokens.h
+
+MAKEROOT ?= ../..
+
+include $(MAKEROOT)/Makefiles/header.makefile
+
+APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
+
+.PHONY:all
+all: $(MAKEROOT)/bin $(APPLICATION)
+
+$(APPLICATION): $(OBJECTS)
+ $(LINKER) -o $(APPLICATION) $(VFR_LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS)
+
+VfrCompiler.o: ../Include/Common/BuildVersion.h
+
+include $(MAKEROOT)/Makefiles/footer.makefile
+
+VfrSyntax.cpp EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h: Pccts/antlr/antlr VfrSyntax.g
+ Pccts/antlr/antlr -CC -e3 -ck 3 -k 2 -fl VfrParser.dlg -ft VfrTokens.h -o . VfrSyntax.g
+
+VfrLexer.cpp VfrLexer.h: Pccts/dlg/dlg VfrParser.dlg
+ Pccts/dlg/dlg -C2 -i -CC -cl VfrLexer -o . VfrParser.dlg
+
+Pccts/antlr/antlr:
+ BIN_DIR='.' $(MAKE) -C Pccts/antlr
+
+Pccts/dlg/dlg:
+ BIN_DIR='.' $(MAKE) -C Pccts/dlg
+
+ATokenBuffer.o: Pccts/h/ATokenBuffer.cpp
+ $(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $(VFR_CXXFLAGS) $? -o $@
+
+DLexerBase.o: Pccts/h/DLexerBase.cpp
+ $(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $(VFR_CXXFLAGS) $? -o $@
+
+AParser.o: Pccts/h/AParser.cpp
+ $(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $(VFR_CXXFLAGS) $? -o $@
+
+VfrSyntax.o: VfrSyntax.cpp
+ $(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $(VFR_CXXFLAGS) $? -o $@
+
+clean: localClean
+
+localClean:
+ BIN_DIR='.' $(MAKE) -C Pccts/antlr clean
+ BIN_DIR='.' $(MAKE) -C Pccts/dlg clean
+ rm -f $(EXTRA_CLEAN_OBJECTS)
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Makefile b/roms/edk2/BaseTools/Source/C/VfrCompile/Makefile
new file mode 100644
index 000000000..d6ec6ad00
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Makefile
@@ -0,0 +1,50 @@
+## @file
+# Windows makefile for 'VfrCompile' module build.
+#
+# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+CPPFLAGS = $(CPPFLAGS) /WX /D PCCTS_USE_NAMESPACE_STD
+APPNAME = VfrCompile
+
+LIBS = $(LIB_PATH)\Common.lib
+
+OBJECTS = AParser.obj DLexerBase.obj ATokenBuffer.obj \
+ EfiVfrParser.obj VfrLexer.obj VfrSyntax.obj \
+ VfrFormPkg.obj VfrError.obj VfrUtilityLib.obj VfrCompiler.obj
+
+INC = $(INC) -I $(BASE_TOOLS_PATH)\Source\C\VfrCompile\Pccts\h
+
+!INCLUDE ..\Makefiles\ms.app
+
+VfrSyntax.cpp EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h: VfrSyntax.g
+ pushd . & cd Pccts & $(MAKE) & popd
+ antlr -CC -e3 -ck 3 -k 2 -fl VfrParser.dlg -ft VfrTokens.h -o . VfrSyntax.g
+# pushd . & cd Pccts & $(MAKE) clean
+
+VfrLexer.cpp VfrLexer.h: VfrParser.dlg
+ dlg -C2 -i -CC -cl VfrLexer -o . VfrParser.dlg
+
+ATokenBuffer.obj: Pccts\h\ATokenBuffer.cpp
+ $(CXX) -c $(CPPFLAGS) $(INC) $? -Fo$@
+
+DLexerBase.obj: Pccts\h\DLexerBase.cpp
+ $(CXX) -c $(CPPFLAGS) $(INC) $? -Fo$@
+
+AParser.obj: Pccts\h\AParser.cpp
+ $(CXX) -c $(CPPFLAGS) $(INC) $? -Fo$@
+
+EXTRA_CLEAN_OBJECTS = VfrParser.dlg EfiVfrParser.cpp EfiVfrParser.h \
+ VfrLexer.cpp VfrLexer.h \
+ VfrSyntax.cpp VfrTokens.h
+
+clean: localClean
+cleanall: localClean localCleanall
+
+localClean:
+ -DEL $(EXTRA_CLEAN_OBJECTS)
+
+localCleanall:
+ pushd . & cd Pccts & $(MAKE) cleanall & popd
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_FROM_131.txt b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_FROM_131.txt
new file mode 100644
index 000000000..500d84f2e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_FROM_131.txt
@@ -0,0 +1,522 @@
+CHANGES FROM 1.31
+
+This file contains the migration of PCCTS from 1.31 in the order that
+changes were made. 1.32b7 is the last beta before full 1.32.
+Terence Parr, Parr Research Corporation 1995.
+
+
+======================================================================
+1.32b1
+Added Russell Quong to banner, changed banner for output slightly
+Fixed it so that you have before / after actions for C++ in class def
+Fixed bug in optimizer that made it sometimes forget to set internal
+ token pointers. Only showed up when a {...} was in the "wrong spot".
+
+======================================================================
+1.32b2
+Added fixes by Dave Seidel for PC compilers in 32 bit mode (config.h
+and set.h).
+
+======================================================================
+1.32b3
+Fixed hideous bug in code generator for wildcard and for ~token op.
+
+from Dave Seidel
+
+ Added pcnames.bat
+ 1. in antlr/main.c: change strcasecmp() to stricmp()
+
+ 2. in dlg/output.c: use DLEXER_C instead on "DLexer.C"
+
+ 3. in h/PBlackBox.h: use <iostream.h> instead of <stream.h>
+
+======================================================================
+1.32b4
+When the -ft option was used, any path prefix screwed up
+the gate on the .h files
+
+Fixed yet another bug due to the optimizer.
+
+The exception handling thing was a bit wacko:
+
+a : ( A B )? A B
+ | A C
+ ;
+ exception ...
+
+caused an exception if "A C" was the input. In other words,
+it found that A C didn't match the (A B)? pred and caused
+an exception rather than trying the next alt. All I did
+was to change the zzmatch_wsig() macros.
+
+Fixed some problems in gen.c relating to the name of token
+class bit sets in the output.
+
+Added the tremendously cool generalized predicate. For the
+moment, I'll give this bried description.
+
+a : <<predicate>>? blah
+ | foo
+ ;
+
+This implies that (assuming blah and foo are syntactically
+ambiguous) "predicate" indicates the semantic validity of
+applying "blah". If "predicate" is false, "foo" is attempted.
+
+Previously, you had to say:
+
+a : <<LA(1)==ID ? predicate : 1>>? ID
+ | ID
+ ;
+
+Now, you can simply use "predicate" without the ?: operator
+if you turn on ANTLR command line option: "-prc on". This
+tells ANTLR to compute that all by itself. It computes n
+tokens of lookahead where LT(n) or LATEXT(n) is the farthest
+ahead you look.
+
+If you give a predicate using "-prc on" that is followed
+by a construct that can recognize more than one n-sequence,
+you will get a warning from ANTLR. For example,
+
+a : <<isTypeName(LT(1)->getText())>>? (ID|INT)
+ ;
+
+This is wrong because the predicate will be applied to INTs
+as well as ID's. You should use this syntax to make
+the predicate more specific:
+
+a : (ID)? => <<isTypeName(LT(1)->getText())>>? (ID|INT)
+ ;
+
+which says "don't apply the predicate unless ID is the
+current lookahead context".
+
+You cannot currently have anything in the "(context)? =>"
+except sequences such as:
+
+( LPAREN ID | LPAREN SCOPE )? => <<pred>>?
+
+I haven't tested this THAT much, but it does work for the
+C++ grammar.
+
+======================================================================
+1.32b5
+
+Added getLine() to the ANTLRTokenBase and DLGBasedToken classes
+left line() for backward compatibility.
+----
+Removed SORCERER_TRANSFORM from the ast.h stuff.
+-------
+Fixed bug in code gen of ANTLR such that nested syn preds work more
+efficiently now. The ANTLRTokenBuffer was getting very large
+with nested predicates.
+------
+Memory leak is now gone from ANTLRTokenBuf; all tokens are deleted.
+For backward compatibility reasons, you have to say parser->deleteTokens()
+or mytokenbuffer->deleteTokens() but later it will be the default mode.
+Say this after the parser is constructed. E.g.,
+
+ ParserBlackBox<DLGLexer, MyParser, ANTLRToken> p(stdin);
+ p.parser()->deleteTokens();
+ p.parser()->start_symbol();
+
+
+==============================
+1.32b6
+
+Changed so that deleteTokens() will do a delete ((ANTLRTokenBase *))
+on the ptr. This gets the virtual destructor.
+
+Fixed some weird things in the C++ header files (a few return types).
+
+Made the AST routines correspond to the book and SORCERER stuff.
+
+New token stuff: See testcpp/14/test.g
+
+ANTLR accepts a #pragma gc_tokens which says
+[1] Generate label = copy(LT(1)) instead of label=LT(1) for
+ all labeled token references.
+[2] User now has to define ANTLRTokenPtr (as a class or a typedef
+ to just a pointer) as well as the ANTLRToken class itself.
+ See the example.
+
+To delete tokens in token buffer, use deleteTokens() message on parser.
+
+ All tokens that fall off the ANTLRTokenBuffer get deleted
+ which is what currently happens when deleteTokens() message
+ has been sent to token buffer.
+
+We always generate ANTLRTokenPtr instead of 'ANTLRToken *' now.
+Then if no pragma set, ANTLR generates a
+
+ class ANTLRToken;
+ typedef ANTLRToken *ANTLRTokenPtr;
+
+in each file.
+
+Made a warning for x:rule_ref <<$x>>; still no warning for $i's, however.
+class BB {
+
+a : x:b y:A <<$x
+$y>>
+ ;
+
+b : B;
+
+}
+generates
+Antlr parser generator Version 1.32b6 1989-1995
+test.g, line 3: error: There are no token ptrs for rule references: '$x'
+
+===================
+1.32b7:
+
+[With respect to token object garbage collection (GC), 1.32b7
+ backtracks from 1.32b6, but results in better and less intrusive GC.
+ This is the last beta version before full 1.32.]
+
+BIGGEST CHANGES:
+
+o The "#pragma gc_tokens" is no longer used.
+
+o .C files are now .cpp files (hence, makefiles will have to
+ be changed; or you can rerun genmk). This is a good move,
+ but causes some backward incompatibility problems. You can
+ avoid this by changing CPP_FILE_SUFFIX to ".C" in pccts/h/config.h.
+
+o The token object class hierarchy has been flattened to include
+ only three classes: ANTLRAbstractToken, ANTLRCommonToken, and
+ ANTLRCommonNoRefCountToken. The common token now does garbage
+ collection via ref counting.
+
+o "Smart" pointers are now used for garbage collection. That is,
+ ANTLRTokenPtr is used instead of "ANTLRToken *".
+
+o The antlr.1 man page has been cleaned up slightly.
+
+o The SUN C++ compiler now complains less about C++ support code.
+
+o Grammars which subclass ANTLRCommonToken must wrap all token
+ pointer references in mytoken(token_ptr). This is the only
+ serious backward incompatibility. See below.
+
+
+MINOR CHANGES:
+
+--------------------------------------------------------
+1 deleteTokens()
+
+The deleteTokens() message to the parser or token buffer has been changed
+to one of:
+
+ void noGarbageCollectTokens() { inputTokens->noGarbageCollectTokens(); }
+ void garbageCollectTokens() { inputTokens->garbageCollectTokens(); }
+
+The token buffer deletes all non-referenced tokens by default now.
+
+--------------------------------------------------------
+2 makeToken()
+
+The makeToken() message returns a new type. The function should look
+like:
+
+ virtual ANTLRAbstractToken *makeToken(ANTLRTokenType tt,
+ ANTLRChar *txt,
+ int line)
+ {
+ ANTLRAbstractToken *t = new ANTLRCommonToken(tt,txt);
+ t->setLine(line);
+ return t;
+ }
+
+--------------------------------------------------------
+3 TokenType
+
+Changed TokenType-> ANTLRTokenType (often forces changes in AST defs due
+to #[] constructor called to AST(tokentype, string)).
+
+--------------------------------------------------------
+4 AST()
+
+You must define AST(ANTLRTokenPtr t) now in your AST class definition.
+You might also have to include ATokPtr.h above the definition; e.g.,
+if AST is defined in a separate file, such as AST.h, it's a good idea
+to include ATOKPTR_H (ATokPtr.h). For example,
+
+ #include ATOKPTR_H
+ class AST : public ASTBase {
+ protected:
+ ANTLRTokenPtr token;
+ public:
+ AST(ANTLRTokenPtr t) { token = t; }
+ void preorder_action() {
+ char *s = token->getText();
+ printf(" %s", s);
+ }
+ };
+
+Note the use of smart pointers rather than "ANTLRToken *".
+
+--------------------------------------------------------
+5 SUN C++
+
+From robertb oakhill.sps.mot.com Bob Bailey. Changed ANTLR C++ output
+to avoid an error in Sun C++ 3.0.1. Made "public" return value
+structs created to hold multiple return values public.
+
+--------------------------------------------------------
+6 genmk
+
+Fixed genmk so that target List.* is not included anymore. It's
+called SList.* anyway.
+
+--------------------------------------------------------
+7 \r vs \n
+
+Scott Vorthmann <vorth cmu.edu> fixed antlr.g in ANTLR so that \r
+is allowed as the return character as well as \n.
+
+--------------------------------------------------------
+8 Exceptions
+
+Bug in exceptions attached to labeled token/tokclass references. Didn't gen
+code for exceptions. This didn't work:
+
+a : "help" x:ID
+ ;
+ exception[x]
+ catch MismatchedToken : <<printf("eh?\n");>>
+
+Now ANTLR generates (which is kinda big, but necessary):
+
+ if ( !_match_wsig(ID) ) {
+ if ( guessing ) goto fail;
+ _signal=MismatchedToken;
+ switch ( _signal ) {
+ case MismatchedToken :
+ printf("eh?\n");
+ _signal = NoSignal;
+ break;
+ default :
+ goto _handler;
+ }
+ }
+
+which implies that you can recover and continue parsing after a missing/bad
+token reference.
+
+--------------------------------------------------------
+9 genmk
+
+genmk now correctly uses config file for CPP_FILE_SUFFIX stuff.
+
+--------------------------------------------------------
+10 general cleanup / PURIFY
+
+Anthony Green <green vizbiz.com> suggested a bunch of good general
+clean up things for the code; he also suggested a few things to
+help out the "PURIFY" memory allocation checker.
+
+--------------------------------------------------------
+11 $-variable references.
+
+Manuel ORNATO indicated that a $-variable outside of a rule caused
+ANTLR to crash. I fixed this.
+
+12 Tom Moog suggestion
+
+Fail action of semantic predicate needs "{}" envelope. FIXED.
+
+13 references to LT(1).
+
+I have enclosed all assignments such as:
+
+ _t22 = (ANTLRTokenPtr)LT(1);
+
+in "if ( !guessing )" so that during backtracking the reference count
+for token objects is not increased.
+
+
+TOKEN OBJECT GARBAGE COLLECTION
+
+1 INTRODUCTION
+
+The class ANTLRCommonToken is now garbaged collected through a "smart"
+pointer called ANTLRTokenPtr using reference counting. Any token
+object not referenced by your grammar actions is destroyed by the
+ANTLRTokenBuffer when it must make room for more token objects.
+Referenced tokens are then destroyed in your parser when local
+ANTLRTokenPtr objects are deleted. For example,
+
+a : label:ID ;
+
+would be converted to something like:
+
+void yourclass::a(void)
+{
+ zzRULE;
+ ANTLRTokenPtr label=NULL; // used to be ANTLRToken *label;
+ zzmatch(ID);
+ label = (ANTLRTokenPtr)LT(1);
+ consume();
+ ...
+}
+
+When the "label" object is destroyed (it's just a pointer to your
+input token object LT(1)), it decrements the reference count on the
+object created for the ID. If the count goes to zero, the object
+pointed by label is deleted.
+
+To correctly manage the garbage collection, you should use
+ANTLRTokenPtr instead of "ANTLRToken *". Most ANTLR support code
+(visible to the user) has been modified to use the smart pointers.
+
+***************************************************************
+Remember that any local objects that you create are not deleted when a
+lonjmp() is executed. Unfortunately, the syntactic predicates (...)?
+use setjmp()/longjmp(). There are some situations when a few tokens
+will "leak".
+***************************************************************
+
+2 DETAILS
+
+o The default is to perform token object garbage collection.
+ You may use parser->noGarbageCollectTokens() to turn off
+ garbage collection.
+
+
+o The type ANTLRTokenPtr is always defined now (automatically).
+ If you do not wish to use smart pointers, you will have to
+ redefined ANTLRTokenPtr by subclassing, changing the header
+ file or changing ANTLR's code generation (easy enough to
+ do in gen.c).
+
+o If you don't use ParserBlackBox, the new initialization sequence is:
+
+ ANTLRTokenPtr aToken = new ANTLRToken;
+ scan.setToken(mytoken(aToken));
+
+ where mytoken(aToken) gets an ANTLRToken * from the smart pointer.
+
+o Define C++ preprocessor symbol DBG_REFCOUNTTOKEN to see a bunch of
+ debugging stuff for reference counting if you suspect something.
+
+
+3 WHY DO I HAVE TO TYPECAST ALL MY TOKEN POINTERS NOW??????
+
+If you subclass ANTLRCommonToken and then attempt to refer to one of
+your token members via a token pointer in your grammar actions, the
+C++ compiler will complain that your token object does not have that
+member. For example, if you used to do this
+
+<<
+class ANTLRToken : public ANTLRCommonToken {
+ int muck;
+ ...
+};
+>>
+
+class Foo {
+a : t:ID << t->muck = ...; >> ;
+}
+
+Now, you must do change the t->muck reference to:
+
+a : t:ID << mytoken(t)->muck = ...; >> ;
+
+in order to downcast 't' to be an "ANTLRToken *" not the
+"ANTLRAbstractToken *" resulting from ANTLRTokenPtr::operator->().
+The macro is defined as:
+
+/*
+ * Since you cannot redefine operator->() to return one of the user's
+ * token object types, we must down cast. This is a drag. Here's
+ * a macro that helps. template: "mytoken(a-smart-ptr)->myfield".
+ */
+#define mytoken(tp) ((ANTLRToken *)(tp.operator->()))
+
+You have to use macro mytoken(grammar-label) now because smart
+pointers are not specific to a parser's token objects. In other
+words, the ANTLRTokenPtr class has a pointer to a generic
+ANTLRAbstractToken not your ANTLRToken; the ANTLR support code must
+use smart pointers too, but be able to work with any kind of
+ANTLRToken. Sorry about this, but it's C++'s fault not mine. Some
+nebulous future version of the C++ compilers should obviate the need
+to downcast smart pointers with runtime type checking (and by allowing
+different return type of overridden functions).
+
+A way to have backward compatible code is to shut off the token object
+garbage collection; i.e., use parser->noGarbageCollectTokens() and
+change the definition of ANTLRTokenPtr (that's why you get source code
+<wink>).
+
+
+PARSER EXCEPTION HANDLING
+
+I've noticed some weird stuff with the exception handling. I intend
+to give this top priority for the "book release" of ANTLR.
+
+==========
+1.32 Full Release
+
+o Changed Token class hierarchy to be (Thanks to Tom Moog):
+
+ ANTLRAbstractToken
+ ANTLRRefCountToken
+ ANTLRCommonToken
+ ANTLRNoRefCountCommonToken
+
+o Added virtual panic() to ANTLRAbstractToken. Made ANTLRParser::panic()
+ virtual also.
+
+o Cleaned up the dup() stuff in AST hierarchy to use shallowCopy() to
+ make node copies. John Farr at Medtronic suggested this. I.e.,
+ if you want to use dup() with either ANTLR or SORCERER or -transform
+ mode with SORCERER, you must defined shallowCopy() as:
+
+ virtual PCCTS_AST *shallowCopy()
+ {
+ return new AST;
+ p->setDown(NULL);
+ p->setRight(NULL);
+ return p;
+ }
+
+ or
+
+ virtual PCCTS_AST *shallowCopy()
+ {
+ return new AST(*this);
+ }
+
+ if you have defined a copy constructor such as
+
+ AST(const AST &t) // shallow copy constructor
+ {
+ token = t.token;
+ iconst = t.iconst;
+ setDown(NULL);
+ setRight(NULL);
+ }
+
+o Added a warning with -CC and -gk are used together. This is broken,
+ hence a warning is appropriate.
+
+o Added warning when #-stuff is used w/o -gt option.
+
+o Updated MPW installation.
+
+o "Miller, Philip W." <MILLERPW f1groups.fsd.jhuapl.edu> suggested
+ that genmk be use RENAME_OBJ_FLAG RENAME_EXE_FLAG instead of
+ hardcoding "-o" in genmk.c.
+
+o made all exit() calls use EXIT_SUCCESS or EXIT_FAILURE.
+
+===========================================================================
+1.33
+
+EXIT_FAILURE and EXIT_SUCCESS were not always defined. I had to modify
+a bunch of files to use PCCTS_EXIT_XXX, which forces a new version. Sorry
+about that.
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_FROM_133.txt b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_FROM_133.txt
new file mode 100644
index 000000000..4d84d1c19
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_FROM_133.txt
@@ -0,0 +1,2448 @@
+=======================================================================
+List of Implemented Fixes and Changes for Maintenance Releases of PCCTS
+=======================================================================
+
+ DISCLAIMER
+
+ The software and these notes are provided "as is". They may include
+ typographical or technical errors and their authors disclaims all
+ liability of any kind or nature for damages due to error, fault,
+ defect, or deficiency regardless of cause. All warranties of any
+ kind, either express or implied, including, but not limited to, the
+ implied warranties of merchantability and fitness for a particular
+ purpose are disclaimed.
+
+
+ -------------------------------------------------------
+ Note: Items #153 to #1 are now in a separate file named
+ CHANGES_FROM_133_BEFORE_MR13.txt
+ -------------------------------------------------------
+
+#312. (Changed in MR33) Bug caused by change #299.
+
+ In change #299 a warning message was suppressed when there was
+ no LT(1) in a semantic predicate and max(k,ck) was 1. The
+ changed caused the code which set a default predicate depth for
+ the semantic predicate to be left as 0 rather than set to 1.
+
+ This manifested as an error at line #1559 of mrhost.c
+
+ Reported by Peter Dulimov.
+
+#311. (Changed in MR33) Added sorcer/lib to Makefile.
+
+ Reported by Dale Martin.
+
+#310. (Changed in MR32) In C mode zzastPush was spelled zzastpush in one case.
+
+ Reported by Jean-Claude Durand
+
+#309. (Changed in MR32) Renamed baseName because of VMS name conflict
+
+ Renamed baseName to pcctsBaseName to avoid library name conflict with
+ VMS library routine. Reported by Jean-François PIÉRONNE.
+
+#308. (Changed in MR32) Used "template" as name of formal in C routine
+
+ In astlib.h routine ast_scan a formal was named "template". This caused
+ problems when the C code was compiled with a C++ compiler. Reported by
+ Sabyasachi Dey.
+
+#307. (Changed in MR31) Compiler dependent bug in function prototype generation
+
+ The code which generated function prototypes contained a bug which
+ was compiler/optimization dependent. Under some circumstance an
+ extra character would be included in portions of a function prototype.
+
+ Reported by David Cook.
+
+#306. (Changed in MR30) Validating predicate following a token
+
+ A validating predicate which immediately followed a token match
+ consumed the token after the predicate rather than before. Prior
+ to this fix (in the following example) isValidTimeScaleValue() in
+ the predicate would test the text for TIMESCALE rather than for
+ NUMBER:
+
+ time_scale :
+ TIMESCALE
+ <<isValidTimeScaleValue(LT(1)->getText())>>?
+ ts:NUMBER
+ ( us:MICROSECOND << tVal = ...>>
+ | ns:NANOSECOND << tVal = ... >>
+ )
+
+ Reported by Adalbert Perbandt.
+
+#305. (Changed in MR30) Alternatives with guess blocks inside (...)* blocks.
+
+ In MR14 change #175 fixed a bug in the prediction expressions for guess
+ blocks which were of the form (alpha)? beta. Unfortunately, this
+ resulted in a new bug as exemplified by the example below, which computed
+ the first set for r as {B} rather than {B C}:
+
+ r : ( (A)? B
+ | C
+ )*
+
+ This example doesn't make any sense as A is not a prefix of B, but it
+ illustrates the problem. This bug did not appear for:
+
+ r : ( (A)?
+ | C
+ )*
+
+ because it does not use the (alpha)? beta form.
+
+ Item #175 fixed an asymmetry in ambiguity messages for the following
+ constructs which appear to have identical ambiguities (between repeating
+ the loop vs. exiting the loop). MR30 retains this fix, but the implementation
+ is slightly different.
+
+ r_star : ( (A B)? )* A ;
+ r_plus : ( (A B)? )+ A ;
+
+ Reported by Arpad Beszedes (beszedes inf.u-szeged.hu).
+
+#304. (Changed in MR30) Crash when mismatch between output value counts.
+
+ For a rule such as:
+
+ r1 : r2>[i,j];
+ r2 >[int i, int j] : A;
+
+ If there were extra actuals for the reference to rule r2 from rule r1
+ there antlr would crash. This bug was introduced by change #276.
+
+ Reported by Sinan Karasu.
+
+#303. (Changed in MR30) DLGLexerBase::replchar
+
+ DLGLexerBase::replchar and the C mode routine zzreplchar did not work
+ properly when the new character was 0.
+
+ Reported with fix by Philippe Laporte
+
+#302. (Changed in MR28) Fix significant problems in initial release of MR27.
+
+#301. (Changed in MR27) Default tab stops set to 2 spaces.
+
+ To have antlr generate true tabs rather than spaces, use "antlr -tab 0".
+ To generate 4 spaces per tab stop use "antlr -tab 4"
+
+#300. (Changed in MR27)
+
+ Consider the following methods of constructing an AST from ID:
+
+ rule1!
+ : id:ID << #0 = #[id]; >> ;
+
+ rule2!
+ : id:ID << #0 = #id; >> ;
+
+ rule3
+ : ID ;
+
+ rule4
+ : id:ID << #0 = #id; >> ;
+
+ For rule_2, the AST corresponding to id would always be NULL. This
+ is because the user explicitly suppressed AST construction using the
+ "!" operator on the rule. In MR27 the use of an AST expression
+ such as #id overrides the "!" operator and forces construction of
+ the AST.
+
+ This fix does not apply to C mode ASTs when the ASTs are referenced
+ using numbers rather than symbols.
+
+ For C mode, this requires that the (optional) function/macro zzmk_ast
+ be defined. This functions copies information from an attribute into
+ a previously allocated AST.
+
+ Reported by Jan Langer (jan langernetz.de)
+
+#299. (Changed in MR27) Don't warn if k=1 and semantic predicate missing LT(i)
+
+ If a semantic does not have a reference to LT(i) or (C mode LATEXT(i))
+ then pccts doesn't know how many lookahead tokens to use for context.
+ However, if max(k,ck) is 1 then there is really only one choice and
+ the warning is unnecessary.
+
+#298. (Changed in MR27) Removed "register" for lastpos in dlgauto.c zzgettok
+
+#297. (Changed in MR27) Incorrect prototypes when used with classic C
+
+ There were a number of errors in function headers when antlr was
+ built with compilers that do not have __STDC__ or __cplusplus set.
+
+ The functions which have variable length argument lists now use
+ PCCTS_USE_STDARG rather than __USE_PROTOTYPES__ to determine
+ whether to use stdargs or varargs.
+
+#296. (Changed in MR27) Complex return types in rules.
+
+ The following return type was not properly handled when
+ unpacking a struct with containing multiple return values:
+
+ rule > [int i, IIR_Bool (IIR_Decl::*constraint)()] : ...
+
+ Instead of using "constraint", the program got lost and used
+ an empty string.
+
+ Reported by P.A. Wilsey.
+
+#295. (Changed in MR27) Extra ";" following zzGUESS_DONE sometimes.
+
+ Certain constructs with guess blocks in MR23 led to extra ";"
+ preceding the "else" clause of an "if".
+
+ Reported by P.A. Wilsey.
+
+#294. (Changed in MR27) Infinite loop in antlr for nested blocks
+
+ An oversight in detecting an empty alternative sometimes led
+ to an infinite loop in antlr when it encountered a rule with
+ nested blocks and guess blocks.
+
+ Reported by P.A. Wilsey.
+
+#293. (Changed in MR27) Sorcerer optimization of _t->type()
+
+ Sorcerer generated code may contain many calls to _t->type() in a
+ single statement. This change introduces a temporary variable
+ to eliminate unnecesary function calls.
+
+ Change implemented by Tom Molteno (tim videoscript.com).
+
+#292. (Changed in MR27)
+
+ WARNING: Item #267 changes the signature of methods in the AST class.
+
+ **** Be sure to revise your AST functions of the same name ***
+
+#291. (Changed in MR24)
+
+ Fix to serious code generation error in MR23 for (...)+ block.
+
+#290. (Changed in MR23)
+
+ Item #247 describes a change in the way {...} blocks handled
+ an error. Consider:
+
+ r1 : {A} b ;
+ b : B;
+
+ with input "C".
+
+ Prior to change #247, the error would resemble "expected B -
+ found C". This is correct but incomplete, and therefore
+ misleading. In #247 it was changed to "expected A, B - found
+ C". This was fine, except for users of parser exception
+ handling because the exception was generated in the epilogue
+ for {...} block rather than in rule b. This made it difficult
+ for users of parser exception handling because B was not
+ expected in that context. Those not using parser exception
+ handling didn't notice the difference.
+
+ The current change restores the behavior prior to #247 when
+ parser exceptions are present, but retains the revised behavior
+ otherwise. This change should be visible only when exceptions
+ are in use and only for {...} blocks and sub-blocks of the form
+ (something|something | something | epsilon) where epsilon represents
+ an empty production and it is the last alternative of a sub-block.
+ In contrast, (something | epsilon | something) should generate the
+ same code as before, even when exceptions are used.
+
+ Reported by Philippe Laporte (philippe at transvirtual.com).
+
+#289. (Changed in MR23) Bug in matching complement of a #tokclass
+
+ Prior to MR23 when a #tokclass was matched in both its complemented form
+ and uncomplemented form, the bit set generated for its first use was used
+ for both cases. However, the prediction expression was correctly computed
+ in both cases. This meant that the second case would never be matched
+ because, for the second appearance, the prediction expression and the
+ set to be matched would be complements of each other.
+
+ Consider:
+
+ #token A "a"
+ #token B "b"
+ #token C "c"
+ #tokclass AB {A B}
+
+ r1 : AB /* alt 1x */
+ | ~AB /* alt 1y */
+ ;
+
+ Prior to MR23, this resulted in alternative 1y being unreachable. Had it
+ been written:
+
+ r2 : ~AB /* alt 2x */
+ : AB /* alt 2y */
+
+ then alternative 2y would have become unreachable.
+
+ This bug was only for the case of complemented #tokclass. For complemented
+ #token the proper code was generated.
+
+#288. (Changed in MR23) #errclass not restricted to choice points
+
+ The #errclass directive is supposed to allow a programmer to define
+ print strings which should appear in syntax error messages as a replacement
+ for some combinations of tokens. For instance:
+
+ #errclass Operator {PLUS MINUS TIMES DIVIDE}
+
+ If a syntax message includes all four of these tokens, and there is no
+ "better" choice of error class, the word "Operator" will be used rather
+ than a list of the four token names.
+
+ Prior to MR23 the #errclass definitions were used only at choice points
+ (which call the FAIL macro). In other cases where there was no choice
+ (e.g. where a single token or token class were matched) the #errclass
+ information was not used.
+
+ With MR23 the #errclass declarations are used for syntax error messages
+ when matching a #tokclass, a wildcard (i.e. "*"), or the complement of a
+ #token or #tokclass (e.g. ~Operator).
+
+ Please note that #errclass may now be defined using #tokclass names
+ (see Item #284).
+
+ Reported by Philip A. Wilsey.
+
+#287. (Changed in MR23) Print name for #tokclass
+
+ Item #148 describes how to give a print name to a #token so that,for
+ example, #token ID could have the expression "identifier" in syntax
+ error messages. This has been extended to #tokclass:
+
+ #token ID("identifier") "[a-zA-Z]+"
+ #tokclass Primitive("primitive type")
+ {INT, FLOAT, CHAR, FLOAT, DOUBLE, BOOL}
+
+ This is really a cosmetic change, since #tokclass names do not appear
+ in any error messages.
+
+#286. (Changed in MR23) Makefile change to use of cd
+
+ In cases where a pccts subdirectory name matched a directory identified
+ in a $CDPATH environment variable the build would fail. All makefile
+ cd commands have been changed from "cd xyz" to "cd ./xyz" in order
+ to avoid this problem.
+
+#285. (Changed in MR23) Check for null pointers in some dlg structures
+
+ An invalid regular expression can cause dlg to build an invalid
+ structure to represent the regular expression even while it issues
+ error messages. Additional pointer checks were added.
+
+ Reported by Robert Sherry.
+
+#284. (Changed in MR23) Allow #tokclass in #errclass definitions
+
+ Previously, a #tokclass reference in the definition of an
+ #errclass was not handled properly. Instead of being expanded
+ into the set of tokens represented by the #tokclass it was
+ treated somewhat like an #errclass. However, in a later phase
+ when all #errclass were expanded into the corresponding tokens
+ the #tokclass reference was not expanded (because it wasn't an
+ #errclass). In effect the reference was ignored.
+
+ This has been fixed.
+
+ Problem reported by Mike Dimmick (mike dimmick.demon.co.uk).
+
+#283. (Changed in MR23) Option -tmake invoke's parser's tmake
+
+ When the string #(...) appears in an action antlr replaces it with
+ a call to ASTBase::tmake(...) to construct an AST. It is sometimes
+ useful to change the tmake routine so that it has access to information
+ in the parser - something which is not possible with a static method
+ in an application where they may be multiple parsers active.
+
+ The antlr option -tmake replaces the call to ASTBase::tmake with a call
+ to a user supplied tmake routine.
+
+#282. (Changed in MR23) Initialization error for DBG_REFCOUNTTOKEN
+
+ When the pre-processor symbol DBG_REFCOUNTTOKEN is defined
+ incorrect code is generated to initialize ANTLRRefCountToken::ctor and
+ dtor.
+
+ Fix reported by Sven Kuehn (sven sevenkuehn.de).
+
+#281. (Changed in MR23) Addition of -noctor option for Sorcerer
+
+ Added a -noctor option to suppress generation of the blank ctor
+ for users who wish to define their own ctor.
+
+ Contributed by Jan Langer (jan langernetz.de).
+
+#280. (Changed in MR23) Syntax error message for EOF token
+
+ The EOF token now receives special treatment in syntax error messages
+ because there is no text matched by the eof token. The token name
+ of the eof token is used unless it is "@" - in which case the string
+ "<eof>" is used.
+
+ Problem reported by Erwin Achermann (erwin.achermann switzerland.org).
+
+#279. (Changed in MR23) Exception groups
+
+ There was a bug in the way that exception groups were attached to
+ alternatives which caused problems when there was a block contained
+ in an alternative. For instance, in the following rule;
+
+ statement : IF S { ELSE S }
+ exception ....
+ ;
+
+ the exception would be attached to the {...} block instead of the
+ entire alternative because it was attached, in error, to the last
+ alternative instead of the last OPEN alternative.
+
+ Reported by Ty Mordane (tymordane hotmail.com).
+
+#278. (Changed in MR23) makefile changes
+
+ Contributed by Tomasz Babczynski (faster lab05-7.ict.pwr.wroc.pl).
+
+ The -cfile option is not absolutely needed: when extension of
+ source file is one of the well-known C/C++ extensions it is
+ treated as C/C++ source
+
+ The gnu make defines the CXX variable as the default C++ compiler
+ name, so I added a line to copy this (if defined) to the CCC var.
+
+ Added a -sor option: after it any -class command defines the class
+ name for sorcerer, not for ANTLR. A file extended with .sor is
+ treated as sorcerer input. Because sorcerer can be called multiple
+ times, -sor option can be repeated. Any files and classes (one class
+ per group) after each -sor makes one tree parser.
+
+ Not implemented:
+
+ 1. Generate dependences for user c/c++ files.
+ 2. Support for -sor in c mode not.
+
+ I have left the old genmk program in the directory as genmk_old.c.
+
+#277. (Changed in MR23) Change in macro for failed semantic predicates
+
+ In the past, a semantic predicate that failed generated a call to
+ the macro zzfailed_pred:
+
+ #ifndef zzfailed_pred
+ #define zzfailed_pred(_p) \
+ if (guessing) { \
+ zzGUESS_FAIL; \
+ } else { \
+ something(_p)
+ }
+ #endif
+
+ If a user wished to use the failed action option for semantic predicates:
+
+ rule : <<my_predicate>>? [my_fail_action] A
+ | ...
+
+
+ the code for my_fail_action would have to contain logic for handling
+ the guess part of the zzfailed_pred macro. The user should not have
+ to be aware of the guess logic in writing the fail action.
+
+ The zzfailed_pred has been rewritten to have three arguments:
+
+ arg 1: the stringized predicate of the semantic predicate
+ arg 2: 0 => there is no user-defined fail action
+ 1 => there is a user-defined fail action
+ arg 3: the user-defined fail action (if defined)
+ otherwise a no-operation
+
+ The zzfailed_pred macro is now defined as:
+
+ #ifndef zzfailed_pred
+ #define zzfailed_pred(_p,_hasuseraction,_useraction) \
+ if (guessing) { \
+ zzGUESS_FAIL; \
+ } else { \
+ zzfailed_pred_action(_p,_hasuseraction,_useraction) \
+ }
+ #endif
+
+
+ With zzfailed_pred_action defined as:
+
+ #ifndef zzfailed_pred_action
+ #define zzfailed_pred_action(_p,_hasuseraction,_useraction) \
+ if (_hasUserAction) { _useraction } else { failedSemanticPredicate(_p); }
+ #endif
+
+ In C++ mode failedSemanticPredicate() is a virtual function.
+ In C mode the default action is a fprintf statement.
+
+ Suggested by Erwin Achermann (erwin.achermann switzerland.org).
+
+#276. (Changed in MR23) Addition of return value initialization syntax
+
+ In an attempt to reduce the problems caused by the PURIFY macro I have
+ added new syntax for initializing the return value of rules and the
+ antlr option "-nopurify".
+
+ A rule with a single return argument:
+
+ r1 > [Foo f = expr] :
+
+ now generates code that resembles:
+
+ Foo r1(void) {
+ Foo _retv = expr;
+ ...
+ }
+
+ A rule with more than one return argument:
+
+ r2 > [Foo f = expr1, Bar b = expr2 ] :
+
+ generates code that resembles:
+
+ struct _rv1 {
+ Foo f;
+ Bar b;
+ }
+
+ _rv1 r2(void) {
+ struct _rv1 _retv;
+ _retv.f = expr1;
+ _retv.b = expr2;
+ ...
+ }
+
+ C++ style comments appearing in the initialization list may cause problems.
+
+#275. (Changed in MR23) Addition of -nopurify option to antlr
+
+ A long time ago the PURIFY macro was introduced to initialize
+ return value arguments and get rid of annoying messages from program
+ that checked for uninitialized variables.
+
+ This has caused significant annoyance for C++ users that had
+ classes with virtual functions or non-trivial constructors because
+ it would zero the object, including the pointer to the virtual
+ function table. This could be defeated by redefining
+ the PURIFY macro to be empty, but it was a constant surprise to
+ new C++ users of pccts.
+
+ I would like to remove it, but I fear that some existing programs
+ depend on it and would break. My temporary solution is to add
+ an antlr option -nopurify which disables generation of the PURIFY
+ macro call.
+
+ The PURIFY macro should be avoided in favor of the new syntax
+ for initializing return arguments described in item #275.
+
+ To avoid name clash, the PURIFY macro has been renamed PCCTS_PURIFY.
+
+#274. (Changed in MR23) DLexer.cpp renamed to DLexer.h
+ (Changed in MR23) ATokPtr.cpp renamed to ATokPtrImpl.h
+
+ These two files had .cpp extensions but acted like .h files because
+ there were included in other files. This caused problems for many IDE.
+ I have renamed them. The ATokPtrImpl.h was necessary because there was
+ already an ATokPtr.h.
+
+#273. (Changed in MR23) Default win32 library changed to multi-threaded DLL
+
+ The model used for building the Win32 debug and release libraries has changed
+ to multi-threaded DLL.
+
+ To make this change in your MSVC 6 project:
+
+ Project -> Settings
+ Select the C++ tab in the right pane of the dialog box
+ Select "Category: Code Generation"
+ Under "Use run-time library" select one of the following:
+
+ Multi-threaded DLL
+ Debug Multi-threaded DLL
+
+ Suggested by Bill Menees (bill.menees gogallagher.com)
+
+#272. (Changed in MR23) Failed semantic predicate reported via virtual function
+
+ In the past, a failed semantic predicated reported the problem via a
+ macro which used fprintf(). The macro now expands into a call on
+ the virtual function ANTLRParser::failedSemanticPredicate().
+
+#271. (Changed in MR23) Warning for LT(i), LATEXT(i) in token match actions
+
+ An bug (or at least an oddity) is that a reference to LT(1), LA(1),
+ or LATEXT(1) in an action which immediately follows a token match
+ in a rule refers to the token matched, not the token which is in
+ the lookahead buffer. Consider:
+
+ r : abc <<action alpha>> D <<action beta>> E;
+
+ In this case LT(1) in action alpha will refer to the next token in
+ the lookahead buffer ("D"), but LT(1) in action beta will refer to
+ the token matched by D - the preceding token.
+
+ A warning has been added for users about this when an action
+ following a token match contains a reference to LT(1), LA(1), or LATEXT(1).
+
+ This behavior should be changed, but it appears in too many programs
+ now. Another problem, perhaps more significant, is that the obvious
+ fix (moving the consume() call to before the action) could change the
+ order in which input is requested and output appears in existing programs.
+
+ This problem was reported, along with a fix by Benjamin Mandel
+ (beny sd.co.il). However, I felt that changing the behavior was too
+ dangerous for existing code.
+
+#270. (Changed in MR23) Removed static objects from PCCTSAST.cpp
+
+ There were some statically allocated objects in PCCTSAST.cpp
+ These were changed to non-static.
+
+#269. (Changed in MR23) dlg output for initializing static array
+
+ The output from dlg contains a construct similar to the
+ following:
+
+ struct XXX {
+ static const int size;
+ static int array1[5];
+ };
+
+ const int XXX::size = 4;
+ int XXX::array1[size+1];
+
+
+ The problem is that although the expression "size+1" used in
+ the definition of array1 is equal to 5 (the expression used to
+ declare array), it is not considered equivalent by some compilers.
+
+ Reported with fix by Volker H. Simonis (simonis informatik.uni-tuebingen.de)
+
+#268. (Changed in MR23) syn() routine output when k > 1
+
+ The syn() routine is supposed to print out the text of the
+ token causing the syntax error. It appears that it always
+ used the text from the first lookahead token rather than the
+ appropriate one. The appropriate one is computed by comparing
+ the token codes of lookahead token i (for i = 1 to k) with
+ the FIRST(i) set.
+
+ This has been corrected in ANTLRParser::syn().
+
+ Reported by Bill Menees (bill.menees gogallagher.com)
+
+#267. (Changed in MR23) AST traversal functions client data argument
+
+ The AST traversal functions now take an extra (optional) parameter
+ which can point to client data:
+
+ preorder_action(void* pData = NULL)
+ preorder_before_action(void* pData = NULL)
+ preorder_after_action(void* pData = NULL)
+
+ **** Warning: this changes the AST signature. ***
+ **** Be sure to revise your AST functions of the same name ***
+
+ Bill Menees (bill.menees gogallagher.com)
+
+#266. (Changed in MR23) virtual function printMessage()
+
+ Bill Menees (bill.menees gogallagher.com) has completed the
+ tedious tasks of replacing all calls to fprintf() with calls
+ to the virtual function printMessage(). For classes which
+ have a pointer to the parser it forwards the printMessage()
+ call to the parser's printMessage() routine.
+
+ This should make it significantly easier to redirect pccts
+ error and warning messages.
+
+#265. (Changed in MR23) Remove "labase++" in C++ mode
+
+ In C++ mode labase++ is called when a token is matched.
+ It appears that labase is not used in C++ mode at all, so
+ this code has been commented out.
+
+#264. (Changed in MR23) Complete rewrite of ParserBlackBox.h
+
+ The parser black box (PBlackBox.h) was completely rewritten
+ by Chris Uzdavinis (chris atdesk.com) to improve its robustness.
+
+#263. (Changed in MR23) -preamble and -preamble_first rescinded
+
+ Changes for item #253 have been rescinded.
+
+#262. (Changed in MR23) Crash with -alpha option during traceback
+
+ Under some circumstances a -alpha traceback was started at the
+ "wrong" time. As a result, internal data structures were not
+ initialized.
+
+ Reported by Arpad Beszedes (beszedes inf.u-szeged.hu).
+
+#261. (Changed in MR23) Defer token fetch for C++ mode
+
+ Item #216 has been revised to indicate that use of the defer fetch
+ option (ZZDEFER_FETCH) requires dlg option -i.
+
+#260. (MR22) Raise default lex buffer size from 8,000 to 32,000 bytes.
+
+ ZZLEXBUFSIZE is the size (in bytes) of the buffer used by dlg
+ generated lexers. The default value has been raised to 32,000 and
+ the value used by antlr, dlg, and sorcerer has also been raised to
+ 32,000.
+
+#259. (MR22) Default function arguments in C++ mode.
+
+ If a rule is declared:
+
+ rr [int i = 0] : ....
+
+ then the declaration generated by pccts resembles:
+
+ void rr(int i = 0);
+
+ however, the definition must omit the default argument:
+
+ void rr(int i) {...}
+
+ In the past the default value was not omitted. In MR22
+ the generated code resembles:
+
+ void rr(int i /* = 0 */ ) {...}
+
+ Implemented by Volker H. Simonis (simonis informatik.uni-tuebingen.de)
+
+
+ Note: In MR23 this was changed so that nested C style comments
+ ("/* ... */") would not cause problems.
+
+#258. (MR22) Using a base class for your parser
+
+ In item #102 (MR10) the class statement was extended to allow one
+ to specify a base class other than ANTLRParser for the generated
+ parser. It turned out that this was less than useful because
+ the constructor still specified ANTLRParser as the base class.
+
+ The class statement now uses the first identifier appearing after
+ the ":" as the name of the base class. For example:
+
+ class MyParser : public FooParser {
+
+ Generates in MyParser.h:
+
+ class MyParser : public FooParser {
+
+ Generates in MyParser.cpp something that resembles:
+
+ MyParser::MyParser(ANTLRTokenBuffer *input) :
+ FooParser(input,1,0,0,4)
+ {
+ token_tbl = _token_tbl;
+ traceOptionValueDefault=1; // MR10 turn trace ON
+ }
+
+ The base class constructor must have a signature similar to
+ that of ANTLRParser.
+
+#257. (MR21a) Removed dlg statement that -i has no effect in C++ mode.
+
+ This was incorrect.
+
+#256. (MR21a) Malformed syntax graph causes crash after error message.
+
+ In the past, certain kinds of errors in the very first grammar
+ element could cause the construction of a malformed graph
+ representing the grammar. This would eventually result in a
+ fatal internal error. The code has been changed to be more
+ resistant to this particular error.
+
+#255. (MR21a) ParserBlackBox(FILE* f)
+
+ This constructor set openByBlackBox to the wrong value.
+
+ Reported by Kees Bakker (kees_bakker tasking.nl).
+
+#254. (MR21a) Reporting syntax error at end-of-file
+
+ When there was a syntax error at the end-of-file the syntax
+ error routine would substitute "<eof>" for the programmer's
+ end-of-file symbol. This substitution is now done only when
+ the programmer does not define his own end-of-file symbol
+ or the symbol begins with the character "@".
+
+ Reported by Kees Bakker (kees_bakker tasking.nl).
+
+#253. (MR21) Generation of block preamble (-preamble and -preamble_first)
+
+ *** This change was rescinded by item #263 ***
+
+ The antlr option -preamble causes antlr to insert the code
+ BLOCK_PREAMBLE at the start of each rule and block. It does
+ not insert code before rules references, token references, or
+ actions. By properly defining the macro BLOCK_PREAMBLE the
+ user can generate code which is specific to the start of blocks.
+
+ The antlr option -preamble_first is similar, but inserts the
+ code BLOCK_PREAMBLE_FIRST(PreambleFirst_123) where the symbol
+ PreambleFirst_123 is equivalent to the first set defined by
+ the #FirstSetSymbol described in Item #248.
+
+ I have not investigated how these options interact with guess
+ mode (syntactic predicates).
+
+#252. (MR21) Check for null pointer in trace routine
+
+ When some trace options are used when the parser is generated
+ without the trace enabled, the current rule name may be a
+ NULL pointer. A guard was added to check for this in
+ restoreState.
+
+ Reported by Douglas E. Forester (dougf projtech.com).
+
+#251. (MR21) Changes to #define zzTRACE_RULES
+
+ The macro zzTRACE_RULES was being use to pass information to
+ AParser.h. If this preprocessor symbol was not properly
+ set the first time AParser.h was #included, the declaration
+ of zzTRACEdata would be omitted (it is used by the -gd option).
+ Subsequent #includes of AParser.h would be skipped because of
+ the #ifdef guard, so the declaration of zzTracePrevRuleName would
+ never be made. The result was that proper compilation was very
+ order dependent.
+
+ The declaration of zzTRACEdata was made unconditional and the
+ problem of removing unused declarations will be left to optimizers.
+
+ Diagnosed by Douglas E. Forester (dougf projtech.com).
+
+#250. (MR21) Option for EXPERIMENTAL change to error sets for blocks
+
+ The antlr option -mrblkerr turns on an experimental feature
+ which is supposed to provide more accurate syntax error messages
+ for k=1, ck=1 grammars. When used with k>1 or ck>1 grammars the
+ behavior should be no worse than the current behavior.
+
+ There is no problem with the matching of elements or the computation
+ of prediction expressions in pccts. The task is only one of listing
+ the most appropriate tokens in the error message. The error sets used
+ in pccts error messages are approximations of the exact error set when
+ optional elements in (...)* or (...)+ are involved. While entirely
+ correct, the error messages are sometimes not 100% accurate.
+
+ There is also a minor philosophical issue. For example, suppose the
+ grammar expects the token to be an optional A followed by Z, and it
+ is X. X, of course, is neither A nor Z, so an error message is appropriate.
+ Is it appropriate to say "Expected Z" ? It is correct, it is accurate,
+ but it is not complete.
+
+ When k>1 or ck>1 the problem of providing the exactly correct
+ list of tokens for the syntax error messages ends up becoming
+ equivalent to evaluating the prediction expression for the
+ alternatives twice. However, for k=1 ck=1 grammars the prediction
+ expression can be computed easily and evaluated cheaply, so I
+ decided to try implementing it to satisfy a particular application.
+ This application uses the error set in an interactive command language
+ to provide prompts which list the alternatives available at that
+ point in the parser. The user can then enter additional tokens to
+ complete the command line. To do this required more accurate error
+ sets then previously provided by pccts.
+
+ In some cases the default pccts behavior may lead to more robust error
+ recovery or clearer error messages then having the exact set of tokens.
+ This is because (a) features like -ge allow the use of symbolic names for
+ certain sets of tokens, so having extra tokens may simply obscure things
+ and (b) the error set is use to resynchronize the parser, so a good
+ choice is sometimes more important than having the exact set.
+
+ Consider the following example:
+
+ Note: All examples code has been abbreviated
+ to the absolute minimum in order to make the
+ examples concise.
+
+ star1 : (A)* Z;
+
+ The generated code resembles:
+
+ old new (with -mrblkerr)
+ --//----------- --------------------
+ for (;;) { for (;;) {
+ match(A); match(A);
+ } }
+ match(Z); if (! A and ! Z) then
+ FAIL(...{A,Z}...);
+ }
+ match(Z);
+
+
+ With input X
+ old message: Found X, expected Z
+ new message: Found X, expected A, Z
+
+ For the example:
+
+ star2 : (A|B)* Z;
+
+ old new (with -mrblkerr)
+ ------------- --------------------
+ for (;;) { for (;;) {
+ if (!A and !B) break; if (!A and !B) break;
+ if (...) { if (...) {
+ <same ...> <same ...>
+ } }
+ else { else {
+ FAIL(...{A,B,Z}...) FAIL(...{A,B}...);
+ } }
+ } }
+ match(B); if (! A and ! B and !Z) then
+ FAIL(...{A,B,Z}...);
+ }
+ match(B);
+
+ With input X
+ old message: Found X, expected Z
+ new message: Found X, expected A, B, Z
+ With input A X
+ old message: Found X, expected Z
+ new message: Found X, expected A, B, Z
+
+ This includes the choice of looping back to the
+ star block.
+
+ The code for plus blocks:
+
+ plus1 : (A)+ Z;
+
+ The generated code resembles:
+
+ old new (with -mrblkerr)
+ ------------- --------------------
+ do { do {
+ match(A); match(A);
+ } while (A) } while (A)
+ match(Z); if (! A and ! Z) then
+ FAIL(...{A,Z}...);
+ }
+ match(Z);
+
+ With input A X
+ old message: Found X, expected Z
+ new message: Found X, expected A, Z
+
+ This includes the choice of looping back to the
+ plus block.
+
+ For the example:
+
+ plus2 : (A|B)+ Z;
+
+ old new (with -mrblkerr)
+ ------------- --------------------
+ do { do {
+ if (A) { <same>
+ match(A); <same>
+ } else if (B) { <same>
+ match(B); <same>
+ } else { <same>
+ if (cnt > 1) break; <same>
+ FAIL(...{A,B,Z}...) FAIL(...{A,B}...);
+ } }
+ cnt++; <same>
+ } }
+
+ match(Z); if (! A and ! B and !Z) then
+ FAIL(...{A,B,Z}...);
+ }
+ match(B);
+
+ With input X
+ old message: Found X, expected A, B, Z
+ new message: Found X, expected A, B
+ With input A X
+ old message: Found X, expected Z
+ new message: Found X, expected A, B, Z
+
+ This includes the choice of looping back to the
+ star block.
+
+#249. (MR21) Changes for DEC/VMS systems
+
+ Jean-François Piéronne (jfp altavista.net) has updated some
+ VMS related command files and fixed some minor problems related
+ to building pccts under the DEC/VMS operating system. For DEC/VMS
+ users the most important differences are:
+
+ a. Revised makefile.vms
+ b. Revised genMMS for genrating VMS style makefiles.
+
+#248. (MR21) Generate symbol for first set of an alternative
+
+ pccts can generate a symbol which represents the tokens which may
+ appear at the start of a block:
+
+ rr : #FirstSetSymbol(rr_FirstSet) ( Foo | Bar ) ;
+
+ This will generate the symbol rr_FirstSet of type SetWordType with
+ elements Foo and Bar set. The bits can be tested using code similar
+ to the following:
+
+ if (set_el(Foo, &rr_FirstSet)) { ...
+
+ This can be combined with the C array zztokens[] or the C++ routine
+ tokenName() to get the print name of the token in the first set.
+
+ The size of the set is given by the newly added enum SET_SIZE, a
+ protected member of the generated parser's class. The number of
+ elements in the generated set will not be exactly equal to the
+ value of SET_SIZE because of synthetic tokens created by #tokclass,
+ #errclass, the -ge option, and meta-tokens such as epsilon, and
+ end-of-file.
+
+ The #FirstSetSymbol must appear immediately before a block
+ such as (...)+, (...)*, and {...}, and (...). It may not appear
+ immediately before a token, a rule reference, or action. However
+ a token or rule reference can be enclosed in a (...) in order to
+ make the use of #pragma FirstSetSymbol legal.
+
+ rr_bad : #FirstSetSymbol(rr_bad_FirstSet) Foo; // Illegal
+
+ rr_ok : #FirstSetSymbol(rr_ok_FirstSet) (Foo); // Legal
+
+ Do not confuse FirstSetSymbol sets with the sets used for testing
+ lookahead. The sets used for FirstSetSymbol have one element per bit,
+ so the number of bytes is approximately the largest token number
+ divided by 8. The sets used for testing lookahead store 8 lookahead
+ sets per byte, so the length of the array is approximately the largest
+ token number.
+
+ If there is demand, a similar routine for follow sets can be added.
+
+#247. (MR21) Misleading error message on syntax error for optional elements.
+
+ ===================================================
+ The behavior has been revised when parser exception
+ handling is used. See Item #290
+ ===================================================
+
+ Prior to MR21, tokens which were optional did not appear in syntax
+ error messages if the block which immediately followed detected a
+ syntax error.
+
+ Consider the following grammar which accepts Number, Word, and Other:
+
+ rr : {Number} Word;
+
+ For this rule the code resembles:
+
+ if (LA(1) == Number) {
+ match(Number);
+ consume();
+ }
+ match(Word);
+
+ Prior to MR21, the error message for input "$ a" would be:
+
+ line 1: syntax error at "$" missing Word
+
+ With MR21 the message will be:
+
+ line 1: syntax error at "$" expecting Word, Number.
+
+ The generate code resembles:
+
+ if ( (LA(1)==Number) ) {
+ zzmatch(Number);
+ consume();
+ }
+ else {
+ if ( (LA(1)==Word) ) {
+ /* nothing */
+ }
+ else {
+ FAIL(... message for both Number and Word ...);
+ }
+ }
+ match(Word);
+
+ The code generated for optional blocks in MR21 is slightly longer
+ than the previous versions, but it should give better error messages.
+
+ The code generated for:
+
+ { a | b | c }
+
+ should now be *identical* to:
+
+ ( a | b | c | )
+
+ which was not the case prior to MR21.
+
+ Reported by Sue Marvin (sue siara.com).
+
+#246. (Changed in MR21) Use of $(MAKE) for calls to make
+
+ Calls to make from the makefiles were replaced with $(MAKE)
+ because of problems when using gmake.
+
+ Reported with fix by Sunil K.Vallamkonda (sunil siara.com).
+
+#245. (Changed in MR21) Changes to genmk
+
+ The following command line options have been added to genmk:
+
+ -cfiles ...
+
+ To add a user's C or C++ files into makefile automatically.
+ The list of files must be enclosed in apostrophes. This
+ option may be specified multiple times.
+
+ -compiler ...
+
+ The name of the compiler to use for $(CCC) or $(CC). The
+ default in C++ mode is "CC". The default in C mode is "cc".
+
+ -pccts_path ...
+
+ The value for $(PCCTS), the pccts directory. The default
+ is /usr/local/pccts.
+
+ Contributed by Tomasz Babczynski (t.babczynski ict.pwr.wroc.pl).
+
+#244. (Changed in MR21) Rename variable "not" in antlr.g
+
+ When antlr.g is compiled with a C++ compiler, a variable named
+ "not" causes problems. Reported by Sinan Karasu
+ (sinan.karasu boeing.com).
+
+#243 (Changed in MR21) Replace recursion with iteration in zzfree_ast
+
+ Another refinement to zzfree_ast in ast.c to limit recursion.
+
+ NAKAJIMA Mutsuki (muc isr.co.jp).
+
+
+#242. (Changed in MR21) LineInfoFormatStr
+
+ Added an #ifndef/#endif around LineInfoFormatStr in pcctscfg.h.
+
+#241. (Changed in MR21) Changed macro PURIFY to a no-op
+
+ ***********************
+ *** NOT IMPLEMENTED ***
+ ***********************
+
+ The PURIFY macro was changed to a no-op because it was causing
+ problems when passing C++ objects.
+
+ The old definition:
+
+ #define PURIFY(r,s) memset((char *) &(r),'\\0',(s));
+
+ The new definition:
+
+ #define PURIFY(r,s) /* nothing */
+#endif
+
+#240. (Changed in MR21) sorcerer/h/sorcerer.h _MATCH and _MATCHRANGE
+
+ Added test for NULL token pointer.
+
+ Suggested by Peter Keller (keller ebi.ac.uk)
+
+#239. (Changed in MR21) C++ mode AParser::traceGuessFail
+
+ If tracing is turned on when the code has been generated
+ without trace code, a failed guess generates a trace report
+ even though there are no other trace reports. This
+ make the behavior consistent with other parts of the
+ trace system.
+
+ Reported by David Wigg (wiggjd sbu.ac.uk).
+
+#238. (Changed in MR21) Namespace version #include files
+
+ Changed reference from CStdio to cstdio (and other
+ #include file names) in the namespace version of pccts.
+ Should have known better.
+
+#237. (Changed in MR21) ParserBlackBox(FILE*)
+
+ In the past, ParserBlackBox would close the FILE in the dtor
+ even though it was not opened by ParserBlackBox. The problem
+ is that there were two constructors, one which accepted a file
+ name and did an fopen, the other which accepted a FILE and did
+ not do an fopen. There is now an extra member variable which
+ remembers whether ParserBlackBox did the open or not.
+
+ Suggested by Mike Percy (mpercy scires.com).
+
+#236. (Changed in MR21) tmake now reports down pointer problem
+
+ When ASTBase::tmake attempts to update the down pointer of
+ an AST it checks to see if the down pointer is NULL. If it
+ is not NULL it does not do the update and returns NULL.
+ An attempt to update the down pointer is almost always a
+ result of a user error. This can lead to difficult to find
+ problems during tree construction.
+
+ With this change, the routine calls a virtual function
+ reportOverwriteOfDownPointer() which calls panic to
+ report the problem. Users who want the old behavior can
+ redefined the virtual function in their AST class.
+
+ Suggested by Sinan Karasu (sinan.karasu boeing.com)
+
+#235. (Changed in MR21) Made ANTLRParser::resynch() virtual
+
+ Suggested by Jerry Evans (jerry swsl.co.uk).
+
+#234. (Changed in MR21) Implicit int for function return value
+
+ ATokenBuffer:bufferSize() did not specify a type for the
+ return value.
+
+ Reported by Hai Vo-Ba (hai fc.hp.com).
+
+#233. (Changed in MR20) Converted to MSVC 6.0
+
+ Due to external circumstances I have had to convert to MSVC 6.0
+ The MSVC 5.0 project files (.dsw and .dsp) have been retained as
+ xxx50.dsp and xxx50.dsw. The MSVC 6.0 files are named xxx60.dsp
+ and xxx60.dsw (where xxx is the related to the directory/project).
+
+#232. (Changed in MR20) Make setwd bit vectors protected in parser.h
+
+ The access for the setwd array in the parser header was not
+ specified. As a result, it would depend on the code which
+ preceded it. In MR20 it will always have access "protected".
+
+ Reported by Piotr Eljasiak (eljasiak zt.gdansk.tpsa.pl).
+
+#231. (Changed in MR20) Error in token buffer debug code.
+
+ When token buffer debugging is selected via the pre-processor
+ symbol DEBUG_TOKENBUFFER there is an erroneous check in
+ AParser.cpp:
+
+ #ifdef DEBUG_TOKENBUFFER
+ if (i >= inputTokens->bufferSize() ||
+ inputTokens->minTokens() < LLk ) /* MR20 Was "<=" */
+ ...
+ #endif
+
+ Reported by David Wigg (wiggjd sbu.ac.uk).
+
+#230. (Changed in MR20) Fixed problem with #define for -gd option
+
+ There was an error in setting zzTRACE_RULES for the -gd (trace) option.
+
+ Reported by Gary Funck (gary intrepid.com).
+
+#229. (Changed in MR20) Additional "const" for literals
+
+ "const" was added to the token name literal table.
+ "const" was added to some panic() and similar routine
+
+#228. (Changed in MR20) dlg crashes on "()"
+
+ The following token definition will cause DLG to crash.
+
+ #token "()"
+
+ When there is a syntax error in a regular expression
+ many of the dlg routines return a structure which has
+ null pointers. When this is accessed by callers it
+ generates the crash.
+
+ I have attempted to fix the more common cases.
+
+ Reported by Mengue Olivier (dolmen bigfoot.com).
+
+#227. (Changed in MR20) Array overwrite
+
+ Steveh Hand (sassth unx.sas.com) reported a problem which
+ was traced to a temporary array which was not properly
+ resized for deeply nested blocks. This has been fixed.
+
+#226. (Changed in MR20) -pedantic conformance
+
+ G. Hobbelt (i_a mbh.org) and THM made many, many minor
+ changes to create prototypes for all the functions and
+ bring antlr, dlg, and sorcerer into conformance with
+ the gcc -pedantic option.
+
+ This may require uses to add pccts/h/pcctscfg.h to some
+ files or makefiles in order to have __USE_PROTOS defined.
+
+#225 (Changed in MR20) AST stack adjustment in C mode
+
+ The fix in #214 for AST stack adjustment in C mode missed
+ some cases.
+
+ Reported with fix by Ger Hobbelt (i_a mbh.org).
+
+#224 (Changed in MR20) LL(1) and LL(2) with #pragma approx
+
+ This may take a record for the oldest, most trival, lexical
+ error in pccts. The regular expressions for LL(1) and LL(2)
+ lacked an escape for the left and right parenthesis.
+
+ Reported by Ger Hobbelt (i_a mbh.org).
+
+#223 (Changed in MR20) Addition of IBM_VISUAL_AGE directory
+
+ Build files for antlr, dlg, and sorcerer under IBM Visual Age
+ have been contributed by Anton Sergeev (ags mlc.ru). They have
+ been placed in the pccts/IBM_VISUAL_AGE directory.
+
+#222 (Changed in MR20) Replace __STDC__ with __USE_PROTOS
+
+ Most occurrences of __STDC__ replaced with __USE_PROTOS due to
+ complaints from several users.
+
+#221 (Changed in MR20) Added #include for DLexerBase.h to PBlackBox.
+
+ Added #include for DLexerBase.h to PBlackBox.
+
+#220 (Changed in MR19) strcat arguments reversed in #pred parse
+
+ The arguments to strcat are reversed when creating a print
+ name for a hash table entry for use with #pred feature.
+
+ Problem diagnosed and fix reported by Scott Harrington
+ (seh4 ix.netcom.com).
+
+#219. (Changed in MR19) C Mode routine zzfree_ast
+
+ Changes to reduce use of recursion for AST trees with only right
+ links or only left links in the C mode routine zzfree_ast.
+
+ Implemented by SAKAI Kiyotaka (ksakai isr.co.jp).
+
+#218. (Changed in MR19) Changes to support unsigned char in C mode
+
+ Changes to antlr.h and err.h to fix omissions in use of zzchar_t
+
+ Implemented by SAKAI Kiyotaka (ksakai isr.co.jp).
+
+#217. (Changed in MR19) Error message when dlg -i and -CC options selected
+
+ *** This change was rescinded by item #257 ***
+
+ The parsers generated by pccts in C++ mode are not able to support the
+ interactive lexer option (except, perhaps, when using the deferred fetch
+ parser option.(Item #216).
+
+ DLG now warns when both -i and -CC are selected.
+
+ This warning was suggested by David Venditti (07751870267-0001 t-online.de).
+
+#216. (Changed in MR19) Defer token fetch for C++ mode
+
+ Implemented by Volker H. Simonis (simonis informatik.uni-tuebingen.de)
+
+ Normally, pccts keeps the lookahead token buffer completely filled.
+ This requires max(k,ck) tokens of lookahead. For some applications
+ this can cause deadlock problems. For example, there may be cases
+ when the parser can't tell when the input has been completely consumed
+ until the parse is complete, but the parse can't be completed because
+ the input routines are waiting for additional tokens to fill the
+ lookahead buffer.
+
+ When the ANTLRParser class is built with the pre-processor option
+ ZZDEFER_FETCH defined, the fetch of new tokens by consume() is deferred
+ until LA(i) or LT(i) is called.
+
+ To test whether this option has been built into the ANTLRParser class
+ use "isDeferFetchEnabled()".
+
+ Using the -gd trace option with the default tracein() and traceout()
+ routines will defeat the effort to defer the fetch because the
+ trace routines print out information about the lookahead token at
+ the start of the rule.
+
+ Because the tracein and traceout routines are virtual it is
+ easy to redefine them in your parser:
+
+ class MyParser {
+ <<
+ virtual void tracein(ANTLRChar * ruleName)
+ { fprintf(stderr,"Entering: %s\n", ruleName); }
+ virtual void traceout(ANTLRChar * ruleName)
+ { fprintf(stderr,"Leaving: %s\n", ruleName); }
+ >>
+
+ The originals for those routines are pccts/h/AParser.cpp
+
+ This requires use of the dlg option -i (interactive lexer).
+
+ This is implemented only for C++ mode.
+
+ This is experimental. The interaction with guess mode (syntactic
+ predicates)is not known.
+
+#215. (Changed in MR19) Addition of reset() to DLGLexerBase
+
+ There was no obvious way to reset the lexer for reuse. The
+ reset() method now does this.
+
+ Suggested by David Venditti (07751870267-0001 t-online.de).
+
+#214. (Changed in MR19) C mode: Adjust AST stack pointer at exit
+
+ In C mode the AST stack pointer needs to be reset if there will
+ be multiple calls to the ANTLRx macros.
+
+ Reported with fix by Paul D. Smith (psmith baynetworks.com).
+
+#213. (Changed in MR18) Fatal error with -mrhoistk (k>1 hoisting)
+
+ When rearranging code I forgot to un-comment a critical line of
+ code that handles hoisting of predicates with k>1 lookahead. This
+ is now fixed.
+
+ Reported by Reinier van den Born (reinier vnet.ibm.com).
+
+#212. (Changed in MR17) Mac related changes by Kenji Tanaka
+
+ Kenji Tanaka (kentar osa.att.ne.jp) has made a number of changes for
+ Macintosh users.
+
+ a. The following Macintosh MPW files aid in installing pccts on Mac:
+
+ pccts/MPW_Read_Me
+
+ pccts/install68K.mpw
+ pccts/installPPC.mpw
+
+ pccts/antlr/antlr.r
+ pccts/antlr/antlr68K.make
+ pccts/antlr/antlrPPC.make
+
+ pccts/dlg/dlg.r
+ pccts/dlg/dlg68K.make
+ pccts/dlg/dlgPPC.make
+
+ pccts/sorcerer/sor.r
+ pccts/sorcerer/sor68K.make
+ pccts/sorcerer/sorPPC.make
+
+ They completely replace the previous Mac installation files.
+
+ b. The most significant is a change in the MAC_FILE_CREATOR symbol
+ in pcctscfg.h:
+
+ old: #define MAC_FILE_CREATOR 'MMCC' /* Metrowerks C/C++ Text files */
+ new: #define MAC_FILE_CREATOR 'CWIE' /* Metrowerks C/C++ Text files */
+
+ c. Added calls to special_fopen_actions() where necessary.
+
+#211. (Changed in MR16a) C++ style comment in dlg
+
+ This has been fixed.
+
+#210. (Changed in MR16a) Sor accepts \r\n, \r, or \n for end-of-line
+
+ A user requested that Sorcerer be changed to accept other forms
+ of end-of-line.
+
+#209. (Changed in MR16) Name of files changed.
+
+ Old: CHANGES_FROM_1.33
+ New: CHANGES_FROM_133.txt
+
+ Old: KNOWN_PROBLEMS
+ New: KNOWN_PROBLEMS.txt
+
+#208. (Changed in MR16) Change in use of pccts #include files
+
+ There were problems with MS DevStudio when mixing Sorcerer and
+ PCCTS in the same source file. The problem is caused by the
+ redefinition of setjmp in the MS header file setjmp.h. In
+ setjmp.h the pre-processor symbol setjmp was redefined to be
+ _setjmp. A later effort to execute #include <setjmp.h> resulted
+ in an effort to #include <_setjmp.h>. I'm not sure whether this
+ is a bug or a feature. In any case, I decided to fix it by
+ avoiding the use of pre-processor symbols in #include statements
+ altogether. This has the added benefit of making pre-compiled
+ headers work again.
+
+ I've replaced statements:
+
+ old: #include PCCTS_SETJMP_H
+ new: #include "pccts_setjmp.h"
+
+ Where pccts_setjmp.h contains:
+
+ #ifndef __PCCTS_SETJMP_H__
+ #define __PCCTS_SETJMP_H__
+
+ #ifdef PCCTS_USE_NAMESPACE_STD
+ #include <Csetjmp>
+ #else
+ #include <setjmp.h>
+ #endif
+
+ #endif
+
+ A similar change has been made for other standard header files
+ required by pccts and sorcerer: stdlib.h, stdarg.h, stdio.h, etc.
+
+ Reported by Jeff Vincent (JVincent novell.com) and Dale Davis
+ (DalDavis spectrace.com).
+
+#207. (Changed in MR16) dlg reports an invalid range for: [\0x00-\0xff]
+
+ -----------------------------------------------------------------
+ Note from MR23: This fix does not work. I am investigating why.
+ -----------------------------------------------------------------
+
+ dlg will report that this is an invalid range.
+
+ Diagnosed by Piotr Eljasiak (eljasiak no-spam.zt.gdansk.tpsa.pl):
+
+ I think this problem is not specific to unsigned chars
+ because dlg reports no error for the range [\0x00-\0xfe].
+
+ I've found that information on range is kept in field
+ letter (unsigned char) of Attrib struct. Unfortunately
+ the letter value internally is for some reasons increased
+ by 1, so \0xff is represented here as 0.
+
+ That's why dlg complains about the range [\0x00-\0xff] in
+ dlg_p.g:
+
+ if ($$.letter > $2.letter) {
+ error("invalid range ", zzline);
+ }
+
+ The fix is:
+
+ if ($$.letter > $2.letter && 255 != $$2.letter) {
+ error("invalid range ", zzline);
+ }
+
+#206. (Changed in MR16) Free zzFAILtext in ANTLRParser destructor
+
+ The ANTLRParser destructor now frees zzFAILtext.
+
+ Problem and fix reported by Manfred Kogler (km cast.uni-linz.ac.at).
+
+#205. (Changed in MR16) DLGStringReset argument now const
+
+ Changed: void DLGStringReset(DLGChar *s) {...}
+ To: void DLGStringReset(const DLGChar *s) {...}
+
+ Suggested by Dale Davis (daldavis spectrace.com)
+
+#204. (Changed in MR15a) Change __WATCOM__ to __WATCOMC__ in pcctscfg.h
+
+ Reported by Oleg Dashevskii (olegdash my-dejanews.com).
+
+#203. (Changed in MR15) Addition of sorcerer to distribution kit
+
+ I have finally caved in to popular demand. The pccts 1.33mr15
+ kit will include sorcerer. The separate sorcerer kit will be
+ discontinued.
+
+#202. (Changed) in MR15) Organization of MS Dev Studio Projects in Kit
+
+ Previously there was one workspace that contained projects for
+ all three parts of pccts: antlr, dlg, and sorcerer. Now each
+ part (and directory) has its own workspace/project and there
+ is an additional workspace/project to build a library from the
+ .cpp files in the pccts/h directory.
+
+ The library build will create pccts_debug.lib or pccts_release.lib
+ according to the configuration selected.
+
+ If you don't want to build pccts 1.33MR15 you can download a
+ ready-to-run kit for win32 from http://www.polhode.com/win32.zip.
+ The ready-to-run for win32 includes executables, a pre-built static
+ library for the .cpp files in the pccts/h directory, and a sample
+ application
+
+ You will need to define the environment variable PCCTS to point to
+ the root of the pccts directory hierarchy.
+
+#201. (Changed in MR15) Several fixes by K.J. Cummings (cummings peritus.com)
+
+ Generation of SETJMP rather than SETJMP_H in gen.c.
+
+ (Sor B19) Declaration of ref_vars_inits for ref_var_inits in
+ pccts/sorcerer/sorcerer.h.
+
+#200. (Changed in MR15) Remove operator=() in AToken.h
+
+ User reported that WatCom couldn't handle use of
+ explicit operator =(). Replace with equivalent
+ using cast operator.
+
+#199. (Changed in MR15) Don't allow use of empty #tokclass
+
+ Change antlr.g to disallow empty #tokclass sets.
+
+ Reported by Manfred Kogler (km cast.uni-linz.ac.at).
+
+#198. Revised ANSI C grammar due to efforts by Manuel Kessler
+
+ Manuel Kessler (mlkessler cip.physik.uni-wuerzburg.de)
+
+ Allow trailing ... in function parameter lists.
+ Add bit fields.
+ Allow old-style function declarations.
+ Support cv-qualified pointers.
+ Better checking of combinations of type specifiers.
+ Release of memory for local symbols on scope exit.
+ Allow input file name on command line as well as by redirection.
+
+ and other miscellaneous tweaks.
+
+ This is not part of the pccts distribution kit. It must be
+ downloaded separately from:
+
+ http://www.polhode.com/ansi_mr15.zip
+
+#197. (Changed in MR14) Resetting the lookahead buffer of the parser
+
+ Explanation and fix by Sinan Karasu (sinan.karasu boeing.com)
+
+ Consider the code used to prime the lookahead buffer LA(i)
+ of the parser when init() is called:
+
+ void
+ ANTLRParser::
+ prime_lookahead()
+ {
+ int i;
+ for(i=1;i<=LLk; i++) consume();
+ dirty=0;
+ //lap = 0; // MR14 - Sinan Karasu (sinan.karusu boeing.com)
+ //labase = 0; // MR14
+ labase=lap; // MR14
+ }
+
+ When the parser is instantiated, lap=0,labase=0 is set.
+
+ The "for" loop runs LLk times. In consume(), lap = lap +1 (mod LLk) is
+ computed. Therefore, lap(before the loop) == lap (after the loop).
+
+ Now the only problem comes in when one does an init() of the parser
+ after an Eof has been seen. At that time, lap could be non zero.
+ Assume it was lap==1. Now we do a prime_lookahead(). If LLk is 2,
+ then
+
+ consume()
+ {
+ NLA = inputTokens->getToken()->getType();
+ dirty--;
+ lap = (lap+1)&(LLk-1);
+ }
+
+ or expanding NLA,
+
+ token_type[lap&(LLk-1)]) = inputTokens->getToken()->getType();
+ dirty--;
+ lap = (lap+1)&(LLk-1);
+
+ so now we prime locations 1 and 2. In prime_lookahead it used to set
+ lap=0 and labase=0. Now, the next token will be read from location 0,
+ NOT 1 as it should have been.
+
+ This was never caught before, because if a parser is just instantiated,
+ then lap and labase are 0, the offending assignment lines are
+ basically no-ops, since the for loop wraps around back to 0.
+
+#196. (Changed in MR14) Problems with "(alpha)? beta" guess
+
+ Consider the following syntactic predicate in a grammar
+ with 2 tokens of lookahead (k=2 or ck=2):
+
+ rule : ( alpha )? beta ;
+ alpha : S t ;
+ t : T U
+ | T
+ ;
+ beta : S t Z ;
+
+ When antlr computes the prediction expression with one token
+ of lookahead for alts 1 and 2 of rule t it finds an ambiguity.
+
+ Because the grammar has a lookahead of 2 it tries to compute
+ two tokens of lookahead for alts 1 and 2 of t. Alt 1 clearly
+ has a lookahead of (T U). Alt 2 is one token long so antlr
+ tries to compute the follow set of alt 2, which means finding
+ the things which can follow rule t in the context of (alpha)?.
+ This cannot be computed, because alpha is only part of a rule,
+ and antlr can't tell what part of beta is matched by alpha and
+ what part remains to be matched. Thus it impossible for antlr
+ to properly determine the follow set of rule t.
+
+ Prior to 1.33MR14, the follow of (alpha)? was computed as
+ FIRST(beta) as a result of the internal representation of
+ guess blocks.
+
+ With MR14 the follow set will be the empty set for that context.
+
+ Normally, one expects a rule appearing in a guess block to also
+ appear elsewhere. When the follow context for this other use
+ is "ored" with the empty set, the context from the other use
+ results, and a reasonable follow context results. However if
+ there is *no* other use of the rule, or it is used in a different
+ manner then the follow context will be inaccurate - it was
+ inaccurate even before MR14, but it will be inaccurate in a
+ different way.
+
+ For the example given earlier, a reasonable way to rewrite the
+ grammar:
+
+ rule : ( alpha )? beta
+ alpha : S t ;
+ t : T U
+ | T
+ ;
+ beta : alpha Z ;
+
+ If there are no other uses of the rule appearing in the guess
+ block it will generate a test for EOF - a workaround for
+ representing a null set in the lookahead tests.
+
+ If you encounter such a problem you can use the -alpha option
+ to get additional information:
+
+ line 2: error: not possible to compute follow set for alpha
+ in an "(alpha)? beta" block.
+
+ With the antlr -alpha command line option the following information
+ is inserted into the generated file:
+
+ #if 0
+
+ Trace of references leading to attempt to compute the follow set of
+ alpha in an "(alpha)? beta" block. It is not possible for antlr to
+ compute this follow set because it is not known what part of beta has
+ already been matched by alpha and what part remains to be matched.
+
+ Rules which make use of the incorrect follow set will also be incorrect
+
+ 1 #token T alpha/2 line 7 brief.g
+ 2 end alpha alpha/3 line 8 brief.g
+ 2 end (...)? block at start/1 line 2 brief.g
+
+ #endif
+
+ At the moment, with the -alpha option selected the program marks
+ any rules which appear in the trace back chain (above) as rules with
+ possible problems computing follow set.
+
+ Reported by Greg Knapen (gregory.knapen bell.ca).
+
+#195. (Changed in MR14) #line directive not at column 1
+
+ Under certain circumstances a predicate test could generate
+ a #line directive which was not at column 1.
+
+ Reported with fix by David Kågedal (davidk lysator.liu.se)
+ (http://www.lysator.liu.se/~davidk/).
+
+#194. (Changed in MR14) (C Mode only) Demand lookahead with #tokclass
+
+ In C mode with the demand lookahead option there is a bug in the
+ code which handles matches for #tokclass (zzsetmatch and
+ zzsetmatch_wsig).
+
+ The bug causes the lookahead pointer to get out of synchronization
+ with the current token pointer.
+
+ The problem was reported with a fix by Ger Hobbelt (hobbelt axa.nl).
+
+#193. (Changed in MR14) Use of PCCTS_USE_NAMESPACE_STD
+
+ The pcctscfg.h now contains the following definitions:
+
+ #ifdef PCCTS_USE_NAMESPACE_STD
+ #define PCCTS_STDIO_H <Cstdio>
+ #define PCCTS_STDLIB_H <Cstdlib>
+ #define PCCTS_STDARG_H <Cstdarg>
+ #define PCCTS_SETJMP_H <Csetjmp>
+ #define PCCTS_STRING_H <Cstring>
+ #define PCCTS_ASSERT_H <Cassert>
+ #define PCCTS_ISTREAM_H <istream>
+ #define PCCTS_IOSTREAM_H <iostream>
+ #define PCCTS_NAMESPACE_STD namespace std {}; using namespace std;
+ #else
+ #define PCCTS_STDIO_H <stdio.h>
+ #define PCCTS_STDLIB_H <stdlib.h>
+ #define PCCTS_STDARG_H <stdarg.h>
+ #define PCCTS_SETJMP_H <setjmp.h>
+ #define PCCTS_STRING_H <string.h>
+ #define PCCTS_ASSERT_H <assert.h>
+ #define PCCTS_ISTREAM_H <istream.h>
+ #define PCCTS_IOSTREAM_H <iostream.h>
+ #define PCCTS_NAMESPACE_STD
+ #endif
+
+ The runtime support in pccts/h uses these pre-processor symbols
+ consistently.
+
+ Also, antlr and dlg have been changed to generate code which uses
+ these pre-processor symbols rather than having the names of the
+ #include files hard-coded in the generated code.
+
+ This required the addition of "#include pcctscfg.h" to a number of
+ files in pccts/h.
+
+ It appears that this sometimes causes problems for MSVC 5 in
+ combination with the "automatic" option for pre-compiled headers.
+ In such cases disable the "automatic" pre-compiled headers option.
+
+ Suggested by Hubert Holin (Hubert.Holin Bigfoot.com).
+
+#192. (Changed in MR14) Change setText() to accept "const ANTLRChar *"
+
+ Changed ANTLRToken::setText(ANTLRChar *) to setText(const ANTLRChar *).
+ This allows literal strings to be used to initialize tokens. Since
+ the usual token implementation (ANTLRCommonToken) makes a copy of the
+ input string, this was an unnecessary limitation.
+
+ Suggested by Bob McWhirter (bob netwrench.com).
+
+#191. (Changed in MR14) HP/UX aCC compiler compatibility problem
+
+ Needed to explicitly declare zzINF_DEF_TOKEN_BUFFER_SIZE and
+ zzINF_BUFFER_TOKEN_CHUNK_SIZE as ints in pccts/h/AParser.cpp.
+
+ Reported by David Cook (dcook bmc.com).
+
+#190. (Changed in MR14) IBM OS/2 CSet compiler compatibility problem
+
+ Name conflict with "_cs" in pccts/h/ATokenBuffer.cpp
+
+ Reported by David Cook (dcook bmc.com).
+
+#189. (Changed in MR14) -gxt switch in C mode
+
+ The -gxt switch in C mode didn't work because of incorrect
+ initialization.
+
+ Reported by Sinan Karasu (sinan boeing.com).
+
+#188. (Changed in MR14) Added pccts/h/DLG_stream_input.h
+
+ This is a DLG stream class based on C++ istreams.
+
+ Contributed by Hubert Holin (Hubert.Holin Bigfoot.com).
+
+#187. (Changed in MR14) Rename config.h to pcctscfg.h
+
+ The PCCTS configuration file has been renamed from config.h to
+ pcctscfg.h. The problem with the original name is that it led
+ to name collisions when pccts parsers were combined with other
+ software.
+
+ All of the runtime support routines in pccts/h/* have been
+ changed to use the new name. Existing software can continue
+ to use pccts/h/config.h. The contents of pccts/h/config.h is
+ now just "#include "pcctscfg.h".
+
+ I don't have a record of the user who suggested this.
+
+#186. (Changed in MR14) Pre-processor symbol DllExportPCCTS class modifier
+
+ Classes in the C++ runtime support routines are now declared:
+
+ class DllExportPCCTS className ....
+
+ By default, the pre-processor symbol is defined as the empty
+ string. This if for use by MSVC++ users to create DLL classes.
+
+ Suggested by Manfred Kogler (km cast.uni-linz.ac.at).
+
+#185. (Changed in MR14) Option to not use PCCTS_AST base class for ASTBase
+
+ Normally, the ASTBase class is derived from PCCTS_AST which contains
+ functions useful to Sorcerer. If these are not necessary then the
+ user can define the pre-processor symbol "PCCTS_NOT_USING_SOR" which
+ will cause the ASTBase class to replace references to PCCTS_AST with
+ references to ASTBase where necessary.
+
+ The class ASTDoublyLinkedBase will contain a pure virtual function
+ shallowCopy() that was formerly defined in class PCCTS_AST.
+
+ Suggested by Bob McWhirter (bob netwrench.com).
+
+#184. (Changed in MR14) Grammars with no tokens generate invalid tokens.h
+
+ Reported by Hubert Holin (Hubert.Holin bigfoot.com).
+
+#183. (Changed in MR14) -f to specify file with names of grammar files
+
+ In DEC/VMS it is difficult to specify very long command lines.
+ The -f option allows one to place the names of the grammar files
+ in a data file in order to bypass limitations of the DEC/VMS
+ command language interpreter.
+
+ Addition supplied by Bernard Giroud (b_giroud decus.ch).
+
+#182. (Changed in MR14) Output directory option for DEC/VMS
+
+ Fix some problems with the -o option under DEC/VMS.
+
+ Fix supplied by Bernard Giroud (b_giroud decus.ch).
+
+#181. (Changed in MR14) Allow chars > 127 in DLGStringInput::nextChar()
+
+ Changed DLGStringInput to cast the character using (unsigned char)
+ so that languages with character codes greater than 127 work
+ without changes.
+
+ Suggested by Manfred Kogler (km cast.uni-linz.ac.at).
+
+#180. (Added in MR14) ANTLRParser::getEofToken()
+
+ Added "ANTLRToken ANTLRParser::getEofToken() const" to match the
+ setEofToken routine.
+
+ Requested by Manfred Kogler (km cast.uni-linz.ac.at).
+
+#179. (Fixed in MR14) Memory leak for BufFileInput subclass of DLGInputStream
+
+ The BufFileInput class described in Item #142 neglected to release
+ the allocated buffer when an instance was destroyed.
+
+ Reported by Manfred Kogler (km cast.uni-linz.ac.at).
+
+#178. (Fixed in MR14) Bug in "(alpha)? beta" guess blocks first sets
+
+ In 1.33 vanilla, and all maintenance releases prior to MR14
+ there is a bug in the handling of guess blocks which use the
+ "long" form:
+
+ (alpha)? beta
+
+ inside a (...)*, (...)+, or {...} block.
+
+ This problem does *not* apply to the case where beta is omitted
+ or when the syntactic predicate is on the leading edge of an
+ alternative.
+
+ The problem is that both alpha and beta are stored in the
+ syntax diagram, and that some analysis routines would fail
+ to skip the alpha portion when it was not on the leading edge.
+ Consider the following grammar with -ck 2:
+
+ r : ( (A)? B )* C D
+
+ | A B /* forces -ck 2 computation for old antlr */
+ /* reports ambig for alts 1 & 2 */
+
+ | B C /* forces -ck 2 computation for new antlr */
+ /* reports ambig for alts 1 & 3 */
+ ;
+
+ The prediction expression for the first alternative should be
+ LA(1)={B C} LA(2)={B C D}, but previous versions of antlr
+ would compute the prediction expression as LA(1)={A C} LA(2)={B D}
+
+ Reported by Arpad Beszedes (beszedes inf.u-szeged.hu) who provided
+ a very clear example of the problem and identified the probable cause.
+
+#177. (Changed in MR14) #tokdefs and #token with regular expression
+
+ In MR13 the change described by Item #162 caused an existing
+ feature of antlr to fail. Prior to the change it was possible
+ to give regular expression definitions and actions to tokens
+ which were defined via the #tokdefs directive.
+
+ This now works again.
+
+ Reported by Manfred Kogler (km cast.uni-linz.ac.at).
+
+#176. (Changed in MR14) Support for #line in antlr source code
+
+ Note: this was implemented by Arpad Beszedes (beszedes inf.u-szeged.hu).
+
+ In 1.33MR14 it is possible for a pre-processor to generate #line
+ directives in the antlr source and have those line numbers and file
+ names used in antlr error messages and in the #line directives
+ generated by antlr.
+
+ The #line directive may appear in the following forms:
+
+ #line ll "sss" xx xx ...
+
+ where ll represents a line number, "sss" represents the name of a file
+ enclosed in quotation marks, and xxx are arbitrary integers.
+
+ The following form (without "line") is not supported at the moment:
+
+ # ll "sss" xx xx ...
+
+ The result:
+
+ zzline
+
+ is replaced with ll from the # or #line directive
+
+ FileStr[CurFile]
+
+ is updated with the contents of the string (if any)
+ following the line number
+
+ Note
+ ----
+ The file-name string following the line number can be a complete
+ name with a directory-path. Antlr generates the output files from
+ the input file name (by replacing the extension from the file-name
+ with .c or .cpp).
+
+ If the input file (or the file-name from the line-info) contains
+ a path:
+
+ "../grammar.g"
+
+ the generated source code will be placed in "../grammar.cpp" (i.e.
+ in the parent directory). This is inconvenient in some cases
+ (even the -o switch can not be used) so the path information is
+ removed from the #line directive. Thus, if the line-info was
+
+ #line 2 "../grammar.g"
+
+ then the current file-name will become "grammar.g"
+
+ In this way, the generated source code according to the grammar file
+ will always be in the current directory, except when the -o switch
+ is used.
+
+#175. (Changed in MR14) Bug when guess block appears at start of (...)*
+
+ In 1.33 vanilla and all maintenance releases prior to 1.33MR14
+ there is a bug when a guess block appears at the start of a (...)+.
+ Consider the following k=1 (ck=1) grammar:
+
+ rule :
+ ( (STAR)? ZIP )* ID ;
+
+ Prior to 1.33MR14, the generated code resembled:
+
+ ...
+ zzGUESS_BLOCK
+ while ( 1 ) {
+ if ( ! LA(1)==STAR) break;
+ zzGUESS
+ if ( !zzrv ) {
+ zzmatch(STAR);
+ zzCONSUME;
+ zzGUESS_DONE
+ zzmatch(ZIP);
+ zzCONSUME;
+ ...
+
+ Note that the routine uses STAR for the prediction expression
+ rather than ZIP. With 1.33MR14 the generated code resembles:
+
+ ...
+ while ( 1 ) {
+ if ( ! LA(1)==ZIP) break;
+ ...
+
+ This problem existed only with (...)* blocks and was caused
+ by the slightly more complicated graph which represents (...)*
+ blocks. This caused the analysis routine to compute the first
+ set for the alpha part of the "(alpha)? beta" rather than the
+ beta part.
+
+ Both (...)+ and {...} blocks handled the guess block correctly.
+
+ Reported by Arpad Beszedes (beszedes inf.u-szeged.hu) who provided
+ a very clear example of the problem and identified the probable cause.
+
+#174. (Changed in MR14) Bug when action precedes syntactic predicate
+
+ In 1.33 vanilla, and all maintenance releases prior to MR14,
+ there was a bug when a syntactic predicate was immediately
+ preceded by an action. Consider the following -ck 2 grammar:
+
+ rule :
+ <<int i;>>
+ (alpha)? beta C
+ | A B
+ ;
+
+ alpha : A ;
+ beta : A B;
+
+ Prior to MR14, the code generated for the first alternative
+ resembled:
+
+ ...
+ zzGUESS
+ if ( !zzrv && LA(1)==A && LA(2)==A) {
+ alpha();
+ zzGUESS_DONE
+ beta();
+ zzmatch(C);
+ zzCONSUME;
+ } else {
+ ...
+
+ The prediction expression (i.e. LA(1)==A && LA(2)==A) is clearly
+ wrong because LA(2) should be matched to B (first[2] of beta is {B}).
+
+ With 1.33MR14 the prediction expression is:
+
+ ...
+ if ( !zzrv && LA(1)==A && LA(2)==B) {
+ alpha();
+ zzGUESS_DONE
+ beta();
+ zzmatch(C);
+ zzCONSUME;
+ } else {
+ ...
+
+ This will only affect users in which alpha is shorter than
+ than max(k,ck) and there is an action immediately preceding
+ the syntactic predicate.
+
+ This problem was reported by reported by Arpad Beszedes
+ (beszedes inf.u-szeged.hu) who provided a very clear example
+ of the problem and identified the presence of the init-action
+ as the likely culprit.
+
+#173. (Changed in MR13a) -glms for Microsoft style filenames with -gl
+
+ With the -gl option antlr generates #line directives using the
+ exact name of the input files specified on the command line.
+ An oddity of the Microsoft C and C++ compilers is that they
+ don't accept file names in #line directives containing "\"
+ even though these are names from the native file system.
+
+ With -glms option, the "\" in file names appearing in #line
+ directives is replaced with a "/" in order to conform to
+ Microsoft compiler requirements.
+
+ Reported by Erwin Achermann (erwin.achermann switzerland.org).
+
+#172. (Changed in MR13) \r\n in antlr source counted as one line
+
+ Some MS software uses \r\n to indicate a new line. Antlr
+ now recognizes this in counting lines.
+
+ Reported by Edward L. Hepler (elh ece.vill.edu).
+
+#171. (Changed in MR13) #tokclass L..U now allowed
+
+ The following is now allowed:
+
+ #tokclass ABC { A..B C }
+
+ Reported by Dave Watola (dwatola amtsun.jpl.nasa.gov)
+
+#170. (Changed in MR13) Suppression for predicates with lookahead depth >1
+
+ In MR12 the capability for suppression of predicates with lookahead
+ depth=1 was introduced. With MR13 this had been extended to
+ predicates with lookahead depth > 1 and released for use by users
+ on an experimental basis.
+
+ Consider the following grammar with -ck 2 and the predicate in rule
+ "a" with depth 2:
+
+ r1 : (ab)* "@"
+ ;
+
+ ab : a
+ | b
+ ;
+
+ a : (A B)? => <<p(LATEXT(2))>>? A B C
+ ;
+
+ b : A B C
+ ;
+
+ Normally, the predicate would be hoisted into rule r1 in order to
+ determine whether to call rule "ab". However it should *not* be
+ hoisted because, even if p is false, there is a valid alternative
+ in rule b. With "-mrhoistk on" the predicate will be suppressed.
+
+ If "-info p" command line option is present the following information
+ will appear in the generated code:
+
+ while ( (LA(1)==A)
+ #if 0
+
+ Part (or all) of predicate with depth > 1 suppressed by alternative
+ without predicate
+
+ pred << p(LATEXT(2))>>?
+ depth=k=2 ("=>" guard) rule a line 8 t1.g
+ tree context:
+ (root = A
+ B
+ )
+
+ The token sequence which is suppressed: ( A B )
+ The sequence of references which generate that sequence of tokens:
+
+ 1 to ab r1/1 line 1 t1.g
+ 2 ab ab/1 line 4 t1.g
+ 3 to b ab/2 line 5 t1.g
+ 4 b b/1 line 11 t1.g
+ 5 #token A b/1 line 11 t1.g
+ 6 #token B b/1 line 11 t1.g
+
+ #endif
+
+ A slightly more complicated example:
+
+ r1 : (ab)* "@"
+ ;
+
+ ab : a
+ | b
+ ;
+
+ a : (A B)? => <<p(LATEXT(2))>>? (A B | D E)
+ ;
+
+ b : <<q(LATEXT(2))>>? D E
+ ;
+
+
+ In this case, the sequence (D E) in rule "a" which lies behind
+ the guard is used to suppress the predicate with context (D E)
+ in rule b.
+
+ while ( (LA(1)==A || LA(1)==D)
+ #if 0
+
+ Part (or all) of predicate with depth > 1 suppressed by alternative
+ without predicate
+
+ pred << q(LATEXT(2))>>?
+ depth=k=2 rule b line 11 t2.g
+ tree context:
+ (root = D
+ E
+ )
+
+ The token sequence which is suppressed: ( D E )
+ The sequence of references which generate that sequence of tokens:
+
+ 1 to ab r1/1 line 1 t2.g
+ 2 ab ab/1 line 4 t2.g
+ 3 to a ab/1 line 4 t2.g
+ 4 a a/1 line 8 t2.g
+ 5 #token D a/1 line 8 t2.g
+ 6 #token E a/1 line 8 t2.g
+
+ #endif
+ &&
+ #if 0
+
+ pred << p(LATEXT(2))>>?
+ depth=k=2 ("=>" guard) rule a line 8 t2.g
+ tree context:
+ (root = A
+ B
+ )
+
+ #endif
+
+ (! ( LA(1)==A && LA(2)==B ) || p(LATEXT(2)) ) {
+ ab();
+ ...
+
+#169. (Changed in MR13) Predicate test optimization for depth=1 predicates
+
+ When the MR12 generated a test of a predicate which had depth 1
+ it would use the depth >1 routines, resulting in correct but
+ inefficient behavior. In MR13, a bit test is used.
+
+#168. (Changed in MR13) Token expressions in context guards
+
+ The token expressions appearing in context guards such as:
+
+ (A B)? => <<test(LT(1))>>? someRule
+
+ are computed during an early phase of antlr processing. As
+ a result, prior to MR13, complex expressions such as:
+
+ ~B
+ L..U
+ ~L..U
+ TokClassName
+ ~TokClassName
+
+ were not computed properly. This resulted in incorrect
+ context being computed for such expressions.
+
+ In MR13 these context guards are verified for proper semantics
+ in the initial phase and then re-evaluated after complex token
+ expressions have been computed in order to produce the correct
+ behavior.
+
+ Reported by Arpad Beszedes (beszedes inf.u-szeged.hu).
+
+#167. (Changed in MR13) ~L..U
+
+ Prior to MR13, the complement of a token range was
+ not properly computed.
+
+#166. (Changed in MR13) token expression L..U
+
+ The token U was represented as an unsigned char, restricting
+ the use of L..U to cases where U was assigned a token number
+ less than 256. This is corrected in MR13.
+
+#165. (Changed in MR13) option -newAST
+
+ To create ASTs from an ANTLRTokenPtr antlr usually calls
+ "new AST(ANTLRTokenPtr)". This option generates a call
+ to "newAST(ANTLRTokenPtr)" instead. This allows a user
+ to define a parser member function to create an AST object.
+
+ Similar changes for ASTBase::tmake and ASTBase::link were not
+ thought necessary since they do not create AST objects, only
+ use existing ones.
+
+#164. (Changed in MR13) Unused variable _astp
+
+ For many compilations, we have lived with warnings about
+ the unused variable _astp. It turns out that this variable
+ can *never* be used because the code which references it was
+ commented out.
+
+ This investigation was sparked by a note from Erwin Achermann
+ (erwin.achermann switzerland.org).
+
+#163. (Changed in MR13) Incorrect makefiles for testcpp examples
+
+ All the examples in pccts/testcpp/* had incorrect definitions
+ in the makefiles for the symbol "CCC". Instead of CCC=CC they
+ had CC=$(CCC).
+
+ There was an additional problem in testcpp/1/test.g due to the
+ change in ANTLRToken::getText() to a const member function
+ (Item #137).
+
+ Reported by Maurice Mass (maas cuci.nl).
+
+#162. (Changed in MR13) Combining #token with #tokdefs
+
+ When it became possible to change the print-name of a
+ #token (Item #148) it became useful to give a #token
+ statement whose only purpose was to giving a print name
+ to the #token. Prior to this change this could not be
+ combined with the #tokdefs feature.
+
+#161. (Changed in MR13) Switch -gxt inhibits generation of tokens.h
+
+#160. (Changed in MR13) Omissions in list of names for remap.h
+
+ When a user selects the -gp option antlr creates a list
+ of macros in remap.h to rename some of the standard
+ antlr routines from zzXXX to userprefixXXX.
+
+ There were number of omissions from the remap.h name
+ list related to the new trace facility. This was reported,
+ along with a fix, by Bernie Solomon (bernard ug.eds.com).
+
+#159. (Changed in MR13) Violations of classic C rules
+
+ There were a number of violations of classic C style in
+ the distribution kit. This was reported, along with fixes,
+ by Bernie Solomon (bernard ug.eds.com).
+
+#158. (Changed in MR13) #header causes problem for pre-processors
+
+ A user who runs the C pre-processor on antlr source suggested
+ that another syntax be allowed. With MR13 such directives
+ such as #header, #pragma, etc. may be written as "\#header",
+ "\#pragma", etc. For escaping pre-processor directives inside
+ a #header use something like the following:
+
+ \#header
+ <<
+ \#include <stdio.h>
+ >>
+
+#157. (Fixed in MR13) empty error sets for rules with infinite recursion
+
+ When the first set for a rule cannot be computed due to infinite
+ left recursion and it is the only alternative for a block then
+ the error set for the block would be empty. This would result
+ in a fatal error.
+
+ Reported by Darin Creason (creason genedax.com)
+
+#156. (Changed in MR13) DLGLexerBase::getToken() now public
+
+#155. (Changed in MR13) Context behind predicates can suppress
+
+ With -mrhoist enabled the context behind a guarded predicate can
+ be used to suppress other predicates. Consider the following grammar:
+
+ r0 : (r1)+;
+
+ r1 : rp
+ | rq
+ ;
+ rp : <<p LATEXT(1)>>? B ;
+ rq : (A)? => <<q LATEXT(1)>>? (A|B);
+
+ In earlier versions both predicates "p" and "q" would be hoisted into
+ rule r0. With MR12c predicate p is suppressed because the context which
+ follows predicate q includes "B" which can "cover" predicate "p". In
+ other words, in trying to decide in r0 whether to call r1, it doesn't
+ really matter whether p is false or true because, either way, there is
+ a valid choice within r1.
+
+#154. (Changed in MR13) Making hoist suppression explicit using <<nohoist>>
+
+ A common error, even among experienced pccts users, is to code
+ an init-action to inhibit hoisting rather than a leading action.
+ An init-action does not inhibit hoisting.
+
+ This was coded:
+
+ rule1 : <<;>> rule2
+
+ This is what was meant:
+
+ rule1 : <<;>> <<;>> rule2
+
+ With MR13, the user can code:
+
+ rule1 : <<;>> <<nohoist>> rule2
+
+ The following will give an error message:
+
+ rule1 : <<nohoist>> rule2
+
+ If the <<nohoist>> appears as an init-action rather than a leading
+ action an error message is issued. The meaning of an init-action
+ containing "nohoist" is unclear: does it apply to just one
+ alternative or to all alternatives ?
+
+
+
+
+
+
+
+
+ -------------------------------------------------------
+ Note: Items #153 to #1 are now in a separate file named
+ CHANGES_FROM_133_BEFORE_MR13.txt
+ -------------------------------------------------------
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_FROM_133_BEFORE_MR13.txt b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_FROM_133_BEFORE_MR13.txt
new file mode 100644
index 000000000..33d7d20a6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_FROM_133_BEFORE_MR13.txt
@@ -0,0 +1,3666 @@
+
+ ------------------------------------------------------------
+ This is the second part of a two part file.
+ This is a list of changes to pccts 1.33 prior to MR13
+ For more recent information see CHANGES_FROM_133.txt
+ ------------------------------------------------------------
+
+ DISCLAIMER
+
+ The software and these notes are provided "as is". They may include
+ typographical or technical errors and their authors disclaims all
+ liability of any kind or nature for damages due to error, fault,
+ defect, or deficiency regardless of cause. All warranties of any
+ kind, either express or implied, including, but not limited to, the
+ implied warranties of merchantability and fitness for a particular
+ purpose are disclaimed.
+
+
+#153. (Changed in MR12b) Bug in computation of -mrhoist suppression set
+
+ Consider the following grammar with k=1 and "-mrhoist on":
+
+ r1 : (A)? => ((p>>? x /* l1 */
+ | r2 /* l2 */
+ ;
+ r2 : A /* l4 */
+ | (B)? => <<q>>? y /* l5 */
+ ;
+
+ In earlier versions the mrhoist routine would see that both l1 and
+ l2 contained predicates and would assume that this prevented either
+ from acting to suppress the other predicate. In the example above
+ it didn't realize the A at line l4 is capable of suppressing the
+ predicate at l1 even though alt l2 contains (indirectly) a predicate.
+
+ This is fixed in MR12b.
+
+ Reported by Reinier van den Born (reinier@vnet.ibm.com)
+
+#153. (Changed in MR12a) Bug in computation of -mrhoist suppression set
+
+ An oversight similar to that described in Item #152 appeared in
+ the computation of the set that "covered" a predicate. If a
+ predicate expression included a term such as p=AND(q,r) the context
+ of p was taken to be context(q) & context(r), when it should have
+ been context(q) | context(r). This is fixed in MR12a.
+
+#152. (Changed in MR12) Bug in generation of predicate expressions
+
+ The primary purpose for MR12 is to make quite clear that MR11 is
+ obsolete and to fix the bug related to predicate expressions.
+
+ In MR10 code was added to optimize the code generated for
+ predicate expression tests. Unfortunately, there was a
+ significant oversight in the code which resulted in a bug in
+ the generation of code for predicate expression tests which
+ contained predicates combined using AND:
+
+ r0 : (r1)* "@" ;
+ r1 : (AAA)? => <<p LATEXT(1)>>? r2 ;
+ r2 : (BBB)? => <<q LATEXT(1)>>? Q
+ | (BBB)? => <<r LATEXT(1)>>? Q
+ ;
+
+ In MR11 (and MR10 when using "-mrhoist on") the code generated
+ for r0 to predict r1 would be equivalent to:
+
+ if ( LA(1)==Q &&
+ (LA(1)==AAA && LA(1)==BBB) &&
+ ( p && ( q || r )) ) {
+
+ This is incorrect because it expresses the idea that LA(1)
+ *must* be AAA in order to attempt r1, and *must* be BBB to
+ attempt r2. The result was that r1 became unreachable since
+ both condition can not be simultaneously true.
+
+ The general philosophy of code generation for predicates
+ can be summarized as follows:
+
+ a. If the context is true don't enter an alt
+ for which the corresponding predicate is false.
+
+ If the context is false then it is okay to enter
+ the alt without evaluating the predicate at all.
+
+ b. A predicate created by ORing of predicates has
+ context which is the OR of their individual contexts.
+
+ c. A predicate created by ANDing of predicates has
+ (surprise) context which is the OR of their individual
+ contexts.
+
+ d. Apply these rules recursively.
+
+ e. Remember rule (a)
+
+ The correct code should express the idea that *if* LA(1) is
+ AAA then p must be true to attempt r1, but if LA(1) is *not*
+ AAA then it is okay to attempt r1, provided that *if* LA(1) is
+ BBB then one of q or r must be true.
+
+ if ( LA(1)==Q &&
+ ( !(LA(1)==AAA || LA(1)==BBB) ||
+ ( ! LA(1) == AAA || p) &&
+ ( ! LA(1) == BBB || q || r ) ) ) {
+
+ I believe this is fixed in MR12.
+
+ Reported by Reinier van den Born (reinier@vnet.ibm.com)
+
+#151a. (Changed in MR12) ANTLRParser::getLexer()
+
+ As a result of several requests, I have added public methods to
+ get a pointer to the lexer belonging to a parser.
+
+ ANTLRTokenStream *ANTLRParser::getLexer() const
+
+ Returns a pointer to the lexer being used by the
+ parser. ANTLRTokenStream is the base class of
+ DLGLexer
+
+ ANTLRTokenStream *ANTLRTokenBuffer::getLexer() const
+
+ Returns a pointer to the lexer being used by the
+ ANTLRTokenBuffer. ANTLRTokenStream is the base
+ class of DLGLexer
+
+ You must manually cast the ANTLRTokenStream to your program's
+ lexer class. Because the name of the lexer's class is not fixed.
+ Thus it is impossible to incorporate it into the DLGLexerBase
+ class.
+
+#151b.(Changed in MR12) ParserBlackBox member getLexer()
+
+ The template class ParserBlackBox now has a member getLexer()
+ which returns a pointer to the lexer.
+
+#150. (Changed in MR12) syntaxErrCount and lexErrCount now public
+
+ See Item #127 for more information.
+
+#149. (Changed in MR12) antlr option -info o (letter o for orphan)
+
+ If there is more than one rule which is not referenced by any
+ other rule then all such rules are listed. This is useful for
+ alerting one to rules which are not used, but which can still
+ contribute to ambiguity. For example:
+
+ start : a Z ;
+ unused: a A ;
+ a : (A)+ ;
+
+ will cause an ambiguity report for rule "a" which will be
+ difficult to understand if the user forgets about rule "unused"
+ simply because it is not used in the grammar.
+
+#148. (Changed in MR11) #token names appearing in zztokens,token_tbl
+
+ In a #token statement like the following:
+
+ #token Plus "\+"
+
+ the string "Plus" appears in the zztokens array (C mode) and
+ token_tbl (C++ mode). This string is used in most error
+ messages. In MR11 one has the option of using some other string,
+ (e.g. "+") in those tables.
+
+ In MR11 one can write:
+
+ #token Plus ("+") "\+"
+ #token RP ("(") "\("
+ #token COM ("comment begin") "/\*"
+
+ A #token statement is allowed to appear in more than one #lexclass
+ with different regular expressions. However, the token name appears
+ only once in the zztokens/token_tbl array. This means that only
+ one substitute can be specified for a given #token name. The second
+ attempt to define a substitute name (different from the first) will
+ result in an error message.
+
+#147. (Changed in MR11) Bug in follow set computation
+
+ There is a bug in 1.33 vanilla and all maintenance releases
+ prior to MR11 in the computation of the follow set. The bug is
+ different than that described in Item #82 and probably more
+ common. It was discovered in the ansi.g grammar while testing
+ the "ambiguity aid" (Item #119). The search for a bug started
+ when the ambiguity aid was unable to discover the actual source
+ of an ambiguity reported by antlr.
+
+ The problem appears when an optimization of the follow set
+ computation is used inappropriately. The result is that the
+ follow set used is the "worst case". In other words, the error
+ can lead to false reports of ambiguity. The good news is that
+ if you have a grammar in which you have addressed all reported
+ ambiguities you are ok. The bad news is that you may have spent
+ time fixing ambiguities that were not real, or used k=2 when
+ ck=2 might have been sufficient, and so on.
+
+ The following grammar demonstrates the problem:
+
+ ------------------------------------------------------------
+ expr : ID ;
+
+ start : stmt SEMI ;
+
+ stmt : CASE expr COLON
+ | expr SEMI
+ | plain_stmt
+ ;
+
+ plain_stmt : ID COLON ;
+ ------------------------------------------------------------
+
+ When compiled with k=1 and ck=2 it will report:
+
+ warning: alts 2 and 3 of the rule itself ambiguous upon
+ { IDENTIFIER }, { COLON }
+
+ When antlr analyzes "stmt" it computes the first[1] set of all
+ alternatives. It finds an ambiguity between alts 2 and 3 for ID.
+ It then computes the first[2] set for alternatives 2 and 3 to resolve
+ the ambiguity. In computing the first[2] set of "expr" (which is
+ only one token long) it needs to determine what could follow "expr".
+ Under a certain combination of circumstances antlr forgets that it
+ is trying to analyze "stmt" which can only be followed by SEMI and
+ adds to the first[2] set of "expr" the "global" follow set (including
+ "COLON") which could follow "expr" (under other conditions) in the
+ phrase "CASE expr COLON".
+
+#146. (Changed in MR11) Option -treport for locating "difficult" alts
+
+ It can be difficult to determine which alternatives are causing
+ pccts to work hard to resolve an ambiguity. In some cases the
+ ambiguity is successfully resolved after much CPU time so there
+ is no message at all.
+
+ A rough measure of the amount of work being peformed which is
+ independent of the CPU speed and system load is the number of
+ tnodes created. Using "-info t" gives information about the
+ total number of tnodes created and the peak number of tnodes.
+
+ Tree Nodes: peak 1300k created 1416k lost 0
+
+ It also puts in the generated C or C++ file the number of tnodes
+ created for a rule (at the end of the rule). However this
+ information is not sufficient to locate the alternatives within
+ a rule which are causing the creation of tnodes.
+
+ Using:
+
+ antlr -treport 100000 ....
+
+ causes antlr to list on stdout any alternatives which require the
+ creation of more than 100,000 tnodes, along with the lookahead sets
+ for those alternatives.
+
+ The following is a trivial case from the ansi.g grammar which shows
+ the format of the report. This report might be of more interest
+ in cases where 1,000,000 tuples were created to resolve the ambiguity.
+
+ -------------------------------------------------------------------------
+ There were 0 tuples whose ambiguity could not be resolved
+ by full lookahead
+ There were 157 tnodes created to resolve ambiguity between:
+
+ Choice 1: statement/2 line 475 file ansi.g
+ Choice 2: statement/3 line 476 file ansi.g
+
+ Intersection of lookahead[1] sets:
+
+ IDENTIFIER
+
+ Intersection of lookahead[2] sets:
+
+ LPARENTHESIS COLON AMPERSAND MINUS
+ STAR PLUSPLUS MINUSMINUS ONESCOMPLEMENT
+ NOT SIZEOF OCTALINT DECIMALINT
+ HEXADECIMALINT FLOATONE FLOATTWO IDENTIFIER
+ STRING CHARACTER
+ -------------------------------------------------------------------------
+
+#145. (Documentation) Generation of Expression Trees
+
+ Item #99 was misleading because it implied that the optimization
+ for tree expressions was available only for trees created by
+ predicate expressions and neglected to mention that it required
+ the use of "-mrhoist on". The optimization applies to tree
+ expressions created for grammars with k>1 and for predicates with
+ lookahead depth >1.
+
+ In MR11 the optimized version is always used so the -mrhoist on
+ option need not be specified.
+
+#144. (Changed in MR11) Incorrect test for exception group
+
+ In testing for a rule's exception group the label a pointer
+ is compared against '\0'. The intention is "*pointer".
+
+ Reported by Jeffrey C. Fried (Jeff@Fried.net).
+
+#143. (Changed in MR11) Optional ";" at end of #token statement
+
+ Fixes problem of:
+
+ #token X "x"
+
+ <<
+ parser action
+ >>
+
+ Being confused with:
+
+ #token X "x" <<lexical action>>
+
+#142. (Changed in MR11) class BufFileInput subclass of DLGInputStream
+
+ Alexey Demakov (demakov@kazbek.ispras.ru) has supplied class
+ BufFileInput derived from DLGInputStream which provides a
+ function lookahead(char *string) to test characters in the
+ input stream more than one character ahead.
+
+ The default amount of lookahead is specified by the constructor
+ and defaults to 8 characters. This does *not* include the one
+ character of lookahead maintained internally by DLG in member "ch"
+ and which is not available for testing via BufFileInput::lookahead().
+
+ This is a useful class for overcoming the one-character-lookahead
+ limitation of DLG without resorting to a lexer capable of
+ backtracking (like flex) which is not integrated with antlr as is
+ DLG.
+
+ There are no restrictions on copying or using BufFileInput.* except
+ that the authorship and related information must be retained in the
+ source code.
+
+ The class is located in pccts/h/BufFileInput.* of the kit.
+
+#141. (Changed in MR11) ZZDEBUG_CONSUME for ANTLRParser::consume()
+
+ A debug aid has been added to file ANTLRParser::consume() in
+ file AParser.cpp:
+
+ #ifdef ZZDEBUG_CONSUME_ACTION
+ zzdebug_consume_action();
+ #endif
+
+ Suggested by Sramji Ramanathan (ps@kumaran.com).
+
+#140. (Changed in MR11) #pred to define predicates
+
+ +---------------------------------------------------+
+ | Note: Assume "-prc on" for this entire discussion |
+ +---------------------------------------------------+
+
+ A problem with predicates is that each one is regarded as
+ unique and capable of disambiguating cases where two
+ alternatives have identical lookahead. For example:
+
+ rule : <<pred(LATEXT(1))>>? A
+ | <<pred(LATEXT(1))>>? A
+ ;
+
+ will not cause any error messages or warnings to be issued
+ by earlier versions of pccts. To compare the text of the
+ predicates is an incomplete solution.
+
+ In 1.33MR11 I am introducing the #pred statement in order to
+ solve some problems with predicates. The #pred statement allows
+ one to give a symbolic name to a "predicate literal" or a
+ "predicate expression" in order to refer to it in other predicate
+ expressions or in the rules of the grammar.
+
+ The predicate literal associated with a predicate symbol is C
+ or C++ code which can be used to test the condition. A
+ predicate expression defines a predicate symbol in terms of other
+ predicate symbols using "!", "&&", and "||". A predicate symbol
+ can be defined in terms of a predicate literal, a predicate
+ expression, or *both*.
+
+ When a predicate symbol is defined with both a predicate literal
+ and a predicate expression, the predicate literal is used to generate
+ code, but the predicate expression is used to check for two
+ alternatives with identical predicates in both alternatives.
+
+ Here are some examples of #pred statements:
+
+ #pred IsLabel <<isLabel(LATEXT(1))>>?
+ #pred IsLocalVar <<isLocalVar(LATEXT(1))>>?
+ #pred IsGlobalVar <<isGlobalVar(LATEXT(1)>>?
+ #pred IsVar <<isVar(LATEXT(1))>>? IsLocalVar || IsGlobalVar
+ #pred IsScoped <<isScoped(LATEXT(1))>>? IsLabel || IsLocalVar
+
+ I hope that the use of EBNF notation to describe the syntax of the
+ #pred statement will not cause problems for my readers (joke).
+
+ predStatement : "#pred"
+ CapitalizedName
+ (
+ "<<predicate_literal>>?"
+ | "<<predicate_literal>>?" predOrExpr
+ | predOrExpr
+ )
+ ;
+
+ predOrExpr : predAndExpr ( "||" predAndExpr ) * ;
+
+ predAndExpr : predPrimary ( "&&" predPrimary ) * ;
+
+ predPrimary : CapitalizedName
+ | "!" predPrimary
+ | "(" predOrExpr ")"
+ ;
+
+ What is the purpose of this nonsense ?
+
+ To understand how predicate symbols help, you need to realize that
+ predicate symbols are used in two different ways with two different
+ goals.
+
+ a. Allow simplification of predicates which have been combined
+ during predicate hoisting.
+
+ b. Allow recognition of identical predicates which can't disambiguate
+ alternatives with common lookahead.
+
+ First we will discuss goal (a). Consider the following rule:
+
+ rule0: rule1
+ | ID
+ | ...
+ ;
+
+ rule1: rule2
+ | rule3
+ ;
+
+ rule2: <<isX(LATEXT(1))>>? ID ;
+ rule3: <<!isX(LATEXT(1)>>? ID ;
+
+ When the predicates in rule2 and rule3 are combined by hoisting
+ to create a prediction expression for rule1 the result is:
+
+ if ( LA(1)==ID
+ && ( isX(LATEXT(1) || !isX(LATEXT(1) ) ) { rule1(); ...
+
+ This is inefficient, but more importantly, can lead to false
+ assumptions that the predicate expression distinguishes the rule1
+ alternative with some other alternative with lookahead ID. In
+ MR11 one can write:
+
+ #pred IsX <<isX(LATEXT(1))>>?
+
+ ...
+
+ rule2: <<IsX>>? ID ;
+ rule3: <<!IsX>>? ID ;
+
+ During hoisting MR11 recognizes this as a special case and
+ eliminates the predicates. The result is a prediction
+ expression like the following:
+
+ if ( LA(1)==ID ) { rule1(); ...
+
+ Please note that the following cases which appear to be equivalent
+ *cannot* be simplified by MR11 during hoisting because the hoisting
+ logic only checks for a "!" in the predicate action, not in the
+ predicate expression for a predicate symbol.
+
+ *Not* equivalent and is not simplified during hoisting:
+
+ #pred IsX <<isX(LATEXT(1))>>?
+ #pred NotX <<!isX(LATEXT(1))>>?
+ ...
+ rule2: <<IsX>>? ID ;
+ rule3: <<NotX>>? ID ;
+
+ *Not* equivalent and is not simplified during hoisting:
+
+ #pred IsX <<isX(LATEXT(1))>>?
+ #pred NotX !IsX
+ ...
+ rule2: <<IsX>>? ID ;
+ rule3: <<NotX>>? ID ;
+
+ Now we will discuss goal (b).
+
+ When antlr discovers that there is a lookahead ambiguity between
+ two alternatives it attempts to resolve the ambiguity by searching
+ for predicates in both alternatives. In the past any predicate
+ would do, even if the same one appeared in both alternatives:
+
+ rule: <<p(LATEXT(1))>>? X
+ | <<p(LATEXT(1))>>? X
+ ;
+
+ The #pred statement is a start towards solving this problem.
+ During ambiguity resolution (*not* predicate hoisting) the
+ predicates for the two alternatives are expanded and compared.
+ Consider the following example:
+
+ #pred Upper <<isUpper(LATEXT(1))>>?
+ #pred Lower <<isLower(LATEXT(1))>>?
+ #pred Alpha <<isAlpha(LATEXT(1))>>? Upper || Lower
+
+ rule0: rule1
+ | <<Alpha>>? ID
+ ;
+
+ rule1:
+ | rule2
+ | rule3
+ ...
+ ;
+
+ rule2: <<Upper>>? ID;
+ rule3: <<Lower>>? ID;
+
+ The definition of #pred Alpha expresses:
+
+ a. to test the predicate use the C code "isAlpha(LATEXT(1))"
+
+ b. to analyze the predicate use the information that
+ Alpha is equivalent to the union of Upper and Lower,
+
+ During ambiguity resolution the definition of Alpha is expanded
+ into "Upper || Lower" and compared with the predicate in the other
+ alternative, which is also "Upper || Lower". Because they are
+ identical MR11 will report a problem.
+
+ -------------------------------------------------------------------------
+ t10.g, line 5: warning: the predicates used to disambiguate rule rule0
+ (file t10.g alt 1 line 5 and alt 2 line 6)
+ are identical when compared without context and may have no
+ resolving power for some lookahead sequences.
+ -------------------------------------------------------------------------
+
+ If you use the "-info p" option the output file will contain:
+
+ +----------------------------------------------------------------------+
+ |#if 0 |
+ | |
+ |The following predicates are identical when compared without |
+ | lookahead context information. For some ambiguous lookahead |
+ | sequences they may not have any power to resolve the ambiguity. |
+ | |
+ |Choice 1: rule0/1 alt 1 line 5 file t10.g |
+ | |
+ | The original predicate for choice 1 with available context |
+ | information: |
+ | |
+ | OR expr |
+ | |
+ | pred << Upper>>? |
+ | depth=k=1 rule rule2 line 14 t10.g |
+ | set context: |
+ | ID |
+ | |
+ | pred << Lower>>? |
+ | depth=k=1 rule rule3 line 15 t10.g |
+ | set context: |
+ | ID |
+ | |
+ | The predicate for choice 1 after expansion (but without context |
+ | information): |
+ | |
+ | OR expr |
+ | |
+ | pred << isUpper(LATEXT(1))>>? |
+ | depth=k=1 rule line 1 t10.g |
+ | |
+ | pred << isLower(LATEXT(1))>>? |
+ | depth=k=1 rule line 2 t10.g |
+ | |
+ | |
+ |Choice 2: rule0/2 alt 2 line 6 file t10.g |
+ | |
+ | The original predicate for choice 2 with available context |
+ | information: |
+ | |
+ | pred << Alpha>>? |
+ | depth=k=1 rule rule0 line 6 t10.g |
+ | set context: |
+ | ID |
+ | |
+ | The predicate for choice 2 after expansion (but without context |
+ | information): |
+ | |
+ | OR expr |
+ | |
+ | pred << isUpper(LATEXT(1))>>? |
+ | depth=k=1 rule line 1 t10.g |
+ | |
+ | pred << isLower(LATEXT(1))>>? |
+ | depth=k=1 rule line 2 t10.g |
+ | |
+ | |
+ |#endif |
+ +----------------------------------------------------------------------+
+
+ The comparison of the predicates for the two alternatives takes
+ place without context information, which means that in some cases
+ the predicates will be considered identical even though they operate
+ on disjoint lookahead sets. Consider:
+
+ #pred Alpha
+
+ rule1: <<Alpha>>? ID
+ | <<Alpha>>? Label
+ ;
+
+ Because the comparison of predicates takes place without context
+ these will be considered identical. The reason for comparing
+ without context is that otherwise it would be necessary to re-evaluate
+ the entire predicate expression for each possible lookahead sequence.
+ This would require more code to be written and more CPU time during
+ grammar analysis, and it is not yet clear whether anyone will even make
+ use of the new #pred facility.
+
+ A temporary workaround might be to use different #pred statements
+ for predicates you know have different context. This would avoid
+ extraneous warnings.
+
+ The above example might be termed a "false positive". Comparison
+ without context will also lead to "false negatives". Consider the
+ following example:
+
+ #pred Alpha
+ #pred Beta
+
+ rule1: <<Alpha>>? A
+ | rule2
+ ;
+
+ rule2: <<Alpha>>? A
+ | <<Beta>>? B
+ ;
+
+ The predicate used for alt 2 of rule1 is (Alpha || Beta). This
+ appears to be different than the predicate Alpha used for alt1.
+ However, the context of Beta is B. Thus when the lookahead is A
+ Beta will have no resolving power and Alpha will be used for both
+ alternatives. Using the same predicate for both alternatives isn't
+ very helpful, but this will not be detected with 1.33MR11.
+
+ To properly handle this the predicate expression would have to be
+ evaluated for each distinct lookahead context.
+
+ To determine whether two predicate expressions are identical is
+ difficult. The routine may fail to identify identical predicates.
+
+ The #pred feature also compares predicates to see if a choice between
+ alternatives which is resolved by a predicate which makes the second
+ choice unreachable. Consider the following example:
+
+ #pred A <<A(LATEXT(1)>>?
+ #pred B <<B(LATEXT(1)>>?
+ #pred A_or_B A || B
+
+ r : s
+ | t
+ ;
+ s : <<A_or_B>>? ID
+ ;
+ t : <<A>>? ID
+ ;
+
+ ----------------------------------------------------------------------------
+ t11.g, line 5: warning: the predicate used to disambiguate the
+ first choice of rule r
+ (file t11.g alt 1 line 5 and alt 2 line 6)
+ appears to "cover" the second predicate when compared without context.
+ The second predicate may have no resolving power for some lookahead
+ sequences.
+ ----------------------------------------------------------------------------
+
+#139. (Changed in MR11) Problem with -gp in C++ mode
+
+ The -gp option to add a prefix to rule names did not work in
+ C++ mode. This has been fixed.
+
+ Reported by Alexey Demakov (demakov@kazbek.ispras.ru).
+
+#138. (Changed in MR11) Additional makefiles for non-MSVC++ MS systems
+
+ Sramji Ramanathan (ps@kumaran.com) has supplied makefiles for
+ building antlr and dlg with Win95/NT development tools that
+ are not based on MSVC5. They are pccts/antlr/AntlrMS.mak and
+ pccts/dlg/DlgMS.mak.
+
+ The first line of the makefiles require a definition of PCCTS_HOME.
+
+ These are in addition to the AntlrMSVC50.* and DlgMSVC50.*
+ supplied by Jeff Vincent (JVincent@novell.com).
+
+#137. (Changed in MR11) Token getType(), getText(), getLine() const members
+
+ --------------------------------------------------------------------
+ If you use ANTLRCommonToken this change probably does not affect you.
+ --------------------------------------------------------------------
+
+ For a long time it has bothered me that these accessor functions
+ in ANTLRAbstractToken were not const member functions. I have
+ refrained from changing them because it require users to modify
+ existing token class definitions which are derived directly
+ from ANTLRAbstractToken. I think it is now time.
+
+ For those who are not used to C++, a "const member function" is a
+ member function which does not modify its own object - the thing
+ to which "this" points. This is quite different from a function
+ which does not modify its arguments
+
+ Most token definitions based on ANTLRAbstractToken have something like
+ the following in order to create concrete definitions of the pure
+ virtual methods in ANTLRAbstractToken:
+
+ class MyToken : public ANTLRAbstractToken {
+ ...
+ ANTLRTokenType getType() {return _type; }
+ int getLine() {return _line; }
+ ANTLRChar * getText() {return _text; }
+ ...
+ }
+
+ The required change is simply to put "const" following the function
+ prototype in the header (.h file) and the definition file (.cpp if
+ it is not inline):
+
+ class MyToken : public ANTLRAbstractToken {
+ ...
+ ANTLRTokenType getType() const {return _type; }
+ int getLine() const {return _line; }
+ ANTLRChar * getText() const {return _text; }
+ ...
+ }
+
+ This was originally proposed a long time ago by Bruce
+ Guenter (bruceg@qcc.sk.ca).
+
+#136. (Changed in MR11) Added getLength() to ANTLRCommonToken
+
+ Classes ANTLRCommonToken and ANTLRCommonTokenNoRefCountToken
+ now have a member function:
+
+ int getLength() const { return strlen(getText()) }
+
+ Suggested by Sramji Ramanathan (ps@kumaran.com).
+
+#135. (Changed in MR11) Raised antlr's own default ZZLEXBUFSIZE to 8k
+
+#134a. (ansi_mr10.zip) T.J. Parr's ANSI C grammar made 1.33MR11 compatible
+
+ There is a typographical error in the definition of BITWISEOREQ:
+
+ #token BITWISEOREQ "!=" should be "\|="
+
+ When this change is combined with the bugfix to the follow set cache
+ problem (Item #147) and a minor rearrangement of the grammar
+ (Item #134b) it becomes a k=1 ck=2 grammar.
+
+#134b. (ansi_mr10.zip) T.J. Parr's ANSI C grammar made 1.33MR11 compatible
+
+ The following changes were made in the ansi.g grammar (along with
+ using -mrhoist on):
+
+ ansi.g
+ ======
+ void tracein(char *) ====> void tracein(const char *)
+ void traceout(char *) ====> void traceout(const char *)
+
+ <LT(1)->getType()==IDENTIFIER ? isTypeName(LT(1)->getText()) : 1>>?
+ ====> <<isTypeName(LT(1)->getText())>>?
+
+ <<(LT(1)->getType()==LPARENTHESIS && LT(2)->getType()==IDENTIFIER) ? \
+ isTypeName(LT(2)->getText()) : 1>>?
+ ====> (LPARENTHESIS IDENTIFIER)? => <<isTypeName(LT(2)->getText())>>?
+
+ <<(LT(1)->getType()==LPARENTHESIS && LT(2)->getType()==IDENTIFIER) ? \
+ isTypeName(LT(2)->getText()) : 1>>?
+ ====> (LPARENTHESIS IDENTIFIER)? => <<isTypeName(LT(2)->getText())>>?
+
+ added to init(): traceOptionValueDefault=0;
+ added to init(): traceOption(-1);
+
+ change rule "statement":
+
+ statement
+ : plain_label_statement
+ | case_label_statement
+ | <<;>> expression SEMICOLON
+ | compound_statement
+ | selection_statement
+ | iteration_statement
+ | jump_statement
+ | SEMICOLON
+ ;
+
+ plain_label_statement
+ : IDENTIFIER COLON statement
+ ;
+
+ case_label_statement
+ : CASE constant_expression COLON statement
+ | DEFAULT COLON statement
+ ;
+
+ support.cpp
+ ===========
+ void tracein(char *) ====> void tracein(const char *)
+ void traceout(char *) ====> void traceout(const char *)
+
+ added to tracein(): ANTLRParser::tracein(r); // call superclass method
+ added to traceout(): ANTLRParser::traceout(r); // call superclass method
+
+ Makefile
+ ========
+ added to AFLAGS: -mrhoist on -prc on
+
+#133. (Changed in 1.33MR11) Make trace options public in ANTLRParser
+
+ In checking T.J. Parr's ANSI C grammar for compatibility with
+ 1.33MR11 discovered that it was inconvenient to have the
+ trace facilities with protected access.
+
+#132. (Changed in 1.33MR11) Recognition of identical predicates in alts
+
+ Prior to 1.33MR11, there would be no ambiguity warning when the
+ very same predicate was used to disambiguate both alternatives:
+
+ test: ref B
+ | ref C
+ ;
+
+ ref : <<pred(LATEXT(1)>>? A
+
+ In 1.33MR11 this will cause the warning:
+
+ warning: the predicates used to disambiguate rule test
+ (file v98.g alt 1 line 1 and alt 2 line 2)
+ are identical and have no resolving power
+
+ ----------------- Note -----------------
+
+ This is different than the following case
+
+ test: <<pred(LATEXT(1))>>? A B
+ | <<pred(LATEXT(1)>>? A C
+ ;
+
+ In this case there are two distinct predicates
+ which have exactly the same text. In the first
+ example there are two references to the same
+ predicate. The problem represented by this
+ grammar will be addressed later.
+
+#131. (Changed in 1.33MR11) Case insensitive command line options
+
+ Command line switches like "-CC" and keywords like "on", "off",
+ and "stdin" are no longer case sensitive in antlr, dlg, and sorcerer.
+
+#130. (Changed in 1.33MR11) Changed ANTLR_VERSION to int from string
+
+ The ANTLR_VERSION was not an integer, making it difficult to
+ perform conditional compilation based on the antlr version.
+
+ Henceforth, ANTLR_VERSION will be:
+
+ (base_version * 10000) + release number
+
+ thus 1.33MR11 will be: 133*100+11 = 13311
+
+ Suggested by Rainer Janssen (Rainer.Janssen@Informatik.Uni-Oldenburg.DE).
+
+#129. (Changed in 1.33MR11) Addition of ANTLR_VERSION to <parserName>.h
+
+ The following code is now inserted into <parserName>.h amd
+ stdpccts.h:
+
+ #ifndef ANTLR_VERSION
+ #define ANTLR_VERSION 13311
+ #endif
+
+ Suggested by Rainer Janssen (Rainer.Janssen@Informatik.Uni-Oldenburg.DE)
+
+#128. (Changed in 1.33MR11) Redundant predicate code in (<<pred>>? ...)+
+
+ Prior to 1.33MR11, the following grammar would generate
+ redundant tests for the "while" condition.
+
+ rule2 : (<<pred>>? X)+ X
+ | B
+ ;
+
+ The code would resemble:
+
+ if (LA(1)==X) {
+ if (pred) {
+ do {
+ if (!pred) {zzfailed_pred(" pred");}
+ zzmatch(X); zzCONSUME;
+ } while (LA(1)==X && pred && pred);
+ } else {...
+
+ With 1.33MR11 the redundant predicate test is omitted.
+
+#127. (Changed in 1.33MR11)
+
+ Count Syntax Errors Count DLG Errors
+ ------------------- ----------------
+
+ C++ mode ANTLRParser:: DLGLexerBase::
+ syntaxErrCount lexErrCount
+ C mode zzSyntaxErrCount zzLexErrCount
+
+ The C mode variables are global and initialized to 0.
+ They are *not* reset to 0 automatically when antlr is
+ restarted.
+
+ The C++ mode variables are public. They are initialized
+ to 0 by the constructors. They are *not* reset to 0 by the
+ ANTLRParser::init() method.
+
+ Suggested by Reinier van den Born (reinier@vnet.ibm.com).
+
+#126. (Changed in 1.33MR11) Addition of #first <<...>>
+
+ The #first <<...>> inserts the specified text in the output
+ files before any other #include statements required by pccts.
+ The only things before the #first text are comments and
+ a #define ANTLR_VERSION.
+
+ Requested by and Esa Pulkkinen (esap@cs.tut.fi) and Alexin
+ Zoltan (alexin@inf.u-szeged.hu).
+
+#125. (Changed in 1.33MR11) Lookahead for (guard)? && <<p>>? predicates
+
+ When implementing the new style of guard predicate (Item #113)
+ in 1.33MR10 I decided to temporarily ignore the problem of
+ computing the "narrowest" lookahead context.
+
+ Consider the following k=1 grammar:
+
+ start : a
+ | b
+ ;
+
+ a : (A)? && <<pred1(LATEXT(1))>>? ab ;
+ b : (B)? && <<pred2(LATEXT(1))>>? ab ;
+
+ ab : A | B ;
+
+ In MR10 the context for both "a" and "b" was {A B} because this is
+ the first set of rule "ab". Normally, this is not a problem because
+ the predicate which follows the guard inhibits any ambiguity report
+ by antlr.
+
+ In MR11 the first set for rule "a" is {A} and for rule "b" it is {B}.
+
+#124. A Note on the New "&&" Style Guarded Predicates
+
+ I've been asked several times, "What is the difference between
+ the old "=>" style guard predicates and the new style "&&" guard
+ predicates, and how do you choose one over the other" ?
+
+ The main difference is that the "=>" does not apply the
+ predicate if the context guard doesn't match, whereas
+ the && form always does. What is the significance ?
+
+ If you have a predicate which is not on the "leading edge"
+ it cannot be hoisted. Suppose you need a predicate that
+ looks at LA(2). You must introduce it manually. The
+ classic example is:
+
+ castExpr :
+ LP typeName RP
+ | ....
+ ;
+
+ typeName : <<isTypeName(LATEXT(1))>>? ID
+ | STRUCT ID
+ ;
+
+ The problem is that typeName isn't on the leading edge
+ of castExpr, so the predicate isTypeName won't be hoisted into
+ castExpr to help make a decision on which production to choose.
+
+ The *first* attempt to fix it is this:
+
+ castExpr :
+ <<isTypeName(LATEXT(2))>>?
+ LP typeName RP
+ | ....
+ ;
+
+ Unfortunately, this won't work because it ignores
+ the problem of STRUCT. The solution is to apply
+ isTypeName() in castExpr if LA(2) is an ID and
+ don't apply it when LA(2) is STRUCT:
+
+ castExpr :
+ (LP ID)? => <<isTypeName(LATEXT(2))>>?
+ LP typeName RP
+ | ....
+ ;
+
+ In conclusion, the "=>" style guarded predicate is
+ useful when:
+
+ a. the tokens required for the predicate
+ are not on the leading edge
+ b. there are alternatives in the expression
+ selected by the predicate for which the
+ predicate is inappropriate
+
+ If (b) were false, then one could use a simple
+ predicate (assuming "-prc on"):
+
+ castExpr :
+ <<isTypeName(LATEXT(2))>>?
+ LP typeName RP
+ | ....
+ ;
+
+ typeName : <<isTypeName(LATEXT(1))>>? ID
+ ;
+
+ So, when do you use the "&&" style guarded predicate ?
+
+ The new-style "&&" predicate should always be used with
+ predicate context. The context guard is in ADDITION to
+ the automatically computed context. Thus it useful for
+ predicates which depend on the token type for reasons
+ other than context.
+
+ The following example is contributed by Reinier van den Born
+ (reinier@vnet.ibm.com).
+
+ +-------------------------------------------------------------------------+
+ | This grammar has two ways to call functions: |
+ | |
+ | - a "standard" call syntax with parens and comma separated args |
+ | - a shell command like syntax (no parens and spacing separated args) |
+ | |
+ | The former also allows a variable to hold the name of the function, |
+ | the latter can also be used to call external commands. |
+ | |
+ | The grammar (simplified) looks like this: |
+ | |
+ | fun_call : ID "(" { expr ("," expr)* } ")" |
+ | /* ID is function name */ |
+ | | "@" ID "(" { expr ("," expr)* } ")" |
+ | /* ID is var containing fun name */ |
+ | ; |
+ | |
+ | command : ID expr* /* ID is function name */ |
+ | | path expr* /* path is external command name */ |
+ | ; |
+ | |
+ | path : ID /* left out slashes and such */ |
+ | | "@" ID /* ID is environment var */ |
+ | ; |
+ | |
+ | expr : .... |
+ | | "(" expr ")"; |
+ | |
+ | call : fun_call |
+ | | command |
+ | ; |
+ | |
+ | Obviously the call is wildly ambiguous. This is more or less how this |
+ | is to be resolved: |
+ | |
+ | A call begins with an ID or an @ followed by an ID. |
+ | |
+ | If it is an ID and if it is an ext. command name -> command |
+ | if followed by a paren -> fun_call |
+ | otherwise -> command |
+ | |
+ | If it is an @ and if the ID is a var name -> fun_call |
+ | otherwise -> command |
+ | |
+ | One can implement these rules quite neatly using && predicates: |
+ | |
+ | call : ("@" ID)? && <<isVarName(LT(2))>>? fun_call |
+ | | (ID)? && <<isExtCmdName>>? command |
+ | | (ID "(")? fun_call |
+ | | command |
+ | ; |
+ | |
+ | This can be done better, so it is not an ideal example, but it |
+ | conveys the principle. |
+ +-------------------------------------------------------------------------+
+
+#123. (Changed in 1.33MR11) Correct definition of operators in ATokPtr.h
+
+ The return value of operators in ANTLRTokenPtr:
+
+ changed: unsigned ... operator !=(...)
+ to: int ... operator != (...)
+ changed: unsigned ... operator ==(...)
+ to: int ... operator == (...)
+
+ Suggested by R.A. Nelson (cowboy@VNET.IBM.COM)
+
+#122. (Changed in 1.33MR11) Member functions to reset DLG in C++ mode
+
+ void DLGFileReset(FILE *f) { input = f; found_eof = 0; }
+ void DLGStringReset(DLGChar *s) { input = s; p = &input[0]; }
+
+ Supplied by R.A. Nelson (cowboy@VNET.IBM.COM)
+
+#121. (Changed in 1.33MR11) Another attempt to fix -o (output dir) option
+
+ Another attempt is made to improve the -o option of antlr, dlg,
+ and sorcerer. This one by JVincent (JVincent@novell.com).
+
+ The current rule:
+
+ a. If -o is not specified than any explicit directory
+ names are retained.
+
+ b. If -o is specified than the -o directory name overrides any
+ explicit directory names.
+
+ c. The directory name of the grammar file is *not* stripped
+ to create the main output file. However it is stil subject
+ to override by the -o directory name.
+
+#120. (Changed in 1.33MR11) "-info f" output to stdout rather than stderr
+
+ Added option 0 (e.g. "-info 0") which is a noop.
+
+#119. (Changed in 1.33MR11) Ambiguity aid for grammars
+
+ The user can ask for additional information on ambiguities reported
+ by antlr to stdout. At the moment, only one ambiguity report can
+ be created in an antlr run.
+
+ This feature is enabled using the "-aa" (Ambiguity Aid) option.
+
+ The following options control the reporting of ambiguities:
+
+ -aa ruleName Selects reporting by name of rule
+ -aa lineNumber Selects reporting by line number
+ (file name not compared)
+
+ -aam Selects "multiple" reporting for a token
+ in the intersection set of the
+ alternatives.
+
+ For instance, the token ID may appear dozens
+ of times in various paths as the program
+ explores the rules which are reachable from
+ the point of an ambiguity. With option -aam
+ every possible path the search program
+ encounters is reported.
+
+ Without -aam only the first encounter is
+ reported. This may result in incomplete
+ information, but the information may be
+ sufficient and much shorter.
+
+ -aad depth Selects the depth of the search.
+ The default value is 1.
+
+ The number of paths to be searched, and the
+ size of the report can grow geometrically
+ with the -ck value if a full search for all
+ contributions to the source of the ambiguity
+ is explored.
+
+ The depth represents the number of tokens
+ in the lookahead set which are matched against
+ the set of ambiguous tokens. A depth of 1
+ means that the search stops when a lookahead
+ sequence of just one token is matched.
+
+ A k=1 ck=6 grammar might generate 5,000 items
+ in a report if a full depth 6 search is made
+ with the Ambiguity Aid. The source of the
+ problem may be in the first token and obscured
+ by the volume of data - I hesitate to call
+ it information.
+
+ When the user selects a depth > 1, the search
+ is first performed at depth=1 for both
+ alternatives, then depth=2 for both alternatives,
+ etc.
+
+ Sample output for rule grammar in antlr.g itself:
+
+ +---------------------------------------------------------------------+
+ | Ambiguity Aid |
+ | |
+ | Choice 1: grammar/70 line 632 file a.g |
+ | Choice 2: grammar/82 line 644 file a.g |
+ | |
+ | Intersection of lookahead[1] sets: |
+ | |
+ | "\}" "class" "#errclass" "#tokclass" |
+ | |
+ | Choice:1 Depth:1 Group:1 ("#errclass") |
+ | 1 in (...)* block grammar/70 line 632 a.g |
+ | 2 to error grammar/73 line 635 a.g |
+ | 3 error error/1 line 894 a.g |
+ | 4 #token "#errclass" error/2 line 895 a.g |
+ | |
+ | Choice:1 Depth:1 Group:2 ("#tokclass") |
+ | 2 to tclass grammar/74 line 636 a.g |
+ | 3 tclass tclass/1 line 937 a.g |
+ | 4 #token "#tokclass" tclass/2 line 938 a.g |
+ | |
+ | Choice:1 Depth:1 Group:3 ("class") |
+ | 2 to class_def grammar/75 line 637 a.g |
+ | 3 class_def class_def/1 line 669 a.g |
+ | 4 #token "class" class_def/3 line 671 a.g |
+ | |
+ | Choice:1 Depth:1 Group:4 ("\}") |
+ | 2 #token "\}" grammar/76 line 638 a.g |
+ | |
+ | Choice:2 Depth:1 Group:5 ("#errclass") |
+ | 1 in (...)* block grammar/83 line 645 a.g |
+ | 2 to error grammar/93 line 655 a.g |
+ | 3 error error/1 line 894 a.g |
+ | 4 #token "#errclass" error/2 line 895 a.g |
+ | |
+ | Choice:2 Depth:1 Group:6 ("#tokclass") |
+ | 2 to tclass grammar/94 line 656 a.g |
+ | 3 tclass tclass/1 line 937 a.g |
+ | 4 #token "#tokclass" tclass/2 line 938 a.g |
+ | |
+ | Choice:2 Depth:1 Group:7 ("class") |
+ | 2 to class_def grammar/95 line 657 a.g |
+ | 3 class_def class_def/1 line 669 a.g |
+ | 4 #token "class" class_def/3 line 671 a.g |
+ | |
+ | Choice:2 Depth:1 Group:8 ("\}") |
+ | 2 #token "\}" grammar/96 line 658 a.g |
+ +---------------------------------------------------------------------+
+
+ For a linear lookahead set ambiguity (where k=1 or for k>1 but
+ when all lookahead sets [i] with i<k all have degree one) the
+ reports appear in the following order:
+
+ for (depth=1 ; depth <= "-aad depth" ; depth++) {
+ for (alternative=1; alternative <=2 ; alternative++) {
+ while (matches-are-found) {
+ group++;
+ print-report
+ };
+ };
+ };
+
+ For reporting a k-tuple ambiguity, the reports appear in the
+ following order:
+
+ for (depth=1 ; depth <= "-aad depth" ; depth++) {
+ while (matches-are-found) {
+ for (alternative=1; alternative <=2 ; alternative++) {
+ group++;
+ print-report
+ };
+ };
+ };
+
+ This is because matches are generated in different ways for
+ linear lookahead and k-tuples.
+
+#118. (Changed in 1.33MR11) DEC VMS makefile and VMS related changes
+
+ Revised makefiles for DEC/VMS operating system for antlr, dlg,
+ and sorcerer.
+
+ Reduced names of routines with external linkage to less than 32
+ characters to conform to DEC/VMS linker limitations.
+
+ Jean-Francois Pieronne discovered problems with dlg and antlr
+ due to the VMS linker not being case sensitive for names with
+ external linkage. In dlg the problem was with "className" and
+ "ClassName". In antlr the problem was with "GenExprSets" and
+ "genExprSets".
+
+ Added genmms, a version of genmk for the DEC/VMS version of make.
+ The source is in directory pccts/support/DECmms.
+
+ All VMS contributions by Jean-Francois Pieronne (jfp@iname.com).
+
+#117. (Changed in 1.33MR10) new EXPERIMENTAL predicate hoisting code
+
+ The hoisting of predicates into rules to create prediction
+ expressions is a problem in antlr. Consider the following
+ example (k=1 with -prc on):
+
+ start : (a)* "@" ;
+ a : b | c ;
+ b : <<isUpper(LATEXT(1))>>? A ;
+ c : A ;
+
+ Prior to 1.33MR10 the code generated for "start" would resemble:
+
+ while {
+ if (LA(1)==A &&
+ (!LA(1)==A || isUpper())) {
+ a();
+ }
+ };
+
+ This code is wrong because it makes rule "c" unreachable from
+ "start". The essence of the problem is that antlr fails to
+ recognize that there can be a valid alternative within "a" even
+ when the predicate <<isUpper(LATEXT(1))>>? is false.
+
+ In 1.33MR10 with -mrhoist the hoisting of the predicate into
+ "start" is suppressed because it recognizes that "c" can
+ cover all the cases where the predicate is false:
+
+ while {
+ if (LA(1)==A) {
+ a();
+ }
+ };
+
+ With the antlr "-info p" switch the user will receive information
+ about the predicate suppression in the generated file:
+
+ --------------------------------------------------------------
+ #if 0
+
+ Hoisting of predicate suppressed by alternative without predicate.
+ The alt without the predicate includes all cases where
+ the predicate is false.
+
+ WITH predicate: line 7 v1.g
+ WITHOUT predicate: line 7 v1.g
+
+ The context set for the predicate:
+
+ A
+
+ The lookahead set for the alt WITHOUT the semantic predicate:
+
+ A
+
+ The predicate:
+
+ pred << isUpper(LATEXT(1))>>?
+ depth=k=1 rule b line 9 v1.g
+ set context:
+ A
+ tree context: null
+
+ Chain of referenced rules:
+
+ #0 in rule start (line 5 v1.g) to rule a
+ #1 in rule a (line 7 v1.g)
+
+ #endif
+ --------------------------------------------------------------
+
+ A predicate can be suppressed by a combination of alternatives
+ which, taken together, cover a predicate:
+
+ start : (a)* "@" ;
+
+ a : b | ca | cb | cc ;
+
+ b : <<isUpper(LATEXT(1))>>? ( A | B | C ) ;
+
+ ca : A ;
+ cb : B ;
+ cc : C ;
+
+ Consider a more complex example in which "c" covers only part of
+ a predicate:
+
+ start : (a)* "@" ;
+
+ a : b
+ | c
+ ;
+
+ b : <<isUpper(LATEXT(1))>>?
+ ( A
+ | X
+ );
+
+ c : A
+ ;
+
+ Prior to 1.33MR10 the code generated for "start" would resemble:
+
+ while {
+ if ( (LA(1)==A || LA(1)==X) &&
+ (! (LA(1)==A || LA(1)==X) || isUpper()) {
+ a();
+ }
+ };
+
+ With 1.33MR10 and -mrhoist the predicate context is restricted to
+ the non-covered lookahead. The code resembles:
+
+ while {
+ if ( (LA(1)==A || LA(1)==X) &&
+ (! (LA(1)==X) || isUpper()) {
+ a();
+ }
+ };
+
+ With the antlr "-info p" switch the user will receive information
+ about the predicate restriction in the generated file:
+
+ --------------------------------------------------------------
+ #if 0
+
+ Restricting the context of a predicate because of overlap
+ in the lookahead set between the alternative with the
+ semantic predicate and one without
+ Without this restriction the alternative without the predicate
+ could not be reached when input matched the context of the
+ predicate and the predicate was false.
+
+ WITH predicate: line 11 v4.g
+ WITHOUT predicate: line 12 v4.g
+
+ The original context set for the predicate:
+
+ A X
+
+ The lookahead set for the alt WITHOUT the semantic predicate:
+
+ A
+
+ The intersection of the two sets
+
+ A
+
+ The original predicate:
+
+ pred << isUpper(LATEXT(1))>>?
+ depth=k=1 rule b line 15 v4.g
+ set context:
+ A X
+ tree context: null
+
+ The new (modified) form of the predicate:
+
+ pred << isUpper(LATEXT(1))>>?
+ depth=k=1 rule b line 15 v4.g
+ set context:
+ X
+ tree context: null
+
+ #endif
+ --------------------------------------------------------------
+
+ The bad news about -mrhoist:
+
+ (a) -mrhoist does not analyze predicates with lookahead
+ depth > 1.
+
+ (b) -mrhoist does not look past a guarded predicate to
+ find context which might cover other predicates.
+
+ For these cases you might want to use syntactic predicates.
+ When a semantic predicate fails during guess mode the guess
+ fails and the next alternative is tried.
+
+ Limitation (a) is illustrated by the following example:
+
+ start : (stmt)* EOF ;
+
+ stmt : cast
+ | expr
+ ;
+ cast : <<isTypename(LATEXT(2))>>? LP ID RP ;
+
+ expr : LP ID RP ;
+
+ This is not much different from the first example, except that
+ it requires two tokens of lookahead context to determine what
+ to do. This predicate is NOT suppressed because the current version
+ is unable to handle predicates with depth > 1.
+
+ A predicate can be combined with other predicates during hoisting.
+ In those cases the depth=1 predicates are still handled. Thus,
+ in the following example the isUpper() predicate will be suppressed
+ by line #4 when hoisted from "bizarre" into "start", but will still
+ be present in "bizarre" in order to predict "stmt".
+
+ start : (bizarre)* EOF ; // #1
+ // #2
+ bizarre : stmt // #3
+ | A // #4
+ ;
+
+ stmt : cast
+ | expr
+ ;
+
+ cast : <<isTypename(LATEXT(2))>>? LP ID RP ;
+
+ expr : LP ID RP ;
+ | <<isUpper(LATEXT(1))>>? A
+
+ Limitation (b) is illustrated by the following example of a
+ context guarded predicate:
+
+ rule : (A)? <<p>>? // #1
+ (A // #2
+ |B // #3
+ ) // #4
+ | <<q>> B // #5
+ ;
+
+ Recall that this means that when the lookahead is NOT A then
+ the predicate "p" is ignored and it attempts to match "A|B".
+ Ideally, the "B" at line #3 should suppress predicate "q".
+ However, the current version does not attempt to look past
+ the guard predicate to find context which might suppress other
+ predicates.
+
+ In some cases -mrhoist will lead to the reporting of ambiguities
+ which were not visible before:
+
+ start : (a)* "@";
+ a : bc | d;
+ bc : b | c ;
+
+ b : <<isUpper(LATEXT(1))>>? A;
+ c : A ;
+
+ d : A ;
+
+ In this case there is a true ambiguity in "a" between "bc" and "d"
+ which can both match "A". Without -mrhoist the predicate in "b"
+ is hoisted into "a" and there is no ambiguity reported. However,
+ with -mrhoist, the predicate in "b" is suppressed by "c" (as it
+ should be) making the ambiguity in "a" apparent.
+
+ The motivations for these changes were hoisting problems reported
+ by Reinier van den Born (reinier@vnet.ibm.com) and several others.
+
+#116. (Changed in 1.33MR10) C++ mode: tracein/traceout rule name is (const char *)
+
+ The prototype for C++ mode routine tracein (and traceout) has changed from
+ "char *" to "const char *".
+
+#115. (Changed in 1.33MR10) Using guess mode with exception handlers in C mode
+
+ The definition of the C mode macros zzmatch_wsig and zzsetmatch_wsig
+ neglected to consider guess mode. When control passed to the rule's
+ parse exception handler the routine would exit without ever closing the
+ guess block. This would lead to unpredictable behavior.
+
+ In 1.33MR10 the behavior of exceptions in C mode and C++ mode should be
+ identical.
+
+#114. (Changed in 1.33MR10) difference in [zz]resynch() between C and C++ modes
+
+ There was a slight difference in the way C and C++ mode resynchronized
+ following a parsing error. The C routine would sometimes skip an extra
+ token before attempting to resynchronize.
+
+ The C routine was changed to match the C++ routine.
+
+#113. (Changed in 1.33MR10) new context guarded pred: (g)? && <<p>>? expr
+
+ The existing context guarded predicate:
+
+ rule : (guard)? => <<p>>? expr
+ | next_alternative
+ ;
+
+ generates code which resembles:
+
+ if (lookahead(expr) && (!guard || pred)) {
+ expr()
+ } else ....
+
+ This is not suitable for some applications because it allows
+ expr() to be invoked when the predicate is false. This is
+ intentional because it is meant to mimic automatically computed
+ predicate context.
+
+ The new context guarded predicate uses the guard information
+ differently because it has a different goal. Consider:
+
+ rule : (guard)? && <<p>>? expr
+ | next_alternative
+ ;
+
+ The new style of context guarded predicate is equivalent to:
+
+ rule : <<guard==true && pred>>? expr
+ | next_alternative
+ ;
+
+ It generates code which resembles:
+
+ if (lookahead(expr) && guard && pred) {
+ expr();
+ } else ...
+
+ Both forms of guarded predicates severely restrict the form of
+ the context guard: it can contain no rule references, no
+ (...)*, no (...)+, and no {...}. It may contain token and
+ token class references, and alternation ("|").
+
+ Addition for 1.33MR11: in the token expression all tokens must
+ be at the same height of the token tree:
+
+ (A ( B | C))? && ... is ok (all height 2)
+ (A ( B | ))? && ... is not ok (some 1, some 2)
+ (A B C D | E F G H)? && ... is ok (all height 4)
+ (A B C D | E )? && ... is not ok (some 4, some 1)
+
+ This restriction is required in order to properly compute the lookahead
+ set for expressions like:
+
+ rule1 : (A B C)? && <<pred>>? rule2 ;
+ rule2 : (A|X) (B|Y) (C|Z);
+
+ This addition was suggested by Rienier van den Born (reinier@vnet.ibm.com)
+
+#112. (Changed in 1.33MR10) failed validation predicate in C guess mode
+
+ John Lilley (jlilley@empathy.com) suggested that failed validation
+ predicates abort a guess rather than reporting a failed error.
+ This was installed in C++ mode (Item #4). Only now was it noticed
+ that the fix was never installed for C mode.
+
+#111. (Changed in 1.33MR10) moved zzTRACEIN to before init action
+
+ When the antlr -gd switch is present antlr generates calls to
+ zzTRACEIN at the start of a rule and zzTRACEOUT at the exit
+ from a rule. Prior to 1.33MR10 Tthe call to zzTRACEIN was
+ after the init-action, which could cause confusion because the
+ init-actions were reported with the name of the enclosing rule,
+ rather than the active rule.
+
+#110. (Changed in 1.33MR10) antlr command line copied to generated file
+
+ The antlr command line is now copied to the generated file near
+ the start.
+
+#109. (Changed in 1.33MR10) improved trace information
+
+ The quality of the trace information provided by the "-gd"
+ switch has been improved significantly. Here is an example
+ of the output from a test program. It shows the rule name,
+ the first token of lookahead, the call depth, and the guess
+ status:
+
+ exit rule gusxx {"?"} depth 2
+ enter rule gusxx {"?"} depth 2
+ enter rule gus1 {"o"} depth 3 guessing
+ guess done - returning to rule gus1 {"o"} at depth 3
+ (guess mode continues - an enclosing guess is still active)
+ guess done - returning to rule gus1 {"Z"} at depth 3
+ (guess mode continues - an enclosing guess is still active)
+ exit rule gus1 {"Z"} depth 3 guessing
+ guess done - returning to rule gusxx {"o"} at depth 2 (guess mode ends)
+ enter rule gus1 {"o"} depth 3
+ guess done - returning to rule gus1 {"o"} at depth 3 (guess mode ends)
+ guess done - returning to rule gus1 {"Z"} at depth 3 (guess mode ends)
+ exit rule gus1 {"Z"} depth 3
+ line 1: syntax error at "Z" missing SC
+ ...
+
+ Rule trace reporting is controlled by the value of the integer
+ [zz]traceOptionValue: when it is positive tracing is enabled,
+ otherwise it is disabled. Tracing during guess mode is controlled
+ by the value of the integer [zz]traceGuessOptionValue. When
+ it is positive AND [zz]traceOptionValue is positive rule trace
+ is reported in guess mode.
+
+ The values of [zz]traceOptionValue and [zz]traceGuessOptionValue
+ can be adjusted by subroutine calls listed below.
+
+ Depending on the presence or absence of the antlr -gd switch
+ the variable [zz]traceOptionValueDefault is set to 0 or 1. When
+ the parser is initialized or [zz]traceReset() is called the
+ value of [zz]traceOptionValueDefault is copied to [zz]traceOptionValue.
+ The value of [zz]traceGuessOptionValue is always initialized to 1,
+ but, as noted earlier, nothing will be reported unless
+ [zz]traceOptionValue is also positive.
+
+ When the parser state is saved/restored the value of the trace
+ variables are also saved/restored. If a restore causes a change in
+ reporting behavior from on to off or vice versa this will be reported.
+
+ When the -gd option is selected, the macro "#define zzTRACE_RULES"
+ is added to appropriate output files.
+
+ C++ mode
+ --------
+ int traceOption(int delta)
+ int traceGuessOption(int delta)
+ void traceReset()
+ int traceOptionValueDefault
+
+ C mode
+ --------
+ int zzTraceOption(int delta)
+ int zzTraceGuessOption(int delta)
+ void zzTraceReset()
+ int zzTraceOptionValueDefault
+
+ The argument "delta" is added to the traceOptionValue. To
+ turn on trace when inside a particular rule one:
+
+ rule : <<traceOption(+1);>>
+ (
+ rest-of-rule
+ )
+ <<traceOption(-1);>>
+ ; /* fail clause */ <<traceOption(-1);>>
+
+ One can use the same idea to turn *off* tracing within a
+ rule by using a delta of (-1).
+
+ An improvement in the rule trace was suggested by Sramji
+ Ramanathan (ps@kumaran.com).
+
+#108. A Note on Deallocation of Variables Allocated in Guess Mode
+
+ NOTE
+ ------------------------------------------------------
+ This mechanism only works for heap allocated variables
+ ------------------------------------------------------
+
+ The rewrite of the trace provides the machinery necessary
+ to properly free variables or undo actions following a
+ failed guess.
+
+ The macro zzUSER_GUESS_HOOK(guessSeq,zzrv) is expanded
+ as part of the zzGUESS macro. When a guess is opened
+ the value of zzrv is 0. When a longjmp() is executed to
+ undo the guess, the value of zzrv will be 1.
+
+ The macro zzUSER_GUESS_DONE_HOOK(guessSeq) is expanded
+ as part of the zzGUESS_DONE macro. This is executed
+ whether the guess succeeds or fails as part of closing
+ the guess.
+
+ The guessSeq is a sequence number which is assigned to each
+ guess and is incremented by 1 for each guess which becomes
+ active. It is needed by the user to associate the start of
+ a guess with the failure and/or completion (closing) of a
+ guess.
+
+ Guesses are nested. They must be closed in the reverse
+ of the order that they are opened.
+
+ In order to free memory used by a variable during a guess
+ a user must write a routine which can be called to
+ register the variable along with the current guess sequence
+ number provided by the zzUSER_GUESS_HOOK macro. If the guess
+ fails, all variables tagged with the corresponding guess
+ sequence number should be released. This is ugly, but
+ it would require a major rewrite of antlr 1.33 to use
+ some mechanism other than setjmp()/longjmp().
+
+ The order of calls for a *successful* guess would be:
+
+ zzUSER_GUESS_HOOK(guessSeq,0);
+ zzUSER_GUESS_DONE_HOOK(guessSeq);
+
+ The order of calls for a *failed* guess would be:
+
+ zzUSER_GUESS_HOOK(guessSeq,0);
+ zzUSER_GUESS_HOOK(guessSeq,1);
+ zzUSER_GUESS_DONE_HOOK(guessSeq);
+
+ The default definitions of these macros are empty strings.
+
+ Here is an example in C++ mode. The zzUSER_GUESS_HOOK and
+ zzUSER_GUESS_DONE_HOOK macros and myGuessHook() routine
+ can be used without change in both C and C++ versions.
+
+ ----------------------------------------------------------------------
+ <<
+
+ #include "AToken.h"
+
+ typedef ANTLRCommonToken ANTLRToken;
+
+ #include "DLGLexer.h"
+
+ int main() {
+
+ {
+ DLGFileInput in(stdin);
+ DLGLexer lexer(&in,2000);
+ ANTLRTokenBuffer pipe(&lexer,1);
+ ANTLRCommonToken aToken;
+ P parser(&pipe);
+
+ lexer.setToken(&aToken);
+ parser.init();
+ parser.start();
+ };
+
+ fclose(stdin);
+ fclose(stdout);
+ return 0;
+ }
+
+ >>
+
+ <<
+ char *s=NULL;
+
+ #undef zzUSER_GUESS_HOOK
+ #define zzUSER_GUESS_HOOK(guessSeq,zzrv) myGuessHook(guessSeq,zzrv);
+ #undef zzUSER_GUESS_DONE_HOOK
+ #define zzUSER_GUESS_DONE_HOOK(guessSeq) myGuessHook(guessSeq,2);
+
+ void myGuessHook(int guessSeq,int zzrv) {
+ if (zzrv == 0) {
+ fprintf(stderr,"User hook: starting guess #%d\n",guessSeq);
+ } else if (zzrv == 1) {
+ free (s);
+ s=NULL;
+ fprintf(stderr,"User hook: failed guess #%d\n",guessSeq);
+ } else if (zzrv == 2) {
+ free (s);
+ s=NULL;
+ fprintf(stderr,"User hook: ending guess #%d\n",guessSeq);
+ };
+ }
+
+ >>
+
+ #token A "a"
+ #token "[\t \ \n]" <<skip();>>
+
+ class P {
+
+ start : (top)+
+ ;
+
+ top : (which) ? <<fprintf(stderr,"%s is a which\n",s); free(s); s=NULL; >>
+ | other <<fprintf(stderr,"%s is an other\n",s); free(s); s=NULL; >>
+ ; <<if (s != NULL) free(s); s=NULL; >>
+
+ which : which2
+ ;
+
+ which2 : which3
+ ;
+ which3
+ : (label)? <<fprintf(stderr,"%s is a label\n",s);>>
+ | (global)? <<fprintf(stderr,"%s is a global\n",s);>>
+ | (exclamation)? <<fprintf(stderr,"%s is an exclamation\n",s);>>
+ ;
+
+ label : <<s=strdup(LT(1)->getText());>> A ":" ;
+
+ global : <<s=strdup(LT(1)->getText());>> A "::" ;
+
+ exclamation : <<s=strdup(LT(1)->getText());>> A "!" ;
+
+ other : <<s=strdup(LT(1)->getText());>> "other" ;
+
+ }
+ ----------------------------------------------------------------------
+
+ This is a silly example, but illustrates the idea. For the input
+ "a ::" with tracing enabled the output begins:
+
+ ----------------------------------------------------------------------
+ enter rule "start" depth 1
+ enter rule "top" depth 2
+ User hook: starting guess #1
+ enter rule "which" depth 3 guessing
+ enter rule "which2" depth 4 guessing
+ enter rule "which3" depth 5 guessing
+ User hook: starting guess #2
+ enter rule "label" depth 6 guessing
+ guess failed
+ User hook: failed guess #2
+ guess done - returning to rule "which3" at depth 5 (guess mode continues
+ - an enclosing guess is still active)
+ User hook: ending guess #2
+ User hook: starting guess #3
+ enter rule "global" depth 6 guessing
+ exit rule "global" depth 6 guessing
+ guess done - returning to rule "which3" at depth 5 (guess mode continues
+ - an enclosing guess is still active)
+ User hook: ending guess #3
+ enter rule "global" depth 6 guessing
+ exit rule "global" depth 6 guessing
+ exit rule "which3" depth 5 guessing
+ exit rule "which2" depth 4 guessing
+ exit rule "which" depth 3 guessing
+ guess done - returning to rule "top" at depth 2 (guess mode ends)
+ User hook: ending guess #1
+ enter rule "which" depth 3
+ .....
+ ----------------------------------------------------------------------
+
+ Remember:
+
+ (a) Only init-actions are executed during guess mode.
+ (b) A rule can be invoked multiple times during guess mode.
+ (c) If the guess succeeds the rule will be called once more
+ without guess mode so that normal actions will be executed.
+ This means that the init-action might need to distinguish
+ between guess mode and non-guess mode using the variable
+ [zz]guessing.
+
+#107. (Changed in 1.33MR10) construction of ASTs in guess mode
+
+ Prior to 1.33MR10, when using automatic AST construction in C++
+ mode for a rule, an AST would be constructed for elements of the
+ rule even while in guess mode. In MR10 this no longer occurs.
+
+#106. (Changed in 1.33MR10) guess variable confusion
+
+ In C++ mode a guess which failed always restored the parser state
+ using zzGUESS_DONE as part of zzGUESS_FAIL. Prior to 1.33MR10,
+ C mode required an explicit call to zzGUESS_DONE after the
+ call to zzGUESS_FAIL.
+
+ Consider:
+
+ rule : (alpha)? beta
+ | ...
+ ;
+
+ The generated code resembles:
+
+ zzGUESS
+ if (!zzrv && LA(1)==ID) { <==== line #1
+ alpha
+ zzGUESS_DONE
+ beta
+ } else {
+ if (! zzrv) zzGUESS_DONE <==== line #2a
+ ....
+
+ However, in some cases line #2 was rendered:
+
+ if (guessing) zzGUESS_DONE <==== line #2b
+
+ This would work for simple test cases, but would fail in
+ some cases where there was a guess while another guess was active.
+ One kind of failure would be to match up the zzGUESS_DONE at line
+ #2b with the "outer" guess which was still active. The outer
+ guess would "succeed" when only the inner guess should have
+ succeeded.
+
+ In 1.33MR10 the behavior of zzGUESS and zzGUESS_FAIL in C and
+ and C++ mode should be identical.
+
+ The same problem appears in 1.33 vanilla in some places. For
+ example:
+
+ start : { (sub)? } ;
+
+ or:
+
+ start : (
+ B
+ | ( sub )?
+ | C
+ )+
+ ;
+
+ generates incorrect code.
+
+ The general principle is:
+
+ (a) use [zz]guessing only when deciding between a call to zzFAIL
+ or zzGUESS_FAIL
+
+ (b) use zzrv in all other cases
+
+ This problem was discovered while testing changes to item #105.
+ I believe this is now fixed. My apologies.
+
+#105. (Changed in 1.33MR10) guess block as single alt of (...)+
+
+ Prior to 1.33MR10 the following constructs:
+
+ rule_plus : (
+ (sub)?
+ )+
+ ;
+
+ rule_star : (
+ (sub)?
+ )*
+ ;
+
+ generated incorrect code for the guess block (which could result
+ in runtime errors) because of an incorrect optimization of a
+ block with only a single alternative.
+
+ The fix caused some changes to the fix described in Item #49
+ because there are now three code generation sequences for (...)+
+ blocks containing a guess block:
+
+ a. single alternative which is a guess block
+ b. multiple alternatives in which the last is a guess block
+ c. all other cases
+
+ Forms like "rule_star" can have unexpected behavior when there
+ is a syntax error: if the subrule "sub" is not matched *exactly*
+ then "rule_star" will consume no tokens.
+
+ Reported by Esa Pulkkinen (esap@cs.tut.fi).
+
+#104. (Changed in 1.33MR10) -o option for dlg
+
+ There was problem with the code added by item #74 to handle the
+ -o option of dlg. This should fix it.
+
+#103. (Changed in 1.33MR10) ANDed semantic predicates
+
+ Rescinded.
+
+ The optimization was a mistake.
+ The resulting problem is described in Item #150.
+
+#102. (Changed in 1.33MR10) allow "class parser : .... {"
+
+ The syntax of the class statement ("class parser-name {")
+ has been extended to allow for the specification of base
+ classes. An arbitrary number of tokens may now appear
+ between the class name and the "{". They are output
+ again when the class declaration is generated. For
+ example:
+
+ class Parser : public MyBaseClassANTLRparser {
+
+ This was suggested by a user, but I don't have a record
+ of who it was.
+
+#101. (Changed in 1.33MR10) antlr -info command line switch
+
+ -info
+
+ p - extra predicate information in generated file
+
+ t - information about tnode use:
+ at the end of each rule in generated file
+ summary on stderr at end of program
+
+ m - monitor progress
+ prints name of each rule as it is started
+ flushes output at start of each rule
+
+ f - first/follow set information to stdout
+
+ 0 - no operation (added in 1.33MR11)
+
+ The options may be combined and may appear in any order.
+ For example:
+
+ antlr -info ptm -CC -gt -mrhoist on mygrammar.g
+
+#100a. (Changed in 1.33MR10) Predicate tree simplification
+
+ When the same predicates can be referenced in more than one
+ alternative of a block large predicate trees can be formed.
+
+ The difference that these optimizations make is so dramatic
+ that I have decided to use it even when -mrhoist is not selected.
+
+ Consider the following grammar:
+
+ start : ( all )* ;
+
+ all : a
+ | d
+ | e
+ | f
+ ;
+
+ a : c A B
+ | c A C
+ ;
+
+ c : <<AAA(LATEXT(2))>>?
+ ;
+
+ d : <<BBB(LATEXT(2))>>? B C
+ ;
+
+ e : <<CCC(LATEXT(2))>>? B C
+ ;
+
+ f : e X Y
+ ;
+
+ In rule "a" there is a reference to rule "c" in both alternatives.
+ The length of the predicate AAA is k=2 and it can be followed in
+ alternative 1 only by (A B) while in alternative 2 it can be
+ followed only by (A C). Thus they do not have identical context.
+
+ In rule "all" the alternatives which refer to rules "e" and "f" allow
+ elimination of the duplicate reference to predicate CCC.
+
+ The table below summarized the kind of simplification performed by
+ 1.33MR10. In the table, X and Y stand for single predicates
+ (not trees).
+
+ (OR X (OR Y (OR Z))) => (OR X Y Z)
+ (AND X (AND Y (AND Z))) => (AND X Y Z)
+
+ (OR X (... (OR X Y) ... )) => (OR X (... Y ... ))
+ (AND X (... (AND X Y) ... )) => (AND X (... Y ... ))
+ (OR X (... (AND X Y) ... )) => (OR X (... ... ))
+ (AND X (... (OR X Y) ... )) => (AND X (... ... ))
+
+ (AND X) => X
+ (OR X) => X
+
+ In a test with a complex grammar for a real application, a predicate
+ tree with six OR nodes and 12 leaves was reduced to "(OR X Y Z)".
+
+ In 1.33MR10 there is a greater effort to release memory used
+ by predicates once they are no longer in use.
+
+#100b. (Changed in 1.33MR10) Suppression of extra predicate tests
+
+ The following optimizations require that -mrhoist be selected.
+
+ It is relatively easy to optimize the code generated for predicate
+ gates when they are of the form:
+
+ (AND X Y Z ...)
+ or (OR X Y Z ...)
+
+ where X, Y, Z, and "..." represent individual predicates (leaves) not
+ predicate trees.
+
+ If the predicate is an AND the contexts of the X, Y, Z, etc. are
+ ANDed together to create a single Tree context for the group and
+ context tests for the individual predicates are suppressed:
+
+ --------------------------------------------------
+ Note: This was incorrect. The contexts should be
+ ORed together. This has been fixed. A more
+ complete description is available in item #152.
+ ---------------------------------------------------
+
+ Optimization 1: (AND X Y Z ...)
+
+ Suppose the context for Xtest is LA(1)==LP and the context for
+ Ytest is LA(1)==LP && LA(2)==ID.
+
+ Without the optimization the code would resemble:
+
+ if (lookaheadContext &&
+ !(LA(1)==LP && LA(1)==LP && LA(2)==ID) ||
+ ( (! LA(1)==LP || Xtest) &&
+ (! (LA(1)==LP || LA(2)==ID) || Xtest)
+ )) {...
+
+ With the -mrhoist optimization the code would resemble:
+
+ if (lookaheadContext &&
+ ! (LA(1)==LP && LA(2)==ID) || (Xtest && Ytest) {...
+
+ Optimization 2: (OR X Y Z ...) with identical contexts
+
+ Suppose the context for Xtest is LA(1)==ID and for Ytest
+ the context is also LA(1)==ID.
+
+ Without the optimization the code would resemble:
+
+ if (lookaheadContext &&
+ ! (LA(1)==ID || LA(1)==ID) ||
+ (LA(1)==ID && Xtest) ||
+ (LA(1)==ID && Ytest) {...
+
+ With the -mrhoist optimization the code would resemble:
+
+ if (lookaheadContext &&
+ (! LA(1)==ID) || (Xtest || Ytest) {...
+
+ Optimization 3: (OR X Y Z ...) with distinct contexts
+
+ Suppose the context for Xtest is LA(1)==ID and for Ytest
+ the context is LA(1)==LP.
+
+ Without the optimization the code would resemble:
+
+ if (lookaheadContext &&
+ ! (LA(1)==ID || LA(1)==LP) ||
+ (LA(1)==ID && Xtest) ||
+ (LA(1)==LP && Ytest) {...
+
+ With the -mrhoist optimization the code would resemble:
+
+ if (lookaheadContext &&
+ (zzpf=0,
+ (LA(1)==ID && (zzpf=1) && Xtest) ||
+ (LA(1)==LP && (zzpf=1) && Ytest) ||
+ !zzpf) {
+
+ These may appear to be of similar complexity at first,
+ but the non-optimized version contains two tests of each
+ context while the optimized version contains only one
+ such test, as well as eliminating some of the inverted
+ logic (" !(...) || ").
+
+ Optimization 4: Computation of predicate gate trees
+
+ When generating code for the gates of predicate expressions
+ antlr 1.33 vanilla uses a recursive procedure to generate
+ "&&" and "||" expressions for testing the lookahead. As each
+ layer of the predicate tree is exposed a new set of "&&" and
+ "||" expressions on the lookahead are generated. In many
+ cases the lookahead being tested has already been tested.
+
+ With -mrhoist a lookahead tree is computed for the entire
+ lookahead expression. This means that predicates with identical
+ context or context which is a subset of another predicate's
+ context disappear.
+
+ This is especially important for predicates formed by rules
+ like the following:
+
+ upperCaseVowel : <<isUpperCase(LATEXT(1))>>? vowel;
+ vowel: : <<isVowel(LATEXT(1))>>? LETTERS;
+
+ These predicates are combined using AND since both must be
+ satisfied for rule upperCaseVowel. They have identical
+ context which makes this optimization very effective.
+
+ The affect of Items #100a and #100b together can be dramatic. In
+ a very large (but real world) grammar one particular predicate
+ expression was reduced from an (unreadable) 50 predicate leaves,
+ 195 LA(1) terms, and 5500 characters to an (easily comprehensible)
+ 3 predicate leaves (all different) and a *single* LA(1) term.
+
+#99. (Changed in 1.33MR10) Code generation for expression trees
+
+ Expression trees are used for k>1 grammars and predicates with
+ lookahead depth >1. This optimization must be enabled using
+ "-mrhoist on". (Clarification added for 1.33MR11).
+
+ In the processing of expression trees, antlr can generate long chains
+ of token comparisons. Prior to 1.33MR10 there were many redundant
+ parenthesis which caused problems for compilers which could handle
+ expressions of only limited complexity. For example, to test an
+ expression tree (root R A B C D), antlr would generate something
+ resembling:
+
+ (LA(1)==R && (LA(2)==A || (LA(2)==B || (LA(2)==C || LA(2)==D)))))
+
+ If there were twenty tokens to test then there would be twenty
+ parenthesis at the end of the expression.
+
+ In 1.33MR10 the generated code for tree expressions resembles:
+
+ (LA(1)==R && (LA(2)==A || LA(2)==B || LA(2)==C || LA(2)==D))
+
+ For "complex" expressions the output is indented to reflect the LA
+ number being tested:
+
+ (LA(1)==R
+ && (LA(2)==A || LA(2)==B || LA(2)==C || LA(2)==D
+ || LA(2)==E || LA(2)==F)
+ || LA(1)==S
+ && (LA(2)==G || LA(2)==H))
+
+
+ Suggested by S. Bochnak (S.Bochnak@@microTool.com.pl),
+
+#98. (Changed in 1.33MR10) Option "-info p"
+
+ When the user selects option "-info p" the program will generate
+ detailed information about predicates. If the user selects
+ "-mrhoist on" additional detail will be provided explaining
+ the promotion and suppression of predicates. The output is part
+ of the generated file and sandwiched between #if 0/#endif statements.
+
+ Consider the following k=1 grammar:
+
+ start : ( all ) * ;
+
+ all : ( a
+ | b
+ )
+ ;
+
+ a : c B
+ ;
+
+ c : <<LATEXT(1)>>?
+ | B
+ ;
+
+ b : <<LATEXT(1)>>? X
+ ;
+
+ Below is an excerpt of the output for rule "start" for the three
+ predicate options (off, on, and maintenance release style hoisting).
+
+ For those who do not wish to use the "-mrhoist on" option for code
+ generation the option can be used in a "diagnostic" mode to provide
+ valuable information:
+
+ a. where one should insert null actions to inhibit hoisting
+ b. a chain of rule references which shows where predicates are
+ being hoisted
+
+ ======================================================================
+ Example of "-info p" with "-mrhoist on"
+ ======================================================================
+ #if 0
+
+ Hoisting of predicate suppressed by alternative without predicate.
+ The alt without the predicate includes all cases where the
+ predicate is false.
+
+ WITH predicate: line 11 v36.g
+ WITHOUT predicate: line 12 v36.g
+
+ The context set for the predicate:
+
+ B
+
+ The lookahead set for alt WITHOUT the semantic predicate:
+
+ B
+
+ The predicate:
+
+ pred << LATEXT(1)>>? depth=k=1 rule c line 11 v36.g
+
+ set context:
+ B
+ tree context: null
+
+ Chain of referenced rules:
+
+ #0 in rule start (line 1 v36.g) to rule all
+ #1 in rule all (line 3 v36.g) to rule a
+ #2 in rule a (line 8 v36.g) to rule c
+ #3 in rule c (line 11 v36.g)
+
+ #endif
+ &&
+ #if 0
+
+ pred << LATEXT(1)>>? depth=k=1 rule b line 15 v36.g
+
+ set context:
+ X
+ tree context: null
+
+ #endif
+ ======================================================================
+ Example of "-info p" with the default -prc setting ( "-prc off")
+ ======================================================================
+ #if 0
+
+ OR
+ pred << LATEXT(1)>>? depth=k=1 rule c line 11 v36.g
+
+ set context:
+ nil
+ tree context: null
+
+ pred << LATEXT(1)>>? depth=k=1 rule b line 15 v36.g
+
+ set context:
+ nil
+ tree context: null
+
+ #endif
+ ======================================================================
+ Example of "-info p" with "-prc on" and "-mrhoist off"
+ ======================================================================
+ #if 0
+
+ OR
+ pred << LATEXT(1)>>? depth=k=1 rule c line 11 v36.g
+
+ set context:
+ B
+ tree context: null
+
+ pred << LATEXT(1)>>? depth=k=1 rule b line 15 v36.g
+
+ set context:
+ X
+ tree context: null
+
+ #endif
+ ======================================================================
+
+#97. (Fixed in 1.33MR10) "Predicate applied for more than one ... "
+
+ In 1.33 vanilla, the grammar listed below produced this message for
+ the first alternative (only) of rule "b":
+
+ warning: predicate applied for >1 lookahead 1-sequences
+ [you may only want one lookahead 1-sequence to apply.
+ Try using a context guard '(...)? =>'
+
+ In 1.33MR10 the message is issued for both alternatives.
+
+ top : (a)*;
+ a : b | c ;
+
+ b : <<PPP(LATEXT(1))>>? ( AAA | BBB )
+ | <<QQQ(LATEXT(1))>>? ( XXX | YYY )
+ ;
+
+ c : AAA | XXX;
+
+#96. (Fixed in 1.33MR10) Guard predicates ignored when -prc off
+
+ Prior to 1.33MR10, guard predicate code was not generated unless
+ "-prc on" was selected.
+
+ This was incorrect, since "-prc off" (the default) is supposed to
+ disable only AUTOMATIC computation of predicate context, not the
+ programmer specified context supplied by guard predicates.
+
+#95. (Fixed in 1.33MR10) Predicate guard context length was k, not max(k,ck)
+
+ Prior to 1.33MR10, predicate guards were computed to k tokens rather
+ than max(k,ck). Consider the following grammar:
+
+ a : ( A B C)? => <<AAA(LATEXT(1))>>? (A|X) (B|Y) (C|Z) ;
+
+ The code generated by 1.33 vanilla with "-k 1 -ck 3 -prc on"
+ for the predicate in "a" resembles:
+
+ if ( (! LA(1)==A) || AAA(LATEXT(1))) {...
+
+ With 1.33MR10 and the same options the code resembles:
+
+ if ( (! (LA(1)==A && LA(2)==B && LA(3)==C) || AAA(LATEXT(1))) {...
+
+#94. (Fixed in 1.33MR10) Predicates followed by rule references
+
+ Prior to 1.33MR10, a semantic predicate which referenced a token
+ which was off the end of the rule caused an incomplete context
+ to be computed (with "-prc on") for the predicate under some circum-
+ stances. In some cases this manifested itself as illegal C code
+ (e.g. "LA(2)==[Ep](1)" in the k=2 examples below:
+
+ all : ( a ) *;
+
+ a : <<AAA(LATEXT(2))>>? ID X
+ | <<BBB(LATEXT(2))>>? Y
+ | Z
+ ;
+
+ This might also occur when the semantic predicate was followed
+ by a rule reference which was shorter than the length of the
+ semantic predicate:
+
+ all : ( a ) *;
+
+ a : <<AAA(LATEXT(2))>>? ID X
+ | <<BBB(LATEXT(2))>>? y
+ | Z
+ ;
+
+ y : Y ;
+
+ Depending on circumstance, the resulting context might be too
+ generous because it was too short, or too restrictive because
+ of missing alternatives.
+
+#93. (Changed in 1.33MR10) Definition of Purify macro
+
+ Ofer Ben-Ami (gremlin@cs.huji.ac.il) has supplied a definition
+ for the Purify macro:
+
+ #define PURIFY(r, s) memset((char *) &(r), '\0', (s));
+
+ Note: This may not be the right thing to do for C++ objects that
+ have constructors. Reported by Bonny Rais (bonny@werple.net.au).
+
+ For those cases one should #define PURIFY to an empty macro in the
+ #header or #first actions.
+
+#92. (Fixed in 1.33MR10) Guarded predicates and hoisting
+
+ When a guarded predicate participates in hoisting it is linked into
+ a predicate expression tree. Prior to 1.33MR10 this link was never
+ cleared and the next time the guard was used to construct a new
+ tree the link could contain a spurious reference to another element
+ which had previously been joined to it in the semantic predicate tree.
+
+ For example:
+
+ start : ( all ) *;
+ all : ( a | b ) ;
+
+ start2 : ( all2 ) *;
+ all2 : ( a ) ;
+
+ a : (A)? => <<AAA(LATEXT(1))>>? A ;
+ b : (B)? => <<BBB(LATEXT(1))>>? B ;
+
+ Prior to 1.33MR10 the code for "start2" would include a spurious
+ reference to the BBB predicate which was left from constructing
+ the predicate tree for rule "start" (i.e. or(AAA,BBB) ).
+
+ In 1.33MR10 this problem is avoided by cloning the original guard
+ each time it is linked into a predicate tree.
+
+#91. (Changed in 1.33MR10) Extensive changes to semantic pred hoisting
+
+ ============================================
+ This has been rendered obsolete by Item #117
+ ============================================
+
+#90. (Fixed in 1.33MR10) Semantic pred with LT(i) and i>max(k,ck)
+
+ There is a bug in antlr 1.33 vanilla and all maintenance releases
+ prior to 1.33MR10 which allows semantic predicates to reference
+ an LT(i) or LATEXT(i) where i is larger than max(k,ck). When
+ this occurs antlr will attempt to mark the ith element of an array
+ in which there are only max(k,ck) elements. The result cannot
+ be predicted.
+
+ Using LT(i) or LATEXT(i) for i>max(k,ck) is reported as an error
+ in 1.33MR10.
+
+#89. Rescinded
+
+#88. (Fixed in 1.33MR10) Tokens used in semantic predicates in guess mode
+
+ Consider the behavior of a semantic predicate during guess mode:
+
+ rule : a:A (
+ <<test($a)>>? b:B
+ | c:C
+ );
+
+ Prior to MR10 the assignment of the token or attribute to
+ $a did not occur during guess mode, which would cause the
+ semantic predicate to misbehave because $a would be null.
+
+ In 1.33MR10 a semantic predicate with a reference to an
+ element label (such as $a) forces the assignment to take
+ place even in guess mode.
+
+ In order to work, this fix REQUIRES use of the $label format
+ for token pointers and attributes referenced in semantic
+ predicates.
+
+ The fix does not apply to semantic predicates using the
+ numeric form to refer to attributes (e.g. <<test($1)>>?).
+ The user will receive a warning for this case.
+
+ Reported by Rob Trout (trout@mcs.cs.kent.edu).
+
+#87. (Fixed in 1.33MR10) Malformed guard predicates
+
+ Context guard predicates may contain only references to
+ tokens. They may not contain references to (...)+ and
+ (...)* blocks. This is now checked. This replaces the
+ fatal error message in item #78 with an appropriate
+ (non-fatal) error message.
+
+ In theory, context guards should be allowed to reference
+ rules. However, I have not had time to fix this.
+ Evaluation of the guard takes place before all rules have
+ been read, making it difficult to resolve a forward reference
+ to rule "zzz" - it hasn't been read yet ! To postpone evaluation
+ of the guard until all rules have been read is too much
+ for the moment.
+
+#86. (Fixed in 1.33MR10) Unequal set size in set_sub
+
+ Routine set_sub() in pccts/support/set/set.h did not work
+ correctly when the sets were of unequal sizes. Rewrote
+ set_equ to make it simpler and remove unnecessary and
+ expensive calls to set_deg(). This routine was not used
+ in 1.33 vanilla.
+
+#85. (Changed in 1.33MR10) Allow redefinition of MaxNumFiles
+
+ Raised the maximum number of input files to 99 from 20.
+ Put a #ifndef/#endif around the "#define MaxNumFiles 99".
+
+#84. (Fixed in 1.33MR10) Initialize zzBadTok in macro zzRULE
+
+ Initialize zzBadTok to NULL in zzRULE macro of AParser.h.
+ in order to get rid of warning messages.
+
+#83. (Fixed in 1.33MR10) False warnings with -w2 for #tokclass
+
+ When -w2 is selected antlr gives inappropriate warnings about
+ #tokclass names not having any associated regular expressions.
+ Since a #tokclass is not a "real" token it will never have an
+ associated regular expression and there should be no warning.
+
+ Reported by Derek Pappas (derek.pappas@eng.sun.com)
+
+#82. (Fixed in 1.33MR10) Computation of follow sets with multiple cycles
+
+ Reinier van den Born (reinier@vnet.ibm.com) reported a problem
+ in the computation of follow sets by antlr. The problem (bug)
+ exists in 1.33 vanilla and all maintenance releases prior to 1.33MR10.
+
+ The problem involves the computation of follow sets when there are
+ cycles - rules which have mutual references. I believe the problem
+ is restricted to cases where there is more than one cycle AND
+ elements of those cycles have rules in common. Even when this
+ occurs it may not affect the code generated - but it might. It
+ might also lead to undetected ambiguities.
+
+ There were no changes in antlr or dlg output from the revised version.
+
+ The following fragment demonstrates the problem by giving different
+ follow sets (option -pa) for var_access when built with k=1 and ck=2 on
+ 1.33 vanilla and 1.33MR10:
+
+ echo_statement : ECHO ( echo_expr )*
+ ;
+
+ echo_expr : ( command )?
+ | expression
+ ;
+
+ command : IDENTIFIER
+ { concat }
+ ;
+
+ expression : operand ( OPERATOR operand )*
+ ;
+
+ operand : value
+ | START command END
+ ;
+
+ value : concat
+ | TYPE operand
+ ;
+
+ concat : var_access { CONCAT value }
+ ;
+
+ var_access : IDENTIFIER { INDEX }
+
+ ;
+#81. (Changed in 1.33MR10) C mode use of attributes and ASTs
+
+ Reported by Isaac Clark (irclark@mindspring.com).
+
+ C mode code ignores attributes returned by rules which are
+ referenced using element labels when ASTs are enabled (-gt option).
+
+ 1. start : r:rule t:Token <<$start=$r;>>
+
+ The $r reference will not work when combined with
+ the -gt option.
+
+ 2. start : t:Token <<$start=$t;>>
+
+ The $t reference works in all cases.
+
+ 3. start : rule <<$0=$1;>>
+
+ Numeric labels work in all cases.
+
+ With MR10 the user will receive an error message for case 1 when
+ the -gt option is used.
+
+#80. (Fixed in 1.33MR10) (...)? as last alternative of block
+
+ A construct like the following:
+
+ rule : a
+ | (b)?
+ ;
+
+ does not make sense because there is no alternative when
+ the guess block fails. This is now reported as a warning
+ to the user.
+
+ Previously, there was a code generation error for this case:
+ the guess block was not "closed" when the guess failed.
+ This could cause an infinite loop or other problems. This
+ is now fixed.
+
+ Example problem:
+
+ #header<<
+ #include <stdio.h>
+ #include "charptr.h"
+ >>
+
+ <<
+ #include "charptr.c"
+ main ()
+ {
+ ANTLR(start(),stdin);
+ }
+ >>
+
+ #token "[\ \t]+" << zzskip(); >>
+ #token "[\n]" << zzline++; zzskip(); >>
+
+ #token Word "[a-z]+"
+ #token Number "[0-9]+"
+
+
+ start : (test1)?
+ | (test2)?
+ ;
+ test1 : (Word Word Word Word)?
+ | (Word Word Word Number)?
+ ;
+ test2 : (Word Word Number Word)?
+ | (Word Word Number Number)?
+ ;
+
+ Test data which caused infinite loop:
+
+ a 1 a a
+
+#79. (Changed in 1.33MR10) Use of -fh with multiple parsers
+
+ Previously, antlr always used the pre-processor symbol
+ STDPCCTS_H as a gate for the file stdpccts.h. This
+ caused problems when there were multiple parsers defined
+ because they used the same gate symbol.
+
+ In 1.33MR10, the -fh filename is used to generate the
+ gate file for stdpccts.h. For instance:
+
+ antlr -fh std_parser1.h
+
+ generates the pre-processor symbol "STDPCCTS_std_parser1_H".
+
+ Reported by Ramanathan Santhanam (ps@kumaran.com).
+
+#78. (Changed in 1.33MR9) Guard predicates that refer to rules
+
+ ------------------------
+ Please refer to Item #87
+ ------------------------
+
+ Guard predicates are processed during an early phase
+ of antlr (during parsing) before all data structures
+ are completed.
+
+ There is an apparent bug in earlier versions of 1.33
+ which caused guard predicates which contained references
+ to rules (rather than tokens) to reference a structure
+ which hadn't yet been initialized.
+
+ In some cases (perhaps all cases) references to rules
+ in guard predicates resulted in the use of "garbage".
+
+#79. (Changed in 1.33MR9) Jeff Vincent (JVincent@novell.com)
+
+ Previously, the maximum length file name was set
+ arbitrarily to 300 characters in antlr, dlg, and sorcerer.
+
+ The config.h file now attempts to define the maximum length
+ filename using _MAX_PATH from stdlib.h before falling back
+ to using the value 300.
+
+#78. (Changed in 1.33MR9) Jeff Vincent (JVincent@novell.com)
+
+ Put #ifndef/#endif around definition of ZZLEXBUFSIZE in
+ antlr.
+
+#77. (Changed in 1.33MR9) Arithmetic overflow for very large grammars
+
+ In routine HandleAmbiguities() antlr attempts to compute the
+ number of possible elements in a set that is order of
+ number-of-tokens raised to the number-of-lookahead-tokens power.
+ For large grammars or large lookahead (e.g. -ck 7) this can
+ cause arithmetic overflow.
+
+ With 1.33MR9, arithmetic overflow in this computation is reported
+ the first time it happens. The program continues to run and
+ the program branches based on the assumption that the computed
+ value is larger than any number computed by counting actual cases
+ because 2**31 is larger than the number of bits in most computers.
+
+ Before 1.33MR9 overflow was not reported. The behavior following
+ overflow is not predictable by anyone but the original author.
+
+ NOTE
+
+ In 1.33MR10 the warning message is suppressed.
+ The code which detects the overflow allows the
+ computation to continue without an error. The
+ error message itself made made users worry.
+
+#76. (Changed in 1.33MR9) Jeff Vincent (JVincent@novell.com)
+
+ Jeff Vincent has convinced me to make ANTLRCommonToken and
+ ANTLRCommonNoRefCountToken use variable length strings
+ allocated from the heap rather than fixed length strings.
+ By suitable definition of setText(), the copy constructor,
+ and operator =() it is possible to maintain "copy" semantics.
+ By "copy" semantics I mean that when a token is copied from
+ an existing token it receives its own, distinct, copy of the
+ text allocated from the heap rather than simply a pointer
+ to the original token's text.
+
+ ============================================================
+ W * A * R * N * I * N * G
+ ============================================================
+
+ It is possible that this may cause problems for some users.
+ For those users I have included the old version of AToken.h as
+ pccts/h/AToken_traditional.h.
+
+#75. (Changed in 1.33MR9) Bruce Guenter (bruceg@qcc.sk.ca)
+
+ Make DLGStringInput const correct. Since this is infrequently
+ subclassed, it should affect few users, I hope.
+
+#74. (Changed in 1.33MR9) -o (output directory) option
+
+ Antlr does not properly handle the -o output directory option
+ when the filename of the grammar contains a directory part. For
+ example:
+
+ antlr -o outdir pccts_src/myfile.g
+
+ causes antlr create a file called "outdir/pccts_src/myfile.cpp.
+ It SHOULD create outdir/myfile.cpp
+
+ The suggested code fix has been installed in antlr, dlg, and
+ Sorcerer.
+
+#73. (Changed in 1.33MR9) Hoisting of semantic predicates and -mrhoist
+
+ ============================================
+ This has been rendered obsolete by Item #117
+ ============================================
+
+#72. (Changed in 1.33MR9) virtual saveState()/restoreState()/guess_XXX
+
+ The following methods in ANTLRParser were made virtual at
+ the request of S. Bochnak (S.Bochnak@microTool.com.pl):
+
+ saveState() and restoreState()
+ guess(), guess_fail(), and guess_done()
+
+#71. (Changed in 1.33MR9) Access to omitted command line argument
+
+ If a switch requiring arguments is the last thing on the
+ command line, and the argument is omitted, antlr would core.
+
+ antlr test.g -prc
+
+ instead of
+
+ antlr test.g -prc off
+
+#70. (Changed in 1.33MR9) Addition of MSVC .dsp and .mak build files
+
+ The following MSVC .dsp and .mak files for pccts and sorcerer
+ were contributed by Stanislaw Bochnak (S.Bochnak@microTool.com.pl)
+ and Jeff Vincent (JVincent@novell.com)
+
+ PCCTS Distribution Kit
+ ----------------------
+ pccts/PCCTSMSVC50.dsw
+
+ pccts/antlr/AntlrMSVC50.dsp
+ pccts/antlr/AntlrMSVC50.mak
+
+ pccts/dlg/DlgMSVC50.dsp
+ pccts/dlg/DlgMSVC50.mak
+
+ pccts/support/msvc.dsp
+
+ Sorcerer Distribution Kit
+ -------------------------
+ pccts/sorcerer/SorcererMSVC50.dsp
+ pccts/sorcerer/SorcererMSVC50.mak
+
+ pccts/sorcerer/lib/msvc.dsp
+
+#69. (Changed in 1.33MR9) Change "unsigned int" to plain "int"
+
+ Declaration of max_token_num in misc.c as "unsigned int"
+ caused comparison between signed and unsigned ints giving
+ warning message without any special benefit.
+
+#68. (Changed in 1.33MR9) Add void return for dlg internal_error()
+
+ Get rid of "no return value" message in internal_error()
+ in file dlg/support.c and dlg/dlg.h.
+
+#67. (Changed in Sor) sor.g: lisp() has no return value
+
+ Added a "void" for the return type.
+
+#66. (Added to Sor) sor.g: ZZLEXBUFSIZE enclosed in #ifndef/#endif
+
+ A user needed to be able to change the ZZLEXBUFSIZE for
+ sor. Put the definition of ZZLEXBUFSIZE inside #ifndef/#endif
+
+#65. (Changed in 1.33MR9) PCCTSAST::deepCopy() and ast_dup() bug
+
+ Jeff Vincent (JVincent@novell.com) found that deepCopy()
+ made new copies of only the direct descendents. No new
+ copies were made of sibling nodes, Sibling pointers are
+ set to zero by shallowCopy().
+
+ PCCTS_AST::deepCopy() has been changed to make a
+ deep copy in the traditional sense.
+
+ The deepCopy() routine depends on the behavior of
+ shallowCopy(). In all sor examples I've found,
+ shallowCopy() zeroes the right and down pointers.
+
+ Original Tree Original deepCopy() Revised deepCopy
+ ------------- ------------------- ----------------
+ a->b->c A A
+ | | |
+ d->e->f D D->E->F
+ | | |
+ g->h->i G G->H->I
+ | |
+ j->k J->K
+
+ While comparing deepCopy() for C++ mode with ast_dup for
+ C mode I found a problem with ast_dup().
+
+ Routine ast_dup() has been changed to make a deep copy
+ in the traditional sense.
+
+ Original Tree Original ast_dup() Revised ast_dup()
+ ------------- ------------------- ----------------
+ a->b->c A->B->C A
+ | | |
+ d->e->f D->E->F D->E->F
+ | | |
+ g->h->i G->H->I G->H->I
+ | | |
+ j->k J->K J->K
+
+
+ I believe this affects transform mode sorcerer programs only.
+
+#64. (Changed in 1.33MR9) anltr/hash.h prototype for killHashTable()
+
+#63. (Changed in 1.33MR8) h/charptr.h does not zero pointer after free
+
+ The charptr.h routine now zeroes the pointer after free().
+
+ Reported by Jens Tingleff (jensting@imaginet.fr)
+
+#62. (Changed in 1.33MR8) ANTLRParser::resynch had static variable
+
+ The static variable "consumed" in ANTLRParser::resynch was
+ changed into an instance variable of the class with the
+ name "resynchConsumed".
+
+ Reported by S.Bochnak@microTool.com.pl
+
+#61. (Changed in 1.33MR8) Using rule>[i,j] when rule has no return values
+
+ Previously, the following code would cause antlr to core when
+ it tried to generate code for rule1 because rule2 had no return
+ values ("upward inheritance"):
+
+ rule1 : <<int i; int j>>
+ rule2 > [i,j]
+ ;
+
+ rule2 : Anything ;
+
+ Reported by S.Bochnak@microTool.com.pl
+
+ Verified correct operation of antlr MR8 when missing or extra
+ inheritance arguments for all combinations. When there are
+ missing or extra arguments code will still be generated even
+ though this might cause the invocation of a subroutine with
+ the wrong number of arguments.
+
+#60. (Changed in 1.33MR7) Major changes to exception handling
+
+ There were significant problems in the handling of exceptions
+ in 1.33 vanilla. The general problem is that it can only
+ process one level of exception handler. For example, a named
+ exception handler, an exception handler for an alternative, or
+ an exception for a subrule always went to the rule's exception
+ handler if there was no "catch" which matched the exception.
+
+ In 1.33MR7 the exception handlers properly "nest". If an
+ exception handler does not have a matching "catch" then the
+ nextmost outer exception handler is checked for an appropriate
+ "catch" clause, and so on until an exception handler with an
+ appropriate "catch" is found.
+
+ There are still undesirable features in the way exception
+ handlers are implemented, but I do not have time to fix them
+ at the moment:
+
+ The exception handlers for alternatives are outside the
+ block containing the alternative. This makes it impossible
+ to access variables declared in a block or to resume the
+ parse by "falling through". The parse can still be easily
+ resumed in other ways, but not in the most natural fashion.
+
+ This results in an inconsistency between named exception
+ handlers and exception handlers for alternatives. When
+ an exception handler for an alternative "falls through"
+ it goes to the nextmost outer handler - not the "normal
+ action".
+
+ A major difference between 1.33MR7 and 1.33 vanilla is
+ the default action after an exception is caught:
+
+ 1.33 Vanilla
+ ------------
+ In 1.33 vanilla the signal value is set to zero ("NoSignal")
+ and the code drops through to the code following the exception.
+ For named exception handlers this is the "normal action".
+ For alternative exception handlers this is the rule's handler.
+
+ 1.33MR7
+ -------
+ In 1.33MR7 the signal value is NOT automatically set to zero.
+
+ There are two cases:
+
+ For named exception handlers: if the signal value has been
+ set to zero the code drops through to the "normal action".
+
+ For all other cases the code branches to the nextmost outer
+ exception handler until it reaches the handler for the rule.
+
+ The following macros have been defined for convenience:
+
+ C/C++ Mode Name
+ --------------------
+ (zz)suppressSignal
+ set signal & return signal arg to 0 ("NoSignal")
+ (zz)setSignal(intValue)
+ set signal & return signal arg to some value
+ (zz)exportSignal
+ copy the signal value to the return signal arg
+
+ I'm not sure why PCCTS make a distinction between the local
+ signal value and the return signal argument, but I'm loathe
+ to change the code. The burden of copying the local signal
+ value to the return signal argument can be given to the
+ default signal handler, I suppose.
+
+#59. (Changed in 1.33MR7) Prototypes for some functions
+
+ Added prototypes for the following functions to antlr.h
+
+ zzconsumeUntil()
+ zzconsumeUntilToken()
+
+#58. (Changed in 1.33MR7) Added definition of zzbufsize to dlgauto.h
+
+#57. (Changed in 1.33MR7) Format of #line directive
+
+ Previously, the -gl directive for line 1234 would
+ resemble: "# 1234 filename.g". This caused problems
+ for some compilers/pre-processors. In MR7 it generates
+ "#line 1234 filename.g".
+
+#56. (Added in 1.33MR7) Jan Mikkelsen <janm@zeta.org.au>
+
+ Move PURIFY macro invocation to after rule's init action.
+
+#55. (Fixed in 1.33MR7) Uninitialized variables in ANTLRParser
+
+ Member variables inf_labase and inf_last were not initialized.
+ (See item #50.)
+
+#54. (Fixed in 1.33MR6) Brad Schick (schick@interacess.com)
+
+ Previously, the following constructs generated the same
+ code:
+
+ rule1 : (A B C)?
+ | something-else
+ ;
+
+ rule2 : (A B C)? ()
+ | something-else
+ ;
+
+ In all versions of pccts rule1 guesses (A B C) and then
+ consume all three tokens if the guess succeeds. In MR6
+ rule2 guesses (A B C) but consumes NONE of the tokens
+ when the guess succeeds because "()" matches epsilon.
+
+#53. (Explanation for 1.33MR6) What happens after an exception is caught ?
+
+ The Book is silent about what happens after an exception
+ is caught.
+
+ The following code fragment prints "Error Action" followed
+ by "Normal Action".
+
+ test : Word ex:Number <<printf("Normal Action\n");>>
+ exception[ex]
+ catch NoViableAlt:
+ <<printf("Error Action\n");>>
+ ;
+
+ The reason for "Normal Action" is that the normal flow of the
+ program after a user-written exception handler is to "drop through".
+ In the case of an exception handler for a rule this results in
+ the execution of a "return" statement. In the case of an
+ exception handler attached to an alternative, rule, or token
+ this is the code that would have executed had there been no
+ exception.
+
+ The user can achieve the desired result by using a "return"
+ statement.
+
+ test : Word ex:Number <<printf("Normal Action\n");>>
+ exception[ex]
+ catch NoViableAlt:
+ <<printf("Error Action\n"); return;>>
+ ;
+
+ The most powerful mechanism for recovery from parse errors
+ in pccts is syntactic predicates because they provide
+ backtracking. Exceptions allow "return", "break",
+ "consumeUntil(...)", "goto _handler", "goto _fail", and
+ changing the _signal value.
+
+#52. (Fixed in 1.33MR6) Exceptions without syntactic predicates
+
+ The following generates bad code in 1.33 if no syntactic
+ predicates are present in the grammar.
+
+ test : Word ex:Number <<printf("Normal Action\n");>>
+ exception[ex]
+ catch NoViableAlt:
+ <<printf("Error Action\n");>>
+
+ There is a reference to a guess variable. In C mode
+ this causes a compiler error. In C++ mode it generates
+ an extraneous check on member "guessing".
+
+ In MR6 correct code is generated for both C and C++ mode.
+
+#51. (Added to 1.33MR6) Exception operator "@" used without exceptions
+
+ In MR6 added a warning when the exception operator "@" is
+ used and no exception group is defined. This is probably
+ a case where "\@" or "@" is meant.
+
+#50. (Fixed in 1.33MR6) Gunnar Rxnning (gunnar@candleweb.no)
+ http://www.candleweb.no/~gunnar/
+
+ Routines zzsave_antlr_state and zzrestore_antlr_state don't
+ save and restore all the data needed when switching states.
+
+ Suggested patch applied to antlr.h and err.h for MR6.
+
+#49. (Fixed in 1.33MR6) Sinan Karasu (sinan@boeing.com)
+
+ Generated code failed to turn off guess mode when leaving a
+ (...)+ block which contained a guess block. The result was
+ an infinite loop. For example:
+
+ rule : (
+ (x)?
+ | y
+ )+
+
+ Suggested code fix implemented in MR6. Replaced
+
+ ... else if (zzcnt>1) break;
+
+ with:
+
+ C++ mode:
+ ... else if (zzcnt>1) {if (!zzrv) zzGUESS_DONE; break;};
+ C mode:
+ ... else if (zzcnt>1) {if (zzguessing) zzGUESS_DONE; break;};
+
+#48. (Fixed in 1.33MR6) Invalid exception element causes core
+
+ A label attached to an invalid construct can cause
+ pccts to crash while processing the exception associated
+ with the label. For example:
+
+ rule : t:(B C)
+ exception[t] catch MismatchedToken: <<printf(...);>>
+
+ Version MR6 generates the message:
+
+ reference in exception handler to undefined label 't'
+
+#47. (Fixed in 1.33MR6) Manuel Ornato
+
+ Under some circumstances involving a k >1 or ck >1
+ grammar and a loop block (i.e. (...)* ) pccts will
+ fail to detect a syntax error and loop indefinitely.
+ The problem did not exist in 1.20, but has existed
+ from 1.23 to the present.
+
+ Fixed in MR6.
+
+ ---------------------------------------------------
+ Complete test program
+ ---------------------------------------------------
+ #header<<
+ #include <stdio.h>
+ #include "charptr.h"
+ >>
+
+ <<
+ #include "charptr.c"
+ main ()
+ {
+ ANTLR(global(),stdin);
+ }
+ >>
+
+ #token "[\ \t]+" << zzskip(); >>
+ #token "[\n]" << zzline++; zzskip(); >>
+
+ #token B "b"
+ #token C "c"
+ #token D "d"
+ #token E "e"
+ #token LP "\("
+ #token RP "\)"
+
+ #token ANTLREOF "@"
+
+ global : (
+ (E liste)
+ | liste
+ | listed
+ ) ANTLREOF
+ ;
+
+ listeb : LP ( B ( B | C )* ) RP ;
+ listec : LP ( C ( B | C )* ) RP ;
+ listed : LP ( D ( B | C )* ) RP ;
+ liste : ( listeb | listec )* ;
+
+ ---------------------------------------------------
+ Sample data causing infinite loop
+ ---------------------------------------------------
+ e (d c)
+ ---------------------------------------------------
+
+#46. (Fixed in 1.33MR6) Robert Richter
+ (Robert.Richter@infotech.tu-chemnitz.de)
+
+ This item from the list of known problems was
+ fixed by item #18 (below).
+
+#45. (Fixed in 1.33MR6) Brad Schick (schick@interaccess.com)
+
+ The dependency scanner in VC++ mistakenly sees a
+ reference to an MPW #include file even though properly
+ #ifdef/#endif in config.h. The suggested workaround
+ has been implemented:
+
+ #ifdef MPW
+ .....
+ #define MPW_CursorCtl_Header <CursorCtl.h>
+ #include MPW_CursorCtl_Header
+ .....
+ #endif
+
+#44. (Fixed in 1.33MR6) cast malloc() to (char *) in charptr.c
+
+ Added (char *) cast for systems where malloc returns "void *".
+
+#43. (Added to 1.33MR6) Bruce Guenter (bruceg@qcc.sk.ca)
+
+ Add setLeft() and setUp methods to ASTDoublyLinkedBase
+ for symmetry with setRight() and setDown() methods.
+
+#42. (Fixed in 1.33MR6) Jeff Katcher (jkatcher@nortel.ca)
+
+ C++ style comment in antlr.c corrected.
+
+#41. (Added in 1.33MR6) antlr -stdout
+
+ Using "antlr -stdout ..." forces the text that would
+ normally go to the grammar.c or grammar.cpp file to
+ stdout.
+
+#40. (Added in 1.33MR6) antlr -tab to change tab stops
+
+ Using "antlr -tab number ..." changes the tab stops
+ for the grammar.c or grammar.cpp file. The number
+ must be between 0 and 8. Using 0 gives tab characters,
+ values between 1 and 8 give the appropriate number of
+ space characters.
+
+#39. (Fixed in 1.33MR5) Jan Mikkelsen <janm@zeta.org.au>
+
+ Commas in function prototype still not correct under
+ some circumstances. Suggested code fix installed.
+
+#38. (Fixed in 1.33MR5) ANTLRTokenBuffer constructor
+
+ Have ANTLRTokenBuffer ctor initialize member "parser" to null.
+
+#37. (Fixed in 1.33MR4) Bruce Guenter (bruceg@qcc.sk.ca)
+
+ In ANTLRParser::FAIL(int k,...) released memory pointed to by
+ f[i] (as well as f itself. Should only free f itself.
+
+#36. (Fixed in 1.33MR3) Cortland D. Starrett (cort@shay.ecn.purdue.edu)
+
+ Neglected to properly declare isDLGmaxToken() when fixing problem
+ reported by Andreas Magnusson.
+
+ Undo "_retv=NULL;" change which caused problems for return values
+ from rules whose return values weren't pointers.
+
+ Failed to create bin directory if it didn't exist.
+
+#35. (Fixed in 1.33MR2) Andreas Magnusson
+(Andreas.Magnusson@mailbox.swipnet.se)
+
+ Repair bug introduced by 1.33MR1 for #tokdefs. The original fix
+ placed "DLGmaxToken=9999" and "DLGminToken=0" in the TokenType enum
+ in order to fix a problem with an aggressive compiler assigning an 8
+ bit enum which might be too narrow. This caused #tokdefs to assume
+ that there were 9999 real tokens. The repair to the fix causes antlr to
+ ignore TokenTypes "DLGmaxToken" and "DLGminToken" in a #tokdefs file.
+
+#34. (Added to 1.33MR1) Add public DLGLexerBase::set_line(int newValue)
+
+ Previously there was no public function for changing the line
+ number maintained by the lexer.
+
+#33. (Fixed in 1.33MR1) Franklin Chen (chen@adi.com)
+
+ Accidental use of EXIT_FAILURE rather than PCCTS_EXIT_FAILURE
+ in pccts/h/AParser.cpp.
+
+#32. (Fixed in 1.33MR1) Franklin Chen (chen@adi.com)
+
+ In PCCTSAST.cpp lines 405 and 466: Change
+
+ free (t)
+ to
+ free ( (char *)t );
+
+ to match prototype.
+
+#31. (Added to 1.33MR1) Pointer to parser in ANTLRTokenBuffer
+ Pointer to parser in DLGLexerBase
+
+ The ANTLRTokenBuffer class now contains a pointer to the
+ parser which is using it. This is established by the
+ ANTLRParser constructor calling ANTLRTokenBuffer::
+ setParser(ANTLRParser *p).
+
+ When ANTLRTokenBuffer::setParser(ANTLRParser *p) is
+ called it saves the pointer to the parser and then
+ calls ANTLRTokenStream::setParser(ANTLRParser *p)
+ so that the lexer can also save a pointer to the
+ parser.
+
+ There is also a function getParser() in each class
+ with the obvious purpose.
+
+ It is possible that these functions will return NULL
+ under some circumstances (e.g. a non-DLG lexer is used).
+
+#30. (Added to 1.33MR1) function tokenName(int token) standard
+
+ The generated parser class now includes the
+ function:
+
+ static const ANTLRChar * tokenName(int token)
+
+ which returns a pointer to the "name" corresponding
+ to the token.
+
+ The base class (ANTLRParser) always includes the
+ member function:
+
+ const ANTLRChar * parserTokenName(int token)
+
+ which can be accessed by objects which have a pointer
+ to an ANTLRParser, but do not know the name of the
+ parser class (e.g. ANTLRTokenBuffer and DLGLexerBase).
+
+#29. (Added to 1.33MR1) Debugging DLG lexers
+
+ If the pre-processor symbol DEBUG_LEXER is defined
+ then DLexerBase will include code for printing out
+ key information about tokens which are recognized.
+
+ The debug feature of the lexer is controlled by:
+
+ int previousDebugValue=lexer.debugLexer(newValue);
+
+ a value of 0 disables output
+ a value of 1 enables output
+
+ Even if the lexer debug code is compiled into DLexerBase
+ it must be enabled before any output is generated. For
+ example:
+
+ DLGFileInput in(stdin);
+ MyDLG lexer(&in,2000);
+
+ lexer.setToken(&aToken);
+
+ #if DEBUG_LEXER
+ lexer.debugLexer(1); // enable debug information
+ #endif
+
+#28. (Added to 1.33MR1) More control over DLG header
+
+ Version 1.33MR1 adds the following directives to PCCTS
+ for C++ mode:
+
+ #lexprefix <<source code>>
+
+ Adds source code to the DLGLexer.h file
+ after the #include "DLexerBase.h" but
+ before the start of the class definition.
+
+ #lexmember <<source code>>
+
+ Adds source code to the DLGLexer.h file
+ as part of the DLGLexer class body. It
+ appears immediately after the start of
+ the class and a "public: statement.
+
+#27. (Fixed in 1.33MR1) Comments in DLG actions
+
+ Previously, DLG would not recognize comments as a special case.
+ Thus, ">>" in the comments would cause errors. This is fixed.
+
+#26. (Fixed in 1.33MR1) Removed static variables from error routines
+
+ Previously, the existence of statically allocated variables
+ in some of the parser's member functions posed a danger when
+ there was more than one parser active.
+
+ Replaced with dynamically allocated/freed variables in 1.33MR1.
+
+#25. (Fixed in 1.33MR1) Use of string literals in semantic predicates
+
+ Previously, it was not possible to place a string literal in
+ a semantic predicate because it was not properly "stringized"
+ for the report of a failed predicate.
+
+#24. (Fixed in 1.33MR1) Continuation lines for semantic predicates
+
+ Previously, it was not possible to continue semantic
+ predicates across a line because it was not properly
+ "stringized" for the report of a failed predicate.
+
+ rule : <<ifXYZ()>>?[ a very
+ long statement ]
+
+#23. (Fixed in 1.33MR1) {...} envelope for failed semantic predicates
+
+ Previously, there was a code generation error for failed
+ semantic predicates:
+
+ rule : <<xyz()>>?[ stmt1; stmt2; ]
+
+ which generated code which resembled:
+
+ if (! xyz()) stmt1; stmt2;
+
+ It now puts the statements in a {...} envelope:
+
+ if (! xyz()) { stmt1; stmt2; };
+
+#22. (Fixed in 1.33MR1) Continuation of #token across lines using "\"
+
+ Previously, it was not possible to continue a #token regular
+ expression across a line. The trailing "\" and newline caused
+ a newline to be inserted into the regular expression by DLG.
+
+ Fixed in 1.33MR1.
+
+#21. (Fixed in 1.33MR1) Use of ">>" (right shift operator in DLG actions
+
+ It is now possible to use the C++ right shift operator ">>"
+ in DLG actions by using the normal escapes:
+
+ #token "shift-right" << value=value \>\> 1;>>
+
+#20. (Version 1.33/19-Jan-97 Karl Eccleson <karle@microrobotics.co.uk>
+ P.A. Keller (P.A.Keller@bath.ac.uk)
+
+ There is a problem due to using exceptions with the -gh option.
+
+ Suggested fix now in 1.33MR1.
+
+#19. (Fixed in 1.33MR1) Tom Piscotti and John Lilley
+
+ There were problems suppressing messages to stdin and stdout
+ when running in a window environment because some functions
+ which uses fprint were not virtual.
+
+ Suggested change now in 1.33MR1.
+
+ I believe all functions containing error messages (excluding those
+ indicating internal inconsistency) have been placed in functions
+ which are virtual.
+
+#18. (Version 1.33/ 22-Nov-96) John Bair (jbair@iftime.com)
+
+ Under some combination of options a required "return _retv" is
+ not generated.
+
+ Suggested fix now in 1.33MR1.
+
+#17. (Version 1.33/3-Sep-96) Ron House (house@helios.usq.edu.au)
+
+ The routine ASTBase::predorder_action omits two "tree->"
+ prefixes, which results in the preorder_action belonging
+ to the wrong node to be invoked.
+
+ Suggested fix now in 1.33MR1.
+
+#16. (Version 1.33/7-Jun-96) Eli Sternheim <eli@interhdl.com>
+
+ Routine consumeUntilToken() does not check for end-of-file
+ condition.
+
+ Suggested fix now in 1.33MR1.
+
+#15. (Version 1.33/8 Apr 96) Asgeir Olafsson <olafsson@cstar.ac.com>
+
+ Problem with tree duplication of doubly linked ASTs in ASTBase.cpp.
+
+ Suggested fix now in 1.33MR1.
+
+#14. (Version 1.33/28-Feb-96) Andreas.Magnusson@mailbox.swipnet.se
+
+ Problem with definition of operator = (const ANTLRTokenPtr rhs).
+
+ Suggested fix now in 1.33MR1.
+
+#13. (Version 1.33/13-Feb-96) Franklin Chen (chen@adi.com)
+
+ Sun C++ Compiler 3.0.1 can't compile testcpp/1 due to goto in
+ block with destructors.
+
+ Apparently fixed. Can't locate "goto".
+
+#12. (Version 1.33/10-Nov-95) Minor problems with 1.33 code
+
+ The following items have been fixed in 1.33MR1:
+
+ 1. pccts/antlr/main.c line 142
+
+ "void" appears in classic C code
+
+ 2. no makefile in support/genmk
+
+ 3. EXIT_FAILURE/_SUCCESS instead of PCCTS_EXIT_FAILURE/_SUCCESS
+
+ pccts/h/PCCTSAST.cpp
+ pccts/h/DLexerBase.cpp
+ pccts/testcpp/6/test.g
+
+ 4. use of "signed int" isn't accepted by AT&T cfront
+
+ pccts/h/PCCTSAST.h line 42
+
+ 5. in call to ANTLRParser::FAIL the var arg err_k is passed as
+ "int" but is declared "unsigned int".
+
+ 6. I believe that a failed validation predicate still does not
+ get put in a "{...}" envelope, despite the release notes.
+
+ 7. The #token ">>" appearing in the DLG grammar description
+ causes DLG to generate the string literal "\>\>" which
+ is non-conforming and will cause some compilers to
+ complain (scan.c function act10 line 143 of source code).
+
+#11. (Version 1.32b6) Dave Kuhlman (dkuhlman@netcom.com)
+
+ Problem with file close in gen.c. Already fixed in 1.33.
+
+#10. (Version 1.32b6/29-Aug-95)
+
+ pccts/antlr/main.c contains a C++ style comments on lines 149
+ and 176 which causes problems for most C compilers.
+
+ Already fixed in 1.33.
+
+#9. (Version 1.32b4/14-Mar-95) dlgauto.h #include "config.h"
+
+ The file pccts/h/dlgauto.h should probably contain a #include
+ "config.h" as it uses the #define symbol __USE_PROTOS.
+
+ Added to 1.33MR1.
+
+#8. (Version 1.32b4/6-Mar-95) Michael T. Richter (mtr@igs.net)
+
+ In C++ output mode anonymous tokens from in-line regular expressions
+ can create enum values which are too wide for the datatype of the enum
+ assigned by the C++ compiler.
+
+ Fixed in 1.33MR1.
+
+#7. (Version 1.32b4/6-Mar-95) C++ does not imply __STDC__
+
+ In err.h the combination of # directives assumes that a C++
+ compiler has __STDC__ defined. This is not necessarily true.
+
+ This problem also appears in the use of __USE_PROTOS which
+ is appropriate for both Standard C and C++ in antlr/gen.c
+ and antlr/lex.c
+
+ Fixed in 1.33MR1.
+
+#6. (Version 1.32 ?/15-Feb-95) Name conflict for "TokenType"
+
+ Already fixed in 1.33.
+
+#5. (23-Jan-95) Douglas_Cuthbertson.JTIDS@jtids_qmail.hanscom.af.mil
+
+ The fail action following a semantic predicate is not enclosed in
+ "{...}". This can lead to problems when the fail action contains
+ more than one statement.
+
+ Fixed in 1.33MR1.
+
+#4 . (Version 1.33/31-Mar-96) jlilley@empathy.com (John Lilley)
+
+ Put briefly, a semantic predicate ought to abort a guess if it fails.
+
+ Correction suggested by J. Lilley has been added to 1.33MR1.
+
+#3 . (Version 1.33) P.A.Keller@bath.ac.uk
+
+ Extra commas are placed in the K&R style argument list for rules
+ when using both exceptions and ASTs.
+
+ Fixed in 1.33MR1.
+
+#2. (Version 1.32b6/2-Oct-95) Brad Schick <schick@interaccess.com>
+
+ Construct #[] generates zzastnew() in C++ mode.
+
+ Already fixed in 1.33.
+
+#1. (Version 1.33) Bob Bailey (robert@oakhill.sps.mot.com)
+
+ Previously, config.h assumed that all PC systems required
+ "short" file names. The user can now override that
+ assumption with "#define LONGFILENAMES".
+
+ Added to 1.33MR1.
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_SUMMARY.txt b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_SUMMARY.txt
new file mode 100644
index 000000000..7134500e2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/CHANGES_SUMMARY.txt
@@ -0,0 +1,2049 @@
+======================================================================
+
+ CHANGES_SUMMARY.TXT
+
+ A QUICK overview of changes from 1.33 in reverse order
+
+ A summary of additions rather than bug fixes and minor code changes.
+
+ Numbers refer to items in CHANGES_FROM_133*.TXT
+ which may contain additional information.
+
+ DISCLAIMER
+
+ The software and these notes are provided "as is". They may include
+ typographical or technical errors and their authors disclaims all
+ liability of any kind or nature for damages due to error, fault,
+ defect, or deficiency regardless of cause. All warranties of any
+ kind, either express or implied, including, but not limited to, the
+ implied warranties of merchantability and fitness for a particular
+ purpose are disclaimed.
+
+======================================================================
+
+#258. You can specify a user-defined base class for your parser
+
+ The base class must constructor must have a signature similar to
+ that of ANTLRParser.
+
+#253. Generation of block preamble (-preamble and -preamble_first)
+
+ The antlr option -preamble causes antlr to insert the code
+ BLOCK_PREAMBLE at the start of each rule and block.
+
+ The antlr option -preamble_first is similar, but inserts the
+ code BLOCK_PREAMBLE_FIRST(PreambleFirst_123) where the symbol
+ PreambleFirst_123 is equivalent to the first set defined by
+ the #FirstSetSymbol described in Item #248.
+
+#248. Generate symbol for first set of an alternative
+
+ rr : #FirstSetSymbol(rr_FirstSet) ( Foo | Bar ) ;
+
+#216. Defer token fetch for C++ mode
+
+ When the ANTLRParser class is built with the pre-processor option
+ ZZDEFER_FETCH defined, the fetch of new tokens by consume() is deferred
+ until LA(i) or LT(i) is called.
+
+#215. Use reset() to reset DLGLexerBase
+#188. Added pccts/h/DLG_stream_input.h
+#180. Added ANTLRParser::getEofToken()
+#173. -glms for Microsoft style filenames with -gl
+#170. Suppression for predicates with lookahead depth >1
+
+ Consider the following grammar with -ck 2 and the predicate in rule
+ "a" with depth 2:
+
+ r1 : (ab)* "@"
+ ;
+
+ ab : a
+ | b
+ ;
+
+ a : (A B)? => <<p(LATEXT(2))>>? A B C
+ ;
+
+ b : A B C
+ ;
+
+ Normally, the predicate would be hoisted into rule r1 in order to
+ determine whether to call rule "ab". However it should *not* be
+ hoisted because, even if p is false, there is a valid alternative
+ in rule b. With "-mrhoistk on" the predicate will be suppressed.
+
+ If "-info p" command line option is present the following information
+ will appear in the generated code:
+
+ while ( (LA(1)==A)
+ #if 0
+
+ Part (or all) of predicate with depth > 1 suppressed by alternative
+ without predicate
+
+ pred << p(LATEXT(2))>>?
+ depth=k=2 ("=>" guard) rule a line 8 t1.g
+ tree context:
+ (root = A
+ B
+ )
+
+ The token sequence which is suppressed: ( A B )
+ The sequence of references which generate that sequence of tokens:
+
+ 1 to ab r1/1 line 1 t1.g
+ 2 ab ab/1 line 4 t1.g
+ 3 to b ab/2 line 5 t1.g
+ 4 b b/1 line 11 t1.g
+ 5 #token A b/1 line 11 t1.g
+ 6 #token B b/1 line 11 t1.g
+
+ #endif
+
+ A slightly more complicated example:
+
+ r1 : (ab)* "@"
+ ;
+
+ ab : a
+ | b
+ ;
+
+ a : (A B)? => <<p(LATEXT(2))>>? (A B | D E)
+ ;
+
+ b : <<q(LATEXT(2))>>? D E
+ ;
+
+
+ In this case, the sequence (D E) in rule "a" which lies behind
+ the guard is used to suppress the predicate with context (D E)
+ in rule b.
+
+ while ( (LA(1)==A || LA(1)==D)
+ #if 0
+
+ Part (or all) of predicate with depth > 1 suppressed by alternative
+ without predicate
+
+ pred << q(LATEXT(2))>>?
+ depth=k=2 rule b line 11 t2.g
+ tree context:
+ (root = D
+ E
+ )
+
+ The token sequence which is suppressed: ( D E )
+ The sequence of references which generate that sequence of tokens:
+
+ 1 to ab r1/1 line 1 t2.g
+ 2 ab ab/1 line 4 t2.g
+ 3 to a ab/1 line 4 t2.g
+ 4 a a/1 line 8 t2.g
+ 5 #token D a/1 line 8 t2.g
+ 6 #token E a/1 line 8 t2.g
+
+ #endif
+ &&
+ #if 0
+
+ pred << p(LATEXT(2))>>?
+ depth=k=2 ("=>" guard) rule a line 8 t2.g
+ tree context:
+ (root = A
+ B
+ )
+
+ #endif
+
+ (! ( LA(1)==A && LA(2)==B ) || p(LATEXT(2)) ) {
+ ab();
+ ...
+
+#165. (Changed in MR13) option -newAST
+
+ To create ASTs from an ANTLRTokenPtr antlr usually calls
+ "new AST(ANTLRTokenPtr)". This option generates a call
+ to "newAST(ANTLRTokenPtr)" instead. This allows a user
+ to define a parser member function to create an AST object.
+
+#161. (Changed in MR13) Switch -gxt inhibits generation of tokens.h
+
+#158. (Changed in MR13) #header causes problem for pre-processors
+
+ A user who runs the C pre-processor on antlr source suggested
+ that another syntax be allowed. With MR13 such directives
+ such as #header, #pragma, etc. may be written as "\#header",
+ "\#pragma", etc. For escaping pre-processor directives inside
+ a #header use something like the following:
+
+ \#header
+ <<
+ \#include <stdio.h>
+ >>
+
+#155. (Changed in MR13) Context behind predicates can suppress
+
+ With -mrhoist enabled the context behind a guarded predicate can
+ be used to suppress other predicates. Consider the following grammar:
+
+ r0 : (r1)+;
+
+ r1 : rp
+ | rq
+ ;
+ rp : <<p LATEXT(1)>>? B ;
+ rq : (A)? => <<q LATEXT(1)>>? (A|B);
+
+ In earlier versions both predicates "p" and "q" would be hoisted into
+ rule r0. With MR12c predicate p is suppressed because the context which
+ follows predicate q includes "B" which can "cover" predicate "p". In
+ other words, in trying to decide in r0 whether to call r1, it doesn't
+ really matter whether p is false or true because, either way, there is
+ a valid choice within r1.
+
+#154. (Changed in MR13) Making hoist suppression explicit using <<nohoist>>
+
+ A common error, even among experienced pccts users, is to code
+ an init-action to inhibit hoisting rather than a leading action.
+ An init-action does not inhibit hoisting.
+
+ This was coded:
+
+ rule1 : <<;>> rule2
+
+ This is what was meant:
+
+ rule1 : <<;>> <<;>> rule2
+
+ With MR13, the user can code:
+
+ rule1 : <<;>> <<nohoist>> rule2
+
+ The following will give an error message:
+
+ rule1 : <<nohoist>> rule2
+
+ If the <<nohoist>> appears as an init-action rather than a leading
+ action an error message is issued. The meaning of an init-action
+ containing "nohoist" is unclear: does it apply to just one
+ alternative or to all alternatives ?
+
+#151a. Addition of ANTLRParser::getLexer(), ANTLRTokenStream::getLexer()
+
+ You must manually cast the ANTLRTokenStream to your program's
+ lexer class. Because the name of the lexer's class is not fixed.
+ Thus it is impossible to incorporate it into the DLGLexerBase
+ class.
+
+#151b.(Changed in MR12) ParserBlackBox member getLexer()
+
+#150. (Changed in MR12) syntaxErrCount and lexErrCount now public
+
+#149. (Changed in MR12) antlr option -info o (letter o for orphan)
+
+ If there is more than one rule which is not referenced by any
+ other rule then all such rules are listed. This is useful for
+ alerting one to rules which are not used, but which can still
+ contribute to ambiguity.
+
+#148. (Changed in MR11) #token names appearing in zztokens,token_tbl
+
+ One can write:
+
+ #token Plus ("+") "\+"
+ #token RP ("(") "\("
+ #token COM ("comment begin") "/\*"
+
+ The string in parenthesis will be used in syntax error messages.
+
+#146. (Changed in MR11) Option -treport for locating "difficult" alts
+
+ It can be difficult to determine which alternatives are causing
+ pccts to work hard to resolve an ambiguity. In some cases the
+ ambiguity is successfully resolved after much CPU time so there
+ is no message at all.
+
+ A rough measure of the amount of work being peformed which is
+ independent of the CPU speed and system load is the number of
+ tnodes created. Using "-info t" gives information about the
+ total number of tnodes created and the peak number of tnodes.
+
+ Tree Nodes: peak 1300k created 1416k lost 0
+
+ It also puts in the generated C or C++ file the number of tnodes
+ created for a rule (at the end of the rule). However this
+ information is not sufficient to locate the alternatives within
+ a rule which are causing the creation of tnodes.
+
+ Using:
+
+ antlr -treport 100000 ....
+
+ causes antlr to list on stdout any alternatives which require the
+ creation of more than 100,000 tnodes, along with the lookahead sets
+ for those alternatives.
+
+ The following is a trivial case from the ansi.g grammar which shows
+ the format of the report. This report might be of more interest
+ in cases where 1,000,000 tuples were created to resolve the ambiguity.
+
+ -------------------------------------------------------------------------
+ There were 0 tuples whose ambiguity could not be resolved
+ by full lookahead
+ There were 157 tnodes created to resolve ambiguity between:
+
+ Choice 1: statement/2 line 475 file ansi.g
+ Choice 2: statement/3 line 476 file ansi.g
+
+ Intersection of lookahead[1] sets:
+
+ IDENTIFIER
+
+ Intersection of lookahead[2] sets:
+
+ LPARENTHESIS COLON AMPERSAND MINUS
+ STAR PLUSPLUS MINUSMINUS ONESCOMPLEMENT
+ NOT SIZEOF OCTALINT DECIMALINT
+ HEXADECIMALINT FLOATONE FLOATTWO IDENTIFIER
+ STRING CHARACTER
+ -------------------------------------------------------------------------
+
+#143. (Changed in MR11) Optional ";" at end of #token statement
+
+ Fixes problem of:
+
+ #token X "x"
+
+ <<
+ parser action
+ >>
+
+ Being confused with:
+
+ #token X "x" <<lexical action>>
+
+#142. (Changed in MR11) class BufFileInput subclass of DLGInputStream
+
+ Alexey Demakov (demakov@kazbek.ispras.ru) has supplied class
+ BufFileInput derived from DLGInputStream which provides a
+ function lookahead(char *string) to test characters in the
+ input stream more than one character ahead.
+ The class is located in pccts/h/BufFileInput.* of the kit.
+
+#140. #pred to define predicates
+
+ +---------------------------------------------------+
+ | Note: Assume "-prc on" for this entire discussion |
+ +---------------------------------------------------+
+
+ A problem with predicates is that each one is regarded as
+ unique and capable of disambiguating cases where two
+ alternatives have identical lookahead. For example:
+
+ rule : <<pred(LATEXT(1))>>? A
+ | <<pred(LATEXT(1))>>? A
+ ;
+
+ will not cause any error messages or warnings to be issued
+ by earlier versions of pccts. To compare the text of the
+ predicates is an incomplete solution.
+
+ In 1.33MR11 I am introducing the #pred statement in order to
+ solve some problems with predicates. The #pred statement allows
+ one to give a symbolic name to a "predicate literal" or a
+ "predicate expression" in order to refer to it in other predicate
+ expressions or in the rules of the grammar.
+
+ The predicate literal associated with a predicate symbol is C
+ or C++ code which can be used to test the condition. A
+ predicate expression defines a predicate symbol in terms of other
+ predicate symbols using "!", "&&", and "||". A predicate symbol
+ can be defined in terms of a predicate literal, a predicate
+ expression, or *both*.
+
+ When a predicate symbol is defined with both a predicate literal
+ and a predicate expression, the predicate literal is used to generate
+ code, but the predicate expression is used to check for two
+ alternatives with identical predicates in both alternatives.
+
+ Here are some examples of #pred statements:
+
+ #pred IsLabel <<isLabel(LATEXT(1))>>?
+ #pred IsLocalVar <<isLocalVar(LATEXT(1))>>?
+ #pred IsGlobalVar <<isGlobalVar(LATEXT(1)>>?
+ #pred IsVar <<isVar(LATEXT(1))>>? IsLocalVar || IsGlobalVar
+ #pred IsScoped <<isScoped(LATEXT(1))>>? IsLabel || IsLocalVar
+
+ I hope that the use of EBNF notation to describe the syntax of the
+ #pred statement will not cause problems for my readers (joke).
+
+ predStatement : "#pred"
+ CapitalizedName
+ (
+ "<<predicate_literal>>?"
+ | "<<predicate_literal>>?" predOrExpr
+ | predOrExpr
+ )
+ ;
+
+ predOrExpr : predAndExpr ( "||" predAndExpr ) * ;
+
+ predAndExpr : predPrimary ( "&&" predPrimary ) * ;
+
+ predPrimary : CapitalizedName
+ | "!" predPrimary
+ | "(" predOrExpr ")"
+ ;
+
+ What is the purpose of this nonsense ?
+
+ To understand how predicate symbols help, you need to realize that
+ predicate symbols are used in two different ways with two different
+ goals.
+
+ a. Allow simplification of predicates which have been combined
+ during predicate hoisting.
+
+ b. Allow recognition of identical predicates which can't disambiguate
+ alternatives with common lookahead.
+
+ First we will discuss goal (a). Consider the following rule:
+
+ rule0: rule1
+ | ID
+ | ...
+ ;
+
+ rule1: rule2
+ | rule3
+ ;
+
+ rule2: <<isX(LATEXT(1))>>? ID ;
+ rule3: <<!isX(LATEXT(1)>>? ID ;
+
+ When the predicates in rule2 and rule3 are combined by hoisting
+ to create a prediction expression for rule1 the result is:
+
+ if ( LA(1)==ID
+ && ( isX(LATEXT(1) || !isX(LATEXT(1) ) ) { rule1(); ...
+
+ This is inefficient, but more importantly, can lead to false
+ assumptions that the predicate expression distinguishes the rule1
+ alternative with some other alternative with lookahead ID. In
+ MR11 one can write:
+
+ #pred IsX <<isX(LATEXT(1))>>?
+
+ ...
+
+ rule2: <<IsX>>? ID ;
+ rule3: <<!IsX>>? ID ;
+
+ During hoisting MR11 recognizes this as a special case and
+ eliminates the predicates. The result is a prediction
+ expression like the following:
+
+ if ( LA(1)==ID ) { rule1(); ...
+
+ Please note that the following cases which appear to be equivalent
+ *cannot* be simplified by MR11 during hoisting because the hoisting
+ logic only checks for a "!" in the predicate action, not in the
+ predicate expression for a predicate symbol.
+
+ *Not* equivalent and is not simplified during hoisting:
+
+ #pred IsX <<isX(LATEXT(1))>>?
+ #pred NotX <<!isX(LATEXT(1))>>?
+ ...
+ rule2: <<IsX>>? ID ;
+ rule3: <<NotX>>? ID ;
+
+ *Not* equivalent and is not simplified during hoisting:
+
+ #pred IsX <<isX(LATEXT(1))>>?
+ #pred NotX !IsX
+ ...
+ rule2: <<IsX>>? ID ;
+ rule3: <<NotX>>? ID ;
+
+ Now we will discuss goal (b).
+
+ When antlr discovers that there is a lookahead ambiguity between
+ two alternatives it attempts to resolve the ambiguity by searching
+ for predicates in both alternatives. In the past any predicate
+ would do, even if the same one appeared in both alternatives:
+
+ rule: <<p(LATEXT(1))>>? X
+ | <<p(LATEXT(1))>>? X
+ ;
+
+ The #pred statement is a start towards solving this problem.
+ During ambiguity resolution (*not* predicate hoisting) the
+ predicates for the two alternatives are expanded and compared.
+ Consider the following example:
+
+ #pred Upper <<isUpper(LATEXT(1))>>?
+ #pred Lower <<isLower(LATEXT(1))>>?
+ #pred Alpha <<isAlpha(LATEXT(1))>>? Upper || Lower
+
+ rule0: rule1
+ | <<Alpha>>? ID
+ ;
+
+ rule1:
+ | rule2
+ | rule3
+ ...
+ ;
+
+ rule2: <<Upper>>? ID;
+ rule3: <<Lower>>? ID;
+
+ The definition of #pred Alpha expresses:
+
+ a. to test the predicate use the C code "isAlpha(LATEXT(1))"
+
+ b. to analyze the predicate use the information that
+ Alpha is equivalent to the union of Upper and Lower,
+
+ During ambiguity resolution the definition of Alpha is expanded
+ into "Upper || Lower" and compared with the predicate in the other
+ alternative, which is also "Upper || Lower". Because they are
+ identical MR11 will report a problem.
+
+ -------------------------------------------------------------------------
+ t10.g, line 5: warning: the predicates used to disambiguate rule rule0
+ (file t10.g alt 1 line 5 and alt 2 line 6)
+ are identical when compared without context and may have no
+ resolving power for some lookahead sequences.
+ -------------------------------------------------------------------------
+
+ If you use the "-info p" option the output file will contain:
+
+ +----------------------------------------------------------------------+
+ |#if 0 |
+ | |
+ |The following predicates are identical when compared without |
+ | lookahead context information. For some ambiguous lookahead |
+ | sequences they may not have any power to resolve the ambiguity. |
+ | |
+ |Choice 1: rule0/1 alt 1 line 5 file t10.g |
+ | |
+ | The original predicate for choice 1 with available context |
+ | information: |
+ | |
+ | OR expr |
+ | |
+ | pred << Upper>>? |
+ | depth=k=1 rule rule2 line 14 t10.g |
+ | set context: |
+ | ID |
+ | |
+ | pred << Lower>>? |
+ | depth=k=1 rule rule3 line 15 t10.g |
+ | set context: |
+ | ID |
+ | |
+ | The predicate for choice 1 after expansion (but without context |
+ | information): |
+ | |
+ | OR expr |
+ | |
+ | pred << isUpper(LATEXT(1))>>? |
+ | depth=k=1 rule line 1 t10.g |
+ | |
+ | pred << isLower(LATEXT(1))>>? |
+ | depth=k=1 rule line 2 t10.g |
+ | |
+ | |
+ |Choice 2: rule0/2 alt 2 line 6 file t10.g |
+ | |
+ | The original predicate for choice 2 with available context |
+ | information: |
+ | |
+ | pred << Alpha>>? |
+ | depth=k=1 rule rule0 line 6 t10.g |
+ | set context: |
+ | ID |
+ | |
+ | The predicate for choice 2 after expansion (but without context |
+ | information): |
+ | |
+ | OR expr |
+ | |
+ | pred << isUpper(LATEXT(1))>>? |
+ | depth=k=1 rule line 1 t10.g |
+ | |
+ | pred << isLower(LATEXT(1))>>? |
+ | depth=k=1 rule line 2 t10.g |
+ | |
+ | |
+ |#endif |
+ +----------------------------------------------------------------------+
+
+ The comparison of the predicates for the two alternatives takes
+ place without context information, which means that in some cases
+ the predicates will be considered identical even though they operate
+ on disjoint lookahead sets. Consider:
+
+ #pred Alpha
+
+ rule1: <<Alpha>>? ID
+ | <<Alpha>>? Label
+ ;
+
+ Because the comparison of predicates takes place without context
+ these will be considered identical. The reason for comparing
+ without context is that otherwise it would be necessary to re-evaluate
+ the entire predicate expression for each possible lookahead sequence.
+ This would require more code to be written and more CPU time during
+ grammar analysis, and it is not yet clear whether anyone will even make
+ use of the new #pred facility.
+
+ A temporary workaround might be to use different #pred statements
+ for predicates you know have different context. This would avoid
+ extraneous warnings.
+
+ The above example might be termed a "false positive". Comparison
+ without context will also lead to "false negatives". Consider the
+ following example:
+
+ #pred Alpha
+ #pred Beta
+
+ rule1: <<Alpha>>? A
+ | rule2
+ ;
+
+ rule2: <<Alpha>>? A
+ | <<Beta>>? B
+ ;
+
+ The predicate used for alt 2 of rule1 is (Alpha || Beta). This
+ appears to be different than the predicate Alpha used for alt1.
+ However, the context of Beta is B. Thus when the lookahead is A
+ Beta will have no resolving power and Alpha will be used for both
+ alternatives. Using the same predicate for both alternatives isn't
+ very helpful, but this will not be detected with 1.33MR11.
+
+ To properly handle this the predicate expression would have to be
+ evaluated for each distinct lookahead context.
+
+ To determine whether two predicate expressions are identical is
+ difficult. The routine may fail to identify identical predicates.
+
+ The #pred feature also compares predicates to see if a choice between
+ alternatives which is resolved by a predicate which makes the second
+ choice unreachable. Consider the following example:
+
+ #pred A <<A(LATEXT(1)>>?
+ #pred B <<B(LATEXT(1)>>?
+ #pred A_or_B A || B
+
+ r : s
+ | t
+ ;
+ s : <<A_or_B>>? ID
+ ;
+ t : <<A>>? ID
+ ;
+
+ ----------------------------------------------------------------------------
+ t11.g, line 5: warning: the predicate used to disambiguate the
+ first choice of rule r
+ (file t11.g alt 1 line 5 and alt 2 line 6)
+ appears to "cover" the second predicate when compared without context.
+ The second predicate may have no resolving power for some lookahead
+ sequences.
+ ----------------------------------------------------------------------------
+
+#132. (Changed in 1.33MR11) Recognition of identical predicates in alts
+
+ Prior to 1.33MR11, there would be no ambiguity warning when the
+ very same predicate was used to disambiguate both alternatives:
+
+ test: ref B
+ | ref C
+ ;
+
+ ref : <<pred(LATEXT(1)>>? A
+
+ In 1.33MR11 this will cause the warning:
+
+ warning: the predicates used to disambiguate rule test
+ (file v98.g alt 1 line 1 and alt 2 line 2)
+ are identical and have no resolving power
+
+ ----------------- Note -----------------
+
+ This is different than the following case
+
+ test: <<pred(LATEXT(1))>>? A B
+ | <<pred(LATEXT(1)>>? A C
+ ;
+
+ In this case there are two distinct predicates
+ which have exactly the same text. In the first
+ example there are two references to the same
+ predicate. The problem represented by this
+ grammar will be addressed later.
+
+
+#127. (Changed in 1.33MR11)
+
+ Count Syntax Errors Count DLG Errors
+ ------------------- ----------------
+
+ C++ mode ANTLRParser:: DLGLexerBase::
+ syntaxErrCount lexErrCount
+ C mode zzSyntaxErrCount zzLexErrCount
+
+ The C mode variables are global and initialized to 0.
+ They are *not* reset to 0 automatically when antlr is
+ restarted.
+
+ The C++ mode variables are public. They are initialized
+ to 0 by the constructors. They are *not* reset to 0 by the
+ ANTLRParser::init() method.
+
+ Suggested by Reinier van den Born (reinier@vnet.ibm.com).
+
+#126. (Changed in 1.33MR11) Addition of #first <<...>>
+
+ The #first <<...>> inserts the specified text in the output
+ files before any other #include statements required by pccts.
+ The only things before the #first text are comments and
+ a #define ANTLR_VERSION.
+
+ Requested by and Esa Pulkkinen (esap@cs.tut.fi) and Alexin
+ Zoltan (alexin@inf.u-szeged.hu).
+
+#124. A Note on the New "&&" Style Guarded Predicates
+
+ I've been asked several times, "What is the difference between
+ the old "=>" style guard predicates and the new style "&&" guard
+ predicates, and how do you choose one over the other" ?
+
+ The main difference is that the "=>" does not apply the
+ predicate if the context guard doesn't match, whereas
+ the && form always does. What is the significance ?
+
+ If you have a predicate which is not on the "leading edge"
+ it is cannot be hoisted. Suppose you need a predicate that
+ looks at LA(2). You must introduce it manually. The
+ classic example is:
+
+ castExpr :
+ LP typeName RP
+ | ....
+ ;
+
+ typeName : <<isTypeName(LATEXT(1))>>? ID
+ | STRUCT ID
+ ;
+
+ The problem is that isTypeName() isn't on the leading edge
+ of typeName, so it won't be hoisted into castExpr to help
+ make a decision on which production to choose.
+
+ The *first* attempt to fix it is this:
+
+ castExpr :
+ <<isTypeName(LATEXT(2))>>?
+ LP typeName RP
+ | ....
+ ;
+
+ Unfortunately, this won't work because it ignores
+ the problem of STRUCT. The solution is to apply
+ isTypeName() in castExpr if LA(2) is an ID and
+ don't apply it when LA(2) is STRUCT:
+
+ castExpr :
+ (LP ID)? => <<isTypeName(LATEXT(2))>>?
+ LP typeName RP
+ | ....
+ ;
+
+ In conclusion, the "=>" style guarded predicate is
+ useful when:
+
+ a. the tokens required for the predicate
+ are not on the leading edge
+ b. there are alternatives in the expression
+ selected by the predicate for which the
+ predicate is inappropriate
+
+ If (b) were false, then one could use a simple
+ predicate (assuming "-prc on"):
+
+ castExpr :
+ <<isTypeName(LATEXT(2))>>?
+ LP typeName RP
+ | ....
+ ;
+
+ typeName : <<isTypeName(LATEXT(1))>>? ID
+ ;
+
+ So, when do you use the "&&" style guarded predicate ?
+
+ The new-style "&&" predicate should always be used with
+ predicate context. The context guard is in ADDITION to
+ the automatically computed context. Thus it useful for
+ predicates which depend on the token type for reasons
+ other than context.
+
+ The following example is contributed by Reinier van den Born
+ (reinier@vnet.ibm.com).
+
+ +-------------------------------------------------------------------------+
+ | This grammar has two ways to call functions: |
+ | |
+ | - a "standard" call syntax with parens and comma separated args |
+ | - a shell command like syntax (no parens and spacing separated args) |
+ | |
+ | The former also allows a variable to hold the name of the function, |
+ | the latter can also be used to call external commands. |
+ | |
+ | The grammar (simplified) looks like this: |
+ | |
+ | fun_call : ID "(" { expr ("," expr)* } ")" |
+ | /* ID is function name */ |
+ | | "@" ID "(" { expr ("," expr)* } ")" |
+ | /* ID is var containing fun name */ |
+ | ; |
+ | |
+ | command : ID expr* /* ID is function name */ |
+ | | path expr* /* path is external command name */ |
+ | ; |
+ | |
+ | path : ID /* left out slashes and such */ |
+ | | "@" ID /* ID is environment var */ |
+ | ; |
+ | |
+ | expr : .... |
+ | | "(" expr ")"; |
+ | |
+ | call : fun_call |
+ | | command |
+ | ; |
+ | |
+ | Obviously the call is wildly ambiguous. This is more or less how this |
+ | is to be resolved: |
+ | |
+ | A call begins with an ID or an @ followed by an ID. |
+ | |
+ | If it is an ID and if it is an ext. command name -> command |
+ | if followed by a paren -> fun_call |
+ | otherwise -> command |
+ | |
+ | If it is an @ and if the ID is a var name -> fun_call |
+ | otherwise -> command |
+ | |
+ | One can implement these rules quite neatly using && predicates: |
+ | |
+ | call : ("@" ID)? && <<isVarName(LT(2))>>? fun_call |
+ | | (ID)? && <<isExtCmdName>>? command |
+ | | (ID "(")? fun_call |
+ | | command |
+ | ; |
+ | |
+ | This can be done better, so it is not an ideal example, but it |
+ | conveys the principle. |
+ +-------------------------------------------------------------------------+
+
+#122. (Changed in 1.33MR11) Member functions to reset DLG in C++ mode
+
+ void DLGFileReset(FILE *f) { input = f; found_eof = 0; }
+ void DLGStringReset(DLGChar *s) { input = s; p = &input[0]; }
+
+ Supplied by R.A. Nelson (cowboy@VNET.IBM.COM)
+
+#119. (Changed in 1.33MR11) Ambiguity aid for grammars
+
+ The user can ask for additional information on ambiguities reported
+ by antlr to stdout. At the moment, only one ambiguity report can
+ be created in an antlr run.
+
+ This feature is enabled using the "-aa" (Ambiguity Aid) option.
+
+ The following options control the reporting of ambiguities:
+
+ -aa ruleName Selects reporting by name of rule
+ -aa lineNumber Selects reporting by line number
+ (file name not compared)
+
+ -aam Selects "multiple" reporting for a token
+ in the intersection set of the
+ alternatives.
+
+ For instance, the token ID may appear dozens
+ of times in various paths as the program
+ explores the rules which are reachable from
+ the point of an ambiguity. With option -aam
+ every possible path the search program
+ encounters is reported.
+
+ Without -aam only the first encounter is
+ reported. This may result in incomplete
+ information, but the information may be
+ sufficient and much shorter.
+
+ -aad depth Selects the depth of the search.
+ The default value is 1.
+
+ The number of paths to be searched, and the
+ size of the report can grow geometrically
+ with the -ck value if a full search for all
+ contributions to the source of the ambiguity
+ is explored.
+
+ The depth represents the number of tokens
+ in the lookahead set which are matched against
+ the set of ambiguous tokens. A depth of 1
+ means that the search stops when a lookahead
+ sequence of just one token is matched.
+
+ A k=1 ck=6 grammar might generate 5,000 items
+ in a report if a full depth 6 search is made
+ with the Ambiguity Aid. The source of the
+ problem may be in the first token and obscured
+ by the volume of data - I hesitate to call
+ it information.
+
+ When the user selects a depth > 1, the search
+ is first performed at depth=1 for both
+ alternatives, then depth=2 for both alternatives,
+ etc.
+
+ Sample output for rule grammar in antlr.g itself:
+
+ +---------------------------------------------------------------------+
+ | Ambiguity Aid |
+ | |
+ | Choice 1: grammar/70 line 632 file a.g |
+ | Choice 2: grammar/82 line 644 file a.g |
+ | |
+ | Intersection of lookahead[1] sets: |
+ | |
+ | "\}" "class" "#errclass" "#tokclass" |
+ | |
+ | Choice:1 Depth:1 Group:1 ("#errclass") |
+ | 1 in (...)* block grammar/70 line 632 a.g |
+ | 2 to error grammar/73 line 635 a.g |
+ | 3 error error/1 line 894 a.g |
+ | 4 #token "#errclass" error/2 line 895 a.g |
+ | |
+ | Choice:1 Depth:1 Group:2 ("#tokclass") |
+ | 2 to tclass grammar/74 line 636 a.g |
+ | 3 tclass tclass/1 line 937 a.g |
+ | 4 #token "#tokclass" tclass/2 line 938 a.g |
+ | |
+ | Choice:1 Depth:1 Group:3 ("class") |
+ | 2 to class_def grammar/75 line 637 a.g |
+ | 3 class_def class_def/1 line 669 a.g |
+ | 4 #token "class" class_def/3 line 671 a.g |
+ | |
+ | Choice:1 Depth:1 Group:4 ("\}") |
+ | 2 #token "\}" grammar/76 line 638 a.g |
+ | |
+ | Choice:2 Depth:1 Group:5 ("#errclass") |
+ | 1 in (...)* block grammar/83 line 645 a.g |
+ | 2 to error grammar/93 line 655 a.g |
+ | 3 error error/1 line 894 a.g |
+ | 4 #token "#errclass" error/2 line 895 a.g |
+ | |
+ | Choice:2 Depth:1 Group:6 ("#tokclass") |
+ | 2 to tclass grammar/94 line 656 a.g |
+ | 3 tclass tclass/1 line 937 a.g |
+ | 4 #token "#tokclass" tclass/2 line 938 a.g |
+ | |
+ | Choice:2 Depth:1 Group:7 ("class") |
+ | 2 to class_def grammar/95 line 657 a.g |
+ | 3 class_def class_def/1 line 669 a.g |
+ | 4 #token "class" class_def/3 line 671 a.g |
+ | |
+ | Choice:2 Depth:1 Group:8 ("\}") |
+ | 2 #token "\}" grammar/96 line 658 a.g |
+ +---------------------------------------------------------------------+
+
+ For a linear lookahead set ambiguity (where k=1 or for k>1 but
+ when all lookahead sets [i] with i<k all have degree one) the
+ reports appear in the following order:
+
+ for (depth=1 ; depth <= "-aad depth" ; depth++) {
+ for (alternative=1; alternative <=2 ; alternative++) {
+ while (matches-are-found) {
+ group++;
+ print-report
+ };
+ };
+ };
+
+ For reporting a k-tuple ambiguity, the reports appear in the
+ following order:
+
+ for (depth=1 ; depth <= "-aad depth" ; depth++) {
+ while (matches-are-found) {
+ for (alternative=1; alternative <=2 ; alternative++) {
+ group++;
+ print-report
+ };
+ };
+ };
+
+ This is because matches are generated in different ways for
+ linear lookahead and k-tuples.
+
+#117. (Changed in 1.33MR10) new EXPERIMENTAL predicate hoisting code
+
+ The hoisting of predicates into rules to create prediction
+ expressions is a problem in antlr. Consider the following
+ example (k=1 with -prc on):
+
+ start : (a)* "@" ;
+ a : b | c ;
+ b : <<isUpper(LATEXT(1))>>? A ;
+ c : A ;
+
+ Prior to 1.33MR10 the code generated for "start" would resemble:
+
+ while {
+ if (LA(1)==A &&
+ (!LA(1)==A || isUpper())) {
+ a();
+ }
+ };
+
+ This code is wrong because it makes rule "c" unreachable from
+ "start". The essence of the problem is that antlr fails to
+ recognize that there can be a valid alternative within "a" even
+ when the predicate <<isUpper(LATEXT(1))>>? is false.
+
+ In 1.33MR10 with -mrhoist the hoisting of the predicate into
+ "start" is suppressed because it recognizes that "c" can
+ cover all the cases where the predicate is false:
+
+ while {
+ if (LA(1)==A) {
+ a();
+ }
+ };
+
+ With the antlr "-info p" switch the user will receive information
+ about the predicate suppression in the generated file:
+
+ --------------------------------------------------------------
+ #if 0
+
+ Hoisting of predicate suppressed by alternative without predicate.
+ The alt without the predicate includes all cases where
+ the predicate is false.
+
+ WITH predicate: line 7 v1.g
+ WITHOUT predicate: line 7 v1.g
+
+ The context set for the predicate:
+
+ A
+
+ The lookahead set for the alt WITHOUT the semantic predicate:
+
+ A
+
+ The predicate:
+
+ pred << isUpper(LATEXT(1))>>?
+ depth=k=1 rule b line 9 v1.g
+ set context:
+ A
+ tree context: null
+
+ Chain of referenced rules:
+
+ #0 in rule start (line 5 v1.g) to rule a
+ #1 in rule a (line 7 v1.g)
+
+ #endif
+ --------------------------------------------------------------
+
+ A predicate can be suppressed by a combination of alternatives
+ which, taken together, cover a predicate:
+
+ start : (a)* "@" ;
+
+ a : b | ca | cb | cc ;
+
+ b : <<isUpper(LATEXT(1))>>? ( A | B | C ) ;
+
+ ca : A ;
+ cb : B ;
+ cc : C ;
+
+ Consider a more complex example in which "c" covers only part of
+ a predicate:
+
+ start : (a)* "@" ;
+
+ a : b
+ | c
+ ;
+
+ b : <<isUpper(LATEXT(1))>>?
+ ( A
+ | X
+ );
+
+ c : A
+ ;
+
+ Prior to 1.33MR10 the code generated for "start" would resemble:
+
+ while {
+ if ( (LA(1)==A || LA(1)==X) &&
+ (! (LA(1)==A || LA(1)==X) || isUpper()) {
+ a();
+ }
+ };
+
+ With 1.33MR10 and -mrhoist the predicate context is restricted to
+ the non-covered lookahead. The code resembles:
+
+ while {
+ if ( (LA(1)==A || LA(1)==X) &&
+ (! (LA(1)==X) || isUpper()) {
+ a();
+ }
+ };
+
+ With the antlr "-info p" switch the user will receive information
+ about the predicate restriction in the generated file:
+
+ --------------------------------------------------------------
+ #if 0
+
+ Restricting the context of a predicate because of overlap
+ in the lookahead set between the alternative with the
+ semantic predicate and one without
+ Without this restriction the alternative without the predicate
+ could not be reached when input matched the context of the
+ predicate and the predicate was false.
+
+ WITH predicate: line 11 v4.g
+ WITHOUT predicate: line 12 v4.g
+
+ The original context set for the predicate:
+
+ A X
+
+ The lookahead set for the alt WITHOUT the semantic predicate:
+
+ A
+
+ The intersection of the two sets
+
+ A
+
+ The original predicate:
+
+ pred << isUpper(LATEXT(1))>>?
+ depth=k=1 rule b line 15 v4.g
+ set context:
+ A X
+ tree context: null
+
+ The new (modified) form of the predicate:
+
+ pred << isUpper(LATEXT(1))>>?
+ depth=k=1 rule b line 15 v4.g
+ set context:
+ X
+ tree context: null
+
+ #endif
+ --------------------------------------------------------------
+
+ The bad news about -mrhoist:
+
+ (a) -mrhoist does not analyze predicates with lookahead
+ depth > 1.
+
+ (b) -mrhoist does not look past a guarded predicate to
+ find context which might cover other predicates.
+
+ For these cases you might want to use syntactic predicates.
+ When a semantic predicate fails during guess mode the guess
+ fails and the next alternative is tried.
+
+ Limitation (a) is illustrated by the following example:
+
+ start : (stmt)* EOF ;
+
+ stmt : cast
+ | expr
+ ;
+ cast : <<isTypename(LATEXT(2))>>? LP ID RP ;
+
+ expr : LP ID RP ;
+
+ This is not much different from the first example, except that
+ it requires two tokens of lookahead context to determine what
+ to do. This predicate is NOT suppressed because the current version
+ is unable to handle predicates with depth > 1.
+
+ A predicate can be combined with other predicates during hoisting.
+ In those cases the depth=1 predicates are still handled. Thus,
+ in the following example the isUpper() predicate will be suppressed
+ by line #4 when hoisted from "bizarre" into "start", but will still
+ be present in "bizarre" in order to predict "stmt".
+
+ start : (bizarre)* EOF ; // #1
+ // #2
+ bizarre : stmt // #3
+ | A // #4
+ ;
+
+ stmt : cast
+ | expr
+ ;
+
+ cast : <<isTypename(LATEXT(2))>>? LP ID RP ;
+
+ expr : LP ID RP ;
+ | <<isUpper(LATEXT(1))>>? A
+
+ Limitation (b) is illustrated by the following example of a
+ context guarded predicate:
+
+ rule : (A)? <<p>>? // #1
+ (A // #2
+ |B // #3
+ ) // #4
+ | <<q>> B // #5
+ ;
+
+ Recall that this means that when the lookahead is NOT A then
+ the predicate "p" is ignored and it attempts to match "A|B".
+ Ideally, the "B" at line #3 should suppress predicate "q".
+ However, the current version does not attempt to look past
+ the guard predicate to find context which might suppress other
+ predicates.
+
+ In some cases -mrhoist will lead to the reporting of ambiguities
+ which were not visible before:
+
+ start : (a)* "@";
+ a : bc | d;
+ bc : b | c ;
+
+ b : <<isUpper(LATEXT(1))>>? A;
+ c : A ;
+
+ d : A ;
+
+ In this case there is a true ambiguity in "a" between "bc" and "d"
+ which can both match "A". Without -mrhoist the predicate in "b"
+ is hoisted into "a" and there is no ambiguity reported. However,
+ with -mrhoist, the predicate in "b" is suppressed by "c" (as it
+ should be) making the ambiguity in "a" apparent.
+
+ The motivations for these changes were hoisting problems reported
+ by Reinier van den Born (reinier@vnet.ibm.com) and several others.
+
+#113. (Changed in 1.33MR10) new context guarded pred: (g)? && <<p>>? expr
+
+ The existing context guarded predicate:
+
+ rule : (guard)? => <<p>>? expr
+ | next_alternative
+ ;
+
+ generates code which resembles:
+
+ if (lookahead(expr) && (!guard || pred)) {
+ expr()
+ } else ....
+
+ This is not suitable for some applications because it allows
+ expr() to be invoked when the predicate is false. This is
+ intentional because it is meant to mimic automatically computed
+ predicate context.
+
+ The new context guarded predicate uses the guard information
+ differently because it has a different goal. Consider:
+
+ rule : (guard)? && <<p>>? expr
+ | next_alternative
+ ;
+
+ The new style of context guarded predicate is equivalent to:
+
+ rule : <<guard==true && pred>>? expr
+ | next_alternative
+ ;
+
+ It generates code which resembles:
+
+ if (lookahead(expr) && guard && pred) {
+ expr();
+ } else ...
+
+ Both forms of guarded predicates severely restrict the form of
+ the context guard: it can contain no rule references, no
+ (...)*, no (...)+, and no {...}. It may contain token and
+ token class references, and alternation ("|").
+
+ Addition for 1.33MR11: in the token expression all tokens must
+ be at the same height of the token tree:
+
+ (A ( B | C))? && ... is ok (all height 2)
+ (A ( B | ))? && ... is not ok (some 1, some 2)
+ (A B C D | E F G H)? && ... is ok (all height 4)
+ (A B C D | E )? && ... is not ok (some 4, some 1)
+
+ This restriction is required in order to properly compute the lookahead
+ set for expressions like:
+
+ rule1 : (A B C)? && <<pred>>? rule2 ;
+ rule2 : (A|X) (B|Y) (C|Z);
+
+ This addition was suggested by Rienier van den Born (reinier@vnet.ibm.com)
+
+#109. (Changed in 1.33MR10) improved trace information
+
+ The quality of the trace information provided by the "-gd"
+ switch has been improved significantly. Here is an example
+ of the output from a test program. It shows the rule name,
+ the first token of lookahead, the call depth, and the guess
+ status:
+
+ exit rule gusxx {"?"} depth 2
+ enter rule gusxx {"?"} depth 2
+ enter rule gus1 {"o"} depth 3 guessing
+ guess done - returning to rule gus1 {"o"} at depth 3
+ (guess mode continues - an enclosing guess is still active)
+ guess done - returning to rule gus1 {"Z"} at depth 3
+ (guess mode continues - an enclosing guess is still active)
+ exit rule gus1 {"Z"} depth 3 guessing
+ guess done - returning to rule gusxx {"o"} at depth 2 (guess mode ends)
+ enter rule gus1 {"o"} depth 3
+ guess done - returning to rule gus1 {"o"} at depth 3 (guess mode ends)
+ guess done - returning to rule gus1 {"Z"} at depth 3 (guess mode ends)
+ exit rule gus1 {"Z"} depth 3
+ line 1: syntax error at "Z" missing SC
+ ...
+
+ Rule trace reporting is controlled by the value of the integer
+ [zz]traceOptionValue: when it is positive tracing is enabled,
+ otherwise it is disabled. Tracing during guess mode is controlled
+ by the value of the integer [zz]traceGuessOptionValue. When
+ it is positive AND [zz]traceOptionValue is positive rule trace
+ is reported in guess mode.
+
+ The values of [zz]traceOptionValue and [zz]traceGuessOptionValue
+ can be adjusted by subroutine calls listed below.
+
+ Depending on the presence or absence of the antlr -gd switch
+ the variable [zz]traceOptionValueDefault is set to 0 or 1. When
+ the parser is initialized or [zz]traceReset() is called the
+ value of [zz]traceOptionValueDefault is copied to [zz]traceOptionValue.
+ The value of [zz]traceGuessOptionValue is always initialized to 1,
+ but, as noted earlier, nothing will be reported unless
+ [zz]traceOptionValue is also positive.
+
+ When the parser state is saved/restored the value of the trace
+ variables are also saved/restored. If a restore causes a change in
+ reporting behavior from on to off or vice versa this will be reported.
+
+ When the -gd option is selected, the macro "#define zzTRACE_RULES"
+ is added to appropriate output files.
+
+ C++ mode
+ --------
+ int traceOption(int delta)
+ int traceGuessOption(int delta)
+ void traceReset()
+ int traceOptionValueDefault
+
+ C mode
+ --------
+ int zzTraceOption(int delta)
+ int zzTraceGuessOption(int delta)
+ void zzTraceReset()
+ int zzTraceOptionValueDefault
+
+ The argument "delta" is added to the traceOptionValue. To
+ turn on trace when inside a particular rule one:
+
+ rule : <<traceOption(+1);>>
+ (
+ rest-of-rule
+ )
+ <<traceOption(-1);>>
+ ; /* fail clause */ <<traceOption(-1);>>
+
+ One can use the same idea to turn *off* tracing within a
+ rule by using a delta of (-1).
+
+ An improvement in the rule trace was suggested by Sramji
+ Ramanathan (ps@kumaran.com).
+
+#108. A Note on Deallocation of Variables Allocated in Guess Mode
+
+ NOTE
+ ------------------------------------------------------
+ This mechanism only works for heap allocated variables
+ ------------------------------------------------------
+
+ The rewrite of the trace provides the machinery necessary
+ to properly free variables or undo actions following a
+ failed guess.
+
+ The macro zzUSER_GUESS_HOOK(guessSeq,zzrv) is expanded
+ as part of the zzGUESS macro. When a guess is opened
+ the value of zzrv is 0. When a longjmp() is executed to
+ undo the guess, the value of zzrv will be 1.
+
+ The macro zzUSER_GUESS_DONE_HOOK(guessSeq) is expanded
+ as part of the zzGUESS_DONE macro. This is executed
+ whether the guess succeeds or fails as part of closing
+ the guess.
+
+ The guessSeq is a sequence number which is assigned to each
+ guess and is incremented by 1 for each guess which becomes
+ active. It is needed by the user to associate the start of
+ a guess with the failure and/or completion (closing) of a
+ guess.
+
+ Guesses are nested. They must be closed in the reverse
+ of the order that they are opened.
+
+ In order to free memory used by a variable during a guess
+ a user must write a routine which can be called to
+ register the variable along with the current guess sequence
+ number provided by the zzUSER_GUESS_HOOK macro. If the guess
+ fails, all variables tagged with the corresponding guess
+ sequence number should be released. This is ugly, but
+ it would require a major rewrite of antlr 1.33 to use
+ some mechanism other than setjmp()/longjmp().
+
+ The order of calls for a *successful* guess would be:
+
+ zzUSER_GUESS_HOOK(guessSeq,0);
+ zzUSER_GUESS_DONE_HOOK(guessSeq);
+
+ The order of calls for a *failed* guess would be:
+
+ zzUSER_GUESS_HOOK(guessSeq,0);
+ zzUSER_GUESS_HOOK(guessSeq,1);
+ zzUSER_GUESS_DONE_HOOK(guessSeq);
+
+ The default definitions of these macros are empty strings.
+
+ Here is an example in C++ mode. The zzUSER_GUESS_HOOK and
+ zzUSER_GUESS_DONE_HOOK macros and myGuessHook() routine
+ can be used without change in both C and C++ versions.
+
+ ----------------------------------------------------------------------
+ <<
+
+ #include "AToken.h"
+
+ typedef ANTLRCommonToken ANTLRToken;
+
+ #include "DLGLexer.h"
+
+ int main() {
+
+ {
+ DLGFileInput in(stdin);
+ DLGLexer lexer(&in,2000);
+ ANTLRTokenBuffer pipe(&lexer,1);
+ ANTLRCommonToken aToken;
+ P parser(&pipe);
+
+ lexer.setToken(&aToken);
+ parser.init();
+ parser.start();
+ };
+
+ fclose(stdin);
+ fclose(stdout);
+ return 0;
+ }
+
+ >>
+
+ <<
+ char *s=NULL;
+
+ #undef zzUSER_GUESS_HOOK
+ #define zzUSER_GUESS_HOOK(guessSeq,zzrv) myGuessHook(guessSeq,zzrv);
+ #undef zzUSER_GUESS_DONE_HOOK
+ #define zzUSER_GUESS_DONE_HOOK(guessSeq) myGuessHook(guessSeq,2);
+
+ void myGuessHook(int guessSeq,int zzrv) {
+ if (zzrv == 0) {
+ fprintf(stderr,"User hook: starting guess #%d\n",guessSeq);
+ } else if (zzrv == 1) {
+ free (s);
+ s=NULL;
+ fprintf(stderr,"User hook: failed guess #%d\n",guessSeq);
+ } else if (zzrv == 2) {
+ free (s);
+ s=NULL;
+ fprintf(stderr,"User hook: ending guess #%d\n",guessSeq);
+ };
+ }
+
+ >>
+
+ #token A "a"
+ #token "[\t \ \n]" <<skip();>>
+
+ class P {
+
+ start : (top)+
+ ;
+
+ top : (which) ? <<fprintf(stderr,"%s is a which\n",s); free(s); s=NULL; >>
+ | other <<fprintf(stderr,"%s is an other\n",s); free(s); s=NULL; >>
+ ; <<if (s != NULL) free(s); s=NULL; >>
+
+ which : which2
+ ;
+
+ which2 : which3
+ ;
+ which3
+ : (label)? <<fprintf(stderr,"%s is a label\n",s);>>
+ | (global)? <<fprintf(stderr,"%s is a global\n",s);>>
+ | (exclamation)? <<fprintf(stderr,"%s is an exclamation\n",s);>>
+ ;
+
+ label : <<s=strdup(LT(1)->getText());>> A ":" ;
+
+ global : <<s=strdup(LT(1)->getText());>> A "::" ;
+
+ exclamation : <<s=strdup(LT(1)->getText());>> A "!" ;
+
+ other : <<s=strdup(LT(1)->getText());>> "other" ;
+
+ }
+ ----------------------------------------------------------------------
+
+ This is a silly example, but illustrates the idea. For the input
+ "a ::" with tracing enabled the output begins:
+
+ ----------------------------------------------------------------------
+ enter rule "start" depth 1
+ enter rule "top" depth 2
+ User hook: starting guess #1
+ enter rule "which" depth 3 guessing
+ enter rule "which2" depth 4 guessing
+ enter rule "which3" depth 5 guessing
+ User hook: starting guess #2
+ enter rule "label" depth 6 guessing
+ guess failed
+ User hook: failed guess #2
+ guess done - returning to rule "which3" at depth 5 (guess mode continues
+ - an enclosing guess is still active)
+ User hook: ending guess #2
+ User hook: starting guess #3
+ enter rule "global" depth 6 guessing
+ exit rule "global" depth 6 guessing
+ guess done - returning to rule "which3" at depth 5 (guess mode continues
+ - an enclosing guess is still active)
+ User hook: ending guess #3
+ enter rule "global" depth 6 guessing
+ exit rule "global" depth 6 guessing
+ exit rule "which3" depth 5 guessing
+ exit rule "which2" depth 4 guessing
+ exit rule "which" depth 3 guessing
+ guess done - returning to rule "top" at depth 2 (guess mode ends)
+ User hook: ending guess #1
+ enter rule "which" depth 3
+ .....
+ ----------------------------------------------------------------------
+
+ Remember:
+
+ (a) Only init-actions are executed during guess mode.
+ (b) A rule can be invoked multiple times during guess mode.
+ (c) If the guess succeeds the rule will be called once more
+ without guess mode so that normal actions will be executed.
+ This means that the init-action might need to distinguish
+ between guess mode and non-guess mode using the variable
+ [zz]guessing.
+
+#101. (Changed in 1.33MR10) antlr -info command line switch
+
+ -info
+
+ p - extra predicate information in generated file
+
+ t - information about tnode use:
+ at the end of each rule in generated file
+ summary on stderr at end of program
+
+ m - monitor progress
+ prints name of each rule as it is started
+ flushes output at start of each rule
+
+ f - first/follow set information to stdout
+
+ 0 - no operation (added in 1.33MR11)
+
+ The options may be combined and may appear in any order.
+ For example:
+
+ antlr -info ptm -CC -gt -mrhoist on mygrammar.g
+
+#100a. (Changed in 1.33MR10) Predicate tree simplification
+
+ When the same predicates can be referenced in more than one
+ alternative of a block large predicate trees can be formed.
+
+ The difference that these optimizations make is so dramatic
+ that I have decided to use it even when -mrhoist is not selected.
+
+ Consider the following grammar:
+
+ start : ( all )* ;
+
+ all : a
+ | d
+ | e
+ | f
+ ;
+
+ a : c A B
+ | c A C
+ ;
+
+ c : <<AAA(LATEXT(2))>>?
+ ;
+
+ d : <<BBB(LATEXT(2))>>? B C
+ ;
+
+ e : <<CCC(LATEXT(2))>>? B C
+ ;
+
+ f : e X Y
+ ;
+
+ In rule "a" there is a reference to rule "c" in both alternatives.
+ The length of the predicate AAA is k=2 and it can be followed in
+ alternative 1 only by (A B) while in alternative 2 it can be
+ followed only by (A C). Thus they do not have identical context.
+
+ In rule "all" the alternatives which refer to rules "e" and "f" allow
+ elimination of the duplicate reference to predicate CCC.
+
+ The table below summarized the kind of simplification performed by
+ 1.33MR10. In the table, X and Y stand for single predicates
+ (not trees).
+
+ (OR X (OR Y (OR Z))) => (OR X Y Z)
+ (AND X (AND Y (AND Z))) => (AND X Y Z)
+
+ (OR X (... (OR X Y) ... )) => (OR X (... Y ... ))
+ (AND X (... (AND X Y) ... )) => (AND X (... Y ... ))
+ (OR X (... (AND X Y) ... )) => (OR X (... ... ))
+ (AND X (... (OR X Y) ... )) => (AND X (... ... ))
+
+ (AND X) => X
+ (OR X) => X
+
+ In a test with a complex grammar for a real application, a predicate
+ tree with six OR nodes and 12 leaves was reduced to "(OR X Y Z)".
+
+ In 1.33MR10 there is a greater effort to release memory used
+ by predicates once they are no longer in use.
+
+#100b. (Changed in 1.33MR10) Suppression of extra predicate tests
+
+ The following optimizations require that -mrhoist be selected.
+
+ It is relatively easy to optimize the code generated for predicate
+ gates when they are of the form:
+
+ (AND X Y Z ...)
+ or (OR X Y Z ...)
+
+ where X, Y, Z, and "..." represent individual predicates (leaves) not
+ predicate trees.
+
+ If the predicate is an AND the contexts of the X, Y, Z, etc. are
+ ANDed together to create a single Tree context for the group and
+ context tests for the individual predicates are suppressed:
+
+ --------------------------------------------------
+ Note: This was incorrect. The contexts should be
+ ORed together. This has been fixed. A more
+ complete description is available in item #152.
+ ---------------------------------------------------
+
+ Optimization 1: (AND X Y Z ...)
+
+ Suppose the context for Xtest is LA(1)==LP and the context for
+ Ytest is LA(1)==LP && LA(2)==ID.
+
+ Without the optimization the code would resemble:
+
+ if (lookaheadContext &&
+ !(LA(1)==LP && LA(1)==LP && LA(2)==ID) ||
+ ( (! LA(1)==LP || Xtest) &&
+ (! (LA(1)==LP || LA(2)==ID) || Xtest)
+ )) {...
+
+ With the -mrhoist optimization the code would resemble:
+
+ if (lookaheadContext &&
+ ! (LA(1)==LP && LA(2)==ID) || (Xtest && Ytest) {...
+
+ Optimization 2: (OR X Y Z ...) with identical contexts
+
+ Suppose the context for Xtest is LA(1)==ID and for Ytest
+ the context is also LA(1)==ID.
+
+ Without the optimization the code would resemble:
+
+ if (lookaheadContext &&
+ ! (LA(1)==ID || LA(1)==ID) ||
+ (LA(1)==ID && Xtest) ||
+ (LA(1)==ID && Ytest) {...
+
+ With the -mrhoist optimization the code would resemble:
+
+ if (lookaheadContext &&
+ (! LA(1)==ID) || (Xtest || Ytest) {...
+
+ Optimization 3: (OR X Y Z ...) with distinct contexts
+
+ Suppose the context for Xtest is LA(1)==ID and for Ytest
+ the context is LA(1)==LP.
+
+ Without the optimization the code would resemble:
+
+ if (lookaheadContext &&
+ ! (LA(1)==ID || LA(1)==LP) ||
+ (LA(1)==ID && Xtest) ||
+ (LA(1)==LP && Ytest) {...
+
+ With the -mrhoist optimization the code would resemble:
+
+ if (lookaheadContext &&
+ (zzpf=0,
+ (LA(1)==ID && (zzpf=1) && Xtest) ||
+ (LA(1)==LP && (zzpf=1) && Ytest) ||
+ !zzpf) {
+
+ These may appear to be of similar complexity at first,
+ but the non-optimized version contains two tests of each
+ context while the optimized version contains only one
+ such test, as well as eliminating some of the inverted
+ logic (" !(...) || ").
+
+ Optimization 4: Computation of predicate gate trees
+
+ When generating code for the gates of predicate expressions
+ antlr 1.33 vanilla uses a recursive procedure to generate
+ "&&" and "||" expressions for testing the lookahead. As each
+ layer of the predicate tree is exposed a new set of "&&" and
+ "||" expressions on the lookahead are generated. In many
+ cases the lookahead being tested has already been tested.
+
+ With -mrhoist a lookahead tree is computed for the entire
+ lookahead expression. This means that predicates with identical
+ context or context which is a subset of another predicate's
+ context disappear.
+
+ This is especially important for predicates formed by rules
+ like the following:
+
+ upperCaseVowel : <<isUpperCase(LATEXT(1))>>? vowel;
+ vowel: : <<isVowel(LATEXT(1))>>? LETTERS;
+
+ These predicates are combined using AND since both must be
+ satisfied for rule upperCaseVowel. They have identical
+ context which makes this optimization very effective.
+
+ The affect of Items #100a and #100b together can be dramatic. In
+ a very large (but real world) grammar one particular predicate
+ expression was reduced from an (unreadable) 50 predicate leaves,
+ 195 LA(1) terms, and 5500 characters to an (easily comprehensible)
+ 3 predicate leaves (all different) and a *single* LA(1) term.
+
+#98. (Changed in 1.33MR10) Option "-info p"
+
+ When the user selects option "-info p" the program will generate
+ detailed information about predicates. If the user selects
+ "-mrhoist on" additional detail will be provided explaining
+ the promotion and suppression of predicates. The output is part
+ of the generated file and sandwiched between #if 0/#endif statements.
+
+ Consider the following k=1 grammar:
+
+ start : ( all ) * ;
+
+ all : ( a
+ | b
+ )
+ ;
+
+ a : c B
+ ;
+
+ c : <<LATEXT(1)>>?
+ | B
+ ;
+
+ b : <<LATEXT(1)>>? X
+ ;
+
+ Below is an excerpt of the output for rule "start" for the three
+ predicate options (off, on, and maintenance release style hoisting).
+
+ For those who do not wish to use the "-mrhoist on" option for code
+ generation the option can be used in a "diagnostic" mode to provide
+ valuable information:
+
+ a. where one should insert null actions to inhibit hoisting
+ b. a chain of rule references which shows where predicates are
+ being hoisted
+
+ ======================================================================
+ Example of "-info p" with "-mrhoist on"
+ ======================================================================
+ #if 0
+
+ Hoisting of predicate suppressed by alternative without predicate.
+ The alt without the predicate includes all cases where the
+ predicate is false.
+
+ WITH predicate: line 11 v36.g
+ WITHOUT predicate: line 12 v36.g
+
+ The context set for the predicate:
+
+ B
+
+ The lookahead set for alt WITHOUT the semantic predicate:
+
+ B
+
+ The predicate:
+
+ pred << LATEXT(1)>>? depth=k=1 rule c line 11 v36.g
+
+ set context:
+ B
+ tree context: null
+
+ Chain of referenced rules:
+
+ #0 in rule start (line 1 v36.g) to rule all
+ #1 in rule all (line 3 v36.g) to rule a
+ #2 in rule a (line 8 v36.g) to rule c
+ #3 in rule c (line 11 v36.g)
+
+ #endif
+ &&
+ #if 0
+
+ pred << LATEXT(1)>>? depth=k=1 rule b line 15 v36.g
+
+ set context:
+ X
+ tree context: null
+
+ #endif
+ ======================================================================
+ Example of "-info p" with the default -prc setting ( "-prc off")
+ ======================================================================
+ #if 0
+
+ OR
+ pred << LATEXT(1)>>? depth=k=1 rule c line 11 v36.g
+
+ set context:
+ nil
+ tree context: null
+
+ pred << LATEXT(1)>>? depth=k=1 rule b line 15 v36.g
+
+ set context:
+ nil
+ tree context: null
+
+ #endif
+ ======================================================================
+ Example of "-info p" with "-prc on" and "-mrhoist off"
+ ======================================================================
+ #if 0
+
+ OR
+ pred << LATEXT(1)>>? depth=k=1 rule c line 11 v36.g
+
+ set context:
+ B
+ tree context: null
+
+ pred << LATEXT(1)>>? depth=k=1 rule b line 15 v36.g
+
+ set context:
+ X
+ tree context: null
+
+ #endif
+ ======================================================================
+
+#60. (Changed in 1.33MR7) Major changes to exception handling
+
+ There were significant problems in the handling of exceptions
+ in 1.33 vanilla. The general problem is that it can only
+ process one level of exception handler. For example, a named
+ exception handler, an exception handler for an alternative, or
+ an exception for a subrule always went to the rule's exception
+ handler if there was no "catch" which matched the exception.
+
+ In 1.33MR7 the exception handlers properly "nest". If an
+ exception handler does not have a matching "catch" then the
+ nextmost outer exception handler is checked for an appropriate
+ "catch" clause, and so on until an exception handler with an
+ appropriate "catch" is found.
+
+ There are still undesirable features in the way exception
+ handlers are implemented, but I do not have time to fix them
+ at the moment:
+
+ The exception handlers for alternatives are outside the
+ block containing the alternative. This makes it impossible
+ to access variables declared in a block or to resume the
+ parse by "falling through". The parse can still be easily
+ resumed in other ways, but not in the most natural fashion.
+
+ This results in an inconsistency between named exception
+ handlers and exception handlers for alternatives. When
+ an exception handler for an alternative "falls through"
+ it goes to the nextmost outer handler - not the "normal
+ action".
+
+ A major difference between 1.33MR7 and 1.33 vanilla is
+ the default action after an exception is caught:
+
+ 1.33 Vanilla
+ ------------
+ In 1.33 vanilla the signal value is set to zero ("NoSignal")
+ and the code drops through to the code following the exception.
+ For named exception handlers this is the "normal action".
+ For alternative exception handlers this is the rule's handler.
+
+ 1.33MR7
+ -------
+ In 1.33MR7 the signal value is NOT automatically set to zero.
+
+ There are two cases:
+
+ For named exception handlers: if the signal value has been
+ set to zero the code drops through to the "normal action".
+
+ For all other cases the code branches to the nextmost outer
+ exception handler until it reaches the handler for the rule.
+
+ The following macros have been defined for convenience:
+
+ C/C++ Mode Name
+ --------------------
+ (zz)suppressSignal
+ set signal & return signal arg to 0 ("NoSignal")
+ (zz)setSignal(intValue)
+ set signal & return signal arg to some value
+ (zz)exportSignal
+ copy the signal value to the return signal arg
+
+ I'm not sure why PCCTS make a distinction between the local
+ signal value and the return signal argument, but I'm loathe
+ to change the code. The burden of copying the local signal
+ value to the return signal argument can be given to the
+ default signal handler, I suppose.
+
+#53. (Explanation for 1.33MR6) What happens after an exception is caught ?
+
+ The Book is silent about what happens after an exception
+ is caught.
+
+ The following code fragment prints "Error Action" followed
+ by "Normal Action".
+
+ test : Word ex:Number <<printf("Normal Action\n");>>
+ exception[ex]
+ catch NoViableAlt:
+ <<printf("Error Action\n");>>
+ ;
+
+ The reason for "Normal Action" is that the normal flow of the
+ program after a user-written exception handler is to "drop through".
+ In the case of an exception handler for a rule this results in
+ the execution of a "return" statement. In the case of an
+ exception handler attached to an alternative, rule, or token
+ this is the code that would have executed had there been no
+ exception.
+
+ The user can achieve the desired result by using a "return"
+ statement.
+
+ test : Word ex:Number <<printf("Normal Action\n");>>
+ exception[ex]
+ catch NoViableAlt:
+ <<printf("Error Action\n"); return;>>
+ ;
+
+ The most powerful mechanism for recovery from parse errors
+ in pccts is syntactic predicates because they provide
+ backtracking. Exceptions allow "return", "break",
+ "consumeUntil(...)", "goto _handler", "goto _fail", and
+ changing the _signal value.
+
+#41. (Added in 1.33MR6) antlr -stdout
+
+ Using "antlr -stdout ..." forces the text that would
+ normally go to the grammar.c or grammar.cpp file to
+ stdout.
+
+#40. (Added in 1.33MR6) antlr -tab to change tab stops
+
+ Using "antlr -tab number ..." changes the tab stops
+ for the grammar.c or grammar.cpp file. The number
+ must be between 0 and 8. Using 0 gives tab characters,
+ values between 1 and 8 give the appropriate number of
+ space characters.
+
+#34. (Added to 1.33MR1) Add public DLGLexerBase::set_line(int newValue)
+
+ Previously there was no public function for changing the line
+ number maintained by the lexer.
+
+#28. (Added to 1.33MR1) More control over DLG header
+
+ Version 1.33MR1 adds the following directives to PCCTS
+ for C++ mode:
+
+ #lexprefix <<source code>>
+
+ Adds source code to the DLGLexer.h file
+ after the #include "DLexerBase.h" but
+ before the start of the class definition.
+
+ #lexmember <<source code>>
+
+ Adds source code to the DLGLexer.h file
+ as part of the DLGLexer class body. It
+ appears immediately after the start of
+ the class and a "public: statement.
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/KNOWN_PROBLEMS.txt b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/KNOWN_PROBLEMS.txt
new file mode 100644
index 000000000..539cf7752
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/KNOWN_PROBLEMS.txt
@@ -0,0 +1,241 @@
+
+ =======================================================
+ Known Problems In PCCTS - Last revised 14 November 1998
+ =======================================================
+
+#17. The dlg fix for handling characters up to 255 is incorrect.
+
+ See item #207.
+
+ Reported by Frank Hartmann.
+
+#16. A note about "&&" predicates (Mike Dimmick)
+
+ Mike Dimmick has pointed out a potential pitfall in the use of the
+ "&&" style predicate. Consider:
+
+ r0: (g)? => <<P>>? r1
+ | ...
+ ;
+ r1: A | B;
+
+ If the context guard g is not a subset of the lookahead context for r1
+ (in other words g is neither A nor B) then the code may execute r1
+ even when the lookahead context is not satisfied. This is an error
+ by the person coding the grammar, and the error should be reported to
+ the user, but it isn't. expect. Some examples I've run seem to
+ indicate that such an error actually results in the rule becoming
+ unreachable.
+
+ When g is properly coded the code is correct, the problem is when g
+ is not properly coded.
+
+ A second problem reported by Mike Dimmick is that the test for a
+ failed validation predicate is equivalent to a test on the predicate
+ along. In other words, if the "&&" has not been hoisted then it may
+ falsely report a validation error.
+
+#15. (Changed in MR23) Warning for LT(i), LATEXT(i) in token match actions
+
+ An bug (or at least an oddity) is that a reference to LT(1), LA(1),
+ or LATEXT(1) in an action which immediately follows a token match
+ in a rule refers to the token matched, not the token which is in
+ the lookahead buffer. Consider:
+
+ r : abc <<action alpha>> D <<action beta>> E;
+
+ In this case LT(1) in action alpha will refer to the next token in
+ the lookahead buffer ("D"), but LT(1) in action beta will refer to
+ the token matched by D - the preceding token.
+
+ A warning has been added which warns users about this when an action
+ following a token match contains a reference to LT(1), LA(1), or LATEXT(1).
+
+ This behavior should be changed, but it appears in too many programs
+ now. Another problem, perhaps more significant, is that the obvious
+ fix (moving the consume() call to before the action) could change the
+ order in which input is requested and output appears in existing programs.
+
+ This problem was reported, along with a fix by Benjamin Mandel
+ (beny@sd.co.il). However, I felt that changing the behavior was too
+ dangerous for existing code.
+
+#14. Parsing bug in dlg
+
+ THM: I have been unable to reproduce this problem.
+
+ Reported by Rick Howard Mijenix Corporation (rickh@mijenix.com).
+
+ The regular expression parser (in rexpr.c) fails while
+ trying to parse the following regular expression:
+
+ {[a-zA-Z]:}(\\\\[a-zA-Z0-9]*)+
+
+ See my comment in the following excerpt from rexpr.c:
+
+ /*
+ * <regExpr> ::= <andExpr> ( '|' {<andExpr>} )*
+ *
+ * Return -1 if syntax error
+ * Return 0 if none found
+ * Return 1 if a regExrp was found
+ */
+ static
+ regExpr(g)
+ GraphPtr g;
+ {
+ Graph g1, g2;
+
+ if ( andExpr(&g1) == -1 )
+ {
+ return -1;
+ }
+
+ while ( token == '|' )
+ {
+ int a;
+ next();
+ a = andExpr(&g2);
+ if ( a == -1 ) return -1; /* syntax error below */
+ else if ( !a ) return 1; /* empty alternative */
+ g1 = BuildNFA_AorB(g1, g2);
+ }
+
+ if ( token!='\0' ) return -1;
+ *****
+ ***** It appears to fail here becuause token is 125 - the closing '}'
+ ***** If I change it to:
+ ***** if ( token!='\0' && token!='}' && token!= ')' ) return -1;
+ *****
+ ***** It succeeds, but I'm not sure this is the corrrect approach.
+ *****
+ *g = g1;
+ return 1;
+ }
+
+#13. dlg reports an invalid range for: [\0x00-\0xff]
+
+ Diagnosed by Piotr Eljasiak (eljasiak@no-spam.zt.gdansk.tpsa.pl):
+
+ Fixed in MR16.
+
+#12. Strings containing comment actions
+
+ Sequences that looked like C style comments appearing in string
+ literals are improperly parsed by antlr/dlg.
+
+ << fprintf(out," /* obsolete */ ");
+
+ For this case use:
+
+ << fprintf(out," \/\* obsolete \*\/ ");
+
+ Reported by K.J. Cummings (cummings@peritus.com).
+
+#11. User hook for deallocation of variables on guess fail
+
+ The mechanism outlined in Item #108 works only for
+ heap allocated variables.
+
+#10. Label re-initialization in ( X {y:Y} )*
+
+ If a label assignment is optional and appears in a
+ (...)* or (...)+ block it will not be reset to NULL
+ when it is skipped by a subsequent iteration.
+
+ Consider the example:
+
+ ( X { y:Y })* Z
+
+ with input:
+
+ X Y X Z
+
+ The first time through the block Y will be matched and
+ y will be set to point to the token. On the second
+ iteration of the (...)* block there is no match for Y.
+ But y will not be reset to NULL, as the user might
+ expect, it will contain a reference to the Y that was
+ matched in the first iteration.
+
+ The work-around is to manually reset y:
+
+ ( X << y = NULL; >> { y:Y } )* Z
+
+ or
+
+ ( X ( y:Y | << y = NULL; >> /* epsilon */ ) )* Z
+
+ Reported by Jeff Vincent (JVincent@novell.com).
+
+#9. PCCTAST.h PCCTSAST::setType() is a noop
+
+#8. #tokdefs with ~Token and .
+
+ THM: I have been unable to reproduce this problem.
+
+ When antlr uses #tokdefs to define tokens the fields of
+ #errclass and #tokclass do not get properly defined.
+ When it subsequently attempts to take the complement of
+ the set of tokens (using ~Token or .) it can refer to
+ tokens which don't have names, generating a fatal error.
+
+#7. DLG crashes on some invalid inputs
+
+ THM: In MR20 have fixed the most common cases.
+
+ The following token definition will cause DLG to crash.
+
+ #token "()"
+
+ Reported by Mengue Olivier (dolmen@bigfoot.com).
+
+#6. On MS systems \n\r is treated as two new lines
+
+ Fixed.
+
+#5. Token expressions in #tokclass
+
+ #errclass does not support TOK1..TOK2 or ~TOK syntax.
+ #tokclass does not support ~TOKEN syntax
+
+ A workaround for #errclass TOK1..TOK2 is to use a
+ #tokclass.
+
+ Reported by Dave Watola (dwatola@amtsun.jpl.nasa.gov)
+
+#4. A #tokdef must appear "early" in the grammar file.
+
+ The "early" section of the grammar file is the only
+ place where the following directives may appear:
+
+ #header
+ #first
+ #tokdefs
+ #parser
+
+ Any other kind of statement signifiies the end of the
+ "early" section.
+
+#3. Use of PURIFY macro for C++ mode
+
+ Item #93 of the CHANGES_FROM_1.33 describes the use of
+ the PURIFY macro to zero arguments to be passed by
+ upward inheritance.
+
+ #define PURIFY(r, s) memset((char *) &(r), '\0', (s));
+
+ This may not be the right thing to do for C++ objects that
+ have constructors. Reported by Bonny Rais (bonny@werple.net.au).
+
+ For those cases one should #define PURIFY to be an empty macro
+ in the #header or #first actions.
+
+#2. Fixed in 1.33MR10 - See CHANGES_FROM_1.33 Item #80.
+
+#1. The quality of support for systems with 8.3 file names leaves
+ much to be desired. Since the kit is distributed using the
+ long file names and the make file uses long file names it requires
+ some effort to generate. This will probably not be changed due
+ to the large number of systems already written using the long
+ file names.
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/MPW_Read_Me b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/MPW_Read_Me
new file mode 100644
index 000000000..70a9d1bca
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/MPW_Read_Me
@@ -0,0 +1,21 @@
+
+1. You can control the creator type of generated files by changing a value of
+ #if control statement.
+
+
+ pccts:h:pcctscfg.h
+
+ line 225-231
+
+ #if 0
+ #define MAC_FILE_CREATOR 'MPS ' /* MPW Text files */
+ #endif
+ #if 0
+ #define MAC_FILE_CREATOR 'KAHL' /* THINK C/Symantec C++ Text files */
+ #endif
+ #if 0
+ #define MAC_FILE_CREATOR 'CWIE' /* Metrowerks C/C++ Text files */
+ #endif
+
+2. If you want to build 68K version. You must convert all source files to Macintosh
+ format before compile.
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/Makefile b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/Makefile
new file mode 100644
index 000000000..57eeda593
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/Makefile
@@ -0,0 +1,15 @@
+#
+# Main makefile for PCCTS 1.33MR33 /* MRXXX */
+#
+pccts:
+ pushd . & cd antlr & $(MAKE) /nologo /f AntlrMS.mak & popd
+ pushd . & cd dlg & $(MAKE) /nologo /f DlgMS.mak & popd
+
+clean:
+ pushd . & cd antlr & $(MAKE) /nologo /f AntlrMS.mak clean & popd
+ pushd . & cd dlg & $(MAKE) /nologo /f DlgMS.mak clean & popd
+
+cleanall:
+ pushd . & cd antlr & $(MAKE) /nologo /f AntlrMS.mak cleanall & popd
+ pushd . & cd dlg & $(MAKE) /nologo /f DlgMS.mak cleanall & popd
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/NOTES.bcc b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/NOTES.bcc
new file mode 100644
index 000000000..1ac05b17c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/NOTES.bcc
@@ -0,0 +1,184 @@
+March 95
+Version 1.32 of pccts
+
+At the moment this file is available via anonymous FTP at
+
+ Node: marvin.ecn.purdue.edu
+ File: pub/pccts/1.32/NOTES.BCC
+
+Mail corrections or additions to David Seidel <71333.1575@compuserve.com>
+===============================================================================
+Notes on Building PCCTS 1.32 with Borland C++
+
+David Seidel, Innovative Data Concepts Incorporated
+CompuServe: 71333,1575
+Internet: 71333.1575@compuserve.com
+ dseidel@delphi.com
+
+I have gotten ANTLR and DLG to succesfully build with BCC 4.0, but have found
+from experience that ANTLR, in particular, is likely to run out of memory
+with grammars over a certain size, or with larger values for the -k and -ck
+options. Now that BCC 4.02 and the new Borland Power Pack for DOS is now
+available, I feel that there is no excuse not to build these tools as
+32-bit executables, as they ought to be.
+
+For people without the Power Pack, the makefiles below should be fairly easily
+modified to build 16-bit real-mode executables, but I don't really recommend
+it. As an alternative, you might consider the highly regarded DJGPP compiler
+(a DOS port of the Gnu GCC compiler, with a DOS extender included). Hopefully
+some other PCCTS who has DJGPP can provode whatever advice is necessary. The
+Watcom compiler is also an excellent possibility (albeit a commercial one),
+and I hope to make available Watcom makefiles in the near future.
+
+Here are the makefiles I am using. Both makefiles use a compiler configuration
+file that contains compiler switches such as optimization settings. I call
+this file bor32.cfg and keep a copy in both the ANTLR and DLG subdirectories.
+
+==== File: bor32.cfg (cut here) ===============================================
+-w-
+-RT-
+-x-
+-N-
+-k-
+-d
+-O2-e-l
+-Z
+-D__STDC__=1
+==== End of file bor32.cfg (cut here) =========================================
+
+==== File: antlr\bor32.mak (cut here) =========================================
+#
+# ANTLR 1.32 Makefile for Borland C++ 4.02 with DPMI 32-bit DOS extender by
+# David Seidel
+# Innovative Data Concepts Incorporated
+# 71333.1575@compuserve.com (or) dseidel@delphi.com
+#
+# Notes: 1. Compiler switches (optimization etc.) are contained in the
+# file bor32.cfg.
+# 2. This makefile requires Borland C++ 4.02 or greater with
+# the DOS Power Pack add-on package.
+# 3. Change the BCCDIR macro below to the topmost directory in
+# which BCC is installed on your system.
+#
+
+BCCDIR = d:\bc4
+CC = bcc32
+SET = ..\support\set
+PCCTS_H = ..\h
+ANTLR = ..\bin\antlr
+DLG = ..\bin\dlg
+CFLAGS = -I$(BCCDIR)\include -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN \
+ +bor32.cfg
+LIBS = dpmi32 cw32
+OBJ_EXT = obj
+OBJS = antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj fset.obj \
+ gen.obj globals.obj hash.obj lex.obj main.obj misc.obj pred.obj dialog.obj \
+ set.obj
+
+.c.obj:
+ $(CC) -c $(CFLAGS) {$&.c }
+
+antlr.exe: $(OBJS)
+ tlink32 @&&|
+-Tpe -ax -c -s -L$(BCCDIR)\lib +
+$(BCCDIR)\lib\c0x32 $**
+$@
+
+$(LIBS)
+;
+|
+ copy *.exe ..\bin
+
+
+# *********** Target list of PC machines ***********
+#
+# Don't worry about the ambiguity messages coming from antlr
+# for making antlr.c etc... [should be 10 of them, I think]
+#
+
+# leave this commented out for initial build!
+#antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
+# $(ANTLR) antlr.g
+
+antlr.$(OBJ_EXT): antlr.c mode.h tokens.h
+
+scan.$(OBJ_EXT): scan.c mode.h tokens.h
+
+# leave this commented out for initial build!
+#scan.c mode.h: parser.dlg
+# $(DLG) -C2 parser.dlg scan.c
+
+set.$(OBJ_EXT): $(SET)\set.c
+ $(CC) -c $(CFLAGS) $(SET)\set.c
+
+==== End of file antlr\bor32.mak (cut here) ===================================
+
+==== File: dlg\bor32.mak (cut here) ===========================================
+#
+# DLG 1.32 Makefile for Borland C++ 4.02 with DPMI 32-bit DOS extender by
+# David Seidel
+# Innovative Data Concepts Incorporated
+# 71333.1575@compuserve.com (or) dseidel@delphi.com
+#
+# Notes: 1. Compiler switches (optimization etc.) are contained in the
+# file bor32.cfg.
+# 2. This makefile requires Borland C++ 4.02 or greater with
+# the DOS Power Pack add-on package.
+# 3. Change the BCCDIR macro below to the topmost directory in
+# which BCC is installed on your system.
+#
+
+
+BCCDIR = d:\bc4
+CC = bcc32
+SET = ..\support\set
+PCCTS_H = ..\h
+ANTLR = ..\bin\antlr
+DLG = ..\bin\dlg
+CFLAGS = -I$(BCCDIR)\include -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN \
+ +bor32.cfg
+LIBS = dpmi32 cw32
+OBJ_EXT = obj
+OBJS = dlg_p.obj dlg_a.obj main.obj err.obj support.obj \
+ output.obj relabel.obj automata.obj set.obj
+
+.c.obj:
+ $(CC) -c $(CFLAGS) {$&.c }
+
+dlg.exe : $(OBJS)
+ tlink32 @&&|
+-Tpe -ax -c -s -L$(BCCDIR)\lib +
+c0x32 $**
+$@
+
+$(LIBS)
+;
+|
+ copy *.exe ..\bin
+
+dlg_p.obj: dlg_p.c
+
+dlg_a.obj: dlg_a.c
+
+main.obj: main.c
+
+err.obj: err.c
+
+support.obj: support.c
+
+output.obj: output.c
+
+relabel.obj: relabel.c
+
+automata.obj: automata.c
+
+set.$(OBJ_EXT): $(SET)\set.c
+ $(CC) -c $(CFLAGS) $(SET)\set.c
+
+==== End of file dlg\bor32.mak (cut here) =====================================
+
+
+
+
+
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/NOTES.msvc b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/NOTES.msvc
new file mode 100644
index 000000000..86f8ed66e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/NOTES.msvc
@@ -0,0 +1,189 @@
+
+ Microsoft Visual C Stuff
+
+
+[Tom Moog 2-Oct-98
+
+ Users of Microsoft Visual C++ should download a separate
+ ready-to-run zip file from my web site. It contains
+ binaries, static library, and a sample project.
+]
+
+[
+ Two notes added by Tom Moog 23-Sep-97. I believe the *.dsp and
+ *.mak files that were once at the end of this file are now obsolete.
+
+ The following MSVC .dsp and .mak files for pccts and sorcerer
+ were contributed by Stanislaw Bochnak (S.Bochnak@microtool.com.pl)
+ and Jeff Vincent (jvincent@novell.com)
+
+ PCCTS Distribution Kit
+ ----------------------
+ pccts/antlr/AntlrMSVC50.dsp
+ pccts/antlr/AntlrMSVC50.mak
+
+ pccts/dlg/DlgMSVC50.dsp
+ pccts/dlg/DlgMSVC50.mak
+
+ pccts/support/genmk/watgenmk.mak
+ pccts/support/msvc.dsp
+
+ Sorcerer Distribution Kit
+ -------------------------
+ pccts/sorcerer/SorcererMSVC50.dsp
+ pccts/sorcerer/SorcererMSVC50.mak
+
+ pccts/sorcerer/lib/msvc.dsp
+
+ I do not have an MS based computer. If you discover problems
+ please report them so as to save trouble for others in the future.
+]
+
+[
+ Modified by Terence Parr (September 1995) to change .C to .cpp
+]
+
+[
+ This file contains notes on MSVC for Windows NT console execs by Dave
+ Seidel and an explanation of flags etc.. by John Hall; good luck,
+ Terence
+]
+
+===============================================================================
+Date: Sat, 31 Dec 1994 11:40:36 -0500 (EST)
+From: David Seidel <75342.2034@compuserve.com>
+
+I've succesfully build 1.31b3 with djgpp for DOS and MSVC 2.0 for Windows
+NT. The only (minor) problem I had was that GNU make (version 3.71, in the
+djgpp port) complained about "multiple targets" in both the antlr and dlg
+makefiles. I got around the error by, in each makefile, commenting out the
+$(SRC) dependency, for example:
+
+ antlr: $(OBJ) #$(SRC)
+
+I don't know why this is happenning, since you haven't changed that part of
+the makefile at all, and I think this used to work ok...
+
+Here are the makefiles I built from within the MSVC 2.0 environment for antlr
+and dlg and Windows NT console executables. Please feel free to pass them
+on. Of course, as soon as 1.31 "goes gold", I will send you nice new
+binaries. I'm not going to bother to keep doing both Borland and djgpp for
+DOS however. Instead, I'll just keep the djgpp version up to date and also
+provide WinNT binaries.
+
+Dave
+===============================================================================
+
+ How to port PCCTS 1.10 (and 1.32 hopefully) to Visual C++
+
+ By
+
+ John Hall <jhall@ivy.wpi.edu>
+
+Here is how to compile an ANTLR grammar in Visual C++. These steps
+describe how to have your ANTLR grammar parse the input file the user
+selects when they choose File Open in your Windows application. (Even
+if you aren't using Visual C++, the steps should be portable enough to
+other compilers.)
+
+ * Make sure that ANTLR and DLG generate ANSI code (use the -ga
+ switch).
+
+ * Set the following compiler flags in Visual C++ (these are in the
+ Memory Model category of the compiler options in the Project
+ Options menu):
+
+ FLAG MEANING
+ ==== ==============================================================
+ /AL Large memory model (multiple data segments; data items must be
+ smaller than 64K).
+
+ /Gtn Allocates all items whose size is greater than or equal to n
+ in a new data segment. (I let n be 256: /Gt256.)
+
+ /Gx- All references to data items are done with far addressing in
+ case they are placed in a far segment.
+
+ * Add the following member variable to the attributes section of your
+ derived CDocument class (you will need to make sure you also
+ include stdio.h):
+
+ FILE *fp;
+
+ * Add the following method to your derived CDocument class:
+
+ BOOL CAppDoc::OnOpenDocument(const char* pszPathName)
+ {
+ // Call CDocument's OnOpenDocument to do housekeeping for us
+ // DON'T add anything to the loading section of Serialize
+ if (!CDocument::OnOpenDocument(pszPathName))
+ return FALSE;
+
+ // Open input file
+ if ((fp = fopen(pszPathName, "r")) == NULL)
+ return FALSE;
+
+ // Parse input file
+ ANTLR(start(), fp);
+
+ // Close input file
+ fclose(fp);
+ return TRUE;
+ }
+
+ (Note: additional code may be necessary, depending on your parser.
+ For example, if your parser uses PCCTS's symbol table library, you
+ will need to insert calls to zzs_init and zzs_done.)
+
+ * Compile the generated C files as C++ files. (I renamed the files
+ to have a .CPP extension to fool Visual C++ into thinking they were
+ C++ files. One might also use the /Tp switch, but that switch
+ requires you separately include the filename.) [I used this step
+ as an easy out for all the external linking errors I was getting
+ that I couldn't fix by declaring things extern "C".]
+
+ * Make sure the __STDC__ portion of the generated files gets
+ compiled. (Either define __STDC__ yourself or else change all
+ occurrences of __STDC__ to __cplusplus in the generated files. You
+ can define __STDC__ in the Preprocessor category of the compiler
+ options.)
+
+ ================================================================
+ = Note 23-Sep-97: This is probably not necessary any more. =
+ = With 1.33MRxxx the use of __STDC__ was replaced with the =
+ = macro __USE_PROTOS to control the compilation of prototypes. =
+ ================================================================
+
+That last step is important for Visual C++, but may not apply to other
+compilers. For C++ compilers, whether __STDC__ is defined is
+implementation dependent (ARM, page 379). Apparently, Visual C++ does
+not to define it; it also does not support "old style" C function
+definitions (which is okay, according to page 404 of the ARM). Those
+two things together caused problems when trying to port the code.
+When it saw this:
+
+#ifdef __STDC__
+void
+globals(AST **_root)
+#else
+globals(_root)
+AST **_root;
+#endif
+
+it skipped the __STDC__ section and tried to process the "old style"
+function definition, where it choked.
+
+When you finally get your parser to compile and link without error,
+you may get General Protection Fault errors at run time. The problem
+I had was that a NULL was passed to a variable argument function
+without an explicit cast. The function grabbed a pointer (32-bits)
+off the stack using va_arg, but the NULL was passed silently as the
+integer 0 (16 bits), making the resulting pointer was invalid. (This
+was in PCCTS's sample C parser.)
+
+There is one other thing I might suggest to help you avoid a run-time
+error. Make sure you redefine the default error reporting function,
+zzsyn. To do this, put "#define USER_ZZSYN" in your #header section
+and put your own zzsyn somewhere. You can then pop up a MessageBox or
+print the error to some output window.
+===============================================================================
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/README b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/README
new file mode 100644
index 000000000..d089b638b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/README
@@ -0,0 +1,159 @@
+
+ Parr Research Corporation
+ with
+ Purdue University Electrical Engineering
+ and
+ University of Minnesota, AHPCRC
+
+ Terence Parr
+ Russell Quong
+ Will Cohen
+ Hank Dietz
+
+
+A central place for information about PCCTS 1.33 is:
+
+ http://www.polhode.com/pccts.html
+
+The maintenance release is available from:
+
+ http://www.polhode.com/pccts133mr.zip
+
+There is a ready-to-run version for win32 for Microsoft Visual Studio
+at the same site. It is available from:
+
+ http://www.polhode.com/win32.zip
+
+New users should visit http://www.polhode.com/pccts.html in
+order to get the following document:
+
+ "Notes For New Users of PCCTS"
+
+This is a Postscript file of about 40 pages which is extremely
+useful for someone starting out. It is a based on 1.33mr21
+
+When you have a little more experience, be sure to review the
+following documents in the distribution kit:
+
+ CHANGES_FROM_133.txt
+ CHANGES_FROM_133_BEFORE_MR13.txt
+ KNOWN_PROBLEMS.txt
+
+-------------------------------------------------------------------------
+ INSTALLATION (Unix)
+-------------------------------------------------------------------------
+0. Download http://www.polhode.com/pccts133mr.zip
+
+1. Unzip the distribution kit to your preferred location.
+ If there are newline problems try using zip -a ...
+
+2. cd to the main pccts directory.
+
+3. make
+
+ This will create:
+
+ antlr
+ dlg
+ sorcerer
+ genmk
+
+4. Copy to /usr/local/bin or /usr/local/bin if you like. If you
+ don't wish to then add pccts/bin to your path.
+
+5. To get an up-to-date list of program options execute the
+ program with no command line options. To get up-to-date
+ documentation read CHANGES_FROM_133*.txt and KNOWN_PROBLEMS.txt
+ at:
+
+ http://www.polhode.com/pccts.html
+
+6. You need not create a library. The makefile created by genmk
+ assumes that the files are not part of a library.
+
+ If you wish to create a library from elements of pccts/h:
+
+ If the first letter of the filename is lowercase (uppercase) it is
+ related to the code generated using the pccts C mode (C++ mode).
+ Some of the .c and .cpp files in the h directory are not meant to
+ be placed in a library and will not compile because they are meant
+ to be #include in pccts generated files which are grammar specific.
+
+ For C++ users place the following elements in the library:
+
+ AParser.cpp
+ ASTBase.cpp
+ ATokenBuffer.cpp
+ BufFileInput.cpp (optional)
+ DLexerBase.cpp
+ PCCTSAST.cpp
+ SList.cpp
+
+-------------------------------------------------------------------------
+ INSTALLATION (Win32)
+-------------------------------------------------------------------------
+
+I've tried to keep the win32 kit to the minimum necessary to get
+up and running. The complete kit contains additional information
+(some historical), source code, and DevStudio projects for
+rebuilding pccts from the source code.
+
+The kit is now distributed with both MSVC 5 and MSVC6 style projects.
+
+0. Download http://www.polhode.com/win32.zip.
+
+ You may also wish to download:
+
+ http://www.polhode.com/CHANGES_FROM_133.txt
+ http://www.polhode.com/CHANGES_FROM_133_BEFORE_MR13.txt
+ http://www.polhode.com/KNOWN_PROBLEMS.txt
+
+1. Unzip the distribution kit to your preferred location.
+
+ This will create:
+
+ a pccts directory tree
+ pccts/bin/*.exe
+ pccts/lib/*.lib
+ pccts/h/*
+ sorcerer/lib/*
+ sorcerer/h/*
+
+ an example directory tree
+ pccts\example\calcAST\*
+ pccts\example\simple\*
+
+2. Define the environment variable PCCTS to point to the main
+ pccts directory.
+
+3. Try building the simple project: pccts\example\simple\simple50.dsw
+ or simple60.dsw.
+
+4. Try building the complex project: pccts\example\calcAST\calcAST50.dsw
+ or calcAST60.dsw.
+
+-------------------------------------------------------------------------
+ INSTALLATION (DEC/VMS)
+-------------------------------------------------------------------------
+
+DEC/VMS support added by Piéronne Jean-François (jfp@altavista.net)
+
+0. Download http://www.polhode.com/pccts133mr.zip
+
+1. Unzip the distribution kit to your preferred location.
+
+2. set default to the main pccts directory.
+
+3. @makefile.vms
+
+ This will create in directory [.bin]:
+
+ antlr.exe
+ dlg.exe
+ sorcerer.exe
+ genmk.exe
+
+5. To get an up-to-date list of program options execute the
+ program with no command line options. To get up-to-date
+ documentation read CHANGES_FROM_133*.txt and KNOWN_PROBLEMS.txt
+ at http://www.polhode.com/pccts.html.
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/RIGHTS b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/RIGHTS
new file mode 100644
index 000000000..9db175ff4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/RIGHTS
@@ -0,0 +1,26 @@
+
+SOFTWARE RIGHTS
+
+We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+Set (PCCTS) -- PCCTS is in the public domain. An individual or
+company may do whatever they wish with source code distributed with
+PCCTS or the code generated by PCCTS, including the incorporation of
+PCCTS, or its output, into commerical software.
+
+We encourage users to develop software with PCCTS. However, we do ask
+that credit is given to us for developing PCCTS. By "credit", we mean
+that if you incorporate our source code into one of your programs
+(commercial product, research project, or otherwise) that you
+acknowledge this fact somewhere in the documentation, research report,
+etc... If you like PCCTS and have developed a nice tool with the
+output, please mention that you developed it using PCCTS. In
+addition, we ask that this header remain intact in our source code.
+As long as these guidelines are kept, we expect to continue enhancing
+this system and expect to make other tools available as they are
+completed.
+
+ANTLR 1.33
+Terence Parr
+Parr Research Corporation
+with Purdue University and AHPCRC, University of Minnesota
+1989-1995
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrDDK.mak b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrDDK.mak
new file mode 100644
index 000000000..71b7c6b0b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrDDK.mak
@@ -0,0 +1,233 @@
+# PCCTS directory
+
+# You will need to set the LIB variable similar to this.
+# LIB="C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/lib;c:/Microsoft Visual Studio .NET 2003/Vc7/PlatformSDK/Lib"
+
+# PCCTS_HOME=<your PCCTS_HOME>
+PCCTS_HOME=$(WORKSPACE)\Tools\CCode\Source\Pccts
+ANTLR_SRC=$(PCCTS_HOME)\antlr
+PCCTS_H=$(PCCTS_HOME)\h
+
+
+# Support directories
+SET=$(PCCTS_HOME)\support\set
+
+
+# Compiler stuff
+CC = cl
+CFLAGS = /nologo -I "." -I "$(PCCTS_H)" -I "$(SET)" -D "USER_ZZSYN" -D "PC" \
+ -D "ZZLEXBUFSIZE=65536" -D "LONGFILENAMES" /Zi /W3 -D__USE_PROTOS /wd4700
+
+ANTLR_OBJS = antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
+ fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
+ misc.obj pred.obj egman.obj mrhoist.obj fcache.obj
+
+SUPPORT_OBJS = set.obj
+
+# Dependencies
+
+$(WORKSPACE)\Tools\bin\antlr.exe: $(ANTLR_OBJS) $(SUPPORT_OBJS)
+ $(CC) $(CFLAGS) -o antlr.exe bufferoverflowu.lib $(ANTLR_OBJS) $(SUPPORT_OBJS)
+ del *.obj
+ move antlr.exe $(WORKSPACE)\Tools\bin
+
+
+antlr.obj: $(ANTLR_SRC)\antlr.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\mode.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+ $(ANTLR_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\antlr.c
+
+scan.obj: $(ANTLR_SRC)\scan.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgauto.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\mode.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+ $(ANTLR_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\scan.c
+
+err.obj: $(ANTLR_SRC)\err.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(PCCTS_H)\err.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+ $(ANTLR_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\err.c
+
+bits.obj: $(ANTLR_SRC)\bits.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\bits.c
+
+build.obj: $(ANTLR_SRC)\build.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\build.c
+
+fset2.obj: $(ANTLR_SRC)\fset2.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\fset2.c
+
+fset.obj: $(ANTLR_SRC)\fset.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\fset.c
+
+gen.obj: $(ANTLR_SRC)\gen.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\gen.c
+
+globals.obj: $(ANTLR_SRC)\globals.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\globals.c
+
+hash.obj: $(ANTLR_SRC)\hash.c \
+ $(PCCTS_H)\config.h \
+ $(ANTLR_SRC)\hash.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\hash.c
+
+lex.obj: $(ANTLR_SRC)\lex.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\lex.c
+
+main.obj: $(ANTLR_SRC)\main.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\mode.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\stdpccts.h \
+ $(ANTLR_SRC)\syn.h \
+ $(ANTLR_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\main.c
+
+misc.obj: $(ANTLR_SRC)\misc.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\misc.c
+
+pred.obj: $(ANTLR_SRC)\pred.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\pred.c
+
+egman.obj: $(ANTLR_SRC)\egman.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\egman.c
+
+mrhoist.obj: $(ANTLR_SRC)\mrhoist.c \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\mrhoist.c
+
+fcache.obj: $(ANTLR_SRC)\fcache.c \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\fcache.c
+
+set.obj: $(SET)\set.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+
+ $(CC) -c $(CFLAGS) $(SET)\set.c
+
+clean:
+ del *.obj
+
+distclean:
+ del *.obj
+ del $(WORKSPACE)\Tools\bin\antlr.exe
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrMS.mak b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrMS.mak
new file mode 100644
index 000000000..b30a73bb7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrMS.mak
@@ -0,0 +1,239 @@
+# PCCTS directory
+
+# You will need to set the LIB variable similar to this.
+# LIB="C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/lib;c:/Microsoft Visual Studio .NET 2003/Vc7/PlatformSDK/Lib"
+
+# PCCTS_HOME=<your PCCTS_HOME>
+PCCTS_HOME=$(BASE_TOOLS_PATH)\Source\C\VfrCompile\Pccts
+ANTLR_SRC=$(PCCTS_HOME)\antlr
+PCCTS_H=$(PCCTS_HOME)\h
+
+
+# Support directories
+SET=$(PCCTS_HOME)\support\set
+
+
+# Compiler stuff
+CC = cl
+CFLAGS = /nologo -I "." -I "$(PCCTS_H)" -I "$(SET)" -D "USER_ZZSYN" -D "PC" \
+ -D "ZZLEXBUFSIZE=65536" /D "LONGFILENAMES" /Zi /W3 -D__USE_PROTOS /wd4700 \
+ /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
+
+ANTLR_OBJS = antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
+ fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
+ misc.obj pred.obj egman.obj mrhoist.obj fcache.obj
+
+SUPPORT_OBJS = set.obj
+
+# Dependencies
+
+$(EDK_TOOLS_PATH)\Bin\Win32\antlr.exe: $(ANTLR_OBJS) $(SUPPORT_OBJS)
+ $(CC) $(CFLAGS) -Feantlr.exe $(ANTLR_OBJS) $(SUPPORT_OBJS)
+ -@if not exist $(EDK_TOOLS_PATH)\Bin\Win32 mkdir $(EDK_TOOLS_PATH)\Bin\Win32
+ copy antlr.exe $(EDK_TOOLS_PATH)\Bin\Win32
+
+
+antlr.obj: $(ANTLR_SRC)\antlr.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\mode.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+ $(ANTLR_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\antlr.c
+
+scan.obj: $(ANTLR_SRC)\scan.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgauto.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\mode.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+ $(ANTLR_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\scan.c
+
+err.obj: $(ANTLR_SRC)\err.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(PCCTS_H)\err.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+ $(ANTLR_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\err.c
+
+bits.obj: $(ANTLR_SRC)\bits.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\bits.c
+
+build.obj: $(ANTLR_SRC)\build.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\build.c
+
+fset2.obj: $(ANTLR_SRC)\fset2.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\fset2.c
+
+fset.obj: $(ANTLR_SRC)\fset.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\fset.c
+
+gen.obj: $(ANTLR_SRC)\gen.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\gen.c
+
+globals.obj: $(ANTLR_SRC)\globals.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\globals.c
+
+hash.obj: $(ANTLR_SRC)\hash.c \
+ $(PCCTS_H)\config.h \
+ $(ANTLR_SRC)\hash.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\hash.c
+
+lex.obj: $(ANTLR_SRC)\lex.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\lex.c
+
+main.obj: $(ANTLR_SRC)\main.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\mode.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\stdpccts.h \
+ $(ANTLR_SRC)\syn.h \
+ $(ANTLR_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\main.c
+
+misc.obj: $(ANTLR_SRC)\misc.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\misc.c
+
+pred.obj: $(ANTLR_SRC)\pred.c \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\pred.c
+
+egman.obj: $(ANTLR_SRC)\egman.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\egman.c
+
+mrhoist.obj: $(ANTLR_SRC)\mrhoist.c \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\mrhoist.c
+
+fcache.obj: $(ANTLR_SRC)\fcache.c \
+ $(ANTLR_SRC)\generic.h \
+ $(ANTLR_SRC)\hash.h \
+ $(ANTLR_SRC)\proto.h \
+ $(ANTLR_SRC)\syn.h \
+
+ $(CC) -c $(CFLAGS) $(ANTLR_SRC)\fcache.c
+
+set.obj: $(SET)\set.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+
+ $(CC) -c $(CFLAGS) $(SET)\set.c
+
+clean:
+ -del *.obj
+ -del *.ilk
+ -del *.pdb
+
+cleanall:
+ -del *.obj
+ -del *.ilk
+ -del *.pdb
+ -del *.exe
+ -del $(EDK_TOOLS_PATH)\Bin\Win32\antlr.exe
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrPPC.mak b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrPPC.mak
new file mode 100644
index 000000000..9ede60d64
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrPPC.mak
@@ -0,0 +1,101 @@
+# Target: antlrPPC
+# Sources: ::support:set:set.c
+# antlr.c
+# bits.c
+# build.c
+# egman.c
+# err.c
+# fcache.c
+# fset2.c
+# fset.c
+# gen.c
+# globals.c
+# hash.c
+# lex.c
+# main.c
+# misc.c
+# mrhoist.c
+# pred.c
+# scan.c
+# Created: Sunday, May 17, 1998 10:24:53 PM
+# Author: Kenji Tanaka
+MAKEFILE = antlrPPC.make
+¥MondoBuild¥ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified
+Includes = ¶
+ -i "::h:" ¶
+ -i "::support:set:"
+Sym¥PPC =
+ObjDir¥PPC = :Obj:
+PPCCOptions = {Includes} {Sym¥PPC} -w off -d MPW -d __STDC__=1 -d USER_ZZSYN
+Objects¥PPC = ¶
+ "{ObjDir¥PPC}set.c.x" ¶
+ "{ObjDir¥PPC}antlr.c.x" ¶
+ "{ObjDir¥PPC}bits.c.x" ¶
+ "{ObjDir¥PPC}build.c.x" ¶
+ "{ObjDir¥PPC}egman.c.x" ¶
+ "{ObjDir¥PPC}err.c.x" ¶
+ "{ObjDir¥PPC}fcache.c.x" ¶
+ "{ObjDir¥PPC}fset2.c.x" ¶
+ "{ObjDir¥PPC}fset.c.x" ¶
+ "{ObjDir¥PPC}gen.c.x" ¶
+ "{ObjDir¥PPC}globals.c.x" ¶
+ "{ObjDir¥PPC}hash.c.x" ¶
+ "{ObjDir¥PPC}lex.c.x" ¶
+ "{ObjDir¥PPC}main.c.x" ¶
+ "{ObjDir¥PPC}misc.c.x" ¶
+ "{ObjDir¥PPC}mrhoist.c.x" ¶
+ "{ObjDir¥PPC}pred.c.x" ¶
+ "{ObjDir¥PPC}scan.c.x"
+antlrPPC ÄÄ {¥MondoBuild¥} {Objects¥PPC}
+ PPCLink ¶
+ -o {Targ} {Sym¥PPC} ¶
+ {Objects¥PPC} ¶
+ -t 'MPST' ¶
+ -c 'MPS ' ¶
+ "{SharedLibraries}InterfaceLib" ¶
+ "{SharedLibraries}StdCLib" ¶
+ #"{SharedLibraries}MathLib" ¶
+ "{PPCLibraries}StdCRuntime.o" ¶
+ "{PPCLibraries}PPCCRuntime.o" ¶
+ "{PPCLibraries}PPCToolLibs.o"
+"{ObjDir¥PPC}set.c.x" Ä {¥MondoBuild¥} "::support:set:set.c"
+ {PPCC} "::support:set:set.c" -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}antlr.c.x" Ä {¥MondoBuild¥} antlr.c
+ {PPCC} antlr.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}bits.c.x" Ä {¥MondoBuild¥} bits.c
+ {PPCC} bits.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}build.c.x" Ä {¥MondoBuild¥} build.c
+ {PPCC} build.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}egman.c.x" Ä {¥MondoBuild¥} egman.c
+ {PPCC} egman.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}err.c.x" Ä {¥MondoBuild¥} err.c
+ {PPCC} err.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}fcache.c.x" Ä {¥MondoBuild¥} fcache.c
+ {PPCC} fcache.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}fset2.c.x" Ä {¥MondoBuild¥} fset2.c
+ {PPCC} fset2.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}fset.c.x" Ä {¥MondoBuild¥} fset.c
+ {PPCC} fset.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}gen.c.x" Ä {¥MondoBuild¥} gen.c
+ {PPCC} gen.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}globals.c.x" Ä {¥MondoBuild¥} globals.c
+ {PPCC} globals.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}hash.c.x" Ä {¥MondoBuild¥} hash.c
+ {PPCC} hash.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}lex.c.x" Ä {¥MondoBuild¥} lex.c
+ {PPCC} lex.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}main.c.x" Ä {¥MondoBuild¥} main.c
+ {PPCC} main.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}misc.c.x" Ä {¥MondoBuild¥} misc.c
+ {PPCC} misc.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}mrhoist.c.x" Ä {¥MondoBuild¥} mrhoist.c
+ {PPCC} mrhoist.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}pred.c.x" Ä {¥MondoBuild¥} pred.c
+ {PPCC} pred.c -o {Targ} {PPCCOptions}
+"{ObjDir¥PPC}scan.c.x" Ä {¥MondoBuild¥} scan.c
+ {PPCC} scan.c -o {Targ} {PPCCOptions}
+
+antlrPPC ÄÄ antlr.r
+ Rez antlr.r -o antlrPPC -a
+Install Ä antlrPPC
+ Duplicate -y antlrPPC "{MPW}"Tools:antlr
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/README b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/README
new file mode 100644
index 000000000..d7fc95916
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/README
@@ -0,0 +1,19 @@
+ ANTLR 1.33
+
+This directory contains the files necessary to build ANTLR.
+
+If you do a "make scrub", ANTLR will have to run on antlr.g and DLG
+will have to run on parser.dlg. Either
+
+(1) ANTLR uses the previous antlr in that directory to rebuild itself
+(2) Needs to find antlr on the search path
+
+You will find that running "antlr -gh antlr.g" will result in about
+10 ambiguity warnings. These are normal. Don't worry.
+
+If you do a "make clean" right after installation, ANTLR and DLG should
+not need to run; only the C files will compile.
+
+Don't forget to go into the makefile to uncomment the appropriate
+definitions for your OS/architecture/compiler or see the appropriate
+NOTES.?? file.
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.1 b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.1
new file mode 100644
index 000000000..acfa85b06
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.1
@@ -0,0 +1,209 @@
+.TH ANTLR 1 "September 1995" "ANTLR" "PCCTS Manual Pages"
+.SH NAME
+antlr \- ANother Tool for Language Recognition
+.SH SYNTAX
+.LP
+\fBantlr\fR [\fIoptions\fR] \fIgrammar_files\fR
+.SH DESCRIPTION
+.PP
+\fIAntlr\fP converts an extended form of context-free grammar into a
+set of C functions which directly implement an efficient form of
+deterministic recursive-descent LL(k) parser. Context-free grammars
+may be augmented with predicates to allow semantics to influence
+parsing; this allows a form of context-sensitive parsing. Selective
+backtracking is also available to handle non-LL(k) and even
+non-LALR(k) constructs. \fIAntlr\fP also produces a definition of a
+lexer which can be automatically converted into C code for a DFA-based
+lexer by \fIdlg\fR. Hence, \fIantlr\fR serves a function much like
+that of \fIyacc\fR, however, it is notably more flexible and is more
+integrated with a lexer generator (\fIantlr\fR directly generates
+\fIdlg\fR code, whereas \fIyacc\fR and \fIlex\fR are given independent
+descriptions). Unlike \fIyacc\fR which accepts LALR(1) grammars,
+\fIantlr\fR accepts LL(k) grammars in an extended BNF notation \(em
+which eliminates the need for precedence rules.
+.PP
+Like \fIyacc\fR grammars, \fIantlr\fR grammars can use
+automatically-maintained symbol attribute values referenced as dollar
+variables. Further, because \fIantlr\fR generates top-down parsers,
+arbitrary values may be inherited from parent rules (passed like
+function parameters). \fIAntlr\fP also has a mechanism for creating
+and manipulating abstract-syntax-trees.
+.PP
+There are various other niceties in \fIantlr\fR, including the ability to
+spread one grammar over multiple files or even multiple grammars in a single
+file, the ability to generate a version of the grammar with actions stripped
+out (for documentation purposes), and lots more.
+.SH OPTIONS
+.IP "\fB-ck \fIn\fR"
+Use up to \fIn\fR symbols of lookahead when using compressed (linear
+approximation) lookahead. This type of lookahead is very cheap to
+compute and is attempted before full LL(k) lookahead, which is of
+exponential complexity in the worst case. In general, the compressed
+lookahead can be much deeper (e.g, \f(CW-ck 10\fP) than the full
+lookahead (which usually must be less than 4).
+.IP \fB-CC\fP
+Generate C++ output from both ANTLR and DLG.
+.IP \fB-cr\fP
+Generate a cross-reference for all rules. For each rule, print a list
+of all other rules that reference it.
+.IP \fB-e1\fP
+Ambiguities/errors shown in low detail (default).
+.IP \fB-e2\fP
+Ambiguities/errors shown in more detail.
+.IP \fB-e3\fP
+Ambiguities/errors shown in excruciating detail.
+.IP "\fB-fe\fP file"
+Rename \fBerr.c\fP to file.
+.IP "\fB-fh\fP file"
+Rename \fBstdpccts.h\fP header (turns on \fB-gh\fP) to file.
+.IP "\fB-fl\fP file"
+Rename lexical output, \fBparser.dlg\fP, to file.
+.IP "\fB-fm\fP file"
+Rename file with lexical mode definitions, \fBmode.h\fP, to file.
+.IP "\fB-fr\fP file"
+Rename file which remaps globally visible symbols, \fBremap.h\fP, to file.
+.IP "\fB-ft\fP file"
+Rename \fBtokens.h\fP to file.
+.IP \fB-ga\fP
+Generate ANSI-compatible code (default case). This has not been
+rigorously tested to be ANSI XJ11 C compliant, but it is close. The
+normal output of \fIantlr\fP is currently compilable under both K&R,
+ANSI C, and C++\(emthis option does nothing because \fIantlr\fP
+generates a bunch of #ifdef's to do the right thing depending on the
+language.
+.IP \fB-gc\fP
+Indicates that \fIantlr\fP should generate no C code, i.e., only
+perform analysis on the grammar.
+.IP \fB-gd\fP
+C code is inserted in each of the \fIantlr\fR generated parsing functions to
+provide for user-defined handling of a detailed parse trace. The inserted
+code consists of calls to the user-supplied macros or functions called
+\fBzzTRACEIN\fR and \fBzzTRACEOUT\fP. The only argument is a
+\fIchar *\fR pointing to a C-style string which is the grammar rule
+recognized by the current parsing function. If no definition is given
+for the trace functions, upon rule entry and exit, a message will be
+printed indicating that a particular rule as been entered or exited.
+.IP \fB-ge\fP
+Generate an error class for each non-terminal.
+.IP \fB-gh\fP
+Generate \fBstdpccts.h\fP for non-ANTLR-generated files to include.
+This file contains all defines needed to describe the type of parser
+generated by \fIantlr\fP (e.g. how much lookahead is used and whether
+or not trees are constructed) and contains the \fBheader\fP action
+specified by the user.
+.IP \fB-gk\fP
+Generate parsers that delay lookahead fetches until needed. Without
+this option, \fIantlr\fP generates parsers which always have \fIk\fP
+tokens of lookahead available.
+.IP \fB-gl\fP
+Generate line info about grammar actions in C parser of the form
+\fB#\ \fIline\fP\ "\fIfile\fP"\fR which makes error messages from
+the C/C++ compiler make more sense as they will \*Qpoint\*U into the
+grammar file not the resulting C file. Debugging is easier as well,
+because you will step through the grammar not C file.
+.IP \fB-gs\fR
+Do not generate sets for token expression lists; instead generate a
+\fB||\fP-separated sequence of \fBLA(1)==\fItoken_number\fR. The
+default is to generate sets.
+.IP \fB-gt\fP
+Generate code for Abstract-Syntax Trees.
+.IP \fB-gx\fP
+Do not create the lexical analyzer files (dlg-related). This option
+should be given when the user wishes to provide a customized lexical
+analyzer. It may also be used in \fImake\fR scripts to cause only the
+parser to be rebuilt when a change not affecting the lexical structure
+is made to the input grammars.
+.IP "\fB-k \fIn\fR"
+Set k of LL(k) to \fIn\fR; i.e. set tokens of look-ahead (default==1).
+.IP "\fB-o\fP dir
+Directory where output files should go (default="."). This is very
+nice for keeping the source directory clear of ANTLR and DLG spawn.
+.IP \fB-p\fP
+The complete grammar, collected from all input grammar files and
+stripped of all comments and embedded actions, is listed to
+\fBstdout\fP. This is intended to aid in viewing the entire grammar
+as a whole and to eliminate the need to keep actions concisely stated
+so that the grammar is easier to read. Hence, it is preferable to
+embed even complex actions directly in the grammar, rather than to
+call them as subroutines, since the subroutine call overhead will be
+saved.
+.IP \fB-pa\fP
+This option is the same as \fB-p\fP except that the output is
+annotated with the first sets determined from grammar analysis.
+.IP "\fB-prc on\fR
+Turn on the computation and hoisting of predicate context.
+.IP "\fB-prc off\fR
+Turn off the computation and hoisting of predicate context. This
+option makes 1.10 behave like the 1.06 release with option \fB-pr\fR
+on. Context computation is off by default.
+.IP "\fB-rl \fIn\fR
+Limit the maximum number of tree nodes used by grammar analysis to
+\fIn\fP. Occasionally, \fIantlr\fP is unable to analyze a grammar
+submitted by the user. This rare situation can only occur when the
+grammar is large and the amount of lookahead is greater than one. A
+nonlinear analysis algorithm is used by PCCTS to handle the general
+case of LL(k) parsing. The average complexity of analysis, however, is
+near linear due to some fancy footwork in the implementation which
+reduces the number of calls to the full LL(k) algorithm. An error
+message will be displayed, if this limit is reached, which indicates
+the grammar construct being analyzed when \fIantlr\fP hit a
+non-linearity. Use this option if \fIantlr\fP seems to go out to
+lunch and your disk start thrashing; try \fIn\fP=10000 to start. Once
+the offending construct has been identified, try to remove the
+ambiguity that \fIantlr\fP was trying to overcome with large lookahead
+analysis. The introduction of (...)? backtracking blocks eliminates
+some of these problems\ \(em \fIantlr\fP does not analyze alternatives
+that begin with (...)? (it simply backtracks, if necessary, at run
+time).
+.IP \fB-w1\fR
+Set low warning level. Do not warn if semantic predicates and/or
+(...)? blocks are assumed to cover ambiguous alternatives.
+.IP \fB-w2\fR
+Ambiguous parsing decisions yield warnings even if semantic predicates
+or (...)? blocks are used. Warn if predicate context computed and
+semantic predicates incompletely disambiguate alternative productions.
+.IP \fB-\fR
+Read grammar from standard input and generate \fBstdin.c\fP as the
+parser file.
+.SH "SPECIAL CONSIDERATIONS"
+.PP
+\fIAntlr\fP works... we think. There is no implicit guarantee of
+anything. We reserve no \fBlegal\fP rights to the software known as
+the Purdue Compiler Construction Tool Set (PCCTS) \(em PCCTS is in the
+public domain. An individual or company may do whatever they wish
+with source code distributed with PCCTS or the code generated by
+PCCTS, including the incorporation of PCCTS, or its output, into
+commercial software. We encourage users to develop software with
+PCCTS. However, we do ask that credit is given to us for developing
+PCCTS. By "credit", we mean that if you incorporate our source code
+into one of your programs (commercial product, research project, or
+otherwise) that you acknowledge this fact somewhere in the
+documentation, research report, etc... If you like PCCTS and have
+developed a nice tool with the output, please mention that you
+developed it using PCCTS. As long as these guidelines are followed,
+we expect to continue enhancing this system and expect to make other
+tools available as they are completed.
+.SH FILES
+.IP *.c
+output C parser.
+.IP *.cpp
+output C++ parser when C++ mode is used.
+.IP \fBparser.dlg\fP
+output \fIdlg\fR lexical analyzer.
+.IP \fBerr.c\fP
+token string array, error sets and error support routines. Not used in
+C++ mode.
+.IP \fBremap.h\fP
+file that redefines all globally visible parser symbols. The use of
+the #parser directive creates this file. Not used in
+C++ mode.
+.IP \fBstdpccts.h\fP
+list of definitions needed by C files, not generated by PCCTS, that
+reference PCCTS objects. This is not generated by default. Not used in
+C++ mode.
+.IP \fBtokens.h\fP
+output \fI#defines\fR for tokens used and function prototypes for
+functions generated for rules.
+.SH "SEE ALSO"
+.LP
+dlg(1), pccts(1)
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.c
new file mode 100644
index 000000000..58d0b134b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.c
@@ -0,0 +1,3565 @@
+/*
+ * A n t l r T r a n s l a t i o n H e a d e r
+ *
+ * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
+ * Purdue University Electrical Engineering
+ * With AHPCRC, University of Minnesota
+ * ANTLR Version 1.33MR33
+ *
+ * ..\bin\antlr -gh antlr.g
+ *
+ */
+
+#define ANTLR_VERSION 13333
+#include "pcctscfg.h"
+#include "pccts_stdio.h"
+
+#include "pcctscfg.h"
+#include "set.h"
+#include <ctype.h>
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#define zzcr_attr(attr,tok,t)
+#define zzSET_SIZE 20
+#include "antlr.h"
+#include "tokens.h"
+#include "dlgdef.h"
+#include "mode.h"
+
+/* MR23 In order to remove calls to PURIFY use the antlr -nopurify option */
+
+#ifndef PCCTS_PURIFY
+#define PCCTS_PURIFY(r,s) memset((char *) &(r),'\0',(s));
+#endif
+
+ANTLR_INFO
+
+
+/* MR20 G. Hobbelt For Borland C++ 4.x & 5.x compiling with ALL warnings enabled */
+#if defined(__TURBOC__)
+#pragma warn -aus /* unused assignment of 'xxx' */
+#endif
+
+#pragma clang diagnostic ignored "-Wparentheses-equality"
+
+#ifdef __USE_PROTOS
+static void chkToken(char *, char *, char *, int);
+#else
+static void chkToken();
+#endif
+
+#ifdef __USE_PROTOS
+static int isDLGmaxToken(char *Token); /* MR3 */
+#else
+static int isDLGmaxToken(); /* MR3 */
+#endif
+
+static int class_nest_level = 0;
+
+/* MR20 G. Hobbelt extern definitions moved to antlr.h */
+
+
+
+void
+#ifdef __USE_PROTOS
+grammar(void)
+#else
+grammar()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ Graph g;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ for (;;) {
+ if ( !((setwd1[LA(1)]&0x1))) break;
+ if ( (LA(1)==94) ) {
+ zzmatch(94); zzCONSUME;
+ zzmatch(Action);
+
+ if ( HdrAction==NULL ) {
+ HdrAction = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(HdrAction!=NULL, "rule grammar: cannot allocate header action");
+ strcpy(HdrAction, LATEXT(1));
+ }
+ else warn("additional #header statement ignored");
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==95) ) {
+ zzmatch(95); zzCONSUME;
+ zzmatch(Action);
+
+ if ( FirstAction==NULL ) {
+ FirstAction = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(FirstAction!=NULL, "rule grammar: cannot allocate #first action");
+ strcpy(FirstAction, LATEXT(1));
+ } else {
+ warn("additional #first statement ignored");
+ };
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==96) ) {
+ zzmatch(96); zzCONSUME;
+ zzmatch(QuotedTerm);
+
+ if ( GenCC ) {
+ warn("#parser meta-op incompatible with -CC; ignored");
+ }
+ else {
+ if ( strcmp(ParserName,"zzparser")==0 ) {
+ ParserName=StripQuotes(mystrdup(LATEXT(1)));
+ if ( RulePrefix[0]!='\0' )
+ {
+ warn("#parser meta-op incompatible with '-gp prefix'; '-gp' ignored");
+ RulePrefix[0]='\0';
+ }
+ }
+ else warn("additional #parser statement ignored");
+ }
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==97) ) {
+ zzmatch(97); zzCONSUME;
+ zzmatch(QuotedTerm);
+ {
+ char *fname;
+ zzantlr_state st; FILE *f; struct zzdlg_state dst;
+ UserTokenDefsFile = mystrdup(LATEXT(1));
+ zzsave_antlr_state(&st);
+ zzsave_dlg_state(&dst);
+ fname = mystrdup(LATEXT(1));
+ f = fopen(StripQuotes(fname), "r");
+ if ( f==NULL ) {warn(eMsg1("cannot open token defs file '%s'", fname+1));}
+ else {
+ ANTLRm(enum_file(fname+1), f, PARSE_ENUM_FILE);
+ UserDefdTokens = 1;
+ }
+ zzrestore_antlr_state(&st);
+ zzrestore_dlg_state(&dst);
+ }
+ zzCONSUME;
+
+ }
+ else break; /* MR6 code for exiting loop "for sure" */
+ }
+ }
+ }
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ for (;;) {
+ if ( !((setwd1[LA(1)]&0x2))) break;
+ if ( (LA(1)==Action) ) {
+ zzmatch(Action);
+ {
+ UserAction *ua = newUserAction(LATEXT(1));
+ ua->file = action_file; ua->line = action_line;
+ if ( class_nest_level>0 ) list_add(&class_before_actions, ua);
+ else list_add(&BeforeActions, ua);
+ }
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==108) ) {
+ laction();
+ }
+ else {
+ if ( (LA(1)==109) ) {
+ lmember();
+ }
+ else {
+ if ( (LA(1)==110) ) {
+ lprefix();
+ }
+ else {
+ if ( (LA(1)==116) ) {
+ aLexclass();
+ }
+ else {
+ if ( (LA(1)==120) ) {
+ token();
+ }
+ else {
+ if ( (LA(1)==117) ) {
+ error();
+ }
+ else {
+ if ( (LA(1)==118) ) {
+ tclass();
+ }
+ else {
+ if ( (LA(1)==111) ) {
+ aPred();
+ }
+ else {
+ if ( (LA(1)==133) ) {
+ default_exception_handler();
+ }
+ else {
+ if ( (LA(1)==99) ) {
+ class_def();
+ }
+ else {
+ if ( (LA(1)==98) ) {
+ zzmatch(98);
+
+ if ( class_nest_level==0 )
+ warn("missing class definition for trailing '}'");
+ class_nest_level--;
+ zzCONSUME;
+
+ }
+ else break; /* MR6 code for exiting loop "for sure" */
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ rule();
+ g=zzaArg(zztasp1,3); SynDiag = (Junction *) zzaArg(zztasp1,3 ).left;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ for (;;) {
+ if ( !((setwd1[LA(1)]&0x4))) break;
+ if ( (LA(1)==NonTerminal) ) {
+ rule();
+ if ( zzaArg(zztasp2,1 ).left!=NULL ) {
+ g.right = NULL;
+
+/* MR21a */ /* Avoid use of a malformed graph when CannotContinue */
+ /* MR21a */ /* is already set */
+ /* MR21a */
+ /* MR21a */ if (! (CannotContinue && g.left == NULL)) {
+ /* MR21a */ g = Or(g, zzaArg(zztasp2,1));
+ /* MR21a */ }
+ /* MR21a */ }
+ }
+ else {
+ if ( (LA(1)==116) ) {
+ aLexclass();
+ }
+ else {
+ if ( (LA(1)==120) ) {
+ token();
+ }
+ else {
+ if ( (LA(1)==117) ) {
+ error();
+ }
+ else {
+ if ( (LA(1)==118) ) {
+ tclass();
+ }
+ else {
+ if ( (LA(1)==111) ) {
+ aPred();
+ }
+ else {
+ if ( (LA(1)==99) ) {
+ class_def();
+ }
+ else {
+ if ( (LA(1)==98) ) {
+ zzmatch(98);
+
+ if ( class_nest_level==0 )
+ warn("missing class definition for trailing '}'");
+ class_nest_level--;
+ zzCONSUME;
+
+ }
+ else break; /* MR6 code for exiting loop "for sure" */
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ for (;;) {
+ if ( !((setwd1[LA(1)]&0x8))) break;
+ if ( (LA(1)==Action) ) {
+ zzmatch(Action);
+ {
+ UserAction *ua = newUserAction(LATEXT(1));
+ ua->file = action_file; ua->line = action_line;
+ if ( class_nest_level>0 ) list_add(&class_after_actions, ua);
+ else list_add(&AfterActions, ua);
+ }
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==108) ) {
+ laction();
+ }
+ else {
+ if ( (LA(1)==109) ) {
+ lmember();
+ }
+ else {
+ if ( (LA(1)==110) ) {
+ lprefix();
+ }
+ else {
+ if ( (LA(1)==117) ) {
+ error();
+ }
+ else {
+ if ( (LA(1)==118) ) {
+ tclass();
+ }
+ else {
+ if ( (LA(1)==99) ) {
+ class_def();
+ }
+ else {
+ if ( (LA(1)==111) ) {
+ aPred();
+ }
+ else {
+ if ( (LA(1)==98) ) {
+ zzmatch(98);
+
+ if ( class_nest_level==0 )
+ warn("missing class definition for trailing '}'");
+ class_nest_level--;
+ zzCONSUME;
+
+ }
+ else break; /* MR6 code for exiting loop "for sure" */
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzmatch(Eof); zzCONSUME;
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd1, 0x10);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+class_def(void)
+#else
+class_def()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ int go=1; char name[MaxRuleName+1];
+ zzmatch(99); zzCONSUME;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==NonTerminal) ) {
+ zzmatch(NonTerminal);
+ if(go) strncpy(name,LATEXT(1),MaxRuleName);
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==TokenTerm) ) {
+ zzmatch(TokenTerm);
+ if(go) strncpy(name,LATEXT(1),MaxRuleName);
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr1,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+
+ if ( CurrentClassName[0]!='\0' && strcmp(CurrentClassName,name)!=0
+ && GenCC ) {
+ err("only one grammar class allowed in this release");
+ go = 0;
+ }
+ else strcpy(CurrentClassName, name);
+ if ( !GenCC ) { err("class meta-op used without C++ option"); }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (setwd1[LA(1)]&0x20) ) {
+ zzsetmatch(zzerr2, zzerr3);
+ if (ClassDeclStuff == NULL) {
+ /* MR10 */ ClassDeclStuff=(char *)calloc(MaxClassDeclStuff+1,sizeof(char));
+ /* MR10 */ };
+ /* MR10 */ strncat(ClassDeclStuff," ",MaxClassDeclStuff);
+ /* MR10 */ strncat(ClassDeclStuff,LATEXT(1),MaxClassDeclStuff);
+ /* MR22 */ do {
+ /* MR22 */ if (0 == strcmp(LATEXT(1),"public")) break;
+ /* MR22 */ if (0 == strcmp(LATEXT(1),"private")) break;
+ /* MR22 */ if (0 == strcmp(LATEXT(1),"protected")) break;
+ /* MR22 */ if (0 == strcmp(LATEXT(1),"virtual")) break;
+ /* MR22 */ if (0 == strcmp(LATEXT(1),",")) break;
+ /* MR22 */ if (0 == strcmp(LATEXT(1),":")) break;
+ /* MR22 */ if (BaseClassName != NULL) break;
+ /* MR22 */ BaseClassName=(char *)calloc(strlen(LATEXT(1))+1,sizeof(char));
+ /* MR22 */ require(BaseClassName!=NULL, "rule grammar: cannot allocate base class name");
+ /* MR22 */ strcpy(BaseClassName,LATEXT(1));
+ /* MR22 */ } while (0);
+ /* MR10 */
+ zzCONSUME;
+
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzmatch(102);
+
+ no_classes_found = 0;
+ if ( class_nest_level>=1 ) {warn("cannot have nested classes");}
+ else class_nest_level++;
+ zzCONSUME;
+
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd1, 0x40);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+rule(void)
+#else
+rule()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+
+
+ ExceptionGroup *eg;
+ RuleEntry *q; Junction *p; Graph r; int f, l; ECnode *e;
+ set toksrefd, rulesrefd;
+ char *pdecl=NULL, *ret=NULL, *a; CurRetDef = CurParmDef = NULL;
+ CurExGroups = NULL;
+ CurElementLabels = NULL;
+ CurAstLabelsInActions = NULL; /* MR27 */
+ /* We want a new element label hash table for each rule */
+ if ( Elabel!=NULL ) killHashTable(Elabel);
+ Elabel = newHashTable();
+ attribsRefdFromAction = empty;
+ zzmatch(NonTerminal);
+ q=NULL;
+ if ( hash_get(Rname, LATEXT(1))!=NULL ) {
+ err(eMsg1("duplicate rule definition: '%s'",LATEXT(1)));
+ CannotContinue=TRUE;
+ }
+ else
+ {
+ q = (RuleEntry *)hash_add(Rname,
+ LATEXT(1),
+ (Entry *)newRuleEntry(LATEXT(1)));
+ CurRule = q->str;
+ }
+ CurRuleNode = q;
+ f = CurFile; l = zzline;
+ NumRules++;
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==103) ) {
+ zzmatch(103);
+ if ( q!=NULL ) q->noAST = TRUE;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd1[LA(1)]&0x80) ) {
+ }
+ else {zzFAIL(1,zzerr4,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ ;
+ if ( (setwd2[LA(1)]&0x1) ) {
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==104) ) {
+ zzmatch(104); zzCONSUME;
+ }
+ else {
+ if ( (LA(1)==PassAction) ) {
+ }
+ else {zzFAIL(1,zzerr5,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ zzmatch(PassAction);
+ pdecl = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(pdecl!=NULL, "rule rule: cannot allocate param decl");
+ strcpy(pdecl, LATEXT(1));
+ CurParmDef = pdecl;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd2[LA(1)]&0x2) ) {
+ }
+ else {zzFAIL(1,zzerr6,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==105) ) {
+ zzmatch(105); zzCONSUME;
+ zzmatch(PassAction);
+ ret = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(ret!=NULL, "rule rule: cannot allocate ret type");
+ strcpy(ret, LATEXT(1));
+ CurRetDef = ret;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd2[LA(1)]&0x4) ) {
+ }
+ else {zzFAIL(1,zzerr7,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==QuotedTerm) ) {
+ zzmatch(QuotedTerm);
+ if ( q!=NULL ) q->egroup=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==106) ) {
+ }
+ else {zzFAIL(1,zzerr8,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+
+ if ( GenEClasseForRules && q!=NULL ) {
+ e = newECnode;
+ require(e!=NULL, "cannot allocate error class node");
+ if ( q->egroup == NULL ) {a = q->str; a[0] = (char)toupper(a[0]);}
+ else a = q->egroup;
+ if ( Tnum( a ) == 0 )
+ {
+ e->tok = addTname( a );
+ list_add(&eclasses, (char *)e);
+ if ( q->egroup == NULL ) a[0] = (char)tolower(a[0]);
+ /* refers to itself */
+ list_add(&(e->elist), mystrdup(q->str));
+ }
+ else {
+ warn(eMsg1("default errclass for '%s' would conflict with token/errclass/tokclass",a));
+ if ( q->egroup == NULL ) a[0] = (char)tolower(a[0]);
+ free((char *)e);
+ }
+ }
+ BlkLevel++;
+ if (BlkLevel >= MAX_BLK_LEVEL) fatal("Blocks nested too deeply");
+ /* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID;
+ /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
+ zzmatch(106);
+ inAlt=1;
+ zzCONSUME;
+
+ block( &toksrefd, &rulesrefd );
+ r = makeBlk(zzaArg(zztasp1,7),0, NULL /* pFirstSetSymbol */ );
+ CurRuleBlk = (Junction *)r.left;
+ CurRuleBlk->blockid = CurBlockID;
+ CurRuleBlk->jtype = RuleBlk;
+ if ( q!=NULL ) CurRuleBlk->rname = q->str;
+ CurRuleBlk->file = f;
+ CurRuleBlk->line = l;
+ CurRuleBlk->pdecl = pdecl;
+ CurRuleBlk->ret = ret;
+ CurRuleBlk->lock = makelocks();
+ CurRuleBlk->pred_lock = makelocks();
+ CurRuleBlk->tokrefs = toksrefd;
+ CurRuleBlk->rulerefs = rulesrefd;
+ p = newJunction(); /* add EndRule Node */
+ ((Junction *)r.right)->p1 = (Node *)p;
+ r.right = (Node *) p;
+ p->jtype = EndRule;
+ p->lock = makelocks();
+ p->pred_lock = makelocks();
+ CurRuleBlk->end = p;
+ if ( q!=NULL ) q->rulenum = NumRules;
+ zzaArg(zztasp1,7) = r;
+
+ /* MR23 */ CurBlockID_array[BlkLevel] = (-1);
+ /* MR23 */ CurAltNum_array[BlkLevel] = (-1);
+ --BlkLevel;
+ altFixup();leFixup();egFixup();
+ zzmatch(107);
+ inAlt=0;
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==Action) ) {
+ zzmatch(Action);
+ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(a!=NULL, "rule rule: cannot allocate error action");
+ strcpy(a, LATEXT(1));
+ CurRuleBlk->erraction = a;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd2[LA(1)]&0x8) ) {
+ }
+ else {zzFAIL(1,zzerr9,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (LA(1)==133) ) {
+ eg = exception_group();
+
+ if ( eg!=NULL ) {
+ list_add(&CurExGroups, (void *)eg);
+ if (eg->label == NULL || *eg->label=='\0' ) q->has_rule_exception = 1;
+ }
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ if ( q==NULL ) zzaArg(zztasp1,0 ).left = NULL; else zzaArg(zztasp1,0) = zzaArg(zztasp1,7);
+ CurRuleBlk->exceptions = CurExGroups;
+ CurRuleBlk->el_labels = CurElementLabels;
+ CurRuleNode->ast_labels_in_actions = CurAstLabelsInActions;
+ CurRuleNode = NULL;
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd2, 0x10);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+laction(void)
+#else
+laction()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ char *a;
+ zzmatch(108); zzCONSUME;
+ zzmatch(Action);
+
+ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(a!=NULL, "rule laction: cannot allocate action");
+ strcpy(a, LATEXT(1));
+ list_add(&LexActions, a);
+ zzCONSUME;
+
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd2, 0x20);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+lmember(void)
+#else
+lmember()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ char *a;
+ zzmatch(109); zzCONSUME;
+ zzmatch(Action);
+
+ /* MR1 */ if (! GenCC) {
+ /* MR1 */ err("Use #lexmember only in C++ mode (to insert code in DLG class header");
+ /* MR1 */ } else {
+ /* MR1 */ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ /* MR1 */ require(a!=NULL, "rule lmember: cannot allocate action");
+ /* MR1 */ strcpy(a, LATEXT(1));
+ /* MR1 */ list_add(&LexMemberActions, a);
+ /* MR1 */ };
+ /* MR1 */
+ zzCONSUME;
+
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd2, 0x40);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+lprefix(void)
+#else
+lprefix()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ char *a;
+ zzmatch(110); zzCONSUME;
+ zzmatch(Action);
+
+ /* MR1 */ if (! GenCC) {
+ /* MR1 */ err("Use #lexprefix only in C++ mode (to insert code in DLG class header");
+ /* MR1 */ } else {
+ /* MR1 */ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ /* MR1 */ require(a!=NULL, "rule lprefix: cannot allocate action");
+ /* MR1 */ strcpy(a, LATEXT(1));
+ /* MR1 */ list_add(&LexPrefixActions, a);
+ /* MR1 */ };
+ /* MR1 */
+ zzCONSUME;
+
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd2, 0x80);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+aPred(void)
+#else
+aPred()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ PredEntry *predEntry=NULL;
+ char *name=NULL;
+ Predicate *predExpr=NULL;
+ char *predLiteral=NULL;
+ int save_file;
+ int save_line;
+ int predExprPresent=0;
+ zzmatch(111);
+
+ MR_usingPredNames=1; /* will need to use -mrhoist version of genPredTree */
+ zzCONSUME;
+
+ zzmatch(TokenTerm);
+ name=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+
+ /* don't free - referenced in predicates */
+
+ CurPredName=(char *)calloc(1,strlen(name) + 10);
+ strcat(CurPredName,"#pred ");
+ strcat(CurPredName,name);
+
+ predEntry=(PredEntry *) hash_get(Pname,name);
+ if (predEntry != NULL) {
+ warnFL(eMsg1("#pred %s previously defined - ignored",name),
+ FileStr[action_file],action_line);
+ name=NULL;
+};
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==Pred) ) {
+ zzmatch(Pred);
+ predLiteral=mystrdup(LATEXT(1));
+ save_line=action_line;
+ save_file=action_file;
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (setwd3[LA(1)]&0x1) ) {
+ predExpr = predOrExpr();
+
+ predExprPresent=1;
+ }
+ else {
+ if ( (setwd3[LA(1)]&0x2) ) {
+ }
+ else {zzFAIL(1,zzerr10,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ if (predLiteral != NULL && name != NULL) {
+
+ /*
+ * predExpr may be NULL due to syntax errors
+ * or simply omitted by the user
+ */
+
+ predEntry=newPredEntry(name);
+ predEntry->file=save_file;
+ predEntry->line=save_line;
+ predExpr=MR_predFlatten(predExpr);
+ predEntry->predLiteral=predLiteral;
+ if (! predExprPresent || predExpr == NULL) {
+ predExpr=new_pred();
+ predExpr->expr=predLiteral;
+ predExpr->source=newActionNode();
+ predExpr->source->action=predExpr->expr;
+ predExpr->source->rname=CurPredName;
+ predExpr->source->line=action_line;
+ predExpr->source->file=action_file;
+ predExpr->source->is_predicate=1;
+ predExpr->k=predicateLookaheadDepth(predExpr->source);
+ };
+ predEntry->pred=predExpr;
+ hash_add(Pname,name,(Entry *)predEntry);
+ predExpr=NULL;
+ };
+ predicate_free(predExpr);
+ }
+ else {
+ if ( (setwd3[LA(1)]&0x4) ) {
+ save_line=zzline; save_file=CurFile;
+ predExpr = predOrExpr();
+
+ if (predExpr != NULL && name != NULL) {
+ predEntry=newPredEntry(name);
+ predEntry->file=CurFile;
+ predEntry->line=zzline;
+ predExpr=MR_predFlatten(predExpr);
+ predEntry->pred=predExpr;
+ hash_add(Pname,name,(Entry *)predEntry);
+ predExpr=NULL;
+ };
+ predicate_free(predExpr);
+ }
+ else {zzFAIL(1,zzerr11,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==107) ) {
+ zzmatch(107); zzCONSUME;
+ }
+ else {
+ if ( (setwd3[LA(1)]&0x8) ) {
+ }
+ else {zzFAIL(1,zzerr12,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ predicate_free(predExpr);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd3, 0x10);
+ }
+}
+
+Predicate *
+#ifdef __USE_PROTOS
+predOrExpr(void)
+#else
+predOrExpr()
+#endif
+{
+ Predicate * _retv;
+ zzRULE;
+ zzBLOCK(zztasp1);
+ PCCTS_PURIFY(_retv,sizeof(Predicate * ))
+ zzMake0;
+ {
+ Predicate *ORnode;
+ Predicate *predExpr;
+ Predicate **tail=NULL;
+ predExpr = predAndExpr();
+
+
+ ORnode=new_pred();
+ ORnode->expr=PRED_OR_LIST;
+ if (predExpr != NULL) {
+ ORnode->down=predExpr;
+ tail=&predExpr->right;
+ };
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (LA(1)==112) ) {
+ zzmatch(112); zzCONSUME;
+ predExpr = predAndExpr();
+
+
+ if (predExpr != NULL) {
+ *tail=predExpr;
+ tail=&predExpr->right;
+ };
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+
+ _retv=ORnode;
+ ORnode=NULL;
+ zzEXIT(zztasp1);
+ return _retv;
+fail:
+ zzEXIT(zztasp1);
+ predicate_free(ORnode);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd3, 0x20);
+ return _retv;
+ }
+}
+
+Predicate *
+#ifdef __USE_PROTOS
+predAndExpr(void)
+#else
+predAndExpr()
+#endif
+{
+ Predicate * _retv;
+ zzRULE;
+ zzBLOCK(zztasp1);
+ PCCTS_PURIFY(_retv,sizeof(Predicate * ))
+ zzMake0;
+ {
+ Predicate *ANDnode;
+ Predicate *predExpr;
+ Predicate **tail=NULL;
+ predExpr = predPrimary();
+
+
+ ANDnode=new_pred();
+ ANDnode->expr=PRED_AND_LIST;
+ if (predExpr != NULL) {
+ ANDnode->down=predExpr;
+ tail=&predExpr->right;
+ };
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (LA(1)==113) ) {
+ zzmatch(113); zzCONSUME;
+ predExpr = predPrimary();
+
+
+ if (predExpr != NULL) {
+ *tail=predExpr;
+ tail=&predExpr->right;
+ };
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+
+ _retv=ANDnode;
+ ANDnode=NULL;
+ zzEXIT(zztasp1);
+ return _retv;
+fail:
+ zzEXIT(zztasp1);
+ predicate_free(ANDnode);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd3, 0x40);
+ return _retv;
+ }
+}
+
+Predicate *
+#ifdef __USE_PROTOS
+predPrimary(void)
+#else
+predPrimary()
+#endif
+{
+ Predicate * _retv;
+ zzRULE;
+ zzBLOCK(zztasp1);
+ PCCTS_PURIFY(_retv,sizeof(Predicate * ))
+ zzMake0;
+ {
+
+ char *name=NULL;
+ PredEntry *predEntry=NULL;
+ Predicate *predExpr=NULL;
+ if ( (LA(1)==TokenTerm) ) {
+ zzmatch(TokenTerm);
+ name=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+
+ predEntry=(PredEntry *) hash_get(Pname,name);
+ if (predEntry == NULL) {
+ warnFL(eMsg1("no previously defined #pred with name \"%s\"",name),
+ FileStr[CurFile],zzline);
+ name=NULL;
+ _retv=NULL;
+ } else {
+ predExpr=predicate_dup(predEntry->pred);
+ predExpr->predEntry=predEntry;
+ _retv=predExpr;
+ };
+ }
+ else {
+ if ( (LA(1)==114) ) {
+ zzmatch(114); zzCONSUME;
+ predExpr = predOrExpr();
+
+ zzmatch(115);
+
+ _retv=predExpr;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==103) ) {
+ zzmatch(103); zzCONSUME;
+ predExpr = predPrimary();
+
+
+ predExpr->inverted=!predExpr->inverted;
+ _retv=predExpr;
+ }
+ else {zzFAIL(1,zzerr13,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ zzEXIT(zztasp1);
+ return _retv;
+fail:
+ zzEXIT(zztasp1);
+
+ predicate_free(predExpr);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd3, 0x80);
+ return _retv;
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+aLexclass(void)
+#else
+aLexclass()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ zzmatch(116); zzCONSUME;
+ zzmatch(TokenTerm);
+ lexclass(mystrdup(LATEXT(1)));
+ zzCONSUME;
+
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd4, 0x1);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+error(void)
+#else
+error()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ char *t=NULL; ECnode *e; int go=1; TermEntry *p;
+ zzmatch(117); zzCONSUME;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ ;
+ if ( (LA(1)==TokenTerm) ) {
+ zzmatch(TokenTerm);
+ t=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==QuotedTerm) ) {
+ zzmatch(QuotedTerm);
+ t=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr14,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ e = newECnode;
+ require(e!=NULL, "cannot allocate error class node");
+ e->lexclass = CurrentLexClass;
+ if ( Tnum( (t=StripQuotes(t)) ) == 0 )
+ {
+ if ( hash_get(Texpr, t) != NULL )
+ warn(eMsg1("errclass name conflicts with regular expression '%s'",t));
+ e->tok = addTname( t );
+ set_orel(e->tok, &imag_tokens);
+ require((p=(TermEntry *)hash_get(Tname, t)) != NULL,
+ "hash table mechanism is broken");
+ p->classname = 1; /* entry is errclass name, not token */
+ list_add(&eclasses, (char *)e);
+ }
+ else
+ {
+ warn(eMsg1("redefinition of errclass or conflict w/token or tokclass '%s'; ignored",t));
+ free( (char *)e );
+ go=0;
+}
+ zzmatch(102); zzCONSUME;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==NonTerminal) ) {
+ zzmatch(NonTerminal);
+ if ( go ) t=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==TokenTerm) ) {
+ zzmatch(TokenTerm);
+ if ( go ) t=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==QuotedTerm) ) {
+ zzmatch(QuotedTerm);
+ if ( go ) t=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr15,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ if ( go ) list_add(&(e->elist), t);
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (setwd4[LA(1)]&0x2) ) {
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==NonTerminal) ) {
+ zzmatch(NonTerminal);
+ if ( go ) t=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==TokenTerm) ) {
+ zzmatch(TokenTerm);
+ if ( go ) t=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==QuotedTerm) ) {
+ zzmatch(QuotedTerm);
+ if ( go ) t=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr16,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ if ( go ) list_add(&(e->elist), t);
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzmatch(98); zzCONSUME;
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd4, 0x4);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+tclass(void)
+#else
+tclass()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ char *t=NULL; TCnode *e; int go=1,tok,totok; TermEntry *p, *term, *toterm;
+ char *akaString=NULL; int save_file; int save_line;
+ char *totext=NULL;
+ zzmatch(118); zzCONSUME;
+ zzmatch(TokenTerm);
+ t=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ e = newTCnode;
+ require(e!=NULL, "cannot allocate token class node");
+ e->lexclass = CurrentLexClass;
+ if ( Tnum( t ) == 0 )
+ {
+ e->tok = addTname( t );
+ set_orel(e->tok, &imag_tokens);
+ set_orel(e->tok, &tokclasses);
+ require((p=(TermEntry *)hash_get(Tname, t)) != NULL,
+ "hash table mechanism is broken");
+ p->classname = 1; /* entry is class name, not token */
+ p->tclass = e; /* save ptr to this tclass def */
+ list_add(&tclasses, (char *)e);
+ }
+ else
+ {
+ warn(eMsg1("redefinition of tokclass or conflict w/token '%s'; ignored",t));
+ free( (char *)e );
+ go=0;
+}
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==114) ) {
+ zzmatch(114); zzCONSUME;
+ zzmatch(QuotedTerm);
+ akaString=mystrdup(StripQuotes(LATEXT(1)));
+ /* MR11 */ save_file=CurFile;save_line=zzline;
+ /* MR23 */
+ zzCONSUME;
+
+ zzmatch(115); zzCONSUME;
+ }
+ else {
+ if ( (LA(1)==102) ) {
+ }
+ else {zzFAIL(1,zzerr17,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+
+ /* MR23 */ if (p!= NULL && akaString != NULL) {
+ /* MR23 */ if (p->akaString != NULL) {
+ /* MR23 */ if (strcmp(p->akaString,akaString) != 0) {
+ /* MR23 */ warnFL(eMsg2("this #tokclass statement conflicts with a previous #tokclass %s(\"%s\") statement",
+ /* MR23 */ t,p->akaString),
+ /* MR23 */ FileStr[save_file],save_line);
+ /* MR23 */ };
+ /* MR23 */ } else {
+ /* MR23 */ p->akaString=akaString;
+ /* MR23 */ };
+ /* MR23 */ };
+ /* MR23 */
+ zzmatch(102); zzCONSUME;
+ {
+ zzBLOCK(zztasp2);
+ int zzcnt=1;
+ zzMake0;
+ {
+ do {
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==TokenTerm) ) {
+ zzmatch(TokenTerm);
+ if ( go ) {
+ term = (TermEntry *) hash_get(Tname, LATEXT(1));
+ if ( term==NULL && UserDefdTokens ) {
+ err("implicit token definition not allowed with #tokdefs");
+ go = 0;
+ }
+ else {t=mystrdup(LATEXT(1)); tok=addTname(LATEXT(1));}
+ }
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp4);
+ zzMake0;
+ {
+ if ( (LA(1)==119) ) {
+ zzmatch(119); zzCONSUME;
+ zzmatch(TokenTerm);
+ if ( go ) {
+ toterm = (TermEntry *) hash_get(Tname, LATEXT(1));
+ if ( toterm==NULL && UserDefdTokens ) {
+ err("implicit token definition not allowed with #tokdefs");
+ go = 0;
+ } else {
+ totext=mystrdup(LATEXT(1)); totok=addTname(LATEXT(1));
+ }
+ }
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd4[LA(1)]&0x8) ) {
+ }
+ else {zzFAIL(1,zzerr18,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp4);
+ }
+ }
+ }
+ else {
+ if ( (LA(1)==QuotedTerm) ) {
+ zzmatch(QuotedTerm);
+ if ( go ) {
+ term = (TermEntry *) hash_get(Texpr, LATEXT(1));
+ if ( term==NULL && UserDefdTokens ) {
+ err("implicit token definition not allowed with #tokdefs");
+ go = 0;
+ }
+ else {t=mystrdup(LATEXT(1)); tok=addTexpr(LATEXT(1));}
+ }
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr19,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ if ( go ) {
+ if (totext == NULL) {
+ list_add(&(e->tlist), t);
+ } else {
+ list_add(&(e->tlist),"..");
+ list_add(&(e->tlist),t);
+ list_add(&(e->tlist),totext);
+ }
+ totext=NULL;
+ }
+ zzLOOP(zztasp2);
+ } while ( (setwd4[LA(1)]&0x10) );
+ zzEXIT(zztasp2);
+ }
+ }
+ zzmatch(98); zzCONSUME;
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd4, 0x20);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+token(void)
+#else
+token()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ char *t=NULL, *e=NULL, *a=NULL; int tnum=0;
+ char *akaString=NULL; TermEntry *te;int save_file=0,save_line=0;
+ zzmatch(120);
+ tokenActionActive=1;
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==TokenTerm) ) {
+ zzmatch(TokenTerm);
+ t=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==114) ) {
+ zzmatch(114); zzCONSUME;
+ zzmatch(QuotedTerm);
+ akaString=mystrdup(StripQuotes(LATEXT(1)));
+ /* MR11 */ save_file=CurFile;save_line=zzline;
+ /* MR11 */
+ zzCONSUME;
+
+ zzmatch(115); zzCONSUME;
+ }
+ else {
+ if ( (setwd4[LA(1)]&0x40) ) {
+ }
+ else {zzFAIL(1,zzerr20,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==121) ) {
+ zzmatch(121); zzCONSUME;
+ zzmatch(122);
+ tnum = atoi(LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd4[LA(1)]&0x80) ) {
+ }
+ else {zzFAIL(1,zzerr21,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ }
+ else {
+ if ( (setwd5[LA(1)]&0x1) ) {
+ }
+ else {zzFAIL(1,zzerr22,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==QuotedTerm) ) {
+ zzmatch(QuotedTerm);
+ e=mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd5[LA(1)]&0x2) ) {
+ }
+ else {zzFAIL(1,zzerr23,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==Action) ) {
+ zzmatch(Action);
+
+ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(a!=NULL, "rule token: cannot allocate action");
+ strcpy(a, LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd5[LA(1)]&0x4) ) {
+ }
+ else {zzFAIL(1,zzerr24,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==107) ) {
+ zzmatch(107); zzCONSUME;
+ }
+ else {
+ if ( (setwd5[LA(1)]&0x8) ) {
+ }
+ else {zzFAIL(1,zzerr25,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ chkToken(t, e, a, tnum);
+ if (t != NULL) {
+ te=(TermEntry *)hash_get(Tname,t);
+ if (te != NULL && akaString != NULL) {
+ if (te->akaString != NULL) {
+ if (strcmp(te->akaString,akaString) != 0) {
+ warnFL(eMsg2("this #token statement conflicts with a previous #token %s(\"%s\") statement",
+ t,te->akaString),
+ FileStr[save_file],save_line);
+ };
+ } else {
+ te->akaString=akaString;
+ };
+ };
+ };
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd5, 0x10);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+block(set * toksrefd,set * rulesrefd)
+#else
+block(toksrefd,rulesrefd)
+ set *toksrefd;
+set *rulesrefd ;
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+
+ Graph g, b;
+ set saveblah;
+ int saveinalt = inAlt;
+ ExceptionGroup *eg;
+ * toksrefd = empty;
+ * rulesrefd = empty;
+ set_clr(AST_nodes_refd_in_actions);
+ CurBlockID++;
+ /* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID;
+ CurAltNum = 1;
+ /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
+ saveblah = attribsRefdFromAction;
+ attribsRefdFromAction = empty;
+ alt( toksrefd,rulesrefd );
+ b = g = zzaArg(zztasp1,1);
+
+ if ( ((Junction *)g.left)->p1->ntype == nAction )
+ {
+ ActionNode *actionNode=(ActionNode *)
+ ( ( (Junction *)g.left) ->p1);
+ if (!actionNode->is_predicate )
+ {
+ actionNode->init_action = TRUE;
+ /* MR12c */ if (actionNode->noHoist) {
+ /* MR12c */ errFL("<<nohoist>> appears as init-action - use <<>> <<nohoist>>",
+ /* MR12c */ FileStr[actionNode->file],actionNode->line);
+ /* MR12c */ };
+ }
+ }
+ ((Junction *)g.left)->blockid = CurBlockID;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (LA(1)==133) ) {
+ eg = exception_group();
+
+
+ if ( eg!=NULL ) {
+ /* MR7 ***** eg->altID = makeAltID(CurBlockID,CurAltNum); *****/
+ /* MR7 ***** CurAltStart->exception_label = eg->altID; *****/
+ list_add(&CurExGroups, (void *)eg);
+ }
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ CurAltNum++;
+ /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (LA(1)==123) ) {
+ zzmatch(123);
+ inAlt=1;
+ zzCONSUME;
+
+ alt( toksrefd,rulesrefd );
+ g = Or(g, zzaArg(zztasp2,2));
+
+ ((Junction *)g.left)->blockid = CurBlockID;
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ while ( (LA(1)==133) ) {
+ eg = exception_group();
+
+
+ if ( eg!=NULL ) {
+ /* MR7 ***** eg->altID = makeAltID(CurBlockID,CurAltNum); *****/
+ /* MR7 ***** CurAltStart->exception_label = eg->altID; *****/
+ list_add(&CurExGroups, (void *)eg);
+ }
+ zzLOOP(zztasp3);
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ CurAltNum++;
+ /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzaArg(zztasp1,0) = b;
+ attribsRefdFromAction = saveblah; inAlt = saveinalt;
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd5, 0x20);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+alt(set * toksrefd,set * rulesrefd)
+#else
+alt(toksrefd,rulesrefd)
+ set *toksrefd;
+set *rulesrefd ;
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ int n=0; Graph g; int e_num=0, old_not=0; Node *node; set elems, dif;
+ int first_on_line = 1, use_def_MT_handler = 0;
+ g.left=NULL; g.right=NULL;
+
+ CurAltStart = NULL;
+ elems = empty;
+ inAlt = 1;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==88) ) {
+ zzmatch(88);
+ use_def_MT_handler = 1;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd5[LA(1)]&0x40) ) {
+ }
+ else {zzFAIL(1,zzerr26,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ ;
+ while ( (setwd5[LA(1)]&0x80) ) {
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ old_not=0;
+ if ( (LA(1)==124) ) {
+ zzmatch(124);
+ old_not=1;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd6[LA(1)]&0x1) ) {
+ }
+ else {zzFAIL(1,zzerr27,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ node = element( old_not, first_on_line, use_def_MT_handler );
+
+ if ( node!=NULL && node->ntype!=nAction ) first_on_line = 0;
+
+ if ( zzaArg(zztasp2,2 ).left!=NULL ) {
+ g = Cat(g, zzaArg(zztasp2,2));
+ n++;
+ if ( node!=NULL ) {
+ if ( node->ntype!=nAction ) e_num++;
+ /* record record number of all rule and token refs */
+ if ( node->ntype==nToken ) {
+ TokNode *tk = (TokNode *)((Junction *)zzaArg(zztasp2,2 ).left)->p1;
+ tk->elnum = e_num;
+ set_orel(e_num, &elems);
+ }
+ else if ( node->ntype==nRuleRef ) {
+ RuleRefNode *rn = (RuleRefNode *)((Junction *)zzaArg(zztasp2,2 ).left)->p1;
+ rn->elnum = e_num;
+ set_orel(e_num, rulesrefd);
+ }
+ }
+ }
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ if ( n == 0 ) g = emptyAlt();
+ zzaArg(zztasp1,0) = g;
+ /* We want to reduce number of LT(i) calls and the number of
+ * local attribute variables in C++ mode (for moment, later we'll
+ * do for C also). However, if trees are being built, they
+ * require most of the attrib variables to create the tree nodes
+ * with; therefore, we gen a token ptr for each token ref in C++
+ */
+ if ( GenCC && !GenAST )
+ {
+ /* This now free's the temp set -ATG 5/6/95 */
+ set temp;
+ temp = set_and(elems, attribsRefdFromAction);
+ set_orin( toksrefd, temp);
+ set_free(temp);
+}
+else set_orin( toksrefd, elems);
+if ( GenCC ) {
+ dif = set_dif(attribsRefdFromAction, elems);
+ if ( set_deg(dif)>0 )
+ err("one or more $i in action(s) refer to non-token elements");
+ set_free(dif);
+}
+set_free(elems);
+set_free(attribsRefdFromAction);
+inAlt = 0;
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd6, 0x2);
+ }
+}
+
+LabelEntry *
+#ifdef __USE_PROTOS
+element_label(void)
+#else
+element_label()
+#endif
+{
+ LabelEntry * _retv;
+ zzRULE;
+ zzBLOCK(zztasp1);
+ PCCTS_PURIFY(_retv,sizeof(LabelEntry * ))
+ zzMake0;
+ {
+ TermEntry *t=NULL; LabelEntry *l=NULL; RuleEntry *r=NULL; char *lab;
+ zzmatch(LABEL);
+ lab = mystrdup(LATEXT(1));
+ zzCONSUME;
+
+
+ UsedNewStyleLabel = 1;
+ if ( UsedOldStyleAttrib ) err("cannot mix with new-style labels with old-style $i");
+ t = (TermEntry *) hash_get(Tname, lab);
+ if ( t==NULL ) t = (TermEntry *) hash_get(Texpr, lab);
+ if ( t==NULL ) r = (RuleEntry *) hash_get(Rname, lab);
+ if ( t!=NULL ) {
+ err(eMsg1("label definition clashes with token/tokclass definition: '%s'", lab));
+ _retv = NULL;
+ }
+ else if ( r!=NULL ) {
+ err(eMsg1("label definition clashes with rule definition: '%s'", lab));
+ _retv = NULL;
+ }
+ else {
+ /* we don't clash with anybody else */
+ l = (LabelEntry *) hash_get(Elabel, lab);
+ if ( l==NULL ) { /* ok to add new element label */
+ l = (LabelEntry *)hash_add(Elabel,
+ lab,
+ (Entry *)newLabelEntry(lab));
+ /* add to list of element labels for this rule */
+ list_add(&CurElementLabels, (void *)lab);
+ /* MR7 */ leAdd(l); /* list of labels waiting for exception group definitions */
+ _retv = l;
+ }
+ else {
+ err(eMsg1("label definitions must be unique per rule: '%s'", lab));
+ _retv = NULL;
+}
+}
+ zzmatch(106); zzCONSUME;
+ zzEXIT(zztasp1);
+ return _retv;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd6, 0x4);
+ return _retv;
+ }
+}
+
+Node *
+#ifdef __USE_PROTOS
+element(int old_not,int first_on_line,int use_def_MT_handler)
+#else
+element(old_not,first_on_line,use_def_MT_handler)
+ int old_not;
+int first_on_line;
+int use_def_MT_handler ;
+#endif
+{
+ Node * _retv;
+ zzRULE;
+ zzBLOCK(zztasp1);
+ PCCTS_PURIFY(_retv,sizeof(Node * ))
+ zzMake0;
+ {
+
+ Attrib blk;
+ Predicate *pred = NULL;
+ int local_use_def_MT_handler=0;
+ ActionNode *act;
+ RuleRefNode *rr;
+ set toksrefd, rulesrefd;
+ TermEntry *term;
+ TokNode *p=NULL; RuleRefNode *q; int approx=0;
+ LabelEntry *label=NULL;
+ int predMsgDone=0;
+ int semDepth=0;
+ int ampersandStyle;
+ int height; /* MR11 */
+ int equal_height; /* MR11 */
+
+ char* pFirstSetSymbol = NULL; /* MR21 */
+
+ _retv = NULL;
+ if ( (setwd6[LA(1)]&0x8) ) {
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==LABEL) ) {
+ label = element_label();
+
+ }
+ else {
+ if ( (setwd6[LA(1)]&0x10) ) {
+ }
+ else {zzFAIL(1,zzerr28,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==TokenTerm) ) {
+ zzmatch(TokenTerm);
+
+ term = (TermEntry *) hash_get(Tname, LATEXT(1));
+ if ( term==NULL && UserDefdTokens ) {
+ err("implicit token definition not allowed with #tokdefs");
+ zzaRet.left = zzaRet.right = NULL;
+ }
+ else {
+ zzaRet = buildToken(LATEXT(1));
+ p=((TokNode *)((Junction *)zzaRet.left)->p1);
+ term = (TermEntry *) hash_get(Tname, LATEXT(1));
+ require( term!= NULL, "hash table mechanism is broken");
+ p->tclass = term->tclass;
+ p->complement = old_not;
+ if ( label!=NULL ) {
+ p->el_label = label->str;
+ label->elem = (Node *)p;
+ }
+ }
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==119) ) {
+ zzmatch(119); zzCONSUME;
+ {
+ zzBLOCK(zztasp4);
+ zzMake0;
+ {
+ if ( (LA(1)==QuotedTerm) ) {
+ zzmatch(QuotedTerm);
+ if ( p!=NULL ) setUpperRange(p, LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==TokenTerm) ) {
+ zzmatch(TokenTerm);
+ if ( p!=NULL ) setUpperRange(p, LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr29,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp4);
+ }
+ }
+ }
+ else {
+ if ( (setwd6[LA(1)]&0x20) ) {
+ }
+ else {zzFAIL(1,zzerr30,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+
+ if ( p!=NULL && (p->upper_range!=0 || p->tclass || old_not) )
+ list_add(&MetaTokenNodes, (void *)p);
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==125) ) {
+ zzmatch(125);
+ if ( p!=NULL ) p->astnode=ASTroot;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd6[LA(1)]&0x40) ) {
+ if ( p!=NULL ) p->astnode=ASTchild;
+ }
+ else {
+ if ( (LA(1)==103) ) {
+ zzmatch(103);
+ if ( p!=NULL ) p->astnode=ASTexclude;
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr31,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==88) ) {
+ zzmatch(88);
+ local_use_def_MT_handler = 1;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd6[LA(1)]&0x80) ) {
+ }
+ else {zzFAIL(1,zzerr32,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+
+ if ( p!=NULL && first_on_line ) {
+ CurAltStart = (Junction *)zzaRet.left;
+ altAdd(CurAltStart); /* MR7 */
+ p->altstart = CurAltStart;
+ }
+ if ( p!=NULL )
+ p->use_def_MT_handler = use_def_MT_handler || local_use_def_MT_handler;
+ _retv = (Node *)p;
+ }
+ else {
+ if ( (LA(1)==QuotedTerm) ) {
+ zzmatch(QuotedTerm);
+
+ term = (TermEntry *) hash_get(Texpr, LATEXT(1));
+ if ( term==NULL && UserDefdTokens ) {
+ err("implicit token definition not allowed with #tokdefs");
+ zzaRet.left = zzaRet.right = NULL;
+ }
+ else {
+ zzaRet = buildToken(LATEXT(1)); p=((TokNode *)((Junction *)zzaRet.left)->p1);
+ p->complement = old_not;
+ if ( label!=NULL ) {
+ p->el_label = label->str;
+ label->elem = (Node *)p;
+ }
+ }
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==119) ) {
+ zzmatch(119); zzCONSUME;
+ {
+ zzBLOCK(zztasp4);
+ zzMake0;
+ {
+ if ( (LA(1)==QuotedTerm) ) {
+ zzmatch(QuotedTerm);
+ if ( p!=NULL ) setUpperRange(p, LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==TokenTerm) ) {
+ zzmatch(TokenTerm);
+ if ( p!=NULL ) setUpperRange(p, LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr33,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp4);
+ }
+ }
+ }
+ else {
+ if ( (setwd7[LA(1)]&0x1) ) {
+ }
+ else {zzFAIL(1,zzerr34,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==125) ) {
+ zzmatch(125);
+ if ( p!=NULL ) p->astnode=ASTroot;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd7[LA(1)]&0x2) ) {
+ if ( p!=NULL ) p->astnode=ASTchild;
+ }
+ else {
+ if ( (LA(1)==103) ) {
+ zzmatch(103);
+ if ( p!=NULL ) p->astnode=ASTexclude;
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr35,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==88) ) {
+ zzmatch(88);
+ local_use_def_MT_handler = 1;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd7[LA(1)]&0x4) ) {
+ }
+ else {zzFAIL(1,zzerr36,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+
+ if ( p!=NULL && (p->upper_range!=0 || p->tclass || old_not) )
+ list_add(&MetaTokenNodes, (void *)p);
+
+ if ( first_on_line ) {
+ CurAltStart = (Junction *)zzaRet.left;
+ altAdd(CurAltStart); /* MR7 */
+ p->altstart = CurAltStart;
+ }
+ if ( p!=NULL )
+ p->use_def_MT_handler = use_def_MT_handler || local_use_def_MT_handler;
+ _retv = (Node *)p;
+ }
+ else {
+ if ( (LA(1)==WildCard) ) {
+ if ( old_not ) warn("~ WILDCARD is an undefined operation (implies 'nothing')");
+ zzmatch(WildCard);
+ zzaRet = buildWildCard(LATEXT(1)); p=((TokNode *)((Junction *)zzaRet.left)->p1);
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==125) ) {
+ zzmatch(125);
+ p->astnode=ASTroot;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd7[LA(1)]&0x8) ) {
+ p->astnode=ASTchild;
+ }
+ else {
+ if ( (LA(1)==103) ) {
+ zzmatch(103);
+ p->astnode=ASTexclude;
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr37,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ list_add(&MetaTokenNodes, (void *)p);
+
+ if ( first_on_line ) {
+ CurAltStart = (Junction *)zzaRet.left;
+ altAdd(CurAltStart); /* MR7 */
+ p->altstart = CurAltStart;
+ if ( label!=NULL ) {
+ p->el_label = label->str;
+ label->elem = (Node *)p;
+ }
+ }
+ _retv = (Node *)p;
+ }
+ else {
+ if ( (LA(1)==NonTerminal) ) {
+ if ( old_not ) warn("~ NONTERMINAL is an undefined operation");
+ zzmatch(NonTerminal);
+ zzaRet = buildRuleRef(LATEXT(1));
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==103) ) {
+ zzmatch(103);
+ q = (RuleRefNode *) ((Junction *)zzaRet.left)->p1;
+ q->astnode=ASTexclude;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd7[LA(1)]&0x10) ) {
+ }
+ else {zzFAIL(1,zzerr38,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (setwd7[LA(1)]&0x20) ) {
+ {
+ zzBLOCK(zztasp4);
+ zzMake0;
+ {
+ if ( (LA(1)==104) ) {
+ zzmatch(104); zzCONSUME;
+ }
+ else {
+ if ( (LA(1)==PassAction) ) {
+ }
+ else {zzFAIL(1,zzerr39,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp4);
+ }
+ }
+ zzmatch(PassAction);
+ addParm(((Junction *)zzaRet.left)->p1, LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd7[LA(1)]&0x40) ) {
+ }
+ else {zzFAIL(1,zzerr40,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ rr=(RuleRefNode *) ((Junction *)zzaRet.left)->p1;
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ char *a;
+ if ( (LA(1)==105) ) {
+ zzmatch(105); zzCONSUME;
+ zzmatch(PassAction);
+
+ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(a!=NULL, "rule element: cannot allocate assignment");
+ strcpy(a, LATEXT(1));
+ rr->assign = a;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd7[LA(1)]&0x80) ) {
+ }
+ else {zzFAIL(1,zzerr41,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+
+ if ( label!=NULL ) {
+ rr->el_label = label->str;
+ label->elem = (Node *)rr;
+ }
+ if ( first_on_line ) {
+ CurAltStart = (Junction *)zzaRet.left;
+ altAdd(CurAltStart); /* MR7 */
+ ((RuleRefNode *)((Junction *)zzaRet.left)->p1)->altstart = CurAltStart;
+ }
+ _retv = (Node *)rr;
+ }
+ else {zzFAIL(1,zzerr42,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ }
+ else {
+ if ( (LA(1)==Action) ) {
+ if ( old_not ) warn("~ ACTION is an undefined operation");
+ zzmatch(Action);
+ zzaArg(zztasp1,0) = buildAction(LATEXT(1),action_file,action_line, 0);
+ zzCONSUME;
+
+ if ( first_on_line ) { /* MR7 */
+ CurAltStart = (Junction *)zzaArg(zztasp1,0 ).left; /* MR7 */
+ altAdd(CurAltStart); /* MR7 */
+ };
+ _retv = (Node *) ((Junction *)zzaArg(zztasp1,0 ).left)->p1;
+ }
+ else {
+ if ( (LA(1)==Pred) ) {
+ if ( old_not ) warn("~ SEMANTIC-PREDICATE is an undefined operation");
+ zzmatch(Pred);
+ zzaArg(zztasp1,0) = buildAction(LATEXT(1),action_file,action_line, 1);
+ zzCONSUME;
+
+ act = (ActionNode *) ((Junction *)zzaArg(zztasp1,0 ).left)->p1;
+ if (numericActionLabel) { /* MR10 */
+ list_add(&NumericPredLabels,act); /* MR10 */
+ numericActionLabel=0; /* MR10 */
+ }; /* MR10 */
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ char *a;
+ if ( (LA(1)==PassAction) ) {
+ zzmatch(PassAction);
+
+ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(a!=NULL, "rule element: cannot allocate predicate fail action");
+ strcpy(a, LATEXT(1));
+ act->pred_fail = a;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd8[LA(1)]&0x1) ) {
+ }
+ else {zzFAIL(1,zzerr43,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ if ( first_on_line ) { /* MR7 */
+ CurAltStart = (Junction *)zzaArg(zztasp1,0 ).left; /* MR7 */
+ altAdd(CurAltStart); /* MR7 */
+ };
+ _retv = (Node *)act;
+ }
+ else {
+ if ( (setwd8[LA(1)]&0x2) ) {
+ if ( old_not ) warn("~ BLOCK is an undefined operation");
+ BlkLevel++;
+ if (BlkLevel >= MAX_BLK_LEVEL) fatal("Blocks nested too deeply");
+ /* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID;
+ /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==Pragma) ) {
+ zzmatch(Pragma); zzCONSUME;
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==126) ) {
+ zzmatch(126);
+ approx=LL_k;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==127) ) {
+ zzmatch(127);
+ approx = 1;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==128) ) {
+ zzmatch(128);
+ approx = 2;
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr44,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ }
+ else {
+ if ( (setwd8[LA(1)]&0x4) ) {
+ }
+ else {zzFAIL(1,zzerr45,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==FirstSetSymbol) ) {
+ zzmatch(FirstSetSymbol); zzCONSUME;
+ zzmatch(114); zzCONSUME;
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==NonTerminal) ) {
+ zzmatch(NonTerminal);
+
+ /* MR21 */ pFirstSetSymbol = (char *) calloc(strlen(LATEXT(1))+1,
+ /* MR21 */ sizeof(char));
+ /* MR21 */ require(pFirstSetSymbol!=NULL,
+ /* MR21 */ "cannot allocate first set name");
+ /* MR21 */ strcpy(pFirstSetSymbol, LATEXT(1));
+ /* MR21 */
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==TokenTerm) ) {
+ zzmatch(TokenTerm);
+
+ /* MR21 */ pFirstSetSymbol = (char *) calloc(strlen(LATEXT(1))+1,
+ /* MR21 */ sizeof(char));
+ /* MR21 */ require(pFirstSetSymbol!=NULL,
+ /* MR21 */ "cannot allocate first set name");
+ /* MR21 */ strcpy(pFirstSetSymbol, LATEXT(1));
+ /* MR21 */
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr46,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ zzmatch(115); zzCONSUME;
+ }
+ else {
+ if ( (setwd8[LA(1)]&0x8) ) {
+ }
+ else {zzFAIL(1,zzerr47,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==114) ) {
+ zzmatch(114); zzCONSUME;
+ block( &toksrefd,&rulesrefd );
+ zzmatch(115);
+ blk = zzaRet = zzaArg(zztasp2,2);
+ /* MR23 */ CurBlockID_array[BlkLevel] = (-1);
+ /* MR23 */ CurAltNum_array[BlkLevel] = (-1);
+ --BlkLevel;
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==129) ) {
+ zzmatch(129);
+ zzaRet = makeLoop(zzaRet,approx,pFirstSetSymbol);
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==130) ) {
+ zzmatch(130);
+ zzaRet = makePlus(zzaRet,approx,pFirstSetSymbol);
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==131) ) {
+ zzmatch(131); zzCONSUME;
+ {
+ zzBLOCK(zztasp4);
+ zzMake0;
+ {
+ if ( (setwd8[LA(1)]&0x10) ) {
+ {
+ zzBLOCK(zztasp5);
+ zzMake0;
+ {
+ if ( (LA(1)==132) ) {
+ zzmatch(132);
+ ampersandStyle=0;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==113) ) {
+ zzmatch(113);
+ ampersandStyle=1;
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr48,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp5);
+ }
+ }
+ zzmatch(Pred);
+ zzaRet = buildAction(LATEXT(1),action_file,action_line,1);
+ zzCONSUME;
+
+ act = (ActionNode *) ((Junction *)zzaRet.left)->p1;
+ semDepth=predicateLookaheadDepth(act);
+ if (numericActionLabel) { /* MR10 */
+ list_add(&NumericPredLabels,act); /* MR10 */
+ numericActionLabel=0; /* MR10 */
+ }; /* MR10 */
+ {
+ zzBLOCK(zztasp5);
+ zzMake0;
+ {
+ char *a;
+ if ( (LA(1)==PassAction) ) {
+ zzmatch(PassAction);
+
+ a = (char *)calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(a!=NULL, "rule element: cannot allocate predicate fail action");
+ strcpy(a, LATEXT(1));
+ act->pred_fail = a;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd8[LA(1)]&0x20) ) {
+ }
+ else {zzFAIL(1,zzerr49,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp5);
+ }
+ }
+ if ( first_on_line) { /* MR7 */
+ CurAltStart=(Junction *)zzaRet.left; /* MR7 */
+ altAdd(CurAltStart); /* MR7 */
+ };
+ _retv = (Node *)act;
+
+ pred = computePredFromContextGuard(blk,&predMsgDone); /* MR10 */
+ if ( pred==NULL) { /* MR10 */
+ if ( !predMsgDone) err("invalid or missing context guard"); /* MR10 */
+ predMsgDone=1; /* MR10 */
+ } else { /* MR10 */
+ act->guardNodes=(Junction *)blk.left; /* MR11 */
+ pred->expr = act->action;
+ pred->source = act;
+ /* MR10 */ pred->ampersandStyle = ampersandStyle; /* 0 means (g)? => ... 1 means (g)? && ... */
+ /* MR13 */ if (pred->tcontext != NULL) {
+ /* MR13 */ height=MR_max_height_of_tree(pred->tcontext);
+ /* MR13 */ equal_height=MR_all_leaves_same_height(pred->tcontext,height);
+ /* MR13 */ if (! equal_height) {
+ /* MR13 */ errFL("in guarded predicates all tokens in the guard must be at the same height",
+ /* MR13 */ FileStr[act->file],act->line);
+ /* MR13 */ };
+ /* MR13 */ }
+ /* MR10 */ if (ampersandStyle) {
+ /* MR10 */ act->ampersandPred = pred;
+ /* MR11 */ if (! HoistPredicateContext) {
+ /* MR11 */ errFL("without \"-prc on\" (guard)? && <<pred>>? ... doesn't make sense",
+ /* MR11 */ FileStr[act->file],act->line);
+ /* MR11 */ };
+ /* MR10 */ } else {
+ /* MR10 */ act->guardpred = pred;
+ /* MR10 */ };
+ /* MR10 */ if (pred->k != semDepth) {
+ /* MR10 */ warn(eMsgd2("length of guard (%d) does not match the length of semantic predicate (%d)",
+ /* MR10 */ pred->k,semDepth));
+ /* MR10 */ };
+ }
+ }
+ else {
+ if ( (setwd8[LA(1)]&0x40) ) {
+ zzaRet = makeBlk(zzaRet,approx,pFirstSetSymbol);
+ FoundGuessBlk = 1;
+ ((Junction *) ((Junction *)zzaRet.left)->p1)->guess=1;
+ if ( ! first_on_line ) {
+ err("(...)? predicate must be first element of production");
+ }
+ }
+ else {zzFAIL(1,zzerr50,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp4);
+ }
+ }
+ }
+ else {
+ if ( (setwd8[LA(1)]&0x80) ) {
+ zzaRet = makeBlk(zzaRet,approx,pFirstSetSymbol);
+ }
+ else {zzFAIL(1,zzerr51,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+
+ if ( pred==NULL && !predMsgDone) { /* MR10 */
+ ((Junction *)((Junction *)zzaRet.left)->p1)->blockid = CurBlockID;
+ ((Junction *)((Junction *)zzaRet.left)->p1)->tokrefs = toksrefd;
+ ((Junction *)((Junction *)zzaRet.left)->p1)->rulerefs = rulesrefd;
+ if ( first_on_line ) { /* MR7 */
+ CurAltStart = (Junction *)((Junction *)((Junction *)zzaRet.left)->p1); /* MR7 */
+ altAdd(CurAltStart); /* MR7 */
+ }; /* MR7 */
+ _retv = (Node *) ((Junction *)zzaRet.left)->p1;
+ }
+ }
+ else {
+ if ( (LA(1)==102) ) {
+ zzmatch(102); zzCONSUME;
+ block( &toksrefd,&rulesrefd );
+ zzaRet = makeOpt(zzaArg(zztasp2,2),approx,pFirstSetSymbol);
+ /* MR23 */ CurBlockID_array[BlkLevel] = (-1);
+ /* MR23 */ CurAltNum_array[BlkLevel] = (-1);
+ --BlkLevel;
+ zzmatch(98);
+
+ ((Junction *)((Junction *)zzaRet.left)->p1)->blockid = CurBlockID;
+ ((Junction *)((Junction *)zzaRet.left)->p1)->tokrefs = toksrefd;
+ ((Junction *)((Junction *)zzaRet.left)->p1)->rulerefs = rulesrefd;
+ zzCONSUME;
+
+ if ( first_on_line ) { /* MR7 */
+ CurAltStart = (Junction *) ((Junction *)((Junction *)zzaRet.left)->p1); /* MR7 */
+ altAdd(CurAltStart); /* MR7 */
+ };
+ _retv = (Node *) ((Junction *)zzaRet.left)->p1;
+ }
+ else {zzFAIL(1,zzerr52,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ }
+ else {
+ if ( (LA(1)==129) ) {
+ zzmatch(129);
+ warn("don't you want a ')' with that '*'?"); CannotContinue=TRUE;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==130) ) {
+ zzmatch(130);
+ warn("don't you want a ')' with that '+'?"); CannotContinue=TRUE;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==105) ) {
+ zzmatch(105);
+ warn("'>' can only appear after a nonterminal"); CannotContinue=TRUE;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==PassAction) ) {
+ zzmatch(PassAction);
+ warn("[...] out of context 'rule > [...]'");
+ CannotContinue=TRUE;
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr53,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ zzEXIT(zztasp1);
+ return _retv;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd9, 0x1);
+ return _retv;
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+default_exception_handler(void)
+#else
+default_exception_handler()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ DefaultExGroup = exception_group();
+
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd9, 0x2);
+ }
+}
+
+ExceptionGroup *
+#ifdef __USE_PROTOS
+exception_group(void)
+#else
+exception_group()
+#endif
+{
+ ExceptionGroup * _retv;
+ zzRULE;
+ zzBLOCK(zztasp1);
+ PCCTS_PURIFY(_retv,sizeof(ExceptionGroup * ))
+ zzMake0;
+ {
+ ExceptionHandler *h; LabelEntry *label=NULL; /* MR6 */
+ FoundException = 1; FoundExceptionGroup = 1;
+ zzmatch(133);
+ _retv = (ExceptionGroup *)calloc(1, sizeof(ExceptionGroup));
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ char *p;
+ if ( (LA(1)==PassAction) ) {
+ zzmatch(PassAction);
+
+ p = LATEXT(1)+1;
+ p[strlen(p)-1] = '\0'; /* kill trailing space */
+ label = (LabelEntry *) hash_get(Elabel, LATEXT(1)+1);
+ if ( label==NULL )
+ {
+ err(eMsg1("unknown label in exception handler: '%s'", LATEXT(1)+1));
+ }
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd9[LA(1)]&0x4) ) {
+ }
+ else {zzFAIL(1,zzerr54,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (LA(1)==135) ) {
+ h = exception_handler();
+
+ list_add(&(_retv->handlers), (void *)h);
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==134) ) {
+ zzmatch(134); zzCONSUME;
+ zzmatch(106); zzCONSUME;
+ zzmatch(Action);
+ {
+ ExceptionHandler *eh = (ExceptionHandler *)
+ calloc(1, sizeof(ExceptionHandler));
+ char *a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(eh!=NULL, "exception: cannot allocate handler");
+ require(a!=NULL, "exception: cannot allocate action");
+ strcpy(a, LATEXT(1));
+ eh->action = a;
+ eh->signalname = (char *) calloc(strlen("default")+1, sizeof(char));
+ require(eh->signalname!=NULL, "exception: cannot allocate sig name");
+ strcpy(eh->signalname, "default");
+ list_add(&(_retv->handlers), (void *)eh);
+ }
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd9[LA(1)]&0x8) ) {
+ }
+ else {zzFAIL(1,zzerr55,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+
+ if ( label!=NULL ) {
+ /* Record ex group in sym tab for this label */
+ if ( label->ex_group!=NULL ) {
+ err(eMsg1("duplicate exception handler for label '%s'",label->str));
+ } else {
+ label->ex_group = _retv;
+ /* Label the exception group itself */
+ _retv->label = label->str;
+ /* Make the labelled element pt to the exception also */
+ /* MR6 */ if (label->elem == NULL) {
+ /* MR6 */ err(eMsg1("reference in exception handler to undefined label '%s'",label->str));
+ /* MR6 */ } else {
+ switch ( label->elem->ntype ) {
+ case nRuleRef :
+ {
+ RuleRefNode *r = (RuleRefNode *)label->elem;
+ r->ex_group = _retv;
+ break;
+ }
+ case nToken :
+ {
+ TokNode *t = (TokNode *)label->elem;
+ t->ex_group = _retv;
+ break;
+ }
+ } /* end switch */
+ /* MR6 */ }; /* end test on label->elem */
+ } /* end test on label->ex_group */
+
+ } /* end test on exception label */
+
+/* MR7 */
+ /* MR7 */ if (BlkLevel == 1 && label == NULL) {
+ /* MR7 */ _retv->forRule=1;
+ /* MR7 */ } else if (label == NULL) {
+ /* MR7 */ _retv->altID = makeAltID(CurBlockID_array[BlkLevel], CurAltNum_array[BlkLevel]);
+ /* MR7 */ egAdd(_retv);
+ /* MR7 */ } else {
+ /* MR7 */ _retv->labelEntry=label;
+ /* MR7 */ };
+ /* MR7 */
+ /* MR7 */ /* You may want to remove this exc from the rule list */
+ /* MR7 */ /* and handle at the labeled element site. */
+ /* MR7 */
+ /* MR7 */ if (label != NULL) {
+ /* MR7 */ _retv = NULL;
+ /* MR7 */ };
+ zzEXIT(zztasp1);
+ return _retv;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd9, 0x10);
+ return _retv;
+ }
+}
+
+ExceptionHandler *
+#ifdef __USE_PROTOS
+exception_handler(void)
+#else
+exception_handler()
+#endif
+{
+ ExceptionHandler * _retv;
+ zzRULE;
+ zzBLOCK(zztasp1);
+ PCCTS_PURIFY(_retv,sizeof(ExceptionHandler * ))
+ zzMake0;
+ {
+ ;
+ zzmatch(135);
+
+ _retv = (ExceptionHandler *)calloc(1, sizeof(ExceptionHandler));
+ require(_retv!=NULL, "exception: cannot allocate handler");
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==NonTerminal) ) {
+ zzmatch(NonTerminal);
+
+ _retv->signalname = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(_retv->signalname!=NULL, "exception: cannot allocate sig name");
+ strcpy(_retv->signalname, LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==TokenTerm) ) {
+ zzmatch(TokenTerm);
+
+ _retv->signalname = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(_retv->signalname!=NULL, "exception: cannot allocate sig name");
+ strcpy(_retv->signalname, LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr56,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzmatch(106); zzCONSUME;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ _retv->action = NULL;
+ if ( (LA(1)==Action) ) {
+ zzmatch(Action);
+
+ _retv->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(_retv->action!=NULL, "exception: cannot allocate action");
+ strcpy(_retv->action, LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd9[LA(1)]&0x20) ) {
+ }
+ else {zzFAIL(1,zzerr57,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzEXIT(zztasp1);
+ return _retv;
+fail:
+ zzEXIT(zztasp1);
+ CannotContinue=TRUE;
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd9, 0x40);
+ return _retv;
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+enum_file(char * fname)
+#else
+enum_file(fname)
+ char *fname ;
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ if ( (setwd9[LA(1)]&0x80) ) {
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==143) ) {
+ zzmatch(143); zzCONSUME;
+ zzmatch(ID); zzCONSUME;
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==149) ) {
+ zzmatch(149); zzCONSUME;
+ zzmatch(ID); zzCONSUME;
+ }
+ else {
+ if ( (setwd10[LA(1)]&0x1) ) {
+ }
+ else {zzFAIL(1,zzerr58,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ }
+ else {
+ if ( (setwd10[LA(1)]&0x2) ) {
+ }
+ else {zzFAIL(1,zzerr59,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==151) ) {
+ {
+ zzBLOCK(zztasp3);
+ int zzcnt=1;
+ zzMake0;
+ {
+ do {
+ enum_def( fname );
+ zzLOOP(zztasp3);
+ } while ( (LA(1)==151) );
+ zzEXIT(zztasp3);
+ }
+ }
+ }
+ else {
+ if ( (LA(1)==149) ) {
+ defines( fname );
+ }
+ else {zzFAIL(1,zzerr60,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ }
+ else {
+ if ( (LA(1)==Eof) ) {
+ }
+ else {zzFAIL(1,zzerr61,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd10, 0x4);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+defines(char * fname)
+#else
+defines(fname)
+ char *fname ;
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ int v; int maxt=(-1); char *t;
+ {
+ zzBLOCK(zztasp2);
+ int zzcnt=1;
+ zzMake0;
+ {
+ do {
+ zzmatch(149); zzCONSUME;
+ zzmatch(ID);
+ t = mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ zzmatch(INT);
+
+ v = atoi(LATEXT(1));
+ /* fprintf(stderr, "#token %s=%d\n", t, v);*/
+
+ /* MR2 Andreas Magnusson (Andreas.Magnusson@mailbox.swipnet.se) */
+ /* MR2 Fix to bug introduced by 1.33MR1 for #tokdefs */
+ /* MR2 Don't let #tokdefs be confused by */
+ /* MR2 DLGminToken and DLGmaxToken */
+
+ if ( ! isDLGmaxToken(t)) { /* MR2 */
+ TokenNum = v;
+ if ( v>maxt ) maxt=v;
+ if ( Tnum( t ) == 0 ) {
+ addForcedTname( t, v );
+ } else {
+ warnFL(eMsg1("redefinition of token %s; ignored",t), fname,zzline);
+ };
+};
+ zzCONSUME;
+
+ zzLOOP(zztasp2);
+ } while ( (LA(1)==149) );
+ zzEXIT(zztasp2);
+ }
+ }
+ TokenNum = maxt + 1;
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd10, 0x8);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+enum_def(char * fname)
+#else
+enum_def(fname)
+ char *fname ;
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ int v= 0; int maxt=(-1); char *t;
+ zzmatch(151); zzCONSUME;
+ zzmatch(ID); zzCONSUME;
+ zzmatch(152); zzCONSUME;
+ zzmatch(ID);
+ t = mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==153) ) {
+ zzmatch(153); zzCONSUME;
+ zzmatch(INT);
+ v=atoi(LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd10[LA(1)]&0x10) ) {
+ v++;
+ }
+ else {zzFAIL(1,zzerr62,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+
+ /* fprintf(stderr, "#token %s=%d\n", t, v);*/
+ TokenNum = v;
+ if ( v>maxt ) maxt=v; /* MR3 */
+ if ( Tnum( t ) == 0 ) addForcedTname( t, v );
+ else {
+ warnFL(eMsg1("redefinition of token %s; ignored",t), fname,zzline);
+ }
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (LA(1)==154) ) {
+ zzmatch(154); zzCONSUME;
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==ID)&&(isDLGmaxToken(LATEXT(1))) ) {
+ if (!(isDLGmaxToken(LATEXT(1))) ) {zzfailed_pred(" isDLGmaxToken(LATEXT(1))",0 /* report */, { ; /* no user action */ } );}
+ zzmatch(ID); zzCONSUME;
+ {
+ zzBLOCK(zztasp4);
+ zzMake0;
+ {
+ if ( (LA(1)==153) ) {
+ zzmatch(153); zzCONSUME;
+ zzmatch(INT); zzCONSUME;
+ }
+ else {
+ if ( (setwd10[LA(1)]&0x20) ) {
+ }
+ else {zzFAIL(1,zzerr63,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp4);
+ }
+ }
+ }
+ else {
+ if ( (LA(1)==ID) ) {
+ zzmatch(ID);
+ t = mystrdup(LATEXT(1));
+ zzCONSUME;
+
+ {
+ zzBLOCK(zztasp4);
+ zzMake0;
+ {
+ if ( (LA(1)==153) ) {
+ zzmatch(153); zzCONSUME;
+ zzmatch(INT);
+ v=atoi(LATEXT(1));
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd10[LA(1)]&0x40) ) {
+ v++;
+ }
+ else {zzFAIL(1,zzerr64,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp4);
+ }
+ }
+
+ /* fprintf(stderr, "#token %s=%d\n", t, v);*/
+ TokenNum = v;
+ if ( v>maxt ) maxt=v; /* MR3 */
+ if ( Tnum( t ) == 0 ) addForcedTname( t, v );
+ else {
+ warnFL(eMsg1("redefinition of token %s; ignored",t), fname,zzline);
+ }
+ }
+ else {
+ if ( (setwd10[LA(1)]&0x80) ) {
+ }
+ else {zzFAIL(1,zzerr65,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzmatch(155); zzCONSUME;
+ zzmatch(156);
+ TokenNum = maxt + 1;
+ zzCONSUME;
+
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd11, 0x1);
+ }
+}
+
+
+/* MR2 Andreas Magnusson (Andreas.Magnusson@mailbox.swipnet.se) */
+/* MR2 Fix to bug introduced by 1.33MR1 for #tokdefs */
+/* MR2 Don't let #tokdefs be confused by */
+/* MR2 DLGminToken and DLGmaxToken */
+
+/* semantic check on DLGminToken and DLGmaxmaxToken in #tokdefs */
+
+#ifdef __USE_PROTOS
+static int isDLGmaxToken(char *Token)
+#else
+static int isDLGmaxToken(Token)
+char * Token;
+#endif
+{
+static char checkStr1[] = "DLGmaxToken";
+static char checkStr2[] = "DLGminToken";
+
+ if (strcmp(Token, checkStr1) == 0)
+return 1;
+else if (strcmp(Token, checkStr2) == 0)
+return 1;
+else
+return 0;
+}
+
+/* semantics of #token */
+static void
+#ifdef __USE_PROTOS
+chkToken(char *t, char *e, char *a, int tnum)
+#else
+chkToken(t,e,a,tnum)
+char *t, *e, *a;
+int tnum;
+#endif
+{
+TermEntry *p;
+
+ /* check to see that they don't try to redefine a token as a token class */
+if ( t!=NULL ) {
+p = (TermEntry *) hash_get(Tname, t);
+if ( p!=NULL && p->classname ) {
+ err(eMsg1("redefinition of #tokclass '%s' to #token not allowed; ignored",t));
+ if ( a!=NULL ) free((char *)a);
+ return;
+}
+}
+
+ if ( t==NULL && e==NULL ) { /* none found */
+err("#token requires at least token name or rexpr");
+}
+else if ( t!=NULL && e!=NULL ) { /* both found */
+if ( UserDefdTokens ) { /* if #tokdefs, must not define new */
+ p = (TermEntry *) hash_get(Tname, t);
+ if ( p == NULL) {
+ err(eMsg1("new token definition '%s' not allowed - only #token with name already defined by #tokdefs file allowed",t));
+ return;
+ };
+}
+Tklink(t, e);
+if ( a!=NULL ) {
+ if ( hasAction(e) ) {
+ err(eMsg1("redefinition of action for %s; ignored",e));
+ }
+ else setHasAction(e, a);
+}
+}
+else if ( t!=NULL ) { /* only one found */
+if ( UserDefdTokens ) {
+ p = (TermEntry *) hash_get(Tname, t);
+ if (p == NULL) {
+ err(eMsg1("new token definition '%s' not allowed - only #token with name already defined by #tokdefs file allowed",t));
+ };
+ return;
+}
+if ( Tnum( t ) == 0 ) addTname( t );
+else {
+ err(eMsg1("redefinition of token %s; ignored",t));
+}
+if ( a!=NULL ) {
+ err(eMsg1("action cannot be attached to a token name (%s); ignored",t));
+ free((char *)a);
+}
+}
+else if ( e!=NULL ) {
+if ( Tnum( e ) == 0 ) addTexpr( e );
+else {
+ if ( hasAction(e) ) {
+ err(eMsg1("redefinition of action for expr %s; ignored",e));
+ }
+ else if ( a==NULL ) {
+ err(eMsg1("redefinition of expr %s; ignored",e));
+ }
+}
+if ( a!=NULL ) setHasAction(e, a);
+}
+
+ /* if a token type number was specified, then add the token ID and 'tnum'
+* pair to the ForcedTokens list. (only applies if an id was given)
+*/
+if ( t!=NULL && tnum>0 )
+{
+if ( set_el(tnum, reserved_positions) )
+{
+ err(eMsgd("a token has already been forced to token number %d; ignored", tnum));
+}
+else
+{
+ list_add(&ForcedTokens, newForcedToken(t,tnum));
+ set_orel(tnum, &reserved_positions);
+}
+}
+}
+
+static int
+#ifdef __USE_PROTOS
+match_token(char *s, char **nxt)
+#else
+match_token(s,nxt)
+char *s;
+char **nxt;
+#endif
+{
+ if ( !(*s>='A' && *s<='Z') ) return 0;
+ s++;
+ while ( (*s>='a' && *s<='z') ||
+ (*s>='A' && *s<='Z') ||
+ (*s>='0' && *s<='9') ||
+ *s=='_' )
+ {
+ s++;
+ }
+ if ( *s!=' ' && *s!='}' ) return 0;
+ *nxt = s;
+ return 1;
+}
+
+static int
+#ifdef __USE_PROTOS
+match_rexpr(char *s, char **nxt)
+#else
+match_rexpr(s,nxt)
+char *s;
+char **nxt;
+#endif
+{
+ if ( *s!='"' ) return 0;
+ s++;
+ while ( *s!='"' )
+ {
+ if ( *s=='\n' || *s=='\r' ) /* MR13 */
+ warn("eoln found in regular expression");
+ if ( *s=='\\' ) s++;
+ s++;
+ }
+ *nxt = s+1;
+ return 1;
+}
+
+/*
+* Walk a string "{ A .. Z }" where A..Z is a space separated list
+* of token references (either labels or reg exprs). Return a
+* string "inlineX_set" for some unique integer X. Basically,
+* we pretend as if we had seen "#tokclass inlineX { A .. Z }"
+* on the input stream outside of an action.
+*/
+char *
+#ifdef __USE_PROTOS
+inline_set(char *s)
+#else
+inline_set(s)
+char *s;
+#endif
+{
+ char *nxt;
+ fprintf(stderr, "found consumeUntil( {...} )\n");
+ while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;}
+ if ( *s!='{' )
+ {
+ err("malformed consumeUntil( {...} ); missing '{'");
+ return "bad_set";
+ }
+ s++;
+ while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;}
+ while ( *s!='}' )
+ {
+ if ( match_token(s,&nxt) ) fprintf(stderr, "found token %s\n", s);
+ else if ( match_rexpr(s,&nxt) ) fprintf(stderr, "found rexpr %s\n", s);
+ else {
+ err("invalid element in consumeUntil( {...} )");
+ return "bad_set";
+ }
+ s = nxt;
+ while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;}
+ }
+ return "inlineX_set";
+}
+
+/* ANTLR-specific syntax error message generator
+* (define USER_ZZSYN when compiling so don't get 2 definitions)
+*/
+void
+#ifdef __USE_PROTOS
+zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok,
+int k, char *bad_text)
+#else
+zzsyn(text, tok, egroup, eset, etok, k, bad_text)
+char *text, *egroup, *bad_text;
+int tok;
+int etok;
+int k;
+SetWordType *eset;
+#endif
+{
+fprintf(stderr, ErrHdr, FileStr[CurFile]!=NULL?FileStr[CurFile]:"stdin", zzline);
+fprintf(stderr, " syntax error at \"%s\"", (tok==zzEOF_TOKEN)?"EOF":text);
+if ( !etok && !eset ) {fprintf(stderr, "\n"); return;}
+if ( k==1 ) fprintf(stderr, " missing");
+else
+{
+fprintf(stderr, "; \"%s\" not", bad_text);
+if ( zzset_deg(eset)>1 ) fprintf(stderr, " in");
+}
+if ( zzset_deg(eset)>0 ) zzedecode(eset);
+else fprintf(stderr, " %s", zztokens[etok]);
+if ( strlen(egroup) > (size_t)0 ) fprintf(stderr, " in %s", egroup);
+fprintf(stderr, "\n");
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.g b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.g
new file mode 100644
index 000000000..c44b036c6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.g
@@ -0,0 +1,2587 @@
+/*
+ * antlr.g -- PCCTS Version 1.xx ANTLR
+ *
+ * Parse an antlr input grammar and build a syntax-diagram.
+ *
+ * Written in itself (needs at least 1.06 to work)
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-1995
+ */
+
+/* MR1 */
+/* MR1 10-Apr-97 MR1 Replace #if logic with #include "pcctscfg.h" */
+/* MR1 */
+
+#header <<
+ #include "pcctscfg.h"
+ #include "set.h"
+ #include <ctype.h>
+ #include "syn.h"
+ #include "hash.h"
+ #include "generic.h"
+ #define zzcr_attr(attr,tok,t)
+ >>
+
+<<
+
+/* MR20 G. Hobbelt For Borland C++ 4.x & 5.x compiling with ALL warnings enabled */
+#if defined(__TURBOC__)
+#pragma warn -aus /* unused assignment of 'xxx' */
+#endif
+
+#pragma clang diagnostic ignored "-Wparentheses-equality"
+
+#ifdef __USE_PROTOS
+static void chkToken(char *, char *, char *, int);
+#else
+static void chkToken();
+#endif
+
+#ifdef __USE_PROTOS
+static int isDLGmaxToken(char *Token); /* MR3 */
+#else
+static int isDLGmaxToken(); /* MR3 */
+#endif
+
+static int class_nest_level = 0;
+
+/* MR20 G. Hobbelt extern definitions moved to antlr.h */
+
+>>
+
+#lexaction <<
+/* maintained, but not used for now */
+set AST_nodes_refd_in_actions = set_init;
+int inAlt = 0;
+set attribsRefdFromAction = set_init; /* MR20 */
+int UsedOldStyleAttrib = 0;
+int UsedNewStyleLabel = 0;
+#ifdef __USE_PROTOS
+char *inline_set(char *);
+#else
+char *inline_set();
+#endif
+
+/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
+/* MR1 in DLG action */
+
+int tokenActionActive=0; /* MR1 */
+
+>>
+
+#lexclass STRINGS
+#token QuotedTerm "\"" << zzmode(START); >>
+#token "\n|\r|\r\n" <<
+ zzline++;
+ warn("eoln found in string");
+ zzskip();
+ >>
+#token "\\(\n|\r|\r\n)" << zzline++; zzmore(); >>
+#token "\\~[]" << zzmore(); >>
+#token "~[\n\r\"\\]+" << zzmore(); >>
+
+#lexclass ACTION_STRINGS
+#token "\"" << zzmode(ACTIONS); zzmore(); >>
+#token "\n|\r|\r\n" <<
+ zzline++;
+ warn("eoln found in string (in user action)");
+ zzskip();
+ >>
+#token "\\(\n|\r|\r\n)" << zzline++; zzmore(); >>
+#token "\\~[]" << zzmore(); >>
+#token "~[\n\r\"\\]+" << zzmore(); >>
+
+#lexclass ACTION_CHARS
+#token "'" << zzmode(ACTIONS); zzmore(); >>
+#token "\n|\r|\r\n" <<
+ zzline++;
+ warn("eoln found in char literal (in user action)");
+ zzskip();
+ >>
+#token "\\~[]" << zzmore(); >>
+#token "~[\n\r'\\]+" << zzmore(); >>
+
+#lexclass ACTION_COMMENTS
+#token "\*/" << zzmode(ACTIONS); zzmore(); >>
+#token "\*" << zzmore(); >>
+#token "\n|\r|\r\n" << zzline++; zzmore(); DAWDLE; >>
+#token "~[\n\r\*]+" << zzmore(); >>
+
+#lexclass TOK_DEF_COMMENTS
+#token "\*/" << zzmode(PARSE_ENUM_FILE);
+ zzmore(); >>
+#token "\*" << zzmore(); >>
+#token "\n|\r|\r\n" << zzline++; zzmore(); DAWDLE; >>
+#token "~[\n\r\*]+" << zzmore(); >>
+
+#lexclass TOK_DEF_CPP_COMMENTS
+#token "\n|\r|\r\n" << zzline++; zzmode(PARSE_ENUM_FILE); zzskip(); DAWDLE; >>
+#token "~[\n\r]+" << zzskip(); >>
+
+#lexclass ACTION_CPP_COMMENTS
+#token "\n|\r|\r\n" << zzline++; zzmode(ACTIONS); zzmore(); DAWDLE; >>
+#token "~[\n\r]+" << zzmore(); >>
+
+#lexclass CPP_COMMENTS
+#token "\n|\r|\r\n" << zzline++; zzmode(START); zzskip(); DAWDLE; >>
+#token "~[\n\r]+" << zzskip(); >>
+
+#lexclass COMMENTS
+#token "\*/" << zzmode(START); zzskip(); >>
+#token "\*" << zzskip(); >>
+#token "\n|\r|\r\n" << zzline++; zzskip(); DAWDLE; >>
+#token "~[\n\r\*]+" << zzskip(); >>
+
+/*
+ * This lexical class accepts actions of type [..] and <<..>>
+ *
+ * It translates the following special items for C:
+ *
+ * $j --> "zzaArg(current zztasp, j)"
+ * $i.j --> "zzaArg(zztaspi, j)"
+ * $i.nondigit> "zzaArg(current zztasp, i).nondigit"
+ * $$ --> "zzaRet"
+ * $alnum --> "alnum" (used to ref parameters)
+ * $rule --> "zzaRet"
+ * $retval --> "_retv.retval" if > 1 return values else "_retv"
+ * $[token, text] --> "zzconstr_attr(token, text)"
+ * $[] --> "zzempty_attr()"
+ *
+ * It translates the following special items for C++:
+ * (attributes are now stored with 'Token' and $i's are only
+ * pointers to the Tokens. Rules don't have attributes now.)
+ *
+ * $j --> "_tbj" where b is the block level
+ * $i.j --> "_tij"
+ * $j->nondigit> "_tbj->nondigit"
+ * $$ --> "$$"
+ * $alnum --> "alnum" (used to ref parameters)
+ * $rule --> "$rule"
+ * $retval --> "_retv.retval" if > 1 return values else "_retv"
+ * $[token, text] --> invalid
+ * $[] --> invalid
+ *
+ * And, for trees:
+ *
+ * #0 --> "(*_root)"
+ * #i --> "zzastArg(i)"
+ * #[args] --> "zzmk_ast(zzastnew(), args)"
+ * #[] --> "zzastnew()"
+ * #( root, child1, ..., childn )
+ * --> "zztmake(root, child1, ...., childn, NULL)"
+ * #() --> "NULL"
+ *
+ * For C++, ...
+ *
+ * #0 --> "(*_root)"
+ * #i --> "_astbi" where b is the block level
+ * #alnum --> "alnum_ast" (used to ref #label)
+ * #[args] --> "new AST(args)"
+ * #[] --> "new AST"
+ * #( root, child1, ..., childn )
+ * --> "AST::tmake(root, child1, ...., childn, NULL)"
+ * #() --> "NULL"
+ *
+ * To escape,
+ *
+ * \] --> ]
+ * \) --> )
+ * \$ --> $
+ * \# --> #
+ *
+ * A stack is used to nest action terminators because they can be nested
+ * like crazy: << #[$[..],..] >>
+ */
+#lexclass ACTIONS
+#token Action "\>\>" << /* these do not nest */
+ zzmode(START);
+ NLATEXT[0] = ' ';
+ NLATEXT[1] = ' ';
+ zzbegexpr[0] = ' ';
+ zzbegexpr[1] = ' ';
+ if ( zzbufovf ) {
+ err( eMsgd("action buffer overflow; size %d",ZZLEXBUFSIZE));
+ }
+
+/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
+/* MR1 in DLG action */
+/* MR1 Doesn't matter what kind of action it is - reset*/
+
+ tokenActionActive=0; /* MR1 */
+ >>
+#token Pred "\>\>?" << /* these do not nest */
+ zzmode(START);
+ NLATEXT[0] = ' ';
+ NLATEXT[1] = ' ';
+ zzbegexpr[0] = '\0';
+ if ( zzbufovf ) {
+ err( eMsgd("predicate buffer overflow; size %d",ZZLEXBUFSIZE));
+ };
+#ifdef __cplusplus__
+/* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
+#else
+#ifdef __STDC__
+/* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
+#else
+#ifdef __USE_PROTOS
+/* MRxx */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
+#else
+/* MR10 */ list_apply(CurActionLabels,mark_label_used_in_sem_pred);
+#endif
+#endif
+#endif
+ >>
+#token PassAction "\]" << if ( topint() == ']' ) {
+ popint();
+ if ( istackempty() ) /* terminate action */
+ {
+ zzmode(START);
+ NLATEXT[0] = ' ';
+ zzbegexpr[0] = ' ';
+ if ( zzbufovf ) {
+ err( eMsgd("parameter buffer overflow; size %d",ZZLEXBUFSIZE));
+ }
+ }
+ else {
+ /* terminate $[..] and #[..] */
+ if ( GenCC ) zzreplstr("))");
+ else zzreplstr(")");
+ zzmore();
+ }
+ }
+ else if ( topint() == '|' ) { /* end of simple [...] */
+ popint();
+ zzmore();
+ }
+ else zzmore();
+ >>
+#token "consumeUntil\( [\ \t]* \{~[\}]+\} [\ \t]* \)"
+ <<
+ zzmore();
+ zzreplstr(inline_set(zzbegexpr+
+ strlen("consumeUntil(")));
+ >>
+#token "consumeUntil\( ~[\)]+ \)"
+ << zzmore(); >>
+#token "\n|\r|\r\n" << zzline++; zzmore(); DAWDLE; >>
+#token "\>" << zzmore(); >>
+#token "$" << zzmore(); >>
+#token "$$" << if ( !GenCC ) {zzreplstr("zzaRet"); zzmore();}
+ else err("$$ use invalid in C++ mode"); >>
+
+#token "$\[\]" << if ( !GenCC ) {zzreplstr("zzempty_attr"); zzmore();}
+ else err("$[] use invalid in C++ mode"); >>
+#token "$\[" <<
+ pushint(']');
+ if ( !GenCC ) zzreplstr("zzconstr_attr(");
+ else err("$[..] use invalid in C++ mode");
+ zzmore();
+ >>
+#token "$[0-9]+" <<{
+ static char buf[100];
+ numericActionLabel=1; /* MR10 */
+ if ( strlen(zzbegexpr)>(size_t)85 )
+ fatal("$i attrib ref too big");
+ set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction);
+ if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s)",
+ BlkLevel-1,zzbegexpr+1);
+ else sprintf(buf,"_t%d%s",
+ BlkLevel-1,zzbegexpr+1);
+ zzreplstr(buf);
+ zzmore();
+ UsedOldStyleAttrib = 1;
+ if ( UsedNewStyleLabel )
+ err("cannot mix old-style $i with new-style labels");
+ }
+ >>
+#token "$[0-9]+." <<{
+ static char buf[100];
+ numericActionLabel=1; /* MR10 */
+ if ( strlen(zzbegexpr)>(size_t)85 )
+ fatal("$i.field attrib ref too big");
+ zzbegexpr[strlen(zzbegexpr)-1] = ' ';
+ set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction);
+ if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s).",
+ BlkLevel-1,zzbegexpr+1);
+ else sprintf(buf,"_t%d%s.",
+ BlkLevel-1,zzbegexpr+1);
+ zzreplstr(buf);
+ zzmore();
+ UsedOldStyleAttrib = 1;
+ if ( UsedNewStyleLabel )
+ err("cannot mix old-style $i with new-style labels");
+ }
+ >>
+#token "$[0-9]+.[0-9]+" <<{
+ static char buf[100];
+ static char i[20], j[20];
+ char *p,*q;
+ numericActionLabel=1; /* MR10 */
+ if (strlen(zzbegexpr)>(size_t)85) fatal("$i.j attrib ref too big");
+ for (p=zzbegexpr+1,q= &i[0]; *p!='.'; p++) {
+ if ( q == &i[20] )
+ fatalFL("i of $i.j attrib ref too big",
+ FileStr[CurFile], zzline );
+ *q++ = *p;
+ }
+ *q = '\0';
+ for (p++, q= &j[0]; *p!='\0'; p++) {
+ if ( q == &j[20] )
+ fatalFL("j of $i.j attrib ref too big",
+ FileStr[CurFile], zzline );
+ *q++ = *p;
+ }
+ *q = '\0';
+ if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%s,%s)",i,j);
+ else sprintf(buf,"_t%s%s",i,j);
+ zzreplstr(buf);
+ zzmore();
+ UsedOldStyleAttrib = 1;
+ if ( UsedNewStyleLabel )
+ err("cannot mix old-style $i with new-style labels");
+ }
+ >>
+#token "$[_a-zA-Z][_a-zA-Z0-9]*"
+ <<{ static char buf[300]; LabelEntry *el;
+ zzbegexpr[0] = ' ';
+ if ( CurRule != NULL &&
+ strcmp(CurRule, &zzbegexpr[1])==0 ) {
+ if ( !GenCC ) zzreplstr("zzaRet");
+ }
+ else if ( CurRetDef != NULL &&
+ strmember(CurRetDef, &zzbegexpr[1])) {
+ if ( hasMultipleOperands( CurRetDef ) ) {
+ require (strlen(zzbegexpr)<=(size_t)285,
+ "$retval attrib ref too big");
+ sprintf(buf,"_retv.%s",&zzbegexpr[1]);
+ zzreplstr(buf);
+ }
+ else zzreplstr("_retv");
+ }
+ else if ( CurParmDef != NULL &&
+ strmember(CurParmDef, &zzbegexpr[1])) {
+ ;
+ }
+ else if ( Elabel==NULL ) {
+ { err("$-variables in actions outside of rules are not allowed"); }
+ } else if ( (el=(LabelEntry *)hash_get(Elabel, &zzbegexpr[1]))!=NULL ) {
+/* MR10 */
+/* MR10 */ /* element labels might exist without an elem when */
+/* MR10 */ /* it is a forward reference (to a rule) */
+/* MR10 */
+/* MR10 */ if ( GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) )
+/* MR10 */ { err(eMsg1("There are no token ptrs for rule references: '$%s'",&zzbegexpr[1])); }
+/* MR10 */
+/* MR10 */ if ( !GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) && GenAST) {
+/* MR10 */ err("You can no longer use attributes returned by rules when also using ASTs");
+/* MR10 */ err(" Use upward inheritance (\"rule >[Attrib a] : ... <<$a=...\>\>\")");
+/* MR10 */ };
+/* MR10 */
+/* MR10 */ /* keep track of <<... $label ...>> for semantic predicates in guess mode */
+/* MR10 */ /* element labels contain pointer to the owners node */
+/* MR10 */
+/* MR10 */ if (el->elem != NULL && el->elem->ntype == nToken) {
+/* MR10 */ list_add(&CurActionLabels,el);
+/* MR10 */ };
+ }
+ else
+ warn(eMsg1("$%s not parameter, return value, (defined) element label",&zzbegexpr[1]));
+ }
+ zzmore();
+ >>
+#token "#0" << zzreplstr("(*_root)"); zzmore(); chkGTFlag(); >>
+#token "#\[\]" << if ( GenCC ) {
+ if (NewAST) zzreplstr("(newAST)");
+ else zzreplstr("(new AST)");}
+ else {zzreplstr("zzastnew()");} zzmore();
+ chkGTFlag();
+ >>
+#token "#\(\)" << zzreplstr("NULL"); zzmore(); chkGTFlag(); >>
+#token "#[0-9]+" <<{
+ static char buf[100];
+ if ( strlen(zzbegexpr)>(size_t)85 )
+ fatal("#i AST ref too big");
+ if ( GenCC ) sprintf(buf,"_ast%d%s",BlkLevel-1,zzbegexpr+1);
+ else sprintf(buf,"zzastArg(%s)",zzbegexpr+1);
+ zzreplstr(buf);
+ zzmore();
+ set_orel(atoi(zzbegexpr+1), &AST_nodes_refd_in_actions);
+ chkGTFlag();
+ }
+ >>
+
+/* MR14 Arpad Beszedes 26-May-98
+ Add support for #line directives when antlr source is pre-processed
+ #lexclass ACTIONS
+*/
+
+#token "#line[\ \t]* [0-9]+ {[\ \t]* \"~[\"]+\" ([\ \t]* [0-9]*)* } (\n|\r|\r\n)"
+ <<
+ zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
+ getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
+ >>
+
+#token "#line ~[\n\r]* (\n|\r|\r\n)"
+ <<
+ zzline++; zzmore();
+ >>
+
+/* MR14 end of a block to support #line in antlr source code */
+
+#token "#[_a-zA-Z][_a-zA-Z0-9]*"
+ <<
+ if ( !(strcmp(zzbegexpr, "#ifdef")==0 ||
+ strcmp(zzbegexpr, "#if")==0 ||
+ strcmp(zzbegexpr, "#else")==0 ||
+ strcmp(zzbegexpr, "#endif")==0 ||
+ strcmp(zzbegexpr, "#ifndef")==0 ||
+ strcmp(zzbegexpr, "#define")==0 ||
+ strcmp(zzbegexpr, "#pragma")==0 ||
+ strcmp(zzbegexpr, "#undef")==0 ||
+ strcmp(zzbegexpr, "#import")==0 ||
+ strcmp(zzbegexpr, "#line")==0 ||
+ strcmp(zzbegexpr, "#include")==0 ||
+ strcmp(zzbegexpr, "#error")==0) )
+ {
+ static char buf[100];
+ sprintf(buf, "%s_ast", zzbegexpr+1);
+/* MR27 */ list_add(&CurAstLabelsInActions, mystrdup(zzbegexpr+1));
+ zzreplstr(buf);
+ chkGTFlag();
+ }
+ zzmore();
+ >>
+#token "#\[" <<
+ pushint(']');
+ if ( GenCC ) {
+ if (NewAST) zzreplstr("(newAST(");
+ else zzreplstr("(new AST("); }
+ else zzreplstr("zzmk_ast(zzastnew(),");
+ zzmore();
+ chkGTFlag();
+ >>
+#token "#\(" <<
+ pushint('}');
+ if ( GenCC ) {
+ if (tmakeInParser) {
+ zzreplstr("tmake(");
+ }
+ else {
+ zzreplstr("ASTBase::tmake(");
+ }
+ }
+ else {
+ zzreplstr("zztmake(");
+ }
+ zzmore();
+ chkGTFlag();
+ >>
+#token "#" << zzmore(); >>
+#token "\)" <<
+ if ( istackempty() )
+ zzmore();
+ else if ( topint()==')' ) {
+ popint();
+ }
+ else if ( topint()=='}' ) {
+ popint();
+ /* terminate #(..) */
+ zzreplstr(", NULL)");
+ }
+ zzmore();
+ >>
+#token "\[" <<
+ pushint('|'); /* look for '|' to terminate simple [...] */
+ zzmore();
+ >>
+#token "\(" <<
+ pushint(')');
+ zzmore();
+ >>
+
+#token "\\\]" << zzreplstr("]"); zzmore(); >>
+#token "\\\)" << zzreplstr(")"); zzmore(); >>
+
+/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
+/* MR1 in DLG action */
+
+#token "\\>" << if (! tokenActionActive) zzreplstr(">"); /* MR1 */
+ zzmore(); /* MR1 */
+ >> /* MR1 */
+
+
+#token "'" << zzmode(ACTION_CHARS); zzmore();>>
+#token "\"" << zzmode(ACTION_STRINGS); zzmore();>>
+#token "\\$" << zzreplstr("$"); zzmore(); >>
+#token "\\#" << zzreplstr("#"); zzmore(); >>
+#token "\\(\n|\r|\r\n)" << zzline++; zzmore(); >>
+#token "\\~[\]\)>$#]" << zzmore(); >> /* escaped char, always ignore */
+#token "/" << zzmore(); >>
+#token "/\*" << zzmode(ACTION_COMMENTS); zzmore(); >>
+#token "\*/" << warn("Missing /*; found dangling */ in action"); zzmore(); >>
+#token "//" << zzmode(ACTION_CPP_COMMENTS); zzmore(); >>
+#token "~[\n\r\)\(\\$#\>\]\[\"'/]+" << zzmore(); >>
+
+#lexclass START
+#token "[\t\ ]+" << zzskip(); >> /* Ignore White */
+#token "\n|\r|\r\n" << zzline++; zzskip(); >> /* Track Line # */
+#token "\[" << zzmode(ACTIONS); zzmore();
+ istackreset();
+ pushint(']'); >>
+#token "\<\<" << action_file=CurFile; action_line=zzline;
+ zzmode(ACTIONS); zzmore();
+ list_free(&CurActionLabels,0); /* MR10 */
+ numericActionLabel=0; /* MR10 */
+ istackreset();
+ pushint('>'); >>
+#token "\"" << zzmode(STRINGS); zzmore(); >>
+#token "/\*" << zzmode(COMMENTS); zzskip(); >>
+#token "\*/" << warn("Missing /*; found dangling */"); zzskip(); >>
+#token "//" << zzmode(CPP_COMMENTS); zzskip(); >>
+
+/* MR14 Arpad Beszedes 26-May-98
+ Add support for #line directives when antlr source is pre-processed
+ #lexclass START
+*/
+
+#token "#line[\ \t]* [0-9]+ {[\ \t]* \"~[\"]+\" ([\ \t]* [0-9]*)* } (\n|\r|\r\n)"
+ <<
+ zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
+ getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
+ >>
+
+#token "#line ~[\n\r]* (\n|\r|\r\n)"
+ <<
+ zzline++; zzmore();
+ >>
+
+/* MR14 end of a block to support #line in antlr source code */
+
+/* */
+/* 8-Apr-97 Regularize escape sequence for ">>" */
+/* appearing in string literals */
+/* */
+
+#token "\>\>" << warn("Missing <<; found dangling \>\>"); zzskip(); >> /* MR1 */
+#token WildCard "."
+#token "\@" <<FoundException = 1; /* MR6 */
+ FoundAtOperator = 1;>> /* MR6 */
+#token Eof "@"
+ << /* L o o k F o r A n o t h e r F i l e */
+ {
+ FILE *new_input;
+ new_input = NextFile();
+ if ( new_input == NULL ) { NLA=Eof; return; }
+ fclose( input );
+ input = new_input;
+ zzrdstream( input );
+ zzskip(); /* Skip the Eof (@) char i.e continue */
+ }
+ >>
+
+#token LABEL
+
+#errclass "grammar-element" { element }
+#errclass "meta-symbol" { "\}" "!" ";" "\|" "\~" "^" "\)" }
+
+#token Pragma "{\\}#pragma" /* MR21 */
+#token FirstSetSymbol "{\\}#FirstSetSymbol" /* MR21 */
+/*
+ * Get a grammar -- Build a list of rules like:
+ *
+ * o-->Rule1--o
+ * |
+ * o-->Rule2--o
+ * |
+ * ...
+ * |
+ * o-->RuleN--o
+ */
+
+/* rule grammar */
+
+grammar : <<Graph g;>>
+ ( "{\\}#header" Action /* MR13 */
+ <<
+ if ( HdrAction==NULL ) {
+ HdrAction = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(HdrAction!=NULL, "rule grammar: cannot allocate header action");
+ strcpy(HdrAction, LATEXT(1));
+ }
+ else warn("additional #header statement ignored");
+ >>
+ | "{\\}#first" Action
+ <<
+ if ( FirstAction==NULL ) {
+ FirstAction = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(FirstAction!=NULL, "rule grammar: cannot allocate #first action");
+ strcpy(FirstAction, LATEXT(1));
+ } else {
+ warn("additional #first statement ignored");
+ };
+ >>
+
+ | "{\\}#parser" QuotedTerm
+ <<
+ if ( GenCC ) {
+ warn("#parser meta-op incompatible with -CC; ignored");
+ }
+ else {
+ if ( strcmp(ParserName,"zzparser")==0 ) {
+ ParserName=StripQuotes(mystrdup(LATEXT(1)));
+ if ( RulePrefix[0]!='\0' )
+ {
+ warn("#parser meta-op incompatible with '-gp prefix'; '-gp' ignored");
+ RulePrefix[0]='\0';
+ }
+ }
+ else warn("additional #parser statement ignored");
+ }
+ >>
+ | "{\\}#tokdefs" QuotedTerm
+ <<{
+ char *fname;
+ zzantlr_state st; FILE *f; struct zzdlg_state dst;
+ UserTokenDefsFile = mystrdup(LATEXT(1));
+ zzsave_antlr_state(&st);
+ zzsave_dlg_state(&dst);
+ fname = mystrdup(LATEXT(1));
+ f = fopen(StripQuotes(fname), "r");
+ if ( f==NULL ) {warn(eMsg1("cannot open token defs file '%s'", fname+1));}
+ else {
+ ANTLRm(enum_file(fname+1), f, PARSE_ENUM_FILE);
+ UserDefdTokens = 1;
+ }
+ zzrestore_antlr_state(&st);
+ zzrestore_dlg_state(&dst);
+ }>>
+ )*
+ ( Action
+ <<{
+ UserAction *ua = newUserAction(LATEXT(1));
+ ua->file = action_file; ua->line = action_line;
+ if ( class_nest_level>0 ) list_add(&class_before_actions, ua);
+ else list_add(&BeforeActions, ua);
+ }>>
+ | laction
+ | lmember /* MR1 */
+ | lprefix /* MR1 */
+ | aLexclass
+ | token
+ | error
+ | tclass
+ | aPred /* MR11 */
+ | default_exception_handler
+ | class_def
+ | "\}"
+ <<
+ if ( class_nest_level==0 )
+ warn("missing class definition for trailing '}'");
+ class_nest_level--;
+ >>
+ )*
+
+ rule <<g=$3; SynDiag = (Junction *) $3.left;>>
+ ( rule
+
+ <<if ( $1.left!=NULL ) {
+ g.right = NULL;
+
+/* MR21a */ /* Avoid use of a malformed graph when CannotContinue */
+/* MR21a */ /* is already set */
+/* MR21a */
+/* MR21a */ if (! (CannotContinue && g.left == NULL)) {
+/* MR21a */ g = Or(g, $1);
+/* MR21a */ }
+/* MR21a */ }
+ >>
+
+ | aLexclass
+ | token
+ | error
+ | tclass
+ | aPred /* MR11 */
+ | class_def
+ | "\}"
+ <<
+ if ( class_nest_level==0 )
+ warn("missing class definition for trailing '}'");
+ class_nest_level--;
+ >>
+ )*
+ ( Action
+ <<{
+ UserAction *ua = newUserAction(LATEXT(1));
+ ua->file = action_file; ua->line = action_line;
+ if ( class_nest_level>0 ) list_add(&class_after_actions, ua);
+ else list_add(&AfterActions, ua);
+ }>>
+ | laction
+ | lmember /* MR1 */
+ | lprefix /* MR1 */
+ | error
+ | tclass
+ | class_def
+ | aPred /* MR11 */
+ | "\}"
+ <<
+ if ( class_nest_level==0 )
+ warn("missing class definition for trailing '}'");
+ class_nest_level--;
+ >>
+ )*
+ Eof
+ ;
+ <<CannotContinue=TRUE;>>
+
+/* rule class_def */
+
+class_def
+ : <<int go=1; char name[MaxRuleName+1];>>
+ "class"
+ ( NonTerminal <<if(go) strncpy(name,LATEXT(1),MaxRuleName);>>
+ | TokenTerm <<if(go) strncpy(name,LATEXT(1),MaxRuleName);>>
+ )
+ <<
+ if ( CurrentClassName[0]!='\0' && strcmp(CurrentClassName,name)!=0
+ && GenCC ) {
+ err("only one grammar class allowed in this release");
+ go = 0;
+ }
+ else strcpy(CurrentClassName, name);
+ >>
+ <<if ( !GenCC ) { err("class meta-op used without C++ option"); }>>
+
+/* MR10 */ (~ "\{"
+/* MR10 */ <<if (ClassDeclStuff == NULL) {
+/* MR10 */ ClassDeclStuff=(char *)calloc(MaxClassDeclStuff+1,sizeof(char));
+/* MR10 */ };
+/* MR10 */ strncat(ClassDeclStuff," ",MaxClassDeclStuff);
+/* MR10 */ strncat(ClassDeclStuff,LATEXT(1),MaxClassDeclStuff);
+/* MR22 */ do {
+/* MR22 */ if (0 == strcmp(LATEXT(1),"public")) break;
+/* MR22 */ if (0 == strcmp(LATEXT(1),"private")) break;
+/* MR22 */ if (0 == strcmp(LATEXT(1),"protected")) break;
+/* MR22 */ if (0 == strcmp(LATEXT(1),"virtual")) break;
+/* MR22 */ if (0 == strcmp(LATEXT(1),",")) break;
+/* MR22 */ if (0 == strcmp(LATEXT(1),":")) break;
+/* MR22 */ if (BaseClassName != NULL) break;
+/* MR22 */ BaseClassName=(char *)calloc(strlen(LATEXT(1))+1,sizeof(char));
+/* MR22 */ require(BaseClassName!=NULL, "rule grammar: cannot allocate base class name");
+/* MR22 */ strcpy(BaseClassName,LATEXT(1));
+/* MR22 */ } while (0);
+/* MR10 */ >>
+/* MR10 */ )*
+
+ "\{"
+ <<
+ no_classes_found = 0;
+ if ( class_nest_level>=1 ) {warn("cannot have nested classes");}
+ else class_nest_level++;
+ >>
+ ;
+ <<CannotContinue=TRUE;>>
+
+/*
+ * Build -o-->o-R-o-->o- where -o-R-o- is the block from rule 'block'.
+ * Construct the RuleBlk front and EndRule node on the end of the
+ * block. This is used to add FOLLOW pointers to the rule end. Add the
+ * new rule name to the Rname hash table and sets its rulenum.
+ * Store the parameter definitions if any are found.
+ *
+ * Note that locks are required on the RuleBlk and EndRule nodes to thwart
+ * infinite recursion.
+ *
+ * Return the left graph pointer == NULL to indicate error/dupl rule def.
+ */
+
+/* rule rule */
+
+rule : <<
+
+ ExceptionGroup *eg;
+ RuleEntry *q; Junction *p; Graph r; int f, l; ECnode *e;
+ set toksrefd, rulesrefd;
+ char *pdecl=NULL, *ret=NULL, *a; CurRetDef = CurParmDef = NULL;
+ CurExGroups = NULL;
+ CurElementLabels = NULL;
+ CurAstLabelsInActions = NULL; /* MR27 */
+ /* We want a new element label hash table for each rule */
+ if ( Elabel!=NULL ) killHashTable(Elabel);
+ Elabel = newHashTable();
+ attribsRefdFromAction = empty;
+ >>
+ NonTerminal
+ <<q=NULL;
+ if ( hash_get(Rname, LATEXT(1))!=NULL ) {
+ err(eMsg1("duplicate rule definition: '%s'",LATEXT(1)));
+ CannotContinue=TRUE;
+ }
+ else
+ {
+ q = (RuleEntry *)hash_add(Rname,
+ LATEXT(1),
+ (Entry *)newRuleEntry(LATEXT(1)));
+ CurRule = q->str;
+ }
+ CurRuleNode = q;
+ f = CurFile; l = zzline;
+ NumRules++;
+ >>
+ { "!" <<if ( q!=NULL ) q->noAST = TRUE;>> }
+ { <<;>>
+ {"\<"}
+ PassAction
+ << pdecl = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(pdecl!=NULL, "rule rule: cannot allocate param decl");
+ strcpy(pdecl, LATEXT(1));
+ CurParmDef = pdecl;
+ >>
+ }
+ { "\>"
+ PassAction
+ << ret = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(ret!=NULL, "rule rule: cannot allocate ret type");
+ strcpy(ret, LATEXT(1));
+ CurRetDef = ret;
+ >>
+ }
+ { QuotedTerm <<if ( q!=NULL ) q->egroup=mystrdup(LATEXT(1));>> }
+ <<
+ if ( GenEClasseForRules && q!=NULL ) {
+ e = newECnode;
+ require(e!=NULL, "cannot allocate error class node");
+ if ( q->egroup == NULL ) {a = q->str; a[0] = (char)toupper(a[0]);}
+ else a = q->egroup;
+ if ( Tnum( a ) == 0 )
+ {
+ e->tok = addTname( a );
+ list_add(&eclasses, (char *)e);
+ if ( q->egroup == NULL ) a[0] = (char)tolower(a[0]);
+ /* refers to itself */
+ list_add(&(e->elist), mystrdup(q->str));
+ }
+ else {
+ warn(eMsg1("default errclass for '%s' would conflict with token/errclass/tokclass",a));
+ if ( q->egroup == NULL ) a[0] = (char)tolower(a[0]);
+ free((char *)e);
+ }
+ }
+ >>
+ <<BlkLevel++;
+ if (BlkLevel >= MAX_BLK_LEVEL) fatal("Blocks nested too deeply");
+/* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID;
+/* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
+ >>
+
+ ":" <<inAlt=1;>>
+ block[&toksrefd, &rulesrefd]
+ <<r = makeBlk($7,0, NULL /* pFirstSetSymbol */ );
+ CurRuleBlk = (Junction *)r.left;
+ CurRuleBlk->blockid = CurBlockID;
+ CurRuleBlk->jtype = RuleBlk;
+ if ( q!=NULL ) CurRuleBlk->rname = q->str;
+ CurRuleBlk->file = f;
+ CurRuleBlk->line = l;
+ CurRuleBlk->pdecl = pdecl;
+ CurRuleBlk->ret = ret;
+ CurRuleBlk->lock = makelocks();
+ CurRuleBlk->pred_lock = makelocks();
+ CurRuleBlk->tokrefs = toksrefd;
+ CurRuleBlk->rulerefs = rulesrefd;
+ p = newJunction(); /* add EndRule Node */
+ ((Junction *)r.right)->p1 = (Node *)p;
+ r.right = (Node *) p;
+ p->jtype = EndRule;
+ p->lock = makelocks();
+ p->pred_lock = makelocks();
+ CurRuleBlk->end = p;
+ if ( q!=NULL ) q->rulenum = NumRules;
+ $7 = r;
+ >>
+ <<
+ /* MR23 */ CurBlockID_array[BlkLevel] = (-1);
+ /* MR23 */ CurAltNum_array[BlkLevel] = (-1);
+ --BlkLevel;
+ >>
+ <<altFixup();leFixup();egFixup();>> /* MR7 */
+ ";" <<inAlt=0;>>
+ { Action
+ << a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(a!=NULL, "rule rule: cannot allocate error action");
+ strcpy(a, LATEXT(1));
+ CurRuleBlk->erraction = a;
+ >>
+ }
+ ( exception_group > [eg]
+ <<if ( eg!=NULL ) {
+ list_add(&CurExGroups, (void *)eg);
+ if (eg->label == NULL || *eg->label=='\0' ) q->has_rule_exception = 1;
+ }
+ >>
+ )*
+ <<if ( q==NULL ) $0.left = NULL; else $0 = $7;>>
+ <<CurRuleBlk->exceptions = CurExGroups;>>
+ <<CurRuleBlk->el_labels = CurElementLabels;>>
+ <<CurRuleNode->ast_labels_in_actions = CurAstLabelsInActions;>> /* MR27 */
+ <<CurRuleNode = NULL;>> /* MR27 Moved */
+ ;
+ <<CannotContinue=TRUE;>>
+
+/*
+ * pragma : "{\\}#pragma" "dup\-labeled\-tokens"
+ * <<Pragma_DupLabeledTokens=1;>>
+ * ;
+ */
+
+/* rule laction */
+
+laction : <<char *a;>>
+
+ "{\\}#lexaction"
+ Action
+ <<
+ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(a!=NULL, "rule laction: cannot allocate action");
+ strcpy(a, LATEXT(1));
+ list_add(&LexActions, a);
+ >>
+ ;
+ <<CannotContinue=TRUE;>>
+
+/* MR1 */
+/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
+/* MR1 via #lexmember <<....>> & #lexprefix <<...>> */
+/* MR1 */
+
+/* rule lmember */
+
+lmember: <<char *a;>> /* MR1 */
+
+/* MR1 */ "{\\}#lexmember"
+/* MR1 */ Action
+/* MR1 */ <<
+/* MR1 */ if (! GenCC) {
+/* MR1 */ err("Use #lexmember only in C++ mode (to insert code in DLG class header");
+/* MR1 */ } else {
+/* MR1 */ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+/* MR1 */ require(a!=NULL, "rule lmember: cannot allocate action");
+/* MR1 */ strcpy(a, LATEXT(1));
+/* MR1 */ list_add(&LexMemberActions, a);
+/* MR1 */ };
+/* MR1 */ >>
+/* MR1 */ ;
+/* MR1 */ <<CannotContinue=TRUE;>>
+
+/* rule lprefix */
+
+lprefix: <<char *a;>> /* MR1 */
+
+/* MR1 */ "{\\}#lexprefix"
+/* MR1 */ Action
+/* MR1 */ <<
+/* MR1 */ if (! GenCC) {
+/* MR1 */ err("Use #lexprefix only in C++ mode (to insert code in DLG class header");
+/* MR1 */ } else {
+/* MR1 */ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+/* MR1 */ require(a!=NULL, "rule lprefix: cannot allocate action");
+/* MR1 */ strcpy(a, LATEXT(1));
+/* MR1 */ list_add(&LexPrefixActions, a);
+/* MR1 */ };
+/* MR1 */ >>
+/* MR1 */ ;
+/* MR1 */ <<CannotContinue=TRUE;>>
+
+/*
+ * #pred upper <<isupper()>>? predicate literal
+ * #pred lower <<islower()>>? predicate literal
+ * #pred up_or_low upper || lower predicate expression
+ * concealed interdependence
+ * #pred up_or_low_2 <<isletter()>>? A || B predicate literal equals predicate expr
+ * analyze using lower||upper
+ * generate using isLetter()
+ */
+
+/* rule aPref */
+
+aPred: <<PredEntry *predEntry=NULL;
+ char *name=NULL;
+ Predicate *predExpr=NULL;
+ char *predLiteral=NULL;
+ int save_file;
+ int save_line;
+ int predExprPresent=0;
+ >>
+
+ "{\\}#pred"
+
+ <<
+ MR_usingPredNames=1; /* will need to use -mrhoist version of genPredTree */
+ >>
+
+ /* used to allow NonTerminal but it caused problems
+ when a rule name immediately followed a #pred statement */
+
+ TokenTerm <<name=mystrdup(LATEXT(1));>>
+
+ <<
+ /* don't free - referenced in predicates */
+
+ CurPredName=(char *)calloc(1,strlen(name) + 10);
+ strcat(CurPredName,"#pred ");
+ strcat(CurPredName,name);
+
+ predEntry=(PredEntry *) hash_get(Pname,name);
+ if (predEntry != NULL) {
+ warnFL(eMsg1("#pred %s previously defined - ignored",name),
+ FileStr[action_file],action_line);
+ name=NULL;
+ };
+ >>
+
+ (
+
+ Pred <<predLiteral=mystrdup(LATEXT(1));
+ save_line=action_line;
+ save_file=action_file;
+ >>
+
+ {
+ predOrExpr>[predExpr] <<predExprPresent=1;>>
+ }
+
+ <<if (predLiteral != NULL && name != NULL) {
+
+ /*
+ * predExpr may be NULL due to syntax errors
+ * or simply omitted by the user
+ */
+
+ predEntry=newPredEntry(name);
+ predEntry->file=save_file;
+ predEntry->line=save_line;
+ predExpr=MR_predFlatten(predExpr);
+ predEntry->predLiteral=predLiteral;
+ if (! predExprPresent || predExpr == NULL) {
+ predExpr=new_pred();
+ predExpr->expr=predLiteral;
+ predExpr->source=newActionNode();
+ predExpr->source->action=predExpr->expr;
+ predExpr->source->rname=CurPredName;
+ predExpr->source->line=action_line;
+ predExpr->source->file=action_file;
+ predExpr->source->is_predicate=1;
+ predExpr->k=predicateLookaheadDepth(predExpr->source);
+ };
+ predEntry->pred=predExpr;
+ hash_add(Pname,name,(Entry *)predEntry);
+ predExpr=NULL;
+ };
+ predicate_free(predExpr);
+ >>
+
+ |
+ <<save_line=zzline; save_file=CurFile;>>
+
+ predOrExpr>[predExpr]
+
+ <<if (predExpr != NULL && name != NULL) {
+ predEntry=newPredEntry(name);
+ predEntry->file=CurFile;
+ predEntry->line=zzline;
+ predExpr=MR_predFlatten(predExpr);
+ predEntry->pred=predExpr;
+ hash_add(Pname,name,(Entry *)predEntry);
+ predExpr=NULL;
+ };
+ predicate_free(predExpr);
+ >>
+ )
+ {";"}
+;
+
+/* fail */
+
+<<predicate_free(predExpr);
+>>
+
+/* rule predOrExpr */
+
+predOrExpr>[Predicate *result] :
+ <<Predicate *ORnode;
+ Predicate *predExpr;
+ Predicate **tail=NULL;
+ >>
+ predAndExpr>[predExpr]
+ <<
+ ORnode=new_pred();
+ ORnode->expr=PRED_OR_LIST;
+ if (predExpr != NULL) {
+ ORnode->down=predExpr;
+ tail=&predExpr->right;
+ };
+ >>
+ ( "\|\|" predAndExpr>[predExpr]
+ <<
+ if (predExpr != NULL) {
+ *tail=predExpr;
+ tail=&predExpr->right;
+ };
+ >>
+ )*
+ <<
+ $result=ORnode;
+ ORnode=NULL;
+ >>
+;
+
+/* fail */
+
+<<predicate_free(ORnode);>>
+
+/* rule predAndExpr */
+
+predAndExpr>[Predicate *result] :
+ <<Predicate *ANDnode;
+ Predicate *predExpr;
+ Predicate **tail=NULL;
+ >>
+ predPrimary>[predExpr]
+ <<
+ ANDnode=new_pred();
+ ANDnode->expr=PRED_AND_LIST;
+ if (predExpr != NULL) {
+ ANDnode->down=predExpr;
+ tail=&predExpr->right;
+ };
+ >>
+ ( "&&" predPrimary>[predExpr]
+ <<
+ if (predExpr != NULL) {
+ *tail=predExpr;
+ tail=&predExpr->right;
+ };
+ >>
+ )*
+ <<
+ $result=ANDnode;
+ ANDnode=NULL;
+ >>
+;
+
+/* fail */
+
+<<predicate_free(ANDnode);>>
+
+
+/* rule predPrimary */
+
+predPrimary>[Predicate *result] :
+ <<
+ char *name=NULL;
+ PredEntry *predEntry=NULL;
+ Predicate *predExpr=NULL;
+ >>
+
+ TokenTerm <<name=mystrdup(LATEXT(1));>>
+
+ <<
+ predEntry=(PredEntry *) hash_get(Pname,name);
+ if (predEntry == NULL) {
+ warnFL(eMsg1("no previously defined #pred with name \"%s\"",name),
+ FileStr[CurFile],zzline);
+ name=NULL;
+ $result=NULL;
+ } else {
+ predExpr=predicate_dup(predEntry->pred);
+ predExpr->predEntry=predEntry;
+ $result=predExpr;
+ };
+ >>
+
+ | "\(" predOrExpr>[predExpr] "\)"
+ <<
+ $result=predExpr;
+ >>
+
+ | "!" predPrimary>[predExpr]
+ <<
+ predExpr->inverted=!predExpr->inverted;
+ $result=predExpr;
+ >>
+;
+
+/* fail */ <<
+ predicate_free(predExpr);
+ >>
+
+/* rule aLexclass */
+
+aLexclass: "{\\}#lexclass" TokenTerm <<lexclass(mystrdup(LATEXT(1)));>>
+ ;
+ <<CannotContinue=TRUE;>>
+
+/* rule error */
+
+error : <<char *t=NULL; ECnode *e; int go=1; TermEntry *p;>>
+ "{\\}#errclass"
+ (<<;>> TokenTerm <<t=mystrdup(LATEXT(1));>>
+ | QuotedTerm <<t=mystrdup(LATEXT(1));>>
+ )
+ <<e = newECnode;
+ require(e!=NULL, "cannot allocate error class node");
+ e->lexclass = CurrentLexClass;
+ if ( Tnum( (t=StripQuotes(t)) ) == 0 )
+ {
+ if ( hash_get(Texpr, t) != NULL )
+ warn(eMsg1("errclass name conflicts with regular expression '%s'",t));
+ e->tok = addTname( t );
+ set_orel(e->tok, &imag_tokens);
+ require((p=(TermEntry *)hash_get(Tname, t)) != NULL,
+ "hash table mechanism is broken");
+ p->classname = 1; /* entry is errclass name, not token */
+ list_add(&eclasses, (char *)e);
+ }
+ else
+ {
+ warn(eMsg1("redefinition of errclass or conflict w/token or tokclass '%s'; ignored",t));
+ free( (char *)e );
+ go=0;
+ }
+ >>
+ "\{"
+ ( NonTerminal <<if ( go ) t=mystrdup(LATEXT(1));>>
+ | TokenTerm <<if ( go ) t=mystrdup(LATEXT(1));>>
+ | QuotedTerm <<if ( go ) t=mystrdup(LATEXT(1));>>
+ )
+ <<if ( go ) list_add(&(e->elist), t);>>
+ (
+ ( NonTerminal <<if ( go ) t=mystrdup(LATEXT(1));>>
+ | TokenTerm <<if ( go ) t=mystrdup(LATEXT(1));>>
+ | QuotedTerm <<if ( go ) t=mystrdup(LATEXT(1));>>
+ )
+ <<if ( go ) list_add(&(e->elist), t);>>
+ )*
+ "\}"
+ ;
+ <<CannotContinue=TRUE;>>
+
+/* rule tclass */
+
+tclass : <<char *t=NULL; TCnode *e; int go=1,tok,totok; TermEntry *p, *term, *toterm;>>
+ <<char *akaString=NULL; int save_file; int save_line;>>
+ <<char *totext=NULL; >>
+ "{\\}#tokclass" TokenTerm <<t=mystrdup(LATEXT(1));>>
+ <<e = newTCnode;
+ require(e!=NULL, "cannot allocate token class node");
+ e->lexclass = CurrentLexClass;
+ if ( Tnum( t ) == 0 )
+ {
+ e->tok = addTname( t );
+ set_orel(e->tok, &imag_tokens);
+ set_orel(e->tok, &tokclasses);
+ require((p=(TermEntry *)hash_get(Tname, t)) != NULL,
+ "hash table mechanism is broken");
+ p->classname = 1; /* entry is class name, not token */
+ p->tclass = e; /* save ptr to this tclass def */
+ list_add(&tclasses, (char *)e);
+ }
+ else
+ {
+ warn(eMsg1("redefinition of tokclass or conflict w/token '%s'; ignored",t));
+ free( (char *)e );
+ go=0;
+ }
+ >>
+/* MR23 */ {
+/* MR23 */ "\("
+/* MR23 */ QuotedTerm
+/* MR23 */ <<akaString=mystrdup(StripQuotes(LATEXT(1)));
+/* MR11 */ save_file=CurFile;save_line=zzline;
+/* MR23 */ >>
+/* MR23 */ "\)"
+/* MR23 */ }
+/* MR23 */
+/* MR23 */
+/* MR23 */ <<
+/* MR23 */ if (p!= NULL && akaString != NULL) {
+/* MR23 */ if (p->akaString != NULL) {
+/* MR23 */ if (strcmp(p->akaString,akaString) != 0) {
+/* MR23 */ warnFL(eMsg2("this #tokclass statement conflicts with a previous #tokclass %s(\"%s\") statement",
+/* MR23 */ t,p->akaString),
+/* MR23 */ FileStr[save_file],save_line);
+/* MR23 */ };
+/* MR23 */ } else {
+/* MR23 */ p->akaString=akaString;
+/* MR23 */ };
+/* MR23 */ };
+/* MR23 */ >>
+
+ "\{"
+ (
+ ( TokenTerm
+ <<if ( go ) {
+ term = (TermEntry *) hash_get(Tname, LATEXT(1));
+ if ( term==NULL && UserDefdTokens ) {
+ err("implicit token definition not allowed with #tokdefs");
+ go = 0;
+ }
+ else {t=mystrdup(LATEXT(1)); tok=addTname(LATEXT(1));}
+ }>>
+
+ {
+ ".."
+ TokenTerm
+
+ <<if ( go ) {
+ toterm = (TermEntry *) hash_get(Tname, LATEXT(1));
+ if ( toterm==NULL && UserDefdTokens ) {
+ err("implicit token definition not allowed with #tokdefs");
+ go = 0;
+ } else {
+ totext=mystrdup(LATEXT(1)); totok=addTname(LATEXT(1));
+ }
+ }
+ >>
+ }
+
+ | QuotedTerm
+ <<if ( go ) {
+ term = (TermEntry *) hash_get(Texpr, LATEXT(1));
+ if ( term==NULL && UserDefdTokens ) {
+ err("implicit token definition not allowed with #tokdefs");
+ go = 0;
+ }
+ else {t=mystrdup(LATEXT(1)); tok=addTexpr(LATEXT(1));}
+ }>>
+ )
+ <<if ( go ) {
+ if (totext == NULL) {
+ list_add(&(e->tlist), t);
+ } else {
+ list_add(&(e->tlist),"..");
+ list_add(&(e->tlist),t);
+ list_add(&(e->tlist),totext);
+ }
+ totext=NULL;
+ }
+ >>
+ )+ // MR15 Manfred Kogler - forbid empty #tokclass sets (was "+")
+ "\}"
+ ;
+ <<CannotContinue=TRUE;>>
+
+/* rule token */
+
+token : <<char *t=NULL, *e=NULL, *a=NULL; int tnum=0;>>
+ <<char *akaString=NULL; TermEntry *te;int save_file=0,save_line=0;>> /* MR11 */
+ "{\\}#token"
+
+/* MR1 10-Apr-97 MR1 Allow shift right operator in DLG actions */
+/* MR1 Danger when parser feedback to lexer */
+/* MR1 */
+
+ <<tokenActionActive=1;>> /* MR1 */
+ { TokenTerm <<t=mystrdup(LATEXT(1));>>
+
+/* MR11 */ {
+/* MR11 */ "\("
+/* MR11 */ QuotedTerm
+/* MR11 */ <<akaString=mystrdup(StripQuotes(LATEXT(1)));
+/* MR11 */ save_file=CurFile;save_line=zzline;
+/* MR11 */ >>
+/* MR11 */ "\)"
+/* MR11 */ }
+
+ { "=" "[0-9]+" /* define the token type number */
+ <<tnum = atoi(LATEXT(1));>>
+ }
+ }
+ { QuotedTerm <<e=mystrdup(LATEXT(1));>> }
+ { Action
+ <<
+ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(a!=NULL, "rule token: cannot allocate action");
+ strcpy(a, LATEXT(1));
+ >>
+ }
+
+ { ";" } /* MR11 */
+
+ <<chkToken(t, e, a, tnum);>>
+
+ <<if (t != NULL) {
+ te=(TermEntry *)hash_get(Tname,t);
+ if (te != NULL && akaString != NULL) {
+ if (te->akaString != NULL) {
+ if (strcmp(te->akaString,akaString) != 0) {
+ warnFL(eMsg2("this #token statement conflicts with a previous #token %s(\"%s\") statement",
+ t,te->akaString),
+ FileStr[save_file],save_line);
+ };
+ } else {
+ te->akaString=akaString;
+ };
+ };
+ };
+ >>
+ ;
+ <<CannotContinue=TRUE;>>
+
+/* rule block */
+
+block[set *toksrefd, set *rulesrefd]
+ : <<
+ Graph g, b;
+ set saveblah;
+ int saveinalt = inAlt;
+ ExceptionGroup *eg;
+ *$toksrefd = empty;
+ *$rulesrefd = empty;
+ set_clr(AST_nodes_refd_in_actions);
+ CurBlockID++;
+/* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID;
+ CurAltNum = 1;
+/* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
+ saveblah = attribsRefdFromAction;
+ attribsRefdFromAction = empty;
+ >>
+
+ alt[toksrefd,rulesrefd] <<b = g = $1;>>
+
+ <<
+ if ( ((Junction *)g.left)->p1->ntype == nAction )
+ {
+ ActionNode *actionNode=(ActionNode *)
+ ( ( (Junction *)g.left) ->p1);
+ if (!actionNode->is_predicate )
+ {
+ actionNode->init_action = TRUE;
+/* MR12c */ if (actionNode->noHoist) {
+/* MR12c */ errFL("<<nohoist>> appears as init-action - use <<>> <<nohoist>>",
+/* MR12c */ FileStr[actionNode->file],actionNode->line);
+/* MR12c */ };
+ }
+ }
+ ((Junction *)g.left)->blockid = CurBlockID;
+ >>
+
+ ( exception_group > [eg]
+ <<
+ if ( eg!=NULL ) {
+/* MR7 ***** eg->altID = makeAltID(CurBlockID,CurAltNum); *****/
+/* MR7 ***** CurAltStart->exception_label = eg->altID; *****/
+ list_add(&CurExGroups, (void *)eg);
+ }
+ >>
+ )*
+ <<CurAltNum++;
+/* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
+ >>
+
+ ( "\|" <<inAlt=1;>>
+ alt[toksrefd,rulesrefd] <<g = Or(g, $2);>>
+ <<
+ ((Junction *)g.left)->blockid = CurBlockID;
+ >>
+
+ ( exception_group > [eg]
+ <<
+ if ( eg!=NULL ) {
+/* MR7 ***** eg->altID = makeAltID(CurBlockID,CurAltNum); *****/
+/* MR7 ***** CurAltStart->exception_label = eg->altID; *****/
+ list_add(&CurExGroups, (void *)eg);
+ }
+ >>
+ )*
+
+ <<CurAltNum++;
+/* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
+ >>
+
+ )*
+ <<$0 = b;>>
+ <<attribsRefdFromAction = saveblah; inAlt = saveinalt;>>
+ ;
+ <<CannotContinue=TRUE;>>
+
+/* rule alt */
+
+alt[set *toksrefd, set *rulesrefd]
+ : <<int n=0; Graph g; int e_num=0, old_not=0; Node *node; set elems, dif;
+ int first_on_line = 1, use_def_MT_handler = 0;
+ g.left=NULL; g.right=NULL;
+
+ CurAltStart = NULL;
+ elems = empty;
+ inAlt = 1;
+ >>
+ { "\@" /* handle MismatchedToken signals with default handler */
+ <<use_def_MT_handler = 1;>>
+ }
+
+ ( <<;>> /* MR9 Removed unreferenced variable "tok" */
+ { <<old_not=0;>> "\~" <<old_not=1;>> }
+ element[old_not, first_on_line, use_def_MT_handler] > [node]
+ <<if ( node!=NULL && node->ntype!=nAction ) first_on_line = 0;>>
+ <<
+ if ( $2.left!=NULL ) {
+ g = Cat(g, $2);
+ n++;
+ if ( node!=NULL ) {
+ if ( node->ntype!=nAction ) e_num++;
+ /* record record number of all rule and token refs */
+ if ( node->ntype==nToken ) {
+ TokNode *tk = (TokNode *)((Junction *)$2.left)->p1;
+ tk->elnum = e_num;
+ set_orel(e_num, &elems);
+ }
+ else if ( node->ntype==nRuleRef ) {
+ RuleRefNode *rn = (RuleRefNode *)((Junction *)$2.left)->p1;
+ rn->elnum = e_num;
+ set_orel(e_num, $rulesrefd);
+ }
+ }
+ }
+ >>
+ )*
+ <<if ( n == 0 ) g = emptyAlt();
+ $0 = g;
+ /* We want to reduce number of LT(i) calls and the number of
+ * local attribute variables in C++ mode (for moment, later we'll
+ * do for C also). However, if trees are being built, they
+ * require most of the attrib variables to create the tree nodes
+ * with; therefore, we gen a token ptr for each token ref in C++
+ */
+ if ( GenCC && !GenAST )
+ {
+ /* This now free's the temp set -ATG 5/6/95 */
+ set temp;
+ temp = set_and(elems, attribsRefdFromAction);
+ set_orin($toksrefd, temp);
+ set_free(temp);
+ }
+ else set_orin($toksrefd, elems);
+ if ( GenCC ) {
+ dif = set_dif(attribsRefdFromAction, elems);
+ if ( set_deg(dif)>0 )
+ err("one or more $i in action(s) refer to non-token elements");
+ set_free(dif);
+ }
+ set_free(elems);
+ set_free(attribsRefdFromAction);
+ inAlt = 0;
+ >>
+ ;
+ <<CannotContinue=TRUE;>>
+
+/* rule element_label */
+
+element_label > [LabelEntry *label]
+ : <<TermEntry *t=NULL; LabelEntry *l=NULL; RuleEntry *r=NULL; char *lab;>>
+ LABEL <<lab = mystrdup(LATEXT(1));>>
+ <<
+ UsedNewStyleLabel = 1;
+ if ( UsedOldStyleAttrib ) err("cannot mix with new-style labels with old-style $i");
+ t = (TermEntry *) hash_get(Tname, lab);
+ if ( t==NULL ) t = (TermEntry *) hash_get(Texpr, lab);
+ if ( t==NULL ) r = (RuleEntry *) hash_get(Rname, lab);
+ if ( t!=NULL ) {
+ err(eMsg1("label definition clashes with token/tokclass definition: '%s'", lab));
+ $label = NULL;
+ }
+ else if ( r!=NULL ) {
+ err(eMsg1("label definition clashes with rule definition: '%s'", lab));
+ $label = NULL;
+ }
+ else {
+ /* we don't clash with anybody else */
+ l = (LabelEntry *) hash_get(Elabel, lab);
+ if ( l==NULL ) { /* ok to add new element label */
+ l = (LabelEntry *)hash_add(Elabel,
+ lab,
+ (Entry *)newLabelEntry(lab));
+ /* add to list of element labels for this rule */
+ list_add(&CurElementLabels, (void *)lab);
+/* MR7 */ leAdd(l); /* list of labels waiting for exception group definitions */
+ $label = l;
+ }
+ else {
+ err(eMsg1("label definitions must be unique per rule: '%s'", lab));
+ $label = NULL;
+ }
+ }
+ >>
+ ":"
+ ;
+
+/* rule element */
+
+element[int old_not, int first_on_line, int use_def_MT_handler] > [Node *node]
+ : <<
+ Attrib blk;
+ Predicate *pred = NULL;
+ int local_use_def_MT_handler=0;
+ ActionNode *act;
+ RuleRefNode *rr;
+ set toksrefd, rulesrefd;
+ TermEntry *term;
+ TokNode *p=NULL; RuleRefNode *q; int approx=0;
+ LabelEntry *label=NULL;
+ int predMsgDone=0;
+ int semDepth=0;
+ int ampersandStyle;
+ int height; /* MR11 */
+ int equal_height; /* MR11 */
+
+ char* pFirstSetSymbol = NULL; /* MR21 */
+
+ $node = NULL;
+ >>
+ {element_label>[label]}
+ ( TokenTerm
+ <<
+ term = (TermEntry *) hash_get(Tname, LATEXT(1));
+ if ( term==NULL && UserDefdTokens ) {
+ err("implicit token definition not allowed with #tokdefs");
+ $$.left = $$.right = NULL;
+ }
+ else {
+ $$ = buildToken(LATEXT(1));
+ p=((TokNode *)((Junction *)$$.left)->p1);
+ term = (TermEntry *) hash_get(Tname, LATEXT(1));
+ require( term!= NULL, "hash table mechanism is broken");
+ p->tclass = term->tclass;
+ p->complement = $old_not;
+ if ( label!=NULL ) {
+ p->el_label = label->str;
+ label->elem = (Node *)p;
+ }
+ }
+ >>
+ { ".."
+ ( QuotedTerm
+ <<if ( p!=NULL ) setUpperRange(p, LATEXT(1));>>
+ | TokenTerm
+ <<if ( p!=NULL ) setUpperRange(p, LATEXT(1));>>
+ )
+ }
+ <<
+ if ( p!=NULL && (p->upper_range!=0 || p->tclass || $old_not) )
+ list_add(&MetaTokenNodes, (void *)p);
+ >>
+ ( "^" <<if ( p!=NULL ) p->astnode=ASTroot;>>
+ | <<if ( p!=NULL ) p->astnode=ASTchild;>>
+ | "!" <<if ( p!=NULL ) p->astnode=ASTexclude;>>
+ )
+ { "\@" <<local_use_def_MT_handler = 1;>> }
+ <<
+ if ( p!=NULL && $first_on_line ) {
+ CurAltStart = (Junction *)$$.left;
+ altAdd(CurAltStart); /* MR7 */
+ p->altstart = CurAltStart;
+ }
+ if ( p!=NULL )
+ p->use_def_MT_handler = $use_def_MT_handler || local_use_def_MT_handler;
+ $node = (Node *)p;
+ >>
+ | QuotedTerm
+ <<
+ term = (TermEntry *) hash_get(Texpr, LATEXT(1));
+ if ( term==NULL && UserDefdTokens ) {
+ err("implicit token definition not allowed with #tokdefs");
+ $$.left = $$.right = NULL;
+ }
+ else {
+ $$ = buildToken(LATEXT(1)); p=((TokNode *)((Junction *)$$.left)->p1);
+ p->complement = $old_not;
+ if ( label!=NULL ) {
+ p->el_label = label->str;
+ label->elem = (Node *)p;
+ }
+ }
+ >>
+ { ".."
+ ( QuotedTerm
+ <<if ( p!=NULL ) setUpperRange(p, LATEXT(1));>>
+ | TokenTerm
+ <<if ( p!=NULL ) setUpperRange(p, LATEXT(1));>>
+ )
+ }
+ ( "^" <<if ( p!=NULL ) p->astnode=ASTroot;>>
+ | <<if ( p!=NULL ) p->astnode=ASTchild;>>
+ | "!" <<if ( p!=NULL ) p->astnode=ASTexclude;>>
+ )
+ { "\@" <<local_use_def_MT_handler = 1;>> }
+ <<
+ if ( p!=NULL && (p->upper_range!=0 || p->tclass || $old_not) )
+ list_add(&MetaTokenNodes, (void *)p);
+ >>
+ <<
+ if ( $first_on_line ) {
+ CurAltStart = (Junction *)$$.left;
+ altAdd(CurAltStart); /* MR7 */
+ p->altstart = CurAltStart;
+ }
+ if ( p!=NULL )
+ p->use_def_MT_handler = $use_def_MT_handler || local_use_def_MT_handler;
+ $node = (Node *)p;
+ >>
+
+ | <<if ( $old_not ) warn("~ WILDCARD is an undefined operation (implies 'nothing')");>>
+ "."
+ <<$$ = buildWildCard(LATEXT(1)); p=((TokNode *)((Junction *)$$.left)->p1);>>
+ ( "^" <<p->astnode=ASTroot;>>
+ | <<p->astnode=ASTchild;>>
+ | "!" <<p->astnode=ASTexclude;>>
+ )
+ <<list_add(&MetaTokenNodes, (void *)p);>>
+ <<
+ if ( $first_on_line ) {
+ CurAltStart = (Junction *)$$.left;
+ altAdd(CurAltStart); /* MR7 */
+ p->altstart = CurAltStart;
+ if ( label!=NULL ) {
+ p->el_label = label->str;
+ label->elem = (Node *)p;
+ }
+ }
+ $node = (Node *)p;
+ >>
+
+ | <<if ( $old_not ) warn("~ NONTERMINAL is an undefined operation");>>
+ NonTerminal
+ <<$$ = buildRuleRef(LATEXT(1));>>
+ { "!" <<q = (RuleRefNode *) ((Junction *)$$.left)->p1;
+ q->astnode=ASTexclude;>>
+ }
+ { {"\<"}
+ PassAction <<addParm(((Junction *)$$.left)->p1, LATEXT(1));>>
+ }
+ <<rr=(RuleRefNode *) ((Junction *)$$.left)->p1;>>
+ { <<char *a;>>
+ "\>"
+ PassAction
+ <<
+ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(a!=NULL, "rule element: cannot allocate assignment");
+ strcpy(a, LATEXT(1));
+ rr->assign = a;
+ >>
+ }
+ <<
+ if ( label!=NULL ) {
+ rr->el_label = label->str;
+ label->elem = (Node *)rr;
+ }
+ if ( $first_on_line ) {
+ CurAltStart = (Junction *)$$.left;
+ altAdd(CurAltStart); /* MR7 */
+ ((RuleRefNode *)((Junction *)$$.left)->p1)->altstart = CurAltStart;
+ }
+ $node = (Node *)rr;
+ >>
+ )
+
+ | <<if ( $old_not ) warn("~ ACTION is an undefined operation");>>
+ Action <<$0 = buildAction(LATEXT(1),action_file,action_line, 0);>>
+ <<if ( $first_on_line ) { /* MR7 */
+ CurAltStart = (Junction *)$0.left; /* MR7 */
+ altAdd(CurAltStart); /* MR7 */
+ };>> /* MR7 */
+ <<$node = (Node *) ((Junction *)$0.left)->p1;>>
+
+ | <<if ( $old_not ) warn("~ SEMANTIC-PREDICATE is an undefined operation");>>
+ Pred <<$0 = buildAction(LATEXT(1),action_file,action_line, 1);>>
+ <<act = (ActionNode *) ((Junction *)$0.left)->p1;>>
+ <<if (numericActionLabel) { /* MR10 */
+ list_add(&NumericPredLabels,act); /* MR10 */
+ numericActionLabel=0; /* MR10 */
+ }; /* MR10 */
+ >>
+ { <<char *a;>>
+ PassAction
+ <<
+ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(a!=NULL, "rule element: cannot allocate predicate fail action");
+ strcpy(a, LATEXT(1));
+ act->pred_fail = a;
+ >>
+ }
+ <<if ( $first_on_line ) { /* MR7 */
+ CurAltStart = (Junction *)$0.left; /* MR7 */
+ altAdd(CurAltStart); /* MR7 */
+ };>> /* MR7 */
+ <<$node = (Node *)act;>>
+
+ | <<if ( $old_not ) warn("~ BLOCK is an undefined operation");>>
+ <<BlkLevel++;
+ if (BlkLevel >= MAX_BLK_LEVEL) fatal("Blocks nested too deeply");
+/* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID;
+/* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
+ >>
+ { Pragma
+ ( "approx" <<approx=LL_k;>>
+ | "LL\(1\)" <<approx = 1;>> /* MR20 */
+ | "LL\(2\)" <<approx = 2;>> /* MR20 */
+ )
+ }
+
+/* MR21 */ { FirstSetSymbol
+/* MR21 */ "\("
+/* MR21 */ ( NonTerminal
+/* MR21 */ <<
+/* MR21 */ pFirstSetSymbol = (char *) calloc(strlen(LATEXT(1))+1,
+/* MR21 */ sizeof(char));
+/* MR21 */ require(pFirstSetSymbol!=NULL,
+/* MR21 */ "cannot allocate first set name");
+/* MR21 */ strcpy(pFirstSetSymbol, LATEXT(1));
+/* MR21 */ >>
+/* MR21 */ | TokenTerm
+/* MR21 */ <<
+/* MR21 */ pFirstSetSymbol = (char *) calloc(strlen(LATEXT(1))+1,
+/* MR21 */ sizeof(char));
+/* MR21 */ require(pFirstSetSymbol!=NULL,
+/* MR21 */ "cannot allocate first set name");
+/* MR21 */ strcpy(pFirstSetSymbol, LATEXT(1));
+/* MR21 */ >>
+/* MR21 */ )
+/* MR21 */ "\)"
+/* MR21 */ }
+
+ (
+
+ "\(" block[&toksrefd,&rulesrefd] "\)"
+ <<blk = $$ = $2;
+ /* MR23 */ CurBlockID_array[BlkLevel] = (-1);
+ /* MR23 */ CurAltNum_array[BlkLevel] = (-1);
+ --BlkLevel;
+ >>
+
+ ( "\*" <<$$ = makeLoop($$,approx,pFirstSetSymbol);>>
+ | "\+" <<$$ = makePlus($$,approx,pFirstSetSymbol);>>
+ | "?"
+ (
+ ( "=>" <<ampersandStyle=0;>>
+ | "&&" <<ampersandStyle=1;>> /* MR10 (g)? && <<p>>? */
+ )
+ Pred /* generalized predicate */
+ /* first make into a predicate */
+ <<$$ = buildAction(LATEXT(1),action_file,action_line,1);>>
+ <<act = (ActionNode *) ((Junction *)$$.left)->p1;>>
+ <<semDepth=predicateLookaheadDepth(act);>> /* MR10 */
+ <<if (numericActionLabel) { /* MR10 */
+ list_add(&NumericPredLabels,act); /* MR10 */
+ numericActionLabel=0; /* MR10 */
+ }; /* MR10 */
+ >>
+ { <<char *a;>>
+ PassAction
+ <<
+ a = (char *)calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(a!=NULL, "rule element: cannot allocate predicate fail action");
+ strcpy(a, LATEXT(1));
+ act->pred_fail = a;
+ >>
+ }
+ <<if ($first_on_line) { /* MR7 */
+ CurAltStart=(Junction *)$$.left; /* MR7 */
+ altAdd(CurAltStart); /* MR7 */
+ };>>
+ <<$node = (Node *)act;>>
+
+ /* for now, just snag context */
+ <<
+ pred = computePredFromContextGuard(blk,&predMsgDone); /* MR10 */
+ if ( pred==NULL) { /* MR10 */
+ if ( !predMsgDone) err("invalid or missing context guard"); /* MR10 */
+ predMsgDone=1; /* MR10 */
+ } else { /* MR10 */
+ act->guardNodes=(Junction *)blk.left; /* MR11 */
+ pred->expr = act->action;
+ pred->source = act;
+/* MR10 */ pred->ampersandStyle = ampersandStyle; /* 0 means (g)? => ... 1 means (g)? && ... */
+/* MR13 */ if (pred->tcontext != NULL) {
+/* MR13 */ height=MR_max_height_of_tree(pred->tcontext);
+/* MR13 */ equal_height=MR_all_leaves_same_height(pred->tcontext,height);
+/* MR13 */ if (! equal_height) {
+/* MR13 */ errFL("in guarded predicates all tokens in the guard must be at the same height",
+/* MR13 */ FileStr[act->file],act->line);
+/* MR13 */ };
+/* MR13 */ }
+/* MR10 */ if (ampersandStyle) {
+/* MR10 */ act->ampersandPred = pred;
+/* MR11 */ if (! HoistPredicateContext) {
+/* MR11 */ errFL("without \"-prc on\" (guard)? && <<pred>>? ... doesn't make sense",
+/* MR11 */ FileStr[act->file],act->line);
+/* MR11 */ };
+/* MR10 */ } else {
+/* MR10 */ act->guardpred = pred;
+/* MR10 */ };
+/* MR10 */ if (pred->k != semDepth) {
+/* MR10 */ warn(eMsgd2("length of guard (%d) does not match the length of semantic predicate (%d)",
+/* MR10 */ pred->k,semDepth));
+/* MR10 */ };
+ }
+ >>
+ | <<$$ = makeBlk($$,approx,pFirstSetSymbol);
+ FoundGuessBlk = 1;
+ ((Junction *) ((Junction *)$$.left)->p1)->guess=1;
+ if ( !$first_on_line ) {
+ err("(...)? predicate must be first element of production");
+ }
+ >>
+ )
+ | <<$$ = makeBlk($$,approx,pFirstSetSymbol);>>
+ )
+ <<
+ if ( pred==NULL && !predMsgDone) { /* MR10 */
+ ((Junction *)((Junction *)$$.left)->p1)->blockid = CurBlockID;
+ ((Junction *)((Junction *)$$.left)->p1)->tokrefs = toksrefd;
+ ((Junction *)((Junction *)$$.left)->p1)->rulerefs = rulesrefd;
+ if ( $first_on_line ) { /* MR7 */
+ CurAltStart = (Junction *)((Junction *)((Junction *)$$.left)->p1); /* MR7 */
+ altAdd(CurAltStart); /* MR7 */
+ }; /* MR7 */
+ $node = (Node *) ((Junction *)$$.left)->p1;
+ }
+ >>
+
+ | "\{" block[&toksrefd,&rulesrefd]
+ <<$$ = makeOpt($2,approx,pFirstSetSymbol);
+ /* MR23 */ CurBlockID_array[BlkLevel] = (-1);
+ /* MR23 */ CurAltNum_array[BlkLevel] = (-1);
+ --BlkLevel;
+ >>
+ "\}"
+ <<
+ ((Junction *)((Junction *)$$.left)->p1)->blockid = CurBlockID;
+ ((Junction *)((Junction *)$$.left)->p1)->tokrefs = toksrefd;
+ ((Junction *)((Junction *)$$.left)->p1)->rulerefs = rulesrefd;
+ >>
+ <<if ( $first_on_line ) { /* MR7 */
+ CurAltStart = (Junction *) ((Junction *)((Junction *)$$.left)->p1); /* MR7 */
+ altAdd(CurAltStart); /* MR7 */
+ };
+ >>
+ <<$node = (Node *) ((Junction *)$$.left)->p1;>>
+
+ )
+
+/* Error catching alternatives */
+ | "\*" <<warn("don't you want a ')' with that '*'?"); CannotContinue=TRUE;>>
+ | "\+" <<warn("don't you want a ')' with that '+'?"); CannotContinue=TRUE;>>
+ | "\>" <<warn("'>' can only appear after a nonterminal"); CannotContinue=TRUE;>>
+ | PassAction <<warn("[...] out of context 'rule > [...]'");
+ CannotContinue=TRUE;>>
+ ;
+ <<CannotContinue=TRUE;>>
+
+/* rule default_exception_handler */
+
+default_exception_handler
+ : exception_group > [DefaultExGroup]
+ ;
+
+/* rule exception_group */
+
+exception_group > [ExceptionGroup *eg]
+ : <<ExceptionHandler *h; LabelEntry *label=NULL; /* MR6 */
+ FoundException = 1; FoundExceptionGroup = 1;>> /* MR6 */
+
+ "exception" <<$eg = (ExceptionGroup *)calloc(1, sizeof(ExceptionGroup));>>
+ { <<char *p;>>
+ PassAction /* did they attach a label? */
+ <<
+ p = LATEXT(1)+1;
+ p[strlen(p)-1] = '\0'; /* kill trailing space */
+ label = (LabelEntry *) hash_get(Elabel, LATEXT(1)+1);
+ if ( label==NULL )
+ {
+ err(eMsg1("unknown label in exception handler: '%s'", LATEXT(1)+1));
+ }
+ >>
+ }
+ ( exception_handler > [h]
+ <<list_add(&($eg->handlers), (void *)h);>>
+ )*
+ { "default" ":" Action
+ <<{
+ ExceptionHandler *eh = (ExceptionHandler *)
+ calloc(1, sizeof(ExceptionHandler));
+ char *a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(eh!=NULL, "exception: cannot allocate handler");
+ require(a!=NULL, "exception: cannot allocate action");
+ strcpy(a, LATEXT(1));
+ eh->action = a;
+ eh->signalname = (char *) calloc(strlen("default")+1, sizeof(char));
+ require(eh->signalname!=NULL, "exception: cannot allocate sig name");
+ strcpy(eh->signalname, "default");
+ list_add(&($eg->handlers), (void *)eh);
+ }>>
+ }
+
+ <<
+ if ( label!=NULL ) {
+ /* Record ex group in sym tab for this label */
+ if ( label->ex_group!=NULL ) {
+ err(eMsg1("duplicate exception handler for label '%s'",label->str));
+ } else {
+ label->ex_group = $eg;
+ /* Label the exception group itself */
+ $eg->label = label->str;
+ /* Make the labelled element pt to the exception also */
+/* MR6 */ if (label->elem == NULL) {
+/* MR6 */ err(eMsg1("reference in exception handler to undefined label '%s'",label->str));
+/* MR6 */ } else {
+ switch ( label->elem->ntype ) {
+ case nRuleRef :
+ {
+ RuleRefNode *r = (RuleRefNode *)label->elem;
+ r->ex_group = $eg;
+ break;
+ }
+ case nToken :
+ {
+ TokNode *t = (TokNode *)label->elem;
+ t->ex_group = $eg;
+ break;
+ }
+ } /* end switch */
+/* MR6 */ }; /* end test on label->elem */
+ } /* end test on label->ex_group */
+
+ } /* end test on exception label */
+
+/* MR7 */
+/* MR7 */ if (BlkLevel == 1 && label == NULL) {
+/* MR7 */ $eg->forRule=1;
+/* MR7 */ } else if (label == NULL) {
+/* MR7 */ $eg->altID = makeAltID(CurBlockID_array[BlkLevel], CurAltNum_array[BlkLevel]);
+/* MR7 */ egAdd($eg);
+/* MR7 */ } else {
+/* MR7 */ $eg->labelEntry=label;
+/* MR7 */ };
+/* MR7 */
+/* MR7 */ /* You may want to remove this exc from the rule list */
+/* MR7 */ /* and handle at the labeled element site. */
+/* MR7 */
+/* MR7 */ if (label != NULL) {
+/* MR7 */ $eg = NULL;
+/* MR7 */ };
+
+ >>
+ ;
+ <<CannotContinue=TRUE;>>
+
+/* rule exception_handler */
+
+exception_handler > [ExceptionHandler *eh]
+ : <<;>> /* MR9 Removed unreferenced variable "a" */
+ "catch"
+ <<
+ $eh = (ExceptionHandler *)calloc(1, sizeof(ExceptionHandler));
+ require($eh!=NULL, "exception: cannot allocate handler");
+ >>
+ ( NonTerminal
+ <<
+ $eh->signalname = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require($eh->signalname!=NULL, "exception: cannot allocate sig name");
+ strcpy($eh->signalname, LATEXT(1));
+ >>
+ | TokenTerm
+ <<
+ $eh->signalname = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require($eh->signalname!=NULL, "exception: cannot allocate sig name");
+ strcpy($eh->signalname, LATEXT(1));
+ >>
+ )
+ ":"
+ { <<$eh->action = NULL;>>
+ Action
+ <<
+ $eh->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require($eh->action!=NULL, "exception: cannot allocate action");
+ strcpy($eh->action, LATEXT(1));
+ >>
+ }
+ ;
+ <<CannotContinue=TRUE;>>
+
+#token NonTerminal "[a-z] [A-Za-z0-9_]*"
+ <<
+ while ( zzchar==' ' || zzchar=='\t' ) {
+ zzadvance();
+ }
+ if ( zzchar == ':' && inAlt ) NLA = LABEL;
+ >>
+#token TokenTerm "[A-Z] [A-Za-z0-9_]*"
+ <<
+ while ( zzchar==' ' || zzchar=='\t' ) {
+ zzadvance();
+ }
+ if ( zzchar == ':' && inAlt ) NLA = LABEL;
+ >>
+#token "{\\}#[A-Za-z0-9_]*" <<warn(eMsg1("unknown meta-op: %s",LATEXT(1))); zzskip(); >>
+
+#lexclass PARSE_ENUM_FILE
+
+#token "[\t\ ]+" << zzskip(); >> /* Ignore White */
+#token "\n|\r|\r\n" << zzline++; zzskip(); >> /* Track Line # */
+#token "//" << zzmode(TOK_DEF_CPP_COMMENTS); zzmore(); >>
+#token "/\*" << zzmode(TOK_DEF_COMMENTS); zzskip(); >>
+#token "#ifdef" << zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); >>
+#token "#if" << zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); >>
+#token "#ifndef" << ; >>
+#token "#else" << zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); >>
+#token "#endif" << zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); >>
+#token "#undef" << zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); >>
+#token "#import" << zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); >>
+#token "@" << ; >>
+
+/* rule enum_file */
+
+enum_file[char *fname]
+ : { "#ifndef" ID
+ { "#define" ID /* ignore if it smells like a gate */
+ /* First #define after the first #ifndef (if any) is ignored */
+ }
+ }
+ ( ( enum_def[$fname] )+
+ | defines[$fname]
+ )
+ |
+ ;
+
+/* rule defines */
+
+defines[char *fname]
+ : <<int v; int maxt=(-1); char *t;>> /* MR3 */
+ (
+ "#define" ID
+ <<t = mystrdup(LATEXT(1));>>
+ INT
+ <<
+ v = atoi(LATEXT(1));
+/* fprintf(stderr, "#token %s=%d\n", t, v);*/
+
+ /* MR2 Andreas Magnusson (Andreas.Magnusson@mailbox.swipnet.se) */
+ /* MR2 Fix to bug introduced by 1.33MR1 for #tokdefs */
+ /* MR2 Don't let #tokdefs be confused by */
+ /* MR2 DLGminToken and DLGmaxToken */
+
+ if ( ! isDLGmaxToken(t)) { /* MR2 */
+ TokenNum = v;
+ if ( v>maxt ) maxt=v;
+ if ( Tnum( t ) == 0 ) {
+ addForcedTname( t, v );
+ } else {
+ warnFL(eMsg1("redefinition of token %s; ignored",t),$fname,zzline);
+ };
+ };
+ >>
+ )+
+ <<TokenNum = maxt + 1;>>
+ ;
+
+/* rule enum_def */
+
+enum_def[char *fname]
+ : <<int v= 0; int maxt=(-1); char *t;>> /* MR3 */
+ "enum" ID
+ "\{"
+ ID
+ <<t = mystrdup(LATEXT(1));>>
+ ( "=" INT <<v=atoi(LATEXT(1));>>
+ | <<v++;>>
+ )
+ <<
+/* fprintf(stderr, "#token %s=%d\n", t, v);*/
+ TokenNum = v;
+ if ( v>maxt ) maxt=v; /* MR3 */
+ if ( Tnum( t ) == 0 ) addForcedTname( t, v );
+ else {
+ warnFL(eMsg1("redefinition of token %s; ignored",t),$fname,zzline);
+ }
+ >>
+ ( ","
+
+ /* MR2 Andreas Magnusson (Andreas.Magnusson@mailbox.swipnet.se) */
+ /* MR2 Fix to bug introduced by 1.33MR1 for #tokdefs */
+ /* MR2 Don't let #tokdefs be confused by */
+ /* MR2 DLGminToken and DLGmaxToken */
+
+ {
+ <<isDLGmaxToken(LATEXT(1))>>? ID { "=" INT } /* MR2 */
+ | ID /* MR2 */
+ <<t = mystrdup(LATEXT(1));>>
+ ( "=" INT <<v=atoi(LATEXT(1));>>
+ | <<v++;>>
+ )
+ <<
+/* fprintf(stderr, "#token %s=%d\n", t, v);*/
+ TokenNum = v;
+ if ( v>maxt ) maxt=v; /* MR3 */
+ if ( Tnum( t ) == 0 ) addForcedTname( t, v );
+ else {
+ warnFL(eMsg1("redefinition of token %s; ignored",t),$fname,zzline);
+ }
+ >>
+ }
+ )*
+ "\}"
+ ";"
+ <<TokenNum = maxt + 1;>> /* MR3 */
+ ;
+
+#token INT "[0-9]+"
+#token ID "[a-zA-Z_][_a-zA-Z0-9]*"
+
+#lexclass START
+
+/* MR14 Arpad Beszedes 26-May-98
+ Add support for #line directives when antlr source is pre-processed
+*/
+
+#lexaction
+<<
+
+static char *
+#ifdef __USE_PROTOS
+getFileNameFromTheLineInfo(char *toStr, char *fromStr)
+#else
+getFileNameFromTheLineInfo(toStr, fromStr)
+char *toStr, *fromStr;
+#endif
+{
+ int i, j, k;
+
+ if (!fromStr || !toStr) return toStr;
+
+ /* find the first " */
+
+ for (i=0;
+ (i<MaxFileName) &&
+ (fromStr[i] != '\n') &&
+ (fromStr[i] != '\r') &&
+ (fromStr[i] != '\"');
+ i++) /* nothing */ ;
+
+ if ( (i == MaxFileName) ||
+ (fromStr[i] == '\n') ||
+ (fromStr[i] == '\r') ) {
+ return toStr;
+ }
+
+ /* find the second " */
+
+ for (j=i+1;
+ (j<MaxFileName) &&
+ (fromStr[j] != '\n') &&
+ (fromStr[j] != '\r') &&
+ (fromStr[j] != '\"');
+ j++) /* nothing */ ;
+
+ if ((j == MaxFileName) ||
+ (fromStr[j] == '\n') ||
+ (fromStr[j] == '\r') ) {
+ return toStr;
+ }
+
+ /* go back until the last / or \ */
+
+ for (k=j-1;
+ (fromStr[k] != '\"') &&
+ (fromStr[k] != '/') &&
+ (fromStr[k] != '\\');
+ k--) /* nothing */ ;
+
+ /* copy the string after " / or \ into toStr */
+
+ for (i=k+1; fromStr[i] != '\"'; i++) {
+ toStr[i-k-1] = fromStr[i];
+ }
+
+ toStr[i-k-1] = '\0';
+
+ return toStr;
+}
+
+/* MR14 end of a block to support #line in antlr source code */
+
+>>
+
+<<
+
+/* MR2 Andreas Magnusson (Andreas.Magnusson@mailbox.swipnet.se) */
+/* MR2 Fix to bug introduced by 1.33MR1 for #tokdefs */
+/* MR2 Don't let #tokdefs be confused by */
+/* MR2 DLGminToken and DLGmaxToken */
+
+/* semantic check on DLGminToken and DLGmaxmaxToken in #tokdefs */
+
+#ifdef __USE_PROTOS
+static int isDLGmaxToken(char *Token)
+#else
+static int isDLGmaxToken(Token)
+ char * Token;
+#endif
+{
+ static char checkStr1[] = "DLGmaxToken";
+ static char checkStr2[] = "DLGminToken";
+
+ if (strcmp(Token, checkStr1) == 0)
+ return 1;
+ else if (strcmp(Token, checkStr2) == 0)
+ return 1;
+ else
+ return 0;
+}
+
+/* semantics of #token */
+static void
+#ifdef __USE_PROTOS
+chkToken(char *t, char *e, char *a, int tnum)
+#else
+chkToken(t,e,a,tnum)
+char *t, *e, *a;
+int tnum;
+#endif
+{
+ TermEntry *p;
+
+ /* check to see that they don't try to redefine a token as a token class */
+ if ( t!=NULL ) {
+ p = (TermEntry *) hash_get(Tname, t);
+ if ( p!=NULL && p->classname ) {
+ err(eMsg1("redefinition of #tokclass '%s' to #token not allowed; ignored",t));
+ if ( a!=NULL ) free((char *)a);
+ return;
+ }
+ }
+
+ if ( t==NULL && e==NULL ) { /* none found */
+ err("#token requires at least token name or rexpr");
+ }
+ else if ( t!=NULL && e!=NULL ) { /* both found */
+ if ( UserDefdTokens ) { /* if #tokdefs, must not define new */
+ p = (TermEntry *) hash_get(Tname, t);
+ if ( p == NULL) {
+err(eMsg1("new token definition '%s' not allowed - only #token with name already defined by #tokdefs file allowed",t));
+ return;
+ };
+ }
+ Tklink(t, e);
+ if ( a!=NULL ) {
+ if ( hasAction(e) ) {
+ err(eMsg1("redefinition of action for %s; ignored",e));
+ }
+ else setHasAction(e, a);
+ }
+ }
+ else if ( t!=NULL ) { /* only one found */
+ if ( UserDefdTokens ) {
+ p = (TermEntry *) hash_get(Tname, t);
+ if (p == NULL) {
+err(eMsg1("new token definition '%s' not allowed - only #token with name already defined by #tokdefs file allowed",t));
+ };
+ return;
+ }
+ if ( Tnum( t ) == 0 ) addTname( t );
+ else {
+ err(eMsg1("redefinition of token %s; ignored",t));
+ }
+ if ( a!=NULL ) {
+ err(eMsg1("action cannot be attached to a token name (%s); ignored",t));
+ free((char *)a);
+ }
+ }
+ else if ( e!=NULL ) {
+ if ( Tnum( e ) == 0 ) addTexpr( e );
+ else {
+ if ( hasAction(e) ) {
+ err(eMsg1("redefinition of action for expr %s; ignored",e));
+ }
+ else if ( a==NULL ) {
+ err(eMsg1("redefinition of expr %s; ignored",e));
+ }
+ }
+ if ( a!=NULL ) setHasAction(e, a);
+ }
+
+ /* if a token type number was specified, then add the token ID and 'tnum'
+ * pair to the ForcedTokens list. (only applies if an id was given)
+ */
+ if ( t!=NULL && tnum>0 )
+ {
+ if ( set_el(tnum, reserved_positions) )
+ {
+ err(eMsgd("a token has already been forced to token number %d; ignored", tnum));
+ }
+ else
+ {
+ list_add(&ForcedTokens, newForcedToken(t,tnum));
+ set_orel(tnum, &reserved_positions);
+ }
+ }
+}
+>>
+
+<<
+static int
+#ifdef __USE_PROTOS
+match_token(char *s, char **nxt)
+#else
+match_token(s,nxt)
+char *s;
+char **nxt;
+#endif
+{
+ if ( !(*s>='A' && *s<='Z') ) return 0;
+ s++;
+ while ( (*s>='a' && *s<='z') ||
+ (*s>='A' && *s<='Z') ||
+ (*s>='0' && *s<='9') ||
+ *s=='_' )
+ {
+ s++;
+ }
+ if ( *s!=' ' && *s!='}' ) return 0;
+ *nxt = s;
+ return 1;
+}
+
+static int
+#ifdef __USE_PROTOS
+match_rexpr(char *s, char **nxt)
+#else
+match_rexpr(s,nxt)
+char *s;
+char **nxt;
+#endif
+{
+ if ( *s!='"' ) return 0;
+ s++;
+ while ( *s!='"' )
+ {
+ if ( *s=='\n' || *s=='\r' ) /* MR13 */
+ warn("eoln found in regular expression");
+ if ( *s=='\\' ) s++;
+ s++;
+ }
+ *nxt = s+1;
+ return 1;
+}
+
+/*
+ * Walk a string "{ A .. Z }" where A..Z is a space separated list
+ * of token references (either labels or reg exprs). Return a
+ * string "inlineX_set" for some unique integer X. Basically,
+ * we pretend as if we had seen "#tokclass inlineX { A .. Z }"
+ * on the input stream outside of an action.
+ */
+char *
+#ifdef __USE_PROTOS
+inline_set(char *s)
+#else
+inline_set(s)
+char *s;
+#endif
+{
+ char *nxt;
+ fprintf(stderr, "found consumeUntil( {...} )\n");
+ while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;}
+ if ( *s!='{' )
+ {
+ err("malformed consumeUntil( {...} ); missing '{'");
+ return "bad_set";
+ }
+ s++;
+ while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;}
+ while ( *s!='}' )
+ {
+ if ( match_token(s,&nxt) ) fprintf(stderr, "found token %s\n", s);
+ else if ( match_rexpr(s,&nxt) ) fprintf(stderr, "found rexpr %s\n", s);
+ else {
+ err("invalid element in consumeUntil( {...} )");
+ return "bad_set";
+ }
+ s = nxt;
+ while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;}
+ }
+ return "inlineX_set";
+}
+>>
+
+<<
+/* ANTLR-specific syntax error message generator
+ * (define USER_ZZSYN when compiling so don't get 2 definitions)
+ */
+void
+#ifdef __USE_PROTOS
+zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok,
+int k, char *bad_text)
+#else
+zzsyn(text, tok, egroup, eset, etok, k, bad_text)
+char *text, *egroup, *bad_text;
+int tok;
+int etok;
+int k;
+SetWordType *eset;
+#endif
+{
+ fprintf(stderr, ErrHdr, FileStr[CurFile]!=NULL?FileStr[CurFile]:"stdin", zzline);
+ fprintf(stderr, " syntax error at \"%s\"", (tok==zzEOF_TOKEN)?"EOF":text);
+ if ( !etok && !eset ) {fprintf(stderr, "\n"); return;}
+ if ( k==1 ) fprintf(stderr, " missing");
+ else
+ {
+ fprintf(stderr, "; \"%s\" not", bad_text);
+ if ( zzset_deg(eset)>1 ) fprintf(stderr, " in");
+ }
+ if ( zzset_deg(eset)>0 ) zzedecode(eset);
+ else fprintf(stderr, " %s", zztokens[etok]);
+ if ( strlen(egroup) > (size_t)0 ) fprintf(stderr, " in %s", egroup);
+ fprintf(stderr, "\n");
+}
+>>
+
+#lexaction <<
+#ifdef __USE_PROTOS
+void mark_label_used_in_sem_pred(LabelEntry *le) /* MR10 */
+#else
+void mark_label_used_in_sem_pred(le) /* MR10 */
+ LabelEntry *le;
+#endif
+{
+ TokNode *tn;
+ require (le->elem->ntype == nToken,"mark_label_used... ntype != nToken");
+ tn=(TokNode *)le->elem;
+ require (tn->label != 0,"mark_label_used... TokNode has no label");
+ tn->label_used_in_semantic_pred=1;
+}
+>>
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.r b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.r
new file mode 100644
index 000000000..a8d183c4e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.r
@@ -0,0 +1,787 @@
+/*
+ File: antlrMPW.r
+ Target: antlr 133MR
+ Created: Monday, June 15, 1998 4:41:11 AM
+ Author: Kenji Tanaka (kentar@osa.att.ne.jp)
+*/
+
+#include "cmdo.r"
+
+resource 'cmdo' (128, "Antlr") {
+ { /* array dialogs: 5 elements */
+ /* [1] */
+ 295,
+ "ANTLR -- Purdue Compiler Construction To"
+ "ol Set (PCCTS) LL(k) parser generator.",
+ { /* array itemArray: 12 elements */
+ /* [1] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {18, 23, 33, 223},
+ "Read grammar from stdin",
+ "-",
+ "Read grammar from stdin."
+ },
+ /* [2] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {38, 23, 53, 310},
+ "Send grammar.c/grammar.cpp to stdout",
+ "-stdout",
+ "Send grammar.c/grammar.cpp to stdout."
+ },
+ /* [3] */
+ NotDependent {
+
+ },
+ MultiFiles {
+ "Grammar File(s)É",
+ "Choose the grammar specification files y"
+ "ou wish to have ANTLR process.",
+ {79, 22, 98, 152},
+ "Grammar specification:",
+ "",
+ MultiInputFiles {
+ { /* array MultiTypesArray: 1 elements */
+ /* [1] */
+ text
+ },
+ ".g",
+ "Files ending in .g",
+ "All text files"
+ }
+ },
+ /* [4] */
+ NotDependent {
+
+ },
+ Files {
+ DirOnly,
+ OptionalFile {
+ {58, 168, 74, 298},
+ {79, 169, 98, 299},
+ "Output Directory",
+ ":",
+ "-o",
+ "",
+ "Choose the directory where ANTLR will pu"
+ "t its output.",
+ dim,
+ "Output DirectoryÉ",
+ "",
+ ""
+ },
+ NoMore {
+
+ }
+ },
+ /* [5] */
+ NotDependent {
+
+ },
+ Redirection {
+ StandardOutput,
+ {126, 27}
+ },
+ /* [6] */
+ NotDependent {
+
+ },
+ Redirection {
+ DiagnosticOutput,
+ {126, 178}
+ },
+ /* [7] */
+ NotDependent {
+
+ },
+ TextBox {
+ gray,
+ {117, 20, 167, 300},
+ "Redirection"
+ },
+ /* [8] */
+ NotDependent {
+
+ },
+ NestedDialog {
+ 5,
+ {20, 324, 40, 460},
+ "Parse OptionsÉ",
+ "Parse control options may be set with th"
+ "is button."
+ },
+ /* [9] */
+ NotDependent {
+
+ },
+ NestedDialog {
+ 2,
+ {50, 324, 70, 460},
+ "Generate OptionsÉ",
+ "Various command line options may be set "
+ "with this button."
+ },
+ /* [10] */
+ NotDependent {
+
+ },
+ NestedDialog {
+ 3,
+ {78, 324, 98, 460},
+ "More OptionsÉ",
+ "Antlr has ALOT of options. There are eve"
+ "n more to be found with this button."
+ },
+ /* [11] */
+ NotDependent {
+
+ },
+ NestedDialog {
+ 4,
+ {106, 324, 126, 460},
+ "Rename OptionsÉ",
+ "Options for renaming output files may be"
+ " set with this button."
+ },
+ /* [12] */
+ NotDependent {
+
+ },
+ VersionDialog {
+ VersionString {
+ "1.33MR"
+ },
+ "PCCTS was written by Terence Parr, Russe"
+ "ll Quong, Will Cohen, and Hank Dietz: 19"
+ "89-1998. MPW port by Scott Haney.",
+ noDialog
+ }
+ },
+ /* [2] */
+ 295,
+ "Use this dialog to specify command line "
+ "Generate Options.",
+ { /* array itemArray: 15 elements */
+ /* [1] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {18, 25, 33, 225},
+ "Generate C++ code",
+ "-CC",
+ "Generate C++ output from both ANTLR and "
+ "DLG."
+ },
+ /* [2] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {38, 25, 53, 225},
+ "Generate ASTs",
+ "-gt",
+ "Generate code for Abstract-Syntax-Trees "
+ "(ASTs)."
+ },
+ /* [3] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {58, 25, 73, 225},
+ "Generate line info",
+ "-gl",
+ "If this option is checked, ANTLR will ge"
+ "nerate line info about grammaractions, t"
+ "hereby making debugging easier since com"
+ "pile errors will point to the grammar fi"
+ "le."
+ },
+ /* [4] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {78, 25, 93, 225},
+ "Generate error classes",
+ "-ge",
+ "If this option is checked, ANTLR will ge"
+ "nerate an error class foreach non-termin"
+ "al."
+ },
+ /* [5] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {98, 25, 113, 225},
+ "Don't generate Code",
+ "-gc",
+ "If this option is checked, ANTLR will ge"
+ "nerate no code, i.e. it will only perfor"
+ "m analysis on the grammar."
+ },
+ /* [6] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {118, 25, 133, 225},
+ "Delay lookahead fetches",
+ "-gk",
+ "If this option is checked, ANTLR will ge"
+ "nerate a parser that delays lookahead fe"
+ "tches until needed."
+ },
+ /* [7] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {138, 25, 153, 225},
+ "Use newAST(...)",
+ "-newAST",
+ "In C++ mode use \"newAST(...)\" rather tha"
+ "n \"new AST(...)\""
+ },
+ /* [8] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {18, 235, 33, 435},
+ "Support parse traces",
+ "-gd",
+ "If this option is checked, ANTLR inserts"
+ " code in each parsing function to provid"
+ "e for user-defined handling of a detaile"
+ "d parse trace. The code consists of call"
+ "s to zzTRACEIN and zzTRACEOUT."
+ },
+ /* [9] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {38, 235, 53, 435},
+ "Generate cross-references",
+ "-cr",
+ "If this option is checked, ANTLR will ge"
+ "nerate a cross reference for all rules. "
+ "For each rule it will print a list of al"
+ "l other rules that reference it."
+ },
+ /* [10] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {58, 235, 73, 435},
+ "Don't create Lexer files",
+ "-gx",
+ "If this option is checked, ANTLR will no"
+ "t generate DLG-related output files. Thi"
+ "s option should be used if one wants a c"
+ "ustom lexical analyzer or if one has mad"
+ "e changes to the grammar not affecting t"
+ "he lexical structure."
+ },
+ /* [11] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {78, 235, 93, 460},
+ "Don't generate token expr sets",
+ "-gs",
+ "If this option is checked, ANTLR will no"
+ "t generate sets for token expression set"
+ "s; instead, it will generate a || separa"
+ "ted sequence of LA(1)==token #. "
+ },
+ /* [12] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {98, 235, 113, 460},
+ "Generate ANSI-compatible",
+ "-ga",
+ "Generate ANSI-compatible code (default=F"
+ "ALSE)"
+ },
+ /* [13] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {118, 235, 133, 460},
+ "Don't generate tokens.h",
+ "-gxt",
+ "Do not generate tokens.h (default=FALSE)"
+ },
+ /* [13] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {138, 235, 153, 460},
+ "Provide \"(alpha)? beta\" info",
+ "-alpha",
+ "Provide additional information for \"(alpha)? beta\" error messages"
+ },
+ /* [14] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Tabs(1 to 8):",
+ {162, 23, 177, 117},
+ {163, 125, 179, 196},
+ "",
+ keepCase,
+ "-tab",
+ "Width of tabs (1 to 8) for grammar.c/gra"
+ "mmar.cpp files."
+ },
+ /* [15] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Function Prefix:",
+ {161, 236, 177, 342},
+ {162, 345, 177, 454},
+ "",
+ keepCase,
+ "-gp",
+ "Prefix all generated rule functions with"
+ " a string."
+ }
+ },
+ /* [3] */
+ 295,
+ "Use this dialog to specify still more co"
+ "mmand line options.",
+ { /* array itemArray: 12 elements */
+ /* [1] */
+ NotDependent {
+
+ },
+ RadioButtons {
+ { /* array radioArray: 3 elements */
+ /* [1] */
+ {38, 25, 53, 85}, "None", "", Set, "When this option is selected, ANTLR will"
+ " not print the grammar to stdout.",
+ /* [2] */
+ {38, 100, 53, 160}, "Yes", "-p", NotSet, "When this option is selected, ANTLR will"
+ " print the grammar, stripped of all acti"
+ "ons and comments, to stdout.",
+ /* [3] */
+ {38, 175, 53, 235}, "More", "-pa", NotSet, "When this option is selected, ANTLR will"
+ " print the grammar, stripped of all acti"
+ "ons and comments, to stdout. It will als"
+ "o annotate the output with the first set"
+ "s determined from grammar analysis."
+ }
+ },
+ /* [2] */
+ NotDependent {
+
+ },
+ TextBox {
+ gray,
+ {28, 15, 60, 250},
+ "Grammar Printing"
+ },
+ /* [3] */
+ NotDependent {
+
+ },
+ RadioButtons {
+ { /* array radioArray: 3 elements */
+ /* [1] */
+ {88, 25, 103, 85}, "Low", "", Set, "When this option is selected, ANTLR will"
+ " show ambiguities/errors in low detail.",
+ /* [2] */
+ {88, 100, 103, 160}, "Medium", "-e2", NotSet, "When this option is selected, ANTLR will"
+ " show ambiguities/errors in more detail.",
+ /* [3] */
+ {88, 175, 103, 235}, "High", "-e3", NotSet, "When this option is selected, ANTLR will"
+ " show ambiguities/errors in excruciating"
+ " detail."
+ }
+ },
+ /* [4] */
+ NotDependent {
+
+ },
+ TextBox {
+ gray,
+ {78, 15, 110, 250},
+ "Error reporting"
+ },
+ /* [5] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {130, 22, 145, 222},
+ "More warnings",
+ "-w2",
+ "If this option is checked, ANTLR will wa"
+ "rn if semantic predicates and/or (É)? bl"
+ "ocks are assumed to cover ambiguous alte"
+ "rnatives."
+ },
+ /* [6] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Report when tnode usage exceeds:",
+ {162, 23, 180, 253},
+ {162, 255, 178, 326},
+ "",
+ keepCase,
+ "-treport",
+ "Report when tnode usage exceeds value du"
+ "ring ambiguity resolution."
+ },
+ /* [7] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {40, 292, 55, 431},
+ "Predicate",
+ "-info p",
+ "With the antlr \"-info p\" switch the user"
+ " will receive information about the pred"
+ "icate suppression in the generated file."
+ },
+ /* [8] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {60, 292, 75, 430},
+ "Tree Nodes",
+ "-info t",
+ "Using \"-info t\" gives information about "
+ "the total number of tnodes created and t"
+ "he peak number of tnodes."
+ },
+ /* [9] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {80, 292, 95, 425},
+ "First/follow",
+ "-info f",
+ "first/follow set information."
+ },
+ /* [10] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {100, 292, 115, 425},
+ "Monitor progress",
+ "-info m",
+ "prints name of each rule as it is starte"
+ "d and flushes output at start of each rule."
+ },
+ /* [11] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {120, 292, 135, 416},
+ "Orphan rules",
+ "-info o",
+ "If there is more than one rule which is "
+ "not referenced by any other rule then al"
+ "l such rules are listed."
+ },
+ /* [12] */
+ NotDependent {
+
+ },
+ TextBox {
+ gray,
+ {28, 279, 147, 451},
+ "Extra info"
+ }
+ },
+ /* [4] */
+ 295,
+ "Use this dialog to specify command line "
+ "options relating to renaming output file"
+ "s.",
+ { /* array itemArray: 7 elements */
+ /* [1] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Errors file name:",
+ {35, 25, 50, 205},
+ {35, 205, 51, 300},
+ "err.c",
+ keepCase,
+ "-fe",
+ "This entry specifies the name ANTLR uses"
+ " for the errors file."
+ },
+ /* [2] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Lexical output name:",
+ {60, 25, 75, 205},
+ {60, 205, 76, 300},
+ "parser.dlg",
+ keepCase,
+ "-fl",
+ "This entry specifies the name ANTLR uses"
+ " for the lexical output file."
+ },
+ /* [3] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Lexical modes name:",
+ {85, 25, 100, 205},
+ {85, 205, 101, 300},
+ "mode.h",
+ keepCase,
+ "-fm",
+ "This entry specifies the name ANTLR uses"
+ " for the lexical mode definitions file."
+ },
+ /* [4] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Remap file name:",
+ {110, 25, 125, 205},
+ {110, 205, 126, 300},
+ "remap.h",
+ keepCase,
+ "-fr",
+ "This entry specifies the name ANTLR uses"
+ " for the file that remaps globally visib"
+ "le symbols."
+ },
+ /* [5] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Tokens file name:",
+ {135, 25, 150, 205},
+ {135, 205, 151, 300},
+ "tokens.h",
+ keepCase,
+ "-ft",
+ "This entry specifies the name ANTLR uses"
+ " for the tokens file."
+ },
+ /* [6] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {160, 25, 175, 175},
+ "Create std header",
+ "-gh",
+ "If this option is checked, ANTLR will cr"
+ "eate a standard header file named, by de"
+ "fault 'stdpccts.h'. This name can be alt"
+ "ered using the entry right next door."
+ },
+ /* [7] */
+ Or {
+ { /* array OrArray: 1 elements */
+ /* [1] */
+ 6
+ }
+ },
+ RegularEntry {
+ "Std header file name:",
+ {160, 175, 175, 355},
+ {160, 355, 176, 450},
+ "stdpccts.h",
+ keepCase,
+ "-fh",
+ "This entry specifies the name ANTLR uses"
+ " for the standard header file."
+ }
+ },
+ /* [5] */
+ 295,
+ "Use this dialog to specify parse options"
+ ".",
+ { /* array itemArray: 9 elements */
+ /* [1] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Lookahead:",
+ {23, 27, 38, 152},
+ {46, 29, 62, 154},
+ "1",
+ keepCase,
+ "-k",
+ "This entry specifies the number of token"
+ "s of lookahead."
+ },
+ /* [2] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Compr lookahead:",
+ {22, 167, 37, 292},
+ {46, 172, 62, 297},
+ "",
+ keepCase,
+ "-ck",
+ "This entry specifies the number of token"
+ "s of lookahead when using compressed (li"
+ "near approximation) lookahead. In genera"
+ "l, the compressed lookahead is much deep"
+ "er than the full lookahead."
+ },
+ /* [3] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Max tree nodes:",
+ {22, 312, 37, 437},
+ {46, 315, 62, 445},
+ "",
+ keepCase,
+ "-rl",
+ "This entry specifies the maximum number "
+ "of tokens of tree nodes used by the gram"
+ "mar analysis."
+ },
+ /* [4] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {76, 25, 91, 350},
+ "Maintenance Release style hoisting",
+ "-mrhoist",
+ "Turn on/off k=1 Maintenance Release styl"
+ "e hoisting."
+ },
+ /* [5] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {96, 25, 111, 431},
+ "EXPERIMENTAL Maintenance Release style h"
+ "oisting",
+ "-mrhoistk",
+ "Turn on/off k>1 EXPERIMENTAL Maintenance"
+ " Release style hoisting."
+ },
+ /* [6] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {116, 25, 131, 363},
+ "Compute context for hoisted predicates",
+ "-prc on",
+ "Turn on/off computation of context for h"
+ "oisted predicates."
+ },
+ /* [7] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Ambiguity aid:",
+ {140, 27, 155, 125},
+ {141, 135, 155, 209},
+ "",
+ keepCase,
+ "-aa",
+ "Ambiguity aid for a rule (rule name or l"
+ "ine number)."
+ },
+ /* [8] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Limits exp growth:",
+ {140, 236, 155, 361},
+ {139, 372, 155, 452},
+ "",
+ keepCase,
+ "-aad",
+ "Limits exp growth of -aa listing - defau"
+ "lt=1 (max=ck value)."
+ },
+ /* [9] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {164, 26, 179, 366},
+ "Lookahead token may appear multiple time"
+ "s",
+ "-aam",
+ "Lookahead token may appear multiple time"
+ "s in -aa listing."
+ }
+ }
+ }
+};
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr1.txt b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr1.txt
new file mode 100644
index 000000000..4a7d22e7f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr1.txt
@@ -0,0 +1,264 @@
+
+
+
+ANTLR(1) PCCTS Manual Pages ANTLR(1)
+
+
+
+NAME
+ antlr - ANother Tool for Language Recognition
+
+SYNTAX
+ antlr [_o_p_t_i_o_n_s] _g_r_a_m_m_a_r__f_i_l_e_s
+
+DESCRIPTION
+ _A_n_t_l_r converts an extended form of context-free grammar into
+ a set of C functions which directly implement an efficient
+ form of deterministic recursive-descent LL(k) parser.
+ Context-free grammars may be augmented with predicates to
+ allow semantics to influence parsing; this allows a form of
+ context-sensitive parsing. Selective backtracking is also
+ available to handle non-LL(k) and even non-LALR(k) con-
+ structs. _A_n_t_l_r also produces a definition of a lexer which
+ can be automatically converted into C code for a DFA-based
+ lexer by _d_l_g. Hence, _a_n_t_l_r serves a function much like that
+ of _y_a_c_c, however, it is notably more flexible and is more
+ integrated with a lexer generator (_a_n_t_l_r directly generates
+ _d_l_g code, whereas _y_a_c_c and _l_e_x are given independent
+ descriptions). Unlike _y_a_c_c which accepts LALR(1) grammars,
+ _a_n_t_l_r accepts LL(k) grammars in an extended BNF notation -
+ which eliminates the need for precedence rules.
+
+ Like _y_a_c_c grammars, _a_n_t_l_r grammars can use automatically-
+ maintained symbol attribute values referenced as dollar
+ variables. Further, because _a_n_t_l_r generates top-down
+ parsers, arbitrary values may be inherited from parent rules
+ (passed like function parameters). _A_n_t_l_r also has a mechan-
+ ism for creating and manipulating abstract-syntax-trees.
+
+ There are various other niceties in _a_n_t_l_r, including the
+ ability to spread one grammar over multiple files or even
+ multiple grammars in a single file, the ability to generate
+ a version of the grammar with actions stripped out (for
+ documentation purposes), and lots more.
+
+OPTIONS
+ -ck _n
+ Use up to _n symbols of lookahead when using compressed
+ (linear approximation) lookahead. This type of looka-
+ head is very cheap to compute and is attempted before
+ full LL(k) lookahead, which is of exponential complex-
+ ity in the worst case. In general, the compressed loo-
+ kahead can be much deeper (e.g, -ck 10) _t_h_a_n _t_h_e _f_u_l_l
+ _l_o_o_k_a_h_e_a_d (_w_h_i_c_h _u_s_u_a_l_l_y _m_u_s_t _b_e _l_e_s_s _t_h_a_n _4).
+
+ -CC Generate C++ output from both ANTLR and DLG.
+
+ -cr Generate a cross-reference for all rules. For each
+ rule, print a list of all other rules that reference
+ it.
+
+ -e1 Ambiguities/errors shown in low detail (default).
+
+ -e2 Ambiguities/errors shown in more detail.
+
+ -e3 Ambiguities/errors shown in excruciating detail.
+
+ -fe file
+ Rename err.c to file.
+
+ -fh file
+ Rename stdpccts.h header (turns on -gh) to file.
+
+ -fl file
+ Rename lexical output, parser.dlg, to file.
+
+ -fm file
+ Rename file with lexical mode definitions, mode.h, to
+ file.
+
+ -fr file
+ Rename file which remaps globally visible symbols,
+ remap.h, to file.
+
+ -ft file
+ Rename tokens.h to file.
+
+ -ga Generate ANSI-compatible code (default case). This has
+ not been rigorously tested to be ANSI XJ11 C compliant,
+ but it is close. The normal output of _a_n_t_l_r is
+ currently compilable under both K&R, ANSI C, and C++-
+ this option does nothing because _a_n_t_l_r generates a
+ bunch of #ifdef's to do the right thing depending on
+ the language.
+
+ -gc Indicates that _a_n_t_l_r should generate no C code, i.e.,
+ only perform analysis on the grammar.
+
+ -gd C code is inserted in each of the _a_n_t_l_r generated pars-
+ ing functions to provide for user-defined handling of a
+ detailed parse trace. The inserted code consists of
+ calls to the user-supplied macros or functions called
+ zzTRACEIN and zzTRACEOUT. The only argument is a _c_h_a_r
+ * pointing to a C-style string which is the grammar
+ rule recognized by the current parsing function. If no
+ definition is given for the trace functions, upon rule
+ entry and exit, a message will be printed indicating
+ that a particular rule as been entered or exited.
+
+ -ge Generate an error class for each non-terminal.
+
+ -gh Generate stdpccts.h for non-ANTLR-generated files to
+ include. This file contains all defines needed to
+ describe the type of parser generated by _a_n_t_l_r (e.g.
+ how much lookahead is used and whether or not trees are
+ constructed) and contains the header action specified
+ by the user.
+
+ -gk Generate parsers that delay lookahead fetches until
+ needed. Without this option, _a_n_t_l_r generates parsers
+ which always have _k tokens of lookahead available.
+
+ -gl Generate line info about grammar actions in C parser of
+ the form # _l_i_n_e "_f_i_l_e" which makes error messages from
+ the C/C++ compiler make more sense as they will point
+ into the grammar file not the resulting C file.
+ Debugging is easier as well, because you will step
+ through the grammar not C file.
+
+ -gs Do not generate sets for token expression lists;
+ instead generate a ||-separated sequence of
+ LA(1)==_t_o_k_e_n__n_u_m_b_e_r. The default is to generate sets.
+
+ -gt Generate code for Abstract-Syntax Trees.
+
+ -gx Do not create the lexical analyzer files (dlg-related).
+ This option should be given when the user wishes to
+ provide a customized lexical analyzer. It may also be
+ used in _m_a_k_e scripts to cause only the parser to be
+ rebuilt when a change not affecting the lexical struc-
+ ture is made to the input grammars.
+
+ -k _n Set k of LL(k) to _n; i.e. set tokens of look-ahead
+ (default==1).
+
+ -o dir
+ Directory where output files should go (default=".").
+ This is very nice for keeping the source directory
+ clear of ANTLR and DLG spawn.
+
+ -p The complete grammar, collected from all input grammar
+ files and stripped of all comments and embedded
+ actions, is listed to stdout. This is intended to aid
+ in viewing the entire grammar as a whole and to elim-
+ inate the need to keep actions concisely stated so that
+ the grammar is easier to read. Hence, it is preferable
+ to embed even complex actions directly in the grammar,
+ rather than to call them as subroutines, since the sub-
+ routine call overhead will be saved.
+
+ -pa This option is the same as -p except that the output is
+ annotated with the first sets determined from grammar
+ analysis.
+
+ -prc on
+ Turn on the computation and hoisting of predicate con-
+ text.
+
+ -prc off
+ Turn off the computation and hoisting of predicate con-
+ text. This option makes 1.10 behave like the 1.06
+ release with option -pr on. Context computation is off
+ by default.
+
+ -rl _n
+ Limit the maximum number of tree nodes used by grammar
+ analysis to _n. Occasionally, _a_n_t_l_r is unable to
+ analyze a grammar submitted by the user. This rare
+ situation can only occur when the grammar is large and
+ the amount of lookahead is greater than one. A non-
+ linear analysis algorithm is used by PCCTS to handle
+ the general case of LL(k) parsing. The average com-
+ plexity of analysis, however, is near linear due to
+ some fancy footwork in the implementation which reduces
+ the number of calls to the full LL(k) algorithm. An
+ error message will be displayed, if this limit is
+ reached, which indicates the grammar construct being
+ analyzed when _a_n_t_l_r hit a non-linearity. Use this
+ option if _a_n_t_l_r seems to go out to lunch and your disk
+ start thrashing; try _n=10000 to start. Once the
+ offending construct has been identified, try to remove
+ the ambiguity that _a_n_t_l_r was trying to overcome with
+ large lookahead analysis. The introduction of (...)?
+ backtracking blocks eliminates some of these problems -
+ _a_n_t_l_r does not analyze alternatives that begin with
+ (...)? (it simply backtracks, if necessary, at run
+ time).
+
+ -w1 Set low warning level. Do not warn if semantic
+ predicates and/or (...)? blocks are assumed to cover
+ ambiguous alternatives.
+
+ -w2 Ambiguous parsing decisions yield warnings even if
+ semantic predicates or (...)? blocks are used. Warn if
+ predicate context computed and semantic predicates
+ incompletely disambiguate alternative productions.
+
+ - Read grammar from standard input and generate stdin.c
+ as the parser file.
+
+SPECIAL CONSIDERATIONS
+ _A_n_t_l_r works... we think. There is no implicit guarantee of
+ anything. We reserve no legal rights to the software known
+ as the Purdue Compiler Construction Tool Set (PCCTS) - PCCTS
+ is in the public domain. An individual or company may do
+ whatever they wish with source code distributed with PCCTS
+ or the code generated by PCCTS, including the incorporation
+ of PCCTS, or its output, into commercial software. We
+ encourage users to develop software with PCCTS. However, we
+ do ask that credit is given to us for developing PCCTS. By
+ "credit", we mean that if you incorporate our source code
+ into one of your programs (commercial product, research pro-
+ ject, or otherwise) that you acknowledge this fact somewhere
+ in the documentation, research report, etc... If you like
+ PCCTS and have developed a nice tool with the output, please
+ mention that you developed it using PCCTS. As long as these
+ guidelines are followed, we expect to continue enhancing
+ this system and expect to make other tools available as they
+ are completed.
+
+FILES
+ *.c output C parser.
+
+ *.cpp
+ output C++ parser when C++ mode is used.
+
+ parser.dlg
+ output _d_l_g lexical analyzer.
+
+ err.c
+ token string array, error sets and error support rou-
+ tines. Not used in C++ mode.
+
+ remap.h
+ file that redefines all globally visible parser sym-
+ bols. The use of the #parser directive creates this
+ file. Not used in C++ mode.
+
+ stdpccts.h
+ list of definitions needed by C files, not generated by
+ PCCTS, that reference PCCTS objects. This is not gen-
+ erated by default. Not used in C++ mode.
+
+ tokens.h
+ output #_d_e_f_i_n_e_s for tokens used and function prototypes
+ for functions generated for rules.
+
+
+SEE ALSO
+ dlg(1), pccts(1)
+
+
+
+
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c
new file mode 100644
index 000000000..5cb657bb2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c
@@ -0,0 +1,1025 @@
+/* bits.c -- manage creation and output of bit sets used by the parser.
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <assert.h>
+#include "pcctscfg.h"
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#include "dlgdef.h"
+
+/* char is only thing that is pretty much always known == 8 bits
+ * This allows output of antlr (set stuff, anyway) to be androgynous (portable)
+ */
+typedef unsigned char SetWordType;
+#define BitsPerByte 8
+#define BitsPerWord BitsPerByte*sizeof(SetWordType)
+
+static SetWordType *setwd = NULL;
+int setnum = -1;
+int wordnum = 0;
+
+int esetnum = 0;
+
+/* Used to convert native wordsize, which ANTLR uses (via set.c) to manipulate sets,
+ to bytes that are most portable size-wise.
+ */
+void
+#ifdef __USE_PROTOS
+DumpIntAsChars( FILE *f, char *format, unsigned wd )
+#else
+DumpIntAsChars( f, format, wd )
+FILE *f;
+char *format;
+unsigned wd;
+#endif
+{
+ int i;
+ /* uses max of 32 bit unsigned integer for the moment */
+ static unsigned long byte_mask[sizeof(unsigned long)] =
+ { 0xFF, 0xFF00UL, 0xFF0000UL, 0xFF000000UL }; /* MR20 G. Hobbelt */
+/* 0xFF00000000, 0xFF0000000000, 0xFF000000000000, 0xFF00000000000000 };*/
+
+ /* for each byte in the word */
+ assert(sizeof(unsigned) <= 4); /* M20 G. Hobbelt Sanity check */
+ for (i=0; i<sizeof(unsigned); i++)
+ {
+ /* mask out the ith byte and shift down to the first 8 bits */
+ fprintf(f, format, (wd&byte_mask[i])>>(i*BitsPerByte));
+ if ( i<sizeof(unsigned)-1) fprintf(f, ",");
+ }
+}
+
+/* Create a new setwd (ignoring [Ep] token on end) */
+void
+#ifdef __USE_PROTOS
+NewSetWd( void )
+#else
+NewSetWd( )
+#endif
+{
+ SetWordType *p;
+
+ if ( setwd == NULL )
+ {
+ setwd = (SetWordType *) calloc(TokenNum, sizeof(SetWordType));
+ require(setwd!=NULL, "NewSetWd: cannot alloc set wd\n");
+ }
+ for (p = setwd; p<&(setwd[TokenNum]); p++) {*p=0;}
+ wordnum++;
+}
+
+void
+#ifdef __USE_PROTOS
+DumpSetWd( void )
+#else
+DumpSetWd( )
+#endif
+{
+ if ( GenCC ) DumpSetWdForCC();
+ else DumpSetWdForC();
+}
+
+/* Dump the current setwd to ErrFile. 0..MaxTokenVal */
+void
+#ifdef __USE_PROTOS
+DumpSetWdForC( void )
+#else
+DumpSetWdForC( )
+#endif
+{
+ int i,c=1;
+
+ if ( setwd==NULL ) return;
+ fprintf(DefFile, "extern SetWordType setwd%d[];\n", wordnum);
+ fprintf(ErrFile,
+ "SetWordType setwd%d[%d] = {", wordnum, TokenNum-1);
+ for (i=0; i<TokenNum-1; i++)
+ {
+ DAWDLE;
+ if ( i!=0 ) fprintf(ErrFile, ",");
+ if ( c == 8 ) {fprintf(ErrFile, "\n\t"); c=1;} else c++;
+ fprintf(ErrFile, "0x%x", setwd[i]);
+ }
+ fprintf(ErrFile, "};\n");
+}
+
+/* Dump the current setwd to Parser.C file. 0..MaxTokenVal;
+ * Only used if -CC on.
+ */
+void
+#ifdef __USE_PROTOS
+DumpSetWdForCC( void )
+#else
+DumpSetWdForCC( )
+#endif
+{
+ int i,c=1;
+
+ if ( setwd==NULL ) return;
+ fprintf(Parser_h, "\tstatic SetWordType setwd%d[%d];\n", wordnum, TokenNum-1);
+ fprintf(Parser_c,
+ "SetWordType %s::setwd%d[%d] = {", CurrentClassName, wordnum,
+ TokenNum-1);
+ for (i=0; i<TokenNum-1; i++)
+ {
+ DAWDLE;
+ if ( i!=0 ) fprintf(Parser_c, ",");
+ if ( c == 8 ) {fprintf(Parser_c, "\n\t"); c=1;} else c++;
+ fprintf(Parser_c, "0x%x", setwd[i]);
+ }
+ fprintf(Parser_c, "};\n");
+}
+
+/* Make a new set. Dump old setwd and create new setwd if current setwd is full */
+void
+#ifdef __USE_PROTOS
+NewSet( void )
+#else
+NewSet( )
+#endif
+{
+ setnum++;
+ if ( setnum==BitsPerWord ) /* is current setwd full? */
+ {
+ DumpSetWd(); NewSetWd(); setnum = 0;
+ }
+}
+
+/* s is a set of tokens. Turn on bit at each token position in set 'setnum' */
+void
+#ifdef __USE_PROTOS
+FillSet( set s )
+#else
+FillSet( s )
+set s;
+#endif
+{
+ SetWordType mask=(((unsigned)1)<<setnum);
+ unsigned int e;
+
+ while ( !set_nil(s) )
+ {
+ e = set_int(s);
+ set_rm(e, s);
+ setwd[e] |= mask;
+ }
+}
+
+ /* E r r o r C l a s s S t u f f */
+
+/* compute the FIRST of a rule for the error class stuff */
+static set
+#ifdef __USE_PROTOS
+Efirst( char *rule, ECnode *eclass )
+#else
+Efirst( rule, eclass )
+char *rule;
+ECnode *eclass;
+#endif
+{
+ set rk, a;
+ Junction *r;
+ RuleEntry *q = (RuleEntry *) hash_get(Rname, rule);
+
+ if ( q == NULL )
+ {
+ warnNoFL(eMsg2("undefined rule '%s' referenced in errclass '%s'; ignored",
+ rule, TokenString(eclass->tok)));
+ return empty;
+ }
+ r = RulePtr[q->rulenum];
+ r->end->halt = TRUE; /* don't let reach fall off end of rule here */
+ rk = empty;
+ REACH(r, 1, &rk, a);
+ r->end->halt = FALSE;
+ return a;
+}
+
+/*
+ * scan the list of tokens/eclasses/nonterminals filling the new eclass
+ * with the set described by the list. Note that an eclass can be
+ * quoted to allow spaces etc... However, an eclass must not conflict
+ * with a reg expr found elsewhere. The reg expr will be taken over
+ * the eclass name.
+ */
+static void
+#ifdef __USE_PROTOS
+doEclass( char *eclass )
+#else
+doEclass( eclass )
+char *eclass;
+#endif
+{
+ TermEntry *q;
+ ECnode *p;
+ TCnode *tcnode;
+ ListNode *e;
+ unsigned int t;
+ unsigned deg=0;
+ set a;
+ require(eclass!=NULL, "doEclass: NULL eset");
+
+ p = (ECnode *) eclass;
+ lexmode(p->lexclass); /* switch to lexclass where errclass is defined */
+ p->eset = empty;
+ for (e = (p->elist)->next; e!=NULL; e=e->next)
+ {
+ q = NULL; /* MR23 */
+
+ if ( islower( *((char *)e->elem) ) ) /* is it a rule ref? (alias FIRST request) */
+ {
+ a = Efirst((char *)e->elem, p);
+ set_orin(&p->eset, a);
+ deg += set_deg(a);
+ set_free( a );
+ continue;
+ }
+ else if ( *((char *)e->elem)=='"' )
+ {
+ t = 0;
+ q = (TermEntry *) hash_get(Texpr, (char *) e->elem);
+ if ( q == NULL )
+ {
+ /* if quoted and not an expr look for eclass name */
+ q = (TermEntry *) hash_get(Tname, *((char **)&(e->elem))=StripQuotes((char *)e->elem));
+ if ( q != NULL ) t = q->token;
+ }
+ else t = q->token;
+ }
+ else /* labelled token/eclass/tokclass */
+ {
+ q = (TermEntry *) hash_get(Tname, (char *)e->elem);
+ if ( q != NULL )
+ {
+ if ( strcmp((char *)e->elem, TokenString(p->tok))==0 )
+ {
+ warnNoFL(eMsg1("self-referential error class '%s'; ignored",
+ (char *)e->elem));
+ continue;
+ }
+ else
+ t = q->token;
+ }
+ else t=0;
+ }
+ if ( t!=0 )
+ {
+ if (isTermEntryTokClass(q)) { /* MR23 */
+ tcnode = q->tclass; /* MR23 */
+ set_orin(&p->eset, tcnode->tset); /* MR23 */
+ deg = set_deg(p->eset); /* MR23 */
+ } /* MR23 */
+ else {
+ set_orel(t, &p->eset);
+ deg++;
+ }
+ }
+ else warnNoFL(eMsg2("undefined token '%s' referenced in errclass '%s'; ignored",
+ (char *)e->elem, TokenString(p->tok)));
+ }
+ p->setdeg = deg;
+}
+
+void
+#ifdef __USE_PROTOS
+ComputeErrorSets( void )
+#else
+ComputeErrorSets( )
+#endif
+{
+#ifdef __cplusplus
+ list_apply(eclasses, (void (*)(void *)) doEclass);
+#else
+#ifdef __USE_PROTOS
+ list_apply(eclasses, (void (*)(void *)) doEclass);
+#else
+ list_apply(eclasses, doEclass);
+#endif
+#endif
+}
+
+void
+#ifdef __USE_PROTOS
+ComputeTokSets( void )
+#else
+ComputeTokSets( )
+#endif
+{
+ ListNode *t, *e = NULL, *e1, *e2;
+ int something_changed;
+ int i;
+ TCnode *p;
+ TermEntry *q, *q1, *q2;
+
+ if ( tclasses == NULL ) return;
+
+ /* turn lists of token/tokclass references into sets */
+ for (t = tclasses->next; t!=NULL; t=t->next)
+ {
+ p = (TCnode *) t->elem;
+
+ /* if wild card, then won't have entries in tclass, assume all_tokens */
+ if ( p->tok == WildCardToken )
+ {
+ p->tset = set_dup(all_tokens);
+ continue;
+ }
+
+ lexmode(p->lexclass); /* switch to lexclass where tokclass is defined */
+ p->tset = empty;
+
+ /* instantiate all tokens/token_classes into the tset */
+ for (e = (p->tlist)->next; e!=NULL; e=e->next)
+ {
+ char *tokstr;
+ tokstr = (char *)e->elem;
+ if ( *tokstr == '"' ) {
+ q = (TermEntry *) hash_get(Texpr, tokstr);
+ require(q!=NULL, "ComputeTokSets: no token def");
+ set_orel(q->token, &p->tset);
+ } else if (tokstr[0] == '.') {
+ e1=e->next;
+ e2=e1->next;
+ e=e2;
+ q1= (TermEntry *) hash_get(Tname, (char *)e1->elem);
+ require(q1!=NULL, "ComputeTokSets: no token def");
+ q2= (TermEntry *) hash_get(Tname, (char *)e2->elem);
+ require(q2!=NULL, "ComputeTokSets: no token def");
+
+ if (set_el(q1->token,imag_tokens)) {
+errNoFL(eMsg2("can't define #tokclass %s using #tokclass or #errclass %s",
+ TokenString(p->tok),(char *)e1->elem) );
+ }
+ if (set_el(q2->token,imag_tokens)) {
+errNoFL(eMsg2("can't define #tokclass %s using #tokclass or #errclass %s",
+ TokenString(p->tok),(char *)e2->elem) );
+ }
+ if (q1->token > q2->token) {
+errNoFL(eMsg3("for #tokclass %s %s..%s - first token number > second token number",
+ TokenString(p->tok),(char *)e1->elem,(char *)e2->elem) );
+ for (i=q2->token; i<=q1->token; i++) { set_orel(i, &p->tset); }
+ } else {
+ for (i=q1->token; i<=q2->token; i++) { set_orel(i, &p->tset); }
+ }
+ } else {
+ q = (TermEntry *) hash_get(Tname, tokstr);
+ require(q!=NULL, "ComputeTokSets: no token def");
+ set_orel(q->token, &p->tset);
+ }
+ }
+ }
+
+ /* Go thru list of tokclasses again looking for tokclasses in sets */
+again:
+ something_changed = 0;
+ for (t = tclasses->next; t!=NULL; t=t->next)
+ {
+ set tcl;
+ p = (TCnode *) t->elem;
+ tcl = set_and(p->tset, tokclasses);
+ if ( !set_nil(tcl) )
+ {
+ int tk;
+ /* replace refs to tokclasses with the associated set of tokens */
+ something_changed = 1;
+ while ( !set_nil(tcl) )
+ {
+ tk = set_int(tcl); /* grab one of the tok class refs */
+ set_rm(tk, tcl);
+ if ( p->tok != tk ) /* tokclass ref to yourself? */
+ {
+ q = (TermEntry *) hash_get(Tname, TokenString(tk));
+ require(q!=NULL, "#tokclass not in hash table");
+ set_orin(&p->tset, q->tclass->tset);
+ }
+ set_rm(tk, p->tset); /* remove ref that we replaced */
+ }
+ }
+ set_free(tcl);
+ }
+ if ( something_changed ) goto again;
+}
+
+void
+#ifdef __USE_PROTOS
+DumpRemainingTokSets(void)
+#else
+DumpRemainingTokSets()
+#endif
+{
+ TCnode *p;
+ ListNode *t;
+
+ /* Go thru tclasses (for the last time) and dump the sets not dumped
+ * during code gen; yes, this is a bogus way to do this, but ComputeTokSets()
+ * can't dump the defs as the error file and tok file has not been created
+ * yet etc...
+ */
+ if ( tclasses==NULL ) return;
+ for (t = tclasses->next; t!=NULL; t=t->next)
+ {
+ unsigned e;
+ p = (TCnode *) t->elem;
+ if ( p->dumped ) continue;
+ e = DefErrSet(&(p->tset), 0, TokenString(p->tok));
+ p->dumped = 1;
+ p->setnum = e;
+ }
+}
+
+
+/* replace a subset of an error set with an error class name if a subset is found
+ * repeat process until no replacements made
+ */
+void
+#ifdef __USE_PROTOS
+SubstErrorClass( set *f )
+#else
+SubstErrorClass( f )
+set *f;
+#endif
+{
+ int max, done = 0;
+ ListNode *p;
+ ECnode *ec, *maxclass = NULL;
+ set a;
+ require(f!=NULL, "SubstErrorClass: NULL eset");
+
+ if ( eclasses == NULL ) return;
+ while ( !done )
+ {
+ max = 0;
+ maxclass = NULL;
+ for (p=eclasses->next; p!=NULL; p=p->next) /* chk all error classes */
+ {
+ ec = (ECnode *) p->elem;
+ if ( ec->setdeg > max )
+ {
+ if ( set_sub(ec->eset, *f) || set_equ(ec->eset, *f) )
+ {maxclass = ec; max=ec->setdeg;}
+ }
+ }
+ if ( maxclass != NULL ) /* if subset found, replace with token */
+ {
+ a = set_dif(*f, maxclass->eset);
+ set_orel((unsigned)maxclass->tok, &a);
+ set_free(*f);
+ *f = a;
+ }
+ else done = 1;
+ }
+}
+
+int
+#ifdef __USE_PROTOS
+DefErrSet1(int nilOK, set *f, int subst, char *name )
+#else
+DefErrSet1(nilOK, f, subst, name )
+int nilOK;
+set *f;
+int subst; /* should be substitute error classes? */
+char *name;
+#endif
+{
+ if ( GenCC ) return DefErrSetForCC1(nilOK, f, subst, name, "_set");
+ else return DefErrSetForC1(nilOK, f, subst, name, "_set");
+}
+
+int
+#ifdef __USE_PROTOS
+DefErrSet( set *f, int subst, char *name )
+#else
+DefErrSet( f, subst, name )
+set *f;
+int subst; /* should be substitute error classes? */
+char *name;
+#endif
+{
+ return DefErrSet1(0,f,subst,name);
+}
+
+int
+#ifdef __USE_PROTOS
+DefErrSetWithSuffix(int nilOK, set *f, int subst, char *name, const char* suffix)
+#else
+DefErrSetWithSuffix(nilOK, f, subst, name, suffix )
+int nilOK;
+set *f;
+int subst; /* should be substitute error classes? */
+char *name;
+char *suffix;
+#endif
+{
+ if ( GenCC ) return DefErrSetForCC1(nilOK, f, subst, name, suffix );
+ else return DefErrSetForC1(nilOK, f, subst, name, suffix);
+}
+
+/* Define a new error set. WARNING...set-implementation dependent.
+ */
+int
+#ifdef __USE_PROTOS
+DefErrSetForC1(int nilOK, set *f, int subst, char * name, const char * suffix)
+#else
+DefErrSetForC1(nilOK, f, subst, name, suffix)
+int nilOK; /* MR13 */
+set *f;
+int subst; /* should be substitute error classes? */
+char *name;
+const char *suffix;
+#endif
+{
+ unsigned *p, *endp;
+ int e=1;
+
+ if (!nilOK) require(!set_nil(*f), "DefErrSetForC1: nil set to dump?");
+
+ if ( subst ) SubstErrorClass(f);
+ p = f->setword;
+ endp = &(f->setword[f->n]);
+ esetnum++;
+ if ( name!=NULL )
+ fprintf(DefFile, "extern SetWordType %s%s[];\n", name, suffix);
+ else
+ fprintf(DefFile, "extern SetWordType zzerr%d[];\n", esetnum);
+ if ( name!=NULL ) {
+ fprintf(ErrFile, "SetWordType %s%s[%lu] = {",
+ name,
+ suffix,
+ NumWords(TokenNum-1)*sizeof(unsigned));
+ }
+ else {
+ fprintf(ErrFile, "SetWordType zzerr%d[%lu] = {",
+ esetnum,
+ NumWords(TokenNum-1)*sizeof(unsigned));
+ }
+ while ( p < endp )
+ {
+ if ( e > 1 ) fprintf(ErrFile, ", ");
+ DumpIntAsChars(ErrFile, "0x%x", *p++);
+ if ( e == 3 )
+ {
+ DAWDLE;
+ if ( p < endp ) fprintf(ErrFile, ",");
+ fprintf(ErrFile, "\n\t");
+ e=1;
+ }
+ else e++;
+ }
+ fprintf(ErrFile, "};\n");
+
+ return esetnum;
+}
+
+int
+#ifdef __USE_PROTOS
+DefErrSetForC( set *f, int subst, char *name )
+#else
+DefErrSetForC( f, subst, name )
+set *f;
+int subst; /* should be substitute error classes? */
+char *name;
+#endif
+{
+ return DefErrSetForC1(0,f,subst,name, "_set");
+}
+
+/* Define a new error set. WARNING...set-implementation dependent;
+ * Only used when -CC on.
+ */
+
+int
+#ifdef __USE_PROTOS
+DefErrSetForCC1(int nilOK, set *f, int subst, char *name, const char *suffix )
+#else
+DefErrSetForCC1(nilOK, f, subst, name, suffix )
+int nilOK; /* MR13 */
+set *f;
+int subst; /* should be substitute error classes? */
+char *name;
+const char *suffix;
+#endif
+{
+ unsigned *p, *endp;
+ int e=1;
+
+ if (!nilOK) require(!set_nil(*f), "DefErrSetForCC1: nil set to dump?");
+
+ if ( subst ) SubstErrorClass(f);
+ p = f->setword;
+ endp = &(f->setword[f->n]);
+ esetnum++;
+
+ if ( name!=NULL ) {
+ fprintf(Parser_h, "\tstatic SetWordType %s%s[%lu];\n", name, suffix,
+ NumWords(TokenNum-1)*sizeof(unsigned));
+ fprintf(Parser_c, "SetWordType %s::%s%s[%lu] = {",
+ CurrentClassName,
+ name,
+ suffix,
+ NumWords(TokenNum-1)*sizeof(unsigned));
+ }
+ else {
+ fprintf(Parser_c, "SetWordType %s::err%d[%lu] = {",
+ CurrentClassName,
+ esetnum,
+ NumWords(TokenNum-1)*sizeof(unsigned));
+ fprintf(Parser_h, "\tstatic SetWordType err%d[%lu];\n", esetnum,
+ NumWords(TokenNum-1)*sizeof(unsigned));
+ }
+
+ while ( p < endp )
+ {
+ if ( e > 1 ) fprintf(Parser_c, ", ");
+ DumpIntAsChars(Parser_c, "0x%x", *p++);
+ if ( e == 3 )
+ {
+ if ( p < endp ) fprintf(Parser_c, ",");
+ fprintf(Parser_c, "\n\t");
+ e=1;
+ }
+ else e++;
+ }
+ fprintf(Parser_c, "};\n");
+
+ return esetnum;
+}
+
+int
+#ifdef __USE_PROTOS
+DefErrSetForCC( set *f, int subst, char *name )
+#else
+DefErrSetForCC( f, subst, name )
+set *f;
+int subst; /* should be substitute error classes? */
+char *name;
+#endif
+{
+ return DefErrSetForCC1(0,f,subst,name, "_set");
+}
+
+void
+#ifdef __USE_PROTOS
+GenParser_c_Hdr(void)
+#else
+GenParser_c_Hdr()
+#endif
+{
+ int i,j;
+ TermEntry *te;
+ char * hasAkaName = NULL; /* MR23 */
+
+ hasAkaName = (char *) malloc(TokenNum+1); /* MR23 */
+ require(hasAkaName!=NULL, "Cannot alloc hasAkaName\n"); /* MR23 */
+ for (i = 0; i < TokenNum; i++) hasAkaName[i]='0'; /* MR23 */
+ hasAkaName[TokenNum] = 0; /* MR23 */
+
+ fprintf(Parser_c, "/*\n");
+ fprintf(Parser_c, " * %s: P a r s e r S u p p o r t\n", CurrentClassName);
+ fprintf(Parser_c, " *\n");
+ fprintf(Parser_c, " * Generated from:");
+ for (i=0; i<NumFiles; i++) fprintf(Parser_c, " %s", FileStr[i]);
+ fprintf(Parser_c, "\n");
+ fprintf(Parser_c, " *\n");
+ fprintf(Parser_c, " * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001\n");
+ fprintf(Parser_c, " * Parr Research Corporation\n");
+ fprintf(Parser_c, " * with Purdue University Electrical Engineering\n");
+ fprintf(Parser_c, " * with AHPCRC, University of Minnesota\n");
+ fprintf(Parser_c, " * ANTLR Version %s\n", Version);
+ fprintf(Parser_c, " */\n\n");
+
+ if ( FirstAction != NULL ) dumpAction(FirstAction,Parser_c, 0, -1, 0, 1); /* MR11 MR15b */
+
+ fprintf(Parser_c, "#define ANTLR_VERSION %s\n", VersionDef);
+
+ fprintf(Parser_c, "#include \"pcctscfg.h\"\n");
+ fprintf(Parser_c, "#include \"pccts_stdio.h\"\n");
+ fprintf(Parser_c, "#define ANTLR_SUPPORT_CODE\n");
+ if ( UserTokenDefsFile != NULL )
+ fprintf(Parser_c, "#include %s\n", UserTokenDefsFile);
+ else
+ fprintf(Parser_c, "#include \"%s\"\n", DefFileName);
+
+ fprintf(Parser_c, "#include \"%s.h\"\n\n", CurrentClassName);
+
+ fprintf(Parser_c, "const ANTLRChar *%s::tokenName(int tok) ", /* MR1 */
+ CurrentClassName); /* MR1 */
+ fprintf(Parser_c, " { return _token_tbl[tok]; }\n"); /* MR1 */ /* MR10 */
+ /* Dump a Parser::tokens for each automaton */
+ fprintf(Parser_c, "\nconst ANTLRChar *%s::_token_tbl[]={\n",
+ CurrentClassName); /* MR20 */
+ fprintf(Parser_c, "\t/* 00 */\t\"Invalid\"");
+
+ for (i=1; i<TokenNum-1; i++)
+ {
+ DAWDLE;
+ if ( i == EpToken ) continue;
+ /* remapped to invalid token? */
+ if ( TokenInd!=NULL && TokenInd[i]>=LastTokenCounted )
+ {
+ fprintf(Parser_c, ",\n\t/* %02d */\t\"invalid\"", i);
+ continue;
+ }
+ if ( TokenString(i) != NULL ) {
+ te=(TermEntry *) hash_get(Tname,TokenString(i)); /* MR11 */
+ if (te == NULL || te->akaString == NULL) { /* MR11 */
+ fprintf(Parser_c, ",\n\t/* %02d */\t\"%s\"", i, TokenString(i));
+ } else {
+ hasAkaName[i] = '1'; /* MR23 */
+ fprintf(Parser_c, ",\n\t/* %02d */\t\"%s\"", i, te->akaString); /* MR11 */
+ }
+ }
+ else
+ {
+ /* look in all lexclasses for the reg expr */
+ for (j=0; j<NumLexClasses; j++)
+ {
+ lexmode(j);
+ if ( ExprString(i) != NULL )
+ {
+ fprintf(Parser_c, ",\n\t/* %02d */\t", i);
+ dumpExpr(Parser_c, ExprString(i));
+ break;
+ }
+ }
+ if ( j>=NumLexClasses )
+ {
+ if ( UserDefdTokens )
+ {
+ fprintf(Parser_c, ",\n\t/* %02d */\t\"\"", i);
+ }
+ else
+ fatal_internal(eMsgd("No label or expr for token %d",i));
+ }
+ }
+ }
+ fprintf(Parser_c, "\n};\n");
+
+ /* Build constructors */
+ fprintf(Parser_c, "\n%s::", CurrentClassName);
+ fprintf(Parser_c, "%s(ANTLRTokenBuffer *input) : %s(input,%d,%d,%d,%lu)\n",
+ CurrentClassName,
+ (BaseClassName == NULL ? "ANTLRParser" : BaseClassName),
+ OutputLL_k,
+ FoundGuessBlk,
+ DemandLookahead,
+ NumWords(TokenNum-1)*sizeof(unsigned));
+ fprintf(Parser_c, "{\n");
+ fprintf(Parser_c, "\ttoken_tbl = _token_tbl;\n");
+ if (TraceGen) {
+ fprintf(Parser_c, "\ttraceOptionValueDefault=1;\t\t// MR10 turn trace ON\n");
+ } else {
+ fprintf(Parser_c, "\ttraceOptionValueDefault=0;\t\t// MR10 turn trace OFF\n");
+ };
+ fprintf(Parser_c, "}\n\n");
+ free ( (void *) hasAkaName);
+}
+
+void
+#ifdef __USE_PROTOS
+GenParser_h_Hdr(void)
+#else
+GenParser_h_Hdr()
+#endif
+{
+ int i;
+
+ fprintf(Parser_h, "/*\n");
+ fprintf(Parser_h, " * %s: P a r s e r H e a d e r \n", CurrentClassName);
+ fprintf(Parser_h, " *\n");
+ fprintf(Parser_h, " * Generated from:");
+ for (i=0; i<NumFiles; i++) fprintf(Parser_h, " %s", FileStr[i]);
+ fprintf(Parser_h, "\n");
+ fprintf(Parser_h, " *\n");
+ fprintf(Parser_h, " * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001\n");
+ fprintf(Parser_h, " * Parr Research Corporation\n");
+ fprintf(Parser_h, " * with Purdue University Electrical Engineering\n");
+ fprintf(Parser_h, " * with AHPCRC, University of Minnesota\n");
+ fprintf(Parser_h, " * ANTLR Version %s\n", Version);
+ fprintf(Parser_h, " */\n\n");
+
+ if ( FirstAction != NULL ) dumpAction( FirstAction, Parser_h, 0, -1, 0, 1); /* MR11 MR15b */
+
+ fprintf(Parser_h, "#ifndef %s_h\n", CurrentClassName);
+ fprintf(Parser_h, "#define %s_h\n\n", CurrentClassName);
+
+ fprintf(Parser_h, "#ifndef ANTLR_VERSION\n");
+ fprintf(Parser_h, "#define ANTLR_VERSION %s\n",VersionDef);
+ fprintf(Parser_h, "#endif\n\n");
+
+ if ( GenAST ) fprintf(Parser_h, "class ASTBase;\n");
+ if (TraceGen) {
+ fprintf(Parser_h,"#ifndef zzTRACE_RULES\n"); /* MR20 */
+ fprintf(Parser_h,"#define zzTRACE_RULES\n"); /* MR20 */
+ fprintf(Parser_h,"#endif\n"); /* MR22 */
+ };
+ fprintf(Parser_h, "#include \"%s\"\n\n", APARSER_H);
+
+ if ( HdrAction != NULL ) dumpAction( HdrAction, Parser_h, 0, -1, 0, 1);
+
+/* MR10 */ if (ClassDeclStuff == NULL) {
+/* MR10 */ fprintf(Parser_h, "class %s : public ANTLRParser {\n", CurrentClassName);
+/* MR10 */ } else {
+/* MR10 */ fprintf(Parser_h, "class %s %s {\n",CurrentClassName,ClassDeclStuff);
+/* MR10 */ };
+
+ fprintf(Parser_h, "public:\n"); /* MR1 */
+ fprintf(Parser_h, "\tstatic const ANTLRChar *tokenName(int tk);\n");/* MR1 */
+ fprintf(Parser_h, "\tenum { SET_SIZE = %i };\n",TokenNum-1); /* MR21 */
+ fprintf(Parser_h, "protected:\n");
+ fprintf(Parser_h, "\tstatic const ANTLRChar *_token_tbl[];\n"); /* MR20 */
+ fprintf(Parser_h, "private:\n");
+}
+
+/* Currently, this is only used in !GenCC mode */
+void
+#ifdef __USE_PROTOS
+GenErrHdr( void )
+#else
+GenErrHdr( )
+#endif
+{
+ int i, j;
+ TermEntry *te;
+
+ fprintf(ErrFile, "/*\n");
+ fprintf(ErrFile, " * A n t l r S e t s / E r r o r F i l e H e a d e r\n");
+ fprintf(ErrFile, " *\n");
+ fprintf(ErrFile, " * Generated from:");
+ for (i=0; i<NumFiles; i++) fprintf(ErrFile, " %s", FileStr[i]);
+ fprintf(ErrFile, "\n");
+ fprintf(ErrFile, " *\n");
+ fprintf(ErrFile, " * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001\n");
+ fprintf(ErrFile, " * Parr Research Corporation\n");
+ fprintf(ErrFile, " * with Purdue University Electrical Engineering\n");
+ fprintf(ErrFile, " * With AHPCRC, University of Minnesota\n");
+ fprintf(ErrFile, " * ANTLR Version %s\n", Version);
+ fprintf(ErrFile, " */\n\n");
+
+ if ( FirstAction != NULL ) dumpAction( FirstAction, ErrFile, 0, -1, 0, 1); /* MR11 MR15b */
+
+ fprintf(ErrFile, "#define ANTLR_VERSION %s\n", VersionDef);
+
+ fprintf(ErrFile, "#include \"pcctscfg.h\"\n");
+ fprintf(ErrFile, "#include \"pccts_stdio.h\"\n");
+ if ( strcmp(ParserName, DefaultParserName)!=0 )
+ fprintf(ErrFile, "#define %s %s\n", DefaultParserName, ParserName);
+ if ( strcmp(ParserName, DefaultParserName)!=0 )
+ fprintf(ErrFile, "#include \"%s\"\n", RemapFileName);
+ if ( HdrAction != NULL ) dumpAction( HdrAction, ErrFile, 0, -1, 0, 1 );
+ if ( FoundGuessBlk )
+ {
+ fprintf(ErrFile, "#define ZZCAN_GUESS\n");
+ fprintf(ErrFile, "#include \"pccts_setjmp.h\"\n");
+ }
+ if (TraceGen) {
+ fprintf(ErrFile,"#ifndef zzTRACE_RULES\n"); /* MR20 */
+ fprintf(ErrFile,"#define zzTRACE_RULES\n"); /* MR20 */
+ fprintf(ErrFile,"#endif\n"); /* MR22 */
+ };
+
+ if ( OutputLL_k > 1 ) fprintf(ErrFile, "#define LL_K %d\n", OutputLL_k);
+#ifdef DUM
+ if ( LexGen ) fprintf(ErrFile, "#define zzEOF_TOKEN %d\n", (TokenInd!=NULL?TokenInd[EofToken]:EofToken));
+#endif
+ fprintf(ErrFile, "#define zzSET_SIZE %lu\n", NumWords(TokenNum-1)*sizeof(unsigned));
+ if ( DemandLookahead ) fprintf(ErrFile, "#define DEMAND_LOOK\n");
+ fprintf(ErrFile, "#include \"antlr.h\"\n");
+ if ( GenAST ) fprintf(ErrFile, "#include \"ast.h\"\n");
+
+ if ( UserDefdTokens ) fprintf(ErrFile, "#include %s\n", UserTokenDefsFile);
+ /* still need this one as it has the func prototypes */
+ fprintf(ErrFile, "#include \"%s\"\n", DefFileName);
+ fprintf(ErrFile, "#include \"dlgdef.h\"\n");
+ fprintf(ErrFile, "#include \"err.h\"\n\n");
+
+ /* Dump a zztokens for each automaton */
+ if ( strcmp(ParserName, DefaultParserName)!=0 )
+ {
+ fprintf(ErrFile, "ANTLRChar *%s_zztokens[%d]={\n", ParserName, TokenNum-1);
+ }
+ else
+ {
+ fprintf(ErrFile, "ANTLRChar *zztokens[%d]={\n", TokenNum-1);
+ }
+ fprintf(ErrFile, "\t/* 00 */\t\"Invalid\"");
+ for (i=1; i<TokenNum-1; i++)
+ {
+ DAWDLE;
+ if ( i == EpToken ) continue;
+ /* remapped to invalid token? */
+ if ( TokenInd!=NULL && TokenInd[i]>=LastTokenCounted )
+ {
+ fprintf(ErrFile, ",\n\t/* %02d */\t\"invalid\"", i);
+ continue;
+ }
+ if ( TokenString(i) != NULL ) {
+ te=(TermEntry *) hash_get(Tname,TokenString(i)); /* MR11 */
+ if (te == NULL || te->akaString == NULL) { /* MR11 */
+ fprintf(ErrFile, ",\n\t/* %02d */\t\"%s\"", i, TokenString(i));
+ } else {
+ fprintf(ErrFile, ",\n\t/* %02d */\t\"%s\"", i, te->akaString); /* MR11 */
+ }
+ }
+ else
+ {
+ /* look in all lexclasses for the reg expr */
+ for (j=0; j<NumLexClasses; j++)
+ {
+ lexmode(j);
+ if ( ExprString(i) != NULL )
+ {
+ fprintf(ErrFile, ",\n\t/* %02d */\t", i);
+ dumpExpr(ErrFile, ExprString(i));
+ break;
+ }
+ }
+ if ( j>=NumLexClasses )
+ {
+ if ( UserDefdTokens )
+ {
+ fprintf(ErrFile, ",\n\t/* %02d */\t\"\"", i);
+ }
+ else
+ fatal_internal(eMsgd("No label or expr for token %d",i));
+ }
+ }
+ }
+ fprintf(ErrFile, "\n};\n");
+}
+
+void
+#ifdef __USE_PROTOS
+dumpExpr( FILE *f, char *e )
+#else
+dumpExpr( f, e )
+FILE *f;
+char *e;
+#endif
+{
+ while ( *e!='\0' )
+ {
+ if ( *e=='\\' && *(e+1)=='\\' )
+ {putc('\\', f); putc('\\', f); e+=2;}
+ else if ( *e=='\\' && *(e+1)=='"' )
+ {putc('\\', f); putc('"', f); e+=2;}
+ else if ( *e=='\\' ) {putc('\\', f); putc('\\', f); e++;}
+ else {putc(*e, f); e++;}
+ }
+}
+
+int
+#ifdef __USE_PROTOS
+isTermEntryTokClass(TermEntry *te)
+#else
+isTermEntryTokClass(te)
+TermEntry *te;
+#endif
+{
+ ListNode *t;
+ TCnode *p;
+ TermEntry *q;
+ char *tokstr;
+
+ if (tclasses == NULL) return 0;
+
+ for (t = tclasses->next; t!=NULL; t=t->next)
+ {
+ p = (TCnode *) t->elem;
+ tokstr = TokenString(p->tok);
+ lexmode(p->lexclass); /* switch to lexclass where tokclass is defined */
+ q = (TermEntry *) hash_get(Tname, tokstr);
+ if (q == te) return 1;
+ }
+ return 0;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/build.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/build.c
new file mode 100644
index 000000000..4eb3b02af
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/build.c
@@ -0,0 +1,813 @@
+/*
+ * build.c -- functions associated with building syntax diagrams.
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include "pcctscfg.h"
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#include "dlgdef.h"
+
+#define SetBlk(g, t, approx, first_set_symbol) { \
+ ((Junction *)g.left)->jtype = t; \
+ ((Junction *)g.left)->approx = approx; \
+ ((Junction *)g.left)->pFirstSetSymbol = first_set_symbol; \
+ ((Junction *)g.left)->end = (Junction *) g.right; \
+ ((Junction *)g.right)->jtype = EndBlk;}
+
+/* Add the parameter string 'parm' to the parms field of a block-type junction
+ * g.left points to the sentinel node on a block. i.e. g.left->p1 points to
+ * the actual junction with its jtype == some block-type.
+ */
+void
+#ifdef __USE_PROTOS
+addParm( Node *p, char *parm )
+#else
+addParm( p, parm )
+Node *p;
+char *parm;
+#endif
+{
+ char *q = (char *) malloc( strlen(parm) + 1 );
+ require(p!=NULL, "addParm: NULL object\n");
+ require(q!=NULL, "addParm: unable to alloc parameter\n");
+
+ strcpy(q, parm);
+ if ( p->ntype == nRuleRef )
+ {
+ ((RuleRefNode *)p)->parms = q;
+ }
+ else if ( p->ntype == nJunction )
+ {
+ ((Junction *)p)->parm = q; /* only one parameter allowed on subrules */
+ }
+ else fatal_internal("addParm: invalid node for adding parm");
+}
+
+/*
+ * Build an action node for the syntax diagram
+ *
+ * buildAction(ACTION) ::= --o-->ACTION-->o--
+ *
+ * Where o is a junction node.
+ */
+Graph
+#ifdef __USE_PROTOS
+buildAction( char *action, int file, int line, int is_predicate )
+#else
+buildAction( action, file, line, is_predicate )
+char *action;
+int file;
+int line;
+int is_predicate;
+#endif
+{
+ Junction *j1, *j2;
+ Graph g;
+ ActionNode *a;
+ require(action!=NULL, "buildAction: invalid action");
+
+ j1 = newJunction();
+ j2 = newJunction();
+ a = newActionNode();
+ a->action = (char *) malloc( strlen(action)+1 );
+ require(a->action!=NULL, "buildAction: cannot alloc space for action\n");
+ strcpy(a->action, action);
+ j1->p1 = (Node *) a;
+ a->next = (Node *) j2;
+ a->is_predicate = is_predicate;
+
+ if (is_predicate) {
+ PredEntry *predEntry;
+ char *t;
+ char *key;
+ char *u;
+ int inverted=0;
+
+ t=key=(char *)calloc(1,strlen(a->action)+1);
+
+ for (u=a->action; *u != '\0' ; u++) {
+ if (*u != ' ') {
+ if (t==key && *u=='!') {
+ inverted=!inverted;
+ } else {
+ *t++=*u;
+ };
+ };
+ };
+
+ *t='\0';
+
+
+ predEntry=(PredEntry *)hash_get(Pname,key);
+ a->predEntry=predEntry;
+ if (predEntry != NULL) a->inverted=inverted;
+ } else {
+/* MR12c */ char *strStart=a->action;
+/* MR12c */ char *strEnd;
+/* MR12c */ strEnd=strStart+strlen(strStart)-1;
+/* MR12c */ for ( ; strEnd >= strStart && isspace(*strEnd); strEnd--) *strEnd=0;
+/* MR12c */ while (*strStart != '\0' && isspace(*strStart)) strStart++;
+/* MR12c */ if (ci_strequ(strStart,"nohoist")) {
+/* MR12c */ a->noHoist=1;
+/* MR12c */ }
+ }
+
+ g.left = (Node *) j1; g.right = (Node *) j2;
+ a->file = file;
+ a->line = line;
+ a->rname = CurRule; /* MR10 */
+ return g;
+}
+
+/*
+ * Build a token node for the syntax diagram
+ *
+ * buildToken(TOKEN) ::= --o-->TOKEN-->o--
+ *
+ * Where o is a junction node.
+ */
+Graph
+#ifdef __USE_PROTOS
+buildToken( char *text )
+#else
+buildToken( text )
+char *text;
+#endif
+{
+ Junction *j1, *j2;
+ Graph g;
+ TokNode *t;
+ require(text!=NULL, "buildToken: invalid token name");
+
+ j1 = newJunction();
+ j2 = newJunction();
+ t = newTokNode();
+ t->altstart = CurAltStart;
+ if ( *text == '"' ) {t->label=FALSE; t->token = addTexpr( text );}
+ else {t->label=TRUE; t->token = addTname( text );}
+ j1->p1 = (Node *) t;
+ t->next = (Node *) j2;
+ g.left = (Node *) j1; g.right = (Node *) j2;
+ return g;
+}
+
+/*
+ * Build a wild-card node for the syntax diagram
+ *
+ * buildToken(TOKEN) ::= --o-->'.'-->o--
+ *
+ * Where o is a junction node.
+ */
+Graph
+#ifdef __USE_PROTOS
+buildWildCard( char *text )
+#else
+buildWildCard( text )
+char *text;
+#endif
+{
+ Junction *j1, *j2;
+ Graph g;
+ TokNode *t;
+ TCnode *w;
+ TermEntry *p;
+ require(text!=NULL, "buildWildCard: invalid token name");
+
+ j1 = newJunction();
+ j2 = newJunction();
+ t = newTokNode();
+
+ /* If the ref a wild card, make a token class for it */
+ if ( Tnum(WildCardString) == 0 )
+ {
+ w = newTCnode;
+ w->tok = addTname( WildCardString );
+ set_orel(w->tok, &imag_tokens);
+ set_orel(w->tok, &tokclasses);
+ WildCardToken = w->tok;
+ require((p=(TermEntry *)hash_get(Tname, WildCardString)) != NULL,
+ "hash table mechanism is broken");
+ p->classname = 1; /* entry is class name, not token */
+ p->tclass = w; /* save ptr to this tclass def */
+ list_add(&tclasses, (char *)w);
+ }
+ else {
+ p=(TermEntry *)hash_get(Tname, WildCardString);
+ require( p!= NULL, "hash table mechanism is broken");
+ w = p->tclass;
+ }
+
+ t->token = w->tok;
+ t->wild_card = 1;
+ t->tclass = w;
+
+ t->altstart = CurAltStart;
+ j1->p1 = (Node *) t;
+ t->next = (Node *) j2;
+ g.left = (Node *) j1; g.right = (Node *) j2;
+ return g;
+}
+
+void
+#ifdef __USE_PROTOS
+setUpperRange(TokNode *t, char *text)
+#else
+setUpperRange(t, text)
+TokNode *t;
+char *text;
+#endif
+{
+ require(t!=NULL, "setUpperRange: NULL token node");
+ require(text!=NULL, "setUpperRange: NULL token string");
+
+ if ( *text == '"' ) {t->upper_range = addTexpr( text );}
+ else {t->upper_range = addTname( text );}
+}
+
+/*
+ * Build a rule reference node of the syntax diagram
+ *
+ * buildRuleRef(RULE) ::= --o-->RULE-->o--
+ *
+ * Where o is a junction node.
+ *
+ * If rule 'text' has been defined already, don't alloc new space to store string.
+ * Set r->text to point to old copy in string table.
+ */
+Graph
+#ifdef __USE_PROTOS
+buildRuleRef( char *text )
+#else
+buildRuleRef( text )
+char *text;
+#endif
+{
+ Junction *j1, *j2;
+ Graph g;
+ RuleRefNode *r;
+ RuleEntry *p;
+ require(text!=NULL, "buildRuleRef: invalid rule name");
+
+ j1 = newJunction();
+ j2 = newJunction();
+ r = newRNode();
+ r->altstart = CurAltStart;
+ r->assign = NULL;
+ if ( (p=(RuleEntry *)hash_get(Rname, text)) != NULL ) r->text = p->str;
+ else r->text = mystrdup( text );
+ j1->p1 = (Node *) r;
+ r->next = (Node *) j2;
+ g.left = (Node *) j1; g.right = (Node *) j2;
+ return g;
+}
+
+/*
+ * Or two subgraphs into one graph via:
+ *
+ * Or(G1, G2) ::= --o-G1-o--
+ * | ^
+ * v |
+ * o-G2-o
+ *
+ * Set the altnum of junction starting G2 to 1 + altnum of junction starting G1.
+ * If, however, the G1 altnum is 0, make it 1 and then
+ * make G2 altnum = G1 altnum + 1.
+ */
+Graph
+#ifdef __USE_PROTOS
+Or( Graph g1, Graph g2 )
+#else
+Or( g1, g2 )
+Graph g1;
+Graph g2;
+#endif
+{
+ Graph g;
+ require(g1.left != NULL, "Or: invalid graph");
+ require(g2.left != NULL && g2.right != NULL, "Or: invalid graph");
+
+ ((Junction *)g1.left)->p2 = g2.left;
+ ((Junction *)g2.right)->p1 = g1.right;
+ /* set altnums */
+ if ( ((Junction *)g1.left)->altnum == 0 ) ((Junction *)g1.left)->altnum = 1;
+ ((Junction *)g2.left)->altnum = ((Junction *)g1.left)->altnum + 1;
+ g.left = g2.left;
+ g.right = g1.right;
+ return g;
+}
+
+/*
+ * Catenate two subgraphs
+ *
+ * Cat(G1, G2) ::= --o-G1-o-->o-G2-o--
+ * Cat(NULL,G2)::= --o-G2-o--
+ * Cat(G1,NULL)::= --o-G1-o--
+ */
+Graph
+#ifdef __USE_PROTOS
+Cat( Graph g1, Graph g2 )
+#else
+Cat( g1, g2 )
+Graph g1;
+Graph g2;
+#endif
+{
+ Graph g;
+
+ if ( g1.left == NULL && g1.right == NULL ) return g2;
+ if ( g2.left == NULL && g2.right == NULL ) return g1;
+ ((Junction *)g1.right)->p1 = g2.left;
+ g.left = g1.left;
+ g.right = g2.right;
+ return g;
+}
+
+/*
+ * Make a subgraph an optional block
+ *
+ * makeOpt(G) ::= --o-->o-G-o-->o--
+ * | ^
+ * v |
+ * o-------o
+ *
+ * Note that this constructs {A|B|...|Z} as if (A|B|...|Z|) was found.
+ *
+ * The node on the far right is added so that every block owns its own
+ * EndBlk node.
+ */
+Graph
+#ifdef __USE_PROTOS
+makeOpt( Graph g1, int approx, char * pFirstSetSymbol )
+#else
+makeOpt( g1, approx, pFirstSetSymbol )
+Graph g1;
+int approx;
+char * pFirstSetSymbol;
+#endif
+{
+ Junction *j1,*j2,*p;
+ Graph g;
+ require(g1.left != NULL && g1.right != NULL, "makeOpt: invalid graph");
+
+ j1 = newJunction();
+ j2 = newJunction();
+ ((Junction *)g1.right)->p1 = (Node *) j2; /* add node to G at end */
+
+ /* MR21
+ *
+ * There is code in genBlk which recognizes the node created
+ * by emptyAlt() as a special case and bypasses it. We don't
+ * want this to happen for the optBlk.
+ */
+
+ g = emptyAlt3(); /* MR21 */
+ if ( ((Junction *)g1.left)->altnum == 0 ) ((Junction *)g1.left)->altnum = 1;
+ ((Junction *)g.left)->altnum = ((Junction *)g1.left)->altnum + 1;
+ for(p=(Junction *)g1.left; p->p2!=NULL; p=(Junction *)p->p2)
+ {;} /* find last alt */
+ p->p2 = g.left; /* add optional alternative */
+ ((Junction *)g.right)->p1 = (Node *)j2; /* opt alt points to EndBlk */
+ g1.right = (Node *)j2;
+ SetBlk(g1, aOptBlk, approx, pFirstSetSymbol);
+ j1->p1 = g1.left; /* add generic node in front */
+ g.left = (Node *) j1;
+ g.right = g1.right;
+ return g;
+}
+
+/*
+ * Make a graph into subblock
+ *
+ * makeBlk(G) ::= --o-->o-G-o-->o--
+ *
+ * The node on the far right is added so that every block owns its own
+ * EndBlk node.
+ */
+Graph
+#ifdef __USE_PROTOS
+makeBlk( Graph g1, int approx, char * pFirstSetSymbol )
+#else
+makeBlk( g1, approx, pFirstSetSymbol )
+Graph g1;
+int approx;
+char * pFirstSetSymbol;
+#endif
+{
+ Junction *j,*j2;
+ Graph g;
+ require(g1.left != NULL && g1.right != NULL, "makeBlk: invalid graph");
+
+ j = newJunction();
+ j2 = newJunction();
+ ((Junction *)g1.right)->p1 = (Node *) j2; /* add node to G at end */
+ g1.right = (Node *)j2;
+ SetBlk(g1, aSubBlk, approx, pFirstSetSymbol);
+ j->p1 = g1.left; /* add node in front */
+ g.left = (Node *) j;
+ g.right = g1.right;
+
+ return g;
+}
+
+/*
+ * Make a subgraph into a loop (closure) block -- (...)*
+ *
+ * makeLoop(G) ::= |---|
+ * v |
+ * --o-->o-->o-G-o-->o--
+ * | ^
+ * v |
+ * o-----------o
+ *
+ * After making loop, always place generic node out front. It becomes
+ * the start of enclosing block. The aLoopBlk is the target of the loop.
+ *
+ * Loop blks have TWO EndBlk nodes--the far right and the node that loops back
+ * to the aLoopBlk node. Node with which we can branch past loop == aLoopBegin and
+ * one which is loop target == aLoopBlk.
+ * The branch-past (initial) aLoopBegin node has end
+ * pointing to the last EndBlk node. The loop-target node has end==NULL.
+ *
+ * Loop blocks have a set of locks (from 1..CLL_k) on the aLoopBlk node.
+ */
+Graph
+#ifdef __USE_PROTOS
+makeLoop( Graph g1, int approx, char * pFirstSetSymbol )
+#else
+makeLoop( g1, approx, pFirstSetSymbol)
+Graph g1;
+int approx;
+char * pFirstSetSymbol;
+#endif
+{
+ Junction *back, *front, *begin;
+ Graph g;
+ require(g1.left != NULL && g1.right != NULL, "makeLoop: invalid graph");
+
+ back = newJunction();
+ front = newJunction();
+ begin = newJunction();
+ g = emptyAlt3();
+ ((Junction *)g1.right)->p2 = g1.left; /* add loop branch to G */
+ ((Junction *)g1.right)->p1 = (Node *) back; /* add node to G at end */
+ ((Junction *)g1.right)->jtype = EndBlk; /* mark 1st EndBlk node */
+ ((Junction *)g1.left)->jtype = aLoopBlk; /* mark 2nd aLoopBlk node */
+ ((Junction *)g1.left)->end = (Junction *) g1.right;
+ ((Junction *)g1.left)->lock = makelocks();
+ ((Junction *)g1.left)->pred_lock = makelocks();
+ g1.right = (Node *) back;
+ begin->p1 = (Node *) g1.left;
+ g1.left = (Node *) begin;
+ begin->p2 = (Node *) g.left; /* make bypass arc */
+ ((Junction *)g.right)->p1 = (Node *) back;
+ SetBlk(g1, aLoopBegin, approx, pFirstSetSymbol);
+ front->p1 = g1.left; /* add node to front */
+ g1.left = (Node *) front;
+
+ return g1;
+}
+
+/*
+ * Make a subgraph into a plus block -- (...)+ -- 1 or more times
+ *
+ * makePlus(G) ::= |---|
+ * v |
+ * --o-->o-G-o-->o--
+ *
+ * After making loop, always place generic node out front. It becomes
+ * the start of enclosing block. The aPlusBlk is the target of the loop.
+ *
+ * Plus blks have TWO EndBlk nodes--the far right and the node that loops back
+ * to the aPlusBlk node.
+ *
+ * Plus blocks have a set of locks (from 1..CLL_k) on the aPlusBlk node.
+ */
+Graph
+#ifdef __USE_PROTOS
+makePlus( Graph g1, int approx, char * pFirstSetSymbol)
+#else
+makePlus( g1, approx, pFirstSetSymbol)
+Graph g1;
+int approx;
+char * pFirstSetSymbol;
+#endif
+{
+ int has_empty_alt_already = 0;
+ Graph g;
+ Junction *j2, *j3, *first_alt;
+ Junction *last_alt=NULL, *p;
+ require(g1.left != NULL && g1.right != NULL, "makePlus: invalid graph");
+
+ first_alt = (Junction *)g1.left;
+ j2 = newJunction();
+ j3 = newJunction();
+ if ( ((Junction *)g1.left)->altnum == 0 ) ((Junction *)g1.left)->altnum = 1;
+ ((Junction *)g1.right)->p2 = g1.left; /* add loop branch to G */
+ ((Junction *)g1.right)->p1 = (Node *) j2; /* add node to G at end */
+ ((Junction *)g1.right)->jtype = EndBlk; /* mark 1st EndBlk node */
+ g1.right = (Node *) j2;
+ SetBlk(g1, aPlusBlk, approx, pFirstSetSymbol);
+ ((Junction *)g1.left)->lock = makelocks();
+ ((Junction *)g1.left)->pred_lock = makelocks();
+ j3->p1 = g1.left; /* add node to front */
+ g1.left = (Node *) j3;
+
+ /* add an optional branch which is the "exit" branch of loop */
+ /* FIRST, check to ensure that there does not already exist
+ * an optional path.
+ */
+ /* find last alt */
+ for(p=first_alt; p!=NULL; p=(Junction *)p->p2)
+ {
+ if ( p->p1->ntype == nJunction &&
+ p->p1!=NULL &&
+ ((Junction *)p->p1)->jtype==Generic &&
+ ((Junction *)p->p1)->p1!=NULL &&
+ ((Junction *)((Junction *)p->p1)->p1)->jtype==EndBlk )
+ {
+ has_empty_alt_already = 1;
+ }
+ last_alt = p;
+ }
+ if ( !has_empty_alt_already )
+ {
+ require(last_alt!=NULL, "last_alt==NULL; bad (..)+");
+ g = emptyAlt();
+ last_alt->p2 = g.left;
+ ((Junction *)g.right)->p1 = (Node *) j2;
+
+ /* make sure lookahead computation ignores this alt for
+ * FIRST("(..)+"); but it's still used for computing the FIRST
+ * of each alternative.
+ */
+ ((Junction *)g.left)->ignore = 1;
+ }
+
+ return g1;
+}
+
+/*
+ * Return an optional path: --o-->o--
+ */
+
+Graph
+#ifdef __USE_PROTOS
+emptyAlt( void )
+#else
+emptyAlt( )
+#endif
+{
+ Junction *j1, *j2;
+ Graph g;
+
+ j1 = newJunction();
+ j2 = newJunction();
+ j1->p1 = (Node *) j2;
+ g.left = (Node *) j1;
+ g.right = (Node *) j2;
+
+ return g;
+}
+
+/* MR21
+ *
+ * There is code in genBlk which recognizes the node created
+ * by emptyAlt() as a special case and bypasses it. We don't
+ * want this to happen for the optBlk.
+ */
+
+Graph
+#ifdef __USE_PROTOS
+emptyAlt3( void )
+#else
+emptyAlt3( )
+#endif
+{
+ Junction *j1, *j2, *j3;
+ Graph g;
+
+ j1 = newJunction();
+ j2 = newJunction();
+ j3 = newJunction();
+ j1->p1 = (Node *) j2;
+ j2->p1 = (Node *) j3;
+ g.left = (Node *) j1;
+ g.right = (Node *) j3;
+
+ return g;
+}
+
+/* N o d e A l l o c a t i o n */
+
+TokNode *
+#ifdef __USE_PROTOS
+newTokNode( void )
+#else
+newTokNode( )
+#endif
+{
+ static TokNode *FreeList = NULL;
+ TokNode *p, *newblk;
+
+ if ( FreeList == NULL )
+ {
+ newblk = (TokNode *)calloc(TokenBlockAllocSize, sizeof(TokNode));
+ if ( newblk == NULL )
+ fatal_internal(eMsg1("out of memory while building rule '%s'",CurRule));
+ for (p=newblk; p<&(newblk[TokenBlockAllocSize]); p++)
+ {
+ p->next = (Node *)FreeList; /* add all new token nodes to FreeList */
+ FreeList = p;
+ }
+ }
+ p = FreeList;
+ FreeList = (TokNode *)FreeList->next;/* remove a TokNode node */
+ p->next = NULL; /* NULL the ptr we used */
+ memset( (char *) p, 0, sizeof(TokNode)); /* MR10 */
+ p->ntype = nToken;
+ p->rname = CurRule;
+ p->file = CurFile;
+ p->line = zzline;
+ p->altstart = NULL;
+
+ return p;
+}
+
+RuleRefNode *
+#ifdef __USE_PROTOS
+newRNode( void )
+#else
+newRNode( )
+#endif
+{
+ static RuleRefNode *FreeList = NULL;
+ RuleRefNode *p, *newblk;
+
+ if ( FreeList == NULL )
+ {
+ newblk = (RuleRefNode *)calloc(RRefBlockAllocSize, sizeof(RuleRefNode));
+ if ( newblk == NULL )
+ fatal_internal(eMsg1("out of memory while building rule '%s'",CurRule));
+ for (p=newblk; p<&(newblk[RRefBlockAllocSize]); p++)
+ {
+ p->next = (Node *)FreeList; /* add all new rref nodes to FreeList */
+ FreeList = p;
+ }
+ }
+ p = FreeList;
+ FreeList = (RuleRefNode *)FreeList->next;/* remove a Junction node */
+ p->next = NULL; /* NULL the ptr we used */
+ memset( (char *) p, 0, sizeof(RuleRefNode)); /* MR10 */
+ p->ntype = nRuleRef;
+ p->rname = CurRule;
+ p->file = CurFile;
+ p->line = zzline;
+ p->astnode = ASTinclude;
+ p->altstart = NULL;
+
+ return p;
+}
+
+static int junctionSeqNumber=0; /* MR10 */
+
+Junction *
+#ifdef __USE_PROTOS
+newJunction( void )
+#else
+newJunction( )
+#endif
+{
+ static Junction *FreeList = NULL;
+ Junction *p, *newblk;
+
+ if ( FreeList == NULL )
+ {
+ newblk = (Junction *)calloc(JunctionBlockAllocSize, sizeof(Junction));
+ if ( newblk == NULL )
+ fatal_internal(eMsg1("out of memory while building rule '%s'",CurRule));
+ for (p=newblk; p<&(newblk[JunctionBlockAllocSize]); p++)
+ {
+ p->p1 = (Node *)FreeList; /* add all new Junction nodes to FreeList */
+ FreeList = p;
+ }
+ }
+ p = FreeList;
+ FreeList = (Junction *)FreeList->p1;/* remove a Junction node */
+ p->p1 = NULL; /* NULL the ptr we used */
+ memset( (char *) p, 0, sizeof(Junction)); /* MR10 */
+ p->ntype = nJunction;
+ p->visited = 0;
+ p->jtype = Generic;
+ p->rname = CurRule;
+ p->file = CurFile;
+ p->line = zzline;
+ p->exception_label = NULL;
+ p->fset = (set *) calloc(CLL_k+1, sizeof(set));
+ require(p->fset!=NULL, "cannot allocate fset in newJunction");
+ p->seq=++junctionSeqNumber; /* MR10 */
+
+ return p;
+}
+
+ActionNode *
+#ifdef __USE_PROTOS
+newActionNode( void )
+#else
+newActionNode( )
+#endif
+{
+ static ActionNode *FreeList = NULL;
+ ActionNode *p, *newblk;
+
+ if ( FreeList == NULL )
+ {
+ newblk = (ActionNode *)calloc(ActionBlockAllocSize, sizeof(ActionNode));
+ if ( newblk == NULL )
+ fatal_internal(eMsg1("out of memory while building rule '%s'",CurRule));
+ for (p=newblk; p<&(newblk[ActionBlockAllocSize]); p++)
+ {
+ p->next = (Node *)FreeList; /* add all new Action nodes to FreeList */
+ FreeList = p;
+ }
+ }
+ p = FreeList;
+ FreeList = (ActionNode *)FreeList->next;/* remove an Action node */
+ memset( (char *) p, 0, sizeof(ActionNode)); /* MR10 */
+ p->ntype = nAction;
+ p->next = NULL; /* NULL the ptr we used */
+ p->done = 0;
+ p->pred_fail = NULL;
+ p->guardpred = NULL;
+ p->ampersandPred = NULL;
+ return p;
+}
+
+/*
+ * allocate the array of locks (1..CLL_k) used to inhibit infinite recursion.
+ * Infinite recursion can occur in (..)* blocks, FIRST calcs and FOLLOW calcs.
+ * Therefore, we need locks on aLoopBlk, RuleBlk, EndRule nodes.
+ *
+ * if ( lock[k]==TRUE ) then we have been here before looking for k tokens
+ * of lookahead.
+ */
+char *
+#ifdef __USE_PROTOS
+makelocks( void )
+#else
+makelocks( )
+#endif
+{
+ char *p = (char *) calloc(CLL_k+1, sizeof(char));
+ require(p!=NULL, "cannot allocate lock array");
+
+ return p;
+}
+
+#if 0
+** #ifdef __USE_PROTOS
+** void my_memset(char *p,char value,int count)
+** #else
+** void my_memset(p,value,count)
+** char *p;
+** char value;
+** int count;
+** #endif
+** {
+** int i;
+**
+** for (i=0; i<count; i++) {
+** p[i]=value;
+** };
+** }
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpcycles.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpcycles.c
new file mode 100644
index 000000000..8156159f7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpcycles.c
@@ -0,0 +1,67 @@
+#include <stdio.h>
+#include <ctype.h>
+
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+
+void
+#ifdef __USE_PROTOS
+dumpcycles(void)
+#else
+dumpcycles()
+#endif
+{
+ Cycle *c;
+ CacheEntry *f;
+ ListNode *p;
+ int i=0;
+ int k;
+ int degree;
+
+ for (k=1; k <= CLL_k; k++) {
+ if (Cycles[k] == NULL) continue;
+
+ for (p = Cycles[k]->next; p!=NULL; p=p->next) {
+ c = (Cycle *) p->elem;
+ degree=set_deg(c->cyclicDep);
+ fprintf(stderr,"Cycle %d: (degree %d) %s -->\n", i++, degree, RulePtr[c->croot]->rname);
+ fprintf(stderr," *self*\n");
+ MR_dumpRuleSet(c->cyclicDep);
+ fprintf(stderr,"\n");
+ f = (CacheEntry *)
+ hash_get(Fcache,Fkey(RulePtr[c->croot]->rname,'o',k));
+ if (f == NULL) {
+ fprintf(stderr," *** FOLLOW(%s) must be in cache but isn't ***\n",
+ RulePtr[c->croot]->rname);
+ };
+ };
+ };
+}
+
+void
+#ifdef __USE_PROTOS
+dumpfostack(int k)
+#else
+dumpfostack(k)
+int k;
+#endif
+{
+ int i=0;
+ int *pi;
+
+ fprintf(stderr,"\n");
+ if (FoStack[k] == NULL) {
+ fprintf(stderr,"FoStack[%d] is null\n",k);
+ };
+ if (FoTOS[k] == NULL) {
+ fprintf(stderr,"FoTOS[%d] is null\n",k);
+ }
+ if (FoTOS[k] != NULL && FoStack[k] != NULL) {
+ for (pi=FoStack[k]; pi <= FoTOS[k]; pi++) {
+ i++;
+ fprintf(stderr,"#%d rule %d %s\n",i,*pi,RulePtr[*pi]->rname);
+ }
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpnode.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpnode.c
new file mode 100644
index 000000000..2a34c6fcd
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpnode.c
@@ -0,0 +1,423 @@
+#include <stdio.h>
+#include <ctype.h>
+
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+
+#ifdef __USE_PROTOS
+void dumpset1(set s)
+#else
+void dumpset1(s)
+ set s;
+#endif
+{
+ if (set_nil(s)) {
+ fprintf(stderr,"{}");
+ } else {
+ s_fprT(stderr,s);
+ };
+}
+
+#ifdef __USE_PROTOS
+void dumpset(set s)
+#else
+void dumpset(s)
+ set s;
+#endif
+{
+ dumpset1(s);
+ fprintf(stderr,"\n");
+}
+
+#ifdef __USE_PROTOS
+int isEndRule(Node * p)
+#else
+int isEndRule(p)
+ Node * p;
+#endif
+{
+ int result=0;
+ if ( p->ntype == nJunction &&
+ ( (Junction *) p)->jtype == EndRule) {
+ result=1;
+ };
+ return result;
+}
+
+#ifdef __USE_PROTOS
+void dumppred1(int depth,Predicate *p)
+#else
+void dumppred1(depth,p)
+ int depth;
+ Predicate *p;
+#endif
+{
+ int i;
+ int k;
+
+ for (i=0; i<depth ; i++) {
+ fprintf(stderr," ");
+ };
+ if (p->expr == PRED_AND_LIST ||
+ p->expr == PRED_OR_LIST) {
+ fprintf(stderr," %s", (p->expr == NULL ? "null expr" : p->expr));
+ if (p->inverted) fprintf(stderr," predicate inverted !");
+ if (p->redundant) {
+ fprintf(stderr," Redundant!");
+ };
+ if (p->isConst) fprintf(stderr," const %d !",p->constValue);
+ fprintf(stderr,"\n");
+ } else {
+ fprintf(stderr,"predicate k=%d",p->k);
+ k=set_int(p->completionSet);
+ if (k >= 0) {
+ fprintf(stderr," Incomplete Set=%d !",k);
+ };
+ k=set_int(p->completionTree);
+ if (k >= 0) {
+ fprintf(stderr," Incomplete Tree=%d !",k);
+ };
+ if (p->redundant) {
+ fprintf(stderr," Redundant!");
+ };
+ fprintf(stderr," \"%s\" (%x)", (p->expr == NULL ? "null expr" : p->expr) ,p);
+ if (p->source != NULL) {
+ fprintf(stderr,"line %d",p->source->line);
+ };
+ if (p->inverted) fprintf(stderr," predicate inverted !");
+ fprintf(stderr,"\n");
+ for (i=0; i<depth ; i++) {
+ fprintf(stderr," ");
+ };
+ fprintf(stderr,"scontext: ");
+ dumpset(p->scontext[1]);
+ for (i=0; i<depth ; i++) {
+ fprintf(stderr," ");
+ };
+ fprintf(stderr,"tcontext: ");
+ preorder(p->tcontext);
+ fprintf(stderr,"\n");
+ };
+ fprintf(stderr,"\n");
+ if (p->down != NULL) {
+ dumppred1(depth+1,p->down);
+ };
+ if (p->right != NULL) {
+ dumppred1(depth,p->right);
+ };
+}
+
+#ifdef __USE_PROTOS
+void dumppred(Predicate *p)
+#else
+void dumppred(p)
+ Predicate *p;
+#endif
+{
+ fprintf(stderr,"---------------------------------\n");
+ dumppred1(0,p);
+ fprintf(stderr,"\n");
+}
+
+#ifdef __USE_PROTOS
+void dumppredtree(Predicate *p)
+#else
+void dumppredtree(p)
+ Predicate *p;
+#endif
+{
+ fprintf(stderr,"predicate k=%d \"%s\" line %d\n",p->k,p->expr,p->source->line);
+ dumpset(p->scontext[1]);
+}
+
+#ifdef __USE_PROTOS
+void dumppredexpr(Predicate *p)
+#else
+void dumppredexpr(p)
+ Predicate *p;
+#endif
+{
+ fprintf(stderr," pred expr \"%s\"\n",p->expr);
+}
+
+#ifdef __USE_PROTOS
+void dt(Tree *t)
+#else
+void dt(t)
+ Tree *t;
+#endif
+{
+ MR_dumpTreeF(stderr,0,t,5);
+}
+
+#ifdef __USE_PROTOS
+void d(Node * p)
+#else
+void d(p)
+ Node * p;
+#endif
+{
+
+ Junction *j;
+ RuleRefNode *r;
+ TokNode *t;
+ ActionNode *a;
+
+ if (p==NULL) {
+ fprintf(stderr,"dumpNode: Node is NULL");
+ return;
+ };
+
+ switch (p->ntype) {
+ case nJunction :
+ j = (Junction *) p;
+ fprintf(stderr, "Junction (#%d in rule %s line %d) ",j->seq,j->rname,j->line);
+ if (j->guess) fprintf(stderr,"guess block ");
+ switch (j->jtype ) {
+ case aSubBlk :
+ fprintf(stderr,"aSubBlk");
+ break;
+ case aOptBlk :
+ fprintf(stderr,"aOptBlk");
+ break;
+ case aLoopBegin :
+ fprintf(stderr,"aLoopBeginBlk");
+ break;
+ case aLoopBlk :
+ fprintf(stderr,"aLoopBlk");
+ break;
+ case aPlusBlk :
+ fprintf(stderr,"aPlusBlk");
+ break;
+ case EndBlk :
+ fprintf(stderr,"EndBlk");
+ break;
+ case RuleBlk :
+ fprintf(stderr,"RuleBlk");
+ break;
+ case Generic :
+ fprintf(stderr,"Generic");
+ break;
+ case EndRule :
+ fprintf(stderr,"EndRule");
+ break;
+ };
+ if (j->halt) fprintf(stderr," halt!");
+ if (j->p1) fprintf(stderr," p1 valid");
+ if (j->p2) {
+ if (j->p2->ntype == nJunction) {
+ fprintf(stderr," (p2=#%d)",( (Junction *) j->p2)->seq);
+ } else {
+ fprintf(stderr," (p2 valid)");
+ };
+ };
+ if (j->ignore) fprintf(stderr, " ignore/plus-block-bypass");
+ if (j->fset != NULL && set_deg(*j->fset) != 0) {
+ fprintf(stderr,"\nfset:\n");
+ dumpset(*j->fset);
+ };
+ if (j->ftree != NULL) {
+ fprintf(stderr,"\nftree:\n");
+ preorder(j->ftree);
+ };
+ fprintf(stderr,"\n");
+ break;
+ case nRuleRef :
+ r = (RuleRefNode *) p;
+ fprintf(stderr, "RuleRefNode (in rule %s line %d) to rule %s\n", r->rname,r->line,r->text);
+ break;
+ case nToken :
+ t = (TokNode *) p;
+ fprintf(stderr, "TokNode (in rule %s line %d) token %s\n",t->rname,t->line,TerminalString(t->token));
+ break;
+ case nAction :
+ a =(ActionNode *) p;
+ if (a->is_predicate) {
+ fprintf(stderr, "Predicate (in rule %s line %d) %s",a->rname,a->line,a->action);
+ if (a->inverted) fprintf(stderr," action inverted !");
+ if (a->guardpred != NULL) {
+ fprintf(stderr," guarded");
+ dumppredexpr(a->guardpred);
+ if (a->ampersandPred) {
+ fprintf(stderr," \"&&\" style");
+ } else {
+ fprintf(stderr," \"=>\" style");
+ };
+ };
+ if (a->predEntry != NULL) fprintf(stderr," predEntry \"%s\" ",a->predEntry->str);
+ fprintf(stderr,"\n");
+ } else if (a->init_action) {
+ fprintf(stderr, "Init-Action (in rule %s line %d) %s\n",a->rname,a->line,a->action);
+ } else {
+ fprintf(stderr, "Action (in rule %s line %d) %s\n",a->rname,a->line,a->action);
+ };
+ break;
+ };
+}
+
+#ifdef __USE_PROTOS
+Node * dp1(Node * p)
+#else
+Node * dp1(p)
+ Node * p;
+#endif
+{
+ Node *result=NULL;
+
+ if (p->ntype == nJunction) {
+ result=( (Junction *) p )->p1;
+ d(result);
+ } else {
+ fprintf(stderr,"dp1: Not a Junction node");
+ };
+ return result;
+}
+
+#ifdef __USE_PROTOS
+Node * dp2(Node * p)
+#else
+Node * dp2(p)
+ Node * p;
+#endif
+{
+ Node *result=NULL;
+
+ if (p->ntype == nJunction) {
+ result=( (Junction *) p )->p2;
+ d(result);
+ } else {
+ fprintf(stderr,"dp2: Not a Junction node");
+ };
+ return result;
+}
+
+#ifdef __USE_PROTOS
+Node * dn(Node * p)
+#else
+Node * dn(p)
+ Node * p;
+#endif
+
+{
+ Node *result=NULL;
+
+ if (p->ntype == nRuleRef) {
+ result=( (RuleRefNode *)p )->next;
+ } else if (p->ntype == nAction) {
+ result=( (ActionNode *)p )->next;
+ } else if (p->ntype == nToken) {
+ result=( (TokNode *)p )->next;
+ } else {
+ fprintf(stderr,"No next field: Neither a RuleRefNode, ActionNode, nor TokNode");
+ };
+ if (result != NULL) d(result);
+ return result;
+}
+
+#ifdef __USE_PROTOS
+void df(Node * p)
+#else
+void df(p)
+ Node * p;
+#endif
+{
+ int count=0;
+ Node *next;
+
+ fprintf(stderr,"\n#%d ",++count);
+ d(p);
+
+ for (next=p; next != NULL && !isEndRule(next) ; ) {
+ fprintf(stderr,"#%d ",++count);
+ if (next->ntype == nJunction) {
+ next=dp1(next);
+ } else {
+ next=dn(next);
+ };
+ };
+}
+
+#ifdef __USE_PROTOS
+Node * dfn(Node * p,int target)
+#else
+Node * dfn(p,target)
+ Node * p;
+ int target;
+#endif
+{
+ Node *result=NULL;
+ int count=0;
+ Node *next;
+
+ fprintf(stderr,"#%d ",++count);
+ d(p);
+
+ for (next=p; next != NULL && !isEndRule(next) ; ) {
+ fprintf(stderr,"#%d ",++count);
+ if (next->ntype == nJunction) {
+ next=dp1(next);
+ } else {
+ next=dn(next);
+ };
+ if (count == target) {
+ result=next;
+ break;
+ };
+ };
+ return result;
+}
+
+
+static int findnodeMatch;
+
+#ifdef __USE_PROTOS
+Junction *findnode1(Node *n)
+#else
+Junction *findnode1(n)
+ Node *n;
+#endif
+{
+ Node *next;
+ Junction *j;
+ Junction *match;
+
+ if (n == NULL) return NULL;
+ if (n->ntype == nJunction) {
+ j=(Junction *) n;
+ if (j->seq == findnodeMatch) return j;
+ if (j->jtype == EndRule) return NULL;
+ if (j->jtype != RuleBlk && j->jtype != EndBlk) {
+ if (j->p2 != NULL && !j->ignore) {
+ match=findnode1(j->p2);
+ if (match != NULL) return match;
+ };
+ };
+ };
+ next=MR_advance(n);
+ return findnode1(next);
+}
+
+#ifdef __USE_PROTOS
+Junction *findnode(int match)
+#else
+Junction *findnode(match)
+ int match;
+#endif
+{
+ Junction *j;
+ Junction *result=NULL;
+
+ findnodeMatch=match;
+
+ for (j=SynDiag; j != NULL; j=(Junction *)j->p2) {
+ require (j->ntype == nJunction && j->jtype == RuleBlk,"Not a rule block");
+ result=findnode1( (Node *) j);
+ if (result != NULL) break;
+ };
+ if (result != NULL) {
+ d( (Node *) result);
+ };
+ return result;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/egman.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/egman.c
new file mode 100644
index 000000000..ba1384dab
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/egman.c
@@ -0,0 +1,328 @@
+/*
+ * egman.c
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33MR10
+ * 2001
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#include "proto.h"
+
+static ExceptionGroup **egArray=NULL; /* ExceptionGroup by BlkLevel */
+static LabelEntry **leArray=NULL; /* LabelEntry by BlkLevel */
+static Junction **altArray=NULL; /* start of alternates */
+static int arraySize=0;
+static int highWater=0;
+static ExceptionGroup *lastEG=NULL; /* used in altFixup() */
+static int lastBlkLevel=0; /* used in altFixup() */
+
+#ifdef __USE_PROTOS
+static void arrayCheck(void);
+#else
+static void arrayCheck();
+#endif
+
+/* Called to add an exception group for an alternative EG */
+
+#ifdef __USE_PROTOS
+void egAdd(ExceptionGroup * eg)
+#else
+void egAdd(eg)
+ExceptionGroup *eg;
+#endif
+{
+ int i;
+
+ ExceptionGroup *nextEG;
+ ExceptionGroup *innerEG;
+
+ LabelEntry *nextLE;
+ LabelEntry *innerLE;
+
+ Junction *nextAlt;
+ Junction *innerAlt;
+
+ lastEG=eg;
+ lastBlkLevel=BlkLevel;
+
+ arrayCheck();
+ eg->pendingLink=egArray[BlkLevel];
+ egArray[BlkLevel]=eg;
+
+ /* EG for alternates already have their altID filled in */
+
+ for (i=BlkLevel+1; i<=highWater ; i++) {
+ for (innerEG=egArray[i]; innerEG != NULL ; innerEG=nextEG) {
+ nextEG=innerEG->pendingLink;
+ innerEG->pendingLink=NULL;
+ innerEG->outerEG=eg;
+ };
+ egArray[i]=NULL;
+ };
+
+ /*
+ * for patching up the LabelEntry you might use an EG for the
+ * current alternative - unlike patching up an alternative EG
+ * i.e. start the loop at BlkLevel rather than (BlkLevel+1)
+ * fill it in only if the EG and the LE are for the very
+ * same alternative if they're at the same BlkLevel
+ * it's easier to leave the LE on this list (filled in) rather than
+ * trying to selectively remove it. It will eventually be
+ * removed anyway when the BlkLevel gets small enough.
+ */
+
+ for (i=BlkLevel; i<=highWater ; i++) {
+ for (innerLE=leArray[i]; innerLE != NULL ; innerLE=nextLE) {
+ nextLE=innerLE->pendingLink;
+ if (BlkLevel != i ||
+ innerLE->curAltNum == CurAltNum_array[BlkLevel]) {
+ if (innerLE->outerEG == NULL) {
+ innerLE->outerEG=eg;
+ };
+ };
+ };
+ if (BlkLevel != i) leArray[i]=NULL;
+ };
+
+/*
+ * For the start of alternatives it is necessary to make a
+ * distinction between the exception group for the current
+ * alternative and the "fallback" EG for the block which
+ * contains the alternative
+ *
+ * The fallback outerEG is used to handle the case where
+ * no alternative of a block matches. In that case the
+ * signal is "NoViableAlt" (or "NoSemViableAlt" and the
+ * generator needs the EG of the block CONTAINING the
+ * current one.
+ *
+ * rule: ( ( ( a
+ * | b
+ * )
+ * | c
+ * )
+ * | d
+ * );
+ */
+
+ for (i=BlkLevel; i <= highWater ; i++) {
+ for (innerAlt=altArray[i]; innerAlt != NULL ; innerAlt=nextAlt) {
+ nextAlt=innerAlt->pendingLink;
+
+ /* first fill in the EG for the current alternative */
+ /* but leave it on the list in order to get the fallback EG */
+ /* if the EG is at the same LEVEL as the alternative then */
+ /* fill it in only if in the very same alternative */
+ /* */
+ /* rule: ( a */
+ /* | b */
+ /* | c exception ... */
+ /* ) */
+ /* */
+ /* if the EG is outside the alternative (e.g. BlkLevel < i) */
+ /* then it doesn't matter about the alternative */
+ /* */
+ /* rule: ( a */
+ /* | b */
+ /* | c */
+ /* ) exception ... */
+ /* */
+
+#if 0
+ printf("BlkLevel=%d i=%d altnum=%d CurAltNum=%d altID=%s\n",
+ BlkLevel,i,innerAlt->curAltNum,CurAltNum_array[BlkLevel],eg->altID);
+#endif
+ if (BlkLevel != i ||
+ innerAlt->curAltNum == CurAltNum_array[BlkLevel]) {
+ if (innerAlt->exception_label == NULL) {
+ innerAlt->exception_label=eg->altID;
+ };
+ };
+
+ /* occurs at a later pass then for the exception_label */
+ /* if an outerEG has been found then fill in the outer EG */
+ /* remove if from the list when the BlkLevel gets smaller */
+
+ if (BlkLevel != i) {
+ if (innerAlt->outerEG == NULL) {
+ innerAlt->outerEG=eg;
+ };
+ };
+ };
+ if (BlkLevel != i) altArray[i]=NULL;
+ };
+}
+
+#ifdef __USE_PROTOS
+void leAdd(LabelEntry * le)
+#else
+void leAdd(le)
+LabelEntry *le;
+#endif
+
+{
+ arrayCheck();
+ le->pendingLink=leArray[BlkLevel];
+ le->curAltNum=CurAltNum_array[BlkLevel];
+ leArray[BlkLevel]=le;
+}
+
+#ifdef __USE_PROTOS
+void altAdd(Junction *alt)
+#else
+void altAdd(alt)
+Junction *alt;
+#endif
+
+{
+ arrayCheck();
+#if 0
+ printf("BlkLevel=%d CurAltNum=%d\n",
+ BlkLevel,CurAltNum_array[BlkLevel]);
+#endif
+ alt->curAltNum=CurAltNum_array[BlkLevel];
+ alt->pendingLink=altArray[BlkLevel];
+ altArray[BlkLevel]=alt;
+}
+
+static void
+#ifdef __USE_PROTOS
+arrayCheck(void)
+#else
+arrayCheck()
+#endif
+{
+ ExceptionGroup **egArrayNew;
+ LabelEntry **leArrayNew;
+ Junction **altArrayNew;
+ int arraySizeNew;
+ int i;
+
+ if (BlkLevel > highWater) highWater=BlkLevel;
+
+ if (BlkLevel >= arraySize) {
+ arraySizeNew=BlkLevel+5; /* MR20 */
+ egArrayNew=(ExceptionGroup **)
+ calloc(arraySizeNew,sizeof(ExceptionGroup *));
+ leArrayNew=(LabelEntry **)
+ calloc(arraySizeNew,sizeof(LabelEntry *));
+ altArrayNew=(Junction **)
+ calloc(arraySizeNew,sizeof(Junction *));
+ for (i=0; i<arraySize ; i++) {
+ egArrayNew[i]=egArray[i];
+ leArrayNew[i]=leArray[i];
+ altArrayNew[i]=altArray[i];
+ };
+ arraySize=arraySizeNew;
+ if (egArray != NULL) free( (char *) egArray);
+ if (leArray != NULL) free( (char *) leArray);
+ if (altArray != NULL) free( (char *) altArray);
+ egArray=egArrayNew;
+ leArray=leArrayNew;
+ altArray=altArrayNew;
+ };
+}
+
+/* always call leFixup() BEFORE egFixup() */
+
+void
+#ifdef __USE_PROTOS
+egFixup(void)
+#else
+egFixup()
+#endif
+{
+ int i;
+ ExceptionGroup *nextEG;
+ ExceptionGroup *innerEG;
+
+ for (i=1; i<=highWater ; i++) {
+ for (innerEG=egArray[i]; innerEG != NULL ; innerEG=nextEG) {
+ nextEG=innerEG->pendingLink;
+ innerEG->pendingLink=NULL;
+ };
+ egArray[i]=NULL;
+ };
+ lastEG=NULL;
+ lastBlkLevel=0;
+}
+
+/* always call leFixup() BEFORE egFixup() */
+
+#ifdef __USE_PROTOS
+void leFixup(void)
+#else
+void leFixup()
+#endif
+{
+
+ int i;
+ LabelEntry *nextLE;
+ LabelEntry *innerLE;
+
+ for (i=BlkLevel; i<=highWater ; i++) {
+ for (innerLE=leArray[i]; innerLE != NULL ; innerLE=nextLE) {
+ nextLE=innerLE->pendingLink;
+ innerLE->pendingLink=NULL;
+ };
+ leArray[i]=NULL;
+ };
+}
+
+/* always call altFixup() BEFORE egFixup() */
+
+#ifdef __USE_PROTOS
+void altFixup(void)
+#else
+void altFixup()
+#endif
+{
+
+ int i;
+ Junction *nextAlt;
+ Junction *innerAlt;
+
+ for (i=BlkLevel; i<=highWater ; i++) {
+ for (innerAlt=altArray[i]; innerAlt != NULL ; innerAlt=nextAlt) {
+
+ /* if an outerEG has been found then fill in the outer EG */
+
+ if (lastBlkLevel <= i) {
+ if (innerAlt->outerEG == NULL) {
+ innerAlt->outerEG=lastEG;
+ };
+ };
+ nextAlt=innerAlt->pendingLink;
+ innerAlt->pendingLink=NULL;
+ };
+ altArray[i]=NULL;
+ };
+}
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/err.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/err.c
new file mode 100644
index 000000000..ca239398c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/err.c
@@ -0,0 +1,538 @@
+/*
+ * A n t l r S e t s / E r r o r F i l e H e a d e r
+ *
+ * Generated from: antlr.g
+ *
+ * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001
+ * Parr Research Corporation
+ * with Purdue University Electrical Engineering
+ * With AHPCRC, University of Minnesota
+ * ANTLR Version 1.33MR33
+ */
+
+#define ANTLR_VERSION 13333
+#include "pcctscfg.h"
+#include "pccts_stdio.h"
+
+#include "pcctscfg.h"
+#include "set.h"
+#include <ctype.h>
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#define zzcr_attr(attr,tok,t)
+#define zzSET_SIZE 20
+#include "antlr.h"
+#include "tokens.h"
+#include "dlgdef.h"
+#include "err.h"
+
+ANTLRChar *zztokens[157]={
+ /* 00 */ "Invalid",
+ /* 01 */ "Eof",
+ /* 02 */ "QuotedTerm",
+ /* 03 */ "\\n|\\r|\\r\\n",
+ /* 04 */ "\\(\\n|\\r|\\r\\n)",
+ /* 05 */ "\\~[]",
+ /* 06 */ "~[\\n\\r\"\\]+",
+ /* 07 */ "\"",
+ /* 08 */ "\\n|\\r|\\r\\n",
+ /* 09 */ "\\(\\n|\\r|\\r\\n)",
+ /* 10 */ "\\~[]",
+ /* 11 */ "~[\\n\\r\"\\]+",
+ /* 12 */ "'",
+ /* 13 */ "\\n|\\r|\\r\\n",
+ /* 14 */ "\\~[]",
+ /* 15 */ "~[\\n\\r'\\]+",
+ /* 16 */ "\\*/",
+ /* 17 */ "\\*",
+ /* 18 */ "\\n|\\r|\\r\\n",
+ /* 19 */ "~[\\n\\r\\*]+",
+ /* 20 */ "\\*/",
+ /* 21 */ "\\*",
+ /* 22 */ "\\n|\\r|\\r\\n",
+ /* 23 */ "~[\\n\\r\\*]+",
+ /* 24 */ "\\n|\\r|\\r\\n",
+ /* 25 */ "~[\\n\\r]+",
+ /* 26 */ "\\n|\\r|\\r\\n",
+ /* 27 */ "~[\\n\\r]+",
+ /* 28 */ "\\n|\\r|\\r\\n",
+ /* 29 */ "~[\\n\\r]+",
+ /* 30 */ "\\*/",
+ /* 31 */ "\\*",
+ /* 32 */ "\\n|\\r|\\r\\n",
+ /* 33 */ "~[\\n\\r\\*]+",
+ /* 34 */ "Action",
+ /* 35 */ "Pred",
+ /* 36 */ "PassAction",
+ /* 37 */ "consumeUntil\\( [\\ \\t]* \\{~[\\}]+\\} [\\ \\t]* \\)",
+ /* 38 */ "consumeUntil\\( ~[\\)]+ \\)",
+ /* 39 */ "\\n|\\r|\\r\\n",
+ /* 40 */ "\\>",
+ /* 41 */ "$",
+ /* 42 */ "$$",
+ /* 43 */ "$\\[\\]",
+ /* 44 */ "$\\[",
+ /* 45 */ "$[0-9]+",
+ /* 46 */ "$[0-9]+.",
+ /* 47 */ "$[0-9]+.[0-9]+",
+ /* 48 */ "$[_a-zA-Z][_a-zA-Z0-9]*",
+ /* 49 */ "#0",
+ /* 50 */ "#\\[\\]",
+ /* 51 */ "#\\(\\)",
+ /* 52 */ "#[0-9]+",
+ /* 53 */ "#line[\\ \\t]* [0-9]+ {[\\ \\t]* \"~[\"]+\" ([\\ \\t]* [0-9]*)* } (\\n|\\r|\\r\\n)",
+ /* 54 */ "#line ~[\\n\\r]* (\\n|\\r|\\r\\n)",
+ /* 55 */ "#[_a-zA-Z][_a-zA-Z0-9]*",
+ /* 56 */ "#\\[",
+ /* 57 */ "#\\(",
+ /* 58 */ "#",
+ /* 59 */ "\\)",
+ /* 60 */ "\\[",
+ /* 61 */ "\\(",
+ /* 62 */ "\\\\]",
+ /* 63 */ "\\\\)",
+ /* 64 */ "\\>",
+ /* 65 */ "'",
+ /* 66 */ "\"",
+ /* 67 */ "\\$",
+ /* 68 */ "\\#",
+ /* 69 */ "\\(\\n|\\r|\\r\\n)",
+ /* 70 */ "\\~[\\]\\)>$#]",
+ /* 71 */ "/",
+ /* 72 */ "/\\*",
+ /* 73 */ "\\*/",
+ /* 74 */ "//",
+ /* 75 */ "~[\\n\\r\\)\\(\\$#\\>\\]\\[\"'/]+",
+ /* 76 */ "[\\t\\ ]+",
+ /* 77 */ "\\n|\\r|\\r\\n",
+ /* 78 */ "\\[",
+ /* 79 */ "\\<\\<",
+ /* 80 */ "\"",
+ /* 81 */ "/\\*",
+ /* 82 */ "\\*/",
+ /* 83 */ "//",
+ /* 84 */ "#line[\\ \\t]* [0-9]+ {[\\ \\t]* \"~[\"]+\" ([\\ \\t]* [0-9]*)* } (\\n|\\r|\\r\\n)",
+ /* 85 */ "#line ~[\\n\\r]* (\\n|\\r|\\r\\n)",
+ /* 86 */ "\\>\\>",
+ /* 87 */ "WildCard",
+ /* 88 */ "\\@",
+ /* 89 */ "LABEL",
+ /* 90 */ "grammar-element",
+ /* 91 */ "meta-symbol",
+ /* 92 */ "Pragma",
+ /* 93 */ "FirstSetSymbol",
+ /* 94 */ "{\\}#header",
+ /* 95 */ "{\\}#first",
+ /* 96 */ "{\\}#parser",
+ /* 97 */ "{\\}#tokdefs",
+ /* 98 */ "\\}",
+ /* 99 */ "class",
+ /* 100 */ "NonTerminal",
+ /* 101 */ "TokenTerm",
+ /* 102 */ "\\{",
+ /* 103 */ "!",
+ /* 104 */ "\\<",
+ /* 105 */ "\\>",
+ /* 106 */ ":",
+ /* 107 */ ";",
+ /* 108 */ "{\\}#lexaction",
+ /* 109 */ "{\\}#lexmember",
+ /* 110 */ "{\\}#lexprefix",
+ /* 111 */ "{\\}#pred",
+ /* 112 */ "\\|\\|",
+ /* 113 */ "&&",
+ /* 114 */ "\\(",
+ /* 115 */ "\\)",
+ /* 116 */ "{\\}#lexclass",
+ /* 117 */ "{\\}#errclass",
+ /* 118 */ "{\\}#tokclass",
+ /* 119 */ "..",
+ /* 120 */ "{\\}#token",
+ /* 121 */ "=",
+ /* 122 */ "[0-9]+",
+ /* 123 */ "\\|",
+ /* 124 */ "\\~",
+ /* 125 */ "^",
+ /* 126 */ "approx",
+ /* 127 */ "LL\\(1\\)",
+ /* 128 */ "LL\\(2\\)",
+ /* 129 */ "\\*",
+ /* 130 */ "\\+",
+ /* 131 */ "?",
+ /* 132 */ "=>",
+ /* 133 */ "exception",
+ /* 134 */ "default",
+ /* 135 */ "catch",
+ /* 136 */ "{\\}#[A-Za-z0-9_]*",
+ /* 137 */ "[\\t\\ ]+",
+ /* 138 */ "\\n|\\r|\\r\\n",
+ /* 139 */ "//",
+ /* 140 */ "/\\*",
+ /* 141 */ "#ifdef",
+ /* 142 */ "#if",
+ /* 143 */ "#ifndef",
+ /* 144 */ "#else",
+ /* 145 */ "#endif",
+ /* 146 */ "#undef",
+ /* 147 */ "#import",
+ /* 148 */ "ID",
+ /* 149 */ "#define",
+ /* 150 */ "INT",
+ /* 151 */ "enum",
+ /* 152 */ "\\{",
+ /* 153 */ "=",
+ /* 154 */ ",",
+ /* 155 */ "\\}",
+ /* 156 */ ";"
+};
+SetWordType zzerr1[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr2[20] = {0xfc,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xf3,
+ 0xbf,0xff,0xff,0xff, 0xff,0xff,0xff,0x1f};
+SetWordType zzerr3[20] = {0xfc,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xfb,
+ 0x3b,0xf7,0xf7,0xc7, 0xff,0xff,0xff,0x1f};
+SetWordType zzerr4[20] = {0x4,0x0,0x0,0x0, 0x10,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x80,0x7,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType setwd1[157] = {0x0,0x50,0xa0,0x20,0x20,0x20,0x20,
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+ 0x20,0x20,0x20,0x6a,0x20,0xa0,0x20,0x20,
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+ 0x20,0x20,0x20,0x0,0x0,0x20,0x20,0x21,
+ 0x21,0x21,0x21,0x6e,0x6e,0x64,0x20,0x0,
+ 0x20,0xa0,0xa0,0xa0,0x20,0x6a,0x6a,0x6a,
+ 0x6e,0x20,0x20,0x20,0x20,0x66,0x6e,0x6e,
+ 0x20,0x66,0x20,0x20,0x20,0x20,0x20,0x20,
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x20,
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+ 0x20,0x20,0x20,0x20,0x20,0x20};
+SetWordType zzerr5[20] = {0x0,0x0,0x0,0x0, 0x10,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x1,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr6[20] = {0x4,0x0,0x0,0x0, 0x10,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x7,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr7[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x6,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr8[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x4,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr9[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x1c,0xf0,0x70,0x1, 0x20,0x0,0x0,0x0};
+SetWordType setwd2[157] = {0x0,0xf8,0x6,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0xf8,0x0,0x1,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0xf8,0xf8,0xf8,0x0,0x0,
+ 0x0,0x1,0x2,0x6,0x0,0xf8,0xf8,0xf8,
+ 0xf8,0x0,0x0,0x0,0x0,0xf8,0xf8,0xf8,
+ 0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0xe8,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0};
+SetWordType zzerr10[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0xbc,0xf8,0x74,0x1, 0x20,0x0,0x0,0x0};
+SetWordType zzerr11[20] = {0x0,0x0,0x0,0x0, 0x8,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0xa0,0x0,0x4,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr12[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x1c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0};
+SetWordType zzerr13[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0xa0,0x0,0x4,0x0, 0x0,0x0,0x0,0x0};
+SetWordType setwd3[157] = {0x0,0xfa,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0xfa,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0xfa,0xfa,0xfa,0x5,0x0,
+ 0x5,0x0,0x0,0x0,0xe2,0xfa,0xfa,0xfa,
+ 0xfa,0xc0,0x80,0x5,0xe0,0xfa,0xfa,0xfa,
+ 0x0,0xfa,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0xfa,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0};
+SetWordType zzerr14[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x20,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr15[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr16[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr17[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x40,0x0,0x4,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr18[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x24,0x0,0x80,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr19[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x20,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr20[20] = {0x6,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x1c,0xf8,0x74,0x3, 0x20,0x0,0x0,0x0};
+SetWordType zzerr21[20] = {0x6,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x1c,0xf8,0x70,0x3, 0x20,0x0,0x0,0x0};
+SetWordType setwd4[157] = {0x0,0xe5,0xda,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0xe5,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0xed,0xe5,0xe7,0x1a,0x0,
+ 0x0,0x0,0x0,0x0,0xc0,0xe5,0xe5,0xe5,
+ 0xe5,0x0,0x0,0x0,0x0,0xe5,0xe5,0xe5,
+ 0x0,0xe5,0x40,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0xe5,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0};
+SetWordType zzerr22[20] = {0x6,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x3c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0};
+SetWordType zzerr23[20] = {0x6,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x1c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0};
+SetWordType zzerr24[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x1c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0};
+SetWordType zzerr25[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x1c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0};
+SetWordType zzerr26[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x5,
+ 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0};
+SetWordType setwd5[157] = {0x0,0x1f,0xc1,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0xdf,0xc0,0xc0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0xc0,0x0,0xc0,0x0,0x0,0xc0,0xc0,0x0,
+ 0x0,0x0,0x0,0x7f,0x1f,0xdf,0xc0,0xc0,
+ 0x0,0x0,0xc0,0x0,0x67,0x1f,0x1f,0x1f,
+ 0x1f,0x0,0x0,0xc0,0x60,0x1f,0x1f,0x1f,
+ 0x0,0x1f,0x0,0x0,0x40,0xc0,0x0,0x0,
+ 0x0,0x0,0xc0,0xc0,0x0,0x0,0x5f,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0};
+SetWordType zzerr27[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
+ 0x0,0x0,0x0,0x10, 0x0,0x0,0x0,0x0};
+SetWordType zzerr28[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x80,0x2,
+ 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr29[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x20,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr30[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xd,
+ 0x0,0x0,0x80,0x0, 0x20,0x0,0x0,0x0};
+SetWordType zzerr31[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xd,
+ 0x0,0x0,0x0,0x0, 0x20,0x0,0x0,0x0};
+SetWordType zzerr32[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x5,
+ 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0};
+SetWordType zzerr33[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x20,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType setwd6[157] = {0x0,0x0,0xfd,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0xe1,0xe1,0xe1,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0xfd,0x60,0xe9,0x0,0x0,0xe1,0xe1,0x0,
+ 0x0,0x0,0x0,0xe2,0x0,0xfd,0xfd,0xe1,
+ 0x20,0x0,0xe1,0x0,0xe2,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0xe1,0xe2,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0xe2,0xe0,0x20,0x0,
+ 0x0,0x0,0xe1,0xe1,0x0,0x0,0xe2,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0};
+SetWordType zzerr34[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xd,
+ 0x0,0x0,0x80,0x0, 0x20,0x0,0x0,0x0};
+SetWordType zzerr35[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xd,
+ 0x0,0x0,0x0,0x0, 0x20,0x0,0x0,0x0};
+SetWordType zzerr36[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x5,
+ 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0};
+SetWordType zzerr37[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xc,
+ 0x0,0x0,0x0,0x0, 0x20,0x0,0x0,0x0};
+SetWordType zzerr38[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
+ 0x84,0x9,0x8,0x18, 0x20,0x0,0x0,0x0};
+SetWordType zzerr39[20] = {0x0,0x0,0x0,0x0, 0x10,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x1,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr40[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
+ 0x4,0x9,0x8,0x18, 0x20,0x0,0x0,0x0};
+SetWordType zzerr41[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
+ 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0};
+SetWordType zzerr42[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x80,0x0,
+ 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType setwd7[157] = {0x0,0x0,0xdf,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0xdf,0xdf,0xff,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0xdf,0x3,0xdf,0x0,0x0,0xdf,0xdf,0x0,
+ 0x0,0x0,0x0,0xdf,0x0,0xdf,0xdf,0xdf,
+ 0x1,0x30,0xdf,0x0,0xdf,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0xdf,0xdf,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0xdf,0xdf,0x1,0x0,
+ 0x0,0x0,0xdf,0xdf,0x0,0x0,0xdf,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0};
+SetWordType zzerr43[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
+ 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0};
+SetWordType zzerr44[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0xc0, 0x1,0x0,0x0,0x0};
+SetWordType zzerr45[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x30,
+ 0x40,0x0,0x4,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr46[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr47[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x20,
+ 0x40,0x0,0x4,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr48[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x2,0x0, 0x10,0x0,0x0,0x0};
+SetWordType zzerr49[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
+ 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0};
+SetWordType zzerr50[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
+ 0x4,0x8,0xa,0x18, 0x30,0x0,0x0,0x0};
+SetWordType zzerr51[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
+ 0x4,0x8,0x8,0x18, 0x28,0x0,0x0,0x0};
+SetWordType zzerr52[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x40,0x0,0x4,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr53[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
+ 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType setwd8[157] = {0x0,0x0,0xe1,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0xe1,0xe1,0xe1,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0xe1,0x0,0xe1,0x0,0x0,0xe3,0xe7,0x0,
+ 0x0,0x0,0x0,0xe1,0x0,0xe1,0xe1,0xef,
+ 0x0,0x0,0xe1,0x0,0xe1,0x0,0x0,0x0,
+ 0x0,0x0,0x10,0xef,0xe1,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0xe1,0xe1,0x0,0x0,
+ 0x0,0x0,0xe1,0xe1,0x0,0x10,0xe1,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0};
+SetWordType zzerr54[20] = {0x2,0x0,0x0,0x0, 0x14,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x1c,0xf8,0x78,0x9, 0xe0,0x0,0x0,0x0};
+SetWordType zzerr55[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x1c,0xf8,0x78,0x9, 0x60,0x0,0x0,0x0};
+SetWordType zzerr56[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr57[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x1c,0xf8,0x78,0x9, 0xe0,0x0,0x0,0x0};
+SetWordType setwd9[157] = {0x0,0x7c,0x1,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x7f,0x1,0x1,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x1,0x0,0x1,0x0,0x0,0x1,0x1,0x0,
+ 0x0,0x0,0x0,0x7f,0x7e,0x7f,0x1,0x1,
+ 0x0,0x0,0x1,0x0,0x7d,0x7e,0x7e,0x7e,
+ 0x7e,0x0,0x0,0x1,0x7d,0x7e,0x7e,0x7e,
+ 0x0,0x7e,0x0,0x0,0x7d,0x1,0x0,0x0,
+ 0x0,0x0,0x1,0x1,0x0,0x0,0x7f,0x64,
+ 0x64,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x80,0x0,0x0,0x0,0x0,0x0,0x80,0x0,
+ 0x80,0x0,0x0,0x0,0x0,0x0};
+SetWordType zzerr58[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0, 0x0,0x0,0xa0,0x0};
+SetWordType zzerr59[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0, 0x0,0x80,0xa0,0x0};
+SetWordType zzerr60[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0, 0x0,0x0,0xa0,0x0};
+SetWordType zzerr61[20] = {0x2,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0, 0x0,0x80,0xa0,0x0};
+SetWordType zzerr62[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xe};
+SetWordType zzerr63[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xe};
+SetWordType zzerr64[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xe};
+SetWordType zzerr65[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0, 0x0,0x0,0x10,0xc};
+SetWordType setwd10[157] = {0x0,0xc,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,
+ 0x3,0x0,0x0,0xf0,0xf0,0x0};
+SetWordType setwd11[157] = {0x0,0x1,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
+ 0x1,0x0,0x0,0x0,0x0,0x0};
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/fcache.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/fcache.c
new file mode 100644
index 000000000..ff7dcdfdd
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/fcache.c
@@ -0,0 +1,123 @@
+/*
+ * fcache.c
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33MR10
+ *
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+
+#include "pcctscfg.h"
+
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+
+#ifdef __USE_PROTOS
+CacheEntry *dumpFcache1(char *prev)
+#else
+CacheEntry *dumpFcache1(prev)
+ char *prev;
+#endif
+{
+ Entry **table=Fcache;
+
+ int low=0;
+ int hi=0;
+
+ CacheEntry *least=NULL;
+
+ Entry **p;
+
+ for (p=table; p<&(table[HashTableSize]); p++) {
+
+ CacheEntry *q =(CacheEntry *) *p;
+
+ if ( q != NULL && low==0 ) low = p-table;
+ while ( q != NULL ) {
+ if (strcmp(q->str,prev) > 0) {
+ if (least == NULL) {
+ least=q;
+ } else {
+ if (strcmp(q->str,least->str) < 0) {
+ least=q;
+ };
+ };
+ };
+ q = q->next;
+ };
+
+ if ( *p != NULL ) hi = p-table;
+ }
+ return least;
+}
+
+#ifdef __USE_PROTOS
+void reportFcache(CacheEntry *q)
+#else
+void reportFcache(q)
+ CacheEntry *q;
+#endif
+{
+ char *qstr;
+
+ fprintf(stdout,"\nrule ");
+ for (qstr=q->str; *qstr != '*' ; qstr++) {
+ fprintf(stdout,"%c",*qstr);
+ };
+
+ qstr++;
+ if (*qstr == 'i') fprintf(stdout," First[");
+ if (*qstr == 'o') fprintf(stdout," Follow[");
+ qstr++;
+ fprintf(stdout,"%s]",qstr);
+ if (q->incomplete) fprintf(stdout," *** incomplete ***");
+ fprintf(stdout,"\n");
+ MR_dumpTokenSet(stdout,1,q->fset);
+}
+
+void
+#ifdef __USE_PROTOS
+DumpFcache(void)
+#else
+DumpFcache()
+#endif
+{
+
+ char *prev="";
+ int n=0;
+ CacheEntry *next;
+
+ fprintf(stdout,"\n\nDump of First/Follow Cache\n");
+
+ for(;;) {
+ next=dumpFcache1(prev);
+ if (next == NULL) break;
+ reportFcache(next);
+ ++n;
+ prev=next->str;
+ };
+ fprintf(stdout,"\nEnd dump of First/Follow Cache\n");
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset.c
new file mode 100644
index 000000000..e3fac09f2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset.c
@@ -0,0 +1,1555 @@
+/*
+ * fset.c
+ *
+ * Compute FIRST and FOLLOW sets.
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "pcctscfg.h"
+
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#include "dlgdef.h"
+#include "limits.h"
+
+#ifdef __USE_PROTOS
+static void ensure_predicates_cover_ambiguous_lookahead_sequences
+ (Junction *, Junction *, char *, Tree *);
+#else
+static void ensure_predicates_cover_ambiguous_lookahead_sequences();
+#endif
+
+/*
+ * What tokens are k tokens away from junction q?
+ *
+ * Follow both p1 and p2 paths (unless RuleBlk) to collect the tokens k away from this
+ * node.
+ * We lock the junction according to k--the lookahead. If we have been at this
+ * junction before looking for the same, k, number of lookahead tokens, we will
+ * do it again and again...until we blow up the stack. Locks are only used on aLoopBlk,
+ * RuleBlk, aPlusBlk and EndRule junctions to remove/detect infinite recursion from
+ * FIRST and FOLLOW calcs.
+ *
+ * If p->jtype == EndRule we are going to attempt a FOLLOW. (FOLLOWs are really defined
+ * in terms of FIRST's, however). To proceed with the FOLLOW, p->halt cannot be
+ * set. p->halt is set to indicate that a reference to the current rule is in progress
+ * and the FOLLOW is not desirable.
+ *
+ * If we attempt a FOLLOW and find that there is no FOLLOW or REACHing beyond the EndRule
+ * junction yields an empty set, replace the empty set with EOF. No FOLLOW means that
+ * only EOF can follow the current rule. This normally occurs only on the start symbol
+ * since all other rules are referenced by another rule somewhere.
+ *
+ * Normally, both p1 and p2 are followed. However, checking p2 on a RuleBlk node is
+ * the same as checking the next rule which is clearly incorrect.
+ *
+ * Cycles in the FOLLOW sense are possible. e.g. Fo(c) requires Fo(b) which requires
+ * Fo(c). Both Fo(b) and Fo(c) are defined to be Fo(b) union Fo(c). Let's say
+ * Fo(c) is attempted first. It finds all of the FOLLOW symbols and then attempts
+ * to do Fo(b) which finds of its FOLLOW symbols. So, we have:
+ *
+ * Fo(c)
+ * / \
+ * a set Fo(b)
+ * / \
+ * a set Fo(c) .....Hmmmm..... Infinite recursion!
+ *
+ * The 2nd Fo(c) is not attempted and Fo(b) is left deficient, but Fo(c) is now
+ * correctly Fo(c) union Fo(b). We wish to pick up where we left off, so the fact
+ * that Fo(b) terminated early means that we lack Fo(c) in the Fo(b) set already
+ * laying around. SOOOOoooo, we track FOLLOW cycles. All FOLLOW computations are
+ * cached in a hash table. After the sequence of FOLLOWs finish, we reconcile all
+ * cycles --> correct all Fo(rule) sets in the cache.
+ *
+ * Confused? Good! Read my MS thesis [Purdue Technical Report TR90-30].
+ * TJP 8/93 -- can now read PhD thesis from Purdue.
+ *
+ * Also, FIRST sets are cached in the hash table. Keys are (rulename,Fi/Fo,k).
+ * Only FIRST sets, for which the FOLLOW is not included, are stored.
+ *
+ * SPECIAL CASE of (...)+ blocks:
+ * I added an optional alt so that the alts could see what
+ * was behind the (...)+ block--thus using enough lookahead
+ * to branch out rather than just enough to distinguish
+ * between alts in the (...)+. However, when the FIRST("(...)+") is
+ * is needed, must not use this last "optional" alt. This routine
+ * turns off this path by setting a new 'ignore' flag for
+ * the alt and then resetting it afterwards.
+ */
+
+set
+#ifdef __USE_PROTOS
+rJunc( Junction *p, int k, set *rk )
+#else
+rJunc( p, k, rk )
+Junction *p;
+int k;
+set *rk;
+#endif
+{
+ set a, b;
+
+ require(p!=NULL, "rJunc: NULL node");
+ require(p->ntype==nJunction, "rJunc: not junction");
+
+#ifdef DBG_LL1
+ if ( p->jtype == RuleBlk ) fprintf(stderr, "FIRST(%s,%d) \n",((Junction *)p)->rname,k);
+ else fprintf(stderr, "rJunc: %s in rule %s\n",
+ decodeJType[p->jtype], ((Junction *)p)->rname);
+#endif
+ /* if this is one of the added optional alts for (...)+ then return */
+
+ /* no need to pop backtrace - hasn't been pushed */
+
+ if ( p->ignore ) return empty;
+
+ if (MR_MaintainBackTrace) MR_pointerStackPush(&MR_BackTraceStack,p);
+
+/* MR14 */ if (AlphaBetaTrace && p->alpha_beta_guess_end) {
+/* MR14 */ warnFL(
+/* MR14 */ "not possible to compute follow set for alpha in an \"(alpha)? beta\" block. ",
+/* MR14 */ FileStr[p->file],p->line);
+/* MR14 */ MR_alphaBetaTraceReport();
+/* MR14 */ };
+
+/* MR14 */ if (p->alpha_beta_guess_end) {
+/* MR14 */ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
+/* MR14 */ return empty;
+/* MR14 */ }
+
+ /* locks are valid for aLoopBlk,aPlusBlk,RuleBlk,EndRule junctions only */
+ if ( p->jtype==aLoopBlk || p->jtype==RuleBlk ||
+ p->jtype==aPlusBlk || p->jtype==EndRule )
+ {
+ require(p->lock!=NULL, "rJunc: lock array is NULL");
+ if ( p->lock[k] )
+ {
+ if ( p->jtype == EndRule ) /* FOLLOW cycle? */
+ {
+#ifdef DBG_LL1
+ fprintf(stderr, "FOLLOW cycle to %s: panic!\n", p->rname);
+#endif
+ if (! MR_AmbSourceSearch) RegisterCycle(p->rname, k);
+ }
+ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
+ return empty;
+ }
+ if ( p->jtype == RuleBlk &&
+ p->end->halt &&
+ ! MR_AmbSourceSearch) /* check for FIRST cache */
+ {
+ CacheEntry *q = (CacheEntry *) hash_get(Fcache, Fkey(p->rname,'i',k));
+ if ( q != NULL )
+ {
+ set_orin(rk, q->rk);
+ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
+ return set_dup( q->fset );
+ }
+ }
+ if ( p->jtype == EndRule &&
+ !p->halt && /* MR11 was using cache even when halt set */
+ ! MR_AmbSourceSearch) /* FOLLOW set cached already? */
+ {
+ CacheEntry *q = (CacheEntry *) hash_get(Fcache, Fkey(p->rname,'o',k));
+ if ( q != NULL )
+ {
+#ifdef DBG_LL1
+ fprintf(stderr, "cache for FOLLOW(%s,%d):", p->rname,k);
+ s_fprT(stderr, q->fset);
+ if ( q->incomplete ) fprintf(stderr, " (incomplete)");
+ fprintf(stderr, "\n");
+#endif
+ if ( !q->incomplete )
+ {
+ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
+ return set_dup( q->fset );
+ }
+ }
+ }
+ p->lock[k] = TRUE; /* This rule is busy */
+ }
+
+ a = b = empty;
+
+ if ( p->jtype == EndRule )
+ {
+ if (p->halt ) /* don't want FOLLOW here? */ /* unless MR10 hoisting */
+ {
+ p->lock[k] = FALSE;
+ set_orel(k, rk); /* indicate this k value needed */
+ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
+ return empty;
+ }
+ if (! MR_AmbSourceSearch) FoPush(p->rname, k); /* Attempting FOLLOW */
+ if ( p->p1 == NULL ) set_orel((TokenInd!=NULL?TokenInd[EofToken]:EofToken), &a);/* if no FOLLOW assume EOF */
+#ifdef DBG_LL1
+ fprintf(stderr, "-->FOLLOW(%s,%d)\n", p->rname,k);
+#endif
+ }
+
+ if ( p->p1 != NULL ) {
+/* MR14 */ if (p->guess) {
+/* MR14 */ if (p->guess_analysis_point == NULL) {
+/* MR14 */ Node * guess_point;
+/* MR14 */ guess_point=(Node *)analysis_point(p);
+/* MR14 */ if (guess_point == (Node *)p) {
+/* MR14 */ guess_point=p->p1;
+/* MR14 */ }
+/* MR14 */ p->guess_analysis_point=guess_point;
+/* MR14 */ }
+/* MR14 */ REACH(p->guess_analysis_point, k, rk, a);
+ } else {
+ REACH(p->p1, k, rk, a);
+ }
+ }
+
+ /* C a c h e R e s u l t s */
+
+ if ( p->jtype == RuleBlk && p->end->halt && ! MR_AmbSourceSearch) /* can save FIRST set? */
+ {
+ CacheEntry *q = newCacheEntry( Fkey(p->rname,'i',k) );
+ /*fprintf(stderr, "Caching %s FIRST %d\n", p->rname, k);*/
+ hash_add(Fcache, Fkey(p->rname,'i',k), (Entry *)q);
+ q->fset = set_dup( a );
+ q->rk = set_dup( *rk );
+ }
+
+ if ( p->jtype == EndRule &&
+ !p->halt && /* MR11 was using cache even with halt set */
+ ! MR_AmbSourceSearch) /* just completed FOLLOW? */
+ {
+ /* Cache Follow set */
+ CacheEntry *q = (CacheEntry *) hash_get(Fcache, Fkey(p->rname,'o',k));
+ if ( q==NULL )
+ {
+ q = newCacheEntry( Fkey(p->rname,'o',k) );
+ hash_add(Fcache, Fkey(p->rname,'o',k), (Entry *)q);
+ }
+ /*fprintf(stderr, "Caching %s FOLLOW %d\n", p->rname, k);*/
+ if ( set_nil(a) && !q->incomplete )
+ {
+ /* Don't ever save a nil set as complete.
+ * Turn it into an eof set.
+ */
+ set_orel(EofToken, &a);
+ }
+ set_orin(&(q->fset), a);
+ FoPop( k );
+ if ( FoTOS[k] == NULL && Cycles[k] != NULL ) ResolveFoCycles(k);
+#ifdef DBG_LL1
+ fprintf(stderr, "saving FOLLOW(%s,%d):", p->rname, k);
+ s_fprT(stderr, q->fset);
+ if ( q->incomplete ) fprintf(stderr, " (incomplete)");
+ fprintf(stderr, "\n");
+#endif
+ }
+
+ if (p->jtype != RuleBlk && p->p2 != NULL && /* MR14 */ ! p->guess) {
+ REACH(p->p2, k, rk, b);
+ }
+
+ if ( p->jtype==aLoopBlk || p->jtype==RuleBlk ||
+ p->jtype==aPlusBlk || p->jtype==EndRule )
+ p->lock[k] = FALSE; /* unlock node */
+
+ set_orin(&a, b);
+ set_free(b);
+ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
+ return a;
+}
+
+set
+#ifdef __USE_PROTOS
+rRuleRef( RuleRefNode *p, int k, set *rk_out )
+#else
+rRuleRef( p, k, rk_out )
+RuleRefNode *p;
+int k;
+set *rk_out;
+#endif
+{
+ set rk;
+ Junction *r;
+ int k2;
+ set a, rk2, b;
+ int save_halt;
+ RuleEntry *q = (RuleEntry *) hash_get(Rname, p->text);
+ require(p!=NULL, "rRuleRef: NULL node");
+ require(p->ntype==nRuleRef, "rRuleRef: not rule ref");
+
+#ifdef DBG_LL1
+ fprintf(stderr, "rRuleRef: %s\n", p->text);
+#endif
+
+ if (MR_MaintainBackTrace) MR_pointerStackPush(&MR_BackTraceStack,p);
+
+ if ( q == NULL )
+ {
+ warnFL( eMsg1("rule %s not defined",p->text), FileStr[p->file], p->line );
+ REACH(p->next, k, rk_out, a);
+ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
+ return a;
+ }
+ rk2 = empty;
+
+/* MR9 Problems with rule references in guarded predicates */
+/* MR9 Perhaps can use hash table to find rule ? */
+
+/* MR9 */ if (RulePtr == NULL) {
+/* MR9 */ fatalFL(eMsg2("Rule %s uses rule %s via RulePtr before it has been initialized",
+/* MR9 */ p->rname,q->str),FileStr[p->file],p->line);
+/* MR9 */ };
+
+ r = RulePtr[q->rulenum];
+ if ( r->lock[k] )
+ {
+ errNoFL( eMsg2("infinite left-recursion to rule %s from rule %s",
+ r->rname, p->rname) );
+
+ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
+
+ return empty;
+ }
+
+ save_halt = r->end->halt;
+ r->end->halt = TRUE; /* don't let reach fall off end of rule here */
+ rk = empty;
+ REACH(r, k, &rk, a);
+ r->end->halt = save_halt;
+ while ( !set_nil(rk) ) {
+ k2 = set_int(rk); /* MR11 this messes up the ambiguity search routine */
+ set_rm(k2, rk);
+ REACH(p->next, k2, &rk2, b); /* MR11 by changing the value of k */
+ set_orin(&a, b);
+ set_free(b);
+ }
+ set_free(rk); /* this has no members, but free its memory */
+ set_orin(rk_out, rk2); /* remember what we couldn't do */
+ set_free(rk2);
+ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
+ return a;
+}
+
+/*
+ * Return FIRST sub k ( token_node )
+ *
+ * TJP 10/11/93 modified this so that token nodes that are actually
+ * ranges (T1..T2) work.
+ */
+set
+#ifdef __USE_PROTOS
+rToken( TokNode *p, int k, set *rk )
+#else
+rToken( p, k, rk )
+TokNode *p;
+int k;
+set *rk;
+#endif
+{
+ set a;
+
+ require(p!=NULL, "rToken: NULL node");
+ require(p->ntype==nToken, "rToken: not token node");
+
+#ifdef DBG_LL1
+ fprintf(stderr, "rToken: %s\n", (TokenString(p->token)!=NULL)?TokenString(p->token):
+ ExprString(p->token));
+#endif
+
+
+ if (MR_MaintainBackTrace) MR_pointerStackPush(&MR_BackTraceStack,p);
+
+ if (MR_AmbSourceSearch && (k-1) == 0) {
+
+ set localConstrain;
+ set intersection;
+
+ localConstrain=fset[maxk-k+1];
+
+ if (! set_nil(p->tset)) {
+ intersection=set_and(localConstrain,p->tset);
+ if (! set_nil(intersection)) {
+ MR_backTraceReport();
+ };
+ set_free(intersection);
+ } else {
+ if (set_el( (unsigned) p->token,localConstrain)) {
+ MR_backTraceReport();
+ }
+ };
+ };
+
+ if ( k-1 == 0 ) {
+
+ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
+
+ if ( !set_nil(p->tset) ) {
+ return set_dup(p->tset);
+ } else {
+ return set_of(p->token);
+ };
+ }
+
+ REACH(p->next, k-1, rk, a);
+
+ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
+
+ return a;
+}
+
+set
+#ifdef __USE_PROTOS
+rAction( ActionNode *p, int k, set *rk )
+#else
+rAction( p, k, rk )
+ActionNode *p;
+int k;
+set *rk;
+#endif
+{
+ set a;
+
+ require(p!=NULL, "rJunc: NULL node");
+ require(p->ntype==nAction, "rJunc: not action");
+
+/* MR11 */ if (p->is_predicate && p->ampersandPred != NULL) {
+/* MR11 */ Predicate *pred=p->ampersandPred;
+/* MR11 */ if (k <= pred->k) {
+/* MR11 */ REACH(p->guardNodes,k,rk,a);
+/* MR11 */ return a;
+/* MR11 */ };
+/* MR11 */ };
+
+ /* it might be a good idea when doing an MR_AmbSourceSearch
+ to *not* look behind predicates under some circumstances
+ we'll look into that later
+ */
+
+ REACH(p->next, k, rk, a); /* ignore actions */
+ return a;
+}
+
+ /* A m b i g u i t y R e s o l u t i o n */
+
+
+void
+#ifdef __USE_PROTOS
+dumpAmbigMsg( set *fset, FILE *f, int want_nls )
+#else
+dumpAmbigMsg( fset, f, want_nls )
+set *fset;
+FILE *f;
+int want_nls;
+#endif
+{
+ int i;
+
+ set copy; /* MR11 */
+
+ if ( want_nls ) fprintf(f, "\n\t");
+ else fprintf(f, " ");
+
+ for (i=1; i<=CLL_k; i++)
+ {
+ copy=set_dup(fset[i]); /* MR11 */
+
+ if ( i>1 )
+ {
+ if ( !want_nls ) fprintf(f, ", ");
+ }
+ if ( set_deg(copy) > 3 && elevel == 1 )
+ {
+ int e,m;
+ fprintf(f, "{");
+ for (m=1; m<=3; m++)
+ {
+ e=set_int(copy);
+ fprintf(f, " %s", TerminalString(e));
+ set_rm(e, copy);
+ }
+ fprintf(f, " ... }");
+ }
+ else s_fprT(f, copy);
+ if ( want_nls ) fprintf(f, "\n\t");
+ set_free(copy);
+ }
+ fprintf(f, "\n");
+
+}
+
+static void
+#ifdef __USE_PROTOS
+verify_context(Predicate *predicate)
+#else
+verify_context(predicate)
+Predicate *predicate;
+#endif
+{
+ if ( predicate == NULL ) return;
+
+ if ( predicate->expr == PRED_OR_LIST ||
+ predicate->expr == PRED_AND_LIST )
+ {
+ verify_context(predicate->down);
+ verify_context(predicate->right); /* MR10 */
+ return;
+ }
+
+ if ( !predicate->source->ctxwarned && predicate->source->guardpred==NULL &&
+ ((predicate->k > 1 &&
+ !is_single_tuple(predicate->tcontext)) ||
+ ( predicate->k == 1 &&
+ set_deg(predicate->scontext[1])>1 )) )
+ {
+
+/* MR9 Suppress annoying messages caused by our own clever(?) fix */
+
+ fprintf(stderr, ErrHdr, FileStr[predicate->source->file],
+ predicate->source->line);
+ fprintf(stderr, " warning: predicate applied for >1 lookahead %d-sequences\n", predicate->k);
+ fprintf(stderr, ErrHdr, FileStr[predicate->source->file],
+ predicate->source->line);
+ fprintf(stderr, " predicate text: \"%s\"\n",
+ (predicate->expr == NULL ? "(null)" : predicate->expr) );
+ fprintf(stderr, ErrHdr, FileStr[predicate->source->file],
+ predicate->source->line);
+ fprintf(stderr, " You may only want one lookahead %d-sequence to apply\n", predicate->k);
+ fprintf(stderr, ErrHdr, FileStr[predicate->source->file],
+ predicate->source->line);
+ fprintf(stderr, " Try using a context guard '(...)? =>'\n");
+ predicate->source->ctxwarned = 1;
+ }
+ verify_context(predicate->right); /* MR10 */
+}
+
+/*
+ * If delta is the set of ambiguous lookahead sequences, then make sure that
+ * the predicate(s) for productions alt1,alt2 cover the sequences in delta.
+ *
+ * For example,
+ * a : <<PRED1>>? (A B|A C)
+ * | b
+ * ;
+ * b : <<PRED2>>? A B
+ * | A C
+ * ;
+ *
+ * This should give a warning that (A C) predicts both productions and alt2
+ * does not have a predicate in the production that generates (A C).
+ *
+ * The warning detection is simple. Let delta = LOOK(alt1) intersection LOOK(alt2).
+ * Now, if ( delta set-difference context(predicates-for-alt1) != empty then
+ * alt1 does not "cover" all ambiguous sequences.
+ *
+ * If ambig is nonempty, then ambig in LL(k) sense -> use tree info; else use fset
+ * info. Actually, sets are used only if k=1 for this grammar.
+ */
+static void
+#ifdef __USE_PROTOS
+ensure_predicates_cover_ambiguous_lookahead_sequences
+ ( Junction *alt1, Junction *alt2, char *sub, Tree *ambig )
+#else
+ensure_predicates_cover_ambiguous_lookahead_sequences( alt1, alt2, sub, ambig )
+Junction *alt1;
+Junction *alt2;
+char *sub;
+Tree *ambig;
+#endif
+{
+ if ( !ParseWithPredicates ) return;
+
+ if ( ambig!=NULL )
+ {
+ Tree *non_covered = NULL;
+ if ( alt1->predicate!=NULL )
+ non_covered = tdif(ambig, alt1->predicate, alt1->fset, alt2->fset);
+ if ( (non_covered!=NULL || alt1->predicate==NULL) && WarningLevel>1 )
+ {
+ fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
+ fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity",
+ alt1->altnum, sub);
+ if ( alt1->predicate!=NULL && non_covered!=NULL )
+ {
+ fprintf(stderr, " upon");
+ preorder(non_covered);
+ }
+ else if ( alt1->predicate==NULL )
+ {
+ fprintf(stderr, " upon");
+ preorder(ambig->down);
+ }
+ fprintf(stderr, "\n");
+ }
+ Tfree(non_covered);
+ non_covered = NULL;
+ if ( alt2->predicate!=NULL )
+ non_covered = tdif(ambig, alt2->predicate, alt1->fset, alt2->fset);
+ if ( (non_covered!=NULL || alt2->predicate==NULL) && WarningLevel>1 )
+ {
+ fprintf(stderr, ErrHdr, FileStr[alt2->file], alt2->line);
+ fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity",
+ alt2->altnum, sub);
+ if ( alt2->predicate!=NULL && non_covered!=NULL )
+ {
+ fprintf(stderr, " upon");
+ preorder(non_covered);
+ }
+ else if ( alt2->predicate==NULL )
+ {
+ fprintf(stderr, " upon");
+ preorder(ambig->down);
+ }
+ fprintf(stderr, "\n");
+ }
+ Tfree(non_covered);
+ }
+ else if ( !set_nil(alt1->fset[1]) )
+ {
+ set delta, non_covered;
+ delta = set_and(alt1->fset[1], alt2->fset[1]);
+ non_covered = set_dif(delta, covered_set(alt1->predicate));
+ if ( set_deg(non_covered)>0 && WarningLevel>1 )
+ {
+ fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
+ fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity",
+ alt1->altnum, sub);
+ if ( alt1->predicate!=NULL )
+ {
+ fprintf(stderr, " upon ");
+ s_fprT(stderr, non_covered);
+ }
+ fprintf(stderr, "\n");
+ }
+ set_free( non_covered );
+ non_covered = set_dif(delta, covered_set(alt2->predicate));
+ if ( set_deg(non_covered)>0 && WarningLevel>1 )
+ {
+ fprintf(stderr, ErrHdr, FileStr[alt2->file], alt2->line);
+ fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity",
+ alt2->altnum, sub);
+ if ( alt2->predicate!=NULL )
+ {
+ fprintf(stderr, " upon ");
+ s_fprT(stderr, non_covered);
+ }
+ fprintf(stderr, "\n");
+ }
+ set_free( non_covered );
+ set_free( delta );
+ }
+ else fatal_internal("productions have no lookahead in predicate checking routine");
+}
+
+#ifdef __USE_PROTOS
+void MR_doPredicatesHelp(int inGuessBlock,Junction *alt1,Junction *alt2,int jtype,char *sub)
+#else
+void MR_doPredicatesHelp(inGuessBlock,alt1,alt2,jtype,sub)
+ int inGuessBlock;
+ Junction *alt1;
+ Junction *alt2;
+ int jtype;
+ char *sub;
+#endif
+{
+ Predicate *p1;
+ Predicate *p2;
+
+ Junction *parentRule=MR_nameToRuleBlk(alt1->rname);
+
+ if (inGuessBlock && WarningLevel <= 1) return;
+
+ /* let antlr give the usual error message */
+
+ if (alt1->predicate == NULL && alt2->predicate == NULL) return;
+
+ if ( (jtype == RuleBlk || jtype == aSubBlk)
+ && (alt1->predicate == NULL && alt2->predicate != NULL)) {
+ fprintf(stderr, ErrHdr, FileStr[parentRule->file],parentRule->line);
+ fprintf(stderr," warning: alt %d line %d and alt %d line %d of %s\n%s%s%s",
+ alt1->altnum,
+ alt1->line,
+ alt2->altnum,
+ alt2->line,
+ sub,
+ " These alts have ambig lookahead sequences resolved by a predicate for\n",
+ " the second choice. The second choice may not be reachable.\n",
+ " You may want to use a complementary predicate or rearrange the alts\n"
+ );
+ return;
+ };
+
+ /* first do the easy comparison. then do the hard one */
+
+ if (MR_comparePredicates(alt1->predicate,alt2->predicate)) {
+
+ if (jtype == aLoopBegin || jtype == aPlusBlk ) {
+
+ /* I'm not sure this code is reachable.
+ Predicates following a (...)+ or (...)* block are probably
+ considered validation predicates and therefore not
+ participate in the predication expression
+ */
+
+ fprintf(stderr, ErrHdr,FileStr[parentRule->file],parentRule->line);
+ fprintf(stderr," warning: %s of %s in rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s",
+ "the predicates used to disambiguate optional/exit paths of ",
+ sub,
+ CurRule,
+ FileStr[alt1->file],
+ alt1->altnum,
+ alt1->line,
+ alt2->altnum,
+ alt2->line,
+ " are identical and have no resolving power\n");
+ } else {
+ fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line);
+ fprintf(stderr," warning: %s rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s",
+ "the predicates used to disambiguate",
+ CurRule,
+ FileStr[alt1->file],
+ alt1->altnum,
+ alt1->line,
+ alt2->altnum,
+ alt2->line,
+ " are identical and have no resolving power\n");
+ };
+ } else {
+ p1=predicate_dup_without_context(alt1->predicate);
+ p1=MR_unfold(p1);
+ MR_clearPredEntry(p1);
+ MR_simplifyInverted(p1,0);
+ p1=MR_predSimplifyALL(p1);
+ p2=predicate_dup_without_context(alt2->predicate);
+ p2=MR_unfold(p2);
+ MR_clearPredEntry(p2);
+ MR_simplifyInverted(p2,0);
+ p2=MR_predSimplifyALL(p2);
+ if (MR_comparePredicates(p1,p2)) {
+ if (jtype == aLoopBegin || jtype == aPlusBlk ) {
+ fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line);
+ fprintf(stderr," warning: %s of %s in rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s%s",
+ "the predicates used to disambiguate optional/exit paths of ",
+ sub,
+ CurRule,
+ FileStr[alt1->file],
+ alt1->altnum,
+ alt1->line,
+ alt2->altnum,
+ alt2->line,
+ " are identical when compared without context and may have no\n",
+ " resolving power for some lookahead sequences.\n");
+ } else {
+ fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line);
+ fprintf(stderr," warning: %s rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s%s",
+ "the predicates used to disambiguate",
+ CurRule,
+ FileStr[alt1->file],
+ alt1->altnum,
+ alt1->line,
+ alt2->altnum,
+ alt2->line,
+ " are identical when compared without context and may have no\n",
+ " resolving power for some lookahead sequences.\n");
+ };
+ if (InfoP) {
+ fprintf(output,"\n#if 0\n\n");
+ fprintf(output,"The following predicates are identical when compared without\n");
+ fprintf(output," lookahead context information. For some ambiguous lookahead\n");
+ fprintf(output," sequences they may not have any power to resolve the ambiguity.\n");
+ fprintf(output,"\n");
+
+ fprintf(output,"Choice 1: %s alt %d line %d file %s\n\n",
+ MR_ruleNamePlusOffset( (Node *) alt1),
+ alt1->altnum,
+ alt1->line,
+ FileStr[alt1->file]);
+ fprintf(output," The original predicate for choice 1 with available context information:\n\n");
+ MR_dumpPred1(2,alt1->predicate,1);
+ fprintf(output," The predicate for choice 1 after expansion (but without context information):\n\n");
+ MR_dumpPred1(2,p1,0);
+ if (p1 == NULL) {
+ Predicate *phelp;
+ fprintf(output," The predicate for choice 1 after expansion (but before simplification)\n\n");
+ phelp=predicate_dup_without_context(alt1->predicate);
+ phelp=MR_unfold(phelp);
+ MR_clearPredEntry(phelp);
+ MR_simplifyInverted(phelp,0);
+ phelp=MR_predSimplifyALLX(phelp,1);
+ MR_dumpPred1(2,phelp,0);
+ predicate_free(phelp);
+ };
+ fprintf(output,"\n");
+
+ fprintf(output,"Choice 2: %s alt %d line %d file %s\n\n",
+ MR_ruleNamePlusOffset( (Node *) alt2),
+ alt2->altnum,
+ alt2->line,
+ FileStr[alt2->file]);
+ fprintf(output," The original predicate for choice 2 with available context information:\n\n");
+ MR_dumpPred1(1,alt2->predicate,1);
+ fprintf(output," The predicate for choice 2 after expansion (but without context information):\n\n");
+ MR_dumpPred1(1,p2,0);
+ if (p2 == NULL) {
+ Predicate *phelp;
+ fprintf(output," The predicate for choice 2 after expansion (but before simplification)\n\n");
+ phelp=predicate_dup_without_context(alt2->predicate);
+ phelp=MR_unfold(phelp);
+ MR_clearPredEntry(phelp);
+ MR_simplifyInverted(phelp,0);
+ phelp=MR_predSimplifyALLX(phelp,1);
+ MR_dumpPred1(2,phelp,0);
+ predicate_free(phelp);
+ };
+ fprintf(output,"\n#endif\n");
+ };
+ } else if (MR_secondPredicateUnreachable(p1,p2)) {
+ if (jtype == aLoopBegin || jtype == aPlusBlk ) {
+ fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line);
+ fprintf(stderr," warning: %s of %s in rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s%s",
+ "the predicate used to disambiguate the first choice of the optional/exit paths of ",
+ sub,
+ CurRule,
+ FileStr[alt1->file],
+ alt1->altnum,
+ alt1->line,
+ alt2->altnum,
+ alt2->line,
+ " appears to \"cover\" the second predicate when compared without context.\n",
+ " The second predicate may have no resolving power for some lookahead sequences.\n");
+ } else {
+ fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line);
+ fprintf(stderr," warning: %s rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s%s",
+ "the predicate used to disambiguate the first choice of",
+ CurRule,
+ FileStr[alt1->file],
+ alt1->altnum,
+ alt1->line,
+ alt2->altnum,
+ alt2->line,
+ " appears to \"cover\" the second predicate when compared without context.\n",
+ " The second predicate may have no resolving power for some lookahead sequences.\n");
+ };
+ if (InfoP) {
+ fprintf(output,"\n#if 0\n\n");
+ fprintf(output,"The first predicate appears to \"cover\" the second predicate when they\n");
+ fprintf(output," are compared without lookahead context information. For some ambiguous\n");
+ fprintf(output," lookahead sequences the second predicate may not have any power to\n");
+ fprintf(output," resolve the ambiguity.\n");
+ fprintf(output,"\n");
+ fprintf(output,"Choice 1: %s alt %d line %d file %s\n\n",
+ MR_ruleNamePlusOffset( (Node *) alt1),
+ alt1->altnum,
+ alt1->line,
+ FileStr[alt1->file]);
+ fprintf(output," The original predicate for choice 1 with available context information:\n\n");
+ MR_dumpPred1(2,alt1->predicate,1);
+ fprintf(output," The predicate for choice 1 after expansion (but without context information):\n\n");
+ MR_dumpPred1(2,p1,0);
+ if (p1 == NULL) {
+ Predicate *phelp;
+ fprintf(output," The predicate for choice 1 after expansion (but before simplification)\n\n");
+ phelp=predicate_dup_without_context(alt1->predicate);
+ phelp=MR_unfold(phelp);
+ MR_clearPredEntry(phelp);
+ MR_simplifyInverted(phelp,0);
+ phelp=MR_predSimplifyALLX(phelp,1);
+ MR_dumpPred1(2,phelp,0);
+ predicate_free(phelp);
+ };
+ fprintf(output,"\n");
+
+ fprintf(output,"Choice 2: %s alt %d line %d file %s\n\n",
+ MR_ruleNamePlusOffset( (Node *) alt2),
+ alt2->altnum,
+ alt2->line,
+ FileStr[alt2->file]);
+ fprintf(output," The original predicate for choice 2 with available context information:\n\n");
+ MR_dumpPred1(1,alt2->predicate,1);
+ fprintf(output," The predicate for choice 2 after expansion (but without context information):\n\n");
+ MR_dumpPred1(1,p2,0);
+ if (p2 == NULL) {
+ Predicate *phelp;
+ fprintf(output," The predicate for choice 2 after expansion (but before simplification)\n\n");
+ phelp=predicate_dup_without_context(alt2->predicate);
+ phelp=MR_unfold(phelp);
+ MR_clearPredEntry(phelp);
+ MR_simplifyInverted(phelp,0);
+ phelp=MR_predSimplifyALLX(phelp,1);
+ MR_dumpPred1(2,phelp,0);
+ predicate_free(phelp);
+ };
+ fprintf(output,"\n#endif\n");
+ };
+ };
+ predicate_free(p1);
+ predicate_free(p2);
+ };
+}
+
+static int totalOverflow=0; /* MR9 */
+
+void
+#ifdef __USE_PROTOS
+HandleAmbiguity( Junction *block, Junction *alt1, Junction *alt2, int jtype )
+#else
+HandleAmbiguity( block, alt1, alt2, jtype )
+Junction *block;
+Junction *alt1;
+Junction *alt2;
+int jtype;
+#endif
+{
+ unsigned **ftbl;
+ set *fset, b;
+ int i, numAmbig,n2;
+ Tree *ambig=NULL, *t, *u;
+ char *sub = "";
+ long n;
+ int thisOverflow=0; /* MR9 */
+ long set_deg_value; /* MR10 */
+ long threshold; /* MR10 */
+
+ require(block!=NULL, "NULL block");
+ require(block->ntype==nJunction, "invalid block");
+
+ /* These sets are used to constrain LL_k set, but are made CLL_k long anyway */
+ fset = (set *) calloc(CLL_k+1, sizeof(set));
+ require(fset!=NULL, "cannot allocate fset");
+ ftbl = (unsigned **) calloc(CLL_k+1, sizeof(unsigned *));
+ require(ftbl!=NULL, "cannot allocate ftbl");
+
+ /* create constraint table and count number of possible ambiguities (use<=LL_k) */
+ for (n=1,i=1; i<=CLL_k; i++)
+ {
+ b = set_and(alt1->fset[i], alt2->fset[i]);
+/* MR9 */ set_deg_value = set_deg(b);
+/* MR10 */ if (n > 0) {
+/* MR10 */ threshold = LONG_MAX / n;
+/* MR10 */ if (set_deg_value <= threshold) {
+/* MR10 */ n *= set_deg_value;
+/* MR10 */ } else {
+/* MR10 */ n=LONG_MAX;
+/* MR9 */ if (totalOverflow == 0) {
+#if 0
+ /* MR10 comment this out because it just makes users worry */
+
+/* MR9 */ warnNoFL("Overflow in computing number of possible ambiguities in HandleAmbiguity\n");
+#endif
+/* MR9 */ };
+/* MR9 */ thisOverflow++;
+/* MR9 */ totalOverflow++;
+/* MR9 */ };
+/* MR10 */ } else {
+/* MR10 */ n *= set_deg_value;
+/* MR9 */ };
+ fset[i] = set_dup(b);
+ ftbl[i] = set_pdq(b);
+ set_free(b);
+ }
+
+ switch ( jtype )
+ {
+ case aSubBlk: sub = "of (..) "; break;
+ case aOptBlk: sub = "of {..} "; break;
+ case aLoopBegin: sub = "of (..)* "; break;
+ case aLoopBlk: sub = "of (..)* "; break;
+ case aPlusBlk: sub = "of (..)+ "; break;
+ case RuleBlk: sub = "of the rule itself "; break;
+ default : sub = ""; break;
+ }
+
+ /* If the block is marked as a compressed lookahead only block, then
+ * simply return; ambiguity warning is given only at warning level 2.
+ */
+ if ( block->approx>0 )
+ {
+ if ( ParseWithPredicates )
+ {
+ if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */
+ if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */
+
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1);
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed");
+ alt1->predicate=MR_predSimplifyALL(alt1->predicate);
+
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1);
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed");
+ alt2->predicate=MR_predSimplifyALL(alt2->predicate);
+
+ MR_doPredicatesHelp(0,alt1,alt2,jtype,sub);
+
+ if ( HoistPredicateContext
+ && (alt1->predicate!=NULL||alt2->predicate!=NULL) )
+ {
+ verify_context(alt1->predicate);
+ verify_context(alt2->predicate);
+ }
+
+ if ( HoistPredicateContext
+ && (alt1->predicate!=NULL||alt2->predicate!=NULL)
+ && WarningLevel>1 )
+ ensure_predicates_cover_ambiguous_lookahead_sequences(alt1, alt2, sub, ambig);
+ }
+
+ if ( WarningLevel>1 )
+ {
+ fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
+ if ( jtype == aLoopBegin || jtype == aPlusBlk )
+ fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub);
+ else
+ fprintf(stderr, " warning(approx): alts %d and %d %sambiguous upon",
+ alt1->altnum, alt2->altnum, sub);
+ dumpAmbigMsg(fset, stderr, 0);
+ MR_traceAmbSource(fset,alt1,alt2);
+ }
+ for (i=1; i<=CLL_k; i++) set_free( fset[i] );
+ free((char *)fset);
+ for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
+ free((char *)ftbl);
+ return;
+ }
+
+ /* if all sets have degree 1 for k<LL_k, then must be ambig upon >=1 permutation;
+ * don't bother doing full LL(k) analysis.
+ * (This "if" block handles the LL(1) case)
+ */
+
+ n2 = 0;
+ for (i=1; i<LL_k; i++) n2 += set_deg(alt1->fset[i])+set_deg(alt2->fset[i]);
+
+ /* here STARTS the special case in which the lookahead sets for alt1 and alt2
+ all have degree 1 for k<LL_k (including LL_k=1)
+ */
+
+ if ( n2==2*(LL_k-1) )
+ {
+
+ /* TJP: added to fix the case where LL(1) and syntactic predicates didn't
+ * work. It now recognizes syntactic predicates, but does not like combo:
+ * LL(1)/syn/sem predicates. (10/24/93)
+ */
+
+ if ( first_item_is_guess_block_extra((Junction *)alt1->p1)!=NULL )
+ {
+ if ( WarningLevel==1 )
+ {
+ for (i=1; i<=CLL_k; i++) set_free( fset[i] );
+ free((char *)fset);
+ for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
+ free((char *)ftbl);
+ return;
+ }
+
+ fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
+ if ( jtype == aLoopBegin || jtype == aPlusBlk )
+ fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub);
+ else
+ fprintf(stderr, " warning: alts %d and %d %sambiguous upon",
+ alt1->altnum, alt2->altnum, sub);
+ dumpAmbigMsg(fset, stderr, 0);
+ MR_traceAmbSource(fset,alt1,alt2);
+ }
+
+ ambig = NULL;
+ if ( LL_k>1 ) ambig = make_tree_from_sets(alt1->fset, alt2->fset);
+ if ( ParseWithPredicates )
+ {
+ if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */
+ if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */
+
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1);
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed");
+ alt1->predicate=MR_predSimplifyALL(alt1->predicate);
+
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1);
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed");
+ alt2->predicate=MR_predSimplifyALL(alt2->predicate);
+
+ MR_doPredicatesHelp(0,alt1,alt2,jtype,sub);
+
+ if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) )
+ {
+ verify_context(alt1->predicate);
+ verify_context(alt2->predicate);
+ }
+ if (HoistPredicateContext&&(alt1->predicate!=NULL||alt2->predicate!=NULL) && WarningLevel>1)
+ ensure_predicates_cover_ambiguous_lookahead_sequences(alt1, alt2, sub, ambig);
+ if ( WarningLevel == 1 &&
+ (alt1->predicate!=NULL||alt2->predicate!=NULL))
+ {
+ for (i=1; i<=CLL_k; i++) set_free( fset[i] );
+ free((char *)fset);
+ for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
+ free((char *)ftbl);
+ Tfree(ambig);
+ return;
+ }
+ }
+/* end TJP (10/24/93) */
+
+ fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
+ if ( jtype == aLoopBegin || jtype == aPlusBlk )
+ fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub);
+ else
+ fprintf(stderr, " warning: alts %d and %d %sambiguous upon",
+ alt1->altnum, alt2->altnum, sub);
+ if ( elevel == 3 && LL_k>1 )
+ {
+ preorder(ambig);
+ fprintf(stderr, "\n");
+ for (i=1; i<=CLL_k; i++) set_free( fset[i] );
+ free((char *)fset);
+ for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
+ free((char *)ftbl);
+ Tfree(ambig);
+ return;
+ };
+
+ Tfree(ambig);
+ dumpAmbigMsg(fset, stderr, 0);
+
+ /* because this is a special case in which both alt1 and alt2 have
+ lookahead sets of degree 1 for k<LL_k (including k=1) the linear
+ lookahead style search is adequate
+ */
+
+ MR_traceAmbSource(fset,alt1,alt2);
+
+ for (i=1; i<=CLL_k; i++) set_free( fset[i] );
+ free((char *)fset);
+ for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
+ free((char *)ftbl);
+ return;
+ }
+
+ /* here ENDS the special case in which the lookahead sets for alt1 and alt2
+ all have degree 1 for k<LL_k (including LL_k=1)
+ */
+
+ /* in case tree construction runs out of memory, set info to make good err msg */
+
+ CurAmbigAlt1 = alt1->altnum;
+ CurAmbigAlt2 = alt2->altnum;
+ CurAmbigbtype = sub;
+ CurAmbigfile = alt1->file;
+ CurAmbigline = alt1->line;
+
+ /* Don't do full LL(n) analysis if (...)? block because the block,
+ by definition, defies LL(n) analysis.
+ If guess (...)? block and ambiguous then don't remove anything from
+ 2nd alt to resolve ambig.
+ Want to predict with LL sup 1 ( n ) decision not LL(n) if guess block
+ since it is much cheaper than LL(n). LL sup 1 ( n ) "covers" the LL(n)
+ lookahead information.
+
+ Note: LL(n) context cannot be computed for semantic predicates when
+ followed by (..)?.
+
+ If (..)? then we scream "AAAHHHH! No LL(n) analysis will help"
+
+ Is 'ambig' always defined if we enter this if? I hope so
+ because the 'ensure...()' func references it. TJP Nov 1993.
+ */
+
+ /* THM MR30: Instead of using first_item_is_guss_block we use
+ first_item_is_guess_block_extra which will look inside a
+ loop block for a guess block. In other words ( (...)? )*.
+ It there is an ambiguity in this circumstance then we suppress
+ the normal methods of resolving ambiguities.
+ */
+
+ if ( first_item_is_guess_block_extra((Junction *)alt1->p1)!=NULL )
+ {
+ if ( ParseWithPredicates )
+ {
+ if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */
+ if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1);
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed");
+ alt1->predicate=MR_predSimplifyALL(alt1->predicate);
+
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1);
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed");
+ alt2->predicate=MR_predSimplifyALL(alt2->predicate);
+
+ MR_doPredicatesHelp(1,alt1,alt2,jtype,sub);
+
+ if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) )
+ {
+ verify_context(alt1->predicate);
+ verify_context(alt2->predicate);
+ }
+ if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) && WarningLevel>1 )
+ ensure_predicates_cover_ambiguous_lookahead_sequences(alt1, alt2, sub, ambig);
+ if ( WarningLevel==1 &&
+ (alt1->predicate!=NULL||alt2->predicate!=NULL))
+ {
+ for (i=1; i<=CLL_k; i++) set_free( fset[i] );
+ free((char *)fset);
+ for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
+ free((char *)ftbl);
+ return;
+ }
+ }
+
+ if ( WarningLevel>1 )
+ {
+ fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
+ if ( jtype == aLoopBegin || jtype == aPlusBlk )
+ fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub);
+ else
+ fprintf(stderr, " warning: alts %d and %d %sambiguous upon",
+ alt1->altnum, alt2->altnum, sub);
+ dumpAmbigMsg(fset, stderr, 0);
+ MR_traceAmbSource(fset,alt1,alt2);
+ }
+
+ for (i=1; i<=CLL_k; i++) set_free( fset[i] );
+ free((char *)fset);
+ for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
+ free((char *)ftbl);
+ return;
+ }
+
+ /* Not resolved with (..)? block. Do full LL(n) analysis */
+
+ /* ambig is the set of k-tuples truly in common between alt 1 and alt 2 */
+ /* MR11 VerifyAmbig once used fset destructively */
+
+ ambig = VerifyAmbig(alt1, alt2, ftbl, fset, &t, &u, &numAmbig);
+
+ /* are all things in intersection really ambigs? */
+
+ if (thisOverflow || numAmbig < n ) /* MR9 */
+ {
+ Tree *v;
+
+ /* remove ambig permutation from 2nd alternative to resolve ambig;
+ * We want to compute the set of artificial tuples, arising from
+ * LL sup 1 (n) compression, that collide with real tuples from the
+ * 2nd alternative. This is the set of "special case" tuples that
+ * the LL sup 1 (n) decision template maps incorrectly.
+ */
+
+ /* when generating code in genExpr() it does
+ *
+ * if ( genExprSets(j->fset) && !genExprTree(j->ftree)) {...
+ *
+ * Sooooo the j->ftree is the tree of alt2
+ * after removal of conflicts, not alt1 !
+ */
+
+ if ( ambig!=NULL )
+ {
+ /* at the top of ambig is an ALT node */
+
+ for (v=ambig->down; v!=NULL; v=v->right)
+ {
+ u = trm_perm(u, v); /* remove v FROM u */
+ }
+/* fprintf(stderr, "after rm alt2:"); preorder(u); fprintf(stderr, "\n");*/
+ }
+ Tfree( t );
+ alt1->ftree = tappend(alt1->ftree, u);
+ alt1->ftree = tleft_factor(alt1->ftree);
+ }
+
+ if ( ambig==NULL )
+ {
+ for (i=1; i<=CLL_k; i++) set_free( fset[i] );
+ free((char *)fset);
+ for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
+ free((char *)ftbl);
+ return;
+ }
+
+ ambig = tleft_factor(ambig);
+
+/* TJP:
+ * At this point, we surely have an LL(k) ambiguity. Check for predicates
+ */
+ if ( ParseWithPredicates )
+ {
+ if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */
+ if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1);
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed");
+ alt1->predicate=MR_predSimplifyALL(alt1->predicate);
+
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1);
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed");
+ alt2->predicate=MR_predSimplifyALL(alt2->predicate);
+
+ MR_doPredicatesHelp(0,alt1,alt2,jtype,sub);
+
+ if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) )
+ {
+ verify_context(alt1->predicate);
+ verify_context(alt2->predicate);
+ }
+ if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) && WarningLevel>1 )
+ ensure_predicates_cover_ambiguous_lookahead_sequences(alt1, alt2, sub, ambig);
+ if ( WarningLevel==1 &&
+ (alt1->predicate!=NULL||alt2->predicate!=NULL))
+ {
+
+ /* We found at least one pred for at least one of the alts;
+ * If warnings are low, just return.
+ */
+
+ Tfree(ambig);
+ for (i=1; i<=CLL_k; i++) set_free( fset[i] );
+ free((char *)fset);
+ for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
+ free((char *)ftbl);
+ return;
+ }
+ /* else we're gonna give a warning */
+ }
+/* end TJP addition */
+
+ fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
+ if ( jtype == aLoopBegin || jtype == aPlusBlk )
+ fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub);
+ else
+ fprintf(stderr, " warning: alts %d and %d %sambiguous upon",
+ alt1->altnum, alt2->altnum, sub);
+ if ( elevel == 3 )
+ {
+ preorder(ambig->down); /* <===== k>1 ambiguity message data */
+ fprintf(stderr, "\n");
+ } else {
+ MR_skipped_e3_report=1;
+ dumpAmbigMsg(fset, stderr, 0);
+ };
+
+ MR_traceAmbSourceK(ambig,alt1,alt2); /* <====== k>1 ambiguity aid */
+
+ Tfree(ambig);
+
+ for (i=1; i<=CLL_k; i++) set_free( fset[i] );
+ free((char *)fset);
+ for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
+ free((char *)ftbl);
+}
+
+/* Don't analyze alpha block of (alpha)?beta; if (alpha)? then analyze
+ * Return the 1st node of the beta block if present else return j.
+ */
+Junction *
+#ifdef __USE_PROTOS
+analysis_point( Junction *j )
+#else
+analysis_point( j )
+Junction *j;
+#endif
+{
+ Junction *gblock;
+
+ /* MR13b When there was an action/predicate preceding a guess block
+ the guess block became invisible at the analysis_point.
+
+ first_item_is_guess_block accepts any kind of node,
+ despite the fact that the formal is a junction. But
+ I don't want to have to change it all over the place
+ until I know it works.
+ */
+
+ if ( j->ntype != nJunction && j->ntype != nAction) return j;
+
+ gblock = first_item_is_guess_block((Junction *)j);
+
+ if ( gblock!=NULL )
+ {
+ Junction *past = gblock->end;
+ Junction *p;
+ require(past!=NULL, "analysis_point: no end block on (...)? block");
+
+ for (p=(Junction *)past->p1; p!=NULL; )
+ {
+ if ( p->ntype==nAction )
+ {
+ p=(Junction *)((ActionNode *)p)->next;
+ continue;
+ }
+ if ( p->ntype!=nJunction )
+ {
+ past->alpha_beta_guess_end=1; /* MR14 */
+ return (Junction *)past->p1;
+ }
+ if ( p->jtype==EndBlk || p->jtype==EndRule )
+ {
+ return j;
+ }
+/* MR6 */
+/* MR6 A guess block is of the form "(alpha)? beta" or "(alpha)?". */
+/* MR6 When beta is omitted (second form) this means "(alpha)? alpha". */
+/* MR6 The program does not store another copy of alpha in this case. */
+/* MR6 During analysis when the program needs to know what follows the */
+/* MR6 guess clause. It calls this routine. */
+/* MR6 */
+/* MR6 If it is of the form "(alpha)? beta" it returns a pointer to beta.*/
+/* MR6 */
+/* MR6 If it is of the form "(alpha)?" it returns a pointer to the guess */
+/* MR6 block itself thereby reusing the junction tree. */
+/* MR6 */
+/* MR6 It works by searching the "next in sequence" chain (skipping actions) */
+/* MR6 searching for a RuleRef or Token node. (Those are the only 4 kinds */
+/* MR6 of nodes: Junctions, RuleRef, Token, and Action.) */
+/* MR6 */
+/* MR6 This won't work for the special case "(alpha)? ()" because it has no */
+/* MR6 rule references or token nodes. It eventually encounters a */
+/* MR6 junction of type EndBlk or EndRule and says to its caller: nothing */
+/* MR6 more here to analyze - must be of the form "(alpha)?". */
+/* MR6 */
+/* MR6 In the case of "(alpha)? ()" it should return a pointer to "()" */
+/* MR6 */
+/* MR6 I think. */
+/* MR6 */
+ if ( p->jtype!=Generic) { /* MR6 */
+ past->alpha_beta_guess_end=1; /* MR14 */
+ return (Junction *)past->p1; /* MR6 */
+ }; /* MR6 */
+ p=(Junction *)p->p1;
+ }
+ }
+ return j;
+}
+
+set
+#ifdef __USE_PROTOS
+First( Junction *j, int k, int jtype, int *max_k )
+#else
+First( j, k, jtype, max_k )
+Junction *j;
+int k;
+int jtype;
+int *max_k;
+#endif
+{
+ Junction *alt1, *alt2;
+ set a, rk, fCurBlk;
+ int savek;
+ int p1, p2;
+
+ int save_maintainBackTrace;
+
+ require(j->ntype==nJunction, "First: non junction passed");
+
+ /* C o m p u t e F I R S T s e t w i t h k l o o k a h e a d */
+ fCurBlk = rk = empty;
+ for (alt1=j; alt1!=NULL; alt1 = (Junction *)alt1->p2 )
+ {
+ Junction * p = NULL;
+ Junction * p1junction = NULL;
+ p = analysis_point((Junction *)alt1->p1);
+ p1junction = (Junction *) (alt1->p1);
+#if 0
+ if (p != p1junction) {
+ fprintf(stdout,"Analysis point for #%d is #%d", p1junction->seq, p->seq); /* debug */
+ }
+#endif
+ REACH(p, k, &rk, alt1->fset[k]);
+ require(set_nil(rk), "rk != nil");
+ set_free(rk);
+ set_orin(&fCurBlk, alt1->fset[k]);
+ }
+
+ /* D e t e c t A m b i g u i t i e s */
+ *max_k = 1;
+ for (p1=1,alt1=j; alt1!=NULL; alt1 = (Junction *)alt1->p2, p1++)
+ {
+ for (p2=1,alt2=(Junction *)alt1->p2; alt2!=NULL; alt2 = (Junction *)alt2->p2, p2++)
+ {
+ savek = k;
+ a = set_and(alt1->fset[k], alt2->fset[k]);
+ while ( !set_nil(a) )
+ {
+ /* if we have hit the max k requested, just give warning */
+ if ( j->approx==k ) {
+ }
+
+ if ( k==CLL_k )
+ {
+#ifdef NOT_USED
+*** int save_LL_k = LL_k;
+*** int save_CLL_k = CLL_k;
+*** /* Get new LL_k from interactive feature if enabled */
+*** if ( AImode )
+*** AmbiguityDialog(j, jtype, alt1, alt2, &CLL_k, &LL_k);
+#endif
+ *max_k = CLL_k;
+ save_maintainBackTrace=MR_MaintainBackTrace;
+ if (AlphaBetaTrace) MR_MaintainBackTrace=0;
+ HandleAmbiguity(j, alt1, alt2, jtype);
+ MR_MaintainBackTrace=save_maintainBackTrace;
+ break;
+ }
+ else
+ {
+ Junction *p = analysis_point((Junction *)alt1->p1);
+ Junction *q = analysis_point((Junction *)alt2->p1);
+ k++; /* attempt ambig alts again with more lookahead */
+
+ REACH(p, k, &rk, alt1->fset[k]);
+ require(set_nil(rk), "rk != nil");
+ REACH(q, k, &rk, alt2->fset[k]);
+ require(set_nil(rk), "rk != nil");
+ set_free(a);
+ a = set_and(alt1->fset[k], alt2->fset[k]);
+ if ( k > *max_k ) *max_k = k;
+ }
+ }
+ set_free(a);
+ k = savek;
+ }
+ }
+
+ return fCurBlk;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c
new file mode 100644
index 000000000..8a4823a05
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c
@@ -0,0 +1,2250 @@
+/*
+ * fset2.c
+ *
+ * Compute FIRST sets for full LL(k)
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include "pcctscfg.h"
+#include <stdlib.h>
+
+#ifdef PCCTS_USE_STDARG
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#include "dlgdef.h"
+
+/* ick! globals. Used by permute() to track which elements of a set have been used */
+
+static int *findex;
+set *fset; /* MR11 make global */
+static unsigned **ftbl;
+static set *constrain; /* pts into fset. constrains tToken() to 'constrain' */
+int ConstrainSearch;
+int maxk; /* set to initial k upon tree construction request */
+ /* MR11 make global */
+static Tree *FreeList = NULL;
+
+#ifdef __USE_PROTOS
+static int tmember_of_context(Tree *, Predicate *);
+#else
+static int tmember_of_context();
+#endif
+
+#if TREE_DEBUG
+set set_of_tnodes_in_use;
+int stop_on_tnode_seq_number=(-1); /* (-1) to disable */
+#endif
+
+/* Do root
+ * Then each sibling
+ */
+
+void
+#ifdef __USE_PROTOS
+preorder( Tree *tree )
+#else
+preorder( tree )
+Tree *tree;
+#endif
+{
+ if ( tree == NULL ) return;
+ if ( tree->down != NULL ) fprintf(stderr, " (");
+ if ( tree->token == ALT ) fprintf(stderr, " ALT");
+ else fprintf(stderr, " %s", TerminalString(tree->token));
+ if ( tree->token==EpToken ) fprintf(stderr, "(%d)", tree->v.rk);
+ preorder(tree->down);
+ if ( tree->down != NULL ) fprintf(stderr, " )");
+ preorder(tree->right);
+}
+
+#ifdef __USE_PROTOS
+int MR_tree_matches_constraints(int k,set * constrain,Tree *t)
+#else
+int MR_tree_matches_constraints(k,constrain,t)
+ int k;
+ set * constrain;
+ Tree * t;
+#endif
+{
+ int i;
+ Tree *u;
+
+ if (k == 0) return 1;
+
+ /* for testing guard predicates: if the guard tree is shorter
+ than the constraint then it is a match. The reason is that
+ a guard of (A B) should be equivalent to a guard of (A B . . .)
+ where "." matches every token. Thus a match which runs out
+ of tree before constraint is a match.
+ */
+
+ if (t == NULL) return 1;
+ require (set_deg(constrain[0]) == 1,
+ "MR_tree_matches_constraints: set_deg != 1");
+ i=set_int(constrain[0]);
+ if (t->token != i) return 0;
+ if (k-1 == 0) return 1;
+ for (u=t->down; u != NULL; u=u->right) {
+ if (MR_tree_matches_constraints(k-1,&constrain[1],u)) {
+ return 1;
+ };
+ };
+ return 0;
+}
+
+/* check the depth of each primary sibling to see that it is exactly
+ * k deep. e.g.;
+ *
+ * ALT
+ * |
+ * A ------- B
+ * | |
+ * C -- D E
+ *
+ * Remove all branches <= k deep.
+ *
+ * Added by TJP 9-23-92 to make the LL(k) constraint mechanism to work.
+ */
+
+static int pruneCount=0;
+static int prunePeak=200;
+
+Tree *
+#ifdef __USE_PROTOS
+prune( Tree *t, int k )
+#else
+prune( t, k )
+Tree *t;
+int k;
+#endif
+{
+ pruneCount++;
+ if (pruneCount > prunePeak+100) {
+ prunePeak=pruneCount;
+#if 0
+*** fprintf(stderr,"pruneCount=%d\n",pruneCount);
+/*** preorder(t); ***/
+*** fprintf(stderr,"\n",pruneCount);
+#endif
+ };
+ if ( t == NULL ) {
+ pruneCount--;
+ return NULL;
+ };
+ if ( t->token == ALT ) fatal_internal("prune: ALT node in FIRST tree");
+ if ( t->right!=NULL ) t->right = prune(t->right, k);
+ if ( k>1 )
+ {
+ if ( t->down!=NULL ) t->down = prune(t->down, k-1);
+ if ( t->down == NULL )
+ {
+ Tree *r = t->right;
+ t->right = NULL;
+ Tfree(t);
+ pruneCount--;
+ return r;
+ }
+ }
+ pruneCount--;
+ return t;
+}
+
+/* build a tree (root child1 child2 ... NULL) */
+#ifdef PCCTS_USE_STDARG
+Tree *tmake(Tree *root, ...)
+#else
+Tree *tmake(va_alist)
+va_dcl
+#endif
+{
+ Tree *w;
+ va_list ap;
+ Tree *child, *sibling=NULL, *tail=NULL;
+#ifndef PCCTS_USE_STDARG
+ Tree *root;
+#endif
+
+#ifdef PCCTS_USE_STDARG
+ va_start(ap, root);
+#else
+ va_start(ap);
+ root = va_arg(ap, Tree *);
+#endif
+ child = va_arg(ap, Tree *);
+ while ( child != NULL )
+ {
+#ifdef DUM
+ /* added "find end of child" thing TJP March 1994 */
+ for (w=child; w->right!=NULL; w=w->right) {;} /* find end of child */
+#else
+ w = child;
+#endif
+
+ if ( sibling == NULL ) {sibling = child; tail = w;}
+ else {tail->right = child; tail = w;}
+ child = va_arg(ap, Tree *);
+ }
+
+ /* was "root->down = sibling;" */
+ if ( root==NULL ) root = sibling;
+ else root->down = sibling;
+
+ va_end(ap);
+ return root;
+}
+
+Tree *
+#ifdef __USE_PROTOS
+tnode( int tok )
+#else
+tnode( tok )
+int tok;
+#endif
+{
+ Tree *p, *newblk;
+ static int n=0;
+
+ if ( FreeList == NULL )
+ {
+ /*fprintf(stderr, "tnode: %d more nodes\n", TreeBlockAllocSize);*/
+ if ( TreeResourceLimit > 0 )
+ {
+ if ( (n+TreeBlockAllocSize) >= TreeResourceLimit )
+ {
+ fprintf(stderr, ErrHdr, FileStr[CurAmbigfile], CurAmbigline);
+ fprintf(stderr, " hit analysis resource limit while analyzing alts %d and %d %s\n",
+ CurAmbigAlt1,
+ CurAmbigAlt2,
+ CurAmbigbtype);
+ exit(PCCTS_EXIT_FAILURE);
+ }
+ }
+ newblk = (Tree *)calloc(TreeBlockAllocSize, sizeof(Tree));
+ if ( newblk == NULL )
+ {
+ fprintf(stderr, ErrHdr, FileStr[CurAmbigfile], CurAmbigline);
+ fprintf(stderr, " out of memory while analyzing alts %d and %d %s\n",
+ CurAmbigAlt1,
+ CurAmbigAlt2,
+ CurAmbigbtype);
+ exit(PCCTS_EXIT_FAILURE);
+ }
+ n += TreeBlockAllocSize;
+ for (p=newblk; p<&(newblk[TreeBlockAllocSize]); p++)
+ {
+ p->right = FreeList; /* add all new Tree nodes to Free List */
+ FreeList = p;
+ }
+ }
+ p = FreeList;
+ FreeList = FreeList->right; /* remove a tree node */
+ p->right = NULL; /* zero out ptrs */
+ p->down = NULL;
+ p->token = tok;
+
+ TnodesAllocated++; /* MR10 */
+ TnodesInUse++; /* MR10 */
+ if (TnodesInUse > TnodesPeak) TnodesPeak=TnodesInUse; /* MR10 */
+
+#ifdef TREE_DEBUG
+ require(!p->in_use, "tnode: node in use!");
+ p->in_use = 1;
+ p->seq=TnodesAllocated;
+ set_orel( (unsigned) TnodesAllocated,&set_of_tnodes_in_use);
+ if (stop_on_tnode_seq_number == p->seq) {
+ fprintf(stderr,"\n*** just allocated tnode #%d ***\n",
+ stop_on_tnode_seq_number);
+ };
+#endif
+ return p;
+}
+
+static Tree *
+#ifdef __USE_PROTOS
+eofnode( int k )
+#else
+eofnode( k )
+int k;
+#endif
+{
+ Tree *t=NULL;
+ int i;
+
+ for (i=1; i<=k; i++)
+ {
+ t = tmake(tnode((TokenInd!=NULL?TokenInd[EofToken]:EofToken)), t, NULL);
+ }
+ return t;
+}
+
+
+
+void
+#ifdef __USE_PROTOS
+_Tfree( Tree *t )
+#else
+_Tfree( t )
+Tree *t;
+#endif
+{
+ if ( t!=NULL )
+ {
+#ifdef TREE_DEBUG
+ if (t->seq == stop_on_tnode_seq_number) {
+ fprintf(stderr,"\n*** just freed tnode #%d ***\n",t->seq);
+ };
+ require(t->in_use, "_Tfree: node not in use!");
+ t->in_use = 0;
+ set_rm( (unsigned) t->seq,set_of_tnodes_in_use);
+#endif
+ t->right = FreeList;
+ FreeList = t;
+ TnodesInUse--; /* MR10 */
+ }
+}
+
+/* tree duplicate */
+Tree *
+#ifdef __USE_PROTOS
+tdup( Tree *t )
+#else
+tdup( t )
+Tree *t;
+#endif
+{
+ Tree *u;
+
+ if ( t == NULL ) return NULL;
+ u = tnode(t->token);
+ u->v.rk = t->v.rk;
+ u->right = tdup(t->right);
+ u->down = tdup(t->down);
+ return u;
+}
+
+/* tree duplicate (assume tree is a chain downwards) */
+Tree *
+#ifdef __USE_PROTOS
+tdup_chain( Tree *t )
+#else
+tdup_chain( t )
+Tree *t;
+#endif
+{
+ Tree *u;
+
+ if ( t == NULL ) return NULL;
+ u = tnode(t->token);
+ u->v.rk = t->v.rk;
+ u->down = tdup(t->down);
+ return u;
+}
+
+Tree *
+#ifdef __USE_PROTOS
+tappend( Tree *t, Tree *u )
+#else
+tappend( t, u )
+Tree *t;
+Tree *u;
+#endif
+{
+ Tree *w;
+
+/*** fprintf(stderr, "tappend(");
+ *** preorder(t); fprintf(stderr, ",");
+ *** preorder(u); fprintf(stderr, " )\n");
+*/
+ if ( t == NULL ) return u;
+ if ( t->token == ALT && t->right == NULL ) return tappend(t->down, u);
+ for (w=t; w->right!=NULL; w=w->right) {;}
+ w->right = u;
+ return t;
+}
+
+/* dealloc all nodes in a tree */
+void
+#ifdef __USE_PROTOS
+Tfree( Tree *t )
+#else
+Tfree( t )
+Tree *t;
+#endif
+{
+ if ( t == NULL ) return;
+ Tfree( t->down );
+ Tfree( t->right );
+ _Tfree( t );
+}
+
+/* find all children (alts) of t that require remaining_k nodes to be LL_k
+ * tokens long.
+ *
+ * t-->o
+ * |
+ * a1--a2--...--an <-- LL(1) tokens
+ * | | |
+ * b1 b2 ... bn <-- LL(2) tokens
+ * | | |
+ * . . .
+ * . . .
+ * z1 z2 ... zn <-- LL(LL_k) tokens
+ *
+ * We look for all [Ep] needing remaining_k nodes and replace with u.
+ * u is not destroyed or actually used by the tree (a copy is made).
+ */
+Tree *
+#ifdef __USE_PROTOS
+tlink( Tree *t, Tree *u, int remaining_k )
+#else
+tlink( t, u, remaining_k )
+Tree *t;
+Tree *u;
+int remaining_k;
+#endif
+{
+ Tree *p;
+ require(remaining_k!=0, "tlink: bad tree");
+
+ if ( t==NULL ) return NULL;
+ /*fprintf(stderr, "tlink: u is:"); preorder(u); fprintf(stderr, "\n");*/
+ if ( t->token == EpToken && t->v.rk == remaining_k )
+ {
+ require(t->down==NULL, "tlink: invalid tree");
+ if ( u == NULL ) {
+/* MR10 */ Tree *tt=t->right;
+/* MR10 */ _Tfree(t);
+/* MR10 */ return tt;
+ };
+ p = tdup( u );
+ p->right = t->right;
+ _Tfree( t );
+ return p;
+ }
+ t->down = tlink(t->down, u, remaining_k);
+ t->right = tlink(t->right, u, remaining_k);
+ return t;
+}
+
+/* remove as many ALT nodes as possible while still maintaining semantics */
+Tree *
+#ifdef __USE_PROTOS
+tshrink( Tree *t )
+#else
+tshrink( t )
+Tree *t;
+#endif
+{
+ if ( t == NULL ) return NULL;
+ t->down = tshrink( t->down );
+ t->right = tshrink( t->right );
+ if ( t->down == NULL )
+ {
+ if ( t->token == ALT )
+ {
+ Tree *u = t->right;
+ _Tfree(t);
+ return u; /* remove useless alts */
+ }
+ return t;
+ }
+
+ /* (? (ALT (? ...)) s) ==> (? (? ...) s) where s = sibling, ? = match any */
+ if ( t->token == ALT && t->down->right == NULL)
+ {
+ Tree *u = t->down;
+ u->right = t->right;
+ _Tfree( t );
+ return u;
+ }
+ /* (? (A (ALT t)) s) ==> (? (A t) s) where A is a token; s,t siblings */
+ if ( t->token != ALT && t->down->token == ALT && t->down->right == NULL )
+ {
+ Tree *u = t->down->down;
+ _Tfree( t->down );
+ t->down = u;
+ return t;
+ }
+ return t;
+}
+
+Tree *
+#ifdef __USE_PROTOS
+tflatten( Tree *t )
+#else
+tflatten( t )
+Tree *t;
+#endif
+{
+ if ( t == NULL ) return NULL;
+ t->down = tflatten( t->down );
+ t->right = tflatten( t->right );
+ if ( t->down == NULL ) return t;
+
+ if ( t->token == ALT )
+ {
+ Tree *u;
+ /* find tail of children */
+ for (u=t->down; u->right!=NULL; u=u->right) {;}
+ u->right = t->right;
+ u = t->down;
+ _Tfree( t );
+ return u;
+ }
+ return t;
+}
+
+Tree *
+#ifdef __USE_PROTOS
+tJunc( Junction *p, int k, set *rk )
+#else
+tJunc( p, k, rk )
+Junction *p;
+int k;
+set *rk;
+#endif
+{
+ Tree *t=NULL, *u=NULL;
+ Junction *alt;
+ Tree *tail=NULL, *r;
+
+#ifdef DBG_TRAV
+ fprintf(stderr, "tJunc(%d): %s in rule %s\n", k,
+ decodeJType[p->jtype], ((Junction *)p)->rname);
+#endif
+
+/* MR14 */ if (AlphaBetaTrace && p->alpha_beta_guess_end) {
+/* MR14 */ warnFL(
+/* MR14 */ "not possible to compute follow set for alpha in an \"(alpha)? beta\" block. ",
+/* MR14 */ FileStr[p->file],p->line);
+/* MR14 */ MR_alphaBetaTraceReport();
+/* MR14 */ };
+
+/* MR14 */ if (p->alpha_beta_guess_end) {
+/* MR14 */ return NULL;
+/* MR14 */ }
+
+ if ( p->jtype==aLoopBlk || p->jtype==RuleBlk ||
+ p->jtype==aPlusBlk || p->jtype==aSubBlk || p->jtype==aOptBlk )
+ {
+ if ( p->jtype!=aSubBlk && p->jtype!=aOptBlk ) {
+ require(p->lock!=NULL, "rJunc: lock array is NULL");
+ if ( p->lock[k] ) return NULL;
+ p->lock[k] = TRUE;
+ }
+
+/* MR10 */ if (MR_MaintainBackTrace) {
+/* MR10 */ if (p->jtype != Generic) MR_pointerStackPush(&MR_BackTraceStack,p);
+/* MR10 */ };
+
+ TRAV(p->p1, k, rk, tail);
+
+/* MR10 */ if (MR_MaintainBackTrace) {
+/* MR10 */ if (p->jtype != Generic) MR_pointerStackPop(&MR_BackTraceStack);
+/* MR10 */ };
+
+ if ( p->jtype==RuleBlk ) {p->lock[k] = FALSE; return tail;}
+ r = tmake(tnode(ALT), tail, NULL);
+ for (alt=(Junction *)p->p2; alt!=NULL; alt = (Junction *)alt->p2)
+ {
+ /* if this is one of the added optional alts for (...)+ then break */
+ if ( alt->ignore ) break;
+
+ if ( tail==NULL ) {TRAV(alt->p1, k, rk, tail); r->down = tail;}
+ else
+ {
+/* MR10 */ if (MR_MaintainBackTrace) {
+/* MR10 */ if (p->jtype != Generic) MR_pointerStackPush(&MR_BackTraceStack,p);
+/* MR10 */ };
+
+ TRAV(alt->p1, k, rk, tail->right);
+
+/* MR10 */ if (MR_MaintainBackTrace) {
+/* MR10 */ if (p->jtype != Generic) MR_pointerStackPop(&MR_BackTraceStack);
+/* MR10 */ };
+ if ( tail->right != NULL ) tail = tail->right;
+ }
+ }
+ if ( p->jtype!=aSubBlk && p->jtype!=aOptBlk ) p->lock[k] = FALSE;
+#ifdef DBG_TREES
+ fprintf(stderr, "blk(%s) returns:",((Junction *)p)->rname); preorder(r); fprintf(stderr, "\n");
+#endif
+ if ( r->down == NULL ) {_Tfree(r); return NULL;}
+ return r;
+ }
+
+ if ( p->jtype==EndRule )
+ {
+ if ( p->halt ) /* don't want FOLLOW here? */
+ {
+/**** if ( ContextGuardTRAV ) return NULL; ****/
+ set_orel( (unsigned) k, rk); /* indicate this k value needed */ /* MR10 cast */
+ t = tnode(EpToken);
+ t->v.rk = k;
+ return t;
+ }
+ require(p->lock!=NULL, "rJunc: lock array is NULL");
+ if ( p->lock[k] ) return NULL;
+ /* if no FOLLOW assume k EOF's */
+ if ( p->p1 == NULL ) return eofnode(k);
+ p->lock[k] = TRUE;
+ }
+
+/* MR14 */ if (p->p1 != NULL && p->guess && p->guess_analysis_point == NULL) {
+/* MR14 */ Node * guess_point;
+/* MR14 */ guess_point=(Node *)analysis_point(p);
+/* MR14 */ if (guess_point == (Node *)p) {
+/* MR14 */ guess_point=p->p1;
+/* MR14 */ }
+/* MR14 */ p->guess_analysis_point=guess_point;
+/* MR14 */ }
+
+ if ( p->p2 == NULL )
+ {
+
+/* MR10 */ if (MR_MaintainBackTrace) {
+/* MR10 */ if (p->jtype != Generic) MR_pointerStackPush(&MR_BackTraceStack,p);
+/* MR10 */ };
+
+/* M14 */ if (p->guess_analysis_point != NULL) {
+/* M14 */ TRAV(p->guess_analysis_point, k, rk,t);
+/* M14 */ } else {
+ TRAV(p->p1, k, rk,t);
+/* M14 */ }
+
+/* MR10 */ if (MR_MaintainBackTrace) {
+/* MR10 */ if (p->jtype != Generic) MR_pointerStackPop(&MR_BackTraceStack);
+/* MR10 */ };
+
+ if ( p->jtype==EndRule ) p->lock[k]=FALSE;
+ return t;
+ }
+
+/* MR10 */ if (MR_MaintainBackTrace) {
+/* MR10 */ if (p->jtype != Generic) MR_pointerStackPush(&MR_BackTraceStack,p);
+/* MR10 */ };
+
+/* M14 */ if (p->guess_analysis_point != NULL) {
+/* M14 */ TRAV(p->guess_analysis_point, k, rk,t);
+/* M14 */ } else {
+ TRAV(p->p1, k, rk,t);
+/* M14 */ }
+
+/* MR10 */ if (MR_MaintainBackTrace) {
+/* MR10 */ if (p->jtype != Generic) MR_pointerStackPop(&MR_BackTraceStack);
+/* MR10 */ };
+
+ if ( p->jtype!=RuleBlk && /* MR14 */ !p->guess) TRAV(p->p2, k, rk, u);
+
+ if ( p->jtype==EndRule ) p->lock[k] = FALSE;/* unlock node */
+
+ if ( t==NULL ) return tmake(tnode(ALT), u, NULL);
+ return tmake(tnode(ALT), t, u, NULL);
+}
+
+Tree *
+#ifdef __USE_PROTOS
+tRuleRef( RuleRefNode *p, int k, set *rk_out )
+#else
+tRuleRef( p, k, rk_out )
+RuleRefNode *p;
+int k;
+set *rk_out;
+#endif
+{
+ int k2;
+ Tree *t=NULL, *u=NULL;
+ Junction *r;
+ set rk, rk2;
+ int save_halt;
+ RuleEntry *q = (RuleEntry *) hash_get(Rname, p->text);
+
+#ifdef DBG_TRAV
+ fprintf(stderr, "tRuleRef: %s\n", p->text);
+#endif
+ if ( q == NULL )
+ {
+ TRAV(p->next, k, rk_out, t);/* ignore undefined rules */
+ return t;
+ }
+ rk = rk2 = empty;
+ if (RulePtr == NULL) fatal("RulePtr==NULL");
+ r = RulePtr[q->rulenum];
+ if ( r->lock[k] ) return NULL;
+ save_halt = r->end->halt;
+ r->end->halt = TRUE; /* don't let reach fall off end of rule here */
+
+/* MR10 */ if (MR_MaintainBackTrace) {
+/* MR10 */ MR_pointerStackPush(&MR_BackTraceStack,p);
+/* MR10 */ };
+
+ TRAV(r, k, &rk, t);
+
+/* MR10 */ if (MR_MaintainBackTrace) {
+/* MR10 */ MR_pointerStackPop(&MR_BackTraceStack);
+/* MR10 */ };
+
+ r->end->halt = save_halt;
+#ifdef DBG_TREES
+ fprintf(stderr, "after ruleref, t is:"); preorder(t); fprintf(stderr, "\n");
+#endif
+ t = tshrink( t );
+ while ( !set_nil(rk) ) { /* any k left to do? if so, link onto tree */
+ k2 = set_int(rk);
+ set_rm(k2, rk);
+
+/* MR10 */ if (MR_MaintainBackTrace) {
+/* MR10 */ MR_pointerStackPush(&MR_BackTraceStack,p);
+/* MR10 */ };
+
+ TRAV(p->next, k2, &rk2, u);
+
+/* MR10 */ if (MR_MaintainBackTrace) {
+/* MR10 */ MR_pointerStackPop(&MR_BackTraceStack);
+/* MR10 */ };
+
+ t = tlink(t, u, k2); /* any alts missing k2 toks, add u onto end */
+ Tfree(u); /* MR10 */
+ }
+ set_free(rk); /* rk is empty, but free its memory */
+ set_orin(rk_out, rk2); /* remember what we couldn't do */
+ set_free(rk2);
+ return t;
+}
+
+Tree *
+#ifdef __USE_PROTOS
+tToken( TokNode *p, int k, set *rk )
+#else
+tToken( p, k, rk )
+TokNode *p;
+int k;
+set *rk;
+#endif
+{
+ Tree *t=NULL, *tset=NULL, *u;
+
+ if (ConstrainSearch) {
+ if (MR_AmbSourceSearch) {
+ require(constrain>=fset&&constrain<=&(fset[CLL_k]),"tToken: constrain is not a valid set");
+ } else {
+ require(constrain>=fset&&constrain<=&(fset[LL_k]),"tToken: constrain is not a valid set");
+ };
+ constrain = &fset[maxk-k+1];
+ }
+
+#ifdef DBG_TRAV
+ fprintf(stderr, "tToken(%d): %s\n", k, TerminalString(p->token));
+ if ( ConstrainSearch ) {
+ fprintf(stderr, "constrain is:"); s_fprT(stderr, *constrain); fprintf(stderr, "\n");
+ }
+#endif
+
+ /* is it a meta token (set of tokens)? */
+
+ if ( !set_nil(p->tset) )
+ {
+ unsigned e=0;
+ set a;
+ Tree *n, *tail = NULL;
+
+ if ( ConstrainSearch ) {
+ a = set_and(p->tset, *constrain);
+ if (set_nil(a)) { /* MR10 */
+ set_free(a); /* MR11 */
+ return NULL; /* MR10 */
+ }; /* MR10 */
+ } else {
+ a = set_dup(p->tset);
+ };
+
+ for (; !set_nil(a); set_rm(e, a))
+ {
+ e = set_int(a);
+ n = tnode(e);
+ if ( tset==NULL ) { tset = n; tail = n; }
+ else { tail->right = n; tail = n; }
+ }
+ set_free( a );
+ }
+ else if ( ConstrainSearch && !set_el(p->token, *constrain) )
+ {
+/* fprintf(stderr, "ignoring token %s(%d)\n", TerminalString(p->token),
+ k);*/
+ return NULL;
+ }
+ else {
+ tset = tnode( p->token );
+ };
+
+/* MR10 */ if (MR_MaintainBackTrace) {
+/* MR10 */ if (k == 1) {
+/* MR10 */ MR_pointerStackPush(&MR_BackTraceStack,p);
+/* MR13 */ if (MR_SuppressSearch) {
+/* MR13 */ MR_suppressSearchReport();
+/* MR13 */ } else {
+/* MR10 */ MR_backTraceReport();
+/* MR13 */ };
+/* MR10 */ MR_pointerStackPop(&MR_BackTraceStack);
+/* MR11 */ Tfree(tset);
+/* MR11 */ return NULL;
+/* MR10 */ };
+/* MR10 */ };
+
+ if ( k == 1 ) return tset;
+
+ if (MR_MaintainBackTrace) {
+ MR_pointerStackPush(&MR_BackTraceStack,p);
+ };
+
+ TRAV(p->next, k-1, rk, t);
+
+ if (MR_MaintainBackTrace) {
+ Tfree(t);
+ Tfree(tset);
+ MR_pointerStackPop(&MR_BackTraceStack);
+ return NULL;
+ };
+
+ /* here, we are positive that, at least, this tree will not contribute
+ * to the LL(2) tree since it will be too shallow, IF t==NULL.
+ * If doing a context guard walk, then don't prune.
+ */
+ if ( t == NULL && !ContextGuardTRAV ) /* tree will be too shallow */
+ {
+ if ( tset!=NULL ) Tfree( tset );
+ return NULL;
+ }
+#ifdef DBG_TREES
+ fprintf(stderr, "tToken(%d)->next:",k); preorder(t); fprintf(stderr, "\n");
+#endif
+
+ /* if single token root, then just make new tree and return */
+ /* MR10 - set_nil(p->tset) isn't a good test because of ConstraintSearch */
+
+ if (tset->right == NULL) return tmake(tset, t, NULL); /* MR10 */
+
+ /* here we must make a copy of t as a child of each element of the tset;
+ * e.g., "T1..T3 A" would yield ( nil ( T1 A ) ( T2 A ) ( T3 A ) )
+ */
+ for (u=tset; u!=NULL; u=u->right)
+ {
+ /* make a copy of t and hook it onto bottom of u */
+ u->down = tdup(t);
+ }
+ Tfree( t );
+#ifdef DBG_TREES
+ fprintf(stderr, "range is:"); preorder(tset); fprintf(stderr, "\n");
+#endif
+ return tset;
+}
+
+Tree *
+#ifdef __USE_PROTOS
+tAction( ActionNode *p, int k, set *rk )
+#else
+tAction( p, k, rk )
+ActionNode *p;
+int k;
+set *rk;
+#endif
+{
+ Tree *t=NULL;
+ set *save_fset=NULL;
+ int i;
+
+ /* fprintf(stderr, "tAction\n"); */
+
+/* An MR_SuppressSearch is looking for things that can be
+ reached even when the predicate is false.
+
+ There are three kinds of predicates:
+ plain: r1: <<p>>? r2
+ guarded: r1: (A)? => <<p>>? r2
+ ampersand style: r1: (A)? && <<p>>? r2
+
+ Of the three kinds of predicates, only a guard predicate
+ has things which are reachable even when the predicate
+ is false. To be reachable the constraint must *not*
+ match the guard.
+
+*/
+
+ if (p->is_predicate && MR_SuppressSearch) {
+
+ Predicate *pred=p->guardpred;
+
+ if (pred == NULL) {
+ t=NULL;
+ goto EXIT;
+ };
+ constrain = &fset[maxk-k+1];
+ if (pred->k == 1) {
+ set dif;
+ dif=set_dif(*constrain,pred->scontext[1]);
+ if (set_nil(dif)) {
+ set_free(dif);
+ t=NULL;
+ goto EXIT;
+ };
+ set_free(dif);
+ } else {
+ if (MR_tree_matches_constraints(k,constrain,pred->tcontext)) {
+ t=NULL;
+ goto EXIT;
+ };
+ }
+ };
+
+ /* The ampersand predicate differs from the
+ other predicates because its first set
+ is a subset of the first set behind the predicate
+
+ r1: (A)? && <<p>>? r2 ;
+ r2: A | B;
+
+ In this case first[1] of r1 is A, even
+ though first[1] of r2 is {A B}.
+ */
+
+ if (p->is_predicate && p->ampersandPred != NULL) {
+
+ Predicate *pred=p->ampersandPred;
+ Tree *tAND;
+ Tree *tset;
+
+ if (k <= pred->k) {
+ if (MR_MaintainBackTrace) MR_pointerStackPush(&MR_BackTraceStack,p);
+ TRAV(p->guardNodes,k,rk,t);
+ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
+ return t;
+ } else {
+ require (k>1,"tAction for ampersandpred: k <= 1");
+ if (ConstrainSearch) {
+ if (MR_AmbSourceSearch) {
+ require(constrain>=fset&&constrain<=&(fset[CLL_k]),
+ "tToken: constrain is not a valid set");
+ } else {
+ require(constrain>=fset&&constrain<=&(fset[LL_k]),
+ "tToken: constrain is not a valid set");
+ };
+ save_fset=(set *) calloc (CLL_k+1,sizeof(set));
+ require (save_fset != NULL,"tAction save_fset alloc");
+ for (i=1; i <= CLL_k ; i++) {
+ save_fset[i]=set_dup(fset[i]);
+ };
+ if (pred->k == 1) {
+ constrain = &fset[maxk-k+1];
+ set_andin(constrain,pred->scontext[1]);
+ if (set_nil(*constrain)) {
+ t=NULL;
+ goto EXIT;
+ };
+ } else {
+ constrain = &fset[maxk-k+1];
+ if (! MR_tree_matches_constraints(pred->k,constrain,pred->tcontext)) {
+ t=NULL;
+ goto EXIT;
+ }; /* end loop on i */
+ }; /* end loop on pred scontext/tcontext */
+ }; /* end if on k > pred->k */
+ }; /* end if on constrain search */
+
+ TRAV(p->next,k,rk,t);
+
+ if (t != NULL) {
+ t=tshrink(t);
+ t=tflatten(t);
+ t=tleft_factor(t);
+ if (pred->tcontext != NULL) {
+ tAND=MR_computeTreeAND(t,pred->tcontext);
+ } else {
+ tset=MR_make_tree_from_set(pred->scontext[1]);
+ tAND=MR_computeTreeAND(t,tset);
+ Tfree(tset);
+ };
+ Tfree(t);
+ t=tAND;
+ };
+ goto EXIT;
+
+ }; /* end if on ampersand predicate */
+
+ TRAV(p->next,k,rk,t);
+
+EXIT:
+ if (save_fset != NULL) {
+ for (i=1 ; i <= CLL_k ; i++) {
+ set_free(fset[i]);
+ fset[i]=save_fset[i];
+ };
+ free ( (char *) save_fset);
+ };
+ return t;
+}
+
+/* see if e exists in s as a possible input permutation (e is always a chain) */
+
+int
+#ifdef __USE_PROTOS
+tmember( Tree *e, Tree *s )
+#else
+tmember( e, s )
+Tree *e;
+Tree *s;
+#endif
+{
+ if ( e==NULL||s==NULL ) return 0;
+/** fprintf(stderr, "tmember(");
+*** preorder(e); fprintf(stderr, ",");
+*** preorder(s); fprintf(stderr, " )\n");
+*/
+ if ( s->token == ALT && s->right == NULL ) return tmember(e, s->down);
+ if ( e->token!=s->token )
+ {
+ if ( s->right==NULL ) return 0;
+ return tmember(e, s->right);
+ }
+ if ( e->down==NULL && s->down == NULL ) return 1;
+ if ( tmember(e->down, s->down) ) return 1;
+ if ( s->right==NULL ) return 0;
+ return tmember(e, s->right);
+}
+
+/* see if e exists in s as a possible input permutation (e is always a chain);
+ * Only check s to the depth of e. In other words, 'e' can be a shorter
+ * sequence than s.
+ */
+int
+#ifdef __USE_PROTOS
+tmember_constrained( Tree *e, Tree *s)
+#else
+tmember_constrained( e, s )
+Tree *e;
+Tree *s;
+#endif
+{
+ if ( e==NULL||s==NULL ) return 0;
+/** fprintf(stderr, "tmember_constrained(");
+*** preorder(e); fprintf(stderr, ",");
+*** preorder(s); fprintf(stderr, " )\n");
+**/
+ if ( s->token == ALT && s->right == NULL )
+ return tmember_constrained(e, s->down);
+ if ( e->token!=s->token )
+ {
+ if ( s->right==NULL ) return 0;
+ return tmember_constrained(e, s->right);
+ }
+ if ( e->down == NULL ) return 1; /* if s is matched to depth of e return */
+ if ( tmember_constrained(e->down, s->down) ) return 1;
+ if ( s->right==NULL ) return 0;
+ return tmember_constrained(e, s->right);
+}
+
+/* combine (? (A t) ... (A u) ...) into (? (A t u)) */
+Tree *
+#ifdef __USE_PROTOS
+tleft_factor( Tree *t )
+#else
+tleft_factor( t )
+Tree *t;
+#endif
+{
+ Tree *u, *v, *trail, *w;
+
+ /* left-factor what is at this level */
+ if ( t == NULL ) return NULL;
+ for (u=t; u!=NULL; u=u->right)
+ {
+ trail = u;
+ v=u->right;
+ while ( v!=NULL )
+ {
+ if ( u->token == v->token )
+ {
+ if ( u->down!=NULL )
+ {
+ for (w=u->down; w->right!=NULL; w=w->right) {;}
+ w->right = v->down; /* link children together */
+ }
+ else u->down = v->down;
+ trail->right = v->right; /* unlink factored node */
+ _Tfree( v );
+ v = trail->right;
+ }
+ else {trail = v; v=v->right;}
+ }
+ }
+ /* left-factor what is below */
+ for (u=t; u!=NULL; u=u->right) u->down = tleft_factor( u->down );
+ return t;
+}
+
+/* remove the permutation p from t if present */
+Tree *
+#ifdef __USE_PROTOS
+trm_perm( Tree *t, Tree *p )
+#else
+trm_perm( t, p )
+Tree *t;
+Tree *p;
+#endif
+{
+ /*
+ fprintf(stderr, "trm_perm(");
+ preorder(t); fprintf(stderr, ",");
+ preorder(p); fprintf(stderr, " )\n");
+ */
+ if ( t == NULL || p == NULL ) return NULL;
+ if ( t->token == ALT )
+ {
+ t->down = trm_perm(t->down, p);
+ if ( t->down == NULL ) /* nothing left below, rm cur node */
+ {
+ Tree *u = t->right;
+ _Tfree( t );
+ return trm_perm(u, p);
+ }
+ t->right = trm_perm(t->right, p); /* look for more instances of p */
+ return t;
+ }
+ if ( p->token != t->token ) /* not found, try a sibling */
+ {
+ t->right = trm_perm(t->right, p);
+ return t;
+ }
+ t->down = trm_perm(t->down, p->down);
+ if ( t->down == NULL ) /* nothing left below, rm cur node */
+ {
+ Tree *u = t->right;
+ _Tfree( t );
+ return trm_perm(u, p);
+ }
+ t->right = trm_perm(t->right, p); /* look for more instances of p */
+ return t;
+}
+
+/* add the permutation 'perm' to the LL_k sets in 'fset' */
+void
+#ifdef __USE_PROTOS
+tcvt( set *fset, Tree *perm )
+#else
+tcvt( fset, perm )
+set *fset;
+Tree *perm;
+#endif
+{
+ if ( perm==NULL ) return;
+ set_orel(perm->token, fset);
+ tcvt(fset+1, perm->down);
+}
+
+/* for each element of ftbl[k], make it the root of a tree with permute(ftbl[k+1])
+ * as a child.
+ */
+Tree *
+#ifdef __USE_PROTOS
+permute( int k, int max_k )
+#else
+permute( k, max_k )
+int k, max_k;
+#endif
+{
+ Tree *t, *u;
+
+ if ( k>max_k ) return NULL;
+ if ( ftbl[k][findex[k]] == nil ) return NULL;
+ t = permute(k+1, max_k);
+ if ( t==NULL&&k<max_k ) /* no permutation left below for k+1 tokens? */
+ {
+ findex[k+1] = 0;
+ (findex[k])++; /* try next token at this k */
+ return permute(k, max_k);
+ }
+
+ u = tmake(tnode(ftbl[k][findex[k]]), t, NULL);
+ if ( k == max_k ) (findex[k])++;
+ return u;
+}
+
+/* Compute LL(k) trees for alts alt1 and alt2 of p.
+ * function result is tree of ambiguous input permutations
+ *
+ * ALGORITHM may change to look for something other than LL_k size
+ * trees ==> maxk will have to change.
+ */
+Tree *
+#ifdef __USE_PROTOS
+VerifyAmbig( Junction *alt1, Junction *alt2, unsigned **ft, set *fs, Tree **t, Tree **u, int *numAmbig )
+#else
+VerifyAmbig( alt1, alt2, ft, fs, t, u, numAmbig )
+Junction *alt1;
+Junction *alt2;
+unsigned **ft;
+set *fs;
+Tree **t;
+Tree **u;
+int *numAmbig;
+#endif
+{
+ set rk;
+ Tree *perm, *ambig=NULL;
+ Junction *p;
+ int k;
+ int tnodes_at_start=TnodesAllocated;
+ int tnodes_at_end;
+ int tnodes_used;
+ set *save_fs;
+ int j;
+
+ save_fs=(set *) calloc(CLL_k+1,sizeof(set));
+ require(save_fs != NULL,"save_fs calloc");
+
+ for (j=0; j <= CLL_k ; j++) save_fs[j]=set_dup(fs[j]);
+
+ maxk = LL_k; /* NOTE: for now, we look for LL_k */
+ ftbl = ft;
+ fset = fs;
+ constrain = &(fset[1]);
+ findex = (int *) calloc(LL_k+1, sizeof(int));
+ if ( findex == NULL )
+ {
+ fprintf(stderr, ErrHdr, FileStr[CurAmbigfile], CurAmbigline);
+ fprintf(stderr, " out of memory while analyzing alts %d and %d of %s\n",
+ CurAmbigAlt1,
+ CurAmbigAlt2,
+ CurAmbigbtype);
+ exit(PCCTS_EXIT_FAILURE);
+ }
+ for (k=1; k<=LL_k; k++) findex[k] = 0;
+
+ rk = empty;
+ ConstrainSearch = 1; /* consider only tokens in ambig sets */
+
+ p = analysis_point((Junction *)alt1->p1);
+ TRAV(p, LL_k, &rk, *t);
+ *t = tshrink( *t );
+ *t = tflatten( *t );
+ *t = tleft_factor( *t ); /* MR10 */
+ *t = prune(*t, LL_k);
+ *t = tleft_factor( *t );
+
+/*** fprintf(stderr, "after shrink&flatten&prune&left_factor:"); preorder(*t); fprintf(stderr, "\n");*/
+ if ( *t == NULL )
+ {
+/*** fprintf(stderr, "TreeIncomplete --> no LL(%d) ambiguity\n", LL_k);*/
+ Tfree( *t ); /* kill if impossible to have ambig */
+ *t = NULL;
+ }
+
+ p = analysis_point((Junction *)alt2->p1);
+
+ TRAV(p, LL_k, &rk, *u);
+ *u = tshrink( *u );
+ *u = tflatten( *u );
+ *t = tleft_factor( *t ); /* MR10 */
+ *u = prune(*u, LL_k);
+ *u = tleft_factor( *u );
+/* fprintf(stderr, "after shrink&flatten&prune&lfactor:"); preorder(*u); fprintf(stderr, "\n");*/
+ if ( *u == NULL )
+ {
+/* fprintf(stderr, "TreeIncomplete --> no LL(%d) ambiguity\n", LL_k);*/
+ Tfree( *u );
+ *u = NULL;
+ }
+
+ for (k=1; k<=LL_k; k++) set_clr( fs[k] );
+
+ ambig = tnode(ALT);
+ k = 0;
+ if ( *t!=NULL && *u!=NULL )
+ {
+ while ( (perm=permute(1,LL_k))!=NULL )
+ {
+/* fprintf(stderr, "chk perm:"); preorder(perm); fprintf(stderr, "\n");*/
+ if ( tmember(perm, *t) && tmember(perm, *u) )
+ {
+/* fprintf(stderr, "ambig upon"); preorder(perm); fprintf(stderr, "\n");*/
+
+ k++;
+ perm->right = ambig->down;
+ ambig->down = perm;
+ tcvt(&(fs[1]), perm);
+ }
+ else Tfree( perm );
+ }
+ }
+
+ for (j=0; j <= CLL_k ; j++) fs[j]=save_fs[j];
+ free( (char *) save_fs);
+
+ tnodes_at_end=TnodesAllocated;
+ tnodes_used=tnodes_at_end - tnodes_at_start;
+
+ if (TnodesReportThreshold > 0 && tnodes_used > TnodesReportThreshold) {
+ fprintf(stdout,"There were %d tuples whose ambiguity could not be resolved by full lookahead\n",k);
+ fprintf(stdout,"There were %d tnodes created to resolve ambiguity between:\n\n",tnodes_used);
+ fprintf(stdout," Choice 1: %s line %d file %s\n",
+ MR_ruleNamePlusOffset( (Node *) alt1),alt1->line,FileStr[alt1->file]);
+ fprintf(stdout," Choice 2: %s line %d file %s\n",
+ MR_ruleNamePlusOffset( (Node *) alt2),alt2->line,FileStr[alt2->file]);
+ for (j=1; j <= CLL_k ; j++) {
+ fprintf(stdout,"\n Intersection of lookahead[%d] sets:\n",j);
+ MR_dumpTokenSet(stdout,2,fs[j]);
+ };
+ fprintf(stdout,"\n");
+ };
+
+ *numAmbig = k;
+ if ( ambig->down == NULL ) {_Tfree(ambig); ambig = NULL;}
+ free( (char *)findex );
+/* fprintf(stderr, "final ambig:"); preorder(ambig); fprintf(stderr, "\n");*/
+ return ambig;
+}
+
+static Tree *
+#ifdef __USE_PROTOS
+bottom_of_chain( Tree *t )
+#else
+bottom_of_chain( t )
+Tree *t;
+#endif
+{
+ if ( t==NULL ) return NULL;
+ for (; t->down != NULL; t=t->down) {;}
+ return t;
+}
+
+/*
+ * Make a tree from k sets where the degree of the first k-1 sets is 1.
+ */
+Tree *
+#ifdef __USE_PROTOS
+make_tree_from_sets( set *fset1, set *fset2 )
+#else
+make_tree_from_sets( fset1, fset2 )
+set *fset1;
+set *fset2;
+#endif
+{
+ set inter;
+ int i;
+ Tree *t=NULL, *n, *u;
+ unsigned *p,*q;
+ require(LL_k>1, "make_tree_from_sets: LL_k must be > 1");
+
+ /* do the degree 1 sets first */
+ for (i=1; i<=LL_k-1; i++)
+ {
+ inter = set_and(fset1[i], fset2[i]);
+ require(set_deg(inter)==1, "invalid set to tree conversion");
+ n = tnode(set_int(inter));
+ if (t==NULL) t=n; else tmake(t, n, NULL);
+ set_free(inter);
+ }
+
+ /* now add the chain of tokens at depth k */
+ u = bottom_of_chain(t);
+ inter = set_and(fset1[LL_k], fset2[LL_k]);
+ if ( (q=p=set_pdq(inter)) == NULL ) fatal_internal("Can't alloc space for set_pdq");
+ /* first one is linked to bottom, then others are sibling linked */
+ n = tnode(*p++);
+ u->down = n;
+ u = u->down;
+ while ( *p != nil )
+ {
+ n = tnode(*p);
+ u->right = n;
+ u = u->right;
+ p++;
+ }
+ free((char *)q);
+
+ return t;
+}
+
+/* create and return the tree of lookahead k-sequences that are in t, but not
+ * in the context of predicates in predicate list p.
+ */
+Tree *
+#ifdef __USE_PROTOS
+tdif( Tree *ambig_tuples, Predicate *p, set *fset1, set *fset2 )
+#else
+tdif( ambig_tuples, p, fset1, fset2 )
+Tree *ambig_tuples;
+Predicate *p;
+set *fset1;
+set *fset2;
+#endif
+{
+ unsigned **ft;
+ Tree *dif=NULL;
+ Tree *perm;
+ set b;
+ int i,k;
+
+ if ( p == NULL ) return tdup(ambig_tuples);
+
+ ft = (unsigned **) calloc(CLL_k+1, sizeof(unsigned *));
+ require(ft!=NULL, "cannot allocate ft");
+ for (i=1; i<=CLL_k; i++)
+ {
+ b = set_and(fset1[i], fset2[i]);
+ ft[i] = set_pdq(b);
+ set_free(b);
+ }
+ findex = (int *) calloc(LL_k+1, sizeof(int));
+ if ( findex == NULL )
+ {
+ fatal_internal("out of memory in tdif while checking predicates");
+ }
+ for (k=1; k<=LL_k; k++) findex[k] = 0;
+
+#ifdef DBG_TRAV
+ fprintf(stderr, "tdif_%d[", p->k);
+ preorder(ambig_tuples);
+ fprintf(stderr, ",");
+ preorder(p->tcontext);
+ fprintf(stderr, "] =");
+#endif
+
+ ftbl = ft;
+ while ( (perm=permute(1,p->k))!=NULL )
+ {
+#ifdef DBG_TRAV
+ fprintf(stderr, "test perm:"); preorder(perm); fprintf(stderr, "\n");
+#endif
+ if ( tmember_constrained(perm, ambig_tuples) &&
+ !tmember_of_context(perm, p) )
+ {
+#ifdef DBG_TRAV
+ fprintf(stderr, "satisfied upon"); preorder(perm); fprintf(stderr, "\n");
+#endif
+ k++;
+ if ( dif==NULL ) dif = perm;
+ else
+ {
+ perm->right = dif;
+ dif = perm;
+ }
+ }
+ else Tfree( perm );
+ }
+
+#ifdef DBG_TRAV
+ preorder(dif);
+ fprintf(stderr, "\n");
+#endif
+
+ for (i=1; i<=CLL_k; i++) free( (char *)ft[i] );
+ free((char *)ft);
+ free((char *)findex);
+
+ return dif;
+}
+
+/* is lookahead sequence t a member of any context tree for any
+ * predicate in p?
+ */
+static int
+#ifdef __USE_PROTOS
+tmember_of_context( Tree *t, Predicate *p )
+#else
+tmember_of_context( t, p )
+Tree *t;
+Predicate *p;
+#endif
+{
+ for (; p!=NULL; p=p->right)
+ {
+ if ( p->expr==PRED_AND_LIST || p->expr==PRED_OR_LIST )
+ return tmember_of_context(t, p->down);
+ if ( tmember_constrained(t, p->tcontext) ) return 1;
+ if ( tmember_of_context(t, p->down) ) return 1;
+ }
+ return 0;
+}
+
+int
+#ifdef __USE_PROTOS
+is_single_tuple( Tree *t )
+#else
+is_single_tuple( t )
+Tree *t;
+#endif
+{
+ if ( t == NULL ) return 0;
+ if ( t->right != NULL ) return 0;
+ if ( t->down == NULL ) return 1;
+ return is_single_tuple(t->down);
+}
+
+
+/* MR10 Check that a context guard contains only allowed things */
+/* MR10 (mainly token references). */
+
+#ifdef __USE_PROTOS
+int contextGuardOK(Node *p,int h,int *hmax)
+#else
+int contextGuardOK(p,h,hmax)
+ Node *p;
+ int h;
+ int *hmax;
+#endif
+{
+ Junction *j;
+ TokNode *tn;
+
+ if (p == NULL) return 1;
+ if (p->ntype == nToken) {
+ h++;
+ if (h > *hmax) *hmax=h;
+ tn=(TokNode *)p;
+ if (tn->el_label != NULL) {
+ warnFL(eMsg1("a label (\"%s\") for a context guard element is meaningless",tn->el_label),
+ FileStr[p->file],p->line);
+ };
+ return contextGuardOK( ( (TokNode *) p)->next,h,hmax);
+ } else if (p->ntype == nAction) {
+ goto Fail;
+ } else if (p->ntype == nRuleRef) {
+ goto Fail;
+ } else {
+ require (p->ntype == nJunction,"Unexpected ntype");
+ j=(Junction *) p;
+ if (j->jtype != Generic &&
+ j->jtype != aSubBlk && /* pretty sure this one is allowed */
+/**** j->jtype != aOptBlk && ****/ /* pretty sure this one is allowed */ /* MR11 not any more ! */
+ j->jtype != EndBlk) {
+ errFL("A context guard may not contain an option block: {...} or looping block: (...)* or (...)+",
+ FileStr[p->file],p->line);
+ contextGuardOK(j->p1,h,hmax);
+ return 0;
+ };
+ /* do both p1 and p2 so use | rather than || */
+ return contextGuardOK(j->p2,h,hmax) | contextGuardOK(j->p1,h,hmax);
+ };
+Fail:
+ errFL("A context guard may contain only Token references - guard will be ignored",
+ FileStr[p->file],p->line);
+ contextGuardOK( ( (ActionNode *) p)->next,h,hmax);
+ return 0;
+}
+
+/*
+ * Look at a (...)? generalized-predicate context-guard and compute
+ * either a lookahead set (k==1) or a lookahead tree for k>1. The
+ * k level is determined by the guard itself rather than the LL_k
+ * variable. For example, ( A B )? is an LL(2) guard and ( ID )?
+ * is an LL(1) guard. For the moment, you can only have a single
+ * tuple in the guard. Physically, the block must look like this
+ * --o-->TOKEN-->o-->o-->TOKEN-->o-- ... -->o-->TOKEN-->o--
+ * An error is printed for any other type.
+ */
+Predicate *
+#ifdef __USE_PROTOS
+computePredFromContextGuard(Graph blk,int *msgDone) /* MR10 */
+#else
+computePredFromContextGuard(blk,msgDone) /* MR10 */
+ Graph blk;
+ int *msgDone; /* MR10 */
+#endif
+{
+ Junction *junc = (Junction *)blk.left, *p;
+ Tree *t=NULL;
+ Predicate *pred = NULL;
+ set scontext, rk;
+ int ok;
+ int hmax=0;
+
+ require(junc!=NULL && junc->ntype == nJunction, "bad context guard");
+
+/* MR10 Check for anything other than Tokens and generic junctions */
+
+ *msgDone=0; /* MR10 */
+ ok=contextGuardOK( (Node *)junc,0,&hmax); /* MR10 */
+ if (! ok) { /* MR10 */
+ *msgDone=1; /* MR10 */
+ return NULL; /* MR10 */
+ }; /* MR10 */
+ if (hmax == 0) {
+errFL("guard is 0 tokens long",FileStr[junc->file],junc->line); /* MR11 */
+ *msgDone=1;
+ return NULL;
+ };
+ if (hmax > CLL_k) { /* MR10 */
+errFL(eMsgd2("guard is %d tokens long - lookahead is limited to max(k,ck)==%d", /* MR10 */
+ hmax,CLL_k), /* MR10 */
+ FileStr[junc->file],junc->line); /* MR10 */
+ *msgDone=1; /* MR10 */
+ return NULL; /* MR10 */
+ }; /* MR10 */
+
+ rk = empty;
+ p = junc;
+ pred = new_pred();
+ pred->k = hmax; /* MR10 should be CLL_k, not LLK ? */
+ if (hmax > 1 ) /* MR10 was LL_k */
+ {
+ ConstrainSearch = 0;
+ ContextGuardTRAV = 1;
+ TRAV(p, hmax, &rk, t); /* MR10 was LL_k */
+ ContextGuardTRAV = 0;
+ set_free(rk);
+ t = tshrink( t );
+ t = tflatten( t );
+ t = tleft_factor( t );
+/*
+ fprintf(stderr, "ctx guard:");
+ preorder(t);
+ fprintf(stderr, "\n");
+*/
+ pred->tcontext = t;
+ }
+ else
+ {
+ REACH(p, 1, &rk, scontext);
+ require(set_nil(rk), "rk != nil");
+ set_free(rk);
+/*
+ fprintf(stderr, "LL(1) ctx guard is:");
+ s_fprT(stderr, scontext);
+ fprintf(stderr, "\n");
+*/
+ pred->scontext[1] = scontext;
+ }
+
+ list_add(&ContextGuardPredicateList,pred); /* MR13 */
+
+ return pred;
+}
+
+/* MR13
+ When the context guard is originally computed the
+ meta-tokens are not known.
+*/
+
+#ifdef __USE_PROTOS
+void recomputeContextGuard(Predicate *pred)
+#else
+void recomputeContextGuard(pred)
+ Predicate *pred;
+#endif
+{
+ Tree * t=NULL;
+ set scontext;
+ set rk;
+ ActionNode * actionNode;
+ Junction * p;
+
+ actionNode=pred->source;
+ require (actionNode != NULL,"context predicate's source == NULL");
+
+ p=actionNode->guardNodes;
+ require (p != NULL,"context predicate's guardNodes == NULL");
+
+ rk = empty;
+ if (pred->k > 1 )
+ {
+ ConstrainSearch = 0;
+ ContextGuardTRAV = 1;
+ TRAV(p, pred->k, &rk, t);
+ ContextGuardTRAV = 0;
+ set_free(rk);
+ t = tshrink( t );
+ t = tflatten( t );
+ t = tleft_factor( t );
+ Tfree(pred->tcontext);
+ pred->tcontext = t;
+ }
+ else
+ {
+ REACH(p, 1, &rk, scontext);
+ require(set_nil(rk), "rk != nil");
+ set_free(rk);
+ set_free(pred->scontext[1]);
+ pred->scontext[1] = scontext;
+ }
+}
+
+/* MR11 - had enough of flags yet ? */
+
+int MR_AmbSourceSearch=0;
+int MR_AmbSourceSearchGroup=0;
+int MR_AmbSourceSearchChoice=0;
+int MR_AmbSourceSearchLimit=0;
+int MR_matched_AmbAidRule=0;
+
+static set *matchSets[2]={NULL,NULL};
+static int *tokensInChain=NULL;
+static Junction *MR_AmbSourceSearchJ[2];
+
+void MR_traceAmbSourceKclient()
+{
+ int i;
+ set *save_fset;
+ int save_ConstrainSearch;
+ set incomplete;
+ Tree *t;
+
+ if (matchSets[0] == NULL) {
+ matchSets[0]=(set *) calloc (CLL_k+1,sizeof(set));
+ require (matchSets[0] != NULL,"matchSets[0] alloc");
+ matchSets[1]=(set *) calloc (CLL_k+1,sizeof(set));
+ require (matchSets[1] != NULL,"matchSets[1] alloc");
+ };
+
+ for (i=1 ; i <= MR_AmbSourceSearchLimit ; i++) {
+ set_clr(matchSets[0][i]);
+ set_orel( (unsigned) tokensInChain[i],
+ &matchSets[0][i]);
+ set_clr(matchSets[1][i]);
+ set_orel( (unsigned) tokensInChain[i],
+ &matchSets[1][i]);
+ };
+
+ save_fset=fset;
+ save_ConstrainSearch=ConstrainSearch;
+
+
+
+ for (i=0 ; i < 2 ; i++) {
+
+#if 0
+** fprintf(stdout," Choice:%d Depth:%d ",i+1,MR_AmbSourceSearchLimit);
+** fprintf(stdout,"(");
+** for (j=1 ; j <= MR_AmbSourceSearchLimit ; j++) {
+** if (j != 1) fprintf(stdout," ");
+** fprintf(stdout,"%s",TerminalString(tokensInChain[j]));
+** };
+** fprintf(stdout,")\n\n");
+#endif
+
+ fset=matchSets[i];
+
+ MR_AmbSourceSearch=1;
+ MR_MaintainBackTrace=1;
+ MR_AmbSourceSearchChoice=i;
+ ConstrainSearch=1;
+
+ maxk = MR_AmbSourceSearchLimit;
+
+ incomplete=empty;
+ t=NULL;
+
+ constrain = &(fset[1]);
+ MR_pointerStackReset(&MR_BackTraceStack);
+
+ TRAV(MR_AmbSourceSearchJ[i],maxk,&incomplete,t);
+
+ Tfree(t);
+
+ require (set_nil(incomplete),"MR_traceAmbSourceK TRAV incomplete");
+ require (MR_BackTraceStack.count == 0,"K: MR_BackTraceStack.count != 0");
+
+ set_free(incomplete);
+ };
+
+ ConstrainSearch=save_ConstrainSearch;
+ fset=save_fset;
+ MR_AmbSourceSearch=0;
+ MR_MaintainBackTrace=0;
+ MR_AmbSourceSearchChoice=0;
+}
+
+#ifdef __USE_PROTOS
+Tree *tTrunc(Tree *t,int depth)
+#else
+Tree *tTrunc(t,depth)
+ Tree *t;
+#endif
+{
+ Tree *u;
+
+ require ( ! (t == NULL && depth > 0),"tree too short");
+
+ if (depth == 0) return NULL;
+
+ if (t->token == ALT) {
+ u=tTrunc(t->down,depth);
+ } else {
+ u=tnode(t->token);
+ u->down=tTrunc(t->down,depth-1);
+ };
+ if (t->right != NULL) u->right=tTrunc(t->right,depth);
+ return u;
+}
+
+#ifdef __USE_PROTOS
+void MR_iterateOverTree(Tree *t,int chain[])
+#else
+void MR_iterateOverTree(t,chain)
+ Tree *t;
+ int chain[];
+#endif
+{
+ if (t == NULL) return;
+ chain[0]=t->token;
+ if (t->down != NULL) {
+ MR_iterateOverTree(t->down,&chain[1]);
+ } else {
+ MR_traceAmbSourceKclient();
+ };
+ MR_iterateOverTree(t->right,&chain[0]);
+ chain[0]=0;
+}
+
+#ifdef __USE_PROTOS
+void MR_traceAmbSourceK(Tree *t,Junction *alt1,Junction *alt2)
+#else
+void MR_traceAmbSourceK(t,alt1,alt2)
+ Tree *t;
+ Junction *alt1;
+ Junction *alt2;
+#endif
+{
+ int i;
+ int depth;
+ int maxDepth;
+ Tree *truncatedTree;
+
+ if (MR_AmbAidRule == NULL) return;
+
+ if ( ! (
+ strcmp(MR_AmbAidRule,alt1->rname) == 0 ||
+ strcmp(MR_AmbAidRule,alt2->rname) == 0 ||
+ MR_AmbAidLine==alt1->line ||
+ MR_AmbAidLine==alt2->line
+ )
+ ) return;
+
+ MR_matched_AmbAidRule++;
+
+ /* there are no token sets in trees, only in TokNodes */
+
+ MR_AmbSourceSearchJ[0]=analysis_point( (Junction *) alt1->p1);
+ MR_AmbSourceSearchJ[1]=analysis_point( (Junction *) alt2->p1);
+
+ if (tokensInChain == NULL) {
+ tokensInChain=(int *) calloc (CLL_k+1,sizeof(int));
+ require (tokensInChain != NULL,"tokensInChain alloc");
+ };
+
+ MR_AmbSourceSearchGroup=0;
+
+ fprintf(stdout,"\n");
+ fprintf(stdout," Ambiguity Aid ");
+ fprintf(stdout,
+ (MR_AmbAidDepth <= LL_k ?
+ "(-k %d -aa %s %s -aad %d)\n\n" :
+ "(-k %d -aa %s %s [-k value limits -aad %d])\n\n"),
+ LL_k,
+ MR_AmbAidRule,
+ (MR_AmbAidMultiple ? "-aam" : ""),
+ MR_AmbAidDepth);
+
+ for (i=0 ; i < 2 ; i++) {
+ fprintf(stdout," Choice %d: %-25s line %d file %s\n",
+ (i+1),
+ MR_ruleNamePlusOffset( (Node *) MR_AmbSourceSearchJ[i]),
+ MR_AmbSourceSearchJ[i]->line,
+ FileStr[MR_AmbSourceSearchJ[i]->file]);
+ };
+
+ fprintf(stdout,"\n");
+
+ if (MR_AmbAidDepth < LL_k) {
+ maxDepth=MR_AmbAidDepth;
+ } else {
+ maxDepth=LL_k;
+ };
+
+ for (depth=1 ; depth <= maxDepth; depth++) {
+ MR_AmbSourceSearchLimit=depth;
+ if (depth < LL_k) {
+ truncatedTree=tTrunc(t,depth);
+ truncatedTree=tleft_factor(truncatedTree);
+ MR_iterateOverTree(truncatedTree,&tokensInChain[1]); /* <===== */
+ Tfree(truncatedTree);
+ } else {
+ MR_iterateOverTree(t,tokensInChain); /* <===== */
+ };
+ fflush(stdout);
+ fflush(stderr);
+ };
+
+ fprintf(stdout,"\n");
+ MR_AmbSourceSearch=0;
+ MR_MaintainBackTrace=0;
+ MR_AmbSourceSearchGroup=0;
+ MR_AmbSourceSearchChoice=0;
+ MR_AmbSourceSearchLimit=0;
+
+}
+
+
+/* this if for k=1 grammars only
+
+ this is approximate only because of the limitations of linear
+ approximation lookahead. Don't want to do a k=3 search when
+ the user only specified a ck=3 grammar
+*/
+
+#ifdef __USE_PROTOS
+void MR_traceAmbSource(set *matchSets,Junction *alt1, Junction *alt2)
+#else
+void MR_traceAmbSource(matchSets,alt1,alt2)
+ set *matchSets;
+ Junction *alt1;
+ Junction *alt2;
+#endif
+{
+ set *save_fset;
+ Junction *p[2];
+ int i;
+ int j;
+ set *dup_matchSets;
+ set intersection;
+ set incomplete;
+ set tokensUsed;
+ int depth;
+
+ if (MR_AmbAidRule == NULL) return;
+ if ( ! (
+ strcmp(MR_AmbAidRule,alt1->rname) == 0 ||
+ strcmp(MR_AmbAidRule,alt2->rname) == 0 ||
+ MR_AmbAidLine==alt1->line ||
+ MR_AmbAidLine==alt2->line
+ )
+ ) return;
+
+ MR_matched_AmbAidRule++;
+
+ save_fset=fset;
+
+ dup_matchSets=(set *) calloc(CLL_k+1,sizeof(set));
+ require (dup_matchSets != NULL,"Can't allocate dup_matchSets");
+
+ p[0]=analysis_point( (Junction *) alt1->p1);
+ p[1]=analysis_point( (Junction *) alt2->p1);
+
+ fprintf(stdout,"\n");
+
+ fprintf(stdout," Ambiguity Aid ");
+ fprintf(stdout,
+ (MR_AmbAidDepth <= CLL_k ?
+ "(-ck %d -aa %s %s -aad %d)\n\n" :
+ "(-ck %d -aa %s %s [-ck value limits -aad %d])\n\n"),
+ CLL_k,
+ MR_AmbAidRule,
+ (MR_AmbAidMultiple ? "-aam" : ""),
+ MR_AmbAidDepth);
+
+ for (i=0 ; i < 2 ; i++) {
+ fprintf(stdout," Choice %d: %-25s line %d file %s\n",
+ (i+1),
+ MR_ruleNamePlusOffset( (Node *) p[i]),
+ p[i]->line,FileStr[p[i]->file]);
+ };
+
+ for (j=1; j <= CLL_k ; j++) {
+ fprintf(stdout,"\n Intersection of lookahead[%d] sets:\n",j);
+ intersection=set_and(alt1->fset[j],alt2->fset[j]);
+ MR_dumpTokenSet(stdout,2,intersection);
+ set_free(intersection);
+ };
+
+ fprintf(stdout,"\n");
+
+ require (1 <= MR_AmbAidDepth && MR_AmbAidDepth <= CLL_k,
+ "illegal MR_AmbAidDepth");
+
+ MR_AmbSourceSearchGroup=0;
+ for (depth=1; depth <= MR_AmbAidDepth; depth++) {
+ MR_AmbSourceSearchLimit=depth;
+ for (i=0 ; i < 2 ; i++) {
+
+/*** fprintf(stdout," Choice:%d Depth:%d\n\n",i+1,depth); ***/
+
+ for (j=0 ; j <= CLL_k ; j++) { dup_matchSets[j]=set_dup(matchSets[j]); };
+ fset=dup_matchSets;
+
+ fflush(output);
+ fflush(stdout);
+
+ MR_AmbSourceSearch=1;
+ MR_MaintainBackTrace=1;
+ MR_AmbSourceSearchChoice=i;
+
+ maxk = depth;
+ tokensUsed=empty;
+ incomplete=empty;
+
+ constrain = &(fset[1]);
+ MR_pointerStackReset(&MR_BackTraceStack);
+
+ REACH(p[i],depth,&incomplete,tokensUsed);
+
+ fflush(output);
+ fflush(stdout);
+
+ require (set_nil(incomplete),"MR_traceAmbSource REACH incomplete");
+ require (MR_BackTraceStack.count == 0,"1: MR_BackTraceStack.count != 0");
+
+ set_free(incomplete);
+ set_free(tokensUsed);
+
+ for (j=0 ; j <= CLL_k ; j++) { set_free(dup_matchSets[j]); };
+ };
+ };
+
+ fprintf(stdout,"\n");
+
+ MR_AmbSourceSearch=0;
+ MR_MaintainBackTrace=0;
+ MR_AmbSourceSearchGroup=0;
+ MR_AmbSourceSearchChoice=0;
+ MR_AmbSourceSearchLimit=0;
+
+ fset=save_fset;
+ free ( (char *) dup_matchSets);
+}
+
+static int itemCount;
+
+void MR_backTraceDumpItemReset() {
+ itemCount=0;
+}
+
+#ifdef __USE_PROTOS
+void MR_backTraceDumpItem(FILE *f,int skip,Node *n)
+#else
+void MR_backTraceDumpItem(f,skip,n)
+ FILE *f;
+ int skip;
+ Node *n;
+#endif
+{
+ TokNode *tn;
+ RuleRefNode *rrn;
+ Junction *j;
+ ActionNode *a;
+
+ switch (n->ntype) {
+ case nToken:
+ itemCount++; if (skip) goto EXIT;
+ tn=(TokNode *)n;
+ if (set_nil(tn->tset)) {
+ fprintf(f," %2d #token %-23s",itemCount,TerminalString(tn->token));
+ } else {
+ fprintf(f," %2d #tokclass %-20s",itemCount,TerminalString(tn->token));
+ };
+ break;
+ case nRuleRef:
+ itemCount++; if (skip) goto EXIT;
+ rrn=(RuleRefNode *)n;
+ fprintf(f," %2d to %-27s",itemCount,rrn->text);
+ break;
+ case nAction:
+ a=(ActionNode *)n;
+ goto EXIT;
+ case nJunction:
+
+ j=(Junction *)n;
+
+ switch (j->jtype) {
+ case aSubBlk:
+ if (j->guess) {
+ itemCount++; if (skip) goto EXIT;
+ fprintf(f," %2d %-30s",itemCount,"in (...)? block at");
+ break;
+ };
+/****** fprintf(f," %2d %-32s",itemCount,"in (...) block at"); *******/
+/****** break; *******/
+ goto EXIT;
+ case aOptBlk:
+ itemCount++; if (skip) goto EXIT;
+ fprintf(f," %2d %-30s",itemCount,"in {...} block");
+ break;
+ case aLoopBlk:
+ itemCount++; if (skip) goto EXIT;
+ fprintf(f," %2d %-30s",itemCount,"in (...)* block");
+ break;
+ case EndBlk:
+ if (j->alpha_beta_guess_end) {
+ itemCount++; if (skip) goto EXIT;
+ fprintf(f," %2d %-30s",itemCount,"end (...)? block at");
+ break;
+ };
+ goto EXIT;
+/****** fprintf(f," %2d %-32s",itemCount,"end of a block at"); *****/
+/****** break; *****/
+ case RuleBlk:
+ itemCount++; if (skip) goto EXIT;
+ fprintf(f," %2d %-30s",itemCount,j->rname);
+ break;
+ case Generic:
+ goto EXIT;
+ case EndRule:
+ itemCount++; if (skip) goto EXIT;
+ fprintf (f," %2d end %-26s",itemCount,j->rname);
+ break;
+ case aPlusBlk:
+ itemCount++; if (skip) goto EXIT;
+ fprintf(f," %2d %-30s",itemCount,"in (...)+ block");
+ break;
+ case aLoopBegin:
+ goto EXIT;
+ };
+ break;
+ };
+ fprintf(f," %-23s line %-4d %s\n",MR_ruleNamePlusOffset(n),n->line,FileStr[n->file]);
+EXIT:
+ return;
+}
+
+
+static PointerStack previousBackTrace={0,0,NULL};
+
+#ifdef __USE_PROTOS
+void MR_backTraceReport(void)
+#else
+void MR_backTraceReport()
+#endif
+{
+ int i;
+ int match = 0;
+ int limitMatch;
+
+ Node *p;
+ TokNode *tn;
+ set remainder;
+ int depth;
+
+ /* Even when doing a k=2 search this routine can get
+ called when there is only 1 token on the stack.
+ This is because something like rRuleRef can change
+ the search value of k from 2 to 1 temporarily.
+ It does this because the it wants to know the k=1
+ first set before it does a k=2 search
+ */
+
+ depth=0;
+ for (i=0; i < MR_BackTraceStack.count ; i++) {
+ p=(Node *) MR_BackTraceStack.data[i];
+ if (p->ntype == nToken) depth++;
+ };
+
+/* MR14 */ if (MR_AmbSourceSearch) {
+/* MR14 */ require (depth <= MR_AmbSourceSearchLimit,"depth > MR_AmbSourceSearchLimit");
+/* MR14 */ }
+
+ /* MR23 THM - Traceback report was being called at the wrong time for -alpha reports */
+ /* Reported by Arpad Beszedes (beszedes@inf.u-szeged.hu) */
+
+ if (MR_AmbSourceSearchLimit == 0 || depth < MR_AmbSourceSearchLimit) {
+ return;
+ };
+
+ MR_backTraceDumpItemReset();
+
+ limitMatch=MR_BackTraceStack.count;
+ if (limitMatch > previousBackTrace.count) {
+ limitMatch=previousBackTrace.count;
+ };
+
+ for (match=0; match < limitMatch; match++) {
+ if (MR_BackTraceStack.data[match] !=
+ previousBackTrace.data[match]) {
+ break;
+ };
+ };
+
+ /* not sure at the moment why there would be duplicates */
+
+ if (match != MR_BackTraceStack.count) {
+
+ fprintf(stdout," Choice:%d Depth:%d Group:%d",
+ (MR_AmbSourceSearchChoice+1),
+ MR_AmbSourceSearchLimit,
+ ++MR_AmbSourceSearchGroup);
+
+ depth=0;
+ fprintf(stdout," (");
+ for (i=0; i < MR_BackTraceStack.count ; i++) {
+ p=(Node *) MR_BackTraceStack.data[i];
+ if (p->ntype != nToken) continue;
+ tn=(TokNode *)p;
+ if (depth != 0) fprintf(stdout," ");
+ fprintf(stdout, "%s", TerminalString(tn->token));
+ depth++;
+ if (! MR_AmbAidMultiple) {
+ if (set_nil(tn->tset)) {
+ set_rm( (unsigned) tn->token,fset[depth]);
+ } else {
+ remainder=set_dif(fset[depth],tn->tset);
+ set_free(fset[depth]);
+ fset[depth]=remainder;
+ };
+ };
+ };
+ fprintf(stdout,")\n");
+
+ for (i=0; i < MR_BackTraceStack.count ; i++) {
+ MR_backTraceDumpItem(stdout, (i<match) ,(Node *) MR_BackTraceStack.data[i]);
+ };
+ fprintf(stdout,"\n");
+ fflush(stdout);
+
+ MR_pointerStackReset(&previousBackTrace);
+
+ for (i=0; i < MR_BackTraceStack.count ; i++) {
+ MR_pointerStackPush(&previousBackTrace,MR_BackTraceStack.data[i]);
+ };
+
+ };
+}
+
+#ifdef __USE_PROTOS
+void MR_setConstrainPointer(set * newConstrainValue)
+#else
+void MR_setConstrainPointer(newConstrainValue)
+ set * newConstrainValue;
+#endif
+{
+ constrain=newConstrainValue;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
new file mode 100644
index 000000000..8e41239f4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
@@ -0,0 +1,4797 @@
+/*
+ * gen.c
+ *
+ * Generate C code (ANSI, K&R, C++)
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include "pcctscfg.h"
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#include "dlgdef.h"
+
+#define NumExprPerLine 4
+static int on1line=0;
+static set tokensRefdInBlock;
+
+ /* T r a n s l a t i o n T a b l e s */
+
+/* C_Trans[node type] == pointer to function that knows how to translate that node. */
+#ifdef __cplusplus
+void (*C_Trans[NumNodeTypes+1])(...) = {
+ NULL,
+ NULL, /* See next table.
+Junctions have many types */
+ (void (*)(...)) genRuleRef,
+ (void (*)(...)) genToken,
+ (void (*)(...)) genAction
+ };
+#else
+void (*C_Trans[NumNodeTypes+1])() = {
+ NULL,
+ NULL, /* See next table.
+Junctions have many types */
+ genRuleRef,
+ genToken,
+ genAction
+ };
+#endif
+
+/* C_JTrans[Junction type] == pointer to function that knows how to translate that
+ * kind of junction node.
+ */
+#ifdef __cplusplus
+void (*C_JTrans[NumJuncTypes+1])(...) = {
+ NULL,
+ (void (*)(...)) genSubBlk,
+ (void (*)(...)) genOptBlk,
+ (void (*)(...)) genLoopBlk,
+ (void (*)(...)) genEndBlk,
+ (void (*)(...)) genRule,
+ (void (*)(...)) genJunction,
+ (void (*)(...)) genEndRule,
+ (void (*)(...)) genPlusBlk,
+ (void (*)(...)) genLoopBegin
+ };
+#else
+void (*C_JTrans[NumJuncTypes+1])() = {
+ NULL,
+ genSubBlk,
+ genOptBlk,
+ genLoopBlk,
+ genEndBlk,
+ genRule,
+ genJunction,
+ genEndRule,
+ genPlusBlk,
+ genLoopBegin
+ };
+#endif
+
+#define PastWhiteSpace(s) while (*(s) == ' ' || *(s) == '\t') {s++;}
+
+static int tabs = 0;
+
+/* MR6 Got tired of text running off page when using standard tab stops */
+
+#define TAB { int i; \
+ if (TabWidth==0) { \
+ for (i=0; i<tabs; i++) fputc('\t', output); \
+ } else { \
+ for (i=0; i<tabs*TabWidth; i++) fputc(' ',output); \
+ }; \
+ }
+
+static void
+#ifdef __USE_PROTOS
+tab( void )
+#else
+tab( )
+#endif
+TAB
+
+#ifdef __USE_PROTOS
+static char *tokenFollowSet(TokNode *);
+static ActionNode *findImmedAction( Node * );
+static void dumpRetValAssign(char *, char *, RuleRefNode *); /* MR30 */
+static void dumpAfterActions(FILE *output);
+static set ComputeErrorSet(Junction *, int, int);
+static void makeErrorClause(Junction *, set, int, int);
+static void DumpFuncHeader( Junction *, RuleEntry * );
+static int has_guess_block_as_first_item(Junction *);
+static int genExprSets(set *, int);
+static void genExprTree( Tree *t, int k );
+static void genExprTreeOriginal( Tree *t, int k ); /* MR10 */
+static char * findOuterHandlerLabel(ExceptionGroup *eg); /* MR7 */
+static void OutLineInfo(FILE *file,int line,char *fileName); /* MR14 */
+#else
+static char *tokenFollowSet();
+static ActionNode *findImmedAction();
+static void dumpRetValAssign();
+static void dumpAfterActions();
+static set ComputeErrorSet();
+static void makeErrorClause();
+static void DumpFuncHeader();
+static int has_guess_block_as_first_item();
+static int genExprSets();
+static void genExprTree();
+static void genExprTreeOriginal(); /* MR10 */
+static char * findOuterHandlerLabel(); /* MR7 */
+static void OutLineInfo(); /* MR14 */
+#endif
+
+#define gen(s) {tab(); fprintf(output, s);}
+#define gen1(s,a) {tab(); fprintf(output, s,a);}
+#define gen2(s,a,b) {tab(); fprintf(output, s,a,b);}
+#define gen3(s,a,b,c) {tab(); fprintf(output, s,a,b,c);}
+#define gen4(s,a,b,c,d) {tab(); fprintf(output, s,a,b,c,d);}
+#define gen5(s,a,b,c,d,e) {tab(); fprintf(output, s,a,b,c,d,e);}
+#define gen6(s,a,b,c,d,e,f) {tab(); fprintf(output, s,a,b,c,d,e,f);}
+#define gen7(s,a,b,c,d,e,f,g) {tab(); fprintf(output, s,a,b,c,d,e,f,g);}
+
+#define _gen(s) {fprintf(output, s);}
+#define _gen1(s,a) {fprintf(output, s,a);}
+#define _gen2(s,a,b) {fprintf(output, s,a,b);}
+#define _gen3(s,a,b,c) {fprintf(output, s,a,b,c);}
+#define _gen4(s,a,b,c,d){fprintf(output, s,a,b,c,d);}
+#define _gen5(s,a,b,c,d,e){fprintf(output, s,a,b,c,d,e);}
+#define _gen6(s,a,b,c,d,e,f){fprintf(output, s,a,b,c,d,e,f);}
+#define _gen7(s,a,b,c,d,e,f,g){fprintf(output, s,a,b,c,d,e,f,g);}
+
+
+/* MR11 a convenient place to set a break point */
+
+#ifdef __USE_PROTOS
+void MR_break(void)
+#else
+void MR_break()
+#endif
+{
+ return;
+}
+
+/* MR10 genTraceOut(Junction *) */
+
+#ifdef __USE_PROTOS
+static void genTraceOut(Junction *q)
+#else
+static void genTraceOut(q)
+ Junction *q;
+#endif
+{
+ if ( TraceGen ) {
+ if ( GenCC ) {gen1("zzTRACEOUT(\"%s\");\n", q->rname);}
+ else gen1("zzTRACEOUT((ANTLRChar *)\"%s\");\n", q->rname);
+ }
+}
+
+static void
+#ifdef __USE_PROTOS
+warn_about_using_gk_option(void)
+#else
+warn_about_using_gk_option()
+#endif
+{
+ static int warned_already=0;
+
+ if ( !DemandLookahead || warned_already ) return;
+ warned_already = 1;
+ warnNoFL("-gk option could cause trouble for <<...>>? predicates");
+}
+
+void
+#ifdef __USE_PROTOS
+freeBlkFsets( Junction *q )
+#else
+freeBlkFsets( q )
+Junction *q;
+#endif
+{
+ int i;
+ Junction *alt;
+ require(q!=NULL, "freeBlkFsets: invalid node");
+
+ for (alt=q; alt != NULL; alt= (Junction *) alt->p2 )
+ {
+ for (i=1; i<=CLL_k; i++) set_free(alt->fset[i]);
+ }
+}
+
+/*
+ * Generate a local variable allocation for each token references
+ * in this block.
+ */
+static void
+#ifdef __USE_PROTOS
+genTokenPointers( Junction *q )
+#else
+genTokenPointers( q )
+Junction *q;
+#endif
+{
+ /* Rule refs are counted and can be referenced, but their
+ * value is not set to anything useful ever.
+ *
+ * The ptrs are to be named _tij where i is the current level
+ * and j is the element number within an alternative.
+ */
+ int first=1, t=0;
+ set a;
+ tokensRefdInBlock = q->tokrefs;
+
+ if ( set_deg(q->tokrefs) == 0 ) return;
+ a = set_dup(q->tokrefs);
+ gen("ANTLRTokenPtr ");
+ for (; !set_nil(a); set_rm(t, a))
+ {
+ t = set_int(a);
+ if ( first ) first = 0;
+ else _gen(",");
+ if ( !DontCopyTokens ) _gen2("_tv%d%d,", BlkLevel, t);
+ _gen2("_t%d%d", BlkLevel, t);
+ if ( !DontCopyTokens ) {_gen2("= &_tv%d%d", BlkLevel, t);}
+ else _gen("=NULL");
+ }
+ _gen(";\n");
+ set_free(a);
+}
+
+static int
+#ifdef __USE_PROTOS
+hasDefaultException(ExceptionGroup *eg)
+#else
+hasDefaultException(eg)
+ExceptionGroup *eg;
+#endif
+{
+ ListNode *q;
+
+ for (q = eg->handlers->next; q!=NULL; q=q->next)
+ {
+ ExceptionHandler *eh = (ExceptionHandler *)q->elem;
+ if ( strcmp("default", eh->signalname)==0 ) {
+ return 1;
+ }
+ }
+ return 0;
+}
+static void
+#ifdef __USE_PROTOS
+dumpException(ExceptionGroup *eg, int no_default_case)
+#else
+dumpException(eg, no_default_case)
+ExceptionGroup *eg;
+int no_default_case;
+#endif
+{
+ char *outerLabel; /* MR7 */
+ int altHandler=0; /* MR7 */
+ int namedHandler=0; /* MR7 */
+
+ outerLabel=findOuterHandlerLabel(eg); /* MR7 */
+
+ if (eg->label != NULL) { /* MR7 */
+ namedHandler=1; /* MR7 */
+ } else if (eg->forRule) { /* MR7 */
+ /* nothing */ /* MR20 */
+ } else { /* MR7 */
+ altHandler=1; /* MR7 */
+ }; /* MR7 */
+
+#if 0
+** if (! eg->used) { /* MR7 */
+** warnFL("exception group never used", /* MR7 */
+** FileStr[eg->altstart->file],eg->altstart->line); /* MR7 */
+** }; /* MR7 */
+#endif
+
+ if (namedHandler) { /* MR7 */
+ gen1("switch ( _signal ) { /* [%s] */\n",eg->label); /* MR7 */
+ } else { /* MR7 */
+ gen("switch ( _signal ) {\n"); /* MR7 */
+ gen("case NoSignal: break; /* MR7 */\n"); /* MR7 */
+ }; /* MR7 */
+ {
+ ListNode *q;
+ for (q = eg->handlers->next; q!=NULL; q=q->next)
+ {
+ ExceptionHandler *eh = (ExceptionHandler *)q->elem;
+ if ( strcmp("default", eh->signalname)==0 ) {
+ gen("default :\n");
+ tabs++;
+ dumpAction(eh->action, output, tabs, -1, 1, 1);
+ gen("_signal=NoSignal; /* MR7 */\n"); /* MR7 */
+ gen("break; /* MR7 */\n"); /* MR7 */
+ tabs--;
+ gen("}\n");
+
+ /* copied from later code in dumpException */ /* MR7 */
+
+ if (namedHandler) { /* MR7 */
+ gen("if (_signal != NoSignal)"); /* MR7 */
+ _gen1(" goto %s_handler; /* MR7 */\n",outerLabel);/* MR7 */
+ } else if (altHandler) { /* MR7 */
+ gen1("goto %s_handler; /* MR7 */\n",outerLabel); /* MR7 */
+ };
+ return;
+ }
+ gen1("case %s :\n", eh->signalname);
+ tabs++;
+ if ( eh->action != NULL )
+ {
+ dumpAction(eh->action, output, tabs, -1, 1, 1);
+ gen("break; /* MR7 */\n"); /* MR7 */
+ }
+ tabs--;
+ }
+ }
+ if ( no_default_case ) return;
+
+ gen("default :\n");
+ tabs++; /* MR7 */
+ gen("break; /* MR7 */\n"); /* MR7 */
+ tabs--; /* MR7 */
+
+ tabs++;
+/***** gen("*_retsignal = _signal;\n"); *****/
+
+ tabs--;
+ gen("}\n");
+
+ if (namedHandler) { /* MR7 */
+ gen("if (_signal != NoSignal)"); /* MR7 */
+ _gen1(" goto %s_handler; /* MR7 */\n",outerLabel); /* MR7 */
+ } else if (altHandler) { /* MR7 */
+ gen1("goto %s_handler; /* MR7 */\n",outerLabel); /* MR7 */
+ };
+
+}
+
+static void
+#ifdef __USE_PROTOS
+dumpExceptions(ListNode *list)
+#else
+dumpExceptions(list)
+ListNode *list;
+#endif
+{
+ ListNode *p;
+
+ for (p = list->next; p!=NULL; p=p->next)
+ {
+ ExceptionGroup *eg = (ExceptionGroup *) p->elem;
+ _gen2("%s%s_handler:\n",
+ eg->label==NULL?"":eg->label,
+ eg->altID==NULL?"":eg->altID);
+ if ( eg->altID!=NULL ) dumpException(eg, 0);
+ else {
+ /* This must be the rule exception handler */
+ dumpException(eg, 1);
+ if ( !hasDefaultException(eg) )
+ {
+ gen("default :\n");
+ tabs++;
+ gen("zzdflthandlers(_signal,_retsignal);\n");
+ tabs--;
+ gen("}\n");
+ }
+ }
+ }
+}
+
+/* For each element label that is found in a rule, generate a unique
+ * Attribute (and AST pointer if GenAST) variable.
+ */
+void
+#ifdef __USE_PROTOS
+genElementLabels(ListNode *list)
+#else
+genElementLabels(list)
+ListNode *list;
+#endif
+{
+ int first=1;
+ ListNode *p;
+
+ if ( GenCC ) {gen("ANTLRTokenPtr");}
+ else {gen("Attrib");}
+ for (p = list->next; p!=NULL; p=p->next)
+ {
+ char *ep = (char *)p->elem;
+ if ( first ) first = 0;
+ else _gen(",");
+ if ( GenCC ) {_gen1(" %s=NULL",ep);}
+ else {_gen1(" %s",ep);}
+ }
+ _gen(";\n");
+
+ if ( !GenAST ) return;
+
+ first = 1;
+ gen("AST");
+ for (p = list->next; p!=NULL; p=p->next)
+ {
+ char *ep = (char *)p->elem;
+ if ( first ) first = 0;
+ else _gen(",");
+ _gen1(" *%s_ast=NULL",ep);
+ }
+ _gen(";\n");
+}
+
+/*
+ * Generate a local variable allocation for each token or rule reference
+ * in this block.
+ */
+static void
+#ifdef __USE_PROTOS
+genASTPointers( Junction *q )
+#else
+genASTPointers( q )
+Junction *q;
+#endif
+{
+ int first=1, t;
+ set a;
+
+ a = set_or(q->tokrefs, q->rulerefs);
+ if ( set_deg(a) > 0 )
+ {
+ gen("AST ");
+ for (; !set_nil(a); set_rm(t, a))
+ {
+ t = set_int(a);
+ if ( first ) first = 0;
+ else _gen(",");
+ _gen2("*_ast%d%d=NULL", BlkLevel, t);
+ }
+ set_free(a);
+ }
+ _gen(";\n");
+}
+
+static void
+#ifdef __USE_PROTOS
+BLOCK_Head( void )
+#else
+BLOCK_Head( )
+#endif
+{
+ gen("{\n");
+ tabs++;
+ if ( !GenCC ) gen1("zzBLOCK(zztasp%d);\n", BlkLevel);
+}
+
+static void
+#ifdef __USE_PROTOS
+BLOCK_Tail( void )
+#else
+BLOCK_Tail( )
+#endif
+{
+ if ( !GenCC ) gen1("zzEXIT(zztasp%d);\n", BlkLevel);
+ if ( !GenCC ) gen("}\n");
+ tabs--;
+ gen("}\n");
+}
+
+static void
+#ifdef __USE_PROTOS
+BLOCK_Preamble( Junction *q )
+#else
+BLOCK_Preamble( q )
+Junction *q;
+#endif
+{
+ ActionNode *a;
+ Junction *begin;
+
+ BLOCK_Head();
+ if ( GenCC ) genTokenPointers(q);
+ if ( GenCC&&GenAST ) genASTPointers(q);
+ if ( q->jtype == aPlusBlk ) gen("int zzcnt=1;\n");
+ if ( q->parm != NULL && !q->predparm ) gen1("zzaPush(%s);\n", q->parm)
+ else if ( !GenCC ) gen("zzMake0;\n");
+ if ( !GenCC ) gen("{\n");
+ if ( q->jtype == aLoopBegin ) begin = (Junction *) ((Junction *)q->p1);
+ else begin = q;
+ if ( has_guess_block_as_first_item(begin) )
+ {
+ gen("zzGUESS_BLOCK\n");
+ }
+ if ( q->jtype == aLoopBegin )
+ a = findImmedAction( ((Junction *)q->p1)->p1 ); /* look at aLoopBlk */
+ else
+ a = findImmedAction( q->p1 );
+ if ( a!=NULL && !a->is_predicate) {
+/* MR21 */ if (!a->noHoist) dumpActionPlus(a, a->action, output, tabs, a->file, a->line, 1);
+ a->done = 1; /* remove action. We have already handled it */
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+genCombinedPredTreeContextOrig( Predicate *p )
+#else
+genCombinedPredTreeContextOrig( p )
+Predicate *p;
+#endif
+{
+ static set *ctx=NULL; /* genExprSets() is destructive, make copy*/
+ require(p!=NULL, "can't make context tree for NULL pred tree");
+
+#ifdef DBG_PRED
+ fprintf(stderr, "enter genCombinedPredTreeContextOrig(%s,0x%x) with sets:\n", p->expr, p);
+ s_fprT(stderr, p->scontext[1]);
+ fprintf(stderr, "\n");
+#endif
+ if ( p->down == NULL )
+ {
+/*** if ( p->k>1 && p->tcontext!=NULL ) ***/
+ if ( p->tcontext!=NULL )
+ {
+ _gen("(");
+ genExprTree(p->tcontext, 1);
+ _gen(")");
+ }
+/*** else if ( p->k==1 && set_deg(p->scontext[1])>0 ) ***/
+ else if ( set_deg(p->scontext[1])>0 )
+ {
+ if ( ctx==NULL ) ctx = (set *)calloc(CLL_k+1, sizeof(set));
+ require(ctx!=NULL, "ctx cannot allocate");
+ ctx[0]=empty;
+ ctx[1]=set_dup(p->scontext[1]);
+ _gen("(");
+ genExprSets(&(ctx[0]), p->k);
+ _gen(")");
+ set_free(ctx[1]);
+ }
+ else if ( p->expr==PRED_AND_LIST || p->expr==PRED_OR_LIST ) {
+ fatal_internal("pred tree is orphan OR or AND list");
+ }
+ else {
+ if (! HoistPredicateContext) {
+ _gen(" 1 /* no context: prc is off */ ");
+ } else {
+ fatal_internal("pred tree context is empty");
+ };
+ }
+ return;
+ }
+
+/* MR10 - make AND just like OR */
+
+ if ( p->expr == PRED_AND_LIST )
+ {
+ Predicate *list = p->down;
+ for (; list!=NULL; list=list->right)
+ {
+ genCombinedPredTreeContextOrig(list);
+ if ( list->right!=NULL ) _gen("|| /* MR10 was wrong */ ");
+ };
+ return;
+ }
+
+ if ( p->expr == PRED_OR_LIST )
+ {
+ Predicate *list = p->down;
+ for (; list!=NULL; list=list->right)
+ {
+ genCombinedPredTreeContextOrig(list);
+ if ( list->right!=NULL ) _gen("||");
+ };
+ return;
+ };
+
+ fatal("pred tree is really wacked");
+}
+
+/* [genCombinedPredTreeContext] */
+
+void
+#ifdef __USE_PROTOS
+genCombinedPredTreeContext( Predicate *p )
+#else
+genCombinedPredTreeContext( p )
+Predicate *p;
+#endif
+{
+ Tree *t;
+ int predDepth=0;
+
+ if (0 && ! MR_usingPredNames && ! MRhoisting) {
+ genCombinedPredTreeContextOrig(p);
+ } else {
+/* MR13 */ MR_pred_depth(p,&predDepth);
+/* MR13 */ if (predDepth == 1) {
+/* MR13 */
+/* MR13 */ set scontext[2];
+/* MR13 */ scontext[0]=empty;
+/* MR13 */ scontext[1]=MR_compute_pred_set(p);
+/* MR13 */ if (set_nil(scontext[1])) {
+/* MR13 */ _gen(" 1 /* MR12 no context (-prc off) */ ");
+/* MR13 */ } else {
+/* MR13 */ _gen("(");
+/* MR13 */ genExprSets(&scontext[0], 1);
+/* MR13 */ set_free(scontext[1]);
+/* MR13 */ _gen(")");
+/* MR13 */ };
+
+ } else {
+ t=MR_compute_pred_tree_context(p);
+ if (t == NULL) {
+ _gen(" 1 /* MR12 no context (-prc off) */ ");
+ } else {
+ _gen("(");
+ genExprTree(t, 1);
+ Tfree(t); /* MR10 */
+ _gen(")");
+ };
+ };
+ };
+}
+
+/* [genPredTreeGate] */
+
+void
+#ifdef __USE_PROTOS
+genPredTreeGate( Predicate *p, int in_and_expr )
+#else
+genPredTreeGate( p, in_and_expr )
+Predicate *p;
+int in_and_expr;
+#endif
+{
+ if ( in_and_expr )
+ {
+ _gen("!(");
+ genCombinedPredTreeContext(p);
+ _gen(")||");
+ if ( p->down!=NULL ) _gen("\n");
+ }
+ else
+ {
+ _gen("(");
+ genCombinedPredTreeContext(p);
+ _gen(")&&");
+ if ( p->down!=NULL ) _gen("\n");
+ }
+}
+
+#ifdef __USE_PROTOS
+void genPredEntry(Predicate *p,int outer)
+#else
+void genPredEntry(p,outer)
+ Predicate *p;
+ int outer;
+#endif
+{
+ int inverted=0;
+ Predicate *q;
+ int localOuter=outer;
+ int needRP=0;
+
+ if (p == NULL) return;
+
+ if (p->predEntry != NULL && p->predEntry->predLiteral != NULL) {
+ if (p->inverted != p->predEntry->pred->inverted) {
+ _gen("! /* inverted pred */ (");
+ needRP=1;
+ } else {
+ if (!localOuter) _gen("(");
+ needRP=1;
+ };
+ dumpAction(p->predEntry->predLiteral,output,0,p->source->file,p->source->line,0);
+ if (needRP) _gen(")");
+ return;
+ };
+
+ inverted=p->inverted;
+
+ if (inverted) {
+ _gen(" ! /* inverted pred */ (");
+ localOuter=1;
+ };
+
+ if (p->expr == PRED_OR_LIST) {
+ if (!localOuter) _gen("(");
+ for (q=p->down; q != NULL ; q=q->right) {
+ genPredEntry(q,0);
+ if (q->right != NULL) _gen(" || ");
+ };
+ if (!localOuter) _gen(")");
+ } else if (p->expr == PRED_AND_LIST) {
+ if (!localOuter) _gen("(");
+ for (q=p->down; q != NULL ; q=q->right) {
+ genPredEntry(q,0);
+ if (q->right != NULL) _gen(" && ");
+ };
+ if (!localOuter) _gen(")");
+ } else {
+ if (!localOuter) _gen("(");
+ require (p->source != NULL,"predEntry->source == NULL");
+ require (p->source->inverted == 0,"dumpPredEntry p->source->inverted != 0");
+ dumpAction(p->source->action,output,0,p->source->file,p->source->line,0);
+ if (!localOuter) _gen(")");
+ };
+
+ if (inverted) {
+ _gen(")");
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+dumpPredAction(ActionNode *anode,
+ char *s,FILE *output,int tabs,int file,int line,int final_newline)
+#else
+dumpPredAction(anode,
+ s,output,tabs,file,line,final_newline)
+
+ ActionNode *anode;
+ char *s;
+ FILE *output;
+ int tabs;
+ int file;
+ int line;
+ int final_newline;
+#endif
+{
+ PredEntry *predEntry=anode->predEntry;
+ int inverted=anode->inverted;
+ Predicate *workPred;
+
+ if (predEntry == NULL) {
+
+ /* inline predicate literal */
+
+ require(inverted == 0,"dumpPredAction action->inverted");
+ dumpAction(s,output,tabs,file,line,final_newline);
+
+ } else {
+
+ /* a reference to a predicate - possibly with an inverted source */
+
+ if (predEntry->predLiteral != NULL) {
+ if (inverted) _gen("! /* inverted pred */ (");
+ dumpAction(predEntry->predLiteral,output,0,anode->file,anode->line,0);
+ if (inverted) _gen(")");
+ } else {
+ workPred=predicate_dup(predEntry->pred);
+ if (inverted) workPred->inverted=!workPred->inverted;
+ genPredEntry(workPred,1);
+ predicate_free(workPred);
+ };
+ };
+}
+
+/* [genPred] */
+
+void
+#ifdef __USE_PROTOS
+genPred(Predicate *p, Node *j,int suppress_sva)
+#else
+genPred(p,j,suppress_sva)
+ Predicate *p;
+ Node *j;
+ int suppress_sva;
+#endif
+{
+ if ( FoundException && !suppress_sva) {_gen("(_sva=(");} /* MR11 suppress_sva */
+ else {_gen("(");}
+ if ( GenLineInfo && j->file != -1 ) _gen("\n");
+ if (p->source != NULL && p->source->ampersandPred != NULL) {
+ if (p->source->ampersandPred->k == 1) {
+
+ set ctx[2];
+
+ ctx[0]=empty;
+ ctx[1]=set_dup(p->source->ampersandPred->scontext[1]);
+
+ _gen("(");
+ genExprSets(&(ctx[0]), p->k);
+ _gen(") && ");
+ set_free(ctx[1]);
+ } else {
+ _gen("( ");
+ genExprTree(p->source->ampersandPred->tcontext,1);
+ _gen(" ) && ");
+ };
+ };
+
+ dumpPredAction((ActionNode *)p->source,
+ p->expr, output, 0, -1 /*indicates no line info*/, j->line, 0);
+
+ if ( FoundException && !suppress_sva) /* MR11 suppress_sva */
+ {_gen("),_sva)");} /* MR10 - get red of "meant ==" messages */
+ else {_gen(")");}
+}
+
+void
+#ifdef __USE_PROTOS
+MR_distinctORcontextOpt(Predicate *p,Node *j,int in_and_expr)
+#else
+MR_distinctORcontextOpt(p,j,in_and_expr)
+ Predicate *p;
+ Node *j;
+ int in_and_expr;
+#endif
+{
+ Predicate *q;
+
+ _gen(" /* MR10 Distinct OR context optimization */ \n");
+
+ if (in_and_expr) {
+ gen("zzpf=0,\n");
+ for (q=p->down; q != NULL; q=q->right) {
+ gen("( ");
+ genCombinedPredTreeContext(q);
+ _gen(" && (zzpf=1, ");
+ genPred(q,j,0);
+ _gen(" )) ||\n");
+ };
+ gen("!zzpf)");
+ } else {
+ require (0,
+ "MR_distinctORcontextOpt: can't get here when using MR_predSimplify");
+#if 0
+** for (q=p->down; q != NULL; q=q->right) {
+** gen("( ");
+** genCombinedPredTreeContext(q);
+** _gen(" && ");
+** genPred(q,j);
+** if (q->right != NULL) {
+** _gen(" ) ||\n");
+** };
+** };
+** gen(")");
+#endif
+ };
+}
+
+void
+#ifdef __USE_PROTOS
+genPredTreeOrig( Predicate *p, Node *j, int in_and_expr )
+#else
+genPredTreeOrig( p, j, in_and_expr )
+Predicate *p;
+Node *j;
+int in_and_expr;
+#endif
+{
+
+/* MR10 */ int allHaveContext=1;
+/* MR10 */ int noneHaveContext=1;
+
+/* MR10 */ MR_predContextPresent(p,&allHaveContext,&noneHaveContext);
+
+ if ( ! noneHaveContext ) /* MR10 context guards ignored when -prc off */
+ {
+ _gen("(");
+ genPredTreeGate(p, in_and_expr);
+ }
+
+ /* if leaf node, just gen predicate */
+
+ if ( p->down==NULL )
+ {
+ genPred(p,j,0);
+ if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
+ return;
+ }
+
+ /* if AND list, do both preds (only two possible) */
+ if ( p->expr == PRED_AND_LIST )
+ {
+#if 0
+** _gen("(");
+** genPredTreeOrig(p->down, j, 1);
+** _gen("&&");
+** genPredTreeOrig(p->down->right, j, 1);
+** _gen(")");
+** if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
+** return;
+#endif
+ /* MR11 - make it work with AND with more than two children - like OR */
+
+ Predicate *list;
+ _gen("(");
+ list = p->down;
+ for (; list!=NULL; list=list->right)
+ {
+ genPredTreeOrig(list, j, 1);
+ if ( list->right!=NULL ) _gen("&&");
+ }
+ _gen(")");
+ if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
+ return;
+ };
+
+ if ( p->expr == PRED_OR_LIST )
+ {
+ Predicate *list;
+ _gen("(");
+ list = p->down;
+ for (; list!=NULL; list=list->right)
+ {
+ genPredTreeOrig(list, j, 0);
+ if ( list->right!=NULL ) _gen("||");
+ }
+ _gen(")");
+ if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
+ return;
+ }
+
+ fatal_internal("genPredTreeOrig: predicate tree is wacked");
+}
+
+#if 0
+** Predicate member dummyPredDepth is no longer used in MR10
+** but we might need it again in the future
+**
+** if (MRhoisting) {
+** if ( !noneHaveContext &&
+** ! in_and_expr &&
+** p->source != NULL &&
+** p->source->dummyPredicateDepth > 0 &&
+** p->down == NULL) {
+** _gen("(");
+** genCombinedPredTreeContext(p);
+** _gen(" )\n");
+** return;
+** };
+** };
+#endif
+
+/* [genPredTree] */
+
+/* in_and_expr
+
+ what to do if the context is wrong
+ what to do if the context is correct but the predicate is false
+
+ remember: if the context is wrong it's the same as if the
+ predicate is true as far as enabling an alternative
+
+ Consider (AND p q r)
+
+ if in an ... && ... expression then you don't want
+ the entire predicate chain to fail just because the
+ context for one component is wrong: so return true
+
+ Consider (OR p q r)
+
+ if in an ... || ... expression then you don't want
+ the entire predicate chain to succeed just because
+ the context for one component is correct when the
+ corresponding test is false: so return false when
+ the context is correct but the test is false.
+*/
+
+void
+#ifdef __USE_PROTOS
+genPredTree( Predicate *p, Node *j, int in_and_expr, int suppress_sva )
+#else
+genPredTree( p, j, in_and_expr, suppress_sva)
+ Predicate *p;
+ Node *j;
+ int in_and_expr;
+ int suppress_sva;
+#endif
+{
+
+ int allHaveContext=1;
+ int noneHaveContext=1;
+ Tree *groupTree;
+ Tree *oneTree;
+ Predicate *q;
+ int identicalORcontextOptimization=0;
+ int identicalANDcontextOptimization=0;
+
+ if (0 && !MR_usingPredNames && !MRhoisting) {
+ genPredTreeOrig(p,j,in_and_expr);
+ return;
+ };
+
+ MR_predContextPresent(p,&allHaveContext,&noneHaveContext);
+
+ if ( ! noneHaveContext ) { /* MR10 context guards ignored when -prc off */
+
+ _gen("(");
+
+ /* MR10 optimize OR predicates which are all leaves */
+
+ if (p->expr == PRED_OR_LIST && MR_allPredLeaves(p->down)) {
+ groupTree=MR_compute_pred_tree_context(p);
+ for (q=p->down ; q != NULL ; q=q->right) {
+ oneTree=MR_compute_pred_tree_context(q);
+ if (! MR_tree_equ(groupTree,oneTree)) {
+ Tfree(oneTree);
+ break;
+ };
+ Tfree(oneTree);
+ };
+ Tfree(groupTree);
+ if (q == NULL) {
+ _gen("/* MR10 individual OR gates suppressed when all predicates are leaves");
+ _gen(" with identical context */\n");
+ genPredTreeGate(p,in_and_expr); /* use the parent's in_and_expr for this gate */
+ identicalORcontextOptimization=1;
+ } else {
+ MR_distinctORcontextOpt(p,j,in_and_expr);
+ return;
+ };
+ } else if (p->expr == PRED_AND_LIST && MR_allPredLeaves(p->down)) {
+
+ /* MR12 optimize AND predicates which are all leaves */
+
+ groupTree=MR_compute_pred_tree_context(p);
+ for (q=p->down ; q != NULL ; q=q->right) {
+ oneTree=MR_compute_pred_tree_context(q);
+ if (! MR_tree_equ(groupTree,oneTree)) {
+ Tfree(oneTree);
+ break;
+ };
+ Tfree(oneTree);
+ };
+ Tfree(groupTree);
+ if (q == NULL) {
+ _gen("/* MR12 individual AND gates suppressed when all predicates are leaves");
+ _gen(" with identical context */\n");
+ genPredTreeGate(p,in_and_expr); /* use the parent's in_and_expr for this gate */
+ identicalANDcontextOptimization=1;
+ } else {
+ genPredTreeGate(p, in_and_expr);
+ };
+ } else {
+ genPredTreeGate(p, in_and_expr);
+ };
+ }
+
+ /* if leaf node, just gen predicate */
+
+ if ( p->down==NULL )
+ {
+ genPred(p,j,suppress_sva);
+ if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
+ return;
+ }
+
+ /* if AND list, do both preds (only two possible) */
+ /* MR10 not any more ! */
+
+ if ( p->expr == PRED_AND_LIST )
+ {
+ Predicate *list;
+ _gen("(");
+ list = p->down;
+ for (; list != NULL; list=list->right) {
+ if (identicalANDcontextOptimization) {
+ genPred(list, j,suppress_sva);
+ } else {
+ genPredTree(list, j, 1, suppress_sva); /* in and context */
+ };
+ if ( list->right!=NULL ) _gen("&&");
+ };
+ _gen(")");
+ if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
+ return;
+ }
+
+ if ( p->expr == PRED_OR_LIST )
+ {
+ Predicate *list;
+ _gen("(");
+ list = p->down;
+ for (; list!=NULL; list=list->right)
+ {
+ if (identicalORcontextOptimization) {
+ genPred(list, j,suppress_sva);
+ } else {
+ genPredTree(list, j, 0, suppress_sva);
+ };
+ if ( list->right!=NULL ) _gen("||");
+ }
+ _gen(")");
+ if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
+ return;
+ }
+
+ fatal_internal("predicate tree is wacked");
+}
+
+/* [genPredTreeMainXX] */
+
+Predicate * /* MR10 */
+#ifdef __USE_PROTOS
+genPredTreeMainXX( Predicate *p, Node *j ,int in_and_expr)
+#else
+genPredTreeMainXX( p, j ,in_and_expr)
+ Predicate *p;
+ Node *j;
+ int in_and_expr;
+#endif
+{
+
+ int allHaveContext=1;
+ int noneHaveContext=1;
+
+#if 0
+ fprintf(stderr,"Pred before\n");
+ dumppred(p);
+ fprintf(stderr,"\n");
+ fprintf(stderr,"Pred after\n");
+ dumppred(p);
+ fprintf(stderr,"\n");
+#endif
+
+ p=MR_predSimplifyALL(p); /* MR10 */
+
+ require (MR_predicate_context_completed(p),"predicate context is not complete");
+
+ MR_cleanup_pred_trees(p); /* MR10 */
+
+ MR_predContextPresent(p,&allHaveContext,&noneHaveContext);
+ if (!noneHaveContext & !allHaveContext) {
+ warnFL("predicate contains elements both with and without context",
+ FileStr[j->file],j->line);
+ };
+
+ if (InfoP) {
+ _gen("\n#if 0\n\n");
+ MR_dumpPred(p,1);
+ _gen("#endif\n");
+ };
+ genPredTree(p,j,in_and_expr,0);
+ return p;
+}
+
+Predicate * /* MR10 */
+#ifdef __USE_PROTOS
+genPredTreeMain( Predicate *p, Node *j)
+#else
+genPredTreeMain( p, j)
+ Predicate *p;
+ Node *j;
+#endif
+{
+ return genPredTreeMainXX(p,j,1);
+}
+
+static void
+#ifdef __USE_PROTOS
+genExprTreeOriginal( Tree *t, int k )
+#else
+genExprTreeOriginal( t, k )
+Tree *t;
+int k;
+#endif
+{
+ require(t!=NULL, "genExprTreeOriginal: NULL tree");
+
+ if ( t->token == ALT )
+ {
+ _gen("("); genExprTreeOriginal(t->down, k); _gen(")");
+ if ( t->right!=NULL )
+ {
+ _gen("||");
+ on1line++;
+ if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); }
+ _gen("("); genExprTreeOriginal(t->right, k); _gen(")");
+ }
+ return;
+ }
+ if ( t->down!=NULL ) _gen("(");
+ _gen1("LA(%d)==",k);
+ if ( TokenString(t->token) == NULL ) _gen1("%d", t->token)
+ else _gen1("%s", TokenString(t->token));
+ if ( t->down!=NULL )
+ {
+ _gen("&&");
+ on1line++;
+ if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); }
+ _gen("("); genExprTreeOriginal(t->down, k+1); _gen(")");
+ }
+ if ( t->down!=NULL ) _gen(")");
+ if ( t->right!=NULL )
+ {
+ _gen("||");
+ on1line++;
+ if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); }
+ _gen("("); genExprTreeOriginal(t->right, k); _gen(")");
+ }
+}
+
+#ifdef __USE_PROTOS
+static void MR_LAtokenString(int k,int token)
+#else
+static void MR_LAtokenString(k,token)
+ int k;
+ int token;
+#endif
+{
+ char *ts;
+
+ ts=TokenString(token);
+ if (ts == NULL) {
+ _gen2(" LA(%d)==%d",k,token);
+ } else {
+ _gen2(" LA(%d)==%s",k,ts);
+ };
+}
+
+
+#ifdef __USE_PROTOS
+static int MR_countLeaves(Tree *t)
+#else
+static int MR_countLeaves(t)
+ Tree *t;
+#endif
+{
+ if (t == NULL) return 0;
+ if (t->token == ALT) {
+ return MR_countLeaves(t->down)+MR_countLeaves(t->right);
+ } else {
+ return 1+MR_countLeaves(t->down)+MR_countLeaves(t->right);
+ };
+}
+
+#ifdef __USE_PROTOS
+static void MR_genOneLine(Tree *tree,int k)
+#else
+static void MR_genOneLine(tree,k)
+ Tree *tree;
+ int k;
+#endif
+{
+ if (tree == NULL) return;
+ if (tree->token == ALT) {
+ MR_genOneLine(tree->down,k);
+ } else {
+ MR_LAtokenString(k,tree->token);
+ if (tree->down != NULL &&
+ tree->down->right == NULL) {
+ _gen(" &&");
+ MR_genOneLine(tree->down,k+1);
+ } else if (tree->down != NULL) {
+ _gen(" && (");
+ MR_genOneLine(tree->down,k+1);
+ _gen(")");
+ };
+ };
+ if (tree->right != NULL) {
+ _gen(" ||");
+ MR_genOneLine(tree->right,k);
+ };
+}
+
+static int across;
+static int depth;
+static int lastkonline;
+
+#ifdef __USE_PROTOS
+static void MR_genMultiLine(Tree *tree,int k)
+#else
+static void MR_genMultiLine(tree,k)
+ Tree *tree;
+ int k;
+#endif
+{
+ int i;
+
+ if (tree == NULL) return;
+ if (tree->token == ALT) {
+ MR_genMultiLine(tree,k);
+ } else {
+ MR_LAtokenString(k,tree->token);
+ lastkonline=k;
+ across++;
+ if (tree->down != NULL && tree->down->right == NULL) {
+ if (across > 3) {
+ _gen("\n");
+ across=0;
+ lastkonline=0;
+ for (i=0 ; i < depth+k ; i++) _gen(" ");
+ _gen("&&");
+ } else {
+ _gen(" &&");
+ };
+ MR_genMultiLine(tree->down,k+1);
+ } else if (tree->down != NULL) {
+ _gen("\n");
+ lastkonline=0;
+ across=0;
+ for (i=0 ; i < depth+k ; i++) _gen(" ");
+ _gen("&& (");
+ MR_genMultiLine(tree->down,k+1);
+ _gen(")");
+ };
+ };
+ if (tree->right != NULL) {
+ if (k < lastkonline) {
+ _gen("\n");
+ across=0;
+ lastkonline=0;
+ for (i=0; i < depth+k-1 ; i++) _gen(" ");
+ _gen("||");
+ } else if (across > 3 ) {
+ _gen("\n");
+ across=0;
+ lastkonline=0;
+ for (i=0; i < depth+k ; i++) _gen(" ");
+ _gen("||");
+ } else {
+ _gen(" ||");
+ };
+ MR_genMultiLine(tree->right,k);
+ };
+}
+
+#ifdef __USE_PROTOS
+static void genExprTree(Tree *tree,int k)
+#else
+static void genExprTree(tree,k)
+ Tree *tree;
+ int k;
+#endif
+{
+ int count;
+
+#if 0
+ /* MR20 THM This was probably an error.
+ The routine should probably reference that static
+ "across" and this declaration hides it.
+ */
+
+ int across;
+#endif
+
+ require (tree != NULL,"genExprTree: tree is NULL");
+ require (k > 0,"genExprTree: k <= 0");
+
+ if (0 && !MRhoisting) { /* MR11 make new version standard */
+ genExprTreeOriginal(tree,k);
+ } else {
+ count=MR_countLeaves(tree);
+ if (count < 5) {
+ MR_genOneLine(tree,k);
+ } else {
+ _gen("\n");
+ across=0;
+ depth=0;
+ lastkonline=0;
+ MR_genMultiLine(tree,k);
+ _gen("\n");
+ };
+ };
+}
+
+
+/*
+ * Generate LL(k) type expressions of the form:
+ *
+ * (LA(1) == T1 || LA(1) == T2 || ... || LA(1) == Tn) &&
+ * (LA(2) == T1 || LA(2) == T2 || ... || LA(2) == Tn) &&
+ * .....
+ * (LA(k) == T1 || LA(k) == T2 || ... || LA(k) == Tn)
+ *
+ * If GenExprSetsOpt generate:
+ *
+ * (setwdi[LA(1)]&(1<<j)) && (setwdi[LA(2)]&(1<<j)) ...
+ *
+ * where n is set_deg(expr) and Ti is some random token and k is the last nonempty
+ * set in fset <=CLL_k.
+ * k=1..CLL_k where CLL_k >= 1.
+ *
+ * This routine is visible only to this file and cannot answer a TRANS message.
+ *
+ */
+
+/* [genExpr] */
+
+static int
+#ifdef __USE_PROTOS
+genExpr( Junction *j )
+#else
+genExpr( j )
+Junction *j;
+#endif
+{
+ int max_k;
+
+ /* if full LL(k) is sufficient, then don't use approximate (-ck) lookahead
+ * from CLL_k..LL_k
+ */
+ {
+ int limit;
+ if ( j->ftree!=NULL ) limit = LL_k;
+ else limit = CLL_k;
+ max_k = genExprSets(j->fset, limit);
+ }
+
+ /* Do tests for real tuples from other productions that conflict with
+ * artificial tuples generated by compression (using sets of tokens
+ * rather than k-trees).
+ */
+ if ( j->ftree != NULL )
+ {
+ _gen(" && !("); genExprTree(j->ftree, 1); _gen(")");
+ }
+
+ if ( ParseWithPredicates && j->predicate!=NULL )
+ {
+ Predicate *p = j->predicate;
+ warn_about_using_gk_option();
+ _gen("&&");
+ j->predicate=genPredTreeMain(p, (Node *)j); /* MR10 */
+ }
+
+ return max_k;
+}
+
+static int
+#ifdef __USE_PROTOS
+genExprSets( set *fset, int limit )
+#else
+genExprSets( fset, limit )
+set *fset;
+int limit;
+#endif
+{
+ int k = 1;
+ int max_k = 0;
+ unsigned *e, *g, firstTime=1;
+
+ if (set_nil(fset[1])) {
+ _gen(" 0 /* MR13 empty set expression - undefined rule ? infinite left recursion ? */ ");
+ MR_BadExprSets++;
+ };
+
+ if ( GenExprSetsOpt )
+ {
+ while ( k <= limit && !set_nil(fset[k]) ) /* MR11 */
+ {
+ if ( set_deg(fset[k])==1 ) /* too simple for a set? */
+ {
+ int e;
+ _gen1("(LA(%d)==",k);
+ e = set_int(fset[k]);
+ if ( TokenString(e) == NULL ) _gen1("%d)", e)
+ else _gen1("%s)", TokenString(e));
+ }
+ else
+ {
+ NewSet();
+ FillSet( fset[k] );
+ _gen3("(setwd%d[LA(%d)]&0x%x)", wordnum, k, 1<<setnum);
+ }
+ if ( k>max_k ) max_k = k;
+ if ( k == CLL_k ) break;
+ k++;
+ if ( k<=limit && !set_nil(fset[k]) ) _gen(" && "); /* MR11 */
+ on1line++;
+ if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); }
+ }
+ return max_k;
+ }
+
+ while ( k<= limit && !set_nil(fset[k]) ) /* MR11 */
+ {
+ if ( (e=g=set_pdq(fset[k])) == NULL ) fatal_internal("genExpr: cannot allocate IF expr pdq set");
+ for (; *e!=nil; e++)
+ {
+ if ( !firstTime ) _gen(" || ") else { _gen("("); firstTime = 0; }
+ on1line++;
+ if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); }
+ _gen1("LA(%d)==",k);
+ if ( TokenString(*e) == NULL ) _gen1("%d", *e)
+ else _gen1("%s", TokenString(*e));
+ }
+ free( (char *)g );
+ _gen(")");
+ if ( k>max_k ) max_k = k;
+ if ( k == CLL_k ) break;
+ k++;
+ if ( k <= limit && !set_nil(fset[k]) ) { firstTime=1; _gen(" && "); } /* MR11 */
+ on1line++;
+ if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); }
+ }
+ return max_k;
+}
+
+/*
+ * Generate code for any type of block. If the last alternative in the block is
+ * empty (not even an action) don't bother doing it. This permits us to handle
+ * optional and loop blocks as well.
+ *
+ * Only do this block, return after completing the block.
+ * This routine is visible only to this file and cannot answer a TRANS message.
+ */
+static set
+#ifdef __USE_PROTOS
+genBlk( Junction *q, int jtype, int *max_k, int *need_right_curly, int * lastAltEmpty /* MR23 */)
+#else
+genBlk( q, jtype, max_k, need_right_curly, lastAltEmpty /* MR23 */)
+Junction *q;
+int jtype;
+int *max_k;
+int *need_right_curly;
+int *lastAltEmpty; /* MR23 */
+#endif
+{
+ set f;
+ Junction *alt;
+ int a_guess_in_block = 0;
+ require(q!=NULL, "genBlk: invalid node");
+ require(q->ntype == nJunction, "genBlk: not junction");
+ *need_right_curly=0;
+ *lastAltEmpty = 0; /* MR23 */
+ if ( q->p2 == NULL ) /* only one alternative? Then don't need if */
+ {
+ if (first_item_is_guess_block((Junction *)q->p1)!=NULL )
+ {
+ if (jtype != aLoopBlk && jtype != aOptBlk && jtype != aPlusBlk) {
+ warnFL("(...)? as only alternative of block is unnecessary", FileStr[q->file], q->line);
+ };
+ gen("zzGUESS\n"); /* guess anyway to make output code consistent */
+/* MR10 disable */ /**** gen("if ( !zzrv )\n"); ****/
+/* MR10 */ gen("if ( !zzrv ) {\n"); tabs++; (*need_right_curly)++;
+ };
+ TRANS(q->p1);
+ return empty; /* no decision to be made-->no error set */
+ }
+
+ f = First(q, 1, jtype, max_k);
+ for (alt=q; alt != NULL; alt= (Junction *) alt->p2 )
+ {
+ if ( alt->p2 == NULL ) /* chk for empty alt */
+ {
+ Node *p = alt->p1;
+ if ( p->ntype == nJunction )
+ {
+ /* we have empty alt */
+/* MR23
+ There is a conflict between giving good error information for non-exceptions
+ and making life easy for those using parser exception handling. Consider:
+
+ r: { A } b;
+ b: B;
+
+ with input "C"
+
+ Before MR21 the error message would be "expecting B - found C". After MR21
+ the error message would be "expect A, B - found C". This was good, but it
+ caused problems for those using parser exceptions because the reference to
+ B was generated inside the {...} where B really wasn't part of the block.
+
+ In MR23 this has been changed for the case where exceptions are in use to
+ not generate the extra check in the tail of the {A} block.
+*/
+
+
+/* MR23 */ if (isEmptyAlt( ((Junction *)p)->p1, (Node *)q->end)) {
+/* MR23 */ *lastAltEmpty = 1;
+/* MR23 */ if (FoundException) {
+/* MR23 */ /* code to restore state if a prev alt didn't follow guess */
+/* MR23 */ if ( a_guess_in_block && jtype != aPlusBlk) {
+/* MR23 */ gen("if ( !zzrv ) zzGUESS_DONE; /* MR28 */\n");
+/* MR23 */ }
+/* MR23 */ break;
+/* MR23 */ };
+/* MR28 */ if (jtype == aPlusBlk) {
+/* MR28 */ break;
+/* MR28 */ }
+/* MR23 */ }
+ }
+ } /* end of for loop on alt */
+
+/* MR10 */ if (alt->p2 == NULL &&
+/* MR10 */ ( q->jtype == aSubBlk || q->jtype == RuleBlk) ) {
+/* MR10 */ if (first_item_is_guess_block(alt)) {
+/* MR10 */ warnFL("(...)? as last alternative of block is unnecessary",
+/* MR10 */ FileStr[alt->file],alt->line);
+/* MR10 */ };
+/* MR10 */ };
+
+ if ( alt != q ) gen("else ")
+ else
+ {
+ if ( DemandLookahead ) {
+ if ( !GenCC ) {gen1("LOOK(%d);\n", *max_k);}
+ else gen1("look(%d);\n", *max_k);
+ }
+ }
+
+ if ( alt!=q )
+ {
+ _gen("{\n");
+ tabs++;
+ (*need_right_curly)++;
+ /* code to restore state if a prev alt didn't follow guess */
+ if ( a_guess_in_block )
+ gen("if ( !zzrv ) zzGUESS_DONE;\n");
+ }
+ if ( first_item_is_guess_block((Junction *)alt->p1)!=NULL )
+ {
+ a_guess_in_block = 1;
+ gen("zzGUESS\n");
+ }
+ gen("if ( ");
+ if ( first_item_is_guess_block((Junction *)alt->p1)!=NULL ) _gen("!zzrv && ");
+ genExpr(alt);
+ _gen(" ) ");
+ _gen("{\n");
+ tabs++;
+ TRANS(alt->p1);
+ --tabs;
+ gen("}\n");
+/* MR10 */ if (alt->p2 == NULL) {
+/* MR10 */ if (first_item_is_guess_block(alt)) {
+/* MR10 */ gen("/* MR10 */ else {\n");
+/* MR10 */ tabs++;
+/* MR10 */ (*need_right_curly)++;
+/* MR10 */ /* code to restore state if a prev alt didn't follow guess */
+/* MR10 */ gen("/* MR10 */ if ( !zzrv ) zzGUESS_DONE;\n");
+/* MR10 */ gen("/* MR10 */ if (0) {} /* last alternative of block is guess block */\n");
+/* MR10 */ };
+/* MR10 */ };
+ }
+ return f;
+}
+
+static int
+#ifdef __USE_PROTOS
+has_guess_block_as_first_item( Junction *q )
+#else
+has_guess_block_as_first_item( q )
+Junction *q;
+#endif
+{
+ Junction *alt;
+
+ for (alt=q; alt != NULL; alt= (Junction *) alt->p2 )
+ {
+ if ( first_item_is_guess_block((Junction *)alt->p1)!=NULL ) return 1;
+ }
+ return 0;
+}
+
+static int
+#ifdef __USE_PROTOS
+has_guess_block_as_last_item( Junction *q )
+#else
+has_guess_block_as_last_item( q )
+Junction *q;
+#endif
+{
+ Junction *alt;
+
+ if (q == NULL) return 0;
+ for (alt=q; alt->p2 != NULL && !( (Junction *) alt->p2)->ignore; alt= (Junction *) alt->p2 ) {};
+ return first_item_is_guess_block( (Junction *) alt->p1) != NULL;
+}
+
+/* MR30 See description of first_item_is_guess_block for background */
+
+Junction *
+#ifdef __USE_PROTOS
+first_item_is_guess_block_extra(Junction *q )
+#else
+first_item_is_guess_block_extra(q)
+Junction *q;
+#endif
+{
+ while ( q!=NULL &&
+ ( ( q->ntype==nAction ) ||
+ ( q->ntype==nJunction &&
+ (q->jtype==Generic || q->jtype == aLoopBlk)
+ )
+ )
+ )
+ {
+ if ( q->ntype==nJunction ) q = (Junction *)q->p1;
+ else q = (Junction *) ((ActionNode *)q)->next;
+ }
+
+ if ( q==NULL ) return NULL;
+ if ( q->ntype!=nJunction ) return NULL;
+ if ( q->jtype!=aSubBlk ) return NULL;
+ if ( !q->guess ) return NULL;
+
+ return q;
+}
+
+/* return NULL if 1st item of alt is NOT (...)? block; else return ptr to aSubBlk node
+ * of (...)?; This function ignores actions and predicates.
+ */
+
+Junction *
+#ifdef __USE_PROTOS
+first_item_is_guess_block( Junction *q )
+#else
+first_item_is_guess_block( q )
+Junction *q;
+#endif
+{
+ Junction * qOriginal = q; /* DEBUG */
+
+ /* MR14 Couldn't find aSubBlock which was a guess block when it lay
+ behind aLoopBlk. The aLoopBlk only appear in conjunction with
+ aLoopBegin, but the routine didn't know that. I think.
+
+ MR14a Added extra parentheses to clarify precedence
+
+ MR30 This appears to have been a mistake. The First set was then
+ computed incorrectly for:
+
+ r : ( (A)? B
+ | C
+ )*
+
+ The routine analysis_point was seeing the guess block when
+ it was still analyzing the loopBegin block. As a consequence,
+ when it looked for the analysis_point it was processing the B, but
+ skipping over the C alternative altogether because it thought
+ it was looking at a guess block, not realizing there was a loop
+ block in front of the loopBegin.
+
+ loopBegin loopBlk subBlk/guess A G EB G B EB EB EB ER
+ | | | ^ ^
+ | | | |
+ | +-> G C G ----------------------+ |
+ | |
+ +--- G G G -------------------------------------+
+
+ Reported by Arpad Beszedes (beszedes@inf.u-szeged.hu).
+
+ MR30 This is still more complicated. This fix caused ambiguity messages
+ to be reported for "( (A B)? )* A B" but not for "( (A B)? )+". Why is
+ there a difference when these are outwardly identical ? It is because the
+ start of a (...)* block is represented by two nodes: a loopBegin block
+ followed by a loopBlock whereas the start of a (...)+ block is
+ represented as a single node: a plusBlock. So if first_item_is_guess_block
+ is called when the current node is a loopBegin it starts with the
+ loop block rather than the sub block which follows the loop block.
+ However, we can't just skip past the loop block because some routines
+ depend on the old implementation. So, we provide a new implementation
+ which does skip the loopBlock. However, which should be called when ?
+ I'm not sure, but my guess is that first_item_is_guess_block_extra (the
+ new one) should only be called for the ambiguity routines.
+
+ */
+
+ while ( q!=NULL &&
+ ( ( q->ntype==nAction ) ||
+ ( q->ntype==nJunction &&
+ (q->jtype==Generic /*** || q->jtype == aLoopBlk ***/ ) /*** MR30 Undo MR14 change ***/
+ )
+ )
+ )
+ {
+ if ( q->ntype==nJunction ) q = (Junction *)q->p1;
+ else q = (Junction *) ((ActionNode *)q)->next;
+ }
+
+ if ( q==NULL ) return NULL;
+ if ( q->ntype!=nJunction ) return NULL;
+ if ( q->jtype!=aSubBlk ) return NULL;
+ if ( !q->guess ) return NULL;
+
+ return q;
+}
+
+/* MR1 */
+/* MR1 10-Apr-97 MR1 Routine to stringize failed semantic predicates msgs */
+/* MR1 */
+
+#define STRINGIZEBUFSIZE 1024
+
+static char stringizeBuf[STRINGIZEBUFSIZE];
+char *
+#ifdef __USE_PROTOS
+stringize(char * s)
+#else
+stringize(s)
+char *s;
+#endif
+
+{
+ char *p;
+ char *stop;
+
+ p=stringizeBuf;
+ stop=&stringizeBuf[1015];
+
+ if (s != 0) {
+ while (*s != 0) {
+ if (p >= stop) {
+ goto stringizeStop;
+ } else if (*s == '\n') {
+ *p++='\\';
+ *p++='n';
+ *p++='\\';
+ *p++=*s++;
+ } else if (*s == '\\') {
+ *p++=*s;
+ *p++=*s++;
+ } else if (*s == '\"') {
+ *p++='\\';
+ *p++=*s++;
+ while (*s != 0) {
+ if (p >= stop) {
+ goto stringizeStop;
+ } else if (*s == '\n') {
+ *p++='\\';
+ *p++=*s++;
+ } else if (*s == '\\') {
+ *p++=*s++;
+ *p++=*s++;
+ } else if (*s == '\"') {
+ *p++='\\';
+ *p++=*s++;
+ break;
+ } else {
+ *p++=*s++;
+ };
+ };
+ } else if (*s == '\'') {
+ *p++=*s++;
+ while (*s != 0) {
+ if (p >= stop) {
+ goto stringizeStop;
+ } else if (*s == '\'') {
+ *p++=*s++;
+ break;
+ } else if (*s == '\\') {
+ *p++=*s++;
+ *p++=*s++;
+ } else if (*s == '\"') {
+ *p++='\\';
+ *p++=*s++;
+ break;
+ } else {
+ *p++=*s++;
+ };
+ };
+ } else {
+ *p++=*s++;
+ };
+ };
+ };
+ goto stringizeExit;
+stringizeStop:
+ *p++='.';
+ *p++='.';
+ *p++='.';
+stringizeExit:
+ *p=0;
+ return stringizeBuf;
+}
+
+#ifdef __USE_PROTOS
+int isNullAction(char *s)
+#else
+int isNullAction(s)
+ char *s;
+#endif
+{
+ char *p;
+ for (p=s; *p != '\0' ; p++) {
+ if (*p != ';' && *p !=' ') return 0;
+ };
+ return 1;
+}
+/* MR1 */
+/* MR1 End of Routine to stringize code for failed predicates msgs */
+/* MR1 */
+
+/* Generate an action. Don't if action is NULL which means that it was already
+ * handled as an init action.
+ */
+void
+#ifdef __USE_PROTOS
+genAction( ActionNode *p )
+#else
+genAction( p )
+ActionNode *p;
+#endif
+{
+ require(p!=NULL, "genAction: invalid node and/or rule");
+ require(p->ntype==nAction, "genAction: not action");
+
+ if ( !p->done ) /* MR10 */ /* MR11 */
+ {
+ if ( p->is_predicate)
+ {
+ if ( p->guardpred != NULL )
+ {
+ Predicate *guardDup=predicate_dup(p->guardpred); /* MR10 */
+ gen("if (!");
+ guardDup=genPredTreeMain(guardDup, (Node *)p);
+ predicate_free(guardDup);
+ }
+/* MR10 */ else if (p->ampersandPred != NULL) {
+/* MR10 */ gen("if (!");
+/* MR10 */ p->ampersandPred=genPredTreeMain(p->ampersandPred, (Node *)p);
+/* MR10 */ }
+ else
+ {
+ gen("if (!(");
+ /* make sure that '#line n' is on front of line */
+ if ( GenLineInfo && p->file != -1 ) _gen("\n");
+ dumpPredAction(p,p->action, output, 0, p->file, p->line, 0);
+ _gen(")");
+ }
+
+/* MR23 Change failed predicate macro to have three arguments:
+
+ macro arg 1: The stringized predicate itself
+ macro arg 2: 0 => no user-defined error action
+ 1 => user-defined error action
+ macro arg 3: The user-defined error action
+
+ This gives the user more control of the error action.
+*/
+ tabs++;
+ gen3(") {zzfailed_pred(\"%s\",%s, { %s } );}\n", /* MR23 */
+ stringize(p->action), /* MR23 */
+ (p->pred_fail == NULL ? /* MR23/MR27 */
+ "0 /* report */" : "1 /* user action */"), /* MR23/MR27 */
+ (p->pred_fail == NULL ? /* MR23 */
+ "; /* no user action */" : p->pred_fail)); /* MR23 */
+ tabs--;
+ }
+ else /* not a predicate */
+ {
+ if (! isNullAction(p->action) && !p->noHoist) {
+ if ( FoundGuessBlk ) {
+ if ( GenCC ) {
+ gen("if ( !guessing ) {\n");
+ } else {
+ gen("zzNON_GUESS_MODE {\n");
+ };
+ };
+ dumpActionPlus(p, p->action, output, tabs, p->file, p->line, 1); /* MR21 */
+ if ( FoundGuessBlk ) gen("}\n");
+ };
+ }
+ }
+ TRANS(p->next)
+}
+
+/*
+ * if invoking rule has !noAST pass zzSTR to rule ref and zzlink it in
+ * else pass addr of temp root ptr (&_ast) (don't zzlink it in).
+ *
+ * if ! modifies rule-ref, then never link it in and never pass zzSTR.
+ * Always pass address of temp root ptr.
+ */
+void
+#ifdef __USE_PROTOS
+genRuleRef( RuleRefNode *p )
+#else
+genRuleRef( p )
+RuleRefNode *p;
+#endif
+{
+ Junction *q;
+ char *handler_id = "";
+ RuleEntry *r, *r2;
+ char *parm = "", *exsig = "";
+
+ int genRuleRef_emittedGuessGuard=0; /* MR10 */
+
+ require(p!=NULL, "genRuleRef: invalid node and/or rule");
+ require(p->ntype==nRuleRef, "genRuleRef: not rule reference");
+
+ if ( p->altstart!=NULL && p->altstart->exception_label!=NULL )
+ handler_id = p->altstart->exception_label;
+
+ r = (RuleEntry *) hash_get(Rname, p->text);
+ if ( r == NULL )
+ {
+ warnFL( eMsg1("rule %s not defined",
+ p->text), FileStr[p->file], p->line );
+ return;
+ }
+
+/* MR8 5-Aug-97 Reported by S.Bochnak@microtool.com.pl */
+/* Don't do assign when no return values declared */
+/* Move definition of q up and use it to guard p->assign */
+
+ q = RulePtr[r->rulenum]; /* find definition of ref'd rule */ /* MR8 */
+
+ r2 = (RuleEntry *) hash_get(Rname, p->rname);
+ if ( r2 == NULL ) {warnNoFL("Rule hash table is screwed up beyond belief"); return;}
+
+ OutLineInfo(output,p->line,FileStr[p->file]);
+
+ if ( GenCC && GenAST ) {
+ gen("_ast = NULL;\n");
+ }
+
+ if ( FoundGuessBlk && p->assign!=NULL && q->ret != NULL ) { /* MR8 */
+ if ( GenCC ) {
+ gen("if ( !guessing ) {\n");
+ } else {
+ gen("zzNON_GUESS_MODE {\n");
+ };
+ tabs++; /* MR11 */
+ genRuleRef_emittedGuessGuard=1; /* MR11 */
+ };
+
+ if ( FoundException ) exsig = "&_signal";
+
+ tab();
+ if ( GenAST )
+ {
+ if ( GenCC ) {
+/**** if ( r2->noAST || p->astnode==ASTexclude )
+****/
+ {
+/**** _gen("_ast = NULL;\n");
+****/
+ parm = "&_ast";
+ }
+/*** we always want to set just a pointer now, then set correct
+pointer after
+
+ else {
+ _gen("_astp =
+(_tail==NULL)?(&_sibling):(&(_tail->_right));\n");
+ parm = "_astp";
+ }
+****/
+ }
+ else {
+ if ( r2->noAST || p->astnode==ASTexclude )
+ {
+ _gen("_ast = NULL; ");
+ parm = "&_ast";
+ }
+ else parm = "zzSTR";
+ }
+ if ( p->assign!=NULL && q->ret!=NULL ) /* MR8 */
+ {
+ if ( !hasMultipleOperands(p->assign) ) {_gen1("%s = ",p->assign);} /* MR23 */
+ else _gen1("{ struct _rv%d _trv; _trv = ", r->rulenum);
+ }
+ if ( FoundException ) {
+ _gen5("%s%s(%s,&_signal%s%s); ",
+ RulePrefix,
+ p->text,
+ parm,
+ (p->parms!=NULL)?",":"",
+ (p->parms!=NULL)?p->parms:"");
+ if ( p->ex_group!=NULL ) {
+ _gen("\n");
+ gen("if (_signal) {\n");
+ tabs++;
+ dumpException(p->ex_group, 0);
+ tabs--;
+ gen("}");
+ }
+ else {
+ _gen1("if (_signal) goto %s_handler;", handler_id);
+ }
+ }
+ else {
+ _gen5("%s%s(%s%s%s);",
+ RulePrefix,
+ p->text,
+ parm,
+ (p->parms!=NULL)?",":"",
+ (p->parms!=NULL)?p->parms:"");
+ }
+ if ( GenCC && (r2->noAST || p->astnode==ASTexclude) )
+ {
+ /* rule has a ! or element does */
+ /* still need to assign to #i so we can play with it */
+ _gen("\n");
+ gen2("_ast%d%d = (AST *)_ast;", BlkLevel-1, p->elnum);
+ }
+ else if ( !r2->noAST && p->astnode == ASTinclude )
+ {
+ /* rule doesn't have a ! and neither does element */
+/* MR10 */ if (FoundGuessBlk && !genRuleRef_emittedGuessGuard) {
+/* MR10 */ _gen("\n");
+/* MR10 */ if (GenCC) gen ("if (!guessing) { /* MR10 */")
+/* MR10 */ else gen ("if (!zzguessing) { /* MR10 */\n");
+/* MR10 */ tabs++;
+/* MR10 */ };
+ if ( GenCC ) {
+ _gen("\n");
+ gen("if ( _tail==NULL ) _sibling = _ast; else _tail->setRight(_ast);\n");
+ gen2("_ast%d%d = (AST *)_ast;\n", BlkLevel-1, p->elnum);
+ tab();
+ }
+ else _gen(" ");
+ if ( GenCC ) {
+ _gen("ASTBase::"); }
+ else _gen("zz");
+ _gen("link(_root, &_sibling, &_tail);");
+
+/* MR10 */ if (FoundGuessBlk && !genRuleRef_emittedGuessGuard) { /* MR10 */
+/* MR10 */ _gen("\n");
+/* MR10 */ tabs--;
+/* MR10 */ if (GenCC) gen ("}; /* MR10 */")
+/* MR10 */ else gen ("}; /* MR10 */");
+/* MR10 */ };
+ }
+ }
+ else
+ {
+ if ( p->assign!=NULL && q->ret!=NULL ) /* MR8 */
+ {
+ if ( !hasMultipleOperands(p->assign) ) {_gen1("%s = ",p->assign);} /* MR23 */
+ else _gen1("{ struct _rv%d _trv; _trv = ", r->rulenum);
+ }
+ if ( FoundException ) {
+ _gen4("%s%s(&_signal%s%s); ",
+ RulePrefix,
+ p->text,
+ (p->parms!=NULL)?",":"",
+ (p->parms!=NULL)?p->parms:"");
+ if ( p->ex_group!=NULL ) {
+ _gen("\n");
+ gen("if (_signal) {\n");
+ tabs++;
+ dumpException(p->ex_group, 0);
+ tabs--;
+ gen("}");
+ }
+ else {
+ _gen1("if (_signal) goto %s_handler;", handler_id);
+ }
+ }
+ else {
+ _gen3("%s%s(%s);",
+ RulePrefix,
+ p->text,
+ (p->parms!=NULL)?p->parms:"");
+ }
+ if ( p->assign!=NULL && q->ret!=NULL ) _gen("\n"); /* MR8 */
+ }
+
+ if ( p->assign!=NULL && q->ret!=NULL) { /* MR8 */
+ if ( hasMultipleOperands(p->assign) ) /* MR23 */
+ {
+ _gen("\n");
+ dumpRetValAssign(p->assign, q->ret, p); /* MR30 */
+ _gen("}");
+ }
+ }
+ _gen("\n");
+
+ /* Handle element labels now */
+ if ( p->el_label!=NULL )
+ {
+ if ( GenAST )
+ {
+ if ( GenCC ) {
+ gen3("%s_ast = _ast%d%d;\n", p->el_label, BlkLevel-1, p->elnum);
+ }
+ else {gen1("%s_ast = zzastCur;\n", p->el_label);}
+ }
+ else if (!GenCC ) {
+ gen1("%s = zzaCur;\n", p->el_label);
+ }
+ }
+
+ if ( FoundGuessBlk && p->assign!=NULL && q->ret!=NULL ) { /* MR8 */
+ /* in guessing mode, don't branch to handler upon error */
+ tabs--; /* MR11 */
+ gen("} else {\n");
+ tabs++; /* MR11 */
+ if ( FoundException ) {
+ gen6("%s%s(%s%s&_signal%s%s);\n",
+ RulePrefix,
+ p->text,
+ parm,
+ (*parm!='\0')?",":"",
+ (p->parms!=NULL)?",":"",
+ (p->parms!=NULL)?p->parms:"");
+ }
+ else {
+ gen5("%s%s(%s%s%s);\n",
+ RulePrefix,
+ p->text,
+ parm,
+ (p->parms!=NULL && *parm!='\0')?",":"",
+ (p->parms!=NULL)?p->parms:"");
+ }
+ tabs--; /* MR11 */
+ gen("}\n");
+ }
+ TRANS(p->next)
+}
+
+/*
+ * Generate code to match a token.
+ *
+ * Getting the next token is tricky. We want to ensure that any action
+ * following a token is executed before the next GetToken();
+ */
+void
+#ifdef __USE_PROTOS
+genToken( TokNode *p )
+#else
+genToken( p )
+TokNode *p;
+#endif
+{
+ RuleEntry *r;
+ char *handler_id = "";
+ ActionNode *a;
+ char *set_name;
+ char *set_nameErrSet;
+ int complement;
+ int ast_label_in_action = 0; /* MR27 */
+ int pushedCmodeAST = 0; /* MR27 */
+
+ require(p!=NULL, "genToken: invalid node and/or rule");
+ require(p->ntype==nToken, "genToken: not token");
+ if ( p->altstart!=NULL && p->altstart->exception_label!=NULL )
+ handler_id = p->altstart->exception_label;
+
+ r = (RuleEntry *) hash_get(Rname, p->rname);
+ if ( r == NULL ) {warnNoFL("Rule hash table is screwed up beyond belief"); return;}
+
+/*
+ * MR27 Has the element label been referenced as an AST (with the # operator) ?
+ * If so, then we'll want to build the AST even though the user has used
+ * the ! operator.
+ */
+/* MR27 */ if (GenAST && p->el_label != NULL) {
+/* MR27 */ ast_label_in_action = list_search_cstring(r->ast_labels_in_actions,
+/* MR27 */ p->el_label);
+/* MR27 */ }
+
+ OutLineInfo(output,p->line,FileStr[p->file]);
+
+ if ( !set_nil(p->tset) ) /* implies '.', ~Tok, or tokenclass */
+ {
+ unsigned e;
+ unsigned eErrSet = 0;
+ set b;
+ set bErrSet; /* MR23 */
+ b = set_dup(p->tset);
+ bErrSet = set_dup(p->tset); /* MR23 */
+ complement = p->complement; /* MR23 */
+ if ( p->tclass!=NULL && complement == 0 /* MR23 */) { /* token class not complemented*/
+ static char buf[MaxRuleName+20]; /* MR23 */
+ static char bufErrSet[MaxRuleName+20]; /* MR23 */
+ if ( p->tclass->dumped ) {
+ e = p->tclass->setnum;
+ eErrSet = p->tclass->setnumErrSet;
+ }
+ else {
+ e = DefErrSet(&b, 0, TokenString(p->token));
+ eErrSet = DefErrSetWithSuffix(0, &bErrSet, 1, TokenString(p->token), "_errset");
+ p->tclass->dumped = 1; /* indicate set has been created */
+ p->tclass->setnum = e;
+ p->tclass->setnumErrSet = eErrSet; /* MR23 */
+ }
+ sprintf(buf, "%s_set", TokenString(p->token));
+ sprintf(bufErrSet, "%s_errset", TokenString(p->token)); /* MR23 */
+ set_name = buf;
+ set_nameErrSet = bufErrSet; /* MR23 */
+ }
+
+ /* MR23 - Forgot about the case of ~TOKCLASS. */
+
+ else if ( p->tclass!=NULL && complement != 0 /* MR23 */)
+ {
+ static char buf[MaxRuleName+20]; /* MR23 */
+ static char bufErrSet[MaxRuleName+20]; /* MR23 */
+ if ( p->tclass->dumpedComplement ) {
+ e = p->tclass->setnumComplement;
+ eErrSet = p->tclass->setnumErrSetComplement;
+ }
+ else {
+ e = DefErrSetWithSuffix(0, &b, 0, TokenString(p->token), "_setbar");
+ eErrSet = DefErrSetWithSuffix(0, &bErrSet, 1, TokenString(p->token), "_errsetbar");
+ p->tclass->dumpedComplement = 1; /* indicate set has been created */
+ p->tclass->setnumComplement = e;
+ p->tclass->setnumErrSetComplement = eErrSet; /* MR23 */
+ }
+ sprintf(buf, "%s_setbar", TokenString(p->token));
+ sprintf(bufErrSet, "%s_errsetbar", TokenString(p->token)); /* MR23 */
+ set_name = buf;
+ set_nameErrSet = bufErrSet; /* MR23 */
+ }
+ else { /* wild card */
+ static char buf[sizeof("zzerr")+10];
+ static char bufErrSet[sizeof("zzerr")+10];
+ int n = DefErrSet( &b, 0, NULL );
+ int nErrSet = DefErrSetWithSuffix(0, &bErrSet, 1, NULL, "_set");
+ if ( GenCC ) sprintf(buf, "err%d", n);
+ else sprintf(buf, "zzerr%d", n);
+ if ( GenCC ) sprintf(bufErrSet, "err%d", nErrSet);
+ else sprintf(bufErrSet, "zzerr%d", nErrSet);
+ set_name = buf;
+ set_nameErrSet = bufErrSet;
+ }
+
+ if ( !FoundException ) {
+/* MR23 */ gen2("zzsetmatch(%s, %s);", set_name, set_nameErrSet);
+ }
+ else if ( p->ex_group==NULL ) {
+ if ( p->use_def_MT_handler )
+ gen3("zzsetmatch_wdfltsig(%s,(ANTLRTokenType)%d,%s);",
+ set_name,
+ p->token,
+ tokenFollowSet(p))
+ else
+ gen2("zzsetmatch_wsig(%s, %s_handler);",
+ set_name,
+ handler_id);
+ }
+ else
+ {
+ gen1("if ( !_setmatch_wsig(%s) ) {\n", set_name);
+ tabs++;
+/* MR6 */ if (FoundGuessBlk) {
+/* MR6 */ if ( GenCC ) {gen("if ( guessing ) goto fail;\n");}
+/* MR6 */ else gen("if ( zzguessing ) goto fail;\n");
+/* MR6 */ };
+ gen("_signal=MismatchedToken;\n");
+ dumpException(p->ex_group, 0);
+ tabs--;
+ gen("}\n");
+ }
+ set_free(b);
+ set_free(bErrSet);
+ }
+ else if ( TokenString(p->token)!=NULL )
+ {
+ if ( FoundException ) {
+ if ( p->use_def_MT_handler )
+ gen2("zzmatch_wdfltsig(%s,%s);",TokenString(p->token),tokenFollowSet(p))
+ else if ( p->ex_group==NULL )
+ {
+ gen2("zzmatch_wsig(%s, %s_handler);",
+ TokenString(p->token),
+ handler_id);
+ }
+ else
+ {
+/* MR6 */ if (GenCC) {
+/* MR6 */ gen1("if ( !_match_wsig(%s) ) {\n", TokenString(p->token));
+/* MR6 */ } else {
+/* MR6 */ gen1("if ( !_zzmatch_wsig(%s) ) {\n", TokenString(p->token));
+/* MR6 */ };
+ tabs++;
+/* MR6 */ if (FoundGuessBlk) {
+/* MR6 */ if ( GenCC ) {gen("if ( guessing ) goto fail;\n");}
+/* MR6 */ else gen("if ( zzguessing ) goto fail;\n");
+/* MR6 */ };
+ gen("_signal=MismatchedToken;\n");
+ dumpException(p->ex_group, 0);
+ tabs--;
+ gen("}\n");
+ }
+ }
+ else gen1("zzmatch(%s);", TokenString(p->token));
+ }
+ else {
+ if ( FoundException ) {
+ if ( p->use_def_MT_handler )
+ gen2("zzmatch_wdfltsig((ANTLRTokenType)%d,%s);",
+ p->token,tokenFollowSet(p))
+ else
+ gen2("zzmatch_wsig(%d,%s_handler);",p->token,handler_id);
+ }
+ else {gen1("zzmatch(%d);", p->token);}
+ }
+
+ a = findImmedAction( p->next );
+ /* generate the token labels */
+ if ( GenCC && p->elnum>0 )
+ {
+ /* If building trees in C++, always gen the LT() assigns */
+ if ( set_el(p->elnum, tokensRefdInBlock) || GenAST )
+ {
+/* MR10 */ if ( FoundGuessBlk ) {
+/* MR10 */ gen("\n");
+/* MR10 */ if (p->label_used_in_semantic_pred) {
+/* MR10 */ gen2(" _t%d%d = (ANTLRTokenPtr)LT(1); /* MR10 */\n", BlkLevel-1, p->elnum);
+/* MR10 */ } else {
+/* MR10 */ gen("if ( !guessing ) {\n"); tab();
+/* MR10 */ _gen2(" _t%d%d = (ANTLRTokenPtr)LT(1);\n", BlkLevel-1, p->elnum);
+/* MR10 */ gen("}\n");
+/* MR10 */ };
+/* MR10 */ } else {
+/* MR10 */ _gen2(" _t%d%d = (ANTLRTokenPtr)LT(1);", BlkLevel-1, p->elnum);
+/* MR10 */ };
+/* MR10 */
+ }
+
+/*
+ * MR23 labase is never used in the C++ runtime library.
+ * and this code is generated only in C++ mode
+ */
+
+/*** if ( LL_k>1 ) / * MR23 disabled */
+/*** if ( !DemandLookahead ) _gen(" labase++;"); / * MR23 disabled */
+/*** _gen("\n"); / * MR23 disabled */
+/*** tab(); / * MR23 disabled */
+ }
+ if ( GenAST )
+ {
+ if ( FoundGuessBlk &&
+ (ast_label_in_action || !(p->astnode == ASTexclude || r->noAST)) )
+ {
+ if ( GenCC ) {_gen("if ( !guessing ) {\n"); tab();}
+ else {_gen("zzNON_GUESS_MODE {\n"); tab();}
+ }
+
+/* MR27 addition when labels referenced when operator ! used */
+
+ pushedCmodeAST = 0; /* MR27 */
+ if (ast_label_in_action && (p->astnode == ASTexclude || r->noAST)) {
+ _gen("\n");
+ if (GenCC) {
+/* MR13 */ if (NewAST) {
+/* MR13 */ gen4("_ast%d%d = newAST(_t%d%d); /* MR27 */\n", BlkLevel-1, p->elnum, BlkLevel-1, p->elnum);
+/* MR13 */ } else {
+/* MR13 */ gen4("_ast%d%d = new AST(_t%d%d); /* MR27 */\n", BlkLevel-1, p->elnum, BlkLevel-1, p->elnum);
+/* MR13 */ }
+ }
+ else {
+ pushedCmodeAST = 1;
+ gen("zzastPush(zzmk_ast(zzastnew(),zzaCur)); /* MR27 */");
+ }
+ }
+
+/* end MR27 addition for labels referenced when operator ! used */
+
+ if (!r->noAST )
+ {
+ if (GenCC && !(p->astnode == ASTexclude) ) {
+ _gen("\n");
+/* MR13 */ if (NewAST) {
+/* MR13 */ gen4("_ast%d%d = newAST(_t%d%d);\n", BlkLevel-1, p->elnum, BlkLevel-1, p->elnum);
+/* MR13 */ } else {
+/* MR13 */ gen4("_ast%d%d = new AST(_t%d%d);\n", BlkLevel-1, p->elnum, BlkLevel-1, p->elnum);
+/* MR13 */ }
+ tab();
+ }
+ if ( GenCC && !(p->astnode == ASTexclude) )
+ {_gen2("_ast%d%d->", BlkLevel-1, p->elnum);}
+ else _gen(" ");
+ if ( p->astnode==ASTchild ) {
+ if ( !GenCC ) _gen("zz");
+ _gen("subchild(_root, &_sibling, &_tail);");
+ }
+ else if ( p->astnode==ASTroot ) {
+ if ( !GenCC ) _gen("zz");
+ _gen("subroot(_root, &_sibling, &_tail);");
+ }
+ if ( GenCC && !(p->astnode == ASTexclude) ) {
+ _gen("\n");
+ tab();
+ }
+ }
+ else if ( !GenCC ) {
+ if (! pushedCmodeAST) _gen(" zzastDPush;");
+ }
+ if ( FoundGuessBlk &&
+ (ast_label_in_action || !(p->astnode == ASTexclude || r->noAST)) )
+ {gen("}\n"); tab();}
+ }
+
+ /* Handle element labels now */
+ if ( p->el_label!=NULL )
+ {
+ int done_NON_GUESSMODE=0;
+
+ _gen("\n");
+
+/* MR10 */ /* do Attrib / Token ptr for token label used in semantic pred */
+/* MR10 */ /* for these cases do assign even in guess mode */
+/* MR10 */
+/* MR10 */ if (p->label_used_in_semantic_pred) {
+/* MR10 */ if ( GenCC ) {
+/* MR10 */ if ( set_el(p->elnum, tokensRefdInBlock) || GenAST ) {
+/* MR10 */ gen3("%s = _t%d%d;", p->el_label, BlkLevel-1, p->elnum);
+/* MR10 */ } else {
+/* MR10 */ gen1("%s = (ANTLRTokenPtr)LT(1);\n", p->el_label);
+/* MR10 */ };
+/* MR10 */ } else {
+/* MR10 */ gen1("%s = zzaCur;", p->el_label);
+/* MR10 */ };
+/* MR10 */ if (FoundGuessBlk) _gen(" /* MR10 */");
+/* MR10 */ _gen("\n");
+/* MR10 */ };
+
+ /* Do Attrib / Token ptr */
+
+/* MR10 */ if (! p->label_used_in_semantic_pred) {
+/* MR10 */
+/* MR10 */ if ( FoundGuessBlk ) {
+/* MR10 */ if (! done_NON_GUESSMODE) {
+/* MR10 */ done_NON_GUESSMODE=1;
+/* MR10 */ if ( GenCC ) {gen("if ( !guessing ) {\n"); tab();}
+/* MR10 */ else {gen("zzNON_GUESS_MODE {\n"); tab();}
+/* MR10 */ };
+/* MR10 */ };
+/* MR10 */
+/* MR10 */ if ( GenCC ) {
+/* MR10 */ if ( set_el(p->elnum, tokensRefdInBlock) || GenAST ) {
+/* MR10 */ gen3("%s = _t%d%d;\n", p->el_label, BlkLevel-1, p->elnum);
+/* MR10 */ } else {
+/* MR10 */ gen1("%s = (ANTLRTokenPtr)LT(1);\n", p->el_label);
+/* MR10 */ };
+/* MR10 */ } else {
+/* MR10 */ gen1("%s = zzaCur;\n", p->el_label);
+/* MR10 */ };
+/* MR10 */ };
+
+ /* Do AST ptr */
+
+ if (GenAST && (ast_label_in_action || !(p->astnode == ASTexclude || r->noAST) )) /* MR27 */
+ {
+
+/* MR10 */ if ( FoundGuessBlk ) {
+/* MR10 */ if (! done_NON_GUESSMODE) {
+/* MR10 */ done_NON_GUESSMODE=1;
+/* MR10 */ if ( GenCC ) {gen("if ( !guessing ) {\n"); tab();}
+/* MR10 */ else {gen("zzNON_GUESS_MODE {\n"); tab();}
+/* MR10 */ };
+/* MR10 */ };
+
+ if ( GenCC ) {
+ gen3("%s_ast = _ast%d%d;\n", p->el_label, BlkLevel-1, p->elnum);
+ }
+ else {gen1("%s_ast = zzastCur;\n", p->el_label);}
+ }
+
+/* MR10 */ if (done_NON_GUESSMODE) {
+/* MR10 */ gen("}\n"); tab();
+/* MR10 */ };
+
+ }
+
+ /* Handle any actions immediately following action */
+ if ( a != NULL ) /* MR10 */ /* MR11 */
+ {
+ /* delay next token fetch until after action */
+ _gen("\n");
+ if ( a->is_predicate)
+ {
+#if 0
+/* Disabled in MR30 ************************************************************
+ And moved into genAction
+ *****************************************************************************
+*/
+
+ gen("if (!(");
+
+ /* make sure that '#line n' is on front of line */ /* MR14 */
+ if ( GenLineInfo && p->file != -1 ) _gen("\n"); /* MR14 */
+ dumpPredAction(a,a->action, output, 0, a->file, a->line, 0);
+
+/* MR23 Change failed predicate macro to have three arguments:
+
+ macro arg 1: The stringized predicate itself
+ macro arg 2: 0 => no user-defined error action
+ 1 => user-defined error action
+ macro arg 3: The user-defined error action
+
+ This gives the user more control of the error action.
+*/
+ _gen(")) \n");
+ tabs++;
+ gen3(" {zzfailed_pred(\"%s\",%s,{ %s } );}\n", /* MR23 */
+ stringize(a->action), /* MR23 */
+ (a->pred_fail == NULL ? /* MR23/MR27 */
+ "0 /* report */" : "1 /* user action */"), /* MR23/MR27 */
+ (a->pred_fail == NULL ? /* MR23 */
+ "; /* no user action */" : a->pred_fail)); /* MR23 */
+ tabs--;
+/* Disabled in MR30 ************************************************************
+ And moved into genAction
+ *****************************************************************************
+*/
+#endif
+ }
+ else /* MR9 a regular action - not a predicate action */
+ {
+
+/* MR23: Search an action which is not a predicate for LT(i),
+ LA(i), or LATEXT(i) in order to warn novice users that
+ it refers to the previous matched token, not the next
+ one. This is different than the case for semantic
+ predicates.
+*/
+
+/* MR23 */ if (GenCC) {
+/* MR23 */ if (strstr(a->action, "LT(") != NULL) LTinTokenAction = 1;
+/* MR23 */ }
+/* MR23 */ else {
+/* MR23 */ if (strstr(a->action, "LA(") != NULL) LTinTokenAction = 1;
+/* MR23 */ if (strstr(a->action, "LATEXT(") != NULL) LTinTokenAction = 1;
+/* MR23 */ }
+
+ if ( FoundGuessBlk ) {
+ if ( GenCC ) {gen("if ( !guessing ) {\n");}
+ else gen("zzNON_GUESS_MODE {\n");
+ }
+ dumpActionPlus(a, a->action, output, tabs, a->file, a->line, 1); /* MR21 */
+ if ( FoundGuessBlk ) gen("}\n");
+ a->done = 1; /* MR30 */
+ }
+/*** a->done = 1; MR30 Moved up into then branch for true actions, but not predicates ***/
+ if ( !DemandLookahead ) {
+ if ( GenCC ) {
+ if ( FoundException && p->use_def_MT_handler ) gen("if (!_signal)");
+ _gen(" consume();")
+ if ( FoundException && p->use_def_MT_handler )
+ _gen(" _signal=NoSignal;");
+ _gen("\n");
+ }
+ else
+ {
+ if ( FoundException && p->use_def_MT_handler ) _gen("if (!_signal)");
+ _gen(" zzCONSUME;\n");
+ if ( FoundException && p->use_def_MT_handler ) _gen(" _signal=NoSignal;");
+ _gen("\n");
+ }
+ }
+ else gen("\n");
+ if (a->done) { /* MR30 */
+ TRANS( a->next ); /* MR30 */
+ } /* MR30 */
+ else { /* MR30 */
+ TRANS( p->next ); /* MR30 */
+ } /* MR30 */
+ }
+ else
+ {
+ if ( !DemandLookahead ) {
+ if ( GenCC ) {
+ if (FoundException && p->use_def_MT_handler) _gen("if (!_signal)");
+ _gen(" consume();")
+ if (FoundException&&p->use_def_MT_handler) _gen(" _signal=NoSignal;");
+ _gen("\n");
+ }
+ else {
+ if (FoundException && p->use_def_MT_handler) _gen("if (!_signal)");
+ _gen(" zzCONSUME;");
+ if ( FoundException && p->use_def_MT_handler ) _gen(" _signal=NoSignal;");
+ _gen("\n");
+ }
+ }
+ else _gen("\n");
+ TRANS(p->next);
+ }
+}
+
+/* MR21
+ *
+ * There was a bug in the code generation for {...} which causes it
+ * to omit the optional tokens from the error messages. The easiest
+ * way to fix this was to make the opt block look like a sub block:
+ *
+ * { a | b | c }
+ *
+ * becomes (internally):
+ *
+ * ( a | b | c | )
+ *
+ * The code for genOptBlk is now identical to genSubBlk except for
+ * cosmetic changes.
+ */
+
+void
+#ifdef __USE_PROTOS
+genOptBlk( Junction *q )
+#else
+genOptBlk( q )
+Junction *q;
+#endif
+{
+ int max_k;
+ set f;
+ int need_right_curly;
+ set savetkref;
+ int lastAltEmpty; /* MR23 */
+ savetkref = tokensRefdInBlock;
+ require(q->ntype == nJunction, "genOptBlk: not junction");
+ require(q->jtype == aOptBlk, "genOptBlk: not opt block");
+
+ OutLineInfo(output,q->line,FileStr[q->file]);
+ BLOCK_Preamble(q);
+ BlkLevel++;
+ BlockPreambleOption(q,q->pFirstSetSymbol); /* MR21 */
+ f = genBlk(q, aOptBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
+/* MR23
+ Bypass error clause generation when exceptions are used in {...} block
+ See multi-line note in genBlk near call to isEmptyAlt.
+*/
+ if (! FoundException) {
+ if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */ );}
+ }
+ else {
+ gen("/* MR23 skip error clause for {...} when exceptions in use */\n");
+ }
+ { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
+ freeBlkFsets(q);
+ --BlkLevel;
+ BLOCK_Tail();
+
+ if ( q->guess )
+ {
+ gen("zzGUESS_DONE\n");
+ }
+
+ /* must duplicate if (alpha)?; one guesses (validates), the
+ * second pass matches */
+ if ( q->guess && analysis_point(q)==q )
+ {
+ OutLineInfo(output,q->line,FileStr[q->file]);
+ BLOCK_Preamble(q);
+ BlkLevel++;
+ f = genBlk(q, aSubBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
+ if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */ );}
+ { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
+ freeBlkFsets(q);
+ --BlkLevel;
+ BLOCK_Tail();
+ }
+
+ tokensRefdInBlock = savetkref;
+ if (q->end->p1 != NULL) TRANS(q->end->p1);
+}
+
+/*
+ * Generate code for a loop blk of form:
+ *
+ * |---|
+ * v |
+ * --o-G-o-->o--
+ */
+void
+#ifdef __USE_PROTOS
+genLoopBlk( Junction *begin, Junction *q, Junction *start, int max_k )
+#else
+genLoopBlk( begin, q, start, max_k )
+Junction *begin;
+Junction *q;
+Junction *start; /* where to start generating code from */
+int max_k;
+#endif
+{
+ set f;
+ int need_right_curly;
+ set savetkref;
+ Junction *guessBlock; /* MR10 */
+ int singleAlt; /* MR10 */
+ int lastAltEmpty; /* MR23 */
+
+ savetkref = tokensRefdInBlock;
+ require(q->ntype == nJunction, "genLoopBlk: not junction");
+ require(q->jtype == aLoopBlk, "genLoopBlk: not loop block");
+
+ if ( q->visited ) return;
+ q->visited = TRUE;
+
+ /* first_item_is_guess_block doesn't care what kind of node it is */
+
+ guessBlock=first_item_is_guess_block( (Junction *) q->p1); /* MR10 */
+ singleAlt=q->p2==NULL; /* MR10 */
+
+ if (singleAlt && !guessBlock) /* MR10 */ /* only one alternative? */
+ {
+ if ( DemandLookahead ) {
+ if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);}
+ else gen1("look(%d);\n", max_k);
+ }
+ gen("while ( ");
+ if ( begin!=NULL ) genExpr(begin);
+ else genExpr(q);
+ /* if no predicates have been hoisted for this single alt (..)*
+ * do so now
+ */
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ if ( ParseWithPredicates && begin->predicate==NULL )
+ {
+ Predicate *a = MR_find_predicates_and_supp((Node *)q->p1);
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+
+ if ( a!=NULL )
+ {
+ _gen("&&");
+ a=genPredTreeMain(a, (Node *)q); /* MR10 */
+ }
+/* MR10 */ if (MRhoisting) {
+/* MR10 */ predicate_free(a);
+/* MR10 */ };
+ }
+ _gen(" ) {\n");
+ tabs++;
+ TRANS(q->p1);
+ if ( !GenCC ) gen1("zzLOOP(zztasp%d);\n", BlkLevel-1);
+ if ( DemandLookahead ) {
+ if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);}
+ else gen1("look(%d);\n", max_k);
+ }
+ --tabs;
+ gen("}\n");
+ freeBlkFsets(q);
+ q->visited = FALSE;
+ tokensRefdInBlock = savetkref;
+ return;
+ }
+ gen("for (;;) {\n"); /* MR20 G. Hobbelt */
+ tabs++;
+/* MR6 */
+/* MR6 "begin" can never be null when called from genLoopBegin */
+/* MR6 because q==(Junction *)begin->p1 and we know q is valid */
+/* MR6 */
+/* MR6 from genLoopBegin: */
+/* MR6 */
+/* MR6 if ( LL_k>1 && !set_nil(q->fset[2]) ) */
+/* MR6 genLoopBlk( q, (Junction *)q->p1, q, max_k ); */
+/* MR6 else genLoopBlk( q, (Junction *)q->p1, NULL, max_k ); */
+/* MR6 */
+ if ( begin!=NULL )
+ {
+ if ( DemandLookahead )
+ {
+ if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);}
+ else gen1("look(%d);\n", max_k);
+ }
+ /* The bypass arc of the (...)* predicts what to do when you fail, but
+ * ONLY after having tested the loop start expression. To avoid this,
+ * we simply break out of the (...)* loop when we find something that
+ * is not in the prediction of the loop (all alts thereof).
+ */
+ gen("if ( !(");
+
+/*** TJP says: It used to use the prediction expression for the bypass arc
+ of the (...)*. HOWEVER, if a non LL^1(k) decision was found, this
+ thing would miss the ftree stored in the aLoopBegin node and generate
+ an LL^1(k) decision anyway.
+
+ *** genExpr((Junction *)begin->p2);
+ ***/
+
+ genExpr((Junction *)begin);
+ _gen(")) break;\n");
+
+ }
+
+ /* generate code for terminating loop (this is optional branch) */
+
+ f = genBlk(q, aLoopBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
+ set_free(f);
+ freeBlkFsets(q);
+
+ /* generate code for terminating loop (this is optional branch) */
+
+/* MR6 */
+/* MR6 30-May-97 Bug reported by Manuel Ornato */
+/* MR6 A definite bug involving the exit from a loop block */
+/* MR6 In 1.23 and later versions (including 1.33) Instead */
+/* MR6 exiting the block and reporting a syntax error the */
+/* MR6 code loops forever. */
+/* MR6 Looking at 1.20 which generates proper code it is not */
+/* MR6 clear which of two changes should be undone. */
+/* MR6 This is my best guess. */
+/* MR6 From earlier MR6 note we know that begin can never be */
+/* MR6 null when genLoopBlk called from genLoopBegin */
+/* MR6 */
+/* MR6 */ if ( begin==NULL) {
+/* MR6 */ /* code for exiting loop "for sure" */
+/* MR6 */ gen("/* Suppressed by MR6 */ /*** else break; ***/\n");
+/* MR6 */ };
+
+/* MR10 */if (singleAlt && guessBlock) {
+/* MR10 */ tabs--;
+/* MR6 */ gen("} else break; /* MR6 code for exiting loop \"for sure\" */\n");
+/* MR10 */ need_right_curly--;
+/* MR10 */ } else {
+/* MR6 */ gen("else break; /* MR6 code for exiting loop \"for sure\" */\n");
+/* MR10 */ };
+
+ { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
+ if ( !GenCC ) gen1("zzLOOP(zztasp%d);\n", BlkLevel-1);
+ --tabs;
+ gen("}\n");
+ q->visited = FALSE;
+ tokensRefdInBlock = savetkref;
+}
+
+/*
+ * Generate code for a loop blk of form:
+ *
+ * |---|
+ * v |
+ * --o-->o-->o-G-o-->o--
+ * | ^
+ * v |
+ * o-----------o
+ *
+ * q->end points to the last node (far right) in the blk.
+ *
+ * Note that q->end->jtype must be 'EndBlk'.
+ *
+ * Generate code roughly of the following form:
+ *
+ * do {
+ * ... code for alternatives ...
+ * } while ( First Set of aLoopBlk );
+ *
+ * OR if > 1 alternative
+ *
+ * do {
+ * ... code for alternatives ...
+ * else break;
+ * } while ( 1 );
+ */
+void
+#ifdef __USE_PROTOS
+genLoopBegin( Junction *q )
+#else
+genLoopBegin( q )
+Junction *q;
+#endif
+{
+ set f;
+ int i;
+ int max_k;
+ set savetkref;
+ savetkref = tokensRefdInBlock;
+ require(q!=NULL, "genLoopBegin: invalid node and/or rule");
+ require(q->ntype == nJunction, "genLoopBegin: not junction");
+ require(q->jtype == aLoopBegin, "genLoopBegin: not loop block");
+ require(q->p2!=NULL, "genLoopBegin: invalid Loop Graph");
+
+ OutLineInfo(output,q->line,FileStr[q->file]);
+
+ BLOCK_Preamble(q);
+ BlkLevel++;
+ BlockPreambleOption(q,q->pFirstSetSymbol); /* MR21 */
+ f = First(q, 1, aLoopBegin, &max_k);
+ /* If not simple LL(1), must specify to start at LoopBegin, not LoopBlk */
+ if ( LL_k>1 && !set_nil(q->fset[2]) )
+ genLoopBlk( q, (Junction *)q->p1, q, max_k );
+ else genLoopBlk( q, (Junction *)q->p1, NULL, max_k );
+
+ for (i=1; i<=CLL_k; i++) set_free(q->fset[i]);
+ for (i=1; i<=CLL_k; i++) set_free(((Junction *)q->p2)->fset[i]);
+ --BlkLevel;
+ BLOCK_Tail();
+ set_free(f);
+ tokensRefdInBlock = savetkref;
+/* MR21 */ if (MR_BlkErr) {
+/* MR21 */ set f, fArray[2];
+/* MR21 */ f = ComputeErrorSet(q,1,0 /* use plus block bypass ? */ );
+/* MR21 */ fArray[0]= empty;
+/* MR21 */ fArray[1]= set_dup(f);
+/* MR21 */ gen("if (");
+/* MR21 */ genExprSets(fArray,1); /* note: destroys set arguments */
+/* MR21 */ _gen(") { /* MR21 option -mrblksynerr */\n");
+/* MR21 */ tabs++;
+/* MR21 */ tab();
+/* MR21 */ _gen("/* nothing */ }\n");
+/* MR21 */ tab();
+/* MR21 */ makeErrorClause(q,f,1,0 /* use plus block bypass ? */ ); /* frees set */
+/* MR21 */ tabs--;
+/* MR21 */ };
+ if (q->end->p1 != NULL) TRANS(q->end->p1);
+}
+
+/*
+ * Generate code for a loop blk of form:
+ *
+ * |---|
+ * v |
+ * --o-G-o-->o--
+ *
+ * q->end points to the last node (far right) in the blk.
+ * Note that q->end->jtype must be 'EndBlk'.
+ *
+ * Generate code roughly of the following form:
+ *
+ * do {
+ * ... code for alternatives ...
+ * } while ( First Set of aPlusBlk );
+ *
+ * OR if > 1 alternative
+ *
+ * do {
+ * ... code for alternatives ...
+ * else if not 1st time through, break;
+ * } while ( 1 );
+ */
+void
+#ifdef __USE_PROTOS
+genPlusBlk( Junction *q )
+#else
+genPlusBlk( q )
+Junction *q;
+#endif
+{
+ int max_k;
+ set f;
+ int need_right_curly;
+ int lastAltEmpty; /* MR23 */
+ set savetkref;
+ Junction *guessBlock; /* MR10 */
+ int singleAlt; /* MR10 */
+
+ savetkref = tokensRefdInBlock;
+ require(q!=NULL, "genPlusBlk: invalid node and/or rule");
+ require(q->ntype == nJunction, "genPlusBlk: not junction");
+ require(q->jtype == aPlusBlk, "genPlusBlk: not Plus block");
+ require(q->p2 != NULL, "genPlusBlk: not a valid Plus block");
+
+ if ( q->visited ) return;
+ q->visited = TRUE;
+ OutLineInfo(output,q->line,FileStr[q->file]);
+ BLOCK_Preamble(q);
+ BlkLevel++;
+
+ BlockPreambleOption((Junction *)q, q->pFirstSetSymbol); /* MR21 */
+
+ /* first_item_is_guess_block doesn't care what kind of node it is */
+
+ guessBlock=first_item_is_guess_block( (Junction *)q->p1); /* MR10 */
+
+ /* if the ignore flag is set on the 2nd alt and that alt is empty,
+ * then it is the implied optional alternative that we added for (...)+
+ * and, hence, only 1 alt.
+ */
+
+/* MR10 Reported by Pulkkinen Esa (esap@cs.tut.fi)
+ * Outer code for guess blocks ignored when there is only one alt
+ * for a (...)+ block.
+ * Force use of regular code rather than "optimized" code for that case
+ */
+
+ singleAlt=( ( (Junction *) q->p2)->p2 == NULL) &&
+ ( ( (Junction *) q->p2)->ignore ); /* only one alternative? */
+
+ if (singleAlt && !guessBlock) /* MR10 */
+ {
+
+ Predicate *a=NULL;
+ /* if the only alt has a semantic predicate, hoist it; must test before
+ * entering loop.
+ */
+ if ( ParseWithPredicates )
+ {
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+ a = MR_find_predicates_and_supp((Node *)q);
+ require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
+
+ if ( a!=NULL ) {
+ gen("if (");
+ a=genPredTreeMain(a, (Node *)q); /* MR10 */
+ _gen(") {\n");
+ }
+ }
+ gen("do {\n");
+ tabs++;
+ TRANS(q->p1);
+ if ( !GenCC ) gen1("zzLOOP(zztasp%d);\n", BlkLevel-1);
+ f = First(q, 1, aPlusBlk, &max_k);
+ if ( DemandLookahead ) {
+ if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);}
+ else gen1("look(%d);\n", max_k);
+ }
+ --tabs;
+ gen("} while ( ");
+ if ( q->parm!=NULL && q->predparm ) _gen1("(%s) && ", q->parm);
+ genExpr(q);
+ if ( ParseWithPredicates && a!=NULL )
+ {
+ if (! MR_comparePredicates(q->predicate,a)) {
+ _gen("&&");
+ a=genPredTreeMain(a, (Node *)q); /* MR10 */
+ };
+ }
+ _gen(" );\n");
+ if ( ParseWithPredicates && a!=NULL ) gen("}\n");
+ --BlkLevel;
+ BLOCK_Tail();
+ q->visited = FALSE;
+ freeBlkFsets(q);
+ set_free(f);
+ tokensRefdInBlock = savetkref;
+/* MR21 */ if (MR_BlkErr) {
+/* MR21 */ set f, fArray[2];
+/* MR21 */ f = ComputeErrorSet(q,1,1 /* use plus block bypass ? */ );
+/* MR21 */ fArray[0]= empty;
+/* MR21 */ fArray[1]= set_dup(f);
+/* MR21 */ gen("if (");
+/* MR21 */ genExprSets(fArray,1); /* note: destroys set arguments */
+/* MR21 */ _gen(") { /* MR21 option -mrblksynerr */\n");
+/* MR21 */ tabs++;
+/* MR21 */ tab();
+/* MR21 */ _gen("/* nothing */ }\n");
+/* MR21 */ tab();
+/* MR21 */ makeErrorClause(q,f,1,1 /* use plus block bypass ? */ ); /* frees set */
+/* MR21 */ tabs--;
+/* MR21 */ };
+ if (q->end->p1 != NULL) TRANS(q->end->p1);
+/* MR10 */ if (MRhoisting) {
+/* MR10 */ predicate_free(a);
+/* MR10 */ };
+ return;
+ }
+ gen("do {\n");
+ tabs++;
+ f = genBlk(q, aPlusBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
+/* MR6 */
+/* MR6 Sinan Karasu (sinan@tardis.ds.boeing.com) */
+/* MR6 Failed to turn off guess mode when leaving block */
+/* MR6 */
+/* MR6 */ if ( has_guess_block_as_last_item(q) ) {
+/* MR10 */ gen("/* MR10 ()+ */ else {\n");
+/* MR10 */ tabs++;
+/* MR10 */ need_right_curly++;
+/* MR10 */ gen("/* MR10 ()+ */ if ( !zzrv ) zzGUESS_DONE;\n");
+/* MR6 */ gen("/* MR10 ()+ */ if ( zzcnt > 1 ) break;\n");
+/* MR10 */ } else {
+/* MR10 */ gen("/* MR10 ()+ */ else {\n");
+/* MR10 */ tabs++;
+/* MR10 */ need_right_curly++;
+/* MR10 */ gen("if ( zzcnt > 1 ) break;\n");
+/* MR10 */ };
+
+/* MR21 */ if (MR_BlkErr && 1 >= max_k) {
+/* MR21 */ set f;
+/* MR21 */ f = ComputeErrorSet(q,1,0 /* use plus block bypass ? */ );
+/* MR21 */ tabs++;
+/* MR21 */ tab();
+/* MR21 */ makeErrorClause(q,f,1,0 /* use plus block bypass ? */ ); /* frees set */
+/* MR21 */ tabs--;
+/* MR21 */ }
+/* MR21 */ else {
+ tab();
+ makeErrorClause(q,f,max_k,1 /* use plus block bypass ? */);
+ /* MR21 I think this generates the wrong set ? */
+ /* MR21 because it includes the plus block bypass ? */
+ /* MR21 but I'm afraid to change it without additional checking */
+ }
+
+ { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
+ freeBlkFsets(q);
+ gen("zzcnt++;");
+ if ( !GenCC ) _gen1(" zzLOOP(zztasp%d);", BlkLevel-1);
+ _gen("\n");
+ if ( DemandLookahead ) {
+ if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);}
+ else gen1("look(%d);\n", max_k);
+ }
+ --tabs;
+ if ( q->parm!=NULL && q->predparm ) {gen1("} while (%s);\n", q->parm);}
+ else gen("} while ( 1 );\n");
+ --BlkLevel;
+ BLOCK_Tail();
+ q->visited = FALSE;
+ tokensRefdInBlock = savetkref;
+/* MR21 */ if (MR_BlkErr) {
+/* MR21 */ set f, fArray[2];
+/* MR21 */ f = ComputeErrorSet(q,1,1 /* use plus block bypass ? */ );
+/* MR21 */ fArray[0]= empty;
+/* MR21 */ fArray[1]= set_dup(f);
+/* MR21 */ gen("if (");
+/* MR21 */ genExprSets(fArray,1); /* note: destroys set arguments */
+/* MR21 */ _gen(") { /* MR21 option -mrblksynerr */\n");
+/* MR21 */ tabs++;
+/* MR21 */ tab();
+/* MR21 */ _gen("/* nothing */ }\n");
+/* MR21 */ tab();
+/* MR21 */ makeErrorClause(q,f,1,1 /* use plus block bypass ? */ ); /* frees set */
+/* MR21 */ tabs--;
+/* MR21 */ };
+ if (q->end->p1 != NULL) TRANS(q->end->p1);
+}
+
+/*
+ * Generate code for a sub blk of alternatives of form:
+ *
+ * --o-G1--o--
+ * | ^
+ * v /|
+ * o-G2-o|
+ * | ^
+ * v |
+ * ..........
+ * | ^
+ * v /
+ * o-Gn-o
+ *
+ * q points to the 1st junction of blk (upper-left).
+ * q->end points to the last node (far right) in the blk.
+ * Note that q->end->jtype must be 'EndBlk'.
+ * The last node in every alt points to q->end.
+ *
+ * Generate code of the following form:
+ * if ( First(G1) ) {
+ * ...code for G1...
+ * }
+ * else if ( First(G2) ) {
+ * ...code for G2...
+ * }
+ * ...
+ * else {
+ * ...code for Gn...
+ * }
+ */
+
+void
+#ifdef __USE_PROTOS
+genSubBlk( Junction *q )
+#else
+genSubBlk( q )
+Junction *q;
+#endif
+{
+ int max_k;
+ set f;
+ int need_right_curly;
+ int lastAltEmpty; /* MR23 */
+ set savetkref;
+ savetkref = tokensRefdInBlock;
+ require(q->ntype == nJunction, "genSubBlk: not junction");
+ require(q->jtype == aSubBlk, "genSubBlk: not subblock");
+
+ OutLineInfo(output,q->line,FileStr[q->file]);
+ BLOCK_Preamble(q);
+ BlkLevel++;
+ BlockPreambleOption(q,q->pFirstSetSymbol); /* MR21 */
+ f = genBlk(q, aSubBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
+
+/* MR23
+ Bypass error clause generation when exceptions are used in a sub block
+ in which the last alternative is epsilon. Example: "(A | B | )".
+ See multi-line note in genBlk near call to isEmptyAlt.
+*/
+ if (FoundException && lastAltEmpty) {
+ gen("/* MR23 skip error clause for (...| epsilon) when exceptions in use */\n");
+ }
+ else {
+ if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */ );}
+ }
+
+ { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
+ freeBlkFsets(q);
+ --BlkLevel;
+ BLOCK_Tail();
+
+ if ( q->guess )
+ {
+ gen("zzGUESS_DONE\n");
+ }
+
+ /* must duplicate if (alpha)?; one guesses (validates), the
+ * second pass matches */
+ if ( q->guess && analysis_point(q)==q )
+ {
+ OutLineInfo(output,q->line,FileStr[q->file]);
+ BLOCK_Preamble(q);
+ BlkLevel++;
+ f = genBlk(q, aSubBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
+ if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */);}
+ { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
+ freeBlkFsets(q);
+ --BlkLevel;
+ BLOCK_Tail();
+ }
+
+ tokensRefdInBlock = savetkref;
+ if (q->end->p1 != NULL) TRANS(q->end->p1);
+}
+
+static int TnodesAllocatedPrevRule=0;
+
+/*
+ * Generate code for a rule.
+ *
+ * rule--> o-->o-Alternatives-o-->o
+ * Or,
+ * rule--> o-->o-Alternative-o-->o
+ *
+ * The 1st junction is a RuleBlk. The second can be a SubBlk or just a junction
+ * (one alternative--no block), the last is EndRule.
+ * The second to last is EndBlk if more than one alternative exists in the rule.
+ *
+ * To get to the init-action for a rule, we must bypass the RuleBlk,
+ * and possible SubBlk.
+ * Mark any init-action as generated so genBlk() does not regenerate it.
+ */
+void
+#ifdef __USE_PROTOS
+genRule( Junction *q )
+#else
+genRule( q )
+Junction *q;
+#endif
+{
+
+ const char * returnValueInitializer;
+
+do { /* MR10 Change recursion into iteration */
+
+ int max_k;
+ set follow, rk, f;
+ ActionNode *a;
+ RuleEntry *r;
+ int lastAltEmpty; /* MR23 */
+ static int file = -1;
+ int need_right_curly;
+ require(q->ntype == nJunction, "genRule: not junction");
+ require(q->jtype == RuleBlk, "genRule: not rule");
+
+/* MR14 */ require (MR_BackTraceStack.count == 0,"-alpha MR_BackTraceStack.count != 0");
+/* MR14 */ MR_pointerStackReset(&MR_BackTraceStack);
+/* MR14 */ if (AlphaBetaTrace) MR_MaintainBackTrace=1;
+
+ CurRule=q->rname; /* MR11 */
+
+ r = (RuleEntry *) hash_get(Rname, q->rname);
+ if ( r == NULL ) warnNoFL("Rule hash table is screwed up beyond belief");
+ if ( q->file != file ) /* open new output file if need to */
+ {
+/* MR6 */
+/* MR6 Simpler to debug when output goes to stdout rather than a file */
+/* MR6 */
+/* MR6 */ if (UseStdout) {
+/* MR6 */ output = stdout;
+/* MR6 */ } else {
+/* MR6 */ if ( output != NULL) fclose( output );
+/* MR6 */ output = fopen(OutMetaName(outname(FileStr[q->file])), "w");
+/* MR6 */ };
+ require(output != NULL, "genRule: can't open output file");
+
+#ifdef SPECIAL_FOPEN
+ special_fopen_actions(OutMetaName(outname(FileStr[q->file]))); /* MR1 */
+#endif
+ if ( file == -1 ) genHdr1(q->file);
+ else genHdr(q->file);
+ file = q->file;
+ }
+
+ if (InfoM) {
+ fprintf(stderr," rule %s\n",q->rname);
+ fflush(output);
+ };
+
+#if 0
+ if (strcmp(q->rname,"***debug***") == 0) {
+ fprintf(stderr,"***debug*** %s reached\n",q->rname);
+ MR_break();
+ };
+#endif
+
+ DumpFuncHeader(q,r);
+ tabs++;
+
+ /* MR23
+
+ If there is a single return value then it can be initialized in
+ the declaration using assignment syntax. If there are multiple
+ return values then antlr creates a struct and initialization takes
+ place element by element for each element of the struct. For
+ multiple elements the initialization is by assignment so we have
+ to wait until all declarations are done before emitting that code -
+ because of restrictions in C which don't exist in C++.
+
+ In the past (before MR23) the only kind of initialization was
+ the PURIFY macro which was just a memset() of 0. Now we allow
+ the user to specify an initial value. PURIFY is still used in C
+ mode because C does not have constructors. However, PURIFY is
+ not used in C++ mode because it might overwrite information created
+ by elements which have their own ctor.
+
+ */
+
+ if ( q->ret!=NULL )
+ {
+ if ( hasMultipleOperands(q->ret) ) /* MR23 */
+ {
+
+ /* Emit initialization code later. */
+
+ gen1("struct _rv%d _retv;\n",r->rulenum);
+ }
+ else
+ {
+ /* Emit initialization code now. */
+
+ tab();
+ DumpType(q->ret, output);
+ returnValueInitializer = getInitializer(q->ret);
+ if (returnValueInitializer == NULL) { /* MR23 */
+ gen(" _retv;\n"); /* MR1 MR3 */
+ } /* MR23 */
+ else { /* MR23 */
+ gen1(" _retv = %s;\n", returnValueInitializer); /* MR23 */
+ } /* MR23 */
+ }
+ }
+
+ OutLineInfo(output,q->line,FileStr[q->file]);
+
+ if (InfoM) {
+ fflush(output);
+ };
+
+ gen("zzRULE;\n");
+ if ( FoundException )
+ {
+ gen("int _sva=1;\n");
+ }
+ if ( GenCC && GenAST )
+ gen("ASTBase *_ast = NULL, *_sibling = NULL, *_tail = NULL;\n");
+ if ( GenCC ) genTokenPointers(q);
+ if ( GenCC&&GenAST ) genASTPointers(q);
+ if ( q->el_labels!=NULL ) genElementLabels(q->el_labels);
+ if ( FoundException ) gen("int _signal=NoSignal;\n");
+
+ if ( !GenCC ) gen1("zzBLOCK(zztasp%d);\n", BlkLevel);
+
+/* MR10 */ /* move zzTRACEIN to before init action */
+
+/* MR10 */ if ( TraceGen ) {
+/* MR10 */ if ( GenCC ) {gen1("zzTRACEIN(\"%s\");\n", q->rname);}
+/* MR10 */ else gen1("zzTRACEIN((ANTLRChar *)\"%s\");\n", q->rname);
+/* MR10 */ }
+
+/* MR7 Moved PURIFY() to after all local variables have been declared */
+/* MR7 so that the generated code is valid C as well as C++ */
+/* MR7 Jan Mikkelsen 10-June-1997 */
+
+
+ /*
+ MR23 Do the PURIFY macro only for C mode.
+ C++ users should use constructors or initialization expressions.
+ */
+
+ if ( q->ret != NULL ) /* MR7 */
+ { /* MR7 */
+ if (hasMultipleOperands(q->ret)) { /* MR23 */
+ if (PURIFY == TRUE) {
+ gen1("PCCTS_PURIFY(_retv,sizeof(struct _rv%d))\n",r->rulenum); /* MR23 */
+ }
+ } /* MR7 */
+ else { /* MR7 */
+
+ /* MR23
+ If there were only one return value operand and
+ it had an initializer then it would have been
+ initialized in the declaration.
+ */
+
+ returnValueInitializer = getInitializer(q->ret); /* MR23 */
+ if (returnValueInitializer == NULL) { /* MR23 */
+ if (PURIFY == TRUE) {
+ gen("PCCTS_PURIFY(_retv,sizeof("); /* MR23 */
+ DumpType(q->ret, output); /* MR7 */
+ gen("))\n"); /* MR7 */
+ }
+ } /* MR23 */
+ } /* MR7 */
+
+ if (hasMultipleOperands(q->ret)) { /* MR23 */
+ DumpInitializers(output, r, q->ret); /* MR23 */
+ }
+
+ }
+ if ( !GenCC ) gen("zzMake0;\n");
+ if ( FoundException ) gen("*_retsignal = NoSignal;\n");
+
+ if ( !GenCC ) gen("{\n");
+
+ if ( has_guess_block_as_first_item((Junction *)q->p1) )
+ {
+ gen("zzGUESS_BLOCK\n");
+ }
+
+ /* L o o k F o r I n i t A c t i o n */
+ if ( ((Junction *)q->p1)->jtype == aSubBlk )
+ a = findImmedAction( ((Junction *)q->p1)->p1 );
+ else
+ a = findImmedAction( q->p1 ); /* only one alternative in rule */
+ if ( a!=NULL && !a->is_predicate)
+ {
+ /* MR21 */ if (!a->noHoist) dumpActionPlus(a, a->action, output, tabs, a->file, a->line, 1);
+ a->done = 1; /* ignore action. We have already handled it */
+ }
+
+ BlkLevel++;
+ q->visited = TRUE; /* mark RULE as visited for FIRST/FOLLOW */
+ BlockPreambleOption((Junction *)q->p1, NULL); /* MR21 */
+ f = genBlk((Junction *)q->p1, RuleBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
+ if ( q->p1 != NULL )
+ if ( ((Junction *)q->p1)->p2 != NULL )
+ {tab(); makeErrorClause((Junction *)q->p1,f,max_k,0 /* use plus block bypass ? */);}
+ { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
+ freeBlkFsets((Junction *)q->p1);
+ q->visited = FALSE;
+ --BlkLevel;
+ if ( !GenCC ) gen1("zzEXIT(zztasp%d);\n", BlkLevel);
+
+ genTraceOut(q);
+
+ if ( q->ret!=NULL ) gen("return _retv;\n") else gen("return;\n");
+ /* E r r o r R e c o v e r y */
+ NewSet();
+ rk = empty;
+
+/* MR14 */ if (r->dontComputeErrorSet) {
+/* MR14 */ follow=empty;
+ } else {
+ MR_pointerStackReset(&MR_BackTraceStack); /* MR14 */
+ MR_ErrorSetComputationActive=1;
+ REACH(q->end, 1, &rk, follow);
+ MR_ErrorSetComputationActive=0;
+ require (MR_BackTraceStack.count == 0,"K: MR_BackTraceStack.count != 0");
+ }
+
+ FillSet( follow );
+ set_free( follow );
+
+ /* MR20 G. Hobbelt
+ Isn't it so that "fail:" is ONLY referenced when:
+
+ !FoundException || FoundGuessBlk ?
+
+ Therefore add the "if" around this piece of code generation...
+
+ Should guessing mode also use _handler label instead of "fail"
+ when exception handling is active? gen can automatically put
+ "if (guessing)" there so as to skip all kinds of user code.
+
+ */
+
+ if ( !FoundException || FoundGuessBlk ) /* MR20 G. Hobbelt */
+ { /* MR20 G. Hobbelt */
+ _gen("fail:\n");
+ if ( !GenCC ) gen("zzEXIT(zztasp1);\n");
+ if ( FoundGuessBlk ) {
+ if ( !GenCC ) {gen("if ( zzguessing ) zzGUESS_FAIL;\n");}
+ else gen("if ( guessing ) zzGUESS_FAIL;\n");
+ }
+ if ( q->erraction!=NULL )
+ dumpAction(q->erraction, output, tabs, q->file, q->line, 1);
+ if ( GenCC )
+ {
+ gen1("syn(zzBadTok, %s, zzMissSet, zzMissTok, zzErrk);\n",
+ r->egroup==NULL?"(ANTLRChar *)\"\"":r->egroup);
+ }
+ else
+ {
+ gen1("zzsyn(zzMissText, zzBadTok, %s, zzMissSet, zzMissTok, zzErrk, zzBadText);\n",
+ r->egroup==NULL?"(ANTLRChar *)\"\"":r->egroup);
+ }
+ gen3("%sresynch(setwd%d, 0x%x);\n", GenCC?"":"zz", wordnum, 1<<setnum);
+
+ if ( q->ret!=NULL ) {
+ genTraceOut(q);
+ gen("return _retv;\n");
+ } else if ( q->exceptions!=NULL ) {
+ genTraceOut(q);
+ gen("return;\n");
+ } else if (!FoundException) { /* MR10 */
+ genTraceOut(q); /* MR10 */
+ };
+
+ } /* MR20 G. Hobbelt */
+
+ if ( !GenCC ) gen("}\n");
+
+ /* Gen code for exception handlers */
+ /* make sure each path out contains genTraceOut() */
+
+ if ( q->exceptions!=NULL )
+ {
+
+ gen("/* exception handlers */\n");
+
+ dumpExceptions(q->exceptions);
+
+ if ( !r->has_rule_exception )
+ {
+ _gen("_handler:\n");
+ gen("zzdflthandlers(_signal,_retsignal);\n");
+ }
+/* MR20 G. Gobbelt The label "adios" is never referenced */
+
+#if 0
+ _gen("_adios:\n");
+#endif
+ if ( q->ret!=NULL ) {
+ genTraceOut(q);
+ gen("return _retv;\n");
+ }
+ else {
+ genTraceOut(q);
+ gen("return;\n");
+ }
+ }
+ else if ( FoundException )
+ {
+ _gen("_handler:\n");
+ gen("zzdflthandlers(_signal,_retsignal);\n");
+
+/* MR1 */
+/* MR1 7-Apr-97 Fix suggested by: John Bair (jbair@iftime.com) */
+/* MR1 */
+
+ if ( q->ret != NULL) { /* MR1 */
+ genTraceOut(q); /* MR10 */
+ gen("return _retv;\n"); /* MR1 */
+ } else { /* MR1 */
+ genTraceOut(q); /* MR10 */
+ gen("return;\n") ; /* MR1 */
+ }; /* MR1 */
+ }
+
+ tabs--;
+ gen("}\n");
+
+/* MR10 Tired of looking at stacks that are as deep as the number of */
+/* MR10 rules. Changes recursion to iteration. */
+
+ MR_releaseResourcesUsedInRule( (Node *) q ); /* MR10 */
+
+ if (InfoT) {
+ fprintf(output,"\n/* tnodes created for rule %s: %d */\n",
+ q->rname, (TnodesAllocated-TnodesAllocatedPrevRule) );
+ };
+
+ TnodesAllocatedPrevRule=TnodesAllocated;
+
+ if (q->p2 == NULL) dumpAfterActions( output );
+ q=(Junction *)q->p2;
+ require(q==NULL || q->jtype==RuleBlk,"RuleBlk p2 does not point to another RuleBlk");
+
+} while (q != NULL);
+
+/**** The old code ****/
+/**** if ( q->p2 != NULL ) {TRANS(q->p2);} ****/ /* generate code for next rule too */
+/**** else dumpAfterActions( output ); ****/
+
+}
+
+
+/* This is for the function definition, not the declaration. */
+
+static void
+#ifdef __USE_PROTOS
+DumpFuncHeader( Junction *q, RuleEntry *r )
+#else
+DumpFuncHeader( q, r )
+Junction *q;
+RuleEntry *r;
+#endif
+{
+/* */
+/* MR1 10-Apr-97 MR1 Simplify insertion of commas in function header */
+/* */
+ int needComma; /* MR1 */
+
+
+ /* A N S I */
+ _gen("\n");
+ if ( q->ret!=NULL )
+ {
+ if ( hasMultipleOperands(q->ret) ) /* MR23 */
+ {
+ if (GenCC) gen2("%s::_rv%d\n", CurrentClassName, r->rulenum)
+ else gen1("struct _rv%d\n",r->rulenum);
+ }
+ else
+ {
+ DumpType(q->ret, output);
+ gen("\n");
+ }
+ }
+ else
+ {
+ _gen("void\n");
+ }
+/* MR1 */
+/* MR1 10-Apr-97 133MR1 Replace __STDC__ with __USE_PROTOS */
+/* MR1 */
+ if ( !GenCC ) _gen("#ifdef __USE_PROTOS\n"); /* MR1 */
+ if ( !GenCC ) gen2("%s%s(", RulePrefix, q->rname)
+ else gen3("%s::%s%s(", CurrentClassName, RulePrefix,q->rname);
+
+ /* If we generate C++ method names, we must hide default arguments */
+ /* which can appear in the parameter declaration list. */
+ /* NOTICE: this is done only here, for the method definition, but */
+ /* not for the method declaration inside the class */
+ /* definition. This is exactly the behaviour defined in */
+ /* C++ standard for default parameters. */
+
+ DumpANSIFunctionArgDef(output,q, 0 /* emit initializers ? */);
+ _gen("\n");
+
+ if ( GenCC ) {
+ gen("{\n");
+ return;
+ }
+
+ /* K & R */
+ gen("#else\n");
+ gen2("%s%s(", RulePrefix, q->rname);
+ needComma=0; /* MR1 */
+ if ( GenAST ) /* MR1 */
+ { /* MR1 */
+ _gen("_root"); /* MR1 */
+ needComma=1; /* MR1 */
+ } /* MR1 */
+ if ( FoundException ) /* MR1 */
+ { /* MR1 */
+ if (needComma) {_gen(",");needComma=0;}; /* MR1 */
+ _gen("_retsignal"); /* MR1 */
+ needComma=1; /* MR1 */
+ } /* MR1 */
+/* MR5 Change below by Jan Mikkelsen (janm@zeta.org.au) 26-May-97 MR5 */
+ DumpListOfParmNames( q->pdecl, output, needComma ); /* MR5 */
+ gen(")\n");
+ if ( GenAST ) gen("AST **_root;\n");
+ if ( FoundException ) gen("int *_retsignal;\n");
+ DumpOldStyleParms( q->pdecl, output );
+ gen("#endif\n");
+ gen("{\n");
+}
+
+void
+#ifdef __USE_PROTOS
+DumpANSIFunctionArgDef(FILE *f, Junction *q, int bInitializer)
+#else
+DumpANSIFunctionArgDef(f,q,bInitializer)
+FILE *f;
+Junction *q;
+int bInitializer;
+#endif
+{
+ if ( GenAST )
+ {
+ if ( GenCC ) {fprintf(f,"ASTBase **_root");}
+ else fprintf(f,"AST**_root");
+ if ( !FoundException && q->pdecl!=NULL ) fprintf(f,",");
+ }
+ if ( FoundException )
+ {
+ if ( GenAST ) fprintf(f,",");
+ fprintf(f,"int *_retsignal");
+ if ( q->pdecl!=NULL ) {
+ fprintf(f,",");
+ }
+ }
+ if ( q->pdecl!=NULL ) {
+ DumpFormals(f, q->pdecl, bInitializer); /* MR23 */
+ }
+ else {
+ if ( !GenAST && !FoundException ) {
+ fprintf(f,"void");
+ }
+ }
+ fprintf(f,")");
+}
+
+void
+#ifdef __USE_PROTOS
+genJunction( Junction *q )
+#else
+genJunction( q )
+Junction *q;
+#endif
+{
+ require(q->ntype == nJunction, "genJunction: not junction");
+ require(q->jtype == Generic, "genJunction: not generic junction");
+
+ if ( q->p1 != NULL ) TRANS(q->p1);
+ if ( q->p2 != NULL ) TRANS(q->p2);
+}
+
+void
+#ifdef __USE_PROTOS
+genEndBlk( Junction *q )
+#else
+genEndBlk( q )
+Junction *q;
+#endif
+{
+}
+
+void
+#ifdef __USE_PROTOS
+genEndRule( Junction *q )
+#else
+genEndRule( q )
+Junction *q;
+#endif
+{
+}
+
+void
+#ifdef __USE_PROTOS
+genHdr( int file )
+#else
+genHdr( file )
+int file;
+#endif
+{
+ int i;
+
+ _gen("/*\n");
+ _gen(" * A n t l r T r a n s l a t i o n H e a d e r\n");
+ _gen(" *\n");
+ _gen(" * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n");
+ _gen(" * Purdue University Electrical Engineering\n");
+ _gen(" * With AHPCRC, University of Minnesota\n");
+ _gen1(" * ANTLR Version %s\n", Version);
+ _gen(" *\n");
+/* MR10 */ _gen(" * ");
+/* MR10 */ for (i=0 ; i < Save_argc ; i++) {
+/* MR10 */ _gen(" ");
+/* MR10 */ _gen1("%s", Save_argv[i]);
+/* MR10 */ };
+ _gen("\n");
+ _gen(" *\n");
+ _gen(" */\n\n");
+ if (FirstAction != NULL ) dumpAction( FirstAction, output, 0, -1, 0, 1); /* MR11 MR15b */
+ _gen1("#define ANTLR_VERSION %s\n", VersionDef);
+ _gen("#include \"pcctscfg.h\"\n");
+ _gen("#include \"pccts_stdio.h\"\n");
+ if ( strcmp(ParserName, DefaultParserName)!=0 )
+ _gen2("#define %s %s\n", DefaultParserName, ParserName);
+ if ( strcmp(ParserName, DefaultParserName)!=0 )
+ {_gen1("#include \"%s\"\n", RemapFileName);}
+ OutLineInfo(output,1,FileStr[file]);
+ if ( GenCC ) {
+ if ( UserTokenDefsFile != NULL )
+ fprintf(output, "#include %s\n", UserTokenDefsFile);
+ else
+ fprintf(output, "#include \"%s\"\n", DefFileName);
+ }
+
+ if ( HdrAction != NULL ) dumpAction( HdrAction, output, 0, -1, 0, 1);
+ if ( !GenCC && FoundGuessBlk )
+ {
+ _gen("#define ZZCAN_GUESS\n");
+ _gen("#include \"pccts_setjmp.h\"\n"); /* MR15 K.J. Cummings (cummings@peritus.com) */
+ }
+ if ( FoundException )
+ {
+ _gen("#define EXCEPTION_HANDLING\n");
+ _gen1("#define NUM_SIGNALS %d\n", NumSignals);
+ }
+ if ( !GenCC && OutputLL_k > 1 ) _gen1("#define LL_K %d\n", OutputLL_k);
+ if ( GenAST&&!GenCC ) _gen("#define GENAST\n\n");
+ if ( GenAST ) {
+ if ( GenCC ) {_gen1("#include \"%s\"\n\n", ASTBASE_H);}
+ else _gen("#include \"ast.h\"\n\n");
+ }
+ if ( !GenCC && DemandLookahead ) _gen("#define DEMAND_LOOK\n\n");
+#ifdef DUM
+ if ( !GenCC && LexGen ) {
+ _gen1("#define zzEOF_TOKEN %d\n", (TokenInd!=NULL?TokenInd[EofToken]:EofToken));
+ }
+#endif
+ /* ###WARNING: This will have to change when SetWordSize changes */
+ if ( !GenCC ) _gen1("#define zzSET_SIZE %lu\n", NumWords(TokenNum-1)*sizeof(unsigned));
+ if (TraceGen) {
+ _gen("#ifndef zzTRACE_RULES\n"); /* MR20 */
+ _gen("#define zzTRACE_RULES\n"); /* MR20 */
+ _gen("#endif\n"); /* MR22 */
+ };
+ if ( !GenCC ) {_gen("#include \"antlr.h\"\n");}
+ else {
+ _gen1("#include \"%s\"\n", APARSER_H);
+ _gen1("#include \"%s.h\"\n", CurrentClassName);
+ }
+ if ( !GenCC ) {
+ if ( UserDefdTokens )
+ {_gen1("#include %s\n", UserTokenDefsFile);}
+ /* still need this one as it has the func prototypes */
+ _gen1("#include \"%s\"\n", DefFileName);
+ }
+ /* still need this one as it defines the DLG interface */
+ if ( !GenCC ) _gen("#include \"dlgdef.h\"\n");
+ if ( LexGen && GenCC ) _gen1("#include \"%s\"\n", DLEXERBASE_H);
+ if ( GenCC ) _gen1("#include \"%s\"\n", ATOKPTR_H);
+ if ( !GenCC && LexGen ) _gen1("#include \"%s\"\n", ModeFileName);
+
+/* MR10 Ofer Ben-Ami (gremlin@cs.huji.ac.il) */
+/* MR10 Finally, a definition of the Purify macro */
+
+ if (PURIFY == TRUE) { /* MR23 */
+ _gen("\n/* MR23 In order to remove calls to PURIFY use the antlr"); /* MR23 */
+ _gen(" -nopurify option */\n\n"); /* MR23 */
+ _gen("#ifndef PCCTS_PURIFY\n");
+ _gen("#define PCCTS_PURIFY(r,s) memset((char *) &(r),'\\0',(s));\n");
+ _gen("#endif\n\n");
+ } /* MR23 */
+}
+
+void
+#ifdef __USE_PROTOS
+genHdr1( int file )
+#else
+genHdr1( file )
+int file;
+#endif
+{
+ ListNode *p;
+
+ genHdr(file);
+ if ( GenAST )
+ {
+ if ( !GenCC ) {
+ _gen("#include \"ast.c\"\n");
+ _gen("zzASTgvars\n\n");
+ }
+ }
+ if ( !GenCC ) _gen("ANTLR_INFO\n");
+ if ( BeforeActions != NULL )
+ {
+ for (p = BeforeActions->next; p!=NULL; p=p->next)
+ {
+ UserAction *ua = (UserAction *)p->elem;
+ dumpAction( ua->action, output, 0, ua->file, ua->line, 1);
+ }
+ }
+
+ if ( !FoundException ) return;
+
+ if ( GenCC )
+ {
+ _gen1("\nvoid %s::\n", CurrentClassName);
+ _gen("zzdflthandlers( int _signal, int *_retsignal )\n");
+ _gen("{\n");
+ }
+ else
+ {
+ _gen("\nvoid\n");
+/* MR1 */
+/* MR1 10-Apr-97 133MR1 Replace __STDC__ with __USE_PROTOS */
+/* MR1 */
+ _gen("#ifdef __USE_PROTOS\n"); /* MR1 */
+ _gen("zzdflthandlers( int _signal, int *_retsignal )\n");
+ _gen("#else\n");
+ _gen("zzdflthandlers( _signal, _retsignal )\n");
+ _gen("int _signal;\n");
+ _gen("int *_retsignal;\n");
+ _gen("#endif\n");
+ _gen("{\n");
+ }
+ tabs++;
+ if ( DefaultExGroup!=NULL )
+ {
+ dumpException(DefaultExGroup, 1);
+ if ( !hasDefaultException(DefaultExGroup) )
+ {
+ gen("default :\n");
+ tabs++;
+ gen("*_retsignal = _signal;\n");
+ tabs--;
+ gen("}\n");
+ }
+ }
+ else {
+ gen("*_retsignal = _signal;\n");
+ }
+
+ tabs--;
+ _gen("}\n\n");
+}
+
+void
+#ifdef __USE_PROTOS
+genStdPCCTSIncludeFile( FILE *f,char *gate ) /* MR10 */
+#else
+genStdPCCTSIncludeFile( f , gate) /* MR10 */
+FILE *f;
+char * gate; /* MR10 */
+#endif
+{
+/* MR10 Ramanathan Santhanam (ps@kumaran.com) */
+/* MR10 Same preprocessor symbol use to gate stdpccts.h */
+/* MR10 even when two grammars are in use. */
+/* MR10 Derive gate symbol from -fh filename */
+
+ if (gate == NULL) {
+ fprintf(f,"#ifndef STDPCCTS_H\n"); /* MR10 */
+ fprintf(f,"#define STDPCCTS_H\n"); /* MR10 */
+ } else {
+ fprintf(f,"#ifndef STDPCCTS_%s_H\n",gate); /* MR10 */
+ fprintf(f,"#define STDPCCTS_%s_H\n",gate); /* MR10 */
+ };
+ fprintf(f,"/*\n");
+ if (gate == NULL) {
+ fprintf(f," * %s -- P C C T S I n c l u d e\n", stdpccts);
+ } else {
+ fprintf(f," * Standard PCCTS include file with -fh %s -- P C C T S I n c l u d e\n", stdpccts);
+ }
+ fprintf(f," *\n");
+ fprintf(f," * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n");
+ fprintf(f," * Purdue University Electrical Engineering\n");
+ fprintf(f," * With AHPCRC, University of Minnesota\n");
+ fprintf(f," * ANTLR Version %s\n", Version);
+ fprintf(f," */\n\n");
+
+ fprintf(f,"#ifndef ANTLR_VERSION\n");
+ fprintf(f,"#define ANTLR_VERSION %s\n", VersionDef);
+ fprintf(f,"#endif\n\n");
+
+ if (FirstAction != NULL ) dumpAction(FirstAction, f, 0, -1, 0, 1); /* MR11 */
+
+ fprintf(f,"#include \"pcctscfg.h\"\n");
+ fprintf(f,"#include \"pccts_stdio.h\"\n");
+ if ( GenCC )
+ {
+ if ( UserDefdTokens )
+ fprintf(f, "#include %s\n", UserTokenDefsFile);
+ else {
+ fprintf(f, "#include \"%s\"\n", DefFileName);
+ }
+
+ fprintf(f, "#include \"%s\"\n", ATOKEN_H);
+
+ if ( HdrAction != NULL ) dumpAction( HdrAction, f, 0, -1, 0, 1);
+
+ fprintf(f, "#include \"%s\"\n", ATOKENBUFFER_H);
+
+ if ( OutputLL_k > 1 ) fprintf(f,"static const unsigned LL_K=%d;\n", OutputLL_k);
+ if ( GenAST ) {
+ fprintf(f, "#include \"%s\"\n", ASTBASE_H);
+ }
+
+ if (TraceGen) {
+ fprintf(f,"#ifndef zzTRACE_RULES\n"); /* MR20 */
+ fprintf(f,"#define zzTRACE_RULES\n"); /* MR20 */
+ fprintf(f,"#endif\n"); /* MR22 */
+ };
+
+ fprintf(f,"#include \"%s\"\n", APARSER_H);
+ fprintf(f,"#include \"%s.h\"\n", CurrentClassName);
+ if ( LexGen ) fprintf(f,"#include \"%s\"\n", DLEXERBASE_H);
+ fprintf(f, "#endif\n");
+ return;
+ }
+
+ if ( strcmp(ParserName, DefaultParserName)!=0 )
+ fprintf(f, "#define %s %s\n", DefaultParserName, ParserName);
+ if ( strcmp(ParserName, DefaultParserName)!=0 )
+ fprintf(f, "#include \"%s\"\n", RemapFileName);
+ if ( UserTokenDefsFile != NULL )
+ fprintf(f, "#include %s\n", UserTokenDefsFile);
+ if ( HdrAction != NULL ) dumpAction( HdrAction, f, 0, -1, 0, 1);
+ if ( FoundGuessBlk )
+ {
+ fprintf(f,"#define ZZCAN_GUESS\n");
+ fprintf(f,"#include \"pccts_setjmp.h\"\n");
+ }
+ if (TraceGen) {
+ fprintf(f,"#ifndef zzTRACE_RULES\n"); /* MR20 */
+ fprintf(f,"#define zzTRACE_RULES\n"); /* MR20 */
+ fprintf(f,"#endif\n"); /* MR22 */
+ };
+ if ( OutputLL_k > 1 ) fprintf(f,"#define LL_K %d\n", OutputLL_k);
+ if ( GenAST ) fprintf(f,"#define GENAST\n");
+ if ( FoundException )
+ {
+/* MR1 7-Apr-97 1.33MR1 */
+/* MR1 Fix suggested by: */
+/* MR1 Francois-Xavier Fontaine (fontaine_f@istvax.ist.lu) */
+
+ fprintf(f,"#define EXCEPTION_HANDLING\n"); /* MR1 */
+ fprintf(f,"#define NUM_SIGNALS %d\n", NumSignals); /* MR1 */
+ }
+ if ( DemandLookahead ) fprintf(f,"#define DEMAND_LOOK\n");
+#ifdef DUM
+ if ( LexGen ) fprintf(f, "#define zzEOF_TOKEN %d\n", (TokenInd!=NULL?TokenInd[EofToken]:EofToken));
+#endif
+ /* ###WARNING: This will have to change when SetWordSize changes */
+ fprintf(f, "#define zzSET_SIZE %lu\n", NumWords(TokenNum-1)*sizeof(unsigned));
+ if (TraceGen) {
+ fprintf(f,"#ifndef zzTRACE_RULES\n"); /* MR20 */
+ fprintf(f,"#define zzTRACE_RULES\n"); /* MR20 */
+ fprintf(f,"#endif\n"); /* MR22 */
+ };
+ fprintf(f,"#include \"antlr.h\"\n");
+ if ( GenAST ) fprintf(f,"#include \"ast.h\"\n");
+ if ( UserDefdTokens )
+ fprintf(f, "#include %s\n", UserTokenDefsFile);
+ /* still need this one as it has the func prototypes */
+ fprintf(f, "#include \"%s\"\n", DefFileName);
+ /* still need this one as it defines the DLG interface */
+ fprintf(f,"#include \"dlgdef.h\"\n");
+ /* don't need this one unless DLG is used */
+ if ( LexGen ) fprintf(f,"#include \"%s\"\n", ModeFileName);
+ fprintf(f,"#endif\n");
+}
+
+/* dump action 's' to file 'output' starting at "local" tab 'tabs'
+ Dump line information in front of action if GenLineInfo is set
+ If file == -1 then GenLineInfo is ignored.
+ The user may redefine the LineInfoFormatStr to his/her liking
+ most compilers will like the default, however.
+
+ June '93; changed so that empty lines are left alone so that
+ line information is correct for the compiler/debuggers.
+*/
+void
+#ifdef __USE_PROTOS
+dumpAction( char *s, FILE *output, int tabs, int file, int line,
+int final_newline )
+#else
+dumpAction( s, output, tabs, file, line, final_newline )
+char *s;
+FILE *output;
+int tabs;
+int file;
+int line;
+int final_newline;
+#endif
+{
+ int inDQuote, inSQuote;
+ require(s!=NULL, "dumpAction: NULL action");
+ require(output!=NULL, eMsg1("dumpAction: output FILE is NULL for %s",s));
+
+ if ( GenLineInfo && file != -1 )
+ {
+ OutLineInfo(output,line,FileStr[file]);
+ }
+ PastWhiteSpace( s );
+ /* don't print a tab if first non-white char is a # (preprocessor command) */
+ if ( *s!='#' ) {TAB;}
+ inDQuote = inSQuote = FALSE;
+ while ( *s != '\0' )
+ {
+ if ( *s == '\\' )
+ {
+ fputc( *s++, output ); /* Avoid '"' Case */
+ if ( *s == '\0' ) return;
+ if ( *s == '\'' ) fputc( *s++, output );
+ if ( *s == '\"' ) fputc( *s++, output );
+ }
+ if ( *s == '\'' )
+ {
+ if ( !inDQuote ) inSQuote = !inSQuote;
+ }
+ if ( *s == '"' )
+ {
+ if ( !inSQuote ) inDQuote = !inDQuote;
+ }
+ if ( *s == '\n' )
+ {
+ fputc('\n', output);
+ s++;
+ PastWhiteSpace( s );
+ if ( *s == '}' )
+ {
+ --tabs;
+ TAB;
+ fputc( *s++, output );
+ continue;
+ }
+ if ( *s == '\0' ) return;
+ if ( *s != '#' ) /* #define, #endif etc.. start at col 1 */
+ {
+ TAB;
+ }
+ }
+ if ( *s == '}' && !(inSQuote || inDQuote) )
+ {
+ --tabs; /* Indent one fewer */
+ }
+ if ( *s == '{' && !(inSQuote || inDQuote) )
+ {
+ tabs++; /* Indent one more */
+ }
+ fputc( *s, output );
+ s++;
+ }
+ if ( final_newline ) fputc('\n', output);
+}
+
+static void
+#ifdef __USE_PROTOS
+dumpAfterActions( FILE *output )
+#else
+dumpAfterActions( output )
+FILE *output;
+#endif
+{
+ ListNode *p;
+ require(output!=NULL, "dumpAfterActions: output file was NULL for some reason");
+ if ( AfterActions != NULL )
+ {
+ for (p = AfterActions->next; p!=NULL; p=p->next)
+ {
+ UserAction *ua = (UserAction *)p->elem;
+ dumpAction( ua->action, output, 0, ua->file, ua->line, 1);
+ }
+ }
+ fclose( output );
+}
+
+/*
+ * Find the next action in the stream of execution. Do not pass
+ * junctions with more than one path leaving them.
+ * Only pass generic junctions.
+ *
+ * Scan forward while (generic junction with p2==NULL)
+ * If we stop on an action, return ptr to the action
+ * else return NULL;
+ */
+static ActionNode *
+#ifdef __USE_PROTOS
+findImmedAction( Node *q )
+#else
+findImmedAction( q )
+Node *q;
+#endif
+{
+ Junction *j;
+ require(q!=NULL, "findImmedAction: NULL node");
+ require(q->ntype>=1 && q->ntype<=NumNodeTypes, "findImmedAction: invalid node");
+
+ while ( q->ntype == nJunction )
+ {
+ j = (Junction *)q;
+ if ( j->jtype != Generic || j->p2 != NULL ) return NULL;
+ q = j->p1;
+ if ( q == NULL ) return NULL;
+ }
+ if ( q->ntype == nAction ) return (ActionNode *)q;
+ return NULL;
+}
+
+static void
+#ifdef __USE_PROTOS
+dumpRetValAssign( char *retval, char *ret_def, RuleRefNode * ruleRef /* MR30 */)
+#else
+dumpRetValAssign( retval, ret_def, ruleRef /* MR30 */)
+char *retval;
+char *ret_def;
+RuleRefNode *ruleRefNode;
+#endif
+{
+ char *q = ret_def;
+
+ tab();
+ while ( *retval != '\0' && *q != '\0')
+ {
+ while ( isspace((*retval)) ) retval++;
+ while ( *retval!=',' && *retval!='\0' ) fputc(*retval++, output);
+ fprintf(output, " = _trv.");
+
+ DumpNextNameInDef(&q, output);
+ while ( isspace(*q) ) q++;
+ fputc(';', output); fputc(' ', output);
+ if ( *retval == ',' ) retval++;
+ }
+ if (*retval == '\0' && *q != '\0') {
+/* MR30 */ errFL("Fewer output values than output formals for rule reference",
+/* MR30 */ FileStr[ruleRef->file],ruleRef->line);
+ }
+ if (*retval != '\0' && *q == '\0') {
+/* MR30 */ errFL("More output actuals than output formals for rule reference",
+/* MR30 */ FileStr[ruleRef->file],ruleRef->line);
+ }
+}
+
+/* This function computes the set of tokens that can possibly be seen k
+ * tokens in the future from point j
+ */
+
+static set
+#ifdef __USE_PROTOS
+ComputeErrorSet( Junction *j, int k, int usePlusBlockBypass)
+#else
+ComputeErrorSet( j, k, usePlusBlockBypass )
+Junction *j;
+int k;
+int usePlusBlockBypass;
+#endif
+{
+ Junction *alt1;
+ set a, rk, f;
+ require(j->ntype==nJunction, "ComputeErrorSet: non junction passed");
+
+ f = rk = empty;
+ for (alt1=j; alt1!=NULL; alt1 = (Junction *)alt1->p2)
+ {
+ if (alt1->ignore && ! usePlusBlockBypass) continue; /* MR21 - Ignore aPlusBlk forward p2 */
+ REACH(alt1->p1, k, &rk, a);
+ require(set_nil(rk), "ComputeErrorSet: rk != nil");
+ set_free(rk);
+ set_orin(&f, a);
+ set_free(a);
+ }
+ return f;
+}
+
+static char *
+#ifdef __USE_PROTOS
+tokenFollowSet(TokNode *p)
+#else
+tokenFollowSet(p)
+TokNode *p;
+#endif
+{
+ static char buf[100];
+ set rk, a;
+ int n;
+ rk = empty;
+
+ REACH(p->next, 1, &rk, a);
+ require(set_nil(rk), "rk != nil");
+ set_free(rk);
+ n = DefErrSet( &a, 0, NULL );
+ set_free(a);
+ if ( GenCC )
+ sprintf(buf, "err%d", n);
+ else
+ sprintf(buf, "zzerr%d", n);
+ return buf;
+}
+
+static void
+#ifdef __USE_PROTOS
+makeErrorClause( Junction *q, set f, int max_k, int usePlusBlockBypass )
+#else
+makeErrorClause( q, f, max_k, usePlusBlockBypass )
+Junction *q;
+set f;
+int max_k;
+int usePlusBlockBypass;
+#endif
+{
+ char * handler_id=""; /* MR7 */
+ int nilf=0; /* MR13 */
+ RuleEntry *ruleEntry; /* MR14 */
+
+ if ( FoundException )
+ {
+ _gen("else {\n");
+ tabs++;
+ if ( FoundGuessBlk )
+ {
+ if ( GenCC ) {gen("if ( guessing ) goto fail;\n");}
+ else gen("if ( zzguessing ) goto fail;\n");
+ }
+ gen("if (_sva) _signal=NoViableAlt;\n");
+ gen("else _signal=NoSemViableAlt;\n");
+ if (q->outerEG != NULL) {
+ handler_id=q->outerEG->altID;
+#if 0
+ } else {
+ printf("q->curAltNum=%d q->exception_label=%s\n",q->curAltNum,q->exception_label);
+ gen("*** DEBUG *** outerEG==NULL\n");
+#endif
+ };
+ gen1("goto %s_handler; /* MR7 */\n",handler_id); /* MR7 */
+ tabs--;
+ gen("}\n");
+ return;
+ }
+
+ if ( max_k == 1 )
+ {
+/* MR13 */ nilf=set_nil(f);
+ if ( GenCC ) {
+ _gen1("else {FAIL(1,err%d", DefErrSet1(1,&f,1,NULL));
+ } else {
+ _gen1("else {zzFAIL(1,zzerr%d", DefErrSet1(1,&f,1,NULL));
+ };
+ set_free(f);
+ }
+ else
+ {
+ int i;
+ set_free(f);
+ if ( GenCC ) {_gen1("else {FAIL(%d", max_k);}
+ else _gen1("else {zzFAIL(%d", max_k);
+
+ ruleEntry = (RuleEntry *) hash_get(Rname,q->rname);
+
+ for (i=1; i<=max_k; i++)
+ {
+/* MR14 */ if (ruleEntry->dontComputeErrorSet) {
+/* MR14 */ f=empty;
+ } else {
+ f = ComputeErrorSet(q, i, usePlusBlockBypass /* use plus block bypass ? */ );
+ }
+
+ if ( GenCC ) {_gen1(",err%d", DefErrSet( &f, 1, NULL ));}
+ else _gen1(",zzerr%d", DefErrSet( &f, 1, NULL ));
+
+ set_free(f);
+ }
+ }
+ _gen(",&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}\n");
+/* MR13 */ if (nilf) {
+/* MR13 */ errFL("empty error set for alt - probably because of undefined rule or infinite left recursion",
+/* MR13 */ FileStr[q->file],q->line);
+/* MR13 */ gen(" /* MR13 empty error set for this alt - undef rule ? infinite left recursion ? */");
+/* MR13 */ };
+}
+
+static /* MR7 */
+#ifdef __USE_PROTOS
+char * findOuterHandlerLabel(ExceptionGroup *eg) /* MR7 */
+#else
+char * findOuterHandlerLabel(eg) /* MR7 */
+ExceptionGroup *eg; /* MR7 */
+#endif
+{
+ char *label=NULL; /* MR7 */
+ ExceptionGroup *outerEG; /* MR7 */
+
+ if (eg->forRule == 0) { /* MR7 */
+ if (eg->labelEntry != NULL) { /* MR7 */
+ outerEG=eg->labelEntry->outerEG; /* MR7 */
+ if (outerEG != NULL) { /* MR7 */
+ label=outerEG->altID; /* MR7 */
+ outerEG->used=1; /* MR7 */
+ }; /* MR7 */
+ } else if (eg->outerEG != NULL) { /* MR7 */
+ outerEG=eg->outerEG; /* MR7 */
+ label=outerEG->altID; /* MR7 */
+ outerEG->used=1; /* MR7 */
+ }; /* MR7 */
+ }; /* MR7 */
+ return (label==NULL ? "" : label); /* MR7 */
+} /* MR7 */
+
+/*** debug ***/
+#if 0
+** static /* MR7 */
+** #ifdef __USE_PROTOS
+** char * findOuterAltHandlerLabel(Junction *startJ) /* MR7 */
+** #else
+** char * findOuterAltHandlerLabel(startJ) /* MR7 */
+** Junction *startJ; /* MR7 */
+** #endif
+** { /* MR7 */
+** char *label=NULL; /* MR7 */
+** Junction *alt; /* MR7 */
+** /* MR7 */
+** for (alt=startJ; alt != NULL; alt=alt->outerAltstart) { /* MR7 */
+** label=alt->exception_label; /* MR7 */
+** if (label != NULL) break; /* MR7 */
+** }; /* MR7 */
+** return (label==NULL ? "" : label); /* MR7 */
+** } /* MR7 */
+#endif
+
+#ifdef __USE_PROTOS
+static void OutLineInfo(FILE *file,int line,char *fileName)
+#else
+static void OutLineInfo(file,line,fileName)
+ FILE * file;
+ int line;
+ char * fileName;
+#endif
+{
+ static char * prevFileName=NULL;
+ static char * prevFileNameMS=NULL;
+
+ char * p;
+ char * q;
+
+ if (! GenLineInfo) return;
+
+ if (!GenLineInfoMS) {
+ fprintf(file, LineInfoFormatStr,line,fileName);
+ } else {
+ if (fileName == prevFileName) {
+ fprintf(file, LineInfoFormatStr,line,prevFileNameMS);
+ } else {
+ if (prevFileNameMS != NULL) free (prevFileNameMS);
+ prevFileNameMS=(char *)calloc(1,strlen(fileName)+1);
+ require(prevFileNameMS != NULL,"why not do this in calloc wrapper");
+ q=prevFileNameMS;
+ for (p=fileName; *p != 0; p++) {
+ *q=*p;
+ if (*q == '\\') *q='/';
+ q++;
+ }
+ }
+ prevFileName=fileName;
+ };
+}
+
+#if 0
+
+/* MR21 */
+
+#ifdef __USE_PROTOS
+void OutFirstSetSymbol(Junction *q, char * pSymbol)
+#else
+void OutFirstSetSymbol(q, pSymbol)
+ Junction* q;
+ char * pSymbol
+#endif
+{
+
+ set f;
+ if (pSymbol == NULL) return;
+ gen1("/** #FirstSetSymbol(%s) **/\n",pSymbol);
+ f = ComputeErrorSet(q, 1, 0 /* use plus block bypass ? */);
+ DefErrSetWithSuffix (0 /* nil ok */, &f,0 /* no substitute */, pSymbol, "");
+ set_free(f);
+}
+#endif
+
+/* MR21 */
+
+#ifdef __USE_PROTOS
+void BlockPreambleOption(Junction *q, char * pSymbol)
+#else
+void BlockPreambleOption(q, pSymbol)
+ Junction* q;
+ char * pSymbol;
+#endif
+{
+ set f = empty;
+ if (pSymbol != NULL) {
+ f = ComputeErrorSet(q, 1, 0 /* use plus block bypass ? */);
+ gen1("/** #FirstSetSymbol(%s) **/\n",pSymbol);
+ DefErrSetWithSuffix (0 /* nil ok */, &f,0 /* no substitute */, pSymbol, "");
+ }
+ set_free(f);
+}
+
+/* MR21 */
+
+void
+#ifdef __USE_PROTOS
+dumpActionPlus(ActionNode *a, char *s, FILE *output, int tabs, int file, int line,
+int final_newline )
+#else
+dumpActionPlus(a, s, output, tabs, file, line, final_newline )
+ActionNode *a;
+char *s;
+FILE *output;
+int tabs;
+int file;
+int line;
+int final_newline;
+#endif
+{
+ dumpAction(s,output,tabs,file,line,final_newline);
+}
+
+
+#if 0
+** #ifdef __USE_PROTOS
+** void MR_ErrorSets(Junction *q, int max_k, int usePlusBlockBypass)
+** #else
+** void MR_ErrorSets(q, max_k, usePlusBlockBypass)
+** Junction *q;
+** int max_k;
+** int usePlusBlockBypass;
+** #endif
+** {
+** int k;
+** set setResult;
+** Junction* alt1;
+** Junction* p;
+** set rk;
+**
+** require (max_k <= CLL_k, "k > CLL_k");
+**
+**
+** for (k = 1; k <= CLL_k; k++) {set_clr(q->fset[k]); }
+**
+** for (k = 1; k <= max_k; k++) {
+** for (alt1=q; alt1 != NULL; alt1 = (Junction *)alt1->p2)
+** {
+** if (alt1->ignore && ! usePlusBlockBypass) continue;
+** p = analysis_point((Junction *)alt1->p1);
+** REACH(p, k, &rk, setResult);
+** require(set_nil(rk), "rk != nil");
+** set_orin(&q->fset[k], setResult);
+** }
+** }
+** }
+#endif
+
+
+#ifdef __USE_PROTOS
+void DumpInitializers(FILE* output, RuleEntry *r, char * pReturn)
+#else
+void DumpInitializers(output, r, pReturn)
+FILE* output;
+RuleEntry *r;
+char * pReturn;
+#endif
+{
+ char *p = pReturn;
+ char *pDataType;
+ char *pSymbol;
+ char *pEqualSign;
+ char *pValue;
+ char *pSeparator;
+ int nest = 0;
+ char *q;
+
+ require(pReturn!=NULL, "DumpInitializer: invalid string");
+
+ while (*p != 0) {
+ p = endFormal(p,
+ &pDataType,
+ &pSymbol,
+ &pEqualSign,
+ &pValue,
+ &pSeparator,
+ &nest);
+ if (nest != 0) return;
+ if (pValue != NULL) {
+ tab();
+ q = strBetween(pSymbol, pEqualSign, pSeparator);
+ fprintf(output, "_retv.%s", q);
+ q = strBetween(pValue, NULL, pSeparator);
+ fprintf(output, " = %s;\n", q);
+ }
+ }
+}
+
+#ifdef __USE_PROTOS
+void DumpFormals(FILE* output, char * pReturn, int bInitializer)
+#else
+void DumpFormals(output, pReturn, bInitializer)
+FILE* output;
+char * pReturn;
+int bInitializer;
+#endif
+{
+ char *p = pReturn;
+ char *pDataType;
+ char *pSymbol;
+ char *pEqualSign;
+ char *pValue;
+ char *pSeparator;
+ int nest = 0;
+ char *q;
+ int count = 0;
+
+ require(pReturn!=NULL, "DumpFormals: invalid string");
+
+ while (*p != 0) {
+ p = endFormal(p,
+ &pDataType,
+ &pSymbol,
+ &pEqualSign,
+ &pValue,
+ &pSeparator,
+ &nest);
+ if (nest != 0) return;
+ if (count > 0) fprintf(output,",");
+ if (pDataType != NULL && pSymbol != NULL) {
+ q = strBetween(pDataType, pSymbol, pSeparator);
+ fprintf(output, "%s", q);
+ q = strBetween(pSymbol, pEqualSign, pSeparator);
+ fprintf(output," %s",q);
+ if (pValue != NULL) {
+ q = strBetween(pValue, NULL, pSeparator);
+ if (bInitializer != 0) {
+ fprintf(output, " = %s", q);
+ }
+ }
+ }
+ count++;
+ }
+}
+
+/* MR23 Check for empty alt in a more intelligent way.
+ Previously, an empty alt for genBlk had to point directly
+ to the endBlock. This did not work once I changed {...}
+ blocks to look like (...|...| epsilon) since there were
+ intervening generics. This fixes the problem for this
+ particular case. Things like actions or empty blocks of
+ various kinds will still cause problems, but I wasn't
+ prepared to handle pathological cases like (A|()*). It
+ does handle (A | ()), which is a recommended idiom for
+ epsilon.
+
+ Actually, this isn't quite correct since it doesn't handle
+ the case of the ignore bit in the plus block bypass, but
+ I'm too tired to figure out the correct fix, and will just
+ work around it.
+*/
+
+#ifdef __USE_PROTOS
+int isEmptyAlt(Node * alt, Node * endBlock)
+#else
+int isEmptyAlt(alt, endBlock)
+Node * alt;
+Node * endBlock;
+#endif
+{
+ Node * n = alt;
+ Junction * j;
+ while (n != endBlock) {
+ switch (n->ntype) {
+
+ case nRuleRef:
+ return 0;
+
+ case nToken:
+ return 0;
+
+ case nAction:
+ return 0;
+
+ case nJunction:
+ goto JUNCTION;
+
+ default:
+ fatal_internal("Invalid node type");
+ return 0;
+ }
+JUNCTION:
+ j = (Junction *) n;
+
+ switch (j->jtype) {
+ case Generic:
+ {
+ n = j->p1;
+ goto NEXT;
+ }
+
+ case aSubBlk:
+ {
+ n = j->p1; /* MR26 */
+ goto NEXT; /* MR26 */
+ }
+
+ case EndBlk:
+ return 0;
+
+ case EndRule:
+ return 1;
+
+ default:
+ return 0;
+ }
+NEXT: continue;
+ }
+ return 1;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/generic.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/generic.h
new file mode 100644
index 000000000..30cc8b603
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/generic.h
@@ -0,0 +1,286 @@
+/*
+ * generic.h -- generic include stuff for new PCCTS ANTLR.
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#define StrSame 0
+
+#define DefaultParserName "zzparser"
+
+/* MR9 JVincent@novell.com Allow user to override default ZZLEXBUFSIZE */
+/* MR11 thm Raise antlr's own default ZZLEXBUFSIZE to 8k */
+/* MR22 thm Raise antlr's own default ZZLEXBUFSIZE to 32k */
+
+#ifndef ZZLEXBUFSIZE
+#define ZZLEXBUFSIZE 32000
+#endif
+
+/* Tree/FIRST/FOLLOW defines -- valid only after all grammar has been read */
+#define ALT TokenNum+1
+#define SET TokenNum+2
+#define TREE_REF TokenNum+3
+
+ /* E r r o r M a c r o s */
+
+#define fatal(err) fatalFL(err, __FILE__, __LINE__)
+#define fatal_internal(err) fatal_intern(err, __FILE__, __LINE__)
+
+
+#define eMsg1(s,a) eMsg3(s,a,NULL,NULL)
+#define eMsg2(s,a,b) eMsg3(s,a,b,NULL)
+
+ /* S a n i t y C h e c k i n g */
+
+#ifndef require
+#define require(expr, err) {if ( !(expr) ) fatal_internal(err);}
+#endif
+
+ /* L i s t N o d e s */
+
+typedef struct _ListNode {
+ void *elem; /* pointer to any kind of element */
+ struct _ListNode *next;
+ } ListNode;
+
+/* Define a Cycle node which is used to track lists of cycles for later
+ * reconciliation by ResolveFoCycles().
+ */
+typedef struct _c {
+ int croot; /* cycle root */
+ set cyclicDep; /* cyclic dependents */
+ unsigned deg; /* degree of FOLLOW set of croot */
+ } Cycle;
+
+typedef struct _e {
+ int tok; /* error class name == TokenStr[tok] */
+ ListNode *elist; /* linked list of elements in error set */
+ set eset;
+ int setdeg; /* how big is the set */
+ int lexclass; /* which lex class is it in? */
+ } ECnode;
+
+typedef struct _TCnode {
+ int tok; /* token class name */
+ ListNode *tlist; /* linked list of elements in token set */
+ set tset;
+ int lexclass; /* which lex class is it in? */
+ unsigned char dumped; /* this def has been been dumped */
+ unsigned char dumpedComplement; /* this def has been been dumped */
+ unsigned setnum; /* which set number is this guy? (if dumped) */
+ unsigned setnumComplement; /* MR23 */
+ unsigned setnumErrSet; /* MR23 which set is this #tokclass error set (if dumped) */
+ unsigned setnumErrSetComplement; /* MR23 */
+ } TCnode;
+
+typedef struct _ft {
+ char *token; /* id of token type to remap */
+ int tnum; /* move token type to which token position */
+ } ForcedToken;
+
+typedef struct _ContextGuardPredicates { /* MR13 */
+ Predicate *pred; /* MR13 */
+ } ContextGuardPredicates; /* MR13 */
+
+#define newListNode (ListNode *) calloc(1, sizeof(ListNode));
+#define newCycle (Cycle *) calloc(1, sizeof(Cycle));
+#define newECnode (ECnode *) calloc(1, sizeof(ECnode));
+#define newTCnode (TCnode *) calloc(1, sizeof(TCnode));
+
+
+ /* H a s h T a b l e E n t r i e s */
+
+typedef struct _t { /* Token name or expression */
+ char *str;
+ struct _t *next;
+ int token; /* token number */
+ unsigned char classname; /* is it a err/tok class name or token */
+ TCnode *tclass; /* ptr to token class */
+ char *action;
+ char *akaString;
+ } TermEntry;
+
+typedef struct _r { /* Rule name and ptr to start of rule */
+ char *str;
+ struct _t *next;
+ int rulenum; /* RulePtr[rulenum]== ptr to RuleBlk junction */
+ unsigned char noAST;/* gen AST construction code? (def==gen code) */
+ char *egroup; /* which error group (err reporting stuff) */
+#if 0
+ /* MR27 This appears to never be used. Delete this code later. */
+
+ ListNode *el_labels;/* list of element labels ref in all of rule */
+#endif
+ ListNode *ast_labels_in_actions; /* MR27 */
+ unsigned char has_rule_exception;
+ char dontComputeErrorSet; /* MR14 - don't compute error set
+ special for rule in alpha part of
+ (alpha)? beta block */
+ } RuleEntry;
+
+typedef struct _f { /* cache Fi/Fo set */
+ char *str; /* key == (rulename, computation, k) */
+ struct _f *next;
+ set fset; /* First/Follow of rule */
+ set rk; /* set of k's remaining to be done after ruleref */
+ int incomplete; /* only w/FOLLOW sets. Use only if complete */
+ } CacheEntry;
+
+typedef struct _LabelEntry { /* element labels */
+ char *str;
+ struct _f *next;
+ Node *elem; /* which element does it point to? */
+ ExceptionGroup *ex_group;
+ /* Is there an exception attached to label? */
+ ExceptionGroup *outerEG; /* MR7 */
+ /* next EG if ex_group doesn't catch it MR7 */
+ struct _LabelEntry *pendingLink; /* MR7 */
+ /* too lazy to use ListNode ? MR7 */
+ int curAltNum; /* MR7 */
+ } LabelEntry;
+
+typedef struct _SignalEntry {
+ char *str;
+ struct _f *next;
+ int signum; /* unique signal number */
+ } SignalEntry;
+
+typedef struct _PredEntry { /* MR11 predicate name and ptr to string */
+ char *str;
+ struct _PredEntry *next;
+ int file;
+ int line;
+ Predicate *pred;
+ char *predLiteral;
+ } PredEntry;
+
+typedef struct _PointerStack { /* MR10 */
+ int count;
+ int size;
+ void **data;
+ } PointerStack;
+
+#define newTermEntry(s) (TermEntry *) newEntry(s, sizeof(TermEntry))
+#define newRuleEntry(s) (RuleEntry *) newEntry(s, sizeof(RuleEntry))
+#define newCacheEntry(s) (CacheEntry *) newEntry(s, sizeof(CacheEntry))
+#define newLabelEntry(s) (LabelEntry *) newEntry(s, sizeof(LabelEntry))
+#define newSignalEntry(s) (SignalEntry *) newEntry(s, sizeof(SignalEntry))
+#define newPredEntry(s) (PredEntry *) newEntry(s,sizeof(PredEntry))
+
+typedef struct _UserAction {
+ char *action;
+ int file, line;
+ } UserAction;
+
+
+ /* L e x i c a l C l a s s */
+
+/* to switch lex classes, switch ExprStr and Texpr (hash table) */
+typedef struct _lc {
+ char *classnum, **exprs;
+ Entry **htable;
+ } LClass;
+
+typedef struct _exprOrder {
+ char *expr;
+ int lclass;
+ } Expr;
+
+
+typedef Graph Attrib;
+
+ /* M a x i m u m s */
+
+/* MR20 Note G. Hobbelt These values are superseded by values in hash.h */
+
+#ifndef HashTableSize
+#define HashTableSize 253
+#endif
+#ifndef StrTableSize
+#define StrTableSize 15000 /* all tokens, nonterminals, rexprs stored here */
+#endif
+#define MaxLexClasses 50 /* how many automatons */
+/* TokenStart and EofToken are ignored if #tokdefs meta-op is used */
+#define TokenStart 2 /* MUST be in 1 + EofToken */
+#define EofToken 1 /* Always predefined to be 1 */
+
+#ifndef MaxNumFiles
+#define MaxNumFiles 99
+#endif
+
+/**** MR9 JVincent@novell.com Move to pcctscfg.h */
+/**** #define MaxFileName 300 ****/ /* MR9 Move to pcctscfg.h */ /* largest file name size */
+
+#define MaxRuleName 100 /* largest rule name size */
+#define TSChunk 100 /* how much to expand TokenStr/ExprStr each time */
+#define TIChunk TSChunk /* expand TokenInd by same as TokenStr to mirror them */
+#define FoStackSize 100 /* deepest FOLLOW recursion possible */
+
+#define MaxClassDeclStuff 256 /* MR10 */
+
+#define NumPredefinedSignals 3
+
+ /* S t a n d a r d S i g n a l s */
+
+#define sigNoSignal 0
+#define sigMismatchedToken 1
+#define sigNoViableAlt 2
+#define sigNoSemViableAlt 3
+
+
+
+/* AST token types */
+#define ASTexclude 0
+#define ASTchild 1
+#define ASTroot 2
+#define ASTinclude 3 /* include subtree made by rule ref */
+
+
+#define PredictionVariable "zzpr_expr"
+#define PredictionLexClassSuffix "_zzpred"
+
+#define WildCardString "WildCard"
+
+#if 0
+ /* Removed in version 1.33MR19
+ Don't understand why this never caused problems before
+ */
+
+ /*********************************************************
+ #ifndef ANTLRm
+ #define ANTLRm(st, f, _m) zzbufsize = ZZLEXBUFSIZE;\
+ zzmode(_m); \
+ zzenterANTLR(f); \
+ st; ++zzasp; \
+ zzleaveANTLR(f);
+ #endif
+ *********************************************************/
+#endif
+
+#include "proto.h"
+#include "pcctscfg.h" /* MR14 */
+#include <string.h>
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/globals.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/globals.c
new file mode 100644
index 000000000..59d00320a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/globals.c
@@ -0,0 +1,484 @@
+/*
+ * globals.c -- File containing all variables/tables visible to all files.
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+
+#include "pcctscfg.h"
+
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+
+char Version[] = "1.33MR33" ; /* PCCTS version number */ /* MRXXX */
+char VersionDef[] = "13333"; /* same (except int equiv for preproc symbol) */ /* MRXXX */
+
+char LexStartSymbol[] = "START";/* Name of starting lexical class/automaton */
+char *RemapFileName = "remap.h";
+char *DlgFileName = "parser.dlg";
+char *DefFileName = "tokens.h";
+char *ErrFileName = "err.c";
+char *ModeFileName = "mode.h";
+char *StdMsgName = NULL;
+
+char *ParserName = DefaultParserName;
+
+/* list of PCCTS supplied support symbols; these are renamed when more than
+ * one ANTLR-generated parsers are linked together to avoid name conflicts.
+ * Can't use '##' ANSIC preprocessor concat operator with K&R and:
+ * #define zzskip zzparser ## skip
+ * will not work for ANSI/C++ as 'zzparserskip' is created w/o zzparser
+ * being substituted--ack!!!
+ */
+char *StandardSymbols[] = {
+/* ANTLR stuff */
+ "zzStackOvfMsg",
+ "zzasp",
+ "zzaStack",
+ "inf_tokens",
+ "inf_text",
+ "inf_text_buffer",
+ "inf_text_buffer_ptr",
+ "inf_text_buffer_size",
+ "inf_labase",
+ "inf_last",
+ "inf_lap",
+ "zztokenLA",
+ "zztextLA",
+ "zzlap",
+ "zzlabase",
+ "zztoktext",
+ "zztoken",
+ "zzdirty",
+ "zzguessing",
+ "zzguess_start",
+ "zzresynch",
+ "zzinf_tokens",
+ "zzinf_text",
+ "zzinf_text_buffer",
+ "zzinf_labase",
+ "zzinf_last",
+ "zzfill_inf_look",
+ "zzFAIL",
+ "zzsave_antlr_state",
+ "zzrestore_antlr_state",
+ "zzsyn",
+ "zzset_el",
+ "zzset_deg",
+ "zzedecode",
+ "_zzsetmatch",
+ "_zzmatch",
+ "_inf_zzgettok",
+ "zzconsumeUntil",
+ "zzconsumeUntilToken",
+ "_zzmatch_wsig",
+ "_zzsetmatch_wsig",
+ "_zzmatch_wdfltsig",
+ "_zzsetmatch_wdfltsig",
+ "zzdflthandlers",
+/* DLG stuff */
+ "zzreal_line",
+ "zzcharfull",
+ "zzerr",
+ "zzlextext",
+ "zzbegexpr",
+ "zzendexpr",
+ "zzbufsize",
+ "zzbegcol",
+ "zzendcol",
+ "zzline",
+ "zzchar",
+ "zzbufovf",
+ "zzrdstream",
+ "zzrdfunc",
+ "zzrdstr",
+ "zzclose_stream",
+ "zzsave_dlg_state",
+ "zzrestore_dlg_state",
+ "zzmode",
+ "zzskip",
+ "zzmore",
+ "zzreplchar",
+ "zzreplstr",
+ "zzgettok",
+ "zzadvance",
+ "zzerrstd",
+ "zzerr_in",
+ "zzconstr_attr",
+ "zzempty_attr",
+ "zzerraction",
+ "zztokens", /* list of token regular expressions */
+ "dfa",
+ "accepts",
+ "actions",
+ "zzTraceOptionValue", /* MR10 */
+ "zzTraceGuessOptionValue", /* MR10 */
+ "zzTraceCurrentRuleName", /* MR10 */
+ "zzTraceDepth", /* MR10 */
+ "zzGuessSeq", /* MR10 */
+ "zzSyntaxErrCount", /* MR11 */
+ "zzLexErrCount", /* MR11 */
+ "zzTraceGuessDone", /* MR13 - BJS */
+ "zzTraceGuessFail", /* MR13 - BJS */
+ "zzTraceGuessOption", /* MR13 - BJS */
+ "zzTraceIn", /* MR13 - BJS */
+ "zzTraceOption", /* MR13 - BJS */
+ "zzTraceOut", /* MR13 - BJS */
+ "zzTraceReset", /* MR13 - BJS */
+ NULL /* must be present */
+};
+
+/* list of PCCTS supplied support functions; these are renamed when more than
+ * one ANTLR-generated parsers are linked together to avoid name conflicts.
+ */
+char *ASTSymbols[] = {
+ "AST",
+ "zzast_sp",
+ "zzastStack",
+ "zzlink",
+ "zzastnew",
+ "zzsubchild",
+ "zzsubroot",
+ "zzpre_ast",
+ "zzfree_ast",
+ "zztmake",
+ "zzdup_ast",
+ "zztfree",
+ "zzdouble_link",
+ NULL /* must be present */
+};
+
+/* Current ambiguity examination information */
+int CurAmbigAlt1, CurAmbigAlt2, CurAmbigline, CurAmbigfile;
+char *CurAmbigbtype;
+
+
+ /* M e t h o d T a b l e s */
+/*
+ * The following tables are used to fill syntax diagram nodes with the correct
+ * function pointers for computing FIRST sets and printing themselves.
+ */
+
+/* fpTraverse[node type] == pointer to function that calculates trees
+ * representing the FIRST sets for that node (maintains spatial info).
+ * We use 'struct _tree' not 'tree' due to a g++ 2.4.3 bug.
+ */
+#ifdef __cplusplus
+struct _tree *(*fpTraverse[NumNodeTypes+1])(... /* Node *, int, set * */) = {
+ NULL,
+ (struct _tree *(*)(...)) tJunc,
+ (struct _tree *(*)(...)) tRuleRef,
+ (struct _tree *(*)(...)) tToken,
+ (struct _tree *(*)(...)) tAction
+};
+#else
+Tree *(*fpTraverse[NumNodeTypes+1])() = {
+ NULL,
+ tJunc,
+ tRuleRef,
+ tToken,
+ tAction
+};
+#endif
+
+/* fpReach[node type] == pointer to function that calculates FIRST set for
+ * that node. (r stands for reach). We use 'struct _set' not 'set'
+ * due to a g++ 2.4.3 bug.
+ */
+#ifdef __cplusplus
+struct _set (*fpReach[NumNodeTypes+1])(... /* Node *, int, set * */) = {
+ NULL,
+ (struct _set (*)(...)) rJunc,
+ (struct _set (*)(...)) rRuleRef,
+ (struct _set (*)(...)) rToken,
+ (struct _set (*)(...)) rAction
+};
+#else
+set (*fpReach[NumNodeTypes+1])() = {
+ NULL,
+ rJunc,
+ rRuleRef,
+ rToken,
+ rAction
+};
+#endif
+
+/* fpPrint[node type] == pointer to function that knows how to print that node. */
+#ifdef __cplusplus
+void (*fpPrint[NumNodeTypes+1])(... /* Node * */) = {
+ NULL,
+ (void (*)(...)) pJunc,
+ (void (*)(...)) pRuleRef,
+ (void (*)(...)) pToken,
+ (void (*)(...)) pAction
+};
+#else
+void (*fpPrint[NumNodeTypes+1])() = {
+ NULL,
+ pJunc,
+ pRuleRef,
+ pToken,
+ pAction
+};
+#endif
+
+char *decodeJType[] = {
+ "invalid",
+ "aSubBlk",
+ "aOptBlk",
+ "aLoopBlk",
+ "EndBlk",
+ "RuleBlk",
+ "Generic",
+ "EndRule",
+ "aPlusBlk",
+ "aLoopBegin"
+};
+
+
+ /* H a s h T a b l e s */
+
+Entry **Tname, /* Table of all token names (maps name to tok num)*/
+ **Texpr, /* Table of all token expressions
+ (maps expr to tok num) */
+ **Rname, /* Table of all Rules (has ptr to start of rule) */
+ **Fcache, /* Cache of First/Follow Computations */
+ **Tcache; /* Tree cache; First/Follow for permute trees */
+Entry **Elabel; /* Table of all element label names */
+Entry **Sname; /* Signal names */
+Entry **Pname; /* symbolic predicate names MR11 */
+
+
+ /* V a r i a b l e s */
+
+int Save_argc; /* MR10 */
+char **Save_argv; /* MR10 */
+int EpToken=0; /* Imaginary Epsilon token number */
+int WildCardToken=0;
+int CurFile= -1; /* Index into FileStr table */
+char *CurPredName=NULL; /* MR11 */
+char *CurRule=NULL; /* Pointer to current rule name */
+int CurRuleDebug=0; /* MR13 debug flag */
+RuleEntry *CurRuleNode=NULL;/* Pointer to current rule node in syntax tree */
+char *CurRetDef=NULL; /* Pointer to current return type definition */
+char *CurParmDef=NULL; /* Pointer to current parameter definition */
+Junction *CurRuleBlk=NULL; /* Pointer to current block node for enclosing block */
+ListNode *CurExGroups=NULL; /* Current list of exception groups for rule/alts */
+ListNode *CurElementLabels=NULL;
+ListNode *CurAstLabelsInActions=NULL; /* MR27 */
+
+/* MR10 used by <<>>? to set "label_used_in_semantic_pred" */
+/* MR10 this will force LT(i) assignment even in guess mode */
+
+ListNode *CurActionLabels=NULL; /* MR10 Element Labels appearing in last action */
+int numericActionLabel=0 ; /* MR10 << ... $1 ... >> or << ... $1 ... >>? */
+ListNode *NumericPredLabels=NULL; /* MR10 << ... $1 ... >>? ONLY */
+ListNode *ContextGuardPredicateList=NULL; /* MR13 for re-evaluating predicates
+ after meta tokens are defined */
+
+int CurBlockID=0; /* Unique int for each block */
+int CurAltNum=0;
+Junction *CurAltStart = NULL; /* Junction node that starts the alt */
+Junction *OuterAltStart = NULL; /* For chaining exception groups MR7 */
+int NumRules=0; /* Rules are from 1 to n */
+FILE *output=NULL; /* current parser output file */
+FILE *input=NULL; /* current grammar input file */
+char *FileStr[MaxNumFiles];/* Ptr to array of file names on command-line */
+int NumFiles=0; /* current grammar file number */
+#ifdef __cplusplus
+void (**fpTrans)(...), /* array of ptrs to funcs that translate nodes */
+ (**fpJTrans)(...); /* ... that translate junctions */
+#else
+void (**fpTrans)(), /* array of ptrs to funcs that translate nodes */
+ (**fpJTrans)(); /* ... that translate junctions */
+#endif
+int **FoStack; /* Array of LL_k ptrs to stacks of rule numbers */
+int **FoTOS; /* FOLLOW stack top-of-stack pointers */
+Junction *SynDiag = NULL; /* Pointer to start of syntax diagram */
+int BlkLevel=1; /* Current block level. Set by antlr.g, used by
+ * scanner to translate $i.j attributes */
+set reserved_positions; /* set of token positions reserved by '#token T=i' cmds */
+set all_tokens; /* set of all token types */
+set imag_tokens; /* set of all imaginary token types (EpToken, errclasses...) */
+set tokclasses; /* set of all token class token types */
+ListNode *ForcedTokens = 0; /* list of token_id/token_num pairs to remap */
+ListNode *MetaTokenNodes=NULL; /* list of meta token refs such as token classes etc... */
+int *TokenInd=NULL; /* an indirection level between token num and position
+ * of that token def in TokenStr and ExprStr */
+int LastTokenCounted=0; /* ==TokenNum if no token renumbering (same as old TokenNum) */
+int TokenNum=TokenStart;
+char **TokenStr=NULL; /* map token # to token name */
+char **ExprStr=NULL; /* map token # to expr */
+Junction **RulePtr=NULL; /* map rule # to RuleBlk node of rule */
+ListNode *ExprOrder=NULL; /* list of exprs as they are found in grammar */
+ListNode *BeforeActions=NULL;/* list of grammar actions before rules */
+ListNode *AfterActions=NULL;/* list of grammar actions after rules */
+ListNode *LexActions=NULL; /* list of lexical actions */
+
+/* MR1 */
+/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
+/* MR1 via #lexmember <<....>> */
+/* MR1 via #lexprefix <<....>> */
+/* MR1 */
+
+ListNode *LexMemberActions=NULL;/* list of lexical header member decl MR1 */
+ListNode *LexPrefixActions=NULL;/* list of lexical header #include decl MR1 */
+ListNode **Cycles=NULL; /* list of cycles (for each k) found when
+ doing FOLLOWs */
+ListNode *eclasses=NULL; /* list of error classes */
+ListNode *tclasses=NULL; /* list of token classes */
+LClass lclass[MaxLexClasses]; /* array of lex class definitions */
+int CurrentLexClass; /* index into lclass */
+int NumLexClasses=0; /* in range 1..MaxLexClasses (init 0) */
+
+char *HdrAction=NULL; /* action defined with #header */
+char *FirstAction=NULL; /* action defined with #first MR11 */
+FILE *ErrFile; /* sets and error recovery stuff */
+FILE *DefFile=NULL; /* list of tokens, return value structs, setwd defs */
+FILE *MRinfoFile=NULL; /* MR10 information file */
+int MRinfo=0; /* MR10 */
+int MRinfoSeq=0; /* MR10 */
+int InfoP=0; /* MR10 predicates */
+int InfoT=0; /* MR10 tnodes */
+int InfoF=0; /* MR10 first/follow sets */
+int InfoM=0; /* MR10 monitor progress */
+int InfoO=0; /* MR12 orphan rules */
+int TnodesInUse=0; /* MR10 */
+int TnodesPeak=0; /* MR10 */
+int TnodesAllocated=0; /* MR10 */
+int TnodesReportThreshold=0; /* MR11 */
+int PotentialSuppression=0; /* MR10 */
+int PotentialDummy=0; /* MR10 */
+int CannotContinue=FALSE;
+int OutputLL_k = 1; /* LL_k for parsing must be power of 2 */
+int action_file; /* used to track start of action */
+int action_line;
+int FoundGuessBlk=0; /* there is a (...)? block somewhere in grammar */
+int FoundException=0; /* there is an exception somewhere in grammar */
+/* MR6 Distinguish between @ operator and real exception */
+/* MR6 by keeping separate flags for @ operator and real exceptions */
+int FoundAtOperator=0; /* MR6 */
+int FoundExceptionGroup=0; /* MR6 */
+int pLevel=0; /* print Level */
+int pAlt1,pAlt2; /* print "==>" in front of these alts */
+
+/* C++ output stuff */
+FILE *Parser_h, /* where subclass of ANTLRParser goes */
+ *Parser_c; /* where code for subclass of ANTLRParser goes */
+char Parser_h_Name[MaxFileName+1] = "";
+char Parser_c_Name[MaxFileName+1] = "";
+char MRinfoFile_Name[MaxFileName+1] = ""; /* MR10 */
+char *ClassDeclStuff=NULL; /* MR10 */
+char *BaseClassName=NULL; /* MR22 */
+/* list of actions inside the #class {...} defs */
+ListNode *class_before_actions=NULL;
+ListNode *class_after_actions=NULL;
+
+char CurrentClassName[MaxRuleName]="";
+int no_classes_found=1;
+char *UserTokenDefsFile;
+int UserDefdTokens=0; /* found #tokdefs? */
+char *OutputDirectory=TopDirectory;
+ExceptionGroup *DefaultExGroup = NULL;
+int NumSignals = NumPredefinedSignals;
+int ContextGuardTRAV=0;
+
+char *MR_AmbAidRule=NULL; /* MR11 */
+int MR_AmbAidLine=0; /* MR11 */
+int MR_AmbAidDepth=0; /* MR11 */
+int MR_AmbAidMultiple=0; /* MR11 */
+int MR_skipped_e3_report=0; /* MR11 */
+int MR_usingPredNames=0; /* MR11 */
+int MR_BadExprSets=0; /* MR13 */
+int MR_Inhibit_Tokens_h_Gen=0; /* MR13 */
+int NewAST=0; /* MR13 */
+int tmakeInParser=0; /* MR23 */
+int AlphaBetaTrace=0; /* MR14 */
+int MR_BlkErr=0; /* MR21 */
+int MR_AlphaBetaMessageCount=0; /* MR14 */
+int MR_AlphaBetaWarning=0; /* MR14 */
+int MR_ErrorSetComputationActive=0; /* MR14 */
+int MR_MaintainBackTrace=0; /* MR14 */
+set MR_CompromisedRules; /* MR14 */
+
+Junction *MR_RuleBlkWithHalt; /* MR10 */
+
+ /* C m d - L i n e O p t i o n s */
+
+int LL_k=1; /* how many tokens of full lookahead */
+int CLL_k= -1; /* how many tokens of compressed lookahead */
+int PrintOut = FALSE; /* print out the grammar */
+int PrintAnnotate = FALSE;/* annotate printout with FIRST sets */
+int CodeGen=TRUE; /* Generate output code? */
+int LexGen=TRUE; /* Generate lexical files? (tokens.h, parser.dlg) */
+int GenAST=FALSE; /* Generate AST's? */
+int GenANSI=FALSE; /* Generate ANSI code where necessary */
+int GenExprSetsOpt=TRUE;/* use sets not (LA(1)==tok) expression lists */
+int GenCR=FALSE; /* Generate cross reference? */
+int GenLineInfo=FALSE; /* Generate # line "file" stuff? */
+int GenLineInfoMS=FALSE;/* Like -gl but replace "\" with "/" for MS C/C++ systems */
+int TraceGen=FALSE; /* Generate code to trace rule invocation */
+int elevel=1; /* error level for ambiguity messages */
+int GenEClasseForRules=0;/* don't generate eclass for each rule */
+int TreeResourceLimit= -1;/* don't limit tree resource */
+int DemandLookahead = 0;/* demand/delayed lookahead or not */
+char *RulePrefix = ""; /* prefix each generated rule with this */
+char *stdpccts = "stdpccts.h";/* where to generate std pccts include file */
+int GenStdPccts = 0; /* don't gen stdpccts.h? */
+int ParseWithPredicates = 1;
+int WarningLevel = 1;
+int UseStdout = 0; /* MR6 */
+int TabWidth = 2; /* MR6 */ /* MR27 */
+int HoistPredicateContext = 0;
+int MRhoisting = 0; /* MR9 */
+int MRhoistingk = 0; /* MR13 */
+int MR_debugGenRule=0; /* MR11 */
+
+int GenCC = 0; /* Generate C++ output */
+
+PointerStack MR_BackTraceStack={0,0,NULL}; /* MR10 */
+PointerStack MR_PredRuleRefStack={0,0,NULL}; /* MR10 */
+PointerStack MR_RuleBlkWithHaltStack={0,0,NULL}; /* MR10 */
+
+/* DontCopyTokens and Pragma_DupLabeledTokens were a bad idea. I've just
+ turned them off rather than backpatching the code. Who knows? We
+ may need them in the future.
+ */
+int DontCopyTokens = 1; /* in C++, don't copy ANTLRToken passed to ANTLR */
+
+/* Remember if LT(i), LA(i), or LATEXT(i) used in an action which is not
+ a predicate. If so, give a warning for novice users.
+*/
+
+int LTinTokenAction = 0; /* MR23 */
+int PURIFY = 1; /* MR23 */
+
+int CurBlockID_array[MAX_BLK_LEVEL]; /* MR23 */
+int CurAltNum_array[MAX_BLK_LEVEL]; /* MR23 */
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.c
new file mode 100644
index 000000000..68fe8fd22
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.c
@@ -0,0 +1,221 @@
+/*
+ * hash.c
+ *
+ * Manage hash tables.
+ *
+ * The following functions are visible:
+ *
+ * char *mystrdup(char *); Make space and copy string
+ * Entry **newHashTable(); Create and return initialized hash table
+ * Entry *hash_add(Entry **, char *, Entry *)
+ * Entry *hash_get(Entry **, char *)
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include "pcctscfg.h"
+#include "hash.h"
+
+#ifdef __USE_PROTOS
+#include <stdlib.h>
+#else
+#ifdef VAXC
+#include <stdlib.h>
+#else
+#include <malloc.h>
+#endif
+#endif
+#include <string.h>
+
+#define StrSame 0
+
+#define fatal(err) \
+ {fprintf(stderr, "%s(%d):", __FILE__, __LINE__); \
+ fprintf(stderr, " %s\n", err); exit(PCCTS_EXIT_FAILURE);}
+#define require(expr, err) {if ( !(expr) ) fatal(err);}
+
+static unsigned size = HashTableSize;
+static char *strings = NULL;
+static char *strp;
+static unsigned strsize = StrTableSize;
+
+/* create the hash table and string table for terminals (string table only once) */
+Entry **
+#ifdef __USE_PROTOS
+newHashTable( void )
+#else
+newHashTable( )
+#endif
+{
+ Entry **table;
+
+ table = (Entry **) calloc(size, sizeof(Entry *));
+ require( table != NULL, "cannot allocate hash table");
+ if ( strings == NULL )
+ {
+ strings = (char *) calloc(strsize, sizeof(char));
+ require( strings != NULL, "cannot allocate string table");
+ strp = strings;
+ }
+ return table;
+}
+
+void
+#ifdef __USE_PROTOS
+killHashTable( Entry **table )
+#else
+killHashTable( table )
+Entry **table;
+#endif
+{
+ /* for now, just free table, forget entries */
+ free( (char *) table ); /* MR10 cast */
+}
+
+/* Given a table, add 'rec' with key 'key' (add to front of list). return ptr to entry */
+Entry *
+#ifdef __USE_PROTOS
+hash_add( Entry **table, char *key, Entry *rec )
+#else
+hash_add( table, key, rec )
+Entry **table;
+char *key;
+Entry *rec;
+#endif
+{
+ unsigned h=0;
+ char *p=key;
+ require(table!=NULL && key!=NULL && rec!=NULL, "add: invalid addition");
+
+ Hash(p,h,size);
+ rec->next = table[h]; /* Add to singly-linked list */
+ table[h] = rec;
+ return rec;
+}
+
+/* Return ptr to 1st entry found in table under key (return NULL if none found) */
+Entry *
+#ifdef __USE_PROTOS
+hash_get( Entry **table, char *key )
+#else
+hash_get( table, key )
+Entry **table;
+char *key;
+#endif
+{
+ unsigned h=0;
+ char *p=key;
+ Entry *q;
+/* require(table!=NULL && key!=NULL, "get: invalid table and/or key");*/
+ if ( !(table!=NULL && key!=NULL) ) *((char *) 34) = 3;
+
+ Hash(p,h,size);
+ for (q = table[h]; q != NULL; q = q->next)
+ {
+ if ( strcmp(key, q->str) == StrSame ) return( q );
+ }
+ return( NULL );
+}
+
+#ifdef DEBUG_HASH
+void
+#ifdef __USE_PROTOS
+hashStat( Entry **table )
+#else
+hashStat( table )
+Entry **table;
+#endif
+{
+ static unsigned short count[20];
+ int i,n=0,low=0, hi=0;
+ Entry **p;
+ float avg=0.0;
+
+ for (i=0; i<20; i++) count[i] = 0;
+ for (p=table; p<&(table[size]); p++)
+ {
+ Entry *q = *p;
+ int len;
+
+ if ( q != NULL && low==0 ) low = p-table;
+ len = 0;
+ if ( q != NULL ) fprintf(stderr, "[%d]", p-table);
+ while ( q != NULL )
+ {
+ len++;
+ n++;
+ fprintf(stderr, " %s", q->str);
+ q = q->next;
+ if ( q == NULL ) fprintf(stderr, "\n");
+ }
+ count[len]++;
+ if ( *p != NULL ) hi = p-table;
+ }
+
+ fprintf(stderr, "Storing %d recs used %d hash positions out of %d\n",
+ n, size-count[0], size);
+ fprintf(stderr, "%f %% utilization\n",
+ ((float)(size-count[0]))/((float)size));
+ for (i=0; i<20; i++)
+ {
+ if ( count[i] != 0 )
+ {
+ avg += (((float)(i*count[i]))/((float)n)) * i;
+ fprintf(stderr, "Bucket len %d == %d (%f %% of recs)\n",
+ i, count[i], ((float)(i*count[i]))/((float)n));
+ }
+ }
+ fprintf(stderr, "Avg bucket length %f\n", avg);
+ fprintf(stderr, "Range of hash function: %d..%d\n", low, hi);
+}
+#endif
+
+/* Add a string to the string table and return a pointer to it.
+ * Bump the pointer into the string table to next avail position.
+ */
+char *
+#ifdef __USE_PROTOS
+mystrdup( char *s )
+#else
+mystrdup( s )
+char *s;
+#endif
+{
+ char *start=strp;
+ require(s!=NULL, "mystrdup: NULL string");
+
+ while ( *s != '\0' )
+ {
+ require( strp <= &(strings[strsize-2]),
+ "string table overflow\nIncrease StrTableSize in hash.h and recompile hash.c\n");
+ *strp++ = *s++;
+ }
+ *strp++ = '\0';
+
+ return( start );
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.h
new file mode 100644
index 000000000..3969c40b4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.h
@@ -0,0 +1,73 @@
+/*
+ * hash.h -- define hash table entries, sizes, hash function...
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+ /* H a s h T a b l e S t u f f */
+
+#ifndef HashTableSize
+#define HashTableSize 553
+#endif
+
+#ifndef StrTableSize
+#ifdef PC32
+#define StrTableSize 1000000
+#endif
+#endif
+
+#ifndef StrTableSize
+#ifdef PC
+#define StrTableSize 655200
+#endif
+#endif
+
+#ifndef StrTableSize
+#define StrTableSize 1000000
+#endif
+
+typedef struct _entry { /* Minimum hash table entry -- superclass */
+ char *str;
+ struct _entry *next;
+ } Entry;
+
+/* Hash 's' using 'size', place into h (s is modified) */
+#define Hash(s,h,size) \
+ {while ( *s != '\0' ) h = (h<<1) + *s++; \
+ h %= size;}
+
+#ifdef __USE_PROTOS
+Entry *hash_get(Entry **, char *),
+ **newHashTable(void),
+ *hash_add(Entry **, char *, Entry *);
+
+void killHashTable(Entry **);
+
+#else
+Entry *hash_get(), **newHashTable(), *hash_add();
+void killHashTable(); /* MR9 23-Sep-97 */
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c
new file mode 100644
index 000000000..fddb46bbc
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c
@@ -0,0 +1,878 @@
+/*
+ * lex.c -- Generate all of the lexical type files: parser.dlg tokens.h
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+/* MR1 */
+/* MR1 10-Apr-97 MR1 Replace use of __STDC__ with __USE_PROTOS */
+/* MR1 */
+#include "pcctscfg.h"
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+
+#define DLGErrorString "invalid token"
+
+/* Generate a complete lexical description of the lexemes found in the grammar */
+void
+#ifdef __USE_PROTOS
+genLexDescr( void )
+#else
+genLexDescr( )
+#endif
+{
+ ListNode *p;
+ FILE *dlgFile = fopen(OutMetaName(DlgFileName), "w");
+ require(dlgFile!=NULL, eMsg1("genLexFile: cannot open %s", OutMetaName(DlgFileName)) );
+#ifdef SPECIAL_FOPEN
+ special_fopen_actions(OutMetaName(DlgFileName)); /* MR1 */
+#endif
+ fprintf(dlgFile, "<<\n");
+ fprintf(dlgFile, "/* %s -- DLG Description of scanner\n", DlgFileName);
+ fprintf(dlgFile, " *\n");
+ fprintf(dlgFile, " * Generated from:");
+ {int i; for (i=0; i<NumFiles; i++) fprintf(dlgFile, " %s", FileStr[i]);}
+ fprintf(dlgFile, "\n");
+ fprintf(dlgFile, " *\n");
+ fprintf(dlgFile, " * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n");
+ fprintf(dlgFile, " * Purdue University Electrical Engineering\n");
+ fprintf(dlgFile, " * With AHPCRC, University of Minnesota\n");
+ fprintf(dlgFile, " * ANTLR Version %s\n", Version);
+ fprintf(dlgFile, " */\n\n");
+ if (FirstAction != NULL ) dumpAction( FirstAction, dlgFile, 0, -1, 0, 1 ); /* MR11 MR15b */
+ fprintf(dlgFile, "#define ANTLR_VERSION %s\n", VersionDef);
+ if ( GenCC )
+ {
+ if ( !UserDefdTokens ) fprintf(dlgFile, "#include \"%s\"\n", DefFileName);
+ else fprintf(dlgFile, "#include %s\n", UserTokenDefsFile);
+ fprintf(dlgFile, "#include \"%s\"\n", ATOKEN_H);
+ if ( GenAST ) fprintf(dlgFile, "#include \"%s\"\n", ASTBASE_H);
+ if ( HdrAction != NULL ) dumpAction( HdrAction, dlgFile, 0, -1, 0, 1 );
+ }
+ else
+ {
+ fprintf(dlgFile, "#include \"pcctscfg.h\"\n");
+ fprintf(dlgFile, "#include \"pccts_stdio.h\"\n");
+ if ( strcmp(ParserName, DefaultParserName)!=0 )
+ fprintf(dlgFile, "#define %s %s\n", DefaultParserName, ParserName);
+ if ( strcmp(ParserName, DefaultParserName)!=0 )
+ fprintf(dlgFile, "#include \"%s\"\n", RemapFileName);
+ if ( HdrAction != NULL ) dumpAction( HdrAction, dlgFile, 0, -1, 0, 1 );
+ if ( FoundGuessBlk )
+ {
+ fprintf(dlgFile, "#define ZZCAN_GUESS\n");
+ fprintf(dlgFile, "#include \"pccts_setjmp.h\"\n");
+ }
+ if ( OutputLL_k > 1 ) fprintf(dlgFile, "#define LL_K %d\n", OutputLL_k);
+ if ( DemandLookahead ) fprintf(dlgFile, "#define DEMAND_LOOK\n");
+ if (TraceGen) {
+ fprintf(dlgFile,"#ifndef zzTRACE_RULES\n"); /* MR20 */
+ fprintf(dlgFile,"#define zzTRACE_RULES\n"); /* MR20 */
+ fprintf(dlgFile,"#endif\n"); /* MR22 */
+ };
+ fprintf(dlgFile, "#include \"antlr.h\"\n");
+ if ( GenAST ) {
+ fprintf(dlgFile, "#include \"ast.h\"\n");
+ }
+ if ( UserDefdTokens )
+ fprintf(dlgFile, "#include %s\n", UserTokenDefsFile);
+ /* still need this one as it has the func prototypes */
+ fprintf(dlgFile, "#include \"%s\"\n", DefFileName);
+ fprintf(dlgFile, "#include \"dlgdef.h\"\n");
+ fprintf(dlgFile, "LOOKAHEAD\n");
+ fprintf(dlgFile, "\n");
+ fprintf(dlgFile, "void\n");
+ fprintf(dlgFile, "#ifdef __USE_PROTOS\n");
+ fprintf(dlgFile, "zzerraction(void)\n");
+ fprintf(dlgFile, "#else\n");
+ fprintf(dlgFile, "zzerraction()\n");
+ fprintf(dlgFile, "#endif\n");
+ fprintf(dlgFile, "{\n");
+ fprintf(dlgFile, "\t(*zzerr)(\"%s\");\n", DLGErrorString);
+ fprintf(dlgFile, "\tzzadvance();\n");
+ fprintf(dlgFile, "\tzzskip();\n");
+ fprintf(dlgFile, "}\n");
+ }
+ fprintf(dlgFile, ">>\n\n");
+
+ /* dump all actions */
+
+/* MR1 */
+/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
+/* MR1 via <<%%lexmember ....>> & <<%%lexprefix ...>> */
+/* MR1 */
+ if (LexActions != NULL) {
+ for (p = LexActions->next; p!=NULL; p=p->next)
+ {
+/* MR1 */ fprintf(dlgFile, "<<%%%%lexaction\n");
+ dumpAction( (char *)p->elem, dlgFile, 0, -1, 0, 1 );
+ fprintf(dlgFile, ">>\n\n");
+ }
+ };
+
+/* MR1 */ if (GenCC) {
+/* MR1 */ fprintf(dlgFile,"<<%%%%parserclass %s>>\n\n",CurrentClassName);
+/* MR1 */ };
+
+/* MR1 */ if (LexPrefixActions != NULL) {
+/* MR1 */ for (p = LexPrefixActions->next; p!=NULL; p=p->next)
+/* MR1 */ {
+/* MR1 */ fprintf(dlgFile, "<<%%%%lexprefix\n");
+/* MR1 */ dumpAction( (char *)p->elem, dlgFile, 0, -1, 0, 1 );
+/* MR1 */ fprintf(dlgFile, ">>\n\n");
+/* MR1 */ }
+/* MR1 */ };
+
+/* MR1 */ if (LexMemberActions != NULL) {
+/* MR1 */ for (p = LexMemberActions->next; p!=NULL; p=p->next)
+/* MR1 */ {
+/* MR1 */ fprintf(dlgFile, "<<%%%%lexmember\n");
+/* MR1 */ dumpAction( (char *)p->elem, dlgFile, 0, -1, 0, 1 );
+/* MR1 */ fprintf(dlgFile, ">>\n\n");
+/* MR1 */ }
+/* MR1 */ };
+
+ /* dump all regular expression rules/actions (skip sentinel node) */
+ if ( ExprOrder == NULL ) {
+ warnNoFL("no regular expressions found in grammar");
+ }
+ else dumpLexClasses(dlgFile);
+ fprintf(dlgFile, "%%%%\n");
+ fclose( dlgFile );
+}
+
+/* For each lexical class, scan ExprOrder looking for expressions
+ * in that lexical class. Print out only those that match.
+ * Each element of the ExprOrder list has both an expr and an lclass
+ * field.
+ */
+void
+#ifdef __USE_PROTOS
+dumpLexClasses( FILE *dlgFile )
+#else
+dumpLexClasses( dlgFile )
+FILE *dlgFile;
+#endif
+{
+ int i;
+ TermEntry *t;
+ ListNode *p;
+ Expr *q;
+
+ for (i=0; i<NumLexClasses; i++)
+ {
+ fprintf(dlgFile, "\n%%%%%s\n\n", lclass[i].classnum);
+ for (p=ExprOrder->next; p!=NULL; p=p->next)
+ {
+ q = (Expr *) p->elem;
+ if ( q->lclass != i ) continue;
+ lexmode(i);
+ t = (TermEntry *) hash_get(Texpr, q->expr);
+ require(t!=NULL, eMsg1("genLexDescr: rexpr %s not in hash table",q->expr) );
+ if ( t->token == EpToken ) continue;
+ fprintf(dlgFile, "%s\n\t<<\n", StripQuotes(q->expr));
+ /* replace " killed by StripQuotes() */
+ q->expr[ strlen(q->expr) ] = '"';
+ if ( !GenCC ) {
+ if ( TokenString(t->token) != NULL )
+ fprintf(dlgFile, "\t\tNLA = %s;\n", TokenString(t->token));
+ else
+ fprintf(dlgFile, "\t\tNLA = %d;\n", t->token);
+ }
+ if ( t->action != NULL ) dumpAction( t->action, dlgFile, 2,-1,0,1 );
+ if ( GenCC ) {
+ if ( TokenString(t->token) != NULL )
+ fprintf(dlgFile, "\t\treturn %s;\n", TokenString(t->token));
+ else
+ fprintf(dlgFile, "\t\treturn (ANTLRTokenType)%d;\n", t->token);
+ }
+ fprintf(dlgFile, "\t>>\n\n");
+ }
+ }
+}
+
+/* Strip the leading path (if any) from a filename */
+char *
+#ifdef __USE_PROTOS
+StripPath( char *fileName )
+#else
+StripPath( fileName )
+char *fileName;
+#endif
+{
+ char *p;
+ static char dirSym[2] = DirectorySymbol;
+
+ if(NULL != (p = strrchr(fileName, dirSym[0])))
+ p++;
+ else
+ p = fileName;
+
+ return(p);
+}
+
+/* Generate a list of #defines && list of struct definitions for
+ * aggregate retv's */
+void
+#ifdef __USE_PROTOS
+genDefFile( void )
+#else
+genDefFile( )
+#endif
+{
+ int i;
+
+ /* If C++ mode and #tokdef used, then don't need anything in here since
+ * C++ puts all definitions in the class file name.
+ */
+ if ( GenCC && UserTokenDefsFile ) return;
+ if ( MR_Inhibit_Tokens_h_Gen) return;
+
+ DefFile = fopen(OutMetaName(DefFileName), "w");
+ require(DefFile!=NULL, eMsg1("genDefFile: cannot open %s", OutMetaName(DefFileName)) );
+#ifdef SPECIAL_FOPEN
+ special_fopen_actions(OutMetaName(DefFileName)); /* MR1 */
+#endif
+ fprintf(DefFile, "#ifndef %s\n", StripPath(gate_symbol(DefFileName)));
+ fprintf(DefFile, "#define %s\n", StripPath(gate_symbol(DefFileName)));
+
+ fprintf(DefFile, "/* %s -- List of labelled tokens and stuff\n", DefFileName);
+ fprintf(DefFile, " *\n");
+ fprintf(DefFile, " * Generated from:");
+ for (i=0; i<NumFiles; i++) fprintf(DefFile, " %s", FileStr[i]);
+ fprintf(DefFile, "\n");
+ fprintf(DefFile, " *\n");
+ fprintf(DefFile, " * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n");
+ fprintf(DefFile, " * Purdue University Electrical Engineering\n");
+ fprintf(DefFile, " * ANTLR Version %s\n", Version);
+ fprintf(DefFile, " */\n");
+
+ if ( !GenCC && LexGen ) {
+ fprintf(DefFile,"#define zzEOF_TOKEN %d\n",
+ TokenInd!=NULL?TokenInd[EofToken]:EofToken);
+ }
+
+ if ( !UserDefdTokens )
+ {
+ int first=1;
+
+ if ( GenCC ) fprintf(DefFile, "enum ANTLRTokenType {\n");
+ for (i=1; i<TokenNum; i++)
+ {
+ /* Don't do EpToken or expr w/o labels */
+ if ( TokenString(i)!=NULL && i != EpToken )
+ {
+ TermEntry *p;
+
+ if ( WarningLevel>1 )
+ {
+ int j;
+ /* look in all lexclasses for the reg expr */
+
+/* MR10 Derek Pappas */
+/* MR10 A #tokclass doesn't have associated regular expressions */
+/* MR10 so don't warn user about it's omission */
+
+ p = (TermEntry *) hash_get(Tname, TokenString(i));
+
+ if (p != NULL && ! p->classname) {
+ for (j=0; j<NumLexClasses; j++)
+ {
+ lexmode(j);
+ if ( ExprString(i)!=NULL ) break;
+ }
+ if ( j>=NumLexClasses )
+ {
+ warnNoFL(eMsg1("token label has no associated rexpr: %s",TokenString(i)));
+ }
+ };
+ }
+ require((p=(TermEntry *)hash_get(Tname, TokenString(i))) != NULL,
+ "token not in sym tab when it should be");
+ if ( !p->classname )
+ {
+ if ( GenCC ) {
+ if ( !first ) fprintf(DefFile, ",\n");
+ first = 0;
+ fprintf(DefFile, "\t%s=%d", TokenString(i), i);
+ }
+ else
+ fprintf(DefFile, "#define %s %d\n", TokenString(i), i);
+ }
+ }
+ }
+/* MR1 */
+/* MR1 10-Apr-97 133MR1 Prevent use of varying sizes of integer */
+/* MR1 for the enum ANTLRTokenType */
+/* MR1 */
+ if ( GenCC ) { /* MR1 */
+ if ( !first ) fprintf(DefFile, ",\n"); /* MR14 */
+ fprintf(DefFile, "\tDLGminToken=0"); /* MR1 */
+ fprintf(DefFile, ",\n\tDLGmaxToken=9999};\n"); /* MR1 */
+ }; /* MR1 */
+ }
+
+ if ( !GenCC ) GenRulePrototypes(DefFile, SynDiag);
+
+ fprintf(DefFile, "\n#endif\n");
+}
+
+void
+#ifdef __USE_PROTOS
+GenRemapFile( void )
+#else
+GenRemapFile( )
+#endif
+{
+ if ( strcmp(ParserName, DefaultParserName)!=0 )
+ {
+ FILE *f;
+ int i;
+
+ f = fopen(OutMetaName(RemapFileName), "w");
+ require(f!=NULL, eMsg1("GenRemapFile: cannot open %s", OutMetaName(RemapFileName)) );
+#ifdef SPECIAL_FOPEN
+ special_fopen_actions(OutMetaName(RemapFileName)); /* MR1 */
+#endif
+ fprintf(f, "/* %s -- List of symbols to remap\n", RemapFileName);
+ fprintf(f, " *\n");
+ fprintf(f, " * Generated from:");
+ for (i=0; i<NumFiles; i++) fprintf(f, " %s", FileStr[i]);
+ fprintf(f, "\n");
+ fprintf(f, " *\n");
+ fprintf(f, " * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n");
+ fprintf(f, " * Purdue University Electrical Engineering\n");
+ fprintf(f, " * ANTLR Version %s\n", Version);
+ fprintf(f, " */\n");
+
+ GenRuleFuncRedefs(f, SynDiag);
+ GenPredefinedSymbolRedefs(f);
+ if ( GenAST ) GenASTSymbolRedefs(f);
+ GenSetRedefs(f);
+
+ fclose(f);
+ }
+}
+
+/* Generate a bunch of #defines that rename all functions to be "ParserName_func" */
+void
+#ifdef __USE_PROTOS
+GenRuleFuncRedefs( FILE *f, Junction *p )
+#else
+GenRuleFuncRedefs( f, p )
+FILE *f;
+Junction *p;
+#endif
+{
+ fprintf(f, "\n/* rename rule functions to be 'ParserName_func' */\n");
+ while ( p!=NULL )
+ {
+ fprintf(f, "#define %s %s_%s\n", p->rname, ParserName, p->rname);
+ p = (Junction *)p->p2;
+ }
+}
+
+/* Generate a bunch of #defines that rename all standard symbols to be
+ * "ParserName_symbol". The list of standard symbols to change is in
+ * globals.c.
+ */
+void
+#ifdef __USE_PROTOS
+GenPredefinedSymbolRedefs( FILE *f )
+#else
+GenPredefinedSymbolRedefs( f )
+FILE *f;
+#endif
+{
+ char **p;
+
+ fprintf(f, "\n/* rename PCCTS-supplied symbols to be 'ParserName_symbol' */\n");
+ for (p = &StandardSymbols[0]; *p!=NULL; p++)
+ {
+ fprintf(f, "#define %s %s_%s\n", *p, ParserName, *p);
+ }
+}
+
+/* Generate a bunch of #defines that rename all AST symbols to be
+ * "ParserName_symbol". The list of AST symbols to change is in
+ * globals.c.
+ */
+void
+#ifdef __USE_PROTOS
+GenASTSymbolRedefs( FILE *f )
+#else
+GenASTSymbolRedefs( f )
+FILE *f;
+#endif
+{
+ char **p;
+
+ fprintf(f, "\n/* rename PCCTS-supplied AST symbols to be 'ParserName_symbol' */\n");
+ for (p = &ASTSymbols[0]; *p!=NULL; p++)
+ {
+ fprintf(f, "#define %s %s_%s\n", *p, ParserName, *p);
+ }
+}
+
+/* redefine all sets generated by ANTLR; WARNING: 'zzerr', 'setwd' must match
+ * use in bits.c (DumpSetWd() etc...)
+ */
+void
+#ifdef __USE_PROTOS
+GenSetRedefs( FILE *f )
+#else
+GenSetRedefs( f )
+FILE *f;
+#endif
+{
+ int i;
+
+ for (i=1; i<=wordnum; i++)
+ {
+ fprintf(f, "#define setwd%d %s_setwd%d\n", i, ParserName, i);
+ }
+ for (i=1; i<=esetnum; i++)
+ {
+ fprintf(f, "#define zzerr%d %s_err%d\n", i, ParserName, i);
+ }
+}
+
+/* Find all return types/parameters that require structs and def
+ * all rules with ret types.
+ *
+ * This is for the declaration, not the definition.
+ */
+void
+#ifdef __USE_PROTOS
+GenRulePrototypes( FILE *f, Junction *p )
+#else
+GenRulePrototypes( f, p )
+FILE *f;
+Junction *p;
+#endif
+{
+ int i;
+
+ i = 1;
+ while ( p!=NULL )
+ {
+ if ( p->ret != NULL )
+ {
+/* MR23 */ if ( hasMultipleOperands(p->ret) )
+ {
+ DumpRetValStruct(f, p->ret, i);
+ }
+ fprintf(f, "\n#ifdef __USE_PROTOS\n");
+/* MR23 */ if ( hasMultipleOperands(p->ret) )
+ {
+ fprintf(f, "extern struct _rv%d", i);
+ }
+ else
+ {
+ fprintf(f, "extern ");
+ DumpType(p->ret, f);
+ }
+ fprintf(f, " %s%s(", RulePrefix, p->rname);
+ DumpANSIFunctionArgDef(f,p,1 /* emit initializers ? */);
+ fprintf(f, ";\n");
+ fprintf(f, "#else\n");
+/* MR23 */ if ( hasMultipleOperands(p->ret) )
+ {
+ fprintf(f, "extern struct _rv%d", i);
+ }
+ else
+ {
+ fprintf(f, "extern ");
+ DumpType(p->ret, f);
+ }
+ fprintf(f, " %s%s();\n", RulePrefix, p->rname);
+ fprintf(f, "#endif\n");
+ }
+ else
+ {
+ fprintf(f, "\n#ifdef __USE_PROTOS\n");
+ fprintf(f, "void %s%s(", RulePrefix, p->rname);
+ DumpANSIFunctionArgDef(f,p, 1 /* emit initializers ? */ );
+ fprintf(f, ";\n");
+#ifdef OLD
+ if ( p->pdecl != NULL || GenAST )
+ {
+ if ( GenAST ) {
+ fprintf(f, "AST **%s",(p->pdecl!=NULL)?",":"");
+ }
+ if ( p->pdecl!=NULL ) fprintf(f, "%s", p->pdecl);
+ }
+ else fprintf(f, "void");
+ fprintf(f, ");\n");
+#endif
+ fprintf(f, "#else\n");
+ fprintf(f, "extern void %s%s();\n", RulePrefix, p->rname);
+ fprintf(f, "#endif\n");
+ }
+ i++;
+ p = (Junction *)p->p2;
+ }
+}
+
+/* Define all rules in the class.h file; generate any required
+ * struct definitions first, however.
+ */
+void
+#ifdef __USE_PROTOS
+GenRuleMemberDeclarationsForCC( FILE *f, Junction *q )
+#else
+GenRuleMemberDeclarationsForCC( f, q )
+FILE *f;
+Junction *q;
+#endif
+{
+ Junction *p = q;
+ int i;
+
+ fprintf(f, "private:\n");
+
+ /* Dump dflt handler declaration */
+ fprintf(f, "\tvoid zzdflthandlers( int _signal, int *_retsignal );\n\n");
+
+ fprintf(f, "public:\n");
+
+ /* Dump return value structs */
+ i = 1;
+ while ( p!=NULL )
+ {
+ if ( p->ret != NULL )
+ {
+/* MR23 */ if ( hasMultipleOperands(p->ret) )
+ {
+ DumpRetValStruct(f, p->ret, i);
+ }
+ }
+ i++;
+ p = (Junction *)p->p2;
+ }
+
+ /* Dump member func defs && CONSTRUCTOR */
+ fprintf(f, "\t%s(ANTLRTokenBuffer *input);\n", CurrentClassName);
+/*
+ fprintf(f, "\t%s(ANTLRTokenBuffer *input, ANTLRTokenType eof);\n",
+ CurrentClassName);
+*/
+
+ i = 1;
+ p = q;
+ while ( p!=NULL )
+ {
+ if ( p->ret != NULL )
+ {
+/* MR23 */ if ( hasMultipleOperands(p->ret) )
+ {
+ fprintf(f, "\tstruct _rv%d", i);
+ }
+ else
+ {
+ fprintf(f, "\t");
+ DumpType(p->ret, f);
+ }
+ fprintf(f, " %s%s(",RulePrefix,p->rname);
+ DumpANSIFunctionArgDef(f,p, 1 /* emit initializers ? */ );
+ fprintf(f, ";\n");
+#ifdef OLD
+ if ( p->pdecl != NULL || GenAST )
+ {
+ if ( GenAST ) fprintf(f, "ASTBase **%s",(p->pdecl!=NULL)?",":"");
+ if ( p->pdecl!=NULL ) fprintf(f, "%s", p->pdecl);
+ }
+ fprintf(f, ");\n");
+#endif
+ }
+ else
+ {
+ fprintf(f, "\tvoid %s%s(",RulePrefix,p->rname);
+ DumpANSIFunctionArgDef(f,p, 1 /* emit initializers ? */);
+ fprintf(f, ";\n");
+#ifdef OLD
+ if ( p->pdecl != NULL || GenAST )
+ {
+ if ( GenAST ) fprintf(f, "ASTBase **%s",(p->pdecl!=NULL)?",":"");
+ if ( p->pdecl!=NULL ) fprintf(f, "%s", p->pdecl);
+ }
+ fprintf(f, ");\n");
+#endif
+ }
+ i++;
+ p = (Junction *)p->p2;
+ }
+}
+
+/* Given a list of ANSI-style parameter declarations, print out a
+ * comma-separated list of the symbols (w/o types).
+ * Basically, we look for a comma, then work backwards until start of
+ * the symbol name. Then print it out until 1st non-alnum char. Now,
+ * move on to next parameter.
+ *
+ */
+
+/* MR5 Jan Mikkelsen 26-May-97 - added initialComma parameter */
+
+void
+#ifdef __USE_PROTOS
+DumpListOfParmNames(char *pdecl, FILE *output, int initialComma) /* MR5 */
+#else
+DumpListOfParmNames(pdecl, output, initialComma) /* MR5 */
+char *pdecl; /* MR5 */
+FILE *output; /* MR5 */
+int initialComma; /* MR5 */
+#endif
+{
+ int firstTime = 1, done = 0;
+ require(output!=NULL, "DumpListOfParmNames: NULL parm");
+
+ if ( pdecl == NULL ) return;
+ while ( !done )
+ {
+ if ( !firstTime || initialComma ) putc(',', output); /* MR5 */
+ done = DumpNextNameInDef(&pdecl, output);
+ firstTime = 0;
+ }
+}
+
+/* given a list of parameters or return values, dump the next
+ * name to output. Return 1 if last one just printed, 0 if more to go.
+ */
+
+/* MR23 Total rewrite */
+
+int
+#ifdef __USE_PROTOS
+DumpNextNameInDef( char **q, FILE *output )
+#else
+DumpNextNameInDef( q, output )
+char **q;
+FILE *output;
+#endif
+{
+ char *p;
+ char *t;
+ char *pDataType;
+ char *pSymbol;
+ char *pEqualSign;
+ char *pValue;
+ char *pSeparator;
+ int nest = 0;
+
+ p = endFormal(*q,
+ &pDataType,
+ &pSymbol,
+ &pEqualSign,
+ &pValue,
+ &pSeparator,
+ &nest);
+
+ /* MR26 Handle rule arguments such as: IIR_Bool (IIR_Decl::*constraint)()
+ For this we need to strip off anything which follows the symbol.
+ */
+
+/* MR26 */ t = pSymbol;
+/* MR26 */ if (t != NULL) {
+/* MR26 */ for (t = pSymbol; *t != 0; t++) {
+/* MR26 */ if (! (isalpha(*t) || isdigit(*t) || *t == '_' || *t == '$')) break;
+/* MR26 */ }
+/* MR26 */ }
+/* MR26 */ fprintf(output, "%s", strBetween(pSymbol, t, pSeparator));
+
+ *q = p;
+ return (*pSeparator == 0);
+}
+
+/* Given a list of ANSI-style parameter declarations, dump K&R-style
+ * declarations, one per line for each parameter. Basically, convert
+ * comma to semi-colon, newline.
+ */
+void
+#ifdef __USE_PROTOS
+DumpOldStyleParms( char *pdecl, FILE *output )
+#else
+DumpOldStyleParms( pdecl, output )
+char *pdecl;
+FILE *output;
+#endif
+{
+ require(output!=NULL, "DumpOldStyleParms: NULL parm");
+
+ if ( pdecl == NULL ) return;
+ while ( *pdecl != '\0' )
+ {
+ if ( *pdecl == ',' )
+ {
+ pdecl++;
+ putc(';', output); putc('\n', output);
+ while ( *pdecl==' ' || *pdecl=='\t' || *pdecl=='\n' ) pdecl++;
+ }
+ else {putc(*pdecl, output); pdecl++;}
+ }
+ putc(';', output);
+ putc('\n', output);
+}
+
+/* Take in a type definition (type + symbol) and print out type only */
+/* MR23 Total rewrite */
+
+void
+#ifdef __USE_PROTOS
+DumpType( char *s, FILE *f )
+#else
+DumpType( s, f )
+char *s;
+FILE *f;
+#endif
+{
+ char *p;
+ char *pDataType;
+ char *pSymbol;
+ char *pEqualSign;
+ char *pValue;
+ char *pSeparator;
+ int nest = 0;
+
+ require(s!=NULL, "DumpType: invalid type string");
+
+ p = endFormal(s,
+ &pDataType,
+ &pSymbol,
+ &pEqualSign,
+ &pValue,
+ &pSeparator,
+ &nest);
+ fprintf(f, "%s", strBetween(pDataType, pSymbol, pSeparator));
+}
+
+/* check to see if string e is a word in string s */
+int
+#ifdef __USE_PROTOS
+strmember( char *s, char *e )
+#else
+strmember( s, e )
+char *s;
+char *e;
+#endif
+{
+ register char *p;
+ require(s!=NULL&&e!=NULL, "strmember: NULL string");
+
+ if ( *e=='\0' ) return 1; /* empty string is always member */
+ do {
+ while ( *s!='\0' && !isalnum(*s) && *s!='_' )
+ ++s;
+ p = e;
+ while ( *p!='\0' && *p==*s ) {p++; s++;}
+ if ( *p=='\0' ) {
+ if ( *s=='\0' ) return 1;
+ if ( !isalnum (*s) && *s != '_' ) return 1;
+ }
+ while ( isalnum(*s) || *s == '_' )
+ ++s;
+ } while ( *s!='\0' );
+ return 0;
+}
+
+#if 0
+
+/* MR23 Replaced by hasMultipleOperands() */
+
+int
+#ifdef __USE_PROTOS
+HasComma( char *s )
+#else
+HasComma( s )
+char *s;
+#endif
+{
+ while (*s!='\0')
+ if ( *s++ == ',' ) return 1;
+ return 0;
+}
+#endif
+
+
+/* MR23 Total rewrite */
+
+void
+#ifdef __USE_PROTOS
+DumpRetValStruct( FILE *f, char *ret, int i )
+#else
+DumpRetValStruct( f, ret, i )
+FILE *f;
+char *ret;
+int i;
+#endif
+{
+ char *p = ret;
+ char *pDataType;
+ char *pSymbol;
+ char *pEqualSign;
+ char *pValue;
+ char *pSeparator;
+ int nest = 0;
+
+ fprintf(f, "\nstruct _rv%d {\n", i);
+ while (*p != 0 && nest == 0) {
+ p = endFormal(p,
+ &pDataType,
+ &pSymbol,
+ &pEqualSign,
+ &pValue,
+ &pSeparator,
+ &nest);
+ fprintf(f,"\t");
+ fprintf(f, "%s", strBetween(pDataType, pSymbol, pSeparator));
+ fprintf(f," ");
+ fprintf(f, "%s", strBetween(pSymbol, pEqualSign, pSeparator));
+ fprintf(f,";\n");
+ }
+ fprintf(f,"};\n");
+}
+
+/* given "s" yield s -- DESTRUCTIVE (we modify s if starts with " else return s) */
+char *
+#ifdef __USE_PROTOS
+StripQuotes( char *s )
+#else
+StripQuotes( s )
+char *s;
+#endif
+{
+ if ( *s == '"' )
+ {
+ s[ strlen(s)-1 ] = '\0'; /* remove last quote */
+ return( s+1 ); /* return address past initial quote */
+ }
+ return( s );
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c
new file mode 100644
index 000000000..051ee4ec5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c
@@ -0,0 +1,1747 @@
+/*
+ * main.c -- main program for PCCTS ANTLR.
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+/* To set a breakpoint just before exit look for "cleanUp". */
+/* To set a breakpoint for fatal error look for "fatal_intern" */
+
+#include <stdio.h>
+
+#include "pcctscfg.h"
+#include "stdpccts.h"
+
+#define MAX_INT_STACK 50
+static int istack[MAX_INT_STACK]; /* Int stack */
+static int isp = MAX_INT_STACK;
+
+static int DontAcceptFiles = 0; /* if stdin, don't read files */
+static int DontAcceptStdin = 0; /* if files seen first, don't accept stdin */
+
+static int tnodes_used_in_guard_predicates_etc; /* MR10 */
+
+ /* C m d - L i n e O p t i o n S t r u c t & F u n c s */
+
+typedef struct _Opt {
+ char *option;
+ int arg;
+#ifdef __cplusplus
+ void (*process)(...);
+#else
+ void (*process)();
+#endif
+ char *descr;
+ } Opt;
+
+#ifdef __USE_PROTOS
+extern void ProcessArgs(int, char **, Opt *);
+#else
+extern void ProcessArgs();
+#endif
+
+#ifdef __USE_PROTOS
+int ci_strequ(char *a,char *b)
+#else
+int ci_strequ(a,b)
+ char *a;
+ char *b;
+#endif
+{
+ for ( ;*a != 0 && *b != 0; a++, b++) {
+ if (toupper(*a) != toupper(*b)) return 0;
+ }
+ return (*a == *b);
+}
+
+static void
+#ifdef __USE_PROTOS
+pStdin( void )
+#else
+pStdin( )
+#endif
+{
+ if ( DontAcceptStdin )
+ {
+ warnNoFL("'-' (stdin) ignored as files were specified first");
+ return;
+ }
+
+ require(NumFiles<MaxNumFiles,"exceeded max # of input files");
+ FileStr[NumFiles++] = "stdin";
+ DontAcceptFiles = 1;
+}
+
+static void
+#ifdef __USE_PROTOS
+pFile( char *s )
+#else
+pFile( s )
+char *s;
+#endif
+{
+ if ( *s=='-' ) { warnNoFL( eMsg1("invalid option: '%s'",s) ); return; }
+ if ( DontAcceptFiles )
+ {
+ warnNoFL(eMsg1("file '%s' ignored as '-' (stdin option) was specified first",s));
+ return;
+ }
+
+ require(NumFiles<MaxNumFiles,"exceeded max # of input files");
+ FileStr[NumFiles++] = s;
+ DontAcceptStdin = 1;
+}
+
+/* MR14
+ Allow input to be a file containing a list of files
+ Bernard Giroud (b_giroud@decus.ch)
+*/
+
+static void
+#ifdef __USE_PROTOS
+pFileList( char *s, char *t )
+#else
+pFileList( s, t )
+char *s;
+char *t;
+#endif
+{
+#define MaxFLArea 1024
+ FILE *fl;
+ static char Fn_in_Fl[MaxFLArea] = "";
+ char one_fn[MaxFileName];
+ char *flp = &Fn_in_Fl[0];
+ int fnl, left = MaxFLArea, i;
+
+ if ( *t=='-' ) { warnNoFL( eMsg1("invalid option: '%s'",t) ); return; }
+ if ( DontAcceptFiles )
+ {
+ warnNoFL(eMsg1("file '%s' ignored as '-' (stdin option) was specified first",t));
+ return;
+ }
+
+ if ((fl = fopen(t, "r")) == NULL)
+ {
+ warnNoFL(eMsg1("file '%s' can't be opened", t));
+ return;
+ }
+ for (;;)
+ {
+ if (fgets(one_fn, 128 - 1, fl) == NULL)
+ break;
+ fnl = strlen(one_fn);
+ require(fnl<=left, "no more room in File List Area");
+ /* drop the trailing LF */
+ if (one_fn[fnl - 1] == 0x0a) one_fn[fnl - 1] = ' ';
+ strcat(Fn_in_Fl, one_fn);
+ left = left - fnl;
+ require(NumFiles<MaxNumFiles,"exceeded max # of input files");
+ FileStr[NumFiles++] = flp;
+ flp = flp + fnl;
+ }
+ fclose(fl);
+ for (i=0;i < MaxFLArea;i++) if (Fn_in_Fl[i] == ' ') Fn_in_Fl[i] = '\0';
+ DontAcceptStdin = 1;
+}
+
+static void
+#ifdef __USE_PROTOS
+pLLK( char *s, char *t )
+#else
+pLLK( s, t )
+char *s;
+char *t;
+#endif
+{
+ LL_k = atoi(t);
+ if ( LL_k <= 0 ) {
+ warnNoFL("must have at least one token of lookahead (setting to 1)");
+ LL_k = 1;
+ }
+}
+
+static void
+#ifdef __USE_PROTOS
+pCk( char *s, char *t )
+#else
+pCk( s, t )
+char *s;
+char *t;
+#endif
+{
+ CLL_k = atoi(t);
+ if ( CLL_k <= 0 ) {
+ warnNoFL("must have at least one token of look-ahead (setting to 1)");
+ CLL_k = 1;
+ }
+}
+
+static void /* MR6 */
+#ifdef __USE_PROTOS
+pTab( char *s, char *t ) /* MR6 */
+#else
+pTab( s, t ) /* MR6 */
+char *s; /* MR6 */
+char *t; /* MR6 */
+#endif
+{ /* MR6 */
+ TabWidth = atoi(t); /* MR6 */
+ if ( TabWidth < 0 || TabWidth > 8 ) { /* MR6 */
+ warnNoFL("tab width must be between 1 and 8"); /* MR6 */
+ TabWidth=0; /* MR6 */
+ } /* MR6 */
+} /* MR6 */
+
+static int ambAidDepthSpecified=0; /* MR11 */
+
+static void /* MR11 */
+#ifdef __USE_PROTOS
+pAAd( char *s, char *t ) /* MR11 */
+#else
+pAAd( s, t ) /* MR11 */
+char *s; /* MR11 */
+char *t; /* MR11 */
+#endif
+{ /* MR11 */
+ ambAidDepthSpecified=1; /* MR11 */
+ MR_AmbAidDepth = atoi(t); /* MR11 */
+} /* MR11 */
+
+static void /* MR11 */
+#ifdef __USE_PROTOS
+pTreport( char *s, char *t ) /* MR11 */
+#else
+pTreport( s, t ) /* MR11 */
+ char *s; /* MR11 */
+ char *t; /* MR11 */
+#endif
+{ /* MR11 */
+ TnodesReportThreshold = atoi(t); /* MR11 */
+} /* MR11 */
+
+#ifdef __USE_PROTOS
+void chkGTFlag(void) /* 7-Apr-97 MR1 */
+#else
+void chkGTFlag() /* 7-Apr-97 MR1 */
+#endif
+{
+ if ( !GenAST )
+ warn("#-variable or other AST item referenced w/o -gt option");
+}
+
+
+#ifdef __USE_PROTOS
+static void pInfo(char *s, char *t) /* MR10 */
+#else
+static void pInfo(s,t) /* MR10 */
+ char *s;
+ char *t;
+#endif
+{
+ char *p;
+ int q;
+ for (p=t; *p != 0; p++) {
+ q=tolower(*p);
+ if (q=='t') {
+ InfoT=1;
+ } else if (q=='p') {
+ InfoP=1;
+ } else if (q=='m') {
+ InfoM=1;
+ } else if (q=='o') {
+ InfoO=1;
+ } else if (q=='0') {
+ ; /* nothing */
+ } else if (q=='f') {
+ InfoF=1;
+ } else {
+ warnNoFL(eMsgd("unrecognized -info option \"%c\"",(int)*p));
+ };
+ };
+}
+
+#ifdef __USE_PROTOS
+static void pCGen(void) { CodeGen = FALSE; LexGen = FALSE; }
+static void pLGen(void) { LexGen = FALSE; }
+static void pXTGen(void){ MR_Inhibit_Tokens_h_Gen = TRUE; }
+static void pTGen(void) { TraceGen = TRUE; }
+static void pSGen(void) { GenExprSetsOpt = FALSE; }
+static void pPrt(void) { PrintOut = TRUE; pCGen(); pLGen(); }
+static void pPrtA(void) { PrintOut = TRUE; PrintAnnotate = TRUE; pCGen(); pLGen(); }
+static void pAst(void) { GenAST = TRUE; }
+static void pANSI(void) { GenANSI = TRUE; }
+static void pCr(void) { GenCR = TRUE; }
+static void pNOPURIFY(void) { PURIFY = FALSE; }
+/*static void pCt(void) { warnNoFL("-ct option is now the default"); }*/
+static void pLI(void) { GenLineInfo = TRUE; GenLineInfoMS = FALSE; } /* MR14 */
+static void pLIms(void) { GenLineInfo = TRUE; GenLineInfoMS = TRUE; } /* MR14 */
+static void pFr(char *s, char *t) {RemapFileName = t;}
+static void pFe(char *s, char *t) {ErrFileName = t;}
+static void pFl(char *s, char *t) {DlgFileName = t;}
+static void pFm(char *s, char *t) {ModeFileName = t;}
+static void pFt(char *s, char *t) {DefFileName = t;}
+
+static void pE1(void) { elevel = 1; }
+static void pE2(void) { elevel = 2; }
+static void pE3(void) { elevel = 3; }
+static void pEGen(void) { GenEClasseForRules = 1; }
+static void pDL(void)
+ {
+ DemandLookahead = 1;
+ if ( GenCC ) {
+ warnNoFL("-gk does not work currently in C++ mode; -gk turned off");
+ DemandLookahead = 0;
+ }
+ }
+
+static void pAA(char *s,char *t) {MR_AmbAidRule = t;} /* MR11 */
+static void pAAm(char *s){MR_AmbAidMultiple = 1;} /* MR11 */
+static void pGHdr(void) { GenStdPccts = 1; }
+static void pFHdr(char *s, char *t) { stdpccts = t; pGHdr(); }
+static void pW1(void) { WarningLevel = 1; }
+static void pNewAST(void) { NewAST = 1; } /* MR13 */
+static void ptmakeInParser(void) { tmakeInParser = 1; } /* MR23 */
+static void pAlpha(void) { AlphaBetaTrace = 1; } /* MR14 */
+static void pMR_BlkErr(void) { MR_BlkErr = 1; } /* MR21 */
+static void pStdout(void) {UseStdout = 1; } /* MR6 */
+static void pW2(void) { WarningLevel = 2; }
+static void pCC(void) { GenCC = TRUE; }
+#else
+static void pCGen() { CodeGen = FALSE; LexGen = FALSE; }
+static void pLGen() { LexGen = FALSE; }
+static void pXTGen(){ MR_Inhibit_Tokens_h_Gen = TRUE; } /* MR14 */
+static void pTGen() { TraceGen = TRUE; }
+static void pSGen() { GenExprSetsOpt = FALSE; }
+static void pPrt() { PrintOut = TRUE; pCGen(); pLGen(); }
+static void pPrtA() { PrintOut = TRUE; PrintAnnotate = TRUE; pCGen(); pLGen(); }
+static void pAst() { GenAST = TRUE; }
+static void pANSI() { GenANSI = TRUE; }
+static void pCr() { GenCR = TRUE; }
+static void pNOPURIFY() { PURIFY = FALSE; }
+
+/*static void pCt() { warnNoFL("-ct option is now the default"); }*/
+static void pLI() { GenLineInfo = TRUE; GenLineInfoMS = FALSE; } /* MR14 */
+static void pLIms() { GenLineInfo = TRUE; GenLineInfoMS = TRUE; } /* MR14 */
+static void pFr(s,t) char *s, *t; {RemapFileName = t;}
+static void pFe(s,t) char *s, *t; {ErrFileName = t;}
+static void pFl(s,t) char *s, *t; {DlgFileName = t;}
+static void pFm(s,t) char *s, *t; {ModeFileName = t;}
+static void pFt(s,t) char *s, *t; {DefFileName = t;}
+
+static void pE1() { elevel = 1; }
+static void pE2() { elevel = 2; }
+static void pE3() { elevel = 3; }
+static void pEGen() { GenEClasseForRules = 1; }
+static void pDL()
+ {
+ DemandLookahead = 1;
+ if ( GenCC ) {
+ warnNoFL("-gk does not work currently in C++ mode; -gk turned off");
+ DemandLookahead = 0;
+ }
+ }
+
+static void pAA(s,t) char *s; char *t; {MR_AmbAidRule = t;} /* MR11 BJS 20-Mar-98 */
+static void pAAm(s) char *s; {MR_AmbAidMultiple = 1;} /* MR11 BJS 20-Mar-98 */
+static void pGHdr() { GenStdPccts = 1; }
+static void pFHdr(s,t) char *s, *t; { stdpccts = t; pGHdr(); }
+static void pW1() { WarningLevel = 1; }
+static void pNewAST() { NewAST = 1; } /* MR13 */
+static void ptmakeInParser() { tmakeInParser = 1; } /* MR23 */
+static void pAlpha() { AlphaBetaTrace = 1; } /* MR14 */
+static void pMR_BlkErr() { MR_BlkErr = 1; } /* MR21 */
+static void pStdout() {UseStdout = 1; } /* MR6 */
+static void pW2() { WarningLevel = 2; }
+static void pCC() { GenCC = TRUE; }
+#endif
+
+static void
+#ifdef __USE_PROTOS
+pPre( char *s, char *t )
+#else
+pPre( s, t )
+char *s;
+char *t;
+#endif
+{
+ RulePrefix = t;
+}
+
+static void
+#ifdef __USE_PROTOS
+pOut( char *s, char *t )
+#else
+pOut( s, t )
+char *s;
+char *t;
+#endif
+{
+ OutputDirectory = t;
+}
+
+static void
+#ifdef __USE_PROTOS
+pPred( void )
+#else
+pPred( )
+#endif
+{
+ warnNoFL("-pr is no longer used (predicates employed if present); see -prc, -mrhoist, -mrhoistk");
+/*
+** if ( DemandLookahead )
+** warnNoFL("-gk conflicts with -pr; -gk turned off");
+** DemandLookahead = 0;
+** HoistPredicateContext = 0;
+*/
+}
+
+static void
+#ifdef __USE_PROTOS
+pPredCtx( char *s, char *t )
+#else
+pPredCtx(s,t)
+char *s;
+char *t;
+#endif
+{
+ if ( ci_strequ(t,"on")) HoistPredicateContext = 1;
+ else if ( ci_strequ(t,"off")) HoistPredicateContext = 0;
+ if ( DemandLookahead )
+ {
+ warnNoFL("-gk incompatible with semantic predicate usage; -gk turned off");
+ DemandLookahead = 0;
+ }
+}
+
+static void
+#ifdef __USE_PROTOS
+pMRhoist( char *s, char *t )
+#else
+pMRhoist(s,t)
+char *s;
+char *t;
+#endif
+{
+ if ( ci_strequ(t,"on")) MRhoisting = 1;
+ else if ( ci_strequ(t,"off")==0 ) MRhoisting = 0;
+ if (MRhoisting) {
+ fprintf(stderr,"Maintenance Release style hoisting enabled for predicates with lookahead depth = 1\n");
+ fprintf(stderr," No longer considered experimental\n");
+ fprintf(stderr," Can't consider suppression for predicates with lookahead depth > 1\n");
+ fprintf(stderr," Implies -prc on but does *not* imply -mrhoistk for k>1 predicates\n");
+ fprintf(stderr," This is a reminder, not a warning or error.\n");
+ };
+}
+
+static void
+#ifdef __USE_PROTOS
+pMRhoistk( char *s, char *t )
+#else
+pMRhoistk(s,t)
+char *s;
+char *t;
+#endif
+{
+ if ( ci_strequ(t,"on")) MRhoistingk = 1;
+ else if ( ci_strequ(t,"off")==0 ) MRhoistingk = 0;
+ if (MRhoistingk) {
+ fprintf(stderr,"EXPERIMENTAL Maintenance Release style hoisting enabled\n");
+ fprintf(stderr," Applies to predicates with lookahead depth > 1\n");
+ fprintf(stderr," Implies -prc on and -mrhoist on\n");
+ };
+}
+
+static void
+#ifdef __USE_PROTOS
+pTRes( char *s, char *t )
+#else
+pTRes( s, t )
+char *s;
+char *t;
+#endif
+{
+ TreeResourceLimit = atoi(t);
+ if ( TreeResourceLimit <= 0 )
+ {
+ warnNoFL("analysis resource limit (# of tree nodes) must be greater than 0");
+ TreeResourceLimit = -1; /* set to no limit */
+ }
+}
+
+Opt options[] = {
+#ifdef __cplusplus
+ { "-CC", 0, (void (*)(...)) pCC, "Generate C++ output (default=FALSE)"},
+ { "-ck", 1, (void (*)(...)) pCk, "Set compressed lookahead depth; fast approximate lookahead"},
+ { "-cr", 0, (void (*)(...)) pCr, "Generate cross reference (default=FALSE)"},
+ { "-e1", 0, (void (*)(...)) pE1, "Ambiguities/errors shown in low detail (default)"},
+ { "-e2", 0, (void (*)(...)) pE2, "Ambiguities/errors shown in more detail"},
+ { "-e3", 0, (void (*)(...)) pE3,
+ "Ambiguities for k>1 grammars shown with exact tuples (not lookahead sets)"},
+ { "-f", 1, (void (*)(...)) pFileList,"Read names of grammar files from specified file"}, /* MR14 */
+ { "-fe", 1, (void (*)(...)) pFe, "Rename err.c"},
+ { "-fh", 1, (void (*)(...)) pFHdr, "Rename stdpccts.h header (turns on -gh)"},
+ { "-fl", 1, (void (*)(...)) pFl, "Rename lexical output--parser.dlg"},
+ { "-fm", 1, (void (*)(...)) pFm, "Rename mode.h"},
+ { "-fr", 1, (void (*)(...)) pFr, "Rename remap.h"},
+ { "-ft", 1, (void (*)(...)) pFt, "Rename tokens.h"},
+ { "-ga", 0, (void (*)(...)) pANSI, "Generate ANSI-compatible code (default=FALSE)"},
+ { "-gc", 0, (void (*)(...)) pCGen, "Do not generate output parser code (default=FALSE)"},
+ { "-gd", 0, (void (*)(...)) pTGen, "Generate code to trace rule invocation (default=FALSE)"},
+ { "-ge", 0, (void (*)(...)) pEGen, "Generate an error class for each non-terminal (default=FALSE)"},
+ { "-gh", 0, (void (*)(...)) pGHdr, "Generate stdpccts.h for non-ANTLR-generated-files to include"},
+ { "-gk", 0, (void (*)(...)) pDL, "Generate parsers that delay lookahead fetches until needed"},
+ { "-gl", 0, (void (*)(...)) pLI, "Generate line info about grammar actions in parser"},
+ { "-glms", 0, (void (*)(...)) pLIms,"Like -gl but replace '\\' with '/' in #line filenames for MS C/C++ systems"},
+ { "-gp", 1, (void (*)(...)) pPre, "Prefix all generated rule functions with a string"},
+ { "-gs", 0, (void (*)(...)) pSGen, "Do not generate sets for token expression lists (default=FALSE)"},
+ { "-gt", 0, (void (*)(...)) pAst, "Generate code for Abstract-Syntax-Trees (default=FALSE)"},
+ { "-gx", 0, (void (*)(...)) pLGen, "Do not generate lexical (dlg-related) files (default=FALSE)"},
+ { "-gxt",0, (void (*)(...)) pXTGen, "Do not generate tokens.h (default=FALSE)"},
+ { "-k", 1, (void (*)(...)) pLLK, "Set full LL(k) lookahead depth (default==1)"},
+ { "-o", 1, (void (*)(...)) pOut, OutputDirectoryOption},
+ { "-p", 0, (void (*)(...)) pPrt, "Print out the grammar w/o actions (default=no)"},
+ { "-pa", 0, (void (*)(...)) pPrtA, "Print out the grammar w/o actions & w/FIRST sets (default=no)"},
+ { "-pr",0, (void (*)(...)) pPred, "no longer used; predicates employed if present"},
+ { "-prc", 1, (void (*)(...)) pPredCtx,"Turn on/off computation of context for hoisted predicates"},
+ { "-rl", 1, (void (*)(...)) pTRes, "Limit max # of tree nodes used by grammar analysis"},
+ { "-stdout",0, (void (*)(...)) pStdout,"Send grammar.c/grammar.cpp to stdout"}, /* MR6 */
+ { "-tab", 1, (void (*)(...)) pTab, "Width of tabs (1 to 8) for grammar.c/grammar.cpp files"}, /* MR6 */
+ { "-w1", 0, (void (*)(...)) pW1, "Set the warning level to 1 (default)"},
+ { "-w2", 0, (void (*)(...)) pW2, "Ambiguities yield warnings even if predicates or (...)? block"},
+ { "-", 0, (void (*)(...)) pStdin, "Read grammar from stdin" },
+ { "-mrhoist",1, (void (*)(...)) pMRhoist, /* MR9 */
+ "Turn on/off k=1 Maintenance Release style hoisting"}, /* MR9 */
+ { "-mrhoistk",1, (void (*)(...)) pMRhoistk, /* MR9 */
+ "Turn on/off EXPERIMENTAL k>1 Maintenance Release style hoisting"}, /* MR13 */
+ { "-aa" , 1, (void (*)(...)) pAA, "Ambiguity aid for a rule (rule name or line number)"}, /* MR11 */
+ { "-aam" , 0, (void (*)(...)) pAAm,
+ "Lookahead token may appear multiple times in -aa listing"}, /* MR11 */
+ { "-aad" , 1, (void (*)(...)) pAAd,
+ "Limits exp growth of -aa listing - default=1 (max=ck value)"}, /* MR11 */
+ { "-info", 1, (void (*)(...)) pInfo,
+ "Extra info: p=pred t=tnodes f=first/follow m=monitor o=orphans 0=noop"}, /* MR12 */
+ { "-treport",1,(void (*)(...)) pTreport,
+ "Report when tnode usage exceeds value during ambiguity resolution"}, /* MR11 */
+ { "-newAST", 0, (void (*)(...)) pNewAST,
+ "In C++ mode use \"newAST(...)\" rather than \"new AST(...)\""}, /* MR13 */
+ { "-tmake", 0, (void (*)(...)) ptmakeInParser,
+ "In C++ mode use parser's tmake method rather than \"ASTBase::tmake(...)\""}, /* MR23 */
+ { "-alpha",0,(void (*)(...)) pAlpha,
+ "Provide additional information for \"(alpha)? beta\" error messages"}, /* MR14 */
+ { "-mrblkerr",0,(void (*)(...)) pMR_BlkErr, /* MR21 */
+ "EXPERIMENTAL change to (...)* and (...)+ syntax error sets"}, /* MR21 */
+ { "-nopurify",0,(void (*)(...)) pNOPURIFY,
+ "Don't use the notorious PURIFY macro (replaced by MR23 initial value syntax) to zero return arguments of rules"}, /* MR23 */
+ { "*", 0, (void (*)(...)) pFile, "" }, /* anything else is a file */
+#else
+ { "-CC", 0, pCC, "Generate C++ output (default=FALSE)"},
+ { "-cr", 0, pCr, "Generate cross reference (default=FALSE)"},
+ { "-ck", 1, pCk, "Set compressed lookahead depth; fast approximate lookahead"},
+ { "-e1", 0, pE1, "Ambiguities/errors shown in low detail (default)"},
+ { "-e2", 0, pE2, "Ambiguities/errors shown in more detail"},
+ { "-e3", 0, pE3, "Ambiguities for k>1 grammars shown with exact tuples (not lookahead sets)"},
+ { "-f", 1, pFileList,"Read names of grammar files from specified file"}, /* MR14 */
+ { "-fe", 1, pFe, "Rename err.c"},
+ { "-fh", 1, pFHdr, "Rename stdpccts.h header (turns on -gh)"},
+ { "-fl", 1, pFl, "Rename lexical output--parser.dlg"},
+ { "-fm", 1, pFm, "Rename mode.h"},
+ { "-fr", 1, pFr, "Rename remap.h"},
+ { "-ft", 1, pFt, "Rename tokens.h"},
+ { "-ga", 0, pANSI, "Generate ANSI-compatible code (default=FALSE)"},
+ { "-gc", 0, pCGen, "Do not generate output parser code (default=FALSE)"},
+ { "-gd", 0, pTGen, "Generate code to trace rule invocation (default=FALSE)"},
+ { "-ge", 0, pEGen, "Generate an error class for each non-terminal (default=FALSE)"},
+ { "-gh", 0, pGHdr, "Generate stdpccts.h for non-ANTLR-generated-files to include"},
+ { "-gk", 0, pDL, "Generate parsers that delay lookahead fetches until needed"},
+ { "-gl", 0, pLI, "Generate line info about grammar actions in C parser"},
+ { "-glms", 0, pLIms,"Like -gl but replace '\\' with '/' in #line filenames for MS C/C++ systems"},
+ { "-gp", 1, pPre, "Prefix all generated rule functions with a string"},
+ { "-gs", 0, pSGen, "Do not generate sets for token expression lists (default=FALSE)"},
+ { "-gt", 0, pAst, "Generate code for Abstract-Syntax-Trees (default=FALSE)"},
+ { "-gx", 0, pLGen, "Do not generate lexical (dlg-related) files (default=FALSE)"},
+ { "-gxt",0, pXTGen, "Do not generate tokens.h (default=FALSE)"},
+ { "-k", 1, pLLK, "Set full LL(k) lookahead depth (default==1)"},
+ { "-o", 1, pOut, OutputDirectoryOption},
+ { "-p", 0, pPrt, "Print out the grammar w/o actions (default=no)"},
+ { "-pa", 0, pPrtA, "Print out the grammar w/o actions & w/FIRST sets (default=no)"},
+ { "-pr",0, pPred, "no longer used; predicates employed if present"},
+ { "-prc", 1, pPredCtx,"Turn on/off computation of context for hoisted predicates"},
+ { "-rl", 1, pTRes, "Limit max # of tree nodes used by grammar analysis"},
+ { "-stdout",0, pStdout, "Send grammar.c/grammar.cpp to stdout"}, /* MR6 */
+ { "-tab", 1, pTab, "Width of tabs (1 to 8) for grammar.c/grammar.cpp files"}, /* MR6 */
+ { "-w1", 0, pW1, "Set the warning level to 1 (default)"},
+ { "-w2", 0, pW2, "Ambiguities yield warnings even if predicates or (...)? block"},
+ { "-mrhoist",1,pMRhoist, /* MR9 */
+ "Turn on/off k=1 Maintenance Release style hoisting"}, /* MR9 */
+ { "-mrhoistk",1,pMRhoistk, /* MR13 */
+ "Turn on/off k>1 EXPERIMENTAL Maintenance Release style hoisting"}, /* MR13 */
+ { "-aa" ,1,pAA, "Ambiguity aid for a rule (rule name or line number)"}, /* MR11 */
+ { "-aam" ,0,pAAm,
+ "Lookahead token may appear multiple times in -aa listing"}, /* MR11 */
+ { "-aad" ,1,pAAd,
+ "Limits exp growth of -aa listing - default=1 (max=ck value)"}, /* MR11 */
+ { "-info",1,pInfo,
+ "Extra info: p=pred t=tnodes f=first/follow m=monitor o=orphans 0=noop"}, /* MR11 */
+ { "-treport",1,pTreport,
+ "Report when tnode usage exceeds value during ambiguity resolution"}, /* MR11 */
+ { "-newAST", 0, pNewAST,
+ "In C++ mode use \"newAST(...)\" rather than \"new AST(...)\""}, /* MR13 */
+ { "-tmake", 0, ptmakeInParser,
+ "In C++ mode use parser's tmake method rather than \"ASTBase::tmake(...)\""}, /* MR23 */
+ { "-alpha",0, pAlpha,
+ "Provide additional information for \"(alpha)? beta\" error messages"}, /* MR14 */
+ { "-mrblkerr",0,pMR_BlkErr, /* MR21 */
+ "EXPERIMENTAL change to (...)* and (...)+ syntax error sets"}, /* MR21 */
+ { "-nopurify",0,pNOPURIFY,
+ "Don't use the notorious PURIFY macro (replaced by MR23 initial value syntax) to zero return arguments of rules"}, /* MR23 */
+ { "-", 0, pStdin, "Read grammar from stdin" },
+ { "*", 0, pFile, "" }, /* anything else is a file */
+#endif
+ { NULL, 0, NULL }
+ };
+
+void readDescr();
+void cleanUp();
+
+#ifdef __USE_PROTOS
+static void buildRulePtr( void );
+static void help( void );
+static void init( void );
+static void CompleteTokenSetRefs( void );
+static void ensure_no_C_file_collisions(char *);
+static void CompleteContextGuards(void);
+#else
+static void buildRulePtr( );
+static void help( );
+static void init( );
+static void CompleteTokenSetRefs( );
+static void ensure_no_C_file_collisions();
+static void CompleteContextGuards();
+#endif
+
+static void
+#ifdef __USE_PROTOS /* <BJS> */
+report_numericPredLabels(ActionNode *a)
+#else
+report_numericPredLabels(a)
+ActionNode *a;
+#endif
+{ /* MR10 */
+ warnFL("numeric references to attributes (e.g. $i or $i.j) in semantic pred will be null during guess mode", /* MR10 */
+ FileStr[a->file],a->line); /* MR10 */
+} /* MR10 */
+
+ /* M a i n */
+
+int
+#ifdef __USE_PROTOS
+main( int argc, char *argv[] )
+#else
+main( argc, argv )
+int argc;
+char *argv[];
+#endif
+{
+ int i;
+ static char EPSTR[] = "[Ep]";
+
+ Save_argc=argc; /* MR10 */
+ Save_argv=argv; /* MR10 */
+
+/* malloc_debug(8);*/
+
+#ifdef SPECIAL_INITS
+ special_inits(); /* MR1 */
+#endif
+ fprintf(stderr, "Antlr parser generator Version %s 1989-2001\n", Version);
+ if ( argc == 1 ) { help(); zzDIE; }
+ ProcessArgs(argc-1, &(argv[1]), options);
+
+/* MR14 */ if (MR_AmbAidRule && AlphaBetaTrace) {
+/* MR14 */ fatal("Can't specify both -aa (ambiguity aid) and -alpha (\"(alpha)? beta\" aid)");
+/* MR14 */ }
+
+ if (MRhoistingk) { /* MR13 */
+ HoistPredicateContext=1; /* MR13 */
+ MRhoisting=1; /* MR13 */
+ }; /* MR13 */
+ if (MRhoisting && ! HoistPredicateContext) {
+/*** warnNoFL("Using \"-mrhoist\" forces \"-prc on\""); ***/
+ HoistPredicateContext=1;
+ };
+ if (HoistPredicateContext && ! MRhoisting) {
+ warnNoFL("When using predicate context (-prc on) -mrhoist on is recommended");
+ }
+ /* Fix lookahead depth */
+ /* Compressed lookahead must always be larger than or equal to full lookahead */
+ if ( CLL_k < LL_k && CLL_k>0 )
+ {
+ warnNoFL("must have compressed lookahead >= full LL(k) lookahead (setting -ck to -k)");
+ CLL_k = LL_k;
+ }
+ if ( CLL_k == -1 ) CLL_k = LL_k;
+ OutputLL_k = CLL_k;
+ if ( ((CLL_k-1)&CLL_k)!=0 ) { /* output ll(k) must be power of 2 */
+ int n;
+ for(n=1; n<CLL_k; n<<=1) {;}
+ OutputLL_k = n;
+ };
+
+ if (MR_BlkErr) {
+ warnNoFL("The -mrblkerr option is EXPERIMENTAL");
+ if (LL_k > 1) {
+ warnNoFL("The -mrblkerr option is designed only for k=1 ck=1 grammars");
+ }
+ };
+
+ if ( ! ambAidDepthSpecified) {
+ MR_AmbAidDepth=1;
+ } else {
+ if (MR_AmbAidDepth > CLL_k || MR_AmbAidDepth <= 0) {
+ warnNoFL(eMsgd(
+ "Ambiguity aid depth (\"-aad ...\") must be a number between 1 and max(k,ck)=%d",CLL_k));
+ MR_AmbAidDepth=1;
+ };
+ if (MR_AmbAidDepth == 0) {
+ MR_AmbAidDepth=2;
+ };
+ };
+
+ if (MR_AmbAidRule != NULL) MR_AmbAidLine=atoi(MR_AmbAidRule);
+
+ fpTrans = &(C_Trans[0]); /* Translate to C Language */
+ fpJTrans = &(C_JTrans[0]);
+ init();
+ lexclass(LexStartSymbol);
+
+ readDescr();
+ LastTokenCounted = TokenNum;
+ RemapForcedTokens();
+ if ( CannotContinue ) {cleanUp(); zzDIE;}
+ if ( GenCC && no_classes_found ) fatal("required grammar class not found (exiting...)");
+ if ( WarningLevel>1 && HdrAction == NULL )
+ warnNoFL("no #header action was found");
+ if ( FoundAtOperator && ! FoundExceptionGroup) {
+ warnNoFL("found the exception operator '@' - but no exception group was found");
+ };
+ EpToken = addTname(EPSTR); /* add imaginary token epsilon */
+ set_orel(EpToken, &imag_tokens);
+
+ /* this won't work for hand-built scanners since EofToken is not
+ * known. Forces EOF to be token type 1.
+ */
+ set_orel(EofToken, &imag_tokens);
+
+ set_size(NumWords(TokenNum-1));
+
+ /* compute the set of all known token types
+ * It represents the set of tokens from 1 to last_token_num + the
+ * reserved positions above that (if any). Don't include the set of
+ * imaginary tokens such as the token/error classes or EOF.
+ */
+ {
+ set a;
+ a = set_dup(reserved_positions);
+ for (i=1; i<TokenNum; i++) { set_orel(i, &a); }
+ all_tokens = set_dif(a, imag_tokens);
+ set_free(a);
+ }
+
+ ComputeTokSets(); /* Compute #tokclass sets */
+ CompleteTokenSetRefs(); /* Change complex nodes in syn diag */
+ CompleteContextGuards(); /* MR13 */
+
+ if ( CodeGen ) genDefFile(); /* create tokens.h */
+ if ( LexGen ) genLexDescr(); /* create parser.dlg */
+
+ if ( GenStdPccts )
+ {
+ FILE *f = fopen(OutMetaName(stdpccts), "w");
+ if ( f==NULL ) {warnNoFL( eMsg1("can't create %s",OutMetaName(stdpccts)) );}
+ else
+ {
+#ifdef SPECIAL_FOPEN
+ special_fopen_actions(OutMetaName(stdpccts)); /* MR1 */
+#endif
+ if (strcmp(stdpccts,"stdpccts.h") == 0) { /* MR10 */
+ genStdPCCTSIncludeFile(f,NULL); /* MR10 */
+ } else { /* MR10 */
+ genStdPCCTSIncludeFile(f,pcctsBaseName(stdpccts)); /* MR32 */
+ };
+ fclose(f);
+ }
+ }
+
+ buildRulePtr(); /* create mapping from rule # to RuleBlk junction */
+ ComputeErrorSets();
+ FoLink( (Node *)SynDiag ); /* add follow links to end of all rules */
+
+ if ( GenCR ) GenCrossRef( SynDiag );
+
+ if ( CodeGen )
+ {
+ if ( SynDiag == NULL )
+ {
+ warnNoFL("no grammar description recognized");
+ cleanUp();
+ zzDIE;
+ }
+ else if ( !GenCC ) {
+ ErrFile = fopen(OutMetaName(ErrFileName), "w");
+ require(ErrFile != NULL, "main: can't open err file");
+#ifdef SPECIAL_FOPEN
+ special_fopen_actions(OutMetaName(ErrFileName)); /* MR1 */
+#endif
+ NewSetWd();
+ GenErrHdr();
+ TRANS(SynDiag); /* Translate to the target language */
+ DumpSetWd();
+ DumpRemainingTokSets();
+ fclose( ErrFile );
+ }
+ else {
+ strcpy(Parser_h_Name, CurrentClassName);
+ strcat(Parser_h_Name, ".h");
+ strcpy(Parser_c_Name, CurrentClassName);
+ strcat(Parser_c_Name, CPP_FILE_SUFFIX);
+ ensure_no_C_file_collisions(Parser_c_Name);
+ Parser_h = fopen(OutMetaName(Parser_h_Name), "w");
+ require(Parser_h != NULL, "main: can't open class Parserx.h file");
+#ifdef SPECIAL_FOPEN
+ special_fopen_actions(OutMetaName(Parser_h_Name)); /* MR1 */
+#endif
+ Parser_c = fopen(OutMetaName(Parser_c_Name), "w");
+ require(Parser_c != NULL, "main: can't open class Parserx.c file");
+#ifdef SPECIAL_FOPEN
+ special_fopen_actions(OutMetaName(Parser_c_Name)); /* MR1 */
+#endif
+ GenParser_h_Hdr();
+ if ( class_before_actions != NULL )
+ {
+ ListNode *p;
+ for (p = class_before_actions->next; p!=NULL; p=p->next)
+ {
+ UserAction *ua = (UserAction *)p->elem;
+ dumpAction( ua->action, Parser_h, 0, ua->file, ua->line, 1);
+ }
+ }
+ GenParser_c_Hdr();
+ fprintf(Parser_h, "protected:\n"); /* MR20 */
+ NewSetWd();
+ TRANS(SynDiag); /* Translate to the target language */
+ DumpSetWd();
+ GenRuleMemberDeclarationsForCC(Parser_h, SynDiag);
+ if ( class_after_actions != NULL )
+ {
+ ListNode *p;
+ for (p = class_after_actions->next; p!=NULL; p=p->next)
+ {
+ UserAction *ua = (UserAction *)p->elem;
+ dumpAction( ua->action, Parser_h, 0, ua->file, ua->line, 1);
+ }
+ }
+ DumpRemainingTokSets();
+ fprintf(Parser_h, "};\n");
+ fprintf(Parser_h, "\n#endif /* %s_h */\n", CurrentClassName);
+ fclose( Parser_h );
+ fclose( Parser_c );
+ }
+ }
+
+ MR_orphanRules(stderr);
+ if (LTinTokenAction && WarningLevel >= 2) {
+ if (GenCC) {
+ warnNoFL("At least one <<action>> following a token match contains a reference to LT(...)\n this will reference the immediately preceding token,\n not the one which follows as is the case with semantic predicates.");
+ }
+ warnNoFL("At least one <<action>> following a token match contains a reference to LA(...) or LATEXT(...)\n this will reference the immediately preceding token,\n not the one which follows as is the case with semantic predicates.");
+ }
+
+ if ( PrintOut )
+ {
+ if ( SynDiag == NULL ) {warnNoFL("no grammar description recognized");}
+ else PRINT(SynDiag);
+ }
+
+#ifdef DBG_LL1
+#endif
+ GenRemapFile(); /* create remap.h */
+/* MR10 */ if (FoundGuessBlk) {
+#ifdef __cplusplus__
+/* MR10 */ list_apply(NumericPredLabels, (void (*)(void *))report_numericPredLabels);
+#else
+#ifdef __USE_PROTOS
+/* MR10 */ list_apply(NumericPredLabels, (void (*)(void *))report_numericPredLabels);
+#else
+/* MR10 */ list_apply(NumericPredLabels,report_numericPredLabels);
+#endif
+#endif
+/* MR10 */ };
+
+ if (InfoT && TnodesAllocated > 0) {
+ if (TnodesPeak > 10000) {
+ fprintf(stdout,"\nTree Nodes: peak %dk created %dk lost %d\n",
+ (TnodesPeak/1000),
+ (TnodesAllocated/1000),
+ TnodesInUse-tnodes_used_in_guard_predicates_etc);
+ } else {
+ fprintf(stdout,"\nTree Nodes: peak %d created %d lost %d\n",
+ TnodesPeak,
+ TnodesAllocated,
+ TnodesInUse-tnodes_used_in_guard_predicates_etc);
+ };
+ };
+ if (InfoF) {
+ DumpFcache();
+ };
+ if (MR_skipped_e3_report) {
+ fprintf(stderr,"note: use -e3 to get exact information on ambiguous tuples\n");
+ };
+ if (MR_BadExprSets != 0) {
+ fprintf(stderr,"note: Unreachable C or C++ code was generated for empty expression sets,\n");
+ fprintf(stderr," probably due to undefined rules or infinite left recursion.\n");
+ fprintf(stderr," To locate: search the generated code for \"empty set expression\"\n");
+ };
+ if (MR_AmbAidRule != NULL && MR_matched_AmbAidRule==0) {
+ RuleEntry *q = (RuleEntry *) hash_get(Rname,MR_AmbAidRule);
+ if (MR_AmbAidLine == 0 && q == NULL) {
+ warnNoFL(eMsg2("there is no rule \"%s\" so \"-aa %s\" will never match",
+ MR_AmbAidRule,MR_AmbAidRule));
+ } else {
+ warnNoFL(eMsg1("there was no ambiguity that matched \"-aa %s\"",MR_AmbAidRule));
+ };
+ };
+ if (AlphaBetaTrace) {
+
+ if (MR_AlphaBetaMessageCount == 0) {
+ fprintf(stderr,"note: there were no messages about \"(alpha)? beta\" blocks added to the generated code\n");
+ } else {
+ fprintf(stderr,"note: there were %d messages about \"(alpha)? beta\" blocks added to the generated code\n",
+ MR_AlphaBetaMessageCount);
+ }
+
+ if (set_null(MR_CompromisedRules)) {
+ fprintf(stderr,"note: the list of rules with compromised follow sets is empty\n");
+ } else {
+ fprintf(stderr,"note: the following is a list of rules which *may* have incorrect\n");
+ fprintf(stderr," follow sets computed as a result of an \"(alpha)? beta\" block\n");
+ fprintf(stderr,"\n");
+ MR_dumpRuleSet(MR_CompromisedRules);
+ fprintf(stderr,"\n");
+ }
+ }
+ cleanUp();
+ exit(PCCTS_EXIT_SUCCESS);
+ return 0; /* MR11 make compilers happy */
+}
+
+static void
+#ifdef __USE_PROTOS
+init( void )
+#else
+init( )
+#endif
+{
+ SignalEntry *q;
+
+ Tname = newHashTable();
+ Rname = newHashTable();
+ Fcache = newHashTable();
+ Tcache = newHashTable();
+ Sname = newHashTable();
+ Pname = newHashTable(); /* MR11 */
+
+ /* Add default signal names */
+ q = (SignalEntry *)hash_add(Sname,
+ "NoViableAlt",
+ (Entry *)newSignalEntry("NoViableAlt"));
+ require(q!=NULL, "cannot alloc signal entry");
+ q->signum = sigNoViableAlt;
+ q = (SignalEntry *)hash_add(Sname,
+ "MismatchedToken",
+ (Entry *)newSignalEntry("MismatchedToken"));
+ require(q!=NULL, "cannot alloc signal entry");
+ q->signum = sigMismatchedToken;
+ q = (SignalEntry *)hash_add(Sname,
+ "NoSemViableAlt",
+ (Entry *)newSignalEntry("NoSemViableAlt"));
+ require(q!=NULL, "cannot alloc signal entry");
+ q->signum = sigNoSemViableAlt;
+
+ reserved_positions = empty;
+ all_tokens = empty;
+ imag_tokens = empty;
+ tokclasses = empty;
+ TokenStr = (char **) calloc(TSChunk, sizeof(char *));
+ require(TokenStr!=NULL, "main: cannot allocate TokenStr");
+ FoStack = (int **) calloc(CLL_k+1, sizeof(int *));
+ require(FoStack!=NULL, "main: cannot allocate FoStack");
+ FoTOS = (int **) calloc(CLL_k+1, sizeof(int *));
+ require(FoTOS!=NULL, "main: cannot allocate FoTOS");
+ Cycles = (ListNode **) calloc(CLL_k+1, sizeof(ListNode *));
+ require(Cycles!=NULL, "main: cannot allocate Cycles List");
+ MR_CompromisedRules=empty; /* MR14 */
+}
+
+static void
+#ifdef __USE_PROTOS
+help( void )
+#else
+help( )
+#endif
+{
+ Opt *p = options;
+ fprintf(stderr, "antlr [options] f1 f2 ... fn\n");
+ while ( *(p->option) != '*' )
+ {
+ fprintf(stderr, " %-9s%s %s\n",
+ p->option,
+ (p->arg)?"___":" ",
+ p->descr);
+ p++;
+ }
+}
+
+/* The RulePtr array is filled in here. RulePtr exists primarily
+ * so that sets of rules can be maintained for the FOLLOW caching
+ * mechanism found in rJunc(). RulePtr maps a rule num from 1 to n
+ * to a pointer to its RuleBlk junction where n is the number of rules.
+ */
+static void
+#ifdef __USE_PROTOS
+buildRulePtr( void )
+#else
+buildRulePtr( )
+#endif
+{
+ int r=1;
+ Junction *p = SynDiag;
+ RulePtr = (Junction **) calloc(NumRules+1, sizeof(Junction *));
+ require(RulePtr!=NULL, "cannot allocate RulePtr array");
+
+ while ( p!=NULL )
+ {
+ require(r<=NumRules, "too many rules???");
+ RulePtr[r++] = p;
+ p = (Junction *)p->p2;
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+dlgerror(const char *s)
+#else
+dlgerror(s)
+char *s;
+#endif
+{
+ fprintf(stderr, ErrHdr, FileStr[CurFile], zzline);
+ fprintf(stderr, " lexical error: %s (text was '%s')\n",
+ ((s == NULL) ? "Lexical error" : s), zzlextext);
+}
+
+void
+#ifdef __USE_PROTOS
+readDescr( void )
+#else
+readDescr( )
+#endif
+{
+ zzerr = dlgerror;
+ input = NextFile();
+ if ( input==NULL ) fatal("No grammar description found (exiting...)");
+ ANTLR(grammar(), input);
+ tnodes_used_in_guard_predicates_etc=TnodesInUse; /* MR10 */
+}
+
+FILE *
+#ifdef __USE_PROTOS
+NextFile( void )
+#else
+NextFile( )
+#endif
+{
+ FILE *f;
+
+ for (;;)
+ {
+ CurFile++;
+ if ( CurFile >= NumFiles ) return(NULL);
+ if ( ci_strequ(FileStr[CurFile],"stdin")) return stdin;
+ f = fopen(FileStr[CurFile], "r");
+ if ( f == NULL )
+ {
+ warnNoFL( eMsg1("file %s doesn't exist; ignored", FileStr[CurFile]) );
+ }
+ else
+ {
+ return(f);
+ }
+ }
+}
+
+/*
+ * Return a string corresponding to the output file name associated
+ * with the input file name passed in.
+ *
+ * Observe the following rules:
+ *
+ * f.e --> f".c"
+ * f --> f".c"
+ * f. --> f".c"
+ * f.e.g --> f.e".c"
+ *
+ * Where f,e,g are arbitrarily long sequences of characters in a file
+ * name.
+ *
+ * In other words, if a ".x" appears on the end of a file name, make it
+ * ".c". If no ".x" appears, append ".c" to the end of the file name.
+ *
+ * C++ mode using .cpp not .c.
+ *
+ * Use malloc() for new string.
+ */
+
+char *
+#ifdef __USE_PROTOS
+outname( char *fs )
+#else
+outname( fs )
+char *fs;
+#endif
+{
+ if ( GenCC) {
+ return outnameX(fs,CPP_FILE_SUFFIX);
+ } else {
+ return outnameX(fs,".c");
+ };
+}
+
+char *
+#ifdef __USE_PROTOS
+outnameX( char *fs ,char *suffix)
+#else
+outnameX( fs , suffix )
+char *fs;
+char *suffix;
+#endif
+{
+ static char buf[MaxFileName+1];
+ char *p;
+ require(fs!=NULL&&*fs!='\0', "outname: NULL filename");
+
+ p = buf;
+ strcpy(buf, fs);
+ while ( *p != '\0' ) {p++;} /* Stop on '\0' */
+ while ( *p != '.' && p != buf ) {--p;} /* Find '.' */
+ if ( p != buf ) *p = '\0'; /* Found '.' */
+ require(strlen(buf) + 2 < (size_t)MaxFileName, "outname: filename too big");
+ strcat(buf,suffix);
+ return( buf );
+}
+
+void
+#ifdef __USE_PROTOS
+fatalFL( char *err_, char *f, int l )
+#else
+fatalFL( err_, f, l )
+char *err_;
+char *f;
+int l;
+#endif
+{
+ fprintf(stderr, ErrHdr, f, l);
+ fprintf(stderr, " %s\n", err_);
+ cleanUp();
+ exit(PCCTS_EXIT_FAILURE);
+}
+
+void
+#ifdef __USE_PROTOS
+fatal_intern( char *err_, char *f, int l )
+#else
+fatal_intern( err_, f, l )
+char *err_;
+char *f;
+int l;
+#endif
+{
+ fprintf(stderr, ErrHdr, f, l);
+ fprintf(stderr, " #$%%*&@# internal error: %s\n", err_);
+ fprintf(stderr, ErrHdr, f, l);
+ fprintf(stderr, " [complain to nearest government official\n");
+ fprintf(stderr, ErrHdr, f, l);
+ fprintf(stderr, " or send hate-mail to parrt@parr-research.com;\n");
+ fprintf(stderr, ErrHdr, f, l);
+ fprintf(stderr, " please pray to the ``bug'' gods that there is a trival fix.]\n");
+ cleanUp();
+ exit(PCCTS_EXIT_FAILURE);
+}
+
+void
+#ifdef __USE_PROTOS
+cleanUp( void )
+#else
+cleanUp( )
+#endif
+{
+ if ( DefFile != NULL) fclose( DefFile );
+}
+
+/* sprintf up to 3 strings */
+char *
+#ifdef __USE_PROTOS
+eMsg3( char *s, char *a1, char *a2, char *a3 )
+#else
+eMsg3( s, a1, a2, a3 )
+char *s;
+char *a1;
+char *a2;
+char *a3;
+#endif
+{
+ static char buf[250]; /* DANGEROUS as hell !!!!!! */
+
+ sprintf(buf, s, a1, a2, a3);
+ return( buf );
+}
+
+/* sprintf a decimal */
+char *
+#ifdef __USE_PROTOS
+eMsgd( char *s, int d )
+#else
+eMsgd( s, d )
+char *s;
+int d;
+#endif
+{
+ static char buf[250]; /* DANGEROUS as hell !!!!!! */
+
+ sprintf(buf, s, d);
+ return( buf );
+}
+
+char *
+#ifdef __USE_PROTOS
+eMsgd2( char *s, int d1,int d2)
+#else
+eMsgd2( s, d1, d2 )
+char *s;
+int d1;
+int d2;
+#endif
+{
+ static char buf[250]; /* DANGEROUS as hell !!!!!! */
+
+ sprintf(buf, s, d1, d2);
+ return( buf );
+}
+
+void
+#ifdef __USE_PROTOS
+s_fprT( FILE *f, set e )
+#else
+s_fprT( f, e )
+FILE *f;
+set e;
+#endif
+{
+ register unsigned *p;
+ unsigned *q;
+
+ if ( set_nil(e) ) return;
+ if ( (q=p=set_pdq(e)) == NULL ) fatal_internal("Can't alloc space for set_pdq");
+ fprintf(f, "{");
+ while ( *p != nil )
+ {
+ fprintf(f, " %s", TerminalString(*p));
+ p++;
+ }
+ fprintf(f, " }");
+ free((char *)q);
+}
+
+/* Return the token name or regular expression for a token number. */
+char *
+#ifdef __USE_PROTOS
+TerminalString( int token )
+#else
+TerminalString( token )
+int token;
+#endif
+{
+ int j;
+ static char imag_name[20];
+
+ /* look in all lexclasses for the token */
+ if ( TokenString(token) != NULL ) return TokenString(token);
+ for (j=0; j<NumLexClasses; j++)
+ {
+ lexmode(j);
+ if ( ExprString(token) != NULL ) return ExprString(token);
+ }
+
+ if (1) {
+ sprintf(imag_name,"UnknownToken#%d",token); /* MR13 */
+ return imag_name; /* MR13 */
+ }
+
+ require(j<NumLexClasses, eMsgd("No label or expr for token %d",token));
+ return "invalid";
+}
+
+ /* S i m p l e I n t S t a c k */
+
+void
+#ifdef __USE_PROTOS
+pushint( int i )
+#else
+pushint( i )
+int i;
+#endif
+{
+ require(isp>0, "pushint: stack overflow");
+ istack[--isp] = i;
+}
+
+int
+#ifdef __USE_PROTOS
+popint( void )
+#else
+popint( )
+#endif
+{
+ require(isp<MAX_INT_STACK, "popint: stack underflow");
+ return istack[isp++];
+}
+
+int
+#ifdef __USE_PROTOS
+istacksize( void )
+#else
+istacksize( )
+#endif
+{
+ return MAX_INT_STACK-isp;
+}
+
+void
+#ifdef __USE_PROTOS
+istackreset( void )
+#else
+istackreset( )
+#endif
+{
+ isp = MAX_INT_STACK;
+}
+
+int
+#ifdef __USE_PROTOS
+istackempty( void )
+#else
+istackempty( )
+#endif
+{
+ return isp==MAX_INT_STACK;
+}
+
+int
+#ifdef __USE_PROTOS
+topint( void )
+#else
+topint( )
+#endif
+{
+ require(isp<MAX_INT_STACK, "topint: stack underflow");
+ return istack[isp];
+}
+
+void
+#ifdef __USE_PROTOS
+ProcessArgs( int argc, char **argv, Opt *options )
+#else
+ProcessArgs( argc, argv, options )
+int argc;
+char **argv;
+Opt *options;
+#endif
+{
+ Opt *p;
+ require(argv!=NULL, "ProcessArgs: command line NULL");
+
+ while ( argc-- > 0 )
+ {
+ p = options;
+ while ( p->option != NULL )
+ {
+ if ( strcmp(p->option, "*") == 0 ||
+ ci_strequ(p->option, *argv) == 1 )
+ {
+ if ( p->arg )
+ {
+/* MR9 26-Sep-97 Check for argv valid */
+ if (argc-- > 0) {
+ (*p->process)( *argv, *(argv+1) );
+ argv++;
+ } else {
+fprintf(stderr,"error: required argument for option %s omitted\n",*argv);
+exit(PCCTS_EXIT_FAILURE);
+ };
+ }
+ else
+ (*p->process)( *argv );
+ break;
+ }
+ p++;
+ }
+ argv++;
+ }
+}
+
+static void
+#ifdef __USE_PROTOS
+CompleteContextGuards(void)
+#else
+CompleteContextGuards()
+#endif
+{
+ ListNode * p;
+ Predicate * pred;
+
+ if (ContextGuardPredicateList == NULL) return;
+
+ for (p=ContextGuardPredicateList->next; p != NULL; p=p->next) {
+ pred=(Predicate *)p->elem;
+ recomputeContextGuard(pred);
+ }
+}
+
+/* Go back into the syntax diagram and compute all meta tokens; i.e.
+ * turn all '.', ranges, token class refs etc... into actual token sets
+ */
+static void
+#ifdef __USE_PROTOS
+CompleteTokenSetRefs(void)
+#else
+CompleteTokenSetRefs()
+#endif
+{
+ ListNode *p;
+
+ if ( MetaTokenNodes==NULL ) return;
+ for (p = MetaTokenNodes->next; p!=NULL; p=p->next)
+ {
+ set a,b;
+
+ TokNode *q = (TokNode *)p->elem;
+ if ( q->wild_card )
+ {
+ q->tset = all_tokens;
+ }
+ else if ( q->tclass!=NULL )
+ {
+ if ( q->complement ) q->tset = set_dif(all_tokens, q->tclass->tset);
+ else q->tset = q->tclass->tset;
+ }
+ else if ( q->upper_range!=0 )
+ {
+ /* we have a range on our hands: make a set from q->token .. q->upper_range */
+ int i;
+ a = empty;
+ for (i=q->token; i<=q->upper_range; i++) { set_orel(i, &a); } /* MR13 */
+
+/* MR13 */ if (q->complement) {
+/* MR13 */ q->tset = set_dif(all_tokens, a);
+/* MR13 */ set_free(a);
+/* MR13 */ } else {
+/* MR13 */ q->tset = a;
+/* MR13 */ }
+
+ }
+
+ /* at this point, it can only be a complemented single token */
+ else if ( q->complement )
+ {
+ a = set_of(q->token);
+ b = set_dif(all_tokens, a);
+ set_free(a);
+ q->tset=b;
+ }
+ else fatal("invalid meta token");
+ }
+}
+
+/* MR10: Jeff Vincent
+ MR10: Changed to remove directory information from n only if
+ MR10: if OutputDirectory was changed by user (-o option)
+*/
+
+char *
+#ifdef __USE_PROTOS
+OutMetaName(char *n)
+#else
+OutMetaName(n)
+char *n;
+#endif
+{
+ static char *dir_sym = DirectorySymbol;
+ static char newname[MaxFileName+1];
+ char *p;
+
+ /* If OutputDirectory is same as TopDirectory (platform default) then leave n alone. */
+ if (strcmp(OutputDirectory, TopDirectory) == 0) /* TopDirectory is "." on Unix. */
+ return n;
+
+ /* p will point to filename without path information */
+ if ((p = strrchr(n, *dir_sym)) != NULL) /* Directory symbol is "/" on Unix. */
+ p++;
+ else
+ p = n;
+
+ /* Copy new output directory into newname[] */
+ strcpy(newname, OutputDirectory);
+
+ /* if new output directory does not have trailing dir_sym, add it! */
+ if (newname[strlen(newname)-1] != *dir_sym) {
+ strcat(newname, dir_sym);
+ }
+ strcat(newname, p);
+ return newname;
+}
+
+char *
+#ifdef __USE_PROTOS
+pcctsBaseName(char *n) /* MR32 */
+#else
+pcctsBaseName(n)
+char *n;
+#endif
+{
+ static char newname[MaxFileName+1];
+ static char* dir_sym = DirectorySymbol;
+ int count = 0;
+ char *p;
+
+ p = n;
+
+ while ( *p != '\0' ) {p++;} /* go to end of string */
+ while ( (*p != *dir_sym) && (p != n) ) {--p;} /* Find last DirectorySymbol */
+ while ( *p == *dir_sym) p++; /* step forward if we're on a dir symbol */
+ while ( *p != '\0' && *p != '.')
+ {
+ newname[count++] = *p;
+ p++;
+ } /* create a new name */
+ newname[count] = '\0';
+ return newname;
+}
+
+static void
+#ifdef __USE_PROTOS
+ensure_no_C_file_collisions(char *class_c_file)
+#else
+ensure_no_C_file_collisions(class_c_file)
+char *class_c_file;
+#endif
+{
+ int i;
+
+ for (i=0; i<NumFiles; i++)
+ {
+
+#ifdef PCCTS_CASE_INSENSITIVE_FILE_NAME
+ /* assume that file names are case insensitive */
+ if ( STRICMP(outname(FileStr[i]), class_c_file)==0 )
+#else
+ if ( strcmp(outname(FileStr[i]), class_c_file)==0 )
+#endif
+ {
+ fatal(eMsg1("class def output file conflicts with parser output file: %s",
+ outname(FileStr[i])));
+ }
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+warnNoFL(char *err)
+#else
+warnNoFL(err)
+char *err;
+#endif
+{
+ fprintf(stderr, "warning: %s\n", err);
+}
+
+void
+#ifdef __USE_PROTOS
+warnFL(char *err,char *f,int l)
+#else
+warnFL(err,f,l)
+char *f;
+int l;
+char *err;
+#endif
+{
+ fprintf(stderr, ErrHdr, f, l);
+ fprintf(stderr, " warning: %s\n", err);
+}
+
+void
+#ifdef __USE_PROTOS
+warn(char *err)
+#else
+warn(err)
+char *err;
+#endif
+{
+ /* back up the file number if we hit an error at the end of the last file */
+ if ( CurFile >= NumFiles && CurFile >= 1 ) CurFile--;
+ fprintf(stderr, ErrHdr, FileStr[CurFile], zzline);
+ fprintf(stderr, " warning: %s\n", err);
+}
+
+void
+#ifdef __USE_PROTOS
+warnNoCR( char *err )
+#else
+warnNoCR( err )
+char *err;
+#endif
+{
+ /* back up the file number if we hit an error at the end of the last file */
+ if ( CurFile >= NumFiles && CurFile >= 1 ) CurFile--;
+ fprintf(stderr, ErrHdr, FileStr[CurFile], zzline);
+ fprintf(stderr, " warning: %s", err);
+}
+
+void
+#ifdef __USE_PROTOS
+errNoFL(char *err)
+#else
+errNoFL(err)
+char *err;
+#endif
+{
+ fprintf(stderr, "error: %s\n", err);
+}
+
+void
+#ifdef __USE_PROTOS
+errFL(char *err,char *f,int l)
+#else
+errFL(err,f,l)
+char *err;
+char *f;
+int l;
+#endif
+{
+ fprintf(stderr, ErrHdr, f, l);
+ fprintf(stderr, " error: %s\n", err);
+}
+
+void
+#ifdef __USE_PROTOS
+err(char *err)
+#else
+err(err)
+char *err;
+#endif
+{
+ /* back up the file number if we hit an error at the end of the last file */
+ if ( CurFile >= NumFiles && CurFile >= 1 ) CurFile--;
+ fprintf(stderr, ErrHdr, FileStr[CurFile], zzline);
+ fprintf(stderr, " error: %s\n", err);
+}
+
+void
+#ifdef __USE_PROTOS
+errNoCR( char *err )
+#else
+errNoCR( err )
+char *err;
+#endif
+{
+ /* back up the file number if we hit an error at the end of the last file */
+ if ( CurFile >= NumFiles && CurFile >= 1 ) CurFile--;
+ fprintf(stderr, ErrHdr, FileStr[CurFile], zzline);
+ fprintf(stderr, " error: %s", err);
+}
+
+UserAction *
+#ifdef __USE_PROTOS
+newUserAction(char *s)
+#else
+newUserAction(s)
+char *s;
+#endif
+{
+ UserAction *ua = (UserAction *) calloc(1, sizeof(UserAction));
+ require(ua!=NULL, "cannot allocate UserAction");
+
+ ua->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ strcpy(ua->action, s);
+ return ua;
+}
+
+/* Added by TJP September 1994 */
+/* Take in file.h and return file_h; names w/o '.'s are left alone */
+char *
+#ifdef __USE_PROTOS
+gate_symbol(char *name)
+#else
+gate_symbol(name)
+char *name;
+#endif
+{
+ static char buf[100];
+ char *p;
+ sprintf(buf, "%s", name);
+
+ for (p=buf; *p!='\0'; p++)
+ {
+ if ( *p=='.' ) *p = '_';
+ }
+ return buf;
+}
+
+char *
+#ifdef __USE_PROTOS
+makeAltID(int blockid, int altnum)
+#else
+makeAltID(blockid, altnum)
+int blockid;
+int altnum;
+#endif
+{
+ static char buf[100];
+ char *p;
+ sprintf(buf, "_blk%d_alt%d", blockid, altnum);
+ p = (char *)malloc(strlen(buf)+1);
+ strcpy(p, buf);
+ return p;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile
new file mode 100644
index 000000000..559b1c99f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile
@@ -0,0 +1,225 @@
+#
+# Makefile for ANTLR 1.33
+#
+# SOFTWARE RIGHTS
+#
+# We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+# Set (PCCTS) -- PCCTS is in the public domain. An individual or
+# company may do whatever they wish with source code distributed with
+# PCCTS or the code generated by PCCTS, including the incorporation of
+# PCCTS, or its output, into commerical software.
+#
+# We encourage users to develop software with PCCTS. However, we do ask
+# that credit is given to us for developing PCCTS. By "credit",
+# we mean that if you incorporate our source code into one of your
+# programs (commercial product, research project, or otherwise) that you
+# acknowledge this fact somewhere in the documentation, research report,
+# etc... If you like PCCTS and have developed a nice tool with the
+# output, please mention that you developed it using PCCTS. In
+# addition, we ask that this header remain intact in our source code.
+# As long as these guidelines are kept, we expect to continue enhancing
+# this system and expect to make other tools available as they are
+# completed.
+#
+# ANTLR 1.33
+# Terence Parr
+# Parr Research Corporation
+# with Purdue University
+# and AHPCRC, University of Minnesota
+# 1989-1995
+#
+# Ported to Borland C++, IBM C-Set/2 and Microsoft 6.0 by
+# Ed Harfmann
+# Micro Data Base Systems
+# Lafayette, Indiana
+#
+SET=../support/set
+PCCTS_H=../h
+
+##
+## Uncomment the appropriate section to build
+## (both targets and 'make' variable definitions)
+## Note that UNIX is the default
+##
+
+#
+# OS/2 & DOS 16 bit using MSC 6.0
+#
+#CC=cl
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /AL /Za /W3 -DPC -DUSER_ZZSYN
+#OUT_OBJ = -Fo
+#LIBS=/NOD:LLIBCE LLIBCEP
+#OBJ_EXT = obj
+#
+#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
+# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
+# misc.obj set.obj pred.obj egamn.obj
+# link @<<
+#$** /NOI
+#$@ /STACK:14336
+#
+#$(LIBS: = +^
+#)
+#$(DEF_FILE) $(LFLAGS) ;
+#<<
+# bind $@ c:\os2\doscalls.lib
+# copy *.exe ..\bin
+#
+
+#
+# Borland C++ for DOS
+#
+#CC=bcc
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -ml -ff- -w- -DPC -DUSER_ZZSYN
+#OUT_OBJ = -o
+#LIBS= emu mathl cl
+#OBJ_EXT = obj
+#
+#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
+# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
+# misc.obj set.obj pred.obj egman.obj mrhoist.obj fcache.obj
+# tlink @&&|
+#C0L $**
+#$@ /Tde /c
+#
+#$(LIBS)
+#$(DEF_FILE) $(LFLAGS) ;
+#|
+# copy *.exe ..\bin
+#
+
+#
+# C-Set/2 for OS/2
+#
+#CC=icc
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /Sa /W3 -DUSER_ZZSYN -D__STDC__
+#OUT_OBJ = -Fo
+#LIBS=
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#OBJ_EXT = obj
+#
+#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
+# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
+# misc.obj set.obj pred.obj egman.obj mrhoist.obj fcache.obj
+# link386 @<<
+#$** /NOI
+#$@ /STACK:32768
+#
+#$(LIBS: = +^
+#)
+#$(DEF_FILE) $(LFLAGS) ;
+#<<
+# copy *.exe ..\bin
+#
+
+#
+# Borland C++ for OS/2
+#
+#CC=bcc
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -w- -v -DUSER_ZZSYN
+#OUT_OBJ = -o
+#LIBS= c2 os2
+#
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#OBJ_EXT = obj
+#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
+# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
+# misc.obj set.obj pred.obj egman.obj mrhoist.obj fcache.obj
+# tlink @&&|
+#c02 $** -c -v
+#antlr.exe
+#
+#C2 os2
+#
+#|
+# copy *.exe ..\bin
+#
+
+# *********** Target list of PC machines ***********
+#
+# Don't worry about the ambiguity messages coming from antlr
+# for making antlr.c etc... [should be 10 of them, I think]
+#
+#antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
+# $(ANTLR) antlr.g
+#
+#antlr.$(OBJ_EXT): antlr.c mode.h tokens.h
+#
+#scan.$(OBJ_EXT): scan.c mode.h tokens.h
+#
+#scan.c mode.h: parser.dlg
+# $(DLG) -C2 parser.dlg scan.c
+#
+#set.$(OBJ_EXT): $(SET)/set.c
+# $(BUILD_CC) $(BUILD_CFLAGS) -c $(OUT_OBJ)set.$(OBJ_EXT) $(SET)/set.c
+
+
+
+#
+# UNIX (default)
+#
+ifeq ($(CXX), llvm)
+BUILD_CC?=$(CLANG_BIN)clang
+else
+BUILD_CC?=gcc
+endif
+COPT=-O
+ANTLR=${BIN_DIR}/antlr
+DLG=${BIN_DIR}/dlg
+OBJ_EXT=o
+OUT_OBJ = -o
+BUILD_CFLAGS= $(COPT) -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN $(COTHER) -DZZLEXBUFSIZE=65536
+BUILD_CPPFLAGS=
+#
+# SGI Users, use this CFLAGS
+#
+#CFLAGS= -O -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN -woff 3262
+OBJ=antlr.o scan.o err.o bits.o build.o fset2.o fset.o gen.o \
+ globals.o hash.o lex.o main.o misc.o set.o pred.o egman.o mrhoist.o fcache.o
+
+$(BIN_DIR)/antlr : $(OBJ) $(SRC)
+ $(BUILD_CC) $(BUILD_CFLAGS) -o $(BIN_DIR)/antlr $(OBJ)
+
+# what files does PCCTS generate (both ANTLR and DLG)
+PCCTS_GEN=antlr.c scan.c err.c tokens.h mode.h parser.dlg stdpccts.h remap.h
+
+SRC=antlr.c scan.c err.c bits.c build.c fset2.c fset.c gen.c globals.c \
+ hash.c lex.c main.c misc.c $(SET)/set.c pred.c egman.c mrhoist.c fcache.c
+
+#
+# Don't worry about the ambiguity messages coming from antlr
+# for making antlr.c etc... [should be 10 of them, I think]
+#
+#antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
+# $(ANTLR) -gh antlr.g
+
+antlr.o : antlr.c mode.h tokens.h
+
+scan.o : scan.c mode.h tokens.h
+
+#scan.c mode.h: parser.dlg
+# $(DLG) -C2 parser.dlg scan.c
+
+set.o : $(SET)/set.c
+ $(BUILD_CC) $(BUILD_CFLAGS) -c -o set.o $(SET)/set.c
+
+%.o : %.c
+ $(BUILD_CC) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
+
+#
+# ****** These next targets are common to UNIX and PC world ********
+#
+
+#clean up all the intermediate files
+clean:
+ rm -f $(BIN_DIR)/antlr *.$(OBJ_EXT) core
+
+#remove everything in clean plus the PCCTS files generated
+scrub:
+ rm -f $(PCCTS_GEN) *.$(OBJ_EXT) core
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile.cygwin b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile.cygwin
new file mode 100644
index 000000000..956de0be0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile.cygwin
@@ -0,0 +1,219 @@
+#
+# Makefile for ANTLR 1.33
+#
+# SOFTWARE RIGHTS
+#
+# We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+# Set (PCCTS) -- PCCTS is in the public domain. An individual or
+# company may do whatever they wish with source code distributed with
+# PCCTS or the code generated by PCCTS, including the incorporation of
+# PCCTS, or its output, into commerical software.
+#
+# We encourage users to develop software with PCCTS. However, we do ask
+# that credit is given to us for developing PCCTS. By "credit",
+# we mean that if you incorporate our source code into one of your
+# programs (commercial product, research project, or otherwise) that you
+# acknowledge this fact somewhere in the documentation, research report,
+# etc... If you like PCCTS and have developed a nice tool with the
+# output, please mention that you developed it using PCCTS. In
+# addition, we ask that this header remain intact in our source code.
+# As long as these guidelines are kept, we expect to continue enhancing
+# this system and expect to make other tools available as they are
+# completed.
+#
+# ANTLR 1.33
+# Terence Parr
+# Parr Research Corporation
+# with Purdue University
+# and AHPCRC, University of Minnesota
+# 1989-1995
+#
+# Ported to Borland C++, IBM C-Set/2 and Microsoft 6.0 by
+# Ed Harfmann
+# Micro Data Base Systems
+# Lafayette, Indiana
+#
+SET=../support/set
+PCCTS_H=../h
+
+##
+## Uncomment the appropriate section to build
+## (both targets and 'make' variable definitions)
+## Note that UNIX is the default
+##
+
+#
+# OS/2 & DOS 16 bit using MSC 6.0
+#
+#CC=cl
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /AL /Za /W3 -DPC -DUSER_ZZSYN
+#OUT_OBJ = -Fo
+#LIBS=/NOD:LLIBCE LLIBCEP
+#OBJ_EXT = obj
+#
+#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
+# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
+# misc.obj set.obj pred.obj egamn.obj
+# link @<<
+#$** /NOI
+#$@ /STACK:14336
+#
+#$(LIBS: = +^
+#)
+#$(DEF_FILE) $(LFLAGS) ;
+#<<
+# bind $@ c:\os2\doscalls.lib
+# copy *.exe ..\bin
+#
+
+#
+# Borland C++ for DOS
+#
+#CC=bcc
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -ml -ff- -w- -DPC -DUSER_ZZSYN
+#OUT_OBJ = -o
+#LIBS= emu mathl cl
+#OBJ_EXT = obj
+#
+#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
+# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
+# misc.obj set.obj pred.obj egman.obj mrhoist.obj fcache.obj
+# tlink @&&|
+#C0L $**
+#$@ /Tde /c
+#
+#$(LIBS)
+#$(DEF_FILE) $(LFLAGS) ;
+#|
+# copy *.exe ..\bin
+#
+
+#
+# C-Set/2 for OS/2
+#
+#CC=icc
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /Sa /W3 -DUSER_ZZSYN -D__STDC__
+#OUT_OBJ = -Fo
+#LIBS=
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#OBJ_EXT = obj
+#
+#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
+# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
+# misc.obj set.obj pred.obj egman.obj mrhoist.obj fcache.obj
+# link386 @<<
+#$** /NOI
+#$@ /STACK:32768
+#
+#$(LIBS: = +^
+#)
+#$(DEF_FILE) $(LFLAGS) ;
+#<<
+# copy *.exe ..\bin
+#
+
+#
+# Borland C++ for OS/2
+#
+#CC=bcc
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -w- -v -DUSER_ZZSYN
+#OUT_OBJ = -o
+#LIBS= c2 os2
+#
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#OBJ_EXT = obj
+#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
+# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
+# misc.obj set.obj pred.obj egman.obj mrhoist.obj fcache.obj
+# tlink @&&|
+#c02 $** -c -v
+#antlr.exe
+#
+#C2 os2
+#
+#|
+# copy *.exe ..\bin
+#
+
+# *********** Target list of PC machines ***********
+#
+# Don't worry about the ambiguity messages coming from antlr
+# for making antlr.c etc... [should be 10 of them, I think]
+#
+#antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
+# $(ANTLR) antlr.g
+#
+#antlr.$(OBJ_EXT): antlr.c mode.h tokens.h
+#
+#scan.$(OBJ_EXT): scan.c mode.h tokens.h
+#
+#scan.c mode.h: parser.dlg
+# $(DLG) -C2 parser.dlg scan.c
+#
+#set.$(OBJ_EXT): $(SET)/set.c
+# $(CC) $(CFLAGS) -c $(OUT_OBJ)set.$(OBJ_EXT) $(SET)/set.c
+
+
+
+#
+# UNIX (default)
+#
+BIN_DIR=../../../../bin
+CC=gcc
+COPT=-O
+ANTLR=$(BIN_DIR)/antlr.exe
+DLG=${BIN_DIR}/dlg.exe
+OBJ_EXT=o
+OUT_OBJ = -o
+CFLAGS= $(COPT) -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN $(COTHER) -DZZLEXBUFSIZE=65536
+#
+# SGI Users, use this CFLAGS
+#
+#CFLAGS= -O -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN -woff 3262
+OBJ=antlr.o scan.o err.o bits.o build.o fset2.o fset.o gen.o \
+ globals.o hash.o lex.o main.o misc.o set.o pred.o egman.o mrhoist.o fcache.o
+
+antlr : $(OBJ) $(SRC)
+ $(CC) $(CFLAGS) -o $(BIN_DIR)/antlr.exe $(OBJ)
+
+# what files does PCCTS generate (both ANTLR and DLG)
+PCCTS_GEN=antlr.c scan.c err.c tokens.h mode.h parser.dlg stdpccts.h remap.h
+
+SRC=antlr.c scan.c err.c bits.c build.c fset2.c fset.c gen.c globals.c \
+ hash.c lex.c main.c misc.c $(SET)/set.c pred.c egman.c mrhoist.c fcache.c
+
+#
+# Don't worry about the ambiguity messages coming from antlr
+# for making antlr.c etc... [should be 10 of them, I think]
+#
+#antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
+# $(ANTLR) -gh antlr.g
+
+antlr.o : antlr.c mode.h tokens.h
+
+scan.o : scan.c mode.h tokens.h
+
+#scan.c mode.h: parser.dlg
+# $(DLG) -C2 parser.dlg scan.c
+
+set.o : $(SET)/set.c
+ $(CC) $(CFLAGS) -c -o set.o $(SET)/set.c
+
+
+#
+# ****** These next targets are common to UNIX and PC world ********
+#
+
+#clean up all the intermediate files
+clean:
+ rm -f *.$(OBJ_EXT) core
+
+#remove everything in clean plus the PCCTS files generated
+scrub:
+ rm -f $(PCCTS_GEN) *.$(OBJ_EXT) core
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile1 b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile1
new file mode 100644
index 000000000..dffc70947
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile1
@@ -0,0 +1,96 @@
+#
+# Makefile for ANTLR 1.33
+#
+# SOFTWARE RIGHTS
+#
+# We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+# Set (PCCTS) -- PCCTS is in the public domain. An individual or
+# company may do whatever they wish with source code distributed with
+# PCCTS or the code generated by PCCTS, including the incorporation of
+# PCCTS, or its output, into commerical software.
+#
+# We encourage users to develop software with PCCTS. However, we do ask
+# that credit is given to us for developing PCCTS. By "credit",
+# we mean that if you incorporate our source code into one of your
+# programs (commercial product, research project, or otherwise) that you
+# acknowledge this fact somewhere in the documentation, research report,
+# etc... If you like PCCTS and have developed a nice tool with the
+# output, please mention that you developed it using PCCTS. In
+# addition, we ask that this header remain intact in our source code.
+# As long as these guidelines are kept, we expect to continue enhancing
+# this system and expect to make other tools available as they are
+# completed.
+#
+# ANTLR 1.33
+# Terence Parr
+# Parr Research Corporation
+# with Purdue University
+# and AHPCRC, University of Minnesota
+# 1989-1995
+#
+# Ported to Borland C++, IBM C-Set/2 and Microsoft 6.0 by
+# Ed Harfmann
+# Micro Data Base Systems
+# Lafayette, Indiana
+#
+SET=../support/set
+PCCTS_H=../h
+
+#
+# UNIX (default)
+#
+CC=cc
+ANTLR=${WORKSPACE}/Tools/bin/antlr
+DLG=${WORKSPACE}/Tools/bin/dlg
+OBJ_EXT=o
+OUT_OBJ = -o
+ANSI=-ansi
+AOTHER=
+CFLAGS= -O0 -g -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN $(COTHER) $(ANSI) -DZZLEXBUFSIZE=32000
+#
+# SGI Users, use this CFLAGS
+#
+#CFLAGS= -O -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN -woff 3262
+
+OBJ=antlr.o scan.o err.o bits.o build.o fset2.o fset.o gen.o \
+ globals.o hash.o lex.o main.o misc.o set.o pred.o egman.o mrhoist.o fcache.o $(OBJOTHER)
+
+antlr : $(OBJ) $(SRC)
+ $(CC) $(CFLAGS) -o antlr $(OBJ)
+ mv antlr ${WORKSPACE}/Tools/bin
+
+# what files does PCCTS generate (both ANTLR and DLG)
+PCCTS_GEN=antlr.c scan.c err.c tokens.h mode.h parser.dlg stdpccts.h remap.h
+
+SRC=antlr.c scan.c err.c bits.c build.c fset2.c fset.c gen.c globals.c \
+ hash.c lex.c main.c misc.c $(SET)/set.c pred.c egman.c mrhoist.c fcache.c
+
+#
+# Don't worry about the ambiguity messages coming from antlr
+# for making antlr.c etc... [should be 10 of them, I think]
+#
+antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
+ $(ANTLR) -gh antlr.g $(AOTHER)
+
+antlr.o : antlr.c mode.h tokens.h
+
+scan.o : scan.c mode.h tokens.h
+
+scan.c mode.h: parser.dlg
+ $(DLG) -C2 parser.dlg scan.c
+
+set.o : $(SET)/set.c
+ $(CC) $(CFLAGS) -c -o set.o $(SET)/set.c
+
+
+#
+# ****** These next targets are common to UNIX and PC world ********
+#
+
+#clean up all the intermediate files
+clean:
+ rm -f *.$(OBJ_EXT) core
+
+#remove everything in clean plus the PCCTS files generated
+scrub:
+ rm -f $(PCCTS_GEN) *.$(OBJ_EXT) core
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/misc.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/misc.c
new file mode 100644
index 000000000..3f58da34c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/misc.c
@@ -0,0 +1,1864 @@
+/*
+ * misc.c
+ *
+ * Manage tokens, regular expressions.
+ * Print methods for debugging
+ * Compute follow lists onto tail ends of rules.
+ *
+ * The following functions are visible:
+ *
+ * int addTname(char *); Add token name
+ * int addTexpr(char *); Add token expression
+ * int Tnum(char *); Get number of expr/token
+ * void Tklink(char *, char *); Link a name with an expression
+ * int hasAction(expr); Does expr already have action assigned?
+ * void setHasAction(expr); Indicate that expr now has an action
+ * Entry *newEntry(char *,int); Create new table entry with certain size
+ * void list_add(ListNode **list, char *e)
+ * void list_free(ListNode **list, int freeData); *** MR10 ***
+ * void list_apply(ListNode *list, void (*f)())
+ * void lexclass(char *m); switch to new/old lexical class
+ * void lexmode(int i); switch to old lexical class i
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include "pcctscfg.h"
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#include "dlgdef.h"
+#include <ctype.h>
+
+static int tsize=TSChunk; /* size of token str arrays */
+
+static void
+#ifdef __USE_PROTOS
+RemapForcedTokensInSyntaxDiagram(Node *);
+#else
+RemapForcedTokensInSyntaxDiagram();
+#endif
+
+ /* T o k e n M a n i p u l a t i o n */
+
+/*
+ * add token 't' to the TokenStr/Expr array. Make more room if necessary.
+ * 't' is either an expression or a token name.
+ *
+ * There is only one TokenStr array, but multiple ExprStr's. Therefore,
+ * for each lex class (element of lclass) we must extend the ExprStr array.
+ * ExprStr's and TokenStr are always all the same size.
+ *
+ * Also, there is a Texpr hash table for each automaton.
+ */
+static void
+#ifdef __USE_PROTOS
+Ttrack( char *t )
+#else
+Ttrack( t )
+char *t;
+#endif
+{
+ if ( TokenNum >= tsize ) /* terminal table overflow? */
+ {
+ char **p;
+ int i, more, j;
+
+ more = TSChunk * (1 + ((TokenNum-tsize) / TSChunk));
+ tsize += more;
+ TokenStr = (char **) realloc((char *)TokenStr, tsize*sizeof(char *));
+ require(TokenStr != NULL, "Ttrack: can't extend TokenStr");
+ for (i=0; i<NumLexClasses; i++)
+ {
+ lclass[i].exprs = (char **)
+ realloc((char *)lclass[i].exprs, tsize*sizeof(char *));
+ require(lclass[i].exprs != NULL, "Ttrack: can't extend ExprStr");
+ for (p= &lclass[i].exprs[tsize-more],j=1; j<=more; j++) *p++ = NULL;
+ }
+ for (p= &TokenStr[tsize-more],i=1; i<=more; i++) *p++ = NULL;
+ lexmode( CurrentLexClass ); /* reset ExprStr in case table moved */
+ }
+ /* note: we use the actual ExprStr/TokenStr array
+ * here as TokenInd doesn't exist yet
+ */
+ if ( *t == '"' ) ExprStr[TokenNum] = t;
+ else TokenStr[TokenNum] = t;
+}
+
+static Expr *
+#ifdef __USE_PROTOS
+newExpr( char *e )
+#else
+newExpr( e )
+char *e;
+#endif
+{
+ Expr *p = (Expr *) calloc(1, sizeof(Expr));
+ require(p!=NULL, "newExpr: cannot alloc Expr node");
+
+ p->expr = e;
+ p->lclass = CurrentLexClass;
+ return p;
+}
+
+/* switch to lexical class/mode m. This amounts to creating a new
+ * lex mode if one does not already exist and making ExprStr point
+ * to the correct char string array. We must also switch Texpr tables.
+ *
+ * BTW, we need multiple ExprStr arrays because more than one automaton
+ * may have the same label for a token, but with different expressions.
+ * We need to track an expr for each automaton. If we disallowed this
+ * feature, only one ExprStr would be required.
+ */
+void
+#ifdef __USE_PROTOS
+lexclass( char *m )
+#else
+lexclass( m )
+char *m;
+#endif
+{
+ int i;
+ TermEntry *p;
+ static char EOFSTR[] = "\"@\"";
+
+ if ( hash_get(Tname, m) != NULL )
+ {
+ warn(eMsg1("lexclass name conflicts with token/errclass label '%s'",m));
+ }
+ /* does m already exist? */
+ i = LexClassIndex(m);
+ if ( i != -1 ) {lexmode(i); return;}
+ /* must make new one */
+ NumLexClasses++;
+ CurrentLexClass = NumLexClasses-1;
+ require(NumLexClasses<=MaxLexClasses, "number of allowable lexclasses exceeded\nIncrease MaxLexClasses in generic.h and recompile all C files");
+ lclass[CurrentLexClass].classnum = m;
+ lclass[CurrentLexClass].exprs = (char **) calloc(tsize, sizeof(char *));
+ require(lclass[CurrentLexClass].exprs!=NULL,
+ "lexclass: cannot allocate ExprStr");
+ lclass[CurrentLexClass].htable = newHashTable();
+ ExprStr = lclass[CurrentLexClass].exprs;
+ Texpr = lclass[CurrentLexClass].htable;
+ /* define EOF for each automaton */
+ p = newTermEntry( EOFSTR );
+ p->token = EofToken; /* couldn't have remapped tokens yet, use EofToken */
+ hash_add(Texpr, EOFSTR, (Entry *)p);
+ list_add(&ExprOrder, (void *)newExpr(EOFSTR));
+ /* note: we use the actual ExprStr array
+ * here as TokenInd doesn't exist yet
+ */
+ ExprStr[EofToken] = EOFSTR;
+}
+
+void
+#ifdef __USE_PROTOS
+lexmode( int i )
+#else
+lexmode( i )
+int i;
+#endif
+{
+ require(i<NumLexClasses, "lexmode: invalid mode");
+ ExprStr = lclass[i].exprs;
+ Texpr = lclass[i].htable;
+ CurrentLexClass = i;
+}
+
+/* return index into lclass array of lexical class. return -1 if nonexistent */
+int
+#ifdef __USE_PROTOS
+LexClassIndex( char *cl )
+#else
+LexClassIndex( cl )
+char *cl;
+#endif
+{
+ int i;
+
+ for (i=0; i<NumLexClasses; i++)
+ {
+ if ( strcmp(lclass[i].classnum, cl) == 0 ) return i;
+ }
+ return -1;
+}
+
+int
+#ifdef __USE_PROTOS
+hasAction( char *expr )
+#else
+hasAction( expr )
+char *expr;
+#endif
+{
+ TermEntry *p;
+ require(expr!=NULL, "hasAction: invalid expr");
+
+ p = (TermEntry *) hash_get(Texpr, expr);
+ require(p!=NULL, eMsg1("hasAction: expr '%s' doesn't exist",expr));
+ return (p->action!=NULL);
+}
+
+void
+#ifdef __USE_PROTOS
+setHasAction( char *expr, char *action )
+#else
+setHasAction( expr, action )
+char *expr;
+char *action;
+#endif
+{
+ TermEntry *p;
+ require(expr!=NULL, "setHasAction: invalid expr");
+
+ p = (TermEntry *) hash_get(Texpr, expr);
+ require(p!=NULL, eMsg1("setHasAction: expr '%s' doesn't exist",expr));
+ p->action = action;
+}
+
+ForcedToken *
+#ifdef __USE_PROTOS
+newForcedToken(char *token, int tnum)
+#else
+newForcedToken(token, tnum)
+char *token;
+int tnum;
+#endif
+{
+ ForcedToken *ft = (ForcedToken *) calloc(1, sizeof(ForcedToken));
+ require(ft!=NULL, "out of memory");
+ ft->token = token;
+ ft->tnum = tnum;
+ return ft;
+}
+
+/*
+ * Make a token indirection array that remaps token numbers and then walk
+ * the appropriate symbol tables and SynDiag to change token numbers
+ */
+void
+#ifdef __USE_PROTOS
+RemapForcedTokens(void)
+#else
+RemapForcedTokens()
+#endif
+{
+ ListNode *p;
+ ForcedToken *q;
+ int max_token_number=0; /* MR9 23-Sep-97 Removed "unsigned" */
+ int i;
+
+ if ( ForcedTokens == NULL ) return;
+
+ /* find max token num */
+ for (p = ForcedTokens->next; p!=NULL; p=p->next)
+ {
+ q = (ForcedToken *) p->elem;
+ if ( q->tnum > max_token_number ) max_token_number = q->tnum;
+ }
+ fprintf(stderr, "max token number is %d\n", max_token_number);
+
+ /* make token indirection array */
+ TokenInd = (int *) calloc(max_token_number+1, sizeof(int));
+ LastTokenCounted = TokenNum;
+ TokenNum = max_token_number+1;
+ require(TokenInd!=NULL, "RemapForcedTokens: cannot allocate TokenInd");
+
+ /* fill token indirection array and change token id htable ; swap token indices */
+ for (i=1; i<TokenNum; i++) TokenInd[i] = i;
+ for (p = ForcedTokens->next; p!=NULL; p=p->next)
+ {
+ TermEntry *te;
+ int old_pos, t;
+
+ q = (ForcedToken *) p->elem;
+ fprintf(stderr, "%s forced to %d\n", q->token, q->tnum);
+ te = (TermEntry *) hash_get(Tname, q->token);
+ require(te!=NULL, "RemapForcedTokens: token not in hash table");
+ old_pos = te->token;
+ fprintf(stderr, "Before: TokenInd[old_pos==%d] is %d\n", old_pos, TokenInd[old_pos]);
+ fprintf(stderr, "Before: TokenInd[target==%d] is %d\n", q->tnum, TokenInd[q->tnum]);
+ q = (ForcedToken *) p->elem;
+ t = TokenInd[old_pos];
+ TokenInd[old_pos] = q->tnum;
+ TokenInd[q->tnum] = t;
+ te->token = q->tnum; /* update token type id symbol table */
+ fprintf(stderr, "After: TokenInd[old_pos==%d] is %d\n", old_pos, TokenInd[old_pos]);
+ fprintf(stderr, "After: TokenInd[target==%d] is %d\n", q->tnum, TokenInd[q->tnum]);
+
+ /* Change the token number in the sym tab entry for the exprs
+ * at the old position of the token id and the target position
+ */
+ /* update expr at target (if any) of forced token id */
+ if ( q->tnum < TokenNum ) /* is it a valid position? */
+ {
+ for (i=0; i<NumLexClasses; i++)
+ {
+ if ( lclass[i].exprs[q->tnum]!=NULL )
+ {
+ /* update the symbol table for this expr */
+ TermEntry *e = (TermEntry *) hash_get(lclass[i].htable, lclass[i].exprs[q->tnum]);
+ require(e!=NULL, "RemapForcedTokens: expr not in hash table");
+ e->token = old_pos;
+ fprintf(stderr, "found expr '%s' at target %d in lclass[%d]; changed to %d\n",
+ lclass[i].exprs[q->tnum], q->tnum, i, old_pos);
+ }
+ }
+ }
+ /* update expr at old position (if any) of forced token id */
+ for (i=0; i<NumLexClasses; i++)
+ {
+ if ( lclass[i].exprs[old_pos]!=NULL )
+ {
+ /* update the symbol table for this expr */
+ TermEntry *e = (TermEntry *) hash_get(lclass[i].htable, lclass[i].exprs[old_pos]);
+ require(e!=NULL, "RemapForcedTokens: expr not in hash table");
+ e->token = q->tnum;
+ fprintf(stderr, "found expr '%s' for id %s in lclass[%d]; changed to %d\n",
+ lclass[i].exprs[old_pos], q->token, i, q->tnum);
+ }
+ }
+ }
+
+ /* Update SynDiag */
+ RemapForcedTokensInSyntaxDiagram((Node *)SynDiag);
+}
+
+static void
+#ifdef __USE_PROTOS
+RemapForcedTokensInSyntaxDiagram(Node *p)
+#else
+RemapForcedTokensInSyntaxDiagram(p)
+Node *p;
+#endif
+{
+ Junction *j = (Junction *) p;
+ RuleRefNode *r = (RuleRefNode *) p;
+ TokNode *t = (TokNode *)p;
+
+ if ( p==NULL ) return;
+ require(p->ntype>=1 && p->ntype<=NumNodeTypes, "Remap...: invalid diagram node");
+ switch ( p->ntype )
+ {
+ case nJunction :
+ if ( j->visited ) return;
+ if ( j->jtype == EndRule ) return;
+ j->visited = TRUE;
+ RemapForcedTokensInSyntaxDiagram( j->p1 );
+ RemapForcedTokensInSyntaxDiagram( j->p2 );
+ j->visited = FALSE;
+ return;
+ case nRuleRef :
+ RemapForcedTokensInSyntaxDiagram( r->next );
+ return;
+ case nToken :
+ if ( t->remapped ) return; /* we've been here before */
+ t->remapped = 1;
+ fprintf(stderr, "remapping %d to %d\n", t->token, TokenInd[t->token]);
+ t->token = TokenInd[t->token];
+ RemapForcedTokensInSyntaxDiagram( t->next );
+ return;
+ case nAction :
+ RemapForcedTokensInSyntaxDiagram( ((ActionNode *)p)->next );
+ return;
+ default :
+ fatal_internal("invalid node type");
+ }
+}
+
+/*
+ * Add a token name. Return the token number associated with it. If it already
+ * exists, then return the token number assigned to it.
+ *
+ * Track the order in which tokens are found so that the DLG output maintains
+ * that order. It also lets us map token numbers to strings.
+ */
+int
+#ifdef __USE_PROTOS
+addTname( char *token )
+#else
+addTname( token )
+char *token;
+#endif
+{
+ TermEntry *p;
+ require(token!=NULL, "addTname: invalid token name");
+
+ if ( (p=(TermEntry *)hash_get(Tname, token)) != NULL ) return p->token;
+ p = newTermEntry( token );
+ Ttrack( p->str );
+ p->token = TokenNum++;
+ hash_add(Tname, token, (Entry *)p);
+ return p->token;
+}
+
+/* This is the same as addTname except we force the TokenNum to be tnum.
+ * We don't have to use the Forced token stuff as no tokens will have
+ * been defined with #tokens when this is called. This is only called
+ * when a #tokdefs meta-op is used.
+ */
+int
+#ifdef __USE_PROTOS
+addForcedTname( char *token, int tnum )
+#else
+addForcedTname( token, tnum )
+char *token;
+int tnum;
+#endif
+{
+ TermEntry *p;
+ require(token!=NULL, "addTname: invalid token name");
+
+ if ( (p=(TermEntry *)hash_get(Tname, token)) != NULL ) return p->token;
+ p = newTermEntry( token );
+ Ttrack( p->str );
+ p->token = tnum;
+ hash_add(Tname, token, (Entry *)p);
+ return p->token;
+}
+
+/*
+ * Add a token expr. Return the token number associated with it. If it already
+ * exists, then return the token number assigned to it.
+ */
+int
+#ifdef __USE_PROTOS
+addTexpr( char *expr )
+#else
+addTexpr( expr )
+char *expr;
+#endif
+{
+ TermEntry *p;
+ require(expr!=NULL, "addTexpr: invalid regular expression");
+
+ if ( (p=(TermEntry *)hash_get(Texpr, expr)) != NULL ) return p->token;
+ p = newTermEntry( expr );
+ Ttrack( p->str );
+ /* track the order in which they occur */
+ list_add(&ExprOrder, (void *)newExpr(p->str));
+ p->token = TokenNum++;
+ hash_add(Texpr, expr, (Entry *)p);
+ return p->token;
+}
+
+/* return the token number of 'term'. Return 0 if no 'term' exists */
+int
+#ifdef __USE_PROTOS
+Tnum( char *term )
+#else
+Tnum( term )
+char *term;
+#endif
+{
+ TermEntry *p;
+ require(term!=NULL, "Tnum: invalid terminal");
+
+ if ( *term=='"' ) p = (TermEntry *) hash_get(Texpr, term);
+ else p = (TermEntry *) hash_get(Tname, term);
+ if ( p == NULL ) return 0;
+ else return p->token;
+}
+
+/* associate a Name with an expr. If both have been already assigned
+ * token numbers, then an error is reported. Add the token or expr
+ * that has not been added if no error. This 'represents' the #token
+ * ANTLR pseudo-op. If both have not been defined, define them both
+ * linked to same token number.
+ */
+void
+#ifdef __USE_PROTOS
+Tklink( char *token, char *expr )
+#else
+Tklink( token, expr )
+char *token;
+char *expr;
+#endif
+{
+ TermEntry *p, *q;
+ require(token!=NULL && expr!=NULL, "Tklink: invalid token name and/or expr");
+
+ p = (TermEntry *) hash_get(Tname, token);
+ q = (TermEntry *) hash_get(Texpr, expr);
+ if ( p != NULL && q != NULL ) /* both defined */
+ {
+ warn( eMsg2("token name %s and rexpr %s already defined; ignored",
+ token, expr) );
+ return;
+ }
+ if ( p==NULL && q==NULL ) /* both not defined */
+ {
+ int t = addTname( token );
+ q = newTermEntry( expr );
+ hash_add(Texpr, expr, (Entry *)q);
+ q->token = t;
+ /* note: we use the actual ExprStr array
+ * here as TokenInd doesn't exist yet
+ */
+ ExprStr[t] = q->str;
+ /* track the order in which they occur */
+ list_add(&ExprOrder, (void *)newExpr(q->str));
+ return;
+ }
+ if ( p != NULL ) /* one is defined, one is not */
+ {
+ q = newTermEntry( expr );
+ hash_add(Texpr, expr, (Entry *)q);
+ q->token = p->token;
+ ExprStr[p->token] = q->str; /* both expr and token str defined now */
+ list_add(&ExprOrder, (void *)newExpr(q->str));
+ }
+ else /* trying to associate name with expr here*/
+ {
+ p = newTermEntry( token );
+ hash_add(Tname, token, (Entry *)p);
+ p->token = q->token;
+ TokenStr[p->token] = p->str;/* both expr and token str defined now */
+ }
+}
+
+/*
+ * Given a string, this function allocates and returns a pointer to a
+ * hash table record of size 'sz' whose "str" pointer is reset to a position
+ * in the string table.
+ */
+Entry *
+#ifdef __USE_PROTOS
+newEntry( char *text, int sz )
+#else
+newEntry( text, sz )
+char *text;
+int sz;
+#endif
+{
+ Entry *p;
+ require(text!=NULL, "new: NULL terminal");
+
+ if ( (p = (Entry *) calloc(1,sz)) == 0 )
+ {
+ fatal_internal("newEntry: out of memory for terminals\n");
+ exit(PCCTS_EXIT_FAILURE);
+ }
+ p->str = mystrdup(text);
+
+ return(p);
+}
+
+/*
+ * add an element to a list.
+ *
+ * Any non-empty list has a sentinel node whose 'elem' pointer is really
+ * a pointer to the last element. (i.e. length(list) = #elemIn(list)+1).
+ * Elements are appended to the list.
+ */
+void
+#ifdef __USE_PROTOS
+list_add( ListNode **list, void *e )
+#else
+list_add( list, e )
+ListNode **list;
+void *e;
+#endif
+{
+ ListNode *p, *tail;
+ require(e!=NULL, "list_add: attempting to add NULL list element");
+
+ p = newListNode;
+ require(p!=NULL, "list_add: cannot alloc new list node");
+ p->elem = e;
+ if ( *list == NULL )
+ {
+ ListNode *sentinel = newListNode;
+ require(sentinel!=NULL, "list_add: cannot alloc sentinel node");
+ *list=sentinel;
+ sentinel->next = p;
+ sentinel->elem = (char *)p; /* set tail pointer */
+ }
+ else /* find end of list */
+ {
+ tail = (ListNode *) (*list)->elem; /* get tail pointer */
+ tail->next = p;
+ (*list)->elem = (char *) p; /* reset tail */
+ }
+}
+
+/* MR10 list_free() frees the ListNode elements in the list */
+/* MR10 if freeData then free the data elements of the list too */
+
+void
+#ifdef __USE_PROTOS
+list_free(ListNode **list,int freeData)
+#else
+list_free(list,freeData)
+ ListNode **list;
+ int freeData;
+#endif
+{
+ ListNode *p;
+ ListNode *next;
+
+ if (list == NULL) return;
+ if (*list == NULL) return;
+ for (p=*list; p != NULL; p=next) {
+ next=p->next;
+ if (freeData && p->elem != NULL) {
+ free( (char *) p->elem);
+ };
+ free( (char *) p);
+ };
+ *list=NULL;
+}
+
+void
+#ifdef __USE_PROTOS
+list_apply( ListNode *list, void (*f)(void *) )
+#else
+list_apply( list, f )
+ListNode *list;
+void (*f)();
+#endif
+{
+ ListNode *p;
+ require(f!=NULL, "list_apply: NULL function to apply");
+
+ if ( list == NULL ) return;
+ for (p = list->next; p!=NULL; p=p->next) (*f)( p->elem );
+}
+
+/* MR27 */
+
+#ifdef __USE_PROTOS
+int list_search_cstring(ListNode *list, char * cstring)
+#else
+int list_search_cstring(list, cstring)
+ ListNode * list;
+ char * cstring;
+#endif
+{
+ ListNode *p;
+ if (list == NULL ) return 0;
+ for (p = list->next; p!=NULL; p=p->next) {
+ if (p->elem == NULL) continue;
+ if (0 == strcmp((char *) p->elem , cstring)) return 1;
+ }
+ return 0;
+}
+
+ /* F O L L O W C y c l e S t u f f */
+
+/* make a key based upon (rulename, computation, k value).
+ * Computation values are 'i'==FIRST, 'o'==FOLLOW.
+ */
+
+/* MR10 Make the key all characters so it can be read easily */
+/* MR10 by a simple dump program. Also, separates */
+/* MR10 'o' and 'i' from rule name */
+
+char *
+#ifdef __USE_PROTOS
+Fkey( char *rule, int computation, int k )
+#else
+Fkey( rule, computation, k )
+char *rule;
+int computation;
+int k;
+#endif
+{
+ static char key[MaxRuleName+2+2+1]; /* MR10 */
+ int i;
+
+ if ( k > 99 ) /* MR10 */
+ fatal("k>99 is too big for this implementation of ANTLR!\n"); /* MR10 */
+ if ( (i=strlen(rule)) > MaxRuleName ) /* MR10 */
+ fatal( eMsgd("rule name > max of %d\n", MaxRuleName) ); /* MR10 */
+ strcpy(key,rule);
+
+/* MR10 */ key[i]='*';
+/* MR10 */ key[i+1] = (char) computation; /* MR20 G. Hobbelt */
+/* MR10 */ if (k < 10) {
+/* MR10 */ key[i+2] = (char) ( '0' + k);
+/* MR10 */ key[i+3] = '\0';
+/* MR10 */ } else {
+/* MR10 */ key[i+2] = (char) ( '0' + k/10);
+/* MR10 */ key[i+3] = (char) ( '0' + k % 10);
+/* MR10 */ key[i+4] = '\0';
+/* MR10 */ };
+
+ return key;
+}
+
+/* Push a rule onto the kth FOLLOW stack */
+void
+#ifdef __USE_PROTOS
+FoPush( char *rule, int k )
+#else
+FoPush( rule, k )
+char *rule;
+int k;
+#endif
+{
+ RuleEntry *r;
+ require(rule!=NULL, "FoPush: tried to push NULL rule");
+ require(k<=CLL_k, "FoPush: tried to access non-existent stack");
+
+ /*fprintf(stderr, "FoPush(%s)\n", rule);*/
+ r = (RuleEntry *) hash_get(Rname, rule);
+ if ( r == NULL ) {fatal_internal( eMsg1("rule %s must be defined but isn't", rule) );}
+ if ( FoStack[k] == NULL ) /* Does the kth stack exist yet? */
+ {
+ /*fprintf(stderr, "allocating FoStack\n");*/
+ FoStack[k] = (int *) calloc(FoStackSize, sizeof(int));
+ require(FoStack[k]!=NULL, "FoPush: cannot allocate FOLLOW stack\n");
+ }
+ if ( FoTOS[k] == NULL )
+ {
+ FoTOS[k]=FoStack[k];
+ *(FoTOS[k]) = r->rulenum;
+ }
+ else
+ {
+#ifdef MEMCHK
+ require(valid(FoStack[k]), "FoPush: invalid FoStack");
+#endif
+ if ( FoTOS[k] >= &(FoStack[k][FoStackSize-1]) )
+ fatal( eMsgd("exceeded max depth of FOLLOW recursion (%d)\n",
+ FoStackSize) );
+ require(FoTOS[k]>=FoStack[k],
+ eMsg1("FoPush: FoStack stack-ptr is playing out of its sandbox",
+ rule));
+ ++(FoTOS[k]);
+ *(FoTOS[k]) = r->rulenum;
+ }
+ {
+ /*
+**** int *p;
+**** fprintf(stderr, "FoStack[k=%d]:\n", k);
+**** for (p=FoStack[k]; p<=FoTOS[k]; p++)
+**** {
+**** fprintf(stderr, "\t%s\n", RulePtr[*p]->rname);
+**** }
+ */
+ }
+}
+
+/* Pop one rule off of the FOLLOW stack. TOS ptr is NULL if empty. */
+void
+#ifdef __USE_PROTOS
+FoPop( int k )
+#else
+FoPop( k )
+int k;
+#endif
+{
+ require(k<=CLL_k, "FoPop: tried to access non-existent stack");
+ /*fprintf(stderr, "FoPop\n");*/
+ require(FoTOS[k]>=FoStack[k]&&FoTOS[k]<=&(FoStack[k][FoStackSize-1]),
+ "FoPop: FoStack stack-ptr is playing out of its sandbox");
+ if ( FoTOS[k] == FoStack[k] ) FoTOS[k] = NULL;
+ else (FoTOS[k])--;
+}
+
+/* Compute FOLLOW cycle.
+ * Mark all FOLLOW sets for rules in cycle as incomplete.
+ * Then, save cycle on the cycle list (Cycles) for later resolution.
+ * The Cycle is stored in the form:
+ * (head of cycle==croot, rest of rules in cycle==cyclicDep)
+ *
+ * e.g. (Fo means "FOLLOW of", "-->" means requires or depends on)
+ *
+ * Fo(x)-->Fo(a)-->Fo(b)-->Fo(c)-->Fo(x)
+ * ^----Infinite recursion (cycle)
+ *
+ * the cycle would be: x -> {a,b,c} or stored as (x,{a,b,c}). Fo(x) depends
+ * on the FOLLOW of a,b, and c. The root of a cycle is always complete after
+ * Fo(x) finishes. Fo(a,b,c) however are not. It turns out that all rules
+ * in a FOLLOW cycle have the same FOLLOW set.
+ */
+void
+#ifdef __USE_PROTOS
+RegisterCycle( char *rule, int k )
+#else
+RegisterCycle( rule, k )
+char *rule;
+int k;
+#endif
+{
+ CacheEntry *f;
+ Cycle *c;
+ int *p;
+ RuleEntry *r;
+ require(rule!=NULL, "RegisterCycle: tried to register NULL rule");
+ require(k<=CLL_k, "RegisterCycle: tried to access non-existent stack");
+
+ /*fprintf(stderr, "RegisterCycle(%s)\n", rule);*/
+ /* Find cycle start */
+ r = (RuleEntry *) hash_get(Rname, rule);
+ require(r!=NULL,eMsg1("rule %s must be defined but isn't", rule));
+ require(FoTOS[k]>=FoStack[k]&&FoTOS[k]<=&(FoStack[k][FoStackSize-1]),
+ eMsg1("RegisterCycle(%s): FoStack stack-ptr is playing out of its sandbox",
+ rule));
+/*** if ( FoTOS[k]<FoStack[k]||FoTOS[k]>&(FoStack[k][FoStackSize-1]) )
+**** {
+**** fprintf(stderr, "RegisterCycle(%s): FoStack stack-ptr is playing out of its sandbox\n",
+**** rule);
+**** fprintf(stderr, "RegisterCycle: sp==0x%x out of bounds 0x%x...0x%x\n",
+**** FoTOS[k], FoStack[k], &(FoStack[k][FoStackSize-1]));
+**** exit(PCCTS_EXIT_FAILURE);
+**** }
+****/
+
+#ifdef MEMCHK
+ require(valid(FoStack[k]), "RegisterCycle: invalid FoStack");
+#endif
+ for (p=FoTOS[k]; *p != r->rulenum && p >= FoStack[k]; --p) {;}
+ require(p>=FoStack[k], "RegisterCycle: FoStack is screwed up beyond belief");
+ if ( p == FoTOS[k] ) return; /* don't worry about cycles to oneself */
+
+ /* compute cyclic dependents (rules in cycle except head) */
+ c = newCycle;
+ require(c!=NULL, "RegisterCycle: couldn't alloc new cycle");
+ c->cyclicDep = empty;
+ c->croot = *p++; /* record root of cycle */
+ for (; p<=FoTOS[k]; p++)
+ {
+ /* Mark all dependent rules as incomplete */
+ f = (CacheEntry *) hash_get(Fcache, Fkey(RulePtr[*p]->rname,'o',k));
+ if ( f==NULL )
+ {
+ f = newCacheEntry( Fkey(RulePtr[*p]->rname,'o',k) );
+ hash_add(Fcache, Fkey(RulePtr[*p]->rname,'o',k), (Entry *)f);
+ }
+ f->incomplete = TRUE;
+
+ set_orel(*p, &(c->cyclicDep)); /* mark rule as dependent of croot */
+ }
+ list_add(&(Cycles[k]), (void *)c);
+}
+
+/* make all rules in cycle complete
+ *
+ * while ( some set has changed ) do
+ * for each cycle do
+ * if degree of FOLLOW set for croot > old degree then
+ * update all FOLLOW sets for rules in cyclic dependency
+ * change = TRUE
+ * endif
+ * endfor
+ * endwhile
+ */
+void
+#ifdef __USE_PROTOS
+ResolveFoCycles( int k )
+#else
+ResolveFoCycles( k )
+int k;
+#endif
+{
+ ListNode *p, *q;
+ Cycle *c;
+ int changed = 1;
+ CacheEntry *f,*g;
+ int r;
+/* int i; */ /* MR10 not useful */
+ unsigned d;
+
+ unsigned *cursor; /* MR10 */
+ unsigned *origin; /* MR10 */
+
+ /*fprintf(stderr, "Resolving following cycles for %d\n", k);*/
+ while ( changed )
+ {
+ changed = 0;
+/* MR10 i = 0; */
+ for (p = Cycles[k]->next; p!=NULL; p=p->next)
+ {
+ c = (Cycle *) p->elem;
+ /*fprintf(stderr, "cycle %d: %s -->", i++, RulePtr[c->croot]->rname);*/
+ /*s_fprT(stderr, c->cyclicDep);*/
+ /*fprintf(stderr, "\n");*/
+ f = (CacheEntry *)
+ hash_get(Fcache, Fkey(RulePtr[c->croot]->rname,'o',k));
+ require(f!=NULL, eMsg1("FOLLOW(%s) must be in cache but isn't", RulePtr[c->croot]->rname) );
+ if ( (d=set_deg(f->fset)) > c->deg )
+ {
+ /*fprintf(stderr, "Fo(%s) has changed\n", RulePtr[c->croot]->rname);*/
+ changed = 1;
+ c->deg = d; /* update cycle FOLLOW set degree */
+
+/* MR10 */ origin=set_pdq(c->cyclicDep);
+/* MR10 */ for (cursor=origin; *cursor != nil; cursor++) {
+/* MR10 */ r=*cursor;
+
+/******** while ( !set_nil(c->cyclicDep) ) { *****/
+/******** r = set_int(c->cyclicDep); *****/
+/******** set_rm(r, c->cyclicDep); *****/
+
+ /*fprintf(stderr, "updating Fo(%s)\n", RulePtr[r]->rname);*/
+ g = (CacheEntry *)
+ hash_get(Fcache, Fkey(RulePtr[r]->rname,'o',k));
+ require(g!=NULL, eMsg1("FOLLOW(%s) must be in cache but isn't", RulePtr[r]->rname) );
+ set_orin(&(g->fset), f->fset);
+ g->incomplete = FALSE;
+ }
+/* MR10 */ free( (char *) origin);
+/* MR10 */ origin=NULL;
+ }
+ }
+/* MR10 - this if statement appears to be meaningless since i is always 0 */
+/* MR10 if ( i == 1 ) changed = 0; */ /* if only 1 cycle, no need to repeat */
+ }
+ /* kill Cycle list */
+ for (q = Cycles[k]->next; q != NULL; q=p)
+ {
+ p = q->next;
+ set_free( ((Cycle *)q->elem)->cyclicDep );
+ free((char *)q);
+ }
+ free( (char *)Cycles[k] );
+ Cycles[k] = NULL;
+}
+
+
+ /* P r i n t i n g S y n t a x D i a g r a m s */
+
+static void
+#ifdef __USE_PROTOS
+pBlk( Junction *q, int btype )
+#else
+pBlk( q, btype )
+Junction *q;
+int btype;
+#endif
+{
+ int k,a;
+ Junction *alt, *p;
+
+ q->end->pvisited = TRUE;
+ if ( btype == aLoopBegin )
+ {
+ require(q->p2!=NULL, "pBlk: invalid ()* block");
+ PRINT(q->p1);
+ alt = (Junction *)q->p2;
+ PRINT(alt->p1);
+ if ( PrintAnnotate )
+ {
+ printf(" /* Opt ");
+ k = 1;
+ while ( !set_nil(alt->fset[k]) )
+ {
+ s_fprT(stdout, alt->fset[k]);
+ if ( k++ == CLL_k ) break;
+ if ( !set_nil(alt->fset[k]) ) printf(", ");
+ }
+ printf(" */\n");
+ }
+ return;
+ }
+ for (a=1,alt=q; alt != NULL; alt= (Junction *) alt->p2, a++)
+ {
+ if ( alt->p1 != NULL ) PRINT(alt->p1);
+ if ( PrintAnnotate )
+ {
+ printf( " /* [%d] ", alt->altnum);
+ k = 1;
+ while ( !set_nil(alt->fset[k]) )
+ {
+ s_fprT(stdout, alt->fset[k]);
+ if ( k++ == CLL_k ) break;
+ if ( !set_nil(alt->fset[k]) ) printf(", ");
+ }
+ if ( alt->p2 == NULL && btype == aOptBlk )
+ printf( " (optional branch) */\n");
+ else printf( " */\n");
+ }
+
+ /* ignore implied empty alt of Plus blocks */
+ if ( alt->p2 != NULL && ((Junction *)alt->p2)->ignore ) break;
+
+ if ( alt->p2 != NULL && !(((Junction *)alt->p2)->p2==NULL && btype == aOptBlk) )
+ {
+ if ( pLevel == 1 )
+ {
+ printf("\n");
+ if ( a+1==pAlt1 || a+1==pAlt2 ) printf("=>");
+ printf("\t");
+ }
+ else printf(" ");
+ printf("|");
+ if ( pLevel == 1 )
+ {
+ p = (Junction *) ((Junction *)alt->p2)->p1;
+ while ( p!=NULL )
+ {
+ if ( p->ntype==nAction )
+ {
+ p=(Junction *)((ActionNode *)p)->next;
+ continue;
+ }
+ if ( p->ntype!=nJunction )
+ {
+ break;
+ }
+ if ( p->jtype==EndBlk || p->jtype==EndRule )
+ {
+ p = NULL;
+ break;
+ }
+ p = (Junction *)p->p1;
+ }
+ if ( p==NULL ) printf("\n\t"); /* Empty alt? */
+ }
+ }
+ }
+ q->end->pvisited = FALSE;
+}
+
+/* How to print out a junction */
+void
+#ifdef __USE_PROTOS
+pJunc( Junction *q )
+#else
+pJunc( q )
+Junction *q;
+#endif
+{
+ int dum_k;
+ int doing_rule;
+ require(q!=NULL, "pJunc: NULL node");
+ require(q->ntype==nJunction, "pJunc: not junction");
+
+ if ( q->pvisited == TRUE ) return;
+ q->pvisited = TRUE;
+ switch ( q->jtype )
+ {
+ case aSubBlk :
+ if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k);
+ if ( q->end->p1 != NULL && ((Junction *)q->end->p1)->ntype==nJunction &&
+ ((Junction *)q->end->p1)->jtype == EndRule ) doing_rule = 1;
+ else doing_rule = 0;
+ pLevel++;
+ if ( pLevel==1 )
+ {
+ if ( pAlt1==1 ) printf("=>");
+ printf("\t");
+ }
+ else printf(" ");
+ if ( doing_rule )
+ {
+ if ( pLevel==1 ) printf(" ");
+ pBlk(q,q->jtype);
+ }
+ else {
+ printf("(");
+ if ( pLevel==1 ) printf(" ");
+ pBlk(q,q->jtype);
+ if ( pLevel>1 ) printf(" ");
+ printf(")");
+ }
+ if ( q->guess ) printf("?");
+ pLevel--;
+ if ( PrintAnnotate ) freeBlkFsets(q);
+ if ( q->end->p1 != NULL ) PRINT(q->end->p1);
+ break;
+ case aOptBlk :
+ if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k);
+ pLevel++;
+ if ( pLevel==1 )
+ {
+ if ( pAlt1==1 ) printf("=>");
+ printf("\t");
+ }
+ else printf(" ");
+ printf("{");
+ if ( pLevel==1 ) printf(" ");
+ pBlk(q,q->jtype);
+ if ( pLevel>1 ) printf(" ");
+ else printf("\n\t");
+ printf("}");
+ pLevel--;
+ if ( PrintAnnotate ) freeBlkFsets(q);
+ if ( q->end->p1 != NULL ) PRINT(q->end->p1);
+ break;
+ case aLoopBegin :
+ if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k);
+ pLevel++;
+ if ( pLevel==1 )
+ {
+ if ( pAlt1==1 ) printf("=>");
+ printf("\t");
+ }
+ else printf(" ");
+ printf("(");
+ if ( pLevel==1 ) printf(" ");
+ pBlk(q,q->jtype);
+ if ( pLevel>1 ) printf(" ");
+ else printf("\n\t");
+ printf(")*");
+ pLevel--;
+ if ( PrintAnnotate ) freeBlkFsets(q);
+ if ( q->end->p1 != NULL ) PRINT(q->end->p1);
+ break;
+ case aLoopBlk :
+ if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k);
+ pBlk(q,q->jtype);
+ if ( PrintAnnotate ) freeBlkFsets(q);
+ break;
+ case aPlusBlk :
+ if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k);
+ pLevel++;
+ if ( pLevel==1 )
+ {
+ if ( pAlt1==1 ) printf("=>");
+ printf("\t");
+ }
+ else printf(" ");
+ printf("(");
+ if ( pLevel==1 ) printf(" ");
+ pBlk(q,q->jtype);
+ if ( pLevel>1 ) printf(" ");
+ printf(")+");
+ pLevel--;
+ if ( PrintAnnotate ) freeBlkFsets(q);
+ if ( q->end->p1 != NULL ) PRINT(q->end->p1);
+ break;
+ case EndBlk :
+ break;
+ case RuleBlk :
+ printf( "\n%s :\n", q->rname);
+ PRINT(q->p1);
+ if ( q->p2 != NULL ) PRINT(q->p2);
+ break;
+ case Generic :
+ if ( q->p1 != NULL ) PRINT(q->p1);
+ q->pvisited = FALSE;
+ if ( q->p2 != NULL ) PRINT(q->p2);
+ break;
+ case EndRule :
+ printf( "\n\t;\n");
+ break;
+ }
+ q->pvisited = FALSE;
+}
+
+/* How to print out a rule reference node */
+void
+#ifdef __USE_PROTOS
+pRuleRef( RuleRefNode *p )
+#else
+pRuleRef( p )
+RuleRefNode *p;
+#endif
+{
+ require(p!=NULL, "pRuleRef: NULL node");
+ require(p->ntype==nRuleRef, "pRuleRef: not rule ref node");
+
+ printf( " %s", p->text);
+ PRINT(p->next);
+}
+
+/* How to print out a terminal node */
+void
+#ifdef __USE_PROTOS
+pToken( TokNode *p )
+#else
+pToken( p )
+TokNode *p;
+#endif
+{
+ require(p!=NULL, "pToken: NULL node");
+ require(p->ntype==nToken, "pToken: not token node");
+
+ if ( p->wild_card ) printf(" .");
+ printf( " %s", TerminalString(p->token));
+ PRINT(p->next);
+}
+
+/* How to print out a terminal node */
+void
+#ifdef __USE_PROTOS
+pAction( ActionNode *p )
+#else
+pAction( p )
+ActionNode *p;
+#endif
+{
+ require(p!=NULL, "pAction: NULL node");
+ require(p->ntype==nAction, "pAction: not action node");
+
+ PRINT(p->next);
+}
+
+ /* F i l l F o l l o w L i s t s */
+
+/*
+ * Search all rules for all rule reference nodes, q to rule, r.
+ * Add q->next to follow list dangling off of rule r.
+ * i.e.
+ *
+ * r: -o-R-o-->o--> Ptr to node following rule r in another rule
+ * |
+ * o--> Ptr to node following another reference to r.
+ *
+ * This is the data structure employed to avoid FOLLOW set computation. We
+ * simply compute the FIRST (reach) of the EndRule Node which follows the
+ * list found at the end of all rules which are referenced elsewhere. Rules
+ * not invoked by other rules have no follow list (r->end->p1==NULL).
+ * Generally, only start symbols are not invoked by another rule.
+ *
+ * Note that this mechanism also gives a free cross-reference mechanism.
+ *
+ * The entire syntax diagram is layed out like this:
+ *
+ * SynDiag
+ * |
+ * v
+ * o-->R1--o
+ * |
+ * o-->R2--o
+ * |
+ * ...
+ * |
+ * o-->Rn--o
+ *
+ */
+void
+#ifdef __USE_PROTOS
+FoLink( Node *p )
+#else
+FoLink( p )
+Node *p;
+#endif
+{
+ RuleEntry *q;
+ Junction *j = (Junction *) p;
+ RuleRefNode *r = (RuleRefNode *) p;
+
+ if ( p==NULL ) return;
+ require(p->ntype>=1 && p->ntype<=NumNodeTypes,
+ eMsgd("FoLink: invalid diagram node: ntype==%d",p->ntype));
+ switch ( p->ntype )
+ {
+ case nJunction :
+ if ( j->fvisited ) return;
+ if ( j->jtype == EndRule ) return;
+ j->fvisited = TRUE;
+ FoLink( j->p1 );
+ FoLink( j->p2 );
+/* MR14 */
+/* MR14 */ /* Need to determine whether the guess block is an */
+/* MR14 */ /* of the form (alpha)? beta before follow sets are */
+/* MR14 */ /* computed. This is necessary to solve problem */
+/* MR14 */ /* of doing follow on the alpha of an (alpha)? beta block. */
+/* MR14 */
+/* MR14 */ /* This is performed by analysis_point as a side-effect. */
+/* MR14 */
+/* MR14 */
+/* MR14 */ if (j->jtype == aSubBlk && j->guess) {
+/* MR14 */ Junction *ignore;
+/* MR14 */ ignore=analysis_point(j);
+/* MR14 */ }
+/* MR14 */
+ return;
+ case nRuleRef :
+ if ( r->linked ) return;
+ q = (RuleEntry *) hash_get(Rname, r->text);
+ if ( q == NULL )
+ {
+ warnFL( eMsg1("rule %s not defined",r->text), FileStr[r->file], r->line );
+ }
+ else
+ {
+ if ( r->parms!=NULL && RulePtr[q->rulenum]->pdecl==NULL )
+ {
+ warnFL( eMsg1("rule %s accepts no parameter(s)", r->text),
+ FileStr[r->file], r->line );
+ }
+ if ( r->parms==NULL && RulePtr[q->rulenum]->pdecl!=NULL )
+ {
+ warnFL( eMsg1("rule %s requires parameter(s)", r->text),
+ FileStr[r->file], r->line );
+ }
+ if ( r->assign!=NULL && RulePtr[q->rulenum]->ret==NULL )
+ {
+ warnFL( eMsg1("rule %s yields no return value(s)", r->text),
+ FileStr[r->file], r->line );
+ }
+ if ( r->assign==NULL && RulePtr[q->rulenum]->ret!=NULL )
+ {
+ warnFL( eMsg1("rule %s returns a value(s)", r->text),
+ FileStr[r->file], r->line );
+ }
+ if ( !r->linked )
+ {
+ addFoLink( r->next, r->rname, RulePtr[q->rulenum] );
+ r->linked = TRUE;
+ }
+ }
+ FoLink( r->next );
+ return;
+ case nToken :
+ FoLink( ((TokNode *)p)->next );
+ return;
+ case nAction :
+ FoLink( ((ActionNode *)p)->next );
+ return;
+ default :
+ fatal_internal("invalid node type");
+ }
+}
+
+/*
+ * Add a reference to the end of a rule.
+ *
+ * 'r' points to the RuleBlk node in a rule. r->end points to the last node
+ * (EndRule jtype) in a rule.
+ *
+ * Initial:
+ * r->end --> o
+ *
+ * After:
+ * r->end --> o-->o--> Ptr to node following rule r in another rule
+ * |
+ * o--> Ptr to node following another reference to r.
+ *
+ * Note that the links are added to the head of the list so that r->end->p1
+ * always points to the most recently added follow-link. At the end, it should
+ * point to the last reference found in the grammar (starting from the 1st rule).
+ */
+void
+#ifdef __USE_PROTOS
+addFoLink( Node *p, char *rname, Junction *r )
+#else
+addFoLink( p, rname, r )
+Node *p;
+char *rname;
+Junction *r;
+#endif
+{
+ Junction *j;
+ require(r!=NULL, "addFoLink: incorrect rule graph");
+ require(r->end!=NULL, "addFoLink: incorrect rule graph");
+ require(r->end->jtype==EndRule, "addFoLink: incorrect rule graph");
+ require(p!=NULL, "addFoLink: NULL FOLLOW link");
+
+ j = newJunction();
+ j->rname = rname; /* rname on follow links point to target rule */
+ j->p1 = p; /* link to other rule */
+ j->p2 = (Node *) r->end->p1;/* point to head of list */
+ r->end->p1 = (Node *) j; /* reset head to point to new node */
+}
+
+void
+#ifdef __USE_PROTOS
+GenCrossRef( Junction *p )
+#else
+GenCrossRef( p )
+Junction *p;
+#endif
+{
+ set a;
+ Junction *j;
+ RuleEntry *q;
+ unsigned e;
+ require(p!=NULL, "GenCrossRef: why are you passing me a null grammar?");
+
+ printf("Cross Reference:\n\n");
+ a = empty;
+ for (; p!=NULL; p = (Junction *)p->p2)
+ {
+ printf("Rule %20s referenced by {", p->rname);
+ /* make a set of rules for uniqueness */
+ for (j = (Junction *)(p->end)->p1; j!=NULL; j = (Junction *)j->p2)
+ {
+ q = (RuleEntry *) hash_get(Rname, j->rname);
+ require(q!=NULL, "GenCrossRef: FoLinks are screwed up");
+ set_orel(q->rulenum, &a);
+ }
+ for (; !set_nil(a); set_rm(e, a))
+ {
+ e = set_int(a);
+ printf(" %s", RulePtr[e]->rname);
+ }
+ printf(" }\n");
+ }
+ set_free( a );
+}
+
+/*
+ The single argument is a pointer to the start of an element of a
+ C++ style function prototypet list. Given a pointer to the start of
+ an formal we must locate the comma (or the end of the string)
+ and locate the datatype, formal name, and initial value expression.
+
+ The function returns a pointer to the character following the comma
+ which terminates the formal declaration, or a pointer to the end of
+ the string if none was found.
+
+ I thought we were parsing specialists, how come I'm doing this by
+ hand written code ?
+
+ Examples of input:
+
+ Foo f,
+ Foo f = Foo(1),
+ Foo f = Foo(1,2),
+ Foo f = &farray[1,2],
+ Foo f = ",",
+ Foo f = ',',
+ TFoo<int,char> f = TFoo<int,char>(1,2),
+
+ A non-zero value for nesting indicates a problem matching '(' and ')',
+ '[' and ']', '<' and '>', '{' and '}', or improperly terminated string
+ or character literal.
+
+*/
+
+
+/*
+ * Don't care if it is a valid string literal or not, just find the end
+ * Start with pointer to leading "\""
+ */
+
+#ifdef __USE_PROTOS
+char * skipStringLiteral(char *pCurrent)
+#else
+char * skipStringLiteral(pCurrent)
+char *pCurrent;
+#endif
+{
+ char *p = pCurrent;
+ if (*p == 0) return p;
+ require (*p == '\"', "skipStringLiteral")
+ p++;
+ for (p = p; *p != 0; p++) {
+ if (*p == '\\') {
+ p++;
+ if (*p == 0) break;
+ p++;
+ }
+ if (*p == '\"') {
+ p++;
+ break;
+ }
+ }
+ return p;
+}
+
+/*
+ * Don't care if it is a valid character literal or not, just find the end
+ * Start with pointer to leading "'"
+ */
+
+#ifdef __USE_PROTOS
+char * skipCharLiteral(char *pStart)
+#else
+char * skipCharLiteral(pStart)
+ char *pStart;
+#endif
+{
+ char *p = pStart;
+ if (*p == 0) return p;
+ require (*p == '\'', "skipCharLiteral")
+ p++;
+ for (p = p; *p != 0; p++) {
+ if (*p == '\\') {
+ p++;
+ if (*p == 0) break;
+ p++;
+ }
+ if (*p == '\'') {
+ p++;
+ break;
+ }
+ }
+ return p;
+}
+
+#ifdef __USE_PROTOS
+char * skipSpaces(char *pStart)
+#else
+char * skipSpaces(pStart)
+char * pStart;
+#endif
+{
+ char *p = pStart;
+ while (*p != 0 && isspace(*p)) p++;
+ return p;
+}
+
+#ifdef __USE_PROTOS
+char * skipToSeparatorOrEqualSign(char *pStart, int *pNest)
+#else
+char * skipToSeparatorOrEqualSign(pStart, pNest)
+char *pStart;
+int *pNest;
+#endif
+{
+ char *p = pStart;
+
+ int nest = 0;
+
+ *pNest = (-1);
+
+ while (*p != 0) {
+ switch (*p) {
+
+ case '(' :
+ case '[' :
+ case '<' :
+ case '{' :
+ nest++;
+ p++;
+ break;
+
+ case ')' :
+ case ']' :
+ case '>' :
+ case '}' :
+ nest--;
+ p++;
+ break;
+
+ case '"' :
+ p = skipStringLiteral(p);
+ break;
+
+ case '\'' :
+ p = skipCharLiteral(p);
+ break;
+
+ case '\\':
+ p++;
+ if (*p == 0) goto EXIT;
+ p++;
+ break;
+
+ case ',':
+ case '=':
+ if (nest == 0) goto EXIT;
+ p++;
+ break;
+
+ default:
+ p++;
+ }
+ }
+EXIT:
+ *pNest = nest;
+ return p;
+}
+
+#ifdef __USE_PROTOS
+char * skipToSeparator(char *pStart, int *pNest)
+#else
+char * skipToSeparator(pStart, pNest)
+char *pStart;
+int *pNest;
+#endif
+{
+ char * p = pStart;
+ for ( ; ; ) {
+ p = skipToSeparatorOrEqualSign(p, pNest);
+ if (*pNest != 0) return p;
+ if (*p == ',') return p;
+ if (*p == 0) return p;
+ p++;
+ }
+}
+
+/* skip to just past the "=" separating the declaration from the initialization value */
+
+#ifdef __USE_PROTOS
+char * getInitializer(char *pStart)
+#else
+char * getInitializer(pStart)
+char * pStart;
+#endif
+{
+ char *p;
+ char *pDataType;
+ char *pSymbol;
+ char *pEqualSign;
+ char *pValue;
+ char *pSeparator;
+ int nest = 0;
+
+ require(pStart!=NULL, "getInitializer: invalid string");
+
+ p = endFormal(pStart,
+ &pDataType,
+ &pSymbol,
+ &pEqualSign,
+ &pValue,
+ &pSeparator,
+ &nest);
+ if (nest != 0) return NULL;
+ if (pEqualSign == NULL) return NULL;
+ if (pValue == NULL) return NULL;
+ return strBetween(pValue, NULL, pSeparator);
+}
+
+/*
+ Examines the string from pStart to pEnd-1.
+ If the string has 0 length or is entirely white space
+ returns 1. Otherwise 0.
+*/
+
+#ifdef __USE_PROTOS
+int isWhiteString(const char *pStart, const char *pEnd)
+#else
+int isWhiteString(pStart, pEnd)
+const char *pStart;
+const char *pEnd;
+#endif
+{
+ const char *p;
+ for (p = pStart; p < pEnd; p++) {
+ if (! isspace(*p)) return 0;
+ }
+ return 1;
+}
+
+/*
+ This replaces HasComma() which couldn't distinguish
+
+ foo ["a,b"]
+
+ from:
+
+ foo[a,b]
+
+*/
+
+#ifdef __USE_PROTOS
+int hasMultipleOperands(char *pStart)
+#else
+int hasMultipleOperands(pStart)
+char *pStart;
+#endif
+{
+ char *p = pStart;
+ int nest = 0;
+
+ p = skipSpaces(p);
+ if (*p == 0) return 0;
+ p = skipToSeparator(p, &nest);
+ if (nest == 0 && *p == ',') return 1;
+ return 0;
+}
+
+
+#define MAX_STR_BETWEEN_WORK_AREA 1000
+
+static char strBetweenWorkArea[MAX_STR_BETWEEN_WORK_AREA];
+
+
+/*
+ strBetween(pStart, pNext, pStop)
+
+ Creates a null terminated string by copying the text between two pointers
+ to a work area. The start of the string is pStart. The end of the string
+ is the character before pNext, or if pNext is null then the character before
+ pStop. Trailing spaces are not included in the copy operation.
+
+ This is used when a string contains several parts. The pNext part may be
+ optional. The pStop will stop the scan when the optional part is not present
+ (is a null pointer).
+*/
+
+#ifdef __USE_PROTOS
+char *strBetween(char *pStart, char *pNext, char *pStop)
+#else
+char *strBetween(pStart, pNext, pStop)
+char *pStart;
+char *pNext;
+char *pStop;
+#endif
+{
+ char *p;
+ char *q = strBetweenWorkArea;
+ const char *pEnd;
+
+ pEnd = (pNext != NULL) ? pNext : pStop;
+
+ require (pEnd != NULL, "pEnd == NULL");
+ require (pEnd >= pStart, "pEnd < pStart");
+ for (pEnd--; pEnd >= pStart; pEnd--) { /* MR31 */
+ if (! isspace(*pEnd)) break;
+ }
+ for (p = pStart;
+ p <= pEnd && q < &strBetweenWorkArea[MAX_STR_BETWEEN_WORK_AREA-2];
+ p++, q++) {
+ *q = *p;
+ }
+ *q = 0;
+ return strBetweenWorkArea;
+}
+
+/*
+ function Returns pointer to character following separator at
+ value which to continue search for next formal. If at the
+ end of the string a pointer to the null byte at the
+ end of the string is returned.
+
+ pStart Pointer to the starting position of the formal list
+
+ This may be the middle of a longer string, for example
+ when looking for the end of formal #3 starting from
+ the middle of the complete formal list.
+
+ ppDataType Returns a pointer to the start of the data type in the
+ formal. Example: pointer to "Foo".
+
+ ppSymbol Returns a pointer to the start of the formal symbol.
+ Example: pointer to "f".
+
+ ppEqualSign Returns a pointer to the equal sign separating the
+ formal symbol from the initial value. If there is
+ no "=" then this will be NULL.
+
+ ppValue Returns a pointer to the initial value part of the
+ formal declaration. Example: pointer to "&farray[1,2]"
+
+ ppSeparator Returns a pointer to the character which terminated the
+ scan. This should be a pointer to a comma or a null
+ byte which terminates the string.
+
+ pNest Returns the nesting level when a separator was found.
+ This is non-zero for any kind of error. This is zero
+ for a successful parse of this portion of the formal
+ list.
+
+*/
+
+#ifdef __USE_PROTOS
+char * endFormal(char *pStart,
+ char **ppDataType,
+ char **ppSymbol,
+ char **ppEqualSign,
+ char **ppValue,
+ char **ppSeparator,
+ int *pNest)
+#else
+char * endFormal(pStart,
+ ppDataType,
+ ppSymbol,
+ ppEqualSign,
+ ppValue,
+ ppSeparator,
+ pNest)
+char *pStart;
+char **ppDataType;
+char **ppSymbol;
+char **ppEqualSign;
+char **ppValue;
+char **ppSeparator;
+int *pNest;
+
+#endif
+{
+ char *p = pStart;
+ char *q;
+
+ *ppDataType = NULL;
+ *ppSymbol = NULL;
+ *ppEqualSign = NULL;
+ *ppValue = NULL;
+ *ppSeparator = NULL;
+
+ *pNest = 0;
+
+ /* The first non-blank is the start of the datatype */
+
+ p = skipSpaces(p);
+ if (*p == 0) goto EXIT;
+ *ppDataType = p;
+
+ /* We are not looking for the symbol, we are looking
+ for the separator that follows the symbol. Then
+ we'll back up.
+
+ Search for the ',' or '=" or null terminator.
+ */
+
+ p = skipToSeparatorOrEqualSign(p, pNest);
+
+ if (*pNest != 0) goto EXIT;
+
+ /*
+ Work backwards to find start of symbol
+ Skip spaces between the end of symbol and separator
+ Assume that there are no spaces in the formal, but
+ there is a space preceding the formal
+ */
+
+ for (q = &p[-1]; q >= *ppDataType; q--) {
+ if (! isspace(*q)) break;
+ }
+ if (q < *ppDataType) goto EXIT;
+
+ /*
+ MR26 Handle things like: IIR_Bool (IIR_Decl::*constraint)()
+ Backup until we hit the end of a symbol string, then find the
+ start of the symbol string. This wont' work for functions
+ with prototypes, but works for the most common cases. For
+ others, use typedef names.
+ */
+
+/* MR26 */ for (q = q; q >= *ppDataType; q--) {
+/* MR26 */ if (isalpha(*q) || isdigit(*q) || *q == '_' || *q == '$') break;
+/* MR26 */ }
+/* MR26 */ if (q < *ppDataType) goto EXIT;
+
+ for (q = q; q >= *ppDataType; q--) {
+ if ( ! (isalpha(*q) || isdigit(*q) || *q == '_' || *q == '$')) break;
+ }
+
+ *ppSymbol = &q[1];
+
+ if (*p == ',' || *p == 0) {
+ *ppSeparator = p;
+ goto EXIT;
+ }
+
+ *ppEqualSign = p;
+ p = skipSpaces(++p);
+ *ppValue = p;
+ if (*p == 0) goto EXIT;
+
+
+ while (*p != 0 && *pNest == 0 && *p != ',') {
+ p = skipToSeparator(p, pNest);
+ }
+ if (*pNest == 0) *ppSeparator = p;
+
+EXIT:
+ if (*p == ',') p++;
+ return p;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/mode.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/mode.h
new file mode 100644
index 000000000..c08bf31ac
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/mode.h
@@ -0,0 +1,12 @@
+#define START 0
+#define STRINGS 1
+#define ACTION_STRINGS 2
+#define ACTION_CHARS 3
+#define ACTION_COMMENTS 4
+#define TOK_DEF_COMMENTS 5
+#define TOK_DEF_CPP_COMMENTS 6
+#define ACTION_CPP_COMMENTS 7
+#define CPP_COMMENTS 8
+#define COMMENTS 9
+#define ACTIONS 10
+#define PARSE_ENUM_FILE 11
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/mrhoist.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/mrhoist.c
new file mode 100644
index 000000000..b57f5ded8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/mrhoist.c
@@ -0,0 +1,3030 @@
+/*
+ * mrhoist.c
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33MR10
+ *
+ */
+
+#include <stdio.h>
+
+#include "pcctscfg.h"
+
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#include "dlgdef.h"
+#include <ctype.h>
+
+#ifdef __USE_PROTOS
+void dumppred(Predicate *);
+#else
+void dumppred();
+#endif
+
+/*
+ Try to determine whether predicate "first" is true for
+ all cases where "second" is true. Comparison takes place
+ without regard to context.
+ Assumes that predicate symbols have been expanded.
+ Assumes that there are no NAND or NOR nodes
+
+*/
+
+#ifdef __USE_PROTOS
+int MR_secondPredicateUnreachable(Predicate *first,Predicate *second)
+#else
+int MR_secondPredicateUnreachable(first,second)
+ Predicate *first;
+ Predicate *second;
+#endif
+{
+ Predicate *f;
+ Predicate *s;
+
+ if (first == NULL) {
+ return 1;
+ } else if (second == NULL) {
+ return 0;
+ } else if (first->down == NULL && second->down == NULL) {
+ if (first->source == second->source &&
+ first->inverted == second->inverted) {
+ return 1; /* look identical - will never reach alt2 */
+ } else {
+ return 0; /* look different */
+ };
+ } else if (first->down == NULL && second->down != NULL) {
+
+ if (second->expr == PRED_AND_LIST) {
+
+ /* unreachable if first covers any child of second */
+
+ for (s=second->down; s != NULL; s=s->right) {
+ if (MR_secondPredicateUnreachable(first,s)) {
+ return 1;
+ };
+ };
+ return 0;
+ } else if (second->expr == PRED_OR_LIST) {
+
+ /* unreachable if first covers every child of second */
+
+ for (s=second->down; s != NULL; s=s->right) {
+ if (!MR_secondPredicateUnreachable(first,s)) {
+ return 0;
+ };
+ };
+ return 1;
+ } else {
+ require (0,"Illegal pred->expr");
+ return 0; /* MR20 Make compiler happy */
+ };
+ } else if (first->down != NULL && second->down == NULL) {
+ if (first->expr == PRED_AND_LIST) {
+
+ /* unreachable if every child of first covers second */
+
+ for (f=first->down; f != NULL; f=f->right) {
+ if (!MR_secondPredicateUnreachable(f,second)) {
+ return 0;
+ };
+ };
+ return 1;
+ } else if (first->expr == PRED_OR_LIST) {
+
+ /* unreachable if any child of first covers second */
+
+ for (f=first->down; f != NULL; f=f->right) {
+ if (MR_secondPredicateUnreachable(f,second)) {
+ return 1;
+ };
+ };
+ return 0;
+ } else {
+ require (0,"Illegal predicate->expr");
+ return 0; /* MR20 Make compiler happy */
+ };
+ } else {
+
+ if (first->expr == PRED_AND_LIST && second->expr == PRED_AND_LIST) {
+
+ /* unreachable if each child of first covers at least one child of second */
+
+ for (f=first->down; f != NULL ; f=f->right) {
+ for (s=second->down; s != NULL ; s=s->right) {
+ if (MR_secondPredicateUnreachable(f,s)) goto A_next_f;
+ };
+ return 0;
+A_next_f:
+ continue;
+ };
+ return 1;
+
+ } else if (first->expr == PRED_AND_LIST && second->expr == PRED_OR_LIST) {
+
+ /* unreachable if each child of first covers ALL of second's children */
+
+ for (f=first->down; f != NULL ; f=f->right) {
+ for (s=second->down; s != NULL ; s=s->right) {
+ if (!MR_secondPredicateUnreachable(f,s)) return 0;
+ };
+ };
+ return 1;
+
+ } else if (first->expr == PRED_OR_LIST && second->expr == PRED_AND_LIST) {
+
+ /* unreachable if any child of second is covered by any child of first */
+
+ for (f=first->down; f != NULL ; f=f->right) {
+ for (s=second->down; s != NULL ; s=s->right) {
+ if (MR_secondPredicateUnreachable(f,s)) return 1;
+ };
+ };
+ return 0;
+
+ } else if (first->expr == PRED_OR_LIST && second->expr == PRED_OR_LIST) {
+
+ /* unreachable if every child of second is covered by some child of first */
+
+ for (f=first->down; f != NULL ; f=f->right) {
+ for (s=second->down; s != NULL ; s=s->right) {
+ if (MR_secondPredicateUnreachable(f,s)) goto B_next_f;
+ };
+ return 0;
+B_next_f:
+ continue;
+ };
+ return 1;
+
+ } else {
+ require (0,"Illegal predicate->expr");
+ return 0; /* MR20 Make compiler happy */
+ };
+ };
+ return 0; /* MR20 MSVC 5.0 complains about missing return statement */
+}
+
+#ifdef __USE_PROTOS
+void MR_xxxIndent(FILE *f,int depth)
+#else
+void MR_xxxIndent(f,depth)
+ FILE *f;
+ int depth;
+#endif
+{
+ int i;
+
+ for (i=0; i<depth ; i++) {
+ fprintf(f," ");
+ };
+}
+
+#ifdef __USE_PROTOS
+void MR_stderrIndent(int depth)
+#else
+void MR_stderrIndent(depth)
+ int depth;
+#endif
+{
+ MR_xxxIndent(stderr,depth);
+}
+
+#ifdef __USE_PROTOS
+void MR_outputIndent(int depth)
+#else
+void MR_outputIndent(depth)
+ int depth;
+#endif
+{
+ MR_xxxIndent(output,depth);
+}
+
+#ifdef __USE_PROTOS
+void MR_set_reuse(set *s)
+#else
+void MR_set_reuse(s)
+ set *s;
+#endif
+{
+ set_free(*s);
+ *s=empty;
+}
+
+#ifdef __USE_PROTOS
+void MR_dumpPredRuleRefStack(FILE *iounit,int indent)
+#else
+void MR_dumpPredRuleRefStack(iounit,indent)
+ FILE *iounit;
+ int indent;
+#endif
+{
+ int i;
+ int j;
+ int count=MR_PredRuleRefStack.count;
+ RuleRefNode *rrn=NULL;
+ Junction *lastOne;
+
+ if (count == 0) {
+ fprintf(iounit,"empty\n");
+ return;
+ };
+ for (i=0; i < count; i++) {
+ rrn=(RuleRefNode *) MR_PredRuleRefStack.data[i];
+ for (j=0; j<indent; j++) fprintf(iounit," ");
+ fprintf(iounit,"#%-2d in rule %s (line %d %s) to rule %s\n",
+ i,rrn->rname,rrn->line,FileStr[rrn->file],rrn->text);
+ };
+ lastOne=MR_ruleReferenced(rrn);
+ if (lastOne != NULL) {
+ for (j=0; j<indent; j++) fprintf(iounit," ");
+ fprintf(iounit,"#%-2d in rule %s (line %d %s)\n",
+ count,lastOne->rname,lastOne->line,FileStr[lastOne->file]);
+ };
+}
+
+#ifdef __USE_PROTOS
+void MR_dumpTreeF(FILE *f,int depth,Tree *tree,int across)
+#else
+void MR_dumpTreeF(f,depth,tree,across)
+ FILE *f;
+ Tree *tree;
+ int depth;
+ int across;
+#endif
+{
+ int newAcross=across;
+
+ if (tree == NULL ) return;
+ if (tree->down != NULL ) {
+ fprintf(output,"\n");
+ MR_outputIndent(depth);
+ fprintf(output, "(root =");
+ };
+ if (tree->token == ALT ) {
+ fprintf(output," %-16s","Alt");
+ } else if (tree->token==EpToken ) {
+ fprintf(output,"(%d)%13s",tree->v.rk," ");
+ } else {
+ fprintf(output," %-16s",TerminalString(tree->token));
+ };
+ if (tree->down != NULL) {
+ fprintf(output,"\n");
+ MR_outputIndent(depth+1);
+ MR_dumpTreeF(f,depth+1,tree->down,1);
+ newAcross=0;
+ fprintf(output,"\n");
+ MR_outputIndent(depth);
+ fprintf(output,")");
+ };
+ if (newAcross > 3) {
+ fprintf(output,"\n");
+ MR_outputIndent(depth);
+ newAcross=0;
+ };
+ MR_dumpTreeF(f,depth,tree->right,newAcross+1);
+}
+
+#ifdef __USE_PROTOS
+void MR_dumpTreeX(int depth,Tree *tree,int across)
+#else
+void MR_dumpTreeX(depth,tree,across)
+ Tree *tree;
+ int depth;
+ int across;
+#endif
+{
+ MR_dumpTreeF(output,depth,tree,across);
+}
+
+#ifdef __USE_PROTOS
+void MR_dumpTokenSet(FILE *f,int depth,set s)
+#else
+void MR_dumpTokenSet(f,depth,s)
+ FILE *f;
+ int depth;
+ set s;
+#endif
+{
+ int i;
+ int j;
+
+ unsigned *pdq;
+
+ if (set_nil(s)) {
+ fprintf(f,"\n");
+ MR_xxxIndent(f,depth+1);
+ fprintf(f,"nil\n");
+ return;
+ };
+
+ pdq=set_pdq(s);
+ require(pdq != NULL,"set_pdq failed");
+ i=0;
+ for (i=0 ; ; i=i+4) {
+ fprintf(f,"\n");
+ MR_xxxIndent(f,depth+1);
+ for (j=0; j < 4 ; j++) {
+ if (pdq[i+j] == nil) break;
+ fprintf(f," %-16s",TerminalString(pdq[i+j]));
+ };
+ if (pdq[i+j] == nil) break;
+ };
+ fprintf(f,"\n");
+ free( (char *) pdq);
+}
+
+#ifdef __USE_PROTOS
+void MR_dumpPred1(int depth,Predicate *p,int withContext)
+#else
+void MR_dumpPred1(depth,p,withContext)
+ int depth;
+ Predicate *p;
+ int withContext;
+#endif
+{
+ unsigned k;
+
+ if (p == NULL) {
+ MR_outputIndent(depth);
+ fprintf(output,"The predicate is empty (or always true)\n\n");
+ return;
+ };
+ if (p->down != NULL) {
+ MR_outputIndent(depth);
+ if (p->inverted) {
+
+ /* MR14a Left out print expression in fprintf
+ Reported by Manuel Kessler (mlkessle@cip.physik.uni-wuerzburg.de)
+ */
+
+ if (p->expr == PRED_AND_LIST) fprintf(output,"%s NAND (not AND) expr\n\n",p->expr);
+ if (p->expr == PRED_OR_LIST) fprintf(output,"%s NOR (not OR) expr\n\n",p->expr);
+ } else {
+ fprintf(output,"%s expr\n\n",p->expr);
+ };
+ } else {
+ MR_outputIndent(depth);
+ fprintf(output,"pred %s <<%s>>?\n",
+ (p->inverted ? " *not*" : ""),
+ (p->expr == NULL ? "null expr" : p->expr));
+ MR_outputIndent(depth+1);
+ fprintf(output," ");
+ fprintf(output," depth=k=%d",p->k);
+ if (p->source != NULL && p->source->guardpred) {
+ fprintf(output," (\"=>\" guard)");
+ }
+ if (p->source != NULL && p->source->ampersandPred != NULL) {
+ fprintf(output," (\"&&\" guard)");
+ };
+ k=set_int(p->completionSet);
+ if (k != nil) {
+ fprintf(output," Incomplete Set at k=%d !",k);
+ };
+ k=set_int(p->completionTree);
+ if (k != nil) {
+ fprintf(output," Incomplete Tree at k=%d !",k);
+ };
+ if (p->source != NULL) {
+ fprintf(output," rule %s line %d %s",
+ p->source->rname,p->source->line,FileStr[p->source->file]);
+ };
+ fprintf(output,"\n");
+ if (withContext &&
+ (HoistPredicateContext ||
+ ! set_nil(p->scontext[1]) ||
+ p->tcontext != NULL)) {
+ if (p->k == 1) {
+ MR_outputIndent(depth+1);
+ fprintf(output,"set context: ");
+ MR_dumpTokenSet(output,depth+1,p->scontext[1]);
+ }
+ if (p->k != 1) {
+ MR_outputIndent(depth+1);
+ fprintf(output,"tree context:");
+ if (p->tcontext == NULL) {
+ fprintf(output," null");
+ } else {
+ MR_dumpTreeX(depth+2,p->tcontext,0);
+ };
+ fprintf(output,"\n");
+ };
+ };
+ fprintf(output,"\n");
+ };
+ if (p->down != NULL) {
+ MR_dumpPred1(depth+1,p->down,withContext);
+ };
+ if (p->right != NULL) {
+ MR_dumpPred1(depth,p->right,withContext);
+ };
+}
+
+#ifdef __USE_PROTOS
+void MR_dumpPred(Predicate *p,int withContext)
+#else
+void MR_dumpPred(p,withContext)
+ Predicate *p;
+ int withContext;
+#endif
+{
+ MR_dumpPred1(0,p,withContext);
+}
+
+#ifdef __USE_PROTOS
+Tree * MR_make_tree_from_set(set s)
+#else
+Tree * MR_make_tree_from_set(s)
+ set s;
+#endif
+{
+ Tree *t=NULL;
+ Tree *node;
+ Tree **tp=&t;
+ int i;
+
+ unsigned *pdq=set_pdq(s);
+
+ if (pdq != NULL) {
+ for (i=0 ; pdq[i] != nil ; i++) {
+ node=tnode( (int) pdq[i]);
+ *tp=node;
+ tp=&(node->right);
+ };
+ *tp=NULL;
+ free ( (char *) pdq);
+ };
+ return t;
+}
+
+#ifdef __USE_PROTOS
+void MR_check_pred_too_long(Predicate *p,set completion)
+#else
+void MR_check_pred_too_long(p,completion)
+ Predicate *p;
+ set completion;
+#endif
+{
+ if (p != NULL &&
+ p->source != NULL &&
+ ! p->source->predTooLong) {
+ if ( !set_nil(completion)) {
+ p->source->predTooLong=1;
+warnFL("It is unusual (but ok) for a semantic predicate to test context past the end of its own rule",
+ FileStr[p->source->file],p->source->line);
+ };
+ };
+}
+
+#ifdef __USE_PROTOS
+int MR_predicate_context_completed(Predicate *p)
+#else
+int MR_predicate_context_completed(p)
+ Predicate *p;
+#endif
+{
+ if (p == NULL) return 1;
+ if (p->expr != PRED_AND_LIST &&
+ p->expr != PRED_OR_LIST) {
+ if ( ! set_nil(p->completionSet)) return 0;
+ if ( ! set_nil(p->completionTree)) return 0;
+ };
+ return MR_predicate_context_completed(p->down) &
+ MR_predicate_context_completed(p->right);
+}
+
+#ifdef __USE_PROTOS
+Node * MR_advance(Node *n)
+#else
+Node * MR_advance(n)
+ Node *n;
+#endif
+{
+ if (n == NULL) return NULL;
+ switch (n->ntype) {
+ case nJunction: return ((Junction *)n)->p1;
+ case nToken: return ((TokNode *)n)->next;
+ case nRuleRef: return ((RuleRefNode *)n)->next;
+ case nAction: return ((ActionNode *)n)->next;
+ default: return NULL;
+ };
+ return NULL; /* MSVC 5.0 complains about missing return statement */
+}
+
+#ifdef __USE_PROTOS
+Junction * MR_find_endRule(Node *n)
+#else
+Junction * MR_find_endRule(n)
+ Node *n;
+#endif
+{
+ Node *next;
+ if (n == NULL) return NULL;
+ for (next=n; next != NULL; next=MR_advance(next)) {
+ if (next->ntype == nJunction &&
+ ( (Junction *) next)->jtype == EndRule) {
+ break;
+ };
+ };
+ return (Junction *)next;
+}
+
+/*
+ Intersection: a branch which is shorter is chosen
+ over one which is longer: (A B C) intersect (A B) yields (A B).
+
+ AND: a branch which is longer is chosen over the one
+ which is shorter: (A B C) AND (A B) yields (A B C)
+
+*/
+
+#ifdef __USE_PROTOS
+Tree *MR_computeTreeIntersection(Tree *l,Tree *r)
+#else
+Tree *MR_computeTreeIntersection(l,r)
+ Tree *l;
+ Tree *r;
+#endif
+{
+ Tree *result=NULL;
+ Tree **tail;
+ Tree *p;
+ Tree *q;
+ Tree *match;
+
+ if (l == NULL || r == NULL) return NULL;
+ for (p=l; p != NULL; p=p->right) {
+ require(p->token != EpToken,"MR_computeTreeIntersection: p->EpToken unexpected\n");
+ require (p->token != ALT,"MR_computeTreeIntersection: p->ALT unexpected\n");
+ };
+ for (q=r; q != NULL; q=q->right) {
+ require(q->token != EpToken,"MR_computeTreeIntersection: q->EpToken unexpected\n");
+ require(q->token != ALT,"MR_computeTreeIntersection: q->ALT unexpected\n");
+ };
+
+ result=tnode(ALT);
+ tail=&(result->down);
+
+ for (p=l; p != NULL ; p=p->right) {
+ for (q=r; q != NULL ; q=q->right) {
+ if (p->token == q->token) {
+ match=tnode(p->token);
+ match->down=MR_computeTreeIntersection(p->down,q->down);
+ *tail=match;
+ tail=&(match->right);
+ };
+ };
+ };
+
+ *tail=NULL;
+ result=tshrink(result);
+ result=tflatten( result );
+ result=tleft_factor( result );
+ return result;
+}
+
+/* the predicates which are ANDed together have a common
+ context: they must all have common roots. Thus the
+ AND operation is more like an OR operation because
+ branches which are longer are grafted onto shorter
+ branches of the AND tree. For instance combining
+ (A B C) with (A B C D) gives (A B C D). There
+ should never be a case of (A B C) and (A B D) because
+ they have the same context.
+
+ Actually, this may not be true once one throws in
+ guard predicates which are defined by the user, not
+ the context.
+*/
+
+/* requires input trees to be in "canonical" format */
+
+#ifdef __USE_PROTOS
+Tree *MR_computeTreeAND(Tree *l,Tree *r)
+#else
+Tree *MR_computeTreeAND(l,r)
+ Tree *l;
+ Tree *r;
+#endif
+{
+ Tree *result=NULL;
+ Tree **tail;
+ Tree *p;
+ Tree *q;
+ Tree *match;
+
+ if (l == NULL) return tdup(r);
+ if (r == NULL) return tdup(l);
+
+ for (p=l; p != NULL; p=p->right) {
+/**** require(p->token != EpToken,"MR_computeTreeAND: p->EpToken unexpected\n"); ****/
+ require (p->token != ALT,"MR_computeTreeAND: p->ALT unexpected\n");
+ };
+ for (q=r; q != NULL; q=q->right) {
+/**** require(q->token != EpToken,"MR_computeTreeAND: q->EpToken unexpected\n"); ****/
+ require(q->token != ALT,"MR_computeTreeAND: q->ALT unexpected\n");
+ };
+
+ result=tnode(ALT);
+ tail=&(result->down);
+
+ for (p=l; p != NULL ; p=p->right) {
+ for (q=r; q != NULL ; q=q->right) {
+ if (p->token == q->token) {
+ match=tnode(p->token);
+ match->down=MR_computeTreeAND(p->down,q->down);
+ *tail=match;
+ tail=&(match->right);
+ };
+ };
+ };
+
+ *tail=NULL;
+ result=tshrink(result);
+ result=tflatten( result );
+ result=tleft_factor( result );
+ return result;
+}
+
+#ifdef __USE_PROTOS
+void MR_union_plain_sets1(Predicate *p,set *theUnion)
+#else
+void MR_union_plain_sets1(p,theUnion)
+ Predicate *p;
+ set *theUnion;
+#endif
+{
+ if (p == NULL) return;
+ MR_union_plain_sets1(p->down,theUnion);
+ MR_union_plain_sets1(p->right,theUnion);
+ set_orin(theUnion,p->plainSet);
+ return;
+}
+
+#ifdef __USE_PROTOS
+set MR_union_plain_sets(Predicate *p)
+#else
+set MR_union_plain_sets(p)
+ Predicate *p;
+#endif
+{
+ set theUnion;
+
+ theUnion=empty;
+
+ MR_union_plain_sets1(p,&theUnion);
+ return theUnion;
+}
+
+/* does NOT left factor: do not want to merge
+ (A B) with (A) to get (A B)
+ in fact the opposite: (A B) with (A) gives (A)
+*/
+
+#ifdef __USE_PROTOS
+Tree *MR_compute_pred_tree_ctxXX(Predicate *p)
+#else
+Tree *MR_compute_pred_tree_ctxXX(p)
+ Predicate *p;
+#endif
+{
+ Tree *result=NULL;
+ Predicate *q;
+ Tree *t;
+
+ if (p == NULL) return NULL;
+
+/* this appears strange: why do we OR the context
+ of and AND predicate ? It is because of the way
+ that predicates are evaluated: if the context is
+ wrong then it's the same as if the predicate was
+ true. That means that even when one leg of an
+ AND has unmatched context, if the other leg has
+ matched context and is true then the predicate
+ succeeds. It's only when all the legs have unmatched
+ context that this one can skip evaluation of the
+ predicates.
+*/
+ if (p->expr == PRED_OR_LIST ||
+ p->expr == PRED_AND_LIST) {
+ for (q=p->down; q != NULL ; q=q->right) {
+ t=MR_compute_pred_tree_ctxXX(q);
+ result=tappend(result,t);
+ t=NULL;
+ };
+
+ result=tshrink(result);
+ result=tflatten( result );
+
+/* does NOT left factor: do not want to merge
+ (A B) with (A) to get (A B)
+ in fact the opposite: (A B) with (A) gives (A)
+*/
+
+/**** result=tleft_factor( result ); ****/
+ return result;
+ };
+
+#if 0
+** if (p->expr == PRED_AND_LIST) {
+**
+** Predicate *l;
+** Predicate *r;
+** Tree *l1;
+** Tree *r1;
+** Tree *prevl1;
+**
+** l=p->down;
+** require (l->right != NULL,"MR_compute_pred_tree - AND has only one child");
+**
+**/* l1 and r1 should already be in "canonical" format */
+**
+** l1=MR_compute_pred_tree(l);
+** for (r=l->right; r != NULL; r=r->right) {
+** r1=MR_compute_pred_tree(r);
+** prevl1=l1;
+** l1=MR_computeTreeAND(l1,r1);
+** Tfree(r1);
+** Tfree(prevl1);
+** };
+**
+**/* result from computeTreeAND should be in "canonical" format */
+**
+** result=l1;
+**
+**/* result of MR_computeTreeAND should be in "canonical" format */
+**
+** return result;
+** };
+#endif
+
+ if (p->k == 1) {
+ result=MR_make_tree_from_set(p->scontext[1]);
+ } else {
+ result=tdup(p->tcontext);
+ result=MR_remove_epsilon_from_tree(result);
+ result=tshrink(result);
+ result=tflatten(result);
+ result=tleft_factor(result);
+ };
+ return result;
+}
+
+#ifdef __USE_PROTOS
+void MR_pred_depth(Predicate *p,int *maxDepth)
+#else
+void MR_pred_depth(p,maxDepth)
+ Predicate *p;
+ int *maxDepth;
+#endif
+{
+ if (p == NULL) return;
+ if (p->expr != PRED_OR_LIST &&
+ p->expr != PRED_AND_LIST) {
+ if (p->k > *maxDepth) *maxDepth=p->k;
+ };
+ MR_pred_depth(p->down,maxDepth);
+ MR_pred_depth(p->right,maxDepth);
+}
+
+/* this computes the OR of all the contexts */
+
+#ifdef __USE_PROTOS
+set MR_compute_pred_set(Predicate *p)
+#else
+set MR_compute_pred_set(p)
+ Predicate *p;
+#endif
+{
+ set result;
+ Predicate *q;
+
+ result=empty;
+
+ if (p == NULL) return empty;
+
+ if (p->expr == PRED_OR_LIST ||
+ p->expr == PRED_AND_LIST) { /* yes, I do mean PRED_AND_LIST ! */
+ /* remember: r1: (A)? => <<p>>? r2; */
+ /* r2: (B)? => <<q>>? r3; */
+ set t;
+
+ t=empty;
+ result=empty;
+
+ for (q=p->down; q != NULL; q=q->right) {
+ t=MR_compute_pred_set(q);
+ set_orin(&result,t);
+ set_free(t);
+ };
+ return result;
+ } else if (p->k > 1) {
+ return empty;
+ } else {
+ return set_dup(p->scontext[1]);
+ };
+}
+
+#ifdef __USE_PROTOS
+set MR_First(int ck,Junction *j,set *incomplete)
+#else
+set MR_First(ck,j,incomplete)
+ int ck;
+ Junction *j;
+ set *incomplete;
+#endif
+{
+ Junction *p;
+ set tokensUsed;
+
+ tokensUsed=empty;
+
+ require(j->ntype==nJunction, "MR_First: non junction passed");
+
+ p = analysis_point((Junction *)j->p1);
+
+ REACH(p,ck,incomplete,tokensUsed);
+
+ return tokensUsed;
+}
+
+#ifdef __USE_PROTOS
+void MR_cleanup_pred_trees(Predicate *p)
+#else
+void MR_cleanup_pred_trees(p)
+ Predicate *p;
+#endif
+{
+ Tree *t;
+
+ if (p == NULL) return;
+ if (p->expr != PRED_OR_LIST &&
+ p->expr != PRED_AND_LIST) {
+ t=p->tcontext;
+ t=tshrink(t);
+ t=tflatten(t);
+ t=tleft_factor(t);
+ p->tcontext=t;
+ };
+ MR_cleanup_pred_trees(p->down);
+ MR_cleanup_pred_trees(p->right);
+}
+
+/* does NOT return canonical tree */
+
+#ifdef __USE_PROTOS
+Tree * MR_remove_epsilon_from_tree(Tree *t)
+#else
+Tree * MR_remove_epsilon_from_tree(t)
+ Tree *t;
+#endif
+{
+ if (t == NULL) return NULL;
+
+ /* I think ALT can be ignored as a special case */
+
+ if (t->token != EpToken) {
+ t->down=MR_remove_epsilon_from_tree(t->down);
+ t->right=MR_remove_epsilon_from_tree(t->right);
+ return t;
+ } else {
+ Tree *u;
+ u=MR_remove_epsilon_from_tree(t->right);
+ t->right=NULL;
+ Tfree(t);
+ return u;
+ };
+}
+
+#ifdef __USE_PROTOS
+void MR_complete_set(int predDepth,set *tokensUsed,set *incomplete)
+#else
+void MR_complete_set(predDepth,tokensUsed,incomplete)
+ int predDepth;
+ set *tokensUsed;
+ set *incomplete;
+#endif
+{
+ int i;
+ RuleRefNode *ruleRef;
+ set rk2;
+ set b;
+ int k2;
+ Junction *save_MR_RuleBlkWithHalt;
+
+ if (set_int(*incomplete) > (unsigned) predDepth) {
+ return;
+ };
+
+ require(MR_PredRuleRefStack.count == MR_RuleBlkWithHaltStack.count,
+ "RuleRefStack and RuleBlkWithHaltStack not same size");
+
+ require(MR_RuleBlkWithHalt == NULL ||
+ (MR_RuleBlkWithHalt->jtype == RuleBlk && MR_RuleBlkWithHalt->end->halt == TRUE),
+ "RuleBlkWithHalt has no halt set");
+
+ save_MR_RuleBlkWithHalt=MR_RuleBlkWithHalt;
+
+ if (MR_RuleBlkWithHalt != NULL) {
+ MR_RuleBlkWithHalt->end->halt=FALSE;
+ };
+
+ for (i=MR_PredRuleRefStack.count-1; i >= 0 ; i--) {
+ ruleRef=(RuleRefNode *)MR_PredRuleRefStack.data[i];
+ if (ruleRef == NULL) continue;
+
+ MR_RuleBlkWithHalt=(Junction *)MR_RuleBlkWithHaltStack.data[i];
+ if (MR_RuleBlkWithHalt != NULL) MR_RuleBlkWithHalt->end->halt=TRUE;
+
+ rk2=empty;
+ b=empty;
+
+ while ( !set_nil(*incomplete) ) {
+ k2=set_int(*incomplete);
+ if (k2 > predDepth) break; /* <=== another exit from loop */
+ set_rm(k2,*incomplete);
+ REACH(ruleRef->next,k2,&rk2,b);
+ set_orin(tokensUsed,b);
+ set_free(b);
+ };
+
+ if (MR_RuleBlkWithHalt != NULL) MR_RuleBlkWithHalt->end->halt=FALSE;
+
+ set_orin(incomplete,rk2); /* remember what we couldn't do */
+ set_free(rk2);
+ if (set_int(*incomplete) > (unsigned) predDepth) break; /* <=== another exit from loop */
+ };
+
+ MR_RuleBlkWithHalt=save_MR_RuleBlkWithHalt;
+ if (MR_RuleBlkWithHalt != NULL) {
+ MR_RuleBlkWithHalt->end->halt=TRUE;
+ };
+}
+
+#ifdef __USE_PROTOS
+void MR_complete_tree(int predDepth,Tree **t,set *incomplete)
+#else
+void MR_complete_tree(predDepth,t,incomplete)
+ int predDepth;
+ Tree **t;
+ set *incomplete;
+#endif
+{
+ int i;
+ RuleRefNode *ruleRef;
+ set rk2;
+ Tree *u;
+ unsigned k2;
+ Junction *save_MR_RuleBlkWithHalt;
+ int saveConstrainSearch;
+
+ if (set_int(*incomplete) > (unsigned) predDepth) {
+ return;
+ };
+
+ require(MR_PredRuleRefStack.count == MR_RuleBlkWithHaltStack.count,
+ "RuleRefStack and RuleBlkWithHaltStack not same size");
+
+ require(MR_RuleBlkWithHalt == NULL ||
+ (MR_RuleBlkWithHalt->jtype == RuleBlk && MR_RuleBlkWithHalt->end->halt == TRUE),
+ "RuleBlkWithHalt has no halt set");
+
+ save_MR_RuleBlkWithHalt=MR_RuleBlkWithHalt;
+ saveConstrainSearch=ConstrainSearch;
+ ConstrainSearch=0;
+
+ if (MR_RuleBlkWithHalt != NULL) {
+ MR_RuleBlkWithHalt->end->halt=FALSE;
+ };
+
+ for (i=MR_PredRuleRefStack.count-1; i >= 0 ; i--) {
+ ruleRef=(RuleRefNode *)MR_PredRuleRefStack.data[i];
+ if (ruleRef == NULL) continue;
+
+ MR_RuleBlkWithHalt=(Junction *)MR_RuleBlkWithHaltStack.data[i];
+
+ if (MR_RuleBlkWithHalt != NULL) MR_RuleBlkWithHalt->end->halt=TRUE;
+
+ rk2=empty;
+
+ while ( !set_nil(*incomplete) ) {
+ k2 = set_int(*incomplete);
+ if (k2 > (unsigned) predDepth) break; /* <=== another exit from loop */
+ set_rm(k2,*incomplete);
+ u = NULL;
+
+ TRAV(ruleRef->next,k2,&rk2,u);
+
+ /* any subtrees missing k2 tokens, add u onto end */
+
+ *t=tlink(*t,u,k2);
+ Tfree(u);
+ }
+
+ set_orin(incomplete,rk2); /* remember what we couldn't do */
+ set_free(rk2);
+
+ if (MR_RuleBlkWithHalt != NULL) MR_RuleBlkWithHalt->end->halt=FALSE;
+
+ if (set_int(*incomplete) > (unsigned) predDepth) break; /* <=== another exit from loop */
+ };
+
+ MR_RuleBlkWithHalt=save_MR_RuleBlkWithHalt;
+
+ if (MR_RuleBlkWithHalt != NULL) {
+ MR_RuleBlkWithHalt->end->halt=TRUE;
+ };
+ ConstrainSearch=saveConstrainSearch;
+}
+
+#ifdef __USE_PROTOS
+void MR_complete_predicates(int predDepth,Predicate *pred)
+#else
+void MR_complete_predicates(predDepth,pred)
+ int predDepth;
+ Predicate *pred;
+#endif
+{
+ if (pred == NULL) return;
+ if (pred->expr != PRED_AND_LIST &&
+ pred->expr != PRED_OR_LIST) {
+ MR_complete_set(predDepth,&(pred->scontext[1]),&(pred->completionSet));
+ MR_complete_tree(predDepth,&(pred->tcontext),&(pred->completionTree));
+ };
+ MR_complete_predicates(predDepth,pred->down);
+ MR_complete_predicates(predDepth,pred->right);
+}
+
+#ifdef __USE_PROTOS
+Junction * MR_junctionWithoutP2(Junction *j)
+#else
+Junction * MR_junctionWithoutP2(j)
+ Junction *j;
+#endif
+{
+ Junction *thisAlt;
+
+/* don't want to follow p2 to the next alternative of this rule */
+/* insert a generic node with null p2 if necessary */
+/* however FIRST requires a junction */
+
+ thisAlt=j;
+ if (thisAlt->p2 != NULL) {
+ if (thisAlt->p1->ntype == nJunction) {
+ thisAlt=(Junction *) thisAlt->p1;
+ } else {
+ thisAlt=newJunction();
+ thisAlt->p1=j->p1;
+ thisAlt->rname=j->rname;
+ thisAlt->file=j->file;
+ thisAlt->line=j->line;
+ j->p1=(Node *)thisAlt;
+ };
+ };
+ return thisAlt;
+}
+
+#ifdef __USE_PROTOS
+int MR_tree_equ(Tree *big, Tree *small) {
+#else
+int MR_tree_equ(big,small)
+ Tree *big;
+ Tree *small;
+{
+#endif
+
+ Tree *b;
+ Tree *s;
+ int bcount=0;
+ int scount=0;
+
+ if (small == NULL && big == NULL) return 1;
+ if (small == NULL) return 0;
+ if (big == NULL) return 0;
+
+ if (small->token == ALT) {
+ require(small->right == NULL,
+ "MR_tree_equ: small: ALT node has siblings");
+ return MR_tree_equ(big,small->down);
+ };
+ if (big->token == ALT) {
+ require(big->right == NULL,
+ "MR_tree_equ: big: ALT node has siblings");
+ return MR_tree_equ(big->down,small);
+ };
+ for (s=small; s != NULL; s=s->right) {
+ scount++;
+ require(s->token != EpToken,"MR_tree_equ: s->EpToken unexpected\n");
+ };
+ for (b=big; b != NULL; b=b->right) {
+ bcount++;
+ require(b->token != EpToken,"MR_tree_equ: b->EpToken unexpected\n");
+ };
+
+ if (bcount != scount) return 0;
+
+ for (s=small; s != NULL; s=s->right) {
+ for (b=big; b!= NULL; b=b->right) {
+ if (s->token == b->token) {
+ if (MR_tree_equ(b->down,s->down)) goto next_s;
+ };
+ };
+ return 0;
+next_s:
+ continue;
+ };
+ return 1;
+}
+
+/* this does not compare sources - only contexts ! */
+
+#ifdef __USE_PROTOS
+int MR_identicalContext(Predicate *p,Predicate *q)
+#else
+int MR_identicalContext(p,q)
+ Predicate *p;
+ Predicate *q;
+#endif
+{
+ if (p->k != q->k) return 0;
+ require ( (p->tcontext == NULL) == (q->tcontext == NULL),
+ "tcontext inconsistent");
+ if (p->k == 1) {
+ return set_equ(p->scontext[1],q->scontext[1]);
+ } else {
+ return MR_tree_equ(p->tcontext,q->tcontext);
+ };
+}
+
+#ifdef __USE_PROTOS
+void MR_reportSetSuppression(int predDepth,
+ set predSet,set plainSet,Junction *jPred,Junction *jPlain,Predicate *p)
+#else
+void MR_reportSetSuppression(predDepth,predSet,plainSet,jPred,jPlain,p)
+ int predDepth;
+ set predSet;
+ set plainSet;
+ Junction *jPred;
+ Junction *jPlain;
+ Predicate *p;
+#endif
+{
+ if (InfoP) {
+ fprintf(output,"\n#if 0\n\n");
+ fprintf(output,"Hoisting of predicate suppressed by alternative without predicate.\n");
+ fprintf(output,"The alt without the predicate includes all cases where the predicate is false.\n\n");
+ fprintf(output," WITH predicate: line %d %s\n",jPred->line,FileStr[jPred->file]);
+ if (jPlain != NULL) {
+ fprintf(output," WITHOUT predicate: line %d %s\n",jPlain->line,FileStr[jPlain->file]);
+ } else {
+ fprintf(output," WITHOUT predicate: all alternatives without predicates (combined)\n");
+ };
+ if (predDepth == 1) {
+ fprintf(output,"\nThe context set for the predicate:\n");
+ MR_dumpTokenSet(output,1,predSet);
+ };
+ fprintf(output,"\nThe lookahead set for the alt WITHOUT the semantic predicate:\n");
+ MR_dumpTokenSet(output,1,plainSet);
+ fprintf(output,"\nThe predicate:\n\n");
+ MR_dumpPred1(1,p,1);
+ fprintf(output,"Chain of referenced rules:\n\n");
+ MR_dumpPredRuleRefStack(output,4);
+ fprintf(output,"\n#endif\n");
+ };
+}
+
+#ifdef __USE_PROTOS
+void MR_reportSetRestriction(int predDepth,set predSet,set plainSet,
+ Junction *jPred,Junction *jPlain,Predicate *origPred,Predicate *newPred)
+#else
+void MR_reportSetRestriction(predDepth,predSet,plainSet,jPred,jPlain,origPred,newPred)
+ int predDepth;
+ set predSet;
+ set plainSet;
+ Junction *jPred;
+ Junction *jPlain;
+ Predicate *origPred;
+ Predicate *newPred;
+#endif
+{
+ set intersect;
+
+ intersect=empty;
+
+ if (! InfoP) return;
+ fprintf(output,"\n#if 0\n\n");
+ fprintf(output,"Restricting the context of a predicate because of overlap in the lookahead set\n");
+ fprintf(output," between the alternative with the semantic predicate and one without\n");
+ fprintf(output,"Without this restriction the alternative without the predicate could not\n");
+ fprintf(output," be reached when input matched the context of the predicate and the predicate\n");
+ fprintf(output," was false.\n\n");
+
+ fprintf(output," WITH predicate: line %d %s\n",jPred->line,FileStr[jPred->file]);
+ if (jPlain != NULL) {
+ fprintf(output," WITHOUT predicate: line %d %s\n",jPlain->line,FileStr[jPlain->file]);
+ } else {
+ fprintf(output," WITHOUT predicate: all alternatives without predicates (combined)\n");
+ };
+ if (predDepth == 1) {
+ fprintf(output,"\nThe original context set for the predicate:\n");
+ MR_dumpTokenSet(output,1,predSet);
+ };
+ fprintf(output,"\nThe lookahead set for the alt WITHOUT the semantic predicate:\n");
+ MR_dumpTokenSet(output,1,plainSet);
+ if (predDepth == 1) {
+ fprintf(output,"\nThe intersection of the two sets\n");
+ intersect=set_and(predSet,plainSet);
+ MR_dumpTokenSet(output,1,intersect);
+ set_free(intersect);
+ };
+ fprintf(output,"\nThe original predicate:\n\n");
+ MR_dumpPred1(1,origPred,1);
+ fprintf(output,"The new (modified) form of the predicate:\n\n");
+ MR_dumpPred1(1,newPred,1);
+ fprintf(output,"#endif\n");
+}
+
+/* don't use Pass3 by itself unless you know that inverted is not important */
+
+#ifdef __USE_PROTOS
+Predicate * MR_removeRedundantPredPass3(Predicate *p)
+#else
+Predicate * MR_removeRedundantPredPass3(p)
+ Predicate *p;
+#endif
+{
+ Predicate *q;
+
+ if (p == NULL) return NULL;
+ p->right=MR_removeRedundantPredPass3(p->right);
+ p->down=MR_removeRedundantPredPass3(p->down);
+ if (p->redundant) {
+ q=p->right;
+ p->right=NULL;
+ predicate_free(p);
+ return q;
+ };
+ if (p->expr == PRED_AND_LIST ||
+ p->expr == PRED_OR_LIST) {
+ if (p->down == NULL) {
+ q=p->right;
+ p->right=NULL;
+ predicate_free(p);
+ return q;
+ };
+ if (p->down != NULL && p->down->right == NULL) {
+ q=p->down;
+ q->right=p->right;
+ p->right=NULL;
+ p->down=NULL;
+ return q;
+ };
+ };
+ return p;
+}
+
+#ifdef __USE_PROTOS
+void MR_removeRedundantPredPass2(Predicate *p)
+#else
+void MR_removeRedundantPredPass2(p)
+ Predicate *p;
+#endif
+{
+ Predicate *q;
+
+ if (p == NULL) return;
+
+ if (p->expr == PRED_AND_LIST) {
+ for (q=p->down ; q != NULL ; q=q->right) {
+ MR_removeRedundantPredPass2(q);
+ if (q->isConst) {
+ if (q->constValue == 0) {
+ p->isConst=1;
+ p->constValue=0;
+ return;
+ } else {
+ q->redundant=1;
+ };
+ };
+ };
+ };
+
+ if (p->expr == PRED_OR_LIST) {
+ for (q=p->down ; q != NULL ; q=q->right) {
+ MR_removeRedundantPredPass2(q);
+ if (q->isConst) {
+ if (q->constValue == 0) {
+ q->redundant=1;
+ } else {
+ p->isConst=1;
+ p->constValue=1;
+ return;
+ };
+ };
+ };
+ };
+
+ return;
+}
+
+#if 0
+ this totally ignores the implications of guarded predicates
+ in which the part after the guard could possibly cover a predicate.
+ that would be much harder:
+
+ rule : (A)? => <<p>>? sub1; /* 1 */
+ | (B)? => <<r>>? sub2 /* 2 */
+ sub1 : (A)? => <<q>>? A B /* 3 */
+ | B /* 4 - suppresses line 2 */
+ ;
+#endif
+
+#ifdef __USE_PROTOS
+void MR_apply_restriction1(Predicate *pred,set *plainSet,int *changed)
+#else
+void MR_apply_restriction1(pred,plainSet,changed)
+ Predicate *pred;
+ set *plainSet;
+ int *changed;
+#endif
+{
+ if (pred == NULL) return;
+ MR_apply_restriction1(pred->right,plainSet,changed);
+ if (pred->down != NULL) {
+ MR_apply_restriction1(pred->down,plainSet,changed);
+ } else {
+ set t;
+ if (pred->k == 1) {
+ t=set_dif(pred->scontext[1],*plainSet);
+ if (*changed == 0 &&
+ !set_equ(t,pred->scontext[1])) {
+ *changed=1;
+ };
+ if (set_nil(t)) {
+ pred->redundant=1;
+ };
+ set_free(pred->scontext[1]);
+ pred->scontext[1]=t;
+ };
+ };
+}
+
+#ifdef __USE_PROTOS
+void MR_orin_plainSet(Predicate *p,set plainSet)
+#else
+void MR_orin_plainSet(p,plainSet)
+ Predicate *p;
+ set plainSet;
+#endif
+{
+ if (p == NULL) return;
+ MR_orin_plainSet(p->down,plainSet);
+ MR_orin_plainSet(p->right,plainSet);
+ set_orin(&p->plainSet,plainSet);
+}
+
+Predicate *PRED_SUPPRESS;
+
+#ifdef __USE_PROTOS
+Predicate * MR_find_in_aSubBlk(Junction *alt)
+#else
+Predicate * MR_find_in_aSubBlk(alt)
+ Junction *alt;
+#endif
+{
+ Predicate *root=NULL;
+ Predicate **tail=NULL;
+
+ Junction *p;
+
+ int nAlts=0;
+ Junction **jList;
+ Predicate **predList;
+ int *matchList;
+ set predSet;
+ int i;
+ int j;
+ int m;
+ int predDepth;
+ set incomplete;
+ set union_plainSet;
+ set setChange;
+ int changed;
+ Predicate *newPred;
+ set setDif;
+ Predicate *origPred;
+ int depth1=1; /* const int */
+ set *plainContext;
+ set plainSet;
+
+ predSet=empty;
+ incomplete=empty;
+ union_plainSet=empty;
+ setChange=empty;
+ setDif=empty;
+ plainSet=empty;
+
+ if (PRED_SUPPRESS == NULL) {
+ PRED_SUPPRESS=new_pred();
+ PRED_SUPPRESS->expr="Predicate Suppressed";
+ };
+
+ /* this section just counts the number of "interesting" alternatives */
+ /* in order to allocate arrays */
+
+ for (p=alt; p!=NULL; p=(Junction *)p->p2) {
+ /* ignore empty alts */
+ if ( p->p1->ntype != nJunction ||
+ ((Junction *)p->p1)->jtype != EndBlk ) {
+ nAlts++;
+ };
+ };
+
+ /* if this is a (...)+ block then don't count the last alt because
+ it can't be taken until at least one time through the block.
+ In other words it isn't a real choice until the (...)+ is entered
+ at which point the hoisting issue is moot.
+ Maybe look at "ignore" instead ?
+ */
+
+ if (alt->jtype == aPlusBlk) {
+ nAlts--;
+ };
+
+ jList=(Junction **)calloc(nAlts,sizeof(Junction *));
+ require(jList!=NULL,"cannot allocate MR_find_in_aSubBlk jList");
+
+ plainContext=(set *)calloc(nAlts,sizeof(set));
+ require(plainContext!=NULL,"cannot allocate MR_find_in_aSubBlk plainContext");
+ for (m=0; m < nAlts; m++) plainContext[m]=empty;
+
+ predList=(Predicate **)calloc(nAlts,sizeof(Predicate *));
+ require(predList!=NULL,"cannot allocate MR_find_in_aSubBlk predList");
+
+ matchList=(int *)calloc(nAlts,sizeof(int));
+ require(matchList!=NULL,"cannot allocate MR_find_in_aSubBlk matchList");
+
+ /* this section just fills in the arrays previously allocated */
+ /* the most interesting one is matchList[] */
+ /* */
+ /* bit 0 => this alt has a semantic pred which is "covered" */
+ /* by an alt without a semantic pred. Don't hoist. */
+
+ for (i=0,p=alt;
+ p!=NULL && i<nAlts;
+ i++,p=(Junction *)p->p2) {
+
+ /* ignore empty alts */
+
+ if ( p->p1->ntype != nJunction ||
+ ((Junction *)p->p1)->jtype != EndBlk ) {
+ jList[i]=MR_junctionWithoutP2(p);
+ predList[i]=find_predicates(p->p1); /* should be jList ????? */
+ if (predList[i] != NULL) {
+ MR_cleanup_pred_trees(predList[i]); /* flatten & left factor */
+ plainContext[i]=MR_union_plain_sets(predList[i]);
+ } else {
+ MR_set_reuse(&plainSet);
+ MR_set_reuse(&incomplete);
+ plainSet=MR_First(depth1,jList[i],&incomplete);
+ MR_complete_set(depth1,&plainSet,&incomplete);
+ require(set_nil(incomplete),"couldn't complete k=1");
+ plainContext[i]=plainSet;
+ plainSet=empty;
+ };
+ set_orin(&union_plainSet,plainContext[i]);
+ };
+ };
+
+ if (nAlts == 1) {
+ goto EXIT_SIMPLE;
+ };
+
+/*
+ * Looking for cases where alt i has a semantic pred and alt j does not.
+ * Don't care about cases where lookahead for semantic predicates overlap
+ * because normal predicate hoisting does the correct thing automatically.
+ * Don't care about cases where lookahead for alts without semantic predicates
+ * overlap because normal prediction does the correct thing automatically.
+ *
+ * When we find such a case check for one of three subcases:
+ *
+ * 1. if lookahead for alt i is contained in the lookahead for any
+ * alt j then ignore semantic predicate of alt i
+ * 2. if lookahead for alt i is not contained in the lookahead for
+ * any alt j then add add predicate i to the OR list to be hoisted
+ * 3. if lookahead for alt i overlaps the lookahead for some alt j then
+ * add a dummy semantic predicate for alt j
+ *
+ * There is an implicit assumption that the context of all alternatives following
+ * the rule being processed here are identical (but may vary from hoist to
+ * hoist depending on the place where the rule was invoked that led to hoisting
+ * these predicates. In othere words in the fragment:
+ *
+ * ( <<a>>? a1 a2 a3 | <<b>>? b1 b2 b3 )
+ *
+ * both a3 and b3 have the same follow sets because they are both at the end of
+ * alternatives in the same block.
+ */
+
+ for (i=0; i < nAlts; i++) {
+ if (jList[i] == NULL) continue;
+ if (predList[i] == NULL) continue;
+
+ /* if the predicate depth turns out to be one token only */
+ /* then it is can be easily represented as a set and */
+ /* compared to the junction set create by MR_First() */
+
+ predDepth=0;
+ MR_pred_depth(predList[i],&predDepth);
+ require (predDepth >= 1,"MR_find_in_aSubBlk: pred depth < 1");
+ require (predDepth <= CLL_k,"MR_find_in_aSubBlk: predDepth > CLL_k");
+
+ /* complete predicates to predDepth
+ If completed to depth=1 then the context would be incomplete.
+ The context would be truncated and the predicate simplify routine
+ would have incomplete information. It would lead to
+ either false matches of failure to find true matches.
+ */
+
+ MR_complete_predicates(predDepth,predList[i]);
+
+ if (predList[i] != NULL) {
+ MR_cleanup_pred_trees(predList[i]); /* flatten & left factor */
+ };
+
+ /* If the predicate depth is 1 then it is possible to suppress
+ a predicate completely using a single plain alt. Check for suppression
+ by a single plain alt first because it gives better messages. If that
+ fails try the union of all the plain alts.
+ */
+
+ if (predDepth == 1) {
+
+ MR_set_reuse(&predSet);
+ predSet=MR_compute_pred_set(predList[i]); /* ignores k>1 predicates */
+
+ for (j=0; j < nAlts; j++) {
+ if (jList[j] == NULL) continue;
+ if (j == i) continue;
+
+ MR_set_reuse(&setDif);
+ setDif=set_dif(predSet,plainContext[j]);
+ if (set_nil(setDif)) {
+ matchList[i] |= 1;
+ MR_reportSetSuppression(predDepth,predSet,plainContext[j],jList[i],jList[j],predList[i]);
+ predicate_free(predList[i]);
+ predList[i]=PRED_SUPPRESS;
+ goto next_i;
+ };
+
+ }; /* end loop on j */
+
+ changed=0;
+
+ /* predicate_dup is only to give good error messages */
+ /* remember to do a predicate_free() */
+
+ origPred=predicate_dup(predList[i]);
+ MR_apply_restriction1(predList[i],&union_plainSet,&changed);
+ if (changed) {
+
+ /* don't use Pass3 by itself unless you know that inverted is not important */
+
+ newPred=MR_removeRedundantPredPass3(predList[i]);
+ newPred=MR_predSimplifyALL(newPred);
+ if (newPred == NULL) {
+ matchList[i] |= 1;
+ MR_reportSetSuppression(predDepth,predSet,union_plainSet,jList[i],
+ NULL,origPred);
+ predList[i]=PRED_SUPPRESS;
+ } else {
+ MR_reportSetRestriction(predDepth,predSet,union_plainSet,jList[i],
+ NULL,origPred,newPred);
+ predList[i]=newPred;
+ };
+ };
+ predicate_free(origPred);
+ origPred=NULL;
+ };
+
+ /*
+ If the predicate depth is > 1 then it can't be suppressed completely
+ because the code doesn't support inspection of such things. They're
+ much messier than k=1 sets.
+ */
+
+ if (predDepth > 1 ) {
+
+ changed=0;
+
+ /* predicate_dup is only to give good error messages */
+ /* remember to do a predicate_free() */
+
+ origPred=predicate_dup(predList[i]);
+ MR_apply_restriction1(predList[i],&union_plainSet,&changed);
+ if (changed) {
+ newPred=MR_removeRedundantPredPass3(predList[i]);
+ newPred=MR_predSimplifyALL(newPred);
+ if (newPred == NULL) {
+ matchList[i] |= 1;
+ MR_reportSetSuppression(predDepth,predSet,union_plainSet,jList[i],
+ NULL,origPred);
+ predList[i]=PRED_SUPPRESS;
+ } else {
+ MR_reportSetRestriction(predDepth,predSet,union_plainSet,jList[i],
+ NULL,origPred,newPred);
+ predList[i]=newPred;
+ };
+ };
+ predicate_free(origPred);
+ origPred=NULL;
+ };
+next_i:
+ continue;
+ };
+
+EXIT_SIMPLE:
+
+ root = new_pred();
+ root->expr=PRED_OR_LIST;
+ tail = &(root->down);
+
+ for (i=0 ; i< nAlts ; i++) {
+ if (jList[i] == NULL) continue;
+
+ if (predList[i] == NULL) {
+ continue;
+ } else if ( (matchList[i] & 1) != 0) {
+ if (predList[i] != PRED_SUPPRESS) {
+ predicate_free(predList[i]);
+ };
+ continue;
+ };
+
+ /* make an OR list of predicates */
+
+ *tail=predList[i];
+ tail=&(predList[i]->right);
+ };
+
+ /* if just one pred, remove OR root */
+
+ if (root->down == NULL) {
+ predicate_free(root);
+ root=NULL;
+ } else if (root->down->right == NULL) {
+ Predicate *p=root->down;
+ root->down=NULL;
+ predicate_free(root);
+ root=p;
+ }
+
+ root=MR_predSimplifyALL(root);
+
+ MR_orin_plainSet(root,union_plainSet);
+
+ set_free(predSet);
+ set_free(union_plainSet);
+ set_free(incomplete);
+ set_free(setChange);
+ set_free(setDif);
+
+ for (m=0; m < nAlts; m++) set_free(plainContext[m]);
+
+ free ( (char *) jList);
+ free ( (char *) predList);
+ free ( (char *) matchList);
+ free ( (char *) plainContext);
+
+ return root;
+}
+
+#ifdef __USE_PROTOS
+void MR_predContextPresent(Predicate *p,int *allHaveContext,int *noneHaveContext)
+#else
+void MR_predContextPresent(p,allHaveContext,noneHaveContext)
+ Predicate *p;
+ int *allHaveContext;
+ int *noneHaveContext;
+#endif
+{
+ if (p == NULL) return;
+ MR_predContextPresent(p->right,allHaveContext,noneHaveContext);
+ if (p->expr != PRED_AND_LIST &&
+ p->expr != PRED_OR_LIST) {
+ if (set_nil(p->scontext[1]) == 0 ||
+ (p->tcontext != NULL)) {
+ *noneHaveContext=0;
+ } else {
+ *allHaveContext=0;
+ };
+ };
+ MR_predContextPresent(p->down,allHaveContext,noneHaveContext);
+}
+
+#ifdef __USE_PROTOS
+int MR_pointerStackPush(PointerStack *ps,void *dataPointer)
+#else
+int MR_pointerStackPush(ps,dataPointer)
+ PointerStack *ps;
+ void *dataPointer;
+#endif
+{
+ void **newStack;
+ int newSize;
+ int i;
+
+ if (ps->count == ps->size) {
+ newSize=20+ps->size*2;
+ newStack=(void **)calloc(newSize,sizeof(void *));
+ require (newStack != NULL,"cannot allocate PointerStack");
+ for (i=0; i < ps->size; i++) {
+ newStack[i]=ps->data[i];
+ };
+ if (ps->data != NULL) free( (char *) ps->data);
+ ps->data=newStack;
+ ps->size=newSize;
+ };
+ ps->data[ps->count]=dataPointer;
+ ps->count++;
+ return ps->count-1;
+}
+
+#ifdef __USE_PROTOS
+void * MR_pointerStackPop(PointerStack *ps)
+#else
+void * MR_pointerStackPop(ps)
+ PointerStack *ps;
+#endif
+{
+ void *dataPointer;
+
+ require(ps->count > 0,"MR_pointerStackPop underflow");
+
+ dataPointer=ps->data[ps->count-1];
+ ps->data[ps->count-1]=NULL;
+ (ps->count)--;
+ return dataPointer;
+}
+
+#ifdef __USE_PROTOS
+void * MR_pointerStackTop(PointerStack *ps)
+#else
+void * MR_pointerStackTop(ps)
+ PointerStack *ps;
+#endif
+{
+ require(ps->count > 0,"MR_pointerStackTop underflow");
+ return ps->data[ps->count-1];
+}
+
+#ifdef __USE_PROTOS
+void MR_pointerStackReset(PointerStack *ps)
+#else
+void MR_pointerStackReset(ps)
+ PointerStack *ps;
+#endif
+{
+ int i;
+ if (ps->data != NULL) {
+ for (i=0; i < ps->count ; i++) {
+ ps->data[i]=NULL;
+ };
+ };
+ ps->count=0;
+}
+
+#ifdef __USE_PROTOS
+Junction *MR_nameToRuleBlk(char *name)
+#else
+Junction *MR_nameToRuleBlk(name)
+ char *name;
+#endif
+{
+ RuleEntry *q;
+
+ require (RulePtr != NULL,"MR_nameToRule: RulePtr not initialized");
+
+ if (name == NULL) return NULL;
+
+ q = (RuleEntry *) hash_get(Rname,name);
+
+ if ( q == NULL ) {
+ return NULL;
+ } else {
+ return RulePtr[q->rulenum];
+ };
+}
+
+#ifdef __USE_PROTOS
+Junction * MR_ruleReferenced(RuleRefNode *rrn)
+#else
+Junction * MR_ruleReferenced(rrn)
+ RuleRefNode *rrn;
+#endif
+{
+ return MR_nameToRuleBlk(rrn->text);
+}
+
+#ifdef __USE_PROTOS
+void MR_comparePredLeaves(Predicate *me,Predicate *myParent,Predicate *him,Predicate *hisParent)
+#else
+void MR_comparePredLeaves(me,myParent,him,hisParent)
+ Predicate *me;
+ Predicate *myParent;
+ Predicate *him;
+ Predicate *hisParent;
+#endif
+{
+ if (me == NULL) return;
+ if (me == him) {
+ MR_comparePredLeaves(me->right,myParent,him,hisParent);
+ return;
+ } else if (me->expr == PRED_AND_LIST ||
+ me->expr == PRED_OR_LIST) {
+ MR_comparePredLeaves(me->down,me,him,hisParent);
+ MR_comparePredLeaves(me->right,myParent,him,hisParent);
+ return;
+ } else {
+ if (me->source != NULL) {
+
+ /* predicate->invert can be set only in the predEntry predicates */
+ /* thus they are only visible after the predEntry predicates have been "unfolded" */
+
+ int sameSource=(me->source == him->source);
+ int sameInvert=1 &
+ (1 + me->inverted + him->inverted + me->source->inverted + him->source->inverted);
+ int samePredEntry=(me->source->predEntry != NULL
+ && him->source->predEntry != NULL
+ && me->source->predEntry == him->source->predEntry);
+ if (sameInvert && (sameSource || samePredEntry)) {
+ if (MR_identicalContext(me,him)) {
+
+ /* identical predicates */
+
+ if (hisParent->expr == PRED_OR_LIST &&
+ myParent->expr == PRED_OR_LIST) {
+ me->redundant=1;
+ } else if (hisParent->expr == PRED_AND_LIST &&
+ myParent->expr == PRED_AND_LIST) {
+ me->redundant=1;
+ } else if ( (hisParent->expr == PRED_OR_LIST &&
+ myParent->expr == PRED_AND_LIST)
+ ||
+ (hisParent->expr == PRED_AND_LIST &&
+ myParent->expr == PRED_OR_LIST)
+ ) {
+ myParent->redundant=1;
+ } else {
+ require (0,"MR_comparePredLeaves: not both PRED_LIST");
+ };
+ };
+ }; /* end same source or same predEntrr with same invert sense */
+
+ /* same predEntry but opposite invert sense */
+
+ if (!sameInvert && (sameSource || samePredEntry)) {
+ if (MR_identicalContext(me,him)) {
+ if (hisParent->expr == PRED_OR_LIST &&
+ myParent->expr == PRED_OR_LIST) {
+ myParent->isConst=1;
+ myParent->constValue=1;
+ } else if (hisParent->expr == PRED_AND_LIST &&
+ myParent->expr == PRED_AND_LIST) {
+ myParent->isConst=1;
+ myParent->constValue=0;
+ } else if ( (hisParent->expr == PRED_OR_LIST &&
+ myParent->expr == PRED_AND_LIST)
+ ||
+ (hisParent->expr == PRED_AND_LIST &&
+ myParent->expr == PRED_OR_LIST)
+ ) {
+ me->redundant=1;
+ } else {
+ require (0,"MR_comparePredLeaves: not both PRED_LIST");
+ };
+ };
+ }; /* end same predEntry with opposite invert sense */
+ };
+
+ MR_comparePredLeaves(me->right,myParent,him,hisParent);
+ return;
+ };
+}
+
+#ifdef __USE_PROTOS
+void MR_removeRedundantPredPass1(Predicate *me,Predicate *myParent)
+#else
+void MR_removeRedundantPredPass1(me,myParent)
+ Predicate *me;
+ Predicate *myParent;
+#endif
+{
+ if (me == NULL) return;
+ if (me->redundant) {
+ MR_removeRedundantPredPass1(me->right,myParent);
+ return;
+ };
+ if (me->expr == PRED_AND_LIST ||
+ me->expr == PRED_OR_LIST) {
+ MR_removeRedundantPredPass1(me->down,me);
+ MR_removeRedundantPredPass1(me->right,myParent);
+ } else {
+ require (me->source != NULL,"me->source == NULL");
+ if (myParent != NULL) {
+ MR_comparePredLeaves(myParent->down,myParent,me,myParent);
+ };
+ MR_removeRedundantPredPass1(me->right,myParent);
+ };
+}
+
+/* pretty much ignores things with the inverted bit set */
+
+#ifdef __USE_PROTOS
+Predicate *MR_predFlatten(Predicate *p)
+#else
+Predicate *MR_predFlatten(p)
+ Predicate *p;
+#endif
+{
+ if (p == NULL) return NULL;
+ if (p->expr == PRED_OR_LIST
+ || p->expr == PRED_AND_LIST) {
+
+ Predicate *child;
+ Predicate *gchild;
+ Predicate **tail;
+ Predicate *next;
+ char *PRED_XXX_LIST=p->expr;
+
+ require (p->down != NULL,"MR_predFlatten AND/OR no child");
+
+
+ p->down=MR_predFlatten(p->down);
+ p->right=MR_predFlatten(p->right);
+ child=p->down;
+ if (child->right == NULL) {
+ child->right=p->right;
+ p->right=NULL;
+ p->down=NULL;
+ if (p->inverted) child->inverted=!child->inverted;
+ predicate_free(p);
+ return child;
+ };
+
+ /* make a single list of all children and grandchildren */
+
+ tail=&(p->down);
+ for (child=p->down; child != NULL; child=next) {
+ if (child->expr != PRED_XXX_LIST
+ || child->inverted
+ || child->predEntry != NULL) {
+ *tail=child;
+ tail=&(child->right);
+ next=child->right;
+ } else {
+ for (gchild=child->down;
+ gchild != NULL;
+ gchild=gchild->right) {
+ *tail=gchild;
+ tail=&(gchild->right);
+ };
+ next=child->right;
+ child->right=NULL;
+ child->down=NULL;
+ predicate_free(child);
+ };
+ };
+ *tail=NULL;
+ return p;
+ } else {
+ p->right=MR_predFlatten(p->right);
+ return p;
+ };
+}
+
+static char *alwaysFalseWarning=NULL;
+
+#ifdef __USE_PROTOS
+Predicate *checkPredicateConflict(Predicate *p)
+#else
+Predicate *checkPredicateConflict(p)
+ Predicate *p;
+#endif
+{
+ if (p->isConst) {
+ if (p->constValue == 1) {
+ predicate_free(p);
+ return NULL;
+ } else {
+ if (InfoP && !p->conflictReported) {
+ p->conflictReported=1;
+ fprintf(output,"\n#if 0\n\n");
+ fprintf(output,"The following predicate expression will always be false:\n\n");
+ MR_dumpPred1(1,p,1);
+ fprintf(output,"\n#endif\n");
+ };
+
+ if (alwaysFalseWarning != CurRule) {
+ alwaysFalseWarning=CurRule;
+ if (InfoP) {
+ warnNoFL(eMsg1("one (or more) predicate expression hoisted into rule \"%s\" are always false \
+- see output file for more information",CurRule));
+ } else {
+ warnNoFL(eMsg1("one (or more) predicate expressions hoisted into rule \"%s\" are always false \
+- use \"-info p\" for more information",CurRule));
+ };
+ };
+ };
+ };
+ return p;
+}
+
+
+#ifdef __USE_PROTOS
+int MR_countPredNodes(Predicate *p)
+#else
+int MR_countPredNodes(p)
+ Predicate *p;
+#endif
+{
+ if (p == NULL) return 0;
+ return 1 + MR_countPredNodes(p->down) + MR_countPredNodes(p->right);
+}
+
+#ifdef __USE_PROTOS
+Predicate *MR_predSimplifyALLX(Predicate *p,int skipPass3)
+#else
+Predicate *MR_predSimplifyALLX(p,skipPass3)
+ Predicate *p;
+ int skipPass3;
+#endif
+{
+ int countBefore;
+ int countAfter;
+
+ countAfter=MR_countPredNodes(p);
+
+ do {
+ if (p == NULL) return NULL;
+ if (p->right == NULL && p->down == NULL) return p;
+ countBefore=countAfter;
+ MR_simplifyInverted(p,0);
+ p=MR_predFlatten(p);
+ MR_removeRedundantPredPass1(p,NULL);
+ MR_removeRedundantPredPass2(p);
+ if (! skipPass3) {
+ p=checkPredicateConflict(p);
+ p=MR_removeRedundantPredPass3(p);
+ };
+ countAfter=MR_countPredNodes(p);
+ } while (countBefore != countAfter);
+
+ return p;
+}
+
+#ifdef __USE_PROTOS
+Predicate *MR_predSimplifyALL(Predicate *p)
+#else
+Predicate *MR_predSimplifyALL(p)
+ Predicate *p;
+#endif
+{
+ return MR_predSimplifyALLX(p,0);
+}
+
+#ifdef __USE_PROTOS
+void MR_releaseResourcesUsedInRule(Node *n)
+#else
+void MR_releaseResourcesUsedInRule(n)
+ Node *n;
+#endif
+{
+ Node *next;
+ Junction *j;
+ int i;
+
+ if (n == NULL) return;
+ if (n->ntype == nJunction) {
+ j=(Junction *) n;
+
+ if (j->predicate != NULL) {
+ predicate_free(j->predicate);
+ j->predicate=NULL;
+ };
+ for (i=0; i< CLL_k; i++) {
+ set_free(j->fset[i]);
+ j->fset[i]=empty;
+ };
+ if (j->ftree != NULL) {
+ Tfree(j->ftree);
+ j->ftree=NULL;
+ };
+ if (j->jtype == EndRule) return;
+ if (j->jtype != RuleBlk && j->jtype != EndBlk) {
+ if (j->p2 != NULL && !j->ignore) { /* MR11 */
+ MR_releaseResourcesUsedInRule(j->p2);
+ };
+ };
+ };
+ next=MR_advance(n);
+ MR_releaseResourcesUsedInRule(next);
+}
+
+#ifdef __USE_PROTOS
+int MR_allPredLeaves(Predicate *p)
+#else
+int MR_allPredLeaves(p)
+ Predicate *p;
+#endif
+{
+ Predicate *q;
+
+ if (p == NULL) return 1;
+
+ for (q=p; q != NULL; q=q->right) {
+ if (q->down != NULL) return 0;
+ };
+ return 1;
+}
+
+/* make sure it works for the last rule in a file */
+
+#ifdef __USE_PROTOS
+int MR_offsetFromRule(Node *n)
+#else
+int MR_offsetFromRule(n)
+ Node *n;
+#endif
+{
+ Junction *j;
+ int offset=(-1);
+
+ for (j=SynDiag; j != NULL; j=(Junction *)j->p2) {
+
+ require (j->ntype == nJunction && j->jtype == RuleBlk,"Not a rule block");
+
+ if (n->file < j->file) {
+ return offset;
+ };
+ if (n->file == j->file) {
+ if (n->line < j->line) {
+ return (offset < 0) ? 0 : offset;
+ } else {
+ offset=n->line - j->line;
+ if (offset == 0) return 0;
+ };
+ };
+ };
+ return offset;
+}
+
+#define ruleNameMax 50
+
+static char ruleNameStatic1[ruleNameMax];
+static char ruleNameStatic2[ruleNameMax+10];
+
+#ifdef __USE_PROTOS
+char * MR_ruleNamePlusOffset(Node *n)
+#else
+char * MR_ruleNamePlusOffset(n)
+ Node *n;
+#endif
+{
+ int offset=MR_offsetFromRule(n);
+
+ strncpy(ruleNameStatic1,n->rname,ruleNameMax);
+ if (offset < 0) {
+ sprintf(ruleNameStatic2,"%s/?",ruleNameStatic1);
+ } else {
+ sprintf(ruleNameStatic2,"%s/%d",ruleNameStatic1,offset+1);
+ };
+ return ruleNameStatic2;
+}
+
+#ifdef __USE_PROTOS
+int MR_max_height_of_tree(Tree *t)
+#else
+int MR_max_height_of_tree(t)
+ Tree *t;
+#endif
+{
+ int h;
+ int height=0;
+ Tree *u;
+
+ if (t == NULL) return 0;
+
+ require (t->token != ALT && t->token != EpToken,"MR_max_height_of_tree ALT or EpToken");
+
+ for (u=t; u != NULL; u=u->right) {
+ h=MR_max_height_of_tree(u->down)+1;
+ if (h > height) height=h;
+ };
+ return height;
+}
+
+#ifdef __USE_PROTOS
+int MR_all_leaves_same_height(Tree *t,int depth)
+#else
+int MR_all_leaves_same_height(t,depth)
+ Tree *t;
+ int depth;
+#endif
+{
+ if (t == NULL) {
+ return (depth==0);
+ };
+
+ require (t->token != ALT && t->token != EpToken,"MR_all_leaves_same_height ALT or EpToken");
+
+ if (depth == 0) {
+ return 0;
+ } else {
+ if ( ! MR_all_leaves_same_height(t->down,depth-1)) {
+ return 0;
+ };
+ if (t->right == NULL) {
+ return 1;
+ } else {
+ return MR_all_leaves_same_height(t->right,depth);
+ };
+ };
+}
+
+#ifdef __USE_PROTOS
+void MR_projectTreeOntoSet(Tree *tree,int ck,set *ckset)
+#else
+void MR_projectTreeOntoSet(tree,ck,ckset)
+ Tree *tree;
+ int ck;
+ set *ckset;
+#endif
+{
+ if (tree == NULL) return;
+
+ require(tree->token != EpToken,"MR_projectTreeOntoSet: EpToken unexpected\n");
+
+ MR_projectTreeOntoSet(tree->right,ck,ckset);
+ if (tree->token == ALT) {
+ MR_projectTreeOntoSet(tree->down,ck,ckset);
+ } else {
+ if (ck > 1) {
+ MR_projectTreeOntoSet(tree->down,ck-1,ckset);
+ } else {
+ set_orel(tree->token,ckset);
+ };
+ };
+}
+
+#ifdef __USE_PROTOS
+int MR_comparePredicates(Predicate *a,Predicate *b)
+#else
+int MR_comparePredicates(a,b)
+ Predicate *a;
+ Predicate *b;
+#endif
+{
+ Predicate *p;
+ Predicate *q;
+
+ if (a == b) return 1;
+ if (a == NULL || b == NULL ) return 0;
+ if (a->down == NULL && b->down == NULL) {
+
+ /* predicate->invert can be set only in the predEntry predicates */
+ /* thus they are only visible after the predEntry predicates have been "unfolded" */
+
+ int sameSource=(a->source == b->source);
+ int sameInvert= 1 & (1 +a->inverted + b->inverted +
+ a->source->inverted + b->source->inverted);
+ int samePredEntry=(a->source->predEntry != NULL
+ && b->source->predEntry != NULL
+ && a->source->predEntry == b->source->predEntry);
+ if (sameInvert && (sameSource || samePredEntry)) {
+ if (MR_identicalContext(a,b)) {
+ return 1;
+ };
+ };
+ return 0;
+ };
+ if (a->down == NULL || b->down == NULL) return 0;
+ if (a->expr != b->expr) return 0;
+
+ for (p=a->down; p != NULL; p=p->right) {
+ for (q=b->down; q != NULL; q=q->right) {
+ if (MR_comparePredicates(p,q)) goto NEXT_P;
+ };
+ return 0;
+NEXT_P:
+ continue;
+ };
+ return 1;
+}
+
+/*
+ * action->inverted can be set only when a predicate symbol appears in
+ * a rule: "rule : <<!XXX>>? X". It cannot be set under any
+ * other circumstances. In particular it cannot be set by
+ * "#pred NotA !A" or by "#pred Nota <<!A>>?". The first case
+ * creates a predEntry and the predicate expression of that predEntry
+ * has inverted set. In the second case, the code for handling "!"
+ * is only present in buildAction, which is not called by the #pred
+ * semantic routines, only when a <<...>>? is recognized as part of
+ * a rule definition.
+ *
+ * predicate->inverted can only be set by a predicate created by a #pred
+ * expression, such as "#pred NotA !A" or "#pred NotXY ! (X && Y) or
+ * "#pred XbarY !(X && Y)". In particular, it cannot be set by any
+ * predicate expression occurring under any other circumstances.
+ * The #pred predicate expressions are stored with in predEntry->pred
+ * and do not normally appear anywhere else until the predicates are
+ * "unfolded" in order to recognize redundancies, conflicts, and
+ * tautologies.
+ *
+ * The unfold routine expands all references to #pred expressions.
+ *
+ * The simplifyInvert goes through and propagates the invert bit so that
+ * all OR and AND nodes are un-inverted.
+ *
+ * Note that !(A and B) => (!A or !B)
+ * !(A or B) => (!A and !B)
+ *
+ * MR_unfold() is called to expand predicate symbols by replacing predicates
+ * that reference predicate entries with the copies of the predicate entries.
+ * Each reference receives a duplicate of the original. This is necessary
+ * because the next phase involves simplification and removal of redundant
+ * predicate nodes. Anyway, the point I'm making is that predicate->invert
+ * should not be set in any predicate until it has been expanded.
+ *
+ * This is a recursive structure, but there is no need for "recursive expansion"
+ * by which I mean a predicate symbol refers to other predicate symbols which
+ * must also be expanded.
+ *
+ * Recursive expansion is *not* performed by this routine because it is not
+ * necessary. Expansion of references is performed by predPrimary when
+ * a new predicate symbol is created by referring to others in the pred expr.
+ */
+
+#ifdef __USE_PROTOS
+Predicate *MR_unfold(Predicate *pred)
+#else
+Predicate *MR_unfold(pred)
+ Predicate *pred;
+#endif
+{
+ Predicate *result;
+
+ if (pred == NULL) return NULL;
+
+ pred->right=MR_unfold(pred->right);
+
+ if (pred->down == NULL) {
+ if (pred->source->predEntry != NULL) {
+ if (pred->source->predEntry->pred == NULL) {
+ ; /* do nothing */ /* a reference to a literal #pred (perhaps with "!" */
+ } else {
+ result=predicate_dup_without_context(pred->source->predEntry->pred);
+ if (pred->inverted) {
+ result->inverted=!result->inverted;
+ };
+ if (pred->source->inverted) {
+ result->inverted=!result->inverted;
+ };
+ result->right=pred->right;
+ pred->right=NULL;
+ predicate_free(pred);
+/*** result=MR_unfold(result); *** not necessary */ /* recursive expansion */
+ return result;
+ };
+ } else {
+ ; /* do nothing */ /* an inline literal predicate */
+ };
+ } else {
+ pred->down=MR_unfold(pred->down);
+ };
+ return pred;
+}
+
+/* this should be called immediately after MR_unfold() and
+ at no other times
+*/
+
+#ifdef __USE_PROTOS
+void MR_simplifyInverted(Predicate *pred,int inverted)
+#else
+void MR_simplifyInverted(pred,inverted)
+ Predicate *pred;
+ int inverted;
+#endif
+{
+ int newInverted;
+
+ if (pred == NULL) return;
+
+ MR_simplifyInverted(pred->right,inverted);
+
+ newInverted= 1 & (inverted + pred->inverted);
+
+ if (pred->down == NULL) {
+ pred->inverted=newInverted;
+ } else {
+ if (newInverted != 0) {
+ if (pred->expr == PRED_AND_LIST) {
+ pred->expr=PRED_OR_LIST;
+ } else {
+ pred->expr=PRED_AND_LIST;
+ };
+ };
+ pred->inverted=0;
+ MR_simplifyInverted(pred->down,newInverted);
+ };
+}
+
+/* only remove it from AND and OR nodes, not leaves */
+
+#ifdef __USE_PROTOS
+void MR_clearPredEntry(Predicate *p)
+#else
+void MR_clearPredEntry(p)
+ Predicate *p;
+#endif
+{
+ if (p == NULL) return;
+ MR_clearPredEntry(p->down);
+ MR_clearPredEntry(p->right);
+ if (p->down != NULL) p->predEntry=NULL;
+}
+
+
+#ifdef __USE_PROTOS
+void MR_orphanRules(FILE *f)
+#else
+void MR_orphanRules(f)
+ FILE *f;
+#endif
+{
+ set a;
+ Junction *p;
+ unsigned e;
+ RuleEntry *re;
+
+ a=empty;
+
+ if (! InfoO) return;
+
+ for (p=SynDiag; p!=NULL; p = (Junction *)p->p2) {
+ if ( (Junction *) (p->end)->p1 == NULL) {
+ re=(RuleEntry *) hash_get(Rname,p->rname);
+ require (re != NULL,"RuleEntry == NULL");
+ set_orel(re->rulenum, &a);
+ }
+ }
+
+ if (set_deg(a) > 1) {
+ fprintf(f,"note: Start rules: {");
+ for (; !set_nil(a); set_rm(e,a)) {
+ e=set_int(a);
+ fprintf(f," %s",RulePtr[e]->rname);
+ };
+ fprintf(f," }\n");
+ };
+ set_free( a );
+}
+
+/* merge (X Y) and (X) to create (X) */
+
+static int *mergeChain;
+static Tree *mergeTree;
+
+#ifdef __USE_PROTOS
+Tree *MR_merge_tree_contexts_client(Tree *t,int chain[])
+#else
+Tree *MR_merge_tree_contexts_client(t,chain)
+ Tree *t;
+ int chain[];
+#endif
+{
+ if (t == NULL) return NULL;
+ if (chain[0] == 0) {
+ Tree *u=t->right;
+ t->right=NULL;
+ Tfree(t);
+ return MR_merge_tree_contexts_client(u,&chain[0]);
+ }
+ if (chain[0] == t->token) {
+ t->down=MR_merge_tree_contexts_client(t->down,&chain[1]);
+ };
+ t->right=MR_merge_tree_contexts_client(t->right,&chain[0]);
+ return t;
+}
+
+#ifdef __USE_PROTOS
+void MR_iterateOverTreeContexts(Tree *t,int chain[])
+#else
+void MR_iterateOverTreeContexts(t,chain)
+ Tree *t;
+ int chain[];
+#endif
+{
+ if (t == NULL) return;
+ chain[0]=t->token;
+ if (t->down != NULL) {
+ MR_iterateOverTreeContexts(t->down,&chain[1]);
+ } else {
+ MR_merge_tree_contexts_client(mergeTree,mergeChain);
+ };
+ MR_iterateOverTreeContexts(t->right,&chain[0]);
+ chain[0]=0;
+}
+
+#ifdef __USE_PROTOS
+Tree *MR_merge_tree_contexts(Tree *t)
+#else
+Tree *MR_merge_tree_contexts(t)
+ Tree *t;
+#endif
+{
+ int h=MR_max_height_of_tree(t);
+
+ mergeTree=t;
+ mergeChain=(int *) calloc(h+1,sizeof(int));
+ require (mergeChain != NULL,"MR_merge_tree_contexts: can't alloc chain");
+ MR_iterateOverTreeContexts(t,mergeChain);
+ t=tshrink(t);
+ t=tflatten(t);
+ t=tleft_factor(t);
+ free ( (char *) mergeChain);
+ mergeChain=NULL;
+ return t;
+}
+
+#ifdef __USE_PROTOS
+Tree *MR_compute_pred_tree_context(Predicate *p)
+#else
+Tree *MR_compute_pred_tree_context(p)
+ Predicate *p;
+#endif
+{
+ Tree *t;
+
+ t=MR_compute_pred_tree_ctxXX(p);
+ MR_merge_tree_contexts(t);
+ return t;
+}
+
+#ifdef __USE_PROTOS
+void MR_guardPred_plainSet(ActionNode *anode,Predicate *pred)
+#else
+void MR_guardPred_plainSet(anode,pred)
+ ActionNode *anode;
+ Predicate *pred;
+#endif
+{
+ Junction *j;
+ Predicate *workPred;
+ set maskSet;
+
+ maskSet=empty;
+
+ if (!MRhoisting) return;
+
+ /* it doesn't really matter whether the predicate has
+ depth k=1 or k>1 because we're not really looking
+ at the predicate itself, just the stuff "behind"
+ the predicate.
+ */
+
+ /* shouldn't have to worry about REACHing off the end
+ of the rule containing the predicate because the
+ Rule->end->halt should have been set already by the
+ the code which handles RuleRef nodes.
+
+ We don't want to REACH off the end of the rule because
+ this would give the "global" follow context rather than
+ the "local" context.
+
+ r1a : (A)? => <<p>>? r2 (A|B)
+ r1b : (A)? => <<p>>? r2 (A|C)
+ r2 : ();
+
+ For r1a we want follow of predicate = {A B}
+ we want plainSet = {B}
+ For r1b we want follow of predicate = {A C}
+ we want plainSet = {C}
+ */
+
+ require (anode->next->ntype == nJunction,"MR_guardpred_plainSet not Junction");
+ j=(Junction *)(anode->next);
+
+ workPred=predicate_dup_without_context(pred);
+ workPred->k=1;
+ workPred->scontext[1]=MR_First(1,j, &(workPred->completionSet) );
+ MR_complete_predicates(1,workPred);
+ if (pred->k == 1) {
+ maskSet=pred->scontext[1];
+ } else {
+ MR_projectTreeOntoSet(pred->tcontext,1,&maskSet);
+ }
+ pred->plainSet=set_dif(workPred->scontext[1],maskSet);
+ predicate_free(workPred);
+}
+
+/*******************************************************************************/
+
+static Tree * suppressTree;
+static int * suppressChain; /* element 0 not used */
+static set * suppressSets;
+static Node * suppressNode;
+static int suppressChainLength;
+int MR_SuppressSearch=0;
+static int suppressSucceeded;
+static Predicate * suppressPredicate;
+
+#ifdef __USE_PROTOS
+int MR_isChain(Tree *t)
+#else
+int MR_isChain(t)
+ Tree *t;
+#endif
+{
+ Tree *u;
+
+ for (u=t; u != NULL; u=u->down) {
+ if (u->right != NULL) return 0;
+ }
+ return 1;
+}
+
+#ifdef __USE_PROTOS
+int MR_suppressK_client(Tree *tree,int tokensInChain[])
+#else
+int MR_suppressK_client(tree,tokensInChain)
+ Tree *tree;
+ int tokensInChain[];
+#endif
+{
+ int i;
+ set *save_fset;
+ int save_ConstrainSearch;
+ set incomplete;
+ Tree *t;
+
+ suppressSucceeded=0; /* volatile */
+
+ if (suppressSets == NULL) {
+ suppressSets=(set *) calloc (CLL_k+1,sizeof(set));
+ require (suppressSets != NULL,"MR_suppressK_client: suppressSets alloc");
+ };
+
+ for (suppressChainLength=1;
+ tokensInChain[suppressChainLength+1] != 0;
+ suppressChainLength++) {};
+
+ require (suppressChainLength != 0,"MR_suppressK_client: chain empty");
+
+ for (i=1 ; i <= suppressChainLength ; i++) {
+ set_clr(suppressSets[i]);
+ set_orel( (unsigned) tokensInChain[i],
+ &suppressSets[i]);
+ };
+
+ save_fset=fset;
+ save_ConstrainSearch=ConstrainSearch;
+
+ fset=suppressSets;
+
+ MR_SuppressSearch=1;
+ MR_AmbSourceSearch=1;
+ MR_MaintainBackTrace=1;
+ ConstrainSearch=1;
+
+ maxk = suppressChainLength;
+
+ incomplete=empty;
+ t=NULL;
+
+/*** constrain = &(fset[1]); ***/
+
+ MR_setConstrainPointer(&(fset[1])); /* MR18 */
+
+ MR_pointerStackReset(&MR_BackTraceStack);
+
+ TRAV(suppressNode,maxk,&incomplete,t);
+
+ Tfree(t);
+
+ require (set_nil(incomplete),"MR_suppressK_client TRAV incomplete");
+ require (MR_BackTraceStack.count == 0,
+ "MR_suppressK_client: MR_BackTraceStack.count != 0");
+ set_free(incomplete);
+
+ ConstrainSearch=save_ConstrainSearch;
+ fset=save_fset;
+
+ MR_AmbSourceSearch=0;
+ MR_MaintainBackTrace=0;
+ MR_SuppressSearch=0;
+ return suppressSucceeded;
+}
+
+#ifdef __USE_PROTOS
+Tree * MR_iterateOverTreeSuppressK(Tree *t,int chain[])
+#else
+Tree * MR_iterateOverTreeSuppressK(t,chain)
+ Tree *t;
+ int chain[];
+#endif
+{
+ if (t == NULL) return NULL;
+ t->right=MR_iterateOverTreeSuppressK(t->right,&chain[0]);
+ chain[0]=t->token;
+ if (t->down != NULL) {
+ t->down=MR_iterateOverTreeSuppressK(t->down,&chain[1]);
+ if (t->down == NULL) {
+ Tree *u=t->right;
+ t->right=NULL;
+ Tfree(t);
+ chain[0]=0;
+ return u;
+ };
+ } else {
+ MR_suppressK_client(suppressTree,suppressChain);
+ if (suppressSucceeded) {
+ Tree *u=t->right;
+ t->right=NULL;
+ Tfree(t);
+ chain[0]=0;
+ return u;
+ };
+ };
+ chain[0]=0;
+ return t;
+}
+
+/* @@@ */
+
+#ifdef __USE_PROTOS
+Predicate * MR_suppressK(Node *j,Predicate *p)
+#else
+Predicate * MR_suppressK(j,p)
+ Node *j;
+ Predicate *p;
+#endif
+{
+ Predicate *result;
+ int guardPred=0;
+ int ampersandPred=0;
+ Node *nodePrime;
+
+ if (! MRhoistingk) {
+ return p;
+ }
+
+ if (! MRhoisting) return p;
+ if (CLL_k == 1) return p;
+
+ if (suppressChain == NULL) {
+ suppressChain=(int *) calloc(CLL_k+2,sizeof(int));
+ require (suppressChain != NULL,"MR_suppressK: can't allocate chain");
+ }
+
+ if (p == NULL) return NULL;
+
+ if (j->ntype == nJunction) {
+ nodePrime=(Node *) MR_junctionWithoutP2( (Junction *) j);
+ } else {
+ nodePrime=j;
+ };
+
+ p->down=MR_suppressK(j,p->down);
+ p->right=MR_suppressK(j,p->right);
+ if (p->down != NULL) {
+ result=p;
+ goto EXIT;
+ };
+ if (p->k == 1) {
+ result=p;
+ goto EXIT;
+ };
+
+ if (p->source != NULL) {
+ if (p->source->guardpred != NULL) guardPred=1;
+ if (p->source->ampersandPred != NULL) ampersandPred=1;
+ }
+
+ suppressPredicate=p;
+ suppressNode=nodePrime; /* was j*/
+
+ suppressTree=p->tcontext;
+
+ if (guardPred || ampersandPred) {
+ p->tcontext=MR_iterateOverTreeSuppressK(suppressTree,&suppressChain[1]);
+ if (p->tcontext == NULL) {
+ predicate_free(p);
+ result=NULL;
+ goto EXIT;
+ };
+ } else {
+ if (MR_isChain(p->tcontext)) {
+ p->tcontext=MR_iterateOverTreeSuppressK(suppressTree,&suppressChain[1]);
+ if (p->tcontext == NULL) {
+ predicate_free(p);
+ result=NULL;
+ goto EXIT;
+ };
+ }
+ }
+ result=p;
+EXIT:
+ return result;
+}
+
+#ifdef __USE_PROTOS
+void MR_suppressSearchReport(void)
+#else
+void MR_suppressSearchReport()
+#endif
+{
+ int i;
+ Node *p;
+ TokNode *tn;
+ int depth;
+ set setAnd;
+
+ /* number of tokens in back trace stack matches length of chain */
+
+ depth=0;
+ for (i=0; i < MR_BackTraceStack.count ; i++) {
+ p=(Node *) MR_BackTraceStack.data[i];
+ if (p->ntype == nToken) depth++;
+ };
+
+ require (depth == suppressChainLength,"depth > suppressChainLength");
+
+ /* token codes match chain */
+
+ depth=0;
+ for (i=0; i < MR_BackTraceStack.count ; i++) {
+ p=(Node *) MR_BackTraceStack.data[i];
+ if (p->ntype != nToken) continue;
+ tn=(TokNode *) p;
+ depth++;
+ if (set_nil(tn->tset)) {
+ require(set_el( (unsigned) tn->token,fset[depth]),
+ "MR_suppressSearchReport: no match to #token in chain");
+ } else {
+ setAnd=set_and(fset[depth],tn->tset);
+ require(!set_nil(setAnd),
+ "MR_suppressSearchReport: no match to #token set in chain");
+ set_free(setAnd);
+ };
+ };
+
+ /* have a match - now remove it from the predicate */
+
+ suppressSucceeded=1;
+
+ if (suppressSucceeded) {
+ fprintf(output,"\n");
+ fprintf(output,"#if 0\n");
+ fprintf(output,"\n");
+ fprintf(output,"Part (or all) of predicate with depth > 1 suppressed by ");
+ fprintf(output,"alternative without predicate\n\n");
+ MR_dumpPred(suppressPredicate,1);
+ fprintf(output,"The token sequence which is suppressed:");
+ fprintf(output," (");
+ for (i=1; i <= suppressChainLength; i++) {
+ fprintf(output," %s",TerminalString(suppressChain[i]));
+ };
+ fprintf(output," )\n");
+ fprintf(output,"The sequence of references which generate that sequence of tokens:\n\n");
+
+ MR_backTraceDumpItemReset();
+
+ for (i=0; i < MR_BackTraceStack.count ; i++) {
+ MR_backTraceDumpItem(output,0,(Node *) MR_BackTraceStack.data[i]);
+ };
+ fprintf(output,"\n");
+ fprintf(output,"#endif\n");
+ }
+}
+
+#ifdef __USE_PROTOS
+void MR_markCompromisedRule(Node *n)
+#else
+void MR_markCompromisedRule(n)
+ Node *n;
+#endif
+{
+ RuleEntry *q;
+ Node *mark=NULL;
+ Junction *j;
+
+ if (n->ntype == nRuleRef) {
+ mark=(Node *) MR_ruleReferenced( (RuleRefNode *) n);
+ } else if (n->ntype == nToken) {
+ mark=n;
+ } else if (n->ntype == nJunction) {
+ j=(Junction *)n;
+ switch (j->jtype) {
+ case aOptBlk:
+ case aLoopBlk:
+ case RuleBlk:
+ case EndRule:
+ case aPlusBlk:
+ case aLoopBegin:
+ mark=n;
+ break;
+ default:
+ break;
+ };
+ }
+
+ if (mark == NULL) return;
+
+ require (RulePtr != NULL,"RulePtr not initialized");
+
+ q = (RuleEntry *) hash_get(Rname,mark->rname);
+ require (q != NULL,"RuleEntry not found");
+ set_orel(q->rulenum,&MR_CompromisedRules);
+}
+
+#ifdef __USE_PROTOS
+void MR_alphaBetaTraceReport(void)
+#else
+void MR_alphaBetaTraceReport()
+#endif
+{
+ int i;
+
+ if (! AlphaBetaTrace) return;
+
+ MR_AlphaBetaMessageCount++;
+
+ fprintf(output,"\n");
+ fprintf(output,"#if 0\n");
+ fprintf(output,"\n");
+ fprintf(output,"Trace of references leading to attempt to compute the follow set of\n");
+ fprintf(output,"alpha in an \"(alpha)? beta\" block. It is not possible for antlr to\n");
+ fprintf(output,"compute this follow set because it is not known what part of beta has\n");
+ fprintf(output,"already been matched by alpha and what part remains to be matched.\n");
+ fprintf(output,"\n");
+ fprintf(output,"Rules which make use of the incorrect follow set will also be incorrect\n");
+ fprintf(output,"\n");
+
+ MR_backTraceDumpItemReset();
+
+ for (i=0; i < MR_BackTraceStack.count ; i++) {
+ MR_backTraceDumpItem(output,0,(Node *) MR_BackTraceStack.data[i]);
+ if (i < MR_BackTraceStack.count-1) {
+ MR_markCompromisedRule( (Node *) MR_BackTraceStack.data[i]);
+ };
+ };
+ fprintf(output,"\n");
+ fprintf(output,"#endif\n");
+}
+
+#ifdef __USE_PROTOS
+void MR_dumpRuleSet(set s)
+#else
+void MR_dumpRuleSet(s)
+ set s;
+#endif
+{
+ unsigned *cursor;
+ unsigned *origin=set_pdq(s);
+
+ require(origin != NULL,"set_pdq failed");
+
+ if (RulePtr == NULL) {
+ fprintf(stderr,"RulePtr[] not yet initialized");
+ } else {
+ for (cursor=origin; *cursor != nil ; cursor++) {
+/**** if (cursor != origin) fprintf(stderr,","); ****/
+ fprintf(stderr," %s",RulePtr[*cursor]->rname);
+ fprintf(stderr,"\n");
+ };
+ free( (char *) origin);
+ };
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/parser.dlg b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/parser.dlg
new file mode 100644
index 000000000..8c43dff30
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/parser.dlg
@@ -0,0 +1,1387 @@
+<<
+/* parser.dlg -- DLG Description of scanner
+ *
+ * Generated from: antlr.g
+ *
+ * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
+ * Purdue University Electrical Engineering
+ * With AHPCRC, University of Minnesota
+ * ANTLR Version 1.33MR33
+ */
+
+#define ANTLR_VERSION 13333
+#include "pcctscfg.h"
+#include "pccts_stdio.h"
+
+#include "pcctscfg.h"
+#include "set.h"
+#include <ctype.h>
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#define zzcr_attr(attr,tok,t)
+#include "antlr.h"
+#include "tokens.h"
+#include "dlgdef.h"
+LOOKAHEAD
+
+void
+#ifdef __USE_PROTOS
+zzerraction(void)
+#else
+zzerraction()
+#endif
+{
+ (*zzerr)("invalid token");
+ zzadvance();
+ zzskip();
+}
+>>
+
+<<%%lexaction
+
+/* maintained, but not used for now */
+set AST_nodes_refd_in_actions = set_init;
+int inAlt = 0;
+set attribsRefdFromAction = set_init; /* MR20 */
+int UsedOldStyleAttrib = 0;
+int UsedNewStyleLabel = 0;
+#ifdef __USE_PROTOS
+char *inline_set(char *);
+#else
+char *inline_set();
+#endif
+
+/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
+/* MR1 in DLG action */
+
+int tokenActionActive=0; /* MR1 */
+
+
+>>
+
+<<%%lexaction
+
+
+static char *
+#ifdef __USE_PROTOS
+getFileNameFromTheLineInfo(char *toStr, char *fromStr)
+#else
+getFileNameFromTheLineInfo(toStr, fromStr)
+char *toStr, *fromStr;
+#endif
+{
+ int i, j, k;
+
+ if (!fromStr || !toStr) return toStr;
+
+ /* find the first " */
+
+ for (i=0;
+ (i<MaxFileName) &&
+ (fromStr[i] != '\n') &&
+ (fromStr[i] != '\r') &&
+ (fromStr[i] != '\"');
+ i++) /* nothing */ ;
+
+ if ( (i == MaxFileName) ||
+ (fromStr[i] == '\n') ||
+ (fromStr[i] == '\r') ) {
+ return toStr;
+}
+
+ /* find the second " */
+
+ for (j=i+1;
+(j<MaxFileName) &&
+(fromStr[j] != '\n') &&
+(fromStr[j] != '\r') &&
+(fromStr[j] != '\"');
+j++) /* nothing */ ;
+
+ if ((j == MaxFileName) ||
+(fromStr[j] == '\n') ||
+(fromStr[j] == '\r') ) {
+ return toStr;
+}
+
+ /* go back until the last / or \ */
+
+ for (k=j-1;
+(fromStr[k] != '\"') &&
+(fromStr[k] != '/') &&
+(fromStr[k] != '\\');
+k--) /* nothing */ ;
+
+ /* copy the string after " / or \ into toStr */
+
+ for (i=k+1; fromStr[i] != '\"'; i++) {
+toStr[i-k-1] = fromStr[i];
+}
+
+ toStr[i-k-1] = '\0';
+
+ return toStr;
+}
+
+/* MR14 end of a block to support #line in antlr source code */
+
+
+>>
+
+<<%%lexaction
+
+#ifdef __USE_PROTOS
+void mark_label_used_in_sem_pred(LabelEntry *le) /* MR10 */
+#else
+void mark_label_used_in_sem_pred(le) /* MR10 */
+LabelEntry *le;
+#endif
+{
+ TokNode *tn;
+ require (le->elem->ntype == nToken,"mark_label_used... ntype != nToken");
+ tn=(TokNode *)le->elem;
+ require (tn->label != 0,"mark_label_used... TokNode has no label");
+ tn->label_used_in_semantic_pred=1;
+}
+>>
+
+
+%%START
+
+@
+ <<
+ NLA = Eof;
+ /* L o o k F o r A n o t h e r F i l e */
+ {
+ FILE *new_input;
+ new_input = NextFile();
+ if ( new_input == NULL ) { NLA=Eof; return; }
+ fclose( input );
+ input = new_input;
+ zzrdstream( input );
+ zzskip(); /* Skip the Eof (@) char i.e continue */
+ }
+ >>
+
+[\t\ ]+
+ <<
+ NLA = 76;
+ zzskip();
+ >>
+
+\n|\r|\r\n
+ <<
+ NLA = 77;
+ zzline++; zzskip();
+ >>
+
+\[
+ <<
+ NLA = 78;
+ zzmode(ACTIONS); zzmore();
+ istackreset();
+ pushint(']');
+ >>
+
+\<\<
+ <<
+ NLA = 79;
+ action_file=CurFile; action_line=zzline;
+ zzmode(ACTIONS); zzmore();
+ list_free(&CurActionLabels,0); /* MR10 */
+ numericActionLabel=0; /* MR10 */
+ istackreset();
+ pushint('>');
+ >>
+
+\"
+ <<
+ NLA = 80;
+ zzmode(STRINGS); zzmore();
+ >>
+
+/\*
+ <<
+ NLA = 81;
+ zzmode(COMMENTS); zzskip();
+ >>
+
+\*/
+ <<
+ NLA = 82;
+ warn("Missing /*; found dangling */"); zzskip();
+ >>
+
+//
+ <<
+ NLA = 83;
+ zzmode(CPP_COMMENTS); zzskip();
+ >>
+
+#line[\ \t]* [0-9]+ {[\ \t]* \"~[\"]+\" ([\ \t]* [0-9]*)* } (\n|\r|\r\n)
+ <<
+ NLA = 84;
+
+ zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
+ getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
+ >>
+
+#line ~[\n\r]* (\n|\r|\r\n)
+ <<
+ NLA = 85;
+
+ zzline++; zzmore();
+ >>
+
+\>\>
+ <<
+ NLA = 86;
+ warn("Missing <<; found dangling \>\>"); zzskip();
+ >>
+
+.
+ <<
+ NLA = WildCard;
+ >>
+
+\@
+ <<
+ NLA = 88;
+ FoundException = 1; /* MR6 */
+ FoundAtOperator = 1;
+ >>
+
+{\\}#pragma
+ <<
+ NLA = Pragma;
+ >>
+
+{\\}#FirstSetSymbol
+ <<
+ NLA = FirstSetSymbol;
+ >>
+
+{\\}#header
+ <<
+ NLA = 94;
+ >>
+
+{\\}#first
+ <<
+ NLA = 95;
+ >>
+
+{\\}#parser
+ <<
+ NLA = 96;
+ >>
+
+{\\}#tokdefs
+ <<
+ NLA = 97;
+ >>
+
+\}
+ <<
+ NLA = 98;
+ >>
+
+class
+ <<
+ NLA = 99;
+ >>
+
+\{
+ <<
+ NLA = 102;
+ >>
+
+!
+ <<
+ NLA = 103;
+ >>
+
+\<
+ <<
+ NLA = 104;
+ >>
+
+\>
+ <<
+ NLA = 105;
+ >>
+
+:
+ <<
+ NLA = 106;
+ >>
+
+;
+ <<
+ NLA = 107;
+ >>
+
+{\\}#lexaction
+ <<
+ NLA = 108;
+ >>
+
+{\\}#lexmember
+ <<
+ NLA = 109;
+ >>
+
+{\\}#lexprefix
+ <<
+ NLA = 110;
+ >>
+
+{\\}#pred
+ <<
+ NLA = 111;
+ >>
+
+\|\|
+ <<
+ NLA = 112;
+ >>
+
+&&
+ <<
+ NLA = 113;
+ >>
+
+\(
+ <<
+ NLA = 114;
+ >>
+
+\)
+ <<
+ NLA = 115;
+ >>
+
+{\\}#lexclass
+ <<
+ NLA = 116;
+ >>
+
+{\\}#errclass
+ <<
+ NLA = 117;
+ >>
+
+{\\}#tokclass
+ <<
+ NLA = 118;
+ >>
+
+..
+ <<
+ NLA = 119;
+ >>
+
+{\\}#token
+ <<
+ NLA = 120;
+ >>
+
+=
+ <<
+ NLA = 121;
+ >>
+
+[0-9]+
+ <<
+ NLA = 122;
+ >>
+
+\|
+ <<
+ NLA = 123;
+ >>
+
+\~
+ <<
+ NLA = 124;
+ >>
+
+^
+ <<
+ NLA = 125;
+ >>
+
+approx
+ <<
+ NLA = 126;
+ >>
+
+LL\(1\)
+ <<
+ NLA = 127;
+ >>
+
+LL\(2\)
+ <<
+ NLA = 128;
+ >>
+
+\*
+ <<
+ NLA = 129;
+ >>
+
+\+
+ <<
+ NLA = 130;
+ >>
+
+?
+ <<
+ NLA = 131;
+ >>
+
+=>
+ <<
+ NLA = 132;
+ >>
+
+exception
+ <<
+ NLA = 133;
+ >>
+
+default
+ <<
+ NLA = 134;
+ >>
+
+catch
+ <<
+ NLA = 135;
+ >>
+
+[a-z] [A-Za-z0-9_]*
+ <<
+ NLA = NonTerminal;
+
+ while ( zzchar==' ' || zzchar=='\t' ) {
+ zzadvance();
+ }
+ if ( zzchar == ':' && inAlt ) NLA = LABEL;
+ >>
+
+[A-Z] [A-Za-z0-9_]*
+ <<
+ NLA = TokenTerm;
+
+ while ( zzchar==' ' || zzchar=='\t' ) {
+ zzadvance();
+ }
+ if ( zzchar == ':' && inAlt ) NLA = LABEL;
+ >>
+
+{\\}#[A-Za-z0-9_]*
+ <<
+ NLA = 136;
+ warn(eMsg1("unknown meta-op: %s",LATEXT(1))); zzskip();
+ >>
+
+
+%%STRINGS
+
+@
+ <<
+ NLA = Eof;
+ >>
+
+\"
+ <<
+ NLA = QuotedTerm;
+ zzmode(START);
+ >>
+
+\n|\r|\r\n
+ <<
+ NLA = 3;
+
+ zzline++;
+ warn("eoln found in string");
+ zzskip();
+ >>
+
+\\(\n|\r|\r\n)
+ <<
+ NLA = 4;
+ zzline++; zzmore();
+ >>
+
+\\~[]
+ <<
+ NLA = 5;
+ zzmore();
+ >>
+
+~[\n\r\"\\]+
+ <<
+ NLA = 6;
+ zzmore();
+ >>
+
+
+%%ACTION_STRINGS
+
+@
+ <<
+ NLA = Eof;
+ >>
+
+\"
+ <<
+ NLA = 7;
+ zzmode(ACTIONS); zzmore();
+ >>
+
+\n|\r|\r\n
+ <<
+ NLA = 8;
+
+ zzline++;
+ warn("eoln found in string (in user action)");
+ zzskip();
+ >>
+
+\\(\n|\r|\r\n)
+ <<
+ NLA = 9;
+ zzline++; zzmore();
+ >>
+
+\\~[]
+ <<
+ NLA = 10;
+ zzmore();
+ >>
+
+~[\n\r\"\\]+
+ <<
+ NLA = 11;
+ zzmore();
+ >>
+
+
+%%ACTION_CHARS
+
+@
+ <<
+ NLA = Eof;
+ >>
+
+'
+ <<
+ NLA = 12;
+ zzmode(ACTIONS); zzmore();
+ >>
+
+\n|\r|\r\n
+ <<
+ NLA = 13;
+
+ zzline++;
+ warn("eoln found in char literal (in user action)");
+ zzskip();
+ >>
+
+\\~[]
+ <<
+ NLA = 14;
+ zzmore();
+ >>
+
+~[\n\r'\\]+
+ <<
+ NLA = 15;
+ zzmore();
+ >>
+
+
+%%ACTION_COMMENTS
+
+@
+ <<
+ NLA = Eof;
+ >>
+
+\*/
+ <<
+ NLA = 16;
+ zzmode(ACTIONS); zzmore();
+ >>
+
+\*
+ <<
+ NLA = 17;
+ zzmore();
+ >>
+
+\n|\r|\r\n
+ <<
+ NLA = 18;
+ zzline++; zzmore(); DAWDLE;
+ >>
+
+~[\n\r\*]+
+ <<
+ NLA = 19;
+ zzmore();
+ >>
+
+
+%%TOK_DEF_COMMENTS
+
+@
+ <<
+ NLA = Eof;
+ >>
+
+\*/
+ <<
+ NLA = 20;
+ zzmode(PARSE_ENUM_FILE);
+ zzmore();
+ >>
+
+\*
+ <<
+ NLA = 21;
+ zzmore();
+ >>
+
+\n|\r|\r\n
+ <<
+ NLA = 22;
+ zzline++; zzmore(); DAWDLE;
+ >>
+
+~[\n\r\*]+
+ <<
+ NLA = 23;
+ zzmore();
+ >>
+
+
+%%TOK_DEF_CPP_COMMENTS
+
+@
+ <<
+ NLA = Eof;
+ >>
+
+\n|\r|\r\n
+ <<
+ NLA = 24;
+ zzline++; zzmode(PARSE_ENUM_FILE); zzskip(); DAWDLE;
+ >>
+
+~[\n\r]+
+ <<
+ NLA = 25;
+ zzskip();
+ >>
+
+
+%%ACTION_CPP_COMMENTS
+
+@
+ <<
+ NLA = Eof;
+ >>
+
+\n|\r|\r\n
+ <<
+ NLA = 26;
+ zzline++; zzmode(ACTIONS); zzmore(); DAWDLE;
+ >>
+
+~[\n\r]+
+ <<
+ NLA = 27;
+ zzmore();
+ >>
+
+
+%%CPP_COMMENTS
+
+@
+ <<
+ NLA = Eof;
+ >>
+
+\n|\r|\r\n
+ <<
+ NLA = 28;
+ zzline++; zzmode(START); zzskip(); DAWDLE;
+ >>
+
+~[\n\r]+
+ <<
+ NLA = 29;
+ zzskip();
+ >>
+
+
+%%COMMENTS
+
+@
+ <<
+ NLA = Eof;
+ >>
+
+\*/
+ <<
+ NLA = 30;
+ zzmode(START); zzskip();
+ >>
+
+\*
+ <<
+ NLA = 31;
+ zzskip();
+ >>
+
+\n|\r|\r\n
+ <<
+ NLA = 32;
+ zzline++; zzskip(); DAWDLE;
+ >>
+
+~[\n\r\*]+
+ <<
+ NLA = 33;
+ zzskip();
+ >>
+
+
+%%ACTIONS
+
+@
+ <<
+ NLA = Eof;
+ >>
+
+\>\>
+ <<
+ NLA = Action;
+ /* these do not nest */
+ zzmode(START);
+ NLATEXT[0] = ' ';
+ NLATEXT[1] = ' ';
+ zzbegexpr[0] = ' ';
+ zzbegexpr[1] = ' ';
+ if ( zzbufovf ) {
+ err( eMsgd("action buffer overflow; size %d",ZZLEXBUFSIZE));
+ }
+
+/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
+ /* MR1 in DLG action */
+ /* MR1 Doesn't matter what kind of action it is - reset*/
+
+ tokenActionActive=0; /* MR1 */
+ >>
+
+\>\>?
+ <<
+ NLA = Pred;
+ /* these do not nest */
+ zzmode(START);
+ NLATEXT[0] = ' ';
+ NLATEXT[1] = ' ';
+ zzbegexpr[0] = '\0';
+ if ( zzbufovf ) {
+ err( eMsgd("predicate buffer overflow; size %d",ZZLEXBUFSIZE));
+ };
+#ifdef __cplusplus__
+ /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
+#else
+#ifdef __STDC__
+ /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
+#else
+#ifdef __USE_PROTOS
+ /* MRxx */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
+#else
+ /* MR10 */ list_apply(CurActionLabels,mark_label_used_in_sem_pred);
+#endif
+#endif
+#endif
+ >>
+
+\]
+ <<
+ NLA = PassAction;
+ if ( topint() == ']' ) {
+ popint();
+ if ( istackempty() ) /* terminate action */
+ {
+ zzmode(START);
+ NLATEXT[0] = ' ';
+ zzbegexpr[0] = ' ';
+ if ( zzbufovf ) {
+ err( eMsgd("parameter buffer overflow; size %d",ZZLEXBUFSIZE));
+ }
+ }
+ else {
+ /* terminate $[..] and #[..] */
+ if ( GenCC ) zzreplstr("))");
+ else zzreplstr(")");
+ zzmore();
+ }
+ }
+ else if ( topint() == '|' ) { /* end of simple [...] */
+ popint();
+ zzmore();
+ }
+ else zzmore();
+ >>
+
+consumeUntil\( [\ \t]* \{~[\}]+\} [\ \t]* \)
+ <<
+ NLA = 37;
+
+ zzmore();
+ zzreplstr(inline_set(zzbegexpr+
+ strlen("consumeUntil(")));
+ >>
+
+consumeUntil\( ~[\)]+ \)
+ <<
+ NLA = 38;
+ zzmore();
+ >>
+
+\n|\r|\r\n
+ <<
+ NLA = 39;
+ zzline++; zzmore(); DAWDLE;
+ >>
+
+\>
+ <<
+ NLA = 40;
+ zzmore();
+ >>
+
+$
+ <<
+ NLA = 41;
+ zzmore();
+ >>
+
+$$
+ <<
+ NLA = 42;
+ if ( !GenCC ) {zzreplstr("zzaRet"); zzmore();}
+ else err("$$ use invalid in C++ mode");
+ >>
+
+$\[\]
+ <<
+ NLA = 43;
+ if ( !GenCC ) {zzreplstr("zzempty_attr"); zzmore();}
+ else err("$[] use invalid in C++ mode");
+ >>
+
+$\[
+ <<
+ NLA = 44;
+
+ pushint(']');
+ if ( !GenCC ) zzreplstr("zzconstr_attr(");
+ else err("$[..] use invalid in C++ mode");
+ zzmore();
+ >>
+
+$[0-9]+
+ <<
+ NLA = 45;
+ {
+ static char buf[100];
+ numericActionLabel=1; /* MR10 */
+ if ( strlen(zzbegexpr)>(size_t)85 )
+ fatal("$i attrib ref too big");
+ set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction);
+ if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s)",
+ BlkLevel-1,zzbegexpr+1);
+ else sprintf(buf,"_t%d%s",
+ BlkLevel-1,zzbegexpr+1);
+ zzreplstr(buf);
+ zzmore();
+ UsedOldStyleAttrib = 1;
+ if ( UsedNewStyleLabel )
+ err("cannot mix old-style $i with new-style labels");
+ }
+ >>
+
+$[0-9]+.
+ <<
+ NLA = 46;
+ {
+ static char buf[100];
+ numericActionLabel=1; /* MR10 */
+ if ( strlen(zzbegexpr)>(size_t)85 )
+ fatal("$i.field attrib ref too big");
+ zzbegexpr[strlen(zzbegexpr)-1] = ' ';
+ set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction);
+ if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s).",
+ BlkLevel-1,zzbegexpr+1);
+ else sprintf(buf,"_t%d%s.",
+ BlkLevel-1,zzbegexpr+1);
+ zzreplstr(buf);
+ zzmore();
+ UsedOldStyleAttrib = 1;
+ if ( UsedNewStyleLabel )
+ err("cannot mix old-style $i with new-style labels");
+ }
+ >>
+
+$[0-9]+.[0-9]+
+ <<
+ NLA = 47;
+ {
+ static char buf[100];
+ static char i[20], j[20];
+ char *p,*q;
+ numericActionLabel=1; /* MR10 */
+ if (strlen(zzbegexpr)>(size_t)85) fatal("$i.j attrib ref too big");
+ for (p=zzbegexpr+1,q= &i[0]; *p!='.'; p++) {
+ if ( q == &i[20] )
+ fatalFL("i of $i.j attrib ref too big",
+ FileStr[CurFile], zzline );
+ *q++ = *p;
+ }
+ *q = '\0';
+ for (p++, q= &j[0]; *p!='\0'; p++) {
+ if ( q == &j[20] )
+ fatalFL("j of $i.j attrib ref too big",
+ FileStr[CurFile], zzline );
+ *q++ = *p;
+ }
+ *q = '\0';
+ if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%s,%s)",i,j);
+ else sprintf(buf,"_t%s%s",i,j);
+ zzreplstr(buf);
+ zzmore();
+ UsedOldStyleAttrib = 1;
+ if ( UsedNewStyleLabel )
+ err("cannot mix old-style $i with new-style labels");
+ }
+ >>
+
+$[_a-zA-Z][_a-zA-Z0-9]*
+ <<
+ NLA = 48;
+ { static char buf[300]; LabelEntry *el;
+ zzbegexpr[0] = ' ';
+ if ( CurRule != NULL &&
+ strcmp(CurRule, &zzbegexpr[1])==0 ) {
+ if ( !GenCC ) zzreplstr("zzaRet");
+ }
+ else if ( CurRetDef != NULL &&
+ strmember(CurRetDef, &zzbegexpr[1])) {
+ if ( hasMultipleOperands( CurRetDef ) ) {
+ require (strlen(zzbegexpr)<=(size_t)285,
+ "$retval attrib ref too big");
+ sprintf(buf,"_retv.%s",&zzbegexpr[1]);
+ zzreplstr(buf);
+ }
+ else zzreplstr("_retv");
+ }
+ else if ( CurParmDef != NULL &&
+ strmember(CurParmDef, &zzbegexpr[1])) {
+ ;
+ }
+ else if ( Elabel==NULL ) {
+ { err("$-variables in actions outside of rules are not allowed"); }
+ } else if ( (el=(LabelEntry *)hash_get(Elabel, &zzbegexpr[1]))!=NULL ) {
+ /* MR10 */
+ /* MR10 */ /* element labels might exist without an elem when */
+ /* MR10 */ /* it is a forward reference (to a rule) */
+ /* MR10 */
+ /* MR10 */ if ( GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) )
+ /* MR10 */ { err(eMsg1("There are no token ptrs for rule references: '$%s'",&zzbegexpr[1])); }
+ /* MR10 */
+ /* MR10 */ if ( !GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) && GenAST) {
+ /* MR10 */ err("You can no longer use attributes returned by rules when also using ASTs");
+ /* MR10 */ err(" Use upward inheritance (\"rule >[Attrib a] : ... <<$a=...\>\>\")");
+ /* MR10 */ };
+ /* MR10 */
+ /* MR10 */ /* keep track of <<... $label ...>> for semantic predicates in guess mode */
+ /* MR10 */ /* element labels contain pointer to the owners node */
+ /* MR10 */
+ /* MR10 */ if (el->elem != NULL && el->elem->ntype == nToken) {
+ /* MR10 */ list_add(&CurActionLabels,el);
+ /* MR10 */ };
+}
+else
+warn(eMsg1("$%s not parameter, return value, (defined) element label",&zzbegexpr[1]));
+}
+zzmore();
+ >>
+
+#0
+ <<
+ NLA = 49;
+ zzreplstr("(*_root)"); zzmore(); chkGTFlag();
+ >>
+
+#\[\]
+ <<
+ NLA = 50;
+ if ( GenCC ) {
+ if (NewAST) zzreplstr("(newAST)");
+ else zzreplstr("(new AST)");}
+ else {zzreplstr("zzastnew()");} zzmore();
+ chkGTFlag();
+ >>
+
+#\(\)
+ <<
+ NLA = 51;
+ zzreplstr("NULL"); zzmore(); chkGTFlag();
+ >>
+
+#[0-9]+
+ <<
+ NLA = 52;
+ {
+ static char buf[100];
+ if ( strlen(zzbegexpr)>(size_t)85 )
+ fatal("#i AST ref too big");
+ if ( GenCC ) sprintf(buf,"_ast%d%s",BlkLevel-1,zzbegexpr+1);
+ else sprintf(buf,"zzastArg(%s)",zzbegexpr+1);
+ zzreplstr(buf);
+ zzmore();
+ set_orel(atoi(zzbegexpr+1), &AST_nodes_refd_in_actions);
+ chkGTFlag();
+ }
+ >>
+
+#line[\ \t]* [0-9]+ {[\ \t]* \"~[\"]+\" ([\ \t]* [0-9]*)* } (\n|\r|\r\n)
+ <<
+ NLA = 53;
+
+ zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
+ getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
+ >>
+
+#line ~[\n\r]* (\n|\r|\r\n)
+ <<
+ NLA = 54;
+
+ zzline++; zzmore();
+ >>
+
+#[_a-zA-Z][_a-zA-Z0-9]*
+ <<
+ NLA = 55;
+
+ if ( !(strcmp(zzbegexpr, "#ifdef")==0 ||
+ strcmp(zzbegexpr, "#if")==0 ||
+ strcmp(zzbegexpr, "#else")==0 ||
+ strcmp(zzbegexpr, "#endif")==0 ||
+ strcmp(zzbegexpr, "#ifndef")==0 ||
+ strcmp(zzbegexpr, "#define")==0 ||
+ strcmp(zzbegexpr, "#pragma")==0 ||
+ strcmp(zzbegexpr, "#undef")==0 ||
+ strcmp(zzbegexpr, "#import")==0 ||
+ strcmp(zzbegexpr, "#line")==0 ||
+ strcmp(zzbegexpr, "#include")==0 ||
+ strcmp(zzbegexpr, "#error")==0) )
+ {
+ static char buf[100];
+ sprintf(buf, "%s_ast", zzbegexpr+1);
+ /* MR27 */ list_add(&CurAstLabelsInActions, mystrdup(zzbegexpr+1));
+ zzreplstr(buf);
+ chkGTFlag();
+ }
+ zzmore();
+ >>
+
+#\[
+ <<
+ NLA = 56;
+
+ pushint(']');
+ if ( GenCC ) {
+ if (NewAST) zzreplstr("(newAST(");
+ else zzreplstr("(new AST("); }
+ else zzreplstr("zzmk_ast(zzastnew(),");
+ zzmore();
+ chkGTFlag();
+ >>
+
+#\(
+ <<
+ NLA = 57;
+
+ pushint('}');
+ if ( GenCC ) {
+ if (tmakeInParser) {
+ zzreplstr("tmake(");
+ }
+ else {
+ zzreplstr("ASTBase::tmake(");
+ }
+ }
+ else {
+ zzreplstr("zztmake(");
+ }
+ zzmore();
+ chkGTFlag();
+ >>
+
+#
+ <<
+ NLA = 58;
+ zzmore();
+ >>
+
+\)
+ <<
+ NLA = 59;
+
+ if ( istackempty() )
+ zzmore();
+ else if ( topint()==')' ) {
+ popint();
+ }
+ else if ( topint()=='}' ) {
+ popint();
+ /* terminate #(..) */
+ zzreplstr(", NULL)");
+ }
+ zzmore();
+ >>
+
+\[
+ <<
+ NLA = 60;
+
+ pushint('|'); /* look for '|' to terminate simple [...] */
+ zzmore();
+ >>
+
+\(
+ <<
+ NLA = 61;
+
+ pushint(')');
+ zzmore();
+ >>
+
+\\\]
+ <<
+ NLA = 62;
+ zzreplstr("]"); zzmore();
+ >>
+
+\\\)
+ <<
+ NLA = 63;
+ zzreplstr(")"); zzmore();
+ >>
+
+\\>
+ <<
+ NLA = 64;
+ if (! tokenActionActive) zzreplstr(">"); /* MR1 */
+ zzmore(); /* MR1 */
+ >>
+
+'
+ <<
+ NLA = 65;
+ zzmode(ACTION_CHARS); zzmore();
+ >>
+
+\"
+ <<
+ NLA = 66;
+ zzmode(ACTION_STRINGS); zzmore();
+ >>
+
+\\$
+ <<
+ NLA = 67;
+ zzreplstr("$"); zzmore();
+ >>
+
+\\#
+ <<
+ NLA = 68;
+ zzreplstr("#"); zzmore();
+ >>
+
+\\(\n|\r|\r\n)
+ <<
+ NLA = 69;
+ zzline++; zzmore();
+ >>
+
+\\~[\]\)>$#]
+ <<
+ NLA = 70;
+ zzmore();
+ >>
+
+/
+ <<
+ NLA = 71;
+ zzmore();
+ >>
+
+/\*
+ <<
+ NLA = 72;
+ zzmode(ACTION_COMMENTS); zzmore();
+ >>
+
+\*/
+ <<
+ NLA = 73;
+ warn("Missing /*; found dangling */ in action"); zzmore();
+ >>
+
+//
+ <<
+ NLA = 74;
+ zzmode(ACTION_CPP_COMMENTS); zzmore();
+ >>
+
+~[\n\r\)\(\\$#\>\]\[\"'/]+
+ <<
+ NLA = 75;
+ zzmore();
+ >>
+
+
+%%PARSE_ENUM_FILE
+
+@
+ <<
+ NLA = Eof;
+ ;
+ >>
+
+[\t\ ]+
+ <<
+ NLA = 137;
+ zzskip();
+ >>
+
+\n|\r|\r\n
+ <<
+ NLA = 138;
+ zzline++; zzskip();
+ >>
+
+//
+ <<
+ NLA = 139;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzmore();
+ >>
+
+/\*
+ <<
+ NLA = 140;
+ zzmode(TOK_DEF_COMMENTS); zzskip();
+ >>
+
+#ifdef
+ <<
+ NLA = 141;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
+ >>
+
+#if
+ <<
+ NLA = 142;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
+ >>
+
+#ifndef
+ <<
+ NLA = 143;
+ ;
+ >>
+
+#else
+ <<
+ NLA = 144;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
+ >>
+
+#endif
+ <<
+ NLA = 145;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
+ >>
+
+#undef
+ <<
+ NLA = 146;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
+ >>
+
+#import
+ <<
+ NLA = 147;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
+ >>
+
+#define
+ <<
+ NLA = 149;
+ >>
+
+enum
+ <<
+ NLA = 151;
+ >>
+
+\{
+ <<
+ NLA = 152;
+ >>
+
+=
+ <<
+ NLA = 153;
+ >>
+
+,
+ <<
+ NLA = 154;
+ >>
+
+\}
+ <<
+ NLA = 155;
+ >>
+
+;
+ <<
+ NLA = 156;
+ >>
+
+[0-9]+
+ <<
+ NLA = INT;
+ >>
+
+[a-zA-Z_][_a-zA-Z0-9]*
+ <<
+ NLA = ID;
+ >>
+
+%%
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/pred.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/pred.c
new file mode 100644
index 000000000..eb11c4d95
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/pred.c
@@ -0,0 +1,821 @@
+/*
+ * pred.c -- source for predicate detection, manipulation
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include "pcctscfg.h"
+#include "set.h"
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#include "dlgdef.h"
+#include <ctype.h>
+
+#ifdef __USE_PROTOS
+static void complete_context_sets(RuleRefNode *, Predicate *);
+static void complete_context_trees(RuleRefNode *, Predicate *);
+#else
+static void complete_context_sets();
+static void complete_context_trees();
+#endif
+
+char *PRED_AND_LIST = "AND";
+char *PRED_OR_LIST = "OR";
+
+/*
+ * In C mode, return the largest constant integer found as the
+ * sole argument to LATEXT(i).
+ *
+ * In C++ mode, return the largest constant integer found as the
+ * sole argument to LT(i) given that the char before is nonalpha.
+ */
+
+int
+#ifdef __USE_PROTOS
+predicateLookaheadDepth(ActionNode *a)
+#else
+predicateLookaheadDepth(a)
+ActionNode *a;
+#endif
+{
+ int max_k=0;
+
+ if (a->predEntry != NULL) {
+ MR_pred_depth(a->predEntry->pred,&max_k);
+ goto PREDENTRY_EXIT;
+ }
+
+ if ( GenCC )
+ {
+ /* scan for LT(i) */
+ int k = 0;
+ char *p = a->action;
+ while ( p!=NULL )
+ {
+ p = strstr(p, "LT(");
+ if ( p!=NULL )
+ {
+ if ( p>=a->action && !isalpha(*(p-1)) )
+ {
+ k = atoi(p+strlen("LT("));
+ if ( k>max_k ) max_k=k;
+ }
+ p += strlen("LT(");
+ }
+ }
+ }
+ else {
+ /* scan for LATEXT(i) */
+ int k = 0;
+ char *p = a->action;
+ while ( p!=NULL )
+ {
+ p = strstr(p, "LATEXT(");
+ if ( p!=NULL )
+ {
+ p += strlen("LATEXT(");
+ k = atoi(p);
+ if ( k>max_k ) max_k=k;
+ }
+ }
+ }
+
+ if (max_k==0) {
+ max_k = 1; /* MR33 Badly designed if didn't set max_k when CLL_k = 1 */
+ if (CLL_k > 1) /* MR27 Don't warn if max(k,ck) == 1 */
+ {
+ if ( !a->frmwarned )
+ {
+ a->frmwarned = 1;
+ warnFL(eMsg1("predicate: %s missing, bad, or with i=0; assuming i=1",
+ GenCC?"LT(i)":"LATEXT(i)"),
+ FileStr[a->file], a->line);
+ }
+ }
+ }
+
+/* MR10 */ if ( max_k > CLL_k) {
+/* MR10 */ if ( !a->frmwarned )
+/* MR10 */ {
+/* MR10 */ a->frmwarned = 1;
+/* MR11 */ errFL(eMsgd2("predicate refers to lookahead token %d. Semantic lookahead is limited to max(k,ck)==%d",
+/* MR10 */ max_k,CLL_k),
+/* MR10 */ FileStr[a->file],a->line);
+/* MR10 */ if (max_k >= OutputLL_k) {
+/* MR10 */ if (!GenCC) {
+/* MR10 */ errFL(eMsgd(" the lookahead buffer size in C mode is %d token(s) (including the one just recognized)",
+/* MR10 */ OutputLL_k),
+/* MR10 */ FileStr[a->file],a->line);
+/* MR10 */ };
+/* MR10 */ };
+/* MR10 */ };
+/* MR10 */ max_k= CLL_k;
+/* MR10 */ };
+
+PREDENTRY_EXIT:
+ return max_k;
+}
+
+/* Find all predicates in a block of alternatives. DO NOT find predicates
+ * behind the block because that predicate could depend on things set in
+ * one of the nonoptional blocks
+ */
+
+Predicate *
+#ifdef __USE_PROTOS
+find_in_aSubBlk( Junction *alt )
+#else
+find_in_aSubBlk( alt )
+Junction *alt;
+#endif
+{
+ Predicate *a, *head=NULL, *tail=NULL, *root=NULL;
+ Junction *p = alt;
+
+ if (MRhoisting) {
+ return MR_find_in_aSubBlk(alt);
+ };
+ for (; p!=NULL; p=(Junction *)p->p2)
+ {
+ /* ignore empty alts */
+ if ( p->p1->ntype != nJunction ||
+ ((Junction *)p->p1)->jtype != EndBlk )
+ {
+ a = find_predicates(p->p1); /* get preds for this alt */
+ if ( a==NULL ) continue;
+
+ /* make an OR list of predicates */
+ if ( head==NULL )
+ {
+ root = new_pred();
+ root->expr = PRED_OR_LIST;
+ head = tail = a;
+ root->down = head;
+ }
+ else {
+ tail->right = a;
+ a->left = tail;
+ a->up = tail->up;
+ tail = a;
+ }
+ }
+ }
+
+ /* if just one pred, remove OR root */
+ if ( root!=NULL && root->down->right == NULL )
+ {
+ Predicate *d = root->down;
+ free( (char *) root);
+ return d;
+ }
+
+ return root;
+}
+
+Predicate *
+#ifdef __USE_PROTOS
+find_in_aOptBlk( Junction *alt )
+#else
+find_in_aOptBlk( alt )
+Junction *alt;
+#endif
+{
+ return find_in_aSubBlk( alt );
+}
+
+Predicate *
+#ifdef __USE_PROTOS
+find_in_aLoopBegin( Junction *alt )
+#else
+find_in_aLoopBegin( alt )
+Junction *alt;
+#endif
+{
+ return find_in_aSubBlk( (Junction *) alt->p1 ); /* get preds in alts */
+}
+
+Predicate *
+#ifdef __USE_PROTOS
+find_in_aPlusBlk( Junction *alt )
+#else
+find_in_aPlusBlk( alt )
+Junction *alt;
+#endif
+{
+ require(alt!=NULL&&alt->p2!=NULL, "invalid aPlusBlk");
+ return find_in_aSubBlk( alt );
+}
+
+/* Look for a predicate;
+ *
+ * Do not pass anything but Junction nodes; no Actions, Tokens, RuleRefs.
+ * This means that a "hoisting distance" of zero is the only distance
+ * allowable. Init actions are ignored.
+ *
+ * WARNING:
+ * Assumes no (..)? block after predicate for the moment.
+ * Does not check to see if pred is in production that can generate
+ * a sequence contained in the set of ambiguous tuples.
+ *
+ * Return the predicate found if any.
+ */
+
+
+Predicate *
+#ifdef __USE_PROTOS
+find_predicates( Node *alt )
+#else
+find_predicates( alt )
+Node *alt;
+#endif
+{
+#ifdef DBG_PRED
+ Junction *j;
+ RuleRefNode *r;
+ TokNode *t;
+#endif
+ Predicate *pred;
+
+ if ( alt==NULL ) return NULL;
+
+#ifdef DBG_PRED
+ switch ( alt->ntype )
+ {
+ case nJunction :
+ j = (Junction *) alt;
+ fprintf(stderr, "Junction(in %s)", j->rname);
+ switch ( j->jtype )
+ {
+ case aSubBlk :
+ fprintf(stderr,"aSubBlk\n");
+ break;
+ case aOptBlk :
+ fprintf(stderr,"aOptBlk\n");
+ break;
+ case aLoopBegin :
+ fprintf(stderr,"aLoopBeginBlk\n");
+ break;
+ case aLoopBlk :
+ fprintf(stderr,"aLoopBlk\n");
+ break;
+ case aPlusBlk :
+ fprintf(stderr,"aPlusBlk\n");
+ break;
+ case EndBlk :
+ fprintf(stderr,"EndBlk\n");
+ break;
+ case RuleBlk :
+ fprintf(stderr,"RuleBlk\n");
+ break;
+ case Generic :
+ fprintf(stderr,"Generic\n");
+ break;
+ case EndRule :
+ fprintf(stderr,"EndRule\n");
+ break;
+ }
+ break;
+ case nRuleRef :
+ r = (RuleRefNode *) alt;
+ fprintf(stderr, "RuleRef(in %s)\n", r->rname);
+ break;
+ case nToken :
+ t = (TokNode *) alt;
+ fprintf(stderr, "TokenNode(in %s)%s\n", t->rname, TokenString(t->token));
+ break;
+ case nAction :
+ fprintf(stderr, "Action\n");
+ break;
+ }
+#endif
+
+ switch ( alt->ntype )
+ {
+ case nJunction :
+ {
+ Predicate *a, *b;
+ Junction *p = (Junction *) alt;
+
+ /* lock nodes */
+ if ( p->jtype==aLoopBlk || p->jtype==RuleBlk ||
+ p->jtype==aPlusBlk || p->jtype==EndRule )
+ {
+ require(p->pred_lock!=NULL, "rJunc: lock array is NULL");
+ if ( p->pred_lock[1] )
+ {
+ return NULL;
+ }
+ p->pred_lock[1] = TRUE;
+ }
+
+ switch ( p->jtype )
+ {
+ case aSubBlk :
+ a = find_in_aSubBlk(p);
+ return a; /* nothing is visible past this guy */
+ case aOptBlk :
+ a = find_in_aOptBlk(p);
+ return a;
+ case aLoopBegin :
+ a = find_in_aLoopBegin(p);
+ return a;
+ case aLoopBlk :
+ a = find_in_aSubBlk(p);
+ p->pred_lock[1] = FALSE;
+ return a;
+ case aPlusBlk :
+ a = find_in_aPlusBlk(p);
+ p->pred_lock[1] = FALSE;
+ return a; /* nothing is visible past this guy */
+ case RuleBlk :
+ a = find_predicates(p->p1);
+ p->pred_lock[1] = FALSE;
+ return a;
+ case Generic :
+ a = find_predicates(p->p1);
+ b = find_predicates(p->p2);
+ if ( p->pred_lock!=NULL ) p->pred_lock[1] = FALSE;
+ if ( a==NULL ) return b;
+ if ( b==NULL ) return a;
+ /* otherwise OR the two preds together */
+ {
+ fatal_internal("hit unknown situation during predicate hoisting");
+ }
+ case EndBlk :
+ case EndRule : /* Find no predicates after a rule ref */
+ return NULL;
+ default:
+ fatal_internal("this cannot be printed\n");
+ break;
+ }
+ }
+ case nAction :
+ {
+ ActionNode *p = (ActionNode *) alt;
+ if ( p->noHoist) return NULL; /* MR12c */
+ if ( p->init_action ) return find_predicates(p->next);
+ if ( p->is_predicate )
+ {
+ Tree *t=NULL;
+#ifdef DBG_PRED
+ fprintf(stderr, "predicate: <<%s>>?\n", p->action);
+#endif
+ if ( p->guardpred!=NULL )
+ {
+ pred = predicate_dup(p->guardpred);
+ MR_guardPred_plainSet(p,pred); /* MR12c */
+ }
+ else
+ {
+ pred = new_pred();
+ pred->k = predicateLookaheadDepth(p);
+ pred->source = p;
+ pred->expr = p->action;
+ if ( HoistPredicateContext && pred->k > 1 )
+ {
+ /* MR30 No need to use first_item_is_guess_block_extra
+ since we know this is an action, not a (...)* or
+ (...)+ block.
+ */
+
+ if ( first_item_is_guess_block((Junction *)p->next) )
+ {
+ warnFL("cannot compute context of predicate in front of (..)? block",
+ FileStr[p->file], p->line);
+ }
+ else
+ {
+ ConstrainSearch = 0;
+/* MR11 */ if (p->ampersandPred != NULL) {
+/* MR11 */ TRAV(p,
+/* MR11 */ pred->k,
+/* MR11 */ &(pred->completionTree), t);
+/* MR11 */ } else {
+ TRAV(p->next,
+ pred->k,
+ &(pred->completionTree), t);
+ };
+ pred->tcontext = t;
+ MR_check_pred_too_long(pred,pred->completionTree);
+#ifdef DBG_PRED
+ fprintf(stderr, "LL(%d) context:", pred->k);
+ preorder(t);
+ fprintf(stderr, "\n");
+#endif
+ }
+ }
+ else if ( HoistPredicateContext && pred->k == 1 )
+ {
+ pred->scontext[1] = empty;
+ /* MR30 No need to use first_item_is_guess_block_extra
+ since we know this is an action.
+ */
+ if ( first_item_is_guess_block((Junction *)p->next) )
+ {
+ warnFL("cannot compute context of predicate in front of (..)? block",
+ FileStr[p->file], p->line);
+ }
+ else
+ {
+ REACH((Junction *)p->next,
+ 1,
+ &(pred->completionSet),
+ pred->scontext[1]);
+ MR_check_pred_too_long(pred,pred->completionSet);
+#ifdef DBG_PRED
+ fprintf(stderr, "LL(1) context:");
+ s_fprT(stderr, pred->scontext[1]);
+ fprintf(stderr, "\n");
+#endif
+ }
+ }
+ }
+ {
+ Predicate *d = find_predicates(p->next);
+ Predicate *root;
+
+/* Warning: Doesn't seem like the up pointers will all be set correctly;
+ * TJP: that's ok, we're not using them now.
+ */
+ if ( d!=NULL )
+ {
+ root = new_pred();
+ root->expr = PRED_AND_LIST;
+ root->down = pred;
+ pred->right = d;
+ pred->up = root;
+ d->left = pred;
+ d->up = pred->up;
+ return root;
+ }
+ }
+ return pred;
+ }
+ return NULL;
+ }
+ case nRuleRef :
+ {
+ Predicate *a;
+ RuleRefNode *p = (RuleRefNode *) alt;
+ Junction *r;
+ Junction *save_MR_RuleBlkWithHalt;
+
+ RuleEntry *q = (RuleEntry *) hash_get(Rname, p->text);
+ if ( q == NULL )
+ {
+ warnFL( eMsg1("rule %s not defined",p->text), FileStr[p->file], p->line );
+ return NULL;
+ }
+ r = RulePtr[q->rulenum];
+ if ( r->pred_lock[1] )
+ {
+ /* infinite left-recursion; ignore 'cause LL sup 1 (k) analysis
+ * must have seen it earlier.
+ */
+ return NULL;
+ }
+
+ /* MR10 There should only be one halt set at a time. */
+ /* MR10 Life would have been easier with a global variable */
+ /* MR10 (at least for this particular need) */
+ /* MR10 Unset the old one and set the new one, later undo. */
+
+ require(r->end->halt == FALSE,"should only have one halt at a time");
+
+/* MR10 */ require(MR_RuleBlkWithHalt == NULL ||
+/* MR10 */ (MR_RuleBlkWithHalt->jtype == RuleBlk && MR_RuleBlkWithHalt->end->halt == TRUE),
+/* MR10 */ "RuleBlkWithHalt->end not RuleBlk or does not have halt set");
+/* MR10 */ if (MR_RuleBlkWithHalt != NULL) {
+/* MR10 */ MR_RuleBlkWithHalt->end->halt=FALSE;
+/* MR10 */ };
+
+/*** fprintf(stderr,"\nSetting halt on junction #%d\n",r->end->seq); ***/
+
+ require(r->end->halt == FALSE,"rule->end->halt already set");
+
+ save_MR_RuleBlkWithHalt=MR_RuleBlkWithHalt;
+
+/* MR10 */ MR_pointerStackPush(&MR_RuleBlkWithHaltStack,MR_RuleBlkWithHalt);
+/* MR10 */ MR_pointerStackPush(&MR_PredRuleRefStack,p);
+
+ r->end->halt = TRUE;
+/* MR10 */ MR_RuleBlkWithHalt=r;
+
+ a = find_predicates((Node *)r);
+
+ require(r->end->halt == TRUE,"rule->end->halt not set");
+ r->end->halt = FALSE;
+
+/* MR10 */ MR_pointerStackPop(&MR_PredRuleRefStack);
+/* MR10 */ MR_RuleBlkWithHalt=(Junction *) MR_pointerStackPop(&MR_RuleBlkWithHaltStack);
+
+ require (MR_RuleBlkWithHalt==save_MR_RuleBlkWithHalt,
+ "RuleBlkWithHaltStack not consistent");
+
+/* MR10 */ require(MR_RuleBlkWithHalt == NULL ||
+/* MR10 */ (MR_RuleBlkWithHalt->jtype == RuleBlk && MR_RuleBlkWithHalt->end->halt == FALSE),
+/* MR10 */ "RuleBlkWithHalt->end not RuleBlk or has no halt set");
+/* MR10 */ if (MR_RuleBlkWithHalt != NULL) {
+/* MR10 */ MR_RuleBlkWithHalt->end->halt=TRUE;
+/* MR10 */ };
+
+/*** fprintf(stderr,"\nRestoring halt on junction #%d\n",r->end->seq); ***/
+
+ if ( a==NULL ) return NULL;
+
+ /* attempt to compute the "local" FOLLOW just like in normal lookahead
+ * computation if needed
+ */
+
+ complete_context_sets(p,a);
+ complete_context_trees(p,a);
+
+/* MR10 */ MR_cleanup_pred_trees(a);
+
+ return a;
+ }
+ case nToken :
+ break;
+ }
+
+ return NULL;
+}
+
+#ifdef __USE_PROTOS
+Predicate *MR_find_predicates_and_supp(Node *alt)
+#else
+Predicate *MR_find_predicates_and_supp(alt)
+ Node *alt;
+#endif
+{
+ Predicate *p;
+
+ p=find_predicates(alt);
+ p=MR_suppressK(alt,p);
+ return p;
+}
+
+Predicate *
+#ifdef __USE_PROTOS
+new_pred( void )
+#else
+new_pred( )
+#endif
+{
+ Predicate *p = (Predicate *) calloc(1,sizeof(Predicate)); /* MR10 */
+ require(p!=NULL, "new_pred: cannot alloc predicate");
+ p->scontext[0]=empty;
+ p->scontext[1]=empty;
+ p->completionTree=empty;
+ p->completionSet=empty;
+ p->plainSet=empty;
+ return p;
+}
+
+static void
+#ifdef __USE_PROTOS
+complete_context_sets( RuleRefNode *p, Predicate *a )
+#else
+complete_context_sets( p, a )
+RuleRefNode *p;
+Predicate *a;
+#endif
+{
+ set rk2, b;
+ int k2;
+
+#ifdef DBG_PRED
+ fprintf(stderr, "enter complete_context_sets\n");
+#endif
+ for (; a!=NULL; a=a->right)
+ {
+ if ( a->expr == PRED_AND_LIST || a->expr == PRED_OR_LIST )
+ {
+ complete_context_sets(p,a->down);
+ continue;
+ }
+ rk2 = b = empty;
+ while ( !set_nil(a->completionSet) )
+ {
+ k2 = set_int(a->completionSet);
+ set_rm(k2, a->completionSet);
+
+ REACH(p->next, k2, &rk2, b);
+ set_orin(&(a->scontext[1]), b);
+ set_free(b);
+ }
+
+ set_orin(&(a->completionSet), rk2);/* remember what we couldn't do */
+ set_free(rk2);
+#ifdef DBG_PRED
+ fprintf(stderr, "LL(1) context for %s(addr 0x%x) after ruleref:", a->expr, a);
+ s_fprT(stderr, a->scontext[1]);
+ fprintf(stderr, "\n");
+#endif
+/* complete_context_sets(p, a->down);*/
+ }
+#ifdef DBG_PRED
+ fprintf(stderr, "exit complete_context_sets\n");
+#endif
+}
+
+static void
+#ifdef __USE_PROTOS
+complete_context_trees( RuleRefNode *p, Predicate *a )
+#else
+complete_context_trees( p, a )
+RuleRefNode *p;
+Predicate *a;
+#endif
+{
+ set rk2;
+ int k2;
+ Tree *u;
+
+#ifdef DBG_PRED
+ fprintf(stderr, "enter complete_context_trees\n");
+#endif
+ for (; a!=NULL; a=a->right)
+ {
+ if ( a->expr == PRED_AND_LIST || a->expr == PRED_OR_LIST )
+ {
+ complete_context_trees(p, a->down);
+ continue;
+ }
+ rk2 = empty;
+
+ /* any k left to do? if so, link onto tree */
+ while ( !set_nil(a->completionTree) )
+ {
+ k2 = set_int(a->completionTree);
+ set_rm(k2, a->completionTree);
+ u = NULL;
+
+ TRAV(p->next, k2, &rk2, u);
+
+ /* any subtrees missing k2 tokens, add u onto end */
+ a->tcontext = tlink(a->tcontext, u, k2);
+ Tfree(u); /* MR10 */
+ }
+ set_orin(&(a->completionTree), rk2);/* remember what we couldn't do */
+ set_free(rk2);
+#ifdef DBG_PRED
+ fprintf(stderr, "LL(i<%d) context after ruleref:", LL_k);
+ preorder(a->tcontext);
+ fprintf(stderr, "\n");
+#endif
+/* complete_context_trees(p, a->down);*/
+ }
+#ifdef DBG_PRED
+ fprintf(stderr, "exit complete_context_trees\n");
+#endif
+}
+
+/* Walk a list of predicates and return the set of all tokens in scontext[1]'s */
+set
+#ifdef __USE_PROTOS
+covered_set( Predicate *p )
+#else
+covered_set( p )
+Predicate *p;
+#endif
+{
+ set a;
+
+ a = empty;
+ for (; p!=NULL; p=p->right)
+ {
+ if ( p->expr == PRED_AND_LIST || p->expr == PRED_OR_LIST )
+ {
+ set_orin(&a, covered_set(p->down));
+ continue;
+ }
+ set_orin(&a, p->scontext[1]);
+ set_orin(&a, covered_set(p->down));
+ }
+ return a;
+}
+
+/* MR10 predicate_free()
+ MR10 Don't free the leaf nodes since they are part of the action node
+*/
+
+#ifdef __USE_PROTOS
+void predicate_free(Predicate *p)
+#else
+void predicate_free(p)
+ Predicate *p;
+#endif
+{
+ if (p == NULL) return;
+ predicate_free(p->right);
+ predicate_free(p->down);
+ if (p->cloned ||
+ p->source == NULL ||
+ p->source->guardpred == NULL ||
+ p->expr == PRED_AND_LIST ||
+ p->expr == PRED_OR_LIST) {
+ set_free(p->scontext[1]);
+ set_free(p->completionSet);
+ set_free(p->completionTree);
+ set_free(p->plainSet);
+ Tfree(p->tcontext);
+ free( (char *) p);
+ } else {
+ p->right=NULL;
+ p->down=NULL; /* MR13 *** debug */
+ };
+}
+
+/* MR10 predicate_dup() */
+
+#ifdef __USE_PROTOS
+Predicate * predicate_dup_xxx(Predicate *p,int contextToo)
+#else
+Predicate * predicate_dup_xxx(p,contextToo)
+ Predicate *p;
+ int contextToo;
+#endif
+{
+ Predicate *q;
+
+ if (p == NULL) return NULL;
+ q=new_pred();
+ q->down=predicate_dup(p->down);
+ q->right=predicate_dup(p->right);
+
+ /*
+ don't replicate expr - it is read-only
+ and address comparison is used to look
+ for identical predicates.
+ */
+
+ q->expr=p->expr;
+ q->k=p->k;
+ q->source=p->source;
+ q->cloned=1;
+ q->ampersandStyle=p->ampersandStyle;
+ q->inverted=p->inverted;
+ q->predEntry=p->predEntry;
+ q->plainSet=set_dup(p->plainSet);
+
+ if (contextToo) {
+ q->tcontext=tdup(p->tcontext);
+ q->scontext[0]=set_dup(p->scontext[0]);
+ q->scontext[1]=set_dup(p->scontext[1]);
+ q->completionTree=set_dup(p->completionTree);
+ q->completionSet=set_dup(p->completionSet);
+ };
+
+ /* don't need to dup "redundant" */
+
+ return q;
+
+}
+
+#ifdef __USE_PROTOS
+Predicate * predicate_dup_without_context(Predicate *p)
+#else
+Predicate * predicate_dup_without_context(p)
+ Predicate *p;
+#endif
+{
+ return predicate_dup_xxx(p,0);
+}
+
+#ifdef __USE_PROTOS
+Predicate * predicate_dup(Predicate *p)
+#else
+Predicate * predicate_dup(p)
+ Predicate *p;
+#endif
+{
+ return predicate_dup_xxx(p,1);
+}
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/proto.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/proto.h
new file mode 100644
index 000000000..53035e720
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/proto.h
@@ -0,0 +1,852 @@
+/*
+ * proto.h -- function prototypes
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+ /* V a r i a b l e s */
+
+extern int tp;
+extern Junction *SynDiag;
+extern char Version[];
+extern char VersionDef[];
+#ifdef __cplusplus
+extern void (*fpPrint[])(...);
+#else
+extern void (*fpPrint[])();
+#endif
+#ifdef __cplusplus
+extern struct _set (*fpReach[])(...);
+#else
+extern struct _set (*fpReach[])();
+#endif
+#ifdef __cplusplus
+extern struct _tree *(*fpTraverse[])(...);
+#else
+extern struct _tree *(*fpTraverse[])();
+#endif
+#ifdef __cplusplus
+extern void (**fpTrans)(...);
+#else
+extern void (**fpTrans)();
+#endif
+#ifdef __cplusplus
+extern void (**fpJTrans)(...);
+#else
+extern void (**fpJTrans)();
+#endif
+#ifdef __cplusplus
+extern void (*C_Trans[NumNodeTypes+1])(...);
+#else
+extern void (*C_Trans[])();
+#endif
+#ifdef __cplusplus
+extern void (*C_JTrans[NumJuncTypes+1])(...);
+#else
+extern void (*C_JTrans[])();
+#endif
+extern int BlkLevel;
+extern int CurFile;
+extern char *CurPredName;
+extern char *CurRule;
+extern int CurRuleDebug; /* MR13 */
+extern Junction *CurRuleBlk;
+extern RuleEntry *CurRuleNode;
+extern ListNode *CurElementLabels;
+extern ListNode *CurAstLabelsInActions; /* MR27 */
+extern ListNode *ContextGuardPredicateList; /* MR13 */
+extern ListNode *CurActionLabels;
+extern int numericActionLabel; /* MR10 << ... $1 ... >> or << ... $1 ... >>? */
+extern ListNode *NumericPredLabels; /* MR10 << ... $1 ... >>? ONLY */
+extern char *FileStr[];
+extern int NumFiles;
+extern int EpToken;
+extern int WildCardToken;
+extern Entry **Tname,
+ **Texpr,
+ **Rname,
+ **Fcache,
+ **Tcache,
+ **Elabel,
+ **Sname,
+ **Pname; /* MR11 */
+extern ListNode *ExprOrder;
+extern ListNode **Cycles;
+extern int TokenNum;
+extern int LastTokenCounted;
+extern ListNode *BeforeActions, *AfterActions, *LexActions;
+
+/* MR1 */
+/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
+/* MR1 via #lexmember <<....>> & #lexprefix <<...>> */
+/* MR1 */
+
+extern ListNode *LexMemberActions; /* MR1 */
+extern ListNode *LexPrefixActions; /* MR1 */
+
+extern set *fset; /* for constrained search */ /* MR11 */
+extern int maxk; /* for constrained search */ /* MR11 */
+extern int Save_argc; /* MR10 */
+extern char **Save_argv; /* MR10 */
+extern ListNode *eclasses, *tclasses;
+extern char *HdrAction;
+extern char *FirstAction; /* MR11 */
+extern FILE *ErrFile;
+extern char *RemapFileName;
+extern char *ErrFileName;
+extern char *DlgFileName;
+extern char *DefFileName;
+extern char *ModeFileName;
+extern char *StdMsgName;
+extern int NumRules;
+extern Junction **RulePtr;
+extern int LL_k;
+extern int CLL_k;
+extern char *decodeJType[];
+extern int PrintOut;
+extern int PrintAnnotate;
+extern int CodeGen;
+extern int LexGen;
+extern int esetnum;
+extern int setnum;
+extern int wordnum;
+extern int GenAST;
+extern int GenANSI;
+extern int **FoStack;
+extern int **FoTOS;
+extern int GenExprSetsOpt;
+extern FILE *DefFile;
+extern int CannotContinue;
+extern int GenCR;
+extern int GenLineInfo;
+extern int GenLineInfoMS;
+extern int action_file, action_line;
+extern int TraceGen;
+extern int CurAmbigAlt1, CurAmbigAlt2, CurAmbigline, CurAmbigfile;
+extern char *CurAmbigbtype;
+extern int elevel;
+extern int GenEClasseForRules;
+extern FILE *input, *output;
+extern char **TokenStr, **ExprStr;
+extern int CurrentLexClass, NumLexClasses;
+extern LClass lclass[];
+extern char LexStartSymbol[];
+extern char *CurRetDef;
+extern char *CurParmDef;
+extern int OutputLL_k;
+extern int TreeResourceLimit;
+extern int DemandLookahead;
+extern char *RulePrefix;
+extern int GenStdPccts;
+extern char *stdpccts;
+extern int ParseWithPredicates;
+extern int ConstrainSearch;
+extern int PURIFY; /* MR23 */
+
+extern set MR_CompromisedRules; /* MR14 */
+extern int MR_AmbSourceSearch; /* MR11 */
+extern int MR_SuppressSearch; /* MR13 */
+extern int MR_AmbSourceSearchGroup; /* MR11 */
+extern int MR_AmbSourceSearchChoice; /* MR11 */
+extern int MR_AmbSourceSearchLimit; /* MR11 */
+extern int MR_usingPredNames; /* MR11 */
+extern int MR_ErrorSetComputationActive; /* MR14 */
+extern char *MR_AmbAidRule; /* MR11 */
+extern int MR_AmbAidLine; /* MR11 */
+extern int MR_AmbAidMultiple; /* MR11 */
+extern int MR_AmbAidDepth; /* MR11 */
+extern int MR_skipped_e3_report; /* MR11 */
+extern int MR_matched_AmbAidRule; /* MR11 */
+extern int MR_Inhibit_Tokens_h_Gen; /* MR13 */
+extern int NewAST; /* MR13 */
+extern int tmakeInParser; /* MR23 */
+extern int AlphaBetaTrace; /* MR14 */
+extern int MR_BlkErr; /* MR21 */
+extern int MR_AlphaBetaWarning; /* MR14 */
+extern int MR_AlphaBetaMessageCount; /* MR14 */
+extern int MR_MaintainBackTrace; /* MR14 */
+extern int MR_BadExprSets; /* MR13 */
+extern int FoundGuessBlk;
+extern int FoundException;
+extern int FoundAtOperator; /* MR6 */
+extern int FoundExceptionGroup; /* MR6 */
+extern int WarningLevel;
+extern int UseStdout; /* MR6 */
+extern int TabWidth; /* MR6 */
+extern int pLevel;
+extern int pAlt1;
+extern int pAlt2;
+extern int AImode;
+extern int HoistPredicateContext;
+extern int MRhoisting; /* MR9 */
+extern int MRhoistingk; /* MR13 */
+extern int MR_debugGenRule; /* MR11 */
+extern int GenCC;
+extern char *ParserName;
+extern char *StandardSymbols[];
+extern char *ASTSymbols[];
+extern set reserved_positions;
+extern set all_tokens;
+extern set imag_tokens;
+extern set tokclasses;
+extern ListNode *ForcedTokens;
+extern int *TokenInd;
+extern FILE *Parser_h, *Parser_c;
+extern char CurrentClassName[];
+extern int no_classes_found;
+extern char Parser_h_Name[];
+extern char Parser_c_Name[];
+extern char MRinfoFile_Name[]; /* MR10 */
+extern FILE *MRinfoFile; /* MR10 */
+extern int MRinfo; /* MR10 */
+extern int MRinfoSeq; /* MR10 */
+extern int InfoP; /* MR10 */
+extern int InfoT; /* MR10 */
+extern int InfoF; /* MR10 */
+extern int InfoM; /* MR10 */
+extern int InfoO; /* MR12 */
+extern int PotentialSuppression; /* MR10 */
+extern int PotentialDummy; /* MR10 */
+extern int TnodesInUse; /* MR10 */
+extern int TnodesPeak; /* MR10 */
+extern int TnodesReportThreshold; /* MR11 */
+extern int TnodesAllocated; /* MR10 */
+extern char *ClassDeclStuff; /* MR10 */
+extern char *BaseClassName; /* MR22 */
+extern ListNode *class_before_actions, *class_after_actions;
+extern char *UserTokenDefsFile;
+extern int UserDefdTokens;
+extern ListNode *MetaTokenNodes;
+extern char *OutputDirectory;
+extern int DontCopyTokens;
+extern int LTinTokenAction; /* MR23 */
+extern set AST_nodes_refd_in_actions;
+extern ListNode *CurExGroups;
+extern int CurBlockID;
+extern int CurAltNum;
+extern Junction *CurAltStart;
+extern Junction *OuterAltStart; /* chain exception groups MR7 */
+extern ExceptionGroup *DefaultExGroup;
+extern int NumSignals;
+extern int ContextGuardTRAV;
+extern Junction *MR_RuleBlkWithHalt; /* MR10 */
+extern PointerStack MR_BackTraceStack; /* MR10 */
+extern PointerStack MR_PredRuleRefStack; /* MR10 */
+extern PointerStack MR_RuleBlkWithHaltStack; /* MR10 */
+
+/* */
+/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
+/* MR1 in DLG action */
+/* */
+extern int tokenActionActive; /* MR1 */
+
+extern char *PRED_OR_LIST; /* MR10 */
+extern char *PRED_AND_LIST; /* MR10 */
+
+#ifdef __VMS
+#define STRICMP strcasecmp /* MR21 */
+#else
+#define STRICMP stricmp /* MR21 */
+#endif
+
+/* MR26 */
+#ifdef PCCTS_USE_STDARG
+extern Tree *tmake(Tree *root, ...);
+#else
+extern Tree *tmake();
+#endif
+
+#ifdef __USE_PROTOS
+extern int STRICMP(const char*, const char*);
+extern void istackreset(void);
+extern int istacksize(void);
+extern void pushint(int);
+extern int popint( void );
+extern int istackempty( void );
+extern int topint( void );
+extern void NewSetWd( void );
+extern void DumpSetWd( void );
+extern void DumpSetWdForC( void );
+extern void DumpSetWdForCC( void );
+extern void NewSet( void );
+extern void FillSet( set );
+extern void ComputeErrorSets( void );
+extern void ComputeTokSets( void );
+extern void SubstErrorClass( set * );
+extern int DefErrSet( set *, int, char * );
+extern int DefErrSetForC( set *, int, char * );
+extern int DefErrSetForCC( set *, int, char * );
+extern int DefErrSet1(int, set *, int, char *); /* MR21 */
+extern int DefErrSetForC1(int, set *, int, char *, const char* ); /* MR21 */
+extern int DefErrSetForCC1(int, set *, int, char *, const char* ); /* MR21 */
+extern int DefErrSetWithSuffix(int, set *, int, char *, const char *); /* MR21 */
+extern void GenErrHdr( void );
+extern void dumpExpr( FILE *, char * );
+extern void addParm( Node *, char * );
+extern Graph buildAction( char *, int, int, int );
+extern Graph buildToken( char * );
+extern Graph buildWildCard( char * );
+extern Graph buildRuleRef( char * );
+extern Graph Or( Graph, Graph );
+extern Graph Cat( Graph, Graph );
+extern Graph makeOpt( Graph, int, char *);
+extern Graph makeBlk( Graph, int, char *);
+extern Graph makeLoop( Graph, int, char *);
+extern Graph makePlus( Graph, int, char *);
+extern Graph emptyAlt( void );
+extern Graph emptyAlt3( void );
+extern TokNode * newTokNode( void );
+extern RuleRefNode * newRNode( void );
+extern Junction * newJunction( void );
+extern ActionNode * newActionNode( void );
+extern char * makelocks( void );
+extern void preorder( Tree * );
+extern Tree * tnode( int );
+extern void _Tfree( Tree * );
+extern Tree * tdup( Tree * );
+extern int is_single_tuple( Tree * );
+extern Tree * tappend( Tree *, Tree * );
+extern void Tfree( Tree * );
+extern Tree * tlink( Tree *, Tree *, int );
+extern Tree * tshrink( Tree * );
+extern Tree * tflatten( Tree * );
+extern Tree * tJunc( Junction *, int, set * );
+extern Tree * tRuleRef( RuleRefNode *, int, set * );
+extern Tree * tToken( TokNode *, int, set * );
+extern Tree * tAction( ActionNode *, int, set * );
+extern int tmember( Tree *, Tree * );
+extern int tmember_constrained( Tree *, Tree * );
+extern Tree * tleft_factor( Tree * );
+extern Tree * trm_perm( Tree *, Tree * );
+extern void tcvt( set *, Tree * );
+extern Tree * permute( int, int );
+extern Tree * VerifyAmbig( Junction *, Junction *, unsigned **, set *, Tree **, Tree **, int * );
+extern set rJunc( Junction *, int, set * );
+extern set rRuleRef( RuleRefNode *, int, set * );
+extern set rToken( TokNode *, int, set * );
+extern set rAction( ActionNode *, int, set * );
+extern void HandleAmbiguity( Junction *, Junction *, Junction *, int );
+extern set First( Junction *, int, int, int * );
+extern void freeBlkFsets( Junction * );
+extern void genAction( ActionNode * );
+extern void genRuleRef( RuleRefNode * );
+extern void genToken( TokNode * );
+extern void genOptBlk( Junction * );
+extern void genLoopBlk( Junction *, Junction *, Junction *, int );
+extern void genLoopBegin( Junction * );
+extern void genPlusBlk( Junction * );
+extern void genSubBlk( Junction * );
+extern void genRule( Junction * );
+extern void genJunction( Junction * );
+extern void genEndBlk( Junction * );
+extern void genEndRule( Junction * );
+extern void genHdr( int );
+extern void genHdr1( int );
+extern void dumpAction( char *, FILE *, int, int, int, int );
+extern void dumpActionPlus(ActionNode*, char *, FILE *, int, int, int, int ); /* MR21 */
+extern Entry ** newHashTable( void );
+extern Entry * hash_add( Entry **, char *, Entry * );
+extern Entry * hash_get( Entry **, char * );
+extern void hashStat( Entry ** );
+extern char * mystrdup( char * );
+extern void genLexDescr( void );
+extern void dumpLexClasses( FILE * );
+extern void genDefFile( void );
+extern void DumpListOfParmNames( char *, FILE *, int ); /* MR5 janm 26-May-97 */
+extern int DumpNextNameInDef( char **, FILE * );
+extern void DumpOldStyleParms( char *, FILE * );
+extern void DumpType( char *, FILE * );
+extern int strmember( char *, char * );
+/* extern int HasComma( char * ); MR23 Replaced by hasMultipleOperands() */
+extern void DumpRetValStruct( FILE *, char *, int );
+extern char * StripQuotes( char * );
+extern int main( int, char *[] );
+extern void readDescr( void );
+extern FILE * NextFile( void );
+extern char * outnameX( char *, char *);
+extern char * outname( char * );
+extern void fatalFL( char *, char *, int );
+extern void fatal_intern( char *, char *, int );
+extern void cleanUp( void );
+extern char * eMsg3( char *, char *, char *, char * );
+extern char * eMsgd( char *, int );
+extern char * eMsgd2( char *, int, int );
+extern void s_fprT( FILE *, set );
+extern char * TerminalString( int );
+extern void lexclass( char * );
+extern void lexmode( int );
+extern int LexClassIndex( char * );
+extern int hasAction( char * );
+extern void setHasAction( char *, char * );
+extern int addTname( char * );
+extern int addTexpr( char * );
+extern int Tnum( char * );
+extern void Tklink( char *, char * );
+extern Entry * newEntry( char *, int );
+extern void list_add( ListNode **, void * );
+extern void list_free( ListNode **, int freeData ); /* MR10 */
+extern void list_apply( ListNode *, void (*)(void *) );
+extern int list_search_cstring (ListNode *, char *); /* MR27 */
+extern char * Fkey( char *, int, int );
+extern void FoPush( char *, int );
+extern void FoPop( int );
+extern void RegisterCycle( char *, int );
+extern void ResolveFoCycles( int );
+extern void pJunc( Junction * );
+extern void pRuleRef( RuleRefNode * );
+extern void pToken( TokNode * );
+extern void pAction( ActionNode * );
+extern void FoLink( Node * );
+extern void addFoLink( Node *, char *, Junction * );
+extern void GenCrossRef( Junction * );
+extern void defErr( char *, long, long, long, long, long, long );
+extern void genStdPCCTSIncludeFile(FILE *,char *); /* MR10 */
+extern char * pcctsBaseName(char *); /* MR32 */
+extern Predicate *find_predicates(Node *); /* MR10 */
+extern Predicate *MR_find_predicates_and_supp(Node *); /* MR13 */
+extern int predicateLookaheadDepth(ActionNode *); /* MR10 */
+extern void predicate_free(Predicate *); /* MR10 */
+extern Predicate * predicate_dup(Predicate *); /* MR10 */
+extern Predicate * predicate_dup_without_context(Predicate *); /* MR11 */
+extern void GenRulePrototypes(FILE *, Junction *);
+extern Junction *first_item_is_guess_block(Junction *);
+extern Junction *first_item_is_guess_block_extra(Junction * q); /* MR30 */
+extern Junction *analysis_point(Junction *);
+extern Tree *make_tree_from_sets(set *, set *);
+extern Tree *tdup_chain(Tree *);
+extern Tree *tdif(Tree *, Predicate *, set *, set *);
+extern set covered_set(Predicate *);
+extern void AmbiguityDialog(Junction *, int, Junction *, Junction *, int *, int *);
+extern void dumpAmbigMsg(set *, FILE *, int);
+extern void GenRuleFuncRedefs(FILE *, Junction *);
+extern void GenPredefinedSymbolRedefs(FILE *);
+extern void GenASTSymbolRedefs(FILE *);
+extern void GenRemapFile(void);
+extern void GenSetRedefs(FILE *);
+extern ForcedToken *newForcedToken(char *, int);
+extern void RemapForcedTokens(void);
+extern char *TokenOrExpr(int);
+extern void setUpperRange(TokNode *, char *);
+extern void GenParser_c_Hdr(void);
+extern void GenParser_h_Hdr(void);
+extern void GenRuleMemberDeclarationsForCC(FILE *, Junction *);
+extern int addForcedTname( char *, int );
+extern char *OutMetaName(char *);
+extern void OutFirstSetSymbol(Junction *q, char *); /* MR21 */
+extern void warnNoFL(char *err);
+extern void warnFL(char *err,char *f,int l);
+extern void warn(char *err);
+extern void warnNoCR( char *err );
+extern void errNoFL(char *err);
+extern void errFL(char *err,char *f,int l);
+extern void err(char *err);
+extern void errNoCR( char *err );
+extern void genPredTree( Predicate *p, Node *j, int ,int);
+extern UserAction *newUserAction(char *);
+extern char *gate_symbol(char *name);
+extern char *makeAltID(int blockid, int altnum);
+extern void DumpRemainingTokSets(void);
+extern void DumpANSIFunctionArgDef(FILE *f, Junction *q, int bInit); /* MR23 */
+extern void DumpFormals(FILE *, char *, int bInit); /* MR23 */
+extern char* hideDefaultArgs(const char* pdecl); /* MR22 VHS */
+extern Predicate *computePredFromContextGuard(Graph,int *msgDone); /* MR21 */
+extern void recomputeContextGuard(Predicate *); /* MR13 */
+extern Predicate *new_pred(void);
+extern void chkGTFlag(void);
+extern void leAdd(LabelEntry *); /* MR7 */
+extern void leFixup(void); /* MR7 */
+extern void egAdd(ExceptionGroup *); /* MR7 */
+extern void egFixup(void); /* MR7 */
+extern void altAdd(Junction *); /* MR7 */
+extern void altFixup(void); /* MR7 */
+extern Predicate * MR_find_in_aSubBlk(Junction *alt); /* MR10 */
+extern Predicate * MR_predFlatten(Predicate *p); /* MR10 */
+extern Predicate * MR_predSimplifyALL(Predicate *p); /* MR10 */
+extern Predicate * MR_predSimplifyALLX(Predicate *p,int skipPass3); /* MR10 */
+extern int MR_allPredLeaves(Predicate *p); /* MR10 */
+extern void MR_cleanup_pred_trees(Predicate *p); /* MR10 */
+extern int MR_predicate_context_completed(Predicate *p); /* MR10 */
+extern void MR_check_pred_too_long(Predicate *p,set completion); /* MR10 */
+extern Tree * MR_remove_epsilon_from_tree(Tree *t); /* MR10 */
+extern Tree * MR_computeTreeAND(Tree *l,Tree *r); /* MR10 */
+extern int MR_tree_equ(Tree *big, Tree *small); /* MR10 */
+extern set MR_First(int ck,Junction *j,set *incomplete); /* MR10 */
+extern set MR_compute_pred_set(Predicate *p); /* MR10 */
+extern Tree * MR_compute_pred_tree_context(Predicate *p); /* MR10 */
+extern int MR_pointerStackPush(PointerStack *,void *); /* MR10 */
+extern void * MR_pointerStackPop(PointerStack *); /* MR10 */
+extern void * MR_pointerStackTop(PointerStack *); /* MR10 */
+extern void MR_pointerStackReset(PointerStack *); /* MR10 */
+extern void MR_backTraceReport(void); /* MR10 */
+extern void MR_alphaBetaTraceReport(void); /* MR14 */
+extern void MR_dumpRuleSet(set); /* MR14 */
+extern void MR_predContextPresent(Predicate *p,int *,int *); /* MR10 */
+extern void MR_dumpPred(Predicate *p,int withContext); /* MR10 */
+extern void MR_dumpPred1(int,Predicate *p,int withContext); /* MR10 */
+extern void MR_xxxIndent(FILE *f,int depth); /* MR11 */
+extern void MR_outputIndent(int depth); /* MR11 */
+extern void MR_stderrIndent(int depth); /* MR11 */
+extern Junction * MR_ruleReferenced(RuleRefNode *rrn); /* MR10 */
+extern Junction * MR_nameToRuleBlk(char *); /* MR10 */
+extern void MR_releaseResourcesUsedInRule(Node *); /* MR10 */
+extern void MR_dumpTreeX(int depth,Tree *t,int across); /* MR10 */
+extern void MR_dumpTreeF(FILE *f,int depth,Tree *t,int across); /* MR10 */
+extern void DumpFcache(void); /* MR10 */
+extern void MR_dumpTokenSet(FILE *f,int depth,set s); /* MR10 */
+extern void MR_traceAmbSource(set *,Junction *,Junction *); /* MR11 */
+extern void MR_traceAmbSourceK(Tree *,Junction *a1,Junction *a2); /* MR11 */
+extern void MR_traceAmbSourceKclient(void); /* MR20 */
+extern Node *MR_advance(Node *); /* MR11 */
+extern int MR_offsetFromRule(Node *); /* MR11 */
+extern char *MR_ruleNamePlusOffset(Node *); /* MR11 */
+extern int MR_max_height_of_tree(Tree *); /* MR11 */
+extern int MR_all_leaves_same_height(Tree *,int); /* MR11 */
+extern void MR_projectTreeOntoSet(Tree *t,int k,set *); /* MR11 */
+extern Tree *MR_make_tree_from_set(set); /* MR11 */
+extern Predicate *MR_removeRedundantPredPass3(Predicate *); /* MR11 */
+extern void MR_pred_depth(Predicate *,int *); /* MR11 */
+extern int MR_comparePredicates(Predicate *,Predicate *); /* MR11 */
+extern Predicate * MR_unfold(Predicate *); /* MR11 */
+extern void MR_simplifyInverted(Predicate *,int); /* MR11 */
+extern int MR_secondPredicateUnreachable /* MR11 */
+ (Predicate *first,Predicate *second); /* MR11 */
+extern void MR_clearPredEntry(Predicate *); /* MR11 */
+extern void MR_orphanRules(FILE *); /* MR12 */
+extern void MR_merge_contexts(Tree *); /* MR12 */
+extern int ci_strequ(char *,char *); /* MR12 */
+extern void MR_guardPred_plainSet(ActionNode *anode,Predicate *); /* MR12c */
+extern void MR_suppressSearchReport(void); /* MR12c */
+extern Predicate * MR_suppressK(Node *,Predicate *); /* MR13 */
+extern void MR_backTraceDumpItem(FILE *,int skip,Node *n); /* MR13 */
+extern void MR_backTraceDumpItemReset(void); /* MR13 */
+extern Junction * MR_junctionWithoutP2(Junction *); /* MR13 */
+extern void MR_setConstrainPointer(set *); /* MR18 */
+extern void BlockPreambleOption(Junction *q, char * pSymbol); /* MR23 */
+extern char* getInitializer(char *); /* MR23 */
+extern char *endFormal(char *pStart, /* MR23 */
+ char **ppDataType, /* MR23 */
+ char **ppSymbol, /* MR23 */
+ char **ppEqualSign, /* MR23 */
+ char **ppValue, /* MR23 */
+ char **ppSeparator, /* MR23 */
+ int *pNext); /* MR23 */
+extern char *strBetween(char *pStart, /* MR23 */
+ char *pNext, /* MR23 */
+ char *pStop); /* MR23 */
+extern int hasMultipleOperands(char *); /* MR23 */
+extern void DumpInitializers(FILE*, RuleEntry*, char*); /* MR23 */
+extern int isTermEntryTokClass(TermEntry *); /* MR23 */
+extern int isEmptyAlt(Node *, Node *); /* MR23 */
+#else
+extern int STRICMP();
+extern void istackreset();
+extern int istacksize();
+extern void pushint();
+extern int popint();
+extern int istackempty();
+extern int topint();
+extern void NewSetWd();
+extern void DumpSetWd();
+extern void DumpSetWdForC();
+extern void DumpSetWdForCC();
+extern void NewSet();
+extern void FillSet();
+extern void ComputeErrorSets();
+extern void ComputeTokSets();
+extern void SubstErrorClass();
+extern int DefErrSet();
+extern int DefErrSetForC();
+extern int DefErrSetForCC();
+extern int DefErrSet1();
+extern int DefErrSetForC1();
+extern int DefErrSetForCC1();
+extern int DefErrSetWithSuffix(); /* MR21 */
+extern void GenErrHdr();
+extern void dumpExpr();
+extern void addParm();
+extern Graph buildAction();
+extern Graph buildToken();
+extern Graph buildWildCard();
+extern Graph buildRuleRef();
+extern Graph Or();
+extern Graph Cat();
+extern Graph makeOpt();
+extern Graph makeBlk();
+extern Graph makeLoop();
+extern Graph makePlus();
+extern Graph emptyAlt();
+extern Graph emptyAlt3();
+extern TokNode * newTokNode();
+extern RuleRefNode * newRNode();
+extern Junction * newJunction();
+extern ActionNode * newActionNode();
+extern char * makelocks();
+extern void preorder();
+extern Tree * tnode();
+extern void _Tfree();
+extern Tree * tdup();
+extern int is_single_tuple();
+extern Tree * tappend();
+extern void Tfree();
+extern Tree * tlink();
+extern Tree * tshrink();
+extern Tree * tflatten();
+extern Tree * tJunc();
+extern Tree * tRuleRef();
+extern Tree * tToken();
+extern Tree * tAction();
+extern int tmember();
+extern int tmember_constrained();
+extern Tree * tleft_factor();
+extern Tree * trm_perm();
+extern void tcvt();
+extern Tree * permute();
+extern Tree * VerifyAmbig();
+extern set rJunc();
+extern set rRuleRef();
+extern set rToken();
+extern set rAction();
+extern void HandleAmbiguity();
+extern set First();
+extern void freeBlkFsets();
+extern void genAction();
+extern void genRuleRef();
+extern void genToken();
+extern void genOptBlk();
+extern void genLoopBlk();
+extern void genLoopBegin();
+extern void genPlusBlk();
+extern void genSubBlk();
+extern void genRule();
+extern void genJunction();
+extern void genEndBlk();
+extern void genEndRule();
+extern void genHdr();
+extern void genHdr1();
+extern void dumpAction();
+extern void dumpActionPlus(); /* MR21 */
+extern Entry ** newHashTable();
+extern Entry * hash_add();
+extern Entry * hash_get();
+extern void hashStat();
+extern char * mystrdup();
+extern void genLexDescr();
+extern void dumpLexClasses();
+extern void genDefFile();
+extern void DumpListOfParmNames(); /* MR5 janm 26-May-97 */
+extern int DumpNextNameInDef();
+extern void DumpOldStyleParms();
+extern void DumpType();
+extern int strmember();
+/* extern int HasComma(); MR23 Replaced by hasMultipleOperands() */
+extern void DumpRetValStruct();
+extern char * StripQuotes();
+extern int main();
+extern void readDescr();
+extern FILE * NextFile();
+extern char * outnameX();
+extern char * outname();
+extern void fatalFL();
+extern void fatal_intern();
+extern void cleanUp();
+extern char * eMsg3();
+extern char * eMsgd();
+extern char * eMsgd2();
+extern void s_fprT();
+extern char * TerminalString();
+extern void lexclass();
+extern void lexmode();
+extern int LexClassIndex();
+extern int hasAction();
+extern void setHasAction();
+extern int addTname();
+extern int addTexpr();
+extern int Tnum();
+extern void Tklink();
+extern Entry * newEntry();
+extern void list_add();
+extern void list_free(); /* MR10 */
+extern void list_apply();
+extern int list_search_cstring (); /* MR27 */
+extern char * Fkey();
+extern void FoPush();
+extern void FoPop();
+extern void RegisterCycle();
+extern void ResolveFoCycles();
+extern void pJunc();
+extern void pRuleRef();
+extern void pToken();
+extern void pAction();
+extern void FoLink();
+extern void addFoLink();
+extern void GenCrossRef();
+extern void defErr();
+extern void genStdPCCTSIncludeFile();
+extern char * pcctsBaseName(); /* MR32 */
+extern Predicate *find_predicates();
+extern Predicate *MR_find_predicates_and_supp(); /* MR13 */
+extern int predicateLookaheadDepth(); /* MR10 */
+extern void predicate_free(); /* MR10 */
+extern Predicate * predicate_dup(); /* MR10 */
+extern Predicate * predicate_dup_without_context(); /* MR11 */
+extern void GenRulePrototypes();
+extern Junction *first_item_is_guess_block();
+extern Junction *first_item_is_guess_block_extra(); /* MR30 */
+extern Junction *analysis_point();
+extern Tree *make_tree_from_sets();
+extern Tree *tdup_chain();
+extern Tree *tdif();
+extern set covered_set();
+extern void AmbiguityDialog();
+extern void dumpAmbigMsg();
+extern void GenRuleFuncRedefs();
+extern void GenPredefinedSymbolRedefs();
+extern void GenASTSymbolRedefs();
+extern void GenRemapFile();
+extern void GenSetRedefs();
+extern ForcedToken *newForcedToken();
+extern void RemapForcedTokens();
+extern char *TokenOrExpr();
+extern void setUpperRange();
+extern void GenParser_c_Hdr();
+extern void GenParser_h_Hdr();
+extern void GenRuleMemberDeclarationsForCC();
+extern int addForcedTname();
+extern char *OutMetaName();
+extern void OutFirstSetSymbol(); /* MR21 */
+extern void warnNoFL();
+extern void warnFL();
+extern void warn();
+extern void warnNoCR();
+extern void errNoFL();
+extern void errFL();
+extern void err();
+extern void errNoCR();
+extern void genPredTree();
+extern UserAction *newUserAction();
+extern char *gate_symbol();
+extern char *makeAltID();
+extern void DumpRemainingTokSets();
+extern void DumpANSIFunctionArgDef();
+extern void DumpFormals(); /* MR23 */
+extern char* hideDefaultArgs(); /* MR22 VHS */
+extern Predicate *computePredFromContextGuard();
+extern void recomputeContextGuard(); /* MR13 */
+extern Predicate *new_pred();
+extern void chkGTFlag();
+extern void leAdd(); /* MR7 */
+extern void leFixup(); /* MR7 */
+extern void egAdd(); /* MR7 */
+extern void egFixup(); /* MR7 */
+extern void altAdd(); /* MR7 */
+extern void altFixup(); /* MR7 */
+extern Predicate * MR_find_in_aSubBlk(); /* MR10 */
+extern Predicate * MR_predFlatten(); /* MR10 */
+extern Predicate * MR_predSimplifyALL(); /* MR10 */
+extern Predicate * MR_predSimplifyALLX(); /* MR10 */
+extern void MR_cleanup_pred_trees(); /* MR10 */
+extern int MR_allPredLeaves(); /* MR10 */
+extern int MR_predicate_context_completed(); /* MR10 */
+extern void MR_check_pred_too_long(); /* MR10 */
+extern Tree * MR_remove_epsilon_from_tree(); /* MR10 */
+extern Tree * MR_computeTreeAND(); /* MR10 */
+extern int MR_tree_equ(); /* MR10 */
+extern set MR_First(); /* MR10 */
+extern set MR_compute_pred_set(); /* MR10 */
+extern Tree * MR_compute_pred_tree_context(); /* MR10 */
+extern int MR_pointerStackPush(); /* MR10 */
+extern void * MR_pointerStackPop(); /* MR10 */
+extern void * MR_pointerStackTop(); /* MR10 */
+extern void MR_pointerStackReset(); /* MR10 */
+extern void MR_backTraceReport(); /* MR10 */
+extern void MR_alphaBetaTraceReport(); /* MR14 */
+extern void MR_dumpRuleSet(); /* MR14 */
+extern void MR_predContextPresent(); /* MR10 */
+extern void MR_dumpPred(); /* MR10 */
+extern void MR_dumpPred1(); /* MR10 */
+extern void MR_xxxIndent(); /* MR11 */
+extern void MR_stderrIndent(); /* MR11 */
+extern void MR_outputIndent(); /* MR11 */
+extern Junction * MR_ruleReferenced(); /* MR10 */
+extern void MR_releaseResourcesUsedInRule(); /* MR10 */
+extern void MR_dumpTreeX(); /* MR10 */
+extern void MR_dumpTreeF(); /* MR10 */
+extern void DumpFcache(); /* MR10 */
+extern void MR_dumpTokenSet(); /* MR10 */
+extern void MR_traceAmbSource(); /* MR11 */
+extern Node *MR_advance(); /* MR11 */
+extern int MR_offsetFromRule(); /* MR11 */
+extern char *MR_ruleNamePlusOffset(); /* MR11 */
+extern void MR_traceAmbSourceK(); /* MR11 */
+extern void MR_traceAmbSourceKclient(); /* [i_a] added */
+extern int MR_max_height_of_tree(); /* MR11 */
+extern int MR_all_leaves_same_height(); /* MR11 */
+extern void MR_projectTreeOntoSet(); /* MR11 */
+extern Tree *MR_make_tree_from_set(); /* MR11 */
+extern Predicate *MR_removeRedundantPredPass3(); /* MR11 */
+extern void MR_pred_depth(); /* MR11 */
+extern int MR_comparePredicates(); /* MR11 */
+extern Predicate * MR_unfold(); /* MR11 */
+extern void MR_simplifyInverted(); /* MR11 */
+extern int MR_secondPredicateUnreachable(); /* MR11 */
+extern Junction * MR_nameToRuleBlk(); /* MR10 */
+extern void MR_clearPredEntry(); /* MR11 */
+extern void MR_orphanRules(); /* MR12 */
+extern void MR_merge_contexts(); /* MR12 */
+extern int ci_strequ(); /* MR12 */
+extern void MR_guardPred_plainSet(); /* MR12c */
+extern void MR_suppressSearchReport(); /* MR12c */
+extern Predicate * MR_suppressK(); /* MR13 */
+extern void MR_backTraceDumpItem(); /* MR13 */
+extern void MR_backTraceDumpItemReset(); /* MR13 */
+extern Junction * MR_junctionWithoutP2(); /* MR13 */
+extern void MR_setConstrainPointer(); /* MR18 */
+extern void BlockPreambleOption(); /* MR23 */
+extern char* getInitializer(); /* MR23 */
+extern int hasMultipleOperands(); /* MR23 */
+extern char *endFormal(); /* MR23 */
+extern char *strBetween(); /* MR23 */
+extern void DumpInitializers(); /* MR23 */
+extern int isTermEntryTokClass(); /* MR23 */
+extern int isEmptyAlt();
+
+#endif
+
+#ifdef __USE_PROTOS
+#include <stdlib.h>
+#endif
+
+/* MR20 G. Hobbelt Create proper externs for dlg variables */
+
+extern set attribsRefdFromAction;
+extern int inAlt;
+extern int UsedOldStyleAttrib;
+extern int UsedNewStyleLabel;
+
+#define MAX_BLK_LEVEL 100 /* MR23 */
+extern int CurBlockID_array[MAX_BLK_LEVEL]; /* MR23 */
+extern int CurAltNum_array[MAX_BLK_LEVEL]; /* MR23 */
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/scan.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/scan.c
new file mode 100644
index 000000000..9b4bde08e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/scan.c
@@ -0,0 +1,5735 @@
+
+/* parser.dlg -- DLG Description of scanner
+ *
+ * Generated from: antlr.g
+ *
+ * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
+ * Purdue University Electrical Engineering
+ * With AHPCRC, University of Minnesota
+ * ANTLR Version 1.33MR33
+ */
+
+#define ANTLR_VERSION 13333
+#include "pcctscfg.h"
+#include "pccts_stdio.h"
+
+#include "pcctscfg.h"
+#include "set.h"
+#include <ctype.h>
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#define zzcr_attr(attr,tok,t)
+#include "antlr.h"
+#include "tokens.h"
+#include "dlgdef.h"
+LOOKAHEAD
+
+void
+#ifdef __USE_PROTOS
+zzerraction(void)
+#else
+zzerraction()
+#endif
+{
+ (*zzerr)("invalid token");
+ zzadvance();
+ zzskip();
+}
+/*
+ * D L G tables
+ *
+ * Generated from: parser.dlg
+ *
+ * 1989-2001 by Will Cohen, Terence Parr, and Hank Dietz
+ * Purdue University Electrical Engineering
+ * DLG Version 1.33MR33
+ */
+
+#include "mode.h"
+
+
+
+
+/* maintained, but not used for now */
+set AST_nodes_refd_in_actions = set_init;
+int inAlt = 0;
+set attribsRefdFromAction = set_init; /* MR20 */
+int UsedOldStyleAttrib = 0;
+int UsedNewStyleLabel = 0;
+#ifdef __USE_PROTOS
+char *inline_set(char *);
+#else
+char *inline_set();
+#endif
+
+/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
+/* MR1 in DLG action */
+
+int tokenActionActive=0; /* MR1 */
+
+
+
+
+
+static char *
+#ifdef __USE_PROTOS
+getFileNameFromTheLineInfo(char *toStr, char *fromStr)
+#else
+getFileNameFromTheLineInfo(toStr, fromStr)
+char *toStr, *fromStr;
+#endif
+{
+ int i, j, k;
+
+ if (!fromStr || !toStr) return toStr;
+
+ /* find the first " */
+
+ for (i=0;
+ (i<MaxFileName) &&
+ (fromStr[i] != '\n') &&
+ (fromStr[i] != '\r') &&
+ (fromStr[i] != '\"');
+ i++) /* nothing */ ;
+
+ if ( (i == MaxFileName) ||
+ (fromStr[i] == '\n') ||
+ (fromStr[i] == '\r') ) {
+ return toStr;
+}
+
+ /* find the second " */
+
+ for (j=i+1;
+(j<MaxFileName) &&
+(fromStr[j] != '\n') &&
+(fromStr[j] != '\r') &&
+(fromStr[j] != '\"');
+j++) /* nothing */ ;
+
+ if ((j == MaxFileName) ||
+(fromStr[j] == '\n') ||
+(fromStr[j] == '\r') ) {
+ return toStr;
+}
+
+ /* go back until the last / or \ */
+
+ for (k=j-1;
+(fromStr[k] != '\"') &&
+(fromStr[k] != '/') &&
+(fromStr[k] != '\\');
+k--) /* nothing */ ;
+
+ /* copy the string after " / or \ into toStr */
+
+ for (i=k+1; fromStr[i] != '\"'; i++) {
+toStr[i-k-1] = fromStr[i];
+}
+
+ toStr[i-k-1] = '\0';
+
+ return toStr;
+}
+
+/* MR14 end of a block to support #line in antlr source code */
+
+
+
+
+#ifdef __USE_PROTOS
+void mark_label_used_in_sem_pred(LabelEntry *le) /* MR10 */
+#else
+void mark_label_used_in_sem_pred(le) /* MR10 */
+LabelEntry *le;
+#endif
+{
+ TokNode *tn;
+ require (le->elem->ntype == nToken,"mark_label_used... ntype != nToken");
+ tn=(TokNode *)le->elem;
+ require (tn->label != 0,"mark_label_used... TokNode has no label");
+ tn->label_used_in_semantic_pred=1;
+}
+
+static void act1()
+{
+ NLA = Eof;
+ /* L o o k F o r A n o t h e r F i l e */
+ {
+ FILE *new_input;
+ new_input = NextFile();
+ if ( new_input == NULL ) { NLA=Eof; return; }
+ fclose( input );
+ input = new_input;
+ zzrdstream( input );
+ zzskip(); /* Skip the Eof (@) char i.e continue */
+ }
+ }
+
+
+static void act2()
+{
+ NLA = 76;
+ zzskip();
+ }
+
+
+static void act3()
+{
+ NLA = 77;
+ zzline++; zzskip();
+ }
+
+
+static void act4()
+{
+ NLA = 78;
+ zzmode(ACTIONS); zzmore();
+ istackreset();
+ pushint(']');
+ }
+
+
+static void act5()
+{
+ NLA = 79;
+ action_file=CurFile; action_line=zzline;
+ zzmode(ACTIONS); zzmore();
+ list_free(&CurActionLabels,0); /* MR10 */
+ numericActionLabel=0; /* MR10 */
+ istackreset();
+ pushint('>');
+ }
+
+
+static void act6()
+{
+ NLA = 80;
+ zzmode(STRINGS); zzmore();
+ }
+
+
+static void act7()
+{
+ NLA = 81;
+ zzmode(COMMENTS); zzskip();
+ }
+
+
+static void act8()
+{
+ NLA = 82;
+ warn("Missing /*; found dangling */"); zzskip();
+ }
+
+
+static void act9()
+{
+ NLA = 83;
+ zzmode(CPP_COMMENTS); zzskip();
+ }
+
+
+static void act10()
+{
+ NLA = 84;
+
+ zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
+ getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
+ }
+
+
+static void act11()
+{
+ NLA = 85;
+
+ zzline++; zzmore();
+ }
+
+
+static void act12()
+{
+ NLA = 86;
+ warn("Missing <<; found dangling >>"); zzskip();
+ }
+
+
+static void act13()
+{
+ NLA = WildCard;
+ }
+
+
+static void act14()
+{
+ NLA = 88;
+ FoundException = 1; /* MR6 */
+ FoundAtOperator = 1;
+ }
+
+
+static void act15()
+{
+ NLA = Pragma;
+ }
+
+
+static void act16()
+{
+ NLA = FirstSetSymbol;
+ }
+
+
+static void act17()
+{
+ NLA = 94;
+ }
+
+
+static void act18()
+{
+ NLA = 95;
+ }
+
+
+static void act19()
+{
+ NLA = 96;
+ }
+
+
+static void act20()
+{
+ NLA = 97;
+ }
+
+
+static void act21()
+{
+ NLA = 98;
+ }
+
+
+static void act22()
+{
+ NLA = 99;
+ }
+
+
+static void act23()
+{
+ NLA = 102;
+ }
+
+
+static void act24()
+{
+ NLA = 103;
+ }
+
+
+static void act25()
+{
+ NLA = 104;
+ }
+
+
+static void act26()
+{
+ NLA = 105;
+ }
+
+
+static void act27()
+{
+ NLA = 106;
+ }
+
+
+static void act28()
+{
+ NLA = 107;
+ }
+
+
+static void act29()
+{
+ NLA = 108;
+ }
+
+
+static void act30()
+{
+ NLA = 109;
+ }
+
+
+static void act31()
+{
+ NLA = 110;
+ }
+
+
+static void act32()
+{
+ NLA = 111;
+ }
+
+
+static void act33()
+{
+ NLA = 112;
+ }
+
+
+static void act34()
+{
+ NLA = 113;
+ }
+
+
+static void act35()
+{
+ NLA = 114;
+ }
+
+
+static void act36()
+{
+ NLA = 115;
+ }
+
+
+static void act37()
+{
+ NLA = 116;
+ }
+
+
+static void act38()
+{
+ NLA = 117;
+ }
+
+
+static void act39()
+{
+ NLA = 118;
+ }
+
+
+static void act40()
+{
+ NLA = 119;
+ }
+
+
+static void act41()
+{
+ NLA = 120;
+ }
+
+
+static void act42()
+{
+ NLA = 121;
+ }
+
+
+static void act43()
+{
+ NLA = 122;
+ }
+
+
+static void act44()
+{
+ NLA = 123;
+ }
+
+
+static void act45()
+{
+ NLA = 124;
+ }
+
+
+static void act46()
+{
+ NLA = 125;
+ }
+
+
+static void act47()
+{
+ NLA = 126;
+ }
+
+
+static void act48()
+{
+ NLA = 127;
+ }
+
+
+static void act49()
+{
+ NLA = 128;
+ }
+
+
+static void act50()
+{
+ NLA = 129;
+ }
+
+
+static void act51()
+{
+ NLA = 130;
+ }
+
+
+static void act52()
+{
+ NLA = 131;
+ }
+
+
+static void act53()
+{
+ NLA = 132;
+ }
+
+
+static void act54()
+{
+ NLA = 133;
+ }
+
+
+static void act55()
+{
+ NLA = 134;
+ }
+
+
+static void act56()
+{
+ NLA = 135;
+ }
+
+
+static void act57()
+{
+ NLA = NonTerminal;
+
+ while ( zzchar==' ' || zzchar=='\t' ) {
+ zzadvance();
+ }
+ if ( zzchar == ':' && inAlt ) NLA = LABEL;
+ }
+
+
+static void act58()
+{
+ NLA = TokenTerm;
+
+ while ( zzchar==' ' || zzchar=='\t' ) {
+ zzadvance();
+ }
+ if ( zzchar == ':' && inAlt ) NLA = LABEL;
+ }
+
+
+static void act59()
+{
+ NLA = 136;
+ warn(eMsg1("unknown meta-op: %s",LATEXT(1))); zzskip();
+ }
+
+static unsigned char shift0[257] = {
+ 0, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 1, 2, 58, 58, 3, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 1, 40, 6, 9, 58, 58, 45,
+ 58, 46, 47, 8, 52, 58, 58, 18, 7, 16,
+ 14, 15, 16, 16, 16, 16, 16, 16, 16, 41,
+ 42, 5, 48, 17, 53, 19, 56, 56, 56, 56,
+ 56, 26, 56, 56, 56, 56, 56, 51, 56, 56,
+ 56, 56, 56, 56, 29, 56, 56, 56, 56, 56,
+ 56, 56, 4, 20, 58, 50, 57, 58, 23, 31,
+ 38, 34, 13, 35, 24, 33, 11, 55, 36, 10,
+ 25, 12, 32, 21, 55, 22, 27, 28, 54, 55,
+ 55, 43, 30, 55, 39, 44, 37, 49, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58
+};
+
+
+static void act60()
+{
+ NLA = Eof;
+ }
+
+
+static void act61()
+{
+ NLA = QuotedTerm;
+ zzmode(START);
+ }
+
+
+static void act62()
+{
+ NLA = 3;
+
+ zzline++;
+ warn("eoln found in string");
+ zzskip();
+ }
+
+
+static void act63()
+{
+ NLA = 4;
+ zzline++; zzmore();
+ }
+
+
+static void act64()
+{
+ NLA = 5;
+ zzmore();
+ }
+
+
+static void act65()
+{
+ NLA = 6;
+ zzmore();
+ }
+
+static unsigned char shift1[257] = {
+ 0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 2, 5, 5, 3, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 1, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 4, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5
+};
+
+
+static void act66()
+{
+ NLA = Eof;
+ }
+
+
+static void act67()
+{
+ NLA = 7;
+ zzmode(ACTIONS); zzmore();
+ }
+
+
+static void act68()
+{
+ NLA = 8;
+
+ zzline++;
+ warn("eoln found in string (in user action)");
+ zzskip();
+ }
+
+
+static void act69()
+{
+ NLA = 9;
+ zzline++; zzmore();
+ }
+
+
+static void act70()
+{
+ NLA = 10;
+ zzmore();
+ }
+
+
+static void act71()
+{
+ NLA = 11;
+ zzmore();
+ }
+
+static unsigned char shift2[257] = {
+ 0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 2, 5, 5, 3, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 1, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 4, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5
+};
+
+
+static void act72()
+{
+ NLA = Eof;
+ }
+
+
+static void act73()
+{
+ NLA = 12;
+ zzmode(ACTIONS); zzmore();
+ }
+
+
+static void act74()
+{
+ NLA = 13;
+
+ zzline++;
+ warn("eoln found in char literal (in user action)");
+ zzskip();
+ }
+
+
+static void act75()
+{
+ NLA = 14;
+ zzmore();
+ }
+
+
+static void act76()
+{
+ NLA = 15;
+ zzmore();
+ }
+
+static unsigned char shift3[257] = {
+ 0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 2, 5, 5, 3, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 1, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 4, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5
+};
+
+
+static void act77()
+{
+ NLA = Eof;
+ }
+
+
+static void act78()
+{
+ NLA = 16;
+ zzmode(ACTIONS); zzmore();
+ }
+
+
+static void act79()
+{
+ NLA = 17;
+ zzmore();
+ }
+
+
+static void act80()
+{
+ NLA = 18;
+ zzline++; zzmore(); DAWDLE;
+ }
+
+
+static void act81()
+{
+ NLA = 19;
+ zzmore();
+ }
+
+static unsigned char shift4[257] = {
+ 0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 3, 5, 5, 4, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 1, 5, 5, 5, 5, 2, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5
+};
+
+
+static void act82()
+{
+ NLA = Eof;
+ }
+
+
+static void act83()
+{
+ NLA = 20;
+ zzmode(PARSE_ENUM_FILE);
+ zzmore();
+ }
+
+
+static void act84()
+{
+ NLA = 21;
+ zzmore();
+ }
+
+
+static void act85()
+{
+ NLA = 22;
+ zzline++; zzmore(); DAWDLE;
+ }
+
+
+static void act86()
+{
+ NLA = 23;
+ zzmore();
+ }
+
+static unsigned char shift5[257] = {
+ 0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 3, 5, 5, 4, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 1, 5, 5, 5, 5, 2, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5
+};
+
+
+static void act87()
+{
+ NLA = Eof;
+ }
+
+
+static void act88()
+{
+ NLA = 24;
+ zzline++; zzmode(PARSE_ENUM_FILE); zzskip(); DAWDLE;
+ }
+
+
+static void act89()
+{
+ NLA = 25;
+ zzskip();
+ }
+
+static unsigned char shift6[257] = {
+ 0, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 1, 3, 3, 2, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3
+};
+
+
+static void act90()
+{
+ NLA = Eof;
+ }
+
+
+static void act91()
+{
+ NLA = 26;
+ zzline++; zzmode(ACTIONS); zzmore(); DAWDLE;
+ }
+
+
+static void act92()
+{
+ NLA = 27;
+ zzmore();
+ }
+
+static unsigned char shift7[257] = {
+ 0, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 1, 3, 3, 2, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3
+};
+
+
+static void act93()
+{
+ NLA = Eof;
+ }
+
+
+static void act94()
+{
+ NLA = 28;
+ zzline++; zzmode(START); zzskip(); DAWDLE;
+ }
+
+
+static void act95()
+{
+ NLA = 29;
+ zzskip();
+ }
+
+static unsigned char shift8[257] = {
+ 0, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 1, 3, 3, 2, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3
+};
+
+
+static void act96()
+{
+ NLA = Eof;
+ }
+
+
+static void act97()
+{
+ NLA = 30;
+ zzmode(START); zzskip();
+ }
+
+
+static void act98()
+{
+ NLA = 31;
+ zzskip();
+ }
+
+
+static void act99()
+{
+ NLA = 32;
+ zzline++; zzskip(); DAWDLE;
+ }
+
+
+static void act100()
+{
+ NLA = 33;
+ zzskip();
+ }
+
+static unsigned char shift9[257] = {
+ 0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 3, 5, 5, 4, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 1, 5, 5, 5, 5, 2, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5
+};
+
+
+static void act101()
+{
+ NLA = Eof;
+ }
+
+
+static void act102()
+{
+ NLA = Action;
+ /* these do not nest */
+ zzmode(START);
+ NLATEXT[0] = ' ';
+ NLATEXT[1] = ' ';
+ zzbegexpr[0] = ' ';
+ zzbegexpr[1] = ' ';
+ if ( zzbufovf ) {
+ err( eMsgd("action buffer overflow; size %d",ZZLEXBUFSIZE));
+ }
+
+/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
+ /* MR1 in DLG action */
+ /* MR1 Doesn't matter what kind of action it is - reset*/
+
+ tokenActionActive=0; /* MR1 */
+ }
+
+
+static void act103()
+{
+ NLA = Pred;
+ /* these do not nest */
+ zzmode(START);
+ NLATEXT[0] = ' ';
+ NLATEXT[1] = ' ';
+ zzbegexpr[0] = '\0';
+ if ( zzbufovf ) {
+ err( eMsgd("predicate buffer overflow; size %d",ZZLEXBUFSIZE));
+ };
+#ifdef __cplusplus__
+ /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
+#else
+#ifdef __STDC__
+ /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
+#else
+#ifdef __USE_PROTOS
+ /* MRxx */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
+#else
+ /* MR10 */ list_apply(CurActionLabels,mark_label_used_in_sem_pred);
+#endif
+#endif
+#endif
+ }
+
+
+static void act104()
+{
+ NLA = PassAction;
+ if ( topint() == ']' ) {
+ popint();
+ if ( istackempty() ) /* terminate action */
+ {
+ zzmode(START);
+ NLATEXT[0] = ' ';
+ zzbegexpr[0] = ' ';
+ if ( zzbufovf ) {
+ err( eMsgd("parameter buffer overflow; size %d",ZZLEXBUFSIZE));
+ }
+ }
+ else {
+ /* terminate $[..] and #[..] */
+ if ( GenCC ) zzreplstr("))");
+ else zzreplstr(")");
+ zzmore();
+ }
+ }
+ else if ( topint() == '|' ) { /* end of simple [...] */
+ popint();
+ zzmore();
+ }
+ else zzmore();
+ }
+
+
+static void act105()
+{
+ NLA = 37;
+
+ zzmore();
+ zzreplstr(inline_set(zzbegexpr+
+ strlen("consumeUntil(")));
+ }
+
+
+static void act106()
+{
+ NLA = 38;
+ zzmore();
+ }
+
+
+static void act107()
+{
+ NLA = 39;
+ zzline++; zzmore(); DAWDLE;
+ }
+
+
+static void act108()
+{
+ NLA = 40;
+ zzmore();
+ }
+
+
+static void act109()
+{
+ NLA = 41;
+ zzmore();
+ }
+
+
+static void act110()
+{
+ NLA = 42;
+ if ( !GenCC ) {zzreplstr("zzaRet"); zzmore();}
+ else err("$$ use invalid in C++ mode");
+ }
+
+
+static void act111()
+{
+ NLA = 43;
+ if ( !GenCC ) {zzreplstr("zzempty_attr"); zzmore();}
+ else err("$[] use invalid in C++ mode");
+ }
+
+
+static void act112()
+{
+ NLA = 44;
+
+ pushint(']');
+ if ( !GenCC ) zzreplstr("zzconstr_attr(");
+ else err("$[..] use invalid in C++ mode");
+ zzmore();
+ }
+
+
+static void act113()
+{
+ NLA = 45;
+ {
+ static char buf[100];
+ numericActionLabel=1; /* MR10 */
+ if ( strlen(zzbegexpr)>(size_t)85 )
+ fatal("$i attrib ref too big");
+ set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction);
+ if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s)",
+ BlkLevel-1,zzbegexpr+1);
+ else sprintf(buf,"_t%d%s",
+ BlkLevel-1,zzbegexpr+1);
+ zzreplstr(buf);
+ zzmore();
+ UsedOldStyleAttrib = 1;
+ if ( UsedNewStyleLabel )
+ err("cannot mix old-style $i with new-style labels");
+ }
+ }
+
+
+static void act114()
+{
+ NLA = 46;
+ {
+ static char buf[100];
+ numericActionLabel=1; /* MR10 */
+ if ( strlen(zzbegexpr)>(size_t)85 )
+ fatal("$i.field attrib ref too big");
+ zzbegexpr[strlen(zzbegexpr)-1] = ' ';
+ set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction);
+ if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s).",
+ BlkLevel-1,zzbegexpr+1);
+ else sprintf(buf,"_t%d%s.",
+ BlkLevel-1,zzbegexpr+1);
+ zzreplstr(buf);
+ zzmore();
+ UsedOldStyleAttrib = 1;
+ if ( UsedNewStyleLabel )
+ err("cannot mix old-style $i with new-style labels");
+ }
+ }
+
+
+static void act115()
+{
+ NLA = 47;
+ {
+ static char buf[100];
+ static char i[20], j[20];
+ char *p,*q;
+ numericActionLabel=1; /* MR10 */
+ if (strlen(zzbegexpr)>(size_t)85) fatal("$i.j attrib ref too big");
+ for (p=zzbegexpr+1,q= &i[0]; *p!='.'; p++) {
+ if ( q == &i[20] )
+ fatalFL("i of $i.j attrib ref too big",
+ FileStr[CurFile], zzline );
+ *q++ = *p;
+ }
+ *q = '\0';
+ for (p++, q= &j[0]; *p!='\0'; p++) {
+ if ( q == &j[20] )
+ fatalFL("j of $i.j attrib ref too big",
+ FileStr[CurFile], zzline );
+ *q++ = *p;
+ }
+ *q = '\0';
+ if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%s,%s)",i,j);
+ else sprintf(buf,"_t%s%s",i,j);
+ zzreplstr(buf);
+ zzmore();
+ UsedOldStyleAttrib = 1;
+ if ( UsedNewStyleLabel )
+ err("cannot mix old-style $i with new-style labels");
+ }
+ }
+
+
+static void act116()
+{
+ NLA = 48;
+ { static char buf[300]; LabelEntry *el;
+ zzbegexpr[0] = ' ';
+ if ( CurRule != NULL &&
+ strcmp(CurRule, &zzbegexpr[1])==0 ) {
+ if ( !GenCC ) zzreplstr("zzaRet");
+ }
+ else if ( CurRetDef != NULL &&
+ strmember(CurRetDef, &zzbegexpr[1])) {
+ if ( hasMultipleOperands( CurRetDef ) ) {
+ require (strlen(zzbegexpr)<=(size_t)285,
+ "$retval attrib ref too big");
+ sprintf(buf,"_retv.%s",&zzbegexpr[1]);
+ zzreplstr(buf);
+ }
+ else zzreplstr("_retv");
+ }
+ else if ( CurParmDef != NULL &&
+ strmember(CurParmDef, &zzbegexpr[1])) {
+ ;
+ }
+ else if ( Elabel==NULL ) {
+ { err("$-variables in actions outside of rules are not allowed"); }
+ } else if ( (el=(LabelEntry *)hash_get(Elabel, &zzbegexpr[1]))!=NULL ) {
+ /* MR10 */
+ /* MR10 */ /* element labels might exist without an elem when */
+ /* MR10 */ /* it is a forward reference (to a rule) */
+ /* MR10 */
+ /* MR10 */ if ( GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) )
+ /* MR10 */ { err(eMsg1("There are no token ptrs for rule references: '$%s'",&zzbegexpr[1])); }
+ /* MR10 */
+ /* MR10 */ if ( !GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) && GenAST) {
+ /* MR10 */ err("You can no longer use attributes returned by rules when also using ASTs");
+ /* MR10 */ err(" Use upward inheritance (\"rule >[Attrib a] : ... <<$a=...>>\")");
+ /* MR10 */ };
+ /* MR10 */
+ /* MR10 */ /* keep track of <<... $label ...>> for semantic predicates in guess mode */
+ /* MR10 */ /* element labels contain pointer to the owners node */
+ /* MR10 */
+ /* MR10 */ if (el->elem != NULL && el->elem->ntype == nToken) {
+ /* MR10 */ list_add(&CurActionLabels,el);
+ /* MR10 */ };
+}
+else
+warn(eMsg1("$%s not parameter, return value, (defined) element label",&zzbegexpr[1]));
+}
+zzmore();
+ }
+
+
+static void act117()
+{
+ NLA = 49;
+ zzreplstr("(*_root)"); zzmore(); chkGTFlag();
+ }
+
+
+static void act118()
+{
+ NLA = 50;
+ if ( GenCC ) {
+ if (NewAST) zzreplstr("(newAST)");
+ else zzreplstr("(new AST)");}
+ else {zzreplstr("zzastnew()");} zzmore();
+ chkGTFlag();
+ }
+
+
+static void act119()
+{
+ NLA = 51;
+ zzreplstr("NULL"); zzmore(); chkGTFlag();
+ }
+
+
+static void act120()
+{
+ NLA = 52;
+ {
+ static char buf[100];
+ if ( strlen(zzbegexpr)>(size_t)85 )
+ fatal("#i AST ref too big");
+ if ( GenCC ) sprintf(buf,"_ast%d%s",BlkLevel-1,zzbegexpr+1);
+ else sprintf(buf,"zzastArg(%s)",zzbegexpr+1);
+ zzreplstr(buf);
+ zzmore();
+ set_orel(atoi(zzbegexpr+1), &AST_nodes_refd_in_actions);
+ chkGTFlag();
+ }
+ }
+
+
+static void act121()
+{
+ NLA = 53;
+
+ zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
+ getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
+ }
+
+
+static void act122()
+{
+ NLA = 54;
+
+ zzline++; zzmore();
+ }
+
+
+static void act123()
+{
+ NLA = 55;
+
+ if ( !(strcmp(zzbegexpr, "#ifdef")==0 ||
+ strcmp(zzbegexpr, "#if")==0 ||
+ strcmp(zzbegexpr, "#else")==0 ||
+ strcmp(zzbegexpr, "#endif")==0 ||
+ strcmp(zzbegexpr, "#ifndef")==0 ||
+ strcmp(zzbegexpr, "#define")==0 ||
+ strcmp(zzbegexpr, "#pragma")==0 ||
+ strcmp(zzbegexpr, "#undef")==0 ||
+ strcmp(zzbegexpr, "#import")==0 ||
+ strcmp(zzbegexpr, "#line")==0 ||
+ strcmp(zzbegexpr, "#include")==0 ||
+ strcmp(zzbegexpr, "#error")==0) )
+ {
+ static char buf[100];
+ sprintf(buf, "%s_ast", zzbegexpr+1);
+ /* MR27 */ list_add(&CurAstLabelsInActions, mystrdup(zzbegexpr+1));
+ zzreplstr(buf);
+ chkGTFlag();
+ }
+ zzmore();
+ }
+
+
+static void act124()
+{
+ NLA = 56;
+
+ pushint(']');
+ if ( GenCC ) {
+ if (NewAST) zzreplstr("(newAST(");
+ else zzreplstr("(new AST("); }
+ else zzreplstr("zzmk_ast(zzastnew(),");
+ zzmore();
+ chkGTFlag();
+ }
+
+
+static void act125()
+{
+ NLA = 57;
+
+ pushint('}');
+ if ( GenCC ) {
+ if (tmakeInParser) {
+ zzreplstr("tmake(");
+ }
+ else {
+ zzreplstr("ASTBase::tmake(");
+ }
+ }
+ else {
+ zzreplstr("zztmake(");
+ }
+ zzmore();
+ chkGTFlag();
+ }
+
+
+static void act126()
+{
+ NLA = 58;
+ zzmore();
+ }
+
+
+static void act127()
+{
+ NLA = 59;
+
+ if ( istackempty() )
+ zzmore();
+ else if ( topint()==')' ) {
+ popint();
+ }
+ else if ( topint()=='}' ) {
+ popint();
+ /* terminate #(..) */
+ zzreplstr(", NULL)");
+ }
+ zzmore();
+ }
+
+
+static void act128()
+{
+ NLA = 60;
+
+ pushint('|'); /* look for '|' to terminate simple [...] */
+ zzmore();
+ }
+
+
+static void act129()
+{
+ NLA = 61;
+
+ pushint(')');
+ zzmore();
+ }
+
+
+static void act130()
+{
+ NLA = 62;
+ zzreplstr("]"); zzmore();
+ }
+
+
+static void act131()
+{
+ NLA = 63;
+ zzreplstr(")"); zzmore();
+ }
+
+
+static void act132()
+{
+ NLA = 64;
+ if (! tokenActionActive) zzreplstr(">"); /* MR1 */
+ zzmore(); /* MR1 */
+ }
+
+
+static void act133()
+{
+ NLA = 65;
+ zzmode(ACTION_CHARS); zzmore();
+ }
+
+
+static void act134()
+{
+ NLA = 66;
+ zzmode(ACTION_STRINGS); zzmore();
+ }
+
+
+static void act135()
+{
+ NLA = 67;
+ zzreplstr("$"); zzmore();
+ }
+
+
+static void act136()
+{
+ NLA = 68;
+ zzreplstr("#"); zzmore();
+ }
+
+
+static void act137()
+{
+ NLA = 69;
+ zzline++; zzmore();
+ }
+
+
+static void act138()
+{
+ NLA = 70;
+ zzmore();
+ }
+
+
+static void act139()
+{
+ NLA = 71;
+ zzmore();
+ }
+
+
+static void act140()
+{
+ NLA = 72;
+ zzmode(ACTION_COMMENTS); zzmore();
+ }
+
+
+static void act141()
+{
+ NLA = 73;
+ warn("Missing /*; found dangling */ in action"); zzmore();
+ }
+
+
+static void act142()
+{
+ NLA = 74;
+ zzmode(ACTION_CPP_COMMENTS); zzmore();
+ }
+
+
+static void act143()
+{
+ NLA = 75;
+ zzmore();
+ }
+
+static unsigned char shift10[257] = {
+ 0, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 16, 19, 33, 33, 20, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 16, 33, 28, 27, 21, 33, 33,
+ 30, 15, 18, 32, 33, 33, 33, 25, 31, 23,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 33,
+ 33, 33, 33, 1, 2, 33, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 11, 26, 26, 26,
+ 26, 26, 22, 29, 3, 33, 26, 33, 26, 26,
+ 4, 26, 10, 26, 26, 26, 13, 26, 26, 14,
+ 9, 6, 5, 26, 26, 26, 7, 12, 8, 26,
+ 26, 26, 26, 26, 17, 33, 34, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33
+};
+
+
+static void act144()
+{
+ NLA = Eof;
+ ;
+ }
+
+
+static void act145()
+{
+ NLA = 137;
+ zzskip();
+ }
+
+
+static void act146()
+{
+ NLA = 138;
+ zzline++; zzskip();
+ }
+
+
+static void act147()
+{
+ NLA = 139;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzmore();
+ }
+
+
+static void act148()
+{
+ NLA = 140;
+ zzmode(TOK_DEF_COMMENTS); zzskip();
+ }
+
+
+static void act149()
+{
+ NLA = 141;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
+ }
+
+
+static void act150()
+{
+ NLA = 142;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
+ }
+
+
+static void act151()
+{
+ NLA = 143;
+ ;
+ }
+
+
+static void act152()
+{
+ NLA = 144;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
+ }
+
+
+static void act153()
+{
+ NLA = 145;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
+ }
+
+
+static void act154()
+{
+ NLA = 146;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
+ }
+
+
+static void act155()
+{
+ NLA = 147;
+ zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
+ }
+
+
+static void act156()
+{
+ NLA = 149;
+ }
+
+
+static void act157()
+{
+ NLA = 151;
+ }
+
+
+static void act158()
+{
+ NLA = 152;
+ }
+
+
+static void act159()
+{
+ NLA = 153;
+ }
+
+
+static void act160()
+{
+ NLA = 154;
+ }
+
+
+static void act161()
+{
+ NLA = 155;
+ }
+
+
+static void act162()
+{
+ NLA = 156;
+ }
+
+
+static void act163()
+{
+ NLA = INT;
+ }
+
+
+static void act164()
+{
+ NLA = ID;
+ }
+
+static unsigned char shift11[257] = {
+ 0, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 1, 2, 27, 27, 3, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 1, 27, 27, 6, 27, 27, 27,
+ 27, 27, 27, 5, 27, 22, 27, 27, 4, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 27,
+ 24, 27, 21, 27, 27, 27, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 27, 27, 27, 27, 26, 27, 26, 26,
+ 26, 9, 10, 8, 26, 26, 7, 26, 26, 12,
+ 15, 11, 17, 16, 26, 18, 13, 19, 14, 26,
+ 26, 26, 26, 26, 20, 27, 23, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27
+};
+
+#define DfaStates 436
+typedef unsigned short DfaState;
+
+static DfaState st0[60] = {
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 11, 11, 12, 13, 13, 13, 14, 15, 16,
+ 17, 11, 11, 18, 11, 11, 19, 11, 11, 19,
+ 11, 11, 11, 11, 20, 11, 11, 21, 22, 23,
+ 24, 25, 26, 11, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 11, 11, 19, 436, 436, 436
+};
+
+static DfaState st1[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st2[60] = {
+ 436, 2, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st3[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st4[60] = {
+ 436, 436, 37, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st5[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st6[60] = {
+ 436, 436, 436, 436, 436, 38, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st7[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st8[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 39, 40, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st9[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 41, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st10[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 42, 43, 43, 44, 43, 43, 43, 436, 436, 436,
+ 436, 45, 43, 43, 43, 43, 46, 43, 47, 43,
+ 43, 43, 43, 48, 43, 49, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st11[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st12[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 51, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st13[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 13, 13, 13, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st14[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 52, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st15[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 53, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st16[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st17[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 54,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st18[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 55, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st19[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 56, 56, 56, 56, 56, 56, 56, 436, 436, 436,
+ 436, 56, 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 436, 56, 436,
+ 436, 436, 436, 56, 436, 436, 436, 436, 436, 436,
+ 436, 56, 436, 436, 56, 56, 56, 56, 436, 436
+};
+
+static DfaState st20[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 57, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st21[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st22[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 58, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 59, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st23[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st24[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st25[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st26[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st27[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 60, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st28[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 61, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st29[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st30[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st31[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 62, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st32[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st33[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st34[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 56, 56, 56, 56, 56, 56, 56, 436, 436, 436,
+ 436, 56, 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 436, 56, 436,
+ 436, 436, 436, 56, 436, 436, 436, 436, 436, 436,
+ 436, 63, 436, 436, 56, 56, 56, 56, 436, 436
+};
+
+static DfaState st35[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st36[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st37[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st38[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st39[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st40[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st41[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st42[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 64, 43, 65, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st43[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st44[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 66, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st45[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 67, 68, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st46[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 69, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st47[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 70, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st48[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 71, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st49[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 72, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st50[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st51[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 73, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st52[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st53[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st54[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 74, 43, 43, 44, 43, 43, 43, 436, 436, 436,
+ 436, 45, 43, 43, 43, 43, 46, 43, 47, 43,
+ 43, 43, 43, 48, 43, 49, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st55[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 75, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st56[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 56, 56, 56, 56, 56, 56, 56, 436, 436, 436,
+ 436, 56, 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 436, 56, 436,
+ 436, 436, 436, 56, 436, 436, 436, 436, 436, 436,
+ 436, 56, 436, 436, 56, 56, 56, 56, 436, 436
+};
+
+static DfaState st57[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 76, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st58[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 77, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st59[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 78, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st60[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st61[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st62[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st63[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 56, 56, 56, 56, 56, 56, 56, 436, 436, 436,
+ 436, 56, 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 436, 56, 436,
+ 436, 436, 436, 56, 436, 436, 79, 436, 436, 436,
+ 436, 56, 436, 436, 56, 56, 56, 56, 436, 436
+};
+
+static DfaState st64[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 80, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st65[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 81, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st66[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 82, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st67[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 83, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 84, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st68[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 85, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st69[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 86, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st70[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 87, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st71[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 88, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st72[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 89, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st73[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 90, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st74[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 65, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st75[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 91, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st76[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 92, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st77[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 93, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st78[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 94, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st79[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 95, 96, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st80[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 97, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st81[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 98, 43, 99, 43, 100, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 101, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st82[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 102, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st83[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 103, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st84[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 104, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st85[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 105, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st86[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 106, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st87[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 107, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 108, 43, 43, 436, 109, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st88[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 110, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st89[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 111, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st90[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 112, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st91[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 113, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st92[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 114, 50, 50, 50, 436, 436
+};
+
+static DfaState st93[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 115, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st94[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 116, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st95[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 117, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st96[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 118, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st97[60] = {
+ 436, 119, 120, 121, 122, 122, 122, 122, 122, 122,
+ 123, 123, 123, 123, 124, 124, 124, 122, 122, 122,
+ 122, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 122, 123, 122,
+ 122, 122, 122, 123, 122, 122, 122, 122, 122, 122,
+ 122, 123, 122, 122, 123, 123, 123, 123, 122, 436
+};
+
+static DfaState st98[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 125, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st99[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 126, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st100[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 127, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st101[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 128, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st102[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 129, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st103[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st104[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 130, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st105[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 131, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st106[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 132, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st107[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 133, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st108[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 134, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st109[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 135, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st110[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 136, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st111[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 137, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st112[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 138, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st113[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 139, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st114[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 140, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st115[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st116[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st117[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st118[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st119[60] = {
+ 436, 119, 120, 121, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 141, 141, 141, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
+};
+
+static DfaState st120[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st121[60] = {
+ 436, 436, 142, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st122[60] = {
+ 436, 122, 120, 121, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
+};
+
+static DfaState st123[60] = {
+ 436, 122, 120, 121, 122, 122, 122, 122, 122, 122,
+ 123, 123, 123, 123, 123, 123, 123, 122, 122, 122,
+ 122, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 122, 123, 122,
+ 122, 122, 122, 123, 122, 122, 122, 122, 122, 122,
+ 122, 123, 122, 122, 123, 123, 123, 123, 122, 436
+};
+
+static DfaState st124[60] = {
+ 436, 143, 144, 145, 122, 122, 146, 122, 122, 122,
+ 123, 123, 123, 123, 124, 124, 124, 122, 122, 122,
+ 122, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 122, 123, 122,
+ 122, 122, 122, 123, 122, 122, 122, 122, 122, 122,
+ 122, 123, 122, 122, 123, 123, 123, 123, 122, 436
+};
+
+static DfaState st125[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 147, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st126[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 148, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st127[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 149, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st128[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 150, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st129[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 151, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st130[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 152, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st131[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 153, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st132[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 154,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st133[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st134[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 155, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st135[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 156, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st136[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 157, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st137[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st138[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 158, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st139[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st140[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 159, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st141[60] = {
+ 436, 143, 144, 145, 122, 122, 146, 122, 122, 122,
+ 122, 122, 122, 122, 141, 141, 141, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
+};
+
+static DfaState st142[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st143[60] = {
+ 436, 143, 120, 121, 122, 122, 146, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
+};
+
+static DfaState st144[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st145[60] = {
+ 436, 436, 160, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st146[60] = {
+ 436, 161, 162, 163, 161, 161, 122, 161, 161, 161,
+ 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
+ 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
+ 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
+ 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
+ 161, 161, 161, 161, 161, 161, 161, 161, 161, 436
+};
+
+static DfaState st147[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 164, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st148[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 165, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st149[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 166, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st150[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 167, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st151[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 168, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st152[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st153[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st154[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 169, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st155[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 170, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st156[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 171, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st157[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st158[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 172, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st159[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st160[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st161[60] = {
+ 436, 161, 162, 163, 161, 161, 173, 161, 161, 161,
+ 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
+ 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
+ 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
+ 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
+ 161, 161, 161, 161, 161, 161, 161, 161, 161, 436
+};
+
+static DfaState st162[60] = {
+ 436, 174, 174, 174, 174, 174, 175, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 436
+};
+
+static DfaState st163[60] = {
+ 436, 174, 176, 174, 174, 174, 175, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 436
+};
+
+static DfaState st164[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 177, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st165[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 178, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st166[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 179, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st167[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 180, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st168[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 181, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st169[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 182, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st170[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st171[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 183, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st172[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 184, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st173[60] = {
+ 436, 185, 144, 145, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 186, 186, 186, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
+};
+
+static DfaState st174[60] = {
+ 436, 174, 174, 174, 174, 174, 175, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 436
+};
+
+static DfaState st175[60] = {
+ 436, 187, 188, 189, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 190, 190, 190, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st176[60] = {
+ 436, 174, 174, 174, 174, 174, 175, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 436
+};
+
+static DfaState st177[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 191, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st178[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 192, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st179[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 193, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st180[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st181[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st182[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 194,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st183[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st184[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
+ 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
+ 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
+ 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
+};
+
+static DfaState st185[60] = {
+ 436, 185, 144, 145, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 186, 186, 186, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
+};
+
+static DfaState st186[60] = {
+ 436, 185, 144, 145, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 186, 186, 186, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
+};
+
+static DfaState st187[60] = {
+ 436, 187, 188, 189, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 190, 190, 190, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st188[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st189[60] = {
+ 436, 436, 195, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st190[60] = {
+ 436, 187, 188, 189, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 190, 190, 190, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st191[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st192[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st193[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st194[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 196, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st195[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st196[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 197, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st197[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 198, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st198[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 199, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st199[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 200, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st200[60] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
+ 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
+ 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
+ 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
+};
+
+static DfaState st201[7] = {
+ 202, 203, 204, 205, 206, 207, 436
+};
+
+static DfaState st202[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st203[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st204[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st205[7] = {
+ 436, 436, 208, 436, 436, 436, 436
+};
+
+static DfaState st206[7] = {
+ 436, 209, 210, 211, 209, 209, 436
+};
+
+static DfaState st207[7] = {
+ 436, 436, 436, 436, 436, 207, 436
+};
+
+static DfaState st208[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st209[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st210[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st211[7] = {
+ 436, 436, 212, 436, 436, 436, 436
+};
+
+static DfaState st212[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st213[7] = {
+ 214, 215, 216, 217, 218, 219, 436
+};
+
+static DfaState st214[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st215[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st216[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st217[7] = {
+ 436, 436, 220, 436, 436, 436, 436
+};
+
+static DfaState st218[7] = {
+ 436, 221, 222, 223, 221, 221, 436
+};
+
+static DfaState st219[7] = {
+ 436, 436, 436, 436, 436, 219, 436
+};
+
+static DfaState st220[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st221[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st222[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st223[7] = {
+ 436, 436, 224, 436, 436, 436, 436
+};
+
+static DfaState st224[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st225[7] = {
+ 226, 227, 228, 229, 230, 231, 436
+};
+
+static DfaState st226[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st227[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st228[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st229[7] = {
+ 436, 436, 232, 436, 436, 436, 436
+};
+
+static DfaState st230[7] = {
+ 436, 233, 233, 233, 233, 233, 436
+};
+
+static DfaState st231[7] = {
+ 436, 436, 436, 436, 436, 231, 436
+};
+
+static DfaState st232[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st233[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st234[7] = {
+ 235, 236, 237, 238, 239, 237, 436
+};
+
+static DfaState st235[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st236[7] = {
+ 436, 436, 240, 436, 436, 436, 436
+};
+
+static DfaState st237[7] = {
+ 436, 436, 237, 436, 436, 237, 436
+};
+
+static DfaState st238[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st239[7] = {
+ 436, 436, 436, 241, 436, 436, 436
+};
+
+static DfaState st240[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st241[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st242[7] = {
+ 243, 244, 245, 246, 247, 245, 436
+};
+
+static DfaState st243[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st244[7] = {
+ 436, 436, 248, 436, 436, 436, 436
+};
+
+static DfaState st245[7] = {
+ 436, 436, 245, 436, 436, 245, 436
+};
+
+static DfaState st246[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st247[7] = {
+ 436, 436, 436, 249, 436, 436, 436
+};
+
+static DfaState st248[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st249[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st250[5] = {
+ 251, 252, 253, 254, 436
+};
+
+static DfaState st251[5] = {
+ 436, 436, 436, 436, 436
+};
+
+static DfaState st252[5] = {
+ 436, 436, 436, 436, 436
+};
+
+static DfaState st253[5] = {
+ 436, 255, 436, 436, 436
+};
+
+static DfaState st254[5] = {
+ 436, 436, 436, 254, 436
+};
+
+static DfaState st255[5] = {
+ 436, 436, 436, 436, 436
+};
+
+static DfaState st256[5] = {
+ 257, 258, 259, 260, 436
+};
+
+static DfaState st257[5] = {
+ 436, 436, 436, 436, 436
+};
+
+static DfaState st258[5] = {
+ 436, 436, 436, 436, 436
+};
+
+static DfaState st259[5] = {
+ 436, 261, 436, 436, 436
+};
+
+static DfaState st260[5] = {
+ 436, 436, 436, 260, 436
+};
+
+static DfaState st261[5] = {
+ 436, 436, 436, 436, 436
+};
+
+static DfaState st262[5] = {
+ 263, 264, 265, 266, 436
+};
+
+static DfaState st263[5] = {
+ 436, 436, 436, 436, 436
+};
+
+static DfaState st264[5] = {
+ 436, 436, 436, 436, 436
+};
+
+static DfaState st265[5] = {
+ 436, 267, 436, 436, 436
+};
+
+static DfaState st266[5] = {
+ 436, 436, 436, 266, 436
+};
+
+static DfaState st267[5] = {
+ 436, 436, 436, 436, 436
+};
+
+static DfaState st268[7] = {
+ 269, 270, 271, 272, 273, 271, 436
+};
+
+static DfaState st269[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st270[7] = {
+ 436, 436, 274, 436, 436, 436, 436
+};
+
+static DfaState st271[7] = {
+ 436, 436, 271, 436, 436, 271, 436
+};
+
+static DfaState st272[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st273[7] = {
+ 436, 436, 436, 275, 436, 436, 436
+};
+
+static DfaState st274[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st275[7] = {
+ 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st276[36] = {
+ 277, 278, 279, 280, 281, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 282, 279, 279, 283, 284,
+ 285, 286, 287, 279, 279, 279, 279, 288, 289, 290,
+ 291, 292, 293, 279, 279, 436
+};
+
+static DfaState st277[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st278[36] = {
+ 436, 294, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st279[36] = {
+ 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 436, 279, 279, 279, 436
+};
+
+static DfaState st280[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st281[36] = {
+ 436, 436, 279, 436, 279, 295, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 436, 279, 279, 279, 436
+};
+
+static DfaState st282[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st283[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st284[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st285[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 296,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st286[36] = {
+ 436, 436, 436, 436, 297, 297, 297, 297, 297, 297,
+ 297, 297, 297, 297, 297, 436, 436, 436, 436, 436,
+ 436, 298, 299, 300, 300, 436, 297, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st287[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st288[36] = {
+ 436, 436, 436, 436, 301, 301, 301, 301, 301, 301,
+ 301, 301, 301, 301, 302, 303, 436, 436, 436, 436,
+ 436, 436, 304, 305, 306, 436, 301, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st289[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st290[36] = {
+ 436, 307, 308, 309, 308, 308, 308, 308, 308, 308,
+ 308, 308, 308, 308, 308, 308, 308, 308, 310, 311,
+ 312, 313, 308, 308, 308, 308, 308, 314, 308, 308,
+ 308, 308, 308, 308, 308, 436
+};
+
+static DfaState st291[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st292[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 315, 316, 436, 436, 436
+};
+
+static DfaState st293[36] = {
+ 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 317, 279, 279, 279, 436
+};
+
+static DfaState st294[36] = {
+ 436, 436, 318, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st295[36] = {
+ 436, 436, 279, 436, 279, 279, 319, 279, 279, 279,
+ 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 436, 279, 279, 279, 436
+};
+
+static DfaState st296[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st297[36] = {
+ 436, 436, 436, 436, 320, 320, 320, 320, 320, 320,
+ 320, 320, 320, 320, 320, 436, 436, 436, 436, 436,
+ 436, 436, 436, 320, 320, 436, 320, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st298[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st299[36] = {
+ 436, 436, 436, 321, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st300[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 300, 300, 322, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st301[36] = {
+ 436, 436, 436, 436, 323, 323, 323, 323, 323, 323,
+ 323, 323, 323, 323, 323, 436, 436, 436, 436, 436,
+ 436, 436, 436, 323, 323, 436, 323, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st302[36] = {
+ 436, 436, 436, 436, 323, 323, 323, 323, 323, 323,
+ 323, 323, 323, 324, 323, 436, 436, 436, 436, 436,
+ 436, 436, 436, 323, 323, 436, 323, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st303[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 325, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st304[36] = {
+ 436, 436, 436, 326, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st305[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 306, 306, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st306[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 306, 306, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st307[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st308[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st309[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st310[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st311[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st312[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 327,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st313[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st314[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st315[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st316[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st317[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st318[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st319[36] = {
+ 436, 436, 279, 436, 279, 279, 279, 328, 279, 279,
+ 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 436, 279, 279, 279, 436
+};
+
+static DfaState st320[36] = {
+ 436, 436, 436, 436, 320, 320, 320, 320, 320, 320,
+ 320, 320, 320, 320, 320, 436, 436, 436, 436, 436,
+ 436, 436, 436, 320, 320, 436, 320, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st321[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st322[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 329, 329, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st323[36] = {
+ 436, 436, 436, 436, 323, 323, 323, 323, 323, 323,
+ 323, 323, 323, 323, 323, 436, 436, 436, 436, 436,
+ 436, 436, 436, 323, 323, 436, 323, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st324[36] = {
+ 436, 436, 436, 436, 323, 323, 330, 323, 323, 323,
+ 323, 323, 323, 323, 323, 436, 436, 436, 436, 436,
+ 436, 436, 436, 323, 323, 436, 323, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st325[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st326[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st327[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st328[36] = {
+ 436, 436, 279, 436, 279, 279, 279, 279, 331, 279,
+ 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 436, 279, 279, 279, 436
+};
+
+static DfaState st329[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 329, 329, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st330[36] = {
+ 436, 436, 436, 436, 323, 323, 323, 323, 323, 323,
+ 332, 323, 323, 323, 323, 436, 436, 436, 436, 436,
+ 436, 436, 436, 323, 323, 436, 323, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st331[36] = {
+ 436, 436, 279, 436, 279, 279, 279, 279, 279, 333,
+ 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 436, 279, 279, 279, 436
+};
+
+static DfaState st332[36] = {
+ 436, 334, 334, 334, 335, 335, 335, 335, 335, 335,
+ 335, 335, 335, 335, 335, 334, 336, 334, 334, 337,
+ 338, 334, 334, 339, 339, 334, 335, 334, 334, 334,
+ 334, 334, 334, 334, 334, 436
+};
+
+static DfaState st333[36] = {
+ 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
+ 340, 279, 279, 279, 279, 436, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 436, 279, 279, 279, 436
+};
+
+static DfaState st334[36] = {
+ 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
+ 334, 334, 334, 334, 334, 334, 334, 334, 334, 337,
+ 338, 334, 334, 334, 334, 334, 334, 334, 334, 334,
+ 334, 334, 334, 334, 334, 436
+};
+
+static DfaState st335[36] = {
+ 436, 334, 334, 334, 335, 335, 335, 335, 335, 335,
+ 335, 335, 335, 335, 335, 334, 334, 334, 334, 337,
+ 338, 334, 334, 335, 335, 334, 335, 334, 334, 334,
+ 334, 334, 334, 334, 334, 436
+};
+
+static DfaState st336[36] = {
+ 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
+ 334, 334, 334, 334, 334, 334, 336, 334, 334, 337,
+ 338, 334, 334, 341, 341, 334, 334, 334, 334, 334,
+ 334, 334, 334, 334, 334, 436
+};
+
+static DfaState st337[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st338[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 342,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st339[36] = {
+ 436, 334, 334, 334, 335, 335, 335, 335, 335, 335,
+ 335, 335, 335, 335, 335, 334, 343, 334, 334, 344,
+ 345, 334, 334, 339, 339, 334, 335, 334, 346, 334,
+ 334, 334, 334, 334, 334, 436
+};
+
+static DfaState st340[36] = {
+ 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
+ 279, 347, 279, 279, 279, 436, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 436, 279, 279, 279, 436
+};
+
+static DfaState st341[36] = {
+ 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
+ 334, 334, 334, 334, 334, 334, 343, 334, 334, 344,
+ 345, 334, 334, 341, 341, 334, 334, 334, 346, 334,
+ 334, 334, 334, 334, 334, 436
+};
+
+static DfaState st342[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st343[36] = {
+ 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
+ 334, 334, 334, 334, 334, 334, 343, 334, 334, 337,
+ 338, 334, 334, 334, 334, 334, 334, 334, 346, 334,
+ 334, 334, 334, 334, 334, 436
+};
+
+static DfaState st344[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st345[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 348,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st346[36] = {
+ 436, 349, 349, 349, 349, 349, 349, 349, 349, 349,
+ 349, 349, 349, 349, 349, 349, 349, 349, 349, 350,
+ 351, 349, 349, 349, 349, 349, 349, 349, 334, 349,
+ 349, 349, 349, 349, 349, 436
+};
+
+static DfaState st347[36] = {
+ 436, 436, 279, 436, 279, 279, 352, 279, 279, 279,
+ 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 436, 279, 279, 279, 436
+};
+
+static DfaState st348[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st349[36] = {
+ 436, 349, 349, 349, 349, 349, 349, 349, 349, 349,
+ 349, 349, 349, 349, 349, 349, 349, 349, 349, 350,
+ 351, 349, 349, 349, 349, 349, 349, 349, 353, 349,
+ 349, 349, 349, 349, 349, 436
+};
+
+static DfaState st350[36] = {
+ 436, 354, 354, 354, 354, 354, 354, 354, 354, 354,
+ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
+ 354, 354, 354, 354, 354, 354, 354, 354, 355, 354,
+ 354, 354, 354, 354, 354, 436
+};
+
+static DfaState st351[36] = {
+ 436, 354, 354, 354, 354, 354, 354, 354, 354, 354,
+ 354, 354, 354, 354, 354, 354, 354, 354, 354, 356,
+ 354, 354, 354, 354, 354, 354, 354, 354, 355, 354,
+ 354, 354, 354, 354, 354, 436
+};
+
+static DfaState st352[36] = {
+ 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
+ 279, 279, 357, 279, 279, 436, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 436, 279, 279, 279, 436
+};
+
+static DfaState st353[36] = {
+ 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
+ 334, 334, 334, 334, 334, 334, 358, 334, 334, 344,
+ 345, 334, 334, 359, 359, 334, 334, 334, 334, 334,
+ 334, 334, 334, 334, 334, 436
+};
+
+static DfaState st354[36] = {
+ 436, 354, 354, 354, 354, 354, 354, 354, 354, 354,
+ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
+ 354, 354, 354, 354, 354, 354, 354, 354, 355, 354,
+ 354, 354, 354, 354, 354, 436
+};
+
+static DfaState st355[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 360, 436, 436, 361,
+ 362, 436, 436, 363, 363, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st356[36] = {
+ 436, 354, 354, 354, 354, 354, 354, 354, 354, 354,
+ 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
+ 354, 354, 354, 354, 354, 354, 354, 354, 355, 354,
+ 354, 354, 354, 354, 354, 436
+};
+
+static DfaState st357[36] = {
+ 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 364, 279, 436, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 436, 279, 279, 279, 436
+};
+
+static DfaState st358[36] = {
+ 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
+ 334, 334, 334, 334, 334, 334, 358, 334, 334, 344,
+ 345, 334, 334, 359, 359, 334, 334, 334, 334, 334,
+ 334, 334, 334, 334, 334, 436
+};
+
+static DfaState st359[36] = {
+ 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
+ 334, 334, 334, 334, 334, 334, 358, 334, 334, 344,
+ 345, 334, 334, 359, 359, 334, 334, 334, 334, 334,
+ 334, 334, 334, 334, 334, 436
+};
+
+static DfaState st360[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 360, 436, 436, 361,
+ 362, 436, 436, 363, 363, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st361[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st362[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 365,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st363[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 360, 436, 436, 361,
+ 362, 436, 436, 363, 363, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st364[36] = {
+ 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 366, 436, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 436, 279, 279, 279, 436
+};
+
+static DfaState st365[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st366[36] = {
+ 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 367, 279, 279, 436, 436,
+ 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
+ 436, 436, 279, 279, 279, 436
+};
+
+static DfaState st367[36] = {
+ 436, 368, 368, 368, 368, 368, 368, 368, 368, 368,
+ 368, 368, 368, 368, 368, 368, 369, 370, 436, 368,
+ 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
+ 368, 368, 368, 368, 368, 436
+};
+
+static DfaState st368[36] = {
+ 436, 368, 368, 368, 368, 368, 368, 368, 368, 368,
+ 368, 368, 368, 368, 368, 368, 368, 368, 371, 368,
+ 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
+ 368, 368, 368, 368, 368, 436
+};
+
+static DfaState st369[36] = {
+ 436, 368, 368, 368, 368, 368, 368, 368, 368, 368,
+ 368, 368, 368, 368, 368, 368, 369, 370, 371, 368,
+ 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
+ 368, 368, 368, 368, 368, 436
+};
+
+static DfaState st370[36] = {
+ 436, 372, 372, 372, 372, 372, 372, 372, 372, 372,
+ 372, 372, 372, 372, 372, 372, 372, 372, 373, 372,
+ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372,
+ 372, 372, 372, 372, 368, 436
+};
+
+static DfaState st371[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st372[36] = {
+ 436, 372, 372, 372, 372, 372, 372, 372, 372, 372,
+ 372, 372, 372, 372, 372, 372, 372, 372, 373, 372,
+ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372,
+ 372, 372, 372, 372, 374, 436
+};
+
+static DfaState st373[36] = {
+ 436, 375, 375, 375, 375, 375, 375, 375, 375, 375,
+ 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
+ 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
+ 375, 375, 375, 375, 376, 436
+};
+
+static DfaState st374[36] = {
+ 436, 368, 368, 368, 368, 368, 368, 368, 368, 368,
+ 368, 368, 368, 368, 368, 368, 377, 368, 378, 368,
+ 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
+ 368, 368, 368, 368, 368, 436
+};
+
+static DfaState st375[36] = {
+ 436, 375, 375, 375, 375, 375, 375, 375, 375, 375,
+ 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
+ 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
+ 375, 375, 375, 375, 376, 436
+};
+
+static DfaState st376[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 379, 436, 380, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st377[36] = {
+ 436, 368, 368, 368, 368, 368, 368, 368, 368, 368,
+ 368, 368, 368, 368, 368, 368, 377, 368, 378, 368,
+ 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
+ 368, 368, 368, 368, 368, 436
+};
+
+static DfaState st378[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st379[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 379, 436, 380, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st380[36] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st381[28] = {
+ 382, 383, 384, 385, 386, 436, 387, 388, 388, 388,
+ 389, 388, 388, 388, 388, 388, 388, 388, 388, 388,
+ 390, 391, 392, 393, 394, 395, 388, 436
+};
+
+static DfaState st382[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st383[28] = {
+ 436, 383, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st384[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st385[28] = {
+ 436, 436, 396, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st386[28] = {
+ 436, 436, 436, 436, 397, 398, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st387[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 399, 436, 400,
+ 401, 436, 436, 436, 402, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st388[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 403, 403, 403,
+ 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
+ 436, 436, 436, 436, 436, 403, 403, 436
+};
+
+static DfaState st389[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 403, 403, 403,
+ 403, 404, 403, 403, 403, 403, 403, 403, 403, 403,
+ 436, 436, 436, 436, 436, 403, 403, 436
+};
+
+static DfaState st390[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st391[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st392[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st393[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st394[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st395[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 395, 436, 436
+};
+
+static DfaState st396[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st397[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st398[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st399[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 405, 436,
+ 436, 436, 436, 436, 436, 406, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st400[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 407, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st401[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 408, 409, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st402[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 410, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st403[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 403, 403, 403,
+ 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
+ 436, 436, 436, 436, 436, 403, 403, 436
+};
+
+static DfaState st404[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 403, 403, 403,
+ 403, 403, 403, 403, 411, 403, 403, 403, 403, 403,
+ 436, 436, 436, 436, 436, 403, 403, 436
+};
+
+static DfaState st405[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 412,
+ 436, 413, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st406[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 414, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st407[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 415, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st408[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 416,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st409[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 417, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st410[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 418,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st411[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 403, 403, 403,
+ 403, 403, 403, 403, 403, 419, 403, 403, 403, 403,
+ 436, 436, 436, 436, 436, 403, 403, 436
+};
+
+static DfaState st412[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 420, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st413[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 421,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st414[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 422, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st415[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 423, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st416[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 424, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st417[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 425, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st418[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 426, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st419[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 403, 403, 403,
+ 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
+ 436, 436, 436, 436, 436, 403, 403, 436
+};
+
+static DfaState st420[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 427, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st421[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 428, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st422[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 429, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st423[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 430, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st424[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 431, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st425[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st426[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 432, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st427[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st428[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 433, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st429[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 434,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st430[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 435, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st431[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st432[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st433[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st434[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+static DfaState st435[28] = {
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
+ 436, 436, 436, 436, 436, 436, 436, 436
+};
+
+
+DfaState *dfa[436] = {
+ st0,
+ st1,
+ st2,
+ st3,
+ st4,
+ st5,
+ st6,
+ st7,
+ st8,
+ st9,
+ st10,
+ st11,
+ st12,
+ st13,
+ st14,
+ st15,
+ st16,
+ st17,
+ st18,
+ st19,
+ st20,
+ st21,
+ st22,
+ st23,
+ st24,
+ st25,
+ st26,
+ st27,
+ st28,
+ st29,
+ st30,
+ st31,
+ st32,
+ st33,
+ st34,
+ st35,
+ st36,
+ st37,
+ st38,
+ st39,
+ st40,
+ st41,
+ st42,
+ st43,
+ st44,
+ st45,
+ st46,
+ st47,
+ st48,
+ st49,
+ st50,
+ st51,
+ st52,
+ st53,
+ st54,
+ st55,
+ st56,
+ st57,
+ st58,
+ st59,
+ st60,
+ st61,
+ st62,
+ st63,
+ st64,
+ st65,
+ st66,
+ st67,
+ st68,
+ st69,
+ st70,
+ st71,
+ st72,
+ st73,
+ st74,
+ st75,
+ st76,
+ st77,
+ st78,
+ st79,
+ st80,
+ st81,
+ st82,
+ st83,
+ st84,
+ st85,
+ st86,
+ st87,
+ st88,
+ st89,
+ st90,
+ st91,
+ st92,
+ st93,
+ st94,
+ st95,
+ st96,
+ st97,
+ st98,
+ st99,
+ st100,
+ st101,
+ st102,
+ st103,
+ st104,
+ st105,
+ st106,
+ st107,
+ st108,
+ st109,
+ st110,
+ st111,
+ st112,
+ st113,
+ st114,
+ st115,
+ st116,
+ st117,
+ st118,
+ st119,
+ st120,
+ st121,
+ st122,
+ st123,
+ st124,
+ st125,
+ st126,
+ st127,
+ st128,
+ st129,
+ st130,
+ st131,
+ st132,
+ st133,
+ st134,
+ st135,
+ st136,
+ st137,
+ st138,
+ st139,
+ st140,
+ st141,
+ st142,
+ st143,
+ st144,
+ st145,
+ st146,
+ st147,
+ st148,
+ st149,
+ st150,
+ st151,
+ st152,
+ st153,
+ st154,
+ st155,
+ st156,
+ st157,
+ st158,
+ st159,
+ st160,
+ st161,
+ st162,
+ st163,
+ st164,
+ st165,
+ st166,
+ st167,
+ st168,
+ st169,
+ st170,
+ st171,
+ st172,
+ st173,
+ st174,
+ st175,
+ st176,
+ st177,
+ st178,
+ st179,
+ st180,
+ st181,
+ st182,
+ st183,
+ st184,
+ st185,
+ st186,
+ st187,
+ st188,
+ st189,
+ st190,
+ st191,
+ st192,
+ st193,
+ st194,
+ st195,
+ st196,
+ st197,
+ st198,
+ st199,
+ st200,
+ st201,
+ st202,
+ st203,
+ st204,
+ st205,
+ st206,
+ st207,
+ st208,
+ st209,
+ st210,
+ st211,
+ st212,
+ st213,
+ st214,
+ st215,
+ st216,
+ st217,
+ st218,
+ st219,
+ st220,
+ st221,
+ st222,
+ st223,
+ st224,
+ st225,
+ st226,
+ st227,
+ st228,
+ st229,
+ st230,
+ st231,
+ st232,
+ st233,
+ st234,
+ st235,
+ st236,
+ st237,
+ st238,
+ st239,
+ st240,
+ st241,
+ st242,
+ st243,
+ st244,
+ st245,
+ st246,
+ st247,
+ st248,
+ st249,
+ st250,
+ st251,
+ st252,
+ st253,
+ st254,
+ st255,
+ st256,
+ st257,
+ st258,
+ st259,
+ st260,
+ st261,
+ st262,
+ st263,
+ st264,
+ st265,
+ st266,
+ st267,
+ st268,
+ st269,
+ st270,
+ st271,
+ st272,
+ st273,
+ st274,
+ st275,
+ st276,
+ st277,
+ st278,
+ st279,
+ st280,
+ st281,
+ st282,
+ st283,
+ st284,
+ st285,
+ st286,
+ st287,
+ st288,
+ st289,
+ st290,
+ st291,
+ st292,
+ st293,
+ st294,
+ st295,
+ st296,
+ st297,
+ st298,
+ st299,
+ st300,
+ st301,
+ st302,
+ st303,
+ st304,
+ st305,
+ st306,
+ st307,
+ st308,
+ st309,
+ st310,
+ st311,
+ st312,
+ st313,
+ st314,
+ st315,
+ st316,
+ st317,
+ st318,
+ st319,
+ st320,
+ st321,
+ st322,
+ st323,
+ st324,
+ st325,
+ st326,
+ st327,
+ st328,
+ st329,
+ st330,
+ st331,
+ st332,
+ st333,
+ st334,
+ st335,
+ st336,
+ st337,
+ st338,
+ st339,
+ st340,
+ st341,
+ st342,
+ st343,
+ st344,
+ st345,
+ st346,
+ st347,
+ st348,
+ st349,
+ st350,
+ st351,
+ st352,
+ st353,
+ st354,
+ st355,
+ st356,
+ st357,
+ st358,
+ st359,
+ st360,
+ st361,
+ st362,
+ st363,
+ st364,
+ st365,
+ st366,
+ st367,
+ st368,
+ st369,
+ st370,
+ st371,
+ st372,
+ st373,
+ st374,
+ st375,
+ st376,
+ st377,
+ st378,
+ st379,
+ st380,
+ st381,
+ st382,
+ st383,
+ st384,
+ st385,
+ st386,
+ st387,
+ st388,
+ st389,
+ st390,
+ st391,
+ st392,
+ st393,
+ st394,
+ st395,
+ st396,
+ st397,
+ st398,
+ st399,
+ st400,
+ st401,
+ st402,
+ st403,
+ st404,
+ st405,
+ st406,
+ st407,
+ st408,
+ st409,
+ st410,
+ st411,
+ st412,
+ st413,
+ st414,
+ st415,
+ st416,
+ st417,
+ st418,
+ st419,
+ st420,
+ st421,
+ st422,
+ st423,
+ st424,
+ st425,
+ st426,
+ st427,
+ st428,
+ st429,
+ st430,
+ st431,
+ st432,
+ st433,
+ st434,
+ st435
+};
+
+
+DfaState accepts[437] = {
+ 0, 1, 2, 3, 3, 4, 25, 6, 0, 50,
+ 59, 57, 57, 43, 26, 13, 14, 0, 57, 58,
+ 57, 21, 57, 23, 24, 27, 28, 44, 0, 35,
+ 36, 42, 45, 46, 58, 51, 52, 3, 5, 9,
+ 7, 8, 59, 59, 59, 59, 59, 59, 59, 59,
+ 57, 57, 12, 40, 59, 57, 58, 57, 57, 57,
+ 33, 34, 53, 58, 59, 59, 59, 59, 59, 59,
+ 59, 59, 59, 57, 59, 57, 57, 57, 57, 0,
+ 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
+ 57, 57, 57, 57, 57, 0, 0, 59, 59, 59,
+ 59, 59, 59, 32, 59, 59, 59, 59, 59, 59,
+ 59, 59, 57, 57, 57, 22, 56, 48, 49, 0,
+ 11, 11, 0, 59, 59, 59, 59, 59, 59, 59,
+ 59, 59, 59, 41, 59, 59, 59, 18, 57, 47,
+ 57, 0, 11, 0, 10, 10, 0, 59, 59, 59,
+ 59, 59, 15, 19, 59, 59, 59, 17, 57, 55,
+ 10, 0, 11, 11, 59, 59, 59, 59, 59, 59,
+ 20, 59, 57, 0, 0, 0, 11, 59, 59, 59,
+ 37, 38, 59, 39, 54, 0, 0, 0, 10, 10,
+ 0, 31, 29, 30, 59, 10, 59, 59, 59, 59,
+ 16, 0, 60, 61, 62, 62, 0, 65, 62, 64,
+ 63, 63, 63, 0, 66, 67, 68, 68, 0, 71,
+ 68, 70, 69, 69, 69, 0, 72, 73, 74, 74,
+ 0, 76, 74, 75, 0, 77, 79, 81, 80, 80,
+ 78, 80, 0, 82, 84, 86, 85, 85, 83, 85,
+ 0, 87, 88, 88, 89, 88, 0, 90, 91, 91,
+ 92, 91, 0, 93, 94, 94, 95, 94, 0, 96,
+ 98, 100, 99, 99, 97, 99, 0, 101, 108, 143,
+ 104, 143, 129, 127, 107, 107, 109, 128, 126, 134,
+ 0, 133, 139, 143, 102, 143, 107, 116, 110, 112,
+ 113, 123, 123, 125, 124, 117, 120, 132, 138, 130,
+ 131, 137, 137, 135, 136, 142, 140, 141, 103, 143,
+ 116, 111, 114, 123, 123, 119, 118, 137, 143, 115,
+ 123, 143, 123, 143, 0, 123, 0, 122, 122, 123,
+ 143, 0, 122, 0, 121, 121, 0, 143, 121, 0,
+ 122, 122, 143, 0, 0, 0, 122, 143, 0, 0,
+ 0, 121, 121, 0, 143, 121, 143, 0, 0, 0,
+ 0, 106, 0, 106, 0, 0, 0, 0, 105, 0,
+ 105, 0, 144, 145, 146, 146, 0, 0, 164, 164,
+ 158, 159, 160, 161, 162, 163, 146, 147, 148, 0,
+ 0, 0, 0, 164, 164, 150, 0, 0, 0, 0,
+ 0, 164, 0, 0, 0, 0, 0, 0, 0, 157,
+ 0, 0, 0, 0, 0, 152, 0, 149, 0, 0,
+ 0, 153, 154, 151, 155, 156, 0
+};
+
+void (*actions[165])() = {
+ zzerraction,
+ act1,
+ act2,
+ act3,
+ act4,
+ act5,
+ act6,
+ act7,
+ act8,
+ act9,
+ act10,
+ act11,
+ act12,
+ act13,
+ act14,
+ act15,
+ act16,
+ act17,
+ act18,
+ act19,
+ act20,
+ act21,
+ act22,
+ act23,
+ act24,
+ act25,
+ act26,
+ act27,
+ act28,
+ act29,
+ act30,
+ act31,
+ act32,
+ act33,
+ act34,
+ act35,
+ act36,
+ act37,
+ act38,
+ act39,
+ act40,
+ act41,
+ act42,
+ act43,
+ act44,
+ act45,
+ act46,
+ act47,
+ act48,
+ act49,
+ act50,
+ act51,
+ act52,
+ act53,
+ act54,
+ act55,
+ act56,
+ act57,
+ act58,
+ act59,
+ act60,
+ act61,
+ act62,
+ act63,
+ act64,
+ act65,
+ act66,
+ act67,
+ act68,
+ act69,
+ act70,
+ act71,
+ act72,
+ act73,
+ act74,
+ act75,
+ act76,
+ act77,
+ act78,
+ act79,
+ act80,
+ act81,
+ act82,
+ act83,
+ act84,
+ act85,
+ act86,
+ act87,
+ act88,
+ act89,
+ act90,
+ act91,
+ act92,
+ act93,
+ act94,
+ act95,
+ act96,
+ act97,
+ act98,
+ act99,
+ act100,
+ act101,
+ act102,
+ act103,
+ act104,
+ act105,
+ act106,
+ act107,
+ act108,
+ act109,
+ act110,
+ act111,
+ act112,
+ act113,
+ act114,
+ act115,
+ act116,
+ act117,
+ act118,
+ act119,
+ act120,
+ act121,
+ act122,
+ act123,
+ act124,
+ act125,
+ act126,
+ act127,
+ act128,
+ act129,
+ act130,
+ act131,
+ act132,
+ act133,
+ act134,
+ act135,
+ act136,
+ act137,
+ act138,
+ act139,
+ act140,
+ act141,
+ act142,
+ act143,
+ act144,
+ act145,
+ act146,
+ act147,
+ act148,
+ act149,
+ act150,
+ act151,
+ act152,
+ act153,
+ act154,
+ act155,
+ act156,
+ act157,
+ act158,
+ act159,
+ act160,
+ act161,
+ act162,
+ act163,
+ act164
+};
+
+static DfaState dfa_base[] = {
+ 0,
+ 201,
+ 213,
+ 225,
+ 234,
+ 242,
+ 250,
+ 256,
+ 262,
+ 268,
+ 276,
+ 381
+};
+
+static unsigned char *b_class_no[] = {
+ shift0,
+ shift1,
+ shift2,
+ shift3,
+ shift4,
+ shift5,
+ shift6,
+ shift7,
+ shift8,
+ shift9,
+ shift10,
+ shift11
+};
+
+
+
+#define ZZSHIFT(c) (b_class_no[zzauto][1+c])
+#define MAX_MODE 12
+#include "dlgauto.h"
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/stdpccts.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/stdpccts.h
new file mode 100644
index 000000000..ccdc21c3c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/stdpccts.h
@@ -0,0 +1,31 @@
+#ifndef STDPCCTS_H
+#define STDPCCTS_H
+/*
+ * stdpccts.h -- P C C T S I n c l u d e
+ *
+ * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
+ * Purdue University Electrical Engineering
+ * With AHPCRC, University of Minnesota
+ * ANTLR Version 1.33MR33
+ */
+
+#ifndef ANTLR_VERSION
+#define ANTLR_VERSION 13333
+#endif
+
+#include "pcctscfg.h"
+#include "pccts_stdio.h"
+
+#include "pcctscfg.h"
+#include "set.h"
+#include <ctype.h>
+#include "syn.h"
+#include "hash.h"
+#include "generic.h"
+#define zzcr_attr(attr,tok,t)
+#define zzSET_SIZE 20
+#include "antlr.h"
+#include "tokens.h"
+#include "dlgdef.h"
+#include "mode.h"
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/syn.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/syn.h
new file mode 100644
index 000000000..a23d196d7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/syn.h
@@ -0,0 +1,390 @@
+/*
+ * syn.h
+ *
+ * This file includes definitions and macros associated with syntax diagrams
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include "set.h"
+
+#define NumNodeTypes 4
+#define NumJuncTypes 9
+
+/* List the different node types */
+#define nJunction 1
+#define nRuleRef 2
+#define nToken 3
+#define nAction 4
+
+/* Different types of junctions */
+#define aSubBlk 1
+#define aOptBlk 2
+#define aLoopBlk 3
+#define EndBlk 4
+#define RuleBlk 5
+#define Generic 6 /* just a junction--no unusual characteristics */
+#define EndRule 7
+#define aPlusBlk 8
+#define aLoopBegin 9
+
+typedef int NodeType;
+
+#define TreeBlockAllocSize 500
+#define JunctionBlockAllocSize 200
+#define ActionBlockAllocSize 50
+#define RRefBlockAllocSize 100
+#define TokenBlockAllocSize 100
+
+#ifdef __cplusplus
+class ActionNode;
+class Junction;
+#endif
+
+/* note that 'right' is used by the tree node allocator as a ptr for linked list */
+typedef struct _tree {
+ struct _tree *down, *right;
+ int token;
+ union {
+ int rk; /* if token==EpToken, => how many more tokens req'd */
+ struct _tree *tref; /* if token==TREE_REF */
+ set sref; /* if token==SET */
+ } v;
+#ifdef TREE_DEBUG
+ int in_use;
+ int seq;
+#endif
+ } Tree;
+
+
+/* a predicate is defined to be a predicate action and a token tree with
+ * context info (if used); later, this struct may include the
+ * "hoisting distance" when we hoist past tokens.
+ *
+ * A tree is used to indicate && vs ||
+ *
+ * p
+ * |
+ * q--r
+ *
+ * indicates p && (q||r).
+ *
+ * If expr is PRED_AND_LIST or PRED_OR_LIST, then it's an operation node
+ * and indicates the start of an && or || list.
+ */
+
+typedef struct _Predicate {
+ struct _Predicate *down, *right; /* these have to be first */
+ struct _Predicate *up, *left; /* doubly-link me */
+ char *expr;
+ Tree *tcontext; /* used if lookahead depth of > one is needed (tree) */
+ int k; /* lookahead depth for this tcontext */
+ set scontext[2];/* used if lookahead depth of one is needed (set) */
+ /* scontext[0] is not used; only needed so genExprSets()
+ routine works (it expects an array)
+ */
+ set completionTree; /* which lookahead depths are required to complete tcontext? */
+ set completionSet; /* MR10 separate completion set for sets and trees */
+ struct _PredEntry *predEntry; /* MR11 */
+
+#ifdef __cplusplus
+ ActionNode *source; /* where did this predicate come from? */
+#else
+ struct _anode *source; /* where did this predicate come from? */
+#endif
+
+ char cloned; /* MR10 don't want to free original guard pred */
+ char redundant; /* MR10 predicate tree simplification */
+ char ampersandStyle; /* MR10 (g)? && <<p>>? */
+ char inverted; /* MR11 ! predName */
+ char isConst; /* MR11 */
+ char constValue; /* MR11 */
+ char conflictReported; /* MR11 */
+
+ set plainSet; /* MR12b */
+
+ /*** remember to change new_predicate() and predicate_dup() when changing this ***/
+
+} Predicate;
+
+typedef struct _ExceptionHandler {
+ char *signalname;
+ char *action;
+ } ExceptionHandler;
+
+typedef struct _ExceptionGroup {
+ struct _ListNode *handlers; /* list of ExceptionHandler's */
+ char *label; /* label==""; implies not attached to any
+ * particular rule ref.
+ */
+ char *altID; /* which alt did it come from (blk#:alt#) */
+
+ struct _ExceptionGroup *pendingLink; /* for alternative EG MR7 */
+ struct _ExceptionGroup *outerEG; /* for alternative EG MR7 */
+ struct _LabelEntry *labelEntry; /* for alternative EG MR7 */
+ int forRule; /* MR7 */
+ int used; /* MR7 */
+ } ExceptionGroup ;
+
+
+#define TokenString(_i) ((TokenInd!=NULL)?TokenStr[TokenInd[_i]]:TokenStr[_i])
+#define ExprString(_i) ((TokenInd!=NULL)?ExprStr[TokenInd[_i]]:ExprStr[_i])
+
+
+ /* M e s s a g e P a s s i n g T o N o d e s */
+
+/*
+ * assumes a 'Junction *r' exists. This macro calls a function with
+ * the pointer to the node to operate on and a pointer to the rule
+ * in which it is enclosed.
+ */
+#define TRANS(p) {if ( (p)==NULL ) fatal("TRANS: NULL object"); \
+ if ( (p)->ntype == nJunction ) (*(fpJTrans[((Junction *)(p))->jtype]))( p );\
+ else (*(fpTrans[(p)->ntype]))( p );}
+
+#define PRINT(p) {if ( (p)==NULL ) fatal("PRINT: NULL object");\
+ (*(fpPrint[(p)->ntype]))( p );}
+
+#define REACH(p,k,rk,a) {if ( (p)==NULL ) fatal("REACH: NULL object");\
+ (a) = (*(fpReach[(p)->ntype]))( p, k, rk );}
+
+#define TRAV(p,k,rk,a) {if ( (p)==NULL ) {\
+ if ( ContextGuardTRAV ) (a)=NULL; \
+ else fatal("TRAV: NULL object");\
+ } \
+ else (a) = (*(fpTraverse[(p)->ntype]))( p, k, rk );}
+
+/**
+*** #define TRAV(p,k,rk,a) {if ( (p)==NULL ) fatal("TRAV: NULL object");\
+*** (a) = (*(fpTraverse[(p)->ntype]))( p, k, rk );}
+**/
+
+/* All syntax diagram nodes derive from Node -- superclass
+ */
+#ifdef __cplusplus
+class Node {
+public:
+ NodeType ntype;
+ char *rname; /* what rule does this element live in? */
+ int file; /* index in FileStr */
+ int line; /* line number that element occurs on */
+ };
+#else
+typedef struct _node {
+ NodeType ntype;
+ char *rname; /* what rule does this element live in? */
+ int file; /* index in FileStr */
+ int line; /* line number that element occurs on */
+ } Node;
+#endif
+
+#ifdef __cplusplus
+class ActionNode : public Node {
+public:
+#else
+typedef struct _anode {
+ NodeType ntype;
+ char *rname; /* what rule does this action live in? */
+ int file; /* index in FileStr (name of file with action) */
+ int line; /* line number that action occurs on */
+#endif
+ Node *next;
+ char *action;
+ int is_predicate; /* true if action is a <<...>>? predicate action */
+ int done; /* don't dump if action dumped (used for predicates) */
+ int init_action; /* is this the 1st action of 1st prod of block? */
+ char *pred_fail; /* what to do/print when predicate fails */
+ Predicate *guardpred; /* if '(context)? =>' was present, already done */
+ unsigned char frmwarned;/* have we dumped a warning for pred yet? */
+ unsigned char ctxwarned;/* have we dumped a warning for pred yet? */
+ unsigned char predTooLong; /* MR10 have we dumped warning for pred yet */
+ unsigned char noHoist; /* MR12 literally "noHoist" */
+ Predicate *ampersandPred; /* MR10 (g)? && <<p>>? expr */
+#ifdef __cplusplus
+ Junction *guardNodes; /* MR11 */
+#else
+ struct _junct *guardNodes; /* MR11 */
+#endif
+ struct _PredEntry *predEntry; /* MR11 */
+ int inverted; /* MR11 <<!predSymbol>>? */
+#ifdef __cplusplus
+ };
+#else
+ } ActionNode;
+#endif
+
+#ifdef __cplusplus
+class TokNode : public Node {
+public:
+#else
+typedef struct _toknode {
+ NodeType ntype;
+ char *rname; /* name of rule it's in */
+ int file; /* index in FileStr (name of file with rule) */
+ int line; /* line number that token occurs on */
+#endif
+ Node *next;
+ int token;
+ int astnode; /* leaf/root/excluded (used to build AST's) */
+ unsigned char label;/* token label or expression ? */
+ unsigned char remapped;
+ /* used if token id's are forced to certain positions;
+ * a function walks the tree reassigning token numbers */
+ int upper_range; /* MR13 - was char */
+ /* used only if Token is of type T1..T2; in this case,
+ * use token..upper_range as the range; else
+ * upper_range must be 0 */
+ unsigned char wild_card;
+ /* indicates that the token is the "." wild-card;
+ * field token is ignored if wild_card is set
+ */
+ unsigned int elnum; /* element number within the alternative */
+#ifdef __cplusplus
+ Junction *altstart; /* pointer to node that starts alt */
+#else
+ struct _junct *altstart; /* pointer to node that starts alt */
+#endif
+ struct _TCnode *tclass; /* token class if tokclass ref */
+ set tset; /* set of tokens represented by meta token */
+ char *el_label; /* el_label:toknode */
+ unsigned char complement; /* complement the set? */
+ ExceptionGroup *ex_group; /* any exception[el_label] attached? */
+ unsigned char use_def_MT_handler;
+ unsigned char label_used_in_semantic_pred; /* MR10 */
+#ifdef __cplusplus
+ };
+#else
+ } TokNode;
+#endif
+
+#ifdef __cplusplus
+class RuleRefNode : public Node {
+public:
+#else
+typedef struct _rrnode {
+ NodeType ntype;
+ char *rname; /* name of rule it's in */
+ int file; /* index in FileStr (name of file with rule)
+ it's in */
+ int line; /* line number that rule ref occurs on */
+#endif
+ Node *next;
+ char *text; /* reference to which rule */
+ char *parms; /* point to parameters of rule invocation
+ (if present) */
+ char *assign; /* point to left-hand-side of assignment
+ (if any) */
+ int linked; /* Has a FoLink already been established? */
+ int astnode; /* excluded? (used to build AST's) */
+ unsigned int elnum; /* element number within the alternative */
+#ifdef __cplusplus
+ Junction *altstart;
+#else
+ struct _junct *altstart;
+#endif
+ char *el_label; /* el_label:rrnode */
+ ExceptionGroup *ex_group; /* any exception[el_label] attached? */
+#ifdef __cplusplus
+ };
+#else
+ } RuleRefNode;
+#endif
+
+#ifdef __cplusplus
+class Junction : public Node {
+public:
+#else
+typedef struct _junct {
+ NodeType ntype;
+ char *rname; /* name of rule junction is in */
+ int file; /* index in FileStr (name of file with rule)
+ if blk == RuleBlk */
+ int line; /* line number that rule occurs on */
+#endif
+ int seq; /* MR10 sequence number */
+ char ignore; /* used by FIRST computation to ignore
+ empty alt added for the (...)+ blks */
+ char visited; /* used by recursive routines to avoid
+ infinite recursion */
+ char pvisited; /* used by print routines to avoid
+ infinite recursion */
+ char fvisited; /* used by FoLink() to avoid
+ infinite recursion */
+ char *lock; /* used by REACH to track infinite recursion */
+ char *pred_lock; /* used by find_predicates to track infinite recursion */
+ int altnum; /* used in subblocks. altnum==0 means not an
+ alt of subrule */
+ int jtype; /* annotation for code-gen/FIRST/FOLLOW.
+ Junction type */
+#ifdef __cplusplus
+ Junction *end; /* pointer to node with EndBlk in it
+ if blk == a block type */
+#else
+ struct _junct *end; /* pointer to node with EndBlk in it
+ if blk == a block type */
+#endif
+ Node *p1, *p2;
+ char halt; /* never move past a junction with halt==TRUE */ /* MR10 was int */
+ char *pdecl; /* point to declaration of parameters on rule
+ (if present) */
+ char *parm; /* point to parameter of block invocation
+ (if present) */
+ char predparm; /* indicates that the 'parm' is a predicate
+ * to be used in the while loop generated
+ * for blocks */ /* MR10 was int */
+ char *ret; /* point to return type of rule (if present) */
+ char *erraction; /* point to error action (if present) */
+ int blockid; /* this is a unique ID */
+ char *exception_label; /* goto label for this alt */
+ set *fset; /* used for code generation */
+ Tree *ftree; /* used for code generation */
+ Predicate *predicate;/* predicate that can be used to disambiguate */
+ char guess; /* true if (...)? block */
+ char alpha_beta_guess_end; /* MR14 1 => end block of guess sub block */
+ Node *guess_analysis_point; /* MR14 */
+ char approx; /* limit block to use linear approx lookahead? */
+ set tokrefs; /* if ith element of alt is tokref then i is member */
+ set rulerefs; /* if ith element of alt is rule ref then i is member */
+ struct _ListNode *exceptions; /* list of exceptions groups for rule */
+ struct _ListNode *el_labels; /* list of element labels for rule */
+ ExceptionGroup *outerEG; /* MR7 */
+ int curAltNum; /* MR7 */
+ char* pFirstSetSymbol; /* #pragma FirstSetSymbol(Foo) MR21 */
+#ifdef __cplusplus
+ Junction *pendingLink; /* MR7 */
+#else
+ struct _junct *pendingLink; /* MR7 */
+#endif
+ char overlap_warning; /* MR10 */
+#ifdef __cplusplus
+ };
+#else
+ } Junction;
+#endif
+
+typedef struct { Node *left, *right;} Graph;
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/tokens.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/tokens.h
new file mode 100644
index 000000000..91a53a847
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/antlr/tokens.h
@@ -0,0 +1,246 @@
+#ifndef tokens_h
+#define tokens_h
+/* tokens.h -- List of labelled tokens and stuff
+ *
+ * Generated from: antlr.g
+ *
+ * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
+ * Purdue University Electrical Engineering
+ * ANTLR Version 1.33MR33
+ */
+#define zzEOF_TOKEN 1
+#define Eof 1
+#define QuotedTerm 2
+#define Action 34
+#define Pred 35
+#define PassAction 36
+#define WildCard 87
+#define LABEL 89
+#define Pragma 92
+#define FirstSetSymbol 93
+#define NonTerminal 100
+#define TokenTerm 101
+#define ID 148
+#define INT 150
+
+#ifdef __USE_PROTOS
+void grammar(void);
+#else
+extern void grammar();
+#endif
+
+#ifdef __USE_PROTOS
+void class_def(void);
+#else
+extern void class_def();
+#endif
+
+#ifdef __USE_PROTOS
+void rule(void);
+#else
+extern void rule();
+#endif
+
+#ifdef __USE_PROTOS
+void laction(void);
+#else
+extern void laction();
+#endif
+
+#ifdef __USE_PROTOS
+void lmember(void);
+#else
+extern void lmember();
+#endif
+
+#ifdef __USE_PROTOS
+void lprefix(void);
+#else
+extern void lprefix();
+#endif
+
+#ifdef __USE_PROTOS
+void aPred(void);
+#else
+extern void aPred();
+#endif
+
+#ifdef __USE_PROTOS
+extern Predicate * predOrExpr(void);
+#else
+extern Predicate * predOrExpr();
+#endif
+
+#ifdef __USE_PROTOS
+extern Predicate * predAndExpr(void);
+#else
+extern Predicate * predAndExpr();
+#endif
+
+#ifdef __USE_PROTOS
+extern Predicate * predPrimary(void);
+#else
+extern Predicate * predPrimary();
+#endif
+
+#ifdef __USE_PROTOS
+void aLexclass(void);
+#else
+extern void aLexclass();
+#endif
+
+#ifdef __USE_PROTOS
+void error(void);
+#else
+extern void error();
+#endif
+
+#ifdef __USE_PROTOS
+void tclass(void);
+#else
+extern void tclass();
+#endif
+
+#ifdef __USE_PROTOS
+void token(void);
+#else
+extern void token();
+#endif
+
+#ifdef __USE_PROTOS
+void block(set * toksrefd,set * rulesrefd);
+#else
+extern void block();
+#endif
+
+#ifdef __USE_PROTOS
+void alt(set * toksrefd,set * rulesrefd);
+#else
+extern void alt();
+#endif
+
+#ifdef __USE_PROTOS
+extern LabelEntry * element_label(void);
+#else
+extern LabelEntry * element_label();
+#endif
+
+#ifdef __USE_PROTOS
+extern Node * element(int old_not,int first_on_line,int use_def_MT_handler);
+#else
+extern Node * element();
+#endif
+
+#ifdef __USE_PROTOS
+void default_exception_handler(void);
+#else
+extern void default_exception_handler();
+#endif
+
+#ifdef __USE_PROTOS
+extern ExceptionGroup * exception_group(void);
+#else
+extern ExceptionGroup * exception_group();
+#endif
+
+#ifdef __USE_PROTOS
+extern ExceptionHandler * exception_handler(void);
+#else
+extern ExceptionHandler * exception_handler();
+#endif
+
+#ifdef __USE_PROTOS
+void enum_file(char * fname);
+#else
+extern void enum_file();
+#endif
+
+#ifdef __USE_PROTOS
+void defines(char * fname);
+#else
+extern void defines();
+#endif
+
+#ifdef __USE_PROTOS
+void enum_def(char * fname);
+#else
+extern void enum_def();
+#endif
+
+#endif
+extern SetWordType zzerr1[];
+extern SetWordType zzerr2[];
+extern SetWordType zzerr3[];
+extern SetWordType zzerr4[];
+extern SetWordType setwd1[];
+extern SetWordType zzerr5[];
+extern SetWordType zzerr6[];
+extern SetWordType zzerr7[];
+extern SetWordType zzerr8[];
+extern SetWordType zzerr9[];
+extern SetWordType setwd2[];
+extern SetWordType zzerr10[];
+extern SetWordType zzerr11[];
+extern SetWordType zzerr12[];
+extern SetWordType zzerr13[];
+extern SetWordType setwd3[];
+extern SetWordType zzerr14[];
+extern SetWordType zzerr15[];
+extern SetWordType zzerr16[];
+extern SetWordType zzerr17[];
+extern SetWordType zzerr18[];
+extern SetWordType zzerr19[];
+extern SetWordType zzerr20[];
+extern SetWordType zzerr21[];
+extern SetWordType setwd4[];
+extern SetWordType zzerr22[];
+extern SetWordType zzerr23[];
+extern SetWordType zzerr24[];
+extern SetWordType zzerr25[];
+extern SetWordType zzerr26[];
+extern SetWordType setwd5[];
+extern SetWordType zzerr27[];
+extern SetWordType zzerr28[];
+extern SetWordType zzerr29[];
+extern SetWordType zzerr30[];
+extern SetWordType zzerr31[];
+extern SetWordType zzerr32[];
+extern SetWordType zzerr33[];
+extern SetWordType setwd6[];
+extern SetWordType zzerr34[];
+extern SetWordType zzerr35[];
+extern SetWordType zzerr36[];
+extern SetWordType zzerr37[];
+extern SetWordType zzerr38[];
+extern SetWordType zzerr39[];
+extern SetWordType zzerr40[];
+extern SetWordType zzerr41[];
+extern SetWordType zzerr42[];
+extern SetWordType setwd7[];
+extern SetWordType zzerr43[];
+extern SetWordType zzerr44[];
+extern SetWordType zzerr45[];
+extern SetWordType zzerr46[];
+extern SetWordType zzerr47[];
+extern SetWordType zzerr48[];
+extern SetWordType zzerr49[];
+extern SetWordType zzerr50[];
+extern SetWordType zzerr51[];
+extern SetWordType zzerr52[];
+extern SetWordType zzerr53[];
+extern SetWordType setwd8[];
+extern SetWordType zzerr54[];
+extern SetWordType zzerr55[];
+extern SetWordType zzerr56[];
+extern SetWordType zzerr57[];
+extern SetWordType setwd9[];
+extern SetWordType zzerr58[];
+extern SetWordType zzerr59[];
+extern SetWordType zzerr60[];
+extern SetWordType zzerr61[];
+extern SetWordType zzerr62[];
+extern SetWordType zzerr63[];
+extern SetWordType zzerr64[];
+extern SetWordType zzerr65[];
+extern SetWordType setwd10[];
+extern SetWordType setwd11[];
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/DlgDDK.mak b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/DlgDDK.mak
new file mode 100644
index 000000000..156d524ac
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/DlgDDK.mak
@@ -0,0 +1,121 @@
+# PCCTS directory
+
+# You will need to set the LIB variable similar to this.
+# LIB="C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/lib;c:/Microsoft Visual Studio .NET 2003/Vc7/PlatformSDK/Lib"
+
+# PCCTS_HOME=<your PCCTS_HOME>
+PCCTS_HOME=$(WORKSPACE)\Tools\CCode\Source\Pccts
+DLG_SRC=$(PCCTS_HOME)\dlg
+PCCTS_H=$(PCCTS_HOME)\h
+
+
+# Support directories
+SET=$(PCCTS_HOME)\support\set
+
+
+# Compiler stuff
+CC = cl
+CFLAGS = /nologo -I "." -I "$(PCCTS_H)" -I "$(SET)" -D "USER_ZZSYN" -D "PC" \
+ -D "ZZLEXBUFSIZE=65536" /D "LONGFILENAMES" /W3 /Zi
+
+DLG_OBJS = dlg_p.obj dlg_a.obj main.obj err.obj support.obj \
+ output.obj relabel.obj automata.obj
+
+SUPPORT_OBJS = set.obj
+
+# Dependencies
+
+dlg.exe: $(DLG_OBJS) $(SUPPORT_OBJS)
+ $(CC) $(CFLAGS) -o dlg.exe bufferoverflowu.lib $(DLG_OBJS) $(SUPPORT_OBJS)
+ del *.obj
+ del *.ilk
+ del *.pdb
+ move dlg.exe $(WORKSPACE)\Tools\bin\.
+
+dlg_p.obj: $(DLG_SRC)\dlg_p.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+ $(DLG_SRC)\mode.h \
+ $(DLG_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\dlg_p.c
+
+dlg_a.obj: $(DLG_SRC)\dlg_a.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgauto.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+ $(DLG_SRC)\mode.h \
+ $(DLG_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\dlg_a.c
+
+main.obj: $(DLG_SRC)\main.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+ $(DLG_SRC)\mode.h \
+ $(DLG_SRC)\stdpccts.h \
+ $(DLG_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\main.c
+
+err.obj: $(DLG_SRC)\err.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(PCCTS_H)\err.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+ $(DLG_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\err.c
+
+support.obj: $(DLG_SRC)\support.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\support.c
+
+output.obj: $(DLG_SRC)\output.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\output.c
+
+relabel.obj: $(DLG_SRC)\relabel.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\relabel.c
+
+automata.obj: $(DLG_SRC)\automata.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\automata.c
+
+
+set.obj: $(SET)\set.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+
+ $(CC) -c $(CFLAGS) $(SET)\set.c
+
+clean:
+ del *.obj
+
+distclean:
+ del *.obj
+ del $(WORKSPACE)\Tools\bin\dlg.exe
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/DlgMS.mak b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/DlgMS.mak
new file mode 100644
index 000000000..2714308d4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/DlgMS.mak
@@ -0,0 +1,126 @@
+# PCCTS directory
+
+# You will need to set the LIB variable similar to this.
+# LIB="C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/lib;c:/Microsoft Visual Studio .NET 2003/Vc7/PlatformSDK/Lib"
+
+# PCCTS_HOME=<your PCCTS_HOME>
+PCCTS_HOME=$(BASE_TOOLS_PATH)\Source\C\VfrCompile\Pccts
+DLG_SRC=$(PCCTS_HOME)\dlg
+PCCTS_H=$(PCCTS_HOME)\h
+
+
+# Support directories
+SET=$(PCCTS_HOME)\support\set
+
+
+# Compiler stuff
+CC = cl
+CFLAGS = /nologo -I "." -I "$(PCCTS_H)" -I "$(SET)" -D "USER_ZZSYN" -D "PC" \
+ -D "ZZLEXBUFSIZE=65536" /D "LONGFILENAMES" /W3 /Zi \
+ /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
+
+DLG_OBJS = dlg_p.obj dlg_a.obj main.obj err.obj support.obj \
+ output.obj relabel.obj automata.obj
+
+SUPPORT_OBJS = set.obj
+
+# Dependencies
+
+$(EDK_TOOLS_PATH)\Bin\Win32\dlg.exe: $(DLG_OBJS) $(SUPPORT_OBJS)
+ $(CC) $(CFLAGS) -Fedlg.exe $(DLG_OBJS) $(SUPPORT_OBJS)
+ -@if not exist $(EDK_TOOLS_PATH)\Bin\Win32 mkdir $(EDK_TOOLS_PATH)\Bin\Win32
+ copy dlg.exe $(EDK_TOOLS_PATH)\Bin\Win32
+
+dlg_p.obj: $(DLG_SRC)\dlg_p.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+ $(DLG_SRC)\mode.h \
+ $(DLG_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\dlg_p.c
+
+dlg_a.obj: $(DLG_SRC)\dlg_a.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgauto.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+ $(DLG_SRC)\mode.h \
+ $(DLG_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\dlg_a.c
+
+main.obj: $(DLG_SRC)\main.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+ $(DLG_SRC)\mode.h \
+ $(DLG_SRC)\stdpccts.h \
+ $(DLG_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\main.c
+
+err.obj: $(DLG_SRC)\err.c \
+ $(PCCTS_H)\antlr.h \
+ $(PCCTS_H)\config.h \
+ $(PCCTS_H)\dlgdef.h \
+ $(PCCTS_H)\err.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+ $(DLG_SRC)\tokens.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\err.c
+
+support.obj: $(DLG_SRC)\support.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\support.c
+
+output.obj: $(DLG_SRC)\output.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\output.c
+
+relabel.obj: $(DLG_SRC)\relabel.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\relabel.c
+
+automata.obj: $(DLG_SRC)\automata.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+ $(DLG_SRC)\dlg.h \
+
+ $(CC) -c $(CFLAGS) $(DLG_SRC)\automata.c
+
+
+set.obj: $(SET)\set.c \
+ $(PCCTS_H)\config.h \
+ $(SET)\set.h \
+
+ $(CC) -c $(CFLAGS) $(SET)\set.c
+
+clean:
+ -del *.obj
+ -del *.ilk
+ -del *.pdb
+
+cleanall:
+ -del *.obj
+ -del *.ilk
+ -del *.pdb
+ -del *.exe
+ -del $(EDK_TOOLS_PATH)\Bin\Win32\dlg.exe
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/DlgPPC.mak b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/DlgPPC.mak
new file mode 100644
index 000000000..55b643ad8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/DlgPPC.mak
@@ -0,0 +1,84 @@
+# File: dlgPPC.make
+# Target: dlgPPC
+# Sources: automata.c
+# dlg_a.c
+# dlg_p.c
+# err.c
+# main.c
+# output.c
+# relabel.c
+# support.c
+# ::support:set:set.c
+# Created: Sunday, May 17, 1998 11:34:20 PM
+# Author: Kenji Tanaka
+
+
+MAKEFILE = dlgPPC.make
+¥MondoBuild¥ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified
+Includes = ¶
+ -i "::h:" ¶
+ -i "::support:set:"
+Sym¥PPC =
+ObjDir¥PPC = ":Obj:"
+
+PPCCOptions = {Includes} {Sym¥PPC} -w off -d MPW -d __STDC__=1 -d USER_ZZSYN
+
+Objects¥PPC = ¶
+ "{ObjDir¥PPC}automata.c.x" ¶
+ "{ObjDir¥PPC}dlg_a.c.x" ¶
+ "{ObjDir¥PPC}dlg_p.c.x" ¶
+ "{ObjDir¥PPC}err.c.x" ¶
+ "{ObjDir¥PPC}main.c.x" ¶
+ "{ObjDir¥PPC}output.c.x" ¶
+ "{ObjDir¥PPC}relabel.c.x" ¶
+ "{ObjDir¥PPC}support.c.x" ¶
+ "{ObjDir¥PPC}set.c.x"
+
+
+dlgPPC ÄÄ {¥MondoBuild¥} {Objects¥PPC}
+ PPCLink ¶
+ -o {Targ} {Sym¥PPC} ¶
+ {Objects¥PPC} ¶
+ -t 'MPST' ¶
+ -c 'MPS ' ¶
+ "{SharedLibraries}InterfaceLib" ¶
+ "{SharedLibraries}StdCLib" ¶
+ "{SharedLibraries}MathLib" ¶
+ "{PPCLibraries}StdCRuntime.o" ¶
+ "{PPCLibraries}PPCCRuntime.o" ¶
+ "{PPCLibraries}PPCToolLibs.o"
+
+
+"{ObjDir¥PPC}automata.c.x" Ä {¥MondoBuild¥} automata.c
+ {PPCC} automata.c -o {Targ} {PPCCOptions}
+
+"{ObjDir¥PPC}dlg_a.c.x" Ä {¥MondoBuild¥} dlg_a.c
+ {PPCC} dlg_a.c -o {Targ} {PPCCOptions}
+
+"{ObjDir¥PPC}dlg_p.c.x" Ä {¥MondoBuild¥} dlg_p.c
+ {PPCC} dlg_p.c -o {Targ} {PPCCOptions}
+
+"{ObjDir¥PPC}err.c.x" Ä {¥MondoBuild¥} err.c
+ {PPCC} err.c -o {Targ} {PPCCOptions}
+
+"{ObjDir¥PPC}main.c.x" Ä {¥MondoBuild¥} main.c
+ {PPCC} main.c -o {Targ} {PPCCOptions}
+
+"{ObjDir¥PPC}output.c.x" Ä {¥MondoBuild¥} output.c
+ {PPCC} output.c -o {Targ} {PPCCOptions}
+
+"{ObjDir¥PPC}relabel.c.x" Ä {¥MondoBuild¥} relabel.c
+ {PPCC} relabel.c -o {Targ} {PPCCOptions}
+
+"{ObjDir¥PPC}support.c.x" Ä {¥MondoBuild¥} support.c
+ {PPCC} support.c -o {Targ} {PPCCOptions}
+
+"{ObjDir¥PPC}set.c.x" Ä {¥MondoBuild¥} "::support:set:set.c"
+ {PPCC} "::support:set:set.c" -o {Targ} {PPCCOptions}
+
+
+dlgPPC ÄÄ dlg.r
+ Rez dlg.r -o dlgPPC -a
+
+Install Ä dlgPPC
+ Duplicate -y dlgPPC "{MPW}"Tools:dlg
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/automata.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/automata.c
new file mode 100644
index 000000000..2d473ec8b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/automata.c
@@ -0,0 +1,353 @@
+/* Automata conversion functions for DLG
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * DLG 1.33
+ * Will Cohen
+ * With mods by Terence Parr; AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include "pcctscfg.h"
+#include "dlg.h"
+#ifdef MEMCHK
+#include "trax.h"
+#else
+#ifdef __STDC__
+#include <stdlib.h>
+#else
+#include <malloc.h>
+#endif /* __STDC__ */
+#endif
+
+#define hash_list struct _hash_list_
+hash_list{
+ hash_list *next; /* next thing in list */
+ dfa_node *node;
+ };
+
+int dfa_allocated = 0; /* keeps track of number of dfa nodes */
+dfa_node **dfa_array; /* root of binary tree that stores dfa array */
+dfa_node *dfa_model_node;
+hash_list *dfa_hash[HASH_SIZE]; /* used to quickly find */
+ /* desired dfa node */
+
+void
+#ifdef __USE_PROTOS
+make_dfa_model_node(int width)
+#else
+make_dfa_model_node(width)
+int width;
+#endif
+{
+ register int i;
+ dfa_model_node = (dfa_node*) malloc(sizeof(dfa_node)
+ + sizeof(int)*width);
+ dfa_model_node->node_no = -1; /* impossible value for real dfa node */
+ dfa_model_node->dfa_set = 0;
+ dfa_model_node->alternatives = FALSE;
+ dfa_model_node->done = FALSE;
+ dfa_model_node->nfa_states = empty;
+ for(i = 0; i<width; i++){
+ dfa_model_node->trans[i] = NIL_INDEX;
+ }
+}
+
+
+/* adds a new nfa to the binary tree and returns a pointer to it */
+dfa_node *
+#ifdef __USE_PROTOS
+new_dfa_node(set nfa_states)
+#else
+new_dfa_node(nfa_states)
+set nfa_states;
+#endif
+{
+ register int j;
+ register dfa_node *t;
+ static int dfa_size=0; /* elements dfa_array[] can hold */
+
+ ++dfa_allocated;
+ if (dfa_size<=dfa_allocated){
+ /* need to redo array */
+ if (!dfa_array){
+ /* need some to do initial allocation */
+ dfa_size=dfa_allocated+DFA_MIN;
+ dfa_array=(dfa_node **) malloc(sizeof(dfa_node*)*
+ dfa_size);
+ }else{
+ /* need more space */
+ dfa_size=2*(dfa_allocated+1);
+ dfa_array=(dfa_node **) realloc(dfa_array,
+ sizeof(dfa_node*)*dfa_size);
+ }
+ }
+ /* fill out entry in array */
+ t = (dfa_node*) malloc(sizeof(nfa_node)+sizeof(int)*class_no);
+ *t = *dfa_model_node;
+ for (j=0; j<class_no; ++j)
+ t->trans[j] = NIL_INDEX;
+ t->node_no = dfa_allocated;
+ t->nfa_states = set_dup(nfa_states);
+ dfa_array[dfa_allocated] = t;
+ return t;
+}
+
+
+/* past a pointer to the start of the nfa graph
+ * nfa_to_dfa convers this graph to dfa. The function returns
+ * a pointer to the first dfa state.
+ * NOTE: The function that prints out the table will have to figure out how
+ * to find the other dfa states given the first dfa_state and the number of dfa
+ * nodes allocated
+ */
+dfa_node **
+#ifdef __USE_PROTOS
+nfa_to_dfa(nfa_node *start)
+#else
+nfa_to_dfa(start)
+nfa_node *start;
+#endif
+{
+ register dfa_node *d_state, *trans_d_state;
+ register int a;
+ set t;
+ int last_done;
+ unsigned *nfa_list;
+ unsigned *reach_list;
+
+ reach_list = (unsigned *) malloc((2+nfa_allocated)*sizeof(unsigned));
+ if (!start) return NULL;
+ t = set_of(NFA_NO(start));
+ _set_pdq(t,reach_list);
+ closure(&t,reach_list);
+ /* Make t a dfa state */
+ d_state = dfastate(t);
+ last_done = DFA_NO(d_state);
+
+ do {
+ /* Mark dfa state x as "done" */
+ d_state->done = TRUE;
+ nfa_list = set_pdq(d_state->nfa_states);
+ for (a = 0; a<class_no; ++a) {
+ /* Add NFA states reached by a from d_state */
+ reach(nfa_list,a,reach_list);
+ /* Were any states found? */
+ if ((*reach_list)!=nil) {
+ /* was t=empty; */
+ set_free(t);
+ /* yes, compute closure */
+ closure(&t,reach_list);
+ /* Make DFA state of it ... */
+ trans_d_state = dfastate(t);
+ /* And make transition x->t, labeled with a */
+ d_state->trans[a] = DFA_NO(trans_d_state);
+ d_state->alternatives = TRUE;
+ }
+ }
+ free(nfa_list);
+ ++last_done; /* move forward in queue */
+ /* And so forth until nothing isn't done */
+ d_state = DFA(last_done);
+ } while (last_done<=dfa_allocated);
+
+ free(reach_list);
+ set_free(t);
+
+ /* returns pointer to the array that holds the automaton */
+ return dfa_array;
+}
+
+void
+#ifdef __USE_PROTOS
+clear_hash(void)
+#else
+clear_hash()
+#endif
+{
+ register int i;
+
+ for(i=0; i<HASH_SIZE; ++i)
+ dfa_hash[i] = 0;
+}
+
+#if HASH_STAT
+void
+#ifdef __USE_PROTOS
+fprint_hash_stats(FILE *f)
+#else
+fprint_hash_stats(f)
+FILE *f;
+#endif
+{
+ register hash_list *p;
+ register int i,j;
+ register total;
+
+ total=0;
+ for(i=0; i<HASH_SIZE; ++i){
+ j=0;
+ p = dfa_hash[i];
+ while(p){
+ ++j;
+ p = p->next;
+ }
+ total+=j;
+ fprintf(f,"bin[%d] has %d\n",i,j);
+ }
+ fprintf(f,"total = %d\n",total);
+}
+#endif
+
+/* Returns a pointer to a dfa node that has the same nfa nodes in it.
+ * This may or may not be a newly created node.
+ */
+dfa_node *
+#ifdef __USE_PROTOS
+dfastate(set nfa_states)
+#else
+dfastate(nfa_states)
+set nfa_states;
+#endif
+{
+ register hash_list *p;
+ int bin;
+
+ /* hash using set and see if it exists */
+ bin = set_hash(nfa_states,HASH_SIZE);
+ p = dfa_hash[bin];
+ while(p && !set_equ(nfa_states,(p->node)->nfa_states)){
+ p = p->next;
+ }
+ if(!p){
+ /* next state to add to hash table */
+ p = (hash_list*)malloc(sizeof(hash_list));
+ p->node = new_dfa_node(nfa_states);
+ p->next = dfa_hash[bin];
+ dfa_hash[bin] = p;
+ }
+ return (p->node);
+}
+
+
+/* this reach assumes the closure has been done already on set */
+int
+#ifdef __USE_PROTOS
+reach(unsigned *nfa_list, register int a, unsigned *reach_list)
+#else
+reach(nfa_list, a, reach_list)
+unsigned *nfa_list;
+register int a;
+unsigned *reach_list;
+#endif
+{
+ register unsigned *e;
+ register nfa_node *node;
+ int t=0;
+
+ e = nfa_list;
+ if (e){
+ while (*e != nil){
+ node = NFA(*e);
+ if (set_el(a,node->label)){
+ t=1;
+ *reach_list=NFA_NO(node->trans[0]);
+ ++reach_list;
+ }
+ ++e;
+ }
+ }
+ *reach_list=nil;
+ return t;
+}
+
+/* finds all the nodes that can be reached by epsilon transitions
+ from the set of a nodes and returns puts them back in set b */
+set
+#ifdef __USE_PROTOS
+closure(set *b, unsigned *reach_list)
+#else
+closure(b, reach_list)
+set *b;
+unsigned *reach_list;
+#endif
+{
+ register nfa_node *node,*n; /* current node being examined */
+ register unsigned *e;
+
+ ++operation_no;
+#if 0
+ t = e = set_pdq(*b);
+#else
+ e=reach_list;
+#endif
+ while (*e != nil){
+ node = NFA(*e);
+ set_orel(NFA_NO(node),b);
+ /* mark it done */
+ node->nfa_set = operation_no;
+ if ((n=node->trans[0]) != NIL_INDEX && set_nil(node->label) &&
+ (n->nfa_set != operation_no)){
+ /* put in b */
+ set_orel(NFA_NO(n),b);
+ close1(n,operation_no,b);
+ }
+ if ((n=node->trans[1]) != NIL_INDEX &&
+ (n->nfa_set != operation_no)){
+ /* put in b */
+ set_orel(NFA_NO(node->trans[1]),b);
+ close1(n,operation_no,b);
+ }
+ ++e;
+ }
+#if 0
+ free(t);
+#endif
+ return *b;
+}
+
+#ifdef __USE_PROTOS
+void close1(nfa_node *node, int o, set *b)
+#else
+void close1(node,o,b)
+nfa_node *node;
+int o; /* marker to avoid cycles */
+set *b;
+#endif
+{
+ register nfa_node *n; /* current node being examined */
+
+ /* mark it done */
+ node->nfa_set = o;
+ if ((n=node->trans[0]) != NIL_INDEX && set_nil(node->label) &&
+ (n->nfa_set != o)){
+ /* put in b */
+ set_orel(NFA_NO(n),b);
+ close1(n,o,b);
+ }
+ if ((n=node->trans[1]) != NIL_INDEX &&
+ (n->nfa_set != o)){
+ /* put in b */
+ set_orel(NFA_NO(node->trans[1]),b);
+ close1(n,o,b);
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg.1 b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg.1
new file mode 100644
index 000000000..f68e3ae8a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg.1
@@ -0,0 +1,79 @@
+.TH dlg 1 "April 1994" "DLG" "PCCTS Manual Pages"
+.SH NAME
+dlg \- DFA Lexical Analyzer Generator
+.SH SYNTAX
+.LP
+\fBdlg\fR [\fIoptions\fR] \fIlexical_spec\fR [\fIoutput_file\fR]
+.SH DESCRIPTION
+.B dlg
+is a tool that produces fast deterministic finite automata for recognizing
+regular expressions in input.
+.SH OPTIONS
+.IP "\fB-CC\fR"
+Generate C++ output. The \fIoutput_file\fP is not specified in this
+case.
+.IP "\fB-C\fR[\fP level\fR]
+Where \fPlevel\fR is the compression level used. 0 indications no
+compression, 1 removes all unused characters from the transition from table,
+and 2 maps equivalent characters into the same character classes. It is
+suggested that level -C2 is used, since it will significantly reduce the size
+of the dfa produced for lexical analyzer.
+.IP "\fB-m\fP
+Produces the header file for the lexical mode with a name other than
+the default name of "mode.h".
+.IP \fB-i\fP
+An interactive, or as interactive as possible, parser is produced. A character
+is only obtained when required to decide which state to go to. Some care
+must be taken to obtain accept states that do not require look ahead at the
+next character to determine if that is the stop state. Any regular expression
+with a Kleene closure at the end is guaranteed to require another character
+of look ahead.
+.IP "\fB-cl\fP class
+Specify a class name for DLG to generate. The default is DLGLexer.
+'class' will be a subclass of DLGLexerBase; only used for -CC.
+.IP \fB-ci\fP
+The automaton will treat upper and lower case characters identically.
+This is accomplished in the automaton; the characters in the lexical
+buffer are unmodified.
+.IP \fB-cs\fP
+Upper and lower case characters are treated as distinct. This is the
+default.
+.IP "\fB-o\fP dir
+Directory where output files should go (default="."). This is very
+nice for keeping the source directory clear of ANTLR and DLG spawn.
+.IP \fB-Wambiguity\fP
+Warns if more than one regular expression could match the same character
+sequence. The warnings give the numbers of the expressions in the dlg
+lexical specification file. The numbering of the expressions starts at one.
+Multiple warnings may be print for the same expressions.
+.IP \-
+Used in place of file names to get input from standard in or send output
+to standard out.
+.SH "SPECIAL CONSIDERATIONS"
+.PP
+\fIDlg\fP works... we think. There is no implicit guarantee of
+anything. We reserve no \fBlegal\fP rights to the software known as
+the Purdue Compiler Construction Tool Set (PCCTS) \(em PCCTS is in the
+public domain. An individual or company may do whatever they wish
+with source code distributed with PCCTS or the code generated by
+PCCTS, including the incorporation of PCCTS, or its output, into
+commercial software. We encourage users to develop software with
+PCCTS. However, we do ask that credit is given to us for developing
+PCCTS. By "credit", we mean that if you incorporate our source code
+into one of your programs (commercial product, research project, or
+otherwise) that you acknowledge this fact somewhere in the
+documentation, research report, etc... If you like PCCTS and have
+developed a nice tool with the output, please mention that you
+developed it using PCCTS. As long as these guidelines are followed, we
+expect to continue enhancing this system and expect to make other
+tools available as they are completed.
+.SH FILES
+.B mode.h
+,
+.B dlgauto.h
+,
+.B dlgdef.h
+.SH SEE ALSO
+.BR antlr (1),
+.BR pccts (1)
+.SH BUGS
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg.h
new file mode 100644
index 000000000..97d1718c7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg.h
@@ -0,0 +1,250 @@
+/* dlg header file
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * DLG 1.33
+ * Will Cohen
+ * With mods by Terence Parr; AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+/* MR1 Move pcctscfg.h to top of file */
+
+#include "pcctscfg.h"
+
+/* turn off warnings for unreferenced labels */
+
+#ifdef _MSC_VER
+#pragma warning(disable:4102)
+#endif
+
+#include "set.h"
+
+#define TRUE 1
+#define FALSE 0
+
+/***** output related stuff *******************/
+#define IN input_stream
+#define OUT output_stream
+
+#define MAX_MODES 50 /* number of %%names allowed */
+#define MAX_ON_LINE 10
+
+#define NFA_MIN 64 /* minimum nfa_array size */
+#define DFA_MIN 64 /* minimum dfa_array size */
+
+#define DEFAULT_CLASSNAME "DLGLexer"
+
+/* these macros allow the size of the character set to be easily changed */
+/* NOTE: do NOT change MIN_CHAR since EOF is the lowest char, -1 */
+#define MIN_CHAR (-1) /* lowest possible character possible on input */
+#define MAX_CHAR 255 /* highest possible character possible on input */
+#define CHAR_RANGE (1+(MAX_CHAR) - (MIN_CHAR))
+
+/* indicates that the not an "array" reference */
+#define NIL_INDEX 0
+
+/* size of hash table used to find dfa_states quickly */
+#define HASH_SIZE 211
+
+#define nfa_node struct _nfa_node
+nfa_node {
+ int node_no;
+ int nfa_set;
+ int accept; /* what case to use */
+ nfa_node *trans[2];
+ set label; /* one arc always labelled with epsilon */
+};
+
+#define dfa_node struct _dfa_node
+dfa_node {
+ int node_no;
+ int dfa_set;
+ int alternatives; /* used for interactive mode */
+ /* are more characters needed */
+ int done;
+ set nfa_states;
+ int trans[1];/* size of transition table depends on
+ * number of classes required for automata.
+ */
+
+
+};
+
+/******** macros for accessing the NFA and DFA nodes ****/
+#define NFA(x) (nfa_array[x])
+#define DFA(x) (dfa_array[x])
+#define DFA_NO(x) ( (x) ? (x)->node_no : NIL_INDEX)
+#define NFA_NO(x) ( (x) ? (x)->node_no : NIL_INDEX)
+
+/******** wrapper for memory checking ***/
+/*#define malloc(x) dlg_malloc((x),__FILE__,__LINE__)*/
+
+/*#define calloc(x,y) dlg_calloc((x),(y),__FILE__,__LINE__)*/
+
+/******** antlr attributes *************/
+typedef struct {
+ unsigned char letter;
+ nfa_node *l,*r;
+ set label;
+ } Attrib;
+
+#define zzcr_attr(attr, token, text) { \
+ (attr)->letter = text[0]; (attr)->l = NULL; \
+ (attr)->r = NULL; (attr)->label = empty; \
+}
+#define zzd_attr(a) set_free((a)->label);
+
+/******************** Variable ******************************/
+extern char program[]; /* tells what program this is */
+extern char version[]; /* tells what version this is */
+extern char *file_str[]; /* file names being used */
+extern int err_found; /* flag to indicate error occurred */
+extern int action_no; /* last action function printed */
+extern int func_action; /* should actions be turned into functions?*/
+extern set used_chars; /* used to label trans. arcs */
+extern set used_classes; /* classes or chars used to label trans. arcs */
+extern int class_no; /* number of classes used */
+extern set class_sets[]; /* shows char. in each class */
+extern set normal_chars; /* mask off unused portion of set */
+extern int comp_level; /* what compression level to use */
+extern int interactive; /* interactive scanner (avoid lookahead)*/
+extern int mode_counter; /* keeps track of the number of %%name */
+extern int dfa_basep[]; /* start of each group of dfa */
+extern int dfa_class_nop[];/* number of transition arcs in */
+ /* each dfa in each mode */
+extern int nfa_allocated;
+extern int dfa_allocated;
+extern nfa_node **nfa_array; /* start of nfa "array" */
+extern dfa_node **dfa_array; /* start of dfa "array" */
+extern int operation_no; /* unique number for each operation */
+extern FILE *input_stream; /* where description read from */
+extern FILE *output_stream; /* where to put the output */
+extern FILE *mode_stream; /* where to put the mode output */
+extern FILE *class_stream;
+extern char *mode_file; /* name of file for mode output */
+extern int gen_ansi; /* produce ansi compatible code */
+extern int case_insensitive;/* ignore case of input spec. */
+extern int warn_ambig; /* show if regular expressions ambiguous */
+extern int gen_cpp;
+extern char *cl_file_str;
+extern int firstLexMember; /* MR1 */
+extern char *OutputDirectory;
+extern char *class_name;
+
+/******************** Functions ******************************/
+#ifdef __USE_PROTOS
+extern char *dlg_malloc(int, char *, int); /* wrapper malloc */
+extern char *dlg_calloc(int, int, char *, int); /* wrapper calloc */
+extern int reach(unsigned *, register int, unsigned *);
+extern set closure(set *, unsigned *);
+extern dfa_node *new_dfa_node(set);
+extern nfa_node *new_nfa_node(void);
+extern dfa_node *dfastate(set);
+extern dfa_node **nfa_to_dfa(nfa_node *);
+extern void internal_error(char *, char *, int); /* MR9 23-Sep-97 */
+extern FILE *read_stream(char *); /* opens file for reading */
+extern FILE *write_stream(char *); /* opens file for writing */
+extern void make_nfa_model_node(void);
+extern void make_dfa_model_node(int);
+extern char *ClassName(char *);
+extern char *OutMetaName(char *);
+extern void error(char*, int);
+extern void warning(char*, int);
+extern void p_head(void);
+extern void p_class_hdr(void);
+extern void p_includes(void);
+extern void p_tables(void);
+extern void p_tail(void); /* MR1 */
+extern void p_class_def1(void); /* MR1 */
+extern void new_automaton_mode(void); /* MR1 */
+extern int relabel(nfa_node *,int); /* MR1 */
+extern void p_shift_table(int); /* MR1 */
+extern void p_bshift_table(void); /* MR1 */
+extern void p_class_table(void); /* MR1 */
+extern void p_mode_def(char *,int); /* MR1 */
+extern void init(void); /* MR1 */
+extern void p_class_def2(void); /* MR1 */
+extern void clear_hash(void); /* MR1 */
+extern void p_alternative_table(void); /* MR1 */
+extern void p_node_table(void); /* MR1 */
+extern void p_dfa_table(void); /* MR1 */
+extern void p_accept_table(void); /* MR1 */
+extern void p_action_table(void); /* MR1 */
+extern void p_base_table(void); /* MR1 */
+extern void p_single_node(int,int); /* MR1 */
+extern char * minsize(int); /* MR1 */
+extern void close1(nfa_node *,int,set *); /* MR1 */
+extern void partition(nfa_node *,int); /* MR1 */
+extern void intersect_nfa_labels(nfa_node *,set *); /* MR1 */
+extern void r_intersect(nfa_node *,set *); /* MR1 */
+extern void label_node(nfa_node *); /* MR1 */
+extern void label_with_classes(nfa_node *); /* MR1 */
+
+#else
+extern char *dlg_malloc(); /* wrapper malloc */
+extern char *dlg_calloc(); /* wrapper calloc */
+extern int reach();
+extern set closure();
+extern dfa_node *new_dfa_node();
+extern nfa_node *new_nfa_node();
+extern dfa_node *dfastate();
+extern dfa_node **nfa_to_dfa();
+extern void internal_error(); /* MR9 23-Sep-97 */
+extern FILE *read_stream(); /* opens file for reading */
+extern FILE *write_stream(); /* opens file for writing */
+extern void make_nfa_model_node();
+extern void make_dfa_model_node();
+extern char *ClassName();
+extern char *OutMetaName();
+extern void error();
+extern void warning();
+extern void p_head(); /* MR9 */
+extern void p_class_hdr(); /* MR9 */
+extern void p_includes(); /* MR9 */
+extern void p_tables(); /* MR9 */
+extern void p_tail(); /* MR1 */
+extern void p_class_def1(); /* MR1 */
+extern void new_automaton_mode(); /* MR1 */
+extern int relabel(); /* MR1 */
+extern void p_shift_table(); /* MR1 */
+extern void p_bshift_table(); /* MR1 */
+extern void p_class_table(); /* MR1 */
+extern void p_mode_def(); /* MR1 */
+extern void init(); /* MR1 */
+extern void p_class_def2(); /* MR1 */
+extern void clear_hash(); /* MR1 */
+extern void p_alternative_table(); /* MR1 */
+extern void p_node_table(); /* MR1 */
+extern void p_dfa_table(); /* MR1 */
+extern void p_accept_table(); /* MR1 */
+extern void p_action_table(); /* MR1 */
+extern void p_base_table(); /* MR1 */
+extern void p_single_node(); /* MR1 */
+extern char * minsize(); /* MR1 */
+extern void close1(); /* MR1 */
+extern void partition(); /* MR1 */
+extern void intersect_nfa_labels(); /* MR1 */
+extern void r_intersect(); /* MR1 */
+extern void label_node(); /* MR1 */
+extern void label_with_classes(); /* MR1 */
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg.r b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg.r
new file mode 100644
index 000000000..c88c15131
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg.r
@@ -0,0 +1,270 @@
+/*
+ File: dlgMPW.r
+ Target: dlg 133MR
+ Created: Monday, June 15, 1998 4:44:11 AM
+ Author: Kenji Tanaka (kentar@osa.att.ne.jp)
+*/
+
+#include "cmdo.r"
+
+resource 'cmdo' (128, "Dlg") {
+ { /* array dialogs: 1 elements */
+ /* [1] */
+ 295,
+ "DLG -- Purdue Compiler Construction Tool"
+ " Set (PCCTS) lexical analyzer generator.",
+ { /* array itemArray: 18 elements */
+ /* [1] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {35, 175, 50, 225},
+ "On",
+ "-CC",
+ "When this control is checked, DLG generates "
+ "a scanner using C++ classes rather than "
+ "C functions."
+ },
+ /* [2] */
+ Or {
+ { /* array OrArray: 1 elements */
+ /* [1] */
+ 1
+ }
+ },
+ RegularEntry {
+ "Lexer Class Name:",
+ {35, 225, 50, 355},
+ {35, 355, 51, 450},
+ "DLGLexer",
+ keepCase,
+ "-cl",
+ "This entry specifies the name DLG uses for the C++ lexer class."
+ },
+ /* [3] */
+ NotDependent {
+
+ },
+ TextBox {
+ gray,
+ {25, 165, 60, 460},
+ "C++ Code Generation"
+ },
+ /* [4] */
+ NotDependent {
+
+ },
+ Files {
+ InputFile,
+ RequiredFile {
+ {37, 25, 56, 135},
+ "Input File",
+ "",
+ "Choose the lexical description file for "
+ "DLG to process."
+ },
+ Additional {
+ "",
+ "",
+ "",
+ "",
+ { /* array TypesArray: 1 elements */
+ /* [1] */
+ text
+ }
+ }
+ },
+ /* [5] */
+ Or {
+ { /* array OrArray: 1 elements */
+ /* [1] */
+ -1
+ }
+ },
+ Files {
+ OutputFile,
+ RequiredFile {
+ {66, 25, 85, 135},
+ "Output File",
+ "",
+ "Choose the name of the file that will hold the DLG-produced scanner."
+ },
+ NoMore {
+
+ }
+ },
+ /* [6] */
+ Or {
+ { /* array OrArray: 2 elements */
+ /* [1] */
+ 1,
+ /* [2] */
+ 5
+ }
+ },
+ Dummy {
+
+ },
+ /* [7] */
+ NotDependent {
+
+ },
+ Redirection {
+ DiagnosticOutput,
+ {90, 25}
+ },
+ /* [8] */
+ NotDependent {
+
+ },
+ TextBox {
+ gray,
+ {25, 20, 132, 145},
+ "Files"
+ },
+ /* [9] */
+ NotDependent {
+
+ },
+ Files {
+ DirOnly,
+ OptionalFile {
+ {68, 175, 84, 305},
+ {88, 175, 107, 305},
+ "Output Directory",
+ ":",
+ "-o",
+ "",
+ "Choose the directory where DLG will put "
+ "its output.",
+ dim,
+ "Output DirectoryI",
+ "",
+ ""
+ },
+ NoMore {
+
+ }
+ },
+ /* [10] */
+ NotDependent {
+
+ },
+ RegularEntry {
+ "Mode File Name:",
+ {68, 315, 83, 450},
+ {88, 315, 104, 450},
+ "mode.h",
+ keepCase,
+ "-m",
+ "This entry specifies the name DLG uses for its lexical mode output file."
+ },
+ /* [11] */
+ NotDependent {
+
+ },
+ RadioButtons {
+ { /* array radioArray: 3 elements */
+ /* [1] */
+ {134, 175, 149, 255}, "None", "", Set, "When this option is selected, DLG will not "
+ "compress its tables.",
+ /* [2] */
+ {134, 265, 149, 345}, "Level 1", "-C1", NotSet, "When this option is selected, DLG will "
+ "remove all unused characters from the transition-from table.",
+ /* [3] */
+ {134, 360, 149, 450}, "Level 2", "-C2", NotSet, "When this option is selected, DLG will "
+ "perform level 1 compression plus it will "
+ "map equivalent characters into the same "
+ "character classes."
+ }
+ },
+ /* [12] */
+ NotDependent {
+
+ },
+ TextBox {
+ gray,
+ {124, 165, 156, 460},
+ "Table Compression"
+ },
+ /* [13] */
+ NotDependent {
+
+ },
+ CheckOption {
+ Set,
+ {165, 20, 180, 145},
+ "Case Sensitive",
+ "-ci",
+ "When this control is checked, the DLG automaton "
+ "will treat upper and lower case "
+ "characters identically."
+ },
+ /* [14] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {165, 150, 180, 300},
+ "Interactive Scanner",
+ "-i",
+ "When this control is checked, DLG will generate "
+ "as interactive a scanner as possible."
+ },
+ /* [15] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {165, 310, 180, 460},
+ "Ambiguity Warnings",
+ "-Wambiguity",
+ "When this control is checked, DLG warns "
+ "if more than one regular expression could "
+ "match the same character sequence."
+ },
+ /* [16] */
+ NotDependent {
+
+ },
+ VersionDialog {
+ VersionString {
+ "1.33MR"
+ },
+ "PCCTS was written by Terence Parr, Russell "
+ "Quong, Will Cohen, and Hank Dietz: 1989-1998. "
+ "MPW port by Scott Haney.",
+ noDialog
+ },
+ /* [17] */
+ And {
+ { /* array AndArray: 2 elements */
+ /* [1] */
+ 4,
+ /* [2] */
+ 6
+ }
+ },
+ DoItButton {
+
+ },
+ /* [18] */
+ NotDependent {
+
+ },
+ CheckOption {
+ NotSet,
+ {142, 20, 157, 148},
+ "Generate ANSI C",
+ "-ga",
+ "When this control is checked, DLG generates "
+ "ANSI C compatible code."
+ }
+ }
+ }
+};
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg1.txt b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg1.txt
new file mode 100644
index 000000000..06b320de2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg1.txt
@@ -0,0 +1,132 @@
+
+
+
+dlg(1) PCCTS Manual Pages dlg(1)
+
+
+
+NAME
+ dlg - DFA Lexical Analyzer Generator
+
+SYNTAX
+ dlg [_o_p_t_i_o_n_s] _l_e_x_i_c_a_l__s_p_e_c [_o_u_t_p_u_t__f_i_l_e]
+
+DESCRIPTION
+ dlg is a tool that produces fast deterministic finite auto-
+ mata for recognizing regular expressions in input.
+
+OPTIONS
+ -CC Generate C++ output. The _o_u_t_p_u_t__f_i_l_e is not specified
+ in this case.
+
+ -C[ level]
+ Where level is the compression level used. 0 indica-
+ tions no compression, 1 removes all unused characters
+ from the transition from table, and 2 maps equivalent
+ characters into the same character classes. It is sug-
+ gested that level -C2 is used, since it will signifi-
+ cantly reduce the size of the dfa produced for lexical
+ analyzer.
+
+ -m Produces the header file for the lexical mode with a
+ name other than the default name of "mode.h".
+
+ -i An interactive, or as interactive as possible, parser
+ is produced. A character is only obtained when
+ required to decide which state to go to. Some care
+ must be taken to obtain accept states that do not
+ require look ahead at the next character to determine
+ if that is the stop state. Any regular expression with
+ a Kleene closure at the end is guaranteed to require
+ another character of look ahead.
+
+ -cl class
+ Specify a class name for DLG to generate. The default
+ is DLGLexer.
+
+ -ci The automaton will treat upper and lower case charac-
+ ters identically. This is accomplished in the automa-
+ ton; the characters in the lexical buffer are unmodi-
+ fied.
+
+ -cs Upper and lower case characters are treated as dis-
+ tinct. This is the default.
+
+ -o dir
+ Directory where output files should go (default=".").
+ This is very nice for keeping the source directory
+ clear of ANTLR and DLG spawn.
+
+ -Wambiguity
+ Warns if more than one regular expression could match
+ the same character sequence. The warnings give the
+ numbers of the expressions in the dlg lexical specifi-
+ cation file. The numbering of the expressions starts
+ at one. Multiple warnings may be print for the same
+ expressions.
+
+ - Used in place of file names to get input from standard
+ in or send output to standard out.
+
+SPECIAL CONSIDERATIONS
+ _D_l_g works... we think. There is no implicit guarantee of
+ anything. We reserve no legal rights to the software known
+ as the Purdue Compiler Construction Tool Set (PCCTS) - PCCTS
+ is in the public domain. An individual or company may do
+ whatever they wish with source code distributed with PCCTS
+ or the code generated by PCCTS, including the incorporation
+ of PCCTS, or its output, into commercial software. We
+ encourage users to develop software with PCCTS. However, we
+ do ask that credit is given to us for developing PCCTS. By
+ "credit", we mean that if you incorporate our source code
+ into one of your programs (commercial product, research pro-
+ ject, or otherwise) that you acknowledge this fact somewhere
+ in the documentation, research report, etc... If you like
+ PCCTS and have developed a nice tool with the output, please
+ mention that you developed it using PCCTS. As long as these
+ guidelines are followed, we expect to continue enhancing
+ this system and expect to make other tools available as they
+ are completed.
+
+FILES
+ mode.h , dlgauto.h , dlgdef.h
+
+SEE ALSO
+ antlr(1), pccts(1)
+
+BUGS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg_a.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg_a.c
new file mode 100644
index 000000000..0b8982cf2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg_a.c
@@ -0,0 +1,1414 @@
+
+/* parser.dlg -- DLG Description of scanner
+ *
+ * Generated from: dlg_p.g
+ *
+ * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
+ * Purdue University Electrical Engineering
+ * With AHPCRC, University of Minnesota
+ * ANTLR Version 1.33MR33
+ */
+
+#define ANTLR_VERSION 13333
+#include "pcctscfg.h"
+#include "pccts_stdio.h"
+
+#include <ctype.h>
+#include "dlg.h"
+#include "antlr.h"
+#include "tokens.h"
+#include "dlgdef.h"
+LOOKAHEAD
+
+void
+#ifdef __USE_PROTOS
+zzerraction(void)
+#else
+zzerraction()
+#endif
+{
+ (*zzerr)("invalid token");
+ zzadvance();
+ zzskip();
+}
+/*
+ * D L G tables
+ *
+ * Generated from: parser.dlg
+ *
+ * 1989-2001 by Will Cohen, Terence Parr, and Hank Dietz
+ * Purdue University Electrical Engineering
+ * DLG Version 1.33MR33
+ */
+
+#include "mode.h"
+
+
+
+
+int func_action; /* should actions be turned into functions?*/
+int lex_mode_counter = 0; /* keeps track of the number of %%names */
+/* MR1 */
+/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
+/* MR1 via <<%%lexmember...>> */
+/* MR1 */
+int lexMember = 0; /* <<%%lexmemeber ...>> MR1 */
+int lexAction = 0; /* <<%%lexaction ...>> MR1 */
+int parserClass = 0; /* <<%%parserclass ...>> MR1 */
+int lexPrefix = 0; /* <<%%lexprefix ...>> MR1 */
+char theClassName[100]; /* MR11 */
+char *pClassName=theClassName; /* MR11 */
+int firstLexMember=1; /* MR1 */
+
+#ifdef __USE_PROTOS
+void xxputc(int c) { /* MR1 */
+#else
+ void xxputc(c) /* MR1 */
+ int c; /* MR1 */
+ { /* MR1 */
+#endif
+ if (parserClass) { /* MR1 */
+ *pClassName++=c; /* MR1 */
+ *pClassName=0; /* MR1 */
+ } else if (lexMember || lexPrefix) { /* MR1 */
+ if (class_stream != NULL) fputc(c,class_stream); /* MR1 */
+ } else { /* MR1 */
+ fputc(c,OUT); /* MR1 */
+ }; /* MR1 */
+ } /* MR1 */
+
+#ifdef __USE_PROTOS
+ void xxprintf(char *format,char *string) { /* MR1 */
+#else
+ void xxprintf(format,string) /* MR1 */
+ char *format; /* MR1 */
+ char *string; /* MR1 */
+ { /* MR1 */
+#endif
+ if (lexMember || lexPrefix || parserClass) { /* MR1 */
+ if (class_stream != NULL) /* MR1 */
+ fprintf(class_stream,format,string); /* MR1 */
+ } else { /* MR1 */
+ fprintf(OUT,format,string); /* MR1 */
+ }; /* MR1 */
+ } /* MR1 */
+
+static void act1()
+{
+ NLA = 1;
+ }
+
+
+static void act2()
+{
+ NLA = 2;
+ zzskip();
+ }
+
+
+static void act3()
+{
+ NLA = 3;
+ zzline++; zzskip(); DAWDLE;
+ }
+
+
+static void act4()
+{
+ NLA = L_EOF;
+ }
+
+
+static void act5()
+{
+ NLA = PER_PER;
+ }
+
+
+static void act6()
+{
+ NLA = NAME_PER_PER;
+ p_mode_def(&zzlextext[2],lex_mode_counter++);
+ }
+
+
+static void act7()
+{
+ NLA = LEXMEMBER;
+ lexMember=1; /* MR1 */
+ if (firstLexMember != 0) { /* MR1 */
+ firstLexMember=0; /* MR1 */
+ p_class_def1(); /* MR1 */
+ }; /* MR1 */
+ zzmode(ACT); /* MR1 */
+ }
+
+
+static void act8()
+{
+ NLA = LEXACTION;
+ lexAction=1;zzmode(ACT);
+ }
+
+
+static void act9()
+{
+ NLA = PARSERCLASS;
+ parserClass=1; /* MR1 */
+ zzmode(ACT); /* MR1 */
+ }
+
+
+static void act10()
+{
+ NLA = LEXPREFIX;
+ lexPrefix=1;zzmode(ACT);
+ }
+
+
+static void act11()
+{
+ NLA = ACTION;
+ if (func_action)
+ fprintf(OUT,"\n%s %sact%d()\n{ ",
+ gen_cpp?"ANTLRTokenType":"static void",
+ gen_cpp?ClassName("::"):"", ++action_no);
+ zzmode(ACT); zzskip();
+ }
+
+
+static void act12()
+{
+ NLA = GREAT_GREAT;
+ }
+
+
+static void act13()
+{
+ NLA = L_BRACE;
+ }
+
+
+static void act14()
+{
+ NLA = R_BRACE;
+ }
+
+
+static void act15()
+{
+ NLA = L_PAR;
+ }
+
+
+static void act16()
+{
+ NLA = R_PAR;
+ }
+
+
+static void act17()
+{
+ NLA = L_BRACK;
+ }
+
+
+static void act18()
+{
+ NLA = R_BRACK;
+ }
+
+
+static void act19()
+{
+ NLA = ZERO_MORE;
+ }
+
+
+static void act20()
+{
+ NLA = ONE_MORE;
+ }
+
+
+static void act21()
+{
+ NLA = OR;
+ }
+
+
+static void act22()
+{
+ NLA = RANGE;
+ }
+
+
+static void act23()
+{
+ NLA = NOT;
+ }
+
+
+static void act24()
+{
+ NLA = OCTAL_VALUE;
+ {int t; sscanf(&zzlextext[1],"%o",&t); zzlextext[0] = t;}
+ }
+
+
+static void act25()
+{
+ NLA = HEX_VALUE;
+ {int t; sscanf(&zzlextext[3],"%x",&t); zzlextext[0] = t;}
+ }
+
+
+static void act26()
+{
+ NLA = DEC_VALUE;
+ {int t; sscanf(&zzlextext[1],"%d",&t); zzlextext[0] = t;}
+ }
+
+
+static void act27()
+{
+ NLA = TAB;
+ zzlextext[0] = '\t';
+ }
+
+
+static void act28()
+{
+ NLA = NL;
+ zzlextext[0] = '\n';
+ }
+
+
+static void act29()
+{
+ NLA = CR;
+ zzlextext[0] = '\r';
+ }
+
+
+static void act30()
+{
+ NLA = BS;
+ zzlextext[0] = '\b';
+ }
+
+
+static void act31()
+{
+ NLA = CONTINUATION;
+ zzline++; zzskip();
+ }
+
+
+static void act32()
+{
+ NLA = LIT;
+ zzlextext[0] = zzlextext[1];
+ }
+
+
+static void act33()
+{
+ NLA = REGCHAR;
+ }
+
+static unsigned char shift0[257] = {
+ 0, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 1, 2, 40, 40, 1, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 1, 40, 40, 40, 40, 4, 40,
+ 40, 30, 31, 34, 35, 40, 37, 40, 40, 23,
+ 24, 24, 24, 24, 24, 24, 24, 25, 25, 40,
+ 40, 26, 40, 27, 40, 3, 21, 21, 21, 21,
+ 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 20,
+ 22, 22, 32, 39, 33, 40, 22, 40, 11, 9,
+ 12, 21, 6, 19, 22, 22, 14, 22, 22, 5,
+ 8, 16, 15, 17, 22, 10, 18, 13, 22, 22,
+ 22, 7, 22, 22, 28, 36, 29, 38, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40
+};
+
+
+static void act34()
+{
+ NLA = 1;
+ error("unterminated action", zzline); zzmode(START);
+ }
+
+
+static void act35()
+{
+ NLA = ACTION;
+ if (func_action) fprintf(OUT,"}\n\n");
+ zzmode(START);
+ /* MR1 */
+ /* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
+ /* MR1 via <<%%lexmember ...>> */
+ /* MR1 This is a consequence of not saving actions */
+ /* MR1 */
+ /* MR1 */ parserClass=0;
+ /* MR1 */ lexPrefix=0;
+ /* MR1 */ lexAction=0;
+ /* MR1 */ lexMember=0;
+ }
+
+
+static void act36()
+{
+ NLA = 34;
+ xxputc(zzlextext[0]); zzskip();
+ }
+
+
+static void act37()
+{
+ NLA = 35;
+ xxputc('>'); zzskip();
+ }
+
+
+static void act38()
+{
+ NLA = 36;
+ xxputc('\\'); zzskip();
+ }
+
+
+static void act39()
+{
+ NLA = 37;
+ xxputc(zzlextext[0]); ++zzline; zzskip();
+ }
+
+
+static void act40()
+{
+ NLA = 38;
+ zzmode(ACTION_COMMENTS); /* MR1 */
+ xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
+ }
+
+
+static void act41()
+{
+ NLA = 39;
+ zzmode(ACTION_CPP_COMMENTS); /* MR1 */
+ xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
+ }
+
+
+static void act42()
+{
+ NLA = 40;
+ xxputc(zzlextext[0]); zzskip();
+ }
+
+static unsigned char shift1[257] = {
+ 0, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 3, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 5, 6, 6, 6, 6, 4, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 1, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 2, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6
+};
+
+
+static void act43()
+{
+ NLA = 1;
+ }
+
+
+static void act44()
+{
+ NLA = 41;
+ zzmode(ACT); /* MR1 */
+ xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
+ }
+
+
+static void act45()
+{
+ NLA = 42;
+ zzline++; xxputc(zzlextext[0]); zzskip();
+ }
+
+
+static void act46()
+{
+ NLA = 43;
+ xxputc(zzlextext[0]); zzskip();
+ }
+
+static unsigned char shift2[257] = {
+ 0, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 3, 4, 4, 3, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 1, 4, 4, 4, 4, 2, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4
+};
+
+
+static void act47()
+{
+ NLA = 1;
+ }
+
+
+static void act48()
+{
+ NLA = 44;
+ zzmode(ACT); zzline++; /* MR1 */
+ xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
+ }
+
+
+static void act49()
+{
+ NLA = 45;
+ xxputc(zzlextext[0]); zzskip();
+ }
+
+static unsigned char shift3[257] = {
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 1, 2, 2, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2
+};
+
+#define DfaStates 94
+typedef unsigned char DfaState;
+
+static DfaState st0[42] = {
+ 1, 2, 3, 4, 5, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 6, 94
+};
+
+static DfaState st1[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st2[42] = {
+ 94, 21, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st3[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st4[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st5[42] = {
+ 94, 94, 94, 94, 22, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st6[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st7[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 23, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st8[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 24, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st9[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st10[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st11[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st12[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st13[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st14[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st15[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st16[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st17[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st18[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st19[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st20[42] = {
+ 94, 25, 26, 25, 25, 25, 25, 25, 25, 27,
+ 28, 25, 25, 29, 25, 25, 30, 25, 25, 25,
+ 25, 25, 25, 31, 32, 32, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 94
+};
+
+static DfaState st21[42] = {
+ 94, 21, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st22[42] = {
+ 94, 94, 94, 94, 94, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 33, 33, 33, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st23[42] = {
+ 94, 94, 94, 94, 34, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st24[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st25[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st26[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st27[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st28[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st29[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st30[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st31[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 35, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 35, 94, 94, 36, 36, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st32[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 37, 37, 37, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st33[42] = {
+ 94, 94, 94, 94, 94, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st34[42] = {
+ 94, 94, 94, 94, 39, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st35[42] = {
+ 94, 94, 94, 94, 94, 94, 40, 94, 94, 40,
+ 94, 40, 40, 94, 94, 94, 94, 94, 94, 40,
+ 94, 40, 94, 40, 40, 40, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st36[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 36, 36, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st37[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 37, 37, 37, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st38[42] = {
+ 94, 94, 94, 94, 94, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st39[42] = {
+ 94, 94, 94, 94, 94, 41, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 42, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st40[42] = {
+ 94, 94, 94, 94, 94, 94, 40, 94, 94, 40,
+ 94, 40, 40, 94, 94, 94, 94, 94, 94, 40,
+ 94, 40, 94, 40, 40, 40, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st41[42] = {
+ 94, 94, 94, 94, 94, 94, 43, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st42[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 44, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st43[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 45, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st44[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 46, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st45[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 47, 94,
+ 94, 48, 94, 94, 94, 94, 94, 49, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st46[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 50, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st47[42] = {
+ 94, 94, 94, 94, 94, 94, 51, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st48[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 52, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st49[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 53, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st50[42] = {
+ 94, 94, 94, 94, 94, 94, 54, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st51[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 55, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st52[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 56, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st53[42] = {
+ 94, 94, 94, 94, 94, 94, 57, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st54[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 58, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st55[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 59,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st56[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 60, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st57[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 61,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st58[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 62, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st59[42] = {
+ 94, 94, 94, 94, 94, 94, 63, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st60[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 64, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st61[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 65, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st62[42] = {
+ 94, 94, 94, 94, 94, 66, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st63[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 67, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st64[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 68, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st65[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 69, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st66[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 70, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st67[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st68[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st69[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st70[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 71, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st71[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 72, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st72[42] = {
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94
+};
+
+static DfaState st73[8] = {
+ 74, 75, 76, 77, 78, 79, 79, 94
+};
+
+static DfaState st74[8] = {
+ 94, 94, 94, 94, 94, 94, 94, 94
+};
+
+static DfaState st75[8] = {
+ 94, 80, 94, 94, 94, 94, 94, 94
+};
+
+static DfaState st76[8] = {
+ 94, 81, 94, 94, 94, 94, 94, 94
+};
+
+static DfaState st77[8] = {
+ 94, 94, 94, 94, 94, 94, 94, 94
+};
+
+static DfaState st78[8] = {
+ 94, 94, 94, 94, 82, 83, 94, 94
+};
+
+static DfaState st79[8] = {
+ 94, 94, 94, 94, 94, 94, 94, 94
+};
+
+static DfaState st80[8] = {
+ 94, 94, 94, 94, 94, 94, 94, 94
+};
+
+static DfaState st81[8] = {
+ 94, 94, 94, 94, 94, 94, 94, 94
+};
+
+static DfaState st82[8] = {
+ 94, 94, 94, 94, 94, 94, 94, 94
+};
+
+static DfaState st83[8] = {
+ 94, 94, 94, 94, 94, 94, 94, 94
+};
+
+static DfaState st84[6] = {
+ 85, 86, 87, 88, 87, 94
+};
+
+static DfaState st85[6] = {
+ 94, 94, 94, 94, 94, 94
+};
+
+static DfaState st86[6] = {
+ 94, 94, 89, 94, 94, 94
+};
+
+static DfaState st87[6] = {
+ 94, 94, 94, 94, 94, 94
+};
+
+static DfaState st88[6] = {
+ 94, 94, 94, 94, 94, 94
+};
+
+static DfaState st89[6] = {
+ 94, 94, 94, 94, 94, 94
+};
+
+static DfaState st90[4] = {
+ 91, 92, 93, 94
+};
+
+static DfaState st91[4] = {
+ 94, 94, 94, 94
+};
+
+static DfaState st92[4] = {
+ 94, 94, 94, 94
+};
+
+static DfaState st93[4] = {
+ 94, 94, 94, 94
+};
+
+
+DfaState *dfa[94] = {
+ st0,
+ st1,
+ st2,
+ st3,
+ st4,
+ st5,
+ st6,
+ st7,
+ st8,
+ st9,
+ st10,
+ st11,
+ st12,
+ st13,
+ st14,
+ st15,
+ st16,
+ st17,
+ st18,
+ st19,
+ st20,
+ st21,
+ st22,
+ st23,
+ st24,
+ st25,
+ st26,
+ st27,
+ st28,
+ st29,
+ st30,
+ st31,
+ st32,
+ st33,
+ st34,
+ st35,
+ st36,
+ st37,
+ st38,
+ st39,
+ st40,
+ st41,
+ st42,
+ st43,
+ st44,
+ st45,
+ st46,
+ st47,
+ st48,
+ st49,
+ st50,
+ st51,
+ st52,
+ st53,
+ st54,
+ st55,
+ st56,
+ st57,
+ st58,
+ st59,
+ st60,
+ st61,
+ st62,
+ st63,
+ st64,
+ st65,
+ st66,
+ st67,
+ st68,
+ st69,
+ st70,
+ st71,
+ st72,
+ st73,
+ st74,
+ st75,
+ st76,
+ st77,
+ st78,
+ st79,
+ st80,
+ st81,
+ st82,
+ st83,
+ st84,
+ st85,
+ st86,
+ st87,
+ st88,
+ st89,
+ st90,
+ st91,
+ st92,
+ st93
+};
+
+
+DfaState accepts[95] = {
+ 0, 1, 2, 3, 4, 33, 33, 33, 33, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 0, 2, 5, 11, 12, 32, 31, 30, 29, 27,
+ 28, 24, 26, 6, 0, 0, 24, 26, 6, 0,
+ 25, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 7, 8, 10,
+ 0, 0, 9, 0, 34, 36, 38, 39, 42, 42,
+ 35, 37, 41, 40, 0, 43, 46, 46, 45, 44,
+ 0, 47, 48, 49, 0
+};
+
+void (*actions[50])() = {
+ zzerraction,
+ act1,
+ act2,
+ act3,
+ act4,
+ act5,
+ act6,
+ act7,
+ act8,
+ act9,
+ act10,
+ act11,
+ act12,
+ act13,
+ act14,
+ act15,
+ act16,
+ act17,
+ act18,
+ act19,
+ act20,
+ act21,
+ act22,
+ act23,
+ act24,
+ act25,
+ act26,
+ act27,
+ act28,
+ act29,
+ act30,
+ act31,
+ act32,
+ act33,
+ act34,
+ act35,
+ act36,
+ act37,
+ act38,
+ act39,
+ act40,
+ act41,
+ act42,
+ act43,
+ act44,
+ act45,
+ act46,
+ act47,
+ act48,
+ act49
+};
+
+static DfaState dfa_base[] = {
+ 0,
+ 73,
+ 84,
+ 90
+};
+
+static unsigned char *b_class_no[] = {
+ shift0,
+ shift1,
+ shift2,
+ shift3
+};
+
+
+
+#define ZZSHIFT(c) (b_class_no[zzauto][1+c])
+#define MAX_MODE 4
+#include "dlgauto.h"
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg_p.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg_p.c
new file mode 100644
index 000000000..fbaf93afc
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg_p.c
@@ -0,0 +1,961 @@
+/*
+ * A n t l r T r a n s l a t i o n H e a d e r
+ *
+ * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
+ * Purdue University Electrical Engineering
+ * With AHPCRC, University of Minnesota
+ * ANTLR Version 1.33MR33
+ *
+ * ..\bin\antlr dlg_p.g -gh
+ *
+ */
+
+#define ANTLR_VERSION 13333
+#include "pcctscfg.h"
+#include "pccts_stdio.h"
+
+#include <ctype.h>
+#include "dlg.h"
+#define zzSET_SIZE 8
+#include "antlr.h"
+#include "tokens.h"
+#include "dlgdef.h"
+#include "mode.h"
+
+/* MR23 In order to remove calls to PURIFY use the antlr -nopurify option */
+
+#ifndef PCCTS_PURIFY
+#define PCCTS_PURIFY(r,s) memset((char *) &(r),'\0',(s));
+#endif
+
+ANTLR_INFO
+
+
+/* MR20 G. Hobbelt
+Fix for Borland C++ 4.x & 5.x compiling with ALL warnings enabled
+*/
+
+#ifdef __TURBOC__
+#pragma warn -aus /* unused assignment of 'xxx' */
+#endif
+
+#pragma clang diagnostic ignored "-Wparentheses-equality"
+
+int action_no = 0; /* keep track of actions outputted */
+int nfa_allocated = 0; /* keeps track of number of nfa nodes */
+nfa_node **nfa_array = NULL;/* root of binary tree that stores nfa array */
+nfa_node nfa_model_node; /* model to initialize new nodes */
+set used_chars; /* used to label trans. arcs */
+set used_classes; /* classes or chars used to label trans. arcs */
+set normal_chars; /* mask to get rid elements that aren't used
+in set */
+int flag_paren = FALSE;
+int flag_brace = FALSE;
+int mode_counter = 0; /* keep track of number of %%names */
+
+
+
+void
+#ifdef __USE_PROTOS
+grammar(void)
+#else
+grammar()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ p_head(); p_class_hdr(); func_action = FALSE;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (setwd1[LA(1)]&0x1) ) {
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ if ( (LA(1)==LEXACTION) ) {
+ zzmatch(LEXACTION); zzCONSUME;
+ }
+ else {
+ if ( (LA(1)==LEXMEMBER) ) {
+ zzmatch(LEXMEMBER); zzCONSUME;
+ }
+ else {
+ if ( (LA(1)==LEXPREFIX) ) {
+ zzmatch(LEXPREFIX); zzCONSUME;
+ }
+ else {
+ if ( (LA(1)==PARSERCLASS) ) {
+ zzmatch(PARSERCLASS); zzCONSUME;
+ }
+ else {
+ if ( (LA(1)==ACTION) ) {
+ }
+ else {zzFAIL(1,zzerr1,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ }
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ zzmatch(ACTION); zzCONSUME;
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ if ( gen_cpp ) p_includes();
+ start_states();
+ func_action = FALSE; p_tables(); p_tail();
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (LA(1)==ACTION) ) {
+ zzmatch(ACTION); zzCONSUME;
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzmatch(1);
+ if (firstLexMember != 0) p_class_def1();
+ zzCONSUME;
+
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd1, 0x2);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+start_states(void)
+#else
+start_states()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==PER_PER) ) {
+ zzmatch(PER_PER); zzCONSUME;
+ do_conversion();
+ }
+ else {
+ if ( (LA(1)==NAME_PER_PER) ) {
+ zzmatch(NAME_PER_PER); zzCONSUME;
+ do_conversion();
+ {
+ zzBLOCK(zztasp3);
+ zzMake0;
+ {
+ while ( (LA(1)==NAME_PER_PER) ) {
+ zzmatch(NAME_PER_PER); zzCONSUME;
+ do_conversion();
+ zzLOOP(zztasp3);
+ }
+ zzEXIT(zztasp3);
+ }
+ }
+ }
+ else {zzFAIL(1,zzerr2,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzmatch(PER_PER); zzCONSUME;
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd1, 0x4);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+do_conversion(void)
+#else
+do_conversion()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ new_automaton_mode(); func_action = TRUE;
+ rule_list();
+
+ dfa_class_nop[mode_counter] =
+ relabel(zzaArg(zztasp1,1 ).l,comp_level);
+ if (comp_level)
+ p_shift_table(mode_counter);
+ dfa_basep[mode_counter] = dfa_allocated+1;
+ make_dfa_model_node(dfa_class_nop[mode_counter]);
+ nfa_to_dfa(zzaArg(zztasp1,1 ).l);
+ ++mode_counter;
+ func_action = FALSE;
+#ifdef HASH_STAT
+ fprint_hash_stats(stderr);
+#endif
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd1, 0x8);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+rule_list(void)
+#else
+rule_list()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ if ( (setwd1[LA(1)]&0x10) ) {
+ rule();
+ zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (setwd1[LA(1)]&0x20) ) {
+ rule();
+ {nfa_node *t1;
+ t1 = new_nfa_node();
+ (t1)->trans[0]=zzaRet.l;
+ (t1)->trans[1]=zzaArg(zztasp2,1 ).l;
+ /* all accept nodes "dead ends" */
+ zzaRet.l=t1; zzaRet.r=NULL;
+ }
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ }
+ else {
+ if ( (setwd1[LA(1)]&0x40) ) {
+ zzaRet.l = new_nfa_node(); zzaRet.r = NULL;
+ warning("no regular expressions", zzline);
+ }
+ else {zzFAIL(1,zzerr3,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd1, 0x80);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+rule(void)
+#else
+rule()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ if ( (setwd2[LA(1)]&0x1) ) {
+ reg_expr();
+ zzmatch(ACTION);
+ if (zzaArg(zztasp1,1 ).r != NULL) {
+ zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r; (zzaArg(zztasp1,1 ).r)->accept=action_no;
+ }
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==ACTION) ) {
+ zzmatch(ACTION);
+ zzaRet.l = NULL; zzaRet.r = NULL;
+ error("no expression for action ", zzline);
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr4,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd2, 0x2);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+reg_expr(void)
+#else
+reg_expr()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ and_expr();
+ zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (LA(1)==OR) ) {
+ zzmatch(OR); zzCONSUME;
+ and_expr();
+ {nfa_node *t1, *t2;
+ t1 = new_nfa_node(); t2 = new_nfa_node();
+ (t1)->trans[0]=zzaRet.l;
+ (t1)->trans[1]=zzaArg(zztasp2,2 ).l;
+ /* MR23 */ if (zzaRet.r != NULL) (zzaRet.r)->trans[1]=t2;
+ if (zzaArg(zztasp2,2 ).r) {
+ (zzaArg(zztasp2,2 ).r)->trans[1]=t2; /* MR20 */
+ }
+ zzaRet.l=t1; zzaRet.r=t2;
+ }
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd2, 0x4);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+and_expr(void)
+#else
+and_expr()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ repeat_expr();
+
+ zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (setwd2[LA(1)]&0x8) ) {
+ repeat_expr();
+ if (zzaRet.r != NULL) {
+ (zzaRet.r)->trans[1]=zzaArg(zztasp2,1 ).l;
+ zzaRet.r=zzaArg(zztasp2,1 ).r;
+ }
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd2, 0x10);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+repeat_expr(void)
+#else
+repeat_expr()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ if ( (setwd2[LA(1)]&0x20) ) {
+ expr();
+ zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r;
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==ZERO_MORE) ) {
+ zzmatch(ZERO_MORE);
+ { nfa_node *t1,*t2;
+ /* MR23 */ if (zzaRet.r != NULL) (zzaRet.r)->trans[0] = zzaRet.l;
+ t1 = new_nfa_node(); t2 = new_nfa_node();
+ t1->trans[0]=zzaRet.l;
+ t1->trans[1]=t2;
+ /* MR23 */ if (zzaRet.r != NULL) (zzaRet.r)->trans[1]=t2;
+ zzaRet.l=t1;zzaRet.r=t2;
+ }
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==ONE_MORE) ) {
+ zzmatch(ONE_MORE);
+ if (zzaRet.r != NULL) (zzaRet.r)->trans[0] = zzaRet.l;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd2[LA(1)]&0x40) ) {
+ }
+ else {zzFAIL(1,zzerr5,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ }
+ else {
+ if ( (LA(1)==ZERO_MORE) ) {
+ zzmatch(ZERO_MORE);
+ error("no expression for *", zzline);
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==ONE_MORE) ) {
+ zzmatch(ONE_MORE);
+ error("no expression for +", zzline);
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr6,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd2, 0x80);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+expr(void)
+#else
+expr()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ zzaRet.l = new_nfa_node();
+ zzaRet.r = new_nfa_node();
+ if ( (LA(1)==L_BRACK) ) {
+ zzmatch(L_BRACK); zzCONSUME;
+ atom_list();
+ zzmatch(R_BRACK);
+
+ /* MR23 */ if (zzaRet.l != NULL) {
+ (zzaRet.l)->trans[0] = zzaRet.r;
+ (zzaRet.l)->label = set_dup(zzaArg(zztasp1,2 ).label);
+ set_orin(&used_chars,(zzaRet.l)->label);
+ }
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==NOT) ) {
+ zzmatch(NOT); zzCONSUME;
+ zzmatch(L_BRACK); zzCONSUME;
+ atom_list();
+ zzmatch(R_BRACK);
+
+ /* MR23 */ if (zzaRet.l != NULL) {
+ (zzaRet.l)->trans[0] = zzaRet.r;
+ (zzaRet.l)->label = set_dif(normal_chars,zzaArg(zztasp1,3 ).label);
+ set_orin(&used_chars,(zzaRet.l)->label);
+ }
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==L_PAR) ) {
+ zzmatch(L_PAR); zzCONSUME;
+ reg_expr();
+ zzmatch(R_PAR);
+
+ /* MR23 */ if (zzaRet.l != NULL) {
+ (zzaRet.l)->trans[0] = zzaArg(zztasp1,2 ).l;
+ if (zzaArg(zztasp1,2 ).r) {
+ (zzaArg(zztasp1,2 ).r)->trans[1] = zzaRet.r; /* MR20 */
+ }
+ }
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==L_BRACE) ) {
+ zzmatch(L_BRACE); zzCONSUME;
+ reg_expr();
+ zzmatch(R_BRACE);
+
+ /* MR23 */ if (zzaRet.l != NULL) {
+ (zzaRet.l)->trans[0] = zzaArg(zztasp1,2 ).l;
+ (zzaRet.l)->trans[1] = zzaRet.r;
+ if (zzaArg(zztasp1,2 ).r) {
+ (zzaArg(zztasp1,2 ).r)->trans[1] = zzaRet.r; /* MR20 */
+ }
+ }
+ zzCONSUME;
+
+ }
+ else {
+ if ( (setwd3[LA(1)]&0x1) ) {
+ atom();
+
+ /* MR23 */ if (zzaRet.l != NULL) {
+ (zzaRet.l)->trans[0] = zzaRet.r;
+ (zzaRet.l)->label = set_dup(zzaArg(zztasp1,1 ).label);
+ set_orin(&used_chars,(zzaRet.l)->label);
+ }
+ }
+ else {zzFAIL(1,zzerr7,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ }
+ }
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd3, 0x2);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+atom_list(void)
+#else
+atom_list()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ set_free(zzaRet.label);
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ while ( (setwd3[LA(1)]&0x4) ) {
+ near_atom();
+ set_orin(&(zzaRet.label),zzaArg(zztasp2,1 ).label);
+ zzLOOP(zztasp2);
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd3, 0x8);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+near_atom(void)
+#else
+near_atom()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ register int i;
+ register int i_prime;
+ anychar();
+ zzaRet.letter=zzaArg(zztasp1,1 ).letter; zzaRet.label=set_of(zzaArg(zztasp1,1 ).letter);
+ i_prime = zzaArg(zztasp1,1 ).letter + MIN_CHAR;
+ if (case_insensitive && islower(i_prime))
+ set_orel(toupper(i_prime)-MIN_CHAR,
+ &(zzaRet.label));
+ if (case_insensitive && isupper(i_prime))
+ set_orel(tolower(i_prime)-MIN_CHAR,
+ &(zzaRet.label));
+ {
+ zzBLOCK(zztasp2);
+ zzMake0;
+ {
+ if ( (LA(1)==RANGE) ) {
+ zzmatch(RANGE); zzCONSUME;
+ anychar();
+ if (case_insensitive){
+ i_prime = zzaRet.letter+MIN_CHAR;
+ zzaRet.letter = (islower(i_prime) ?
+ toupper(i_prime) : i_prime)-MIN_CHAR;
+ i_prime = zzaArg(zztasp2,2 ).letter+MIN_CHAR;
+ zzaArg(zztasp2,2 ).letter = (islower(i_prime) ?
+ toupper(i_prime) : i_prime)-MIN_CHAR;
+ }
+ /* check to see if range okay */
+ {
+ int debugLetter1 = zzaRet.letter;
+ int debugLetter2 = zzaArg(zztasp2,2 ).letter;
+ }
+ if (zzaRet.letter > zzaArg(zztasp2,2 ).letter
+ && zzaArg(zztasp2,2 ).letter != 0xff){ /* MR16 */
+ error("invalid range ", zzline);
+ }
+ for (i=zzaRet.letter; i<= (int)zzaArg(zztasp2,2 ).letter; ++i){
+ set_orel(i,&(zzaRet.label));
+ i_prime = i+MIN_CHAR;
+ if (case_insensitive && islower(i_prime))
+ set_orel(toupper(i_prime)-MIN_CHAR,
+ &(zzaRet.label));
+ if (case_insensitive && isupper(i_prime))
+ set_orel(tolower(i_prime)-MIN_CHAR,
+ &(zzaRet.label));
+ }
+ }
+ else {
+ if ( (setwd3[LA(1)]&0x10) ) {
+ }
+ else {zzFAIL(1,zzerr8,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ zzEXIT(zztasp2);
+ }
+ }
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd3, 0x20);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+atom(void)
+#else
+atom()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ register int i_prime;
+ anychar();
+ zzaRet.label = set_of(zzaArg(zztasp1,1 ).letter);
+ i_prime = zzaArg(zztasp1,1 ).letter + MIN_CHAR;
+ if (case_insensitive && islower(i_prime))
+ set_orel(toupper(i_prime)-MIN_CHAR,
+ &(zzaRet.label));
+ if (case_insensitive && isupper(i_prime))
+ set_orel(tolower(i_prime)-MIN_CHAR,
+ &(zzaRet.label));
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd3, 0x40);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+anychar(void)
+#else
+anychar()
+#endif
+{
+ zzRULE;
+ zzBLOCK(zztasp1);
+ zzMake0;
+ {
+ if ( (LA(1)==REGCHAR) ) {
+ zzmatch(REGCHAR);
+ zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==OCTAL_VALUE) ) {
+ zzmatch(OCTAL_VALUE);
+ zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==HEX_VALUE) ) {
+ zzmatch(HEX_VALUE);
+ zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==DEC_VALUE) ) {
+ zzmatch(DEC_VALUE);
+ zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==TAB) ) {
+ zzmatch(TAB);
+ zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==NL) ) {
+ zzmatch(NL);
+ zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==CR) ) {
+ zzmatch(CR);
+ zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==BS) ) {
+ zzmatch(BS);
+ zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==LIT) ) {
+ zzmatch(LIT);
+ zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR;
+ zzCONSUME;
+
+ }
+ else {
+ if ( (LA(1)==L_EOF) ) {
+ zzmatch(L_EOF);
+ zzaRet.letter = 0;
+ zzCONSUME;
+
+ }
+ else {zzFAIL(1,zzerr9,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ zzEXIT(zztasp1);
+ return;
+fail:
+ zzEXIT(zztasp1);
+ /* empty action */
+ zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
+ zzresynch(setwd3, 0x80);
+ }
+}
+
+/* adds a new nfa to the binary tree and returns a pointer to it */
+nfa_node *
+#ifdef __USE_PROTOS
+new_nfa_node(void)
+#else
+new_nfa_node()
+#endif
+{
+ register nfa_node *t;
+ static int nfa_size=0; /* elements nfa_array[] can hold */
+
+ ++nfa_allocated;
+ if (nfa_size<=nfa_allocated){
+ /* need to redo array */
+ if (!nfa_array){
+ /* need some to do initial allocation */
+ nfa_size=nfa_allocated+NFA_MIN;
+ nfa_array=(nfa_node **) malloc(sizeof(nfa_node*)*
+ nfa_size);
+ }else{
+ /* need more space */
+ nfa_size=2*(nfa_allocated+1);
+ nfa_array=(nfa_node **) realloc(nfa_array,
+ sizeof(nfa_node*)*nfa_size);
+ }
+ }
+ /* fill out entry in array */
+ t = (nfa_node*) malloc(sizeof(nfa_node));
+ nfa_array[nfa_allocated] = t;
+ *t = nfa_model_node;
+ t->node_no = nfa_allocated;
+ return t;
+}
+
+
+/* initialize the model node used to fill in newly made nfa_nodes */
+void
+#ifdef __USE_PROTOS
+make_nfa_model_node(void)
+#else
+make_nfa_model_node()
+#endif
+{
+ nfa_model_node.node_no = -1; /* impossible value for real nfa node */
+ nfa_model_node.nfa_set = 0;
+ nfa_model_node.accept = 0; /* error state default*/
+ nfa_model_node.trans[0] = NULL;
+ nfa_model_node.trans[1] = NULL;
+ nfa_model_node.label = empty;
+}
+
+#if defined(DEBUG) || defined(_DEBUG)
+
+/* print out the pointer value and the node_number */
+void
+#ifdef __USE_PROTOS
+fprint_dfa_pair(FILE *f, nfa_node *p)
+#else
+fprint_dfa_pair(f, p)
+FILE *f;
+nfa_node *p;
+#endif
+{
+ if (p){
+ fprintf(f, "%x (%d)", p, p->node_no);
+ }else{
+ fprintf(f, "(nil)");
+ }
+}
+
+/* print out interest information on a set */
+void
+#ifdef __USE_PROTOS
+fprint_set(FILE *f, set s)
+#else
+fprint_set(f,s)
+FILE *f;
+set s;
+#endif
+{
+ unsigned int *x;
+
+ fprintf(f, "n = %d,", s.n);
+ if (s.setword){
+ fprintf(f, "setword = %x, ", s.setword);
+ /* print out all the elements in the set */
+ x = set_pdq(s);
+ while (*x!=nil){
+ fprintf(f, "%d ", *x);
+ ++x;
+ }
+ }else{
+ fprintf(f, "setword = (nil)");
+ }
+}
+
+/* code to be able to dump out the nfas
+return 0 if okay dump
+return 1 if screwed up
+*/
+int
+#ifdef __USE_PROTOS
+dump_nfas(int first_node, int last_node)
+#else
+dump_nfas(first_node, last_node)
+int first_node;
+int last_node;
+#endif
+{
+ register int i;
+ nfa_node *t;
+
+ for (i=first_node; i<=last_node; ++i){
+ t = NFA(i);
+ if (!t) break;
+ fprintf(stderr, "nfa_node %d {\n", t->node_no);
+ fprintf(stderr, "\n\tnfa_set = %d\n", t->nfa_set);
+ fprintf(stderr, "\taccept\t=\t%d\n", t->accept);
+ fprintf(stderr, "\ttrans\t=\t(");
+ fprint_dfa_pair(stderr, t->trans[0]);
+ fprintf(stderr, ",");
+ fprint_dfa_pair(stderr, t->trans[1]);
+ fprintf(stderr, ")\n");
+ fprintf(stderr, "\tlabel\t=\t{ ");
+ fprint_set(stderr, t->label);
+ fprintf(stderr, "\t}\n");
+ fprintf(stderr, "}\n\n");
+ }
+ return 0;
+}
+#endif
+
+/* DLG-specific syntax error message generator
+* (define USER_ZZSYN when compiling so don't get 2 definitions)
+*/
+void
+#ifdef __USE_PROTOS
+zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok, int k, char *bad_text)
+#else
+zzsyn(text, tok, egroup, eset, etok, k, bad_text)
+char *text, *egroup, *bad_text;
+int tok;
+int etok;
+int k;
+SetWordType *eset;
+#endif
+{
+fprintf(stderr, ErrHdr, file_str[0]!=NULL?file_str[0]:"stdin", zzline);
+fprintf(stderr, " syntax error at \"%s\"", (tok==zzEOF_TOKEN)?"EOF":text);
+if ( !etok && !eset ) {fprintf(stderr, "\n"); return;}
+if ( k==1 ) fprintf(stderr, " missing");
+else
+{
+fprintf(stderr, "; \"%s\" not", bad_text);
+if ( zzset_deg(eset)>1 ) fprintf(stderr, " in");
+}
+if ( zzset_deg(eset)>0 ) zzedecode(eset);
+else fprintf(stderr, " %s", zztokens[etok]);
+if ( strlen(egroup) > (size_t)0 ) fprintf(stderr, " in %s", egroup);
+fprintf(stderr, "\n");
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg_p.g b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg_p.g
new file mode 100644
index 000000000..657f3251a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg_p.g
@@ -0,0 +1,616 @@
+/* This is the parser for the dlg
+ * This is a part of the Purdue Compiler Construction Tool Set
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * DLG 1.33
+ * Will Cohen
+ * With mods by Terence Parr; AHPCRC, University of Minnesota
+ * 1989-1995
+ */
+
+#header <<
+#include <ctype.h>
+#include "dlg.h"
+>>
+
+<<
+
+/* MR20 G. Hobbelt
+ Fix for Borland C++ 4.x & 5.x compiling with ALL warnings enabled
+*/
+
+#ifdef __TURBOC__
+#pragma warn -aus /* unused assignment of 'xxx' */
+#endif
+
+#pragma clang diagnostic ignored "-Wparentheses-equality"
+
+int action_no = 0; /* keep track of actions outputted */
+int nfa_allocated = 0; /* keeps track of number of nfa nodes */
+nfa_node **nfa_array = NULL;/* root of binary tree that stores nfa array */
+nfa_node nfa_model_node; /* model to initialize new nodes */
+set used_chars; /* used to label trans. arcs */
+set used_classes; /* classes or chars used to label trans. arcs */
+set normal_chars; /* mask to get rid elements that aren't used
+ in set */
+int flag_paren = FALSE;
+int flag_brace = FALSE;
+int mode_counter = 0; /* keep track of number of %%names */
+
+>>
+
+#lexaction <<
+int func_action; /* should actions be turned into functions?*/
+int lex_mode_counter = 0; /* keeps track of the number of %%names */
+/* MR1 */
+/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
+/* MR1 via <<%%lexmember...>> */
+/* MR1 */
+int lexMember = 0; /* <<%%lexmemeber ...>> MR1 */
+int lexAction = 0; /* <<%%lexaction ...>> MR1 */
+int parserClass = 0; /* <<%%parserclass ...>> MR1 */
+int lexPrefix = 0; /* <<%%lexprefix ...>> MR1 */
+char theClassName[100]; /* MR11 */
+char *pClassName=theClassName; /* MR11 */
+int firstLexMember=1; /* MR1 */
+
+#ifdef __USE_PROTOS
+void xxputc(int c) { /* MR1 */
+#else
+void xxputc(c) /* MR1 */
+ int c; /* MR1 */
+{ /* MR1 */
+#endif
+ if (parserClass) { /* MR1 */
+ *pClassName++=c; /* MR1 */
+ *pClassName=0; /* MR1 */
+ } else if (lexMember || lexPrefix) { /* MR1 */
+ if (class_stream != NULL) fputc(c,class_stream); /* MR1 */
+ } else { /* MR1 */
+ fputc(c,OUT); /* MR1 */
+ }; /* MR1 */
+} /* MR1 */
+
+#ifdef __USE_PROTOS
+void xxprintf(char *format,char *string) { /* MR1 */
+#else
+void xxprintf(format,string) /* MR1 */
+ char *format; /* MR1 */
+ char *string; /* MR1 */
+{ /* MR1 */
+#endif
+ if (lexMember || lexPrefix || parserClass) { /* MR1 */
+ if (class_stream != NULL) /* MR1 */
+ fprintf(class_stream,format,string); /* MR1 */
+ } else { /* MR1 */
+ fprintf(OUT,format,string); /* MR1 */
+ }; /* MR1 */
+} /* MR1 */
+>>
+
+#token "[\r\t\ ]+" << zzskip(); >> /* Ignore white */
+#token "\n" << zzline++; zzskip(); DAWDLE; >> /* Track Line # */
+#token L_EOF "\@"
+#token PER_PER "\%\%"
+#token NAME_PER_PER "\%\%[a-zA-Z_][a-zA-Z0-9_]*"
+ << p_mode_def(&zzlextext[2],lex_mode_counter++); >>
+
+#token LEXMEMBER "\<\<\%\%lexmember" /* MR1 */
+ <<lexMember=1; /* MR1 */
+ if (firstLexMember != 0) { /* MR1 */
+ firstLexMember=0; /* MR1 */
+ p_class_def1(); /* MR1 */
+ }; /* MR1 */
+ zzmode(ACT); /* MR1 */
+ >> /* MR1 */
+#token LEXACTION "\<\<\%\%lexaction" /* MR1 */
+ <<lexAction=1;zzmode(ACT);>> /* MR1 */
+#token PARSERCLASS "\<\<\%\%parserclass" /* MR1 */
+ <<parserClass=1; /* MR1 */
+ zzmode(ACT); /* MR1 */
+ >> /* MR1 */
+#token LEXPREFIX "\<\<\%\%lexprefix" /* MR1 */
+ <<lexPrefix=1;zzmode(ACT);>> /* MR1 */
+
+#token ACTION "\<\<"
+ << if (func_action)
+ fprintf(OUT,"\n%s %sact%d()\n{ ",
+ gen_cpp?"ANTLRTokenType":"static void",
+ gen_cpp?ClassName("::"):"", ++action_no);
+ zzmode(ACT); zzskip();
+ >>
+#token GREAT_GREAT "\>\>"
+#token L_BRACE "\{"
+#token R_BRACE "\}"
+#token L_PAR "\("
+#token R_PAR "\)"
+#token L_BRACK "\["
+#token R_BRACK "\]"
+#token ZERO_MORE "\*"
+#token ONE_MORE "\+"
+#token OR "\|"
+#token RANGE "\-"
+#token NOT "\~"
+#token OCTAL_VALUE "\\0[0-7]*"
+ << {int t; sscanf(&zzlextext[1],"%o",&t); zzlextext[0] = t;}>>
+#token HEX_VALUE "\\0[Xx][0-9a-fA-F]+"
+ << {int t; sscanf(&zzlextext[3],"%x",&t); zzlextext[0] = t;}>>
+#token DEC_VALUE "\\[1-9][0-9]*"
+ << {int t; sscanf(&zzlextext[1],"%d",&t); zzlextext[0] = t;}>>
+#token TAB "\\t" << zzlextext[0] = '\t';>>
+#token NL "\\n" << zzlextext[0] = '\n';>>
+#token CR "\\r" << zzlextext[0] = '\r';>>
+#token BS "\\b" << zzlextext[0] = '\b';>>
+
+/* MR1 */
+/* MR1 10-Apr-97 MR1 Allow #token regular expressions to cross lines */
+/* MR1 */
+#token CONTINUATION "\\ \n" << zzline++; zzskip();>> /* MR1 */
+
+/* NOTE: this takes ANYTHING after the \ */
+#token LIT "\\~[tnrb]" << zzlextext[0] = zzlextext[1];>>
+
+/* NOTE: this takes ANYTHING that doesn't match the other tokens */
+#token REGCHAR "~[\\]"
+
+
+grammar : << p_head(); p_class_hdr(); func_action = FALSE;>>
+ ( {LEXACTION | LEXMEMBER | LEXPREFIX | PARSERCLASS } ACTION)* /* MR1 */
+ <<if ( gen_cpp ) p_includes();>>
+ start_states
+ << func_action = FALSE; p_tables(); p_tail(); >>
+ (ACTION)* "@"
+ << if (firstLexMember != 0) p_class_def1(); >> /* MR1 */
+ ;
+
+start_states : ( PER_PER do_conversion
+ | NAME_PER_PER do_conversion (NAME_PER_PER do_conversion)*)
+ PER_PER
+ ;
+
+do_conversion : <<new_automaton_mode(); func_action = TRUE;>>
+ rule_list
+ <<
+ dfa_class_nop[mode_counter] =
+ relabel($1.l,comp_level);
+ if (comp_level)
+ p_shift_table(mode_counter);
+ dfa_basep[mode_counter] = dfa_allocated+1;
+ make_dfa_model_node(dfa_class_nop[mode_counter]);
+ nfa_to_dfa($1.l);
+ ++mode_counter;
+ func_action = FALSE;
+#ifdef HASH_STAT
+ fprint_hash_stats(stderr);
+#endif
+ >>
+ ;
+
+rule_list : rule <<$$.l=$1.l; $$.r=$1.r;>>
+ (rule
+ <<{nfa_node *t1;
+ t1 = new_nfa_node();
+ (t1)->trans[0]=$$.l;
+ (t1)->trans[1]=$1.l;
+ /* all accept nodes "dead ends" */
+ $$.l=t1; $$.r=NULL;
+ }
+ >>
+ )*
+ | /* empty */
+ <<$$.l = new_nfa_node(); $$.r = NULL;
+ warning("no regular expressions", zzline);
+ >>
+ ;
+
+rule : reg_expr ACTION
+/* MR23 */ << if ($1.r != NULL) {
+ $$.l=$1.l; $$.r=$1.r; ($1.r)->accept=action_no;
+ }
+ >>
+ | ACTION
+ <<$$.l = NULL; $$.r = NULL;
+ error("no expression for action ", zzline);
+ >>
+ ;
+
+reg_expr : and_expr <<$$.l=$1.l; $$.r=$1.r;>>
+ (OR and_expr
+ <<{nfa_node *t1, *t2;
+ t1 = new_nfa_node(); t2 = new_nfa_node();
+ (t1)->trans[0]=$$.l;
+ (t1)->trans[1]=$2.l;
+/* MR23 */ if ($$.r != NULL) ($$.r)->trans[1]=t2;
+ if ($2.r) {
+ ($2.r)->trans[1]=t2; /* MR20 */
+ }
+ $$.l=t1; $$.r=t2;
+ }
+ >>
+ )*
+ ;
+
+and_expr : repeat_expr
+ <<
+ $$.l=$1.l; $$.r=$1.r;
+ >>
+ (repeat_expr
+/* MR23 */ << if ($$.r != NULL) {
+ ($$.r)->trans[1]=$1.l;
+ $$.r=$1.r;
+ }
+ >>
+ )*
+ ;
+
+repeat_expr : expr <<$$.l=$1.l; $$.r=$1.r;>>
+ { ZERO_MORE
+ <<{ nfa_node *t1,*t2;
+/* MR23 */ if ($$.r != NULL) ($$.r)->trans[0] = $$.l;
+ t1 = new_nfa_node(); t2 = new_nfa_node();
+ t1->trans[0]=$$.l;
+ t1->trans[1]=t2;
+/* MR23 */ if ($$.r != NULL) ($$.r)->trans[1]=t2;
+ $$.l=t1;$$.r=t2;
+ }
+ >>
+ | ONE_MORE
+/* MR23 */ <<if ($$.r != NULL) ($$.r)->trans[0] = $$.l;>>
+ }
+ | ZERO_MORE
+ << error("no expression for *", zzline);>>
+ | ONE_MORE
+ << error("no expression for +", zzline);>>
+ ;
+
+expr : << $$.l = new_nfa_node();
+ $$.r = new_nfa_node();
+ >>
+ L_BRACK atom_list R_BRACK
+ <<
+/* MR23 */ if ($$.l != NULL) {
+ ($$.l)->trans[0] = $$.r;
+ ($$.l)->label = set_dup($2.label);
+ set_orin(&used_chars,($$.l)->label);
+ }
+ >>
+ | NOT L_BRACK atom_list R_BRACK
+ <<
+/* MR23 */ if ($$.l != NULL) {
+ ($$.l)->trans[0] = $$.r;
+ ($$.l)->label = set_dif(normal_chars,$3.label);
+ set_orin(&used_chars,($$.l)->label);
+ }
+ >>
+ | L_PAR reg_expr R_PAR
+ <<
+/* MR23 */ if ($$.l != NULL) {
+ ($$.l)->trans[0] = $2.l;
+ if ($2.r) {
+ ($2.r)->trans[1] = $$.r; /* MR20 */
+ }
+ }
+ >>
+ | L_BRACE reg_expr R_BRACE
+ <<
+/* MR23 */ if ($$.l != NULL) {
+ ($$.l)->trans[0] = $2.l;
+ ($$.l)->trans[1] = $$.r;
+ if ($2.r) {
+ ($2.r)->trans[1] = $$.r; /* MR20 */
+ }
+ }
+ >>
+ | atom
+ <<
+/* MR23 */ if ($$.l != NULL) {
+ ($$.l)->trans[0] = $$.r;
+ ($$.l)->label = set_dup($1.label);
+ set_orin(&used_chars,($$.l)->label);
+ }
+ >>
+ ;
+
+atom_list : << set_free($$.label); >>
+ (near_atom <<set_orin(&($$.label),$1.label);>>)*
+ ;
+
+near_atom : << register int i;
+ register int i_prime;
+ >>
+ anychar
+ <<$$.letter=$1.letter; $$.label=set_of($1.letter);
+ i_prime = $1.letter + MIN_CHAR;
+ if (case_insensitive && islower(i_prime))
+ set_orel(toupper(i_prime)-MIN_CHAR,
+ &($$.label));
+ if (case_insensitive && isupper(i_prime))
+ set_orel(tolower(i_prime)-MIN_CHAR,
+ &($$.label));
+ >>
+ { RANGE anychar
+ << if (case_insensitive){
+ i_prime = $$.letter+MIN_CHAR;
+ $$.letter = (islower(i_prime) ?
+ toupper(i_prime) : i_prime)-MIN_CHAR;
+ i_prime = $2.letter+MIN_CHAR;
+ $2.letter = (islower(i_prime) ?
+ toupper(i_prime) : i_prime)-MIN_CHAR;
+ }
+ /* check to see if range okay */
+ {
+ int debugLetter1 = $$.letter;
+ int debugLetter2 = $2.letter;
+ }
+ if ($$.letter > $2.letter
+ && $2.letter != 0xff){ /* MR16 */
+ error("invalid range ", zzline);
+ }
+ for (i=$$.letter; i<= (int)$2.letter; ++i){
+ set_orel(i,&($$.label));
+ i_prime = i+MIN_CHAR;
+ if (case_insensitive && islower(i_prime))
+ set_orel(toupper(i_prime)-MIN_CHAR,
+ &($$.label));
+ if (case_insensitive && isupper(i_prime))
+ set_orel(tolower(i_prime)-MIN_CHAR,
+ &($$.label));
+ }
+ >>
+ }
+ ;
+
+atom : << register int i_prime;>>
+ anychar
+ <<$$.label = set_of($1.letter);
+ i_prime = $1.letter + MIN_CHAR;
+ if (case_insensitive && islower(i_prime))
+ set_orel(toupper(i_prime)-MIN_CHAR,
+ &($$.label));
+ if (case_insensitive && isupper(i_prime))
+ set_orel(tolower(i_prime)-MIN_CHAR,
+ &($$.label));
+ >>
+ ;
+
+anychar : REGCHAR <<$$.letter = $1.letter - MIN_CHAR;>>
+ | OCTAL_VALUE <<$$.letter = $1.letter - MIN_CHAR;>>
+ | HEX_VALUE <<$$.letter = $1.letter - MIN_CHAR;>>
+ | DEC_VALUE <<$$.letter = $1.letter - MIN_CHAR;>>
+ | TAB <<$$.letter = $1.letter - MIN_CHAR;>>
+ | NL <<$$.letter = $1.letter - MIN_CHAR;>>
+ | CR <<$$.letter = $1.letter - MIN_CHAR;>>
+ | BS <<$$.letter = $1.letter - MIN_CHAR;>>
+ | LIT <<$$.letter = $1.letter - MIN_CHAR;>>
+ /* NOTE: LEX_EOF is ALWAYS shifted to 0 = MIN_CHAR - MIN_CHAR*/
+ | L_EOF <<$$.letter = 0;>>
+ ;
+
+<</* empty action */>>
+
+#lexclass ACT
+#token "@" << error("unterminated action", zzline); zzmode(START); >>
+#token ACTION "\>\>"
+ << if (func_action) fprintf(OUT,"}\n\n");
+ zzmode(START);
+/* MR1 */
+/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
+/* MR1 via <<%%lexmember ...>> */
+/* MR1 This is a consequence of not saving actions */
+/* MR1 */
+/* MR1 */ parserClass=0;
+/* MR1 */ lexPrefix=0;
+/* MR1 */ lexAction=0;
+/* MR1 */ lexMember=0;
+ >>
+#token "\>" << xxputc(zzlextext[0]); zzskip(); >> /* MR1 */
+#token "\\\>" << xxputc('>'); zzskip(); >> /* MR1 */
+#token "\\" << xxputc('\\'); zzskip(); >> /* MR1 */
+#token "\n" << xxputc(zzlextext[0]); ++zzline; zzskip(); >> /* MR1 */
+#token "/\*" << zzmode(ACTION_COMMENTS); /* MR1 */
+ xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
+ >> /* MR1 */
+#token "//" << zzmode(ACTION_CPP_COMMENTS); /* MR1 */
+ xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
+ >> /* MR1 */
+#token "~[]" << xxputc(zzlextext[0]); zzskip(); >> /* MR1 */
+ /* MR1 */
+#lexclass ACTION_COMMENTS /* MR1 */
+#token "\*/" << zzmode(ACT); /* MR1 */
+ xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
+ >> /* MR1 */
+#token "[\n\r]" << zzline++; xxputc(zzlextext[0]); zzskip();>> /* MR1 */
+#token "~[]" << xxputc(zzlextext[0]); zzskip();>> /* MR1 */
+ /* MR1 */
+#lexclass ACTION_CPP_COMMENTS /* MR1 */
+#token "[\n\r]" << zzmode(ACT); zzline++; /* MR1 */
+ xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
+ >> /* MR1 */
+#token "~[]" << xxputc(zzlextext[0]); zzskip();>> /* MR1 */
+
+<<
+/* adds a new nfa to the binary tree and returns a pointer to it */
+nfa_node *
+#ifdef __USE_PROTOS
+new_nfa_node(void)
+#else
+new_nfa_node()
+#endif
+{
+ register nfa_node *t;
+ static int nfa_size=0; /* elements nfa_array[] can hold */
+
+ ++nfa_allocated;
+ if (nfa_size<=nfa_allocated){
+ /* need to redo array */
+ if (!nfa_array){
+ /* need some to do initial allocation */
+ nfa_size=nfa_allocated+NFA_MIN;
+ nfa_array=(nfa_node **) malloc(sizeof(nfa_node*)*
+ nfa_size);
+ }else{
+ /* need more space */
+ nfa_size=2*(nfa_allocated+1);
+ nfa_array=(nfa_node **) realloc(nfa_array,
+ sizeof(nfa_node*)*nfa_size);
+ }
+ }
+ /* fill out entry in array */
+ t = (nfa_node*) malloc(sizeof(nfa_node));
+ nfa_array[nfa_allocated] = t;
+ *t = nfa_model_node;
+ t->node_no = nfa_allocated;
+ return t;
+}
+
+
+/* initialize the model node used to fill in newly made nfa_nodes */
+void
+#ifdef __USE_PROTOS
+make_nfa_model_node(void)
+#else
+make_nfa_model_node()
+#endif
+{
+ nfa_model_node.node_no = -1; /* impossible value for real nfa node */
+ nfa_model_node.nfa_set = 0;
+ nfa_model_node.accept = 0; /* error state default*/
+ nfa_model_node.trans[0] = NULL;
+ nfa_model_node.trans[1] = NULL;
+ nfa_model_node.label = empty;
+}
+>>
+
+<<
+#if defined(DEBUG) || defined(_DEBUG)
+
+/* print out the pointer value and the node_number */
+void
+#ifdef __USE_PROTOS
+fprint_dfa_pair(FILE *f, nfa_node *p)
+#else
+fprint_dfa_pair(f, p)
+FILE *f;
+nfa_node *p;
+#endif
+{
+ if (p){
+ fprintf(f, "%x (%d)", p, p->node_no);
+ }else{
+ fprintf(f, "(nil)");
+ }
+}
+
+/* print out interest information on a set */
+void
+#ifdef __USE_PROTOS
+fprint_set(FILE *f, set s)
+#else
+fprint_set(f,s)
+FILE *f;
+set s;
+#endif
+{
+ unsigned int *x;
+
+ fprintf(f, "n = %d,", s.n);
+ if (s.setword){
+ fprintf(f, "setword = %x, ", s.setword);
+ /* print out all the elements in the set */
+ x = set_pdq(s);
+ while (*x!=nil){
+ fprintf(f, "%d ", *x);
+ ++x;
+ }
+ }else{
+ fprintf(f, "setword = (nil)");
+ }
+}
+
+/* code to be able to dump out the nfas
+ return 0 if okay dump
+ return 1 if screwed up
+ */
+int
+#ifdef __USE_PROTOS
+dump_nfas(int first_node, int last_node)
+#else
+dump_nfas(first_node, last_node)
+int first_node;
+int last_node;
+#endif
+{
+ register int i;
+ nfa_node *t;
+
+ for (i=first_node; i<=last_node; ++i){
+ t = NFA(i);
+ if (!t) break;
+ fprintf(stderr, "nfa_node %d {\n", t->node_no);
+ fprintf(stderr, "\n\tnfa_set = %d\n", t->nfa_set);
+ fprintf(stderr, "\taccept\t=\t%d\n", t->accept);
+ fprintf(stderr, "\ttrans\t=\t(");
+ fprint_dfa_pair(stderr, t->trans[0]);
+ fprintf(stderr, ",");
+ fprint_dfa_pair(stderr, t->trans[1]);
+ fprintf(stderr, ")\n");
+ fprintf(stderr, "\tlabel\t=\t{ ");
+ fprint_set(stderr, t->label);
+ fprintf(stderr, "\t}\n");
+ fprintf(stderr, "}\n\n");
+ }
+ return 0;
+}
+#endif
+>>
+
+<<
+/* DLG-specific syntax error message generator
+ * (define USER_ZZSYN when compiling so don't get 2 definitions)
+ */
+void
+#ifdef __USE_PROTOS
+zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok, int k, char *bad_text)
+#else
+zzsyn(text, tok, egroup, eset, etok, k, bad_text)
+char *text, *egroup, *bad_text;
+int tok;
+int etok;
+int k;
+SetWordType *eset;
+#endif
+{
+ fprintf(stderr, ErrHdr, file_str[0]!=NULL?file_str[0]:"stdin", zzline);
+ fprintf(stderr, " syntax error at \"%s\"", (tok==zzEOF_TOKEN)?"EOF":text);
+ if ( !etok && !eset ) {fprintf(stderr, "\n"); return;}
+ if ( k==1 ) fprintf(stderr, " missing");
+ else
+ {
+ fprintf(stderr, "; \"%s\" not", bad_text);
+ if ( zzset_deg(eset)>1 ) fprintf(stderr, " in");
+ }
+ if ( zzset_deg(eset)>0 ) zzedecode(eset);
+ else fprintf(stderr, " %s", zztokens[etok]);
+ if ( strlen(egroup) > (size_t)0 ) fprintf(stderr, " in %s", egroup);
+ fprintf(stderr, "\n");
+}
+>>
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/err.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/err.c
new file mode 100644
index 000000000..c3eaeae6d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/err.c
@@ -0,0 +1,99 @@
+/*
+ * A n t l r S e t s / E r r o r F i l e H e a d e r
+ *
+ * Generated from: dlg_p.g
+ *
+ * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001
+ * Parr Research Corporation
+ * with Purdue University Electrical Engineering
+ * With AHPCRC, University of Minnesota
+ * ANTLR Version 1.33MR33
+ */
+
+#define ANTLR_VERSION 13333
+#include "pcctscfg.h"
+#include "pccts_stdio.h"
+
+#include <ctype.h>
+#include "dlg.h"
+#define zzSET_SIZE 8
+#include "antlr.h"
+#include "tokens.h"
+#include "dlgdef.h"
+#include "err.h"
+
+ANTLRChar *zztokens[46]={
+ /* 00 */ "Invalid",
+ /* 01 */ "@",
+ /* 02 */ "[\\r\\t\\ ]+",
+ /* 03 */ "\\n",
+ /* 04 */ "L_EOF",
+ /* 05 */ "PER_PER",
+ /* 06 */ "NAME_PER_PER",
+ /* 07 */ "LEXMEMBER",
+ /* 08 */ "LEXACTION",
+ /* 09 */ "PARSERCLASS",
+ /* 10 */ "LEXPREFIX",
+ /* 11 */ "ACTION",
+ /* 12 */ "GREAT_GREAT",
+ /* 13 */ "L_BRACE",
+ /* 14 */ "R_BRACE",
+ /* 15 */ "L_PAR",
+ /* 16 */ "R_PAR",
+ /* 17 */ "L_BRACK",
+ /* 18 */ "R_BRACK",
+ /* 19 */ "ZERO_MORE",
+ /* 20 */ "ONE_MORE",
+ /* 21 */ "OR",
+ /* 22 */ "RANGE",
+ /* 23 */ "NOT",
+ /* 24 */ "OCTAL_VALUE",
+ /* 25 */ "HEX_VALUE",
+ /* 26 */ "DEC_VALUE",
+ /* 27 */ "TAB",
+ /* 28 */ "NL",
+ /* 29 */ "CR",
+ /* 30 */ "BS",
+ /* 31 */ "CONTINUATION",
+ /* 32 */ "LIT",
+ /* 33 */ "REGCHAR",
+ /* 34 */ "\\>",
+ /* 35 */ "\\\\>",
+ /* 36 */ "\\",
+ /* 37 */ "\\n",
+ /* 38 */ "/\\*",
+ /* 39 */ "//",
+ /* 40 */ "~[]",
+ /* 41 */ "\\*/",
+ /* 42 */ "[\\n\\r]",
+ /* 43 */ "~[]",
+ /* 44 */ "[\\n\\r]",
+ /* 45 */ "~[]"
+};
+SetWordType zzerr1[8] = {0x80,0xf,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr2[8] = {0x60,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
+SetWordType zzerr3[8] = {0x70,0xa8,0x9a,0x7f, 0x3,0x0,0x0,0x0};
+SetWordType setwd1[46] = {0x0,0x6,0x0,0x0,0x30,0xc8,0xc8,
+ 0x1,0x1,0x1,0x1,0x35,0x0,0x30,0x0,
+ 0x30,0x0,0x30,0x0,0x30,0x30,0x0,0x0,
+ 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,
+ 0x0,0x30,0x30,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0};
+SetWordType zzerr4[8] = {0x10,0xa8,0x9a,0x7f, 0x3,0x0,0x0,0x0};
+SetWordType zzerr5[8] = {0x10,0xe8,0xbb,0x7f, 0x3,0x0,0x0,0x0};
+SetWordType zzerr6[8] = {0x10,0xa0,0x9a,0x7f, 0x3,0x0,0x0,0x0};
+SetWordType setwd2[46] = {0x0,0x0,0x0,0x0,0xeb,0x2,0x2,
+ 0x0,0x0,0x0,0x0,0xd6,0x0,0xeb,0xd4,
+ 0xeb,0xd4,0xeb,0x0,0xcb,0xcb,0xd0,0x0,
+ 0xeb,0xeb,0xeb,0xeb,0xeb,0xeb,0xeb,0xeb,
+ 0x0,0xeb,0xeb,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0};
+SetWordType zzerr7[8] = {0x10,0xa0,0x82,0x7f, 0x3,0x0,0x0,0x0};
+SetWordType zzerr8[8] = {0x10,0x0,0x44,0x7f, 0x3,0x0,0x0,0x0};
+SetWordType zzerr9[8] = {0x10,0x0,0x0,0x7f, 0x3,0x0,0x0,0x0};
+SetWordType setwd3[46] = {0x0,0x0,0x0,0x0,0xf7,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0xc2,0x0,0xc2,0xc2,
+ 0xc2,0xc2,0xc2,0xb8,0xc2,0xc2,0xc2,0x80,
+ 0xc2,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,
+ 0x0,0xf7,0xf7,0x0,0x0,0x0,0x0,0x0,
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0};
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/main.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/main.c
new file mode 100644
index 000000000..35bd827f8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/main.c
@@ -0,0 +1,281 @@
+/* Main function for dlg version
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * DLG 1.33
+ * Will Cohen
+ * With mods by Terence Parr; AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include "stdpccts.h"
+
+char program[] = "dlg";
+char version[] = "1.33MR33"; /* MRXXX */
+int numfiles = 0;
+char *file_str[2] = {NULL, NULL};
+char *mode_file = "mode.h";
+char *class_name = DEFAULT_CLASSNAME;
+char *OutputDirectory = TopDirectory;
+
+/* Option variables */
+int comp_level = 0;
+int interactive = FALSE;
+int case_insensitive = FALSE;
+int warn_ambig = FALSE;
+int gen_cpp = FALSE;
+
+#ifdef __USE_PROTOS
+static int ci_strequ(char *a,char *b)
+#else
+static int ci_strequ(a,b)
+ char *a;
+ char *b;
+#endif
+{
+ for ( ;*a != 0 && *b != 0; a++, b++) {
+ if (toupper(*a) != toupper(*b)) return 0;
+ }
+ return (*a == *b);
+}
+
+/* Option List Stuff */
+#ifdef __USE_PROTOS
+void p_comp0(void) {comp_level = 0;}
+void p_comp1(void) {comp_level = 1;}
+void p_comp2(void) {comp_level = 2;}
+void p_stdio(void) { file_str[numfiles++] = NULL;}
+void p_file(char *s) { file_str[numfiles++] = s;}
+void p_cl_name(char *s, char *t)
+ {
+ if ( gen_cpp ) {
+ class_name = t;
+ }
+ else {
+ warning("-cl only valid in C++ mode; -cl ignored...",0);
+ }
+ }
+void p_mode_file(char *s, char *t){mode_file=t;}
+void p_outdir(char *s,char *t) {OutputDirectory=t;}
+void p_ansi(void) {gen_ansi = TRUE;}
+void p_interactive(void) {interactive = TRUE;}
+void p_case_s(void) { case_insensitive = FALSE; }
+void p_case_i(void) { case_insensitive = TRUE; }
+void p_warn_ambig(void) { warn_ambig = TRUE; }
+void p_cpp(void) { gen_cpp = TRUE; }
+#else
+void p_comp0() {comp_level = 0;}
+void p_comp1() {comp_level = 1;}
+void p_comp2() {comp_level = 2;}
+void p_stdio() { file_str[numfiles++] = NULL;}
+void p_file(s) char *s; { file_str[numfiles++] = s;}
+void p_cl_name(s,t)
+ char *s, *t;
+ {
+ if ( gen_cpp ) {
+ class_name = t;
+ }
+ else {
+ warning("-cl only valid in C++ mode; -cl ignored...",0);
+ }
+ }
+void p_mode_file(s,t) char *s,*t;{mode_file=t;}
+void p_outdir(s,t) char *s,*t;{OutputDirectory=t;}
+void p_ansi() {gen_ansi = TRUE;}
+void p_interactive() {interactive = TRUE;}
+void p_case_s() { case_insensitive = FALSE; }
+void p_case_i() { case_insensitive = TRUE; }
+void p_warn_ambig() { warn_ambig = TRUE; }
+void p_cpp() { gen_cpp = TRUE; }
+#endif
+
+#ifdef __cplusplus
+typedef void (*WildFunc)(...);
+#else
+typedef void (*WildFunc)();
+#endif
+
+typedef struct {
+ char *option;
+ int arg;
+ WildFunc process;
+ char *descr;
+ } Opt;
+
+Opt options[] = {
+ { "-CC", 0, (WildFunc)p_cpp, "Generate C++ output" },
+ { "-C0", 0, (WildFunc)p_comp0, "No compression (default)" },
+ { "-C1", 0, (WildFunc)p_comp1, "Compression level 1" },
+ { "-C2", 0, (WildFunc)p_comp2, "Compression level 2" },
+ { "-ga", 0, (WildFunc)p_ansi, "Generate ansi C"},
+ { "-Wambiguity", 0, (WildFunc)p_warn_ambig, "Warn if expressions ambiguous"},
+ { "-m", 1, (WildFunc)p_mode_file, "Rename lexical mode output file"},
+ { "-i", 0, (WildFunc)p_interactive, "Build interactive scanner (not valid for C++ mode)"},
+ { "-ci", 0, (WildFunc)p_case_i, "Make lexical analyzer case insensitive"},
+ { "-cl", 1, (WildFunc)p_cl_name, "Rename lexer class (DLGLexer); only used for -CC"},
+ { "-cs", 0, (WildFunc)p_case_s, "Make lexical analyzer case sensitive (default)"},
+ { "-o", 1, (WildFunc)p_outdir, OutputDirectoryOption},
+ { "-", 0, (WildFunc)p_stdio, "Use standard i/o rather than file"},
+ { "*", 0, (WildFunc)p_file, ""}, /* anything else is a file */
+ { NULL, 0, NULL }
+ };
+
+#ifdef __USE_PROTOS
+void ProcessArgs(int argc, char **argv, Opt *options)
+#else
+void ProcessArgs(argc, argv, options)
+int argc;
+char **argv;
+Opt *options;
+#endif
+{
+ Opt *p;
+
+ while ( argc-- > 0 )
+ {
+ p = options;
+ while ( p->option != NULL )
+ {
+ if ( strcmp(p->option, "*") == 0 ||
+ ci_strequ(p->option,*argv) )
+ {
+ if ( p->arg )
+ {
+ (*p->process)( *argv, *(argv+1) );
+ argv++;
+ argc--;
+ }
+ else
+ (*p->process)( *argv );
+ break;
+ }
+ p++;
+ }
+ argv++;
+ }
+}
+
+#ifdef __USE_PROTOS
+int main(int argc, char *argv[])
+#else
+int main(argc, argv)
+int argc;
+char *argv[];
+#endif
+{
+ init();
+ fprintf(stderr, "%s Version %s 1989-2001\n", &(program[0]),
+ &(version[0]));
+ if ( argc == 1 )
+ {
+ Opt *p = options;
+ fprintf(stderr, "%s [options] f1 f2 ... fn\n",argv[0]);
+ while ( *(p->option) != '*' )
+ {
+ fprintf(stderr, "\t%s %s\t%s\n",
+ p->option,
+ (p->arg)?"___":" ",
+ p->descr);
+ p++;
+ }
+ }else{
+ ProcessArgs(argc-1, &(argv[1]), options);
+ if (interactive && gen_cpp) {
+ fprintf(stderr,"\n");
+/*** MR21a This statement is wrong ! ***/
+#if 0
+*** fprintf(stderr,"Interactive lexer option (\"-i\") has no effect when in C++ mode\n");
+*** fprintf(stderr,"because of extra buffering provided by ANTLRTokenBuffer class.\n");
+*** fprintf(stderr,"\n");
+#endif
+ }
+ input_stream = read_stream(file_str[0]);
+ if (input_stream) {
+ /* don't overwrite unless input okay */
+ if ( gen_cpp ) {
+ output_stream = write_stream(ClassName(CPP_FILE_SUFFIX));
+ if ( file_str[1]!=NULL ) {
+ warning("output file implicit in C++ mode; ignored...",0);
+ }
+ class_stream = write_stream(ClassName(".h"));
+ mode_stream = class_stream;
+ }
+ else {
+ output_stream = write_stream(file_str[1]);
+ mode_stream = write_stream(mode_file);
+ }
+ }
+ /* make sure that error reporting routines in grammar
+ know what the file really is */
+ /* make sure that reading and writing somewhere */
+ if (input_stream && output_stream && mode_stream){
+ ANTLR(grammar(), input_stream);
+ }
+ p_class_def2(); /* MR1 */
+ }
+ if ( output_stream!=NULL ) fclose(output_stream);
+ if ( !gen_cpp && mode_stream!=NULL ) fclose(mode_stream);
+ if ( class_stream!=NULL ) fclose(class_stream);
+ exit(PCCTS_EXIT_SUCCESS);
+ return 0; /* get rid of warning message MR1 */
+}
+
+/* initialize all the variables */
+void
+#ifdef __USE_PROTOS
+init(void)
+#else
+init()
+#endif
+{
+ register int i;
+
+#ifdef SPECIAL_INITS
+ special_inits(); /* MR1 */
+#endif
+ used_chars = empty;
+ used_classes = empty;
+ /* make the valid character set */
+ normal_chars = empty;
+ /* NOTE: MIN_CHAR is EOF */
+ /* NOTE: EOF is not quite a valid char, it is special. Skip it*/
+ for (i = 1; i<CHAR_RANGE; ++i){
+ set_orel(i,&normal_chars);
+ }
+ make_nfa_model_node();
+ clear_hash();
+ /* NOTE: need to set this flag before the lexer starts getting */
+ /* tokens */
+ func_action = FALSE;
+}
+
+/* stuff that needs to be reset when a new automaton is being built */
+void
+#ifdef __USE_PROTOS
+new_automaton_mode(void) /* MR1 */
+#else
+new_automaton_mode() /* MR1 */
+#endif
+{
+ set_free(used_chars);
+ clear_hash();
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile
new file mode 100644
index 000000000..5a3561ede
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile
@@ -0,0 +1,164 @@
+#
+# Makefile for DLG 1.33
+# Terence Parr
+# Purdue University, U of MN, Parr Research Corporation
+# 1989-1994
+#
+# Ported to IBM C-Set/2 and Microsoft 6.0 by
+# Ed Harfmann
+# Micro Data Base Systems
+# Lafayette, Indiana
+#
+SET=../support/set
+PCCTS_H=../h
+
+##
+## Uncomment the appropriate section to build
+##
+
+#
+# OS/2 & DOS 16 bit using MSC 6.0
+#
+#CC=cl
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /AL /Za /W3 -DPC -DUSER_ZZSYN
+#OUT_OBJ = -Fo
+#LIBS=/NOD:LLIBCE LLIBCEP
+#OBJ_EXT = obj
+#
+#dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj \
+# output.obj relabel.obj automata.obj
+# link @<<
+#$** /NOI
+#$@ /STACK:16384
+#
+#$(LIBS: = +^
+#)
+#$(DEF_FILE) $(LFLAGS) ;
+#<<
+# bind $@ c:\os2\doscalls.lib
+# copy *.exe ..\bin
+#
+
+#
+# Borland C++ for DOS
+#
+#CC=bcc
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -ml -ff- -w- -DPC -DUSER_ZZSYN
+#OUT_OBJ = -o
+#LIBS= emu mathl cl
+#OBJ_EXT = obj
+#
+#dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj \
+# output.obj relabel.obj automata.obj
+# tlink @&&|
+#C0L $**
+#$@ /Tde /c
+#
+#$(LIBS)
+#$(DEF_FILE) $(LFLAGS) ;
+#|
+# copy *.exe ..\bin
+#
+
+#
+# C-Set/2 for OS/2
+#
+#CC=icc
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /Sa /W3 /DUSER_ZZSYN
+#OUT_OBJ = -Fo
+#LIBS=
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#OBJ_EXT=obj
+#
+#dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj \
+# output.obj relabel.obj automata.obj
+# link386 @<<
+#$** /NOI
+#$@ /STACK:32768
+#
+#$(LIBS: = +^
+#)
+#$(DEF_FILE) $(LFLAGS) ;
+#<<
+# copy *.exe ..\bin
+#
+
+#
+# Borland C++ for OS/2
+#
+#CC=bcc
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -w- -DUSER_ZZSYN
+#OUT_OBJ = -o
+#LIBS= c2 os2
+#
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#OBJ_EXT = obj
+#dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj \
+# output.obj relabel.obj automata.obj
+# tlink @&&|
+#c02 $** -c
+#dlg.exe
+#
+#C2 os2
+#
+#|
+# copy *.exe ..\bin
+#
+
+#
+# UNIX
+#
+ifeq ($(CXX), llvm)
+BUILD_CC?=$(CLANG_BIN)clang
+else
+BUILD_CC?=cc
+endif
+COPT=-O
+ANTLR=${BIN_DIR}/antlr
+DLG=${BIN_DIR}/dlg
+BUILD_CFLAGS= $(COPT) -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN -DZZLEXBUFSIZE=65536
+BUILD_CPPFLAGS=
+OBJ_EXT=o
+OUT_OBJ = -o
+OBJ = dlg_p.o dlg_a.o main.o err.o set.o support.o output.o \
+ relabel.o automata.o
+
+$(BIN_DIR)/dlg : $(OBJ) $(SRC)
+ $(BUILD_CC) $(BUILD_CFLAGS) -o $(BIN_DIR)/dlg $(OBJ)
+
+SRC = dlg_p.c dlg_a.c main.c err.c $(SET)/set.c support.c output.c \
+ relabel.c automata.c
+
+#dlg_p.c parser.dlg err.c tokens.h : dlg_p.g
+# $(ANTLR) dlg_p.g
+
+#dlg_a.c mode.h : parser.dlg
+# $(DLG) -C2 parser.dlg dlg_a.c
+
+dlg_p.$(OBJ_EXT) : dlg_p.c dlg.h tokens.h mode.h
+ $(BUILD_CC) $(BUILD_CFLAGS) -c dlg_p.c
+
+dlg_a.$(OBJ_EXT) : dlg_a.c dlg.h tokens.h mode.h
+ $(BUILD_CC) $(BUILD_CFLAGS) -c dlg_a.c
+
+main.$(OBJ_EXT) : main.c dlg.h
+ $(BUILD_CC) $(BUILD_CFLAGS) -c main.c
+
+set.$(OBJ_EXT) : $(SET)/set.c
+ $(BUILD_CC) -c $(BUILD_CFLAGS) $(SET)/set.c
+
+%.o : %.c
+ $(BUILD_CC) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
+
+lint:
+ lint *.c
+
+#clean up all the intermediate files
+clean:
+ rm -f $(BIN_DIR)/dlg *.$(OBJ_EXT) core
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile.cygwin b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile.cygwin
new file mode 100644
index 000000000..bbba820d1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile.cygwin
@@ -0,0 +1,157 @@
+#
+# Makefile for DLG 1.33
+# Terence Parr
+# Purdue University, U of MN, Parr Research Corporation
+# 1989-1994
+#
+# Ported to IBM C-Set/2 and Microsoft 6.0 by
+# Ed Harfmann
+# Micro Data Base Systems
+# Lafayette, Indiana
+#
+SET=../support/set
+PCCTS_H=../h
+
+##
+## Uncomment the appropriate section to build
+##
+
+#
+# OS/2 & DOS 16 bit using MSC 6.0
+#
+#CC=cl
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /AL /Za /W3 -DPC -DUSER_ZZSYN
+#OUT_OBJ = -Fo
+#LIBS=/NOD:LLIBCE LLIBCEP
+#OBJ_EXT = obj
+#
+#dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj \
+# output.obj relabel.obj automata.obj
+# link @<<
+#$** /NOI
+#$@ /STACK:16384
+#
+#$(LIBS: = +^
+#)
+#$(DEF_FILE) $(LFLAGS) ;
+#<<
+# bind $@ c:\os2\doscalls.lib
+# copy *.exe ..\bin
+#
+
+#
+# Borland C++ for DOS
+#
+#CC=bcc
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -ml -ff- -w- -DPC -DUSER_ZZSYN
+#OUT_OBJ = -o
+#LIBS= emu mathl cl
+#OBJ_EXT = obj
+#
+#dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj \
+# output.obj relabel.obj automata.obj
+# tlink @&&|
+#C0L $**
+#$@ /Tde /c
+#
+#$(LIBS)
+#$(DEF_FILE) $(LFLAGS) ;
+#|
+# copy *.exe ..\bin
+#
+
+#
+# C-Set/2 for OS/2
+#
+#CC=icc
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /Sa /W3 /DUSER_ZZSYN
+#OUT_OBJ = -Fo
+#LIBS=
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#OBJ_EXT=obj
+#
+#dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj \
+# output.obj relabel.obj automata.obj
+# link386 @<<
+#$** /NOI
+#$@ /STACK:32768
+#
+#$(LIBS: = +^
+#)
+#$(DEF_FILE) $(LFLAGS) ;
+#<<
+# copy *.exe ..\bin
+#
+
+#
+# Borland C++ for OS/2
+#
+#CC=bcc
+#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -w- -DUSER_ZZSYN
+#OUT_OBJ = -o
+#LIBS= c2 os2
+#
+#ANTLR=..\bin\antlr
+#DLG=..\bin\dlg
+#OBJ_EXT = obj
+#dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj \
+# output.obj relabel.obj automata.obj
+# tlink @&&|
+#c02 $** -c
+#dlg.exe
+#
+#C2 os2
+#
+#|
+# copy *.exe ..\bin
+#
+
+#
+# UNIX
+#
+BIN_DIR=../../../../bin
+CC=cc
+COPT=-O
+ANTLR=$(BIN_DIR)/antlr.exe
+DLG=${BIN_DIR}/dlg.exe
+CFLAGS= $(COPT) -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN -DZZLEXBUFSIZE=65536
+OBJ_EXT=o
+OUT_OBJ = -o
+OBJ = dlg_p.o dlg_a.o main.o err.o set.o support.o output.o \
+ relabel.o automata.o
+
+dlg : $(OBJ) $(SRC)
+ $(CC) $(CFLAGS) -o $(BIN_DIR)/dlg.exe $(OBJ)
+
+SRC = dlg_p.c dlg_a.c main.c err.c $(SET)/set.c support.c output.c \
+ relabel.c automata.c
+
+#dlg_p.c parser.dlg err.c tokens.h : dlg_p.g
+# $(ANTLR) dlg_p.g
+
+#dlg_a.c mode.h : parser.dlg
+# $(DLG) -C2 parser.dlg dlg_a.c
+
+dlg_p.$(OBJ_EXT) : dlg_p.c dlg.h tokens.h mode.h
+ $(CC) $(CFLAGS) -c dlg_p.c
+
+dlg_a.$(OBJ_EXT) : dlg_a.c dlg.h tokens.h mode.h
+ $(CC) $(CFLAGS) -c dlg_a.c
+
+main.$(OBJ_EXT) : main.c dlg.h
+ $(CC) $(CFLAGS) -c main.c
+
+set.$(OBJ_EXT) : $(SET)/set.c
+ $(CC) -c $(CFLAGS) $(SET)/set.c
+
+lint:
+ lint *.c
+
+#clean up all the intermediate files
+clean:
+ rm -f *.$(OBJ_EXT) core
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile1 b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile1
new file mode 100644
index 000000000..4d00f7966
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile1
@@ -0,0 +1,63 @@
+#
+# Makefile for DLG 1.33
+# Terence Parr
+# Purdue University, U of MN, Parr Research Corporation
+# 1989-1994
+#
+# Ported to IBM C-Set/2 and Microsoft 6.0 by
+# Ed Harfmann
+# Micro Data Base Systems
+# Lafayette, Indiana
+#
+SET=../support/set
+PCCTS_H=../h
+
+##
+## Uncomment the appropriate section to build
+##
+
+
+#
+# UNIX
+#
+CC=cc
+ANTLR=../bin/antlr
+DLG=../bin/dlg
+ANSI=-ansi
+CFLAGS= -O -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN $(COTHER) $(ANSI) -DZZLEXBUFSIZE=32000
+OBJ_EXT=o
+OUT_OBJ = -o
+OBJ = dlg_p.o dlg_a.o main.o err.o set.o support.o output.o \
+ relabel.o automata.o
+
+dlg : $(OBJ) $(SRC)
+ $(CC) $(CFLAGS) -o dlg $(OBJ)
+ mv dlg ../bin
+
+SRC = dlg_p.c dlg_a.c main.c err.c $(SET)/set.c support.c output.c \
+ relabel.c automata.c
+
+dlg_p.c parser.dlg err.c tokens.h : dlg_p.g
+ $(ANTLR) dlg_p.g
+
+dlg_a.c mode.h : parser.dlg
+ $(DLG) -C2 parser.dlg dlg_a.c
+
+dlg_p.$(OBJ_EXT) : dlg_p.c dlg.h tokens.h mode.h
+ $(CC) $(CFLAGS) -c dlg_p.c
+
+dlg_a.$(OBJ_EXT) : dlg_a.c dlg.h tokens.h mode.h
+ $(CC) $(CFLAGS) -c dlg_a.c
+
+main.$(OBJ_EXT) : main.c dlg.h
+ $(CC) $(CFLAGS) -c main.c
+
+set.$(OBJ_EXT) : $(SET)/set.c
+ $(CC) -c $(CFLAGS) $(SET)/set.c
+
+lint:
+ lint *.c
+
+#clean up all the intermediate files
+clean:
+ rm -f *.$(OBJ_EXT) core
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/mode.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/mode.h
new file mode 100644
index 000000000..3f3279e52
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/mode.h
@@ -0,0 +1,4 @@
+#define START 0
+#define ACT 1
+#define ACTION_COMMENTS 2
+#define ACTION_CPP_COMMENTS 3
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/output.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/output.c
new file mode 100644
index 000000000..2e56a6d8c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/output.c
@@ -0,0 +1,850 @@
+/* output.c, output generator for dlg
+ *
+ * Output Notes:
+ *
+ * DfaStates == number of dfa nodes in automaton (just a #define)
+ * DfaState == type large enough to index every node in automaton
+ * <256 unsigned char, <65536 unsigned short, etc.
+ *
+ * Thus, the elements in each of the automaton states (st%d) are type DfaState
+ * and are size appropriately, since they must be able to index the next
+ * automaton state.
+ *
+ * dfa[] == a linear array that points to all the automaton states (st%d)
+ * (dfa_base[] should be the same, but isn't right now)
+ *
+ * accepts[] == Taking a closer look at this one, it probably shouldn't be type
+ * DfaState because there is no real requirement that the number of
+ * accepts states is less than the number of dfa state. However, if
+ * the number of accept states was more than the number of DFA states
+ * then the lexical specification would be really ambiguous.
+ *
+ * Another note. Is that is should be possible to fold accepts[] and
+ * actions[] together. If this is done, I would suggest get rid of
+ * accept[] and make actions[] have an entry for each state (st%d) in
+ * the automaton.
+ *
+ * dfa_base[] == starting location for each lexical mode. This should be
+ * Dfastate type (but isn't right now), since it points to the states
+ * in the automaton.
+ *
+ * dfa_class_no[] == indicates the number of columns each lexical mode has.
+ *
+ * b_class_no[] == pointer to the start of the translation array used to
+ * convert from input character to character class. This could cause
+ * problems if there are more than 256 classes
+ *
+ * shift%d[] == the actual translation arrays that convert the input character
+ * into the character class. These will have to change if there are
+ * more than 256 character classes.
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * DLG 1.33
+ * Will Cohen
+ * With mods by Terence Parr; AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "dlg.h"
+#ifdef MEMCHK
+#include "trax.h"
+#else
+#ifdef __STDC__
+#include <stdlib.h>
+#else
+#include <malloc.h>
+#endif /* __STDC__ */
+#endif
+
+static char *mode_name[MAX_MODES];
+static int mode_number[MAX_MODES];
+static int cur_mode=0;
+
+int operation_no = 0; /* used to mark nodes so that infinite loops avoided */
+int dfa_basep[MAX_MODES]; /* start of each group of states */
+int dfa_class_nop[MAX_MODES]; /* number of elements in each group of states*/
+
+int gen_ansi = FALSE; /* allows ansi code to be generated */
+
+FILE *input_stream; /* where to read description from */
+FILE *output_stream; /* where to put the output */
+FILE *mode_stream; /* where to put the mode.h stuff */
+FILE *class_stream; /* where to put the scan.h stuff (if gen_cpp) */
+
+/* NOTE: This section is MACHINE DEPENDENT */
+#define DIF_SIZE 4
+#if defined(PC) && !defined(PC32)
+unsigned long typesize[DIF_SIZE] = { 0x7f, 0x7fff, 0x7ffful, 0x7ffffffful }; /* MR20 */
+char t0[] = "unsigned char";
+char t1[] = "unsigned short";
+char t2[] = "unsigned int";
+char t3[] = "unsigned long";
+char *typevar[DIF_SIZE] = { t0, t1, t2, t3};
+#else
+unsigned long typesize[DIF_SIZE] = { 0x7f, 0x7fff, 0x7ffffffful, 0x7ffffffful }; /* MR20 */
+char t0[] = "unsigned char";
+char t1[] = "unsigned short";
+char t2[] = "unsigned int";
+char t3[] = "unsigned long";
+char *typevar[DIF_SIZE] = { t0, t1, t2, t3};
+#endif
+
+/* Added by TJP August 1994 */
+/* Take in MyLexer and return MyLexer_h */
+
+static char *
+#ifdef __USE_PROTOS
+gate_symbol(char *name)
+#else
+gate_symbol(name)
+char *name;
+#endif
+{
+ static char buf[100];
+ sprintf(buf, "%s_h", name);
+ return buf;
+}
+
+/* Added by TJP August 1994 */
+static char *
+#ifdef __USE_PROTOS
+mystrdup(char *s)
+#else
+mystrdup(s)
+char *s;
+#endif
+{
+ char *p = (char *)malloc(strlen(s)+1);
+ strcpy(p, s);
+ return p;
+}
+
+#ifdef __USE_PROTOS
+void p_class_hdr(void)
+#else
+void p_class_hdr()
+#endif
+{
+ if ( class_stream == NULL ) return;
+ fprintf(class_stream, "#ifndef %s\n", gate_symbol(ClassName("")));
+ fprintf(class_stream, "#define %s\n", gate_symbol(ClassName("")));
+ fprintf(class_stream, "/*\n");
+ fprintf(class_stream, " * D L G L e x e r C l a s s D e f i n i t i o n\n");
+ fprintf(class_stream, " *\n");
+ fprintf(class_stream, " * Generated from:");
+ fprintf(class_stream, " %s", file_str[0]);
+ fprintf(class_stream, "\n");
+ fprintf(class_stream, " *\n");
+ fprintf(class_stream, " * 1989-2001 by Will Cohen, Terence Parr, and Hank Dietz\n");
+ fprintf(class_stream, " * Purdue University Electrical Engineering\n");
+ fprintf(class_stream, " * DLG Version %s\n", version);
+ fprintf(class_stream, " */\n\n");
+ fprintf(class_stream, "\n");
+ fprintf(class_stream, "#include \"%s\"\n", DLEXERBASE_H);
+}
+
+/* MR1 */
+/* MR1 16-Apr-97 Split printing of class header up into several parts */
+/* MR1 so that #lexprefix <<...>>and #lexmember <<...>> */
+/* MR1 can be inserted in the appropriate spots */
+/* MR1 */
+
+#ifdef __USE_PROTOS
+void p_class_def1(void)
+#else
+void p_class_def1()
+#endif
+{
+ if ( class_stream == NULL ) return;
+ fprintf(class_stream, "\nclass %s : public DLGLexerBase {\n", ClassName(""));
+ fprintf(class_stream, "public:\n");
+}
+
+#ifdef __USE_PROTOS
+void p_class_def2(void)
+#else
+void p_class_def2()
+#endif
+{
+ int i, m;
+ if ( class_stream == NULL ) return;
+ fprintf(class_stream, "public:\n");
+ fprintf(class_stream, "\tstatic const int MAX_MODE;\n");
+ fprintf(class_stream, "\tstatic const int DfaStates;\n");
+ for (i=0; i<cur_mode; i++) {
+ fprintf(class_stream, "\tstatic const int %s;\n", mode_name[i]);
+ }
+
+ fprintf(class_stream, "\ttypedef %s DfaState;\n\n", minsize(dfa_allocated));
+ fprintf(class_stream, "\t%s(DLGInputStream *in,\n",ClassName(""));
+ fprintf(class_stream, "\t\tunsigned bufsize=2000)\n");
+ fprintf(class_stream, "\t\t: DLGLexerBase(in, bufsize, %d)\n", interactive);
+ fprintf(class_stream, "\t{\n");
+ fprintf(class_stream, "\t;\n");
+ fprintf(class_stream, "\t}\n");
+ fprintf(class_stream, "\tvoid mode(int);\n");
+ fprintf(class_stream, "\tANTLRTokenType nextTokenType(void);\n");
+ fprintf(class_stream, "\tvoid advance(void);\n");
+ fprintf(class_stream, "protected:\n");
+ for (i=1; i<=action_no; ++i) {
+ fprintf(class_stream, "\tANTLRTokenType act%d();\n", i);
+ }
+
+ for(m=0; m<(mode_counter-1); ++m){
+ for(i=dfa_basep[m]; i<dfa_basep[m+1]; ++i)
+ fprintf(class_stream, "\tstatic DfaState st%d[%d];\n", i-1, dfa_class_nop[m]+1);
+ }
+ for(i=dfa_basep[m]; i<=dfa_allocated; ++i)
+ fprintf(class_stream, "\tstatic DfaState st%d[%d];\n", i-1, dfa_class_nop[m]+1);
+
+ fprintf(class_stream, "\tstatic DfaState *dfa[%d];\n", dfa_allocated);
+ fprintf(class_stream, "\tstatic DfaState dfa_base[];\n");
+/* fprintf(class_stream, "\tstatic int dfa_base_no[];\n"); */
+ fprintf(class_stream, "\tstatic unsigned char *b_class_no[];\n");
+ fprintf(class_stream, "\tstatic DfaState accepts[%d];\n",dfa_allocated+1);
+ fprintf(class_stream, "\tstatic DLGChar alternatives[%d];\n",dfa_allocated+1);
+ /* WARNING: should be ANTLRTokenType for action table, but g++ 2.5.6 is hosed */
+ fprintf(class_stream, "\tstatic ANTLRTokenType (%s::*actions[%d])();\n", ClassName(""), action_no+1);
+ for(m=0; m<mode_counter; ++m) {
+ fprintf(class_stream, "\tstatic unsigned char shift%d[%d];\n",
+ m, CHAR_RANGE);
+ }
+ if (comp_level)
+ fprintf(class_stream, "\tint ZZSHIFT(int c) { return b_class_no[automaton][1+c]; }\n");
+ else
+ fprintf(class_stream, "\tint ZZSHIFT(int c) { return 1+c; }\n");
+
+/* MR1 */
+/* MR1 11-APr-97 Kludge to allow inclusion of user-defined code in */
+/* MR1 DLGLexer class header */
+/* MR1 Deprecated in favor of 133MR1 addition #lexmember <<>> */
+/* MR1 */
+/* MR1 */ fprintf(class_stream,"//\n");
+/* MR1 */ fprintf(class_stream,
+/* MR1 */ "// 133MR1 Deprecated feature to allow inclusion of ");
+/* MR1 */ fprintf(class_stream,
+/* MR1 */ "user-defined code in DLG class header\n");
+/* MR1 */ fprintf(class_stream,"//\n");
+/* MR1 */
+/* MR1 */ fprintf(class_stream,"#ifdef DLGLexerIncludeFile\n");
+/* MR1 */ fprintf(class_stream,"#include DLGLexerIncludeFile\n");
+/* MR1 */ fprintf(class_stream,"#endif\n");
+
+ fprintf(class_stream, "};\n");
+
+ fprintf(class_stream, "typedef ANTLRTokenType (%s::*Ptr%sMemberFunc)();\n",
+ ClassName(""), ClassName(""));
+
+ fprintf(class_stream, "#endif\n");
+}
+
+/* generate required header on output */
+
+#ifdef __USE_PROTOS
+void p_head(void)
+#else
+void p_head()
+#endif
+{
+ fprintf(OUT, "/*\n");
+ fprintf(OUT, " * D L G tables\n");
+ fprintf(OUT, " *\n");
+ fprintf(OUT, " * Generated from:");
+ fprintf(OUT, " %s", file_str[0]);
+ fprintf(OUT, "\n");
+ fprintf(OUT, " *\n");
+ fprintf(OUT, " * 1989-2001 by Will Cohen, Terence Parr, and Hank Dietz\n");
+ fprintf(OUT, " * Purdue University Electrical Engineering\n");
+ fprintf(OUT, " * DLG Version %s\n", version);
+ fprintf(OUT, " */\n\n");
+ if ( gen_cpp) fprintf(OUT, "#include \"pcctscfg.h\"\n");
+ if ( gen_cpp ) fprintf(OUT, "#include \"pccts_stdio.h\"\n");
+ if ( !gen_cpp ) fprintf(OUT, "#include \"%s\"\n\n", mode_file);
+ fprintf(OUT,"\n");
+}
+
+#ifdef __USE_PROTOS
+void p_includes(void)
+#else
+void p_includes()
+#endif
+{
+ fprintf(OUT, "#include \"%s\"\n", APARSER_H);
+ fprintf(OUT, "#include \"%s\"\n", DLEXERBASE_H);
+ fprintf(OUT, "#include \"%s\"\n", ClassName(".h"));
+}
+
+/* generate code to tie up any loose ends */
+
+#ifdef __USE_PROTOS
+void p_tail(void) /* MR1 */
+#else
+void p_tail() /* MR1 */
+#endif
+{
+ if ( gen_cpp ) {
+ if ( strcmp(ClassName(""), DEFAULT_CLASSNAME)!=0 )
+ fprintf(OUT, "#define DLGLexer %s\n", ClassName(""));
+ fprintf(OUT, "#include \"%s\"\n", DLEXER_H); /* MR23 Rename DLexer.cpp to DLexer.h */
+ return;
+ }
+ fprintf(OUT, "\n");
+ fprintf(OUT, "\n");
+ if (comp_level)
+ fprintf(OUT, "#define ZZSHIFT(c) (b_class_no[zzauto][1+c])\n");
+ else
+ fprintf(OUT, "#define ZZSHIFT(c) (1+c)\n");
+ if ( !gen_cpp ) fprintf(OUT, "#define MAX_MODE %d\n",mode_counter);
+ fprintf(OUT, "#include \"dlgauto.h\"\n");
+}
+
+
+/* output the table of DFA for general use */
+
+#ifdef __USE_PROTOS
+void p_tables()
+#else
+void p_tables()
+#endif
+{
+ if ( !gen_cpp ) {
+ fprintf(OUT, "#define DfaStates\t%d\n", dfa_allocated);
+ fprintf(OUT, "typedef %s DfaState;\n\n", minsize(dfa_allocated));
+ }
+
+ if ( gen_cpp ) {
+ int i;
+ fprintf(OUT, "\n");
+ fprintf(OUT, "const int %s::MAX_MODE=%d;\n",
+ ClassName(""),
+ mode_counter);
+ fprintf(OUT, "const int %s::DfaStates=%d;\n",
+ ClassName(""),
+ dfa_allocated);
+ for (i=0; i<cur_mode; i++) {
+ fprintf(OUT, "const int %s::%s=%d;\n",
+ ClassName(""), mode_name[i], mode_number[i]);
+ }
+ fprintf(OUT, "\n");
+ }
+
+ p_node_table();
+ p_dfa_table();
+ p_accept_table();
+ p_action_table();
+ p_base_table();
+ p_class_table();
+ if (comp_level)
+ p_bshift_table();
+ if (interactive || gen_cpp )
+ p_alternative_table();
+}
+
+
+/* figures out the smallest variable type that will hold the transitions
+ */
+
+#ifdef __USE_PROTOS
+char *minsize(int elements)
+#else
+char *minsize(elements)
+int elements;
+#endif
+{
+ int i = 0;
+
+ while ((unsigned long) elements > typesize[i]) /* MR20 */
+ ++i;
+ return typevar[i];
+}
+
+
+#ifdef __USE_PROTOS
+void p_node_table(void)
+#else
+void p_node_table()
+#endif
+{
+ register int i;
+ register int m = 0;
+
+ for(m=0; m<(mode_counter-1); ++m){
+ for(i=dfa_basep[m]; i<dfa_basep[m+1]; ++i)
+ p_single_node(i,dfa_class_nop[m]);
+ }
+ for(i=dfa_basep[m]; i<=dfa_allocated; ++i)
+ p_single_node(i,dfa_class_nop[m]);
+}
+
+
+#ifdef __USE_PROTOS
+void p_single_node(int i,int classes)
+#else
+void p_single_node(i,classes)
+int i,classes;
+#endif
+{
+ register int j;
+ register int trans, items_on_line;
+
+#if 1
+ /* extra state (classes+1) for invalid characters */
+ fprintf(OUT, "%sDfaState %sst%d[%d] = {\n ",
+ gen_cpp?ClassName("::"):"static ",
+ gen_cpp?ClassName("::"):"",(i-1), (classes+1));
+#else
+ fprintf(OUT, "static DfaState st%d[%d] = {\n ", (i-1), classes);
+#endif
+ items_on_line = MAX_ON_LINE;
+ for(j=0; j<classes; ++j){
+ DAWDLE;
+ trans = DFA(i)->trans[j];
+ if (trans == NIL_INDEX)
+ trans = dfa_allocated+1;
+ /* all of DFA moved down one in array */
+ fprintf(OUT, "%d", trans-1);
+ fprintf(OUT, ", ");
+ if (!(--items_on_line)){
+ fprintf(OUT, "\n ");
+ items_on_line = MAX_ON_LINE;
+ }
+ }
+#if 1
+ /* put in jump to error state */
+ fprintf(OUT, "%d\n};\n\n", dfa_allocated);
+#else
+ fprintf(OUT, "\n};\n\n");
+#endif
+}
+
+
+#ifdef __USE_PROTOS
+void p_dfa_table(void)
+#else
+void p_dfa_table()
+#endif
+{
+ register int i;
+
+ fprintf(OUT, "\n%sDfaState *%sdfa[%d] = {\n",
+ gen_cpp?ClassName("::"):"",gen_cpp?ClassName("::"):"", dfa_allocated);
+ for (i=0; i<(dfa_allocated-1); ++i){
+ fprintf(OUT, "\tst%d,\n", i);
+ }
+ fprintf(OUT, "\tst%d\n", i);
+ fprintf(OUT, "};\n\n");
+}
+
+
+#ifdef __USE_PROTOS
+void p_accept_table(void)
+#else
+void p_accept_table()
+#endif
+{
+ register int i = 1;
+ register int items_on_line = 0;
+ int true_interactive = TRUE;
+
+ /* make sure element for one past (zzerraction) -WEC 12/16/92 */
+ fprintf(OUT,"\n%sDfaState %saccepts[%d] = {\n ",
+ gen_cpp?ClassName("::"):"",
+ gen_cpp?ClassName("::"):"",
+ dfa_allocated+1);
+ /* don't do anything if no dfa nodes */
+ if (i>dfa_allocated) goto skip_accepts;
+ for (;;) {
+ int accept=0; /* MR14a - Manuel Kessler (mlkessle@cip.physik.uni-wuerzburg.de) */
+ set accept_set;
+ set nfa_states;
+ unsigned int *t, *nfa_i;
+ unsigned int *q, *regular_expr;
+
+ accept_set = empty;
+ nfa_states = DFA(i)->nfa_states;
+ t = nfa_i = set_pdq(nfa_states);
+ /* NOTE: picks lowest accept because accepts monotonic */
+ /* with respect to nfa node numbers and set_pdq */
+ /* returns in that order */
+ while((*nfa_i != nil) && (!(accept = NFA(*nfa_i)->accept))){
+ nfa_i++;
+ }
+
+ /* figure out if more than one accept state there */
+ if (warn_ambig ){
+ set_orel(accept, &accept_set);
+ while(*nfa_i != nil){
+ set_orel(NFA(*nfa_i)->accept, &accept_set);
+ nfa_i++;
+ }
+ /* remove error action from consideration */
+ set_rm(0, accept_set);
+
+ if( set_deg(accept_set)>1){
+ fprintf(stderr, "dlg warning: ambiguous regular expression ");
+ q = regular_expr = set_pdq(accept_set);
+ while(*regular_expr != nil){
+ fprintf(stderr," %d ", *regular_expr);
+ ++regular_expr;
+ }
+ fprintf(stderr, "\n");
+ free(q);
+ }
+ }
+
+ if ((DFA(i)->alternatives) && (accept != 0)){
+ true_interactive = FALSE;
+ }
+ fprintf(OUT, "%d, ", accept);
+
+ /* free up memory before we "break" below -ATG 4/6/95 */
+ free(t);
+ set_free(accept_set);
+
+ if ((++i)>dfa_allocated)
+ break;
+ if ((++items_on_line)>=MAX_ON_LINE){
+ fprintf(OUT,"\n ");
+ items_on_line = 0;
+ }
+/*
+ free(t);
+ set_free(accept_set);
+*/
+ }
+ /* make sure element for one past (zzerraction) -WEC 12/16/92 */
+skip_accepts:
+ fprintf(OUT, "0\n};\n\n");
+}
+
+
+#ifdef __USE_PROTOS
+void p_action_table(void)
+#else
+void p_action_table()
+#endif
+{
+ register int i;
+ char* theClassName = ClassName("");
+
+ if ( gen_cpp )
+ fprintf(OUT, "Ptr%sMemberFunc %s::actions[%d] = {\n", theClassName,
+ theClassName, action_no+1);
+ else
+ fprintf(OUT, "void (*actions[%d])() = {\n", action_no+1);
+ if ( gen_cpp )
+/* fprintf(OUT, "\t(Ptr%sMemberFunc)&%s::erraction,\n", theClassName, theClassName);*/
+ fprintf(OUT, "\t&%s::erraction,\n", theClassName);
+ else
+ fprintf(OUT, "\tzzerraction,\n");
+ for (i=1; i<action_no; ++i) {
+ if ( gen_cpp )
+/* fprintf(OUT,"\t(Ptr%sMemberFunc)&%s::act%d,\n", theClassName, theClassName, i);*/
+ fprintf(OUT,"\t&%s::act%d,\n", theClassName, i);
+ else
+ fprintf(OUT,"\tact%d,\n", i);
+ DAWDLE;
+ }
+ if ( gen_cpp )
+/* fprintf(OUT,"\t(Ptr%sMemberFunc)&%s::act%d\n", theClassName, theClassName, i);*/
+ fprintf(OUT,"\t&%s::act%d\n", theClassName, i);
+ else
+ fprintf(OUT,"\tact%d\n", i);
+ fprintf(OUT, "};\n\n");
+}
+
+
+#ifdef __USE_PROTOS
+void p_shift_table(int m) /* MR1 */
+#else
+void p_shift_table(m) /* MR1 */
+int m;
+#endif
+{
+ register int i = 0, j;
+ register int items_on_line = 0;
+
+ fprintf(OUT, "%s unsigned char %sshift%d[%d] = {\n ",
+ gen_cpp?"":"static",
+ gen_cpp?ClassName("::"):"", m, CHAR_RANGE);
+ for (;;) {
+ /* find which partition character i is in */
+ for (j=0; j<dfa_class_nop[mode_counter]; ++j){
+ if (set_el(i,class_sets[j]))
+ break;
+ }
+ fprintf(OUT,"%d",j);
+ if ((++i)>=CHAR_RANGE)
+ break;
+ fprintf(OUT,", ");
+ if ((++items_on_line)>=MAX_ON_LINE){
+ fprintf(OUT,"\n ");
+ items_on_line = 0;
+ }
+ }
+ fprintf(OUT, "\n};\n\n");
+}
+
+
+#ifdef __USE_PROTOS
+void p_base_table(void)
+#else
+void p_base_table()
+#endif
+{
+ register int m;
+
+ fprintf(OUT, "%sDfaState %sdfa_base[] = {\n",
+ gen_cpp?ClassName("::"):"static ",
+ gen_cpp?ClassName("::"):"");
+ for(m=0; m<(mode_counter-1); ++m)
+ fprintf(OUT, "\t%d,\n", dfa_basep[m]-1);
+ fprintf(OUT, "\t%d\n};\n\n", dfa_basep[m]-1);
+}
+
+
+#ifdef __USE_PROTOS
+void p_class_table(void) /* MR1 */
+#else
+void p_class_table() /* MR1 */
+#endif
+{
+#if 0
+ register int m;
+
+ fprintf(OUT,"%s int %sdfa_class_no[] = {\n",
+ gen_cpp?"":"static",
+ gen_cpp?ClassName("::"):"");
+ for(m=0; m<(mode_counter-1); ++m)
+ fprintf(OUT,"\t%d,\n", dfa_class_nop[m]);
+ fprintf(OUT,"\t%d\n};\n\n", dfa_class_nop[m]);
+#endif
+}
+
+
+#ifdef __USE_PROTOS
+void p_bshift_table(void) /* MR1 */
+#else
+void p_bshift_table() /* MR1 */
+#endif
+{
+ register int m;
+
+ fprintf(OUT,"%s unsigned char *%sb_class_no[] = {\n",
+ gen_cpp?"":"static",
+ gen_cpp?ClassName("::"):"");
+ for(m=0; m<(mode_counter-1); ++m)
+ fprintf(OUT, "\tshift%d,\n", m);
+ fprintf(OUT, "\tshift%d\n};\n\n", m);
+}
+
+
+#ifdef __USE_PROTOS
+void p_alternative_table(void) /* MR1 */
+#else
+void p_alternative_table() /* MR1 */
+#endif
+{
+ register int i;
+
+ if ( !gen_cpp ) fprintf(OUT, "#define ZZINTERACTIVE\n\n");
+ if ( gen_cpp )
+ fprintf(OUT, "DLGChar %salternatives[%d] = {\n", /* mr23 vhs %sDfaStates+1 */
+ ClassName("::"),
+ dfa_allocated+1); /* vhs ClassName("::")); */
+ else
+ fprintf(OUT, "static %s zzalternatives[DfaStates+1] = {\n",
+ minsize(dfa_allocated));
+
+ for(i=1; i<=dfa_allocated; ++i)
+ fprintf(OUT, "\t%d,\n", DFA(i)->alternatives);
+ fprintf(OUT, "/* must have 0 for zzalternatives[DfaStates] */\n");
+ fprintf(OUT, "\t0\n};\n\n");
+}
+
+
+#ifdef __USE_PROTOS
+void p_mode_def(char *s,int m) /* MR1 */
+#else
+void p_mode_def(s,m) /* MR1 */
+char *s;
+int m;
+#endif
+{
+ if ( gen_cpp )
+ {
+ mode_name[cur_mode] = mystrdup(s);
+ mode_number[cur_mode] = m;
+ cur_mode++;
+ }
+ else
+ fprintf(mode_stream, "#define %s %d\n", s, m);
+}
+
+#ifdef __USE_PROTOS
+char * ClassName(char *suffix)
+#else
+char * ClassName(suffix)
+char *suffix;
+#endif
+{
+ static char buf[200];
+ extern char *class_name;
+
+ sprintf(buf, "%s%s", class_name, suffix);
+ return buf;
+}
+
+#ifdef DEBUG
+
+/* print out a particular nfa node that is pointed to by p */
+
+#ifdef __USE_PROTOS
+void p_nfa_node(nfa_node *p)
+#else
+void p_nfa_node(p)
+nfa_node *p;
+#endif
+{
+ register nfa_node *t;
+
+ if (p != NIL_INDEX){
+ printf("NFA state : %d\naccept state : %d\n",
+ NFA_NO(p),p->accept);
+ if (p->trans[0] != NIL_INDEX){
+ printf("trans[0] => %d on ", NFA_NO(p->trans[0]));
+ p_set(p->label);
+ printf("\n");
+ }
+ else
+ printf("trans[0] => nil\n");
+ if (p->trans[1] != NIL_INDEX)
+ printf("trans[1] => %d on epsilon\n",
+ NFA_NO(p->trans[1]));
+ else
+ printf("trans[1] => nil\n");
+ printf("\n");
+ }
+}
+#endif
+
+#ifdef DEBUG
+
+/* code to print out special structures when using a debugger */
+
+#ifdef __USE_PROTOS
+void p_nfa(p)
+#else
+void p_nfa(nfa_node *p)
+nfa_node *p; /* state number also index into array */
+#endif
+{
+/* each node has a marker on it so it only gets printed once */
+
+ operation_no++; /* get new number */
+ s_p_nfa(p);
+}
+
+#ifdef __USE_PROTOS
+void s_p_nfa(nfa_node *p)
+#else
+void s_p_nfa(p)
+nfa_node *p; /* state number also index into array */
+#endif
+{
+ if ((p != NIL_INDEX) && (p->nfa_set != operation_no)){
+ /* so it is only printed once */
+ p->nfa_set = operation_no;
+ p_nfa_node(p);
+ s_p_nfa(p->trans[0]);
+ s_p_nfa(p->trans[1]);
+ }
+}
+
+#ifdef __USE_PROTOS
+void p_dfa_node(dfa_node *p)
+#else
+void p_dfa_node(p)
+dfa_node *p;
+#endif
+{
+ int i;
+
+ if (p != NIL_INDEX){
+ printf("DFA state :%d\n",NFA_NO(p));
+ if (p->done)
+ printf("done\n");
+ else
+ printf("undone\n");
+ printf("from nfa states : ");
+ p_set(p->nfa_states);
+ printf("\n");
+ /* NOTE: trans arcs stored as ints rather than pointer*/
+ for (i=0; i<class_no; i++){
+ printf("%d ",p->trans[i]);
+ }
+ printf("\n\n");
+ }
+}
+
+#ifdef __USE_PROTOS
+void p_dfa(void)
+#else
+void p_dfa()
+#endif
+{
+/* prints out all the dfa nodes actually allocated */
+
+ int i;
+
+ for (i = 1; i<=dfa_allocated; i++)
+ p_dfa_node(NFA(i));
+}
+
+
+/* print out numbers in the set label */
+
+#ifdef __USE_PROTOS
+void p_set(set label)
+#else
+void p_set(label)
+set label;
+#endif
+{
+ unsigned *t, *e;
+
+ if (set_nil(label)){
+ printf("epsilon\n");
+ }else{
+ t = e = set_pdq(label);
+ while(*e != nil){
+ printf("%d ", (*e+MIN_CHAR));
+ e++;
+ }
+ printf("\n");
+ free(t);
+ }
+
+}
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/parser.dlg b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/parser.dlg
new file mode 100644
index 000000000..df9a637f9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/parser.dlg
@@ -0,0 +1,398 @@
+<<
+/* parser.dlg -- DLG Description of scanner
+ *
+ * Generated from: dlg_p.g
+ *
+ * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
+ * Purdue University Electrical Engineering
+ * With AHPCRC, University of Minnesota
+ * ANTLR Version 1.33MR33
+ */
+
+#define ANTLR_VERSION 13333
+#include "pcctscfg.h"
+#include "pccts_stdio.h"
+
+#include <ctype.h>
+#include "dlg.h"
+#include "antlr.h"
+#include "tokens.h"
+#include "dlgdef.h"
+LOOKAHEAD
+
+void
+#ifdef __USE_PROTOS
+zzerraction(void)
+#else
+zzerraction()
+#endif
+{
+ (*zzerr)("invalid token");
+ zzadvance();
+ zzskip();
+}
+>>
+
+<<%%lexaction
+
+int func_action; /* should actions be turned into functions?*/
+int lex_mode_counter = 0; /* keeps track of the number of %%names */
+/* MR1 */
+/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
+/* MR1 via <<%%lexmember...>> */
+/* MR1 */
+int lexMember = 0; /* <<%%lexmemeber ...>> MR1 */
+int lexAction = 0; /* <<%%lexaction ...>> MR1 */
+int parserClass = 0; /* <<%%parserclass ...>> MR1 */
+int lexPrefix = 0; /* <<%%lexprefix ...>> MR1 */
+char theClassName[100]; /* MR11 */
+char *pClassName=theClassName; /* MR11 */
+int firstLexMember=1; /* MR1 */
+
+#ifdef __USE_PROTOS
+void xxputc(int c) { /* MR1 */
+#else
+ void xxputc(c) /* MR1 */
+ int c; /* MR1 */
+ { /* MR1 */
+#endif
+ if (parserClass) { /* MR1 */
+ *pClassName++=c; /* MR1 */
+ *pClassName=0; /* MR1 */
+ } else if (lexMember || lexPrefix) { /* MR1 */
+ if (class_stream != NULL) fputc(c,class_stream); /* MR1 */
+ } else { /* MR1 */
+ fputc(c,OUT); /* MR1 */
+ }; /* MR1 */
+ } /* MR1 */
+
+#ifdef __USE_PROTOS
+ void xxprintf(char *format,char *string) { /* MR1 */
+#else
+ void xxprintf(format,string) /* MR1 */
+ char *format; /* MR1 */
+ char *string; /* MR1 */
+ { /* MR1 */
+#endif
+ if (lexMember || lexPrefix || parserClass) { /* MR1 */
+ if (class_stream != NULL) /* MR1 */
+ fprintf(class_stream,format,string); /* MR1 */
+ } else { /* MR1 */
+ fprintf(OUT,format,string); /* MR1 */
+ }; /* MR1 */
+ } /* MR1 */
+>>
+
+
+%%START
+
+@
+ <<
+ NLA = 1;
+ >>
+
+[\r\t\ ]+
+ <<
+ NLA = 2;
+ zzskip();
+ >>
+
+\n
+ <<
+ NLA = 3;
+ zzline++; zzskip(); DAWDLE;
+ >>
+
+\@
+ <<
+ NLA = L_EOF;
+ >>
+
+\%\%
+ <<
+ NLA = PER_PER;
+ >>
+
+\%\%[a-zA-Z_][a-zA-Z0-9_]*
+ <<
+ NLA = NAME_PER_PER;
+ p_mode_def(&zzlextext[2],lex_mode_counter++);
+ >>
+
+\<\<\%\%lexmember
+ <<
+ NLA = LEXMEMBER;
+ lexMember=1; /* MR1 */
+ if (firstLexMember != 0) { /* MR1 */
+ firstLexMember=0; /* MR1 */
+ p_class_def1(); /* MR1 */
+ }; /* MR1 */
+ zzmode(ACT); /* MR1 */
+ >>
+
+\<\<\%\%lexaction
+ <<
+ NLA = LEXACTION;
+ lexAction=1;zzmode(ACT);
+ >>
+
+\<\<\%\%parserclass
+ <<
+ NLA = PARSERCLASS;
+ parserClass=1; /* MR1 */
+ zzmode(ACT); /* MR1 */
+ >>
+
+\<\<\%\%lexprefix
+ <<
+ NLA = LEXPREFIX;
+ lexPrefix=1;zzmode(ACT);
+ >>
+
+\<\<
+ <<
+ NLA = ACTION;
+ if (func_action)
+ fprintf(OUT,"\n%s %sact%d()\n{ ",
+ gen_cpp?"ANTLRTokenType":"static void",
+ gen_cpp?ClassName("::"):"", ++action_no);
+ zzmode(ACT); zzskip();
+ >>
+
+\>\>
+ <<
+ NLA = GREAT_GREAT;
+ >>
+
+\{
+ <<
+ NLA = L_BRACE;
+ >>
+
+\}
+ <<
+ NLA = R_BRACE;
+ >>
+
+\(
+ <<
+ NLA = L_PAR;
+ >>
+
+\)
+ <<
+ NLA = R_PAR;
+ >>
+
+\[
+ <<
+ NLA = L_BRACK;
+ >>
+
+\]
+ <<
+ NLA = R_BRACK;
+ >>
+
+\*
+ <<
+ NLA = ZERO_MORE;
+ >>
+
+\+
+ <<
+ NLA = ONE_MORE;
+ >>
+
+\|
+ <<
+ NLA = OR;
+ >>
+
+\-
+ <<
+ NLA = RANGE;
+ >>
+
+\~
+ <<
+ NLA = NOT;
+ >>
+
+\\0[0-7]*
+ <<
+ NLA = OCTAL_VALUE;
+ {int t; sscanf(&zzlextext[1],"%o",&t); zzlextext[0] = t;}
+ >>
+
+\\0[Xx][0-9a-fA-F]+
+ <<
+ NLA = HEX_VALUE;
+ {int t; sscanf(&zzlextext[3],"%x",&t); zzlextext[0] = t;}
+ >>
+
+\\[1-9][0-9]*
+ <<
+ NLA = DEC_VALUE;
+ {int t; sscanf(&zzlextext[1],"%d",&t); zzlextext[0] = t;}
+ >>
+
+\\t
+ <<
+ NLA = TAB;
+ zzlextext[0] = '\t';
+ >>
+
+\\n
+ <<
+ NLA = NL;
+ zzlextext[0] = '\n';
+ >>
+
+\\r
+ <<
+ NLA = CR;
+ zzlextext[0] = '\r';
+ >>
+
+\\b
+ <<
+ NLA = BS;
+ zzlextext[0] = '\b';
+ >>
+
+\\ \n
+ <<
+ NLA = CONTINUATION;
+ zzline++; zzskip();
+ >>
+
+\\~[tnrb]
+ <<
+ NLA = LIT;
+ zzlextext[0] = zzlextext[1];
+ >>
+
+~[\\]
+ <<
+ NLA = REGCHAR;
+ >>
+
+
+%%ACT
+
+@
+ <<
+ NLA = 1;
+ error("unterminated action", zzline); zzmode(START);
+ >>
+
+\>\>
+ <<
+ NLA = ACTION;
+ if (func_action) fprintf(OUT,"}\n\n");
+ zzmode(START);
+ /* MR1 */
+ /* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
+ /* MR1 via <<%%lexmember ...>> */
+ /* MR1 This is a consequence of not saving actions */
+ /* MR1 */
+ /* MR1 */ parserClass=0;
+ /* MR1 */ lexPrefix=0;
+ /* MR1 */ lexAction=0;
+ /* MR1 */ lexMember=0;
+ >>
+
+\>
+ <<
+ NLA = 34;
+ xxputc(zzlextext[0]); zzskip();
+ >>
+
+\\\>
+ <<
+ NLA = 35;
+ xxputc('>'); zzskip();
+ >>
+
+\\
+ <<
+ NLA = 36;
+ xxputc('\\'); zzskip();
+ >>
+
+\n
+ <<
+ NLA = 37;
+ xxputc(zzlextext[0]); ++zzline; zzskip();
+ >>
+
+/\*
+ <<
+ NLA = 38;
+ zzmode(ACTION_COMMENTS); /* MR1 */
+ xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
+ >>
+
+//
+ <<
+ NLA = 39;
+ zzmode(ACTION_CPP_COMMENTS); /* MR1 */
+ xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
+ >>
+
+~[]
+ <<
+ NLA = 40;
+ xxputc(zzlextext[0]); zzskip();
+ >>
+
+
+%%ACTION_COMMENTS
+
+@
+ <<
+ NLA = 1;
+ >>
+
+\*/
+ <<
+ NLA = 41;
+ zzmode(ACT); /* MR1 */
+ xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
+ >>
+
+[\n\r]
+ <<
+ NLA = 42;
+ zzline++; xxputc(zzlextext[0]); zzskip();
+ >>
+
+~[]
+ <<
+ NLA = 43;
+ xxputc(zzlextext[0]); zzskip();
+ >>
+
+
+%%ACTION_CPP_COMMENTS
+
+@
+ <<
+ NLA = 1;
+ >>
+
+[\n\r]
+ <<
+ NLA = 44;
+ zzmode(ACT); zzline++; /* MR1 */
+ xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
+ >>
+
+~[]
+ <<
+ NLA = 45;
+ xxputc(zzlextext[0]); zzskip();
+ >>
+
+%%
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/relabel.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/relabel.c
new file mode 100644
index 000000000..f2dce30f5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/relabel.c
@@ -0,0 +1,217 @@
+/* This group of functions does the character class compression.
+ It goes over the dfa and relabels the arcs with the partitions
+ of characters in the NFA. The partitions are stored in the
+ array class.
+
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * DLG 1.33
+ * Will Cohen
+ * With mods by Terence Parr; AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include "dlg.h"
+#ifdef MEMCHK
+#include "trax.h"
+#else
+#ifdef __STDC__
+#include <stdlib.h>
+#else
+#include <malloc.h>
+#endif /* __STDC__ */
+#endif
+
+int class_no = CHAR_RANGE; /* number of classes for labels */
+int first_el[CHAR_RANGE]; /* first element in each class partition */
+set class_sets[CHAR_RANGE]; /* array holds partitions from class */
+ /* compression */
+
+/* goes through labels on NFA graph and partitions the characters into
+ * character classes. This reduces the amount of space required for each
+ * dfa node, since only one arc is required each class instead of one arc
+ * for each character
+ * level:
+ * 0 no compression done
+ * 1 remove unused characters from classes
+ * 2 compress equivalent characters into same class
+ *
+ * returns the number of character classes required
+ */
+#ifdef __USE_PROTOS
+int relabel(nfa_node* start,int level)
+#else
+int relabel(start,level)
+int level;
+nfa_node *start;
+#endif
+{
+ if (level){
+ set_free(used_classes);
+ partition(start,level);
+ label_with_classes(start);
+ }else{
+ /* classes equivalent to all characters in alphabet */
+ class_no = CHAR_RANGE;
+ }
+ return class_no;
+}
+
+/* makes character class sets for new labels */
+#ifdef __USE_PROTOS
+void partition(nfa_node* start,int level)
+#else
+void partition(start,level)
+nfa_node *start; /* beginning of nfa graph */
+int level; /* compression level to uses */
+#endif
+{
+ set current_class;
+ set unpart_chars;
+ set temp;
+
+ unpart_chars = set_dup(used_chars);
+#if 0
+ /* EOF (-1+1) alway in class 0 */
+ class_sets[0] = set_of(0);
+ first_el[0] = 0;
+ used_classes = set_of(0);
+ temp = set_dif(unpart_chars, class_sets[0]);
+ set_free(unpart_chars);
+ unpart_chars = temp;
+ class_no = 1;
+#else
+ class_no = 0;
+#endif
+ while (!set_nil(unpart_chars)){
+ /* don't look for equivalent labels if c <= 1 */
+ if (level <= 1){
+ current_class = set_of(set_int(unpart_chars));
+ }else{
+ current_class = set_dup(unpart_chars);
+ intersect_nfa_labels(start,&current_class);
+ }
+ set_orel(class_no,&used_classes);
+ first_el[class_no] = set_int(current_class);
+ class_sets[class_no] = current_class;
+ temp = set_dif(unpart_chars,current_class);
+ set_free(unpart_chars);
+ unpart_chars = temp;
+ ++class_no;
+ }
+
+ /* free unpart_chars -ATG 5/6/95 */
+ set_free(unpart_chars);
+
+#if 0
+ /* group all the other unused characters into a class */
+ set_orel(class_no,&used_classes);
+ first_el[class_no] = set_int(current_class);
+ class_sets[class_no] = set_dif(normal_chars,used_chars);
+ ++class_no;
+#endif
+}
+
+
+/* given pointer to beginning of graph and recursively walks it trying
+ * to find a maximal partition. This partition in returned in maximal_class
+ */
+#ifdef __USE_PROTOS
+void intersect_nfa_labels(nfa_node* start,set* maximal_class)
+#else
+void intersect_nfa_labels(start,maximal_class)
+nfa_node *start;
+set *maximal_class;
+#endif
+{
+ /* pick a new operation number */
+ ++operation_no;
+ r_intersect(start,maximal_class);
+}
+
+#ifdef __USE_PROTOS
+void r_intersect(nfa_node* start,set* maximal_class)
+#else
+void r_intersect(start,maximal_class)
+nfa_node *start;
+set * maximal_class;
+#endif
+{
+ set temp;
+
+ if(start && start->nfa_set != operation_no)
+ {
+ start->nfa_set = operation_no;
+ temp = set_and(*maximal_class,start->label);
+ if (!set_nil(temp))
+ {
+ set_free(*maximal_class);
+ *maximal_class = temp;
+ }else{
+ set_free(temp);
+ }
+ r_intersect(start->trans[0],maximal_class);
+ r_intersect(start->trans[1],maximal_class);
+ }
+}
+
+
+/* puts class labels in place of old character labels */
+#ifdef __USE_PROTOS
+void label_with_classes(nfa_node* start)
+#else
+void label_with_classes(start)
+nfa_node *start;
+#endif
+{
+ ++operation_no;
+ label_node(start);
+}
+
+#ifdef __USE_PROTOS
+void label_node(nfa_node *start)
+#else
+void label_node(start)
+nfa_node *start;
+#endif
+{
+ set new_label;
+ register int i;
+
+ /* only do node if it hasn't been done before */
+ if (start && start->nfa_set != operation_no){
+ start->nfa_set = operation_no;
+ new_label = empty;
+ for (i = 0; i<class_no; ++i){
+ /* if one element of class in old_label,
+ all elements are. */
+ if (set_el(first_el[i],start->label))
+ set_orel(i,&new_label);
+ }
+ set_free(start->label);
+ start->label = new_label;
+ /* do any nodes that can be reached from this one */
+ label_node(start->trans[0]);
+ label_node(start->trans[1]);
+ }
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/stdpccts.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/stdpccts.h
new file mode 100644
index 000000000..06ec67e44
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/stdpccts.h
@@ -0,0 +1,26 @@
+#ifndef STDPCCTS_H
+#define STDPCCTS_H
+/*
+ * stdpccts.h -- P C C T S I n c l u d e
+ *
+ * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
+ * Purdue University Electrical Engineering
+ * With AHPCRC, University of Minnesota
+ * ANTLR Version 1.33MR33
+ */
+
+#ifndef ANTLR_VERSION
+#define ANTLR_VERSION 13333
+#endif
+
+#include "pcctscfg.h"
+#include "pccts_stdio.h"
+
+#include <ctype.h>
+#include "dlg.h"
+#define zzSET_SIZE 8
+#include "antlr.h"
+#include "tokens.h"
+#include "dlgdef.h"
+#include "mode.h"
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/support.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/support.c
new file mode 100644
index 000000000..84fe99d69
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/support.c
@@ -0,0 +1,240 @@
+/*
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * DLG 1.33
+ * Will Cohen
+ * With mods by Terence Parr; AHPCRC, University of Minnesota
+ * 1989-2001
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "dlg.h"
+#ifdef MEMCHK
+#include "trax.h"
+#else
+#ifdef __STDC__
+#include <stdlib.h>
+#else
+#include <malloc.h>
+#endif /* __STDC__ */
+#endif
+
+int err_found = 0; /* indicates whether problem found */
+
+#ifdef __USE_PROTOS
+void internal_error(char *s, char *file,int line) /* MR9 23-Sep-97 */
+#else
+void internal_error(s,file,line) /* MR9 23-Sep-97 */
+char *s,*file;
+int line;
+#endif
+{
+ fprintf(stderr,s,file,line);
+ exit(PCCTS_EXIT_FAILURE);
+}
+
+#ifdef __USE_PROTOS
+char *dlg_malloc(int bytes,char *file,int line)
+#else
+char *dlg_malloc(bytes,file,line)
+int bytes;
+char *file;
+int line;
+#endif
+{
+ char *t;
+
+ t = (char *) malloc(bytes);
+ if (!t){
+ /* error */
+ internal_error("%s(%d): unable to allocate memory\n",
+ file,line);
+ }
+ return t;
+}
+
+
+#ifdef __USE_PROTOS
+char *dlg_calloc(int n,int bytes,char *file,int line)
+#else
+char *dlg_calloc(n,bytes,file,line)
+int n,bytes;
+char *file;
+int line;
+#endif
+{
+ char *t;
+
+ t = (char *) calloc(n,bytes);
+ if (!t){
+ /* error */
+ internal_error("%s(%d): unable to allocate memory\n",
+ file,line);
+ }
+ return t;
+}
+
+
+#ifdef __USE_PROTOS
+FILE *read_stream(char *name)
+#else
+FILE *read_stream(name)
+char *name;
+#endif
+{
+ FILE *f;
+
+ if (name){
+ if (name[0] == '-') {
+ fprintf(stderr, "dlg: invalid option: '%s'\n", name);
+ f = NULL;
+ }else{
+ f = fopen(name, "r");
+ if (f == NULL){
+ /* couldn't open file */
+ fprintf(stderr,
+ "dlg: Warning: Can't read file %s.\n",
+ name);
+ }
+ }
+ }else{
+ /* open stdin if nothing there */
+ f = stdin;
+ }
+ return f;
+}
+
+#ifdef __USE_PROTOS
+FILE *write_stream(char *name)
+#else
+FILE *write_stream(name)
+char *name;
+#endif
+{
+ FILE *f;
+
+ if (name){
+ if (name[0] == '-') {
+ fprintf(stderr, "dlg: invalid option: '%s'\n", name);
+ f = NULL;
+ }else{
+ f = fopen(OutMetaName(name), "w");
+ if (f == NULL){
+ /* couldn't open file */
+ fprintf(stderr,
+ "dlg: Warning: Can't write to file %s.\n",
+ name);
+ }
+ else
+#ifdef SPECIAL_FOPEN
+ special_fopen_actions(OutMetaName(name)); /* MR1 */
+#else
+ ; /* MR1 */
+#endif
+ }
+ }else{
+ /* open stdout if nothing there */
+ f = stdout;
+ }
+ return f;
+}
+
+
+#ifdef __USE_PROTOS
+void fatal(char *message,int line_no)
+#else
+void fatal(message,line_no)
+char *message;
+int line_no;
+#endif
+{
+ fprintf(stderr,ErrHdr,
+ (file_str[0] ? file_str[0] : "stdin"), line_no);
+ fprintf(stderr, " Fatal: %s\n", message);
+ exit(PCCTS_EXIT_FAILURE);
+}
+
+#ifdef __USE_PROTOS
+void error(char *message,int line_no)
+#else
+void error(message,line_no)
+char *message;
+int line_no;
+#endif
+{
+ fprintf(stderr,ErrHdr,
+ (file_str[0] ? file_str[0] : "stdin"), line_no);
+ fprintf(stderr, " Error: %s\n", message);
+ err_found = 1;
+}
+
+#ifdef __USE_PROTOS
+void warning(char *message,int line_no)
+#else
+void warning(message,line_no)
+char *message;
+int line_no;
+#endif
+{
+ fprintf(stderr,ErrHdr,
+ (file_str[0] ? file_str[0] : "stdin"), line_no);
+ fprintf(stderr, " Warning: %s\n", message);
+}
+
+/* MR10: Jeff Vincent
+ MR10: Changed to remove directory information from n only if
+ MR10: if OutputDirectory was changed by user (-o option)
+*/
+
+#ifdef __USE_PROTOS
+char *OutMetaName(char *n)
+#else
+char *OutMetaName(n)
+char *n;
+#endif
+{
+ static char *dir_sym = DirectorySymbol;
+ static char newname[MaxFileName+1];
+ char *p;
+
+ /* If OutputDirectory is same as TopDirectory (platform default) then leave n alone. */
+ if (strcmp(OutputDirectory, TopDirectory) == 0)
+ return n;
+
+ /* p will point to filename without path information */
+ if ((p = strrchr(n, *dir_sym)) != NULL)
+ p++;
+ else
+ p = n;
+
+ /* Copy new output directory into newname[] */
+ strcpy(newname, OutputDirectory);
+
+ /* if new output directory does not have trailing dir_sym, add it! */
+ if (newname[strlen(newname)-1] != *dir_sym)
+ strcat(newname, dir_sym);
+
+ /* contatenate FILE NAME ONLY to new output directory */
+ strcat(newname, p);
+
+ return newname;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/tokens.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/tokens.h
new file mode 100644
index 000000000..73e502b7e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/dlg/tokens.h
@@ -0,0 +1,133 @@
+#ifndef tokens_h
+#define tokens_h
+/* tokens.h -- List of labelled tokens and stuff
+ *
+ * Generated from: dlg_p.g
+ *
+ * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
+ * Purdue University Electrical Engineering
+ * ANTLR Version 1.33MR33
+ */
+#define zzEOF_TOKEN 1
+#define L_EOF 4
+#define PER_PER 5
+#define NAME_PER_PER 6
+#define LEXMEMBER 7
+#define LEXACTION 8
+#define PARSERCLASS 9
+#define LEXPREFIX 10
+#define ACTION 11
+#define GREAT_GREAT 12
+#define L_BRACE 13
+#define R_BRACE 14
+#define L_PAR 15
+#define R_PAR 16
+#define L_BRACK 17
+#define R_BRACK 18
+#define ZERO_MORE 19
+#define ONE_MORE 20
+#define OR 21
+#define RANGE 22
+#define NOT 23
+#define OCTAL_VALUE 24
+#define HEX_VALUE 25
+#define DEC_VALUE 26
+#define TAB 27
+#define NL 28
+#define CR 29
+#define BS 30
+#define CONTINUATION 31
+#define LIT 32
+#define REGCHAR 33
+
+#ifdef __USE_PROTOS
+void grammar(void);
+#else
+extern void grammar();
+#endif
+
+#ifdef __USE_PROTOS
+void start_states(void);
+#else
+extern void start_states();
+#endif
+
+#ifdef __USE_PROTOS
+void do_conversion(void);
+#else
+extern void do_conversion();
+#endif
+
+#ifdef __USE_PROTOS
+void rule_list(void);
+#else
+extern void rule_list();
+#endif
+
+#ifdef __USE_PROTOS
+void rule(void);
+#else
+extern void rule();
+#endif
+
+#ifdef __USE_PROTOS
+void reg_expr(void);
+#else
+extern void reg_expr();
+#endif
+
+#ifdef __USE_PROTOS
+void and_expr(void);
+#else
+extern void and_expr();
+#endif
+
+#ifdef __USE_PROTOS
+void repeat_expr(void);
+#else
+extern void repeat_expr();
+#endif
+
+#ifdef __USE_PROTOS
+void expr(void);
+#else
+extern void expr();
+#endif
+
+#ifdef __USE_PROTOS
+void atom_list(void);
+#else
+extern void atom_list();
+#endif
+
+#ifdef __USE_PROTOS
+void near_atom(void);
+#else
+extern void near_atom();
+#endif
+
+#ifdef __USE_PROTOS
+void atom(void);
+#else
+extern void atom();
+#endif
+
+#ifdef __USE_PROTOS
+void anychar(void);
+#else
+extern void anychar();
+#endif
+
+#endif
+extern SetWordType zzerr1[];
+extern SetWordType zzerr2[];
+extern SetWordType zzerr3[];
+extern SetWordType setwd1[];
+extern SetWordType zzerr4[];
+extern SetWordType zzerr5[];
+extern SetWordType zzerr6[];
+extern SetWordType setwd2[];
+extern SetWordType zzerr7[];
+extern SetWordType zzerr8[];
+extern SetWordType zzerr9[];
+extern SetWordType setwd3[];
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/AParser.cpp b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/AParser.cpp
new file mode 100644
index 000000000..720fe75af
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/AParser.cpp
@@ -0,0 +1,871 @@
+/* ANTLRParser.C
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#include "pcctscfg.h"
+
+#include "pccts_stdlib.h"
+#include "pccts_stdarg.h"
+#include "pccts_string.h"
+#include "pccts_stdio.h"
+
+PCCTS_NAMESPACE_STD
+
+/* I have to put this here due to C++ limitation
+ * that you can't have a 'forward' decl for enums.
+ * I hate C++!!!!!!!!!!!!!!!
+ * Of course, if I could use real templates, this would go away.
+ */
+// MR1
+// MR1 10-Apr-97 133MR1 Prevent use of varying sizes for the
+// MR1 ANTLRTokenType enum
+// MR1
+
+enum ANTLRTokenType { TER_HATES_CPP=0, ITS_TOO_COMPLICATED=9999}; // MR1
+
+#define ANTLR_SUPPORT_CODE
+
+#include ATOKEN_H
+#include ATOKENBUFFER_H
+#include APARSER_H
+
+static const int zzINF_DEF_TOKEN_BUFFER_SIZE = 2000; /* MR14 */
+static const int zzINF_BUFFER_TOKEN_CHUNK_SIZE = 1000; /* MR14 */
+
+ /* L o o k a h e a d M a c r o s */
+
+/* maximum of 32 bits/unsigned int and must be 8 bits/byte;
+ * we only use 8 bits of it.
+ */
+SetWordType ANTLRParser::bitmask[sizeof(SetWordType)*8] = {
+ 0x00000001, 0x00000002, 0x00000004, 0x00000008,
+ 0x00000010, 0x00000020, 0x00000040, 0x00000080
+};
+
+char ANTLRParser::eMsgBuffer[500] = "";
+
+ANTLRParser::
+~ANTLRParser()
+{
+ delete [] token_type;
+ delete [] zzFAILtext; // MR16 Manfred Kogler
+}
+
+ANTLRParser::
+ANTLRParser(ANTLRTokenBuffer *_inputTokens,
+ int k,
+ int use_inf_look,
+ int dlook,
+ int ssize)
+{
+ LLk = k;
+ can_use_inf_look = use_inf_look;
+/* MR14 */ if (dlook != 0) {
+/* MR14 */ panic("ANTLRParser::ANTLRParser - Demand lookahead not supported in C++ mode");
+/* MR14 */
+/* MR14 */ };
+ demand_look = 0; /* demand_look = dlook; */
+ bsetsize = ssize;
+ guessing = 0;
+ token_tbl = NULL;
+ eofToken = (ANTLRTokenType)1;
+
+ // allocate lookahead buffer
+ token_type = new ANTLRTokenType[LLk];
+ lap = 0;
+ labase = 0;
+#ifdef ZZDEFER_FETCH
+ stillToFetch = 0; // MR19
+#endif
+ dirty = 0;
+ inf_labase = 0; // MR7
+ inf_last = 0; // MR7
+ /* prime lookahead buffer, point to inputTokens */
+ this->inputTokens = _inputTokens;
+ this->inputTokens->setMinTokens(k);
+ _inputTokens->setParser(this); // MR1
+ resynchConsumed=1; // MR8
+ zzFAILtext=NULL; // MR9
+ traceOptionValueDefault=0; // MR10
+ traceReset(); // MR10
+ zzGuessSeq=0; // MR10
+ syntaxErrCount=0; // MR11
+}
+
+void ANTLRParser::init()
+{
+ prime_lookahead();
+ resynchConsumed=1; // MR8
+ traceReset(); // MR10
+}
+
+void ANTLRParser::traceReset()
+{
+ traceOptionValue=traceOptionValueDefault;
+ traceGuessOptionValue=1;
+ traceCurrentRuleName=NULL;
+ traceDepth=0;
+}
+
+
+#ifdef _MSC_VER // MR23
+//Turn off warning:
+//interaction between '_setjmp' and C++ object destruction is non-portable
+#pragma warning(disable : 4611)
+#endif
+int ANTLRParser::
+guess(ANTLRParserState *st)
+{
+ saveState(st);
+ guessing = 1;
+ return setjmp(guess_start.state);
+}
+#ifdef _MSC_VER // MR23
+#pragma warning(default: 4611)
+#endif
+
+void ANTLRParser::
+saveState(ANTLRParserState *buf)
+{
+ buf->guess_start = guess_start;
+ buf->guessing = guessing;
+ buf->inf_labase = inf_labase;
+ buf->inf_last = inf_last;
+ buf->dirty = dirty;
+ buf->traceOptionValue=traceOptionValue; /* MR10 */
+ buf->traceGuessOptionValue=traceGuessOptionValue; /* MR10 */
+ buf->traceCurrentRuleName=traceCurrentRuleName; /* MR10 */
+ buf->traceDepth=traceDepth; /* MR10 */
+}
+
+void ANTLRParser::
+restoreState(ANTLRParserState *buf)
+{
+ int i;
+ int prevTraceOptionValue;
+
+ guess_start = buf->guess_start;
+ guessing = buf->guessing;
+ inf_labase = buf->inf_labase;
+ inf_last = buf->inf_last;
+ dirty = buf->dirty;
+
+ // restore lookahead buffer from k tokens before restored TokenBuffer position
+ // if demand_look, then I guess we don't look backwards for these tokens.
+ for (i=1; i<=LLk; i++) token_type[i-1] =
+ inputTokens->bufferedToken(i-LLk)->getType();
+ lap = 0;
+ labase = 0;
+
+ /* MR10 */
+
+ prevTraceOptionValue=traceOptionValue;
+ traceOptionValue=buf->traceOptionValue;
+ if ( (prevTraceOptionValue > 0) !=
+ (traceOptionValue > 0)) {
+ if (traceCurrentRuleName != NULL) { /* MR21 */
+ if (traceOptionValue > 0) {
+ /* MR23 */ printMessage(stderr,
+ "trace enable restored in rule %s depth %d\n",
+ traceCurrentRuleName,
+ traceDepth);
+ };
+ if (traceOptionValue <= 0) {
+ /* MR23 */ printMessage(stderr,
+ "trace disable restored in rule %s depth %d\n",
+ traceCurrentRuleName, /* MR21 */
+ traceDepth);
+ };
+ }
+ };
+ traceGuessOptionValue=buf->traceGuessOptionValue;
+ traceCurrentRuleName=buf->traceCurrentRuleName;
+ traceDepth=buf->traceDepth;
+ traceGuessDone(buf);
+}
+
+/* Get the next symbol from the input stream; put it into lookahead buffer;
+ * fill token_type[] fast reference cache also. NLA is the next place where
+ * a lookahead ANTLRAbstractToken should go.
+ */
+void ANTLRParser::
+consume()
+{
+
+#ifdef ZZDEBUG_CONSUME_ACTION
+ zzdebug_consume_action();
+#endif
+
+// MR19 V.H. Simonis
+// Defer Fetch feature
+// Moves action of consume() into LA() function
+
+#ifdef ZZDEFER_FETCH
+ stillToFetch++;
+#else
+ NLA = inputTokens->getToken()->getType();
+ dirty--;
+ lap = (lap+1)&(LLk-1);
+#endif
+
+}
+
+_ANTLRTokenPtr ANTLRParser::
+LT(int i)
+{
+
+// MR19 V.H. Simonis
+// Defer Fetch feature
+// Moves action of consume() into LA() function
+
+#ifdef ZZDEFER_FETCH
+ undeferFetch();
+#endif
+
+#ifdef DEBUG_TOKENBUFFER
+ if ( i >= inputTokens->bufferSize() || inputTokens->minTokens() < LLk ) /* MR20 Was "<=" */
+ {
+ char buf[2000]; /* MR20 Was "static" */
+ sprintf(buf, "The minimum number of tokens you requested that the\nANTLRTokenBuffer buffer is not enough to satisfy your\nLT(%d) request; increase 'k' argument to constructor for ANTLRTokenBuffer\n", i);
+ panic(buf);
+ }
+#endif
+ return inputTokens->bufferedToken(i-LLk);
+}
+
+void
+ANTLRParser::
+look(int k)
+{
+ int i, c = k - (LLk-dirty);
+ for (i=1; i<=c; i++) consume();
+}
+
+/* fill the lookahead buffer up with k symbols (even if DEMAND_LOOK);
+ */
+void
+ANTLRParser::
+prime_lookahead()
+{
+ int i;
+ for(i=1;i<=LLk; i++) consume();
+ dirty=0;
+ // lap = 0; // MR14 Sinan Karasu (sinan.karasu@boeing.com)
+ // labase = 0; // MR14
+ labase=lap; // MR14
+}
+
+/* check to see if the current input symbol matches '_t'.
+ * During NON demand lookahead mode, dirty will always be 0 and
+ * hence the extra code for consuming tokens in _match is never
+ * executed; the same routine can be used for both modes.
+ */
+int ANTLRParser::
+_match(ANTLRTokenType _t, ANTLRChar **MissText,
+ ANTLRTokenType *MissTok, _ANTLRTokenPtr *BadTok,
+ SetWordType **MissSet)
+{
+ if ( dirty==LLk ) {
+ consume();
+ }
+ if ( LA(1)!=_t ) {
+ *MissText=NULL;
+ *MissTok= _t;
+ *BadTok = LT(1);
+ *MissSet=NULL;
+ return 0;
+ }
+ dirty++;
+ labase = (labase+1)&(LLk-1); // labase maintained even if !demand look
+ return 1;
+}
+
+/* check to see if the current input symbol matches '_t'.
+ * Used during exception handling.
+ */
+int ANTLRParser::
+_match_wsig(ANTLRTokenType _t)
+{
+ if ( dirty==LLk ) {
+ consume();
+ }
+ if ( LA(1)!=_t ) return 0;
+ dirty++;
+ labase = (labase+1)&(LLk-1); // labase maintained even if !demand look
+ return 1;
+}
+
+/* check to see if the current input symbol matches any token in a set.
+ * During NON demand lookahead mode, dirty will always be 0 and
+ * hence the extra code for consuming tokens in _match is never
+ * executed; the same routine can be used for both modes.
+ */
+int ANTLRParser::
+_setmatch(SetWordType *tset, ANTLRChar **MissText,
+ ANTLRTokenType *MissTok, _ANTLRTokenPtr *BadTok,
+ SetWordType **MissSet, SetWordType *tokclassErrset)
+{
+ if ( dirty==LLk ) {
+ consume();
+ }
+ if ( !set_el(LA(1), tset) ) {
+ *MissText=NULL; /* MR23 */
+ *MissTok=(ANTLRTokenType) 0; /* MR23 */
+ *BadTok=LT(1); /* MR23 */
+ *MissSet=tokclassErrset; /* MR23 */
+ return 0;
+ }
+ dirty++;
+ labase = (labase+1)&(LLk-1); // labase maintained even if !demand look
+ return 1;
+}
+
+int ANTLRParser::
+_setmatch_wsig(SetWordType *tset)
+{
+ if ( dirty==LLk ) {
+ consume();
+ }
+ if ( !set_el(LA(1), tset) ) return 0;
+ dirty++;
+ labase = (labase+1)&(LLk-1); // labase maintained even if !demand look
+ return 1;
+}
+
+ /* Exception handling routines */
+//
+// 7-Apr-97 133MR1
+// Change suggested by Eli Sternheim (eli@interhdl.com)
+//
+void ANTLRParser::
+consumeUntil(SetWordType *st)
+{
+ ANTLRTokenType tmp; // MR1
+ const int Eof=1; // MR1
+ while ( !set_el( (tmp=LA(1)), st) && tmp!=Eof) { consume(); } // MR1
+}
+
+//
+// 7-Apr-97 133MR1
+// Change suggested by Eli Sternheim (eli@interhdl.com)
+//
+void ANTLRParser::
+consumeUntilToken(int t)
+{
+ int tmp; // MR1
+ const int Eof=1; // MR1
+ while ( (tmp=LA(1)) !=t && tmp!=Eof) { consume(); } // MR1
+}
+
+
+ /* Old error stuff */
+
+void ANTLRParser::
+resynch(SetWordType *wd,SetWordType mask)
+{
+
+/* MR8 S.Bochnak@microtool.com.pl */
+/* MR8 Change file scope static "consumed" to instance var */
+
+ /* if you enter here without having consumed a token from last resynch
+ * force a token consumption.
+ */
+/* MR8 */ if ( !resynchConsumed ) {consume(); resynchConsumed=1; return;}
+
+ /* if current token is in resynch set, we've got what we wanted */
+
+/* MR8 */ if ( wd[LA(1)]&mask || LA(1) == eofToken ) {resynchConsumed=0; return;}
+
+ /* scan until we find something in the resynch set */
+
+ while ( !(wd[LA(1)]&mask) && LA(1) != eofToken ) {consume();}
+
+/* MR8 */ resynchConsumed=1;
+}
+
+/* standard error reporting function that assumes DLG-based scanners;
+ * you should redefine in subclass to change it or if you use your
+ * own scanner.
+ */
+
+/* MR23 THM There appears to be a parameter "badText" passed to syn()
+ which is not present in the parameter list. This may be
+ because in C mode there is no attribute function which
+ returns the text, so the text representation of the token
+ must be passed explicitly. I think.
+*/
+
+void ANTLRParser::
+syn(_ANTLRTokenPtr /*tok MR23*/, ANTLRChar *egroup, SetWordType *eset,
+ ANTLRTokenType etok, int k)
+{
+ int line;
+
+ line = LT(1)->getLine();
+
+ syntaxErrCount++; /* MR11 */
+
+ /* MR23 If the token is not an EOF token, then use the ->getText() value.
+
+ If the token is the EOF token the text returned by ->getText()
+ may be garbage. If the text from the token table is "@" use
+ "<eof>" instead, because end-users don't know what "@" means.
+ If the text is not "@" then use that text, which must have been
+ supplied by the grammar writer.
+ */
+ const char * errorAt = LT(1)->getText();
+ if (LA(1) == eofToken) {
+ errorAt = parserTokenName(LA(1));
+ if (errorAt[0] == '@') errorAt = "<eof>";
+ }
+ /* MR23 */ printMessage(stderr, "line %d: syntax error at \"%s\"",
+ line, errorAt);
+ if ( !etok && !eset ) {/* MR23 */ printMessage(stderr, "\n"); return;}
+ if ( k==1 ) /* MR23 */ printMessage(stderr, " missing");
+ else
+ {
+ /* MR23 */ printMessage(stderr, "; \"%s\" not", LT(k)->getText()); // MR23 use LT(k) since k>1
+ if ( set_deg(eset)>1 ) /* MR23 */ printMessage(stderr, " in");
+ }
+ if ( set_deg(eset)>0 ) edecode(eset);
+ else /* MR23 */ printMessage(stderr, " %s", token_tbl[etok]);
+ if ( strlen(egroup) > 0 ) /* MR23 */ printMessage(stderr, " in %s", egroup);
+ /* MR23 */ printMessage(stderr, "\n");
+}
+
+/* is b an element of set p? */
+int ANTLRParser::
+set_el(ANTLRTokenType b, SetWordType *p)
+{
+ return( p[DIVWORD(b)] & bitmask[MODWORD(b)] );
+}
+
+int ANTLRParser::
+set_deg(SetWordType *a)
+{
+ /* Fast compute degree of a set... the number
+ of elements present in the set. Assumes
+ that all word bits are used in the set
+ */
+ register SetWordType *p = a;
+ register SetWordType *endp = &(a[bsetsize]);
+ register int degree = 0;
+
+ if ( a == NULL ) return 0;
+ while ( p < endp )
+ {
+ register SetWordType t = *p;
+ register SetWordType *b = &(bitmask[0]);
+ do {
+ if (t & *b) ++degree;
+ } while (++b < &(bitmask[sizeof(SetWordType)*8]));
+ p++;
+ }
+
+ return(degree);
+}
+
+void ANTLRParser::
+edecode(SetWordType *a)
+{
+ register SetWordType *p = a;
+ register SetWordType *endp = &(p[bsetsize]);
+ register unsigned e = 0;
+
+ if ( set_deg(a)>1 ) /* MR23 */ printMessage(stderr, " {");
+ do {
+ register SetWordType t = *p;
+ register SetWordType *b = &(bitmask[0]);
+ do {
+ if ( t & *b ) /* MR23 */ printMessage(stderr, " %s", token_tbl[e]);
+ e++;
+ } while (++b < &(bitmask[sizeof(SetWordType)*8]));
+ } while (++p < endp);
+ if ( set_deg(a)>1 ) /* MR23 */ printMessage(stderr, " }");
+}
+
+/* input looks like:
+ * zzFAIL(k, e1, e2, ...,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk)
+ * where the zzMiss stuff is set here to the token that did not match
+ * (and which set wasn't it a member of).
+ */
+
+// MR9 29-Sep-97 Stan Bochnak (S.Bochnak@microTool.com.pl)
+// MR9 Original fix to static allocated text didn't
+// MR9 work because a pointer to it was passed back
+// MR9 to caller. Replace with instance variable.
+
+const int SETWORDCOUNT=20;
+
+void
+ANTLRParser::FAIL(int k, ...)
+{
+//
+// MR1 10-Apr-97
+//
+
+ if (zzFAILtext == NULL) zzFAILtext=new char [1000]; // MR9
+ SetWordType **f=new SetWordType *[SETWORDCOUNT]; // MR1 // MR9
+ SetWordType **miss_set;
+ ANTLRChar **miss_text;
+ _ANTLRTokenPtr *bad_tok;
+ ANTLRChar **bad_text;
+//
+// 7-Apr-97 133MR1
+// err_k is passed as a "int *", not "unsigned *"
+//
+ int *err_k; // MR1
+ int i;
+ va_list ap;
+
+ va_start(ap, k);
+
+ zzFAILtext[0] = '\0';
+ if ( k > SETWORDCOUNT ) panic("FAIL: overflowed buffer");
+ for (i=1; i<=k; i++) /* collect all lookahead sets */
+ {
+ f[i-1] = va_arg(ap, SetWordType *);
+ }
+ for (i=1; i<=k; i++) /* look for offending token */
+ {
+ if ( i>1 ) strcat(zzFAILtext, " ");
+ strcat(zzFAILtext, LT(i)->getText());
+ if ( !set_el(LA(i), f[i-1]) ) break;
+ }
+ miss_set = va_arg(ap, SetWordType **);
+ miss_text = va_arg(ap, ANTLRChar **);
+ bad_tok = va_arg(ap, _ANTLRTokenPtr *);
+ bad_text = va_arg(ap, ANTLRChar **);
+ err_k = va_arg(ap, int *); // MR1
+ if ( i>k )
+ {
+ /* bad; lookahead is permutation that cannot be matched,
+ * but, the ith token of lookahead is valid at the ith position
+ * (The old LL sub 1 (k) versus LL(k) parsing technique)
+ */
+ *miss_set = NULL;
+ *miss_text = LT(1)->getText();
+ *bad_tok = LT(1);
+ *bad_text = (*bad_tok)->getText();
+ *err_k = k;
+//
+// MR4 20-May-97 erroneously deleted contents of f[]
+// MR4 reported by Bruce Guenter (bruceg@qcc.sk.ca)
+// MR1 10-Apr-97 release temporary storage
+//
+ delete [] f; // MR1
+ return; // MR1
+ }
+/* MR23 printMessage(stderr, "%s not in %dth set\n", zztokens[LA(i)], i);*/
+ *miss_set = f[i-1];
+ *miss_text = zzFAILtext;
+ *bad_tok = LT(i);
+ *bad_text = (*bad_tok)->getText();
+ if ( i==1 ) *err_k = 1;
+ else *err_k = k;
+//
+// MR4 20-May-97 erroneously deleted contents of f[]
+// MR4 reported by Bruce Guenter (bruceg@qcc.sk.ca)
+// MR1 10-Apr-97 release temporary storage
+//
+ delete [] f; // MR1
+ return; // MR1
+}
+
+int ANTLRParser::
+_match_wdfltsig(ANTLRTokenType tokenWanted, SetWordType *whatFollows)
+{
+ if ( dirty==LLk ) consume();
+
+ if ( LA(1)!=tokenWanted )
+ {
+ syntaxErrCount++; /* MR11 */
+ /* MR23 */ printMessage(stderr,
+ "line %d: syntax error at \"%s\" missing %s\n",
+ LT(1)->getLine(),
+ (LA(1)==eofToken && LT(1)->getText()[0] == '@')?"<eof>":LT(1)->getText(), /* MR21a */
+ token_tbl[tokenWanted]);
+ consumeUntil( whatFollows );
+ return 0;
+ }
+ else {
+ dirty++;
+ labase = (labase+1)&(LLk-1); // labase maintained even if !demand look
+/* if ( !demand_look ) consume(); */
+ return 1;
+ }
+}
+
+
+int ANTLRParser::
+_setmatch_wdfltsig(SetWordType *tokensWanted,
+ ANTLRTokenType tokenTypeOfSet,
+ SetWordType *whatFollows)
+{
+ if ( dirty==LLk ) consume();
+ if ( !set_el(LA(1), tokensWanted) )
+ {
+ syntaxErrCount++; /* MR11 */
+ /* MR23 */ printMessage(stderr,
+ "line %d: syntax error at \"%s\" missing %s\n",
+ LT(1)->getLine(),
+ (LA(1)==eofToken && LT(1)->getText()[0] == '@')?"<eof>":LT(1)->getText(), /* MR21a */
+ token_tbl[tokenTypeOfSet]);
+ consumeUntil( whatFollows );
+ return 0;
+ }
+ else {
+ dirty++;
+ labase = (labase+1)&(LLk-1); // labase maintained even if !demand look
+/* if ( !demand_look ) consume(); */
+ return 1;
+ }
+}
+
+char *ANTLRParser::
+eMsgd(char *err,int d)
+{
+ sprintf(eMsgBuffer, err, d); // dangerous, but I don't care
+ return eMsgBuffer;
+}
+
+char *ANTLRParser::
+eMsg(char *err, char *s)
+{
+ sprintf(eMsgBuffer, err, s);
+ return eMsgBuffer;
+}
+
+char *ANTLRParser::
+eMsg2(char *err,char *s, char *t)
+{
+ sprintf(eMsgBuffer, err, s, t);
+ return eMsgBuffer;
+}
+
+void ANTLRParser::
+panic(const char *msg) // MR20 const
+{
+ /* MR23 */ printMessage(stderr, "ANTLR panic: %s\n", msg);
+ exit(PCCTS_EXIT_FAILURE); // MR1
+}
+
+const ANTLRChar *ANTLRParser:: // MR1
+parserTokenName(int tok) { // MR1
+ return token_tbl[tok]; // MR1
+} // MR1
+
+void ANTLRParser::traceGuessDone(const ANTLRParserState *state) {
+
+ int doIt=0;
+
+ if (traceCurrentRuleName == NULL) return;
+
+ if (traceOptionValue <= 0) {
+ doIt=0;
+ } else if (traceGuessOptionValue <= 0) {
+ doIt=0;
+ } else {
+ doIt=1;
+ };
+
+ if (doIt) {
+ /* MR23 */ printMessage(stderr,"guess done - returning to rule %s {\"%s\"} at depth %d",
+ state->traceCurrentRuleName,
+ LT(1)->getType() == eofToken ? "@" : LT(1)->getText(),
+ state->traceDepth);
+ if (state->guessing != 0) {
+ /* MR23 */ printMessage(stderr," (guess mode continues - an enclosing guess is still active)");
+ } else {
+ /* MR23 */ printMessage(stderr," (guess mode ends)");
+ };
+ /* MR23 */ printMessage(stderr,"\n");
+ };
+}
+
+void ANTLRParser::traceGuessFail() {
+
+ int doIt=0;
+
+ if (traceCurrentRuleName == NULL) return; /* MR21 */
+
+ if (traceOptionValue <= 0) {
+ doIt=0;
+ } else if (guessing && traceGuessOptionValue <= 0) {
+ doIt=0;
+ } else {
+ doIt=1;
+ };
+
+ if (doIt) {
+ /* MR23 */ printMessage(stderr,"guess failed in %s\n",traceCurrentRuleName);
+ };
+}
+
+/* traceOption:
+ zero value turns off trace
+*/
+
+void ANTLRParser::tracein(const ANTLRChar * rule) {
+
+ int doIt=0;
+
+ traceDepth++;
+ traceCurrentRuleName=rule;
+
+ if (traceOptionValue <= 0) {
+ doIt=0;
+ } else if (guessing && traceGuessOptionValue <= 0) {
+ doIt=0;
+ } else {
+ doIt=1;
+ };
+
+ if (doIt) {
+ /* MR23 */ printMessage(stderr,"enter rule %s {\"%s\"} depth %d",
+ rule,
+ LT(1)->getType() == eofToken ? "@" : LT(1)->getText(),
+ traceDepth);
+ if (guessing) /* MR23 */ printMessage(stderr," guessing");
+ /* MR23 */ printMessage(stderr,"\n");
+ };
+ return;
+}
+
+void ANTLRParser::traceout(const ANTLRChar * rule) {
+
+ int doIt=0;
+
+ traceDepth--;
+
+ if (traceOptionValue <= 0) {
+ doIt=0;
+ } else if (guessing && traceGuessOptionValue <= 0) {
+ doIt=0;
+ } else {
+ doIt=1;
+ };
+
+ if (doIt) {
+ /* MR23 */ printMessage(stderr,"exit rule %s {\"%s\"} depth %d",
+ rule,
+ LT(1)->getType() == eofToken ? "@" : LT(1)->getText(),
+ traceDepth+1);
+ if (guessing) /* MR23 */ printMessage(stderr," guessing");
+ /* MR23 */ printMessage(stderr,"\n");
+ };
+}
+
+int ANTLRParser::traceOption(int delta) {
+
+ int prevValue=traceOptionValue;
+
+ traceOptionValue=traceOptionValue+delta;
+
+ if (traceCurrentRuleName != NULL) {
+ if (prevValue <= 0 && traceOptionValue > 0) {
+ /* MR23 */ printMessage(stderr,"trace enabled in rule %s depth %d\n",traceCurrentRuleName,traceDepth);
+ };
+ if (prevValue > 0 && traceOptionValue <= 0) {
+ /* MR23 */ printMessage(stderr,"trace disabled in rule %s depth %d\n",traceCurrentRuleName,traceDepth);
+ };
+ };
+
+ return prevValue;
+}
+
+int ANTLRParser::traceGuessOption(int delta) {
+
+ int prevValue=traceGuessOptionValue;
+
+ traceGuessOptionValue=traceGuessOptionValue+delta;
+
+ if (traceCurrentRuleName != NULL) {
+ if (prevValue <= 0 && traceGuessOptionValue > 0) {
+ /* MR23 */ printMessage(stderr,"guess trace enabled in rule %s depth %d\n",traceCurrentRuleName,traceDepth);
+ };
+ if (prevValue > 0 && traceGuessOptionValue <= 0) {
+ /* MR23 */ printMessage(stderr,"guess trace disabled in rule %s depth %d\n",traceCurrentRuleName,traceDepth);
+ };
+ };
+ return prevValue;
+}
+
+// MR19 V.H. Simonis Defer Fetch feature
+
+void ANTLRParser::undeferFetch()
+{
+
+#ifdef ZZDEFER_FETCH
+ if (stillToFetch) {
+ for (int stillToFetch_x = 0; stillToFetch_x < stillToFetch; ++stillToFetch_x) {
+ NLA = inputTokens->getToken()->getType();
+ dirty--;
+ lap = (lap+1)&(LLk-1);
+ }
+ stillToFetch = 0;
+ }
+#else
+ return;
+#endif
+
+}
+
+int ANTLRParser::isDeferFetchEnabled()
+{
+#ifdef ZZDEFER_FETCH
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+//MR23
+int ANTLRParser::printMessage(FILE* pFile, const char* pFormat, ...)
+{
+ va_list marker;
+ va_start( marker, pFormat );
+ int iRet = printMessageV(pFile, pFormat, marker);
+ va_end( marker );
+ return iRet;
+}
+
+int ANTLRParser::printMessageV(FILE* pFile, const char* pFormat, va_list arglist) // MR23
+{
+ return vfprintf(pFile, pFormat, arglist);
+}
+
+// MR23 Move semantic predicate error handling from macro to virtual function
+//
+// Called by the zzfailed_pred
+
+void ANTLRParser::failedSemanticPredicate(const char* predicate)
+{
+ printMessage(stdout,"line %d: semantic error; failed predicate: '%s'\n",
+ LT(1)->getLine(), predicate);
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/AParser.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/AParser.h
new file mode 100644
index 000000000..fe405f416
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/AParser.h
@@ -0,0 +1,376 @@
+/* ANTLRParser.h
+ *
+ * Define the generic ANTLRParser superclass, which is subclassed to
+ * define an actual parser.
+ *
+ * Before entry into this file: ANTLRTokenType must be set.
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef APARSER_H_GATE
+#define APARSER_H_GATE
+
+#include "pcctscfg.h"
+
+#include "pccts_stdio.h"
+#include "pccts_setjmp.h"
+
+PCCTS_NAMESPACE_STD
+
+#include ATOKEN_H
+#include ATOKENBUFFER_H
+
+#ifdef ZZCAN_GUESS
+#ifndef ZZINF_LOOK
+#define ZZINF_LOOK
+#endif
+#endif
+
+
+#define NLA (token_type[lap&(LLk-1)])/* --> next LA */
+
+typedef unsigned char SetWordType;
+
+/* Define external bit set stuff (for SetWordType) */
+#define EXT_WORDSIZE (sizeof(char)*8)
+#define EXT_LOGWORDSIZE 3
+
+ /* s y n t a c t i c p r e d i c a t e s t u f f */
+
+#ifndef zzUSER_GUESS_HOOK
+#define zzUSER_GUESS_HOOK(seqFrozen,zzrv)
+#endif
+
+#ifndef zzUSER_GUESS_DONE_HOOK
+#define zzUSER_GUESS_DONE_HOOK(seqFrozen)
+#endif
+
+/* MR14 Add zzUSER_GUESS_FAIL_HOOK and related code */
+
+#define zzUSER_GUESS_FAIL_HOOK_INTERNAL zzUSER_GUESS_FAIL_HOOK(SeqFrozen)
+#ifndef zzUSER_GUESS_FAIL_HOOK
+#define zzUSER_GUESS_FAIL_HOOK(zzGuessSeq)
+#endif
+
+
+typedef struct _zzjmp_buf {
+ jmp_buf state;
+ } zzjmp_buf;
+
+/* these need to be macros not member functions */
+#define zzGUESS_BLOCK ANTLRParserState zzst; int zzrv; int _marker; int zzGuessSeqFrozen;
+#define zzNON_GUESS_MODE if ( !guessing )
+#define zzGUESS_FAIL guess_fail();
+
+/* Note: zzGUESS_DONE does not execute longjmp() */
+
+#define zzGUESS_DONE {zzrv=1; inputTokens->rewind(_marker); guess_done(&zzst);zzUSER_GUESS_DONE_HOOK(zzGuessSeqFrozen) }
+#define zzGUESS saveState(&zzst); \
+ guessing = 1; \
+ zzGuessSeqFrozen = ++zzGuessSeq; \
+ _marker = inputTokens->mark(); \
+ zzrv = setjmp(guess_start.state); \
+ zzUSER_GUESS_HOOK(zzGuessSeqFrozen,zzrv) \
+ if ( zzrv ) zzGUESS_DONE
+
+#define zzTRACEdata const ANTLRChar *zzTracePrevRuleName = NULL;
+
+#ifndef zzTRACEIN
+#define zzTRACEIN(r) zzTracePrevRuleName=traceCurrentRuleName;tracein(r);
+#endif
+#ifndef zzTRACEOUT
+#define zzTRACEOUT(r) traceout(r);traceCurrentRuleName=zzTracePrevRuleName;
+#endif
+
+ /* a n t l r p a r s e r d e f */
+
+struct ANTLRParserState {
+ /* class variables */
+ zzjmp_buf guess_start;
+ int guessing;
+
+ int inf_labase;
+ int inf_last;
+
+ int dirty;
+
+ int traceOptionValue; // MR10
+ int traceGuessOptionValue; // MR10
+ const ANTLRChar *traceCurrentRuleName; // MR10
+ int traceDepth; // MR10
+
+};
+
+/* notes:
+ *
+ * multiple inheritance is a cool way to include what stuff is needed
+ * in this structure (like guess stuff). however, i'm not convinced that
+ * multiple inheritance works correctly on all platforms. not that
+ * much space is used--just include all possibly useful members.
+ *
+ * the class should also be a template with arguments for the lookahead
+ * depth and so on. that way, more than one parser can be defined (as
+ * each will probably have different lookahead requirements). however,
+ * am i sure that templates work? no, i'm not sure.
+ *
+ * no attributes are maintained and, hence, the 'asp' variable is not
+ * needed. $i can still be referenced, but it refers to the token
+ * associated with that rule element. question: where are the token's
+ * stored if not on the software stack? in local variables created
+ * and assigned to by antlr.
+ */
+class ANTLRParser {
+protected:
+ /* class variables */
+ static SetWordType bitmask[sizeof(SetWordType)*8];
+ static char eMsgBuffer[500];
+
+protected:
+ int LLk; // number of lookahead symbols (old LL_K)
+ int demand_look;
+ ANTLRTokenType eofToken; // when do I stop during resynch()s
+ int bsetsize; // size of bitsets created by ANTLR in
+ // units of SetWordType
+
+ ANTLRTokenBuffer *inputTokens; //place to get input tokens
+
+ zzjmp_buf guess_start; // where to jump back to upon failure
+ int guessing; // if guessing (using (...)? predicate)
+
+ // infinite lookahead stuff
+ int can_use_inf_look; // set by subclass (generated by ANTLR)
+ int inf_lap;
+ int inf_labase;
+ int inf_last;
+ int *_inf_line;
+
+ const ANTLRChar **token_tbl; // pointer to table of token type strings MR20 const
+
+ int dirty; // used during demand lookahead
+
+ ANTLRTokenType *token_type; // fast reference cache of token.getType()
+// ANTLRLightweightToken **token; // the token with all its attributes
+ int lap;
+ int labase;
+#ifdef ZZDEFER_FETCH
+ int stillToFetch; // MR19 V.H. Simonis
+#endif
+
+private:
+ void fill_inf_look();
+
+protected:
+ virtual void guess_fail() { // MR9 27-Sep-97 make virtual
+ traceGuessFail(); // MR10
+ longjmp(guess_start.state, 1); } // MR9
+ virtual void guess_done(ANTLRParserState *st) { // MR9 27-Sep-97 make virtual
+ restoreState(st); } // MR9
+ virtual int guess(ANTLRParserState *); // MR9 27-Sep-97 make virtual
+ void look(int);
+ int _match(ANTLRTokenType, ANTLRChar **, ANTLRTokenType *,
+ _ANTLRTokenPtr *, SetWordType **);
+ int _setmatch(SetWordType *, ANTLRChar **, ANTLRTokenType *,
+ _ANTLRTokenPtr *, SetWordType **,
+ SetWordType * tokclassErrset /* MR23 */);
+ int _match_wsig(ANTLRTokenType);
+ int _setmatch_wsig(SetWordType *);
+ virtual void consume();
+ virtual void resynch(SetWordType *wd,SetWordType mask); // MR21
+ void prime_lookahead();
+ virtual void tracein(const ANTLRChar *r); // MR10
+ virtual void traceout(const ANTLRChar *r); // MR10
+ static unsigned MODWORD(unsigned x) {return x & (EXT_WORDSIZE-1);} // x % EXT_WORDSIZE // MR9
+ static unsigned DIVWORD(unsigned x) {return x >> EXT_LOGWORDSIZE;} // x / EXT_WORDSIZE // MR9
+ int set_deg(SetWordType *);
+ int set_el(ANTLRTokenType, SetWordType *);
+ virtual void edecode(SetWordType *); // MR1
+ virtual void FAIL(int k, ...); // MR1
+ int traceOptionValue; // MR10
+ int traceGuessOptionValue; // MR10
+ const ANTLRChar *traceCurrentRuleName; // MR10
+ int traceDepth; // MR10
+ void traceReset(); // MR10
+ virtual void traceGuessFail(); // MR10
+ virtual void traceGuessDone(const ANTLRParserState *); // MR10
+ int zzGuessSeq; // MR10
+
+public:
+ ANTLRParser(ANTLRTokenBuffer *,
+ int k=1,
+ int use_inf_look=0,
+ int demand_look=0,
+ int bsetsize=1);
+ virtual ~ANTLRParser();
+
+ virtual void init();
+
+ ANTLRTokenType LA(int i)
+ {
+//
+// MR14 demand look will always be 0 for C++ mode
+//
+//// return demand_look ? token_type[(labase+(i)-1)&(LLk-1)] :
+//// token_type[(lap+(i)-1)&(LLk-1)];
+
+// MR19 V.H. Simonis Defer fetch feature
+
+#ifdef ZZDEFER_FETCH
+ undeferFetch();
+#endif
+ return token_type[(lap+(i)-1)&(LLk-1)];
+ }
+ _ANTLRTokenPtr LT(int i);
+
+ void setEofToken(ANTLRTokenType t) { eofToken = t; }
+ ANTLRTokenType getEofToken() const { return eofToken; } // MR14
+
+ void noGarbageCollectTokens() { inputTokens->noGarbageCollectTokens(); }
+ void garbageCollectTokens() { inputTokens->garbageCollectTokens(); }
+
+ virtual void syn(_ANTLRTokenPtr tok, ANTLRChar *egroup,
+ SetWordType *eset, ANTLRTokenType etok, int k);
+ virtual void saveState(ANTLRParserState *); // MR9 27-Sep-97 make virtual
+ virtual void restoreState(ANTLRParserState *); // MR9 27-Sep-97 make virtual
+
+ virtual void panic(const char *msg); // MR20 const
+
+ static char *eMsgd(char *,int);
+ static char *eMsg(char *,char *);
+ static char *eMsg2(char *,char *,char *);
+
+ virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23
+ virtual int printMessageV(FILE* pFile, const char* pFormat, va_list arglist); // MR23
+
+ void consumeUntil(SetWordType *st);
+ void consumeUntilToken(int t);
+
+ virtual int _setmatch_wdfltsig(SetWordType *tokensWanted,
+ ANTLRTokenType tokenTypeOfSet,
+ SetWordType *whatFollows);
+ virtual int _match_wdfltsig(ANTLRTokenType tokenWanted,
+ SetWordType *whatFollows);
+
+ const ANTLRChar * parserTokenName(int tok); // MR1
+
+ int traceOptionValueDefault; // MR11
+ int traceOption(int delta); // MR11
+ int traceGuessOption(int delta); // MR11
+
+// MR8 5-Aug-97 S.Bochnak@microtool.com.pl
+// MR8 Move resynch static local variable
+// MR8 to class instance
+
+ int syntaxErrCount; // MR12
+ ANTLRTokenStream *getLexer() const { // MR12
+ return inputTokens ? inputTokens->getLexer() : 0; } // MR12
+protected: // MR8
+ int resynchConsumed; // MR8
+ char *zzFAILtext; // workarea required by zzFAIL // MR9
+ void undeferFetch(); // MR19 V.H. Simonis
+ int isDeferFetchEnabled(); // MR19 V.H. Simonis
+ virtual void failedSemanticPredicate(const char* predicate); /* MR23 */
+};
+
+#define zzmatch(_t) \
+ if ( !_match((ANTLRTokenType)_t, &zzMissText, &zzMissTok, \
+ (_ANTLRTokenPtr *) &zzBadTok, &zzMissSet) ) goto fail;
+
+#define zzmatch_wsig(_t,handler) \
+ if ( !_match_wsig((ANTLRTokenType)_t) ) if ( guessing ) zzGUESS_FAIL else {_signal=MismatchedToken; goto handler;}
+
+#define zzsetmatch(_ts,_tokclassErrset) \
+ if ( !_setmatch(_ts, &zzMissText, &zzMissTok, \
+ (_ANTLRTokenPtr *) &zzBadTok, &zzMissSet, _tokclassErrset) ) goto fail;
+
+#define zzsetmatch_wsig(_ts, handler) \
+ if ( !_setmatch_wsig(_ts) ) if ( guessing ) zzGUESS_FAIL else {_signal=MismatchedToken; goto handler;}
+
+/* For the dflt signal matchers, a FALSE indicates that an error occurred
+ * just like the other matchers, but in this case, the routine has already
+ * recovered--we do NOT want to consume another token. However, when
+ * the match was successful, we do want to consume hence _signal=0 so that
+ * a token is consumed by the "if (!_signal) consume(); _signal=NoSignal;"
+ * preamble.
+ */
+#define zzsetmatch_wdfltsig(tokensWanted, tokenTypeOfSet, whatFollows) \
+ if ( !_setmatch_wdfltsig(tokensWanted, tokenTypeOfSet, whatFollows) ) \
+ _signal = MismatchedToken;
+
+#define zzmatch_wdfltsig(tokenWanted, whatFollows) \
+ if ( !_match_wdfltsig(tokenWanted, whatFollows) ) _signal = MismatchedToken;
+
+
+// MR1 10-Apr-97 zzfailed_pred() macro does not backtrack in guess mode.
+// MR1 Identification and correction due to J. Lilley
+//
+// MR23 Call virtual method to report error.
+// MR23 Provide more control over failed predicate action
+// without any need for user to worry about guessing internals.
+
+#ifndef zzfailed_pred
+#define zzfailed_pred(_p,_hasuseraction,_useraction) \
+ if (guessing) { \
+ zzGUESS_FAIL; \
+ } else { \
+ zzfailed_pred_action(_p,_hasuseraction,_useraction) \
+ }
+#endif
+
+// MR23 Provide more control over failed predicate action
+// without any need for user to worry about guessing internals.
+// _hasuseraction == 0 => no user specified error action
+// _hasuseraction == 1 => user specified error action
+
+#ifndef zzfailed_pred_action
+#define zzfailed_pred_action(_p,_hasuseraction,_useraction) \
+ if (_hasuseraction) { _useraction } else { failedSemanticPredicate(_p); }
+#endif
+
+#define zzRULE \
+ SetWordType *zzMissSet=NULL; ANTLRTokenType zzMissTok=(ANTLRTokenType)0; \
+ _ANTLRTokenPtr zzBadTok=NULL; ANTLRChar *zzBadText=(ANTLRChar *)""; \
+ int zzErrk=1,zzpf=0; \
+ zzTRACEdata \
+ ANTLRChar *zzMissText=(ANTLRChar *)"";
+
+#endif
+
+ /* S t a n d a r d E x c e p t i o n S i g n a l s */
+
+#define NoSignal 0
+#define MismatchedToken 1
+#define NoViableAlt 2
+#define NoSemViableAlt 3
+
+/* MR7 Allow more control over signalling */
+/* by adding "Unwind" and "SetSignal" */
+
+#define Unwind 4
+#define setSignal(newValue) *_retsignal=_signal=(newValue)
+#define suppressSignal *_retsignal=_signal=0
+#define exportSignal *_retsignal=_signal
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ASTBase.cpp b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ASTBase.cpp
new file mode 100644
index 000000000..a94f080c8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ASTBase.cpp
@@ -0,0 +1,256 @@
+/* Abstract syntax tree manipulation functions
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#include "pcctscfg.h"
+
+#include "pccts_stdio.h"
+#include "pccts_stdarg.h"
+
+PCCTS_NAMESPACE_STD
+
+#define ANTLR_SUPPORT_CODE
+
+#include "ASTBase.h"
+
+/* ensure that tree manipulation variables are current after a rule
+ * reference
+ */
+void
+ASTBase::link(ASTBase **_root, ASTBase **_sibling, ASTBase **_tail)
+{
+ if ( *_sibling == NULL ) return;
+ if ( *_root == NULL ) *_root = *_sibling;
+ else if ( *_root != *_sibling ) (*_root)->_down = *_sibling;
+ if ( *_tail==NULL ) *_tail = *_sibling;
+ while ( (*_tail)->_right != NULL ) *_tail = (*_tail)->_right;
+}
+
+/* add a child node to the current sibling list */
+void
+ASTBase::subchild(ASTBase **_root, ASTBase **_sibling, ASTBase **_tail)
+{
+ if ( *_tail != NULL ) (*_tail)->_right = this;
+ else {
+ *_sibling = this;
+ if ( *_root != NULL ) (*_root)->_down = *_sibling;
+ }
+ *_tail = this;
+ if ( *_root == NULL ) *_root = *_sibling;
+}
+
+/* make a new AST node. Make the newly-created
+ * node the root for the current sibling list. If a root node already
+ * exists, make the newly-created node the root of the current root.
+ */
+void
+ASTBase::subroot(ASTBase **_root, ASTBase **_sibling, ASTBase **_tail)
+{
+ if ( *_root != NULL )
+ if ( (*_root)->_down == *_sibling ) *_sibling = *_tail = *_root;
+ *_root = this;
+ (*_root)->_down = *_sibling;
+}
+
+/* Apply preorder_action(), etc.. to root then each sibling */
+//
+// 7-Apr-97 133MR1
+// Fix suggested by Ron House (house@helios.usq.edu.au)
+//
+void
+ASTBase::preorder(void* pData /*= NULL*/ /* MR23 */)
+{
+ ASTBase *tree = this;
+
+ while ( tree!= NULL )
+ {
+ if ( tree->_down != NULL ) {
+ tree->preorder_before_action(pData); // MR1
+ };
+ tree->preorder_action(pData);
+ if ( tree->_down!=NULL )
+ {
+ tree->_down->preorder(pData);
+ tree->preorder_after_action(pData); // MR1
+ }
+ tree = tree->_right;
+ }
+}
+
+/* free all AST nodes in tree; apply func to each before freeing */
+void
+ASTBase::destroy()
+{
+ ASTBase* tree = this;
+ while (tree) {
+ if (tree->_down) tree->_down->destroy();
+
+ ASTBase* cur = tree;
+ tree = tree->_right;
+ delete cur;
+ }
+}
+
+/* build a tree (root child1 child2 ... NULL)
+ * If root is NULL, simply make the children siblings and return ptr
+ * to 1st sibling (child1). If root is not single node, return NULL.
+ *
+ * Siblings that are actually siblins lists themselves are handled
+ * correctly. For example #( NULL, #( NULL, A, B, C), D) results
+ * in the tree ( NULL A B C D ).
+ *
+ * Requires at least two parameters with the last one being NULL. If
+ * both are NULL, return NULL.
+ */
+ASTBase *
+ASTBase::tmake(ASTBase *root, ...)
+{
+ va_list ap;
+ register ASTBase *child, *sibling=NULL, *tail=NULL /*MR23*/, *w;
+
+ va_start(ap, root);
+
+ if ( root != NULL )
+ if ( root->_down != NULL ) {
+ root->reportOverwriteOfDownPointer(); /* MR21 Report problem which almost always an error */
+ return NULL;
+ }
+ child = va_arg(ap, ASTBase *);
+ while ( child != NULL )
+ {
+ for (w=child; w->_right!=NULL; w=w->_right) {;} /* find end of child */
+ if ( sibling == NULL ) {sibling = child; tail = w;}
+ else {tail->_right = child; tail = w;}
+ child = va_arg(ap, ASTBase *);
+ }
+ if ( root==NULL ) root = sibling;
+ else root->_down = sibling;
+ va_end(ap);
+ return root;
+}
+
+#ifndef PCCTS_NOT_USING_SOR
+
+/* tree duplicate */
+// forgot to check for NULL this (TJP July 23,1995)
+ASTBase *
+ASTBase::dup()
+{
+ ASTBase *u, *t=this;
+
+ if ( t == NULL ) return NULL;
+/*
+ u = new ASTBase;
+ *u = *t;
+*/
+ u = (ASTBase *)this->shallowCopy();
+ if ( t->_right!=NULL ) u->_right = t->_right->dup();
+ else u->_right = NULL;
+ if ( t->_down!=NULL ) u->_down = t->_down->dup();
+ else u->_down = NULL;
+ return u;
+}
+#endif
+
+//
+// 7-Apr-97 133MR1
+// Fix suggested by Asgeir Olafsson (olafsson@cstar.ac.com)
+//
+/* tree duplicate */
+
+#ifndef PCCTS_NOT_USING_SOR
+
+ASTBase *
+ASTDoublyLinkedBase::dup()
+{
+ ASTDoublyLinkedBase *u, *t=this;
+
+ if ( t == NULL ) return NULL;
+ u = (ASTDoublyLinkedBase *)this->shallowCopy();
+ u->_up = NULL; /* set by calling invocation */
+ u->_left = NULL;
+ if (t->_right!=NULL) { // MR1
+ u->_right=t->_right->dup(); // MR1
+ ((ASTDoublyLinkedBase *)u->_right)->_left = u; // MR1
+ } else { // MR1
+ u->_right = NULL; // MR1
+ }; // MR1
+ if (t->_down!=NULL) { // MR1
+ u->_down = t->_down->dup(); // MR1
+ ((ASTDoublyLinkedBase *)u->_down)->_up = u; // MR1
+ } else { // MR1
+ u->_down = NULL; // MR1
+ }; // MR1
+ return u;
+}
+
+#endif
+
+/*
+ * Set the 'up', and 'left' pointers of all nodes in 't'.
+ * Initial call is double_link(your_tree, NULL, NULL).
+ */
+void
+ASTDoublyLinkedBase::double_link(ASTBase *left, ASTBase *up)
+{
+ ASTDoublyLinkedBase *t = this;
+
+ t->_left = (ASTDoublyLinkedBase *) left;
+ t->_up = (ASTDoublyLinkedBase *) up;
+ if (t->_down != NULL)
+ ((ASTDoublyLinkedBase *)t->_down)->double_link(NULL, t);
+ if (t->_right != NULL)
+ ((ASTDoublyLinkedBase *)t->_right)->double_link(t, up);
+}
+
+// MR21 ASTBase::reportOverwriteOfDownPointer
+
+void ASTBase::reportOverwriteOfDownPointer()
+{
+ panic("Attempt to overwrite down pointer in ASTBase::tmake");
+}
+
+// MR21 ASTBase::panic
+
+void ASTBase::panic(const char *msg)
+{
+ /* MR23 */ printMessage(stderr,"ASTBase panic: %s\n", msg);
+ exit(PCCTS_EXIT_FAILURE);
+}
+
+#ifdef PCCTS_NOT_USING_SOR
+//MR23
+int ASTBase::printMessage(FILE* pFile, const char* pFormat, ...)
+{
+ va_list marker;
+ va_start( marker, pFormat );
+ int iRet = vfprintf(pFile, pFormat, marker);
+ va_end( marker );
+ return iRet;
+}
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ASTBase.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ASTBase.h
new file mode 100644
index 000000000..912f4b848
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ASTBase.h
@@ -0,0 +1,122 @@
+/* Abstract syntax tree
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef ASTBase_H
+#define ASTBase_H
+
+#include "pcctscfg.h"
+
+#include "pccts_stdio.h"
+#include "pccts_stdlib.h"
+
+PCCTS_NAMESPACE_STD
+
+#ifndef PCCTS_NOT_USING_SOR
+#include "PCCTSAST.h"
+#endif
+
+/*
+ * Notes:
+ *
+ * To specify a copy constructor, subclass one of these classes and
+ * give the copy constructor. To use dup(), you must define shallowCopy().
+ * shallowCopy() can use either a copy constructor or just copy the node
+ * itself.
+ */
+
+#ifdef PCCTS_NOT_USING_SOR
+class DllExportPCCTS ASTBase {
+#else
+class DllExportPCCTS ASTBase : public PCCTS_AST {
+#endif
+
+protected:
+ ASTBase *_right, *_down;
+
+public:
+
+#ifdef PCCTS_NOT_USING_SOR
+ ASTBase *right() { return _right; }
+ ASTBase *down() { return _down; }
+ void setRight(ASTBase *t) { _right = (ASTBase *)t; }
+ void setDown(ASTBase *t) { _down = (ASTBase *)t; }
+#else
+ PCCTS_AST *right() { return _right; } // define the SORCERER interface
+ PCCTS_AST *down() { return _down; }
+ void setRight(PCCTS_AST *t) { _right = (ASTBase *)t; }
+ void setDown(PCCTS_AST *t) { _down = (ASTBase *)t; }
+#endif
+ ASTBase() { _right = _down = NULL; }
+ virtual ~ASTBase() { ; }
+#ifndef PCCTS_NOT_USING_SOR
+ virtual ASTBase *dup();
+#endif
+ void destroy();
+ void preorder(void* pData = NULL /* MR23 */);
+ static ASTBase *tmake(ASTBase *, ...);
+ static void link(ASTBase **, ASTBase **, ASTBase **);
+ void subchild(ASTBase **, ASTBase **, ASTBase **);
+ void subroot(ASTBase **, ASTBase **, ASTBase **);
+ virtual void preorder_action(void* /*pData*/ = NULL /* MR23 */) { ; }
+ virtual void preorder_before_action(void* /*pData*/ = NULL /* MR23 */) { /* MR23 */ printMessage(stdout, " ("); }
+ virtual void preorder_after_action(void* /*pData*/ = NULL /* MR23 */) { /* MR23 */ printMessage(stdout, " )"); }
+ virtual void panic(const char *msg); /* MR21 */
+ virtual void reportOverwriteOfDownPointer(); /* MR21 */
+#ifdef PCCTS_NOT_USING_SOR
+ virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23
+#endif
+};
+
+class DllExportPCCTS ASTDoublyLinkedBase : public ASTBase {
+protected:
+ ASTDoublyLinkedBase *_left, *_up;
+
+public:
+ void double_link(ASTBase *left, ASTBase *up);
+
+#ifndef PCCTS_NOT_USING_SOR
+ virtual ASTBase *dup();
+#endif
+
+#ifdef PCCTS_NOT_USING_SOR
+ ASTBase *left() { return _left; }
+ ASTBase *up() { return _up; }
+ void setLeft(ASTBase *t) { _left = (ASTDoublyLinkedBase *)t; } // MR6
+ void setUp(ASTBase *t) { _up = (ASTDoublyLinkedBase *)t; } // MR6
+#else
+ PCCTS_AST *left() { return _left; }
+ PCCTS_AST *up() { return _up; }
+ void setLeft(PCCTS_AST *t) { _left = (ASTDoublyLinkedBase *)t; } // MR6
+ void setUp(PCCTS_AST *t) { _up = (ASTDoublyLinkedBase *)t; } // MR6
+#endif
+
+};
+
+class AST; // announce that this class will be coming along shortly
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtr.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtr.h
new file mode 100644
index 000000000..df89d8ff6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtr.h
@@ -0,0 +1,88 @@
+/* ATokPtr.h
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Written by Russell Quong June 30, 1995
+ * Adapted by Terence Parr to ANTLR stuff
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef ATokPtr_h
+#define ATokPtr_h
+
+#include "pcctscfg.h"
+
+#include "pccts_stdio.h"
+
+PCCTS_NAMESPACE_STD
+
+// pointer to a reference counted object
+// robust in that an unused ANTLRTokenPtr can point to NULL.
+
+class ANTLRAbstractToken;
+
+class DllExportPCCTS ANTLRTokenPtr {
+public:
+ ANTLRTokenPtr(ANTLRAbstractToken *addr=NULL){ptr_ = addr; ref();}
+ ANTLRTokenPtr(const ANTLRTokenPtr &lhs) {ptr_ = lhs.ptr_; lhs.ref();}
+ ~ANTLRTokenPtr();
+
+ // use ANTLRTokenPtr as a pointer to ANTLRToken
+//
+// 8-Apr-97 MR1 Make operator -> a const member function
+// as well as some other member functions
+//
+ ANTLRAbstractToken *operator-> () const { return ptr_; } // MR1
+//
+// 7-Apr-97 133MR1
+// Fix suggested by Andreas Magnusson
+// (Andreas.Magnusson@mailbox.swipnet.se)
+ ANTLRTokenPtr& operator = (const ANTLRTokenPtr & lhs); // MR1
+ ANTLRTokenPtr& operator = (ANTLRAbstractToken *addr);
+ int operator != (const ANTLRTokenPtr &q) const // MR1 // MR11 unsigned -> int
+ { return this->ptr_ != q.ptr_; }
+ int operator == (const ANTLRTokenPtr &q) const // MR1 // MR11 unsigned -> int
+ { return this->ptr_ == q.ptr_; }
+ int operator == (const ANTLRAbstractToken *addr) const // MR11
+ { return this->ptr_ == addr; }
+ int operator != (const ANTLRAbstractToken *addr) const // MR11
+ { return this->ptr_ != addr; }
+
+ void ref() const;
+ void deref();
+
+protected:
+ ANTLRAbstractToken *ptr_;
+};
+
+//typedef ANTLRTokenPtr _ANTLRTokenPtr;
+
+/*
+ * Since you cannot redefine operator->() to return one of the user's
+ * token object types, we must down cast. This is a drag. Here's
+ * a macro that helps. template: "mytoken(a-smart-ptr)->myfield".
+ */
+#define mytoken(tk) ((ANTLRToken *)(tk.operator->()))
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtrImpl.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtrImpl.h
new file mode 100644
index 000000000..4d682a5ef
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtrImpl.h
@@ -0,0 +1,90 @@
+/*
+ * ATokPtrImpl.h (formerly ATokPtr.cpp)
+ *
+ * This is #included in ATokBuffer.cpp for historical reasons.
+ * It has been renamed because of problems with the .cpp extension
+ * when used with IDE.
+ *
+ *
+ * ANTLRToken MUST be defined before entry to this file.
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Written by Russell Quong June 30, 1995
+ * Adapted by Terence Parr to ANTLR stuff
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#include "pcctscfg.h"
+
+PCCTS_NAMESPACE_STD
+
+#include "ATokPtr.h"
+
+void ANTLRTokenPtr::ref() const
+{
+ if (ptr_ != NULL) {
+ ptr_->ref();
+ }
+}
+
+void ANTLRTokenPtr::deref()
+{
+ if (ptr_ != NULL)
+ {
+ ptr_->deref();
+ if ( ptr_->nref()==0 )
+ {
+ delete ptr_;
+ ptr_ = NULL;
+ }
+ }
+}
+
+ANTLRTokenPtr::~ANTLRTokenPtr()
+{
+ deref();
+}
+
+//
+// 8-Apr-97 MR1 Make operator -> a const member function
+// as well as some other member functions
+//
+ANTLRTokenPtr& ANTLRTokenPtr::operator = (const ANTLRTokenPtr & lhs) // MR1
+{
+ lhs.ref(); // protect against "xp = xp"; ie same underlying object
+ deref();
+ ptr_ = lhs.ptr_;
+ return *this;
+}
+
+ANTLRTokenPtr& ANTLRTokenPtr::operator = (ANTLRAbstractToken *addr)
+{
+ if (addr != NULL) {
+ addr->ref();
+ }
+ deref();
+ ptr_ = addr;
+ return *this;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/AToken.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/AToken.h
new file mode 100644
index 000000000..6167c21ef
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/AToken.h
@@ -0,0 +1,325 @@
+/* ANTLRToken.h
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef ATOKEN_H_GATE
+#define ATOKEN_H_GATE
+
+#include "pcctscfg.h"
+
+#include "pccts_string.h"
+#include "pccts_stdio.h"
+#include "pccts_stdlib.h"
+#include "pccts_stdarg.h" // MR23
+
+PCCTS_NAMESPACE_STD
+
+// MR9 RJV (JVincent@novell.com) Not needed for variable length strings
+
+//// MR9 #ifndef ANTLRCommonTokenTEXTSIZE
+//// MR9 #define ANTLRCommonTokenTEXTSIZE 100
+//// MR9 #endif
+
+
+/* must define what a char looks like; can make this a class too */
+typedef char ANTLRChar;
+
+/* D E F I N E S M A R T P O I N T E R S */
+
+//#include ATOKPTR_H not tested yet, leave out
+class ANTLRAbstractToken;
+typedef ANTLRAbstractToken *_ANTLRTokenPtr;
+
+class ANTLRAbstractToken {
+public:
+ virtual ~ANTLRAbstractToken() {;}
+ virtual ANTLRTokenType getType() const = 0;
+ virtual void setType(ANTLRTokenType t) = 0;
+ virtual int getLine() const = 0;
+ virtual void setLine(int line) = 0;
+ virtual ANTLRChar *getText() const = 0;
+ virtual void setText(const ANTLRChar *) = 0;
+
+ /* This function will disappear when I can use templates */
+ virtual ANTLRAbstractToken *makeToken(ANTLRTokenType tt,
+ ANTLRChar *text,
+ int line) = 0;
+
+ /* define to satisfy ANTLRTokenBuffer's need to determine whether or
+ not a token object can be destroyed. If nref()==0, no one has
+ a reference, and the object may be destroyed. This function defaults
+ to 1, hence, if you use deleteTokens() message with a token object
+ not derived from ANTLRCommonRefCountToken, the parser will compile
+ but will not delete objects after they leave the token buffer.
+ */
+
+ virtual unsigned nref() const { return 1; } // MR11
+ virtual void ref() {;}
+ virtual void deref() {;}
+
+ virtual void panic(const char *msg) // MR20 const
+ {
+ /* MR23 */ printMessage(stderr, "ANTLRAbstractToken panic: %s\n", msg);
+ exit(PCCTS_EXIT_FAILURE);
+ }
+
+ virtual int printMessage(FILE* pFile, const char* pFormat, ...) // MR23
+ {
+ va_list marker;
+ va_start( marker, pFormat );
+ int iRet = vfprintf(pFile, pFormat, marker);
+ va_end( marker );
+ return iRet;
+ }
+};
+
+/* This class should be subclassed. It cannot store token type or text */
+
+class ANTLRRefCountToken : public ANTLRAbstractToken {
+public:
+#ifdef DBG_REFCOUNTTOKEN
+ static int ctor;
+ static int dtor;
+#endif
+protected:
+ unsigned refcnt_;
+#ifdef DBG_REFCOUNTTOKEN
+ char object[200];
+#endif
+
+public:
+
+ // MR23 - No matter what you do, you're hammered.
+ // Don't give names to formals something breaks.
+ // Give names to formals and don't use them it breaks.
+
+#ifndef DBG_REFCOUNTTOKEN
+ ANTLRRefCountToken(ANTLRTokenType /* t MR23 */, const ANTLRChar * /* s MR23 */)
+#else
+ ANTLRRefCountToken(ANTLRTokenType t, const ANTLRChar * s)
+#endif
+
+#ifndef DBG_REFCOUNTTOKEN
+ {
+ refcnt_ = 0;
+ }
+#else
+ {
+ ctor++;
+ refcnt_ = 0;
+ if ( t==1 ) sprintf(object,"tok_EOF");
+ else sprintf(object,"tok_%s",s);
+ /* MR23 */ printMessage(stderr, "ctor %s #%d\n",object,ctor);
+ }
+#endif
+ ANTLRRefCountToken()
+#ifndef DBG_REFCOUNTTOKEN
+ { refcnt_ = 0; }
+#else
+ {
+ ctor++;
+ refcnt_ = 0;
+ sprintf(object,"tok_blank");
+ /* MR23 */ printMessage(stderr, "ctor %s #%d\n",object,ctor);
+ }
+ virtual ~ANTLRRefCountToken()
+ {
+ dtor++;
+ if ( dtor>ctor ) /* MR23 */ printMessage(stderr, "WARNING: dtor>ctor\n");
+ /* MR23 */ printMessage(stderr, "dtor %s #%d\n", object, dtor);
+ object[0]='\0';
+ }
+#endif
+
+ // reference counting stuff needed by ANTLRTokenPtr.
+ // User should not access these; for C++ language reasons, we had
+ // to make these public. Yuck.
+
+ void ref() { refcnt_++; }
+ void deref() { refcnt_--; }
+ unsigned nref() const { return refcnt_; } // MR11
+
+ virtual ANTLRAbstractToken *makeToken(ANTLRTokenType /*tt MR23*/,
+ ANTLRChar * /*txt MR23*/,
+ int /*line MR23*/)
+ {
+ panic("call to ANTLRRefCountToken::makeToken()\n");
+ return NULL;
+ }
+};
+
+class ANTLRCommonNoRefCountToken : public ANTLRAbstractToken {
+protected:
+ ANTLRTokenType _type;
+ int _line;
+ ANTLRChar *_text; // MR9 RJV
+
+public:
+ ANTLRCommonNoRefCountToken(ANTLRTokenType t, const ANTLRChar *s)
+ { setType(t); _line = 0; _text = NULL; setText(s); }
+ ANTLRCommonNoRefCountToken()
+ { setType((ANTLRTokenType)0); _line = 0; _text = NULL; setText(""); }
+
+ ~ANTLRCommonNoRefCountToken() { if (_text) delete [] _text; } // MR9 RJV: Added Destructor to remove string
+
+ ANTLRTokenType getType() const { return _type; }
+ void setType(ANTLRTokenType t) { _type = t; }
+ virtual int getLine() const { return _line; }
+ void setLine(int line) { _line = line; }
+ ANTLRChar *getText() const { return _text; }
+ int getLength() const { return strlen(getText()); } // MR11
+
+// MR9 RJV: Added code for variable length strings to setText()
+
+ void setText(const ANTLRChar *s)
+ { if (s != _text) {
+ if (_text) delete [] _text;
+ if (s != NULL) {
+ _text = new ANTLRChar[strlen(s)+1];
+ if (_text == NULL) panic("ANTLRCommonNoRefCountToken::setText new failed");
+ strcpy(_text,s);
+ } else {
+ _text = new ANTLRChar[1];
+ if (_text == NULL) panic("ANTLRCommonNoRefCountToken::setText new failed");
+ strcpy(_text,"");
+ };
+ };
+ }
+
+ virtual ANTLRAbstractToken *makeToken(ANTLRTokenType tt,
+ ANTLRChar *txt,
+ int line)
+ {
+ ANTLRAbstractToken *t = new ANTLRCommonNoRefCountToken;
+ t->setType(tt); t->setText(txt); t->setLine(line);
+ return t;
+ }
+
+// MR9 THM Copy constructor required when heap allocated string is used with copy semantics
+
+ ANTLRCommonNoRefCountToken (const ANTLRCommonNoRefCountToken& from) :
+ ANTLRAbstractToken(from) {
+ setType(from._type);
+ setLine(from._line);
+ _text=NULL;
+ setText(from._text);
+ };
+
+// MR9 THM operator =() required when heap allocated string is used with copy semantics
+
+ virtual ANTLRCommonNoRefCountToken& operator =(const ANTLRCommonNoRefCountToken& rhs) {
+
+////// MR15 WatCom can't hack use of operator =()
+////// Use this: *( (ANTRLAbstractToken *) this)=rhs;
+
+ *( (ANTLRAbstractToken *) this ) = rhs;
+
+ setType(rhs._type);
+ setLine(rhs._line);
+ setText(rhs._text);
+ return *this;
+ };
+};
+
+class ANTLRCommonToken : public ANTLRRefCountToken {
+protected:
+ ANTLRTokenType _type;
+ int _line;
+ ANTLRChar *_text; // MR9 RJV:Added
+
+public:
+ ANTLRCommonToken(ANTLRTokenType t, const ANTLRChar *s) : ANTLRRefCountToken(t,s)
+ { setType(t); _line = 0; _text = NULL; setText(s); } // MR9
+ ANTLRCommonToken()
+ { setType((ANTLRTokenType)0); _line = 0; _text = NULL; setText(""); } // MR9
+
+ virtual ~ANTLRCommonToken() { if (_text) delete [] _text; } // MR9 RJV: Added Destructor to remove string
+
+ ANTLRTokenType getType() const { return _type; }
+ void setType(ANTLRTokenType t) { _type = t; }
+ virtual int getLine() const { return _line; }
+ void setLine(int line) { _line = line; }
+ ANTLRChar *getText() const { return _text; }
+ int getLength() const { return strlen(getText()); } // MR11
+
+// MR9 RJV: Added code for variable length strings to setText()
+
+ void setText(const ANTLRChar *s)
+ { if (s != _text) {
+ if (_text) delete [] _text;
+ if (s != NULL) {
+ _text = new ANTLRChar[strlen(s)+1];
+ if (_text == NULL) panic("ANTLRCommonToken::setText new failed");
+ strcpy(_text,s);
+ } else {
+ _text = new ANTLRChar[1];
+ if (_text == NULL) panic("ANTLRCommonToken::setText new failed");
+ strcpy(_text,"");
+ };
+ };
+ }
+
+ virtual ANTLRAbstractToken *makeToken(ANTLRTokenType tt,
+ ANTLRChar *txt,
+ int line)
+ {
+ ANTLRAbstractToken *t = new ANTLRCommonToken(tt,txt);
+ t->setLine(line);
+ return t;
+ }
+
+// MR9 THM Copy constructor required when heap allocated string is used with copy semantics
+
+ ANTLRCommonToken (const ANTLRCommonToken& from) :
+ ANTLRRefCountToken(from) {
+ setType(from._type);
+ setLine(from._line);
+ _text=NULL;
+ setText(from._text);
+ };
+
+// MR9 THM operator =() required when heap allocated string is used with copy semantics
+
+ virtual ANTLRCommonToken& operator =(const ANTLRCommonToken& rhs) {
+
+////// MR15 WatCom can't hack use of operator =()
+////// Use this instead: *( (ANTRLRRefCountToken *) this)=rhs;
+
+ *( (ANTLRRefCountToken *) this) = rhs;
+
+ setType(rhs._type);
+ setLine(rhs._line);
+ setText(rhs._text);
+ return *this;
+ };
+};
+
+// used for backward compatibility
+typedef ANTLRCommonToken ANTLRCommonBacktrackingToken;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokenBuffer.cpp b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokenBuffer.cpp
new file mode 100644
index 000000000..9a2f2fc88
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokenBuffer.cpp
@@ -0,0 +1,374 @@
+/* ANTLRTokenBuffer.cpp
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+typedef int ANTLRTokenType; // fool AToken.h into compiling
+
+class ANTLRParser; /* MR1 */
+
+#define ANTLR_SUPPORT_CODE
+
+#include "pcctscfg.h"
+
+#include ATOKENBUFFER_H
+#include APARSER_H // MR23
+
+typedef ANTLRAbstractToken *_ANTLRTokenPtr;
+
+#if defined(DBG_TBUF)||defined(DBG_TBUF_MARK_REW)
+static unsigned char test[1000];
+#endif
+
+#ifdef DBG_REFCOUNTTOKEN
+int ANTLRRefCountToken::ctor = 0; /* MR23 */
+int ANTLRRefCountToken::dtor = 0; /* MR23 */
+#endif
+
+ANTLRTokenBuffer::
+ANTLRTokenBuffer(ANTLRTokenStream *_input, int _k, int _chunk_size_formal) /* MR14 */
+{
+ this->input = _input;
+ this->k = _k;
+ buffer_size = chunk_size = _chunk_size_formal;
+ buffer = (_ANTLRTokenPtr *)
+ calloc(chunk_size+1,sizeof(_ANTLRTokenPtr ));
+ if ( buffer == NULL ) {
+ panic("cannot alloc token buffer");
+ }
+ buffer++; // leave the first elem empty so tp-1 is valid ptr
+
+ tp = &buffer[0];
+ last = tp-1;
+ next = &buffer[0];
+ num_markers = 0;
+ end_of_buffer = &buffer[buffer_size-1];
+ threshold = &buffer[(int)(buffer_size/2)]; // MR23 - Used to be 1.0/2.0 !
+ _deleteTokens = 1; // assume we delete tokens
+ parser=NULL; // MR5 - uninitialized reference
+}
+
+static void f() {;}
+ANTLRTokenBuffer::
+~ANTLRTokenBuffer()
+{
+ f();
+ // Delete all remaining tokens (from 0..last inclusive)
+ if ( _deleteTokens )
+ {
+ _ANTLRTokenPtr *z;
+ for (z=buffer; z<=last; z++)
+ {
+ (*z)->deref();
+// z->deref();
+#ifdef DBG_REFCOUNTTOKEN
+ /* MR23 */ printMessage(stderr, "##########dtor: deleting token '%s' (ref %d)\n",
+ ((ANTLRCommonToken *)*z)->getText(), (*z)->nref());
+#endif
+ if ( (*z)->nref()==0 )
+ {
+ delete (*z);
+ }
+ }
+ }
+
+ if ( buffer!=NULL ) free((char *)(buffer-1));
+}
+
+#if defined(DBG_TBUF)||defined(DBG_TBUF_MARK_REW)
+#include "pccts_stdio.h"
+PCCTS_NAMESPACE_STD
+#endif
+
+_ANTLRTokenPtr ANTLRTokenBuffer::
+getToken()
+{
+ if ( tp <= last ) // is there any buffered lookahead still to be read?
+ {
+ return *tp++; // read buffered lookahead
+ }
+ // out of buffered lookahead, get some more "real"
+ // input from getANTLRToken()
+ if ( num_markers==0 )
+ {
+ if( next > threshold )
+ {
+#ifdef DBG_TBUF
+/* MR23 */ printMessage(stderr,"getToken: next > threshold (high water is %d)\n", threshold-buffer);
+#endif
+ makeRoom();
+ }
+ }
+ else {
+ if ( next > end_of_buffer )
+ {
+#ifdef DBG_TBUF
+/* MR23 */ printMessage(stderr,"getToken: next > end_of_buffer (size is %d)\n", buffer_size);
+#endif
+ extendBuffer();
+ }
+ }
+ *next = getANTLRToken();
+ (*next)->ref(); // say we have a copy of this pointer in buffer
+ last = next;
+ next++;
+ tp = last;
+ return *tp++;
+}
+
+void ANTLRTokenBuffer::
+rewind(int pos)
+{
+#if defined(DBG_TBUF)||defined(DBG_TBUF_MARK_REW)
+ /* MR23 */ printMessage(stderr, "rewind(%d)[nm=%d,from=%d,%d.n=%d]\n", pos, num_markers, tp-buffer,pos,test[pos]);
+ test[pos]--;
+#endif
+ tp = &buffer[pos];
+ num_markers--;
+}
+
+/*
+ * This function is used to specify that the token pointers read
+ * by the ANTLRTokenBuffer should be buffered up (to be reused later).
+ */
+int ANTLRTokenBuffer::
+mark()
+{
+#if defined(DBG_TBUF)||defined(DBG_TBUF_MARK_REW)
+ test[tp-buffer]++;
+ /* MR23 */ printMessage(stderr,"mark(%d)[nm=%d,%d.n=%d]\n",tp-buffer,num_markers+1,tp-buffer,test[tp-buffer]);
+#endif
+ num_markers++;
+ return tp - buffer;
+}
+
+/*
+ * returns the token pointer n positions ahead.
+ * This implies that bufferedToken(1) gets the NEXT symbol of lookahead.
+ * This is used in conjunction with the ANTLRParser lookahead buffer.
+ *
+ * No markers are set or anything. A bunch of input is buffered--that's all.
+ * The tp pointer is left alone as the lookahead has not been advanced
+ * with getToken(). The next call to getToken() will find a token
+ * in the buffer and won't have to call getANTLRToken().
+ *
+ * If this is called before a consume() is done, how_many_more_i_need is
+ * set to 'n'.
+ */
+_ANTLRTokenPtr ANTLRTokenBuffer::
+bufferedToken(int n)
+{
+// int how_many_more_i_need = (last-tp < 0) ? n : n-(last-tp)-1;
+ int how_many_more_i_need = (tp > last) ? n : n-(last-tp)-1;
+ // Make sure that at least n tokens are available in the buffer
+#ifdef DBG_TBUF
+ /* MR23 */ printMessage(stderr, "bufferedToken(%d)\n", n);
+#endif
+ for (int i=1; i<=how_many_more_i_need; i++)
+ {
+ if ( next > end_of_buffer ) // buffer overflow?
+ {
+ extendBuffer();
+ }
+ *next = getANTLRToken();
+ (*next)->ref(); // say we have a copy of this pointer in buffer
+ last = next;
+ next++;
+ }
+ return tp[n - 1];
+}
+
+/* If no markers are set, the none of the input needs to be saved (except
+ * for the lookahead Token pointers). We save only k-1 token pointers as
+ * we are guaranteed to do a getANTLRToken() right after this because otherwise
+ * we wouldn't have needed to extend the buffer.
+ *
+ * If there are markers in the buffer, we need to save things and so
+ * extendBuffer() is called.
+ */
+void ANTLRTokenBuffer::
+makeRoom()
+{
+#ifdef DBG_TBUF
+ /* MR23 */ printMessage(stderr, "in makeRoom.................\n");
+ /* MR23 */ printMessage(stderr, "num_markers==%d\n", num_markers);
+#endif
+/*
+ if ( num_markers == 0 )
+ {
+*/
+#ifdef DBG_TBUF
+ /* MR23 */ printMessage(stderr, "moving lookahead and resetting next\n");
+
+ _ANTLRTokenPtr *r;
+ /* MR23 */ printMessage(stderr, "tbuf = [");
+ for (r=buffer; r<=last; r++)
+ {
+ if ( *r==NULL ) /* MR23 */ printMessage(stderr, " xxx");
+ else /* MR23 */ printMessage(stderr, " '%s'", ((ANTLRCommonToken *)*r)->getText());
+ }
+ /* MR23 */ printMessage(stderr, " ]\n");
+
+ /* MR23 */ printMessage(stderr,
+ "before: tp=%d, last=%d, next=%d, threshold=%d\n",tp-buffer,last-buffer,next-buffer,threshold-buffer);
+#endif
+
+ // Delete all tokens from 0..last-(k-1) inclusive
+ if ( _deleteTokens )
+ {
+ _ANTLRTokenPtr *z;
+ for (z=buffer; z<=last-(k-1); z++)
+ {
+ (*z)->deref();
+// z->deref();
+#ifdef DBG_REFCOUNTTOKEN
+ /* MR23 */ printMessage(stderr, "##########makeRoom: deleting token '%s' (ref %d)\n",
+ ((ANTLRCommonToken *)*z)->getText(), (*z)->nref());
+#endif
+ if ( (*z)->nref()==0 )
+ {
+ delete (*z);
+ }
+ }
+ }
+
+ // reset the buffer to initial conditions, but move k-1 symbols
+ // to the beginning of buffer and put new input symbol at k
+ _ANTLRTokenPtr *p = buffer, *q = last-(k-1)+1;
+// ANTLRAbstractToken **p = buffer, **q = end_of_buffer-(k-1)+1;
+#ifdef DBG_TBUF
+ /* MR23 */ printMessage(stderr, "lookahead buffer = [");
+#endif
+ for (int i=1; i<=(k-1); i++)
+ {
+ *p++ = *q++;
+#ifdef DBG_TBUF
+ /* MR23 */ printMessage(stderr,
+ " '%s'", ((ANTLRCommonToken *)buffer[i-1])->getText());
+#endif
+ }
+#ifdef DBG_TBUF
+ /* MR23 */ printMessage(stderr, " ]\n");
+#endif
+ next = &buffer[k-1];
+ tp = &buffer[k-1]; // tp points to what will be filled in next
+ last = tp-1;
+#ifdef DBG_TBUF
+ /* MR23 */ printMessage(stderr,
+ "after: tp=%d, last=%d, next=%d\n",
+ tp-buffer, last-buffer, next-buffer);
+#endif
+/*
+ }
+ else {
+ extendBuffer();
+ }
+*/
+}
+
+/* This function extends 'buffer' by chunk_size and returns with all
+ * pointers at the same relative positions in the buffer (the buffer base
+ * address could have changed in realloc()) except that 'next' comes
+ * back set to where the next token should be stored. All other pointers
+ * are untouched.
+ */
+void
+ANTLRTokenBuffer::
+extendBuffer()
+{
+ int save_last = last-buffer, save_tp = tp-buffer, save_next = next-buffer;
+#ifdef DBG_TBUF
+ /* MR23 */ printMessage(stderr, "extending physical buffer\n");
+#endif
+ buffer_size += chunk_size;
+ buffer = (_ANTLRTokenPtr *)
+ realloc((char *)(buffer-1),
+ (buffer_size+1)*sizeof(_ANTLRTokenPtr ));
+ if ( buffer == NULL ) {
+ panic("cannot alloc token buffer");
+ }
+ buffer++; // leave the first elem empty so tp-1 is valid ptr
+
+ tp = buffer + save_tp; // put the pointers back to same relative position
+ last = buffer + save_last;
+ next = buffer + save_next;
+ end_of_buffer = &buffer[buffer_size-1];
+ threshold = &buffer[(int)(buffer_size*(1.0/2.0))];
+
+/*
+ // zero out new token ptrs so we'll know if something to delete in buffer
+ ANTLRAbstractToken **p = end_of_buffer-chunk_size+1;
+ for (; p<=end_of_buffer; p++) *p = NULL;
+*/
+}
+
+ANTLRParser * ANTLRTokenBuffer:: // MR1
+setParser(ANTLRParser *p) { // MR1
+ ANTLRParser *old=parser; // MR1
+ parser=p; // MR1
+ input->setParser(p); // MR1
+ return old; // MR1
+} // MR1
+ // MR1
+ANTLRParser * ANTLRTokenBuffer:: // MR1
+getParser() { // MR1
+ return parser; // MR1
+} // MR1
+
+void ANTLRTokenBuffer::panic(const char *msg) // MR23
+{
+ if (parser) //MR23
+ parser->panic(msg); //MR23
+ else //MR23
+ exit(PCCTS_EXIT_FAILURE);
+}
+
+//MR23
+int ANTLRTokenBuffer::printMessage(FILE* pFile, const char* pFormat, ...)
+{
+ va_list marker;
+ va_start( marker, pFormat );
+
+ int iRet = 0;
+ if (parser)
+ parser->printMessageV(pFile, pFormat, marker);
+ else
+ iRet = vfprintf(pFile, pFormat, marker);
+
+ va_end( marker );
+ return iRet;
+}
+
+/* to avoid having to link in another file just for the smart token ptr
+ * stuff, we include it here. Ugh.
+ *
+ * MR23 This causes nothing but problems for IDEs.
+ * Change from .cpp to .h
+ *
+ */
+
+#include ATOKPTR_IMPL_H
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokenBuffer.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokenBuffer.h
new file mode 100644
index 000000000..1c008fd59
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokenBuffer.h
@@ -0,0 +1,109 @@
+/* ANTLRTokenBuffer.h
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef ATOKENBUFFER_H_GATE
+#define ATOKENBUFFER_H_GATE
+
+#include "pcctscfg.h"
+
+#include "pccts_stdlib.h"
+
+PCCTS_NAMESPACE_STD
+
+#include ATOKEN_H
+#include ATOKENSTREAM_H
+
+/*
+ * The parser is "attached" to an ANTLRTokenBuffer via interface
+ * functions: getToken() and bufferedToken(). The object that actually
+ * consumes characters and constructs tokens is connected to the
+ * ANTLRTokenBuffer via interface function ANTLRTokenStream::getToken();
+ * where ANTLRTokenStream is really just a behavior (class with no data).
+ * C++ does not have this abstraction and hence we simply have come up
+ * with a fancy name for "void *". See the note in ANTLRTokenStream.h on
+ * the "behavior" of ANTLRTokenStream.
+ */
+
+class ANTLRParser; // MR1
+
+class DllExportPCCTS ANTLRTokenBuffer {
+protected:
+ ANTLRTokenStream *input; // where do I get tokens
+ int buffer_size;
+ int chunk_size;
+ int num_markers;
+ int k; // Need at least this many tokens in buffer
+ _ANTLRTokenPtr *buffer; // buffer used for arbitrary lookahead
+ _ANTLRTokenPtr *tp; // pts into buffer; current token ptr
+ _ANTLRTokenPtr *last; // pts to last valid token in buffer
+ _ANTLRTokenPtr *next; // place to put token from getANTLRToken()
+ _ANTLRTokenPtr *end_of_buffer;
+ /* when you try to write a token past this and there are no markers
+ set, then move k-1 tokens back to the beginning of the buffer.
+ We want to stay away from the end of the buffer because we have
+ to extend it if a marker is set and we reach the end (we cannot
+ move tokens to the beginning of the buffer in this case).
+ */
+ _ANTLRTokenPtr *threshold;
+ unsigned char _deleteTokens;
+
+ // This function is filled in by the subclass; it initiates fetch of input
+ virtual _ANTLRTokenPtr getANTLRToken() { return input->getToken(); }
+ void makeRoom();
+ void extendBuffer();
+
+public:
+ ANTLRTokenBuffer(ANTLRTokenStream *in, int k=1, int chksz=50);
+ virtual ~ANTLRTokenBuffer();
+ virtual _ANTLRTokenPtr getToken();
+ virtual void rewind(int pos);
+ virtual int mark();
+ virtual _ANTLRTokenPtr bufferedToken(int i);
+
+ void noGarbageCollectTokens() { _deleteTokens=0; }
+ void garbageCollectTokens() { _deleteTokens=1; }
+
+ virtual int bufferSize() { return buffer_size; }
+ virtual int minTokens() { return k; }
+ virtual void setMinTokens(int k_new) { k = k_new; }
+
+ virtual void panic(const char *msg); /* MR20 const */
+
+ virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23
+
+protected: // MR1
+ ANTLRParser *parser; // MR1
+public: // MR1
+ ANTLRParser *setParser(ANTLRParser *p); // MR1
+ ANTLRParser *getParser(); // MR1
+ ANTLRTokenStream *getLexer() const { // MR12
+ return input;} // MR12
+};
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokenStream.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokenStream.h
new file mode 100644
index 000000000..3dfea6ebf
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ATokenStream.h
@@ -0,0 +1,51 @@
+/* ANTLRTokenStream.h
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef ATOKENSTREAM_H_GATE
+#define ATOKENSTREAM_H_GATE
+
+#include "pcctscfg.h"
+
+/* This is really a behavior or protocol; it merely indicates the behavior
+ * required of the input and output of an ANTLRTokenBuffer. You could
+ * subclass it, but you can also just pass any old pointer to ANTLRTokenBuffer
+ * with a type cast (in which case, your getANTLRToken() would have to
+ * explicitly cast the input pointer to your REAL type (typically your lexer)).
+ */
+
+class ANTLRParser; // MR1
+
+class DllExportPCCTS ANTLRTokenStream {
+public:
+ virtual _ANTLRTokenPtr getToken() = 0;
+ virtual ANTLRParser * setParser(ANTLRParser * /*p MR23*/) {return 0; }; // MR12
+ virtual ANTLRParser * getParser() { return 0; }; // MR12
+};
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/BufFileInput.cpp b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/BufFileInput.cpp
new file mode 100644
index 000000000..99d08a42a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/BufFileInput.cpp
@@ -0,0 +1,100 @@
+// FILE: BufFileInput.cpp
+// AUTHOR: Alexey Demakov (AVD) demakov@kazbek.ispras.ru
+// CREATION: 26-JAN-1998
+// DESCRIPTION: File Input Stream with lookahead for Scanner.
+// See file BufFileInput.h for details
+
+// Change History:
+//
+// 22-Jun-1998 assert.h -> PCCTS_ASSERT_H
+// string.h -> PCCTS_STRING_H
+//
+// 28-May-1998 Add virtual destructor to release buffer.
+//
+// Add dummy definition for ANTLRTokenType
+// to allow compilation without knowing
+// token type codes.
+//
+// Manfred Kogler (km@cast.uni-linz.ac.at)
+// (1.33MR14)
+//
+// 20-Jul-1998 MR14a - Reorder initialization list for ctor.
+//
+
+enum ANTLRTokenType {TER_HATES_CPP=0, SO_DO_OTHERS=9999 };
+
+#include "pcctscfg.h"
+#include "pccts_assert.h"
+#include "pccts_string.h"
+
+PCCTS_NAMESPACE_STD
+
+#include "BufFileInput.h"
+
+BufFileInput::BufFileInput( FILE *f, int buf_size )
+: input( f ),
+ buf( new int[buf_size] ),
+ size( buf_size ),
+ start( 0 ),
+ len( 0 )
+{
+}
+
+BufFileInput::~BufFileInput()
+{
+ delete [] buf;
+}
+
+int BufFileInput::nextChar( void )
+{
+ if( len > 0 )
+ {
+ // get char from buffer
+ int c = buf[start];
+
+ if( c != EOF )
+ {
+ start++; start %= size;
+ len--;
+ }
+ return c;
+ } else {
+ // get char from file
+ int c = getc( input );
+
+ if( c == EOF )
+ {
+ // if EOF - put it in the buffer as indicator
+ buf[start] = EOF;
+ len++;
+ }
+ return c;
+ }
+}
+
+int BufFileInput::lookahead( char* s )
+{
+ int l = strlen( s );
+
+ assert( 0 < l && l <= size );
+
+ while( len < l )
+ {
+ int c = getc( input );
+
+ buf[ (start+len) % size ] = c;
+
+ len++;
+
+ if( c == EOF ) return 0;
+ }
+
+ for( int i = 0; i < l; i++ )
+ {
+ if( s[i] != buf[ (start+i) % size ] ) return 0;
+ }
+ return 1;
+}
+
+// End of file BufFileInput.cpp
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/BufFileInput.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/BufFileInput.h
new file mode 100644
index 000000000..ea54c0ee2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/BufFileInput.h
@@ -0,0 +1,53 @@
+// FILE: BufFileInput.h
+// AUTHOR: Alexey Demakov (AVD) demakov@kazbek.ispras.ru
+// CREATION: 26-JAN-1998
+// DESCRIPTION: File Input Stream with lookahead for Scanner
+// Tested under Win32 with ANTLR 1.33 MR10 and MSVC 5.0
+
+// Change History:
+//
+// 28-May-1998 Add virtual destructor to release buffer
+// Manfred Kogler (km@cast.uni-linz.ac.at)
+// (1.33MR14)
+
+#ifndef BufFileInput_h
+#define BufFileInput_h
+
+#include "pcctscfg.h"
+
+#include "pccts_stdio.h"
+
+PCCTS_NAMESPACE_STD
+
+#include "DLexerBase.h"
+
+class DllExportPCCTS BufFileInput : public DLGInputStream
+{
+public:
+ // constructor
+ // f - input stream
+ // buf_size - size of buffer (maximal length for string in is_in)
+
+ BufFileInput(FILE *f, int buf_size = 8 );
+
+ virtual ~BufFileInput();
+
+ // gets next char from stream
+
+ virtual int nextChar( void );
+
+ // looks in stream and compares next l characters with s
+ // returns the result of comparision
+
+ int lookahead( char* s );
+
+private:
+ FILE *input; // input stream;
+ int* buf; // buffer
+ int size; // size of buffer
+ int start; // position of the first symbol in buffer
+ int len; // count of characters in buffers
+};
+
+#endif
+// end of file BufFileInput.h
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLG_stream_input.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLG_stream_input.h
new file mode 100644
index 000000000..f3b4b79e8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLG_stream_input.h
@@ -0,0 +1,98 @@
+
+/************************************************************/
+/* */
+/* Predefined char stream: Input from (c++) stream. */
+/* */
+/* By Hubert Holin (Hubert.Holin@Bigfoot.com), 1998. */
+/* */
+/* This is completely free stuff, do whatever you want with */
+/* it (but then, I will take no responsibility for whatever */
+/* may happen if you do either... caveat emptor!). */
+/* */
+/************************************************************/
+
+#ifndef _DLG_STREAM_INPUT_H
+#define _DLG_STREAM_INPUT_H
+
+#include "pccts_istream.h"
+
+PCCTS_NAMESPACE_STD
+
+#ifndef DLGX_H
+#include "DLexerBase.h"
+#endif
+
+
+// NOTES: The semantics of the copy constructor
+// and the affectation operator may be unwarranted...
+// and the stream may not be reset.
+//
+// It would have been so much nicer for nextChar()
+// to throw (of for the DLGInputStream to change status)
+// upon hitting EOF than to return an "int"...
+
+template <
+ class E,
+ class T = ::std::char_traits<E>
+ >
+class DLG_stream_input : public DLGInputStream
+{
+public:
+
+ DLG_stream_input(::std::basic_istream<E,T> * p_input_stream)
+ : input(p_input_stream)
+ {
+ // nothing to do!
+ };
+
+ DLG_stream_input(const DLG_stream_input & a_recopier)
+ : input(a_recopier.input)
+ {
+ // nothing to do!
+ };
+
+ virtual ~DLG_stream_input()
+ {
+ this->purge(); // bloody templarized lookup...
+ };
+
+ DLG_stream_input operator = (const DLG_stream_input & a_affecter)
+ {
+ if (this != &a_affecter)
+ {
+ input = a_affecter.input;
+ }
+
+ return(*this);
+ };
+
+ virtual int nextChar()
+ {
+ E extracted_stuff;
+
+ input->get(extracted_stuff);
+
+ if (*input)
+ {
+ return(int(extracted_stuff));
+ }
+ else
+ {
+ return(EOF);
+ }
+ };
+
+protected:
+
+ ::std::basic_istream<E,T> * input;
+
+private:
+
+ void purge()
+ {
+ // nothing to do!
+ };
+};
+
+#endif /* _DLG_STREAM_INPUT_H */
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLexer.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLexer.h
new file mode 100644
index 000000000..f15bff118
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLexer.h
@@ -0,0 +1,194 @@
+/* DLexer.h (formerly DLexer.cpp)
+ *
+ * This was renamed because the use of the .cpp extension caused problems
+ * with IDEs.
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#include <assert.h>
+
+#define ZZINC {if ( track_columns ) (++_endcol);}
+
+#define ZZGETC {ch = input->nextChar(); cl = ZZSHIFT(ch);}
+
+#define ZZNEWSTATE (newstate = dfa[state][cl])
+
+#ifndef ZZCOPY
+#define ZZCOPY \
+ /* Truncate matching buffer to size (not an error) */ \
+ if (nextpos < lastpos){ \
+ *(nextpos++) = ch; \
+ }else{ \
+ bufovf = 1; \
+ }
+#endif
+
+void DLGLexer::
+mode( int m )
+{
+ /* points to base of dfa table */
+ if (m<MAX_MODE){
+ automaton = m;
+ /* have to redo class since using different compression */
+ cl = ZZSHIFT(ch);
+ }else{
+ sprintf((char *)ebuf,"Invalid automaton mode = %d ",m);
+ errstd(ebuf);
+ }
+}
+
+ANTLRTokenType DLGLexer::
+nextTokenType(void)
+{
+ register int state, newstate;
+ /* last space reserved for the null char */
+ register DLGChar *lastpos;
+ ANTLRTokenType tk;
+
+skip:
+ bufovf = 0;
+ lastpos = &_lextext[_bufsize-1];
+ nextpos = _lextext;
+ _begcol = _endcol+1;
+more:
+ _begexpr = nextpos;
+ if ( interactive ) {
+ /* interactive version of automaton */
+ /* if there is something in ch, process it */
+ state = newstate = dfa_base[automaton];
+ if (charfull){
+ ZZINC;
+ ZZCOPY;
+ ZZNEWSTATE;
+ }
+ while (alternatives[newstate]){
+ state = newstate;
+ ZZGETC;
+ ZZINC;
+ ZZCOPY;
+ ZZNEWSTATE;
+ }
+ /* figure out if last character really part of token */
+ if ((state != dfa_base[automaton]) && (newstate == DfaStates)){
+ charfull = 1;
+ --nextpos;
+ }else{
+ charfull = 0;
+ state = newstate;
+ }
+ *(nextpos) = '\0';
+ /* Able to transition out of start state to some non err state?*/
+ if ( state == dfa_base[automaton] ){
+ /* make sure doesn't get stuck */
+ advance();
+ }
+ }
+ else { /* non-interactive version of automaton */
+ if (!charfull)
+ advance();
+ else
+ ZZINC;
+ state = dfa_base[automaton];
+ while (ZZNEWSTATE != DfaStates) {
+ state = newstate;
+ assert(state <= sizeof(dfa)/sizeof(dfa[0]));
+ ZZCOPY;
+ ZZGETC;
+ ZZINC;
+ }
+ charfull = 1;
+ if ( state == dfa_base[automaton] ){
+ if (nextpos < lastpos){
+ *(nextpos++) = ch;
+ }else{
+ bufovf = 1;
+ }
+ *nextpos = '\0';
+ /* make sure doesn't get stuck */
+ advance();
+ }else{
+ *nextpos = '\0';
+ }
+ }
+ if ( track_columns ) _endcol -= charfull;
+ _endexpr = nextpos -1;
+ add_erase = 0;
+#ifdef OLD
+ tk = (ANTLRTokenType)
+ (*actions[accepts[state]])(this); // must pass this manually
+ // actions is not a [] of pointers
+ // to member functions.
+#endif
+ tk = (this->*actions[accepts[state]])();
+
+// MR1
+// MR1 11-Apr-97 Help for tracking DLG results
+// MR1
+
+#ifdef DEBUG_LEXER
+
+/* MR1 */ if (debugLexerFlag) {
+/* MR1 */ if (parser != NULL) {
+/* MR1 */ /* MR23 */ printMessage(stdout, "\ntoken name=%s",parser->parserTokenName(tk));
+/* MR1 */ } else {
+/* MR1 */ /* MR23 */ printMessage(stdout, "\ntoken nnumber=%d",tk);
+/* MR1 */ };
+/* MR1 */ /* MR23 */ printMessage(stdout, " lextext=(%s) mode=%d",
+/* MR1 */ (_lextext[0]=='\n' && _lextext[1]==0) ?
+/* MR1 */ "newline" : _lextext,
+/* MR1 */ automaton);
+/* MR1 */ if (interactive && !charfull) {
+/* MR1 */ /* MR23 */ printMessage(stdout, " char=empty");
+/* MR1 */ } else {
+/* MR1 */ if (ch=='\n') {
+/* MR1 */ /* MR23 */ printMessage(stdout, " char=newline");
+/* MR1 */ } else {
+/* MR1 */ /* MR23 */ printMessage(stdout, " char=(%c)",ch);
+/* MR1 */ };
+/* MR1 */ };
+/* MR1 */ /* MR23 */ printMessage(stdout, " %s\n",
+/* MR1 */ (add_erase==1 ? "skip()" :
+/* MR1 */ add_erase==2 ? "more()" :
+/* MR1 */ ""));
+/* MR1 */ };
+
+#endif
+
+ switch (add_erase) {
+ case 1: goto skip;
+ case 2: goto more;
+ }
+ return tk;
+}
+
+void DLGLexer::
+advance()
+{
+ if ( input==NULL ) err_in();
+ ZZGETC; charfull = 1; ZZINC;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLexerBase.cpp b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLexerBase.cpp
new file mode 100644
index 000000000..b218afc03
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLexerBase.cpp
@@ -0,0 +1,302 @@
+/* DLGLexerBase.c
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#include "pcctscfg.h"
+
+#include "pccts_stdio.h"
+#include "pccts_stdlib.h"
+
+PCCTS_NAMESPACE_STD
+
+/* I have to put this here due to C++ limitation
+ * that you can't have a 'forward' decl for enums.
+ * I hate C++!!!!!!!!!!!!!!!
+ */
+
+// MR1
+// MR1 10-Apr-97 133MR1 Prevent use of varying sizes for the
+// MR1 ANTLRTokenType enum
+// MR1
+
+enum ANTLRTokenType { TER_HATES_CPP=0, ITS_UTTER_GARBAGE, // MR1
+ WITH_SOME_GOOD_IDEAS=9999}; // MR1
+
+#define ANTLR_SUPPORT_CODE
+
+#include "pcctscfg.h"
+#include DLEXERBASE_H
+#include APARSER_H // MR23
+
+DLGLexerBase::
+DLGLexerBase(DLGInputStream *in,
+ unsigned bufsize,
+ int _interactive,
+ int _track_columns)
+{
+ this->_bufsize = bufsize;
+ this->_lextext = new DLGChar[_bufsize];
+ if ( this->_lextext==NULL ) {
+ panic("text buffer is NULL");
+ }
+ this->_begexpr = this->_endexpr = NULL;
+ this->ch = this->bufovf = 0;
+ this->nextpos = NULL;
+ this->cl = 0;
+ this->add_erase = 0;
+ this->input = in;
+ this->_begcol = 0;
+ this->_endcol = 0;
+ this->_line = 1;
+ this->charfull = 0;
+ this->automaton = 0;
+ this->token_to_fill = NULL;
+ this->interactive = _interactive;
+ this->track_columns = _track_columns;
+ this->debugLexerFlag = 0; // MR1
+ this->parser = NULL; // MR1
+ this->lexErrCount=0; // MR11
+}
+
+// MR19 THM
+
+void DLGLexerBase::reset()
+{
+ this->charfull = 0;
+ this->_begcol = 0;
+ this->_endcol = 0;
+ this->automaton = 0;
+ this->_line=1;
+ this->lexErrCount=0;
+}
+
+void DLGLexerBase::
+setInputStream( DLGInputStream *in )
+{
+ this->input = in;
+ _line = 1;
+ charfull = 0;
+}
+
+/* saves dlg state, but not what feeds dlg (such as file position) */
+void DLGLexerBase::
+saveState(DLGState *state)
+{
+ state->input = input;
+ state->interactive = interactive;
+ state->track_columns = track_columns;
+ state->auto_num = automaton;
+ state->add_erase = add_erase;
+ state->lookc = ch;
+ state->char_full = charfull;
+ state->begcol = _begcol;
+ state->endcol = _endcol;
+ state->line = _line;
+ state->lextext = _lextext;
+ state->begexpr = _begexpr;
+ state->endexpr = _endexpr;
+ state->bufsize = _bufsize;
+ state->bufovf = bufovf;
+ state->nextpos = nextpos;
+ state->class_num = cl;
+ state->debugLexerFlag = debugLexerFlag; // MR1
+ state->parser = parser; // MR1
+}
+
+void DLGLexerBase::
+restoreState(DLGState *state)
+{
+ input = state->input;
+ interactive = state->interactive;
+ track_columns = state->track_columns;
+ automaton = state->auto_num;
+ add_erase = state->add_erase;
+ ch = state->lookc;
+ charfull = state->char_full;
+ _begcol = state->begcol;
+ _endcol = state->endcol;
+ _line = state->line;
+ _lextext = state->lextext;
+ _begexpr = state->begexpr;
+ _endexpr = state->endexpr;
+ _bufsize = state->bufsize;
+ bufovf = state->bufovf;
+ nextpos = state->nextpos;
+ cl = state->class_num;
+ debugLexerFlag = state->debugLexerFlag; // MR1
+ parser = state->parser; // MR1
+}
+
+/* erase what is currently in the buffer, and get a new reg. expr */
+void DLGLexerBase::
+skip()
+{
+ add_erase = 1;
+}
+
+/* don't erase what is in the lextext buffer, add on to it */
+void DLGLexerBase::
+more()
+{
+ add_erase = 2;
+}
+
+/* substitute c for the reg. expr last matched and is in the buffer */
+void DLGLexerBase::
+replchar(DLGChar c)
+{
+ /* can't allow overwriting null at end of string */
+ if (_begexpr < &_lextext[_bufsize-1]){
+ *_begexpr = c;
+ *(_begexpr+1) = '\0';
+ }
+ _endexpr = _begexpr;
+ if (c != '\0') {
+ nextpos = _begexpr + 1;
+ }
+ else {
+ nextpos = _begexpr; /* MR30 Zero terminates string. */
+ }
+}
+
+/* replace the string s for the reg. expr last matched and in the buffer */
+
+#ifdef _MSC_VER // MR23
+//Turn off "assignment within conditional expression" warning
+#pragma warning(disable : 4706)
+#endif
+void DLGLexerBase::
+replstr(const DLGChar *s) /* MR20 const */
+{
+ register DLGChar *l= &_lextext[_bufsize -1];
+
+ nextpos = _begexpr;
+ if (s){
+ while ((nextpos <= l) && (*(nextpos++) = *(s++))){
+ /* empty */
+ }
+ /* correct for NULL at end of string */
+ nextpos--;
+ }
+ if ((nextpos <= l) && (*(--s) == 0)){
+ bufovf = 0;
+ }else{
+ bufovf = 1;
+ }
+ *(nextpos) = '\0';
+ _endexpr = nextpos - 1;
+}
+#ifdef _MSC_VER // MR23
+#pragma warning(default: 4706)
+#endif
+
+void DLGLexerBase::
+errstd(const char *s) /* MR20 const */
+{
+ lexErrCount++; /* MR11 */
+ /* MR23 */ printMessage(stderr,
+ "%s near line %d (text was '%s')\n",
+ ((s == NULL) ? "Lexical error" : s),
+ _line,_lextext);
+}
+
+int DLGLexerBase::
+err_in()
+{
+ /* MR23 */ printMessage(stderr,"No input stream, function, or string\n");
+ /* return eof to get out gracefully */
+ return EOF;
+}
+
+ANTLRTokenType DLGLexerBase::
+erraction()
+{
+ errstd("invalid token");
+ advance();
+ skip();
+ return (ANTLRTokenType) 0; // bogus, but satisfies compiler
+}
+
+_ANTLRTokenPtr DLGLexerBase::
+getToken()
+{
+ if ( token_to_fill==NULL ) panic("NULL token_to_fill");
+ ANTLRTokenType tt = nextTokenType();
+ _ANTLRTokenPtr tk = token_to_fill->makeToken(tt, _lextext,_line);
+ return tk;
+}
+
+void DLGLexerBase::
+panic(const char *msg) /* MR20 const */
+{
+ if (parser) //MR23
+ parser->panic(msg); //MR23
+ else //MR23
+ {
+ /* MR23 */ printMessage(stderr, "DLG panic: %s\n", msg);
+ //
+ // 7-Apr-97 133MR1
+ //
+ exit(PCCTS_EXIT_FAILURE); // MR1
+ }
+}
+
+ANTLRParser * DLGLexerBase:: // MR1
+setParser(ANTLRParser *p) { // MR1
+ ANTLRParser *oldValue=parser; // MR1
+ parser=p; // MR1
+ return oldValue; // MR1
+} // MR1
+ // MR1
+ANTLRParser * DLGLexerBase:: // MR1
+getParser() { // MR1
+ return parser; // MR1
+} // MR1
+ // MR1
+int DLGLexerBase:: // MR1
+debugLexer(int newValue) { // MR1
+ int oldValue=debugLexerFlag; // MR1
+ debugLexerFlag=newValue; // MR1
+ return oldValue; // MR1
+} // MR1
+
+//MR23
+int DLGLexerBase::printMessage(FILE* pFile, const char* pFormat, ...)
+{
+ va_list marker;
+ va_start( marker, pFormat );
+
+ int iRet = 0;
+ if (parser)
+ parser->printMessageV(pFile, pFormat, marker);
+ else
+ iRet = vfprintf(pFile, pFormat, marker);
+
+ va_end( marker );
+ return iRet;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLexerBase.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLexerBase.h
new file mode 100644
index 000000000..b9ca311ba
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/DLexerBase.h
@@ -0,0 +1,202 @@
+/* DLGLexerBase.h
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef DLGX_H
+#define DLGX_H
+
+#include "pcctscfg.h"
+#include "pccts_stdio.h"
+
+PCCTS_NAMESPACE_STD
+
+#include ATOKEN_H
+#include ATOKENSTREAM_H
+
+class ANTLRParser; // MR1
+
+/* must define what a char looks like; can make this a class too */
+typedef char DLGChar;
+
+/* Can have it as a class too: (ack this looks weird; is it right?)
+class DllExportPCCTS DLGChar {
+private:
+ int c;
+public:
+ DLGChar(int ch) { c = ch; }
+ int atom() { return c; }
+};
+*/
+
+/* user must subclass this */
+class DllExportPCCTS DLGInputStream {
+public:
+ virtual int nextChar() = 0;
+ virtual ~DLGInputStream() {};
+};
+
+/* Predefined char stream: Input from FILE */
+class DllExportPCCTS DLGFileInput : public DLGInputStream {
+private:
+ int found_eof;
+ FILE *input;
+public:
+ DLGFileInput(FILE *f) { input = f; found_eof = 0; }
+ int nextChar() {
+ int c;
+ if ( found_eof ) return EOF;
+ else {
+ c=getc(input);
+ if ( c==EOF ) found_eof = 1;
+ return c;
+ }
+ }
+ void DLGFileReset(FILE *f) {input=f; found_eof = 0; }; // MR11
+};
+
+// MR9 Suggested by Bruce Guenter (bruceg@qcc.sk.ca)
+// MR9 Make DLGStringInput const correct
+
+/* Predefined char stream: Input from string */
+class DllExportPCCTS DLGStringInput : public DLGInputStream {
+private:
+ const DLGChar *input; // MR9
+ const DLGChar *p; // MR9
+public:
+ DLGStringInput(const DLGChar *s) { input = s; p = &input[0];} // MR9
+ int nextChar()
+ {
+ if (*p) return (int) (unsigned char) *p++; // MR14
+ else return EOF;
+ }
+
+ void DLGStringReset(const DLGChar *s) {input=s; p= &input[0]; }; // MR11 // MR16
+};
+
+class DllExportPCCTS DLGState {
+public:
+ DLGInputStream *input;
+ int interactive;
+ int track_columns;
+ int auto_num;
+ int add_erase;
+ int lookc;
+ int char_full;
+ int begcol, endcol;
+ int line;
+ DLGChar *lextext, *begexpr, *endexpr;
+ int bufsize;
+ int bufovf;
+ DLGChar *nextpos;
+ int class_num;
+ int debugLexerFlag; // MR1
+ ANTLRParser *parser; // MR1
+};
+
+/* user must subclass this */
+class DllExportPCCTS DLGLexerBase : public ANTLRTokenStream {
+private:
+ DLGLexerBase(const DLGLexerBase&); // Prevent copy-construction
+ DLGLexerBase& operator=(const DLGLexerBase&); // Prevent assignment
+public:
+ virtual ANTLRTokenType erraction();
+
+protected:
+ DLGInputStream *input;
+ int interactive;
+ int track_columns;
+ DLGChar *_lextext; /* text of most recently matched token */
+ DLGChar *_begexpr; /* beginning of last reg expr recogn. */
+ DLGChar *_endexpr; /* beginning of last reg expr recogn. */
+ int _bufsize; /* number of characters in lextext */
+ int _begcol; /* column that first character of token is in*/
+ int _endcol; /* column that last character of token is in */
+ int _line; /* line current token is on */
+ int ch; /* character to determine next state */
+ int bufovf; /* indicates that buffer too small for text */
+ int charfull;
+ DLGChar *nextpos; /* points to next available position in lextext*/
+ int cl;
+ int automaton;
+ int add_erase;
+ DLGChar ebuf[70];
+ _ANTLRTokenPtr token_to_fill;
+
+ int debugLexerFlag; // MR1
+ ANTLRParser *parser; // MR1
+public:
+ virtual _ANTLRTokenPtr getToken(); // MR12 public
+ virtual void advance(void) = 0;
+ void skip(void); /* erase lextext, look for antoher token */
+ void more(void); /* keep lextext, look for another token */
+ void mode(int k); /* switch to automaton 'k' */
+ void saveState(DLGState *);
+ void restoreState(DLGState *);
+ virtual ANTLRTokenType nextTokenType(void)=0;/* get next token */
+ void replchar(DLGChar c); /* replace last recognized reg. expr. with
+ a character */
+ void replstr(const DLGChar *s); /* replace last recognized reg. expr. with
+ a string */ /* MR20 const */
+ virtual int err_in(); // MR1
+ virtual void errstd(const char *); // MR1 MR20 const
+ int line() { return _line; }
+ void set_line(int newValue) { _line=newValue; }; // MR1
+ virtual void newline() { _line++; }
+ DLGChar *lextext() { return _lextext; }
+
+ int begcol() { return _begcol; }
+ int endcol() { return _endcol; }
+ void set_begcol(int a) { _begcol=a; }
+ void set_endcol(int a) { _endcol=a; }
+ DLGChar *begexpr() { return _begexpr; }
+ DLGChar *endexpr() { return _endexpr; }
+ int bufsize() { return _bufsize; }
+
+ void setToken(ANTLRAbstractToken *t) { token_to_fill = t; }
+
+ void setInputStream(DLGInputStream *);
+ DLGLexerBase(DLGInputStream *in,
+ unsigned bufsize=2000,
+ int interactive=0,
+ int track_columns=0);
+ void reset(); // MR19
+ virtual ~DLGLexerBase() { delete [] _lextext; }
+ virtual void panic(const char *msg); // MR1 MR20 const
+ void trackColumns() {
+ track_columns = 1;
+ this->_begcol = 0;
+ this->_endcol = 0;
+ };
+ virtual ANTLRParser *setParser(ANTLRParser *p); // MR1
+ virtual ANTLRParser *getParser(); // MR1
+ virtual int debugLexer(int value); // MR1
+ int lexErrCount; // MR12
+ virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23
+};
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h
new file mode 100644
index 000000000..d25b8d693
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h
@@ -0,0 +1,134 @@
+#ifndef PBLACKBOX_H
+#define PBLACKBOX_H
+
+/*
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+/* Completely rewritten by Chris Uzdavinis (chris@atdesk.com) for MR23 */
+
+#include "pcctscfg.h"
+
+#include "pccts_iostream.h"
+
+PCCTS_NAMESPACE_STD
+
+// MR20 Added #include for "DLexerBase.h"
+
+#include "DLexerBase.h"
+
+//
+// The default buffer size of the lexer is given by the
+// second argument of the lexer's ctor. It is optional
+// and defaults to 2000
+//
+
+template<class Lexer, class Parser, class Token>
+class DllExportPCCTS ParserBlackBox {
+private:
+ // no copy construction allowed
+ ParserBlackBox(ParserBlackBox const &);
+
+ // no copy assignment allowed
+ ParserBlackBox & operator=(ParserBlackBox const &);
+
+protected:
+ DLGFileInput *in;
+ Lexer *scan;
+ _ANTLRTokenPtr tok;
+ ANTLRTokenBuffer *pipe;
+ Parser *_parser;
+ FILE *file;
+ int openByBlackBox; /* MR21 Don't close what we haven't opened */
+public:
+
+ ParserBlackBox(FILE *f)
+ : in(0)
+ , scan(0)
+ , tok(0)
+ , pipe(0)
+ , _parser(0)
+ , file(0)
+ , openByBlackBox(0)
+ {
+ if (f == NULL)
+ {
+ cerr << "invalid file pointer\n";
+ }
+ else
+ {
+ openByBlackBox = 0; /* MR21a */
+ file = f;
+ in = new DLGFileInput(f);
+ scan = new Lexer(in);
+ pipe = new ANTLRTokenBuffer(scan);
+ tok = new Token;
+ scan->setToken(tok);
+ _parser = new Parser(pipe);
+ _parser->init();
+ }
+ }
+ ParserBlackBox(char *fname)
+ : in(0)
+ , scan(0)
+ , tok(0)
+ , pipe(0)
+ , _parser(0)
+ , file(0)
+ , openByBlackBox(0)
+ {
+ FILE *f = fopen(fname, "r");
+ if ( f==NULL ) {
+ openByBlackBox = 0;
+ cerr << "cannot open " << fname << "\n"; return;
+ }
+ else {
+ openByBlackBox = 1;
+ file = f;
+ in = new DLGFileInput(f);
+ scan = new Lexer(in);
+ pipe = new ANTLRTokenBuffer(scan);
+ tok = new Token;
+ scan->setToken(tok);
+ _parser = new Parser(pipe);
+ _parser->init();
+ }
+ }
+
+ ~ParserBlackBox()
+ {
+ delete in; delete scan; delete pipe; delete _parser; delete tok;
+ if (1 == openByBlackBox) {
+ fclose(file);
+ }
+ }
+
+ Parser *parser() { return _parser; }
+ Lexer *getLexer() { return scan; }
+};
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/PCCTSAST.cpp b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/PCCTSAST.cpp
new file mode 100644
index 000000000..a8249cdac
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/PCCTSAST.cpp
@@ -0,0 +1,684 @@
+/*
+ * PCCTSAST.C
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to SORCERER -- SORCERER is in the public
+ * domain. An individual or company may do whatever they wish with
+ * source code distributed with SORCERER or the code generated by
+ * SORCERER, including the incorporation of SORCERER, or its output, into
+ * commerical software.
+ *
+ * We encourage users to develop software with SORCERER. However, we do
+ * ask that credit is given to us for developing SORCERER. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like SORCERER and have developed a nice tool with the
+ * output, please mention that you developed it using SORCERER. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * SORCERER 1.00B14 and ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * AHPCRC, University of Minnesota
+ * 1992-2000
+ */
+
+#define ANTLR_SUPPORT_CODE
+
+#include "pcctscfg.h"
+
+#include "PCCTSAST.h"
+#include "pccts_stdarg.h"
+
+PCCTS_NAMESPACE_STD
+
+#include <ctype.h>
+
+//#include "SList.h"
+
+ /* String Scanning/Parsing Stuff */
+
+const char *PCCTS_AST::scan_token_tbl[] = { /* MR20 const */
+ "invalid", /* 0 */
+ "LPAREN", /* 1 */
+ "RPAREN", /* 2 */
+ "PERCENT", /* 3 */
+ "INT", /* 4 */
+ "COLON", /* 5 */
+ "POUND", /* 6 */
+ "PERIOD", /* 7 */
+};
+
+void PCCTS_AST::
+addChild(PCCTS_AST *t)
+{
+ if ( t==NULL ) return;
+ PCCTS_AST *s = down();
+ if ( s!=NULL )
+ {
+ while ( s->right()!=NULL ) s = s->right();
+ s->setRight(t);
+ }
+ else
+ this->setDown(t);
+}
+
+void PCCTS_AST::
+lisp(FILE *f)
+{
+ if ( down() != NULL ) /* MR23 */ printMessage(f," (");
+ lisp_action(f);
+ if ( down()!=NULL ) down()->lisp(f);
+ if ( down() != NULL ) /* MR23 */ printMessage(f," )");
+ if ( right()!=NULL ) right()->lisp(f);
+}
+
+/* build a tree (root child1 child2 ... NULL)
+ * If root is NULL, simply make the children siblings and return ptr
+ * to 1st sibling (child1). If root is not single node, return NULL.
+ *
+ * Siblings that are actually sibling lists themselves are handled
+ * correctly. For example #( NULL, #( NULL, A, B, C), D) results
+ * in the tree ( NULL A B C D ).
+ *
+ * Requires at least two parameters with the last one being NULL. If
+ * both are NULL, return NULL.
+ *
+ * The down() and right() down/right pointers are used to make the tree.
+ */
+PCCTS_AST *PCCTS_AST::
+make(PCCTS_AST *rt, ...)
+{
+ va_list ap;
+ register PCCTS_AST *child, *sibling=NULL, *tail=NULL /*MR23*/, *w;
+ PCCTS_AST *root;
+
+ va_start(ap, rt);
+ root = rt;
+
+ if ( root != NULL )
+ if ( root->down() != NULL ) return NULL;
+ child = va_arg(ap, PCCTS_AST *);
+ while ( child != NULL )
+ {
+ /* find end of child */
+ for (w=child; w->right()!=NULL; w=w->right()) {;}
+ if ( sibling == NULL ) {sibling = child; tail = w;}
+ else {tail->setRight(child); tail = w;}
+ child = va_arg(ap, PCCTS_AST *);
+ }
+ if ( root==NULL ) root = sibling;
+ else root->setDown(sibling);
+ va_end(ap);
+ return root;
+}
+
+/* The following push and pop routines are only used by ast_find_all() */
+
+void PCCTS_AST::
+_push(PCCTS_AST **st, int *sp, PCCTS_AST *e)
+{
+ (*sp)--;
+ require((*sp)>=0, "stack overflow");
+ st[(*sp)] = e;
+}
+
+PCCTS_AST *PCCTS_AST::
+_pop(PCCTS_AST **st, int *sp)
+{
+ PCCTS_AST *e = st[*sp];
+ (*sp)++;
+ require((*sp)<=MaxTreeStackDepth, "stack underflow");
+ return e;
+}
+
+/* Find all occurrences of u in t.
+ * 'cursor' must be initialized to 't'. It eventually
+ * returns NULL when no more occurrences of 'u' are found.
+ */
+PCCTS_AST *PCCTS_AST::
+ast_find_all(PCCTS_AST *u, PCCTS_AST **cursor)
+{
+ PCCTS_AST *sib;
+ /*** static ***/ PCCTS_AST *template_stack[MaxTreeStackDepth]; /* MR23 Remove "static" */
+ /*** static ***/ int tsp = MaxTreeStackDepth; /* MR23 Remove "static" */
+
+////static int nesting = 0; /* MR23 Not referenced */
+
+ if ( *cursor == NULL ) return NULL;
+ if ( *cursor!=this ) sib = *cursor;
+ else {
+ /* else, first time--start at top of template 't' */
+ tsp = MaxTreeStackDepth;
+ sib = this;
+ /* bottom of stack is always a NULL--"cookie" indicates "done" */
+ _push(template_stack, &tsp, NULL);
+ }
+
+keep_looking:
+ if ( sib==NULL ) /* hit end of sibling list */
+ {
+ sib = _pop(template_stack, &tsp);
+ if ( sib == NULL ) { *cursor = NULL; return NULL; }
+ }
+
+ if ( sib->type() != u->type() )
+ {
+ /* look for another match */
+ if ( sib->down()!=NULL )
+ {
+ if ( sib->right()!=NULL ) _push(template_stack, &tsp, sib->right());
+ sib=sib->down();
+ goto keep_looking;
+ }
+ /* nothing below to try, try next sibling */
+ sib=sib->right();
+ goto keep_looking;
+ }
+
+ /* found a matching root node, try to match what's below */
+ if ( match_partial(sib, u) )
+ {
+ /* record sibling cursor so we can pick up next from there */
+ if ( sib->down()!=NULL )
+ {
+ if ( sib->right()!=NULL ) _push(template_stack, &tsp, sib->right());
+ *cursor = sib->down();
+ }
+ else if ( sib->right()!=NULL ) *cursor = sib->right();
+ else *cursor = _pop(template_stack, &tsp);
+ return sib;
+ }
+
+ /* no match, keep searching */
+ if ( sib->down()!=NULL )
+ {
+ if ( sib->right()!=NULL ) _push(template_stack, &tsp, sib->right());
+ sib=sib->down();
+ }
+ else sib = sib->right(); /* else, try to right if zip below */
+ goto keep_looking;
+}
+
+/* are two trees exactly alike? */
+int PCCTS_AST::
+match(PCCTS_AST *u)
+{
+ PCCTS_AST *t = this;
+ PCCTS_AST *sib;
+
+ if ( u==NULL ) return 0;
+
+ for (sib=t; sib!=NULL&&u!=NULL; sib=sib->right(), u=u->right())
+ {
+ if ( sib->type() != u->type() ) return 0;
+ if ( sib->down()!=NULL )
+ if ( !sib->down()->match(u->down()) ) return 0;
+ }
+ return 1;
+}
+
+/* Is 'u' a subtree of 't' beginning at the root? */
+int PCCTS_AST::
+match_partial(PCCTS_AST *t, PCCTS_AST *u)
+{
+ PCCTS_AST *sib;
+
+ if ( u==NULL ) return 1;
+ if ( t==NULL ) return 0; /* MR23 removed unreachable code */
+
+ for (sib=t; sib!=NULL&&u!=NULL; sib=sib->right(), u=u->right())
+ {
+ if ( sib->type() != u->type() ) return 0;
+ if ( sib->down()!=NULL )
+ if ( !match_partial(sib->down(), u->down()) ) return 0;
+ }
+ return 1;
+}
+
+#ifdef _MSC_VER // MR23
+//Turn off "unreachable code" warning
+#pragma warning(disable : 4702)
+#endif
+/* Walk the template tree 't' (matching against 'this'), filling in the
+ * 'labels' array, and setting 'n' according to how many labels were matched.
+ */
+int PCCTS_AST::
+scanmatch(ScanAST *t, PCCTS_AST **labels[], int *n)
+{
+ ScanAST *sib;
+ PCCTS_AST *u = this;
+
+ if ( u==NULL ) return 0;
+
+ for (sib=t; sib!=NULL&&u!=NULL; sib=sib->right(), u=u->right())
+ {
+ /* make sure tokens match; token of '0' means wildcard match */
+ if ( sib->type() != u->type() && sib->type()!=0 ) return 0;
+ /* we have a matched token here; set label pointers if exists */
+ if ( sib->label_num>0 )
+ {
+ require(labels!=NULL, "label found in template, but no array of labels");
+ (*n)++;
+ *(labels[sib->label_num-1]) = u;
+ }
+ /* match what's below if something there and current node is not wildcard */
+ if ( sib->down()!=NULL && sib->type()!=0 )
+ {
+ if ( sib->down()==NULL )
+ {
+ if ( u->down()!=NULL )
+ return 0;
+ else
+ return 1;
+ }
+ if ( !u->down()->scanmatch(sib->down(), labels, n) ) return 0;
+ }
+ }
+ return 1;
+}
+#ifdef _MSC_VER // MR23
+#pragma warning(default : 4702)
+#endif
+
+void PCCTS_AST::
+insert_after(PCCTS_AST *b)
+{
+ PCCTS_AST *end;
+ if ( b==NULL ) return;
+ /* find end of b's child list */
+ for (end=b; end->right()!=NULL; end=end->right()) {;}
+ end->setRight(this->right());
+ this->setRight(b);
+}
+
+void PCCTS_AST::
+append(PCCTS_AST *b)
+{
+ PCCTS_AST *end;
+ require(b!=NULL, "append: NULL input tree");
+ /* find end of child list */
+ for (end=this; end->right()!=NULL; end=end->right()) {;}
+ end->setRight(b);
+}
+
+PCCTS_AST *PCCTS_AST::
+tail()
+{
+ PCCTS_AST *end;
+ /* find end of child list */
+ for (end=this; end->right()!=NULL; end=end->right()) {;}
+ return end;
+}
+
+PCCTS_AST *PCCTS_AST::
+bottom()
+{
+ PCCTS_AST *end;
+ /* find end of child list */
+ for (end=this; end->down()!=NULL; end=end->down()) {;}
+ return end;
+}
+
+PCCTS_AST *PCCTS_AST::
+cut_between(PCCTS_AST *a, PCCTS_AST *b)
+{
+ PCCTS_AST *end, *ret;
+ if (a==NULL||b==NULL) return NULL;
+ /* find node pointing to b */
+ for (end=a; end->right()!=NULL&&end->right()!=b; end=end->right())
+ {;}
+ if (end->right()==NULL) return NULL; //ast_cut_between: a,b not connected
+ end->setRight(NULL); /* don't want it point to 'b' anymore */
+ ret = a->right();
+ a->setRight(b);
+ return ret;
+}
+
+#ifdef NOT_YET
+SList *PCCTS_AST::
+to_slist()
+{
+ SList *list = new SList;
+ PCCTS_AST *p;
+
+ for (p=this; p!=NULL; p=p->right())
+ {
+ list->add(p);
+ }
+ return list;
+}
+#endif
+
+void PCCTS_AST::
+tfree()
+{
+ PCCTS_AST *t = this;
+ if ( t->down()!=NULL ) t->down()->tfree();
+ if ( t->right()!=NULL ) t->right()->tfree();
+ delete t;
+}
+
+int PCCTS_AST::
+nsiblings()
+{
+ PCCTS_AST *t = this;
+ int n=0;
+
+ while ( t!=NULL )
+ {
+ n++;
+ t = t->right();
+ }
+ return n;
+}
+
+PCCTS_AST *PCCTS_AST::
+sibling_index(int i)
+{
+ PCCTS_AST *t = this;
+ int j=1;
+ require(i>0, "sibling_index: i<=0");
+
+ while ( t!=NULL )
+ {
+ if ( j==i ) return t;
+ j++;
+ t = t->right();
+ }
+ return NULL;
+}
+
+/* Assume this is a root node of a tree--
+ * duplicate that node and what's below; ignore siblings of root node.
+ */
+
+// MR9 23-Sep-97 RJV
+// MR9
+// MR9 RJV: Original version only duplicated the node and down elements.
+// MR9 Made copies of the pointers to sibling.
+// MR9 Changed call "down()->deepCopy()" to "down()->deepCopyBushy()"
+// MR9
+
+PCCTS_AST *PCCTS_AST::
+deepCopy()
+{
+ PCCTS_AST *u = this->shallowCopy();
+ if ( down()!=NULL ) u->setDown(down()->deepCopyBushy());
+ u->setRight(NULL);
+ return u;
+}
+
+/* Copy all nodes including siblings of root. */
+PCCTS_AST *PCCTS_AST::
+deepCopyBushy()
+{
+ PCCTS_AST *u = this->shallowCopy();
+ /* copy the rest of the tree */
+ if ( down()!=NULL ) u->setDown(down()->deepCopyBushy());
+ if ( right()!=NULL ) u->setRight(right()->deepCopyBushy());
+ return u;
+}
+
+void PCCTS_AST::
+scanast_free(ScanAST *t)
+{
+ if ( t == NULL ) return;
+ scanast_free( t->down() );
+ scanast_free( t->right() );
+ free( (char *) t ); // MR1
+}
+
+/*
+ * scan
+ *
+ * This function is like scanf(): it attempts to match a template
+ * against an input tree. A variable number of tree pointers
+ * may be set according to the '%i' labels in the template string.
+ * For example:
+ *
+ * t->ast_scan("#( 6 #(5 %1:4 %2:3) #(1 %3:3 %4:3) )",
+ * &w, &x, &y, &z);
+ *
+ * Naturally, you'd want this converted from
+ *
+ * t->ast_scan("#( RangeOp #(Minus %1:IConst %2:Var) #(Plus %3:Var %4Var) )",
+ * &w, &x, &y, &z);
+ *
+ * by SORCERER.
+ *
+ * This function call must be done withing a SORCERER file because SORCERER
+ * must convert the token references to the associated token number.
+ *
+ * This functions parses the template and creates trees which are then
+ * matched against the input tree. The labels are set as they are
+ * encountered; hence, partial matches may leave some pointers set
+ * and some NULL. This routines initializes all argument pointers to NULL
+ * at the beginning.
+ *
+ * This function returns the number of labels matched.
+ */
+int PCCTS_AST::
+ast_scan(char *templ, ...)
+{
+ va_list ap;
+ ScanAST *tmpl;
+ int n, i, found=0;
+ PCCTS_AST ***label_ptrs=NULL;
+
+ va_start(ap, templ);
+
+ /* make a ScanAST tree out of the template */
+ tmpl = stringparser_parse_scanast(templ, &n);
+
+ /* make an array out of the labels */
+ if ( n>0 )
+ {
+ label_ptrs = (PCCTS_AST ***) calloc(n, sizeof(PCCTS_AST **));
+ require(label_ptrs!=NULL, "scan: out of memory");
+ for (i=1; i<=n; i++)
+ {
+ label_ptrs[i-1] = va_arg(ap, PCCTS_AST **);
+ *(label_ptrs[i-1]) = NULL;
+ }
+ }
+
+ /* match the input tree against the template */
+ scanmatch(tmpl, label_ptrs, &found);
+
+ scanast_free(tmpl);
+ free( (char *) label_ptrs); // MR1
+
+ return found;
+}
+
+ScanAST *PCCTS_AST::
+new_scanast(int tok)
+{
+ ScanAST *p = (ScanAST *) calloc(1, sizeof(ScanAST));
+//
+// 7-Apr-97 133MR1
+//
+ if ( p == NULL )
+ panic("out of memory\n"); // MR23
+ p->_token = tok;
+ return p;
+}
+
+ScanAST *PCCTS_AST::
+stringparser_parse_scanast(char *templ, int *num_labels)
+{
+ StringLexer lex;
+ StringParser parser;
+ ScanAST *t;
+
+ stringlexer_init(&lex, templ);
+ stringparser_init(&parser, &lex);
+ t = stringparser_parse_tree(&parser);
+ *num_labels = parser.num_labels;
+ return t;
+}
+
+void PCCTS_AST::
+stringparser_match(StringParser *parser, int token)
+{
+ if ( parser->token != token ) panic("bad tree in scan()");
+}
+
+/*
+ * Match a tree of the form:
+ * (root child1 child2 ... childn)
+ * or,
+ * node
+ *
+ * where the elements are integers or labeled integers.
+ */
+ScanAST *PCCTS_AST::
+stringparser_parse_tree(StringParser *parser)
+{
+ ScanAST *t=NULL, *root, *child, *last=NULL /*MR23*/;
+
+ if ( parser->token != __POUND )
+ {
+ return stringparser_parse_element(parser);
+ }
+ stringparser_match(parser,__POUND);
+ parser->token = stringscan_gettok(parser->lexer);
+ stringparser_match(parser,__LPAREN);
+ parser->token = stringscan_gettok(parser->lexer);
+ root = stringparser_parse_element(parser);
+ while ( parser->token != __RPAREN )
+ {
+ child = stringparser_parse_element(parser);
+ if ( t==NULL ) { t = child; last = t; }
+ else { last->_right = child; last = child; }
+ }
+ stringparser_match(parser,__RPAREN);
+ parser->token = stringscan_gettok(parser->lexer);
+ root->_down = t;
+ return root;
+}
+
+ScanAST *PCCTS_AST::
+stringparser_parse_element(StringParser *parser)
+{
+ char ebuf[100];
+ int label = 0;
+
+ if ( parser->token == __POUND )
+ {
+ return stringparser_parse_tree(parser);
+ }
+ if ( parser->token == __PERCENT )
+ {
+ parser->token = stringscan_gettok(parser->lexer);
+ stringparser_match(parser,__INT);
+ label = atoi(parser->lexer->text);
+ parser->num_labels++;
+ if ( label==0 ) panic("%%0 is an invalid label");
+ parser->token = stringscan_gettok(parser->lexer);
+ stringparser_match(parser,__COLON);
+ parser->token = stringscan_gettok(parser->lexer);
+ /* can label tokens and wildcards */
+ if ( parser->token != __INT && parser->token != __PERIOD )
+ panic("can only label tokens");
+ }
+ if ( parser->token == __INT )
+ {
+ ScanAST *p = new_scanast(atoi(parser->lexer->text));
+ parser->token = stringscan_gettok(parser->lexer);
+ p->label_num = label;
+ return p;
+ }
+ if ( parser->token == __PERIOD )
+ {
+ ScanAST *p = new_scanast(0); /* token of 0 is wildcard */
+ parser->token = stringscan_gettok(parser->lexer);
+ p->label_num = label;
+ return p;
+ }
+ sprintf(ebuf, "mismatch token in scan(): %s", scan_token_str(parser->token));
+ panic(ebuf);
+ return NULL;
+}
+
+void PCCTS_AST::
+stringparser_init(StringParser *parser, StringLexer *input)
+{
+ parser->lexer = input;
+ parser->token = stringscan_gettok(parser->lexer);
+ parser->num_labels = 0;
+}
+
+void PCCTS_AST::
+stringlexer_init(StringLexer *scanner, char *input)
+{
+ scanner->text[0]='\0';
+ scanner->input = input;
+ scanner->p = input;
+ stringscan_advance(scanner);
+}
+
+void PCCTS_AST::
+stringscan_advance(StringLexer *scanner)
+{
+ if ( *(scanner->p) == '\0' ) scanner->c = __StringScanEOF;
+ scanner->c = *(scanner->p)++;
+}
+
+int PCCTS_AST::
+stringscan_gettok(StringLexer *scanner)
+{
+ char *index = &scanner->text[0];
+ char ebuf[100]; /* MR23 Remove static */
+
+ while ( isspace(scanner->c) ) { stringscan_advance(scanner); }
+ if ( isdigit(scanner->c) )
+ {
+ int tok = __INT;
+ while ( isdigit(scanner->c) ) {
+ *index++ = (char) /* static_cast<char> */ (scanner->c); // MR23
+ stringscan_advance(scanner);
+ }
+ *index = '\0';
+ return tok;
+ }
+ switch ( scanner->c )
+ {
+ case '#' : stringscan_advance(scanner); return __POUND;
+ case '(' : stringscan_advance(scanner); return __LPAREN;
+ case ')' : stringscan_advance(scanner); return __RPAREN;
+ case '%' : stringscan_advance(scanner); return __PERCENT;
+ case ':' : stringscan_advance(scanner); return __COLON;
+ case '.' : stringscan_advance(scanner); return __PERIOD;
+ case '\0' : return __StringScanEOF;
+ case __StringScanEOF : return __StringScanEOF;
+ default :
+ sprintf(ebuf, "invalid char in scan: '%c'", scanner->c);
+ panic(ebuf);
+ }
+ return __StringScanEOF; // never reached
+}
+
+const char *PCCTS_AST:: /* MR20 const */
+scan_token_str(int t)
+{
+ if ( VALID_SCAN_TOKEN(t) ) return scan_token_tbl[t];
+ else if ( t==__StringScanEOF ) return "<end-of-string>";
+ else return "<invalid-token>";
+}
+
+//MR23
+int PCCTS_AST::printMessage(FILE* pFile, const char* pFormat, ...)
+{
+ va_list marker;
+ va_start( marker, pFormat );
+ int iRet = vfprintf(pFile, pFormat, marker);
+ va_end( marker );
+ return iRet;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/PCCTSAST.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/PCCTSAST.h
new file mode 100644
index 000000000..3485da7d1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/PCCTSAST.h
@@ -0,0 +1,143 @@
+/* Abstract syntax tree
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef PCCTSAST_H
+#define PCCTSAST_H
+
+#include "pcctscfg.h"
+
+#include "pccts_stdio.h"
+#include "pccts_stdlib.h"
+
+PCCTS_NAMESPACE_STD
+
+//class SList;
+
+#define StringScanMaxText 50
+#define MaxTreeStackDepth 400
+
+//
+// 7-Apr-97 133MR1 signed int not accepted by AT&T cfront
+//
+typedef struct stringlexer {
+ int c; // MR1
+ char *input;
+ char *p;
+ char text[StringScanMaxText];
+ } StringLexer;
+
+/* Define the structures needed for ast_scan() */
+typedef struct stringparser {
+ int token;
+ StringLexer *lexer;
+ int num_labels;
+ } StringParser;
+
+typedef struct _scanast {
+ struct _scanast *_right, *_down;
+ int _token;
+ int label_num;
+ int type() { return _token; }
+ struct _scanast *right() { return _right; }
+ struct _scanast *down() { return _down; }
+ } ScanAST;
+
+#define VALID_SCAN_TOKEN(t) (t>=__LPAREN && t<=__PERIOD)
+
+class DllExportPCCTS PCCTS_AST {
+protected:
+ static const char *scan_token_tbl[]; /* MR20 const */
+ enum {
+ __LPAREN=1,
+ __RPAREN=2,
+ __PERCENT=3,
+ __INT=4,
+ __COLON=5,
+ __POUND=6,
+ __PERIOD=7,
+ __StringScanEOF=-1};
+
+protected:
+ const char *scan_token_str(int t); /* MR20 const */
+ void stringlexer_init(StringLexer *scanner, char *input);
+ void stringparser_init(StringParser *, StringLexer *);
+ ScanAST *stringparser_parse_scanast(char *templ, int *n);
+ ScanAST *stringparser_parse_tree(StringParser *parser);
+ ScanAST *stringparser_parse_element(StringParser *parser);
+ void stringscan_advance(StringLexer *scanner);
+ int stringscan_gettok(StringLexer *scanner);
+ void _push(PCCTS_AST **st, int *sp, PCCTS_AST *e);
+ PCCTS_AST *_pop(PCCTS_AST **st, int *sp);
+ int match_partial(PCCTS_AST *t, PCCTS_AST *u);
+ int scanmatch(ScanAST *t, PCCTS_AST **labels[], int *n);
+ void scanast_free(ScanAST *t);
+ ScanAST *new_scanast(int tok);
+ void stringparser_match(StringParser *parser, int type);
+ virtual PCCTS_AST *deepCopyBushy();
+
+public:
+ PCCTS_AST() {;}
+ virtual ~PCCTS_AST() {;}
+
+ /* This group must be defined for SORCERER to work correctly */
+ virtual PCCTS_AST *right() = 0;
+ virtual PCCTS_AST *down() = 0;
+ virtual void setRight(PCCTS_AST *t) = 0;
+ virtual void setDown(PCCTS_AST *t) = 0;
+// we define these so ANTLR doesn't have to
+ virtual int type() { return 0; }
+ virtual void setType(int /*t MR23 */) {;}
+ virtual PCCTS_AST *shallowCopy() {panic("no shallowCopy() defined"); return NULL;}
+
+ /* These are not needed by ANTLR, but are support functions */
+ virtual PCCTS_AST *deepCopy(); // used by SORCERER in transform mode
+ virtual void addChild(PCCTS_AST *t);
+ virtual void lisp_action(FILE * /*f MR23 */) {;}
+ virtual void lisp(FILE *f);
+ static PCCTS_AST *make(PCCTS_AST *rt, ...);
+ virtual PCCTS_AST *ast_find_all(PCCTS_AST *u, PCCTS_AST **cursor);
+ virtual int match(PCCTS_AST *u);
+ virtual void insert_after(PCCTS_AST *b);
+ virtual void append(PCCTS_AST *b);
+ virtual PCCTS_AST *tail();
+ virtual PCCTS_AST *bottom();
+ static PCCTS_AST *cut_between(PCCTS_AST *a, PCCTS_AST *b);
+// virtual SList *to_slist();
+ virtual void tfree();
+ int ast_scan(char *templ, ...);
+ virtual int nsiblings();
+ virtual PCCTS_AST *sibling_index(int i);
+
+ void require(int e,const char *err){ if ( !e ) panic(err); } /* MR20 const */
+ virtual void panic(const char *err) // MR20 const
+ { /* MR23 */ printMessage(stderr, "PCCTS_AST: %s\n", err); exit(PCCTS_EXIT_FAILURE); }
+ virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23
+};
+
+#endif /* PCCTSAST_H */
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/SList.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/SList.h
new file mode 100644
index 000000000..5b8bf9742
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/SList.h
@@ -0,0 +1,72 @@
+#ifndef SList_h
+#define SList_h
+
+/*
+ * SList.h
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to SORCERER -- SORCERER is in the public
+ * domain. An individual or company may do whatever they wish with
+ * source code distributed with SORCERER or the code generated by
+ * SORCERER, including the incorporation of SORCERER, or its output, into
+ * commerical software.
+ *
+ * We encourage users to develop software with SORCERER. However, we do
+ * ask that credit is given to us for developing SORCERER. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like SORCERER and have developed a nice tool with the
+ * output, please mention that you developed it using SORCERER. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * PCCTS 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1992-2000
+ */
+
+#include "pcctscfg.h"
+
+#include "pccts_stdio.h"
+#include "pccts_stdlib.h"
+
+PCCTS_NAMESPACE_STD
+
+#include "PCCTSAST.h"
+
+class PCCTS_AST;
+
+class SListNode {
+protected:
+ void *_elem; /* pointer to any kind of element */
+ SListNode *_next;
+public:
+ SListNode() {_elem=_next=NULL;}
+ virtual ~SListNode() {_elem=_next=NULL;}
+ void *elem() { return _elem; }
+ void setElem(void *e) { _elem = e; }
+ void setNext(SListNode *t) { _next = t; }
+ SListNode *next() { return _next; }
+};
+
+class SList {
+ SListNode *head, *tail;
+public:
+ SList() {head=tail=NULL;}
+ virtual ~SList() {head=tail=NULL;}
+ virtual void *iterate(SListNode **);
+ virtual void add(void *e);
+ virtual void lfree();
+ virtual PCCTS_AST *to_ast(SList list);
+ virtual void require(int e,char *err){ if ( !e ) panic(err); }
+ virtual void panic(char *err){ /* MR23 */ printMessage(stderr, "SList panic: %s\n", err); exit(PCCTS_EXIT_FAILURE); }
+ virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23
+};
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/antlr.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/antlr.h
new file mode 100644
index 000000000..27a324274
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/antlr.h
@@ -0,0 +1,807 @@
+/* antlr.h
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef ANTLR_H
+#define ANTLR_H
+
+#include "pcctscfg.h"
+
+#include "pccts_stdio.h"
+
+/* turn off warnings for unreferenced labels */
+
+#ifdef _MSC_VER
+#pragma warning(disable:4102)
+#endif
+
+/*
+ * Define all of the stack setup and manipulation of $i, #i variables.
+ *
+ * Notes:
+ * The type 'Attrib' must be defined before entry into this .h file.
+ */
+
+
+#ifdef __USE_PROTOS
+#include "pccts_stdlib.h"
+#else
+#ifdef VAXC
+#include <stdlib.h>
+#else
+#include <malloc.h>
+#endif
+#endif
+#include "pccts_string.h"
+
+#if 0
+#include "set.h"
+#endif
+
+
+typedef int ANTLRTokenType;
+typedef unsigned char SetWordType;
+
+typedef char ANTLRChar;
+
+ /* G u e s s S t u f f */
+
+#ifdef ZZCAN_GUESS
+#ifndef ZZINF_LOOK
+#define ZZINF_LOOK
+#endif
+#endif
+
+#ifdef ZZCAN_GUESS
+typedef struct _zzjmp_buf {
+ jmp_buf state;
+ } zzjmp_buf;
+#endif
+
+
+/* can make this a power of 2 for more efficient lookup */
+
+#ifndef ZZLEXBUFSIZE
+#define ZZLEXBUFSIZE 8000 /* MR22 raise from 2k to 8k */
+#endif
+
+#define zzOvfChk \
+ if ( zzasp <= 0 ) \
+ { \
+ fprintf(stderr, zzStackOvfMsg, __FILE__, __LINE__); \
+ exit(PCCTS_EXIT_FAILURE); \
+ }
+
+#ifndef ZZA_STACKSIZE
+#define ZZA_STACKSIZE 400
+#endif
+#ifndef ZZAST_STACKSIZE
+#define ZZAST_STACKSIZE 400
+#endif
+
+#ifndef zzfailed_pred
+#ifdef ZZCAN_GUESS
+#define zzfailed_pred(_p,_hasuseraction,_useraction) \
+ if (zzguessing) { \
+ zzGUESS_FAIL; \
+ } else { \
+ zzfailed_pred_action(_p,_hasuseraction,_useraction); \
+ }
+#else
+#define zzfailed_pred(_p,_hasuseraction,_useraction) \
+ zzfailed_pred_action(_p,_hasuseraction,_useraction);
+#endif
+#endif
+
+/* MR23 Provide more control over failed predicate action
+ without any need for user to worry about guessing internals.
+ _hasuseraction == 0 => no user specified error action
+ _hasuseraction == 1 => user specified error action
+*/
+
+#ifndef zzfailed_pred_action
+#define zzfailed_pred_action(_p,_hasuseraction,_useraction) \
+ if (_hasuseraction) { _useraction } \
+ else { fprintf(stderr, "semantic error; failed predicate: '%s'\n",_p); }
+#endif
+
+/* MR19 zzchar_t additions */
+
+#ifdef LL_K
+#define LOOKAHEAD \
+ int zztokenLA[LL_K]; \
+ zzchar_t zztextLA[LL_K][ZZLEXBUFSIZE]; \
+ int zzlap = 0, zzlabase=0; /* labase only used for DEMAND_LOOK */
+#else
+#define LOOKAHEAD \
+ int zztoken;
+#endif
+
+#ifndef zzcr_ast
+#define zzcr_ast(ast,attr,tok,text)
+#endif
+
+#ifdef DEMAND_LOOK
+#define DemandLookData int zzdirty=1;
+#else
+#define DemandLookData
+#endif
+
+#ifndef zzUSER_GUESS_HOOK
+#define zzUSER_GUESS_HOOK(seqFrozen,zzrv)
+#endif
+
+#ifndef zzUSER_GUESS_DONE_HOOK
+#define zzUSER_GUESS_DONE_HOOK(seqFrozen)
+#endif
+
+ /* S t a t e S t u f f */
+
+#ifdef ZZCAN_GUESS
+#define zzGUESS_BLOCK zzantlr_state zzst; int zzrv; int zzGuessSeqFrozen;
+
+/* MR10 change zzGUESS: do zzGUESS_DONE when zzrv==1 after longjmp as in C++ mode */
+
+#define zzGUESS zzsave_antlr_state(&zzst); \
+ zzguessing = 1; \
+ zzGuessSeqFrozen=++zzGuessSeq; \
+ zzrv = setjmp(zzguess_start.state); \
+ zzUSER_GUESS_HOOK(zzGuessSeqFrozen,zzrv) \
+ if (zzrv) zzGUESS_DONE;
+#ifdef zzTRACE_RULES
+#define zzGUESS_FAIL { zzTraceGuessFail(); longjmp(zzguess_start.state, 1); }
+#else
+#define zzGUESS_FAIL longjmp(zzguess_start.state, 1)
+#endif
+
+/* MR10 change zzGUESS_DONE: zzrv=1 to simulate longjmp() return value as in C++ mode */
+
+#define zzGUESS_DONE { zzrestore_antlr_state(&zzst); zzrv=1; zzUSER_GUESS_DONE_HOOK(zzGuessSeqFrozen) }
+#define zzNON_GUESS_MODE if ( !zzguessing )
+#define zzGuessData \
+ zzjmp_buf zzguess_start; \
+ int zzguessing;
+#else
+#define zzGUESS_BLOCK
+#define zzGUESS
+#define zzGUESS_FAIL
+#define zzGUESS_DONE
+#define zzNON_GUESS_MODE
+#define zzGuessData
+#endif
+
+typedef struct _zzantlr_state {
+#ifdef ZZCAN_GUESS
+ zzjmp_buf guess_start;
+ int guessing;
+#endif
+ int asp;
+ int ast_sp;
+#ifdef ZZINF_LOOK
+ int inf_lap; /* not sure we need to save this one */
+ int inf_labase;
+ int inf_last;
+
+/* MR6 Gunnar Rxnning (gunnar@candleweb.no) */
+/* MR6 Additional state needs to be saved/restored */
+/* MR6 Matching changes in err.h */
+
+ int *inf_tokens; /* MR6 */
+ char **inf_text; /* MR6 */
+ char *inf_text_buffer; /* MR6 */
+ int *inf_line; /* MR6 */
+#endif
+#ifdef DEMAND_LOOK
+ int dirty;
+#endif
+
+#ifdef LL_K
+ int tokenLA[LL_K];
+ char textLA[LL_K][ZZLEXBUFSIZE];
+ int lap;
+ int labase;
+#else
+ int token;
+ char text[ZZLEXBUFSIZE];
+#endif
+#ifdef zzTRACE_RULES
+ int traceOptionValue; /* MR10 */
+ int traceGuessOptionValue; /* MR10 */
+ char *traceCurrentRuleName; /* MR10 */
+ int traceDepth; /* MR10 */
+#endif
+
+ } zzantlr_state;
+
+#ifdef zzTRACE_RULES
+extern int zzTraceOptionValueDefault;
+extern int zzTraceOptionValue;
+extern int zzTraceGuessOptionValue;
+extern char *zzTraceCurrentRuleName;
+extern int zzTraceDepth;
+#endif
+
+extern int zzGuessSeq; /* MR10 */
+extern int zzSyntaxErrCount; /* MR11 */
+extern int zzLexErrCount; /* MR11 */
+
+ /* I n f i n i t e L o o k a h e a d */
+
+
+#ifdef ZZINF_LOOK
+#define InfLookData \
+ int *zzinf_tokens; \
+ char **zzinf_text; \
+ char *zzinf_text_buffer; \
+ int *zzinf_line; \
+ int zzinf_labase; \
+ int zzinf_last;
+#else
+#define InfLookData
+#endif
+
+#ifdef ZZINF_LOOK
+
+#ifndef ZZINF_DEF_TEXT_BUFFER_SIZE
+#define ZZINF_DEF_TEXT_BUFFER_SIZE 20000
+#endif
+#ifndef ZZINF_DEF_TOKEN_BUFFER_SIZE
+#define ZZINF_DEF_TOKEN_BUFFER_SIZE 2000
+#endif
+/* WARNING!!!!!!
+ * ZZINF_BUFFER_TEXT_CHUNK_SIZE must be > sizeof(text) largest possible token.
+ */
+#ifndef ZZINF_BUFFER_TEXT_CHUNK_SIZE
+#define ZZINF_BUFFER_TEXT_CHUNK_SIZE 5000
+#endif
+#ifndef ZZINF_BUFFER_TOKEN_CHUNK_SIZE
+#define ZZINF_BUFFER_TOKEN_CHUNK_SIZE 1000
+#endif
+
+#if ZZLEXBUFSIZE > ZZINF_BUFFER_TEXT_CHUNK_SIZE
+#define ZZINF_BUFFER_TEXT_CHUNK_SIZE ZZLEXBUFSIZE+5
+#endif
+
+/* make inf_look user-access macros */
+#ifdef LL_K
+#define ZZINF_LA_VALID(i) (((zzinf_labase+i-1)-LL_K+1) <= zzinf_last)
+#define ZZINF_LA(i) zzinf_tokens[(zzinf_labase+i-1)-LL_K+1]
+#define ZZINF_LATEXT(i) zzinf_text[(zzinf_labase+i-1)-LL_K+1]
+/* MR6 In 1.33 vanilla the #define ZZINF_LINE(i) is was commented out */
+#define ZZINF_LINE(i) zzinf_line[(zzinf_labase+i-1)-LL_K+1]
+#else
+#define ZZINF_LA_VALID(i) (((zzinf_labase+i-1)) <= zzinf_last)
+#define ZZINF_LA(i) zzinf_tokens[(zzinf_labase+i-1)]
+#define ZZINF_LATEXT(i) zzinf_text[(zzinf_labase+i-1)]
+#endif
+
+#define inf_zzgettok _inf_zzgettok()
+extern void _inf_zzgettok();
+
+#endif /* ZZINF_LOOK */
+
+
+#ifdef LL_K
+
+#ifdef __USE_PROTOS
+#define ANTLR_INFO \
+ Attrib zzempty_attr(void) {static Attrib a; return a;} \
+ Attrib zzconstr_attr(int _tok, char *_text) \
+ {Attrib a; zzcr_attr((&a),_tok,_text); return a;} \
+ int zzasp=ZZA_STACKSIZE; \
+ char zzStackOvfMsg[]="fatal: attrib/AST stack overflow %s(%d)!\n"; \
+ Attrib zzaStack[ZZA_STACKSIZE]; DemandLookData \
+ InfLookData \
+ zzGuessData
+#else
+#define ANTLR_INFO \
+ Attrib zzempty_attr() {static Attrib a; return a;} \
+ Attrib zzconstr_attr(_tok, _text) int _tok; char *_text; \
+ {Attrib a; zzcr_attr((&a),_tok,_text); return a;} \
+ int zzasp=ZZA_STACKSIZE; \
+ char zzStackOvfMsg[]="fatal: attrib/AST stack overflow %s(%d)!\n"; \
+ Attrib zzaStack[ZZA_STACKSIZE]; DemandLookData \
+ InfLookData \
+ zzGuessData
+#endif
+
+#else
+
+#ifdef __USE_PROTOS
+#define ANTLR_INFO \
+ Attrib zzempty_attr(void) {static Attrib a; return a;} \
+ Attrib zzconstr_attr(int _tok, char *_text) \
+ {Attrib a; zzcr_attr((&a),_tok,_text); return a;} \
+ int zzasp=ZZA_STACKSIZE; \
+ char zzStackOvfMsg[]="fatal: attrib/AST stack overflow %s(%d)!\n"; \
+ Attrib zzaStack[ZZA_STACKSIZE]; DemandLookData \
+ InfLookData \
+ zzGuessData
+#else
+#define ANTLR_INFO \
+ Attrib zzempty_attr() {static Attrib a; return a;} \
+ Attrib zzconstr_attr(_tok, _text) int _tok; char *_text; \
+ {Attrib a; zzcr_attr((&a),_tok,_text); return a;} \
+ int zzasp=ZZA_STACKSIZE; \
+ char zzStackOvfMsg[]="fatal: attrib/AST stack overflow %s(%d)!\n"; \
+ Attrib zzaStack[ZZA_STACKSIZE]; DemandLookData \
+ InfLookData \
+ zzGuessData
+#endif
+
+#endif /* LL_k */
+
+
+#ifdef ZZINF_LOOK
+
+#ifdef LL_K
+#ifdef DEMAND_LOOK
+#define zzPrimeLookAhead {zzdirty=LL_K; zzlap = zzlabase = 0;}
+#else
+#define zzPrimeLookAhead {zzlap = zzlabase = 0; zzfill_inf_look();\
+ {int _i; for(_i=1;_i<=LL_K; _i++) \
+ {zzCONSUME;} zzlap = zzlabase = 0;}}
+#endif
+
+#else /* LL_K */
+
+#ifdef DEMAND_LOOK
+#define zzPrimeLookAhead zzfill_inf_look(); zzdirty=1
+#else
+#define zzPrimeLookAhead zzfill_inf_look(); inf_zzgettok
+
+#endif
+#endif /* LL_K */
+
+#else /* ZZINF_LOOK */
+
+#ifdef LL_K
+#ifdef DEMAND_LOOK
+#define zzPrimeLookAhead {zzdirty=LL_K; zzlap = zzlabase = 0;}
+#else
+#define zzPrimeLookAhead {int _i; zzlap = 0; for(_i=1;_i<=LL_K; _i++) \
+ {zzCONSUME;} zzlap = 0;}
+#endif
+
+#else
+
+#ifdef DEMAND_LOOK
+#define zzPrimeLookAhead zzdirty=1
+#else
+#define zzPrimeLookAhead zzgettok()
+#endif
+#endif /* LL_K */
+
+#endif /* ZZINF_LOOK */
+
+
+#ifdef LL_K
+#define zzenterANTLRs(s) \
+ zzlextext = &(zztextLA[0][0]); zzrdstr( s ); zzPrimeLookAhead;
+#define zzenterANTLRf(f) \
+ zzlextext = &(zztextLA[0][0]); zzrdfunc( f ); zzPrimeLookAhead;
+#define zzenterANTLR(f) \
+ zzlextext = &(zztextLA[0][0]); zzrdstream( f ); zzPrimeLookAhead;
+#ifdef ZZINF_LOOK
+#define zzleaveANTLR(f) free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line);
+#define zzleaveANTLRf(f) free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line);
+#define zzleaveANTLRs(f) free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line);
+#else
+#define zzleaveANTLR(f)
+#define zzleaveANTLRf(f)
+#define zzleaveANTLRs(f)
+#endif
+
+#else
+
+#define zzenterANTLRs(s) \
+ {static char zztoktext[ZZLEXBUFSIZE]; \
+ zzlextext = zztoktext; zzrdstr( s ); zzPrimeLookAhead;}
+#define zzenterANTLRf(f) \
+ {static char zztoktext[ZZLEXBUFSIZE]; \
+ zzlextext = zztoktext; zzrdfunc( f ); zzPrimeLookAhead;}
+#define zzenterANTLR(f) \
+ {static char zztoktext[ZZLEXBUFSIZE]; \
+ zzlextext = zztoktext; zzrdstream( f ); zzPrimeLookAhead;}
+#ifdef ZZINF_LOOK
+#define zzleaveANTLR(f) free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line);
+#define zzleaveANTLRf(f) free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line);
+#define zzleaveANTLRs(f) free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line);
+#else
+#define zzleaveANTLR(f)
+#define zzleaveANTLRf(f)
+#define zzleaveANTLRs(f)
+#endif
+
+#endif
+
+/* MR19 Paul D. Smith (psmith@baynetworks.com)
+ Need to adjust AST stack pointer at exit.
+ Referenced in ANTLRx macros.
+*/
+
+#ifdef GENAST
+#define ZZAST_ADJUST ++zzast_sp;
+#else
+#define ZZAST_ADJUST
+#endif
+
+#define ANTLR(st, f) zzbufsize = ZZLEXBUFSIZE; \
+ zzenterANTLR(f); \
+ { \
+ zzBLOCK(zztasp1); \
+ st; /* ++zzasp; Removed MR20 G. Hobbelt */ \
+ /* ZZAST_ADJUST Removed MR20 G. Hobbelt */ \
+ /* MR20 G. Hobbelt. Kill the top' attribute (+AST stack corr.) */ \
+ zzEXIT_ANTLR(zztasp1 + 1); \
+ } \
+ zzleaveANTLR(f);
+
+#define ANTLRm(st, f, _m) zzbufsize = ZZLEXBUFSIZE; \
+ zzmode(_m); \
+ zzenterANTLR(f); \
+ { \
+ zzBLOCK(zztasp1); \
+ st; /* ++zzasp; Removed MR20 G. Hobbelt */ \
+ /* ZZAST_ADJUST Removed MR20 G. Hobbelt */ \
+ /* MR20 G. Hobbelt. Kill the top' attribute (+AST stack corr.) */ \
+ zzEXIT_ANTLR(zztasp1 + 1); \
+ } \
+ zzleaveANTLR(f);
+
+#define ANTLRf(st, f) zzbufsize = ZZLEXBUFSIZE; \
+ zzenterANTLRf(f); \
+ { \
+ zzBLOCK(zztasp1); \
+ st; /* ++zzasp; Removed MR20 G. Hobbelt */ \
+ /* ZZAST_ADJUST Removed MR20 G. Hobbelt */ \
+ /* MR20 G. Hobbelt. Kill the top' attribute (+AST stack corr.) */ \
+ zzEXIT_ANTLR(zztasp1 + 1); \
+ } \
+ zzleaveANTLRf(f);
+
+#define ANTLRs(st, s) zzbufsize = ZZLEXBUFSIZE; \
+ zzenterANTLRs(s); \
+ { \
+ zzBLOCK(zztasp1); \
+ st; /* ++zzasp; Removed MR20 G. Hobbelt */ \
+ /* ZZAST_ADJUST Removed MR20 G. Hobbelt */ \
+ /* MR20 G. Hobbelt. Kill the top' attribute (+AST stack corr.) */ \
+ zzEXIT_ANTLR(zztasp1 + 1); \
+ } \
+ zzleaveANTLRs(s);
+
+#ifdef LL_K
+#define zztext (&(zztextLA[zzlap][0]))
+#else
+#define zztext zzlextext
+#endif
+
+
+ /* A r g u m e n t A c c e s s */
+
+#define zzaCur (zzaStack[zzasp])
+#define zzaRet (*zzaRetPtr)
+#define zzaArg(v,n) zzaStack[v-n]
+#define zzMakeAttr { zzNON_GUESS_MODE {zzOvfChk; --zzasp; zzcr_attr(&(zzaStack[zzasp]),LA(1),LATEXT(1));}}
+#ifdef zzdef0
+#define zzMake0 { zzOvfChk; --zzasp; zzdef0(&(zzaStack[zzasp]));}
+#else
+#define zzMake0 { zzOvfChk; --zzasp;}
+#endif
+#define zzaPush(_v) { zzOvfChk; zzaStack[--zzasp] = _v;}
+#ifndef zzd_attr
+#define zzREL(t) zzasp=(t); /* Restore state of stack */
+#else
+#define zzREL(t) for (; zzasp<(t); zzasp++) \
+ { zzd_attr(&(zzaStack[zzasp])); }
+#endif
+
+
+#define zzsetmatch(_es,_tokclassErrset) \
+ if ( !_zzsetmatch(_es, &zzBadText, &zzMissText, &zzMissTok, &zzBadTok, &zzMissSet, _tokclassErrset) ) goto fail; /* MR23 */
+
+#ifdef ZZCAN_GUESS
+#define zzsetmatch_wsig(_es, handler) \
+ if ( !_zzsetmatch_wsig(_es) ) if (zzguessing) { zzGUESS_FAIL; } else {_signal=MismatchedToken; goto handler;}
+#else
+#define zzsetmatch_wsig(_es, handler) \
+ if ( !_zzsetmatch_wsig(_es) ) {_signal=MismatchedToken; goto handler;}
+#endif
+
+#ifdef __USE_PROTOS
+extern int _zzsetmatch(SetWordType *, char **, char **, int *, int *, SetWordType **, SetWordType * /* MR23 */);
+extern int _zzsetmatch_wsig(SetWordType *);
+#else
+extern int _zzsetmatch();
+extern int _zzsetmatch_wsig();
+#endif
+
+#define zzmatch(_t) \
+ if ( !_zzmatch(_t, &zzBadText, &zzMissText, &zzMissTok, &zzBadTok, &zzMissSet) ) goto fail;
+
+#ifdef ZZCAN_GUESS
+#define zzmatch_wsig(_t,handler) \
+ if ( !_zzmatch_wsig(_t) ) if (zzguessing) { zzGUESS_FAIL; } else {_signal=MismatchedToken; goto handler;}
+#else
+#define zzmatch_wsig(_t,handler) \
+ if ( !_zzmatch_wsig(_t) ) {_signal=MismatchedToken; goto handler;}
+#endif
+
+#ifdef __USE_PROTOS
+extern int _zzmatch(int, char **, char **, int *, int *, SetWordType **);
+extern int _zzmatch_wsig(int);
+#else
+extern int _zzmatch();
+extern int _zzmatch_wsig();
+#endif
+
+#define zzmatch_wdfltsig(_t,_f) \
+ if ( !_zzmatch_wdfltsig(_t,_f) ) _signal=MismatchedToken;
+#define zzsetmatch_wdfltsig(tw,tt,wf) \
+ if ( !_zzsetmatch_wdfltsig(tw,tt,wf) ) _signal=MismatchedToken;
+
+#ifdef __USE_PROTOS
+extern int _zzmatch_wdfltsig(int, SetWordType *);
+extern int _zzsetmatch_wdfltsig(SetWordType *tokensWanted,
+ int tokenTypeOfSet,
+ SetWordType *whatFollows);
+#else
+extern int _zzmatch_wdfltsig();
+extern int _zzsetmatch_wdfltsig();
+#endif
+
+#ifdef GENAST
+#define zzRULE Attrib *zzaRetPtr = &(zzaStack[zzasp-1]); \
+ SetWordType *zzMissSet=NULL; int zzMissTok=0; \
+ int zzBadTok=0; char *zzBadText=""; \
+ int zzErrk=1,zzpf=0; \
+ zzTRACEdata \
+ char *zzMissText=""; zzASTVars
+#else
+#define zzRULE Attrib *zzaRetPtr = &(zzaStack[zzasp-1]); \
+ int zzBadTok=0; char *zzBadText=""; \
+ int zzErrk=1,zzpf=0; \
+ zzTRACEdata \
+ SetWordType *zzMissSet=NULL; int zzMissTok=0; char *zzMissText=""
+#endif
+
+#ifdef GENAST
+#define zzBLOCK(i) int i = zzasp - 1; int zztsp = zzast_sp
+#define zzEXIT(i) zzREL(i); zzastREL; zzNON_GUESS_MODE { zzastPush(*_root); }
+#define zzEXIT_ANTLR(i) zzREL(i); zzastREL /* [i_a] added as we want this for the ANTLRx() macros */
+#define zzLOOP(i) zzREL(i); zzastREL
+#else
+#define zzBLOCK(i) int i = zzasp - 1
+#define zzEXIT(i) zzREL(i)
+#define zzEXIT_ANTLR(i) zzREL(i) /* [i_a] added as we want this for the ANTLRx() macros */
+#define zzLOOP(i) zzREL(i)
+#endif
+
+#ifdef LL_K
+
+#ifdef DEMAND_LOOK
+#define LOOK(_k) {int i,stop=_k-(LL_K-zzdirty); for (i=1; i<=stop; i++) \
+ zzCONSUME;}
+#define zzCONSUME {zzgettok(); zzdirty--; \
+ zzlap = (zzlap+1)&(LL_K-1); \
+ zzlextext = &(zztextLA[zzlap][0]);}
+#else
+#ifdef ZZINF_LOOK
+#define zzCONSUME {inf_zzgettok; \
+ zzlap = (zzlap+1)&(LL_K-1); \
+ zzlextext = &(zztextLA[zzlap][0]); \
+ }
+#else
+#define zzCONSUME {zzgettok(); \
+ zzlap = (zzlap+1)&(LL_K-1); \
+ zzlextext = &(zztextLA[zzlap][0]);}
+#endif /* ZZINF_LOOK */
+#endif /* DEMAND_LOOK */
+
+#else /* LL_K */
+
+#ifdef DEMAND_LOOK
+#define LOOK(_k) if ( zzdirty) zzCONSUME;
+#ifdef ZZINF_LOOK
+#define zzCONSUME inf_zzgettok; zzdirty=0;
+#else
+#define zzCONSUME zzgettok(); zzdirty=0;
+#endif /* ZZINF_LOOK */
+
+#else /* DEMAND_LOOK */
+
+#ifdef ZZINF_LOOK
+#define zzCONSUME inf_zzgettok
+#else
+#define zzCONSUME zzgettok();
+#endif
+
+#endif /* DEMAND_LOOK */
+
+#endif /* LL_K */
+
+#ifdef LL_K
+#define NLA zztokenLA[zzlap&(LL_K-1)] /* --> next LA */
+#define NLATEXT zztextLA[zzlap&(LL_K-1)] /* --> next text of LA */
+#ifdef DEMAND_LOOK
+#define LA(i) zztokenLA[(zzlabase+(i)-1)&(LL_K-1)]
+#define LATEXT(i) (&(zztextLA[(zzlabase+(i)-1)&(LL_K-1)][0]))
+#else
+#define LA(i) zztokenLA[(zzlap+(i)-1)&(LL_K-1)]
+#define LATEXT(i) (&(zztextLA[(zzlap+(i)-1)&(LL_K-1)][0]))
+#endif
+#else
+#define NLA zztoken
+#define NLATEXT zztext
+#define LA(i) zztoken
+#define LATEXT(i) zztext
+#endif
+
+
+ /* S t a n d a r d S i g n a l s */
+
+#define NoSignal 0
+#define MismatchedToken 1
+#define NoViableAlt 2
+#define NoSemViableAlt 3
+
+/* MR7 Allow more control over signalling */
+/* by adding "Unwind" and "zzsetSignal" */
+
+#define Unwind 4
+#define zzsetSignal(newValue) *_retsignal=_signal=(newValue)
+#define zzsuppressSignal *_retsignal=_signal=0
+#define zzexportSignal *_retsignal=_signal
+
+ /* F u n c t i o n T r a c i n g */
+
+#ifndef zzTRACE_RULES
+#define zzTRACEdata
+#else
+#ifndef zzTRACEdata
+#define zzTRACEdata ANTLRChar *zzTracePrevRuleName = NULL;
+#endif
+#endif
+
+#ifndef zzTRACEIN
+#define zzTRACEIN(r) zzTracePrevRuleName=zzTraceCurrentRuleName;zzTraceIn(r);
+#endif
+#ifndef zzTRACEOUT
+#define zzTRACEOUT(r) zzTraceOut(r);zzTraceCurrentRuleName=zzTracePrevRuleName;
+#endif
+
+/* MR19 zzchar_t additions */
+
+#ifndef zzchar_t
+#ifdef ZZWCHAR_T
+#define zzchar_t wchar_t
+#else
+#define zzchar_t char
+#endif
+#endif
+
+
+/* MR26 */
+
+#ifdef PCCTS_USE_STDARG
+extern void zzFAIL(int k, ...);
+#else
+extern void zzFAIL();
+#endif
+ /* E x t e r n D e f s */
+
+#ifdef __USE_PROTOS
+extern Attrib zzempty_attr(void);
+extern Attrib zzconstr_attr(int, char *);
+extern void zzsyn(char *, int, char *, SetWordType *, int, int, char *);
+extern int zzset_el(unsigned, SetWordType *);
+extern int zzset_deg(SetWordType *);
+extern void zzedecode(SetWordType *);
+
+extern void zzresynch(SetWordType *, SetWordType);
+extern void zzsave_antlr_state(zzantlr_state *);
+extern void zzrestore_antlr_state(zzantlr_state *);
+extern void zzfill_inf_look(void);
+extern void zzconsumeUntil(SetWordType *st); /* MR7 */
+extern void zzconsumeUntilToken(int t); /* MR7 */
+extern void zzTraceIn(char * ruleName); /* MR10 */
+extern void zzTraceOut(char * ruleName); /* MR10 */
+extern int zzTraceOption(int delta); /* MR10 */
+extern int zzTraceGuessOption(int delta); /* MR10 */
+extern void zzTraceReset(void); /* MR10 */
+extern void zzTraceGuessFail(void); /* MR10 */
+#ifdef EXCEPTION_HANDLING
+extern void zzdflthandlers(int, int *);
+#endif
+#else
+extern Attrib zzempty_attr();
+extern Attrib zzconstr_attr();
+extern void zzsyn();
+extern int zzset_el();
+extern int zzset_deg();
+extern void zzedecode();
+extern void zzresynch();
+extern void zzsave_antlr_state();
+extern void zzrestore_antlr_state();
+extern void zzfill_inf_look();
+extern void zzconsumeUntil(); /* MR7 */
+extern void zzconsumeUntilToken(); /* MR7 */
+extern void zzTraceIn(); /* MR10 */
+extern void zzTraceOut(); /* MR10 */
+extern int zzTraceOption(); /* MR10 */
+extern int zzTraceGuessOption(); /* MR10 */
+extern void zzTraceReset(); /* MR10 */
+extern void zzTraceGuessFail(); /* MR10 */
+#ifdef EXCEPTION_HANDLING
+extern void zzdflthandlers();
+#endif
+#endif
+
+ /* G l o b a l V a r i a b l e s */
+
+/* Define a parser; user should do a "#parser myname" in their grammar file */
+/*extern struct pccts_parser zzparser;*/
+
+extern char *zztokens[];
+#ifdef LL_K
+extern int zztokenLA[];
+extern zzchar_t zztextLA[][ZZLEXBUFSIZE];
+extern int zzlap;
+extern int zzlabase;
+#else
+extern int zztoken;
+#endif
+
+extern char zzStackOvfMsg[];
+extern int zzasp;
+extern Attrib zzaStack[];
+#ifdef ZZINF_LOOK
+extern int *zzinf_tokens;
+extern char **zzinf_text;
+extern char *zzinf_text_buffer;
+extern int *zzinf_line;
+extern int zzinf_labase;
+extern int zzinf_last;
+#endif
+#ifdef DEMAND_LOOK
+extern int zzdirty;
+#endif
+#ifdef ZZCAN_GUESS
+extern int zzguessing;
+extern zzjmp_buf zzguess_start;
+#endif
+
+/* Define global variables that refer to values exported by the scanner.
+ * These declarations duplicate those in dlgdef.h, but are needed
+ * if ANTLR is not to generate a .dlg file (-gx); PS, this is a hack.
+ */
+extern zzchar_t *zzlextext; /* text of most recently matched token */
+extern int zzbufsize; /* how long zzlextext is */
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ast.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ast.c
new file mode 100644
index 000000000..9326ae16a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ast.c
@@ -0,0 +1,345 @@
+/* Abstract syntax tree manipulation functions
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#include "pcctscfg.h"
+
+#ifdef PCCTS_USE_STDARG
+#include "pccts_stdarg.h"
+#else
+#include <varargs.h>
+#endif
+
+/* ensure that tree manipulation variables are current after a rule
+ * reference
+ */
+
+void
+#ifdef __USE_PROTOS
+zzlink(AST **_root, AST **_sibling, AST **_tail)
+#else
+zzlink(_root, _sibling, _tail)
+AST **_root, **_sibling, **_tail;
+#endif
+{
+ if ( *_sibling == NULL ) return;
+ if ( *_root == NULL ) *_root = *_sibling;
+ else if ( *_root != *_sibling ) (*_root)->down = *_sibling;
+ if ( *_tail==NULL ) *_tail = *_sibling;
+ while ( (*_tail)->right != NULL ) *_tail = (*_tail)->right;
+}
+
+AST *
+#ifdef __USE_PROTOS
+zzastnew(void)
+#else
+zzastnew()
+#endif
+{
+ AST *p = (AST *) calloc(1, sizeof(AST));
+ if ( p == NULL ) fprintf(stderr,"%s(%d): cannot allocate AST node\n",__FILE__,__LINE__);
+ return p;
+}
+
+/* add a child node to the current sibling list */
+void
+#ifdef __USE_PROTOS
+zzsubchild(AST **_root, AST **_sibling, AST **_tail)
+#else
+zzsubchild(_root, _sibling, _tail)
+AST **_root, **_sibling, **_tail;
+#endif
+{
+ AST *n;
+ zzNON_GUESS_MODE {
+ n = zzastnew();
+#ifdef DEMAND_LOOK
+ zzcr_ast(n, &(zzaCur), LA(0), LATEXT(0));
+#else
+ zzcr_ast(n, &(zzaCur), LA(1), LATEXT(1));
+#endif
+ zzastPush( n );
+ if ( *_tail != NULL ) (*_tail)->right = n;
+ else {
+ *_sibling = n;
+ if ( *_root != NULL ) (*_root)->down = *_sibling;
+ }
+ *_tail = n;
+ if ( *_root == NULL ) *_root = *_sibling;
+ }
+}
+
+/* make a new AST node. Make the newly-created
+ * node the root for the current sibling list. If a root node already
+ * exists, make the newly-created node the root of the current root.
+ */
+void
+#ifdef __USE_PROTOS
+zzsubroot(AST **_root, AST **_sibling, AST **_tail)
+#else
+zzsubroot(_root, _sibling, _tail)
+AST **_root, **_sibling, **_tail;
+#endif
+{
+ AST *n;
+ zzNON_GUESS_MODE {
+ n = zzastnew();
+#ifdef DEMAND_LOOK
+ zzcr_ast(n, &(zzaCur), LA(0), LATEXT(0));
+#else
+ zzcr_ast(n, &(zzaCur), LA(1), LATEXT(1));
+#endif
+ zzastPush( n );
+ if ( *_root != NULL )
+ if ( (*_root)->down == *_sibling ) *_sibling = *_tail = *_root;
+ *_root = n;
+ (*_root)->down = *_sibling;
+ }
+}
+
+/* Apply function to root then each sibling
+ * example: print tree in child-sibling LISP-format (AST has token field)
+ *
+ * void show(tree)
+ * AST *tree;
+ * {
+ * if ( tree == NULL ) return;
+ * printf(" %s", zztokens[tree->token]);
+ * }
+ *
+ * void before() { printf(" ("); }
+ * void after() { printf(" )"); }
+ *
+ * LISPdump() { zzpre_ast(tree, show, before, after); }
+ *
+ */
+void
+#ifdef __USE_PROTOS
+zzpre_ast(
+ AST *tree,
+ void (*func)(AST *), /* apply this to each tree node */
+ void (*before)(AST *), /* apply this to root of subtree before preordering it */
+ void (*after)(AST *)) /* apply this to root of subtree after preordering it */
+#else
+zzpre_ast(tree, func, before, after)
+AST *tree;
+void (*func)(), /* apply this to each tree node */
+ (*before)(), /* apply this to root of subtree before preordering it */
+ (*after)(); /* apply this to root of subtree after preordering it */
+#endif
+{
+ while ( tree!= NULL )
+ {
+ if ( tree->down != NULL ) (*before)(tree);
+ (*func)(tree);
+ zzpre_ast(tree->down, func, before, after);
+ if ( tree->down != NULL ) (*after)(tree);
+ tree = tree->right;
+ }
+}
+
+/* free all AST nodes in tree; apply func to each before freeing */
+
+#if 0
+////void
+////#ifdef __USE_PROTOS
+////zzfree_ast(AST *tree)
+////#else
+////zzfree_ast(tree)
+////AST *tree;
+////#endif
+////{
+//// if ( tree == NULL ) return;
+//// zzfree_ast( tree->down );
+//// zzfree_ast( tree->right );
+//// zztfree( tree );
+////}
+#endif
+
+/*
+ MR19 Optimize freeing of the following structure to limit recursion
+ SAKAI Kiyotaka (ksakai@isr.co.jp)
+*/
+
+/*
+ NULL o
+ / \
+ NULL o
+ / \
+ NULL NULL
+*/
+
+/*
+ MR21 Another refinement to replace recursion with iteration
+ NAKAJIMA Mutsuki (muc@isr.co.jp).
+*/
+
+void
+#ifdef __USE_PROTOS
+zzfree_ast(AST *tree)
+#else
+zzfree_ast(tree)
+AST *tree;
+#endif
+{
+
+ AST *otree;
+
+ if (tree == NULL) return;
+
+ while (tree->down == NULL || tree->right == NULL) {
+
+ if (tree->down == NULL && tree->right == NULL) {
+ zztfree(tree);
+ return;
+ }
+
+ otree = tree;
+ if (tree->down == NULL) {
+ tree = tree->right;
+ } else {
+ tree = tree->down;
+ }
+ zztfree( otree );
+ }
+
+ while (tree != NULL) {
+ zzfree_ast(tree->down);
+ otree = tree;
+ tree = otree->right;
+ zztfree(otree);
+ }
+}
+
+/* build a tree (root child1 child2 ... NULL)
+ * If root is NULL, simply make the children siblings and return ptr
+ * to 1st sibling (child1). If root is not single node, return NULL.
+ *
+ * Siblings that are actually siblins lists themselves are handled
+ * correctly. For example #( NULL, #( NULL, A, B, C), D) results
+ * in the tree ( NULL A B C D ).
+ *
+ * Requires at least two parameters with the last one being NULL. If
+ * both are NULL, return NULL.
+ */
+#ifdef PCCTS_USE_STDARG
+AST *zztmake(AST *rt, ...)
+#else
+AST *zztmake(va_alist)
+va_dcl
+#endif
+{
+ va_list ap;
+ register AST *child, *sibling=NULL, *tail=NULL /* MR20 */, *w;
+ AST *root;
+
+#ifdef PCCTS_USE_STDARG
+ va_start(ap, rt);
+ root = rt;
+#else
+ va_start(ap);
+ root = va_arg(ap, AST *);
+#endif
+
+ if ( root != NULL )
+ if ( root->down != NULL ) return NULL;
+ child = va_arg(ap, AST *);
+ while ( child != NULL )
+ {
+ for (w=child; w->right!=NULL; w=w->right) {;} /* find end of child */
+ if ( sibling == NULL ) {sibling = child; tail = w;}
+ else {tail->right = child; tail = w;}
+ child = va_arg(ap, AST *);
+ }
+ if ( root==NULL ) root = sibling;
+ else root->down = sibling;
+ va_end(ap);
+ return root;
+}
+
+/* tree duplicate */
+AST *
+#ifdef __USE_PROTOS
+zzdup_ast(AST *t)
+#else
+zzdup_ast(t)
+AST *t;
+#endif
+{
+ AST *u;
+
+ if ( t == NULL ) return NULL;
+ u = zzastnew();
+ *u = *t;
+#ifdef zzAST_DOUBLE
+ u->up = NULL; /* set by calling invocation */
+ u->left = NULL;
+#endif
+ u->right = zzdup_ast(t->right);
+ u->down = zzdup_ast(t->down);
+#ifdef zzAST_DOUBLE
+ if ( u->right!=NULL ) u->right->left = u;
+ if ( u->down!=NULL ) u->down->up = u;
+#endif
+ return u;
+}
+
+void
+#ifdef __USE_PROTOS
+zztfree(AST *t)
+#else
+zztfree(t)
+AST *t;
+#endif
+{
+#ifdef zzd_ast
+ zzd_ast( t );
+#endif
+ free( t );
+}
+
+#ifdef zzAST_DOUBLE
+/*
+ * Set the 'up', and 'left' pointers of all nodes in 't'.
+ * Initial call is double_link(your_tree, NULL, NULL).
+ */
+void
+#ifdef __USE_PROTOS
+zzdouble_link(AST *t, AST *left, AST *up)
+#else
+zzdouble_link(t, left, up)
+AST *t, *left, *up;
+#endif
+{
+ if ( t==NULL ) return;
+ t->left = left;
+ t->up = up;
+ zzdouble_link(t->down, NULL, t);
+ zzdouble_link(t->right, t, up);
+}
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ast.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ast.h
new file mode 100644
index 000000000..5ff84bd76
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/ast.h
@@ -0,0 +1,121 @@
+/* Abstract syntax tree
+ *
+ * Macros, definitions
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef ZZAST_H
+#define ZZAST_H
+
+#define zzastOvfChk \
+ if ( zzast_sp <= 0 ) \
+ { \
+ fprintf(stderr, zzStackOvfMsg, __FILE__, __LINE__); \
+ exit(PCCTS_EXIT_FAILURE); \
+ }
+
+#ifndef USER_DEFINED_AST
+#ifndef AST_FIELDS
+#define AST_FIELDS
+#endif
+
+typedef struct _ast {
+ struct _ast *right, *down;
+#ifdef zzAST_DOUBLE
+ struct _ast *left, *up;
+#endif
+ AST_FIELDS
+} AST;
+
+#else
+
+#ifdef zzAST_DOUBLE
+#define AST_REQUIRED_FIELDS struct _ast *right, *down, *left, *up;
+#else
+#define AST_REQUIRED_FIELDS struct _ast *right, *down;
+#endif
+
+#endif
+
+
+/* N o d e a c c e s s m a c r o s */
+#define zzchild(t) (((t)==NULL)? (AST *) NULL:(t->down)) /* MR19 */
+#define zzsibling(t) (((t)==NULL)? (AST *) NULL:(t->right)) /* MR19 */
+
+
+/* define global variables needed by #i stack */
+#define zzASTgvars \
+ AST *zzastStack[ZZAST_STACKSIZE]; \
+ int zzast_sp = ZZAST_STACKSIZE;
+
+#define zzASTVars AST *_ast = NULL, *_sibling = NULL, *_tail = NULL
+#define zzSTR ( (_tail==NULL)?(&_sibling):(&(_tail->right)) )
+#define zzastCur (zzastStack[zzast_sp])
+#define zzastArg(i) (zzastStack[zztsp-i])
+#define zzastPush(p) zzastOvfChk; zzastStack[--zzast_sp] = p;
+#define zzastDPush --zzast_sp
+#define zzastMARK zztsp=zzast_sp; /* Save state of stack */
+#define zzastREL zzast_sp=zztsp; /* Return state of stack */
+#define zzrm_ast {zzfree_ast(*_root); _tail = _sibling = (*_root)=NULL;}
+
+extern int zzast_sp;
+extern AST *zzastStack[];
+
+/* MR26 */
+
+#ifdef PCCTS_USE_STDARG
+AST *zztmake(AST *, ...);
+#else
+AST *zztmake();
+#endif
+
+#ifdef __USE_PROTOS
+void zzlink(AST **, AST **, AST **);
+void zzsubchild(AST **, AST **, AST **);
+void zzsubroot(AST **, AST **, AST **);
+void zzpre_ast(AST *, void (*)(AST *), void (*)(AST *), void (*)(AST *));
+void zzfree_ast(AST *);
+AST *zzdup_ast(AST *);
+void zztfree(AST *);
+void zzdouble_link(AST *, AST *, AST *);
+AST *zzastnew(void);
+
+#else
+
+void zzlink();
+AST *zzastnew();
+void zzsubchild();
+void zzsubroot();
+void zzpre_ast();
+void zzfree_ast();
+AST *zzdup_ast();
+void zztfree();
+void zzdouble_link();
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/charbuf.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/charbuf.h
new file mode 100644
index 000000000..5f01c8ba3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/charbuf.h
@@ -0,0 +1,46 @@
+/* ANTLR attribute definition -- constant width text
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef ZZCHARBUF_H
+#define ZZCHARBUF_H
+
+#include "pcctscfg.h"
+
+#include "pccts_string.h"
+
+#ifndef D_TextSize
+#define D_TextSize 30
+#endif
+
+typedef struct { char text[D_TextSize]; } Attrib;
+
+#define zzcr_attr(a,tok,t) strncpy((a)->text, t, D_TextSize-1); \
+ (a)->text[D_TextSize-1] = '\0';
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/charptr.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/charptr.c
new file mode 100644
index 000000000..d3f80e60b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/charptr.c
@@ -0,0 +1,58 @@
+/*
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#include "pcctscfg.h"
+
+#ifdef __STDC__
+#include "pccts_stdlib.h"
+#else
+#include <malloc.h>
+#endif
+#include "pccts_string.h"
+
+/* 133MR1 include stdio.h for fprintf in charptr.c */
+
+#include "pccts_stdio.h"
+
+/* 133MR1 include charptr.h for Attrib in charptr.c */
+
+#include "charptr.h"
+
+#ifdef __USE_PROTOS
+zzcr_attr(Attrib *a,int token,char *text)
+#else
+zzcr_attr(a,token,text)
+Attrib *a;
+int token;
+char *text;
+#endif
+{
+ *a = (char *) malloc(strlen(text)+1); /* MR6 */
+ if ( *a == NULL ) {fprintf(stderr, "zzcr_attr: out of memory!\n"); exit(-1);}
+ strcpy(*a, text);
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/charptr.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/charptr.h
new file mode 100644
index 000000000..e73da681a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/charptr.h
@@ -0,0 +1,48 @@
+/*
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+/*
+ * WARNING!!!!: charptr.h does NOT make copies and the
+ * memory is freed after the attribute scope exits.
+ */
+
+#ifndef ZZCHARPTR_H
+#define ZZCHARPTR_H
+
+typedef char *Attrib;
+#define zzdef0(a) {*(a)=NULL;}
+/* MR8 Jens Tingleff (jensting@imaginet.fr) */
+/* Set memory pointer to null after free() */
+#define zzd_attr(a) {if ( *(a)!=NULL ) {free(*(a)); *(a)=NULL; }; }
+
+#ifdef __STDC__
+extern zzcr_attr(Attrib *,int,char *);
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/config.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/config.h
new file mode 100644
index 000000000..8aa50ad61
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/config.h
@@ -0,0 +1 @@
+#include "pcctscfg.h"
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/dlgauto.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/dlgauto.h
new file mode 100644
index 000000000..db94cefac
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/dlgauto.h
@@ -0,0 +1,504 @@
+/* dlgauto.h automaton
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Will Cohen and Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef ZZDEFAUTO_H
+#define ZZDEFAUTO_H
+
+/* 10-Apr-97 133MR1 Uses __USE_PROTOS show should #include pcctscfg.h */
+
+#include "pcctscfg.h"
+
+zzchar_t *zzlextext; /* text of most recently matched token */
+zzchar_t *zzbegexpr; /* beginning of last reg expr recogn. */
+zzchar_t *zzendexpr; /* beginning of last reg expr recogn. */
+int zzbufsize = 0; /* number of characters in zzlextext */ /* MR7 */
+int zzbegcol = 0; /* column that first character of token is in*/
+int zzendcol = 0; /* column that last character of token is in */
+int zzline = 1; /* line current token is on */
+int zzreal_line=1; /* line of 1st portion of token that is not skipped */
+int zzchar; /* character to determine next state */
+int zzbufovf; /* indicates that buffer too small for text */
+int zzcharfull = 0;
+static zzchar_t *zznextpos;/* points to next available position in zzlextext*/
+static int zzclass;
+
+#ifdef __USE_PROTOS
+void zzerrstd(const char *);
+void (*zzerr)(const char *)=zzerrstd;/* pointer to error reporting function */
+extern int zzerr_in(void);
+static int (*zzfunc_in)(void) = zzerr_in; /* MR20 */
+#else
+void zzerrstd();
+void (*zzerr)()=zzerrstd; /* pointer to error reporting function */
+extern int zzerr_in();
+static int (*zzfunc_in)() = zzerr_in; /* MR20 */
+#endif
+
+static FILE *zzstream_in=0;
+static zzchar_t *zzstr_in=0;
+
+#ifdef USER_ZZMODE_STACK
+int zzauto = 0;
+#else
+static int zzauto = 0;
+#endif
+static int zzadd_erase;
+static char zzebuf[70];
+
+#ifdef ZZCOL
+#define ZZINC (++zzendcol)
+#else
+#define ZZINC
+#endif
+
+
+#define ZZGETC_STREAM {zzchar = getc(zzstream_in); zzclass = ZZSHIFT(zzchar);}
+#define ZZGETC_FUNC {zzchar = (*zzfunc_in)(); zzclass = ZZSHIFT(zzchar);}
+#define ZZGETC_STR { \
+ if (*zzstr_in){ \
+ zzchar = *zzstr_in; \
+ ++zzstr_in; \
+ }else{ \
+ zzchar = EOF; \
+ } \
+ zzclass = ZZSHIFT(zzchar); \
+}
+
+#define ZZNEWSTATE (newstate = dfa[state][zzclass])
+
+#ifndef ZZCOPY
+#define ZZCOPY \
+ /* Truncate matching buffer to size (not an error) */ \
+ if (zznextpos < lastpos){ \
+ *(zznextpos++) = zzchar; \
+ }else{ \
+ zzbufovf = 1; \
+ }
+#endif
+
+void
+#ifdef __USE_PROTOS
+zzrdstream( FILE *f )
+#else
+zzrdstream( f )
+FILE *f;
+#endif
+{
+ /* make sure that it is really set to something, otherwise just
+ leave it be.
+ */
+ if (f){
+ /* make sure that there is always someplace to get input
+ before closing zzstream_in
+ */
+#if 0
+ if (zzstream_in && zzstream_in!=stdin) fclose( zzstream_in );
+#endif
+ zzline = 1;
+ zzstream_in = f;
+ zzfunc_in = NULL;
+ zzstr_in = 0;
+ zzcharfull = 0;
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+zzrdfunc( int (*f)(void) )
+#else
+zzrdfunc( f )
+int (*f)();
+#endif
+{
+ /* make sure that it is really set to something, otherwise just
+ leave it be.
+ */
+ if (f){
+ /* make sure that there is always someplace to get input
+ before closing zzstream_in
+ */
+#if 0
+ if (zzstream_in && zzstream_in!=stdin) fclose( zzstream_in );
+#endif
+ zzline = 1;
+ zzstream_in = NULL;
+ zzfunc_in = f;
+ zzstr_in = 0;
+ zzcharfull = 0;
+ }
+}
+
+
+void
+#ifdef __USE_PROTOS
+zzrdstr( zzchar_t *s )
+#else
+zzrdstr( s )
+zzchar_t *s;
+#endif
+{
+ /* make sure that it is really set to something, otherwise just
+ leave it be.
+ */
+ if (s){
+ /* make sure that there is always someplace to get input
+ before closing zzstream_in
+ */
+#if 0
+ if (zzstream_in && zzstream_in!=stdin) fclose( zzstream_in );
+#endif
+ zzline = 1;
+ zzstream_in = NULL;
+ zzfunc_in = 0;
+ zzstr_in = s;
+ zzcharfull = 0;
+ }
+}
+
+
+#ifdef __USE_PROTOS
+void zzclose_stream(void)
+#else
+void zzclose_stream()
+#endif
+{
+#if 0
+ fclose( zzstream_in );
+ zzstream_in = NULL;
+ zzfunc_in = NULL;
+#endif
+}
+
+/* saves dlg state, but not what feeds dlg (such as file position) */
+void
+#ifdef __USE_PROTOS
+zzsave_dlg_state(struct zzdlg_state *state)
+#else
+zzsave_dlg_state(state)
+struct zzdlg_state *state;
+#endif
+{
+ state->stream = zzstream_in;
+ state->func_ptr = zzfunc_in;
+ state->str = zzstr_in;
+ state->auto_num = zzauto;
+ state->add_erase = zzadd_erase;
+ state->lookc = zzchar;
+ state->char_full = zzcharfull;
+ state->begcol = zzbegcol;
+ state->endcol = zzendcol;
+ state->line = zzline;
+ state->lextext = zzlextext;
+ state->begexpr = zzbegexpr;
+ state->endexpr = zzendexpr;
+ state->bufsize = zzbufsize;
+ state->bufovf = zzbufovf;
+ state->nextpos = zznextpos;
+ state->class_num = zzclass;
+}
+
+void
+#ifdef __USE_PROTOS
+zzrestore_dlg_state(struct zzdlg_state *state)
+#else
+zzrestore_dlg_state(state)
+struct zzdlg_state *state;
+#endif
+{
+ zzstream_in = state->stream;
+ zzfunc_in = state->func_ptr;
+ zzstr_in = state->str;
+ zzauto = state->auto_num;
+ zzadd_erase = state->add_erase;
+ zzchar = state->lookc;
+ zzcharfull = state->char_full;
+ zzbegcol = state->begcol;
+ zzendcol = state->endcol;
+ zzline = state->line;
+ zzlextext = state->lextext;
+ zzbegexpr = state->begexpr;
+ zzendexpr = state->endexpr;
+ zzbufsize = state->bufsize;
+ zzbufovf = state->bufovf;
+ zznextpos = state->nextpos;
+ zzclass = state->class_num;
+}
+
+void
+#ifdef __USE_PROTOS
+zzmode( int m )
+#else
+zzmode( m )
+int m;
+#endif
+{
+ /* points to base of dfa table */
+ if (m<MAX_MODE){
+ zzauto = m;
+ /* have to redo class since using different compression */
+ zzclass = ZZSHIFT(zzchar);
+ }else{
+ sprintf(zzebuf,"Invalid automaton mode = %d ",m);
+ zzerr(zzebuf);
+ }
+}
+
+/* erase what is currently in the buffer, and get a new reg. expr */
+
+#ifdef __USE_PROTOS
+void zzskip(void)
+#else
+void zzskip()
+#endif
+{
+ zzadd_erase = 1;
+}
+
+/* don't erase what is in the zzlextext buffer, add on to it */
+#ifdef __USE_PROTOS
+void zzmore()
+#else
+void zzmore()
+#endif
+{
+ zzadd_erase = 2;
+}
+
+/* substitute c for the reg. expr last matched and is in the buffer */
+#ifdef __USE_PROTOS
+void
+zzreplchar(zzchar_t c)
+#else
+void
+zzreplchar(c)
+zzchar_t c;
+#endif
+{
+ /* can't allow overwriting null at end of string */
+ if (zzbegexpr < &zzlextext[zzbufsize-1]){
+ *zzbegexpr = c;
+ *(zzbegexpr+1) = '\0';
+ }
+ zzendexpr = zzbegexpr;
+ if (c != '\0') {
+ zznextpos = zzbegexpr + 1;
+ }
+ else {
+ zznextpos = zzbegexpr; /* MR30 Zero terminates string. */
+ }
+}
+
+/* replace the string s for the reg. expr last matched and in the buffer */
+void
+#ifdef __USE_PROTOS
+zzreplstr(register zzchar_t *s)
+#else
+zzreplstr(s)
+register zzchar_t *s;
+#endif
+{
+ register zzchar_t *l= &zzlextext[zzbufsize -1];
+
+ zznextpos = zzbegexpr;
+ if (s){
+ while ((zznextpos <= l) && (*(zznextpos++) = *(s++))!=0){
+ /* empty */
+ }
+ /* correct for NULL at end of string */
+ zznextpos--;
+ }
+ if ((zznextpos <= l) && (*(--s) == 0)){
+ zzbufovf = 0;
+ }else{
+ zzbufovf = 1;
+ }
+ *(zznextpos) = '\0';
+ zzendexpr = zznextpos - 1;
+}
+
+#ifdef __USE_PROTOS
+void zzgettok(void)
+#else
+void zzgettok()
+#endif
+{
+ register int state, newstate;
+ /* last space reserved for the null char */
+ zzchar_t *lastpos; /* MR27 Remove register since address operator used. */
+
+skip:
+ zzreal_line = zzline;
+ zzbufovf = 0;
+ lastpos = &zzlextext[zzbufsize-1];
+ zznextpos = zzlextext;
+ zzbegcol = zzendcol+1;
+more:
+ zzbegexpr = zznextpos;
+#ifdef ZZINTERACTIVE
+ /* interactive version of automaton */
+ /* if there is something in zzchar, process it */
+ state = newstate = dfa_base[zzauto];
+ if (zzcharfull){
+ ZZINC;
+ ZZCOPY;
+ ZZNEWSTATE;
+ }
+ if (zzstr_in)
+ while (zzalternatives[newstate]){
+ state = newstate;
+ ZZGETC_STR;
+ ZZINC;
+ ZZCOPY;
+ ZZNEWSTATE;
+ }
+ else if (zzstream_in)
+ while (zzalternatives[newstate]){
+ state = newstate;
+ ZZGETC_STREAM;
+ ZZINC;
+ ZZCOPY;
+ ZZNEWSTATE;
+ }
+ else if (zzfunc_in)
+ while (zzalternatives[newstate]){
+ state = newstate;
+ ZZGETC_FUNC;
+ ZZINC;
+ ZZCOPY;
+ ZZNEWSTATE;
+ }
+ /* figure out if last character really part of token */
+ if ((state != dfa_base[zzauto]) && (newstate == DfaStates)){
+ zzcharfull = 1;
+ --zznextpos;
+ }else{
+ zzcharfull = 0;
+ state = newstate;
+ }
+ *(zznextpos) = '\0';
+ /* Able to transition out of start state to some non err state?*/
+ if ( state == dfa_base[zzauto] ){
+ /* make sure doesn't get stuck */
+ zzadvance();
+ }
+#else
+ /* non-interactive version of automaton */
+ if (!zzcharfull)
+ zzadvance();
+ else
+ ZZINC;
+ state = dfa_base[zzauto];
+ if (zzstr_in)
+ while (ZZNEWSTATE != DfaStates){
+ state = newstate;
+ ZZCOPY;
+ ZZGETC_STR;
+ ZZINC;
+ }
+ else if (zzstream_in)
+ while (ZZNEWSTATE != DfaStates){
+ state = newstate;
+ ZZCOPY;
+ ZZGETC_STREAM;
+ ZZINC;
+ }
+ else if (zzfunc_in)
+ while (ZZNEWSTATE != DfaStates){
+ state = newstate;
+ ZZCOPY;
+ ZZGETC_FUNC;
+ ZZINC;
+ }
+ zzcharfull = 1;
+ if ( state == dfa_base[zzauto] ){
+ if (zznextpos < lastpos){
+ *(zznextpos++) = zzchar;
+ }else{
+ zzbufovf = 1;
+ }
+ *zznextpos = '\0';
+ /* make sure doesn't get stuck */
+ zzadvance();
+ }else{
+ *zznextpos = '\0';
+ }
+#endif
+#ifdef ZZCOL
+ zzendcol -= zzcharfull;
+#endif
+ zzendexpr = zznextpos -1;
+ zzadd_erase = 0;
+ (*actions[accepts[state]])();
+ switch (zzadd_erase) {
+ case 1: goto skip;
+ case 2: goto more;
+ }
+}
+
+#ifdef __USE_PROTOS
+void zzadvance(void)
+#else
+void zzadvance()
+#endif
+{
+ if (zzstream_in) { ZZGETC_STREAM; zzcharfull = 1; ZZINC;}
+ if (zzfunc_in) { ZZGETC_FUNC; zzcharfull = 1; ZZINC;}
+ if (zzstr_in) { ZZGETC_STR; zzcharfull = 1; ZZINC;}
+ if (!(zzstream_in || zzfunc_in || zzstr_in)){
+ zzerr_in();
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+zzerrstd(const char *s)
+#else
+zzerrstd(s)
+char *s;
+#endif
+{
+ zzLexErrCount++; /* MR11 */
+ fprintf(stderr,
+ "%s near line %d (text was '%s')\n",
+ ((s == NULL) ? "Lexical error" : s),
+ zzline,zzlextext);
+}
+
+#ifdef __USE_PROTOS
+int zzerr_in(void)
+#else
+int zzerr_in()
+#endif
+{
+ fprintf(stderr,"No input stream, function, or string\n");
+ /* return eof to get out gracefully */
+ return EOF;
+}
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/dlgdef.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/dlgdef.h
new file mode 100644
index 000000000..733d2568e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/dlgdef.h
@@ -0,0 +1,128 @@
+/* dlgdef.h
+ * Things in scanner produced by dlg that should be visible to the outside
+ * world
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef ZZDLGDEF_H
+#define ZZDLGDEF_H
+
+#include "pcctscfg.h"
+
+#ifndef zzchar_t
+#ifdef ZZWCHAR_T
+#define zzchar_t wchar_t
+#else
+#define zzchar_t char
+#endif
+#endif
+
+struct zzdlg_state {
+ FILE *stream;
+#ifdef __USE_PROTOS
+ int (*func_ptr)(void);
+#else
+ int (*func_ptr)();
+#endif
+ zzchar_t *str;
+ int auto_num;
+ int add_erase;
+ int lookc;
+ int char_full;
+ int begcol, endcol;
+ int line;
+ zzchar_t *lextext, *begexpr, *endexpr;
+ int bufsize;
+ int bufovf;
+ zzchar_t *nextpos;
+ int class_num;
+};
+
+extern zzchar_t *zzlextext; /* text of most recently matched token */
+extern zzchar_t *zzbegexpr; /* beginning of last reg expr recogn. */
+extern zzchar_t *zzendexpr; /* beginning of last reg expr recogn. */
+extern int zzbufsize; /* how long zzlextext is */
+extern int zzbegcol; /* column that first character of token is in*/
+extern int zzendcol; /* column that last character of token is in */
+extern int zzline; /* line current token is on */
+extern int zzreal_line; /* line of 1st portion of token that is not skipped */
+extern int zzchar; /* character to determine next state */
+extern int zzbufovf; /* indicates that buffer too small for text */
+#ifdef __USE_PROTOS
+extern void (*zzerr)(const char *);/* pointer to error reporting function */
+#else
+extern void (*zzerr)();
+#endif
+
+#ifdef USER_ZZMODE_STACK
+extern int zzauto;
+#endif
+
+#ifdef __USE_PROTOS
+extern void zzadvance(void);
+extern void zzskip(void); /* erase zzlextext, look for antoher token */
+extern void zzmore(void); /* keep zzlextext, look for another token */
+extern void zzmode(int k); /* switch to automaton 'k' */
+extern void zzrdstream(FILE *);/* what stream to read from */
+extern void zzclose_stream(void);/* close the current input stream */
+extern void zzrdfunc(int (*)(void));/* what function to get char from */
+extern void zzrdstr( zzchar_t * );
+extern void zzgettok(void); /* get next token */
+extern void zzreplchar(zzchar_t c);/* replace last recognized reg. expr. with
+ a character */
+extern void zzreplstr(zzchar_t *s);/* replace last recognized reg. expr. with
+ a string */
+extern void zzsave_dlg_state(struct zzdlg_state *);
+extern void zzrestore_dlg_state(struct zzdlg_state *);
+extern int zzerr_in(void);
+extern void zzerrstd(const char *);
+extern void zzerraction(void);
+
+#else
+
+extern void zzadvance();
+extern void zzskip(); /* erase zzlextext, look for antoher token */
+extern void zzmore(); /* keep zzlextext, look for another token */
+extern void zzmode(/*k*/); /* switch to automaton 'k' */
+extern void zzrdstream(); /* what stream to read from */
+extern void zzclose_stream();/* close the current input stream */
+extern void zzrdfunc(); /* what function to get char from */
+extern void zzrdstr();
+extern void zzgettok(); /* get next token */
+extern void zzreplchar(); /* replace last recognized reg. expr. with
+ a character */
+extern void zzreplstr(); /* replace last recognized reg. expr. with
+ a string */
+extern void zzsave_dlg_state();
+extern void zzrestore_dlg_state();
+extern int zzerr_in();
+extern void zzerrstd();
+extern void zzerraction();
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/err.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/err.h
new file mode 100644
index 000000000..435d48356
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/err.h
@@ -0,0 +1,1170 @@
+/*
+ * err.h
+ *
+ * Standard error handling mechanism
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * Has grown to hold all kinds of stuff (err.h is increasingly misnamed)
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef ERR_H
+#define ERR_H
+
+#include "pcctscfg.h"
+#include <stdlib.h>
+#include <assert.h>
+
+/* */
+/* 7-Apr-97 133MR1 */
+/* Proper choice of STDC and cplusplus pre-processor symbols (?) */
+/* */
+#include "pccts_string.h"
+
+#ifdef PCCTS_USE_STDARG
+#include "pccts_stdarg.h"
+#else
+#include <varargs.h>
+#endif
+
+#ifdef DUM
+/* Define usable bits per unsigned int word (used for set stuff) */
+#ifdef PC
+#define BSETWORDSIZE 16
+#define BSETLOGWORDSIZE 4
+#else
+#define BSETWORDSIZE 32
+#define BSETLOGWORDSIZE 5
+#endif
+#endif
+
+#define BSETWORDSIZE 8
+#define BSETLOGWORDSIZE 3 /* SetWordType is 8bits */
+
+#define BSETMODWORD(x) ((x) & (BSETWORDSIZE-1)) /* x % BSETWORDSIZE */
+#define BSETDIVWORD(x) ((x) >> BSETLOGWORDSIZE) /* x / BSETWORDSIZE */
+
+/* This is not put into the global pccts_parser structure because it is
+ * hidden and does not need to be saved during a "save state" operation
+ */
+/* maximum of 32 bits/unsigned int and must be 8 bits/byte */
+static SetWordType bitmask[] = {
+ 0x00000001, 0x00000002, 0x00000004, 0x00000008,
+ 0x00000010, 0x00000020, 0x00000040, 0x00000080
+};
+
+#ifdef zzTRACE_RULES
+int zzTraceOptionValueDefault=1;
+int zzTraceOptionValue=1;
+int zzTraceGuessOptionValue=1;
+char *zzTraceCurrentRuleName=NULL;
+int zzTraceDepth=0;
+#endif
+
+int zzGuessSeq=0; /* MR10 */
+int zzSyntaxErrCount=0; /* MR11 */
+int zzLexErrCount=0; /* MR11 */
+
+void
+#ifdef __USE_PROTOS
+zzresynch(SetWordType *wd,SetWordType mask)
+#else
+zzresynch(wd,mask)
+SetWordType *wd, mask;
+#endif
+{
+ static int consumed = 1;
+
+ /* if you enter here without having consumed a token from last resynch
+ * force a token consumption.
+ */
+ if ( !consumed ) {zzCONSUME; consumed=1; return;} /* MR10 */
+
+ /* if current token is in resynch set, we've got what we wanted */
+ if ( wd[LA(1)]&mask || LA(1) == zzEOF_TOKEN ) {consumed=0; return;}
+
+ /* scan until we find something in the resynch set */
+ while ( !(wd[LA(1)]&mask) && LA(1) != zzEOF_TOKEN ) {zzCONSUME;}
+ consumed=1;
+}
+
+/* */
+/* 7-Apr-97 133MR1 for C++ and MR7 for C */
+/* Change suggested by Eli Sternheim (eli@interhdl.com) */
+/* */
+
+void
+#ifdef __USE_PROTOS
+zzconsumeUntil(SetWordType *st)
+#else
+zzconsumeUntil(st)
+SetWordType *st;
+#endif
+{
+ int tmp; /* MR7 */
+ while ( !zzset_el( (tmp=LA(1)), st) && tmp!=1 /* Eof */) { /* MR7 */
+ zzCONSUME; } /* MR7 */
+}
+
+/* */
+/* 7-Apr-97 133MR1 for C++ and MR7 for C */
+/* Change suggested by Eli Sternheim (eli@interhdl.com) */
+/* */
+
+void
+#ifdef __USE_PROTOS
+zzconsumeUntilToken(int t)
+#else
+zzconsumeUntilToken(t)
+int t;
+#endif
+{
+ int tmp; /* MR7 */
+ while ( (tmp=LA(1)) !=t && tmp!=1 /* Eof */) { zzCONSUME; } /* MR7 */
+}
+
+/* input looks like:
+ * zzFAIL(k, e1, e2, ...,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText)
+ * where the zzMiss stuff is set here to the token that did not match
+ * (and which set wasn't it a member of).
+ */
+
+#ifdef PCCTS_USE_STDARG
+void zzFAIL(int k, ...)
+#else
+void zzFAIL(va_alist)
+va_dcl
+#endif
+{
+#ifdef LL_K
+ static char text[LL_K*ZZLEXBUFSIZE+1];
+ SetWordType *f[LL_K];
+#else
+ static char text[ZZLEXBUFSIZE+1];
+ SetWordType *f[1];
+#endif
+ SetWordType **miss_set;
+ char **miss_text;
+ int *bad_tok;
+ char **bad_text;
+ int *err_k;
+ int i;
+ va_list ap;
+#ifndef PCCTS_USE_STDARG /* MR20 */
+ int k;
+#endif
+#ifdef PCCTS_USE_STDARG /* MR20 */
+ va_start(ap, k);
+#else
+ va_start(ap);
+ k = va_arg(ap, int); /* how many lookahead sets? */
+#endif
+ assert(k <= sizeof(f)/sizeof(f[0])); /* MR20 G. Hobbelt */
+ text[0] = '\0';
+ for (i=1; i<=k; i++) /* collect all lookahead sets */
+ {
+ f[i-1] = va_arg(ap, SetWordType *);
+ }
+ for (i=1; i<=k; i++) /* look for offending token */
+ {
+ if ( i>1 ) strcat(text, " ");
+ strcat(text, LATEXT(i));
+ if ( !zzset_el((unsigned)LA(i), f[i-1]) ) break;
+ }
+ miss_set = va_arg(ap, SetWordType **);
+ miss_text = va_arg(ap, char **);
+ bad_tok = va_arg(ap, int *);
+ bad_text = va_arg(ap, char **);
+ err_k = va_arg(ap, int *);
+ if ( i>k )
+ {
+ /* bad; lookahead is permutation that cannot be matched,
+ * but, the ith token of lookahead is valid at the ith position
+ * (The old LL sub 1 (k) versus LL(k) parsing technique)
+ */
+ *miss_set = NULL;
+ *miss_text = zzlextext;
+ *bad_tok = LA(1);
+ *bad_text = LATEXT(1);
+ *err_k = k;
+ return;
+ }
+/* fprintf(stderr, "%s not in %dth set\n", zztokens[LA(i)], i);*/
+ *miss_set = f[i-1];
+ *miss_text = text;
+ *bad_tok = LA(i);
+ *bad_text = LATEXT(i);
+ if ( i==1 ) *err_k = 1;
+ else *err_k = k;
+}
+
+#ifdef __USE_PROTOS
+void zzTraceGuessDone(zzantlr_state *state)
+#else
+void zzTraceGuessDone(state)
+ zzantlr_state *state;
+#endif
+{
+#ifdef zzTRACE_RULES
+#ifdef ZZCAN_GUESS
+
+ int doIt=0;
+
+ if (zzTraceCurrentRuleName == NULL) return;
+
+ if (zzTraceOptionValue <= 0) {
+ doIt=0;
+ } else if (zzTraceGuessOptionValue <= 0) {
+ doIt=0;
+ } else {
+ doIt=1;
+ };
+
+ if (doIt) {
+ fprintf(stderr,"guess done - returning to rule %s {\"%s\"} at depth %d",
+ state->traceCurrentRuleName,
+ LATEXT(1),
+ state->traceDepth);
+ if (state->guessing != 0) {
+ fprintf(stderr," (guess mode continues - an enclosing guess is still active)");
+ } else {
+ fprintf(stderr," (guess mode ends)");
+ };
+ fprintf(stderr,"\n");
+ };
+#endif
+#endif
+}
+
+void
+#ifdef __USE_PROTOS
+zzsave_antlr_state(zzantlr_state *buf)
+#else
+zzsave_antlr_state(buf)
+zzantlr_state *buf;
+#endif
+{
+#ifdef LL_K
+ int i;
+#endif
+
+#ifdef ZZCAN_GUESS
+ buf->guess_start = zzguess_start;
+ buf->guessing = zzguessing;
+#endif
+ buf->asp = zzasp;
+#ifdef GENAST
+ buf->ast_sp = zzast_sp;
+#endif
+#ifdef ZZINF_LOOK
+ buf->inf_labase = zzinf_labase;
+ buf->inf_last = zzinf_last;
+
+/* MR6 Gunnar Rxnning (gunnar@candleweb.no) */
+/* MR6 Additional state needs to be saved/restored */
+
+ buf->inf_tokens = zzinf_tokens; /* MR6 */
+ buf->inf_text = zzinf_text; /* MR6 */
+ buf->inf_text_buffer = zzinf_text_buffer; /* MR6 */
+ buf->inf_line = zzinf_line; /* MR6 */
+
+#endif
+#ifdef DEMAND_LOOK
+ buf->dirty = zzdirty;
+#endif
+#ifdef LL_K
+ for (i=0; i<LL_K; i++) buf->tokenLA[i] = zztokenLA[i];
+ for (i=0; i<LL_K; i++) strcpy(buf->textLA[i], zztextLA[i]);
+ buf->lap = zzlap;
+ buf->labase = zzlabase;
+#else
+ buf->token = zztoken;
+ strcpy(buf->text, zzlextext);
+#endif
+#ifdef zzTRACE_RULES
+
+ /* MR10 */
+
+ buf->traceOptionValue=zzTraceOptionValue;
+ buf->traceGuessOptionValue=zzTraceGuessOptionValue;
+ buf->traceCurrentRuleName=zzTraceCurrentRuleName;
+ buf->traceDepth=zzTraceDepth;
+#endif
+}
+
+void
+#ifdef __USE_PROTOS
+zzrestore_antlr_state(zzantlr_state *buf)
+#else
+zzrestore_antlr_state(buf)
+zzantlr_state *buf;
+#endif
+{
+
+#ifdef zzTRACE_RULES
+ int prevTraceOptionValue;
+#endif
+
+#ifdef LL_K
+ int i;
+#endif
+
+#ifdef ZZCAN_GUESS
+ zzguess_start = buf->guess_start;
+ zzguessing = buf->guessing;
+#endif
+ zzasp = buf->asp;
+#ifdef GENAST
+ zzast_sp = buf->ast_sp;
+#endif
+#ifdef ZZINF_LOOK
+ zzinf_labase = buf->inf_labase;
+ zzinf_last = buf->inf_last;
+
+/* MR6 Gunnar Rxnning (gunnar@candleweb.no) */
+/* MR6 Additional state needs to be saved/restored */
+
+ zzinf_tokens = buf->inf_tokens; /* MR6 */
+ zzinf_text = buf->inf_text; /* MR6 */
+ zzinf_text_buffer = buf->inf_text_buffer; /* MR6 */
+ zzinf_line = buf->inf_line; /* MR6 */
+#endif
+#ifdef DEMAND_LOOK
+ zzdirty = buf->dirty;
+#endif
+#ifdef LL_K
+ for (i=0; i<LL_K; i++) zztokenLA[i] = buf->tokenLA[i];
+ for (i=0; i<LL_K; i++) strcpy(zztextLA[i], buf->textLA[i]);
+ zzlap = buf->lap;
+ zzlabase = buf->labase;
+#else
+ zztoken = buf->token;
+ strcpy(zzlextext, buf->text);
+#endif
+#ifdef zzTRACE_RULES
+
+ prevTraceOptionValue=zzTraceOptionValue;
+ zzTraceOptionValue=buf->traceOptionValue;
+ if ( (prevTraceOptionValue > 0) !=
+ (zzTraceOptionValue > 0)) {
+ if (zzTraceOptionValue > 0) {
+ fprintf(stderr,"trace enable restored in rule %s depth %d\n",
+ zzTraceCurrentRuleName,zzTraceDepth);
+ };
+ if (zzTraceOptionValue <= 0) {
+ fprintf(stderr,"trace disable restored in rule %s depth %d\n",
+ zzTraceCurrentRuleName,zzTraceDepth);
+ };
+ };
+
+ zzTraceOptionValue=buf->traceOptionValue; /* MR10 */
+ zzTraceGuessOptionValue=buf->traceGuessOptionValue; /* MR10 */
+ zzTraceCurrentRuleName=buf->traceCurrentRuleName; /* MR10 */
+ zzTraceDepth=buf->traceDepth; /* MR10 */
+ zzTraceGuessDone(buf); /* MR10 */
+#endif
+}
+
+void
+#ifdef __USE_PROTOS
+zzedecode(SetWordType *a)
+#else
+zzedecode(a)
+SetWordType *a;
+#endif
+{
+ register SetWordType *p = a;
+ register SetWordType *endp = &(p[zzSET_SIZE]);
+ register unsigned e = 0;
+
+ if ( zzset_deg(a)>1 ) fprintf(stderr, " {");
+ do {
+ register SetWordType t = *p;
+ register SetWordType *b = &(bitmask[0]);
+ do {
+ if ( t & *b ) fprintf(stderr, " %s", zztokens[e]);
+ e++;
+ } while (++b < &(bitmask[sizeof(SetWordType)*8]));
+ } while (++p < endp);
+ if ( zzset_deg(a)>1 ) fprintf(stderr, " }");
+}
+
+#ifndef USER_ZZSYN
+/* standard error reporting function */
+void
+#ifdef __USE_PROTOS
+zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok, int k, char *bad_text)
+#else
+zzsyn(text, tok, egroup, eset, etok, k, bad_text)
+char *text, *egroup, *bad_text;
+int tok;
+int etok;
+int k;
+SetWordType *eset;
+#endif
+{
+
+ zzSyntaxErrCount++; /* MR11 */
+ fprintf(stderr, "line %d: syntax error at \"%s\"", zzline, (tok==zzEOF_TOKEN)?"EOF":bad_text);
+ if ( !etok && !eset ) {fprintf(stderr, "\n"); return;}
+ if ( k==1 ) fprintf(stderr, " missing");
+ else
+ {
+ fprintf(stderr, "; \"%s\" not", bad_text);
+ if ( zzset_deg(eset)>1 ) fprintf(stderr, " in");
+ }
+ if ( zzset_deg(eset)>0 ) zzedecode(eset);
+ else fprintf(stderr, " %s", zztokens[etok]);
+ if ( strlen(egroup) > 0 ) fprintf(stderr, " in %s", egroup);
+ fprintf(stderr, "\n");
+}
+#endif
+
+/* is b an element of set p? */
+int
+#ifdef __USE_PROTOS
+zzset_el(unsigned b, SetWordType *p)
+#else
+zzset_el(b,p)
+unsigned b;
+SetWordType *p;
+#endif
+{
+ return( p[BSETDIVWORD(b)] & bitmask[BSETMODWORD(b)] );
+}
+
+int
+#ifdef __USE_PROTOS
+zzset_deg(SetWordType *a)
+#else
+zzset_deg(a)
+SetWordType *a;
+#endif
+{
+ /* Fast compute degree of a set... the number
+ of elements present in the set. Assumes
+ that all word bits are used in the set
+ */
+ register SetWordType *p = a;
+ register SetWordType *endp = &(a[zzSET_SIZE]);
+ register int degree = 0;
+
+ if ( a == NULL ) return 0;
+ while ( p < endp )
+ {
+ register SetWordType t = *p;
+ register SetWordType *b = &(bitmask[0]);
+ do {
+ if (t & *b) ++degree;
+ } while (++b < &(bitmask[sizeof(SetWordType)*8]));
+ p++;
+ }
+
+ return(degree);
+}
+
+#ifdef DEMAND_LOOK
+
+#ifdef LL_K
+int
+#ifdef __USE_PROTOS
+_zzmatch(int _t, char **zzBadText, char **zzMissText,
+ int *zzMissTok, int *zzBadTok,
+ SetWordType **zzMissSet)
+#else
+_zzmatch(_t, zzBadText, zzMissText, zzMissTok, zzBadTok, zzMissSet)
+int _t;
+char **zzBadText;
+char **zzMissText;
+int *zzMissTok, *zzBadTok;
+SetWordType **zzMissSet;
+#endif
+{
+ if ( zzdirty==LL_K ) {
+ zzCONSUME;
+ }
+ if ( LA(1)!=_t ) {
+ *zzBadText = *zzMissText=LATEXT(1);
+ *zzMissTok= _t; *zzBadTok=LA(1);
+ *zzMissSet=NULL;
+ return 0;
+ }
+ zzMakeAttr
+ zzdirty++;
+ zzlabase++;
+ return 1;
+}
+
+int
+#ifdef __USE_PROTOS
+_zzmatch_wsig(int _t)
+#else
+_zzmatch_wsig(_t)
+int _t;
+#endif
+{
+ if ( zzdirty==LL_K ) {
+ zzCONSUME;
+ }
+ if ( LA(1)!=_t ) {
+ return 0;
+ }
+ zzMakeAttr
+ zzdirty++;
+ zzlabase++;
+ return 1;
+}
+
+#else
+
+int
+#ifdef __USE_PROTOS
+_zzmatch(int _t, char **zzBadText, char **zzMissText,
+ int *zzMissTok, int *zzBadTok, SetWordType **zzMissSet)
+#else
+_zzmatch(_t, zzBadText, zzMissText, zzMissTok, zzBadTok, zzMissSet)
+int _t;
+char **zzBadText;
+char **zzMissText;
+int *zzMissTok, *zzBadTok;
+SetWordType **zzMissSet;
+#endif
+{
+ if ( zzdirty ) {zzCONSUME;}
+ if ( LA(1)!=_t ) {
+ *zzBadText = *zzMissText=LATEXT(1);
+ *zzMissTok= _t; *zzBadTok=LA(1);
+ *zzMissSet=NULL;
+ return 0;
+ }
+ zzdirty = 1;
+ zzMakeAttr
+ return 1;
+}
+
+int
+#ifdef __USE_PROTOS
+_zzmatch_wsig(int _t)
+#else
+_zzmatch_wsig(_t)
+int _t;
+#endif
+{
+ if ( zzdirty ) {zzCONSUME;}
+ if ( LA(1)!=_t ) {
+ return 0;
+ }
+ zzdirty = 1;
+ zzMakeAttr
+ return 1;
+}
+
+#endif /*LL_K*/
+
+#else
+
+int
+#ifdef __USE_PROTOS
+_zzmatch(int _t, char **zzBadText, char **zzMissText,
+ int *zzMissTok, int *zzBadTok,
+ SetWordType **zzMissSet)
+#else
+_zzmatch(_t, zzBadText, zzMissText, zzMissTok, zzBadTok, zzMissSet)
+int _t;
+char **zzBadText;
+char **zzMissText;
+int *zzMissTok, *zzBadTok;
+SetWordType **zzMissSet;
+#endif
+{
+ if ( LA(1)!=_t ) {
+ *zzBadText = *zzMissText=LATEXT(1);
+ *zzMissTok= _t; *zzBadTok=LA(1);
+ *zzMissSet=NULL;
+ return 0;
+ }
+ zzMakeAttr
+ return 1;
+}
+
+int
+#ifdef __USE_PROTOS
+_zzmatch_wsig(int _t)
+#else
+_zzmatch_wsig(_t)
+int _t;
+#endif
+{
+ if ( LA(1)!=_t ) return 0;
+ zzMakeAttr
+ return 1;
+}
+
+#endif /*DEMAND_LOOK*/
+
+#ifdef ZZINF_LOOK
+void
+#ifdef __USE_PROTOS
+_inf_zzgettok(void)
+#else
+_inf_zzgettok()
+#endif
+{
+ if ( zzinf_labase >= zzinf_last )
+ {NLA = zzEOF_TOKEN; strcpy(NLATEXT, "");}
+ else {
+ NLA = zzinf_tokens[zzinf_labase];
+ zzline = zzinf_line[zzinf_labase]; /* wrong in 1.21 */
+ strcpy(NLATEXT, zzinf_text[zzinf_labase]);
+ zzinf_labase++;
+ }
+}
+#endif
+
+#ifdef ZZINF_LOOK
+/* allocate default size text,token and line arrays;
+ * then, read all of the input reallocing the arrays as needed.
+ * Once the number of total tokens is known, the LATEXT(i) array (zzinf_text)
+ * is allocated and its pointers are set to the tokens in zzinf_text_buffer.
+ */
+void
+#ifdef __USE_PROTOS
+zzfill_inf_look(void)
+#else
+zzfill_inf_look()
+#endif
+{
+ int tok, line;
+ int zzinf_token_buffer_size = ZZINF_DEF_TOKEN_BUFFER_SIZE;
+ int zzinf_text_buffer_size = ZZINF_DEF_TEXT_BUFFER_SIZE;
+ int zzinf_text_buffer_index = 0;
+ int zzinf_lap = 0;
+
+ /* allocate text/token buffers */
+ zzinf_text_buffer = (char *) malloc(zzinf_text_buffer_size);
+ if ( zzinf_text_buffer == NULL )
+ {
+ fprintf(stderr, "cannot allocate lookahead text buffer (%d bytes)\n",
+ zzinf_text_buffer_size);
+ exit(PCCTS_EXIT_FAILURE);
+ }
+ zzinf_tokens = (int *) calloc(zzinf_token_buffer_size,sizeof(int));
+ if ( zzinf_tokens == NULL )
+ {
+ fprintf(stderr, "cannot allocate token buffer (%d tokens)\n",
+ zzinf_token_buffer_size);
+ exit(PCCTS_EXIT_FAILURE);
+ }
+ zzinf_line = (int *) calloc(zzinf_token_buffer_size,sizeof(int));
+ if ( zzinf_line == NULL )
+ {
+ fprintf(stderr, "cannot allocate line buffer (%d ints)\n",
+ zzinf_token_buffer_size);
+ exit(PCCTS_EXIT_FAILURE);
+ }
+
+ /* get tokens, copying text to text buffer */
+ zzinf_text_buffer_index = 0;
+ do {
+ zzgettok();
+ line = zzreal_line;
+ while ( zzinf_lap>=zzinf_token_buffer_size )
+ {
+ zzinf_token_buffer_size += ZZINF_BUFFER_TOKEN_CHUNK_SIZE;
+ zzinf_tokens = (int *) realloc(zzinf_tokens,
+ zzinf_token_buffer_size*sizeof(int));
+ if ( zzinf_tokens == NULL )
+ {
+ fprintf(stderr, "cannot allocate lookahead token buffer (%d tokens)\n",
+ zzinf_token_buffer_size);
+ exit(PCCTS_EXIT_FAILURE);
+ }
+ zzinf_line = (int *) realloc(zzinf_line,
+ zzinf_token_buffer_size*sizeof(int));
+ if ( zzinf_line == NULL )
+ {
+ fprintf(stderr, "cannot allocate lookahead line buffer (%d ints)\n",
+ zzinf_token_buffer_size);
+ exit(PCCTS_EXIT_FAILURE);
+ }
+
+ }
+ while ( (zzinf_text_buffer_index+strlen(NLATEXT)+1) >= zzinf_text_buffer_size )
+ {
+ zzinf_text_buffer_size += ZZINF_BUFFER_TEXT_CHUNK_SIZE;
+ zzinf_text_buffer = (char *) realloc(zzinf_text_buffer,
+ zzinf_text_buffer_size);
+ if ( zzinf_text_buffer == NULL )
+ {
+ fprintf(stderr, "cannot allocate lookahead text buffer (%d bytes)\n",
+ zzinf_text_buffer_size);
+ exit(PCCTS_EXIT_FAILURE);
+ }
+ }
+ /* record token and text and line of input symbol */
+ tok = zzinf_tokens[zzinf_lap] = NLA;
+ strcpy(&zzinf_text_buffer[zzinf_text_buffer_index], NLATEXT);
+ zzinf_text_buffer_index += strlen(NLATEXT)+1;
+ zzinf_line[zzinf_lap] = line;
+ zzinf_lap++;
+ } while (tok!=zzEOF_TOKEN);
+ zzinf_labase = 0;
+ zzinf_last = zzinf_lap-1;
+
+ /* allocate ptrs to text of ith token */
+ zzinf_text = (char **) calloc(zzinf_last+1,sizeof(char *));
+ if ( zzinf_text == NULL )
+ {
+ fprintf(stderr, "cannot allocate lookahead text buffer (%d)\n",
+ zzinf_text_buffer_size);
+ exit(PCCTS_EXIT_FAILURE);
+ }
+ zzinf_text_buffer_index = 0;
+ zzinf_lap = 0;
+ /* set ptrs so that zzinf_text[i] is the text of the ith token found on input */
+ while (zzinf_lap<=zzinf_last)
+ {
+ zzinf_text[zzinf_lap++] = &zzinf_text_buffer[zzinf_text_buffer_index];
+ zzinf_text_buffer_index += strlen(&zzinf_text_buffer[zzinf_text_buffer_index])+1;
+ }
+}
+#endif
+
+int
+#ifdef __USE_PROTOS
+_zzsetmatch(SetWordType *e, char **zzBadText, char **zzMissText,
+ int *zzMissTok, int *zzBadTok,
+ SetWordType **zzMissSet,
+ SetWordType *zzTokclassErrset /* MR23 */)
+#else
+_zzsetmatch(e, zzBadText, zzMissText, zzMissTok, zzBadTok, zzMissSet, zzTokclassErrset /* MR23 */)
+SetWordType *e;
+char **zzBadText;
+char **zzMissText;
+int *zzMissTok, *zzBadTok;
+SetWordType **zzMissSet;
+SetWordType *zzTokclassErrset;
+#endif
+{
+#ifdef DEMAND_LOOK
+#ifdef LL_K
+ if ( zzdirty==LL_K ) {zzCONSUME;}
+#else
+ if ( zzdirty ) {zzCONSUME;}
+#endif
+#endif
+ if ( !zzset_el((unsigned)LA(1), e) ) {
+ *zzBadText = LATEXT(1); *zzMissText=NULL;
+ *zzMissTok= 0; *zzBadTok=LA(1);
+ *zzMissSet=zzTokclassErrset; /* MR23 */
+ return 0;
+ }
+ zzMakeAttr /* MR14 Ger Hobbelt (hobbelt@axa.nl) */
+#ifdef DEMAND_LOOK
+#ifdef LL_K
+ zzdirty++;
+ zzlabase++; /* MR14 Ger Hobbelt (hobbelt@axa.nl) */
+#else
+ zzdirty = 1;
+#endif
+#endif
+ return 1;
+}
+
+int
+#ifdef __USE_PROTOS
+_zzmatch_wdfltsig(int tokenWanted, SetWordType *whatFollows)
+#else
+_zzmatch_wdfltsig(tokenWanted, whatFollows)
+int tokenWanted;
+SetWordType *whatFollows;
+#endif
+{
+#ifdef DEMAND_LOOK
+#ifdef LL_K
+ if ( zzdirty==LL_K ) {
+ zzCONSUME;
+ }
+#else
+ if ( zzdirty ) {zzCONSUME;}
+#endif
+#endif
+
+ if ( LA(1)!=tokenWanted )
+ {
+ zzSyntaxErrCount++; /* MR11 */
+ fprintf(stderr,
+ "line %d: syntax error at \"%s\" missing %s\n",
+ zzline,
+ (LA(1)==zzEOF_TOKEN)?"<eof>":(char *)LATEXT(1),
+ zztokens[tokenWanted]);
+ zzconsumeUntil( whatFollows );
+ return 0;
+ }
+ else {
+ zzMakeAttr
+#ifdef DEMAND_LOOK
+#ifdef LL_K
+ zzdirty++;
+ zzlabase++;
+#else
+ zzdirty = 1;
+#endif
+#else
+/* zzCONSUME; consume if not demand lookahead */
+#endif
+ return 1;
+ }
+}
+
+int
+#ifdef __USE_PROTOS
+_zzsetmatch_wdfltsig(SetWordType *tokensWanted,
+ int tokenTypeOfSet,
+ SetWordType *whatFollows)
+#else
+_zzsetmatch_wdfltsig(tokensWanted, tokenTypeOfSet, whatFollows)
+SetWordType *tokensWanted;
+int tokenTypeOfSet;
+SetWordType *whatFollows;
+#endif
+{
+#ifdef DEMAND_LOOK
+#ifdef LL_K
+ if ( zzdirty==LL_K ) {zzCONSUME;}
+#else
+ if ( zzdirty ) {zzCONSUME;}
+#endif
+#endif
+ if ( !zzset_el((unsigned)LA(1), tokensWanted) )
+ {
+ zzSyntaxErrCount++; /* MR11 */
+ fprintf(stderr,
+ "line %d: syntax error at \"%s\" missing %s\n",
+ zzline,
+ (LA(1)==zzEOF_TOKEN)?"<eof>":(char *)LATEXT(1),
+ zztokens[tokenTypeOfSet]);
+ zzconsumeUntil( whatFollows );
+ return 0;
+ }
+ else {
+ zzMakeAttr
+#ifdef DEMAND_LOOK
+#ifdef LL_K
+ zzdirty++;
+ zzlabase++;
+#else
+ zzdirty = 1;
+#endif
+#else
+/* zzCONSUME; consume if not demand lookahead */
+#endif
+ return 1;
+ }
+}
+
+int
+#ifdef __USE_PROTOS
+_zzsetmatch_wsig(SetWordType *e)
+#else
+_zzsetmatch_wsig(e)
+SetWordType *e;
+#endif
+{
+#ifdef DEMAND_LOOK
+#ifdef LL_K
+ if ( zzdirty==LL_K ) {zzCONSUME;}
+#else
+ if ( zzdirty ) {zzCONSUME;}
+#endif
+#endif
+ if ( !zzset_el((unsigned)LA(1), e) ) return 0;
+ zzMakeAttr /* MR14 Ger Hobbelt (hobbelt@axa.nl) */
+#ifdef DEMAND_LOOK
+#ifdef LL_K
+ zzdirty++;
+ zzlabase++; /* MR14 Ger Hobbelt (hobbelt@axa.nl) */
+#else
+ zzdirty = 1;
+#endif
+#endif
+ return 1;
+}
+
+#ifdef USER_ZZMODE_STACK
+static int zzmstk[ZZMAXSTK] = { -1 };
+static int zzmdep = 0;
+static char zzmbuf[70];
+
+void
+#ifdef __USE_PROTOS
+zzmpush( int m )
+#else
+zzmpush( m )
+int m;
+#endif
+{
+ if(zzmdep == ZZMAXSTK - 1) {
+ sprintf(zzmbuf, "Mode stack overflow ");
+ zzerr(zzmbuf);
+ } else {
+ zzmstk[zzmdep++] = zzauto;
+ zzmode(m);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+zzmpop( void )
+#else
+zzmpop( )
+#endif
+{
+ if(zzmdep == 0)
+ { sprintf(zzmbuf, "Mode stack underflow ");
+ zzerr(zzmbuf);
+ }
+ else
+ { zzmdep--;
+ zzmode(zzmstk[zzmdep]);
+ }
+}
+
+void
+#ifdef __USE_PROTOS
+zzsave_mode_stack( int modeStack[], int *modeLevel )
+#else
+zzsave_mode_stack( modeStack, modeLevel )
+int modeStack[];
+int *modeLevel;
+#endif
+{
+ int i;
+ memcpy(modeStack, zzmstk, sizeof(zzmstk));
+ *modeLevel = zzmdep;
+ zzmdep = 0;
+
+ return;
+}
+
+void
+#ifdef __USE_PROTOS
+zzrestore_mode_stack( int modeStack[], int *modeLevel )
+#else
+zzrestore_mode_stack( modeStack, modeLevel )
+int modeStack[];
+int *modeLevel;
+#endif
+{
+ int i;
+
+ memcpy(zzmstk, modeStack, sizeof(zzmstk));
+ zzmdep = *modeLevel;
+
+ return;
+}
+#endif /* USER_ZZMODE_STACK */
+
+#ifdef __USE_PROTOS
+void zzTraceReset(void)
+#else
+void zzTraceReset()
+#endif
+{
+#ifdef zzTRACE_RULES
+ zzTraceOptionValue=zzTraceOptionValueDefault;
+ zzTraceGuessOptionValue=1;
+ zzTraceCurrentRuleName=NULL;
+ zzTraceDepth=0;
+#endif
+}
+
+#ifdef __USE_PROTOS
+void zzTraceGuessFail(void)
+#else
+void zzTraceGuessFail()
+#endif
+{
+
+#ifdef zzTRACE_RULES
+#ifdef ZZCAN_GUESS
+
+ int doIt=0;
+
+ if (zzTraceOptionValue <= 0) {
+ doIt=0;
+ } else if (zzguessing && zzTraceGuessOptionValue <= 0) {
+ doIt=0;
+ } else {
+ doIt=1;
+ };
+
+ if (doIt) {
+ fprintf(stderr,"guess failed\n");
+ };
+#endif
+#endif
+}
+
+/* zzTraceOption:
+ zero value turns off trace
+*/
+
+#ifdef __USE_PROTOS
+void zzTraceIn(char * rule)
+#else
+void zzTraceIn(rule)
+ char *rule;
+#endif
+{
+#ifdef zzTRACE_RULES
+
+ int doIt=0;
+
+ zzTraceDepth++;
+ zzTraceCurrentRuleName=rule;
+
+ if (zzTraceOptionValue <= 0) {
+ doIt=0;
+#ifdef ZZCAN_GUESS
+ } else if (zzguessing && zzTraceGuessOptionValue <= 0) {
+ doIt=0;
+#endif
+ } else {
+ doIt=1;
+ };
+
+ if (doIt) {
+ fprintf(stderr,"enter rule %s {\"%s\"} depth %d",
+ rule,
+ LA(1)==1 ? "@" : (char *) LATEXT(1), /* MR19 */
+ zzTraceDepth);
+#ifdef ZZCAN_GUESS
+ if (zzguessing) fprintf(stderr," guessing");
+#endif
+ fprintf(stderr,"\n");
+ };
+#endif
+ return;
+}
+
+#ifdef __USE_PROTOS
+void zzTraceOut(char * rule)
+#else
+void zzTraceOut(rule)
+ char *rule;
+#endif
+{
+#ifdef zzTRACE_RULES
+ int doIt=0;
+
+ zzTraceDepth--;
+
+ if (zzTraceOptionValue <= 0) {
+ doIt=0;
+#ifdef ZZCAN_GUESS
+ } else if (zzguessing && zzTraceGuessOptionValue <= 0) {
+ doIt=0;
+#endif
+ } else {
+ doIt=1;
+ };
+
+ if (doIt) {
+ fprintf(stderr,"exit rule %s {\"%s\"} depth %d",
+ rule,
+ LA(1)==1 ? "@" : (char *) LATEXT(1), /* MR19 */
+ zzTraceDepth+1);
+#ifdef ZZCAN_GUESS
+ if (zzguessing) fprintf(stderr," guessing");
+#endif
+ fprintf(stderr,"\n");
+ };
+#endif
+}
+
+#ifdef __USE_PROTOS
+int zzTraceOption(int delta)
+#else
+int zzTraceOption(delta)
+ int delta;
+#endif
+{
+#ifdef zzTRACE_RULES
+ int prevValue=zzTraceOptionValue;
+
+ zzTraceOptionValue=zzTraceOptionValue+delta;
+
+ if (zzTraceCurrentRuleName != NULL) {
+ if (prevValue <= 0 && zzTraceOptionValue > 0) {
+ fprintf(stderr,"trace enabled in rule %s depth %d\n",
+ zzTraceCurrentRuleName,zzTraceDepth);
+ };
+ if (prevValue > 0 && zzTraceOptionValue <= 0) {
+ fprintf(stderr,"trace disabled in rule %s depth %d\n",
+ zzTraceCurrentRuleName,zzTraceDepth);
+ };
+ };
+ return prevValue;
+#else
+ return 0;
+#endif
+}
+
+#ifdef __USE_PROTOS
+int zzTraceGuessOption(int delta)
+#else
+int zzTraceGuessOption(delta)
+ int delta;
+#endif
+{
+#ifdef zzTRACE_RULES
+#ifdef ZZCAN_GUESS
+ int prevValue=zzTraceGuessOptionValue;
+
+ zzTraceGuessOptionValue=zzTraceGuessOptionValue+delta;
+
+ if (zzTraceCurrentRuleName != NULL) {
+ if (prevValue <= 0 && zzTraceGuessOptionValue > 0) {
+ fprintf(stderr,"guess trace enabled in rule %s depth %d\n",
+ zzTraceCurrentRuleName,zzTraceDepth);
+ };
+ if (prevValue > 0 && zzTraceGuessOptionValue <= 0) {
+ fprintf(stderr,"guess trace disabled in rule %s depth %d\n",
+ zzTraceCurrentRuleName,zzTraceDepth);
+ };
+ };
+ return prevValue;
+#else
+ return 0;
+#endif
+#else
+ return 0;
+#endif
+}
+
+#endif /* ERR_H */
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/int.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/int.h
new file mode 100644
index 000000000..cdcaa9242
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/int.h
@@ -0,0 +1,37 @@
+/* ANTLR attribute definition -- long integers
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * ANTLR 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+#ifndef ZZINT_H
+#define ZZINT_H
+
+typedef long Attrib;
+
+#define zzcr_attr(a,tok,t) *(a) = atol(t);
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_assert.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_assert.h
new file mode 100644
index 000000000..ff0dfb512
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_assert.h
@@ -0,0 +1,10 @@
+#ifndef __PCCTS_ASSERT_H__
+#define __PCCTS_ASSERT_H__
+
+#ifdef PCCTS_USE_NAMESPACE_STD
+#include <cassert>
+#else
+#include <assert.h>
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_iostream.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_iostream.h
new file mode 100644
index 000000000..972b32cbd
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_iostream.h
@@ -0,0 +1,10 @@
+#ifndef __PCCTS_IOSTREAM_H__
+#define __PCCTS_IOSTREAM_H__
+
+#ifdef PCCTS_USE_NAMESPACE_STD
+#include <iostream>
+#else
+#include <iostream.h>
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_istream.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_istream.h
new file mode 100644
index 000000000..e25cb8c48
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_istream.h
@@ -0,0 +1,10 @@
+#ifndef __PCCTS_ISTREAM_H__
+#define __PCCTS_ISTREAM_H__
+
+#ifdef PCCTS_USE_NAMESPACE_STD
+#include <istream>
+#else
+#include <istream.h>
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_setjmp.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_setjmp.h
new file mode 100644
index 000000000..9ea185ca7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_setjmp.h
@@ -0,0 +1,10 @@
+#ifndef __PCCTS_SETJMP_H__
+#define __PCCTS_SETJMP_H__
+
+#ifdef PCCTS_USE_NAMESPACE_STD
+#include <csetjmp>
+#else
+#include <setjmp.h>
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_stdarg.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_stdarg.h
new file mode 100644
index 000000000..e957430c3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_stdarg.h
@@ -0,0 +1,10 @@
+#ifndef __PCCTS_STDARG_H__
+#define __PCCTS_STDARG_H__
+
+#ifdef PCCTS_USE_NAMESPACE_STD
+#include <cstdarg>
+#else
+#include <stdarg.h>
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_stdio.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_stdio.h
new file mode 100644
index 000000000..ac34d1086
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_stdio.h
@@ -0,0 +1,10 @@
+#ifndef __PCCTS_STDIO_H__
+#define __PCCTS_STDIO_H__
+
+#ifdef PCCTS_USE_NAMESPACE_STD
+#include <cstdio>
+#else
+#include <stdio.h>
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_stdlib.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_stdlib.h
new file mode 100644
index 000000000..f0b344e8d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_stdlib.h
@@ -0,0 +1,10 @@
+#ifndef __PCCTS_STDLIB_H__
+#define __PCCTS_STDLIB_H__
+
+#ifdef PCCTS_USE_NAMESPACE_STD
+#include <cstdlib>
+#else
+#include <stdlib.h>
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_string.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_string.h
new file mode 100644
index 000000000..458a08a94
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pccts_string.h
@@ -0,0 +1,10 @@
+#ifndef __PCCTS_STRING_H__
+#define __PCCTS_STRING_H__
+
+#ifdef PCCTS_USE_NAMESPACE_STD
+#include <cstring>
+#else
+#include <string.h>
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pcctscfg.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pcctscfg.h
new file mode 100644
index 000000000..0c3c5ba6f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pcctscfg.h
@@ -0,0 +1,359 @@
+#ifndef PCCTS_CONFIG_H
+#define PCCTS_CONFIG_H
+/*
+ * pcctscfg.h (formerly config.h) (for ANTLR, DLG, and SORCERER)
+ *
+ * This is a simple configuration file that doesn't have config stuff
+ * in it, but it's a start.
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or
+ * company may do whatever they wish with source code distributed with
+ * PCCTS or the code generated by PCCTS, including the incorporation of
+ * PCCTS, or its output, into commerical software.
+ *
+ * We encourage users to develop software with PCCTS. However, we do ask
+ * that credit is given to us for developing PCCTS. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like PCCTS and have developed a nice tool with the
+ * output, please mention that you developed it using PCCTS. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * Used by PCCTS 1.33 (SORCERER 1.00B11 and up)
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1989-2000
+ */
+
+/* This file knows about the following ``environments''
+ UNIX (default)
+ DOS (use #define PC)
+ MAC (use #define MPW; has a few things for THINK C, Metrowerks)
+ MS/C++ (MR14 Microsoft Visual C++ environment uses symbol _MSC_VER)
+
+ */
+
+/* should test __STDC__ for 1, but some compilers don't set value, just def */
+
+#ifndef __USE_PROTOS
+#ifdef __STDC__
+#define __USE_PROTOS
+#endif
+#ifdef __cplusplus
+#define __USE_PROTOS
+#endif
+#endif
+
+#ifdef PCCTS_USE_NAMESPACE_STD
+#define PCCTS_NAMESPACE_STD namespace std {}; using namespace std;
+#else
+#define PCCTS_NAMESPACE_STD
+#endif
+
+#include "pccts_stdio.h"
+#include "pccts_stdlib.h"
+
+/* largest file name size */
+
+#ifdef _MAX_PATH
+#define MaxFileName _MAX_PATH /* MR9 RJV: MAX_PATH defined in stdlib.h (MSVC++ 5.0) */
+#else
+#define MaxFileName 300
+#endif
+
+/*
+* Define PC32 if in a 32-bit PC environment (e.g. extended DOS or Win32).
+* The macros tested here are defined by Watcom, Microsoft, Borland,
+* and djgpp, respectively, when they are used as 32-bit compilers.
+* Users of these compilers *must* be sure to define PC in their
+* makefiles for this to work correctly.
+*/
+#ifdef PC
+# if (defined(__WATCOMC__) || defined(_WIN32) || defined(__WIN32__) || \
+ defined(__GNUC__) || defined(__GNUG__))
+# ifndef PC32
+# define PC32
+# endif
+# endif
+#endif
+
+/* MR1 10-Apr-97 Default for PC is short file names */
+/* MR1 Default for non-PC is long file names */
+/* MR1 Can override via command line option LONGFILENAMES */
+
+#ifndef LONGFILENAMES
+#ifndef PC
+#define LONGFILENAMES
+#endif
+#endif
+
+#ifndef LONGFILENAMES
+#define ATOKEN_H "AToken.h"
+#define ATOKPTR_H "ATokPtr.h"
+#define ATOKPTR_IMPL_H "ATokPtrIm.h"
+#define ATOKENBUFFER_H "ATokBuf.h"
+#define ATOKENBUFFER_C "ATokBuf.cpp"
+#define ATOKENSTREAM_H "ATokStr.h"
+#define APARSER_H "AParser.h"
+#define APARSER_C "AParser.cpp"
+#define ASTBASE_H "ASTBase.h"
+#define ASTBASE_C "ASTBase.cpp"
+#define PCCTSAST_C "PCCTSAST.cpp"
+#define LIST_C "List.cpp"
+#define DLEXERBASE_H "DLexBase.h"
+#define DLEXERBASE_C "DLexBase.cpp"
+#define DLEXER_H "DLexer.h"
+#define STREESUPPORT_C "STreeSup.C"
+#else
+#define ATOKEN_H "AToken.h"
+#define ATOKPTR_H "ATokPtr.h"
+#define ATOKPTR_IMPL_H "ATokPtrImpl.h"
+#define ATOKENBUFFER_H "ATokenBuffer.h"
+#define ATOKENBUFFER_C "ATokenBuffer.cpp"
+#define ATOKENSTREAM_H "ATokenStream.h"
+#define APARSER_H "AParser.h"
+#define APARSER_C "AParser.cpp"
+#define ASTBASE_H "ASTBase.h"
+#define ASTBASE_C "ASTBase.cpp"
+#define PCCTSAST_C "PCCTSAST.cpp"
+#define LIST_C "List.cpp"
+#define DLEXERBASE_H "DLexerBase.h"
+#define DLEXERBASE_C "DLexerBase.cpp"
+#define DLEXER_H "DLexer.h"
+#define STREESUPPORT_C "STreeSupport.cpp"
+#endif
+
+/* SORCERER Stuff */
+
+/* MR8 6-Aug-97 Change from ifdef PC to ifndef LONGFILENAMES */
+
+#ifndef LONGFILENAMES
+#define STPARSER_H "STreePar.h"
+#define STPARSER_C "STreePar.C"
+#else
+#define STPARSER_H "STreeParser.h"
+#define STPARSER_C "STreeParser.cpp"
+#endif
+
+#ifdef MPW
+#define CPP_FILE_SUFFIX ".cp"
+#define CPP_FILE_SUFFIX_NO_DOT "cp"
+#define OBJ_FILE_SUFFIX ".o"
+#else
+#ifdef PC
+#define CPP_FILE_SUFFIX ".cpp"
+#define CPP_FILE_SUFFIX_NO_DOT "cpp"
+#define OBJ_FILE_SUFFIX ".obj"
+#else
+#ifdef __VMS
+#define CPP_FILE_SUFFIX ".cpp"
+#define CPP_FILE_SUFFIX_NO_DOT "cpp"
+#define OBJ_FILE_SUFFIX ".obj"
+#else
+#define CPP_FILE_SUFFIX ".cpp"
+#define CPP_FILE_SUFFIX_NO_DOT "cpp"
+#define OBJ_FILE_SUFFIX ".o"
+#endif
+#endif
+#endif
+
+/* User may redefine how line information looks */ /* make it #line MR7 */
+/* MR21 Use #ifndef */
+
+#ifndef LineInfoFormatStr
+#define LineInfoFormatStr "#line %d \"%s\"\n"
+#endif
+
+#ifdef MPW /* Macintosh Programmer's Workshop */
+#define ErrHdr "File \"%s\"; Line %d #"
+#else
+#ifdef _MSC_VER /* MR14 Microsoft Visual C++ environment */
+#define ErrHdr "%s(%d) :"
+#else
+#define ErrHdr "%s, line %d:" /* default */
+#endif
+#endif
+
+/* must assume old K&R cpp here, can't use #if defined(..)... */
+
+#ifdef MPW
+#define TopDirectory ":"
+#define DirectorySymbol ":"
+#define OutputDirectoryOption "Directory where all output files should go (default=\":\")"
+#else
+#ifdef PC
+#define TopDirectory "."
+#define DirectorySymbol "\\"
+#define OutputDirectoryOption "Directory where all output files should go (default=\".\")"
+#else
+#ifdef __VMS
+#define TopDirectory "[000000]"
+#define DirectorySymbol "]"
+#define OutputDirectoryOption "Directory where all output files should go (default=\"[]\")"
+#else
+#define TopDirectory "."
+#define DirectorySymbol "/"
+#define OutputDirectoryOption "Directory where all output files should go (default=\".\")"
+#endif
+#endif
+#endif
+
+#ifdef MPW
+
+/* Make sure we have prototypes for all functions under MPW */
+
+#include "pccts_string.h"
+#include "pccts_stdlib.h"
+
+/* MR6 2-Jun-97 Fixes false dependency caused by VC++ #include scanner */
+/* MR6 Reported by Brad Schick (schick@interaccess.com) */
+#define MPW_CursorCtl_Header <CursorCtl.h>
+#include MPW_CursorCtl_Header
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern void fsetfileinfo (const char *filename, unsigned long newcreator, unsigned long newtype);
+#ifdef __cplusplus
+}
+#endif
+
+/* File creators for various popular development environments */
+
+#define MAC_FILE_CREATOR 'MPS ' /* MPW Text files */
+#if 0
+#define MAC_FILE_CREATOR 'KAHL' /* THINK C/Symantec C++ Text files */
+#endif
+#if 0
+#define MAC_FILE_CREATOR 'CWIE' /* Metrowerks C/C++ Text files */
+#endif
+
+#endif
+
+#ifdef MPW
+#define DAWDLE SpinCursor(1)
+#else
+#define DAWDLE
+#endif
+
+#ifdef MPW
+#define SPECIAL_INITS
+#define SPECIAL_FOPEN
+#endif
+
+#ifdef MPW
+#ifdef __cplusplus
+inline
+#else
+static
+#endif
+void special_inits()
+{
+ InitCursorCtl((acurHandle) 0);
+}
+#endif
+
+#ifdef MPW
+#ifdef __cplusplus
+inline
+#else
+static
+#endif
+void special_fopen_actions(char * s)
+{
+ fsetfileinfo (s, MAC_FILE_CREATOR, 'TEXT');
+}
+#endif
+
+/* Define usable bits for set.c stuff */
+#define BytesPerWord sizeof(unsigned)
+#define WORDSIZE (sizeof(unsigned)*8)
+#define LogWordSize (WORDSIZE==16?4:5)
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#if defined(VAXC) || defined(__VMS)
+#include <ssdef.h>
+#define PCCTS_EXIT_SUCCESS 1
+#define PCCTS_EXIT_FAILURE SS$_ABORT
+#define zzDIE return SS$_ABORT;
+#define zzDONE return 1;
+
+#else /* !VAXC and !__VMS */
+
+#define PCCTS_EXIT_SUCCESS 0
+#define PCCTS_EXIT_FAILURE 1
+#define zzDIE return 1;
+#define zzDONE return 0;
+
+#endif
+
+#ifdef USER_ZZMODE_STACK
+# ifndef ZZSTACK_MAX_MODE
+# define ZZSTACK_MAX_MODE 32
+# endif
+# define ZZMAXSTK (ZZSTACK_MAX_MODE * 2)
+#endif
+
+#ifndef DllExportPCCTS
+#define DllExportPCCTS
+#endif
+
+#ifdef PC
+#ifndef PCCTS_CASE_INSENSITIVE_FILE_NAME
+#define PCCTS_CASE_INSENSITIVE_FILE_NAME
+#endif
+#endif
+
+#ifdef PC32
+#ifndef PCCTS_CASE_INSENSITIVE_FILE_NAME
+#define PCCTS_CASE_INSENSITIVE_FILE_NAME
+#endif
+#endif
+
+#ifdef __VMS
+#ifndef PCCTS_CASE_INSENSITIVE_FILE_NAME
+#define PCCTS_CASE_INSENSITIVE_FILE_NAME
+#endif
+#endif
+
+#ifdef __USE_PROTOS
+#ifndef PCCTS_USE_STDARG
+#define PCCTS_USE_STDARG
+#endif
+#endif
+
+#ifdef __STDC__
+#ifndef PCCTS_USE_STDARG
+#define PCCTS_USE_STDARG
+#endif
+#endif
+
+#ifdef __cplusplus
+#ifndef PCCTS_USE_STDARG
+#define PCCTS_USE_STDARG
+#endif
+#endif
+
+#ifdef _MSC_VER
+/*Turn off the warnings for:
+ unreferenced inline/local function has been removed
+*/
+#pragma warning(disable : 4514)
+/* function not expanded */
+#pragma warning(disable : 4710)
+#endif
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pcnames.bat b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pcnames.bat
new file mode 100644
index 000000000..8784aee9a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/pcnames.bat
@@ -0,0 +1,11 @@
+ren aparser.c aparser.cpp
+ren astbase.c astbase.cpp
+ren atokenbu.c atokbuf.cpp
+ren atokenbu.h atokbuf.h
+ren atokenst.h atokstr.h
+ren dlexerba.c dlexbase.cpp
+ren dlexerba.h dlexbase.h
+ren dlexer.c dlexer.cpp
+ren list.c list.cpp
+ren pblackbo.h pblckbox.h
+ren pcctsast.c pcctsast.cpp
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/slist.cpp b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/slist.cpp
new file mode 100644
index 000000000..faf2fe496
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/h/slist.cpp
@@ -0,0 +1,116 @@
+/*
+ * SList.C
+ *
+ * SOFTWARE RIGHTS
+ *
+ * We reserve no LEGAL rights to SORCERER -- SORCERER is in the public
+ * domain. An individual or company may do whatever they wish with
+ * source code distributed with SORCERER or the code generated by
+ * SORCERER, including the incorporation of SORCERER, or its output, into
+ * commerical software.
+ *
+ * We encourage users to develop software with SORCERER. However, we do
+ * ask that credit is given to us for developing SORCERER. By "credit",
+ * we mean that if you incorporate our source code into one of your
+ * programs (commercial product, research project, or otherwise) that you
+ * acknowledge this fact somewhere in the documentation, research report,
+ * etc... If you like SORCERER and have developed a nice tool with the
+ * output, please mention that you developed it using SORCERER. In
+ * addition, we ask that this header remain intact in our source code.
+ * As long as these guidelines are kept, we expect to continue enhancing
+ * this system and expect to make other tools available as they are
+ * completed.
+ *
+ * PCCTS 1.33
+ * Terence Parr
+ * Parr Research Corporation
+ * with Purdue University and AHPCRC, University of Minnesota
+ * 1992-2000
+ */
+
+#define ANTLR_SUPPORT_CODE
+
+#include "SList.h"
+#include "pccts_stdarg.h" // MR23
+
+/* Iterate over a list of elements; returns ptr to a new element
+ * in list upon every call and NULL when no more are left.
+ * Very useful like this:
+ *
+ * cursor = mylist;
+ * while ( (p=mylist->iterate(&cursor)) ) {
+ * // place with element p
+ * }
+ *
+ * The cursor must be initialized to point to the list to iterate over.
+ */
+void *SList::
+iterate(SListNode **cursor)
+{
+ void *e;
+
+ if ( cursor == NULL || *cursor==NULL ) return NULL;
+ if ( head == *cursor ) { *cursor = (*cursor)->next(); }
+ e = (*cursor)->elem();
+ (*cursor) = (*cursor)->next();
+ return e;
+}
+
+/* add an element to end of list. */
+void SList::
+add(void *e)
+{
+ SListNode *p, *tail=NULL;
+ require(e!=NULL, "slist_add: attempting to add NULL list element");
+
+ p = new SListNode;
+ require(p!=NULL, "add: cannot alloc new list node");
+ p->setElem(e);
+ if ( head == NULL )
+ {
+ head = tail = p;
+ }
+ else /* find end of list */
+ {
+ tail->setNext(p);
+ tail = p;
+ }
+}
+
+void SList::
+lfree()
+{
+ SListNode *p,*q;
+
+ if ( head==NULL ) return; /* empty list */
+ for (p = head; p!=NULL; p=q)
+ {
+ q = p->next();
+ free(p);
+ }
+}
+
+PCCTS_AST *SList::
+to_ast(SList list)
+{
+ PCCTS_AST *t=NULL, *last=NULL;
+ SListNode *p;
+
+ for (p = head; p!=NULL; p=p->next())
+ {
+ PCCTS_AST *u = (PCCTS_AST *)p->elem();
+ if ( last==NULL ) last = t = u;
+ else { last->setRight(u); last = u; }
+ }
+ return t;
+}
+
+// MR23
+int SList::printMessage(FILE* pFile, const char* pFormat, ...)
+{
+ va_list marker;
+ va_start( marker, pFormat );
+ int iRet = vfprintf(pFile, pFormat, marker);
+ va_end( marker );
+ return iRet;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/history.ps b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/history.ps
new file mode 100644
index 000000000..e2600d512
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/history.ps
@@ -0,0 +1,473 @@
+%!PS-Adobe-3.0
+%%Creator: groff version 1.06
+%%DocumentNeededResources: font Times-Roman
+%%+ font Times-Italic
+%%+ font Courier
+%%DocumentSuppliedResources: procset grops 1.06 0
+%%Pages: 3
+%%PageOrder: Ascend
+%%Orientation: Portrait
+%%EndComments
+%%BeginProlog
+%%BeginResource: procset grops 1.06 0
+
+/setpacking where {
+ pop
+ currentpacking
+ true setpacking
+} if
+
+/grops 120 dict dup begin
+
+% The ASCII code of the space character.
+/SC 32 def
+
+/A /show load def
+/B { 0 SC 3 -1 roll widthshow } bind def
+/C { 0 exch ashow } bind def
+/D { 0 exch 0 SC 5 2 roll awidthshow } bind def
+/E { 0 rmoveto show } bind def
+/F { 0 rmoveto 0 SC 3 -1 roll widthshow } bind def
+/G { 0 rmoveto 0 exch ashow } bind def
+/H { 0 rmoveto 0 exch 0 SC 5 2 roll awidthshow } bind def
+/I { 0 exch rmoveto show } bind def
+/J { 0 exch rmoveto 0 SC 3 -1 roll widthshow } bind def
+/K { 0 exch rmoveto 0 exch ashow } bind def
+/L { 0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow } bind def
+/M { rmoveto show } bind def
+/N { rmoveto 0 SC 3 -1 roll widthshow } bind def
+/O { rmoveto 0 exch ashow } bind def
+/P { rmoveto 0 exch 0 SC 5 2 roll awidthshow } bind def
+/Q { moveto show } bind def
+/R { moveto 0 SC 3 -1 roll widthshow } bind def
+/S { moveto 0 exch ashow } bind def
+/T { moveto 0 exch 0 SC 5 2 roll awidthshow } bind def
+
+% name size font SF -
+
+/SF {
+ findfont exch
+ [ exch dup 0 exch 0 exch neg 0 0 ] makefont
+ dup setfont
+ [ exch /setfont cvx ] cvx bind def
+} bind def
+
+% name a c d font MF -
+
+/MF {
+ findfont
+ [ 5 2 roll
+ 0 3 1 roll % b
+ neg 0 0 ] makefont
+ dup setfont
+ [ exch /setfont cvx ] cvx bind def
+} bind def
+
+/level0 0 def
+/RES 0 def
+/PL 0 def
+/LS 0 def
+
+% Guess the page length.
+% This assumes that the imageable area is vertically centered on the page.
+% PLG - length
+
+/PLG {
+ gsave newpath clippath pathbbox grestore
+ exch pop add exch pop
+} bind def
+
+% BP -
+
+/BP {
+ /level0 save def
+ 1 setlinecap
+ 1 setlinejoin
+ 72 RES div dup scale
+ LS {
+ 90 rotate
+ } {
+ 0 PL translate
+ } ifelse
+ 1 -1 scale
+} bind def
+
+/EP {
+ level0 restore
+ showpage
+} bind def
+
+
+% centerx centery radius startangle endangle DA -
+
+/DA {
+ newpath arcn stroke
+} bind def
+
+% x y SN - x' y'
+% round a position to nearest (pixel + (.25,.25))
+
+/SN {
+ transform
+ .25 sub exch .25 sub exch
+ round .25 add exch round .25 add exch
+ itransform
+} bind def
+
+% endx endy startx starty DL -
+% we round the endpoints of the line, so that parallel horizontal
+% and vertical lines will appear even
+
+/DL {
+ SN
+ moveto
+ SN
+ lineto stroke
+} bind def
+
+% centerx centery radius DC -
+
+/DC {
+ newpath 0 360 arc closepath
+} bind def
+
+
+/TM matrix def
+
+% width height centerx centery DE -
+
+/DE {
+ TM currentmatrix pop
+ translate scale newpath 0 0 .5 0 360 arc closepath
+ TM setmatrix
+} bind def
+
+% these are for splines
+
+/RC /rcurveto load def
+/RL /rlineto load def
+/ST /stroke load def
+/MT /moveto load def
+/CL /closepath load def
+
+% fill the last path
+
+% amount FL -
+
+/FL {
+ currentgray exch setgray fill setgray
+} bind def
+
+% fill with the ``current color''
+
+/BL /fill load def
+
+/LW /setlinewidth load def
+% new_font_name encoding_vector old_font_name RE -
+
+/RE {
+ findfont
+ dup maxlength dict begin
+ {
+ 1 index /FID ne { def } { pop pop } ifelse
+ } forall
+ /Encoding exch def
+ dup /FontName exch def
+ currentdict end definefont pop
+} bind def
+
+/DEFS 0 def
+
+% hpos vpos EBEGIN -
+
+/EBEGIN {
+ moveto
+ DEFS begin
+} bind def
+
+/EEND /end load def
+
+/CNT 0 def
+/level1 0 def
+
+% llx lly newwid wid newht ht newllx newlly PBEGIN -
+
+/PBEGIN {
+ /level1 save def
+ translate
+ div 3 1 roll div exch scale
+ neg exch neg exch translate
+ % set the graphics state to default values
+ 0 setgray
+ 0 setlinecap
+ 1 setlinewidth
+ 0 setlinejoin
+ 10 setmiterlimit
+ [] 0 setdash
+ /setstrokeadjust where {
+ pop
+ false setstrokeadjust
+ } if
+ /setoverprint where {
+ pop
+ false setoverprint
+ } if
+ newpath
+ /CNT countdictstack def
+ userdict begin
+ /showpage {} def
+} bind def
+
+/PEND {
+ clear
+ countdictstack CNT sub { end } repeat
+ level1 restore
+} bind def
+
+end def
+
+/setpacking where {
+ pop
+ setpacking
+} if
+%%EndResource
+%%IncludeResource: font Times-Roman
+%%IncludeResource: font Times-Italic
+%%IncludeResource: font Courier
+grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL
+792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron/scaron/zcaron
+/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/space
+/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright/parenleft
+/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four
+/five/six/seven/eight/nine/colon/semicolon/less/equal/greater/question/at/A/B/C
+/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash
+/bracketright/circumflex/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q
+/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase
+/guillemotleft/guillemotright/bullet/florin/fraction/perthousand/dagger
+/daggerdbl/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
+/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
+/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar
+/section/dieresis/copyright/ordfeminine/guilsinglleft/logicalnot/minus
+/registered/macron/degree/plusminus/twosuperior/threesuperior/acute/mu
+/paragraph/periodcentered/cedilla/onesuperior/ordmasculine/guilsinglright
+/onequarter/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde
+/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute
+/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
+/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls
+/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute
+/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve
+/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex
+/udieresis/yacute/thorn/ydieresis]def/Courier@0 ENC0/Courier RE/Times-Italic@0
+ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE
+%%EndProlog
+%%Page: 1 1
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 13/Times-Roman@0 SF(The History of PCCTS)228.232 84 Q/F1 11/Times-Roman@0
+SF(The Purdue Compiler)190.468 108 Q(-Construction T)-.22 E(ool Set)-.88 E/F2
+10/Times-Italic@0 SF -.92(Te)262.245 144 S -.37(re).92 G(nce P).37 E(arr)-.8 E
+/F3 10/Times-Roman@0 SF -.15(Pa)234.755 156 S(rr Research Corporation).15 E
+(Minneapolis, Minnesota)239.39 168 Q(and)280.78 180 Q(Uni)239.315 192 Q -.15
+(ve)-.25 G(rsity of Minnesota).15 E
+(Army High Performance Computing Research Center)180.38 204 Q F2
+([Updated 8-7-94])252.31 228 Q F1 .084(The PCCTS project be)97 259.6 R -.055
+(ga)-.165 G 2.834(na).055 G 2.833(sap)220.547 259.6 S(arser)240.876 259.6 Q
+.083(-generator project for a graduate course at Purdue Uni-)-.22 F -.165(ve)72
+275.6 S 1.085(rsity in the F).165 F 1.086
+(all of 1988 taught by Hank Dietz\212 translator)-.165 F 1.086
+(-writing systems.)-.22 F 1.086(Under the guid-)6.586 F .627
+(ance of Professor Dietz, the parser generator)72 291.6 R 3.377(,A)-.44 G .626
+(NTLR \(originally called YUCC\), continued after)285.18 291.6 R .253
+(the termination of the course and e)72 307.6 R -.165(ve)-.275 G .254
+(ntually became the subject of T).165 F .254(erence P)-.77 F(arr')-.165 E 3.004
+(sM)-.605 G(aster')445.083 307.6 Q 3.004(st)-.605 G(hesis.)479.25 307.6 Q
+(Originally)72 323.6 Q 4.092(,l)-.715 G -.165(ex)126.406 323.6 S 1.342
+(ical analysis w).165 F 1.342(as performed via ALX which w)-.11 F 1.342
+(as soon replaced by W)-.11 F 1.341(ill Cohen')-.44 F(s)-.605 E .594
+(DLG in the F)72 339.6 R .594(all of 1989 \(DF)-.165 F .595(A-based le)-.814 F
+.595(xical-analyzer generator)-.165 F 3.345(,a)-.44 G .595(lso an of)367.188
+339.6 R .595(fshoot of the graduate)-.275 F(translation course\).)72 355.6 Q
+.877(The alpha v)97 375.2 R .877(ersion of ANTLR w)-.165 F .877(as totally re)
+-.11 F .876(written resulting in 1.00B.)-.275 F -1.221(Ve)6.376 G .876
+(rsion 1.00B w)1.221 F(as)-.11 E 1.577(released via an internet ne)72 391.2 R
+1.577(wsgroup \(comp.compilers\) posting in February of 1990 and quickly)-.275
+F -.055(ga)72 407.2 S .356(thered a lar).055 F .356(ge follo)-.198 F 3.106
+(wing. 1.00B)-.275 F .356(generated only LL\(1\) parsers, b)3.106 F .356
+(ut allo)-.22 F .356(wed the mer)-.275 F .356(ged descrip-)-.198 F 1.859
+(tion of le)72 423.2 R 1.859(xical and syntactic analysis.)-.165 F 1.86
+(It had rudimentary attrib)7.359 F 1.86(ute handling similar to that of)-.22 F
+-.55 -1.32(YA C)72 439.2 T 3.549(Ca)1.32 G .799
+(nd did not incorporate rule parameters or return v)109.231 439.2 R .798
+(alues; do)-.275 F(wnw)-.275 E .798(ard inheritance w)-.11 F .798(as v)-.11 F
+(ery)-.165 E -.165(aw)72 455.2 S(kw).165 E 6.433(ard. 1.00B-generated)-.11 F
+3.684(parsers terminated upon the \214rst syntax error)6.433 F 9.184(.L)-.605 G
+-.165(ex)440.916 455.2 S 3.684(ical classes).165 F(\(modes\) were not allo)72
+471.2 Q(wed and DLG did not ha)-.275 E .33 -.165(ve a)-.22 H 2.75(ni).165 G
+(nteracti)305.959 471.2 Q .33 -.165(ve m)-.275 H(ode.).165 E .831
+(Upon starting his Ph.D. at Purdue in the F)97 490.8 R .83(all of 1990, T)-.165
+F .83(erence P)-.77 F .83(arr be)-.165 F -.055(ga)-.165 G 3.58(nt).055 G .83
+(he second total)436.351 490.8 R(re)72 506.8 Q 1.646(write of ANTLR.)-.275 F
+1.646(The method by which grammars may be practically analyzed to generate)
+7.146 F/F4 11/Times-Italic@0 SF(LL)72.638 522.8 Q F1(\().583 E F4(k).396 E F1
+3.849(\)l).737 G 1.099(ookahead information w)105.703 522.8 R 1.099(as disco)
+-.11 F -.165(ve)-.165 G 1.099(red in August of 1990 just before his return.)
+.165 F -1.221(Ve)6.598 G(rsion)1.221 E .626
+(1.00 incorporated this algorithm and included the AST mechanism, le)72 538.8 R
+.626(xical classes, error classes,)-.165 F .354(and automatic error reco)72
+554.8 R -.165(ve)-.165 G .353(ry; code quality and portability were higher).165
+F 5.853(.I)-.605 G 3.103(nF)395.965 554.8 S .353(ebruary of 1992 1.00)410.684
+554.8 R -.11(wa)72 570.8 S 2.76(sr).11 G .01
+(eleased via an article in SIGPLAN Notices.)95.418 570.8 R .01
+(Peter Dahl, Ph.D. candidate, and Professor Matt)5.51 F(O'K)72 586.8 Q 2.074
+(eefe \(both at the Uni)-.275 F -.165(ve)-.275 G 2.073
+(rsity of Minnesota\) tested this v).165 F 2.073(ersion e)-.165 F(xtensi)-.165
+E -.165(ve)-.275 G(ly).165 E 7.573(.D)-.715 G 2.073(ana Hogg)448.522 586.8 R
+(att)-.055 E .078(\(Micro Data Base Systems, Inc.\) came up with the idea of e\
+rror grouping \(strings attached to non-)72 602.8 R
+(terminals\) and tested 1.00 hea)72 618.8 Q(vily)-.22 E(.)-.715 E -1.221(Ve)97
+638.4 S .878(rsion 1.06 w)1.221 F .877
+(as released in December 1992 and represented a lar)-.11 F .877
+(ge feature enhancement)-.198 F -.165(ove)72 654.4 S 3.648(r1).165 G 3.648
+(.00. F)100.365 654.4 R .898(or e)-.165 F .899
+(xample, rudimentary semantic predicates were introduced, error messages were)
+-.165 F 2.281(signi\214cantly impro)72 670.4 R -.165(ve)-.165 G 5.031(df).165 G
+(or)181.953 670.4 Q F4(k)5.427 E F1 2.281
+(>1 lookahead and ANTLR parsers could indicate that lookahead).737 F 1.381
+(fetches were to occur only when necessary for the parse \(normally)72 686.4 R
+4.131(,t)-.715 G 1.381(he lookahead `)387.051 686.4 R(`pipe')-.814 E 4.132('w)
+-.814 G(as)494.837 686.4 Q 1.182(constantly full\).)72 702.4 R 1.182
+(Russell Quong joined the project in the Spring of 1992 to aid in the semantic)
+6.682 F .681(predicate design.)72 718.4 R(Be)6.181 E .681(ginning and adv)-.165
+F .682(anced tutorials were created and released as well.)-.275 F 3.432(Am)
+6.182 G(ak)485.179 718.4 Q(e-)-.11 E .993(\214le generator w)72 734.4 R .993
+(as included that sets up dependencies and such correctly for ANTLR and DLG.)
+-.11 F EP
+%%Page: 2 2
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 11/Times-Roman@0 SF 2.75(-2-)278.837 52 S -1.221(Ve)72 88 S 1.414(ry fe)
+1.221 F 4.164(w1)-.275 G 1.414(.00 incompatibilities were introduced \(1.00 w)
+122.81 88 R 1.415(as quite dif)-.11 F 1.415(ferent from 1.00B in some)-.275 F
+(areas\).)72 104 Q 1.089(1.10 w)97 123.6 R 1.088
+(as released on August 31, 1993 and incorporated b)-.11 F 1.088(ug \214x)-.22 F
+1.088(es, a fe)-.165 F 3.838(wf)-.275 G 1.088(eature enhance-)433.59 123.6 R
+3.112(ments and a major ne)72 139.6 R 5.863(wc)-.275 G(apability \212)196.957
+139.6 Q 3.113(an arbitrary lookahead operator \(syntactic predicate\),)5.863 F
+/F1 11/Courier@0 SF(\(alpha\)?beta)72 155.6 Q F0 6.754(.T)C 1.254
+(his feature w)167.425 155.6 R 1.254
+(as co-designed with Professor Russell Quong also at Purdue.)-.11 F 3.297 -.88
+(To s)72 171.6 T 1.537
+(upport in\214nite lookahead, a preprocessor \215ag, ZZINF_LOOK, w).88 F 1.537
+(as created that forced the)-.11 F .21(ANTLR\(\) macro to tok)72 187.6 R .21
+(enize all input prior to parsing.)-.11 F .209(Hence, at an)5.709 F 2.959(ym)
+-.165 G .209(oment, an action or predi-)389.215 187.6 R .936
+(cate can see the entire input sentence.)72 203.6 R .936
+(The predicate mechanism of 1.06 w)6.436 F .937(as e)-.11 F .937
+(xtended to allo)-.165 F(w)-.275 E .55
+(multiple predicates to be hoisted; the syntactic conte)72 219.6 R .55
+(xt of a predicate w)-.165 F .55(as also mo)-.11 F -.165(ve)-.165 G 3.299(da)
+.165 G .549(long with)461.585 219.6 R(the predicate.)72 235.6 Q .754
+(In February of 1994, SORCERER \(a simple tree-parser generator\) w)97 255.2 R
+.755(as released.)-.11 F .755(This tool)6.255 F(allo)72 271.2 Q .6(ws the user\
+ to parse child-sibling trees by specifying a grammar rather than b)-.275 F
+.599(uilding a recur)-.22 F(-)-.22 E(si)72 287.2 Q -.165(ve)-.275 G 1.39
+(-descent tree w).165 F(alk)-.11 E 1.391(er by hand.)-.11 F -.88(Wo)6.891 G
+1.391(rk to).88 F -.11(wa)-.275 G 1.391
+(rds a library of tree transformations is underw).11 F(ay)-.11 E(.)-.715 E .581
+(Aaron Sa)72 303.2 R(wde)-.165 E 3.331(ya)-.165 G 3.331(tT)145.531 303.2 S .581
+(he Uni)158.641 303.2 R -.165(ve)-.275 G .58
+(rsity of Minnesota became a second author of SORCERER after the).165 F
+(initial release.)72 319.2 Q .627(On April 1, 1994, PCCTS 1.20 w)97 338.8 R
+.627(as released.)-.11 F .627(This w)6.127 F .627(as the \214rst v)-.11 F .627
+(ersion to acti)-.165 F -.165(ve)-.275 G .627(ly support).165 F 1.664
+(C++ output.)72 354.8 R 1.664(It also included important \214x)7.164 F 1.663
+(es re)-.165 F -.055(ga)-.165 G 1.663
+(rding semantic predicates and \(..\)+ subrules.).055 F(This v)72 370.8 Q
+(ersion also introduced tok)-.165 E(en classes, the `)-.11 E(`)-.814 E/F2 11
+/Times-Italic@0 SF(not)A F0 1.628 -.814('' o)D(perator).814 E 2.75(,a)-.44 G
+(nd tok)355.294 370.8 Q(en ranges.)-.11 E .764
+(On June 19, 1994, SORCERER 1.00B9 w)97 390.4 R .765(as released.)-.11 F .765
+(Gary Funck of Intrepid T)6.265 F(echnology)-.77 E .807
+(joined the SORCERER team and pro)72 406.4 R .807(vided v)-.165 F .807(ery v)
+-.165 F .807(aluable suggestions re)-.275 F -.055(ga)-.165 G .806(rding the `)
+.055 F(`transform')-.814 E(')-.814 E(mode of SORCERER.)72 422.4 Q 1.137
+(On August 8, 1994, PCCTS 1.21 w)97 442 R 1.137(as released.)-.11 F 1.138
+(It mainly cleaned up the C++ output and)6.637 F(included a number of b)72 458
+Q(ug \214x)-.22 E(es.)-.165 E .316(From the 1.21 release forw)97 477.6 R .316
+(ard, the maintenance and support of all PCCTS tools will be pri-)-.11 F 1.557
+(marily pro)72 493.6 R 1.557(vided by P)-.165 F 1.557
+(arr Research Corporation, Minneapolis MN---an or)-.165 F -.055(ga)-.198 G
+1.558(nization founded on).055 F 1.616(the principles of e)72 509.6 R 1.616
+(xcellence in research and inte)-.165 F 1.616(grity in b)-.165 F 1.616
+(usiness; we are de)-.22 F -.22(vo)-.275 G 1.616(ted to pro).22 F(viding)-.165
+E 1.202(really cool softw)72 525.6 R 1.202(are tools.)-.11 F 1.202
+(Please see \214le PCCTS.FUTURE for more information.)6.702 F 1.203(All PCCTS)
+6.703 F(tools currently in the public domain will continue to be in the public\
+ domain.)72 541.6 Q 1.198(Looking to)97 561.2 R -.11(wa)-.275 G 1.198
+(rds the future, a graphical user).11 F(-interf)-.22 E 1.197
+(ace is in the design phase.)-.11 F 1.197(This w)6.697 F(ould)-.11 E(allo)72
+577.2 Q 2.753(wu)-.275 G .003(sers to vie)104.42 577.2 R 2.753(wt)-.275 G .004
+(he syntax diagram representation of their grammars and w)162.509 577.2 R .004
+(ould highlight non-)-.11 F 1.181(deterministic productions.)72 593.2 R -.165
+(Pa)6.681 G 1.18(rsing can be traced graphically as well.).165 F 1.18
+(This system will be b)6.68 F(uilt)-.22 E .167(using a multiplatform windo)72
+609.2 R 2.917(wl)-.275 G(ibrary)211.73 609.2 Q 5.667(.W)-.715 G 2.917(ea)
+255.204 609.2 S .168(lso anticipate the introduction of a sophisticated error)
+267.889 609.2 R(handling mechanism called `)72 625.2 Q(`parser e)-.814 E
+(xception handling')-.165 E 2.75('i)-.814 G 2.75(nan)327.431 625.2 S
+(ear future release.)348.815 625.2 Q(Currently)97 644.8 Q 3.019(,P)-.715 G .269
+(CCTS is used at o)150.333 644.8 R -.165(ve)-.165 G 3.019(r1).165 G .269
+(000 kno)253.098 644.8 R .268(wn academic, go)-.275 F -.165(ve)-.165 G .268
+(rnment, and commercial sites).165 F .859(in 37 countries.)72 660.8 R .859
+(Of course, the true number of users is unkno)6.359 F .859(wn due to the lar)
+-.275 F .859(ge number of ftp)-.198 F(sites.)72 676.8 Q EP
+%%Page: 3 3
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 11/Times-Roman@0 SF 2.75(-3-)278.837 52 S(Credits)272.11 88 Q .44 LW
+472.162 103.75 103.838 103.75 DL(Idea/T)134.236 117 Q 52.987(ool Coder)-.88 F
+(Co-designer\(s\))345.436 117 Q 281.334 103.75 281.334 124.75 DL 209.273 103.75
+209.273 124.75 DL 209.273 124.75 103.838 124.75 DL 103.838 126.75 209.273
+126.75 DL 281.334 124.75 209.273 124.75 DL 209.273 126.75 281.334 126.75 DL
+472.162 124.75 281.334 124.75 DL 281.334 126.75 472.162 126.75 DL(ANTLR 1.00A)
+109.338 140 Q -.77(Te)217.523 140 S(rence P).77 E 13.75(arr Hank)-.165 F(Dietz)
+2.75 E 82.83(ALX T)109.338 156 R(erence P)-.77 E 13.75(arr Hank)-.165 F(Dietz)
+2.75 E(ANTLR 1.00B)109.338 172 Q -.77(Te)217.523 172 S(rence P).77 E 13.75
+(arr Hank)-.165 F(Dietz, W)2.75 E(ill Cohen)-.44 E(DLG 1.00B)109.338 188 Q -.44
+(Wi)217.523 188 S(ll Cohen).44 E -.77(Te)289.584 188 S(rence P).77 E(arr)-.165
+E 2.75(,H)-.44 G(ank Dietz)358.147 188 Q(NF)109.338 204 Q 2.75(AR)-.814 G
+30.778(elabelling W)140.611 204 R(ill Cohen)-.44 E/F1 11/Times-Italic@0 SF(LL)
+109.976 220 Q F0(\().583 E F1(k).396 E F0 2.75(\)a).737 G 40.447(nalysis T)
+143.768 220 R(erence P)-.77 E 13.75(arr Hank)-.165 F(Dietz)2.75 E(ANTLR 1.00)
+109.338 236 Q -.77(Te)217.523 236 S(rence P).77 E 13.75(arr Hank)-.165 F
+(Dietz, W)2.75 E(ill Cohen)-.44 E(DLG 1.00)109.338 252 Q -.44(Wi)217.523 252 S
+(ll Cohen).44 E -.77(Te)289.584 252 S(rence P).77 E(arr)-.165 E 2.75(,H)-.44 G
+(ank Dietz)358.147 252 Q(ANTLR 1.06)109.338 268 Q -.77(Te)217.523 268 S
+(rence P).77 E 13.75(arr W)-.165 F(ill Cohen, Russell Quong, Hank Dietz)-.44 E
+(DLG 1.06)109.338 284 Q -.44(Wi)217.523 284 S(ll Cohen).44 E -.77(Te)289.584
+284 S(rence P).77 E(arr)-.165 E 2.75(,H)-.44 G(ank Dietz)358.147 284 Q
+(ANTLR 1.10)109.338 300 Q -.77(Te)217.523 300 S(rence P).77 E 13.75(arr W)-.165
+F(ill Cohen, Russell Quong)-.44 E(ANTLR 1.20)109.338 316 Q -.77(Te)217.523 316
+S(rence P).77 E 13.75(arr W)-.165 F(ill Cohen, Russell Quong)-.44 E(ANTLR 1.21)
+109.338 332 Q -.77(Te)217.523 332 S(rence P).77 E 13.75(arr Russell)-.165 F
+(Quong)2.75 E(DLG 1.10)109.338 348 Q -.44(Wi)217.523 348 S(ll Cohen).44 E -.77
+(Te)289.584 348 S(rence P).77 E(arr)-.165 E(DLG 1.20)109.338 364 Q -.44(Wi)
+217.523 364 S(ll Cohen).44 E -.77(Te)289.584 364 S(rence P).77 E(arr)-.165 E
+(DLG 1.21)109.338 380 Q -.77(Te)217.523 380 S(rence P).77 E(arr)-.165 E
+(Semantic predicates)109.338 396 Q -.77(Te)217.523 396 S(rence P).77 E 13.75
+(arr Russell)-.165 F(Quonq)2.75 E(Syntactic predicates)109.338 412 Q -.77(Te)
+217.523 412 S(rence P).77 E 13.75(arr Russell)-.165 F(Quonq)2.75 E
+(SORCERER 1.00A)109.338 428 Q -.77(Te)217.523 428 S(rence P).77 E(arr)-.165 E
+(SORCERER 1.00B)109.338 444 Q -.77(Te)217.523 444 S(rence P).77 E 13.75
+(arr Aaron)-.165 F(Sa)2.75 E(wde)-.165 E(y)-.165 E(SORCERER 1.00B9)109.338 460
+Q -.77(Te)217.523 460 S(rence P).77 E 13.75(arr Aaron)-.165 F(Sa)2.75 E(wde)
+-.165 E 1.43 -.715(y, G)-.165 H(ary Funck).715 E 472.162 467.75 103.838 467.75
+DL 472.162 103.75 472.162 467.75 DL 103.838 103.75 103.838 467.75 DL EP
+%%Trailer
+end
+%%EOF
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/history.txt b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/history.txt
new file mode 100644
index 000000000..89ad8408c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/history.txt
@@ -0,0 +1,186 @@
+
+
+
+ The History of PCCTS
+
+ The Purdue Compiler-Construction Tool Set
+
+
+ Terence Parr
+ Parr Research Corporation
+ Minneapolis, Minnesota
+ and
+ University of Minnesota
+ Army High Performance Computing Research Center
+
+ [Updated 8-7-94]
+
+
+ The PCCTS project began as a parser-generator project for a gra-
+duate course at Purdue University in the Fall of 1988 taught by Hank
+Dietz- translator-writing systems. Under the guidance of Professor
+Dietz, the parser generator, ANTLR (originally called YUCC), continued
+after the termination of the course and eventually became the subject
+of Terence Parr's Master's thesis. Originally, lexical analysis was
+performed via ALX which was soon replaced by Will Cohen's DLG in the
+Fall of 1989 (DFA-based lexical-analyzer generator, also an offshoot
+of the graduate translation course).
+
+ The alpha version of ANTLR was totally rewritten resulting in
+1.00B. Version 1.00B was released via an internet newsgroup
+(comp.compilers) posting in February of 1990 and quickly gathered a
+large following. 1.00B generated only LL(1) parsers, but allowed the
+merged description of lexical and syntactic analysis. It had rudimen-
+tary attribute handling similar to that of YACC and did not incor-
+porate rule parameters or return values; downward inheritance was very
+awkward. 1.00B-generated parsers terminated upon the first syntax
+error. Lexical classes (modes) were not allowed and DLG did not have
+an interactive mode.
+
+ Upon starting his Ph.D. at Purdue in the Fall of 1990, Terence
+Parr began the second total rewrite of ANTLR. The method by which
+grammars may be practically analyzed to generate LL(k) lookahead
+information was discovered in August of 1990 just before his return.
+Version 1.00 incorporated this algorithm and included the AST mechan-
+ism, lexical classes, error classes, and automatic error recovery;
+code quality and portability were higher. In February of 1992 1.00
+was released via an article in SIGPLAN Notices. Peter Dahl, Ph.D.
+candidate, and Professor Matt O'Keefe (both at the University of Min-
+nesota) tested this version extensively. Dana Hoggatt (Micro Data
+Base Systems, Inc.) came up with the idea of error grouping (strings
+attached to non-terminals) and tested 1.00 heavily.
+
+ Version 1.06 was released in December 1992 and represented a
+large feature enhancement over 1.00. For example, rudimentary seman-
+tic predicates were introduced, error messages were significantly
+improved for k>1 lookahead and ANTLR parsers could indicate that loo-
+kahead fetches were to occur only when necessary for the parse
+
+
+
+ Page 1
+
+ PCCTS
+
+
+(normally, the lookahead "pipe" was constantly full). Russell Quong
+joined the project in the Spring of 1992 to aid in the semantic predi-
+cate design. Beginning and advanced tutorials were created and
+released as well. A makefile generator was included that sets up
+dependencies and such correctly for ANTLR and DLG. Very few 1.00
+incompatibilities were introduced (1.00 was quite different from 1.00B
+in some areas).
+
+ 1.10 was released on August 31, 1993 and incorporated bug fixes,
+a few feature enhancements and a major new capability - an arbitrary
+lookahead operator (syntactic predicate), (alpha)?beta. This feature
+was co-designed with Professor Russell Quong also at Purdue. To sup-
+port infinite lookahead, a preprocessor flag, ZZINF_LOOK, was created
+that forced the ANTLR() macro to tokenize all input prior to parsing.
+Hence, at any moment, an action or predicate can see the entire input
+sentence. The predicate mechanism of 1.06 was extended to allow mul-
+tiple predicates to be hoisted; the syntactic context of a predicate
+was also moved along with the predicate.
+
+ In February of 1994, SORCERER (a simple tree-parser generator)
+was released. This tool allows the user to parse child-sibling trees
+by specifying a grammar rather than building a recursive-descent tree
+walker by hand. Work towards a library of tree transformations is
+underway. Aaron Sawdey at The University of Minnesota became a second
+author of SORCERER after the initial release.
+
+ On April 1, 1994, PCCTS 1.20 was released. This was the first
+version to actively support C++ output. It also included important
+fixes regarding semantic predicates and (..)+ subrules. This version
+also introduced token classes, the "not" operator, and token ranges.
+
+ On June 19, 1994, SORCERER 1.00B9 was released. Gary Funck of
+Intrepid Technology joined the SORCERER team and provided very valu-
+able suggestions regarding the "transform" mode of SORCERER.
+
+ On August 8, 1994, PCCTS 1.21 was released. It mainly cleaned up
+the C++ output and included a number of bug fixes.
+
+ From the 1.21 release forward, the maintenance and support of all
+PCCTS tools will be primarily provided by Parr Research Corporation,
+Minneapolis MN---an organization founded on the principles of excel-
+lence in research and integrity in business; we are devoted to provid-
+ing really cool software tools. Please see file PCCTS.FUTURE for more
+information. All PCCTS tools currently in the public domain will con-
+tinue to be in the public domain.
+
+ Looking towards the future, a graphical user-interface is in the
+design phase. This would allow users to view the syntax diagram
+representation of their grammars and would highlight nondeterministic
+productions. Parsing can be traced graphically as well. This system
+will be built using a multiplatform window library. We also antici-
+pate the introduction of a sophisticated error handling mechanism
+called "parser exception handling" in a near future release.
+
+
+
+
+ Page 2
+
+ PCCTS
+
+
+ Currently, PCCTS is used at over 1000 known academic, government,
+and commercial sites in 37 countries. Of course, the true number of
+users is unknown due to the large number of ftp sites.
+ Credits
+
+_____________________________________________________________________________
+_____________________________________________________________________________
+|ANTLR 1.00A Terence Parr Hank Dietz |
+|ALX Terence Parr Hank Dietz |
+|ANTLR 1.00B Terence Parr Hank Dietz, Will Cohen |
+|DLG 1.00B Will Cohen Terence Parr, Hank Dietz |
+|NFA Relabelling Will Cohen |
+|LL(k) analysis Terence Parr Hank Dietz |
+|ANTLR 1.00 Terence Parr Hank Dietz, Will Cohen |
+|DLG 1.00 Will Cohen Terence Parr, Hank Dietz |
+|ANTLR 1.06 Terence Parr Will Cohen, Russell Quong, Hank Dietz|
+|DLG 1.06 Will Cohen Terence Parr, Hank Dietz |
+|ANTLR 1.10 Terence Parr Will Cohen, Russell Quong |
+|ANTLR 1.20 Terence Parr Will Cohen, Russell Quong |
+|ANTLR 1.21 Terence Parr Russell Quong |
+|DLG 1.10 Will Cohen Terence Parr |
+|DLG 1.20 Will Cohen Terence Parr |
+|DLG 1.21 Terence Parr |
+|Semantic predicates Terence Parr Russell Quonq |
+|Syntactic predicates Terence Parr Russell Quonq |
+|SORCERER 1.00A Terence Parr |
+|SORCERER 1.00B Terence Parr Aaron Sawdey |
+|SORCERER 1.00B9 Terence Parr Aaron Sawdey, Gary Funck |
+|___________________________________________________________________________|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Page 3
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/makefile.old b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/makefile.old
new file mode 100644
index 000000000..f9b2dd2b9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/makefile.old
@@ -0,0 +1,66 @@
+#
+# Main makefile for PCCTS 1.33MR33 /* MRXXX */
+#
+# Terence Parr
+# Parr Research Corporation
+#
+# verbosity versus silence...
+PSss=
+#
+# this can be set to /user/local/bin etc...
+BINDIR=bin
+# This part added by Thomas Herter, M"unchen, Germany. See also manpages
+# target.
+MANDIR=$(HOME)/man
+MANEXT=1
+MANFILES=dlg/dlg.1 antlr/antlr.1
+
+#CC=cc
+#CC=gcc
+#COPT=-O2
+
+pccts:
+ @echo " "
+ @echo " Welcome to PCCTS 1.33MR33 installation"
+ @echo " "
+ @echo " (Version 1.33 Maintenance Release #33)" # mrxxx
+ @echo " "
+ @echo " Released 19 April 2002"
+ @echo " "
+ @echo " Featuring"
+ @echo " ANTLR -- ANother Tool for Language Recognition"
+ @echo " DLG -- DFA-based Lexical Analyzer Generator"
+ @echo " SORCERER -- Source-to-source translator (tree walker)"
+ @echo " "
+ @echo " http://www.antlr.org"
+ @echo " "
+ @echo " Trouble reports to tmoog@polhode.com"
+ @echo " Additional PCCTS 1.33 information at"
+ @echo " http://www.polhode.com"
+ @echo
+ @echo
+ @echo "To substitute gcc for CC to invoke compiler: make CC=gcc"
+ @echo "If there are problems with cr and lf try: unzip -a ..."
+ @echo
+#
+ @if [ ! -d $(BINDIR) ] ; then mkdir $(BINDIR) ; fi
+ @echo Making executables...
+ (cd ./antlr; $(MAKE) CC="$(CC)" COPT="$(COPT)")
+ @echo antlr executable now in $(BINDIR)
+ (cd ./dlg; $(MAKE) CC="$(CC)" COPT="$(COPT)")
+ @echo dlg executable now in $(BINDIR)
+ @echo
+ @echo " PCCTS 1.33MR33 installation complete" # MRXXX
+
+clean:
+ (cd ./antlr; $(MAKE) -s clean)
+ (cd ./dlg; $(MAKE) -s clean)
+
+
+manpages:
+ # mkdir -p $(MANDIR)/man$(MANEXT)
+ if [ ! -d $(MANDIR) ] ; then \
+ mkdir $(MANDIR) ; fi
+ if [ ! -d $(MANDIR)/man$(MANEXT) ] ; then \
+ mkdir $(MANDIR)/man$(MANEXT); fi
+ cp -p $(MANFILES) $(MANDIR)/man$(MANEXT)
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/genmk/genmk.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/genmk/genmk.c
new file mode 100644
index 000000000..4952a30b3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/genmk/genmk.c
@@ -0,0 +1,1063 @@
+/*
+ * genmk -- a program to make makefiles for PCCTS
+ *
+ * ANTLR 1.33MR23
+ * Terence John Parr 1989 - 2000
+ * Purdue University
+ * U of MN
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "pcctscfg.h" /* be sensitive to what ANTLR/DLG call the files */
+
+#ifdef VAXC
+#define DIE return 0;
+#define DONE return 1;
+#else
+#define DIE return 1;
+#define DONE return 0;
+#endif
+
+#ifndef require
+#define require(expr, err) {if ( !(expr) ) fatal(err);}
+#endif
+
+#define MAX_FILES 50
+#define MAX_CFILES 1600
+#define MAX_SFILES 50
+#define MAX_SORS 50
+#define MAX_CLASSES 50
+
+char *RENAME_OBJ_FLAG="-o",
+ *RENAME_EXE_FLAG="-o";
+
+char *dlg = "parser.dlg";
+char *err = "err.c";
+char *hdr = "stdpccts.h";
+char *tok = "tokens.h";
+char *mode = "mode.h";
+char *scan = "scan";
+
+char ATOKENBUFFER_O[100];
+char APARSER_O[100];
+char ASTBASE_O[100];
+char PCCTSAST_O[100];
+char LIST_O[100];
+char DLEXERBASE_O[100];
+
+/* Option flags */
+static char *project="t", *files[MAX_FILES], *classes[MAX_CLASSES];
+static char *cfiles[MAX_CFILES];
+static char *sfiles[MAX_SORS][MAX_SFILES],*sclasses[MAX_SORS];
+static int num_sfiles[MAX_SORS]; /*sorcerer files in group */
+static int num_sors = 0; /*sorcerer groups */
+static int num_files = 0; /* grammar files */
+static int num_cfiles = 0; /* additional C/C++ files */
+static int num_classes = 0; /* ANTLR classes */
+static int user_lexer = 0;
+static char *user_token_types = NULL;
+static int gen_CPP = 0;
+static char *outdir=".";
+static char *dlg_class = "DLGLexer";
+static int gen_trees = 0;
+static int gen_hoist = 0;
+static int nondef_comp = 0; /* 1=compiler is non default */
+static char *compilerCCC="CC";
+static char *compilerCC="cc";
+static char *pccts_path="/usr/local/pccts";
+
+#ifdef __STDC__
+void help(void);
+void mk(char *project, char **files, int n, int argc, char **argv);
+void pfiles(char **files, int n, char *suffix);
+void fatal(char *msg);
+void warn(char *msg);
+#else
+void help();
+void mk();
+void pfiles();
+void fatal();
+void warn();
+#endif
+
+typedef struct _Opt {
+ char *option;
+ int arg;
+#ifdef __cplusplus
+ void (*process)(...);
+#else
+ void (*process)();
+#endif
+ char *descr;
+ } Opt;
+
+#ifdef __STDC__
+static void ProcessArgs(int, char **, Opt *);
+#else
+static void ProcessArgs();
+#endif
+
+static void
+#ifdef __STDC__
+pProj(char *s, char *t )
+#else
+pProj( s, t )
+char *s;
+char *t;
+#endif
+{
+ project = t;
+}
+
+static void
+#ifdef __STDC__
+pUL( char *s )
+#else
+pUL( s )
+char *s;
+#endif
+{
+ user_lexer = 1;
+}
+
+static void
+#ifdef __STDC__
+pCPP( char *s )
+#else
+pCPP( s )
+char *s;
+#endif
+{
+ gen_CPP = 1;
+}
+
+static void
+#ifdef __STDC__
+pUT( char *s, char *t )
+#else
+pUT( s, t )
+char *s;
+char *t;
+#endif
+{
+ user_token_types = t;
+}
+
+static void
+#ifdef __STDC__
+pTrees( char *s )
+#else
+pTrees( s )
+char *s;
+#endif
+{
+ gen_trees = 1;
+}
+
+static void
+#ifdef __STDC__
+pHoist( char *s )
+#else
+pHoist( s )
+char *s;
+#endif
+{
+ gen_hoist = 1;
+}
+
+static void
+#ifdef __STDC__
+pSor( char *s )
+#else
+pSor( s )
+char *s;
+#endif
+{
+ require(num_sors<MAX_SORS, "exceeded max # of sorcerer groups");
+ num_sors++;
+ pTrees(NULL); /* silently turn on tree generation */
+}
+
+static void
+#ifdef __STDC__
+pSFiles( char *s, char *t )
+#else
+pSFiles( s, t )
+char *s;
+char *t;
+#endif
+{
+ if (num_sors==0)
+ {
+ pSor(NULL);
+ warn("sorcerer input file before any '-sor' option");
+ }
+
+ require(num_sfiles[num_sors-1]<MAX_SFILES,
+ "exceeded max # of sorcerer input files");
+ sfiles[num_sors-1][num_sfiles[num_sors-1]++] = t;
+}
+
+static void
+#ifdef __STDC__
+pCFiles( char *s, char *t )
+#else
+pCFiles( s, t )
+char *s;
+char *t;
+#endif
+{
+ require(num_cfiles<MAX_CFILES, "exceeded max # of C/C++ input files");
+ cfiles[num_cfiles++] = t;
+}
+
+int
+#ifdef __STDC__
+isKnownSuffix( char *s )
+#else
+isKnownSuffix( s )
+ char *s;
+#endif
+{
+ if(s==NULL) return 0;
+ if (strcasecmp(s,".c")==0) return 1;
+ if (strcasecmp(s,".cc")==0) return 1;
+ if (strcasecmp(s,".cpp")==0) return 1;
+ if (strcasecmp(s,".cxx")==0) return 1;
+ if (strcasecmp(s,CPP_FILE_SUFFIX)==0) return 1;
+ if (strcasecmp(s,".sor")==0) return 2;
+ return 0;
+}
+
+static void
+#ifdef __STDC__
+pFile( char *s )
+#else
+pFile( s )
+char *s;
+#endif
+{
+ if ( *s=='-' )
+ {
+ fprintf(stderr, "invalid option: '%s'; ignored...",s);
+ return;
+ }
+ switch(isKnownSuffix(strrchr(s,'.')))
+ {
+ case 1: /* c/c++ */
+ pCFiles("-cfiles",s);
+ return;
+ case 2: /* sorcerer */
+ pSFiles("",s);
+ return;
+ default: /* grammar (ANTLR) */
+ break;
+ }
+ require(num_files<MAX_FILES, "exceeded max # of input files");
+ files[num_files++] = s;
+}
+
+static void
+#ifdef __STDC__
+pClass( char *s, char *t )
+#else
+pClass( s, t )
+char *s;
+char *t;
+#endif
+{
+ if (num_sors==0)
+ {
+ require(num_classes<MAX_CLASSES, "exceeded max # of grammar classes");
+ classes[num_classes++] = t;
+ } else
+ {
+ sclasses[num_sors-1] = t; /* one class per sorcerer group (last valid) */
+ }
+}
+
+static void
+#ifdef __STDC__
+pDLGClass( char *s, char *t )
+#else
+pDLGClass( s, t )
+char *s;
+char *t;
+#endif
+{
+ if ( !gen_CPP ) {
+ fprintf(stderr, "-dlg-class makes no sense without C++ mode; ignored...");
+ }
+ else dlg_class = t;
+}
+
+static void
+#ifdef __STDC__
+pOdir( char *s, char *t )
+#else
+pOdir( s, t )
+char *s;
+char *t;
+#endif
+{
+ outdir = t;
+}
+
+static void
+#ifdef __STDC__
+pHdr( char *s, char *t )
+#else
+pHdr( s, t )
+char *s;
+char *t;
+#endif
+{
+ hdr = t;
+}
+
+static void
+#ifdef __STDC__
+pCompiler( char *s, char *t )
+#else
+pCompiler( s, t )
+char *s;
+char *t;
+#endif
+{
+ compilerCCC = t;
+ compilerCC = t;
+ nondef_comp = 1;
+}
+
+static void
+#ifdef __STDC__
+ppccts_path( char *s, char *t )
+#else
+ppccts_path( s, t )
+char *s;
+char *t;
+#endif
+{
+ pccts_path = t;
+}
+
+Opt options[] = {
+ { "-CC", 0, pCPP, "Generate C++ output"},
+ { "-class", 1, pClass, "Name of a grammar class defined in grammar (if C++)"},
+ { "-dlg-class", 1,pDLGClass,"Name of DLG lexer class (default=DLGLexer) (if C++)"},
+ { "-header", 1,pHdr, "Name of ANTLR standard header info (default=no file)"},
+ { "-o", 1, pOdir, "Directory where output files should go (default=\".\")"},
+ { "-project", 1, pProj, "Name of executable to create (default=t)"},
+ { "-token-types", 1, pUT, "Token types are in this file (don't use tokens.h)"},
+ { "-trees", 0, pTrees, "Generate ASTs"},
+ { "-user-lexer", 0, pUL, "Do not create a DLG-based scanner"},
+ { "-mrhoist",0,pHoist, "Maintenance release style hoisting"},
+ { "-cfiles",1,pCFiles, "Additional files in C or C++ to compile"},
+ { "-sor",0,pSor, "Start of sorcerer group"},
+ { "-pccts_path",1,ppccts_path,
+ "Path for $PCCTS directory (default is /usr/local/pccts)"},
+ { "-compiler",1,pCompiler,
+ "Default compiler (default is CC/cc)"},
+ { "*", 0,pFile, "" }, /* anything else is a file */
+ { NULL, 0, NULL, NULL }
+};
+
+#ifdef __STDC__
+extern char *DIR(void);
+#else
+extern char *DIR();
+#endif
+
+#ifdef __STDC__
+int main(int argc, char **argv)
+#else
+int main(argc, argv)
+int argc;
+char **argv;
+#endif
+{
+ int i;
+
+ if ( argc == 1 ) { help(); DIE; }
+ for(i=0;i<MAX_SORS;i++) num_sfiles[i]=0;
+
+ ProcessArgs(argc-1, &(argv[1]), options);
+
+ strcpy(ATOKENBUFFER_O, ATOKENBUFFER_C);
+ ATOKENBUFFER_O[strlen(ATOKENBUFFER_C)-strlen(CPP_FILE_SUFFIX)] = '\0';
+ strcat(ATOKENBUFFER_O, OBJ_FILE_SUFFIX);
+ strcpy(APARSER_O, APARSER_C);
+ APARSER_O[strlen(APARSER_O)-strlen(CPP_FILE_SUFFIX)] = '\0';
+ strcat(APARSER_O, OBJ_FILE_SUFFIX);
+
+ strcpy(ASTBASE_O, ASTBASE_C);
+ ASTBASE_O[strlen(ASTBASE_C)-strlen(CPP_FILE_SUFFIX)] = '\0';
+ strcat(ASTBASE_O, OBJ_FILE_SUFFIX);
+
+ strcpy(PCCTSAST_O, PCCTSAST_C);
+ PCCTSAST_O[strlen(PCCTSAST_C)-strlen(CPP_FILE_SUFFIX)] = '\0';
+ strcat(PCCTSAST_O, OBJ_FILE_SUFFIX);
+
+ strcpy(LIST_O, LIST_C);
+ LIST_O[strlen(LIST_C)-strlen(CPP_FILE_SUFFIX)] = '\0';
+ strcat(LIST_O, OBJ_FILE_SUFFIX);
+
+ strcpy(DLEXERBASE_O, DLEXERBASE_C);
+ DLEXERBASE_O[strlen(DLEXERBASE_C)-strlen(CPP_FILE_SUFFIX)] = '\0';
+ strcat(DLEXERBASE_O, OBJ_FILE_SUFFIX);
+
+ if ( num_files == 0 ) fatal("no grammar files specified; exiting...");
+ if ( !gen_CPP && num_classes>0 ) {
+ warn("can't define classes w/o C++ mode; turning on C++ mode...\n");
+ gen_CPP=1;
+ }
+ if (!gen_CPP && num_sors) {
+ warn("can't define sorcerer group in C mode (yet); turning on C++ mode...\n");
+ gen_CPP=1;
+ }
+ if ( gen_CPP && num_classes==0 ) {
+ fatal("must define classes >0 grammar classes in C++ mode\n");
+ }
+
+ mk(project, files, num_files, argc, argv);
+ DONE;
+}
+
+#ifdef __STDC__
+void help(void)
+#else
+void help()
+#endif
+{
+ Opt *p = options;
+ static char buf[1000+1];
+
+ fprintf(stderr, "genmk [options] f1.g ... fn.g\n");
+ while ( p->option!=NULL && *(p->option) != '*' )
+ {
+ buf[0]='\0';
+ if ( p->arg ) sprintf(buf, "%s ___", p->option);
+ else strcpy(buf, p->option);
+ fprintf(stderr, "\t%-16s %s\n", buf, p->descr);
+ p++;
+ }
+}
+
+#ifdef __STDC__
+void mk(char *project, char **files, int n, int argc, char **argv)
+#else
+void mk(project, files, n, argc, argv)
+char *project;
+char **files;
+int n;
+int argc;
+char **argv;
+#endif
+{
+ int i,j;
+
+ printf("#\n");
+ printf("# PCCTS makefile for: ");
+ pfiles(files, n, NULL);
+ printf("\n");
+ printf("#\n");
+ printf("# Created from:");
+ for (i=0; i<argc; i++) printf(" %s", argv[i]);
+ printf("\n");
+ printf("#\n");
+ printf("# PCCTS release 1.33MR23\n");
+ printf("# Project: %s\n", project);
+ if ( gen_CPP ) printf("# C++ output\n");
+ else printf("# C output\n");
+ if ( user_lexer ) printf("# User-defined scanner\n");
+ else printf("# DLG scanner\n");
+ if ( user_token_types!=NULL ) printf("# User-defined token types in '%s'\n", user_token_types);
+ else printf("# ANTLR-defined token types\n");
+ printf("#\n");
+/***********
+ printf(".SUFFIXES:\n.SUFFIXES:\t.o .cpp .c .h .g .i .dlg .sor\n");
+ ***********/
+ if ( user_token_types!=NULL ) {
+ printf("# Make sure #tokdefs directive in ANTLR grammar lists this file:\n");
+ printf("TOKENS = %s", user_token_types);
+ }
+ else printf("TOKENS = %stokens.h", DIR());
+ printf("\n");
+ printf("#\n");
+ printf("# The following filenames must be consistent with ANTLR/DLG flags\n");
+ printf("DLG_FILE = %s%s\n", DIR(), dlg);
+ printf("ERR = %serr\n", DIR());
+ if ( strcmp(hdr,"stdpccts.h")!=0 ) printf("HDR_FILE = %s%s\n", DIR(), hdr);
+ else printf("HDR_FILE =\n");
+ if ( !gen_CPP ) printf("MOD_FILE = %s%s\n", DIR(), mode);
+ if ( !gen_CPP ) printf("SCAN = %s\n", scan);
+ else printf("SCAN = %s%s\n", DIR(), dlg_class);
+
+ printf("PCCTS = %s\n",pccts_path);
+ printf("ANTLR_H = $(PCCTS)%sh\n", DirectorySymbol);
+ if (num_sors>0) {
+ printf("SOR_H = $(PCCTS)%ssorcerer%sh\n", DirectorySymbol, DirectorySymbol);
+ printf("SOR_LIB = $(PCCTS)%ssorcerer%slib\n",
+ DirectorySymbol, DirectorySymbol);
+ }
+ printf("BIN = $(PCCTS)%sbin\n", DirectorySymbol);
+ printf("ANTLR = $(BIN)%santlr\n", DirectorySymbol);
+ printf("DLG = $(BIN)%sdlg\n", DirectorySymbol);
+ if (num_sors>0) printf("SOR = $(BIN)%ssor\n", DirectorySymbol);
+ printf("CFLAGS = -I. -I$(ANTLR_H)");
+ if (num_sors>0) printf(" -I$(SOR_H)");
+ if ( strcmp(outdir, ".")!=0 ) printf(" -I%s", outdir);
+ printf(" $(COTHER)");
+ printf("\n");
+ printf("AFLAGS =");
+ if ( strcmp(outdir,".")!=0 ) printf(" -o %s", outdir);
+ if ( user_lexer ) printf(" -gx");
+ if ( gen_CPP ) printf(" -CC");
+ if ( strcmp(hdr,"stdpccts.h")!=0 ) printf(" -gh %s", hdr);
+ if ( gen_trees ) printf(" -gt");
+ if ( gen_hoist ) {
+ printf(" -mrhoist on") ;
+ } else {
+ printf(" -mrhoist off");
+ };
+ printf(" $(AOTHER)");
+ printf("\n");
+ printf("DFLAGS = -C2 -i");
+ if ( gen_CPP ) printf(" -CC");
+ if ( strcmp(dlg_class,"DLGLexer")!=0 ) printf(" -cl %s", dlg_class);
+ if ( strcmp(outdir,".")!=0 ) printf(" -o %s", outdir);
+ printf(" $(DOTHER)");
+ printf("\n");
+ if (num_sors>0)
+ {
+ printf("SFLAGS = -CPP");
+ if ( strcmp(outdir,".")!=0 ) printf(" -out-dir %s", outdir);
+ printf(" $(SOTHER)\n");
+ }
+ printf("GRM = ");
+ pfiles(files, n, NULL);
+ printf("\n");
+ printf("SRC = ");
+ if ( gen_CPP ) pfiles(files, n, CPP_FILE_SUFFIX_NO_DOT);
+ else pfiles(files, n, "c");
+ if ( gen_CPP ) {
+ printf(" \\\n\t");
+ pclasses(classes, num_classes, CPP_FILE_SUFFIX_NO_DOT);
+ printf(" \\\n\t");
+ printf("$(ANTLR_H)%s%s", DirectorySymbol, APARSER_C);
+ if ( !user_lexer ) printf(" $(ANTLR_H)%s%s", DirectorySymbol, DLEXERBASE_C);
+ if ( gen_trees ) {
+ printf(" \\\n\t");
+ printf("$(ANTLR_H)%s%s", DirectorySymbol, ASTBASE_C);
+ printf(" $(ANTLR_H)%s%s", DirectorySymbol, PCCTSAST_C);
+/* printf(" $(ANTLR_H)%s%s", DirectorySymbol, LIST_C); */
+ printf(" \\\n\t");
+ }
+ printf(" $(ANTLR_H)%s%s", DirectorySymbol, ATOKENBUFFER_C);
+ }
+ if ( !user_lexer ) {
+ if ( gen_CPP ) printf(" $(SCAN)%s", CPP_FILE_SUFFIX);
+ else printf(" %s$(SCAN).c", DIR());
+ }
+ if ( !gen_CPP ) printf(" $(ERR).c");
+ for (i=0;i<num_sors;i++)
+ {
+ printf(" \\\n\t");
+ pclasses(&sclasses[i],1,CPP_FILE_SUFFIX_NO_DOT);
+ printf(" ");
+ pfiles(&sfiles[i][0],num_sfiles[i],CPP_FILE_SUFFIX_NO_DOT);
+ }
+ if(num_sors>0)
+ printf(" \\\n\t$(SOR_LIB)%sSTreeParser.cpp", DirectorySymbol);
+ if (num_cfiles>0)
+ {
+ printf(" \\\n\t");
+ pfiles(cfiles,num_cfiles,NULL);
+ }
+ printf("\n\n");
+ printf("OBJ = ");
+ pfiles(files, n, "o");
+ if ( gen_CPP ) {
+ printf(" \\\n\t");
+ pclasses(classes, num_classes, "o");
+ printf(" \\\n\t");
+ printf("%s%s", DIR(), APARSER_O);
+ if ( !user_lexer ) {
+ printf(" %s%s", DIR(), DLEXERBASE_O);
+ }
+ if ( gen_trees ) {
+ printf(" \\\n\t");
+ printf("%s%s", DIR(), ASTBASE_O);
+ printf(" %s%s", DIR(), PCCTSAST_O);
+/* printf(" %s%s", DIR(), LIST_O); */
+ printf(" \\\n\t");
+ }
+ printf(" %s%s", DIR(), ATOKENBUFFER_O);
+ }
+ if ( !user_lexer ) {
+ if ( gen_CPP ) printf(" $(SCAN)%s", OBJ_FILE_SUFFIX);
+ else printf(" %s$(SCAN)%s", DIR(), OBJ_FILE_SUFFIX);
+ }
+ if ( !gen_CPP ) printf(" $(ERR)%s", OBJ_FILE_SUFFIX);
+ for (i=0;i<num_sors;i++)
+ {
+ printf(" \\\n\t");
+ pclasses(&sclasses[i],1,"o");
+ printf(" ");
+ pfiles(&sfiles[i][0],num_sfiles[i],"o");
+ }
+ if(num_sors>0) printf(" \\\n\tSTreeParser.o");
+ if (num_cfiles>0)
+ {
+ printf(" \\\n\t");
+ pfiles(cfiles,num_cfiles,"o");
+ }
+ printf("\n\n");
+
+ printf("ANTLR_SPAWN = ");
+ if ( gen_CPP ) pfiles(files, n, CPP_FILE_SUFFIX_NO_DOT);
+ else pfiles(files, n, "c");
+ if ( gen_CPP ) {
+ printf(" ");
+ pclasses(classes, num_classes, CPP_FILE_SUFFIX_NO_DOT);
+ printf(" \\\n\t\t");
+ pclasses(classes, num_classes, "h");
+ if ( strcmp(hdr,"stdpccts.h")!=0 ) {
+ printf(" \\\n\t\t");
+ printf("$(HDR_FILE) stdpccts.h");
+ }
+ }
+ if ( user_lexer ) {
+ if ( !user_token_types ) printf(" $(TOKENS)");
+ }
+ else {
+ printf(" $(DLG_FILE)");
+ if ( !user_token_types ) printf(" $(TOKENS)");
+ }
+ if ( !gen_CPP ) printf(" $(ERR).c");
+ printf("\n");
+
+ if ( !user_lexer ) {
+ if ( gen_CPP ) printf("DLG_SPAWN = $(SCAN)%s", CPP_FILE_SUFFIX);
+ else printf("DLG_SPAWN = %s$(SCAN).c", DIR());
+ if ( gen_CPP ) printf(" $(SCAN).h");
+ if ( !gen_CPP ) printf(" $(MOD_FILE)");
+ printf("\n");
+ }
+
+ if ( gen_CPP ) {
+ if ( !nondef_comp )
+ printf("ifdef CXX\nCCC = $(CXX)\nendif\n\nifndef CCC\n");
+ printf("CCC = %s\n",compilerCCC);
+ if ( !nondef_comp ) printf("endif\n\n");
+ }
+ else
+ {
+ if ( !nondef_comp ) printf("ifndef CC\n");
+ printf("CC = %s\n",compilerCC);
+ if ( !nondef_comp ) printf("endif\n\n");
+ }
+
+ /* set up dependencies */
+ printf("\n%s : $(SRC) $(OBJ)\n", project);
+ printf("\t%s %s %s $(CFLAGS) $(OBJ)\n",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_EXE_FLAG,
+ project);
+ printf("\n");
+
+ /* implicit rules */
+
+/* if(gen_CPP)
+ printf("%%.o : %%.cpp\n\t$(CCC) -c $(CFLAGS) $<\n\n");
+
+ printf("%%.o : %%.c\n\t%s -c $(CFLAGS) $<\n\n",
+ gen_CPP?"$(CCC)":"$(CC)");
+*/
+ /* how to compile parser files */
+
+ for (i=0; i<num_files; i++)
+ {
+ pfiles(&files[i], 1, "o");
+ if ( user_lexer ) {
+ printf(" : $(TOKENS)");
+ }
+ else {
+ if ( gen_CPP ) printf(" : $(TOKENS) $(SCAN).h");
+ else printf(" : $(MOD_FILE) $(TOKENS)");
+ }
+ printf(" ");
+ if ( gen_CPP ) pfiles(&files[i], 1, CPP_FILE_SUFFIX_NO_DOT);
+ else pfiles(&files[i], 1, "c");
+ if ( gen_CPP && strcmp(hdr,"stdpccts.h")!=0 ) printf(" $(HDR_FILE)");
+ printf("\n");
+ printf("\t%s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",RENAME_OBJ_FLAG);
+ pfiles(&files[i], 1, "o");
+ printf(" ");
+ if ( gen_CPP ) pfiles(&files[i], 1, CPP_FILE_SUFFIX_NO_DOT);
+ else pfiles(&files[i], 1, "c");
+ printf("\n\n");
+ }
+
+ for (i=0; i<num_cfiles; i++)
+ {
+ pfiles(&cfiles[i], 1, "o");
+ printf(" : ");
+ pfiles(&cfiles[i], 1, NULL);
+ if ( gen_CPP && strcmp(hdr,"stdpccts.h")!=0 ) printf(" $(HDR_FILE)");
+/*** printf(" "); ***/
+/*** pfiles(&cfiles[i], 1, "h"); ***/
+ printf("\n");
+ printf("\t%s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",RENAME_OBJ_FLAG);
+ pfiles(&cfiles[i], 1, "o");
+ printf(" ");
+ pfiles(&cfiles[i], 1, NULL);
+ printf("\n\n");
+
+/*
+ * pfiles(&cfiles[i], 1, "h");
+ * printf(" :\ntouch ");
+ * pfiles(&cfiles[i], 1, "h");
+ * printf("\n\n");
+ */
+ }
+
+ /* how to compile err.c */
+ if ( !gen_CPP ) {
+ printf("$(ERR)%s : $(ERR).c", OBJ_FILE_SUFFIX);
+ if ( !user_lexer ) printf(" $(TOKENS)");
+ printf("\n");
+ printf("\t%s -c $(CFLAGS) %s $(ERR)%s $(ERR).c",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG,
+ OBJ_FILE_SUFFIX);
+ printf("\n\n");
+ }
+
+ /* how to compile Class.c */
+ for (i=0; i<num_classes; i++)
+ {
+ pclasses(&classes[i], 1, "o");
+ if ( user_lexer ) {
+ printf(" : $(TOKENS)");
+ }
+ else {
+ printf(" : $(TOKENS) $(SCAN).h");
+ }
+ printf(" ");
+ pclasses(&classes[i], 1, CPP_FILE_SUFFIX_NO_DOT);
+ printf(" ");
+ pclasses(&classes[i], 1, "h");
+ if ( gen_CPP && strcmp(hdr,"stdpccts.h")!=0 ) printf(" $(HDR_FILE)");
+ printf("\n");
+ printf("\t%s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG);
+ pclasses(&classes[i], 1, "o");
+ printf(" ");
+ pclasses(&classes[i], 1, CPP_FILE_SUFFIX_NO_DOT);
+ printf("\n\n");
+ }
+
+ /* how to compile scan.c */
+ if ( !user_lexer ) {
+ if ( gen_CPP ) printf("$(SCAN)%s : $(SCAN)%s", OBJ_FILE_SUFFIX, CPP_FILE_SUFFIX);
+ else printf("%s$(SCAN)%s : %s$(SCAN).c", DIR(), OBJ_FILE_SUFFIX, DIR());
+ if ( !user_lexer ) printf(" $(TOKENS)");
+ printf("\n");
+ if ( gen_CPP ) printf("\t$(CCC) -c $(CFLAGS) %s $(SCAN)%s $(SCAN)%s",
+ RENAME_OBJ_FLAG,
+ OBJ_FILE_SUFFIX,
+ CPP_FILE_SUFFIX);
+ else printf("\t$(CC) -c $(CFLAGS) %s %s$(SCAN)%s %s$(SCAN).c",
+ RENAME_OBJ_FLAG,
+ DIR(),
+ OBJ_FILE_SUFFIX,
+ DIR());
+ printf("\n\n");
+ }
+/* how to compile sorcerer classes */
+ for (i=0;i<num_sors;i++)
+ {
+ pclasses(&sclasses[i], 1, "o");
+ printf(" : ");
+ pclasses(&sclasses[i], 1, CPP_FILE_SUFFIX_NO_DOT);
+ printf(" ");
+ pclasses(&sclasses[i], 1, "h");
+ if ( gen_CPP && strcmp(hdr,"stdpccts.h")!=0 ) printf(" $(HDR_FILE)");
+ printf("\n");
+ printf("\t%s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG);
+ pclasses(&sclasses[i], 1, "o");
+ printf(" ");
+ pclasses(&sclasses[i], 1, CPP_FILE_SUFFIX_NO_DOT);
+ printf("\n\n");
+/* how to compile i-th sorcerer's files*/
+ for (j=0; j<num_sfiles[i]; j++)
+ {
+ pfiles(&sfiles[i][j], 1, "o");
+ printf(" : ");
+ if ( gen_CPP ) pfiles(&sfiles[i][j], 1, CPP_FILE_SUFFIX_NO_DOT);
+ else pfiles(&sfiles[i][j], 1, "c");
+ if ( gen_CPP && strcmp(hdr,"stdpccts.h")!=0 ) printf(" $(HDR_FILE)");
+ printf("\n");
+ printf("\t%s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",RENAME_OBJ_FLAG);
+ pfiles(&sfiles[i][j], 1, "o");
+ printf(" ");
+ if ( gen_CPP ) pfiles(&sfiles[i][j], 1, CPP_FILE_SUFFIX_NO_DOT);
+ else pfiles(&sfiles[i][j], 1, "c");
+ printf("\n\n");
+ }
+ if ( gen_CPP ) pfiles(&sfiles[i][0], num_sfiles[i], CPP_FILE_SUFFIX_NO_DOT);
+ else pfiles(&sfiles[i][0], num_sfiles[i], "c");
+ if ( gen_CPP )
+ {
+ printf(" ");
+ pclasses(&sclasses[i], 1, CPP_FILE_SUFFIX_NO_DOT);
+ printf(" ");
+ pclasses(&sclasses[i], 1, "h");
+ if ( strcmp(hdr,"stdpccts.h")!=0 )
+ {
+ printf(" ");
+ printf("$(HDR_FILE) stdpccts.h");
+ }
+ }
+ printf(" : ");
+ pfiles(&sfiles[i][0],num_sfiles[i],NULL);
+ printf("\n\t$(SOR) $(SFLAGS) ");
+ pfiles(&sfiles[i][0],num_sfiles[i],NULL);
+ printf("\n\n");
+ }
+ if(num_sors>0)
+ {
+ printf("STreeParser%s : $(SOR_LIB)%sSTreeParser.cpp\n",
+ OBJ_FILE_SUFFIX,DirectorySymbol);
+ printf("\t%s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",RENAME_OBJ_FLAG);
+ printf("STreeParser%s ",OBJ_FILE_SUFFIX);
+ printf("$(SOR_LIB)%sSTreeParser.cpp\n\n",DirectorySymbol);
+ }
+
+ printf("$(ANTLR_SPAWN) : $(GRM)\n");
+ printf("\t$(ANTLR) $(AFLAGS) $(GRM)\n");
+
+ if ( !user_lexer )
+ {
+ printf("\n");
+ printf("$(DLG_SPAWN) : $(DLG_FILE)\n");
+ if ( gen_CPP ) printf("\t$(DLG) $(DFLAGS) $(DLG_FILE)\n");
+ else printf("\t$(DLG) $(DFLAGS) $(DLG_FILE) $(SCAN).c\n");
+ }
+
+ /* do the makes for ANTLR/DLG support */
+ if ( gen_CPP ) {
+ printf("\n");
+ printf("%s%s : $(ANTLR_H)%s%s\n", DIR(), APARSER_O, DirectorySymbol, APARSER_C);
+ printf("\t%s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG);
+ printf("%s%s $(ANTLR_H)%s%s\n", DIR(), APARSER_O, DirectorySymbol, APARSER_C);
+ printf("\n");
+ printf("%s%s : $(ANTLR_H)%s%s\n", DIR(), ATOKENBUFFER_O, DirectorySymbol, ATOKENBUFFER_C);
+ printf("\t%s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG);
+ printf("%s%s $(ANTLR_H)%s%s\n", DIR(), ATOKENBUFFER_O, DirectorySymbol, ATOKENBUFFER_C);
+ if ( !user_lexer ) {
+ printf("\n");
+ printf("%s%s : $(ANTLR_H)%s%s\n", DIR(), DLEXERBASE_O, DirectorySymbol, DLEXERBASE_C);
+ printf("\t%s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG);
+ printf("%s%s $(ANTLR_H)%s%s\n", DIR(), DLEXERBASE_O, DirectorySymbol, DLEXERBASE_C);
+ }
+ if ( gen_trees ) {
+ printf("\n");
+ printf("%s%s : $(ANTLR_H)%s%s\n", DIR(), ASTBASE_O, DirectorySymbol, ASTBASE_C);
+ printf("\t%s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG);
+ printf("%s%s $(ANTLR_H)%s%s\n", DIR(), ASTBASE_O, DirectorySymbol, ASTBASE_C);
+ printf("\n");
+ printf("%s%s : $(ANTLR_H)%s%s\n", DIR(), PCCTSAST_O, DirectorySymbol, PCCTSAST_C);
+ printf("\t%s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG);
+ printf("%s%s $(ANTLR_H)%s%s\n", DIR(), PCCTSAST_O, DirectorySymbol, PCCTSAST_C);
+ printf("\n");
+/*
+ printf("%s%s : $(ANTLR_H)%s%s\n", DIR(), LIST_O, DirectorySymbol, LIST_C);
+ printf("\t%s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",RENAME_OBJ_FLAG);
+ printf("%s%s $(ANTLR_H)%s%s\n", DIR(), LIST_O, DirectorySymbol, LIST_C);
+*/
+ }
+ }
+
+ /* clean and scrub targets */
+
+ printf("\nclean:\n");
+ printf("\trm -f *%s core %s", OBJ_FILE_SUFFIX, project);
+ if ( strcmp(outdir, ".")!=0 ) printf(" %s*%s", DIR(), OBJ_FILE_SUFFIX);
+ printf("\n");
+
+ printf("\nscrub: clean\n");
+/* printf("\trm -f *%s core %s", OBJ_FILE_SUFFIX, project); */
+/* if ( strcmp(outdir, ".")!=0 ) printf(" %s*%s", DIR(), OBJ_FILE_SUFFIX); */
+ printf("\trm -f $(ANTLR_SPAWN)");
+ if ( !user_lexer ) printf(" $(DLG_SPAWN)");
+ for (i=0;i<num_sors;i++)
+ {
+ printf(" ");
+ if ( gen_CPP ) pfiles(&sfiles[i][0], num_sfiles[i], CPP_FILE_SUFFIX_NO_DOT);
+ else pfiles(&sfiles[i][0], num_sfiles[i], "c");
+ if ( gen_CPP )
+ {
+ printf(" ");
+ pclasses(&sclasses[i], 1, CPP_FILE_SUFFIX_NO_DOT);
+ printf(" ");
+ pclasses(&sclasses[i], 1, "h");
+ }
+ }
+ printf("\n\n");
+}
+
+#ifdef __STDC__
+void pfiles(char **files, int n, char *suffix)
+#else
+void pfiles(files, n, suffix)
+char **files;
+int n;
+char *suffix;
+#endif
+{
+ int first=1;
+
+ while ( n>0 )
+ {
+ char *p = &(*files)[strlen(*files)-1];
+ if ( !first ) putchar(' ');
+ first=0;
+ while ( p > *files && *p != '.' ) --p;
+ if ( p == *files )
+ {
+ fprintf(stderr,
+ "genmk: filenames must be file.suffix format: %s\n",
+ *files);
+ exit(-1);
+ }
+ if ( suffix == NULL ) printf("%s", *files);
+ else
+ {
+ *p = '\0';
+ printf("%s", DIR());
+ if ( strcmp(suffix, "o")==0 ) printf("%s%s", *files, OBJ_FILE_SUFFIX);
+ else printf("%s.%s", *files, suffix);
+ *p = '.';
+ }
+ files++;
+ --n;
+ }
+}
+
+#ifdef __STDC__
+pclasses(char **classes, int n, char *suffix)
+#else
+pclasses(classes, n, suffix)
+char **classes;
+int n;
+char *suffix;
+#endif
+{
+ int first=1;
+
+ while ( n>0 )
+ {
+ if ( !first ) putchar(' ');
+ first=0;
+ if ( suffix == NULL ) printf("%s", *classes);
+ else {
+ printf("%s", DIR());
+ if ( strcmp(suffix, "o")==0 ) printf("%s%s", *classes, OBJ_FILE_SUFFIX);
+ else printf("%s.%s", *classes, suffix);
+ }
+ classes++;
+ --n;
+ }
+}
+
+static void
+#ifdef __STDC__
+ProcessArgs( int argc, char **argv, Opt *options )
+#else
+ProcessArgs( argc, argv, options )
+int argc;
+char **argv;
+Opt *options;
+#endif
+{
+ Opt *p;
+ require(argv!=NULL, "ProcessArgs: command line NULL");
+
+ while ( argc-- > 0 )
+ {
+ p = options;
+ while ( p->option != NULL )
+ {
+ if ( strcmp(p->option, "*") == 0 ||
+ strcmp(p->option, *argv) == 0 )
+ {
+ if ( p->arg )
+ {
+ (*p->process)( *argv, *(argv+1) );
+ argv++;
+ argc--;
+ }
+ else
+ (*p->process)( *argv );
+ break;
+ }
+ p++;
+ }
+ argv++;
+ }
+}
+
+#ifdef __STDC__
+void fatal( char *err_)
+#else
+void fatal( err_)
+char *err_;
+#endif
+{
+ fprintf(stderr, "genmk: %s\n", err_);
+ exit(1);
+}
+
+#ifdef __STDC__
+void warn( char *err_)
+#else
+void warn( err_)
+char *err_;
+#endif
+{
+ fprintf(stderr, "genmk: %s\n", err_);
+}
+
+#ifdef __STDC__
+char *DIR(void)
+#else
+char *DIR()
+#endif
+{
+ static char buf[200+1];
+
+ if ( strcmp(outdir,TopDirectory)==0 ) return "";
+ sprintf(buf, "%s%s", outdir, DirectorySymbol);
+ return buf;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/genmk/genmk_old.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/genmk/genmk_old.c
new file mode 100644
index 000000000..2cf9fad72
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/genmk/genmk_old.c
@@ -0,0 +1,762 @@
+/*
+ * genmk -- a program to make makefiles for PCCTS
+ *
+ * ANTLR 1.33MR10
+ * Terence John Parr 1989 - 1998
+ * Purdue University
+ * U of MN
+ */
+
+#include <stdio.h>
+#include "pcctscfg.h" /* be sensitive to what ANTLR/DLG call the files */
+
+#ifdef VAXC
+#define DIE return 0;
+#define DONE return 1;
+#else
+#define DIE return 1;
+#define DONE return 0;
+#endif
+
+#ifndef require
+#define require(expr, err) {if ( !(expr) ) fatal(err);}
+#endif
+
+#define MAX_FILES 50
+#define MAX_CLASSES 50
+
+char *RENAME_OBJ_FLAG="-o",
+ *RENAME_EXE_FLAG="-o";
+
+char *dlg = "parser.dlg";
+char *err = "err.c";
+char *hdr = "stdpccts.h";
+char *tok = "tokens.h";
+char *mode = "mode.h";
+char *scan = "scan";
+
+char ATOKENBUFFER_O[100];
+char APARSER_O[100];
+char ASTBASE_O[100];
+char PCCTSAST_O[100];
+char LIST_O[100];
+char DLEXERBASE_O[100];
+
+/* Option flags */
+static char *project="t", *files[MAX_FILES], *classes[MAX_CLASSES];
+static int num_files = 0;
+static int num_classes = 0;
+static int user_lexer = 0;
+static char *user_token_types = NULL;
+static int gen_CPP = 0;
+static char *outdir=".";
+static char *dlg_class = "DLGLexer";
+static int gen_trees = 0;
+static int gen_hoist = 0;
+static char cfiles[1600]="";
+static char *compilerCCC="CC";
+static char *compilerCC="cc";
+static char *pccts_path="/usr/local/pccts";
+
+void help();
+void mk();
+void pfiles();
+void pclasses();
+void fatal();
+void warn();
+
+typedef struct _Opt {
+ char *option;
+ int arg;
+#ifdef __cplusplus
+ void (*process)(...);
+#else
+ void (*process)();
+#endif
+ char *descr;
+ } Opt;
+
+#ifdef __STDC__
+static void ProcessArgs(int, char **, Opt *);
+#else
+static void ProcessArgs();
+#endif
+
+static void
+pProj( s, t )
+char *s;
+char *t;
+{
+ project = t;
+}
+
+static void
+pUL( s )
+char *s;
+{
+ user_lexer = 1;
+}
+
+static void
+pCPP( s )
+char *s;
+{
+ gen_CPP = 1;
+}
+
+static void
+pUT( s, t )
+char *s;
+char *t;
+{
+ user_token_types = t;
+}
+
+static void
+pTrees( s )
+char *s;
+{
+ gen_trees = 1;
+}
+
+static void
+pHoist( s )
+char *s;
+{
+ gen_hoist = 1;
+}
+
+static void
+#ifdef __STDC__
+pFile( char *s )
+#else
+pFile( s )
+char *s;
+#endif
+{
+ if ( *s=='-' )
+ {
+ fprintf(stderr, "invalid option: '%s'; ignored...",s);
+ return;
+ }
+
+ require(num_files<MAX_FILES, "exceeded max # of input files");
+ files[num_files++] = s;
+}
+
+static void
+#ifdef __STDC__
+pClass( char *s, char *t )
+#else
+pClass( s, t )
+char *s;
+char *t;
+#endif
+{
+ require(num_classes<MAX_CLASSES, "exceeded max # of grammar classes");
+ classes[num_classes++] = t;
+}
+
+static void
+#ifdef __STDC__
+pDLGClass( char *s, char *t )
+#else
+pDLGClass( s, t )
+char *s;
+char *t;
+#endif
+{
+ if ( !gen_CPP ) {
+ fprintf(stderr, "-dlg-class makes no sense without C++ mode; ignored...");
+ }
+ else dlg_class = t;
+}
+
+static void
+#ifdef __STDC__
+pOdir( char *s, char *t )
+#else
+pOdir( s, t )
+char *s;
+char *t;
+#endif
+{
+ outdir = t;
+}
+
+static void
+#ifdef __STDC__
+pHdr( char *s, char *t )
+#else
+pHdr( s, t )
+char *s;
+char *t;
+#endif
+{
+ hdr = t;
+}
+
+static void
+#ifdef __STDC__
+pCFiles( char *s, char *t )
+#else
+pCFiles( s, t )
+char *s;
+char *t;
+#endif
+{
+ strcat(strcat(cfiles," "), t);
+}
+
+static void
+#ifdef __STDC__
+pCompiler( char *s, char *t )
+#else
+pCompiler( s, t )
+char *s;
+char *t;
+#endif
+{
+ compilerCCC = t;
+ compilerCC = t;
+}
+
+static void
+#ifdef __STDC__
+ppccts_path( char *s, char *t )
+#else
+ppccts_path( s, t )
+char *s;
+char *t;
+#endif
+{
+ pccts_path = t;
+}
+
+Opt options[] = {
+ { "-CC", 0, pCPP, "Generate C++ output"},
+ { "-class", 1, pClass, "Name of a grammar class defined in grammar (if C++)"},
+ { "-dlg-class", 1,pDLGClass,"Name of DLG lexer class (default=DLGLexer) (if C++)"},
+ { "-header", 1,pHdr, "Name of ANTLR standard header info (default=no file)"},
+ { "-o", 1, pOdir, "Directory where output files should go (default=\".\")"},
+ { "-project", 1, pProj, "Name of executable to create (default=t)"},
+ { "-token-types", 1, pUT, "Token types are in this file (don't use tokens.h)"},
+ { "-trees", 0, pTrees, "Generate ASTs"},
+ { "-user-lexer", 0, pUL, "Do not create a DLG-based scanner"},
+ { "-mrhoist",0,pHoist, "Maintenance release style hoisting"},
+ { "-cfiles",1,pCFiles, "Additional files in C or C++ to compile"},
+ { "-pccts_path",1,ppccts_path,
+ "Path for $PCCTS directory (default is /usr/local/pccts)"},
+ { "-compiler",1,pCompiler,
+ "Default compiler (default is CC/cc)"},
+ { "*", 0,pFile, "" }, /* anything else is a file */
+ { NULL, 0, NULL, NULL }
+};
+
+extern char *DIR();
+
+int main(argc, argv)
+int argc;
+char **argv;
+{
+ if ( argc == 1 ) { help(); DIE; }
+ ProcessArgs(argc-1, &(argv[1]), options);
+
+ strcpy(ATOKENBUFFER_O, ATOKENBUFFER_C);
+ ATOKENBUFFER_O[strlen(ATOKENBUFFER_C)-strlen(CPP_FILE_SUFFIX)] = '\0';
+ strcat(ATOKENBUFFER_O, OBJ_FILE_SUFFIX);
+ strcpy(APARSER_O, APARSER_C);
+ APARSER_O[strlen(APARSER_O)-strlen(CPP_FILE_SUFFIX)] = '\0';
+ strcat(APARSER_O, OBJ_FILE_SUFFIX);
+
+ strcpy(ASTBASE_O, ASTBASE_C);
+ ASTBASE_O[strlen(ASTBASE_C)-strlen(CPP_FILE_SUFFIX)] = '\0';
+ strcat(ASTBASE_O, OBJ_FILE_SUFFIX);
+
+ strcpy(PCCTSAST_O, PCCTSAST_C);
+ PCCTSAST_O[strlen(PCCTSAST_C)-strlen(CPP_FILE_SUFFIX)] = '\0';
+ strcat(PCCTSAST_O, OBJ_FILE_SUFFIX);
+
+ strcpy(LIST_O, LIST_C);
+ LIST_O[strlen(LIST_C)-strlen(CPP_FILE_SUFFIX)] = '\0';
+ strcat(LIST_O, OBJ_FILE_SUFFIX);
+
+ strcpy(DLEXERBASE_O, DLEXERBASE_C);
+ DLEXERBASE_O[strlen(DLEXERBASE_C)-strlen(CPP_FILE_SUFFIX)] = '\0';
+ strcat(DLEXERBASE_O, OBJ_FILE_SUFFIX);
+
+ if ( num_files == 0 ) fatal("no grammar files specified; exiting...");
+ if ( !gen_CPP && num_classes>0 ) {
+ warn("can't define classes w/o C++ mode; turning on C++ mode...\n");
+ gen_CPP=1;
+ }
+ if ( gen_CPP && num_classes==0 ) {
+ fatal("must define classes >0 grammar classes in C++ mode\n");
+ }
+
+ mk(project, files, num_files, argc, argv);
+ DONE;
+}
+
+void help()
+{
+ Opt *p = options;
+ static char buf[1000+1];
+
+ fprintf(stderr, "genmk [options] f1.g ... fn.g\n");
+ while ( p->option!=NULL && *(p->option) != '*' )
+ {
+ buf[0]='\0';
+ if ( p->arg ) sprintf(buf, "%s ___", p->option);
+ else strcpy(buf, p->option);
+ fprintf(stderr, "\t%-16s %s\n", buf, p->descr);
+ p++;
+ }
+}
+
+void mk(project, files, n, argc, argv)
+char *project;
+char **files;
+int n;
+int argc;
+char **argv;
+{
+ int i;
+
+ printf("#\n");
+ printf("# PCCTS makefile for: ");
+ pfiles(files, n, NULL);
+ printf("\n");
+ printf("#\n");
+ printf("# Created from:");
+ for (i=0; i<argc; i++) printf(" %s", argv[i]);
+ printf("\n");
+ printf("#\n");
+ printf("# PCCTS release 1.33MR21\n");
+ printf("# Project: %s\n", project);
+ if ( gen_CPP ) printf("# C++ output\n");
+ else printf("# C output\n");
+ if ( user_lexer ) printf("# User-defined scanner\n");
+ else printf("# DLG scanner\n");
+ if ( user_token_types!=NULL ) printf("# User-defined token types in '%s'\n", user_token_types);
+ else printf("# ANTLR-defined token types\n");
+ printf("#\n");
+ printf(".SUFFIXES:\n.SUFFIXES: .o .cpp .c .h .g .i .dlg\n");
+ if ( user_token_types!=NULL ) {
+ printf("# Make sure #tokdefs directive in ANTLR grammar lists this file:\n");
+ printf("TOKENS = %s", user_token_types);
+ }
+ else printf("TOKENS = %stokens.h", DIR());
+ printf("\n");
+ printf("#\n");
+ printf("# The following filenames must be consistent with ANTLR/DLG flags\n");
+ printf("DLG_FILE = %s%s\n", DIR(), dlg);
+ printf("ERR = %serr\n", DIR());
+ if ( strcmp(hdr,"stdpccts.h")!=0 ) printf("HDR_FILE = %s%s\n", DIR(), hdr);
+ else printf("HDR_FILE =\n");
+ if ( !gen_CPP ) printf("MOD_FILE = %s%s\n", DIR(), mode);
+ if ( !gen_CPP ) printf("SCAN = %s\n", scan);
+ else printf("SCAN = %s%s\n", DIR(), dlg_class);
+
+ printf("PCCTS = %s\n",pccts_path);
+ printf("ANTLR_H = $(PCCTS)%sh\n", DirectorySymbol);
+ printf("BIN = $(PCCTS)%sbin\n", DirectorySymbol);
+ printf("ANTLR = $(BIN)%santlr\n", DirectorySymbol);
+ printf("DLG = $(BIN)%sdlg\n", DirectorySymbol);
+ printf("CFLAGS = -I. -I$(ANTLR_H)");
+ if ( strcmp(outdir, ".")!=0 ) printf(" -I%s", outdir);
+ printf(" $(COTHER)");
+ printf("\n");
+ printf("AFLAGS =");
+ if ( strcmp(outdir,".")!=0 ) printf(" -o %s", outdir);
+ if ( user_lexer ) printf(" -gx");
+ if ( gen_CPP ) printf(" -CC");
+ if ( strcmp(hdr,"stdpccts.h")!=0 ) printf(" -gh %s", hdr);
+ if ( gen_trees ) printf(" -gt");
+ if ( gen_hoist ) {
+ printf(" -mrhoist on") ;
+ } else {
+ printf(" -mrhoist off");
+ };
+ printf(" $(AOTHER)");
+ printf("\n");
+ printf("DFLAGS = -C2 -i");
+ if ( gen_CPP ) printf(" -CC");
+ if ( strcmp(dlg_class,"DLGLexer")!=0 ) printf(" -cl %s", dlg_class);
+ if ( strcmp(outdir,".")!=0 ) printf(" -o %s", outdir);
+ printf(" $(DOTHER)");
+ printf("\n");
+ printf("GRM = ");
+ pfiles(files, n, NULL);
+ printf("\n");
+ printf("MYFILES = %s\n",cfiles);
+ printf("SRC = ");
+ if ( gen_CPP ) pfiles(files, n, CPP_FILE_SUFFIX_NO_DOT);
+ else pfiles(files, n, "c");
+ if ( gen_CPP ) {
+ printf(" \\\n ");
+ printf(" ");
+ pclasses(classes, num_classes, CPP_FILE_SUFFIX_NO_DOT);
+ printf(" \\\n ");
+ printf("$(ANTLR_H)%s%s", DirectorySymbol, APARSER_C);
+ if ( !user_lexer ) printf(" $(ANTLR_H)%s%s", DirectorySymbol, DLEXERBASE_C);
+ if ( gen_trees ) {
+ printf(" \\\n ");
+ printf("$(ANTLR_H)%s%s", DirectorySymbol, ASTBASE_C);
+ printf(" $(ANTLR_H)%s%s", DirectorySymbol, PCCTSAST_C);
+/* printf(" $(ANTLR_H)%s%s", DirectorySymbol, LIST_C); */
+ printf(" \\\n ");
+ }
+ printf(" $(ANTLR_H)%s%s", DirectorySymbol, ATOKENBUFFER_C);
+ }
+ if ( !user_lexer ) {
+ if ( gen_CPP ) printf(" $(SCAN)%s", CPP_FILE_SUFFIX);
+ else printf(" %s$(SCAN).c", DIR());
+ }
+ if ( !gen_CPP ) printf(" $(ERR).c");
+ printf("\\\n $(MYFILES)\n");
+ printf("OBJ = ");
+ pfiles(files, n, "o");
+ if ( gen_CPP ) {
+ printf(" \\\n ");
+ printf(" ");
+ pclasses(classes, num_classes, "o");
+ printf(" \\\n ");
+ printf(" %s%s", DIR(), APARSER_O);
+ if ( !user_lexer ) {
+ printf(" %s%s", DIR(), DLEXERBASE_O);
+ }
+ if ( gen_trees ) {
+ printf(" \\\n ");
+ printf("%s%s", DIR(), ASTBASE_O);
+ printf(" %s%s", DIR(), PCCTSAST_O);
+/* printf(" %s%s", DIR(), LIST_O); */
+ printf(" \\\n ");
+ }
+ printf(" %s%s", DIR(), ATOKENBUFFER_O);
+ }
+ if ( !user_lexer ) {
+ if ( gen_CPP ) printf(" $(SCAN)%s", OBJ_FILE_SUFFIX);
+ else printf(" %s$(SCAN)%s", DIR(), OBJ_FILE_SUFFIX);
+ }
+ if ( !gen_CPP ) printf(" $(ERR)%s", OBJ_FILE_SUFFIX);
+ printf("\\\n $(MYFILES:.cpp=.o)\n");
+
+ printf("ANTLR_SPAWN = ");
+ if ( gen_CPP ) pfiles(files, n, CPP_FILE_SUFFIX_NO_DOT);
+ else pfiles(files, n, "c");
+ if ( gen_CPP ) {
+ printf(" ");
+ pclasses(classes, num_classes, CPP_FILE_SUFFIX_NO_DOT);
+ printf(" \\\n ");
+ pclasses(classes, num_classes, "h");
+ if ( strcmp(hdr,"stdpccts.h")!=0 ) {
+ printf(" \\\n ");
+ printf("$(HDR_FILE) stdpccts.h");
+ }
+ }
+ if ( user_lexer ) {
+ if ( !user_token_types ) printf(" $(TOKENS)");
+ }
+ else {
+ printf(" $(DLG_FILE)");
+ if ( !user_token_types ) printf(" $(TOKENS)");
+ }
+ if ( !gen_CPP ) printf(" $(ERR).c");
+ printf("\n");
+
+ if ( !user_lexer ) {
+ if ( gen_CPP ) printf("DLG_SPAWN = $(SCAN)%s", CPP_FILE_SUFFIX);
+ else printf("DLG_SPAWN = %s$(SCAN).c", DIR());
+ if ( gen_CPP ) printf(" $(SCAN).h");
+ if ( !gen_CPP ) printf(" $(MOD_FILE)");
+ printf("\n");
+ }
+
+ if ( gen_CPP ) {
+ printf("CCC = %s\n",compilerCCC);
+ }
+ else printf("CC = %s\n",compilerCC);
+
+ /* set up dependencies */
+ printf("\n%s : $(OBJ) $(SRC)\n", project);
+ printf(" %s %s %s $(CFLAGS) $(OBJ)\n",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_EXE_FLAG,
+ project);
+ printf("\n");
+
+ /* implicit rules */
+
+ if(gen_CPP)
+ printf("%%.o : %%.cpp\n\t$(CCC) -c $(CFLAGS) $<\n\n");
+
+ printf("%%.o : %%.c\n\t%s -c $(CFLAGS) $<\n\n",
+ gen_CPP?"$(CCC)":"$(CC)");
+
+ /* how to compile parser files */
+
+ for (i=0; i<num_files; i++)
+ {
+ pfiles(&files[i], 1, "o");
+ if ( user_lexer ) {
+ printf(" : $(TOKENS)");
+ }
+ else {
+ if ( gen_CPP ) printf(" : $(TOKENS) $(SCAN).h");
+ else printf(" : $(MOD_FILE) $(TOKENS)");
+ }
+ printf(" ");
+ if ( gen_CPP ) pfiles(&files[i], 1, CPP_FILE_SUFFIX_NO_DOT);
+ else pfiles(&files[i], 1, "c");
+ if ( gen_CPP && strcmp(hdr,"stdpccts.h")!=0 ) printf(" $(HDR_FILE)");
+ printf("\n");
+ printf(" %s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",RENAME_OBJ_FLAG);
+ pfiles(&files[i], 1, "o");
+ printf(" ");
+ if ( gen_CPP ) pfiles(&files[i], 1, CPP_FILE_SUFFIX_NO_DOT);
+ else pfiles(&files[i], 1, "c");
+ printf("\n\n");
+ }
+
+ /* how to compile err.c */
+ if ( !gen_CPP ) {
+ printf("$(ERR)%s : $(ERR).c", OBJ_FILE_SUFFIX);
+ if ( !user_lexer ) printf(" $(TOKENS)");
+ printf("\n");
+ printf(" %s -c $(CFLAGS) %s $(ERR)%s $(ERR).c",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG,
+ OBJ_FILE_SUFFIX);
+ printf("\n\n");
+ }
+
+ /* how to compile Class.c */
+ for (i=0; i<num_classes; i++)
+ {
+ pclasses(&classes[i], 1, "o");
+ if ( user_lexer ) {
+ printf(" : $(TOKENS)");
+ }
+ else {
+ printf(" : $(TOKENS) $(SCAN).h");
+ }
+ printf(" ");
+ pclasses(&classes[i], 1, CPP_FILE_SUFFIX_NO_DOT);
+ printf(" ");
+ pclasses(&classes[i], 1, "h");
+ if ( gen_CPP && strcmp(hdr,"stdpccts.h")!=0 ) printf(" $(HDR_FILE)");
+ printf("\n");
+ printf(" %s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG);
+ pclasses(&classes[i], 1, "o");
+ printf(" ");
+ pclasses(&classes[i], 1, CPP_FILE_SUFFIX_NO_DOT);
+ printf("\n\n");
+ }
+
+ /* how to compile scan.c */
+ if ( !user_lexer ) {
+ if ( gen_CPP ) printf("$(SCAN)%s : $(SCAN)%s", OBJ_FILE_SUFFIX, CPP_FILE_SUFFIX);
+ else printf("%s$(SCAN)%s : %s$(SCAN).c", DIR(), OBJ_FILE_SUFFIX, DIR());
+ if ( !user_lexer ) printf(" $(TOKENS)");
+ printf("\n");
+ if ( gen_CPP ) printf(" $(CCC) -c $(CFLAGS) %s $(SCAN)%s $(SCAN)%s",
+ RENAME_OBJ_FLAG,
+ OBJ_FILE_SUFFIX,
+ CPP_FILE_SUFFIX);
+ else printf(" $(CC) -c $(CFLAGS) %s %s$(SCAN)%s %s$(SCAN).c",
+ RENAME_OBJ_FLAG,
+ DIR(),
+ OBJ_FILE_SUFFIX,
+ DIR());
+ printf("\n\n");
+ }
+
+ printf("$(ANTLR_SPAWN) : $(GRM)\n");
+ printf(" $(ANTLR) $(AFLAGS) $(GRM)\n");
+
+ if ( !user_lexer )
+ {
+ printf("\n");
+ printf("$(DLG_SPAWN) : $(DLG_FILE)\n");
+ if ( gen_CPP ) printf(" $(DLG) $(DFLAGS) $(DLG_FILE)\n");
+ else printf(" $(DLG) $(DFLAGS) $(DLG_FILE) $(SCAN).c\n");
+ }
+
+ /* do the makes for ANTLR/DLG support */
+ if ( gen_CPP ) {
+ printf("\n");
+ printf("%s%s : $(ANTLR_H)%s%s\n", DIR(), APARSER_O, DirectorySymbol, APARSER_C);
+ printf(" %s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG);
+ printf("%s%s $(ANTLR_H)%s%s\n", DIR(), APARSER_O, DirectorySymbol, APARSER_C);
+ printf("\n");
+ printf("%s%s : $(ANTLR_H)%s%s\n", DIR(), ATOKENBUFFER_O, DirectorySymbol, ATOKENBUFFER_C);
+ printf(" %s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG);
+ printf("%s%s $(ANTLR_H)%s%s\n", DIR(), ATOKENBUFFER_O, DirectorySymbol, ATOKENBUFFER_C);
+ if ( !user_lexer ) {
+ printf("\n");
+ printf("%s%s : $(ANTLR_H)%s%s\n", DIR(), DLEXERBASE_O, DirectorySymbol, DLEXERBASE_C);
+ printf(" %s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG);
+ printf("%s%s $(ANTLR_H)%s%s\n", DIR(), DLEXERBASE_O, DirectorySymbol, DLEXERBASE_C);
+ }
+ if ( gen_trees ) {
+ printf("\n");
+ printf("%s%s : $(ANTLR_H)%s%s\n", DIR(), ASTBASE_O, DirectorySymbol, ASTBASE_C);
+ printf(" %s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG);
+ printf("%s%s $(ANTLR_H)%s%s\n", DIR(), ASTBASE_O, DirectorySymbol, ASTBASE_C);
+ printf("\n");
+ printf("%s%s : $(ANTLR_H)%s%s\n", DIR(), PCCTSAST_O, DirectorySymbol, PCCTSAST_C);
+ printf(" %s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",
+ RENAME_OBJ_FLAG);
+ printf("%s%s $(ANTLR_H)%s%s\n", DIR(), PCCTSAST_O, DirectorySymbol, PCCTSAST_C);
+ printf("\n");
+/*
+ printf("%s%s : $(ANTLR_H)%s%s\n", DIR(), LIST_O, DirectorySymbol, LIST_C);
+ printf(" %s -c $(CFLAGS) %s ",
+ gen_CPP?"$(CCC)":"$(CC)",RENAME_OBJ_FLAG);
+ printf("%s%s $(ANTLR_H)%s%s\n", DIR(), LIST_O, DirectorySymbol, LIST_C);
+*/
+ }
+ }
+
+ /* clean and scrub targets */
+
+ printf("\nclean:\n");
+ printf(" rm -f *%s core %s", OBJ_FILE_SUFFIX, project);
+ if ( strcmp(outdir, ".")!=0 ) printf(" %s*%s", DIR(), OBJ_FILE_SUFFIX);
+ printf("\n");
+
+ printf("\nscrub:\n");
+ printf(" rm -f *%s core %s", OBJ_FILE_SUFFIX, project);
+ if ( strcmp(outdir, ".")!=0 ) printf(" %s*%s", DIR(), OBJ_FILE_SUFFIX);
+ printf(" $(ANTLR_SPAWN)");
+ if ( !user_lexer ) printf(" $(DLG_SPAWN)");
+ printf("\n");
+}
+
+void pfiles(files, n, suffix)
+char **files;
+int n;
+char *suffix;
+{
+ int first=1;
+
+ while ( n>0 )
+ {
+ char *p = &(*files)[strlen(*files)-1];
+ if ( !first ) putchar(' ');
+ first=0;
+ while ( p > *files && *p != '.' ) --p;
+ if ( p == *files )
+ {
+ fprintf(stderr,
+ "genmk: filenames must be file.suffix format: %s\n",
+ *files);
+ exit(-1);
+ }
+ if ( suffix == NULL ) printf("%s", *files);
+ else
+ {
+ *p = '\0';
+ printf("%s", DIR());
+ if ( strcmp(suffix, "o")==0 ) printf("%s%s", *files, OBJ_FILE_SUFFIX);
+ else printf("%s.%s", *files, suffix);
+ *p = '.';
+ }
+ files++;
+ --n;
+ }
+}
+
+void pclasses(classes, n, suffix)
+char **classes;
+int n;
+char *suffix;
+{
+ int first=1;
+
+ while ( n>0 )
+ {
+ if ( !first ) putchar(' ');
+ first=0;
+ if ( suffix == NULL ) printf("%s", *classes);
+ else {
+ printf("%s", DIR());
+ if ( strcmp(suffix, "o")==0 ) printf("%s%s", *classes, OBJ_FILE_SUFFIX);
+ else printf("%s.%s", *classes, suffix);
+ }
+ classes++;
+ --n;
+ }
+}
+
+static void
+#ifdef __STDC__
+ProcessArgs( int argc, char **argv, Opt *options )
+#else
+ProcessArgs( argc, argv, options )
+int argc;
+char **argv;
+Opt *options;
+#endif
+{
+ Opt *p;
+ require(argv!=NULL, "ProcessArgs: command line NULL");
+
+ while ( argc-- > 0 )
+ {
+ p = options;
+ while ( p->option != NULL )
+ {
+ if ( strcmp(p->option, "*") == 0 ||
+ strcmp(p->option, *argv) == 0 )
+ {
+ if ( p->arg )
+ {
+ (*p->process)( *argv, *(argv+1) );
+ argv++;
+ argc--;
+ }
+ else
+ (*p->process)( *argv );
+ break;
+ }
+ p++;
+ }
+ argv++;
+ }
+}
+
+void fatal( err_)
+char *err_;
+{
+ fprintf(stderr, "genmk: %s\n", err_);
+ exit(1);
+}
+
+void warn( err_)
+char *err_;
+{
+ fprintf(stderr, "genmk: %s\n", err_);
+}
+
+char *DIR()
+{
+ static char buf[200+1];
+
+ if ( strcmp(outdir,TopDirectory)==0 ) return "";
+ sprintf(buf, "%s%s", outdir, DirectorySymbol);
+ return buf;
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/genmk/makefile b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/genmk/makefile
new file mode 100644
index 000000000..a003c2f32
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/genmk/makefile
@@ -0,0 +1,29 @@
+##
+## 7-Apr-97
+## added support/genmk/makefile to pccts 1.33MR1 distribution kit
+## (support/genmk/makefile" omitted from 1.33 distribution kit)
+##
+SRC=genmk.c
+OBJ=genmk.o
+# Define PC if you use a PC OS (changes directory symbol and object file extension)
+# see pccts/h/pcctscfg.h
+CC=cc
+COPT=-O
+#CFLAGS=-I../../h -DPC
+CFLAGS=$(COPT) -I../../h
+BAG=../../bin/bag
+
+genmk: $(OBJ) $(SRC) ../../h/pcctscfg.h
+ $(CC) -o genmk $(OBJ)
+
+clean:
+ rm -rf core *.o
+
+scrub:
+ rm -rf genmk core *.o
+
+shar:
+ shar genmk.c makefile > genmk.shar
+
+archive:
+ $(BAG) genmk.c makefile > genmk.bag
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/makefile b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/makefile
new file mode 100644
index 000000000..44caef1aa
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/makefile
@@ -0,0 +1,19 @@
+BAG=../../bin/bag
+SRC=test.c rexpr.c
+OBJ=test.o rexpr.o
+CFLAGS = -g
+
+test: $(OBJ) $(SRC)
+ cc -g -o texpr $(OBJ)
+
+shar:
+ shar makefile test.c rexpr.c rexpr.h > rexpr.shar
+
+archive:
+ $(BAG) makefile test.c rexpr.c rexpr.h > rexpr.bag
+
+clean:
+ rm -rf *.o core texpr
+
+scrub:
+ rm -rf *.o core texpr
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/rexpr.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/rexpr.c
new file mode 100644
index 000000000..805bf6553
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/rexpr.c
@@ -0,0 +1,586 @@
+/*
+ * This file contains code for
+ *
+ * int rexpr(char *expr, char *s);
+ *
+ * which answers
+ *
+ * 1 if 's' is in the language described by the regular expression 'expr'
+ * 0 if it is not
+ * -1 if the regular expression is invalid
+ *
+ * Language membership is determined by constructing a non-deterministic
+ * finite automata (NFA) from the regular expression. A depth-
+ * first-search is performed on the NFA (graph) to check for a match of 's'.
+ * Each non-epsilon arc consumes one character from 's'. Backtracking is
+ * performed to check all possible paths through the NFA.
+ *
+ * Regular expressions follow the meta-language:
+ *
+ * <regExpr> ::= <andExpr> ( '|' <andExpr> )*
+ *
+ * <andExpr> ::= <expr> ( <expr> )*
+ *
+ * <expr> ::= {'~'} '[' <atomList> ']' <repeatSymbol>
+ * | '(' <regExpr> ')' <repeatSymbol>
+ * | '{' <regExpr> '}' <repeatSymbol>
+ * | <atom> <repeatSymbol>
+ *
+ * <repeatSymbol> ::= { '*' | '+' }
+ *
+ * <atomList> ::= <atom> ( <atom> )*
+ * | { <atomList> } <atom> '-' <atom> { <atomList> }
+ *
+ * <atom> ::= Token[Atom]
+ *
+ * Notes:
+ * ~ means complement the set in [..]. i.e. all characters not listed
+ * * means match 0 or more times (can be on expression or atom)
+ * + means match 1 or more times (can be on expression or atom)
+ * {} optional
+ * () grouping
+ * [] set of atoms
+ * x-y all characters from x to y (found only in [..])
+ * \xx the character with value xx
+ *
+ * Examples:
+ * [a-z]+
+ * match 1 or more lower-case letters (e.g. variable)
+ *
+ * 0x[0-9A-Fa-f]+
+ * match a hex number with 0x on front (e.g. 0xA1FF)
+ *
+ * [0-9]+.[0-9]+{e[0-9]+}
+ * match a floating point number (e.g. 3.14e21)
+ *
+ * Code example:
+ * if ( rexpr("[a-zA-Z][a-zA-Z0-9]+", str) ) then str is keyword
+ *
+ * Terence Parr
+ * Purdue University
+ * April 1991
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+#ifdef __STDC__
+#include <stdlib.h>
+#else
+#include <malloc.h>
+#endif
+#include "rexpr.h"
+
+#ifdef __USE_PROTOS
+static int regExpr( GraphPtr g );
+static int andExpr( GraphPtr g );
+static int expr( GraphPtr g );
+static int repeatSymbol( GraphPtr g );
+static int atomList( char *p, int complement );
+static void next( void );
+static ArcPtr newGraphArc( void );
+static NodePtr newNode( void );
+static int ArcBetweenGraphNode( NodePtr i, NodePtr j, int label );
+static Graph BuildNFA_atom( int label );
+static Graph BuildNFA_AB( Graph A, Graph B );
+static Graph BuildNFA_AorB( Graph A, Graph B );
+static Graph BuildNFA_set( char *s );
+static Graph BuildNFA_Astar( Graph A );
+static Graph BuildNFA_Aplus( Graph A );
+static Graph BuildNFA_Aoptional( Graph A );
+#else
+static int regExpr();
+static int andExpr();
+static int expr();
+static int repeatSymbol();
+static int atomList();
+static void next();
+static ArcPtr newGraphArc();
+static NodePtr newNode();
+static int ArcBetweenGraphNode();
+static Graph BuildNFA_atom();
+static Graph BuildNFA_AB();
+static Graph BuildNFA_AorB();
+static Graph BuildNFA_set();
+static Graph BuildNFA_Astar();
+static Graph BuildNFA_Aplus();
+static Graph BuildNFA_Aoptional();
+#endif
+
+static char *_c;
+static int token, tokchar;
+static NodePtr accept;
+static NodePtr freelist = NULL;
+
+/*
+ * return 1 if s in language described by expr
+ * 0 if s is not
+ * -1 if expr is an invalid regular expression
+ */
+#ifdef __USE_PROTOS
+static int rexpr(char *expr,char *s)
+#else
+static int rexpr(expr, s)
+char *expr, *s;
+#endif
+{
+ NodePtr p,q;
+ Graph nfa;
+ int result;
+
+ fprintf(stderr, "rexpr(%s,%s);\n", expr,s);
+ freelist = NULL;
+ _c = expr;
+ next();
+ if ( regExpr(&nfa) == -1 ) return -1;
+ accept = nfa.right;
+ result = match(nfa.left, s);
+ /* free all your memory */
+ p = q = freelist;
+ while ( p!=NULL ) { q = p->track; free(p); p = q; }
+ return result;
+}
+
+/*
+ * do a depth-first-search on the NFA looking for a path from start to
+ * accept state labelled with the characters of 's'.
+ */
+
+#ifdef __USE_PROTOS
+static int match(NodePtr automaton,char *s)
+#else
+static int match(automaton, s)
+NodePtr automaton;
+char *s;
+#endif
+{
+ ArcPtr p;
+
+ if ( automaton == accept && *s == '\0' ) return 1; /* match */
+
+ for (p=automaton->arcs; p!=NULL; p=p->next) /* try all arcs */
+ {
+ if ( p->label == Epsilon )
+ {
+ if ( match(p->target, s) ) return 1;
+ }
+ else if ( p->label == *s )
+ if ( match(p->target, s+1) ) return 1;
+ }
+ return 0;
+}
+
+/*
+ * <regExpr> ::= <andExpr> ( '|' {<andExpr>} )*
+ *
+ * Return -1 if syntax error
+ * Return 0 if none found
+ * Return 1 if a regExrp was found
+ */
+
+#ifdef __USE_PROTOS
+static int regExpr(GraphPtr g)
+#else
+static int regExpr(g)
+GraphPtr g;
+#endif
+{
+ Graph g1, g2;
+
+ if ( andExpr(&g1) == -1 )
+ {
+ return -1;
+ }
+
+ while ( token == '|' )
+ {
+ int a;
+ next();
+ a = andExpr(&g2);
+ if ( a == -1 ) return -1; /* syntax error below */
+ else if ( !a ) return 1; /* empty alternative */
+ g1 = BuildNFA_AorB(g1, g2);
+ }
+
+ if ( token!='\0' ) return -1;
+
+ *g = g1;
+ return 1;
+}
+
+/*
+ * <andExpr> ::= <expr> ( <expr> )*
+ */
+
+#ifdef __USE_PROTOS
+static int andExpr(GraphPtr g)
+#else
+static int andExpr(g)
+GraphPtr g;
+#endif
+{
+ Graph g1, g2;
+
+ if ( expr(&g1) == -1 )
+ {
+ return -1;
+ }
+
+ while ( token==Atom || token=='{' || token=='(' || token=='~' || token=='[' )
+ {
+ if (expr(&g2) == -1) return -1;
+ g1 = BuildNFA_AB(g1, g2);
+ }
+
+ *g = g1;
+ return 1;
+}
+
+/*
+ * <expr> ::= {'~'} '[' <atomList> ']' <repeatSymbol>
+ * | '(' <regExpr> ')' <repeatSymbol>
+ * | '{' <regExpr> '}' <repeatSymbol>
+ * | <atom> <repeatSymbol>
+ */
+
+#ifdef __USE_PROTOS
+static int expr(GraphPtr g)
+#else
+static int expr(g)
+GraphPtr g;
+#endif
+{
+ int complement = 0;
+ char s[257]; /* alloc space for string of char in [] */
+
+ if ( token == '~' || token == '[' )
+ {
+ if ( token == '~' ) {complement = 1; next();}
+ if ( token != '[' ) return -1;
+ next();
+ if ( atomList( s, complement ) == -1 ) return -1;
+ *g = BuildNFA_set( s );
+ if ( token != ']' ) return -1;
+ next();
+ repeatSymbol( g );
+ return 1;
+ }
+ if ( token == '(' )
+ {
+ next();
+ if ( regExpr( g ) == -1 ) return -1;
+ if ( token != ')' ) return -1;
+ next();
+ repeatSymbol( g );
+ return 1;
+ }
+ if ( token == '{' )
+ {
+ next();
+ if ( regExpr( g ) == -1 ) return -1;
+ if ( token != '}' ) return -1;
+ next();
+ /* S p e c i a l C a s e O p t i o n a l { } */
+ if ( token != '*' && token != '+' )
+ {
+ *g = BuildNFA_Aoptional( *g );
+ }
+ repeatSymbol( g );
+ return 1;
+ }
+ if ( token == Atom )
+ {
+ *g = BuildNFA_atom( tokchar );
+ next();
+ repeatSymbol( g );
+ return 1;
+ }
+
+ return -1;
+}
+
+/*
+ * <repeatSymbol> ::= { '*' | '+' }
+ */
+#ifdef __USE_PROTOS
+static int repeatSymbol(GraphPtr g)
+#else
+static int repeatSymbol(g)
+GraphPtr g;
+#endif
+{
+ switch ( token )
+ {
+ case '*' : *g = BuildNFA_Astar( *g ); next(); break;
+ case '+' : *g = BuildNFA_Aplus( *g ); next(); break;
+ }
+ return 1;
+}
+
+/*
+ * <atomList> ::= <atom> { <atom> }*
+ * { <atomList> } <atom> '-' <atom> { <atomList> }
+ *
+ * a-b is same as ab
+ * q-a is same as q
+ */
+
+#ifdef __USE_PROTOS
+static int atomList(char *p, int complement)
+#else
+static int atomList(p, complement)
+char *p;
+int complement;
+#endif
+{
+ static unsigned char set[256]; /* no duplicates */
+ int first, last, i;
+ char *s = p;
+
+ if ( token != Atom ) return -1;
+
+ for (i=0; i<256; i++) set[i] = 0;
+ while ( token == Atom )
+ {
+ if ( !set[tokchar] ) *s++ = tokchar;
+ set[tokchar] = 1; /* Add atom to set */
+ next();
+ if ( token == '-' ) /* have we found '-' */
+ {
+ first = *(s-1); /* Get last char */
+ next();
+ if ( token != Atom ) return -1;
+ else
+ {
+ last = tokchar;
+ }
+ for (i = first+1; i <= last; i++)
+ {
+ if ( !set[tokchar] ) *s++ = i;
+ set[i] = 1; /* Add atom to set */
+ }
+ next();
+ }
+ }
+ *s = '\0';
+ if ( complement )
+ {
+ for (i=0; i<256; i++) set[i] = !set[i];
+ for (i=1,s=p; i<256; i++) if ( set[i] ) *s++ = i;
+ *s = '\0';
+ }
+ return 1;
+}
+
+/* a somewhat stupid lexical analyzer */
+
+#ifdef __USE_PROTOS
+static void next(void)
+#else
+static void next()
+#endif
+{
+ while ( *_c==' ' || *_c=='\t' || *_c=='\n' ) _c++;
+ if ( *_c=='\\' )
+ {
+ _c++;
+ if ( isdigit(*_c) )
+ {
+ int n=0;
+ while ( isdigit(*_c) )
+ {
+ n = n*10 + (*_c++ - '0');
+ }
+ if ( n>255 ) n=255;
+ tokchar = n;
+ }
+ else
+ {
+ switch (*_c)
+ {
+ case 'n' : tokchar = '\n'; break;
+ case 't' : tokchar = '\t'; break;
+ case 'r' : tokchar = '\r'; break;
+ default : tokchar = *_c;
+ }
+ _c++;
+ }
+ token = Atom;
+ }
+ else if ( isgraph(*_c) && *_c!='[' && *_c!='(' && *_c!='{' &&
+ *_c!='-' && *_c!='}' && *_c!=')' && *_c!=']' &&
+ *_c!='+' && *_c!='*' && *_c!='~' && *_c!='|' )
+ {
+ token = Atom;
+ tokchar = *_c++;
+ }
+ else
+ {
+ token = tokchar = *_c++;
+ }
+}
+
+/* N F A B u i l d i n g R o u t i n e s */
+
+#ifdef __USE_PROTOS
+static ArcPtr newGraphArc(void)
+#else
+static ArcPtr newGraphArc()
+#endif
+{
+ ArcPtr p;
+ p = (ArcPtr) calloc(1, sizeof(Arc));
+ if ( p==NULL ) {fprintf(stderr,"rexpr: out of memory\n"); exit(-1);}
+ if ( freelist != NULL ) p->track = (ArcPtr) freelist;
+ freelist = (NodePtr) p;
+ return p;
+}
+
+#ifdef __USE_PROTOS
+static NodePtr newNode(void)
+#else
+static NodePtr newNode()
+#endif
+{
+ NodePtr p;
+ p = (NodePtr) calloc(1, sizeof(Node));
+ if ( p==NULL ) {fprintf(stderr,"rexpr: out of memory\n"); exit(-1);}
+ if ( freelist != NULL ) p->track = freelist;
+ freelist = p;
+ return p;
+}
+
+#ifdef __USE_PROTOS
+static void ArcBetweenGraphNodes(NodePtr i,NodePtr j,int label)
+#else
+static void ArcBetweenGraphNodes(i, j, label)
+NodePtr i, j;
+int label;
+#endif
+{
+ ArcPtr a;
+
+ a = newGraphArc();
+ if ( i->arcs == NULL ) i->arctail = i->arcs = a;
+ else {(i->arctail)->next = a; i->arctail = a;}
+ a->label = label;
+ a->target = j;
+}
+
+#ifdef __USE_PROTOS
+static Graph BuildNFA_atom(int label)
+#else
+static Graph BuildNFA_atom(label)
+int label;
+#endif
+{
+ Graph g;
+
+ g.left = newNode();
+ g.right = newNode();
+ ArcBetweenGraphNodes(g.left, g.right, label);
+ return( g );
+}
+
+#ifdef __USE_PROTOS
+static Graph BuildNFA_AB(Graph A,Graph B)
+#else
+static Graph BuildNFA_AB(A, B)
+Graph A, B;
+#endif
+{
+ Graph g;
+
+ ArcBetweenGraphNodes(A.right, B.left, Epsilon);
+ g.left = A.left;
+ g.right = B.right;
+ return( g );
+}
+
+#ifdef __USE_PROTOS
+static Graph BuildNFA_AorB(Graph A,Graph B)
+#else
+static Graph BuildNFA_AorB(A, B)
+Graph A, B;
+#endif
+{
+ Graph g;
+
+ g.left = newNode();
+ ArcBetweenGraphNodes(g.left, A.left, Epsilon);
+ ArcBetweenGraphNodes(g.left, B.left, Epsilon);
+ g.right = newNode();
+ ArcBetweenGraphNodes(A.right, g.right, Epsilon);
+ ArcBetweenGraphNodes(B.right, g.right, Epsilon);
+ return( g );
+}
+
+#ifdef __USE_PROTOS
+static Graph BuildNFA_set(char *s)
+#else
+static Graph BuildNFA_set( s )
+char *s;
+#endif
+{
+ Graph g;
+
+ if ( s == NULL ) return g;
+
+ g.left = newNode();
+ g.right = newNode();
+ while ( *s != '\0' )
+ {
+ ArcBetweenGraphNodes(g.left, g.right, *s++);
+ }
+ return g;
+}
+
+#ifdef __USE_PROTOS
+static Graph BuildNFA_Astar(Graph A)
+#else
+static Graph BuildNFA_Astar( A )
+Graph A;
+#endif
+{
+ Graph g;
+
+ g.left = newNode();
+ g.right = newNode();
+
+ ArcBetweenGraphNodes(g.left, A.left, Epsilon);
+ ArcBetweenGraphNodes(g.left, g.right, Epsilon);
+ ArcBetweenGraphNodes(A.right, g.right, Epsilon);
+ ArcBetweenGraphNodes(A.right, A.left, Epsilon);
+
+ return( g );
+}
+
+#ifdef __USE_PROTOS
+static Graph BuildNFA_Aplus(Graph A)
+#else
+static Graph BuildNFA_Aplus( A )
+Graph A;
+#endif
+{
+ ArcBetweenGraphNodes(A.right, A.left, Epsilon);
+
+ return( A );
+}
+
+#ifdef __USE_PROTOS
+static Graph BuildNFA_Aoptional(Graph A)
+#else
+static Graph BuildNFA_Aoptional( A )
+Graph A;
+#endif
+{
+ Graph g;
+
+ g.left = newNode();
+ g.right = newNode();
+
+ ArcBetweenGraphNodes(g.left, A.left, Epsilon);
+ ArcBetweenGraphNodes(g.left, g.right, Epsilon);
+ ArcBetweenGraphNodes(A.right, g.right, Epsilon);
+
+ return( g );
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/rexpr.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/rexpr.h
new file mode 100644
index 000000000..e67a9652f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/rexpr.h
@@ -0,0 +1,30 @@
+#define Atom 256 /* token Atom (an impossible char value) */
+#define Epsilon 257 /* epsilon arc (an impossible char value) */
+
+/* track field must be same for all node types */
+typedef struct _a {
+ struct _a *track; /* track mem allocation */
+ int label;
+ struct _a *next;
+ struct _n *target;
+ } Arc, *ArcPtr;
+
+typedef struct _n {
+ struct _n *track;
+ ArcPtr arcs, arctail;
+ } Node, *NodePtr;
+
+typedef struct {
+ NodePtr left,
+ right;
+ } Graph, *GraphPtr;
+
+#ifdef __USE_PROTOS
+int rexpr( char *expr, char *s );
+int match( NodePtr automaton, char *s );
+#else
+int rexpr();
+int match();
+#endif
+
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/test.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/test.c
new file mode 100644
index 000000000..2619539e4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/rexpr/test.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include "rexpr.h"
+
+/*
+ * test for rexpr().
+ * To make this test:
+ * cc -o rexpr test.c rexpr.c
+ * Then from command line type:
+ * rexpr r string
+ * where r is the regular expression that decribes a language
+ * and string is the string to verify.
+ */
+main(argc,argv)
+int argc;
+char *argv[];
+{
+ if ( argc!=3 ) fprintf(stderr,"rexpr: expr s\n");
+ else printf("%d\n", rexpr(argv[1], argv[2]));
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/set/set.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/set/set.c
new file mode 100644
index 000000000..6b9b510b8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/set/set.c
@@ -0,0 +1,816 @@
+/* set.c
+
+ The following is a general-purpose set library originally developed
+ by Hank Dietz and enhanced by Terence Parr to allow dynamic sets.
+
+ Sets are now structs containing the #words in the set and
+ a pointer to the actual set words.
+
+ Generally, sets need not be explicitly allocated. They are
+ created/extended/shrunk when appropriate (e.g. in set_of()).
+ HOWEVER, sets need to be destroyed (free()ed) when they go out of scope
+ or are otherwise no longer needed. A routine is provided to
+ free a set.
+
+ Sets can be explicitly created with set_new(s, max_elem).
+
+ Sets can be declared to have minimum size to reduce realloc traffic.
+ Default minimum size = 1.
+
+ Sets can be explicitly initialized to have no elements (set.n == 0)
+ by using the 'empty' initializer:
+
+ Examples:
+ set a = empty; -- set_deg(a) == 0
+
+ return( empty );
+
+ Example set creation and destruction:
+
+ set
+ set_of2(e,g)
+ unsigned e,g;
+ {
+ set a,b,c;
+
+ b = set_of(e); -- Creates space for b and sticks in e
+ set_new(c, g); -- set_new(); set_orel() ==> set_of()
+ set_orel(g, &c);
+ a = set_or(b, c);
+ .
+ .
+ .
+ set_free(b);
+ set_free(c);
+ return( a );
+ }
+
+ 1987 by Hank Dietz
+
+ Modified by:
+ Terence Parr
+ Purdue University
+ October 1989
+
+ Made it smell less bad to C++ 7/31/93 -- TJP
+*/
+
+#include <stdio.h>
+#include "pcctscfg.h"
+#ifdef __STDC__
+#include <stdlib.h>
+#else
+#include <malloc.h>
+#endif
+#include <string.h>
+
+#include "set.h"
+
+#define MIN(i,j) ( (i) > (j) ? (j) : (i))
+#define MAX(i,j) ( (i) < (j) ? (j) : (i))
+
+/* elems can be a maximum of 32 bits */
+static unsigned bitmask[] = {
+ 0x00000001, 0x00000002, 0x00000004, 0x00000008,
+ 0x00000010, 0x00000020, 0x00000040, 0x00000080,
+ 0x00000100, 0x00000200, 0x00000400, 0x00000800,
+ 0x00001000, 0x00002000, 0x00004000, 0x00008000,
+#if !defined(PC) || defined(PC32)
+ 0x00010000, 0x00020000, 0x00040000, 0x00080000,
+ 0x00100000, 0x00200000, 0x00400000, 0x00800000,
+ 0x01000000, 0x02000000, 0x04000000, 0x08000000,
+ 0x10000000, 0x20000000, 0x40000000, 0x80000000
+#endif
+};
+
+set empty = set_init;
+static unsigned min=1;
+
+#define StrSize 200
+
+#ifdef MEMCHK
+#define CHK(a) \
+ if ( a.setword != NULL ) \
+ if ( !valid(a.setword) ) \
+ {fprintf(stderr, "%s(%d): invalid set\n",__FILE__,__LINE__); exit(-1);}
+#else
+#define CHK(a)
+#endif
+
+/*
+ * Set the minimum size (in words) of a set to reduce realloc calls
+ */
+void
+#ifdef __USE_PROTOS
+set_size( unsigned n )
+#else
+set_size( n )
+unsigned n;
+#endif
+{
+ min = n;
+}
+
+unsigned int
+#ifdef __USE_PROTOS
+set_deg( set a )
+#else
+set_deg( a )
+set a;
+#endif
+{
+ /* Fast compute degree of a set... the number
+ of elements present in the set. Assumes
+ that all word bits are used in the set
+ and that SETSIZE(a) is a multiple of WORDSIZE.
+ */
+ register unsigned *p = &(a.setword[0]);
+ register unsigned *endp = NULL; /* MR27 Avoid false memory check report */
+ register unsigned degree = 0;
+
+ CHK(a);
+ if ( a.n == 0 ) return(0);
+ endp = &(a.setword[a.n]);
+ while ( p < endp )
+ {
+ register unsigned t = *p;
+ register unsigned *b = &(bitmask[0]);
+ do {
+ if (t & *b) ++degree;
+ } while (++b < &(bitmask[WORDSIZE]));
+ p++;
+ }
+
+ return(degree);
+}
+
+set
+#ifdef __USE_PROTOS
+set_or( set b, set c )
+#else
+set_or( b, c )
+set b;
+set c;
+#endif
+{
+ /* Fast set union operation */
+ /* resultant set size is max(b, c); */
+ set *big;
+ set t;
+ unsigned int m,n;
+ register unsigned *r, *p, *q, *endp;
+
+ CHK(b); CHK(c);
+ t = empty;
+ if (b.n > c.n) {big= &b; m=b.n; n=c.n;} else {big= &c; m=c.n; n=b.n;}
+ set_ext(&t, m);
+ r = t.setword;
+
+ /* Or b,c until max of smaller set */
+ q = c.setword;
+ p = b.setword;
+ endp = &(b.setword[n]);
+ while ( p < endp ) *r++ = *p++ | *q++;
+
+ /* Copy rest of bigger set into result */
+ p = &(big->setword[n]);
+ endp = &(big->setword[m]);
+ while ( p < endp ) *r++ = *p++;
+
+ return(t);
+}
+
+set
+#ifdef __USE_PROTOS
+set_and( set b, set c )
+#else
+set_and( b, c )
+set b;
+set c;
+#endif
+{
+ /* Fast set intersection operation */
+ /* resultant set size is min(b, c); */
+ set t;
+ unsigned int n;
+ register unsigned *r, *p, *q, *endp;
+
+ CHK(b); CHK(c);
+ t = empty;
+ n = (b.n > c.n) ? c.n : b.n;
+ if ( n == 0 ) return t; /* TJP 4-27-92 fixed for empty set */
+ set_ext(&t, n);
+ r = t.setword;
+
+ /* & b,c until max of smaller set */
+ q = c.setword;
+ p = b.setword;
+ endp = &(b.setword[n]);
+ while ( p < endp ) *r++ = *p++ & *q++;
+
+ return(t);
+}
+
+set
+#ifdef __USE_PROTOS
+set_dif( set b, set c )
+#else
+set_dif( b, c )
+set b;
+set c;
+#endif
+{
+ /* Fast set difference operation b - c */
+ /* resultant set size is size(b) */
+ set t;
+ unsigned int n;
+ register unsigned *r, *p, *q, *endp;
+
+ CHK(b); CHK(c);
+ t = empty;
+ n = (b.n <= c.n) ? b.n : c.n ;
+ if ( b.n == 0 ) return t; /* TJP 4-27-92 fixed for empty set */
+ /* WEC 12-1-92 fixed for c.n = 0 */
+ set_ext(&t, b.n);
+ r = t.setword;
+
+ /* Dif b,c until smaller set size */
+ q = c.setword;
+ p = b.setword;
+ endp = &(b.setword[n]);
+ while ( p < endp ) *r++ = *p++ & (~ *q++);
+
+ /* Copy rest of b into result if size(b) > c */
+ if ( b.n > n )
+ {
+ p = &(b.setword[n]);
+ endp = &(b.setword[b.n]);
+ while ( p < endp ) *r++ = *p++;
+ }
+
+ return(t);
+}
+
+set
+#ifdef __USE_PROTOS
+set_of( unsigned b )
+#else
+set_of( b )
+unsigned b;
+#endif
+{
+ /* Fast singleton set constructor operation */
+ static set a;
+
+ if ( b == nil ) return( empty );
+ set_new(a, b);
+ a.setword[DIVWORD(b)] = bitmask[MODWORD(b)];
+
+ return(a);
+}
+
+/*
+ * Extend (or shrink) the set passed in to have n words.
+ *
+ * if n is smaller than the minimum, boost n to have the minimum.
+ * if the new set size is the same as the old one, do nothing.
+ *
+ * TJP 4-27-92 Fixed so won't try to alloc 0 bytes
+ */
+void
+#ifdef __USE_PROTOS
+set_ext( set *a, unsigned int n )
+#else
+set_ext( a, n )
+set *a;
+unsigned int n;
+#endif
+{
+ register unsigned *p;
+ register unsigned *endp;
+ unsigned int size;
+
+ CHK((*a));
+ if ( a->n == 0 )
+ {
+ if ( n == 0 ) return;
+ if (a->setword != NULL) {
+ free (a->setword); /* MR20 */
+ }
+ a->setword = (unsigned *) calloc(n, BytesPerWord);
+ if ( a->setword == NULL )
+ {
+ fprintf(stderr, "set_ext(%d words): cannot allocate set\n", n);
+ exit(-1);
+ }
+ a->n = n;
+ return;
+ }
+ if ( n < min ) n = min;
+ if ( a->n == n || n == 0 ) return;
+ size = a->n;
+ a->n = n;
+ a->setword = (unsigned *) realloc( (char *)a->setword, (n*BytesPerWord) );
+ if ( a->setword == NULL )
+ {
+ fprintf(stderr, "set_ext(%d words): cannot allocate set\n", n);
+ exit(-1);
+ }
+
+ p = &(a->setword[size]); /* clear from old size to new size */
+ endp = &(a->setword[a->n]);
+ do {
+ *p++ = 0;
+ } while ( p < endp );
+}
+
+set
+#ifdef __USE_PROTOS
+set_not( set a )
+#else
+set_not( a )
+set a;
+#endif
+{
+ /* Fast not of set a (assumes all bits used) */
+ /* size of resultant set is size(a) */
+ /* ~empty = empty cause we don't know how bit to make set */
+ set t;
+ register unsigned *r;
+ register unsigned *p = a.setword;
+ register unsigned *endp = &(a.setword[a.n]);
+
+ CHK(a);
+ t = empty;
+ if ( a.n == 0 ) return( empty );
+ set_ext(&t, a.n);
+ r = t.setword;
+
+ do {
+ *r++ = (~ *p++);
+ } while ( p < endp );
+
+ return(t);
+}
+
+int
+#ifdef __USE_PROTOS
+set_equ( set a, set b )
+#else
+set_equ( a, b )
+set a;
+set b;
+#endif
+{
+/* 8-Nov-97 Make it work with sets of different sizes */
+/* Easy to understand, too. Probably faster. */
+/* Check for a equal to b */
+
+ unsigned int count; /* MR11 */
+ unsigned int i; /* MR11 */
+
+ CHK(a); CHK(b);
+
+ count=MIN(a.n,b.n);
+ if (count == 0) return 1;
+ for (i=0; i < count; i++) {
+ if (a.setword[i] != b.setword[i]) return 0;
+ };
+ if (a.n < b.n) {
+ for (i=count; i < b.n; i++) {
+ if (b.setword[i] != 0) return 0;
+ }
+ return 1;
+ } else if (a.n > b.n) {
+ for (i=count; i < a.n; i++) {
+ if (a.setword[i] != 0) return 0;
+ }
+ return 1;
+ } else {
+ return 1;
+ };
+}
+
+int
+#ifdef __USE_PROTOS
+set_sub( set a, set b )
+#else
+set_sub( a, b )
+set a;
+set b;
+#endif
+{
+
+/* 8-Nov-97 Make it work with sets of different sizes */
+/* Easy to understand, too. Probably faster. */
+/* Check for a is a PROPER subset of b */
+
+ unsigned int count;
+ unsigned int i;
+
+ CHK(a); CHK(b);
+
+ if (a.n == 0) return 1;
+ count=MIN(a.n,b.n);
+ for (i=0; i < count; i++) {
+ if (a.setword[i] & ~b.setword[i]) return 0;
+ };
+ if (a.n <= b.n) {
+ return 1;
+ } else {
+ for (i=count; i<a.n ; i++) {
+ if (a.setword[i]) return 0;
+ };
+ };
+ return 1;
+}
+
+unsigned
+#ifdef __USE_PROTOS
+set_int( set b )
+#else
+set_int( b )
+set b;
+#endif
+{
+ /* Fast pick any element of the set b */
+ register unsigned *p = b.setword;
+ register unsigned *endp = &(b.setword[b.n]);
+
+ CHK(b);
+ if ( b.n == 0 ) return( nil );
+
+ do {
+ if (*p) {
+ /* Found a non-empty word of the set */
+ register unsigned i = ((p - b.setword) << LogWordSize);
+ register unsigned t = *p;
+ p = &(bitmask[0]);
+ while (!(*p & t)) {
+ ++i; ++p;
+ }
+ return(i);
+ }
+ } while (++p < endp);
+
+ /* Empty -- only element it contains is nil */
+ return(nil);
+}
+
+int
+#ifdef __USE_PROTOS
+set_el( unsigned b, set a )
+#else
+set_el( b, a )
+unsigned b;
+set a;
+#endif
+{
+ CHK(a);
+ /* nil is an element of every set */
+ if (b == nil) return(1);
+ if ( a.n == 0 || NumWords(b) > a.n ) return(0);
+
+ /* Otherwise, we have to check */
+ return( a.setword[DIVWORD(b)] & bitmask[MODWORD(b)] );
+}
+
+int
+#ifdef __USE_PROTOS
+set_nil( set a )
+#else
+set_nil( a )
+set a;
+#endif
+{
+ /* Fast check for nil set */
+ register unsigned *p = a.setword;
+ register unsigned *endp;
+
+ CHK(a);
+ if ( a.n == 0 ) return(1);
+ endp = &(a.setword[a.n]);
+
+ /* The set is not empty if any word used to store
+ the set is non-zero. This means one must be a
+ bit careful about doing things like negation.
+ */
+ do {
+ if (*p) return(0);
+ } while (++p < endp);
+
+ return(1);
+}
+
+char *
+#ifdef __USE_PROTOS
+set_str( set a )
+#else
+set_str( a )
+set a;
+#endif
+{
+ /* Fast convert set a into ASCII char string...
+ assumes that all word bits are used in the set
+ and that SETSIZE is a multiple of WORDSIZE.
+ Trailing 0 bits are removed from the string.
+ if no bits are on or set is empty, "" is returned.
+ */
+ register unsigned *p = a.setword;
+ register unsigned *endp = &(a.setword[a.n]);
+ static char str_tmp[StrSize+1];
+ register char *q = &(str_tmp[0]);
+
+ CHK(a);
+ if ( a.n==0 ) {*q=0; return( &(str_tmp[0]) );}
+ do {
+ register unsigned t = *p;
+ register unsigned *b = &(bitmask[0]);
+ do {
+ *(q++) = (char) ((t & *b) ? '1' : '0');
+ } while (++b < &(bitmask[WORDSIZE]));
+ } while (++p < endp);
+
+ /* Trim trailing 0s & NULL terminate the string */
+ while ((q > &(str_tmp[0])) && (*(q-1) != '1')) --q;
+ *q = 0;
+
+ return(&(str_tmp[0]));
+}
+
+set
+#ifdef __USE_PROTOS
+set_val( register char *s )
+#else
+set_val( s )
+register char *s;
+#endif
+{
+ /* Fast convert set ASCII char string into a set.
+ If the string ends early, the remaining set bits
+ are all made zero.
+ The resulting set size is just big enough to hold all elements.
+ */
+ static set a;
+ register unsigned *p, *endp;
+
+ set_new(a, (unsigned) strlen(s));
+ p = a.setword;
+ endp = &(a.setword[a.n]);
+ do {
+ register unsigned *b = &(bitmask[0]);
+ /* Start with a word with no bits on */
+ *p = 0;
+ do {
+ if (*s) {
+ if (*s == '1') {
+ /* Turn-on this bit */
+ *p |= *b;
+ }
+ ++s;
+ }
+ } while (++b < &(bitmask[WORDSIZE]));
+ } while (++p < endp);
+
+ return(a);
+}
+
+/*
+ * Or element e into set a. a can be empty.
+ */
+void
+#ifdef __USE_PROTOS
+set_orel( unsigned e, set *a )
+#else
+set_orel( e, a )
+unsigned e;
+set *a;
+#endif
+{
+ CHK((*a));
+ if ( e == nil ) return;
+ if ( NumWords(e) > a->n ) set_ext(a, NumWords(e));
+ a->setword[DIVWORD(e)] |= bitmask[MODWORD(e)];
+}
+
+/*
+ * Or set b into set a. a can be empty. does nothing if b empty.
+ */
+void
+#ifdef __USE_PROTOS
+set_orin( set *a, set b )
+#else
+set_orin( a, b )
+set *a;
+set b;
+#endif
+{
+ /* Fast set union operation */
+ /* size(a) is max(a, b); */
+ unsigned int m;
+ register unsigned *p,
+ *q = b.setword,
+ *endq; /* MR20 */
+
+ CHK((*a)); CHK(b);
+ if ( b.n == 0 ) return;
+ endq = &(b.setword[b.n]); /* MR20 */
+ m = (a->n > b.n) ? a->n : b.n;
+ set_ext(a, m);
+ p = a->setword;
+ do {
+ *p++ |= *q++;
+ } while ( q < endq );
+}
+
+/*
+ * And set b into set a. a can be empty. does nothing if b empty.
+ */
+void
+#ifdef __USE_PROTOS
+set_andin( set *a, set b )
+#else
+set_andin( a, b )
+set *a;
+set b;
+#endif
+{
+ /* Fast set intersection operation */
+ /* size(a) is max(a, b); */
+ unsigned int m;
+ register unsigned *p,
+ *q = b.setword,
+ *endq = &(b.setword[b.n]);
+
+ CHK((*a)); CHK(b);
+ if ( b.n == 0 ) return;
+ m = (a->n > b.n) ? a->n : b.n;
+ set_ext(a, m);
+ p = a->setword;
+ do {
+ *p++ &= *q++;
+ } while ( q < endq );
+}
+
+void
+#ifdef __USE_PROTOS
+set_rm( unsigned e, set a )
+#else
+set_rm( e, a )
+unsigned e;
+set a;
+#endif
+{
+ /* Does not effect size of set */
+ CHK(a);
+ if ( (e == nil) || (NumWords(e) > a.n) ) return;
+ a.setword[DIVWORD(e)] ^= (a.setword[DIVWORD(e)]&bitmask[MODWORD(e)]);
+}
+
+void
+#ifdef __USE_PROTOS
+set_clr( set a )
+#else
+set_clr( a )
+set a;
+#endif
+{
+ /* Does not effect size of set */
+ register unsigned *p = a.setword;
+ register unsigned *endp;
+
+ CHK(a);
+ if ( a.n == 0 ) return;
+ endp = &(a.setword[a.n]);
+ do {
+ *p++ = 0;
+ } while ( p < endp );
+}
+
+set
+#ifdef __USE_PROTOS
+set_dup( set a )
+#else
+set_dup( a )
+set a;
+#endif
+{
+ set b;
+ register unsigned *p,
+ *q = a.setword,
+ *endq; /* MR20 */
+
+ CHK(a);
+ b = empty;
+ if ( a.n == 0 ) return( empty );
+ endq = &(a.setword[a.n]); /* MR20 */
+ set_ext(&b, a.n);
+ p = b.setword;
+ do {
+ *p++ = *q++;
+ } while ( q < endq );
+
+ return(b);
+}
+
+/*
+ * Return a nil terminated list of unsigned ints that represents all
+ * "on" bits in the bit set.
+ *
+ * e.g. {011011} --> {1, 2, 4, 5, nil}
+ *
+ * _set_pdq and set_pdq are useful when an operation is required on each element
+ * of a set. Normally, the sequence is:
+ *
+ * while ( set_deg(a) > 0 ) {
+ * e = set_int(a);
+ * set_rm(e, a);
+ * ...process e...
+ * }
+ * Now,
+ *
+ * t = e = set_pdq(a);
+ * while ( *e != nil ) {
+ * ...process *e...
+ * e++;
+ * }
+ * free( t );
+ *
+ * We have saved many set calls and have not destroyed set a.
+ */
+void
+#ifdef __USE_PROTOS
+_set_pdq( set a, register unsigned *q )
+#else
+_set_pdq( a, q )
+set a;
+register unsigned *q;
+#endif
+{
+ register unsigned *p = a.setword,
+ *endp = &(a.setword[a.n]);
+ register unsigned e=0;
+
+ CHK(a);
+ /* are there any space (possibility of elements)? */
+ if ( a.n == 0 ) return;
+ do {
+ register unsigned t = *p;
+ register unsigned *b = &(bitmask[0]);
+ do {
+ if ( t & *b ) *q++ = e;
+ ++e;
+ } while (++b < &(bitmask[WORDSIZE]));
+ } while (++p < endp);
+ *q = nil;
+}
+
+/*
+ * Same as _set_pdq except allocate memory. set_pdq is the natural function
+ * to use.
+ */
+unsigned *
+#ifdef __USE_PROTOS
+set_pdq( set a )
+#else
+set_pdq( a )
+set a;
+#endif
+{
+ unsigned *q;
+ int max_deg;
+
+ CHK(a);
+ max_deg = WORDSIZE*a.n;
+ /* assume a.n!=0 & no elements is rare, but still ok */
+ if ( a.n == 0 ) return(NULL);
+ q = (unsigned *) malloc((max_deg+1)*BytesPerWord);
+ if ( q == NULL ) return( NULL );
+ _set_pdq(a, q);
+ return( q );
+}
+
+/* a function that produces a hash number for the set
+ */
+unsigned int
+#ifdef __USE_PROTOS
+set_hash( set a, register unsigned int mod )
+#else
+set_hash( a, mod )
+set a;
+register unsigned int mod;
+#endif
+{
+ /* Fast hash of set a (assumes all bits used) */
+ register unsigned *p = &(a.setword[0]);
+ register unsigned *endp = &(a.setword[a.n]);
+ register unsigned i = 0;
+
+ CHK(a);
+ while (p<endp){
+ i += (*p);
+ ++p;
+ }
+
+ return(i % mod);
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/set/set.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/set/set.h
new file mode 100644
index 000000000..5d68152df
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/set/set.h
@@ -0,0 +1,121 @@
+#ifndef __GATE_SET_H
+#define __GATE_SET_H
+
+/* set.h
+
+ The following is a general-purpose set library originally developed
+ by Hank Dietz and enhanced by Terence Parr to allow dynamic sets.
+
+ Sets are now structs containing the #words in the set and
+ a pointer to the actual set words.
+
+ 1987 by Hank Dietz
+
+ Modified by:
+ Terence Parr
+ Purdue University
+ October 1989
+
+ Added ANSI prototyping Dec. 1992 -- TJP
+*/
+
+#include "pcctscfg.h"
+
+#ifdef NOT_USED /* SEE config.h */
+/* Define usable bits per unsigned int word */
+#ifdef PC
+#define WORDSIZE 16
+#define LogWordSize 4
+#else
+#define WORDSIZE 32
+#define LogWordSize 5
+#endif
+#define BytesPerWord sizeof(unsigned)
+#endif
+
+#define SETSIZE(a) ((a).n<<LogWordSize) /* Maximum items per set */
+#define MODWORD(x) ((x) & (WORDSIZE-1)) /* x % WORDSIZE */
+#define DIVWORD(x) ((x) >> LogWordSize) /* x / WORDSIZE */
+#define nil (~((unsigned) 0)) /* An impossible set member all bits on (big!) */
+
+typedef struct _set {
+ unsigned int n; /* Number of words in set */
+ unsigned *setword;
+ } set;
+
+#define set_init {0, NULL}
+#define set_null(a) ((a).setword==NULL)
+
+#define NumBytes(x) (((x)>>3)+1) /* Num bytes to hold x */
+#define NumWords(x) ((((unsigned)(x))>>LogWordSize)+1) /* Num words to hold x */
+
+
+/* M a c r o s */
+
+/* make arg1 a set big enough to hold max elem # of arg2 */
+#define set_new(a,_max) \
+if (((a).setword=(unsigned *)calloc(NumWords(_max),BytesPerWord))==NULL) \
+ fprintf(stderr, "set_new: Cannot allocate set with max of %d\n", _max); \
+ (a).n = NumWords(_max);
+
+#define set_free(a) \
+ {if ( (a).setword != NULL ) free((char *)((a).setword)); \
+ (a) = empty;}
+
+#ifdef __USE_PROTOS
+extern void set_size( unsigned );
+extern unsigned int set_deg( set );
+extern set set_or( set, set );
+extern set set_and( set, set );
+extern set set_dif( set, set );
+extern set set_of( unsigned );
+extern void set_ext( set *, unsigned int );
+extern set set_not( set );
+extern int set_equ( set, set );
+extern int set_sub( set, set );
+extern unsigned set_int( set );
+extern int set_el( unsigned, set );
+extern int set_nil( set );
+extern char * set_str( set );
+extern set set_val( register char * );
+extern void set_orel( unsigned, set * );
+extern void set_orin( set *, set );
+extern void set_andin( set *, set );
+extern void set_rm( unsigned, set );
+extern void set_clr( set );
+extern set set_dup( set );
+extern void set_PDQ( set, register unsigned * );
+extern unsigned *set_pdq( set );
+extern void _set_pdq( set a, register unsigned *q );
+extern unsigned int set_hash( set, register unsigned int );
+#else
+extern void set_size();
+extern unsigned int set_deg();
+extern set set_or();
+extern set set_and();
+extern set set_dif();
+extern set set_of();
+extern void set_ext();
+extern set set_not();
+extern int set_equ();
+extern int set_sub();
+extern unsigned set_int();
+extern int set_el();
+extern int set_nil();
+extern char * set_str();
+extern set set_val();
+extern void set_orel();
+extern void set_orin();
+extern void set_andin();
+extern void set_rm();
+extern void set_clr();
+extern set set_dup();
+extern void set_PDQ();
+extern unsigned *set_pdq();
+extern void _set_pdq();
+extern unsigned int set_hash();
+#endif
+
+extern set empty;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/sym/sym.c b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/sym/sym.c
new file mode 100644
index 000000000..eccce059b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/sym/sym.c
@@ -0,0 +1,402 @@
+/*
+ * Simple symbol table manager using coalesced chaining to resolve collisions
+ *
+ * Doubly-linked lists are used for fast removal of entries.
+ *
+ * 'sym.h' must have a definition for typedef "Sym". Sym must include at
+ * minimum the following fields:
+ *
+ * ...
+ * char *symbol;
+ * struct ... *next, *prev, **head, *scope;
+ * unsigned int hash;
+ * ...
+ *
+ * 'template.h' can be used as a template to create a 'sym.h'.
+ *
+ * 'head' is &(table[hash(itself)]).
+ * The hash table is not resizable at run-time.
+ * The scope field is used to link all symbols of a current scope together.
+ * Scope() sets the current scope (linked list) to add symbols to.
+ * Any number of scopes can be handled. The user passes the address of
+ * a pointer to a symbol table
+ * entry (INITIALIZED TO NULL first time).
+ *
+ * Available Functions:
+ *
+ * zzs_init(s1,s2) -- Create hash table with size s1, string table size s2.
+ * zzs_done() -- Free hash and string table created with zzs_init().
+ * zzs_add(key,rec)-- Add 'rec' with key 'key' to the symbol table.
+ * zzs_newadd(key) -- create entry; add using 'key' to the symbol table.
+ * zzs_get(key) -- Return pointer to last record entered under 'key'
+ * Else return NULL
+ * zzs_del(p) -- Unlink the entry associated with p. This does
+ * NOT free 'p' and DOES NOT remove it from a scope
+ * list. If it was a part of your intermediate code
+ * tree or another structure. It will still be there.
+ * It is only removed from further consideration
+ * by the symbol table.
+ * zzs_keydel(s) -- Unlink the entry associated with key s.
+ * Calls zzs_del(p) to unlink.
+ * zzs_scope(sc) -- Specifies that everything added to the symbol
+ * table with zzs_add() is added to the list (scope)
+ * 'sc'. 'sc' is of 'Sym **sc' type and must be
+ * initialized to NULL before trying to add anything
+ * to it (passing it to zzs_scope()). Scopes can be
+ * switched at any time and merely links a set of
+ * symbol table entries. If a NULL pointer is
+ * passed, the current scope is returned.
+ * zzs_rmscope(sc) -- Remove (zzs_del()) all elements of scope 'sc'
+ * from the symbol table. The entries are NOT
+ * free()'d. A pointer to the first
+ * element in the "scope" is returned. The user
+ * can then manipulate the list as he/she chooses
+ * (such as freeing them all). NOTE that this
+ * function sets your scope pointer to NULL,
+ * but returns a pointer to the list for you to use.
+ * zzs_stat() -- Print out the symbol table and some relevant stats.
+ * zzs_new(key) -- Create a new record with calloc() of type Sym.
+ * Add 'key' to the string table and make the new
+ * records 'symbol' pointer point to it.
+ * zzs_strdup(s) -- Add s to the string table and return a pointer
+ * to it. Very fast allocation routine
+ * and does not require strlen() nor calloc().
+ *
+ * Example:
+ *
+ * #include <stdio.h>
+ * #include "sym.h"
+ *
+ * main()
+ * {
+ * Sym *scope1=NULL, *scope2=NULL, *a, *p;
+ *
+ * zzs_init(101, 100);
+ *
+ * a = zzs_new("Apple"); zzs_add(a->symbol, a); -- No scope
+ * zzs_scope( &scope1 ); -- enter scope 1
+ * a = zzs_new("Plum"); zzs_add(a->symbol, a);
+ * zzs_scope( &scope2 ); -- enter scope 2
+ * a = zzs_new("Truck"); zzs_add(a->symbol, a);
+ *
+ * p = zzs_get("Plum");
+ * if ( p == NULL ) fprintf(stderr, "Hmmm...Can't find 'Plum'\n");
+ *
+ * p = zzs_rmscope(&scope1)
+ * for (; p!=NULL; p=p->scope) {printf("Scope1: %s\n", p->symbol);}
+ * p = zzs_rmscope(&scope2)
+ * for (; p!=NULL; p=p->scope) {printf("Scope2: %s\n", p->symbol);}
+ * }
+ *
+ * Terence Parr
+ * Purdue University
+ * February 1990
+ *
+ * CHANGES
+ *
+ * Terence Parr
+ * May 1991
+ * Renamed functions to be consistent with ANTLR
+ * Made HASH macro
+ * Added zzs_keydel()
+ * Added zzs_newadd()
+ * Fixed up zzs_stat()
+ *
+ * July 1991
+ * Made symbol table entry save its hash code for fast comparison
+ * during searching etc...
+ */
+
+#include <stdio.h>
+#if defined(__STDC__) || defined(__USE_PROTOS)
+#include <string.h>
+#include <stdlib.h>
+#else
+#include <malloc.h>
+#endif
+#include "sym.h"
+
+#define StrSame 0
+
+static Sym **CurScope = NULL;
+static unsigned size = 0;
+static Sym **table=NULL;
+static char *strings;
+static char *strp;
+static int strsize = 0;
+
+#ifdef __USE_PROTOS
+void zzs_init(int sz,int strs)
+#else
+void zzs_init(sz, strs)
+int sz, strs;
+#endif
+{
+ if ( sz <= 0 || strs <= 0 ) return;
+ table = (Sym **) calloc(sz, sizeof(Sym *));
+ if ( table == NULL )
+ {
+ fprintf(stderr, "Cannot allocate table of size %d\n", sz);
+ exit(1);
+ }
+ strings = (char *) calloc(strs, sizeof(char));
+ if ( strings == NULL )
+ {
+ fprintf(stderr, "Cannot allocate string table of size %d\n", strs);
+ exit(1);
+ }
+ size = sz;
+ strsize = strs;
+ strp = strings;
+}
+
+#ifdef __USE_PROTOS
+void zzs_done(void)
+#else
+void zzs_done()
+#endif
+{
+ if ( table != NULL ) free( table );
+ if ( strings != NULL ) free( strings );
+}
+
+#ifdef __USE_PROTOS
+void zzs_add(char *key,Sym rec)
+#else
+void zzs_add(key, rec)
+char *key;
+register Sym *rec;
+#endif
+{
+ register unsigned int h=0;
+ register char *p=key;
+
+ HASH(p, h);
+ rec->hash = h; /* save hash code for fast comp later */
+ h %= size;
+
+ if ( CurScope != NULL ) {rec->scope = *CurScope; *CurScope = rec;}
+ rec->next = table[h]; /* Add to doubly-linked list */
+ rec->prev = NULL;
+ if ( rec->next != NULL ) (rec->next)->prev = rec;
+ table[h] = rec;
+ rec->head = &(table[h]);
+}
+
+#ifdef __USE_PROTOS
+Sym * zzs_get(char *key)
+#else
+Sym * zzs_get(key)
+char *key;
+#endif
+{
+ register unsigned int h=0;
+ register char *p=key;
+ register Sym *q;
+
+ HASH(p, h);
+
+ for (q = table[h%size]; q != NULL; q = q->next)
+ {
+ if ( q->hash == h ) /* do we even have a chance of matching? */
+ if ( strcmp(key, q->symbol) == StrSame ) return( q );
+ }
+ return( NULL );
+}
+
+/*
+ * Unlink p from the symbol table. Hopefully, it's actually in the
+ * symbol table.
+ *
+ * If p is not part of a bucket chain of the symbol table, bad things
+ * will happen.
+ *
+ * Will do nothing if all list pointers are NULL
+ */
+#ifdef __USE_PROTOS
+void zzs_del(Sym *p)
+#else
+void zzs_del(p)
+register Sym *p;
+#endif
+{
+ if ( p == NULL ) {fprintf(stderr, "zzs_del(NULL)\n"); exit(1);}
+ if ( p->prev == NULL ) /* Head of list */
+ {
+ register Sym **t = p->head;
+
+ if ( t == NULL ) return; /* not part of symbol table */
+ (*t) = p->next;
+ if ( (*t) != NULL ) (*t)->prev = NULL;
+ }
+ else
+ {
+ (p->prev)->next = p->next;
+ if ( p->next != NULL ) (p->next)->prev = p->prev;
+ }
+ p->next = p->prev = NULL; /* not part of symbol table anymore */
+ p->head = NULL;
+}
+
+#ifdef __USE_PROTOS
+void zzs_keydel(char *key)
+#else
+void zzs_keydel(key)
+char *key;
+#endif
+{
+ Sym *p = zzs_get(key);
+
+ if ( p != NULL ) zzs_del( p );
+}
+
+/* S c o p e S t u f f */
+
+/* Set current scope to 'scope'; return current scope if 'scope' == NULL */
+
+#ifdef __USE_PROTOS
+Sym ** zzs_scope(Sym **scope)
+#else
+Sym ** zzs_scope(scope)
+Sym **scope;
+#endif
+{
+ if ( scope == NULL ) return( CurScope );
+ CurScope = scope;
+ return( scope );
+}
+
+/* Remove a scope described by 'scope'. Return pointer to 1st element in scope */
+
+#ifdef __USE_PROTOS
+Sym * zzs_rmscope(Sym **scope)
+#else
+Sym * zzs_rmscope(scope)
+register Sym **scope;
+#endif
+{
+ register Sym *p;
+ Sym *start;
+
+ if ( scope == NULL ) return(NULL);
+ start = p = *scope;
+ for (; p != NULL; p=p->scope) { zzs_del( p ); }
+ *scope = NULL;
+ return( start );
+}
+
+#ifdef __USE_PROTOS
+void zzs_stat(void)
+#else
+void zzs_stat()
+#endif
+{
+ static unsigned short count[20];
+ unsigned int i,n=0,low=0, hi=0;
+ register Sym **p;
+ float avg=0.0;
+
+ for (i=0; i<20; i++) count[i] = 0;
+ for (p=table; p<&(table[size]); p++)
+ {
+ register Sym *q = *p;
+ unsigned int len;
+
+ if ( q != NULL && low==0 ) low = p-table;
+ len = 0;
+ if ( q != NULL ) printf("[%d]", p-table);
+ while ( q != NULL )
+ {
+ len++;
+ n++;
+ printf(" %s", q->symbol);
+ q = q->next;
+ if ( q == NULL ) printf("\n");
+ }
+ if ( len>=20 ) printf("zzs_stat: count table too small\n");
+ else count[len]++;
+ if ( *p != NULL ) hi = p-table;
+ }
+
+ printf("Storing %d recs used %d hash positions out of %d\n",
+ n, size-count[0], size);
+ printf("%f %% utilization\n",
+ ((float)(size-count[0]))/((float)size));
+ for (i=0; i<20; i++)
+ {
+ if ( count[i] != 0 )
+ {
+ avg += (((float)(i*count[i]))/((float)n)) * i;
+ printf("Buckets of len %d == %d (%f %% of recs)\n",
+ i, count[i], 100.0*((float)(i*count[i]))/((float)n));
+ }
+ }
+ printf("Avg bucket length %f\n", avg);
+ printf("Range of hash function: %d..%d\n", low, hi);
+}
+
+/*
+ * Given a string, this function allocates and returns a pointer to a
+ * symbol table record whose "symbol" pointer is reset to a position
+ * in the string table.
+ */
+
+#ifdef __USE_PROTOS
+Sym * zzs_new(char *text)
+#else
+Sym * zzs_new(text)
+char *text;
+#endif
+{
+ Sym *p;
+
+ if ( (p = (Sym *) calloc(1,sizeof(Sym))) == 0 )
+ {
+ fprintf(stderr,"Out of memory\n");
+ exit(1);
+ }
+ p->symbol = zzs_strdup(text);
+
+ return p;
+}
+
+/* create a new symbol table entry and add it to the symbol table */
+
+#ifdef __USE_PROTOS
+Sym * zzs_newadd(char *text)
+#else
+Sym * zzs_newadd(text)
+char *text;
+#endif
+{
+ Sym *p = zzs_new(text);
+ if ( p != NULL ) zzs_add(text, p);
+ return p;
+}
+
+/* Add a string to the string table and return a pointer to it.
+ * Bump the pointer into the string table to next avail position.
+ */
+
+#ifdef __USE_PROTOS
+char * zzs_strdup(char *s)
+#else
+char * zzs_strdup(s)
+register char *s;
+#endif
+{
+ register char *start=strp;
+
+ while ( *s != '\0' )
+ {
+ if ( strp >= &(strings[strsize-2]) )
+ {
+ fprintf(stderr, "sym: string table overflow (%d chars)\n", strsize);
+ exit(-1);
+ }
+ *strp++ = *s++;
+ }
+ *strp++ = '\0';
+
+ return( start );
+}
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/sym/template.h b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/sym/template.h
new file mode 100644
index 000000000..ee6e665e3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/Pccts/support/sym/template.h
@@ -0,0 +1,41 @@
+/* T e m p l a t e F o r S y m b o l T a b l e M a n a g e r */
+
+/* define some hash function */
+#ifndef HASH
+#define HASH(p, h) while ( *p != '\0' ) h = (h<<1) + *p++;
+#endif
+
+/* minimum symbol table record */
+typedef struct _sym {
+ char *symbol;
+ struct _sym *next, *prev, **head, *scope;
+ unsigned int hash;
+ } Sym, *SymPtr;
+
+#ifdef __USE_PROTOS
+void zzs_init(int, int);
+void zzs_done(void);
+void zzs_add(char *, Sym *);
+Sym *zzs_get(char *);
+void zzs_del(Sym *);
+void zzs_keydel(char *);
+Sym **zzs_scope(Sym **);
+Sym *zzs_rmscope(Sym **);
+void zzs_stat(void);
+Sym *zzs_new(char *);
+Sym *zzs_newadd(char *);
+char *zzs_strdup(char *);
+#else
+void zzs_init();
+void zzs_done();
+void zzs_add();
+Sym *zzs_get();
+void zzs_del();
+void zzs_keydel();
+Sym **zzs_scope();
+Sym *zzs_rmscope();
+void zzs_stat();
+Sym *zzs_new();
+Sym *zzs_newadd();
+char *zzs_strdup();
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
new file mode 100644
index 000000000..5f4d262d8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
@@ -0,0 +1,941 @@
+/** @file
+
+ VfrCompiler main class and main function.
+
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "stdio.h"
+#include "stdlib.h"
+#include "string.h"
+#include "VfrCompiler.h"
+#include "CommonLib.h"
+#include "EfiUtilityMsgs.h"
+
+PACKAGE_DATA gCBuffer;
+PACKAGE_DATA gRBuffer;
+CVfrStringDB gCVfrStringDB;
+
+VOID
+CVfrCompiler::DebugError (
+ IN CHAR8 *FileName,
+ IN UINT32 LineNumber,
+ IN UINT32 MessageCode,
+ IN CONST CHAR8 *Text,
+ IN CONST CHAR8 *MsgFmt,
+ ...
+ )
+{
+ va_list List;
+ va_start (List, MsgFmt);
+ PrintMessage ((CHAR8 *) "ERROR", FileName, LineNumber, MessageCode, (CHAR8 *) Text, (CHAR8 *) MsgFmt, List);
+ va_end (List);
+}
+
+VOID
+CVfrCompiler::SET_RUN_STATUS (
+ IN COMPILER_RUN_STATUS Status
+ )
+{
+ mRunStatus = Status;
+}
+
+BOOLEAN
+CVfrCompiler::IS_RUN_STATUS (
+ IN COMPILER_RUN_STATUS Status
+ )
+{
+ return mRunStatus == Status;
+}
+
+VOID
+CVfrCompiler::OptionInitialization (
+ IN INT32 Argc,
+ IN CHAR8 **Argv
+ )
+{
+ INT32 Index;
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+ SetUtilityName ((CHAR8*) PROGRAM_NAME);
+
+ mOptions.VfrFileName = NULL;
+ mOptions.RecordListFile = NULL;
+ mOptions.CreateRecordListFile = FALSE;
+ mOptions.CreateIfrPkgFile = FALSE;
+ mOptions.PkgOutputFileName = NULL;
+ mOptions.COutputFileName = NULL;
+ mOptions.OutputDirectory = NULL;
+ mOptions.PreprocessorOutputFileName = NULL;
+ mOptions.VfrBaseFileName = NULL;
+ mOptions.IncludePaths = NULL;
+ mOptions.SkipCPreprocessor = TRUE;
+ mOptions.CPreprocessorOptions = NULL;
+ mOptions.HasOverrideClassGuid = FALSE;
+ mOptions.WarningAsError = FALSE;
+ mOptions.AutoDefault = FALSE;
+ mOptions.CheckDefault = FALSE;
+ memset (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));
+
+ if (Argc == 1) {
+ Usage ();
+ SET_RUN_STATUS (STATUS_DEAD);
+ return;
+ }
+
+ for (Index = 1; (Index < Argc) && (Argv[Index][0] == '-'); Index++) {
+ if ((stricmp(Argv[Index], "-h") == 0) || (stricmp(Argv[Index], "--help") == 0)) {
+ Usage ();
+ SET_RUN_STATUS (STATUS_DEAD);
+ return;
+ } else if (stricmp(Argv[Index], "--version") == 0) {
+ Version ();
+ SET_RUN_STATUS (STATUS_DEAD);
+ return;
+ } else if (stricmp(Argv[Index], "-l") == 0) {
+ mOptions.CreateRecordListFile = TRUE;
+ gCIfrRecordInfoDB.TurnOn ();
+ } else if (stricmp(Argv[Index], "-i") == 0) {
+ Index++;
+ if ((Index >= Argc) || (Argv[Index][0] == '-')) {
+ DebugError (NULL, 0, 1001, "Missing option", "-i missing path argument");
+ goto Fail;
+ }
+
+ AppendIncludePath(Argv[Index]);
+ } else if (stricmp(Argv[Index], "-o") == 0 || stricmp(Argv[Index], "--output-directory") == 0 || stricmp(Argv[Index], "-od") == 0) {
+ Index++;
+ if ((Index >= Argc) || (Argv[Index][0] == '-')) {
+ DebugError (NULL, 0, 1001, "Missing option", "-o missing output directory name");
+ goto Fail;
+ }
+
+ mOptions.OutputDirectory = (CHAR8 *) malloc (strlen (Argv[Index]) + strlen ("\\") + 1);
+ if (mOptions.OutputDirectory == NULL) {
+ DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
+ goto Fail;
+ }
+ strcpy (mOptions.OutputDirectory, Argv[Index]);
+
+ CHAR8 lastChar = mOptions.OutputDirectory[strlen(mOptions.OutputDirectory) - 1];
+ if ((lastChar != '/') && (lastChar != '\\')) {
+ if (strchr(mOptions.OutputDirectory, '/') != NULL) {
+ strcat (mOptions.OutputDirectory, "/");
+ } else {
+ strcat (mOptions.OutputDirectory, "\\");
+ }
+ }
+ DebugMsg (NULL, 0, 9, (CHAR8 *) "Output Directory", (CHAR8 *) "%s", mOptions.OutputDirectory);
+ } else if (stricmp(Argv[Index], "-b") == 0 || stricmp(Argv[Index], "--create-ifr-package") == 0 || stricmp(Argv[Index], "-ibin") == 0) {
+ mOptions.CreateIfrPkgFile = TRUE;
+ } else if (stricmp(Argv[Index], "-n") == 0 || stricmp(Argv[Index], "--no-pre-processing") == 0 || stricmp(Argv[Index], "-nopp") == 0) {
+ mOptions.SkipCPreprocessor = TRUE;
+ } else if (stricmp(Argv[Index], "-f") == 0 || stricmp(Argv[Index], "--pre-processing-flag") == 0 || stricmp(Argv[Index], "-ppflag") == 0) {
+ Index++;
+ if ((Index >= Argc) || (Argv[Index][0] == '-')) {
+ DebugError (NULL, 0, 1001, "Missing option", "-od - missing C-preprocessor argument");
+ goto Fail;
+ }
+
+ AppendCPreprocessorOptions (Argv[Index]);
+ } else if (stricmp(Argv[Index], "-s") == 0|| stricmp(Argv[Index], "--string-db") == 0) {
+ Index++;
+ if ((Index >= Argc) || (Argv[Index][0] == '-')) {
+ DebugError (NULL, 0, 1001, "Missing option", "-s missing input string file name");
+ goto Fail;
+ }
+ gCVfrStringDB.SetStringFileName(Argv[Index]);
+ DebugMsg (NULL, 0, 9, (CHAR8 *) "Input string file path", (CHAR8 *) "%s", Argv[Index]);
+ } else if ((stricmp (Argv[Index], "-g") == 0) || (stricmp (Argv[Index], "--guid") == 0)) {
+ Index++;
+ Status = StringToGuid (Argv[Index], &mOptions.OverrideClassGuid);
+ if (EFI_ERROR (Status)) {
+ DebugError (NULL, 0, 1000, "Invalid format:", "%s", Argv[Index]);
+ goto Fail;
+ }
+ mOptions.HasOverrideClassGuid = TRUE;
+ } else if (stricmp(Argv[Index], "-w") == 0 || stricmp(Argv[Index], "--warning-as-error") == 0) {
+ mOptions.WarningAsError = TRUE;
+ } else if (stricmp(Argv[Index], "-a") == 0 ||stricmp(Argv[Index], "--autodefault") == 0) {
+ mOptions.AutoDefault = TRUE;
+ } else if (stricmp(Argv[Index], "-d") == 0 ||stricmp(Argv[Index], "--checkdefault") == 0) {
+ mOptions.CheckDefault = TRUE;
+ } else {
+ DebugError (NULL, 0, 1000, "Unknown option", "unrecognized option %s", Argv[Index]);
+ goto Fail;
+ }
+ }
+
+ if (Index != Argc - 1) {
+ DebugError (NULL, 0, 1001, "Missing option", "VFR file name is not specified.");
+ goto Fail;
+ } else {
+ mOptions.VfrFileName = (CHAR8 *) malloc (strlen (Argv[Index]) + 1);
+ if (mOptions.VfrFileName == NULL) {
+ DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
+ goto Fail;
+ }
+ strcpy (mOptions.VfrFileName, Argv[Index]);
+
+ if (mOptions.OutputDirectory == NULL) {
+ mOptions.OutputDirectory = (CHAR8 *) malloc (1);
+ if (mOptions.OutputDirectory == NULL) {
+ DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
+ goto Fail;
+ }
+ mOptions.OutputDirectory[0] = '\0';
+ }
+ }
+
+ if (SetBaseFileName() != 0) {
+ goto Fail;
+ }
+ if (SetPkgOutputFileName () != 0) {
+ goto Fail;
+ }
+ if (SetCOutputFileName() != 0) {
+ goto Fail;
+ }
+ if (SetPreprocessorOutputFileName () != 0) {
+ goto Fail;
+ }
+ if (SetRecordListFileName () != 0) {
+ goto Fail;
+ }
+ return;
+
+Fail:
+ SET_RUN_STATUS (STATUS_DEAD);
+
+ mOptions.CreateRecordListFile = FALSE;
+ mOptions.CreateIfrPkgFile = FALSE;
+
+ if (mOptions.VfrFileName != NULL) {
+ free (mOptions.VfrFileName);
+ mOptions.VfrFileName = NULL;
+ }
+ if (mOptions.VfrBaseFileName != NULL) {
+ free (mOptions.VfrBaseFileName);
+ mOptions.VfrBaseFileName = NULL;
+ }
+ if (mOptions.OutputDirectory != NULL) {
+ free (mOptions.OutputDirectory);
+ mOptions.OutputDirectory = NULL;
+ }
+ if (mOptions.PkgOutputFileName != NULL) {
+ free (mOptions.PkgOutputFileName);
+ mOptions.PkgOutputFileName = NULL;
+ }
+ if (mOptions.COutputFileName != NULL) {
+ free (mOptions.COutputFileName);
+ mOptions.COutputFileName = NULL;
+ }
+ if (mOptions.PreprocessorOutputFileName != NULL) {
+ free (mOptions.PreprocessorOutputFileName);
+ mOptions.PreprocessorOutputFileName = NULL;
+ }
+ if (mOptions.RecordListFile != NULL) {
+ free (mOptions.RecordListFile);
+ mOptions.RecordListFile = NULL;
+ }
+ if (mOptions.IncludePaths != NULL) {
+ delete mOptions.IncludePaths;
+ mOptions.IncludePaths = NULL;
+ }
+ if (mOptions.CPreprocessorOptions != NULL) {
+ delete mOptions.CPreprocessorOptions;
+ mOptions.CPreprocessorOptions = NULL;
+ }
+}
+
+VOID
+CVfrCompiler::AppendIncludePath (
+ IN CHAR8 *PathStr
+ )
+{
+ UINT32 Len = 0;
+ CHAR8 *IncludePaths = NULL;
+
+ Len = strlen (" -I ") + strlen (PathStr) + 1;
+ if (mOptions.IncludePaths != NULL) {
+ Len += strlen (mOptions.IncludePaths);
+ }
+ IncludePaths = new CHAR8[Len];
+ if (IncludePaths == NULL) {
+ DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
+ return;
+ }
+ IncludePaths[0] = '\0';
+ if (mOptions.IncludePaths != NULL) {
+ strcat (IncludePaths, mOptions.IncludePaths);
+ }
+ strcat (IncludePaths, " -I ");
+ strcat (IncludePaths, PathStr);
+ if (mOptions.IncludePaths != NULL) {
+ delete[] mOptions.IncludePaths;
+ }
+ mOptions.IncludePaths = IncludePaths;
+}
+
+VOID
+CVfrCompiler::AppendCPreprocessorOptions (
+ IN CHAR8 *Options
+ )
+{
+ UINT32 Len = 0;
+ CHAR8 *Opt = NULL;
+
+ Len = strlen (Options) + strlen (" ") + 1;
+ if (mOptions.CPreprocessorOptions != NULL) {
+ Len += strlen (mOptions.CPreprocessorOptions);
+ }
+ Opt = new CHAR8[Len];
+ if (Opt == NULL) {
+ DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
+ return;
+ }
+ Opt[0] = 0;
+ if (mOptions.CPreprocessorOptions != NULL) {
+ strcat (Opt, mOptions.CPreprocessorOptions);
+ }
+ strcat (Opt, " ");
+ strcat (Opt, Options);
+ if (mOptions.CPreprocessorOptions != NULL) {
+ delete[] mOptions.CPreprocessorOptions;
+ }
+ mOptions.CPreprocessorOptions = Opt;
+}
+
+INT8
+CVfrCompiler::SetBaseFileName (
+ VOID
+ )
+{
+ CHAR8 *pFileName, *pPath, *pExt;
+
+ if (mOptions.VfrFileName == NULL) {
+ return -1;
+ }
+
+ pFileName = mOptions.VfrFileName;
+ while (
+ ((pPath = strchr (pFileName, '\\')) != NULL) ||
+ ((pPath = strchr (pFileName, '/')) != NULL)
+ )
+ {
+ pFileName = pPath + 1;
+ }
+
+ if (pFileName == NULL) {
+ return -1;
+ }
+
+ if ((pExt = strchr (pFileName, '.')) == NULL) {
+ return -1;
+ }
+
+ *pExt = '\0';
+
+ mOptions.VfrBaseFileName = (CHAR8 *) malloc (strlen (pFileName) + 1);
+ if (mOptions.VfrBaseFileName == NULL) {
+ *pExt = '.';
+ return -1;
+ }
+
+ strcpy (mOptions.VfrBaseFileName, pFileName);
+ *pExt = '.';
+
+ return 0;
+}
+
+INT8
+CVfrCompiler::SetPkgOutputFileName (
+ VOID
+ )
+{
+ INTN Length;
+
+ if (mOptions.VfrBaseFileName == NULL) {
+ return -1;
+ }
+
+ Length = strlen (mOptions.OutputDirectory) +
+ strlen (mOptions.VfrBaseFileName) +
+ strlen (VFR_PACKAGE_FILENAME_EXTENSION) +
+ 1;
+
+ mOptions.PkgOutputFileName = (CHAR8 *) malloc (Length);
+ if (mOptions.PkgOutputFileName == NULL) {
+ return -1;
+ }
+
+ strcpy (mOptions.PkgOutputFileName, mOptions.OutputDirectory);
+ strcat (mOptions.PkgOutputFileName, mOptions.VfrBaseFileName);
+ strcat (mOptions.PkgOutputFileName, VFR_PACKAGE_FILENAME_EXTENSION);
+
+ return 0;
+}
+
+INT8
+CVfrCompiler::SetCOutputFileName (
+ VOID
+ )
+{
+ INTN Length;
+
+ if (mOptions.VfrBaseFileName == NULL) {
+ return -1;
+ }
+
+ Length = strlen (mOptions.OutputDirectory) +
+ strlen (mOptions.VfrBaseFileName) +
+ strlen (".c") +
+ 1;
+
+ mOptions.COutputFileName = (CHAR8 *) malloc (Length);
+ if (mOptions.COutputFileName == NULL) {
+ return -1;
+ }
+
+ strcpy (mOptions.COutputFileName, mOptions.OutputDirectory);
+ strcat (mOptions.COutputFileName, mOptions.VfrBaseFileName);
+ strcat (mOptions.COutputFileName, ".c");
+
+ return 0;
+}
+
+INT8
+CVfrCompiler::SetPreprocessorOutputFileName (
+ VOID
+ )
+{
+ INTN Length;
+
+ if (mOptions.VfrBaseFileName == NULL) {
+ return -1;
+ }
+
+ Length = strlen (mOptions.OutputDirectory) +
+ strlen (mOptions.VfrBaseFileName) +
+ strlen (VFR_PREPROCESS_FILENAME_EXTENSION) +
+ 1;
+
+ mOptions.PreprocessorOutputFileName = (CHAR8 *) malloc (Length);
+ if (mOptions.PreprocessorOutputFileName == NULL) {
+ return -1;
+ }
+
+ strcpy (mOptions.PreprocessorOutputFileName, mOptions.OutputDirectory);
+ strcat (mOptions.PreprocessorOutputFileName, mOptions.VfrBaseFileName);
+ strcat (mOptions.PreprocessorOutputFileName, VFR_PREPROCESS_FILENAME_EXTENSION);
+
+ return 0;
+}
+
+INT8
+CVfrCompiler::SetRecordListFileName (
+ VOID
+ )
+{
+ INTN Length;
+
+ if (mOptions.VfrBaseFileName == NULL) {
+ return -1;
+ }
+
+ Length = strlen (mOptions.OutputDirectory) +
+ strlen (mOptions.VfrBaseFileName) +
+ strlen (VFR_RECORDLIST_FILENAME_EXTENSION) +
+ 1;
+
+ mOptions.RecordListFile = (CHAR8 *) malloc (Length);
+ if (mOptions.RecordListFile == NULL) {
+ return -1;
+ }
+
+ strcpy (mOptions.RecordListFile, mOptions.OutputDirectory);
+ strcat (mOptions.RecordListFile, mOptions.VfrBaseFileName);
+ strcat (mOptions.RecordListFile, VFR_RECORDLIST_FILENAME_EXTENSION);
+
+ return 0;
+}
+
+CVfrCompiler::CVfrCompiler (
+ IN INT32 Argc,
+ IN CHAR8 **Argv
+ )
+{
+ mPreProcessCmd = (CHAR8 *) PREPROCESSOR_COMMAND;
+ mPreProcessOpt = (CHAR8 *) PREPROCESSOR_OPTIONS;
+
+ SET_RUN_STATUS (STATUS_STARTED);
+
+ OptionInitialization(Argc, Argv);
+
+ if ((IS_RUN_STATUS(STATUS_FAILED)) || (IS_RUN_STATUS(STATUS_DEAD))) {
+ return;
+ }
+
+ SET_RUN_STATUS(STATUS_INITIALIZED);
+}
+
+CVfrCompiler::~CVfrCompiler (
+ VOID
+ )
+{
+ if (mOptions.VfrFileName != NULL) {
+ free (mOptions.VfrFileName);
+ mOptions.VfrFileName = NULL;
+ }
+
+ if (mOptions.VfrBaseFileName != NULL) {
+ free (mOptions.VfrBaseFileName);
+ mOptions.VfrBaseFileName = NULL;
+ }
+
+ if (mOptions.OutputDirectory != NULL) {
+ free (mOptions.OutputDirectory);
+ mOptions.OutputDirectory = NULL;
+ }
+
+ if (mOptions.PkgOutputFileName != NULL) {
+ free (mOptions.PkgOutputFileName);
+ mOptions.PkgOutputFileName = NULL;
+ }
+
+ if (mOptions.COutputFileName != NULL) {
+ free (mOptions.COutputFileName);
+ mOptions.COutputFileName = NULL;
+ }
+
+ if (mOptions.PreprocessorOutputFileName != NULL) {
+ free (mOptions.PreprocessorOutputFileName);
+ mOptions.PreprocessorOutputFileName = NULL;
+ }
+
+ if (mOptions.RecordListFile != NULL) {
+ free (mOptions.RecordListFile);
+ mOptions.RecordListFile = NULL;
+ }
+
+ if (mOptions.IncludePaths != NULL) {
+ delete[] mOptions.IncludePaths;
+ mOptions.IncludePaths = NULL;
+ }
+
+ if (mOptions.CPreprocessorOptions != NULL) {
+ delete[] mOptions.CPreprocessorOptions;
+ mOptions.CPreprocessorOptions = NULL;
+ }
+
+ SET_RUN_STATUS(STATUS_DEAD);
+}
+
+VOID
+CVfrCompiler::Usage (
+ VOID
+ )
+{
+ UINT32 Index;
+ CONST CHAR8 *Help[] = {
+ " ",
+ "VfrCompile version " VFR_COMPILER_VERSION "Build " __BUILD_VERSION,
+ "Copyright (c) 2004-2016 Intel Corporation. All rights reserved.",
+ " ",
+ "Usage: VfrCompile [options] VfrFile",
+ " ",
+ "Options:",
+ " -h, --help prints this help",
+ " --version prints version info",
+ " -l create an output IFR listing file",
+ " -o DIR, --output-directory DIR",
+ " deposit all output files to directory OutputDir",
+ " default is current directory",
+ " -b, --create-ifr-package",
+ " create an IFR HII pack file",
+ " -n, --no-pre-processing",
+ " do not preprocessing input file",
+ " -s, --string-db",
+ " input uni string package file",
+ " -g, --guid",
+ " override class guid input",
+ " format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
+ " -w --warning-as-error",
+ " treat warning as an error",
+ " -a --autodefaut generate default value for question opcode if some default is missing",
+ " -d --checkdefault check the default information in a question opcode",
+ NULL
+ };
+ for (Index = 0; Help[Index] != NULL; Index++) {
+ fprintf (stdout, "%s\n", Help[Index]);
+ }
+}
+
+VOID
+CVfrCompiler::Version (
+ VOID
+ )
+{
+ UINT32 Index;
+ CONST CHAR8 *Help[] = {
+ "VfrCompile version " VFR_COMPILER_VERSION "Build " __BUILD_VERSION,
+ NULL
+ };
+ for (Index = 0; Help[Index] != NULL; Index++) {
+ fprintf (stdout, "%s\n", Help[Index]);
+ }
+}
+
+VOID
+CVfrCompiler::PreProcess (
+ VOID
+ )
+{
+ FILE *pVfrFile = NULL;
+ UINT32 CmdLen = 0;
+ CHAR8 *PreProcessCmd = NULL;
+
+ if (!IS_RUN_STATUS(STATUS_INITIALIZED)) {
+ goto Fail;
+ }
+
+ if (mOptions.SkipCPreprocessor == TRUE) {
+ goto Out;
+ }
+
+ if ((pVfrFile = fopen (LongFilePath (mOptions.VfrFileName), "r")) == NULL) {
+ DebugError (NULL, 0, 0001, "Error opening the input VFR file", "%s", mOptions.VfrFileName);
+ goto Fail;
+ }
+ fclose (pVfrFile);
+
+ CmdLen = strlen (mPreProcessCmd) + strlen (mPreProcessOpt) +
+ strlen (mOptions.VfrFileName) + strlen (mOptions.PreprocessorOutputFileName);
+ if (mOptions.CPreprocessorOptions != NULL) {
+ CmdLen += strlen (mOptions.CPreprocessorOptions);
+ }
+ if (mOptions.IncludePaths != NULL) {
+ CmdLen += strlen (mOptions.IncludePaths);
+ }
+
+ PreProcessCmd = new CHAR8[CmdLen + 10];
+ if (PreProcessCmd == NULL) {
+ DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
+ goto Fail;
+ }
+ strcpy (PreProcessCmd, mPreProcessCmd), strcat (PreProcessCmd, " ");
+ strcat (PreProcessCmd, mPreProcessOpt), strcat (PreProcessCmd, " ");
+ if (mOptions.IncludePaths != NULL) {
+ strcat (PreProcessCmd, mOptions.IncludePaths), strcat (PreProcessCmd, " ");
+ }
+ if (mOptions.CPreprocessorOptions != NULL) {
+ strcat (PreProcessCmd, mOptions.CPreprocessorOptions), strcat (PreProcessCmd, " ");
+ }
+ strcat (PreProcessCmd, mOptions.VfrFileName), strcat (PreProcessCmd, " > ");
+ strcat (PreProcessCmd, mOptions.PreprocessorOutputFileName);
+
+ if (system (PreProcessCmd) != 0) {
+ DebugError (NULL, 0, 0003, "Error parsing file", "failed to spawn C preprocessor on VFR file %s\n", PreProcessCmd);
+ goto Fail;
+ }
+
+ delete[] PreProcessCmd;
+
+Out:
+ SET_RUN_STATUS (STATUS_PREPROCESSED);
+ return;
+
+Fail:
+ if (!IS_RUN_STATUS(STATUS_DEAD)) {
+ SET_RUN_STATUS (STATUS_FAILED);
+ }
+ delete[] PreProcessCmd;
+}
+
+extern UINT8 VfrParserStart (IN FILE *, IN INPUT_INFO_TO_SYNTAX *);
+
+VOID
+CVfrCompiler::Compile (
+ VOID
+ )
+{
+ FILE *pInFile = NULL;
+ CHAR8 *InFileName = NULL;
+ INPUT_INFO_TO_SYNTAX InputInfo;
+
+ if (!IS_RUN_STATUS(STATUS_PREPROCESSED)) {
+ goto Fail;
+ }
+
+ InFileName = (mOptions.SkipCPreprocessor == TRUE) ? mOptions.VfrFileName : mOptions.PreprocessorOutputFileName;
+
+ gCVfrErrorHandle.SetInputFile (InFileName);
+ gCVfrErrorHandle.SetWarningAsError(mOptions.WarningAsError);
+
+ if ((pInFile = fopen (LongFilePath (InFileName), "r")) == NULL) {
+ DebugError (NULL, 0, 0001, "Error opening the input file", "%s", InFileName);
+ goto Fail;
+ }
+
+ if (mOptions.HasOverrideClassGuid) {
+ InputInfo.OverrideClassGuid = &mOptions.OverrideClassGuid;
+ } else {
+ InputInfo.OverrideClassGuid = NULL;
+ }
+
+ if (VfrParserStart (pInFile, &InputInfo) != 0) {
+ goto Fail;
+ }
+
+ fclose (pInFile);
+ pInFile = NULL;
+
+ if (gCFormPkg.HavePendingUnassigned () == TRUE) {
+ gCFormPkg.PendingAssignPrintAll ();
+ goto Fail;
+ }
+
+ SET_RUN_STATUS (STATUS_COMPILEED);
+ return;
+
+Fail:
+ if (!IS_RUN_STATUS(STATUS_DEAD)) {
+ DebugError (NULL, 0, 0003, "Error parsing", "compile error in file %s", InFileName);
+ SET_RUN_STATUS (STATUS_FAILED);
+ }
+ if (pInFile != NULL) {
+ fclose (pInFile);
+ }
+}
+
+VOID
+CVfrCompiler::AdjustBin (
+ VOID
+ )
+{
+ EFI_VFR_RETURN_CODE Status;
+
+ if (!IS_RUN_STATUS(STATUS_COMPILEED)) {
+ return;
+ }
+
+ if (gNeedAdjustOpcode) {
+ //
+ // When parsing the Vfr, has created some opcodes, now need to update the record info.
+ //
+ gCIfrRecordInfoDB.IfrUpdateRecordInfoForDynamicOpcode (FALSE);
+ }
+
+ //
+ // Check whether need to check default info for question or auto add default for question.
+ //
+ if (mOptions.AutoDefault || mOptions.CheckDefault) {
+ gCIfrRecordInfoDB.IfrCheckAddDefaultRecord (mOptions.AutoDefault, mOptions.CheckDefault);
+ }
+
+ //
+ // Check Binary Code consistent between Form and IfrRecord
+ //
+
+ //
+ // Get Package Data and IfrRecord Data
+ //
+ gCFormPkg.BuildPkg (gCBuffer);
+ gCIfrRecordInfoDB.IfrRecordOutput (gRBuffer);
+
+ //
+ // Compare Form and Record data
+ //
+ if (gCBuffer.Buffer != NULL && gRBuffer.Buffer != NULL) {
+ UINT32 Index;
+ if (gCBuffer.Size != gRBuffer.Size) {
+ DebugError (NULL, 0, 0001, "Error parsing vfr file", " %s. FormBinary Size 0x%X is not same to RecordBuffer Size 0x%X", mOptions.VfrFileName, gCBuffer.Size, gRBuffer.Size);
+ }
+ for (Index = 0; Index < gCBuffer.Size; Index ++) {
+ if (gCBuffer.Buffer[Index] != gRBuffer.Buffer[Index]) {
+ break;
+ }
+ }
+ if (Index != gCBuffer.Size) {
+ DebugError (NULL, 0, 0001, "Error parsing vfr file", " %s. the 0x%X byte is different between Form and Record", mOptions.VfrFileName, Index);
+ }
+ DebugMsg (NULL, 0, 9, (CHAR8 *) "IFR Buffer", (CHAR8 *) "Form Buffer same to Record Buffer and Size is 0x%X", Index);
+ } else if (gCBuffer.Buffer == NULL && gRBuffer.Buffer == NULL) {
+ //ok
+ } else {
+ DebugError (NULL, 0, 0001, "Error parsing vfr file", " %s.Buffer not allocated.", mOptions.VfrFileName);
+ }
+
+ return;
+}
+
+VOID
+CVfrCompiler::GenBinary (
+ VOID
+ )
+{
+ FILE *pFile = NULL;
+
+ if (!IS_RUN_STATUS(STATUS_COMPILEED)) {
+ goto Fail;
+ }
+
+ if (mOptions.CreateIfrPkgFile == TRUE) {
+ if ((pFile = fopen (LongFilePath (mOptions.PkgOutputFileName), "wb")) == NULL) {
+ DebugError (NULL, 0, 0001, "Error opening file", "%s", mOptions.PkgOutputFileName);
+ goto Fail;
+ }
+ if (gCFormPkg.BuildPkg (pFile, &gRBuffer) != VFR_RETURN_SUCCESS) {
+ fclose (pFile);
+ goto Fail;
+ }
+ fclose (pFile);
+ }
+
+ SET_RUN_STATUS (STATUS_GENBINARY);
+
+ return;
+
+Fail:
+ if (!IS_RUN_STATUS(STATUS_DEAD)) {
+ SET_RUN_STATUS (STATUS_FAILED);
+ }
+}
+
+static const char *gSourceFileHeader[] = {
+ "//",
+ "// DO NOT EDIT -- auto-generated file",
+ "//",
+ "// This file is generated by the vfrcompiler utility",
+ "//",
+ NULL
+};
+
+VOID
+CVfrCompiler::GenCFile (
+ VOID
+ )
+{
+ FILE *pFile;
+ UINT32 Index;
+
+ if (!IS_RUN_STATUS(STATUS_GENBINARY)) {
+ goto Fail;
+ }
+
+ if (!mOptions.CreateIfrPkgFile) {
+ if ((pFile = fopen (LongFilePath (mOptions.COutputFileName), "w")) == NULL) {
+ DebugError (NULL, 0, 0001, "Error opening output C file", "%s", mOptions.COutputFileName);
+ goto Fail;
+ }
+
+ for (Index = 0; gSourceFileHeader[Index] != NULL; Index++) {
+ fprintf (pFile, "%s\n", gSourceFileHeader[Index]);
+ }
+
+ if (gCFormPkg.GenCFile (mOptions.VfrBaseFileName, pFile, &gRBuffer) != VFR_RETURN_SUCCESS) {
+ fclose (pFile);
+ goto Fail;
+ }
+ fclose (pFile);
+ }
+
+ SET_RUN_STATUS (STATUS_FINISHED);
+ return;
+
+Fail:
+ if (!IS_RUN_STATUS(STATUS_DEAD)) {
+ SET_RUN_STATUS (STATUS_FAILED);
+ }
+}
+
+VOID
+CVfrCompiler::GenRecordListFile (
+ VOID
+ )
+{
+ CHAR8 *InFileName = NULL;
+ FILE *pInFile = NULL;
+ FILE *pOutFile = NULL;
+ CHAR8 LineBuf[MAX_VFR_LINE_LEN];
+ UINT32 LineNo;
+
+ InFileName = (mOptions.SkipCPreprocessor == TRUE) ? mOptions.VfrFileName : mOptions.PreprocessorOutputFileName;
+
+ if (mOptions.CreateRecordListFile == TRUE && InFileName != NULL && mOptions.RecordListFile != NULL) {
+ if ((InFileName[0] == '\0') || (mOptions.RecordListFile[0] == '\0')) {
+ return;
+ }
+
+ if ((pInFile = fopen (LongFilePath (InFileName), "r")) == NULL) {
+ DebugError (NULL, 0, 0001, "Error opening the input VFR preprocessor output file", "%s", InFileName);
+ return;
+ }
+
+ if ((pOutFile = fopen (LongFilePath (mOptions.RecordListFile), "w")) == NULL) {
+ DebugError (NULL, 0, 0001, "Error opening the record list file", "%s", mOptions.RecordListFile);
+ goto Err1;
+ }
+
+ fprintf (pOutFile, "//\n// VFR compiler version " VFR_COMPILER_VERSION __BUILD_VERSION "\n//\n");
+ LineNo = 0;
+ while (!feof (pInFile)) {
+ if (fgets (LineBuf, MAX_VFR_LINE_LEN, pInFile) != NULL) {
+ fprintf (pOutFile, "%s", LineBuf);
+ LineNo++;
+ gCIfrRecordInfoDB.IfrRecordOutput (pOutFile, LineNo);
+ }
+ }
+
+ fprintf (pOutFile, "\n//\n// All Opcode Record List \n//\n");
+ gCIfrRecordInfoDB.IfrRecordOutput (pOutFile, 0);
+ gCVfrVarDataTypeDB.Dump(pOutFile);
+
+ fclose (pOutFile);
+ fclose (pInFile);
+ }
+
+ return;
+
+Err1:
+ fclose (pInFile);
+}
+
+int
+main (
+ IN int Argc,
+ IN char **Argv
+ )
+{
+ COMPILER_RUN_STATUS Status;
+
+ SetPrintLevel(WARNING_LOG_LEVEL);
+ CVfrCompiler Compiler(Argc, Argv);
+
+ Compiler.PreProcess();
+ Compiler.Compile();
+ Compiler.AdjustBin();
+ Compiler.GenBinary();
+ Compiler.GenCFile();
+ Compiler.GenRecordListFile ();
+
+ Status = Compiler.RunStatus ();
+ if ((Status == STATUS_DEAD) || (Status == STATUS_FAILED)) {
+ return 2;
+ }
+
+ if (gCBuffer.Buffer != NULL) {
+ delete[] gCBuffer.Buffer;
+ }
+
+ if (gRBuffer.Buffer != NULL) {
+ delete[] gRBuffer.Buffer;
+ }
+
+ return GetUtilityStatus ();
+}
+
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/VfrCompiler.h b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrCompiler.h
new file mode 100644
index 000000000..b6e207d2c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrCompiler.h
@@ -0,0 +1,108 @@
+/** @file
+
+ VfrCompiler internal definitions.
+
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _VFRCOMPILER_H_
+#define _VFRCOMPILER_H_
+
+#include "Common/UefiBaseTypes.h"
+#include "EfiVfr.h"
+#include "VfrFormPkg.h"
+#include "VfrUtilityLib.h"
+#include "ParseInf.h"
+
+#define PROGRAM_NAME "VfrCompile"
+#define VFR_COMPILER_VERSION " 2.01 (UEFI 2.4) "
+//
+// This is how we invoke the C preprocessor on the VFR source file
+// to resolve #defines, #includes, etc. To make C source files
+// shareable between VFR and drivers, define VFRCOMPILE so that
+// #ifdefs can be used in shared .h files.
+//
+#define PREPROCESSOR_COMMAND "cl "
+#define PREPROCESSOR_OPTIONS "/nologo /E /TC /DVFRCOMPILE "
+
+//
+// Specify the filename extensions for the files we generate.
+//
+#define VFR_PREPROCESS_FILENAME_EXTENSION ".i"
+#define VFR_PACKAGE_FILENAME_EXTENSION ".hpk"
+#define VFR_RECORDLIST_FILENAME_EXTENSION ".lst"
+
+typedef struct {
+ CHAR8 *VfrFileName;
+ CHAR8 *RecordListFile;
+ CHAR8 *PkgOutputFileName;
+ CHAR8 *COutputFileName;
+ bool CreateRecordListFile;
+ bool CreateIfrPkgFile;
+ CHAR8 *OutputDirectory;
+ CHAR8 *PreprocessorOutputFileName;
+ CHAR8 *VfrBaseFileName; // name of input VFR file with no path or extension
+ CHAR8 *IncludePaths;
+ bool SkipCPreprocessor;
+ CHAR8 *CPreprocessorOptions;
+ BOOLEAN HasOverrideClassGuid;
+ EFI_GUID OverrideClassGuid;
+ BOOLEAN WarningAsError;
+ BOOLEAN AutoDefault;
+ BOOLEAN CheckDefault;
+} OPTIONS;
+
+typedef enum {
+ STATUS_STARTED = 0,
+ STATUS_INITIALIZED,
+ STATUS_PREPROCESSED,
+ STATUS_COMPILEED,
+ STATUS_GENBINARY,
+ STATUS_FINISHED,
+ STATUS_FAILED,
+ STATUS_DEAD,
+} COMPILER_RUN_STATUS;
+
+class CVfrCompiler {
+private:
+ COMPILER_RUN_STATUS mRunStatus;
+ OPTIONS mOptions;
+ CHAR8 *mPreProcessCmd;
+ CHAR8 *mPreProcessOpt;
+
+ VOID OptionInitialization (IN INT32 , IN CHAR8 **);
+ VOID AppendIncludePath (IN CHAR8 *);
+ VOID AppendCPreprocessorOptions (IN CHAR8 *);
+ INT8 SetBaseFileName (VOID);
+ INT8 SetPkgOutputFileName (VOID);
+ INT8 SetCOutputFileName(VOID);
+ INT8 SetPreprocessorOutputFileName (VOID);
+ INT8 SetRecordListFileName (VOID);
+
+ VOID SET_RUN_STATUS (IN COMPILER_RUN_STATUS);
+ BOOLEAN IS_RUN_STATUS (IN COMPILER_RUN_STATUS);
+
+public:
+ COMPILER_RUN_STATUS RunStatus (VOID) {
+ return mRunStatus;
+ }
+
+public:
+ CVfrCompiler (IN INT32 , IN CHAR8 **);
+ ~CVfrCompiler ();
+
+ VOID Usage (VOID);
+ VOID Version (VOID);
+
+ VOID PreProcess (VOID);
+ VOID Compile (VOID);
+ VOID AdjustBin (VOID);
+ VOID GenBinary (VOID);
+ VOID GenCFile (VOID);
+ VOID GenRecordListFile (VOID);
+ VOID DebugError (IN CHAR8*, IN UINT32, IN UINT32, IN CONST CHAR8*, IN CONST CHAR8*, ...);
+};
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/VfrError.cpp b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrError.cpp
new file mode 100644
index 000000000..65bb8e34f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrError.cpp
@@ -0,0 +1,297 @@
+/** @file
+
+ VfrCompiler error handler.
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "stdio.h"
+#include "string.h"
+#include "stdlib.h"
+#include "VfrError.h"
+#include "EfiUtilityMsgs.h"
+
+static SVFR_ERROR_HANDLE VFR_ERROR_HANDLE_TABLE [] = {
+ { VFR_RETURN_SUCCESS, NULL },
+ { VFR_RETURN_ERROR_SKIPED, NULL },
+ { VFR_RETURN_FATAL_ERROR, ": fatal error!!" },
+
+ { VFR_RETURN_MISMATCHED, ": unexpected token" },
+ { VFR_RETURN_INVALID_PARAMETER, ": invalid parameter" },
+ { VFR_RETURN_OUT_FOR_RESOURCES, ": system out of memory" },
+ { VFR_RETURN_UNSUPPORTED, ": unsupported" },
+ { VFR_RETURN_REDEFINED, ": already defined" },
+ { VFR_RETURN_FORMID_REDEFINED, ": form id already defined" },
+ { VFR_RETURN_QUESTIONID_REDEFINED, ": question id already defined" },
+ { VFR_RETURN_VARSTOREID_REDEFINED, ": varstore id already defined" },
+ { VFR_RETURN_UNDEFINED, ": undefined" },
+ { VFR_RETURN_VAR_NOTDEFINED_BY_QUESTION, ": some variable has not defined by a question"},
+ { VFR_RETURN_VARSTORE_DATATYPE_REDEFINED_ERROR, ": Data Structure is defined by more than one varstores, it can't be referred as varstore, only varstore name could be used."},
+ { VFR_RETURN_GET_EFIVARSTORE_ERROR, ": get efi varstore error"},
+ { VFR_RETURN_EFIVARSTORE_USE_ERROR, ": can not use the efi varstore like this" },
+ { VFR_RETURN_EFIVARSTORE_SIZE_ERROR, ": unsupport efi varstore size should be <= 8 bytes" },
+ { VFR_RETURN_GET_NVVARSTORE_ERROR, ": get name value varstore error" },
+ { VFR_RETURN_QVAR_REUSE, ": variable reused by more than one question" },
+ { VFR_RETURN_FLAGS_UNSUPPORTED, ": flags unsupported" },
+ { VFR_RETURN_ERROR_ARRARY_NUM, ": array number error, the valid value is in (0 ~ MAX_INDEX-1) for UEFI vfr and in (1 ~ MAX_INDEX) for Framework Vfr" },
+ { VFR_RETURN_DATA_STRING_ERROR, ": data field string error or not support"},
+ { VFR_RETURN_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"},
+ { VFR_RETURN_CONSTANT_ONLY, ": only constant is allowed in the expression"},
+ { VFR_RETURN_VARSTORE_NAME_REDEFINED_ERROR, ": Varstore name is defined by more than one varstores, it can't be referred as varstore, only varstore structure name could be used."},
+ { VFR_RETURN_BIT_WIDTH_ERROR, ": bit width must be <= sizeof (type) * 8 and the max width can not > 32" },
+ { VFR_RETURN_STRING_TO_UINT_OVERFLOW, ": String to UINT* Overflow"},
+ { VFR_RETURN_CODEUNDEFINED, ": undefined Error Code" }
+};
+
+static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE [] = {
+ { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"},
+ { VFR_WARNING_ACTION_WITH_TEXT_TWO, ": Action opcode should not have TextTwo part"},
+ { VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend to use obsoleted framework opcode"},
+ { VFR_WARNING_CODEUNDEFINED, ": undefined Warning Code" }
+};
+
+CVfrErrorHandle::CVfrErrorHandle (
+ VOID
+ )
+{
+ mInputFileName = NULL;
+ mScopeRecordListHead = NULL;
+ mScopeRecordListTail = NULL;
+ mVfrErrorHandleTable = VFR_ERROR_HANDLE_TABLE;
+ mVfrWarningHandleTable = VFR_WARNING_HANDLE_TABLE;
+ mWarningAsError = FALSE;
+}
+
+CVfrErrorHandle::~CVfrErrorHandle (
+ VOID
+ )
+{
+ SVfrFileScopeRecord *pNode = NULL;
+
+ if (mInputFileName != NULL) {
+ delete[] mInputFileName;
+ }
+
+ while (mScopeRecordListHead != NULL) {
+ pNode = mScopeRecordListHead;
+ mScopeRecordListHead = mScopeRecordListHead->mNext;
+ delete pNode;
+ }
+
+ mScopeRecordListHead = NULL;
+ mScopeRecordListTail = NULL;
+ mVfrErrorHandleTable = NULL;
+ mVfrWarningHandleTable = NULL;
+}
+
+VOID
+CVfrErrorHandle::SetWarningAsError (
+ IN BOOLEAN WarningAsError
+ )
+{
+ mWarningAsError = WarningAsError;
+}
+
+VOID
+CVfrErrorHandle::SetInputFile (
+ IN CHAR8 *InputFile
+ )
+{
+ if (InputFile != NULL) {
+ mInputFileName = new CHAR8[strlen(InputFile) + 1];
+ strcpy (mInputFileName, InputFile);
+ }
+}
+
+SVfrFileScopeRecord::SVfrFileScopeRecord (
+ IN CHAR8 *Record,
+ IN UINT32 LineNum
+ )
+{
+ UINT32 Index;
+ CHAR8 *FileName = NULL;
+ CHAR8 *Str = NULL;
+
+ mWholeScopeLine = LineNum;
+ mNext = NULL;
+
+ Str = strchr (Record, ' ');
+ mScopeLineStart = atoi (++Str);
+
+ Str = strchr (Str, '\"');
+ FileName = ++Str;
+
+ while((Str = strstr (FileName, "\\\\")) != NULL) {
+ FileName = Str + 2;
+ }
+ if ((mFileName = new CHAR8[strlen(FileName)]) != NULL) {
+ for (Index = 0; FileName[Index] != '\"'; Index++) {
+ mFileName[Index] = FileName[Index];
+ }
+ mFileName[Index] = '\0';
+ }
+
+ return;
+}
+
+SVfrFileScopeRecord::~SVfrFileScopeRecord (
+ VOID
+ )
+{
+ if (mFileName != NULL) {
+ delete[] mFileName;
+ }
+}
+
+VOID
+CVfrErrorHandle::ParseFileScopeRecord (
+ IN CHAR8 *Record,
+ IN UINT32 WholeScopeLine
+ )
+{
+ SVfrFileScopeRecord *pNode = NULL;
+
+ if (Record == NULL) {
+ return;
+ }
+
+ if ((pNode = new SVfrFileScopeRecord(Record, WholeScopeLine)) == NULL) {
+ return;
+ }
+
+ if (mScopeRecordListHead == NULL) {
+ mScopeRecordListTail = mScopeRecordListHead = pNode;
+ } else {
+ mScopeRecordListTail->mNext = pNode;
+ mScopeRecordListTail = pNode;
+ }
+}
+
+VOID
+CVfrErrorHandle::GetFileNameLineNum (
+ IN UINT32 LineNum,
+ OUT CHAR8 **FileName,
+ OUT UINT32 *FileLine
+ )
+{
+ SVfrFileScopeRecord *pNode = NULL;
+
+ if ((FileName == NULL) || (FileLine == NULL)) {
+ return;
+ }
+
+ *FileName = NULL;
+ *FileLine = 0xFFFFFFFF;
+
+ //
+ // Some errors occur before scope record list been built.
+ //
+ if (mScopeRecordListHead == NULL) {
+ *FileLine = LineNum;
+ *FileName = mInputFileName;
+ return ;
+ }
+
+ for (pNode = mScopeRecordListHead; pNode->mNext != NULL; pNode = pNode->mNext) {
+ if ((LineNum > pNode->mWholeScopeLine) && (pNode->mNext->mWholeScopeLine > LineNum)) {
+ *FileName = pNode->mFileName;
+ *FileLine = LineNum - pNode->mWholeScopeLine + pNode->mScopeLineStart - 1;
+ return ;
+ }
+ }
+
+ *FileName = pNode->mFileName;
+ *FileLine = LineNum - pNode->mWholeScopeLine + pNode->mScopeLineStart - 1;
+}
+
+VOID
+CVfrErrorHandle::PrintMsg (
+ IN UINT32 LineNum,
+ IN CHAR8 *TokName,
+ IN CONST CHAR8 *MsgType,
+ IN CONST CHAR8 *ErrorMsg
+ )
+{
+ CHAR8 *FileName = NULL;
+ UINT32 FileLine;
+
+ if (strncmp ("Warning", MsgType, strlen ("Warning")) == 0) {
+ VerboseMsg ((CHAR8 *) ErrorMsg);
+ return;
+ }
+ GetFileNameLineNum (LineNum, &FileName, &FileLine);
+ Error (FileName, FileLine, 0x3000, TokName, (CHAR8 *) "\t%s\n", (CHAR8 *) ErrorMsg);
+}
+
+UINT8
+CVfrErrorHandle::HandleError (
+ IN EFI_VFR_RETURN_CODE ErrorCode,
+ IN UINT32 LineNum,
+ IN CHAR8 *TokName
+ )
+{
+ UINT32 Index;
+ CHAR8 *FileName = NULL;
+ UINT32 FileLine;
+ CONST CHAR8 *ErrorMsg = NULL;
+
+ if (mVfrErrorHandleTable == NULL) {
+ return 1;
+ }
+
+ for (Index = 0; mVfrErrorHandleTable[Index].mErrorCode != VFR_RETURN_CODEUNDEFINED; Index++) {
+ if (ErrorCode == mVfrErrorHandleTable[Index].mErrorCode) {
+ ErrorMsg = mVfrErrorHandleTable[Index].mErrorMsg;
+ break;
+ }
+ }
+
+ if (ErrorMsg != NULL) {
+ GetFileNameLineNum (LineNum, &FileName, &FileLine);
+ Error (FileName, FileLine, 0x3000, TokName, (CHAR8 *) "\t%s\n", (CHAR8 *) ErrorMsg);
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+UINT8
+CVfrErrorHandle::HandleWarning (
+ IN EFI_VFR_WARNING_CODE WarningCode,
+ IN UINT32 LineNum,
+ IN CHAR8 *TokName
+ )
+{
+ UINT32 Index;
+ CHAR8 *FileName = NULL;
+ UINT32 FileLine;
+ CONST CHAR8 *WarningMsg = NULL;
+
+ if (mVfrWarningHandleTable == NULL) {
+ return 1;
+ }
+
+ GetFileNameLineNum (LineNum, &FileName, &FileLine);
+
+ if (mWarningAsError) {
+ Error (FileName, FileLine, 0x2220, (CHAR8 *) "warning treated as error", NULL);
+ }
+
+ for (Index = 0; mVfrWarningHandleTable[Index].mWarningCode != VFR_WARNING_CODEUNDEFINED; Index++) {
+ if (WarningCode == mVfrWarningHandleTable[Index].mWarningCode) {
+ WarningMsg = mVfrWarningHandleTable[Index].mWarningMsg;
+ break;
+ }
+ }
+
+ if (WarningMsg != NULL) {
+ Warning (FileName, FileLine, 0, TokName, (CHAR8 *) "\t%s\n", (CHAR8 *) WarningMsg);
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+CVfrErrorHandle gCVfrErrorHandle;
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/VfrError.h b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrError.h
new file mode 100644
index 000000000..7d16bd5f7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrError.h
@@ -0,0 +1,107 @@
+/** @file
+
+ VfrCompiler Error definition
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _VFRERROR_H_
+#define _VFRERROR_H_
+
+#include "Common/UefiBaseTypes.h"
+
+typedef enum {
+ VFR_RETURN_SUCCESS = 0,
+ VFR_RETURN_ERROR_SKIPED,
+ VFR_RETURN_FATAL_ERROR,
+ VFR_RETURN_MISMATCHED,
+ VFR_RETURN_INVALID_PARAMETER,
+ VFR_RETURN_OUT_FOR_RESOURCES,
+ VFR_RETURN_UNSUPPORTED,
+ VFR_RETURN_REDEFINED,
+ VFR_RETURN_FORMID_REDEFINED,
+ VFR_RETURN_QUESTIONID_REDEFINED,
+ VFR_RETURN_VARSTOREID_REDEFINED,
+ VFR_RETURN_UNDEFINED,
+ VFR_RETURN_VAR_NOTDEFINED_BY_QUESTION,
+ VFR_RETURN_VARSTORE_DATATYPE_REDEFINED_ERROR,
+ VFR_RETURN_GET_EFIVARSTORE_ERROR,
+ VFR_RETURN_EFIVARSTORE_USE_ERROR,
+ VFR_RETURN_EFIVARSTORE_SIZE_ERROR,
+ VFR_RETURN_GET_NVVARSTORE_ERROR,
+ VFR_RETURN_QVAR_REUSE,
+ VFR_RETURN_FLAGS_UNSUPPORTED,
+ VFR_RETURN_ERROR_ARRARY_NUM,
+ VFR_RETURN_DATA_STRING_ERROR,
+ VFR_RETURN_DEFAULT_VALUE_REDEFINED,
+ VFR_RETURN_CONSTANT_ONLY,
+ VFR_RETURN_VARSTORE_NAME_REDEFINED_ERROR,
+ VFR_RETURN_BIT_WIDTH_ERROR,
+ VFR_RETURN_STRING_TO_UINT_OVERFLOW,
+ VFR_RETURN_CODEUNDEFINED
+} EFI_VFR_RETURN_CODE;
+
+typedef enum {
+ VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0,
+ VFR_WARNING_ACTION_WITH_TEXT_TWO,
+ VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,
+ VFR_WARNING_CODEUNDEFINED
+} EFI_VFR_WARNING_CODE;
+
+typedef struct _SVFR_ERROR_HANDLE {
+ EFI_VFR_RETURN_CODE mErrorCode;
+ CONST CHAR8 *mErrorMsg;
+} SVFR_ERROR_HANDLE;
+
+typedef struct _SVFR_WARNING_HANDLE {
+ EFI_VFR_WARNING_CODE mWarningCode;
+ CONST CHAR8 *mWarningMsg;
+} SVFR_WARNING_HANDLE;
+
+struct SVfrFileScopeRecord {
+ CHAR8 *mFileName;
+ UINT32 mWholeScopeLine;
+ UINT32 mScopeLineStart;
+ SVfrFileScopeRecord *mNext;
+
+ SVfrFileScopeRecord (IN CHAR8 *, IN UINT32);
+ ~SVfrFileScopeRecord();
+
+private:
+ SVfrFileScopeRecord (IN CONST SVfrFileScopeRecord&); // Prevent copy-construction
+ SVfrFileScopeRecord& operator= (IN CONST SVfrFileScopeRecord&); // Prevent assignment
+};
+
+class CVfrErrorHandle {
+private:
+ CHAR8 *mInputFileName;
+ SVFR_ERROR_HANDLE *mVfrErrorHandleTable;
+ SVFR_WARNING_HANDLE *mVfrWarningHandleTable;
+ SVfrFileScopeRecord *mScopeRecordListHead;
+ SVfrFileScopeRecord *mScopeRecordListTail;
+ BOOLEAN mWarningAsError;
+
+public:
+ CVfrErrorHandle (VOID);
+ ~CVfrErrorHandle (VOID);
+
+ VOID SetWarningAsError (IN BOOLEAN);
+ VOID SetInputFile (IN CHAR8 *);
+ VOID ParseFileScopeRecord (IN CHAR8 *, IN UINT32);
+ VOID GetFileNameLineNum (IN UINT32, OUT CHAR8 **, OUT UINT32 *);
+ UINT8 HandleError (IN EFI_VFR_RETURN_CODE, IN UINT32 LineNum = 0, IN CHAR8 *TokName = NULL);
+ UINT8 HandleWarning (IN EFI_VFR_WARNING_CODE, IN UINT32 LineNum = 0, IN CHAR8 *TokName = NULL);
+ VOID PrintMsg (IN UINT32 LineNum = 0, IN CHAR8 *TokName = NULL, IN CONST CHAR8 *MsgType = "Error", IN CONST CHAR8 *ErrorMsg = "");
+
+private:
+ CVfrErrorHandle (IN CONST CVfrErrorHandle&); // Prevent copy-construction
+ CVfrErrorHandle& operator= (IN CONST CVfrErrorHandle&); // Prevent assignment
+};
+
+#define CHECK_ERROR_RETURN(f, v) do { EFI_VFR_RETURN_CODE r; if ((r = (f)) != (v)) { return r; } } while (0)
+
+extern CVfrErrorHandle gCVfrErrorHandle;
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
new file mode 100644
index 000000000..36d3baaf1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
@@ -0,0 +1,2457 @@
+/** @file
+
+ The definition of CFormPkg's member function
+
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "stdio.h"
+#include "assert.h"
+#include "VfrFormPkg.h"
+
+/*
+ * The definition of CFormPkg's member function
+ */
+
+SPendingAssign::SPendingAssign (
+ IN CHAR8 *Key,
+ IN VOID *Addr,
+ IN UINT32 Len,
+ IN UINT32 LineNo,
+ IN CONST CHAR8 *Msg
+ )
+{
+ mKey = NULL;
+ mAddr = Addr;
+ mLen = Len;
+ mFlag = PENDING;
+ mLineNo = LineNo;
+ mMsg = NULL;
+ mNext = NULL;
+ if (Key != NULL) {
+ mKey = new CHAR8[strlen (Key) + 1];
+ if (mKey != NULL) {
+ strcpy (mKey, Key);
+ }
+ }
+
+ if (Msg != NULL) {
+ mMsg = new CHAR8[strlen (Msg) + 1];
+ if (mMsg != NULL) {
+ strcpy (mMsg, Msg);
+ }
+ }
+}
+
+SPendingAssign::~SPendingAssign (
+ VOID
+ )
+{
+ if (mKey != NULL) {
+ delete[] mKey;
+ }
+ mAddr = NULL;
+ mLen = 0;
+ mLineNo = 0;
+ if (mMsg != NULL) {
+ delete[] mMsg;
+ }
+ mNext = NULL;
+}
+
+VOID
+SPendingAssign::SetAddrAndLen (
+ IN VOID *Addr,
+ IN UINT32 LineNo
+ )
+{
+ mAddr = Addr;
+ mLineNo = LineNo;
+}
+
+VOID
+SPendingAssign::AssignValue (
+ IN VOID *Addr,
+ IN UINT32 Len
+ )
+{
+ memmove (mAddr, Addr, (mLen < Len ? mLen : Len));
+ mFlag = ASSIGNED;
+}
+
+CHAR8 *
+SPendingAssign::GetKey (
+ VOID
+ )
+{
+ return mKey;
+}
+
+CFormPkg::CFormPkg (
+ IN UINT32 BufferSize
+ )
+{
+ CHAR8 *BufferStart;
+ CHAR8 *BufferEnd;
+ SBufferNode *Node;
+
+ mPkgLength = 0;
+ mBufferSize = 0;
+ mBufferNodeQueueHead = NULL;
+ mBufferNodeQueueTail = NULL;
+ mCurrBufferNode = NULL;
+ mReadBufferNode = NULL;
+ mReadBufferOffset = 0;
+ PendingAssignList = NULL;
+
+ Node = new SBufferNode;
+ if (Node == NULL) {
+ return ;
+ }
+ BufferStart = new CHAR8[BufferSize];
+ if (BufferStart == NULL) {
+ delete Node;
+ return;
+ }
+ BufferEnd = BufferStart + BufferSize;
+
+ memset (BufferStart, 0, BufferSize);
+ Node->mBufferStart = BufferStart;
+ Node->mBufferEnd = BufferEnd;
+ Node->mBufferFree = BufferStart;
+ Node->mNext = NULL;
+
+ mBufferSize = BufferSize;
+ mBufferNodeQueueHead = Node;
+ mBufferNodeQueueTail = Node;
+ mCurrBufferNode = Node;
+}
+
+CFormPkg::~CFormPkg ()
+{
+ SBufferNode *pBNode;
+ SPendingAssign *pPNode;
+
+ while (mBufferNodeQueueHead != NULL) {
+ pBNode = mBufferNodeQueueHead;
+ mBufferNodeQueueHead = mBufferNodeQueueHead->mNext;
+ if (pBNode->mBufferStart != NULL) {
+ delete[] pBNode->mBufferStart;
+ delete pBNode;
+ }
+ }
+ mBufferNodeQueueTail = NULL;
+ mCurrBufferNode = NULL;
+
+ while (PendingAssignList != NULL) {
+ pPNode = PendingAssignList;
+ PendingAssignList = PendingAssignList->mNext;
+ delete pPNode;
+ }
+ PendingAssignList = NULL;
+}
+
+SBufferNode *
+CFormPkg::CreateNewNode (
+ VOID
+ )
+{
+ SBufferNode *Node;
+
+ Node = new SBufferNode;
+ if (Node == NULL) {
+ return NULL;
+ }
+
+ Node->mBufferStart = new CHAR8[mBufferSize];
+ if (Node->mBufferStart == NULL) {
+ delete Node;
+ return NULL;
+ } else {
+ memset (Node->mBufferStart, 0, mBufferSize);
+ Node->mBufferEnd = Node->mBufferStart + mBufferSize;
+ Node->mBufferFree = Node->mBufferStart;
+ Node->mNext = NULL;
+ }
+
+ return Node;
+}
+
+CHAR8 *
+CFormPkg::IfrBinBufferGet (
+ IN UINT32 Len
+ )
+{
+ CHAR8 *BinBuffer = NULL;
+ SBufferNode *Node = NULL;
+
+ if ((Len == 0) || (Len > mBufferSize)) {
+ return NULL;
+ }
+
+ if ((mCurrBufferNode->mBufferFree + Len) <= mCurrBufferNode->mBufferEnd) {
+ BinBuffer = mCurrBufferNode->mBufferFree;
+ mCurrBufferNode->mBufferFree += Len;
+ } else {
+ Node = CreateNewNode ();
+ if (Node == NULL) {
+ return NULL;
+ }
+
+ if (mBufferNodeQueueTail == NULL) {
+ mBufferNodeQueueHead = mBufferNodeQueueTail = Node;
+ } else {
+ mBufferNodeQueueTail->mNext = Node;
+ mBufferNodeQueueTail = Node;
+ }
+ mCurrBufferNode = Node;
+
+ //
+ // Now try again.
+ //
+ BinBuffer = mCurrBufferNode->mBufferFree;
+ mCurrBufferNode->mBufferFree += Len;
+ }
+
+ mPkgLength += Len;
+
+ return BinBuffer;
+}
+
+inline
+UINT32
+CFormPkg::GetPkgLength (
+ VOID
+ )
+{
+ return mPkgLength;
+}
+
+VOID
+CFormPkg::Open (
+ VOID
+ )
+{
+ mReadBufferNode = mBufferNodeQueueHead;
+ mReadBufferOffset = 0;
+}
+
+VOID
+CFormPkg::Close (
+ VOID
+ )
+{
+ mReadBufferNode = NULL;
+ mReadBufferOffset = 0;
+}
+
+UINT32
+CFormPkg::Read (
+ IN CHAR8 *Buffer,
+ IN UINT32 Size
+ )
+{
+ UINT32 Index;
+
+ if ((Size == 0) || (Buffer == NULL)) {
+ return 0;
+ }
+
+ if (mReadBufferNode == NULL) {
+ return 0;
+ }
+
+ for (Index = 0; Index < Size; Index++) {
+ if ((mReadBufferNode->mBufferStart + mReadBufferOffset) < mReadBufferNode->mBufferFree) {
+ Buffer[Index] = mReadBufferNode->mBufferStart[mReadBufferOffset++];
+ } else {
+ if ((mReadBufferNode = mReadBufferNode->mNext) == NULL) {
+ return Index;
+ } else {
+ mReadBufferOffset = 0;
+ Index --;
+ }
+ }
+ }
+
+ return Size;
+}
+
+EFI_VFR_RETURN_CODE
+CFormPkg::BuildPkgHdr (
+ OUT EFI_HII_PACKAGE_HEADER **PkgHdr
+ )
+{
+ if (PkgHdr == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ if (((*PkgHdr) = new EFI_HII_PACKAGE_HEADER) == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+
+ (*PkgHdr)->Type = EFI_HII_PACKAGE_FORM;
+ (*PkgHdr)->Length = mPkgLength + sizeof (EFI_HII_PACKAGE_HEADER);
+
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CFormPkg::BuildPkg (
+ OUT PACKAGE_DATA &TBuffer
+ )
+{
+
+ CHAR8 *Temp;
+ UINT32 Size;
+ CHAR8 Buffer[1024];
+
+ if (TBuffer.Buffer != NULL) {
+ delete TBuffer.Buffer;
+ }
+
+ TBuffer.Size = mPkgLength;
+ TBuffer.Buffer = NULL;
+ if (TBuffer.Size != 0) {
+ TBuffer.Buffer = new CHAR8[TBuffer.Size];
+ } else {
+ return VFR_RETURN_SUCCESS;
+ }
+
+ Temp = TBuffer.Buffer;
+ Open ();
+ while ((Size = Read (Buffer, 1024)) != 0) {
+ memcpy (Temp, Buffer, Size);
+ Temp += Size;
+ }
+ Close ();
+ return VFR_RETURN_SUCCESS;
+}
+
+
+EFI_VFR_RETURN_CODE
+CFormPkg::BuildPkg (
+ IN FILE *Output,
+ IN PACKAGE_DATA *PkgData
+ )
+{
+ EFI_VFR_RETURN_CODE Ret;
+ CHAR8 Buffer[1024];
+ UINT32 Size;
+ EFI_HII_PACKAGE_HEADER *PkgHdr;
+
+ if (Output == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ if ((Ret = BuildPkgHdr(&PkgHdr)) != VFR_RETURN_SUCCESS) {
+ return Ret;
+ }
+ fwrite (PkgHdr, sizeof (EFI_HII_PACKAGE_HEADER), 1, Output);
+ delete PkgHdr;
+
+ if (PkgData == NULL) {
+ Open ();
+ while ((Size = Read (Buffer, 1024)) != 0) {
+ fwrite (Buffer, Size, 1, Output);
+ }
+ Close ();
+ } else {
+ fwrite (PkgData->Buffer, PkgData->Size, 1, Output);
+ }
+
+ return VFR_RETURN_SUCCESS;
+}
+
+VOID
+CFormPkg::_WRITE_PKG_LINE (
+ IN FILE *pFile,
+ IN UINT32 LineBytes,
+ IN CONST CHAR8 *LineHeader,
+ IN CHAR8 *BlkBuf,
+ IN UINT32 BlkSize
+ )
+{
+ UINT32 Index;
+
+ if ((pFile == NULL) || (LineHeader == NULL) || (BlkBuf == NULL)) {
+ return;
+ }
+
+ for (Index = 0; Index < BlkSize; Index++) {
+ if ((Index % LineBytes) == 0) {
+ fprintf (pFile, "\n%s", LineHeader);
+ }
+ fprintf (pFile, "0x%02X, ", (UINT8)BlkBuf[Index]);
+ }
+}
+
+VOID
+CFormPkg::_WRITE_PKG_END (
+ IN FILE *pFile,
+ IN UINT32 LineBytes,
+ IN CONST CHAR8 *LineHeader,
+ IN CHAR8 *BlkBuf,
+ IN UINT32 BlkSize
+ )
+{
+ UINT32 Index;
+
+ if ((BlkSize == 0) || (pFile == NULL) || (LineHeader == NULL) || (BlkBuf == NULL)) {
+ return;
+ }
+
+ for (Index = 0; Index < BlkSize - 1; Index++) {
+ if ((Index % LineBytes) == 0) {
+ fprintf (pFile, "\n%s", LineHeader);
+ }
+ fprintf (pFile, "0x%02X, ", (UINT8)BlkBuf[Index]);
+ }
+
+ if ((Index % LineBytes) == 0) {
+ fprintf (pFile, "\n%s", LineHeader);
+ }
+ fprintf (pFile, "0x%02X\n", (UINT8)BlkBuf[Index]);
+}
+
+#define BYTES_PRE_LINE 0x10
+UINT32 gAdjustOpcodeOffset = 0;
+BOOLEAN gNeedAdjustOpcode = FALSE;
+UINT32 gAdjustOpcodeLen = 0;
+
+EFI_VFR_RETURN_CODE
+CFormPkg::GenCFile (
+ IN CHAR8 *BaseName,
+ IN FILE *pFile,
+ IN PACKAGE_DATA *PkgData
+ )
+{
+ EFI_VFR_RETURN_CODE Ret;
+ CHAR8 Buffer[BYTES_PRE_LINE * 8];
+ EFI_HII_PACKAGE_HEADER *PkgHdr;
+ UINT32 PkgLength = 0;
+ UINT32 ReadSize = 0;
+
+ if ((BaseName == NULL) || (pFile == NULL)) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ fprintf (pFile, "\nunsigned char %sBin[] = {\n", BaseName);
+
+ if ((Ret = BuildPkgHdr(&PkgHdr)) != VFR_RETURN_SUCCESS) {
+ return Ret;
+ }
+
+
+ fprintf (pFile, " // ARRAY LENGTH\n");
+ PkgLength = PkgHdr->Length + sizeof (UINT32);
+ _WRITE_PKG_LINE(pFile, BYTES_PRE_LINE, " ", (CHAR8 *)&PkgLength, sizeof (UINT32));
+
+ fprintf (pFile, "\n\n // PACKAGE HEADER\n");
+ _WRITE_PKG_LINE(pFile, BYTES_PRE_LINE, " ", (CHAR8 *)PkgHdr, sizeof (EFI_HII_PACKAGE_HEADER));
+ PkgLength = sizeof (EFI_HII_PACKAGE_HEADER);
+
+ fprintf (pFile, "\n\n // PACKAGE DATA\n");
+
+ if (PkgData == NULL) {
+ Open ();
+ while ((ReadSize = Read ((CHAR8 *)Buffer, BYTES_PRE_LINE * 8)) != 0) {
+ PkgLength += ReadSize;
+ if (PkgLength < PkgHdr->Length) {
+ _WRITE_PKG_LINE (pFile, BYTES_PRE_LINE, " ", Buffer, ReadSize);
+ } else {
+ _WRITE_PKG_END (pFile, BYTES_PRE_LINE, " ", Buffer, ReadSize);
+ }
+ }
+ Close ();
+ } else {
+ if (PkgData->Size % BYTES_PRE_LINE != 0) {
+ PkgLength = PkgData->Size - (PkgData->Size % BYTES_PRE_LINE);
+ _WRITE_PKG_LINE (pFile, BYTES_PRE_LINE, " ", PkgData->Buffer, PkgLength);
+ _WRITE_PKG_END (pFile, BYTES_PRE_LINE, " ", PkgData->Buffer + PkgLength, PkgData->Size % BYTES_PRE_LINE);
+ } else {
+ PkgLength = PkgData->Size - BYTES_PRE_LINE;
+ _WRITE_PKG_LINE (pFile, BYTES_PRE_LINE, " ", PkgData->Buffer, PkgLength);
+ _WRITE_PKG_END (pFile, BYTES_PRE_LINE, " ", PkgData->Buffer + PkgLength, BYTES_PRE_LINE);
+ }
+ }
+
+ delete PkgHdr;
+ fprintf (pFile, "\n};\n");
+
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CFormPkg::AssignPending (
+ IN CHAR8 *Key,
+ IN VOID *ValAddr,
+ IN UINT32 ValLen,
+ IN UINT32 LineNo,
+ IN CONST CHAR8 *Msg
+ )
+{
+ SPendingAssign *pNew;
+
+ pNew = new SPendingAssign (Key, ValAddr, ValLen, LineNo, Msg);
+ if (pNew == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+
+ pNew->mNext = PendingAssignList;
+ PendingAssignList = pNew;
+ return VFR_RETURN_SUCCESS;
+}
+
+VOID
+CFormPkg::DoPendingAssign (
+ IN CHAR8 *Key,
+ IN VOID *ValAddr,
+ IN UINT32 ValLen
+ )
+{
+ SPendingAssign *pNode;
+
+ if ((Key == NULL) || (ValAddr == NULL)) {
+ return;
+ }
+
+ for (pNode = PendingAssignList; pNode != NULL; pNode = pNode->mNext) {
+ if (strcmp (pNode->mKey, Key) == 0) {
+ pNode->AssignValue (ValAddr, ValLen);
+ }
+ }
+}
+
+bool
+CFormPkg::HavePendingUnassigned (
+ VOID
+ )
+{
+ SPendingAssign *pNode;
+
+ for (pNode = PendingAssignList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mFlag == PENDING) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+VOID
+CFormPkg::PendingAssignPrintAll (
+ VOID
+ )
+{
+ SPendingAssign *pNode;
+
+ for (pNode = PendingAssignList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mFlag == PENDING) {
+ gCVfrErrorHandle.PrintMsg (pNode->mLineNo, pNode->mKey, "Error", pNode->mMsg);
+ }
+ }
+}
+
+SBufferNode *
+CFormPkg::GetBinBufferNodeForAddr (
+ IN CHAR8 *BinBuffAddr
+ )
+{
+ SBufferNode *TmpNode;
+
+ TmpNode = mBufferNodeQueueHead;
+
+ while (TmpNode != NULL) {
+ if (TmpNode->mBufferStart <= BinBuffAddr && TmpNode->mBufferFree >= BinBuffAddr) {
+ return TmpNode;
+ }
+
+ TmpNode = TmpNode->mNext;
+ }
+
+ return NULL;
+}
+
+SBufferNode *
+CFormPkg::GetNodeBefore(
+ IN SBufferNode *CurrentNode
+ )
+{
+ SBufferNode *FirstNode = mBufferNodeQueueHead;
+ SBufferNode *LastNode = mBufferNodeQueueHead;
+
+ while (FirstNode != NULL) {
+ if (FirstNode == CurrentNode) {
+ break;
+ }
+
+ LastNode = FirstNode;
+ FirstNode = FirstNode->mNext;
+ }
+
+ if (FirstNode == NULL) {
+ LastNode = NULL;
+ }
+
+ return LastNode;
+}
+
+EFI_VFR_RETURN_CODE
+CFormPkg::InsertNodeBefore(
+ IN SBufferNode *CurrentNode,
+ IN SBufferNode *NewNode
+ )
+{
+ SBufferNode *LastNode = GetNodeBefore (CurrentNode);
+
+ if (LastNode == NULL) {
+ return VFR_RETURN_MISMATCHED;
+ }
+
+ NewNode->mNext = LastNode->mNext;
+ LastNode->mNext = NewNode;
+
+ return VFR_RETURN_SUCCESS;
+}
+
+CHAR8 *
+CFormPkg::GetBufAddrBaseOnOffset (
+ IN UINT32 Offset
+ )
+{
+ SBufferNode *TmpNode;
+ UINT32 TotalBufLen;
+ UINT32 CurrentBufLen;
+
+ TotalBufLen = 0;
+
+ for (TmpNode = mBufferNodeQueueHead; TmpNode != NULL; TmpNode = TmpNode->mNext) {
+ CurrentBufLen = TmpNode->mBufferFree - TmpNode->mBufferStart;
+ if (Offset >= TotalBufLen && Offset < TotalBufLen + CurrentBufLen) {
+ return TmpNode->mBufferStart + (Offset - TotalBufLen);
+ }
+
+ TotalBufLen += CurrentBufLen;
+ }
+
+ return NULL;
+}
+
+EFI_VFR_RETURN_CODE
+CFormPkg::AdjustDynamicInsertOpcode (
+ IN CHAR8 *InserPositionAddr,
+ IN CHAR8 *InsertOpcodeAddr,
+ IN BOOLEAN CreateOpcodeAfterParsingVfr
+ )
+{
+ SBufferNode *InserPositionNode;
+ SBufferNode *InsertOpcodeNode;
+ SBufferNode *NewRestoreNodeBegin;
+ SBufferNode *NewRestoreNodeEnd;
+ SBufferNode *NewLastEndNode;
+ SBufferNode *TmpNode;
+ UINT32 NeedRestoreCodeLen;
+
+ NewRestoreNodeEnd = NULL;
+
+ InserPositionNode = GetBinBufferNodeForAddr(InserPositionAddr);
+ InsertOpcodeNode = GetBinBufferNodeForAddr(InsertOpcodeAddr);
+ assert (InserPositionNode != NULL);
+ assert (InsertOpcodeNode != NULL);
+
+ if (InserPositionNode == InsertOpcodeNode) {
+ //
+ // Create New Node to save the restore opcode.
+ //
+ NeedRestoreCodeLen = InsertOpcodeAddr - InserPositionAddr;
+ gAdjustOpcodeLen = NeedRestoreCodeLen;
+ NewRestoreNodeBegin = CreateNewNode ();
+ if (NewRestoreNodeBegin == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+ memcpy (NewRestoreNodeBegin->mBufferFree, InserPositionAddr, NeedRestoreCodeLen);
+ NewRestoreNodeBegin->mBufferFree += NeedRestoreCodeLen;
+
+ //
+ // Override the restore buffer data.
+ //
+ memmove (InserPositionAddr, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr);
+ InsertOpcodeNode->mBufferFree -= NeedRestoreCodeLen;
+ memset (InsertOpcodeNode->mBufferFree, 0, NeedRestoreCodeLen);
+ } else {
+ //
+ // Create New Node to save the restore opcode.
+ //
+ NeedRestoreCodeLen = InserPositionNode->mBufferFree - InserPositionAddr;
+ gAdjustOpcodeLen = NeedRestoreCodeLen;
+ NewRestoreNodeBegin = CreateNewNode ();
+ if (NewRestoreNodeBegin == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+ memcpy (NewRestoreNodeBegin->mBufferFree, InserPositionAddr, NeedRestoreCodeLen);
+ NewRestoreNodeBegin->mBufferFree += NeedRestoreCodeLen;
+ //
+ // Override the restore buffer data.
+ //
+ InserPositionNode->mBufferFree -= NeedRestoreCodeLen;
+ //
+ // Link the restore data to new node.
+ //
+ NewRestoreNodeBegin->mNext = InserPositionNode->mNext;
+
+ //
+ // Count the Adjust opcode len.
+ //
+ TmpNode = InserPositionNode->mNext;
+ while (TmpNode != InsertOpcodeNode) {
+ gAdjustOpcodeLen += TmpNode->mBufferFree - TmpNode->mBufferStart;
+ TmpNode = TmpNode->mNext;
+ }
+
+ //
+ // Create New Node to save the last node of restore opcode.
+ //
+ NeedRestoreCodeLen = InsertOpcodeAddr - InsertOpcodeNode->mBufferStart;
+ gAdjustOpcodeLen += NeedRestoreCodeLen;
+ if (NeedRestoreCodeLen > 0) {
+ NewRestoreNodeEnd = CreateNewNode ();
+ if (NewRestoreNodeEnd == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+ memcpy (NewRestoreNodeEnd->mBufferFree, InsertOpcodeNode->mBufferStart, NeedRestoreCodeLen);
+ NewRestoreNodeEnd->mBufferFree += NeedRestoreCodeLen;
+ //
+ // Override the restore buffer data.
+ //
+ memmove (InsertOpcodeNode->mBufferStart, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr);
+ InsertOpcodeNode->mBufferFree -= InsertOpcodeAddr - InsertOpcodeNode->mBufferStart;
+
+ //
+ // Insert the last restore data node.
+ //
+ TmpNode = GetNodeBefore (InsertOpcodeNode);
+ assert (TmpNode != NULL);
+
+ if (TmpNode == InserPositionNode) {
+ NewRestoreNodeBegin->mNext = NewRestoreNodeEnd;
+ } else {
+ TmpNode->mNext = NewRestoreNodeEnd;
+ }
+ //
+ // Connect the dynamic opcode node to the node after InserPositionNode.
+ //
+ InserPositionNode->mNext = InsertOpcodeNode;
+ }
+ }
+
+ if (CreateOpcodeAfterParsingVfr) {
+ //
+ // Th new opcodes were created after Parsing Vfr file,
+ // so the content in mBufferNodeQueueTail must be the new created opcodes.
+ // So connet the NewRestoreNodeBegin to the tail and update the tail node.
+ //
+ mBufferNodeQueueTail->mNext = NewRestoreNodeBegin;
+ if (NewRestoreNodeEnd != NULL) {
+ mBufferNodeQueueTail = NewRestoreNodeEnd;
+ } else {
+ mBufferNodeQueueTail = NewRestoreNodeBegin;
+ }
+ } else {
+ if (mBufferNodeQueueTail->mBufferFree - mBufferNodeQueueTail->mBufferStart > 2) {
+ //
+ // End form set opcode all in the mBufferNodeQueueTail node.
+ //
+ NewLastEndNode = CreateNewNode ();
+ if (NewLastEndNode == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+ NewLastEndNode->mBufferStart[0] = 0x29;
+ NewLastEndNode->mBufferStart[1] = 0x02;
+ NewLastEndNode->mBufferFree += 2;
+
+ mBufferNodeQueueTail->mBufferFree -= 2;
+
+ mBufferNodeQueueTail->mNext = NewRestoreNodeBegin;
+ if (NewRestoreNodeEnd != NULL) {
+ NewRestoreNodeEnd->mNext = NewLastEndNode;
+ } else {
+ NewRestoreNodeBegin->mNext = NewLastEndNode;
+ }
+
+ mBufferNodeQueueTail = NewLastEndNode;
+ } else if (mBufferNodeQueueTail->mBufferFree - mBufferNodeQueueTail->mBufferStart == 2) {
+ TmpNode = GetNodeBefore(mBufferNodeQueueTail);
+ assert (TmpNode != NULL);
+
+ TmpNode->mNext = NewRestoreNodeBegin;
+ if (NewRestoreNodeEnd != NULL) {
+ NewRestoreNodeEnd->mNext = mBufferNodeQueueTail;
+ } else {
+ NewRestoreNodeBegin->mNext = mBufferNodeQueueTail;
+ }
+ }
+ }
+ mCurrBufferNode = mBufferNodeQueueTail;
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CFormPkg::DeclarePendingQuestion (
+ IN CVfrVarDataTypeDB &lCVfrVarDataTypeDB,
+ IN CVfrDataStorage &lCVfrDataStorage,
+ IN CVfrQuestionDB &lCVfrQuestionDB,
+ IN EFI_GUID *LocalFormSetGuid,
+ IN UINT32 LineNo,
+ OUT CHAR8 **InsertOpcodeAddr
+ )
+{
+ SPendingAssign *pNode;
+ CHAR8 *VarStr;
+ UINT32 ArrayIdx;
+ CHAR8 FName[MAX_NAME_LEN];
+ CHAR8 *SName;
+ CHAR8 *NewStr;
+ UINT32 ShrinkSize = 0;
+ EFI_VFR_RETURN_CODE ReturnCode;
+ EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
+ UINT8 LFlags;
+ UINT32 MaxValue;
+ CIfrGuid *GuidObj = NULL;
+
+ //
+ // Declare all questions as Numeric in DisableIf True
+ //
+ // DisableIf
+ CIfrDisableIf DIObj;
+ DIObj.SetLineNo (LineNo);
+ *InsertOpcodeAddr = DIObj.GetObjBinAddr<CHAR8>();
+
+ //TrueOpcode
+ CIfrTrue TObj (LineNo);
+
+ // Declare Numeric qeustion for each undefined question.
+ for (pNode = PendingAssignList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mFlag == PENDING) {
+ EFI_VARSTORE_INFO Info;
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
+ //
+ // Register this question, assume it is normal question, not date or time question
+ //
+ VarStr = pNode->mKey;
+ ReturnCode = lCVfrQuestionDB.RegisterQuestion (NULL, VarStr, QId);
+ if (ReturnCode != VFR_RETURN_SUCCESS) {
+ gCVfrErrorHandle.HandleError (ReturnCode, pNode->mLineNo, pNode->mKey);
+ return ReturnCode;
+ }
+
+#ifdef VFREXP_DEBUG
+ printf ("Undefined Question name is %s and Id is 0x%x\n", VarStr, QId);
+#endif
+ //
+ // Get Question Info, framework vfr VarName == StructName
+ //
+ ReturnCode = lCVfrVarDataTypeDB.ExtractFieldNameAndArrary (VarStr, FName, ArrayIdx);
+ if (ReturnCode != VFR_RETURN_SUCCESS) {
+ gCVfrErrorHandle.PrintMsg (pNode->mLineNo, pNode->mKey, "Error", "Var string is not the valid C variable");
+ return ReturnCode;
+ }
+ //
+ // Get VarStoreType
+ //
+ ReturnCode = lCVfrDataStorage.GetVarStoreId (FName, &Info.mVarStoreId);
+ if (ReturnCode != VFR_RETURN_SUCCESS) {
+ gCVfrErrorHandle.PrintMsg (pNode->mLineNo, FName, "Error", "Var Store Type is not defined");
+ return ReturnCode;
+ }
+ VarStoreType = lCVfrDataStorage.GetVarStoreType (Info.mVarStoreId);
+
+ if (*VarStr == '\0' && ArrayIdx != INVALID_ARRAY_INDEX) {
+ ReturnCode = lCVfrDataStorage.GetNameVarStoreInfo (&Info, ArrayIdx);
+ } else {
+ if (VarStoreType == EFI_VFR_VARSTORE_EFI) {
+ ReturnCode = lCVfrDataStorage.GetEfiVarStoreInfo (&Info);
+ } else if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_BUFFER_BITS) {
+ VarStr = pNode->mKey;
+ //convert VarStr with store name to VarStr with structure name
+ ReturnCode = lCVfrDataStorage.GetBufferVarStoreDataTypeName (Info.mVarStoreId, &SName);
+ if (ReturnCode == VFR_RETURN_SUCCESS) {
+ NewStr = new CHAR8[strlen (VarStr) + strlen (SName) + 1];
+ NewStr[0] = '\0';
+ strcpy (NewStr, SName);
+ strcat (NewStr, VarStr + strlen (FName));
+ ReturnCode = lCVfrVarDataTypeDB.GetDataFieldInfo (NewStr, Info.mInfo.mVarOffset, Info.mVarType, Info.mVarTotalSize, Info.mIsBitVar);
+ delete[] NewStr;
+ }
+ } else {
+ ReturnCode = VFR_RETURN_UNSUPPORTED;
+ }
+ }
+ if (ReturnCode != VFR_RETURN_SUCCESS) {
+ gCVfrErrorHandle.HandleError (ReturnCode, pNode->mLineNo, pNode->mKey);
+ return ReturnCode;
+ }
+ //
+ // If the storage is bit fields, create Guid opcode to wrap the numeric opcode.
+ //
+ if (Info.mIsBitVar) {
+ GuidObj = new CIfrGuid(0);
+ GuidObj->SetGuid (&gEdkiiIfrBitVarGuid);
+ GuidObj->SetLineNo(LineNo);
+ }
+
+ CIfrNumeric CNObj;
+ CNObj.SetLineNo (LineNo);
+ CNObj.SetPrompt (0x0);
+ CNObj.SetHelp (0x0);
+ CNObj.SetQuestionId (QId);
+ CNObj.SetVarStoreInfo (&Info);
+
+ //
+ // Set Min/Max/Step Data and flags for the question with bit fields.Min/Max/Step Data are saved as UINT32 type for bit question.
+ //
+ if (Info.mIsBitVar) {
+ MaxValue = (1 << Info.mVarTotalSize) -1;
+ CNObj.SetMinMaxStepData ((UINT32) 0, MaxValue, (UINT32) 0);
+ ShrinkSize = 12;
+ LFlags = (EDKII_IFR_NUMERIC_SIZE_BIT & Info.mVarTotalSize);
+ CNObj.SetFlagsForBitField (0, LFlags);
+ } else {
+ //
+ // Numeric doesn't support BOOLEAN data type.
+ // BOOLEAN type has the same data size to UINT8.
+ //
+ if (Info.mVarType == EFI_IFR_TYPE_BOOLEAN) {
+ Info.mVarType = EFI_IFR_TYPE_NUM_SIZE_8;
+ }
+ CNObj.SetFlags (0, Info.mVarType);
+ //
+ // Use maximum value not to limit the valid value for the undefined question.
+ //
+ switch (Info.mVarType) {
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ CNObj.SetMinMaxStepData ((UINT64) 0, (UINT64) -1 , (UINT64) 0);
+ ShrinkSize = 0;
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ CNObj.SetMinMaxStepData ((UINT32) 0, (UINT32) -1 , (UINT32) 0);
+ ShrinkSize = 12;
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ CNObj.SetMinMaxStepData ((UINT16) 0, (UINT16) -1 , (UINT16) 0);
+ ShrinkSize = 18;
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ CNObj.SetMinMaxStepData ((UINT8) 0, (UINT8) -1 , (UINT8) 0);
+ ShrinkSize = 21;
+ break;
+ default:
+ break;
+ }
+ }
+ CNObj.ShrinkBinSize (ShrinkSize);
+
+ //
+ // For undefined Efi VarStore type question
+ // Append the extended guided opcode to contain VarName
+ //
+ if (VarStoreType == EFI_VFR_VARSTORE_EFI) {
+ CIfrVarEqName CVNObj (QId, Info.mInfo.mVarName);
+ CVNObj.SetLineNo (LineNo);
+ }
+
+ //
+ // End for Numeric
+ //
+ CIfrEnd CEObj;
+ CEObj.SetLineNo (LineNo);
+ //
+ // End for Guided opcode
+ //
+ if (GuidObj != NULL) {
+ CIfrEnd CEObjGuid;
+ CEObjGuid.SetLineNo (LineNo);
+ GuidObj->SetScope(1);
+ delete GuidObj;
+ GuidObj = NULL;
+ }
+ }
+ }
+
+ //
+ // End for DisableIf
+ //
+ CIfrEnd SEObj;
+ SEObj.SetLineNo (LineNo);
+
+ return VFR_RETURN_SUCCESS;
+}
+
+CFormPkg gCFormPkg;
+
+SIfrRecord::SIfrRecord (
+ VOID
+ )
+{
+ mIfrBinBuf = NULL;
+ mBinBufLen = 0;
+ mLineNo = 0xFFFFFFFF;
+ mOffset = 0xFFFFFFFF;
+ mNext = NULL;
+}
+
+SIfrRecord::~SIfrRecord (
+ VOID
+ )
+{
+ if (mIfrBinBuf != NULL) {
+ //delete mIfrBinBuf;
+ mIfrBinBuf = NULL;
+ }
+ mLineNo = 0xFFFFFFFF;
+ mOffset = 0xFFFFFFFF;
+ mBinBufLen = 0;
+ mNext = NULL;
+}
+
+CIfrRecordInfoDB::CIfrRecordInfoDB (
+ VOID
+ )
+{
+ mSwitch = TRUE;
+ mRecordCount = EFI_IFR_RECORDINFO_IDX_START;
+ mIfrRecordListHead = NULL;
+ mIfrRecordListTail = NULL;
+ mAllDefaultTypeCount = 0;
+ for (UINT8 i = 0; i < EFI_HII_MAX_SUPPORT_DEFAULT_TYPE; i++) {
+ mAllDefaultIdArray[i] = 0xffff;
+ }
+}
+
+CIfrRecordInfoDB::~CIfrRecordInfoDB (
+ VOID
+ )
+{
+ SIfrRecord *pNode;
+
+ while (mIfrRecordListHead != NULL) {
+ pNode = mIfrRecordListHead;
+ mIfrRecordListHead = mIfrRecordListHead->mNext;
+ delete pNode;
+ }
+}
+
+SIfrRecord *
+CIfrRecordInfoDB::GetRecordInfoFromIdx (
+ IN UINT32 RecordIdx
+ )
+{
+ UINT32 Idx;
+ SIfrRecord *pNode = NULL;
+
+ if (RecordIdx == EFI_IFR_RECORDINFO_IDX_INVALUD) {
+ return NULL;
+ }
+
+ for (Idx = (EFI_IFR_RECORDINFO_IDX_START + 1), pNode = mIfrRecordListHead;
+ (Idx != RecordIdx) && (pNode != NULL);
+ Idx++, pNode = pNode->mNext)
+ ;
+
+ return pNode;
+}
+
+UINT32
+CIfrRecordInfoDB::IfrRecordRegister (
+ IN UINT32 LineNo,
+ IN CHAR8 *IfrBinBuf,
+ IN UINT8 BinBufLen,
+ IN UINT32 Offset
+ )
+{
+ SIfrRecord *pNew;
+
+ if (mSwitch == FALSE) {
+ return EFI_IFR_RECORDINFO_IDX_INVALUD;
+ }
+
+ if ((pNew = new SIfrRecord) == NULL) {
+ return EFI_IFR_RECORDINFO_IDX_INVALUD;
+ }
+
+ if (mIfrRecordListHead == NULL) {
+ mIfrRecordListHead = pNew;
+ mIfrRecordListTail = pNew;
+ } else {
+ mIfrRecordListTail->mNext = pNew;
+ mIfrRecordListTail = pNew;
+ }
+ mRecordCount++;
+
+ return mRecordCount;
+}
+
+VOID
+CIfrRecordInfoDB::IfrRecordInfoUpdate (
+ IN UINT32 RecordIdx,
+ IN UINT32 LineNo,
+ IN CHAR8 *BinBuf,
+ IN UINT8 BinBufLen,
+ IN UINT32 Offset
+ )
+{
+ SIfrRecord *pNode;
+ SIfrRecord *Prev;
+
+ if ((pNode = GetRecordInfoFromIdx (RecordIdx)) == NULL) {
+ return;
+ }
+
+ if (LineNo == 0) {
+ //
+ // Line number is not specified explicitly, try to use line number of previous opcode
+ //
+ Prev = GetRecordInfoFromIdx (RecordIdx - 1);
+ if (Prev != NULL) {
+ LineNo = Prev->mLineNo;
+ }
+ }
+
+ pNode->mLineNo = LineNo;
+ pNode->mOffset = Offset;
+ pNode->mBinBufLen = BinBufLen;
+ pNode->mIfrBinBuf = BinBuf;
+
+}
+
+VOID
+CIfrRecordInfoDB::IfrRecordOutput (
+ OUT PACKAGE_DATA &TBuffer
+ )
+{
+ CHAR8 *Temp;
+ SIfrRecord *pNode;
+
+ if (TBuffer.Buffer != NULL) {
+ delete[] TBuffer.Buffer;
+ }
+
+ TBuffer.Size = 0;
+ TBuffer.Buffer = NULL;
+
+
+ if (mSwitch == FALSE) {
+ return;
+ }
+
+ for (pNode = mIfrRecordListHead; pNode != NULL; pNode = pNode->mNext) {
+ TBuffer.Size += pNode->mBinBufLen;
+ }
+
+ if (TBuffer.Size != 0) {
+ TBuffer.Buffer = new CHAR8[TBuffer.Size];
+ } else {
+ return;
+ }
+
+ Temp = TBuffer.Buffer;
+
+ for (pNode = mIfrRecordListHead; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mIfrBinBuf != NULL) {
+ memcpy (Temp, pNode->mIfrBinBuf, pNode->mBinBufLen);
+ Temp += pNode->mBinBufLen;
+ }
+ }
+
+ return;
+}
+
+VOID
+CIfrRecordInfoDB::IfrRecordOutput (
+ IN FILE *File,
+ IN UINT32 LineNo
+ )
+{
+ SIfrRecord *pNode;
+ UINT8 Index;
+ UINT32 TotalSize;
+
+ if (mSwitch == FALSE) {
+ return;
+ }
+
+ if (File == NULL) {
+ return;
+ }
+
+ TotalSize = 0;
+
+ for (pNode = mIfrRecordListHead; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mLineNo == LineNo || LineNo == 0) {
+ fprintf (File, ">%08X: ", pNode->mOffset);
+ TotalSize += pNode->mBinBufLen;
+ if (pNode->mIfrBinBuf != NULL) {
+ for (Index = 0; Index < pNode->mBinBufLen; Index++) {
+ fprintf (File, "%02X ", (UINT8)(pNode->mIfrBinBuf[Index]));
+ }
+ }
+ fprintf (File, "\n");
+ }
+ }
+
+ if (LineNo == 0) {
+ fprintf (File, "\nTotal Size of all record is 0x%08X\n", TotalSize);
+ }
+}
+
+//
+// for framework vfr file
+// adjust opcode sequence for uefi IFR format
+// adjust inconsistent and varstore into the right position.
+//
+BOOLEAN
+CIfrRecordInfoDB::CheckQuestionOpCode (
+ IN UINT8 OpCode
+ )
+{
+ switch (OpCode) {
+ case EFI_IFR_CHECKBOX_OP:
+ case EFI_IFR_NUMERIC_OP:
+ case EFI_IFR_PASSWORD_OP:
+ case EFI_IFR_ONE_OF_OP:
+ case EFI_IFR_ACTION_OP:
+ case EFI_IFR_STRING_OP:
+ case EFI_IFR_DATE_OP:
+ case EFI_IFR_TIME_OP:
+ case EFI_IFR_ORDERED_LIST_OP:
+ case EFI_IFR_REF_OP:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+BOOLEAN
+CIfrRecordInfoDB::CheckIdOpCode (
+ IN UINT8 OpCode
+ )
+{
+ switch (OpCode) {
+ case EFI_IFR_EQ_ID_VAL_OP:
+ case EFI_IFR_EQ_ID_ID_OP:
+ case EFI_IFR_EQ_ID_VAL_LIST_OP:
+ case EFI_IFR_QUESTION_REF1_OP:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+EFI_QUESTION_ID
+CIfrRecordInfoDB::GetOpcodeQuestionId (
+ IN EFI_IFR_OP_HEADER *OpHead
+ )
+{
+ EFI_IFR_QUESTION_HEADER *QuestionHead;
+
+ QuestionHead = (EFI_IFR_QUESTION_HEADER *) (OpHead + 1);
+
+ return QuestionHead->QuestionId;
+}
+
+SIfrRecord *
+CIfrRecordInfoDB::GetRecordInfoFromOffset (
+ IN UINT32 Offset
+ )
+{
+ SIfrRecord *pNode = NULL;
+
+ for (pNode = mIfrRecordListHead; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mOffset == Offset) {
+ return pNode;
+ }
+ }
+
+ return pNode;
+}
+
+/**
+ Add just the op code position.
+
+ Case1 (CreateOpcodeAfterParsingVfr == FALSE): The dynamic opcodes were created before the formset opcode,
+ so pDynamicOpcodeNodes is before mIfrRecordListTail.
+
+ From
+
+ |mIfrRecordListHead + ...+ pAdjustNode + pDynamicOpcodeNodes + mIfrRecordListTail|
+
+ To
+
+ |mIfrRecordListHead + ...+ pDynamicOpcodeNodes + pAdjustNode + mIfrRecordListTail|
+
+ Case2 (CreateOpcodeAfterParsingVfr == TRUE): The dynamic opcodes were created after paring the vfr file,
+ so new records are appennded to the end of OriginalIfrRecordListTail.
+
+ From
+
+ |mIfrRecordListHead + ...+ pAdjustNode + ... + OriginalIfrRecordListTail + pDynamicOpcodeNodes|
+
+ To
+
+ |mIfrRecordListHead + ...+ pDynamicOpcodeNodes + pAdjustNode + ... + OriginalIfrRecordListTail|
+
+
+ @param CreateOpcodeAfterParsingVfr Whether create the dynamic opcode after parsing the VFR file.
+
+**/
+BOOLEAN
+CIfrRecordInfoDB::IfrAdjustDynamicOpcodeInRecords (
+ IN BOOLEAN CreateOpcodeAfterParsingVfr
+ )
+{
+ UINT32 OpcodeOffset;
+ SIfrRecord *pNode, *pPreNode;
+ SIfrRecord *pAdjustNode, *pNodeBeforeAdjust;
+ SIfrRecord *pNodeBeforeDynamic;
+
+ pPreNode = NULL;
+ pAdjustNode = NULL;
+ pNodeBeforeDynamic = NULL;
+ OpcodeOffset = 0;
+
+ //
+ // Base on the gAdjustOpcodeOffset and gAdjustOpcodeLen to find the pAdjustNod, the node before pAdjustNode,
+ // and the node before pDynamicOpcodeNode.
+ //
+ for (pNode = mIfrRecordListHead; pNode!= NULL; pNode = pNode->mNext) {
+ if (OpcodeOffset == gAdjustOpcodeOffset) {
+ pAdjustNode = pNode;
+ pNodeBeforeAdjust = pPreNode;
+ } else if (OpcodeOffset == gAdjustOpcodeOffset + gAdjustOpcodeLen) {
+ pNodeBeforeDynamic = pPreNode;
+ }
+ if (pNode->mNext != NULL) {
+ pPreNode = pNode;
+ }
+ OpcodeOffset += pNode->mBinBufLen;
+ }
+
+ //
+ // Check the nodes whether exist.
+ //
+ if (pNodeBeforeDynamic == NULL || pAdjustNode == NULL || pNodeBeforeAdjust == NULL) {
+ return FALSE;
+ }
+
+ //
+ // Adjust the node. pPreNode save the Node before mIfrRecordListTail
+ //
+ pNodeBeforeAdjust->mNext = pNodeBeforeDynamic->mNext;
+ if (CreateOpcodeAfterParsingVfr) {
+ //
+ // mIfrRecordListTail is the end of pDynamicNode (Case2).
+ //
+ mIfrRecordListTail->mNext = pAdjustNode;
+ mIfrRecordListTail = pNodeBeforeDynamic;
+ mIfrRecordListTail->mNext = NULL;
+ } else {
+ //
+ //pPreNode is the end of pDynamicNode(Case1).
+ //
+ pPreNode->mNext = pAdjustNode;
+ pNodeBeforeDynamic->mNext = mIfrRecordListTail;
+ }
+
+ return TRUE;
+}
+
+/**
+ Update the record info(the position in the record list, offset and mIfrBinBuf) for new created record.
+
+ @param CreateOpcodeAfterParsingVfr Whether create the dynamic opcode after parsing the VFR file.
+
+**/
+VOID
+CIfrRecordInfoDB::IfrUpdateRecordInfoForDynamicOpcode (
+ IN BOOLEAN CreateOpcodeAfterParsingVfr
+ )
+{
+ SIfrRecord *pRecord;
+
+ //
+ // Base on the original offset info to update the record list.
+ //
+ if (!IfrAdjustDynamicOpcodeInRecords(CreateOpcodeAfterParsingVfr)) {
+ gCVfrErrorHandle.PrintMsg (0, (CHAR8 *)"Error", (CHAR8 *)"Can not find the adjust offset in the record.");
+ }
+
+ //
+ // Base on the opcode binary length to recalculate the offset for each opcode.
+ //
+ IfrAdjustOffsetForRecord();
+
+ //
+ // Base on the offset to find the binary address.
+ //
+ pRecord = GetRecordInfoFromOffset(gAdjustOpcodeOffset);
+ while (pRecord != NULL) {
+ pRecord->mIfrBinBuf = gCFormPkg.GetBufAddrBaseOnOffset(pRecord->mOffset);
+ pRecord = pRecord->mNext;
+ }
+}
+
+
+VOID
+CIfrRecordInfoDB::IfrAdjustOffsetForRecord (
+ VOID
+ )
+{
+ UINT32 OpcodeOffset;
+ SIfrRecord *pNode;
+
+ OpcodeOffset = 0;
+ for (pNode = mIfrRecordListHead; pNode != NULL; pNode = pNode->mNext) {
+ pNode->mOffset = OpcodeOffset;
+ OpcodeOffset += pNode->mBinBufLen;
+ }
+}
+
+EFI_VFR_RETURN_CODE
+CIfrRecordInfoDB::IfrRecordAdjust (
+ VOID
+ )
+{
+ SIfrRecord *pNode, *preNode;
+ SIfrRecord *uNode, *tNode;
+ EFI_IFR_OP_HEADER *OpHead, *tOpHead;
+ EFI_QUESTION_ID QuestionId;
+ UINT32 StackCount;
+ UINT32 QuestionScope;
+ CHAR8 ErrorMsg[MAX_STRING_LEN] = {0, };
+ EFI_VFR_RETURN_CODE Status;
+
+ //
+ // Init local variable
+ //
+ Status = VFR_RETURN_SUCCESS;
+ pNode = mIfrRecordListHead;
+ preNode = pNode;
+ QuestionScope = 0;
+ while (pNode != NULL) {
+ OpHead = (EFI_IFR_OP_HEADER *) pNode->mIfrBinBuf;
+
+ //
+ // make sure the inconsistent opcode in question scope
+ //
+ if (QuestionScope > 0) {
+ QuestionScope += OpHead->Scope;
+ if (OpHead->OpCode == EFI_IFR_END_OP) {
+ QuestionScope --;
+ }
+ }
+
+ if (CheckQuestionOpCode (OpHead->OpCode)) {
+ QuestionScope = 1;
+ }
+ //
+ // for the inconsistent opcode not in question scope, adjust it
+ //
+ if (OpHead->OpCode == EFI_IFR_INCONSISTENT_IF_OP && QuestionScope == 0) {
+ //
+ // for inconsistent opcode not in question scope
+ //
+
+ //
+ // Count inconsistent opcode Scope
+ //
+ StackCount = OpHead->Scope;
+ QuestionId = EFI_QUESTION_ID_INVALID;
+ tNode = pNode;
+ while (tNode != NULL && StackCount > 0) {
+ tNode = tNode->mNext;
+ tOpHead = (EFI_IFR_OP_HEADER *) tNode->mIfrBinBuf;
+ //
+ // Calculate Scope Number
+ //
+ StackCount += tOpHead->Scope;
+ if (tOpHead->OpCode == EFI_IFR_END_OP) {
+ StackCount --;
+ }
+ //
+ // by IdEqual opcode to get QuestionId
+ //
+ if (QuestionId == EFI_QUESTION_ID_INVALID &&
+ CheckIdOpCode (tOpHead->OpCode)) {
+ QuestionId = *(EFI_QUESTION_ID *) (tOpHead + 1);
+ }
+ }
+ if (tNode == NULL || QuestionId == EFI_QUESTION_ID_INVALID) {
+ //
+ // report error; not found
+ //
+ sprintf (ErrorMsg, "Inconsistent OpCode Record list invalid QuestionId is 0x%X", QuestionId);
+ gCVfrErrorHandle.PrintMsg (0, NULL, "Error", ErrorMsg);
+ Status = VFR_RETURN_MISMATCHED;
+ break;
+ }
+ //
+ // extract inconsistent opcode list
+ // pNode is Inconsistent opcode, tNode is End Opcode
+ //
+
+ //
+ // insert inconsistent opcode list into the right question scope by questionid
+ //
+ for (uNode = mIfrRecordListHead; uNode != NULL; uNode = uNode->mNext) {
+ tOpHead = (EFI_IFR_OP_HEADER *) uNode->mIfrBinBuf;
+ if (CheckQuestionOpCode (tOpHead->OpCode) &&
+ (QuestionId == GetOpcodeQuestionId (tOpHead))) {
+ break;
+ }
+ }
+ //
+ // insert inconsistent opcode list and check LATE_CHECK flag
+ //
+ if (uNode != NULL) {
+ if ((((EFI_IFR_QUESTION_HEADER *)(tOpHead + 1))->Flags & 0x20) != 0) {
+ //
+ // if LATE_CHECK flag is set, change inconsistent to nosumbit
+ //
+ OpHead->OpCode = EFI_IFR_NO_SUBMIT_IF_OP;
+ }
+
+ //
+ // skip the default storage for Date and Time
+ //
+ if ((uNode->mNext != NULL) && (*uNode->mNext->mIfrBinBuf == EFI_IFR_DEFAULT_OP)) {
+ uNode = uNode->mNext;
+ }
+
+ preNode->mNext = tNode->mNext;
+ tNode->mNext = uNode->mNext;
+ uNode->mNext = pNode;
+ //
+ // reset pNode to head list, scan the whole list again.
+ //
+ pNode = mIfrRecordListHead;
+ preNode = pNode;
+ QuestionScope = 0;
+ continue;
+ } else {
+ //
+ // not found matched question id, report error
+ //
+ sprintf (ErrorMsg, "QuestionId required by Inconsistent OpCode is not found. QuestionId is 0x%X", QuestionId);
+ gCVfrErrorHandle.PrintMsg (0, NULL, "Error", ErrorMsg);
+ Status = VFR_RETURN_MISMATCHED;
+ break;
+ }
+ } else if (OpHead->OpCode == EFI_IFR_VARSTORE_OP ||
+ OpHead->OpCode == EFI_IFR_VARSTORE_EFI_OP) {
+ //
+ // for new added group of varstore opcode
+ //
+ tNode = pNode;
+ while (tNode->mNext != NULL) {
+ tOpHead = (EFI_IFR_OP_HEADER *) tNode->mNext->mIfrBinBuf;
+ if (tOpHead->OpCode != EFI_IFR_VARSTORE_OP &&
+ tOpHead->OpCode != EFI_IFR_VARSTORE_EFI_OP) {
+ break;
+ }
+ tNode = tNode->mNext;
+ }
+
+ if (tNode->mNext == NULL) {
+ //
+ // invalid IfrCode, IfrCode end by EndOpCode
+ //
+ gCVfrErrorHandle.PrintMsg (0, NULL, "Error", "No found End Opcode in the end");
+ Status = VFR_RETURN_MISMATCHED;
+ break;
+ }
+
+ if (tOpHead->OpCode != EFI_IFR_END_OP) {
+ //
+ // not new added varstore, which are not needed to be adjust.
+ //
+ preNode = tNode;
+ pNode = tNode->mNext;
+ continue;
+ } else {
+ //
+ // move new added varstore opcode to the position befor form opcode
+ // varstore opcode between pNode and tNode
+ //
+
+ //
+ // search form opcode from begin
+ //
+ for (uNode = mIfrRecordListHead; uNode->mNext != NULL; uNode = uNode->mNext) {
+ tOpHead = (EFI_IFR_OP_HEADER *) uNode->mNext->mIfrBinBuf;
+ if (tOpHead->OpCode == EFI_IFR_FORM_OP) {
+ break;
+ }
+ }
+ //
+ // Insert varstore opcode beform form opcode if form opcode is found
+ //
+ if (uNode->mNext != NULL) {
+ preNode->mNext = tNode->mNext;
+ tNode->mNext = uNode->mNext;
+ uNode->mNext = pNode;
+ //
+ // reset pNode to head list, scan the whole list again.
+ //
+ pNode = mIfrRecordListHead;
+ preNode = pNode;
+ QuestionScope = 0;
+ continue;
+ } else {
+ //
+ // not found form, continue scan IfrRecord list
+ //
+ preNode = tNode;
+ pNode = tNode->mNext;
+ continue;
+ }
+ }
+ }
+ //
+ // next node
+ //
+ preNode = pNode;
+ pNode = pNode->mNext;
+ }
+
+ //
+ // Update Ifr Opcode Offset
+ //
+ if (Status == VFR_RETURN_SUCCESS) {
+ IfrAdjustOffsetForRecord ();
+ }
+ return Status;
+}
+
+/**
+ When the Varstore of the question is EFI_VFR_VARSTORE_BUFFER and the default value is not
+ given by expression, should save the default info for the Buffer VarStore.
+
+ @param DefaultId The default id.
+ @param pQuestionNode Point to the question opcode node.
+ @param Value The default value.
+**/
+VOID
+CIfrRecordInfoDB::IfrAddDefaultToBufferConfig (
+ IN UINT16 DefaultId,
+ IN SIfrRecord *pQuestionNode,
+ IN EFI_IFR_TYPE_VALUE Value
+ )
+{
+ CHAR8 *VarStoreName = NULL;
+ EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
+ EFI_GUID *VarGuid = NULL;
+ EFI_VARSTORE_INFO VarInfo;
+ EFI_IFR_QUESTION_HEADER *QuestionHead;
+ EFI_IFR_OP_HEADER *pQuestionOpHead;
+
+ pQuestionOpHead = (EFI_IFR_OP_HEADER *) pQuestionNode->mIfrBinBuf;
+ QuestionHead = (EFI_IFR_QUESTION_HEADER *) (pQuestionOpHead + 1);
+
+ //
+ // Get the Var Store name and type.
+ //
+ gCVfrDataStorage.GetVarStoreName (QuestionHead->VarStoreId, &VarStoreName);
+ VarGuid= gCVfrDataStorage.GetVarStoreGuid (QuestionHead->VarStoreId);
+ VarStoreType = gCVfrDataStorage.GetVarStoreType (QuestionHead->VarStoreId);
+
+ //
+ // Only for Buffer storage need to save the default info in the storage.
+ // Other type storage, just return.
+ //
+ if (VarStoreType != EFI_VFR_VARSTORE_BUFFER) {
+ return;
+ } else {
+ VarInfo.mInfo.mVarOffset = QuestionHead->VarStoreInfo.VarOffset;
+ VarInfo.mVarStoreId = QuestionHead->VarStoreId;
+ }
+
+ //
+ // Get the buffer storage info about this question.
+ //
+ gCVfrDataStorage.GetBufferVarStoreFieldInfo (&VarInfo);
+
+ //
+ // Add action.
+ //
+ gCVfrDefaultStore.BufferVarStoreAltConfigAdd (
+ DefaultId,
+ VarInfo,
+ VarStoreName,
+ VarGuid,
+ VarInfo.mVarType,
+ Value
+ );
+}
+
+/**
+ Record the number and default id of all defaultstore opcode.
+
+**/
+VOID
+CIfrRecordInfoDB::IfrGetDefaultStoreInfo (
+ VOID
+ )
+{
+ SIfrRecord *pNode;
+ EFI_IFR_OP_HEADER *pOpHead;
+ EFI_IFR_DEFAULTSTORE *DefaultStore;
+
+ pNode = mIfrRecordListHead;
+ mAllDefaultTypeCount = 0;
+
+ while (pNode != NULL) {
+ pOpHead = (EFI_IFR_OP_HEADER *) pNode->mIfrBinBuf;
+
+ if (pOpHead->OpCode == EFI_IFR_DEFAULTSTORE_OP){
+ DefaultStore = (EFI_IFR_DEFAULTSTORE *) pNode->mIfrBinBuf;
+ mAllDefaultIdArray[mAllDefaultTypeCount++] = DefaultStore->DefaultId;
+ }
+ pNode = pNode->mNext;
+ }
+}
+
+/**
+ Create new default opcode record.
+
+ @param Size The new default opcode size.
+ @param DefaultId The new default id.
+ @param Type The new default type.
+ @param LineNo The line number of the new record.
+ @param Value The new default value.
+
+**/
+VOID
+CIfrRecordInfoDB::IfrCreateDefaultRecord(
+ IN UINT8 Size,
+ IN UINT16 DefaultId,
+ IN UINT8 Type,
+ IN UINT32 LineNo,
+ IN EFI_IFR_TYPE_VALUE Value
+ )
+{
+ CIfrDefault *DObj;
+ CIfrDefault2 *DObj2;
+
+ DObj = NULL;
+ DObj2 = NULL;
+
+ if (Type == EFI_IFR_TYPE_OTHER) {
+ DObj2 = new CIfrDefault2 (Size);
+ DObj2->SetDefaultId(DefaultId);
+ DObj2->SetType(Type);
+ DObj2->SetLineNo(LineNo);
+ DObj2->SetScope (1);
+ delete DObj2;
+ } else {
+ DObj = new CIfrDefault (Size);
+ DObj->SetDefaultId(DefaultId);
+ DObj->SetType(Type);
+ DObj->SetLineNo(LineNo);
+ DObj->SetValue (Value);
+ delete DObj;
+ }
+}
+
+/**
+ Create new default opcode for question base on the QuestionDefaultInfo.
+
+ @param pQuestionNode Point to the question opcode Node.
+ @param QuestionDefaultInfo Point to the QuestionDefaultInfo for current question.
+
+**/
+VOID
+CIfrRecordInfoDB::IfrCreateDefaultForQuestion (
+ IN SIfrRecord *pQuestionNode,
+ IN QuestionDefaultRecord *QuestionDefaultInfo
+ )
+{
+ EFI_IFR_OP_HEADER *pOpHead;
+ EFI_IFR_DEFAULT *Default;
+ SIfrRecord *pSNode;
+ SIfrRecord *pENode;
+ SIfrRecord *pDefaultNode;
+ CIfrObj *Obj;
+ CHAR8 *ObjBinBuf;
+ UINT8 ScopeCount;
+ UINT8 OpcodeNumber;
+ UINT8 OpcodeCount;
+ UINT8 DefaultSize;
+ EFI_IFR_ONE_OF_OPTION *DefaultOptionOpcode;
+ EFI_IFR_TYPE_VALUE CheckBoxDefaultValue;
+
+ CheckBoxDefaultValue.b = 1;
+ pOpHead = (EFI_IFR_OP_HEADER *) pQuestionNode->mIfrBinBuf;
+ ScopeCount = 0;
+ OpcodeCount = 0;
+ Obj = NULL;
+
+ //
+ // Record the offset of node which need to be adjust, will move the new created default opcode to this offset.
+ //
+ gAdjustOpcodeOffset = pQuestionNode->mNext->mOffset;
+ //
+ // Case 1:
+ // For oneof, the default with smallest default id is given by the option flag.
+ // So create the missing defaults base on the oneof option value(mDefaultValueRecord).
+ //
+ if (pOpHead->OpCode == EFI_IFR_ONE_OF_OP && !QuestionDefaultInfo->mIsDefaultOpcode) {
+ DefaultOptionOpcode = (EFI_IFR_ONE_OF_OPTION *)QuestionDefaultInfo->mDefaultValueRecord->mIfrBinBuf;
+ DefaultSize = QuestionDefaultInfo->mDefaultValueRecord->mBinBufLen - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value);
+ DefaultSize += OFFSET_OF (EFI_IFR_DEFAULT, Value);
+ for (UINT8 i = 0; i < mAllDefaultTypeCount; i++) {
+ if (!QuestionDefaultInfo->mIsDefaultIdExist[i]) {
+ IfrCreateDefaultRecord (DefaultSize, mAllDefaultIdArray[i], DefaultOptionOpcode->Type, pQuestionNode->mLineNo, DefaultOptionOpcode->Value);
+ //
+ // Save the new created default in the buffer storage.
+ //
+ IfrAddDefaultToBufferConfig (mAllDefaultIdArray[i], pQuestionNode, DefaultOptionOpcode->Value);
+ }
+ }
+ return;
+ }
+
+ //
+ // Case2:
+ // For checkbox, the default with smallest default id is given by the question flag.
+ // And create the missing defaults with true value.
+ //
+ if (pOpHead-> OpCode == EFI_IFR_CHECKBOX_OP && !QuestionDefaultInfo->mIsDefaultOpcode) {
+ DefaultSize = OFFSET_OF (EFI_IFR_DEFAULT, Value) + sizeof (BOOLEAN);
+ for (UINT8 i = 0; i < mAllDefaultTypeCount; i++) {
+ if (!QuestionDefaultInfo->mIsDefaultIdExist[i]) {
+ IfrCreateDefaultRecord (DefaultSize, mAllDefaultIdArray[i], EFI_IFR_TYPE_BOOLEAN, pQuestionNode->mLineNo, CheckBoxDefaultValue);
+ //
+ // Save the new created default.
+ //
+ IfrAddDefaultToBufferConfig (mAllDefaultIdArray[i], pQuestionNode, CheckBoxDefaultValue);
+ }
+ }
+ return;
+ }
+
+ //
+ // Case3:
+ // The default with smallest default id is given by the default opcode.
+ // So create the missing defaults base on the value in the default opcode.
+ //
+
+ //
+ // pDefaultNode point to the mDefaultValueRecord in QuestionDefaultInfo.
+ //
+ pDefaultNode = QuestionDefaultInfo->mDefaultValueRecord;
+ Default = (EFI_IFR_DEFAULT *)pDefaultNode->mIfrBinBuf;
+ //
+ // Record the offset of node which need to be adjust, will move the new created default opcode to this offset.
+ //
+ gAdjustOpcodeOffset = pDefaultNode->mNext->mOffset;
+
+ if (Default->Type == EFI_IFR_TYPE_OTHER) {
+ //
+ // EFI_IFR_DEFAULT_2 opcode.
+ //
+ // Point to the first expression opcode.
+ //
+ pSNode = pDefaultNode->mNext;
+ pENode = NULL;
+ ScopeCount++;
+ //
+ // Get opcode number behind the EFI_IFR_DEFAULT_2 until reach its END opcode (including the END opcode of EFI_IFR_DEFAULT_2)
+ //
+ while (pSNode != NULL && pSNode->mNext != NULL && ScopeCount != 0) {
+ pOpHead = (EFI_IFR_OP_HEADER *) pSNode->mIfrBinBuf;
+ if (pOpHead->Scope == 1) {
+ ScopeCount++;
+ }
+ if (pOpHead->OpCode == EFI_IFR_END_OP) {
+ ScopeCount--;
+ }
+ pENode = pSNode;
+ pSNode = pSNode->mNext;
+ OpcodeCount++;
+ }
+
+ assert (pSNode);
+ assert (pENode);
+
+ //
+ // Record the offset of node which need to be adjust, will move the new created default opcode to this offset.
+ //
+ gAdjustOpcodeOffset = pSNode->mOffset;
+ //
+ // Create new default opcode node for missing default.
+ //
+ for (UINT8 i = 0; i < mAllDefaultTypeCount; i++) {
+ OpcodeNumber = OpcodeCount;
+ if (!QuestionDefaultInfo->mIsDefaultIdExist[i]) {
+ IfrCreateDefaultRecord (Default->Header.Length, mAllDefaultIdArray[i], Default->Type, pENode->mLineNo, Default->Value);
+ //
+ // Point to the first expression opcode node.
+ //
+ pSNode = pDefaultNode->mNext;
+ //
+ // Create the expression opcode and end opcode for the new created EFI_IFR_DEFAULT_2 opcode.
+ //
+ while (pSNode != NULL && pSNode->mNext != NULL && OpcodeNumber-- != 0) {
+ pOpHead = (EFI_IFR_OP_HEADER *) pSNode->mIfrBinBuf;
+ Obj = new CIfrObj (pOpHead->OpCode, NULL, pSNode->mBinBufLen, FALSE);
+ assert (Obj != NULL);
+ Obj->SetLineNo (pSNode->mLineNo);
+ ObjBinBuf = Obj->GetObjBinAddr<CHAR8>();
+ memcpy (ObjBinBuf, pSNode->mIfrBinBuf, (UINTN)pSNode->mBinBufLen);
+ delete Obj;
+ pSNode = pSNode->mNext;
+ }
+ }
+ }
+ } else {
+ //
+ // EFI_IFR_DEFAULT opcode.
+ //
+ // Create new default opcode node for missing default.
+ //
+ for (UINT8 i = 0; i < mAllDefaultTypeCount; i++) {
+ if (!QuestionDefaultInfo->mIsDefaultIdExist[i]) {
+ IfrCreateDefaultRecord (Default->Header.Length, mAllDefaultIdArray[i], Default->Type, pDefaultNode->mLineNo, Default->Value);
+ //
+ // Save the new created default in the buffer storage..
+ //
+ IfrAddDefaultToBufferConfig (mAllDefaultIdArray[i], pQuestionNode, Default->Value);
+ }
+ }
+ }
+}
+
+/**
+ Parse the default information in a question, get the QuestionDefaultInfo.
+
+ @param pQuestionNode Point to the question record Node.
+ @param QuestionDefaultInfo On return, point to the QuestionDefaultInfo.
+**/
+VOID
+CIfrRecordInfoDB::IfrParseDefaulInfoInQuestion(
+ IN SIfrRecord *pQuestionNode,
+ OUT QuestionDefaultRecord *QuestionDefaultInfo
+ )
+{
+ SIfrRecord *pSNode;
+ EFI_IFR_ONE_OF_OPTION *OneofOptionOpcode;
+ EFI_IFR_OP_HEADER *pSOpHead;
+ EFI_IFR_CHECKBOX *CheckBoxOpcode;
+ EFI_IFR_DEFAULT *DefaultOpcode;
+ BOOLEAN IsOneOfOpcode;
+ UINT16 SmallestDefaultId;
+ UINT8 ScopeCount;
+
+ SmallestDefaultId = 0xffff;
+ IsOneOfOpcode = FALSE;
+ ScopeCount = 0;
+ pSNode = pQuestionNode;
+
+ //
+ // Parse all the opcodes in the Question.
+ //
+ while (pSNode != NULL) {
+ pSOpHead = (EFI_IFR_OP_HEADER *) pSNode->mIfrBinBuf;
+ //
+ // For a question, its scope bit must be set, the scope exists until it reaches a corresponding EFI_IFR_END_OP.
+ // Scopes may be nested within other scopes.
+ // When finishing parsing a question, the scope count must be zero.
+ //
+ if (pSOpHead->Scope == 1) {
+ ScopeCount++;
+ }
+ if (pSOpHead->OpCode == EFI_IFR_END_OP) {
+ ScopeCount--;
+ }
+ //
+ // Check whether finishing parsing a question.
+ //
+ if (ScopeCount == 0) {
+ break;
+ }
+
+ //
+ // Record the default information in the question.
+ //
+ switch (pSOpHead->OpCode) {
+ case EFI_IFR_ONE_OF_OP:
+ IsOneOfOpcode = TRUE;
+ break;
+ case EFI_IFR_CHECKBOX_OP:
+ //
+ // The default info of check box may be given by flag.
+ // So need to check the flag of check box.
+ //
+ CheckBoxOpcode = (EFI_IFR_CHECKBOX *)pSNode->mIfrBinBuf;
+ if ((CheckBoxOpcode->Flags & EFI_IFR_CHECKBOX_DEFAULT) != 0) {
+ //
+ // Check whether need to update the smallest default id.
+ //
+ if (SmallestDefaultId > EFI_HII_DEFAULT_CLASS_STANDARD) {
+ SmallestDefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
+ }
+ //
+ // Update the QuestionDefaultInfo.
+ //
+ for (UINT8 i = 0; i < mAllDefaultTypeCount; i++) {
+ if (mAllDefaultIdArray[i] == EFI_HII_DEFAULT_CLASS_STANDARD) {
+ if (!QuestionDefaultInfo->mIsDefaultIdExist[i]) {
+ QuestionDefaultInfo->mDefaultNumber ++;
+ QuestionDefaultInfo->mIsDefaultIdExist[i] = TRUE;
+ }
+ break;
+ }
+ }
+ }
+ if ((CheckBoxOpcode->Flags & EFI_IFR_CHECKBOX_DEFAULT_MFG) != 0) {
+ //
+ // Check whether need to update the smallest default id.
+ //
+ if (SmallestDefaultId > EFI_HII_DEFAULT_CLASS_MANUFACTURING) {
+ SmallestDefaultId = EFI_HII_DEFAULT_CLASS_MANUFACTURING;
+ }
+ //
+ // Update the QuestionDefaultInfo.
+ //
+ for (UINT8 i = 0; i < mAllDefaultTypeCount; i++) {
+ if (mAllDefaultIdArray[i] == EFI_HII_DEFAULT_CLASS_MANUFACTURING) {
+ if (!QuestionDefaultInfo->mIsDefaultIdExist[i]) {
+ QuestionDefaultInfo->mDefaultNumber ++;
+ QuestionDefaultInfo->mIsDefaultIdExist[i] = TRUE;
+ }
+ break;
+ }
+ }
+ }
+ break;
+ case EFI_IFR_ONE_OF_OPTION_OP:
+ if (!IsOneOfOpcode) {
+ //
+ // Only check the option in oneof.
+ //
+ break;
+ }
+ OneofOptionOpcode = (EFI_IFR_ONE_OF_OPTION *)pSNode->mIfrBinBuf;
+ if ((OneofOptionOpcode->Flags & EFI_IFR_OPTION_DEFAULT) != 0) {
+ //
+ // The option is used as the standard default.
+ // Check whether need to update the smallest default id and QuestionDefaultInfo.
+ //
+ if (SmallestDefaultId > EFI_HII_DEFAULT_CLASS_STANDARD) {
+ SmallestDefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
+ QuestionDefaultInfo->mDefaultValueRecord = pSNode;
+ }
+ //
+ // Update the IsDefaultIdExist array in QuestionDefaultInfo.
+ //
+ for (UINT8 i = 0; i < mAllDefaultTypeCount; i++) {
+ if (mAllDefaultIdArray[i] == EFI_HII_DEFAULT_CLASS_STANDARD) {
+ if (!QuestionDefaultInfo->mIsDefaultIdExist[i]) {
+ QuestionDefaultInfo->mDefaultNumber ++;
+ QuestionDefaultInfo->mIsDefaultIdExist[i] = TRUE;
+ }
+ break;
+ }
+ }
+ }
+ if ((OneofOptionOpcode->Flags & EFI_IFR_OPTION_DEFAULT_MFG) != 0) {
+ //
+ // This option is used as the manufacture default.
+ // Check whether need to update the smallest default id and QuestionDefaultInfo.
+ //
+ if (SmallestDefaultId > EFI_HII_DEFAULT_CLASS_MANUFACTURING) {
+ SmallestDefaultId = EFI_HII_DEFAULT_CLASS_MANUFACTURING;
+ QuestionDefaultInfo->mDefaultValueRecord = pSNode;
+ }
+ //
+ // Update the QuestionDefaultInfo.
+ //
+ for (UINT8 i = 0; i < mAllDefaultTypeCount; i++) {
+ if (mAllDefaultIdArray[i] == EFI_HII_DEFAULT_CLASS_MANUFACTURING) {
+ if (!QuestionDefaultInfo->mIsDefaultIdExist[i]) {
+ QuestionDefaultInfo->mDefaultNumber ++;
+ QuestionDefaultInfo->mIsDefaultIdExist[i] = TRUE;
+ }
+ break;
+ }
+ }
+ }
+ break;
+ case EFI_IFR_DEFAULT_OP:
+ DefaultOpcode = (EFI_IFR_DEFAULT *) pSNode->mIfrBinBuf;
+ //
+ // Check whether need to update the smallest default id and QuestionDefaultInfo.
+ //
+ if (SmallestDefaultId >= DefaultOpcode->DefaultId ) {
+ SmallestDefaultId = DefaultOpcode->DefaultId;
+ QuestionDefaultInfo->mDefaultValueRecord= pSNode;
+ QuestionDefaultInfo->mIsDefaultOpcode= TRUE;
+ }
+ //
+ // Update the QuestionDefaultInfo.
+ //
+ for (UINT8 i = 0; i < mAllDefaultTypeCount; i++){
+ if (mAllDefaultIdArray[i] == ((EFI_IFR_DEFAULT *)pSNode->mIfrBinBuf)->DefaultId) {
+ if (!QuestionDefaultInfo->mIsDefaultIdExist[i]) {
+ QuestionDefaultInfo->mDefaultNumber ++;
+ QuestionDefaultInfo->mIsDefaultIdExist[i] = TRUE;
+ }
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ //
+ // Parse next opcode in this question.
+ //
+ pSNode = pSNode->mNext;
+ }
+}
+
+/**
+ Check or add default for question if need.
+
+ This function will check the default info for question.
+ If the question has default, but the default number < defaultstore opcode number.
+ will do following two action :
+
+ 1. if (AutoDefault) will add default for question to support all kinds of defaults.
+ 2. if (CheckDefault) will generate an error to tell user the question misses some default value.
+
+ We assume that the two options can not be TRUE at same time.
+ If they are TRUE at same time, only do the action corresponding to AutoDefault option.
+
+ @param AutoDefault Add default for question if needed
+ @param CheckDefault Check the default info, if missing default, generates an error.
+
+**/
+VOID
+CIfrRecordInfoDB::IfrCheckAddDefaultRecord (
+ BOOLEAN AutoDefault,
+ BOOLEAN CheckDefault
+ )
+{
+ SIfrRecord *pNode;
+ SIfrRecord *pTailNode;
+ SIfrRecord *pStartAdjustNode;
+ EFI_IFR_OP_HEADER *pOpHead;
+ QuestionDefaultRecord QuestionDefaultInfo;
+ UINT8 MissingDefaultCount;
+ CHAR8 Msg[MAX_STRING_LEN] = {0, };
+
+ pNode = mIfrRecordListHead;
+
+ //
+ // Record the number and default id of all defaultstore opcode.
+ //
+ IfrGetDefaultStoreInfo ();
+
+ while (pNode != NULL) {
+ pOpHead = (EFI_IFR_OP_HEADER *) pNode->mIfrBinBuf;
+ //
+ // Check whether is question opcode.
+ //
+ if (CheckQuestionOpCode (pOpHead->OpCode)) {
+ //
+ // Initialize some local variables here, because they vary with question.
+ // Record the mIfrRecordListTail for each question, because may create default node for question after mIfrRecordListTail.
+ //
+ memset (&QuestionDefaultInfo, 0, sizeof (QuestionDefaultRecord));
+ pTailNode = mIfrRecordListTail;
+ //
+ // Get the QuestionDefaultInfo for current question.
+ //
+ IfrParseDefaulInfoInQuestion (pNode, &QuestionDefaultInfo);
+
+ if (QuestionDefaultInfo.mDefaultNumber != mAllDefaultTypeCount && QuestionDefaultInfo.mDefaultNumber != 0) {
+ if (AutoDefault) {
+ //
+ // Create default for question which misses default.
+ //
+ IfrCreateDefaultForQuestion (pNode, &QuestionDefaultInfo);
+
+ //
+ // Adjust the buffer content.
+ // pStartAdjustNode->mIfrBinBuf points to the insert position.
+ // pTailNode->mNext->mIfrBinBuf points to the inset opcodes.
+ //
+ pStartAdjustNode =GetRecordInfoFromOffset (gAdjustOpcodeOffset);
+ gCFormPkg.AdjustDynamicInsertOpcode (pStartAdjustNode->mIfrBinBuf, pTailNode->mNext->mIfrBinBuf, TRUE);
+
+ //
+ // Update the record info.
+ //
+ IfrUpdateRecordInfoForDynamicOpcode (TRUE);
+ } else if (CheckDefault) {
+ //
+ // Generate an error for question which misses default.
+ //
+ MissingDefaultCount = mAllDefaultTypeCount - QuestionDefaultInfo.mDefaultNumber;
+ sprintf (Msg, "The question misses %d default, the question's opcode is %d", MissingDefaultCount, pOpHead->OpCode);
+ gCVfrErrorHandle.PrintMsg (pNode->mLineNo, NULL, "Error", Msg);
+ }
+ }
+ }
+ //
+ // parse next opcode.
+ //
+ pNode = pNode->mNext;
+ }
+}
+
+CIfrRecordInfoDB gCIfrRecordInfoDB;
+
+VOID
+CIfrObj::_EMIT_PENDING_OBJ (
+ VOID
+ )
+{
+ CHAR8 *ObjBinBuf = NULL;
+
+ //
+ // do nothing
+ //
+ if (!mDelayEmit || !gCreateOp) {
+ return;
+ }
+
+ mPkgOffset = gCFormPkg.GetPkgLength ();
+ //
+ // update data buffer to package data
+ //
+ ObjBinBuf = gCFormPkg.IfrBinBufferGet (mObjBinLen);
+ if (ObjBinBuf != NULL) {
+ memmove (ObjBinBuf, mObjBinBuf, mObjBinLen);
+ }
+
+ //
+ // update bin buffer to package data buffer
+ //
+ if (mObjBinBuf != NULL) {
+ delete[] mObjBinBuf;
+ mObjBinBuf = ObjBinBuf;
+ }
+
+ mDelayEmit = FALSE;
+}
+
+/*
+ * The definition of CIfrObj's member function
+ */
+static struct {
+ UINT8 mSize;
+ UINT8 mScope;
+} gOpcodeSizesScopeTable[] = {
+ { 0, 0 }, // EFI_IFR_INVALID - 0x00
+ { sizeof (EFI_IFR_FORM), 1 }, // EFI_IFR_FORM_OP
+ { sizeof (EFI_IFR_SUBTITLE), 1 }, // EFI_IFR_SUBTITLE_OP
+ { sizeof (EFI_IFR_TEXT), 0 }, // EFI_IFR_TEXT_OP
+ { sizeof (EFI_IFR_IMAGE), 0 }, // EFI_IFR_IMAGE_OP
+ { sizeof (EFI_IFR_ONE_OF), 1 }, // EFI_IFR_ONE_OF_OP - 0x05
+ { sizeof (EFI_IFR_CHECKBOX), 1}, // EFI_IFR_CHECKBOX_OP
+ { sizeof (EFI_IFR_NUMERIC), 1 }, // EFI_IFR_NUMERIC_OP
+ { sizeof (EFI_IFR_PASSWORD), 1 }, // EFI_IFR_PASSWORD_OP
+ { sizeof (EFI_IFR_ONE_OF_OPTION), 0 }, // EFI_IFR_ONE_OF_OPTION_OP
+ { sizeof (EFI_IFR_SUPPRESS_IF), 1 }, // EFI_IFR_SUPPRESS_IF - 0x0A
+ { sizeof (EFI_IFR_LOCKED), 0 }, // EFI_IFR_LOCKED_OP
+ { sizeof (EFI_IFR_ACTION), 1 }, // EFI_IFR_ACTION_OP
+ { sizeof (EFI_IFR_RESET_BUTTON), 1 }, // EFI_IFR_RESET_BUTTON_OP
+ { sizeof (EFI_IFR_FORM_SET), 1 }, // EFI_IFR_FORM_SET_OP -0xE
+ { sizeof (EFI_IFR_REF), 0 }, // EFI_IFR_REF_OP
+ { sizeof (EFI_IFR_NO_SUBMIT_IF), 1}, // EFI_IFR_NO_SUBMIT_IF_OP -0x10
+ { sizeof (EFI_IFR_INCONSISTENT_IF), 1 }, // EFI_IFR_INCONSISTENT_IF_OP
+ { sizeof (EFI_IFR_EQ_ID_VAL), 0 }, // EFI_IFR_EQ_ID_VAL_OP
+ { sizeof (EFI_IFR_EQ_ID_ID), 0 }, // EFI_IFR_EQ_ID_ID_OP
+ { sizeof (EFI_IFR_EQ_ID_VAL_LIST), 0 }, // EFI_IFR_EQ_ID_LIST_OP - 0x14
+ { sizeof (EFI_IFR_AND), 0 }, // EFI_IFR_AND_OP
+ { sizeof (EFI_IFR_OR), 0 }, // EFI_IFR_OR_OP
+ { sizeof (EFI_IFR_NOT), 0 }, // EFI_IFR_NOT_OP
+ { sizeof (EFI_IFR_RULE), 1 }, // EFI_IFR_RULE_OP
+ { sizeof (EFI_IFR_GRAY_OUT_IF), 1 }, // EFI_IFR_GRAYOUT_IF_OP - 0x19
+ { sizeof (EFI_IFR_DATE), 1 }, // EFI_IFR_DATE_OP
+ { sizeof (EFI_IFR_TIME), 1 }, // EFI_IFR_TIME_OP
+ { sizeof (EFI_IFR_STRING), 1 }, // EFI_IFR_STRING_OP
+ { sizeof (EFI_IFR_REFRESH), 0 }, // EFI_IFR_REFRESH_OP
+ { sizeof (EFI_IFR_DISABLE_IF), 1 }, // EFI_IFR_DISABLE_IF_OP - 0x1E
+ { 0, 0 }, // 0x1F
+ { sizeof (EFI_IFR_TO_LOWER), 0 }, // EFI_IFR_TO_LOWER_OP - 0x20
+ { sizeof (EFI_IFR_TO_UPPER), 0 }, // EFI_IFR_TO_UPPER_OP - 0x21
+ { sizeof (EFI_IFR_MAP), 1 }, // EFI_IFR_MAP - 0x22
+ { sizeof (EFI_IFR_ORDERED_LIST), 1 }, // EFI_IFR_ORDERED_LIST_OP - 0x23
+ { sizeof (EFI_IFR_VARSTORE), 0 }, // EFI_IFR_VARSTORE_OP
+ { sizeof (EFI_IFR_VARSTORE_NAME_VALUE), 0 }, // EFI_IFR_VARSTORE_NAME_VALUE_OP
+ { sizeof (EFI_IFR_VARSTORE_EFI), 0 }, // EFI_IFR_VARSTORE_EFI_OP
+ { sizeof (EFI_IFR_VARSTORE_DEVICE), 1 }, // EFI_IFR_VARSTORE_DEVICE_OP
+ { sizeof (EFI_IFR_VERSION), 0 }, // EFI_IFR_VERSION_OP - 0x28
+ { sizeof (EFI_IFR_END), 0 }, // EFI_IFR_END_OP
+ { sizeof (EFI_IFR_MATCH), 0 }, // EFI_IFR_MATCH_OP - 0x2A
+ { sizeof (EFI_IFR_GET), 0 }, // EFI_IFR_GET - 0x2B
+ { sizeof (EFI_IFR_SET), 0 }, // EFI_IFR_SET - 0x2C
+ { sizeof (EFI_IFR_READ), 0 }, // EFI_IFR_READ - 0x2D
+ { sizeof (EFI_IFR_WRITE), 0 }, // EFI_IFR_WRITE - 0x2E
+ { sizeof (EFI_IFR_EQUAL), 0 }, // EFI_IFR_EQUAL_OP - 0x2F
+ { sizeof (EFI_IFR_NOT_EQUAL), 0 }, // EFI_IFR_NOT_EQUAL_OP
+ { sizeof (EFI_IFR_GREATER_THAN), 0 }, // EFI_IFR_GREATER_THAN_OP
+ { sizeof (EFI_IFR_GREATER_EQUAL), 0 }, // EFI_IFR_GREATER_EQUAL_OP
+ { sizeof (EFI_IFR_LESS_THAN), 0 }, // EFI_IFR_LESS_THAN_OP
+ { sizeof (EFI_IFR_LESS_EQUAL), 0 }, // EFI_IFR_LESS_EQUAL_OP - 0x34
+ { sizeof (EFI_IFR_BITWISE_AND), 0 }, // EFI_IFR_BITWISE_AND_OP
+ { sizeof (EFI_IFR_BITWISE_OR), 0 }, // EFI_IFR_BITWISE_OR_OP
+ { sizeof (EFI_IFR_BITWISE_NOT), 0 }, // EFI_IFR_BITWISE_NOT_OP
+ { sizeof (EFI_IFR_SHIFT_LEFT), 0 }, // EFI_IFR_SHIFT_LEFT_OP
+ { sizeof (EFI_IFR_SHIFT_RIGHT), 0 }, // EFI_IFR_SHIFT_RIGHT_OP
+ { sizeof (EFI_IFR_ADD), 0 }, // EFI_IFR_ADD_OP - 0x3A
+ { sizeof (EFI_IFR_SUBTRACT), 0 }, // EFI_IFR_SUBTRACT_OP
+ { sizeof (EFI_IFR_MULTIPLY), 0 }, // EFI_IFR_MULTIPLY_OP
+ { sizeof (EFI_IFR_DIVIDE), 0 }, // EFI_IFR_DIVIDE_OP
+ { sizeof (EFI_IFR_MODULO), 0 }, // EFI_IFR_MODULO_OP - 0x3E
+ { sizeof (EFI_IFR_RULE_REF), 0 }, // EFI_IFR_RULE_REF_OP
+ { sizeof (EFI_IFR_QUESTION_REF1), 0 }, // EFI_IFR_QUESTION_REF1_OP
+ { sizeof (EFI_IFR_QUESTION_REF2), 0 }, // EFI_IFR_QUESTION_REF2_OP - 0x41
+ { sizeof (EFI_IFR_UINT8), 0}, // EFI_IFR_UINT8
+ { sizeof (EFI_IFR_UINT16), 0}, // EFI_IFR_UINT16
+ { sizeof (EFI_IFR_UINT32), 0}, // EFI_IFR_UINT32
+ { sizeof (EFI_IFR_UINT64), 0}, // EFI_IFR_UTNT64
+ { sizeof (EFI_IFR_TRUE), 0 }, // EFI_IFR_TRUE_OP - 0x46
+ { sizeof (EFI_IFR_FALSE), 0 }, // EFI_IFR_FALSE_OP
+ { sizeof (EFI_IFR_TO_UINT), 0 }, // EFI_IFR_TO_UINT_OP
+ { sizeof (EFI_IFR_TO_STRING), 0 }, // EFI_IFR_TO_STRING_OP
+ { sizeof (EFI_IFR_TO_BOOLEAN), 0 }, // EFI_IFR_TO_BOOLEAN_OP
+ { sizeof (EFI_IFR_MID), 0 }, // EFI_IFR_MID_OP
+ { sizeof (EFI_IFR_FIND), 0 }, // EFI_IFR_FIND_OP
+ { sizeof (EFI_IFR_TOKEN), 0 }, // EFI_IFR_TOKEN_OP
+ { sizeof (EFI_IFR_STRING_REF1), 0 }, // EFI_IFR_STRING_REF1_OP - 0x4E
+ { sizeof (EFI_IFR_STRING_REF2), 0 }, // EFI_IFR_STRING_REF2_OP
+ { sizeof (EFI_IFR_CONDITIONAL), 0 }, // EFI_IFR_CONDITIONAL_OP
+ { sizeof (EFI_IFR_QUESTION_REF3), 0 }, // EFI_IFR_QUESTION_REF3_OP
+ { sizeof (EFI_IFR_ZERO), 0 }, // EFI_IFR_ZERO_OP
+ { sizeof (EFI_IFR_ONE), 0 }, // EFI_IFR_ONE_OP
+ { sizeof (EFI_IFR_ONES), 0 }, // EFI_IFR_ONES_OP
+ { sizeof (EFI_IFR_UNDEFINED), 0 }, // EFI_IFR_UNDEFINED_OP
+ { sizeof (EFI_IFR_LENGTH), 0 }, // EFI_IFR_LENGTH_OP
+ { sizeof (EFI_IFR_DUP), 0 }, // EFI_IFR_DUP_OP - 0x57
+ { sizeof (EFI_IFR_THIS), 0 }, // EFI_IFR_THIS_OP
+ { sizeof (EFI_IFR_SPAN), 0 }, // EFI_IFR_SPAN_OP
+ { sizeof (EFI_IFR_VALUE), 1 }, // EFI_IFR_VALUE_OP
+ { sizeof (EFI_IFR_DEFAULT), 0 }, // EFI_IFR_DEFAULT_OP
+ { sizeof (EFI_IFR_DEFAULTSTORE), 0 }, // EFI_IFR_DEFAULTSTORE_OP - 0x5C
+ { sizeof (EFI_IFR_FORM_MAP), 1}, // EFI_IFR_FORM_MAP_OP - 0x5D
+ { sizeof (EFI_IFR_CATENATE), 0 }, // EFI_IFR_CATENATE_OP
+ { sizeof (EFI_IFR_GUID), 0 }, // EFI_IFR_GUID_OP
+ { sizeof (EFI_IFR_SECURITY), 0 }, // EFI_IFR_SECURITY_OP - 0x60
+ { sizeof (EFI_IFR_MODAL_TAG), 0}, // EFI_IFR_MODAL_TAG_OP - 0x61
+ { sizeof (EFI_IFR_REFRESH_ID), 0}, // EFI_IFR_REFRESH_ID_OP - 0x62
+ { sizeof (EFI_IFR_WARNING_IF), 1}, // EFI_IFR_WARNING_IF_OP - 0x63
+ { sizeof (EFI_IFR_MATCH2), 0 }, // EFI_IFR_MATCH2_OP - 0x64
+};
+
+#ifdef CIFROBJ_DEUBG
+static struct {
+ CHAR8 *mIfrName;
+} gIfrObjPrintDebugTable[] = {
+ "EFI_IFR_INVALID", "EFI_IFR_FORM", "EFI_IFR_SUBTITLE", "EFI_IFR_TEXT", "EFI_IFR_IMAGE", "EFI_IFR_ONE_OF",
+ "EFI_IFR_CHECKBOX", "EFI_IFR_NUMERIC", "EFI_IFR_PASSWORD", "EFI_IFR_ONE_OF_OPTION", "EFI_IFR_SUPPRESS_IF", "EFI_IFR_LOCKED",
+ "EFI_IFR_ACTION", "EFI_IFR_RESET_BUTTON", "EFI_IFR_FORM_SET", "EFI_IFR_REF", "EFI_IFR_NO_SUBMIT_IF", "EFI_IFR_INCONSISTENT_IF",
+ "EFI_IFR_EQ_ID_VAL", "EFI_IFR_EQ_ID_ID", "EFI_IFR_EQ_ID_LIST", "EFI_IFR_AND", "EFI_IFR_OR", "EFI_IFR_NOT",
+ "EFI_IFR_RULE", "EFI_IFR_GRAY_OUT_IF", "EFI_IFR_DATE", "EFI_IFR_TIME", "EFI_IFR_STRING", "EFI_IFR_REFRESH",
+ "EFI_IFR_DISABLE_IF", "EFI_IFR_INVALID", "EFI_IFR_TO_LOWER", "EFI_IFR_TO_UPPER", "EFI_IFR_MAP", "EFI_IFR_ORDERED_LIST",
+ "EFI_IFR_VARSTORE", "EFI_IFR_VARSTORE_NAME_VALUE", "EFI_IFR_VARSTORE_EFI", "EFI_IFR_VARSTORE_DEVICE", "EFI_IFR_VERSION", "EFI_IFR_END",
+ "EFI_IFR_MATCH", "EFI_IFR_GET", "EFI_IFR_SET", "EFI_IFR_READ", "EFI_IFR_WRITE", "EFI_IFR_EQUAL",
+ "EFI_IFR_NOT_EQUAL", "EFI_IFR_GREATER_THAN", "EFI_IFR_GREATER_EQUAL", "EFI_IFR_LESS_THAN", "EFI_IFR_LESS_EQUAL", "EFI_IFR_BITWISE_AND",
+ "EFI_IFR_BITWISE_OR", "EFI_IFR_BITWISE_NOT", "EFI_IFR_SHIFT_LEFT", "EFI_IFR_SHIFT_RIGHT", "EFI_IFR_ADD", "EFI_IFR_SUBTRACT",
+ "EFI_IFR_MULTIPLY", "EFI_IFR_DIVIDE", "EFI_IFR_MODULO", "EFI_IFR_RULE_REF", "EFI_IFR_QUESTION_REF1", "EFI_IFR_QUESTION_REF2",
+ "EFI_IFR_UINT8", "EFI_IFR_UINT16", "EFI_IFR_UINT32", "EFI_IFR_UINT64", "EFI_IFR_TRUE", "EFI_IFR_FALSE",
+ "EFI_IFR_TO_UINT", "EFI_IFR_TO_STRING", "EFI_IFR_TO_BOOLEAN", "EFI_IFR_MID", "EFI_IFR_FIND", "EFI_IFR_TOKEN",
+ "EFI_IFR_STRING_REF1","EFI_IFR_STRING_REF2", "EFI_IFR_CONDITIONAL", "EFI_IFR_QUESTION_REF3", "EFI_IFR_ZERO", "EFI_IFR_ONE",
+ "EFI_IFR_ONES", "EFI_IFR_UNDEFINED", "EFI_IFR_LENGTH", "EFI_IFR_DUP", "EFI_IFR_THIS", "EFI_IFR_SPAN",
+ "EFI_IFR_VALUE", "EFI_IFR_DEFAULT", "EFI_IFR_DEFAULTSTORE", "EFI_IFR_FORM_MAP", "EFI_IFR_CATENATE", "EFI_IFR_GUID",
+ "EFI_IFR_SECURITY", "EFI_IFR_MODAL_TAG", "EFI_IFR_REFRESH_ID", "EFI_IFR_WARNING_IF", "EFI_IFR_MATCH2",
+};
+
+VOID
+CIFROBJ_DEBUG_PRINT (
+ IN UINT8 OpCode
+ )
+{
+ printf ("======Create IFR [%s]\n", gIfrObjPrintDebugTable[OpCode].mIfrName);
+}
+#else
+
+#define CIFROBJ_DEBUG_PRINT(OpCode)
+
+#endif
+
+BOOLEAN gCreateOp = TRUE;
+
+CIfrObj::CIfrObj (
+ IN UINT8 OpCode,
+ OUT CHAR8 **IfrObj,
+ IN UINT8 ObjBinLen,
+ IN BOOLEAN DelayEmit
+ )
+{
+ mDelayEmit = DelayEmit;
+ mPkgOffset = gCFormPkg.GetPkgLength ();
+ mObjBinLen = (ObjBinLen == 0) ? gOpcodeSizesScopeTable[OpCode].mSize : ObjBinLen;
+ mObjBinBuf = ((DelayEmit == FALSE) && (gCreateOp == TRUE)) ? gCFormPkg.IfrBinBufferGet (mObjBinLen) : new CHAR8[EFI_IFR_MAX_LENGTH];
+ mRecordIdx = (gCreateOp == TRUE) ? gCIfrRecordInfoDB.IfrRecordRegister (0xFFFFFFFF, mObjBinBuf, mObjBinLen, mPkgOffset) : EFI_IFR_RECORDINFO_IDX_INVALUD;
+ mLineNo = 0;
+
+ assert (mObjBinBuf != NULL);
+
+ if (IfrObj != NULL) {
+ *IfrObj = mObjBinBuf;
+ }
+
+ CIFROBJ_DEBUG_PRINT (OpCode);
+}
+
+CIfrObj::~CIfrObj (
+ VOID
+ )
+{
+ if ((mDelayEmit == TRUE) && ((gCreateOp == TRUE))) {
+ _EMIT_PENDING_OBJ ();
+ }
+
+ gCIfrRecordInfoDB.IfrRecordInfoUpdate (mRecordIdx, mLineNo, mObjBinBuf, mObjBinLen, mPkgOffset);
+}
+
+/*
+ * The definition of CIfrObj's member function
+ */
+UINT8 gScopeCount = 0;
+
+CIfrOpHeader::CIfrOpHeader (
+ IN UINT8 OpCode,
+ IN VOID *StartAddr,
+ IN UINT8 Length
+ ) : mHeader ((EFI_IFR_OP_HEADER *)StartAddr)
+{
+ mHeader->OpCode = OpCode;
+ mHeader->Length = (Length == 0) ? gOpcodeSizesScopeTable[OpCode].mSize : Length;
+ mHeader->Scope = (gOpcodeSizesScopeTable[OpCode].mScope + gScopeCount > 0) ? 1 : 0;
+}
+
+CIfrOpHeader::CIfrOpHeader (
+ IN CIfrOpHeader &OpHdr
+ )
+{
+ mHeader = OpHdr.mHeader;
+}
+
+UINT32 CIfrFormId::FormIdBitMap[EFI_FREE_FORM_ID_BITMAP_SIZE] = {0, };
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/VfrFormPkg.h b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
new file mode 100644
index 000000000..1cea4f0e2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
@@ -0,0 +1,2776 @@
+/** @file
+
+ The definition of CFormPkg's member function
+
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _EFIIFRCLASS_H_
+#define _EFIIFRCLASS_H_
+
+#include "string.h"
+#include "EfiVfr.h"
+#include "VfrError.h"
+#include "VfrUtilityLib.h"
+
+#define NO_QST_REFED "no question refered"
+
+struct PACKAGE_DATA {
+ CHAR8 *Buffer;
+ UINT32 Size;
+};
+
+/*
+ * The functions below are used for flags setting
+ */
+static inline BOOLEAN _FLAGS_ZERO (
+ IN UINT8 &Flags
+ )
+{
+ return Flags == 0;
+}
+
+static inline VOID _FLAG_CLEAR (
+ IN UINT8 &Flags,
+ IN UINT8 Mask
+ )
+{
+ Flags &= (~Mask);
+}
+
+static inline UINT8 _FLAG_TEST_AND_CLEAR (
+ IN UINT8 &Flags,
+ IN UINT8 Mask
+ )
+{
+ UINT8 Ret = Flags & Mask;
+ Flags &= (~Mask);
+ return Ret;
+}
+
+static inline UINT8 _IS_EQUAL (
+ IN UINT8 &Flags,
+ IN UINT8 Value
+ )
+{
+ return Flags == Value;
+}
+
+/*
+ * The definition of CIfrBin
+ */
+typedef enum {
+ PENDING,
+ ASSIGNED
+} ASSIGN_FLAG;
+
+struct SPendingAssign {
+ CHAR8 *mKey; // key ! unique
+ VOID *mAddr;
+ UINT32 mLen;
+ ASSIGN_FLAG mFlag;
+ UINT32 mLineNo;
+ CHAR8 *mMsg;
+ struct SPendingAssign *mNext;
+
+ SPendingAssign (IN CHAR8 *, IN VOID *, IN UINT32, IN UINT32, IN CONST CHAR8 *);
+ ~SPendingAssign ();
+
+ VOID SetAddrAndLen (IN VOID *, IN UINT32);
+ VOID AssignValue (IN VOID *, IN UINT32);
+ CHAR8 * GetKey (VOID);
+
+private:
+ SPendingAssign (IN CONST SPendingAssign&); // Prevent copy-construction
+ SPendingAssign& operator= (IN CONST SPendingAssign&); // Prevent assignment
+};
+
+struct SBufferNode {
+ CHAR8 *mBufferStart;
+ CHAR8 *mBufferEnd;
+ CHAR8 *mBufferFree;
+ struct SBufferNode *mNext;
+};
+
+typedef struct {
+ EFI_GUID *OverrideClassGuid;
+} INPUT_INFO_TO_SYNTAX;
+
+class CFormPkg {
+private:
+ UINT32 mBufferSize;
+ SBufferNode *mBufferNodeQueueHead;
+ SBufferNode *mBufferNodeQueueTail;
+ SBufferNode *mCurrBufferNode;
+
+ SBufferNode *mReadBufferNode;
+ UINT32 mReadBufferOffset;
+
+ UINT32 mPkgLength;
+
+ VOID _WRITE_PKG_LINE (IN FILE *, IN UINT32 , IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
+ VOID _WRITE_PKG_END (IN FILE *, IN UINT32 , IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
+ SBufferNode * GetBinBufferNodeForAddr (IN CHAR8 *);
+ SBufferNode * CreateNewNode ();
+ SBufferNode * GetNodeBefore (IN SBufferNode *);
+ EFI_VFR_RETURN_CODE InsertNodeBefore (IN SBufferNode *, IN SBufferNode *);
+
+private:
+ SPendingAssign *PendingAssignList;
+
+public:
+ CFormPkg (IN UINT32 BufferSize = 4096);
+ ~CFormPkg ();
+
+ CHAR8 * IfrBinBufferGet (IN UINT32);
+ inline UINT32 GetPkgLength (VOID);
+
+ VOID Open ();
+ UINT32 Read (IN CHAR8 *, IN UINT32);
+ VOID Close ();
+
+ EFI_VFR_RETURN_CODE BuildPkgHdr (OUT EFI_HII_PACKAGE_HEADER **);
+ EFI_VFR_RETURN_CODE BuildPkg (IN FILE *, IN PACKAGE_DATA *PkgData = NULL);
+ EFI_VFR_RETURN_CODE BuildPkg (OUT PACKAGE_DATA &);
+ EFI_VFR_RETURN_CODE GenCFile (IN CHAR8 *, IN FILE *, IN PACKAGE_DATA *PkgData = NULL);
+
+private:
+ CFormPkg (IN CONST CFormPkg&); // Prevent copy-construction
+ CFormPkg& operator= (IN CONST CFormPkg&); // Prevent assignment
+
+public:
+ EFI_VFR_RETURN_CODE AssignPending (IN CHAR8 *, IN VOID *, IN UINT32, IN UINT32, IN CONST CHAR8 *Msg = NULL);
+ VOID DoPendingAssign (IN CHAR8 *, IN VOID *, IN UINT32);
+ bool HavePendingUnassigned (VOID);
+ VOID PendingAssignPrintAll (VOID);
+ EFI_VFR_RETURN_CODE DeclarePendingQuestion (
+ IN CVfrVarDataTypeDB &lCVfrVarDataTypeDB,
+ IN CVfrDataStorage &lCVfrDataStorage,
+ IN CVfrQuestionDB &lCVfrQuestionDB,
+ IN EFI_GUID *LocalFormSetGuid,
+ IN UINT32 LineNo,
+ OUT CHAR8 **InsertOpcodeAddr
+ );
+ EFI_VFR_RETURN_CODE AdjustDynamicInsertOpcode (
+ IN CHAR8 *LastFormEndAddr,
+ IN CHAR8 *InsertOpcodeAddr,
+ IN BOOLEAN CreateOpcodeAfterParsingVfr
+ );
+ CHAR8 * GetBufAddrBaseOnOffset (
+ IN UINT32 Offset
+ );
+};
+
+extern CFormPkg gCFormPkg;
+extern CVfrStringDB gCVfrStringDB;
+extern UINT32 gAdjustOpcodeOffset;
+extern BOOLEAN gNeedAdjustOpcode;
+
+struct SIfrRecord {
+ UINT32 mLineNo;
+ CHAR8 *mIfrBinBuf;
+ UINT8 mBinBufLen;
+ UINT32 mOffset;
+ SIfrRecord *mNext;
+
+ SIfrRecord (VOID);
+ ~SIfrRecord (VOID);
+};
+
+
+#define EFI_IFR_RECORDINFO_IDX_INVALUD 0xFFFFFF
+#define EFI_IFR_RECORDINFO_IDX_START 0x0
+#define EFI_HII_MAX_SUPPORT_DEFAULT_TYPE 0x08
+
+struct QuestionDefaultRecord {
+ BOOLEAN mIsDefaultIdExist[EFI_HII_MAX_SUPPORT_DEFAULT_TYPE]; // Record the default id in mAllDefaultIdArray[EFI_HII_MAX_SUPPORT_DEFAULT_TYPE]
+ // whether exists in current question.
+
+ SIfrRecord *mDefaultValueRecord; // Point to the default value record in RecordList which has smallest default Id.
+ // (for checkbox it may be NULL, because the dedault value is always true when the flag is set.)
+
+ BOOLEAN mIsDefaultOpcode; // whether the default value with smallest default id is given by default opcode.
+ // (for oneof and checkbox default info may be given by flag.)
+
+ UINT16 mDefaultNumber; // The default number of this question.
+};
+
+class CIfrRecordInfoDB {
+private:
+ bool mSwitch;
+ UINT32 mRecordCount;
+ SIfrRecord *mIfrRecordListHead;
+ SIfrRecord *mIfrRecordListTail;
+ UINT8 mAllDefaultTypeCount;
+ UINT16 mAllDefaultIdArray[EFI_HII_MAX_SUPPORT_DEFAULT_TYPE];
+
+ SIfrRecord * GetRecordInfoFromIdx (IN UINT32);
+ BOOLEAN CheckQuestionOpCode (IN UINT8);
+ BOOLEAN CheckIdOpCode (IN UINT8);
+ EFI_QUESTION_ID GetOpcodeQuestionId (IN EFI_IFR_OP_HEADER *);
+public:
+ CIfrRecordInfoDB (VOID);
+ ~CIfrRecordInfoDB (VOID);
+
+ inline VOID TurnOn (VOID) {
+ mSwitch = TRUE;
+ }
+
+ inline VOID TurnOff (VOID) {
+ mSwitch = FALSE;
+ }
+
+ SIfrRecord * GetRecordInfoFromOffset (IN UINT32);
+ VOID IfrAdjustOffsetForRecord (VOID);
+ BOOLEAN IfrAdjustDynamicOpcodeInRecords (IN BOOLEAN);
+
+ UINT32 IfrRecordRegister (IN UINT32, IN CHAR8 *, IN UINT8, IN UINT32);
+ VOID IfrRecordInfoUpdate (IN UINT32, IN UINT32, IN CHAR8*, IN UINT8, IN UINT32);
+ VOID IfrRecordOutput (IN FILE *, IN UINT32 LineNo);
+ VOID IfrRecordOutput (OUT PACKAGE_DATA &);
+ EFI_VFR_RETURN_CODE IfrRecordAdjust (VOID);
+ VOID IfrUpdateRecordInfoForDynamicOpcode (IN BOOLEAN);
+ VOID IfrCheckAddDefaultRecord (IN BOOLEAN, IN BOOLEAN);
+ VOID IfrGetDefaultStoreInfo ();
+ VOID IfrCreateDefaultRecord (IN UINT8 Size,IN UINT16 DefaultId,IN UINT8 Type,IN UINT32 LineNo,IN EFI_IFR_TYPE_VALUE Value);
+ VOID IfrCreateDefaultForQuestion (IN SIfrRecord *, IN QuestionDefaultRecord *);
+ VOID IfrParseDefaulInfoInQuestion (IN SIfrRecord *, OUT QuestionDefaultRecord *);
+ VOID IfrAddDefaultToBufferConfig (IN UINT16, IN SIfrRecord *,IN EFI_IFR_TYPE_VALUE);
+
+private:
+ CIfrRecordInfoDB (IN CONST CIfrRecordInfoDB&); // Prevent copy-construction
+ CIfrRecordInfoDB& operator= (IN CONST CIfrRecordInfoDB&); // Prevent assignment
+};
+
+extern CIfrRecordInfoDB gCIfrRecordInfoDB;
+
+/*
+ * The definition of CIfrObj
+ */
+extern BOOLEAN gCreateOp;
+
+class CIfrObj {
+private:
+ BOOLEAN mDelayEmit;
+
+ CHAR8 *mObjBinBuf;
+ UINT8 mObjBinLen;
+ UINT32 mLineNo;
+ UINT32 mRecordIdx;
+ UINT32 mPkgOffset;
+
+public:
+ CIfrObj (IN UINT8 OpCode, OUT CHAR8 **IfrObj = NULL, IN UINT8 ObjBinLen = 0, IN BOOLEAN DelayEmit = FALSE);
+ virtual ~CIfrObj(VOID);
+
+ VOID _EMIT_PENDING_OBJ (VOID);
+
+ inline VOID SetLineNo (IN UINT32 LineNo) {
+ mLineNo = LineNo;
+ }
+
+ template<typename T>
+ inline T * GetObjBinAddr (VOID) {
+ return reinterpret_cast<T *>(mObjBinBuf);
+ }
+
+ inline UINT32 GetObjBinOffset (VOID) {
+ return mPkgOffset;
+ }
+
+ inline UINT8 GetObjBinLen (VOID) {
+ return mObjBinLen;
+ }
+
+ inline bool ExpendObjBin (IN UINT8 Size) {
+ if ((mDelayEmit == TRUE) && ((mObjBinLen + Size) > mObjBinLen)) {
+ mObjBinLen = mObjBinLen + Size;
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ }
+
+ inline bool ShrinkObjBin (IN UINT8 Size) {
+ if ((mDelayEmit == TRUE) && (mObjBinLen > Size)) {
+ mObjBinLen -= Size;
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ }
+};
+
+/*
+ * The definition of CIfrOpHeader
+ */
+class CIfrOpHeader {
+private:
+ EFI_IFR_OP_HEADER *mHeader;
+
+public:
+ CIfrOpHeader (IN UINT8 OpCode, IN VOID *StartAddr, IN UINT8 Length = 0);
+ CIfrOpHeader (IN CIfrOpHeader &);
+ CIfrOpHeader& operator=(IN CONST CIfrOpHeader &);
+
+ VOID IncLength (UINT8 Size) {
+ if ((mHeader->Length + Size) > mHeader->Length) {
+ mHeader->Length = mHeader->Length + Size;
+ }
+ }
+
+ VOID DecLength (UINT8 Size) {
+ if (mHeader->Length >= Size) {
+ mHeader->Length -= Size;
+ }
+ }
+
+ UINT8 GetLength () {
+ return mHeader->Length;
+ }
+
+ UINT8 GetScope () {
+ return mHeader->Scope;
+ }
+
+ VOID SetScope (IN UINT8 Scope) {
+ mHeader->Scope = Scope;
+ }
+
+ VOID UpdateHeader (IN EFI_IFR_OP_HEADER *Header) {
+ mHeader = Header;
+ }
+
+ UINT8 GetOpCode () {
+ return mHeader->OpCode;
+ }
+};
+
+extern UINT8 gScopeCount;
+
+/*
+ * The definition of CIfrStatementHeader
+ */
+class CIfrStatementHeader {
+private:
+ EFI_IFR_STATEMENT_HEADER *mHeader;
+
+public:
+ CIfrStatementHeader (
+ IN EFI_IFR_STATEMENT_HEADER *StartAddr
+ ) : mHeader ((EFI_IFR_STATEMENT_HEADER *)StartAddr) {
+ mHeader = StartAddr;
+ mHeader->Help = EFI_STRING_ID_INVALID;
+ mHeader->Prompt = EFI_STRING_ID_INVALID;
+ }
+
+ EFI_IFR_STATEMENT_HEADER *GetStatementHeader () {
+ return mHeader;
+ }
+
+ VOID SetPrompt (IN EFI_STRING_ID Prompt) {
+ mHeader->Prompt = Prompt;
+ }
+
+ VOID SetHelp (IN EFI_STRING_ID Help) {
+ mHeader->Help = Help;
+ }
+};
+
+/*
+ * The definition of CIfrQuestionHeader
+ */
+#define EFI_IFR_QUESTION_FLAG_DEFAULT 0
+
+class CIfrQuestionHeader : public CIfrStatementHeader {
+private:
+ EFI_IFR_QUESTION_HEADER *mHeader;
+
+ EFI_IFR_STATEMENT_HEADER * QH2SH (EFI_IFR_QUESTION_HEADER *Qheader) {
+ return &(Qheader)->Header;
+ }
+
+public:
+ EFI_QUESTION_ID QUESTION_ID (VOID) {
+ return mHeader->QuestionId;
+ }
+
+ EFI_VARSTORE_ID VARSTORE_ID (VOID) {
+ return mHeader->VarStoreId;
+ }
+
+ VOID VARSTORE_INFO (OUT EFI_VARSTORE_INFO *Info) {
+ if (Info != NULL) {
+ Info->mVarStoreId = mHeader->VarStoreId;
+ memmove (&Info->mVarStoreId, &mHeader->VarStoreInfo, sizeof (Info->mVarStoreId));
+ }
+ }
+
+ UINT8 FLAGS (VOID) {
+ return mHeader->Flags;
+ }
+
+public:
+ CIfrQuestionHeader (
+ IN EFI_IFR_QUESTION_HEADER *StartAddr,
+ IN UINT8 Flags = EFI_IFR_QUESTION_FLAG_DEFAULT
+ ) : CIfrStatementHeader (QH2SH(StartAddr)) {
+ mHeader = StartAddr;
+ mHeader->QuestionId = EFI_QUESTION_ID_INVALID;
+ mHeader->VarStoreId = EFI_VARSTORE_ID_INVALID;
+ mHeader->VarStoreInfo.VarName = EFI_STRING_ID_INVALID;
+ mHeader->VarStoreInfo.VarOffset = EFI_VAROFFSET_INVALID;
+ mHeader->Flags = Flags;
+ }
+
+ VOID SetQuestionId (IN EFI_QUESTION_ID QuestionId) {
+ mHeader->QuestionId = QuestionId;
+ }
+
+ VOID SetVarStoreInfo (IN EFI_VARSTORE_INFO *Info) {
+ mHeader->VarStoreId = Info->mVarStoreId;
+ mHeader->VarStoreInfo.VarName = Info->mInfo.mVarName;
+ mHeader->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;
+ }
+
+ EFI_VFR_RETURN_CODE SetFlags (IN UINT8 Flags) {
+ if (_FLAG_TEST_AND_CLEAR (Flags, EFI_IFR_FLAG_READ_ONLY)) {
+ mHeader->Flags |= EFI_IFR_FLAG_READ_ONLY;
+ }
+
+ _FLAG_CLEAR (Flags, 0x02);
+
+ if (_FLAG_TEST_AND_CLEAR (Flags, EFI_IFR_FLAG_CALLBACK)) {
+ mHeader->Flags |= EFI_IFR_FLAG_CALLBACK;
+ }
+
+ //
+ // ignore NVAccessFlag
+ //
+ _FLAG_CLEAR (Flags, 0x08);
+
+ if (_FLAG_TEST_AND_CLEAR (Flags, EFI_IFR_FLAG_RESET_REQUIRED)) {
+ mHeader->Flags |= EFI_IFR_FLAG_RESET_REQUIRED;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (Flags, EFI_IFR_FLAG_RECONNECT_REQUIRED)) {
+ mHeader->Flags |= EFI_IFR_FLAG_RECONNECT_REQUIRED;
+ }
+
+ //
+ // Set LateCheck Flag to compatible for framework flag
+ // but it uses 0x20 as its flag, if in the future UEFI may take this flag
+ //
+ if (_FLAG_TEST_AND_CLEAR (Flags, 0x20)) {
+ mHeader->Flags |= 0x20;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (Flags, EFI_IFR_FLAG_OPTIONS_ONLY)) {
+ mHeader->Flags |= EFI_IFR_FLAG_OPTIONS_ONLY;
+ }
+
+ return _FLAGS_ZERO (Flags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
+ }
+
+ VOID UpdateCIfrQuestionHeader (IN EFI_IFR_QUESTION_HEADER *Header) {
+ mHeader = Header;
+ }
+};
+
+/*
+ * The definition of CIfrMinMaxStepData
+ */
+class CIfrMinMaxStepData {
+private:
+ MINMAXSTEP_DATA *mMinMaxStepData;
+ BOOLEAN ValueIsSet;
+ BOOLEAN IsNumeric;
+
+public:
+ CIfrMinMaxStepData (MINMAXSTEP_DATA *DataAddr, BOOLEAN NumericOpcode=FALSE) : mMinMaxStepData (DataAddr) {
+ mMinMaxStepData->u64.MinValue = 0;
+ mMinMaxStepData->u64.MaxValue = 0;
+ mMinMaxStepData->u64.Step = 0;
+ ValueIsSet = FALSE;
+ IsNumeric = NumericOpcode;
+ }
+
+ VOID SetMinMaxStepData (IN UINT64 MinValue, IN UINT64 MaxValue, IN UINT64 Step) {
+ if (!ValueIsSet) {
+ mMinMaxStepData->u64.MinValue = MinValue;
+ mMinMaxStepData->u64.MaxValue = MaxValue;
+ ValueIsSet = TRUE;
+ } else {
+ if (MinValue < mMinMaxStepData->u64.MinValue) {
+ mMinMaxStepData->u64.MinValue = MinValue;
+ }
+ if (MaxValue > mMinMaxStepData->u64.MaxValue) {
+ mMinMaxStepData->u64.MaxValue = MaxValue;
+ }
+ }
+ mMinMaxStepData->u64.Step = Step;
+ }
+
+ VOID SetMinMaxStepData (IN UINT32 MinValue, IN UINT32 MaxValue, IN UINT32 Step) {
+ if (!ValueIsSet) {
+ mMinMaxStepData->u32.MinValue = MinValue;
+ mMinMaxStepData->u32.MaxValue = MaxValue;
+ ValueIsSet = TRUE;
+ } else {
+ if (MinValue < mMinMaxStepData->u32.MinValue) {
+ mMinMaxStepData->u32.MinValue = MinValue;
+ }
+ if (MaxValue > mMinMaxStepData->u32.MaxValue) {
+ mMinMaxStepData->u32.MaxValue = MaxValue;
+ }
+ }
+ mMinMaxStepData->u32.Step = Step;
+ }
+
+ VOID SetMinMaxStepData (IN UINT16 MinValue, IN UINT16 MaxValue, IN UINT16 Step) {
+ if (!ValueIsSet) {
+ mMinMaxStepData->u16.MinValue = MinValue;
+ mMinMaxStepData->u16.MaxValue = MaxValue;
+ ValueIsSet = TRUE;
+ } else {
+ if (MinValue < mMinMaxStepData->u16.MinValue) {
+ mMinMaxStepData->u16.MinValue = MinValue;
+ }
+ if (MaxValue > mMinMaxStepData->u16.MaxValue) {
+ mMinMaxStepData->u16.MaxValue = MaxValue;
+ }
+ }
+ mMinMaxStepData->u16.Step = Step;
+ }
+
+ VOID SetMinMaxStepData (IN UINT8 MinValue, IN UINT8 MaxValue, IN UINT8 Step) {
+ if (!ValueIsSet) {
+ mMinMaxStepData->u8.MinValue = MinValue;
+ mMinMaxStepData->u8.MaxValue = MaxValue;
+ ValueIsSet = TRUE;
+ } else {
+ if (MinValue < mMinMaxStepData->u8.MinValue) {
+ mMinMaxStepData->u8.MinValue = MinValue;
+ }
+ if (MaxValue > mMinMaxStepData->u8.MaxValue) {
+ mMinMaxStepData->u8.MaxValue = MaxValue;
+ }
+ }
+ mMinMaxStepData->u8.Step = Step;
+ }
+
+ UINT64 GetMinData (UINT8 VarType, BOOLEAN IsBitVar) {
+ UINT64 MinValue = 0;
+ if (IsBitVar) {
+ MinValue = mMinMaxStepData->u32.MinValue;
+ return MinValue;
+ }
+ switch (VarType) {
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ MinValue = mMinMaxStepData->u64.MinValue;
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ MinValue = (UINT64) mMinMaxStepData->u32.MinValue;
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ MinValue = (UINT64) mMinMaxStepData->u16.MinValue;
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ MinValue = (UINT64) mMinMaxStepData->u8.MinValue;
+ break;
+ default:
+ break;
+ }
+ return MinValue;
+ }
+
+ UINT64 GetMaxData (UINT8 VarType, BOOLEAN IsBitVar) {
+ UINT64 MaxValue = 0;
+ if (IsBitVar) {
+ MaxValue = mMinMaxStepData->u32.MaxValue;
+ return MaxValue;
+ }
+ switch (VarType) {
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ MaxValue = mMinMaxStepData->u64.MaxValue;
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ MaxValue = (UINT64) mMinMaxStepData->u32.MaxValue;
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ MaxValue = (UINT64) mMinMaxStepData->u16.MaxValue;
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ MaxValue = (UINT64) mMinMaxStepData->u8.MaxValue;
+ break;
+ default:
+ break;
+ }
+ return MaxValue;
+ }
+
+ UINT64 GetStepData (UINT8 VarType, BOOLEAN IsBitVar) {
+ UINT64 MaxValue = 0;
+ if (IsBitVar) {
+ MaxValue = mMinMaxStepData->u32.Step;
+ return MaxValue;
+ }
+ switch (VarType) {
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ MaxValue = mMinMaxStepData->u64.Step;
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ MaxValue = (UINT64) mMinMaxStepData->u32.Step;
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ MaxValue = (UINT64) mMinMaxStepData->u16.Step;
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ MaxValue = (UINT64) mMinMaxStepData->u8.Step;
+ break;
+ default:
+ break;
+ }
+ return MaxValue;
+ }
+
+ BOOLEAN IsNumericOpcode () {
+ return IsNumeric;
+ }
+
+ VOID UpdateCIfrMinMaxStepData (IN MINMAXSTEP_DATA *MinMaxStepData) {
+ mMinMaxStepData = MinMaxStepData;
+ }
+};
+
+static CIfrQuestionHeader *gCurrentQuestion = NULL;
+static CIfrMinMaxStepData *gCurrentMinMaxData = NULL;
+static BOOLEAN gIsOrderedList = FALSE;
+static BOOLEAN gIsStringOp = FALSE;
+
+/*
+ * The definition of all of the UEFI IFR Objects
+ */
+class CIfrFormSet : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_FORM_SET *mFormSet;
+ EFI_GUID *mClassGuid;
+
+public:
+ CIfrFormSet (UINT8 Size) : CIfrObj (EFI_IFR_FORM_SET_OP, (CHAR8 **)NULL, Size),
+ CIfrOpHeader (EFI_IFR_FORM_SET_OP, &(GetObjBinAddr<EFI_IFR_FORM_SET>())->Header, Size), mFormSet(GetObjBinAddr<EFI_IFR_FORM_SET>()) {
+ mFormSet->Help = EFI_STRING_ID_INVALID;
+ mFormSet->FormSetTitle = EFI_STRING_ID_INVALID;
+ mFormSet->Flags = 0;
+ memset (&mFormSet->Guid, 0, sizeof (EFI_GUID));
+ mClassGuid = (EFI_GUID *) (mFormSet + 1);
+ }
+
+ VOID SetGuid (IN EFI_GUID *Guid) {
+ memmove (&mFormSet->Guid, Guid, sizeof (EFI_GUID));
+ }
+
+ VOID SetFormSetTitle (IN EFI_STRING_ID FormSetTitle) {
+ mFormSet->FormSetTitle = FormSetTitle;
+ }
+
+ VOID SetHelp (IN EFI_STRING_ID Help) {
+ mFormSet->Help = Help;
+ }
+
+ VOID SetClassGuid (IN EFI_GUID *Guid) {
+ memmove (&(mClassGuid[mFormSet->Flags++]), Guid, sizeof (EFI_GUID));
+ }
+
+ UINT8 GetFlags() {
+ return mFormSet->Flags;
+ }
+};
+
+class CIfrEnd : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrEnd () : CIfrObj (EFI_IFR_END_OP),
+ CIfrOpHeader (EFI_IFR_END_OP, &(GetObjBinAddr<EFI_IFR_END>())->Header) {}
+};
+
+class CIfrDefaultStore : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_DEFAULTSTORE *mDefaultStore;
+
+public:
+ CIfrDefaultStore () : CIfrObj (EFI_IFR_DEFAULTSTORE_OP),
+ CIfrOpHeader (EFI_IFR_DEFAULTSTORE_OP, &(GetObjBinAddr<EFI_IFR_DEFAULTSTORE>())->Header), mDefaultStore(GetObjBinAddr<EFI_IFR_DEFAULTSTORE>()) {
+ mDefaultStore->DefaultId = EFI_VARSTORE_ID_INVALID;
+ mDefaultStore->DefaultName = EFI_STRING_ID_INVALID;
+ }
+
+ VOID SetDefaultName (IN EFI_STRING_ID DefaultName) {
+ mDefaultStore->DefaultName = DefaultName;
+ }
+
+ VOID SetDefaultId (IN UINT16 DefaultId) {
+ mDefaultStore->DefaultId = DefaultId;
+ }
+};
+
+#define EFI_FORM_ID_MAX 0xFFFF
+#define EFI_FREE_FORM_ID_BITMAP_SIZE ((EFI_FORM_ID_MAX + 1) / EFI_BITS_PER_UINT32)
+
+class CIfrFormId {
+public:
+ STATIC UINT32 FormIdBitMap[EFI_FREE_FORM_ID_BITMAP_SIZE];
+
+ STATIC BOOLEAN ChekFormIdFree (IN EFI_FORM_ID FormId) {
+ UINT32 Index = (FormId / EFI_BITS_PER_UINT32);
+ UINT32 Offset = (FormId % EFI_BITS_PER_UINT32);
+
+ return (FormIdBitMap[Index] & (0x80000000 >> Offset)) == 0;
+ }
+
+ STATIC VOID MarkFormIdUsed (IN EFI_FORM_ID FormId) {
+ UINT32 Index = (FormId / EFI_BITS_PER_UINT32);
+ UINT32 Offset = (FormId % EFI_BITS_PER_UINT32);
+
+ FormIdBitMap[Index] |= (0x80000000 >> Offset);
+ }
+};
+
+class CIfrForm : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_FORM *mForm;
+
+public:
+ CIfrForm () : CIfrObj (EFI_IFR_FORM_OP),
+ CIfrOpHeader (EFI_IFR_FORM_OP, &(GetObjBinAddr<EFI_IFR_FORM>())->Header), mForm(GetObjBinAddr<EFI_IFR_FORM>()) {
+ mForm->FormId = 0;
+ mForm->FormTitle = EFI_STRING_ID_INVALID;
+ }
+
+ EFI_VFR_RETURN_CODE SetFormId (IN EFI_FORM_ID FormId) {
+ if (FormId == 0) {
+ //
+ // FormId can't be 0.
+ //
+ return VFR_RETURN_INVALID_PARAMETER;
+ }
+ if (CIfrFormId::ChekFormIdFree (FormId) == FALSE) {
+ return VFR_RETURN_FORMID_REDEFINED;
+ }
+ mForm->FormId = FormId;
+ CIfrFormId::MarkFormIdUsed (FormId);
+ return VFR_RETURN_SUCCESS;
+ }
+
+ VOID SetFormTitle (IN EFI_STRING_ID FormTitle) {
+ mForm->FormTitle = FormTitle;
+ }
+};
+
+class CIfrFormMap : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_FORM_MAP *mFormMap;
+ EFI_IFR_FORM_MAP_METHOD *mMethodMap;
+
+public:
+ CIfrFormMap () : CIfrObj (EFI_IFR_FORM_MAP_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_FORM_MAP), TRUE),
+ CIfrOpHeader (EFI_IFR_FORM_MAP_OP, &(GetObjBinAddr<EFI_IFR_FORM_MAP>())->Header), mFormMap(GetObjBinAddr<EFI_IFR_FORM_MAP>()) {
+ mFormMap->FormId = 0;
+ mMethodMap = (EFI_IFR_FORM_MAP_METHOD *) (mFormMap + 1);
+ }
+
+ EFI_VFR_RETURN_CODE SetFormId (IN EFI_FORM_ID FormId) {
+ if (FormId == 0) {
+ //
+ // FormId can't be 0.
+ //
+ return VFR_RETURN_INVALID_PARAMETER;
+ }
+ if (CIfrFormId::ChekFormIdFree (FormId) == FALSE) {
+ return VFR_RETURN_FORMID_REDEFINED;
+ }
+ mFormMap->FormId = FormId;
+ CIfrFormId::MarkFormIdUsed (FormId);
+ return VFR_RETURN_SUCCESS;
+ }
+
+ VOID SetFormMapMethod (IN EFI_STRING_ID MethodTitle, IN EFI_GUID *MethodGuid) {
+ if (ExpendObjBin (sizeof (EFI_IFR_FORM_MAP_METHOD))) {
+ IncLength (sizeof (EFI_IFR_FORM_MAP_METHOD));
+
+ mMethodMap->MethodTitle = MethodTitle;
+ memmove (&(mMethodMap->MethodIdentifier), MethodGuid, sizeof (EFI_GUID));
+ mMethodMap ++;
+ }
+ }
+};
+
+class CIfrVarStore : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_VARSTORE *mVarStore;
+
+public:
+ CIfrVarStore () : CIfrObj (EFI_IFR_VARSTORE_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_VARSTORE), TRUE),
+ CIfrOpHeader (EFI_IFR_VARSTORE_OP, &(GetObjBinAddr<EFI_IFR_VARSTORE>())->Header), mVarStore(GetObjBinAddr<EFI_IFR_VARSTORE>()) {
+ mVarStore->VarStoreId = EFI_VARSTORE_ID_INVALID;
+ mVarStore->Size = 0;
+ memset (&mVarStore->Guid, 0, sizeof (EFI_GUID));
+ mVarStore->Name[0] = '\0';
+ }
+
+ VOID SetGuid (IN EFI_GUID *Guid) {
+ memmove (&mVarStore->Guid, Guid, sizeof (EFI_GUID));
+ }
+
+ VOID SetVarStoreId (IN EFI_VARSTORE_ID VarStoreId) {
+ mVarStore->VarStoreId = VarStoreId;
+ }
+
+ VOID SetSize (IN UINT16 Size) {
+ mVarStore->Size = Size;
+ }
+
+ VOID SetName (IN CHAR8 *Name) {
+ UINT8 Len;
+
+ if (Name != NULL) {
+ Len = (UINT8) strlen (Name);
+ if (Len != 0) {
+ if (ExpendObjBin (Len) == TRUE) {
+ IncLength (Len);
+ strcpy ((CHAR8 *)(mVarStore->Name), Name);
+ }
+ }
+ }
+ }
+};
+
+class CIfrVarStoreEfi : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_VARSTORE_EFI *mVarStoreEfi;
+
+public:
+ CIfrVarStoreEfi () : CIfrObj (EFI_IFR_VARSTORE_EFI_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_VARSTORE_EFI), TRUE),
+ CIfrOpHeader (EFI_IFR_VARSTORE_EFI_OP, &(GetObjBinAddr<EFI_IFR_VARSTORE_EFI>())->Header), mVarStoreEfi(GetObjBinAddr<EFI_IFR_VARSTORE_EFI>()) {
+ mVarStoreEfi->VarStoreId = EFI_VAROFFSET_INVALID;
+ mVarStoreEfi->Size = 0;
+ memset (&mVarStoreEfi->Guid, 0, sizeof (EFI_GUID));
+ mVarStoreEfi->Name[0] = '\0';
+ }
+
+ VOID SetGuid (IN EFI_GUID *Guid) {
+ memmove (&mVarStoreEfi->Guid, Guid, sizeof (EFI_GUID));
+ }
+
+ VOID SetVarStoreId (IN UINT16 VarStoreId) {
+ mVarStoreEfi->VarStoreId = VarStoreId;
+ }
+
+ VOID SetAttributes (IN UINT32 Attributes) {
+ mVarStoreEfi->Attributes = Attributes;
+ }
+ VOID SetSize (IN UINT16 Size) {
+ mVarStoreEfi->Size = Size;
+ }
+
+ VOID SetName (IN CHAR8 *Name) {
+ UINT8 Len;
+
+ if (Name != NULL) {
+ Len = (UINT8) strlen (Name);
+ if (Len != 0) {
+ if (ExpendObjBin (Len) == TRUE) {
+ IncLength (Len);
+ strcpy ((CHAR8 *)(mVarStoreEfi->Name), Name);
+ }
+ }
+ }
+ }
+
+ VOID SetBinaryLength (IN UINT16 Size) {
+ UINT16 Len;
+
+ Len = sizeof (EFI_IFR_VARSTORE_EFI);
+ if (Size > Len) {
+ ExpendObjBin(Size - Len);
+ IncLength(Size - Len);
+ } else {
+ ShrinkObjBin(Len - Size);
+ DecLength(Len - Size);
+ }
+ }
+};
+
+class CIfrVarStoreNameValue : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_VARSTORE_NAME_VALUE *mVarStoreNameValue;
+
+public:
+ CIfrVarStoreNameValue () : CIfrObj (EFI_IFR_VARSTORE_NAME_VALUE_OP),
+ CIfrOpHeader (EFI_IFR_VARSTORE_NAME_VALUE_OP, &(GetObjBinAddr<EFI_IFR_VARSTORE_NAME_VALUE>())->Header), mVarStoreNameValue(GetObjBinAddr<EFI_IFR_VARSTORE_NAME_VALUE>()) {
+ mVarStoreNameValue->VarStoreId = EFI_VAROFFSET_INVALID;
+ memset (&mVarStoreNameValue->Guid, 0, sizeof (EFI_GUID));
+ }
+
+ VOID SetGuid (IN EFI_GUID *Guid) {
+ memmove (&mVarStoreNameValue->Guid, Guid, sizeof (EFI_GUID));
+ }
+
+ VOID SetVarStoreId (IN UINT16 VarStoreId) {
+ mVarStoreNameValue->VarStoreId = VarStoreId;
+ }
+};
+
+class CIfrImage : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_IMAGE *mImage;
+
+public:
+ CIfrImage () : CIfrObj (EFI_IFR_IMAGE_OP),
+ CIfrOpHeader (EFI_IFR_IMAGE_OP, &(GetObjBinAddr<EFI_IFR_IMAGE>())->Header), mImage(GetObjBinAddr<EFI_IFR_IMAGE>()) {
+ mImage->Id = EFI_IMAGE_ID_INVALID;
+ }
+
+ VOID SetImageId (IN EFI_IMAGE_ID ImageId) {
+ mImage->Id = ImageId;
+ }
+};
+
+class CIfrModal : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrModal () : CIfrObj (EFI_IFR_MODAL_TAG_OP),
+ CIfrOpHeader (EFI_IFR_MODAL_TAG_OP, &(GetObjBinAddr<EFI_IFR_MODAL_TAG>())->Header) {
+ }
+};
+
+
+class CIfrLocked : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrLocked () : CIfrObj (EFI_IFR_LOCKED_OP),
+ CIfrOpHeader (EFI_IFR_LOCKED_OP, &(GetObjBinAddr<EFI_IFR_LOCKED>())->Header) {}
+};
+
+class CIfrRule : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_RULE *mRule;
+
+public:
+ CIfrRule () : CIfrObj (EFI_IFR_RULE_OP),
+ CIfrOpHeader (EFI_IFR_RULE_OP, &(GetObjBinAddr<EFI_IFR_RULE>())->Header), mRule(GetObjBinAddr<EFI_IFR_RULE>()) {
+ mRule->RuleId = EFI_RULE_ID_INVALID;
+ }
+
+ VOID SetRuleId (IN UINT8 RuleId) {
+ mRule->RuleId = RuleId;
+ }
+};
+
+static EFI_IFR_TYPE_VALUE gZeroEfiIfrTypeValue = {0, };
+
+class CIfrDefault : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_DEFAULT *mDefault;
+
+public:
+ CIfrDefault (
+ IN UINT8 Size,
+ IN UINT16 DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD,
+ IN UINT8 Type = EFI_IFR_TYPE_OTHER,
+ IN EFI_IFR_TYPE_VALUE Value = gZeroEfiIfrTypeValue
+ ) : CIfrObj (EFI_IFR_DEFAULT_OP, (CHAR8 **)NULL, Size),
+ CIfrOpHeader (EFI_IFR_DEFAULT_OP, &(GetObjBinAddr<EFI_IFR_DEFAULT>())->Header, Size), mDefault(GetObjBinAddr<EFI_IFR_DEFAULT>()) {
+ mDefault->Type = Type;
+ mDefault->DefaultId = DefaultId;
+ memmove (&(mDefault->Value), &Value, Size - OFFSET_OF (EFI_IFR_DEFAULT, Value));
+ }
+
+ VOID SetDefaultId (IN UINT16 DefaultId) {
+ mDefault->DefaultId = DefaultId;
+ }
+
+ VOID SetType (IN UINT8 Type) {
+ mDefault->Type = Type;
+ }
+
+ VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
+ memmove (&mDefault->Value, &Value, mDefault->Header.Length - OFFSET_OF (EFI_IFR_DEFAULT, Value));
+ }
+};
+
+class CIfrDefault2 : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_DEFAULT_2 *mDefault;
+
+public:
+ CIfrDefault2 (
+ IN UINT16 DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD,
+ IN UINT8 Type = EFI_IFR_TYPE_OTHER
+ ) : CIfrObj (EFI_IFR_DEFAULT_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_DEFAULT_2)),
+ CIfrOpHeader (EFI_IFR_DEFAULT_OP, &(GetObjBinAddr<EFI_IFR_DEFAULT_2>())->Header, sizeof (EFI_IFR_DEFAULT_2)), mDefault(GetObjBinAddr<EFI_IFR_DEFAULT_2>()) {
+ mDefault->Type = Type;
+ mDefault->DefaultId = DefaultId;
+ }
+
+ VOID SetDefaultId (IN UINT16 DefaultId) {
+ mDefault->DefaultId = DefaultId;
+ }
+
+ VOID SetType (IN UINT8 Type) {
+ mDefault->Type = Type;
+ }
+};
+
+class CIfrValue : public CIfrObj, public CIfrOpHeader{
+public:
+ CIfrValue () : CIfrObj (EFI_IFR_VALUE_OP),
+ CIfrOpHeader (EFI_IFR_VALUE_OP, &(GetObjBinAddr<EFI_IFR_VALUE>())->Header) {}
+
+};
+
+class CIfrRead : public CIfrObj, public CIfrOpHeader{
+public:
+ CIfrRead () : CIfrObj (EFI_IFR_READ_OP),
+ CIfrOpHeader (EFI_IFR_READ_OP, &(GetObjBinAddr<EFI_IFR_READ>())->Header) {}
+
+};
+
+class CIfrWrite : public CIfrObj, public CIfrOpHeader{
+public:
+ CIfrWrite () : CIfrObj (EFI_IFR_WRITE_OP),
+ CIfrOpHeader (EFI_IFR_WRITE_OP, &(GetObjBinAddr<EFI_IFR_WRITE>())->Header) {}
+
+};
+
+class CIfrGet : public CIfrObj, public CIfrOpHeader{
+private:
+ EFI_IFR_GET *mGet;
+
+public:
+ CIfrGet (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_GET_OP),
+ CIfrOpHeader (EFI_IFR_GET_OP, &(GetObjBinAddr<EFI_IFR_GET>())->Header), mGet(GetObjBinAddr<EFI_IFR_GET>()) {
+ SetLineNo (LineNo);
+ }
+
+ VOID SetVarInfo (IN EFI_VARSTORE_INFO *Info) {
+ mGet->VarStoreId = Info->mVarStoreId;
+ mGet->VarStoreInfo.VarName = Info->mInfo.mVarName;
+ mGet->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;
+ mGet->VarStoreType = Info->mVarType;
+ }
+};
+
+class CIfrSet : public CIfrObj, public CIfrOpHeader{
+private:
+ EFI_IFR_SET *mSet;
+
+public:
+ CIfrSet (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_SET_OP),
+ CIfrOpHeader (EFI_IFR_SET_OP, &(GetObjBinAddr<EFI_IFR_SET>())->Header), mSet(GetObjBinAddr<EFI_IFR_SET>()) {
+ SetLineNo (LineNo);
+ }
+
+ VOID SetVarInfo (IN EFI_VARSTORE_INFO *Info) {
+ mSet->VarStoreId = Info->mVarStoreId;
+ mSet->VarStoreInfo.VarName = Info->mInfo.mVarName;
+ mSet->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;
+ mSet->VarStoreType = Info->mVarType;
+ }
+};
+
+class CIfrSubtitle : public CIfrObj, public CIfrOpHeader, public CIfrStatementHeader {
+private:
+ EFI_IFR_SUBTITLE *mSubtitle;
+
+public:
+ CIfrSubtitle () : CIfrObj (EFI_IFR_SUBTITLE_OP),
+ CIfrOpHeader (EFI_IFR_SUBTITLE_OP, &(GetObjBinAddr<EFI_IFR_SUBTITLE>())->Header),
+ CIfrStatementHeader (&(GetObjBinAddr<EFI_IFR_SUBTITLE>())->Statement), mSubtitle(GetObjBinAddr<EFI_IFR_SUBTITLE>()) {
+ mSubtitle->Flags = 0;
+ }
+
+ EFI_VFR_RETURN_CODE SetFlags (IN UINT8 LFlags) {
+ if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_FLAGS_HORIZONTAL)) {
+ mSubtitle->Flags |= EFI_IFR_FLAGS_HORIZONTAL;
+ }
+
+ return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
+ }
+};
+
+class CIfrText : public CIfrObj, public CIfrOpHeader, public CIfrStatementHeader {
+private:
+ EFI_IFR_TEXT *mText;
+
+public:
+ CIfrText () : CIfrObj (EFI_IFR_TEXT_OP),
+ CIfrOpHeader (EFI_IFR_TEXT_OP, &(GetObjBinAddr<EFI_IFR_TEXT>())->Header),
+ CIfrStatementHeader (&(GetObjBinAddr<EFI_IFR_TEXT>())->Statement), mText(GetObjBinAddr<EFI_IFR_TEXT>()) {
+ mText->TextTwo = EFI_STRING_ID_INVALID;
+ }
+
+ VOID SetTextTwo (IN EFI_STRING_ID StringId) {
+ mText->TextTwo = StringId;
+ }
+};
+
+class CIfrRef : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
+private:
+ EFI_IFR_REF *mRef;
+
+public:
+ CIfrRef () : CIfrObj (EFI_IFR_REF_OP),
+ CIfrOpHeader (EFI_IFR_REF_OP, &(GetObjBinAddr<EFI_IFR_REF>())->Header),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_REF>())->Question), mRef(GetObjBinAddr<EFI_IFR_REF>()) {
+ mRef->FormId = 0;
+ }
+
+ VOID SetFormId (IN EFI_FORM_ID FormId) {
+ mRef->FormId = FormId;
+ }
+};
+
+class CIfrRef2 : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
+private:
+ EFI_IFR_REF2 *mRef2;
+
+public:
+ CIfrRef2 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_REF2)),
+ CIfrOpHeader (EFI_IFR_REF_OP, &(GetObjBinAddr<EFI_IFR_REF2>())->Header, sizeof (EFI_IFR_REF2)),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_REF2>())->Question), mRef2(GetObjBinAddr<EFI_IFR_REF2>()) {
+ mRef2->FormId = 0;
+ mRef2->QuestionId = EFI_QUESTION_ID_INVALID;
+ }
+
+ VOID SetFormId (IN EFI_FORM_ID FormId) {
+ mRef2->FormId = FormId;
+ }
+
+ VOID SetQuestionId (IN EFI_QUESTION_ID QuestionId) {
+ mRef2->QuestionId = QuestionId;
+ }
+};
+
+class CIfrRef3 : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
+private:
+ EFI_IFR_REF3 *mRef3;
+
+public:
+ CIfrRef3 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)NULL, sizeof(EFI_IFR_REF3)),
+ CIfrOpHeader (EFI_IFR_REF_OP, &(GetObjBinAddr<EFI_IFR_REF3>())->Header, sizeof (EFI_IFR_REF3)),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_REF3>())->Question), mRef3(GetObjBinAddr<EFI_IFR_REF3>()) {
+ mRef3->FormId = 0;
+ mRef3->QuestionId = EFI_QUESTION_ID_INVALID;
+ memset (&mRef3->FormSetId, 0, sizeof (EFI_GUID));
+ }
+
+ VOID SetFormId (IN EFI_FORM_ID FormId) {
+ mRef3->FormId = FormId;
+ }
+
+ VOID SetQuestionId (IN EFI_QUESTION_ID QuestionId) {
+ mRef3->QuestionId = QuestionId;
+ }
+
+ VOID SetFormSetId (IN EFI_GUID FormSetId) {
+ mRef3->FormSetId = FormSetId;
+ }
+};
+
+class CIfrRef4 : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
+private:
+ EFI_IFR_REF4 *mRef4;
+
+public:
+ CIfrRef4 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)NULL, sizeof(EFI_IFR_REF4)),
+ CIfrOpHeader (EFI_IFR_REF_OP, &(GetObjBinAddr<EFI_IFR_REF4>())->Header, sizeof(EFI_IFR_REF4)),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_REF4>())->Question), mRef4(GetObjBinAddr<EFI_IFR_REF4>()) {
+ mRef4->FormId = 0;
+ mRef4->QuestionId = EFI_QUESTION_ID_INVALID;
+ memset (&mRef4->FormSetId, 0, sizeof (EFI_GUID));
+ mRef4->DevicePath = EFI_STRING_ID_INVALID;
+ }
+
+ VOID SetFormId (IN EFI_FORM_ID FormId) {
+ mRef4->FormId = FormId;
+ }
+
+ VOID SetQuestionId (IN EFI_QUESTION_ID QuestionId) {
+ mRef4->QuestionId = QuestionId;
+ }
+
+ VOID SetFormSetId (IN EFI_GUID FormSetId) {
+ mRef4->FormSetId = FormSetId;
+ }
+
+ VOID SetDevicePath (IN EFI_STRING_ID DevicePath) {
+ mRef4->DevicePath = DevicePath;
+ }
+};
+
+class CIfrRef5 : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
+public:
+ CIfrRef5 () : CIfrObj (EFI_IFR_REF_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_REF5)),
+ CIfrOpHeader (EFI_IFR_REF_OP, &(GetObjBinAddr<EFI_IFR_REF5>())->Header, sizeof (EFI_IFR_REF5)),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_REF5>())->Question) {
+ }
+};
+
+class CIfrResetButton : public CIfrObj, public CIfrOpHeader, public CIfrStatementHeader {
+private:
+ EFI_IFR_RESET_BUTTON *mResetButton;
+
+public:
+ CIfrResetButton () : CIfrObj (EFI_IFR_RESET_BUTTON_OP),
+ CIfrOpHeader (EFI_IFR_RESET_BUTTON_OP, &(GetObjBinAddr<EFI_IFR_RESET_BUTTON>())->Header),
+ CIfrStatementHeader (&(GetObjBinAddr<EFI_IFR_RESET_BUTTON>())->Statement), mResetButton(GetObjBinAddr<EFI_IFR_RESET_BUTTON>()) {
+ mResetButton->DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
+ }
+
+ VOID SetDefaultId (IN UINT16 DefaultId) {
+ mResetButton->DefaultId = DefaultId;
+ }
+};
+
+class CIfrCheckBox : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
+private:
+ EFI_IFR_CHECKBOX *mCheckBox;
+
+public:
+ CIfrCheckBox () : CIfrObj (EFI_IFR_CHECKBOX_OP),
+ CIfrOpHeader (EFI_IFR_CHECKBOX_OP, &(GetObjBinAddr<EFI_IFR_CHECKBOX>())->Header),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_CHECKBOX>())->Question), mCheckBox(GetObjBinAddr<EFI_IFR_CHECKBOX>()) {
+ mCheckBox->Flags = 0;
+ gCurrentQuestion = this;
+ }
+
+ ~CIfrCheckBox () {
+ gCurrentQuestion = NULL;
+ }
+
+ EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, UINT8 LFlags) {
+ EFI_VFR_RETURN_CODE Ret;
+
+ Ret = CIfrQuestionHeader::SetFlags (HFlags);
+ if (Ret != VFR_RETURN_SUCCESS) {
+ return Ret;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_CHECKBOX_DEFAULT)) {
+ mCheckBox->Flags |= EFI_IFR_CHECKBOX_DEFAULT;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_CHECKBOX_DEFAULT_MFG)) {
+ mCheckBox->Flags |= EFI_IFR_CHECKBOX_DEFAULT_MFG;
+ }
+
+ return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
+ }
+
+ UINT8 GetFlags (VOID) {
+ return mCheckBox->Flags;
+ }
+};
+
+class CIfrAction : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
+private:
+ EFI_IFR_ACTION *mAction;
+
+public:
+ CIfrAction () : CIfrObj (EFI_IFR_ACTION_OP),
+ CIfrOpHeader (EFI_IFR_ACTION_OP, &(GetObjBinAddr<EFI_IFR_ACTION>())->Header),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_ACTION>())->Question), mAction(GetObjBinAddr<EFI_IFR_ACTION>()) {
+ mAction->QuestionConfig = EFI_STRING_ID_INVALID;
+ }
+
+ VOID SetQuestionConfig (IN EFI_STRING_ID QuestionConfig) {
+ mAction->QuestionConfig = QuestionConfig;
+ }
+};
+
+class CIfrDate : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
+private:
+ EFI_IFR_DATE *mDate;
+
+public:
+ CIfrDate () : CIfrObj (EFI_IFR_DATE_OP),
+ CIfrOpHeader (EFI_IFR_DATE_OP, &(GetObjBinAddr<EFI_IFR_DATE>())->Header),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_DATE>())->Question), mDate(GetObjBinAddr<EFI_IFR_DATE>()) {
+ mDate->Flags = 0;
+ }
+
+ EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
+ EFI_VFR_RETURN_CODE Ret;
+
+ Ret = CIfrQuestionHeader::SetFlags (HFlags);
+ if (Ret != VFR_RETURN_SUCCESS) {
+ return Ret;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_QF_DATE_YEAR_SUPPRESS)) {
+ mDate->Flags |= EFI_QF_DATE_YEAR_SUPPRESS;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_QF_DATE_MONTH_SUPPRESS)) {
+ mDate->Flags |= EFI_QF_DATE_MONTH_SUPPRESS;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_QF_DATE_DAY_SUPPRESS)) {
+ mDate->Flags |= EFI_QF_DATE_DAY_SUPPRESS;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, QF_DATE_STORAGE_NORMAL)) {
+ mDate->Flags |= QF_DATE_STORAGE_NORMAL;
+ } else if (_FLAG_TEST_AND_CLEAR (LFlags, QF_DATE_STORAGE_TIME)) {
+ mDate->Flags |= QF_DATE_STORAGE_TIME;
+ } else if (_FLAG_TEST_AND_CLEAR (LFlags, QF_DATE_STORAGE_WAKEUP)) {
+ mDate->Flags |= QF_DATE_STORAGE_WAKEUP;
+ }
+
+ return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
+ }
+};
+
+class CIfrNumeric : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader, public CIfrMinMaxStepData {
+private:
+ EFI_IFR_NUMERIC *mNumeric;
+
+public:
+ CIfrNumeric () : CIfrObj (EFI_IFR_NUMERIC_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_NUMERIC), TRUE),
+ CIfrOpHeader (EFI_IFR_NUMERIC_OP, &(GetObjBinAddr<EFI_IFR_NUMERIC>())->Header),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_NUMERIC>())->Question),
+ CIfrMinMaxStepData (&(GetObjBinAddr<EFI_IFR_NUMERIC>())->data, TRUE), mNumeric(GetObjBinAddr<EFI_IFR_NUMERIC>()) {
+ mNumeric->Flags = EFI_IFR_NUMERIC_SIZE_1 | EFI_IFR_DISPLAY_UINT_DEC;
+ gCurrentQuestion = this;
+ gCurrentMinMaxData = this;
+ }
+
+ ~CIfrNumeric () {
+ gCurrentQuestion = NULL;
+ gCurrentMinMaxData = NULL;
+ }
+
+ VOID ShrinkBinSize (IN UINT16 Size) {
+ //
+ // Update the buffer size which is truly be used later.
+ //
+ ShrinkObjBin(Size);
+ DecLength(Size);
+
+ //
+ // Allocate buffer in gCFormPkg.
+ //
+ _EMIT_PENDING_OBJ();
+
+ //
+ // Update the buffer pointer used by other class.
+ //
+ mNumeric = GetObjBinAddr<EFI_IFR_NUMERIC>();
+ UpdateHeader (&mNumeric->Header);
+ UpdateCIfrQuestionHeader(&mNumeric->Question);
+ UpdateCIfrMinMaxStepData(&mNumeric->data);
+ }
+
+ EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags, BOOLEAN DisplaySettingsSpecified = FALSE) {
+ EFI_VFR_RETURN_CODE Ret;
+
+ Ret = CIfrQuestionHeader::SetFlags (HFlags);
+ if (Ret != VFR_RETURN_SUCCESS) {
+ return Ret;
+ }
+
+ if (DisplaySettingsSpecified == FALSE) {
+ mNumeric->Flags = LFlags | EFI_IFR_DISPLAY_UINT_DEC;
+ } else {
+ mNumeric->Flags = LFlags;
+ }
+ return VFR_RETURN_SUCCESS;
+ }
+
+ EFI_VFR_RETURN_CODE SetFlagsForBitField (IN UINT8 HFlags, IN UINT8 LFlags, BOOLEAN DisplaySettingsSpecified = FALSE) {
+ EFI_VFR_RETURN_CODE Ret;
+
+ Ret = CIfrQuestionHeader::SetFlags (HFlags);
+ if (Ret != VFR_RETURN_SUCCESS) {
+ return Ret;
+ }
+
+ if (DisplaySettingsSpecified == FALSE) {
+ mNumeric->Flags = LFlags | EDKII_IFR_DISPLAY_UINT_DEC_BIT;
+ } else {
+ mNumeric->Flags = LFlags;
+ }
+ return VFR_RETURN_SUCCESS;
+ }
+
+ UINT8 GetNumericFlags () {
+ return mNumeric->Flags;
+ }
+};
+
+class CIfrOneOf : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader, public CIfrMinMaxStepData {
+private:
+ EFI_IFR_ONE_OF *mOneOf;
+
+public:
+ CIfrOneOf () : CIfrObj (EFI_IFR_ONE_OF_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_ONE_OF), TRUE),
+ CIfrOpHeader (EFI_IFR_ONE_OF_OP, &(GetObjBinAddr<EFI_IFR_ONE_OF>())->Header),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_ONE_OF>())->Question),
+ CIfrMinMaxStepData (&(GetObjBinAddr<EFI_IFR_ONE_OF>())->data), mOneOf(GetObjBinAddr<EFI_IFR_ONE_OF>()) {
+ mOneOf->Flags = 0;
+ gCurrentQuestion = this;
+ gCurrentMinMaxData = this;
+ }
+
+ ~CIfrOneOf () {
+ gCurrentQuestion = NULL;
+ gCurrentMinMaxData = NULL;
+ }
+
+ EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
+ EFI_VFR_RETURN_CODE Ret;
+
+ Ret = CIfrQuestionHeader::SetFlags (HFlags);
+ if (Ret != VFR_RETURN_SUCCESS) {
+ return Ret;
+ }
+
+ if (LFlags & EFI_IFR_DISPLAY) {
+ mOneOf->Flags = LFlags;
+ } else {
+ mOneOf->Flags = LFlags | EFI_IFR_DISPLAY_UINT_DEC;
+ }
+ return VFR_RETURN_SUCCESS;
+ }
+
+ EFI_VFR_RETURN_CODE SetFlagsForBitField (IN UINT8 HFlags, IN UINT8 LFlags) {
+ EFI_VFR_RETURN_CODE Ret;
+
+ Ret = CIfrQuestionHeader::SetFlags (HFlags);
+ if (Ret != VFR_RETURN_SUCCESS) {
+ return Ret;
+ }
+
+ if (LFlags & EFI_IFR_DISPLAY) {
+ mOneOf->Flags = LFlags;
+ } else {
+ mOneOf->Flags = LFlags | EDKII_IFR_DISPLAY_UINT_DEC_BIT;
+ }
+ return VFR_RETURN_SUCCESS;
+ }
+
+ VOID ShrinkBinSize (IN UINT16 Size) {
+ //
+ // Update the buffer size which is truly be used later.
+ //
+ ShrinkObjBin(Size);
+ DecLength(Size);
+
+ //
+ // Allocate buffer in gCFormPkg.
+ //
+ _EMIT_PENDING_OBJ();
+
+ //
+ // Update the buffer pointer used by other class.
+ //
+ mOneOf = GetObjBinAddr<EFI_IFR_ONE_OF>();
+ UpdateHeader (&mOneOf->Header);
+ UpdateCIfrQuestionHeader(&mOneOf->Question);
+ UpdateCIfrMinMaxStepData(&mOneOf->data);
+ }
+};
+
+class CIfrString : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
+private:
+ EFI_IFR_STRING *mString;
+
+public:
+ CIfrString () : CIfrObj (EFI_IFR_STRING_OP),
+ CIfrOpHeader (EFI_IFR_STRING_OP, &(GetObjBinAddr<EFI_IFR_STRING>())->Header),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_STRING>())->Question), mString(GetObjBinAddr<EFI_IFR_STRING>()) {
+ mString->Flags = 0;
+ mString->MinSize = 0;
+ mString->MaxSize = 0;
+ gCurrentQuestion = this;
+ }
+
+ ~CIfrString () {
+ gCurrentQuestion = NULL;
+ }
+
+ EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
+ EFI_VFR_RETURN_CODE Ret;
+
+ Ret = CIfrQuestionHeader::SetFlags (HFlags);
+ if (Ret != VFR_RETURN_SUCCESS) {
+ return Ret;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_STRING_MULTI_LINE)) {
+ mString->Flags |= EFI_IFR_STRING_MULTI_LINE;
+ }
+
+ return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
+ }
+
+ VOID SetMinSize (IN UINT8 Flags) {
+ mString->MinSize = Flags;
+ }
+
+ VOID SetMaxSize (IN UINT8 MaxSize) {
+ mString->MaxSize = MaxSize;
+ }
+};
+
+class CIfrPassword : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
+private:
+ EFI_IFR_PASSWORD *mPassword;
+
+public:
+ CIfrPassword () : CIfrObj (EFI_IFR_PASSWORD_OP),
+ CIfrOpHeader (EFI_IFR_PASSWORD_OP, &(GetObjBinAddr<EFI_IFR_PASSWORD>())->Header),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_PASSWORD>())->Question), mPassword(GetObjBinAddr<EFI_IFR_PASSWORD>()) {
+ mPassword->MinSize = 0;
+ mPassword->MaxSize = 0;
+ gCurrentQuestion = this;
+ }
+
+ ~CIfrPassword () {
+ gCurrentQuestion = NULL;
+ }
+
+ VOID SetMinSize (IN UINT16 MinSize) {
+ mPassword->MinSize = MinSize;
+ }
+
+ VOID SetMaxSize (IN UINT16 MaxSize) {
+ mPassword->MaxSize = MaxSize;
+ }
+};
+
+class CIfrOrderedList : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
+private:
+ EFI_IFR_ORDERED_LIST *mOrderedList;
+
+public:
+ CIfrOrderedList () : CIfrObj (EFI_IFR_ORDERED_LIST_OP),
+ CIfrOpHeader (EFI_IFR_ORDERED_LIST_OP, &(GetObjBinAddr<EFI_IFR_ORDERED_LIST>())->Header),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_ORDERED_LIST>())->Question), mOrderedList(GetObjBinAddr<EFI_IFR_ORDERED_LIST>()) {
+ mOrderedList->MaxContainers = 0;
+ mOrderedList->Flags = 0;
+ gCurrentQuestion = this;
+ }
+
+ ~CIfrOrderedList () {
+ gCurrentQuestion = NULL;
+ }
+
+ VOID SetMaxContainers (IN UINT8 MaxContainers) {
+ mOrderedList->MaxContainers = MaxContainers;
+ }
+
+ EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
+ EFI_VFR_RETURN_CODE Ret;
+
+ Ret = CIfrQuestionHeader::SetFlags (HFlags);
+ if (Ret != VFR_RETURN_SUCCESS) {
+ return Ret;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_UNIQUE_SET)) {
+ mOrderedList->Flags |= EFI_IFR_UNIQUE_SET;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_NO_EMPTY_SET)) {
+ mOrderedList->Flags |= EFI_IFR_NO_EMPTY_SET;
+ }
+
+ return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
+ }
+};
+
+class CIfrTime : public CIfrObj, public CIfrOpHeader, public CIfrQuestionHeader {
+private:
+ EFI_IFR_TIME *mTime;
+
+public:
+ CIfrTime () : CIfrObj (EFI_IFR_TIME_OP),
+ CIfrOpHeader (EFI_IFR_TIME_OP, &(GetObjBinAddr<EFI_IFR_TIME>())->Header),
+ CIfrQuestionHeader (&(GetObjBinAddr<EFI_IFR_TIME>())->Question), mTime(GetObjBinAddr<EFI_IFR_TIME>()) {
+ mTime->Flags = 0;
+ }
+
+ EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
+ EFI_VFR_RETURN_CODE Ret;
+
+ Ret = CIfrQuestionHeader::SetFlags (HFlags);
+ if (Ret != VFR_RETURN_SUCCESS) {
+ return Ret;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_HOUR_SUPPRESS)) {
+ mTime->Flags |= QF_TIME_HOUR_SUPPRESS;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_MINUTE_SUPPRESS)) {
+ mTime->Flags |= QF_TIME_MINUTE_SUPPRESS;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_SECOND_SUPPRESS)) {
+ mTime->Flags |= QF_TIME_SECOND_SUPPRESS;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_STORAGE_NORMAL)) {
+ mTime->Flags |= QF_TIME_STORAGE_NORMAL;
+ } else if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_STORAGE_TIME)) {
+ mTime->Flags |= QF_TIME_STORAGE_TIME;
+ } else if (_FLAG_TEST_AND_CLEAR (LFlags, QF_TIME_STORAGE_WAKEUP)) {
+ mTime->Flags |= QF_TIME_STORAGE_WAKEUP;
+ }
+
+ return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
+ }
+};
+
+class CIfrDisableIf : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrDisableIf () : CIfrObj (EFI_IFR_DISABLE_IF_OP),
+ CIfrOpHeader (EFI_IFR_DISABLE_IF_OP, &(GetObjBinAddr<EFI_IFR_DISABLE_IF>())->Header) {}
+};
+
+class CIfrSuppressIf : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrSuppressIf () : CIfrObj (EFI_IFR_SUPPRESS_IF_OP),
+ CIfrOpHeader (EFI_IFR_SUPPRESS_IF_OP, &(GetObjBinAddr<EFI_IFR_SUPPRESS_IF>())->Header) {}
+};
+
+class CIfrGrayOutIf : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrGrayOutIf () : CIfrObj (EFI_IFR_GRAY_OUT_IF_OP),
+ CIfrOpHeader (EFI_IFR_GRAY_OUT_IF_OP, &(GetObjBinAddr<EFI_IFR_GRAY_OUT_IF>())->Header) {}
+};
+
+class CIfrInconsistentIf : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_INCONSISTENT_IF *mInconsistentIf;
+
+public:
+ CIfrInconsistentIf () : CIfrObj (EFI_IFR_INCONSISTENT_IF_OP),
+ CIfrOpHeader (EFI_IFR_INCONSISTENT_IF_OP, &(GetObjBinAddr<EFI_IFR_INCONSISTENT_IF>())->Header), mInconsistentIf(GetObjBinAddr<EFI_IFR_INCONSISTENT_IF>()) {
+ mInconsistentIf->Error = EFI_STRING_ID_INVALID;
+ }
+
+ VOID SetError (IN EFI_STRING_ID Error) {
+ mInconsistentIf->Error = Error;
+ }
+};
+
+class CIfrWarningIf : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_WARNING_IF *mWarningIf;
+
+public:
+ CIfrWarningIf () : CIfrObj (EFI_IFR_WARNING_IF_OP),
+ CIfrOpHeader (EFI_IFR_WARNING_IF_OP, &(GetObjBinAddr<EFI_IFR_WARNING_IF>())->Header), mWarningIf(GetObjBinAddr<EFI_IFR_WARNING_IF>()) {
+ mWarningIf->Warning = EFI_STRING_ID_INVALID;
+ mWarningIf->TimeOut = 0;
+ }
+
+ VOID SetWarning (IN EFI_STRING_ID Warning) {
+ mWarningIf->Warning = Warning;
+ }
+
+ VOID SetTimeOut (IN UINT8 TimeOut) {
+ mWarningIf->TimeOut = TimeOut;
+ }
+};
+
+class CIfrNoSubmitIf : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_NO_SUBMIT_IF *mNoSubmitIf;
+
+public:
+ CIfrNoSubmitIf () : CIfrObj (EFI_IFR_NO_SUBMIT_IF_OP),
+ CIfrOpHeader (EFI_IFR_NO_SUBMIT_IF_OP, &(GetObjBinAddr<EFI_IFR_NO_SUBMIT_IF>())->Header), mNoSubmitIf(GetObjBinAddr<EFI_IFR_NO_SUBMIT_IF>()) {
+ mNoSubmitIf->Error = EFI_STRING_ID_INVALID;
+ }
+
+ VOID SetError (IN EFI_STRING_ID Error) {
+ mNoSubmitIf->Error = Error;
+ }
+};
+
+class CIfrRefresh : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_REFRESH *mRefresh;
+
+public:
+ CIfrRefresh () : CIfrObj (EFI_IFR_REFRESH_OP),
+ CIfrOpHeader (EFI_IFR_REFRESH_OP, &(GetObjBinAddr<EFI_IFR_REFRESH>())->Header), mRefresh(GetObjBinAddr<EFI_IFR_REFRESH>()) {
+ mRefresh->RefreshInterval = 0;
+ }
+
+ VOID SetRefreshInterval (IN UINT8 RefreshInterval) {
+ mRefresh->RefreshInterval = RefreshInterval;
+ }
+};
+
+class CIfrRefreshId : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_REFRESH_ID *mRefreshId;
+
+public:
+ CIfrRefreshId () : CIfrObj (EFI_IFR_REFRESH_ID_OP),
+ CIfrOpHeader (EFI_IFR_REFRESH_ID_OP, &(GetObjBinAddr<EFI_IFR_REFRESH_ID>())->Header), mRefreshId(GetObjBinAddr<EFI_IFR_REFRESH_ID>()) {
+ memset (&mRefreshId->RefreshEventGroupId, 0, sizeof (EFI_GUID));
+ }
+
+ VOID SetRefreshEventGroutId (IN EFI_GUID *RefreshEventGroupId) {
+ memmove (&mRefreshId->RefreshEventGroupId, RefreshEventGroupId, sizeof (EFI_GUID));
+ }
+};
+
+class CIfrVarStoreDevice : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_VARSTORE_DEVICE *mVarStoreDevice;
+
+public:
+ CIfrVarStoreDevice () : CIfrObj (EFI_IFR_VARSTORE_DEVICE_OP),
+ CIfrOpHeader (EFI_IFR_VARSTORE_DEVICE_OP, &(GetObjBinAddr<EFI_IFR_VARSTORE_DEVICE>())->Header), mVarStoreDevice(GetObjBinAddr<EFI_IFR_VARSTORE_DEVICE>()) {
+ mVarStoreDevice->DevicePath = EFI_STRING_ID_INVALID;
+ }
+
+ VOID SetDevicePath (IN EFI_STRING_ID DevicePath) {
+ mVarStoreDevice->DevicePath = DevicePath;
+ }
+};
+
+class CIfrOneOfOption : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_ONE_OF_OPTION *mOneOfOption;
+
+public:
+ CIfrOneOfOption (UINT8 Size) : CIfrObj (EFI_IFR_ONE_OF_OPTION_OP, (CHAR8 **)NULL, Size),
+ CIfrOpHeader (EFI_IFR_ONE_OF_OPTION_OP, &(GetObjBinAddr<EFI_IFR_ONE_OF_OPTION>())->Header, Size), mOneOfOption(GetObjBinAddr<EFI_IFR_ONE_OF_OPTION>()) {
+ mOneOfOption->Flags = 0;
+ mOneOfOption->Option = EFI_STRING_ID_INVALID;
+ mOneOfOption->Type = EFI_IFR_TYPE_OTHER;
+ memset (&mOneOfOption->Value, 0, Size - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
+ }
+
+ VOID SetOption (IN EFI_STRING_ID Option) {
+ mOneOfOption->Option = Option;
+ }
+
+ EFI_VFR_RETURN_CODE SetFlags (IN UINT8 LFlags) {
+ mOneOfOption->Flags = 0;
+ if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_OPTION_DEFAULT)) {
+ mOneOfOption->Flags |= EFI_IFR_OPTION_DEFAULT;
+ }
+
+ if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_OPTION_DEFAULT_MFG)) {
+ mOneOfOption->Flags |= EFI_IFR_OPTION_DEFAULT_MFG;
+ }
+
+ if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_NUM_SIZE_8)) {
+ _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_NUM_SIZE_8);
+ mOneOfOption->Flags |= EFI_IFR_TYPE_NUM_SIZE_8;
+ } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_NUM_SIZE_16)) {
+ _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_NUM_SIZE_16);
+ mOneOfOption->Flags |= EFI_IFR_TYPE_NUM_SIZE_16;
+ } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_NUM_SIZE_32)) {
+ _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_NUM_SIZE_32);
+ mOneOfOption->Flags |= EFI_IFR_TYPE_NUM_SIZE_32;
+ } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_NUM_SIZE_64)) {
+ _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_NUM_SIZE_64);
+ mOneOfOption->Flags |= EFI_IFR_TYPE_NUM_SIZE_64;
+ } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_BOOLEAN)) {
+ _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_BOOLEAN);
+ mOneOfOption->Flags |= EFI_IFR_TYPE_BOOLEAN;
+ } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_TIME)) {
+ _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_TIME);
+ mOneOfOption->Flags |= EFI_IFR_TYPE_TIME;
+ } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_DATE)) {
+ _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_DATE);
+ mOneOfOption->Flags |= EFI_IFR_TYPE_DATE;
+ } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_STRING)) {
+ _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_STRING);
+ mOneOfOption->Flags |= EFI_IFR_TYPE_STRING;
+ } else if (_IS_EQUAL (LFlags, EFI_IFR_TYPE_OTHER)) {
+ _FLAG_CLEAR (LFlags, EFI_IFR_TYPE_OTHER);
+ mOneOfOption->Flags |= EFI_IFR_TYPE_OTHER;
+ }
+
+ return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
+ }
+
+ VOID SetType (IN UINT8 Type) {
+ mOneOfOption->Type = Type;
+ }
+
+ VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
+ memmove (&mOneOfOption->Value, &Value, mOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
+ }
+
+ UINT8 GetFlags (VOID) {
+ return mOneOfOption->Flags;
+ }
+};
+
+static EFI_GUID IfrTianoGuid = EFI_IFR_TIANO_GUID;
+static EFI_GUID IfrFrameworkGuid = EFI_IFR_FRAMEWORK_GUID;
+
+class CIfrClass : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_GUID_CLASS *mClass;
+
+public:
+ CIfrClass () : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_GUID_CLASS)),
+ CIfrOpHeader (EFI_IFR_GUID_OP, &(GetObjBinAddr<EFI_IFR_GUID_CLASS>())->Header, sizeof (EFI_IFR_GUID_CLASS)), mClass(GetObjBinAddr<EFI_IFR_GUID_CLASS>()) {
+ mClass->ExtendOpCode = EFI_IFR_EXTEND_OP_CLASS;
+ mClass->Guid = IfrTianoGuid;
+ mClass->Class = EFI_NON_DEVICE_CLASS;
+ }
+
+ VOID SetClass (IN UINT16 Class) {
+ mClass->Class = Class;
+ }
+};
+
+class CIfrSubClass : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_GUID_SUBCLASS *mSubClass;
+
+public:
+ CIfrSubClass () : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_GUID_SUBCLASS)),
+ CIfrOpHeader (EFI_IFR_GUID_OP, &(GetObjBinAddr<EFI_IFR_GUID_SUBCLASS>())->Header, sizeof (EFI_IFR_GUID_SUBCLASS)), mSubClass(GetObjBinAddr<EFI_IFR_GUID_SUBCLASS>()) {
+ mSubClass->ExtendOpCode = EFI_IFR_EXTEND_OP_SUBCLASS;
+ mSubClass->Guid = IfrTianoGuid;
+ mSubClass->SubClass = EFI_SETUP_APPLICATION_SUBCLASS;
+ }
+
+ VOID SetSubClass (IN UINT16 SubClass) {
+ mSubClass->SubClass = SubClass;
+ }
+};
+
+class CIfrLabel : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_GUID_LABEL *mLabel;
+
+public:
+ CIfrLabel () : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_GUID_LABEL)),
+ CIfrOpHeader (EFI_IFR_GUID_OP, &(GetObjBinAddr<EFI_IFR_GUID_LABEL>())->Header, sizeof (EFI_IFR_GUID_LABEL)), mLabel(GetObjBinAddr<EFI_IFR_GUID_LABEL>()) {
+ mLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
+ mLabel->Guid = IfrTianoGuid;
+ }
+
+ VOID SetNumber (IN UINT16 Number) {
+ mLabel->Number = Number;
+ }
+};
+
+class CIfrBanner : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_GUID_BANNER *mBanner;
+
+public:
+ CIfrBanner () : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_GUID_BANNER)),
+ CIfrOpHeader (EFI_IFR_GUID_OP, &(GetObjBinAddr<EFI_IFR_GUID_BANNER>())->Header, sizeof (EFI_IFR_GUID_BANNER)), mBanner(GetObjBinAddr<EFI_IFR_GUID_BANNER>()) {
+ mBanner->ExtendOpCode = EFI_IFR_EXTEND_OP_BANNER;
+ mBanner->Guid = IfrTianoGuid;
+ }
+
+ VOID SetTitle (IN EFI_STRING_ID StringId) {
+ mBanner->Title = StringId;
+ }
+
+ VOID SetLine (IN UINT16 Line) {
+ mBanner->LineNumber = Line;
+ }
+
+ VOID SetAlign (IN UINT8 Align) {
+ mBanner->Alignment = Align;
+ }
+};
+
+class CIfrOptionKey : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_GUID_OPTIONKEY *mOptionKey;
+
+public:
+ CIfrOptionKey (
+ IN EFI_QUESTION_ID QuestionId,
+ IN EFI_IFR_TYPE_VALUE &OptionValue,
+ IN EFI_QUESTION_ID KeyValue
+ ) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_GUID_OPTIONKEY)),
+ CIfrOpHeader (EFI_IFR_GUID_OP, &(GetObjBinAddr<EFI_IFR_GUID_OPTIONKEY>())->Header, sizeof (EFI_IFR_GUID_OPTIONKEY)), mOptionKey(GetObjBinAddr<EFI_IFR_GUID_OPTIONKEY>()) {
+ mOptionKey->ExtendOpCode = EFI_IFR_EXTEND_OP_OPTIONKEY;
+ mOptionKey->Guid = IfrFrameworkGuid;
+ mOptionKey->QuestionId = QuestionId;
+ mOptionKey->OptionValue = OptionValue;
+ mOptionKey->KeyValue = KeyValue;
+ }
+};
+
+class CIfrVarEqName : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_GUID_VAREQNAME *mVarEqName;
+
+public:
+ CIfrVarEqName (
+ IN EFI_QUESTION_ID QuestionId,
+ IN EFI_STRING_ID NameId
+ ) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_GUID_VAREQNAME)),
+ CIfrOpHeader (EFI_IFR_GUID_OP, &(GetObjBinAddr<EFI_IFR_GUID_VAREQNAME>())->Header, sizeof (EFI_IFR_GUID_VAREQNAME)), mVarEqName(GetObjBinAddr<EFI_IFR_GUID_VAREQNAME>()) {
+ mVarEqName->ExtendOpCode = EFI_IFR_EXTEND_OP_VAREQNAME;
+ mVarEqName->Guid = IfrFrameworkGuid;
+ mVarEqName->QuestionId = QuestionId;
+ mVarEqName->NameId = NameId;
+ }
+};
+
+class CIfrTimeout : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_GUID_TIMEOUT *mTimeout;
+
+public:
+ CIfrTimeout (IN UINT16 Timeout = 0) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_GUID_TIMEOUT)),
+ CIfrOpHeader (EFI_IFR_GUID_OP, &(GetObjBinAddr<EFI_IFR_GUID_TIMEOUT>())->Header, sizeof (EFI_IFR_GUID_TIMEOUT)), mTimeout(GetObjBinAddr<EFI_IFR_GUID_TIMEOUT>()) {
+ mTimeout->ExtendOpCode = EFI_IFR_EXTEND_OP_TIMEOUT;
+ mTimeout->Guid = IfrTianoGuid;
+ mTimeout->TimeOut = Timeout;
+ }
+
+ VOID SetTimeout (IN UINT16 Timeout) {
+ mTimeout->TimeOut = Timeout;
+ }
+};
+
+class CIfrGuid : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_GUID *mGuid;
+
+public:
+ CIfrGuid (UINT8 Size) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_GUID)+Size),
+ CIfrOpHeader (EFI_IFR_GUID_OP, &(GetObjBinAddr<EFI_IFR_GUID>())->Header, sizeof (EFI_IFR_GUID)+Size), mGuid(GetObjBinAddr<EFI_IFR_GUID>()) {
+ memset (&mGuid->Guid, 0, sizeof (EFI_GUID));
+ }
+
+ VOID SetGuid (IN EFI_GUID *Guid) {
+ memmove (&mGuid->Guid, Guid, sizeof (EFI_GUID));
+ }
+
+ VOID SetData (IN UINT8* DataBuff, IN UINT8 Size) {
+ memmove ((UINT8 *)mGuid + sizeof (EFI_IFR_GUID), DataBuff, Size);
+ }
+};
+
+class CIfrDup : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrDup (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_DUP_OP),
+ CIfrOpHeader (EFI_IFR_DUP_OP, &(GetObjBinAddr<EFI_IFR_DUP>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrEqIdId : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_EQ_ID_ID *mEqIdId;
+
+public:
+ CIfrEqIdId (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_EQ_ID_ID_OP),
+ CIfrOpHeader (EFI_IFR_EQ_ID_ID_OP, &(GetObjBinAddr<EFI_IFR_EQ_ID_ID>())->Header), mEqIdId(GetObjBinAddr<EFI_IFR_EQ_ID_ID>()) {
+ SetLineNo (LineNo);
+ mEqIdId->QuestionId1 = EFI_QUESTION_ID_INVALID;
+ mEqIdId->QuestionId2 = EFI_QUESTION_ID_INVALID;
+ }
+
+ VOID SetQuestionId1 (
+ IN EFI_QUESTION_ID QuestionId,
+ IN CHAR8 *VarIdStr,
+ IN UINT32 LineNo
+ ) {
+ if (QuestionId != EFI_QUESTION_ID_INVALID) {
+ mEqIdId->QuestionId1 = QuestionId;
+ } else {
+ gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mEqIdId->QuestionId1), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
+ }
+ }
+
+ VOID SetQuestionId2 (
+ IN EFI_QUESTION_ID QuestionId,
+ IN CHAR8 *VarIdStr,
+ IN UINT32 LineNo
+ ) {
+ if (QuestionId != EFI_QUESTION_ID_INVALID) {
+ mEqIdId->QuestionId2 = QuestionId;
+ } else {
+ gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mEqIdId->QuestionId2), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
+ }
+ }
+};
+
+class CIfrEqIdVal : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_EQ_ID_VAL *mEqIdVal;
+
+public:
+ CIfrEqIdVal (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_EQ_ID_VAL_OP),
+ CIfrOpHeader (EFI_IFR_EQ_ID_VAL_OP, &(GetObjBinAddr<EFI_IFR_EQ_ID_VAL>())->Header), mEqIdVal(GetObjBinAddr<EFI_IFR_EQ_ID_VAL>()) {
+ SetLineNo (LineNo);
+ mEqIdVal->QuestionId = EFI_QUESTION_ID_INVALID;
+ }
+
+ VOID SetQuestionId (
+ IN EFI_QUESTION_ID QuestionId,
+ IN CHAR8 *VarIdStr,
+ IN UINT32 LineNo
+ ) {
+ if (QuestionId != EFI_QUESTION_ID_INVALID) {
+ mEqIdVal->QuestionId = QuestionId;
+ } else {
+ gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mEqIdVal->QuestionId), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
+ }
+ }
+
+ VOID SetValue (IN UINT16 Value) {
+ mEqIdVal->Value = Value;
+ }
+};
+
+class CIfrEqIdList : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_EQ_ID_VAL_LIST *mEqIdVList;
+
+public:
+ CIfrEqIdList (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_EQ_ID_VAL_LIST_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_EQ_ID_VAL_LIST), TRUE),
+ CIfrOpHeader (EFI_IFR_EQ_ID_VAL_LIST_OP, &(GetObjBinAddr<EFI_IFR_EQ_ID_VAL_LIST>())->Header), mEqIdVList(GetObjBinAddr<EFI_IFR_EQ_ID_VAL_LIST>()) {
+ SetLineNo (LineNo);
+ mEqIdVList->QuestionId = EFI_QUESTION_ID_INVALID;
+ mEqIdVList->ListLength = 0;
+ mEqIdVList->ValueList[0] = 0;
+ }
+
+ VOID UpdateIfrBuffer (
+ ) {
+ _EMIT_PENDING_OBJ();
+ mEqIdVList = GetObjBinAddr<EFI_IFR_EQ_ID_VAL_LIST>();
+ UpdateHeader (&mEqIdVList->Header);
+ }
+
+ VOID SetQuestionId (
+ IN EFI_QUESTION_ID QuestionId,
+ IN CHAR8 *VarIdStr,
+ IN UINT32 LineNo
+ ) {
+ if (QuestionId != EFI_QUESTION_ID_INVALID) {
+ mEqIdVList->QuestionId = QuestionId;
+ } else {
+ gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mEqIdVList->QuestionId), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
+ }
+ }
+
+ VOID SetListLength (IN UINT16 ListLength) {
+ mEqIdVList->ListLength = ListLength;
+ }
+
+ VOID SetValueList (IN UINT16 Index, IN UINT16 Value) {
+ if (Index == 0) {
+ mEqIdVList->ValueList[0] = Value;
+ return;
+ }
+
+ if (ExpendObjBin (sizeof (UINT16)) ==TRUE) {
+ IncLength (sizeof (UINT16));
+ mEqIdVList->ValueList[Index] = Value;
+ }
+ }
+};
+
+class CIfrQuestionRef1 : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_QUESTION_REF1 *mQuestionRef1;
+
+public:
+ CIfrQuestionRef1 (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_QUESTION_REF1_OP),
+ CIfrOpHeader (EFI_IFR_QUESTION_REF1_OP, &(GetObjBinAddr<EFI_IFR_QUESTION_REF1>())->Header), mQuestionRef1(GetObjBinAddr<EFI_IFR_QUESTION_REF1>()) {
+ SetLineNo (LineNo);
+ mQuestionRef1->QuestionId = EFI_QUESTION_ID_INVALID;
+ }
+
+ VOID SetQuestionId (
+ IN EFI_QUESTION_ID QuestionId,
+ IN CHAR8 *VarIdStr,
+ IN UINT32 LineNo
+ ) {
+ if (QuestionId != EFI_QUESTION_ID_INVALID) {
+ mQuestionRef1->QuestionId = QuestionId;
+ } else {
+ gCFormPkg.AssignPending (VarIdStr, (VOID *)(&mQuestionRef1->QuestionId), sizeof (EFI_QUESTION_ID), LineNo, NO_QST_REFED);
+ }
+ }
+};
+
+class CIfrQuestionRef2 : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrQuestionRef2 (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_QUESTION_REF2_OP),
+ CIfrOpHeader (EFI_IFR_QUESTION_REF2_OP, &(GetObjBinAddr<EFI_IFR_QUESTION_REF2>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrQuestionRef3 : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrQuestionRef3 (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_QUESTION_REF3_OP),
+ CIfrOpHeader (EFI_IFR_QUESTION_REF3_OP, &(GetObjBinAddr<EFI_IFR_QUESTION_REF3>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrQuestionRef3_2 : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_QUESTION_REF3_2 *mQuestionRef3_2;
+
+public:
+ CIfrQuestionRef3_2 (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_QUESTION_REF3_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_QUESTION_REF3_2)),
+ CIfrOpHeader (EFI_IFR_QUESTION_REF3_OP, &(GetObjBinAddr<EFI_IFR_QUESTION_REF3_2>())->Header, sizeof (EFI_IFR_QUESTION_REF3_2)), mQuestionRef3_2(GetObjBinAddr<EFI_IFR_QUESTION_REF3_2>()) {
+ SetLineNo (LineNo);
+ mQuestionRef3_2->DevicePath = EFI_STRING_ID_INVALID;
+ }
+
+ VOID SetDevicePath (IN EFI_STRING_ID DevicePath) {
+ mQuestionRef3_2->DevicePath = DevicePath;
+ }
+};
+
+class CIfrQuestionRef3_3 : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_QUESTION_REF3_3 *mQuestionRef3_3;
+
+public:
+ CIfrQuestionRef3_3 (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_QUESTION_REF3_OP, (CHAR8 **)NULL, sizeof (EFI_IFR_QUESTION_REF3_3)),
+ CIfrOpHeader (EFI_IFR_QUESTION_REF3_OP, &(GetObjBinAddr<EFI_IFR_QUESTION_REF3_3>())->Header, sizeof (EFI_IFR_QUESTION_REF3_3)), mQuestionRef3_3(GetObjBinAddr<EFI_IFR_QUESTION_REF3_3>()) {
+ SetLineNo (LineNo);
+ mQuestionRef3_3->DevicePath = EFI_STRING_ID_INVALID;
+ memset (&mQuestionRef3_3->Guid, 0, sizeof (EFI_GUID));
+ }
+
+ VOID SetDevicePath (IN EFI_STRING_ID DevicePath) {
+ mQuestionRef3_3->DevicePath = DevicePath;
+ }
+
+ VOID SetGuid (IN EFI_GUID *Guid) {
+ mQuestionRef3_3->Guid = *Guid;
+ }
+};
+
+class CIfrRuleRef : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_RULE_REF *mRuleRef;
+
+public:
+ CIfrRuleRef (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_RULE_REF_OP),
+ CIfrOpHeader (EFI_IFR_RULE_REF_OP, &(GetObjBinAddr<EFI_IFR_RULE_REF>())->Header), mRuleRef(GetObjBinAddr<EFI_IFR_RULE_REF>()) {
+ SetLineNo (LineNo);
+ mRuleRef->RuleId = EFI_RULE_ID_INVALID;
+ }
+
+ VOID SetRuleId (IN UINT8 RuleId) {
+ mRuleRef->RuleId = RuleId;
+ }
+};
+
+class CIfrStringRef1 : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_STRING_REF1 *mStringRef1;
+
+public:
+ CIfrStringRef1 (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_STRING_REF1_OP),
+ CIfrOpHeader (EFI_IFR_STRING_REF1_OP, &(GetObjBinAddr<EFI_IFR_STRING_REF1>())->Header), mStringRef1(GetObjBinAddr<EFI_IFR_STRING_REF1>()) {
+ SetLineNo (LineNo);
+ mStringRef1->StringId = EFI_STRING_ID_INVALID;
+ }
+
+ VOID SetStringId (IN EFI_STRING_ID StringId) {
+ mStringRef1->StringId = StringId;
+ }
+};
+
+class CIfrStringRef2 : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrStringRef2 (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_STRING_REF2_OP),
+ CIfrOpHeader (EFI_IFR_STRING_REF2_OP, &(GetObjBinAddr<EFI_IFR_STRING_REF2>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrThis : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrThis (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_THIS_OP),
+ CIfrOpHeader (EFI_IFR_THIS_OP, &(GetObjBinAddr<EFI_IFR_THIS>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrSecurity : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_SECURITY *mSecurity;
+
+public:
+ CIfrSecurity (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_SECURITY_OP),
+ CIfrOpHeader (EFI_IFR_SECURITY_OP, &(GetObjBinAddr<EFI_IFR_SECURITY>())->Header), mSecurity(GetObjBinAddr<EFI_IFR_SECURITY>()) {
+ SetLineNo (LineNo);
+ memset (&mSecurity->Permissions, 0, sizeof (EFI_GUID));
+ }
+
+ VOID SetPermissions (IN EFI_GUID *Permissions) {
+ memmove (&mSecurity->Permissions, Permissions, sizeof (EFI_GUID));
+ }
+};
+
+class CIfrUint8 : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_UINT8 *mUint8;
+
+public:
+ CIfrUint8 (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_UINT8_OP),
+ CIfrOpHeader (EFI_IFR_UINT8_OP, &(GetObjBinAddr<EFI_IFR_UINT8>())->Header), mUint8(GetObjBinAddr<EFI_IFR_UINT8>()) {
+ SetLineNo (LineNo);
+ }
+
+ VOID SetValue (IN UINT8 Value) {
+ mUint8->Value = Value;
+ }
+};
+
+class CIfrUint16 : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_UINT16 *mUint16;
+
+public:
+ CIfrUint16 (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_UINT16_OP),
+ CIfrOpHeader (EFI_IFR_UINT16_OP, &(GetObjBinAddr<EFI_IFR_UINT16>())->Header), mUint16(GetObjBinAddr<EFI_IFR_UINT16>()) {
+ SetLineNo (LineNo);
+ }
+
+ VOID SetValue (IN UINT16 Value) {
+ mUint16->Value = Value;
+ }
+};
+
+class CIfrUint32 : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_UINT32 *mUint32;
+
+public:
+ CIfrUint32 (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_UINT32_OP),
+ CIfrOpHeader (EFI_IFR_UINT32_OP, &(GetObjBinAddr<EFI_IFR_UINT32>())->Header), mUint32(GetObjBinAddr<EFI_IFR_UINT32>()) {
+ SetLineNo (LineNo);
+ }
+
+ VOID SetValue (IN UINT32 Value) {
+ mUint32->Value = Value;
+ }
+};
+
+class CIfrUint64 : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_UINT64 *mUint64;
+
+public:
+ CIfrUint64 (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_UINT64_OP),
+ CIfrOpHeader (EFI_IFR_UINT64_OP, &(GetObjBinAddr<EFI_IFR_UINT64>())->Header), mUint64(GetObjBinAddr<EFI_IFR_UINT64>()) {
+ SetLineNo (LineNo);
+ }
+
+ VOID SetValue (IN UINT64 Value) {
+ mUint64->Value = Value;
+ }
+};
+
+class CIfrTrue : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrTrue (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_TRUE_OP),
+ CIfrOpHeader (EFI_IFR_TRUE_OP, &(GetObjBinAddr<EFI_IFR_TRUE>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrFalse : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrFalse (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_FALSE_OP),
+ CIfrOpHeader (EFI_IFR_FALSE_OP, &(GetObjBinAddr<EFI_IFR_FALSE>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrOne : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrOne (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_ONE_OP),
+ CIfrOpHeader (EFI_IFR_ONE_OP, &(GetObjBinAddr<EFI_IFR_ONE>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrOnes : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrOnes (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_ONES_OP),
+ CIfrOpHeader (EFI_IFR_ONES_OP, &(GetObjBinAddr<EFI_IFR_ONES>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrZero : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrZero (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_ZERO_OP),
+ CIfrOpHeader (EFI_IFR_ZERO_OP, &(GetObjBinAddr<EFI_IFR_ZERO>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrUndefined : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrUndefined (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_UNDEFINED_OP),
+ CIfrOpHeader (EFI_IFR_UNDEFINED_OP, &(GetObjBinAddr<EFI_IFR_UNDEFINED>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrVersion : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrVersion (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_VERSION_OP),
+ CIfrOpHeader (EFI_IFR_VERSION_OP, &(GetObjBinAddr<EFI_IFR_VERSION>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrLength : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrLength (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_LENGTH_OP),
+ CIfrOpHeader (EFI_IFR_LENGTH_OP, &(GetObjBinAddr<EFI_IFR_LENGTH>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrNot : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrNot (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_NOT_OP),
+ CIfrOpHeader (EFI_IFR_NOT_OP, &(GetObjBinAddr<EFI_IFR_NOT>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrBitWiseNot : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrBitWiseNot (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_BITWISE_NOT_OP),
+ CIfrOpHeader (EFI_IFR_BITWISE_NOT_OP, &(GetObjBinAddr<EFI_IFR_BITWISE_NOT>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrToBoolean : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrToBoolean (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_TO_BOOLEAN_OP),
+ CIfrOpHeader (EFI_IFR_TO_BOOLEAN_OP, &(GetObjBinAddr<EFI_IFR_TO_BOOLEAN>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrToString : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_TO_STRING *mToString;
+
+public:
+ CIfrToString (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_TO_STRING_OP),
+ CIfrOpHeader (EFI_IFR_TO_STRING_OP, &(GetObjBinAddr<EFI_IFR_TO_STRING>())->Header), mToString(GetObjBinAddr<EFI_IFR_TO_STRING>()) {
+ SetLineNo (LineNo);
+ }
+
+ VOID SetFormat (IN UINT8 Format) {
+ mToString->Format = Format;
+ }
+};
+
+class CIfrToUint : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrToUint (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_TO_UINT_OP),
+ CIfrOpHeader (EFI_IFR_TO_UINT_OP, &(GetObjBinAddr<EFI_IFR_TO_UINT>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrToUpper : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrToUpper (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_TO_UPPER_OP),
+ CIfrOpHeader (EFI_IFR_TO_UPPER_OP, &(GetObjBinAddr<EFI_IFR_TO_UPPER>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrToLower : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrToLower (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_TO_LOWER_OP),
+ CIfrOpHeader (EFI_IFR_TO_LOWER_OP, &(GetObjBinAddr<EFI_IFR_TO_LOWER>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrAdd : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrAdd (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_ADD_OP),
+ CIfrOpHeader (EFI_IFR_ADD_OP, &(GetObjBinAddr<EFI_IFR_ADD>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrBitWiseAnd : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrBitWiseAnd (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_BITWISE_AND_OP),
+ CIfrOpHeader (EFI_IFR_BITWISE_AND_OP, &(GetObjBinAddr<EFI_IFR_BITWISE_AND>())->Header) {
+ SetLineNo(LineNo);
+ }
+};
+
+class CIfrBitWiseOr : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrBitWiseOr (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_BITWISE_OR_OP),
+ CIfrOpHeader (EFI_IFR_BITWISE_OR_OP, &(GetObjBinAddr<EFI_IFR_BITWISE_OR>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrAnd : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrAnd (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_AND_OP),
+ CIfrOpHeader (EFI_IFR_AND_OP, &(GetObjBinAddr<EFI_IFR_AND>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrCatenate : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrCatenate (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_CATENATE_OP),
+ CIfrOpHeader (EFI_IFR_CATENATE_OP, &(GetObjBinAddr<EFI_IFR_CATENATE>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrDivide : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrDivide (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_DIVIDE_OP),
+ CIfrOpHeader (EFI_IFR_DIVIDE_OP, &(GetObjBinAddr<EFI_IFR_DIVIDE>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrEqual : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrEqual (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_EQUAL_OP),
+ CIfrOpHeader (EFI_IFR_EQUAL_OP, &(GetObjBinAddr<EFI_IFR_EQUAL>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrGreaterEqual : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrGreaterEqual (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_GREATER_EQUAL_OP),
+ CIfrOpHeader (EFI_IFR_GREATER_EQUAL_OP, &(GetObjBinAddr<EFI_IFR_GREATER_EQUAL>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrGreaterThan : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrGreaterThan (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_GREATER_THAN_OP),
+ CIfrOpHeader (EFI_IFR_GREATER_THAN_OP, &(GetObjBinAddr<EFI_IFR_GREATER_THAN>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrLessEqual : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrLessEqual (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_LESS_EQUAL_OP),
+ CIfrOpHeader (EFI_IFR_LESS_EQUAL_OP, &(GetObjBinAddr<EFI_IFR_LESS_EQUAL>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrLessThan : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrLessThan (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_LESS_THAN_OP),
+ CIfrOpHeader (EFI_IFR_LESS_THAN_OP, &(GetObjBinAddr<EFI_IFR_LESS_THAN>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrMap : public CIfrObj, public CIfrOpHeader{
+public:
+ CIfrMap (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_MAP_OP),
+ CIfrOpHeader (EFI_IFR_MAP_OP, &(GetObjBinAddr<EFI_IFR_MAP>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrMatch : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrMatch (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_MATCH_OP),
+ CIfrOpHeader (EFI_IFR_MATCH_OP, &(GetObjBinAddr<EFI_IFR_MATCH>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrMatch2 : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_MATCH2 *mMatch2;
+
+public:
+ CIfrMatch2 (
+ IN UINT32 LineNo,
+ IN EFI_GUID *Guid
+ ) : CIfrObj (EFI_IFR_MATCH2_OP),
+ CIfrOpHeader (EFI_IFR_MATCH2_OP, &(GetObjBinAddr<EFI_IFR_MATCH2>())->Header), mMatch2(GetObjBinAddr<EFI_IFR_MATCH2>()) {
+ SetLineNo (LineNo);
+ memmove (&mMatch2->SyntaxType, Guid, sizeof (EFI_GUID));
+ }
+};
+
+class CIfrMultiply : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrMultiply (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_MULTIPLY_OP),
+ CIfrOpHeader (EFI_IFR_MULTIPLY_OP, &(GetObjBinAddr<EFI_IFR_MULTIPLY>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrModulo : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrModulo (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_MODULO_OP),
+ CIfrOpHeader (EFI_IFR_MODULO_OP, &(GetObjBinAddr<EFI_IFR_MODULO>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrNotEqual : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrNotEqual (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_NOT_EQUAL_OP),
+ CIfrOpHeader (EFI_IFR_NOT_EQUAL_OP, &(GetObjBinAddr<EFI_IFR_NOT_EQUAL>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrOr : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrOr (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_OR_OP),
+ CIfrOpHeader (EFI_IFR_OR_OP, &(GetObjBinAddr<EFI_IFR_OR>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrShiftLeft : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrShiftLeft (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_SHIFT_LEFT_OP),
+ CIfrOpHeader (EFI_IFR_SHIFT_LEFT_OP, &(GetObjBinAddr<EFI_IFR_SHIFT_LEFT>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrShiftRight : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrShiftRight (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_SHIFT_RIGHT_OP),
+ CIfrOpHeader (EFI_IFR_SHIFT_RIGHT_OP, &(GetObjBinAddr<EFI_IFR_SHIFT_RIGHT>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrSubtract : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrSubtract (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_SUBTRACT_OP),
+ CIfrOpHeader (EFI_IFR_SUBTRACT_OP, &(GetObjBinAddr<EFI_IFR_SUBTRACT>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrConditional : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrConditional (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_CONDITIONAL_OP),
+ CIfrOpHeader (EFI_IFR_CONDITIONAL_OP, &(GetObjBinAddr<EFI_IFR_CONDITIONAL>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrFind : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_FIND *mFind;
+
+public:
+ CIfrFind (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_FIND_OP),
+ CIfrOpHeader (EFI_IFR_FIND_OP, &(GetObjBinAddr<EFI_IFR_FIND>())->Header), mFind(GetObjBinAddr<EFI_IFR_FIND>()) {
+ SetLineNo (LineNo);
+ }
+
+ VOID SetFormat (IN UINT8 Format) {
+ mFind->Format = Format;
+ }
+};
+
+class CIfrMid : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrMid (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_MID_OP),
+ CIfrOpHeader (EFI_IFR_MID_OP, &(GetObjBinAddr<EFI_IFR_MID>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrToken : public CIfrObj, public CIfrOpHeader {
+public:
+ CIfrToken (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_TOKEN_OP),
+ CIfrOpHeader (EFI_IFR_TOKEN_OP, &(GetObjBinAddr<EFI_IFR_TOKEN>())->Header) {
+ SetLineNo (LineNo);
+ }
+};
+
+class CIfrSpan : public CIfrObj, public CIfrOpHeader {
+private:
+ EFI_IFR_SPAN *mSpan;
+
+public:
+ CIfrSpan (
+ IN UINT32 LineNo
+ ) : CIfrObj (EFI_IFR_SPAN_OP),
+ CIfrOpHeader (EFI_IFR_SPAN_OP, &(GetObjBinAddr<EFI_IFR_SPAN>())->Header), mSpan(GetObjBinAddr<EFI_IFR_SPAN>()) {
+ SetLineNo (LineNo);
+ mSpan->Flags = EFI_IFR_FLAGS_FIRST_MATCHING;
+ }
+
+ EFI_VFR_RETURN_CODE SetFlags (IN UINT8 LFlags) {
+ if (_IS_EQUAL (LFlags, EFI_IFR_FLAGS_FIRST_MATCHING)) {
+ mSpan->Flags |= EFI_IFR_FLAGS_FIRST_MATCHING;
+ } else if (_FLAG_TEST_AND_CLEAR (LFlags, EFI_IFR_FLAGS_FIRST_NON_MATCHING)) {
+ mSpan->Flags |= EFI_IFR_FLAGS_FIRST_NON_MATCHING;
+ }
+
+ return _FLAGS_ZERO (LFlags) ? VFR_RETURN_SUCCESS : VFR_RETURN_FLAGS_UNSUPPORTED;
+ }
+};
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrSyntax.g
new file mode 100644
index 000000000..127cb8b2b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrSyntax.g
@@ -0,0 +1,5689 @@
+/*++ @file
+Vfr Syntax
+
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+--*/
+
+#header<<
+
+#include "EfiVfr.h"
+#include "VfrFormPkg.h"
+#include "VfrError.h"
+#include "VfrUtilityLib.h"
+#include "AToken.h"
+#include "ATokPtr.h"
+>>
+
+<<
+#ifdef UINT8_MAX
+#undef UINT8_MAX
+#endif
+#include "stdio.h"
+#include "PBlackBox.h"
+#include "DLexerBase.h"
+#include "VfrLexer.h"
+#include "AToken.h"
+
+#define GET_LINENO(Obj) ((Obj)->getLine())
+#define SET_LINE_INFO(Obj, L) do {(Obj).SetLineNo((L)->getLine());} while (0)
+#define CRT_END_OP(Obj) do {CIfrEnd EObj; if (Obj != NULL) EObj.SetLineNo ((Obj)->getLine());} while (0)
+
+typedef ANTLRCommonToken ANTLRToken;
+
+class CVfrDLGLexer : public VfrLexer
+{
+public:
+ CVfrDLGLexer (DLGFileInput *F) : VfrLexer (F) {};
+ void errstd (const char *Text)
+ {
+ printf ("unrecognized input '%s'\n", Text);
+ }
+};
+
+UINT8
+VfrParserStart (
+ IN FILE *File,
+ IN INPUT_INFO_TO_SYNTAX *InputInfo
+ )
+{
+ ParserBlackBox<CVfrDLGLexer, EfiVfrParser, ANTLRToken> VfrParser(File);
+ VfrParser.parser()->SetOverrideClassGuid (InputInfo->OverrideClassGuid);
+ return VfrParser.parser()->vfrProgram();
+}
+>>
+
+//
+// Define a lexical class for parsing quoted strings. Basically
+// starts with a double quote, and ends with a double quote that
+// is not preceded with a backslash.
+//
+#lexclass QUOTED_STRING
+#token TheString "~[\"]*\"" << mode (START); >>
+
+//
+// Define a lexclass for skipping over C++ style comments
+//
+#lexclass CPP_COMMENT
+#token "~[\n]*" << skip (); >>
+#token "\n" << skip (); mode (START); newline (); >>
+
+//
+// Standard lexclass is START
+//
+#lexclass START
+
+//
+// Find start of C++ style comments
+//
+#token "//" << skip (); mode (CPP_COMMENT); >>
+
+//
+// Skip whitespace
+//
+#token "[\ \t]" << skip (); >>
+
+//
+// Skip over newlines, but count them
+//
+#token "\n" << skip (); newline (); >>
+
+//
+// Skip over 'extern' in any included .H file
+//
+#token "extern" << skip (); mode (CPP_COMMENT); >>
+
+//
+// Tokens for the different keywords. Syntax is:
+// TokenName("ErrorMessageText") "TokenString"
+// where:
+// TokenName is the token name (must be capitalized) that is used in the rules
+// ErrorMessageText is the string the compiler emits when it detects a syntax error
+// TokenString is the actual matching string used in the user script
+//
+#token FormPkgType("formpkgtype") "formpkgtype"
+#token OpenBrace("{") "\{"
+#token CloseBrace("}") "\}"
+#token OpenParen("(") "\("
+#token CloseParen(")") "\)"
+#token OpenBracket("[") "\["
+#token CloseBracket("]") "\]"
+
+#token LineDefinition "#line\ [0-9]+\ \"~[\"]+\"[\ \t]*\n" << gCVfrErrorHandle.ParseFileScopeRecord (begexpr (), line ()); skip (); newline (); >>
+#token DevicePath("devicepath") "devicepath"
+#token FormSet("formset") "formset"
+#token FormSetId("formsetid") "formsetid"
+#token EndFormSet("endformset") "endformset"
+#token Title("title") "title"
+#token FormId("formid") "formid"
+#token OneOf("oneof") "oneof"
+#token EndOneOf("endoneof") "endoneof"
+#token Prompt("prompt") "prompt"
+#token OrderedList("orderedlist") "orderedlist"
+#token MaxContainers("maxcontainers") "maxcontainers"
+#token EndList("endlist") "endlist"
+#token EndForm("endform") "endform"
+#token Form("form") "form"
+#token FormMap("formmap") "formmap"
+#token MapTitle("maptitle") "maptitle"
+#token MapGuid("mapguid") "mapguid"
+#token Subtitle("subtitle") "subtitle"
+#token EndSubtitle("endsubtitle") "endsubtitle"
+#token Help("help") "help"
+#token Text("text") "text"
+#token Option("option") "option"
+#token FLAGS("flags") "flags"
+#token Date("date") "date"
+#token EndDate("enddate") "enddate"
+#token Year("year") "year"
+#token Month("month") "month"
+#token Day("day") "day"
+#token Time("time") "time"
+#token EndTime("endtime") "endtime"
+#token Hour("hour") "hour"
+#token Minute("minute") "minute"
+#token Second("second") "second"
+#token GrayOutIf("grayoutif") "grayoutif"
+#token Label("label") "label"
+#token Timeout("timeout") "timeout"
+#token Inventory("inventory") "inventory"
+#token NonNvDataMap("_NON_NV_DATA_MAP") "_NON_NV_DATA_MAP"
+#token Struct("struct") "struct"
+#token Union("union") "union"
+#token Boolean("BOOLEAN") "BOOLEAN"
+#token Uint64("UINT64") "UINT64"
+#token Uint32("UINT32") "UINT32"
+#token Uint16("UINT16") "UINT16"
+#token Char16("CHAR16") "CHAR16"
+#token Uint8("UINT8") "UINT8"
+#token Uuid("guid") "guid"
+#token CheckBox("checkbox") "checkbox"
+#token EndCheckBox("endcheckbox") "endcheckbox"
+#token Numeric("numeric") "numeric"
+#token EndNumeric("endnumeric") "endnumeric"
+#token Minimum("minimum") "minimum"
+#token Maximum("maximum") "maximum"
+#token STEP("step") "step"
+#token Default("default") "default"
+#token Password("password") "password"
+#token EndPassword("endpassword") "endpassword"
+#token String("string") "string"
+#token EndString("endstring") "endstring"
+#token MinSize("minsize") "minsize"
+#token MaxSize("maxsize") "maxsize"
+#token Encoding("encoding") "encoding"
+#token SuppressIf("suppressif") "suppressif"
+#token DisableIf("disableif") "disableif"
+#token Hidden("hidden") "hidden"
+#token Goto("goto") "goto"
+#token FormSetGuid("formsetguid") "formsetguid"
+#token InconsistentIf("inconsistentif") "inconsistentif"
+#token WarningIf("warningif") "warningif"
+#token NoSubmitIf("nosubmitif") "nosubmitif"
+#token EndIf("endif") "endif"
+#token Key("key") "key"
+#token DefaultFlag("DEFAULT") "DEFAULT"
+#token ManufacturingFlag("MANUFACTURING") "MANUFACTURING"
+#token InteractiveFlag("INTERACTIVE") "INTERACTIVE"
+#token NVAccessFlag("NV_ACCESS") "NV_ACCESS"
+#token ResetRequiredFlag("RESET_REQUIRED") "RESET_REQUIRED"
+#token ReconnectRequiredFlag("RECONNECT_REQUIRED") "RECONNECT_REQUIRED"
+#token LateCheckFlag("LATE_CHECK") "LATE_CHECK"
+#token ReadOnlyFlag("READ_ONLY") "READ_ONLY"
+#token OptionOnlyFlag("OPTIONS_ONLY") "OPTIONS_ONLY"
+#token Class("class") "class"
+#token Subclass("subclass") "subclass"
+#token ClassGuid("classguid") "classguid"
+#token TypeDef("typedef") "typedef"
+#token Restore("restore") "restore"
+#token Save("save") "save"
+#token Defaults("defaults") "defaults"
+#token Banner("banner") "banner"
+#token Align("align") "align"
+#token Left("left") "left"
+#token Right("right") "right"
+#token Center("center") "center"
+#token Line("line") "line"
+#token Name("name") "name"
+
+#token VarId("varid") "varid"
+#token Question("question") "question"
+#token QuestionId("questionid") "questionid"
+#token Image("image") "image"
+#token Locked("locked") "locked"
+#token Rule("rule") "rule"
+#token EndRule("endrule") "endrule"
+#token Value("value") "value"
+#token Read("read") "read"
+#token Write("write") "write"
+#token ResetButton("resetbutton") "resetbutton"
+#token EndResetButton("endresetbutton") "endresetbutton"
+#token DefaultStore("defaultstore") "defaultstore"
+#token Attribute("attribute") "attribute"
+#token Varstore("varstore") "varstore"
+#token Efivarstore("efivarstore") "efivarstore"
+#token VarSize("varsize") "varsize"
+#token NameValueVarStore("namevaluevarstore") "namevaluevarstore"
+#token Action("action") "action"
+#token Config("config") "config"
+#token EndAction("endaction") "endaction"
+#token Refresh("refresh") "refresh"
+#token Interval("interval") "interval"
+#token VarstoreDevice("varstoredevice") "varstoredevice"
+#token GuidOp("guidop") "guidop"
+#token EndGuidOp("endguidop") "endguidop"
+#token DataType("datatype") "datatype"
+#token Data("data") "data"
+#token Modal("modal") "modal"
+
+//
+// Define the class and subclass tokens
+//
+#token ClassNonDevice("NONDEVICE") "NON_DEVICE"
+#token ClassDiskDevice("DISK_DEVICE") "DISK_DEVICE"
+#token ClassVideoDevice("VIDEO_DEVICE") "VIDEO_DEVICE"
+#token ClassNetworkDevice("NETWORK_DEVICE") "NETWORK_DEVICE"
+#token ClassInputDevice("INPUT_DEVICE") "INPUT_DEVICE"
+#token ClassOnBoardDevice("ONBOARD_DEVICE") "ONBOARD_DEVICE"
+#token ClassOtherDevice("OTHER_DEVICE") "OTHER_DEVICE"
+
+#token SubclassSetupApplication("SETUP_APPLICATION") "SETUP_APPLICATION"
+#token SubclassGeneralApplication("GENERAL_APPLICATION") "GENERAL_APPLICATION"
+#token SubclassFrontPage("FRONT_PAGE") "FRONT_PAGE"
+#token SubclassSingleUse("SINGLE_USE") "SINGLE_USE"
+
+//
+// This is the overall definition of a VFR form definition script.
+//
+
+vfrProgram > [UINT8 Return] :
+ <<
+ mParserStatus = 0;
+ mCIfrOpHdrIndex = 0;
+ mConstantOnlyInExpression = FALSE;
+ >>
+ (
+ vfrPragmaPackDefinition
+ | vfrDataStructDefinition
+ | vfrDataUnionDefinition
+ )*
+ vfrFormSetDefinition
+ << $Return = mParserStatus; >>
+ ;
+
+pragmaPackShowDef :
+ L:"show" << gCVfrVarDataTypeDB.Pack (L->getLine(), VFR_PACK_SHOW); >>
+ ;
+
+pragmaPackStackDef :
+ <<
+ UINT32 LineNum;
+ UINT8 PackAction;
+ CHAR8 *Identifier = NULL;
+ UINT32 PackNumber = DEFAULT_PACK_ALIGN;
+ >>
+ (
+ L1:"push" << LineNum = L1->getLine(); PackAction = VFR_PACK_PUSH; >>
+ | L2:"pop" << LineNum = L2->getLine(); PackAction = VFR_PACK_POP; >>
+ )
+ {
+ "," ID:StringIdentifier << Identifier = ID->getText(); >>
+ }
+ {
+ "," N:Number << PackAction |= VFR_PACK_ASSIGN; PackNumber = _STOU32(N->getText(), N->getLine()); >>
+ }
+ << gCVfrVarDataTypeDB.Pack (LineNum, PackAction, Identifier, PackNumber); >>
+ ;
+
+pragmaPackNumber :
+ <<
+ UINT32 LineNum;
+ UINT32 PackNumber = DEFAULT_PACK_ALIGN;
+ >>
+ N:Number << LineNum = N->getLine(); PackNumber = _STOU32(N->getText(), N->getLine()); >>
+ << gCVfrVarDataTypeDB.Pack (LineNum, VFR_PACK_ASSIGN, NULL, PackNumber); >>
+ ;
+
+vfrPragmaPackDefinition :
+ "\#pragma" "pack" "\("
+ {
+ pragmaPackShowDef
+ | pragmaPackStackDef
+ | pragmaPackNumber
+ }
+ "\)"
+ ;
+
+ vfrDataUnionDefinition :
+ { TypeDef } Union << gCVfrVarDataTypeDB.DeclareDataTypeBegin (); >>
+ { NonNvDataMap }
+ {
+ N1:StringIdentifier << _PCATCH(gCVfrVarDataTypeDB.SetNewTypeName (N1->getText()), N1); >>
+ }
+ OpenBrace
+ vfrDataStructFields[TRUE]
+ CloseBrace
+ {
+ N2:StringIdentifier << _PCATCH(gCVfrVarDataTypeDB.SetNewTypeName (N2->getText()), N2); >>
+ }
+ ";" << gCVfrVarDataTypeDB.DeclareDataTypeEnd ();>>
+ ;
+
+vfrDataStructDefinition :
+ { TypeDef } Struct << gCVfrVarDataTypeDB.DeclareDataTypeBegin (); >>
+ { NonNvDataMap }
+ {
+ N1:StringIdentifier << _PCATCH(gCVfrVarDataTypeDB.SetNewTypeName (N1->getText()), N1); >>
+ }
+ OpenBrace
+ vfrDataStructFields[FALSE]
+ CloseBrace
+ {
+ N2:StringIdentifier << _PCATCH(gCVfrVarDataTypeDB.SetNewTypeName (N2->getText()), N2); >>
+ }
+ ";" << gCVfrVarDataTypeDB.DeclareDataTypeEnd (); >>
+ ;
+
+vfrDataStructFields [BOOLEAN FieldInUnion]:
+ (
+ dataStructField64 [FieldInUnion] |
+ dataStructField32 [FieldInUnion] |
+ dataStructField16 [FieldInUnion] |
+ dataStructField8 [FieldInUnion] |
+ dataStructFieldBool [FieldInUnion] |
+ dataStructFieldString [FieldInUnion]|
+ dataStructFieldDate [FieldInUnion] |
+ dataStructFieldTime [FieldInUnion] |
+ dataStructFieldRef [FieldInUnion] |
+ dataStructFieldUser [FieldInUnion] |
+ dataStructBitField64 [FieldInUnion] |
+ dataStructBitField32 [FieldInUnion] |
+ dataStructBitField16 [FieldInUnion] |
+ dataStructBitField8 [FieldInUnion]
+ )*
+ ;
+
+dataStructField64 [BOOLEAN FieldInUnion]:
+ << UINT32 ArrayNum = 0; >>
+ D:"UINT64"
+ N:StringIdentifier
+ {
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum, FieldInUnion), N); >>
+ ;
+
+dataStructField32 [BOOLEAN FieldInUnion]:
+ << UINT32 ArrayNum = 0; >>
+ D:"UINT32"
+ N:StringIdentifier
+ {
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum, FieldInUnion), N); >>
+ ;
+
+dataStructField16 [BOOLEAN FieldInUnion]:
+ <<
+ UINT32 ArrayNum = 0;
+ >>
+ ("UINT16" | "CHAR16")
+ N:StringIdentifier
+ {
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), (CHAR8 *) "UINT16", ArrayNum, FieldInUnion), N); >>
+ ;
+
+dataStructField8 [BOOLEAN FieldInUnion]:
+ << UINT32 ArrayNum = 0; >>
+ D:"UINT8"
+ N:StringIdentifier
+ {
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum, FieldInUnion), N); >>
+ ;
+
+dataStructFieldBool [BOOLEAN FieldInUnion]:
+ << UINT32 ArrayNum = 0; >>
+ D:"BOOLEAN"
+ N:StringIdentifier
+ {
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum, FieldInUnion), N); >>
+ ;
+
+dataStructFieldString [BOOLEAN FieldInUnion]:
+ << UINT32 ArrayNum = 0; >>
+ D:"EFI_STRING_ID"
+ N:StringIdentifier
+ {
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum, FieldInUnion), N); >>
+ ;
+
+dataStructFieldDate [BOOLEAN FieldInUnion]:
+ << UINT32 ArrayNum = 0; >>
+ D:"EFI_HII_DATE"
+ N:StringIdentifier
+ {
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum, FieldInUnion), N); >>
+ ;
+
+dataStructFieldTime [BOOLEAN FieldInUnion]:
+ << UINT32 ArrayNum = 0; >>
+ D:"EFI_HII_TIME"
+ N:StringIdentifier
+ {
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum, FieldInUnion), N); >>
+ ;
+
+dataStructFieldRef [BOOLEAN FieldInUnion]:
+ << UINT32 ArrayNum = 0; >>
+ D:"EFI_HII_REF"
+ N:StringIdentifier
+ {
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum, FieldInUnion), N); >>
+ ;
+
+dataStructFieldUser [BOOLEAN FieldInUnion]:
+ << UINT32 ArrayNum = 0; >>
+ T:StringIdentifier
+ N:StringIdentifier
+ {
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), T->getText(), ArrayNum, FieldInUnion), T); >>
+ ;
+
+dataStructBitField64[BOOLEAN FieldInUnion]:
+ <<
+ UINT32 Width = 0;
+ BOOLEAN HasBitFieldName = FALSE;
+ >>
+ D:"UINT64"
+ {
+ N:StringIdentifier << HasBitFieldName = TRUE;>>
+ }
+ ":" I:Number << Width = _STOU32(I->getText(), I->getLine());>>
+
+ ";" << if (HasBitFieldName) {
+ _PCATCH(gCVfrVarDataTypeDB.DataTypeAddBitField (N->getText(), D->getText(), Width, FieldInUnion), N);
+ } else {
+ _PCATCH(gCVfrVarDataTypeDB.DataTypeAddBitField (NULL, D->getText(), Width, FieldInUnion), D);
+ }
+ >>
+ ;
+
+dataStructBitField32[BOOLEAN FieldInUnion]:
+ <<
+ UINT32 Width = 0;
+ BOOLEAN HasBitFieldName = FALSE;
+ >>
+ D:"UINT32"
+ {
+ N:StringIdentifier << HasBitFieldName = TRUE;>>
+ }
+
+ ":" I:Number << Width = _STOU32(I->getText(), I->getLine());>>
+
+ ";" << if (HasBitFieldName) {
+ _PCATCH(gCVfrVarDataTypeDB.DataTypeAddBitField (N->getText(), D->getText(), Width, FieldInUnion), N);
+ } else {
+ _PCATCH(gCVfrVarDataTypeDB.DataTypeAddBitField (NULL, D->getText(), Width, FieldInUnion), D);
+ }
+ >>
+ ;
+
+dataStructBitField16[BOOLEAN FieldInUnion]:
+ <<
+ UINT32 Width = 0;
+ BOOLEAN HasBitFieldName = FALSE;
+ >>
+ D:"UINT16"
+ {
+ N:StringIdentifier << HasBitFieldName = TRUE;>>
+ }
+ ":" I:Number << Width = _STOU32(I->getText(), I->getLine());>>
+
+ ";" << if (HasBitFieldName) {
+ _PCATCH(gCVfrVarDataTypeDB.DataTypeAddBitField (N->getText(), D->getText(), Width, FieldInUnion), N);
+ } else {
+ _PCATCH(gCVfrVarDataTypeDB.DataTypeAddBitField (NULL, D->getText(), Width, FieldInUnion), D);
+ }
+ >>
+ ;
+
+dataStructBitField8[BOOLEAN FieldInUnion]:
+ <<
+ UINT32 Width = 0;
+ BOOLEAN HasBitFieldName = FALSE;
+ >>
+ D:"UINT8"
+ {
+ N:StringIdentifier << HasBitFieldName = TRUE;>>
+ }
+ ":" I:Number << Width = _STOU32(I->getText(), I->getLine());>>
+
+ ";" << if (HasBitFieldName) {
+ _PCATCH(gCVfrVarDataTypeDB.DataTypeAddBitField (N->getText(), D->getText(), Width, FieldInUnion), N);
+ } else {
+ _PCATCH(gCVfrVarDataTypeDB.DataTypeAddBitField (NULL, D->getText(), Width, FieldInUnion), D);
+ }
+ >>
+ ;
+
+//*****************************************************************************
+//
+// the syntax of GUID definition
+//
+guidSubDefinition [EFI_GUID &Guid] :
+ G4:Number "," G5:Number "," G6:Number "," G7:Number "," G8:Number "," G9:Number "," G10:Number "," G11:Number
+ <<
+ Guid.Data4[0] = _STOU8(G4->getText(), G4->getLine());
+ Guid.Data4[1] = _STOU8(G5->getText(), G5->getLine());
+ Guid.Data4[2] = _STOU8(G6->getText(), G6->getLine());
+ Guid.Data4[3] = _STOU8(G7->getText(), G7->getLine());
+ Guid.Data4[4] = _STOU8(G8->getText(), G8->getLine());
+ Guid.Data4[5] = _STOU8(G9->getText(), G9->getLine());
+ Guid.Data4[6] = _STOU8(G10->getText(), G10->getLine());
+ Guid.Data4[7] = _STOU8(G11->getText(), G11->getLine());
+ >>
+ ;
+
+guidDefinition [EFI_GUID &Guid] :
+ OpenBrace
+ G1:Number "," G2:Number "," G3:Number ","
+ <<
+ Guid.Data1 = _STOU32 (G1->getText(), G1->getLine());
+ Guid.Data2 = _STOU16 (G2->getText(), G2->getLine());
+ Guid.Data3 = _STOU16 (G3->getText(), G3->getLine());
+ >>
+ (
+ OpenBrace guidSubDefinition[Guid] CloseBrace
+ | guidSubDefinition[Guid]
+ )
+ CloseBrace
+ ;
+
+//*****************************************************************************
+//
+// the syntax of form set definition
+//
+vfrFormSetDefinition :
+ <<
+ EFI_GUID Guid;
+ EFI_GUID DefaultClassGuid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID;
+ EFI_GUID ClassGuid1, ClassGuid2, ClassGuid3;
+ UINT8 ClassGuidNum = 0;
+ CIfrFormSet *FSObj = NULL;
+ UINT16 C, SC;
+ CHAR8* InsertOpcodeAddr = NULL;
+ >>
+ L:FormSet
+ Uuid "=" guidDefinition[Guid] ","
+ Title "=" "STRING_TOKEN" "\(" S1:Number "\)" ","
+ Help "=" "STRING_TOKEN" "\(" S2:Number "\)" ","
+ {
+ ClassGuid "=" guidDefinition[ClassGuid1] << ++ClassGuidNum; >>
+ {
+ "\|" guidDefinition[ClassGuid2] << ++ClassGuidNum; >>
+ {
+ "\|" guidDefinition[ClassGuid3] << ++ClassGuidNum; >>
+ }
+ }
+ ","
+ }
+ <<
+ if (mOverrideClassGuid != NULL && ClassGuidNum >= 3) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Already has 3 class guids, can't add extra class guid!");
+ }
+ switch (ClassGuidNum) {
+ case 0:
+ if (mOverrideClassGuid != NULL) {
+ ClassGuidNum = 2;
+ } else {
+ ClassGuidNum = 1;
+ }
+ FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
+ FSObj->SetClassGuid(&DefaultClassGuid);
+ if (mOverrideClassGuid != NULL) {
+ FSObj->SetClassGuid(mOverrideClassGuid);
+ }
+ break;
+ case 1:
+ if (mOverrideClassGuid != NULL) {
+ ClassGuidNum ++;
+ }
+ FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
+ FSObj->SetClassGuid(&ClassGuid1);
+ if (mOverrideClassGuid != NULL) {
+ FSObj->SetClassGuid(mOverrideClassGuid);
+ }
+ break;
+ case 2:
+ if (mOverrideClassGuid != NULL) {
+ ClassGuidNum ++;
+ }
+ FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
+ FSObj->SetClassGuid(&ClassGuid1);
+ FSObj->SetClassGuid(&ClassGuid2);
+ if (mOverrideClassGuid != NULL) {
+ FSObj->SetClassGuid(mOverrideClassGuid);
+ }
+ break;
+ case 3:
+ FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
+ FSObj->SetClassGuid(&ClassGuid1);
+ FSObj->SetClassGuid(&ClassGuid2);
+ FSObj->SetClassGuid(&ClassGuid3);
+ break;
+ default:
+ break;
+ }
+
+ SET_LINE_INFO (*FSObj, L);
+ FSObj->SetGuid (&Guid);
+ FSObj->SetFormSetTitle (_STOSID(S1->getText(), S1->getLine()));
+ FSObj->SetHelp (_STOSID(S2->getText(), S2->getLine()));
+ >>
+ {
+ FC:Class "=" classDefinition[C] "," << {CIfrClass CObj;SET_LINE_INFO (CObj, FC); CObj.SetClass(C);} >>
+ }
+ {
+ FSC:Subclass "=" subclassDefinition[SC] "," << {CIfrSubClass SCObj; SET_LINE_INFO (SCObj, FSC); SCObj.SetSubClass(SC);} >>
+ }
+ <<
+ _DeclareStandardDefaultStorage (GET_LINENO (L));
+ >>
+ vfrFormSetList
+ E:EndFormSet <<
+ //
+ // Declare undefined Question so that they can be used in expression.
+ //
+ if (gCFormPkg.HavePendingUnassigned()) {
+ mParserStatus += gCFormPkg.DeclarePendingQuestion (
+ gCVfrVarDataTypeDB,
+ gCVfrDataStorage,
+ mCVfrQuestionDB,
+ &mFormsetGuid,
+ E->getLine(),
+ &InsertOpcodeAddr
+ );
+ gNeedAdjustOpcode = TRUE;
+ }
+
+ CRT_END_OP (E);
+
+ //
+ // Adjust the pending question position.
+ // Move the position from current to before the end of the last form in the form set.
+ //
+ if (gNeedAdjustOpcode) {
+ gCFormPkg.AdjustDynamicInsertOpcode (
+ mLastFormEndAddr,
+ InsertOpcodeAddr,
+ FALSE
+ );
+ }
+
+ if (FSObj != NULL) {
+ delete FSObj;
+ }
+ >>
+ ";"
+ ;
+
+vfrFormSetList :
+ (
+ vfrFormDefinition |
+ vfrFormMapDefinition |
+ vfrStatementImage |
+ vfrStatementVarStoreLinear |
+ vfrStatementVarStoreEfi |
+ vfrStatementVarStoreNameValue |
+ vfrStatementDefaultStore |
+ vfrStatementDisableIfFormSet |
+ vfrStatementSuppressIfFormSet |
+ vfrStatementExtension
+ )*
+ ;
+
+vfrStatementExtension:
+ <<
+ EFI_GUID Guid;
+ CIfrGuid *GuidObj = NULL;
+ CHAR8 *TypeName = NULL;
+ UINT32 TypeSize = 0;
+ UINT8 *DataBuff = NULL;
+ UINT32 Size = 0;
+ UINT8 Idx = 0;
+ UINT32 LineNum;
+ BOOLEAN IsStruct = FALSE;
+ UINT32 ArrayNum = 0;
+ >>
+ L:GuidOp
+ Uuid "=" guidDefinition[Guid]
+ {"," DataType "="
+ (
+ U64:"UINT64" {OpenBracket AN1:Number CloseBracket <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>}
+ << TypeName = U64->getText(); LineNum = U64->getLine(); >>
+ | U32:"UINT32" {OpenBracket AN2:Number CloseBracket <<ArrayNum = _STOU32(AN2->getText(), AN2->getLine());>>}
+ << TypeName = U32->getText(); LineNum = U32->getLine(); >>
+ | U16:"UINT16" {OpenBracket AN3:Number CloseBracket <<ArrayNum = _STOU32(AN3->getText(), AN3->getLine());>>}
+ << TypeName = U16->getText(); LineNum = U16->getLine(); >>
+ | U8:"UINT8" {OpenBracket AN4:Number CloseBracket <<ArrayNum = _STOU32(AN4->getText(), AN4->getLine());>>}
+ << TypeName = U8->getText(); LineNum = U8->getLine(); >>
+ | BL:"BOOLEAN" {OpenBracket AN5:Number CloseBracket <<ArrayNum = _STOU32(AN5->getText(), AN5->getLine());>>}
+ << TypeName = BL->getText(); LineNum = BL->getLine(); >>
+ | SI:"EFI_STRING_ID" {OpenBracket AN6:Number CloseBracket <<ArrayNum = _STOU32(AN6->getText(), AN6->getLine());>>}
+ << TypeName = SI->getText(); LineNum = SI->getLine(); >>
+ | D:"EFI_HII_DATE" {OpenBracket AN7:Number CloseBracket <<ArrayNum = _STOU32(AN7->getText(), AN7->getLine());>>}
+ << TypeName = D->getText(); LineNum = D->getLine(); IsStruct = TRUE;>>
+ | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket <<ArrayNum = _STOU32(AN8->getText(), AN8->getLine());>>}
+ << TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
+ | R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = _STOU32(AN9->getText(), AN9->getLine());>>}
+ << TypeName = R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
+ | TN:StringIdentifier {OpenBracket AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(), AN10->getLine());>>}
+ << TypeName = TN->getText(); LineNum = TN->getLine(); IsStruct = TRUE;>>
+ )
+ <<
+ _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &TypeSize), LineNum);
+ if (ArrayNum > 0) {
+ Size = TypeSize*ArrayNum;
+ } else {
+ Size = TypeSize;
+ }
+ if (Size > (128 - sizeof (EFI_IFR_GUID))) return;
+ DataBuff = (UINT8 *)malloc(Size);
+ for (Idx = 0; Idx < Size; Idx++) {
+ DataBuff[Idx] = 0;
+ }
+ >>
+ vfrExtensionData [DataBuff, Size, TypeName, TypeSize, IsStruct, ArrayNum]
+ }
+ <<
+ {
+ GuidObj = new CIfrGuid(Size);
+ if (GuidObj != NULL) {
+ GuidObj->SetLineNo(L->getLine());
+ GuidObj->SetGuid (&Guid);
+ }
+ }
+ if (TypeName != NULL) {
+ GuidObj->SetData(DataBuff, Size);
+ }
+ >>
+ {","
+ (
+ vfrStatementExtension
+ )*
+ E:EndGuidOp << GuidObj->SetScope(1); CRT_END_OP (E); >>
+ }
+ <<
+ if (GuidObj != NULL) delete GuidObj;
+ if (DataBuff != NULL) free(DataBuff);
+ >>
+ ";"
+;
+
+vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 TypeSize, BOOLEAN IsStruct, UINT32 ArrayNum]:
+ <<
+ CHAR8 *TFName = NULL;
+ UINT32 ArrayIdx = 0;
+ UINT16 FieldOffset;
+ UINT8 FieldType;
+ UINT32 FieldSize;
+ UINT64 Data_U64 = 0;
+ UINT32 Data_U32 = 0;
+ UINT16 Data_U16 = 0;
+ UINT8 Data_U8 = 0;
+ BOOLEAN Data_BL = 0;
+ EFI_STRING_ID Data_SID = 0;
+ BOOLEAN IsArray = FALSE;
+ UINT8 *ByteOffset = NULL;
+ BOOLEAN BitField = FALSE;
+ UINT64 Value;
+ UINT64 Mask;
+ UINT16 Offset;
+ UINT8 PreBits;
+ >>
+(
+ ("," "data" {OpenBracket IDX1:Number CloseBracket <<IsArray = TRUE;>>}
+ <<
+ ArrayIdx = 0;
+ if (IsArray == TRUE) {
+ ArrayIdx = _STOU8(IDX1->getText(), IDX1->getLine());
+ if (ArrayIdx >= ArrayNum) return;
+ IsArray = FALSE;
+ }
+ ByteOffset = DataBuff + (ArrayIdx * TypeSize);
+ if (IsStruct == TRUE) {
+ _STRCAT(&TFName, TypeName);
+ }
+ >>
+ ("." FN:StringIdentifier
+ <<
+ if (IsStruct == TRUE) {
+ _STRCAT(&TFName, ".");
+ _STRCAT(&TFName, FN->getText());
+ }
+ >>
+ {
+ OpenBracket IDX2:Number CloseBracket
+ <<
+ if (IsStruct == TRUE) {
+ _STRCAT(&TFName, "[");
+ _STRCAT(&TFName, IDX2->getText());
+ _STRCAT(&TFName, "]");
+ }
+ >>
+ }
+ )*
+ "=" RD:Number
+ <<
+ if (IsStruct == FALSE) {
+ if (strcmp ("UINT64", TypeName) == 0) {
+ Data_U64 = _STOU64(RD->getText(), RD->getLine());
+ memcpy (ByteOffset, &Data_U64, TypeSize);
+ }else if (strcmp ("UINT32", TypeName) == 0) {
+ Data_U32 = _STOU32(RD->getText(), RD->getLine());
+ memcpy (ByteOffset, &Data_U32, TypeSize);
+ }else if (strcmp ("UINT16", TypeName) == 0) {
+ Data_U16 = _STOU16(RD->getText(), RD->getLine());
+ memcpy (ByteOffset, &Data_U16, TypeSize);
+ }else if (strcmp ("UINT8", TypeName) == 0) {
+ Data_U8 = _STOU8(RD->getText(), RD->getLine());
+ memcpy (ByteOffset, &Data_U8, TypeSize);
+ }else if (strcmp ("BOOLEAN", TypeName)== 0) {
+ Data_BL = _STOU8(RD->getText(), RD->getLine());
+ memcpy (ByteOffset, &Data_BL, TypeSize);
+ }else if (strcmp ("EFI_STRING_ID", TypeName) == 0) {
+ Data_SID = _STOSID(RD->getText(), RD->getLine());
+ memcpy (ByteOffset, &Data_SID, TypeSize);
+ }
+ } else {
+ gCVfrVarDataTypeDB.GetDataFieldInfo(TFName, FieldOffset, FieldType, FieldSize, BitField);
+ if (BitField) {
+ Mask = (1 << FieldSize) - 1;
+ Offset = FieldOffset / 8;
+ PreBits = FieldOffset % 8;
+ Mask <<= PreBits;
+ }
+ switch (FieldType) {
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ Data_U8 = _STOU8(RD->getText(), RD->getLine());
+ if (BitField) {
+ //
+ // Set the value to the bit fileds.
+ //
+ Value = *(UINT8*) (ByteOffset + Offset);
+ Data_U8 <<= PreBits;
+ Value = (Value & (~Mask)) | Data_U8;
+ memcpy (ByteOffset + Offset, &Value, sizeof (UINT8));
+ } else {
+ memcpy (ByteOffset + FieldOffset, &Data_U8, FieldSize);
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ Data_U16 = _STOU16(RD->getText(), RD->getLine());
+ if (BitField) {
+ //
+ // Set the value to the bit fileds.
+ //
+ Value = *(UINT16*) (ByteOffset + Offset);
+ Data_U16 <<= PreBits;
+ Value = (Value & (~Mask)) | Data_U16;
+ memcpy (ByteOffset + Offset, &Value, sizeof (UINT16));
+ } else {
+ memcpy (ByteOffset + FieldOffset, &Data_U16, FieldSize);
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ Data_U32 = _STOU32(RD->getText(), RD->getLine());
+ if (BitField) {
+ //
+ // Set the value to the bit fileds.
+ //
+ Value = *(UINT32*) (ByteOffset + Offset);
+ Data_U32 <<= PreBits;
+ Value = (Value & (~Mask)) | Data_U32;
+ memcpy (ByteOffset + Offset, &Value, sizeof (UINT32));
+ } else {
+ memcpy (ByteOffset + FieldOffset, &Data_U32, FieldSize);
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ Data_U64 = _STOU64(RD->getText(), RD->getLine());
+ if (BitField) {
+ //
+ // Set the value to the bit fileds.
+ //
+ Value = *(UINT64*) (ByteOffset + Offset);
+ Data_U64 <<= PreBits;
+ Value = (Value & (~Mask)) | Data_U64;
+ memcpy (ByteOffset + Offset, &Value, sizeof (UINT64));
+ } else {
+ memcpy (ByteOffset + FieldOffset, &Data_U64, FieldSize);
+ }
+ break;
+ case EFI_IFR_TYPE_BOOLEAN:
+ Data_BL = _STOU8(RD->getText(), RD->getLine());
+ memcpy (ByteOffset + FieldOffset, &Data_BL, FieldSize);
+ break;
+ case EFI_IFR_TYPE_STRING:
+ Data_SID = _STOSID(RD->getText(), RD->getLine());
+ memcpy (ByteOffset + FieldOffset, &Data_SID, FieldSize);
+ break;
+ default:
+ break;
+ }
+ }
+ if (TFName != NULL) { delete[] TFName; TFName = NULL; }
+ >>
+ )*
+)
+;
+
+
+vfrStatementDefaultStore :
+ << UINT16 DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD; >>
+ D:DefaultStore N:StringIdentifier ","
+ Prompt "=" "STRING_TOKEN" "\(" S:Number "\)"
+ {
+ "," Attribute "=" A:Number << DefaultId = _STOU16(A->getText(), A->getLine()); >>
+ }
+ <<
+ if (gCVfrDefaultStore.DefaultIdRegistered (DefaultId) == FALSE) {
+ CIfrDefaultStore DSObj;
+ _PCATCH(gCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr<CHAR8>(), N->getText(), _STOSID(S->getText(), S->getLine()), DefaultId)), D->getLine();
+ DSObj.SetLineNo(D->getLine());
+ DSObj.SetDefaultName (_STOSID(S->getText(), S->getLine()));
+ DSObj.SetDefaultId (DefaultId);
+ } else {
+ _PCATCH(gCVfrDefaultStore.ReRegisterDefaultStoreById (DefaultId, N->getText(), _STOSID(S->getText(), S->getLine()))), D->getLine();
+ }
+ >>
+ ";"
+ ;
+
+vfrStatementVarStoreLinear :
+ <<
+ EFI_GUID Guid;
+ CIfrVarStore VSObj;
+ CHAR8 *TypeName;
+ CHAR8 *StoreName;
+ UINT32 LineNum;
+ EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
+ UINT32 Size;
+ BOOLEAN IsBitVarStore = FALSE;
+ >>
+ V:Varstore << VSObj.SetLineNo(V->getLine()); >>
+ (
+ TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); IsBitVarStore = gCVfrVarDataTypeDB.DataTypeHasBitField (TN->getText());>>
+ | U8:"UINT8" "," << TypeName = U8->getText(); LineNum = U8->getLine(); >>
+ | U16:"UINT16" "," << TypeName = U16->getText(); LineNum = U16->getLine(); >>
+ | C16:"CHAR16" "," << TypeName = (CHAR8 *) "UINT16"; LineNum = C16->getLine(); >>
+ | U32:"UINT32" "," << TypeName = U32->getText(); LineNum = U32->getLine(); >>
+ | U64:"UINT64" "," << TypeName = U64->getText(); LineNum = U64->getLine(); >>
+ | D:"EFI_HII_DATE" "," << TypeName = D->getText(); LineNum = D->getLine(); >>
+ | T:"EFI_HII_TIME" "," << TypeName = T->getText(); LineNum = T->getLine(); >>
+ | R:"EFI_HII_REF" "," << TypeName = R->getText(); LineNum = R->getLine(); >>
+ )
+ {
+ VarId "=" ID:Number "," <<
+ _PCATCH(
+ (INTN)(VarStoreId = _STOU16(ID->getText(), ID->getLine())) != 0,
+ (INTN)TRUE,
+ ID,
+ "varid 0 is not allowed."
+ );
+ >>
+ }
+ Name "=" SN:StringIdentifier ","
+ Uuid "=" guidDefinition[Guid]
+ <<
+
+ StoreName = SN->getText();
+ _PCATCH(gCVfrDataStorage.DeclareBufferVarStore (
+ StoreName,
+ &Guid,
+ &gCVfrVarDataTypeDB,
+ TypeName,
+ VarStoreId,
+ IsBitVarStore
+ ), LineNum);
+ VSObj.SetGuid (&Guid);
+ _PCATCH(gCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId, &Guid), SN);
+ VSObj.SetVarStoreId (VarStoreId);
+ _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);
+ VSObj.SetSize ((UINT16) Size);
+ VSObj.SetName (SN->getText());
+ >>
+ ";"
+ ;
+
+vfrStatementVarStoreEfi :
+ <<
+ BOOLEAN IsUEFI23EfiVarstore = TRUE;
+ EFI_GUID Guid;
+ CIfrVarStoreEfi VSEObj;
+ EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
+ UINT32 Attr = 0;
+ UINT32 Size;
+ CHAR8 *TypeName;
+ UINT32 LineNum;
+ CHAR8 *StoreName = NULL;
+ BOOLEAN CustomizedName = FALSE;
+ BOOLEAN IsBitVarStore = FALSE;
+ >>
+ E:Efivarstore << VSEObj.SetLineNo(E->getLine()); >>
+ (
+ TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); CustomizedName = TRUE; IsBitVarStore = gCVfrVarDataTypeDB.DataTypeHasBitField (TN->getText());>>
+ | U8:"UINT8" "," << TypeName = U8->getText(); LineNum = U8->getLine(); >>
+ | U16:"UINT16" "," << TypeName = U16->getText(); LineNum = U16->getLine(); >>
+ | C16:"CHAR16" "," << TypeName = (CHAR8 *) "UINT16"; LineNum = C16->getLine(); >>
+ | U32:"UINT32" "," << TypeName = U32->getText(); LineNum = U32->getLine(); >>
+ | U64:"UINT64" "," << TypeName = U64->getText(); LineNum = U64->getLine(); >>
+ | D:"EFI_HII_DATE" "," << TypeName = D->getText(); LineNum = D->getLine(); >>
+ | T:"EFI_HII_TIME" "," << TypeName = T->getText(); LineNum = T->getLine(); >>
+ | R:"EFI_HII_REF" "," << TypeName = R->getText(); LineNum = R->getLine(); >>
+ )
+ {
+ VarId "=" ID:Number "," <<
+ _PCATCH(
+ (INTN)(VarStoreId = _STOU16(ID->getText(), ID->getLine())) != 0,
+ (INTN)TRUE,
+ ID,
+ "varid 0 is not allowed."
+ );
+ >>
+ }
+ Attribute "=" vfrVarStoreEfiAttr[Attr] ( "\|" vfrVarStoreEfiAttr[Attr] )* ","
+ << VSEObj.SetAttributes (Attr); >>
+
+ (
+ Name "=" SN:StringIdentifier "," << StoreName = SN->getText(); >>
+ |
+ Name "=" "STRING_TOKEN" "\(" VN:Number "\)" ","
+ VarSize "=" N:Number "," <<
+ IsUEFI23EfiVarstore = FALSE;
+ StoreName = gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(), VN->getLine()));
+ if (StoreName == NULL) {
+ _PCATCH (VFR_RETURN_UNSUPPORTED, VN->getLine(), "Can't get varstore name for this StringId!");
+ }
+ if (!CustomizedName) {
+ _PCATCH (VFR_RETURN_UNSUPPORTED, E->getLine(), "Old style efivarstore must have String Identifier!");
+ return;
+ }
+ Size = _STOU32(N->getText(), N->getLine());
+ switch (Size) {
+ case 1:
+ TypeName = (CHAR8 *) "UINT8";
+ break;
+ case 2:
+ TypeName = (CHAR8 *) "UINT16";
+ break;
+ case 4:
+ TypeName = (CHAR8 *) "UINT32";
+ break;
+ case 8:
+ TypeName = (CHAR8 *) "UINT64";
+ break;
+ default:
+ _PCATCH (VFR_RETURN_UNSUPPORTED, N);
+ break;
+ }
+ >>
+ )
+
+ Uuid "=" guidDefinition[Guid] <<
+ if (IsUEFI23EfiVarstore) {
+ _PCATCH(gCVfrDataStorage.DeclareBufferVarStore (
+ StoreName,
+ &Guid,
+ &gCVfrVarDataTypeDB,
+ TypeName,
+ VarStoreId,
+ IsBitVarStore
+ ), LineNum);
+ _PCATCH(gCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId, &Guid), SN);
+ _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);
+ } else {
+ _PCATCH(gCVfrDataStorage.DeclareBufferVarStore (
+ TN->getText(),
+ &Guid,
+ &gCVfrVarDataTypeDB,
+ TypeName,
+ VarStoreId,
+ FALSE
+ ), LineNum);
+ _PCATCH(gCVfrDataStorage.GetVarStoreId(TN->getText(), &VarStoreId, &Guid), VN);
+ _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), N->getLine());
+ }
+ VSEObj.SetGuid (&Guid);
+ VSEObj.SetVarStoreId (VarStoreId);
+
+ VSEObj.SetSize ((UINT16) Size);
+ VSEObj.SetName (StoreName);
+ if (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {
+ delete[] StoreName;
+ }
+ >>
+ ";"
+ ;
+
+vfrVarStoreEfiAttr [UINT32 & Attr] :
+ N:Number << $Attr |= _STOU32(N->getText(), N->getLine()); >>
+ ;
+
+vfrStatementVarStoreNameValue :
+ <<
+ EFI_GUID Guid;
+ CIfrVarStoreNameValue VSNVObj;
+ EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
+ BOOLEAN Created = FALSE;
+ >>
+ L:NameValueVarStore << VSNVObj.SetLineNo(L->getLine()); >>
+ SN:StringIdentifier ","
+ {
+ VarId "=" ID:Number "," <<
+ _PCATCH(
+ (INTN)(VarStoreId = _STOU16(ID->getText(), ID->getLine())) != 0,
+ (INTN)TRUE,
+ ID,
+ "varid 0 is not allowed."
+ );
+ >>
+ }
+ (
+ Name "=" "STRING_TOKEN" "\(" N:Number "\)" "," <<
+ if (!Created) {
+ _PCATCH(gCVfrDataStorage.DeclareNameVarStoreBegin (SN->getText(), VarStoreId), SN);
+ Created = TRUE;
+ }
+ _PCATCH(gCVfrDataStorage.NameTableAddItem (_STOSID(N->getText(), N->getLine())), SN);
+ >>
+ )+
+ Uuid "=" guidDefinition[Guid] << _PCATCH(gCVfrDataStorage.DeclareNameVarStoreEnd (&Guid), SN); >>
+ <<
+ VSNVObj.SetGuid (&Guid);
+ _PCATCH(gCVfrDataStorage.GetVarStoreId(SN->getText(), &VarStoreId, &Guid), SN);
+ VSNVObj.SetVarStoreId (VarStoreId);
+ >>
+ ";"
+ ;
+
+//
+// keep classDefinition and validClassNames for compatibility but not generate
+// any IFR object
+//
+classDefinition[UINT16 & Class] :
+ << $Class = 0; >>
+ validClassNames[$Class] ( "\|" validClassNames[$Class] )*
+ ;
+
+validClassNames[UINT16 & Class] :
+ ClassNonDevice << $Class |= EFI_NON_DEVICE_CLASS; >>
+ | ClassDiskDevice << $Class |= EFI_DISK_DEVICE_CLASS; >>
+ | ClassVideoDevice << $Class |= EFI_VIDEO_DEVICE_CLASS; >>
+ | ClassNetworkDevice << $Class |= EFI_NETWORK_DEVICE_CLASS; >>
+ | ClassInputDevice << $Class |= EFI_INPUT_DEVICE_CLASS; >>
+ | ClassOnBoardDevice << $Class |= EFI_ON_BOARD_DEVICE_CLASS; >>
+ | ClassOtherDevice << $Class |= EFI_OTHER_DEVICE_CLASS; >>
+ | N:Number << $Class |= _STOU16(N->getText(), N->getLine()); >>
+ ;
+
+subclassDefinition[UINT16 & SubClass] :
+ << $SubClass = 0; >>
+ SubclassSetupApplication << $SubClass |= EFI_SETUP_APPLICATION_SUBCLASS; >>
+ | SubclassGeneralApplication << $SubClass |= EFI_GENERAL_APPLICATION_SUBCLASS; >>
+ | SubclassFrontPage << $SubClass |= EFI_FRONT_PAGE_SUBCLASS; >>
+ | SubclassSingleUse << $SubClass |= EFI_SINGLE_USE_SUBCLASS; >>
+ | N:Number << $SubClass |= _STOU16(N->getText(), N->getLine()); >>
+ ;
+
+vfrStatementDisableIfFormSet :
+ <<
+ CIfrDisableIf DIObj;
+ mConstantOnlyInExpression = TRUE;
+ >>
+ D:DisableIf << DIObj.SetLineNo(D->getLine()); >>
+ vfrStatementExpression[0] ";" << mConstantOnlyInExpression = FALSE; >>
+ vfrFormSetList
+ E:EndIf << CRT_END_OP (E); >>
+ ";"
+ ;
+
+vfrStatementSuppressIfFormSet :
+ << CIfrSuppressIf SIObj;>>
+ L:SuppressIf <<
+ SIObj.SetLineNo(L->getLine());
+ >>
+ { FLAGS "=" flagsField ( "\|" flagsField )* "," }
+ vfrStatementExpression[0] ";"
+ vfrFormSetList
+ E: EndIf
+ ";" << CRT_END_OP (E); >>
+ ;
+
+//*****************************************************************************
+//
+// the syntax of question header and statement header
+//
+vfrStatementHeader[CIfrStatementHeader *SHObj] :
+ Prompt "=" "STRING_TOKEN" "\(" S1:Number "\)" "," << $SHObj->SetPrompt (_STOSID(S1->getText(), S1->getLine())); >>
+ Help "=" "STRING_TOKEN" "\(" S2:Number "\)" << $SHObj->SetHelp (_STOSID(S2->getText(), S2->getLine())); >>
+ ;
+
+vfrQuestionBaseInfo[EFI_VARSTORE_INFO & Info, EFI_QUESTION_ID & QId, EFI_QUESION_TYPE QType = QUESTION_NORMAL]:
+ <<
+ CHAR8 *QName = NULL;
+ CHAR8 *VarIdStr = NULL;
+ mUsedDefaultCount = 0;
+ >>
+ {
+ Name "=" QN:StringIdentifier "," <<
+ QName = QN->getText();
+ _PCATCH(mCVfrQuestionDB.FindQuestion (QName), VFR_RETURN_UNDEFINED, QN, "has already been used please used anther name");
+ >>
+ }
+ { V:VarId "=" vfrStorageVarId[Info, VarIdStr] "," }
+ {
+ QuestionId "=" ID:Number "," <<
+ QId = _STOQID(ID->getText(), ID->getLine());
+ _PCATCH(mCVfrQuestionDB.FindQuestion (QId), VFR_RETURN_UNDEFINED, ID, "has already been used please assign another number");
+ >>
+ }
+ <<
+ switch (QType) {
+ case QUESTION_NORMAL:
+ mCVfrQuestionDB.RegisterQuestion (QName, VarIdStr, QId);
+ break;
+ case QUESTION_DATE:
+ mCVfrQuestionDB.RegisterNewDateQuestion (QName, VarIdStr, QId);
+ break;
+ case QUESTION_TIME:
+ mCVfrQuestionDB.RegisterNewTimeQuestion (QName, VarIdStr, QId);
+ break;
+ case QUESTION_REF:
+ //
+ // VarIdStr != NULL stand for question with storagae.
+ //
+ if (VarIdStr != NULL) {
+ mCVfrQuestionDB.RegisterRefQuestion (QName, VarIdStr, QId);
+ } else {
+ mCVfrQuestionDB.RegisterQuestion (QName, NULL, QId);
+ }
+ break;
+ default:
+ _PCATCH(VFR_RETURN_FATAL_ERROR);
+ }
+ >>
+ <<
+ if (VarIdStr != NULL) {
+ delete[] VarIdStr;
+ }
+ _SAVE_CURRQEST_VARINFO (Info);
+ >>
+ ;
+
+vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_NORMAL]:
+ <<
+ EFI_VARSTORE_INFO Info;
+ Info.mVarType = EFI_IFR_TYPE_OTHER;
+ Info.mVarTotalSize = 0;
+ Info.mInfo.mVarOffset = EFI_VAROFFSET_INVALID;
+ Info.mVarStoreId = EFI_VARSTORE_ID_INVALID;
+ Info.mIsBitVar = FALSE;
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
+ >>
+ vfrQuestionBaseInfo[Info, QId, QType]
+ << $QHObj.SetQuestionId (QId);
+ if (Info.mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ $QHObj.SetVarStoreInfo (&Info);
+ }
+ >>
+ vfrStatementHeader[&$QHObj]
+ ;
+
+questionheaderFlagsField[UINT8 & Flags] :
+ ReadOnlyFlag << $Flags |= 0x01; >>
+ | InteractiveFlag << $Flags |= 0x04; >>
+ | ResetRequiredFlag << $Flags |= 0x10; >>
+ | ReconnectRequiredFlag << $Flags |= 0x40; >>
+ | O:OptionOnlyFlag <<
+ gCVfrErrorHandle.HandleWarning (
+ VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,
+ O->getLine(),
+ O->getText()
+ );
+ >>
+ | N:NVAccessFlag <<
+ gCVfrErrorHandle.HandleWarning (
+ VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,
+ N->getLine(),
+ N->getText()
+ );
+ >>
+ | L:LateCheckFlag <<
+ gCVfrErrorHandle.HandleWarning (
+ VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,
+ L->getLine(),
+ L->getText()
+ );
+ >>
+ ;
+
+vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFlag = TRUE] :
+ <<
+ UINT32 Idx;
+ UINT32 LineNo;
+ EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
+ CHAR8 *VarIdStr = NULL;
+ CHAR8 *VarStr = NULL;
+ CHAR8 *SName = NULL;
+ CHAR8 *TName = NULL;
+ EFI_VFR_RETURN_CODE VfrReturnCode = VFR_RETURN_SUCCESS;
+ EFI_IFR_TYPE_VALUE Dummy = gZeroEfiIfrTypeValue;
+ EFI_GUID *VarGuid = NULL;
+ >>
+ (
+ SN1:StringIdentifier << SName = SN1->getText(); _STRCAT(&VarIdStr, SN1->getText()); >>
+ OpenBracket I1:Number CloseBracket <<
+ Idx = _STOU32(I1->getText(), I1->getLine());
+ _STRCAT(&VarIdStr, "[");
+ _STRCAT(&VarIdStr, I1->getText());
+ _STRCAT(&VarIdStr, "]");
+ >>
+ <<
+ VfrReturnCode = gCVfrDataStorage.GetVarStoreId(SName, &$Info.mVarStoreId);
+ if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
+ _PCATCH(VfrReturnCode, SN1);
+ _PCATCH(gCVfrDataStorage.GetNameVarStoreInfo (&$Info, Idx), SN1);
+ }
+
+ QuestVarIdStr = VarIdStr;
+ >>
+ )
+ |
+ (
+ SN2:StringIdentifier << SName = SN2->getText(); _STRCAT(&VarIdStr, SName); >>
+ <<
+ VfrReturnCode = gCVfrDataStorage.GetVarStoreId(SName, &$Info.mVarStoreId);
+ if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
+ _PCATCH(VfrReturnCode, SN2);
+ VarStoreType = gCVfrDataStorage.GetVarStoreType ($Info.mVarStoreId);
+ if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_BUFFER_BITS) {
+ _PCATCH(gCVfrDataStorage.GetBufferVarStoreDataTypeName(Info.mVarStoreId, &TName), SN2);
+ _STRCAT(&VarStr, TName);
+ }
+ }
+ >>
+
+ (
+ "." <<
+ if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
+ _PCATCH((((VarStoreType != EFI_VFR_VARSTORE_BUFFER) && (VarStoreType != EFI_VFR_VARSTORE_BUFFER_BITS))? VFR_RETURN_EFIVARSTORE_USE_ERROR : VFR_RETURN_SUCCESS), SN2);
+ }
+ _STRCAT(&VarIdStr, "."); _STRCAT(&VarStr, ".");
+ >>
+ SF:StringIdentifier << _STRCAT(&VarIdStr, SF->getText()); _STRCAT(&VarStr, SF->getText()); >>
+ {
+ OpenBracket I2:Number CloseBracket <<
+ Idx = _STOU32(I2->getText(), I2->getLine());
+ if (Idx > 0) {
+ //
+ // Idx == 0, [0] can be ignored.
+ // Array[0] is same to Array for unify the varid name to cover [0]
+ //
+ _STRCAT(&VarIdStr, "[");
+ _STRCAT(&VarIdStr, I2->getText());
+ _STRCAT(&VarIdStr, "]");
+ }
+ _STRCAT(&VarStr, "[");
+ _STRCAT(&VarStr, I2->getText());
+ _STRCAT(&VarStr, "]");
+ >>
+ }
+ )* <<
+ switch (VarStoreType) {
+ case EFI_VFR_VARSTORE_EFI:
+ _PCATCH(gCVfrDataStorage.GetEfiVarStoreInfo (&$Info), SN2);
+ break;
+ case EFI_VFR_VARSTORE_BUFFER:
+ case EFI_VFR_VARSTORE_BUFFER_BITS:
+ _PCATCH(gCVfrVarDataTypeDB.GetDataFieldInfo (VarStr, $Info.mInfo.mVarOffset, $Info.mVarType, $Info.mVarTotalSize, $Info.mIsBitVar), SN2->getLine(), VarStr);
+ VarGuid = gCVfrDataStorage.GetVarStoreGuid($Info.mVarStoreId);
+ _PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Register (
+ SName,
+ VarGuid,
+ NULL),
+ SN2->getLine());
+ _PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Write (
+ 'a',
+ SName,
+ VarGuid,
+ NULL,
+ $Info.mVarType,
+ $Info.mInfo.mVarOffset,
+ $Info.mVarTotalSize,
+ Dummy),
+ SN2->getLine());
+ _PCATCH(gCVfrDataStorage.AddBufferVarStoreFieldInfo(&$Info ),SN2->getLine());
+ break;
+ case EFI_VFR_VARSTORE_NAME:
+ default: break;
+ }
+
+ QuestVarIdStr = VarIdStr;
+ if (VarStr != NULL) {delete[] VarStr;}
+ >>
+ )
+ ;
+
+vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr, UINT32 &LineNo] :
+ <<
+ UINT32 Idx;
+ VarIdStr = NULL; LineNo = 0;
+ >>
+ (
+ SN1:StringIdentifier << _STRCAT(&VarIdStr, SN1->getText()); LineNo = SN1->getLine(); >>
+ OpenBracket I1:Number CloseBracket <<
+ _STRCAT(&VarIdStr, "[");
+ _STRCAT(&VarIdStr, I1->getText());
+ _STRCAT(&VarIdStr, "]");
+ mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask);
+ if (mConstantOnlyInExpression) {
+ _PCATCH(VFR_RETURN_CONSTANT_ONLY, LineNo);
+ }
+ >>
+ )
+ |
+ (
+ SN2:StringIdentifier << _STRCAT (&VarIdStr, SN2->getText()); LineNo = SN2->getLine(); >>
+ (
+ "." <<
+ _STRCAT (&VarIdStr, ".");
+ if (mConstantOnlyInExpression) {
+ _PCATCH(VFR_RETURN_CONSTANT_ONLY, LineNo);
+ }
+ >>
+ SF:StringIdentifier << _STRCAT (&VarIdStr, SF->getText()); >>
+ {
+ OpenBracket I2:Number CloseBracket <<
+ Idx = _STOU32(I2->getText(), I2->getLine());
+ if (Idx > 0) {
+ //
+ // Idx == 0, [0] can be ignored.
+ // Array[0] is same to Array
+ //
+ _STRCAT(&VarIdStr, "[");
+ _STRCAT(&VarIdStr, I2->getText());
+ _STRCAT(&VarIdStr, "]");
+ }
+ >>
+ }
+ )*
+ << mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask); >>
+ )
+ ;
+
+vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value, BOOLEAN &ListType] :
+ <<
+ EFI_GUID Guid;
+ BOOLEAN Negative = FALSE;
+ BOOLEAN IntDecStyle = FALSE;
+ CIfrNumeric *NumericQst = NULL;
+ if (gCurrentMinMaxData != NULL && gCurrentMinMaxData->IsNumericOpcode()) {
+ NumericQst = (CIfrNumeric *) gCurrentQuestion;
+ IntDecStyle = (NumericQst->GetNumericFlags() & EFI_IFR_DISPLAY) == 0 ? TRUE : FALSE;
+ }
+ UINT8 *Type8 = (UINT8 *) &Value;
+ UINT16 *Type16 = (UINT16 *) &Value;
+ UINT32 *Type32 = (UINT32 *) &Value;
+ UINT64 *Type64 = (UINT64 *) &Value;
+ UINT16 Index = 0;
+ ListType = FALSE;
+ >>
+ {
+ "\-" << Negative = TRUE; >>
+ }
+ N1:Number <<
+ //
+ // The value stored in bit fields is always set to UINT32 type.
+ //
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ $Value.u32 = _STOU32(N1->getText(), N1->getLine());
+ } else {
+ switch ($Type) {
+ case EFI_IFR_TYPE_NUM_SIZE_8 :
+ $Value.u8 = _STOU8(N1->getText(), N1->getLine());
+ if (IntDecStyle) {
+ if (Negative) {
+ if ($Value.u8 > 0x80) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N1->getLine(), "INT8 type can't big than 0x7F, small than -0x80");
+ }
+ } else {
+ if ($Value.u8 > 0x7F) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N1->getLine(), "INT8 type can't big than 0x7F, small than -0x80");
+ }
+ }
+ }
+ if (Negative) {
+ $Value.u8 = ~$Value.u8 + 1;
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16 :
+ $Value.u16 = _STOU16(N1->getText(), N1->getLine());
+ if (IntDecStyle) {
+ if (Negative) {
+ if ($Value.u16 > 0x8000) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N1->getLine(), "INT16 type can't big than 0x7FFF, small than -0x8000");
+ }
+ } else {
+ if ($Value.u16 > 0x7FFF) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N1->getLine(), "INT16 type can't big than 0x7FFF, small than -0x8000");
+ }
+ }
+ }
+ if (Negative) {
+ $Value.u16 = ~$Value.u16 + 1;
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32 :
+ $Value.u32 = _STOU32(N1->getText(), N1->getLine());
+ if (IntDecStyle) {
+ if (Negative) {
+ if ($Value.u32 > 0x80000000) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N1->getLine(), "INT32 type can't big than 0x7FFFFFFF, small than -0x80000000");
+ }
+ } else {
+ if ($Value.u32 > 0X7FFFFFFF) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N1->getLine(), "INT32 type can't big than 0x7FFFFFFF, small than -0x80000000");
+ }
+ }
+ }
+ if (Negative) {
+ $Value.u32 = ~$Value.u32 + 1;
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_64 :
+ $Value.u64 = _STOU64(N1->getText(), N1->getLine());
+ if (IntDecStyle) {
+ if (Negative) {
+ if ($Value.u64 > 0x8000000000000000) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N1->getLine(), "INT64 type can't big than 0x7FFFFFFFFFFFFFFF, small than -0x8000000000000000");
+ }
+ } else {
+ if ($Value.u64 > 0x7FFFFFFFFFFFFFFF) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N1->getLine(), "INT64 type can't big than 0x7FFFFFFFFFFFFFFF, small than -0x8000000000000000");
+ }
+ }
+ }
+ if (Negative) {
+ $Value.u64 = ~$Value.u64 + 1;
+ }
+ break;
+ case EFI_IFR_TYPE_BOOLEAN :
+ $Value.b = _STOU8(N1->getText(), N1->getLine());
+ break;
+ case EFI_IFR_TYPE_STRING :
+ $Value.string = _STOU16(N1->getText(), N1->getLine());
+ break;
+ case EFI_IFR_TYPE_TIME :
+ case EFI_IFR_TYPE_DATE :
+ case EFI_IFR_TYPE_REF :
+ default :
+ break;
+ }
+ }
+ >>
+ | B1:True << $Value.b = TRUE; >>
+ | B2:False << $Value.b = FALSE; >>
+ | O1:One << $Value.u8 = _STOU8(O1->getText(), O1->getLine()); >>
+ | O2:Ones << $Value.u64 = _STOU64(O2->getText(), O2->getLine()); >>
+ | Z:Zero << $Value.u8 = _STOU8(Z->getText(), Z->getLine()); >>
+ | HOUR:Number ":" MINUTE:Number ":" SECOND:Number << $Value.time = _STOT(HOUR->getText(), MINUTE->getText(),SECOND->getText(), HOUR->getLine()); >>
+ | YEAR:Number "/" MONTH:Number "/" DAY:Number << $Value.date = _STOD(YEAR->getText(), MONTH->getText(), DAY->getText(), YEAR->getLine()); >>
+ | QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)"
+ << $Value.ref = _STOR(QI->getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>
+ | "STRING_TOKEN" "\(" S1:Number "\)" << $Value.string = _STOSID(S1->getText(), S1->getLine()); >>
+ | "\{" << ListType = TRUE; >>
+ L1:Number <<
+ switch (Type) {
+ case EFI_IFR_TYPE_NUM_SIZE_8 :
+ Type8[Index] = _STOU8(L1->getText(), L1->getLine());
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16 :
+ Type16[Index] = _STOU16(L1->getText(), L1->getLine());
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32 :
+ Type32[Index] = _STOU32(L1->getText(), L1->getLine());
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_64 :
+ Type64[Index] = _STOU64(L1->getText(), L1->getLine());
+ break;
+ default:
+ break;
+ }
+ Index++;
+ >>
+ (
+ ","
+ L2:Number <<
+ switch (Type) {
+ case EFI_IFR_TYPE_NUM_SIZE_8 :
+ Type8[Index] = _STOU8(L2->getText(), L2->getLine());
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16 :
+ Type16[Index] = _STOU16(L2->getText(), L2->getLine());
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32 :
+ Type32[Index] = _STOU32(L2->getText(), L2->getLine());
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_64 :
+ Type64[Index] = _STOU64(L2->getText(), L2->getLine());
+ break;
+ default:
+ break;
+ }
+ Index++;
+ >>
+ )*
+ "\}"
+ ;
+
+//*****************************************************************************
+//
+// the syntax of form definition
+//
+vfrFormDefinition :
+ << CIfrForm FObj; >>
+ F:Form << FObj.SetLineNo(F->getLine()); >>
+ FormId "=" S1:Number "," << _PCATCH(FObj.SetFormId (_STOFID(S1->getText(), S1->getLine())), S1); >>
+ Title "=" "STRING_TOKEN" "\(" S2:Number "\)" ";" << FObj.SetFormTitle (_STOSID(S2->getText(), S2->getLine())); >>
+ (
+ vfrStatementImage |
+ vfrStatementLocked |
+ vfrStatementRules |
+ vfrStatementDefault |
+ vfrStatementStat |
+ vfrStatementQuestions |
+ vfrStatementConditional |
+ vfrStatementLabel |
+ vfrStatementBanner |
+ // Just for framework vfr compatibility
+ vfrStatementInvalid |
+ vfrStatementExtension |
+ vfrStatementModal |
+ vfrStatementRefreshEvent ";"
+ )*
+ E:EndForm <<
+ {CIfrEnd EObj; EObj.SetLineNo (E->getLine()); mLastFormEndAddr = EObj.GetObjBinAddr<CHAR8>(); gAdjustOpcodeOffset = EObj.GetObjBinOffset ();}
+ >>
+ ";"
+ ;
+
+vfrFormMapDefinition :
+ <<
+ CIfrFormMap *FMapObj = NULL;
+ UINT32 FormMapMethodNumber = 0;
+ EFI_GUID Guid;
+ >>
+ F:FormMap << FMapObj = new CIfrFormMap(); FMapObj->SetLineNo(F->getLine()); >>
+ FormId "=" S1:Number "," << _PCATCH(FMapObj->SetFormId (_STOFID(S1->getText(), S1->getLine())), S1); >>
+ (
+ MapTitle "=" "STRING_TOKEN" "\(" S2:Number "\)" ";"
+ MapGuid "=" guidDefinition[Guid] ";" << FMapObj->SetFormMapMethod (_STOFID(S2->getText(), S2->getLine()), &Guid); FormMapMethodNumber ++; >>
+ )* << if (FormMapMethodNumber == 0) {_PCATCH (VFR_RETURN_INVALID_PARAMETER, F->getLine(), "No MapMethod is set for FormMap!");} delete FMapObj;>>
+ (
+ vfrStatementImage |
+ vfrStatementLocked |
+ vfrStatementRules |
+ vfrStatementDefault |
+ vfrStatementStat |
+ vfrStatementQuestions |
+ vfrStatementConditional |
+ vfrStatementLabel |
+ vfrStatementBanner |
+ vfrStatementExtension |
+ vfrStatementModal |
+ vfrStatementRefreshEvent ";"
+ )*
+ E:EndForm << CRT_END_OP (E); >>
+ ";"
+ ;
+
+vfrStatementRules :
+ << CIfrRule RObj; >>
+ R:Rule << RObj.SetLineNo(R->getLine()); >>
+ S1:StringIdentifier "," <<
+ mCVfrRulesDB.RegisterRule (S1->getText());
+ RObj.SetRuleId (mCVfrRulesDB.GetRuleId(S1->getText()));
+ >>
+ vfrStatementExpression[0]
+ E:EndRule << CRT_END_OP (E); >>
+ ";"
+ ;
+
+vfrStatementDefault :
+ <<
+ BOOLEAN IsExp = FALSE;
+ UINT64 ValueList[EFI_IFR_MAX_LENGTH] = {0,};
+ EFI_IFR_TYPE_VALUE *Val = (EFI_IFR_TYPE_VALUE *) ValueList;
+ CIfrDefault *DObj = NULL;
+ CIfrDefault2 *DObj2 = NULL;
+ EFI_DEFAULT_ID DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
+ CHAR8 *VarStoreName = NULL;
+ EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
+ UINT32 Size = 0;
+ EFI_GUID *VarGuid = NULL;
+ BOOLEAN ArrayType = FALSE;
+ UINT8 *Type8 = (UINT8 *) ValueList;
+ UINT16 *Type16 = (UINT16 *) ValueList;
+ UINT32 *Type32 = (UINT32 *) ValueList;
+ UINT64 *Type64 = (UINT64 *) ValueList;
+ CIfrNumeric *NumericQst = NULL;
+
+ >>
+ D:Default
+ (
+ (
+ "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","
+ <<
+ if (gCurrentMinMaxData != NULL && gCurrentMinMaxData->IsNumericOpcode()) {
+ //check default value is valid for Numeric Opcode
+ NumericQst = (CIfrNumeric *) gCurrentQuestion;
+ if ((NumericQst->GetNumericFlags() & EFI_IFR_DISPLAY) == 0 && !(_GET_CURRQEST_VARTINFO().mIsBitVar)) {
+ switch (_GET_CURRQEST_DATATYPE()) {
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ if (((INT8) Val->u8 < (INT8) gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE(), FALSE)) ||
+ ((INT8) Val->u8 > (INT8) gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE(), FALSE))) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ if (((INT16) Val->u16 < (INT16) gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE(), FALSE)) ||
+ ((INT16) Val->u16 > (INT16) gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE(), FALSE))) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ if (((INT32) Val->u32 < (INT32) gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE(), FALSE)) ||
+ ((INT32) Val->u32 > (INT32) gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE(), FALSE))) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ if (((INT64) Val->u64 < (INT64) gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE(), FALSE)) ||
+ ((INT64) Val->u64 > (INT64) gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE(), FALSE))) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
+ }
+ break;
+ default:
+ break;
+ }
+ } else {
+ //
+ // Value for question stored in bit fields is always set to UINT32 type.
+ //
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ if (Val->u32 < gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE(), TRUE) || Val->u32 > gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE(), TRUE)) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
+ }
+ } else {
+ if (Val->u64 < gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE(), FALSE) || Val->u64 > gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE(), FALSE)) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
+ }
+ }
+ }
+ }
+ if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
+ _PCATCH (VFR_RETURN_FATAL_ERROR, D->getLine(), "Default data type error.");
+ Size = sizeof (EFI_IFR_TYPE_VALUE);
+ } else if (ArrayType) {
+ switch (_GET_CURRQEST_DATATYPE()) {
+ case EFI_IFR_TYPE_NUM_SIZE_8 :
+ while (Type8[Size] != 0) {
+ Size++;
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16 :
+ while (Type16[Size] != 0) {
+ Size++;
+ }
+ Size *= sizeof (UINT16);
+ break;
+
+ case EFI_IFR_TYPE_NUM_SIZE_32 :
+ while (Type32[Size] != 0) {
+ Size++;
+ }
+ Size *= sizeof (UINT32);
+ break;
+
+ case EFI_IFR_TYPE_NUM_SIZE_64 :
+ while (Type64[Size] != 0) {
+ Size++;
+ }
+ Size *= sizeof (UINT64);
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ Size = sizeof (UINT32);
+ } else {
+ _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &Size), D->getLine());
+ }
+ }
+ Size += OFFSET_OF (EFI_IFR_DEFAULT, Value);
+ DObj = new CIfrDefault ((UINT8)Size);
+ DObj->SetLineNo(D->getLine());
+ if (ArrayType) {
+ DObj->SetType (EFI_IFR_TYPE_BUFFER);
+ } else if (gIsStringOp) {
+ DObj->SetType (EFI_IFR_TYPE_STRING);
+ } else {
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ DObj->SetType (EFI_IFR_TYPE_NUM_SIZE_32);
+ } else {
+ DObj->SetType (_GET_CURRQEST_DATATYPE());
+ }
+ }
+ DObj->SetValue(*Val);
+ >>
+ | << IsExp = TRUE; DObj2 = new CIfrDefault2; DObj2->SetLineNo(D->getLine()); DObj2->SetScope (1); >>
+ vfrStatementValue "," << CIfrEnd EndObj1; EndObj1.SetLineNo(D->getLine()); >>
+ )
+ {
+ DefaultStore "=" SN:StringIdentifier "," <<
+ _PCATCH(gCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN);
+ if (DObj != NULL) {
+ DObj->SetDefaultId (DefaultId);
+ }
+
+ if (DObj2 != NULL) {
+ DObj2->SetDefaultId (DefaultId);
+ }
+ >>
+ }
+ <<
+ CheckDuplicateDefaultValue (DefaultId, D);
+ if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ _PCATCH(gCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), D->getLine());
+ VarGuid = gCVfrDataStorage.GetVarStoreGuid(_GET_CURRQEST_VARTINFO().mVarStoreId);
+ VarStoreType = gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
+ if ((IsExp == FALSE) && (VarStoreType == EFI_VFR_VARSTORE_BUFFER)) {
+ _PCATCH(gCVfrDefaultStore.BufferVarStoreAltConfigAdd (
+ DefaultId,
+ _GET_CURRQEST_VARTINFO(),
+ VarStoreName,
+ VarGuid,
+ _GET_CURRQEST_DATATYPE (),
+ *Val),
+ D->getLine()
+ );
+ }
+ }
+ if (DObj != NULL) {delete DObj;}
+ if (DObj2 != NULL) {delete DObj2;}
+ >>
+ )
+ ;
+
+vfrStatementStat :
+ vfrStatementSubTitle |
+ vfrStatementStaticText |
+ vfrStatementCrossReference
+ ;
+
+vfrStatementQuestions :
+ vfrStatementBooleanType |
+ vfrStatementDate |
+ vfrStatementNumericType |
+ vfrStatementStringType |
+ vfrStatementOrderedList |
+ vfrStatementTime
+ ;
+
+vfrStatementConditional :
+ vfrStatementDisableIfStat |
+ vfrStatementSuppressIfStat | //enhance to be compatible for framework endif
+ vfrStatementGrayOutIfStat |
+ vfrStatementInconsistentIfStat //to be compatible for framework
+ ;
+
+vfrStatementConditionalNew :
+ vfrStatementDisableIfStat |
+ vfrStatementSuppressIfStatNew |
+ vfrStatementGrayOutIfStatNew |
+ vfrStatementInconsistentIfStat //to be compatible for framework
+ ;
+
+vfrStatementSuppressIfStat :
+ vfrStatementSuppressIfStatNew
+ ;
+
+vfrStatementGrayOutIfStat :
+ vfrStatementGrayOutIfStatNew
+ ;
+
+vfrStatementInvalid :
+ (
+ vfrStatementInvalidHidden |
+ vfrStatementInvalidInventory |
+ vfrStatementInvalidSaveRestoreDefaults
+ )
+ << _CRT_OP (TRUE); >>
+ ;
+
+flagsField :
+ Number
+ | InteractiveFlag
+ | ManufacturingFlag
+ | DefaultFlag
+ | ResetRequiredFlag
+ | ReconnectRequiredFlag
+ | N:NVAccessFlag <<
+ gCVfrErrorHandle.HandleWarning (
+ VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,
+ N->getLine(),
+ N->getText()
+ );
+ >>
+ | L:LateCheckFlag <<
+ gCVfrErrorHandle.HandleWarning (
+ VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,
+ L->getLine(),
+ L->getText()
+ );
+ >>
+ ;
+
+vfrStatementValue :
+ << CIfrValue VObj; >>
+ V:Value << VObj.SetLineNo(V->getLine()); >>
+ "=" vfrStatementExpression[0] << {CIfrEnd EndObj; EndObj.SetLineNo(V->getLine());} >>
+ ;
+
+vfrStatementRead :
+ << CIfrRead RObj; >>
+ R:Read << RObj.SetLineNo(R->getLine()); >>
+ vfrStatementExpression[0] ";"
+ ;
+
+vfrStatementWrite :
+ << CIfrWrite WObj; >>
+ W:Write << WObj.SetLineNo(W->getLine()); >>
+ vfrStatementExpression[0] ";"
+ ;
+
+vfrStatementSubTitle :
+ << CIfrSubtitle SObj; >>
+ L:Subtitle << SObj.SetLineNo(L->getLine()); >>
+ Text "=" "STRING_TOKEN" "\(" S:Number "\)" << SObj.SetPrompt (_STOSID(S->getText(), S->getLine())); >>
+ {
+ "," FLAGS "=" vfrSubtitleFlags[SObj]
+ }
+ (
+ {vfrStatementStatTagList "," }
+ E:";" << CRT_END_OP (E); >>
+ |
+ { "," vfrStatementStatTagList}
+ { "," (vfrStatementStat | vfrStatementQuestions)*}
+ D: EndSubtitle ";" << CRT_END_OP (D); >>
+ )
+ ;
+
+vfrSubtitleFlags [CIfrSubtitle & SObj] :
+ << UINT8 LFlags = 0; >>
+ subtitleFlagsField[LFlags] ( "\|" subtitleFlagsField[LFlags] )*
+ << _PCATCH(SObj.SetFlags (LFlags)); >>
+ ;
+
+subtitleFlagsField [UINT8 & Flags] :
+ N:Number << $Flags |= _STOU8(N->getText(), N->getLine()); >>
+ | "HORIZONTAL" << $Flags |= 0x01; >>
+ ;
+
+vfrStatementStaticText :
+ <<
+ UINT8 Flags = 0;
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
+ EFI_STRING_ID TxtTwo = EFI_STRING_ID_INVALID;
+ >>
+ T:Text
+ Help "=" "STRING_TOKEN" "\(" S1:Number "\)" ","
+ Text "=" "STRING_TOKEN" "\(" S2:Number "\)"
+ {
+ "," Text "=" "STRING_TOKEN" "\(" S3:Number "\)" << TxtTwo = _STOSID(S3->getText(), S3->getLine()); >>
+ }
+ {
+ "," F:FLAGS "=" staticTextFlagsField[Flags] ( "\|" staticTextFlagsField[Flags] )*
+ "," Key "=" KN:Number
+ }
+ <<
+ if (Flags & EFI_IFR_FLAG_CALLBACK) {
+ if (TxtTwo != EFI_STRING_ID_INVALID) {
+ gCVfrErrorHandle.HandleWarning (
+ VFR_WARNING_ACTION_WITH_TEXT_TWO,
+ S3->getLine(),
+ S3->getText()
+ );
+ }
+ CIfrAction AObj;
+ mCVfrQuestionDB.RegisterQuestion (NULL, NULL, QId);
+ AObj.SetLineNo (F->getLine());
+ AObj.SetQuestionId (QId);
+ AObj.SetPrompt (_STOSID(S2->getText(), S2->getLine()));
+ AObj.SetHelp (_STOSID(S1->getText(), S1->getLine()));
+ _PCATCH(AObj.SetFlags (Flags), F->getLine());
+ AssignQuestionKey (AObj, KN);
+ CRT_END_OP (KN);
+ } else {
+ CIfrText TObj;
+ TObj.SetLineNo (T->getLine());
+ TObj.SetHelp (_STOSID(S1->getText(), S1->getLine()));
+ TObj.SetPrompt (_STOSID(S2->getText(), S2->getLine()));
+ TObj.SetTextTwo (TxtTwo);
+ }
+ >>
+ { "," vfrStatementStatTagList }
+ ";"
+ ;
+
+staticTextFlagsField[UINT8 & HFlags] :
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+ | questionheaderFlagsField[HFlags]
+ ;
+
+vfrStatementCrossReference :
+ vfrStatementGoto |
+ vfrStatementResetButton
+ ;
+
+vfrStatementGoto :
+ <<
+ UINT8 RefType = 5;
+ EFI_STRING_ID DevPath = EFI_STRING_ID_INVALID;
+ EFI_GUID FSId = {0,};
+ EFI_FORM_ID FId;
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
+ UINT32 BitMask;
+ CIfrQuestionHeader *QHObj = NULL;
+ CIfrOpHeader *OHObj = NULL;
+ CIfrRef *R1Obj = NULL;
+ CIfrRef2 *R2Obj = NULL;
+ CIfrRef3 *R3Obj = NULL;
+ CIfrRef4 *R4Obj = NULL;
+ CIfrRef5 *R5Obj = NULL;
+ >>
+ G:Goto
+ {
+ (
+ DevicePath "=" "STRING_TOKEN" "\(" P:Number "\)" ","
+ FormSetGuid "=" guidDefinition[FSId] ","
+ FormId "=" F1:Number ","
+ Question "=" QN1:Number ","
+ <<
+ RefType = 4;
+ DevPath = _STOSID(P->getText(), P->getLine());
+ FId = _STOFID(F1->getText(), F1->getLine());
+ QId = _STOQID(QN1->getText(), QN1->getLine());
+ >>
+ )
+ |
+ (
+ FormSetGuid "=" guidDefinition[FSId] ","
+ FormId "=" F2:Number ","
+ Question "=" QN2:Number ","
+ <<
+ RefType = 3;
+ FId = _STOFID(F2->getText(), F2->getLine());
+ QId = _STOQID(QN2->getText(), QN2->getLine());
+ >>
+ )
+ |
+ (
+ FormId "=" F3:Number "," << RefType = 2; FId = _STOFID(F3->getText(), F3->getLine()); >>
+ Question "="
+ (
+ QN3:StringIdentifier "," <<
+ mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask);
+ if (QId == EFI_QUESTION_ID_INVALID) {
+ _PCATCH(VFR_RETURN_UNDEFINED, QN3);
+ }
+ >>
+ | QN4:Number "," << QId = _STOQID(QN4->getText(), QN4->getLine()); >>
+ )
+ )
+ |
+ (
+ F4:Number "," <<
+ RefType = 1;
+ FId = _STOFID(F4->getText(), F4->getLine());
+ >>
+ )
+ }
+ <<
+ switch (RefType) {
+ case 5:
+ {
+ R5Obj = new CIfrRef5;
+ QHObj = R5Obj;
+ OHObj = R5Obj;
+ R5Obj->SetLineNo(G->getLine());
+ break;
+ }
+ case 4:
+ {
+ R4Obj = new CIfrRef4;
+ QHObj = R4Obj;
+ OHObj = R4Obj;
+ R4Obj->SetLineNo(G->getLine());
+ R4Obj->SetDevicePath (DevPath);
+ R4Obj->SetFormSetId (FSId);
+ R4Obj->SetFormId (FId);
+ R4Obj->SetQuestionId (QId);
+ break;
+ }
+ case 3:
+ {
+ R3Obj = new CIfrRef3;
+ QHObj = R3Obj;
+ OHObj = R3Obj;
+ R3Obj->SetLineNo(G->getLine());
+ R3Obj->SetFormSetId (FSId);
+ R3Obj->SetFormId (FId);
+ R3Obj->SetQuestionId (QId);
+ break;
+ }
+ case 2:
+ {
+ R2Obj = new CIfrRef2;
+ QHObj = R2Obj;
+ OHObj = R2Obj;
+ R2Obj->SetLineNo(G->getLine());
+ R2Obj->SetFormId (FId);
+ R2Obj->SetQuestionId (QId);
+ break;
+ }
+ case 1:
+ {
+ R1Obj = new CIfrRef;
+ QHObj = R1Obj;
+ OHObj = R1Obj;
+ R1Obj->SetLineNo(G->getLine());
+ R1Obj->SetFormId (FId);
+ break;
+ }
+ default: break;
+ }
+ >>
+ vfrQuestionHeader[*QHObj, QUESTION_REF] <<
+ if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
+ _GET_CURRQEST_VARTINFO().mVarType = EFI_IFR_TYPE_REF;
+ }
+ >>
+ { "," F:FLAGS "=" vfrGotoFlags[QHObj, F->getLine()] }
+ {
+ "," Key "=" KN:Number << AssignQuestionKey (*QHObj, KN); >>
+ }
+ {
+ E:","
+ vfrStatementQuestionOptionList << OHObj->SetScope(1); CRT_END_OP (E);>>
+ }
+ ";" << if (R1Obj != NULL) {delete R1Obj;} if (R2Obj != NULL) {delete R2Obj;} if (R3Obj != NULL) {delete R3Obj;} if (R4Obj != NULL) {delete R4Obj;} if (R5Obj != NULL) {delete R5Obj;}>>
+ ;
+
+vfrGotoFlags [CIfrQuestionHeader *QHObj, UINT32 LineNum] :
+ << UINT8 HFlags = 0; >>
+ gotoFlagsField[HFlags] ( "\|" gotoFlagsField[HFlags] )*
+ << _PCATCH(QHObj->SetFlags (HFlags), LineNum); >>
+ ;
+
+gotoFlagsField[UINT8 & HFlags] :
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+ | questionheaderFlagsField[HFlags]
+ ;
+
+getStringId :
+ "STRING_TOKEN" "\("
+ IdVal:Number
+ "\)"
+ ;
+
+vfrStatementResetButton :
+ <<
+ CIfrResetButton RBObj;
+ UINT16 DefaultId;
+ >>
+ L:ResetButton << RBObj.SetLineNo(L->getLine()); >>
+ DefaultStore
+ "=" N:StringIdentifier "," <<
+ _PCATCH(gCVfrDefaultStore.GetDefaultId (N->getText(), &DefaultId), N->getLine());
+ RBObj.SetDefaultId (DefaultId);
+ >>
+ vfrStatementHeader[&RBObj] ","
+ { vfrStatementStatTagList "," }
+ E:EndResetButton << CRT_END_OP (E); >>
+ ";"
+ ;
+
+vfrStatementBooleanType :
+ vfrStatementCheckBox |
+ vfrStatementAction
+ ;
+
+//*****************************************************
+// Syntax of checkbox
+//
+// Example:
+// checkbox
+// varid = MySTestData.mField1,
+// prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
+// help = STRING_TOKEN(STR_CHECK_BOX_HELP),
+// flags = CHECKBOX_DEFAULT | CALLBACK,
+// default value = TRUE, defaultstore = MyDefaultStore,
+// endcheckbox;
+//
+vfrStatementCheckBox :
+ <<
+ CIfrCheckBox *CBObj = NULL;
+ EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
+ CHAR8 *VarStoreName = NULL;
+ UINT32 DataTypeSize;
+ EFI_GUID *VarStoreGuid = NULL;
+ CIfrGuid *GuidObj = NULL;
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;;
+ EFI_VARSTORE_INFO Info;
+ Info.mVarType = EFI_IFR_TYPE_OTHER;
+ Info.mVarTotalSize = 0;
+ Info.mInfo.mVarOffset = EFI_VAROFFSET_INVALID;
+ Info.mVarStoreId = EFI_VARSTORE_ID_INVALID;
+ Info.mIsBitVar = FALSE;
+ >>
+ L:CheckBox
+ vfrQuestionBaseInfo[Info, QId] <<
+ //
+ // Create a GUID opcode to wrap the checkbox opcode, if it refer to bit varstore.
+ //
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ GuidObj = new CIfrGuid(0);
+ GuidObj->SetGuid (&gEdkiiIfrBitVarGuid);
+ GuidObj->SetLineNo(L->getLine());
+ }
+ CBObj = new CIfrCheckBox;
+ CBObj->SetLineNo(L->getLine());
+ CBObj->SetQuestionId (QId);
+ CBObj->SetVarStoreInfo (&Info);
+ >>
+ vfrStatementHeader[CBObj]"," << //check data type
+ if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
+ _GET_CURRQEST_VARTINFO().mVarType = EFI_IFR_TYPE_BOOLEAN;
+ }
+ if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ //
+ // Check whether the question refers to a bit field, if yes. create a Guid to indicate the question refers to a bit field.
+ //
+ if (_GET_CURRQEST_VARTINFO ().mIsBitVar) {
+ _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "CheckBox varid is not the valid data type");
+ if ((gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId) == EFI_VFR_VARSTORE_BUFFER_BITS) &&
+ (_GET_CURRQEST_VARSIZE() != 1)) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid only occupy 1 bit in Bit Varstore");
+ }
+ } else {
+ _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "CheckBox varid is not the valid data type");
+ if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid doesn't support array");
+ } else if ((gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId) == EFI_VFR_VARSTORE_BUFFER) &&
+ (_GET_CURRQEST_VARSIZE() != sizeof (BOOLEAN))) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid only support BOOLEAN data type");
+ }
+ }
+ }
+ >>
+ {
+ F:FLAGS "=" vfrCheckBoxFlags[*CBObj, F->getLine()] ","
+ <<
+ if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ _PCATCH(gCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), VFR_RETURN_SUCCESS, L, "Failed to retrieve varstore name");
+ VarStoreGuid = gCVfrDataStorage.GetVarStoreGuid(_GET_CURRQEST_VARTINFO().mVarStoreId);
+ Val.b = TRUE;
+ if (CBObj->GetFlags () & 0x01) {
+ CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_STANDARD, F);
+ _PCATCH(
+ gCVfrDefaultStore.BufferVarStoreAltConfigAdd (
+ EFI_HII_DEFAULT_CLASS_STANDARD,
+ _GET_CURRQEST_VARTINFO(),
+ VarStoreName,
+ VarStoreGuid,
+ _GET_CURRQEST_DATATYPE (),
+ Val
+ ),
+ VFR_RETURN_SUCCESS,
+ L,
+ "No standard default storage found"
+ );
+ }
+ if (CBObj->GetFlags () & 0x02) {
+ CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_MANUFACTURING, F);
+ _PCATCH(
+ gCVfrDefaultStore.BufferVarStoreAltConfigAdd (
+ EFI_HII_DEFAULT_CLASS_MANUFACTURING,
+ _GET_CURRQEST_VARTINFO(),
+ VarStoreName,
+ VarStoreGuid,
+ _GET_CURRQEST_DATATYPE (),
+ Val
+ ),
+ VFR_RETURN_SUCCESS,
+ L,
+ "No manufacturing default storage found"
+ );
+ }
+ }
+ >>
+ }
+ {
+ Key "=" KN:Number "," << AssignQuestionKey (*CBObj, KN); >>
+ }
+ vfrStatementQuestionOptionList
+ E:EndCheckBox << CRT_END_OP (E);
+ if (GuidObj != NULL) {
+ GuidObj->SetScope(1);
+ CRT_END_OP (E);
+ delete GuidObj;
+ }
+ if (CBObj != NULL) delete CBObj;
+ >>
+ ";"
+ ;
+
+vfrCheckBoxFlags [CIfrCheckBox & CBObj, UINT32 LineNum] :
+ <<
+ UINT8 LFlags = 0;
+ UINT8 HFlags = 0;
+ >>
+ checkboxFlagsField[LFlags, HFlags] ( "\|" checkboxFlagsField[LFlags, HFlags] )*
+ << _PCATCH(CBObj.SetFlags (HFlags, LFlags), LineNum); >>
+ ;
+
+checkboxFlagsField[UINT8 & LFlags, UINT8 & HFlags] :
+ N:Number <<
+ _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine());
+ >>
+ | D:"DEFAULT" <<
+ _PCATCH (VFR_RETURN_UNSUPPORTED, D);
+ >>
+ | M:"MANUFACTURING" <<
+ _PCATCH (VFR_RETURN_UNSUPPORTED, M);
+ >>
+ | "CHECKBOX_DEFAULT" << $LFlags |= 0x01; >>
+ | "CHECKBOX_DEFAULT_MFG" << $LFlags |= 0x02; >>
+ | questionheaderFlagsField[HFlags]
+ ;
+
+//*****************************************************
+// Syntax of action
+//
+// Example:
+// action
+// prompt = STRING_TOKEN(STR_ACTION_PROMPT),
+// help = STRING_TOKEN(STR_ACTION_HELP),
+// flags = CALLBACK,
+// config = STRING_TOKEN(STR_ACTION_CONFIG),
+// endaction;
+//
+vfrStatementAction :
+ << CIfrAction AObj; >>
+ L:Action << AObj.SetLineNo(L->getLine()); >>
+ vfrQuestionHeader[AObj] ","
+ { F:FLAGS "=" vfrActionFlags[AObj, F->getLine()] "," }
+ Config "=" "STRING_TOKEN" "\(" S:Number "\)" "," << AObj.SetQuestionConfig (_STOSID(S->getText(), S->getLine())); >>
+ vfrStatementQuestionTagList
+ E:EndAction << CRT_END_OP (E); >>
+ ";"
+ ;
+
+vfrActionFlags[CIfrAction & AObj, UINT32 LineNum] :
+ << UINT8 HFlags = 0; >>
+ actionFlagsField[HFlags] ( "\|" actionFlagsField[HFlags] )*
+ << _PCATCH(AObj.SetFlags (HFlags), LineNum); >>
+ ;
+
+actionFlagsField[UINT8 & HFlags] :
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+ | questionheaderFlagsField[HFlags]
+ ;
+
+vfrStatementDate :
+ <<
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
+ CHAR8 *VarIdStr[3] = {NULL, };
+ CIfrDate DObj;
+ EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
+ UINT8 Size = OFFSET_OF (EFI_IFR_DEFAULT, Value) + sizeof (EFI_HII_DATE);
+ >>
+ L:Date << DObj.SetLineNo(L->getLine()); >>
+ (
+ (
+ vfrQuestionHeader[DObj, QUESTION_DATE] "," <<
+ if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
+ _GET_CURRQEST_VARTINFO().mVarType = EFI_IFR_TYPE_DATE;
+ }
+ >>
+ { F:FLAGS "=" vfrDateFlags[DObj, F->getLine()] "," }
+ vfrStatementQuestionOptionList
+ )
+ |
+ (
+ Year VarId "=" D1:StringIdentifier "." D1Y:StringIdentifier ","
+ << _STRCAT(&VarIdStr[0], D1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], D1Y->getText()); >>
+ Prompt "=" "STRING_TOKEN" "\(" YP:Number "\)" ","
+ Help "=" "STRING_TOKEN" "\(" YH:Number "\)" ","
+ minMaxDateStepDefault[Val.date, 0]
+
+ Month VarId "=" D2:StringIdentifier "." D2M:StringIdentifier ","
+ << _STRCAT(&VarIdStr[1], D2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], D2M->getText()); >>
+ Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","
+ Help "=" "STRING_TOKEN" "\(" MH:Number "\)" ","
+ minMaxDateStepDefault[Val.date, 1]
+
+ Day VarId "=" D3:StringIdentifier "." D3D:StringIdentifier ","
+ << _STRCAT(&VarIdStr[2], D3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], D3D->getText()); >>
+ Prompt "=" "STRING_TOKEN" "\(" DP:Number "\)" ","
+ Help "=" "STRING_TOKEN" "\(" DH:Number "\)" ","
+ minMaxDateStepDefault[Val.date, 2]
+ { G:FLAGS "=" vfrDateFlags[DObj, G->getLine()] "," }
+ <<
+ mCVfrQuestionDB.RegisterOldDateQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId);
+ DObj.SetQuestionId (QId);
+ DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_DATE_STORAGE_TIME);
+ DObj.SetPrompt (_STOSID(YP->getText(), YP->getLine()));
+ DObj.SetHelp (_STOSID(YH->getText(), YH->getLine()));
+ if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }
+ >>
+ << {CIfrDefault DefaultObj(Size, EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_DATE, Val); DefaultObj.SetLineNo(L->getLine());} >>
+ )
+ ( vfrStatementInconsistentIf )*
+ )
+ E:EndDate << CRT_END_OP (E); >>
+ ";"
+ ;
+
+minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
+ Minimum "=" MinN:Number ","
+ Maximum "=" MaxN:Number ","
+ { "step" "=" Number "," }
+ {
+ "default" "=" N:Number "," <<
+ switch (KeyValue) {
+ case 0:
+ D.Year = _STOU16(N->getText(), N->getLine());
+ if (D.Year < _STOU16 (MinN->getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(), MaxN->getLine())) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must be between Min year and Max year.");
+ }
+ break;
+ case 1:
+ D.Month = _STOU8(N->getText(), N->getLine());
+ if (D.Month < 1 || D.Month > 12) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value must be between 1 and 12.");
+ }
+ break;
+ case 2:
+ D.Day = _STOU8(N->getText(), N->getLine());
+ if (D.Day < 1 || D.Day > 31) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must be between 1 and 31.");
+ }
+ break;
+ }
+ >>
+ }
+ ;
+
+vfrDateFlags [CIfrDate & DObj, UINT32 LineNum] :
+ << UINT8 LFlags = 0; >>
+ dateFlagsField[LFlags] ( "\|" dateFlagsField[LFlags] )*
+ << _PCATCH(DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>
+ ;
+
+dateFlagsField [UINT8 & Flags] :
+ N:Number << $Flags |= _STOU8(N->getText(), N->getLine()); >>
+ | "YEAR_SUPPRESS" << $Flags |= 0x01; >>
+ | "MONTH_SUPPRESS" << $Flags |= 0x02; >>
+ | "DAY_SUPPRESS" << $Flags |= 0x04; >>
+ | "STORAGE_NORMAL" << $Flags |= 0x00; >>
+ | "STORAGE_TIME" << $Flags |= 0x10; >>
+ | "STORAGE_WAKEUP" << $Flags |= 0x20; >>
+ ;
+
+vfrStatementNumericType :
+ vfrStatementNumeric |
+ vfrStatementOneOf
+ ;
+
+vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
+ <<
+ UINT64 MaxU8 = 0, MinU8 = 0, StepU8 = 0;
+ UINT32 MaxU4 = 0, MinU4 = 0, StepU4 = 0;
+ UINT16 MaxU2 = 0, MinU2 = 0, StepU2 = 0;
+ UINT8 MaxU1 = 0, MinU1 = 0, StepU1 = 0;
+ BOOLEAN IntDecStyle = FALSE;
+ CIfrNumeric *NObj = (CIfrNumeric *) (&MMSDObj);
+ if (((_GET_CURRQEST_VARTINFO().mIsBitVar) && (NObj->GetOpCode() == EFI_IFR_NUMERIC_OP) && ((NObj->GetNumericFlags() & EDKII_IFR_DISPLAY_BIT) == 0)) ||
+ (!(_GET_CURRQEST_VARTINFO().mIsBitVar) && (NObj->GetOpCode() == EFI_IFR_NUMERIC_OP) && ((NObj->GetNumericFlags() & EFI_IFR_DISPLAY) == 0))) {
+ IntDecStyle = TRUE;
+ }
+ BOOLEAN MinNegative = FALSE;
+ BOOLEAN MaxNegative = FALSE;
+ >>
+ Minimum "="
+ {
+ "\-" << MinNegative = TRUE; >>
+ }
+ I:Number "," <<
+ if (!IntDecStyle && MinNegative) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, I->getLine(), "\"-\" can't be used when not in int decimal type. ");
+ }
+ //
+ // Value for question stored in bit fields is always set to UINT32 type.
+ //
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ MinU4 = _STOU32(I->getText(), I->getLine());
+ if (!IntDecStyle && MinU4 > (1<< _GET_CURRQEST_VARTINFO().mVarTotalSize) -1) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, I->getLine(), "BIT type minimum can't small than 0, bigger than 2^BitWidth -1");
+ }
+ } else {
+ switch (_GET_CURRQEST_DATATYPE()) {
+ case EFI_IFR_TYPE_NUM_SIZE_64 :
+ MinU8 = _STOU64(I->getText(), I->getLine());
+ if (IntDecStyle) {
+ if (MinNegative) {
+ if (MinU8 > 0x8000000000000000) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, I->getLine(), "INT64 type minimum can't small than -0x8000000000000000, big than 0x7FFFFFFFFFFFFFFF");
+ }
+ } else {
+ if (MinU8 > 0x7FFFFFFFFFFFFFFF) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, I->getLine(), "INT64 type minimum can't small than -0x8000000000000000, big than 0x7FFFFFFFFFFFFFFF");
+ }
+ }
+ }
+ if (MinNegative) {
+ MinU8 = ~MinU8 + 1;
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32 :
+ MinU4 = _STOU32(I->getText(), I->getLine());
+ if (IntDecStyle) {
+ if (MinNegative) {
+ if (MinU4 > 0x80000000) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, I->getLine(), "INT32 type minimum can't small than -0x80000000, big than 0x7FFFFFFF");
+ }
+ } else {
+ if (MinU4 > 0x7FFFFFFF) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, I->getLine(), "INT32 type minimum can't small than -0x80000000, big than 0x7FFFFFFF");
+ }
+ }
+ }
+ if (MinNegative) {
+ MinU4 = ~MinU4 + 1;
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16 :
+ MinU2 = _STOU16(I->getText(), I->getLine());
+ if (IntDecStyle) {
+ if (MinNegative) {
+ if (MinU2 > 0x8000) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, I->getLine(), "INT16 type minimum can't small than -0x8000, big than 0x7FFF");
+ }
+ } else {
+ if (MinU2 > 0x7FFF) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, I->getLine(), "INT16 type minimum can't small than -0x8000, big than 0x7FFF");
+ }
+ }
+ }
+ if (MinNegative) {
+ MinU2 = ~MinU2 + 1;
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_8 :
+ MinU1 = _STOU8(I->getText(), I->getLine());
+ if (IntDecStyle) {
+ if (MinNegative) {
+ if (MinU1 > 0x80) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, I->getLine(), "INT8 type minimum can't small than -0x80, big than 0x7F");
+ }
+ } else {
+ if (MinU1 > 0x7F) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, I->getLine(), "INT8 type minimum can't small than -0x80, big than 0x7F");
+ }
+ }
+ }
+ if (MinNegative) {
+ MinU1 = ~MinU1 + 1;
+ }
+ break;
+ }
+ }
+ >>
+ Maximum "="
+ {
+ "\-" << MaxNegative = TRUE; >>
+ }
+ A:Number "," <<
+ if (!IntDecStyle && MaxNegative) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "\"-\" can't be used when not in int decimal type. ");
+ }
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ MaxU4 = _STOU32(A->getText(), A->getLine());
+ if (!IntDecStyle && MaxU4 > (1<< _GET_CURRQEST_VARTINFO().mVarTotalSize) -1) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "BIT type maximum can't bigger than 2^BitWidth -1");
+ }
+ } else {
+ switch (_GET_CURRQEST_DATATYPE()) {
+ case EFI_IFR_TYPE_NUM_SIZE_64 :
+ MaxU8 = _STOU64(A->getText(), A->getLine());
+ if (IntDecStyle) {
+ if (MaxNegative) {
+ if (MaxU8 > 0x8000000000000000) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "INT64 type maximum can't small than -0x8000000000000000, big than 0x7FFFFFFFFFFFFFFF");
+ }
+ } else {
+ if (MaxU8 > 0x7FFFFFFFFFFFFFFF) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "INT64 type maximum can't small than -0x8000000000000000, big than 0x7FFFFFFFFFFFFFFF");
+ }
+ }
+ }
+ if (MaxNegative) {
+ MaxU8 = ~MaxU8 + 1;
+ }
+ if (IntDecStyle) {
+ if ((INT64) MaxU8 < (INT64) MinU8) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
+ }
+ } else {
+ if (MaxU8 < MinU8) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
+ }
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32 :
+ MaxU4 = _STOU32(A->getText(), A->getLine());
+ if (IntDecStyle) {
+ if (MaxNegative) {
+ if (MaxU4 > 0x80000000) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "INT32 type maximum can't small than -0x80000000, big than 0x7FFFFFFF");
+ }
+ } else {
+ if (MaxU4 > 0x7FFFFFFF) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "INT32 type maximum can't small than -0x80000000, big than 0x7FFFFFFF");
+ }
+ }
+ }
+ if (MaxNegative) {
+ MaxU4 = ~MaxU4 + 1;
+ }
+ if (IntDecStyle) {
+ if ((INT32) MaxU4 < (INT32) MinU4) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
+ }
+ } else {
+ if (MaxU4 < MinU4) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
+ }
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16 :
+ MaxU2 = _STOU16(A->getText(), A->getLine());
+ if (IntDecStyle) {
+ if (MaxNegative) {
+ if (MaxU2 > 0x8000) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "INT16 type maximum can't small than -0x8000, big than 0x7FFF");
+ }
+ } else {
+ if (MaxU2 > 0x7FFF) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "INT16 type maximum can't small than -0x8000, big than 0x7FFF");
+ }
+ }
+ }
+ if (MaxNegative) {
+ MaxU2 = ~MaxU2 + 1;
+ }
+ if (IntDecStyle) {
+ if ((INT16) MaxU2 < (INT16) MinU2) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
+ }
+ } else {
+ if (MaxU2 < MinU2) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
+ }
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_8 :
+ MaxU1 = _STOU8(A->getText(), A->getLine());
+ if (IntDecStyle) {
+ if (MaxNegative) {
+ if (MaxU1 > 0x80) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "INT8 type maximum can't small than -0x80, big than 0x7F");
+ }
+ } else {
+ if (MaxU1 > 0x7F) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "INT8 type maximum can't small than -0x80, big than 0x7F");
+ }
+ }
+ }
+ if (MaxNegative) {
+ MaxU1 = ~MaxU1 + 1;
+ }
+ if (IntDecStyle) {
+ if ((INT8) MaxU1 < (INT8) MinU1) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
+ }
+ } else {
+ if (MaxU1 < MinU1) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
+ }
+ }
+ break;
+ }
+ }
+ >>
+ {
+ STEP "=" S:Number ","
+ <<
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ StepU4 = _STOU32(S->getText(), S->getLine());
+ } else {
+ switch (_GET_CURRQEST_DATATYPE()) {
+ case EFI_IFR_TYPE_NUM_SIZE_64 : StepU8 = _STOU64(S->getText(), S->getLine()); break;
+ case EFI_IFR_TYPE_NUM_SIZE_32 : StepU4 = _STOU32(S->getText(), S->getLine()); break;
+ case EFI_IFR_TYPE_NUM_SIZE_16 : StepU2 = _STOU16(S->getText(), S->getLine()); break;
+ case EFI_IFR_TYPE_NUM_SIZE_8 : StepU1 = _STOU8(S->getText(), S->getLine()); break;
+ }
+ }
+ >>
+ }
+ <<
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ $MMSDObj.SetMinMaxStepData (MinU4, MaxU4, StepU4);
+ } else {
+ switch (_GET_CURRQEST_DATATYPE()) {
+ case EFI_IFR_TYPE_NUM_SIZE_64 : $MMSDObj.SetMinMaxStepData (MinU8, MaxU8, StepU8); break;
+ case EFI_IFR_TYPE_NUM_SIZE_32 : $MMSDObj.SetMinMaxStepData (MinU4, MaxU4, StepU4); break;
+ case EFI_IFR_TYPE_NUM_SIZE_16 : $MMSDObj.SetMinMaxStepData (MinU2, MaxU2, StepU2); break;
+ case EFI_IFR_TYPE_NUM_SIZE_8 : $MMSDObj.SetMinMaxStepData (MinU1, MaxU1, StepU1); break;
+ }
+ }
+ >>
+ ;
+
+vfrStatementNumeric :
+ <<
+ CIfrNumeric *NObj = NULL;
+ UINT32 DataTypeSize;
+ BOOLEAN IsSupported = TRUE;
+ UINT8 ShrinkSize = 0;
+ CIfrGuid *GuidObj = NULL;
+ UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
+ EFI_VARSTORE_INFO Info;
+ Info.mVarType = EFI_IFR_TYPE_OTHER;
+ Info.mVarTotalSize = 0;
+ Info.mInfo.mVarOffset = EFI_VAROFFSET_INVALID;
+ Info.mVarStoreId = EFI_VARSTORE_ID_INVALID;
+ Info.mIsBitVar = FALSE;
+ >>
+ L:Numeric
+ vfrQuestionBaseInfo[Info, QId] <<
+ //
+ // Create a GUID opcode to wrap the numeric opcode, if it refer to bit varstore.
+ //
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ GuidObj = new CIfrGuid(0);
+ GuidObj->SetGuid (&gEdkiiIfrBitVarGuid);
+ GuidObj->SetLineNo(L->getLine());
+ }
+ NObj = new CIfrNumeric;
+ NObj->SetLineNo(L->getLine());
+ NObj->SetQuestionId (QId);
+ NObj->SetVarStoreInfo (&Info);
+ >>
+ vfrStatementHeader[NObj]","
+ <<
+ // check data type
+ if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ LFlags = (EDKII_IFR_NUMERIC_SIZE_BIT & (_GET_CURRQEST_VARSIZE()));
+ _PCATCH(NObj->SetFlagsForBitField (NObj->FLAGS(), LFlags), L->getLine());
+ } else {
+ _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "Numeric varid is not the valid data type");
+ if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric varid doesn't support array");
+ }
+ _PCATCH(NObj->SetFlags (NObj->FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
+ }
+ }
+ >>
+ { F:FLAGS "=" vfrNumericFlags[*NObj, F->getLine()] "," }
+ {
+ Key "=" KN:Number "," << AssignQuestionKey (*NObj, KN); >>
+ }
+ vfrSetMinMaxStep[*NObj] <<
+ if (!_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ switch (_GET_CURRQEST_DATATYPE()) {
+ //
+ // Base on the type to know the actual used size,shrink the buffer
+ // size allocate before.
+ //
+ case EFI_IFR_TYPE_NUM_SIZE_8: ShrinkSize = 21;break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:ShrinkSize = 18;break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:ShrinkSize = 12;break;
+ case EFI_IFR_TYPE_NUM_SIZE_64:break;
+ default:
+ IsSupported = FALSE;
+ break;
+ }
+ } else {
+ //
+ // Question stored in bit fields saved as UINT32 type, so the ShrinkSize same as EFI_IFR_TYPE_NUM_SIZE_32.
+ //
+ ShrinkSize = 12;
+ }
+ NObj->ShrinkBinSize (ShrinkSize);
+
+ if (!IsSupported) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric question only support UINT8, UINT16, UINT32 and UINT64 data type.");
+ }
+ >>
+ vfrStatementQuestionOptionList
+ E:EndNumeric <<
+ CRT_END_OP (E);
+ if (GuidObj != NULL) {
+ GuidObj->SetScope(1);
+ CRT_END_OP (E);
+ delete GuidObj;
+ }
+ if (NObj != NULL) delete NObj;
+ >>
+ ";"
+ ;
+
+vfrNumericFlags [CIfrNumeric & NObj, UINT32 LineNum] :
+ <<
+ UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;
+ UINT8 HFlags = 0;
+ BOOLEAN IsSetType = FALSE;
+ BOOLEAN IsDisplaySpecified = FALSE;
+ EFI_VFR_VARSTORE_TYPE VarStoreType = gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
+ >>
+ numericFlagsField[HFlags, LFlags, IsSetType, IsDisplaySpecified, LineNum] ( "\|" numericFlagsField[HFlags, LFlags, IsSetType, IsDisplaySpecified, LineNum] )*
+ <<
+ //check data type flag
+ if (!_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
+ if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
+ _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
+ }
+ } else {
+ // update data type for name/value store
+ UINT32 DataTypeSize;
+ _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
+ gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
+ _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
+ }
+ } else if (IsSetType){
+ _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
+ }
+ _PCATCH(NObj.SetFlags (HFlags, LFlags, IsDisplaySpecified), LineNum);
+ } else if ((_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) && (_GET_CURRQEST_VARTINFO().mIsBitVar)) {
+ LFlags |= (EDKII_IFR_NUMERIC_SIZE_BIT & (_GET_CURRQEST_VARSIZE()));
+ _PCATCH(NObj.SetFlagsForBitField (HFlags, LFlags, IsDisplaySpecified), LineNum);
+ }
+ >>
+ ;
+
+numericFlagsField [UINT8 & HFlags, UINT8 & LFlags, BOOLEAN & IsSetType, BOOLEAN & IsDisplaySpecified, UINT32 LineNum] :
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+ | "NUMERIC_SIZE_1" << if (!_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_1;IsSetType = TRUE;
+ } else {
+ _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Can not specify the size of the numeric value for BIT field");
+ }
+ >>
+ | "NUMERIC_SIZE_2" << if (!_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_2;IsSetType = TRUE;
+ } else {
+ _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Can not specify the size of the numeric value for BIT field");
+ }
+ >>
+ | "NUMERIC_SIZE_4" << if (!_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_4; IsSetType = TRUE;
+ } else {
+ _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Can not specify the size of the numeric value for BIT field");
+ }
+ >>
+ | "NUMERIC_SIZE_8" << if (!_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_8; IsSetType = TRUE;
+ } else {
+ _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Can not specify the size of the numeric value for BIT field");
+ }
+ >>
+ | "DISPLAY_INT_DEC" << if (!_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_INT_DEC;
+ } else {
+ $LFlags = ($LFlags & ~EDKII_IFR_DISPLAY_BIT) | EDKII_IFR_DISPLAY_INT_DEC_BIT;
+ }
+ IsDisplaySpecified = TRUE;
+ >>
+ | "DISPLAY_UINT_DEC" << if (!_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_DEC;
+ } else {
+ $LFlags = ($LFlags & ~EDKII_IFR_DISPLAY_BIT) | EDKII_IFR_DISPLAY_UINT_DEC_BIT;
+ }
+ IsDisplaySpecified = TRUE;
+ >>
+ | "DISPLAY_UINT_HEX" << if (!_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_HEX;
+ } else {
+ $LFlags = ($LFlags & ~EDKII_IFR_DISPLAY_BIT) | EDKII_IFR_DISPLAY_UINT_HEX_BIT;
+ }
+ IsDisplaySpecified = TRUE;
+ >>
+ | questionheaderFlagsField[HFlags]
+ ;
+
+vfrStatementOneOf :
+ <<
+ CIfrOneOf *OObj = NULL;
+ UINT32 DataTypeSize;
+ BOOLEAN IsSupported = TRUE;
+ UINT8 ShrinkSize = 0;
+ CIfrGuid *GuidObj = NULL;
+ UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;;
+ EFI_VARSTORE_INFO Info;
+ Info.mVarType = EFI_IFR_TYPE_OTHER;
+ Info.mVarTotalSize = 0;
+ Info.mInfo.mVarOffset = EFI_VAROFFSET_INVALID;
+ Info.mVarStoreId = EFI_VARSTORE_ID_INVALID;
+ Info.mIsBitVar = FALSE;
+ >>
+ L:OneOf
+ vfrQuestionBaseInfo[Info, QId] <<
+ //
+ // Create a GUID opcode to wrap the oneof opcode, if it refer to bit varstore.
+ //
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ GuidObj = new CIfrGuid(0);
+ GuidObj->SetGuid (&gEdkiiIfrBitVarGuid);
+ GuidObj->SetLineNo(L->getLine());
+ }
+ OObj = new CIfrOneOf;
+ OObj->SetLineNo(L->getLine());
+ OObj->SetQuestionId (QId);
+ OObj->SetVarStoreInfo (&Info);
+ >>
+ vfrStatementHeader[OObj]","
+ << //check data type
+ if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ LFlags = (EDKII_IFR_NUMERIC_SIZE_BIT & (_GET_CURRQEST_VARSIZE()));
+ _PCATCH(OObj->SetFlagsForBitField (OObj->FLAGS(), LFlags), L->getLine());
+ } else {
+ _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "OneOf varid is not the valid data type");
+ if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf varid doesn't support array");
+ }
+ _PCATCH(OObj->SetFlags (OObj->FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
+ }
+ }
+ >>
+ { F:FLAGS "=" vfrOneofFlagsField[*OObj, F->getLine()] "," }
+ {
+ vfrSetMinMaxStep[*OObj]
+ }
+ <<
+ if (!_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ switch (_GET_CURRQEST_DATATYPE()) {
+ //
+ // Base on the type to know the actual used size,shrink the buffer
+ // size allocate before.
+ //
+ case EFI_IFR_TYPE_NUM_SIZE_8: ShrinkSize = 21;break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:ShrinkSize = 18;break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:ShrinkSize = 12;break;
+ case EFI_IFR_TYPE_NUM_SIZE_64:break;
+ default:
+ IsSupported = FALSE;
+ break;
+ }
+ } else {
+ //
+ // Question stored in bit fields saved as UINT32 type, so the ShrinkSize same as EFI_IFR_TYPE_NUM_SIZE_32.
+ //
+ ShrinkSize = 12;
+ }
+ OObj->ShrinkBinSize (ShrinkSize);
+
+ if (!IsSupported) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf question only support UINT8, UINT16, UINT32 and UINT64 data type.");
+ }
+ >>
+ vfrStatementQuestionOptionList
+ E:EndOneOf <<
+ CRT_END_OP (E);
+ if (GuidObj != NULL) {
+ GuidObj->SetScope(1);
+ CRT_END_OP (E);
+ delete GuidObj;
+ }
+ if (OObj != NULL) delete OObj;
+ >>
+ ";"
+ ;
+
+vfrOneofFlagsField [CIfrOneOf & OObj, UINT32 LineNum] :
+ <<
+ UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;
+ UINT8 HFlags = 0;
+ BOOLEAN IsSetType = FALSE;
+ BOOLEAN IsDisplaySpecified = FALSE;
+ EFI_VFR_VARSTORE_TYPE VarStoreType = gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
+ >>
+ numericFlagsField[HFlags, LFlags, IsSetType, IsDisplaySpecified, LineNum] ( "\|" numericFlagsField[HFlags, LFlags, IsSetType, IsDisplaySpecified, LineNum] )*
+ <<
+ //check data type flag
+ if (!_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
+ if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
+ _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
+ }
+ } else {
+ // update data type for Name/Value store
+ UINT32 DataTypeSize;
+ _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
+ gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
+ _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
+ }
+ } else if (IsSetType){
+ _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
+ }
+ _PCATCH(OObj.SetFlags (HFlags, LFlags), LineNum);
+ } else if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ _PCATCH(OObj.SetFlagsForBitField (HFlags, LFlags), LineNum);
+ }
+ >>
+ ;
+
+vfrStatementStringType :
+ vfrStatementString |
+ vfrStatementPassword
+ ;
+
+vfrStatementString :
+ <<
+ CIfrString SObj;
+ UINT32 VarArraySize;
+ UINT8 StringMinSize;
+ UINT8 StringMaxSize;
+ >>
+ L:String << SObj.SetLineNo(L->getLine()); gIsStringOp = TRUE;>>
+ vfrQuestionHeader[SObj] ","
+ { F:FLAGS "=" vfrStringFlagsField[SObj, F->getLine()] "," }
+ {
+ Key "=" KN:Number "," << AssignQuestionKey (SObj, KN); >>
+ }
+ MinSize "=" MIN:Number "," <<
+ VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
+ StringMinSize = _STOU8(MIN->getText(), MIN->getLine());
+ if (_STOU64(MIN->getText(), MIN->getLine()) > StringMinSize) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "String MinSize takes only one byte, which can't be larger than 0xFF.");
+ } else if (VarArraySize != 0 && StringMinSize > VarArraySize) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "String MinSize can't be larger than the max number of elements in string array.");
+ }
+ SObj.SetMinSize (StringMinSize);
+ >>
+ MaxSize "=" MAX:Number "," <<
+ StringMaxSize = _STOU8(MAX->getText(), MAX->getLine());
+ if (_STOU64(MAX->getText(), MAX->getLine()) > StringMaxSize) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize takes only one byte, which can't be larger than 0xFF.");
+ } else if (VarArraySize != 0 && StringMaxSize > VarArraySize) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize can't be larger than the max number of elements in string array.");
+ } else if (StringMaxSize < StringMinSize) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize can't be less than String MinSize.");
+ }
+ SObj.SetMaxSize (StringMaxSize);
+ >>
+ vfrStatementQuestionOptionList
+ E:EndString << CRT_END_OP (E); gIsStringOp = FALSE;>>
+ ";"
+ ;
+
+vfrStringFlagsField [CIfrString & SObj, UINT32 LineNum] :
+ <<
+ UINT8 LFlags = 0;
+ UINT8 HFlags = 0;
+ >>
+ stringFlagsField[HFlags, LFlags] ( "\|" stringFlagsField[HFlags, LFlags] )*
+ << _PCATCH(SObj.SetFlags (HFlags, LFlags), LineNum); >>
+ ;
+
+stringFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+ | "MULTI_LINE" << $LFlags = 0x01; >>
+ | questionheaderFlagsField[HFlags]
+ ;
+
+vfrStatementPassword :
+ <<
+ CIfrPassword PObj;
+ UINT32 VarArraySize;
+ UINT16 PasswordMinSize;
+ UINT16 PasswordMaxSize;
+ >>
+ L:Password << PObj.SetLineNo(L->getLine()); >>
+ vfrQuestionHeader[PObj] ","
+ { F:FLAGS "=" vfrPasswordFlagsField[PObj, F->getLine()] "," }
+ {
+ Key "=" KN:Number "," << AssignQuestionKey (PObj, KN); >>
+ }
+ MinSize "=" MIN:Number "," <<
+ VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
+ PasswordMinSize = _STOU16(MIN->getText(), MIN->getLine());
+ if (_STOU64(MIN->getText(), MIN->getLine()) > PasswordMinSize) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "Password MinSize takes only two byte, which can't be larger than 0xFFFF.");
+ } else if (VarArraySize != 0 && PasswordMinSize > VarArraySize) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "Password MinSize can't be larger than the max number of elements in password array.");
+ }
+ PObj.SetMinSize (PasswordMinSize);
+ >>
+ MaxSize "=" MAX:Number "," <<
+ PasswordMaxSize = _STOU16(MAX->getText(), MAX->getLine());
+ if (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize takes only two byte, which can't be larger than 0xFFFF.");
+ } else if (VarArraySize != 0 && PasswordMaxSize > VarArraySize) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize can't be larger than the max number of elements in password array.");
+ } else if (PasswordMaxSize < PasswordMinSize) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize can't be less than Password MinSize.");
+ }
+ PObj.SetMaxSize (PasswordMaxSize);
+ >>
+ { Encoding "=" Number "," }
+ vfrStatementQuestionOptionList
+ E:EndPassword << CRT_END_OP (E); >>
+ ";"
+ ;
+
+vfrPasswordFlagsField [CIfrPassword & PObj, UINT32 LineNum] :
+ << UINT8 HFlags = 0; >>
+ passwordFlagsField[HFlags] ( "\|" passwordFlagsField[HFlags] )*
+ << _PCATCH(PObj.SetFlags(HFlags), LineNum); >>
+ ;
+
+passwordFlagsField [UINT8 & HFlags] :
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+ | questionheaderFlagsField[HFlags]
+ ;
+
+vfrStatementOrderedList :
+ <<
+ CIfrOrderedList OLObj;
+ UINT32 VarArraySize;
+ >>
+ L:OrderedList << OLObj.SetLineNo(L->getLine()); gIsOrderedList = TRUE;>>
+ vfrQuestionHeader[OLObj] ","
+ <<
+ VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
+ OLObj.SetMaxContainers ((UINT8) (VarArraySize > 0xFF ? 0xFF : VarArraySize));
+ >>
+ {
+ MaxContainers "=" M:Number "," <<
+ if (_STOU64(M->getText(), M->getLine()) > _STOU8(M->getText(), M->getLine())) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList MaxContainers takes only one byte, which can't be larger than 0xFF.");
+ } else if (VarArraySize != 0 && _STOU8(M->getText(), M->getLine()) > VarArraySize) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList MaxContainers can't be larger than the max number of elements in array.");
+ }
+ OLObj.SetMaxContainers (_STOU8(M->getText(), M->getLine()));
+ >>
+ }
+ { F:FLAGS "=" vfrOrderedListFlags[OLObj, F->getLine()] {","}}
+ vfrStatementQuestionOptionList
+ E:EndList << CRT_END_OP (E); gIsOrderedList = FALSE;>>
+ ";"
+ ;
+
+vfrOrderedListFlags [CIfrOrderedList & OLObj, UINT32 LineNum] :
+ <<
+ UINT8 HFlags = 0;
+ UINT8 LFlags = 0;
+ >>
+ orderedlistFlagsField[HFlags, LFlags] ( "\|" orderedlistFlagsField[HFlags, LFlags] )*
+ << _PCATCH(OLObj.SetFlags (HFlags, LFlags), LineNum); >>
+ ;
+
+orderedlistFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+ | "UNIQUE" << $LFlags |= 0x01; >>
+ | "NOEMPTY" << $LFlags |= 0x02; >>
+ | questionheaderFlagsField[HFlags]
+ ;
+
+vfrStatementTime :
+ <<
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
+ CHAR8 *VarIdStr[3] = {NULL, };
+ CIfrTime TObj;
+ EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
+ UINT8 Size = OFFSET_OF (EFI_IFR_DEFAULT, Value) + sizeof (EFI_HII_TIME);
+ >>
+ L:Time << TObj.SetLineNo(L->getLine()); >>
+ (
+ (
+ vfrQuestionHeader[TObj, QUESTION_TIME] "," <<
+ if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
+ _GET_CURRQEST_VARTINFO().mVarType = EFI_IFR_TYPE_TIME;
+ }
+ >>
+ { F:FLAGS "=" vfrTimeFlags[TObj, F->getLine()] "," }
+ vfrStatementQuestionOptionList
+ )
+ |
+ (
+ Hour VarId "=" T1:StringIdentifier "." T1H:StringIdentifier ","
+ << _STRCAT(&VarIdStr[0], T1->getText()); _STRCAT(&VarIdStr[0], "."); _STRCAT(&VarIdStr[0], T1H->getText()); >>
+ Prompt "=" "STRING_TOKEN" "\(" HP:Number "\)" ","
+ Help "=" "STRING_TOKEN" "\(" HH:Number "\)" ","
+ minMaxTimeStepDefault[Val.time, 0]
+
+ Minute VarId "=" T2:StringIdentifier "." T2M:StringIdentifier ","
+ << _STRCAT(&VarIdStr[1], T2->getText()); _STRCAT(&VarIdStr[1], "."); _STRCAT(&VarIdStr[1], T2M->getText()); >>
+ Prompt "=" "STRING_TOKEN" "\(" MP:Number "\)" ","
+ Help "=" "STRING_TOKEN" "\(" MH:Number "\)" ","
+ minMaxTimeStepDefault[Val.time, 1]
+
+ Second VarId "=" T3:StringIdentifier "." T3S:StringIdentifier ","
+ << _STRCAT(&VarIdStr[2], T3->getText()); _STRCAT(&VarIdStr[2], "."); _STRCAT(&VarIdStr[2], T3S->getText()); >>
+ Prompt "=" "STRING_TOKEN" "\(" SP:Number "\)" ","
+ Help "=" "STRING_TOKEN" "\(" SH:Number "\)" ","
+ minMaxTimeStepDefault[Val.time, 2]
+ { G:FLAGS "=" vfrTimeFlags[TObj, G->getLine()] "," }
+ <<
+ mCVfrQuestionDB.RegisterOldTimeQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId);
+ TObj.SetQuestionId (QId);
+ TObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_TIME_STORAGE_TIME);
+ TObj.SetPrompt (_STOSID(HP->getText(), HP->getLine()));
+ TObj.SetHelp (_STOSID(HH->getText(), HH->getLine()));
+ if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }
+ >>
+ << {CIfrDefault DefaultObj(Size, EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_TIME, Val); DefaultObj.SetLineNo(L->getLine());} >>
+ )
+ ( vfrStatementInconsistentIf )*
+ )
+ E:EndTime << CRT_END_OP (E); >>
+ ";"
+ ;
+
+minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :
+ Minimum "=" Number ","
+ Maximum "=" Number ","
+ { "step" "=" Number "," }
+ {
+ "default" "=" N:Number "," <<
+ switch (KeyValue) {
+ case 0:
+ T.Hour = _STOU8(N->getText(), N->getLine());
+ if (T.Hour > 23) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must be between 0 and 23.");
+ }
+ break;
+ case 1:
+ T.Minute = _STOU8(N->getText(), N->getLine());
+ if (T.Minute > 59) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value must be between 0 and 59.");
+ }
+ break;
+ case 2:
+ T.Second = _STOU8(N->getText(), N->getLine());
+ if (T.Second > 59) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value must be between 0 and 59.");
+ }
+ break;
+ }
+ >>
+ }
+ ;
+
+vfrTimeFlags [CIfrTime & TObj, UINT32 LineNum] :
+ << UINT8 LFlags = 0; >>
+ timeFlagsField[LFlags] ( "\|" timeFlagsField[LFlags] )*
+ << _PCATCH(TObj.SetFlags(EFI_IFR_QUESTION_FLAG_DEFAULT, LFlags), LineNum); >>
+ ;
+
+timeFlagsField [UINT8 & Flags] :
+ N:Number << $Flags |= _STOU8(N->getText(), N->getLine()); >>
+ | "HOUR_SUPPRESS" << $Flags |= 0x01; >>
+ | "MINUTE_SUPPRESS" << $Flags |= 0x02; >>
+ | "SECOND_SUPPRESS" << $Flags |= 0x04; >>
+ | "STORAGE_NORMAL" << $Flags |= 0x00; >>
+ | "STORAGE_TIME" << $Flags |= 0x10; >>
+ | "STORAGE_WAKEUP" << $Flags |= 0x20; >>
+ ;
+
+vfrStatementQuestionTag :
+ vfrStatementStatTag "," |
+ vfrStatementInconsistentIf |
+ vfrStatementNoSubmitIf |
+ vfrStatementDisableIfQuest |
+ vfrStatementRefresh |
+ vfrStatementVarstoreDevice |
+ vfrStatementExtension |
+ vfrStatementRefreshEvent "," |
+ vfrStatementWarningIf
+ ;
+
+vfrStatementQuestionTagList :
+ ( vfrStatementQuestionTag )*
+ ;
+
+vfrStatementQuestionOptionTag :
+ vfrStatementSuppressIfQuest |
+ vfrStatementGrayOutIfQuest |
+ vfrStatementValue |
+ vfrStatementDefault |
+ vfrStatementRead |
+ vfrStatementWrite |
+ vfrStatementOptions
+ ;
+
+vfrStatementQuestionOptionList :
+ (
+ vfrStatementQuestionTag |
+ vfrStatementQuestionOptionTag
+ )*
+ ;
+
+vfrStatementStatList :
+ vfrStatementStat |
+ vfrStatementQuestions |
+ vfrStatementConditionalNew |
+ vfrStatementLabel |
+ vfrStatementExtension |
+ // Just for framework vfr compatibility
+ vfrStatementInvalid
+ ;
+
+vfrStatementStatListOld :
+ vfrStatementStat |
+ vfrStatementQuestions |
+ vfrStatementLabel |
+ // Just for framework vfr compatibility
+ vfrStatementInvalid
+ ;
+
+vfrStatementDisableIfStat :
+ <<
+ CIfrDisableIf DIObj;
+ >>
+ L:DisableIf << DIObj.SetLineNo(L->getLine()); >>
+ vfrStatementExpression[0] ";"
+ ( vfrStatementStatList )*
+ E:EndIf << CRT_END_OP (E); >>
+ ";"
+ ;
+
+vfrStatementInconsistentIfStat :
+ << CIfrInconsistentIf IIObj; >>
+ L:InconsistentIf <<
+ _PCATCH (VFR_RETURN_UNSUPPORTED, L);
+ IIObj.SetLineNo(L->getLine());
+ >>
+ Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText(), S->getLine())); >>
+ { FLAGS "=" flagsField ( "\|" flagsField )* "," }
+ vfrStatementExpression[0]
+ E:EndIf << CRT_END_OP (E); >>
+ ";"
+ ;
+
+//
+// Compatible for framework vfr file
+//
+vfrStatementgrayoutIfSuppressIf:
+ << CIfrSuppressIf SIObj; >>
+ L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>
+ { FLAGS "=" flagsField ( "\|" flagsField )* "," }
+ vfrStatementExpression[0]
+ ";"
+ ;
+
+vfrStatementsuppressIfGrayOutIf:
+ << CIfrGrayOutIf GOIObj; >>
+ L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>
+ { FLAGS "=" flagsField ( "\|" flagsField )* "," }
+ vfrStatementExpression[0]
+ ";"
+ ;
+
+vfrStatementSuppressIfStatNew :
+ << CIfrSuppressIf SIObj;>>
+ L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>
+ { FLAGS "=" flagsField ( "\|" flagsField )* "," }
+ vfrStatementExpression[0]
+ ";"
+ ( vfrStatementStatList )*
+ E: EndIf ";" << CRT_END_OP (E); >>
+ ;
+
+vfrStatementGrayOutIfStatNew :
+ << CIfrGrayOutIf GOIObj;>>
+ L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>
+ { FLAGS "=" flagsField ( "\|" flagsField )* "," }
+ vfrStatementExpression[0]
+ ";"
+ ( vfrStatementStatList )*
+ E: EndIf ";" << CRT_END_OP (E); >>
+ ;
+
+vfrImageTag :
+ << CIfrImage IObj; >>
+ L:Image "=" "IMAGE_TOKEN" "\(" S1:Number "\)" << IObj.SetImageId (_STOSID(S1->getText(), S1->getLine())); IObj.SetLineNo(L->getLine()); >>
+ ;
+
+vfrLockedTag :
+ << CIfrLocked LObj; >>
+ L:Locked << LObj.SetLineNo(L->getLine()); >>
+ ;
+
+vfrModalTag :
+ << CIfrModal MObj; >>
+ L:Modal << MObj.SetLineNo(L->getLine()); >>
+ ;
+
+vfrStatementStatTag :
+ vfrImageTag |
+ vfrLockedTag
+ ;
+
+vfrStatementStatTagList :
+ vfrStatementStatTag ( "," vfrStatementStatTag )*
+ ;
+
+vfrStatementImage :
+ vfrImageTag
+ ";"
+ ;
+
+vfrStatementModal :
+ vfrModalTag
+ ";"
+ ;
+
+vfrStatementLocked :
+ vfrLockedTag
+ ";"
+ ;
+
+vfrStatementInconsistentIf :
+ << CIfrInconsistentIf IIObj; >>
+ L:InconsistentIf << IIObj.SetLineNo(L->getLine()); >>
+ Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText(), S->getLine())); >>
+ { FLAGS "=" flagsField ( "\|" flagsField )* "," }
+ vfrStatementExpression[0]
+ E:EndIf {";"} << CRT_END_OP (E); >>
+ ;
+
+vfrStatementNoSubmitIf :
+ << CIfrNoSubmitIf NSIObj; >>
+ L:NoSubmitIf << NSIObj.SetLineNo(L->getLine()); >>
+ Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << NSIObj.SetError (_STOSID(S->getText(), S->getLine())); >>
+ { FLAGS "=" flagsField ( "\|" flagsField )* "," }
+ vfrStatementExpression[0]
+ E:EndIf {";"} << CRT_END_OP (E); >>
+ ;
+
+vfrStatementWarningIf :
+ << CIfrWarningIf WIObj; >>
+ L:WarningIf << WIObj.SetLineNo(L->getLine()); >>
+ Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << WIObj.SetWarning (_STOSID(S->getText(), S->getLine())); >>
+ {Timeout "=" T:Number "," << WIObj.SetTimeOut (_STOU8(T->getText(), T->getLine())); >>}
+ vfrStatementExpression[0]
+ E:EndIf {";"} << CRT_END_OP (E); >>
+ ;
+
+vfrStatementDisableIfQuest :
+ <<
+ CIfrDisableIf DIObj;
+ >>
+ L:DisableIf << DIObj.SetLineNo(L->getLine()); >>
+ vfrStatementExpression[0] ";"
+ vfrStatementQuestionOptionList
+ E:EndIf {";"} << CRT_END_OP (E); >>
+ ;
+
+vfrStatementRefresh :
+ << CIfrRefresh RObj; >>
+ L:Refresh << RObj.SetLineNo(L->getLine()); >>
+ Interval "=" I:Number << RObj.SetRefreshInterval (_STOU8(I->getText(), I->getLine())); >>
+ ;
+
+vfrStatementRefreshEvent :
+ <<
+ CIfrRefreshId RiObj;
+ EFI_GUID Guid;
+ >>
+ L:RefreshGuid << RiObj.SetLineNo(L->getLine()); >>
+ "=" guidDefinition[Guid] << RiObj.SetRefreshEventGroutId (&Guid); >>
+ ;
+
+vfrStatementVarstoreDevice :
+ << CIfrVarStoreDevice VDObj; >>
+ L:VarstoreDevice << VDObj.SetLineNo(L->getLine()); >>
+ "=" "STRING_TOKEN" "\(" S:Number "\)" "," << VDObj.SetDevicePath (_STOSID(S->getText(), S->getLine())); >>
+ ;
+
+vfrStatementSuppressIfQuest :
+ << CIfrSuppressIf SIObj; >>
+ L:SuppressIf << SIObj.SetLineNo(L->getLine()); >>
+ { FLAGS "=" flagsField ( "\|" flagsField )* "," }
+ vfrStatementExpression[0] ";"
+ vfrStatementQuestionOptionList
+ E:EndIf {";"} << CRT_END_OP (E); >>
+ ;
+
+vfrStatementGrayOutIfQuest :
+ << CIfrGrayOutIf GOIObj; >>
+ L:GrayOutIf << GOIObj.SetLineNo(L->getLine()); >>
+ { FLAGS "=" flagsField ( "\|" flagsField )* "," }
+ vfrStatementExpression[0] ";"
+ vfrStatementQuestionOptionList
+ E:EndIf {";"} << CRT_END_OP (E); >>
+ ;
+
+vfrStatementOptions :
+ vfrStatementOneOfOption
+ ;
+
+vfrStatementOneOfOption :
+ <<
+ UINT8 ValueList[EFI_IFR_MAX_LENGTH] = {0,};
+ EFI_IFR_TYPE_VALUE *Val = (EFI_IFR_TYPE_VALUE *) ValueList;
+ CHAR8 *VarStoreName = NULL;
+ UINT32 Size = 0;
+ BOOLEAN TypeError = FALSE;
+ EFI_VFR_RETURN_CODE ReturnCode = VFR_RETURN_SUCCESS;
+ EFI_GUID *VarStoreGuid = NULL;
+ BOOLEAN ArrayType = FALSE;
+ CIfrOneOfOption *OOOObj;
+ UINT8 *Type8 = (UINT8 *) ValueList;
+ UINT16 *Type16 = (UINT16 *) ValueList;
+ UINT32 *Type32 = (UINT32 *) ValueList;
+ UINT64 *Type64 = (UINT64 *) ValueList;
+ >>
+ L:Option <<
+ if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
+ _PCATCH (VFR_RETURN_FATAL_ERROR, L->getLine(), "Get data type error.");
+ }
+
+ >>
+ Text "=" "STRING_TOKEN" "\(" S:Number "\)" ","
+ Value "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","
+ <<
+ if (gCurrentMinMaxData != NULL) {
+ //set min/max value for oneof opcode
+ UINT64 Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE(), _GET_CURRQEST_VARTINFO().mIsBitVar);
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ gCurrentMinMaxData->SetMinMaxStepData(Val->u32, Val->u32, (UINT32) Step);
+ } else {
+ switch (_GET_CURRQEST_DATATYPE()) {
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ gCurrentMinMaxData->SetMinMaxStepData(Val->u64, Val->u64, Step);
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ gCurrentMinMaxData->SetMinMaxStepData(Val->u32, Val->u32, (UINT32) Step);
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ gCurrentMinMaxData->SetMinMaxStepData(Val->u16, Val->u16, (UINT16) Step);
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ gCurrentMinMaxData->SetMinMaxStepData(Val->u8, Val->u8, (UINT8) Step);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
+ Size = sizeof (EFI_IFR_TYPE_VALUE);
+ } else if (ArrayType) {
+ switch (_GET_CURRQEST_DATATYPE()) {
+ case EFI_IFR_TYPE_NUM_SIZE_8 :
+ while (Type8[Size] != 0) {
+ Size++;
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16 :
+ while (Type16[Size] != 0) {
+ Size++;
+ }
+ Size *= sizeof (UINT16);
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32 :
+ while (Type32[Size] != 0) {
+ Size++;
+ }
+ Size *= sizeof (UINT32);
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_64 :
+ while (Type64[Size] != 0) {
+ Size++;
+ }
+ Size *= sizeof (UINT64);
+ break;
+ default:
+ break;
+ }
+ } else {
+ //
+ // For the oneof stored in bit fields, set the option type as UINT32.
+ //
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ Size = sizeof (UINT32);
+ } else {
+ ReturnCode = gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &Size);
+ }
+ }
+ if (ReturnCode != VFR_RETURN_SUCCESS) {
+ _PCATCH (ReturnCode, L->getLine());
+ }
+
+ Size += OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value);
+ OOOObj = new CIfrOneOfOption((UINT8)Size);
+ OOOObj->SetLineNo(L->getLine());
+ OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
+ if (ArrayType) {
+ OOOObj->SetType (EFI_IFR_TYPE_BUFFER);
+ } else {
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ OOOObj->SetType ( EFI_IFR_TYPE_NUM_SIZE_32);
+ } else {
+ OOOObj->SetType (_GET_CURRQEST_DATATYPE());
+ }
+ }
+ OOOObj->SetValue (*Val);
+ >>
+ F:FLAGS "=" vfrOneOfOptionFlags[*OOOObj, F->getLine()]
+ <<
+ //
+ // Array type only for default type OneOfOption.
+ //
+ if ((OOOObj->GetFlags () & (EFI_IFR_OPTION_DEFAULT | EFI_IFR_OPTION_DEFAULT_MFG)) == 0 && ArrayType) {
+ _PCATCH (VFR_RETURN_FATAL_ERROR, L->getLine(), "Default keyword should with array value type!");
+ }
+
+ //
+ // Clear the default flag if the option not use array value but has default flag.
+ //
+ if ((OOOObj->GetFlags () & (EFI_IFR_OPTION_DEFAULT | EFI_IFR_OPTION_DEFAULT_MFG)) != 0 && !ArrayType && gIsOrderedList) {
+ OOOObj->SetFlags(OOOObj->GetFlags () & ~(EFI_IFR_OPTION_DEFAULT | EFI_IFR_OPTION_DEFAULT_MFG));
+ }
+
+ if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ _PCATCH(gCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), L->getLine());
+ VarStoreGuid = gCVfrDataStorage.GetVarStoreGuid(_GET_CURRQEST_VARTINFO().mVarStoreId);
+ if (OOOObj->GetFlags () & EFI_IFR_OPTION_DEFAULT) {
+ CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_STANDARD, F);
+ _PCATCH(gCVfrDefaultStore.BufferVarStoreAltConfigAdd (
+ EFI_HII_DEFAULT_CLASS_STANDARD,
+ _GET_CURRQEST_VARTINFO(),
+ VarStoreName,
+ VarStoreGuid,
+ _GET_CURRQEST_DATATYPE (),
+ *Val
+ ), L->getLine());
+ }
+ if (OOOObj->GetFlags () & EFI_IFR_OPTION_DEFAULT_MFG) {
+ CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_MANUFACTURING, F);
+ _PCATCH(gCVfrDefaultStore.BufferVarStoreAltConfigAdd (
+ EFI_HII_DEFAULT_CLASS_MANUFACTURING,
+ _GET_CURRQEST_VARTINFO(),
+ VarStoreName,
+ VarStoreGuid,
+ _GET_CURRQEST_DATATYPE (),
+ *Val
+ ), L->getLine());
+ }
+ }
+ >>
+ {
+ "," Key "=" KN:Number <<
+ _PCATCH (VFR_RETURN_UNSUPPORTED, KN);
+ //
+ // Guid Option Key
+ //
+ CIfrOptionKey IfrOptionKey (
+ gCurrentQuestion->QUESTION_ID(),
+ *Val,
+ _STOQID(KN->getText(), KN->getLine())
+ );
+ SET_LINE_INFO (IfrOptionKey, KN);
+ >>
+ }
+ (
+ T:"," vfrImageTag << OOOObj->SetScope (1); CRT_END_OP (T); >>
+ )*
+ ";" << if (OOOObj != NULL) {delete OOOObj;} >>
+ ;
+
+vfrOneOfOptionFlags [CIfrOneOfOption & OOOObj, UINT32 LineNum] :
+ <<
+ UINT8 LFlags = _GET_CURRQEST_DATATYPE();
+ UINT8 HFlags = 0;
+ >>
+ oneofoptionFlagsField[HFlags, LFlags] ( "\|" oneofoptionFlagsField[HFlags, LFlags] )*
+ << _PCATCH(gCurrentQuestion->SetFlags(HFlags), LineNum); >>
+ << _PCATCH(OOOObj.SetFlags(LFlags), LineNum); >>
+ ;
+
+oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
+ N:Number << $LFlags |= _STOU8(N->getText(), N->getLine()); >>
+ | "OPTION_DEFAULT" << $LFlags |= 0x10; >>
+ | "OPTION_DEFAULT_MFG" << $LFlags |= 0x20; >>
+ | InteractiveFlag << $HFlags |= 0x04; >>
+ | ResetRequiredFlag << $HFlags |= 0x10; >>
+ | ReconnectRequiredFlag << $HFlags |= 0x40; >>
+ | ManufacturingFlag << $LFlags |= 0x20; >>
+ | DefaultFlag << $LFlags |= 0x10; >>
+ | A:NVAccessFlag <<
+ gCVfrErrorHandle.HandleWarning (
+ VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,
+ A->getLine(),
+ A->getText()
+ );
+ >>
+ | L:LateCheckFlag <<
+ gCVfrErrorHandle.HandleWarning (
+ VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,
+ L->getLine(),
+ L->getText()
+ );
+ >>
+ ;
+
+vfrStatementLabel :
+ L:Label
+ N:Number <<
+ {
+ CIfrLabel LObj2;
+ LObj2.SetLineNo(L->getLine());
+ LObj2.SetNumber (_STOU16(N->getText(), N->getLine()));
+ }
+ >>
+ ";"
+ ;
+
+vfrStatementBanner :
+ << CIfrBanner BObj; >>
+ B:Banner { "," } << BObj.SetLineNo(B->getLine()); >>
+ Title "=" "STRING_TOKEN" "\(" S:Number "\)" "," << BObj.SetTitle (_STOSID(S->getText(), S->getLine())); >>
+ (
+ (
+ Line L:Number "," << BObj.SetLine (_STOU16(L->getText(), L->getLine())); >>
+ Align
+ (
+ Left << BObj.SetAlign (0); >>
+ | Center << BObj.SetAlign (1); >>
+ | Right << BObj.SetAlign (2); >>
+ ) ";"
+ )
+ |
+ (
+ Timeout "=" T:Number ";" << {CIfrTimeout TObj(_STOU16(T->getText(), T->getLine()));} >>
+ )
+ )
+ ;
+
+//******************************************************************************
+//
+// keep some syntax for compatibility but not generate any IFR object
+//
+vfrStatementInvalidHidden :
+ L:Hidden <<
+ _PCATCH (VFR_RETURN_UNSUPPORTED, L);
+ >>
+ Value "=" Number ","
+ Key "=" Number ";"
+ ;
+
+vfrStatementInvalidInconsistentIf :
+ InconsistentIf
+ Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" ","
+ { FLAGS "=" flagsField ( "\|" flagsField )* "," }
+ vfrStatementExpression[0]
+ EndIf
+ ";"
+ ;
+
+vfrStatementInvalidInventory :
+ L:Inventory <<
+ _PCATCH (VFR_RETURN_UNSUPPORTED, L);
+ >>
+ Help "=" "STRING_TOKEN" "\(" Number "\)" ","
+ Text "=" "STRING_TOKEN" "\(" Number "\)" ","
+ {
+ Text "=" "STRING_TOKEN" "\(" Number "\)"
+ }
+ ";"
+ ;
+
+vfrStatementInvalidSaveRestoreDefaults :
+ (
+ L:Save <<
+ _PCATCH (VFR_RETURN_UNSUPPORTED, L);
+ >>
+ |
+ K:Restore <<
+ _PCATCH (VFR_RETURN_UNSUPPORTED, K);
+ >>
+ )
+ Defaults ","
+ FormId "=" Number ","
+ Prompt "=" "STRING_TOKEN" "\(" Number "\)" ","
+ Help "=" "STRING_TOKEN" "\(" Number "\)"
+ { "," FLAGS "=" flagsField ( "\|" flagsField )* }
+ { "," Key "=" Number }
+ ";"
+ ;
+
+//******************************************************************************
+//
+// The syntax of expression
+//
+#token Dup("dup") "dup"
+#token VarEqVal("vareqval") "vareqval"
+#token Var("var") "var"
+#token IdEqVal("ideqval") "ideqval"
+#token IdEqId("ideqid") "ideqid"
+#token IdEqValList("ideqvallist") "ideqvallist"
+#token QuestionRef("questionref") "questionref"
+#token RuleRef("ruleref") "ruleref"
+#token StringRef("stringref") "stringref"
+#token PushThis("pushthis") "pushthis"
+#token Security("security") "security"
+#token Get("get") "get"
+#token True("TRUE") "TRUE"
+#token False("FALSE") "FALSE"
+#token One("ONE") "ONE"
+#token Ones("ONES") "ONES"
+#token Zero("ZERO") "ZERO"
+#token Undefined("UNDEFINED") "UNDEFINED"
+#token Version("VERSION") "VERSION"
+#token Length("length") "length"
+#token AND("AND") "AND"
+#token OR("OR") "OR"
+#token NOT("NOT") "NOT"
+#token Set("set") "set"
+#token BitWiseNot("~") "\~"
+#token BoolVal("boolval") "boolval"
+#token StringVal("stringval") "stringval"
+#token UnIntVal("unintval") "unintval"
+#token ToUpper("toupper") "toupper"
+#token ToLower("tolower") "tolower"
+#token Match("match") "match"
+#token Match2("match2") "match2"
+#token Catenate("catenate") "catenate"
+#token QuestionRefVal("questionrefval") "questionrefval"
+#token StringRefVal("stringrefval") "stringrefval"
+#token Map("map") "map"
+#token RefreshGuid("refreshguid") "refreshguid"
+
+//
+// Root expression extension function called by other function.
+//
+vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :
+ <<
+ if ($RootLevel == 0) {
+ mCIfrOpHdrIndex ++;
+ if (mCIfrOpHdrIndex >= MAX_IFR_EXPRESSION_DEPTH) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, 0, "The depth of expression exceeds the max supported level 8!");
+ }
+ _INIT_OPHDR_COND ();
+ }
+ >>
+ andTerm[$RootLevel, $ExpOpCount]
+ (
+ L:OR andTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrOr OObj(L->getLine()); >>
+ )*
+ <<
+ //
+ // Extend OpCode Scope only for the root expression.
+ //
+ if ($ExpOpCount > 1 && $RootLevel == 0) {
+ if (_SET_SAVED_OPHDR_SCOPE()) {
+ CIfrEnd EObj;
+ if (mCIfrOpHdrLineNo[mCIfrOpHdrIndex] != 0) {
+ EObj.SetLineNo (mCIfrOpHdrLineNo[mCIfrOpHdrIndex]);
+ }
+ }
+ }
+
+ if ($RootLevel == 0) {
+ _CLEAR_SAVED_OPHDR ();
+ mCIfrOpHdrIndex --;
+ }
+ >>
+ ;
+
+//
+// Add new sub function for the sub expression extension to remember the ExpOpCount
+// This function is only called by sub expression.
+//
+vfrStatementExpressionSub [UINT32 RootLevel, UINT32 & ExpOpCount] :
+ andTerm[$RootLevel, $ExpOpCount]
+ (
+ L:OR andTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrOr OObj(L->getLine()); >>
+ )*
+ ;
+
+andTerm[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ bitwiseorTerm[$RootLevel, $ExpOpCount]
+ (
+ L:AND bitwiseorTerm [$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrAnd AObj(L->getLine()); >>
+ )*
+ ;
+
+bitwiseorTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ bitwiseandTerm[$RootLevel, $ExpOpCount]
+ (
+ L:"\|" bitwiseandTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrBitWiseOr BWOObj(L->getLine()); >>
+ )*
+ ;
+
+bitwiseandTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ equalTerm[$RootLevel, $ExpOpCount]
+ (
+ L:"&" equalTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrBitWiseAnd BWAObj(L->getLine()); >>
+ )*
+ ;
+
+equalTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ compareTerm[$RootLevel, $ExpOpCount]
+ (
+ (
+ L1:"==" compareTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrEqual EObj(L1->getLine()); >>
+ )
+ |
+ (
+ L2:"!=" compareTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrNotEqual NEObj(L2->getLine()); >>
+ )
+ )*
+ ;
+
+compareTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ shiftTerm[$RootLevel, $ExpOpCount]
+ (
+ (
+ L1:"<" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrLessThan LTObj(L1->getLine()); >>
+ )
+ |
+ (
+ L2:"<=" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrLessEqual LEObj(L2->getLine()); >>
+ )
+ |
+ (
+ L3:">" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrGreaterThan GTObj(L3->getLine()); >>
+ )
+ |
+ (
+ L4:">=" shiftTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrGreaterEqual GEObj(L4->getLine()); >>
+ )
+ )*
+ ;
+
+shiftTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ addMinusTerm[$RootLevel, $ExpOpCount]
+ (
+ (
+ L1:"\<<" addMinusTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrShiftLeft SLObj(L1->getLine()); >>
+ )
+ |
+ (
+ L2:"\>>" addMinusTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrShiftRight SRObj(L2->getLine()); >>
+ )
+ )*
+ ;
+
+addMinusTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ multdivmodTerm[$RootLevel, $ExpOpCount]
+ (
+ (
+ L1:"\+" multdivmodTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrAdd AObj(L1->getLine()); >>
+ )
+ |
+ (
+ L2:"\-" multdivmodTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrSubtract SObj(L2->getLine()); >>
+ )
+ )*
+ ;
+
+multdivmodTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ castTerm[$RootLevel, $ExpOpCount]
+ (
+ (
+ L1:"\*" castTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrMultiply MObj(L1->getLine()); >>
+ )
+ |
+ (
+ L2:"/" castTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrDivide DObj(L2->getLine()); >>
+ )
+ |
+ (
+ L3:"%" castTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrModulo MObj(L3->getLine()); >>
+ )
+ )*
+ ;
+
+castTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ << UINT8 CastType = 0xFF; >>
+ (
+ L:"\("
+ (
+ Boolean << CastType = 0; >>
+ | Uint64 << CastType = 1; >>
+ | Uint32 << CastType = 1; >>
+ | Uint16 << CastType = 1; >>
+ | Uint8 << CastType = 1; >>
+ )
+ "\)"
+ )*
+ atomTerm[$RootLevel, $ExpOpCount]
+ <<
+ switch (CastType) {
+ case 0: { CIfrToBoolean TBObj(L->getLine()); $ExpOpCount++; } break;
+ case 1: { CIfrToUint TUObj(L->getLine()); $ExpOpCount++; } break;
+ }
+ >>
+ ;
+
+atomTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ vfrExpressionCatenate[$RootLevel, $ExpOpCount]
+ | vfrExpressionMatch[$RootLevel, $ExpOpCount]
+ | vfrExpressionMatch2[$RootLevel, $ExpOpCount]
+ | vfrExpressionParen[$RootLevel, $ExpOpCount]
+ | vfrExpressionBuildInFunction[$RootLevel, $ExpOpCount]
+ | vfrExpressionConstant[$RootLevel, $ExpOpCount]
+ | vfrExpressionUnaryOp[$RootLevel, $ExpOpCount]
+ | vfrExpressionTernaryOp[$RootLevel, $ExpOpCount]
+ | vfrExpressionMap[$RootLevel, $ExpOpCount]
+ | (
+ L:NOT
+ atomTerm[$RootLevel, $ExpOpCount] << { CIfrNot NObj(L->getLine()); $ExpOpCount++; } >>
+ )
+ ;
+
+vfrExpressionCatenate [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ L:Catenate
+ "\("
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ","
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ "\)" << { CIfrCatenate CObj(L->getLine()); $ExpOpCount++; } >>
+ ;
+
+vfrExpressionMatch [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ L:Match
+ "\("
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ","
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ "\)" << { CIfrMatch MObj(L->getLine()); $ExpOpCount++; } >>
+ ;
+
+vfrExpressionMatch2 [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ <<
+ EFI_GUID Guid;
+ >>
+ L:Match2
+ "\("
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ","
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ","
+ guidDefinition[Guid]
+ "\)" << { CIfrMatch2 M2Obj(L->getLine(), &Guid); $ExpOpCount++; } >>
+ ;
+
+vfrExpressionParen [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ "\("
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ "\)"
+ ;
+
+vfrExpressionBuildInFunction [UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ dupExp[$RootLevel, $ExpOpCount]
+ | vareqvalExp[$RootLevel, $ExpOpCount] //Compatible for Framework vareqval
+ | ideqvalExp[$RootLevel, $ExpOpCount]
+ | ideqidExp[$RootLevel, $ExpOpCount]
+ | ideqvallistExp[$RootLevel, $ExpOpCount]
+ | questionref1Exp[$RootLevel, $ExpOpCount]
+ | rulerefExp[$RootLevel, $ExpOpCount]
+ | stringref1Exp[$RootLevel, $ExpOpCount]
+ | pushthisExp[$RootLevel, $ExpOpCount]
+ | securityExp[$RootLevel, $ExpOpCount]
+ | getExp[$RootLevel, $ExpOpCount]
+ ;
+
+dupExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L:Dup << { CIfrDup DObj(L->getLine()); _SAVE_OPHDR_COND(DObj, ($ExpOpCount == 0), L->getLine()); $ExpOpCount++; } >>
+ ;
+
+vareqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ <<
+ EFI_QUESTION_ID QId;
+ UINT32 Mask;
+ UINT16 ConstVal;
+ CHAR8 *VarIdStr;
+ UINT32 LineNo;
+ EFI_VFR_RETURN_CODE VfrReturnCode = VFR_RETURN_SUCCESS;
+ EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
+ >>
+ L:VarEqVal <<
+ _PCATCH (VFR_RETURN_UNSUPPORTED, L);
+ >>
+ VK:Var
+ OpenParen
+ VN:Number <<
+ VarIdStr = NULL; _STRCAT(&VarIdStr, VK->getText()); _STRCAT(&VarIdStr, VN->getText());
+ VfrReturnCode = gCVfrDataStorage.GetVarStoreId (VarIdStr, &VarStoreId);
+ if (VfrReturnCode == VFR_RETURN_UNDEFINED) {
+ _PCATCH (gCVfrDataStorage.DeclareEfiVarStore (
+ VarIdStr,
+ &mFormsetGuid,
+ _STOSID(VN->getText(), VN->getLine()),
+ 0x2, //default type is UINT16
+ FALSE
+ ), VN);
+ } else {
+ _PCATCH (VfrReturnCode, VN);
+ }
+ mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask);
+ LineNo = GET_LINENO(VN);
+ >>
+ CloseParen
+ (
+ (
+ "=="
+ V1:Number << ConstVal = _STOU16(V1->getText(), V1->getLine()); >>
+ <<
+ if (Mask == 0) {
+ CIfrEqIdVal EIVObj (L->getLine());
+ _SAVE_OPHDR_COND (EIVObj, ($ExpOpCount == 0), L->getLine());
+ EIVObj.SetQuestionId (QId, VarIdStr, LineNo);
+ EIVObj.SetValue (ConstVal);
+ $ExpOpCount++;
+ } else {
+ IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, EQUAL);
+ }
+ >>
+ )
+ |
+ (
+ "<="
+ V2:Number << ConstVal = _STOU16(V2->getText(), V2->getLine()); >>
+ << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_EQUAL); >>
+ )
+ |
+ (
+ "<"
+ V3:Number << ConstVal = _STOU16(V3->getText(), V3->getLine()); >>
+ << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_THAN); >>
+ )
+ |
+ (
+ ">="
+ V4:Number << ConstVal = _STOU16(V4->getText(), V4->getLine()); >>
+ << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_EQUAL); >>
+ )
+ |
+ (
+ ">"
+ V5:Number << ConstVal = _STOU16(V5->getText(), V5->getLine()); >>
+ << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>
+ )
+ )
+ <<
+ if (VarIdStr != NULL) {
+ delete[] VarIdStr;
+ VarIdStr = NULL;
+ }
+ >>
+ ;
+
+ideqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ <<
+ EFI_QUESTION_ID QId;
+ UINT32 Mask;
+ UINT16 ConstVal;
+ CHAR8 *VarIdStr;
+ UINT32 LineNo;
+ >>
+ L:IdEqVal
+ vfrQuestionDataFieldName[QId, Mask, VarIdStr, LineNo]
+ (
+ (
+ "=="
+ V1:Number << ConstVal = _STOU16(V1->getText(), V1->getLine()); >>
+ <<
+ if (Mask == 0) {
+ CIfrEqIdVal EIVObj (L->getLine());
+ _SAVE_OPHDR_COND (EIVObj, ($ExpOpCount == 0), L->getLine());
+ EIVObj.SetQuestionId (QId, VarIdStr, LineNo);
+ EIVObj.SetValue (ConstVal);
+ $ExpOpCount++;
+ } else {
+ IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, EQUAL);
+ }
+ >>
+ )
+ |
+ (
+ "<="
+ V2:Number << ConstVal = _STOU16(V2->getText(), V2->getLine()); >>
+ << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_EQUAL); >>
+ )
+ |
+ (
+ "<"
+ V3:Number << ConstVal = _STOU16(V3->getText(), V3->getLine()); >>
+ << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_THAN); >>
+ )
+ |
+ (
+ ">="
+ V4:Number << ConstVal = _STOU16(V4->getText(), V4->getLine()); >>
+ << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_EQUAL); >>
+ )
+ |
+ (
+ ">"
+ V5:Number << ConstVal = _STOU16(V5->getText(), V5->getLine()); >>
+ << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>
+ )
+ )
+ <<
+ if (VarIdStr != NULL) {
+ delete[] VarIdStr;
+ VarIdStr = NULL;
+ }
+ >>
+ ;
+
+ideqidExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ <<
+ EFI_QUESTION_ID QId[2];
+ UINT32 Mask[2];
+ CHAR8 *VarIdStr[2];
+ UINT32 LineNo[2];
+ >>
+ L:IdEqId
+ vfrQuestionDataFieldName[QId[0], Mask[0], VarIdStr[0], LineNo[0]]
+ (
+ (
+ "=="
+ vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
+ <<
+ if (Mask[0] & Mask[1]) {
+ IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], EQUAL);
+ } else {
+ CIfrEqIdId EIIObj(L->getLine());
+ _SAVE_OPHDR_COND (EIIObj, ($ExpOpCount == 0), L->getLine());
+ EIIObj.SetQuestionId1 (QId[0], VarIdStr[0], LineNo[0]);
+ EIIObj.SetQuestionId2 (QId[1], VarIdStr[1], LineNo[1]);
+ $ExpOpCount++;
+ }
+ >>
+ )
+ |
+ (
+ "<="
+ vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
+ << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], LESS_EQUAL); >>
+ )
+ |
+ (
+ "<"
+ vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
+ << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], LESS_THAN); >>
+ )
+ |
+ (
+ ">="
+ vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
+ << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], GREATER_EQUAL); >>
+ )
+ |
+ (
+ ">"
+ vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
+ << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], GREATER_THAN); >>
+ )
+ )
+ <<
+ if (VarIdStr[0] != NULL) {
+ delete[] VarIdStr[0];
+ VarIdStr[0] = NULL;
+ }
+ if (VarIdStr[1] != NULL) {
+ delete[] VarIdStr[1];
+ VarIdStr[1] = NULL;
+ }
+ >>
+ ;
+
+ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ <<
+ UINT16 ListLen = 0;
+ EFI_QUESTION_ID QId;
+ UINT32 Mask;
+ UINT16 ValueList[EFI_IFR_MAX_LENGTH] = {0,};
+ CHAR8 *VarIdStr;
+ UINT32 LineNo;
+ >>
+ L:IdEqValList
+ vfrQuestionDataFieldName[QId, Mask, VarIdStr, LineNo]
+ "=="
+ (
+ V:Number << ValueList[ListLen] = _STOU16(V->getText(), V->getLine()); ListLen++; >>
+ )+
+ <<
+ if (Mask != 0) {
+ IdEqListDoSpecial ($ExpOpCount, LineNo, QId, VarIdStr, Mask, ListLen, ValueList);
+ } else {
+ UINT16 Index;
+ CIfrEqIdList EILObj(L->getLine());
+ if (QId != EFI_QUESTION_ID_INVALID) {
+ EILObj.SetQuestionId (QId, VarIdStr, LineNo);
+ }
+ EILObj.SetListLength (ListLen);
+ for (Index = 0; Index < ListLen; Index++) {
+ EILObj.SetValueList (Index, ValueList[Index]);
+ }
+
+ EILObj.UpdateIfrBuffer();
+ _SAVE_OPHDR_COND (EILObj, ($ExpOpCount == 0), L->getLine());
+
+ if (QId == EFI_QUESTION_ID_INVALID) {
+ EILObj.SetQuestionId (QId, VarIdStr, LineNo);
+ }
+ $ExpOpCount++;
+ }
+ if (VarIdStr != NULL) {
+ delete[] VarIdStr;
+ VarIdStr = NULL;
+ }
+ >>
+ ;
+
+questionref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ <<
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
+ UINT32 BitMask;
+ CHAR8 *QName = NULL;
+ UINT32 LineNo = 0;
+ >>
+ L:QuestionRef
+ "\("
+ (
+ QN:StringIdentifier <<
+ QName = QN->getText();
+ LineNo = QN->getLine();
+ mCVfrQuestionDB.GetQuestionId (QN->getText(), NULL, QId, BitMask);
+ >>
+ | ID:Number << QId = _STOQID(ID->getText(), ID->getLine()); >>
+ )
+ "\)"
+ <<
+ { CIfrQuestionRef1 QR1Obj(L->getLine()); _SAVE_OPHDR_COND (QR1Obj, ($ExpOpCount == 0), L->getLine()); QR1Obj.SetQuestionId (QId, QName, LineNo); } $ExpOpCount++; >>
+ ;
+
+rulerefExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L:RuleRef
+ "\(" RN:StringIdentifier "\)" << { CIfrRuleRef RRObj(L->getLine()); _SAVE_OPHDR_COND (RRObj, ($ExpOpCount == 0), L->getLine()); RRObj.SetRuleId (mCVfrRulesDB.GetRuleId (RN->getText())); } $ExpOpCount++; >>
+ ;
+
+//******************************************************
+// PARSE:
+// stringref (STR_FORM_SET_TITLE)
+//
+stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ <<
+ EFI_STRING_ID RefStringId = EFI_STRING_ID_INVALID;
+ >>
+ L:StringRef
+ "\("
+ (
+ "STRING_TOKEN"
+ "\("
+ S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>
+ "\)"
+ | I:Number << RefStringId = _STOSID(I->getText(), I->getLine()); >>
+ )
+ "\)" << { CIfrStringRef1 SR1Obj(L->getLine()); _SAVE_OPHDR_COND (SR1Obj, ($ExpOpCount == 0), L->getLine()); SR1Obj.SetStringId (RefStringId); $ExpOpCount++; } >>
+ ;
+
+pushthisExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L:PushThis << { CIfrThis TObj(L->getLine()); _SAVE_OPHDR_COND (TObj, ($ExpOpCount == 0), L->getLine()); $ExpOpCount++; } >>
+ ;
+
+securityExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ <<
+ EFI_GUID Guid;
+ >>
+ L:Security
+ "\(" guidDefinition[Guid] "\)" << { CIfrSecurity SObj(L->getLine()); _SAVE_OPHDR_COND (SObj, ($ExpOpCount == 0), L->getLine()); SObj.SetPermissions (&Guid); } $ExpOpCount++; >>
+ ;
+
+numericVarStoreType [UINT8 & VarType] :
+ "NUMERIC_SIZE_1" << $VarType = EFI_IFR_NUMERIC_SIZE_1; >>
+ | "NUMERIC_SIZE_2" << $VarType = EFI_IFR_NUMERIC_SIZE_2; >>
+ | "NUMERIC_SIZE_4" << $VarType = EFI_IFR_NUMERIC_SIZE_4; >>
+ | "NUMERIC_SIZE_8" << $VarType = EFI_IFR_NUMERIC_SIZE_8; >>
+ ;
+
+getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ <<
+ EFI_VARSTORE_INFO Info;
+ CHAR8 *VarIdStr = NULL;
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
+ UINT32 Mask = 0;
+ EFI_QUESION_TYPE QType = QUESTION_NORMAL;
+ UINT8 VarType = EFI_IFR_TYPE_UNDEFINED;
+ UINT32 VarSize = 0;
+ Info.mVarStoreId = 0;
+ >>
+ L:Get
+ "\("
+ vfrStorageVarId[Info, VarIdStr, FALSE]
+ {"\|" FLAGS "=" numericVarStoreType [VarType] }
+ "\)" <<
+ {
+ if (Info.mVarStoreId == 0) {
+ // support Date/Time question
+ mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask, &QType);
+ if (QId == EFI_QUESTION_ID_INVALID || Mask == 0 || QType == QUESTION_NORMAL) {
+ _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
+ }
+ if (QType == QUESTION_DATE) {
+ Info.mVarType = EFI_IFR_TYPE_DATE;
+ } else if (QType == QUESTION_TIME) {
+ Info.mVarType = EFI_IFR_TYPE_TIME;
+ }
+ switch (Mask) {
+ case DATE_YEAR_BITMASK:
+ Info.mInfo.mVarOffset = 0;
+ break;
+ case DATE_DAY_BITMASK:
+ Info.mInfo.mVarOffset = 3;
+ break;
+ case TIME_HOUR_BITMASK:
+ Info.mInfo.mVarOffset = 0;
+ break;
+ case TIME_MINUTE_BITMASK:
+ Info.mInfo.mVarOffset = 1;
+ break;
+ case TIME_SECOND_BITMASK:
+ Info.mInfo.mVarOffset = 2;
+ break;
+ default:
+ _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
+ break;
+ }
+ } else {
+ if ((gCVfrDataStorage.GetVarStoreType(Info.mVarStoreId) == EFI_VFR_VARSTORE_NAME) && (VarType == EFI_IFR_TYPE_UNDEFINED)) {
+ _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support name string");
+ }
+ if (VarType != EFI_IFR_TYPE_UNDEFINED) {
+ Info.mVarType = VarType;
+ _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
+ Info.mVarTotalSize = VarSize;
+ }
+ _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
+ if (VarSize != Info.mVarTotalSize) {
+ _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support data array");
+ }
+ }
+ CIfrGet GObj(L->getLine());
+ _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine());
+ GObj.SetVarInfo (&Info);
+ delete[] VarIdStr;
+ $ExpOpCount++;
+ }
+ >>
+ ;
+
+vfrExpressionConstant[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L1:True << CIfrTrue TObj(L1->getLine()); _SAVE_OPHDR_COND (TObj, ($ExpOpCount == 0), L1->getLine()); $ExpOpCount++; >>
+ | L2:False << CIfrFalse FObj(L2->getLine()); _SAVE_OPHDR_COND (FObj, ($ExpOpCount == 0), L2->getLine()); $ExpOpCount++; >>
+ | L3:One << CIfrOne OObj(L3->getLine()); _SAVE_OPHDR_COND (OObj, ($ExpOpCount == 0), L3->getLine()); $ExpOpCount++; >>
+ | L4:Ones << CIfrOnes OObj(L4->getLine()); _SAVE_OPHDR_COND (OObj, ($ExpOpCount == 0), L4->getLine()); $ExpOpCount++; >>
+ | L5:Zero << CIfrZero ZObj(L5->getLine()); _SAVE_OPHDR_COND (ZObj, ($ExpOpCount == 0), L5->getLine()); $ExpOpCount++; >>
+ | L6:Undefined << CIfrUndefined UObj(L6->getLine()); _SAVE_OPHDR_COND (UObj, ($ExpOpCount == 0), L6->getLine()); $ExpOpCount++; >>
+ | L7:Version << CIfrVersion VObj(L7->getLine()); _SAVE_OPHDR_COND (VObj, ($ExpOpCount == 0), L7->getLine()); $ExpOpCount++; >>
+ | V:Number << CIfrUint64 U64Obj(V->getLine()); U64Obj.SetValue (_STOU64(V->getText(), V->getLine())); _SAVE_OPHDR_COND (U64Obj, ($ExpOpCount == 0), V->getLine()); $ExpOpCount++; >>
+ ;
+
+vfrExpressionUnaryOp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ lengthExp[$RootLevel, $ExpOpCount]
+ | bitwisenotExp[$RootLevel, $ExpOpCount]
+ | question23refExp[$RootLevel, $ExpOpCount]
+ | stringref2Exp[$RootLevel, $ExpOpCount]
+ | toboolExp[$RootLevel, $ExpOpCount]
+ | tostringExp[$RootLevel, $ExpOpCount]
+ | unintExp[$RootLevel, $ExpOpCount]
+ | toupperExp[$RootLevel, $ExpOpCount]
+ | tolwerExp[$RootLevel, $ExpOpCount]
+ | setExp[$RootLevel, $ExpOpCount]
+ ;
+
+lengthExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L:Length
+ "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
+ << { CIfrLength LObj(L->getLine()); $ExpOpCount++; } >>
+ ;
+
+bitwisenotExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L:BitWiseNot
+ "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
+ << { CIfrBitWiseNot BWNObj(L->getLine()); $ExpOpCount++; } >>
+ ;
+
+question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ <<
+ UINT8 Type = 0x1;
+ EFI_STRING_ID DevPath = EFI_STRING_ID_INVALID;
+ EFI_GUID Guid = {0,};
+ >>
+ L:QuestionRefVal
+ "\("
+ {
+ DevicePath "=" "STRING_TOKEN" "\(" S:Number "\)" "," << Type = 0x2; DevPath = _STOSID(S->getText(), S->getLine()); >>
+ }
+ {
+ Uuid "=" guidDefinition[Guid] "," << Type = 0x3; >>
+ }
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ "\)"
+ <<
+ switch (Type) {
+ case 0x1: {CIfrQuestionRef2 QR2Obj(L->getLine()); _SAVE_OPHDR_COND (QR2Obj, ($ExpOpCount == 0), L->getLine()); break;}
+ case 0x2: {CIfrQuestionRef3_2 QR3_2Obj(L->getLine()); _SAVE_OPHDR_COND (QR3_2Obj, ($ExpOpCount == 0), L->getLine()); QR3_2Obj.SetDevicePath (DevPath); break;}
+ case 0x3: {CIfrQuestionRef3_3 QR3_3Obj(L->getLine()); _SAVE_OPHDR_COND (QR3_3Obj, ($ExpOpCount == 0), L->getLine()); QR3_3Obj.SetDevicePath (DevPath); QR3_3Obj.SetGuid (&Guid); break;}
+ }
+ $ExpOpCount++;
+ >>
+ ;
+
+stringref2Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L:StringRefVal
+ "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
+ << { CIfrStringRef2 SR2Obj(L->getLine()); $ExpOpCount++; } >>
+ ;
+
+toboolExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L:BoolVal
+ "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
+ << { CIfrToBoolean TBObj(L->getLine()); $ExpOpCount++; } >>
+ ;
+
+tostringExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ << UINT8 Fmt = 0; >>
+ L:StringVal
+ {
+ Format "=" F:Number "," << Fmt = _STOU8(F->getText(), F->getLine()); >>
+ }
+ "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
+ << { CIfrToString TSObj(L->getLine()); TSObj.SetFormat (Fmt); $ExpOpCount++; } >>
+ ;
+
+unintExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L:UnIntVal
+ "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
+ << { CIfrToUint TUObj(L->getLine()); $ExpOpCount++; } >>
+ ;
+
+toupperExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L:ToUpper
+ "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
+ << { CIfrToUpper TUObj(L->getLine()); $ExpOpCount++; } >>
+ ;
+
+tolwerExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L:ToLower
+ "\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
+ << { CIfrToLower TLObj(L->getLine()); $ExpOpCount++; } >>
+ ;
+
+setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ <<
+ EFI_VARSTORE_INFO Info;
+ CHAR8 *VarIdStr = NULL;
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
+ UINT32 Mask = 0;
+ EFI_QUESION_TYPE QType = QUESTION_NORMAL;
+ UINT8 VarType = EFI_IFR_TYPE_UNDEFINED;
+ UINT32 VarSize = 0;
+ Info.mVarStoreId = 0;
+ >>
+ L:Set
+ "\("
+ vfrStorageVarId[Info, VarIdStr, FALSE]
+ {"\|" FLAG "=" numericVarStoreType [VarType] }
+ "," vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ "\)"
+ <<
+ {
+ if (Info.mVarStoreId == 0) {
+ // support Date/Time question
+ mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask, &QType);
+ if (QId == EFI_QUESTION_ID_INVALID || Mask == 0 || QType == QUESTION_NORMAL) {
+ _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
+ }
+ if (QType == QUESTION_DATE) {
+ Info.mVarType = EFI_IFR_TYPE_DATE;
+ } else if (QType == QUESTION_TIME) {
+ Info.mVarType = EFI_IFR_TYPE_TIME;
+ }
+ switch (Mask) {
+ case DATE_YEAR_BITMASK:
+ Info.mInfo.mVarOffset = 0;
+ break;
+ case DATE_DAY_BITMASK:
+ Info.mInfo.mVarOffset = 3;
+ break;
+ case TIME_HOUR_BITMASK:
+ Info.mInfo.mVarOffset = 0;
+ break;
+ case TIME_MINUTE_BITMASK:
+ Info.mInfo.mVarOffset = 1;
+ break;
+ case TIME_SECOND_BITMASK:
+ Info.mInfo.mVarOffset = 2;
+ break;
+ default:
+ _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
+ break;
+ }
+ } else {
+ if ((gCVfrDataStorage.GetVarStoreType(Info.mVarStoreId) == EFI_VFR_VARSTORE_NAME) && (VarType == EFI_IFR_TYPE_UNDEFINED)) {
+ _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support name string");
+ }
+ if (VarType != EFI_IFR_TYPE_UNDEFINED) {
+ Info.mVarType = VarType;
+ _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
+ Info.mVarTotalSize = VarSize;
+ }
+ _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
+ if (VarSize != Info.mVarTotalSize) {
+ _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support data array");
+ }
+ }
+ CIfrSet TSObj(L->getLine());
+ TSObj.SetVarInfo (&Info);
+ delete[] VarIdStr;
+ $ExpOpCount++;
+ }
+ >>
+ ;
+
+vfrExpressionTernaryOp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ conditionalExp[$RootLevel, $ExpOpCount]
+ | findExp[$RootLevel, $ExpOpCount]
+ | midExp[$RootLevel, $ExpOpCount]
+ | tokenExp[$RootLevel, $ExpOpCount]
+ | spanExp[$RootLevel, $ExpOpCount]
+ ;
+
+#token Cond("cond") "cond"
+#token Find("find") "find"
+#token Mid("mid") "mid"
+#token Tok("token") "token"
+#token Span("span") "span"
+
+conditionalExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L:Cond "\("
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ "?"
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ":"
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ "\)" << { CIfrConditional CObj(L->getLine()); $ExpOpCount++; } >>
+ ;
+
+findExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ << UINT8 Format; >>
+ L:Find "\("
+ findFormat[Format] ( "\|" findFormat[Format] )*
+ ","
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ","
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ","
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ "\)" << { CIfrFind FObj(L->getLine()); FObj.SetFormat (Format); $ExpOpCount++; } >>
+ ;
+
+findFormat [UINT8 & Format] :
+ "SENSITIVE" << $Format = 0x00; >>
+ | "INSENSITIVE" << $Format = 0x01; >>
+ ;
+
+midExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L:Mid "\("
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ","
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ","
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ "\)" << { CIfrMid MObj(L->getLine()); $ExpOpCount++; } >>
+ ;
+
+tokenExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ L:Tok "\("
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ","
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ","
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ "\)" << { CIfrToken TObj(L->getLine()); $ExpOpCount++; } >>
+ ;
+
+spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
+ << UINT8 Flags = 0; >>
+ S:Span "\("
+ FLAGS "=" spanFlags[Flags] ( "\|" spanFlags[Flags] )*
+ ","
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ","
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ","
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ "\)" << { CIfrSpan SObj(S->getLine()); SObj.SetFlags(Flags); $ExpOpCount++; } >>
+ ;
+
+vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:
+ L:Map
+ "\("
+ vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
+ ":" << { CIfrMap MObj(L->getLine()); } >>
+ (
+ vfrStatementExpression[0]
+ ","
+ vfrStatementExpression[0]
+ ";"
+ ) *
+ E:"\)" << { CIfrEnd EObj; EObj.SetLineNo(E->getLine()); $ExpOpCount++; } >>
+ ;
+
+spanFlags [UINT8 & Flags] :
+ N:Number << $Flags |= _STOU8(N->getText(), N->getLine()); >>
+ | "LAST_NON_MATCH" << $Flags |= 0x00; >>
+ | "FIRST_NON_MATCH" << $Flags |= 0x01; >>
+ ;
+
+#token StringIdentifier("string identifier") "[A-Za-z_][A-Za-z_0-9]*"
+#token Number("numeric value") "(0x[0-9A-Fa-f]+) | [0-9]+"
+
+//******************************************************************************
+//
+// Parser class definition.
+//
+class EfiVfrParser {
+<<
+private:
+ UINT8 mParserStatus;
+ BOOLEAN mConstantOnlyInExpression;
+
+ CVfrQuestionDB mCVfrQuestionDB;
+ CVfrRulesDB mCVfrRulesDB;
+
+ CIfrOpHeader * mCIfrOpHdr[MAX_IFR_EXPRESSION_DEPTH];
+ UINT32 mCIfrOpHdrLineNo[MAX_IFR_EXPRESSION_DEPTH];
+ UINT8 mCIfrOpHdrIndex;
+ VOID _SAVE_OPHDR_COND (IN CIfrOpHeader &, IN BOOLEAN, UINT32 LineNo = 0);
+ VOID _CLEAR_SAVED_OPHDR (VOID);
+ VOID _INIT_OPHDR_COND (VOID);
+ BOOLEAN _SET_SAVED_OPHDR_SCOPE (VOID);
+
+
+ EFI_VARSTORE_INFO mCurrQestVarInfo;
+ EFI_GUID *mOverrideClassGuid;
+ CHAR8* mLastFormEndAddr;
+
+//
+// Whether the question already has default value.
+//
+ UINT16 mUsedDefaultArray[EFI_IFR_MAX_DEFAULT_TYPE];
+ UINT16 mUsedDefaultCount;
+
+ EFI_GUID mFormsetGuid;
+
+ VOID _CRT_OP (IN BOOLEAN);
+
+ VOID _SAVE_CURRQEST_VARINFO (IN EFI_VARSTORE_INFO &);
+ EFI_VARSTORE_INFO & _GET_CURRQEST_VARTINFO (VOID);
+
+ UINT8 _GET_CURRQEST_DATATYPE ();
+ UINT32 _GET_CURRQEST_VARSIZE ();
+ UINT32 _GET_CURRQEST_ARRAY_SIZE();
+ VOID CheckDuplicateDefaultValue (IN EFI_DEFAULT_ID, IN ANTLRTokenPtr);
+
+public:
+ VOID _PCATCH (IN INTN, IN INTN, IN ANTLRTokenPtr, IN CONST CHAR8 *);
+ VOID _PCATCH (IN EFI_VFR_RETURN_CODE);
+ VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN ANTLRTokenPtr);
+ VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);
+ VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);
+
+ VOID syn (ANTLRAbstractToken *, ANTLRChar *, SetWordType *, ANTLRTokenType, INT32);
+
+ CHAR8* TrimHex (IN CHAR8 *, OUT BOOLEAN *);
+ CHAR8* _U32TOS (IN UINT32);
+ UINT8 _STOU8 (IN CHAR8 *, IN UINT32);
+ UINT16 _STOU16 (IN CHAR8 *, IN UINT32);
+ UINT32 _STOU32 (IN CHAR8 *, IN UINT32);
+ UINT64 _STOU64 (IN CHAR8 *, IN UINT32);
+ EFI_HII_DATE _STOD (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *, IN UINT32);
+ EFI_HII_TIME _STOT (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *, IN UINT32);
+ EFI_HII_REF _STOR (IN CHAR8 *, IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *, IN UINT32);
+
+ EFI_STRING_ID _STOSID (IN CHAR8 *, IN UINT32);
+ EFI_FORM_ID _STOFID (IN CHAR8 *, IN UINT32);
+ EFI_QUESTION_ID _STOQID (IN CHAR8 *, IN UINT32);
+
+ VOID _STRCAT (IN OUT CHAR8 **, IN CONST CHAR8 *);
+
+ VOID _DeclareDefaultLinearVarStore (IN UINT32);
+ VOID _DeclareStandardDefaultStorage (IN UINT32);
+
+ VOID AssignQuestionKey (IN CIfrQuestionHeader &, IN ANTLRTokenPtr);
+
+ VOID ConvertIdExpr (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32);
+ VOID IdEqValDoSpecial (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN UINT16, IN EFI_COMPARE_TYPE);
+ VOID IdEqIdDoSpecial (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN EFI_COMPARE_TYPE);
+ VOID IdEqListDoSpecial (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN UINT16, IN UINT16 *);
+ VOID SetOverrideClassGuid (IN EFI_GUID *);
+>>
+}
+
+<<
+VOID
+EfiVfrParser::_SAVE_OPHDR_COND (
+ IN CIfrOpHeader &OpHdr,
+ IN BOOLEAN Cond,
+ IN UINT32 LineNo
+ )
+{
+ if (Cond == TRUE) {
+ if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
+ return ;
+ }
+ mCIfrOpHdr[mCIfrOpHdrIndex] = new CIfrOpHeader(OpHdr);
+ mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = LineNo;
+ }
+}
+
+VOID
+EfiVfrParser::_INIT_OPHDR_COND (
+ VOID
+ )
+{
+ mCIfrOpHdr[mCIfrOpHdrIndex] = NULL;
+ mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = 0;
+}
+
+VOID
+EfiVfrParser::_CLEAR_SAVED_OPHDR (
+ VOID
+ )
+{
+ if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
+ delete mCIfrOpHdr[mCIfrOpHdrIndex];
+ mCIfrOpHdr[mCIfrOpHdrIndex] = NULL;
+ }
+}
+
+BOOLEAN
+EfiVfrParser::_SET_SAVED_OPHDR_SCOPE (
+ VOID
+ )
+{
+ if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
+ mCIfrOpHdr[mCIfrOpHdrIndex]->SetScope (1);
+ return TRUE;
+ }
+
+ //
+ // IfrOpHdr is not set, FALSE is return.
+ //
+ return FALSE;
+}
+
+VOID
+EfiVfrParser::_CRT_OP (
+ IN BOOLEAN Crt
+ )
+{
+ gCreateOp = Crt;
+}
+
+VOID
+EfiVfrParser::_SAVE_CURRQEST_VARINFO (
+ IN EFI_VARSTORE_INFO &Info
+ )
+{
+ mCurrQestVarInfo = Info;
+}
+
+EFI_VARSTORE_INFO &
+EfiVfrParser::_GET_CURRQEST_VARTINFO (
+ VOID
+ )
+{
+ return mCurrQestVarInfo;
+}
+
+UINT32
+EfiVfrParser::_GET_CURRQEST_ARRAY_SIZE (
+ VOID
+ )
+{
+ UINT8 Size = 1;
+
+ switch (mCurrQestVarInfo.mVarType) {
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ Size = 1;
+ break;
+
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ Size = 2;
+ break;
+
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ Size = 4;
+ break;
+
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ Size = 8;
+ break;
+
+ default:
+ break;
+ }
+
+ return (mCurrQestVarInfo.mVarTotalSize / Size);
+}
+
+UINT8
+EfiVfrParser::_GET_CURRQEST_DATATYPE (
+ VOID
+ )
+{
+ return mCurrQestVarInfo.mVarType;
+}
+
+UINT32
+EfiVfrParser::_GET_CURRQEST_VARSIZE (
+ VOID
+ )
+{
+ return mCurrQestVarInfo.mVarTotalSize;
+}
+
+VOID
+EfiVfrParser::_PCATCH (
+ IN INTN ReturnCode,
+ IN INTN ExpectCode,
+ IN ANTLRTokenPtr Tok,
+ IN CONST CHAR8 *ErrorMsg
+ )
+{
+ if (ReturnCode != ExpectCode) {
+ mParserStatus++;
+ gCVfrErrorHandle.PrintMsg (Tok->getLine(), Tok->getText(), "Error", ErrorMsg);
+ }
+}
+
+VOID
+EfiVfrParser::_PCATCH (
+ IN EFI_VFR_RETURN_CODE ReturnCode
+ )
+{
+ mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode);
+}
+
+VOID
+EfiVfrParser::_PCATCH (
+ IN EFI_VFR_RETURN_CODE ReturnCode,
+ IN ANTLRTokenPtr Tok
+ )
+{
+ mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, Tok->getLine(), Tok->getText());
+}
+
+VOID
+EfiVfrParser::_PCATCH (
+ IN EFI_VFR_RETURN_CODE ReturnCode,
+ IN UINT32 LineNum
+ )
+{
+ mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, LineNum);
+}
+
+VOID
+EfiVfrParser::_PCATCH (
+ IN EFI_VFR_RETURN_CODE ReturnCode,
+ IN UINT32 LineNum,
+ IN CONST CHAR8 *ErrorMsg
+ )
+{
+ mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, LineNum, (CHAR8 *) ErrorMsg);
+}
+
+VOID
+EfiVfrParser::syn (
+ ANTLRAbstractToken *Tok,
+ ANTLRChar *Egroup,
+ SetWordType *Eset,
+ ANTLRTokenType ETok,
+ INT32 Huh
+ )
+{
+ gCVfrErrorHandle.HandleError (VFR_RETURN_MISMATCHED, Tok->getLine(), Tok->getText());
+
+ mParserStatus += 1;
+}
+
+CHAR8 *
+EfiVfrParser::TrimHex (
+ IN CHAR8 *Str,
+ OUT BOOLEAN *IsHex
+ )
+{
+ *IsHex = FALSE;
+
+ while (*Str && *Str == ' ') {
+ Str++;
+ }
+ while (*Str && *Str == '0') {
+ Str++;
+ }
+ if (*Str && (*Str == 'x' || *Str == 'X')) {
+ Str++;
+ *IsHex = TRUE;
+ }
+
+ return Str;
+}
+
+CHAR8 *
+EfiVfrParser::_U32TOS (
+ IN UINT32 Value
+ )
+{
+ CHAR8 *Str;
+ Str = new CHAR8[20];
+ sprintf (Str, "%d", Value);
+ return Str;
+}
+
+UINT8
+EfiVfrParser::_STOU8 (
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
+ )
+{
+ BOOLEAN IsHex;
+ UINT8 Value;
+ CHAR8 c;
+
+ UINT8 PreviousValue;
+ CHAR8 *OrigString = Str;
+ CHAR8 ErrorMsg[100];
+
+ Str = TrimHex (Str, &IsHex);
+ for (Value = 0; (c = *Str) != '\0'; Str++) {
+ PreviousValue = Value;
+ (IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);
+
+ if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {
+ Value += (c - 'a' + 10);
+ }
+ if ((IsHex == TRUE) && (c >= 'A') && (c <= 'F')) {
+ Value += (c - 'A' + 10);
+ }
+ if (c >= '0' && c <= '9') {
+ Value += (c - '0');
+ }
+ if((IsHex && ((Value/16) != PreviousValue)) || (!IsHex && ((Value/10) != PreviousValue))) {
+ sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a UINT8", OrigString);
+ mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (VFR_RETURN_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);
+ }
+ }
+
+ return Value;
+}
+
+UINT16
+EfiVfrParser::_STOU16 (
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
+ )
+{
+ BOOLEAN IsHex;
+ UINT16 Value;
+ CHAR8 c;
+
+ UINT16 PreviousValue;
+ CHAR8 *OrigString = Str;
+ CHAR8 ErrorMsg[100];
+
+ Str = TrimHex (Str, &IsHex);
+ for (Value = 0; (c = *Str) != '\0'; Str++) {
+ PreviousValue = Value;
+ (IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);
+
+ if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {
+ Value += (c - 'a' + 10);
+ }
+ if ((IsHex == TRUE) && (c >= 'A') && (c <= 'F')) {
+ Value += (c - 'A' + 10);
+ }
+ if (c >= '0' && c <= '9') {
+ Value += (c - '0');
+ }
+ if((IsHex && ((Value/16) != PreviousValue)) || (!IsHex && ((Value/10) != PreviousValue))) {
+ sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a UINT16", OrigString);
+ mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (VFR_RETURN_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);
+ }
+ }
+
+ return Value;
+}
+
+UINT32
+EfiVfrParser::_STOU32 (
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
+ )
+{
+ BOOLEAN IsHex;
+ UINT32 Value;
+ CHAR8 c;
+
+ UINT32 PreviousValue;
+ CHAR8 *OrigString = Str;
+ CHAR8 ErrorMsg[100];
+
+ Str = TrimHex (Str, &IsHex);
+ for (Value = 0; (c = *Str) != '\0'; Str++) {
+ PreviousValue = Value;
+ (IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);
+
+ if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {
+ Value += (c - 'a' + 10);
+ }
+ if ((IsHex == TRUE) && (c >= 'A') && (c <= 'F')) {
+ Value += (c - 'A' + 10);
+ }
+ if (c >= '0' && c <= '9') {
+ Value += (c - '0');
+ }
+ if((IsHex && ((Value/16) != PreviousValue)) || (!IsHex && ((Value/10) != PreviousValue ))) {
+ sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a UINT32", OrigString);
+ mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (VFR_RETURN_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);
+ }
+ }
+
+ return Value;
+}
+
+UINT64
+EfiVfrParser::_STOU64 (
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
+ )
+{
+ BOOLEAN IsHex;
+ UINT64 Value;
+ CHAR8 c;
+ UINT64 PreviousValue;
+ CHAR8 *OrigString = Str;
+ CHAR8 ErrorMsg[100];
+
+ Str = TrimHex (Str, &IsHex);
+ for (Value = 0; (c = *Str) != '\0'; Str++) {
+ PreviousValue = Value;
+ (IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);
+
+ if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {
+ Value += (c - 'a' + 10);
+ }
+ if ((IsHex == TRUE) && (c >= 'A') && (c <= 'F')) {
+ Value += (c - 'A' + 10);
+ }
+ if (c >= '0' && c <= '9') {
+ Value += (c - '0');
+ }
+ if((IsHex && ((Value/16) != PreviousValue)) || ((!IsHex && (Value/10) != PreviousValue))) {
+ sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a UINT64", OrigString);
+ mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (VFR_RETURN_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);
+ }
+ }
+
+ return Value;
+}
+
+EFI_HII_DATE
+EfiVfrParser::_STOD (
+ IN CHAR8 *Year,
+ IN CHAR8 *Month,
+ IN CHAR8 *Day,
+ IN UINT32 LineNum
+ )
+{
+ EFI_HII_DATE Date;
+
+ Date.Year = _STOU16 (Year, LineNum);
+ Date.Month = _STOU8 (Month, LineNum);
+ Date.Day = _STOU8 (Day, LineNum);
+
+ return Date;
+}
+
+EFI_HII_TIME
+EfiVfrParser::_STOT (
+ IN CHAR8 *Hour,
+ IN CHAR8 *Minute,
+ IN CHAR8 *Second,
+ IN UINT32 LineNum
+ )
+{
+ EFI_HII_TIME Time;
+
+ Time.Hour = _STOU8 (Hour, LineNum);
+ Time.Minute = _STOU8 (Minute, LineNum);
+ Time.Second = _STOU8 (Second, LineNum);
+
+ return Time;
+}
+
+EFI_STRING_ID
+EfiVfrParser::_STOSID (
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
+ )
+{
+ return (EFI_STRING_ID)_STOU16(Str, LineNum);
+}
+
+EFI_FORM_ID
+EfiVfrParser::_STOFID (
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
+ )
+{
+ return (EFI_FORM_ID)_STOU16(Str, LineNum);
+}
+
+EFI_QUESTION_ID
+EfiVfrParser::_STOQID (
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
+ )
+{
+ return (EFI_QUESTION_ID)_STOU16(Str, LineNum);
+}
+
+VOID
+EfiVfrParser::_STRCAT (
+ IN OUT CHAR8 **Dest,
+ IN CONST CHAR8 *Src
+ )
+{
+ CHAR8 *NewStr;
+ UINT32 Len;
+
+ if ((Dest == NULL) || (Src == NULL)) {
+ return;
+ }
+
+ Len = (*Dest == NULL) ? 0 : strlen (*Dest);
+ Len += strlen (Src);
+ if ((NewStr = new CHAR8[Len + 1]) == NULL) {
+ return;
+ }
+ NewStr[0] = '\0';
+ if (*Dest != NULL) {
+ strcpy (NewStr, *Dest);
+ delete[] *Dest;
+ }
+ strcat (NewStr, Src);
+
+ *Dest = NewStr;
+}
+
+EFI_HII_REF
+EfiVfrParser::_STOR (
+ IN CHAR8 *QuestionId,
+ IN CHAR8 *FormId,
+ IN EFI_GUID *FormSetGuid,
+ IN CHAR8 *DevicePath,
+ IN UINT32 LineNum
+ )
+{
+ EFI_HII_REF Ref;
+ UINT32 Index;
+
+ memcpy (&Ref.FormSetGuid, FormSetGuid, sizeof (EFI_GUID));
+ Ref.QuestionId = _STOQID (QuestionId, LineNum);
+ Ref.FormId = _STOFID (FormId, LineNum);
+ Ref.DevicePath = _STOSID (DevicePath, LineNum);
+
+ return Ref;
+}
+
+VOID
+EfiVfrParser::_DeclareDefaultLinearVarStore (
+ IN UINT32 LineNo
+ )
+{
+ UINT32 Index;
+ CHAR8 **TypeNameList;
+ UINT32 ListSize;
+ CONST CHAR8 DateName[] = "Date";
+ CONST CHAR8 TimeName[] = "Time";
+ CONST CHAR8 DateType[] = "EFI_HII_DATE";
+ CONST CHAR8 TimeType[] = "EFI_HII_TIME";
+
+ gCVfrVarDataTypeDB.GetUserDefinedTypeNameList (&TypeNameList, &ListSize);
+
+ for (Index = 0; Index < ListSize; Index++) {
+ UINT32 Size;
+ EFI_VARSTORE_ID VarStoreId;
+ CIfrVarStore VSObj;
+
+ VSObj.SetLineNo (LineNo);
+ gCVfrDataStorage.DeclareBufferVarStore (
+ TypeNameList[Index],
+ &mFormsetGuid,
+ &gCVfrVarDataTypeDB,
+ TypeNameList[Index],
+ EFI_VARSTORE_ID_INVALID,
+ FALSE
+ );
+ gCVfrDataStorage.GetVarStoreId(TypeNameList[Index], &VarStoreId, &mFormsetGuid);
+ VSObj.SetVarStoreId (VarStoreId);
+ gCVfrVarDataTypeDB.GetDataTypeSize(TypeNameList[Index], &Size);
+ VSObj.SetSize ((UINT16) Size);
+ VSObj.SetName (TypeNameList[Index]);
+ VSObj.SetGuid (&mFormsetGuid);
+ }
+
+//
+// not required to declare Date and Time VarStore,
+// because code to support old format Data and Time
+//
+ if (gCVfrVarDataTypeDB.IsTypeNameDefined ((CHAR8 *) DateName) == FALSE) {
+ UINT32 Size;
+ EFI_VARSTORE_ID VarStoreId;
+ CIfrVarStore VSObj;
+
+ VSObj.SetLineNo (LineNo);
+ gCVfrDataStorage.DeclareBufferVarStore (
+ (CHAR8 *) DateName,
+ &mFormsetGuid,
+ &gCVfrVarDataTypeDB,
+ (CHAR8 *) DateType,
+ EFI_VARSTORE_ID_INVALID,
+ FALSE
+ );
+ gCVfrDataStorage.GetVarStoreId((CHAR8 *) DateName, &VarStoreId, &mFormsetGuid);
+ VSObj.SetVarStoreId (VarStoreId);
+ gCVfrVarDataTypeDB.GetDataTypeSize((CHAR8 *) DateType, &Size);
+ VSObj.SetSize ((UINT16) Size);
+ VSObj.SetName ((CHAR8 *) DateName);
+ VSObj.SetGuid (&mFormsetGuid);
+ }
+
+ if (gCVfrVarDataTypeDB.IsTypeNameDefined ((CHAR8 *) TimeName) == FALSE) {
+ UINT32 Size;
+ EFI_VARSTORE_ID VarStoreId;
+ CIfrVarStore VSObj;
+
+ VSObj.SetLineNo (LineNo);
+ gCVfrDataStorage.DeclareBufferVarStore (
+ (CHAR8 *) TimeName,
+ &mFormsetGuid,
+ &gCVfrVarDataTypeDB,
+ (CHAR8 *) TimeType,
+ EFI_VARSTORE_ID_INVALID,
+ FALSE
+ );
+ gCVfrDataStorage.GetVarStoreId((CHAR8 *) TimeName, &VarStoreId, &mFormsetGuid);
+ VSObj.SetVarStoreId (VarStoreId);
+ gCVfrVarDataTypeDB.GetDataTypeSize((CHAR8 *) TimeType, &Size);
+ VSObj.SetSize ((UINT16) Size);
+ VSObj.SetName ((CHAR8 *) TimeName);
+ VSObj.SetGuid (&mFormsetGuid);
+ }
+}
+
+VOID
+EfiVfrParser::_DeclareStandardDefaultStorage (
+ IN UINT32 LineNo
+ )
+{
+ //
+ // Default Store is declared.
+ //
+ CIfrDefaultStore DSObj;
+
+ gCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr<CHAR8>(), (CHAR8 *) "Standard Defaults", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_STANDARD);
+ DSObj.SetLineNo (LineNo);
+ DSObj.SetDefaultName (EFI_STRING_ID_INVALID);
+ DSObj.SetDefaultId (EFI_HII_DEFAULT_CLASS_STANDARD);
+
+ //
+ // Default MANUFACTURING Store is declared.
+ //
+ CIfrDefaultStore DSObjMF;
+
+ gCVfrDefaultStore.RegisterDefaultStore (DSObjMF.GetObjBinAddr<CHAR8>(), (CHAR8 *) "Standard ManuFacturing", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_MANUFACTURING);
+ DSObjMF.SetLineNo (LineNo);
+ DSObjMF.SetDefaultName (EFI_STRING_ID_INVALID);
+ DSObjMF.SetDefaultId (EFI_HII_DEFAULT_CLASS_MANUFACTURING);
+}
+
+VOID
+EfiVfrParser::AssignQuestionKey (
+ IN CIfrQuestionHeader &QHObj,
+ IN ANTLRTokenPtr KeyTok
+ )
+{
+ UINT16 KeyValue;
+
+ if (KeyTok == NULL) {
+ return;
+ }
+
+ KeyValue = _STOU16 (KeyTok->getText(), KeyTok->getLine());
+
+ if (QHObj.FLAGS () & EFI_IFR_FLAG_CALLBACK) {
+ /*
+ * if the question is not CALLBACK ignore the key.
+ */
+ _PCATCH(mCVfrQuestionDB.UpdateQuestionId (QHObj.QUESTION_ID(), KeyValue), KeyTok);
+ QHObj.SetQuestionId (KeyValue);
+ }
+}
+
+VOID
+EfiVfrParser::ConvertIdExpr (
+ IN UINT32 &ExpOpCount,
+ IN UINT32 LineNo,
+ IN EFI_QUESTION_ID QId,
+ IN CHAR8 *VarIdStr,
+ IN UINT32 BitMask
+ )
+{
+ CIfrQuestionRef1 QR1Obj(LineNo);
+ QR1Obj.SetQuestionId (QId, VarIdStr, LineNo);
+ _SAVE_OPHDR_COND (QR1Obj, (ExpOpCount == 0));
+
+ if (BitMask != 0) {
+ CIfrUint32 U32Obj(LineNo);
+ U32Obj.SetValue (BitMask);
+
+ CIfrBitWiseAnd BWAObj(LineNo);
+
+ CIfrUint8 U8Obj(LineNo);
+ switch (BitMask) {
+ case DATE_YEAR_BITMASK : U8Obj.SetValue (0); break;
+ case TIME_SECOND_BITMASK : U8Obj.SetValue (0x10); break;
+ case DATE_DAY_BITMASK : U8Obj.SetValue (0x18); break;
+ case TIME_HOUR_BITMASK : U8Obj.SetValue (0); break;
+ case TIME_MINUTE_BITMASK : U8Obj.SetValue (0x8); break;
+ }
+
+ CIfrShiftRight SRObj(LineNo);
+ }
+
+ ExpOpCount += 4;
+}
+
+VOID
+EfiVfrParser::IdEqValDoSpecial (
+ IN UINT32 &ExpOpCount,
+ IN UINT32 LineNo,
+ IN EFI_QUESTION_ID QId,
+ IN CHAR8 *VarIdStr,
+ IN UINT32 BitMask,
+ IN UINT16 ConstVal,
+ IN EFI_COMPARE_TYPE CompareType
+ )
+{
+ ConvertIdExpr (ExpOpCount, LineNo, QId, VarIdStr, BitMask);
+
+ if (ConstVal > 0xFF) {
+ CIfrUint16 U16Obj(LineNo);
+ U16Obj.SetValue (ConstVal);
+ } else {
+ CIfrUint8 U8Obj(LineNo);
+ U8Obj.SetValue ((UINT8)ConstVal);
+ }
+
+ switch (CompareType) {
+ case EQUAL :
+ {
+ CIfrEqual EObj(LineNo);
+ break;
+ }
+ case LESS_EQUAL :
+ {
+ CIfrLessEqual LEObj(LineNo);
+ break;
+ }
+ case LESS_THAN :
+ {
+ CIfrLessThan LTObj(LineNo);
+ break;
+ }
+ case GREATER_EQUAL :
+ {
+ CIfrGreaterEqual GEObj(LineNo);
+ break;
+ }
+ case GREATER_THAN :
+ {
+ CIfrGreaterThan GTObj(LineNo);
+ break;
+ }
+ }
+
+ ExpOpCount += 2;
+}
+
+VOID
+EfiVfrParser::IdEqIdDoSpecial (
+ IN UINT32 &ExpOpCount,
+ IN UINT32 LineNo,
+ IN EFI_QUESTION_ID QId1,
+ IN CHAR8 *VarId1Str,
+ IN UINT32 BitMask1,
+ IN EFI_QUESTION_ID QId2,
+ IN CHAR8 *VarId2Str,
+ IN UINT32 BitMask2,
+ IN EFI_COMPARE_TYPE CompareType
+ )
+{
+ ConvertIdExpr (ExpOpCount, LineNo, QId1, VarId1Str, BitMask1);
+ ConvertIdExpr (ExpOpCount, LineNo, QId2, VarId2Str, BitMask2);
+
+ switch (CompareType) {
+ case EQUAL :
+ {
+ CIfrEqual EObj(LineNo);
+ break;
+ }
+ case LESS_EQUAL :
+ {
+ CIfrLessEqual LEObj(LineNo);
+ break;
+ }
+ case LESS_THAN :
+ {
+ CIfrLessThan LTObj(LineNo);
+ break;
+ }
+ case GREATER_EQUAL :
+ {
+ CIfrGreaterEqual GEObj(LineNo);
+ break;
+ }
+ case GREATER_THAN :
+ {
+ CIfrGreaterThan GTObj(LineNo);
+ break;
+ }
+ }
+
+ ExpOpCount++;
+}
+
+VOID
+EfiVfrParser::IdEqListDoSpecial (
+ IN UINT32 &ExpOpCount,
+ IN UINT32 LineNo,
+ IN EFI_QUESTION_ID QId,
+ IN CHAR8 *VarIdStr,
+ IN UINT32 BitMask,
+ IN UINT16 ListLen,
+ IN UINT16 *ValueList
+ )
+{
+ UINT16 Index;
+
+ if (ListLen == 0) {
+ return;
+ }
+
+ IdEqValDoSpecial (ExpOpCount, LineNo, QId, VarIdStr, BitMask, ValueList[0], EQUAL);
+ for (Index = 1; Index < ListLen; Index++) {
+ IdEqValDoSpecial (ExpOpCount, LineNo, QId, VarIdStr, BitMask, ValueList[Index], EQUAL);
+ CIfrOr OObj (LineNo);
+ ExpOpCount++;
+ }
+}
+
+VOID
+EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID *OverrideClassGuid)
+{
+ mOverrideClassGuid = OverrideClassGuid;
+}
+
+VOID
+EfiVfrParser::CheckDuplicateDefaultValue (
+ IN EFI_DEFAULT_ID DefaultId,
+ IN ANTLRTokenPtr Tok
+ )
+{
+ UINT16 Index;
+
+ for(Index = 0; Index < mUsedDefaultCount; Index++) {
+ if (mUsedDefaultArray[Index] == DefaultId) {
+ gCVfrErrorHandle.HandleWarning (VFR_WARNING_DEFAULT_VALUE_REDEFINED, Tok->getLine(), Tok->getText());
+ }
+ }
+
+ if (mUsedDefaultCount >= EFI_IFR_MAX_DEFAULT_TYPE - 1) {
+ gCVfrErrorHandle.HandleError (VFR_RETURN_FATAL_ERROR, Tok->getLine(), Tok->getText());
+ }
+
+ mUsedDefaultArray[mUsedDefaultCount++] = DefaultId;
+}
+>>
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
new file mode 100644
index 000000000..2b9b5dbb1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -0,0 +1,3920 @@
+/** @file
+
+ Vfr common library functions.
+
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "stdio.h"
+#include "stdlib.h"
+#include "assert.h"
+#include "CommonLib.h"
+#include "VfrUtilityLib.h"
+#include "VfrFormPkg.h"
+
+VOID
+CVfrBinaryOutput::WriteLine (
+ IN FILE *pFile,
+ IN UINT32 LineBytes,
+ IN CONST CHAR8 *LineHeader,
+ IN CHAR8 *BlkBuf,
+ IN UINT32 BlkSize
+ )
+{
+ UINT32 Index;
+
+ if ((pFile == NULL) || (LineHeader == NULL) || (BlkBuf == NULL)) {
+ return;
+ }
+
+ for (Index = 0; Index < BlkSize; Index++) {
+ if ((Index % LineBytes) == 0) {
+ fprintf (pFile, "\n%s", LineHeader);
+ }
+ fprintf (pFile, "0x%02X, ", (UINT8)BlkBuf[Index]);
+ }
+}
+
+VOID
+CVfrBinaryOutput::WriteEnd (
+ IN FILE *pFile,
+ IN UINT32 LineBytes,
+ IN CONST CHAR8 *LineHeader,
+ IN CHAR8 *BlkBuf,
+ IN UINT32 BlkSize
+ )
+{
+ UINT32 Index;
+
+ if ((BlkSize == 0) || (pFile == NULL) || (LineHeader == NULL) || (BlkBuf == NULL)) {
+ return;
+ }
+
+ for (Index = 0; Index < BlkSize - 1; Index++) {
+ if ((Index % LineBytes) == 0) {
+ fprintf (pFile, "\n%s", LineHeader);
+ }
+ fprintf (pFile, "0x%02X, ", (UINT8)BlkBuf[Index]);
+ }
+
+ if ((Index % LineBytes) == 0) {
+ fprintf (pFile, "\n%s", LineHeader);
+ }
+ fprintf (pFile, "0x%02X\n", (UINT8)BlkBuf[Index]);
+}
+
+SConfigInfo::SConfigInfo (
+ IN UINT8 Type,
+ IN UINT16 Offset,
+ IN UINT32 Width,
+ IN EFI_IFR_TYPE_VALUE Value
+ )
+{
+ mNext = NULL;
+ mOffset = Offset;
+ mWidth = (UINT16)Width;
+ mValue = new UINT8[mWidth];
+ if (mValue == NULL) {
+ return;
+ }
+
+ switch (Type) {
+ case EFI_IFR_TYPE_NUM_SIZE_8 :
+ memcpy (mValue, &Value.u8, mWidth);
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16 :
+ memcpy (mValue, &Value.u16, mWidth);
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32 :
+ memcpy (mValue, &Value.u32, mWidth);
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_64 :
+ memcpy (mValue, &Value.u64, mWidth);
+ break;
+ case EFI_IFR_TYPE_BOOLEAN :
+ memcpy (mValue, &Value.b, mWidth);
+ break;
+ case EFI_IFR_TYPE_TIME :
+ memcpy (mValue, &Value.time, mWidth);
+ break;
+ case EFI_IFR_TYPE_DATE :
+ memcpy (mValue, &Value.date, mWidth);
+ break;
+ case EFI_IFR_TYPE_STRING :
+ memcpy (mValue, &Value.string, mWidth);
+ break;
+ case EFI_IFR_TYPE_BUFFER :
+ memcpy (mValue, &Value.u8, mWidth);
+ break;
+
+ case EFI_IFR_TYPE_OTHER :
+ return;
+ }
+}
+
+SConfigInfo::~SConfigInfo (
+ VOID
+ )
+{
+ ARRAY_SAFE_FREE (mValue);
+}
+
+SConfigItem::SConfigItem (
+ IN CHAR8 *Name,
+ IN EFI_GUID *Guid,
+ IN CHAR8 *Id
+ )
+{
+ mName = NULL;
+ mGuid = NULL;
+ mId = NULL;
+ mInfoStrList = NULL;
+ mNext = NULL;
+
+ if (Name != NULL) {
+ if ((mName = new CHAR8[strlen (Name) + 1]) != NULL) {
+ strcpy (mName, Name);
+ }
+ }
+
+ if (Guid != NULL) {
+ if ((mGuid = (EFI_GUID *) new CHAR8[sizeof (EFI_GUID)]) != NULL) {
+ memcpy (mGuid, Guid, sizeof (EFI_GUID));
+ }
+ }
+
+ if (Id != NULL) {
+ if ((mId = new CHAR8[strlen (Id) + 1]) != NULL) {
+ strcpy (mId, Id);
+ }
+ }
+}
+
+SConfigItem::SConfigItem (
+ IN CHAR8 *Name,
+ IN EFI_GUID *Guid,
+ IN CHAR8 *Id,
+ IN UINT8 Type,
+ IN UINT16 Offset,
+ IN UINT16 Width,
+ IN EFI_IFR_TYPE_VALUE Value
+ )
+{
+ mName = NULL;
+ mGuid = NULL;
+ mId = NULL;
+ mInfoStrList = NULL;
+ mNext = NULL;
+
+ if (Name != NULL) {
+ if ((mName = new CHAR8[strlen (Name) + 1]) != NULL) {
+ strcpy (mName, Name);
+ }
+ }
+
+ if (Guid != NULL) {
+ if ((mGuid = (EFI_GUID *) new CHAR8[sizeof (EFI_GUID)]) != NULL) {
+ memcpy (mGuid, Guid, sizeof (EFI_GUID));
+ }
+ }
+
+ if (Id != NULL) {
+ if ((mId = new CHAR8[strlen (Id) + 1]) != NULL) {
+ strcpy (mId, Id);
+ }
+ }
+
+ mInfoStrList = new SConfigInfo(Type, Offset, Width, Value);
+}
+
+SConfigItem::~SConfigItem (
+ VOID
+ )
+{
+ SConfigInfo *Info;
+
+ ARRAY_SAFE_FREE (mName);
+ ARRAY_SAFE_FREE (mGuid);
+ ARRAY_SAFE_FREE (mId);
+ while (mInfoStrList != NULL) {
+ Info = mInfoStrList;
+ mInfoStrList = mInfoStrList->mNext;
+
+ BUFFER_SAFE_FREE (Info);
+ }
+}
+
+UINT8
+CVfrBufferConfig::Register (
+ IN CHAR8 *Name,
+ IN EFI_GUID *Guid,
+ IN CHAR8 *Id
+ )
+{
+ SConfigItem *pNew;
+
+ if (Select (Name, Guid) == 0) {
+ return 1;
+ }
+
+ if ((pNew = new SConfigItem (Name, Guid, Id)) == NULL) {
+ return 2;
+ }
+
+ if (mItemListHead == NULL) {
+ mItemListHead = pNew;
+ mItemListTail = pNew;
+ } else {
+ mItemListTail->mNext = pNew;
+ mItemListTail = pNew;
+ }
+ mItemListPos = pNew;
+
+ return 0;
+}
+
+VOID
+CVfrBufferConfig::Open (
+ VOID
+ )
+{
+ mItemListPos = mItemListHead;
+}
+
+BOOLEAN
+CVfrBufferConfig::Eof(
+ VOID
+ )
+{
+ return (mItemListPos == NULL) ? TRUE : FALSE;
+}
+
+UINT8
+CVfrBufferConfig::Select (
+ IN CHAR8 *Name,
+ IN EFI_GUID *Guid,
+ IN CHAR8 *Id
+ )
+{
+ SConfigItem *p;
+
+ if (Name == NULL || Guid == NULL) {
+ mItemListPos = mItemListHead;
+ return 0;
+ } else {
+ for (p = mItemListHead; p != NULL; p = p->mNext) {
+ if ((strcmp (p->mName, Name) != 0) || (memcmp (p->mGuid, Guid, sizeof (EFI_GUID)) != 0)) {
+ continue;
+ }
+
+ if (Id != NULL) {
+ if (p->mId == NULL || strcmp (p->mId, Id) != 0) {
+ continue;
+ }
+ } else if (p->mId != NULL) {
+ continue;
+ }
+
+ mItemListPos = p;
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+UINT8
+CVfrBufferConfig::Write (
+ IN CONST CHAR8 Mode,
+ IN CHAR8 *Name,
+ IN EFI_GUID *Guid,
+ IN CHAR8 *Id,
+ IN UINT8 Type,
+ IN UINT16 Offset,
+ IN UINT32 Width,
+ IN EFI_IFR_TYPE_VALUE Value
+ )
+{
+ UINT8 Ret;
+ SConfigItem *pItem;
+ SConfigInfo *pInfo;
+
+ if ((Ret = Select (Name, Guid)) != 0) {
+ return Ret;
+ }
+
+ switch (Mode) {
+ case 'a' : // add
+ if (Select (Name, Guid, Id) != 0) {
+ if ((pItem = new SConfigItem (Name, Guid, Id, Type, Offset, (UINT16) Width, Value)) == NULL) {
+ return 2;
+ }
+ if (mItemListHead == NULL) {
+ mItemListHead = pItem;
+ mItemListTail = pItem;
+ } else {
+ mItemListTail->mNext = pItem;
+ mItemListTail = pItem;
+ }
+ mItemListPos = pItem;
+ } else {
+ // tranverse the list to find out if there's already the value for the same offset
+ for (pInfo = mItemListPos->mInfoStrList; pInfo != NULL; pInfo = pInfo->mNext) {
+ if (pInfo->mOffset == Offset) {
+ return 0;
+ }
+ }
+ if((pInfo = new SConfigInfo (Type, Offset, Width, Value)) == NULL) {
+ return 2;
+ }
+ pInfo->mNext = mItemListPos->mInfoStrList;
+ mItemListPos->mInfoStrList = pInfo;
+ }
+ break;
+
+ case 'd' : // delete
+ if (mItemListHead == mItemListPos) {
+ mItemListHead = mItemListPos->mNext;
+ delete mItemListPos;
+ break;
+ }
+
+ for (pItem = mItemListHead; pItem->mNext != mItemListPos; pItem = pItem->mNext)
+ ;
+
+ pItem->mNext = mItemListPos->mNext;
+ if (mItemListTail == mItemListPos) {
+ mItemListTail = pItem;
+ }
+ delete mItemListPos;
+ mItemListPos = pItem->mNext;
+ break;
+
+ case 'i' : // set info
+ if (mItemListPos->mId != NULL) {
+ delete[] mItemListPos->mId;
+ }
+ mItemListPos->mId = NULL;
+ if (Id != NULL) {
+ if ((mItemListPos->mId = new CHAR8[strlen (Id) + 1]) == NULL) {
+ return 2;
+ }
+ strcpy (mItemListPos->mId, Id);
+ }
+ break;
+
+ default :
+ return 1;
+ }
+
+ return 0;
+}
+
+
+VOID
+CVfrBufferConfig::Close (
+ VOID
+ )
+{
+ mItemListPos = NULL;
+}
+
+#define BYTES_PRE_LINE 0x10
+
+VOID
+CVfrBufferConfig::OutputCFile (
+ IN FILE *pFile,
+ IN CHAR8 *BaseName
+ )
+{
+ CVfrBinaryOutput Output;
+ SConfigItem *Item;
+ SConfigInfo *Info;
+ UINT32 TotalLen;
+
+ if (pFile == NULL) {
+ return;
+ }
+
+ for (Item = mItemListHead; Item != NULL; Item = Item->mNext) {
+ if (Item->mId != NULL || Item->mInfoStrList == NULL) {
+ continue;
+ }
+ fprintf (pFile, "\nunsigned char %s%sBlockName[] = {", BaseName, Item->mName);
+
+ TotalLen = sizeof (UINT32);
+ for (Info = Item->mInfoStrList; Info != NULL; Info = Info->mNext) {
+ TotalLen += sizeof (UINT16) * 2;
+ }
+ Output.WriteLine (pFile, BYTES_PRE_LINE, " ", (CHAR8 *)&TotalLen, sizeof (UINT32));
+
+ for (Info = Item->mInfoStrList; Info != NULL; Info = Info->mNext) {
+ fprintf (pFile, "\n");
+ Output.WriteLine (pFile, BYTES_PRE_LINE, " ", (CHAR8 *)&Info->mOffset, sizeof (UINT16));
+ Output.WriteLine (pFile, BYTES_PRE_LINE, " ", (CHAR8 *)&Info->mWidth, sizeof (UINT16));
+ }
+ fprintf (pFile, "\n};\n");
+ }
+
+ for (Item = mItemListHead; Item != NULL; Item = Item->mNext) {
+ if (Item->mId != NULL && Item->mInfoStrList != NULL) {
+ fprintf (pFile, "\nunsigned char %s%sDefault%s[] = {", BaseName, Item->mName, Item->mId);
+
+ TotalLen = sizeof (UINT32);
+ for (Info = Item->mInfoStrList; Info != NULL; Info = Info->mNext) {
+ TotalLen += Info->mWidth + sizeof (UINT16) * 2;
+ }
+ Output.WriteLine (pFile, BYTES_PRE_LINE, " ", (CHAR8 *)&TotalLen, sizeof (UINT32));
+
+ for (Info = Item->mInfoStrList; Info != NULL; Info = Info->mNext) {
+ fprintf (pFile, "\n");
+ Output.WriteLine (pFile, BYTES_PRE_LINE, " ", (CHAR8 *)&Info->mOffset, sizeof (UINT16));
+ Output.WriteLine (pFile, BYTES_PRE_LINE, " ", (CHAR8 *)&Info->mWidth, sizeof (UINT16));
+ if (Info->mNext == NULL) {
+ Output.WriteEnd (pFile, BYTES_PRE_LINE, " ", (CHAR8 *)Info->mValue, Info->mWidth);
+ } else {
+ Output.WriteLine (pFile, BYTES_PRE_LINE, " ", (CHAR8 *)Info->mValue, Info->mWidth);
+ }
+ }
+ fprintf (pFile, "\n};\n");
+ }
+ }
+}
+
+CVfrBufferConfig::CVfrBufferConfig (
+ VOID
+ )
+{
+ mItemListHead = NULL;
+ mItemListTail = NULL;
+ mItemListPos = NULL;
+}
+
+CVfrBufferConfig::~CVfrBufferConfig (
+ VOID
+ )
+{
+ SConfigItem *p;
+
+ while (mItemListHead != NULL) {
+ p = mItemListHead;
+ mItemListHead = mItemListHead->mNext;
+ delete p;
+ }
+
+ mItemListHead = NULL;
+ mItemListTail = NULL;
+ mItemListPos = NULL;
+}
+
+CVfrBufferConfig gCVfrBufferConfig;
+
+static struct {
+ CONST CHAR8 *mTypeName;
+ UINT8 mType;
+ UINT32 mSize;
+ UINT32 mAlign;
+} gInternalTypesTable [] = {
+ {"UINT64", EFI_IFR_TYPE_NUM_SIZE_64, sizeof (UINT64), sizeof (UINT64)},
+ {"UINT32", EFI_IFR_TYPE_NUM_SIZE_32, sizeof (UINT32), sizeof (UINT32)},
+ {"UINT16", EFI_IFR_TYPE_NUM_SIZE_16, sizeof (UINT16), sizeof (UINT16)},
+ {"UINT8", EFI_IFR_TYPE_NUM_SIZE_8, sizeof (UINT8), sizeof (UINT8)},
+ {"BOOLEAN", EFI_IFR_TYPE_BOOLEAN, sizeof (BOOLEAN), sizeof (BOOLEAN)},
+ {"EFI_HII_DATE", EFI_IFR_TYPE_DATE, sizeof (EFI_HII_DATE), sizeof (UINT16)},
+ {"EFI_STRING_ID", EFI_IFR_TYPE_STRING, sizeof (EFI_STRING_ID),sizeof (EFI_STRING_ID)},
+ {"EFI_HII_TIME", EFI_IFR_TYPE_TIME, sizeof (EFI_HII_TIME), sizeof (UINT8)},
+ {"EFI_HII_REF", EFI_IFR_TYPE_REF, sizeof (EFI_HII_REF), sizeof (EFI_GUID)},
+ {NULL, EFI_IFR_TYPE_OTHER, 0, 0}
+};
+
+STATIC
+BOOLEAN
+_IS_INTERNAL_TYPE (
+ IN CHAR8 *TypeName
+ )
+{
+ UINT32 Index;
+
+ if (TypeName == NULL) {
+ return FALSE;
+ }
+
+ for (Index = 0; gInternalTypesTable[Index].mTypeName != NULL; Index++) {
+ if (strcmp (TypeName, gInternalTypesTable[Index].mTypeName) == 0) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+STATIC
+CHAR8 *
+TrimHex (
+ IN CHAR8 *Str,
+ OUT bool *IsHex
+ )
+{
+ *IsHex = FALSE;
+
+ while (*Str && *Str == ' ') {
+ Str++;
+ }
+ while (*Str && *Str == '0') {
+ Str++;
+ }
+ if (*Str && (*Str == 'x' || *Str == 'X')) {
+ Str++;
+ *IsHex = TRUE;
+ }
+
+ return Str;
+}
+
+UINT32
+_STR2U32 (
+ IN CHAR8 *Str
+ )
+{
+ bool IsHex;
+ UINT32 Value;
+ CHAR8 c;
+
+ Str = TrimHex (Str, &IsHex);
+ for (Value = 0; (c = *Str) != '\0'; Str++) {
+ //
+ // BUG: does not handle overflow here
+ //
+ (IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);
+
+ if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {
+ Value += (c - 'a' + 10);
+ }
+ if ((IsHex == TRUE) && (c >= 'A') && (c <= 'F')) {
+ Value += (c - 'A' + 10);
+ }
+ if (c >= '0' && c <= '9') {
+ Value += (c - '0');
+ }
+ }
+
+ return Value;
+}
+
+VOID
+CVfrVarDataTypeDB::RegisterNewType (
+ IN SVfrDataType *New
+ )
+{
+ New->mNext = mDataTypeList;
+ mDataTypeList = New;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::ExtractStructTypeName (
+ IN CHAR8 *&VarStr,
+ OUT CHAR8 *TName
+ )
+{
+ if (TName == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ while((*VarStr != '\0') && (*VarStr != '.')) {
+ *TName = *VarStr;
+ VarStr++;
+ TName++;
+ }
+ *TName = '\0';
+ if (*VarStr == '.') {
+ VarStr++;
+ }
+
+ return VFR_RETURN_SUCCESS;
+}
+
+/**
+ Check whether the DataType contain bit field.
+
+ @param TypeName The name of the type.
+
+**/
+BOOLEAN
+CVfrVarDataTypeDB::DataTypeHasBitField (
+ IN CHAR8 *TypeName
+ )
+{
+ SVfrDataType *pType = NULL;
+ SVfrDataField *pTmp;
+
+ GetDataType (TypeName, &pType);
+
+ if (pType == NULL){
+ return FALSE;
+ }
+ for (pTmp = pType->mMembers; pTmp!= NULL; pTmp = pTmp->mNext) {
+ if (pTmp->mIsBitField) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/**
+ Check whether the field is bit field or not.
+
+ @param VarStr Point to the field name which may contain the structure name.
+
+**/
+BOOLEAN
+CVfrVarDataTypeDB::IsThisBitField (
+ IN CHAR8 *VarStr
+ )
+{
+ CHAR8 FName[MAX_NAME_LEN];
+ CHAR8 TName[MAX_NAME_LEN];
+ UINT32 ArrayIdx;
+ SVfrDataType *pType = NULL;
+ SVfrDataField *pField = NULL;
+
+ CHECK_ERROR_RETURN (ExtractStructTypeName (VarStr, TName), VFR_RETURN_SUCCESS);
+ CHECK_ERROR_RETURN (GetDataType (TName, &pType), VFR_RETURN_SUCCESS);
+
+ while (*VarStr != '\0') {
+ CHECK_ERROR_RETURN(ExtractFieldNameAndArrary(VarStr, FName, ArrayIdx), VFR_RETURN_SUCCESS);
+ CHECK_ERROR_RETURN(GetTypeField (FName, pType, pField), VFR_RETURN_SUCCESS);
+ pType = pField->mFieldType;
+ }
+ if (pField != NULL && pField->mIsBitField) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::ExtractFieldNameAndArrary (
+ IN CHAR8 *&VarStr,
+ IN CHAR8 *FName,
+ OUT UINT32 &ArrayIdx
+ )
+{
+ UINT32 Idx;
+ CHAR8 ArrayStr[MAX_NAME_LEN + 1];
+
+ ArrayIdx = INVALID_ARRAY_INDEX;
+
+ if (FName == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ while((*VarStr != '\0') &&
+ (*VarStr != '.') &&
+ (*VarStr != '[') &&
+ (*VarStr != ']')) {
+ *FName = *VarStr;
+ VarStr++;
+ FName++;
+ }
+ *FName = '\0';
+
+ switch (*VarStr) {
+ case '.' :
+ VarStr++;
+ case '\0':
+ return VFR_RETURN_SUCCESS;
+ case '[' :
+ VarStr++;
+ for (Idx = 0; (Idx < MAX_NAME_LEN) && (*VarStr != '\0') && (*VarStr != ']'); VarStr++, Idx++) {
+ ArrayStr[Idx] = *VarStr;
+ }
+ ArrayStr[Idx] = '\0';
+
+ if ((*VarStr != ']') && (ArrayStr[0] == '\0')) {
+ return VFR_RETURN_DATA_STRING_ERROR;
+ }
+ ArrayIdx = _STR2U32 (ArrayStr);
+ if (*VarStr == ']') {
+ VarStr++;
+ }
+ if (*VarStr == '.') {
+ VarStr++;
+ }
+ return VFR_RETURN_SUCCESS;
+ case ']':
+ return VFR_RETURN_DATA_STRING_ERROR;
+ }
+
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::GetTypeField (
+ IN CONST CHAR8 *FName,
+ IN SVfrDataType *Type,
+ OUT SVfrDataField *&Field
+ )
+{
+ SVfrDataField *pField = NULL;
+
+ if ((FName == NULL) || (Type == NULL)) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ for (pField = Type->mMembers; pField != NULL; pField = pField->mNext) {
+ //
+ // For type EFI_IFR_TYPE_TIME, because field name is not correctly wrote,
+ // add code to adjust it.
+ //
+ if (Type->mType == EFI_IFR_TYPE_TIME) {
+ if (strcmp (FName, "Hour") == 0) {
+ FName = "Hours";
+ } else if (strcmp (FName, "Minute") == 0) {
+ FName = "Minuts";
+ } else if (strcmp (FName, "Second") == 0) {
+ FName = "Seconds";
+ }
+ }
+
+ if (strcmp (pField->mFieldName, FName) == 0) {
+ Field = pField;
+ return VFR_RETURN_SUCCESS;
+ }
+ }
+
+ return VFR_RETURN_UNDEFINED;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::GetFieldOffset (
+ IN SVfrDataField *Field,
+ IN UINT32 ArrayIdx,
+ OUT UINT32 &Offset,
+ IN BOOLEAN IsBitField
+ )
+{
+ if (Field == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ if ((ArrayIdx != INVALID_ARRAY_INDEX) && ((Field->mArrayNum == 0) || (Field->mArrayNum <= ArrayIdx))) {
+ return VFR_RETURN_ERROR_ARRARY_NUM;
+ }
+
+ //
+ // Be compatible with the current usage
+ // If ArraryIdx is not specified, the first one is used.
+ //
+ // if ArrayNum is larger than zero, ArraryIdx must be specified.
+ //
+ // if ((ArrayIdx == INVALID_ARRAY_INDEX) && (Field->mArrayNum > 0)) {
+ // return VFR_RETURN_ERROR_ARRARY_NUM;
+ // }
+ //
+ if (IsBitField) {
+ Offset = Field->mBitOffset + Field->mFieldType->mTotalSize * ((ArrayIdx == INVALID_ARRAY_INDEX) ? 0 : ArrayIdx) * 8;
+ } else {
+ Offset = Field->mOffset + Field->mFieldType->mTotalSize * ((ArrayIdx == INVALID_ARRAY_INDEX) ? 0 : ArrayIdx);
+ }
+ return VFR_RETURN_SUCCESS;
+}
+
+UINT8
+CVfrVarDataTypeDB::GetFieldWidth (
+ IN SVfrDataField *Field
+ )
+{
+ if (Field == NULL) {
+ return 0;
+ }
+
+ return Field->mFieldType->mType;
+}
+
+UINT32
+CVfrVarDataTypeDB::GetFieldSize (
+ IN SVfrDataField *Field,
+ IN UINT32 ArrayIdx,
+ IN BOOLEAN BitField
+ )
+{
+ if (Field == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ if ((ArrayIdx == INVALID_ARRAY_INDEX) && (Field->mArrayNum != 0)) {
+ return Field->mFieldType->mTotalSize * Field->mArrayNum;
+ } else {
+ if (BitField) {
+ return Field->mBitWidth;
+ } else {
+ return Field->mFieldType->mTotalSize;
+ }
+ }
+}
+
+VOID
+CVfrVarDataTypeDB::InternalTypesListInit (
+ VOID
+ )
+{
+ SVfrDataType *New = NULL;
+ UINT32 Index;
+
+ for (Index = 0; gInternalTypesTable[Index].mTypeName != NULL; Index++) {
+ New = new SVfrDataType;
+ if (New != NULL) {
+ assert (strlen (gInternalTypesTable[Index].mTypeName) < MAX_NAME_LEN);
+ strncpy (New->mTypeName, gInternalTypesTable[Index].mTypeName, MAX_NAME_LEN - 1);
+ New->mTypeName[MAX_NAME_LEN - 1] = 0;
+ New->mType = gInternalTypesTable[Index].mType;
+ New->mAlign = gInternalTypesTable[Index].mAlign;
+ New->mTotalSize = gInternalTypesTable[Index].mSize;
+ if (strcmp (gInternalTypesTable[Index].mTypeName, "EFI_HII_DATE") == 0) {
+ SVfrDataField *pYearField = new SVfrDataField;
+ SVfrDataField *pMonthField = new SVfrDataField;
+ SVfrDataField *pDayField = new SVfrDataField;
+
+ strcpy (pYearField->mFieldName, "Year");
+ GetDataType ((CHAR8 *)"UINT16", &pYearField->mFieldType);
+ pYearField->mOffset = 0;
+ pYearField->mNext = pMonthField;
+ pYearField->mArrayNum = 0;
+ pYearField->mIsBitField = FALSE;
+
+ strcpy (pMonthField->mFieldName, "Month");
+ GetDataType ((CHAR8 *)"UINT8", &pMonthField->mFieldType);
+ pMonthField->mOffset = 2;
+ pMonthField->mNext = pDayField;
+ pMonthField->mArrayNum = 0;
+ pMonthField->mIsBitField = FALSE;
+
+ strcpy (pDayField->mFieldName, "Day");
+ GetDataType ((CHAR8 *)"UINT8", &pDayField->mFieldType);
+ pDayField->mOffset = 3;
+ pDayField->mNext = NULL;
+ pDayField->mArrayNum = 0;
+ pDayField->mIsBitField = FALSE;
+
+ New->mMembers = pYearField;
+ } else if (strcmp (gInternalTypesTable[Index].mTypeName, "EFI_HII_TIME") == 0) {
+ SVfrDataField *pHoursField = new SVfrDataField;
+ SVfrDataField *pMinutesField = new SVfrDataField;
+ SVfrDataField *pSecondsField = new SVfrDataField;
+
+ strcpy (pHoursField->mFieldName, "Hours");
+ GetDataType ((CHAR8 *)"UINT8", &pHoursField->mFieldType);
+ pHoursField->mOffset = 0;
+ pHoursField->mNext = pMinutesField;
+ pHoursField->mArrayNum = 0;
+ pHoursField->mIsBitField = FALSE;
+
+ strcpy (pMinutesField->mFieldName, "Minutes");
+ GetDataType ((CHAR8 *)"UINT8", &pMinutesField->mFieldType);
+ pMinutesField->mOffset = 1;
+ pMinutesField->mNext = pSecondsField;
+ pMinutesField->mArrayNum = 0;
+ pMinutesField->mIsBitField = FALSE;
+
+ strcpy (pSecondsField->mFieldName, "Seconds");
+ GetDataType ((CHAR8 *)"UINT8", &pSecondsField->mFieldType);
+ pSecondsField->mOffset = 2;
+ pSecondsField->mNext = NULL;
+ pSecondsField->mArrayNum = 0;
+ pSecondsField->mIsBitField = FALSE;
+
+ New->mMembers = pHoursField;
+ } else if (strcmp (gInternalTypesTable[Index].mTypeName, "EFI_HII_REF") == 0) {
+ SVfrDataField *pQuestionIdField = new SVfrDataField;
+ SVfrDataField *pFormIdField = new SVfrDataField;
+ SVfrDataField *pFormSetGuidField = new SVfrDataField;
+ SVfrDataField *pDevicePathField = new SVfrDataField;
+
+ strcpy (pQuestionIdField->mFieldName, "QuestionId");
+ GetDataType ((CHAR8 *)"UINT16", &pQuestionIdField->mFieldType);
+ pQuestionIdField->mOffset = 0;
+ pQuestionIdField->mNext = pFormIdField;
+ pQuestionIdField->mArrayNum = 0;
+ pQuestionIdField->mIsBitField = FALSE;
+
+ strcpy (pFormIdField->mFieldName, "FormId");
+ GetDataType ((CHAR8 *)"UINT16", &pFormIdField->mFieldType);
+ pFormIdField->mOffset = 2;
+ pFormIdField->mNext = pFormSetGuidField;
+ pFormIdField->mArrayNum = 0;
+ pFormIdField->mIsBitField = FALSE;
+
+ strcpy (pFormSetGuidField->mFieldName, "FormSetGuid");
+ GetDataType ((CHAR8 *)"EFI_GUID", &pFormSetGuidField->mFieldType);
+ pFormSetGuidField->mOffset = 4;
+ pFormSetGuidField->mNext = pDevicePathField;
+ pFormSetGuidField->mArrayNum = 0;
+ pFormSetGuidField->mIsBitField = FALSE;
+
+ strcpy (pDevicePathField->mFieldName, "DevicePath");
+ GetDataType ((CHAR8 *)"EFI_STRING_ID", &pDevicePathField->mFieldType);
+ pDevicePathField->mOffset = 20;
+ pDevicePathField->mNext = NULL;
+ pDevicePathField->mArrayNum = 0;
+ pDevicePathField->mIsBitField = FALSE;
+
+ New->mMembers = pQuestionIdField;
+ } else {
+ New->mMembers = NULL;
+ }
+ New->mNext = NULL;
+ RegisterNewType (New);
+ New = NULL;
+ }
+ }
+}
+
+CVfrVarDataTypeDB::CVfrVarDataTypeDB (
+ VOID
+ )
+{
+ mDataTypeList = NULL;
+ mNewDataType = NULL;
+ mCurrDataField = NULL;
+ mPackAlign = DEFAULT_PACK_ALIGN;
+ mPackStack = NULL;
+ mFirstNewDataTypeName = NULL;
+ mCurrDataType = NULL;
+
+ InternalTypesListInit ();
+}
+
+CVfrVarDataTypeDB::~CVfrVarDataTypeDB (
+ VOID
+ )
+{
+ SVfrDataType *pType;
+ SVfrDataField *pField;
+ SVfrPackStackNode *pPack;
+
+ if (mNewDataType != NULL) {
+ delete mNewDataType;
+ }
+
+ while (mDataTypeList != NULL) {
+ pType = mDataTypeList;
+ mDataTypeList = mDataTypeList->mNext;
+ while(pType->mMembers != NULL) {
+ pField = pType->mMembers;
+ pType->mMembers = pType->mMembers->mNext;
+ delete pField;
+ }
+ delete pType;
+ }
+
+ while (mPackStack != NULL) {
+ pPack = mPackStack;
+ mPackStack = mPackStack->mNext;
+ delete pPack;
+ }
+}
+
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::Pack (
+ IN UINT32 LineNum,
+ IN UINT8 Action,
+ IN CHAR8 *Identifier,
+ IN UINT32 Number
+ )
+{
+ UINT32 PackAlign;
+ CHAR8 Msg[MAX_STRING_LEN] = {0, };
+
+ if (Action & VFR_PACK_SHOW) {
+ sprintf (Msg, "value of pragma pack(show) == %d", mPackAlign);
+ gCVfrErrorHandle.PrintMsg (LineNum, NULL, "Warning", Msg);
+ }
+
+ if (Action & VFR_PACK_PUSH) {
+ SVfrPackStackNode *pNew = NULL;
+
+ if ((pNew = new SVfrPackStackNode (Identifier, mPackAlign)) == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+ pNew->mNext = mPackStack;
+ mPackStack = pNew;
+ }
+
+ if (Action & VFR_PACK_POP) {
+ SVfrPackStackNode *pNode = NULL;
+
+ if (mPackStack == NULL) {
+ gCVfrErrorHandle.PrintMsg (LineNum, NULL, "Error", "#pragma pack(pop...) : more pops than pushes");
+ }
+
+ for (pNode = mPackStack; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->Match (Identifier) == TRUE) {
+ mPackAlign = pNode->mNumber;
+ mPackStack = pNode->mNext;
+ }
+ }
+ }
+
+ if (Action & VFR_PACK_ASSIGN) {
+ PackAlign = (Number > 1) ? Number + Number % 2 : Number;
+ if ((PackAlign == 0) || (PackAlign > 16)) {
+ gCVfrErrorHandle.PrintMsg (LineNum, NULL, "Error", "expected pragma parameter to be '1', '2', '4', '8', or '16'");
+ } else {
+ mPackAlign = PackAlign;
+ }
+ }
+
+ return VFR_RETURN_SUCCESS;
+}
+
+VOID
+CVfrVarDataTypeDB::DeclareDataTypeBegin (
+ VOID
+ )
+{
+ SVfrDataType *pNewType = NULL;
+
+ pNewType = new SVfrDataType;
+ pNewType->mTypeName[0] = '\0';
+ pNewType->mType = EFI_IFR_TYPE_OTHER;
+ pNewType->mAlign = DEFAULT_ALIGN;
+ pNewType->mTotalSize = 0;
+ pNewType->mMembers = NULL;
+ pNewType->mNext = NULL;
+ pNewType->mHasBitField = FALSE;
+
+ mNewDataType = pNewType;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::SetNewTypeName (
+ IN CHAR8 *TypeName
+ )
+{
+ SVfrDataType *pType;
+
+ if (mNewDataType == NULL) {
+ return VFR_RETURN_ERROR_SKIPED;
+ }
+ if (TypeName == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+ if (strlen(TypeName) >= MAX_NAME_LEN) {
+ return VFR_RETURN_INVALID_PARAMETER;
+ }
+
+ for (pType = mDataTypeList; pType != NULL; pType = pType->mNext) {
+ if (strcmp(pType->mTypeName, TypeName) == 0) {
+ return VFR_RETURN_REDEFINED;
+ }
+ }
+
+ strncpy(mNewDataType->mTypeName, TypeName, MAX_NAME_LEN - 1);
+ mNewDataType->mTypeName[MAX_NAME_LEN - 1] = 0;
+ return VFR_RETURN_SUCCESS;
+}
+
+/**
+ Record the bit field info in the data type.
+
+ @param FieldName Point to the field name.
+ @param TypeName Point to the type name.
+ @param Width The bit width.
+ @param FieldInUnion The filed is in Union type or Structure type.
+
+**/
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::DataTypeAddBitField (
+ IN CHAR8 *FieldName,
+ IN CHAR8 *TypeName,
+ IN UINT32 Width,
+ IN BOOLEAN FieldInUnion
+ )
+{
+ SVfrDataField *pNewField = NULL;
+ SVfrDataType *pFieldType = NULL;
+ SVfrDataField *pTmp;
+ UINT32 Align;
+ UINT32 MaxDataTypeSize;
+ BOOLEAN UpdateTotalSize;
+
+ CHECK_ERROR_RETURN (GetDataType (TypeName, &pFieldType), VFR_RETURN_SUCCESS);
+
+ if (Width > MAX_BIT_WIDTH) {
+ return VFR_RETURN_BIT_WIDTH_ERROR;
+ }
+
+ if (Width > pFieldType->mTotalSize * 8) {
+ return VFR_RETURN_BIT_WIDTH_ERROR;
+ }
+
+ if (FieldName != NULL && strlen (FieldName) >= MAX_NAME_LEN) {
+ return VFR_RETURN_INVALID_PARAMETER;
+ }
+
+ if (Width == 0 && FieldName != NULL) {
+ return VFR_RETURN_INVALID_PARAMETER;
+ }
+
+ for (pTmp = mNewDataType->mMembers; pTmp != NULL; pTmp = pTmp->mNext) {
+ if (FieldName != NULL && strcmp (pTmp->mFieldName, FieldName) == 0) {
+ return VFR_RETURN_REDEFINED;
+ }
+ }
+
+ Align = MIN (mPackAlign, pFieldType->mAlign);
+ UpdateTotalSize = FALSE;
+
+ if ((pNewField = new SVfrDataField) == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+
+ MaxDataTypeSize = mNewDataType->mTotalSize;
+ if (FieldName != NULL) {
+ strncpy (pNewField->mFieldName, FieldName, MAX_NAME_LEN - 1);
+ pNewField->mFieldName[MAX_NAME_LEN - 1] = 0;
+ }
+ pNewField->mFieldType = pFieldType;
+ pNewField->mIsBitField = TRUE;
+ pNewField->mBitWidth = Width;
+ pNewField->mArrayNum = 0;
+ pNewField->mBitOffset = 0;
+ pNewField->mOffset = 0;
+
+ if (mNewDataType->mMembers == NULL) {
+ mNewDataType->mMembers = pNewField;
+ pNewField->mNext = NULL;
+ } else {
+ for (pTmp = mNewDataType->mMembers; pTmp->mNext != NULL; pTmp = pTmp->mNext)
+ ;
+ pTmp->mNext = pNewField;
+ pNewField->mNext = NULL;
+ }
+
+ if (FieldInUnion) {
+ pNewField->mOffset = 0;
+ if (MaxDataTypeSize < pNewField->mFieldType->mTotalSize) {
+ mNewDataType->mTotalSize = pNewField->mFieldType->mTotalSize;
+ }
+ } else {
+ //
+ // Check whether the bit fields can be contained within one FieldType.
+ //
+ if (pTmp != NULL && pTmp->mIsBitField && strcmp (pTmp->mFieldType->mTypeName, pNewField->mFieldType->mTypeName) == 0 &&
+ (pTmp->mBitOffset - pTmp->mOffset * 8) + pTmp->mBitWidth + pNewField->mBitWidth <= pNewField->mFieldType->mTotalSize * 8) {
+ pNewField->mBitOffset = pTmp->mBitOffset + pTmp->mBitWidth;
+ pNewField->mOffset = pTmp->mOffset;
+ //
+ // If BitWidth=0,used to force alignment at the next word boundary.
+ // So make this bit field occupy the remaing bit width of current field type.
+ //
+ if (pNewField->mBitWidth == 0) {
+ pNewField->mBitWidth = pNewField->mFieldType->mTotalSize * 8 - (pNewField->mBitOffset - pTmp->mOffset * 8);
+ }
+ } else {
+ //
+ // The bit filed start a new memory
+ //
+ pNewField->mBitOffset = mNewDataType->mTotalSize * 8;
+ UpdateTotalSize = TRUE;
+ }
+ }
+
+ if (UpdateTotalSize){
+ if ((mNewDataType->mTotalSize % Align) == 0) {
+ pNewField->mOffset = mNewDataType->mTotalSize;
+ } else {
+ pNewField->mOffset = mNewDataType->mTotalSize + ALIGN_STUFF(mNewDataType->mTotalSize, Align);
+ }
+ mNewDataType->mTotalSize = pNewField->mOffset + (pNewField->mFieldType->mTotalSize);
+ }
+
+ mNewDataType->mAlign = MIN (mPackAlign, MAX (pFieldType->mAlign, mNewDataType->mAlign));
+ mNewDataType->mHasBitField = TRUE;
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::DataTypeAddField (
+ IN CHAR8 *FieldName,
+ IN CHAR8 *TypeName,
+ IN UINT32 ArrayNum,
+ IN BOOLEAN FieldInUnion
+ )
+{
+ SVfrDataField *pNewField = NULL;
+ SVfrDataType *pFieldType = NULL;
+ SVfrDataField *pTmp;
+ UINT32 Align;
+ UINT32 MaxDataTypeSize;
+
+ CHECK_ERROR_RETURN (GetDataType (TypeName, &pFieldType), VFR_RETURN_SUCCESS);
+ MaxDataTypeSize = mNewDataType->mTotalSize;
+
+ if (strlen (FieldName) >= MAX_NAME_LEN) {
+ return VFR_RETURN_INVALID_PARAMETER;
+ }
+
+ for (pTmp = mNewDataType->mMembers; pTmp != NULL; pTmp = pTmp->mNext) {
+ if (strcmp (pTmp->mFieldName, FieldName) == 0) {
+ return VFR_RETURN_REDEFINED;
+ }
+ }
+
+ Align = MIN (mPackAlign, pFieldType->mAlign);
+
+ if ((pNewField = new SVfrDataField) == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+ strncpy (pNewField->mFieldName, FieldName, MAX_NAME_LEN - 1);
+ pNewField->mFieldName[MAX_NAME_LEN - 1] = 0;
+ pNewField->mFieldType = pFieldType;
+ pNewField->mArrayNum = ArrayNum;
+ pNewField->mIsBitField = FALSE;
+ if ((mNewDataType->mTotalSize % Align) == 0) {
+ pNewField->mOffset = mNewDataType->mTotalSize;
+ } else {
+ pNewField->mOffset = mNewDataType->mTotalSize + ALIGN_STUFF(mNewDataType->mTotalSize, Align);
+ }
+ if (mNewDataType->mMembers == NULL) {
+ mNewDataType->mMembers = pNewField;
+ pNewField->mNext = NULL;
+ } else {
+ for (pTmp = mNewDataType->mMembers; pTmp->mNext != NULL; pTmp = pTmp->mNext)
+ ;
+ pTmp->mNext = pNewField;
+ pNewField->mNext = NULL;
+ }
+
+ mNewDataType->mAlign = MIN (mPackAlign, MAX (pFieldType->mAlign, mNewDataType->mAlign));
+
+ if (FieldInUnion) {
+ if (MaxDataTypeSize < pNewField->mFieldType->mTotalSize) {
+ mNewDataType->mTotalSize = pNewField->mFieldType->mTotalSize;
+ }
+ pNewField->mOffset = 0;
+ } else {
+ mNewDataType->mTotalSize = pNewField->mOffset + (pNewField->mFieldType->mTotalSize) * ((ArrayNum == 0) ? 1 : ArrayNum);
+ }
+
+ return VFR_RETURN_SUCCESS;
+}
+
+VOID
+CVfrVarDataTypeDB::DeclareDataTypeEnd (
+ VOID
+ )
+{
+ if (mNewDataType->mTypeName[0] == '\0') {
+ return;
+ }
+
+ if ((mNewDataType->mTotalSize % mNewDataType->mAlign) !=0) {
+ mNewDataType->mTotalSize += ALIGN_STUFF (mNewDataType->mTotalSize, mNewDataType->mAlign);
+ }
+
+ RegisterNewType (mNewDataType);
+ if (mFirstNewDataTypeName == NULL) {
+ mFirstNewDataTypeName = mNewDataType->mTypeName;
+ }
+
+ mNewDataType = NULL;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::GetDataType (
+ IN CHAR8 *TypeName,
+ OUT SVfrDataType **DataType
+ )
+{
+ SVfrDataType *pDataType = NULL;
+
+ if (TypeName == NULL) {
+ return VFR_RETURN_ERROR_SKIPED;
+ }
+
+ if (DataType == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ *DataType = NULL;
+
+ for (pDataType = mDataTypeList; pDataType != NULL; pDataType = pDataType->mNext) {
+ if (strcmp (TypeName, pDataType->mTypeName) == 0) {
+ *DataType = pDataType;
+ return VFR_RETURN_SUCCESS;
+ }
+ }
+
+ return VFR_RETURN_UNDEFINED;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::GetDataTypeSize (
+ IN UINT8 DataType,
+ OUT UINT32 *Size
+ )
+{
+ SVfrDataType *pDataType = NULL;
+
+ if (Size == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ *Size = 0;
+ DataType = DataType & 0x0F;
+
+ //
+ // For user defined data type, the size can't be got by this function.
+ //
+ if (DataType == EFI_IFR_TYPE_OTHER) {
+ return VFR_RETURN_SUCCESS;
+ }
+
+ for (pDataType = mDataTypeList; pDataType != NULL; pDataType = pDataType->mNext) {
+ if (DataType == pDataType->mType) {
+ *Size = pDataType->mTotalSize;
+ return VFR_RETURN_SUCCESS;
+ }
+ }
+
+ return VFR_RETURN_UNDEFINED;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::GetDataTypeSize (
+ IN CHAR8 *TypeName,
+ OUT UINT32 *Size
+ )
+{
+ SVfrDataType *pDataType = NULL;
+
+ if (Size == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ *Size = 0;
+
+ for (pDataType = mDataTypeList; pDataType != NULL; pDataType = pDataType->mNext) {
+ if (strcmp (TypeName, pDataType->mTypeName) == 0) {
+ *Size = pDataType->mTotalSize;
+ return VFR_RETURN_SUCCESS;
+ }
+ }
+
+ return VFR_RETURN_UNDEFINED;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::GetDataFieldInfo (
+ IN CHAR8 *VarStr,
+ OUT UINT16 &Offset,
+ OUT UINT8 &Type,
+ OUT UINT32 &Size,
+ OUT BOOLEAN &BitField
+ )
+{
+ CHAR8 TName[MAX_NAME_LEN], FName[MAX_NAME_LEN];
+ UINT32 ArrayIdx, Tmp;
+ SVfrDataType *pType = NULL;
+ SVfrDataField *pField = NULL;
+ CHAR8 *VarStrName;
+
+ Offset = 0;
+ Type = EFI_IFR_TYPE_OTHER;
+ Size = 0;
+ VarStrName = VarStr;
+
+ CHECK_ERROR_RETURN (ExtractStructTypeName (VarStr, TName), VFR_RETURN_SUCCESS);
+ CHECK_ERROR_RETURN (GetDataType (TName, &pType), VFR_RETURN_SUCCESS);
+
+ BitField = IsThisBitField (VarStrName);
+
+ //
+ // if it is not struct data type
+ //
+ Type = pType->mType;
+ Size = pType->mTotalSize;
+
+ while (*VarStr != '\0') {
+ CHECK_ERROR_RETURN(ExtractFieldNameAndArrary(VarStr, FName, ArrayIdx), VFR_RETURN_SUCCESS);
+ CHECK_ERROR_RETURN(GetTypeField (FName, pType, pField), VFR_RETURN_SUCCESS);
+ pType = pField->mFieldType;
+ CHECK_ERROR_RETURN(GetFieldOffset (pField, ArrayIdx, Tmp, pField->mIsBitField), VFR_RETURN_SUCCESS);
+ if (BitField && !pField->mIsBitField) {
+ Offset = (UINT16) (Offset + Tmp * 8);
+ } else {
+ Offset = (UINT16) (Offset + Tmp);
+ }
+ Type = GetFieldWidth (pField);
+ Size = GetFieldSize (pField, ArrayIdx, BitField);
+ }
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::GetUserDefinedTypeNameList (
+ OUT CHAR8 ***NameList,
+ OUT UINT32 *ListSize
+ )
+{
+ UINT32 Index;
+ SVfrDataType *pType;
+
+ if ((NameList == NULL) || (ListSize == NULL)) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ *NameList = NULL;
+ *ListSize = 0;
+
+ for (pType = mDataTypeList; pType != NULL; pType = pType->mNext) {
+ if (_IS_INTERNAL_TYPE(pType->mTypeName) == FALSE) {
+ (*ListSize)++;
+ }
+ }
+
+ if (*ListSize == 0) {
+ return VFR_RETURN_SUCCESS;
+ }
+
+ if ((*NameList = new CHAR8*[*ListSize]) == NULL) {
+ *ListSize = 0;
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+
+ for (Index = 0, pType = mDataTypeList; pType != NULL; pType = pType->mNext, Index++) {
+ if (_IS_INTERNAL_TYPE(pType->mTypeName) == FALSE) {
+ (*NameList)[Index] = pType->mTypeName;
+ }
+ }
+ return VFR_RETURN_SUCCESS;
+}
+
+BOOLEAN
+CVfrVarDataTypeDB::IsTypeNameDefined (
+ IN CHAR8 *TypeName
+ )
+{
+ SVfrDataType *pType;
+
+ if (TypeName == NULL) {
+ return FALSE;
+ }
+
+ for (pType = mDataTypeList; pType != NULL; pType = pType->mNext) {
+ if (strcmp (pType->mTypeName, TypeName) == 0) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+VOID
+CVfrVarDataTypeDB::Dump (
+ IN FILE *File
+ )
+{
+ SVfrDataType *pTNode;
+ SVfrDataField *pFNode;
+
+ fprintf (File, "\n\n***************************************************************\n");
+ fprintf (File, "\t\tmPackAlign = %x\n", mPackAlign);
+ for (pTNode = mDataTypeList; pTNode != NULL; pTNode = pTNode->mNext) {
+ fprintf (File, "\t\tstruct %s : mAlign [%d] mTotalSize [0x%x]\n\n", pTNode->mTypeName, pTNode->mAlign, pTNode->mTotalSize);
+ fprintf (File, "\t\tstruct %s {\n", pTNode->mTypeName);
+ for (pFNode = pTNode->mMembers; pFNode != NULL; pFNode = pFNode->mNext) {
+ if (pFNode->mArrayNum > 0) {
+ fprintf (File, "\t\t\t+%08d[%08x] %s[%d] <%s>\n", pFNode->mOffset, pFNode->mOffset,
+ pFNode->mFieldName, pFNode->mArrayNum, pFNode->mFieldType->mTypeName);
+ } else {
+ fprintf (File, "\t\t\t+%08d[%08x] %s <%s>\n", pFNode->mOffset, pFNode->mOffset,
+ pFNode->mFieldName, pFNode->mFieldType->mTypeName);
+ }
+ }
+ fprintf (File, "\t\t};\n");
+ fprintf (File, "---------------------------------------------------------------\n");
+ }
+ fprintf (File, "***************************************************************\n");
+}
+
+#ifdef CVFR_VARDATATYPEDB_DEBUG
+VOID
+CVfrVarDataTypeDB::ParserDB (
+ VOID
+ )
+{
+ SVfrDataType *pTNode;
+ SVfrDataField *pFNode;
+
+ printf ("***************************************************************\n");
+ printf ("\t\tmPackAlign = %x\n", mPackAlign);
+ for (pTNode = mDataTypeList; pTNode != NULL; pTNode = pTNode->mNext) {
+ printf ("\t\tstruct %s : mAlign [%x] mTotalSize [%x]\n\n", pTNode->mTypeName, pTNode->mAlign, pTNode->mTotalSize);
+ printf ("\t\tstruct %s {\n", pTNode->mTypeName);
+ for (pFNode = pTNode->mMembers; pFNode != NULL; pFNode = pFNode->mNext) {
+ printf ("\t\t\t%s\t%s\n", pFNode->mFieldType->mTypeName, pFNode->mFieldName);
+ }
+ printf ("\t\t};\n");
+ printf ("---------------------------------------------------------------\n");
+ }
+ printf ("***************************************************************\n");
+}
+#endif
+
+SVfrVarStorageNode::SVfrVarStorageNode (
+ IN EFI_GUID *Guid,
+ IN CHAR8 *StoreName,
+ IN EFI_VARSTORE_ID VarStoreId,
+ IN EFI_STRING_ID VarName,
+ IN UINT32 VarSize,
+ IN BOOLEAN Flag
+ )
+{
+ if (Guid != NULL) {
+ mGuid = *Guid;
+ } else {
+ memset (&mGuid, 0, sizeof (EFI_GUID));
+ }
+ if (StoreName != NULL) {
+ mVarStoreName = new CHAR8[strlen(StoreName) + 1];
+ strcpy (mVarStoreName, StoreName);
+ } else {
+ mVarStoreName = NULL;
+ }
+ mNext = NULL;
+ mVarStoreId = VarStoreId;
+ mVarStoreType = EFI_VFR_VARSTORE_EFI;
+ mStorageInfo.mEfiVar.mEfiVarName = VarName;
+ mStorageInfo.mEfiVar.mEfiVarSize = VarSize;
+ mAssignedFlag = Flag;
+}
+
+SVfrVarStorageNode::SVfrVarStorageNode (
+ IN EFI_GUID *Guid,
+ IN CHAR8 *StoreName,
+ IN EFI_VARSTORE_ID VarStoreId,
+ IN SVfrDataType *DataType,
+ IN BOOLEAN BitsVarstore,
+ IN BOOLEAN Flag
+ )
+{
+ if (Guid != NULL) {
+ mGuid = *Guid;
+ } else {
+ memset (&mGuid, 0, sizeof (EFI_GUID));
+ }
+ if (StoreName != NULL) {
+ mVarStoreName = new CHAR8[strlen(StoreName) + 1];
+ strcpy (mVarStoreName, StoreName);
+ } else {
+ mVarStoreName = NULL;
+ }
+ mNext = NULL;
+ mVarStoreId = VarStoreId;
+ if (BitsVarstore) {
+ mVarStoreType = EFI_VFR_VARSTORE_BUFFER_BITS;
+ } else {
+ mVarStoreType = EFI_VFR_VARSTORE_BUFFER;
+ }
+ mStorageInfo.mDataType = DataType;
+ mAssignedFlag = Flag;
+}
+
+SVfrVarStorageNode::SVfrVarStorageNode (
+ IN CHAR8 *StoreName,
+ IN EFI_VARSTORE_ID VarStoreId
+ )
+{
+ memset (&mGuid, 0, sizeof (EFI_GUID));
+ if (StoreName != NULL) {
+ mVarStoreName = new CHAR8[strlen(StoreName) + 1];
+ strcpy (mVarStoreName, StoreName);
+ } else {
+ mVarStoreName = NULL;
+ }
+ mNext = NULL;
+ mVarStoreId = VarStoreId;
+ mVarStoreType = EFI_VFR_VARSTORE_NAME;
+ mStorageInfo.mNameSpace.mNameTable = new EFI_VARSTORE_ID[DEFAULT_NAME_TABLE_ITEMS];
+ mStorageInfo.mNameSpace.mTableSize = 0;
+ mAssignedFlag = FALSE;
+}
+
+SVfrVarStorageNode::~SVfrVarStorageNode (
+ VOID
+ )
+{
+ if (mVarStoreName != NULL) {
+ delete[] mVarStoreName;
+ }
+
+ if (mVarStoreType == EFI_VFR_VARSTORE_NAME) {
+ delete[] mStorageInfo.mNameSpace.mNameTable;
+ }
+}
+
+CVfrDataStorage::CVfrDataStorage (
+ VOID
+ )
+{
+ UINT32 Index;
+
+ for (Index = 0; Index < EFI_FREE_VARSTORE_ID_BITMAP_SIZE; Index++) {
+ mFreeVarStoreIdBitMap[Index] = 0;
+ }
+
+ // Question ID 0 is reserved.
+ mFreeVarStoreIdBitMap[0] = 0x80000000;
+
+ mBufferVarStoreList = NULL;
+ mEfiVarStoreList = NULL;
+ mNameVarStoreList = NULL;
+ mCurrVarStorageNode = NULL;
+ mNewVarStorageNode = NULL;
+ mBufferFieldInfoListHead = NULL;
+ mBufferFieldInfoListTail = NULL;
+}
+
+CVfrDataStorage::~CVfrDataStorage (
+ VOID
+ )
+{
+ SVfrVarStorageNode *pNode;
+
+ while (mBufferVarStoreList != NULL) {
+ pNode = mBufferVarStoreList;
+ mBufferVarStoreList = mBufferVarStoreList->mNext;
+ delete pNode;
+ }
+ while (mEfiVarStoreList != NULL) {
+ pNode = mEfiVarStoreList;
+ mEfiVarStoreList = mEfiVarStoreList->mNext;
+ delete pNode;
+ }
+ while (mNameVarStoreList != NULL) {
+ pNode = mNameVarStoreList;
+ mNameVarStoreList = mNameVarStoreList->mNext;
+ delete pNode;
+ }
+ if (mNewVarStorageNode != NULL) {
+ delete mNewVarStorageNode;
+ }
+}
+
+EFI_VARSTORE_ID
+CVfrDataStorage::GetFreeVarStoreId (
+ EFI_VFR_VARSTORE_TYPE VarType
+ )
+{
+ UINT32 Index, Mask, Offset;
+
+ Index = 0;
+
+ for (; Index < EFI_FREE_VARSTORE_ID_BITMAP_SIZE; Index++) {
+ if (mFreeVarStoreIdBitMap[Index] != 0xFFFFFFFF) {
+ break;
+ }
+ }
+
+ if (Index == EFI_FREE_VARSTORE_ID_BITMAP_SIZE) {
+ return EFI_VARSTORE_ID_INVALID;
+ }
+
+ for (Offset = 0, Mask = 0x80000000; Mask != 0; Mask >>= 1, Offset++) {
+ if ((mFreeVarStoreIdBitMap[Index] & Mask) == 0) {
+ mFreeVarStoreIdBitMap[Index] |= Mask;
+ return (EFI_VARSTORE_ID)((Index << EFI_BITS_SHIFT_PER_UINT32) + Offset);
+ }
+ }
+
+ return EFI_VARSTORE_ID_INVALID;
+}
+
+BOOLEAN
+CVfrDataStorage::ChekVarStoreIdFree (
+ IN EFI_VARSTORE_ID VarStoreId
+ )
+{
+ UINT32 Index = (VarStoreId / EFI_BITS_PER_UINT32);
+ UINT32 Offset = (VarStoreId % EFI_BITS_PER_UINT32);
+
+ return (mFreeVarStoreIdBitMap[Index] & (0x80000000 >> Offset)) == 0;
+}
+
+VOID
+CVfrDataStorage::MarkVarStoreIdUsed (
+ IN EFI_VARSTORE_ID VarStoreId
+ )
+{
+ UINT32 Index = (VarStoreId / EFI_BITS_PER_UINT32);
+ UINT32 Offset = (VarStoreId % EFI_BITS_PER_UINT32);
+
+ mFreeVarStoreIdBitMap[Index] |= (0x80000000 >> Offset);
+}
+
+VOID
+CVfrDataStorage::MarkVarStoreIdUnused (
+ IN EFI_VARSTORE_ID VarStoreId
+ )
+{
+ UINT32 Index = (VarStoreId / EFI_BITS_PER_UINT32);
+ UINT32 Offset = (VarStoreId % EFI_BITS_PER_UINT32);
+
+ mFreeVarStoreIdBitMap[Index] &= ~(0x80000000 >> Offset);
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDataStorage::DeclareNameVarStoreBegin (
+ IN CHAR8 *StoreName,
+ IN EFI_VARSTORE_ID VarStoreId
+ )
+{
+ SVfrVarStorageNode *pNode = NULL;
+ EFI_VARSTORE_ID TmpVarStoreId;
+
+ if (StoreName == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ if (GetVarStoreId (StoreName, &TmpVarStoreId) == VFR_RETURN_SUCCESS) {
+ return VFR_RETURN_REDEFINED;
+ }
+
+ if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
+ VarStoreId = GetFreeVarStoreId (EFI_VFR_VARSTORE_NAME);
+ } else {
+ if (ChekVarStoreIdFree (VarStoreId) == FALSE) {
+ return VFR_RETURN_VARSTOREID_REDEFINED;
+ }
+ MarkVarStoreIdUsed (VarStoreId);
+ }
+
+ if ((pNode = new SVfrVarStorageNode (StoreName, VarStoreId)) == NULL) {
+ return VFR_RETURN_UNDEFINED;
+ }
+
+ mNewVarStorageNode = pNode;
+
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDataStorage::NameTableAddItem (
+ IN EFI_STRING_ID Item
+ )
+{
+ EFI_VARSTORE_ID *NewTable, *OldTable;
+ UINT32 TableSize;
+
+ OldTable = mNewVarStorageNode->mStorageInfo.mNameSpace.mNameTable;
+ TableSize = mNewVarStorageNode->mStorageInfo.mNameSpace.mTableSize;
+
+ if ((TableSize != 0) && ((TableSize % DEFAULT_NAME_TABLE_ITEMS) == 0)) {
+ if ((NewTable = new EFI_VARSTORE_ID[TableSize + DEFAULT_NAME_TABLE_ITEMS]) == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+ memcpy (NewTable, OldTable, TableSize);
+ mNewVarStorageNode->mStorageInfo.mNameSpace.mNameTable = NewTable;
+ }
+
+ mNewVarStorageNode->mStorageInfo.mNameSpace.mNameTable[TableSize++] = Item;
+ mNewVarStorageNode->mStorageInfo.mNameSpace.mTableSize = TableSize;
+
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDataStorage::DeclareNameVarStoreEnd (
+ IN EFI_GUID *Guid
+ )
+{
+ mNewVarStorageNode->mGuid = *Guid;
+ mNewVarStorageNode->mNext = mNameVarStoreList;
+ mNameVarStoreList = mNewVarStorageNode;
+
+ mNewVarStorageNode = NULL;
+
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDataStorage::DeclareEfiVarStore (
+ IN CHAR8 *StoreName,
+ IN EFI_GUID *Guid,
+ IN EFI_STRING_ID NameStrId,
+ IN UINT32 VarSize,
+ IN BOOLEAN Flag
+ )
+{
+ SVfrVarStorageNode *pNode;
+ EFI_VARSTORE_ID VarStoreId;
+
+ if ((StoreName == NULL) || (Guid == NULL)) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ if (VarSize > sizeof (UINT64)) {
+ return VFR_RETURN_EFIVARSTORE_SIZE_ERROR;
+ }
+
+ if (GetVarStoreId (StoreName, &VarStoreId, Guid) == VFR_RETURN_SUCCESS) {
+ return VFR_RETURN_REDEFINED;
+ }
+
+ VarStoreId = GetFreeVarStoreId (EFI_VFR_VARSTORE_EFI);
+ if ((pNode = new SVfrVarStorageNode (Guid, StoreName, VarStoreId, NameStrId, VarSize, Flag)) == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+
+ pNode->mNext = mEfiVarStoreList;
+ mEfiVarStoreList = pNode;
+
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDataStorage::DeclareBufferVarStore (
+ IN CHAR8 *StoreName,
+ IN EFI_GUID *Guid,
+ IN CVfrVarDataTypeDB *DataTypeDB,
+ IN CHAR8 *TypeName,
+ IN EFI_VARSTORE_ID VarStoreId,
+ IN BOOLEAN IsBitVarStore,
+ IN BOOLEAN Flag
+ )
+{
+ SVfrVarStorageNode *pNew = NULL;
+ SVfrDataType *pDataType = NULL;
+ EFI_VARSTORE_ID TempVarStoreId;
+
+ if ((StoreName == NULL) || (Guid == NULL) || (DataTypeDB == NULL)) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ if (GetVarStoreId (StoreName, &TempVarStoreId, Guid) == VFR_RETURN_SUCCESS) {
+ return VFR_RETURN_REDEFINED;
+ }
+
+ CHECK_ERROR_RETURN(DataTypeDB->GetDataType (TypeName, &pDataType), VFR_RETURN_SUCCESS);
+
+ if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
+ VarStoreId = GetFreeVarStoreId (EFI_VFR_VARSTORE_BUFFER);
+ } else {
+ if (ChekVarStoreIdFree (VarStoreId) == FALSE) {
+ return VFR_RETURN_VARSTOREID_REDEFINED;
+ }
+ MarkVarStoreIdUsed (VarStoreId);
+ }
+
+ if ((pNew = new SVfrVarStorageNode (Guid, StoreName, VarStoreId, pDataType, IsBitVarStore, Flag)) == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+
+ pNew->mNext = mBufferVarStoreList;
+ mBufferVarStoreList = pNew;
+
+ if (gCVfrBufferConfig.Register(StoreName, Guid) != 0) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDataStorage::GetVarStoreByDataType (
+ IN CHAR8 *DataTypeName,
+ OUT SVfrVarStorageNode **VarNode,
+ IN EFI_GUID *VarGuid
+ )
+{
+ SVfrVarStorageNode *pNode;
+ SVfrVarStorageNode *MatchNode;
+
+ MatchNode = NULL;
+ for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (strcmp (pNode->mStorageInfo.mDataType->mTypeName, DataTypeName) != 0) {
+ continue;
+ }
+
+ if ((VarGuid != NULL)) {
+ if (memcmp (VarGuid, &pNode->mGuid, sizeof (EFI_GUID)) == 0) {
+ *VarNode = pNode;
+ return VFR_RETURN_SUCCESS;
+ }
+ } else {
+ if (MatchNode == NULL) {
+ MatchNode = pNode;
+ } else {
+ //
+ // More than one varstores referred the same data structures.
+ //
+ return VFR_RETURN_VARSTORE_DATATYPE_REDEFINED_ERROR;
+ }
+ }
+ }
+
+ if (MatchNode == NULL) {
+ return VFR_RETURN_UNDEFINED;
+ }
+
+ *VarNode = MatchNode;
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VARSTORE_ID
+CVfrDataStorage::CheckGuidField (
+ IN SVfrVarStorageNode *pNode,
+ IN EFI_GUID *StoreGuid,
+ IN BOOLEAN *HasFoundOne,
+ OUT EFI_VFR_RETURN_CODE *ReturnCode
+ )
+{
+ if (StoreGuid != NULL) {
+ //
+ // If has guid info, compare the guid filed.
+ //
+ if (memcmp (StoreGuid, &pNode->mGuid, sizeof (EFI_GUID)) == 0) {
+ //
+ // Both name and guid are same, this this varstore.
+ //
+ mCurrVarStorageNode = pNode;
+ *ReturnCode = VFR_RETURN_SUCCESS;
+ return TRUE;
+ }
+ } else {
+ //
+ // Not has Guid field, check whether this name is the only one.
+ //
+ if (*HasFoundOne) {
+ //
+ // The name has conflict, return name redefined.
+ //
+ *ReturnCode = VFR_RETURN_VARSTORE_NAME_REDEFINED_ERROR;
+ return TRUE;
+ }
+
+ *HasFoundOne = TRUE;
+ mCurrVarStorageNode = pNode;
+ }
+
+ return FALSE;
+}
+
+/**
+ Base on the input store name and guid to find the varstore id.
+
+ If both name and guid are inputed, base on the name and guid to
+ found the varstore. If only name inputed, base on the name to
+ found the varstore and go on to check whether more than one varstore
+ has the same name. If only has found one varstore, return this
+ varstore; if more than one varstore has same name, return varstore
+ name redefined error. If no varstore found by varstore name, call
+ function GetVarStoreByDataType and use inputed varstore name as
+ data type name to search.
+**/
+EFI_VFR_RETURN_CODE
+CVfrDataStorage::GetVarStoreId (
+ IN CHAR8 *StoreName,
+ OUT EFI_VARSTORE_ID *VarStoreId,
+ IN EFI_GUID *StoreGuid
+ )
+{
+ EFI_VFR_RETURN_CODE ReturnCode;
+ SVfrVarStorageNode *pNode;
+ BOOLEAN HasFoundOne = FALSE;
+
+ mCurrVarStorageNode = NULL;
+
+ for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
+ if (CheckGuidField(pNode, StoreGuid, &HasFoundOne, &ReturnCode)) {
+ *VarStoreId = mCurrVarStorageNode->mVarStoreId;
+ return ReturnCode;
+ }
+ }
+ }
+
+ for (pNode = mEfiVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
+ if (CheckGuidField(pNode, StoreGuid, &HasFoundOne, &ReturnCode)) {
+ *VarStoreId = mCurrVarStorageNode->mVarStoreId;
+ return ReturnCode;
+ }
+ }
+ }
+
+ for (pNode = mNameVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
+ if (CheckGuidField(pNode, StoreGuid, &HasFoundOne, &ReturnCode)) {
+ *VarStoreId = mCurrVarStorageNode->mVarStoreId;
+ return ReturnCode;
+ }
+ }
+ }
+
+ if (HasFoundOne) {
+ *VarStoreId = mCurrVarStorageNode->mVarStoreId;
+ return VFR_RETURN_SUCCESS;
+ }
+
+ *VarStoreId = EFI_VARSTORE_ID_INVALID;
+
+ //
+ // Assume that Data structure name is used as StoreName, and check again.
+ //
+ ReturnCode = GetVarStoreByDataType (StoreName, &pNode, StoreGuid);
+ if (pNode != NULL) {
+ mCurrVarStorageNode = pNode;
+ *VarStoreId = pNode->mVarStoreId;
+ }
+
+ return ReturnCode;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDataStorage::GetBufferVarStoreDataTypeName (
+ IN EFI_VARSTORE_ID VarStoreId,
+ OUT CHAR8 **DataTypeName
+ )
+{
+ SVfrVarStorageNode *pNode;
+
+ if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ *DataTypeName = pNode->mStorageInfo.mDataType->mTypeName;
+ return VFR_RETURN_SUCCESS;
+ }
+ }
+
+ return VFR_RETURN_UNDEFINED;
+}
+
+EFI_VFR_VARSTORE_TYPE
+CVfrDataStorage::GetVarStoreType (
+ IN EFI_VARSTORE_ID VarStoreId
+ )
+{
+ SVfrVarStorageNode *pNode;
+ EFI_VFR_VARSTORE_TYPE VarStoreType;
+
+ VarStoreType = EFI_VFR_VARSTORE_INVALID;
+
+ if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
+ return VarStoreType;
+ }
+
+ for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ VarStoreType = pNode->mVarStoreType;
+ return VarStoreType;
+ }
+ }
+
+ for (pNode = mEfiVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ VarStoreType = pNode->mVarStoreType;
+ return VarStoreType;
+ }
+ }
+
+ for (pNode = mNameVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ VarStoreType = pNode->mVarStoreType;
+ return VarStoreType;
+ }
+ }
+
+ return VarStoreType;
+}
+
+EFI_GUID *
+CVfrDataStorage::GetVarStoreGuid (
+ IN EFI_VARSTORE_ID VarStoreId
+ )
+{
+ SVfrVarStorageNode *pNode;
+ EFI_GUID *VarGuid;
+
+ VarGuid = NULL;
+
+ if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
+ return VarGuid;
+ }
+
+ for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ VarGuid = &pNode->mGuid;
+ return VarGuid;
+ }
+ }
+
+ for (pNode = mEfiVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ VarGuid = &pNode->mGuid;
+ return VarGuid;
+ }
+ }
+
+ for (pNode = mNameVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ VarGuid = &pNode->mGuid;
+ return VarGuid;
+ }
+ }
+
+ return VarGuid;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDataStorage::GetVarStoreName (
+ IN EFI_VARSTORE_ID VarStoreId,
+ OUT CHAR8 **VarStoreName
+ )
+{
+ SVfrVarStorageNode *pNode;
+
+ if (VarStoreName == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ *VarStoreName = pNode->mVarStoreName;
+ return VFR_RETURN_SUCCESS;
+ }
+ }
+
+ for (pNode = mEfiVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ *VarStoreName = pNode->mVarStoreName;
+ return VFR_RETURN_SUCCESS;
+ }
+ }
+
+ for (pNode = mNameVarStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ *VarStoreName = pNode->mVarStoreName;
+ return VFR_RETURN_SUCCESS;
+ }
+ }
+
+ *VarStoreName = NULL;
+ return VFR_RETURN_UNDEFINED;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDataStorage::GetEfiVarStoreInfo (
+ IN OUT EFI_VARSTORE_INFO *Info
+ )
+{
+ if (Info == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ if (mCurrVarStorageNode == NULL) {
+ return VFR_RETURN_GET_EFIVARSTORE_ERROR;
+ }
+
+ Info->mInfo.mVarName = mCurrVarStorageNode->mStorageInfo.mEfiVar.mEfiVarName;
+ Info->mVarTotalSize = mCurrVarStorageNode->mStorageInfo.mEfiVar.mEfiVarSize;
+ switch (Info->mVarTotalSize) {
+ case 1:
+ Info->mVarType = EFI_IFR_TYPE_NUM_SIZE_8;
+ break;
+ case 2:
+ Info->mVarType = EFI_IFR_TYPE_NUM_SIZE_16;
+ break;
+ case 4:
+ Info->mVarType = EFI_IFR_TYPE_NUM_SIZE_32;
+ break;
+ case 8:
+ Info->mVarType = EFI_IFR_TYPE_NUM_SIZE_64;
+ break;
+ default :
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDataStorage::AddBufferVarStoreFieldInfo (
+ IN EFI_VARSTORE_INFO *Info
+ )
+{
+ BufferVarStoreFieldInfoNode *pNew;
+
+ if ((pNew = new BufferVarStoreFieldInfoNode(Info)) == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ if (mBufferFieldInfoListHead == NULL) {
+ mBufferFieldInfoListHead = pNew;
+ mBufferFieldInfoListTail= pNew;
+ } else {
+ mBufferFieldInfoListTail->mNext = pNew;
+ mBufferFieldInfoListTail = pNew;
+ }
+
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDataStorage::GetBufferVarStoreFieldInfo (
+ IN OUT EFI_VARSTORE_INFO *Info
+ )
+{
+ BufferVarStoreFieldInfoNode *pNode;
+
+ pNode = mBufferFieldInfoListHead;
+ while (pNode != NULL) {
+ if (Info->mVarStoreId == pNode->mVarStoreInfo.mVarStoreId &&
+ Info->mInfo.mVarOffset == pNode->mVarStoreInfo.mInfo.mVarOffset) {
+ Info->mVarTotalSize = pNode->mVarStoreInfo.mVarTotalSize;
+ Info->mVarType = pNode->mVarStoreInfo.mVarType;
+ return VFR_RETURN_SUCCESS;
+ }
+ pNode = pNode->mNext;
+ }
+ return VFR_RETURN_FATAL_ERROR;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDataStorage::GetNameVarStoreInfo (
+ OUT EFI_VARSTORE_INFO *Info,
+ IN UINT32 Index
+ )
+{
+ if (Info == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ if (mCurrVarStorageNode == NULL) {
+ return VFR_RETURN_GET_NVVARSTORE_ERROR;
+ }
+
+ Info->mInfo.mVarName = mCurrVarStorageNode->mStorageInfo.mNameSpace.mNameTable[Index];
+
+ return VFR_RETURN_SUCCESS;
+}
+
+SVfrDefaultStoreNode::SVfrDefaultStoreNode (
+ IN EFI_IFR_DEFAULTSTORE *ObjBinAddr,
+ IN CHAR8 *RefName,
+ IN EFI_STRING_ID DefaultStoreNameId,
+ IN UINT16 DefaultId
+ )
+{
+ mObjBinAddr = ObjBinAddr;
+
+ if (RefName != NULL) {
+ mRefName = new CHAR8[strlen (RefName) + 1];
+ strcpy (mRefName, RefName);
+ } else {
+ mRefName = NULL;
+ }
+
+ mNext = NULL;
+ mDefaultId = DefaultId;
+ mDefaultStoreNameId = DefaultStoreNameId;
+}
+
+SVfrDefaultStoreNode::~SVfrDefaultStoreNode (
+ VOID
+ )
+{
+ if (mRefName != NULL) {
+ delete[] mRefName;
+ }
+}
+
+CVfrDefaultStore::CVfrDefaultStore (
+ VOID
+ )
+{
+ mDefaultStoreList = NULL;
+}
+
+CVfrDefaultStore::~CVfrDefaultStore (
+ VOID
+ )
+{
+ SVfrDefaultStoreNode *pTmp = NULL;
+
+ while (mDefaultStoreList != NULL) {
+ pTmp = mDefaultStoreList;
+ mDefaultStoreList = mDefaultStoreList->mNext;
+ delete pTmp;
+ }
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDefaultStore::RegisterDefaultStore (
+ IN CHAR8 *ObjBinAddr,
+ IN CHAR8 *RefName,
+ IN EFI_STRING_ID DefaultStoreNameId,
+ IN UINT16 DefaultId
+ )
+{
+ SVfrDefaultStoreNode *pNode = NULL;
+
+ if (RefName == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ for (pNode = mDefaultStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (strcmp (pNode->mRefName, RefName) == 0) {
+ return VFR_RETURN_REDEFINED;
+ }
+ }
+
+ if ((pNode = new SVfrDefaultStoreNode ((EFI_IFR_DEFAULTSTORE *)ObjBinAddr, RefName, DefaultStoreNameId, DefaultId)) == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+
+ pNode->mNext = mDefaultStoreList;
+ mDefaultStoreList = pNode;
+
+ return VFR_RETURN_SUCCESS;
+}
+
+/*
+ * assign new reference name or new default store name id only if
+ * the original is invalid
+ */
+EFI_VFR_RETURN_CODE
+CVfrDefaultStore::ReRegisterDefaultStoreById (
+ IN UINT16 DefaultId,
+ IN CHAR8 *RefName,
+ IN EFI_STRING_ID DefaultStoreNameId
+ )
+{
+ SVfrDefaultStoreNode *pNode = NULL;
+
+ for (pNode = mDefaultStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mDefaultId == DefaultId) {
+ break;
+ }
+ }
+
+ if (pNode == NULL) {
+ return VFR_RETURN_UNDEFINED;
+ } else {
+ if (pNode->mDefaultStoreNameId == EFI_STRING_ID_INVALID) {
+ pNode->mDefaultStoreNameId = DefaultStoreNameId;
+ if (pNode->mObjBinAddr != NULL) {
+ pNode->mObjBinAddr->DefaultName = DefaultStoreNameId;
+ }
+ } else {
+ return VFR_RETURN_REDEFINED;
+ }
+
+ if (RefName != NULL) {
+ delete pNode->mRefName;
+ pNode->mRefName = new CHAR8[strlen (RefName) + 1];
+ if (pNode->mRefName != NULL) {
+ strcpy (pNode->mRefName, RefName);
+ }
+ }
+ }
+
+ return VFR_RETURN_SUCCESS;
+}
+
+BOOLEAN
+CVfrDefaultStore::DefaultIdRegistered (
+ IN UINT16 DefaultId
+ )
+{
+ SVfrDefaultStoreNode *pNode = NULL;
+
+ for (pNode = mDefaultStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mDefaultId == DefaultId) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDefaultStore::GetDefaultId (
+ IN CHAR8 *RefName,
+ OUT UINT16 *DefaultId
+ )
+{
+ SVfrDefaultStoreNode *pTmp = NULL;
+
+ if (DefaultId == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ for (pTmp = mDefaultStoreList; pTmp != NULL; pTmp = pTmp->mNext) {
+ if (strcmp (pTmp->mRefName, RefName) == 0) {
+ *DefaultId = pTmp->mDefaultId;
+ return VFR_RETURN_SUCCESS;
+ }
+ }
+
+ return VFR_RETURN_UNDEFINED;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrDefaultStore::BufferVarStoreAltConfigAdd (
+ IN EFI_VARSTORE_ID DefaultId,
+ IN EFI_VARSTORE_INFO &Info,
+ IN CHAR8 *VarStoreName,
+ IN EFI_GUID *VarStoreGuid,
+ IN UINT8 Type,
+ IN EFI_IFR_TYPE_VALUE Value
+ )
+{
+ SVfrDefaultStoreNode *pNode = NULL;
+ CHAR8 NewAltCfg[2 * 2 * sizeof (UINT16) + 1] = {0,};
+ INTN Returnvalue = 0;
+
+ if (VarStoreName == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ for (pNode = mDefaultStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mDefaultId == DefaultId) {
+ break;
+ }
+ }
+
+ if (pNode == NULL) {
+ return VFR_RETURN_UNDEFINED;
+ }
+
+ gCVfrBufferConfig.Open ();
+
+ sprintf (NewAltCfg, "%04x", pNode->mDefaultId);
+ if ((Returnvalue = gCVfrBufferConfig.Select(VarStoreName, VarStoreGuid)) == 0) {
+ if ((Returnvalue = gCVfrBufferConfig.Write ('a', VarStoreName, VarStoreGuid, NewAltCfg, Type, Info.mInfo.mVarOffset, Info.mVarTotalSize, Value)) != 0) {
+ goto WriteError;
+ }
+ }
+
+ gCVfrBufferConfig.Close ();
+
+ return VFR_RETURN_SUCCESS;
+
+WriteError:
+ gCVfrBufferConfig.Close ();
+ return (EFI_VFR_RETURN_CODE)Returnvalue;
+}
+
+SVfrRuleNode::SVfrRuleNode (
+ IN CHAR8 *RuleName,
+ IN UINT8 RuleId
+ )
+{
+ if (RuleName != NULL) {
+ mRuleName = new CHAR8[strlen (RuleName) + 1];
+ strcpy (mRuleName, RuleName);
+ } else {
+ mRuleName = NULL;
+ }
+
+ mNext = NULL;
+ mRuleId = RuleId;
+}
+
+SVfrRuleNode::~SVfrRuleNode (
+ VOID
+ )
+{
+ if (mRuleName != NULL) {
+ delete[] mRuleName;
+ }
+}
+
+CVfrRulesDB::CVfrRulesDB ()
+{
+ mRuleList = NULL;
+ mFreeRuleId = EFI_VARSTORE_ID_START;
+}
+
+CVfrRulesDB::~CVfrRulesDB ()
+{
+ SVfrRuleNode *pNode;
+
+ while(mRuleList != NULL) {
+ pNode = mRuleList;
+ mRuleList = mRuleList->mNext;
+ delete pNode;
+ }
+}
+
+VOID
+CVfrRulesDB::RegisterRule (
+ IN CHAR8 *RuleName
+ )
+{
+ SVfrRuleNode *pNew;
+
+ if (RuleName == NULL) {
+ return ;
+ }
+
+ if ((pNew = new SVfrRuleNode (RuleName, mFreeRuleId)) == NULL) {
+ return ;
+ }
+
+ mFreeRuleId++;
+
+ pNew->mNext = mRuleList;
+ mRuleList = pNew;
+}
+
+UINT8
+CVfrRulesDB::GetRuleId (
+ IN CHAR8 *RuleName
+ )
+{
+ SVfrRuleNode *pNode;
+
+ if (RuleName == NULL) {
+ return EFI_RULE_ID_INVALID;
+ }
+
+ for (pNode = mRuleList; pNode != NULL; pNode = pNode->mNext) {
+ if (strcmp (pNode->mRuleName, RuleName) == 0) {
+ return pNode->mRuleId;
+ }
+ }
+
+ return EFI_RULE_ID_INVALID;
+}
+
+CVfrRulesDB gCVfrRulesDB;
+
+EFI_VARSTORE_INFO::EFI_VARSTORE_INFO (
+ VOID
+ )
+{
+ mVarStoreId = EFI_VARSTORE_ID_INVALID;
+ mInfo.mVarName = EFI_STRING_ID_INVALID;
+ mInfo.mVarOffset = EFI_VAROFFSET_INVALID;
+ mVarType = EFI_IFR_TYPE_OTHER;
+ mVarTotalSize = 0;
+ mIsBitVar = FALSE;
+}
+
+EFI_VARSTORE_INFO::EFI_VARSTORE_INFO (
+ IN EFI_VARSTORE_INFO &Info
+ )
+{
+ mVarStoreId = Info.mVarStoreId;
+ mInfo.mVarName = Info.mInfo.mVarName;
+ mInfo.mVarOffset = Info.mInfo.mVarOffset;
+ mVarType = Info.mVarType;
+ mVarTotalSize = Info.mVarTotalSize;
+ mIsBitVar = Info.mIsBitVar;
+}
+
+EFI_VARSTORE_INFO&
+EFI_VARSTORE_INFO::operator= (
+ IN CONST EFI_VARSTORE_INFO &Info
+ )
+{
+ if (this != &Info) {
+ mVarStoreId = Info.mVarStoreId;
+ mInfo.mVarName = Info.mInfo.mVarName;
+ mInfo.mVarOffset = Info.mInfo.mVarOffset;
+ mVarType = Info.mVarType;
+ mVarTotalSize = Info.mVarTotalSize;
+ mIsBitVar = Info.mIsBitVar;
+ }
+
+ return *this;
+}
+
+BOOLEAN
+EFI_VARSTORE_INFO::operator == (
+ IN EFI_VARSTORE_INFO *Info
+ )
+{
+ if ((mVarStoreId == Info->mVarStoreId) &&
+ (mInfo.mVarName == Info->mInfo.mVarName) &&
+ (mInfo.mVarOffset == Info->mInfo.mVarOffset) &&
+ (mVarType == Info->mVarType) &&
+ (mVarTotalSize == Info->mVarTotalSize) &&
+ (mIsBitVar == Info->mIsBitVar)) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+BufferVarStoreFieldInfoNode::BufferVarStoreFieldInfoNode(
+ IN EFI_VARSTORE_INFO *Info
+ )
+{
+ mVarStoreInfo.mVarType = Info->mVarType;
+ mVarStoreInfo.mVarTotalSize = Info->mVarTotalSize;
+ mVarStoreInfo.mInfo.mVarOffset = Info->mInfo.mVarOffset;
+ mVarStoreInfo.mVarStoreId = Info->mVarStoreId;
+ mNext = NULL;
+}
+
+BufferVarStoreFieldInfoNode::~BufferVarStoreFieldInfoNode ()
+{
+ mVarStoreInfo.mVarType = EFI_IFR_TYPE_OTHER;
+ mVarStoreInfo.mVarTotalSize = 0;
+ mVarStoreInfo.mInfo.mVarOffset = EFI_VAROFFSET_INVALID;
+ mVarStoreInfo.mVarStoreId = EFI_VARSTORE_ID_INVALID;
+ mNext = NULL;
+}
+
+static EFI_VARSTORE_INFO gEfiInvalidVarStoreInfo;
+
+EFI_QUESTION_ID
+CVfrQuestionDB::GetFreeQuestionId (
+ VOID
+ )
+{
+ UINT32 Index, Mask, Offset;
+
+ for (Index = 0; Index < EFI_FREE_QUESTION_ID_BITMAP_SIZE; Index++) {
+ if (mFreeQIdBitMap[Index] != 0xFFFFFFFF) {
+ break;
+ }
+ }
+
+ if (Index == EFI_FREE_QUESTION_ID_BITMAP_SIZE) {
+ return EFI_QUESTION_ID_INVALID;
+ }
+
+ for (Offset = 0, Mask = 0x80000000; Mask != 0; Mask >>= 1, Offset++) {
+ if ((mFreeQIdBitMap[Index] & Mask) == 0) {
+ mFreeQIdBitMap[Index] |= Mask;
+ return (EFI_QUESTION_ID)((Index << EFI_BITS_SHIFT_PER_UINT32) + Offset);
+ }
+ }
+
+ return EFI_QUESTION_ID_INVALID;
+}
+
+BOOLEAN
+CVfrQuestionDB::ChekQuestionIdFree (
+ IN EFI_QUESTION_ID QId
+ )
+{
+ UINT32 Index = (QId / EFI_BITS_PER_UINT32);
+ UINT32 Offset = (QId % EFI_BITS_PER_UINT32);
+
+ return (mFreeQIdBitMap[Index] & (0x80000000 >> Offset)) == 0;
+}
+
+VOID
+CVfrQuestionDB::MarkQuestionIdUsed (
+ IN EFI_QUESTION_ID QId
+ )
+{
+ UINT32 Index = (QId / EFI_BITS_PER_UINT32);
+ UINT32 Offset = (QId % EFI_BITS_PER_UINT32);
+
+ mFreeQIdBitMap[Index] |= (0x80000000 >> Offset);
+}
+
+VOID
+CVfrQuestionDB::MarkQuestionIdUnused (
+ IN EFI_QUESTION_ID QId
+ )
+{
+ UINT32 Index = (QId / EFI_BITS_PER_UINT32);
+ UINT32 Offset = (QId % EFI_BITS_PER_UINT32);
+
+ mFreeQIdBitMap[Index] &= ~(0x80000000 >> Offset);
+}
+
+SVfrQuestionNode::SVfrQuestionNode (
+ IN CHAR8 *Name,
+ IN CHAR8 *VarIdStr,
+ IN UINT32 BitMask
+ )
+{
+ mName = NULL;
+ mVarIdStr = NULL;
+ mQuestionId = EFI_QUESTION_ID_INVALID;
+ mBitMask = BitMask;
+ mNext = NULL;
+ mQtype = QUESTION_NORMAL;
+
+ if (Name == NULL) {
+ mName = new CHAR8[strlen ("$DEFAULT") + 1];
+ strcpy (mName, "$DEFAULT");
+ } else {
+ mName = new CHAR8[strlen (Name) + 1];
+ strcpy (mName, Name);
+ }
+
+ if (VarIdStr != NULL) {
+ mVarIdStr = new CHAR8[strlen (VarIdStr) + 1];
+ strcpy (mVarIdStr, VarIdStr);
+ } else {
+ mVarIdStr = new CHAR8[strlen ("$") + 1];
+ strcpy (mVarIdStr, "$");
+ }
+}
+
+SVfrQuestionNode::~SVfrQuestionNode (
+ VOID
+ )
+{
+ if (mName != NULL) {
+ delete[] mName;
+ }
+
+ if (mVarIdStr != NULL) {
+ delete[] mVarIdStr;
+ }
+}
+
+CVfrQuestionDB::CVfrQuestionDB ()
+{
+ UINT32 Index;
+
+ for (Index = 0; Index < EFI_FREE_QUESTION_ID_BITMAP_SIZE; Index++) {
+ mFreeQIdBitMap[Index] = 0;
+ }
+
+ // Question ID 0 is reserved.
+ mFreeQIdBitMap[0] = 0x80000000;
+ mQuestionList = NULL;
+}
+
+CVfrQuestionDB::~CVfrQuestionDB ()
+{
+ SVfrQuestionNode *pNode;
+
+ while (mQuestionList != NULL) {
+ pNode = mQuestionList;
+ mQuestionList = mQuestionList->mNext;
+ delete pNode;
+ }
+}
+
+//
+// Reset to init state
+//
+VOID
+CVfrQuestionDB::ResetInit(
+ IN VOID
+ )
+{
+ UINT32 Index;
+ SVfrQuestionNode *pNode;
+
+ while (mQuestionList != NULL) {
+ pNode = mQuestionList;
+ mQuestionList = mQuestionList->mNext;
+ delete pNode;
+ }
+
+ for (Index = 0; Index < EFI_FREE_QUESTION_ID_BITMAP_SIZE; Index++) {
+ mFreeQIdBitMap[Index] = 0;
+ }
+
+ // Question ID 0 is reserved.
+ mFreeQIdBitMap[0] = 0x80000000;
+ mQuestionList = NULL;
+}
+
+VOID
+CVfrQuestionDB::PrintAllQuestion (
+ VOID
+ )
+{
+ SVfrQuestionNode *pNode = NULL;
+
+ for (pNode = mQuestionList; pNode != NULL; pNode = pNode->mNext) {
+ printf ("Question VarId is %s and QuestionId is 0x%x\n", pNode->mVarIdStr, pNode->mQuestionId);
+ }
+}
+
+EFI_VFR_RETURN_CODE
+CVfrQuestionDB::RegisterQuestion (
+ IN CHAR8 *Name,
+ IN CHAR8 *VarIdStr,
+ IN OUT EFI_QUESTION_ID &QuestionId
+ )
+{
+ SVfrQuestionNode *pNode = NULL;
+
+ if ((Name != NULL) && (FindQuestion(Name) == VFR_RETURN_SUCCESS)) {
+ return VFR_RETURN_REDEFINED;
+ }
+
+ if ((pNode = new SVfrQuestionNode (Name, VarIdStr)) == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+
+ if (QuestionId == EFI_QUESTION_ID_INVALID) {
+ QuestionId = GetFreeQuestionId ();
+ } else {
+ if (ChekQuestionIdFree (QuestionId) == FALSE) {
+ delete pNode;
+ return VFR_RETURN_QUESTIONID_REDEFINED;
+ }
+ MarkQuestionIdUsed (QuestionId);
+ }
+ pNode->mQuestionId = QuestionId;
+
+ pNode->mNext = mQuestionList;
+ mQuestionList = pNode;
+
+ gCFormPkg.DoPendingAssign (VarIdStr, (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+
+ return VFR_RETURN_SUCCESS;
+}
+
+VOID
+CVfrQuestionDB::RegisterOldDateQuestion (
+ IN CHAR8 *YearVarId,
+ IN CHAR8 *MonthVarId,
+ IN CHAR8 *DayVarId,
+ IN OUT EFI_QUESTION_ID &QuestionId
+ )
+{
+ SVfrQuestionNode *pNode[3] = {NULL, };
+ UINT32 Index;
+
+ if ((YearVarId == NULL) || (MonthVarId == NULL) || (DayVarId == NULL)) {
+ return;
+ }
+
+ if ((pNode[0] = new SVfrQuestionNode (NULL, YearVarId, DATE_YEAR_BITMASK)) == NULL) {
+ goto Err;
+ }
+ if ((pNode[1] = new SVfrQuestionNode (NULL, MonthVarId, DATE_MONTH_BITMASK)) == NULL) {
+ goto Err;
+ }
+ if ((pNode[2] = new SVfrQuestionNode (NULL, DayVarId, DATE_DAY_BITMASK)) == NULL) {
+ goto Err;
+ }
+
+ if (QuestionId == EFI_QUESTION_ID_INVALID) {
+ QuestionId = GetFreeQuestionId ();
+ } else {
+ if (ChekQuestionIdFree (QuestionId) == FALSE) {
+ goto Err;
+ }
+ MarkQuestionIdUsed (QuestionId);
+ }
+
+ pNode[0]->mQuestionId = QuestionId;
+ pNode[1]->mQuestionId = QuestionId;
+ pNode[2]->mQuestionId = QuestionId;
+ pNode[0]->mQtype = QUESTION_DATE;
+ pNode[1]->mQtype = QUESTION_DATE;
+ pNode[2]->mQtype = QUESTION_DATE;
+ pNode[0]->mNext = pNode[1];
+ pNode[1]->mNext = pNode[2];
+ pNode[2]->mNext = mQuestionList;
+ mQuestionList = pNode[0];
+
+ gCFormPkg.DoPendingAssign (YearVarId, (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (MonthVarId, (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (DayVarId, (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+
+ return;
+
+Err:
+ for (Index = 0; Index < 3; Index++) {
+ if (pNode[Index] != NULL) {
+ delete pNode[Index];
+ }
+ }
+ QuestionId = EFI_QUESTION_ID_INVALID;
+}
+
+VOID
+CVfrQuestionDB::RegisterNewDateQuestion (
+ IN CHAR8 *Name,
+ IN CHAR8 *BaseVarId,
+ IN OUT EFI_QUESTION_ID &QuestionId
+ )
+{
+ SVfrQuestionNode *pNode[3] = {NULL, };
+ UINT32 Len;
+ CHAR8 *VarIdStr[3] = {NULL, };
+ CHAR8 Index;
+
+ if (BaseVarId == NULL && Name == NULL) {
+ if (QuestionId == EFI_QUESTION_ID_INVALID) {
+ QuestionId = GetFreeQuestionId ();
+ } else {
+ if (ChekQuestionIdFree (QuestionId) == FALSE) {
+ goto Err;
+ }
+ MarkQuestionIdUsed (QuestionId);
+ }
+ return;
+ }
+
+ if (BaseVarId != NULL) {
+ Len = strlen (BaseVarId);
+
+ VarIdStr[0] = new CHAR8[Len + strlen (".Year") + 1];
+ if (VarIdStr[0] != NULL) {
+ strcpy (VarIdStr[0], BaseVarId);
+ strcat (VarIdStr[0], ".Year");
+ }
+ VarIdStr[1] = new CHAR8[Len + strlen (".Month") + 1];
+ if (VarIdStr[1] != NULL) {
+ strcpy (VarIdStr[1], BaseVarId);
+ strcat (VarIdStr[1], ".Month");
+ }
+ VarIdStr[2] = new CHAR8[Len + strlen (".Day") + 1];
+ if (VarIdStr[2] != NULL) {
+ strcpy (VarIdStr[2], BaseVarId);
+ strcat (VarIdStr[2], ".Day");
+ }
+ } else {
+ Len = strlen (Name);
+
+ VarIdStr[0] = new CHAR8[Len + strlen (".Year") + 1];
+ if (VarIdStr[0] != NULL) {
+ strcpy (VarIdStr[0], Name);
+ strcat (VarIdStr[0], ".Year");
+ }
+ VarIdStr[1] = new CHAR8[Len + strlen (".Month") + 1];
+ if (VarIdStr[1] != NULL) {
+ strcpy (VarIdStr[1], Name);
+ strcat (VarIdStr[1], ".Month");
+ }
+ VarIdStr[2] = new CHAR8[Len + strlen (".Day") + 1];
+ if (VarIdStr[2] != NULL) {
+ strcpy (VarIdStr[2], Name);
+ strcat (VarIdStr[2], ".Day");
+ }
+ }
+
+ if ((pNode[0] = new SVfrQuestionNode (Name, VarIdStr[0], DATE_YEAR_BITMASK)) == NULL) {
+ goto Err;
+ }
+ if ((pNode[1] = new SVfrQuestionNode (Name, VarIdStr[1], DATE_MONTH_BITMASK)) == NULL) {
+ goto Err;
+ }
+ if ((pNode[2] = new SVfrQuestionNode (Name, VarIdStr[2], DATE_DAY_BITMASK)) == NULL) {
+ goto Err;
+ }
+
+ if (QuestionId == EFI_QUESTION_ID_INVALID) {
+ QuestionId = GetFreeQuestionId ();
+ } else {
+ if (ChekQuestionIdFree (QuestionId) == FALSE) {
+ goto Err;
+ }
+ MarkQuestionIdUsed (QuestionId);
+ }
+
+ pNode[0]->mQuestionId = QuestionId;
+ pNode[1]->mQuestionId = QuestionId;
+ pNode[2]->mQuestionId = QuestionId;
+ pNode[0]->mQtype = QUESTION_DATE;
+ pNode[1]->mQtype = QUESTION_DATE;
+ pNode[2]->mQtype = QUESTION_DATE;
+ pNode[0]->mNext = pNode[1];
+ pNode[1]->mNext = pNode[2];
+ pNode[2]->mNext = mQuestionList;
+ mQuestionList = pNode[0];
+
+ for (Index = 0; Index < 3; Index++) {
+ if (VarIdStr[Index] != NULL) {
+ delete[] VarIdStr[Index];
+ VarIdStr[Index] = NULL;
+ }
+ }
+
+ gCFormPkg.DoPendingAssign (VarIdStr[0], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (VarIdStr[1], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (VarIdStr[2], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+
+ return;
+
+Err:
+ for (Index = 0; Index < 3; Index++) {
+ if (pNode[Index] != NULL) {
+ delete pNode[Index];
+ }
+
+ if (VarIdStr[Index] != NULL) {
+ delete[] VarIdStr [Index];
+ VarIdStr [Index] = NULL;
+ }
+ }
+}
+
+VOID
+CVfrQuestionDB::RegisterOldTimeQuestion (
+ IN CHAR8 *HourVarId,
+ IN CHAR8 *MinuteVarId,
+ IN CHAR8 *SecondVarId,
+ IN OUT EFI_QUESTION_ID &QuestionId
+ )
+{
+ SVfrQuestionNode *pNode[3] = {NULL, };
+ UINT32 Index;
+
+ if ((HourVarId == NULL) || (MinuteVarId == NULL) || (SecondVarId == NULL)) {
+ return;
+ }
+
+ if ((pNode[0] = new SVfrQuestionNode (NULL, HourVarId, TIME_HOUR_BITMASK)) == NULL) {
+ goto Err;
+ }
+ if ((pNode[1] = new SVfrQuestionNode (NULL, MinuteVarId, TIME_MINUTE_BITMASK)) == NULL) {
+ goto Err;
+ }
+ if ((pNode[2] = new SVfrQuestionNode (NULL, SecondVarId, TIME_SECOND_BITMASK)) == NULL) {
+ goto Err;
+ }
+
+ if (QuestionId == EFI_QUESTION_ID_INVALID) {
+ QuestionId = GetFreeQuestionId ();
+ } else {
+ if (ChekQuestionIdFree (QuestionId) == FALSE) {
+ goto Err;
+ }
+ MarkQuestionIdUsed (QuestionId);
+ }
+
+ pNode[0]->mQuestionId = QuestionId;
+ pNode[1]->mQuestionId = QuestionId;
+ pNode[2]->mQuestionId = QuestionId;
+ pNode[0]->mQtype = QUESTION_TIME;
+ pNode[1]->mQtype = QUESTION_TIME;
+ pNode[2]->mQtype = QUESTION_TIME;
+ pNode[0]->mNext = pNode[1];
+ pNode[1]->mNext = pNode[2];
+ pNode[2]->mNext = mQuestionList;
+ mQuestionList = pNode[0];
+
+ gCFormPkg.DoPendingAssign (HourVarId, (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (MinuteVarId, (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (SecondVarId, (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+
+ return;
+
+Err:
+ for (Index = 0; Index < 3; Index++) {
+ if (pNode[Index] != NULL) {
+ delete pNode[Index];
+ }
+ }
+ QuestionId = EFI_QUESTION_ID_INVALID;
+}
+
+VOID
+CVfrQuestionDB::RegisterNewTimeQuestion (
+ IN CHAR8 *Name,
+ IN CHAR8 *BaseVarId,
+ IN OUT EFI_QUESTION_ID &QuestionId
+ )
+{
+ SVfrQuestionNode *pNode[3] = {NULL, };
+ UINT32 Len;
+ CHAR8 *VarIdStr[3] = {NULL, };
+ CHAR8 Index;
+
+ if (BaseVarId == NULL && Name == NULL) {
+ if (QuestionId == EFI_QUESTION_ID_INVALID) {
+ QuestionId = GetFreeQuestionId ();
+ } else {
+ if (ChekQuestionIdFree (QuestionId) == FALSE) {
+ goto Err;
+ }
+ MarkQuestionIdUsed (QuestionId);
+ }
+ return;
+ }
+
+ if (BaseVarId != NULL) {
+ Len = strlen (BaseVarId);
+
+ VarIdStr[0] = new CHAR8[Len + strlen (".Hour") + 1];
+ if (VarIdStr[0] != NULL) {
+ strcpy (VarIdStr[0], BaseVarId);
+ strcat (VarIdStr[0], ".Hour");
+ }
+ VarIdStr[1] = new CHAR8[Len + strlen (".Minute") + 1];
+ if (VarIdStr[1] != NULL) {
+ strcpy (VarIdStr[1], BaseVarId);
+ strcat (VarIdStr[1], ".Minute");
+ }
+ VarIdStr[2] = new CHAR8[Len + strlen (".Second") + 1];
+ if (VarIdStr[2] != NULL) {
+ strcpy (VarIdStr[2], BaseVarId);
+ strcat (VarIdStr[2], ".Second");
+ }
+ } else {
+ Len = strlen (Name);
+
+ VarIdStr[0] = new CHAR8[Len + strlen (".Hour") + 1];
+ if (VarIdStr[0] != NULL) {
+ strcpy (VarIdStr[0], Name);
+ strcat (VarIdStr[0], ".Hour");
+ }
+ VarIdStr[1] = new CHAR8[Len + strlen (".Minute") + 1];
+ if (VarIdStr[1] != NULL) {
+ strcpy (VarIdStr[1], Name);
+ strcat (VarIdStr[1], ".Minute");
+ }
+ VarIdStr[2] = new CHAR8[Len + strlen (".Second") + 1];
+ if (VarIdStr[2] != NULL) {
+ strcpy (VarIdStr[2], Name);
+ strcat (VarIdStr[2], ".Second");
+ }
+ }
+
+ if ((pNode[0] = new SVfrQuestionNode (Name, VarIdStr[0], TIME_HOUR_BITMASK)) == NULL) {
+ goto Err;
+ }
+ if ((pNode[1] = new SVfrQuestionNode (Name, VarIdStr[1], TIME_MINUTE_BITMASK)) == NULL) {
+ goto Err;
+ }
+ if ((pNode[2] = new SVfrQuestionNode (Name, VarIdStr[2], TIME_SECOND_BITMASK)) == NULL) {
+ goto Err;
+ }
+
+ if (QuestionId == EFI_QUESTION_ID_INVALID) {
+ QuestionId = GetFreeQuestionId ();
+ } else {
+ if (ChekQuestionIdFree (QuestionId) == FALSE) {
+ goto Err;
+ }
+ MarkQuestionIdUsed (QuestionId);
+ }
+
+ pNode[0]->mQuestionId = QuestionId;
+ pNode[1]->mQuestionId = QuestionId;
+ pNode[2]->mQuestionId = QuestionId;
+ pNode[0]->mQtype = QUESTION_TIME;
+ pNode[1]->mQtype = QUESTION_TIME;
+ pNode[2]->mQtype = QUESTION_TIME;
+ pNode[0]->mNext = pNode[1];
+ pNode[1]->mNext = pNode[2];
+ pNode[2]->mNext = mQuestionList;
+ mQuestionList = pNode[0];
+
+ for (Index = 0; Index < 3; Index++) {
+ if (VarIdStr[Index] != NULL) {
+ delete[] VarIdStr[Index];
+ VarIdStr[Index] = NULL;
+ }
+ }
+
+ gCFormPkg.DoPendingAssign (VarIdStr[0], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (VarIdStr[1], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (VarIdStr[2], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+
+ return;
+
+Err:
+ for (Index = 0; Index < 3; Index++) {
+ if (pNode[Index] != NULL) {
+ delete pNode[Index];
+ }
+
+ if (VarIdStr[Index] != NULL) {
+ delete[] VarIdStr[Index];
+ VarIdStr[Index] = NULL;
+ }
+ }
+}
+
+VOID
+CVfrQuestionDB::RegisterRefQuestion (
+ IN CHAR8 *Name,
+ IN CHAR8 *BaseVarId,
+ IN OUT EFI_QUESTION_ID &QuestionId
+ )
+{
+ SVfrQuestionNode *pNode[4] = {NULL, };
+ UINT32 Len;
+ CHAR8 *VarIdStr[4] = {NULL, };
+ CHAR8 Index;
+
+ if (BaseVarId == NULL && Name == NULL) {
+ return;
+ }
+
+ if (BaseVarId != NULL) {
+ Len = strlen (BaseVarId);
+
+ VarIdStr[0] = new CHAR8[Len + strlen (".QuestionId") + 1];
+ if (VarIdStr[0] != NULL) {
+ strcpy (VarIdStr[0], BaseVarId);
+ strcat (VarIdStr[0], ".QuestionId");
+ }
+ VarIdStr[1] = new CHAR8[Len + strlen (".FormId") + 1];
+ if (VarIdStr[1] != NULL) {
+ strcpy (VarIdStr[1], BaseVarId);
+ strcat (VarIdStr[1], ".FormId");
+ }
+ VarIdStr[2] = new CHAR8[Len + strlen (".FormSetGuid") + 1];
+ if (VarIdStr[2] != NULL) {
+ strcpy (VarIdStr[2], BaseVarId);
+ strcat (VarIdStr[2], ".FormSetGuid");
+ }
+ VarIdStr[3] = new CHAR8[Len + strlen (".DevicePath") + 1];
+ if (VarIdStr[3] != NULL) {
+ strcpy (VarIdStr[3], BaseVarId);
+ strcat (VarIdStr[3], ".DevicePath");
+ }
+ } else {
+ Len = strlen (Name);
+
+ VarIdStr[0] = new CHAR8[Len + strlen (".QuestionId") + 1];
+ if (VarIdStr[0] != NULL) {
+ strcpy (VarIdStr[0], Name);
+ strcat (VarIdStr[0], ".QuestionId");
+ }
+ VarIdStr[1] = new CHAR8[Len + strlen (".FormId") + 1];
+ if (VarIdStr[1] != NULL) {
+ strcpy (VarIdStr[1], Name);
+ strcat (VarIdStr[1], ".FormId");
+ }
+ VarIdStr[2] = new CHAR8[Len + strlen (".FormSetGuid") + 1];
+ if (VarIdStr[2] != NULL) {
+ strcpy (VarIdStr[2], Name);
+ strcat (VarIdStr[2], ".FormSetGuid");
+ }
+ VarIdStr[3] = new CHAR8[Len + strlen (".DevicePath") + 1];
+ if (VarIdStr[3] != NULL) {
+ strcpy (VarIdStr[3], Name);
+ strcat (VarIdStr[3], ".DevicePath");
+ }
+ }
+
+ if ((pNode[0] = new SVfrQuestionNode (Name, VarIdStr[0])) == NULL) {
+ goto Err;
+ }
+ if ((pNode[1] = new SVfrQuestionNode (Name, VarIdStr[1])) == NULL) {
+ goto Err;
+ }
+ if ((pNode[2] = new SVfrQuestionNode (Name, VarIdStr[2])) == NULL) {
+ goto Err;
+ }
+ if ((pNode[3] = new SVfrQuestionNode (Name, VarIdStr[3])) == NULL) {
+ goto Err;
+ }
+
+ if (QuestionId == EFI_QUESTION_ID_INVALID) {
+ QuestionId = GetFreeQuestionId ();
+ } else {
+ if (ChekQuestionIdFree (QuestionId) == FALSE) {
+ goto Err;
+ }
+ MarkQuestionIdUsed (QuestionId);
+ }
+
+ pNode[0]->mQuestionId = QuestionId;
+ pNode[1]->mQuestionId = QuestionId;
+ pNode[2]->mQuestionId = QuestionId;
+ pNode[3]->mQuestionId = QuestionId;
+ pNode[0]->mQtype = QUESTION_REF;
+ pNode[1]->mQtype = QUESTION_REF;
+ pNode[2]->mQtype = QUESTION_REF;
+ pNode[3]->mQtype = QUESTION_REF;
+ pNode[0]->mNext = pNode[1];
+ pNode[1]->mNext = pNode[2];
+ pNode[2]->mNext = pNode[3];
+ pNode[3]->mNext = mQuestionList;
+ mQuestionList = pNode[0];
+
+ gCFormPkg.DoPendingAssign (VarIdStr[0], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (VarIdStr[1], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (VarIdStr[2], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+ gCFormPkg.DoPendingAssign (VarIdStr[3], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
+
+ return;
+
+ Err:
+ for (Index = 0; Index < 4; Index++) {
+ if (pNode[Index] != NULL) {
+ delete pNode[Index];
+ }
+
+ if (VarIdStr[Index] != NULL) {
+ delete VarIdStr[Index];
+ }
+ }
+}
+
+EFI_VFR_RETURN_CODE
+CVfrQuestionDB::UpdateQuestionId (
+ IN EFI_QUESTION_ID QId,
+ IN EFI_QUESTION_ID NewQId
+ )
+{
+ SVfrQuestionNode *pNode = NULL;
+
+ if (QId == NewQId) {
+ // don't update
+ return VFR_RETURN_SUCCESS;
+ }
+
+ if (ChekQuestionIdFree (NewQId) == FALSE) {
+ return VFR_RETURN_REDEFINED;
+ }
+
+ for (pNode = mQuestionList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mQuestionId == QId) {
+ break;
+ }
+ }
+
+ if (pNode == NULL) {
+ return VFR_RETURN_UNDEFINED;
+ }
+
+ MarkQuestionIdUnused (QId);
+ pNode->mQuestionId = NewQId;
+ MarkQuestionIdUsed (NewQId);
+
+ gCFormPkg.DoPendingAssign (pNode->mVarIdStr, (VOID *)&NewQId, sizeof(EFI_QUESTION_ID));
+
+ return VFR_RETURN_SUCCESS;
+}
+
+VOID
+CVfrQuestionDB::GetQuestionId (
+ IN CHAR8 *Name,
+ IN CHAR8 *VarIdStr,
+ OUT EFI_QUESTION_ID &QuestionId,
+ OUT UINT32 &BitMask,
+ OUT EFI_QUESION_TYPE *QType
+ )
+{
+ SVfrQuestionNode *pNode;
+
+ QuestionId = EFI_QUESTION_ID_INVALID;
+ BitMask = 0x00000000;
+ if (QType != NULL) {
+ *QType = QUESTION_NORMAL;
+ }
+
+ if ((Name == NULL) && (VarIdStr == NULL)) {
+ return ;
+ }
+
+ for (pNode = mQuestionList; pNode != NULL; pNode = pNode->mNext) {
+ if (Name != NULL) {
+ if (strcmp (pNode->mName, Name) != 0) {
+ continue;
+ }
+ }
+
+ if (VarIdStr != NULL) {
+ if (strcmp (pNode->mVarIdStr, VarIdStr) != 0) {
+ continue;
+ }
+ }
+
+ QuestionId = pNode->mQuestionId;
+ BitMask = pNode->mBitMask;
+ if (QType != NULL) {
+ *QType = pNode->mQtype;
+ }
+ break;
+ }
+
+ return ;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrQuestionDB::FindQuestion (
+ IN EFI_QUESTION_ID QuestionId
+ )
+{
+ SVfrQuestionNode *pNode;
+
+ if (QuestionId == EFI_QUESTION_ID_INVALID) {
+ return VFR_RETURN_INVALID_PARAMETER;
+ }
+
+ for (pNode = mQuestionList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mQuestionId == QuestionId) {
+ return VFR_RETURN_SUCCESS;
+ }
+ }
+
+ return VFR_RETURN_UNDEFINED;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrQuestionDB::FindQuestion (
+ IN CHAR8 *Name
+ )
+{
+ SVfrQuestionNode *pNode;
+
+ if (Name == NULL) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ for (pNode = mQuestionList; pNode != NULL; pNode = pNode->mNext) {
+ if (strcmp (pNode->mName, Name) == 0) {
+ return VFR_RETURN_SUCCESS;
+ }
+ }
+
+ return VFR_RETURN_UNDEFINED;
+}
+
+CVfrStringDB::CVfrStringDB ()
+{
+ mStringFileName = NULL;
+}
+
+CVfrStringDB::~CVfrStringDB ()
+{
+ if (mStringFileName != NULL) {
+ delete[] mStringFileName;
+ }
+ mStringFileName = NULL;
+}
+
+
+VOID
+CVfrStringDB::SetStringFileName(IN CHAR8 *StringFileName)
+{
+ UINT32 FileLen = 0;
+
+ if (StringFileName == NULL) {
+ return;
+ }
+
+ if (mStringFileName != NULL) {
+ delete[] mStringFileName;
+ }
+
+ FileLen = strlen (StringFileName) + 1;
+ mStringFileName = new CHAR8[FileLen];
+ if (mStringFileName == NULL) {
+ return;
+ }
+
+ strcpy (mStringFileName, StringFileName);
+ mStringFileName[FileLen - 1] = '\0';
+}
+
+
+/**
+ Returns TRUE or FALSE whether SupportedLanguages contains the best matching language
+ from a set of supported languages.
+
+ @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that
+ contains a set of language codes.
+ @param[in] Language A variable that contains pointers to Null-terminated
+ ASCII strings that contain one language codes.
+
+ @retval FALSE The best matching language could not be found in SupportedLanguages.
+ @retval TRUE The best matching language could be found in SupportedLanguages.
+
+**/
+BOOLEAN
+CVfrStringDB::GetBestLanguage (
+ IN CONST CHAR8 *SupportedLanguages,
+ IN CHAR8 *Language
+ )
+{
+ UINTN CompareLength;
+ UINTN LanguageLength;
+ CONST CHAR8 *Supported;
+
+ if (SupportedLanguages == NULL || Language == NULL){
+ return FALSE;
+ }
+
+ //
+ // Determine the length of the first RFC 4646 language code in Language
+ //
+ for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++);
+
+ //
+ // Trim back the length of Language used until it is empty
+ //
+ while (LanguageLength > 0) {
+ //
+ // Loop through all language codes in SupportedLanguages
+ //
+ for (Supported = SupportedLanguages; *Supported != '\0'; Supported += CompareLength) {
+ //
+ // Skip ';' characters in Supported
+ //
+ for (; *Supported != '\0' && *Supported == ';'; Supported++);
+ //
+ // Determine the length of the next language code in Supported
+ //
+ for (CompareLength = 0; Supported[CompareLength] != 0 && Supported[CompareLength] != ';'; CompareLength++);
+ //
+ // If Language is longer than the Supported, then skip to the next language
+ //
+ if (LanguageLength > CompareLength) {
+ continue;
+ }
+
+ //
+ // See if the first LanguageLength characters in Supported match Language
+ //
+ if (strncmp (Supported, Language, LanguageLength) == 0) {
+ return TRUE;
+ }
+ }
+
+ //
+ // Trim Language from the right to the next '-' character
+ //
+ for (LanguageLength--; LanguageLength > 0 && Language[LanguageLength] != '-'; LanguageLength--);
+ }
+
+ //
+ // No matches were found
+ //
+ return FALSE;
+}
+
+
+CHAR8 *
+CVfrStringDB::GetVarStoreNameFormStringId (
+ IN EFI_STRING_ID StringId
+ )
+{
+ FILE *pInFile = NULL;
+ UINT32 NameOffset;
+ UINT32 Length;
+ UINT8 *StringPtr;
+ CHAR8 *StringName;
+ CHAR16 *UnicodeString;
+ CHAR8 *VarStoreName = NULL;
+ CHAR8 *DestTmp;
+ UINT8 *Current;
+ EFI_STATUS Status;
+ CHAR8 LineBuf[EFI_IFR_MAX_LENGTH];
+ UINT8 BlockType;
+ EFI_HII_STRING_PACKAGE_HDR *PkgHeader;
+
+ if (mStringFileName == NULL) {
+ return NULL;
+ }
+
+ if ((pInFile = fopen (LongFilePath (mStringFileName), "rb")) == NULL) {
+ return NULL;
+ }
+
+ //
+ // Get file length.
+ //
+ fseek (pInFile, 0, SEEK_END);
+ Length = ftell (pInFile);
+ fseek (pInFile, 0, SEEK_SET);
+
+ //
+ // Get file data.
+ //
+ StringPtr = new UINT8[Length];
+ if (StringPtr == NULL) {
+ fclose (pInFile);
+ return NULL;
+ }
+ fread ((char *)StringPtr, sizeof (UINT8), Length, pInFile);
+ fclose (pInFile);
+
+ PkgHeader = (EFI_HII_STRING_PACKAGE_HDR *) StringPtr;
+ //
+ // Check the String package.
+ //
+ if (PkgHeader->Header.Type != EFI_HII_PACKAGE_STRINGS) {
+ delete[] StringPtr;
+ return NULL;
+ }
+
+ //
+ // Search the language, get best language base on RFC 4647 matching algorithm.
+ //
+ Current = StringPtr;
+ while (!GetBestLanguage ("en", PkgHeader->Language)) {
+ Current += PkgHeader->Header.Length;
+ PkgHeader = (EFI_HII_STRING_PACKAGE_HDR *) Current;
+ //
+ // If can't find string package base on language, just return the first string package.
+ //
+ if (Current - StringPtr >= Length) {
+ Current = StringPtr;
+ PkgHeader = (EFI_HII_STRING_PACKAGE_HDR *) StringPtr;
+ break;
+ }
+ }
+
+ Current += PkgHeader->HdrSize;
+ //
+ // Find the string block according the stringId.
+ //
+ Status = FindStringBlock(Current, StringId, &NameOffset, &BlockType);
+ if (Status != EFI_SUCCESS) {
+ delete[] StringPtr;
+ return NULL;
+ }
+
+ //
+ // Get varstore name according the string type.
+ //
+ switch (BlockType) {
+ case EFI_HII_SIBT_STRING_SCSU:
+ case EFI_HII_SIBT_STRING_SCSU_FONT:
+ case EFI_HII_SIBT_STRINGS_SCSU:
+ case EFI_HII_SIBT_STRINGS_SCSU_FONT:
+ StringName = (CHAR8*)(Current + NameOffset);
+ VarStoreName = new CHAR8[strlen(StringName) + 1];
+ strcpy (VarStoreName, StringName);
+ break;
+ case EFI_HII_SIBT_STRING_UCS2:
+ case EFI_HII_SIBT_STRING_UCS2_FONT:
+ case EFI_HII_SIBT_STRINGS_UCS2:
+ case EFI_HII_SIBT_STRINGS_UCS2_FONT:
+ UnicodeString = (CHAR16*)(Current + NameOffset);
+ Length = GetUnicodeStringTextSize ((UINT8*)UnicodeString) ;
+ DestTmp = new CHAR8[Length / 2 + 1];
+ VarStoreName = DestTmp;
+ while (*UnicodeString != '\0') {
+ *(DestTmp++) = (CHAR8) *(UnicodeString++);
+ }
+ *DestTmp = '\0';
+ break;
+ default:
+ break;
+ }
+
+ delete[] StringPtr;
+
+ return VarStoreName;
+}
+
+EFI_STATUS
+CVfrStringDB::FindStringBlock (
+ IN UINT8 *StringData,
+ IN EFI_STRING_ID StringId,
+ OUT UINT32 *StringTextOffset,
+ OUT UINT8 *BlockType
+ )
+{
+ UINT8 *BlockHdr;
+ EFI_STRING_ID CurrentStringId;
+ UINT32 BlockSize;
+ UINT32 Index;
+ UINT8 *StringTextPtr;
+ UINT32 Offset;
+ UINT16 StringCount;
+ UINT16 SkipCount;
+ UINT8 Length8;
+ EFI_HII_SIBT_EXT2_BLOCK Ext2;
+ UINT32 Length32;
+ UINT32 StringSize;
+
+ CurrentStringId = 1;
+
+ //
+ // Parse the string blocks to get the string text and font.
+ //
+ BlockHdr = StringData;
+ BlockSize = 0;
+ Offset = 0;
+ while (*BlockHdr != EFI_HII_SIBT_END) {
+ switch (*BlockHdr) {
+ case EFI_HII_SIBT_STRING_SCSU:
+ Offset = sizeof (EFI_HII_STRING_BLOCK);
+ StringTextPtr = BlockHdr + Offset;
+ BlockSize += Offset + strlen ((CHAR8 *) StringTextPtr) + 1;
+ CurrentStringId++;
+ break;
+
+ case EFI_HII_SIBT_STRING_SCSU_FONT:
+ Offset = sizeof (EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK) - sizeof (UINT8);
+ StringTextPtr = BlockHdr + Offset;
+ BlockSize += Offset + strlen ((CHAR8 *) StringTextPtr) + 1;
+ CurrentStringId++;
+ break;
+
+ case EFI_HII_SIBT_STRINGS_SCSU:
+ memcpy (&StringCount, BlockHdr + sizeof (EFI_HII_STRING_BLOCK), sizeof (UINT16));
+ StringTextPtr = BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_BLOCK) - sizeof (UINT8);
+ BlockSize += StringTextPtr - BlockHdr;
+
+ for (Index = 0; Index < StringCount; Index++) {
+ BlockSize += strlen ((CHAR8 *) StringTextPtr) + 1;
+ if (CurrentStringId == StringId) {
+ *BlockType = *BlockHdr;
+ *StringTextOffset = StringTextPtr - StringData;
+ return EFI_SUCCESS;
+ }
+ StringTextPtr = StringTextPtr + strlen ((CHAR8 *) StringTextPtr) + 1;
+ CurrentStringId++;
+ }
+ break;
+
+ case EFI_HII_SIBT_STRINGS_SCSU_FONT:
+ memcpy (
+ &StringCount,
+ BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ sizeof (UINT16)
+ );
+ StringTextPtr = BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK) - sizeof (UINT8);
+ BlockSize += StringTextPtr - BlockHdr;
+
+ for (Index = 0; Index < StringCount; Index++) {
+ BlockSize += strlen ((CHAR8 *) StringTextPtr) + 1;
+ if (CurrentStringId == StringId) {
+ *BlockType = *BlockHdr;
+ *StringTextOffset = StringTextPtr - StringData;
+ return EFI_SUCCESS;
+ }
+ StringTextPtr = StringTextPtr + strlen ((CHAR8 *) StringTextPtr) + 1;
+ CurrentStringId++;
+ }
+ break;
+
+ case EFI_HII_SIBT_STRING_UCS2:
+ Offset = sizeof (EFI_HII_STRING_BLOCK);
+ StringTextPtr = BlockHdr + Offset;
+ //
+ // Use StringSize to store the size of the specified string, including the NULL
+ // terminator.
+ //
+ StringSize = GetUnicodeStringTextSize (StringTextPtr);
+ BlockSize += Offset + StringSize;
+ CurrentStringId++;
+ break;
+
+ case EFI_HII_SIBT_STRING_UCS2_FONT:
+ Offset = sizeof (EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK) - sizeof (CHAR16);
+ StringTextPtr = BlockHdr + Offset;
+ //
+ // Use StrSize to store the size of the specified string, including the NULL
+ // terminator.
+ //
+ StringSize = GetUnicodeStringTextSize (StringTextPtr);
+ BlockSize += Offset + StringSize;
+ CurrentStringId++;
+ break;
+
+ case EFI_HII_SIBT_STRINGS_UCS2:
+ Offset = sizeof (EFI_HII_SIBT_STRINGS_UCS2_BLOCK) - sizeof (CHAR16);
+ StringTextPtr = BlockHdr + Offset;
+ BlockSize += Offset;
+ memcpy (&StringCount, BlockHdr + sizeof (EFI_HII_STRING_BLOCK), sizeof (UINT16));
+ for (Index = 0; Index < StringCount; Index++) {
+ StringSize = GetUnicodeStringTextSize (StringTextPtr);
+ BlockSize += StringSize;
+ if (CurrentStringId == StringId) {
+ *BlockType = *BlockHdr;
+ *StringTextOffset = StringTextPtr - StringData;
+ return EFI_SUCCESS;
+ }
+ StringTextPtr = StringTextPtr + StringSize;
+ CurrentStringId++;
+ }
+ break;
+
+ case EFI_HII_SIBT_STRINGS_UCS2_FONT:
+ Offset = sizeof (EFI_HII_SIBT_STRINGS_UCS2_FONT_BLOCK) - sizeof (CHAR16);
+ StringTextPtr = BlockHdr + Offset;
+ BlockSize += Offset;
+ memcpy (
+ &StringCount,
+ BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ sizeof (UINT16)
+ );
+ for (Index = 0; Index < StringCount; Index++) {
+ StringSize = GetUnicodeStringTextSize (StringTextPtr);
+ BlockSize += StringSize;
+ if (CurrentStringId == StringId) {
+ *BlockType = *BlockHdr;
+ *StringTextOffset = StringTextPtr - StringData;
+ return EFI_SUCCESS;
+ }
+ StringTextPtr = StringTextPtr + StringSize;
+ CurrentStringId++;
+ }
+ break;
+
+ case EFI_HII_SIBT_DUPLICATE:
+ if (CurrentStringId == StringId) {
+ //
+ // Incoming StringId is an id of a duplicate string block.
+ // Update the StringId to be the previous string block.
+ // Go back to the header of string block to search.
+ //
+ memcpy (
+ &StringId,
+ BlockHdr + sizeof (EFI_HII_STRING_BLOCK),
+ sizeof (EFI_STRING_ID)
+ );
+ CurrentStringId = 1;
+ BlockSize = 0;
+ } else {
+ BlockSize += sizeof (EFI_HII_SIBT_DUPLICATE_BLOCK);
+ CurrentStringId++;
+ }
+ break;
+
+ case EFI_HII_SIBT_SKIP1:
+ SkipCount = (UINT16) (*(BlockHdr + sizeof (EFI_HII_STRING_BLOCK)));
+ CurrentStringId = (UINT16) (CurrentStringId + SkipCount);
+ BlockSize += sizeof (EFI_HII_SIBT_SKIP1_BLOCK);
+ break;
+
+ case EFI_HII_SIBT_SKIP2:
+ memcpy (&SkipCount, BlockHdr + sizeof (EFI_HII_STRING_BLOCK), sizeof (UINT16));
+ CurrentStringId = (UINT16) (CurrentStringId + SkipCount);
+ BlockSize += sizeof (EFI_HII_SIBT_SKIP2_BLOCK);
+ break;
+
+ case EFI_HII_SIBT_EXT1:
+ memcpy (
+ &Length8,
+ BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ sizeof (UINT8)
+ );
+ BlockSize += Length8;
+ break;
+
+ case EFI_HII_SIBT_EXT2:
+ memcpy (&Ext2, BlockHdr, sizeof (EFI_HII_SIBT_EXT2_BLOCK));
+ BlockSize += Ext2.Length;
+ break;
+
+ case EFI_HII_SIBT_EXT4:
+ memcpy (
+ &Length32,
+ BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ sizeof (UINT32)
+ );
+
+ BlockSize += Length32;
+ break;
+
+ default:
+ break;
+ }
+
+ if (StringId > 0 && StringId != (EFI_STRING_ID)(-1)) {
+ *StringTextOffset = BlockHdr - StringData + Offset;
+ *BlockType = *BlockHdr;
+
+ if (StringId == CurrentStringId - 1) {
+ //
+ // if only one skip item, return EFI_NOT_FOUND.
+ //
+ if(*BlockType == EFI_HII_SIBT_SKIP2 || *BlockType == EFI_HII_SIBT_SKIP1) {
+ return EFI_NOT_FOUND;
+ } else {
+ return EFI_SUCCESS;
+ }
+ }
+
+ if (StringId < CurrentStringId - 1) {
+ return EFI_NOT_FOUND;
+ }
+ }
+ BlockHdr = StringData + BlockSize;
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+UINT32
+CVfrStringDB::GetUnicodeStringTextSize (
+ IN UINT8 *StringSrc
+ )
+{
+ UINT32 StringSize;
+ CHAR16 *StringPtr;
+
+ StringSize = sizeof (CHAR16);
+ StringPtr = (UINT16*)StringSrc;
+ while (*StringPtr++ != L'\0') {
+ StringSize += sizeof (CHAR16);
+ }
+
+ return StringSize;
+}
+
+CVfrVarDataTypeDB gCVfrVarDataTypeDB;
+CVfrDefaultStore gCVfrDefaultStore;
+CVfrDataStorage gCVfrDataStorage;
+
+
diff --git a/roms/edk2/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
new file mode 100644
index 000000000..57bb0c424
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
@@ -0,0 +1,538 @@
+/** @file
+
+ Vfr common library functions.
+
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _VFRUTILITYLIB_H_
+#define _VFRUTILITYLIB_H_
+
+#include "string.h"
+#include "Common/UefiBaseTypes.h"
+#include "EfiVfr.h"
+#include "VfrError.h"
+
+static EFI_GUID gEdkiiIfrBitVarGuid = EDKII_IFR_BIT_VARSTORE_GUID;
+
+#define MAX_BIT_WIDTH 32
+#define MAX_NAME_LEN 64
+#define MAX_STRING_LEN 0x100
+#define DEFAULT_ALIGN 1
+#define DEFAULT_PACK_ALIGN 0x8
+#define DEFAULT_NAME_TABLE_ITEMS 1024
+
+#define EFI_BITS_SHIFT_PER_UINT32 0x5
+#define EFI_BITS_PER_UINT32 (1 << EFI_BITS_SHIFT_PER_UINT32)
+
+#define BUFFER_SAFE_FREE(Buf) do { if ((Buf) != NULL) { delete (Buf); } } while (0);
+#define ARRAY_SAFE_FREE(Buf) do { if ((Buf) != NULL) { delete[] (Buf); } } while (0);
+
+
+class CVfrBinaryOutput {
+public:
+ virtual VOID WriteLine (IN FILE *, IN UINT32, IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
+ virtual VOID WriteEnd (IN FILE *, IN UINT32, IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
+};
+
+UINT32
+_STR2U32 (
+ IN CHAR8 *Str
+ );
+
+struct SConfigInfo {
+ UINT16 mOffset;
+ UINT16 mWidth;
+ UINT8 *mValue;
+ SConfigInfo *mNext;
+
+ SConfigInfo (IN UINT8, IN UINT16, IN UINT32, IN EFI_IFR_TYPE_VALUE);
+ ~SConfigInfo (VOID);
+
+private:
+ SConfigInfo (IN CONST SConfigInfo&); // Prevent copy-construction
+ SConfigInfo& operator= (IN CONST SConfigInfo&); // Prevent assignment
+};
+
+struct SConfigItem {
+ CHAR8 *mName; // varstore name
+ EFI_GUID *mGuid; // varstore guid, varstore name + guid deside one varstore
+ CHAR8 *mId; // default ID
+ SConfigInfo *mInfoStrList; // list of Offset/Value in the varstore
+ SConfigItem *mNext;
+
+public:
+ SConfigItem (IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *);
+ SConfigItem (IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *, IN UINT8, IN UINT16, IN UINT16, IN EFI_IFR_TYPE_VALUE);
+ virtual ~SConfigItem ();
+
+private:
+ SConfigItem (IN CONST SConfigItem&); // Prevent copy-construction
+ SConfigItem& operator= (IN CONST SConfigItem&); // Prevent assignment
+};
+
+class CVfrBufferConfig {
+private:
+ SConfigItem *mItemListHead;
+ SConfigItem *mItemListTail;
+ SConfigItem *mItemListPos;
+
+public:
+ CVfrBufferConfig (VOID);
+ virtual ~CVfrBufferConfig (VOID);
+
+ virtual UINT8 Register (IN CHAR8 *, IN EFI_GUID *,IN CHAR8 *Info = NULL);
+ virtual VOID Open (VOID);
+ virtual BOOLEAN Eof(VOID);
+ virtual UINT8 Select (IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *Info = NULL);
+ virtual UINT8 Write (IN CONST CHAR8, IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *, IN UINT8, IN UINT16, IN UINT32, IN EFI_IFR_TYPE_VALUE);
+#if 0
+ virtual UINT8 Read (OUT CHAR8 **, OUT CHAR8 **, OUT CHAR8 **, OUT CHAR8 **, OUT CHAR8 **);
+#endif
+ virtual VOID Close (VOID);
+ virtual VOID OutputCFile (IN FILE *, IN CHAR8 *);
+
+private:
+ CVfrBufferConfig (IN CONST CVfrBufferConfig&); // Prevent copy-construction
+ CVfrBufferConfig& operator= (IN CONST CVfrBufferConfig&); // Prevent assignment
+};
+
+extern CVfrBufferConfig gCVfrBufferConfig;
+
+#define ALIGN_STUFF(Size, Align) ((Align) - (Size) % (Align))
+#define INVALID_ARRAY_INDEX 0xFFFFFFFF
+
+struct SVfrDataType;
+
+struct SVfrDataField {
+ CHAR8 mFieldName[MAX_NAME_LEN];
+ SVfrDataType *mFieldType;
+ UINT32 mOffset;
+ UINT32 mArrayNum;
+ BOOLEAN mIsBitField;
+ UINT8 mBitWidth;
+ UINT32 mBitOffset;
+ SVfrDataField *mNext;
+};
+
+struct SVfrDataType {
+ CHAR8 mTypeName[MAX_NAME_LEN];
+ UINT8 mType;
+ UINT32 mAlign;
+ UINT32 mTotalSize;
+ BOOLEAN mHasBitField;
+ SVfrDataField *mMembers;
+ SVfrDataType *mNext;
+};
+
+#define VFR_PACK_ASSIGN 0x01
+#define VFR_PACK_SHOW 0x02
+#define VFR_PACK_PUSH 0x04
+#define VFR_PACK_POP 0x08
+
+#define PACKSTACK_MAX_SIZE 0x400
+
+struct SVfrPackStackNode {
+ CHAR8 *mIdentifier;
+ UINT32 mNumber;
+ SVfrPackStackNode *mNext;
+
+ SVfrPackStackNode (IN CHAR8 *Identifier, IN UINT32 Number) {
+ mIdentifier = NULL;
+ mNumber = Number;
+ mNext = NULL;
+
+ if (Identifier != NULL) {
+ mIdentifier = new CHAR8[strlen (Identifier) + 1];
+ strcpy (mIdentifier, Identifier);
+ }
+ }
+
+ ~SVfrPackStackNode (VOID) {
+ if (mIdentifier != NULL) {
+ delete[] mIdentifier;
+ }
+ mNext = NULL;
+ }
+
+ bool Match (IN CHAR8 *Identifier) {
+ if (Identifier == NULL) {
+ return TRUE;
+ } else if (mIdentifier == NULL) {
+ return FALSE;
+ } else if (strcmp (Identifier, mIdentifier) == 0) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ }
+
+private:
+ SVfrPackStackNode (IN CONST SVfrPackStackNode&); // Prevent copy-construction
+ SVfrPackStackNode& operator= (IN CONST SVfrPackStackNode&); // Prevent assignment
+};
+
+class CVfrVarDataTypeDB {
+private:
+ UINT32 mPackAlign;
+ SVfrPackStackNode *mPackStack;
+
+public:
+ EFI_VFR_RETURN_CODE Pack (IN UINT32, IN UINT8, IN CHAR8 *Identifier = NULL, IN UINT32 Number = DEFAULT_PACK_ALIGN);
+
+private:
+ SVfrDataType *mDataTypeList;
+
+ SVfrDataType *mNewDataType;
+ SVfrDataType *mCurrDataType;
+ SVfrDataField *mCurrDataField;
+
+ VOID InternalTypesListInit (VOID);
+ VOID RegisterNewType (IN SVfrDataType *);
+
+ EFI_VFR_RETURN_CODE ExtractStructTypeName (IN CHAR8 *&, OUT CHAR8 *);
+ EFI_VFR_RETURN_CODE GetTypeField (IN CONST CHAR8 *, IN SVfrDataType *, IN SVfrDataField *&);
+ EFI_VFR_RETURN_CODE GetFieldOffset (IN SVfrDataField *, IN UINT32, OUT UINT32 &, IN BOOLEAN);
+ UINT8 GetFieldWidth (IN SVfrDataField *);
+ UINT32 GetFieldSize (IN SVfrDataField *, IN UINT32, IN BOOLEAN);
+
+public:
+ CVfrVarDataTypeDB (VOID);
+ ~CVfrVarDataTypeDB (VOID);
+
+ VOID DeclareDataTypeBegin (VOID);
+ EFI_VFR_RETURN_CODE SetNewTypeName (IN CHAR8 *);
+ EFI_VFR_RETURN_CODE DataTypeAddField (IN CHAR8 *, IN CHAR8 *, IN UINT32, IN BOOLEAN);
+ EFI_VFR_RETURN_CODE DataTypeAddBitField (IN CHAR8 *, IN CHAR8 *, IN UINT32, IN BOOLEAN);
+ VOID DeclareDataTypeEnd (VOID);
+
+ EFI_VFR_RETURN_CODE GetDataType (IN CHAR8 *, OUT SVfrDataType **);
+ EFI_VFR_RETURN_CODE GetDataTypeSize (IN CHAR8 *, OUT UINT32 *);
+ EFI_VFR_RETURN_CODE GetDataTypeSize (IN UINT8, OUT UINT32 *);
+ EFI_VFR_RETURN_CODE GetDataFieldInfo (IN CHAR8 *, OUT UINT16 &, OUT UINT8 &, OUT UINT32 &, OUT BOOLEAN &);
+
+ EFI_VFR_RETURN_CODE GetUserDefinedTypeNameList (OUT CHAR8 ***, OUT UINT32 *);
+ EFI_VFR_RETURN_CODE ExtractFieldNameAndArrary (IN CHAR8 *&, OUT CHAR8 *, OUT UINT32 &);
+ BOOLEAN DataTypeHasBitField (IN CHAR8 *);
+ BOOLEAN IsThisBitField (IN CHAR8 *);
+
+ BOOLEAN IsTypeNameDefined (IN CHAR8 *);
+
+ VOID Dump(IN FILE *);
+ //
+ // First the declared
+ //
+ CHAR8 *mFirstNewDataTypeName;
+#ifdef CVFR_VARDATATYPEDB_DEBUG
+ VOID ParserDB ();
+#endif
+
+private:
+ CVfrVarDataTypeDB (IN CONST CVfrVarDataTypeDB&); // Prevent copy-construction
+ CVfrVarDataTypeDB& operator= (IN CONST CVfrVarDataTypeDB&); // Prevent assignment
+};
+
+extern CVfrVarDataTypeDB gCVfrVarDataTypeDB;
+
+typedef enum {
+ EFI_VFR_VARSTORE_INVALID,
+ EFI_VFR_VARSTORE_BUFFER,
+ EFI_VFR_VARSTORE_EFI,
+ EFI_VFR_VARSTORE_NAME,
+ EFI_VFR_VARSTORE_BUFFER_BITS
+} EFI_VFR_VARSTORE_TYPE;
+
+struct SVfrVarStorageNode {
+ EFI_GUID mGuid;
+ CHAR8 *mVarStoreName;
+ EFI_VARSTORE_ID mVarStoreId;
+ BOOLEAN mAssignedFlag; //Create varstore opcode
+ struct SVfrVarStorageNode *mNext;
+
+ EFI_VFR_VARSTORE_TYPE mVarStoreType;
+ union {
+ // EFI Variable
+ struct {
+ EFI_STRING_ID mEfiVarName;
+ UINT32 mEfiVarSize;
+ } mEfiVar;
+
+ // Buffer Storage
+ SVfrDataType *mDataType;
+
+ // NameValue Storage
+ struct {
+ EFI_STRING_ID *mNameTable;
+ UINT32 mTableSize;
+ } mNameSpace;
+ } mStorageInfo;
+
+public:
+ SVfrVarStorageNode (IN EFI_GUID *, IN CHAR8 *, IN EFI_VARSTORE_ID, IN EFI_STRING_ID, IN UINT32, IN BOOLEAN Flag = TRUE);
+ SVfrVarStorageNode (IN EFI_GUID *, IN CHAR8 *, IN EFI_VARSTORE_ID, IN SVfrDataType *,IN BOOLEAN, IN BOOLEAN Flag = TRUE);
+ SVfrVarStorageNode (IN CHAR8 *, IN EFI_VARSTORE_ID);
+ ~SVfrVarStorageNode (VOID);
+
+private:
+ SVfrVarStorageNode (IN CONST SVfrVarStorageNode&); // Prevent copy-construction
+ SVfrVarStorageNode& operator= (IN CONST SVfrVarStorageNode&); // Prevent assignment
+};
+
+struct EFI_VARSTORE_INFO {
+ EFI_VARSTORE_ID mVarStoreId;
+ union {
+ EFI_STRING_ID mVarName;
+ UINT16 mVarOffset;
+ } mInfo;
+ UINT8 mVarType;
+ UINT32 mVarTotalSize;
+ BOOLEAN mIsBitVar;
+
+ EFI_VARSTORE_INFO (VOID);
+ EFI_VARSTORE_INFO (IN EFI_VARSTORE_INFO &);
+ EFI_VARSTORE_INFO& operator=(IN CONST EFI_VARSTORE_INFO &);
+ BOOLEAN operator == (IN EFI_VARSTORE_INFO *);
+};
+
+struct BufferVarStoreFieldInfoNode {
+ EFI_VARSTORE_INFO mVarStoreInfo;
+ struct BufferVarStoreFieldInfoNode *mNext;
+
+ BufferVarStoreFieldInfoNode( IN EFI_VARSTORE_INFO *Info );
+ ~BufferVarStoreFieldInfoNode ();
+};
+
+#define EFI_VARSTORE_ID_MAX 0xFFFF
+#define EFI_FREE_VARSTORE_ID_BITMAP_SIZE ((EFI_VARSTORE_ID_MAX + 1) / EFI_BITS_PER_UINT32)
+
+class CVfrDataStorage {
+private:
+ UINT32 mFreeVarStoreIdBitMap[EFI_FREE_VARSTORE_ID_BITMAP_SIZE];
+
+ struct SVfrVarStorageNode *mBufferVarStoreList;
+ struct SVfrVarStorageNode *mEfiVarStoreList;
+ struct SVfrVarStorageNode *mNameVarStoreList;
+
+ struct SVfrVarStorageNode *mCurrVarStorageNode;
+ struct SVfrVarStorageNode *mNewVarStorageNode;
+ BufferVarStoreFieldInfoNode *mBufferFieldInfoListHead;
+ BufferVarStoreFieldInfoNode *mBufferFieldInfoListTail;
+
+private:
+
+ EFI_VARSTORE_ID GetFreeVarStoreId (EFI_VFR_VARSTORE_TYPE VarType = EFI_VFR_VARSTORE_BUFFER);
+ BOOLEAN ChekVarStoreIdFree (IN EFI_VARSTORE_ID);
+ VOID MarkVarStoreIdUsed (IN EFI_VARSTORE_ID);
+ VOID MarkVarStoreIdUnused (IN EFI_VARSTORE_ID);
+ EFI_VARSTORE_ID CheckGuidField (IN SVfrVarStorageNode *,
+ IN EFI_GUID *,
+ IN BOOLEAN *,
+ OUT EFI_VFR_RETURN_CODE *);
+
+public:
+ CVfrDataStorage ();
+ ~CVfrDataStorage ();
+
+ SVfrVarStorageNode * GetBufferVarStoreList () {
+ return mBufferVarStoreList;
+ }
+ SVfrVarStorageNode * GetEfiVarStoreList () {
+ return mEfiVarStoreList;
+ }
+ EFI_VFR_RETURN_CODE DeclareNameVarStoreBegin (CHAR8 *, EFI_VARSTORE_ID);
+ EFI_VFR_RETURN_CODE NameTableAddItem (EFI_STRING_ID);
+ EFI_VFR_RETURN_CODE DeclareNameVarStoreEnd (EFI_GUID *);
+
+ EFI_VFR_RETURN_CODE DeclareEfiVarStore (IN CHAR8 *, IN EFI_GUID *, IN EFI_STRING_ID, IN UINT32, IN BOOLEAN Flag = TRUE);
+
+ EFI_VFR_RETURN_CODE DeclareBufferVarStore (IN CHAR8 *, IN EFI_GUID *, IN CVfrVarDataTypeDB *, IN CHAR8 *, IN EFI_VARSTORE_ID, IN BOOLEAN, IN BOOLEAN Flag = TRUE);
+
+ EFI_VFR_RETURN_CODE GetVarStoreId (IN CHAR8 *, OUT EFI_VARSTORE_ID *, IN EFI_GUID *VarGuid = NULL);
+ EFI_VFR_VARSTORE_TYPE GetVarStoreType (IN EFI_VARSTORE_ID);
+ EFI_GUID * GetVarStoreGuid (IN EFI_VARSTORE_ID);
+ EFI_VFR_RETURN_CODE GetVarStoreName (IN EFI_VARSTORE_ID, OUT CHAR8 **);
+ EFI_VFR_RETURN_CODE GetVarStoreByDataType (IN CHAR8 *, OUT SVfrVarStorageNode **, IN EFI_GUID *VarGuid = NULL);
+
+ EFI_VFR_RETURN_CODE GetBufferVarStoreDataTypeName (IN EFI_VARSTORE_ID, OUT CHAR8 **);
+ EFI_VFR_RETURN_CODE GetEfiVarStoreInfo (IN EFI_VARSTORE_INFO *);
+ EFI_VFR_RETURN_CODE GetNameVarStoreInfo (IN EFI_VARSTORE_INFO *, IN UINT32);
+ EFI_VFR_RETURN_CODE AddBufferVarStoreFieldInfo (IN EFI_VARSTORE_INFO *);
+ EFI_VFR_RETURN_CODE GetBufferVarStoreFieldInfo (IN OUT EFI_VARSTORE_INFO *);
+
+private:
+ CVfrDataStorage (IN CONST CVfrDataStorage&); // Prevent copy-construction
+ CVfrDataStorage& operator= (IN CONST CVfrDataStorage&); // Prevent assignment
+};
+
+extern CVfrDataStorage gCVfrDataStorage;
+
+#define EFI_QUESTION_ID_MAX 0xFFFF
+#define EFI_FREE_QUESTION_ID_BITMAP_SIZE ((EFI_QUESTION_ID_MAX + 1) / EFI_BITS_PER_UINT32)
+#define EFI_QUESTION_ID_INVALID 0x0
+
+#define DATE_YEAR_BITMASK 0x0000FFFF
+#define DATE_MONTH_BITMASK 0x00FF0000
+#define DATE_DAY_BITMASK 0xFF000000
+#define TIME_HOUR_BITMASK 0x000000FF
+#define TIME_MINUTE_BITMASK 0x0000FF00
+#define TIME_SECOND_BITMASK 0x00FF0000
+
+struct SVfrQuestionNode {
+ CHAR8 *mName;
+ CHAR8 *mVarIdStr;
+ EFI_QUESTION_ID mQuestionId;
+ UINT32 mBitMask;
+ SVfrQuestionNode *mNext;
+ EFI_QUESION_TYPE mQtype;
+
+ SVfrQuestionNode (IN CHAR8 *, IN CHAR8 *, IN UINT32 BitMask = 0);
+ ~SVfrQuestionNode ();
+
+private:
+ SVfrQuestionNode (IN CONST SVfrQuestionNode&); // Prevent copy-construction
+ SVfrQuestionNode& operator= (IN CONST SVfrQuestionNode&); // Prevent assignment
+};
+
+class CVfrQuestionDB {
+private:
+ SVfrQuestionNode *mQuestionList;
+ UINT32 mFreeQIdBitMap[EFI_FREE_QUESTION_ID_BITMAP_SIZE];
+
+private:
+ EFI_QUESTION_ID GetFreeQuestionId (VOID);
+ BOOLEAN ChekQuestionIdFree (IN EFI_QUESTION_ID);
+ VOID MarkQuestionIdUsed (IN EFI_QUESTION_ID);
+ VOID MarkQuestionIdUnused (IN EFI_QUESTION_ID);
+
+public:
+ CVfrQuestionDB ();
+ ~CVfrQuestionDB();
+
+ EFI_VFR_RETURN_CODE RegisterQuestion (IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &);
+ VOID RegisterOldDateQuestion (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &);
+ VOID RegisterNewDateQuestion (IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &);
+ VOID RegisterOldTimeQuestion (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &);
+ VOID RegisterNewTimeQuestion (IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &);
+ VOID RegisterRefQuestion (IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &);
+ EFI_VFR_RETURN_CODE UpdateQuestionId (IN EFI_QUESTION_ID, IN EFI_QUESTION_ID);
+ VOID GetQuestionId (IN CHAR8 *, IN CHAR8 *, OUT EFI_QUESTION_ID &, OUT UINT32 &, OUT EFI_QUESION_TYPE *QType = NULL);
+ EFI_VFR_RETURN_CODE FindQuestion (IN EFI_QUESTION_ID);
+ EFI_VFR_RETURN_CODE FindQuestion (IN CHAR8 *);
+ VOID PrintAllQuestion (IN VOID);
+ VOID ResetInit (IN VOID);
+
+private:
+ CVfrQuestionDB (IN CONST CVfrQuestionDB&); // Prevent copy-construction
+ CVfrQuestionDB& operator= (IN CONST CVfrQuestionDB&); // Prevent assignment
+};
+
+struct SVfrDefaultStoreNode {
+ EFI_IFR_DEFAULTSTORE *mObjBinAddr;
+ CHAR8 *mRefName;
+ EFI_STRING_ID mDefaultStoreNameId;
+ UINT16 mDefaultId;
+
+ SVfrDefaultStoreNode *mNext;
+
+ SVfrDefaultStoreNode (IN EFI_IFR_DEFAULTSTORE *, IN CHAR8 *, IN EFI_STRING_ID, IN UINT16);
+ ~SVfrDefaultStoreNode();
+
+private:
+ SVfrDefaultStoreNode (IN CONST SVfrDefaultStoreNode&); // Prevent copy-construction
+ SVfrDefaultStoreNode& operator= (IN CONST SVfrDefaultStoreNode&); // Prevent assignment
+};
+
+class CVfrDefaultStore {
+private:
+ SVfrDefaultStoreNode *mDefaultStoreList;
+
+public:
+ CVfrDefaultStore ();
+ ~CVfrDefaultStore ();
+
+ EFI_VFR_RETURN_CODE RegisterDefaultStore (IN CHAR8 *, IN CHAR8 *, IN EFI_STRING_ID, IN UINT16);
+ EFI_VFR_RETURN_CODE ReRegisterDefaultStoreById (IN UINT16, IN CHAR8 *, IN EFI_STRING_ID);
+ BOOLEAN DefaultIdRegistered (IN UINT16);
+ EFI_VFR_RETURN_CODE GetDefaultId (IN CHAR8 *, OUT UINT16 *);
+ EFI_VFR_RETURN_CODE BufferVarStoreAltConfigAdd (IN EFI_VARSTORE_ID, IN EFI_VARSTORE_INFO &, IN CHAR8 *, IN EFI_GUID *, IN UINT8, IN EFI_IFR_TYPE_VALUE);
+
+private:
+ CVfrDefaultStore (IN CONST CVfrDefaultStore&); // Prevent copy-construction
+ CVfrDefaultStore& operator= (IN CONST CVfrDefaultStore&); // Prevent assignment
+};
+
+extern CVfrDefaultStore gCVfrDefaultStore;
+
+#define EFI_RULE_ID_START 0x01
+#define EFI_RULE_ID_INVALID 0x00
+
+struct SVfrRuleNode {
+ UINT8 mRuleId;
+ CHAR8 *mRuleName;
+ SVfrRuleNode *mNext;
+
+ SVfrRuleNode(IN CHAR8 *, IN UINT8);
+ ~SVfrRuleNode();
+
+private:
+ SVfrRuleNode (IN CONST SVfrRuleNode&); // Prevent copy-construction
+ SVfrRuleNode& operator= (IN CONST SVfrRuleNode&); // Prevent assignment
+};
+
+class CVfrRulesDB {
+private:
+ SVfrRuleNode *mRuleList;
+ UINT8 mFreeRuleId;
+
+public:
+ CVfrRulesDB ();
+ ~CVfrRulesDB();
+
+ VOID RegisterRule (IN CHAR8 *);
+ UINT8 GetRuleId (IN CHAR8 *);
+
+private:
+ CVfrRulesDB (IN CONST CVfrRulesDB&); // Prevent copy-construction
+ CVfrRulesDB& operator= (IN CONST CVfrRulesDB&); // Prevent assignment
+};
+
+class CVfrStringDB {
+private:
+ CHAR8 *mStringFileName;
+
+ EFI_STATUS FindStringBlock (
+ IN UINT8 *StringData,
+ IN EFI_STRING_ID StringId,
+ OUT UINT32 *StringTextOffset,
+ OUT UINT8 *BlockType
+ );
+
+ UINT32 GetUnicodeStringTextSize (
+ IN UINT8 *StringSrc
+ );
+
+ BOOLEAN GetBestLanguage (
+ IN CONST CHAR8 *SupportedLanguages,
+ IN CHAR8 *Language
+ );
+
+public:
+ CVfrStringDB ();
+ ~CVfrStringDB ();
+
+ VOID SetStringFileName (
+ IN CHAR8 *StringFileName
+ );
+
+ CHAR8 * GetVarStoreNameFormStringId (
+ IN EFI_STRING_ID StringId
+ );
+
+private:
+ CVfrStringDB (IN CONST CVfrStringDB&); // Prevent copy-construction
+ CVfrStringDB& operator= (IN CONST CVfrStringDB&); // Prevent assignment
+};
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/C/VolInfo/GNUmakefile b/roms/edk2/BaseTools/Source/C/VolInfo/GNUmakefile
new file mode 100644
index 000000000..9795b28ad
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VolInfo/GNUmakefile
@@ -0,0 +1,17 @@
+## @file
+# GNU/Linux makefile for 'VolInfo' module build.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+MAKEROOT ?= ..
+
+APPNAME = VolInfo
+
+OBJECTS = VolInfo.o
+
+include $(MAKEROOT)/Makefiles/app.makefile
+
+LIBS = -lCommon
+
+
diff --git a/roms/edk2/BaseTools/Source/C/VolInfo/Makefile b/roms/edk2/BaseTools/Source/C/VolInfo/Makefile
new file mode 100644
index 000000000..47f6d35ea
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VolInfo/Makefile
@@ -0,0 +1,16 @@
+## @file
+# Windows makefile for 'VolInfo' module build.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+!INCLUDE ..\Makefiles\ms.common
+
+APPNAME = VolInfo
+
+LIBS = $(LIB_PATH)\Common.lib
+
+OBJECTS = VolInfo.obj
+
+!INCLUDE ..\Makefiles\ms.app
+
diff --git a/roms/edk2/BaseTools/Source/C/VolInfo/VolInfo.c b/roms/edk2/BaseTools/Source/C/VolInfo/VolInfo.c
new file mode 100644
index 000000000..2457ddd2e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -0,0 +1,2427 @@
+/** @file
+The tool dumps the contents of a firmware volume
+
+Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <assert.h>
+#ifdef __GNUC__
+#include <unistd.h>
+#else
+#include <direct.h>
+#endif
+
+#include <FvLib.h>
+#include <Common/UefiBaseTypes.h>
+#include <Common/UefiCapsule.h>
+#include <Common/PiFirmwareFile.h>
+#include <Common/PiFirmwareVolume.h>
+#include <Guid/PiFirmwareFileSystem.h>
+#include <IndustryStandard/PeImage.h>
+#include <Protocol/GuidedSectionExtraction.h>
+
+#include "Compress.h"
+#include "Decompress.h"
+#include "VolInfo.h"
+#include "CommonLib.h"
+#include "EfiUtilityMsgs.h"
+#include "FirmwareVolumeBufferLib.h"
+#include "OsPath.h"
+#include "ParseGuidedSectionTools.h"
+#include "StringFuncs.h"
+#include "ParseInf.h"
+#include "PeCoffLib.h"
+
+//
+// Utility global variables
+//
+
+EFI_GUID gEfiCrc32GuidedSectionExtractionProtocolGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;
+
+#define UTILITY_MAJOR_VERSION 1
+#define UTILITY_MINOR_VERSION 0
+
+#define UTILITY_NAME "VolInfo"
+
+#define EFI_SECTION_ERROR EFIERR (100)
+
+#define MAX_BASENAME_LEN 60 // not good to hardcode, but let's be reasonable
+
+//
+// Structure to keep a list of guid-to-basenames
+//
+typedef struct _GUID_TO_BASENAME {
+ struct _GUID_TO_BASENAME *Next;
+ INT8 Guid[PRINTED_GUID_BUFFER_SIZE];
+ INT8 BaseName[MAX_BASENAME_LEN];
+} GUID_TO_BASENAME;
+
+static GUID_TO_BASENAME *mGuidBaseNameList = NULL;
+
+//
+// Store GUIDed Section guid->tool mapping
+//
+EFI_HANDLE mParsedGuidedSectionTools = NULL;
+
+CHAR8* mUtilityFilename = NULL;
+
+BOOLEAN EnableHash = FALSE;
+CHAR8 *OpenSslPath = NULL;
+
+EFI_STATUS
+ParseGuidBaseNameFile (
+ CHAR8 *FileName
+ );
+
+EFI_STATUS
+FreeGuidBaseNameList (
+ VOID
+ );
+
+EFI_STATUS
+PrintGuidName (
+ IN UINT8 *GuidStr
+ );
+
+EFI_STATUS
+ParseSection (
+ IN UINT8 *SectionBuffer,
+ IN UINT32 BufferLength
+ );
+
+EFI_STATUS
+DumpDepexSection (
+ IN UINT8 *Ptr,
+ IN UINT32 SectionLength
+ );
+
+STATIC
+EFI_STATUS
+ReadHeader (
+ IN FILE *InputFile,
+ OUT UINT32 *FvSize,
+ OUT BOOLEAN *ErasePolarity
+ );
+
+STATIC
+EFI_STATUS
+PrintFileInfo (
+ EFI_FIRMWARE_VOLUME_HEADER *FvImage,
+ EFI_FFS_FILE_HEADER *FileHeader,
+ BOOLEAN ErasePolarity
+ );
+
+static
+EFI_STATUS
+PrintFvInfo (
+ IN VOID *Fv,
+ IN BOOLEAN IsChildFv
+ );
+
+static
+VOID
+LoadGuidedSectionToolsTxt (
+ IN CHAR8* FirmwareVolumeFilename
+ );
+
+EFI_STATUS
+CombinePath (
+ IN CHAR8* DefaultPath,
+ IN CHAR8* AppendPath,
+ OUT CHAR8* NewPath
+);
+
+void
+Usage (
+ VOID
+ );
+
+UINT32
+UnicodeStrLen (
+ IN CHAR16 *String
+ )
+ /*++
+
+ Routine Description:
+
+ Returns the length of a null-terminated unicode string.
+
+ Arguments:
+
+ String - The pointer to a null-terminated unicode string.
+
+ Returns:
+
+ N/A
+
+ --*/
+{
+ UINT32 Length;
+
+ for (Length = 0; *String != L'\0'; String++, Length++) {
+ ;
+ }
+ return Length;
+}
+
+VOID
+Unicode2AsciiString (
+ IN CHAR16 *Source,
+ OUT CHAR8 *Destination
+ )
+ /*++
+
+ Routine Description:
+
+ Convert a null-terminated unicode string to a null-terminated ascii string.
+
+ Arguments:
+
+ Source - The pointer to the null-terminated input unicode string.
+ Destination - The pointer to the null-terminated output ascii string.
+
+ Returns:
+
+ N/A
+
+ --*/
+{
+ while (*Source != '\0') {
+ *(Destination++) = (CHAR8) *(Source++);
+ }
+ //
+ // End the ascii with a NULL.
+ //
+ *Destination = '\0';
+}
+
+int
+main (
+ int argc,
+ char *argv[]
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+ argc - GC_TODO: add argument description
+ ] - GC_TODO: add argument description
+
+Returns:
+
+ GC_TODO: add return values
+
+--*/
+{
+ FILE *InputFile;
+ int BytesRead;
+ EFI_FIRMWARE_VOLUME_HEADER *FvImage;
+ UINT32 FvSize;
+ EFI_STATUS Status;
+ int Offset;
+ BOOLEAN ErasePolarity;
+ UINT64 LogLevel;
+ CHAR8 *OpenSslEnv;
+ CHAR8 *OpenSslCommand;
+
+ SetUtilityName (UTILITY_NAME);
+ //
+ // Print utility header
+ //
+ printf ("%s Version %d.%d Build %s\n",
+ UTILITY_NAME,
+ UTILITY_MAJOR_VERSION,
+ UTILITY_MINOR_VERSION,
+ __BUILD_VERSION
+ );
+
+ if (argc == 1) {
+ Usage ();
+ return -1;
+ }
+
+ argc--;
+ argv++;
+ LogLevel = 0;
+ Offset = 0;
+
+ //
+ // Look for help options
+ //
+ if ((strcmp(argv[0], "-h") == 0) || (strcmp(argv[0], "--help") == 0) ||
+ (strcmp(argv[0], "-?") == 0) || (strcmp(argv[0], "/?") == 0)) {
+ Usage();
+ return STATUS_SUCCESS;
+ }
+ //
+ // Version has already be printed, so just return success
+ //
+ if (strcmp(argv[0], "--version") == 0) {
+ return STATUS_SUCCESS;
+ }
+
+ //
+ // If they specified -x xref guid/basename cross-reference files, process it.
+ // This will print the basename beside each file guid. To use it, specify
+ // -x xref_filename to processdsc, then use xref_filename as a parameter
+ // here.
+ //
+ while (argc > 0) {
+ if ((strcmp(argv[0], "-x") == 0) || (strcmp(argv[0], "--xref") == 0)) {
+ ParseGuidBaseNameFile (argv[1]);
+ printf("ParseGuidBaseNameFile: %s\n", argv[1]);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+ if (strcmp(argv[0], "--offset") == 0) {
+ //
+ // Hex or decimal?
+ //
+ if ((argv[1][0] == '0') && (tolower ((int)argv[1][1]) == 'x')) {
+ if (sscanf (argv[1], "%x", &Offset) != 1) {
+ Error (NULL, 0, 1003, "Invalid option value", "Offset = %s", argv[1]);
+ return GetUtilityStatus ();
+ }
+ } else {
+ if (sscanf (argv[1], "%d", &Offset) != 1) {
+ Error (NULL, 0, 1003, "Invalid option value", "Offset = %s", argv[1]);
+ return GetUtilityStatus ();
+ }
+ //
+ // See if they said something like "64K"
+ //
+ if (tolower ((int)argv[1][strlen (argv[1]) - 1]) == 'k') {
+ Offset *= 1024;
+ }
+ }
+
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+ if ((stricmp (argv[0], "--hash") == 0)) {
+ if (EnableHash == TRUE) {
+ //
+ // --hash already given in the option, ignore this one
+ //
+ argc --;
+ argv ++;
+ continue;
+ }
+ EnableHash = TRUE;
+ OpenSslCommand = "openssl";
+ OpenSslEnv = getenv("OPENSSL_PATH");
+ if (OpenSslEnv == NULL) {
+ OpenSslPath = OpenSslCommand;
+ } else {
+ //
+ // We add quotes to the Openssl Path in case it has space characters
+ //
+ OpenSslPath = malloc(2+strlen(OpenSslEnv)+strlen(OpenSslCommand)+1);
+ if (OpenSslPath == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return GetUtilityStatus ();
+ }
+ CombinePath(OpenSslEnv, OpenSslCommand, OpenSslPath);
+ }
+ if (OpenSslPath == NULL){
+ Error (NULL, 0, 3000, "Open SSL command not available. Please verify PATH or set OPENSSL_PATH.", NULL);
+ return GetUtilityStatus ();
+ }
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-v") == 0) || (stricmp (argv[0], "--verbose") == 0)) {
+ SetPrintLevel (VERBOSE_LOG_LEVEL);
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
+ SetPrintLevel (KEY_LOG_LEVEL);
+ argc --;
+ argv ++;
+ continue;
+ }
+
+ if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--debug") == 0)) {
+ Status = AsciiStringToUint64 (argv[1], FALSE, &LogLevel);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+ return -1;
+ }
+ if (LogLevel > 9) {
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);
+ return -1;
+ }
+ SetPrintLevel (LogLevel);
+ DebugMsg (NULL, 0, 9, "Debug Mode Set", "Debug Output Mode Level %s is set!", argv[1]);
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+
+ mUtilityFilename = argv[0];
+ argc --;
+ argv ++;
+ }
+
+ //
+ // Open the file containing the FV
+ //
+ if (mUtilityFilename == NULL) {
+ Error (NULL, 0, 1001, "Missing option", "Input files are not specified");
+ return GetUtilityStatus ();
+ }
+ InputFile = fopen (LongFilePath (mUtilityFilename), "rb");
+ if (InputFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening the input file", mUtilityFilename);
+ return GetUtilityStatus ();
+ }
+ //
+ // Skip over pad bytes if specified. This is used if they prepend 0xff
+ // data to the FV image binary.
+ //
+ if (Offset != 0) {
+ fseek (InputFile, Offset, SEEK_SET);
+ }
+ //
+ // Determine size of FV
+ //
+ Status = ReadHeader (InputFile, &FvSize, &ErasePolarity);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "error parsing FV image", "%s Header is invalid", mUtilityFilename);
+ fclose (InputFile);
+ return GetUtilityStatus ();
+ }
+ //
+ // Allocate a buffer for the FV image
+ //
+ FvImage = malloc (FvSize);
+ if (FvImage == NULL) {
+ Error (NULL, 0, 4001, "Resource: Memory can't be allocated", NULL);
+ fclose (InputFile);
+ return GetUtilityStatus ();
+ }
+ //
+ // Seek to the start of the image, then read the entire FV to the buffer
+ //
+ fseek (InputFile, Offset, SEEK_SET);
+ BytesRead = fread (FvImage, 1, FvSize, InputFile);
+ fclose (InputFile);
+ if ((unsigned int) BytesRead != FvSize) {
+ Error (NULL, 0, 0004, "error reading FvImage from", mUtilityFilename);
+ free (FvImage);
+ return GetUtilityStatus ();
+ }
+
+ LoadGuidedSectionToolsTxt (mUtilityFilename);
+
+ PrintFvInfo (FvImage, FALSE);
+
+ //
+ // Clean up
+ //
+ free (FvImage);
+ FreeGuidBaseNameList ();
+ return GetUtilityStatus ();
+}
+
+
+static
+EFI_STATUS
+PrintFvInfo (
+ IN VOID *Fv,
+ IN BOOLEAN IsChildFv
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+ Fv - Firmware Volume to print information about
+ IsChildFv - Flag specifies whether the input FV is a child FV.
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN NumberOfFiles;
+ BOOLEAN ErasePolarity;
+ UINTN FvSize;
+ EFI_FFS_FILE_HEADER *CurrentFile;
+ UINTN Key;
+
+ Status = FvBufGetSize (Fv, &FvSize);
+
+ NumberOfFiles = 0;
+ ErasePolarity =
+ (((EFI_FIRMWARE_VOLUME_HEADER*)Fv)->Attributes & EFI_FVB2_ERASE_POLARITY) ?
+ TRUE : FALSE;
+
+ //
+ // Get the first file
+ //
+ Key = 0;
+ Status = FvBufFindNextFile (Fv, &Key, (VOID **) &CurrentFile);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "error parsing FV image", "cannot find the first file in the FV image");
+ return GetUtilityStatus ();
+ }
+ //
+ // Display information about files found
+ //
+ while (CurrentFile != NULL) {
+ //
+ // Increment the number of files counter
+ //
+ NumberOfFiles++;
+
+ //
+ // Display info about this file
+ //
+ Status = PrintFileInfo (Fv, CurrentFile, ErasePolarity);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "error parsing FV image", "failed to parse a file in the FV");
+ return GetUtilityStatus ();
+ }
+ //
+ // Get the next file
+ //
+ Status = FvBufFindNextFile (Fv, &Key, (VOID **) &CurrentFile);
+ if (Status == EFI_NOT_FOUND) {
+ CurrentFile = NULL;
+ } else if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "error parsing FV image", "cannot find the next file in the FV image");
+ return GetUtilityStatus ();
+ }
+ }
+
+ if (IsChildFv) {
+ printf ("There are a total of %d files in the child FV\n", (int) NumberOfFiles);
+ } else {
+ printf ("There are a total of %d files in this FV\n", (int) NumberOfFiles);
+ }
+
+ return EFI_SUCCESS;
+}
+
+UINT32
+GetOccupiedSize (
+ IN UINT32 ActualSize,
+ IN UINT32 Alignment
+ )
+/*++
+
+Routine Description:
+
+ This function returns the next larger size that meets the alignment
+ requirement specified.
+
+Arguments:
+
+ ActualSize The size.
+ Alignment The desired alignment.
+
+Returns:
+
+ EFI_SUCCESS Function completed successfully.
+ EFI_ABORTED The function encountered an error.
+
+--*/
+{
+ UINT32 OccupiedSize;
+
+ OccupiedSize = ActualSize;
+ while ((OccupiedSize & (Alignment - 1)) != 0) {
+ OccupiedSize++;
+ }
+
+ return OccupiedSize;
+}
+
+static
+CHAR8 *
+SectionNameToStr (
+ IN EFI_SECTION_TYPE Type
+ )
+/*++
+
+Routine Description:
+
+ Converts EFI Section names to Strings
+
+Arguments:
+
+ Type - The EFI Section type
+
+Returns:
+
+ CHAR8* - Pointer to the String containing the section name.
+
+--*/
+{
+ CHAR8 *SectionStr;
+ CHAR8 *SectionTypeStringTable[] = {
+ //
+ // 0X00
+ //
+ "EFI_SECTION_ALL",
+ //
+ // 0x01
+ //
+ "EFI_SECTION_COMPRESSION",
+ //
+ // 0x02
+ //
+ "EFI_SECTION_GUID_DEFINED",
+ //
+ // 0x03
+ //
+ "Unknown section type - Reserved 0x03",
+ //
+ // 0x04
+ //
+ "Unknown section type - Reserved 0x04",
+ //
+ // 0x05
+ //
+ "Unknown section type - Reserved 0x05",
+ //
+ // 0x06
+ //
+ "Unknown section type - Reserved 0x06",
+ //
+ // 0x07
+ //
+ "Unknown section type - Reserved 0x07",
+ //
+ // 0x08
+ //
+ "Unknown section type - Reserved 0x08",
+ //
+ // 0x09
+ //
+ "Unknown section type - Reserved 0x09",
+ //
+ // 0x0A
+ //
+ "Unknown section type - Reserved 0x0A",
+ //
+ // 0x0B
+ //
+ "Unknown section type - Reserved 0x0B",
+ //
+ // 0x0C
+ //
+ "Unknown section type - Reserved 0x0C",
+ //
+ // 0x0D
+ //
+ "Unknown section type - Reserved 0x0D",
+ //
+ // 0x0E
+ //
+ "Unknown section type - Reserved 0x0E",
+ //
+ // 0x0F
+ //
+ "Unknown section type - Reserved 0x0E",
+ //
+ // 0x10
+ //
+ "EFI_SECTION_PE32",
+ //
+ // 0x11
+ //
+ "EFI_SECTION_PIC",
+ //
+ // 0x12
+ //
+ "EFI_SECTION_TE",
+ //
+ // 0x13
+ //
+ "EFI_SECTION_DXE_DEPEX",
+ //
+ // 0x14
+ //
+ "EFI_SECTION_VERSION",
+ //
+ // 0x15
+ //
+ "EFI_SECTION_USER_INTERFACE",
+ //
+ // 0x16
+ //
+ "EFI_SECTION_COMPATIBILITY16",
+ //
+ // 0x17
+ //
+ "EFI_SECTION_FIRMWARE_VOLUME_IMAGE ",
+ //
+ // 0x18
+ //
+ "EFI_SECTION_FREEFORM_SUBTYPE_GUID ",
+ //
+ // 0x19
+ //
+ "EFI_SECTION_RAW",
+ //
+ // 0x1A
+ //
+ "Unknown section type - 0x1A",
+ //
+ // 0x1B
+ //
+ "EFI_SECTION_PEI_DEPEX",
+ //
+ // 0x1C
+ //
+ "EFI_SECTION_SMM_DEPEX",
+ //
+ // 0x1C+
+ //
+ "Unknown section type - Reserved - beyond last defined section"
+ };
+
+ if (Type > EFI_SECTION_LAST_SECTION_TYPE) {
+ Type = EFI_SECTION_LAST_SECTION_TYPE + 1;
+ }
+
+ SectionStr = malloc (100);
+ if (SectionStr == NULL) {
+ printf ("Error: Out of memory resources.\n");
+ return SectionStr;
+ }
+ strcpy (SectionStr, SectionTypeStringTable[Type]);
+ return SectionStr;
+}
+
+STATIC
+EFI_STATUS
+ReadHeader (
+ IN FILE *InputFile,
+ OUT UINT32 *FvSize,
+ OUT BOOLEAN *ErasePolarity
+ )
+/*++
+
+Routine Description:
+
+ This function determines the size of the FV and the erase polarity. The
+ erase polarity is the FALSE value for file state.
+
+Arguments:
+
+ InputFile The file that contains the FV image.
+ FvSize The size of the FV.
+ ErasePolarity The FV erase polarity.
+
+Returns:
+
+ EFI_SUCCESS Function completed successfully.
+ EFI_INVALID_PARAMETER A required parameter was NULL or is out of range.
+ EFI_ABORTED The function encountered an error.
+
+--*/
+{
+ EFI_FIRMWARE_VOLUME_HEADER VolumeHeader;
+ EFI_FV_BLOCK_MAP_ENTRY BlockMap;
+ UINTN Signature[2];
+ UINTN BytesRead;
+ UINT32 Size;
+ size_t ReadSize;
+
+ BytesRead = 0;
+ Size = 0;
+ //
+ // Check input parameters
+ //
+ if (InputFile == NULL || FvSize == NULL || ErasePolarity == NULL) {
+ Error (__FILE__, __LINE__, 0, "application error", "invalid parameter to function");
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Read the header
+ //
+ ReadSize = fread (&VolumeHeader, sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, InputFile);
+ if (ReadSize != 1) {
+ return EFI_ABORTED;
+ }
+ BytesRead = sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY);
+ Signature[0] = VolumeHeader.Signature;
+ Signature[1] = 0;
+
+ //
+ // Print FV header information
+ //
+ printf ("Signature: %s (%X)\n", (char *) Signature, (unsigned) VolumeHeader.Signature);
+ printf ("Attributes: %X\n", (unsigned) VolumeHeader.Attributes);
+
+ if (VolumeHeader.Attributes & EFI_FVB2_READ_DISABLED_CAP) {
+ printf (" EFI_FVB2_READ_DISABLED_CAP\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_READ_ENABLED_CAP) {
+ printf (" EFI_FVB2_READ_ENABLED_CAP\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_READ_STATUS) {
+ printf (" EFI_FVB2_READ_STATUS\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_WRITE_DISABLED_CAP) {
+ printf (" EFI_FVB2_WRITE_DISABLED_CAP\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_WRITE_ENABLED_CAP) {
+ printf (" EFI_FVB2_WRITE_ENABLED_CAP\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_WRITE_STATUS) {
+ printf (" EFI_FVB2_WRITE_STATUS\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_LOCK_CAP) {
+ printf (" EFI_FVB2_LOCK_CAP\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_LOCK_STATUS) {
+ printf (" EFI_FVB2_LOCK_STATUS\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_STICKY_WRITE) {
+ printf (" EFI_FVB2_STICKY_WRITE\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_MEMORY_MAPPED) {
+ printf (" EFI_FVB2_MEMORY_MAPPED\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ERASE_POLARITY) {
+ printf (" EFI_FVB2_ERASE_POLARITY\n");
+ *ErasePolarity = TRUE;
+ }
+
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT) {
+ printf (" EFI_FVB2_ALIGNMENT\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2) {
+ printf (" EFI_FVB2_ALIGNMENT_2\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4) {
+ printf (" EFI_FVB2_ALIGNMENT_4\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8) {
+ printf (" EFI_FVB2_ALIGNMENT_8\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16) {
+ printf (" EFI_FVB2_ALIGNMENT_16\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32) {
+ printf (" EFI_FVB2_ALIGNMENT_32\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64) {
+ printf (" EFI_FVB2_ALIGNMENT_64\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128) {
+ printf (" EFI_FVB2_ALIGNMENT_128\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256) {
+ printf (" EFI_FVB2_ALIGNMENT_256\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512) {
+ printf (" EFI_FVB2_ALIGNMENT_512\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1K) {
+ printf (" EFI_FVB2_ALIGNMENT_1K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2K) {
+ printf (" EFI_FVB2_ALIGNMENT_2K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4K) {
+ printf (" EFI_FVB2_ALIGNMENT_4K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8K) {
+ printf (" EFI_FVB2_ALIGNMENT_8K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16K) {
+ printf (" EFI_FVB2_ALIGNMENT_16K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32K) {
+ printf (" EFI_FVB2_ALIGNMENT_32K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64K) {
+ printf (" EFI_FVB2_ALIGNMENT_64K\n");
+ }
+
+#else
+
+ if (VolumeHeader.Attributes & EFI_FVB2_READ_LOCK_CAP) {
+ printf (" EFI_FVB2_READ_LOCK_CAP\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_READ_LOCK_STATUS) {
+ printf (" EFI_FVB2_READ_LOCK_STATUS\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_WRITE_LOCK_CAP) {
+ printf (" EFI_FVB2_WRITE_LOCK_CAP\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_WRITE_LOCK_STATUS) {
+ printf (" EFI_FVB2_WRITE_LOCK_STATUS\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1) {
+ printf (" EFI_FVB2_ALIGNMENT_1\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2) {
+ printf (" EFI_FVB2_ALIGNMENT_2\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4) {
+ printf (" EFI_FVB2_ALIGNMENT_4\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8) {
+ printf (" EFI_FVB2_ALIGNMENT_8\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16) {
+ printf (" EFI_FVB2_ALIGNMENT_16\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32) {
+ printf (" EFI_FVB2_ALIGNMENT_32\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64) {
+ printf (" EFI_FVB2_ALIGNMENT_64\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128) {
+ printf (" EFI_FVB2_ALIGNMENT_128\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256) {
+ printf (" EFI_FVB2_ALIGNMENT_256\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512) {
+ printf (" EFI_FVB2_ALIGNMENT_512\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1K) {
+ printf (" EFI_FVB2_ALIGNMENT_1K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2K) {
+ printf (" EFI_FVB2_ALIGNMENT_2K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4K) {
+ printf (" EFI_FVB2_ALIGNMENT_4K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8K) {
+ printf (" EFI_FVB2_ALIGNMENT_8K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16K) {
+ printf (" EFI_FVB2_ALIGNMENT_16K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32K) {
+ printf (" EFI_FVB2_ALIGNMENT_32K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64K) {
+ printf (" EFI_FVB2_ALIGNMENT_64K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128K) {
+ printf (" EFI_FVB2_ALIGNMENT_128K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256K) {
+ printf (" EFI_FVB2_ALIGNMENT_256K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512K) {
+ printf (" EFI_FVB2_ALIGNMENT_512K\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1M) {
+ printf (" EFI_FVB2_ALIGNMENT_1M\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2M) {
+ printf (" EFI_FVB2_ALIGNMENT_2M\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4M) {
+ printf (" EFI_FVB2_ALIGNMENT_4M\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8M) {
+ printf (" EFI_FVB2_ALIGNMENT_8M\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16M) {
+ printf (" EFI_FVB2_ALIGNMENT_16M\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32M) {
+ printf (" EFI_FVB2_ALIGNMENT_32M\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) {
+ printf (" EFI_FVB2_ALIGNMENT_64M\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) {
+ printf (" EFI_FVB2_ALIGNMENT_128M\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) {
+ printf (" EFI_FVB2_ALIGNMENT_64M\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) {
+ printf (" EFI_FVB2_ALIGNMENT_128M\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256M) {
+ printf (" EFI_FVB2_ALIGNMENT_256M\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512M) {
+ printf (" EFI_FVB2_ALIGNMENT_512M\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1G) {
+ printf (" EFI_FVB2_ALIGNMENT_1G\n");
+ }
+
+ if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2G) {
+ printf (" EFI_FVB2_ALIGNMENT_2G\n");
+ }
+
+#endif
+ printf ("Header Length: 0x%08X\n", VolumeHeader.HeaderLength);
+ printf ("File System ID: ");
+ PrintGuid (&VolumeHeader.FileSystemGuid);
+ //
+ // printf ("\n");
+ //
+ printf ("Revision: 0x%04X\n", VolumeHeader.Revision);
+
+ do {
+ ReadSize = fread (&BlockMap, sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, InputFile);
+ if (ReadSize != 1) {
+ return EFI_ABORTED;
+ }
+ BytesRead += sizeof (EFI_FV_BLOCK_MAP_ENTRY);
+
+ if (BlockMap.NumBlocks != 0) {
+ printf ("Number of Blocks: 0x%08X\n", (unsigned) BlockMap.NumBlocks);
+ printf ("Block Length: 0x%08X\n", (unsigned) BlockMap.Length);
+ Size += BlockMap.NumBlocks * BlockMap.Length;
+ }
+
+ } while (!(BlockMap.NumBlocks == 0 && BlockMap.Length == 0));
+
+ if (BytesRead != VolumeHeader.HeaderLength) {
+ printf ("ERROR: Header length not consistent with Block Maps!\n");
+ return EFI_ABORTED;
+ }
+
+ if (VolumeHeader.FvLength != Size) {
+ printf ("ERROR: Volume Size not consistent with Block Maps!\n");
+ return EFI_ABORTED;
+ }
+
+ printf ("Total Volume Size: 0x%08X\n", (unsigned) Size);
+
+ *FvSize = Size;
+
+ //
+ // rewind (InputFile);
+ //
+ return EFI_SUCCESS;
+}
+
+STATIC
+EFI_STATUS
+PrintFileInfo (
+ EFI_FIRMWARE_VOLUME_HEADER *FvImage,
+ EFI_FFS_FILE_HEADER *FileHeader,
+ BOOLEAN ErasePolarity
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+ FvImage - GC_TODO: add argument description
+ FileHeader - GC_TODO: add argument description
+ ErasePolarity - GC_TODO: add argument description
+
+Returns:
+
+ EFI_SUCCESS - GC_TODO: Add description for return value
+ EFI_ABORTED - GC_TODO: Add description for return value
+
+--*/
+{
+ UINT32 FileLength;
+ UINT8 FileState;
+ UINT8 Checksum;
+ EFI_FFS_FILE_HEADER2 BlankHeader;
+ EFI_STATUS Status;
+ UINT8 GuidBuffer[PRINTED_GUID_BUFFER_SIZE];
+ UINT32 HeaderSize;
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
+ UINT16 *Tail;
+#endif
+ //
+ // Check if we have free space
+ //
+ HeaderSize = FvBufGetFfsHeaderSize(FileHeader);
+ if (ErasePolarity) {
+ memset (&BlankHeader, -1, HeaderSize);
+ } else {
+ memset (&BlankHeader, 0, HeaderSize);
+ }
+
+ if (memcmp (&BlankHeader, FileHeader, HeaderSize) == 0) {
+ return EFI_SUCCESS;
+ }
+ //
+ // Print file information.
+ //
+ printf ("============================================================\n");
+
+ printf ("File Name: ");
+ PrintGuidToBuffer (&FileHeader->Name, GuidBuffer, sizeof (GuidBuffer), TRUE);
+ printf ("%s ", GuidBuffer);
+ PrintGuidName (GuidBuffer);
+ printf ("\n");
+
+ //
+ // PrintGuid (&FileHeader->Name);
+ // printf ("\n");
+ //
+ FileLength = FvBufGetFfsFileSize (FileHeader);
+ printf ("File Offset: 0x%08X\n", (unsigned) ((UINTN) FileHeader - (UINTN) FvImage));
+ printf ("File Length: 0x%08X\n", (unsigned) FileLength);
+ printf ("File Attributes: 0x%02X\n", FileHeader->Attributes);
+ printf ("File State: 0x%02X\n", FileHeader->State);
+
+ //
+ // Print file state
+ //
+ FileState = GetFileState (ErasePolarity, FileHeader);
+
+ switch (FileState) {
+
+ case EFI_FILE_HEADER_CONSTRUCTION:
+ printf (" EFI_FILE_HEADER_CONSTRUCTION\n");
+ return EFI_SUCCESS;
+
+ case EFI_FILE_HEADER_INVALID:
+ printf (" EFI_FILE_HEADER_INVALID\n");
+ return EFI_SUCCESS;
+
+ case EFI_FILE_HEADER_VALID:
+ printf (" EFI_FILE_HEADER_VALID\n");
+ Checksum = CalculateSum8 ((UINT8 *) FileHeader, HeaderSize);
+ Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File);
+ Checksum = (UINT8) (Checksum - FileHeader->State);
+ if (Checksum != 0) {
+ printf ("ERROR: Header checksum invalid.\n");
+ return EFI_ABORTED;
+ }
+
+ return EFI_SUCCESS;
+
+ case EFI_FILE_DELETED:
+ printf (" EFI_FILE_DELETED\n");
+
+ case EFI_FILE_MARKED_FOR_UPDATE:
+ printf (" EFI_FILE_MARKED_FOR_UPDATE\n");
+
+ case EFI_FILE_DATA_VALID:
+ printf (" EFI_FILE_DATA_VALID\n");
+
+ //
+ // Calculate header checksum
+ //
+ Checksum = CalculateSum8 ((UINT8 *) FileHeader, HeaderSize);
+ Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File);
+ Checksum = (UINT8) (Checksum - FileHeader->State);
+ if (Checksum != 0) {
+ Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid header checksum", GuidBuffer);
+ return EFI_ABORTED;
+ }
+
+ FileLength = FvBufGetFfsFileSize (FileHeader);
+
+ if (FileHeader->Attributes & FFS_ATTRIB_CHECKSUM) {
+ //
+ // Calculate file checksum
+ //
+ Checksum = CalculateSum8 ((UINT8 *)FileHeader + HeaderSize, FileLength - HeaderSize);
+ Checksum = Checksum + FileHeader->IntegrityCheck.Checksum.File;
+ if (Checksum != 0) {
+ Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid file checksum", GuidBuffer);
+ return EFI_ABORTED;
+ }
+ } else {
+ if (FileHeader->IntegrityCheck.Checksum.File != FFS_FIXED_CHECKSUM) {
+ Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid header checksum -- not set to fixed value of 0xAA", GuidBuffer);
+ return EFI_ABORTED;
+ }
+ }
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
+ //
+ // Verify tail if present
+ //
+ if (FileHeader->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
+ //
+ // Verify tail is complement of integrity check field in the header.
+ //
+ Tail = (UINT16 *) ((UINTN) FileHeader + GetLength (FileHeader->Size) - sizeof (EFI_FFS_INTEGRITY_CHECK));
+ if (FileHeader->IntegrityCheck.TailReference != (UINT16)~(*Tail)) {
+ Error (NULL, 0, 0003, "error parsing FFS file", \
+ "FFS file with Guid %s failed in the integrity check, tail is not the complement of the header field", GuidBuffer);
+ return EFI_ABORTED;
+ }
+ }
+ #endif
+ break;
+
+ default:
+ Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has the invalid/unrecognized file state bits", GuidBuffer);
+ return EFI_ABORTED;
+ }
+
+ printf ("File Type: 0x%02X ", FileHeader->Type);
+
+ switch (FileHeader->Type) {
+
+ case EFI_FV_FILETYPE_RAW:
+ printf ("EFI_FV_FILETYPE_RAW\n");
+ break;
+
+ case EFI_FV_FILETYPE_FREEFORM:
+ printf ("EFI_FV_FILETYPE_FREEFORM\n");
+ break;
+
+ case EFI_FV_FILETYPE_SECURITY_CORE:
+ printf ("EFI_FV_FILETYPE_SECURITY_CORE\n");
+ break;
+
+ case EFI_FV_FILETYPE_PEI_CORE:
+ printf ("EFI_FV_FILETYPE_PEI_CORE\n");
+ break;
+
+ case EFI_FV_FILETYPE_DXE_CORE:
+ printf ("EFI_FV_FILETYPE_DXE_CORE\n");
+ break;
+
+ case EFI_FV_FILETYPE_PEIM:
+ printf ("EFI_FV_FILETYPE_PEIM\n");
+ break;
+
+ case EFI_FV_FILETYPE_DRIVER:
+ printf ("EFI_FV_FILETYPE_DRIVER\n");
+ break;
+
+ case EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER:
+ printf ("EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER\n");
+ break;
+
+ case EFI_FV_FILETYPE_APPLICATION:
+ printf ("EFI_FV_FILETYPE_APPLICATION\n");
+ break;
+
+ case EFI_FV_FILETYPE_SMM:
+ printf ("EFI_FV_FILETYPE_SMM\n");
+ break;
+
+ case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE:
+ printf ("EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE\n");
+ break;
+
+ case EFI_FV_FILETYPE_COMBINED_SMM_DXE:
+ printf ("EFI_FV_FILETYPE_COMBINED_SMM_DXE\n");
+ break;
+
+ case EFI_FV_FILETYPE_SMM_CORE:
+ printf ("EFI_FV_FILETYPE_SMM_CORE\n");
+ break;
+
+ case EFI_FV_FILETYPE_MM_STANDALONE:
+ printf ("EFI_FV_FILETYPE_MM_STANDALONE\n");
+ break;
+
+ case EFI_FV_FILETYPE_MM_CORE_STANDALONE:
+ printf ("EFI_FV_FILETYPE_MM_CORE_STANDALONE\n");
+ break;
+
+ case EFI_FV_FILETYPE_FFS_PAD:
+ printf ("EFI_FV_FILETYPE_FFS_PAD\n");
+ break;
+
+ default:
+ printf ("\nERROR: Unrecognized file type %X.\n", FileHeader->Type);
+ return EFI_ABORTED;
+ break;
+ }
+
+ switch (FileHeader->Type) {
+
+ case EFI_FV_FILETYPE_ALL:
+ case EFI_FV_FILETYPE_RAW:
+ case EFI_FV_FILETYPE_FFS_PAD:
+ break;
+
+ default:
+ //
+ // All other files have sections
+ //
+ Status = ParseSection (
+ (UINT8 *) ((UINTN) FileHeader + HeaderSize),
+ FvBufGetFfsFileSize (FileHeader) - HeaderSize
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // printf ("ERROR: Parsing the FFS file.\n");
+ //
+ return EFI_ABORTED;
+ }
+ break;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+RebaseImageRead (
+ IN VOID *FileHandle,
+ IN UINTN FileOffset,
+ IN OUT UINT32 *ReadSize,
+ OUT VOID *Buffer
+ )
+/*++
+
+Routine Description:
+
+ Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
+
+Arguments:
+
+ FileHandle - The handle to the PE/COFF file
+
+ FileOffset - The offset, in bytes, into the file to read
+
+ ReadSize - The number of bytes to read from the file starting at FileOffset
+
+ Buffer - A pointer to the buffer to read the data into.
+
+Returns:
+
+ EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
+
+--*/
+{
+ CHAR8 *Destination8;
+ CHAR8 *Source8;
+ UINT32 Length;
+
+ Destination8 = Buffer;
+ Source8 = (CHAR8 *) ((UINTN) FileHandle + FileOffset);
+ Length = *ReadSize;
+ while (Length--) {
+ *(Destination8++) = *(Source8++);
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+SetAddressToSectionHeader (
+ IN CHAR8 *FileName,
+ IN OUT UINT8 *FileBuffer,
+ IN UINT64 NewPe32BaseAddress
+ )
+/*++
+
+Routine Description:
+
+ Set new base address into the section header of PeImage
+
+Arguments:
+
+ FileName - Name of file
+ FileBuffer - Pointer to PeImage.
+ NewPe32BaseAddress - New Base Address for PE image.
+
+Returns:
+
+ EFI_SUCCESS Set new base address into this image successfully.
+
+--*/
+{
+ EFI_STATUS Status;
+ PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
+ UINTN Index;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
+ EFI_IMAGE_SECTION_HEADER *SectionHeader;
+
+ //
+ // Initialize context
+ //
+ memset (&ImageContext, 0, sizeof (ImageContext));
+ ImageContext.Handle = (VOID *) FileBuffer;
+ ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) RebaseImageRead;
+ Status = PeCoffLoaderGetImageInfo (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "The input PeImage %s is not valid", FileName);
+ return Status;
+ }
+
+ if (ImageContext.RelocationsStripped) {
+ Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
+ return Status;
+ }
+
+ //
+ // Get PeHeader pointer
+ //
+ ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(FileBuffer + ImageContext.PeCoffHeaderOffset);
+
+ //
+ // Get section header list
+ //
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
+ (UINTN) ImgHdr +
+ sizeof (UINT32) +
+ sizeof (EFI_IMAGE_FILE_HEADER) +
+ ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
+ );
+
+ //
+ // Set base address into the first section header that doesn't point to code section.
+ //
+ for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
+ if ((SectionHeader->Characteristics & EFI_IMAGE_SCN_CNT_CODE) == 0) {
+ *(UINT64 *) &SectionHeader->PointerToRelocations = NewPe32BaseAddress;
+ break;
+ }
+ }
+
+ //
+ // BaseAddress is set to section header.
+ //
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+RebaseImage (
+ IN CHAR8 *FileName,
+ IN OUT UINT8 *FileBuffer,
+ IN UINT64 NewPe32BaseAddress
+ )
+/*++
+
+Routine Description:
+
+ Set new base address into PeImage, and fix up PeImage based on new address.
+
+Arguments:
+
+ FileName - Name of file
+ FileBuffer - Pointer to PeImage.
+ NewPe32BaseAddress - New Base Address for PE image.
+
+Returns:
+
+ EFI_INVALID_PARAMETER - BaseAddress is not valid.
+ EFI_SUCCESS - Update PeImage is correctly.
+
+--*/
+{
+ EFI_STATUS Status;
+ PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
+ UINTN Index;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
+ UINT8 *MemoryImagePointer;
+ EFI_IMAGE_SECTION_HEADER *SectionHeader;
+
+ //
+ // Initialize context
+ //
+ memset (&ImageContext, 0, sizeof (ImageContext));
+ ImageContext.Handle = (VOID *) FileBuffer;
+ ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) RebaseImageRead;
+ Status = PeCoffLoaderGetImageInfo (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "The input PeImage %s is not valid", FileName);
+ return Status;
+ }
+
+ if (ImageContext.RelocationsStripped) {
+ Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
+ return Status;
+ }
+
+ //
+ // Get PeHeader pointer
+ //
+ ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(FileBuffer + ImageContext.PeCoffHeaderOffset);
+
+ //
+ // Load and Relocate Image Data
+ //
+ MemoryImagePointer = (UINT8 *) malloc ((UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
+ if (MemoryImagePointer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ memset ((VOID *) MemoryImagePointer, 0, (UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
+ ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~((INT64)ImageContext.SectionAlignment - 1));
+
+ Status = PeCoffLoaderLoadImage (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "LocateImage() call failed on rebase of %s", FileName);
+ free ((VOID *) MemoryImagePointer);
+ return Status;
+ }
+
+ ImageContext.DestinationAddress = NewPe32BaseAddress;
+ Status = PeCoffLoaderRelocateImage (&ImageContext);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "RelocateImage() call failed on rebase of %s", FileName);
+ free ((VOID *) MemoryImagePointer);
+ return Status;
+ }
+
+ //
+ // Copy Relocated data to raw image file.
+ //
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
+ (UINTN) ImgHdr +
+ sizeof (UINT32) +
+ sizeof (EFI_IMAGE_FILE_HEADER) +
+ ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
+ );
+
+ for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
+ CopyMem (
+ FileBuffer + SectionHeader->PointerToRawData,
+ (VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
+ SectionHeader->SizeOfRawData
+ );
+ }
+
+ free ((VOID *) MemoryImagePointer);
+
+ //
+ // Update Image Base Address
+ //
+ if (ImgHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ ImgHdr->Pe32.OptionalHeader.ImageBase = (UINT32) NewPe32BaseAddress;
+ } else if (ImgHdr->Pe32Plus.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
+ ImgHdr->Pe32Plus.OptionalHeader.ImageBase = NewPe32BaseAddress;
+ } else {
+ Error (NULL, 0, 3000, "Invalid", "unknown PE magic signature %X in PE32 image %s",
+ ImgHdr->Pe32.OptionalHeader.Magic,
+ FileName
+ );
+ return EFI_ABORTED;
+ }
+
+ //
+ // Set new base address into section header
+ //
+ Status = SetAddressToSectionHeader (FileName, FileBuffer, NewPe32BaseAddress);
+
+ return Status;
+}
+
+EFI_STATUS
+CombinePath (
+ IN CHAR8* DefaultPath,
+ IN CHAR8* AppendPath,
+ OUT CHAR8* NewPath
+)
+{
+ UINT32 DefaultPathLen;
+ UINT64 Index;
+ CHAR8 QuotesStr[] = "\"";
+ strcpy(NewPath, QuotesStr);
+ DefaultPathLen = strlen(DefaultPath);
+ strcat(NewPath, DefaultPath);
+ Index = 0;
+ for (; Index < DefaultPathLen + 1; Index ++) {
+ if (NewPath[Index] == '\\' || NewPath[Index] == '/') {
+ if (NewPath[Index + 1] != '\0') {
+ NewPath[Index] = '/';
+ }
+ }
+ }
+ if (NewPath[Index -1] != '/') {
+ NewPath[Index] = '/';
+ NewPath[Index + 1] = '\0';
+ }
+ strcat(NewPath, AppendPath);
+ strcat(NewPath, QuotesStr);
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+ParseSection (
+ IN UINT8 *SectionBuffer,
+ IN UINT32 BufferLength
+ )
+/*++
+
+Routine Description:
+
+ Parses EFI Sections
+
+Arguments:
+
+ SectionBuffer - Buffer containing the section to parse.
+ BufferLength - Length of SectionBuffer
+
+Returns:
+
+ EFI_SECTION_ERROR - Problem with section parsing.
+ (a) compression errors
+ (b) unrecognized section
+ EFI_UNSUPPORTED - Do not know how to parse the section.
+ EFI_SUCCESS - Section successfully parsed.
+ EFI_OUT_OF_RESOURCES - Memory allocation failed.
+
+--*/
+{
+ EFI_SECTION_TYPE Type;
+ UINT8 *Ptr;
+ UINT32 SectionLength;
+ UINT32 SectionHeaderLen;
+ CHAR8 *SectionName;
+ EFI_STATUS Status;
+ UINT32 ParsedLength;
+ UINT8 *CompressedBuffer;
+ UINT32 CompressedLength;
+ UINT8 *UncompressedBuffer;
+ UINT32 UncompressedLength;
+ UINT8 *ToolOutputBuffer;
+ UINT32 ToolOutputLength;
+ UINT8 CompressionType;
+ UINT32 DstSize;
+ UINT32 ScratchSize;
+ UINT8 *ScratchBuffer;
+ DECOMPRESS_FUNCTION DecompressFunction;
+ GETINFO_FUNCTION GetInfoFunction;
+ // CHAR16 *name;
+ CHAR8 *ExtractionTool;
+ CHAR8 *ToolInputFile;
+ CHAR8 *ToolOutputFile;
+ CHAR8 *SystemCommand;
+ EFI_GUID *EfiGuid;
+ UINT16 DataOffset;
+ UINT16 Attributes;
+ UINT32 RealHdrLen;
+ CHAR8 *ToolInputFileName;
+ CHAR8 *ToolOutputFileName;
+ CHAR8 *UIFileName;
+
+ ParsedLength = 0;
+ ToolInputFileName = NULL;
+ ToolOutputFileName = NULL;
+
+ while (ParsedLength < BufferLength) {
+ Ptr = SectionBuffer + ParsedLength;
+
+ SectionLength = GetLength (((EFI_COMMON_SECTION_HEADER *) Ptr)->Size);
+ Type = ((EFI_COMMON_SECTION_HEADER *) Ptr)->Type;
+
+ //
+ // This is sort of an odd check, but is necessary because FFS files are
+ // padded to a QWORD boundary, meaning there is potentially a whole section
+ // header worth of 0xFF bytes.
+ //
+ if (SectionLength == 0xffffff && Type == 0xff) {
+ ParsedLength += 4;
+ continue;
+ }
+
+ //
+ // Get real section file size
+ //
+ SectionLength = GetSectionFileLength ((EFI_COMMON_SECTION_HEADER *) Ptr);
+ SectionHeaderLen = GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER *)Ptr);
+
+ SectionName = SectionNameToStr (Type);
+ if (SectionName != NULL) {
+ printf ("------------------------------------------------------------\n");
+ printf (" Type: %s\n Size: 0x%08X\n", SectionName, (unsigned) SectionLength);
+ free (SectionName);
+ }
+
+ switch (Type) {
+ case EFI_SECTION_RAW:
+ case EFI_SECTION_PIC:
+ case EFI_SECTION_TE:
+ // default is no more information
+ break;
+
+ case EFI_SECTION_PE32:
+ if (EnableHash) {
+ ToolInputFileName = "edk2Temp_InputEfi.tmp";
+ ToolOutputFileName = "edk2Temp_OutputHash.tmp";
+ RebaseImage(ToolInputFileName, (UINT8*)Ptr + SectionHeaderLen, 0);
+ PutFileImage (
+ ToolInputFileName,
+ (CHAR8*)Ptr + SectionHeaderLen,
+ SectionLength - SectionHeaderLen
+ );
+
+ SystemCommand = malloc (
+ strlen (OPENSSL_COMMAND_FORMAT_STRING) +
+ strlen (OpenSslPath) +
+ strlen (ToolInputFileName) +
+ strlen (ToolOutputFileName) +
+ 1
+ );
+ if (SystemCommand == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return EFI_OUT_OF_RESOURCES;
+ }
+ sprintf (
+ SystemCommand,
+ OPENSSL_COMMAND_FORMAT_STRING,
+ OpenSslPath,
+ ToolOutputFileName,
+ ToolInputFileName
+ );
+
+ if (system (SystemCommand) != EFI_SUCCESS) {
+ Error (NULL, 0, 3000, "Open SSL command not available. Please verify PATH or set OPENSSL_PATH.", NULL);
+ }
+ else {
+ FILE *fp;
+ CHAR8 *StrLine;
+ CHAR8 *NewStr;
+ UINT32 nFileLen;
+ if((fp = fopen(ToolOutputFileName,"r")) == NULL) {
+ Error (NULL, 0, 0004, "Hash the PE32 image failed.", NULL);
+ }
+ else {
+ fseek(fp,0,SEEK_SET);
+ fseek(fp,0,SEEK_END);
+ nFileLen = ftell(fp);
+ fseek(fp,0,SEEK_SET);
+ StrLine = malloc(nFileLen);
+ if (StrLine == NULL) {
+ fclose(fp);
+ free (SystemCommand);
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return EFI_OUT_OF_RESOURCES;
+ }
+ fgets(StrLine, nFileLen, fp);
+ NewStr = strrchr (StrLine, '=');
+ printf (" SHA1: %s\n", NewStr + 1);
+ free (StrLine);
+ fclose(fp);
+ }
+ }
+ remove(ToolInputFileName);
+ remove(ToolOutputFileName);
+ free (SystemCommand);
+ }
+ break;
+
+ case EFI_SECTION_USER_INTERFACE:
+ UIFileName = (CHAR8 *) malloc (UnicodeStrLen (((EFI_USER_INTERFACE_SECTION *) Ptr)->FileNameString) + 1);
+ if (UIFileName == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return EFI_OUT_OF_RESOURCES;
+ }
+ Unicode2AsciiString (((EFI_USER_INTERFACE_SECTION *) Ptr)->FileNameString, UIFileName);
+ printf (" String: %s\n", UIFileName);
+ free (UIFileName);
+ break;
+
+ case EFI_SECTION_FIRMWARE_VOLUME_IMAGE:
+ Status = PrintFvInfo (Ptr + SectionHeaderLen, TRUE);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "printing of FV section contents failed", NULL);
+ return EFI_SECTION_ERROR;
+ }
+ break;
+
+ case EFI_SECTION_COMPATIBILITY16:
+ case EFI_SECTION_FREEFORM_SUBTYPE_GUID:
+ //
+ // Section does not contain any further header information.
+ //
+ break;
+
+ case EFI_SECTION_PEI_DEPEX:
+ case EFI_SECTION_DXE_DEPEX:
+ case EFI_SECTION_SMM_DEPEX:
+ DumpDepexSection (Ptr, SectionLength);
+ break;
+
+ case EFI_SECTION_VERSION:
+ printf (" Build Number: 0x%02X\n", *(UINT16 *)(Ptr + SectionHeaderLen));
+ printf (" Version Strg: %s\n", (char*) (Ptr + SectionHeaderLen + sizeof (UINT16)));
+ break;
+
+ case EFI_SECTION_COMPRESSION:
+ UncompressedBuffer = NULL;
+ if (SectionHeaderLen == sizeof (EFI_COMMON_SECTION_HEADER)) {
+ RealHdrLen = sizeof(EFI_COMPRESSION_SECTION);
+ UncompressedLength = ((EFI_COMPRESSION_SECTION *)Ptr)->UncompressedLength;
+ CompressionType = ((EFI_COMPRESSION_SECTION *)Ptr)->CompressionType;
+ } else {
+ RealHdrLen = sizeof(EFI_COMPRESSION_SECTION2);
+ UncompressedLength = ((EFI_COMPRESSION_SECTION2 *)Ptr)->UncompressedLength;
+ CompressionType = ((EFI_COMPRESSION_SECTION2 *)Ptr)->CompressionType;
+ }
+ CompressedLength = SectionLength - RealHdrLen;
+ printf (" Uncompressed Length: 0x%08X\n", (unsigned) UncompressedLength);
+
+ if (CompressionType == EFI_NOT_COMPRESSED) {
+ printf (" Compression Type: EFI_NOT_COMPRESSED\n");
+ if (CompressedLength != UncompressedLength) {
+ Error (
+ NULL,
+ 0,
+ 0,
+ "file is not compressed, but the compressed length does not match the uncompressed length",
+ NULL
+ );
+ return EFI_SECTION_ERROR;
+ }
+
+ UncompressedBuffer = Ptr + RealHdrLen;
+ } else if (CompressionType == EFI_STANDARD_COMPRESSION) {
+ GetInfoFunction = EfiGetInfo;
+ DecompressFunction = EfiDecompress;
+ printf (" Compression Type: EFI_STANDARD_COMPRESSION\n");
+
+ CompressedBuffer = Ptr + RealHdrLen;
+
+ Status = GetInfoFunction (CompressedBuffer, CompressedLength, &DstSize, &ScratchSize);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "error getting compression info from compression section", NULL);
+ return EFI_SECTION_ERROR;
+ }
+
+ if (DstSize != UncompressedLength) {
+ Error (NULL, 0, 0003, "compression error in the compression section", NULL);
+ return EFI_SECTION_ERROR;
+ }
+
+ ScratchBuffer = malloc (ScratchSize);
+ if (ScratchBuffer == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return EFI_OUT_OF_RESOURCES;
+ }
+ UncompressedBuffer = malloc (UncompressedLength);
+ if (UncompressedBuffer == NULL) {
+ free (ScratchBuffer);
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return EFI_OUT_OF_RESOURCES;
+ }
+ Status = DecompressFunction (
+ CompressedBuffer,
+ CompressedLength,
+ UncompressedBuffer,
+ UncompressedLength,
+ ScratchBuffer,
+ ScratchSize
+ );
+ free (ScratchBuffer);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "decompress failed", NULL);
+ free (UncompressedBuffer);
+ return EFI_SECTION_ERROR;
+ }
+ } else {
+ Error (NULL, 0, 0003, "unrecognized compression type", "type 0x%X", CompressionType);
+ return EFI_SECTION_ERROR;
+ }
+
+ Status = ParseSection (UncompressedBuffer, UncompressedLength);
+
+ if (CompressionType == EFI_STANDARD_COMPRESSION) {
+ //
+ // We need to deallocate Buffer
+ //
+ free (UncompressedBuffer);
+ }
+
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "failed to parse section", NULL);
+ return EFI_SECTION_ERROR;
+ }
+ break;
+
+ case EFI_SECTION_GUID_DEFINED:
+ if (SectionHeaderLen == sizeof(EFI_COMMON_SECTION_HEADER)) {
+ EfiGuid = &((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid;
+ DataOffset = ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset;
+ Attributes = ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes;
+ } else {
+ EfiGuid = &((EFI_GUID_DEFINED_SECTION2 *) Ptr)->SectionDefinitionGuid;
+ DataOffset = ((EFI_GUID_DEFINED_SECTION2 *) Ptr)->DataOffset;
+ Attributes = ((EFI_GUID_DEFINED_SECTION2 *) Ptr)->Attributes;
+ }
+ printf (" SectionDefinitionGuid: ");
+ PrintGuid (EfiGuid);
+ printf ("\n");
+ printf (" DataOffset: 0x%04X\n", (unsigned) DataOffset);
+ printf (" Attributes: 0x%04X\n", (unsigned) Attributes);
+
+ ExtractionTool =
+ LookupGuidedSectionToolPath (
+ mParsedGuidedSectionTools,
+ EfiGuid
+ );
+
+ if (ExtractionTool != NULL) {
+ #ifndef __GNUC__
+ ToolInputFile = CloneString (tmpnam (NULL));
+ ToolOutputFile = CloneString (tmpnam (NULL));
+ #else
+ char tmp1[] = "/tmp/fileXXXXXX";
+ char tmp2[] = "/tmp/fileXXXXXX";
+ int fd1;
+ int fd2;
+ fd1 = mkstemp(tmp1);
+ fd2 = mkstemp(tmp2);
+ ToolInputFile = CloneString(tmp1);
+ ToolOutputFile = CloneString(tmp2);
+ close(fd1);
+ close(fd2);
+ #endif
+
+ if ((ToolInputFile == NULL) || (ToolOutputFile == NULL)) {
+ if (ToolInputFile != NULL) {
+ free (ToolInputFile);
+ }
+ if (ToolOutputFile != NULL) {
+ free (ToolOutputFile);
+ }
+ free (ExtractionTool);
+
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Construction 'system' command string
+ //
+ SystemCommand = malloc (
+ strlen (EXTRACT_COMMAND_FORMAT_STRING) +
+ strlen (ExtractionTool) +
+ strlen (ToolInputFile) +
+ strlen (ToolOutputFile) +
+ 1
+ );
+ if (SystemCommand == NULL) {
+ free (ToolInputFile);
+ free (ToolOutputFile);
+ free (ExtractionTool);
+
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return EFI_OUT_OF_RESOURCES;
+ }
+ sprintf (
+ SystemCommand,
+ EXTRACT_COMMAND_FORMAT_STRING,
+ ExtractionTool,
+ ToolOutputFile,
+ ToolInputFile
+ );
+ free (ExtractionTool);
+
+ Status =
+ PutFileImage (
+ ToolInputFile,
+ (CHAR8*) SectionBuffer + DataOffset,
+ BufferLength - DataOffset
+ );
+
+ system (SystemCommand);
+ remove (ToolInputFile);
+ free (ToolInputFile);
+
+ Status =
+ GetFileImage (
+ ToolOutputFile,
+ (CHAR8 **)&ToolOutputBuffer,
+ &ToolOutputLength
+ );
+ remove (ToolOutputFile);
+ free (ToolOutputFile);
+ free (SystemCommand);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0004, "unable to read decoded GUIDED section", NULL);
+ return EFI_SECTION_ERROR;
+ }
+
+ Status = ParseSection (
+ ToolOutputBuffer,
+ ToolOutputLength
+ );
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "parse of decoded GUIDED section failed", NULL);
+ return EFI_SECTION_ERROR;
+ }
+
+ //
+ // Check for CRC32 sections which we can handle internally if needed.
+ //
+ } else if (!CompareGuid (
+ EfiGuid,
+ &gEfiCrc32GuidedSectionExtractionProtocolGuid
+ )
+ ) {
+ //
+ // CRC32 guided section
+ //
+ Status = ParseSection (
+ SectionBuffer + DataOffset,
+ BufferLength - DataOffset
+ );
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 0003, "parse of CRC32 GUIDED section failed", NULL);
+ return EFI_SECTION_ERROR;
+ }
+ } else {
+ //
+ // We don't know how to parse it now.
+ //
+ Error (NULL, 0, 0003, "Error parsing section", \
+ "EFI_SECTION_GUID_DEFINED cannot be parsed at this time. Tool to decode this section should have been defined in GuidedSectionTools.txt (built in the FV directory).");
+ return EFI_UNSUPPORTED;
+ }
+ break;
+
+ default:
+ //
+ // Unknown section, return error
+ //
+ Error (NULL, 0, 0003, "unrecognized section type found", "section type = 0x%X", Type);
+ return EFI_SECTION_ERROR;
+ }
+
+ ParsedLength += SectionLength;
+ //
+ // We make then next section begin on a 4-byte boundary
+ //
+ ParsedLength = GetOccupiedSize (ParsedLength, 4);
+ }
+
+ if (ParsedLength < BufferLength) {
+ Error (NULL, 0, 0003, "sections do not completely fill the sectioned buffer being parsed", NULL);
+ return EFI_SECTION_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+DumpDepexSection (
+ IN UINT8 *Ptr,
+ IN UINT32 SectionLength
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+ Ptr - GC_TODO: add argument description
+ SectionLength - GC_TODO: add argument description
+
+Returns:
+
+ EFI_SUCCESS - GC_TODO: Add description for return value
+
+--*/
+{
+ UINT8 GuidBuffer[PRINTED_GUID_BUFFER_SIZE];
+
+ //
+ // Need at least a section header + data
+ //
+ if (SectionLength <= sizeof (EFI_COMMON_SECTION_HEADER)) {
+ return EFI_SUCCESS;
+ }
+
+ Ptr += GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER *)Ptr);
+ SectionLength -= GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER *)Ptr);
+ while (SectionLength > 0) {
+ printf (" ");
+ switch (*Ptr) {
+ case EFI_DEP_BEFORE:
+ printf ("BEFORE\n");
+ Ptr++;
+ SectionLength--;
+ break;
+
+ case EFI_DEP_AFTER:
+ printf ("AFTER\n");
+ Ptr++;
+ SectionLength--;
+ break;
+
+ case EFI_DEP_PUSH:
+ printf ("PUSH\n ");
+ PrintGuidToBuffer ((EFI_GUID *) (Ptr + 1), GuidBuffer, sizeof (GuidBuffer), TRUE);
+ printf ("%s ", GuidBuffer);
+ PrintGuidName (GuidBuffer);
+ printf ("\n");
+ //
+ // PrintGuid ((EFI_GUID *)(Ptr + 1));
+ //
+ Ptr += 17;
+ SectionLength -= 17;
+ break;
+
+ case EFI_DEP_AND:
+ printf ("AND\n");
+ Ptr++;
+ SectionLength--;
+ break;
+
+ case EFI_DEP_OR:
+ printf ("OR\n");
+ Ptr++;
+ SectionLength--;
+ break;
+
+ case EFI_DEP_NOT:
+ printf ("NOT\n");
+ Ptr++;
+ SectionLength--;
+ break;
+
+ case EFI_DEP_TRUE:
+ printf ("TRUE\n");
+ Ptr++;
+ SectionLength--;
+ break;
+
+ case EFI_DEP_FALSE:
+ printf ("FALSE\n");
+ Ptr++;
+ SectionLength--;
+ break;
+
+ case EFI_DEP_END:
+ printf ("END DEPEX\n");
+ Ptr++;
+ SectionLength--;
+ break;
+
+ case EFI_DEP_SOR:
+ printf ("SOR\n");
+ Ptr++;
+ SectionLength--;
+ break;
+
+ default:
+ printf ("Unrecognized byte in depex: 0x%X\n", *Ptr);
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+PrintGuidName (
+ IN UINT8 *GuidStr
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+ GuidStr - GC_TODO: add argument description
+
+Returns:
+
+ EFI_SUCCESS - GC_TODO: Add description for return value
+ EFI_INVALID_PARAMETER - GC_TODO: Add description for return value
+
+--*/
+{
+ GUID_TO_BASENAME *GPtr;
+ //
+ // If we have a list of guid-to-basenames, then go through the list to
+ // look for a guid string match. If found, print the basename to stdout,
+ // otherwise return a failure.
+ //
+ GPtr = mGuidBaseNameList;
+ while (GPtr != NULL) {
+ if (_stricmp ((CHAR8*) GuidStr, (CHAR8*) GPtr->Guid) == 0) {
+ printf ("%s", GPtr->BaseName);
+ return EFI_SUCCESS;
+ }
+
+ GPtr = GPtr->Next;
+ }
+
+ return EFI_INVALID_PARAMETER;
+}
+
+EFI_STATUS
+ParseGuidBaseNameFile (
+ CHAR8 *FileName
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+ FileName - GC_TODO: add argument description
+
+Returns:
+
+ EFI_DEVICE_ERROR - GC_TODO: Add description for return value
+ EFI_OUT_OF_RESOURCES - GC_TODO: Add description for return value
+ EFI_SUCCESS - GC_TODO: Add description for return value
+
+--*/
+{
+ FILE *Fptr;
+ CHAR8 Line[MAX_LINE_LEN];
+ CHAR8 FormatString[MAX_LINE_LEN];
+ GUID_TO_BASENAME *GPtr;
+
+ if ((Fptr = fopen (LongFilePath (FileName), "r")) == NULL) {
+ printf ("ERROR: Failed to open input cross-reference file '%s'\n", FileName);
+ return EFI_DEVICE_ERROR;
+ }
+
+ //
+ // Generate the format string for fscanf
+ //
+ sprintf (
+ FormatString,
+ "%%%us %%%us",
+ (unsigned) sizeof (GPtr->Guid) - 1,
+ (unsigned) sizeof (GPtr->BaseName) - 1
+ );
+
+ while (fgets (Line, sizeof (Line), Fptr) != NULL) {
+ //
+ // Allocate space for another guid/basename element
+ //
+ GPtr = malloc (sizeof (GUID_TO_BASENAME));
+ if (GPtr == NULL) {
+ fclose (Fptr);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ memset ((char *) GPtr, 0, sizeof (GUID_TO_BASENAME));
+ if (sscanf (Line, FormatString, GPtr->Guid, GPtr->BaseName) == 2) {
+ GPtr->Next = mGuidBaseNameList;
+ mGuidBaseNameList = GPtr;
+ } else {
+ //
+ // Some sort of error. Just continue.
+ //
+ free (GPtr);
+ }
+ }
+
+ fclose (Fptr);
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+FreeGuidBaseNameList (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+ None
+
+Returns:
+
+ EFI_SUCCESS - GC_TODO: Add description for return value
+
+--*/
+{
+ GUID_TO_BASENAME *Next;
+
+ while (mGuidBaseNameList != NULL) {
+ Next = mGuidBaseNameList->Next;
+ free (mGuidBaseNameList);
+ mGuidBaseNameList = Next;
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+static
+VOID
+LoadGuidedSectionToolsTxt (
+ IN CHAR8* FirmwareVolumeFilename
+ )
+{
+ CHAR8* PeerFilename;
+ CHAR8* Places[] = {
+ NULL,
+ //NULL,
+ };
+ UINTN Index;
+
+ Places[0] = FirmwareVolumeFilename;
+ //Places[1] = mUtilityFilename;
+
+ mParsedGuidedSectionTools = NULL;
+
+ for (Index = 0; Index < (sizeof(Places)/sizeof(Places[0])); Index++) {
+ PeerFilename = OsPathPeerFilePath (Places[Index], "GuidedSectionTools.txt");
+ //printf("Loading %s...\n", PeerFilename);
+ if (OsPathExists (PeerFilename)) {
+ mParsedGuidedSectionTools = ParseGuidedSectionToolsFile (PeerFilename);
+ }
+ free (PeerFilename);
+ if (mParsedGuidedSectionTools != NULL) {
+ return;
+ }
+ }
+}
+
+
+void
+Usage (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ GC_TODO: Add function description
+
+Arguments:
+
+ None
+
+Returns:
+
+ GC_TODO: add return values
+
+--*/
+{
+ //
+ // Summary usage
+ //
+ fprintf (stdout, "Usage: %s [options] <input_file>\n\n", UTILITY_NAME);
+
+ //
+ // Copyright declaration
+ //
+ fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, " Display Tiano Firmware Volume FFS image information\n\n");
+
+ //
+ // Details Option
+ //
+ fprintf (stdout, "optional arguments:\n");
+ fprintf (stdout, " -h, --help\n\
+ Show this help message and exit\n");
+ fprintf (stdout, " --version\n\
+ Show program's version number and exit\n");
+ fprintf (stdout, " -d [DEBUG], --debug [DEBUG]\n\
+ Output DEBUG statements, where DEBUG_LEVEL is 0 (min) - 9 (max)\n");
+ fprintf (stdout, " -v, --verbose\n\
+ Print informational statements\n");
+ fprintf (stdout, " -q, --quiet\n\
+ Returns the exit code, error messages will be displayed\n");
+ fprintf (stdout, " -s, --silent\n\
+ Returns only the exit code; informational and error\n\
+ messages are not displayed\n");
+ fprintf (stdout, " -x XREF_FILENAME, --xref XREF_FILENAME\n\
+ Parse the basename to file-guid cross reference file(s)\n");
+ fprintf (stdout, " -f OFFSET, --offset OFFSET\n\
+ The offset from the start of the input file to start \n\
+ processing an FV\n");
+ fprintf (stdout, " --hash\n\
+ Generate HASH value of the entire PE image\n");
+ fprintf (stdout, " --sfo\n\
+ Reserved for future use\n");
+}
+
diff --git a/roms/edk2/BaseTools/Source/C/VolInfo/VolInfo.h b/roms/edk2/BaseTools/Source/C/VolInfo/VolInfo.h
new file mode 100644
index 000000000..624ac38f0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/C/VolInfo/VolInfo.h
@@ -0,0 +1,31 @@
+/** @file
+Local Definitions for the VolInfo utility
+
+Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _VOLINFO_H_
+#define _VOLINFO_H_ 1
+
+#define PI_SPECIFICATION_VERSION 0x00010000
+
+#define EFI_DEP_BEFORE 0x00
+#define EFI_DEP_AFTER 0x01
+#define EFI_DEP_PUSH 0x02
+#define EFI_DEP_AND 0x03
+#define EFI_DEP_OR 0x04
+#define EFI_DEP_NOT 0x05
+#define EFI_DEP_TRUE 0x06
+#define EFI_DEP_FALSE 0x07
+#define EFI_DEP_END 0x08
+#define EFI_DEP_SOR 0x09
+
+#define EFI_SECTION_LAST_LEAF_SECTION_TYPE 0x1B
+#define EFI_SECTION_LAST_SECTION_TYPE 0x1B
+
+#define OPENSSL_COMMAND_FORMAT_STRING "%s sha1 -out %s %s"
+#define EXTRACT_COMMAND_FORMAT_STRING "%s -d -o %s %s"
+
+#endif
diff --git a/roms/edk2/BaseTools/Source/Python/AmlToC/AmlToC.py b/roms/edk2/BaseTools/Source/Python/AmlToC/AmlToC.py
new file mode 100644
index 000000000..346de7159
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AmlToC/AmlToC.py
@@ -0,0 +1,142 @@
+## @file
+#
+# Convert an AML file to a .c file containing the AML bytecode stored in a
+# C array.
+# By default, "Tables\Dsdt.aml" will generate "Tables\Dsdt.c".
+# "Tables\Dsdt.c" will contain a C array named "dsdt_aml_code" that contains
+# the AML bytecode.
+#
+# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+import argparse
+import Common.EdkLogger as EdkLogger
+from Common.BuildToolError import *
+import sys
+import os
+
+__description__ = """
+Convert an AML file to a .c file containing the AML bytecode stored in a C
+array. By default, Tables\Dsdt.aml will generate Tables\Dsdt.c.
+Tables\Dsdt.c will contain a C array named "dsdt_aml_code" that contains
+the AML bytecode.
+"""
+
+## Parse the command line arguments.
+#
+# @retval A argparse.NameSpace instance, containing parsed values.
+#
+def ParseArgs():
+ # Initialize the parser.
+ Parser = argparse.ArgumentParser(description=__description__)
+
+ # Define the possible arguments.
+ Parser.add_argument(dest="InputFile",
+ help="Path to an input AML file to generate a .c file from.")
+ Parser.add_argument("-o", "--out-dir", dest="OutDir",
+ help="Output directory where the .c file will be generated. Default is the input file's directory.")
+
+ # Parse the input arguments.
+ Args = Parser.parse_args()
+ SplitInputName = ""
+
+ if not os.path.exists(Args.InputFile):
+ EdkLogger.error(__file__, FILE_OPEN_FAILURE,
+ ExtraData=Args.InputFile)
+ return None
+ else:
+ with open(Args.InputFile, "rb") as fIn:
+ Signature = str(fIn.read(4))
+ if ("DSDT" not in Signature) and ("SSDT" not in Signature):
+ EdkLogger.info("Invalid file type. File does not have a valid DSDT or SSDT signature: {}".format(Args.InputFile))
+ return None
+
+ # Get the basename of the input file.
+ SplitInputName = os.path.splitext(Args.InputFile)
+ BaseName = os.path.basename(SplitInputName[0])
+
+ # If no output directory is specified, output to the input directory.
+ if not Args.OutDir:
+ Args.OutputFile = os.path.join(os.path.dirname(Args.InputFile),
+ BaseName + ".c")
+ else:
+ if not os.path.exists(Args.OutDir):
+ os.mkdir(Args.OutDir)
+ Args.OutputFile = os.path.join(Args.OutDir, BaseName + ".c")
+
+ Args.BaseName = BaseName
+
+ return Args
+
+## Convert an AML file to a .c file containing the AML bytecode stored
+# in a C array.
+#
+# @param InputFile Path to the input AML file.
+# @param OutputFile Path to the output .c file to generate.
+# @param BaseName Base name of the input file.
+# This is also the name of the generated .c file.
+#
+def AmlToC(InputFile, OutputFile, BaseName):
+
+ ArrayName = BaseName.lower() + "_aml_code"
+ FileHeader =\
+"""
+// This file has been generated from:
+// -Python script: {}
+// -Input AML file: {}
+
+"""
+
+ with open(InputFile, "rb") as fIn, open(OutputFile, "w") as fOut:
+ # Write header.
+ fOut.write(FileHeader.format(os.path.abspath(InputFile), os.path.abspath(__file__)))
+
+ # Write the array and its content.
+ fOut.write("unsigned char {}[] = {{\n ".format(ArrayName))
+ cnt = 0
+ byte = fIn.read(1)
+ while len(byte) != 0:
+ fOut.write("0x{0:02X}, ".format(ord(byte)))
+ cnt += 1
+ if (cnt % 8) == 0:
+ fOut.write("\n ")
+ byte = fIn.read(1)
+ fOut.write("\n};\n")
+
+## Main method
+#
+# This method:
+# 1- Initialize an EdkLogger instance.
+# 2- Parses the input arguments.
+# 3- Converts an AML file to a .c file containing the AML bytecode stored
+# in a C array.
+#
+# @retval 0 Success.
+# @retval 1 Error.
+#
+def Main():
+ # Initialize an EdkLogger instance.
+ EdkLogger.Initialize()
+
+ try:
+ # Parse the input arguments.
+ CommandArguments = ParseArgs()
+ if not CommandArguments:
+ return 1
+
+ # Convert an AML file to a .c file containing the AML bytecode stored
+ # in a C array.
+ AmlToC(CommandArguments.InputFile, CommandArguments.OutputFile, CommandArguments.BaseName)
+ except Exception as e:
+ print(e)
+ return 1
+
+ return 0
+
+if __name__ == '__main__':
+ r = Main()
+ # 0-127 is a safe return range, and 1 is a standard default error
+ if r < 0 or r > 127: r = 1
+ sys.exit(r)
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py b/roms/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py
new file mode 100644
index 000000000..d9ee699d8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -0,0 +1,113 @@
+## @file
+# Generate AutoGen.h, AutoGen.c and *.depex files
+#
+# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.<BR>
+# Copyright (c) 2019, American Megatrends, Inc. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+## Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+from Common.DataType import TAB_STAR
+## Base class for AutoGen
+#
+# This class just implements the cache mechanism of AutoGen objects.
+#
+class AutoGen(object):
+ # database to maintain the objects in each child class
+ __ObjectCache = {} # (BuildTarget, ToolChain, ARCH, platform file): AutoGen object
+
+ ## Factory method
+ #
+ # @param Class class object of real AutoGen class
+ # (WorkspaceAutoGen, ModuleAutoGen or PlatformAutoGen)
+ # @param Workspace Workspace directory or WorkspaceAutoGen object
+ # @param MetaFile The path of meta file
+ # @param Target Build target
+ # @param Toolchain Tool chain name
+ # @param Arch Target arch
+ # @param *args The specific class related parameters
+ # @param **kwargs The specific class related dict parameters
+ #
+
+ def __new__(cls, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs):
+ # check if the object has been created
+ Key = (Target, Toolchain, Arch, MetaFile)
+ if Key in cls.__ObjectCache:
+ # if it exists, just return it directly
+ return cls.__ObjectCache[Key]
+ # it didnt exist. create it, cache it, then return it
+ RetVal = cls.__ObjectCache[Key] = super(AutoGen, cls).__new__(cls)
+ return RetVal
+
+
+ ## hash() operator
+ #
+ # The file path of platform file will be used to represent hash value of this object
+ #
+ # @retval int Hash value of the file path of platform file
+ #
+ def __hash__(self):
+ return hash(self.MetaFile)
+
+ ## str() operator
+ #
+ # The file path of platform file will be used to represent this object
+ #
+ # @retval string String of platform file path
+ #
+ def __str__(self):
+ return str(self.MetaFile)
+
+ ## "==" operator
+ def __eq__(self, Other):
+ return Other and self.MetaFile == Other
+
+ @classmethod
+ def Cache(cls):
+ return cls.__ObjectCache
+
+#
+# The priority list while override build option
+#
+PrioList = {"0x11111" : 16, # TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE (Highest)
+ "0x01111" : 15, # ******_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE
+ "0x10111" : 14, # TARGET_*********_ARCH_COMMANDTYPE_ATTRIBUTE
+ "0x00111" : 13, # ******_*********_ARCH_COMMANDTYPE_ATTRIBUTE
+ "0x11011" : 12, # TARGET_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE
+ "0x01011" : 11, # ******_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE
+ "0x10011" : 10, # TARGET_*********_****_COMMANDTYPE_ATTRIBUTE
+ "0x00011" : 9, # ******_*********_****_COMMANDTYPE_ATTRIBUTE
+ "0x11101" : 8, # TARGET_TOOLCHAIN_ARCH_***********_ATTRIBUTE
+ "0x01101" : 7, # ******_TOOLCHAIN_ARCH_***********_ATTRIBUTE
+ "0x10101" : 6, # TARGET_*********_ARCH_***********_ATTRIBUTE
+ "0x00101" : 5, # ******_*********_ARCH_***********_ATTRIBUTE
+ "0x11001" : 4, # TARGET_TOOLCHAIN_****_***********_ATTRIBUTE
+ "0x01001" : 3, # ******_TOOLCHAIN_****_***********_ATTRIBUTE
+ "0x10001" : 2, # TARGET_*********_****_***********_ATTRIBUTE
+ "0x00001" : 1} # ******_*********_****_***********_ATTRIBUTE (Lowest)
+## Calculate the priority value of the build option
+#
+# @param Key Build option definition contain: TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE
+#
+# @retval Value Priority value based on the priority list.
+#
+def CalculatePriorityValue(Key):
+ Target, ToolChain, Arch, CommandType, Attr = Key.split('_')
+ PriorityValue = 0x11111
+ if Target == TAB_STAR:
+ PriorityValue &= 0x01111
+ if ToolChain == TAB_STAR:
+ PriorityValue &= 0x10111
+ if Arch == TAB_STAR:
+ PriorityValue &= 0x11011
+ if CommandType == TAB_STAR:
+ PriorityValue &= 0x11101
+ if Attr == TAB_STAR:
+ PriorityValue &= 0x11110
+
+ return PrioList["0x%0.5x" % PriorityValue]
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/AutoGenWorker.py b/roms/edk2/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
new file mode 100755
index 000000000..0425f1ab0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
@@ -0,0 +1,329 @@
+## @file
+# Create makefile for MS nmake and GNU make
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+from __future__ import absolute_import
+import multiprocessing as mp
+import threading
+from Common.Misc import PathClass
+from AutoGen.ModuleAutoGen import ModuleAutoGen
+from AutoGen.ModuleAutoGenHelper import WorkSpaceInfo,AutoGenInfo
+import Common.GlobalData as GlobalData
+import Common.EdkLogger as EdkLogger
+import os
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+from AutoGen.AutoGen import AutoGen
+from Workspace.WorkspaceDatabase import BuildDB
+try:
+ from queue import Empty
+except:
+ from Queue import Empty
+import traceback
+import sys
+from AutoGen.DataPipe import MemoryDataPipe
+import logging
+import time
+
+def clearQ(q):
+ try:
+ while True:
+ q.get_nowait()
+ except Empty:
+ pass
+
+class LogAgent(threading.Thread):
+ def __init__(self,log_q,log_level,log_file=None):
+ super(LogAgent,self).__init__()
+ self.log_q = log_q
+ self.log_level = log_level
+ self.log_file = log_file
+ def InitLogger(self):
+ # For DEBUG level (All DEBUG_0~9 are applicable)
+ self._DebugLogger_agent = logging.getLogger("tool_debug_agent")
+ _DebugFormatter = logging.Formatter("[%(asctime)s.%(msecs)d]: %(message)s", datefmt="%H:%M:%S")
+ self._DebugLogger_agent.setLevel(self.log_level)
+ _DebugChannel = logging.StreamHandler(sys.stdout)
+ _DebugChannel.setFormatter(_DebugFormatter)
+ self._DebugLogger_agent.addHandler(_DebugChannel)
+
+ # For VERBOSE, INFO, WARN level
+ self._InfoLogger_agent = logging.getLogger("tool_info_agent")
+ _InfoFormatter = logging.Formatter("%(message)s")
+ self._InfoLogger_agent.setLevel(self.log_level)
+ _InfoChannel = logging.StreamHandler(sys.stdout)
+ _InfoChannel.setFormatter(_InfoFormatter)
+ self._InfoLogger_agent.addHandler(_InfoChannel)
+
+ # For ERROR level
+ self._ErrorLogger_agent = logging.getLogger("tool_error_agent")
+ _ErrorFormatter = logging.Formatter("%(message)s")
+ self._ErrorLogger_agent.setLevel(self.log_level)
+ _ErrorCh = logging.StreamHandler(sys.stderr)
+ _ErrorCh.setFormatter(_ErrorFormatter)
+ self._ErrorLogger_agent.addHandler(_ErrorCh)
+
+ if self.log_file:
+ if os.path.exists(self.log_file):
+ os.remove(self.log_file)
+ _Ch = logging.FileHandler(self.log_file)
+ _Ch.setFormatter(_DebugFormatter)
+ self._DebugLogger_agent.addHandler(_Ch)
+
+ _Ch= logging.FileHandler(self.log_file)
+ _Ch.setFormatter(_InfoFormatter)
+ self._InfoLogger_agent.addHandler(_Ch)
+
+ _Ch = logging.FileHandler(self.log_file)
+ _Ch.setFormatter(_ErrorFormatter)
+ self._ErrorLogger_agent.addHandler(_Ch)
+
+ def run(self):
+ self.InitLogger()
+ while True:
+ log_message = self.log_q.get()
+ if log_message is None:
+ break
+ if log_message.name == "tool_error":
+ self._ErrorLogger_agent.log(log_message.levelno,log_message.getMessage())
+ elif log_message.name == "tool_info":
+ self._InfoLogger_agent.log(log_message.levelno,log_message.getMessage())
+ elif log_message.name == "tool_debug":
+ self._DebugLogger_agent.log(log_message.levelno,log_message.getMessage())
+ else:
+ self._InfoLogger_agent.log(log_message.levelno,log_message.getMessage())
+
+ def kill(self):
+ self.log_q.put(None)
+class AutoGenManager(threading.Thread):
+ def __init__(self,autogen_workers, feedback_q,error_event):
+ super(AutoGenManager,self).__init__()
+ self.autogen_workers = autogen_workers
+ self.feedback_q = feedback_q
+ self.Status = True
+ self.error_event = error_event
+ def run(self):
+ try:
+ fin_num = 0
+ while True:
+ badnews = self.feedback_q.get()
+ if badnews is None:
+ break
+ if badnews == "Done":
+ fin_num += 1
+ elif badnews == "QueueEmpty":
+ EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), badnews))
+ self.TerminateWorkers()
+ else:
+ EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), badnews))
+ self.Status = False
+ self.TerminateWorkers()
+ if fin_num == len(self.autogen_workers):
+ self.clearQueue()
+ for w in self.autogen_workers:
+ w.join()
+ break
+ except Exception:
+ return
+
+ def clearQueue(self):
+ taskq = self.autogen_workers[0].module_queue
+ logq = self.autogen_workers[0].log_q
+ clearQ(taskq)
+ clearQ(self.feedback_q)
+ clearQ(logq)
+ # Copy the cache queue itmes to parent thread before clear
+ cacheq = self.autogen_workers[0].cache_q
+ try:
+ cache_num = 0
+ while True:
+ item = cacheq.get()
+ if item == "CacheDone":
+ cache_num += 1
+ else:
+ GlobalData.gModuleAllCacheStatus.add(item)
+ if cache_num == len(self.autogen_workers):
+ break
+ except:
+ print ("cache_q error")
+
+ def TerminateWorkers(self):
+ self.error_event.set()
+ def kill(self):
+ self.feedback_q.put(None)
+class AutoGenWorkerInProcess(mp.Process):
+ def __init__(self,module_queue,data_pipe_file_path,feedback_q,file_lock,cache_q,log_q,error_event):
+ mp.Process.__init__(self)
+ self.module_queue = module_queue
+ self.data_pipe_file_path =data_pipe_file_path
+ self.data_pipe = None
+ self.feedback_q = feedback_q
+ self.PlatformMetaFileSet = {}
+ self.file_lock = file_lock
+ self.cache_q = cache_q
+ self.log_q = log_q
+ self.error_event = error_event
+ def GetPlatformMetaFile(self,filepath,root):
+ try:
+ return self.PlatformMetaFileSet[(filepath,root)]
+ except:
+ self.PlatformMetaFileSet[(filepath,root)] = filepath
+ return self.PlatformMetaFileSet[(filepath,root)]
+ def run(self):
+ try:
+ taskname = "Init"
+ with self.file_lock:
+ try:
+ self.data_pipe = MemoryDataPipe()
+ self.data_pipe.load(self.data_pipe_file_path)
+ except:
+ self.feedback_q.put(taskname + ":" + "load data pipe %s failed." % self.data_pipe_file_path)
+ EdkLogger.LogClientInitialize(self.log_q)
+ loglevel = self.data_pipe.Get("LogLevel")
+ if not loglevel:
+ loglevel = EdkLogger.INFO
+ EdkLogger.SetLevel(loglevel)
+ target = self.data_pipe.Get("P_Info").get("Target")
+ toolchain = self.data_pipe.Get("P_Info").get("ToolChain")
+ archlist = self.data_pipe.Get("P_Info").get("ArchList")
+
+ active_p = self.data_pipe.Get("P_Info").get("ActivePlatform")
+ workspacedir = self.data_pipe.Get("P_Info").get("WorkspaceDir")
+ PackagesPath = os.getenv("PACKAGES_PATH")
+ mws.setWs(workspacedir, PackagesPath)
+ self.Wa = WorkSpaceInfo(
+ workspacedir,active_p,target,toolchain,archlist
+ )
+ self.Wa._SrcTimeStamp = self.data_pipe.Get("Workspace_timestamp")
+ GlobalData.gGlobalDefines = self.data_pipe.Get("G_defines")
+ GlobalData.gCommandLineDefines = self.data_pipe.Get("CL_defines")
+ os.environ._data = self.data_pipe.Get("Env_Var")
+ GlobalData.gWorkspace = workspacedir
+ GlobalData.gDisableIncludePathCheck = False
+ GlobalData.gFdfParser = self.data_pipe.Get("FdfParser")
+ GlobalData.gDatabasePath = self.data_pipe.Get("DatabasePath")
+
+ GlobalData.gUseHashCache = self.data_pipe.Get("UseHashCache")
+ GlobalData.gBinCacheSource = self.data_pipe.Get("BinCacheSource")
+ GlobalData.gBinCacheDest = self.data_pipe.Get("BinCacheDest")
+ GlobalData.gPlatformHashFile = self.data_pipe.Get("PlatformHashFile")
+ GlobalData.gModulePreMakeCacheStatus = dict()
+ GlobalData.gModuleMakeCacheStatus = dict()
+ GlobalData.gHashChainStatus = dict()
+ GlobalData.gCMakeHashFile = dict()
+ GlobalData.gModuleHashFile = dict()
+ GlobalData.gFileHashDict = dict()
+ GlobalData.gEnableGenfdsMultiThread = self.data_pipe.Get("EnableGenfdsMultiThread")
+ GlobalData.file_lock = self.file_lock
+ CommandTarget = self.data_pipe.Get("CommandTarget")
+ pcd_from_build_option = []
+ for pcd_tuple in self.data_pipe.Get("BuildOptPcd"):
+ pcd_id = ".".join((pcd_tuple[0],pcd_tuple[1]))
+ if pcd_tuple[2].strip():
+ pcd_id = ".".join((pcd_id,pcd_tuple[2]))
+ pcd_from_build_option.append("=".join((pcd_id,pcd_tuple[3])))
+ GlobalData.BuildOptionPcd = pcd_from_build_option
+ module_count = 0
+ FfsCmd = self.data_pipe.Get("FfsCommand")
+ if FfsCmd is None:
+ FfsCmd = {}
+ GlobalData.FfsCmd = FfsCmd
+ PlatformMetaFile = self.GetPlatformMetaFile(self.data_pipe.Get("P_Info").get("ActivePlatform"),
+ self.data_pipe.Get("P_Info").get("WorkspaceDir"))
+ while True:
+ if self.error_event.is_set():
+ break
+ module_count += 1
+ try:
+ module_file,module_root,module_path,module_basename,module_originalpath,module_arch,IsLib = self.module_queue.get_nowait()
+ except Empty:
+ EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), "Fake Empty."))
+ time.sleep(0.01)
+ continue
+ if module_file is None:
+ EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), "Worker get the last item in the queue."))
+ self.feedback_q.put("QueueEmpty")
+ time.sleep(0.01)
+ continue
+
+ modulefullpath = os.path.join(module_root,module_file)
+ taskname = " : ".join((modulefullpath,module_arch))
+ module_metafile = PathClass(module_file,module_root)
+ if module_path:
+ module_metafile.Path = module_path
+ if module_basename:
+ module_metafile.BaseName = module_basename
+ if module_originalpath:
+ module_metafile.OriginalPath = PathClass(module_originalpath,module_root)
+ arch = module_arch
+ target = self.data_pipe.Get("P_Info").get("Target")
+ toolchain = self.data_pipe.Get("P_Info").get("ToolChain")
+ Ma = ModuleAutoGen(self.Wa,module_metafile,target,toolchain,arch,PlatformMetaFile,self.data_pipe)
+ Ma.IsLibrary = IsLib
+ # SourceFileList calling sequence impact the makefile string sequence.
+ # Create cached SourceFileList here to unify its calling sequence for both
+ # CanSkipbyPreMakeCache and CreateCodeFile/CreateMakeFile.
+ RetVal = Ma.SourceFileList
+ if GlobalData.gUseHashCache and not GlobalData.gBinCacheDest and CommandTarget in [None, "", "all"]:
+ try:
+ CacheResult = Ma.CanSkipbyPreMakeCache()
+ except:
+ CacheResult = False
+ self.feedback_q.put(taskname)
+
+ if CacheResult:
+ self.cache_q.put((Ma.MetaFile.Path, Ma.Arch, "PreMakeCache", True))
+ continue
+ else:
+ self.cache_q.put((Ma.MetaFile.Path, Ma.Arch, "PreMakeCache", False))
+
+ Ma.CreateCodeFile(False)
+ Ma.CreateMakeFile(False,GenFfsList=FfsCmd.get((Ma.MetaFile.Path, Ma.Arch),[]))
+ Ma.CreateAsBuiltInf()
+ if GlobalData.gBinCacheSource and CommandTarget in [None, "", "all"]:
+ try:
+ CacheResult = Ma.CanSkipbyMakeCache()
+ except:
+ CacheResult = False
+ self.feedback_q.put(taskname)
+
+ if CacheResult:
+ self.cache_q.put((Ma.MetaFile.Path, Ma.Arch, "MakeCache", True))
+ continue
+ else:
+ self.cache_q.put((Ma.MetaFile.Path, Ma.Arch, "MakeCache", False))
+
+ except Exception as e:
+ EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), str(e)))
+ self.feedback_q.put(taskname)
+ finally:
+ EdkLogger.debug(EdkLogger.DEBUG_9, "Worker %s: %s" % (os.getpid(), "Done"))
+ self.feedback_q.put("Done")
+ self.cache_q.put("CacheDone")
+
+ def printStatus(self):
+ print("Processs ID: %d Run %d modules in AutoGen " % (os.getpid(),len(AutoGen.Cache())))
+ print("Processs ID: %d Run %d modules in AutoGenInfo " % (os.getpid(),len(AutoGenInfo.GetCache())))
+ groupobj = {}
+ for buildobj in BuildDB.BuildObject.GetCache().values():
+ if str(buildobj).lower().endswith("dec"):
+ try:
+ groupobj['dec'].append(str(buildobj))
+ except:
+ groupobj['dec'] = [str(buildobj)]
+ if str(buildobj).lower().endswith("dsc"):
+ try:
+ groupobj['dsc'].append(str(buildobj))
+ except:
+ groupobj['dsc'] = [str(buildobj)]
+
+ if str(buildobj).lower().endswith("inf"):
+ try:
+ groupobj['inf'].append(str(buildobj))
+ except:
+ groupobj['inf'] = [str(buildobj)]
+
+ print("Processs ID: %d Run %d pkg in WDB " % (os.getpid(),len(groupobj.get("dec",[]))))
+ print("Processs ID: %d Run %d pla in WDB " % (os.getpid(),len(groupobj.get("dsc",[]))))
+ print("Processs ID: %d Run %d inf in WDB " % (os.getpid(),len(groupobj.get("inf",[]))))
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/BuildEngine.py b/roms/edk2/BaseTools/Source/Python/AutoGen/BuildEngine.py
new file mode 100644
index 000000000..722fead75
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/BuildEngine.py
@@ -0,0 +1,650 @@
+## @file
+# The engine for building files
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+import Common.LongFilePathOs as os
+import re
+import copy
+import string
+from Common.LongFilePathSupport import OpenLongFilePath as open
+
+from Common.GlobalData import *
+from Common.BuildToolError import *
+from Common.Misc import tdict, PathClass
+from Common.StringUtils import NormPath
+from Common.DataType import *
+from Common.TargetTxtClassObject import TargetTxtDict
+gDefaultBuildRuleFile = 'build_rule.txt'
+AutoGenReqBuildRuleVerNum = '0.1'
+
+import Common.EdkLogger as EdkLogger
+
+## Convert file type to file list macro name
+#
+# @param FileType The name of file type
+#
+# @retval string The name of macro
+#
+def FileListMacro(FileType):
+ return "%sS" % FileType.replace("-", "_").upper()
+
+## Convert file type to list file macro name
+#
+# @param FileType The name of file type
+#
+# @retval string The name of macro
+#
+def ListFileMacro(FileType):
+ return "%s_LIST" % FileListMacro(FileType)
+
+class TargetDescBlock(object):
+ def __init__(self, Inputs, Outputs, Commands, Dependencies):
+ self.InitWorker(Inputs, Outputs, Commands, Dependencies)
+
+ def InitWorker(self, Inputs, Outputs, Commands, Dependencies):
+ self.Inputs = Inputs
+ self.Outputs = Outputs
+ self.Commands = Commands
+ self.Dependencies = Dependencies
+ if self.Outputs:
+ self.Target = self.Outputs[0]
+ else:
+ self.Target = None
+
+ def __str__(self):
+ return self.Target.Path
+
+ def __hash__(self):
+ return hash(self.Target.Path)
+
+ def __eq__(self, Other):
+ if isinstance(Other, type(self)):
+ return Other.Target.Path == self.Target.Path
+ else:
+ return str(Other) == self.Target.Path
+
+ def AddInput(self, Input):
+ if Input not in self.Inputs:
+ self.Inputs.append(Input)
+
+ def IsMultipleInput(self):
+ return len(self.Inputs) > 1
+
+## Class for one build rule
+#
+# This represents a build rule which can give out corresponding command list for
+# building the given source file(s). The result can be used for generating the
+# target for makefile.
+#
+class FileBuildRule:
+ INC_LIST_MACRO = "INC_LIST"
+ INC_MACRO = "INC"
+
+ ## constructor
+ #
+ # @param Input The dictionary representing input file(s) for a rule
+ # @param Output The list representing output file(s) for a rule
+ # @param Command The list containing commands to generate the output from input
+ #
+ def __init__(self, Type, Input, Output, Command, ExtraDependency=None):
+ # The Input should not be empty
+ if not Input:
+ Input = []
+ if not Output:
+ Output = []
+ if not Command:
+ Command = []
+
+ self.FileListMacro = FileListMacro(Type)
+ self.ListFileMacro = ListFileMacro(Type)
+ self.IncListFileMacro = self.INC_LIST_MACRO
+
+ self.SourceFileType = Type
+ # source files listed not in TAB_STAR or "?" pattern format
+ if not ExtraDependency:
+ self.ExtraSourceFileList = []
+ else:
+ self.ExtraSourceFileList = ExtraDependency
+
+ #
+ # Search macros used in command lines for <FILE_TYPE>_LIST and INC_LIST.
+ # If found, generate a file to keep the input files used to get over the
+ # limitation of command line length
+ #
+ self.MacroList = []
+ self.CommandList = []
+ for CmdLine in Command:
+ self.MacroList.extend(gMacroRefPattern.findall(CmdLine))
+ # replace path separator with native one
+ self.CommandList.append(CmdLine)
+
+ # Indicate what should be generated
+ if self.FileListMacro in self.MacroList:
+ self.GenFileListMacro = True
+ else:
+ self.GenFileListMacro = False
+
+ if self.ListFileMacro in self.MacroList:
+ self.GenListFile = True
+ self.GenFileListMacro = True
+ else:
+ self.GenListFile = False
+
+ if self.INC_LIST_MACRO in self.MacroList:
+ self.GenIncListFile = True
+ else:
+ self.GenIncListFile = False
+
+ # Check input files
+ self.IsMultipleInput = False
+ self.SourceFileExtList = set()
+ for File in Input:
+ Base, Ext = os.path.splitext(File)
+ if Base.find(TAB_STAR) >= 0:
+ # There's TAB_STAR in the file name
+ self.IsMultipleInput = True
+ self.GenFileListMacro = True
+ elif Base.find("?") < 0:
+ # There's no TAB_STAR and "?" in file name
+ self.ExtraSourceFileList.append(File)
+ continue
+ self.SourceFileExtList.add(Ext)
+
+ # Check output files
+ self.DestFileList = []
+ for File in Output:
+ self.DestFileList.append(File)
+
+ # All build targets generated by this rule for a module
+ self.BuildTargets = {}
+
+ ## str() function support
+ #
+ # @retval string
+ #
+ def __str__(self):
+ SourceString = ""
+ SourceString += " %s %s %s" % (self.SourceFileType, " ".join(self.SourceFileExtList), self.ExtraSourceFileList)
+ DestString = ", ".join([str(i) for i in self.DestFileList])
+ CommandString = "\n\t".join(self.CommandList)
+ return "%s : %s\n\t%s" % (DestString, SourceString, CommandString)
+
+ def Instantiate(self, Macros = None):
+ if Macros is None:
+ Macros = {}
+ NewRuleObject = copy.copy(self)
+ NewRuleObject.BuildTargets = {}
+ NewRuleObject.DestFileList = []
+ for File in self.DestFileList:
+ NewRuleObject.DestFileList.append(PathClass(NormPath(File, Macros)))
+ return NewRuleObject
+
+ ## Apply the rule to given source file(s)
+ #
+ # @param SourceFile One file or a list of files to be built
+ # @param RelativeToDir The relative path of the source file
+ # @param PathSeparator Path separator
+ #
+ # @retval tuple (Source file in full path, List of individual sourcefiles, Destination file, List of build commands)
+ #
+ def Apply(self, SourceFile, BuildRuleOrder=None):
+ if not self.CommandList or not self.DestFileList:
+ return None
+
+ # source file
+ if self.IsMultipleInput:
+ SrcFileName = ""
+ SrcFileBase = ""
+ SrcFileExt = ""
+ SrcFileDir = ""
+ SrcPath = ""
+ # SourceFile must be a list
+ SrcFile = "$(%s)" % self.FileListMacro
+ else:
+ SrcFileName, SrcFileBase, SrcFileExt = SourceFile.Name, SourceFile.BaseName, SourceFile.Ext
+ if SourceFile.Root:
+ SrcFileDir = SourceFile.SubDir
+ if SrcFileDir == "":
+ SrcFileDir = "."
+ else:
+ SrcFileDir = "."
+ SrcFile = SourceFile.Path
+ SrcPath = SourceFile.Dir
+
+ # destination file (the first one)
+ if self.DestFileList:
+ DestFile = self.DestFileList[0].Path
+ DestPath = self.DestFileList[0].Dir
+ DestFileName = self.DestFileList[0].Name
+ DestFileBase, DestFileExt = self.DestFileList[0].BaseName, self.DestFileList[0].Ext
+ else:
+ DestFile = ""
+ DestPath = ""
+ DestFileName = ""
+ DestFileBase = ""
+ DestFileExt = ""
+
+ BuildRulePlaceholderDict = {
+ # source file
+ "src" : SrcFile,
+ "s_path" : SrcPath,
+ "s_dir" : SrcFileDir,
+ "s_name" : SrcFileName,
+ "s_base" : SrcFileBase,
+ "s_ext" : SrcFileExt,
+ # destination file
+ "dst" : DestFile,
+ "d_path" : DestPath,
+ "d_name" : DestFileName,
+ "d_base" : DestFileBase,
+ "d_ext" : DestFileExt,
+ }
+
+ DstFile = []
+ for File in self.DestFileList:
+ File = string.Template(str(File)).safe_substitute(BuildRulePlaceholderDict)
+ File = string.Template(str(File)).safe_substitute(BuildRulePlaceholderDict)
+ DstFile.append(PathClass(File, IsBinary=True))
+
+ if DstFile[0] in self.BuildTargets:
+ TargetDesc = self.BuildTargets[DstFile[0]]
+ if BuildRuleOrder and SourceFile.Ext in BuildRuleOrder:
+ Index = BuildRuleOrder.index(SourceFile.Ext)
+ for Input in TargetDesc.Inputs:
+ if Input.Ext not in BuildRuleOrder or BuildRuleOrder.index(Input.Ext) > Index:
+ #
+ # Command line should be regenerated since some macros are different
+ #
+ CommandList = self._BuildCommand(BuildRulePlaceholderDict)
+ TargetDesc.InitWorker([SourceFile], DstFile, CommandList, self.ExtraSourceFileList)
+ break
+ else:
+ TargetDesc.AddInput(SourceFile)
+ else:
+ CommandList = self._BuildCommand(BuildRulePlaceholderDict)
+ TargetDesc = TargetDescBlock([SourceFile], DstFile, CommandList, self.ExtraSourceFileList)
+ TargetDesc.ListFileMacro = self.ListFileMacro
+ TargetDesc.FileListMacro = self.FileListMacro
+ TargetDesc.IncListFileMacro = self.IncListFileMacro
+ TargetDesc.GenFileListMacro = self.GenFileListMacro
+ TargetDesc.GenListFile = self.GenListFile
+ TargetDesc.GenIncListFile = self.GenIncListFile
+ self.BuildTargets[DstFile[0]] = TargetDesc
+ return TargetDesc
+
+ def _BuildCommand(self, Macros):
+ CommandList = []
+ for CommandString in self.CommandList:
+ CommandString = string.Template(CommandString).safe_substitute(Macros)
+ CommandString = string.Template(CommandString).safe_substitute(Macros)
+ CommandList.append(CommandString)
+ return CommandList
+
+## Class for build rules
+#
+# BuildRule class parses rules defined in a file or passed by caller, and converts
+# the rule into FileBuildRule object.
+#
+class BuildRule:
+ _SectionHeader = "SECTIONHEADER"
+ _Section = "SECTION"
+ _SubSectionHeader = "SUBSECTIONHEADER"
+ _SubSection = "SUBSECTION"
+ _InputFile = "INPUTFILE"
+ _OutputFile = "OUTPUTFILE"
+ _ExtraDependency = "EXTRADEPENDENCY"
+ _Command = "COMMAND"
+ _UnknownSection = "UNKNOWNSECTION"
+
+ _SubSectionList = [_InputFile, _OutputFile, _Command]
+
+ _PATH_SEP = "(+)"
+ _FileTypePattern = re.compile("^[_a-zA-Z][_\-0-9a-zA-Z]*$")
+ _BinaryFileRule = FileBuildRule(TAB_DEFAULT_BINARY_FILE, [], [os.path.join("$(OUTPUT_DIR)", "${s_name}")],
+ ["$(CP) ${src} ${dst}"], [])
+
+ ## Constructor
+ #
+ # @param File The file containing build rules in a well defined format
+ # @param Content The string list of build rules in a well defined format
+ # @param LineIndex The line number from which the parsing will begin
+ # @param SupportedFamily The list of supported tool chain families
+ #
+ def __init__(self, File=None, Content=None, LineIndex=0, SupportedFamily=[TAB_COMPILER_MSFT, "INTEL", "GCC", "RVCT"]):
+ self.RuleFile = File
+ # Read build rules from file if it's not none
+ if File is not None:
+ try:
+ self.RuleContent = open(File, 'r').readlines()
+ except:
+ EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=File)
+ elif Content is not None:
+ self.RuleContent = Content
+ else:
+ EdkLogger.error("build", PARAMETER_MISSING, ExtraData="No rule file or string given")
+
+ self.SupportedToolChainFamilyList = SupportedFamily
+ self.RuleDatabase = tdict(True, 4) # {FileExt, ModuleType, Arch, Family : FileBuildRule object}
+ self.Ext2FileType = {} # {ext : file-type}
+ self.FileTypeList = set()
+
+ self._LineIndex = LineIndex
+ self._State = ""
+ self._RuleInfo = tdict(True, 2) # {toolchain family : {"InputFile": {}, "OutputFile" : [], "Command" : []}}
+ self._FileType = ''
+ self._BuildTypeList = set()
+ self._ArchList = set()
+ self._FamilyList = []
+ self._TotalToolChainFamilySet = set()
+ self._RuleObjectList = [] # FileBuildRule object list
+ self._FileVersion = ""
+
+ self.Parse()
+
+ # some intrinsic rules
+ self.RuleDatabase[TAB_DEFAULT_BINARY_FILE, TAB_COMMON, TAB_COMMON, TAB_COMMON] = self._BinaryFileRule
+ self.FileTypeList.add(TAB_DEFAULT_BINARY_FILE)
+
+ ## Parse the build rule strings
+ def Parse(self):
+ self._State = self._Section
+ for Index in range(self._LineIndex, len(self.RuleContent)):
+ # Clean up the line and replace path separator with native one
+ Line = self.RuleContent[Index].strip().replace(self._PATH_SEP, os.path.sep)
+ self.RuleContent[Index] = Line
+
+ # find the build_rule_version
+ if Line and Line[0] == "#" and Line.find(TAB_BUILD_RULE_VERSION) != -1:
+ if Line.find("=") != -1 and Line.find("=") < (len(Line) - 1) and (Line[(Line.find("=") + 1):]).split():
+ self._FileVersion = (Line[(Line.find("=") + 1):]).split()[0]
+ # skip empty or comment line
+ if Line == "" or Line[0] == "#":
+ continue
+
+ # find out section header, enclosed by []
+ if Line[0] == '[' and Line[-1] == ']':
+ # merge last section information into rule database
+ self.EndOfSection()
+ self._State = self._SectionHeader
+ # find out sub-section header, enclosed by <>
+ elif Line[0] == '<' and Line[-1] == '>':
+ if self._State != self._UnknownSection:
+ self._State = self._SubSectionHeader
+
+ # call section handler to parse each (sub)section
+ self._StateHandler[self._State](self, Index)
+ # merge last section information into rule database
+ self.EndOfSection()
+
+ ## Parse definitions under a section
+ #
+ # @param LineIndex The line index of build rule text
+ #
+ def ParseSection(self, LineIndex):
+ pass
+
+ ## Parse definitions under a subsection
+ #
+ # @param LineIndex The line index of build rule text
+ #
+ def ParseSubSection(self, LineIndex):
+ # currently nothing here
+ pass
+
+ ## Placeholder for not supported sections
+ #
+ # @param LineIndex The line index of build rule text
+ #
+ def SkipSection(self, LineIndex):
+ pass
+
+ ## Merge section information just got into rule database
+ def EndOfSection(self):
+ Database = self.RuleDatabase
+ # if there's specific toolchain family, 'COMMON' doesn't make sense any more
+ if len(self._TotalToolChainFamilySet) > 1 and TAB_COMMON in self._TotalToolChainFamilySet:
+ self._TotalToolChainFamilySet.remove(TAB_COMMON)
+ for Family in self._TotalToolChainFamilySet:
+ Input = self._RuleInfo[Family, self._InputFile]
+ Output = self._RuleInfo[Family, self._OutputFile]
+ Command = self._RuleInfo[Family, self._Command]
+ ExtraDependency = self._RuleInfo[Family, self._ExtraDependency]
+
+ BuildRule = FileBuildRule(self._FileType, Input, Output, Command, ExtraDependency)
+ for BuildType in self._BuildTypeList:
+ for Arch in self._ArchList:
+ Database[self._FileType, BuildType, Arch, Family] = BuildRule
+ for FileExt in BuildRule.SourceFileExtList:
+ self.Ext2FileType[FileExt] = self._FileType
+
+ ## Parse section header
+ #
+ # @param LineIndex The line index of build rule text
+ #
+ def ParseSectionHeader(self, LineIndex):
+ self._RuleInfo = tdict(True, 2)
+ self._BuildTypeList = set()
+ self._ArchList = set()
+ self._FamilyList = []
+ self._TotalToolChainFamilySet = set()
+ FileType = ''
+ RuleNameList = self.RuleContent[LineIndex][1:-1].split(',')
+ for RuleName in RuleNameList:
+ Arch = TAB_COMMON
+ BuildType = TAB_COMMON
+ TokenList = [Token.strip().upper() for Token in RuleName.split('.')]
+ # old format: Build.File-Type
+ if TokenList[0] == "BUILD":
+ if len(TokenList) == 1:
+ EdkLogger.error("build", FORMAT_INVALID, "Invalid rule section",
+ File=self.RuleFile, Line=LineIndex + 1,
+ ExtraData=self.RuleContent[LineIndex])
+
+ FileType = TokenList[1]
+ if FileType == '':
+ EdkLogger.error("build", FORMAT_INVALID, "No file type given",
+ File=self.RuleFile, Line=LineIndex + 1,
+ ExtraData=self.RuleContent[LineIndex])
+ if self._FileTypePattern.match(FileType) is None:
+ EdkLogger.error("build", FORMAT_INVALID, File=self.RuleFile, Line=LineIndex + 1,
+ ExtraData="Only character, number (non-first character), '_' and '-' are allowed in file type")
+ # new format: File-Type.Build-Type.Arch
+ else:
+ if FileType == '':
+ FileType = TokenList[0]
+ elif FileType != TokenList[0]:
+ EdkLogger.error("build", FORMAT_INVALID,
+ "Different file types are not allowed in the same rule section",
+ File=self.RuleFile, Line=LineIndex + 1,
+ ExtraData=self.RuleContent[LineIndex])
+ if len(TokenList) > 1:
+ BuildType = TokenList[1]
+ if len(TokenList) > 2:
+ Arch = TokenList[2]
+ self._BuildTypeList.add(BuildType)
+ self._ArchList.add(Arch)
+
+ if TAB_COMMON in self._BuildTypeList and len(self._BuildTypeList) > 1:
+ EdkLogger.error("build", FORMAT_INVALID,
+ "Specific build types must not be mixed with common one",
+ File=self.RuleFile, Line=LineIndex + 1,
+ ExtraData=self.RuleContent[LineIndex])
+ if TAB_COMMON in self._ArchList and len(self._ArchList) > 1:
+ EdkLogger.error("build", FORMAT_INVALID,
+ "Specific ARCH must not be mixed with common one",
+ File=self.RuleFile, Line=LineIndex + 1,
+ ExtraData=self.RuleContent[LineIndex])
+
+ self._FileType = FileType
+ self._State = self._Section
+ self.FileTypeList.add(FileType)
+
+ ## Parse sub-section header
+ #
+ # @param LineIndex The line index of build rule text
+ #
+ def ParseSubSectionHeader(self, LineIndex):
+ SectionType = ""
+ List = self.RuleContent[LineIndex][1:-1].split(',')
+ FamilyList = []
+ for Section in List:
+ TokenList = Section.split('.')
+ Type = TokenList[0].strip().upper()
+
+ if SectionType == "":
+ SectionType = Type
+ elif SectionType != Type:
+ EdkLogger.error("build", FORMAT_INVALID,
+ "Two different section types are not allowed in the same sub-section",
+ File=self.RuleFile, Line=LineIndex + 1,
+ ExtraData=self.RuleContent[LineIndex])
+
+ if len(TokenList) > 1:
+ Family = TokenList[1].strip().upper()
+ else:
+ Family = TAB_COMMON
+
+ if Family not in FamilyList:
+ FamilyList.append(Family)
+
+ self._FamilyList = FamilyList
+ self._TotalToolChainFamilySet.update(FamilyList)
+ self._State = SectionType.upper()
+ if TAB_COMMON in FamilyList and len(FamilyList) > 1:
+ EdkLogger.error("build", FORMAT_INVALID,
+ "Specific tool chain family should not be mixed with general one",
+ File=self.RuleFile, Line=LineIndex + 1,
+ ExtraData=self.RuleContent[LineIndex])
+ if self._State not in self._StateHandler:
+ EdkLogger.error("build", FORMAT_INVALID, File=self.RuleFile, Line=LineIndex + 1,
+ ExtraData="Unknown subsection: %s" % self.RuleContent[LineIndex])
+ ## Parse <InputFile> sub-section
+ #
+ # @param LineIndex The line index of build rule text
+ #
+ def ParseInputFileSubSection(self, LineIndex):
+ FileList = [File.strip() for File in self.RuleContent[LineIndex].split(",")]
+ for ToolChainFamily in self._FamilyList:
+ if self._RuleInfo[ToolChainFamily, self._State] is None:
+ self._RuleInfo[ToolChainFamily, self._State] = []
+ self._RuleInfo[ToolChainFamily, self._State].extend(FileList)
+
+ ## Parse <ExtraDependency> sub-section
+ ## Parse <OutputFile> sub-section
+ ## Parse <Command> sub-section
+ #
+ # @param LineIndex The line index of build rule text
+ #
+ def ParseCommonSubSection(self, LineIndex):
+ for ToolChainFamily in self._FamilyList:
+ if self._RuleInfo[ToolChainFamily, self._State] is None:
+ self._RuleInfo[ToolChainFamily, self._State] = []
+ self._RuleInfo[ToolChainFamily, self._State].append(self.RuleContent[LineIndex])
+
+ ## Get a build rule via [] operator
+ #
+ # @param FileExt The extension of a file
+ # @param ToolChainFamily The tool chain family name
+ # @param BuildVersion The build version number. TAB_STAR means any rule
+ # is applicable.
+ #
+ # @retval FileType The file type string
+ # @retval FileBuildRule The object of FileBuildRule
+ #
+ # Key = (FileExt, ModuleType, Arch, ToolChainFamily)
+ def __getitem__(self, Key):
+ if not Key:
+ return None
+
+ if Key[0] in self.Ext2FileType:
+ Type = self.Ext2FileType[Key[0]]
+ elif Key[0].upper() in self.FileTypeList:
+ Type = Key[0].upper()
+ else:
+ return None
+
+ if len(Key) > 1:
+ Key = (Type,) + Key[1:]
+ else:
+ Key = (Type,)
+ return self.RuleDatabase[Key]
+
+ _StateHandler = {
+ _SectionHeader : ParseSectionHeader,
+ _Section : ParseSection,
+ _SubSectionHeader : ParseSubSectionHeader,
+ _SubSection : ParseSubSection,
+ _InputFile : ParseInputFileSubSection,
+ _OutputFile : ParseCommonSubSection,
+ _ExtraDependency : ParseCommonSubSection,
+ _Command : ParseCommonSubSection,
+ _UnknownSection : SkipSection,
+ }
+
+class ToolBuildRule():
+
+ def __new__(cls, *args, **kw):
+ if not hasattr(cls, '_instance'):
+ orig = super(ToolBuildRule, cls)
+ cls._instance = orig.__new__(cls, *args, **kw)
+ return cls._instance
+
+ def __init__(self):
+ if not hasattr(self, 'ToolBuildRule'):
+ self._ToolBuildRule = None
+
+ @property
+ def ToolBuildRule(self):
+ if not self._ToolBuildRule:
+ self._GetBuildRule()
+ return self._ToolBuildRule
+
+ def _GetBuildRule(self):
+ BuildRuleFile = None
+ TargetObj = TargetTxtDict()
+ TargetTxt = TargetObj.Target
+ if TAB_TAT_DEFINES_BUILD_RULE_CONF in TargetTxt.TargetTxtDictionary:
+ BuildRuleFile = TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_BUILD_RULE_CONF]
+ if not BuildRuleFile:
+ BuildRuleFile = gDefaultBuildRuleFile
+ RetVal = BuildRule(BuildRuleFile)
+ if RetVal._FileVersion == "":
+ RetVal._FileVersion = AutoGenReqBuildRuleVerNum
+ else:
+ if RetVal._FileVersion < AutoGenReqBuildRuleVerNum :
+ # If Build Rule's version is less than the version number required by the tools, halting the build.
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ ExtraData="The version number [%s] of build_rule.txt is less than the version number required by the AutoGen.(the minimum required version number is [%s])"\
+ % (RetVal._FileVersion, AutoGenReqBuildRuleVerNum))
+ self._ToolBuildRule = RetVal
+
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+if __name__ == '__main__':
+ import sys
+ EdkLogger.Initialize()
+ if len(sys.argv) > 1:
+ Br = BuildRule(sys.argv[1])
+ print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", TAB_COMPILER_MSFT][1]))
+ print()
+ print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1]))
+ print()
+ print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1]))
+ print()
+ print(str(Br[".ac", "ACPI_TABLE", "IA32", TAB_COMPILER_MSFT][1]))
+ print()
+ print(str(Br[".h", "ACPI_TABLE", "IA32", "INTEL"][1]))
+ print()
+ print(str(Br[".ac", "ACPI_TABLE", "IA32", TAB_COMPILER_MSFT][1]))
+ print()
+ print(str(Br[".s", SUP_MODULE_SEC, "IPF", "COMMON"][1]))
+ print()
+ print(str(Br[".s", SUP_MODULE_SEC][1]))
+
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/DataPipe.py b/roms/edk2/BaseTools/Source/Python/AutoGen/DataPipe.py
new file mode 100755
index 000000000..50403fbfb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/DataPipe.py
@@ -0,0 +1,168 @@
+## @file
+# Create makefile for MS nmake and GNU make
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+from __future__ import absolute_import
+from Workspace.WorkspaceDatabase import BuildDB
+from Workspace.WorkspaceCommon import GetModuleLibInstances
+import Common.GlobalData as GlobalData
+import os
+import pickle
+from pickle import HIGHEST_PROTOCOL
+from Common import EdkLogger
+
+class PCD_DATA():
+ def __init__(self,TokenCName,TokenSpaceGuidCName,Type,DatumType,SkuInfoList,DefaultValue,
+ MaxDatumSize,UserDefinedDefaultStoresFlag,validateranges,
+ validlists,expressions,CustomAttribute,TokenValue):
+ self.TokenCName = TokenCName
+ self.TokenSpaceGuidCName = TokenSpaceGuidCName
+ self.Type = Type
+ self.DatumType = DatumType
+ self.SkuInfoList = SkuInfoList
+ self.DefaultValue = DefaultValue
+ self.MaxDatumSize = MaxDatumSize
+ self.UserDefinedDefaultStoresFlag = UserDefinedDefaultStoresFlag
+ self.validateranges = validateranges
+ self.validlists = validlists
+ self.expressions = expressions
+ self.CustomAttribute = CustomAttribute
+ self.TokenValue = TokenValue
+
+class DataPipe(object):
+ def __init__(self, BuildDir=None):
+ self.data_container = {}
+ self.BuildDir = BuildDir
+ self.dump_file = ""
+
+class MemoryDataPipe(DataPipe):
+
+ def Get(self,key):
+ return self.data_container.get(key)
+
+ def dump(self,file_path):
+ self.dump_file = file_path
+ with open(file_path,'wb') as fd:
+ pickle.dump(self.data_container,fd,pickle.HIGHEST_PROTOCOL)
+
+ def load(self,file_path):
+ with open(file_path,'rb') as fd:
+ self.data_container = pickle.load(fd)
+
+ @property
+ def DataContainer(self):
+ return self.data_container
+ @DataContainer.setter
+ def DataContainer(self,data):
+ self.data_container.update(data)
+
+ def FillData(self,PlatformInfo):
+ #Platform Pcds
+ self.DataContainer = {
+ "PLA_PCD" : [PCD_DATA(
+ pcd.TokenCName,pcd.TokenSpaceGuidCName,pcd.Type,
+ pcd.DatumType,pcd.SkuInfoList,pcd.DefaultValue,
+ pcd.MaxDatumSize,pcd.UserDefinedDefaultStoresFlag,pcd.validateranges,
+ pcd.validlists,pcd.expressions,pcd.CustomAttribute,pcd.TokenValue)
+ for pcd in PlatformInfo.Platform.Pcds.values()]
+ }
+
+ #Platform Module Pcds
+ ModulePcds = {}
+ for m in PlatformInfo.Platform.Modules:
+ m_pcds = PlatformInfo.Platform.Modules[m].Pcds
+ if m_pcds:
+ ModulePcds[(m.File,m.Root,m.Arch)] = [PCD_DATA(
+ pcd.TokenCName,pcd.TokenSpaceGuidCName,pcd.Type,
+ pcd.DatumType,pcd.SkuInfoList,pcd.DefaultValue,
+ pcd.MaxDatumSize,pcd.UserDefinedDefaultStoresFlag,pcd.validateranges,
+ pcd.validlists,pcd.expressions,pcd.CustomAttribute,pcd.TokenValue)
+ for pcd in PlatformInfo.Platform.Modules[m].Pcds.values()]
+
+
+ self.DataContainer = {"MOL_PCDS":ModulePcds}
+
+ #Module's Library Instance
+ ModuleLibs = {}
+ libModules = {}
+ for m in PlatformInfo.Platform.Modules:
+ module_obj = BuildDB.BuildObject[m,PlatformInfo.Arch,PlatformInfo.BuildTarget,PlatformInfo.ToolChain]
+ Libs = GetModuleLibInstances(module_obj, PlatformInfo.Platform, BuildDB.BuildObject, PlatformInfo.Arch,PlatformInfo.BuildTarget,PlatformInfo.ToolChain,PlatformInfo.MetaFile,EdkLogger)
+ for lib in Libs:
+ try:
+ libModules[(lib.MetaFile.File,lib.MetaFile.Root,lib.Arch,lib.MetaFile.Path)].append((m.File,m.Root,module_obj.Arch,m.Path))
+ except:
+ libModules[(lib.MetaFile.File,lib.MetaFile.Root,lib.Arch,lib.MetaFile.Path)] = [(m.File,m.Root,module_obj.Arch,m.Path)]
+ ModuleLibs[(m.File,m.Root,module_obj.Arch,m.Path)] = [(l.MetaFile.File,l.MetaFile.Root,l.Arch,l.MetaFile.Path) for l in Libs]
+ self.DataContainer = {"DEPS":ModuleLibs}
+ self.DataContainer = {"REFS":libModules}
+
+ #Platform BuildOptions
+
+ platform_build_opt = PlatformInfo.EdkIIBuildOption
+
+ ToolDefinition = PlatformInfo.ToolDefinition
+ module_build_opt = {}
+ for m in PlatformInfo.Platform.Modules:
+ ModuleTypeOptions, PlatformModuleOptions = PlatformInfo.GetGlobalBuildOptions(BuildDB.BuildObject[m,PlatformInfo.Arch,PlatformInfo.BuildTarget,PlatformInfo.ToolChain])
+ if ModuleTypeOptions or PlatformModuleOptions:
+ module_build_opt.update({(m.File,m.Root): {"ModuleTypeOptions":ModuleTypeOptions, "PlatformModuleOptions":PlatformModuleOptions}})
+
+ self.DataContainer = {"PLA_BO":platform_build_opt,
+ "TOOLDEF":ToolDefinition,
+ "MOL_BO":module_build_opt
+ }
+
+
+
+ #Platform Info
+ PInfo = {
+ "WorkspaceDir":PlatformInfo.Workspace.WorkspaceDir,
+ "Target":PlatformInfo.BuildTarget,
+ "ToolChain":PlatformInfo.Workspace.ToolChain,
+ "BuildRuleFile":PlatformInfo.BuildRule,
+ "Arch": PlatformInfo.Arch,
+ "ArchList":PlatformInfo.Workspace.ArchList,
+ "ActivePlatform":PlatformInfo.MetaFile
+ }
+ self.DataContainer = {'P_Info':PInfo}
+
+ self.DataContainer = {'M_Name':PlatformInfo.UniqueBaseName}
+
+ self.DataContainer = {"ToolChainFamily": PlatformInfo.ToolChainFamily}
+
+ self.DataContainer = {"BuildRuleFamily": PlatformInfo.BuildRuleFamily}
+
+ self.DataContainer = {"MixedPcd":GlobalData.MixedPcd}
+
+ self.DataContainer = {"BuildOptPcd":GlobalData.BuildOptionPcd}
+
+ self.DataContainer = {"BuildCommand": PlatformInfo.BuildCommand}
+
+ self.DataContainer = {"AsBuildModuleList": PlatformInfo._AsBuildModuleList}
+
+ self.DataContainer = {"G_defines": GlobalData.gGlobalDefines}
+
+ self.DataContainer = {"CL_defines": GlobalData.gCommandLineDefines}
+
+ self.DataContainer = {"Env_Var": {k:v for k, v in os.environ.items()}}
+
+ self.DataContainer = {"PackageList": [(dec.MetaFile,dec.Arch) for dec in PlatformInfo.PackageList]}
+
+ self.DataContainer = {"GuidDict": PlatformInfo.Platform._GuidDict}
+
+ self.DataContainer = {"DatabasePath":GlobalData.gDatabasePath}
+
+ self.DataContainer = {"FdfParser": True if GlobalData.gFdfParser else False}
+
+ self.DataContainer = {"LogLevel": EdkLogger.GetLevel()}
+
+ self.DataContainer = {"UseHashCache":GlobalData.gUseHashCache}
+
+ self.DataContainer = {"BinCacheSource":GlobalData.gBinCacheSource}
+
+ self.DataContainer = {"BinCacheDest":GlobalData.gBinCacheDest}
+
+ self.DataContainer = {"EnableGenfdsMultiThread":GlobalData.gEnableGenfdsMultiThread}
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/GenC.py b/roms/edk2/BaseTools/Source/Python/AutoGen/GenC.py
new file mode 100755
index 000000000..5e0d11e16
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/GenC.py
@@ -0,0 +1,2108 @@
+## @file
+# Routines for generating AutoGen.h and AutoGen.c
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+## Import Modules
+#
+from __future__ import absolute_import
+import string
+import collections
+import struct
+from Common import EdkLogger
+from Common import GlobalData
+from Common.BuildToolError import *
+from Common.DataType import *
+from Common.Misc import *
+from Common.StringUtils import StringToArray
+from .StrGather import *
+from .GenPcdDb import CreatePcdDatabaseCode
+from .IdfClassObject import *
+
+## PCD type string
+gItemTypeStringDatabase = {
+ TAB_PCDS_FEATURE_FLAG : TAB_PCDS_FIXED_AT_BUILD,
+ TAB_PCDS_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
+ TAB_PCDS_PATCHABLE_IN_MODULE: 'BinaryPatch',
+ TAB_PCDS_DYNAMIC : '',
+ TAB_PCDS_DYNAMIC_DEFAULT : '',
+ TAB_PCDS_DYNAMIC_VPD : '',
+ TAB_PCDS_DYNAMIC_HII : '',
+ TAB_PCDS_DYNAMIC_EX : '',
+ TAB_PCDS_DYNAMIC_EX_DEFAULT : '',
+ TAB_PCDS_DYNAMIC_EX_VPD : '',
+ TAB_PCDS_DYNAMIC_EX_HII : '',
+}
+
+
+## Datum size
+gDatumSizeStringDatabase = {TAB_UINT8:'8',TAB_UINT16:'16',TAB_UINT32:'32',TAB_UINT64:'64','BOOLEAN':'BOOLEAN',TAB_VOID:'8'}
+gDatumSizeStringDatabaseH = {TAB_UINT8:'8',TAB_UINT16:'16',TAB_UINT32:'32',TAB_UINT64:'64','BOOLEAN':'BOOL',TAB_VOID:'PTR'}
+gDatumSizeStringDatabaseLib = {TAB_UINT8:'8',TAB_UINT16:'16',TAB_UINT32:'32',TAB_UINT64:'64','BOOLEAN':'Bool',TAB_VOID:'Ptr'}
+
+## AutoGen File Header Templates
+gAutoGenHeaderString = TemplateString("""\
+/**
+ DO NOT EDIT
+ FILE auto-generated
+ Module name:
+ ${FileName}
+ Abstract: Auto-generated ${FileName} for building module or library.
+**/
+""")
+
+gAutoGenHPrologueString = TemplateString("""
+#ifndef _${File}_${Guid}
+#define _${File}_${Guid}
+
+""")
+
+gAutoGenHCppPrologueString = """\
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+"""
+
+gAutoGenHEpilogueString = """
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+"""
+
+## PEI Core Entry Point Templates
+gPeiCoreEntryPointPrototype = TemplateString("""
+${BEGIN}
+VOID
+EFIAPI
+${Function} (
+ IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
+ IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,
+ IN VOID *Context
+ );
+${END}
+""")
+
+gPeiCoreEntryPointString = TemplateString("""
+${BEGIN}
+VOID
+EFIAPI
+ProcessModuleEntryPointList (
+ IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
+ IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,
+ IN VOID *Context
+ )
+
+{
+ ${Function} (SecCoreData, PpiList, Context);
+}
+${END}
+""")
+
+
+## DXE Core Entry Point Templates
+gDxeCoreEntryPointPrototype = TemplateString("""
+${BEGIN}
+VOID
+EFIAPI
+${Function} (
+ IN VOID *HobStart
+ );
+${END}
+""")
+
+gDxeCoreEntryPointString = TemplateString("""
+${BEGIN}
+VOID
+EFIAPI
+ProcessModuleEntryPointList (
+ IN VOID *HobStart
+ )
+
+{
+ ${Function} (HobStart);
+}
+${END}
+""")
+
+## PEIM Entry Point Templates
+gPeimEntryPointPrototype = TemplateString("""
+${BEGIN}
+EFI_STATUS
+EFIAPI
+${Function} (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ );
+${END}
+""")
+
+gPeimEntryPointString = [
+TemplateString("""
+GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = ${PiSpecVersion};
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+
+{
+ return EFI_SUCCESS;
+}
+"""),
+TemplateString("""
+GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = ${PiSpecVersion};
+${BEGIN}
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+
+{
+ return ${Function} (FileHandle, PeiServices);
+}
+${END}
+"""),
+TemplateString("""
+GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = ${PiSpecVersion};
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+
+{
+ EFI_STATUS Status;
+ EFI_STATUS CombinedStatus;
+
+ CombinedStatus = EFI_LOAD_ERROR;
+${BEGIN}
+ Status = ${Function} (FileHandle, PeiServices);
+ if (!EFI_ERROR (Status) || EFI_ERROR (CombinedStatus)) {
+ CombinedStatus = Status;
+ }
+${END}
+ return CombinedStatus;
+}
+""")
+]
+
+## SMM_CORE Entry Point Templates
+gSmmCoreEntryPointPrototype = TemplateString("""
+${BEGIN}
+EFI_STATUS
+EFIAPI
+${Function} (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+${END}
+""")
+
+gSmmCoreEntryPointString = TemplateString("""
+${BEGIN}
+const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
+const UINT32 _gDxeRevision = ${PiSpecVersion};
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ return ${Function} (ImageHandle, SystemTable);
+}
+${END}
+""")
+
+## MM_CORE_STANDALONE Entry Point Templates
+gMmCoreStandaloneEntryPointPrototype = TemplateString("""
+${BEGIN}
+EFI_STATUS
+EFIAPI
+${Function} (
+ IN VOID *HobStart
+ );
+${END}
+""")
+
+gMmCoreStandaloneEntryPointString = TemplateString("""
+${BEGIN}
+const UINT32 _gMmRevision = ${PiSpecVersion};
+
+VOID
+EFIAPI
+ProcessModuleEntryPointList (
+ IN VOID *HobStart
+ )
+{
+ ${Function} (HobStart);
+}
+${END}
+""")
+
+## MM_STANDALONE Entry Point Templates
+gMmStandaloneEntryPointPrototype = TemplateString("""
+${BEGIN}
+EFI_STATUS
+EFIAPI
+${Function} (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_MM_SYSTEM_TABLE *MmSystemTable
+ );
+${END}
+""")
+
+gMmStandaloneEntryPointString = [
+TemplateString("""
+GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gMmRevision = ${PiSpecVersion};
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_MM_SYSTEM_TABLE *MmSystemTable
+ )
+
+{
+ return EFI_SUCCESS;
+}
+"""),
+TemplateString("""
+GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gMmRevision = ${PiSpecVersion};
+${BEGIN}
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_MM_SYSTEM_TABLE *MmSystemTable
+ )
+
+{
+ return ${Function} (ImageHandle, MmSystemTable);
+}
+${END}
+"""),
+TemplateString("""
+GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gMmRevision = ${PiSpecVersion};
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_MM_SYSTEM_TABLE *MmSystemTable
+ )
+
+{
+ EFI_STATUS Status;
+ EFI_STATUS CombinedStatus;
+
+ CombinedStatus = EFI_LOAD_ERROR;
+${BEGIN}
+ Status = ${Function} (ImageHandle, MmSystemTable);
+ if (!EFI_ERROR (Status) || EFI_ERROR (CombinedStatus)) {
+ CombinedStatus = Status;
+ }
+${END}
+ return CombinedStatus;
+}
+""")
+]
+
+## DXE SMM Entry Point Templates
+gDxeSmmEntryPointPrototype = TemplateString("""
+${BEGIN}
+EFI_STATUS
+EFIAPI
+${Function} (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+${END}
+""")
+
+gDxeSmmEntryPointString = [
+TemplateString("""
+const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
+const UINT32 _gDxeRevision = ${PiSpecVersion};
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+
+{
+ return EFI_SUCCESS;
+}
+"""),
+TemplateString("""
+const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
+const UINT32 _gDxeRevision = ${PiSpecVersion};
+
+static BASE_LIBRARY_JUMP_BUFFER mJumpContext;
+static EFI_STATUS mDriverEntryPointStatus;
+
+VOID
+EFIAPI
+ExitDriver (
+ IN EFI_STATUS Status
+ )
+{
+ if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {
+ mDriverEntryPointStatus = Status;
+ }
+ LongJump (&mJumpContext, (UINTN)-1);
+ ASSERT (FALSE);
+}
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ mDriverEntryPointStatus = EFI_LOAD_ERROR;
+
+${BEGIN}
+ if (SetJump (&mJumpContext) == 0) {
+ ExitDriver (${Function} (ImageHandle, SystemTable));
+ ASSERT (FALSE);
+ }
+${END}
+
+ return mDriverEntryPointStatus;
+}
+""")
+]
+
+## UEFI Driver Entry Point Templates
+gUefiDriverEntryPointPrototype = TemplateString("""
+${BEGIN}
+EFI_STATUS
+EFIAPI
+${Function} (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+${END}
+""")
+
+gUefiDriverEntryPointString = [
+TemplateString("""
+const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
+const UINT32 _gDxeRevision = ${PiSpecVersion};
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ return EFI_SUCCESS;
+}
+"""),
+TemplateString("""
+const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
+const UINT32 _gDxeRevision = ${PiSpecVersion};
+
+${BEGIN}
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+
+{
+ return ${Function} (ImageHandle, SystemTable);
+}
+${END}
+VOID
+EFIAPI
+ExitDriver (
+ IN EFI_STATUS Status
+ )
+{
+ if (EFI_ERROR (Status)) {
+ ProcessLibraryDestructorList (gImageHandle, gST);
+ }
+ gBS->Exit (gImageHandle, Status, 0, NULL);
+}
+"""),
+TemplateString("""
+const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
+const UINT32 _gDxeRevision = ${PiSpecVersion};
+
+static BASE_LIBRARY_JUMP_BUFFER mJumpContext;
+static EFI_STATUS mDriverEntryPointStatus;
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ mDriverEntryPointStatus = EFI_LOAD_ERROR;
+ ${BEGIN}
+ if (SetJump (&mJumpContext) == 0) {
+ ExitDriver (${Function} (ImageHandle, SystemTable));
+ ASSERT (FALSE);
+ }
+ ${END}
+ return mDriverEntryPointStatus;
+}
+
+VOID
+EFIAPI
+ExitDriver (
+ IN EFI_STATUS Status
+ )
+{
+ if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {
+ mDriverEntryPointStatus = Status;
+ }
+ LongJump (&mJumpContext, (UINTN)-1);
+ ASSERT (FALSE);
+}
+""")
+]
+
+
+## UEFI Application Entry Point Templates
+gUefiApplicationEntryPointPrototype = TemplateString("""
+${BEGIN}
+EFI_STATUS
+EFIAPI
+${Function} (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+${END}
+""")
+
+gUefiApplicationEntryPointString = [
+TemplateString("""
+const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ return EFI_SUCCESS;
+}
+"""),
+TemplateString("""
+const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
+
+${BEGIN}
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+
+{
+ return ${Function} (ImageHandle, SystemTable);
+}
+${END}
+VOID
+EFIAPI
+ExitDriver (
+ IN EFI_STATUS Status
+ )
+{
+ if (EFI_ERROR (Status)) {
+ ProcessLibraryDestructorList (gImageHandle, gST);
+ }
+ gBS->Exit (gImageHandle, Status, 0, NULL);
+}
+"""),
+TemplateString("""
+const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+
+{
+ ${BEGIN}
+ if (SetJump (&mJumpContext) == 0) {
+ ExitDriver (${Function} (ImageHandle, SystemTable));
+ ASSERT (FALSE);
+ }
+ ${END}
+ return mDriverEntryPointStatus;
+}
+
+static BASE_LIBRARY_JUMP_BUFFER mJumpContext;
+static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;
+
+VOID
+EFIAPI
+ExitDriver (
+ IN EFI_STATUS Status
+ )
+{
+ if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {
+ mDriverEntryPointStatus = Status;
+ }
+ LongJump (&mJumpContext, (UINTN)-1);
+ ASSERT (FALSE);
+}
+""")
+]
+
+## UEFI Unload Image Templates
+gUefiUnloadImagePrototype = TemplateString("""
+${BEGIN}
+EFI_STATUS
+EFIAPI
+${Function} (
+ IN EFI_HANDLE ImageHandle
+ );
+${END}
+""")
+
+gUefiUnloadImageString = [
+TemplateString("""
+GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ${Count};
+
+EFI_STATUS
+EFIAPI
+ProcessModuleUnloadList (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ return EFI_SUCCESS;
+}
+"""),
+TemplateString("""
+GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ${Count};
+
+${BEGIN}
+EFI_STATUS
+EFIAPI
+ProcessModuleUnloadList (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ return ${Function} (ImageHandle);
+}
+${END}
+"""),
+TemplateString("""
+GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ${Count};
+
+EFI_STATUS
+EFIAPI
+ProcessModuleUnloadList (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+${BEGIN}
+ if (EFI_ERROR (Status)) {
+ ${Function} (ImageHandle);
+ } else {
+ Status = ${Function} (ImageHandle);
+ }
+${END}
+ return Status;
+}
+""")
+]
+
+gLibraryStructorPrototype = {
+SUP_MODULE_BASE : TemplateString("""${BEGIN}
+RETURN_STATUS
+EFIAPI
+${Function} (
+ VOID
+ );${END}
+"""),
+
+'PEI' : TemplateString("""${BEGIN}
+EFI_STATUS
+EFIAPI
+${Function} (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ );${END}
+"""),
+
+'DXE' : TemplateString("""${BEGIN}
+EFI_STATUS
+EFIAPI
+${Function} (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );${END}
+"""),
+
+'MM' : TemplateString("""${BEGIN}
+EFI_STATUS
+EFIAPI
+${Function} (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_MM_SYSTEM_TABLE *MmSystemTable
+ );${END}
+"""),
+}
+
+gLibraryStructorCall = {
+SUP_MODULE_BASE : TemplateString("""${BEGIN}
+ Status = ${Function} ();
+ ASSERT_RETURN_ERROR (Status);${END}
+"""),
+
+'PEI' : TemplateString("""${BEGIN}
+ Status = ${Function} (FileHandle, PeiServices);
+ ASSERT_EFI_ERROR (Status);${END}
+"""),
+
+'DXE' : TemplateString("""${BEGIN}
+ Status = ${Function} (ImageHandle, SystemTable);
+ ASSERT_EFI_ERROR (Status);${END}
+"""),
+
+'MM' : TemplateString("""${BEGIN}
+ Status = ${Function} (ImageHandle, MmSystemTable);
+ ASSERT_EFI_ERROR (Status);${END}
+"""),
+}
+
+## Library Constructor and Destructor Templates
+gLibraryString = {
+SUP_MODULE_BASE : TemplateString("""
+${BEGIN}${FunctionPrototype}${END}
+
+VOID
+EFIAPI
+ProcessLibrary${Type}List (
+ VOID
+ )
+{
+${BEGIN} RETURN_STATUS Status;
+${FunctionCall}${END}
+}
+"""),
+
+'PEI' : TemplateString("""
+${BEGIN}${FunctionPrototype}${END}
+
+VOID
+EFIAPI
+ProcessLibrary${Type}List (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+{
+${BEGIN} EFI_STATUS Status;
+${FunctionCall}${END}
+}
+"""),
+
+'DXE' : TemplateString("""
+${BEGIN}${FunctionPrototype}${END}
+
+VOID
+EFIAPI
+ProcessLibrary${Type}List (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+${BEGIN} EFI_STATUS Status;
+${FunctionCall}${END}
+}
+"""),
+
+'MM' : TemplateString("""
+${BEGIN}${FunctionPrototype}${END}
+
+VOID
+EFIAPI
+ProcessLibrary${Type}List (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_MM_SYSTEM_TABLE *MmSystemTable
+ )
+{
+${BEGIN} EFI_STATUS Status;
+${FunctionCall}${END}
+}
+"""),
+}
+
+gBasicHeaderFile = "Base.h"
+
+gModuleTypeHeaderFile = {
+ SUP_MODULE_BASE : [gBasicHeaderFile, "Library/DebugLib.h"],
+ SUP_MODULE_SEC : ["PiPei.h", "Library/DebugLib.h"],
+ SUP_MODULE_PEI_CORE : ["PiPei.h", "Library/DebugLib.h", "Library/PeiCoreEntryPoint.h"],
+ SUP_MODULE_PEIM : ["PiPei.h", "Library/DebugLib.h", "Library/PeimEntryPoint.h"],
+ SUP_MODULE_DXE_CORE : ["PiDxe.h", "Library/DebugLib.h", "Library/DxeCoreEntryPoint.h"],
+ SUP_MODULE_DXE_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_DXE_SMM_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_DXE_RUNTIME_DRIVER: ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_DXE_SAL_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_UEFI_DRIVER : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_UEFI_APPLICATION : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntryPoint.h"],
+ SUP_MODULE_SMM_CORE : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
+ SUP_MODULE_MM_STANDALONE : ["PiMm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/StandaloneMmDriverEntryPoint.h"],
+ SUP_MODULE_MM_CORE_STANDALONE : ["PiMm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/StandaloneMmCoreEntryPoint.h"],
+ SUP_MODULE_USER_DEFINED : [gBasicHeaderFile, "Library/DebugLib.h"],
+ SUP_MODULE_HOST_APPLICATION : [gBasicHeaderFile, "Library/DebugLib.h"]
+}
+
+## Autogen internal worker macro to define DynamicEx PCD name includes both the TokenSpaceGuidName
+# the TokenName and Guid comparison to avoid define name collisions.
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenH The TemplateString object for header file
+#
+#
+def DynExPcdTokenNumberMapping(Info, AutoGenH):
+ ExTokenCNameList = []
+ PcdExList = []
+ # Even it is the Library, the PCD is saved in the ModulePcdList
+ PcdList = Info.ModulePcdList
+ for Pcd in PcdList:
+ if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
+ ExTokenCNameList.append(Pcd.TokenCName)
+ PcdExList.append(Pcd)
+ if len(ExTokenCNameList) == 0:
+ return
+ AutoGenH.Append('\n#define COMPAREGUID(Guid1, Guid2) (BOOLEAN)(*(CONST UINT64*)Guid1 == *(CONST UINT64*)Guid2 && *((CONST UINT64*)Guid1 + 1) == *((CONST UINT64*)Guid2 + 1))\n')
+ # AutoGen for each PCD listed in a [PcdEx] section of a Module/Lib INF file.
+ # Auto generate a macro for each TokenName that takes a Guid pointer as a parameter.
+ # Use the Guid pointer to see if it matches any of the token space GUIDs.
+ TokenCNameList = set()
+ for TokenCName in ExTokenCNameList:
+ if TokenCName in TokenCNameList:
+ continue
+ Index = 0
+ Count = ExTokenCNameList.count(TokenCName)
+ for Pcd in PcdExList:
+ RealTokenCName = Pcd.TokenCName
+ for PcdItem in GlobalData.MixedPcd:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ RealTokenCName = PcdItem[0]
+ break
+ if Pcd.TokenCName == TokenCName:
+ Index = Index + 1
+ if Index == 1:
+ AutoGenH.Append('\n#define __PCD_%s_ADDR_CMP(GuidPtr) (' % (RealTokenCName))
+ AutoGenH.Append('\\\n (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:'
+ % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, RealTokenCName))
+ else:
+ AutoGenH.Append('\\\n (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:'
+ % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, RealTokenCName))
+ if Index == Count:
+ AutoGenH.Append('0 \\\n )\n')
+ TokenCNameList.add(TokenCName)
+
+ TokenCNameList = set()
+ for TokenCName in ExTokenCNameList:
+ if TokenCName in TokenCNameList:
+ continue
+ Index = 0
+ Count = ExTokenCNameList.count(TokenCName)
+ for Pcd in PcdExList:
+ RealTokenCName = Pcd.TokenCName
+ for PcdItem in GlobalData.MixedPcd:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ RealTokenCName = PcdItem[0]
+ break
+ if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenCName == TokenCName:
+ Index = Index + 1
+ if Index == 1:
+ AutoGenH.Append('\n#define __PCD_%s_VAL_CMP(GuidPtr) (' % (RealTokenCName))
+ AutoGenH.Append('\\\n (GuidPtr == NULL) ? 0:')
+ AutoGenH.Append('\\\n COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:'
+ % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, RealTokenCName))
+ else:
+ AutoGenH.Append('\\\n COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:'
+ % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, RealTokenCName))
+ if Index == Count:
+ AutoGenH.Append('0 \\\n )\n')
+ # Autogen internal worker macro to compare GUIDs. Guid1 is a pointer to a GUID.
+ # Guid2 is a C name for a GUID. Compare pointers first because optimizing compiler
+ # can do this at build time on CONST GUID pointers and optimize away call to COMPAREGUID().
+ # COMPAREGUID() will only be used if the Guid passed in is local to the module.
+ AutoGenH.Append('#define _PCD_TOKEN_EX_%s(GuidPtr) __PCD_%s_ADDR_CMP(GuidPtr) ? __PCD_%s_ADDR_CMP(GuidPtr) : __PCD_%s_VAL_CMP(GuidPtr) \n'
+ % (RealTokenCName, RealTokenCName, RealTokenCName, RealTokenCName))
+ TokenCNameList.add(TokenCName)
+
+## Create code for module PCDs
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+# @param Pcd The PCD object
+#
+def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
+ TokenSpaceGuidValue = Pcd.TokenSpaceGuidValue #Info.GuidList[Pcd.TokenSpaceGuidCName]
+ PcdTokenNumber = Info.PlatformInfo.PcdTokenNumber
+ #
+ # Write PCDs
+ #
+ TokenCName = Pcd.TokenCName
+ for PcdItem in GlobalData.MixedPcd:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ TokenCName = PcdItem[0]
+ break
+ PcdTokenName = '_PCD_TOKEN_' + TokenCName
+ PatchPcdSizeTokenName = '_PCD_PATCHABLE_' + TokenCName +'_SIZE'
+ PatchPcdSizeVariableName = '_gPcd_BinaryPatch_Size_' + TokenCName
+ PatchPcdMaxSizeVariable = '_gPcd_BinaryPatch_MaxSize_' + TokenCName
+ FixPcdSizeTokenName = '_PCD_SIZE_' + TokenCName
+ FixedPcdSizeVariableName = '_gPcd_FixedAtBuild_Size_' + TokenCName
+
+ if Pcd.PcdValueFromComm:
+ Pcd.DefaultValue = Pcd.PcdValueFromComm
+ elif Pcd.PcdValueFromFdf:
+ Pcd.DefaultValue = Pcd.PcdValueFromFdf
+
+ if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
+ TokenNumber = int(Pcd.TokenValue, 0)
+ # Add TokenSpaceGuidValue value to PcdTokenName to discriminate the DynamicEx PCDs with
+ # different Guids but same TokenCName
+ PcdExTokenName = '_PCD_TOKEN_' + Pcd.TokenSpaceGuidCName + '_' + TokenCName
+ AutoGenH.Append('\n#define %s %dU\n' % (PcdExTokenName, TokenNumber))
+ else:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber:
+ # If one of the Source built modules listed in the DSC is not listed in FDF modules,
+ # and the INF lists a PCD can only use the PcdsDynamic access method (it is only
+ # listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will
+ # report warning message notify the PI that they are attempting to build a module
+ # that must be included in a flash image in order to be functional. These Dynamic PCD
+ # will not be added into the Database unless it is used by other modules that are
+ # included in the FDF file.
+ # In this case, just assign an invalid token number to make it pass build.
+ if Pcd.Type in PCD_DYNAMIC_TYPE_SET:
+ TokenNumber = 0
+ else:
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, TokenCName),
+ ExtraData="[%s]" % str(Info))
+ else:
+ TokenNumber = PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName]
+ AutoGenH.Append('\n#define %s %dU\n' % (PcdTokenName, TokenNumber))
+
+ EdkLogger.debug(EdkLogger.DEBUG_3, "Creating code for " + TokenCName + "." + Pcd.TokenSpaceGuidCName)
+ if Pcd.Type not in gItemTypeStringDatabase:
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "Unknown PCD type [%s] of PCD %s.%s" % (Pcd.Type, Pcd.TokenSpaceGuidCName, TokenCName),
+ ExtraData="[%s]" % str(Info))
+
+ DatumSize = gDatumSizeStringDatabase[Pcd.DatumType] if Pcd.DatumType in gDatumSizeStringDatabase else gDatumSizeStringDatabase[TAB_VOID]
+ DatumSizeLib = gDatumSizeStringDatabaseLib[Pcd.DatumType] if Pcd.DatumType in gDatumSizeStringDatabaseLib else gDatumSizeStringDatabaseLib[TAB_VOID]
+ GetModeName = '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_' + TokenCName
+ SetModeName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_' + TokenCName
+ SetModeStatusName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_S_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_S_' + TokenCName
+ GetModeSizeName = '_PCD_GET_MODE_SIZE' + '_' + TokenCName
+
+ if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
+ if Info.IsLibrary:
+ PcdList = Info.LibraryPcdList
+ else:
+ PcdList = Info.ModulePcdList + Info.LibraryPcdList
+ PcdExCNameTest = 0
+ for PcdModule in PcdList:
+ if PcdModule.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenCName == PcdModule.TokenCName:
+ PcdExCNameTest += 1
+ # get out early once we found > 1...
+ if PcdExCNameTest > 1:
+ break
+ # Be compatible with the current code which using PcdToken and PcdGet/Set for DynamicEx Pcd.
+ # If only PcdToken and PcdGet/Set used in all Pcds with different CName, it should succeed to build.
+ # If PcdToken and PcdGet/Set used in the Pcds with different Guids but same CName, it should failed to build.
+ if PcdExCNameTest > 1:
+ AutoGenH.Append('// Disabled the macros, as PcdToken and PcdGet/Set are not allowed in the case that more than one DynamicEx Pcds are different Guids but same CName.\n')
+ AutoGenH.Append('// #define %s %s\n' % (PcdTokenName, PcdExTokenName))
+ AutoGenH.Append('// #define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ AutoGenH.Append('// #define %s LibPcdGetExSize(&%s, %s)\n' % (GetModeSizeName, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
+ AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ else:
+ AutoGenH.Append('// #define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ AutoGenH.Append('// #define %s(Value) LibPcdSetEx%sS(&%s, %s, (Value))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ else:
+ AutoGenH.Append('#define %s %s\n' % (PcdTokenName, PcdExTokenName))
+ AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ AutoGenH.Append('#define %s LibPcdGetExSize(&%s, %s)\n' % (GetModeSizeName, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
+ AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ else:
+ AutoGenH.Append('#define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ AutoGenH.Append('#define %s(Value) LibPcdSetEx%sS(&%s, %s, (Value))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ elif Pcd.Type in PCD_DYNAMIC_TYPE_SET:
+ PcdCNameTest = 0
+ for PcdModule in Info.LibraryPcdList + Info.ModulePcdList:
+ if PcdModule.Type in PCD_DYNAMIC_TYPE_SET and Pcd.TokenCName == PcdModule.TokenCName:
+ PcdCNameTest += 1
+ # get out early once we found > 1...
+ if PcdCNameTest > 1:
+ break
+ if PcdCNameTest > 1:
+ EdkLogger.error("build", AUTOGEN_ERROR, "More than one Dynamic Pcds [%s] are different Guids but same CName. They need to be changed to DynamicEx type to avoid the confliction.\n" % (TokenCName), ExtraData="[%s]" % str(Info.MetaFile.Path))
+ else:
+ AutoGenH.Append('#define %s LibPcdGet%s(%s)\n' % (GetModeName, DatumSizeLib, PcdTokenName))
+ AutoGenH.Append('#define %s LibPcdGetSize(%s)\n' % (GetModeSizeName, PcdTokenName))
+ if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
+ AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%s(%s, (SizeOfBuffer), (Buffer))\n' %(SetModeName, DatumSizeLib, PcdTokenName))
+ AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%sS(%s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName))
+ else:
+ AutoGenH.Append('#define %s(Value) LibPcdSet%s(%s, (Value))\n' % (SetModeName, DatumSizeLib, PcdTokenName))
+ AutoGenH.Append('#define %s(Value) LibPcdSet%sS(%s, (Value))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName))
+ else:
+ PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[Pcd.Type] + '_' + TokenCName
+ Const = 'const'
+ if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE:
+ Const = ''
+ Type = ''
+ Array = ''
+ Value = Pcd.DefaultValue
+ Unicode = False
+ ValueNumber = 0
+
+ if Pcd.DatumType == 'BOOLEAN':
+ BoolValue = Value.upper()
+ if BoolValue == 'TRUE' or BoolValue == '1':
+ Value = '1U'
+ elif BoolValue == 'FALSE' or BoolValue == '0':
+ Value = '0U'
+
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ try:
+ if Value.upper().endswith('L'):
+ Value = Value[:-1]
+ if Value.startswith('0') and not Value.lower().startswith('0x') and len(Value) > 1 and Value.lstrip('0'):
+ Value = Value.lstrip('0')
+ ValueNumber = int (Value, 0)
+ except:
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "PCD value is not valid dec or hex number for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),
+ ExtraData="[%s]" % str(Info))
+ if ValueNumber < 0:
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),
+ ExtraData="[%s]" % str(Info))
+ elif ValueNumber > MAX_VAL_TYPE[Pcd.DatumType]:
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),
+ ExtraData="[%s]" % str(Info))
+ if Pcd.DatumType == TAB_UINT64 and not Value.endswith('ULL'):
+ Value += 'ULL'
+ elif Pcd.DatumType != TAB_UINT64 and not Value.endswith('U'):
+ Value += 'U'
+
+ if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
+ if not Pcd.MaxDatumSize:
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "Unknown [MaxDatumSize] of PCD [%s.%s]" % (Pcd.TokenSpaceGuidCName, TokenCName),
+ ExtraData="[%s]" % str(Info))
+
+ ArraySize = int(Pcd.MaxDatumSize, 0)
+ if Value[0] == '{':
+ Type = '(VOID *)'
+ ValueSize = len(Value.split(','))
+ else:
+ if Value[0] == 'L':
+ Unicode = True
+ Value = Value.lstrip('L') #.strip('"')
+ Value = eval(Value) # translate escape character
+ ValueSize = len(Value) + 1
+ NewValue = '{'
+ for Index in range(0, len(Value)):
+ if Unicode:
+ NewValue = NewValue + str(ord(Value[Index]) % 0x10000) + ', '
+ else:
+ NewValue = NewValue + str(ord(Value[Index]) % 0x100) + ', '
+ if Unicode:
+ ArraySize = ArraySize // 2
+ Value = NewValue + '0 }'
+ if ArraySize < ValueSize:
+ if Pcd.MaxSizeUserSet:
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, TokenCName),
+ ExtraData="[%s]" % str(Info))
+ else:
+ ArraySize = Pcd.GetPcdSize()
+ if Unicode:
+ ArraySize = ArraySize // 2
+ Array = '[%d]' % ArraySize
+ #
+ # skip casting for fixed at build since it breaks ARM assembly.
+ # Long term we need PCD macros that work in assembly
+ #
+ elif Pcd.Type != TAB_PCDS_FIXED_AT_BUILD and Pcd.DatumType in TAB_PCD_NUMERIC_TYPES_VOID:
+ Value = "((%s)%s)" % (Pcd.DatumType, Value)
+
+ if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE:
+ PcdValueName = '_PCD_PATCHABLE_VALUE_' + TokenCName
+ else:
+ PcdValueName = '_PCD_VALUE_' + TokenCName
+
+ if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
+ #
+ # For unicode, UINT16 array will be generated, so the alignment of unicode is guaranteed.
+ #
+ AutoGenH.Append('#define %s %s%s\n' %(PcdValueName, Type, PcdVariableName))
+ if Unicode:
+ AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s UINT16 %s%s = %s;\n' % (Const, PcdVariableName, Array, Value))
+ AutoGenH.Append('extern %s UINT16 %s%s;\n' %(Const, PcdVariableName, Array))
+ else:
+ AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s UINT8 %s%s = %s;\n' % (Const, PcdVariableName, Array, Value))
+ AutoGenH.Append('extern %s UINT8 %s%s;\n' %(Const, PcdVariableName, Array))
+ AutoGenH.Append('#define %s %s%s\n' %(GetModeName, Type, PcdVariableName))
+
+ PcdDataSize = Pcd.GetPcdSize()
+ if Pcd.Type == TAB_PCDS_FIXED_AT_BUILD:
+ AutoGenH.Append('#define %s %s\n' % (FixPcdSizeTokenName, PcdDataSize))
+ AutoGenH.Append('#define %s %s \n' % (GetModeSizeName, FixPcdSizeTokenName))
+ AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED const UINTN %s = %s;\n' % (FixedPcdSizeVariableName, PcdDataSize))
+ if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE:
+ AutoGenH.Append('#define %s %s\n' % (PatchPcdSizeTokenName, Pcd.MaxDatumSize))
+ AutoGenH.Append('#define %s %s \n' % (GetModeSizeName, PatchPcdSizeVariableName))
+ AutoGenH.Append('extern UINTN %s; \n' % PatchPcdSizeVariableName)
+ AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED UINTN %s = %s;\n' % (PatchPcdSizeVariableName, PcdDataSize))
+ AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED const UINTN %s = %s;\n' % (PatchPcdMaxSizeVariable, Pcd.MaxDatumSize))
+ elif Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE:
+ AutoGenH.Append('#define %s %s\n' %(PcdValueName, Value))
+ AutoGenC.Append('volatile %s %s %s = %s;\n' %(Const, Pcd.DatumType, PcdVariableName, PcdValueName))
+ AutoGenH.Append('extern volatile %s %s %s%s;\n' % (Const, Pcd.DatumType, PcdVariableName, Array))
+ AutoGenH.Append('#define %s %s%s\n' % (GetModeName, Type, PcdVariableName))
+
+ PcdDataSize = Pcd.GetPcdSize()
+ AutoGenH.Append('#define %s %s\n' % (PatchPcdSizeTokenName, PcdDataSize))
+
+ AutoGenH.Append('#define %s %s \n' % (GetModeSizeName, PatchPcdSizeVariableName))
+ AutoGenH.Append('extern UINTN %s; \n' % PatchPcdSizeVariableName)
+ AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED UINTN %s = %s;\n' % (PatchPcdSizeVariableName, PcdDataSize))
+ else:
+ PcdDataSize = Pcd.GetPcdSize()
+ AutoGenH.Append('#define %s %s\n' % (FixPcdSizeTokenName, PcdDataSize))
+ AutoGenH.Append('#define %s %s \n' % (GetModeSizeName, FixPcdSizeTokenName))
+
+ AutoGenH.Append('#define %s %s\n' %(PcdValueName, Value))
+ AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s %s = %s;\n' %(Const, Pcd.DatumType, PcdVariableName, PcdValueName))
+ AutoGenH.Append('extern %s %s %s%s;\n' % (Const, Pcd.DatumType, PcdVariableName, Array))
+ AutoGenH.Append('#define %s %s%s\n' % (GetModeName, Type, PcdVariableName))
+
+ if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE:
+ if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
+ AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeName, Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName))
+ AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSizeS((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName))
+ else:
+ AutoGenH.Append('#define %s(Value) (%s = (Value))\n' % (SetModeName, PcdVariableName))
+ AutoGenH.Append('#define %s(Value) ((%s = (Value)), RETURN_SUCCESS) \n' % (SetModeStatusName, PcdVariableName))
+ else:
+ AutoGenH.Append('//#define %s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName)
+
+## Create code for library module PCDs
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+# @param Pcd The PCD object
+#
+def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
+ PcdTokenNumber = Info.PlatformInfo.PcdTokenNumber
+ TokenSpaceGuidCName = Pcd.TokenSpaceGuidCName
+ TokenCName = Pcd.TokenCName
+ for PcdItem in GlobalData.MixedPcd:
+ if (TokenCName, TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ TokenCName = PcdItem[0]
+ break
+ PcdTokenName = '_PCD_TOKEN_' + TokenCName
+ FixPcdSizeTokenName = '_PCD_SIZE_' + TokenCName
+ PatchPcdSizeTokenName = '_PCD_PATCHABLE_' + TokenCName +'_SIZE'
+ PatchPcdSizeVariableName = '_gPcd_BinaryPatch_Size_' + TokenCName
+ PatchPcdMaxSizeVariable = '_gPcd_BinaryPatch_MaxSize_' + TokenCName
+ FixedPcdSizeVariableName = '_gPcd_FixedAtBuild_Size_' + TokenCName
+
+ if Pcd.PcdValueFromComm:
+ Pcd.DefaultValue = Pcd.PcdValueFromComm
+ elif Pcd.PcdValueFromFdf:
+ Pcd.DefaultValue = Pcd.PcdValueFromFdf
+ #
+ # Write PCDs
+ #
+ if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
+ TokenNumber = int(Pcd.TokenValue, 0)
+ else:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber:
+ # If one of the Source built modules listed in the DSC is not listed in FDF modules,
+ # and the INF lists a PCD can only use the PcdsDynamic access method (it is only
+ # listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will
+ # report warning message notify the PI that they are attempting to build a module
+ # that must be included in a flash image in order to be functional. These Dynamic PCD
+ # will not be added into the Database unless it is used by other modules that are
+ # included in the FDF file.
+ # In this case, just assign an invalid token number to make it pass build.
+ if Pcd.Type in PCD_DYNAMIC_TYPE_SET:
+ TokenNumber = 0
+ else:
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, TokenCName),
+ ExtraData="[%s]" % str(Info))
+ else:
+ TokenNumber = PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName]
+
+ if Pcd.Type not in gItemTypeStringDatabase:
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "Unknown PCD type [%s] of PCD %s.%s" % (Pcd.Type, Pcd.TokenSpaceGuidCName, TokenCName),
+ ExtraData="[%s]" % str(Info))
+
+ DatumType = Pcd.DatumType
+ DatumSize = gDatumSizeStringDatabase[Pcd.DatumType] if Pcd.DatumType in gDatumSizeStringDatabase else gDatumSizeStringDatabase[TAB_VOID]
+ DatumSizeLib = gDatumSizeStringDatabaseLib[Pcd.DatumType] if Pcd.DatumType in gDatumSizeStringDatabaseLib else gDatumSizeStringDatabaseLib[TAB_VOID]
+ GetModeName = '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_' + TokenCName
+ SetModeName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_' + TokenCName
+ SetModeStatusName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_S_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_S_' + TokenCName
+ GetModeSizeName = '_PCD_GET_MODE_SIZE' + '_' + TokenCName
+
+ Type = ''
+ Array = ''
+ if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
+ if Pcd.DefaultValue[0]== '{':
+ Type = '(VOID *)'
+ Array = '[]'
+ PcdItemType = Pcd.Type
+ if PcdItemType in PCD_DYNAMIC_EX_TYPE_SET:
+ PcdExTokenName = '_PCD_TOKEN_' + TokenSpaceGuidCName + '_' + TokenCName
+ AutoGenH.Append('\n#define %s %dU\n' % (PcdExTokenName, TokenNumber))
+
+ if Info.IsLibrary:
+ PcdList = Info.LibraryPcdList
+ else:
+ PcdList = Info.ModulePcdList
+ PcdExCNameTest = 0
+ for PcdModule in PcdList:
+ if PcdModule.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenCName == PcdModule.TokenCName:
+ PcdExCNameTest += 1
+ # get out early once we found > 1...
+ if PcdExCNameTest > 1:
+ break
+ # Be compatible with the current code which using PcdGet/Set for DynamicEx Pcd.
+ # If only PcdGet/Set used in all Pcds with different CName, it should succeed to build.
+ # If PcdGet/Set used in the Pcds with different Guids but same CName, it should failed to build.
+ if PcdExCNameTest > 1:
+ AutoGenH.Append('// Disabled the macros, as PcdToken and PcdGet/Set are not allowed in the case that more than one DynamicEx Pcds are different Guids but same CName.\n')
+ AutoGenH.Append('// #define %s %s\n' % (PcdTokenName, PcdExTokenName))
+ AutoGenH.Append('// #define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ AutoGenH.Append('// #define %s LibPcdGetExSize(&%s, %s)\n' % (GetModeSizeName, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
+ AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ else:
+ AutoGenH.Append('// #define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ AutoGenH.Append('// #define %s(Value) LibPcdSetEx%sS(&%s, %s, (Value))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ else:
+ AutoGenH.Append('#define %s %s\n' % (PcdTokenName, PcdExTokenName))
+ AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ AutoGenH.Append('#define %s LibPcdGetExSize(&%s, %s)\n' % (GetModeSizeName, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
+ AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ else:
+ AutoGenH.Append('#define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ AutoGenH.Append('#define %s(Value) LibPcdSetEx%sS(&%s, %s, (Value))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
+ else:
+ AutoGenH.Append('#define _PCD_TOKEN_%s %dU\n' % (TokenCName, TokenNumber))
+ if PcdItemType in PCD_DYNAMIC_TYPE_SET:
+ PcdList = []
+ PcdCNameList = []
+ PcdList.extend(Info.LibraryPcdList)
+ PcdList.extend(Info.ModulePcdList)
+ for PcdModule in PcdList:
+ if PcdModule.Type in PCD_DYNAMIC_TYPE_SET:
+ PcdCNameList.append(PcdModule.TokenCName)
+ if PcdCNameList.count(Pcd.TokenCName) > 1:
+ EdkLogger.error("build", AUTOGEN_ERROR, "More than one Dynamic Pcds [%s] are different Guids but same CName.They need to be changed to DynamicEx type to avoid the confliction.\n" % (TokenCName), ExtraData="[%s]" % str(Info.MetaFile.Path))
+ else:
+ AutoGenH.Append('#define %s LibPcdGet%s(%s)\n' % (GetModeName, DatumSizeLib, PcdTokenName))
+ AutoGenH.Append('#define %s LibPcdGetSize(%s)\n' % (GetModeSizeName, PcdTokenName))
+ if DatumType not in TAB_PCD_NUMERIC_TYPES:
+ AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%s(%s, (SizeOfBuffer), (Buffer))\n' %(SetModeName, DatumSizeLib, PcdTokenName))
+ AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%sS(%s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName))
+ else:
+ AutoGenH.Append('#define %s(Value) LibPcdSet%s(%s, (Value))\n' % (SetModeName, DatumSizeLib, PcdTokenName))
+ AutoGenH.Append('#define %s(Value) LibPcdSet%sS(%s, (Value))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName))
+ if PcdItemType == TAB_PCDS_PATCHABLE_IN_MODULE:
+ PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[TAB_PCDS_PATCHABLE_IN_MODULE] + '_' + TokenCName
+ if DatumType not in TAB_PCD_NUMERIC_TYPES:
+ if DatumType == TAB_VOID and Array == '[]':
+ DatumType = [TAB_UINT8, TAB_UINT16][Pcd.DefaultValue[0] == 'L']
+ else:
+ DatumType = TAB_UINT8
+ AutoGenH.Append('extern %s _gPcd_BinaryPatch_%s%s;\n' %(DatumType, TokenCName, Array))
+ else:
+ AutoGenH.Append('extern volatile %s %s%s;\n' % (DatumType, PcdVariableName, Array))
+ AutoGenH.Append('#define %s %s_gPcd_BinaryPatch_%s\n' %(GetModeName, Type, TokenCName))
+ PcdDataSize = Pcd.GetPcdSize()
+ if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
+ AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, &%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, TokenCName, PatchPcdSizeVariableName, PatchPcdMaxSizeVariable))
+ AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSizeS((VOID *)_gPcd_BinaryPatch_%s, &%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, TokenCName, PatchPcdSizeVariableName, PatchPcdMaxSizeVariable))
+ AutoGenH.Append('#define %s %s\n' % (PatchPcdSizeTokenName, PatchPcdMaxSizeVariable))
+ AutoGenH.Append('extern const UINTN %s; \n' % PatchPcdMaxSizeVariable)
+ else:
+ AutoGenH.Append('#define %s(Value) (%s = (Value))\n' % (SetModeName, PcdVariableName))
+ AutoGenH.Append('#define %s(Value) ((%s = (Value)), RETURN_SUCCESS)\n' % (SetModeStatusName, PcdVariableName))
+ AutoGenH.Append('#define %s %s\n' % (PatchPcdSizeTokenName, PcdDataSize))
+
+ AutoGenH.Append('#define %s %s\n' % (GetModeSizeName, PatchPcdSizeVariableName))
+ AutoGenH.Append('extern UINTN %s; \n' % PatchPcdSizeVariableName)
+
+ if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG:
+ key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
+ PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[Pcd.Type] + '_' + TokenCName
+ if DatumType == TAB_VOID and Array == '[]':
+ DatumType = [TAB_UINT8, TAB_UINT16][Pcd.DefaultValue[0] == 'L']
+ if DatumType not in TAB_PCD_NUMERIC_TYPES_VOID:
+ DatumType = TAB_UINT8
+ AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array))
+ AutoGenH.Append('#define %s %s_gPcd_FixedAtBuild_%s\n' %(GetModeName, Type, TokenCName))
+ AutoGenH.Append('//#define %s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName)
+
+ ConstFixedPcd = False
+ if PcdItemType == TAB_PCDS_FIXED_AT_BUILD and (key in Info.ConstPcd or (Info.IsLibrary and not Info.ReferenceModules)):
+ ConstFixedPcd = True
+ if key in Info.ConstPcd:
+ Pcd.DefaultValue = Info.ConstPcd[key]
+ if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
+ AutoGenH.Append('#define _PCD_VALUE_%s %s%s\n' %(TokenCName, Type, PcdVariableName))
+ else:
+ AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName, Pcd.DefaultValue))
+ PcdDataSize = Pcd.GetPcdSize()
+ if PcdItemType == TAB_PCDS_FIXED_AT_BUILD:
+ if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
+ if ConstFixedPcd:
+ AutoGenH.Append('#define %s %s\n' % (FixPcdSizeTokenName, PcdDataSize))
+ AutoGenH.Append('#define %s %s\n' % (GetModeSizeName, FixPcdSizeTokenName))
+ else:
+ AutoGenH.Append('#define %s %s\n' % (GetModeSizeName, FixedPcdSizeVariableName))
+ AutoGenH.Append('#define %s %s\n' % (FixPcdSizeTokenName, FixedPcdSizeVariableName))
+ AutoGenH.Append('extern const UINTN %s; \n' % FixedPcdSizeVariableName)
+ else:
+ AutoGenH.Append('#define %s %s\n' % (FixPcdSizeTokenName, PcdDataSize))
+ AutoGenH.Append('#define %s %s\n' % (GetModeSizeName, FixPcdSizeTokenName))
+
+## Create code for library constructor
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+#
+def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
+ #
+ # Library Constructors
+ #
+ ConstructorPrototypeString = TemplateString()
+ ConstructorCallingString = TemplateString()
+ if Info.IsLibrary:
+ DependentLibraryList = [Info.Module]
+ else:
+ DependentLibraryList = Info.DependentLibraryList
+ for Lib in DependentLibraryList:
+ if len(Lib.ConstructorList) <= 0:
+ continue
+ Dict = {'Function':Lib.ConstructorList}
+ if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
+ ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE_BASE].Replace(Dict))
+ ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Replace(Dict))
+ if Info.ModuleType not in [SUP_MODULE_BASE, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
+ if Lib.ModuleType in SUP_MODULE_SET_PEI:
+ ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
+ ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
+ elif Lib.ModuleType in [SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER,
+ SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_SMM_CORE]:
+ ConstructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict))
+ ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict))
+ elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE]:
+ ConstructorPrototypeString.Append(gLibraryStructorPrototype['MM'].Replace(Dict))
+ ConstructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dict))
+
+ if str(ConstructorPrototypeString) == '':
+ ConstructorPrototypeList = []
+ else:
+ ConstructorPrototypeList = [str(ConstructorPrototypeString)]
+ if str(ConstructorCallingString) == '':
+ ConstructorCallingList = []
+ else:
+ ConstructorCallingList = [str(ConstructorCallingString)]
+
+ Dict = {
+ 'Type' : 'Constructor',
+ 'FunctionPrototype' : ConstructorPrototypeList,
+ 'FunctionCall' : ConstructorCallingList
+ }
+ if Info.IsLibrary:
+ AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
+ else:
+ if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
+ AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
+ elif Info.ModuleType in SUP_MODULE_SET_PEI:
+ AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
+ elif Info.ModuleType in [SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER,
+ SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_SMM_CORE]:
+ AutoGenC.Append(gLibraryString['DXE'].Replace(Dict))
+ elif Info.ModuleType in [SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE]:
+ AutoGenC.Append(gLibraryString['MM'].Replace(Dict))
+
+## Create code for library destructor
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+#
+def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
+ #
+ # Library Destructors
+ #
+ DestructorPrototypeString = TemplateString()
+ DestructorCallingString = TemplateString()
+ if Info.IsLibrary:
+ DependentLibraryList = [Info.Module]
+ else:
+ DependentLibraryList = Info.DependentLibraryList
+ for Index in range(len(DependentLibraryList)-1, -1, -1):
+ Lib = DependentLibraryList[Index]
+ if len(Lib.DestructorList) <= 0:
+ continue
+ Dict = {'Function':Lib.DestructorList}
+ if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
+ DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE_BASE].Replace(Dict))
+ DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Replace(Dict))
+ if Info.ModuleType not in [SUP_MODULE_BASE, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
+ if Lib.ModuleType in SUP_MODULE_SET_PEI:
+ DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
+ DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
+ elif Lib.ModuleType in [SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER,
+ SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_SMM_CORE]:
+ DestructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict))
+ DestructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict))
+ elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE]:
+ DestructorPrototypeString.Append(gLibraryStructorPrototype['MM'].Replace(Dict))
+ DestructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dict))
+
+ if str(DestructorPrototypeString) == '':
+ DestructorPrototypeList = []
+ else:
+ DestructorPrototypeList = [str(DestructorPrototypeString)]
+ if str(DestructorCallingString) == '':
+ DestructorCallingList = []
+ else:
+ DestructorCallingList = [str(DestructorCallingString)]
+
+ Dict = {
+ 'Type' : 'Destructor',
+ 'FunctionPrototype' : DestructorPrototypeList,
+ 'FunctionCall' : DestructorCallingList
+ }
+ if Info.IsLibrary:
+ AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
+ else:
+ if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
+ AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
+ elif Info.ModuleType in SUP_MODULE_SET_PEI:
+ AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
+ elif Info.ModuleType in [SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER,
+ SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_SMM_CORE]:
+ AutoGenC.Append(gLibraryString['DXE'].Replace(Dict))
+ elif Info.ModuleType in [SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE]:
+ AutoGenC.Append(gLibraryString['MM'].Replace(Dict))
+
+
+## Create code for ModuleEntryPoint
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+#
+def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
+ if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SEC]:
+ return
+ #
+ # Module Entry Points
+ #
+ NumEntryPoints = len(Info.Module.ModuleEntryPointList)
+ if 'PI_SPECIFICATION_VERSION' in Info.Module.Specification:
+ PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION']
+ else:
+ PiSpecVersion = '0x00000000'
+ if 'UEFI_SPECIFICATION_VERSION' in Info.Module.Specification:
+ UefiSpecVersion = Info.Module.Specification['UEFI_SPECIFICATION_VERSION']
+ else:
+ UefiSpecVersion = '0x00000000'
+ Dict = {
+ 'Function' : Info.Module.ModuleEntryPointList,
+ 'PiSpecVersion' : PiSpecVersion + 'U',
+ 'UefiSpecVersion': UefiSpecVersion + 'U'
+ }
+
+ if Info.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_DXE_CORE, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE]:
+ if Info.SourceFileList:
+ if NumEntryPoints != 1:
+ EdkLogger.error(
+ "build",
+ AUTOGEN_ERROR,
+ '%s must have exactly one entry point' % Info.ModuleType,
+ File=str(Info),
+ ExtraData= ", ".join(Info.Module.ModuleEntryPointList)
+ )
+ if Info.ModuleType == SUP_MODULE_PEI_CORE:
+ AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict))
+ AutoGenH.Append(gPeiCoreEntryPointPrototype.Replace(Dict))
+ elif Info.ModuleType == SUP_MODULE_DXE_CORE:
+ AutoGenC.Append(gDxeCoreEntryPointString.Replace(Dict))
+ AutoGenH.Append(gDxeCoreEntryPointPrototype.Replace(Dict))
+ elif Info.ModuleType == SUP_MODULE_SMM_CORE:
+ AutoGenC.Append(gSmmCoreEntryPointString.Replace(Dict))
+ AutoGenH.Append(gSmmCoreEntryPointPrototype.Replace(Dict))
+ elif Info.ModuleType == SUP_MODULE_MM_CORE_STANDALONE:
+ AutoGenC.Append(gMmCoreStandaloneEntryPointString.Replace(Dict))
+ AutoGenH.Append(gMmCoreStandaloneEntryPointPrototype.Replace(Dict))
+ elif Info.ModuleType == SUP_MODULE_PEIM:
+ if NumEntryPoints < 2:
+ AutoGenC.Append(gPeimEntryPointString[NumEntryPoints].Replace(Dict))
+ else:
+ AutoGenC.Append(gPeimEntryPointString[2].Replace(Dict))
+ AutoGenH.Append(gPeimEntryPointPrototype.Replace(Dict))
+ elif Info.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]:
+ if NumEntryPoints < 2:
+ AutoGenC.Append(gUefiDriverEntryPointString[NumEntryPoints].Replace(Dict))
+ else:
+ AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict))
+ AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict))
+ elif Info.ModuleType == SUP_MODULE_DXE_SMM_DRIVER:
+ if NumEntryPoints == 0:
+ AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict))
+ else:
+ AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict))
+ AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict))
+ elif Info.ModuleType == SUP_MODULE_MM_STANDALONE:
+ if NumEntryPoints < 2:
+ AutoGenC.Append(gMmStandaloneEntryPointString[NumEntryPoints].Replace(Dict))
+ else:
+ AutoGenC.Append(gMmStandaloneEntryPointString[2].Replace(Dict))
+ AutoGenH.Append(gMmStandaloneEntryPointPrototype.Replace(Dict))
+ elif Info.ModuleType == SUP_MODULE_UEFI_APPLICATION:
+ if NumEntryPoints < 2:
+ AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoints].Replace(Dict))
+ else:
+ AutoGenC.Append(gUefiApplicationEntryPointString[2].Replace(Dict))
+ AutoGenH.Append(gUefiApplicationEntryPointPrototype.Replace(Dict))
+
+## Create code for ModuleUnloadImage
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+#
+def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
+ if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE, SUP_MODULE_SEC]:
+ return
+ #
+ # Unload Image Handlers
+ #
+ NumUnloadImage = len(Info.Module.ModuleUnloadImageList)
+ Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':Info.Module.ModuleUnloadImageList}
+ if NumUnloadImage < 2:
+ AutoGenC.Append(gUefiUnloadImageString[NumUnloadImage].Replace(Dict))
+ else:
+ AutoGenC.Append(gUefiUnloadImageString[2].Replace(Dict))
+ AutoGenH.Append(gUefiUnloadImagePrototype.Replace(Dict))
+
+## Create code for GUID
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+#
+def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
+ if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
+ GuidType = TAB_GUID
+ else:
+ GuidType = "EFI_GUID"
+
+ if Info.GuidList:
+ if not Info.IsLibrary:
+ AutoGenC.Append("\n// Guids\n")
+ AutoGenH.Append("\n// Guids\n")
+ #
+ # GUIDs
+ #
+ for Key in Info.GuidList:
+ if not Info.IsLibrary:
+ AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.GuidList[Key]))
+ AutoGenH.Append('extern %s %s;\n' % (GuidType, Key))
+
+## Create code for protocol
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+#
+def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
+ if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
+ GuidType = TAB_GUID
+ else:
+ GuidType = "EFI_GUID"
+
+ if Info.ProtocolList:
+ if not Info.IsLibrary:
+ AutoGenC.Append("\n// Protocols\n")
+ AutoGenH.Append("\n// Protocols\n")
+ #
+ # Protocol GUIDs
+ #
+ for Key in Info.ProtocolList:
+ if not Info.IsLibrary:
+ AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.ProtocolList[Key]))
+ AutoGenH.Append('extern %s %s;\n' % (GuidType, Key))
+
+## Create code for PPI
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+#
+def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
+ if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
+ GuidType = TAB_GUID
+ else:
+ GuidType = "EFI_GUID"
+
+ if Info.PpiList:
+ if not Info.IsLibrary:
+ AutoGenC.Append("\n// PPIs\n")
+ AutoGenH.Append("\n// PPIs\n")
+ #
+ # PPI GUIDs
+ #
+ for Key in Info.PpiList:
+ if not Info.IsLibrary:
+ AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.PpiList[Key]))
+ AutoGenH.Append('extern %s %s;\n' % (GuidType, Key))
+
+## Create code for PCD
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+#
+def CreatePcdCode(Info, AutoGenC, AutoGenH):
+
+ # Collect Token Space GUIDs used by DynamicEc PCDs
+ TokenSpaceList = []
+ for Pcd in Info.ModulePcdList:
+ if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenSpaceGuidCName not in TokenSpaceList:
+ TokenSpaceList.append(Pcd.TokenSpaceGuidCName)
+
+ SkuMgr = Info.PlatformInfo.Platform.SkuIdMgr
+ AutoGenH.Append("\n// Definition of SkuId Array\n")
+ AutoGenH.Append("extern UINT64 _gPcd_SkuId_Array[];\n")
+ # Add extern declarations to AutoGen.h if one or more Token Space GUIDs were found
+ if TokenSpaceList:
+ AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in this module\n\n")
+ if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
+ GuidType = TAB_GUID
+ else:
+ GuidType = "EFI_GUID"
+ for Item in TokenSpaceList:
+ AutoGenH.Append('extern %s %s;\n' % (GuidType, Item))
+
+ if Info.IsLibrary:
+ if Info.ModulePcdList:
+ AutoGenH.Append("\n// PCD definitions\n")
+ for Pcd in Info.ModulePcdList:
+ CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd)
+ DynExPcdTokenNumberMapping (Info, AutoGenH)
+ else:
+ AutoGenC.Append("\n// Definition of SkuId Array\n")
+ AutoGenC.Append("GLOBAL_REMOVE_IF_UNREFERENCED UINT64 _gPcd_SkuId_Array[] = %s;\n" % SkuMgr.DumpSkuIdArrary())
+ if Info.ModulePcdList:
+ AutoGenH.Append("\n// Definition of PCDs used in this module\n")
+ AutoGenC.Append("\n// Definition of PCDs used in this module\n")
+ for Pcd in Info.ModulePcdList:
+ CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd)
+ DynExPcdTokenNumberMapping (Info, AutoGenH)
+ if Info.LibraryPcdList:
+ AutoGenH.Append("\n// Definition of PCDs used in libraries is in AutoGen.c\n")
+ AutoGenC.Append("\n// Definition of PCDs used in libraries\n")
+ for Pcd in Info.LibraryPcdList:
+ CreateModulePcdCode(Info, AutoGenC, AutoGenC, Pcd)
+ CreatePcdDatabaseCode(Info, AutoGenC, AutoGenH)
+
+## Create code for unicode string definition
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+# @param UniGenCFlag UniString is generated into AutoGen C file when it is set to True
+# @param UniGenBinBuffer Buffer to store uni string package data
+#
+def CreateUnicodeStringCode(Info, AutoGenC, AutoGenH, UniGenCFlag, UniGenBinBuffer):
+ WorkingDir = os.getcwd()
+ os.chdir(Info.WorkspaceDir)
+
+ IncList = [Info.MetaFile.Dir]
+ # Get all files under [Sources] section in inf file for EDK-II module
+ EDK2Module = True
+ SrcList = [F for F in Info.SourceFileList]
+
+ if 'BUILD' in Info.BuildOption and Info.BuildOption['BUILD']['FLAGS'].find('-c') > -1:
+ CompatibleMode = True
+ else:
+ CompatibleMode = False
+
+ #
+ # -s is a temporary option dedicated for building .UNI files with ISO 639-2 language codes of EDK Shell in EDK2
+ #
+ if 'BUILD' in Info.BuildOption and Info.BuildOption['BUILD']['FLAGS'].find('-s') > -1:
+ if CompatibleMode:
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "-c and -s build options should be used exclusively",
+ ExtraData="[%s]" % str(Info))
+ ShellMode = True
+ else:
+ ShellMode = False
+
+ #RFC4646 is only for EDKII modules and ISO639-2 for EDK modules
+ if EDK2Module:
+ FilterInfo = [EDK2Module] + [Info.PlatformInfo.Platform.RFCLanguages]
+ else:
+ FilterInfo = [EDK2Module] + [Info.PlatformInfo.Platform.ISOLanguages]
+ Header, Code = GetStringFiles(Info.UnicodeFileList, SrcList, IncList, Info.IncludePathList, ['.uni', '.inf'], Info.Name, CompatibleMode, ShellMode, UniGenCFlag, UniGenBinBuffer, FilterInfo)
+ if CompatibleMode or UniGenCFlag:
+ AutoGenC.Append("\n//\n//Unicode String Pack Definition\n//\n")
+ AutoGenC.Append(Code)
+ AutoGenC.Append("\n")
+ AutoGenH.Append("\n//\n//Unicode String ID\n//\n")
+ AutoGenH.Append(Header)
+ if CompatibleMode or UniGenCFlag:
+ AutoGenH.Append("\n#define STRING_ARRAY_NAME %sStrings\n" % Info.Name)
+ os.chdir(WorkingDir)
+
+def CreateIdfFileCode(Info, AutoGenC, StringH, IdfGenCFlag, IdfGenBinBuffer):
+ if len(Info.IdfFileList) > 0:
+ ImageFiles = IdfFileClassObject(sorted (Info.IdfFileList))
+ if ImageFiles.ImageFilesDict:
+ Index = 1
+ PaletteIndex = 1
+ IncList = [Info.MetaFile.Dir]
+ SrcList = [F for F in Info.SourceFileList]
+ SkipList = ['.jpg', '.png', '.bmp', '.inf', '.idf']
+ FileList = GetFileList(SrcList, IncList, SkipList)
+ ValueStartPtr = 60
+ StringH.Append("\n//\n//Image ID\n//\n")
+ ImageInfoOffset = 0
+ PaletteInfoOffset = 0
+ ImageBuffer = pack('x')
+ PaletteBuffer = pack('x')
+ BufferStr = ''
+ PaletteStr = ''
+ FileDict = {}
+ for Idf in ImageFiles.ImageFilesDict:
+ if ImageFiles.ImageFilesDict[Idf]:
+ for FileObj in ImageFiles.ImageFilesDict[Idf]:
+ for sourcefile in Info.SourceFileList:
+ if FileObj.FileName == sourcefile.File:
+ if not sourcefile.Ext.upper() in ['.PNG', '.BMP', '.JPG']:
+ EdkLogger.error("build", AUTOGEN_ERROR, "The %s's postfix must be one of .bmp, .jpg, .png" % (FileObj.FileName), ExtraData="[%s]" % str(Info))
+ FileObj.File = sourcefile
+ break
+ else:
+ EdkLogger.error("build", AUTOGEN_ERROR, "The %s in %s is not defined in the driver's [Sources] section" % (FileObj.FileName, Idf), ExtraData="[%s]" % str(Info))
+
+ for FileObj in ImageFiles.ImageFilesDict[Idf]:
+ ID = FileObj.ImageID
+ File = FileObj.File
+ try:
+ SearchImageID (FileObj, FileList)
+ if FileObj.Referenced:
+ if (ValueStartPtr - len(DEFINE_STR + ID)) <= 0:
+ Line = DEFINE_STR + ' ' + ID + ' ' + DecToHexStr(Index, 4) + '\n'
+ else:
+ Line = DEFINE_STR + ' ' + ID + ' ' * (ValueStartPtr - len(DEFINE_STR + ID)) + DecToHexStr(Index, 4) + '\n'
+
+ if File not in FileDict:
+ FileDict[File] = Index
+ else:
+ DuplicateBlock = pack('B', EFI_HII_IIBT_DUPLICATE)
+ DuplicateBlock += pack('H', FileDict[File])
+ ImageBuffer += DuplicateBlock
+ BufferStr = WriteLine(BufferStr, '// %s: %s: %s' % (DecToHexStr(Index, 4), ID, DecToHexStr(Index, 4)))
+ TempBufferList = AscToHexList(DuplicateBlock)
+ BufferStr = WriteLine(BufferStr, CreateArrayItem(TempBufferList, 16) + '\n')
+ StringH.Append(Line)
+ Index += 1
+ continue
+
+ TmpFile = open(File.Path, 'rb')
+ Buffer = TmpFile.read()
+ TmpFile.close()
+ if File.Ext.upper() == '.PNG':
+ TempBuffer = pack('B', EFI_HII_IIBT_IMAGE_PNG)
+ TempBuffer += pack('I', len(Buffer))
+ TempBuffer += Buffer
+ elif File.Ext.upper() == '.JPG':
+ ImageType, = struct.unpack('4s', Buffer[6:10])
+ if ImageType != b'JFIF':
+ EdkLogger.error("build", FILE_TYPE_MISMATCH, "The file %s is not a standard JPG file." % File.Path)
+ TempBuffer = pack('B', EFI_HII_IIBT_IMAGE_JPEG)
+ TempBuffer += pack('I', len(Buffer))
+ TempBuffer += Buffer
+ elif File.Ext.upper() == '.BMP':
+ TempBuffer, TempPalette = BmpImageDecoder(File, Buffer, PaletteIndex, FileObj.TransParent)
+ if len(TempPalette) > 1:
+ PaletteIndex += 1
+ NewPalette = pack('H', len(TempPalette))
+ NewPalette += TempPalette
+ PaletteBuffer += NewPalette
+ PaletteStr = WriteLine(PaletteStr, '// %s: %s: %s' % (DecToHexStr(PaletteIndex - 1, 4), ID, DecToHexStr(PaletteIndex - 1, 4)))
+ TempPaletteList = AscToHexList(NewPalette)
+ PaletteStr = WriteLine(PaletteStr, CreateArrayItem(TempPaletteList, 16) + '\n')
+ ImageBuffer += TempBuffer
+ BufferStr = WriteLine(BufferStr, '// %s: %s: %s' % (DecToHexStr(Index, 4), ID, DecToHexStr(Index, 4)))
+ TempBufferList = AscToHexList(TempBuffer)
+ BufferStr = WriteLine(BufferStr, CreateArrayItem(TempBufferList, 16) + '\n')
+
+ StringH.Append(Line)
+ Index += 1
+ except IOError:
+ EdkLogger.error("build", FILE_NOT_FOUND, ExtraData=File.Path)
+
+ BufferStr = WriteLine(BufferStr, '// End of the Image Info')
+ BufferStr = WriteLine(BufferStr, CreateArrayItem(DecToHexList(EFI_HII_IIBT_END, 2)) + '\n')
+ ImageEnd = pack('B', EFI_HII_IIBT_END)
+ ImageBuffer += ImageEnd
+
+ if len(ImageBuffer) > 1:
+ ImageInfoOffset = 12
+ if len(PaletteBuffer) > 1:
+ PaletteInfoOffset = 12 + len(ImageBuffer) - 1 # -1 is for the first empty pad byte of ImageBuffer
+
+ IMAGE_PACKAGE_HDR = pack('=II', ImageInfoOffset, PaletteInfoOffset)
+ # PACKAGE_HEADER_Length = PACKAGE_HEADER + ImageInfoOffset + PaletteInfoOffset + ImageBuffer Length + PaletteCount + PaletteBuffer Length
+ if len(PaletteBuffer) > 1:
+ PACKAGE_HEADER_Length = 4 + 4 + 4 + len(ImageBuffer) - 1 + 2 + len(PaletteBuffer) - 1
+ else:
+ PACKAGE_HEADER_Length = 4 + 4 + 4 + len(ImageBuffer) - 1
+ if PaletteIndex > 1:
+ PALETTE_INFO_HEADER = pack('H', PaletteIndex - 1)
+ # EFI_HII_PACKAGE_HEADER length max value is 0xFFFFFF
+ Hex_Length = '%06X' % PACKAGE_HEADER_Length
+ if PACKAGE_HEADER_Length > 0xFFFFFF:
+ EdkLogger.error("build", AUTOGEN_ERROR, "The Length of EFI_HII_PACKAGE_HEADER exceed its maximum value", ExtraData="[%s]" % str(Info))
+ PACKAGE_HEADER = pack('=HBB', int('0x' + Hex_Length[2:], 16), int('0x' + Hex_Length[0:2], 16), EFI_HII_PACKAGE_IMAGES)
+
+ IdfGenBinBuffer.write(PACKAGE_HEADER)
+ IdfGenBinBuffer.write(IMAGE_PACKAGE_HDR)
+ if len(ImageBuffer) > 1 :
+ IdfGenBinBuffer.write(ImageBuffer[1:])
+ if PaletteIndex > 1:
+ IdfGenBinBuffer.write(PALETTE_INFO_HEADER)
+ if len(PaletteBuffer) > 1:
+ IdfGenBinBuffer.write(PaletteBuffer[1:])
+
+ if IdfGenCFlag:
+ TotalLength = EFI_HII_ARRAY_SIZE_LENGTH + PACKAGE_HEADER_Length
+ AutoGenC.Append("\n//\n//Image Pack Definition\n//\n")
+ AllStr = WriteLine('', CHAR_ARRAY_DEFIN + ' ' + Info.Module.BaseName + 'Images' + '[] = {\n')
+ AllStr = WriteLine(AllStr, '// STRGATHER_OUTPUT_HEADER')
+ AllStr = WriteLine(AllStr, CreateArrayItem(DecToHexList(TotalLength)) + '\n')
+ AllStr = WriteLine(AllStr, '// Image PACKAGE HEADER\n')
+ IMAGE_PACKAGE_HDR_List = AscToHexList(PACKAGE_HEADER)
+ IMAGE_PACKAGE_HDR_List += AscToHexList(IMAGE_PACKAGE_HDR)
+ AllStr = WriteLine(AllStr, CreateArrayItem(IMAGE_PACKAGE_HDR_List, 16) + '\n')
+ AllStr = WriteLine(AllStr, '// Image DATA\n')
+ if BufferStr:
+ AllStr = WriteLine(AllStr, BufferStr)
+ if PaletteStr:
+ AllStr = WriteLine(AllStr, '// Palette Header\n')
+ PALETTE_INFO_HEADER_List = AscToHexList(PALETTE_INFO_HEADER)
+ AllStr = WriteLine(AllStr, CreateArrayItem(PALETTE_INFO_HEADER_List, 16) + '\n')
+ AllStr = WriteLine(AllStr, '// Palette Data\n')
+ AllStr = WriteLine(AllStr, PaletteStr)
+ AllStr = WriteLine(AllStr, '};')
+ AutoGenC.Append(AllStr)
+ AutoGenC.Append("\n")
+ StringH.Append('\nextern unsigned char ' + Info.Module.BaseName + 'Images[];\n')
+ StringH.Append("\n#define IMAGE_ARRAY_NAME %sImages\n" % Info.Module.BaseName)
+
+# typedef struct _EFI_HII_IMAGE_PACKAGE_HDR {
+# EFI_HII_PACKAGE_HEADER Header; # Standard package header, where Header.Type = EFI_HII_PACKAGE_IMAGES
+# UINT32 ImageInfoOffset;
+# UINT32 PaletteInfoOffset;
+# } EFI_HII_IMAGE_PACKAGE_HDR;
+
+# typedef struct {
+# UINT32 Length:24;
+# UINT32 Type:8;
+# UINT8 Data[];
+# } EFI_HII_PACKAGE_HEADER;
+
+# typedef struct _EFI_HII_IMAGE_BLOCK {
+# UINT8 BlockType;
+# UINT8 BlockBody[];
+# } EFI_HII_IMAGE_BLOCK;
+
+def BmpImageDecoder(File, Buffer, PaletteIndex, TransParent):
+ ImageType, = struct.unpack('2s', Buffer[0:2])
+ if ImageType!= b'BM': # BMP file type is 'BM'
+ EdkLogger.error("build", FILE_TYPE_MISMATCH, "The file %s is not a standard BMP file." % File.Path)
+ BMP_IMAGE_HEADER = collections.namedtuple('BMP_IMAGE_HEADER', ['bfSize', 'bfReserved1', 'bfReserved2', 'bfOffBits', 'biSize', 'biWidth', 'biHeight', 'biPlanes', 'biBitCount', 'biCompression', 'biSizeImage', 'biXPelsPerMeter', 'biYPelsPerMeter', 'biClrUsed', 'biClrImportant'])
+ BMP_IMAGE_HEADER_STRUCT = struct.Struct('IHHIIIIHHIIIIII')
+ BmpHeader = BMP_IMAGE_HEADER._make(BMP_IMAGE_HEADER_STRUCT.unpack_from(Buffer[2:]))
+ #
+ # Doesn't support compress.
+ #
+ if BmpHeader.biCompression != 0:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "The compress BMP file %s is not support." % File.Path)
+
+ # The Width and Height is UINT16 type in Image Package
+ if BmpHeader.biWidth > 0xFFFF:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "The BMP file %s Width is exceed 0xFFFF." % File.Path)
+ if BmpHeader.biHeight > 0xFFFF:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "The BMP file %s Height is exceed 0xFFFF." % File.Path)
+
+ PaletteBuffer = pack('x')
+ if BmpHeader.biBitCount == 1:
+ if TransParent:
+ ImageBuffer = pack('B', EFI_HII_IIBT_IMAGE_1BIT_TRANS)
+ else:
+ ImageBuffer = pack('B', EFI_HII_IIBT_IMAGE_1BIT)
+ ImageBuffer += pack('B', PaletteIndex)
+ Width = (BmpHeader.biWidth + 7)//8
+ if BmpHeader.bfOffBits > BMP_IMAGE_HEADER_STRUCT.size + 2:
+ PaletteBuffer = Buffer[BMP_IMAGE_HEADER_STRUCT.size + 2 : BmpHeader.bfOffBits]
+ elif BmpHeader.biBitCount == 4:
+ if TransParent:
+ ImageBuffer = pack('B', EFI_HII_IIBT_IMAGE_4BIT_TRANS)
+ else:
+ ImageBuffer = pack('B', EFI_HII_IIBT_IMAGE_4BIT)
+ ImageBuffer += pack('B', PaletteIndex)
+ Width = (BmpHeader.biWidth + 1)//2
+ if BmpHeader.bfOffBits > BMP_IMAGE_HEADER_STRUCT.size + 2:
+ PaletteBuffer = Buffer[BMP_IMAGE_HEADER_STRUCT.size + 2 : BmpHeader.bfOffBits]
+ elif BmpHeader.biBitCount == 8:
+ if TransParent:
+ ImageBuffer = pack('B', EFI_HII_IIBT_IMAGE_8BIT_TRANS)
+ else:
+ ImageBuffer = pack('B', EFI_HII_IIBT_IMAGE_8BIT)
+ ImageBuffer += pack('B', PaletteIndex)
+ Width = BmpHeader.biWidth
+ if BmpHeader.bfOffBits > BMP_IMAGE_HEADER_STRUCT.size + 2:
+ PaletteBuffer = Buffer[BMP_IMAGE_HEADER_STRUCT.size + 2 : BmpHeader.bfOffBits]
+ elif BmpHeader.biBitCount == 24:
+ if TransParent:
+ ImageBuffer = pack('B', EFI_HII_IIBT_IMAGE_24BIT_TRANS)
+ else:
+ ImageBuffer = pack('B', EFI_HII_IIBT_IMAGE_24BIT)
+ Width = BmpHeader.biWidth * 3
+ else:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "Only support the 1 bit, 4 bit, 8bit, 24 bit BMP files.", ExtraData="[%s]" % str(File.Path))
+
+ ImageBuffer += pack('H', BmpHeader.biWidth)
+ ImageBuffer += pack('H', BmpHeader.biHeight)
+ Start = BmpHeader.bfOffBits
+ End = BmpHeader.bfSize - 1
+ for Height in range(0, BmpHeader.biHeight):
+ if Width % 4 != 0:
+ Start = End + (Width % 4) - 4 - Width
+ else:
+ Start = End - Width
+ ImageBuffer += Buffer[Start + 1 : Start + Width + 1]
+ End = Start
+
+ # handle the Palette info, BMP use 4 bytes for R, G, B and Reserved info while EFI_HII_RGB_PIXEL only have the R, G, B info
+ if PaletteBuffer and len(PaletteBuffer) > 1:
+ PaletteTemp = pack('x')
+ for Index in range(0, len(PaletteBuffer)):
+ if Index % 4 == 3:
+ continue
+ PaletteTemp += PaletteBuffer[Index:Index+1]
+ PaletteBuffer = PaletteTemp[1:]
+ return ImageBuffer, PaletteBuffer
+
+## Create common code
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+#
+def CreateHeaderCode(Info, AutoGenC, AutoGenH):
+ # file header
+ AutoGenH.Append(gAutoGenHeaderString.Replace({'FileName':'AutoGen.h'}))
+ # header file Prologue
+ AutoGenH.Append(gAutoGenHPrologueString.Replace({'File':'AUTOGENH','Guid':Info.Guid.replace('-', '_')}))
+ AutoGenH.Append(gAutoGenHCppPrologueString)
+
+ # header files includes
+ if Info.ModuleType in gModuleTypeHeaderFile:
+ AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0])
+ #
+ # if either PcdLib in [LibraryClasses] sections or there exist Pcd section, add PcdLib.h
+ # As if modules only uses FixedPcd, then PcdLib is not needed in [LibraryClasses] section.
+ #
+ if 'PcdLib' in Info.Module.LibraryClasses or Info.Module.Pcds:
+ AutoGenH.Append("#include <Library/PcdLib.h>\n")
+
+ AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;')
+ AutoGenH.Append('\nextern CHAR8 *gEfiCallerBaseName;\n\n')
+
+ if Info.IsLibrary:
+ return
+
+ AutoGenH.Append("#define EFI_CALLER_ID_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.Guid))
+
+ if Info.IsLibrary:
+ return
+ # C file header
+ AutoGenC.Append(gAutoGenHeaderString.Replace({'FileName':'AutoGen.c'}))
+ # C file header files includes
+ if Info.ModuleType in gModuleTypeHeaderFile:
+ for Inc in gModuleTypeHeaderFile[Info.ModuleType]:
+ AutoGenC.Append("#include <%s>\n" % Inc)
+ else:
+ AutoGenC.Append("#include <%s>\n" % gBasicHeaderFile)
+
+ #
+ # Publish the CallerId Guid
+ #
+ AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = %s;\n' % GuidStringToGuidStructureString(Info.Guid))
+ AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "%s";\n' % Info.Name)
+
+## Create common code for header file
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+#
+def CreateFooterCode(Info, AutoGenC, AutoGenH):
+ AutoGenH.Append(gAutoGenHEpilogueString)
+
+## Create code for a module
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+# @param StringH The TemplateString object for header file
+# @param UniGenCFlag UniString is generated into AutoGen C file when it is set to True
+# @param UniGenBinBuffer Buffer to store uni string package data
+# @param StringIdf The TemplateString object for header file
+# @param IdfGenCFlag IdfString is generated into AutoGen C file when it is set to True
+# @param IdfGenBinBuffer Buffer to store Idf string package data
+#
+def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer, StringIdf, IdfGenCFlag, IdfGenBinBuffer):
+ CreateHeaderCode(Info, AutoGenC, AutoGenH)
+
+ CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH)
+ CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH)
+ CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH)
+ CreatePcdCode(Info, AutoGenC, AutoGenH)
+ CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH)
+ CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH)
+ CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH)
+ CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH)
+
+ if Info.UnicodeFileList:
+ FileName = "%sStrDefs.h" % Info.Name
+ StringH.Append(gAutoGenHeaderString.Replace({'FileName':FileName}))
+ StringH.Append(gAutoGenHPrologueString.Replace({'File':'STRDEFS', 'Guid':Info.Guid.replace('-', '_')}))
+ CreateUnicodeStringCode(Info, AutoGenC, StringH, UniGenCFlag, UniGenBinBuffer)
+
+ GuidMacros = []
+ for Guid in Info.Module.Guids:
+ if Guid in Info.Module.GetGuidsUsedByPcd():
+ continue
+ GuidMacros.append('#define %s %s' % (Guid, Info.Module.Guids[Guid]))
+ for Guid, Value in list(Info.Module.Protocols.items()) + list(Info.Module.Ppis.items()):
+ GuidMacros.append('#define %s %s' % (Guid, Value))
+ # supports FixedAtBuild and FeaturePcd usage in VFR file
+ if Info.VfrFileList and Info.ModulePcdList:
+ GuidMacros.append('#define %s %s' % ('FixedPcdGetBool(TokenName)', '_PCD_VALUE_##TokenName'))
+ GuidMacros.append('#define %s %s' % ('FixedPcdGet8(TokenName)', '_PCD_VALUE_##TokenName'))
+ GuidMacros.append('#define %s %s' % ('FixedPcdGet16(TokenName)', '_PCD_VALUE_##TokenName'))
+ GuidMacros.append('#define %s %s' % ('FixedPcdGet32(TokenName)', '_PCD_VALUE_##TokenName'))
+ GuidMacros.append('#define %s %s' % ('FixedPcdGet64(TokenName)', '_PCD_VALUE_##TokenName'))
+ GuidMacros.append('#define %s %s' % ('FeaturePcdGet(TokenName)', '_PCD_VALUE_##TokenName'))
+ for Pcd in Info.ModulePcdList:
+ if Pcd.Type in [TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_FEATURE_FLAG]:
+ TokenCName = Pcd.TokenCName
+ Value = Pcd.DefaultValue
+ if Pcd.DatumType == 'BOOLEAN':
+ BoolValue = Value.upper()
+ if BoolValue == 'TRUE':
+ Value = '1'
+ elif BoolValue == 'FALSE':
+ Value = '0'
+ for PcdItem in GlobalData.MixedPcd:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ TokenCName = PcdItem[0]
+ break
+ GuidMacros.append('#define %s %s' % ('_PCD_VALUE_'+TokenCName, Value))
+
+ if Info.IdfFileList:
+ GuidMacros.append('#include "%sImgDefs.h"' % Info.Name)
+
+ if GuidMacros:
+ StringH.Append('\n#ifdef VFRCOMPILE\n%s\n#endif\n' % '\n'.join(GuidMacros))
+
+ StringH.Append("\n#endif\n")
+ AutoGenH.Append('#include "%s"\n' % FileName)
+
+ if Info.IdfFileList:
+ FileName = "%sImgDefs.h" % Info.Name
+ StringIdf.Append(gAutoGenHeaderString.Replace({'FileName':FileName}))
+ StringIdf.Append(gAutoGenHPrologueString.Replace({'File':'IMAGEDEFS', 'Guid':Info.Guid.replace('-', '_')}))
+ CreateIdfFileCode(Info, AutoGenC, StringIdf, IdfGenCFlag, IdfGenBinBuffer)
+
+ StringIdf.Append("\n#endif\n")
+ AutoGenH.Append('#include "%s"\n' % FileName)
+
+ CreateFooterCode(Info, AutoGenC, AutoGenH)
+
+## Create the code file
+#
+# @param FilePath The path of code file
+# @param Content The content of code file
+# @param IsBinaryFile The flag indicating if the file is binary file or not
+#
+# @retval True If file content is changed or file doesn't exist
+# @retval False If the file exists and the content is not changed
+#
+def Generate(FilePath, Content, IsBinaryFile):
+ return SaveFileOnChange(FilePath, Content, IsBinaryFile)
+
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/GenDepex.py b/roms/edk2/BaseTools/Source/Python/AutoGen/GenDepex.py
new file mode 100644
index 000000000..f2f2e9d65
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/GenDepex.py
@@ -0,0 +1,464 @@
+## @file
+# This file is used to generate DEPEX file for module's dependency expression
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+## Import Modules
+#
+import sys
+import Common.LongFilePathOs as os
+import re
+import traceback
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from io import BytesIO
+from struct import pack
+from Common.BuildToolError import *
+from Common.Misc import SaveFileOnChange
+from Common.Misc import GuidStructureStringToGuidString
+from Common.Misc import GuidStructureByteArrayToGuidString
+from Common.Misc import GuidStringToGuidStructureString
+from Common import EdkLogger as EdkLogger
+from Common.BuildVersion import gBUILD_VERSION
+from Common.DataType import *
+
+## Regular expression for matching "DEPENDENCY_START ... DEPENDENCY_END"
+gStartClosePattern = re.compile(".*DEPENDENCY_START(.+)DEPENDENCY_END.*", re.S)
+
+## Mapping between module type and EFI phase
+gType2Phase = {
+ SUP_MODULE_BASE : None,
+ SUP_MODULE_SEC : "PEI",
+ SUP_MODULE_PEI_CORE : "PEI",
+ SUP_MODULE_PEIM : "PEI",
+ SUP_MODULE_DXE_CORE : "DXE",
+ SUP_MODULE_DXE_DRIVER : "DXE",
+ SUP_MODULE_DXE_SMM_DRIVER : "DXE",
+ SUP_MODULE_DXE_RUNTIME_DRIVER: "DXE",
+ SUP_MODULE_DXE_SAL_DRIVER : "DXE",
+ SUP_MODULE_UEFI_DRIVER : "DXE",
+ SUP_MODULE_UEFI_APPLICATION : "DXE",
+ SUP_MODULE_SMM_CORE : "DXE",
+ SUP_MODULE_MM_STANDALONE : "MM",
+ SUP_MODULE_MM_CORE_STANDALONE : "MM",
+}
+
+## Convert dependency expression string into EFI internal representation
+#
+# DependencyExpression class is used to parse dependency expression string and
+# convert it into its binary form.
+#
+class DependencyExpression:
+
+ ArchProtocols = {
+ '665e3ff6-46cc-11d4-9a38-0090273fc14d', # 'gEfiBdsArchProtocolGuid'
+ '26baccb1-6f42-11d4-bce7-0080c73c8881', # 'gEfiCpuArchProtocolGuid'
+ '26baccb2-6f42-11d4-bce7-0080c73c8881', # 'gEfiMetronomeArchProtocolGuid'
+ '1da97072-bddc-4b30-99f1-72a0b56fff2a', # 'gEfiMonotonicCounterArchProtocolGuid'
+ '27cfac87-46cc-11d4-9a38-0090273fc14d', # 'gEfiRealTimeClockArchProtocolGuid'
+ '27cfac88-46cc-11d4-9a38-0090273fc14d', # 'gEfiResetArchProtocolGuid'
+ 'b7dfb4e1-052f-449f-87be-9818fc91b733', # 'gEfiRuntimeArchProtocolGuid'
+ 'a46423e3-4617-49f1-b9ff-d1bfa9115839', # 'gEfiSecurityArchProtocolGuid'
+ '26baccb3-6f42-11d4-bce7-0080c73c8881', # 'gEfiTimerArchProtocolGuid'
+ '6441f818-6362-4e44-b570-7dba31dd2453', # 'gEfiVariableWriteArchProtocolGuid'
+ '1e5668e2-8481-11d4-bcf1-0080c73c8881', # 'gEfiVariableArchProtocolGuid'
+ '665e3ff5-46cc-11d4-9a38-0090273fc14d' # 'gEfiWatchdogTimerArchProtocolGuid'
+ }
+
+ OpcodePriority = {
+ DEPEX_OPCODE_AND : 1,
+ DEPEX_OPCODE_OR : 1,
+ DEPEX_OPCODE_NOT : 2,
+ }
+
+ Opcode = {
+ "PEI" : {
+ DEPEX_OPCODE_PUSH : 0x02,
+ DEPEX_OPCODE_AND : 0x03,
+ DEPEX_OPCODE_OR : 0x04,
+ DEPEX_OPCODE_NOT : 0x05,
+ DEPEX_OPCODE_TRUE : 0x06,
+ DEPEX_OPCODE_FALSE : 0x07,
+ DEPEX_OPCODE_END : 0x08
+ },
+
+ "DXE" : {
+ DEPEX_OPCODE_BEFORE: 0x00,
+ DEPEX_OPCODE_AFTER : 0x01,
+ DEPEX_OPCODE_PUSH : 0x02,
+ DEPEX_OPCODE_AND : 0x03,
+ DEPEX_OPCODE_OR : 0x04,
+ DEPEX_OPCODE_NOT : 0x05,
+ DEPEX_OPCODE_TRUE : 0x06,
+ DEPEX_OPCODE_FALSE : 0x07,
+ DEPEX_OPCODE_END : 0x08,
+ DEPEX_OPCODE_SOR : 0x09
+ },
+
+ "MM" : {
+ DEPEX_OPCODE_BEFORE: 0x00,
+ DEPEX_OPCODE_AFTER : 0x01,
+ DEPEX_OPCODE_PUSH : 0x02,
+ DEPEX_OPCODE_AND : 0x03,
+ DEPEX_OPCODE_OR : 0x04,
+ DEPEX_OPCODE_NOT : 0x05,
+ DEPEX_OPCODE_TRUE : 0x06,
+ DEPEX_OPCODE_FALSE : 0x07,
+ DEPEX_OPCODE_END : 0x08,
+ DEPEX_OPCODE_SOR : 0x09
+ }
+ }
+
+ # all supported op codes and operands
+ SupportedOpcode = [DEPEX_OPCODE_BEFORE, DEPEX_OPCODE_AFTER, DEPEX_OPCODE_PUSH, DEPEX_OPCODE_AND, DEPEX_OPCODE_OR, DEPEX_OPCODE_NOT, DEPEX_OPCODE_END, DEPEX_OPCODE_SOR]
+ SupportedOperand = [DEPEX_OPCODE_TRUE, DEPEX_OPCODE_FALSE]
+
+ OpcodeWithSingleOperand = [DEPEX_OPCODE_NOT, DEPEX_OPCODE_BEFORE, DEPEX_OPCODE_AFTER]
+ OpcodeWithTwoOperand = [DEPEX_OPCODE_AND, DEPEX_OPCODE_OR]
+
+ # op code that should not be the last one
+ NonEndingOpcode = [DEPEX_OPCODE_AND, DEPEX_OPCODE_OR, DEPEX_OPCODE_NOT, DEPEX_OPCODE_SOR]
+ # op code must not present at the same time
+ ExclusiveOpcode = [DEPEX_OPCODE_BEFORE, DEPEX_OPCODE_AFTER]
+ # op code that should be the first one if it presents
+ AboveAllOpcode = [DEPEX_OPCODE_SOR, DEPEX_OPCODE_BEFORE, DEPEX_OPCODE_AFTER]
+
+ #
+ # open and close brace must be taken as individual tokens
+ #
+ TokenPattern = re.compile("(\(|\)|\{[^{}]+\{?[^{}]+\}?[ ]*\}|\w+)")
+
+ ## Constructor
+ #
+ # @param Expression The list or string of dependency expression
+ # @param ModuleType The type of the module using the dependency expression
+ #
+ def __init__(self, Expression, ModuleType, Optimize=False):
+ self.ModuleType = ModuleType
+ self.Phase = gType2Phase[ModuleType]
+ if isinstance(Expression, type([])):
+ self.ExpressionString = " ".join(Expression)
+ self.TokenList = Expression
+ else:
+ self.ExpressionString = Expression
+ self.GetExpressionTokenList()
+
+ self.PostfixNotation = []
+ self.OpcodeList = []
+
+ self.GetPostfixNotation()
+ self.ValidateOpcode()
+
+ EdkLogger.debug(EdkLogger.DEBUG_8, repr(self))
+ if Optimize:
+ self.Optimize()
+ EdkLogger.debug(EdkLogger.DEBUG_8, "\n Optimized: " + repr(self))
+
+ def __str__(self):
+ return " ".join(self.TokenList)
+
+ def __repr__(self):
+ WellForm = ''
+ for Token in self.PostfixNotation:
+ if Token in self.SupportedOpcode:
+ WellForm += "\n " + Token
+ else:
+ WellForm += ' ' + Token
+ return WellForm
+
+ ## Split the expression string into token list
+ def GetExpressionTokenList(self):
+ self.TokenList = self.TokenPattern.findall(self.ExpressionString)
+
+ ## Convert token list into postfix notation
+ def GetPostfixNotation(self):
+ Stack = []
+ LastToken = ''
+ for Token in self.TokenList:
+ if Token == "(":
+ if LastToken not in self.SupportedOpcode + ['(', '', None]:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "Invalid dependency expression: missing operator before open parentheses",
+ ExtraData="Near %s" % LastToken)
+ Stack.append(Token)
+ elif Token == ")":
+ if '(' not in Stack:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "Invalid dependency expression: mismatched parentheses",
+ ExtraData=str(self))
+ elif LastToken in self.SupportedOpcode + ['', None]:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "Invalid dependency expression: missing operand before close parentheses",
+ ExtraData="Near %s" % LastToken)
+ while len(Stack) > 0:
+ if Stack[-1] == '(':
+ Stack.pop()
+ break
+ self.PostfixNotation.append(Stack.pop())
+ elif Token in self.OpcodePriority:
+ if Token == DEPEX_OPCODE_NOT:
+ if LastToken not in self.SupportedOpcode + ['(', '', None]:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "Invalid dependency expression: missing operator before NOT",
+ ExtraData="Near %s" % LastToken)
+ elif LastToken in self.SupportedOpcode + ['(', '', None]:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "Invalid dependency expression: missing operand before " + Token,
+ ExtraData="Near %s" % LastToken)
+
+ while len(Stack) > 0:
+ if Stack[-1] == "(" or self.OpcodePriority[Token] >= self.OpcodePriority[Stack[-1]]:
+ break
+ self.PostfixNotation.append(Stack.pop())
+ Stack.append(Token)
+ self.OpcodeList.append(Token)
+ else:
+ if Token not in self.SupportedOpcode:
+ # not OP, take it as GUID
+ if LastToken not in self.SupportedOpcode + ['(', '', None]:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "Invalid dependency expression: missing operator before %s" % Token,
+ ExtraData="Near %s" % LastToken)
+ if len(self.OpcodeList) == 0 or self.OpcodeList[-1] not in self.ExclusiveOpcode:
+ if Token not in self.SupportedOperand:
+ self.PostfixNotation.append(DEPEX_OPCODE_PUSH)
+ # check if OP is valid in this phase
+ elif Token in self.Opcode[self.Phase]:
+ if Token == DEPEX_OPCODE_END:
+ break
+ self.OpcodeList.append(Token)
+ else:
+ EdkLogger.error("GenDepex", PARSER_ERROR,
+ "Opcode=%s doesn't supported in %s stage " % (Token, self.Phase),
+ ExtraData=str(self))
+ self.PostfixNotation.append(Token)
+ LastToken = Token
+
+ # there should not be parentheses in Stack
+ if '(' in Stack or ')' in Stack:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "Invalid dependency expression: mismatched parentheses",
+ ExtraData=str(self))
+ while len(Stack) > 0:
+ self.PostfixNotation.append(Stack.pop())
+ if self.PostfixNotation[-1] != DEPEX_OPCODE_END:
+ self.PostfixNotation.append(DEPEX_OPCODE_END)
+
+ ## Validate the dependency expression
+ def ValidateOpcode(self):
+ for Op in self.AboveAllOpcode:
+ if Op in self.PostfixNotation:
+ if Op != self.PostfixNotation[0]:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "%s should be the first opcode in the expression" % Op,
+ ExtraData=str(self))
+ if len(self.PostfixNotation) < 3:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "Missing operand for %s" % Op,
+ ExtraData=str(self))
+ for Op in self.ExclusiveOpcode:
+ if Op in self.OpcodeList:
+ if len(self.OpcodeList) > 1:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "%s should be the only opcode in the expression" % Op,
+ ExtraData=str(self))
+ if len(self.PostfixNotation) < 3:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "Missing operand for %s" % Op,
+ ExtraData=str(self))
+ if self.TokenList[-1] != DEPEX_OPCODE_END and self.TokenList[-1] in self.NonEndingOpcode:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "Extra %s at the end of the dependency expression" % self.TokenList[-1],
+ ExtraData=str(self))
+ if self.TokenList[-1] == DEPEX_OPCODE_END and self.TokenList[-2] in self.NonEndingOpcode:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "Extra %s at the end of the dependency expression" % self.TokenList[-2],
+ ExtraData=str(self))
+ if DEPEX_OPCODE_END in self.TokenList and DEPEX_OPCODE_END != self.TokenList[-1]:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "Extra expressions after END",
+ ExtraData=str(self))
+
+ ## Simply optimize the dependency expression by removing duplicated operands
+ def Optimize(self):
+ OpcodeSet = set(self.OpcodeList)
+ # if there are isn't one in the set, return
+ if len(OpcodeSet) != 1:
+ return
+ Op = OpcodeSet.pop()
+ #if Op isn't either OR or AND, return
+ if Op not in [DEPEX_OPCODE_AND, DEPEX_OPCODE_OR]:
+ return
+ NewOperand = []
+ AllOperand = set()
+ for Token in self.PostfixNotation:
+ if Token in self.SupportedOpcode or Token in NewOperand:
+ continue
+ AllOperand.add(Token)
+ if Token == DEPEX_OPCODE_TRUE:
+ if Op == DEPEX_OPCODE_AND:
+ continue
+ else:
+ NewOperand.append(Token)
+ break
+ elif Token == DEPEX_OPCODE_FALSE:
+ if Op == DEPEX_OPCODE_OR:
+ continue
+ else:
+ NewOperand.append(Token)
+ break
+ NewOperand.append(Token)
+
+ # don't generate depex if only TRUE operand left
+ if self.ModuleType == SUP_MODULE_PEIM and len(NewOperand) == 1 and NewOperand[0] == DEPEX_OPCODE_TRUE:
+ self.PostfixNotation = []
+ return
+
+ # don't generate depex if all operands are architecture protocols
+ if self.ModuleType in [SUP_MODULE_UEFI_DRIVER, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_MM_STANDALONE] and \
+ Op == DEPEX_OPCODE_AND and \
+ self.ArchProtocols == set(GuidStructureStringToGuidString(Guid) for Guid in AllOperand):
+ self.PostfixNotation = []
+ return
+
+ if len(NewOperand) == 0:
+ self.TokenList = list(AllOperand)
+ else:
+ self.TokenList = []
+ while True:
+ self.TokenList.append(NewOperand.pop(0))
+ if NewOperand == []:
+ break
+ self.TokenList.append(Op)
+ self.PostfixNotation = []
+ self.GetPostfixNotation()
+
+
+ ## Convert a GUID value in C structure format into its binary form
+ #
+ # @param Guid The GUID value in C structure format
+ #
+ # @retval array The byte array representing the GUID value
+ #
+ def GetGuidValue(self, Guid):
+ GuidValueString = Guid.replace("{", "").replace("}", "").replace(" ", "")
+ GuidValueList = GuidValueString.split(",")
+ if len(GuidValueList) != 11 and len(GuidValueList) == 16:
+ GuidValueString = GuidStringToGuidStructureString(GuidStructureByteArrayToGuidString(Guid))
+ GuidValueString = GuidValueString.replace("{", "").replace("}", "").replace(" ", "")
+ GuidValueList = GuidValueString.split(",")
+ if len(GuidValueList) != 11:
+ EdkLogger.error("GenDepex", PARSER_ERROR, "Invalid GUID value string or opcode: %s" % Guid)
+ return pack("1I2H8B", *(int(value, 16) for value in GuidValueList))
+
+ ## Save the binary form of dependency expression in file
+ #
+ # @param File The path of file. If None is given, put the data on console
+ #
+ # @retval True If the file doesn't exist or file is changed
+ # @retval False If file exists and is not changed.
+ #
+ def Generate(self, File=None):
+ Buffer = BytesIO()
+ if len(self.PostfixNotation) == 0:
+ return False
+
+ for Item in self.PostfixNotation:
+ if Item in self.Opcode[self.Phase]:
+ Buffer.write(pack("B", self.Opcode[self.Phase][Item]))
+ elif Item in self.SupportedOpcode:
+ EdkLogger.error("GenDepex", FORMAT_INVALID,
+ "Opcode [%s] is not expected in %s phase" % (Item, self.Phase),
+ ExtraData=self.ExpressionString)
+ else:
+ Buffer.write(self.GetGuidValue(Item))
+
+ FilePath = ""
+ FileChangeFlag = True
+ if File is None:
+ sys.stdout.write(Buffer.getvalue())
+ FilePath = "STDOUT"
+ else:
+ FileChangeFlag = SaveFileOnChange(File, Buffer.getvalue(), True)
+
+ Buffer.close()
+ return FileChangeFlag
+
+versionNumber = ("0.04" + " " + gBUILD_VERSION)
+__version__ = "%prog Version " + versionNumber
+__copyright__ = "Copyright (c) 2007-2018, Intel Corporation All rights reserved."
+__usage__ = "%prog [options] [dependency_expression_file]"
+
+## Parse command line options
+#
+# @retval OptionParser
+#
+def GetOptions():
+ from optparse import OptionParser
+
+ Parser = OptionParser(description=__copyright__, version=__version__, usage=__usage__)
+
+ Parser.add_option("-o", "--output", dest="OutputFile", default=None, metavar="FILE",
+ help="Specify the name of depex file to be generated")
+ Parser.add_option("-t", "--module-type", dest="ModuleType", default=None,
+ help="The type of module for which the dependency expression serves")
+ Parser.add_option("-e", "--dependency-expression", dest="Expression", default="",
+ help="The string of dependency expression. If this option presents, the input file will be ignored.")
+ Parser.add_option("-m", "--optimize", dest="Optimize", default=False, action="store_true",
+ help="Do some simple optimization on the expression.")
+ Parser.add_option("-v", "--verbose", dest="verbose", default=False, action="store_true",
+ help="build with verbose information")
+ Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
+ Parser.add_option("-q", "--quiet", dest="quiet", default=False, action="store_true",
+ help="build with little information")
+
+ return Parser.parse_args()
+
+
+## Entrance method
+#
+# @retval 0 Tool was successful
+# @retval 1 Tool failed
+#
+def Main():
+ EdkLogger.Initialize()
+ Option, Input = GetOptions()
+
+ # Set log level
+ if Option.quiet:
+ EdkLogger.SetLevel(EdkLogger.QUIET)
+ elif Option.verbose:
+ EdkLogger.SetLevel(EdkLogger.VERBOSE)
+ elif Option.debug is not None:
+ EdkLogger.SetLevel(Option.debug + 1)
+ else:
+ EdkLogger.SetLevel(EdkLogger.INFO)
+
+ try:
+ if Option.ModuleType is None or Option.ModuleType not in gType2Phase:
+ EdkLogger.error("GenDepex", OPTION_MISSING, "Module type is not specified or supported")
+
+ DxsFile = ''
+ if len(Input) > 0 and Option.Expression == "":
+ DxsFile = Input[0]
+ DxsString = open(DxsFile, 'r').read().replace("\n", " ").replace("\r", " ")
+ DxsString = gStartClosePattern.sub("\\1", DxsString)
+ elif Option.Expression != "":
+ if Option.Expression[0] == '"':
+ DxsString = Option.Expression[1:-1]
+ else:
+ DxsString = Option.Expression
+ else:
+ EdkLogger.error("GenDepex", OPTION_MISSING, "No expression string or file given")
+
+ Dpx = DependencyExpression(DxsString, Option.ModuleType, Option.Optimize)
+ if Option.OutputFile is not None:
+ FileChangeFlag = Dpx.Generate(Option.OutputFile)
+ if not FileChangeFlag and DxsFile:
+ #
+ # Touch the output file if its time stamp is older than the original
+ # DXS file to avoid re-invoke this tool for the dependency check in build rule.
+ #
+ if os.stat(DxsFile)[8] > os.stat(Option.OutputFile)[8]:
+ os.utime(Option.OutputFile, None)
+ else:
+ Dpx.Generate()
+ except BaseException as X:
+ EdkLogger.quiet("")
+ if Option is not None and Option.debug is not None:
+ EdkLogger.quiet(traceback.format_exc())
+ else:
+ EdkLogger.quiet(str(X))
+ return 1
+
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(Main())
+
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/GenMake.py b/roms/edk2/BaseTools/Source/Python/AutoGen/GenMake.py
new file mode 100755
index 000000000..0314d0ea3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -0,0 +1,1762 @@
+## @file
+# Create makefile for MS nmake and GNU make
+#
+# Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+## Import Modules
+#
+from __future__ import absolute_import
+import Common.LongFilePathOs as os
+import sys
+import string
+import re
+import os.path as path
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+from Common.BuildToolError import *
+from Common.Misc import *
+from Common.StringUtils import *
+from .BuildEngine import *
+import Common.GlobalData as GlobalData
+from collections import OrderedDict
+from Common.DataType import TAB_COMPILER_MSFT
+
+## Regular expression for finding header file inclusions
+gIncludePattern = re.compile(r"^[ \t]*[#%]?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE | re.IGNORECASE)
+
+## Regular expression for matching macro used in header file inclusion
+gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE)
+
+gIsFileMap = {}
+
+## pattern for include style in Edk.x code
+gProtocolDefinition = "Protocol/%(HeaderKey)s/%(HeaderKey)s.h"
+gGuidDefinition = "Guid/%(HeaderKey)s/%(HeaderKey)s.h"
+gArchProtocolDefinition = "ArchProtocol/%(HeaderKey)s/%(HeaderKey)s.h"
+gPpiDefinition = "Ppi/%(HeaderKey)s/%(HeaderKey)s.h"
+gIncludeMacroConversion = {
+ "EFI_PROTOCOL_DEFINITION" : gProtocolDefinition,
+ "EFI_GUID_DEFINITION" : gGuidDefinition,
+ "EFI_ARCH_PROTOCOL_DEFINITION" : gArchProtocolDefinition,
+ "EFI_PROTOCOL_PRODUCER" : gProtocolDefinition,
+ "EFI_PROTOCOL_CONSUMER" : gProtocolDefinition,
+ "EFI_PROTOCOL_DEPENDENCY" : gProtocolDefinition,
+ "EFI_ARCH_PROTOCOL_PRODUCER" : gArchProtocolDefinition,
+ "EFI_ARCH_PROTOCOL_CONSUMER" : gArchProtocolDefinition,
+ "EFI_ARCH_PROTOCOL_DEPENDENCY" : gArchProtocolDefinition,
+ "EFI_PPI_DEFINITION" : gPpiDefinition,
+ "EFI_PPI_PRODUCER" : gPpiDefinition,
+ "EFI_PPI_CONSUMER" : gPpiDefinition,
+ "EFI_PPI_DEPENDENCY" : gPpiDefinition,
+}
+
+NMAKE_FILETYPE = "nmake"
+GMAKE_FILETYPE = "gmake"
+WIN32_PLATFORM = "win32"
+POSIX_PLATFORM = "posix"
+
+## BuildFile class
+#
+# This base class encapsules build file and its generation. It uses template to generate
+# the content of build file. The content of build file will be got from AutoGen objects.
+#
+class BuildFile(object):
+ ## template used to generate the build file (i.e. makefile if using make)
+ _TEMPLATE_ = TemplateString('')
+
+ _DEFAULT_FILE_NAME_ = "Makefile"
+
+ ## default file name for each type of build file
+ _FILE_NAME_ = {
+ NMAKE_FILETYPE : "Makefile",
+ GMAKE_FILETYPE : "GNUmakefile"
+ }
+
+ # Get Makefile name.
+ def getMakefileName(self):
+ if not self._FileType:
+ return self._DEFAULT_FILE_NAME_
+ else:
+ return self._FILE_NAME_[self._FileType]
+
+ ## Fixed header string for makefile
+ _MAKEFILE_HEADER = '''#
+# DO NOT EDIT
+# This file is auto-generated by build utility
+#
+# Module Name:
+#
+# %s
+#
+# Abstract:
+#
+# Auto-generated makefile for building modules, libraries or platform
+#
+ '''
+
+ ## Header string for each type of build file
+ _FILE_HEADER_ = {
+ NMAKE_FILETYPE : _MAKEFILE_HEADER % _FILE_NAME_[NMAKE_FILETYPE],
+ GMAKE_FILETYPE : _MAKEFILE_HEADER % _FILE_NAME_[GMAKE_FILETYPE]
+ }
+
+ ## shell commands which can be used in build file in the form of macro
+ # $(CP) copy file command
+ # $(MV) move file command
+ # $(RM) remove file command
+ # $(MD) create dir command
+ # $(RD) remove dir command
+ #
+ _SHELL_CMD_ = {
+ WIN32_PLATFORM : {
+ "CP" : "copy /y",
+ "MV" : "move /y",
+ "RM" : "del /f /q",
+ "MD" : "mkdir",
+ "RD" : "rmdir /s /q",
+ },
+
+ POSIX_PLATFORM : {
+ "CP" : "cp -f",
+ "MV" : "mv -f",
+ "RM" : "rm -f",
+ "MD" : "mkdir -p",
+ "RD" : "rm -r -f",
+ }
+ }
+
+ ## directory separator
+ _SEP_ = {
+ WIN32_PLATFORM : "\\",
+ POSIX_PLATFORM : "/"
+ }
+
+ ## directory creation template
+ _MD_TEMPLATE_ = {
+ WIN32_PLATFORM : 'if not exist %(dir)s $(MD) %(dir)s',
+ POSIX_PLATFORM : "$(MD) %(dir)s"
+ }
+
+ ## directory removal template
+ _RD_TEMPLATE_ = {
+ WIN32_PLATFORM : 'if exist %(dir)s $(RD) %(dir)s',
+ POSIX_PLATFORM : "$(RD) %(dir)s"
+ }
+ ## cp if exist
+ _CP_TEMPLATE_ = {
+ WIN32_PLATFORM : 'if exist %(Src)s $(CP) %(Src)s %(Dst)s',
+ POSIX_PLATFORM : "test -f %(Src)s && $(CP) %(Src)s %(Dst)s"
+ }
+
+ _CD_TEMPLATE_ = {
+ WIN32_PLATFORM : 'if exist %(dir)s cd %(dir)s',
+ POSIX_PLATFORM : "test -e %(dir)s && cd %(dir)s"
+ }
+
+ _MAKE_TEMPLATE_ = {
+ WIN32_PLATFORM : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(file)s',
+ POSIX_PLATFORM : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(file)s'
+ }
+
+ _INCLUDE_CMD_ = {
+ NMAKE_FILETYPE : '!INCLUDE',
+ GMAKE_FILETYPE : "include"
+ }
+
+ _INC_FLAG_ = {TAB_COMPILER_MSFT : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I", "NASM" : "-I"}
+
+ ## Constructor of BuildFile
+ #
+ # @param AutoGenObject Object of AutoGen class
+ #
+ def __init__(self, AutoGenObject):
+ self._AutoGenObject = AutoGenObject
+
+ MakePath = AutoGenObject.BuildOption.get('MAKE', {}).get('PATH')
+ if not MakePath:
+ self._FileType = ""
+ elif "nmake" in MakePath:
+ self._FileType = NMAKE_FILETYPE
+ else:
+ self._FileType = "gmake"
+
+ if sys.platform == "win32":
+ self._Platform = WIN32_PLATFORM
+ else:
+ self._Platform = POSIX_PLATFORM
+
+ ## Create build file.
+ #
+ # Only nmake and gmake are supported.
+ #
+ # @retval TRUE The build file is created or re-created successfully.
+ # @retval FALSE The build file exists and is the same as the one to be generated.
+ #
+ def Generate(self):
+ FileContent = self._TEMPLATE_.Replace(self._TemplateDict)
+ FileName = self.getMakefileName()
+ if not os.path.exists(os.path.join(self._AutoGenObject.MakeFileDir, "deps.txt")):
+ with open(os.path.join(self._AutoGenObject.MakeFileDir, "deps.txt"),"w+") as fd:
+ fd.write("")
+ if not os.path.exists(os.path.join(self._AutoGenObject.MakeFileDir, "dependency")):
+ with open(os.path.join(self._AutoGenObject.MakeFileDir, "dependency"),"w+") as fd:
+ fd.write("")
+ if not os.path.exists(os.path.join(self._AutoGenObject.MakeFileDir, "deps_target")):
+ with open(os.path.join(self._AutoGenObject.MakeFileDir, "deps_target"),"w+") as fd:
+ fd.write("")
+ return SaveFileOnChange(os.path.join(self._AutoGenObject.MakeFileDir, FileName), FileContent, False)
+
+ ## Return a list of directory creation command string
+ #
+ # @param DirList The list of directory to be created
+ #
+ # @retval list The directory creation command list
+ #
+ def GetCreateDirectoryCommand(self, DirList):
+ return [self._MD_TEMPLATE_[self._Platform] % {'dir':Dir} for Dir in DirList]
+
+ ## Return a list of directory removal command string
+ #
+ # @param DirList The list of directory to be removed
+ #
+ # @retval list The directory removal command list
+ #
+ def GetRemoveDirectoryCommand(self, DirList):
+ return [self._RD_TEMPLATE_[self._Platform] % {'dir':Dir} for Dir in DirList]
+
+ def PlaceMacro(self, Path, MacroDefinitions=None):
+ if Path.startswith("$("):
+ return Path
+ else:
+ if MacroDefinitions is None:
+ MacroDefinitions = {}
+ PathLength = len(Path)
+ for MacroName in MacroDefinitions:
+ MacroValue = MacroDefinitions[MacroName]
+ MacroValueLength = len(MacroValue)
+ if MacroValueLength == 0:
+ continue
+ if MacroValueLength <= PathLength and Path.startswith(MacroValue):
+ Path = "$(%s)%s" % (MacroName, Path[MacroValueLength:])
+ break
+ return Path
+
+## ModuleMakefile class
+#
+# This class encapsules makefie and its generation for module. It uses template to generate
+# the content of makefile. The content of makefile will be got from ModuleAutoGen object.
+#
+class ModuleMakefile(BuildFile):
+ ## template used to generate the makefile for module
+ _TEMPLATE_ = TemplateString('''\
+${makefile_header}
+
+#
+# Platform Macro Definition
+#
+PLATFORM_NAME = ${platform_name}
+PLATFORM_GUID = ${platform_guid}
+PLATFORM_VERSION = ${platform_version}
+PLATFORM_RELATIVE_DIR = ${platform_relative_directory}
+PLATFORM_DIR = ${platform_dir}
+PLATFORM_OUTPUT_DIR = ${platform_output_directory}
+
+#
+# Module Macro Definition
+#
+MODULE_NAME = ${module_name}
+MODULE_GUID = ${module_guid}
+MODULE_NAME_GUID = ${module_name_guid}
+MODULE_VERSION = ${module_version}
+MODULE_TYPE = ${module_type}
+MODULE_FILE = ${module_file}
+MODULE_FILE_BASE_NAME = ${module_file_base_name}
+BASE_NAME = $(MODULE_NAME)
+MODULE_RELATIVE_DIR = ${module_relative_directory}
+PACKAGE_RELATIVE_DIR = ${package_relative_directory}
+MODULE_DIR = ${module_dir}
+FFS_OUTPUT_DIR = ${ffs_output_directory}
+
+MODULE_ENTRY_POINT = ${module_entry_point}
+ARCH_ENTRY_POINT = ${arch_entry_point}
+IMAGE_ENTRY_POINT = ${image_entry_point}
+
+${BEGIN}${module_extra_defines}
+${END}
+#
+# Build Configuration Macro Definition
+#
+ARCH = ${architecture}
+TOOLCHAIN = ${toolchain_tag}
+TOOLCHAIN_TAG = ${toolchain_tag}
+TARGET = ${build_target}
+
+#
+# Build Directory Macro Definition
+#
+# PLATFORM_BUILD_DIR = ${platform_build_directory}
+BUILD_DIR = ${platform_build_directory}
+BIN_DIR = $(BUILD_DIR)${separator}${architecture}
+LIB_DIR = $(BIN_DIR)
+MODULE_BUILD_DIR = ${module_build_directory}
+OUTPUT_DIR = ${module_output_directory}
+DEBUG_DIR = ${module_debug_directory}
+DEST_DIR_OUTPUT = $(OUTPUT_DIR)
+DEST_DIR_DEBUG = $(DEBUG_DIR)
+
+#
+# Shell Command Macro
+#
+${BEGIN}${shell_command_code} = ${shell_command}
+${END}
+
+#
+# Tools definitions specific to this module
+#
+${BEGIN}${module_tool_definitions}
+${END}
+MAKE_FILE = ${makefile_path}
+
+#
+# Build Macro
+#
+${BEGIN}${file_macro}
+${END}
+
+#
+# Overridable Target Macro Definitions
+#
+FORCE_REBUILD = force_build
+INIT_TARGET = init
+PCH_TARGET =
+BC_TARGET = ${BEGIN}${backward_compatible_target} ${END}
+CODA_TARGET = ${BEGIN}${remaining_build_target} \\
+ ${END}
+
+#
+# Default target, which will build dependent libraries in addition to source files
+#
+
+all: mbuild
+
+
+#
+# Target used when called from platform makefile, which will bypass the build of dependent libraries
+#
+
+pbuild: $(INIT_TARGET) $(BC_TARGET) $(PCH_TARGET) $(CODA_TARGET)
+
+#
+# ModuleTarget
+#
+
+mbuild: $(INIT_TARGET) $(BC_TARGET) gen_libs $(PCH_TARGET) $(CODA_TARGET)
+
+#
+# Build Target used in multi-thread build mode, which will bypass the init and gen_libs targets
+#
+
+tbuild: $(BC_TARGET) $(PCH_TARGET) $(CODA_TARGET)
+
+#
+# Phony target which is used to force executing commands for a target
+#
+force_build:
+\t-@
+
+#
+# Target to update the FD
+#
+
+fds: mbuild gen_fds
+
+#
+# Initialization target: print build information and create necessary directories
+#
+init: info dirs
+
+info:
+\t-@echo Building ... $(MODULE_DIR)${separator}$(MODULE_FILE) [$(ARCH)]
+
+dirs:
+${BEGIN}\t-@${create_directory_command}\n${END}
+
+strdefs:
+\t-@$(CP) $(DEBUG_DIR)${separator}AutoGen.h $(DEBUG_DIR)${separator}$(MODULE_NAME)StrDefs.h
+
+#
+# GenLibsTarget
+#
+gen_libs:
+\t${BEGIN}@"$(MAKE)" $(MAKE_FLAGS) -f ${dependent_library_build_directory}${separator}${makefile_name}
+\t${END}@cd $(MODULE_BUILD_DIR)
+
+#
+# Build Flash Device Image
+#
+gen_fds:
+\t@"$(MAKE)" $(MAKE_FLAGS) -f $(BUILD_DIR)${separator}${makefile_name} fds
+\t@cd $(MODULE_BUILD_DIR)
+
+${INCLUDETAG}
+
+#
+# Individual Object Build Targets
+#
+${BEGIN}${file_build_target}
+${END}
+
+#
+# clean all intermediate files
+#
+clean:
+\t${BEGIN}${clean_command}
+\t${END}\t$(RM) AutoGenTimeStamp
+
+#
+# clean all generated files
+#
+cleanall:
+${BEGIN}\t${cleanall_command}
+${END}\t$(RM) *.pdb *.idb > NUL 2>&1
+\t$(RM) $(BIN_DIR)${separator}$(MODULE_NAME).efi
+\t$(RM) AutoGenTimeStamp
+
+#
+# clean all dependent libraries built
+#
+cleanlib:
+\t${BEGIN}-@${library_build_command} cleanall
+\t${END}@cd $(MODULE_BUILD_DIR)\n\n''')
+
+ _FILE_MACRO_TEMPLATE = TemplateString("${macro_name} = ${BEGIN} \\\n ${source_file}${END}\n")
+ _BUILD_TARGET_TEMPLATE = TemplateString("${BEGIN}${target} : ${deps}\n${END}\t${cmd}\n")
+
+ ## Constructor of ModuleMakefile
+ #
+ # @param ModuleAutoGen Object of ModuleAutoGen class
+ #
+ def __init__(self, ModuleAutoGen):
+ BuildFile.__init__(self, ModuleAutoGen)
+ self.PlatformInfo = self._AutoGenObject.PlatformInfo
+
+ self.ResultFileList = []
+ self.IntermediateDirectoryList = ["$(DEBUG_DIR)", "$(OUTPUT_DIR)"]
+
+ self.FileBuildTargetList = [] # [(src, target string)]
+ self.BuildTargetList = [] # [target string]
+ self.PendingBuildTargetList = [] # [FileBuildRule objects]
+ self.CommonFileDependency = []
+ self.FileListMacros = {}
+ self.ListFileMacros = {}
+ self.ObjTargetDict = OrderedDict()
+ self.FileCache = {}
+ self.LibraryBuildCommandList = []
+ self.LibraryFileList = []
+ self.LibraryMakefileList = []
+ self.LibraryBuildDirectoryList = []
+ self.SystemLibraryList = []
+ self.Macros = OrderedDict()
+ self.Macros["OUTPUT_DIR" ] = self._AutoGenObject.Macros["OUTPUT_DIR"]
+ self.Macros["DEBUG_DIR" ] = self._AutoGenObject.Macros["DEBUG_DIR"]
+ self.Macros["MODULE_BUILD_DIR"] = self._AutoGenObject.Macros["MODULE_BUILD_DIR"]
+ self.Macros["BIN_DIR" ] = self._AutoGenObject.Macros["BIN_DIR"]
+ self.Macros["BUILD_DIR" ] = self._AutoGenObject.Macros["BUILD_DIR"]
+ self.Macros["WORKSPACE" ] = self._AutoGenObject.Macros["WORKSPACE"]
+ self.Macros["FFS_OUTPUT_DIR" ] = self._AutoGenObject.Macros["FFS_OUTPUT_DIR"]
+ self.GenFfsList = ModuleAutoGen.GenFfsList
+ self.MacroList = ['FFS_OUTPUT_DIR', 'MODULE_GUID', 'OUTPUT_DIR']
+ self.FfsOutputFileList = []
+ self.DependencyHeaderFileSet = set()
+
+ # Compose a dict object containing information used to do replacement in template
+ @property
+ def _TemplateDict(self):
+ MyAgo = self._AutoGenObject
+ Separator = self._SEP_[self._Platform]
+
+ # break build if no source files and binary files are found
+ if len(MyAgo.SourceFileList) == 0 and len(MyAgo.BinaryFileList) == 0:
+ EdkLogger.error("build", AUTOGEN_ERROR, "No files to be built in module [%s, %s, %s]"
+ % (MyAgo.BuildTarget, MyAgo.ToolChain, MyAgo.Arch),
+ ExtraData="[%s]" % str(MyAgo))
+
+ # convert dependent libraries to build command
+ self.ProcessDependentLibrary()
+ if len(MyAgo.Module.ModuleEntryPointList) > 0:
+ ModuleEntryPoint = MyAgo.Module.ModuleEntryPointList[0]
+ else:
+ ModuleEntryPoint = "_ModuleEntryPoint"
+
+ ArchEntryPoint = ModuleEntryPoint
+
+ if MyAgo.Arch == "EBC":
+ # EBC compiler always use "EfiStart" as entry point. Only applies to EdkII modules
+ ImageEntryPoint = "EfiStart"
+ else:
+ # EdkII modules always use "_ModuleEntryPoint" as entry point
+ ImageEntryPoint = "_ModuleEntryPoint"
+
+ for k, v in MyAgo.Module.Defines.items():
+ if k not in MyAgo.Macros:
+ MyAgo.Macros[k] = v
+
+ if 'MODULE_ENTRY_POINT' not in MyAgo.Macros:
+ MyAgo.Macros['MODULE_ENTRY_POINT'] = ModuleEntryPoint
+ if 'ARCH_ENTRY_POINT' not in MyAgo.Macros:
+ MyAgo.Macros['ARCH_ENTRY_POINT'] = ArchEntryPoint
+ if 'IMAGE_ENTRY_POINT' not in MyAgo.Macros:
+ MyAgo.Macros['IMAGE_ENTRY_POINT'] = ImageEntryPoint
+
+ PCI_COMPRESS_Flag = False
+ for k, v in MyAgo.Module.Defines.items():
+ if 'PCI_COMPRESS' == k and 'TRUE' == v:
+ PCI_COMPRESS_Flag = True
+
+ # tools definitions
+ ToolsDef = []
+ IncPrefix = self._INC_FLAG_[MyAgo.ToolChainFamily]
+ for Tool in MyAgo.BuildOption:
+ for Attr in MyAgo.BuildOption[Tool]:
+ Value = MyAgo.BuildOption[Tool][Attr]
+ if Attr == "FAMILY":
+ continue
+ elif Attr == "PATH":
+ ToolsDef.append("%s = %s" % (Tool, Value))
+ else:
+ # Don't generate MAKE_FLAGS in makefile. It's put in environment variable.
+ if Tool == "MAKE":
+ continue
+ # Remove duplicated include path, if any
+ if Attr == "FLAGS":
+ Value = RemoveDupOption(Value, IncPrefix, MyAgo.IncludePathList)
+ if Tool == "OPTROM" and PCI_COMPRESS_Flag:
+ ValueList = Value.split()
+ if ValueList:
+ for i, v in enumerate(ValueList):
+ if '-e' == v:
+ ValueList[i] = '-ec'
+ Value = ' '.join(ValueList)
+
+ ToolsDef.append("%s_%s = %s" % (Tool, Attr, Value))
+ ToolsDef.append("")
+
+ # generate the Response file and Response flag
+ RespDict = self.CommandExceedLimit()
+ RespFileList = os.path.join(MyAgo.OutputDir, 'respfilelist.txt')
+ if RespDict:
+ RespFileListContent = ''
+ for Resp in RespDict:
+ RespFile = os.path.join(MyAgo.OutputDir, str(Resp).lower() + '.txt')
+ StrList = RespDict[Resp].split(' ')
+ UnexpandMacro = []
+ NewStr = []
+ for Str in StrList:
+ if '$' in Str or '-MMD' in Str or '-MF' in Str:
+ UnexpandMacro.append(Str)
+ else:
+ NewStr.append(Str)
+ UnexpandMacroStr = ' '.join(UnexpandMacro)
+ NewRespStr = ' '.join(NewStr)
+ SaveFileOnChange(RespFile, NewRespStr, False)
+ ToolsDef.append("%s = %s" % (Resp, UnexpandMacroStr + ' @' + RespFile))
+ RespFileListContent += '@' + RespFile + TAB_LINE_BREAK
+ RespFileListContent += NewRespStr + TAB_LINE_BREAK
+ SaveFileOnChange(RespFileList, RespFileListContent, False)
+ else:
+ if os.path.exists(RespFileList):
+ os.remove(RespFileList)
+
+ # convert source files and binary files to build targets
+ self.ResultFileList = [str(T.Target) for T in MyAgo.CodaTargetList]
+ if len(self.ResultFileList) == 0 and len(MyAgo.SourceFileList) != 0:
+ EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build",
+ ExtraData="[%s]" % str(MyAgo))
+
+ self.ProcessBuildTargetList()
+ self.ParserGenerateFfsCmd()
+
+ # Generate macros used to represent input files
+ FileMacroList = [] # macro name = file list
+ for FileListMacro in self.FileListMacros:
+ FileMacro = self._FILE_MACRO_TEMPLATE.Replace(
+ {
+ "macro_name" : FileListMacro,
+ "source_file" : self.FileListMacros[FileListMacro]
+ }
+ )
+ FileMacroList.append(FileMacro)
+
+ # INC_LIST is special
+ FileMacro = ""
+ IncludePathList = []
+ for P in MyAgo.IncludePathList:
+ IncludePathList.append(IncPrefix + self.PlaceMacro(P, self.Macros))
+ if FileBuildRule.INC_LIST_MACRO in self.ListFileMacros:
+ self.ListFileMacros[FileBuildRule.INC_LIST_MACRO].append(IncPrefix + P)
+ FileMacro += self._FILE_MACRO_TEMPLATE.Replace(
+ {
+ "macro_name" : "INC",
+ "source_file" : IncludePathList
+ }
+ )
+ FileMacroList.append(FileMacro)
+ # Add support when compiling .nasm source files
+ IncludePathList = []
+ asmsource = [item for item in MyAgo.SourceFileList if item.File.upper().endswith((".NASM",".ASM",".NASMB","S"))]
+ if asmsource:
+ for P in MyAgo.IncludePathList:
+ IncludePath = self._INC_FLAG_['NASM'] + self.PlaceMacro(P, self.Macros)
+ if IncludePath.endswith(os.sep):
+ IncludePath = IncludePath.rstrip(os.sep)
+ # When compiling .nasm files, need to add a literal backslash at each path.
+ # In nmake makfiles, a trailing literal backslash must be escaped with a caret ('^').
+ # It is otherwise replaced with a space (' '). This is not necessary for GNU makfefiles.
+ if P == MyAgo.IncludePathList[-1] and self._Platform == WIN32_PLATFORM and self._FileType == NMAKE_FILETYPE:
+ IncludePath = ''.join([IncludePath, '^', os.sep])
+ else:
+ IncludePath = os.path.join(IncludePath, '')
+ IncludePathList.append(IncludePath)
+ FileMacroList.append(self._FILE_MACRO_TEMPLATE.Replace({"macro_name": "NASM_INC", "source_file": IncludePathList}))
+
+ # Generate macros used to represent files containing list of input files
+ for ListFileMacro in self.ListFileMacros:
+ ListFileName = os.path.join(MyAgo.OutputDir, "%s.lst" % ListFileMacro.lower()[:len(ListFileMacro) - 5])
+ FileMacroList.append("%s = %s" % (ListFileMacro, ListFileName))
+ SaveFileOnChange(
+ ListFileName,
+ "\n".join(self.ListFileMacros[ListFileMacro]),
+ False
+ )
+
+ # Generate objlist used to create .obj file
+ for Type in self.ObjTargetDict:
+ NewLine = ' '.join(list(self.ObjTargetDict[Type]))
+ FileMacroList.append("OBJLIST_%s = %s" % (list(self.ObjTargetDict.keys()).index(Type), NewLine))
+
+ BcTargetList = []
+
+ MakefileName = self.getMakefileName()
+ LibraryMakeCommandList = []
+ for D in self.LibraryBuildDirectoryList:
+ Command = self._MAKE_TEMPLATE_[self._Platform] % {"file":os.path.join(D, MakefileName)}
+ LibraryMakeCommandList.append(Command)
+
+ package_rel_dir = MyAgo.SourceDir
+ current_dir = self.Macros["WORKSPACE"]
+ found = False
+ while not found and os.sep in package_rel_dir:
+ index = package_rel_dir.index(os.sep)
+ current_dir = mws.join(current_dir, package_rel_dir[:index])
+ if os.path.exists(current_dir):
+ for fl in os.listdir(current_dir):
+ if fl.endswith('.dec'):
+ found = True
+ break
+ package_rel_dir = package_rel_dir[index + 1:]
+
+ MakefileTemplateDict = {
+ "makefile_header" : self._FILE_HEADER_[self._FileType],
+ "makefile_path" : os.path.join("$(MODULE_BUILD_DIR)", MakefileName),
+ "makefile_name" : MakefileName,
+ "platform_name" : self.PlatformInfo.Name,
+ "platform_guid" : self.PlatformInfo.Guid,
+ "platform_version" : self.PlatformInfo.Version,
+ "platform_relative_directory": self.PlatformInfo.SourceDir,
+ "platform_output_directory" : self.PlatformInfo.OutputDir,
+ "ffs_output_directory" : MyAgo.Macros["FFS_OUTPUT_DIR"],
+ "platform_dir" : MyAgo.Macros["PLATFORM_DIR"],
+
+ "module_name" : MyAgo.Name,
+ "module_guid" : MyAgo.Guid,
+ "module_name_guid" : MyAgo.UniqueBaseName,
+ "module_version" : MyAgo.Version,
+ "module_type" : MyAgo.ModuleType,
+ "module_file" : MyAgo.MetaFile.Name,
+ "module_file_base_name" : MyAgo.MetaFile.BaseName,
+ "module_relative_directory" : MyAgo.SourceDir,
+ "module_dir" : mws.join (self.Macros["WORKSPACE"], MyAgo.SourceDir),
+ "package_relative_directory": package_rel_dir,
+ "module_extra_defines" : ["%s = %s" % (k, v) for k, v in MyAgo.Module.Defines.items()],
+
+ "architecture" : MyAgo.Arch,
+ "toolchain_tag" : MyAgo.ToolChain,
+ "build_target" : MyAgo.BuildTarget,
+
+ "platform_build_directory" : self.PlatformInfo.BuildDir,
+ "module_build_directory" : MyAgo.BuildDir,
+ "module_output_directory" : MyAgo.OutputDir,
+ "module_debug_directory" : MyAgo.DebugDir,
+
+ "separator" : Separator,
+ "module_tool_definitions" : ToolsDef,
+
+ "shell_command_code" : list(self._SHELL_CMD_[self._Platform].keys()),
+ "shell_command" : list(self._SHELL_CMD_[self._Platform].values()),
+
+ "module_entry_point" : ModuleEntryPoint,
+ "image_entry_point" : ImageEntryPoint,
+ "arch_entry_point" : ArchEntryPoint,
+ "remaining_build_target" : self.ResultFileList,
+ "common_dependency_file" : self.CommonFileDependency,
+ "create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList),
+ "clean_command" : self.GetRemoveDirectoryCommand(["$(OUTPUT_DIR)"]),
+ "cleanall_command" : self.GetRemoveDirectoryCommand(["$(DEBUG_DIR)", "$(OUTPUT_DIR)"]),
+ "dependent_library_build_directory" : self.LibraryBuildDirectoryList,
+ "library_build_command" : LibraryMakeCommandList,
+ "file_macro" : FileMacroList,
+ "file_build_target" : self.BuildTargetList,
+ "backward_compatible_target": BcTargetList,
+ "INCLUDETAG" : "\n".join([self._INCLUDE_CMD_[self._FileType] + " " + os.path.join("$(MODULE_BUILD_DIR)","dependency"),
+ self._INCLUDE_CMD_[self._FileType] + " " + os.path.join("$(MODULE_BUILD_DIR)","deps_target")
+ ])
+ }
+
+ return MakefileTemplateDict
+
+ def ParserGenerateFfsCmd(self):
+ #Add Ffs cmd to self.BuildTargetList
+ OutputFile = ''
+ DepsFileList = []
+
+ for Cmd in self.GenFfsList:
+ if Cmd[2]:
+ for CopyCmd in Cmd[2]:
+ Src, Dst = CopyCmd
+ Src = self.ReplaceMacro(Src)
+ Dst = self.ReplaceMacro(Dst)
+ if Dst not in self.ResultFileList:
+ self.ResultFileList.append(Dst)
+ if '%s :' %(Dst) not in self.BuildTargetList:
+ self.BuildTargetList.append("%s : %s" %(Dst,Src))
+ self.BuildTargetList.append('\t' + self._CP_TEMPLATE_[self._Platform] %{'Src': Src, 'Dst': Dst})
+
+ FfsCmdList = Cmd[0]
+ for index, Str in enumerate(FfsCmdList):
+ if '-o' == Str:
+ OutputFile = FfsCmdList[index + 1]
+ if '-i' == Str or "-oi" == Str:
+ if DepsFileList == []:
+ DepsFileList = [FfsCmdList[index + 1]]
+ else:
+ DepsFileList.append(FfsCmdList[index + 1])
+ DepsFileString = ' '.join(DepsFileList).strip()
+ if DepsFileString == '':
+ continue
+ OutputFile = self.ReplaceMacro(OutputFile)
+ self.ResultFileList.append(OutputFile)
+ DepsFileString = self.ReplaceMacro(DepsFileString)
+ self.BuildTargetList.append('%s : %s' % (OutputFile, DepsFileString))
+ CmdString = ' '.join(FfsCmdList).strip()
+ CmdString = self.ReplaceMacro(CmdString)
+ self.BuildTargetList.append('\t%s' % CmdString)
+
+ self.ParseSecCmd(DepsFileList, Cmd[1])
+ for SecOutputFile, SecDepsFile, SecCmd in self.FfsOutputFileList :
+ self.BuildTargetList.append('%s : %s' % (self.ReplaceMacro(SecOutputFile), self.ReplaceMacro(SecDepsFile)))
+ self.BuildTargetList.append('\t%s' % self.ReplaceMacro(SecCmd))
+ self.FfsOutputFileList = []
+
+ def ParseSecCmd(self, OutputFileList, CmdTuple):
+ for OutputFile in OutputFileList:
+ for SecCmdStr in CmdTuple:
+ SecDepsFileList = []
+ SecCmdList = SecCmdStr.split()
+ CmdName = SecCmdList[0]
+ for index, CmdItem in enumerate(SecCmdList):
+ if '-o' == CmdItem and OutputFile == SecCmdList[index + 1]:
+ index = index + 1
+ while index + 1 < len(SecCmdList):
+ if not SecCmdList[index+1].startswith('-'):
+ SecDepsFileList.append(SecCmdList[index + 1])
+ index = index + 1
+ if CmdName == 'Trim':
+ SecDepsFileList.append(os.path.join('$(DEBUG_DIR)', os.path.basename(OutputFile).replace('offset', 'efi')))
+ if OutputFile.endswith('.ui') or OutputFile.endswith('.ver'):
+ SecDepsFileList.append(os.path.join('$(MODULE_DIR)', '$(MODULE_FILE)'))
+ self.FfsOutputFileList.append((OutputFile, ' '.join(SecDepsFileList), SecCmdStr))
+ if len(SecDepsFileList) > 0:
+ self.ParseSecCmd(SecDepsFileList, CmdTuple)
+ break
+ else:
+ continue
+
+ def ReplaceMacro(self, str):
+ for Macro in self.MacroList:
+ if self._AutoGenObject.Macros[Macro] and self._AutoGenObject.Macros[Macro] in str:
+ str = str.replace(self._AutoGenObject.Macros[Macro], '$(' + Macro + ')')
+ return str
+
+ def CommandExceedLimit(self):
+ FlagDict = {
+ 'CC' : { 'Macro' : '$(CC_FLAGS)', 'Value' : False},
+ 'PP' : { 'Macro' : '$(PP_FLAGS)', 'Value' : False},
+ 'APP' : { 'Macro' : '$(APP_FLAGS)', 'Value' : False},
+ 'ASLPP' : { 'Macro' : '$(ASLPP_FLAGS)', 'Value' : False},
+ 'VFRPP' : { 'Macro' : '$(VFRPP_FLAGS)', 'Value' : False},
+ 'ASM' : { 'Macro' : '$(ASM_FLAGS)', 'Value' : False},
+ 'ASLCC' : { 'Macro' : '$(ASLCC_FLAGS)', 'Value' : False},
+ }
+
+ RespDict = {}
+ FileTypeList = []
+ IncPrefix = self._INC_FLAG_[self._AutoGenObject.ToolChainFamily]
+
+ # base on the source files to decide the file type
+ for File in self._AutoGenObject.SourceFileList:
+ for type in self._AutoGenObject.FileTypes:
+ if File in self._AutoGenObject.FileTypes[type]:
+ if type not in FileTypeList:
+ FileTypeList.append(type)
+
+ # calculate the command-line length
+ if FileTypeList:
+ for type in FileTypeList:
+ BuildTargets = self._AutoGenObject.BuildRules[type].BuildTargets
+ for Target in BuildTargets:
+ CommandList = BuildTargets[Target].Commands
+ for SingleCommand in CommandList:
+ Tool = ''
+ SingleCommandLength = len(SingleCommand)
+ SingleCommandList = SingleCommand.split()
+ if len(SingleCommandList) > 0:
+ for Flag in FlagDict:
+ if '$('+ Flag +')' in SingleCommandList[0]:
+ Tool = Flag
+ break
+ if Tool:
+ if 'PATH' not in self._AutoGenObject.BuildOption[Tool]:
+ EdkLogger.error("build", AUTOGEN_ERROR, "%s_PATH doesn't exist in %s ToolChain and %s Arch." %(Tool, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch), ExtraData="[%s]" % str(self._AutoGenObject))
+ SingleCommandLength += len(self._AutoGenObject.BuildOption[Tool]['PATH'])
+ for item in SingleCommandList[1:]:
+ if FlagDict[Tool]['Macro'] in item:
+ if 'FLAGS' not in self._AutoGenObject.BuildOption[Tool]:
+ EdkLogger.error("build", AUTOGEN_ERROR, "%s_FLAGS doesn't exist in %s ToolChain and %s Arch." %(Tool, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch), ExtraData="[%s]" % str(self._AutoGenObject))
+ Str = self._AutoGenObject.BuildOption[Tool]['FLAGS']
+ for Option in self._AutoGenObject.BuildOption:
+ for Attr in self._AutoGenObject.BuildOption[Option]:
+ if Str.find(Option + '_' + Attr) != -1:
+ Str = Str.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])
+ while(Str.find('$(') != -1):
+ for macro in self._AutoGenObject.Macros:
+ MacroName = '$('+ macro + ')'
+ if (Str.find(MacroName) != -1):
+ Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])
+ break
+ else:
+ break
+ SingleCommandLength += len(Str)
+ elif '$(INC)' in item:
+ SingleCommandLength += self._AutoGenObject.IncludePathLength + len(IncPrefix) * len(self._AutoGenObject.IncludePathList)
+ elif item.find('$(') != -1:
+ Str = item
+ for Option in self._AutoGenObject.BuildOption:
+ for Attr in self._AutoGenObject.BuildOption[Option]:
+ if Str.find(Option + '_' + Attr) != -1:
+ Str = Str.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])
+ while(Str.find('$(') != -1):
+ for macro in self._AutoGenObject.Macros:
+ MacroName = '$('+ macro + ')'
+ if (Str.find(MacroName) != -1):
+ Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])
+ break
+ else:
+ break
+ SingleCommandLength += len(Str)
+
+ if SingleCommandLength > GlobalData.gCommandMaxLength:
+ FlagDict[Tool]['Value'] = True
+
+ # generate the response file content by combine the FLAGS and INC
+ for Flag in FlagDict:
+ if FlagDict[Flag]['Value']:
+ Key = Flag + '_RESP'
+ RespMacro = FlagDict[Flag]['Macro'].replace('FLAGS', 'RESP')
+ Value = self._AutoGenObject.BuildOption[Flag]['FLAGS']
+ for inc in self._AutoGenObject.IncludePathList:
+ Value += ' ' + IncPrefix + inc
+ for Option in self._AutoGenObject.BuildOption:
+ for Attr in self._AutoGenObject.BuildOption[Option]:
+ if Value.find(Option + '_' + Attr) != -1:
+ Value = Value.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])
+ while (Value.find('$(') != -1):
+ for macro in self._AutoGenObject.Macros:
+ MacroName = '$('+ macro + ')'
+ if (Value.find(MacroName) != -1):
+ Value = Value.replace(MacroName, self._AutoGenObject.Macros[macro])
+ break
+ else:
+ break
+
+ if self._AutoGenObject.ToolChainFamily == 'GCC':
+ RespDict[Key] = Value.replace('\\', '/')
+ else:
+ RespDict[Key] = Value
+ for Target in BuildTargets:
+ for i, SingleCommand in enumerate(BuildTargets[Target].Commands):
+ if FlagDict[Flag]['Macro'] in SingleCommand:
+ BuildTargets[Target].Commands[i] = SingleCommand.replace('$(INC)', '').replace(FlagDict[Flag]['Macro'], RespMacro)
+ return RespDict
+
+ def ProcessBuildTargetList(self):
+ #
+ # Search dependency file list for each source file
+ #
+ ForceIncludedFile = []
+ for File in self._AutoGenObject.AutoGenFileList:
+ if File.Ext == '.h':
+ ForceIncludedFile.append(File)
+ SourceFileList = []
+ OutPutFileList = []
+ for Target in self._AutoGenObject.IntroTargetList:
+ SourceFileList.extend(Target.Inputs)
+ OutPutFileList.extend(Target.Outputs)
+
+ if OutPutFileList:
+ for Item in OutPutFileList:
+ if Item in SourceFileList:
+ SourceFileList.remove(Item)
+
+ FileDependencyDict = {item:ForceIncludedFile for item in SourceFileList}
+
+ for Dependency in FileDependencyDict.values():
+ self.DependencyHeaderFileSet.update(set(Dependency))
+
+ # Get a set of unique package includes from MetaFile
+ parentMetaFileIncludes = set()
+ for aInclude in self._AutoGenObject.PackageIncludePathList:
+ aIncludeName = str(aInclude)
+ parentMetaFileIncludes.add(aIncludeName.lower())
+
+ # Check if header files are listed in metafile
+ # Get a set of unique module header source files from MetaFile
+ headerFilesInMetaFileSet = set()
+ for aFile in self._AutoGenObject.SourceFileList:
+ aFileName = str(aFile)
+ if not aFileName.endswith('.h'):
+ continue
+ headerFilesInMetaFileSet.add(aFileName.lower())
+
+ # Get a set of unique module autogen files
+ localAutoGenFileSet = set()
+ for aFile in self._AutoGenObject.AutoGenFileList:
+ localAutoGenFileSet.add(str(aFile).lower())
+
+ # Get a set of unique module dependency header files
+ # Exclude autogen files and files not in the source directory
+ # and files that are under the package include list
+ headerFileDependencySet = set()
+ localSourceDir = str(self._AutoGenObject.SourceDir).lower()
+ for Dependency in FileDependencyDict.values():
+ for aFile in Dependency:
+ aFileName = str(aFile).lower()
+ # Exclude non-header files
+ if not aFileName.endswith('.h'):
+ continue
+ # Exclude autogen files
+ if aFileName in localAutoGenFileSet:
+ continue
+ # Exclude include out of local scope
+ if localSourceDir not in aFileName:
+ continue
+ # Exclude files covered by package includes
+ pathNeeded = True
+ for aIncludePath in parentMetaFileIncludes:
+ if aIncludePath in aFileName:
+ pathNeeded = False
+ break
+ if not pathNeeded:
+ continue
+ # Keep the file to be checked
+ headerFileDependencySet.add(aFileName)
+
+ # Check if a module dependency header file is missing from the module's MetaFile
+ for aFile in headerFileDependencySet:
+ if aFile in headerFilesInMetaFileSet:
+ continue
+ if GlobalData.gUseHashCache:
+ GlobalData.gModuleBuildTracking[self._AutoGenObject] = 'FAIL_METAFILE'
+ EdkLogger.warn("build","Module MetaFile [Sources] is missing local header!",
+ ExtraData = "Local Header: " + aFile + " not found in " + self._AutoGenObject.MetaFile.Path
+ )
+
+ for File,Dependency in FileDependencyDict.items():
+ if not Dependency:
+ continue
+
+ self._AutoGenObject.AutoGenDepSet |= set(Dependency)
+
+ CmdSumDict = {}
+ CmdTargetDict = {}
+ CmdCppDict = {}
+ DependencyDict = FileDependencyDict.copy()
+
+ # Convert target description object to target string in makefile
+ if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT and TAB_C_CODE_FILE in self._AutoGenObject.Targets:
+ for T in self._AutoGenObject.Targets[TAB_C_CODE_FILE]:
+ NewFile = self.PlaceMacro(str(T), self.Macros)
+ if not self.ObjTargetDict.get(T.Target.SubDir):
+ self.ObjTargetDict[T.Target.SubDir] = set()
+ self.ObjTargetDict[T.Target.SubDir].add(NewFile)
+ for Type in self._AutoGenObject.Targets:
+ for T in self._AutoGenObject.Targets[Type]:
+ # Generate related macros if needed
+ if T.GenFileListMacro and T.FileListMacro not in self.FileListMacros:
+ self.FileListMacros[T.FileListMacro] = []
+ if T.GenListFile and T.ListFileMacro not in self.ListFileMacros:
+ self.ListFileMacros[T.ListFileMacro] = []
+ if T.GenIncListFile and T.IncListFileMacro not in self.ListFileMacros:
+ self.ListFileMacros[T.IncListFileMacro] = []
+
+ Deps = []
+ CCodeDeps = []
+ # Add force-dependencies
+ for Dep in T.Dependencies:
+ Deps.append(self.PlaceMacro(str(Dep), self.Macros))
+ if Dep != '$(MAKE_FILE)':
+ CCodeDeps.append(self.PlaceMacro(str(Dep), self.Macros))
+ # Add inclusion-dependencies
+ if len(T.Inputs) == 1 and T.Inputs[0] in FileDependencyDict:
+ for F in FileDependencyDict[T.Inputs[0]]:
+ Deps.append(self.PlaceMacro(str(F), self.Macros))
+ # Add source-dependencies
+ for F in T.Inputs:
+ NewFile = self.PlaceMacro(str(F), self.Macros)
+ # In order to use file list macro as dependency
+ if T.GenListFile:
+ # gnu tools need forward slash path separator, even on Windows
+ self.ListFileMacros[T.ListFileMacro].append(str(F).replace ('\\', '/'))
+ self.FileListMacros[T.FileListMacro].append(NewFile)
+ elif T.GenFileListMacro:
+ self.FileListMacros[T.FileListMacro].append(NewFile)
+ else:
+ Deps.append(NewFile)
+ for key in self.FileListMacros:
+ self.FileListMacros[key].sort()
+ # Use file list macro as dependency
+ if T.GenFileListMacro:
+ Deps.append("$(%s)" % T.FileListMacro)
+ if Type in [TAB_OBJECT_FILE, TAB_STATIC_LIBRARY]:
+ Deps.append("$(%s)" % T.ListFileMacro)
+
+ if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT and Type == TAB_C_CODE_FILE:
+ T, CmdTarget, CmdTargetDict, CmdCppDict = self.ParserCCodeFile(T, Type, CmdSumDict, CmdTargetDict, CmdCppDict, DependencyDict)
+ TargetDict = {"target": self.PlaceMacro(T.Target.Path, self.Macros), "cmd": "\n\t".join(T.Commands),"deps": CCodeDeps}
+ CmdLine = self._BUILD_TARGET_TEMPLATE.Replace(TargetDict).rstrip().replace('\t$(OBJLIST', '$(OBJLIST')
+ if T.Commands:
+ CmdLine = '%s%s' %(CmdLine, TAB_LINE_BREAK)
+ if CCodeDeps or CmdLine:
+ self.BuildTargetList.append(CmdLine)
+ else:
+ TargetDict = {"target": self.PlaceMacro(T.Target.Path, self.Macros), "cmd": "\n\t".join(T.Commands),"deps": Deps}
+ self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(TargetDict))
+
+ # Add a Makefile rule for targets generating multiple files.
+ # The main output is a prerequisite for the other output files.
+ for i in T.Outputs[1:]:
+ AnnexeTargetDict = {"target": self.PlaceMacro(i.Path, self.Macros), "cmd": "", "deps": self.PlaceMacro(T.Target.Path, self.Macros)}
+ self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(AnnexeTargetDict))
+
+ def ParserCCodeFile(self, T, Type, CmdSumDict, CmdTargetDict, CmdCppDict, DependencyDict):
+ if not CmdSumDict:
+ for item in self._AutoGenObject.Targets[Type]:
+ CmdSumDict[item.Target.SubDir] = item.Target.BaseName
+ for CppPath in item.Inputs:
+ Path = self.PlaceMacro(CppPath.Path, self.Macros)
+ if CmdCppDict.get(item.Target.SubDir):
+ CmdCppDict[item.Target.SubDir].append(Path)
+ else:
+ CmdCppDict[item.Target.SubDir] = ['$(MAKE_FILE)', Path]
+ if CppPath.Path in DependencyDict:
+ for Temp in DependencyDict[CppPath.Path]:
+ try:
+ Path = self.PlaceMacro(Temp.Path, self.Macros)
+ except:
+ continue
+ if Path not in (self.CommonFileDependency + CmdCppDict[item.Target.SubDir]):
+ CmdCppDict[item.Target.SubDir].append(Path)
+ if T.Commands:
+ CommandList = T.Commands[:]
+ for Item in CommandList[:]:
+ SingleCommandList = Item.split()
+ if len(SingleCommandList) > 0 and self.CheckCCCmd(SingleCommandList):
+ for Temp in SingleCommandList:
+ if Temp.startswith('/Fo'):
+ CmdSign = '%s%s' % (Temp.rsplit(TAB_SLASH, 1)[0], TAB_SLASH)
+ break
+ else: continue
+ if CmdSign not in list(CmdTargetDict.keys()):
+ CmdTargetDict[CmdSign] = Item.replace(Temp, CmdSign)
+ else:
+ CmdTargetDict[CmdSign] = "%s %s" % (CmdTargetDict[CmdSign], SingleCommandList[-1])
+ Index = CommandList.index(Item)
+ CommandList.pop(Index)
+ if SingleCommandList[-1].endswith("%s%s.c" % (TAB_SLASH, CmdSumDict[CmdSign[3:].rsplit(TAB_SLASH, 1)[0]])):
+ Cpplist = CmdCppDict[T.Target.SubDir]
+ Cpplist.insert(0, '$(OBJLIST_%d): ' % list(self.ObjTargetDict.keys()).index(T.Target.SubDir))
+ T.Commands[Index] = '%s\n\t%s' % (' \\\n\t'.join(Cpplist), CmdTargetDict[CmdSign])
+ else:
+ T.Commands.pop(Index)
+ return T, CmdSumDict, CmdTargetDict, CmdCppDict
+
+ def CheckCCCmd(self, CommandList):
+ for cmd in CommandList:
+ if '$(CC)' in cmd:
+ return True
+ return False
+ ## For creating makefile targets for dependent libraries
+ def ProcessDependentLibrary(self):
+ for LibraryAutoGen in self._AutoGenObject.LibraryAutoGenList:
+ if not LibraryAutoGen.IsBinaryModule:
+ self.LibraryBuildDirectoryList.append(self.PlaceMacro(LibraryAutoGen.BuildDir, self.Macros))
+
+ ## Return a list containing source file's dependencies
+ #
+ # @param FileList The list of source files
+ # @param ForceInculeList The list of files which will be included forcely
+ # @param SearchPathList The list of search path
+ #
+ # @retval dict The mapping between source file path and its dependencies
+ #
+ def GetFileDependency(self, FileList, ForceInculeList, SearchPathList):
+ Dependency = {}
+ for F in FileList:
+ Dependency[F] = GetDependencyList(self._AutoGenObject, self.FileCache, F, ForceInculeList, SearchPathList)
+ return Dependency
+
+
+## CustomMakefile class
+#
+# This class encapsules makefie and its generation for module. It uses template to generate
+# the content of makefile. The content of makefile will be got from ModuleAutoGen object.
+#
+class CustomMakefile(BuildFile):
+ ## template used to generate the makefile for module with custom makefile
+ _TEMPLATE_ = TemplateString('''\
+${makefile_header}
+
+#
+# Platform Macro Definition
+#
+PLATFORM_NAME = ${platform_name}
+PLATFORM_GUID = ${platform_guid}
+PLATFORM_VERSION = ${platform_version}
+PLATFORM_RELATIVE_DIR = ${platform_relative_directory}
+PLATFORM_DIR = ${platform_dir}
+PLATFORM_OUTPUT_DIR = ${platform_output_directory}
+
+#
+# Module Macro Definition
+#
+MODULE_NAME = ${module_name}
+MODULE_GUID = ${module_guid}
+MODULE_NAME_GUID = ${module_name_guid}
+MODULE_VERSION = ${module_version}
+MODULE_TYPE = ${module_type}
+MODULE_FILE = ${module_file}
+MODULE_FILE_BASE_NAME = ${module_file_base_name}
+BASE_NAME = $(MODULE_NAME)
+MODULE_RELATIVE_DIR = ${module_relative_directory}
+MODULE_DIR = ${module_dir}
+
+#
+# Build Configuration Macro Definition
+#
+ARCH = ${architecture}
+TOOLCHAIN = ${toolchain_tag}
+TOOLCHAIN_TAG = ${toolchain_tag}
+TARGET = ${build_target}
+
+#
+# Build Directory Macro Definition
+#
+# PLATFORM_BUILD_DIR = ${platform_build_directory}
+BUILD_DIR = ${platform_build_directory}
+BIN_DIR = $(BUILD_DIR)${separator}${architecture}
+LIB_DIR = $(BIN_DIR)
+MODULE_BUILD_DIR = ${module_build_directory}
+OUTPUT_DIR = ${module_output_directory}
+DEBUG_DIR = ${module_debug_directory}
+DEST_DIR_OUTPUT = $(OUTPUT_DIR)
+DEST_DIR_DEBUG = $(DEBUG_DIR)
+
+#
+# Tools definitions specific to this module
+#
+${BEGIN}${module_tool_definitions}
+${END}
+MAKE_FILE = ${makefile_path}
+
+#
+# Shell Command Macro
+#
+${BEGIN}${shell_command_code} = ${shell_command}
+${END}
+
+${custom_makefile_content}
+
+#
+# Target used when called from platform makefile, which will bypass the build of dependent libraries
+#
+
+pbuild: init all
+
+
+#
+# ModuleTarget
+#
+
+mbuild: init all
+
+#
+# Build Target used in multi-thread build mode, which no init target is needed
+#
+
+tbuild: all
+
+#
+# Initialization target: print build information and create necessary directories
+#
+init:
+\t-@echo Building ... $(MODULE_DIR)${separator}$(MODULE_FILE) [$(ARCH)]
+${BEGIN}\t-@${create_directory_command}\n${END}\
+
+''')
+
+ ## Constructor of CustomMakefile
+ #
+ # @param ModuleAutoGen Object of ModuleAutoGen class
+ #
+ def __init__(self, ModuleAutoGen):
+ BuildFile.__init__(self, ModuleAutoGen)
+ self.PlatformInfo = self._AutoGenObject.PlatformInfo
+ self.IntermediateDirectoryList = ["$(DEBUG_DIR)", "$(OUTPUT_DIR)"]
+ self.DependencyHeaderFileSet = set()
+
+ # Compose a dict object containing information used to do replacement in template
+ @property
+ def _TemplateDict(self):
+ Separator = self._SEP_[self._Platform]
+ MyAgo = self._AutoGenObject
+ if self._FileType not in MyAgo.CustomMakefile:
+ EdkLogger.error('build', OPTION_NOT_SUPPORTED, "No custom makefile for %s" % self._FileType,
+ ExtraData="[%s]" % str(MyAgo))
+ MakefilePath = mws.join(
+ MyAgo.WorkspaceDir,
+ MyAgo.CustomMakefile[self._FileType]
+ )
+ try:
+ CustomMakefile = open(MakefilePath, 'r').read()
+ except:
+ EdkLogger.error('build', FILE_OPEN_FAILURE, File=str(MyAgo),
+ ExtraData=MyAgo.CustomMakefile[self._FileType])
+
+ # tools definitions
+ ToolsDef = []
+ for Tool in MyAgo.BuildOption:
+ # Don't generate MAKE_FLAGS in makefile. It's put in environment variable.
+ if Tool == "MAKE":
+ continue
+ for Attr in MyAgo.BuildOption[Tool]:
+ if Attr == "FAMILY":
+ continue
+ elif Attr == "PATH":
+ ToolsDef.append("%s = %s" % (Tool, MyAgo.BuildOption[Tool][Attr]))
+ else:
+ ToolsDef.append("%s_%s = %s" % (Tool, Attr, MyAgo.BuildOption[Tool][Attr]))
+ ToolsDef.append("")
+
+ MakefileName = self.getMakefileName()
+ MakefileTemplateDict = {
+ "makefile_header" : self._FILE_HEADER_[self._FileType],
+ "makefile_path" : os.path.join("$(MODULE_BUILD_DIR)", MakefileName),
+ "platform_name" : self.PlatformInfo.Name,
+ "platform_guid" : self.PlatformInfo.Guid,
+ "platform_version" : self.PlatformInfo.Version,
+ "platform_relative_directory": self.PlatformInfo.SourceDir,
+ "platform_output_directory" : self.PlatformInfo.OutputDir,
+ "platform_dir" : MyAgo.Macros["PLATFORM_DIR"],
+
+ "module_name" : MyAgo.Name,
+ "module_guid" : MyAgo.Guid,
+ "module_name_guid" : MyAgo.UniqueBaseName,
+ "module_version" : MyAgo.Version,
+ "module_type" : MyAgo.ModuleType,
+ "module_file" : MyAgo.MetaFile,
+ "module_file_base_name" : MyAgo.MetaFile.BaseName,
+ "module_relative_directory" : MyAgo.SourceDir,
+ "module_dir" : mws.join (MyAgo.WorkspaceDir, MyAgo.SourceDir),
+
+ "architecture" : MyAgo.Arch,
+ "toolchain_tag" : MyAgo.ToolChain,
+ "build_target" : MyAgo.BuildTarget,
+
+ "platform_build_directory" : self.PlatformInfo.BuildDir,
+ "module_build_directory" : MyAgo.BuildDir,
+ "module_output_directory" : MyAgo.OutputDir,
+ "module_debug_directory" : MyAgo.DebugDir,
+
+ "separator" : Separator,
+ "module_tool_definitions" : ToolsDef,
+
+ "shell_command_code" : list(self._SHELL_CMD_[self._Platform].keys()),
+ "shell_command" : list(self._SHELL_CMD_[self._Platform].values()),
+
+ "create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList),
+ "custom_makefile_content" : CustomMakefile
+ }
+
+ return MakefileTemplateDict
+
+## PlatformMakefile class
+#
+# This class encapsules makefie and its generation for platform. It uses
+# template to generate the content of makefile. The content of makefile will be
+# got from PlatformAutoGen object.
+#
+class PlatformMakefile(BuildFile):
+ ## template used to generate the makefile for platform
+ _TEMPLATE_ = TemplateString('''\
+${makefile_header}
+
+#
+# Platform Macro Definition
+#
+PLATFORM_NAME = ${platform_name}
+PLATFORM_GUID = ${platform_guid}
+PLATFORM_VERSION = ${platform_version}
+PLATFORM_FILE = ${platform_file}
+PLATFORM_DIR = ${platform_dir}
+PLATFORM_OUTPUT_DIR = ${platform_output_directory}
+
+#
+# Build Configuration Macro Definition
+#
+TOOLCHAIN = ${toolchain_tag}
+TOOLCHAIN_TAG = ${toolchain_tag}
+TARGET = ${build_target}
+
+#
+# Build Directory Macro Definition
+#
+BUILD_DIR = ${platform_build_directory}
+FV_DIR = ${platform_build_directory}${separator}FV
+
+#
+# Shell Command Macro
+#
+${BEGIN}${shell_command_code} = ${shell_command}
+${END}
+
+MAKE = ${make_path}
+MAKE_FILE = ${makefile_path}
+
+#
+# Default target
+#
+all: init build_libraries build_modules
+
+#
+# Initialization target: print build information and create necessary directories
+#
+init:
+\t-@echo Building ... $(PLATFORM_FILE) [${build_architecture_list}]
+\t${BEGIN}-@${create_directory_command}
+\t${END}
+#
+# library build target
+#
+libraries: init build_libraries
+
+#
+# module build target
+#
+modules: init build_libraries build_modules
+
+#
+# Build all libraries:
+#
+build_libraries:
+${BEGIN}\t@"$(MAKE)" $(MAKE_FLAGS) -f ${library_makefile_list} pbuild
+${END}\t@cd $(BUILD_DIR)
+
+#
+# Build all modules:
+#
+build_modules:
+${BEGIN}\t@"$(MAKE)" $(MAKE_FLAGS) -f ${module_makefile_list} pbuild
+${END}\t@cd $(BUILD_DIR)
+
+#
+# Clean intermediate files
+#
+clean:
+\t${BEGIN}-@${library_build_command} clean
+\t${END}${BEGIN}-@${module_build_command} clean
+\t${END}@cd $(BUILD_DIR)
+
+#
+# Clean all generated files except to makefile
+#
+cleanall:
+${BEGIN}\t${cleanall_command}
+${END}
+
+#
+# Clean all library files
+#
+cleanlib:
+\t${BEGIN}-@${library_build_command} cleanall
+\t${END}@cd $(BUILD_DIR)\n
+''')
+
+ ## Constructor of PlatformMakefile
+ #
+ # @param ModuleAutoGen Object of PlatformAutoGen class
+ #
+ def __init__(self, PlatformAutoGen):
+ BuildFile.__init__(self, PlatformAutoGen)
+ self.ModuleBuildCommandList = []
+ self.ModuleMakefileList = []
+ self.IntermediateDirectoryList = []
+ self.ModuleBuildDirectoryList = []
+ self.LibraryBuildDirectoryList = []
+ self.LibraryMakeCommandList = []
+ self.DependencyHeaderFileSet = set()
+
+ # Compose a dict object containing information used to do replacement in template
+ @property
+ def _TemplateDict(self):
+ Separator = self._SEP_[self._Platform]
+
+ MyAgo = self._AutoGenObject
+ if "MAKE" not in MyAgo.ToolDefinition or "PATH" not in MyAgo.ToolDefinition["MAKE"]:
+ EdkLogger.error("build", OPTION_MISSING, "No MAKE command defined. Please check your tools_def.txt!",
+ ExtraData="[%s]" % str(MyAgo))
+
+ self.IntermediateDirectoryList = ["$(BUILD_DIR)"]
+ self.ModuleBuildDirectoryList = self.GetModuleBuildDirectoryList()
+ self.LibraryBuildDirectoryList = self.GetLibraryBuildDirectoryList()
+
+ MakefileName = self.getMakefileName()
+ LibraryMakefileList = []
+ LibraryMakeCommandList = []
+ for D in self.LibraryBuildDirectoryList:
+ D = self.PlaceMacro(D, {"BUILD_DIR":MyAgo.BuildDir})
+ Makefile = os.path.join(D, MakefileName)
+ Command = self._MAKE_TEMPLATE_[self._Platform] % {"file":Makefile}
+ LibraryMakefileList.append(Makefile)
+ LibraryMakeCommandList.append(Command)
+ self.LibraryMakeCommandList = LibraryMakeCommandList
+
+ ModuleMakefileList = []
+ ModuleMakeCommandList = []
+ for D in self.ModuleBuildDirectoryList:
+ D = self.PlaceMacro(D, {"BUILD_DIR":MyAgo.BuildDir})
+ Makefile = os.path.join(D, MakefileName)
+ Command = self._MAKE_TEMPLATE_[self._Platform] % {"file":Makefile}
+ ModuleMakefileList.append(Makefile)
+ ModuleMakeCommandList.append(Command)
+
+ MakefileTemplateDict = {
+ "makefile_header" : self._FILE_HEADER_[self._FileType],
+ "makefile_path" : os.path.join("$(BUILD_DIR)", MakefileName),
+ "make_path" : MyAgo.ToolDefinition["MAKE"]["PATH"],
+ "makefile_name" : MakefileName,
+ "platform_name" : MyAgo.Name,
+ "platform_guid" : MyAgo.Guid,
+ "platform_version" : MyAgo.Version,
+ "platform_file" : MyAgo.MetaFile,
+ "platform_relative_directory": MyAgo.SourceDir,
+ "platform_output_directory" : MyAgo.OutputDir,
+ "platform_build_directory" : MyAgo.BuildDir,
+ "platform_dir" : MyAgo.Macros["PLATFORM_DIR"],
+
+ "toolchain_tag" : MyAgo.ToolChain,
+ "build_target" : MyAgo.BuildTarget,
+ "shell_command_code" : list(self._SHELL_CMD_[self._Platform].keys()),
+ "shell_command" : list(self._SHELL_CMD_[self._Platform].values()),
+ "build_architecture_list" : MyAgo.Arch,
+ "architecture" : MyAgo.Arch,
+ "separator" : Separator,
+ "create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList),
+ "cleanall_command" : self.GetRemoveDirectoryCommand(self.IntermediateDirectoryList),
+ "library_makefile_list" : LibraryMakefileList,
+ "module_makefile_list" : ModuleMakefileList,
+ "library_build_command" : LibraryMakeCommandList,
+ "module_build_command" : ModuleMakeCommandList,
+ }
+
+ return MakefileTemplateDict
+
+ ## Get the root directory list for intermediate files of all modules build
+ #
+ # @retval list The list of directory
+ #
+ def GetModuleBuildDirectoryList(self):
+ DirList = []
+ for ModuleAutoGen in self._AutoGenObject.ModuleAutoGenList:
+ if not ModuleAutoGen.IsBinaryModule:
+ DirList.append(os.path.join(self._AutoGenObject.BuildDir, ModuleAutoGen.BuildDir))
+ return DirList
+
+ ## Get the root directory list for intermediate files of all libraries build
+ #
+ # @retval list The list of directory
+ #
+ def GetLibraryBuildDirectoryList(self):
+ DirList = []
+ for LibraryAutoGen in self._AutoGenObject.LibraryAutoGenList:
+ if not LibraryAutoGen.IsBinaryModule:
+ DirList.append(os.path.join(self._AutoGenObject.BuildDir, LibraryAutoGen.BuildDir))
+ return DirList
+
+## TopLevelMakefile class
+#
+# This class encapsules makefie and its generation for entrance makefile. It
+# uses template to generate the content of makefile. The content of makefile
+# will be got from WorkspaceAutoGen object.
+#
+class TopLevelMakefile(BuildFile):
+ ## template used to generate toplevel makefile
+ _TEMPLATE_ = TemplateString('''${BEGIN}\tGenFds -f ${fdf_file} --conf=${conf_directory} -o ${platform_build_directory} -t ${toolchain_tag} -b ${build_target} -p ${active_platform} -a ${build_architecture_list} ${extra_options}${END}${BEGIN} -r ${fd} ${END}${BEGIN} -i ${fv} ${END}${BEGIN} -C ${cap} ${END}${BEGIN} -D ${macro} ${END}''')
+
+ ## Constructor of TopLevelMakefile
+ #
+ # @param Workspace Object of WorkspaceAutoGen class
+ #
+ def __init__(self, Workspace):
+ BuildFile.__init__(self, Workspace)
+ self.IntermediateDirectoryList = []
+ self.DependencyHeaderFileSet = set()
+
+ # Compose a dict object containing information used to do replacement in template
+ @property
+ def _TemplateDict(self):
+ Separator = self._SEP_[self._Platform]
+
+ # any platform autogen object is ok because we just need common information
+ MyAgo = self._AutoGenObject
+
+ if "MAKE" not in MyAgo.ToolDefinition or "PATH" not in MyAgo.ToolDefinition["MAKE"]:
+ EdkLogger.error("build", OPTION_MISSING, "No MAKE command defined. Please check your tools_def.txt!",
+ ExtraData="[%s]" % str(MyAgo))
+
+ for Arch in MyAgo.ArchList:
+ self.IntermediateDirectoryList.append(Separator.join(["$(BUILD_DIR)", Arch]))
+ self.IntermediateDirectoryList.append("$(FV_DIR)")
+
+ # TRICK: for not generating GenFds call in makefile if no FDF file
+ MacroList = []
+ if MyAgo.FdfFile is not None and MyAgo.FdfFile != "":
+ FdfFileList = [MyAgo.FdfFile]
+ # macros passed to GenFds
+ MacroDict = {}
+ MacroDict.update(GlobalData.gGlobalDefines)
+ MacroDict.update(GlobalData.gCommandLineDefines)
+ for MacroName in MacroDict:
+ if MacroDict[MacroName] != "":
+ MacroList.append('"%s=%s"' % (MacroName, MacroDict[MacroName].replace('\\', '\\\\')))
+ else:
+ MacroList.append('"%s"' % MacroName)
+ else:
+ FdfFileList = []
+
+ # pass extra common options to external program called in makefile, currently GenFds.exe
+ ExtraOption = ''
+ LogLevel = EdkLogger.GetLevel()
+ if LogLevel == EdkLogger.VERBOSE:
+ ExtraOption += " -v"
+ elif LogLevel <= EdkLogger.DEBUG_9:
+ ExtraOption += " -d %d" % (LogLevel - 1)
+ elif LogLevel == EdkLogger.QUIET:
+ ExtraOption += " -q"
+
+ if GlobalData.gCaseInsensitive:
+ ExtraOption += " -c"
+ if not GlobalData.gEnableGenfdsMultiThread:
+ ExtraOption += " --no-genfds-multi-thread"
+ if GlobalData.gIgnoreSource:
+ ExtraOption += " --ignore-sources"
+
+ for pcd in GlobalData.BuildOptionPcd:
+ if pcd[2]:
+ pcdname = '.'.join(pcd[0:3])
+ else:
+ pcdname = '.'.join(pcd[0:2])
+ if pcd[3].startswith('{'):
+ ExtraOption += " --pcd " + pcdname + '=' + 'H' + '"' + pcd[3] + '"'
+ else:
+ ExtraOption += " --pcd " + pcdname + '=' + pcd[3]
+
+ MakefileName = self.getMakefileName()
+ SubBuildCommandList = []
+ for A in MyAgo.ArchList:
+ Command = self._MAKE_TEMPLATE_[self._Platform] % {"file":os.path.join("$(BUILD_DIR)", A, MakefileName)}
+ SubBuildCommandList.append(Command)
+
+ MakefileTemplateDict = {
+ "makefile_header" : self._FILE_HEADER_[self._FileType],
+ "makefile_path" : os.path.join("$(BUILD_DIR)", MakefileName),
+ "make_path" : MyAgo.ToolDefinition["MAKE"]["PATH"],
+ "platform_name" : MyAgo.Name,
+ "platform_guid" : MyAgo.Guid,
+ "platform_version" : MyAgo.Version,
+ "platform_build_directory" : MyAgo.BuildDir,
+ "conf_directory" : GlobalData.gConfDirectory,
+
+ "toolchain_tag" : MyAgo.ToolChain,
+ "build_target" : MyAgo.BuildTarget,
+ "shell_command_code" : list(self._SHELL_CMD_[self._Platform].keys()),
+ "shell_command" : list(self._SHELL_CMD_[self._Platform].values()),
+ 'arch' : list(MyAgo.ArchList),
+ "build_architecture_list" : ','.join(MyAgo.ArchList),
+ "separator" : Separator,
+ "create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList),
+ "cleanall_command" : self.GetRemoveDirectoryCommand(self.IntermediateDirectoryList),
+ "sub_build_command" : SubBuildCommandList,
+ "fdf_file" : FdfFileList,
+ "active_platform" : str(MyAgo),
+ "fd" : MyAgo.FdTargetList,
+ "fv" : MyAgo.FvTargetList,
+ "cap" : MyAgo.CapTargetList,
+ "extra_options" : ExtraOption,
+ "macro" : MacroList,
+ }
+
+ return MakefileTemplateDict
+
+ ## Get the root directory list for intermediate files of all modules build
+ #
+ # @retval list The list of directory
+ #
+ def GetModuleBuildDirectoryList(self):
+ DirList = []
+ for ModuleAutoGen in self._AutoGenObject.ModuleAutoGenList:
+ if not ModuleAutoGen.IsBinaryModule:
+ DirList.append(os.path.join(self._AutoGenObject.BuildDir, ModuleAutoGen.BuildDir))
+ return DirList
+
+ ## Get the root directory list for intermediate files of all libraries build
+ #
+ # @retval list The list of directory
+ #
+ def GetLibraryBuildDirectoryList(self):
+ DirList = []
+ for LibraryAutoGen in self._AutoGenObject.LibraryAutoGenList:
+ if not LibraryAutoGen.IsBinaryModule:
+ DirList.append(os.path.join(self._AutoGenObject.BuildDir, LibraryAutoGen.BuildDir))
+ return DirList
+
+## Find dependencies for one source file
+#
+# By searching recursively "#include" directive in file, find out all the
+# files needed by given source file. The dependencies will be only searched
+# in given search path list.
+#
+# @param File The source file
+# @param ForceInculeList The list of files which will be included forcely
+# @param SearchPathList The list of search path
+#
+# @retval list The list of files the given source file depends on
+#
+def GetDependencyList(AutoGenObject, FileCache, File, ForceList, SearchPathList):
+ EdkLogger.debug(EdkLogger.DEBUG_1, "Try to get dependency files for %s" % File)
+ FileStack = [File] + ForceList
+ DependencySet = set()
+
+ if AutoGenObject.Arch not in gDependencyDatabase:
+ gDependencyDatabase[AutoGenObject.Arch] = {}
+ DepDb = gDependencyDatabase[AutoGenObject.Arch]
+
+ while len(FileStack) > 0:
+ F = FileStack.pop()
+
+ FullPathDependList = []
+ if F in FileCache:
+ for CacheFile in FileCache[F]:
+ FullPathDependList.append(CacheFile)
+ if CacheFile not in DependencySet:
+ FileStack.append(CacheFile)
+ DependencySet.update(FullPathDependList)
+ continue
+
+ CurrentFileDependencyList = []
+ if F in DepDb:
+ CurrentFileDependencyList = DepDb[F]
+ else:
+ try:
+ Fd = open(F.Path, 'rb')
+ FileContent = Fd.read()
+ Fd.close()
+ except BaseException as X:
+ EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=F.Path + "\n\t" + str(X))
+ if len(FileContent) == 0:
+ continue
+ try:
+ if FileContent[0] == 0xff or FileContent[0] == 0xfe:
+ FileContent = FileContent.decode('utf-16')
+ else:
+ FileContent = FileContent.decode()
+ except:
+ # The file is not txt file. for example .mcb file
+ continue
+ IncludedFileList = gIncludePattern.findall(FileContent)
+
+ for Inc in IncludedFileList:
+ Inc = Inc.strip()
+ # if there's macro used to reference header file, expand it
+ HeaderList = gMacroPattern.findall(Inc)
+ if len(HeaderList) == 1 and len(HeaderList[0]) == 2:
+ HeaderType = HeaderList[0][0]
+ HeaderKey = HeaderList[0][1]
+ if HeaderType in gIncludeMacroConversion:
+ Inc = gIncludeMacroConversion[HeaderType] % {"HeaderKey" : HeaderKey}
+ else:
+ # not known macro used in #include, always build the file by
+ # returning a empty dependency
+ FileCache[File] = []
+ return []
+ Inc = os.path.normpath(Inc)
+ CurrentFileDependencyList.append(Inc)
+ DepDb[F] = CurrentFileDependencyList
+
+ CurrentFilePath = F.Dir
+ PathList = [CurrentFilePath] + SearchPathList
+ for Inc in CurrentFileDependencyList:
+ for SearchPath in PathList:
+ FilePath = os.path.join(SearchPath, Inc)
+ if FilePath in gIsFileMap:
+ if not gIsFileMap[FilePath]:
+ continue
+ # If isfile is called too many times, the performance is slow down.
+ elif not os.path.isfile(FilePath):
+ gIsFileMap[FilePath] = False
+ continue
+ else:
+ gIsFileMap[FilePath] = True
+ FilePath = PathClass(FilePath)
+ FullPathDependList.append(FilePath)
+ if FilePath not in DependencySet:
+ FileStack.append(FilePath)
+ break
+ else:
+ EdkLogger.debug(EdkLogger.DEBUG_9, "%s included by %s was not found "\
+ "in any given path:\n\t%s" % (Inc, F, "\n\t".join(SearchPathList)))
+
+ FileCache[F] = FullPathDependList
+ DependencySet.update(FullPathDependList)
+
+ DependencySet.update(ForceList)
+ if File in DependencySet:
+ DependencySet.remove(File)
+ DependencyList = list(DependencySet) # remove duplicate ones
+
+ return DependencyList
+
+# This acts like the main() function for the script, unless it is 'import'ed into another script.
+if __name__ == '__main__':
+ pass
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/roms/edk2/BaseTools/Source/Python/AutoGen/GenPcdDb.py
new file mode 100644
index 000000000..0870c4414
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -0,0 +1,1615 @@
+## @file
+# Routines for generating Pcd Database
+#
+# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+from __future__ import absolute_import
+from io import BytesIO
+from Common.Misc import *
+from Common.StringUtils import StringToArray
+from struct import pack
+from .ValidCheckingInfoObject import VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER
+from .ValidCheckingInfoObject import VAR_CHECK_PCD_VARIABLE_TAB
+from .ValidCheckingInfoObject import GetValidationObject
+from Common.VariableAttributes import VariableAttributes
+import copy
+from struct import unpack
+from Common.DataType import *
+from Common import GlobalData
+from Common import EdkLogger
+import Common.LongFilePathOs as os
+
+DATABASE_VERSION = 7
+
+gPcdDatabaseAutoGenC = TemplateString("""
+//
+// External PCD database debug information
+//
+#if 0
+${PHASE}_PCD_DATABASE_INIT g${PHASE}PcdDbInit = {
+ /* SkuIdTable */
+ { ${BEGIN}${SKUID_VALUE}, ${END} },
+${BEGIN} { ${INIT_VALUE_UINT64} }, /* ${INIT_CNAME_DECL_UINT64}_${INIT_GUID_DECL_UINT64}[${INIT_NUMSKUS_DECL_UINT64}] */
+${END}
+${BEGIN} ${VARDEF_VALUE_UINT64}, /* ${VARDEF_CNAME_UINT64}_${VARDEF_GUID_UINT64}_VariableDefault_${VARDEF_SKUID_UINT64} */
+${END}
+${BEGIN} { ${INIT_VALUE_UINT32} }, /* ${INIT_CNAME_DECL_UINT32}_${INIT_GUID_DECL_UINT32}[${INIT_NUMSKUS_DECL_UINT32}] */
+${END}
+${BEGIN} ${VARDEF_VALUE_UINT32}, /* ${VARDEF_CNAME_UINT32}_${VARDEF_GUID_UINT32}_VariableDefault_${VARDEF_SKUID_UINT32} */
+${END}
+ /* VPD */
+${BEGIN} { ${VPD_HEAD_VALUE} }, /* ${VPD_HEAD_CNAME_DECL}_${VPD_HEAD_GUID_DECL}[${VPD_HEAD_NUMSKUS_DECL}] */
+${END}
+ /* ExMapTable */
+ {
+${BEGIN} { ${EXMAPPING_TABLE_EXTOKEN}, ${EXMAPPING_TABLE_LOCAL_TOKEN}, ${EXMAPPING_TABLE_GUID_INDEX} },
+${END}
+ },
+ /* LocalTokenNumberTable */
+ {
+${BEGIN} offsetof(${PHASE}_PCD_DATABASE, ${TOKEN_INIT}.${TOKEN_CNAME}_${TOKEN_GUID}${VARDEF_HEADER}) | ${TOKEN_TYPE},
+${END}
+ },
+ /* GuidTable */
+ {
+${BEGIN} ${GUID_STRUCTURE},
+${END}
+ },
+${BEGIN} { ${STRING_HEAD_VALUE} }, /* ${STRING_HEAD_CNAME_DECL}_${STRING_HEAD_GUID_DECL}[${STRING_HEAD_NUMSKUS_DECL}] */
+${END}
+${BEGIN} /* ${VARIABLE_HEAD_CNAME_DECL}_${VARIABLE_HEAD_GUID_DECL}_Variable_Header[${VARIABLE_HEAD_NUMSKUS_DECL}] */
+ {
+ ${VARIABLE_HEAD_VALUE}
+ },
+${END}
+/* SkuHead */
+ {
+ ${BEGIN} offsetof (${PHASE}_PCD_DATABASE, ${TOKEN_INIT}.${TOKEN_CNAME}_${TOKEN_GUID}${VARDEF_HEADER}) | ${TOKEN_TYPE}, /* */
+ offsetof (${PHASE}_PCD_DATABASE, ${TOKEN_INIT}.SkuHead) /* */
+ ${END}
+ },
+ /* StringTable */
+${BEGIN} ${STRING_TABLE_VALUE}, /* ${STRING_TABLE_CNAME}_${STRING_TABLE_GUID} */
+${END}
+ /* SizeTable */
+ {
+${BEGIN} ${SIZE_TABLE_MAXIMUM_LENGTH}, ${SIZE_TABLE_CURRENT_LENGTH}, /* ${SIZE_TABLE_CNAME}_${SIZE_TABLE_GUID} */
+${END}
+ },
+${BEGIN} { ${INIT_VALUE_UINT16} }, /* ${INIT_CNAME_DECL_UINT16}_${INIT_GUID_DECL_UINT16}[${INIT_NUMSKUS_DECL_UINT16}] */
+${END}
+${BEGIN} ${VARDEF_VALUE_UINT16}, /* ${VARDEF_CNAME_UINT16}_${VARDEF_GUID_UINT16}_VariableDefault_${VARDEF_SKUID_UINT16} */
+${END}
+${BEGIN} { ${INIT_VALUE_UINT8} }, /* ${INIT_CNAME_DECL_UINT8}_${INIT_GUID_DECL_UINT8}[${INIT_NUMSKUS_DECL_UINT8}] */
+${END}
+${BEGIN} ${VARDEF_VALUE_UINT8}, /* ${VARDEF_CNAME_UINT8}_${VARDEF_GUID_UINT8}_VariableDefault_${VARDEF_SKUID_UINT8} */
+${END}
+${BEGIN} { ${INIT_VALUE_BOOLEAN} }, /* ${INIT_CNAME_DECL_BOOLEAN}_${INIT_GUID_DECL_BOOLEAN}[${INIT_NUMSKUS_DECL_BOOLEAN}] */
+${END}
+${BEGIN} ${VARDEF_VALUE_BOOLEAN}, /* ${VARDEF_CNAME_BOOLEAN}_${VARDEF_GUID_BOOLEAN}_VariableDefault_${VARDEF_SKUID_BOOLEAN} */
+${END}
+ ${SYSTEM_SKU_ID_VALUE}
+};
+#endif
+""")
+
+## Mapping between PCD driver type and EFI phase
+gPcdPhaseMap = {
+ "PEI_PCD_DRIVER" : "PEI",
+ "DXE_PCD_DRIVER" : "DXE"
+}
+
+gPcdDatabaseAutoGenH = TemplateString("""
+#define PCD_${PHASE}_SERVICE_DRIVER_VERSION ${SERVICE_DRIVER_VERSION}
+
+//
+// External PCD database debug information
+//
+#if 0
+#define ${PHASE}_GUID_TABLE_SIZE ${GUID_TABLE_SIZE}
+#define ${PHASE}_STRING_TABLE_SIZE ${STRING_TABLE_SIZE}
+#define ${PHASE}_SKUID_TABLE_SIZE ${SKUID_TABLE_SIZE}
+#define ${PHASE}_LOCAL_TOKEN_NUMBER_TABLE_SIZE ${LOCAL_TOKEN_NUMBER_TABLE_SIZE}
+#define ${PHASE}_LOCAL_TOKEN_NUMBER ${LOCAL_TOKEN_NUMBER}
+#define ${PHASE}_EXMAPPING_TABLE_SIZE ${EXMAPPING_TABLE_SIZE}
+#define ${PHASE}_EX_TOKEN_NUMBER ${EX_TOKEN_NUMBER}
+#define ${PHASE}_SIZE_TABLE_SIZE ${SIZE_TABLE_SIZE}
+#define ${PHASE}_GUID_TABLE_EMPTY ${GUID_TABLE_EMPTY}
+#define ${PHASE}_STRING_TABLE_EMPTY ${STRING_TABLE_EMPTY}
+#define ${PHASE}_SKUID_TABLE_EMPTY ${SKUID_TABLE_EMPTY}
+#define ${PHASE}_DATABASE_EMPTY ${DATABASE_EMPTY}
+#define ${PHASE}_EXMAP_TABLE_EMPTY ${EXMAP_TABLE_EMPTY}
+
+typedef struct {
+ UINT64 SkuIdTable[${PHASE}_SKUID_TABLE_SIZE];
+${BEGIN} UINT64 ${INIT_CNAME_DECL_UINT64}_${INIT_GUID_DECL_UINT64}[${INIT_NUMSKUS_DECL_UINT64}];
+${END}
+${BEGIN} UINT64 ${VARDEF_CNAME_UINT64}_${VARDEF_GUID_UINT64}_VariableDefault_${VARDEF_SKUID_UINT64};
+${END}
+${BEGIN} UINT32 ${INIT_CNAME_DECL_UINT32}_${INIT_GUID_DECL_UINT32}[${INIT_NUMSKUS_DECL_UINT32}];
+${END}
+${BEGIN} UINT32 ${VARDEF_CNAME_UINT32}_${VARDEF_GUID_UINT32}_VariableDefault_${VARDEF_SKUID_UINT32};
+${END}
+${BEGIN} VPD_HEAD ${VPD_HEAD_CNAME_DECL}_${VPD_HEAD_GUID_DECL}[${VPD_HEAD_NUMSKUS_DECL}];
+${END}
+ DYNAMICEX_MAPPING ExMapTable[${PHASE}_EXMAPPING_TABLE_SIZE];
+ UINT32 LocalTokenNumberTable[${PHASE}_LOCAL_TOKEN_NUMBER_TABLE_SIZE];
+ GUID GuidTable[${PHASE}_GUID_TABLE_SIZE];
+${BEGIN} STRING_HEAD ${STRING_HEAD_CNAME_DECL}_${STRING_HEAD_GUID_DECL}[${STRING_HEAD_NUMSKUS_DECL}];
+${END}
+${BEGIN} VARIABLE_HEAD ${VARIABLE_HEAD_CNAME_DECL}_${VARIABLE_HEAD_GUID_DECL}_Variable_Header[${VARIABLE_HEAD_NUMSKUS_DECL}];
+${BEGIN} UINT8 StringTable${STRING_TABLE_INDEX}[${STRING_TABLE_LENGTH}]; /* ${STRING_TABLE_CNAME}_${STRING_TABLE_GUID} */
+${END}
+ SIZE_INFO SizeTable[${PHASE}_SIZE_TABLE_SIZE];
+${BEGIN} UINT16 ${INIT_CNAME_DECL_UINT16}_${INIT_GUID_DECL_UINT16}[${INIT_NUMSKUS_DECL_UINT16}];
+${END}
+${BEGIN} UINT16 ${VARDEF_CNAME_UINT16}_${VARDEF_GUID_UINT16}_VariableDefault_${VARDEF_SKUID_UINT16};
+${END}
+${BEGIN} UINT8 ${INIT_CNAME_DECL_UINT8}_${INIT_GUID_DECL_UINT8}[${INIT_NUMSKUS_DECL_UINT8}];
+${END}
+${BEGIN} UINT8 ${VARDEF_CNAME_UINT8}_${VARDEF_GUID_UINT8}_VariableDefault_${VARDEF_SKUID_UINT8};
+${END}
+${BEGIN} BOOLEAN ${INIT_CNAME_DECL_BOOLEAN}_${INIT_GUID_DECL_BOOLEAN}[${INIT_NUMSKUS_DECL_BOOLEAN}];
+${END}
+${BEGIN} BOOLEAN ${VARDEF_CNAME_BOOLEAN}_${VARDEF_GUID_BOOLEAN}_VariableDefault_${VARDEF_SKUID_BOOLEAN};
+${END}
+${SYSTEM_SKU_ID}
+} ${PHASE}_PCD_DATABASE_INIT;
+
+typedef struct {
+${PCD_DATABASE_UNINIT_EMPTY}
+${BEGIN} UINT64 ${UNINIT_CNAME_DECL_UINT64}_${UNINIT_GUID_DECL_UINT64}[${UNINIT_NUMSKUS_DECL_UINT64}];
+${END}
+${BEGIN} UINT32 ${UNINIT_CNAME_DECL_UINT32}_${UNINIT_GUID_DECL_UINT32}[${UNINIT_NUMSKUS_DECL_UINT32}];
+${END}
+${BEGIN} UINT16 ${UNINIT_CNAME_DECL_UINT16}_${UNINIT_GUID_DECL_UINT16}[${UNINIT_NUMSKUS_DECL_UINT16}];
+${END}
+${BEGIN} UINT8 ${UNINIT_CNAME_DECL_UINT8}_${UNINIT_GUID_DECL_UINT8}[${UNINIT_NUMSKUS_DECL_UINT8}];
+${END}
+${BEGIN} BOOLEAN ${UNINIT_CNAME_DECL_BOOLEAN}_${UNINIT_GUID_DECL_BOOLEAN}[${UNINIT_NUMSKUS_DECL_BOOLEAN}];
+${END}
+} ${PHASE}_PCD_DATABASE_UNINIT;
+
+typedef struct {
+ //GUID Signature; // PcdDataBaseGuid
+ //UINT32 BuildVersion;
+ //UINT32 Length;
+ //SKU_ID SystemSkuId; // Current SkuId value.
+ //UINT32 LengthForAllSkus; // Length of all SKU PCD DB
+ //UINT32 UninitDataBaseSize;// Total size for PCD those default value with 0.
+ //TABLE_OFFSET LocalTokenNumberTableOffset;
+ //TABLE_OFFSET ExMapTableOffset;
+ //TABLE_OFFSET GuidTableOffset;
+ //TABLE_OFFSET StringTableOffset;
+ //TABLE_OFFSET SizeTableOffset;
+ //TABLE_OFFSET SkuIdTableOffset;
+ //TABLE_OFFSET PcdNameTableOffset;
+ //UINT16 LocalTokenCount; // LOCAL_TOKEN_NUMBER for all
+ //UINT16 ExTokenCount; // EX_TOKEN_NUMBER for DynamicEx
+ //UINT16 GuidTableCount; // The Number of Guid in GuidTable
+ //UINT8 Pad[6];
+ ${PHASE}_PCD_DATABASE_INIT Init;
+ ${PHASE}_PCD_DATABASE_UNINIT Uninit;
+} ${PHASE}_PCD_DATABASE;
+
+#define ${PHASE}_NEX_TOKEN_NUMBER (${PHASE}_LOCAL_TOKEN_NUMBER - ${PHASE}_EX_TOKEN_NUMBER)
+#endif
+""")
+
+
+gEmptyPcdDatabaseAutoGenC = TemplateString("""
+//
+// External PCD database debug information
+//
+#if 0
+${PHASE}_PCD_DATABASE_INIT g${PHASE}PcdDbInit = {
+ /* SkuIdTable */
+ { 0 },
+ /* ExMapTable */
+ {
+ {0, 0, 0}
+ },
+ /* LocalTokenNumberTable */
+ {
+ 0
+ },
+ /* GuidTable */
+ {
+ {0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}
+ },
+ /* StringTable */
+ { 0 },
+ /* SkuHead */
+ {
+ 0, 0
+ },
+ /* SizeTable */
+ {
+ 0, 0
+ },
+ ${SYSTEM_SKU_ID_VALUE}
+};
+#endif
+""")
+
+## DbItemList
+#
+# The class holds the Pcd database items. ItemSize if not zero should match the item datum type in the C structure.
+# When the structure is changed, remember to check the ItemSize and the related PackStr in PackData()
+# RawDataList is the RawData that may need some kind of calculation or transformation,
+# the DataList corresponds to the data that need to be written to database. If DataList is not present, then RawDataList
+# will be written to the database.
+#
+class DbItemList:
+ def __init__(self, ItemSize, DataList=None, RawDataList=None):
+ self.ItemSize = ItemSize
+ self.DataList = DataList if DataList else []
+ self.RawDataList = RawDataList if RawDataList else []
+ self.ListSize = 0
+
+ def GetInterOffset(self, Index):
+ Offset = 0
+ if self.ItemSize == 0:
+ #
+ # Variable length, need to calculate one by one
+ #
+ assert(Index < len(self.RawDataList))
+ for ItemIndex in range(Index):
+ Offset += len(self.RawDataList[ItemIndex])
+ else:
+ Offset = self.ItemSize * Index
+
+ return Offset
+
+ def GetListSize(self):
+ if self.ListSize:
+ return self.ListSize
+ if len(self.RawDataList) == 0:
+ self.ListSize = 0
+ return self.ListSize
+ if self.ItemSize == 0:
+ self.ListSize = self.GetInterOffset(len(self.RawDataList) - 1) + len(self.RawDataList[len(self.RawDataList)-1])
+ else:
+ self.ListSize = self.ItemSize * len(self.RawDataList)
+ return self.ListSize
+
+ def PackData(self):
+ ## PackGuid
+ #
+ # Pack the GUID value in C structure format into data array
+ #
+ # @param GuidStructureValue: The GUID value in C structure format
+ #
+ # @retval Buffer: a data array contains the Guid
+ #
+ def PackGuid(GuidStructureValue):
+ GuidString = GuidStructureStringToGuidString(GuidStructureValue)
+ return PackGUID(GuidString.split('-'))
+
+ PackStr = PACK_CODE_BY_SIZE[self.ItemSize]
+
+ Buffer = bytearray()
+ for Datas in self.RawDataList:
+ if type(Datas) in (list, tuple):
+ for Data in Datas:
+ if PackStr:
+ Buffer += pack(PackStr, GetIntegerValue(Data))
+ else:
+ Buffer += PackGuid(Data)
+ else:
+ if PackStr:
+ Buffer += pack(PackStr, GetIntegerValue(Datas))
+ else:
+ Buffer += PackGuid(Datas)
+
+ return Buffer
+
+## DbExMapTblItemList
+#
+# The class holds the ExMap table
+#
+class DbExMapTblItemList (DbItemList):
+ def __init__(self, ItemSize, DataList=None, RawDataList=None):
+ DbItemList.__init__(self, ItemSize, DataList, RawDataList)
+
+ def PackData(self):
+ Buffer = bytearray()
+ PackStr = "=LHH"
+ for Datas in self.RawDataList:
+ Buffer += pack(PackStr,
+ GetIntegerValue(Datas[0]),
+ GetIntegerValue(Datas[1]),
+ GetIntegerValue(Datas[2]))
+ return Buffer
+
+## DbComItemList
+#
+# The DbComItemList is a special kind of DbItemList in case that the size of the List can not be computed by the
+# ItemSize multiply the ItemCount.
+#
+class DbComItemList (DbItemList):
+ def __init__(self, ItemSize, DataList=None, RawDataList=None):
+ DbItemList.__init__(self, ItemSize, DataList, RawDataList)
+
+ def GetInterOffset(self, Index):
+ Offset = 0
+ if self.ItemSize == 0:
+ #
+ # Variable length, need to calculate one by one
+ # The only variable table is stringtable, it is not Composite item, should not reach here
+ #
+ assert(False)
+ else:
+ assert(Index < len(self.RawDataList))
+ for ItemIndex in range(Index):
+ Offset += len(self.RawDataList[ItemIndex]) * self.ItemSize
+
+ return Offset
+
+ def GetListSize(self):
+ if self.ListSize:
+ return self.ListSize
+ if self.ItemSize == 0:
+ assert(False)
+ else:
+ if len(self.RawDataList) == 0:
+ self.ListSize = 0
+ else:
+ self.ListSize = self.GetInterOffset(len(self.RawDataList) - 1) + len(self.RawDataList[len(self.RawDataList)-1]) * self.ItemSize
+
+ return self.ListSize
+
+ def PackData(self):
+ PackStr = PACK_CODE_BY_SIZE[self.ItemSize]
+
+ Buffer = bytearray()
+ for DataList in self.RawDataList:
+ for Data in DataList:
+ if type(Data) in (list, tuple):
+ for SingleData in Data:
+ Buffer += pack(PackStr, GetIntegerValue(SingleData))
+ else:
+ Buffer += pack(PackStr, GetIntegerValue(Data))
+
+ return Buffer
+
+## DbVariableTableItemList
+#
+# The class holds the Variable header value table
+#
+class DbVariableTableItemList (DbComItemList):
+ def __init__(self, ItemSize, DataList=None, RawDataList=None):
+ DbComItemList.__init__(self, ItemSize, DataList, RawDataList)
+
+ def PackData(self):
+ PackStr = "=LLHHLHH"
+ Buffer = bytearray()
+ for DataList in self.RawDataList:
+ for Data in DataList:
+ Buffer += pack(PackStr,
+ GetIntegerValue(Data[0]),
+ GetIntegerValue(Data[1]),
+ GetIntegerValue(Data[2]),
+ GetIntegerValue(Data[3]),
+ GetIntegerValue(Data[4]),
+ GetIntegerValue(Data[5]),
+ GetIntegerValue(0))
+ return Buffer
+
+class DbStringHeadTableItemList(DbItemList):
+ def __init__(self,ItemSize,DataList=None,RawDataList=None):
+ DbItemList.__init__(self, ItemSize, DataList, RawDataList)
+
+ def GetInterOffset(self, Index):
+ Offset = 0
+ if self.ItemSize == 0:
+ #
+ # Variable length, need to calculate one by one
+ #
+ assert(Index < len(self.RawDataList))
+ for ItemIndex in range(Index):
+ Offset += len(self.RawDataList[ItemIndex])
+ else:
+ for innerIndex in range(Index):
+ if type(self.RawDataList[innerIndex]) in (list, tuple):
+ Offset += len(self.RawDataList[innerIndex]) * self.ItemSize
+ else:
+ Offset += self.ItemSize
+
+ return Offset
+
+ def GetListSize(self):
+ if self.ListSize:
+ return self.ListSize
+ if len(self.RawDataList) == 0:
+ self.ListSize = 0
+ return self.ListSize
+ if self.ItemSize == 0:
+ self.ListSize = self.GetInterOffset(len(self.RawDataList) - 1) + len(self.RawDataList[len(self.RawDataList)-1])
+ else:
+ for Datas in self.RawDataList:
+ if type(Datas) in (list, tuple):
+ self.ListSize += len(Datas) * self.ItemSize
+ else:
+ self.ListSize += self.ItemSize
+ return self.ListSize
+
+## DbSkuHeadTableItemList
+#
+# The class holds the Sku header value table
+#
+class DbSkuHeadTableItemList (DbItemList):
+ def __init__(self, ItemSize, DataList=None, RawDataList=None):
+ DbItemList.__init__(self, ItemSize, DataList, RawDataList)
+
+ def PackData(self):
+ PackStr = "=LL"
+ Buffer = bytearray()
+ for Data in self.RawDataList:
+ Buffer += pack(PackStr,
+ GetIntegerValue(Data[0]),
+ GetIntegerValue(Data[1]))
+ return Buffer
+
+## DbSizeTableItemList
+#
+# The class holds the size table
+#
+class DbSizeTableItemList (DbItemList):
+ def __init__(self, ItemSize, DataList=None, RawDataList=None):
+ DbItemList.__init__(self, ItemSize, DataList, RawDataList)
+
+ def GetListSize(self):
+ length = 0
+ for Data in self.RawDataList:
+ length += (1 + len(Data[1]))
+ return length * self.ItemSize
+ def PackData(self):
+ PackStr = "=H"
+ Buffer = bytearray()
+ for Data in self.RawDataList:
+ Buffer += pack(PackStr,
+ GetIntegerValue(Data[0]))
+ for subData in Data[1]:
+ Buffer += pack(PackStr,
+ GetIntegerValue(subData))
+ return Buffer
+
+## DbStringItemList
+#
+# The class holds the string table
+#
+class DbStringItemList (DbComItemList):
+ def __init__(self, ItemSize, DataList=None, RawDataList=None, LenList=None):
+ if DataList is None:
+ DataList = []
+ if RawDataList is None:
+ RawDataList = []
+ if LenList is None:
+ LenList = []
+
+ assert(len(RawDataList) == len(LenList))
+ DataList = []
+ # adjust DataList according to the LenList
+ for Index in range(len(RawDataList)):
+ Len = LenList[Index]
+ RawDatas = RawDataList[Index]
+ assert(Len >= len(RawDatas))
+ ActualDatas = []
+ for i in range(len(RawDatas)):
+ ActualDatas.append(RawDatas[i])
+ for i in range(len(RawDatas), Len):
+ ActualDatas.append(0)
+ DataList.append(ActualDatas)
+ self.LenList = LenList
+ DbComItemList.__init__(self, ItemSize, DataList, RawDataList)
+ def GetInterOffset(self, Index):
+ Offset = 0
+
+ assert(Index < len(self.LenList))
+ for ItemIndex in range(Index):
+ Offset += self.LenList[ItemIndex]
+
+ return Offset
+
+ def GetListSize(self):
+ if self.ListSize:
+ return self.ListSize
+
+ if len(self.LenList) == 0:
+ self.ListSize = 0
+ else:
+ self.ListSize = self.GetInterOffset(len(self.LenList) - 1) + self.LenList[len(self.LenList)-1]
+
+ return self.ListSize
+
+ def PackData(self):
+ self.RawDataList = self.DataList
+ return DbComItemList.PackData(self)
+
+
+
+## Find the index in two list where the item matches the key separately
+#
+# @param Key1 The key used to search the List1
+# @param List1 The list that Key1 will be searched
+# @param Key2 The key used to search the List2
+# @param List2 The list that Key2 will be searched
+#
+# @retval Index The position inside the list where list1[Index] == Key1 and list2[Index] == Key2
+#
+def GetMatchedIndex(Key1, List1, Key2, List2):
+ StartPos = 0
+ while StartPos < len(List1):
+ Index = List1.index(Key1, StartPos)
+ if List2[Index] == Key2:
+ return Index
+ else:
+ StartPos = Index + 1
+
+ return -1
+
+
+## convert StringArray like {0x36, 0x00, 0x34, 0x00, 0x21, 0x00, 0x36, 0x00, 0x34, 0x00, 0x00, 0x00}
+# to List like [0x36, 0x00, 0x34, 0x00, 0x21, 0x00, 0x36, 0x00, 0x34, 0x00, 0x00, 0x00]
+#
+# @param StringArray A string array like {0x36, 0x00, 0x34, 0x00, 0x21, 0x00, 0x36, 0x00, 0x34, 0x00, 0x00, 0x00}
+#
+# @retval A list object of integer items
+#
+def StringArrayToList(StringArray):
+ StringArray = StringArray[1:-1]
+ StringArray = '[' + StringArray + ']'
+ return eval(StringArray)
+
+
+## Convert TokenType String like "PCD_DATUM_TYPE_UINT32 | PCD_TYPE_HII" to TokenType value
+#
+# @param TokenType A TokenType string like "PCD_DATUM_TYPE_UINT32 | PCD_TYPE_HII"
+#
+# @retval A integer representation of the TokenType
+#
+def GetTokenTypeValue(TokenType):
+ TokenTypeDict = {
+ "PCD_TYPE_SHIFT": 28,
+ "PCD_TYPE_DATA": (0x0 << 28),
+ "PCD_TYPE_HII": (0x8 << 28),
+ "PCD_TYPE_VPD": (0x4 << 28),
+# "PCD_TYPE_SKU_ENABLED":(0x2 << 28),
+ "PCD_TYPE_STRING": (0x1 << 28),
+
+ "PCD_DATUM_TYPE_SHIFT": 24,
+ "PCD_DATUM_TYPE_POINTER": (0x0 << 24),
+ "PCD_DATUM_TYPE_UINT8": (0x1 << 24),
+ "PCD_DATUM_TYPE_UINT16": (0x2 << 24),
+ "PCD_DATUM_TYPE_UINT32": (0x4 << 24),
+ "PCD_DATUM_TYPE_UINT64": (0x8 << 24),
+
+ "PCD_DATUM_TYPE_SHIFT2": 20,
+ "PCD_DATUM_TYPE_UINT8_BOOLEAN": (0x1 << 20 | 0x1 << 24),
+ }
+ return eval(TokenType, TokenTypeDict)
+
+## construct the external Pcd database using data from Dict
+#
+# @param Dict A dictionary contains Pcd related tables
+#
+# @retval Buffer A byte stream of the Pcd database
+#
+def BuildExDataBase(Dict):
+ # init Db items
+ InitValueUint64 = Dict['INIT_DB_VALUE_UINT64']
+ DbInitValueUint64 = DbComItemList(8, RawDataList = InitValueUint64)
+ VardefValueUint64 = Dict['VARDEF_DB_VALUE_UINT64']
+ DbVardefValueUint64 = DbItemList(8, RawDataList = VardefValueUint64)
+ InitValueUint32 = Dict['INIT_DB_VALUE_UINT32']
+ DbInitValueUint32 = DbComItemList(4, RawDataList = InitValueUint32)
+ VardefValueUint32 = Dict['VARDEF_DB_VALUE_UINT32']
+ DbVardefValueUint32 = DbItemList(4, RawDataList = VardefValueUint32)
+ VpdHeadValue = Dict['VPD_DB_VALUE']
+ DbVpdHeadValue = DbComItemList(4, RawDataList = VpdHeadValue)
+ ExMapTable = list(zip(Dict['EXMAPPING_TABLE_EXTOKEN'], Dict['EXMAPPING_TABLE_LOCAL_TOKEN'], Dict['EXMAPPING_TABLE_GUID_INDEX']))
+ DbExMapTable = DbExMapTblItemList(8, RawDataList = ExMapTable)
+ LocalTokenNumberTable = Dict['LOCAL_TOKEN_NUMBER_DB_VALUE']
+ DbLocalTokenNumberTable = DbItemList(4, RawDataList = LocalTokenNumberTable)
+ GuidTable = Dict['GUID_STRUCTURE']
+ DbGuidTable = DbItemList(16, RawDataList = GuidTable)
+ StringHeadValue = Dict['STRING_DB_VALUE']
+ # DbItemList to DbStringHeadTableItemList
+ DbStringHeadValue = DbStringHeadTableItemList(4, RawDataList = StringHeadValue)
+ VariableTable = Dict['VARIABLE_DB_VALUE']
+ DbVariableTable = DbVariableTableItemList(20, RawDataList = VariableTable)
+ NumberOfSkuEnabledPcd = GetIntegerValue(Dict['SKU_HEAD_SIZE'])
+
+ Dict['STRING_TABLE_DB_VALUE'] = [StringArrayToList(x) for x in Dict['STRING_TABLE_VALUE']]
+
+ StringTableValue = Dict['STRING_TABLE_DB_VALUE']
+ # when calcute the offset, should use StringTableLen instead of StringTableValue, as string maximum len may be different with actual len
+ StringTableLen = Dict['STRING_TABLE_LENGTH']
+ DbStringTableLen = DbStringItemList(0, RawDataList = StringTableValue, LenList = StringTableLen)
+
+
+ PcdTokenTable = Dict['PCD_TOKENSPACE']
+ PcdTokenLen = Dict['PCD_TOKENSPACE_LENGTH']
+ PcdTokenTableValue = [StringArrayToList(x) for x in Dict['PCD_TOKENSPACE']]
+ DbPcdTokenTable = DbStringItemList(0, RawDataList = PcdTokenTableValue, LenList = PcdTokenLen)
+
+ PcdCNameTable = Dict['PCD_CNAME']
+ PcdCNameLen = Dict['PCD_CNAME_LENGTH']
+ PcdCNameTableValue = [StringArrayToList(x) for x in Dict['PCD_CNAME']]
+ DbPcdCNameTable = DbStringItemList(0, RawDataList = PcdCNameTableValue, LenList = PcdCNameLen)
+
+ PcdNameOffsetTable = Dict['PCD_NAME_OFFSET']
+ DbPcdNameOffsetTable = DbItemList(4, RawDataList = PcdNameOffsetTable)
+
+ SizeTableValue = list(zip(Dict['SIZE_TABLE_MAXIMUM_LENGTH'], Dict['SIZE_TABLE_CURRENT_LENGTH']))
+ DbSizeTableValue = DbSizeTableItemList(2, RawDataList = SizeTableValue)
+ InitValueUint16 = Dict['INIT_DB_VALUE_UINT16']
+ DbInitValueUint16 = DbComItemList(2, RawDataList = InitValueUint16)
+ VardefValueUint16 = Dict['VARDEF_DB_VALUE_UINT16']
+ DbVardefValueUint16 = DbItemList(2, RawDataList = VardefValueUint16)
+ InitValueUint8 = Dict['INIT_DB_VALUE_UINT8']
+ DbInitValueUint8 = DbComItemList(1, RawDataList = InitValueUint8)
+ VardefValueUint8 = Dict['VARDEF_DB_VALUE_UINT8']
+ DbVardefValueUint8 = DbItemList(1, RawDataList = VardefValueUint8)
+ InitValueBoolean = Dict['INIT_DB_VALUE_BOOLEAN']
+ DbInitValueBoolean = DbComItemList(1, RawDataList = InitValueBoolean)
+ VardefValueBoolean = Dict['VARDEF_DB_VALUE_BOOLEAN']
+ DbVardefValueBoolean = DbItemList(1, RawDataList = VardefValueBoolean)
+ SkuidValue = Dict['SKUID_VALUE']
+ DbSkuidValue = DbItemList(8, RawDataList = SkuidValue)
+
+
+
+ # Unit Db Items
+ UnInitValueUint64 = Dict['UNINIT_GUID_DECL_UINT64']
+ DbUnInitValueUint64 = DbItemList(8, RawDataList = UnInitValueUint64)
+ UnInitValueUint32 = Dict['UNINIT_GUID_DECL_UINT32']
+ DbUnInitValueUint32 = DbItemList(4, RawDataList = UnInitValueUint32)
+ UnInitValueUint16 = Dict['UNINIT_GUID_DECL_UINT16']
+ DbUnInitValueUint16 = DbItemList(2, RawDataList = UnInitValueUint16)
+ UnInitValueUint8 = Dict['UNINIT_GUID_DECL_UINT8']
+ DbUnInitValueUint8 = DbItemList(1, RawDataList = UnInitValueUint8)
+ UnInitValueBoolean = Dict['UNINIT_GUID_DECL_BOOLEAN']
+ DbUnInitValueBoolean = DbItemList(1, RawDataList = UnInitValueBoolean)
+ PcdTokenNumberMap = Dict['PCD_ORDER_TOKEN_NUMBER_MAP']
+
+ DbNameTotle = ["SkuidValue", "InitValueUint64", "VardefValueUint64", "InitValueUint32", "VardefValueUint32", "VpdHeadValue", "ExMapTable",
+ "LocalTokenNumberTable", "GuidTable", "StringHeadValue", "PcdNameOffsetTable", "VariableTable", "StringTableLen", "PcdTokenTable", "PcdCNameTable",
+ "SizeTableValue", "InitValueUint16", "VardefValueUint16", "InitValueUint8", "VardefValueUint8", "InitValueBoolean",
+ "VardefValueBoolean", "UnInitValueUint64", "UnInitValueUint32", "UnInitValueUint16", "UnInitValueUint8", "UnInitValueBoolean"]
+
+ DbTotal = [SkuidValue, InitValueUint64, VardefValueUint64, InitValueUint32, VardefValueUint32, VpdHeadValue, ExMapTable,
+ LocalTokenNumberTable, GuidTable, StringHeadValue, PcdNameOffsetTable, VariableTable, StringTableLen, PcdTokenTable, PcdCNameTable,
+ SizeTableValue, InitValueUint16, VardefValueUint16, InitValueUint8, VardefValueUint8, InitValueBoolean,
+ VardefValueBoolean, UnInitValueUint64, UnInitValueUint32, UnInitValueUint16, UnInitValueUint8, UnInitValueBoolean]
+ DbItemTotal = [DbSkuidValue, DbInitValueUint64, DbVardefValueUint64, DbInitValueUint32, DbVardefValueUint32, DbVpdHeadValue, DbExMapTable,
+ DbLocalTokenNumberTable, DbGuidTable, DbStringHeadValue, DbPcdNameOffsetTable, DbVariableTable, DbStringTableLen, DbPcdTokenTable, DbPcdCNameTable,
+ DbSizeTableValue, DbInitValueUint16, DbVardefValueUint16, DbInitValueUint8, DbVardefValueUint8, DbInitValueBoolean,
+ DbVardefValueBoolean, DbUnInitValueUint64, DbUnInitValueUint32, DbUnInitValueUint16, DbUnInitValueUint8, DbUnInitValueBoolean]
+
+ # VardefValueBoolean is the last table in the init table items
+ InitTableNum = DbNameTotle.index("VardefValueBoolean") + 1
+ # The FixedHeader length of the PCD_DATABASE_INIT, from Signature to Pad
+ FixedHeaderLen = 80
+
+ # Get offset of SkuId table in the database
+ SkuIdTableOffset = FixedHeaderLen
+ for DbIndex in range(len(DbTotal)):
+ if DbTotal[DbIndex] is SkuidValue:
+ break
+ SkuIdTableOffset += DbItemTotal[DbIndex].GetListSize()
+
+
+ # Get offset of SkuValue table in the database
+
+ # Fix up the LocalTokenNumberTable, SkuHeader table
+ for (LocalTokenNumberTableIndex, (Offset, Table)) in enumerate(LocalTokenNumberTable):
+ DbIndex = 0
+ DbOffset = FixedHeaderLen
+ for DbIndex in range(len(DbTotal)):
+ if DbTotal[DbIndex] is Table:
+ DbOffset += DbItemTotal[DbIndex].GetInterOffset(Offset)
+ break
+ DbOffset += DbItemTotal[DbIndex].GetListSize()
+ if DbIndex + 1 == InitTableNum:
+ if DbOffset % 8:
+ DbOffset += (8 - DbOffset % 8)
+ else:
+ assert(False)
+
+ TokenTypeValue = Dict['TOKEN_TYPE'][LocalTokenNumberTableIndex]
+ TokenTypeValue = GetTokenTypeValue(TokenTypeValue)
+ LocalTokenNumberTable[LocalTokenNumberTableIndex] = DbOffset|int(TokenTypeValue)
+ # if PCD_TYPE_SKU_ENABLED, then we need to fix up the SkuTable
+
+
+
+
+ # resolve variable table offset
+ for VariableEntries in VariableTable:
+ skuindex = 0
+ for VariableEntryPerSku in VariableEntries:
+ (VariableHeadGuidIndex, VariableHeadStringIndex, SKUVariableOffset, VariableOffset, VariableRefTable, VariableAttribute) = VariableEntryPerSku[:]
+ DbIndex = 0
+ DbOffset = FixedHeaderLen
+ for DbIndex in range(len(DbTotal)):
+ if DbTotal[DbIndex] is VariableRefTable:
+ DbOffset += DbItemTotal[DbIndex].GetInterOffset(VariableOffset)
+ break
+ DbOffset += DbItemTotal[DbIndex].GetListSize()
+ if DbIndex + 1 == InitTableNum:
+ if DbOffset % 8:
+ DbOffset += (8 - DbOffset % 8)
+ else:
+ assert(False)
+ if isinstance(VariableRefTable[0], list):
+ DbOffset += skuindex * 4
+ skuindex += 1
+ if DbIndex >= InitTableNum:
+ assert(False)
+ VarAttr, VarProp = VariableAttributes.GetVarAttributes(VariableAttribute)
+ VariableEntryPerSku[:] = (VariableHeadStringIndex, DbOffset, VariableHeadGuidIndex, SKUVariableOffset, VarAttr, VarProp)
+
+ # calculate various table offset now
+ DbTotalLength = FixedHeaderLen
+ for DbIndex in range(len(DbItemTotal)):
+ if DbItemTotal[DbIndex] is DbLocalTokenNumberTable:
+ LocalTokenNumberTableOffset = DbTotalLength
+ elif DbItemTotal[DbIndex] is DbExMapTable:
+ ExMapTableOffset = DbTotalLength
+ elif DbItemTotal[DbIndex] is DbGuidTable:
+ GuidTableOffset = DbTotalLength
+ elif DbItemTotal[DbIndex] is DbStringTableLen:
+ StringTableOffset = DbTotalLength
+ elif DbItemTotal[DbIndex] is DbSizeTableValue:
+ SizeTableOffset = DbTotalLength
+ elif DbItemTotal[DbIndex] is DbSkuidValue:
+ SkuIdTableOffset = DbTotalLength
+ elif DbItemTotal[DbIndex] is DbPcdNameOffsetTable:
+ DbPcdNameOffset = DbTotalLength
+
+
+ DbTotalLength += DbItemTotal[DbIndex].GetListSize()
+ if not Dict['PCD_INFO_FLAG']:
+ DbPcdNameOffset = 0
+ LocalTokenCount = GetIntegerValue(Dict['LOCAL_TOKEN_NUMBER'])
+ ExTokenCount = GetIntegerValue(Dict['EX_TOKEN_NUMBER'])
+ GuidTableCount = GetIntegerValue(Dict['GUID_TABLE_SIZE'])
+ SystemSkuId = GetIntegerValue(Dict['SYSTEM_SKU_ID_VALUE'])
+ Pad = 0xDA
+
+ UninitDataBaseSize = 0
+ for Item in (DbUnInitValueUint64, DbUnInitValueUint32, DbUnInitValueUint16, DbUnInitValueUint8, DbUnInitValueBoolean):
+ UninitDataBaseSize += Item.GetListSize()
+
+ if (DbTotalLength - UninitDataBaseSize) % 8:
+ DbTotalLength += (8 - (DbTotalLength - UninitDataBaseSize) % 8)
+ # Construct the database buffer
+ Guid = "{0x3c7d193c, 0x682c, 0x4c14, 0xa6, 0x8f, 0x55, 0x2d, 0xea, 0x4f, 0x43, 0x7e}"
+ Guid = StringArrayToList(Guid)
+ Buffer = PackByteFormatGUID(Guid)
+
+ b = pack("=L", DATABASE_VERSION)
+ Buffer += b
+
+ b = pack('=L', DbTotalLength - UninitDataBaseSize)
+
+ Buffer += b
+ b = pack('=Q', SystemSkuId)
+
+ Buffer += b
+ b = pack('=L', 0)
+
+ Buffer += b
+ b = pack('=L', UninitDataBaseSize)
+
+ Buffer += b
+ b = pack('=L', LocalTokenNumberTableOffset)
+
+ Buffer += b
+ b = pack('=L', ExMapTableOffset)
+
+ Buffer += b
+ b = pack('=L', GuidTableOffset)
+
+ Buffer += b
+ b = pack('=L', StringTableOffset)
+
+ Buffer += b
+ b = pack('=L', SizeTableOffset)
+
+ Buffer += b
+ b = pack('=L', SkuIdTableOffset)
+
+ Buffer += b
+ b = pack('=L', DbPcdNameOffset)
+
+ Buffer += b
+ b = pack('=H', LocalTokenCount)
+
+ Buffer += b
+ b = pack('=H', ExTokenCount)
+
+ Buffer += b
+ b = pack('=H', GuidTableCount)
+
+ Buffer += b
+ b = pack('=B', Pad)
+ Buffer += b
+ Buffer += b
+ Buffer += b
+ Buffer += b
+ Buffer += b
+ Buffer += b
+
+ Index = 0
+ for Item in DbItemTotal:
+ Index +=1
+ packdata = Item.PackData()
+ for i in range(len(packdata)):
+ Buffer += packdata[i:i + 1]
+ if Index == InitTableNum:
+ if len(Buffer) % 8:
+ for num in range(8 - len(Buffer) % 8):
+ b = pack('=B', Pad)
+ Buffer += b
+ break
+ return Buffer
+
+## Create code for PCD database
+#
+# @param Info The ModuleAutoGen object
+# @param AutoGenC The TemplateString object for C code
+# @param AutoGenH The TemplateString object for header file
+#
+def CreatePcdDatabaseCode (Info, AutoGenC, AutoGenH):
+ if Info.PcdIsDriver == "":
+ return
+ if Info.PcdIsDriver not in gPcdPhaseMap:
+ EdkLogger.error("build", AUTOGEN_ERROR, "Not supported PcdIsDriver type:%s" % Info.PcdIsDriver,
+ ExtraData="[%s]" % str(Info))
+
+ AdditionalAutoGenH, AdditionalAutoGenC, PcdDbBuffer = NewCreatePcdDatabasePhaseSpecificAutoGen (Info.PlatformInfo, 'PEI')
+ AutoGenH.Append(AdditionalAutoGenH.String)
+
+ Phase = gPcdPhaseMap[Info.PcdIsDriver]
+ if Phase == 'PEI':
+ AutoGenC.Append(AdditionalAutoGenC.String)
+
+ if Phase == 'DXE':
+ AdditionalAutoGenH, AdditionalAutoGenC, PcdDbBuffer = NewCreatePcdDatabasePhaseSpecificAutoGen (Info.PlatformInfo, Phase)
+ AutoGenH.Append(AdditionalAutoGenH.String)
+ AutoGenC.Append(AdditionalAutoGenC.String)
+
+ if Info.IsBinaryModule:
+ DbFileName = os.path.join(Info.PlatformInfo.BuildDir, TAB_FV_DIRECTORY, Phase + "PcdDataBase.raw")
+ else:
+ DbFileName = os.path.join(Info.OutputDir, Phase + "PcdDataBase.raw")
+ DbFile = BytesIO()
+ DbFile.write(PcdDbBuffer)
+ Changed = SaveFileOnChange(DbFileName, DbFile.getvalue(), True)
+def CreatePcdDataBase(PcdDBData):
+ delta = {}
+ for skuname, skuid in PcdDBData:
+ if len(PcdDBData[(skuname, skuid)][1]) != len(PcdDBData[(TAB_DEFAULT, "0")][1]):
+ EdkLogger.ERROR("The size of each sku in one pcd are not same")
+ for skuname, skuid in PcdDBData:
+ if skuname == TAB_DEFAULT:
+ continue
+ delta[(skuname, skuid)] = [(index, data, hex(data)) for index, data in enumerate(PcdDBData[(skuname, skuid)][1]) if PcdDBData[(skuname, skuid)][1][index] != PcdDBData[(TAB_DEFAULT, "0")][1][index]]
+ databasebuff = PcdDBData[(TAB_DEFAULT, "0")][0]
+
+ for skuname, skuid in delta:
+ # 8 byte align
+ if len(databasebuff) % 8 > 0:
+ for i in range(8 - (len(databasebuff) % 8)):
+ databasebuff += pack("=B", 0)
+ databasebuff += pack('=Q', int(skuid))
+ databasebuff += pack('=Q', 0)
+ databasebuff += pack('=L', 8+8+4+4*len(delta[(skuname, skuid)]))
+ for item in delta[(skuname, skuid)]:
+ databasebuff += pack("=L", item[0])
+ databasebuff = databasebuff[:-1] + pack("=B", item[1])
+ totallen = len(databasebuff)
+ totallenbuff = pack("=L", totallen)
+ newbuffer = databasebuff[:32]
+ for i in range(4):
+ newbuffer += totallenbuff[i:i+1]
+ for i in range(36, totallen):
+ newbuffer += databasebuff[i:i+1]
+
+ return newbuffer
+
+def CreateVarCheckBin(VarCheckTab):
+ return VarCheckTab[(TAB_DEFAULT, "0")]
+
+def CreateAutoGen(PcdDriverAutoGenData):
+ autogenC = TemplateString()
+ for skuname, skuid in PcdDriverAutoGenData:
+ autogenC.Append("//SKUID: %s" % skuname)
+ autogenC.Append(PcdDriverAutoGenData[(skuname, skuid)][1].String)
+ return (PcdDriverAutoGenData[(skuname, skuid)][0], autogenC)
+def NewCreatePcdDatabasePhaseSpecificAutoGen(Platform, Phase):
+ def prune_sku(pcd, skuname):
+ new_pcd = copy.deepcopy(pcd)
+ new_pcd.SkuInfoList = {skuname:pcd.SkuInfoList[skuname]}
+ new_pcd.isinit = 'INIT'
+ if new_pcd.DatumType in TAB_PCD_NUMERIC_TYPES:
+ for skuobj in pcd.SkuInfoList.values():
+ if skuobj.DefaultValue:
+ defaultvalue = int(skuobj.DefaultValue, 16) if skuobj.DefaultValue.upper().startswith("0X") else int(skuobj.DefaultValue, 10)
+ if defaultvalue != 0:
+ new_pcd.isinit = "INIT"
+ break
+ elif skuobj.VariableName:
+ new_pcd.isinit = "INIT"
+ break
+ else:
+ new_pcd.isinit = "UNINIT"
+ return new_pcd
+ DynamicPcds = Platform.DynamicPcdList
+ DynamicPcdSet_Sku = {(SkuName, skuobj.SkuId):[] for pcd in DynamicPcds for (SkuName, skuobj) in pcd.SkuInfoList.items() }
+ for skuname, skuid in DynamicPcdSet_Sku:
+ DynamicPcdSet_Sku[(skuname, skuid)] = [prune_sku(pcd, skuname) for pcd in DynamicPcds]
+ PcdDBData = {}
+ PcdDriverAutoGenData = {}
+ VarCheckTableData = {}
+ if DynamicPcdSet_Sku:
+ for skuname, skuid in DynamicPcdSet_Sku:
+ AdditionalAutoGenH, AdditionalAutoGenC, PcdDbBuffer, VarCheckTab = CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdSet_Sku[(skuname, skuid)], Phase)
+ final_data = ()
+ for item in range(len(PcdDbBuffer)):
+ final_data += unpack("B", PcdDbBuffer[item:item+1])
+ PcdDBData[(skuname, skuid)] = (PcdDbBuffer, final_data)
+ PcdDriverAutoGenData[(skuname, skuid)] = (AdditionalAutoGenH, AdditionalAutoGenC)
+ VarCheckTableData[(skuname, skuid)] = VarCheckTab
+ if Platform.Platform.VarCheckFlag:
+ dest = os.path.join(Platform.BuildDir, TAB_FV_DIRECTORY)
+ VarCheckTable = CreateVarCheckBin(VarCheckTableData)
+ VarCheckTable.dump(dest, Phase)
+ AdditionalAutoGenH, AdditionalAutoGenC = CreateAutoGen(PcdDriverAutoGenData)
+ else:
+ AdditionalAutoGenH, AdditionalAutoGenC, PcdDbBuffer, VarCheckTab = CreatePcdDatabasePhaseSpecificAutoGen (Platform, {}, Phase)
+ final_data = ()
+ for item in range(len(PcdDbBuffer)):
+ final_data += unpack("B", PcdDbBuffer[item:item + 1])
+ PcdDBData[(TAB_DEFAULT, "0")] = (PcdDbBuffer, final_data)
+
+ return AdditionalAutoGenH, AdditionalAutoGenC, CreatePcdDataBase(PcdDBData)
+## Create PCD database in DXE or PEI phase
+#
+# @param Platform The platform object
+# @retval tuple Two TemplateString objects for C code and header file,
+# respectively
+#
+def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
+ AutoGenC = TemplateString()
+ AutoGenH = TemplateString()
+
+ Dict = {
+ 'PHASE' : Phase,
+ 'SERVICE_DRIVER_VERSION' : DATABASE_VERSION,
+ 'GUID_TABLE_SIZE' : '1U',
+ 'STRING_TABLE_SIZE' : '1U',
+ 'SKUID_TABLE_SIZE' : '1U',
+ 'LOCAL_TOKEN_NUMBER_TABLE_SIZE' : '0U',
+ 'LOCAL_TOKEN_NUMBER' : '0U',
+ 'EXMAPPING_TABLE_SIZE' : '1U',
+ 'EX_TOKEN_NUMBER' : '0U',
+ 'SIZE_TABLE_SIZE' : '2U',
+ 'SKU_HEAD_SIZE' : '1U',
+ 'GUID_TABLE_EMPTY' : 'TRUE',
+ 'STRING_TABLE_EMPTY' : 'TRUE',
+ 'SKUID_TABLE_EMPTY' : 'TRUE',
+ 'DATABASE_EMPTY' : 'TRUE',
+ 'EXMAP_TABLE_EMPTY' : 'TRUE',
+ 'PCD_DATABASE_UNINIT_EMPTY' : ' UINT8 dummy; /* PCD_DATABASE_UNINIT is empty */',
+ 'SYSTEM_SKU_ID' : ' SKU_ID SystemSkuId;',
+ 'SYSTEM_SKU_ID_VALUE' : '0U'
+ }
+
+ SkuObj = Platform.Platform.SkuIdMgr
+ Dict['SYSTEM_SKU_ID_VALUE'] = 0 if SkuObj.SkuUsageType == SkuObj.SINGLE else Platform.Platform.SkuIds[SkuObj.SystemSkuId][0]
+
+ Dict['PCD_INFO_FLAG'] = Platform.Platform.PcdInfoFlag
+
+ for DatumType in TAB_PCD_NUMERIC_TYPES_VOID:
+ Dict['VARDEF_CNAME_' + DatumType] = []
+ Dict['VARDEF_GUID_' + DatumType] = []
+ Dict['VARDEF_SKUID_' + DatumType] = []
+ Dict['VARDEF_VALUE_' + DatumType] = []
+ Dict['VARDEF_DB_VALUE_' + DatumType] = []
+ for Init in ['INIT', 'UNINIT']:
+ Dict[Init+'_CNAME_DECL_' + DatumType] = []
+ Dict[Init+'_GUID_DECL_' + DatumType] = []
+ Dict[Init+'_NUMSKUS_DECL_' + DatumType] = []
+ Dict[Init+'_VALUE_' + DatumType] = []
+ Dict[Init+'_DB_VALUE_'+DatumType] = []
+
+ for Type in ['STRING_HEAD', 'VPD_HEAD', 'VARIABLE_HEAD']:
+ Dict[Type + '_CNAME_DECL'] = []
+ Dict[Type + '_GUID_DECL'] = []
+ Dict[Type + '_NUMSKUS_DECL'] = []
+ Dict[Type + '_VALUE'] = []
+
+ Dict['STRING_DB_VALUE'] = []
+ Dict['VPD_DB_VALUE'] = []
+ Dict['VARIABLE_DB_VALUE'] = []
+
+ Dict['STRING_TABLE_INDEX'] = []
+ Dict['STRING_TABLE_LENGTH'] = []
+ Dict['STRING_TABLE_CNAME'] = []
+ Dict['STRING_TABLE_GUID'] = []
+ Dict['STRING_TABLE_VALUE'] = []
+ Dict['STRING_TABLE_DB_VALUE'] = []
+
+ Dict['SIZE_TABLE_CNAME'] = []
+ Dict['SIZE_TABLE_GUID'] = []
+ Dict['SIZE_TABLE_CURRENT_LENGTH'] = []
+ Dict['SIZE_TABLE_MAXIMUM_LENGTH'] = []
+
+ Dict['EXMAPPING_TABLE_EXTOKEN'] = []
+ Dict['EXMAPPING_TABLE_LOCAL_TOKEN'] = []
+ Dict['EXMAPPING_TABLE_GUID_INDEX'] = []
+
+ Dict['GUID_STRUCTURE'] = []
+ Dict['SKUID_VALUE'] = [0] # init Dict length
+ Dict['VARDEF_HEADER'] = []
+
+ Dict['LOCAL_TOKEN_NUMBER_DB_VALUE'] = []
+ Dict['VARIABLE_DB_VALUE'] = []
+
+ Dict['PCD_TOKENSPACE'] = []
+ Dict['PCD_CNAME'] = []
+ Dict['PCD_TOKENSPACE_LENGTH'] = []
+ Dict['PCD_CNAME_LENGTH'] = []
+ Dict['PCD_TOKENSPACE_OFFSET'] = []
+ Dict['PCD_CNAME_OFFSET'] = []
+ Dict['PCD_TOKENSPACE_MAP'] = []
+ Dict['PCD_NAME_OFFSET'] = []
+
+ Dict['PCD_ORDER_TOKEN_NUMBER_MAP'] = {}
+ PCD_STRING_INDEX_MAP = {}
+
+ StringTableIndex = 0
+ StringTableSize = 0
+ NumberOfLocalTokens = 0
+ NumberOfPeiLocalTokens = 0
+ NumberOfDxeLocalTokens = 0
+ NumberOfExTokens = 0
+ NumberOfSizeItems = 0
+ NumberOfSkuEnabledPcd = 0
+ GuidList = []
+ VarCheckTab = VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER()
+ i = 0
+ ReorderedDynPcdList = GetOrderedDynamicPcdList(DynamicPcdList, Platform.PcdTokenNumber)
+ for item in ReorderedDynPcdList:
+ if item.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
+ item.DatumType = TAB_VOID
+ for Pcd in ReorderedDynPcdList:
+ VoidStarTypeCurrSize = []
+ i += 1
+ CName = Pcd.TokenCName
+ TokenSpaceGuidCName = Pcd.TokenSpaceGuidCName
+
+ for PcdItem in GlobalData.MixedPcd:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ CName = PcdItem[0]
+
+ EdkLogger.debug(EdkLogger.DEBUG_3, "PCD: %s %s (%s : %s)" % (CName, TokenSpaceGuidCName, Pcd.Phase, Phase))
+
+ if Pcd.Phase == 'PEI':
+ NumberOfPeiLocalTokens += 1
+ if Pcd.Phase == 'DXE':
+ NumberOfDxeLocalTokens += 1
+ if Pcd.Phase != Phase:
+ continue
+
+ #
+ # TODO: need GetGuidValue() definition
+ #
+ TokenSpaceGuidStructure = Pcd.TokenSpaceGuidValue
+ TokenSpaceGuid = GuidStructureStringToGuidValueName(TokenSpaceGuidStructure)
+ if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
+ if TokenSpaceGuid not in GuidList:
+ GuidList.append(TokenSpaceGuid)
+ Dict['GUID_STRUCTURE'].append(TokenSpaceGuidStructure)
+ NumberOfExTokens += 1
+
+ ValueList = []
+ DbValueList = []
+ StringHeadOffsetList = []
+ StringDbOffsetList = []
+ VpdHeadOffsetList = []
+ VpdDbOffsetList = []
+ VariableHeadValueList = []
+ VariableDbValueList = []
+ Pcd.InitString = 'UNINIT'
+
+ if Pcd.DatumType == TAB_VOID:
+ if Pcd.Type not in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:
+ Pcd.TokenTypeList = ['PCD_TYPE_STRING']
+ else:
+ Pcd.TokenTypeList = []
+ elif Pcd.DatumType == 'BOOLEAN':
+ Pcd.TokenTypeList = ['PCD_DATUM_TYPE_UINT8_BOOLEAN']
+ else:
+ Pcd.TokenTypeList = ['PCD_DATUM_TYPE_' + Pcd.DatumType]
+
+ if len(Pcd.SkuInfoList) > 1:
+ NumberOfSkuEnabledPcd += 1
+
+ SkuIdIndex = 1
+ VariableHeadList = []
+ for SkuName in Pcd.SkuInfoList:
+ Sku = Pcd.SkuInfoList[SkuName]
+ SkuId = Sku.SkuId
+ if SkuId is None or SkuId == '':
+ continue
+
+
+ SkuIdIndex += 1
+
+ if len(Sku.VariableName) > 0:
+ VariableGuidStructure = Sku.VariableGuidValue
+ VariableGuid = GuidStructureStringToGuidValueName(VariableGuidStructure)
+ if Platform.Platform.VarCheckFlag:
+ var_check_obj = VAR_CHECK_PCD_VARIABLE_TAB(VariableGuidStructure, StringToArray(Sku.VariableName))
+ try:
+ var_check_obj.push_back(GetValidationObject(Pcd, Sku.VariableOffset))
+ VarAttr, _ = VariableAttributes.GetVarAttributes(Sku.VariableAttribute)
+ var_check_obj.SetAttributes(VarAttr)
+ var_check_obj.UpdateSize()
+ VarCheckTab.push_back(var_check_obj)
+ except Exception:
+ ValidInfo = ''
+ if Pcd.validateranges:
+ ValidInfo = Pcd.validateranges[0]
+ if Pcd.validlists:
+ ValidInfo = Pcd.validlists[0]
+ if ValidInfo:
+ EdkLogger.error("build", PCD_VALIDATION_INFO_ERROR,
+ "The PCD '%s.%s' Validation information defined in DEC file has incorrect format." % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
+ ExtraData = "[%s]" % str(ValidInfo))
+ else:
+ EdkLogger.error("build", PCD_VALIDATION_INFO_ERROR,
+ "The PCD '%s.%s' Validation information defined in DEC file has incorrect format." % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
+ Pcd.TokenTypeList.append('PCD_TYPE_HII')
+ Pcd.InitString = 'INIT'
+ # Store all variable names of one HII PCD under different SKU to stringTable
+ # and calculate the VariableHeadStringIndex
+
+ VariableNameStructure = StringToArray(Sku.VariableName)
+
+ # Make pointer of VaraibleName(HII PCD) 2 bytes aligned
+ VariableNameStructureBytes = VariableNameStructure.lstrip("{").rstrip("}").split(",")
+ if len(VariableNameStructureBytes) % 2:
+ VariableNameStructure = "{%s,0x00}" % ",".join(VariableNameStructureBytes)
+
+ if VariableNameStructure not in Dict['STRING_TABLE_VALUE']:
+ Dict['STRING_TABLE_CNAME'].append(CName)
+ Dict['STRING_TABLE_GUID'].append(TokenSpaceGuid)
+ if StringTableIndex == 0:
+ Dict['STRING_TABLE_INDEX'].append('')
+ else:
+ Dict['STRING_TABLE_INDEX'].append('_%d' % StringTableIndex)
+ VarNameSize = len(VariableNameStructure.replace(',', ' ').split())
+ Dict['STRING_TABLE_LENGTH'].append(VarNameSize )
+ Dict['STRING_TABLE_VALUE'].append(VariableNameStructure)
+ StringHeadOffsetList.append(str(StringTableSize) + 'U')
+ VarStringDbOffsetList = []
+ VarStringDbOffsetList.append(StringTableSize)
+ Dict['STRING_DB_VALUE'].append(VarStringDbOffsetList)
+ StringTableIndex += 1
+ StringTableSize += len(VariableNameStructure.replace(',', ' ').split())
+ VariableHeadStringIndex = 0
+ for Index in range(Dict['STRING_TABLE_VALUE'].index(VariableNameStructure)):
+ VariableHeadStringIndex += Dict['STRING_TABLE_LENGTH'][Index]
+ VariableHeadList.append(VariableHeadStringIndex)
+
+ VariableHeadStringIndex = VariableHeadList[SkuIdIndex - 2]
+ # store VariableGuid to GuidTable and get the VariableHeadGuidIndex
+
+ if VariableGuid not in GuidList:
+ GuidList.append(VariableGuid)
+ Dict['GUID_STRUCTURE'].append(VariableGuidStructure)
+ VariableHeadGuidIndex = GuidList.index(VariableGuid)
+
+ if "PCD_TYPE_STRING" in Pcd.TokenTypeList:
+ VariableHeadValueList.append('%dU, offsetof(%s_PCD_DATABASE, Init.%s_%s), %dU, %sU' %
+ (VariableHeadStringIndex, Phase, CName, TokenSpaceGuid,
+ VariableHeadGuidIndex, Sku.VariableOffset))
+ else:
+ VariableHeadValueList.append('%dU, offsetof(%s_PCD_DATABASE, Init.%s_%s_VariableDefault_%s), %dU, %sU' %
+ (VariableHeadStringIndex, Phase, CName, TokenSpaceGuid, SkuIdIndex,
+ VariableHeadGuidIndex, Sku.VariableOffset))
+ Dict['VARDEF_CNAME_'+Pcd.DatumType].append(CName)
+ Dict['VARDEF_GUID_'+Pcd.DatumType].append(TokenSpaceGuid)
+ Dict['VARDEF_SKUID_'+Pcd.DatumType].append(SkuIdIndex)
+ if "PCD_TYPE_STRING" in Pcd.TokenTypeList:
+ Dict['VARDEF_VALUE_' + Pcd.DatumType].append("%s_%s[%d]" % (Pcd.TokenCName, TokenSpaceGuid, SkuIdIndex))
+ else:
+ #
+ # ULL (for UINT64) or U(other integer type) should be append to avoid
+ # warning under linux building environment.
+ #
+ Dict['VARDEF_DB_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue)
+
+ if Pcd.DatumType == TAB_UINT64:
+ Dict['VARDEF_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue + "ULL")
+ elif Pcd.DatumType in (TAB_UINT32, TAB_UINT16, TAB_UINT8):
+ Dict['VARDEF_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue + "U")
+ elif Pcd.DatumType == "BOOLEAN":
+ if eval(Sku.HiiDefaultValue) in [1, 0]:
+ Dict['VARDEF_VALUE_'+Pcd.DatumType].append(str(eval(Sku.HiiDefaultValue)) + "U")
+ else:
+ Dict['VARDEF_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue)
+
+ # construct the VariableHeader value
+ if "PCD_TYPE_STRING" in Pcd.TokenTypeList:
+ VariableHeadValueList.append('%dU, %dU, %sU, offsetof(%s_PCD_DATABASE, Init.%s_%s)' %
+ (VariableHeadGuidIndex, VariableHeadStringIndex, Sku.VariableOffset,
+ Phase, CName, TokenSpaceGuid))
+ # the Pcd default value will be filled later on
+ VariableOffset = len(Dict['STRING_DB_VALUE'])
+ VariableRefTable = Dict['STRING_DB_VALUE']
+ else:
+ VariableHeadValueList.append('%dU, %dU, %sU, offsetof(%s_PCD_DATABASE, Init.%s_%s_VariableDefault_%s)' %
+ (VariableHeadGuidIndex, VariableHeadStringIndex, Sku.VariableOffset,
+ Phase, CName, TokenSpaceGuid, SkuIdIndex))
+ # the Pcd default value was filled before
+ VariableOffset = len(Dict['VARDEF_DB_VALUE_' + Pcd.DatumType]) - 1
+ VariableRefTable = Dict['VARDEF_DB_VALUE_' + Pcd.DatumType]
+ VariableDbValueList.append([VariableHeadGuidIndex, VariableHeadStringIndex, Sku.VariableOffset, VariableOffset, VariableRefTable, Sku.VariableAttribute])
+
+ elif Sku.VpdOffset != '':
+ Pcd.TokenTypeList.append('PCD_TYPE_VPD')
+ Pcd.InitString = 'INIT'
+ VpdHeadOffsetList.append(str(Sku.VpdOffset) + 'U')
+ VpdDbOffsetList.append(Sku.VpdOffset)
+ # Also add the VOID* string of VPD PCD to SizeTable
+ if Pcd.DatumType == TAB_VOID:
+ NumberOfSizeItems += 1
+ # For VPD type of PCD, its current size is equal to its MAX size.
+ VoidStarTypeCurrSize = [str(Pcd.MaxDatumSize) + 'U']
+ continue
+
+ if Pcd.DatumType == TAB_VOID:
+ Pcd.TokenTypeList.append('PCD_TYPE_STRING')
+ Pcd.InitString = 'INIT'
+ if Sku.HiiDefaultValue != '' and Sku.DefaultValue == '':
+ Sku.DefaultValue = Sku.HiiDefaultValue
+ if Sku.DefaultValue != '':
+ NumberOfSizeItems += 1
+ Dict['STRING_TABLE_CNAME'].append(CName)
+ Dict['STRING_TABLE_GUID'].append(TokenSpaceGuid)
+
+ if StringTableIndex == 0:
+ Dict['STRING_TABLE_INDEX'].append('')
+ else:
+ Dict['STRING_TABLE_INDEX'].append('_%d' % StringTableIndex)
+ if Sku.DefaultValue[0] == 'L':
+ DefaultValueBinStructure = StringToArray(Sku.DefaultValue)
+ Size = len(DefaultValueBinStructure.replace(',', ' ').split())
+ Dict['STRING_TABLE_VALUE'].append(DefaultValueBinStructure)
+ elif Sku.DefaultValue[0] == '"':
+ DefaultValueBinStructure = StringToArray(Sku.DefaultValue)
+ Size = len(Sku.DefaultValue) - 2 + 1
+ Dict['STRING_TABLE_VALUE'].append(DefaultValueBinStructure)
+ elif Sku.DefaultValue[0] == '{':
+ DefaultValueBinStructure = StringToArray(Sku.DefaultValue)
+ Size = len(Sku.DefaultValue.split(","))
+ Dict['STRING_TABLE_VALUE'].append(DefaultValueBinStructure)
+
+ StringHeadOffsetList.append(str(StringTableSize) + 'U')
+ StringDbOffsetList.append(StringTableSize)
+ if Pcd.MaxDatumSize != '':
+ MaxDatumSize = int(Pcd.MaxDatumSize, 0)
+ if MaxDatumSize < Size:
+ if Pcd.MaxSizeUserSet:
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
+ ExtraData="[%s]" % str(Platform))
+ else:
+ MaxDatumSize = Size
+ else:
+ MaxDatumSize = Size
+ StringTabLen = MaxDatumSize
+ if StringTabLen % 2:
+ StringTabLen += 1
+ if Sku.VpdOffset == '':
+ VoidStarTypeCurrSize.append(str(Size) + 'U')
+ Dict['STRING_TABLE_LENGTH'].append(StringTabLen)
+ StringTableIndex += 1
+ StringTableSize += (StringTabLen)
+ else:
+ if "PCD_TYPE_HII" not in Pcd.TokenTypeList:
+ Pcd.TokenTypeList.append('PCD_TYPE_DATA')
+ if Sku.DefaultValue == 'TRUE':
+ Pcd.InitString = 'INIT'
+ else:
+ Pcd.InitString = Pcd.isinit
+ #
+ # For UNIT64 type PCD's value, ULL should be append to avoid
+ # warning under linux building environment.
+ #
+ if Pcd.DatumType == TAB_UINT64:
+ ValueList.append(Sku.DefaultValue + "ULL")
+ elif Pcd.DatumType in (TAB_UINT32, TAB_UINT16, TAB_UINT8):
+ ValueList.append(Sku.DefaultValue + "U")
+ elif Pcd.DatumType == "BOOLEAN":
+ if Sku.DefaultValue in ["1", "0"]:
+ ValueList.append(Sku.DefaultValue + "U")
+ else:
+ ValueList.append(Sku.DefaultValue)
+
+ DbValueList.append(Sku.DefaultValue)
+
+ Pcd.TokenTypeList = list(set(Pcd.TokenTypeList))
+ if Pcd.DatumType == TAB_VOID:
+ Dict['SIZE_TABLE_CNAME'].append(CName)
+ Dict['SIZE_TABLE_GUID'].append(TokenSpaceGuid)
+ Dict['SIZE_TABLE_MAXIMUM_LENGTH'].append(str(Pcd.MaxDatumSize) + 'U')
+ Dict['SIZE_TABLE_CURRENT_LENGTH'].append(VoidStarTypeCurrSize)
+
+
+
+ if 'PCD_TYPE_HII' in Pcd.TokenTypeList:
+ Dict['VARIABLE_HEAD_CNAME_DECL'].append(CName)
+ Dict['VARIABLE_HEAD_GUID_DECL'].append(TokenSpaceGuid)
+ Dict['VARIABLE_HEAD_NUMSKUS_DECL'].append(len(Pcd.SkuInfoList))
+ Dict['VARIABLE_HEAD_VALUE'].append('{ %s }\n' % ' },\n { '.join(VariableHeadValueList))
+ Dict['VARDEF_HEADER'].append('_Variable_Header')
+ Dict['VARIABLE_DB_VALUE'].append(VariableDbValueList)
+ else:
+ Dict['VARDEF_HEADER'].append('')
+ if 'PCD_TYPE_VPD' in Pcd.TokenTypeList:
+ Dict['VPD_HEAD_CNAME_DECL'].append(CName)
+ Dict['VPD_HEAD_GUID_DECL'].append(TokenSpaceGuid)
+ Dict['VPD_HEAD_NUMSKUS_DECL'].append(len(Pcd.SkuInfoList))
+ Dict['VPD_HEAD_VALUE'].append('{ %s }' % ' }, { '.join(VpdHeadOffsetList))
+ Dict['VPD_DB_VALUE'].append(VpdDbOffsetList)
+ if 'PCD_TYPE_STRING' in Pcd.TokenTypeList:
+ Dict['STRING_HEAD_CNAME_DECL'].append(CName)
+ Dict['STRING_HEAD_GUID_DECL'].append(TokenSpaceGuid)
+ Dict['STRING_HEAD_NUMSKUS_DECL'].append(len(Pcd.SkuInfoList))
+ Dict['STRING_HEAD_VALUE'].append(', '.join(StringHeadOffsetList))
+ Dict['STRING_DB_VALUE'].append(StringDbOffsetList)
+ PCD_STRING_INDEX_MAP[len(Dict['STRING_HEAD_CNAME_DECL']) -1 ] = len(Dict['STRING_DB_VALUE']) -1
+ if 'PCD_TYPE_DATA' in Pcd.TokenTypeList:
+ Dict[Pcd.InitString+'_CNAME_DECL_'+Pcd.DatumType].append(CName)
+ Dict[Pcd.InitString+'_GUID_DECL_'+Pcd.DatumType].append(TokenSpaceGuid)
+ Dict[Pcd.InitString+'_NUMSKUS_DECL_'+Pcd.DatumType].append(len(Pcd.SkuInfoList))
+ if Pcd.InitString == 'UNINIT':
+ Dict['PCD_DATABASE_UNINIT_EMPTY'] = ''
+ else:
+ Dict[Pcd.InitString+'_VALUE_'+Pcd.DatumType].append(', '.join(ValueList))
+ Dict[Pcd.InitString+'_DB_VALUE_'+Pcd.DatumType].append(DbValueList)
+
+ if Phase == 'PEI':
+ NumberOfLocalTokens = NumberOfPeiLocalTokens
+ if Phase == 'DXE':
+ NumberOfLocalTokens = NumberOfDxeLocalTokens
+
+ Dict['TOKEN_INIT'] = ['' for x in range(NumberOfLocalTokens)]
+ Dict['TOKEN_CNAME'] = ['' for x in range(NumberOfLocalTokens)]
+ Dict['TOKEN_GUID'] = ['' for x in range(NumberOfLocalTokens)]
+ Dict['TOKEN_TYPE'] = ['' for x in range(NumberOfLocalTokens)]
+ Dict['LOCAL_TOKEN_NUMBER_DB_VALUE'] = ['' for x in range(NumberOfLocalTokens)]
+ Dict['PCD_CNAME'] = ['' for x in range(NumberOfLocalTokens)]
+ Dict['PCD_TOKENSPACE_MAP'] = ['' for x in range(NumberOfLocalTokens)]
+ Dict['PCD_CNAME_LENGTH'] = [0 for x in range(NumberOfLocalTokens)]
+ SkuEnablePcdIndex = 0
+ for Pcd in ReorderedDynPcdList:
+ CName = Pcd.TokenCName
+ TokenSpaceGuidCName = Pcd.TokenSpaceGuidCName
+ if Pcd.Phase != Phase:
+ continue
+
+ TokenSpaceGuid = GuidStructureStringToGuidValueName(Pcd.TokenSpaceGuidValue) #(Platform.PackageList, TokenSpaceGuidCName))
+ GeneratedTokenNumber = Platform.PcdTokenNumber[CName, TokenSpaceGuidCName] - 1
+ if Phase == 'DXE':
+ GeneratedTokenNumber -= NumberOfPeiLocalTokens
+
+ if len(Pcd.SkuInfoList) > 1:
+ Dict['PCD_ORDER_TOKEN_NUMBER_MAP'][GeneratedTokenNumber] = SkuEnablePcdIndex
+ SkuEnablePcdIndex += 1
+
+ for PcdItem in GlobalData.MixedPcd:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ CName = PcdItem[0]
+
+ EdkLogger.debug(EdkLogger.DEBUG_1, "PCD = %s.%s" % (CName, TokenSpaceGuidCName))
+ EdkLogger.debug(EdkLogger.DEBUG_1, "phase = %s" % Phase)
+ EdkLogger.debug(EdkLogger.DEBUG_1, "GeneratedTokenNumber = %s" % str(GeneratedTokenNumber))
+
+ #
+ # following four Dict items hold the information for LocalTokenNumberTable
+ #
+ Dict['TOKEN_INIT'][GeneratedTokenNumber] = 'Init'
+ if Pcd.InitString == 'UNINIT':
+ Dict['TOKEN_INIT'][GeneratedTokenNumber] = 'Uninit'
+
+ Dict['TOKEN_CNAME'][GeneratedTokenNumber] = CName
+ Dict['TOKEN_GUID'][GeneratedTokenNumber] = TokenSpaceGuid
+ Dict['TOKEN_TYPE'][GeneratedTokenNumber] = ' | '.join(Pcd.TokenTypeList)
+
+ if Platform.Platform.PcdInfoFlag:
+ TokenSpaceGuidCNameArray = StringToArray('"' + TokenSpaceGuidCName + '"' )
+ if TokenSpaceGuidCNameArray not in Dict['PCD_TOKENSPACE']:
+ Dict['PCD_TOKENSPACE'].append(TokenSpaceGuidCNameArray)
+ Dict['PCD_TOKENSPACE_LENGTH'].append( len(TokenSpaceGuidCNameArray.split(",")) )
+ Dict['PCD_TOKENSPACE_MAP'][GeneratedTokenNumber] = Dict['PCD_TOKENSPACE'].index(TokenSpaceGuidCNameArray)
+ CNameBinArray = StringToArray('"' + CName + '"' )
+ Dict['PCD_CNAME'][GeneratedTokenNumber] = CNameBinArray
+
+ Dict['PCD_CNAME_LENGTH'][GeneratedTokenNumber] = len(CNameBinArray.split(","))
+
+
+ Pcd.TokenTypeList = list(set(Pcd.TokenTypeList))
+
+ # search the Offset and Table, used by LocalTokenNumberTableOffset
+ if 'PCD_TYPE_HII' in Pcd.TokenTypeList:
+ # Find index by CName, TokenSpaceGuid
+ Offset = GetMatchedIndex(CName, Dict['VARIABLE_HEAD_CNAME_DECL'], TokenSpaceGuid, Dict['VARIABLE_HEAD_GUID_DECL'])
+ assert(Offset != -1)
+ Table = Dict['VARIABLE_DB_VALUE']
+ if 'PCD_TYPE_VPD' in Pcd.TokenTypeList:
+ Offset = GetMatchedIndex(CName, Dict['VPD_HEAD_CNAME_DECL'], TokenSpaceGuid, Dict['VPD_HEAD_GUID_DECL'])
+ assert(Offset != -1)
+ Table = Dict['VPD_DB_VALUE']
+ if 'PCD_TYPE_STRING' in Pcd.TokenTypeList and 'PCD_TYPE_HII' not in Pcd.TokenTypeList:
+ # Find index by CName, TokenSpaceGuid
+ Offset = GetMatchedIndex(CName, Dict['STRING_HEAD_CNAME_DECL'], TokenSpaceGuid, Dict['STRING_HEAD_GUID_DECL'])
+ Offset = PCD_STRING_INDEX_MAP[Offset]
+ assert(Offset != -1)
+ Table = Dict['STRING_DB_VALUE']
+ if 'PCD_TYPE_DATA' in Pcd.TokenTypeList:
+ # need to store whether it is in init table or not
+ Offset = GetMatchedIndex(CName, Dict[Pcd.InitString+'_CNAME_DECL_'+Pcd.DatumType], TokenSpaceGuid, Dict[Pcd.InitString+'_GUID_DECL_'+Pcd.DatumType])
+ assert(Offset != -1)
+ if Pcd.InitString == 'UNINIT':
+ Table = Dict[Pcd.InitString+'_GUID_DECL_'+Pcd.DatumType]
+ else:
+ Table = Dict[Pcd.InitString+'_DB_VALUE_'+Pcd.DatumType]
+ Dict['LOCAL_TOKEN_NUMBER_DB_VALUE'][GeneratedTokenNumber] = (Offset, Table)
+
+ #
+ # Update VARDEF_HEADER
+ #
+ if 'PCD_TYPE_HII' in Pcd.TokenTypeList:
+ Dict['VARDEF_HEADER'][GeneratedTokenNumber] = '_Variable_Header'
+ else:
+ Dict['VARDEF_HEADER'][GeneratedTokenNumber] = ''
+
+
+ if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
+
+ if Phase == 'DXE':
+ GeneratedTokenNumber += NumberOfPeiLocalTokens
+ #
+ # Per, PCD architecture specification, PCD Token Number is 1 based and 0 is defined as invalid token number.
+ # For each EX type PCD, a PCD Token Number is assigned. When the
+ # PCD Driver/PEIM map EX_GUID and EX_TOKEN_NUMBER to the PCD Token Number,
+ # the non-EX Protocol/PPI interface can be called to get/set the value. This assumption is made by
+ # Pcd Driver/PEIM in MdeModulePkg.
+ # Therefore, 1 is added to GeneratedTokenNumber to generate a PCD Token Number before being inserted
+ # to the EXMAPPING_TABLE.
+ #
+
+
+ Dict['EXMAPPING_TABLE_EXTOKEN'].append(str(Pcd.TokenValue) + 'U')
+ Dict['EXMAPPING_TABLE_LOCAL_TOKEN'].append(str(GeneratedTokenNumber + 1) + 'U')
+ Dict['EXMAPPING_TABLE_GUID_INDEX'].append(str(GuidList.index(TokenSpaceGuid)) + 'U')
+
+ if Platform.Platform.PcdInfoFlag:
+ for index in range(len(Dict['PCD_TOKENSPACE_MAP'])):
+ TokenSpaceIndex = StringTableSize
+ for i in range(Dict['PCD_TOKENSPACE_MAP'][index]):
+ TokenSpaceIndex += Dict['PCD_TOKENSPACE_LENGTH'][i]
+ Dict['PCD_TOKENSPACE_OFFSET'].append(TokenSpaceIndex)
+ for index in range(len(Dict['PCD_TOKENSPACE'])):
+ StringTableSize += Dict['PCD_TOKENSPACE_LENGTH'][index]
+ StringTableIndex += 1
+ for index in range(len(Dict['PCD_CNAME'])):
+ Dict['PCD_CNAME_OFFSET'].append(StringTableSize)
+ Dict['PCD_NAME_OFFSET'].append(Dict['PCD_TOKENSPACE_OFFSET'][index])
+ Dict['PCD_NAME_OFFSET'].append(StringTableSize)
+ StringTableSize += Dict['PCD_CNAME_LENGTH'][index]
+ StringTableIndex += 1
+ if GuidList != []:
+ Dict['GUID_TABLE_EMPTY'] = 'FALSE'
+ Dict['GUID_TABLE_SIZE'] = str(len(GuidList)) + 'U'
+ else:
+ Dict['GUID_STRUCTURE'] = [GuidStringToGuidStructureString('00000000-0000-0000-0000-000000000000')]
+
+ if StringTableIndex == 0:
+ Dict['STRING_TABLE_INDEX'].append('')
+ Dict['STRING_TABLE_LENGTH'].append(1)
+ Dict['STRING_TABLE_CNAME'].append('')
+ Dict['STRING_TABLE_GUID'].append('')
+ Dict['STRING_TABLE_VALUE'].append('{ 0 }')
+ else:
+ Dict['STRING_TABLE_EMPTY'] = 'FALSE'
+ Dict['STRING_TABLE_SIZE'] = str(StringTableSize) + 'U'
+
+ if Dict['SIZE_TABLE_CNAME'] == []:
+ Dict['SIZE_TABLE_CNAME'].append('')
+ Dict['SIZE_TABLE_GUID'].append('')
+ Dict['SIZE_TABLE_CURRENT_LENGTH'].append(['0U'])
+ Dict['SIZE_TABLE_MAXIMUM_LENGTH'].append('0U')
+
+ if NumberOfLocalTokens != 0:
+ Dict['DATABASE_EMPTY'] = 'FALSE'
+ Dict['LOCAL_TOKEN_NUMBER_TABLE_SIZE'] = NumberOfLocalTokens
+ Dict['LOCAL_TOKEN_NUMBER'] = NumberOfLocalTokens
+
+ if NumberOfExTokens != 0:
+ Dict['EXMAP_TABLE_EMPTY'] = 'FALSE'
+ Dict['EXMAPPING_TABLE_SIZE'] = str(NumberOfExTokens) + 'U'
+ Dict['EX_TOKEN_NUMBER'] = str(NumberOfExTokens) + 'U'
+ else:
+ Dict['EXMAPPING_TABLE_EXTOKEN'].append('0U')
+ Dict['EXMAPPING_TABLE_LOCAL_TOKEN'].append('0U')
+ Dict['EXMAPPING_TABLE_GUID_INDEX'].append('0U')
+
+ if NumberOfSizeItems != 0:
+ Dict['SIZE_TABLE_SIZE'] = str(NumberOfSizeItems * 2) + 'U'
+
+ if NumberOfSkuEnabledPcd != 0:
+ Dict['SKU_HEAD_SIZE'] = str(NumberOfSkuEnabledPcd) + 'U'
+
+ for AvailableSkuNumber in SkuObj.SkuIdNumberSet:
+ if AvailableSkuNumber not in Dict['SKUID_VALUE']:
+ Dict['SKUID_VALUE'].append(AvailableSkuNumber)
+ Dict['SKUID_VALUE'][0] = len(Dict['SKUID_VALUE']) - 1
+
+ AutoGenH.Append(gPcdDatabaseAutoGenH.Replace(Dict))
+ if NumberOfLocalTokens == 0:
+ AutoGenC.Append(gEmptyPcdDatabaseAutoGenC.Replace(Dict))
+ else:
+ #
+ # Update Size Table to the right order, it should be same with LocalTokenNumberTable
+ #
+ SizeCNameTempList = []
+ SizeGuidTempList = []
+ SizeCurLenTempList = []
+ SizeMaxLenTempList = []
+ ReOrderFlag = True
+
+ if len(Dict['SIZE_TABLE_CNAME']) == 1:
+ if not (Dict['SIZE_TABLE_CNAME'][0] and Dict['SIZE_TABLE_GUID'][0]):
+ ReOrderFlag = False
+
+ if ReOrderFlag:
+ for Count in range(len(Dict['TOKEN_CNAME'])):
+ for Count1 in range(len(Dict['SIZE_TABLE_CNAME'])):
+ if Dict['TOKEN_CNAME'][Count] == Dict['SIZE_TABLE_CNAME'][Count1] and \
+ Dict['TOKEN_GUID'][Count] == Dict['SIZE_TABLE_GUID'][Count1]:
+ SizeCNameTempList.append(Dict['SIZE_TABLE_CNAME'][Count1])
+ SizeGuidTempList.append(Dict['SIZE_TABLE_GUID'][Count1])
+ SizeCurLenTempList.append(Dict['SIZE_TABLE_CURRENT_LENGTH'][Count1])
+ SizeMaxLenTempList.append(Dict['SIZE_TABLE_MAXIMUM_LENGTH'][Count1])
+
+ for Count in range(len(Dict['SIZE_TABLE_CNAME'])):
+ Dict['SIZE_TABLE_CNAME'][Count] = SizeCNameTempList[Count]
+ Dict['SIZE_TABLE_GUID'][Count] = SizeGuidTempList[Count]
+ Dict['SIZE_TABLE_CURRENT_LENGTH'][Count] = SizeCurLenTempList[Count]
+ Dict['SIZE_TABLE_MAXIMUM_LENGTH'][Count] = SizeMaxLenTempList[Count]
+
+ AutoGenC.Append(gPcdDatabaseAutoGenC.Replace(Dict))
+
+
+# print Phase
+ Buffer = BuildExDataBase(Dict)
+ return AutoGenH, AutoGenC, Buffer, VarCheckTab
+
+def GetOrderedDynamicPcdList(DynamicPcdList, PcdTokenNumberList):
+ ReorderedDyPcdList = [None for i in range(len(DynamicPcdList))]
+ for Pcd in DynamicPcdList:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in PcdTokenNumberList:
+ ReorderedDyPcdList[PcdTokenNumberList[Pcd.TokenCName, Pcd.TokenSpaceGuidCName]-1] = Pcd
+ return ReorderedDyPcdList
+
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/GenVar.py b/roms/edk2/BaseTools/Source/Python/AutoGen/GenVar.py
new file mode 100644
index 000000000..591ef3df5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/GenVar.py
@@ -0,0 +1,366 @@
+# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+#
+# This file is used to collect the Variable checking information
+#
+
+# #
+# Import Modules
+#
+from struct import pack, unpack
+import collections
+import copy
+from Common.VariableAttributes import VariableAttributes
+from Common.Misc import *
+import collections
+import Common.DataType as DataType
+
+var_info = collections.namedtuple("uefi_var", "pcdindex,pcdname,defaultstoragename,skuname,var_name, var_guid, var_offset,var_attribute,pcd_default_value, default_value, data_type,PcdDscLine,StructurePcd")
+NvStorageHeaderSize = 28
+VariableHeaderSize = 32
+
+class VariableMgr(object):
+ def __init__(self, DefaultStoreMap, SkuIdMap):
+ self.VarInfo = []
+ self.DefaultStoreMap = DefaultStoreMap
+ self.SkuIdMap = SkuIdMap
+ self.VpdRegionSize = 0
+ self.VpdRegionOffset = 0
+ self.NVHeaderBuff = None
+ self.VarDefaultBuff = None
+ self.VarDeltaBuff = None
+
+ def append_variable(self, uefi_var):
+ self.VarInfo.append(uefi_var)
+
+ def SetVpdRegionMaxSize(self, maxsize):
+ self.VpdRegionSize = maxsize
+
+ def SetVpdRegionOffset(self, vpdoffset):
+ self.VpdRegionOffset = vpdoffset
+
+ def PatchNVStoreDefaultMaxSize(self, maxsize):
+ if not self.NVHeaderBuff:
+ return ""
+ self.NVHeaderBuff = self.NVHeaderBuff[:8] + pack("=Q", maxsize)
+ default_var_bin = VariableMgr.format_data(self.NVHeaderBuff + self.VarDefaultBuff + self.VarDeltaBuff)
+ value_str = "{"
+ default_var_bin_strip = [ data.strip("""'""") for data in default_var_bin]
+ value_str += ",".join(default_var_bin_strip)
+ value_str += "}"
+ return value_str
+
+ def combine_variable(self):
+ indexedvarinfo = collections.OrderedDict()
+ for item in self.VarInfo:
+ if (item.skuname, item.defaultstoragename, item.var_name, item.var_guid) not in indexedvarinfo:
+ indexedvarinfo[(item.skuname, item.defaultstoragename, item.var_name, item.var_guid) ] = []
+ indexedvarinfo[(item.skuname, item.defaultstoragename, item.var_name, item.var_guid)].append(item)
+ for key in indexedvarinfo:
+ sku_var_info_offset_list = indexedvarinfo[key]
+ sku_var_info_offset_list.sort(key=lambda x:x.PcdDscLine)
+ FirstOffset = int(sku_var_info_offset_list[0].var_offset, 16) if sku_var_info_offset_list[0].var_offset.upper().startswith("0X") else int(sku_var_info_offset_list[0].var_offset)
+ fisrtvalue_list = sku_var_info_offset_list[0].default_value.strip("{").strip("}").split(",")
+ firstdata_type = sku_var_info_offset_list[0].data_type
+ if firstdata_type in DataType.TAB_PCD_NUMERIC_TYPES:
+ fisrtdata_flag = DataType.PACK_CODE_BY_SIZE[MAX_SIZE_TYPE[firstdata_type]]
+ fisrtdata = fisrtvalue_list[0]
+ fisrtvalue_list = []
+ pack_data = pack(fisrtdata_flag, int(fisrtdata, 0))
+ for data_byte in range(len(pack_data)):
+ fisrtvalue_list.append(hex(unpack("B", pack_data[data_byte:data_byte + 1])[0]))
+ newvalue_list = ["0x00"] * FirstOffset + fisrtvalue_list
+
+ for var_item in sku_var_info_offset_list[1:]:
+ CurOffset = int(var_item.var_offset, 16) if var_item.var_offset.upper().startswith("0X") else int(var_item.var_offset)
+ CurvalueList = var_item.default_value.strip("{").strip("}").split(",")
+ Curdata_type = var_item.data_type
+ if Curdata_type in DataType.TAB_PCD_NUMERIC_TYPES:
+ data_flag = DataType.PACK_CODE_BY_SIZE[MAX_SIZE_TYPE[Curdata_type]]
+ data = CurvalueList[0]
+ CurvalueList = []
+ pack_data = pack(data_flag, int(data, 0))
+ for data_byte in range(len(pack_data)):
+ CurvalueList.append(hex(unpack("B", pack_data[data_byte:data_byte + 1])[0]))
+ if CurOffset > len(newvalue_list):
+ newvalue_list = newvalue_list + ["0x00"] * (CurOffset - len(newvalue_list)) + CurvalueList
+ else:
+ newvalue_list[CurOffset : CurOffset + len(CurvalueList)] = CurvalueList
+
+ newvaluestr = "{" + ",".join(newvalue_list) +"}"
+ n = sku_var_info_offset_list[0]
+ indexedvarinfo[key] = [var_info(n.pcdindex, n.pcdname, n.defaultstoragename, n.skuname, n.var_name, n.var_guid, "0x00", n.var_attribute, newvaluestr, newvaluestr, DataType.TAB_VOID,n.PcdDscLine,n.StructurePcd)]
+ self.VarInfo = [item[0] for item in list(indexedvarinfo.values())]
+
+ def process_variable_data(self):
+
+ var_data = collections.defaultdict(collections.OrderedDict)
+
+ indexedvarinfo = collections.OrderedDict()
+ for item in self.VarInfo:
+ if item.pcdindex not in indexedvarinfo:
+ indexedvarinfo[item.pcdindex] = dict()
+ indexedvarinfo[item.pcdindex][(item.skuname, item.defaultstoragename)] = item
+
+ for index in indexedvarinfo:
+ sku_var_info = indexedvarinfo[index]
+
+ default_data_buffer = ""
+ others_data_buffer = ""
+ tail = None
+ default_sku_default = indexedvarinfo[index].get((DataType.TAB_DEFAULT, DataType.TAB_DEFAULT_STORES_DEFAULT))
+
+ if default_sku_default.data_type not in DataType.TAB_PCD_NUMERIC_TYPES:
+ var_max_len = max(len(var_item.default_value.split(",")) for var_item in sku_var_info.values())
+ if len(default_sku_default.default_value.split(",")) < var_max_len:
+ tail = ",".join("0x00" for i in range(var_max_len-len(default_sku_default.default_value.split(","))))
+
+ default_data_buffer = VariableMgr.PACK_VARIABLES_DATA(default_sku_default.default_value, default_sku_default.data_type, tail)
+
+ default_data_array = ()
+ for item in range(len(default_data_buffer)):
+ default_data_array += unpack("B", default_data_buffer[item:item + 1])
+
+ var_data[(DataType.TAB_DEFAULT, DataType.TAB_DEFAULT_STORES_DEFAULT)][index] = (default_data_buffer, sku_var_info[(DataType.TAB_DEFAULT, DataType.TAB_DEFAULT_STORES_DEFAULT)])
+
+ for (skuid, defaultstoragename) in indexedvarinfo[index]:
+ tail = None
+ if (skuid, defaultstoragename) == (DataType.TAB_DEFAULT, DataType.TAB_DEFAULT_STORES_DEFAULT):
+ continue
+ other_sku_other = indexedvarinfo[index][(skuid, defaultstoragename)]
+
+ if default_sku_default.data_type not in DataType.TAB_PCD_NUMERIC_TYPES:
+ if len(other_sku_other.default_value.split(",")) < var_max_len:
+ tail = ",".join("0x00" for i in range(var_max_len-len(other_sku_other.default_value.split(","))))
+
+ others_data_buffer = VariableMgr.PACK_VARIABLES_DATA(other_sku_other.default_value, other_sku_other.data_type, tail)
+
+ others_data_array = ()
+ for item in range(len(others_data_buffer)):
+ others_data_array += unpack("B", others_data_buffer[item:item + 1])
+
+ data_delta = VariableMgr.calculate_delta(default_data_array, others_data_array)
+
+ var_data[(skuid, defaultstoragename)][index] = (data_delta, sku_var_info[(skuid, defaultstoragename)])
+ return var_data
+
+ def new_process_varinfo(self):
+ self.combine_variable()
+
+ var_data = self.process_variable_data()
+
+ if not var_data:
+ return []
+
+ pcds_default_data = var_data.get((DataType.TAB_DEFAULT, DataType.TAB_DEFAULT_STORES_DEFAULT), {})
+ NvStoreDataBuffer = bytearray()
+ var_data_offset = collections.OrderedDict()
+ offset = NvStorageHeaderSize
+ for default_data, default_info in pcds_default_data.values():
+ var_name_buffer = VariableMgr.PACK_VARIABLE_NAME(default_info.var_name)
+
+ vendorguid = default_info.var_guid.split('-')
+
+ if default_info.var_attribute:
+ var_attr_value, _ = VariableAttributes.GetVarAttributes(default_info.var_attribute)
+ else:
+ var_attr_value = 0x07
+
+ DataBuffer = VariableMgr.AlignData(var_name_buffer + default_data)
+
+ data_size = len(DataBuffer)
+ offset += VariableHeaderSize + len(default_info.var_name.split(","))
+ var_data_offset[default_info.pcdindex] = offset
+ offset += data_size - len(default_info.var_name.split(","))
+
+ var_header_buffer = VariableMgr.PACK_VARIABLE_HEADER(var_attr_value, len(default_info.var_name.split(",")), len (default_data), vendorguid)
+ NvStoreDataBuffer += (var_header_buffer + DataBuffer)
+
+ variable_storage_header_buffer = VariableMgr.PACK_VARIABLE_STORE_HEADER(len(NvStoreDataBuffer) + 28)
+
+ nv_default_part = VariableMgr.AlignData(VariableMgr.PACK_DEFAULT_DATA(0, 0, VariableMgr.unpack_data(variable_storage_header_buffer+NvStoreDataBuffer)), 8)
+
+ data_delta_structure_buffer = bytearray()
+ for skuname, defaultstore in var_data:
+ if (skuname, defaultstore) == (DataType.TAB_DEFAULT, DataType.TAB_DEFAULT_STORES_DEFAULT):
+ continue
+ pcds_sku_data = var_data[(skuname, defaultstore)]
+ delta_data_set = []
+ for pcdindex in pcds_sku_data:
+ offset = var_data_offset[pcdindex]
+ delta_data, _ = pcds_sku_data[pcdindex]
+ delta_data = [(item[0] + offset, item[1]) for item in delta_data]
+ delta_data_set.extend(delta_data)
+
+ data_delta_structure_buffer += VariableMgr.AlignData(self.PACK_DELTA_DATA(skuname, defaultstore, delta_data_set), 8)
+
+ size = len(nv_default_part + data_delta_structure_buffer) + 16
+ maxsize = self.VpdRegionSize if self.VpdRegionSize else size
+ NV_Store_Default_Header = VariableMgr.PACK_NV_STORE_DEFAULT_HEADER(size, maxsize)
+
+ self.NVHeaderBuff = NV_Store_Default_Header
+ self.VarDefaultBuff =nv_default_part
+ self.VarDeltaBuff = data_delta_structure_buffer
+ return VariableMgr.format_data(NV_Store_Default_Header + nv_default_part + data_delta_structure_buffer)
+
+
+ @staticmethod
+ def format_data(data):
+ return [hex(item) for item in VariableMgr.unpack_data(data)]
+
+ @staticmethod
+ def unpack_data(data):
+ final_data = ()
+ for item in range(len(data)):
+ final_data += unpack("B", data[item:item + 1])
+ return final_data
+
+ @staticmethod
+ def calculate_delta(default, theother):
+ if len(default) - len(theother) != 0:
+ EdkLogger.error("build", FORMAT_INVALID, 'The variable data length is not the same for the same PCD.')
+ data_delta = []
+ for i in range(len(default)):
+ if default[i] != theother[i]:
+ data_delta.append((i, theother[i]))
+ return data_delta
+
+ def dump(self):
+
+ default_var_bin = self.new_process_varinfo()
+ if default_var_bin:
+ value_str = "{"
+ default_var_bin_strip = [ data.strip("""'""") for data in default_var_bin]
+ value_str += ",".join(default_var_bin_strip)
+ value_str += "}"
+ return value_str
+ return ""
+
+ @staticmethod
+ def PACK_VARIABLE_STORE_HEADER(size):
+ #Signature: gEfiVariableGuid
+ Guid = "{ 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d }}"
+ Guid = GuidStructureStringToGuidString(Guid)
+ GuidBuffer = PackGUID(Guid.split('-'))
+
+ SizeBuffer = pack('=L', size)
+ FormatBuffer = pack('=B', 0x5A)
+ StateBuffer = pack('=B', 0xFE)
+ reservedBuffer = pack('=H', 0)
+ reservedBuffer += pack('=L', 0)
+
+ return GuidBuffer + SizeBuffer + FormatBuffer + StateBuffer + reservedBuffer
+
+ @staticmethod
+ def PACK_NV_STORE_DEFAULT_HEADER(size, maxsize):
+ Signature = pack('=B', ord('N'))
+ Signature += pack("=B", ord('S'))
+ Signature += pack("=B", ord('D'))
+ Signature += pack("=B", ord('B'))
+
+ SizeBuffer = pack("=L", size)
+ MaxSizeBuffer = pack("=Q", maxsize)
+
+ return Signature + SizeBuffer + MaxSizeBuffer
+
+ @staticmethod
+ def PACK_VARIABLE_HEADER(attribute, namesize, datasize, vendorguid):
+
+ Buffer = pack('=H', 0x55AA) # pack StartID
+ Buffer += pack('=B', 0x3F) # pack State
+ Buffer += pack('=B', 0) # pack reserved
+
+ Buffer += pack('=L', attribute)
+ Buffer += pack('=L', namesize)
+ Buffer += pack('=L', datasize)
+
+ Buffer += PackGUID(vendorguid)
+
+ return Buffer
+
+ @staticmethod
+ def PACK_VARIABLES_DATA(var_value,data_type, tail = None):
+ Buffer = bytearray()
+ data_len = 0
+ if data_type == DataType.TAB_VOID:
+ for value_char in var_value.strip("{").strip("}").split(","):
+ Buffer += pack("=B", int(value_char, 16))
+ data_len += len(var_value.split(","))
+ if tail:
+ for value_char in tail.split(","):
+ Buffer += pack("=B", int(value_char, 16))
+ data_len += len(tail.split(","))
+ elif data_type == "BOOLEAN":
+ Buffer += pack("=B", True) if var_value.upper() in ["TRUE","1"] else pack("=B", False)
+ data_len += 1
+ elif data_type == DataType.TAB_UINT8:
+ Buffer += pack("=B", GetIntegerValue(var_value))
+ data_len += 1
+ elif data_type == DataType.TAB_UINT16:
+ Buffer += pack("=H", GetIntegerValue(var_value))
+ data_len += 2
+ elif data_type == DataType.TAB_UINT32:
+ Buffer += pack("=L", GetIntegerValue(var_value))
+ data_len += 4
+ elif data_type == DataType.TAB_UINT64:
+ Buffer += pack("=Q", GetIntegerValue(var_value))
+ data_len += 8
+
+ return Buffer
+
+ @staticmethod
+ def PACK_DEFAULT_DATA(defaultstoragename, skuid, var_value):
+ Buffer = bytearray()
+ Buffer += pack("=L", 4+8+8)
+ Buffer += pack("=Q", int(skuid))
+ Buffer += pack("=Q", int(defaultstoragename))
+
+ for item in var_value:
+ Buffer += pack("=B", item)
+
+ Buffer = pack("=L", len(Buffer)+4) + Buffer
+
+ return Buffer
+
+ def GetSkuId(self, skuname):
+ if skuname not in self.SkuIdMap:
+ return None
+ return self.SkuIdMap.get(skuname)[0]
+
+ def GetDefaultStoreId(self, dname):
+ if dname not in self.DefaultStoreMap:
+ return None
+ return self.DefaultStoreMap.get(dname)[0]
+
+ def PACK_DELTA_DATA(self, skuname, defaultstoragename, delta_list):
+ skuid = self.GetSkuId(skuname)
+ defaultstorageid = self.GetDefaultStoreId(defaultstoragename)
+ Buffer = bytearray()
+ Buffer += pack("=L", 4+8+8)
+ Buffer += pack("=Q", int(skuid))
+ Buffer += pack("=Q", int(defaultstorageid))
+ for (delta_offset, value) in delta_list:
+ Buffer += pack("=L", delta_offset)
+ Buffer = Buffer[:-1] + pack("=B", value)
+
+ Buffer = pack("=L", len(Buffer) + 4) + Buffer
+
+ return Buffer
+
+ @staticmethod
+ def AlignData(data, align = 4):
+ mybuffer = data
+ if (len(data) % align) > 0:
+ for i in range(align - (len(data) % align)):
+ mybuffer += pack("=B", 0)
+
+ return mybuffer
+
+ @staticmethod
+ def PACK_VARIABLE_NAME(var_name):
+ Buffer = bytearray()
+ for name_char in var_name.strip("{").strip("}").split(","):
+ Buffer += pack("=B", int(name_char, 16))
+
+ return Buffer
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/IdfClassObject.py b/roms/edk2/BaseTools/Source/Python/AutoGen/IdfClassObject.py
new file mode 100644
index 000000000..a6b8123c2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/IdfClassObject.py
@@ -0,0 +1,132 @@
+## @file
+# This file is used to collect all defined strings in Image Definition files
+#
+# Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.EdkLogger as EdkLogger
+from Common.BuildToolError import *
+from Common.StringUtils import GetLineNo
+from Common.Misc import PathClass
+from Common.LongFilePathSupport import LongFilePath
+import re
+import os
+from Common.GlobalData import gIdentifierPattern
+from .UniClassObject import StripComments
+
+IMAGE_TOKEN = re.compile('IMAGE_TOKEN *\(([A-Z0-9_]+) *\)', re.MULTILINE | re.UNICODE)
+
+#
+# Value of different image information block types
+#
+EFI_HII_IIBT_END = 0x00
+EFI_HII_IIBT_IMAGE_1BIT = 0x10
+EFI_HII_IIBT_IMAGE_1BIT_TRANS = 0x11
+EFI_HII_IIBT_IMAGE_4BIT = 0x12
+EFI_HII_IIBT_IMAGE_4BIT_TRANS = 0x13
+EFI_HII_IIBT_IMAGE_8BIT = 0x14
+EFI_HII_IIBT_IMAGE_8BIT_TRANS = 0x15
+EFI_HII_IIBT_IMAGE_24BIT = 0x16
+EFI_HII_IIBT_IMAGE_24BIT_TRANS = 0x17
+EFI_HII_IIBT_IMAGE_JPEG = 0x18
+EFI_HII_IIBT_IMAGE_PNG = 0x19
+EFI_HII_IIBT_DUPLICATE = 0x20
+EFI_HII_IIBT_SKIP2 = 0x21
+EFI_HII_IIBT_SKIP1 = 0x22
+EFI_HII_IIBT_EXT1 = 0x30
+EFI_HII_IIBT_EXT2 = 0x31
+EFI_HII_IIBT_EXT4 = 0x32
+
+#
+# Value of HII package type
+#
+EFI_HII_PACKAGE_TYPE_ALL = 0x00
+EFI_HII_PACKAGE_TYPE_GUID = 0x01
+EFI_HII_PACKAGE_FORMS = 0x02
+EFI_HII_PACKAGE_STRINGS = 0x04
+EFI_HII_PACKAGE_FONTS = 0x05
+EFI_HII_PACKAGE_IMAGES = 0x06
+EFI_HII_PACKAGE_SIMPLE_FONTS = 0x07
+EFI_HII_PACKAGE_DEVICE_PATH = 0x08
+EFI_HII_PACKAGE_KEYBOARD_LAYOUT = 0x09
+EFI_HII_PACKAGE_ANIMATIONS = 0x0A
+EFI_HII_PACKAGE_END = 0xDF
+EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN = 0xE0
+EFI_HII_PACKAGE_TYPE_SYSTEM_END = 0xFF
+
+class IdfFileClassObject(object):
+ def __init__(self, FileList = []):
+ self.ImageFilesDict = {}
+ self.ImageIDList = []
+ for File in FileList:
+ if File is None:
+ EdkLogger.error("Image Definition File Parser", PARSER_ERROR, 'No Image definition file is given.')
+
+ try:
+ IdfFile = open(LongFilePath(File.Path), mode='r')
+ FileIn = IdfFile.read()
+ IdfFile.close()
+ except:
+ EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=File)
+
+ ImageFileList = []
+ for Line in FileIn.splitlines():
+ Line = Line.strip()
+ Line = StripComments(Line)
+ if len(Line) == 0:
+ continue
+
+ LineNo = GetLineNo(FileIn, Line, False)
+ if not Line.startswith('#image '):
+ EdkLogger.error("Image Definition File Parser", PARSER_ERROR, 'The %s in Line %s of File %s is invalid.' % (Line, LineNo, File.Path))
+
+ if Line.find('#image ') >= 0:
+ LineDetails = Line.split()
+ Len = len(LineDetails)
+ if Len != 3 and Len != 4:
+ EdkLogger.error("Image Definition File Parser", PARSER_ERROR, 'The format is not match #image IMAGE_ID [TRANSPARENT] ImageFileName in Line %s of File %s.' % (LineNo, File.Path))
+ if Len == 4 and LineDetails[2] != 'TRANSPARENT':
+ EdkLogger.error("Image Definition File Parser", PARSER_ERROR, 'Please use the keyword "TRANSPARENT" to describe the transparency setting in Line %s of File %s.' % (LineNo, File.Path))
+ MatchString = gIdentifierPattern.match(LineDetails[1])
+ if MatchString is None:
+ EdkLogger.error('Image Definition File Parser', FORMAT_INVALID, 'The Image token name %s defined in Idf file %s contains the invalid character.' % (LineDetails[1], File.Path))
+ if LineDetails[1] not in self.ImageIDList:
+ self.ImageIDList.append(LineDetails[1])
+ else:
+ EdkLogger.error("Image Definition File Parser", PARSER_ERROR, 'The %s in Line %s of File %s is already defined.' % (LineDetails[1], LineNo, File.Path))
+ if Len == 4:
+ ImageFile = ImageFileObject(LineDetails[Len-1], LineDetails[1], True)
+ else:
+ ImageFile = ImageFileObject(LineDetails[Len-1], LineDetails[1], False)
+ ImageFileList.append(ImageFile)
+ if ImageFileList:
+ self.ImageFilesDict[File] = ImageFileList
+
+def SearchImageID(ImageFileObject, FileList):
+ if FileList == []:
+ return ImageFileObject
+
+ for File in FileList:
+ if os.path.isfile(File):
+ Lines = open(File, 'r')
+ for Line in Lines:
+ ImageIdList = IMAGE_TOKEN.findall(Line)
+ for ID in ImageIdList:
+ EdkLogger.debug(EdkLogger.DEBUG_5, "Found ImageID identifier: " + ID)
+ ImageFileObject.SetImageIDReferenced(ID)
+
+class ImageFileObject(object):
+ def __init__(self, FileName, ImageID, TransParent = False):
+ self.FileName = FileName
+ self.File = ''
+ self.ImageID = ImageID
+ self.TransParent = TransParent
+ self.Referenced = False
+
+ def SetImageIDReferenced(self, ImageID):
+ if ImageID == self.ImageID:
+ self.Referenced = True
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py b/roms/edk2/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py
new file mode 100644
index 000000000..720d93395
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py
@@ -0,0 +1,295 @@
+## @file
+# Build cache intermediate result and state
+#
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+from Common.caching import cached_property
+import Common.EdkLogger as EdkLogger
+import Common.LongFilePathOs as os
+from Common.BuildToolError import *
+from Common.Misc import SaveFileOnChange, PathClass
+from Common.Misc import TemplateString
+import sys
+gIsFileMap = {}
+
+DEP_FILE_TAIL = "# Updated \n"
+
+class IncludesAutoGen():
+ """ This class is to manage the dependent files witch are used in Makefile to support incremental build.
+ 1. C files:
+ 1. MSVS.
+ cl.exe has a build option /showIncludes to display include files on stdout. Build tool captures
+ that messages and generate dependency files, .deps files.
+ 2. CLANG and GCC
+ -MMD -MF build option are used to generate dependency files by compiler. Build tool updates the
+ .deps files.
+ 2. ASL files:
+ 1. Trim find out all the included files with asl specific include format and generate .trim.deps file.
+ 2. ASL PP use c preprocessor to find out all included files with #include format and generate a .deps file
+ 3. build tool updates the .deps file
+ 3. ASM files (.asm, .s or .nasm):
+ 1. Trim find out all the included files with asl specific include format and generate .trim.deps file.
+ 2. ASM PP use c preprocessor to find out all included files with #include format and generate a deps file
+ 3. build tool updates the .deps file
+ """
+ def __init__(self, makefile_folder, ModuleAuto):
+ self.d_folder = makefile_folder
+ self.makefile_folder = makefile_folder
+ self.module_autogen = ModuleAuto
+ self.ToolChainFamily = ModuleAuto.ToolChainFamily
+ self.workspace = ModuleAuto.WorkspaceDir
+
+ def CreateModuleDeps(self):
+ SaveFileOnChange(os.path.join(self.makefile_folder,"deps.txt"),"\n".join(self.DepsCollection),False)
+
+ def CreateDepsInclude(self):
+ deps_file = {'deps_file':self.deps_files}
+
+ MakePath = self.module_autogen.BuildOption.get('MAKE', {}).get('PATH')
+ if not MakePath:
+ EdkLogger.error("build", PARAMETER_MISSING, Message="No Make path available.")
+ elif "nmake" in MakePath:
+ _INCLUDE_DEPS_TEMPLATE = TemplateString('''
+${BEGIN}
+!IF EXIST(${deps_file})
+!INCLUDE ${deps_file}
+!ENDIF
+${END}
+ ''')
+ else:
+ _INCLUDE_DEPS_TEMPLATE = TemplateString('''
+${BEGIN}
+-include ${deps_file}
+${END}
+ ''')
+
+ try:
+ deps_include_str = _INCLUDE_DEPS_TEMPLATE.Replace(deps_file)
+ except Exception as e:
+ print(e)
+ SaveFileOnChange(os.path.join(self.makefile_folder,"dependency"),deps_include_str,False)
+
+ def CreateDepsTarget(self):
+ SaveFileOnChange(os.path.join(self.makefile_folder,"deps_target"),"\n".join([item +":" for item in self.DepsCollection]),False)
+
+ @cached_property
+ def deps_files(self):
+ """ Get all .deps file under module build folder. """
+ deps_files = []
+ for root, _, files in os.walk(self.d_folder, topdown=False):
+ for name in files:
+ if not name.endswith(".deps"):
+ continue
+ abspath = os.path.join(root, name)
+ deps_files.append(abspath)
+ return deps_files
+
+ @cached_property
+ def DepsCollection(self):
+ """ Collect all the dependency files list from all .deps files under a module's build folder """
+ includes = set()
+ targetname = [item[0].Name for item in self.TargetFileList.values()]
+ for abspath in self.deps_files:
+ try:
+ with open(abspath,"r") as fd:
+ lines = fd.readlines()
+
+ firstlineitems = lines[0].split(": ")
+ dependency_file = firstlineitems[1].strip(" \\\n")
+ dependency_file = dependency_file.strip('''"''')
+ if dependency_file:
+ if os.path.normpath(dependency_file +".deps") == abspath:
+ continue
+ filename = os.path.basename(dependency_file).strip()
+ if filename not in self.SourceFileList and filename not in targetname:
+ includes.add(dependency_file.strip())
+
+ for item in lines[1:]:
+ if item == DEP_FILE_TAIL:
+ continue
+ dependency_file = item.strip(" \\\n")
+ dependency_file = dependency_file.strip('''"''')
+ if dependency_file == '':
+ continue
+ if os.path.normpath(dependency_file +".deps") == abspath:
+ continue
+ filename = os.path.basename(dependency_file).strip()
+ if filename in self.SourceFileList:
+ continue
+ if filename in targetname:
+ continue
+ includes.add(dependency_file.strip())
+ except Exception as e:
+ EdkLogger.error("build",FILE_NOT_FOUND, "%s doesn't exist" % abspath, ExtraData=str(e), RaiseError=False)
+ continue
+ rt = sorted(list(set([item.strip(' " \\\n') for item in includes])))
+ return rt
+
+ @cached_property
+ def SourceFileList(self):
+ """ Get a map of module's source files name to module's source files path """
+ source = {os.path.basename(item.File):item.Path for item in self.module_autogen.SourceFileList}
+ middle_file = {}
+ for afile in source:
+ if afile.upper().endswith(".VFR"):
+ middle_file.update({afile.split(".")[0]+".c":os.path.join(self.module_autogen.DebugDir,afile.split(".")[0]+".c")})
+ if afile.upper().endswith((".S","ASM")):
+ middle_file.update({afile.split(".")[0]+".i":os.path.join(self.module_autogen.OutputDir,afile.split(".")[0]+".i")})
+ if afile.upper().endswith(".ASL"):
+ middle_file.update({afile.split(".")[0]+".i":os.path.join(self.module_autogen.OutputDir,afile.split(".")[0]+".i")})
+ source.update({"AutoGen.c":os.path.join(self.module_autogen.OutputDir,"AutoGen.c")})
+ source.update(middle_file)
+ return source
+
+ @cached_property
+ def HasNamesakeSourceFile(self):
+ source_base_name = set([os.path.basename(item.File) for item in self.module_autogen.SourceFileList])
+ rt = len(source_base_name) != len(self.module_autogen.SourceFileList)
+ return rt
+ @cached_property
+ def CcPPCommandPathSet(self):
+ rt = set()
+ rt.add(self.module_autogen.BuildOption.get('CC',{}).get('PATH'))
+ rt.add(self.module_autogen.BuildOption.get('ASLCC',{}).get('PATH'))
+ rt.add(self.module_autogen.BuildOption.get('ASLPP',{}).get('PATH'))
+ rt.add(self.module_autogen.BuildOption.get('VFRPP',{}).get('PATH'))
+ rt.add(self.module_autogen.BuildOption.get('PP',{}).get('PATH'))
+ rt.add(self.module_autogen.BuildOption.get('APP',{}).get('PATH'))
+ rt.discard(None)
+ return rt
+ @cached_property
+ def TargetFileList(self):
+ """ Get a map of module's target name to a tuple of module's targets path and whose input file path """
+ targets = {}
+ targets["AutoGen.obj"] = (PathClass(os.path.join(self.module_autogen.OutputDir,"AutoGen.obj")),PathClass(os.path.join(self.module_autogen.DebugDir,"AutoGen.c")))
+ for item in self.module_autogen.Targets.values():
+ for block in item:
+ targets[block.Target.Path] = (block.Target,block.Inputs[0])
+ return targets
+
+ def GetRealTarget(self,source_file_abs):
+ """ Get the final target file based on source file abspath """
+ source_target_map = {item[1].Path:item[0].Path for item in self.TargetFileList.values()}
+ source_name_map = {item[1].File:item[0].Path for item in self.TargetFileList.values()}
+ target_abs = source_target_map.get(source_file_abs)
+ if target_abs is None:
+ if source_file_abs.strip().endswith(".i"):
+ sourcefilename = os.path.basename(source_file_abs.strip())
+ for sourcefile in source_name_map:
+ if sourcefilename.split(".")[0] == sourcefile.split(".")[0]:
+ target_abs = source_name_map[sourcefile]
+ break
+ else:
+ target_abs = source_file_abs
+ else:
+ target_abs = source_file_abs
+ return target_abs
+
+ def CreateDepsFileForMsvc(self, DepList):
+ """ Generate dependency files, .deps file from /showIncludes output message """
+ if not DepList:
+ return
+ ModuleDepDict = {}
+ current_source = ""
+ SourceFileAbsPathMap = self.SourceFileList
+ for line in DepList:
+ line = line.strip()
+ if self.HasNamesakeSourceFile:
+ for cc_cmd in self.CcPPCommandPathSet:
+ if cc_cmd in line:
+ if '''"'''+cc_cmd+'''"''' in line:
+ cc_options = line[len(cc_cmd)+2:].split()
+ else:
+ cc_options = line[len(cc_cmd):].split()
+ SourceFileAbsPathMap = {os.path.basename(item):item for item in cc_options if not item.startswith("/") and os.path.exists(item)}
+ if line in SourceFileAbsPathMap:
+ current_source = line
+ if current_source not in ModuleDepDict:
+ ModuleDepDict[SourceFileAbsPathMap[current_source]] = []
+ elif "Note: including file:" == line.lstrip()[:21]:
+ if not current_source:
+ EdkLogger.error("build",BUILD_ERROR, "Parse /showIncludes output failed. line: %s. \n" % line, RaiseError=False)
+ else:
+ ModuleDepDict[SourceFileAbsPathMap[current_source]].append(line.lstrip()[22:].strip())
+
+ for source_abs in ModuleDepDict:
+ if ModuleDepDict[source_abs]:
+ target_abs = self.GetRealTarget(source_abs)
+ dep_file_name = os.path.basename(source_abs) + ".deps"
+ SaveFileOnChange(os.path.join(os.path.dirname(target_abs),dep_file_name)," \\\n".join([target_abs+":"] + ['''"''' + item +'''"''' for item in ModuleDepDict[source_abs]]),False)
+
+ def UpdateDepsFileforNonMsvc(self):
+ """ Update .deps files.
+ 1. Update target path to absolute path.
+ 2. Update middle target to final target.
+ """
+
+ for abspath in self.deps_files:
+ if abspath.endswith(".trim.deps"):
+ continue
+ try:
+ newcontent = []
+ with open(abspath,"r") as fd:
+ lines = fd.readlines()
+ if lines[-1] == DEP_FILE_TAIL:
+ continue
+ firstlineitems = lines[0].strip().split(" ")
+
+ if len(firstlineitems) > 2:
+ sourceitem = firstlineitems[1]
+ else:
+ sourceitem = lines[1].strip().split(" ")[0]
+
+ source_abs = self.SourceFileList.get(sourceitem,sourceitem)
+ firstlineitems[0] = self.GetRealTarget(source_abs)
+ p_target = firstlineitems
+ if not p_target[0].strip().endswith(":"):
+ p_target[0] += ": "
+
+ if len(p_target) == 2:
+ p_target[0] += lines[1]
+ newcontent.append(p_target[0])
+ newcontent.extend(lines[2:])
+ else:
+ line1 = " ".join(p_target).strip()
+ line1 += "\n"
+ newcontent.append(line1)
+ newcontent.extend(lines[1:])
+
+ newcontent.append("\n")
+ newcontent.append(DEP_FILE_TAIL)
+ with open(abspath,"w") as fw:
+ fw.write("".join(newcontent))
+ except Exception as e:
+ EdkLogger.error("build",FILE_NOT_FOUND, "%s doesn't exist" % abspath, ExtraData=str(e), RaiseError=False)
+ continue
+
+ def UpdateDepsFileforTrim(self):
+ """ Update .deps file which generated by trim. """
+
+ for abspath in self.deps_files:
+ if not abspath.endswith(".trim.deps"):
+ continue
+ try:
+ newcontent = []
+ with open(abspath,"r") as fd:
+ lines = fd.readlines()
+ if lines[-1] == DEP_FILE_TAIL:
+ continue
+
+ source_abs = lines[0].strip().split(" ")[0]
+ targetitem = self.GetRealTarget(source_abs.strip(" :"))
+
+ targetitem += ": "
+ targetitem += lines[1]
+ newcontent.append(targetitem)
+ newcontent.extend(lines[2:])
+ newcontent.append("\n")
+ newcontent.append(DEP_FILE_TAIL)
+ with open(abspath,"w") as fw:
+ fw.write("".join(newcontent))
+ except Exception as e:
+ EdkLogger.error("build",FILE_NOT_FOUND, "%s doesn't exist" % abspath, ExtraData=str(e), RaiseError=False)
+ continue
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/InfSectionParser.py b/roms/edk2/BaseTools/Source/Python/AutoGen/InfSectionParser.py
new file mode 100644
index 000000000..a55ddac34
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/InfSectionParser.py
@@ -0,0 +1,119 @@
+## @file
+# Parser a Inf file and Get specify section data.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+## Import Modules
+#
+
+import Common.EdkLogger as EdkLogger
+from Common.BuildToolError import *
+from Common.DataType import *
+
+
+class InfSectionParser():
+ def __init__(self, FilePath):
+ self._FilePath = FilePath
+ self._FileSectionDataList = []
+ self._ParserInf()
+
+ def _ParserInf(self):
+ FileLinesList = []
+ UserExtFind = False
+ FindEnd = True
+ FileLastLine = False
+ SectionLine = ''
+ SectionData = []
+
+ try:
+ with open(self._FilePath, "r") as File:
+ FileLinesList = File.readlines()
+ except BaseException:
+ EdkLogger.error("build", AUTOGEN_ERROR, 'File %s is opened failed.' % self._FilePath)
+
+ for Index in range(0, len(FileLinesList)):
+ line = str(FileLinesList[Index]).strip()
+ if Index + 1 == len(FileLinesList):
+ FileLastLine = True
+ NextLine = ''
+ else:
+ NextLine = str(FileLinesList[Index + 1]).strip()
+ if UserExtFind and FindEnd == False:
+ if line:
+ SectionData.append(line)
+ if line.startswith(TAB_SECTION_START) and line.endswith(TAB_SECTION_END):
+ SectionLine = line
+ UserExtFind = True
+ FindEnd = False
+
+ if (NextLine != '' and NextLine[0] == TAB_SECTION_START and \
+ NextLine[-1] == TAB_SECTION_END) or FileLastLine:
+ UserExtFind = False
+ FindEnd = True
+ self._FileSectionDataList.append({SectionLine: SectionData[:]})
+ del SectionData[:]
+ SectionLine = ''
+
+ # Get user extension TianoCore data
+ #
+ # @return: a list include some dictionary that key is section and value is a list contain all data.
+ def GetUserExtensionTianoCore(self):
+ UserExtensionTianoCore = []
+ if not self._FileSectionDataList:
+ return UserExtensionTianoCore
+ for SectionDataDict in self._FileSectionDataList:
+ for key in SectionDataDict:
+ if key.lower().startswith("[userextensions") and key.lower().find('.tianocore.') > -1:
+ SectionLine = key.lstrip(TAB_SECTION_START).rstrip(TAB_SECTION_END)
+ SubSectionList = [SectionLine]
+ if str(SectionLine).find(TAB_COMMA_SPLIT) > -1:
+ SubSectionList = str(SectionLine).split(TAB_COMMA_SPLIT)
+ for SubSection in SubSectionList:
+ if SubSection.lower().find('.tianocore.') > -1:
+ UserExtensionTianoCore.append({SubSection: SectionDataDict[key]})
+ return UserExtensionTianoCore
+
+ # Get depex expression
+ #
+ # @return: a list include some dictionary that key is section and value is a list contain all data.
+ def GetDepexExpresionList(self):
+ DepexExpressionList = []
+ if not self._FileSectionDataList:
+ return DepexExpressionList
+ for SectionDataDict in self._FileSectionDataList:
+ for key in SectionDataDict:
+ if key.lower() == "[depex]" or key.lower().startswith("[depex."):
+ SectionLine = key.lstrip(TAB_SECTION_START).rstrip(TAB_SECTION_END)
+ SubSectionList = [SectionLine]
+ if str(SectionLine).find(TAB_COMMA_SPLIT) > -1:
+ SubSectionList = str(SectionLine).split(TAB_COMMA_SPLIT)
+ for SubSection in SubSectionList:
+ SectionList = SubSection.split(TAB_SPLIT)
+ SubKey = ()
+ if len(SectionList) == 1:
+ SubKey = (TAB_ARCH_COMMON, TAB_ARCH_COMMON)
+ elif len(SectionList) == 2:
+ SubKey = (SectionList[1], TAB_ARCH_COMMON)
+ elif len(SectionList) == 3:
+ SubKey = (SectionList[1], SectionList[2])
+ else:
+ EdkLogger.error("build", AUTOGEN_ERROR, 'Section %s is invalid.' % key)
+ DepexExpressionList.append({SubKey: SectionDataDict[key]})
+ return DepexExpressionList
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/roms/edk2/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
new file mode 100755
index 000000000..dc8b1fe3d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -0,0 +1,2459 @@
+## @file
+# Create makefile for MS nmake and GNU make
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+from __future__ import absolute_import
+from AutoGen.AutoGen import AutoGen
+from Common.LongFilePathSupport import LongFilePath, CopyLongFilePath
+from Common.BuildToolError import *
+from Common.DataType import *
+from Common.Misc import *
+from Common.StringUtils import NormPath,GetSplitList
+from collections import defaultdict
+from Workspace.WorkspaceCommon import OrderedListDict
+import os.path as path
+import copy
+import hashlib
+from . import InfSectionParser
+from . import GenC
+from . import GenMake
+from . import GenDepex
+from io import BytesIO
+from GenPatchPcdTable.GenPatchPcdTable import parsePcdInfoFromMapFile
+from Workspace.MetaFileCommentParser import UsageList
+from .GenPcdDb import CreatePcdDatabaseCode
+from Common.caching import cached_class_function
+from AutoGen.ModuleAutoGenHelper import PlatformInfo,WorkSpaceInfo
+import json
+import tempfile
+
+## Mapping Makefile type
+gMakeTypeMap = {TAB_COMPILER_MSFT:"nmake", "GCC":"gmake"}
+#
+# Regular expression for finding Include Directories, the difference between MSFT and INTEL/GCC/RVCT
+# is the former use /I , the Latter used -I to specify include directories
+#
+gBuildOptIncludePatternMsft = re.compile(r"(?:.*?)/I[ \t]*([^ ]*)", re.MULTILINE | re.DOTALL)
+gBuildOptIncludePatternOther = re.compile(r"(?:.*?)-I[ \t]*([^ ]*)", re.MULTILINE | re.DOTALL)
+
+## default file name for AutoGen
+gAutoGenCodeFileName = "AutoGen.c"
+gAutoGenHeaderFileName = "AutoGen.h"
+gAutoGenStringFileName = "%(module_name)sStrDefs.h"
+gAutoGenStringFormFileName = "%(module_name)sStrDefs.hpk"
+gAutoGenDepexFileName = "%(module_name)s.depex"
+gAutoGenImageDefFileName = "%(module_name)sImgDefs.h"
+gAutoGenIdfFileName = "%(module_name)sIdf.hpk"
+gInfSpecVersion = "0x00010017"
+
+#
+# Match name = variable
+#
+gEfiVarStoreNamePattern = re.compile("\s*name\s*=\s*(\w+)")
+#
+# The format of guid in efivarstore statement likes following and must be correct:
+# guid = {0xA04A27f4, 0xDF00, 0x4D42, {0xB5, 0x52, 0x39, 0x51, 0x13, 0x02, 0x11, 0x3D}}
+#
+gEfiVarStoreGuidPattern = re.compile("\s*guid\s*=\s*({.*?{.*?}\s*})")
+
+#
+# Template string to generic AsBuilt INF
+#
+gAsBuiltInfHeaderString = TemplateString("""${header_comments}
+
+# DO NOT EDIT
+# FILE auto-generated
+
+[Defines]
+ INF_VERSION = ${module_inf_version}
+ BASE_NAME = ${module_name}
+ FILE_GUID = ${module_guid}
+ MODULE_TYPE = ${module_module_type}${BEGIN}
+ VERSION_STRING = ${module_version_string}${END}${BEGIN}
+ PCD_IS_DRIVER = ${pcd_is_driver_string}${END}${BEGIN}
+ UEFI_SPECIFICATION_VERSION = ${module_uefi_specification_version}${END}${BEGIN}
+ PI_SPECIFICATION_VERSION = ${module_pi_specification_version}${END}${BEGIN}
+ ENTRY_POINT = ${module_entry_point}${END}${BEGIN}
+ UNLOAD_IMAGE = ${module_unload_image}${END}${BEGIN}
+ CONSTRUCTOR = ${module_constructor}${END}${BEGIN}
+ DESTRUCTOR = ${module_destructor}${END}${BEGIN}
+ SHADOW = ${module_shadow}${END}${BEGIN}
+ PCI_VENDOR_ID = ${module_pci_vendor_id}${END}${BEGIN}
+ PCI_DEVICE_ID = ${module_pci_device_id}${END}${BEGIN}
+ PCI_CLASS_CODE = ${module_pci_class_code}${END}${BEGIN}
+ PCI_REVISION = ${module_pci_revision}${END}${BEGIN}
+ BUILD_NUMBER = ${module_build_number}${END}${BEGIN}
+ SPEC = ${module_spec}${END}${BEGIN}
+ UEFI_HII_RESOURCE_SECTION = ${module_uefi_hii_resource_section}${END}${BEGIN}
+ MODULE_UNI_FILE = ${module_uni_file}${END}
+
+[Packages.${module_arch}]${BEGIN}
+ ${package_item}${END}
+
+[Binaries.${module_arch}]${BEGIN}
+ ${binary_item}${END}
+
+[PatchPcd.${module_arch}]${BEGIN}
+ ${patchablepcd_item}
+${END}
+
+[Protocols.${module_arch}]${BEGIN}
+ ${protocol_item}
+${END}
+
+[Ppis.${module_arch}]${BEGIN}
+ ${ppi_item}
+${END}
+
+[Guids.${module_arch}]${BEGIN}
+ ${guid_item}
+${END}
+
+[PcdEx.${module_arch}]${BEGIN}
+ ${pcd_item}
+${END}
+
+[LibraryClasses.${module_arch}]
+## @LIB_INSTANCES${BEGIN}
+# ${libraryclasses_item}${END}
+
+${depexsection_item}
+
+${userextension_tianocore_item}
+
+${tail_comments}
+
+[BuildOptions.${module_arch}]
+## @AsBuilt${BEGIN}
+## ${flags_item}${END}
+""")
+#
+# extend lists contained in a dictionary with lists stored in another dictionary
+# if CopyToDict is not derived from DefaultDict(list) then this may raise exception
+#
+def ExtendCopyDictionaryLists(CopyToDict, CopyFromDict):
+ for Key in CopyFromDict:
+ CopyToDict[Key].extend(CopyFromDict[Key])
+
+# Create a directory specified by a set of path elements and return the full path
+def _MakeDir(PathList):
+ RetVal = path.join(*PathList)
+ CreateDirectory(RetVal)
+ return RetVal
+
+#
+# Convert string to C format array
+#
+def _ConvertStringToByteArray(Value):
+ Value = Value.strip()
+ if not Value:
+ return None
+ if Value[0] == '{':
+ if not Value.endswith('}'):
+ return None
+ Value = Value.replace(' ', '').replace('{', '').replace('}', '')
+ ValFields = Value.split(',')
+ try:
+ for Index in range(len(ValFields)):
+ ValFields[Index] = str(int(ValFields[Index], 0))
+ except ValueError:
+ return None
+ Value = '{' + ','.join(ValFields) + '}'
+ return Value
+
+ Unicode = False
+ if Value.startswith('L"'):
+ if not Value.endswith('"'):
+ return None
+ Value = Value[1:]
+ Unicode = True
+ elif not Value.startswith('"') or not Value.endswith('"'):
+ return None
+
+ Value = eval(Value) # translate escape character
+ NewValue = '{'
+ for Index in range(0, len(Value)):
+ if Unicode:
+ NewValue = NewValue + str(ord(Value[Index]) % 0x10000) + ','
+ else:
+ NewValue = NewValue + str(ord(Value[Index]) % 0x100) + ','
+ Value = NewValue + '0}'
+ return Value
+
+## ModuleAutoGen class
+#
+# This class encapsules the AutoGen behaviors for the build tools. In addition to
+# the generation of AutoGen.h and AutoGen.c, it will generate *.depex file according
+# to the [depex] section in module's inf file.
+#
+class ModuleAutoGen(AutoGen):
+ # call super().__init__ then call the worker function with different parameter count
+ def __init__(self, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs):
+ if not hasattr(self, "_Init"):
+ self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch, *args)
+ self._Init = True
+
+ ## Cache the timestamps of metafiles of every module in a class attribute
+ #
+ TimeDict = {}
+
+ def __new__(cls, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs):
+# check if this module is employed by active platform
+ if not PlatformInfo(Workspace, args[0], Target, Toolchain, Arch,args[-1]).ValidModule(MetaFile):
+ EdkLogger.verbose("Module [%s] for [%s] is not employed by active platform\n" \
+ % (MetaFile, Arch))
+ return None
+ return super(ModuleAutoGen, cls).__new__(cls, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
+
+ ## Initialize ModuleAutoGen
+ #
+ # @param Workspace EdkIIWorkspaceBuild object
+ # @param ModuleFile The path of module file
+ # @param Target Build target (DEBUG, RELEASE)
+ # @param Toolchain Name of tool chain
+ # @param Arch The arch the module supports
+ # @param PlatformFile Platform meta-file
+ #
+ def _InitWorker(self, Workspace, ModuleFile, Target, Toolchain, Arch, PlatformFile,DataPipe):
+ EdkLogger.debug(EdkLogger.DEBUG_9, "AutoGen module [%s] [%s]" % (ModuleFile, Arch))
+ GlobalData.gProcessingFile = "%s [%s, %s, %s]" % (ModuleFile, Arch, Toolchain, Target)
+
+ self.Workspace = Workspace
+ self.WorkspaceDir = ""
+ self.PlatformInfo = None
+ self.DataPipe = DataPipe
+ self.__init_platform_info__()
+ self.MetaFile = ModuleFile
+ self.SourceDir = self.MetaFile.SubDir
+ self.SourceDir = mws.relpath(self.SourceDir, self.WorkspaceDir)
+
+ self.ToolChain = Toolchain
+ self.BuildTarget = Target
+ self.Arch = Arch
+ self.ToolChainFamily = self.PlatformInfo.ToolChainFamily
+ self.BuildRuleFamily = self.PlatformInfo.BuildRuleFamily
+
+ self.IsCodeFileCreated = False
+ self.IsAsBuiltInfCreated = False
+ self.DepexGenerated = False
+
+ self.BuildDatabase = self.Workspace.BuildDatabase
+ self.BuildRuleOrder = None
+ self.BuildTime = 0
+
+ self._GuidComments = OrderedListDict()
+ self._ProtocolComments = OrderedListDict()
+ self._PpiComments = OrderedListDict()
+ self._BuildTargets = None
+ self._IntroBuildTargetList = None
+ self._FinalBuildTargetList = None
+ self._FileTypes = None
+
+ self.AutoGenDepSet = set()
+ self.ReferenceModules = []
+ self.ConstPcd = {}
+ self.Makefile = None
+ self.FileDependCache = {}
+
+ def __init_platform_info__(self):
+ pinfo = self.DataPipe.Get("P_Info")
+ self.WorkspaceDir = pinfo.get("WorkspaceDir")
+ self.PlatformInfo = PlatformInfo(self.Workspace,pinfo.get("ActivePlatform"),pinfo.get("Target"),pinfo.get("ToolChain"),pinfo.get("Arch"),self.DataPipe)
+ ## hash() operator of ModuleAutoGen
+ #
+ # The module file path and arch string will be used to represent
+ # hash value of this object
+ #
+ # @retval int Hash value of the module file path and arch
+ #
+ @cached_class_function
+ def __hash__(self):
+ return hash((self.MetaFile, self.Arch, self.ToolChain,self.BuildTarget))
+ def __repr__(self):
+ return "%s [%s]" % (self.MetaFile, self.Arch)
+
+ # Get FixedAtBuild Pcds of this Module
+ @cached_property
+ def FixedAtBuildPcds(self):
+ RetVal = []
+ for Pcd in self.ModulePcdList:
+ if Pcd.Type != TAB_PCDS_FIXED_AT_BUILD:
+ continue
+ if Pcd not in RetVal:
+ RetVal.append(Pcd)
+ return RetVal
+
+ @cached_property
+ def FixedVoidTypePcds(self):
+ RetVal = {}
+ for Pcd in self.FixedAtBuildPcds:
+ if Pcd.DatumType == TAB_VOID:
+ if '.'.join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) not in RetVal:
+ RetVal['.'.join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))] = Pcd.DefaultValue
+ return RetVal
+
+ @property
+ def UniqueBaseName(self):
+ ModuleNames = self.DataPipe.Get("M_Name")
+ if not ModuleNames:
+ return self.Name
+ return ModuleNames.get((self.Name,self.MetaFile),self.Name)
+
+ # Macros could be used in build_rule.txt (also Makefile)
+ @cached_property
+ def Macros(self):
+ return OrderedDict((
+ ("WORKSPACE" ,self.WorkspaceDir),
+ ("MODULE_NAME" ,self.Name),
+ ("MODULE_NAME_GUID" ,self.UniqueBaseName),
+ ("MODULE_GUID" ,self.Guid),
+ ("MODULE_VERSION" ,self.Version),
+ ("MODULE_TYPE" ,self.ModuleType),
+ ("MODULE_FILE" ,str(self.MetaFile)),
+ ("MODULE_FILE_BASE_NAME" ,self.MetaFile.BaseName),
+ ("MODULE_RELATIVE_DIR" ,self.SourceDir),
+ ("MODULE_DIR" ,self.SourceDir),
+ ("BASE_NAME" ,self.Name),
+ ("ARCH" ,self.Arch),
+ ("TOOLCHAIN" ,self.ToolChain),
+ ("TOOLCHAIN_TAG" ,self.ToolChain),
+ ("TOOL_CHAIN_TAG" ,self.ToolChain),
+ ("TARGET" ,self.BuildTarget),
+ ("BUILD_DIR" ,self.PlatformInfo.BuildDir),
+ ("BIN_DIR" ,os.path.join(self.PlatformInfo.BuildDir, self.Arch)),
+ ("LIB_DIR" ,os.path.join(self.PlatformInfo.BuildDir, self.Arch)),
+ ("MODULE_BUILD_DIR" ,self.BuildDir),
+ ("OUTPUT_DIR" ,self.OutputDir),
+ ("DEBUG_DIR" ,self.DebugDir),
+ ("DEST_DIR_OUTPUT" ,self.OutputDir),
+ ("DEST_DIR_DEBUG" ,self.DebugDir),
+ ("PLATFORM_NAME" ,self.PlatformInfo.Name),
+ ("PLATFORM_GUID" ,self.PlatformInfo.Guid),
+ ("PLATFORM_VERSION" ,self.PlatformInfo.Version),
+ ("PLATFORM_RELATIVE_DIR" ,self.PlatformInfo.SourceDir),
+ ("PLATFORM_DIR" ,mws.join(self.WorkspaceDir, self.PlatformInfo.SourceDir)),
+ ("PLATFORM_OUTPUT_DIR" ,self.PlatformInfo.OutputDir),
+ ("FFS_OUTPUT_DIR" ,self.FfsOutputDir)
+ ))
+
+ ## Return the module build data object
+ @cached_property
+ def Module(self):
+ return self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]
+
+ ## Return the module name
+ @cached_property
+ def Name(self):
+ return self.Module.BaseName
+
+ ## Return the module DxsFile if exist
+ @cached_property
+ def DxsFile(self):
+ return self.Module.DxsFile
+
+ ## Return the module meta-file GUID
+ @cached_property
+ def Guid(self):
+ #
+ # To build same module more than once, the module path with FILE_GUID overridden has
+ # the file name FILE_GUIDmodule.inf, but the relative path (self.MetaFile.File) is the real path
+ # in DSC. The overridden GUID can be retrieved from file name
+ #
+ if os.path.basename(self.MetaFile.File) != os.path.basename(self.MetaFile.Path):
+ #
+ # Length of GUID is 36
+ #
+ return os.path.basename(self.MetaFile.Path)[:36]
+ return self.Module.Guid
+
+ ## Return the module version
+ @cached_property
+ def Version(self):
+ return self.Module.Version
+
+ ## Return the module type
+ @cached_property
+ def ModuleType(self):
+ return self.Module.ModuleType
+
+ ## Return the component type (for Edk.x style of module)
+ @cached_property
+ def ComponentType(self):
+ return self.Module.ComponentType
+
+ ## Return the build type
+ @cached_property
+ def BuildType(self):
+ return self.Module.BuildType
+
+ ## Return the PCD_IS_DRIVER setting
+ @cached_property
+ def PcdIsDriver(self):
+ return self.Module.PcdIsDriver
+
+ ## Return the autogen version, i.e. module meta-file version
+ @cached_property
+ def AutoGenVersion(self):
+ return self.Module.AutoGenVersion
+
+ ## Check if the module is library or not
+ @cached_property
+ def IsLibrary(self):
+ return bool(self.Module.LibraryClass)
+
+ ## Check if the module is binary module or not
+ @cached_property
+ def IsBinaryModule(self):
+ return self.Module.IsBinaryModule
+
+ ## Return the directory to store intermediate files of the module
+ @cached_property
+ def BuildDir(self):
+ return _MakeDir((
+ self.PlatformInfo.BuildDir,
+ self.Arch,
+ self.SourceDir,
+ self.MetaFile.BaseName
+ ))
+
+ ## Return the directory to store the intermediate object files of the module
+ @cached_property
+ def OutputDir(self):
+ return _MakeDir((self.BuildDir, "OUTPUT"))
+
+ ## Return the directory path to store ffs file
+ @cached_property
+ def FfsOutputDir(self):
+ if GlobalData.gFdfParser:
+ return path.join(self.PlatformInfo.BuildDir, TAB_FV_DIRECTORY, "Ffs", self.Guid + self.Name)
+ return ''
+
+ ## Return the directory to store auto-gened source files of the module
+ @cached_property
+ def DebugDir(self):
+ return _MakeDir((self.BuildDir, "DEBUG"))
+
+ ## Return the path of custom file
+ @cached_property
+ def CustomMakefile(self):
+ RetVal = {}
+ for Type in self.Module.CustomMakefile:
+ MakeType = gMakeTypeMap[Type] if Type in gMakeTypeMap else 'nmake'
+ File = os.path.join(self.SourceDir, self.Module.CustomMakefile[Type])
+ RetVal[MakeType] = File
+ return RetVal
+
+ ## Return the directory of the makefile
+ #
+ # @retval string The directory string of module's makefile
+ #
+ @cached_property
+ def MakeFileDir(self):
+ return self.BuildDir
+
+ ## Return build command string
+ #
+ # @retval string Build command string
+ #
+ @cached_property
+ def BuildCommand(self):
+ return self.PlatformInfo.BuildCommand
+
+ ## Get Module package and Platform package
+ #
+ # @retval list The list of package object
+ #
+ @cached_property
+ def PackageList(self):
+ PkagList = []
+ if self.Module.Packages:
+ PkagList.extend(self.Module.Packages)
+ Platform = self.BuildDatabase[self.PlatformInfo.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]
+ for Package in Platform.Packages:
+ if Package in PkagList:
+ continue
+ PkagList.append(Package)
+ return PkagList
+
+ ## Get object list of all packages the module and its dependent libraries belong to and the Platform depends on
+ #
+ # @retval list The list of package object
+ #
+ @cached_property
+ def DerivedPackageList(self):
+ PackageList = []
+ PackageList.extend(self.PackageList)
+ for M in self.DependentLibraryList:
+ for Package in M.Packages:
+ if Package in PackageList:
+ continue
+ PackageList.append(Package)
+ return PackageList
+
+ ## Get the depex string
+ #
+ # @return : a string contain all depex expression.
+ def _GetDepexExpresionString(self):
+ DepexStr = ''
+ DepexList = []
+ ## DPX_SOURCE IN Define section.
+ if self.Module.DxsFile:
+ return DepexStr
+ for M in [self.Module] + self.DependentLibraryList:
+ Filename = M.MetaFile.Path
+ InfObj = InfSectionParser.InfSectionParser(Filename)
+ DepexExpressionList = InfObj.GetDepexExpresionList()
+ for DepexExpression in DepexExpressionList:
+ for key in DepexExpression:
+ Arch, ModuleType = key
+ DepexExpr = [x for x in DepexExpression[key] if not str(x).startswith('#')]
+ # the type of build module is USER_DEFINED.
+ # All different DEPEX section tags would be copied into the As Built INF file
+ # and there would be separate DEPEX section tags
+ if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED or self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
+ if (Arch.upper() == self.Arch.upper()) and (ModuleType.upper() != TAB_ARCH_COMMON):
+ DepexList.append({(Arch, ModuleType): DepexExpr})
+ else:
+ if Arch.upper() == TAB_ARCH_COMMON or \
+ (Arch.upper() == self.Arch.upper() and \
+ ModuleType.upper() in [TAB_ARCH_COMMON, self.ModuleType.upper()]):
+ DepexList.append({(Arch, ModuleType): DepexExpr})
+
+ #the type of build module is USER_DEFINED.
+ if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED or self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
+ for Depex in DepexList:
+ for key in Depex:
+ DepexStr += '[Depex.%s.%s]\n' % key
+ DepexStr += '\n'.join('# '+ val for val in Depex[key])
+ DepexStr += '\n\n'
+ if not DepexStr:
+ return '[Depex.%s]\n' % self.Arch
+ return DepexStr
+
+ #the type of build module not is USER_DEFINED.
+ Count = 0
+ for Depex in DepexList:
+ Count += 1
+ if DepexStr != '':
+ DepexStr += ' AND '
+ DepexStr += '('
+ for D in Depex.values():
+ DepexStr += ' '.join(val for val in D)
+ Index = DepexStr.find('END')
+ if Index > -1 and Index == len(DepexStr) - 3:
+ DepexStr = DepexStr[:-3]
+ DepexStr = DepexStr.strip()
+ DepexStr += ')'
+ if Count == 1:
+ DepexStr = DepexStr.lstrip('(').rstrip(')').strip()
+ if not DepexStr:
+ return '[Depex.%s]\n' % self.Arch
+ return '[Depex.%s]\n# ' % self.Arch + DepexStr
+
+ ## Merge dependency expression
+ #
+ # @retval list The token list of the dependency expression after parsed
+ #
+ @cached_property
+ def DepexList(self):
+ if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
+ return {}
+
+ DepexList = []
+ #
+ # Append depex from dependent libraries, if not "BEFORE", "AFTER" expression
+ #
+ FixedVoidTypePcds = {}
+ for M in [self] + self.LibraryAutoGenList:
+ FixedVoidTypePcds.update(M.FixedVoidTypePcds)
+ for M in [self] + self.LibraryAutoGenList:
+ Inherited = False
+ for D in M.Module.Depex[self.Arch, self.ModuleType]:
+ if DepexList != []:
+ DepexList.append('AND')
+ DepexList.append('(')
+ #replace D with value if D is FixedAtBuild PCD
+ NewList = []
+ for item in D:
+ if '.' not in item:
+ NewList.append(item)
+ else:
+ try:
+ Value = FixedVoidTypePcds[item]
+ if len(Value.split(',')) != 16:
+ EdkLogger.error("build", FORMAT_INVALID,
+ "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type and 16 bytes in the module.".format(item))
+ NewList.append(Value)
+ except:
+ EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module.".format(item))
+
+ DepexList.extend(NewList)
+ if DepexList[-1] == 'END': # no need of a END at this time
+ DepexList.pop()
+ DepexList.append(')')
+ Inherited = True
+ if Inherited:
+ EdkLogger.verbose("DEPEX[%s] (+%s) = %s" % (self.Name, M.Module.BaseName, DepexList))
+ if 'BEFORE' in DepexList or 'AFTER' in DepexList:
+ break
+ if len(DepexList) > 0:
+ EdkLogger.verbose('')
+ return {self.ModuleType:DepexList}
+
+ ## Merge dependency expression
+ #
+ # @retval list The token list of the dependency expression after parsed
+ #
+ @cached_property
+ def DepexExpressionDict(self):
+ if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
+ return {}
+
+ DepexExpressionString = ''
+ #
+ # Append depex from dependent libraries, if not "BEFORE", "AFTER" expresion
+ #
+ for M in [self.Module] + self.DependentLibraryList:
+ Inherited = False
+ for D in M.DepexExpression[self.Arch, self.ModuleType]:
+ if DepexExpressionString != '':
+ DepexExpressionString += ' AND '
+ DepexExpressionString += '('
+ DepexExpressionString += D
+ DepexExpressionString = DepexExpressionString.rstrip('END').strip()
+ DepexExpressionString += ')'
+ Inherited = True
+ if Inherited:
+ EdkLogger.verbose("DEPEX[%s] (+%s) = %s" % (self.Name, M.BaseName, DepexExpressionString))
+ if 'BEFORE' in DepexExpressionString or 'AFTER' in DepexExpressionString:
+ break
+ if len(DepexExpressionString) > 0:
+ EdkLogger.verbose('')
+
+ return {self.ModuleType:DepexExpressionString}
+
+ # Get the tiano core user extension, it is contain dependent library.
+ # @retval: a list contain tiano core userextension.
+ #
+ def _GetTianoCoreUserExtensionList(self):
+ TianoCoreUserExtentionList = []
+ for M in [self.Module] + self.DependentLibraryList:
+ Filename = M.MetaFile.Path
+ InfObj = InfSectionParser.InfSectionParser(Filename)
+ TianoCoreUserExtenList = InfObj.GetUserExtensionTianoCore()
+ for TianoCoreUserExtent in TianoCoreUserExtenList:
+ for Section in TianoCoreUserExtent:
+ ItemList = Section.split(TAB_SPLIT)
+ Arch = self.Arch
+ if len(ItemList) == 4:
+ Arch = ItemList[3]
+ if Arch.upper() == TAB_ARCH_COMMON or Arch.upper() == self.Arch.upper():
+ TianoCoreList = []
+ TianoCoreList.extend([TAB_SECTION_START + Section + TAB_SECTION_END])
+ TianoCoreList.extend(TianoCoreUserExtent[Section][:])
+ TianoCoreList.append('\n')
+ TianoCoreUserExtentionList.append(TianoCoreList)
+
+ return TianoCoreUserExtentionList
+
+ ## Return the list of specification version required for the module
+ #
+ # @retval list The list of specification defined in module file
+ #
+ @cached_property
+ def Specification(self):
+ return self.Module.Specification
+
+ ## Tool option for the module build
+ #
+ # @param PlatformInfo The object of PlatformBuildInfo
+ # @retval dict The dict containing valid options
+ #
+ @cached_property
+ def BuildOption(self):
+ RetVal, self.BuildRuleOrder = self.PlatformInfo.ApplyBuildOption(self.Module)
+ if self.BuildRuleOrder:
+ self.BuildRuleOrder = ['.%s' % Ext for Ext in self.BuildRuleOrder.split()]
+ return RetVal
+
+ ## Get include path list from tool option for the module build
+ #
+ # @retval list The include path list
+ #
+ @cached_property
+ def BuildOptionIncPathList(self):
+ #
+ # Regular expression for finding Include Directories, the difference between MSFT and INTEL/GCC/RVCT
+ # is the former use /I , the Latter used -I to specify include directories
+ #
+ if self.PlatformInfo.ToolChainFamily in (TAB_COMPILER_MSFT):
+ BuildOptIncludeRegEx = gBuildOptIncludePatternMsft
+ elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC', 'RVCT'):
+ BuildOptIncludeRegEx = gBuildOptIncludePatternOther
+ else:
+ #
+ # New ToolChainFamily, don't known whether there is option to specify include directories
+ #
+ return []
+
+ RetVal = []
+ for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'ASM'):
+ try:
+ FlagOption = self.BuildOption[Tool]['FLAGS']
+ except KeyError:
+ FlagOption = ''
+
+ if self.ToolChainFamily != 'RVCT':
+ IncPathList = [NormPath(Path, self.Macros) for Path in BuildOptIncludeRegEx.findall(FlagOption)]
+ else:
+ #
+ # RVCT may specify a list of directory seperated by commas
+ #
+ IncPathList = []
+ for Path in BuildOptIncludeRegEx.findall(FlagOption):
+ PathList = GetSplitList(Path, TAB_COMMA_SPLIT)
+ IncPathList.extend(NormPath(PathEntry, self.Macros) for PathEntry in PathList)
+
+ #
+ # EDK II modules must not reference header files outside of the packages they depend on or
+ # within the module's directory tree. Report error if violation.
+ #
+ if GlobalData.gDisableIncludePathCheck == False:
+ for Path in IncPathList:
+ if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir):
+ ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption)
+ EdkLogger.error("build",
+ PARAMETER_INVALID,
+ ExtraData=ErrMsg,
+ File=str(self.MetaFile))
+ RetVal += IncPathList
+ return RetVal
+
+ ## Return a list of files which can be built from source
+ #
+ # What kind of files can be built is determined by build rules in
+ # $(CONF_DIRECTORY)/build_rule.txt and toolchain family.
+ #
+ @cached_property
+ def SourceFileList(self):
+ RetVal = []
+ ToolChainTagSet = {"", TAB_STAR, self.ToolChain}
+ ToolChainFamilySet = {"", TAB_STAR, self.ToolChainFamily, self.BuildRuleFamily}
+ for F in self.Module.Sources:
+ # match tool chain
+ if F.TagName not in ToolChainTagSet:
+ EdkLogger.debug(EdkLogger.DEBUG_9, "The toolchain [%s] for processing file [%s] is found, "
+ "but [%s] is currently used" % (F.TagName, str(F), self.ToolChain))
+ continue
+ # match tool chain family or build rule family
+ if F.ToolChainFamily not in ToolChainFamilySet:
+ EdkLogger.debug(
+ EdkLogger.DEBUG_0,
+ "The file [%s] must be built by tools of [%s], " \
+ "but current toolchain family is [%s], buildrule family is [%s]" \
+ % (str(F), F.ToolChainFamily, self.ToolChainFamily, self.BuildRuleFamily))
+ continue
+
+ # add the file path into search path list for file including
+ if F.Dir not in self.IncludePathList:
+ self.IncludePathList.insert(0, F.Dir)
+ RetVal.append(F)
+
+ self._MatchBuildRuleOrder(RetVal)
+
+ for F in RetVal:
+ self._ApplyBuildRule(F, TAB_UNKNOWN_FILE)
+ return RetVal
+
+ def _MatchBuildRuleOrder(self, FileList):
+ Order_Dict = {}
+ self.BuildOption
+ for SingleFile in FileList:
+ if self.BuildRuleOrder and SingleFile.Ext in self.BuildRuleOrder and SingleFile.Ext in self.BuildRules:
+ key = SingleFile.Path.rsplit(SingleFile.Ext,1)[0]
+ if key in Order_Dict:
+ Order_Dict[key].append(SingleFile.Ext)
+ else:
+ Order_Dict[key] = [SingleFile.Ext]
+
+ RemoveList = []
+ for F in Order_Dict:
+ if len(Order_Dict[F]) > 1:
+ Order_Dict[F].sort(key=lambda i: self.BuildRuleOrder.index(i))
+ for Ext in Order_Dict[F][1:]:
+ RemoveList.append(F + Ext)
+
+ for item in RemoveList:
+ FileList.remove(item)
+
+ return FileList
+
+ ## Return the list of unicode files
+ @cached_property
+ def UnicodeFileList(self):
+ return self.FileTypes.get(TAB_UNICODE_FILE,[])
+
+ ## Return the list of vfr files
+ @cached_property
+ def VfrFileList(self):
+ return self.FileTypes.get(TAB_VFR_FILE, [])
+
+ ## Return the list of Image Definition files
+ @cached_property
+ def IdfFileList(self):
+ return self.FileTypes.get(TAB_IMAGE_FILE,[])
+
+ ## Return a list of files which can be built from binary
+ #
+ # "Build" binary files are just to copy them to build directory.
+ #
+ # @retval list The list of files which can be built later
+ #
+ @cached_property
+ def BinaryFileList(self):
+ RetVal = []
+ for F in self.Module.Binaries:
+ if F.Target not in [TAB_ARCH_COMMON, TAB_STAR] and F.Target != self.BuildTarget:
+ continue
+ RetVal.append(F)
+ self._ApplyBuildRule(F, F.Type, BinaryFileList=RetVal)
+ return RetVal
+
+ @cached_property
+ def BuildRules(self):
+ RetVal = {}
+ BuildRuleDatabase = self.PlatformInfo.BuildRule
+ for Type in BuildRuleDatabase.FileTypeList:
+ #first try getting build rule by BuildRuleFamily
+ RuleObject = BuildRuleDatabase[Type, self.BuildType, self.Arch, self.BuildRuleFamily]
+ if not RuleObject:
+ # build type is always module type, but ...
+ if self.ModuleType != self.BuildType:
+ RuleObject = BuildRuleDatabase[Type, self.ModuleType, self.Arch, self.BuildRuleFamily]
+ #second try getting build rule by ToolChainFamily
+ if not RuleObject:
+ RuleObject = BuildRuleDatabase[Type, self.BuildType, self.Arch, self.ToolChainFamily]
+ if not RuleObject:
+ # build type is always module type, but ...
+ if self.ModuleType != self.BuildType:
+ RuleObject = BuildRuleDatabase[Type, self.ModuleType, self.Arch, self.ToolChainFamily]
+ if not RuleObject:
+ continue
+ RuleObject = RuleObject.Instantiate(self.Macros)
+ RetVal[Type] = RuleObject
+ for Ext in RuleObject.SourceFileExtList:
+ RetVal[Ext] = RuleObject
+ return RetVal
+
+ def _ApplyBuildRule(self, File, FileType, BinaryFileList=None):
+ if self._BuildTargets is None:
+ self._IntroBuildTargetList = set()
+ self._FinalBuildTargetList = set()
+ self._BuildTargets = defaultdict(set)
+ self._FileTypes = defaultdict(set)
+
+ if not BinaryFileList:
+ BinaryFileList = self.BinaryFileList
+
+ SubDirectory = os.path.join(self.OutputDir, File.SubDir)
+ if not os.path.exists(SubDirectory):
+ CreateDirectory(SubDirectory)
+ TargetList = set()
+ FinalTargetName = set()
+ RuleChain = set()
+ SourceList = [File]
+ Index = 0
+ #
+ # Make sure to get build rule order value
+ #
+ self.BuildOption
+
+ while Index < len(SourceList):
+ # Reset the FileType if not the first iteration.
+ if Index > 0:
+ FileType = TAB_UNKNOWN_FILE
+ Source = SourceList[Index]
+ Index = Index + 1
+
+ if Source != File:
+ CreateDirectory(Source.Dir)
+
+ if File.IsBinary and File == Source and File in BinaryFileList:
+ # Skip all files that are not binary libraries
+ if not self.IsLibrary:
+ continue
+ RuleObject = self.BuildRules[TAB_DEFAULT_BINARY_FILE]
+ elif FileType in self.BuildRules:
+ RuleObject = self.BuildRules[FileType]
+ elif Source.Ext in self.BuildRules:
+ RuleObject = self.BuildRules[Source.Ext]
+ else:
+ # No more rule to apply: Source is a final target.
+ FinalTargetName.add(Source)
+ continue
+
+ FileType = RuleObject.SourceFileType
+ self._FileTypes[FileType].add(Source)
+
+ # stop at STATIC_LIBRARY for library
+ if self.IsLibrary and FileType == TAB_STATIC_LIBRARY:
+ FinalTargetName.add(Source)
+ continue
+
+ Target = RuleObject.Apply(Source, self.BuildRuleOrder)
+ if not Target:
+ # No Target: Source is a final target.
+ FinalTargetName.add(Source)
+ continue
+
+ TargetList.add(Target)
+ self._BuildTargets[FileType].add(Target)
+
+ if not Source.IsBinary and Source == File:
+ self._IntroBuildTargetList.add(Target)
+
+ # to avoid cyclic rule
+ if FileType in RuleChain:
+ EdkLogger.error("build", ERROR_STATEMENT, "Cyclic dependency detected while generating rule for %s" % str(Source))
+
+ RuleChain.add(FileType)
+ SourceList.extend(Target.Outputs)
+
+ # For each final target name, retrieve the corresponding TargetDescBlock instance.
+ for FTargetName in FinalTargetName:
+ for Target in TargetList:
+ if FTargetName == Target.Target:
+ self._FinalBuildTargetList.add(Target)
+
+ @cached_property
+ def Targets(self):
+ if self._BuildTargets is None:
+ self._IntroBuildTargetList = set()
+ self._FinalBuildTargetList = set()
+ self._BuildTargets = defaultdict(set)
+ self._FileTypes = defaultdict(set)
+
+ #TRICK: call SourceFileList property to apply build rule for source files
+ self.SourceFileList
+
+ #TRICK: call _GetBinaryFileList to apply build rule for binary files
+ self.BinaryFileList
+
+ return self._BuildTargets
+
+ @cached_property
+ def IntroTargetList(self):
+ self.Targets
+ return self._IntroBuildTargetList
+
+ @cached_property
+ def CodaTargetList(self):
+ self.Targets
+ return self._FinalBuildTargetList
+
+ @cached_property
+ def FileTypes(self):
+ self.Targets
+ return self._FileTypes
+
+ ## Get the list of package object the module depends on and the Platform depends on
+ #
+ # @retval list The package object list
+ #
+ @cached_property
+ def DependentPackageList(self):
+ return self.PackageList
+
+ ## Return the list of auto-generated code file
+ #
+ # @retval list The list of auto-generated file
+ #
+ @cached_property
+ def AutoGenFileList(self):
+ AutoGenUniIdf = self.BuildType != 'UEFI_HII'
+ UniStringBinBuffer = BytesIO()
+ IdfGenBinBuffer = BytesIO()
+ RetVal = {}
+ AutoGenC = TemplateString()
+ AutoGenH = TemplateString()
+ StringH = TemplateString()
+ StringIdf = TemplateString()
+ GenC.CreateCode(self, AutoGenC, AutoGenH, StringH, AutoGenUniIdf, UniStringBinBuffer, StringIdf, AutoGenUniIdf, IdfGenBinBuffer)
+ #
+ # AutoGen.c is generated if there are library classes in inf, or there are object files
+ #
+ if str(AutoGenC) != "" and (len(self.Module.LibraryClasses) > 0
+ or TAB_OBJECT_FILE in self.FileTypes):
+ AutoFile = PathClass(gAutoGenCodeFileName, self.DebugDir)
+ RetVal[AutoFile] = str(AutoGenC)
+ self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)
+ if str(AutoGenH) != "":
+ AutoFile = PathClass(gAutoGenHeaderFileName, self.DebugDir)
+ RetVal[AutoFile] = str(AutoGenH)
+ self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)
+ if str(StringH) != "":
+ AutoFile = PathClass(gAutoGenStringFileName % {"module_name":self.Name}, self.DebugDir)
+ RetVal[AutoFile] = str(StringH)
+ self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)
+ if UniStringBinBuffer is not None and UniStringBinBuffer.getvalue() != b"":
+ AutoFile = PathClass(gAutoGenStringFormFileName % {"module_name":self.Name}, self.OutputDir)
+ RetVal[AutoFile] = UniStringBinBuffer.getvalue()
+ AutoFile.IsBinary = True
+ self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)
+ if UniStringBinBuffer is not None:
+ UniStringBinBuffer.close()
+ if str(StringIdf) != "":
+ AutoFile = PathClass(gAutoGenImageDefFileName % {"module_name":self.Name}, self.DebugDir)
+ RetVal[AutoFile] = str(StringIdf)
+ self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)
+ if IdfGenBinBuffer is not None and IdfGenBinBuffer.getvalue() != b"":
+ AutoFile = PathClass(gAutoGenIdfFileName % {"module_name":self.Name}, self.OutputDir)
+ RetVal[AutoFile] = IdfGenBinBuffer.getvalue()
+ AutoFile.IsBinary = True
+ self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)
+ if IdfGenBinBuffer is not None:
+ IdfGenBinBuffer.close()
+ return RetVal
+
+ ## Return the list of library modules explicitly or implicitly used by this module
+ @cached_property
+ def DependentLibraryList(self):
+ # only merge library classes and PCD for non-library module
+ if self.IsLibrary:
+ return []
+ return self.PlatformInfo.ApplyLibraryInstance(self.Module)
+
+ ## Get the list of PCDs from current module
+ #
+ # @retval list The list of PCD
+ #
+ @cached_property
+ def ModulePcdList(self):
+ # apply PCD settings from platform
+ RetVal = self.PlatformInfo.ApplyPcdSetting(self.Module, self.Module.Pcds)
+
+ return RetVal
+ @cached_property
+ def _PcdComments(self):
+ ReVal = OrderedListDict()
+ ExtendCopyDictionaryLists(ReVal, self.Module.PcdComments)
+ if not self.IsLibrary:
+ for Library in self.DependentLibraryList:
+ ExtendCopyDictionaryLists(ReVal, Library.PcdComments)
+ return ReVal
+
+ ## Get the list of PCDs from dependent libraries
+ #
+ # @retval list The list of PCD
+ #
+ @cached_property
+ def LibraryPcdList(self):
+ if self.IsLibrary:
+ return []
+ RetVal = []
+ Pcds = set()
+ # get PCDs from dependent libraries
+ for Library in self.DependentLibraryList:
+ PcdsInLibrary = OrderedDict()
+ for Key in Library.Pcds:
+ # skip duplicated PCDs
+ if Key in self.Module.Pcds or Key in Pcds:
+ continue
+ Pcds.add(Key)
+ PcdsInLibrary[Key] = copy.copy(Library.Pcds[Key])
+ RetVal.extend(self.PlatformInfo.ApplyPcdSetting(self.Module, PcdsInLibrary, Library=Library))
+ return RetVal
+
+ ## Get the GUID value mapping
+ #
+ # @retval dict The mapping between GUID cname and its value
+ #
+ @cached_property
+ def GuidList(self):
+ RetVal = self.Module.Guids
+ for Library in self.DependentLibraryList:
+ RetVal.update(Library.Guids)
+ ExtendCopyDictionaryLists(self._GuidComments, Library.GuidComments)
+ ExtendCopyDictionaryLists(self._GuidComments, self.Module.GuidComments)
+ return RetVal
+
+ @cached_property
+ def GetGuidsUsedByPcd(self):
+ RetVal = OrderedDict(self.Module.GetGuidsUsedByPcd())
+ for Library in self.DependentLibraryList:
+ RetVal.update(Library.GetGuidsUsedByPcd())
+ return RetVal
+ ## Get the protocol value mapping
+ #
+ # @retval dict The mapping between protocol cname and its value
+ #
+ @cached_property
+ def ProtocolList(self):
+ RetVal = OrderedDict(self.Module.Protocols)
+ for Library in self.DependentLibraryList:
+ RetVal.update(Library.Protocols)
+ ExtendCopyDictionaryLists(self._ProtocolComments, Library.ProtocolComments)
+ ExtendCopyDictionaryLists(self._ProtocolComments, self.Module.ProtocolComments)
+ return RetVal
+
+ ## Get the PPI value mapping
+ #
+ # @retval dict The mapping between PPI cname and its value
+ #
+ @cached_property
+ def PpiList(self):
+ RetVal = OrderedDict(self.Module.Ppis)
+ for Library in self.DependentLibraryList:
+ RetVal.update(Library.Ppis)
+ ExtendCopyDictionaryLists(self._PpiComments, Library.PpiComments)
+ ExtendCopyDictionaryLists(self._PpiComments, self.Module.PpiComments)
+ return RetVal
+
+ ## Get the list of include search path
+ #
+ # @retval list The list path
+ #
+ @cached_property
+ def IncludePathList(self):
+ RetVal = []
+ RetVal.append(self.MetaFile.Dir)
+ RetVal.append(self.DebugDir)
+
+ for Package in self.PackageList:
+ PackageDir = mws.join(self.WorkspaceDir, Package.MetaFile.Dir)
+ if PackageDir not in RetVal:
+ RetVal.append(PackageDir)
+ IncludesList = Package.Includes
+ if Package._PrivateIncludes:
+ if not self.MetaFile.OriginalPath.Path.startswith(PackageDir):
+ IncludesList = list(set(Package.Includes).difference(set(Package._PrivateIncludes)))
+ for Inc in IncludesList:
+ if Inc not in RetVal:
+ RetVal.append(str(Inc))
+ RetVal.extend(self.IncPathFromBuildOptions)
+ return RetVal
+
+ @cached_property
+ def IncPathFromBuildOptions(self):
+ IncPathList = []
+ for tool in self.BuildOption:
+ if 'FLAGS' in self.BuildOption[tool]:
+ flags = self.BuildOption[tool]['FLAGS']
+ whitespace = False
+ for flag in flags.split(" "):
+ flag = flag.strip()
+ if flag.startswith(("/I","-I")):
+ if len(flag)>2:
+ if os.path.exists(flag[2:]):
+ IncPathList.append(flag[2:])
+ else:
+ whitespace = True
+ continue
+ if whitespace and flag:
+ if os.path.exists(flag):
+ IncPathList.append(flag)
+ whitespace = False
+ return IncPathList
+
+ @cached_property
+ def IncludePathLength(self):
+ return sum(len(inc)+1 for inc in self.IncludePathList)
+
+ ## Get the list of include paths from the packages
+ #
+ # @IncludesList list The list path
+ #
+ @cached_property
+ def PackageIncludePathList(self):
+ IncludesList = []
+ for Package in self.PackageList:
+ PackageDir = mws.join(self.WorkspaceDir, Package.MetaFile.Dir)
+ IncludesList = Package.Includes
+ if Package._PrivateIncludes:
+ if not self.MetaFile.Path.startswith(PackageDir):
+ IncludesList = list(set(Package.Includes).difference(set(Package._PrivateIncludes)))
+ return IncludesList
+
+ ## Get HII EX PCDs which maybe used by VFR
+ #
+ # efivarstore used by VFR may relate with HII EX PCDs
+ # Get the variable name and GUID from efivarstore and HII EX PCD
+ # List the HII EX PCDs in As Built INF if both name and GUID match.
+ #
+ # @retval list HII EX PCDs
+ #
+ def _GetPcdsMaybeUsedByVfr(self):
+ if not self.SourceFileList:
+ return []
+
+ NameGuids = set()
+ for SrcFile in self.SourceFileList:
+ if SrcFile.Ext.lower() != '.vfr':
+ continue
+ Vfri = os.path.join(self.OutputDir, SrcFile.BaseName + '.i')
+ if not os.path.exists(Vfri):
+ continue
+ VfriFile = open(Vfri, 'r')
+ Content = VfriFile.read()
+ VfriFile.close()
+ Pos = Content.find('efivarstore')
+ while Pos != -1:
+ #
+ # Make sure 'efivarstore' is the start of efivarstore statement
+ # In case of the value of 'name' (name = efivarstore) is equal to 'efivarstore'
+ #
+ Index = Pos - 1
+ while Index >= 0 and Content[Index] in ' \t\r\n':
+ Index -= 1
+ if Index >= 0 and Content[Index] != ';':
+ Pos = Content.find('efivarstore', Pos + len('efivarstore'))
+ continue
+ #
+ # 'efivarstore' must be followed by name and guid
+ #
+ Name = gEfiVarStoreNamePattern.search(Content, Pos)
+ if not Name:
+ break
+ Guid = gEfiVarStoreGuidPattern.search(Content, Pos)
+ if not Guid:
+ break
+ NameArray = _ConvertStringToByteArray('L"' + Name.group(1) + '"')
+ NameGuids.add((NameArray, GuidStructureStringToGuidString(Guid.group(1))))
+ Pos = Content.find('efivarstore', Name.end())
+ if not NameGuids:
+ return []
+ HiiExPcds = []
+ for Pcd in self.PlatformInfo.Pcds.values():
+ if Pcd.Type != TAB_PCDS_DYNAMIC_EX_HII:
+ continue
+ for SkuInfo in Pcd.SkuInfoList.values():
+ Value = GuidValue(SkuInfo.VariableGuid, self.PlatformInfo.PackageList, self.MetaFile.Path)
+ if not Value:
+ continue
+ Name = _ConvertStringToByteArray(SkuInfo.VariableName)
+ Guid = GuidStructureStringToGuidString(Value)
+ if (Name, Guid) in NameGuids and Pcd not in HiiExPcds:
+ HiiExPcds.append(Pcd)
+ break
+
+ return HiiExPcds
+
+ def _GenOffsetBin(self):
+ VfrUniBaseName = {}
+ for SourceFile in self.Module.Sources:
+ if SourceFile.Type.upper() == ".VFR" :
+ #
+ # search the .map file to find the offset of vfr binary in the PE32+/TE file.
+ #
+ VfrUniBaseName[SourceFile.BaseName] = (SourceFile.BaseName + "Bin")
+ elif SourceFile.Type.upper() == ".UNI" :
+ #
+ # search the .map file to find the offset of Uni strings binary in the PE32+/TE file.
+ #
+ VfrUniBaseName["UniOffsetName"] = (self.Name + "Strings")
+
+ if not VfrUniBaseName:
+ return None
+ MapFileName = os.path.join(self.OutputDir, self.Name + ".map")
+ EfiFileName = os.path.join(self.OutputDir, self.Name + ".efi")
+ VfrUniOffsetList = GetVariableOffset(MapFileName, EfiFileName, list(VfrUniBaseName.values()))
+ if not VfrUniOffsetList:
+ return None
+
+ OutputName = '%sOffset.bin' % self.Name
+ UniVfrOffsetFileName = os.path.join( self.OutputDir, OutputName)
+
+ try:
+ fInputfile = open(UniVfrOffsetFileName, "wb+", 0)
+ except:
+ EdkLogger.error("build", FILE_OPEN_FAILURE, "File open failed for %s" % UniVfrOffsetFileName, None)
+
+ # Use a instance of BytesIO to cache data
+ fStringIO = BytesIO()
+
+ for Item in VfrUniOffsetList:
+ if (Item[0].find("Strings") != -1):
+ #
+ # UNI offset in image.
+ # GUID + Offset
+ # { 0x8913c5e0, 0x33f6, 0x4d86, { 0x9b, 0xf1, 0x43, 0xef, 0x89, 0xfc, 0x6, 0x66 } }
+ #
+ UniGuid = b'\xe0\xc5\x13\x89\xf63\x86M\x9b\xf1C\xef\x89\xfc\x06f'
+ fStringIO.write(UniGuid)
+ UniValue = pack ('Q', int (Item[1], 16))
+ fStringIO.write (UniValue)
+ else:
+ #
+ # VFR binary offset in image.
+ # GUID + Offset
+ # { 0xd0bc7cb4, 0x6a47, 0x495f, { 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2 } };
+ #
+ VfrGuid = b'\xb4|\xbc\xd0Gj_I\xaa\x11q\x07F\xda\x06\xa2'
+ fStringIO.write(VfrGuid)
+ VfrValue = pack ('Q', int (Item[1], 16))
+ fStringIO.write (VfrValue)
+ #
+ # write data into file.
+ #
+ try :
+ fInputfile.write (fStringIO.getvalue())
+ except:
+ EdkLogger.error("build", FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the "
+ "file been locked or using by other applications." %UniVfrOffsetFileName, None)
+
+ fStringIO.close ()
+ fInputfile.close ()
+ return OutputName
+
+ @cached_property
+ def OutputFile(self):
+ retVal = set()
+
+ for Root, Dirs, Files in os.walk(self.BuildDir):
+ for File in Files:
+ # lib file is already added through above CodaTargetList, skip it here
+ if not (File.lower().endswith('.obj') or File.lower().endswith('.debug')):
+ NewFile = path.join(Root, File)
+ retVal.add(NewFile)
+
+ for Root, Dirs, Files in os.walk(self.FfsOutputDir):
+ for File in Files:
+ NewFile = path.join(Root, File)
+ retVal.add(NewFile)
+
+ return retVal
+
+ ## Create AsBuilt INF file the module
+ #
+ def CreateAsBuiltInf(self):
+
+ if self.IsAsBuiltInfCreated:
+ return
+
+ # Skip INF file generation for libraries
+ if self.IsLibrary:
+ return
+
+ # Skip the following code for modules with no source files
+ if not self.SourceFileList:
+ return
+
+ # Skip the following code for modules without any binary files
+ if self.BinaryFileList:
+ return
+
+ ### TODO: How to handles mixed source and binary modules
+
+ # Find all DynamicEx and PatchableInModule PCDs used by this module and dependent libraries
+ # Also find all packages that the DynamicEx PCDs depend on
+ Pcds = []
+ PatchablePcds = []
+ Packages = []
+ PcdCheckList = []
+ PcdTokenSpaceList = []
+ for Pcd in self.ModulePcdList + self.LibraryPcdList:
+ if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE:
+ PatchablePcds.append(Pcd)
+ PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, TAB_PCDS_PATCHABLE_IN_MODULE))
+ elif Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
+ if Pcd not in Pcds:
+ Pcds.append(Pcd)
+ PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC_EX))
+ PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC))
+ PcdTokenSpaceList.append(Pcd.TokenSpaceGuidCName)
+ GuidList = OrderedDict(self.GuidList)
+ for TokenSpace in self.GetGuidsUsedByPcd:
+ # If token space is not referred by patch PCD or Ex PCD, remove the GUID from GUID list
+ # The GUIDs in GUIDs section should really be the GUIDs in source INF or referred by Ex an patch PCDs
+ if TokenSpace not in PcdTokenSpaceList and TokenSpace in GuidList:
+ GuidList.pop(TokenSpace)
+ CheckList = (GuidList, self.PpiList, self.ProtocolList, PcdCheckList)
+ for Package in self.DerivedPackageList:
+ if Package in Packages:
+ continue
+ BeChecked = (Package.Guids, Package.Ppis, Package.Protocols, Package.Pcds)
+ Found = False
+ for Index in range(len(BeChecked)):
+ for Item in CheckList[Index]:
+ if Item in BeChecked[Index]:
+ Packages.append(Package)
+ Found = True
+ break
+ if Found:
+ break
+
+ VfrPcds = self._GetPcdsMaybeUsedByVfr()
+ for Pkg in self.PlatformInfo.PackageList:
+ if Pkg in Packages:
+ continue
+ for VfrPcd in VfrPcds:
+ if ((VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC_EX) in Pkg.Pcds or
+ (VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC) in Pkg.Pcds):
+ Packages.append(Pkg)
+ break
+
+ ModuleType = SUP_MODULE_DXE_DRIVER if self.ModuleType == SUP_MODULE_UEFI_DRIVER and self.DepexGenerated else self.ModuleType
+ DriverType = self.PcdIsDriver if self.PcdIsDriver else ''
+ Guid = self.Guid
+ MDefs = self.Module.Defines
+
+ AsBuiltInfDict = {
+ 'module_name' : self.Name,
+ 'module_guid' : Guid,
+ 'module_module_type' : ModuleType,
+ 'module_version_string' : [MDefs['VERSION_STRING']] if 'VERSION_STRING' in MDefs else [],
+ 'pcd_is_driver_string' : [],
+ 'module_uefi_specification_version' : [],
+ 'module_pi_specification_version' : [],
+ 'module_entry_point' : self.Module.ModuleEntryPointList,
+ 'module_unload_image' : self.Module.ModuleUnloadImageList,
+ 'module_constructor' : self.Module.ConstructorList,
+ 'module_destructor' : self.Module.DestructorList,
+ 'module_shadow' : [MDefs['SHADOW']] if 'SHADOW' in MDefs else [],
+ 'module_pci_vendor_id' : [MDefs['PCI_VENDOR_ID']] if 'PCI_VENDOR_ID' in MDefs else [],
+ 'module_pci_device_id' : [MDefs['PCI_DEVICE_ID']] if 'PCI_DEVICE_ID' in MDefs else [],
+ 'module_pci_class_code' : [MDefs['PCI_CLASS_CODE']] if 'PCI_CLASS_CODE' in MDefs else [],
+ 'module_pci_revision' : [MDefs['PCI_REVISION']] if 'PCI_REVISION' in MDefs else [],
+ 'module_build_number' : [MDefs['BUILD_NUMBER']] if 'BUILD_NUMBER' in MDefs else [],
+ 'module_spec' : [MDefs['SPEC']] if 'SPEC' in MDefs else [],
+ 'module_uefi_hii_resource_section' : [MDefs['UEFI_HII_RESOURCE_SECTION']] if 'UEFI_HII_RESOURCE_SECTION' in MDefs else [],
+ 'module_uni_file' : [MDefs['MODULE_UNI_FILE']] if 'MODULE_UNI_FILE' in MDefs else [],
+ 'module_arch' : self.Arch,
+ 'package_item' : [Package.MetaFile.File.replace('\\', '/') for Package in Packages],
+ 'binary_item' : [],
+ 'patchablepcd_item' : [],
+ 'pcd_item' : [],
+ 'protocol_item' : [],
+ 'ppi_item' : [],
+ 'guid_item' : [],
+ 'flags_item' : [],
+ 'libraryclasses_item' : []
+ }
+
+ if 'MODULE_UNI_FILE' in MDefs:
+ UNIFile = os.path.join(self.MetaFile.Dir, MDefs['MODULE_UNI_FILE'])
+ if os.path.isfile(UNIFile):
+ shutil.copy2(UNIFile, self.OutputDir)
+
+ if self.AutoGenVersion > int(gInfSpecVersion, 0):
+ AsBuiltInfDict['module_inf_version'] = '0x%08x' % self.AutoGenVersion
+ else:
+ AsBuiltInfDict['module_inf_version'] = gInfSpecVersion
+
+ if DriverType:
+ AsBuiltInfDict['pcd_is_driver_string'].append(DriverType)
+
+ if 'UEFI_SPECIFICATION_VERSION' in self.Specification:
+ AsBuiltInfDict['module_uefi_specification_version'].append(self.Specification['UEFI_SPECIFICATION_VERSION'])
+ if 'PI_SPECIFICATION_VERSION' in self.Specification:
+ AsBuiltInfDict['module_pi_specification_version'].append(self.Specification['PI_SPECIFICATION_VERSION'])
+
+ OutputDir = self.OutputDir.replace('\\', '/').strip('/')
+ DebugDir = self.DebugDir.replace('\\', '/').strip('/')
+ for Item in self.CodaTargetList:
+ File = Item.Target.Path.replace('\\', '/').strip('/').replace(DebugDir, '').replace(OutputDir, '').strip('/')
+ if os.path.isabs(File):
+ File = File.replace('\\', '/').strip('/').replace(OutputDir, '').strip('/')
+ if Item.Target.Ext.lower() == '.aml':
+ AsBuiltInfDict['binary_item'].append('ASL|' + File)
+ elif Item.Target.Ext.lower() == '.acpi':
+ AsBuiltInfDict['binary_item'].append('ACPI|' + File)
+ elif Item.Target.Ext.lower() == '.efi':
+ AsBuiltInfDict['binary_item'].append('PE32|' + self.Name + '.efi')
+ else:
+ AsBuiltInfDict['binary_item'].append('BIN|' + File)
+ if not self.DepexGenerated:
+ DepexFile = os.path.join(self.OutputDir, self.Name + '.depex')
+ if os.path.exists(DepexFile):
+ self.DepexGenerated = True
+ if self.DepexGenerated:
+ if self.ModuleType in [SUP_MODULE_PEIM]:
+ AsBuiltInfDict['binary_item'].append('PEI_DEPEX|' + self.Name + '.depex')
+ elif self.ModuleType in [SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]:
+ AsBuiltInfDict['binary_item'].append('DXE_DEPEX|' + self.Name + '.depex')
+ elif self.ModuleType in [SUP_MODULE_DXE_SMM_DRIVER]:
+ AsBuiltInfDict['binary_item'].append('SMM_DEPEX|' + self.Name + '.depex')
+
+ Bin = self._GenOffsetBin()
+ if Bin:
+ AsBuiltInfDict['binary_item'].append('BIN|%s' % Bin)
+
+ for Root, Dirs, Files in os.walk(OutputDir):
+ for File in Files:
+ if File.lower().endswith('.pdb'):
+ AsBuiltInfDict['binary_item'].append('DISPOSABLE|' + File)
+ HeaderComments = self.Module.HeaderComments
+ StartPos = 0
+ for Index in range(len(HeaderComments)):
+ if HeaderComments[Index].find('@BinaryHeader') != -1:
+ HeaderComments[Index] = HeaderComments[Index].replace('@BinaryHeader', '@file')
+ StartPos = Index
+ break
+ AsBuiltInfDict['header_comments'] = '\n'.join(HeaderComments[StartPos:]).replace(':#', '://')
+ AsBuiltInfDict['tail_comments'] = '\n'.join(self.Module.TailComments)
+
+ GenList = [
+ (self.ProtocolList, self._ProtocolComments, 'protocol_item'),
+ (self.PpiList, self._PpiComments, 'ppi_item'),
+ (GuidList, self._GuidComments, 'guid_item')
+ ]
+ for Item in GenList:
+ for CName in Item[0]:
+ Comments = '\n '.join(Item[1][CName]) if CName in Item[1] else ''
+ Entry = Comments + '\n ' + CName if Comments else CName
+ AsBuiltInfDict[Item[2]].append(Entry)
+ PatchList = parsePcdInfoFromMapFile(
+ os.path.join(self.OutputDir, self.Name + '.map'),
+ os.path.join(self.OutputDir, self.Name + '.efi')
+ )
+ if PatchList:
+ for Pcd in PatchablePcds:
+ TokenCName = Pcd.TokenCName
+ for PcdItem in GlobalData.MixedPcd:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ TokenCName = PcdItem[0]
+ break
+ for PatchPcd in PatchList:
+ if TokenCName == PatchPcd[0]:
+ break
+ else:
+ continue
+ PcdValue = ''
+ if Pcd.DatumType == 'BOOLEAN':
+ BoolValue = Pcd.DefaultValue.upper()
+ if BoolValue == 'TRUE':
+ Pcd.DefaultValue = '1'
+ elif BoolValue == 'FALSE':
+ Pcd.DefaultValue = '0'
+
+ if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES:
+ HexFormat = '0x%02x'
+ if Pcd.DatumType == TAB_UINT16:
+ HexFormat = '0x%04x'
+ elif Pcd.DatumType == TAB_UINT32:
+ HexFormat = '0x%08x'
+ elif Pcd.DatumType == TAB_UINT64:
+ HexFormat = '0x%016x'
+ PcdValue = HexFormat % int(Pcd.DefaultValue, 0)
+ else:
+ if Pcd.MaxDatumSize is None or Pcd.MaxDatumSize == '':
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "Unknown [MaxDatumSize] of PCD [%s.%s]" % (Pcd.TokenSpaceGuidCName, TokenCName)
+ )
+ ArraySize = int(Pcd.MaxDatumSize, 0)
+ PcdValue = Pcd.DefaultValue
+ if PcdValue[0] != '{':
+ Unicode = False
+ if PcdValue[0] == 'L':
+ Unicode = True
+ PcdValue = PcdValue.lstrip('L')
+ PcdValue = eval(PcdValue)
+ NewValue = '{'
+ for Index in range(0, len(PcdValue)):
+ if Unicode:
+ CharVal = ord(PcdValue[Index])
+ NewValue = NewValue + '0x%02x' % (CharVal & 0x00FF) + ', ' \
+ + '0x%02x' % (CharVal >> 8) + ', '
+ else:
+ NewValue = NewValue + '0x%02x' % (ord(PcdValue[Index]) % 0x100) + ', '
+ Padding = '0x00, '
+ if Unicode:
+ Padding = Padding * 2
+ ArraySize = ArraySize // 2
+ if ArraySize < (len(PcdValue) + 1):
+ if Pcd.MaxSizeUserSet:
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, TokenCName)
+ )
+ else:
+ ArraySize = len(PcdValue) + 1
+ if ArraySize > len(PcdValue) + 1:
+ NewValue = NewValue + Padding * (ArraySize - len(PcdValue) - 1)
+ PcdValue = NewValue + Padding.strip().rstrip(',') + '}'
+ elif len(PcdValue.split(',')) <= ArraySize:
+ PcdValue = PcdValue.rstrip('}') + ', 0x00' * (ArraySize - len(PcdValue.split(',')))
+ PcdValue += '}'
+ else:
+ if Pcd.MaxSizeUserSet:
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ "The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, TokenCName)
+ )
+ else:
+ ArraySize = len(PcdValue) + 1
+ PcdItem = '%s.%s|%s|0x%X' % \
+ (Pcd.TokenSpaceGuidCName, TokenCName, PcdValue, PatchPcd[1])
+ PcdComments = ''
+ if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) in self._PcdComments:
+ PcdComments = '\n '.join(self._PcdComments[Pcd.TokenSpaceGuidCName, Pcd.TokenCName])
+ if PcdComments:
+ PcdItem = PcdComments + '\n ' + PcdItem
+ AsBuiltInfDict['patchablepcd_item'].append(PcdItem)
+
+ for Pcd in Pcds + VfrPcds:
+ PcdCommentList = []
+ HiiInfo = ''
+ TokenCName = Pcd.TokenCName
+ for PcdItem in GlobalData.MixedPcd:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ TokenCName = PcdItem[0]
+ break
+ if Pcd.Type == TAB_PCDS_DYNAMIC_EX_HII:
+ for SkuName in Pcd.SkuInfoList:
+ SkuInfo = Pcd.SkuInfoList[SkuName]
+ HiiInfo = '## %s|%s|%s' % (SkuInfo.VariableName, SkuInfo.VariableGuid, SkuInfo.VariableOffset)
+ break
+ if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) in self._PcdComments:
+ PcdCommentList = self._PcdComments[Pcd.TokenSpaceGuidCName, Pcd.TokenCName][:]
+ if HiiInfo:
+ UsageIndex = -1
+ UsageStr = ''
+ for Index, Comment in enumerate(PcdCommentList):
+ for Usage in UsageList:
+ if Comment.find(Usage) != -1:
+ UsageStr = Usage
+ UsageIndex = Index
+ break
+ if UsageIndex != -1:
+ PcdCommentList[UsageIndex] = '## %s %s %s' % (UsageStr, HiiInfo, PcdCommentList[UsageIndex].replace(UsageStr, ''))
+ else:
+ PcdCommentList.append('## UNDEFINED ' + HiiInfo)
+ PcdComments = '\n '.join(PcdCommentList)
+ PcdEntry = Pcd.TokenSpaceGuidCName + '.' + TokenCName
+ if PcdComments:
+ PcdEntry = PcdComments + '\n ' + PcdEntry
+ AsBuiltInfDict['pcd_item'].append(PcdEntry)
+ for Item in self.BuildOption:
+ if 'FLAGS' in self.BuildOption[Item]:
+ AsBuiltInfDict['flags_item'].append('%s:%s_%s_%s_%s_FLAGS = %s' % (self.ToolChainFamily, self.BuildTarget, self.ToolChain, self.Arch, Item, self.BuildOption[Item]['FLAGS'].strip()))
+
+ # Generated LibraryClasses section in comments.
+ for Library in self.LibraryAutoGenList:
+ AsBuiltInfDict['libraryclasses_item'].append(Library.MetaFile.File.replace('\\', '/'))
+
+ # Generated UserExtensions TianoCore section.
+ # All tianocore user extensions are copied.
+ UserExtStr = ''
+ for TianoCore in self._GetTianoCoreUserExtensionList():
+ UserExtStr += '\n'.join(TianoCore)
+ ExtensionFile = os.path.join(self.MetaFile.Dir, TianoCore[1])
+ if os.path.isfile(ExtensionFile):
+ shutil.copy2(ExtensionFile, self.OutputDir)
+ AsBuiltInfDict['userextension_tianocore_item'] = UserExtStr
+
+ # Generated depex expression section in comments.
+ DepexExpression = self._GetDepexExpresionString()
+ AsBuiltInfDict['depexsection_item'] = DepexExpression if DepexExpression else ''
+
+ AsBuiltInf = TemplateString()
+ AsBuiltInf.Append(gAsBuiltInfHeaderString.Replace(AsBuiltInfDict))
+
+ SaveFileOnChange(os.path.join(self.OutputDir, self.Name + '.inf'), str(AsBuiltInf), False)
+
+ self.IsAsBuiltInfCreated = True
+
+ def CacheCopyFile(self, DestDir, SourceDir, File):
+ if os.path.isdir(File):
+ return
+
+ sub_dir = os.path.relpath(File, SourceDir)
+ destination_file = os.path.join(DestDir, sub_dir)
+ destination_dir = os.path.dirname(destination_file)
+ CreateDirectory(destination_dir)
+ try:
+ CopyFileOnChange(File, destination_dir)
+ except:
+ EdkLogger.quiet("[cache warning]: fail to copy file:%s to folder:%s" % (File, destination_dir))
+ return
+
+ def CopyModuleToCache(self):
+ # Find the MakeHashStr and PreMakeHashStr from latest MakeHashFileList
+ # and PreMakeHashFileList files
+ MakeHashStr = None
+ PreMakeHashStr = None
+ MakeTimeStamp = 0
+ PreMakeTimeStamp = 0
+ Files = [f for f in os.listdir(LongFilePath(self.BuildDir)) if path.isfile(LongFilePath(path.join(self.BuildDir, f)))]
+ for File in Files:
+ if ".MakeHashFileList." in File:
+ #find lastest file through time stamp
+ FileTimeStamp = os.stat(LongFilePath(path.join(self.BuildDir, File)))[8]
+ if FileTimeStamp > MakeTimeStamp:
+ MakeTimeStamp = FileTimeStamp
+ MakeHashStr = File.split('.')[-1]
+ if len(MakeHashStr) != 32:
+ EdkLogger.quiet("[cache error]: wrong MakeHashFileList file:%s" % (File))
+ if ".PreMakeHashFileList." in File:
+ FileTimeStamp = os.stat(LongFilePath(path.join(self.BuildDir, File)))[8]
+ if FileTimeStamp > PreMakeTimeStamp:
+ PreMakeTimeStamp = FileTimeStamp
+ PreMakeHashStr = File.split('.')[-1]
+ if len(PreMakeHashStr) != 32:
+ EdkLogger.quiet("[cache error]: wrong PreMakeHashFileList file:%s" % (File))
+
+ if not MakeHashStr:
+ EdkLogger.quiet("[cache error]: No MakeHashFileList file for module:%s[%s]" % (self.MetaFile.Path, self.Arch))
+ return
+ if not PreMakeHashStr:
+ EdkLogger.quiet("[cache error]: No PreMakeHashFileList file for module:%s[%s]" % (self.MetaFile.Path, self.Arch))
+ return
+
+ # Create Cache destination dirs
+ FileDir = path.join(GlobalData.gBinCacheDest, self.PlatformInfo.OutputDir, self.BuildTarget + "_" + self.ToolChain, self.Arch, self.SourceDir, self.MetaFile.BaseName)
+ FfsDir = path.join(GlobalData.gBinCacheDest, self.PlatformInfo.OutputDir, self.BuildTarget + "_" + self.ToolChain, TAB_FV_DIRECTORY, "Ffs", self.Guid + self.Name)
+ CacheFileDir = path.join(FileDir, MakeHashStr)
+ CacheFfsDir = path.join(FfsDir, MakeHashStr)
+ CreateDirectory (CacheFileDir)
+ CreateDirectory (CacheFfsDir)
+
+ # Create ModuleHashPair file to support multiple version cache together
+ ModuleHashPair = path.join(FileDir, self.Name + ".ModuleHashPair")
+ ModuleHashPairList = [] # tuple list: [tuple(PreMakefileHash, MakeHash)]
+ if os.path.exists(ModuleHashPair):
+ with open(ModuleHashPair, 'r') as f:
+ ModuleHashPairList = json.load(f)
+ if not (PreMakeHashStr, MakeHashStr) in set(map(tuple, ModuleHashPairList)):
+ ModuleHashPairList.insert(0, (PreMakeHashStr, MakeHashStr))
+ with open(ModuleHashPair, 'w') as f:
+ json.dump(ModuleHashPairList, f, indent=2)
+
+ # Copy files to Cache destination dirs
+ if not self.OutputFile:
+ Ma = self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]
+ self.OutputFile = Ma.Binaries
+ for File in self.OutputFile:
+ if File.startswith(os.path.abspath(self.FfsOutputDir)+os.sep):
+ self.CacheCopyFile(CacheFfsDir, self.FfsOutputDir, File)
+ else:
+ if self.Name + ".autogen.hash." in File or \
+ self.Name + ".autogen.hashchain." in File or \
+ self.Name + ".hash." in File or \
+ self.Name + ".hashchain." in File or \
+ self.Name + ".PreMakeHashFileList." in File or \
+ self.Name + ".MakeHashFileList." in File:
+ self.CacheCopyFile(FileDir, self.BuildDir, File)
+ else:
+ self.CacheCopyFile(CacheFileDir, self.BuildDir, File)
+ ## Create makefile for the module and its dependent libraries
+ #
+ # @param CreateLibraryMakeFile Flag indicating if or not the makefiles of
+ # dependent libraries will be created
+ #
+ @cached_class_function
+ def CreateMakeFile(self, CreateLibraryMakeFile=True, GenFfsList = []):
+
+ # nest this function inside it's only caller.
+ def CreateTimeStamp():
+ FileSet = {self.MetaFile.Path}
+
+ for SourceFile in self.Module.Sources:
+ FileSet.add (SourceFile.Path)
+
+ for Lib in self.DependentLibraryList:
+ FileSet.add (Lib.MetaFile.Path)
+
+ for f in self.AutoGenDepSet:
+ FileSet.add (f.Path)
+
+ if os.path.exists (self.TimeStampPath):
+ os.remove (self.TimeStampPath)
+
+ SaveFileOnChange(self.TimeStampPath, "\n".join(FileSet), False)
+
+ # Ignore generating makefile when it is a binary module
+ if self.IsBinaryModule:
+ return
+
+ self.GenFfsList = GenFfsList
+
+ if not self.IsLibrary and CreateLibraryMakeFile:
+ for LibraryAutoGen in self.LibraryAutoGenList:
+ LibraryAutoGen.CreateMakeFile()
+
+ # CanSkip uses timestamps to determine build skipping
+ if self.CanSkip():
+ return
+
+ if len(self.CustomMakefile) == 0:
+ Makefile = GenMake.ModuleMakefile(self)
+ else:
+ Makefile = GenMake.CustomMakefile(self)
+ if Makefile.Generate():
+ EdkLogger.debug(EdkLogger.DEBUG_9, "Generated makefile for module %s [%s]" %
+ (self.Name, self.Arch))
+ else:
+ EdkLogger.debug(EdkLogger.DEBUG_9, "Skipped the generation of makefile for module %s [%s]" %
+ (self.Name, self.Arch))
+
+ CreateTimeStamp()
+
+ MakefileType = Makefile._FileType
+ MakefileName = Makefile._FILE_NAME_[MakefileType]
+ MakefilePath = os.path.join(self.MakeFileDir, MakefileName)
+ FilePath = path.join(self.BuildDir, self.Name + ".makefile")
+ SaveFileOnChange(FilePath, MakefilePath, False)
+
+ def CopyBinaryFiles(self):
+ for File in self.Module.Binaries:
+ SrcPath = File.Path
+ DstPath = os.path.join(self.OutputDir, os.path.basename(SrcPath))
+ CopyLongFilePath(SrcPath, DstPath)
+ ## Create autogen code for the module and its dependent libraries
+ #
+ # @param CreateLibraryCodeFile Flag indicating if or not the code of
+ # dependent libraries will be created
+ #
+ def CreateCodeFile(self, CreateLibraryCodeFile=True):
+
+ if self.IsCodeFileCreated:
+ return
+
+ # Need to generate PcdDatabase even PcdDriver is binarymodule
+ if self.IsBinaryModule and self.PcdIsDriver != '':
+ CreatePcdDatabaseCode(self, TemplateString(), TemplateString())
+ return
+ if self.IsBinaryModule:
+ if self.IsLibrary:
+ self.CopyBinaryFiles()
+ return
+
+ if not self.IsLibrary and CreateLibraryCodeFile:
+ for LibraryAutoGen in self.LibraryAutoGenList:
+ LibraryAutoGen.CreateCodeFile()
+
+ # CanSkip uses timestamps to determine build skipping
+ if self.CanSkip():
+ return
+ self.LibraryAutoGenList
+ AutoGenList = []
+ IgoredAutoGenList = []
+
+ for File in self.AutoGenFileList:
+ if GenC.Generate(File.Path, self.AutoGenFileList[File], File.IsBinary):
+ AutoGenList.append(str(File))
+ else:
+ IgoredAutoGenList.append(str(File))
+
+
+ for ModuleType in self.DepexList:
+ # Ignore empty [depex] section or [depex] section for SUP_MODULE_USER_DEFINED module
+ if len(self.DepexList[ModuleType]) == 0 or ModuleType == SUP_MODULE_USER_DEFINED or ModuleType == SUP_MODULE_HOST_APPLICATION:
+ continue
+
+ Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)
+ DpxFile = gAutoGenDepexFileName % {"module_name" : self.Name}
+
+ if len(Dpx.PostfixNotation) != 0:
+ self.DepexGenerated = True
+
+ if Dpx.Generate(path.join(self.OutputDir, DpxFile)):
+ AutoGenList.append(str(DpxFile))
+ else:
+ IgoredAutoGenList.append(str(DpxFile))
+
+ if IgoredAutoGenList == []:
+ EdkLogger.debug(EdkLogger.DEBUG_9, "Generated [%s] files for module %s [%s]" %
+ (" ".join(AutoGenList), self.Name, self.Arch))
+ elif AutoGenList == []:
+ EdkLogger.debug(EdkLogger.DEBUG_9, "Skipped the generation of [%s] files for module %s [%s]" %
+ (" ".join(IgoredAutoGenList), self.Name, self.Arch))
+ else:
+ EdkLogger.debug(EdkLogger.DEBUG_9, "Generated [%s] (skipped %s) files for module %s [%s]" %
+ (" ".join(AutoGenList), " ".join(IgoredAutoGenList), self.Name, self.Arch))
+
+ self.IsCodeFileCreated = True
+
+ return AutoGenList
+
+ ## Summarize the ModuleAutoGen objects of all libraries used by this module
+ @cached_property
+ def LibraryAutoGenList(self):
+ RetVal = []
+ for Library in self.DependentLibraryList:
+ La = ModuleAutoGen(
+ self.Workspace,
+ Library.MetaFile,
+ self.BuildTarget,
+ self.ToolChain,
+ self.Arch,
+ self.PlatformInfo.MetaFile,
+ self.DataPipe
+ )
+ La.IsLibrary = True
+ if La not in RetVal:
+ RetVal.append(La)
+ for Lib in La.CodaTargetList:
+ self._ApplyBuildRule(Lib.Target, TAB_UNKNOWN_FILE)
+ return RetVal
+
+ def GenCMakeHash(self):
+ # GenCMakeHash can only be called in --binary-destination
+ # Never called in multiprocessing and always directly save result in main process,
+ # so no need remote dict to share the gCMakeHashFile result with main process
+
+ DependencyFileSet = set()
+ # Add AutoGen files
+ if self.AutoGenFileList:
+ for File in set(self.AutoGenFileList):
+ DependencyFileSet.add(File)
+
+ # Add Makefile
+ abspath = path.join(self.BuildDir, self.Name + ".makefile")
+ try:
+ with open(LongFilePath(abspath),"r") as fd:
+ lines = fd.readlines()
+ except Exception as e:
+ EdkLogger.error("build",FILE_NOT_FOUND, "%s doesn't exist" % abspath, ExtraData=str(e), RaiseError=False)
+ if lines:
+ DependencyFileSet.update(lines)
+
+ # Caculate all above dependency files hash
+ # Initialze hash object
+ FileList = []
+ m = hashlib.md5()
+ for File in sorted(DependencyFileSet, key=lambda x: str(x)):
+ if not path.exists(LongFilePath(str(File))):
+ EdkLogger.quiet("[cache warning]: header file %s is missing for module: %s[%s]" % (File, self.MetaFile.Path, self.Arch))
+ continue
+ with open(LongFilePath(str(File)), 'rb') as f:
+ Content = f.read()
+ m.update(Content)
+ FileList.append((str(File), hashlib.md5(Content).hexdigest()))
+
+ HashChainFile = path.join(self.BuildDir, self.Name + ".autogen.hashchain." + m.hexdigest())
+ GlobalData.gCMakeHashFile[(self.MetaFile.Path, self.Arch)] = HashChainFile
+ try:
+ with open(LongFilePath(HashChainFile), 'w') as f:
+ json.dump(FileList, f, indent=2)
+ except:
+ EdkLogger.quiet("[cache warning]: fail to save hashchain file:%s" % HashChainFile)
+ return False
+
+ def GenModuleHash(self):
+ # GenModuleHash only called after autogen phase
+ # Never called in multiprocessing and always directly save result in main process,
+ # so no need remote dict to share the gModuleHashFile result with main process
+ #
+ # GenPreMakefileHashList consume no dict.
+ # GenPreMakefileHashList produce local gModuleHashFile dict.
+
+ DependencyFileSet = set()
+ # Add Module Meta file
+ DependencyFileSet.add(self.MetaFile.Path)
+
+ # Add Module's source files
+ if self.SourceFileList:
+ for File in set(self.SourceFileList):
+ DependencyFileSet.add(File.Path)
+
+ # Add modules's include header files
+ # Directly use the deps.txt file in the module BuildDir
+ abspath = path.join(self.BuildDir, "deps.txt")
+ rt = None
+ try:
+ with open(LongFilePath(abspath),"r") as fd:
+ lines = fd.readlines()
+ if lines:
+ rt = set([item.lstrip().strip("\n") for item in lines if item.strip("\n").endswith(".h")])
+ except Exception as e:
+ EdkLogger.error("build",FILE_NOT_FOUND, "%s doesn't exist" % abspath, ExtraData=str(e), RaiseError=False)
+
+ if rt:
+ DependencyFileSet.update(rt)
+
+
+ # Caculate all above dependency files hash
+ # Initialze hash object
+ FileList = []
+ m = hashlib.md5()
+ BuildDirStr = path.abspath(self.BuildDir).lower()
+ for File in sorted(DependencyFileSet, key=lambda x: str(x)):
+ # Skip the AutoGen files in BuildDir which already been
+ # included in .autogen.hash. file
+ if BuildDirStr in path.abspath(File).lower():
+ continue
+ if not path.exists(LongFilePath(File)):
+ EdkLogger.quiet("[cache warning]: header file %s is missing for module: %s[%s]" % (File, self.MetaFile.Path, self.Arch))
+ continue
+ with open(LongFilePath(File), 'rb') as f:
+ Content = f.read()
+ m.update(Content)
+ FileList.append((File, hashlib.md5(Content).hexdigest()))
+
+ HashChainFile = path.join(self.BuildDir, self.Name + ".hashchain." + m.hexdigest())
+ GlobalData.gModuleHashFile[(self.MetaFile.Path, self.Arch)] = HashChainFile
+ try:
+ with open(LongFilePath(HashChainFile), 'w') as f:
+ json.dump(FileList, f, indent=2)
+ except:
+ EdkLogger.quiet("[cache warning]: fail to save hashchain file:%s" % HashChainFile)
+ return False
+
+ def GenPreMakefileHashList(self):
+ # GenPreMakefileHashList consume below dicts:
+ # gPlatformHashFile
+ # gPackageHashFile
+ # gModuleHashFile
+ # GenPreMakefileHashList produce no dict.
+ # gModuleHashFile items might be produced in multiprocessing, so
+ # need check gModuleHashFile remote dict
+
+ # skip binary module
+ if self.IsBinaryModule:
+ return
+
+ FileList = []
+ m = hashlib.md5()
+ # Add Platform level hash
+ HashFile = GlobalData.gPlatformHashFile
+ if path.exists(LongFilePath(HashFile)):
+ FileList.append(HashFile)
+ m.update(HashFile.encode('utf-8'))
+ else:
+ EdkLogger.quiet("[cache warning]: No Platform HashFile: %s" % HashFile)
+
+ # Add Package level hash
+ if self.DependentPackageList:
+ for Pkg in sorted(self.DependentPackageList, key=lambda x: x.PackageName):
+ if not (Pkg.PackageName, Pkg.Arch) in GlobalData.gPackageHashFile:
+ EdkLogger.quiet("[cache warning]:No Package %s for module %s[%s]" % (Pkg.PackageName, self.MetaFile.Path, self.Arch))
+ continue
+ HashFile = GlobalData.gPackageHashFile[(Pkg.PackageName, Pkg.Arch)]
+ if path.exists(LongFilePath(HashFile)):
+ FileList.append(HashFile)
+ m.update(HashFile.encode('utf-8'))
+ else:
+ EdkLogger.quiet("[cache warning]:No Package HashFile: %s" % HashFile)
+
+ # Add Module self
+ # GenPreMakefileHashList needed in both --binary-destination
+ # and --hash. And --hash might save ModuleHashFile in remote dict
+ # during multiprocessing.
+ if (self.MetaFile.Path, self.Arch) in GlobalData.gModuleHashFile:
+ HashFile = GlobalData.gModuleHashFile[(self.MetaFile.Path, self.Arch)]
+ else:
+ EdkLogger.quiet("[cache error]:No ModuleHashFile for module: %s[%s]" % (self.MetaFile.Path, self.Arch))
+ if path.exists(LongFilePath(HashFile)):
+ FileList.append(HashFile)
+ m.update(HashFile.encode('utf-8'))
+ else:
+ EdkLogger.quiet("[cache warning]:No Module HashFile: %s" % HashFile)
+
+ # Add Library hash
+ if self.LibraryAutoGenList:
+ for Lib in sorted(self.LibraryAutoGenList, key=lambda x: x.MetaFile.Path):
+
+ if (Lib.MetaFile.Path, Lib.Arch) in GlobalData.gModuleHashFile:
+ HashFile = GlobalData.gModuleHashFile[(Lib.MetaFile.Path, Lib.Arch)]
+ else:
+ EdkLogger.quiet("[cache error]:No ModuleHashFile for lib: %s[%s]" % (Lib.MetaFile.Path, Lib.Arch))
+ if path.exists(LongFilePath(HashFile)):
+ FileList.append(HashFile)
+ m.update(HashFile.encode('utf-8'))
+ else:
+ EdkLogger.quiet("[cache warning]:No Lib HashFile: %s" % HashFile)
+
+ # Save PreMakeHashFileList
+ FilePath = path.join(self.BuildDir, self.Name + ".PreMakeHashFileList." + m.hexdigest())
+ try:
+ with open(LongFilePath(FilePath), 'w') as f:
+ json.dump(FileList, f, indent=0)
+ except:
+ EdkLogger.quiet("[cache warning]: fail to save PreMake HashFileList: %s" % FilePath)
+
+ def GenMakefileHashList(self):
+ # GenMakefileHashList only need in --binary-destination which will
+ # everything in local dict. So don't need check remote dict.
+
+ # skip binary module
+ if self.IsBinaryModule:
+ return
+
+ FileList = []
+ m = hashlib.md5()
+ # Add AutoGen hash
+ HashFile = GlobalData.gCMakeHashFile[(self.MetaFile.Path, self.Arch)]
+ if path.exists(LongFilePath(HashFile)):
+ FileList.append(HashFile)
+ m.update(HashFile.encode('utf-8'))
+ else:
+ EdkLogger.quiet("[cache warning]:No AutoGen HashFile: %s" % HashFile)
+
+ # Add Module self
+ if (self.MetaFile.Path, self.Arch) in GlobalData.gModuleHashFile:
+ HashFile = GlobalData.gModuleHashFile[(self.MetaFile.Path, self.Arch)]
+ else:
+ EdkLogger.quiet("[cache error]:No ModuleHashFile for module: %s[%s]" % (self.MetaFile.Path, self.Arch))
+ if path.exists(LongFilePath(HashFile)):
+ FileList.append(HashFile)
+ m.update(HashFile.encode('utf-8'))
+ else:
+ EdkLogger.quiet("[cache warning]:No Module HashFile: %s" % HashFile)
+
+ # Add Library hash
+ if self.LibraryAutoGenList:
+ for Lib in sorted(self.LibraryAutoGenList, key=lambda x: x.MetaFile.Path):
+ if (Lib.MetaFile.Path, Lib.Arch) in GlobalData.gModuleHashFile:
+ HashFile = GlobalData.gModuleHashFile[(Lib.MetaFile.Path, Lib.Arch)]
+ else:
+ EdkLogger.quiet("[cache error]:No ModuleHashFile for lib: %s[%s]" % (Lib.MetaFile.Path, Lib.Arch))
+ if path.exists(LongFilePath(HashFile)):
+ FileList.append(HashFile)
+ m.update(HashFile.encode('utf-8'))
+ else:
+ EdkLogger.quiet("[cache warning]:No Lib HashFile: %s" % HashFile)
+
+ # Save MakeHashFileList
+ FilePath = path.join(self.BuildDir, self.Name + ".MakeHashFileList." + m.hexdigest())
+ try:
+ with open(LongFilePath(FilePath), 'w') as f:
+ json.dump(FileList, f, indent=0)
+ except:
+ EdkLogger.quiet("[cache warning]: fail to save Make HashFileList: %s" % FilePath)
+
+ def CheckHashChainFile(self, HashChainFile):
+ # Assume the HashChainFile basename format is the 'x.hashchain.16BytesHexStr'
+ # The x is module name and the 16BytesHexStr is md5 hexdigest of
+ # all hashchain files content
+ HashStr = HashChainFile.split('.')[-1]
+ if len(HashStr) != 32:
+ EdkLogger.quiet("[cache error]: wrong format HashChainFile:%s" % (File))
+ return False
+
+ try:
+ with open(LongFilePath(HashChainFile), 'r') as f:
+ HashChainList = json.load(f)
+ except:
+ EdkLogger.quiet("[cache error]: fail to load HashChainFile: %s" % HashChainFile)
+ return False
+
+ # Print the different file info
+ # print(HashChainFile)
+ for idx, (SrcFile, SrcHash) in enumerate (HashChainList):
+ if SrcFile in GlobalData.gFileHashDict:
+ DestHash = GlobalData.gFileHashDict[SrcFile]
+ else:
+ try:
+ with open(LongFilePath(SrcFile), 'rb') as f:
+ Content = f.read()
+ DestHash = hashlib.md5(Content).hexdigest()
+ GlobalData.gFileHashDict[SrcFile] = DestHash
+ except IOError as X:
+ # cache miss if SrcFile is removed in new version code
+ GlobalData.gFileHashDict[SrcFile] = 0
+ EdkLogger.quiet("[cache insight]: first cache miss file in %s is %s" % (HashChainFile, SrcFile))
+ return False
+ if SrcHash != DestHash:
+ EdkLogger.quiet("[cache insight]: first cache miss file in %s is %s" % (HashChainFile, SrcFile))
+ return False
+
+ return True
+
+ ## Decide whether we can skip the left autogen and make process
+ def CanSkipbyMakeCache(self):
+ # For --binary-source only
+ # CanSkipbyMakeCache consume below dicts:
+ # gModuleMakeCacheStatus
+ # gHashChainStatus
+ # GenPreMakefileHashList produce gModuleMakeCacheStatus, gModuleHashFile dict.
+ # all these dicts might be produced in multiprocessing, so
+ # need check these remote dict
+
+ if not GlobalData.gBinCacheSource:
+ return False
+
+ if (self.MetaFile.Path, self.Arch) in GlobalData.gModuleMakeCacheStatus:
+ return GlobalData.gModuleMakeCacheStatus[(self.MetaFile.Path, self.Arch)]
+
+ # If Module is binary, which has special build rule, do not skip by cache.
+ if self.IsBinaryModule:
+ print("[cache miss]: MakeCache: Skip BinaryModule:", self.MetaFile.Path, self.Arch)
+ GlobalData.gModuleMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = False
+ return False
+
+ # see .inc as binary file, do not skip by hash
+ for f_ext in self.SourceFileList:
+ if '.inc' in str(f_ext):
+ print("[cache miss]: MakeCache: Skip '.inc' File:", self.MetaFile.Path, self.Arch)
+ GlobalData.gModuleMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = False
+ return False
+
+ ModuleCacheDir = path.join(GlobalData.gBinCacheSource, self.PlatformInfo.OutputDir, self.BuildTarget + "_" + self.ToolChain, self.Arch, self.SourceDir, self.MetaFile.BaseName)
+ FfsDir = path.join(GlobalData.gBinCacheSource, self.PlatformInfo.OutputDir, self.BuildTarget + "_" + self.ToolChain, TAB_FV_DIRECTORY, "Ffs", self.Guid + self.Name)
+
+ ModuleHashPairList = [] # tuple list: [tuple(PreMakefileHash, MakeHash)]
+ ModuleHashPair = path.join(ModuleCacheDir, self.Name + ".ModuleHashPair")
+ try:
+ with open(LongFilePath(ModuleHashPair), 'r') as f:
+ ModuleHashPairList = json.load(f)
+ except:
+ # ModuleHashPair might not exist for new added module
+ GlobalData.gModuleMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = False
+ EdkLogger.quiet("[cache warning]: fail to load ModuleHashPair file: %s" % ModuleHashPair)
+ print("[cache miss]: MakeCache:", self.MetaFile.Path, self.Arch)
+ return False
+
+ # Check the PreMakeHash in ModuleHashPairList one by one
+ for idx, (PreMakefileHash, MakeHash) in enumerate (ModuleHashPairList):
+ SourceHashDir = path.join(ModuleCacheDir, MakeHash)
+ SourceFfsHashDir = path.join(FfsDir, MakeHash)
+ PreMakeHashFileList_FilePah = path.join(ModuleCacheDir, self.Name + ".PreMakeHashFileList." + PreMakefileHash)
+ MakeHashFileList_FilePah = path.join(ModuleCacheDir, self.Name + ".MakeHashFileList." + MakeHash)
+
+ try:
+ with open(LongFilePath(MakeHashFileList_FilePah), 'r') as f:
+ MakeHashFileList = json.load(f)
+ except:
+ EdkLogger.quiet("[cache error]: fail to load MakeHashFileList file: %s" % MakeHashFileList_FilePah)
+ continue
+
+ HashMiss = False
+ for HashChainFile in MakeHashFileList:
+ HashChainStatus = None
+ if HashChainFile in GlobalData.gHashChainStatus:
+ HashChainStatus = GlobalData.gHashChainStatus[HashChainFile]
+ if HashChainStatus == False:
+ HashMiss = True
+ break
+ elif HashChainStatus == True:
+ continue
+ # Convert to path start with cache source dir
+ RelativePath = os.path.relpath(HashChainFile, self.WorkspaceDir)
+ NewFilePath = os.path.join(GlobalData.gBinCacheSource, RelativePath)
+ if self.CheckHashChainFile(NewFilePath):
+ GlobalData.gHashChainStatus[HashChainFile] = True
+ # Save the module self HashFile for GenPreMakefileHashList later usage
+ if self.Name + ".hashchain." in HashChainFile:
+ GlobalData.gModuleHashFile[(self.MetaFile.Path, self.Arch)] = HashChainFile
+ else:
+ GlobalData.gHashChainStatus[HashChainFile] = False
+ HashMiss = True
+ break
+
+ if HashMiss:
+ continue
+
+ # PreMakefile cache hit, restore the module build result
+ for root, dir, files in os.walk(SourceHashDir):
+ for f in files:
+ File = path.join(root, f)
+ self.CacheCopyFile(self.BuildDir, SourceHashDir, File)
+ if os.path.exists(SourceFfsHashDir):
+ for root, dir, files in os.walk(SourceFfsHashDir):
+ for f in files:
+ File = path.join(root, f)
+ self.CacheCopyFile(self.FfsOutputDir, SourceFfsHashDir, File)
+
+ if self.Name == "PcdPeim" or self.Name == "PcdDxe":
+ CreatePcdDatabaseCode(self, TemplateString(), TemplateString())
+
+ print("[cache hit]: MakeCache:", self.MetaFile.Path, self.Arch)
+ GlobalData.gModuleMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = True
+ return True
+
+ print("[cache miss]: MakeCache:", self.MetaFile.Path, self.Arch)
+ GlobalData.gModuleMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = False
+ return False
+
+ ## Decide whether we can skip the left autogen and make process
+ def CanSkipbyPreMakeCache(self):
+ # CanSkipbyPreMakeCache consume below dicts:
+ # gModulePreMakeCacheStatus
+ # gHashChainStatus
+ # gModuleHashFile
+ # GenPreMakefileHashList produce gModulePreMakeCacheStatus dict.
+ # all these dicts might be produced in multiprocessing, so
+ # need check these remote dicts
+
+ if not GlobalData.gUseHashCache or GlobalData.gBinCacheDest:
+ return False
+
+ if (self.MetaFile.Path, self.Arch) in GlobalData.gModulePreMakeCacheStatus:
+ return GlobalData.gModulePreMakeCacheStatus[(self.MetaFile.Path, self.Arch)]
+
+ # If Module is binary, which has special build rule, do not skip by cache.
+ if self.IsBinaryModule:
+ print("[cache miss]: PreMakeCache: Skip BinaryModule:", self.MetaFile.Path, self.Arch)
+ GlobalData.gModulePreMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = False
+ return False
+
+ # see .inc as binary file, do not skip by hash
+ for f_ext in self.SourceFileList:
+ if '.inc' in str(f_ext):
+ print("[cache miss]: PreMakeCache: Skip '.inc' File:", self.MetaFile.Path, self.Arch)
+ GlobalData.gModulePreMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = False
+ return False
+
+ # For --hash only in the incremental build
+ if not GlobalData.gBinCacheSource:
+ Files = [path.join(self.BuildDir, f) for f in os.listdir(self.BuildDir) if path.isfile(path.join(self.BuildDir, f))]
+ PreMakeHashFileList_FilePah = None
+ MakeTimeStamp = 0
+ # Find latest PreMakeHashFileList file in self.BuildDir folder
+ for File in Files:
+ if ".PreMakeHashFileList." in File:
+ FileTimeStamp = os.stat(path.join(self.BuildDir, File))[8]
+ if FileTimeStamp > MakeTimeStamp:
+ MakeTimeStamp = FileTimeStamp
+ PreMakeHashFileList_FilePah = File
+ if not PreMakeHashFileList_FilePah:
+ GlobalData.gModulePreMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = False
+ return False
+
+ try:
+ with open(LongFilePath(PreMakeHashFileList_FilePah), 'r') as f:
+ PreMakeHashFileList = json.load(f)
+ except:
+ EdkLogger.quiet("[cache error]: fail to load PreMakeHashFileList file: %s" % PreMakeHashFileList_FilePah)
+ print("[cache miss]: PreMakeCache:", self.MetaFile.Path, self.Arch)
+ GlobalData.gModulePreMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = False
+ return False
+
+ HashMiss = False
+ for HashChainFile in PreMakeHashFileList:
+ HashChainStatus = None
+ if HashChainFile in GlobalData.gHashChainStatus:
+ HashChainStatus = GlobalData.gHashChainStatus[HashChainFile]
+ if HashChainStatus == False:
+ HashMiss = True
+ break
+ elif HashChainStatus == True:
+ continue
+ if self.CheckHashChainFile(HashChainFile):
+ GlobalData.gHashChainStatus[HashChainFile] = True
+ # Save the module self HashFile for GenPreMakefileHashList later usage
+ if self.Name + ".hashchain." in HashChainFile:
+ GlobalData.gModuleHashFile[(self.MetaFile.Path, self.Arch)] = HashChainFile
+ else:
+ GlobalData.gHashChainStatus[HashChainFile] = False
+ HashMiss = True
+ break
+
+ if HashMiss:
+ print("[cache miss]: PreMakeCache:", self.MetaFile.Path, self.Arch)
+ GlobalData.gModulePreMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = False
+ return False
+ else:
+ print("[cache hit]: PreMakeCache:", self.MetaFile.Path, self.Arch)
+ GlobalData.gModulePreMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = True
+ return True
+
+ ModuleCacheDir = path.join(GlobalData.gBinCacheSource, self.PlatformInfo.OutputDir, self.BuildTarget + "_" + self.ToolChain, self.Arch, self.SourceDir, self.MetaFile.BaseName)
+ FfsDir = path.join(GlobalData.gBinCacheSource, self.PlatformInfo.OutputDir, self.BuildTarget + "_" + self.ToolChain, TAB_FV_DIRECTORY, "Ffs", self.Guid + self.Name)
+
+ ModuleHashPairList = [] # tuple list: [tuple(PreMakefileHash, MakeHash)]
+ ModuleHashPair = path.join(ModuleCacheDir, self.Name + ".ModuleHashPair")
+ try:
+ with open(LongFilePath(ModuleHashPair), 'r') as f:
+ ModuleHashPairList = json.load(f)
+ except:
+ # ModuleHashPair might not exist for new added module
+ GlobalData.gModulePreMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = False
+ EdkLogger.quiet("[cache warning]: fail to load ModuleHashPair file: %s" % ModuleHashPair)
+ print("[cache miss]: PreMakeCache:", self.MetaFile.Path, self.Arch)
+ return False
+
+ # Check the PreMakeHash in ModuleHashPairList one by one
+ for idx, (PreMakefileHash, MakeHash) in enumerate (ModuleHashPairList):
+ SourceHashDir = path.join(ModuleCacheDir, MakeHash)
+ SourceFfsHashDir = path.join(FfsDir, MakeHash)
+ PreMakeHashFileList_FilePah = path.join(ModuleCacheDir, self.Name + ".PreMakeHashFileList." + PreMakefileHash)
+ MakeHashFileList_FilePah = path.join(ModuleCacheDir, self.Name + ".MakeHashFileList." + MakeHash)
+
+ try:
+ with open(LongFilePath(PreMakeHashFileList_FilePah), 'r') as f:
+ PreMakeHashFileList = json.load(f)
+ except:
+ EdkLogger.quiet("[cache error]: fail to load PreMakeHashFileList file: %s" % PreMakeHashFileList_FilePah)
+ continue
+
+ HashMiss = False
+ for HashChainFile in PreMakeHashFileList:
+ HashChainStatus = None
+ if HashChainFile in GlobalData.gHashChainStatus:
+ HashChainStatus = GlobalData.gHashChainStatus[HashChainFile]
+ if HashChainStatus == False:
+ HashMiss = True
+ break
+ elif HashChainStatus == True:
+ continue
+ # Convert to path start with cache source dir
+ RelativePath = os.path.relpath(HashChainFile, self.WorkspaceDir)
+ NewFilePath = os.path.join(GlobalData.gBinCacheSource, RelativePath)
+ if self.CheckHashChainFile(NewFilePath):
+ GlobalData.gHashChainStatus[HashChainFile] = True
+ else:
+ GlobalData.gHashChainStatus[HashChainFile] = False
+ HashMiss = True
+ break
+
+ if HashMiss:
+ continue
+
+ # PreMakefile cache hit, restore the module build result
+ for root, dir, files in os.walk(SourceHashDir):
+ for f in files:
+ File = path.join(root, f)
+ self.CacheCopyFile(self.BuildDir, SourceHashDir, File)
+ if os.path.exists(SourceFfsHashDir):
+ for root, dir, files in os.walk(SourceFfsHashDir):
+ for f in files:
+ File = path.join(root, f)
+ self.CacheCopyFile(self.FfsOutputDir, SourceFfsHashDir, File)
+
+ if self.Name == "PcdPeim" or self.Name == "PcdDxe":
+ CreatePcdDatabaseCode(self, TemplateString(), TemplateString())
+
+ print("[cache hit]: PreMakeCache:", self.MetaFile.Path, self.Arch)
+ GlobalData.gModulePreMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = True
+ return True
+
+ print("[cache miss]: PreMakeCache:", self.MetaFile.Path, self.Arch)
+ GlobalData.gModulePreMakeCacheStatus[(self.MetaFile.Path, self.Arch)] = False
+ return False
+
+ ## Decide whether we can skip the Module build
+ def CanSkipbyCache(self, gHitSet):
+ # Hashing feature is off
+ if not GlobalData.gBinCacheSource:
+ return False
+
+ if self in gHitSet:
+ return True
+
+ return False
+
+ ## Decide whether we can skip the ModuleAutoGen process
+ # If any source file is newer than the module than we cannot skip
+ #
+ def CanSkip(self):
+ # Don't skip if cache feature enabled
+ if GlobalData.gUseHashCache or GlobalData.gBinCacheDest or GlobalData.gBinCacheSource:
+ return False
+ if self.MakeFileDir in GlobalData.gSikpAutoGenCache:
+ return True
+ if not os.path.exists(self.TimeStampPath):
+ return False
+ #last creation time of the module
+ DstTimeStamp = os.stat(self.TimeStampPath)[8]
+
+ SrcTimeStamp = self.Workspace._SrcTimeStamp
+ if SrcTimeStamp > DstTimeStamp:
+ return False
+
+ with open(self.TimeStampPath,'r') as f:
+ for source in f:
+ source = source.rstrip('\n')
+ if not os.path.exists(source):
+ return False
+ if source not in ModuleAutoGen.TimeDict :
+ ModuleAutoGen.TimeDict[source] = os.stat(source)[8]
+ if ModuleAutoGen.TimeDict[source] > DstTimeStamp:
+ return False
+ GlobalData.gSikpAutoGenCache.add(self.MakeFileDir)
+ return True
+
+ @cached_property
+ def TimeStampPath(self):
+ return os.path.join(self.MakeFileDir, 'AutoGenTimeStamp')
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py b/roms/edk2/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
new file mode 100644
index 000000000..9dd93b9be
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
@@ -0,0 +1,648 @@
+## @file
+# Create makefile for MS nmake and GNU make
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+from __future__ import absolute_import
+from Workspace.WorkspaceDatabase import WorkspaceDatabase,BuildDB
+from Common.caching import cached_property
+from AutoGen.BuildEngine import BuildRule,AutoGenReqBuildRuleVerNum
+from AutoGen.AutoGen import CalculatePriorityValue
+from Common.Misc import CheckPcdDatum,GuidValue
+from Common.Expression import ValueExpressionEx
+from Common.DataType import *
+from CommonDataClass.Exceptions import *
+from CommonDataClass.CommonClass import SkuInfoClass
+import Common.EdkLogger as EdkLogger
+from Common.BuildToolError import OPTION_CONFLICT,FORMAT_INVALID,RESOURCE_NOT_AVAILABLE
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+from collections import defaultdict
+from Common.Misc import PathClass
+import os
+
+
+#
+# The priority list while override build option
+#
+PrioList = {"0x11111" : 16, # TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE (Highest)
+ "0x01111" : 15, # ******_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE
+ "0x10111" : 14, # TARGET_*********_ARCH_COMMANDTYPE_ATTRIBUTE
+ "0x00111" : 13, # ******_*********_ARCH_COMMANDTYPE_ATTRIBUTE
+ "0x11011" : 12, # TARGET_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE
+ "0x01011" : 11, # ******_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE
+ "0x10011" : 10, # TARGET_*********_****_COMMANDTYPE_ATTRIBUTE
+ "0x00011" : 9, # ******_*********_****_COMMANDTYPE_ATTRIBUTE
+ "0x11101" : 8, # TARGET_TOOLCHAIN_ARCH_***********_ATTRIBUTE
+ "0x01101" : 7, # ******_TOOLCHAIN_ARCH_***********_ATTRIBUTE
+ "0x10101" : 6, # TARGET_*********_ARCH_***********_ATTRIBUTE
+ "0x00101" : 5, # ******_*********_ARCH_***********_ATTRIBUTE
+ "0x11001" : 4, # TARGET_TOOLCHAIN_****_***********_ATTRIBUTE
+ "0x01001" : 3, # ******_TOOLCHAIN_****_***********_ATTRIBUTE
+ "0x10001" : 2, # TARGET_*********_****_***********_ATTRIBUTE
+ "0x00001" : 1} # ******_*********_****_***********_ATTRIBUTE (Lowest)
+## Base class for AutoGen
+#
+# This class just implements the cache mechanism of AutoGen objects.
+#
+class AutoGenInfo(object):
+ # database to maintain the objects in each child class
+ __ObjectCache = {} # (BuildTarget, ToolChain, ARCH, platform file): AutoGen object
+
+ ## Factory method
+ #
+ # @param Class class object of real AutoGen class
+ # (WorkspaceAutoGen, ModuleAutoGen or PlatformAutoGen)
+ # @param Workspace Workspace directory or WorkspaceAutoGen object
+ # @param MetaFile The path of meta file
+ # @param Target Build target
+ # @param Toolchain Tool chain name
+ # @param Arch Target arch
+ # @param *args The specific class related parameters
+ # @param **kwargs The specific class related dict parameters
+ #
+ @classmethod
+ def GetCache(cls):
+ return cls.__ObjectCache
+ def __new__(cls, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs):
+ # check if the object has been created
+ Key = (Target, Toolchain, Arch, MetaFile)
+ if Key in cls.__ObjectCache:
+ # if it exists, just return it directly
+ return cls.__ObjectCache[Key]
+ # it didnt exist. create it, cache it, then return it
+ RetVal = cls.__ObjectCache[Key] = super(AutoGenInfo, cls).__new__(cls)
+ return RetVal
+
+
+ ## hash() operator
+ #
+ # The file path of platform file will be used to represent hash value of this object
+ #
+ # @retval int Hash value of the file path of platform file
+ #
+ def __hash__(self):
+ return hash(self.MetaFile)
+
+ ## str() operator
+ #
+ # The file path of platform file will be used to represent this object
+ #
+ # @retval string String of platform file path
+ #
+ def __str__(self):
+ return str(self.MetaFile)
+
+ ## "==" operator
+ def __eq__(self, Other):
+ return Other and self.MetaFile == Other
+
+ ## Expand * in build option key
+ #
+ # @param Options Options to be expanded
+ # @param ToolDef Use specified ToolDef instead of full version.
+ # This is needed during initialization to prevent
+ # infinite recursion betweeh BuildOptions,
+ # ToolDefinition, and this function.
+ #
+ # @retval options Options expanded
+ #
+ def _ExpandBuildOption(self, Options, ModuleStyle=None, ToolDef=None):
+ if not ToolDef:
+ ToolDef = self.ToolDefinition
+ BuildOptions = {}
+ FamilyMatch = False
+ FamilyIsNull = True
+
+ OverrideList = {}
+ #
+ # Construct a list contain the build options which need override.
+ #
+ for Key in Options:
+ #
+ # Key[0] -- tool family
+ # Key[1] -- TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE
+ #
+ if (Key[0] == self.BuildRuleFamily and
+ (ModuleStyle is None or len(Key) < 3 or (len(Key) > 2 and Key[2] == ModuleStyle))):
+ Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_')
+ if (Target == self.BuildTarget or Target == TAB_STAR) and\
+ (ToolChain == self.ToolChain or ToolChain == TAB_STAR) and\
+ (Arch == self.Arch or Arch == TAB_STAR) and\
+ Options[Key].startswith("="):
+
+ if OverrideList.get(Key[1]) is not None:
+ OverrideList.pop(Key[1])
+ OverrideList[Key[1]] = Options[Key]
+
+ #
+ # Use the highest priority value.
+ #
+ if (len(OverrideList) >= 2):
+ KeyList = list(OverrideList.keys())
+ for Index in range(len(KeyList)):
+ NowKey = KeyList[Index]
+ Target1, ToolChain1, Arch1, CommandType1, Attr1 = NowKey.split("_")
+ for Index1 in range(len(KeyList) - Index - 1):
+ NextKey = KeyList[Index1 + Index + 1]
+ #
+ # Compare two Key, if one is included by another, choose the higher priority one
+ #
+ Target2, ToolChain2, Arch2, CommandType2, Attr2 = NextKey.split("_")
+ if (Target1 == Target2 or Target1 == TAB_STAR or Target2 == TAB_STAR) and\
+ (ToolChain1 == ToolChain2 or ToolChain1 == TAB_STAR or ToolChain2 == TAB_STAR) and\
+ (Arch1 == Arch2 or Arch1 == TAB_STAR or Arch2 == TAB_STAR) and\
+ (CommandType1 == CommandType2 or CommandType1 == TAB_STAR or CommandType2 == TAB_STAR) and\
+ (Attr1 == Attr2 or Attr1 == TAB_STAR or Attr2 == TAB_STAR):
+
+ if CalculatePriorityValue(NowKey) > CalculatePriorityValue(NextKey):
+ if Options.get((self.BuildRuleFamily, NextKey)) is not None:
+ Options.pop((self.BuildRuleFamily, NextKey))
+ else:
+ if Options.get((self.BuildRuleFamily, NowKey)) is not None:
+ Options.pop((self.BuildRuleFamily, NowKey))
+
+ for Key in Options:
+ if ModuleStyle is not None and len (Key) > 2:
+ # Check Module style is EDK or EDKII.
+ # Only append build option for the matched style module.
+ if ModuleStyle == EDK_NAME and Key[2] != EDK_NAME:
+ continue
+ elif ModuleStyle == EDKII_NAME and Key[2] != EDKII_NAME:
+ continue
+ Family = Key[0]
+ Target, Tag, Arch, Tool, Attr = Key[1].split("_")
+ # if tool chain family doesn't match, skip it
+ if Tool in ToolDef and Family != "":
+ FamilyIsNull = False
+ if ToolDef[Tool].get(TAB_TOD_DEFINES_BUILDRULEFAMILY, "") != "":
+ if Family != ToolDef[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]:
+ continue
+ elif Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]:
+ continue
+ FamilyMatch = True
+ # expand any wildcard
+ if Target == TAB_STAR or Target == self.BuildTarget:
+ if Tag == TAB_STAR or Tag == self.ToolChain:
+ if Arch == TAB_STAR or Arch == self.Arch:
+ if Tool not in BuildOptions:
+ BuildOptions[Tool] = {}
+ if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
+ BuildOptions[Tool][Attr] = Options[Key]
+ else:
+ # append options for the same tool except PATH
+ if Attr != 'PATH':
+ BuildOptions[Tool][Attr] += " " + Options[Key]
+ else:
+ BuildOptions[Tool][Attr] = Options[Key]
+ # Build Option Family has been checked, which need't to be checked again for family.
+ if FamilyMatch or FamilyIsNull:
+ return BuildOptions
+
+ for Key in Options:
+ if ModuleStyle is not None and len (Key) > 2:
+ # Check Module style is EDK or EDKII.
+ # Only append build option for the matched style module.
+ if ModuleStyle == EDK_NAME and Key[2] != EDK_NAME:
+ continue
+ elif ModuleStyle == EDKII_NAME and Key[2] != EDKII_NAME:
+ continue
+ Family = Key[0]
+ Target, Tag, Arch, Tool, Attr = Key[1].split("_")
+ # if tool chain family doesn't match, skip it
+ if Tool not in ToolDef or Family == "":
+ continue
+ # option has been added before
+ if Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]:
+ continue
+
+ # expand any wildcard
+ if Target == TAB_STAR or Target == self.BuildTarget:
+ if Tag == TAB_STAR or Tag == self.ToolChain:
+ if Arch == TAB_STAR or Arch == self.Arch:
+ if Tool not in BuildOptions:
+ BuildOptions[Tool] = {}
+ if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
+ BuildOptions[Tool][Attr] = Options[Key]
+ else:
+ # append options for the same tool except PATH
+ if Attr != 'PATH':
+ BuildOptions[Tool][Attr] += " " + Options[Key]
+ else:
+ BuildOptions[Tool][Attr] = Options[Key]
+ return BuildOptions
+#
+#This class is the pruned WorkSpaceAutoGen for ModuleAutoGen in multiple thread
+#
+class WorkSpaceInfo(AutoGenInfo):
+ def __init__(self,Workspace, MetaFile, Target, ToolChain, Arch):
+ if not hasattr(self, "_Init"):
+ self.do_init(Workspace, MetaFile, Target, ToolChain, Arch)
+ self._Init = True
+ def do_init(self,Workspace, MetaFile, Target, ToolChain, Arch):
+ self._SrcTimeStamp = 0
+ self.Db = BuildDB
+ self.BuildDatabase = self.Db.BuildObject
+ self.Target = Target
+ self.ToolChain = ToolChain
+ self.WorkspaceDir = Workspace
+ self.ActivePlatform = MetaFile
+ self.ArchList = Arch
+ self.AutoGenObjectList = []
+ @property
+ def BuildDir(self):
+ return self.AutoGenObjectList[0].BuildDir
+
+ @property
+ def Name(self):
+ return self.AutoGenObjectList[0].Platform.PlatformName
+
+ @property
+ def FlashDefinition(self):
+ return self.AutoGenObjectList[0].Platform.FlashDefinition
+ @property
+ def GenFdsCommandDict(self):
+ FdsCommandDict = self.AutoGenObjectList[0].DataPipe.Get("FdsCommandDict")
+ if FdsCommandDict:
+ return FdsCommandDict
+ return {}
+
+ @cached_property
+ def FvDir(self):
+ return os.path.join(self.BuildDir, TAB_FV_DIRECTORY)
+
+class PlatformInfo(AutoGenInfo):
+ def __init__(self, Workspace, MetaFile, Target, ToolChain, Arch,DataPipe):
+ if not hasattr(self, "_Init"):
+ self.do_init(Workspace, MetaFile, Target, ToolChain, Arch,DataPipe)
+ self._Init = True
+ def do_init(self,Workspace, MetaFile, Target, ToolChain, Arch,DataPipe):
+ self.Wa = Workspace
+ self.WorkspaceDir = self.Wa.WorkspaceDir
+ self.MetaFile = MetaFile
+ self.Arch = Arch
+ self.Target = Target
+ self.BuildTarget = Target
+ self.ToolChain = ToolChain
+ self.Platform = self.Wa.BuildDatabase[self.MetaFile, self.Arch, self.Target, self.ToolChain]
+
+ self.SourceDir = MetaFile.SubDir
+ self.DataPipe = DataPipe
+ @cached_property
+ def _AsBuildModuleList(self):
+ retVal = self.DataPipe.Get("AsBuildModuleList")
+ if retVal is None:
+ retVal = {}
+ return retVal
+
+ ## Test if a module is supported by the platform
+ #
+ # An error will be raised directly if the module or its arch is not supported
+ # by the platform or current configuration
+ #
+ def ValidModule(self, Module):
+ return Module in self.Platform.Modules or Module in self.Platform.LibraryInstances \
+ or Module in self._AsBuildModuleList
+
+ @cached_property
+ def ToolChainFamily(self):
+ retVal = self.DataPipe.Get("ToolChainFamily")
+ if retVal is None:
+ retVal = {}
+ return retVal
+
+ @cached_property
+ def BuildRuleFamily(self):
+ retVal = self.DataPipe.Get("BuildRuleFamily")
+ if retVal is None:
+ retVal = {}
+ return retVal
+
+ @cached_property
+ def _MbList(self):
+ return [self.Wa.BuildDatabase[m, self.Arch, self.BuildTarget, self.ToolChain] for m in self.Platform.Modules]
+
+ @cached_property
+ def PackageList(self):
+ RetVal = set()
+ for dec_file,Arch in self.DataPipe.Get("PackageList"):
+ RetVal.add(self.Wa.BuildDatabase[dec_file,Arch,self.BuildTarget, self.ToolChain])
+ return list(RetVal)
+
+ ## Return the directory to store all intermediate and final files built
+ @cached_property
+ def BuildDir(self):
+ if os.path.isabs(self.OutputDir):
+ RetVal = os.path.join(
+ os.path.abspath(self.OutputDir),
+ self.Target + "_" + self.ToolChain,
+ )
+ else:
+ RetVal = os.path.join(
+ self.WorkspaceDir,
+ self.OutputDir,
+ self.Target + "_" + self.ToolChain,
+ )
+ return RetVal
+
+ ## Return the build output directory platform specifies
+ @cached_property
+ def OutputDir(self):
+ return self.Platform.OutputDirectory
+
+ ## Return platform name
+ @cached_property
+ def Name(self):
+ return self.Platform.PlatformName
+
+ ## Return meta-file GUID
+ @cached_property
+ def Guid(self):
+ return self.Platform.Guid
+
+ ## Return platform version
+ @cached_property
+ def Version(self):
+ return self.Platform.Version
+
+ ## Return paths of tools
+ @cached_property
+ def ToolDefinition(self):
+ retVal = self.DataPipe.Get("TOOLDEF")
+ if retVal is None:
+ retVal = {}
+ return retVal
+
+ ## Return build command string
+ #
+ # @retval string Build command string
+ #
+ @cached_property
+ def BuildCommand(self):
+ retVal = self.DataPipe.Get("BuildCommand")
+ if retVal is None:
+ retVal = []
+ return retVal
+
+ @cached_property
+ def PcdTokenNumber(self):
+ retVal = self.DataPipe.Get("PCD_TNUM")
+ if retVal is None:
+ retVal = {}
+ return retVal
+
+ ## Override PCD setting (type, value, ...)
+ #
+ # @param ToPcd The PCD to be overridden
+ # @param FromPcd The PCD overriding from
+ #
+ def _OverridePcd(self, ToPcd, FromPcd, Module="", Msg="", Library=""):
+ #
+ # in case there's PCDs coming from FDF file, which have no type given.
+ # at this point, ToPcd.Type has the type found from dependent
+ # package
+ #
+ TokenCName = ToPcd.TokenCName
+ for PcdItem in self.MixedPcd:
+ if (ToPcd.TokenCName, ToPcd.TokenSpaceGuidCName) in self.MixedPcd[PcdItem]:
+ TokenCName = PcdItem[0]
+ break
+ if FromPcd is not None:
+ if ToPcd.Pending and FromPcd.Type:
+ ToPcd.Type = FromPcd.Type
+ elif ToPcd.Type and FromPcd.Type\
+ and ToPcd.Type != FromPcd.Type and ToPcd.Type in FromPcd.Type:
+ if ToPcd.Type.strip() == TAB_PCDS_DYNAMIC_EX:
+ ToPcd.Type = FromPcd.Type
+ elif ToPcd.Type and FromPcd.Type \
+ and ToPcd.Type != FromPcd.Type:
+ if Library:
+ Module = str(Module) + " 's library file (" + str(Library) + ")"
+ EdkLogger.error("build", OPTION_CONFLICT, "Mismatched PCD type",
+ ExtraData="%s.%s is used as [%s] in module %s, but as [%s] in %s."\
+ % (ToPcd.TokenSpaceGuidCName, TokenCName,
+ ToPcd.Type, Module, FromPcd.Type, Msg),
+ File=self.MetaFile)
+
+ if FromPcd.MaxDatumSize:
+ ToPcd.MaxDatumSize = FromPcd.MaxDatumSize
+ ToPcd.MaxSizeUserSet = FromPcd.MaxDatumSize
+ if FromPcd.DefaultValue:
+ ToPcd.DefaultValue = FromPcd.DefaultValue
+ if FromPcd.TokenValue:
+ ToPcd.TokenValue = FromPcd.TokenValue
+ if FromPcd.DatumType:
+ ToPcd.DatumType = FromPcd.DatumType
+ if FromPcd.SkuInfoList:
+ ToPcd.SkuInfoList = FromPcd.SkuInfoList
+ if FromPcd.UserDefinedDefaultStoresFlag:
+ ToPcd.UserDefinedDefaultStoresFlag = FromPcd.UserDefinedDefaultStoresFlag
+ # Add Flexible PCD format parse
+ if ToPcd.DefaultValue:
+ try:
+ ToPcd.DefaultValue = ValueExpressionEx(ToPcd.DefaultValue, ToPcd.DatumType, self._GuidDict)(True)
+ except BadExpression as Value:
+ EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %(ToPcd.TokenSpaceGuidCName, ToPcd.TokenCName, ToPcd.DefaultValue, Value),
+ File=self.MetaFile)
+
+ # check the validation of datum
+ IsValid, Cause = CheckPcdDatum(ToPcd.DatumType, ToPcd.DefaultValue)
+ if not IsValid:
+ EdkLogger.error('build', FORMAT_INVALID, Cause, File=self.MetaFile,
+ ExtraData="%s.%s" % (ToPcd.TokenSpaceGuidCName, TokenCName))
+ ToPcd.validateranges = FromPcd.validateranges
+ ToPcd.validlists = FromPcd.validlists
+ ToPcd.expressions = FromPcd.expressions
+ ToPcd.CustomAttribute = FromPcd.CustomAttribute
+
+ if FromPcd is not None and ToPcd.DatumType == TAB_VOID and not ToPcd.MaxDatumSize:
+ EdkLogger.debug(EdkLogger.DEBUG_9, "No MaxDatumSize specified for PCD %s.%s" \
+ % (ToPcd.TokenSpaceGuidCName, TokenCName))
+ Value = ToPcd.DefaultValue
+ if not Value:
+ ToPcd.MaxDatumSize = '1'
+ elif Value[0] == 'L':
+ ToPcd.MaxDatumSize = str((len(Value) - 2) * 2)
+ elif Value[0] == '{':
+ ToPcd.MaxDatumSize = str(len(Value.split(',')))
+ else:
+ ToPcd.MaxDatumSize = str(len(Value) - 1)
+
+ # apply default SKU for dynamic PCDS if specified one is not available
+ if (ToPcd.Type in PCD_DYNAMIC_TYPE_SET or ToPcd.Type in PCD_DYNAMIC_EX_TYPE_SET) \
+ and not ToPcd.SkuInfoList:
+ if self.Platform.SkuName in self.Platform.SkuIds:
+ SkuName = self.Platform.SkuName
+ else:
+ SkuName = TAB_DEFAULT
+ ToPcd.SkuInfoList = {
+ SkuName : SkuInfoClass(SkuName, self.Platform.SkuIds[SkuName][0], '', '', '', '', '', ToPcd.DefaultValue)
+ }
+
+ def ApplyPcdSetting(self, Module, Pcds, Library=""):
+ # for each PCD in module
+ for Name, Guid in Pcds:
+ PcdInModule = Pcds[Name, Guid]
+ # find out the PCD setting in platform
+ if (Name, Guid) in self.Pcds:
+ PcdInPlatform = self.Pcds[Name, Guid]
+ else:
+ PcdInPlatform = None
+ # then override the settings if any
+ self._OverridePcd(PcdInModule, PcdInPlatform, Module, Msg="DSC PCD sections", Library=Library)
+ # resolve the VariableGuid value
+ for SkuId in PcdInModule.SkuInfoList:
+ Sku = PcdInModule.SkuInfoList[SkuId]
+ if Sku.VariableGuid == '': continue
+ Sku.VariableGuidValue = GuidValue(Sku.VariableGuid, self.PackageList, self.MetaFile.Path)
+ if Sku.VariableGuidValue is None:
+ PackageList = "\n\t".join(str(P) for P in self.PackageList)
+ EdkLogger.error(
+ 'build',
+ RESOURCE_NOT_AVAILABLE,
+ "Value of GUID [%s] is not found in" % Sku.VariableGuid,
+ ExtraData=PackageList + "\n\t(used with %s.%s from module %s)" \
+ % (Guid, Name, str(Module)),
+ File=self.MetaFile
+ )
+
+ # override PCD settings with module specific setting
+ if Module in self.Platform.Modules:
+ PlatformModule = self.Platform.Modules[str(Module)]
+ for Key in PlatformModule.Pcds:
+ if self.BuildOptionPcd:
+ for pcd in self.BuildOptionPcd:
+ (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd
+ if (TokenCName, TokenSpaceGuidCName) == Key and FieldName =="":
+ PlatformModule.Pcds[Key].DefaultValue = pcdvalue
+ PlatformModule.Pcds[Key].PcdValueFromComm = pcdvalue
+ break
+ Flag = False
+ if Key in Pcds:
+ ToPcd = Pcds[Key]
+ Flag = True
+ elif Key in self.MixedPcd:
+ for PcdItem in self.MixedPcd[Key]:
+ if PcdItem in Pcds:
+ ToPcd = Pcds[PcdItem]
+ Flag = True
+ break
+ if Flag:
+ self._OverridePcd(ToPcd, PlatformModule.Pcds[Key], Module, Msg="DSC Components Module scoped PCD section", Library=Library)
+ # use PCD value to calculate the MaxDatumSize when it is not specified
+ for Name, Guid in Pcds:
+ Pcd = Pcds[Name, Guid]
+ if Pcd.DatumType == TAB_VOID and not Pcd.MaxDatumSize:
+ Pcd.MaxSizeUserSet = None
+ Value = Pcd.DefaultValue
+ if not Value:
+ Pcd.MaxDatumSize = '1'
+ elif Value[0] == 'L':
+ Pcd.MaxDatumSize = str((len(Value) - 2) * 2)
+ elif Value[0] == '{':
+ Pcd.MaxDatumSize = str(len(Value.split(',')))
+ else:
+ Pcd.MaxDatumSize = str(len(Value) - 1)
+ return list(Pcds.values())
+
+ @cached_property
+ def Pcds(self):
+ PlatformPcdData = self.DataPipe.Get("PLA_PCD")
+# for pcd in PlatformPcdData:
+# for skuid in pcd.SkuInfoList:
+# pcd.SkuInfoList[skuid] = self.CreateSkuInfoFromDict(pcd.SkuInfoList[skuid])
+ return {(pcddata.TokenCName,pcddata.TokenSpaceGuidCName):pcddata for pcddata in PlatformPcdData}
+
+ def CreateSkuInfoFromDict(self,SkuInfoDict):
+ return SkuInfoClass(
+ SkuInfoDict.get("SkuIdName"),
+ SkuInfoDict.get("SkuId"),
+ SkuInfoDict.get("VariableName"),
+ SkuInfoDict.get("VariableGuid"),
+ SkuInfoDict.get("VariableOffset"),
+ SkuInfoDict.get("HiiDefaultValue"),
+ SkuInfoDict.get("VpdOffset"),
+ SkuInfoDict.get("DefaultValue"),
+ SkuInfoDict.get("VariableGuidValue"),
+ SkuInfoDict.get("VariableAttribute",""),
+ SkuInfoDict.get("DefaultStore",None)
+ )
+ @cached_property
+ def MixedPcd(self):
+ return self.DataPipe.Get("MixedPcd")
+ @cached_property
+ def _GuidDict(self):
+ RetVal = self.DataPipe.Get("GuidDict")
+ if RetVal is None:
+ RetVal = {}
+ return RetVal
+ @cached_property
+ def BuildOptionPcd(self):
+ return self.DataPipe.Get("BuildOptPcd")
+ def ApplyBuildOption(self,module):
+ PlatformOptions = self.DataPipe.Get("PLA_BO")
+ ModuleBuildOptions = self.DataPipe.Get("MOL_BO")
+ ModuleOptionFromDsc = ModuleBuildOptions.get((module.MetaFile.File,module.MetaFile.Root))
+ if ModuleOptionFromDsc:
+ ModuleTypeOptions, PlatformModuleOptions = ModuleOptionFromDsc["ModuleTypeOptions"],ModuleOptionFromDsc["PlatformModuleOptions"]
+ else:
+ ModuleTypeOptions, PlatformModuleOptions = {}, {}
+ ToolDefinition = self.DataPipe.Get("TOOLDEF")
+ ModuleOptions = self._ExpandBuildOption(module.BuildOptions)
+ BuildRuleOrder = None
+ for Options in [ToolDefinition, ModuleOptions, PlatformOptions, ModuleTypeOptions, PlatformModuleOptions]:
+ for Tool in Options:
+ for Attr in Options[Tool]:
+ if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:
+ BuildRuleOrder = Options[Tool][Attr]
+
+ AllTools = set(list(ModuleOptions.keys()) + list(PlatformOptions.keys()) +
+ list(PlatformModuleOptions.keys()) + list(ModuleTypeOptions.keys()) +
+ list(ToolDefinition.keys()))
+ BuildOptions = defaultdict(lambda: defaultdict(str))
+ for Tool in AllTools:
+ for Options in [ToolDefinition, ModuleOptions, PlatformOptions, ModuleTypeOptions, PlatformModuleOptions]:
+ if Tool not in Options:
+ continue
+ for Attr in Options[Tool]:
+ #
+ # Do not generate it in Makefile
+ #
+ if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:
+ continue
+ Value = Options[Tool][Attr]
+ # check if override is indicated
+ if Value.startswith('='):
+ BuildOptions[Tool][Attr] = mws.handleWsMacro(Value[1:])
+ else:
+ if Attr != 'PATH':
+ BuildOptions[Tool][Attr] += " " + mws.handleWsMacro(Value)
+ else:
+ BuildOptions[Tool][Attr] = mws.handleWsMacro(Value)
+
+ return BuildOptions, BuildRuleOrder
+
+ def ApplyLibraryInstance(self,module):
+ alldeps = self.DataPipe.Get("DEPS")
+ if alldeps is None:
+ alldeps = {}
+ mod_libs = alldeps.get((module.MetaFile.File,module.MetaFile.Root,module.Arch,module.MetaFile.Path),[])
+ retVal = []
+ for (file_path,root,arch,abs_path) in mod_libs:
+ libMetaFile = PathClass(file_path,root)
+ libMetaFile.OriginalPath = PathClass(file_path,root)
+ libMetaFile.Path = abs_path
+ retVal.append(self.Wa.BuildDatabase[libMetaFile, arch, self.Target,self.ToolChain])
+ return retVal
+
+ ## Parse build_rule.txt in Conf Directory.
+ #
+ # @retval BuildRule object
+ #
+ @cached_property
+ def BuildRule(self):
+ WInfo = self.DataPipe.Get("P_Info")
+ RetVal = WInfo.get("BuildRuleFile")
+ if RetVal._FileVersion == "":
+ RetVal._FileVersion = AutoGenReqBuildRuleVerNum
+ return RetVal
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/roms/edk2/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
new file mode 100644
index 000000000..af66c48c7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
@@ -0,0 +1,1518 @@
+## @file
+# Create makefile for MS nmake and GNU make
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+## Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+import os.path as path
+import copy
+from collections import defaultdict
+
+from .BuildEngine import BuildRule,gDefaultBuildRuleFile,AutoGenReqBuildRuleVerNum
+from .GenVar import VariableMgr, var_info
+from . import GenMake
+from AutoGen.DataPipe import MemoryDataPipe
+from AutoGen.ModuleAutoGen import ModuleAutoGen
+from AutoGen.AutoGen import AutoGen
+from AutoGen.AutoGen import CalculatePriorityValue
+from Workspace.WorkspaceCommon import GetModuleLibInstances
+from CommonDataClass.CommonClass import SkuInfoClass
+from Common.caching import cached_class_function
+from Common.Expression import ValueExpressionEx
+from Common.StringUtils import StringToArray,NormPath
+from Common.BuildToolError import *
+from Common.DataType import *
+from Common.Misc import *
+import Common.VpdInfoFile as VpdInfoFile
+
+## Split command line option string to list
+#
+# subprocess.Popen needs the args to be a sequence. Otherwise there's problem
+# in non-windows platform to launch command
+#
+def _SplitOption(OptionString):
+ OptionList = []
+ LastChar = " "
+ OptionStart = 0
+ QuotationMark = ""
+ for Index in range(0, len(OptionString)):
+ CurrentChar = OptionString[Index]
+ if CurrentChar in ['"', "'"]:
+ if QuotationMark == CurrentChar:
+ QuotationMark = ""
+ elif QuotationMark == "":
+ QuotationMark = CurrentChar
+ continue
+ elif QuotationMark:
+ continue
+
+ if CurrentChar in ["/", "-"] and LastChar in [" ", "\t", "\r", "\n"]:
+ if Index > OptionStart:
+ OptionList.append(OptionString[OptionStart:Index - 1])
+ OptionStart = Index
+ LastChar = CurrentChar
+ OptionList.append(OptionString[OptionStart:])
+ return OptionList
+
+## AutoGen class for platform
+#
+# PlatformAutoGen class will process the original information in platform
+# file in order to generate makefile for platform.
+#
+class PlatformAutoGen(AutoGen):
+ # call super().__init__ then call the worker function with different parameter count
+ def __init__(self, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs):
+ if not hasattr(self, "_Init"):
+ self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch)
+ self._Init = True
+ #
+ # Used to store all PCDs for both PEI and DXE phase, in order to generate
+ # correct PCD database
+ #
+ _DynaPcdList_ = []
+ _NonDynaPcdList_ = []
+ _PlatformPcds = {}
+
+
+
+ ## Initialize PlatformAutoGen
+ #
+ #
+ # @param Workspace WorkspaceAutoGen object
+ # @param PlatformFile Platform file (DSC file)
+ # @param Target Build target (DEBUG, RELEASE)
+ # @param Toolchain Name of tool chain
+ # @param Arch arch of the platform supports
+ #
+ def _InitWorker(self, Workspace, PlatformFile, Target, Toolchain, Arch):
+ EdkLogger.debug(EdkLogger.DEBUG_9, "AutoGen platform [%s] [%s]" % (PlatformFile, Arch))
+ GlobalData.gProcessingFile = "%s [%s, %s, %s]" % (PlatformFile, Arch, Toolchain, Target)
+
+ self.MetaFile = PlatformFile
+ self.Workspace = Workspace
+ self.WorkspaceDir = Workspace.WorkspaceDir
+ self.ToolChain = Toolchain
+ self.BuildTarget = Target
+ self.Arch = Arch
+ self.SourceDir = PlatformFile.SubDir
+ self.FdTargetList = self.Workspace.FdTargetList
+ self.FvTargetList = self.Workspace.FvTargetList
+ # get the original module/package/platform objects
+ self.BuildDatabase = Workspace.BuildDatabase
+ self.DscBuildDataObj = Workspace.Platform
+
+ # MakeFileName is used to get the Makefile name and as a flag
+ # indicating whether the file has been created.
+ self.MakeFileName = ""
+
+ self._DynamicPcdList = None # [(TokenCName1, TokenSpaceGuidCName1), (TokenCName2, TokenSpaceGuidCName2), ...]
+ self._NonDynamicPcdList = None # [(TokenCName1, TokenSpaceGuidCName1), (TokenCName2, TokenSpaceGuidCName2), ...]
+
+ self._AsBuildInfList = []
+ self._AsBuildModuleList = []
+
+ self.VariableInfo = None
+
+ if GlobalData.gFdfParser is not None:
+ self._AsBuildInfList = GlobalData.gFdfParser.Profile.InfList
+ for Inf in self._AsBuildInfList:
+ InfClass = PathClass(NormPath(Inf), GlobalData.gWorkspace, self.Arch)
+ M = self.BuildDatabase[InfClass, self.Arch, self.BuildTarget, self.ToolChain]
+ if not M.IsBinaryModule:
+ continue
+ self._AsBuildModuleList.append(InfClass)
+ # get library/modules for build
+ self.LibraryBuildDirectoryList = []
+ self.ModuleBuildDirectoryList = []
+
+ self.DataPipe = MemoryDataPipe(self.BuildDir)
+ self.DataPipe.FillData(self)
+
+ return True
+ def FillData_LibConstPcd(self):
+ libConstPcd = {}
+ for LibAuto in self.LibraryAutoGenList:
+ if LibAuto.ConstPcd:
+ libConstPcd[(LibAuto.MetaFile.File,LibAuto.MetaFile.Root,LibAuto.Arch,LibAuto.MetaFile.Path)] = LibAuto.ConstPcd
+ self.DataPipe.DataContainer = {"LibConstPcd":libConstPcd}
+ ## hash() operator of PlatformAutoGen
+ #
+ # The platform file path and arch string will be used to represent
+ # hash value of this object
+ #
+ # @retval int Hash value of the platform file path and arch
+ #
+ @cached_class_function
+ def __hash__(self):
+ return hash((self.MetaFile, self.Arch,self.ToolChain,self.BuildTarget))
+ @cached_class_function
+ def __repr__(self):
+ return "%s [%s]" % (self.MetaFile, self.Arch)
+
+ ## Create autogen code for platform and modules
+ #
+ # Since there's no autogen code for platform, this method will do nothing
+ # if CreateModuleCodeFile is set to False.
+ #
+ # @param CreateModuleCodeFile Flag indicating if creating module's
+ # autogen code file or not
+ #
+ @cached_class_function
+ def CreateCodeFile(self, CreateModuleCodeFile=False):
+ # only module has code to be created, so do nothing if CreateModuleCodeFile is False
+ if not CreateModuleCodeFile:
+ return
+
+ for Ma in self.ModuleAutoGenList:
+ Ma.CreateCodeFile(CreateModuleCodeFile)
+
+ ## Generate Fds Command
+ @cached_property
+ def GenFdsCommand(self):
+ return self.Workspace.GenFdsCommand
+
+ ## Create makefile for the platform and modules in it
+ #
+ # @param CreateModuleMakeFile Flag indicating if the makefile for
+ # modules will be created as well
+ #
+ def CreateMakeFile(self, CreateModuleMakeFile=False, FfsCommand = {}):
+ if CreateModuleMakeFile:
+ for Ma in self._MaList:
+ key = (Ma.MetaFile.File, self.Arch)
+ if key in FfsCommand:
+ Ma.CreateMakeFile(CreateModuleMakeFile, FfsCommand[key])
+ else:
+ Ma.CreateMakeFile(CreateModuleMakeFile)
+ self.CreateLibModuelDirs()
+
+ def CreateLibModuelDirs(self):
+ # No need to create makefile for the platform more than once.
+ if self.MakeFileName:
+ return
+
+ # create library/module build dirs for platform
+ Makefile = GenMake.PlatformMakefile(self)
+ self.LibraryBuildDirectoryList = Makefile.GetLibraryBuildDirectoryList()
+ self.ModuleBuildDirectoryList = Makefile.GetModuleBuildDirectoryList()
+ self.MakeFileName = Makefile.getMakefileName()
+
+ @property
+ def AllPcdList(self):
+ return self.DynamicPcdList + self.NonDynamicPcdList
+ ## Deal with Shared FixedAtBuild Pcds
+ #
+ def CollectFixedAtBuildPcds(self):
+ for LibAuto in self.LibraryAutoGenList:
+ FixedAtBuildPcds = {}
+ ShareFixedAtBuildPcdsSameValue = {}
+ for Module in LibAuto.ReferenceModules:
+ for Pcd in set(Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds):
+ DefaultValue = Pcd.DefaultValue
+ # Cover the case: DSC component override the Pcd value and the Pcd only used in one Lib
+ if Pcd in Module.LibraryPcdList:
+ Index = Module.LibraryPcdList.index(Pcd)
+ DefaultValue = Module.LibraryPcdList[Index].DefaultValue
+ key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
+ if key not in FixedAtBuildPcds:
+ ShareFixedAtBuildPcdsSameValue[key] = True
+ FixedAtBuildPcds[key] = DefaultValue
+ else:
+ if FixedAtBuildPcds[key] != DefaultValue:
+ ShareFixedAtBuildPcdsSameValue[key] = False
+ for Pcd in LibAuto.FixedAtBuildPcds:
+ key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in self.NonDynamicPcdDict:
+ continue
+ else:
+ DscPcd = self.NonDynamicPcdDict[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)]
+ if DscPcd.Type != TAB_PCDS_FIXED_AT_BUILD:
+ continue
+ if key in ShareFixedAtBuildPcdsSameValue and ShareFixedAtBuildPcdsSameValue[key]:
+ LibAuto.ConstPcd[key] = FixedAtBuildPcds[key]
+
+ def CollectVariables(self, DynamicPcdSet):
+ VpdRegionSize = 0
+ VpdRegionBase = 0
+ if self.Workspace.FdfFile:
+ FdDict = self.Workspace.FdfProfile.FdDict[GlobalData.gFdfParser.CurrentFdName]
+ for FdRegion in FdDict.RegionList:
+ for item in FdRegion.RegionDataList:
+ if self.Platform.VpdToolGuid.strip() and self.Platform.VpdToolGuid in item:
+ VpdRegionSize = FdRegion.Size
+ VpdRegionBase = FdRegion.Offset
+ break
+
+ VariableInfo = VariableMgr(self.DscBuildDataObj._GetDefaultStores(), self.DscBuildDataObj.SkuIds)
+ VariableInfo.SetVpdRegionMaxSize(VpdRegionSize)
+ VariableInfo.SetVpdRegionOffset(VpdRegionBase)
+ Index = 0
+ for Pcd in DynamicPcdSet:
+ pcdname = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
+ for SkuName in Pcd.SkuInfoList:
+ Sku = Pcd.SkuInfoList[SkuName]
+ SkuId = Sku.SkuId
+ if SkuId is None or SkuId == '':
+ continue
+ if len(Sku.VariableName) > 0:
+ if Sku.VariableAttribute and 'NV' not in Sku.VariableAttribute:
+ continue
+ VariableGuidStructure = Sku.VariableGuidValue
+ VariableGuid = GuidStructureStringToGuidString(VariableGuidStructure)
+ for StorageName in Sku.DefaultStoreDict:
+ VariableInfo.append_variable(var_info(Index, pcdname, StorageName, SkuName, StringToArray(Sku.VariableName), VariableGuid, Sku.VariableOffset, Sku.VariableAttribute, Sku.HiiDefaultValue, Sku.DefaultStoreDict[StorageName] if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES else StringToArray(Sku.DefaultStoreDict[StorageName]), Pcd.DatumType, Pcd.CustomAttribute['DscPosition'], Pcd.CustomAttribute.get('IsStru',False)))
+ Index += 1
+ return VariableInfo
+
+ def UpdateNVStoreMaxSize(self, OrgVpdFile):
+ if self.VariableInfo:
+ VpdMapFilePath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY, "%s.map" % self.Platform.VpdToolGuid)
+ PcdNvStoreDfBuffer = [item for item in self._DynamicPcdList if item.TokenCName == "PcdNvStoreDefaultValueBuffer" and item.TokenSpaceGuidCName == "gEfiMdeModulePkgTokenSpaceGuid"]
+
+ if PcdNvStoreDfBuffer:
+ try:
+ OrgVpdFile.Read(VpdMapFilePath)
+ PcdItems = OrgVpdFile.GetOffset(PcdNvStoreDfBuffer[0])
+ NvStoreOffset = list(PcdItems.values())[0].strip() if PcdItems else '0'
+ except:
+ EdkLogger.error("build", FILE_READ_FAILURE, "Can not find VPD map file %s to fix up VPD offset." % VpdMapFilePath)
+
+ NvStoreOffset = int(NvStoreOffset, 16) if NvStoreOffset.upper().startswith("0X") else int(NvStoreOffset)
+ default_skuobj = PcdNvStoreDfBuffer[0].SkuInfoList.get(TAB_DEFAULT)
+ maxsize = self.VariableInfo.VpdRegionSize - NvStoreOffset if self.VariableInfo.VpdRegionSize else len(default_skuobj.DefaultValue.split(","))
+ var_data = self.VariableInfo.PatchNVStoreDefaultMaxSize(maxsize)
+
+ if var_data and default_skuobj:
+ default_skuobj.DefaultValue = var_data
+ PcdNvStoreDfBuffer[0].DefaultValue = var_data
+ PcdNvStoreDfBuffer[0].SkuInfoList.clear()
+ PcdNvStoreDfBuffer[0].SkuInfoList[TAB_DEFAULT] = default_skuobj
+ PcdNvStoreDfBuffer[0].MaxDatumSize = str(len(default_skuobj.DefaultValue.split(",")))
+
+ return OrgVpdFile
+
+ ## Collect dynamic PCDs
+ #
+ # Gather dynamic PCDs list from each module and their settings from platform
+ # This interface should be invoked explicitly when platform action is created.
+ #
+ def CollectPlatformDynamicPcds(self):
+ self.CategoryPcds()
+ self.SortDynamicPcd()
+
+ def CategoryPcds(self):
+ # Category Pcds into DynamicPcds and NonDynamicPcds
+ # for gathering error information
+ NoDatumTypePcdList = set()
+ FdfModuleList = []
+ for InfName in self._AsBuildInfList:
+ InfName = mws.join(self.WorkspaceDir, InfName)
+ FdfModuleList.append(os.path.normpath(InfName))
+ for M in self._MbList:
+# F is the Module for which M is the module autogen
+ ModPcdList = self.ApplyPcdSetting(M, M.ModulePcdList)
+ LibPcdList = []
+ for lib in M.LibraryPcdList:
+ LibPcdList.extend(self.ApplyPcdSetting(M, M.LibraryPcdList[lib], lib))
+ for PcdFromModule in ModPcdList + LibPcdList:
+
+ # make sure that the "VOID*" kind of datum has MaxDatumSize set
+ if PcdFromModule.DatumType == TAB_VOID and not PcdFromModule.MaxDatumSize:
+ NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, M.MetaFile))
+
+ # Check the PCD from Binary INF or Source INF
+ if M.IsBinaryModule == True:
+ PcdFromModule.IsFromBinaryInf = True
+
+ # Check the PCD from DSC or not
+ PcdFromModule.IsFromDsc = (PcdFromModule.TokenCName, PcdFromModule.TokenSpaceGuidCName) in self.Platform.Pcds
+
+ if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET or PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:
+ if M.MetaFile.Path not in FdfModuleList:
+ # If one of the Source built modules listed in the DSC is not listed
+ # in FDF modules, and the INF lists a PCD can only use the PcdsDynamic
+ # access method (it is only listed in the DEC file that declares the
+ # PCD as PcdsDynamic), then build tool will report warning message
+ # notify the PI that they are attempting to build a module that must
+ # be included in a flash image in order to be functional. These Dynamic
+ # PCD will not be added into the Database unless it is used by other
+ # modules that are included in the FDF file.
+ if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET and \
+ PcdFromModule.IsFromBinaryInf == False:
+ # Print warning message to let the developer make a determine.
+ continue
+ # If one of the Source built modules listed in the DSC is not listed in
+ # FDF modules, and the INF lists a PCD can only use the PcdsDynamicEx
+ # access method (it is only listed in the DEC file that declares the
+ # PCD as PcdsDynamicEx), then DO NOT break the build; DO NOT add the
+ # PCD to the Platform's PCD Database.
+ if PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:
+ continue
+ #
+ # If a dynamic PCD used by a PEM module/PEI module & DXE module,
+ # it should be stored in Pcd PEI database, If a dynamic only
+ # used by DXE module, it should be stored in DXE PCD database.
+ # The default Phase is DXE
+ #
+ if M.ModuleType in SUP_MODULE_SET_PEI:
+ PcdFromModule.Phase = "PEI"
+ if PcdFromModule not in self._DynaPcdList_:
+ self._DynaPcdList_.append(PcdFromModule)
+ elif PcdFromModule.Phase == 'PEI':
+ # overwrite any the same PCD existing, if Phase is PEI
+ Index = self._DynaPcdList_.index(PcdFromModule)
+ self._DynaPcdList_[Index] = PcdFromModule
+ elif PcdFromModule not in self._NonDynaPcdList_:
+ self._NonDynaPcdList_.append(PcdFromModule)
+ elif PcdFromModule in self._NonDynaPcdList_ and PcdFromModule.IsFromBinaryInf == True:
+ Index = self._NonDynaPcdList_.index(PcdFromModule)
+ if self._NonDynaPcdList_[Index].IsFromBinaryInf == False:
+ #The PCD from Binary INF will override the same one from source INF
+ self._NonDynaPcdList_.remove (self._NonDynaPcdList_[Index])
+ PcdFromModule.Pending = False
+ self._NonDynaPcdList_.append (PcdFromModule)
+ DscModuleSet = {os.path.normpath(ModuleInf.Path) for ModuleInf in self.Platform.Modules}
+ # add the PCD from modules that listed in FDF but not in DSC to Database
+ for InfName in FdfModuleList:
+ if InfName not in DscModuleSet:
+ InfClass = PathClass(InfName)
+ M = self.BuildDatabase[InfClass, self.Arch, self.BuildTarget, self.ToolChain]
+ # If a module INF in FDF but not in current arch's DSC module list, it must be module (either binary or source)
+ # for different Arch. PCDs in source module for different Arch is already added before, so skip the source module here.
+ # For binary module, if in current arch, we need to list the PCDs into database.
+ if not M.IsBinaryModule:
+ continue
+ # Override the module PCD setting by platform setting
+ ModulePcdList = self.ApplyPcdSetting(M, M.Pcds)
+ for PcdFromModule in ModulePcdList:
+ PcdFromModule.IsFromBinaryInf = True
+ PcdFromModule.IsFromDsc = False
+ # Only allow the DynamicEx and Patchable PCD in AsBuild INF
+ if PcdFromModule.Type not in PCD_DYNAMIC_EX_TYPE_SET and PcdFromModule.Type not in TAB_PCDS_PATCHABLE_IN_MODULE:
+ EdkLogger.error("build", AUTOGEN_ERROR, "PCD setting error",
+ File=self.MetaFile,
+ ExtraData="\n\tExisted %s PCD %s in:\n\t\t%s\n"
+ % (PcdFromModule.Type, PcdFromModule.TokenCName, InfName))
+ # make sure that the "VOID*" kind of datum has MaxDatumSize set
+ if PcdFromModule.DatumType == TAB_VOID and not PcdFromModule.MaxDatumSize:
+ NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName))
+ if M.ModuleType in SUP_MODULE_SET_PEI:
+ PcdFromModule.Phase = "PEI"
+ if PcdFromModule not in self._DynaPcdList_ and PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:
+ self._DynaPcdList_.append(PcdFromModule)
+ elif PcdFromModule not in self._NonDynaPcdList_ and PcdFromModule.Type in TAB_PCDS_PATCHABLE_IN_MODULE:
+ self._NonDynaPcdList_.append(PcdFromModule)
+ if PcdFromModule in self._DynaPcdList_ and PcdFromModule.Phase == 'PEI' and PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:
+ # Overwrite the phase of any the same PCD existing, if Phase is PEI.
+ # It is to solve the case that a dynamic PCD used by a PEM module/PEI
+ # module & DXE module at a same time.
+ # Overwrite the type of the PCDs in source INF by the type of AsBuild
+ # INF file as DynamicEx.
+ Index = self._DynaPcdList_.index(PcdFromModule)
+ self._DynaPcdList_[Index].Phase = PcdFromModule.Phase
+ self._DynaPcdList_[Index].Type = PcdFromModule.Type
+ for PcdFromModule in self._NonDynaPcdList_:
+ # If a PCD is not listed in the DSC file, but binary INF files used by
+ # this platform all (that use this PCD) list the PCD in a [PatchPcds]
+ # section, AND all source INF files used by this platform the build
+ # that use the PCD list the PCD in either a [Pcds] or [PatchPcds]
+ # section, then the tools must NOT add the PCD to the Platform's PCD
+ # Database; the build must assign the access method for this PCD as
+ # PcdsPatchableInModule.
+ if PcdFromModule not in self._DynaPcdList_:
+ continue
+ Index = self._DynaPcdList_.index(PcdFromModule)
+ if PcdFromModule.IsFromDsc == False and \
+ PcdFromModule.Type in TAB_PCDS_PATCHABLE_IN_MODULE and \
+ PcdFromModule.IsFromBinaryInf == True and \
+ self._DynaPcdList_[Index].IsFromBinaryInf == False:
+ Index = self._DynaPcdList_.index(PcdFromModule)
+ self._DynaPcdList_.remove (self._DynaPcdList_[Index])
+
+ # print out error information and break the build, if error found
+ if len(NoDatumTypePcdList) > 0:
+ NoDatumTypePcdListString = "\n\t\t".join(NoDatumTypePcdList)
+ EdkLogger.error("build", AUTOGEN_ERROR, "PCD setting error",
+ File=self.MetaFile,
+ ExtraData="\n\tPCD(s) without MaxDatumSize:\n\t\t%s\n"
+ % NoDatumTypePcdListString)
+ self._NonDynamicPcdList = sorted(self._NonDynaPcdList_)
+ self._DynamicPcdList = self._DynaPcdList_
+
+ def SortDynamicPcd(self):
+ #
+ # Sort dynamic PCD list to:
+ # 1) If PCD's datum type is VOID* and value is unicode string which starts with L, the PCD item should
+ # try to be put header of dynamicd List
+ # 2) If PCD is HII type, the PCD item should be put after unicode type PCD
+ #
+ # The reason of sorting is make sure the unicode string is in double-byte alignment in string table.
+ #
+ UnicodePcdArray = set()
+ HiiPcdArray = set()
+ OtherPcdArray = set()
+ VpdPcdDict = {}
+ VpdFile = VpdInfoFile.VpdInfoFile()
+ NeedProcessVpdMapFile = False
+
+ for pcd in self.Platform.Pcds:
+ if pcd not in self._PlatformPcds:
+ self._PlatformPcds[pcd] = self.Platform.Pcds[pcd]
+
+ for item in self._PlatformPcds:
+ if self._PlatformPcds[item].DatumType and self._PlatformPcds[item].DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
+ self._PlatformPcds[item].DatumType = TAB_VOID
+
+ if (self.Workspace.ArchList[-1] == self.Arch):
+ for Pcd in self._DynamicPcdList:
+ # just pick the a value to determine whether is unicode string type
+ Sku = Pcd.SkuInfoList.get(TAB_DEFAULT)
+ Sku.VpdOffset = Sku.VpdOffset.strip()
+
+ if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
+ Pcd.DatumType = TAB_VOID
+
+ # if found PCD which datum value is unicode string the insert to left size of UnicodeIndex
+ # if found HII type PCD then insert to right of UnicodeIndex
+ if Pcd.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:
+ VpdPcdDict[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)] = Pcd
+
+ #Collect DynamicHii PCD values and assign it to DynamicExVpd PCD gEfiMdeModulePkgTokenSpaceGuid.PcdNvStoreDefaultValueBuffer
+ PcdNvStoreDfBuffer = VpdPcdDict.get(("PcdNvStoreDefaultValueBuffer", "gEfiMdeModulePkgTokenSpaceGuid"))
+ if PcdNvStoreDfBuffer:
+ self.VariableInfo = self.CollectVariables(self._DynamicPcdList)
+ vardump = self.VariableInfo.dump()
+ if vardump:
+ #
+ #According to PCD_DATABASE_INIT in edk2\MdeModulePkg\Include\Guid\PcdDataBaseSignatureGuid.h,
+ #the max size for string PCD should not exceed USHRT_MAX 65535(0xffff).
+ #typedef UINT16 SIZE_INFO;
+ #//SIZE_INFO SizeTable[];
+ if len(vardump.split(",")) > 0xffff:
+ EdkLogger.error("build", RESOURCE_OVERFLOW, 'The current length of PCD %s value is %d, it exceeds to the max size of String PCD.' %(".".join([PcdNvStoreDfBuffer.TokenSpaceGuidCName,PcdNvStoreDfBuffer.TokenCName]) ,len(vardump.split(","))))
+ PcdNvStoreDfBuffer.DefaultValue = vardump
+ for skuname in PcdNvStoreDfBuffer.SkuInfoList:
+ PcdNvStoreDfBuffer.SkuInfoList[skuname].DefaultValue = vardump
+ PcdNvStoreDfBuffer.MaxDatumSize = str(len(vardump.split(",")))
+ else:
+ #If the end user define [DefaultStores] and [XXX.Menufacturing] in DSC, but forget to configure PcdNvStoreDefaultValueBuffer to PcdsDynamicVpd
+ if [Pcd for Pcd in self._DynamicPcdList if Pcd.UserDefinedDefaultStoresFlag]:
+ EdkLogger.warn("build", "PcdNvStoreDefaultValueBuffer should be defined as PcdsDynamicExVpd in dsc file since the DefaultStores is enabled for this platform.\n%s" %self.Platform.MetaFile.Path)
+ PlatformPcds = sorted(self._PlatformPcds.keys())
+ #
+ # Add VPD type PCD into VpdFile and determine whether the VPD PCD need to be fixed up.
+ #
+ VpdSkuMap = {}
+ for PcdKey in PlatformPcds:
+ Pcd = self._PlatformPcds[PcdKey]
+ if Pcd.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD] and \
+ PcdKey in VpdPcdDict:
+ Pcd = VpdPcdDict[PcdKey]
+ SkuValueMap = {}
+ DefaultSku = Pcd.SkuInfoList.get(TAB_DEFAULT)
+ if DefaultSku:
+ PcdValue = DefaultSku.DefaultValue
+ if PcdValue not in SkuValueMap:
+ SkuValueMap[PcdValue] = []
+ VpdFile.Add(Pcd, TAB_DEFAULT, DefaultSku.VpdOffset)
+ SkuValueMap[PcdValue].append(DefaultSku)
+
+ for (SkuName, Sku) in Pcd.SkuInfoList.items():
+ Sku.VpdOffset = Sku.VpdOffset.strip()
+ PcdValue = Sku.DefaultValue
+ if PcdValue == "":
+ PcdValue = Pcd.DefaultValue
+ if Sku.VpdOffset != TAB_STAR:
+ if PcdValue.startswith("{"):
+ Alignment = 8
+ elif PcdValue.startswith("L"):
+ Alignment = 2
+ else:
+ Alignment = 1
+ try:
+ VpdOffset = int(Sku.VpdOffset)
+ except:
+ try:
+ VpdOffset = int(Sku.VpdOffset, 16)
+ except:
+ EdkLogger.error("build", FORMAT_INVALID, "Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
+ if VpdOffset % Alignment != 0:
+ if PcdValue.startswith("{"):
+ EdkLogger.warn("build", "The offset value of PCD %s.%s is not 8-byte aligned!" %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName), File=self.MetaFile)
+ else:
+ EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Alignment))
+ if PcdValue not in SkuValueMap:
+ SkuValueMap[PcdValue] = []
+ VpdFile.Add(Pcd, SkuName, Sku.VpdOffset)
+ SkuValueMap[PcdValue].append(Sku)
+ # if the offset of a VPD is *, then it need to be fixed up by third party tool.
+ if not NeedProcessVpdMapFile and Sku.VpdOffset == TAB_STAR:
+ NeedProcessVpdMapFile = True
+ if self.Platform.VpdToolGuid is None or self.Platform.VpdToolGuid == '':
+ EdkLogger.error("Build", FILE_NOT_FOUND, \
+ "Fail to find third-party BPDG tool to process VPD PCDs. BPDG Guid tool need to be defined in tools_def.txt and VPD_TOOL_GUID need to be provided in DSC file.")
+
+ VpdSkuMap[PcdKey] = SkuValueMap
+ #
+ # Fix the PCDs define in VPD PCD section that never referenced by module.
+ # An example is PCD for signature usage.
+ #
+ for DscPcd in PlatformPcds:
+ DscPcdEntry = self._PlatformPcds[DscPcd]
+ if DscPcdEntry.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:
+ if not (self.Platform.VpdToolGuid is None or self.Platform.VpdToolGuid == ''):
+ FoundFlag = False
+ for VpdPcd in VpdFile._VpdArray:
+ # This PCD has been referenced by module
+ if (VpdPcd.TokenSpaceGuidCName == DscPcdEntry.TokenSpaceGuidCName) and \
+ (VpdPcd.TokenCName == DscPcdEntry.TokenCName):
+ FoundFlag = True
+
+ # Not found, it should be signature
+ if not FoundFlag :
+ # just pick the a value to determine whether is unicode string type
+ SkuValueMap = {}
+ SkuObjList = list(DscPcdEntry.SkuInfoList.items())
+ DefaultSku = DscPcdEntry.SkuInfoList.get(TAB_DEFAULT)
+ if DefaultSku:
+ defaultindex = SkuObjList.index((TAB_DEFAULT, DefaultSku))
+ SkuObjList[0], SkuObjList[defaultindex] = SkuObjList[defaultindex], SkuObjList[0]
+ for (SkuName, Sku) in SkuObjList:
+ Sku.VpdOffset = Sku.VpdOffset.strip()
+
+ # Need to iterate DEC pcd information to get the value & datumtype
+ for eachDec in self.PackageList:
+ for DecPcd in eachDec.Pcds:
+ DecPcdEntry = eachDec.Pcds[DecPcd]
+ if (DecPcdEntry.TokenSpaceGuidCName == DscPcdEntry.TokenSpaceGuidCName) and \
+ (DecPcdEntry.TokenCName == DscPcdEntry.TokenCName):
+ # Print warning message to let the developer make a determine.
+ EdkLogger.warn("build", "Unreferenced vpd pcd used!",
+ File=self.MetaFile, \
+ ExtraData = "PCD: %s.%s used in the DSC file %s is unreferenced." \
+ %(DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, self.Platform.MetaFile.Path))
+
+ DscPcdEntry.DatumType = DecPcdEntry.DatumType
+ DscPcdEntry.DefaultValue = DecPcdEntry.DefaultValue
+ DscPcdEntry.TokenValue = DecPcdEntry.TokenValue
+ DscPcdEntry.TokenSpaceGuidValue = eachDec.Guids[DecPcdEntry.TokenSpaceGuidCName]
+ # Only fix the value while no value provided in DSC file.
+ if not Sku.DefaultValue:
+ DscPcdEntry.SkuInfoList[list(DscPcdEntry.SkuInfoList.keys())[0]].DefaultValue = DecPcdEntry.DefaultValue
+
+ if DscPcdEntry not in self._DynamicPcdList:
+ self._DynamicPcdList.append(DscPcdEntry)
+ Sku.VpdOffset = Sku.VpdOffset.strip()
+ PcdValue = Sku.DefaultValue
+ if PcdValue == "":
+ PcdValue = DscPcdEntry.DefaultValue
+ if Sku.VpdOffset != TAB_STAR:
+ if PcdValue.startswith("{"):
+ Alignment = 8
+ elif PcdValue.startswith("L"):
+ Alignment = 2
+ else:
+ Alignment = 1
+ try:
+ VpdOffset = int(Sku.VpdOffset)
+ except:
+ try:
+ VpdOffset = int(Sku.VpdOffset, 16)
+ except:
+ EdkLogger.error("build", FORMAT_INVALID, "Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName))
+ if VpdOffset % Alignment != 0:
+ if PcdValue.startswith("{"):
+ EdkLogger.warn("build", "The offset value of PCD %s.%s is not 8-byte aligned!" %(DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName), File=self.MetaFile)
+ else:
+ EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, Alignment))
+ if PcdValue not in SkuValueMap:
+ SkuValueMap[PcdValue] = []
+ VpdFile.Add(DscPcdEntry, SkuName, Sku.VpdOffset)
+ SkuValueMap[PcdValue].append(Sku)
+ if not NeedProcessVpdMapFile and Sku.VpdOffset == TAB_STAR:
+ NeedProcessVpdMapFile = True
+ if DscPcdEntry.DatumType == TAB_VOID and PcdValue.startswith("L"):
+ UnicodePcdArray.add(DscPcdEntry)
+ elif len(Sku.VariableName) > 0:
+ HiiPcdArray.add(DscPcdEntry)
+ else:
+ OtherPcdArray.add(DscPcdEntry)
+
+ # if the offset of a VPD is *, then it need to be fixed up by third party tool.
+ VpdSkuMap[DscPcd] = SkuValueMap
+ if (self.Platform.FlashDefinition is None or self.Platform.FlashDefinition == '') and \
+ VpdFile.GetCount() != 0:
+ EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
+ "Fail to get FLASH_DEFINITION definition in DSC file %s which is required when DSC contains VPD PCD." % str(self.Platform.MetaFile))
+
+ if VpdFile.GetCount() != 0:
+
+ self.FixVpdOffset(VpdFile)
+
+ self.FixVpdOffset(self.UpdateNVStoreMaxSize(VpdFile))
+ PcdNvStoreDfBuffer = [item for item in self._DynamicPcdList if item.TokenCName == "PcdNvStoreDefaultValueBuffer" and item.TokenSpaceGuidCName == "gEfiMdeModulePkgTokenSpaceGuid"]
+ if PcdNvStoreDfBuffer:
+ PcdName,PcdGuid = PcdNvStoreDfBuffer[0].TokenCName, PcdNvStoreDfBuffer[0].TokenSpaceGuidCName
+ if (PcdName,PcdGuid) in VpdSkuMap:
+ DefaultSku = PcdNvStoreDfBuffer[0].SkuInfoList.get(TAB_DEFAULT)
+ VpdSkuMap[(PcdName,PcdGuid)] = {DefaultSku.DefaultValue:[SkuObj for SkuObj in PcdNvStoreDfBuffer[0].SkuInfoList.values() ]}
+
+ # Process VPD map file generated by third party BPDG tool
+ if NeedProcessVpdMapFile:
+ VpdMapFilePath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY, "%s.map" % self.Platform.VpdToolGuid)
+ try:
+ VpdFile.Read(VpdMapFilePath)
+
+ # Fixup TAB_STAR offset
+ for pcd in VpdSkuMap:
+ vpdinfo = VpdFile.GetVpdInfo(pcd)
+ if vpdinfo is None:
+ # just pick the a value to determine whether is unicode string type
+ continue
+ for pcdvalue in VpdSkuMap[pcd]:
+ for sku in VpdSkuMap[pcd][pcdvalue]:
+ for item in vpdinfo:
+ if item[2] == pcdvalue:
+ sku.VpdOffset = item[1]
+ except:
+ EdkLogger.error("build", FILE_READ_FAILURE, "Can not find VPD map file %s to fix up VPD offset." % VpdMapFilePath)
+
+ # Delete the DynamicPcdList At the last time enter into this function
+ for Pcd in self._DynamicPcdList:
+ # just pick the a value to determine whether is unicode string type
+ Sku = Pcd.SkuInfoList.get(TAB_DEFAULT)
+ Sku.VpdOffset = Sku.VpdOffset.strip()
+
+ if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
+ Pcd.DatumType = TAB_VOID
+
+ PcdValue = Sku.DefaultValue
+ if Pcd.DatumType == TAB_VOID and PcdValue.startswith("L"):
+ # if found PCD which datum value is unicode string the insert to left size of UnicodeIndex
+ UnicodePcdArray.add(Pcd)
+ elif len(Sku.VariableName) > 0:
+ # if found HII type PCD then insert to right of UnicodeIndex
+ HiiPcdArray.add(Pcd)
+ else:
+ OtherPcdArray.add(Pcd)
+ del self._DynamicPcdList[:]
+ self._DynamicPcdList.extend(list(UnicodePcdArray))
+ self._DynamicPcdList.extend(list(HiiPcdArray))
+ self._DynamicPcdList.extend(list(OtherPcdArray))
+ self._DynamicPcdList.sort()
+ allskuset = [(SkuName, Sku.SkuId) for pcd in self._DynamicPcdList for (SkuName, Sku) in pcd.SkuInfoList.items()]
+ for pcd in self._DynamicPcdList:
+ if len(pcd.SkuInfoList) == 1:
+ for (SkuName, SkuId) in allskuset:
+ if isinstance(SkuId, str) and eval(SkuId) == 0 or SkuId == 0:
+ continue
+ pcd.SkuInfoList[SkuName] = copy.deepcopy(pcd.SkuInfoList[TAB_DEFAULT])
+ pcd.SkuInfoList[SkuName].SkuId = SkuId
+ pcd.SkuInfoList[SkuName].SkuIdName = SkuName
+
+ def FixVpdOffset(self, VpdFile ):
+ FvPath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY)
+ if not os.path.exists(FvPath):
+ try:
+ os.makedirs(FvPath)
+ except:
+ EdkLogger.error("build", FILE_WRITE_FAILURE, "Fail to create FV folder under %s" % self.BuildDir)
+
+ VpdFilePath = os.path.join(FvPath, "%s.txt" % self.Platform.VpdToolGuid)
+
+ if VpdFile.Write(VpdFilePath):
+ # retrieve BPDG tool's path from tool_def.txt according to VPD_TOOL_GUID defined in DSC file.
+ BPDGToolName = None
+ for ToolDef in self.ToolDefinition.values():
+ if TAB_GUID in ToolDef and ToolDef[TAB_GUID] == self.Platform.VpdToolGuid:
+ if "PATH" not in ToolDef:
+ EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "PATH attribute was not provided for BPDG guid tool %s in tools_def.txt" % self.Platform.VpdToolGuid)
+ BPDGToolName = ToolDef["PATH"]
+ break
+ # Call third party GUID BPDG tool.
+ if BPDGToolName is not None:
+ VpdInfoFile.CallExtenalBPDGTool(BPDGToolName, VpdFilePath)
+ else:
+ EdkLogger.error("Build", FILE_NOT_FOUND, "Fail to find third-party BPDG tool to process VPD PCDs. BPDG Guid tool need to be defined in tools_def.txt and VPD_TOOL_GUID need to be provided in DSC file.")
+
+ ## Return the platform build data object
+ @cached_property
+ def Platform(self):
+ return self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]
+
+ ## Return platform name
+ @cached_property
+ def Name(self):
+ return self.Platform.PlatformName
+
+ ## Return the meta file GUID
+ @cached_property
+ def Guid(self):
+ return self.Platform.Guid
+
+ ## Return the platform version
+ @cached_property
+ def Version(self):
+ return self.Platform.Version
+
+ ## Return the FDF file name
+ @cached_property
+ def FdfFile(self):
+ if self.Workspace.FdfFile:
+ RetVal= mws.join(self.WorkspaceDir, self.Workspace.FdfFile)
+ else:
+ RetVal = ''
+ return RetVal
+
+ ## Return the build output directory platform specifies
+ @cached_property
+ def OutputDir(self):
+ return self.Platform.OutputDirectory
+
+ ## Return the directory to store all intermediate and final files built
+ @cached_property
+ def BuildDir(self):
+ if os.path.isabs(self.OutputDir):
+ GlobalData.gBuildDirectory = RetVal = path.join(
+ path.abspath(self.OutputDir),
+ self.BuildTarget + "_" + self.ToolChain,
+ )
+ else:
+ GlobalData.gBuildDirectory = RetVal = path.join(
+ self.WorkspaceDir,
+ self.OutputDir,
+ self.BuildTarget + "_" + self.ToolChain,
+ )
+ return RetVal
+
+ ## Return directory of platform makefile
+ #
+ # @retval string Makefile directory
+ #
+ @cached_property
+ def MakeFileDir(self):
+ return path.join(self.BuildDir, self.Arch)
+
+ ## Return build command string
+ #
+ # @retval string Build command string
+ #
+ @cached_property
+ def BuildCommand(self):
+ RetVal = []
+ if "MAKE" in self.ToolDefinition and "PATH" in self.ToolDefinition["MAKE"]:
+ RetVal += _SplitOption(self.ToolDefinition["MAKE"]["PATH"])
+ if "FLAGS" in self.ToolDefinition["MAKE"]:
+ NewOption = self.ToolDefinition["MAKE"]["FLAGS"].strip()
+ if NewOption != '':
+ RetVal += _SplitOption(NewOption)
+ if "MAKE" in self.EdkIIBuildOption:
+ if "FLAGS" in self.EdkIIBuildOption["MAKE"]:
+ Flags = self.EdkIIBuildOption["MAKE"]["FLAGS"]
+ if Flags.startswith('='):
+ RetVal = [RetVal[0]] + [Flags[1:]]
+ else:
+ RetVal.append(Flags)
+ return RetVal
+
+ ## Get tool chain definition
+ #
+ # Get each tool definition for given tool chain from tools_def.txt and platform
+ #
+ @cached_property
+ def ToolDefinition(self):
+ ToolDefinition = self.Workspace.ToolDef.ToolsDefTxtDictionary
+ if TAB_TOD_DEFINES_COMMAND_TYPE not in self.Workspace.ToolDef.ToolsDefTxtDatabase:
+ EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No tools found in configuration",
+ ExtraData="[%s]" % self.MetaFile)
+ RetVal = OrderedDict()
+ DllPathList = set()
+ for Def in ToolDefinition:
+ Target, Tag, Arch, Tool, Attr = Def.split("_")
+ if Target != self.BuildTarget or Tag != self.ToolChain or Arch != self.Arch:
+ continue
+
+ Value = ToolDefinition[Def]
+ # don't record the DLL
+ if Attr == "DLL":
+ DllPathList.add(Value)
+ continue
+
+ if Tool not in RetVal:
+ RetVal[Tool] = OrderedDict()
+ RetVal[Tool][Attr] = Value
+
+ ToolsDef = ''
+ if GlobalData.gOptions.SilentMode and "MAKE" in RetVal:
+ if "FLAGS" not in RetVal["MAKE"]:
+ RetVal["MAKE"]["FLAGS"] = ""
+ RetVal["MAKE"]["FLAGS"] += " -s"
+ MakeFlags = ''
+ for Tool in RetVal:
+ for Attr in RetVal[Tool]:
+ Value = RetVal[Tool][Attr]
+ if Tool in self._BuildOptionWithToolDef(RetVal) and Attr in self._BuildOptionWithToolDef(RetVal)[Tool]:
+ # check if override is indicated
+ if self._BuildOptionWithToolDef(RetVal)[Tool][Attr].startswith('='):
+ Value = self._BuildOptionWithToolDef(RetVal)[Tool][Attr][1:]
+ else:
+ if Attr != 'PATH':
+ Value += " " + self._BuildOptionWithToolDef(RetVal)[Tool][Attr]
+ else:
+ Value = self._BuildOptionWithToolDef(RetVal)[Tool][Attr]
+ Def = '_'.join([self.BuildTarget, self.ToolChain, self.Arch, Tool, Attr])
+ self.Workspace.ToolDef.ToolsDefTxtDictionary[Def] = Value
+ if Attr == "PATH":
+ # Don't put MAKE definition in the file
+ if Tool != "MAKE":
+ ToolsDef += "%s = %s\n" % (Tool, Value)
+ elif Attr != "DLL":
+ # Don't put MAKE definition in the file
+ if Tool == "MAKE":
+ if Attr == "FLAGS":
+ MakeFlags = Value
+ else:
+ ToolsDef += "%s_%s = %s\n" % (Tool, Attr, Value)
+ ToolsDef += "\n"
+
+ tool_def_file = os.path.join(self.MakeFileDir, "TOOLS_DEF." + self.Arch)
+ SaveFileOnChange(tool_def_file, ToolsDef, False)
+ for DllPath in DllPathList:
+ os.environ["PATH"] = DllPath + os.pathsep + os.environ["PATH"]
+ os.environ["MAKE_FLAGS"] = MakeFlags
+
+ return RetVal
+
+ ## Return the paths of tools
+ @cached_property
+ def ToolDefinitionFile(self):
+ tool_def_file = os.path.join(self.MakeFileDir, "TOOLS_DEF." + self.Arch)
+ if not os.path.exists(tool_def_file):
+ self.ToolDefinition
+ return tool_def_file
+
+ ## Retrieve the toolchain family of given toolchain tag. Default to 'MSFT'.
+ @cached_property
+ def ToolChainFamily(self):
+ ToolDefinition = self.Workspace.ToolDef.ToolsDefTxtDatabase
+ if TAB_TOD_DEFINES_FAMILY not in ToolDefinition \
+ or self.ToolChain not in ToolDefinition[TAB_TOD_DEFINES_FAMILY] \
+ or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][self.ToolChain]:
+ EdkLogger.verbose("No tool chain family found in configuration for %s. Default to MSFT." \
+ % self.ToolChain)
+ RetVal = TAB_COMPILER_MSFT
+ else:
+ RetVal = ToolDefinition[TAB_TOD_DEFINES_FAMILY][self.ToolChain]
+ return RetVal
+
+ @cached_property
+ def BuildRuleFamily(self):
+ ToolDefinition = self.Workspace.ToolDef.ToolsDefTxtDatabase
+ if TAB_TOD_DEFINES_BUILDRULEFAMILY not in ToolDefinition \
+ or self.ToolChain not in ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY] \
+ or not ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain]:
+ EdkLogger.verbose("No tool chain family found in configuration for %s. Default to MSFT." \
+ % self.ToolChain)
+ return TAB_COMPILER_MSFT
+
+ return ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain]
+
+ ## Return the build options specific for all modules in this platform
+ @cached_property
+ def BuildOption(self):
+ return self._ExpandBuildOption(self.Platform.BuildOptions)
+
+ def _BuildOptionWithToolDef(self, ToolDef):
+ return self._ExpandBuildOption(self.Platform.BuildOptions, ToolDef=ToolDef)
+
+ ## Return the build options specific for EDK modules in this platform
+ @cached_property
+ def EdkBuildOption(self):
+ return self._ExpandBuildOption(self.Platform.BuildOptions, EDK_NAME)
+
+ ## Return the build options specific for EDKII modules in this platform
+ @cached_property
+ def EdkIIBuildOption(self):
+ return self._ExpandBuildOption(self.Platform.BuildOptions, EDKII_NAME)
+
+ ## Parse build_rule.txt in Conf Directory.
+ #
+ # @retval BuildRule object
+ #
+ @cached_property
+ def BuildRule(self):
+ BuildRuleFile = None
+ if TAB_TAT_DEFINES_BUILD_RULE_CONF in self.Workspace.TargetTxt.TargetTxtDictionary:
+ BuildRuleFile = self.Workspace.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_BUILD_RULE_CONF]
+ if not BuildRuleFile:
+ BuildRuleFile = gDefaultBuildRuleFile
+ RetVal = BuildRule(BuildRuleFile)
+ if RetVal._FileVersion == "":
+ RetVal._FileVersion = AutoGenReqBuildRuleVerNum
+ else:
+ if RetVal._FileVersion < AutoGenReqBuildRuleVerNum :
+ # If Build Rule's version is less than the version number required by the tools, halting the build.
+ EdkLogger.error("build", AUTOGEN_ERROR,
+ ExtraData="The version number [%s] of build_rule.txt is less than the version number required by the AutoGen.(the minimum required version number is [%s])"\
+ % (RetVal._FileVersion, AutoGenReqBuildRuleVerNum))
+ return RetVal
+
+ ## Summarize the packages used by modules in this platform
+ @cached_property
+ def PackageList(self):
+ RetVal = set()
+ for Mb in self._MbList:
+ RetVal.update(Mb.Packages)
+ for lb in Mb.LibInstances:
+ RetVal.update(lb.Packages)
+ #Collect package set information from INF of FDF
+ for ModuleFile in self._AsBuildModuleList:
+ if ModuleFile in self.Platform.Modules:
+ continue
+ ModuleData = self.BuildDatabase[ModuleFile, self.Arch, self.BuildTarget, self.ToolChain]
+ RetVal.update(ModuleData.Packages)
+ RetVal.update(self.Platform.Packages)
+ return list(RetVal)
+
+ @cached_property
+ def NonDynamicPcdDict(self):
+ return {(Pcd.TokenCName, Pcd.TokenSpaceGuidCName):Pcd for Pcd in self.NonDynamicPcdList}
+
+ ## Get list of non-dynamic PCDs
+ @property
+ def NonDynamicPcdList(self):
+ if not self._NonDynamicPcdList:
+ self.CollectPlatformDynamicPcds()
+ return self._NonDynamicPcdList
+
+ ## Get list of dynamic PCDs
+ @property
+ def DynamicPcdList(self):
+ if not self._DynamicPcdList:
+ self.CollectPlatformDynamicPcds()
+ return self._DynamicPcdList
+
+ ## Generate Token Number for all PCD
+ @cached_property
+ def PcdTokenNumber(self):
+ RetVal = OrderedDict()
+ TokenNumber = 1
+ #
+ # Make the Dynamic and DynamicEx PCD use within different TokenNumber area.
+ # Such as:
+ #
+ # Dynamic PCD:
+ # TokenNumber 0 ~ 10
+ # DynamicEx PCD:
+ # TokeNumber 11 ~ 20
+ #
+ for Pcd in self.DynamicPcdList:
+ if Pcd.Phase == "PEI" and Pcd.Type in PCD_DYNAMIC_TYPE_SET:
+ EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber))
+ RetVal[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber
+ TokenNumber += 1
+
+ for Pcd in self.DynamicPcdList:
+ if Pcd.Phase == "PEI" and Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
+ EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber))
+ RetVal[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber
+ TokenNumber += 1
+
+ for Pcd in self.DynamicPcdList:
+ if Pcd.Phase == "DXE" and Pcd.Type in PCD_DYNAMIC_TYPE_SET:
+ EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber))
+ RetVal[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber
+ TokenNumber += 1
+
+ for Pcd in self.DynamicPcdList:
+ if Pcd.Phase == "DXE" and Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
+ EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber))
+ RetVal[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber
+ TokenNumber += 1
+
+ for Pcd in self.NonDynamicPcdList:
+ RetVal[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber
+ TokenNumber += 1
+ return RetVal
+
+ @cached_property
+ def _MbList(self):
+ return [self.BuildDatabase[m, self.Arch, self.BuildTarget, self.ToolChain] for m in self.Platform.Modules]
+
+ @cached_property
+ def _MaList(self):
+ for ModuleFile in self.Platform.Modules:
+ Ma = ModuleAutoGen(
+ self.Workspace,
+ ModuleFile,
+ self.BuildTarget,
+ self.ToolChain,
+ self.Arch,
+ self.MetaFile,
+ self.DataPipe
+ )
+ self.Platform.Modules[ModuleFile].M = Ma
+ return [x.M for x in self.Platform.Modules.values()]
+
+ ## Summarize ModuleAutoGen objects of all modules to be built for this platform
+ @cached_property
+ def ModuleAutoGenList(self):
+ RetVal = []
+ for Ma in self._MaList:
+ if Ma not in RetVal:
+ RetVal.append(Ma)
+ return RetVal
+
+ ## Summarize ModuleAutoGen objects of all libraries to be built for this platform
+ @cached_property
+ def LibraryAutoGenList(self):
+ RetVal = []
+ for Ma in self._MaList:
+ for La in Ma.LibraryAutoGenList:
+ if La not in RetVal:
+ RetVal.append(La)
+ if Ma not in La.ReferenceModules:
+ La.ReferenceModules.append(Ma)
+ return RetVal
+
+ ## Test if a module is supported by the platform
+ #
+ # An error will be raised directly if the module or its arch is not supported
+ # by the platform or current configuration
+ #
+ def ValidModule(self, Module):
+ return Module in self.Platform.Modules or Module in self.Platform.LibraryInstances \
+ or Module in self._AsBuildModuleList
+ @cached_property
+ def GetAllModuleInfo(self,WithoutPcd=True):
+ ModuleLibs = set()
+ for m in self.Platform.Modules:
+ module_obj = self.BuildDatabase[m,self.Arch,self.BuildTarget,self.ToolChain]
+ if not bool(module_obj.LibraryClass):
+ Libs = GetModuleLibInstances(module_obj, self.Platform, self.BuildDatabase, self.Arch,self.BuildTarget,self.ToolChain,self.MetaFile,EdkLogger)
+ else:
+ Libs = []
+ ModuleLibs.update( set([(l.MetaFile.File,l.MetaFile.Root,l.MetaFile.Path,l.MetaFile.BaseName,l.MetaFile.OriginalPath,l.Arch,True) for l in Libs]))
+ if WithoutPcd and module_obj.PcdIsDriver:
+ continue
+ ModuleLibs.add((m.File,m.Root,m.Path,m.BaseName,m.OriginalPath,module_obj.Arch,bool(module_obj.LibraryClass)))
+
+ return ModuleLibs
+
+ ## Resolve the library classes in a module to library instances
+ #
+ # This method will not only resolve library classes but also sort the library
+ # instances according to the dependency-ship.
+ #
+ # @param Module The module from which the library classes will be resolved
+ #
+ # @retval library_list List of library instances sorted
+ #
+ def ApplyLibraryInstance(self, Module):
+ # Cover the case that the binary INF file is list in the FDF file but not DSC file, return empty list directly
+ if str(Module) not in self.Platform.Modules:
+ return []
+
+ return GetModuleLibInstances(Module,
+ self.Platform,
+ self.BuildDatabase,
+ self.Arch,
+ self.BuildTarget,
+ self.ToolChain,
+ self.MetaFile,
+ EdkLogger)
+
+ ## Override PCD setting (type, value, ...)
+ #
+ # @param ToPcd The PCD to be overridden
+ # @param FromPcd The PCD overriding from
+ #
+ def _OverridePcd(self, ToPcd, FromPcd, Module="", Msg="", Library=""):
+ #
+ # in case there's PCDs coming from FDF file, which have no type given.
+ # at this point, ToPcd.Type has the type found from dependent
+ # package
+ #
+ TokenCName = ToPcd.TokenCName
+ for PcdItem in GlobalData.MixedPcd:
+ if (ToPcd.TokenCName, ToPcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ TokenCName = PcdItem[0]
+ break
+ if FromPcd is not None:
+ if ToPcd.Pending and FromPcd.Type:
+ ToPcd.Type = FromPcd.Type
+ elif ToPcd.Type and FromPcd.Type\
+ and ToPcd.Type != FromPcd.Type and ToPcd.Type in FromPcd.Type:
+ if ToPcd.Type.strip() == TAB_PCDS_DYNAMIC_EX:
+ ToPcd.Type = FromPcd.Type
+ elif ToPcd.Type and FromPcd.Type \
+ and ToPcd.Type != FromPcd.Type:
+ if Library:
+ Module = str(Module) + " 's library file (" + str(Library) + ")"
+ EdkLogger.error("build", OPTION_CONFLICT, "Mismatched PCD type",
+ ExtraData="%s.%s is used as [%s] in module %s, but as [%s] in %s."\
+ % (ToPcd.TokenSpaceGuidCName, TokenCName,
+ ToPcd.Type, Module, FromPcd.Type, Msg),
+ File=self.MetaFile)
+
+ if FromPcd.MaxDatumSize:
+ ToPcd.MaxDatumSize = FromPcd.MaxDatumSize
+ ToPcd.MaxSizeUserSet = FromPcd.MaxDatumSize
+ if FromPcd.DefaultValue:
+ ToPcd.DefaultValue = FromPcd.DefaultValue
+ if FromPcd.TokenValue:
+ ToPcd.TokenValue = FromPcd.TokenValue
+ if FromPcd.DatumType:
+ ToPcd.DatumType = FromPcd.DatumType
+ if FromPcd.SkuInfoList:
+ ToPcd.SkuInfoList = FromPcd.SkuInfoList
+ if FromPcd.UserDefinedDefaultStoresFlag:
+ ToPcd.UserDefinedDefaultStoresFlag = FromPcd.UserDefinedDefaultStoresFlag
+ # Add Flexible PCD format parse
+ if ToPcd.DefaultValue:
+ try:
+ ToPcd.DefaultValue = ValueExpressionEx(ToPcd.DefaultValue, ToPcd.DatumType, self.Platform._GuidDict)(True)
+ except BadExpression as Value:
+ EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %(ToPcd.TokenSpaceGuidCName, ToPcd.TokenCName, ToPcd.DefaultValue, Value),
+ File=self.MetaFile)
+
+ # check the validation of datum
+ IsValid, Cause = CheckPcdDatum(ToPcd.DatumType, ToPcd.DefaultValue)
+ if not IsValid:
+ EdkLogger.error('build', FORMAT_INVALID, Cause, File=self.MetaFile,
+ ExtraData="%s.%s" % (ToPcd.TokenSpaceGuidCName, TokenCName))
+ ToPcd.validateranges = FromPcd.validateranges
+ ToPcd.validlists = FromPcd.validlists
+ ToPcd.expressions = FromPcd.expressions
+ ToPcd.CustomAttribute = FromPcd.CustomAttribute
+
+ if FromPcd is not None and ToPcd.DatumType == TAB_VOID and not ToPcd.MaxDatumSize:
+ EdkLogger.debug(EdkLogger.DEBUG_9, "No MaxDatumSize specified for PCD %s.%s" \
+ % (ToPcd.TokenSpaceGuidCName, TokenCName))
+ Value = ToPcd.DefaultValue
+ if not Value:
+ ToPcd.MaxDatumSize = '1'
+ elif Value[0] == 'L':
+ ToPcd.MaxDatumSize = str((len(Value) - 2) * 2)
+ elif Value[0] == '{':
+ ToPcd.MaxDatumSize = str(len(Value.split(',')))
+ else:
+ ToPcd.MaxDatumSize = str(len(Value) - 1)
+
+ # apply default SKU for dynamic PCDS if specified one is not available
+ if (ToPcd.Type in PCD_DYNAMIC_TYPE_SET or ToPcd.Type in PCD_DYNAMIC_EX_TYPE_SET) \
+ and not ToPcd.SkuInfoList:
+ if self.Platform.SkuName in self.Platform.SkuIds:
+ SkuName = self.Platform.SkuName
+ else:
+ SkuName = TAB_DEFAULT
+ ToPcd.SkuInfoList = {
+ SkuName : SkuInfoClass(SkuName, self.Platform.SkuIds[SkuName][0], '', '', '', '', '', ToPcd.DefaultValue)
+ }
+
+ ## Apply PCD setting defined platform to a module
+ #
+ # @param Module The module from which the PCD setting will be overridden
+ #
+ # @retval PCD_list The list PCDs with settings from platform
+ #
+ def ApplyPcdSetting(self, Module, Pcds, Library=""):
+ # for each PCD in module
+ for Name, Guid in Pcds:
+ PcdInModule = Pcds[Name, Guid]
+ # find out the PCD setting in platform
+ if (Name, Guid) in self.Platform.Pcds:
+ PcdInPlatform = self.Platform.Pcds[Name, Guid]
+ else:
+ PcdInPlatform = None
+ # then override the settings if any
+ self._OverridePcd(PcdInModule, PcdInPlatform, Module, Msg="DSC PCD sections", Library=Library)
+ # resolve the VariableGuid value
+ for SkuId in PcdInModule.SkuInfoList:
+ Sku = PcdInModule.SkuInfoList[SkuId]
+ if Sku.VariableGuid == '': continue
+ Sku.VariableGuidValue = GuidValue(Sku.VariableGuid, self.PackageList, self.MetaFile.Path)
+ if Sku.VariableGuidValue is None:
+ PackageList = "\n\t".join(str(P) for P in self.PackageList)
+ EdkLogger.error(
+ 'build',
+ RESOURCE_NOT_AVAILABLE,
+ "Value of GUID [%s] is not found in" % Sku.VariableGuid,
+ ExtraData=PackageList + "\n\t(used with %s.%s from module %s)" \
+ % (Guid, Name, str(Module)),
+ File=self.MetaFile
+ )
+
+ # override PCD settings with module specific setting
+ if Module in self.Platform.Modules:
+ PlatformModule = self.Platform.Modules[str(Module)]
+ for Key in PlatformModule.Pcds:
+ if GlobalData.BuildOptionPcd:
+ for pcd in GlobalData.BuildOptionPcd:
+ (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd
+ if (TokenCName, TokenSpaceGuidCName) == Key and FieldName =="":
+ PlatformModule.Pcds[Key].DefaultValue = pcdvalue
+ PlatformModule.Pcds[Key].PcdValueFromComm = pcdvalue
+ break
+ Flag = False
+ if Key in Pcds:
+ ToPcd = Pcds[Key]
+ Flag = True
+ elif Key in GlobalData.MixedPcd:
+ for PcdItem in GlobalData.MixedPcd[Key]:
+ if PcdItem in Pcds:
+ ToPcd = Pcds[PcdItem]
+ Flag = True
+ break
+ if Flag:
+ self._OverridePcd(ToPcd, PlatformModule.Pcds[Key], Module, Msg="DSC Components Module scoped PCD section", Library=Library)
+ # use PCD value to calculate the MaxDatumSize when it is not specified
+ for Name, Guid in Pcds:
+ Pcd = Pcds[Name, Guid]
+ if Pcd.DatumType == TAB_VOID and not Pcd.MaxDatumSize:
+ Pcd.MaxSizeUserSet = None
+ Value = Pcd.DefaultValue
+ if not Value:
+ Pcd.MaxDatumSize = '1'
+ elif Value[0] == 'L':
+ Pcd.MaxDatumSize = str((len(Value) - 2) * 2)
+ elif Value[0] == '{':
+ Pcd.MaxDatumSize = str(len(Value.split(',')))
+ else:
+ Pcd.MaxDatumSize = str(len(Value) - 1)
+ return list(Pcds.values())
+
+ ## Append build options in platform to a module
+ #
+ # @param Module The module to which the build options will be appended
+ #
+ # @retval options The options appended with build options in platform
+ #
+ def ApplyBuildOption(self, Module):
+ # Get the different options for the different style module
+ PlatformOptions = self.EdkIIBuildOption
+ ModuleTypeOptions = self.Platform.GetBuildOptionsByModuleType(EDKII_NAME, Module.ModuleType)
+ ModuleTypeOptions = self._ExpandBuildOption(ModuleTypeOptions)
+ ModuleOptions = self._ExpandBuildOption(Module.BuildOptions)
+ if Module in self.Platform.Modules:
+ PlatformModule = self.Platform.Modules[str(Module)]
+ PlatformModuleOptions = self._ExpandBuildOption(PlatformModule.BuildOptions)
+ else:
+ PlatformModuleOptions = {}
+
+ BuildRuleOrder = None
+ for Options in [self.ToolDefinition, ModuleOptions, PlatformOptions, ModuleTypeOptions, PlatformModuleOptions]:
+ for Tool in Options:
+ for Attr in Options[Tool]:
+ if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:
+ BuildRuleOrder = Options[Tool][Attr]
+
+ AllTools = set(list(ModuleOptions.keys()) + list(PlatformOptions.keys()) +
+ list(PlatformModuleOptions.keys()) + list(ModuleTypeOptions.keys()) +
+ list(self.ToolDefinition.keys()))
+ BuildOptions = defaultdict(lambda: defaultdict(str))
+ for Tool in AllTools:
+ for Options in [self.ToolDefinition, ModuleOptions, PlatformOptions, ModuleTypeOptions, PlatformModuleOptions]:
+ if Tool not in Options:
+ continue
+ for Attr in Options[Tool]:
+ #
+ # Do not generate it in Makefile
+ #
+ if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:
+ continue
+ Value = Options[Tool][Attr]
+ # check if override is indicated
+ if Value.startswith('='):
+ BuildOptions[Tool][Attr] = mws.handleWsMacro(Value[1:])
+ else:
+ if Attr != 'PATH':
+ BuildOptions[Tool][Attr] += " " + mws.handleWsMacro(Value)
+ else:
+ BuildOptions[Tool][Attr] = mws.handleWsMacro(Value)
+
+ return BuildOptions, BuildRuleOrder
+
+
+ def GetGlobalBuildOptions(self,Module):
+ ModuleTypeOptions = self.Platform.GetBuildOptionsByModuleType(EDKII_NAME, Module.ModuleType)
+ ModuleTypeOptions = self._ExpandBuildOption(ModuleTypeOptions)
+
+ if Module in self.Platform.Modules:
+ PlatformModule = self.Platform.Modules[str(Module)]
+ PlatformModuleOptions = self._ExpandBuildOption(PlatformModule.BuildOptions)
+ else:
+ PlatformModuleOptions = {}
+
+ return ModuleTypeOptions,PlatformModuleOptions
+ def ModuleGuid(self,Module):
+ if os.path.basename(Module.MetaFile.File) != os.path.basename(Module.MetaFile.Path):
+ #
+ # Length of GUID is 36
+ #
+ return os.path.basename(Module.MetaFile.Path)[:36]
+ return Module.Guid
+ @cached_property
+ def UniqueBaseName(self):
+ retVal ={}
+ ModuleNameDict = {}
+ UniqueName = {}
+ for Module in self._MbList:
+ unique_base_name = '%s_%s' % (Module.BaseName,self.ModuleGuid(Module))
+ if unique_base_name not in ModuleNameDict:
+ ModuleNameDict[unique_base_name] = []
+ ModuleNameDict[unique_base_name].append(Module.MetaFile)
+ if Module.BaseName not in UniqueName:
+ UniqueName[Module.BaseName] = set()
+ UniqueName[Module.BaseName].add((self.ModuleGuid(Module),Module.MetaFile))
+ for module_paths in ModuleNameDict.values():
+ if len(set(module_paths))>1:
+ samemodules = list(set(module_paths))
+ EdkLogger.error("build", FILE_DUPLICATED, 'Modules have same BaseName and FILE_GUID:\n'
+ ' %s\n %s' % (samemodules[0], samemodules[1]))
+ for name in UniqueName:
+ Guid_Path = UniqueName[name]
+ if len(Guid_Path) > 1:
+ for guid,mpath in Guid_Path:
+ retVal[(name,mpath)] = '%s_%s' % (name,guid)
+ return retVal
+ ## Expand * in build option key
+ #
+ # @param Options Options to be expanded
+ # @param ToolDef Use specified ToolDef instead of full version.
+ # This is needed during initialization to prevent
+ # infinite recursion betweeh BuildOptions,
+ # ToolDefinition, and this function.
+ #
+ # @retval options Options expanded
+ #
+ def _ExpandBuildOption(self, Options, ModuleStyle=None, ToolDef=None):
+ if not ToolDef:
+ ToolDef = self.ToolDefinition
+ BuildOptions = {}
+ FamilyMatch = False
+ FamilyIsNull = True
+
+ OverrideList = {}
+ #
+ # Construct a list contain the build options which need override.
+ #
+ for Key in Options:
+ #
+ # Key[0] -- tool family
+ # Key[1] -- TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE
+ #
+ if (Key[0] == self.BuildRuleFamily and
+ (ModuleStyle is None or len(Key) < 3 or (len(Key) > 2 and Key[2] == ModuleStyle))):
+ Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_')
+ if (Target == self.BuildTarget or Target == TAB_STAR) and\
+ (ToolChain == self.ToolChain or ToolChain == TAB_STAR) and\
+ (Arch == self.Arch or Arch == TAB_STAR) and\
+ Options[Key].startswith("="):
+
+ if OverrideList.get(Key[1]) is not None:
+ OverrideList.pop(Key[1])
+ OverrideList[Key[1]] = Options[Key]
+
+ #
+ # Use the highest priority value.
+ #
+ if (len(OverrideList) >= 2):
+ KeyList = list(OverrideList.keys())
+ for Index in range(len(KeyList)):
+ NowKey = KeyList[Index]
+ Target1, ToolChain1, Arch1, CommandType1, Attr1 = NowKey.split("_")
+ for Index1 in range(len(KeyList) - Index - 1):
+ NextKey = KeyList[Index1 + Index + 1]
+ #
+ # Compare two Key, if one is included by another, choose the higher priority one
+ #
+ Target2, ToolChain2, Arch2, CommandType2, Attr2 = NextKey.split("_")
+ if (Target1 == Target2 or Target1 == TAB_STAR or Target2 == TAB_STAR) and\
+ (ToolChain1 == ToolChain2 or ToolChain1 == TAB_STAR or ToolChain2 == TAB_STAR) and\
+ (Arch1 == Arch2 or Arch1 == TAB_STAR or Arch2 == TAB_STAR) and\
+ (CommandType1 == CommandType2 or CommandType1 == TAB_STAR or CommandType2 == TAB_STAR) and\
+ (Attr1 == Attr2 or Attr1 == TAB_STAR or Attr2 == TAB_STAR):
+
+ if CalculatePriorityValue(NowKey) > CalculatePriorityValue(NextKey):
+ if Options.get((self.BuildRuleFamily, NextKey)) is not None:
+ Options.pop((self.BuildRuleFamily, NextKey))
+ else:
+ if Options.get((self.BuildRuleFamily, NowKey)) is not None:
+ Options.pop((self.BuildRuleFamily, NowKey))
+
+ for Key in Options:
+ if ModuleStyle is not None and len (Key) > 2:
+ # Check Module style is EDK or EDKII.
+ # Only append build option for the matched style module.
+ if ModuleStyle == EDK_NAME and Key[2] != EDK_NAME:
+ continue
+ elif ModuleStyle == EDKII_NAME and Key[2] != EDKII_NAME:
+ continue
+ Family = Key[0]
+ Target, Tag, Arch, Tool, Attr = Key[1].split("_")
+ # if tool chain family doesn't match, skip it
+ if Tool in ToolDef and Family != "":
+ FamilyIsNull = False
+ if ToolDef[Tool].get(TAB_TOD_DEFINES_BUILDRULEFAMILY, "") != "":
+ if Family != ToolDef[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]:
+ continue
+ elif Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]:
+ continue
+ FamilyMatch = True
+ # expand any wildcard
+ if Target == TAB_STAR or Target == self.BuildTarget:
+ if Tag == TAB_STAR or Tag == self.ToolChain:
+ if Arch == TAB_STAR or Arch == self.Arch:
+ if Tool not in BuildOptions:
+ BuildOptions[Tool] = {}
+ if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
+ BuildOptions[Tool][Attr] = Options[Key]
+ else:
+ # append options for the same tool except PATH
+ if Attr != 'PATH':
+ BuildOptions[Tool][Attr] += " " + Options[Key]
+ else:
+ BuildOptions[Tool][Attr] = Options[Key]
+ # Build Option Family has been checked, which need't to be checked again for family.
+ if FamilyMatch or FamilyIsNull:
+ return BuildOptions
+
+ for Key in Options:
+ if ModuleStyle is not None and len (Key) > 2:
+ # Check Module style is EDK or EDKII.
+ # Only append build option for the matched style module.
+ if ModuleStyle == EDK_NAME and Key[2] != EDK_NAME:
+ continue
+ elif ModuleStyle == EDKII_NAME and Key[2] != EDKII_NAME:
+ continue
+ Family = Key[0]
+ Target, Tag, Arch, Tool, Attr = Key[1].split("_")
+ # if tool chain family doesn't match, skip it
+ if Tool not in ToolDef or Family == "":
+ continue
+ # option has been added before
+ if Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]:
+ continue
+
+ # expand any wildcard
+ if Target == TAB_STAR or Target == self.BuildTarget:
+ if Tag == TAB_STAR or Tag == self.ToolChain:
+ if Arch == TAB_STAR or Arch == self.Arch:
+ if Tool not in BuildOptions:
+ BuildOptions[Tool] = {}
+ if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
+ BuildOptions[Tool][Attr] = Options[Key]
+ else:
+ # append options for the same tool except PATH
+ if Attr != 'PATH':
+ BuildOptions[Tool][Attr] += " " + Options[Key]
+ else:
+ BuildOptions[Tool][Attr] = Options[Key]
+ return BuildOptions
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/StrGather.py b/roms/edk2/BaseTools/Source/Python/AutoGen/StrGather.py
new file mode 100644
index 000000000..eed30388b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/StrGather.py
@@ -0,0 +1,630 @@
+## @file
+# This file is used to parse a strings file and create or add to a string database
+# file.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import re
+import Common.EdkLogger as EdkLogger
+from Common.BuildToolError import *
+from .UniClassObject import *
+from io import BytesIO
+from struct import pack, unpack
+from Common.LongFilePathSupport import OpenLongFilePath as open
+
+##
+# Static definitions
+#
+EFI_HII_SIBT_END = '0x00'
+EFI_HII_SIBT_STRING_SCSU = '0x10'
+EFI_HII_SIBT_STRING_SCSU_FONT = '0x11'
+EFI_HII_SIBT_STRINGS_SCSU = '0x12'
+EFI_HII_SIBT_STRINGS_SCSU_FONT = '0x13'
+EFI_HII_SIBT_STRING_UCS2 = '0x14'
+EFI_HII_SIBT_STRING_UCS2_FONT = '0x15'
+EFI_HII_SIBT_STRINGS_UCS2 = '0x16'
+EFI_HII_SIBT_STRINGS_UCS2_FONT = '0x17'
+EFI_HII_SIBT_DUPLICATE = '0x20'
+EFI_HII_SIBT_SKIP2 = '0x21'
+EFI_HII_SIBT_SKIP1 = '0x22'
+EFI_HII_SIBT_EXT1 = '0x30'
+EFI_HII_SIBT_EXT2 = '0x31'
+EFI_HII_SIBT_EXT4 = '0x32'
+EFI_HII_SIBT_FONT = '0x40'
+
+EFI_HII_PACKAGE_STRINGS = '0x04'
+EFI_HII_PACKAGE_FORM = '0x02'
+
+StringPackageType = EFI_HII_PACKAGE_STRINGS
+StringPackageForm = EFI_HII_PACKAGE_FORM
+StringBlockType = EFI_HII_SIBT_STRING_UCS2
+StringSkipType = EFI_HII_SIBT_SKIP2
+
+HexHeader = '0x'
+
+COMMENT = '// '
+DEFINE_STR = '#define'
+COMMENT_DEFINE_STR = COMMENT + DEFINE_STR
+NOT_REFERENCED = 'not referenced'
+COMMENT_NOT_REFERENCED = ' ' + COMMENT + NOT_REFERENCED
+CHAR_ARRAY_DEFIN = 'unsigned char'
+COMMON_FILE_NAME = 'Strings'
+STRING_TOKEN = re.compile('STRING_TOKEN *\(([A-Z0-9_]+) *\)', re.MULTILINE | re.UNICODE)
+
+EFI_HII_ARRAY_SIZE_LENGTH = 4
+EFI_HII_PACKAGE_HEADER_LENGTH = 4
+EFI_HII_HDR_SIZE_LENGTH = 4
+EFI_HII_STRING_OFFSET_LENGTH = 4
+EFI_STRING_ID = 1
+EFI_STRING_ID_LENGTH = 2
+EFI_HII_LANGUAGE_WINDOW = 0
+EFI_HII_LANGUAGE_WINDOW_LENGTH = 2
+EFI_HII_LANGUAGE_WINDOW_NUMBER = 16
+EFI_HII_STRING_PACKAGE_HDR_LENGTH = EFI_HII_PACKAGE_HEADER_LENGTH + EFI_HII_HDR_SIZE_LENGTH + EFI_HII_STRING_OFFSET_LENGTH + EFI_HII_LANGUAGE_WINDOW_LENGTH * EFI_HII_LANGUAGE_WINDOW_NUMBER + EFI_STRING_ID_LENGTH
+
+H_C_FILE_HEADER = ['//', \
+ '// DO NOT EDIT -- auto-generated file', \
+ '//', \
+ '// This file is generated by the StrGather utility', \
+ '//']
+LANGUAGE_NAME_STRING_NAME = '$LANGUAGE_NAME'
+PRINTABLE_LANGUAGE_NAME_STRING_NAME = '$PRINTABLE_LANGUAGE_NAME'
+
+## Convert a dec number to a hex string
+#
+# Convert a dec number to a formatted hex string in length digit
+# The digit is set to default 8
+# The hex string starts with "0x"
+# DecToHexStr(1000) is '0x000003E8'
+# DecToHexStr(1000, 6) is '0x0003E8'
+#
+# @param Dec: The number in dec format
+# @param Digit: The needed digit of hex string
+#
+# @retval: The formatted hex string
+#
+def DecToHexStr(Dec, Digit = 8):
+ return '0x{0:0{1}X}'.format(Dec, Digit)
+
+## Convert a dec number to a hex list
+#
+# Convert a dec number to a formatted hex list in size digit
+# The digit is set to default 8
+# DecToHexList(1000) is ['0xE8', '0x03', '0x00', '0x00']
+# DecToHexList(1000, 6) is ['0xE8', '0x03', '0x00']
+#
+# @param Dec: The number in dec format
+# @param Digit: The needed digit of hex list
+#
+# @retval: A list for formatted hex string
+#
+def DecToHexList(Dec, Digit = 8):
+ Hex = '{0:0{1}X}'.format(Dec, Digit)
+ return ["0x" + Hex[Bit:Bit + 2] for Bit in range(Digit - 2, -1, -2)]
+
+## Convert a acsii string to a hex list
+#
+# Convert a acsii string to a formatted hex list
+# AscToHexList('en-US') is ['0x65', '0x6E', '0x2D', '0x55', '0x53']
+#
+# @param Ascii: The acsii string
+#
+# @retval: A list for formatted hex string
+#
+def AscToHexList(Ascii):
+ try:
+ return ['0x{0:02X}'.format(Item) for Item in Ascii]
+ except:
+ return ['0x{0:02X}'.format(ord(Item)) for Item in Ascii]
+
+## Create content of .h file
+#
+# Create content of .h file
+#
+# @param BaseName: The basename of strings
+# @param UniObjectClass A UniObjectClass instance
+# @param IsCompatibleMode Compatible mode
+# @param UniGenCFlag UniString is generated into AutoGen C file when it is set to True
+#
+# @retval Str: A string of .h file content
+#
+def CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag):
+ Str = []
+ ValueStartPtr = 60
+ Line = COMMENT_DEFINE_STR + ' ' + LANGUAGE_NAME_STRING_NAME + ' ' * (ValueStartPtr - len(DEFINE_STR + LANGUAGE_NAME_STRING_NAME)) + DecToHexStr(0, 4) + COMMENT_NOT_REFERENCED
+ Str = WriteLine(Str, Line)
+ Line = COMMENT_DEFINE_STR + ' ' + PRINTABLE_LANGUAGE_NAME_STRING_NAME + ' ' * (ValueStartPtr - len(DEFINE_STR + PRINTABLE_LANGUAGE_NAME_STRING_NAME)) + DecToHexStr(1, 4) + COMMENT_NOT_REFERENCED
+ Str = WriteLine(Str, Line)
+ UnusedStr = ''
+
+ #Group the referred/Unused STRING token together.
+ for Index in range(2, len(UniObjectClass.OrderedStringList[UniObjectClass.LanguageDef[0][0]])):
+ StringItem = UniObjectClass.OrderedStringList[UniObjectClass.LanguageDef[0][0]][Index]
+ Name = StringItem.StringName
+ Token = StringItem.Token
+ Referenced = StringItem.Referenced
+ if Name is not None:
+ Line = ''
+ if Referenced == True:
+ if (ValueStartPtr - len(DEFINE_STR + Name)) <= 0:
+ Line = DEFINE_STR + ' ' + Name + ' ' + DecToHexStr(Token, 4)
+ else:
+ Line = DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4)
+ Str = WriteLine(Str, Line)
+ else:
+ if (ValueStartPtr - len(DEFINE_STR + Name)) <= 0:
+ Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED
+ else:
+ Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED
+ UnusedStr = WriteLine(UnusedStr, Line)
+
+ Str.extend( UnusedStr)
+
+ Str = WriteLine(Str, '')
+ if IsCompatibleMode or UniGenCFlag:
+ Str = WriteLine(Str, 'extern unsigned char ' + BaseName + 'Strings[];')
+ return "".join(Str)
+
+## Create a complete .h file
+#
+# Create a complet .h file with file header and file content
+#
+# @param BaseName: The basename of strings
+# @param UniObjectClass A UniObjectClass instance
+# @param IsCompatibleMode Compatible mode
+# @param UniGenCFlag UniString is generated into AutoGen C file when it is set to True
+#
+# @retval Str: A string of complete .h file
+#
+def CreateHFile(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag):
+ HFile = WriteLine('', CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag))
+
+ return "".join(HFile)
+
+## Create a buffer to store all items in an array
+#
+# @param BinBuffer Buffer to contain Binary data.
+# @param Array: The array need to be formatted
+#
+def CreateBinBuffer(BinBuffer, Array):
+ for Item in Array:
+ BinBuffer.write(pack("B", int(Item, 16)))
+
+## Create a formatted string all items in an array
+#
+# Use ',' to join each item in an array, and break an new line when reaching the width (default is 16)
+#
+# @param Array: The array need to be formatted
+# @param Width: The line length, the default value is set to 16
+#
+# @retval ArrayItem: A string for all formatted array items
+#
+def CreateArrayItem(Array, Width = 16):
+ MaxLength = Width
+ Index = 0
+ Line = ' '
+ ArrayItem = []
+
+ for Item in Array:
+ if Index < MaxLength:
+ Line = Line + Item + ', '
+ Index = Index + 1
+ else:
+ ArrayItem = WriteLine(ArrayItem, Line)
+ Line = ' ' + Item + ', '
+ Index = 1
+ ArrayItem = Write(ArrayItem, Line.rstrip())
+
+ return "".join(ArrayItem)
+
+## CreateCFileStringValue
+#
+# Create a line with string value
+#
+# @param Value: Value of the string
+#
+# @retval Str: A formatted string with string value
+#
+
+def CreateCFileStringValue(Value):
+ Value = [StringBlockType] + Value
+ Str = WriteLine('', CreateArrayItem(Value))
+
+ return "".join(Str)
+
+## GetFilteredLanguage
+#
+# apply get best language rules to the UNI language code list
+#
+# @param UniLanguageList: language code definition list in *.UNI file
+# @param LanguageFilterList: language code filter list of RFC4646 format in DSC file
+#
+# @retval UniLanguageListFiltered: the filtered language code
+#
+def GetFilteredLanguage(UniLanguageList, LanguageFilterList):
+ UniLanguageListFiltered = []
+ # if filter list is empty, then consider there is no filter
+ if LanguageFilterList == []:
+ UniLanguageListFiltered = UniLanguageList
+ return UniLanguageListFiltered
+ for Language in LanguageFilterList:
+ # first check for exact match
+ if Language in UniLanguageList:
+ if Language not in UniLanguageListFiltered:
+ UniLanguageListFiltered.append(Language)
+ # find the first one with the same/equivalent primary tag
+ else:
+ if Language.find('-') != -1:
+ PrimaryTag = Language[0:Language.find('-')].lower()
+ else:
+ PrimaryTag = Language
+
+ if len(PrimaryTag) == 3:
+ PrimaryTag = LangConvTable.get(PrimaryTag)
+
+ for UniLanguage in UniLanguageList:
+ if UniLanguage.find('-') != -1:
+ UniLanguagePrimaryTag = UniLanguage[0:UniLanguage.find('-')].lower()
+ else:
+ UniLanguagePrimaryTag = UniLanguage
+
+ if len(UniLanguagePrimaryTag) == 3:
+ UniLanguagePrimaryTag = LangConvTable.get(UniLanguagePrimaryTag)
+
+ if PrimaryTag == UniLanguagePrimaryTag:
+ if UniLanguage not in UniLanguageListFiltered:
+ UniLanguageListFiltered.append(UniLanguage)
+ break
+ else:
+ # Here is rule 3 for "get best language"
+ # If tag is not listed in the Unicode file, the default ("en") tag should be used for that language
+ # for better processing, find the one that best suit for it.
+ DefaultTag = 'en'
+ if DefaultTag not in UniLanguageListFiltered:
+ # check whether language code with primary code equivalent with DefaultTag already in the list, if so, use that
+ for UniLanguage in UniLanguageList:
+ if UniLanguage.startswith('en-') or UniLanguage.startswith('eng-'):
+ if UniLanguage not in UniLanguageListFiltered:
+ UniLanguageListFiltered.append(UniLanguage)
+ break
+ else:
+ UniLanguageListFiltered.append(DefaultTag)
+ return UniLanguageListFiltered
+
+
+## Create content of .c file
+#
+# Create content of .c file
+#
+# @param BaseName: The basename of strings
+# @param UniObjectClass A UniObjectClass instance
+# @param IsCompatibleMode Compatible mode
+# @param UniBinBuffer UniBinBuffer to contain UniBinary data.
+# @param FilterInfo Platform language filter information
+#
+# @retval Str: A string of .c file content
+#
+def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniBinBuffer, FilterInfo):
+ #
+ # Init array length
+ #
+ TotalLength = EFI_HII_ARRAY_SIZE_LENGTH
+ Str = ''
+ Offset = 0
+
+ EDK2Module = FilterInfo[0]
+ if EDK2Module:
+ LanguageFilterList = FilterInfo[1]
+ else:
+ # EDK module is using ISO639-2 format filter, convert to the RFC4646 format
+ LanguageFilterList = [LangConvTable.get(F.lower()) for F in FilterInfo[1]]
+
+ UniLanguageList = []
+ for IndexI in range(len(UniObjectClass.LanguageDef)):
+ UniLanguageList += [UniObjectClass.LanguageDef[IndexI][0]]
+
+ UniLanguageListFiltered = GetFilteredLanguage(UniLanguageList, LanguageFilterList)
+
+
+ #
+ # Create lines for each language's strings
+ #
+ for IndexI in range(len(UniObjectClass.LanguageDef)):
+ Language = UniObjectClass.LanguageDef[IndexI][0]
+ if Language not in UniLanguageListFiltered:
+ continue
+
+ StringBuffer = BytesIO()
+ StrStringValue = ''
+ ArrayLength = 0
+ NumberOfUseOtherLangDef = 0
+ Index = 0
+ for IndexJ in range(1, len(UniObjectClass.OrderedStringList[UniObjectClass.LanguageDef[IndexI][0]])):
+ Item = UniObjectClass.OrderedStringListByToken[Language][IndexJ]
+
+ Name = Item.StringName
+ Value = Item.StringValueByteList
+ Referenced = Item.Referenced
+ Token = Item.Token
+ UseOtherLangDef = Item.UseOtherLangDef
+
+ if UseOtherLangDef != '' and Referenced:
+ NumberOfUseOtherLangDef = NumberOfUseOtherLangDef + 1
+ Index = Index + 1
+ else:
+ if NumberOfUseOtherLangDef > 0:
+ StrStringValue = WriteLine(StrStringValue, CreateArrayItem([StringSkipType] + DecToHexList(NumberOfUseOtherLangDef, 4)))
+ CreateBinBuffer (StringBuffer, ([StringSkipType] + DecToHexList(NumberOfUseOtherLangDef, 4)))
+ NumberOfUseOtherLangDef = 0
+ ArrayLength = ArrayLength + 3
+ if Referenced and Item.Token > 0:
+ Index = Index + 1
+ StrStringValue = WriteLine(StrStringValue, "// %s: %s:%s" % (DecToHexStr(Index, 4), Name, DecToHexStr(Token, 4)))
+ StrStringValue = Write(StrStringValue, CreateCFileStringValue(Value))
+ CreateBinBuffer (StringBuffer, [StringBlockType] + Value)
+ ArrayLength = ArrayLength + Item.Length + 1 # 1 is for the length of string type
+
+ #
+ # EFI_HII_PACKAGE_HEADER
+ #
+ Offset = EFI_HII_STRING_PACKAGE_HDR_LENGTH + len(Language) + 1
+ ArrayLength = Offset + ArrayLength + 1
+
+ #
+ # Create PACKAGE HEADER
+ #
+ Str = WriteLine(Str, '// PACKAGE HEADER\n')
+ TotalLength = TotalLength + ArrayLength
+
+ List = DecToHexList(ArrayLength, 6) + \
+ [StringPackageType] + \
+ DecToHexList(Offset) + \
+ DecToHexList(Offset) + \
+ DecToHexList(EFI_HII_LANGUAGE_WINDOW, EFI_HII_LANGUAGE_WINDOW_LENGTH * 2) * EFI_HII_LANGUAGE_WINDOW_NUMBER + \
+ DecToHexList(EFI_STRING_ID, 4) + \
+ AscToHexList(Language) + \
+ DecToHexList(0, 2)
+ Str = WriteLine(Str, CreateArrayItem(List, 16) + '\n')
+
+ #
+ # Create PACKAGE DATA
+ #
+ Str = WriteLine(Str, '// PACKAGE DATA\n')
+ Str = Write(Str, StrStringValue)
+
+ #
+ # Add an EFI_HII_SIBT_END at last
+ #
+ Str = WriteLine(Str, ' ' + EFI_HII_SIBT_END + ",")
+
+ #
+ # Create binary UNI string
+ #
+ if UniBinBuffer:
+ CreateBinBuffer (UniBinBuffer, List)
+ UniBinBuffer.write (StringBuffer.getvalue())
+ UniBinBuffer.write (pack("B", int(EFI_HII_SIBT_END, 16)))
+ StringBuffer.close()
+
+ #
+ # Create line for string variable name
+ # "unsigned char $(BaseName)Strings[] = {"
+ #
+ AllStr = WriteLine('', CHAR_ARRAY_DEFIN + ' ' + BaseName + COMMON_FILE_NAME + '[] = {\n')
+
+ if IsCompatibleMode:
+ #
+ # Create FRAMEWORK_EFI_HII_PACK_HEADER in compatible mode
+ #
+ AllStr = WriteLine(AllStr, '// FRAMEWORK PACKAGE HEADER Length')
+ AllStr = WriteLine(AllStr, CreateArrayItem(DecToHexList(TotalLength + 2)) + '\n')
+ AllStr = WriteLine(AllStr, '// FRAMEWORK PACKAGE HEADER Type')
+ AllStr = WriteLine(AllStr, CreateArrayItem(DecToHexList(2, 4)) + '\n')
+ else:
+ #
+ # Create whole array length in UEFI mode
+ #
+ AllStr = WriteLine(AllStr, '// STRGATHER_OUTPUT_HEADER')
+ AllStr = WriteLine(AllStr, CreateArrayItem(DecToHexList(TotalLength)) + '\n')
+
+ #
+ # Join package data
+ #
+ AllStr = Write(AllStr, Str)
+
+ return "".join(AllStr)
+
+## Create end of .c file
+#
+# Create end of .c file
+#
+# @retval Str: A string of .h file end
+#
+def CreateCFileEnd():
+ Str = Write('', '};')
+ return Str
+
+## Create a .c file
+#
+# Create a complete .c file
+#
+# @param BaseName: The basename of strings
+# @param UniObjectClass A UniObjectClass instance
+# @param IsCompatibleMode Compatible Mode
+# @param FilterInfo Platform language filter information
+#
+# @retval CFile: A string of complete .c file
+#
+def CreateCFile(BaseName, UniObjectClass, IsCompatibleMode, FilterInfo):
+ CFile = ''
+ CFile = WriteLine(CFile, CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, None, FilterInfo))
+ CFile = WriteLine(CFile, CreateCFileEnd())
+ return "".join(CFile)
+
+## GetFileList
+#
+# Get a list for all files
+#
+# @param IncludeList: A list of all path to be searched
+# @param SkipList: A list of all types of file could be skipped
+#
+# @retval FileList: A list of all files found
+#
+def GetFileList(SourceFileList, IncludeList, SkipList):
+ if IncludeList is None:
+ EdkLogger.error("UnicodeStringGather", AUTOGEN_ERROR, "Include path for unicode file is not defined")
+
+ FileList = []
+ if SkipList is None:
+ SkipList = []
+
+ for File in SourceFileList:
+ for Dir in IncludeList:
+ if not os.path.exists(Dir):
+ continue
+ File = os.path.join(Dir, File.Path)
+ #
+ # Ignore Dir
+ #
+ if os.path.isfile(File) != True:
+ continue
+ #
+ # Ignore file listed in skip list
+ #
+ IsSkip = False
+ for Skip in SkipList:
+ if os.path.splitext(File)[1].upper() == Skip.upper():
+ EdkLogger.verbose("Skipped %s for string token uses search" % File)
+ IsSkip = True
+ break
+
+ if not IsSkip:
+ FileList.append(File)
+
+ break
+
+ return FileList
+
+## SearchString
+#
+# Search whether all string defined in UniObjectClass are referenced
+# All string used should be set to Referenced
+#
+# @param UniObjectClass: Input UniObjectClass
+# @param FileList: Search path list
+# @param IsCompatibleMode Compatible Mode
+#
+# @retval UniObjectClass: UniObjectClass after searched
+#
+def SearchString(UniObjectClass, FileList, IsCompatibleMode):
+ if FileList == []:
+ return UniObjectClass
+
+ for File in FileList:
+ try:
+ if os.path.isfile(File):
+ Lines = open(File, 'r')
+ for Line in Lines:
+ for StrName in STRING_TOKEN.findall(Line):
+ EdkLogger.debug(EdkLogger.DEBUG_5, "Found string identifier: " + StrName)
+ UniObjectClass.SetStringReferenced(StrName)
+ except:
+ EdkLogger.error("UnicodeStringGather", AUTOGEN_ERROR, "SearchString: Error while processing file", File=File, RaiseError=False)
+ raise
+
+ UniObjectClass.ReToken()
+
+ return UniObjectClass
+
+## GetStringFiles
+#
+# This function is used for UEFI2.1 spec
+#
+#
+def GetStringFiles(UniFilList, SourceFileList, IncludeList, IncludePathList, SkipList, BaseName, IsCompatibleMode = False, ShellMode = False, UniGenCFlag = True, UniGenBinBuffer = None, FilterInfo = [True, []]):
+ if len(UniFilList) > 0:
+ if ShellMode:
+ #
+ # support ISO 639-2 codes in .UNI files of EDK Shell
+ #
+ Uni = UniFileClassObject(sorted(UniFilList, key=lambda x: x.File), True, IncludePathList)
+ else:
+ Uni = UniFileClassObject(sorted(UniFilList, key=lambda x: x.File), IsCompatibleMode, IncludePathList)
+ else:
+ EdkLogger.error("UnicodeStringGather", AUTOGEN_ERROR, 'No unicode files given')
+
+ FileList = GetFileList(SourceFileList, IncludeList, SkipList)
+
+ Uni = SearchString(Uni, sorted (FileList), IsCompatibleMode)
+
+ HFile = CreateHFile(BaseName, Uni, IsCompatibleMode, UniGenCFlag)
+ CFile = None
+ if IsCompatibleMode or UniGenCFlag:
+ CFile = CreateCFile(BaseName, Uni, IsCompatibleMode, FilterInfo)
+ if UniGenBinBuffer:
+ CreateCFileContent(BaseName, Uni, IsCompatibleMode, UniGenBinBuffer, FilterInfo)
+
+ return HFile, CFile
+
+#
+# Write an item
+#
+def Write(Target, Item):
+ if isinstance(Target,str):
+ Target = [Target]
+ if not Target:
+ Target = []
+ if isinstance(Item,list):
+ Target.extend(Item)
+ else:
+ Target.append(Item)
+ return Target
+
+#
+# Write an item with a break line
+#
+def WriteLine(Target, Item):
+ if isinstance(Target,str):
+ Target = [Target]
+ if not Target:
+ Target = []
+ if isinstance(Item, list):
+ Target.extend(Item)
+ else:
+ Target.append(Item)
+ Target.append('\n')
+ return Target
+
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+if __name__ == '__main__':
+ EdkLogger.info('start')
+
+ UniFileList = [
+ r'C:\\Edk\\Strings2.uni',
+ r'C:\\Edk\\Strings.uni'
+ ]
+
+ SrcFileList = []
+ for Root, Dirs, Files in os.walk('C:\\Edk'):
+ for File in Files:
+ SrcFileList.append(File)
+
+ IncludeList = [
+ r'C:\\Edk'
+ ]
+
+ SkipList = ['.inf', '.uni']
+ BaseName = 'DriverSample'
+ (h, c) = GetStringFiles(UniFileList, SrcFileList, IncludeList, SkipList, BaseName, True)
+ hfile = open('unistring.h', 'w')
+ cfile = open('unistring.c', 'w')
+ hfile.write(h)
+ cfile.write(c)
+
+ EdkLogger.info('end')
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/UniClassObject.py b/roms/edk2/BaseTools/Source/Python/AutoGen/UniClassObject.py
new file mode 100644
index 000000000..883c2356e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/UniClassObject.py
@@ -0,0 +1,683 @@
+## @file
+# This file is used to collect all defined strings in multiple uni files
+#
+#
+# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.<BR>
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+##
+# Import Modules
+#
+from __future__ import print_function
+import Common.LongFilePathOs as os, codecs, re
+import distutils.util
+import Common.EdkLogger as EdkLogger
+from io import BytesIO
+from Common.BuildToolError import *
+from Common.StringUtils import GetLineNo
+from Common.Misc import PathClass
+from Common.LongFilePathSupport import LongFilePath
+from Common.GlobalData import *
+##
+# Static definitions
+#
+UNICODE_WIDE_CHAR = u'\\wide'
+UNICODE_NARROW_CHAR = u'\\narrow'
+UNICODE_NON_BREAKING_CHAR = u'\\nbr'
+UNICODE_UNICODE_CR = '\r'
+UNICODE_UNICODE_LF = '\n'
+
+NARROW_CHAR = u'\uFFF0'
+WIDE_CHAR = u'\uFFF1'
+NON_BREAKING_CHAR = u'\uFFF2'
+CR = u'\u000D'
+LF = u'\u000A'
+NULL = u'\u0000'
+TAB = u'\t'
+BACK_SLASH_PLACEHOLDER = u'\u0006'
+
+gIncludePattern = re.compile("^#include +[\"<]+([^\"< >]+)[>\"]+$", re.MULTILINE | re.UNICODE)
+
+## Convert a unicode string to a Hex list
+#
+# Convert a unicode string to a Hex list
+# UniToHexList('ABC') is ['0x41', '0x00', '0x42', '0x00', '0x43', '0x00']
+#
+# @param Uni: The python unicode string
+#
+# @retval List: The formatted hex list
+#
+def UniToHexList(Uni):
+ List = []
+ for Item in Uni:
+ Temp = '%04X' % ord(Item)
+ List.append('0x' + Temp[2:4])
+ List.append('0x' + Temp[0:2])
+ return List
+
+LangConvTable = {'eng':'en', 'fra':'fr', \
+ 'aar':'aa', 'abk':'ab', 'ave':'ae', 'afr':'af', 'aka':'ak', 'amh':'am', \
+ 'arg':'an', 'ara':'ar', 'asm':'as', 'ava':'av', 'aym':'ay', 'aze':'az', \
+ 'bak':'ba', 'bel':'be', 'bul':'bg', 'bih':'bh', 'bis':'bi', 'bam':'bm', \
+ 'ben':'bn', 'bod':'bo', 'bre':'br', 'bos':'bs', 'cat':'ca', 'che':'ce', \
+ 'cha':'ch', 'cos':'co', 'cre':'cr', 'ces':'cs', 'chu':'cu', 'chv':'cv', \
+ 'cym':'cy', 'dan':'da', 'deu':'de', 'div':'dv', 'dzo':'dz', 'ewe':'ee', \
+ 'ell':'el', 'epo':'eo', 'spa':'es', 'est':'et', 'eus':'eu', 'fas':'fa', \
+ 'ful':'ff', 'fin':'fi', 'fij':'fj', 'fao':'fo', 'fry':'fy', 'gle':'ga', \
+ 'gla':'gd', 'glg':'gl', 'grn':'gn', 'guj':'gu', 'glv':'gv', 'hau':'ha', \
+ 'heb':'he', 'hin':'hi', 'hmo':'ho', 'hrv':'hr', 'hat':'ht', 'hun':'hu', \
+ 'hye':'hy', 'her':'hz', 'ina':'ia', 'ind':'id', 'ile':'ie', 'ibo':'ig', \
+ 'iii':'ii', 'ipk':'ik', 'ido':'io', 'isl':'is', 'ita':'it', 'iku':'iu', \
+ 'jpn':'ja', 'jav':'jv', 'kat':'ka', 'kon':'kg', 'kik':'ki', 'kua':'kj', \
+ 'kaz':'kk', 'kal':'kl', 'khm':'km', 'kan':'kn', 'kor':'ko', 'kau':'kr', \
+ 'kas':'ks', 'kur':'ku', 'kom':'kv', 'cor':'kw', 'kir':'ky', 'lat':'la', \
+ 'ltz':'lb', 'lug':'lg', 'lim':'li', 'lin':'ln', 'lao':'lo', 'lit':'lt', \
+ 'lub':'lu', 'lav':'lv', 'mlg':'mg', 'mah':'mh', 'mri':'mi', 'mkd':'mk', \
+ 'mal':'ml', 'mon':'mn', 'mar':'mr', 'msa':'ms', 'mlt':'mt', 'mya':'my', \
+ 'nau':'na', 'nob':'nb', 'nde':'nd', 'nep':'ne', 'ndo':'ng', 'nld':'nl', \
+ 'nno':'nn', 'nor':'no', 'nbl':'nr', 'nav':'nv', 'nya':'ny', 'oci':'oc', \
+ 'oji':'oj', 'orm':'om', 'ori':'or', 'oss':'os', 'pan':'pa', 'pli':'pi', \
+ 'pol':'pl', 'pus':'ps', 'por':'pt', 'que':'qu', 'roh':'rm', 'run':'rn', \
+ 'ron':'ro', 'rus':'ru', 'kin':'rw', 'san':'sa', 'srd':'sc', 'snd':'sd', \
+ 'sme':'se', 'sag':'sg', 'sin':'si', 'slk':'sk', 'slv':'sl', 'smo':'sm', \
+ 'sna':'sn', 'som':'so', 'sqi':'sq', 'srp':'sr', 'ssw':'ss', 'sot':'st', \
+ 'sun':'su', 'swe':'sv', 'swa':'sw', 'tam':'ta', 'tel':'te', 'tgk':'tg', \
+ 'tha':'th', 'tir':'ti', 'tuk':'tk', 'tgl':'tl', 'tsn':'tn', 'ton':'to', \
+ 'tur':'tr', 'tso':'ts', 'tat':'tt', 'twi':'tw', 'tah':'ty', 'uig':'ug', \
+ 'ukr':'uk', 'urd':'ur', 'uzb':'uz', 'ven':'ve', 'vie':'vi', 'vol':'vo', \
+ 'wln':'wa', 'wol':'wo', 'xho':'xh', 'yid':'yi', 'yor':'yo', 'zha':'za', \
+ 'zho':'zh', 'zul':'zu'}
+
+## GetLanguageCode
+#
+# Check the language code read from .UNI file and convert ISO 639-2 codes to RFC 4646 codes if appropriate
+# ISO 639-2 language codes supported in compatibility mode
+# RFC 4646 language codes supported in native mode
+#
+# @param LangName: Language codes read from .UNI file
+#
+# @retval LangName: Valid language code in RFC 4646 format or None
+#
+def GetLanguageCode(LangName, IsCompatibleMode, File):
+ length = len(LangName)
+ if IsCompatibleMode:
+ if length == 3 and LangName.isalpha():
+ TempLangName = LangConvTable.get(LangName.lower())
+ if TempLangName is not None:
+ return TempLangName
+ return LangName
+ else:
+ EdkLogger.error("Unicode File Parser", FORMAT_INVALID, "Invalid ISO 639-2 language code : %s" % LangName, File)
+
+ if (LangName[0] == 'X' or LangName[0] == 'x') and LangName[1] == '-':
+ return LangName
+ if length == 2:
+ if LangName.isalpha():
+ return LangName
+ elif length == 3:
+ if LangName.isalpha() and LangConvTable.get(LangName.lower()) is None:
+ return LangName
+ elif length == 5:
+ if LangName[0:2].isalpha() and LangName[2] == '-':
+ return LangName
+ elif length >= 6:
+ if LangName[0:2].isalpha() and LangName[2] == '-':
+ return LangName
+ if LangName[0:3].isalpha() and LangConvTable.get(LangName.lower()) is None and LangName[3] == '-':
+ return LangName
+
+ EdkLogger.error("Unicode File Parser", FORMAT_INVALID, "Invalid RFC 4646 language code : %s" % LangName, File)
+
+## Ucs2Codec
+#
+# This is only a partial codec implementation. It only supports
+# encoding, and is primarily used to check that all the characters are
+# valid for UCS-2.
+#
+class Ucs2Codec(codecs.Codec):
+ def __init__(self):
+ self.__utf16 = codecs.lookup('utf-16')
+
+ def encode(self, input, errors='strict'):
+ for Char in input:
+ CodePoint = ord(Char)
+ if CodePoint >= 0xd800 and CodePoint <= 0xdfff:
+ raise ValueError("Code Point is in range reserved for " +
+ "UTF-16 surrogate pairs")
+ elif CodePoint > 0xffff:
+ raise ValueError("Code Point too large to encode in UCS-2")
+ return self.__utf16.encode(input)
+
+TheUcs2Codec = Ucs2Codec()
+def Ucs2Search(name):
+ if name in ['ucs-2', 'ucs_2']:
+ return codecs.CodecInfo(
+ name=name,
+ encode=TheUcs2Codec.encode,
+ decode=TheUcs2Codec.decode)
+ else:
+ return None
+codecs.register(Ucs2Search)
+
+## StringDefClassObject
+#
+# A structure for language definition
+#
+class StringDefClassObject(object):
+ def __init__(self, Name = None, Value = None, Referenced = False, Token = None, UseOtherLangDef = ''):
+ self.StringName = ''
+ self.StringNameByteList = []
+ self.StringValue = ''
+ self.StringValueByteList = ''
+ self.Token = 0
+ self.Referenced = Referenced
+ self.UseOtherLangDef = UseOtherLangDef
+ self.Length = 0
+
+ if Name is not None:
+ self.StringName = Name
+ self.StringNameByteList = UniToHexList(Name)
+ if Value is not None:
+ self.StringValue = Value + u'\x00' # Add a NULL at string tail
+ self.StringValueByteList = UniToHexList(self.StringValue)
+ self.Length = len(self.StringValueByteList)
+ if Token is not None:
+ self.Token = Token
+
+ def __str__(self):
+ return repr(self.StringName) + ' ' + \
+ repr(self.Token) + ' ' + \
+ repr(self.Referenced) + ' ' + \
+ repr(self.StringValue) + ' ' + \
+ repr(self.UseOtherLangDef)
+
+ def UpdateValue(self, Value = None):
+ if Value is not None:
+ self.StringValue = Value + u'\x00' # Add a NULL at string tail
+ self.StringValueByteList = UniToHexList(self.StringValue)
+ self.Length = len(self.StringValueByteList)
+
+def StripComments(Line):
+ Comment = u'//'
+ CommentPos = Line.find(Comment)
+ while CommentPos >= 0:
+ # if there are non matched quotes before the comment header
+ # then we are in the middle of a string
+ # but we need to ignore the escaped quotes and backslashes.
+ if ((Line.count(u'"', 0, CommentPos) - Line.count(u'\\"', 0, CommentPos)) & 1) == 1:
+ CommentPos = Line.find (Comment, CommentPos + 1)
+ else:
+ return Line[:CommentPos].strip()
+ return Line.strip()
+
+## UniFileClassObject
+#
+# A structure for .uni file definition
+#
+class UniFileClassObject(object):
+ def __init__(self, FileList = [], IsCompatibleMode = False, IncludePathList = []):
+ self.FileList = FileList
+ self.Token = 2
+ self.LanguageDef = [] #[ [u'LanguageIdentifier', u'PrintableName'], ... ]
+ self.OrderedStringList = {} #{ u'LanguageIdentifier' : [StringDefClassObject] }
+ self.OrderedStringDict = {} #{ u'LanguageIdentifier' : {StringName:(IndexInList)} }
+ self.OrderedStringListByToken = {} #{ u'LanguageIdentifier' : {Token: StringDefClassObject} }
+ self.IsCompatibleMode = IsCompatibleMode
+ self.IncludePathList = IncludePathList
+ if len(self.FileList) > 0:
+ self.LoadUniFiles(FileList)
+
+ #
+ # Get Language definition
+ #
+ def GetLangDef(self, File, Line):
+ Lang = distutils.util.split_quoted((Line.split(u"//")[0]))
+ if len(Lang) != 3:
+ try:
+ FileIn = UniFileClassObject.OpenUniFile(LongFilePath(File.Path))
+ except UnicodeError as X:
+ EdkLogger.error("build", FILE_READ_FAILURE, "File read failure: %s" % str(X), ExtraData=File);
+ except:
+ EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=File);
+ LineNo = GetLineNo(FileIn, Line, False)
+ EdkLogger.error("Unicode File Parser", PARSER_ERROR, "Wrong language definition",
+ ExtraData="""%s\n\t*Correct format is like '#langdef en-US "English"'""" % Line, File=File, Line=LineNo)
+ else:
+ LangName = GetLanguageCode(Lang[1], self.IsCompatibleMode, self.File)
+ LangPrintName = Lang[2]
+
+ IsLangInDef = False
+ for Item in self.LanguageDef:
+ if Item[0] == LangName:
+ IsLangInDef = True
+ break;
+
+ if not IsLangInDef:
+ self.LanguageDef.append([LangName, LangPrintName])
+
+ #
+ # Add language string
+ #
+ self.AddStringToList(u'$LANGUAGE_NAME', LangName, LangName, 0, True, Index=0)
+ self.AddStringToList(u'$PRINTABLE_LANGUAGE_NAME', LangName, LangPrintName, 1, True, Index=1)
+
+ if not IsLangInDef:
+ #
+ # The found STRING tokens will be added into new language string list
+ # so that the unique STRING identifier is reserved for all languages in the package list.
+ #
+ FirstLangName = self.LanguageDef[0][0]
+ if LangName != FirstLangName:
+ for Index in range (2, len (self.OrderedStringList[FirstLangName])):
+ Item = self.OrderedStringList[FirstLangName][Index]
+ if Item.UseOtherLangDef != '':
+ OtherLang = Item.UseOtherLangDef
+ else:
+ OtherLang = FirstLangName
+ self.OrderedStringList[LangName].append (StringDefClassObject(Item.StringName, '', Item.Referenced, Item.Token, OtherLang))
+ self.OrderedStringDict[LangName][Item.StringName] = len(self.OrderedStringList[LangName]) - 1
+ return True
+
+ @staticmethod
+ def OpenUniFile(FileName):
+ #
+ # Read file
+ #
+ try:
+ UniFile = open(FileName, mode='rb')
+ FileIn = UniFile.read()
+ UniFile.close()
+ except:
+ EdkLogger.Error("build", FILE_OPEN_FAILURE, ExtraData=File)
+
+ #
+ # Detect Byte Order Mark at beginning of file. Default to UTF-8
+ #
+ Encoding = 'utf-8'
+ if (FileIn.startswith(codecs.BOM_UTF16_BE) or
+ FileIn.startswith(codecs.BOM_UTF16_LE)):
+ Encoding = 'utf-16'
+
+ UniFileClassObject.VerifyUcs2Data(FileIn, FileName, Encoding)
+
+ UniFile = BytesIO(FileIn)
+ Info = codecs.lookup(Encoding)
+ (Reader, Writer) = (Info.streamreader, Info.streamwriter)
+ return codecs.StreamReaderWriter(UniFile, Reader, Writer)
+
+ @staticmethod
+ def VerifyUcs2Data(FileIn, FileName, Encoding):
+ Ucs2Info = codecs.lookup('ucs-2')
+ #
+ # Convert to unicode
+ #
+ try:
+ FileDecoded = codecs.decode(FileIn, Encoding)
+ Ucs2Info.encode(FileDecoded)
+ except:
+ UniFile = BytesIO(FileIn)
+ Info = codecs.lookup(Encoding)
+ (Reader, Writer) = (Info.streamreader, Info.streamwriter)
+ File = codecs.StreamReaderWriter(UniFile, Reader, Writer)
+ LineNumber = 0
+ ErrMsg = lambda Encoding, LineNumber: \
+ '%s contains invalid %s characters on line %d.' % \
+ (FileName, Encoding, LineNumber)
+ while True:
+ LineNumber = LineNumber + 1
+ try:
+ Line = File.readline()
+ if Line == '':
+ EdkLogger.error('Unicode File Parser', PARSER_ERROR,
+ ErrMsg(Encoding, LineNumber))
+ Ucs2Info.encode(Line)
+ except:
+ EdkLogger.error('Unicode File Parser', PARSER_ERROR,
+ ErrMsg('UCS-2', LineNumber))
+
+ #
+ # Get String name and value
+ #
+ def GetStringObject(self, Item):
+ Language = ''
+ Value = ''
+
+ Name = Item.split()[1]
+ # Check the string name
+ if Name != '':
+ MatchString = gIdentifierPattern.match(Name)
+ if MatchString is None:
+ EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid character.' % (Name, self.File))
+ LanguageList = Item.split(u'#language ')
+ for IndexI in range(len(LanguageList)):
+ if IndexI == 0:
+ continue
+ else:
+ Language = LanguageList[IndexI].split()[0]
+ Value = LanguageList[IndexI][LanguageList[IndexI].find(u'\"') + len(u'\"') : LanguageList[IndexI].rfind(u'\"')] #.replace(u'\r\n', u'')
+ Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File)
+ self.AddStringToList(Name, Language, Value)
+
+ #
+ # Get include file list and load them
+ #
+ def GetIncludeFile(self, Item, Dir):
+ FileName = Item[Item.find(u'#include ') + len(u'#include ') :Item.find(u' ', len(u'#include '))][1:-1]
+ self.LoadUniFile(FileName)
+
+ #
+ # Pre-process before parse .uni file
+ #
+ def PreProcess(self, File):
+ try:
+ FileIn = UniFileClassObject.OpenUniFile(LongFilePath(File.Path))
+ except UnicodeError as X:
+ EdkLogger.error("build", FILE_READ_FAILURE, "File read failure: %s" % str(X), ExtraData=File.Path);
+ except OSError:
+ EdkLogger.error("Unicode File Parser", FILE_NOT_FOUND, ExtraData=File.Path)
+ except:
+ EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=File.Path);
+
+ Lines = []
+ #
+ # Use unique identifier
+ #
+ for Line in FileIn:
+ Line = Line.strip()
+ Line = Line.replace(u'\\\\', BACK_SLASH_PLACEHOLDER)
+ Line = StripComments(Line)
+
+ #
+ # Ignore empty line
+ #
+ if len(Line) == 0:
+ continue
+
+
+ Line = Line.replace(u'/langdef', u'#langdef')
+ Line = Line.replace(u'/string', u'#string')
+ Line = Line.replace(u'/language', u'#language')
+ Line = Line.replace(u'/include', u'#include')
+
+ Line = Line.replace(UNICODE_WIDE_CHAR, WIDE_CHAR)
+ Line = Line.replace(UNICODE_NARROW_CHAR, NARROW_CHAR)
+ Line = Line.replace(UNICODE_NON_BREAKING_CHAR, NON_BREAKING_CHAR)
+
+ Line = Line.replace(u'\\r\\n', CR + LF)
+ Line = Line.replace(u'\\n', CR + LF)
+ Line = Line.replace(u'\\r', CR)
+ Line = Line.replace(u'\\t', u' ')
+ Line = Line.replace(u'\t', u' ')
+ Line = Line.replace(u'\\"', u'"')
+ Line = Line.replace(u"\\'", u"'")
+ Line = Line.replace(BACK_SLASH_PLACEHOLDER, u'\\')
+
+ StartPos = Line.find(u'\\x')
+ while (StartPos != -1):
+ EndPos = Line.find(u'\\', StartPos + 1, StartPos + 7)
+ if EndPos != -1 and EndPos - StartPos == 6 :
+ if g4HexChar.match(Line[StartPos + 2 : EndPos], re.UNICODE):
+ EndStr = Line[EndPos: ]
+ UniStr = Line[StartPos + 2: EndPos]
+ if EndStr.startswith(u'\\x') and len(EndStr) >= 7:
+ if EndStr[6] == u'\\' and g4HexChar.match(EndStr[2 : 6], re.UNICODE):
+ Line = Line[0 : StartPos] + UniStr + EndStr
+ else:
+ Line = Line[0 : StartPos] + UniStr + EndStr[1:]
+ StartPos = Line.find(u'\\x', StartPos + 1)
+
+ IncList = gIncludePattern.findall(Line)
+ if len(IncList) == 1:
+ for Dir in [File.Dir] + self.IncludePathList:
+ IncFile = PathClass(str(IncList[0]), Dir)
+ if os.path.isfile(IncFile.Path):
+ Lines.extend(self.PreProcess(IncFile))
+ break
+ else:
+ EdkLogger.error("Unicode File Parser", FILE_NOT_FOUND, Message="Cannot find include file", ExtraData=str(IncList[0]))
+ continue
+
+ Lines.append(Line)
+
+ return Lines
+
+ #
+ # Load a .uni file
+ #
+ def LoadUniFile(self, File = None):
+ if File is None:
+ EdkLogger.error("Unicode File Parser", PARSER_ERROR, 'No unicode file is given')
+ self.File = File
+ #
+ # Process special char in file
+ #
+ Lines = self.PreProcess(File)
+
+ #
+ # Get Unicode Information
+ #
+ for IndexI in range(len(Lines)):
+ Line = Lines[IndexI]
+ if (IndexI + 1) < len(Lines):
+ SecondLine = Lines[IndexI + 1]
+ if (IndexI + 2) < len(Lines):
+ ThirdLine = Lines[IndexI + 2]
+
+ #
+ # Get Language def information
+ #
+ if Line.find(u'#langdef ') >= 0:
+ self.GetLangDef(File, Line)
+ continue
+
+ Name = ''
+ Language = ''
+ Value = ''
+ #
+ # Get string def information format 1 as below
+ #
+ # #string MY_STRING_1
+ # #language eng
+ # My first English string line 1
+ # My first English string line 2
+ # #string MY_STRING_1
+ # #language spa
+ # Mi segunda secuencia 1
+ # Mi segunda secuencia 2
+ #
+ if Line.find(u'#string ') >= 0 and Line.find(u'#language ') < 0 and \
+ SecondLine.find(u'#string ') < 0 and SecondLine.find(u'#language ') >= 0 and \
+ ThirdLine.find(u'#string ') < 0 and ThirdLine.find(u'#language ') < 0:
+ Name = Line[Line.find(u'#string ') + len(u'#string ') : ].strip(' ')
+ Language = SecondLine[SecondLine.find(u'#language ') + len(u'#language ') : ].strip(' ')
+ for IndexJ in range(IndexI + 2, len(Lines)):
+ if Lines[IndexJ].find(u'#string ') < 0 and Lines[IndexJ].find(u'#language ') < 0:
+ Value = Value + Lines[IndexJ]
+ else:
+ IndexI = IndexJ
+ break
+ # Value = Value.replace(u'\r\n', u'')
+ Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File)
+ # Check the string name
+ if not self.IsCompatibleMode and Name != '':
+ MatchString = gIdentifierPattern.match(Name)
+ if MatchString is None:
+ EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid character.' % (Name, self.File))
+ self.AddStringToList(Name, Language, Value)
+ continue
+
+ #
+ # Get string def information format 2 as below
+ #
+ # #string MY_STRING_1 #language eng "My first English string line 1"
+ # "My first English string line 2"
+ # #language spa "Mi segunda secuencia 1"
+ # "Mi segunda secuencia 2"
+ # #string MY_STRING_2 #language eng "My first English string line 1"
+ # "My first English string line 2"
+ # #string MY_STRING_2 #language spa "Mi segunda secuencia 1"
+ # "Mi segunda secuencia 2"
+ #
+ if Line.find(u'#string ') >= 0 and Line.find(u'#language ') >= 0:
+ StringItem = Line
+ for IndexJ in range(IndexI + 1, len(Lines)):
+ if Lines[IndexJ].find(u'#string ') >= 0 and Lines[IndexJ].find(u'#language ') >= 0:
+ IndexI = IndexJ
+ break
+ elif Lines[IndexJ].find(u'#string ') < 0 and Lines[IndexJ].find(u'#language ') >= 0:
+ StringItem = StringItem + Lines[IndexJ]
+ elif Lines[IndexJ].count(u'\"') >= 2:
+ StringItem = StringItem[ : StringItem.rfind(u'\"')] + Lines[IndexJ][Lines[IndexJ].find(u'\"') + len(u'\"') : ]
+ self.GetStringObject(StringItem)
+ continue
+
+ #
+ # Load multiple .uni files
+ #
+ def LoadUniFiles(self, FileList):
+ if len(FileList) > 0:
+ for File in FileList:
+ self.LoadUniFile(File)
+
+ #
+ # Add a string to list
+ #
+ def AddStringToList(self, Name, Language, Value, Token = None, Referenced = False, UseOtherLangDef = '', Index = -1):
+ for LangNameItem in self.LanguageDef:
+ if Language == LangNameItem[0]:
+ break
+ else:
+ EdkLogger.error('Unicode File Parser', FORMAT_NOT_SUPPORTED, "The language '%s' for %s is not defined in Unicode file %s." \
+ % (Language, Name, self.File))
+
+ if Language not in self.OrderedStringList:
+ self.OrderedStringList[Language] = []
+ self.OrderedStringDict[Language] = {}
+
+ IsAdded = True
+ if Name in self.OrderedStringDict[Language]:
+ IsAdded = False
+ if Value is not None:
+ ItemIndexInList = self.OrderedStringDict[Language][Name]
+ Item = self.OrderedStringList[Language][ItemIndexInList]
+ Item.UpdateValue(Value)
+ Item.UseOtherLangDef = ''
+
+ if IsAdded:
+ Token = len(self.OrderedStringList[Language])
+ if Index == -1:
+ self.OrderedStringList[Language].append(StringDefClassObject(Name, Value, Referenced, Token, UseOtherLangDef))
+ self.OrderedStringDict[Language][Name] = Token
+ for LangName in self.LanguageDef:
+ #
+ # New STRING token will be added into all language string lists.
+ # so that the unique STRING identifier is reserved for all languages in the package list.
+ #
+ if LangName[0] != Language:
+ if UseOtherLangDef != '':
+ OtherLangDef = UseOtherLangDef
+ else:
+ OtherLangDef = Language
+ self.OrderedStringList[LangName[0]].append(StringDefClassObject(Name, '', Referenced, Token, OtherLangDef))
+ self.OrderedStringDict[LangName[0]][Name] = len(self.OrderedStringList[LangName[0]]) - 1
+ else:
+ self.OrderedStringList[Language].insert(Index, StringDefClassObject(Name, Value, Referenced, Token, UseOtherLangDef))
+ self.OrderedStringDict[Language][Name] = Index
+
+ #
+ # Set the string as referenced
+ #
+ def SetStringReferenced(self, Name):
+ #
+ # String stoken are added in the same order in all language string lists.
+ # So, only update the status of string stoken in first language string list.
+ #
+ Lang = self.LanguageDef[0][0]
+ if Name in self.OrderedStringDict[Lang]:
+ ItemIndexInList = self.OrderedStringDict[Lang][Name]
+ Item = self.OrderedStringList[Lang][ItemIndexInList]
+ Item.Referenced = True
+
+ #
+ # Search the string in language definition by Name
+ #
+ def FindStringValue(self, Name, Lang):
+ if Name in self.OrderedStringDict[Lang]:
+ ItemIndexInList = self.OrderedStringDict[Lang][Name]
+ return self.OrderedStringList[Lang][ItemIndexInList]
+
+ return None
+
+ #
+ # Search the string in language definition by Token
+ #
+ def FindByToken(self, Token, Lang):
+ for Item in self.OrderedStringList[Lang]:
+ if Item.Token == Token:
+ return Item
+
+ return None
+
+ #
+ # Re-order strings and re-generate tokens
+ #
+ def ReToken(self):
+ #
+ # Retoken all language strings according to the status of string stoken in the first language string.
+ #
+ FirstLangName = self.LanguageDef[0][0]
+
+ # Convert the OrderedStringList to be OrderedStringListByToken in order to faciliate future search by token
+ for LangNameItem in self.LanguageDef:
+ self.OrderedStringListByToken[LangNameItem[0]] = {}
+
+ #
+ # Use small token for all referred string stoken.
+ #
+ RefToken = 0
+ for Index in range (0, len (self.OrderedStringList[FirstLangName])):
+ FirstLangItem = self.OrderedStringList[FirstLangName][Index]
+ if FirstLangItem.Referenced == True:
+ for LangNameItem in self.LanguageDef:
+ LangName = LangNameItem[0]
+ OtherLangItem = self.OrderedStringList[LangName][Index]
+ OtherLangItem.Referenced = True
+ OtherLangItem.Token = RefToken
+ self.OrderedStringListByToken[LangName][OtherLangItem.Token] = OtherLangItem
+ RefToken = RefToken + 1
+
+ #
+ # Use big token for all unreferred string stoken.
+ #
+ UnRefToken = 0
+ for Index in range (0, len (self.OrderedStringList[FirstLangName])):
+ FirstLangItem = self.OrderedStringList[FirstLangName][Index]
+ if FirstLangItem.Referenced == False:
+ for LangNameItem in self.LanguageDef:
+ LangName = LangNameItem[0]
+ OtherLangItem = self.OrderedStringList[LangName][Index]
+ OtherLangItem.Token = RefToken + UnRefToken
+ self.OrderedStringListByToken[LangName][OtherLangItem.Token] = OtherLangItem
+ UnRefToken = UnRefToken + 1
+
+ #
+ # Show the instance itself
+ #
+ def ShowMe(self):
+ print(self.LanguageDef)
+ #print self.OrderedStringList
+ for Item in self.OrderedStringList:
+ print(Item)
+ for Member in self.OrderedStringList[Item]:
+ print(str(Member))
+
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+if __name__ == '__main__':
+ EdkLogger.Initialize()
+ EdkLogger.SetLevel(EdkLogger.DEBUG_0)
+ a = UniFileClassObject([PathClass("C:\\Edk\\Strings.uni"), PathClass("C:\\Edk\\Strings2.uni")])
+ a.ReToken()
+ a.ShowMe()
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py b/roms/edk2/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py
new file mode 100644
index 000000000..ad8c9b598
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py
@@ -0,0 +1,280 @@
+# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+#
+# This file is used to collect the Variable checking information
+#
+
+# #
+# Import Modules
+#
+import os
+from Common.RangeExpression import RangeExpression
+from Common.Misc import *
+from io import BytesIO
+from struct import pack
+from Common.DataType import *
+
+class VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER(object):
+ def __init__(self):
+ self.var_check_info = []
+
+ def push_back(self, var_check_tab):
+ for tab in self.var_check_info:
+ if tab.equal(var_check_tab):
+ tab.merge(var_check_tab)
+ break
+ else:
+ self.var_check_info.append(var_check_tab)
+
+ def dump(self, dest, Phase):
+
+ if not os.path.isabs(dest):
+ return
+ if not os.path.exists(dest):
+ os.mkdir(dest)
+ BinFileName = "PcdVarCheck.bin"
+ BinFilePath = os.path.join(dest, BinFileName)
+ Buffer = bytearray()
+ index = 0
+ for var_check_tab in self.var_check_info:
+ index += 1
+ realLength = 0
+ realLength += 32
+ Name = var_check_tab.Name[1:-1]
+ NameChars = Name.split(",")
+ realLength += len(NameChars)
+ if (index < len(self.var_check_info) and realLength % 4) or (index == len(self.var_check_info) and len(var_check_tab.validtab) > 0 and realLength % 4):
+ realLength += (4 - (realLength % 4))
+ itemIndex = 0
+ for item in var_check_tab.validtab:
+ itemIndex += 1
+ realLength += 5
+ for v_data in item.data:
+ if isinstance(v_data, int):
+ realLength += item.StorageWidth
+ else:
+ realLength += item.StorageWidth
+ realLength += item.StorageWidth
+ if (index == len(self.var_check_info)) :
+ if (itemIndex < len(var_check_tab.validtab)) and realLength % 4:
+ realLength += (4 - (realLength % 4))
+ else:
+ if realLength % 4:
+ realLength += (4 - (realLength % 4))
+ var_check_tab.Length = realLength
+ realLength = 0
+ index = 0
+ for var_check_tab in self.var_check_info:
+ index += 1
+
+ b = pack("=H", var_check_tab.Revision)
+ Buffer += b
+ realLength += 2
+
+ b = pack("=H", var_check_tab.HeaderLength)
+ Buffer += b
+ realLength += 2
+
+ b = pack("=L", var_check_tab.Length)
+ Buffer += b
+ realLength += 4
+
+ b = pack("=B", var_check_tab.Type)
+ Buffer += b
+ realLength += 1
+
+ for i in range(0, 3):
+ b = pack("=B", var_check_tab.Reserved)
+ Buffer += b
+ realLength += 1
+
+ b = pack("=L", var_check_tab.Attributes)
+ Buffer += b
+ realLength += 4
+
+ Guid = var_check_tab.Guid
+ b = PackByteFormatGUID(Guid)
+ Buffer += b
+ realLength += 16
+
+ Name = var_check_tab.Name[1:-1]
+ NameChars = Name.split(",")
+ for NameChar in NameChars:
+ NameCharNum = int(NameChar, 16)
+ b = pack("=B", NameCharNum)
+ Buffer += b
+ realLength += 1
+
+ if (index < len(self.var_check_info) and realLength % 4) or (index == len(self.var_check_info) and len(var_check_tab.validtab) > 0 and realLength % 4):
+ for i in range(4 - (realLength % 4)):
+ b = pack("=B", var_check_tab.pad)
+ Buffer += b
+ realLength += 1
+ itemIndex = 0
+ for item in var_check_tab.validtab:
+ itemIndex += 1
+
+ b = pack("=B", item.Type)
+ Buffer += b
+ realLength += 1
+
+ b = pack("=B", item.Length)
+ Buffer += b
+ realLength += 1
+
+ b = pack("=H", int(item.VarOffset, 16))
+ Buffer += b
+ realLength += 2
+
+ b = pack("=B", item.StorageWidth)
+ Buffer += b
+ realLength += 1
+ for v_data in item.data:
+ if isinstance(v_data, int):
+ b = pack(PACK_CODE_BY_SIZE[item.StorageWidth], v_data)
+ Buffer += b
+ realLength += item.StorageWidth
+ else:
+ b = pack(PACK_CODE_BY_SIZE[item.StorageWidth], v_data[0])
+ Buffer += b
+ realLength += item.StorageWidth
+ b = pack(PACK_CODE_BY_SIZE[item.StorageWidth], v_data[1])
+ Buffer += b
+ realLength += item.StorageWidth
+
+ if (index == len(self.var_check_info)) :
+ if (itemIndex < len(var_check_tab.validtab)) and realLength % 4:
+ for i in range(4 - (realLength % 4)):
+ b = pack("=B", var_check_tab.pad)
+ Buffer += b
+ realLength += 1
+ else:
+ if realLength % 4:
+ for i in range(4 - (realLength % 4)):
+ b = pack("=B", var_check_tab.pad)
+ Buffer += b
+ realLength += 1
+
+ DbFile = BytesIO()
+ if Phase == 'DXE' and os.path.exists(BinFilePath):
+ BinFile = open(BinFilePath, "rb")
+ BinBuffer = BinFile.read()
+ BinFile.close()
+ BinBufferSize = len(BinBuffer)
+ if (BinBufferSize % 4):
+ for i in range(4 - (BinBufferSize % 4)):
+ b = pack("=B", VAR_CHECK_PCD_VARIABLE_TAB.pad)
+ BinBuffer += b
+ Buffer = BinBuffer + Buffer
+ DbFile.write(Buffer)
+ SaveFileOnChange(BinFilePath, DbFile.getvalue(), True)
+
+
+class VAR_CHECK_PCD_VARIABLE_TAB(object):
+ pad = 0xDA
+ def __init__(self, TokenSpaceGuid, PcdCName):
+ self.Revision = 0x0001
+ self.HeaderLength = 0
+ self.Length = 0 # Length include this header
+ self.Type = 0
+ self.Reserved = 0
+ self.Attributes = 0x00000000
+ self.Guid = eval("[" + TokenSpaceGuid.replace("{", "").replace("}", "") + "]")
+ self.Name = PcdCName
+ self.validtab = []
+
+ def UpdateSize(self):
+ self.HeaderLength = 32 + len(self.Name.split(","))
+ self.Length = 32 + len(self.Name.split(",")) + self.GetValidTabLen()
+
+ def GetValidTabLen(self):
+ validtablen = 0
+ for item in self.validtab:
+ validtablen += item.Length
+ return validtablen
+
+ def SetAttributes(self, attributes):
+ self.Attributes = attributes
+
+ def push_back(self, valid_obj):
+ if valid_obj is not None:
+ self.validtab.append(valid_obj)
+
+ def equal(self, varchecktab):
+ if self.Guid == varchecktab.Guid and self.Name == varchecktab.Name:
+ return True
+ else:
+ return False
+
+ def merge(self, varchecktab):
+ for validobj in varchecktab.validtab:
+ if validobj in self.validtab:
+ continue
+ self.validtab.append(validobj)
+ self.UpdateSize()
+
+
+class VAR_CHECK_PCD_VALID_OBJ(object):
+ def __init__(self, VarOffset, data, PcdDataType):
+ self.Type = 1
+ self.Length = 0 # Length include this header
+ self.VarOffset = VarOffset
+ self.PcdDataType = PcdDataType.strip()
+ self.rawdata = data
+ self.data = set()
+ try:
+ self.StorageWidth = MAX_SIZE_TYPE[self.PcdDataType]
+ self.ValidData = True
+ except:
+ self.StorageWidth = 0
+ self.ValidData = False
+
+ def __eq__(self, validObj):
+ return validObj and self.VarOffset == validObj.VarOffset
+
+class VAR_CHECK_PCD_VALID_LIST(VAR_CHECK_PCD_VALID_OBJ):
+ def __init__(self, VarOffset, validlist, PcdDataType):
+ super(VAR_CHECK_PCD_VALID_LIST, self).__init__(VarOffset, validlist, PcdDataType)
+ self.Type = 1
+ valid_num_list = []
+ for item in self.rawdata:
+ valid_num_list.extend(item.split(','))
+
+ for valid_num in valid_num_list:
+ valid_num = valid_num.strip()
+
+ if valid_num.startswith('0x') or valid_num.startswith('0X'):
+ self.data.add(int(valid_num, 16))
+ else:
+ self.data.add(int(valid_num))
+
+
+ self.Length = 5 + len(self.data) * self.StorageWidth
+
+
+class VAR_CHECK_PCD_VALID_RANGE(VAR_CHECK_PCD_VALID_OBJ):
+ def __init__(self, VarOffset, validrange, PcdDataType):
+ super(VAR_CHECK_PCD_VALID_RANGE, self).__init__(VarOffset, validrange, PcdDataType)
+ self.Type = 2
+ RangeExpr = ""
+ i = 0
+ for item in self.rawdata:
+ if i == 0:
+ RangeExpr = "( " + item + " )"
+ else:
+ RangeExpr = RangeExpr + "OR ( " + item + " )"
+ range_result = RangeExpression(RangeExpr, self.PcdDataType)(True)
+ for rangelist in range_result:
+ for obj in rangelist.pop():
+ self.data.add((obj.start, obj.end))
+ self.Length = 5 + len(self.data) * 2 * self.StorageWidth
+
+
+def GetValidationObject(PcdClass, VarOffset):
+ if PcdClass.validateranges:
+ return VAR_CHECK_PCD_VALID_RANGE(VarOffset, PcdClass.validateranges, PcdClass.DatumType)
+ if PcdClass.validlists:
+ return VAR_CHECK_PCD_VALID_LIST(VarOffset, PcdClass.validlists, PcdClass.DatumType)
+ else:
+ return None
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py b/roms/edk2/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py
new file mode 100644
index 000000000..f86c749c0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py
@@ -0,0 +1,971 @@
+## @file
+# Create makefile for MS nmake and GNU make
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+## Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+import os.path as path
+import hashlib
+from collections import defaultdict
+from GenFds.FdfParser import FdfParser
+from Workspace.WorkspaceCommon import GetModuleLibInstances
+from AutoGen import GenMake
+from AutoGen.AutoGen import AutoGen
+from AutoGen.PlatformAutoGen import PlatformAutoGen
+from AutoGen.BuildEngine import gDefaultBuildRuleFile
+from Common.ToolDefClassObject import gDefaultToolsDefFile
+from Common.StringUtils import NormPath
+from Common.BuildToolError import *
+from Common.DataType import *
+from Common.Misc import *
+import json
+
+## Regular expression for splitting Dependency Expression string into tokens
+gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)")
+
+## Regular expression for match: PCD(xxxx.yyy)
+gPCDAsGuidPattern = re.compile(r"^PCD\(.+\..+\)$")
+
+## Workspace AutoGen class
+#
+# This class is used mainly to control the whole platform build for different
+# architecture. This class will generate top level makefile.
+#
+class WorkspaceAutoGen(AutoGen):
+ # call super().__init__ then call the worker function with different parameter count
+ def __init__(self, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs):
+ if not hasattr(self, "_Init"):
+ self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
+ self._Init = True
+
+ ## Initialize WorkspaceAutoGen
+ #
+ # @param WorkspaceDir Root directory of workspace
+ # @param ActivePlatform Meta-file of active platform
+ # @param Target Build target
+ # @param Toolchain Tool chain name
+ # @param ArchList List of architecture of current build
+ # @param MetaFileDb Database containing meta-files
+ # @param BuildConfig Configuration of build
+ # @param ToolDefinition Tool chain definitions
+ # @param FlashDefinitionFile File of flash definition
+ # @param Fds FD list to be generated
+ # @param Fvs FV list to be generated
+ # @param Caps Capsule list to be generated
+ # @param SkuId SKU id from command line
+ #
+ def _InitWorker(self, WorkspaceDir, ActivePlatform, Target, Toolchain, ArchList, MetaFileDb,
+ BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=None, Fvs=None, Caps=None, SkuId='', UniFlag=None,
+ Progress=None, BuildModule=None):
+ self.BuildDatabase = MetaFileDb
+ self.MetaFile = ActivePlatform
+ self.WorkspaceDir = WorkspaceDir
+ self.Platform = self.BuildDatabase[self.MetaFile, TAB_ARCH_COMMON, Target, Toolchain]
+ GlobalData.gActivePlatform = self.Platform
+ self.BuildTarget = Target
+ self.ToolChain = Toolchain
+ self.ArchList = ArchList
+ self.SkuId = SkuId
+ self.UniFlag = UniFlag
+
+ self.TargetTxt = BuildConfig
+ self.ToolDef = ToolDefinition
+ self.FdfFile = FlashDefinitionFile
+ self.FdTargetList = Fds if Fds else []
+ self.FvTargetList = Fvs if Fvs else []
+ self.CapTargetList = Caps if Caps else []
+ self.AutoGenObjectList = []
+ self._GuidDict = {}
+
+ # there's many relative directory operations, so ...
+ os.chdir(self.WorkspaceDir)
+
+ self.MergeArch()
+ self.ValidateBuildTarget()
+
+ EdkLogger.info("")
+ if self.ArchList:
+ EdkLogger.info('%-16s = %s' % ("Architecture(s)", ' '.join(self.ArchList)))
+ EdkLogger.info('%-16s = %s' % ("Build target", self.BuildTarget))
+ EdkLogger.info('%-16s = %s' % ("Toolchain", self.ToolChain))
+
+ EdkLogger.info('\n%-24s = %s' % ("Active Platform", self.Platform))
+ if BuildModule:
+ EdkLogger.info('%-24s = %s' % ("Active Module", BuildModule))
+
+ if self.FdfFile:
+ EdkLogger.info('%-24s = %s' % ("Flash Image Definition", self.FdfFile))
+
+ EdkLogger.verbose("\nFLASH_DEFINITION = %s" % self.FdfFile)
+
+ if Progress:
+ Progress.Start("\nProcessing meta-data")
+ #
+ # Mark now build in AutoGen Phase
+ #
+ #
+ # Collect Platform Guids to support Guid name in Fdfparser.
+ #
+ self.CollectPlatformGuids()
+ GlobalData.gAutoGenPhase = True
+ self.ProcessModuleFromPdf()
+ self.ProcessPcdType()
+ self.ProcessMixedPcd()
+ self.VerifyPcdsFromFDF()
+ self.CollectAllPcds()
+ for Pa in self.AutoGenObjectList:
+ Pa.FillData_LibConstPcd()
+ self.GeneratePkgLevelHash()
+ #
+ # Check PCDs token value conflict in each DEC file.
+ #
+ self._CheckAllPcdsTokenValueConflict()
+ #
+ # Check PCD type and definition between DSC and DEC
+ #
+ self._CheckPcdDefineAndType()
+
+ self.CreateBuildOptionsFile()
+ self.CreatePcdTokenNumberFile()
+ self.GeneratePlatformLevelHash()
+
+ #
+ # Merge Arch
+ #
+ def MergeArch(self):
+ if not self.ArchList:
+ ArchList = set(self.Platform.SupArchList)
+ else:
+ ArchList = set(self.ArchList) & set(self.Platform.SupArchList)
+ if not ArchList:
+ EdkLogger.error("build", PARAMETER_INVALID,
+ ExtraData = "Invalid ARCH specified. [Valid ARCH: %s]" % (" ".join(self.Platform.SupArchList)))
+ elif self.ArchList and len(ArchList) != len(self.ArchList):
+ SkippedArchList = set(self.ArchList).symmetric_difference(set(self.Platform.SupArchList))
+ EdkLogger.verbose("\nArch [%s] is ignored because the platform supports [%s] only!"
+ % (" ".join(SkippedArchList), " ".join(self.Platform.SupArchList)))
+ self.ArchList = tuple(ArchList)
+
+ # Validate build target
+ def ValidateBuildTarget(self):
+ if self.BuildTarget not in self.Platform.BuildTargets:
+ EdkLogger.error("build", PARAMETER_INVALID,
+ ExtraData="Build target [%s] is not supported by the platform. [Valid target: %s]"
+ % (self.BuildTarget, " ".join(self.Platform.BuildTargets)))
+
+ def CollectPlatformGuids(self):
+ oriInfList = []
+ oriPkgSet = set()
+ PlatformPkg = set()
+ for Arch in self.ArchList:
+ Platform = self.BuildDatabase[self.MetaFile, Arch, self.BuildTarget, self.ToolChain]
+ oriInfList = Platform.Modules
+ for ModuleFile in oriInfList:
+ ModuleData = self.BuildDatabase[ModuleFile, Platform._Arch, Platform._Target, Platform._Toolchain]
+ oriPkgSet.update(ModuleData.Packages)
+ for Pkg in oriPkgSet:
+ Guids = Pkg.Guids
+ GlobalData.gGuidDict.update(Guids)
+ if Platform.Packages:
+ PlatformPkg.update(Platform.Packages)
+ for Pkg in PlatformPkg:
+ Guids = Pkg.Guids
+ GlobalData.gGuidDict.update(Guids)
+
+ @cached_property
+ def FdfProfile(self):
+ if not self.FdfFile:
+ self.FdfFile = self.Platform.FlashDefinition
+
+ FdfProfile = None
+ if self.FdfFile:
+ Fdf = FdfParser(self.FdfFile.Path)
+ Fdf.ParseFile()
+ GlobalData.gFdfParser = Fdf
+ if Fdf.CurrentFdName and Fdf.CurrentFdName in Fdf.Profile.FdDict:
+ FdDict = Fdf.Profile.FdDict[Fdf.CurrentFdName]
+ for FdRegion in FdDict.RegionList:
+ if str(FdRegion.RegionType) == 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):
+ if int(FdRegion.Offset) % 8 != 0:
+ EdkLogger.error("build", FORMAT_INVALID, 'The VPD Base Address %s must be 8-byte aligned.' % (FdRegion.Offset))
+ FdfProfile = Fdf.Profile
+ else:
+ if self.FdTargetList:
+ EdkLogger.info("No flash definition file found. FD [%s] will be ignored." % " ".join(self.FdTargetList))
+ self.FdTargetList = []
+ if self.FvTargetList:
+ EdkLogger.info("No flash definition file found. FV [%s] will be ignored." % " ".join(self.FvTargetList))
+ self.FvTargetList = []
+ if self.CapTargetList:
+ EdkLogger.info("No flash definition file found. Capsule [%s] will be ignored." % " ".join(self.CapTargetList))
+ self.CapTargetList = []
+
+ return FdfProfile
+
+ def ProcessModuleFromPdf(self):
+
+ if self.FdfProfile:
+ for fvname in self.FvTargetList:
+ if fvname.upper() not in self.FdfProfile.FvDict:
+ EdkLogger.error("build", OPTION_VALUE_INVALID,
+ "No such an FV in FDF file: %s" % fvname)
+
+ # In DSC file may use FILE_GUID to override the module, then in the Platform.Modules use FILE_GUIDmodule.inf as key,
+ # but the path (self.MetaFile.Path) is the real path
+ for key in self.FdfProfile.InfDict:
+ if key == 'ArchTBD':
+ MetaFile_cache = defaultdict(set)
+ for Arch in self.ArchList:
+ Current_Platform_cache = self.BuildDatabase[self.MetaFile, Arch, self.BuildTarget, self.ToolChain]
+ for Pkey in Current_Platform_cache.Modules:
+ MetaFile_cache[Arch].add(Current_Platform_cache.Modules[Pkey].MetaFile)
+ for Inf in self.FdfProfile.InfDict[key]:
+ ModuleFile = PathClass(NormPath(Inf), GlobalData.gWorkspace, Arch)
+ for Arch in self.ArchList:
+ if ModuleFile in MetaFile_cache[Arch]:
+ break
+ else:
+ ModuleData = self.BuildDatabase[ModuleFile, Arch, self.BuildTarget, self.ToolChain]
+ if not ModuleData.IsBinaryModule:
+ EdkLogger.error('build', PARSER_ERROR, "Module %s NOT found in DSC file; Is it really a binary module?" % ModuleFile)
+
+ else:
+ for Arch in self.ArchList:
+ if Arch == key:
+ Platform = self.BuildDatabase[self.MetaFile, Arch, self.BuildTarget, self.ToolChain]
+ MetaFileList = set()
+ for Pkey in Platform.Modules:
+ MetaFileList.add(Platform.Modules[Pkey].MetaFile)
+ for Inf in self.FdfProfile.InfDict[key]:
+ ModuleFile = PathClass(NormPath(Inf), GlobalData.gWorkspace, Arch)
+ if ModuleFile in MetaFileList:
+ continue
+ ModuleData = self.BuildDatabase[ModuleFile, Arch, self.BuildTarget, self.ToolChain]
+ if not ModuleData.IsBinaryModule:
+ EdkLogger.error('build', PARSER_ERROR, "Module %s NOT found in DSC file; Is it really a binary module?" % ModuleFile)
+
+
+
+ # parse FDF file to get PCDs in it, if any
+ def VerifyPcdsFromFDF(self):
+
+ if self.FdfProfile:
+ PcdSet = self.FdfProfile.PcdDict
+ self.VerifyPcdDeclearation(PcdSet)
+
+ def ProcessPcdType(self):
+ for Arch in self.ArchList:
+ Platform = self.BuildDatabase[self.MetaFile, Arch, self.BuildTarget, self.ToolChain]
+ Platform.Pcds
+ # generate the SourcePcdDict and BinaryPcdDict
+ Libs = []
+ for BuildData in list(self.BuildDatabase._CACHE_.values()):
+ if BuildData.Arch != Arch:
+ continue
+ if BuildData.MetaFile.Ext == '.inf' and str(BuildData) in Platform.Modules :
+ Libs.extend(GetModuleLibInstances(BuildData, Platform,
+ self.BuildDatabase,
+ Arch,
+ self.BuildTarget,
+ self.ToolChain,
+ self.Platform.MetaFile,
+ EdkLogger
+ ))
+ for BuildData in list(self.BuildDatabase._CACHE_.values()):
+ if BuildData.Arch != Arch:
+ continue
+ if BuildData.MetaFile.Ext == '.inf':
+ for key in BuildData.Pcds:
+ if BuildData.Pcds[key].Pending:
+ if key in Platform.Pcds:
+ PcdInPlatform = Platform.Pcds[key]
+ if PcdInPlatform.Type:
+ BuildData.Pcds[key].Type = PcdInPlatform.Type
+ BuildData.Pcds[key].Pending = False
+
+ if BuildData.MetaFile in Platform.Modules:
+ PlatformModule = Platform.Modules[str(BuildData.MetaFile)]
+ if key in PlatformModule.Pcds:
+ PcdInPlatform = PlatformModule.Pcds[key]
+ if PcdInPlatform.Type:
+ BuildData.Pcds[key].Type = PcdInPlatform.Type
+ BuildData.Pcds[key].Pending = False
+ else:
+ #Pcd used in Library, Pcd Type from reference module if Pcd Type is Pending
+ if BuildData.Pcds[key].Pending:
+ if bool(BuildData.LibraryClass):
+ if BuildData in set(Libs):
+ ReferenceModules = BuildData.ReferenceModules
+ for ReferenceModule in ReferenceModules:
+ if ReferenceModule.MetaFile in Platform.Modules:
+ RefPlatformModule = Platform.Modules[str(ReferenceModule.MetaFile)]
+ if key in RefPlatformModule.Pcds:
+ PcdInReferenceModule = RefPlatformModule.Pcds[key]
+ if PcdInReferenceModule.Type:
+ BuildData.Pcds[key].Type = PcdInReferenceModule.Type
+ BuildData.Pcds[key].Pending = False
+ break
+
+ def ProcessMixedPcd(self):
+ for Arch in self.ArchList:
+ SourcePcdDict = {TAB_PCDS_DYNAMIC_EX:set(), TAB_PCDS_PATCHABLE_IN_MODULE:set(),TAB_PCDS_DYNAMIC:set(),TAB_PCDS_FIXED_AT_BUILD:set()}
+ BinaryPcdDict = {TAB_PCDS_DYNAMIC_EX:set(), TAB_PCDS_PATCHABLE_IN_MODULE:set()}
+ SourcePcdDict_Keys = SourcePcdDict.keys()
+ BinaryPcdDict_Keys = BinaryPcdDict.keys()
+
+ # generate the SourcePcdDict and BinaryPcdDict
+
+ for BuildData in list(self.BuildDatabase._CACHE_.values()):
+ if BuildData.Arch != Arch:
+ continue
+ if BuildData.MetaFile.Ext == '.inf':
+ for key in BuildData.Pcds:
+ if TAB_PCDS_DYNAMIC_EX in BuildData.Pcds[key].Type:
+ if BuildData.IsBinaryModule:
+ BinaryPcdDict[TAB_PCDS_DYNAMIC_EX].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
+ else:
+ SourcePcdDict[TAB_PCDS_DYNAMIC_EX].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
+
+ elif TAB_PCDS_PATCHABLE_IN_MODULE in BuildData.Pcds[key].Type:
+ if BuildData.MetaFile.Ext == '.inf':
+ if BuildData.IsBinaryModule:
+ BinaryPcdDict[TAB_PCDS_PATCHABLE_IN_MODULE].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
+ else:
+ SourcePcdDict[TAB_PCDS_PATCHABLE_IN_MODULE].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
+
+ elif TAB_PCDS_DYNAMIC in BuildData.Pcds[key].Type:
+ SourcePcdDict[TAB_PCDS_DYNAMIC].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
+ elif TAB_PCDS_FIXED_AT_BUILD in BuildData.Pcds[key].Type:
+ SourcePcdDict[TAB_PCDS_FIXED_AT_BUILD].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
+
+ #
+ # A PCD can only use one type for all source modules
+ #
+ for i in SourcePcdDict_Keys:
+ for j in SourcePcdDict_Keys:
+ if i != j:
+ Intersections = SourcePcdDict[i].intersection(SourcePcdDict[j])
+ if len(Intersections) > 0:
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "Building modules from source INFs, following PCD use %s and %s access method. It must be corrected to use only one access method." % (i, j),
+ ExtraData='\n\t'.join(str(P[1]+'.'+P[0]) for P in Intersections)
+ )
+
+ #
+ # intersection the BinaryPCD for Mixed PCD
+ #
+ for i in BinaryPcdDict_Keys:
+ for j in BinaryPcdDict_Keys:
+ if i != j:
+ Intersections = BinaryPcdDict[i].intersection(BinaryPcdDict[j])
+ for item in Intersections:
+ NewPcd1 = (item[0] + '_' + i, item[1])
+ NewPcd2 = (item[0] + '_' + j, item[1])
+ if item not in GlobalData.MixedPcd:
+ GlobalData.MixedPcd[item] = [NewPcd1, NewPcd2]
+ else:
+ if NewPcd1 not in GlobalData.MixedPcd[item]:
+ GlobalData.MixedPcd[item].append(NewPcd1)
+ if NewPcd2 not in GlobalData.MixedPcd[item]:
+ GlobalData.MixedPcd[item].append(NewPcd2)
+
+ #
+ # intersection the SourcePCD and BinaryPCD for Mixed PCD
+ #
+ for i in SourcePcdDict_Keys:
+ for j in BinaryPcdDict_Keys:
+ if i != j:
+ Intersections = SourcePcdDict[i].intersection(BinaryPcdDict[j])
+ for item in Intersections:
+ NewPcd1 = (item[0] + '_' + i, item[1])
+ NewPcd2 = (item[0] + '_' + j, item[1])
+ if item not in GlobalData.MixedPcd:
+ GlobalData.MixedPcd[item] = [NewPcd1, NewPcd2]
+ else:
+ if NewPcd1 not in GlobalData.MixedPcd[item]:
+ GlobalData.MixedPcd[item].append(NewPcd1)
+ if NewPcd2 not in GlobalData.MixedPcd[item]:
+ GlobalData.MixedPcd[item].append(NewPcd2)
+
+ BuildData = self.BuildDatabase[self.MetaFile, Arch, self.BuildTarget, self.ToolChain]
+ for key in BuildData.Pcds:
+ for SinglePcd in GlobalData.MixedPcd:
+ if (BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName) == SinglePcd:
+ for item in GlobalData.MixedPcd[SinglePcd]:
+ Pcd_Type = item[0].split('_')[-1]
+ if (Pcd_Type == BuildData.Pcds[key].Type) or (Pcd_Type == TAB_PCDS_DYNAMIC_EX and BuildData.Pcds[key].Type in PCD_DYNAMIC_EX_TYPE_SET) or \
+ (Pcd_Type == TAB_PCDS_DYNAMIC and BuildData.Pcds[key].Type in PCD_DYNAMIC_TYPE_SET):
+ Value = BuildData.Pcds[key]
+ Value.TokenCName = BuildData.Pcds[key].TokenCName + '_' + Pcd_Type
+ if len(key) == 2:
+ newkey = (Value.TokenCName, key[1])
+ elif len(key) == 3:
+ newkey = (Value.TokenCName, key[1], key[2])
+ del BuildData.Pcds[key]
+ BuildData.Pcds[newkey] = Value
+ break
+ break
+
+ if self.FdfProfile:
+ PcdSet = self.FdfProfile.PcdDict
+ # handle the mixed pcd in FDF file
+ for key in PcdSet:
+ if key in GlobalData.MixedPcd:
+ Value = PcdSet[key]
+ del PcdSet[key]
+ for item in GlobalData.MixedPcd[key]:
+ PcdSet[item] = Value
+
+ #Collect package set information from INF of FDF
+ @cached_property
+ def PkgSet(self):
+ if not self.FdfFile:
+ self.FdfFile = self.Platform.FlashDefinition
+
+ if self.FdfFile:
+ ModuleList = self.FdfProfile.InfList
+ else:
+ ModuleList = []
+ Pkgs = {}
+ for Arch in self.ArchList:
+ Platform = self.BuildDatabase[self.MetaFile, Arch, self.BuildTarget, self.ToolChain]
+ PkgSet = set()
+ for mb in [self.BuildDatabase[m, Arch, self.BuildTarget, self.ToolChain] for m in Platform.Modules]:
+ PkgSet.update(mb.Packages)
+ for Inf in ModuleList:
+ ModuleFile = PathClass(NormPath(Inf), GlobalData.gWorkspace, Arch)
+ if ModuleFile in Platform.Modules:
+ continue
+ ModuleData = self.BuildDatabase[ModuleFile, Arch, self.BuildTarget, self.ToolChain]
+ PkgSet.update(ModuleData.Packages)
+ PkgSet.update(Platform.Packages)
+ Pkgs[Arch] = list(PkgSet)
+ return Pkgs
+
+ def VerifyPcdDeclearation(self,PcdSet):
+ for Arch in self.ArchList:
+ Platform = self.BuildDatabase[self.MetaFile, Arch, self.BuildTarget, self.ToolChain]
+ Pkgs = self.PkgSet[Arch]
+ DecPcds = set()
+ DecPcdsKey = set()
+ for Pkg in Pkgs:
+ for Pcd in Pkg.Pcds:
+ DecPcds.add((Pcd[0], Pcd[1]))
+ DecPcdsKey.add((Pcd[0], Pcd[1], Pcd[2]))
+
+ Platform.SkuName = self.SkuId
+ for Name, Guid,Fileds in PcdSet:
+ if (Name, Guid) not in DecPcds:
+ EdkLogger.error(
+ 'build',
+ PARSER_ERROR,
+ "PCD (%s.%s) used in FDF is not declared in DEC files." % (Guid, Name),
+ File = self.FdfProfile.PcdFileLineDict[Name, Guid, Fileds][0],
+ Line = self.FdfProfile.PcdFileLineDict[Name, Guid, Fileds][1]
+ )
+ else:
+ # Check whether Dynamic or DynamicEx PCD used in FDF file. If used, build break and give a error message.
+ if (Name, Guid, TAB_PCDS_FIXED_AT_BUILD) in DecPcdsKey \
+ or (Name, Guid, TAB_PCDS_PATCHABLE_IN_MODULE) in DecPcdsKey \
+ or (Name, Guid, TAB_PCDS_FEATURE_FLAG) in DecPcdsKey:
+ continue
+ elif (Name, Guid, TAB_PCDS_DYNAMIC) in DecPcdsKey or (Name, Guid, TAB_PCDS_DYNAMIC_EX) in DecPcdsKey:
+ EdkLogger.error(
+ 'build',
+ PARSER_ERROR,
+ "Using Dynamic or DynamicEx type of PCD [%s.%s] in FDF file is not allowed." % (Guid, Name),
+ File = self.FdfProfile.PcdFileLineDict[Name, Guid, Fileds][0],
+ Line = self.FdfProfile.PcdFileLineDict[Name, Guid, Fileds][1]
+ )
+ def CollectAllPcds(self):
+
+ for Arch in self.ArchList:
+ Pa = PlatformAutoGen(self, self.MetaFile, self.BuildTarget, self.ToolChain, Arch)
+ #
+ # Explicitly collect platform's dynamic PCDs
+ #
+ Pa.CollectPlatformDynamicPcds()
+ Pa.CollectFixedAtBuildPcds()
+ self.AutoGenObjectList.append(Pa)
+ # We need to calculate the PcdTokenNumber after all Arch Pcds are collected.
+ for Arch in self.ArchList:
+ #Pcd TokenNumber
+ Pa = PlatformAutoGen(self, self.MetaFile, self.BuildTarget, self.ToolChain, Arch)
+ self.UpdateModuleDataPipe(Arch, {"PCD_TNUM":Pa.PcdTokenNumber})
+
+ def UpdateModuleDataPipe(self,arch, attr_dict):
+ for (Target, Toolchain, Arch, MetaFile) in AutoGen.Cache():
+ if Arch != arch:
+ continue
+ try:
+ AutoGen.Cache()[(Target, Toolchain, Arch, MetaFile)].DataPipe.DataContainer = attr_dict
+ except Exception:
+ pass
+ #
+ # Generate Package level hash value
+ #
+ def GeneratePkgLevelHash(self):
+ for Arch in self.ArchList:
+ GlobalData.gPackageHash = {}
+ if GlobalData.gUseHashCache:
+ for Pkg in self.PkgSet[Arch]:
+ self._GenPkgLevelHash(Pkg)
+
+
+ def CreateBuildOptionsFile(self):
+ #
+ # Create BuildOptions Macro & PCD metafile, also add the Active Platform and FDF file.
+ #
+ content = 'gCommandLineDefines: '
+ content += str(GlobalData.gCommandLineDefines)
+ content += TAB_LINE_BREAK
+ content += 'BuildOptionPcd: '
+ content += str(GlobalData.BuildOptionPcd)
+ content += TAB_LINE_BREAK
+ content += 'Active Platform: '
+ content += str(self.Platform)
+ content += TAB_LINE_BREAK
+ if self.FdfFile:
+ content += 'Flash Image Definition: '
+ content += str(self.FdfFile)
+ content += TAB_LINE_BREAK
+ SaveFileOnChange(os.path.join(self.BuildDir, 'BuildOptions'), content, False)
+
+ def CreatePcdTokenNumberFile(self):
+ #
+ # Create PcdToken Number file for Dynamic/DynamicEx Pcd.
+ #
+ PcdTokenNumber = 'PcdTokenNumber: '
+ Pa = self.AutoGenObjectList[0]
+ if Pa.PcdTokenNumber:
+ if Pa.DynamicPcdList:
+ for Pcd in Pa.DynamicPcdList:
+ PcdTokenNumber += TAB_LINE_BREAK
+ PcdTokenNumber += str((Pcd.TokenCName, Pcd.TokenSpaceGuidCName))
+ PcdTokenNumber += ' : '
+ PcdTokenNumber += str(Pa.PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName])
+ SaveFileOnChange(os.path.join(self.BuildDir, 'PcdTokenNumber'), PcdTokenNumber, False)
+
+ def GeneratePlatformLevelHash(self):
+ #
+ # Get set of workspace metafiles
+ #
+ AllWorkSpaceMetaFiles = self._GetMetaFiles(self.BuildTarget, self.ToolChain)
+ AllWorkSpaceMetaFileList = sorted(AllWorkSpaceMetaFiles, key=lambda x: str(x))
+ #
+ # Retrieve latest modified time of all metafiles
+ #
+ SrcTimeStamp = 0
+ for f in AllWorkSpaceMetaFiles:
+ if os.stat(f)[8] > SrcTimeStamp:
+ SrcTimeStamp = os.stat(f)[8]
+ self._SrcTimeStamp = SrcTimeStamp
+
+ if GlobalData.gUseHashCache:
+ FileList = []
+ m = hashlib.md5()
+ for file in AllWorkSpaceMetaFileList:
+ if file.endswith('.dec'):
+ continue
+ f = open(file, 'rb')
+ Content = f.read()
+ f.close()
+ m.update(Content)
+ FileList.append((str(file), hashlib.md5(Content).hexdigest()))
+
+ HashDir = path.join(self.BuildDir, "Hash_Platform")
+ HashFile = path.join(HashDir, 'Platform.hash.' + m.hexdigest())
+ SaveFileOnChange(HashFile, m.hexdigest(), False)
+ HashChainFile = path.join(HashDir, 'Platform.hashchain.' + m.hexdigest())
+ GlobalData.gPlatformHashFile = HashChainFile
+ try:
+ with open(HashChainFile, 'w') as f:
+ json.dump(FileList, f, indent=2)
+ except:
+ EdkLogger.quiet("[cache warning]: fail to save hashchain file:%s" % HashChainFile)
+
+ if GlobalData.gBinCacheDest:
+ # Copy platform hash files to cache destination
+ FileDir = path.join(GlobalData.gBinCacheDest, self.OutputDir, self.BuildTarget + "_" + self.ToolChain, "Hash_Platform")
+ CacheFileDir = FileDir
+ CreateDirectory(CacheFileDir)
+ CopyFileOnChange(HashFile, CacheFileDir)
+ CopyFileOnChange(HashChainFile, CacheFileDir)
+
+ #
+ # Write metafile list to build directory
+ #
+ AutoGenFilePath = os.path.join(self.BuildDir, 'AutoGen')
+ if os.path.exists (AutoGenFilePath):
+ os.remove(AutoGenFilePath)
+ if not os.path.exists(self.BuildDir):
+ os.makedirs(self.BuildDir)
+ with open(os.path.join(self.BuildDir, 'AutoGen'), 'w+') as file:
+ for f in AllWorkSpaceMetaFileList:
+ print(f, file=file)
+ return True
+
+ def _GenPkgLevelHash(self, Pkg):
+ if Pkg.PackageName in GlobalData.gPackageHash:
+ return
+
+ PkgDir = os.path.join(self.BuildDir, Pkg.Arch, "Hash_Pkg", Pkg.PackageName)
+ CreateDirectory(PkgDir)
+ FileList = []
+ m = hashlib.md5()
+ # Get .dec file's hash value
+ f = open(Pkg.MetaFile.Path, 'rb')
+ Content = f.read()
+ f.close()
+ m.update(Content)
+ FileList.append((str(Pkg.MetaFile.Path), hashlib.md5(Content).hexdigest()))
+ # Get include files hash value
+ if Pkg.Includes:
+ for inc in sorted(Pkg.Includes, key=lambda x: str(x)):
+ for Root, Dirs, Files in os.walk(str(inc)):
+ for File in sorted(Files):
+ File_Path = os.path.join(Root, File)
+ f = open(File_Path, 'rb')
+ Content = f.read()
+ f.close()
+ m.update(Content)
+ FileList.append((str(File_Path), hashlib.md5(Content).hexdigest()))
+ GlobalData.gPackageHash[Pkg.PackageName] = m.hexdigest()
+
+ HashDir = PkgDir
+ HashFile = path.join(HashDir, Pkg.PackageName + '.hash.' + m.hexdigest())
+ SaveFileOnChange(HashFile, m.hexdigest(), False)
+ HashChainFile = path.join(HashDir, Pkg.PackageName + '.hashchain.' + m.hexdigest())
+ GlobalData.gPackageHashFile[(Pkg.PackageName, Pkg.Arch)] = HashChainFile
+ try:
+ with open(HashChainFile, 'w') as f:
+ json.dump(FileList, f, indent=2)
+ except:
+ EdkLogger.quiet("[cache warning]: fail to save hashchain file:%s" % HashChainFile)
+
+ if GlobalData.gBinCacheDest:
+ # Copy Pkg hash files to cache destination dir
+ FileDir = path.join(GlobalData.gBinCacheDest, self.OutputDir, self.BuildTarget + "_" + self.ToolChain, Pkg.Arch, "Hash_Pkg", Pkg.PackageName)
+ CacheFileDir = FileDir
+ CreateDirectory(CacheFileDir)
+ CopyFileOnChange(HashFile, CacheFileDir)
+ CopyFileOnChange(HashChainFile, CacheFileDir)
+
+ def _GetMetaFiles(self, Target, Toolchain):
+ AllWorkSpaceMetaFiles = set()
+ #
+ # add fdf
+ #
+ if self.FdfFile:
+ AllWorkSpaceMetaFiles.add (self.FdfFile.Path)
+ for f in GlobalData.gFdfParser.GetAllIncludedFile():
+ AllWorkSpaceMetaFiles.add (f.FileName)
+ #
+ # add dsc
+ #
+ AllWorkSpaceMetaFiles.add(self.MetaFile.Path)
+
+ #
+ # add build_rule.txt & tools_def.txt
+ #
+ AllWorkSpaceMetaFiles.add(os.path.join(GlobalData.gConfDirectory, gDefaultBuildRuleFile))
+ AllWorkSpaceMetaFiles.add(os.path.join(GlobalData.gConfDirectory, gDefaultToolsDefFile))
+
+ # add BuildOption metafile
+ #
+ AllWorkSpaceMetaFiles.add(os.path.join(self.BuildDir, 'BuildOptions'))
+
+ # add PcdToken Number file for Dynamic/DynamicEx Pcd
+ #
+ AllWorkSpaceMetaFiles.add(os.path.join(self.BuildDir, 'PcdTokenNumber'))
+
+ for Pa in self.AutoGenObjectList:
+ AllWorkSpaceMetaFiles.add(Pa.ToolDefinitionFile)
+
+ for Arch in self.ArchList:
+ #
+ # add dec
+ #
+ for Package in PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch).PackageList:
+ AllWorkSpaceMetaFiles.add(Package.MetaFile.Path)
+
+ #
+ # add included dsc
+ #
+ for filePath in self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]._RawData.IncludedFiles:
+ AllWorkSpaceMetaFiles.add(filePath.Path)
+
+ return AllWorkSpaceMetaFiles
+
+ def _CheckPcdDefineAndType(self):
+ PcdTypeSet = {TAB_PCDS_FIXED_AT_BUILD,
+ TAB_PCDS_PATCHABLE_IN_MODULE,
+ TAB_PCDS_FEATURE_FLAG,
+ TAB_PCDS_DYNAMIC,
+ TAB_PCDS_DYNAMIC_EX}
+
+ # This dict store PCDs which are not used by any modules with specified arches
+ UnusedPcd = OrderedDict()
+ for Pa in self.AutoGenObjectList:
+ # Key of DSC's Pcds dictionary is PcdCName, TokenSpaceGuid
+ for Pcd in Pa.Platform.Pcds:
+ PcdType = Pa.Platform.Pcds[Pcd].Type
+
+ # If no PCD type, this PCD comes from FDF
+ if not PcdType:
+ continue
+
+ # Try to remove Hii and Vpd suffix
+ if PcdType.startswith(TAB_PCDS_DYNAMIC_EX):
+ PcdType = TAB_PCDS_DYNAMIC_EX
+ elif PcdType.startswith(TAB_PCDS_DYNAMIC):
+ PcdType = TAB_PCDS_DYNAMIC
+
+ for Package in Pa.PackageList:
+ # Key of DEC's Pcds dictionary is PcdCName, TokenSpaceGuid, PcdType
+ if (Pcd[0], Pcd[1], PcdType) in Package.Pcds:
+ break
+ for Type in PcdTypeSet:
+ if (Pcd[0], Pcd[1], Type) in Package.Pcds:
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "Type [%s] of PCD [%s.%s] in DSC file doesn't match the type [%s] defined in DEC file." \
+ % (Pa.Platform.Pcds[Pcd].Type, Pcd[1], Pcd[0], Type),
+ ExtraData=None
+ )
+ return
+ else:
+ UnusedPcd.setdefault(Pcd, []).append(Pa.Arch)
+
+ for Pcd in UnusedPcd:
+ EdkLogger.warn(
+ 'build',
+ "The PCD was not specified by any INF module in the platform for the given architecture.\n"
+ "\tPCD: [%s.%s]\n\tPlatform: [%s]\n\tArch: %s"
+ % (Pcd[1], Pcd[0], os.path.basename(str(self.MetaFile)), str(UnusedPcd[Pcd])),
+ ExtraData=None
+ )
+
+ def __repr__(self):
+ return "%s [%s]" % (self.MetaFile, ", ".join(self.ArchList))
+
+ ## Return the directory to store FV files
+ @cached_property
+ def FvDir(self):
+ return path.join(self.BuildDir, TAB_FV_DIRECTORY)
+
+ ## Return the directory to store all intermediate and final files built
+ @cached_property
+ def BuildDir(self):
+ return self.AutoGenObjectList[0].BuildDir
+
+ ## Return the build output directory platform specifies
+ @cached_property
+ def OutputDir(self):
+ return self.Platform.OutputDirectory
+
+ ## Return platform name
+ @cached_property
+ def Name(self):
+ return self.Platform.PlatformName
+
+ ## Return meta-file GUID
+ @cached_property
+ def Guid(self):
+ return self.Platform.Guid
+
+ ## Return platform version
+ @cached_property
+ def Version(self):
+ return self.Platform.Version
+
+ ## Return paths of tools
+ @cached_property
+ def ToolDefinition(self):
+ return self.AutoGenObjectList[0].ToolDefinition
+
+ ## Return directory of platform makefile
+ #
+ # @retval string Makefile directory
+ #
+ @cached_property
+ def MakeFileDir(self):
+ return self.BuildDir
+
+ ## Return build command string
+ #
+ # @retval string Build command string
+ #
+ @cached_property
+ def BuildCommand(self):
+ # BuildCommand should be all the same. So just get one from platform AutoGen
+ return self.AutoGenObjectList[0].BuildCommand
+
+ ## Check the PCDs token value conflict in each DEC file.
+ #
+ # Will cause build break and raise error message while two PCDs conflict.
+ #
+ # @return None
+ #
+ def _CheckAllPcdsTokenValueConflict(self):
+ for Pa in self.AutoGenObjectList:
+ for Package in Pa.PackageList:
+ PcdList = list(Package.Pcds.values())
+ PcdList.sort(key=lambda x: int(x.TokenValue, 0))
+ Count = 0
+ while (Count < len(PcdList) - 1) :
+ Item = PcdList[Count]
+ ItemNext = PcdList[Count + 1]
+ #
+ # Make sure in the same token space the TokenValue should be unique
+ #
+ if (int(Item.TokenValue, 0) == int(ItemNext.TokenValue, 0)):
+ SameTokenValuePcdList = []
+ SameTokenValuePcdList.append(Item)
+ SameTokenValuePcdList.append(ItemNext)
+ RemainPcdListLength = len(PcdList) - Count - 2
+ for ValueSameCount in range(RemainPcdListLength):
+ if int(PcdList[len(PcdList) - RemainPcdListLength + ValueSameCount].TokenValue, 0) == int(Item.TokenValue, 0):
+ SameTokenValuePcdList.append(PcdList[len(PcdList) - RemainPcdListLength + ValueSameCount])
+ else:
+ break;
+ #
+ # Sort same token value PCD list with TokenGuid and TokenCName
+ #
+ SameTokenValuePcdList.sort(key=lambda x: "%s.%s" % (x.TokenSpaceGuidCName, x.TokenCName))
+ SameTokenValuePcdListCount = 0
+ while (SameTokenValuePcdListCount < len(SameTokenValuePcdList) - 1):
+ Flag = False
+ TemListItem = SameTokenValuePcdList[SameTokenValuePcdListCount]
+ TemListItemNext = SameTokenValuePcdList[SameTokenValuePcdListCount + 1]
+
+ if (TemListItem.TokenSpaceGuidCName == TemListItemNext.TokenSpaceGuidCName) and (TemListItem.TokenCName != TemListItemNext.TokenCName):
+ for PcdItem in GlobalData.MixedPcd:
+ if (TemListItem.TokenCName, TemListItem.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem] or \
+ (TemListItemNext.TokenCName, TemListItemNext.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ Flag = True
+ if not Flag:
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The TokenValue [%s] of PCD [%s.%s] is conflict with: [%s.%s] in %s"\
+ % (TemListItem.TokenValue, TemListItem.TokenSpaceGuidCName, TemListItem.TokenCName, TemListItemNext.TokenSpaceGuidCName, TemListItemNext.TokenCName, Package),
+ ExtraData=None
+ )
+ SameTokenValuePcdListCount += 1
+ Count += SameTokenValuePcdListCount
+ Count += 1
+
+ PcdList = list(Package.Pcds.values())
+ PcdList.sort(key=lambda x: "%s.%s" % (x.TokenSpaceGuidCName, x.TokenCName))
+ Count = 0
+ while (Count < len(PcdList) - 1) :
+ Item = PcdList[Count]
+ ItemNext = PcdList[Count + 1]
+ #
+ # Check PCDs with same TokenSpaceGuidCName.TokenCName have same token value as well.
+ #
+ if (Item.TokenSpaceGuidCName == ItemNext.TokenSpaceGuidCName) and (Item.TokenCName == ItemNext.TokenCName) and (int(Item.TokenValue, 0) != int(ItemNext.TokenValue, 0)):
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The TokenValue [%s] of PCD [%s.%s] in %s defined in two places should be same as well."\
+ % (Item.TokenValue, Item.TokenSpaceGuidCName, Item.TokenCName, Package),
+ ExtraData=None
+ )
+ Count += 1
+ ## Generate fds command
+ @property
+ def GenFdsCommand(self):
+ return (GenMake.TopLevelMakefile(self)._TEMPLATE_.Replace(GenMake.TopLevelMakefile(self)._TemplateDict)).strip()
+
+ @property
+ def GenFdsCommandDict(self):
+ FdsCommandDict = {}
+ LogLevel = EdkLogger.GetLevel()
+ if LogLevel == EdkLogger.VERBOSE:
+ FdsCommandDict["verbose"] = True
+ elif LogLevel <= EdkLogger.DEBUG_9:
+ FdsCommandDict["debug"] = LogLevel - 1
+ elif LogLevel == EdkLogger.QUIET:
+ FdsCommandDict["quiet"] = True
+
+ FdsCommandDict["GenfdsMultiThread"] = GlobalData.gEnableGenfdsMultiThread
+ if GlobalData.gIgnoreSource:
+ FdsCommandDict["IgnoreSources"] = True
+
+ FdsCommandDict["OptionPcd"] = []
+ for pcd in GlobalData.BuildOptionPcd:
+ if pcd[2]:
+ pcdname = '.'.join(pcd[0:3])
+ else:
+ pcdname = '.'.join(pcd[0:2])
+ if pcd[3].startswith('{'):
+ FdsCommandDict["OptionPcd"].append(pcdname + '=' + 'H' + '"' + pcd[3] + '"')
+ else:
+ FdsCommandDict["OptionPcd"].append(pcdname + '=' + pcd[3])
+
+ MacroList = []
+ # macros passed to GenFds
+ MacroDict = {}
+ MacroDict.update(GlobalData.gGlobalDefines)
+ MacroDict.update(GlobalData.gCommandLineDefines)
+ for MacroName in MacroDict:
+ if MacroDict[MacroName] != "":
+ MacroList.append('"%s=%s"' % (MacroName, MacroDict[MacroName].replace('\\', '\\\\')))
+ else:
+ MacroList.append('"%s"' % MacroName)
+ FdsCommandDict["macro"] = MacroList
+
+ FdsCommandDict["fdf_file"] = [self.FdfFile]
+ FdsCommandDict["build_target"] = self.BuildTarget
+ FdsCommandDict["toolchain_tag"] = self.ToolChain
+ FdsCommandDict["active_platform"] = str(self)
+
+ FdsCommandDict["conf_directory"] = GlobalData.gConfDirectory
+ FdsCommandDict["build_architecture_list"] = ','.join(self.ArchList)
+ FdsCommandDict["platform_build_directory"] = self.BuildDir
+
+ FdsCommandDict["fd"] = self.FdTargetList
+ FdsCommandDict["fv"] = self.FvTargetList
+ FdsCommandDict["cap"] = self.CapTargetList
+ return FdsCommandDict
+
+ ## Create makefile for the platform and modules in it
+ #
+ # @param CreateDepsMakeFile Flag indicating if the makefile for
+ # modules will be created as well
+ #
+ def CreateMakeFile(self, CreateDepsMakeFile=False):
+ if not CreateDepsMakeFile:
+ return
+ for Pa in self.AutoGenObjectList:
+ Pa.CreateMakeFile(CreateDepsMakeFile)
+
+ ## Create autogen code for platform and modules
+ #
+ # Since there's no autogen code for platform, this method will do nothing
+ # if CreateModuleCodeFile is set to False.
+ #
+ # @param CreateDepsCodeFile Flag indicating if creating module's
+ # autogen code file or not
+ #
+ def CreateCodeFile(self, CreateDepsCodeFile=False):
+ if not CreateDepsCodeFile:
+ return
+ for Pa in self.AutoGenObjectList:
+ Pa.CreateCodeFile(CreateDepsCodeFile)
+
+ ## Create AsBuilt INF file the platform
+ #
+ def CreateAsBuiltInf(self):
+ return
+
diff --git a/roms/edk2/BaseTools/Source/Python/AutoGen/__init__.py b/roms/edk2/BaseTools/Source/Python/AutoGen/__init__.py
new file mode 100644
index 000000000..47451c4c4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/AutoGen/__init__.py
@@ -0,0 +1,11 @@
+## @file
+# Python 'AutoGen' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+__all__ = ["AutoGen"]
diff --git a/roms/edk2/BaseTools/Source/Python/BPDG/BPDG.py b/roms/edk2/BaseTools/Source/Python/BPDG/BPDG.py
new file mode 100644
index 000000000..283e08a37
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/BPDG/BPDG.py
@@ -0,0 +1,158 @@
+## @file
+# Intel Binary Product Data Generation Tool (Intel BPDG).
+# This tool provide a simple process for the creation of a binary file containing read-only
+# configuration data for EDK II platforms that contain Dynamic and DynamicEx PCDs described
+# in VPD sections. It also provide an option for specifying an alternate name for a mapping
+# file of PCD layout for use during the build when the platform integrator selects to use
+# automatic offset calculation.
+#
+# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+import Common.LongFilePathOs as os
+import sys
+import encodings.ascii
+
+from optparse import OptionParser
+from Common import EdkLogger
+from Common.BuildToolError import *
+from Common.BuildVersion import gBUILD_VERSION
+
+from . import StringTable as st
+from . import GenVpd
+
+PROJECT_NAME = st.LBL_BPDG_LONG_UNI
+VERSION = (st.LBL_BPDG_VERSION + " Build " + gBUILD_VERSION)
+
+## Tool entrance method
+#
+# This method mainly dispatch specific methods per the command line options.
+# If no error found, return zero value so the caller of this tool can know
+# if it's executed successfully or not.
+#
+# @retval 0 Tool was successful
+# @retval 1 Tool failed
+#
+def main():
+ global Options, Args
+
+ # Initialize log system
+ EdkLogger.Initialize()
+ Options, Args = MyOptionParser()
+
+ ReturnCode = 0
+
+ if Options.opt_verbose:
+ EdkLogger.SetLevel(EdkLogger.VERBOSE)
+ elif Options.opt_quiet:
+ EdkLogger.SetLevel(EdkLogger.QUIET)
+ elif Options.debug_level is not None:
+ EdkLogger.SetLevel(Options.debug_level + 1)
+ else:
+ EdkLogger.SetLevel(EdkLogger.INFO)
+
+ if Options.bin_filename is None:
+ EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please use the -o option to specify the file name for the VPD binary file")
+ if Options.filename is None:
+ EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please use the -m option to specify the file name for the mapping file")
+
+ Force = False
+ if Options.opt_force is not None:
+ Force = True
+
+ if (Args[0] is not None) :
+ StartBpdg(Args[0], Options.filename, Options.bin_filename, Force)
+ else :
+ EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please specify the file which contain the VPD pcd info.",
+ None)
+
+ return ReturnCode
+
+
+## Parse command line options
+#
+# Using standard Python module optparse to parse command line option of this tool.
+#
+# @retval options A optparse.Values object containing the parsed options
+# @retval args Target of BPDG command
+#
+def MyOptionParser():
+ #
+ # Process command line firstly.
+ #
+ parser = OptionParser(version="%s - Version %s" % (PROJECT_NAME, VERSION),
+ description='',
+ prog='BPDG',
+ usage=st.LBL_BPDG_USAGE
+ )
+ parser.add_option('-d', '--debug', action='store', type="int", dest='debug_level',
+ help=st.MSG_OPTION_DEBUG_LEVEL)
+ parser.add_option('-v', '--verbose', action='store_true', dest='opt_verbose',
+ help=st.MSG_OPTION_VERBOSE)
+ parser.add_option('-q', '--quiet', action='store_true', dest='opt_quiet', default=False,
+ help=st.MSG_OPTION_QUIET)
+ parser.add_option('-o', '--vpd-filename', action='store', dest='bin_filename',
+ help=st.MSG_OPTION_VPD_FILENAME)
+ parser.add_option('-m', '--map-filename', action='store', dest='filename',
+ help=st.MSG_OPTION_MAP_FILENAME)
+ parser.add_option('-f', '--force', action='store_true', dest='opt_force',
+ help=st.MSG_OPTION_FORCE)
+
+ (options, args) = parser.parse_args()
+ if len(args) == 0:
+ EdkLogger.info("Please specify the filename.txt file which contain the VPD pcd info!")
+ EdkLogger.info(parser.usage)
+ sys.exit(1)
+ return options, args
+
+
+## Start BPDG and call the main functions
+#
+# This method mainly focus on call GenVPD class member functions to complete
+# BPDG's target. It will process VpdFile override, and provide the interface file
+# information.
+#
+# @Param InputFileName The filename include the vpd type pcd information
+# @param MapFileName The filename of map file that stores vpd type pcd information.
+# This file will be generated by the BPDG tool after fix the offset
+# and adjust the offset to make the pcd data aligned.
+# @param VpdFileName The filename of Vpd file that hold vpd pcd information.
+# @param Force Override the exist Vpdfile or not.
+#
+def StartBpdg(InputFileName, MapFileName, VpdFileName, Force):
+ if os.path.exists(VpdFileName) and not Force:
+ print("\nFile %s already exist, Overwrite(Yes/No)?[Y]: " % VpdFileName)
+ choice = sys.stdin.readline()
+ if choice.strip().lower() not in ['y', 'yes', '']:
+ return
+
+ GenVPD = GenVpd.GenVPD (InputFileName, MapFileName, VpdFileName)
+
+ EdkLogger.info('%-24s = %s' % ("VPD input data file: ", InputFileName))
+ EdkLogger.info('%-24s = %s' % ("VPD output map file: ", MapFileName))
+ EdkLogger.info('%-24s = %s' % ("VPD output binary file: ", VpdFileName))
+
+ GenVPD.ParserInputFile()
+ GenVPD.FormatFileLine()
+ GenVPD.FixVpdOffset()
+ GenVPD.GenerateVpdFile(MapFileName, VpdFileName)
+
+ EdkLogger.info("- Vpd pcd fixed done! -")
+
+if __name__ == '__main__':
+ try:
+ r = main()
+ except FatalError as e:
+ r = e
+ ## 0-127 is a safe return range, and 1 is a standard default error
+ if r < 0 or r > 127: r = 1
+ sys.exit(r)
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/BPDG/GenVpd.py b/roms/edk2/BaseTools/Source/Python/BPDG/GenVpd.py
new file mode 100644
index 000000000..049c082f4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/BPDG/GenVpd.py
@@ -0,0 +1,689 @@
+## @file
+# This file include GenVpd class for fix the Vpd type PCD offset, and PcdEntry for describe
+# and process each entry of vpd type PCD.
+#
+# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import absolute_import
+import Common.LongFilePathOs as os
+from io import BytesIO
+from . import StringTable as st
+import array
+import re
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from struct import *
+from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE, TAB_STAR
+import Common.EdkLogger as EdkLogger
+import Common.BuildToolError as BuildToolError
+
+_FORMAT_CHAR = {1: 'B',
+ 2: 'H',
+ 4: 'I',
+ 8: 'Q'
+ }
+
+## The VPD PCD data structure for store and process each VPD PCD entry.
+#
+# This class contain method to format and pack pcd's value.
+#
+class PcdEntry:
+ def __init__(self, PcdCName, SkuId,PcdOffset, PcdSize, PcdValue, Lineno=None, FileName=None, PcdUnpackValue=None,
+ PcdBinOffset=None, PcdBinSize=None, Alignment=None):
+ self.PcdCName = PcdCName.strip()
+ self.SkuId = SkuId.strip()
+ self.PcdOffset = PcdOffset.strip()
+ self.PcdSize = PcdSize.strip()
+ self.PcdValue = PcdValue.strip()
+ self.Lineno = Lineno.strip()
+ self.FileName = FileName.strip()
+ self.PcdUnpackValue = PcdUnpackValue
+ self.PcdBinOffset = PcdBinOffset
+ self.PcdBinSize = PcdBinSize
+ self.Alignment = Alignment
+
+ if self.PcdValue == '' :
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "Invalid PCD format(Name: %s File: %s line: %s) , no Value specified!" % (self.PcdCName, self.FileName, self.Lineno))
+
+ if self.PcdOffset == '' :
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "Invalid PCD format(Name: %s File: %s Line: %s) , no Offset specified!" % (self.PcdCName, self.FileName, self.Lineno))
+
+ if self.PcdSize == '' :
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "Invalid PCD format(Name: %s File: %s Line: %s), no PcdSize specified!" % (self.PcdCName, self.FileName, self.Lineno))
+
+ self._GenOffsetValue ()
+
+ ## Analyze the string value to judge the PCD's datum type equal to Boolean or not.
+ #
+ # @param ValueString PCD's value
+ # @param Size PCD's size
+ #
+ # @retval True PCD's datum type is Boolean
+ # @retval False PCD's datum type is not Boolean.
+ #
+ def _IsBoolean(self, ValueString, Size):
+ if (Size == "1"):
+ if ValueString.upper() in ["TRUE", "FALSE"]:
+ return True
+ elif ValueString in ["0", "1", "0x0", "0x1", "0x00", "0x01"]:
+ return True
+
+ return False
+
+ ## Convert the PCD's value from string to integer.
+ #
+ # This function will try to convert the Offset value form string to integer
+ # for both hexadecimal and decimal.
+ #
+ def _GenOffsetValue(self):
+ if self.PcdOffset != TAB_STAR:
+ try:
+ self.PcdBinOffset = int (self.PcdOffset)
+ except:
+ try:
+ self.PcdBinOffset = int(self.PcdOffset, 16)
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "Invalid offset value %s for PCD %s (File: %s Line: %s)" % (self.PcdOffset, self.PcdCName, self.FileName, self.Lineno))
+
+ ## Pack Boolean type VPD PCD's value form string to binary type.
+ #
+ # @param ValueString The boolean type string for pack.
+ #
+ #
+ def _PackBooleanValue(self, ValueString):
+ if ValueString.upper() == "TRUE" or ValueString in ["1", "0x1", "0x01"]:
+ try:
+ self.PcdValue = pack(_FORMAT_CHAR[1], 1)
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "Invalid size or value for PCD %s to pack(File: %s Line: %s)." % (self.PcdCName, self.FileName, self.Lineno))
+ else:
+ try:
+ self.PcdValue = pack(_FORMAT_CHAR[1], 0)
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "Invalid size or value for PCD %s to pack(File: %s Line: %s)." % (self.PcdCName, self.FileName, self.Lineno))
+
+ ## Pack Integer type VPD PCD's value form string to binary type.
+ #
+ # @param ValueString The Integer type string for pack.
+ #
+ #
+ def _PackIntValue(self, IntValue, Size):
+ if Size not in _FORMAT_CHAR:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "Invalid size %d for PCD %s in integer datum size(File: %s Line: %s)." % (Size, self.PcdCName, self.FileName, self.Lineno))
+
+ for Type, MaxSize in MAX_SIZE_TYPE.items():
+ if Type == 'BOOLEAN':
+ continue
+ if Size == MaxSize:
+ if IntValue < 0:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "PCD can't be set to negative value %d for PCD %s in %s datum type(File: %s Line: %s)." % (
+ IntValue, self.PcdCName, Type, self.FileName, self.Lineno))
+ elif IntValue > MAX_VAL_TYPE[Type]:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "Too large PCD value %d for datum type %s for PCD %s(File: %s Line: %s)." % (
+ IntValue, Type, self.PcdCName, self.FileName, self.Lineno))
+
+ try:
+ self.PcdValue = pack(_FORMAT_CHAR[Size], IntValue)
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "Invalid size or value for PCD %s to pack(File: %s Line: %s)." % (self.PcdCName, self.FileName, self.Lineno))
+
+ ## Pack VOID* type VPD PCD's value form string to binary type.
+ #
+ # The VOID* type of string divided into 3 sub-type:
+ # 1: L"String"/L'String', Unicode type string.
+ # 2: "String"/'String', Ascii type string.
+ # 3: {bytearray}, only support byte-array.
+ #
+ # @param ValueString The Integer type string for pack.
+ #
+ def _PackPtrValue(self, ValueString, Size):
+ if ValueString.startswith('L"') or ValueString.startswith("L'"):
+ self._PackUnicode(ValueString, Size)
+ elif ValueString.startswith('{') and ValueString.endswith('}'):
+ self._PackByteArray(ValueString, Size)
+ elif (ValueString.startswith('"') and ValueString.endswith('"')) or (ValueString.startswith("'") and ValueString.endswith("'")):
+ self._PackString(ValueString, Size)
+ else:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "Invalid VOID* type PCD %s value %s (File: %s Line: %s)" % (self.PcdCName, ValueString, self.FileName, self.Lineno))
+
+ ## Pack an Ascii PCD value.
+ #
+ # An Ascii string for a PCD should be in format as ""/''.
+ #
+ def _PackString(self, ValueString, Size):
+ if (Size < 0):
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "Invalid parameter Size %s of PCD %s!(File: %s Line: %s)" % (self.PcdBinSize, self.PcdCName, self.FileName, self.Lineno))
+ if (ValueString == ""):
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid parameter ValueString %s of PCD %s!(File: %s Line: %s)" % (self.PcdUnpackValue, self.PcdCName, self.FileName, self.Lineno))
+
+ QuotedFlag = True
+ if ValueString.startswith("'"):
+ QuotedFlag = False
+
+ ValueString = ValueString[1:-1]
+ # No null-terminator in 'string'
+ if (QuotedFlag and len(ValueString) + 1 > Size) or (not QuotedFlag and len(ValueString) > Size):
+ EdkLogger.error("BPDG", BuildToolError.RESOURCE_OVERFLOW,
+ "PCD value string %s is exceed to size %d(File: %s Line: %s)" % (ValueString, Size, self.FileName, self.Lineno))
+ try:
+ self.PcdValue = pack('%ds' % Size, ValueString.encode('utf-8'))
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "Invalid size or value for PCD %s to pack(File: %s Line: %s)." % (self.PcdCName, self.FileName, self.Lineno))
+
+ ## Pack a byte-array PCD value.
+ #
+ # A byte-array for a PCD should be in format as {0x01, 0x02, ...}.
+ #
+ def _PackByteArray(self, ValueString, Size):
+ if (Size < 0):
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid parameter Size %s of PCD %s!(File: %s Line: %s)" % (self.PcdBinSize, self.PcdCName, self.FileName, self.Lineno))
+ if (ValueString == ""):
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid parameter ValueString %s of PCD %s!(File: %s Line: %s)" % (self.PcdUnpackValue, self.PcdCName, self.FileName, self.Lineno))
+
+ ValueString = ValueString.strip()
+ ValueString = ValueString.lstrip('{').strip('}')
+ ValueList = ValueString.split(',')
+ ValueList = [item.strip() for item in ValueList]
+
+ if len(ValueList) > Size:
+ EdkLogger.error("BPDG", BuildToolError.RESOURCE_OVERFLOW,
+ "The byte array %s is too large for size %d(File: %s Line: %s)" % (ValueString, Size, self.FileName, self.Lineno))
+
+ ReturnArray = array.array('B')
+
+ for Index in range(len(ValueList)):
+ Value = None
+ if ValueList[Index].lower().startswith('0x'):
+ # translate hex value
+ try:
+ Value = int(ValueList[Index], 16)
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "The value item %s in byte array %s is an invalid HEX value.(File: %s Line: %s)" % \
+ (ValueList[Index], ValueString, self.FileName, self.Lineno))
+ else:
+ # translate decimal value
+ try:
+ Value = int(ValueList[Index], 10)
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "The value item %s in byte array %s is an invalid DECIMAL value.(File: %s Line: %s)" % \
+ (ValueList[Index], ValueString, self.FileName, self.Lineno))
+
+ if Value > 255:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "The value item %s in byte array %s do not in range 0 ~ 0xFF(File: %s Line: %s)" % \
+ (ValueList[Index], ValueString, self.FileName, self.Lineno))
+
+ ReturnArray.append(Value)
+
+ for Index in range(len(ValueList), Size):
+ ReturnArray.append(0)
+
+ self.PcdValue = ReturnArray.tolist()
+
+ ## Pack a unicode PCD value into byte array.
+ #
+ # A unicode string for a PCD should be in format as L""/L''.
+ #
+ def _PackUnicode(self, UnicodeString, Size):
+ if (Size < 0):
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid parameter Size %s of PCD %s!(File: %s Line: %s)" % \
+ (self.PcdBinSize, self.PcdCName, self.FileName, self.Lineno))
+
+ QuotedFlag = True
+ if UnicodeString.startswith("L'"):
+ QuotedFlag = False
+ UnicodeString = UnicodeString[2:-1]
+
+ # No null-terminator in L'string'
+ if (QuotedFlag and (len(UnicodeString) + 1) * 2 > Size) or (not QuotedFlag and len(UnicodeString) * 2 > Size):
+ EdkLogger.error("BPDG", BuildToolError.RESOURCE_OVERFLOW,
+ "The size of unicode string %s is too larger for size %s(File: %s Line: %s)" % \
+ (UnicodeString, Size, self.FileName, self.Lineno))
+
+ ReturnArray = array.array('B')
+ for Value in UnicodeString:
+ try:
+ ReturnArray.append(ord(Value))
+ ReturnArray.append(0)
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
+ "Invalid unicode character %s in unicode string %s(File: %s Line: %s)" % \
+ (Value, UnicodeString, self.FileName, self.Lineno))
+
+ for Index in range(len(UnicodeString) * 2, Size):
+ ReturnArray.append(0)
+
+ self.PcdValue = ReturnArray.tolist()
+
+
+
+## The class implementing the BPDG VPD PCD offset fix process
+#
+# The VPD PCD offset fix process includes:
+# 1. Parse the input guided.txt file and store it in the data structure;
+# 2. Format the input file data to remove unused lines;
+# 3. Fixed offset if needed;
+# 4. Generate output file, including guided.map and guided.bin file;
+#
+class GenVPD :
+ ## Constructor of DscBuildData
+ #
+ # Initialize object of GenVPD
+ # @Param InputFileName The filename include the vpd type pcd information
+ # @param MapFileName The filename of map file that stores vpd type pcd information.
+ # This file will be generated by the BPDG tool after fix the offset
+ # and adjust the offset to make the pcd data aligned.
+ # @param VpdFileName The filename of Vpd file that hold vpd pcd information.
+ #
+ def __init__(self, InputFileName, MapFileName, VpdFileName):
+ self.InputFileName = InputFileName
+ self.MapFileName = MapFileName
+ self.VpdFileName = VpdFileName
+ self.FileLinesList = []
+ self.PcdFixedOffsetSizeList = []
+ self.PcdUnknownOffsetList = []
+ try:
+ fInputfile = open(InputFileName, "r")
+ try:
+ self.FileLinesList = fInputfile.readlines()
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FILE_READ_FAILURE, "File read failed for %s" % InputFileName, None)
+ finally:
+ fInputfile.close()
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FILE_OPEN_FAILURE, "File open failed for %s" % InputFileName, None)
+
+ ##
+ # Parser the input file which is generated by the build tool. Convert the value of each pcd's
+ # from string to its real format. Also remove the useless line in the input file.
+ #
+ def ParserInputFile (self):
+ count = 0
+ for line in self.FileLinesList:
+ # Strip "\r\n" generated by readlines ().
+ line = line.strip()
+ line = line.rstrip(os.linesep)
+
+ # Skip the comment line
+ if (not line.startswith("#")) and len(line) > 1 :
+ #
+ # Enhanced for support "|" character in the string.
+ #
+ ValueList = ['', '', '', '', '']
+
+ ValueRe = re.compile(r'\s*L?\".*\|.*\"\s*$')
+ PtrValue = ValueRe.findall(line)
+
+ ValueUpdateFlag = False
+
+ if len(PtrValue) >= 1:
+ line = re.sub(ValueRe, '', line)
+ ValueUpdateFlag = True
+
+ TokenList = line.split('|')
+ ValueList[0:len(TokenList)] = TokenList
+
+ if ValueUpdateFlag:
+ ValueList[4] = PtrValue[0]
+ self.FileLinesList[count] = ValueList
+ # Store the line number
+ self.FileLinesList[count].append(str(count + 1))
+ elif len(line) <= 1 :
+ # Set the blank line to "None"
+ self.FileLinesList[count] = None
+ else :
+ # Set the comment line to "None"
+ self.FileLinesList[count] = None
+ count += 1
+
+ # The line count contain usage information
+ count = 0
+ # Delete useless lines
+ while (True) :
+ try :
+ if (self.FileLinesList[count] is None) :
+ del(self.FileLinesList[count])
+ else :
+ count += 1
+ except :
+ break
+ #
+ # After remove the useless line, if there are no data remain in the file line list,
+ # Report warning messages to user's.
+ #
+ if len(self.FileLinesList) == 0 :
+ EdkLogger.warn('BPDG', BuildToolError.RESOURCE_NOT_AVAILABLE,
+ "There are no VPD type pcds defined in DSC file, Please check it.")
+
+ # Process the pcds one by one base on the pcd's value and size
+ count = 0
+ for line in self.FileLinesList:
+ if line is not None :
+ PCD = PcdEntry(line[0], line[1], line[2], line[3], line[4], line[5], self.InputFileName)
+ # Strip the space char
+ PCD.PcdCName = PCD.PcdCName.strip(' ')
+ PCD.SkuId = PCD.SkuId.strip(' ')
+ PCD.PcdOffset = PCD.PcdOffset.strip(' ')
+ PCD.PcdSize = PCD.PcdSize.strip(' ')
+ PCD.PcdValue = PCD.PcdValue.strip(' ')
+ PCD.Lineno = PCD.Lineno.strip(' ')
+
+ #
+ # Store the original pcd value.
+ # This information will be useful while generate the output map file.
+ #
+ PCD.PcdUnpackValue = str(PCD.PcdValue)
+
+ #
+ # Translate PCD size string to an integer value.
+ PackSize = None
+ try:
+ PackSize = int(PCD.PcdSize, 10)
+ PCD.PcdBinSize = PackSize
+ except:
+ try:
+ PackSize = int(PCD.PcdSize, 16)
+ PCD.PcdBinSize = PackSize
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid PCD size value %s at file: %s line: %s" % (PCD.PcdSize, self.InputFileName, PCD.Lineno))
+
+ #
+ # If value is Unicode string (e.g. L""), then use 2-byte alignment
+ # If value is byte array (e.g. {}), then use 8-byte alignment
+ #
+ PCD.PcdOccupySize = PCD.PcdBinSize
+ if PCD.PcdUnpackValue.startswith("{"):
+ Alignment = 8
+ elif PCD.PcdUnpackValue.startswith("L"):
+ Alignment = 2
+ else:
+ Alignment = 1
+
+ PCD.Alignment = Alignment
+ if PCD.PcdOffset != TAB_STAR:
+ if PCD.PcdOccupySize % Alignment != 0:
+ if PCD.PcdUnpackValue.startswith("{"):
+ EdkLogger.warn("BPDG", "The offset value of PCD %s is not 8-byte aligned!" %(PCD.PcdCName), File=self.InputFileName)
+ else:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, 'The offset value of PCD %s should be %s-byte aligned.' % (PCD.PcdCName, Alignment))
+ else:
+ if PCD.PcdOccupySize % Alignment != 0:
+ PCD.PcdOccupySize = (PCD.PcdOccupySize // Alignment + 1) * Alignment
+
+ PackSize = PCD.PcdOccupySize
+ if PCD._IsBoolean(PCD.PcdValue, PCD.PcdSize):
+ PCD._PackBooleanValue(PCD.PcdValue)
+ self.FileLinesList[count] = PCD
+ count += 1
+ continue
+ #
+ # Try to translate value to an integer firstly.
+ #
+ IsInteger = True
+ PackValue = None
+ try:
+ PackValue = int(PCD.PcdValue)
+ except:
+ try:
+ PackValue = int(PCD.PcdValue, 16)
+ except:
+ IsInteger = False
+
+ if IsInteger:
+ PCD._PackIntValue(PackValue, PackSize)
+ else:
+ PCD._PackPtrValue(PCD.PcdValue, PackSize)
+
+ self.FileLinesList[count] = PCD
+ count += 1
+ else :
+ continue
+
+ ##
+ # This function used to create a clean list only contain useful information and reorganized to make it
+ # easy to be sorted
+ #
+ def FormatFileLine (self) :
+
+ for eachPcd in self.FileLinesList :
+ if eachPcd.PcdOffset != TAB_STAR :
+ # Use pcd's Offset value as key, and pcd's Value as value
+ self.PcdFixedOffsetSizeList.append(eachPcd)
+ else :
+ # Use pcd's CName as key, and pcd's Size as value
+ self.PcdUnknownOffsetList.append(eachPcd)
+
+
+ ##
+ # This function is use to fix the offset value which the not specified in the map file.
+ # Usually it use the star (meaning any offset) character in the offset field
+ #
+ def FixVpdOffset (self):
+ # At first, the offset should start at 0
+ # Sort fixed offset list in order to find out where has free spaces for the pcd's offset
+ # value is TAB_STAR to insert into.
+
+ self.PcdFixedOffsetSizeList.sort(key=lambda x: x.PcdBinOffset)
+
+ #
+ # Sort the un-fixed pcd's offset by its size.
+ #
+ self.PcdUnknownOffsetList.sort(key=lambda x: x.PcdBinSize)
+
+ index =0
+ for pcd in self.PcdUnknownOffsetList:
+ index += 1
+ if pcd.PcdCName == ".".join(("gEfiMdeModulePkgTokenSpaceGuid", "PcdNvStoreDefaultValueBuffer")):
+ if index != len(self.PcdUnknownOffsetList):
+ for i in range(len(self.PcdUnknownOffsetList) - index):
+ self.PcdUnknownOffsetList[index+i -1 ], self.PcdUnknownOffsetList[index+i] = self.PcdUnknownOffsetList[index+i], self.PcdUnknownOffsetList[index+i -1]
+
+ #
+ # Process all Offset value are TAB_STAR
+ #
+ if (len(self.PcdFixedOffsetSizeList) == 0) and (len(self.PcdUnknownOffsetList) != 0) :
+ # The offset start from 0
+ NowOffset = 0
+ for Pcd in self.PcdUnknownOffsetList :
+ if NowOffset % Pcd.Alignment != 0:
+ NowOffset = (NowOffset// Pcd.Alignment + 1) * Pcd.Alignment
+ Pcd.PcdBinOffset = NowOffset
+ Pcd.PcdOffset = str(hex(Pcd.PcdBinOffset))
+ NowOffset += Pcd.PcdOccupySize
+
+ self.PcdFixedOffsetSizeList = self.PcdUnknownOffsetList
+ return
+
+ # Check the offset of VPD type pcd's offset start from 0.
+ if self.PcdFixedOffsetSizeList[0].PcdBinOffset != 0 :
+ EdkLogger.warn("BPDG", "The offset of VPD type pcd should start with 0, please check it.",
+ None)
+
+ # Judge whether the offset in fixed pcd offset list is overlapped or not.
+ lenOfList = len(self.PcdFixedOffsetSizeList)
+ count = 0
+ while (count < lenOfList - 1) :
+ PcdNow = self.PcdFixedOffsetSizeList[count]
+ PcdNext = self.PcdFixedOffsetSizeList[count+1]
+ # Two pcd's offset is same
+ if PcdNow.PcdBinOffset == PcdNext.PcdBinOffset :
+ EdkLogger.error("BPDG", BuildToolError.ATTRIBUTE_GET_FAILURE,
+ "The offset of %s at line: %s is same with %s at line: %s in file %s" % \
+ (PcdNow.PcdCName, PcdNow.Lineno, PcdNext.PcdCName, PcdNext.Lineno, PcdNext.FileName),
+ None)
+
+ # Overlapped
+ if PcdNow.PcdBinOffset + PcdNow.PcdOccupySize > PcdNext.PcdBinOffset :
+ EdkLogger.error("BPDG", BuildToolError.ATTRIBUTE_GET_FAILURE,
+ "The offset of %s at line: %s is overlapped with %s at line: %s in file %s" % \
+ (PcdNow.PcdCName, PcdNow.Lineno, PcdNext.PcdCName, PcdNext.Lineno, PcdNext.FileName),
+ None)
+
+ # Has free space, raise a warning message
+ if PcdNow.PcdBinOffset + PcdNow.PcdOccupySize < PcdNext.PcdBinOffset :
+ EdkLogger.warn("BPDG", BuildToolError.ATTRIBUTE_GET_FAILURE,
+ "The offsets have free space of between %s at line: %s and %s at line: %s in file %s" % \
+ (PcdNow.PcdCName, PcdNow.Lineno, PcdNext.PcdCName, PcdNext.Lineno, PcdNext.FileName),
+ None)
+ count += 1
+
+ LastOffset = self.PcdFixedOffsetSizeList[0].PcdBinOffset
+ FixOffsetSizeListCount = 0
+ lenOfList = len(self.PcdFixedOffsetSizeList)
+ lenOfUnfixedList = len(self.PcdUnknownOffsetList)
+
+ ##
+ # Insert the un-fixed offset pcd's list into fixed offset pcd's list if has free space between those pcds.
+ #
+ while (FixOffsetSizeListCount < lenOfList) :
+
+ eachFixedPcd = self.PcdFixedOffsetSizeList[FixOffsetSizeListCount]
+ NowOffset = eachFixedPcd.PcdBinOffset
+
+ # Has free space
+ if LastOffset < NowOffset :
+ if lenOfUnfixedList != 0 :
+ countOfUnfixedList = 0
+ while(countOfUnfixedList < lenOfUnfixedList) :
+ eachUnfixedPcd = self.PcdUnknownOffsetList[countOfUnfixedList]
+ needFixPcdSize = eachUnfixedPcd.PcdOccupySize
+ # Not been fixed
+ if eachUnfixedPcd.PcdOffset == TAB_STAR :
+ if LastOffset % eachUnfixedPcd.Alignment != 0:
+ LastOffset = (LastOffset // eachUnfixedPcd.Alignment + 1) * eachUnfixedPcd.Alignment
+ # The offset un-fixed pcd can write into this free space
+ if needFixPcdSize <= (NowOffset - LastOffset) :
+ # Change the offset value of un-fixed pcd
+ eachUnfixedPcd.PcdOffset = str(hex(LastOffset))
+ eachUnfixedPcd.PcdBinOffset = LastOffset
+ # Insert this pcd into fixed offset pcd list.
+ self.PcdFixedOffsetSizeList.insert(FixOffsetSizeListCount, eachUnfixedPcd)
+
+ # Delete the item's offset that has been fixed and added into fixed offset list
+ self.PcdUnknownOffsetList.pop(countOfUnfixedList)
+
+ # After item added, should enlarge the length of fixed pcd offset list
+ lenOfList += 1
+ FixOffsetSizeListCount += 1
+
+ # Decrease the un-fixed pcd offset list's length
+ lenOfUnfixedList -= 1
+
+ # Modify the last offset value
+ LastOffset += needFixPcdSize
+ else :
+ # It can not insert into those two pcds, need to check still has other space can store it.
+ LastOffset = NowOffset + self.PcdFixedOffsetSizeList[FixOffsetSizeListCount].PcdOccupySize
+ FixOffsetSizeListCount += 1
+ break
+
+ # Set the FixOffsetSizeListCount = lenOfList for quit the loop
+ else :
+ FixOffsetSizeListCount = lenOfList
+
+ # No free space, smoothly connect with previous pcd.
+ elif LastOffset == NowOffset :
+ LastOffset = NowOffset + eachFixedPcd.PcdOccupySize
+ FixOffsetSizeListCount += 1
+ # Usually it will not enter into this thunk, if so, means it overlapped.
+ else :
+ EdkLogger.error("BPDG", BuildToolError.ATTRIBUTE_NOT_AVAILABLE,
+ "The offset value definition has overlapped at pcd: %s, its offset is: %s, in file: %s line: %s" % \
+ (eachFixedPcd.PcdCName, eachFixedPcd.PcdOffset, eachFixedPcd.InputFileName, eachFixedPcd.Lineno),
+ None)
+ FixOffsetSizeListCount += 1
+
+ # Continue to process the un-fixed offset pcd's list, add this time, just append them behind the fixed pcd's offset list.
+ lenOfUnfixedList = len(self.PcdUnknownOffsetList)
+ lenOfList = len(self.PcdFixedOffsetSizeList)
+ while (lenOfUnfixedList > 0) :
+ # Still has items need to process
+ # The last pcd instance
+ LastPcd = self.PcdFixedOffsetSizeList[lenOfList-1]
+ NeedFixPcd = self.PcdUnknownOffsetList[0]
+
+ NeedFixPcd.PcdBinOffset = LastPcd.PcdBinOffset + LastPcd.PcdOccupySize
+ if NeedFixPcd.PcdBinOffset % NeedFixPcd.Alignment != 0:
+ NeedFixPcd.PcdBinOffset = (NeedFixPcd.PcdBinOffset // NeedFixPcd.Alignment + 1) * NeedFixPcd.Alignment
+
+ NeedFixPcd.PcdOffset = str(hex(NeedFixPcd.PcdBinOffset))
+
+ # Insert this pcd into fixed offset pcd list's tail.
+ self.PcdFixedOffsetSizeList.insert(lenOfList, NeedFixPcd)
+ # Delete the item's offset that has been fixed and added into fixed offset list
+ self.PcdUnknownOffsetList.pop(0)
+
+ lenOfList += 1
+ lenOfUnfixedList -= 1
+ ##
+ # Write the final data into output files.
+ #
+ def GenerateVpdFile (self, MapFileName, BinFileName):
+ #Open an VPD file to process
+
+ try:
+ fVpdFile = open(BinFileName, "wb")
+ except:
+ # Open failed
+ EdkLogger.error("BPDG", BuildToolError.FILE_OPEN_FAILURE, "File open failed for %s" % self.VpdFileName, None)
+
+ try :
+ fMapFile = open(MapFileName, "w")
+ except:
+ # Open failed
+ EdkLogger.error("BPDG", BuildToolError.FILE_OPEN_FAILURE, "File open failed for %s" % self.MapFileName, None)
+
+ # Use a instance of BytesIO to cache data
+ fStringIO = BytesIO()
+
+ # Write the header of map file.
+ try :
+ fMapFile.write (st.MAP_FILE_COMMENT_TEMPLATE + "\n")
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the file been locked or using by other applications." % self.MapFileName, None)
+
+ for eachPcd in self.PcdFixedOffsetSizeList :
+ # write map file
+ try :
+ fMapFile.write("%s | %s | %s | %s | %s \n" % (eachPcd.PcdCName, eachPcd.SkuId, eachPcd.PcdOffset, eachPcd.PcdSize, eachPcd.PcdUnpackValue))
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the file been locked or using by other applications." % self.MapFileName, None)
+
+ # Write Vpd binary file
+ fStringIO.seek (eachPcd.PcdBinOffset)
+ if isinstance(eachPcd.PcdValue, list):
+ for i in range(len(eachPcd.PcdValue)):
+ Value = eachPcd.PcdValue[i:i + 1]
+ if isinstance(bytes(Value), str):
+ fStringIO.write(chr(Value[0]))
+ else:
+ fStringIO.write(bytes(Value))
+ else:
+ fStringIO.write (eachPcd.PcdValue)
+
+ try :
+ fVpdFile.write (fStringIO.getvalue())
+ except:
+ EdkLogger.error("BPDG", BuildToolError.FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the file been locked or using by other applications." % self.VpdFileName, None)
+
+ fStringIO.close ()
+ fVpdFile.close ()
+ fMapFile.close ()
+
diff --git a/roms/edk2/BaseTools/Source/Python/BPDG/StringTable.py b/roms/edk2/BaseTools/Source/Python/BPDG/StringTable.py
new file mode 100644
index 000000000..cd8b2d732
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/BPDG/StringTable.py
@@ -0,0 +1,72 @@
+## @file
+# This file is used to define strings used in the BPDG tool
+#
+# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+
+#string table starts here...
+
+#strings are classified as following types
+# MSG_...: it is a message string
+# ERR_...: it is a error string
+# WRN_...: it is a warning string
+# LBL_...: it is a UI label (window title, control label, etc.)
+# MNU_...: it is a menu item label
+# HLP_...: it is a help string
+# CFG_...: it is a config string used in module. Do not need to translate it.
+# XRC_...: it is a user visible string from xrc file
+
+MAP_FILE_COMMENT_TEMPLATE = \
+"""
+## @file
+#
+# THIS IS AUTO-GENERATED FILE BY BPDG TOOLS AND PLEASE DO NOT MAKE MODIFICATION.
+#
+# This file lists all VPD informations for a platform fixed/adjusted by BPDG tool.
+#
+# Copyright (c) 2010 -2018, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+"""
+
+
+
+LBL_BPDG_LONG_UNI = (u"Intel(r) Binary Product Data Generation Tool (Intel(r) BPDG)")
+LBL_BPDG_VERSION = (u"1.0")
+LBL_BPDG_USAGE = \
+(
+"""BPDG options -o Filename.bin -m Filename.map Filename.txt
+Copyright (c) 2010 - 2018, Intel Corporation All Rights Reserved.
+
+ Intel(r) Binary Product Data Generation Tool (Intel(r) BPDG)
+
+Required Flags:
+ -o BIN_FILENAME, --vpd-filename=BIN_FILENAME
+ Specify the file name for the VPD binary file
+ -m FILENAME, --map-filename=FILENAME
+ Generate file name for consumption during the build that contains
+ the mapping of Pcd name, offset, datum size and value derived
+ from the input file and any automatic calculations.
+"""
+)
+
+MSG_OPTION_HELP = ("Show this help message and exit.")
+MSG_OPTION_DEBUG_LEVEL = ("Print DEBUG statements, where DEBUG_LEVEL is 0-9.")
+MSG_OPTION_VERBOSE = ("Print informational statements.")
+MSG_OPTION_QUIET = ("Returns the exit code and will display only error messages.")
+MSG_OPTION_VPD_FILENAME = ("Specify the file name for the VPD binary file.")
+MSG_OPTION_MAP_FILENAME = ("Generate file name for consumption during the build that contains the mapping of Pcd name, offset, datum size and value derived from the input file and any automatic calculations.")
+MSG_OPTION_FORCE = ("Will force overwriting existing output files rather than returning an error message.")
+
+ERR_INVALID_DEBUG_LEVEL = ("Invalid level for debug message. Only "
+ "'DEBUG', 'INFO', 'WARNING', 'ERROR', "
+ "'CRITICAL' are supported for debugging "
+ "messages.")
diff --git a/roms/edk2/BaseTools/Source/Python/BPDG/__init__.py b/roms/edk2/BaseTools/Source/Python/BPDG/__init__.py
new file mode 100644
index 000000000..ea120ab9c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/BPDG/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'BPDG' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/Capsule/GenerateCapsule.py b/roms/edk2/BaseTools/Source/Python/Capsule/GenerateCapsule.py
new file mode 100644
index 000000000..a8de98825
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Capsule/GenerateCapsule.py
@@ -0,0 +1,1048 @@
+## @file
+# Generate a capsule.
+#
+# This tool generates a UEFI Capsule around an FMP Capsule. The capsule payload
+# be signed using signtool or OpenSSL and if it is signed the signed content
+# includes an FMP Payload Header.
+#
+# This tool is intended to be used to generate UEFI Capsules to update the
+# system firmware or device firmware for integrated devices. In order to
+# keep the tool as simple as possible, it has the following limitations:
+# * Do not support vendor code bytes in a capsule.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+GenerateCapsule
+'''
+
+import sys
+import argparse
+import uuid
+import struct
+import subprocess
+import os
+import tempfile
+import shutil
+import platform
+import json
+from Common.Uefi.Capsule.UefiCapsuleHeader import UefiCapsuleHeaderClass
+from Common.Uefi.Capsule.FmpCapsuleHeader import FmpCapsuleHeaderClass
+from Common.Uefi.Capsule.FmpAuthHeader import FmpAuthHeaderClass
+from Common.Uefi.Capsule.CapsuleDependency import CapsuleDependencyClass
+from Common.Edk2.Capsule.FmpPayloadHeader import FmpPayloadHeaderClass
+
+#
+# Globals for help information
+#
+__prog__ = 'GenerateCapsule'
+__version__ = '0.9'
+__copyright__ = 'Copyright (c) 2018, Intel Corporation. All rights reserved.'
+__description__ = 'Generate a capsule.\n'
+
+def SignPayloadSignTool (Payload, ToolPath, PfxFile, Verbose = False):
+ #
+ # Create a temporary directory
+ #
+ TempDirectoryName = tempfile.mkdtemp()
+
+ #
+ # Generate temp file name for the payload contents
+ #
+ TempFileName = os.path.join (TempDirectoryName, 'Payload.bin')
+
+ #
+ # Create temporary payload file for signing
+ #
+ try:
+ with open (TempFileName, 'wb') as File:
+ File.write (Payload)
+ except:
+ shutil.rmtree (TempDirectoryName)
+ raise ValueError ('GenerateCapsule: error: can not write temporary payload file.')
+
+ #
+ # Build signtool command
+ #
+ if ToolPath is None:
+ ToolPath = ''
+ Command = ''
+ Command = Command + '"{Path}" '.format (Path = os.path.join (ToolPath, 'signtool.exe'))
+ Command = Command + 'sign /fd sha256 /p7ce DetachedSignedData /p7co 1.2.840.113549.1.7.2 '
+ Command = Command + '/p7 {TempDir} '.format (TempDir = TempDirectoryName)
+ Command = Command + '/f {PfxFile} '.format (PfxFile = PfxFile)
+ Command = Command + TempFileName
+ if Verbose:
+ print (Command)
+
+ #
+ # Sign the input file using the specified private key
+ #
+ try:
+ Process = subprocess.Popen (Command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
+ Result = Process.communicate('')
+ except:
+ shutil.rmtree (TempDirectoryName)
+ raise ValueError ('GenerateCapsule: error: can not run signtool.')
+
+ if Process.returncode != 0:
+ shutil.rmtree (TempDirectoryName)
+ print (Result[1].decode())
+ raise ValueError ('GenerateCapsule: error: signtool failed.')
+
+ #
+ # Read the signature from the generated output file
+ #
+ try:
+ with open (TempFileName + '.p7', 'rb') as File:
+ Signature = File.read ()
+ except:
+ shutil.rmtree (TempDirectoryName)
+ raise ValueError ('GenerateCapsule: error: can not read signature file.')
+
+ shutil.rmtree (TempDirectoryName)
+ return Signature
+
+def VerifyPayloadSignTool (Payload, CertData, ToolPath, PfxFile, Verbose = False):
+ print ('signtool verify is not supported.')
+ raise ValueError ('GenerateCapsule: error: signtool verify is not supported.')
+
+def SignPayloadOpenSsl (Payload, ToolPath, SignerPrivateCertFile, OtherPublicCertFile, TrustedPublicCertFile, Verbose = False):
+ #
+ # Build openssl command
+ #
+ if ToolPath is None:
+ ToolPath = ''
+ Command = ''
+ Command = Command + '"{Path}" '.format (Path = os.path.join (ToolPath, 'openssl'))
+ Command = Command + 'smime -sign -binary -outform DER -md sha256 '
+ Command = Command + '-signer "{Private}" -certfile "{Public}"'.format (Private = SignerPrivateCertFile, Public = OtherPublicCertFile)
+ if Verbose:
+ print (Command)
+
+ #
+ # Sign the input file using the specified private key and capture signature from STDOUT
+ #
+ try:
+ Process = subprocess.Popen (Command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
+ Result = Process.communicate(input = Payload)
+ Signature = Result[0]
+ except:
+ raise ValueError ('GenerateCapsule: error: can not run openssl.')
+
+ if Process.returncode != 0:
+ print (Result[1].decode())
+ raise ValueError ('GenerateCapsule: error: openssl failed.')
+
+ return Signature
+
+def VerifyPayloadOpenSsl (Payload, CertData, ToolPath, SignerPrivateCertFile, OtherPublicCertFile, TrustedPublicCertFile, Verbose = False):
+ #
+ # Create a temporary directory
+ #
+ TempDirectoryName = tempfile.mkdtemp()
+
+ #
+ # Generate temp file name for the payload contents
+ #
+ TempFileName = os.path.join (TempDirectoryName, 'Payload.bin')
+
+ #
+ # Create temporary payload file for verification
+ #
+ try:
+ with open (TempFileName, 'wb') as File:
+ File.write (Payload)
+ except:
+ shutil.rmtree (TempDirectoryName)
+ raise ValueError ('GenerateCapsule: error: can not write temporary payload file.')
+
+ #
+ # Build openssl command
+ #
+ if ToolPath is None:
+ ToolPath = ''
+ Command = ''
+ Command = Command + '"{Path}" '.format (Path = os.path.join (ToolPath, 'openssl'))
+ Command = Command + 'smime -verify -inform DER '
+ Command = Command + '-content {Content} -CAfile "{Public}"'.format (Content = TempFileName, Public = TrustedPublicCertFile)
+ if Verbose:
+ print (Command)
+
+ #
+ # Verify signature
+ #
+ try:
+ Process = subprocess.Popen (Command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
+ Result = Process.communicate(input = CertData)
+ except:
+ shutil.rmtree (TempDirectoryName)
+ raise ValueError ('GenerateCapsule: error: can not run openssl.')
+
+ if Process.returncode != 0:
+ shutil.rmtree (TempDirectoryName)
+ print (Result[1].decode())
+ raise ValueError ('GenerateCapsule: error: openssl failed.')
+
+ shutil.rmtree (TempDirectoryName)
+ return Payload
+
+if __name__ == '__main__':
+ def convert_arg_line_to_args(arg_line):
+ for arg in arg_line.split():
+ if not arg.strip():
+ continue
+ yield arg
+
+ def ValidateUnsignedInteger (Argument):
+ try:
+ Value = int (Argument, 0)
+ except:
+ Message = '{Argument} is not a valid integer value.'.format (Argument = Argument)
+ raise argparse.ArgumentTypeError (Message)
+ if Value < 0:
+ Message = '{Argument} is a negative value.'.format (Argument = Argument)
+ raise argparse.ArgumentTypeError (Message)
+ return Value
+
+ def ValidateRegistryFormatGuid (Argument):
+ try:
+ Value = uuid.UUID (Argument)
+ except:
+ Message = '{Argument} is not a valid registry format GUID value.'.format (Argument = Argument)
+ raise argparse.ArgumentTypeError (Message)
+ return Value
+
+ def ConvertJsonValue (Config, FieldName, Convert, Required = True, Default = None, Open = False):
+ if FieldName not in Config:
+ if Required:
+ print ('GenerateCapsule: error: Payload descriptor invalid syntax. Could not find {Key} in payload descriptor.'.format(Key = FieldName))
+ sys.exit (1)
+ return Default
+ try:
+ Value = Convert (Config[FieldName])
+ except:
+ print ('GenerateCapsule: error: {Key} in payload descriptor has invalid syntax.'.format (Key = FieldName))
+ sys.exit (1)
+ if Open:
+ try:
+ Value = open (Value, "rb")
+ except:
+ print ('GenerateCapsule: error: can not open file {File}'.format (File = FieldName))
+ sys.exit (1)
+ return Value
+
+ def DecodeJsonFileParse (Json):
+ if 'Payloads' not in Json:
+ print ('GenerateCapsule: error "Payloads" section not found in JSON file {File}'.format (File = args.JsonFile.name))
+ sys.exit (1)
+ for Config in Json['Payloads']:
+ #
+ # Parse fields from JSON
+ #
+ PayloadFile = ConvertJsonValue (Config, 'Payload', os.path.expandvars, Required = False)
+ Guid = ConvertJsonValue (Config, 'Guid', ValidateRegistryFormatGuid, Required = False)
+ FwVersion = ConvertJsonValue (Config, 'FwVersion', ValidateUnsignedInteger, Required = False)
+ LowestSupportedVersion = ConvertJsonValue (Config, 'LowestSupportedVersion', ValidateUnsignedInteger, Required = False)
+ HardwareInstance = ConvertJsonValue (Config, 'HardwareInstance', ValidateUnsignedInteger, Required = False, Default = 0)
+ MonotonicCount = ConvertJsonValue (Config, 'MonotonicCount', ValidateUnsignedInteger, Required = False, Default = 0)
+ SignToolPfxFile = ConvertJsonValue (Config, 'SignToolPfxFile', os.path.expandvars, Required = False, Default = None, Open = True)
+ OpenSslSignerPrivateCertFile = ConvertJsonValue (Config, 'OpenSslSignerPrivateCertFile', os.path.expandvars, Required = False, Default = None, Open = True)
+ OpenSslOtherPublicCertFile = ConvertJsonValue (Config, 'OpenSslOtherPublicCertFile', os.path.expandvars, Required = False, Default = None, Open = True)
+ OpenSslTrustedPublicCertFile = ConvertJsonValue (Config, 'OpenSslTrustedPublicCertFile', os.path.expandvars, Required = False, Default = None, Open = True)
+ SigningToolPath = ConvertJsonValue (Config, 'SigningToolPath', os.path.expandvars, Required = False, Default = None)
+ UpdateImageIndex = ConvertJsonValue (Config, 'UpdateImageIndex', ValidateUnsignedInteger, Required = False, Default = 1)
+
+ PayloadDescriptorList.append (PayloadDescriptor (
+ PayloadFile,
+ Guid,
+ FwVersion,
+ LowestSupportedVersion,
+ MonotonicCount,
+ HardwareInstance,
+ UpdateImageIndex,
+ SignToolPfxFile,
+ OpenSslSignerPrivateCertFile,
+ OpenSslOtherPublicCertFile,
+ OpenSslTrustedPublicCertFile,
+ SigningToolPath
+ ))
+
+ def EncodeJsonFileParse (Json):
+ if 'EmbeddedDrivers' not in Json:
+ print ('GenerateCapsule: warning "EmbeddedDrivers" section not found in JSON file {File}'.format (File = args.JsonFile.name))
+ else:
+ for Config in Json['EmbeddedDrivers']:
+ EmbeddedDriverFile = ConvertJsonValue(Config, 'Driver', os.path.expandvars, Open = True)
+ #
+ #Read EmbeddedDriver file
+ #
+ try:
+ if args.Verbose:
+ print ('Read EmbeddedDriver file {File}'.format (File = EmbeddedDriverFile.name))
+ Driver = EmbeddedDriverFile.read()
+ except:
+ print ('GenerateCapsule: error: can not read EmbeddedDriver file {File}'.format (File = EmbeddedDriverFile.name))
+ sys.exit (1)
+ EmbeddedDriverDescriptorList.append (Driver)
+
+ if 'Payloads' not in Json:
+ print ('GenerateCapsule: error: "Payloads" section not found in JSON file {File}'.format (File = args.JsonFile.name))
+ sys.exit (1)
+ for Config in Json['Payloads']:
+ #
+ # Parse fields from JSON
+ #
+ PayloadFile = ConvertJsonValue (Config, 'Payload', os.path.expandvars, Open = True)
+ Guid = ConvertJsonValue (Config, 'Guid', ValidateRegistryFormatGuid)
+ FwVersion = ConvertJsonValue (Config, 'FwVersion', ValidateUnsignedInteger)
+ LowestSupportedVersion = ConvertJsonValue (Config, 'LowestSupportedVersion', ValidateUnsignedInteger)
+ HardwareInstance = ConvertJsonValue (Config, 'HardwareInstance', ValidateUnsignedInteger, Required = False, Default = 0)
+ UpdateImageIndex = ConvertJsonValue (Config, 'UpdateImageIndex', ValidateUnsignedInteger, Required = False, Default = 1)
+ MonotonicCount = ConvertJsonValue (Config, 'MonotonicCount', ValidateUnsignedInteger, Required = False, Default = 0)
+ SignToolPfxFile = ConvertJsonValue (Config, 'SignToolPfxFile', os.path.expandvars, Required = False, Default = None, Open = True)
+ OpenSslSignerPrivateCertFile = ConvertJsonValue (Config, 'OpenSslSignerPrivateCertFile', os.path.expandvars, Required = False, Default = None, Open = True)
+ OpenSslOtherPublicCertFile = ConvertJsonValue (Config, 'OpenSslOtherPublicCertFile', os.path.expandvars, Required = False, Default = None, Open = True)
+ OpenSslTrustedPublicCertFile = ConvertJsonValue (Config, 'OpenSslTrustedPublicCertFile', os.path.expandvars, Required = False, Default = None, Open = True)
+ SigningToolPath = ConvertJsonValue (Config, 'SigningToolPath', os.path.expandvars, Required = False, Default = None)
+ DepexExp = ConvertJsonValue (Config, 'Dependencies', str, Required = False, Default = None)
+
+ #
+ # Read binary input file
+ #
+ try:
+ if args.Verbose:
+ print ('Read binary input file {File}'.format (File = PayloadFile.name))
+ Payload = PayloadFile.read()
+ PayloadFile.close ()
+ except:
+ print ('GenerateCapsule: error: can not read binary input file {File}'.format (File = PayloadFile.name))
+ sys.exit (1)
+ PayloadDescriptorList.append (PayloadDescriptor (
+ Payload,
+ Guid,
+ FwVersion,
+ LowestSupportedVersion,
+ MonotonicCount,
+ HardwareInstance,
+ UpdateImageIndex,
+ SignToolPfxFile,
+ OpenSslSignerPrivateCertFile,
+ OpenSslOtherPublicCertFile,
+ OpenSslTrustedPublicCertFile,
+ SigningToolPath,
+ DepexExp
+ ))
+
+ def GenerateOutputJson (PayloadJsonDescriptorList):
+ PayloadJson = {
+ "Payloads" : [
+ {
+ "Guid": str(PayloadDescriptor.Guid).upper(),
+ "FwVersion": str(PayloadDescriptor.FwVersion),
+ "LowestSupportedVersion": str(PayloadDescriptor.LowestSupportedVersion),
+ "MonotonicCount": str(PayloadDescriptor.MonotonicCount),
+ "Payload": PayloadDescriptor.Payload,
+ "HardwareInstance": str(PayloadDescriptor.HardwareInstance),
+ "UpdateImageIndex": str(PayloadDescriptor.UpdateImageIndex),
+ "SignToolPfxFile": str(PayloadDescriptor.SignToolPfxFile),
+ "OpenSslSignerPrivateCertFile": str(PayloadDescriptor.OpenSslSignerPrivateCertFile),
+ "OpenSslOtherPublicCertFile": str(PayloadDescriptor.OpenSslOtherPublicCertFile),
+ "OpenSslTrustedPublicCertFile": str(PayloadDescriptor.OpenSslTrustedPublicCertFile),
+ "SigningToolPath": str(PayloadDescriptor.SigningToolPath),
+ "Dependencies" : str(PayloadDescriptor.DepexExp)
+ }for PayloadDescriptor in PayloadJsonDescriptorList
+ ]
+ }
+ OutputJsonFile = args.OutputFile.name + '.json'
+ if 'Payloads' in PayloadJson:
+ PayloadSection = PayloadJson ['Payloads']
+ Index = 0
+ for PayloadField in PayloadSection:
+ if PayloadJsonDescriptorList[Index].SignToolPfxFile is None:
+ del PayloadField ['SignToolPfxFile']
+ if PayloadJsonDescriptorList[Index].OpenSslSignerPrivateCertFile is None:
+ del PayloadField ['OpenSslSignerPrivateCertFile']
+ if PayloadJsonDescriptorList[Index].OpenSslOtherPublicCertFile is None:
+ del PayloadField ['OpenSslOtherPublicCertFile']
+ if PayloadJsonDescriptorList[Index].OpenSslTrustedPublicCertFile is None:
+ del PayloadField ['OpenSslTrustedPublicCertFile']
+ if PayloadJsonDescriptorList[Index].SigningToolPath is None:
+ del PayloadField ['SigningToolPath']
+ Index = Index + 1
+ Result = json.dumps (PayloadJson, indent=4, sort_keys=True, separators=(',', ': '))
+ with open (OutputJsonFile, 'w') as OutputFile:
+ OutputFile.write (Result)
+
+ def CheckArgumentConflict (args):
+ if args.Encode:
+ if args.InputFile:
+ print ('GenerateCapsule: error: Argument InputFile conflicts with Argument -j')
+ sys.exit (1)
+ if args.EmbeddedDriver:
+ print ('GenerateCapsule: error: Argument --embedded-driver conflicts with Argument -j')
+ sys.exit (1)
+ if args.Guid:
+ print ('GenerateCapsule: error: Argument --guid conflicts with Argument -j')
+ sys.exit (1)
+ if args.FwVersion:
+ print ('GenerateCapsule: error: Argument --fw-version conflicts with Argument -j')
+ sys.exit (1)
+ if args.LowestSupportedVersion:
+ print ('GenerateCapsule: error: Argument --lsv conflicts with Argument -j')
+ sys.exit (1)
+ if args.MonotonicCount:
+ print ('GenerateCapsule: error: Argument --monotonic-count conflicts with Argument -j')
+ sys.exit (1)
+ if args.HardwareInstance:
+ print ('GenerateCapsule: error: Argument --hardware-instance conflicts with Argument -j')
+ sys.exit (1)
+ if args.SignToolPfxFile:
+ print ('GenerateCapsule: error: Argument --pfx-file conflicts with Argument -j')
+ sys.exit (1)
+ if args.OpenSslSignerPrivateCertFile:
+ print ('GenerateCapsule: error: Argument --signer-private-cert conflicts with Argument -j')
+ sys.exit (1)
+ if args.OpenSslOtherPublicCertFile:
+ print ('GenerateCapsule: error: Argument --other-public-cert conflicts with Argument -j')
+ sys.exit (1)
+ if args.OpenSslTrustedPublicCertFile:
+ print ('GenerateCapsule: error: Argument --trusted-public-cert conflicts with Argument -j')
+ sys.exit (1)
+ if args.SigningToolPath:
+ print ('GenerateCapsule: error: Argument --signing-tool-path conflicts with Argument -j')
+ sys.exit (1)
+
+ class PayloadDescriptor (object):
+ def __init__(self,
+ Payload,
+ Guid,
+ FwVersion,
+ LowestSupportedVersion,
+ MonotonicCount = 0,
+ HardwareInstance = 0,
+ UpdateImageIndex = 1,
+ SignToolPfxFile = None,
+ OpenSslSignerPrivateCertFile = None,
+ OpenSslOtherPublicCertFile = None,
+ OpenSslTrustedPublicCertFile = None,
+ SigningToolPath = None,
+ DepexExp = None
+ ):
+ self.Payload = Payload
+ self.Guid = Guid
+ self.FwVersion = FwVersion
+ self.LowestSupportedVersion = LowestSupportedVersion
+ self.MonotonicCount = MonotonicCount
+ self.HardwareInstance = HardwareInstance
+ self.UpdateImageIndex = UpdateImageIndex
+ self.SignToolPfxFile = SignToolPfxFile
+ self.OpenSslSignerPrivateCertFile = OpenSslSignerPrivateCertFile
+ self.OpenSslOtherPublicCertFile = OpenSslOtherPublicCertFile
+ self.OpenSslTrustedPublicCertFile = OpenSslTrustedPublicCertFile
+ self.SigningToolPath = SigningToolPath
+ self.DepexExp = DepexExp
+
+ self.UseSignTool = self.SignToolPfxFile is not None
+ self.UseOpenSsl = (self.OpenSslSignerPrivateCertFile is not None and
+ self.OpenSslOtherPublicCertFile is not None and
+ self.OpenSslTrustedPublicCertFile is not None)
+ self.AnyOpenSsl = (self.OpenSslSignerPrivateCertFile is not None or
+ self.OpenSslOtherPublicCertFile is not None or
+ self.OpenSslTrustedPublicCertFile is not None)
+ self.UseDependency = self.DepexExp is not None
+
+ def Validate(self, args):
+ if self.UseSignTool and self.AnyOpenSsl:
+ raise argparse.ArgumentTypeError ('Providing both signtool and OpenSSL options is not supported')
+ if not self.UseSignTool and not self.UseOpenSsl and self.AnyOpenSsl:
+ if args.JsonFile:
+ raise argparse.ArgumentTypeError ('the following JSON fields are required for OpenSSL: OpenSslSignerPrivateCertFile, OpenSslOtherPublicCertFile, OpenSslTrustedPublicCertFile')
+ else:
+ raise argparse.ArgumentTypeError ('the following options are required for OpenSSL: --signer-private-cert, --other-public-cert, --trusted-public-cert')
+ if self.UseSignTool and platform.system() != 'Windows':
+ raise argparse.ArgumentTypeError ('Use of signtool is not supported on this operating system.')
+ if args.Encode:
+ if self.FwVersion is None or self.LowestSupportedVersion is None:
+ if args.JsonFile:
+ raise argparse.ArgumentTypeError ('the following JSON fields are required: FwVersion, LowestSupportedVersion')
+ else:
+ raise argparse.ArgumentTypeError ('the following options are required: --fw-version, --lsv')
+ if self.FwVersion > 0xFFFFFFFF:
+ if args.JsonFile:
+ raise argparse.ArgumentTypeError ('JSON field FwVersion must be an integer in range 0x0..0xffffffff')
+ else:
+ raise argparse.ArgumentTypeError ('--fw-version must be an integer in range 0x0..0xffffffff')
+ if self.LowestSupportedVersion > 0xFFFFFFFF:
+ if args.JsonFile:
+ raise argparse.ArgumentTypeError ('JSON field LowestSupportedVersion must be an integer in range 0x0..0xffffffff')
+ else:
+ raise argparse.ArgumentTypeError ('--lsv must be an integer in range 0x0..0xffffffff')
+
+ if args.Encode:
+ if self.Guid is None:
+ if args.JsonFile:
+ raise argparse.ArgumentTypeError ('the following JSON field is required: Guid')
+ else:
+ raise argparse.ArgumentTypeError ('the following option is required: --guid')
+ if self.HardwareInstance > 0xFFFFFFFFFFFFFFFF:
+ if args.JsonFile:
+ raise argparse.ArgumentTypeError ('JSON field HardwareInstance must be an integer in range 0x0..0xffffffffffffffff')
+ else:
+ raise argparse.ArgumentTypeError ('--hardware-instance must be an integer in range 0x0..0xffffffffffffffff')
+ if self.MonotonicCount > 0xFFFFFFFFFFFFFFFF:
+ if args.JsonFile:
+ raise argparse.ArgumentTypeError ('JSON field MonotonicCount must be an integer in range 0x0..0xffffffffffffffff')
+ else:
+ raise argparse.ArgumentTypeError ('--monotonic-count must be an integer in range 0x0..0xffffffffffffffff')
+ if self.UpdateImageIndex >0xFF:
+ if args.JsonFile:
+ raise argparse.ArgumentTypeError ('JSON field UpdateImageIndex must be an integer in range 0x0..0xff')
+ else:
+ raise argparse.ArgumentTypeError ('--update-image-index must be an integer in range 0x0..0xff')
+
+ if self.UseSignTool:
+ self.SignToolPfxFile.close()
+ self.SignToolPfxFile = self.SignToolPfxFile.name
+ if self.UseOpenSsl:
+ self.OpenSslSignerPrivateCertFile.close()
+ self.OpenSslOtherPublicCertFile.close()
+ self.OpenSslTrustedPublicCertFile.close()
+ self.OpenSslSignerPrivateCertFile = self.OpenSslSignerPrivateCertFile.name
+ self.OpenSslOtherPublicCertFile = self.OpenSslOtherPublicCertFile.name
+ self.OpenSslTrustedPublicCertFile = self.OpenSslTrustedPublicCertFile.name
+
+ #
+ # Perform additional argument verification
+ #
+ if args.Encode:
+ if 'PersistAcrossReset' not in args.CapsuleFlag:
+ if 'InitiateReset' in args.CapsuleFlag:
+ raise argparse.ArgumentTypeError ('--capflag InitiateReset also requires --capflag PersistAcrossReset')
+ if args.CapsuleOemFlag > 0xFFFF:
+ raise argparse.ArgumentTypeError ('--capoemflag must be an integer between 0x0000 and 0xffff')
+
+ return True
+
+
+ def Encode (PayloadDescriptorList, EmbeddedDriverDescriptorList, Buffer):
+ if args.JsonFile:
+ CheckArgumentConflict(args)
+ try:
+ Json = json.loads (args.JsonFile.read ())
+ except:
+ print ('GenerateCapsule: error: {JSONFile} loads failure. '.format (JSONFile = args.JsonFile))
+ sys.exit (1)
+ EncodeJsonFileParse(Json)
+ else:
+ for Driver in args.EmbeddedDriver:
+ EmbeddedDriverDescriptorList.append (Driver.read())
+ PayloadDescriptorList.append (PayloadDescriptor (
+ Buffer,
+ args.Guid,
+ args.FwVersion,
+ args.LowestSupportedVersion,
+ args.MonotonicCount,
+ args.HardwareInstance,
+ args.UpdateImageIndex,
+ args.SignToolPfxFile,
+ args.OpenSslSignerPrivateCertFile,
+ args.OpenSslOtherPublicCertFile,
+ args.OpenSslTrustedPublicCertFile,
+ args.SigningToolPath,
+ None
+ ))
+ for SinglePayloadDescriptor in PayloadDescriptorList:
+ try:
+ SinglePayloadDescriptor.Validate (args)
+ except Exception as Msg:
+ print ('GenerateCapsule: error:' + str(Msg))
+ sys.exit (1)
+ for SinglePayloadDescriptor in PayloadDescriptorList:
+ Result = SinglePayloadDescriptor.Payload
+ try:
+ FmpPayloadHeader.FwVersion = SinglePayloadDescriptor.FwVersion
+ FmpPayloadHeader.LowestSupportedVersion = SinglePayloadDescriptor.LowestSupportedVersion
+ FmpPayloadHeader.Payload = SinglePayloadDescriptor.Payload
+ Result = FmpPayloadHeader.Encode ()
+ if args.Verbose:
+ FmpPayloadHeader.DumpInfo ()
+ except:
+ print ('GenerateCapsule: error: can not encode FMP Payload Header')
+ sys.exit (1)
+ if SinglePayloadDescriptor.UseDependency:
+ CapsuleDependency.Payload = Result
+ CapsuleDependency.DepexExp = SinglePayloadDescriptor.DepexExp
+ Result = CapsuleDependency.Encode ()
+ if args.Verbose:
+ CapsuleDependency.DumpInfo ()
+ if SinglePayloadDescriptor.UseOpenSsl or SinglePayloadDescriptor.UseSignTool:
+ #
+ # Sign image with 64-bit MonotonicCount appended to end of image
+ #
+ try:
+ if SinglePayloadDescriptor.UseSignTool:
+ CertData = SignPayloadSignTool (
+ Result + struct.pack ('<Q', SinglePayloadDescriptor.MonotonicCount),
+ SinglePayloadDescriptor.SigningToolPath,
+ SinglePayloadDescriptor.SignToolPfxFile,
+ Verbose = args.Verbose
+ )
+ else:
+ CertData = SignPayloadOpenSsl (
+ Result + struct.pack ('<Q', SinglePayloadDescriptor.MonotonicCount),
+ SinglePayloadDescriptor.SigningToolPath,
+ SinglePayloadDescriptor.OpenSslSignerPrivateCertFile,
+ SinglePayloadDescriptor.OpenSslOtherPublicCertFile,
+ SinglePayloadDescriptor.OpenSslTrustedPublicCertFile,
+ Verbose = args.Verbose
+ )
+ except Exception as Msg:
+ print ('GenerateCapsule: error: can not sign payload \n' + str(Msg))
+ sys.exit (1)
+
+ try:
+ FmpAuthHeader.MonotonicCount = SinglePayloadDescriptor.MonotonicCount
+ FmpAuthHeader.CertData = CertData
+ FmpAuthHeader.Payload = Result
+ Result = FmpAuthHeader.Encode ()
+ if args.Verbose:
+ FmpAuthHeader.DumpInfo ()
+ except:
+ print ('GenerateCapsule: error: can not encode FMP Auth Header')
+ sys.exit (1)
+ FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, Result, HardwareInstance = SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = SinglePayloadDescriptor.UpdateImageIndex)
+ try:
+ for EmbeddedDriver in EmbeddedDriverDescriptorList:
+ FmpCapsuleHeader.AddEmbeddedDriver(EmbeddedDriver)
+
+ Result = FmpCapsuleHeader.Encode ()
+ if args.Verbose:
+ FmpCapsuleHeader.DumpInfo ()
+ except:
+ print ('GenerateCapsule: error: can not encode FMP Capsule Header')
+ sys.exit (1)
+
+ try:
+ UefiCapsuleHeader.OemFlags = args.CapsuleOemFlag
+ UefiCapsuleHeader.PersistAcrossReset = 'PersistAcrossReset' in args.CapsuleFlag
+ UefiCapsuleHeader.PopulateSystemTable = False
+ UefiCapsuleHeader.InitiateReset = 'InitiateReset' in args.CapsuleFlag
+ UefiCapsuleHeader.Payload = Result
+ Result = UefiCapsuleHeader.Encode ()
+ if args.Verbose:
+ UefiCapsuleHeader.DumpInfo ()
+ except:
+ print ('GenerateCapsule: error: can not encode UEFI Capsule Header')
+ sys.exit (1)
+ try:
+ if args.Verbose:
+ print ('Write binary output file {File}'.format (File = args.OutputFile.name))
+ args.OutputFile.write (Result)
+ args.OutputFile.close ()
+ except:
+ print ('GenerateCapsule: error: can not write binary output file {File}'.format (File = args.OutputFile.name))
+ sys.exit (1)
+
+ def Decode (PayloadDescriptorList, PayloadJsonDescriptorList, Buffer):
+ if args.JsonFile:
+ CheckArgumentConflict(args)
+ #
+ # Parse payload descriptors from JSON
+ #
+ try:
+ Json = json.loads (args.JsonFile.read())
+ except:
+ print ('GenerateCapsule: error: {JSONFile} loads failure. '.format (JSONFile = args.JsonFile))
+ sys.exit (1)
+ DecodeJsonFileParse (Json)
+ else:
+ PayloadDescriptorList.append (PayloadDescriptor (
+ Buffer,
+ args.Guid,
+ args.FwVersion,
+ args.LowestSupportedVersion,
+ args.MonotonicCount,
+ args.HardwareInstance,
+ args.UpdateImageIndex,
+ args.SignToolPfxFile,
+ args.OpenSslSignerPrivateCertFile,
+ args.OpenSslOtherPublicCertFile,
+ args.OpenSslTrustedPublicCertFile,
+ args.SigningToolPath,
+ None
+ ))
+ #
+ # Perform additional verification on payload descriptors
+ #
+ for SinglePayloadDescriptor in PayloadDescriptorList:
+ try:
+ SinglePayloadDescriptor.Validate (args)
+ except Exception as Msg:
+ print ('GenerateCapsule: error:' + str(Msg))
+ sys.exit (1)
+ try:
+ Result = UefiCapsuleHeader.Decode (Buffer)
+ if len (Result) > 0:
+ Result = FmpCapsuleHeader.Decode (Result)
+ if args.JsonFile:
+ if FmpCapsuleHeader.PayloadItemCount != len (PayloadDescriptorList):
+ CapsulePayloadNum = FmpCapsuleHeader.PayloadItemCount
+ JsonPayloadNum = len (PayloadDescriptorList)
+ print ('GenerateCapsule: Decode error: {JsonPayloadNumber} payloads in JSON file {File} and {CapsulePayloadNumber} payloads in Capsule {CapsuleName}'.format (JsonPayloadNumber = JsonPayloadNum, File = args.JsonFile.name, CapsulePayloadNumber = CapsulePayloadNum, CapsuleName = args.InputFile.name))
+ sys.exit (1)
+ for Index in range (0, FmpCapsuleHeader.PayloadItemCount):
+ if Index < len (PayloadDescriptorList):
+ GUID = FmpCapsuleHeader.GetFmpCapsuleImageHeader (Index).UpdateImageTypeId
+ HardwareInstance = FmpCapsuleHeader.GetFmpCapsuleImageHeader (Index).UpdateHardwareInstance
+ UpdateImageIndex = FmpCapsuleHeader.GetFmpCapsuleImageHeader (Index).UpdateImageIndex
+ if PayloadDescriptorList[Index].Guid != GUID or PayloadDescriptorList[Index].HardwareInstance != HardwareInstance:
+ print ('GenerateCapsule: Decode error: Guid or HardwareInstance pair in input JSON file {File} does not match the payload {PayloadIndex} in Capsule {InputCapsule}'.format (File = args.JsonFile.name, PayloadIndex = Index + 1, InputCapsule = args.InputFile.name))
+ sys.exit (1)
+ PayloadDescriptorList[Index].Payload = FmpCapsuleHeader.GetFmpCapsuleImageHeader (Index).Payload
+ DecodeJsonOutput = args.OutputFile.name + '.Payload.{Index:d}.bin'.format (Index = Index + 1)
+ PayloadJsonDescriptorList.append (PayloadDescriptor (
+ DecodeJsonOutput,
+ GUID,
+ None,
+ None,
+ None,
+ HardwareInstance,
+ UpdateImageIndex,
+ PayloadDescriptorList[Index].SignToolPfxFile,
+ PayloadDescriptorList[Index].OpenSslSignerPrivateCertFile,
+ PayloadDescriptorList[Index].OpenSslOtherPublicCertFile,
+ PayloadDescriptorList[Index].OpenSslTrustedPublicCertFile,
+ PayloadDescriptorList[Index].SigningToolPath,
+ None
+ ))
+ else:
+ PayloadDescriptorList[0].Payload = FmpCapsuleHeader.GetFmpCapsuleImageHeader (0).Payload
+ for Index in range (0, FmpCapsuleHeader.PayloadItemCount):
+ if Index > 0:
+ PayloadDecodeFile = FmpCapsuleHeader.GetFmpCapsuleImageHeader (Index).Payload
+ PayloadDescriptorList.append (PayloadDescriptor (PayloadDecodeFile,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None
+ ))
+ GUID = FmpCapsuleHeader.GetFmpCapsuleImageHeader (Index).UpdateImageTypeId
+ HardwareInstance = FmpCapsuleHeader.GetFmpCapsuleImageHeader (Index).UpdateHardwareInstance
+ UpdateImageIndex = FmpCapsuleHeader.GetFmpCapsuleImageHeader (Index).UpdateImageIndex
+ DecodeJsonOutput = args.OutputFile.name + '.Payload.{Index:d}.bin'.format (Index = Index + 1)
+ PayloadJsonDescriptorList.append (PayloadDescriptor (
+ DecodeJsonOutput,
+ GUID,
+ None,
+ None,
+ None,
+ HardwareInstance,
+ UpdateImageIndex,
+ PayloadDescriptorList[Index].SignToolPfxFile,
+ PayloadDescriptorList[Index].OpenSslSignerPrivateCertFile,
+ PayloadDescriptorList[Index].OpenSslOtherPublicCertFile,
+ PayloadDescriptorList[Index].OpenSslTrustedPublicCertFile,
+ PayloadDescriptorList[Index].SigningToolPath,
+ None
+ ))
+ JsonIndex = 0
+ for SinglePayloadDescriptor in PayloadDescriptorList:
+ if args.Verbose:
+ print ('========')
+ UefiCapsuleHeader.DumpInfo ()
+ print ('--------')
+ FmpCapsuleHeader.DumpInfo ()
+ if FmpAuthHeader.IsSigned(SinglePayloadDescriptor.Payload):
+ if not SinglePayloadDescriptor.UseOpenSsl and not SinglePayloadDescriptor.UseSignTool:
+ print ('GenerateCapsule: decode warning: can not verify singed payload without cert or pfx file. Index = {Index}'.format (Index = JsonIndex + 1))
+ SinglePayloadDescriptor.Payload = FmpAuthHeader.Decode (SinglePayloadDescriptor.Payload)
+ PayloadJsonDescriptorList[JsonIndex].MonotonicCount = FmpAuthHeader.MonotonicCount
+ if args.Verbose:
+ print ('--------')
+ FmpAuthHeader.DumpInfo ()
+
+ #
+ # Verify Image with 64-bit MonotonicCount appended to end of image
+ #
+ try:
+ if SinglePayloadDescriptor.UseSignTool:
+ CertData = VerifyPayloadSignTool (
+ FmpAuthHeader.Payload + struct.pack ('<Q', FmpAuthHeader.MonotonicCount),
+ FmpAuthHeader.CertData,
+ SinglePayloadDescriptor.SigningToolPath,
+ SinglePayloadDescriptor.SignToolPfxFile,
+ Verbose = args.Verbose
+ )
+ else:
+ CertData = VerifyPayloadOpenSsl (
+ FmpAuthHeader.Payload + struct.pack ('<Q', FmpAuthHeader.MonotonicCount),
+ FmpAuthHeader.CertData,
+ SinglePayloadDescriptor.SigningToolPath,
+ SinglePayloadDescriptor.OpenSslSignerPrivateCertFile,
+ SinglePayloadDescriptor.OpenSslOtherPublicCertFile,
+ SinglePayloadDescriptor.OpenSslTrustedPublicCertFile,
+ Verbose = args.Verbose
+ )
+ except Exception as Msg:
+ print ('GenerateCapsule: warning: payload verification failed Index = {Index} \n'.format (Index = JsonIndex + 1) + str(Msg))
+ else:
+ if args.Verbose:
+ print ('--------')
+ print ('No EFI_FIRMWARE_IMAGE_AUTHENTICATION')
+
+ PayloadSignature = struct.unpack ('<I', SinglePayloadDescriptor.Payload[0:4])
+ if PayloadSignature != FmpPayloadHeader.Signature:
+ SinglePayloadDescriptor.UseDependency = True
+ try:
+ SinglePayloadDescriptor.Payload = CapsuleDependency.Decode (SinglePayloadDescriptor.Payload)
+ PayloadJsonDescriptorList[JsonIndex].DepexExp = CapsuleDependency.DepexExp
+ if args.Verbose:
+ print ('--------')
+ CapsuleDependency.DumpInfo ()
+ except Exception as Msg:
+ print ('GenerateCapsule: error: invalid dependency expression')
+ else:
+ if args.Verbose:
+ print ('--------')
+ print ('No EFI_FIRMWARE_IMAGE_DEP')
+
+ try:
+ SinglePayloadDescriptor.Payload = FmpPayloadHeader.Decode (SinglePayloadDescriptor.Payload)
+ PayloadJsonDescriptorList[JsonIndex].FwVersion = FmpPayloadHeader.FwVersion
+ PayloadJsonDescriptorList[JsonIndex].LowestSupportedVersion = FmpPayloadHeader.LowestSupportedVersion
+ JsonIndex = JsonIndex + 1
+ if args.Verbose:
+ print ('--------')
+ FmpPayloadHeader.DumpInfo ()
+ print ('========')
+ except:
+ if args.Verbose:
+ print ('--------')
+ print ('No FMP_PAYLOAD_HEADER')
+ print ('========')
+ sys.exit (1)
+ #
+ # Write embedded driver file(s)
+ #
+ for Index in range (0, FmpCapsuleHeader.EmbeddedDriverCount):
+ EmbeddedDriverBuffer = FmpCapsuleHeader.GetEmbeddedDriver (Index)
+ EmbeddedDriverPath = args.OutputFile.name + '.EmbeddedDriver.{Index:d}.efi'.format (Index = Index + 1)
+ try:
+ if args.Verbose:
+ print ('Write embedded driver file {File}'.format (File = EmbeddedDriverPath))
+ with open (EmbeddedDriverPath, 'wb') as EmbeddedDriverFile:
+ EmbeddedDriverFile.write (EmbeddedDriverBuffer)
+ except:
+ print ('GenerateCapsule: error: can not write embedded driver file {File}'.format (File = EmbeddedDriverPath))
+ sys.exit (1)
+
+ except:
+ print ('GenerateCapsule: error: can not decode capsule')
+ sys.exit (1)
+ GenerateOutputJson(PayloadJsonDescriptorList)
+ PayloadIndex = 0
+ for SinglePayloadDescriptor in PayloadDescriptorList:
+ if args.OutputFile is None:
+ print ('GenerateCapsule: Decode error: OutputFile is needed for decode output')
+ sys.exit (1)
+ try:
+ if args.Verbose:
+ print ('Write binary output file {File}'.format (File = args.OutputFile.name))
+ PayloadDecodePath = args.OutputFile.name + '.Payload.{Index:d}.bin'.format (Index = PayloadIndex + 1)
+ with open (PayloadDecodePath, 'wb') as PayloadDecodeFile:
+ PayloadDecodeFile.write (SinglePayloadDescriptor.Payload)
+ PayloadIndex = PayloadIndex + 1
+ except:
+ print ('GenerateCapsule: error: can not write binary output file {File}'.format (File = SinglePayloadDescriptor.OutputFile.name))
+ sys.exit (1)
+
+ def DumpInfo (Buffer, args):
+ if args.OutputFile is not None:
+ raise argparse.ArgumentTypeError ('the following option is not supported for dumpinfo operations: --output')
+ try:
+ Result = UefiCapsuleHeader.Decode (Buffer)
+ print ('========')
+ UefiCapsuleHeader.DumpInfo ()
+ if len (Result) > 0:
+ FmpCapsuleHeader.Decode (Result)
+ print ('--------')
+ FmpCapsuleHeader.DumpInfo ()
+ for Index in range (0, FmpCapsuleHeader.PayloadItemCount):
+ Result = FmpCapsuleHeader.GetFmpCapsuleImageHeader (Index).Payload
+ try:
+ Result = FmpAuthHeader.Decode (Result)
+ print ('--------')
+ FmpAuthHeader.DumpInfo ()
+ except:
+ print ('--------')
+ print ('No EFI_FIRMWARE_IMAGE_AUTHENTICATION')
+
+ PayloadSignature = struct.unpack ('<I', Result[0:4])
+ if PayloadSignature != FmpPayloadHeader.Signature:
+ try:
+ Result = CapsuleDependency.Decode (Result)
+ print ('--------')
+ CapsuleDependency.DumpInfo ()
+ except:
+ print ('GenerateCapsule: error: invalid dependency expression')
+ else:
+ print ('--------')
+ print ('No EFI_FIRMWARE_IMAGE_DEP')
+ try:
+ Result = FmpPayloadHeader.Decode (Result)
+ print ('--------')
+ FmpPayloadHeader.DumpInfo ()
+ except:
+ print ('--------')
+ print ('No FMP_PAYLOAD_HEADER')
+ print ('========')
+ except:
+ print ('GenerateCapsule: error: can not decode capsule')
+ sys.exit (1)
+ #
+ # Create command line argument parser object
+ #
+ parser = argparse.ArgumentParser (
+ prog = __prog__,
+ description = __description__ + __copyright__,
+ conflict_handler = 'resolve',
+ fromfile_prefix_chars = '@'
+ )
+ parser.convert_arg_line_to_args = convert_arg_line_to_args
+
+ #
+ # Add input and output file arguments
+ #
+ parser.add_argument("InputFile", type = argparse.FileType('rb'), nargs='?',
+ help = "Input binary payload filename.")
+ parser.add_argument("-o", "--output", dest = 'OutputFile', type = argparse.FileType('wb'),
+ help = "Output filename.")
+ #
+ # Add group for -e and -d flags that are mutually exclusive and required
+ #
+ group = parser.add_mutually_exclusive_group (required = True)
+ group.add_argument ("-e", "--encode", dest = 'Encode', action = "store_true",
+ help = "Encode file")
+ group.add_argument ("-d", "--decode", dest = 'Decode', action = "store_true",
+ help = "Decode file")
+ group.add_argument ("--dump-info", dest = 'DumpInfo', action = "store_true",
+ help = "Display FMP Payload Header information")
+ #
+ # Add optional arguments for this command
+ #
+ parser.add_argument ("-j", "--json-file", dest = 'JsonFile', type=argparse.FileType('r'),
+ help = "JSON configuration file for multiple payloads and embedded drivers.")
+ parser.add_argument ("--capflag", dest = 'CapsuleFlag', action='append', default = [],
+ choices=['PersistAcrossReset', 'InitiateReset'],
+ help = "Capsule flag can be PersistAcrossReset or InitiateReset or not set")
+ parser.add_argument ("--capoemflag", dest = 'CapsuleOemFlag', type = ValidateUnsignedInteger, default = 0x0000,
+ help = "Capsule OEM Flag is an integer between 0x0000 and 0xffff.")
+
+ parser.add_argument ("--guid", dest = 'Guid', type = ValidateRegistryFormatGuid,
+ help = "The FMP/ESRT GUID in registry format. Required for single payload encode operations.")
+ parser.add_argument ("--hardware-instance", dest = 'HardwareInstance', type = ValidateUnsignedInteger, default = 0x0000000000000000,
+ help = "The 64-bit hardware instance. The default is 0x0000000000000000")
+
+
+ parser.add_argument ("--monotonic-count", dest = 'MonotonicCount', type = ValidateUnsignedInteger, default = 0x0000000000000000,
+ help = "64-bit monotonic count value in header. Default is 0x0000000000000000.")
+
+ parser.add_argument ("--fw-version", dest = 'FwVersion', type = ValidateUnsignedInteger,
+ help = "The 32-bit version of the binary payload (e.g. 0x11223344 or 5678). Required for encode operations.")
+ parser.add_argument ("--lsv", dest = 'LowestSupportedVersion', type = ValidateUnsignedInteger,
+ help = "The 32-bit lowest supported version of the binary payload (e.g. 0x11223344 or 5678). Required for encode operations.")
+
+ parser.add_argument ("--pfx-file", dest='SignToolPfxFile', type=argparse.FileType('rb'),
+ help="signtool PFX certificate filename.")
+
+ parser.add_argument ("--signer-private-cert", dest='OpenSslSignerPrivateCertFile', type=argparse.FileType('rb'),
+ help="OpenSSL signer private certificate filename.")
+ parser.add_argument ("--other-public-cert", dest='OpenSslOtherPublicCertFile', type=argparse.FileType('rb'),
+ help="OpenSSL other public certificate filename.")
+ parser.add_argument ("--trusted-public-cert", dest='OpenSslTrustedPublicCertFile', type=argparse.FileType('rb'),
+ help="OpenSSL trusted public certificate filename.")
+
+ parser.add_argument ("--signing-tool-path", dest = 'SigningToolPath',
+ help = "Path to signtool or OpenSSL tool. Optional if path to tools are already in PATH.")
+
+ parser.add_argument ("--embedded-driver", dest = 'EmbeddedDriver', type = argparse.FileType('rb'), action='append', default = [],
+ help = "Path to embedded UEFI driver to add to capsule.")
+
+ #
+ # Add optional arguments common to all operations
+ #
+ parser.add_argument ('--version', action='version', version='%(prog)s ' + __version__)
+ parser.add_argument ("-v", "--verbose", dest = 'Verbose', action = "store_true",
+ help = "Turn on verbose output with informational messages printed, including capsule headers and warning messages.")
+ parser.add_argument ("-q", "--quiet", dest = 'Quiet', action = "store_true",
+ help = "Disable all messages except fatal errors.")
+ parser.add_argument ("--debug", dest = 'Debug', type = int, metavar = '[0-9]', choices = range (0, 10), default = 0,
+ help = "Set debug level")
+ parser.add_argument ("--update-image-index", dest = 'UpdateImageIndex', type = ValidateUnsignedInteger, default = 0x01, help = "unique number identifying the firmware image within the device ")
+
+ #
+ # Parse command line arguments
+ #
+ args = parser.parse_args()
+
+ #
+ # Read binary input file
+ #
+ Buffer = ''
+ if args.InputFile:
+ if os.path.getsize (args.InputFile.name) == 0:
+ print ('GenerateCapsule: error: InputFile {File} is empty'.format (File = args.InputFile.name))
+ sys.exit (1)
+ try:
+ if args.Verbose:
+ print ('Read binary input file {File}'.format (File = args.InputFile.name))
+ Buffer = args.InputFile.read ()
+ args.InputFile.close ()
+ except:
+ print ('GenerateCapsule: error: can not read binary input file {File}'.format (File = args.InputFile.name))
+ sys.exit (1)
+
+ #
+ # Create objects
+ #
+ UefiCapsuleHeader = UefiCapsuleHeaderClass ()
+ FmpCapsuleHeader = FmpCapsuleHeaderClass ()
+ FmpAuthHeader = FmpAuthHeaderClass ()
+ FmpPayloadHeader = FmpPayloadHeaderClass ()
+ CapsuleDependency = CapsuleDependencyClass ()
+
+ EmbeddedDriverDescriptorList = []
+ PayloadDescriptorList = []
+ PayloadJsonDescriptorList = []
+
+ #
+ #Encode Operation
+ #
+ if args.Encode:
+ Encode (PayloadDescriptorList, EmbeddedDriverDescriptorList, Buffer)
+
+ #
+ #Decode Operation
+ #
+ if args.Decode:
+ Decode (PayloadDescriptorList, PayloadJsonDescriptorList, Buffer)
+
+ #
+ #Dump Info Operation
+ #
+ if args.DumpInfo:
+ DumpInfo (Buffer, args)
+
+ if args.Verbose:
+ print('Success')
diff --git a/roms/edk2/BaseTools/Source/Python/Capsule/GenerateWindowsDriver.py b/roms/edk2/BaseTools/Source/Python/Capsule/GenerateWindowsDriver.py
new file mode 100644
index 000000000..bea7a0df3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Capsule/GenerateWindowsDriver.py
@@ -0,0 +1,120 @@
+## @file
+# Generate a capsule windows driver.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+GenerateWindowsDriver
+'''
+
+import sys
+import argparse
+import uuid
+import struct
+import subprocess
+import os
+import tempfile
+import shutil
+import platform
+import re
+import logging
+from WindowsCapsuleSupportHelper import WindowsCapsuleSupportHelper
+from Common.Uefi.Capsule.FmpCapsuleHeader import FmpCapsuleHeaderClass
+from Common.Uefi.Capsule.UefiCapsuleHeader import UefiCapsuleHeaderClass
+
+#
+# Globals for help information
+#
+__prog__ = 'GenerateWindowsDriver'
+__version__ = '0.0'
+__copyright__ = 'Copyright (c) 2019, Intel Corporation. All rights reserved.'
+__description__ = 'Generate Capsule Windows Driver.\n'
+
+def GetCapGuid (InputFile):
+ with open(InputFile, 'rb') as File:
+ Buffer = File.read()
+ try:
+ Result = UefiCapsuleHeader.Decode (Buffer)
+ if len (Result) > 0:
+ FmpCapsuleHeader.Decode (Result)
+ for index in range (0, FmpCapsuleHeader.PayloadItemCount):
+ Guid = FmpCapsuleHeader.GetFmpCapsuleImageHeader (index).UpdateImageTypeId
+ return Guid
+ except:
+ print ('GenerateCapsule: error: can not decode capsule')
+ sys.exit (1)
+
+def ArgCheck(args):
+ Version = args.CapsuleVersion_DotString.split('.')
+
+ if len(Version) != 4:
+ logging.critical("Name invalid: '%s'", args.CapsuleVersion_DotString)
+ raise ValueError("Name invalid.")
+ for sub in Version:
+ if int(sub, 16) > 65536:
+ logging.critical("Name invalid: '%s'", args.CapsuleVersion_DotString)
+ raise ValueError("Name exceed limit 65536.")
+
+ if not (re.compile(r'[\a-fA-F0-9]*$')).match(args.CapsuleVersion_DotString):
+ logging.critical("Name invalid: '%s'", args.CapsuleVersion_DotString)
+ raise ValueError("Name has invalid chars.")
+
+def CapsuleGuidCheck(InputFile, Guid):
+ CapGuid = GetCapGuid(InputFile)
+ if (str(Guid).lower() != str(CapGuid)):
+ print('GenerateWindowsDriver error: Different Guid from Capsule')
+ sys.exit(1)
+
+if __name__ == '__main__':
+ def convert_arg_line_to_args(arg_line):
+ for arg in arg_line.split():
+ if not arg.strip():
+ continue
+ yield arg
+
+ parser = argparse.ArgumentParser (
+ prog = __prog__,
+ description = __description__ + __copyright__,
+ conflict_handler = 'resolve',
+ fromfile_prefix_chars = '@'
+ )
+ parser.convert_arg_line_to_args = convert_arg_line_to_args
+ parser.add_argument("--output-folder", dest = 'OutputFolder', help = "firmware resource update driver package output folder.")
+ parser.add_argument("--product-fmp-guid", dest = 'ProductFmpGuid', help = "firmware GUID of resource update driver package")
+ parser.add_argument("--capsuleversion-dotstring", dest = 'CapsuleVersion_DotString', help = "firmware version with date on which update driver package is authored")
+ parser.add_argument("--capsuleversion-hexstring", dest = 'CapsuleVersion_HexString', help = "firmware version in Hex of update driver package")
+ parser.add_argument("--product-fw-provider", dest = 'ProductFwProvider', help = "vendor/provider of entire firmware resource update driver package")
+ parser.add_argument("--product-fw-mfg-name", dest = 'ProductFwMfgName', help = "manufacturer/vendor of firmware resource update driver package")
+ parser.add_argument("--product-fw-desc", dest = "ProductFwDesc", help = "description about resource update driver")
+ parser.add_argument("--capsule-file-name", dest = 'CapsuleFileName', help ="firmware resource image file")
+ parser.add_argument("--pfx-file", dest = 'PfxFile', help = "pfx file path used to sign resource update driver")
+ parser.add_argument("--arch", dest = 'Arch', help = "supported architecture:arm/x64/amd64/arm64/aarch64", default = 'amd64')
+ parser.add_argument("--operating-system-string", dest = 'OperatingSystemString', help = "supported operating system:win10/10/10_au/10_rs2/10_rs3/10_rs4/server10/server2016/serverrs2/serverrs3/serverrs4", default = "win10")
+
+ args = parser.parse_args()
+ InputFile = os.path.join(args.OutputFolder, '') + args.CapsuleFileName
+ UefiCapsuleHeader = UefiCapsuleHeaderClass ()
+ FmpCapsuleHeader = FmpCapsuleHeaderClass ()
+ CapsuleGuidCheck(InputFile, args.ProductFmpGuid)
+ ArgCheck(args)
+ ProductName = os.path.splitext(args.CapsuleFileName)[0]
+ WindowsDriver = WindowsCapsuleSupportHelper ()
+
+ WindowsDriver.PackageWindowsCapsuleFiles (
+ args.OutputFolder,
+ ProductName,
+ args.ProductFmpGuid,
+ args.CapsuleVersion_DotString,
+ args.CapsuleVersion_HexString,
+ args.ProductFwProvider,
+ args.ProductFwMfgName,
+ args.ProductFwDesc,
+ args.CapsuleFileName,
+ args.PfxFile,
+ None,
+ None,
+ args.Arch,
+ args.OperatingSystemString
+ )
diff --git a/roms/edk2/BaseTools/Source/Python/Capsule/WindowsCapsuleSupportHelper.py b/roms/edk2/BaseTools/Source/Python/Capsule/WindowsCapsuleSupportHelper.py
new file mode 100644
index 000000000..a29ac21ae
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Capsule/WindowsCapsuleSupportHelper.py
@@ -0,0 +1,64 @@
+##
+# UefiBuild Plugin that supports Window Capsule files based on the
+# Windows Firmware Update Platform spec.
+# Creates INF, Cat, and then signs it
+#
+# To install run pip install --upgrade edk2-pytool-library
+# edk2-pytool-library-0.9.1 is required.
+#
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+import sys
+import re
+import datetime
+import os
+import logging
+from edk2toollib.windows.capsule.cat_generator import CatGenerator
+from edk2toollib.windows.capsule.inf_generator import InfGenerator
+from edk2toollib.utility_functions import CatalogSignWithSignTool
+from edk2toollib.windows.locate_tools import FindToolInWinSdk
+
+class WindowsCapsuleSupportHelper(object):
+
+ def RegisterHelpers(self, obj):
+ fp = os.path.abspath(__file__)
+ obj.Register("PackageWindowsCapsuleFiles", WindowsCapsuleSupportHelper.PackageWindowsCapsuleFiles, fp)
+
+
+ @staticmethod
+ def PackageWindowsCapsuleFiles(OutputFolder, ProductName, ProductFmpGuid, CapsuleVersion_DotString,
+ CapsuleVersion_HexString, ProductFwProvider, ProductFwMfgName, ProductFwDesc, CapsuleFileName, PfxFile=None, PfxPass=None,
+ Rollback=False, Arch='amd64', OperatingSystem_String='Win10'):
+
+ logging.debug("CapsulePackage: Create Windows Capsule Files")
+
+ #Make INF
+ InfFilePath = os.path.join(OutputFolder, ProductName + ".inf")
+ InfTool = InfGenerator(ProductName, ProductFwProvider, ProductFmpGuid, Arch, ProductFwDesc, CapsuleVersion_DotString, CapsuleVersion_HexString)
+ InfTool.Manufacturer = ProductFwMfgName #optional
+ ret = InfTool.MakeInf(InfFilePath, CapsuleFileName, Rollback)
+ if(ret != 0):
+ raise Exception("CreateWindowsInf Failed with errorcode %d" % ret)
+
+ #Make CAT
+ CatFilePath = os.path.realpath(os.path.join(OutputFolder, ProductName + ".cat"))
+ CatTool = CatGenerator(Arch, OperatingSystem_String)
+ ret = CatTool.MakeCat(CatFilePath)
+
+ if(ret != 0):
+ raise Exception("Creating Cat file Failed with errorcode %d" % ret)
+
+ if(PfxFile is not None):
+ #Find Signtool
+ SignToolPath = FindToolInWinSdk("signtool.exe")
+ if not os.path.exists(SignToolPath):
+ raise Exception("Can't find signtool on this machine.")
+ #dev sign the cat file
+ ret = CatalogSignWithSignTool(SignToolPath, CatFilePath, PfxFile, PfxPass)
+ if(ret != 0):
+ raise Exception("Signing Cat file Failed with errorcode %d" % ret)
+
+ return ret
diff --git a/roms/edk2/BaseTools/Source/Python/Common/BuildToolError.py b/roms/edk2/BaseTools/Source/Python/Common/BuildToolError.py
new file mode 100644
index 000000000..21549683c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/BuildToolError.py
@@ -0,0 +1,160 @@
+## @file
+# Standardized Error Handling infrastructures.
+#
+# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+FILE_OPEN_FAILURE = 1
+FILE_WRITE_FAILURE = 2
+FILE_PARSE_FAILURE = 3
+FILE_READ_FAILURE = 4
+FILE_CREATE_FAILURE = 5
+FILE_CHECKSUM_FAILURE = 6
+FILE_COMPRESS_FAILURE = 7
+FILE_DECOMPRESS_FAILURE = 8
+FILE_MOVE_FAILURE = 9
+FILE_DELETE_FAILURE = 10
+FILE_COPY_FAILURE = 11
+FILE_POSITIONING_FAILURE = 12
+FILE_ALREADY_EXIST = 13
+FILE_NOT_FOUND = 14
+FILE_TYPE_MISMATCH = 15
+FILE_CASE_MISMATCH = 16
+FILE_DUPLICATED = 17
+FILE_UNKNOWN_ERROR = 0x0FFF
+
+OPTION_UNKNOWN = 0x1000
+OPTION_MISSING = 0x1001
+OPTION_CONFLICT = 0x1002
+OPTION_VALUE_INVALID = 0x1003
+OPTION_DEPRECATED = 0x1004
+OPTION_NOT_SUPPORTED = 0x1005
+OPTION_UNKNOWN_ERROR = 0x1FFF
+
+PARAMETER_INVALID = 0x2000
+PARAMETER_MISSING = 0x2001
+PARAMETER_UNKNOWN_ERROR =0x2FFF
+
+FORMAT_INVALID = 0x3000
+FORMAT_NOT_SUPPORTED = 0x3001
+FORMAT_UNKNOWN = 0x3002
+FORMAT_UNKNOWN_ERROR = 0x3FFF
+
+RESOURCE_NOT_AVAILABLE = 0x4000
+RESOURCE_ALLOCATE_FAILURE = 0x4001
+RESOURCE_FULL = 0x4002
+RESOURCE_OVERFLOW = 0x4003
+RESOURCE_UNDERRUN = 0x4004
+RESOURCE_UNKNOWN_ERROR = 0x4FFF
+
+ATTRIBUTE_NOT_AVAILABLE = 0x5000
+ATTRIBUTE_GET_FAILURE = 0x5001
+ATTRIBUTE_SET_FAILURE = 0x5002
+ATTRIBUTE_UPDATE_FAILURE = 0x5003
+ATTRIBUTE_ACCESS_DENIED = 0x5004
+ATTRIBUTE_UNKNOWN_ERROR = 0x5FFF
+
+IO_NOT_READY = 0x6000
+IO_BUSY = 0x6001
+IO_TIMEOUT = 0x6002
+IO_UNKNOWN_ERROR = 0x6FFF
+
+COMMAND_FAILURE = 0x7000
+
+PERMISSION_FAILURE = 0x8000
+
+FV_FREESIZE_ERROR = 0x9000
+
+CODE_ERROR = 0xC0DE
+
+AUTOGEN_ERROR = 0xF000
+PARSER_ERROR = 0xF001
+BUILD_ERROR = 0xF002
+GENFDS_ERROR = 0xF003
+ECC_ERROR = 0xF004
+EOT_ERROR = 0xF005
+PREBUILD_ERROR = 0xF007
+POSTBUILD_ERROR = 0xF008
+DDC_ERROR = 0xF009
+WARNING_AS_ERROR = 0xF006
+MIGRATION_ERROR = 0xF010
+PCD_VALIDATION_INFO_ERROR = 0xF011
+PCD_VARIABLE_ATTRIBUTES_ERROR = 0xF012
+PCD_VARIABLE_INFO_ERROR = 0xF016
+PCD_VARIABLE_ATTRIBUTES_CONFLICT_ERROR = 0xF013
+PCD_STRUCTURE_PCD_INVALID_FIELD_ERROR = 0xF014
+PCD_STRUCTURE_PCD_ERROR = 0xF015
+ERROR_STATEMENT = 0xFFFD
+ABORT_ERROR = 0xFFFE
+UNKNOWN_ERROR = 0xFFFF
+
+## Error message of each error code
+gErrorMessage = {
+ FILE_NOT_FOUND : "File/directory not found in workspace",
+ FILE_OPEN_FAILURE : "File open failure",
+ FILE_WRITE_FAILURE : "File write failure",
+ FILE_PARSE_FAILURE : "File parse failure",
+ FILE_READ_FAILURE : "File read failure",
+ FILE_CREATE_FAILURE : "File create failure",
+ FILE_CHECKSUM_FAILURE : "Invalid checksum of file",
+ FILE_COMPRESS_FAILURE : "File compress failure",
+ FILE_DECOMPRESS_FAILURE : "File decompress failure",
+ FILE_MOVE_FAILURE : "File move failure",
+ FILE_DELETE_FAILURE : "File delete failure",
+ FILE_COPY_FAILURE : "File copy failure",
+ FILE_POSITIONING_FAILURE: "Failed to seeking position",
+ FILE_ALREADY_EXIST : "File or directory already exists",
+ FILE_TYPE_MISMATCH : "Incorrect file type",
+ FILE_CASE_MISMATCH : "File name case mismatch",
+ FILE_DUPLICATED : "Duplicated file found",
+ FILE_UNKNOWN_ERROR : "Unknown error encountered on file",
+
+ OPTION_UNKNOWN : "Unknown option",
+ OPTION_MISSING : "Missing option",
+ OPTION_CONFLICT : "Conflict options",
+ OPTION_VALUE_INVALID : "Invalid value of option",
+ OPTION_DEPRECATED : "Deprecated option",
+ OPTION_NOT_SUPPORTED : "Unsupported option",
+ OPTION_UNKNOWN_ERROR : "Unknown error when processing options",
+
+ PARAMETER_INVALID : "Invalid parameter",
+ PARAMETER_MISSING : "Missing parameter",
+ PARAMETER_UNKNOWN_ERROR : "Unknown error in parameters",
+
+ FORMAT_INVALID : "Invalid syntax/format",
+ FORMAT_NOT_SUPPORTED : "Not supported syntax/format",
+ FORMAT_UNKNOWN : "Unknown format",
+ FORMAT_UNKNOWN_ERROR : "Unknown error in syntax/format ",
+
+ RESOURCE_NOT_AVAILABLE : "Not available",
+ RESOURCE_ALLOCATE_FAILURE : "Allocate failure",
+ RESOURCE_FULL : "Full",
+ RESOURCE_OVERFLOW : "Overflow",
+ RESOURCE_UNDERRUN : "Underrun",
+ RESOURCE_UNKNOWN_ERROR : "Unknown error",
+
+ ATTRIBUTE_NOT_AVAILABLE : "Not available",
+ ATTRIBUTE_GET_FAILURE : "Failed to retrieve",
+ ATTRIBUTE_SET_FAILURE : "Failed to set",
+ ATTRIBUTE_UPDATE_FAILURE: "Failed to update",
+ ATTRIBUTE_ACCESS_DENIED : "Access denied",
+ ATTRIBUTE_UNKNOWN_ERROR : "Unknown error when accessing",
+
+ COMMAND_FAILURE : "Failed to execute command",
+
+ IO_NOT_READY : "Not ready",
+ IO_BUSY : "Busy",
+ IO_TIMEOUT : "Timeout",
+ IO_UNKNOWN_ERROR : "Unknown error in IO operation",
+
+ ERROR_STATEMENT : "!error statement",
+ UNKNOWN_ERROR : "Unknown error",
+}
+
+## Exception indicating a fatal error
+class FatalError(Exception):
+ pass
+
+if __name__ == "__main__":
+ pass
diff --git a/roms/edk2/BaseTools/Source/Python/Common/BuildVersion.py b/roms/edk2/BaseTools/Source/Python/Common/BuildVersion.py
new file mode 100644
index 000000000..088609f54
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/BuildVersion.py
@@ -0,0 +1,10 @@
+## @file
+#
+# This file is for build version number auto generation
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+gBUILD_VERSION = "Developer Build based on Revision: Unknown"
diff --git a/roms/edk2/BaseTools/Source/Python/Common/DataType.py b/roms/edk2/BaseTools/Source/Python/Common/DataType.py
new file mode 100644
index 000000000..fb88f20cc
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/DataType.py
@@ -0,0 +1,539 @@
+## @file
+# This file is used to define common static strings used by INF/DEC/DSC files
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
+# Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+##
+# Common Definitions
+#
+TAB_SPLIT = '.'
+TAB_COMMENT_EDK_START = '/*'
+TAB_COMMENT_EDK_END = '*/'
+TAB_COMMENT_EDK_SPLIT = '//'
+TAB_COMMENT_SPLIT = '#'
+TAB_SPECIAL_COMMENT = '##'
+TAB_EQUAL_SPLIT = '='
+TAB_VALUE_SPLIT = '|'
+TAB_COMMA_SPLIT = ','
+TAB_SPACE_SPLIT = ' '
+TAB_SEMI_COLON_SPLIT = ';'
+TAB_SECTION_START = '['
+TAB_SECTION_END = ']'
+TAB_OPTION_START = '<'
+TAB_OPTION_END = '>'
+TAB_SLASH = '\\'
+TAB_BACK_SLASH = '/'
+TAB_STAR = '*'
+TAB_LINE_BREAK = '\n'
+TAB_PRINTCHAR_VT = '\x0b'
+TAB_PRINTCHAR_BS = '\b'
+TAB_PRINTCHAR_NUL = '\0'
+TAB_UINT8 = 'UINT8'
+TAB_UINT16 = 'UINT16'
+TAB_UINT32 = 'UINT32'
+TAB_UINT64 = 'UINT64'
+TAB_VOID = 'VOID*'
+TAB_GUID = 'GUID'
+
+TAB_PCD_CLEAN_NUMERIC_TYPES = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64}
+TAB_PCD_NUMERIC_TYPES = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BOOLEAN'}
+TAB_PCD_NUMERIC_TYPES_VOID = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BOOLEAN', TAB_VOID}
+
+TAB_WORKSPACE = '$(WORKSPACE)'
+TAB_FV_DIRECTORY = 'FV'
+
+TAB_ARCH_NULL = ''
+TAB_ARCH_COMMON = 'COMMON'
+TAB_ARCH_IA32 = 'IA32'
+TAB_ARCH_X64 = 'X64'
+TAB_ARCH_ARM = 'ARM'
+TAB_ARCH_EBC = 'EBC'
+TAB_ARCH_AARCH64 = 'AARCH64'
+
+TAB_ARCH_RISCV64 = 'RISCV64'
+
+ARCH_SET_FULL = {TAB_ARCH_IA32, TAB_ARCH_X64, TAB_ARCH_ARM, TAB_ARCH_EBC, TAB_ARCH_AARCH64, TAB_ARCH_RISCV64, TAB_ARCH_COMMON}
+
+SUP_MODULE_BASE = 'BASE'
+SUP_MODULE_SEC = 'SEC'
+SUP_MODULE_PEI_CORE = 'PEI_CORE'
+SUP_MODULE_PEIM = 'PEIM'
+SUP_MODULE_DXE_CORE = 'DXE_CORE'
+SUP_MODULE_DXE_DRIVER = 'DXE_DRIVER'
+SUP_MODULE_DXE_RUNTIME_DRIVER = 'DXE_RUNTIME_DRIVER'
+SUP_MODULE_DXE_SAL_DRIVER = 'DXE_SAL_DRIVER'
+SUP_MODULE_DXE_SMM_DRIVER = 'DXE_SMM_DRIVER'
+SUP_MODULE_UEFI_DRIVER = 'UEFI_DRIVER'
+SUP_MODULE_UEFI_APPLICATION = 'UEFI_APPLICATION'
+SUP_MODULE_USER_DEFINED = 'USER_DEFINED'
+SUP_MODULE_HOST_APPLICATION = 'HOST_APPLICATION'
+SUP_MODULE_SMM_CORE = 'SMM_CORE'
+SUP_MODULE_MM_STANDALONE = 'MM_STANDALONE'
+SUP_MODULE_MM_CORE_STANDALONE = 'MM_CORE_STANDALONE'
+
+SUP_MODULE_LIST = [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER, \
+ SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_UEFI_DRIVER, \
+ SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE]
+SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
+SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE}
+
+EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY'
+EDK_COMPONENT_TYPE_SECURITY_CORE = 'SECURITY_CORE'
+EDK_COMPONENT_TYPE_PEI_CORE = SUP_MODULE_PEI_CORE
+EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER = 'COMBINED_PEIM_DRIVER'
+EDK_COMPONENT_TYPE_PIC_PEIM = 'PIC_PEIM'
+EDK_COMPONENT_TYPE_RELOCATABLE_PEIM = 'RELOCATABLE_PEIM'
+EDK_COMPONENT_TYPE_BS_DRIVER = 'BS_DRIVER'
+EDK_COMPONENT_TYPE_RT_DRIVER = 'RT_DRIVER'
+EDK_COMPONENT_TYPE_SAL_RT_DRIVER = 'SAL_RT_DRIVER'
+EDK_COMPONENT_TYPE_APPLICATION = 'APPLICATION'
+EDK_NAME = 'EDK'
+EDKII_NAME = 'EDKII'
+MSG_EDKII_MAIL_ADDR = 'devel@edk2.groups.io'
+
+COMPONENT_TO_MODULE_MAP_DICT = {
+ EDK_COMPONENT_TYPE_LIBRARY : SUP_MODULE_BASE,
+ EDK_COMPONENT_TYPE_SECURITY_CORE : SUP_MODULE_SEC,
+ EDK_COMPONENT_TYPE_PEI_CORE : SUP_MODULE_PEI_CORE,
+ EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER : SUP_MODULE_PEIM,
+ EDK_COMPONENT_TYPE_PIC_PEIM : SUP_MODULE_PEIM,
+ EDK_COMPONENT_TYPE_RELOCATABLE_PEIM : SUP_MODULE_PEIM,
+ "PE32_PEIM" : SUP_MODULE_PEIM,
+ EDK_COMPONENT_TYPE_BS_DRIVER : SUP_MODULE_DXE_DRIVER,
+ EDK_COMPONENT_TYPE_RT_DRIVER : SUP_MODULE_DXE_RUNTIME_DRIVER,
+ EDK_COMPONENT_TYPE_SAL_RT_DRIVER : SUP_MODULE_DXE_SAL_DRIVER,
+ EDK_COMPONENT_TYPE_APPLICATION : SUP_MODULE_UEFI_APPLICATION,
+ "LOGO" : SUP_MODULE_BASE,
+}
+
+BINARY_FILE_TYPE_FW = 'FW'
+BINARY_FILE_TYPE_GUID = 'GUID'
+BINARY_FILE_TYPE_PREEFORM = 'PREEFORM'
+BINARY_FILE_TYPE_UEFI_APP = 'UEFI_APP'
+BINARY_FILE_TYPE_UNI_UI = 'UNI_UI'
+BINARY_FILE_TYPE_UNI_VER = 'UNI_VER'
+BINARY_FILE_TYPE_LIB = 'LIB'
+BINARY_FILE_TYPE_PE32 = 'PE32'
+BINARY_FILE_TYPE_PIC = 'PIC'
+BINARY_FILE_TYPE_PEI_DEPEX = 'PEI_DEPEX'
+BINARY_FILE_TYPE_DXE_DEPEX = 'DXE_DEPEX'
+BINARY_FILE_TYPE_SMM_DEPEX = 'SMM_DEPEX'
+BINARY_FILE_TYPE_TE = 'TE'
+BINARY_FILE_TYPE_VER = 'VER'
+BINARY_FILE_TYPE_UI = 'UI'
+BINARY_FILE_TYPE_BIN = 'BIN'
+BINARY_FILE_TYPE_FV = 'FV'
+BINARY_FILE_TYPE_RAW = 'RAW_BINARY'
+
+PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS = 'LIBRARY_CLASS'
+PLATFORM_COMPONENT_TYPE_MODULE = 'MODULE'
+
+TAB_SOURCES = 'Sources'
+TAB_SOURCES_COMMON = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_SOURCES_IA32 = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_IA32
+TAB_SOURCES_X64 = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_X64
+TAB_SOURCES_ARM = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_ARM
+TAB_SOURCES_EBC = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_EBC
+TAB_SOURCES_AARCH64 = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_BINARIES = 'Binaries'
+TAB_BINARIES_COMMON = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_BINARIES_IA32 = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_IA32
+TAB_BINARIES_X64 = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_X64
+TAB_BINARIES_ARM = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_ARM
+TAB_BINARIES_EBC = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_EBC
+TAB_BINARIES_AARCH64 = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_INCLUDES = 'Includes'
+TAB_INCLUDES_COMMON = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_INCLUDES_IA32 = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_IA32
+TAB_INCLUDES_X64 = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_X64
+TAB_INCLUDES_ARM = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_ARM
+TAB_INCLUDES_EBC = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_EBC
+TAB_INCLUDES_AARCH64 = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_GUIDS = 'Guids'
+TAB_GUIDS_COMMON = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_GUIDS_IA32 = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_IA32
+TAB_GUIDS_X64 = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_X64
+TAB_GUIDS_ARM = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_ARM
+TAB_GUIDS_EBC = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_EBC
+TAB_GUIDS_AARCH64 = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_PROTOCOLS = 'Protocols'
+TAB_PROTOCOLS_COMMON = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_PROTOCOLS_IA32 = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_IA32
+TAB_PROTOCOLS_X64 = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_X64
+TAB_PROTOCOLS_ARM = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_ARM
+TAB_PROTOCOLS_EBC = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_EBC
+TAB_PROTOCOLS_AARCH64 = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_PPIS = 'Ppis'
+TAB_PPIS_COMMON = TAB_PPIS + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_PPIS_IA32 = TAB_PPIS + TAB_SPLIT + TAB_ARCH_IA32
+TAB_PPIS_X64 = TAB_PPIS + TAB_SPLIT + TAB_ARCH_X64
+TAB_PPIS_ARM = TAB_PPIS + TAB_SPLIT + TAB_ARCH_ARM
+TAB_PPIS_EBC = TAB_PPIS + TAB_SPLIT + TAB_ARCH_EBC
+TAB_PPIS_AARCH64 = TAB_PPIS + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_LIBRARY_CLASSES = 'LibraryClasses'
+TAB_LIBRARY_CLASSES_COMMON = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_LIBRARY_CLASSES_IA32 = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_IA32
+TAB_LIBRARY_CLASSES_X64 = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_X64
+TAB_LIBRARY_CLASSES_ARM = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_ARM
+TAB_LIBRARY_CLASSES_EBC = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_EBC
+TAB_LIBRARY_CLASSES_AARCH64 = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_PACKAGES = 'Packages'
+TAB_PACKAGES_COMMON = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_PACKAGES_IA32 = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_IA32
+TAB_PACKAGES_X64 = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_X64
+TAB_PACKAGES_ARM = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_ARM
+TAB_PACKAGES_EBC = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_EBC
+TAB_PACKAGES_AARCH64 = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_PCDS = 'Pcds'
+TAB_PCDS_FIXED_AT_BUILD = 'FixedAtBuild'
+TAB_PCDS_PATCHABLE_IN_MODULE = 'PatchableInModule'
+TAB_PCDS_FEATURE_FLAG = 'FeatureFlag'
+TAB_PCDS_DYNAMIC_EX = 'DynamicEx'
+TAB_PCDS_DYNAMIC_EX_DEFAULT = 'DynamicExDefault'
+TAB_PCDS_DYNAMIC_EX_VPD = 'DynamicExVpd'
+TAB_PCDS_DYNAMIC_EX_HII = 'DynamicExHii'
+TAB_PCDS_DYNAMIC = 'Dynamic'
+TAB_PCDS_DYNAMIC_DEFAULT = 'DynamicDefault'
+TAB_PCDS_DYNAMIC_VPD = 'DynamicVpd'
+TAB_PCDS_DYNAMIC_HII = 'DynamicHii'
+
+PCD_DYNAMIC_TYPE_SET = {TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII}
+PCD_DYNAMIC_EX_TYPE_SET = {TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII}
+
+# leave as a list for order
+PCD_TYPE_LIST = [TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG, TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_EX]
+
+TAB_PCDS_FIXED_AT_BUILD_NULL = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD
+TAB_PCDS_FIXED_AT_BUILD_COMMON = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_PCDS_FIXED_AT_BUILD_IA32 = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_IA32
+TAB_PCDS_FIXED_AT_BUILD_X64 = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_X64
+TAB_PCDS_FIXED_AT_BUILD_ARM = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_ARM
+TAB_PCDS_FIXED_AT_BUILD_EBC = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_EBC
+TAB_PCDS_FIXED_AT_BUILD_AARCH64 = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_PCDS_PATCHABLE_IN_MODULE_NULL = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE
+TAB_PCDS_PATCHABLE_IN_MODULE_COMMON = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_PCDS_PATCHABLE_IN_MODULE_IA32 = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + TAB_SPLIT + TAB_ARCH_IA32
+TAB_PCDS_PATCHABLE_IN_MODULE_X64 = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + TAB_SPLIT + TAB_ARCH_X64
+TAB_PCDS_PATCHABLE_IN_MODULE_ARM = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + TAB_SPLIT + TAB_ARCH_ARM
+TAB_PCDS_PATCHABLE_IN_MODULE_EBC = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + TAB_SPLIT + TAB_ARCH_EBC
+TAB_PCDS_PATCHABLE_IN_MODULE_AARCH64 = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_PCDS_FEATURE_FLAG_NULL = TAB_PCDS + TAB_PCDS_FEATURE_FLAG
+TAB_PCDS_FEATURE_FLAG_COMMON = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_PCDS_FEATURE_FLAG_IA32 = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + TAB_ARCH_IA32
+TAB_PCDS_FEATURE_FLAG_X64 = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + TAB_ARCH_X64
+TAB_PCDS_FEATURE_FLAG_ARM = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + TAB_ARCH_ARM
+TAB_PCDS_FEATURE_FLAG_EBC = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + TAB_ARCH_EBC
+TAB_PCDS_FEATURE_FLAG_AARCH64 = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_PCDS_DYNAMIC_EX_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_EX
+TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_EX_DEFAULT
+TAB_PCDS_DYNAMIC_EX_HII_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_EX_HII
+TAB_PCDS_DYNAMIC_EX_VPD_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_EX_VPD
+TAB_PCDS_DYNAMIC_EX_COMMON = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_PCDS_DYNAMIC_EX_IA32 = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + TAB_ARCH_IA32
+TAB_PCDS_DYNAMIC_EX_X64 = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + TAB_ARCH_X64
+TAB_PCDS_DYNAMIC_EX_ARM = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + TAB_ARCH_ARM
+TAB_PCDS_DYNAMIC_EX_EBC = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + TAB_ARCH_EBC
+TAB_PCDS_DYNAMIC_EX_AARCH64 = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_PCDS_DYNAMIC_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC
+TAB_PCDS_DYNAMIC_DEFAULT_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_DEFAULT
+TAB_PCDS_DYNAMIC_HII_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_HII
+TAB_PCDS_DYNAMIC_VPD_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_VPD
+TAB_PCDS_DYNAMIC_COMMON = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_PCDS_DYNAMIC_IA32 = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_IA32
+TAB_PCDS_DYNAMIC_X64 = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_X64
+TAB_PCDS_DYNAMIC_ARM = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_ARM
+TAB_PCDS_DYNAMIC_EBC = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_EBC
+TAB_PCDS_DYNAMIC_AARCH64 = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE = 'PcdLoadFixAddressPeiCodePageNumber'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE_DATA_TYPE = 'UINT32'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE = 'PcdLoadFixAddressBootTimeCodePageNumber'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE_DATA_TYPE = 'UINT32'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE = 'PcdLoadFixAddressRuntimeCodePageNumber'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE_DATA_TYPE = 'UINT32'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE = 'PcdLoadFixAddressSmmCodePageNumber'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE_DATA_TYPE = 'UINT32'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SET = {TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE, \
+ TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE, \
+ TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE, \
+ TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE}
+
+## The mapping dictionary from datum type to its maximum number.
+MAX_VAL_TYPE = {"BOOLEAN":0x01, TAB_UINT8:0xFF, TAB_UINT16:0xFFFF, TAB_UINT32:0xFFFFFFFF, TAB_UINT64:0xFFFFFFFFFFFFFFFF}
+## The mapping dictionary from datum type to size string.
+MAX_SIZE_TYPE = {"BOOLEAN":1, TAB_UINT8:1, TAB_UINT16:2, TAB_UINT32:4, TAB_UINT64:8}
+
+TAB_DEPEX = 'Depex'
+TAB_DEPEX_COMMON = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_DEPEX_IA32 = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_IA32
+TAB_DEPEX_X64 = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_X64
+TAB_DEPEX_ARM = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_ARM
+TAB_DEPEX_EBC = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_EBC
+TAB_DEPEX_AARCH64 = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_SKUIDS = 'SkuIds'
+TAB_DEFAULT_STORES = 'DefaultStores'
+TAB_DEFAULT_STORES_DEFAULT = 'STANDARD'
+
+TAB_LIBRARIES = 'Libraries'
+TAB_LIBRARIES_COMMON = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_LIBRARIES_IA32 = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_IA32
+TAB_LIBRARIES_X64 = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_X64
+TAB_LIBRARIES_ARM = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_ARM
+TAB_LIBRARIES_EBC = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_EBC
+TAB_LIBRARIES_AARCH64 = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_COMPONENTS = 'Components'
+TAB_COMPONENTS_COMMON = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_COMPONENTS_IA32 = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_IA32
+TAB_COMPONENTS_X64 = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_X64
+TAB_COMPONENTS_ARM = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_ARM
+TAB_COMPONENTS_EBC = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_EBC
+TAB_COMPONENTS_AARCH64 = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_AARCH64
+
+TAB_BUILD_OPTIONS = 'BuildOptions'
+
+TAB_DEFINE = 'DEFINE'
+TAB_NMAKE = 'Nmake'
+TAB_USER_EXTENSIONS = 'UserExtensions'
+TAB_INCLUDE = '!include'
+TAB_DEFAULT = 'DEFAULT'
+TAB_COMMON = 'COMMON'
+
+#
+# Common Define
+#
+TAB_COMMON_DEFINES = 'Defines'
+
+#
+# Inf Definitions
+#
+TAB_INF_DEFINES = TAB_COMMON_DEFINES
+TAB_INF_DEFINES_INF_VERSION = 'INF_VERSION'
+TAB_INF_DEFINES_BASE_NAME = 'BASE_NAME'
+TAB_INF_DEFINES_FILE_GUID = 'FILE_GUID'
+TAB_INF_DEFINES_MODULE_TYPE = 'MODULE_TYPE'
+TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION = 'EFI_SPECIFICATION_VERSION'
+TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION = 'UEFI_SPECIFICATION_VERSION'
+TAB_INF_DEFINES_PI_SPECIFICATION_VERSION = 'PI_SPECIFICATION_VERSION'
+TAB_INF_DEFINES_EDK_RELEASE_VERSION = 'EDK_RELEASE_VERSION'
+TAB_INF_DEFINES_BINARY_MODULE = 'BINARY_MODULE'
+TAB_INF_DEFINES_LIBRARY_CLASS = 'LIBRARY_CLASS'
+TAB_INF_DEFINES_COMPONENT_TYPE = 'COMPONENT_TYPE'
+TAB_INF_DEFINES_MAKEFILE_NAME = 'MAKEFILE_NAME'
+TAB_INF_DEFINES_DPX_SOURCE = 'DPX_SOURCE'
+TAB_INF_DEFINES_BUILD_NUMBER = 'BUILD_NUMBER'
+TAB_INF_DEFINES_BUILD_TYPE = 'BUILD_TYPE'
+TAB_INF_DEFINES_FFS_EXT = 'FFS_EXT'
+TAB_INF_DEFINES_FV_EXT = 'FV_EXT'
+TAB_INF_DEFINES_SOURCE_FV = 'SOURCE_FV'
+TAB_INF_DEFINES_VERSION_NUMBER = 'VERSION_NUMBER'
+TAB_INF_DEFINES_VERSION = 'VERSION' # for Edk inf, the same as VERSION_NUMBER
+TAB_INF_DEFINES_VERSION_STRING = 'VERSION_STRING'
+TAB_INF_DEFINES_PCD_IS_DRIVER = 'PCD_IS_DRIVER'
+TAB_INF_DEFINES_TIANO_EDK_FLASHMAP_H = 'TIANO_EDK_FLASHMAP_H'
+TAB_INF_DEFINES_ENTRY_POINT = 'ENTRY_POINT'
+TAB_INF_DEFINES_UNLOAD_IMAGE = 'UNLOAD_IMAGE'
+TAB_INF_DEFINES_CONSTRUCTOR = 'CONSTRUCTOR'
+TAB_INF_DEFINES_DESTRUCTOR = 'DESTRUCTOR'
+TAB_INF_DEFINES_DEFINE = 'DEFINE'
+TAB_INF_DEFINES_SPEC = 'SPEC'
+TAB_INF_DEFINES_CUSTOM_MAKEFILE = 'CUSTOM_MAKEFILE'
+TAB_INF_DEFINES_MACRO = '__MACROS__'
+TAB_INF_DEFINES_SHADOW = 'SHADOW'
+TAB_INF_FIXED_PCD = 'FixedPcd'
+TAB_INF_FEATURE_PCD = 'FeaturePcd'
+TAB_INF_PATCH_PCD = 'PatchPcd'
+TAB_INF_PCD = 'Pcd'
+TAB_INF_PCD_EX = 'PcdEx'
+TAB_INF_USAGE_PRO = 'PRODUCES'
+TAB_INF_USAGE_SOME_PRO = 'SOMETIMES_PRODUCES'
+TAB_INF_USAGE_CON = 'CONSUMES'
+TAB_INF_USAGE_SOME_CON = 'SOMETIMES_CONSUMES'
+TAB_INF_USAGE_NOTIFY = 'NOTIFY'
+TAB_INF_USAGE_TO_START = 'TO_START'
+TAB_INF_USAGE_BY_START = 'BY_START'
+TAB_INF_GUIDTYPE_EVENT = 'Event'
+TAB_INF_GUIDTYPE_FILE = 'File'
+TAB_INF_GUIDTYPE_FV = 'FV'
+TAB_INF_GUIDTYPE_GUID = 'GUID'
+TAB_INF_GUIDTYPE_HII = 'HII'
+TAB_INF_GUIDTYPE_HOB = 'HOB'
+TAB_INF_GUIDTYPE_ST = 'SystemTable'
+TAB_INF_GUIDTYPE_TSG = 'TokenSpaceGuid'
+TAB_INF_GUIDTYPE_VAR = 'Variable'
+TAB_INF_GUIDTYPE_PROTOCOL = 'PROTOCOL'
+TAB_INF_GUIDTYPE_PPI = 'PPI'
+TAB_INF_USAGE_UNDEFINED = 'UNDEFINED'
+
+#
+# Dec Definitions
+#
+TAB_DEC_DEFINES = TAB_COMMON_DEFINES
+TAB_DEC_DEFINES_DEC_SPECIFICATION = 'DEC_SPECIFICATION'
+TAB_DEC_DEFINES_PACKAGE_NAME = 'PACKAGE_NAME'
+TAB_DEC_DEFINES_PACKAGE_GUID = 'PACKAGE_GUID'
+TAB_DEC_DEFINES_PACKAGE_VERSION = 'PACKAGE_VERSION'
+TAB_DEC_DEFINES_PKG_UNI_FILE = 'PKG_UNI_FILE'
+
+#
+# Dsc Definitions
+#
+TAB_DSC_DEFINES = TAB_COMMON_DEFINES
+TAB_DSC_DEFINES_PLATFORM_NAME = 'PLATFORM_NAME'
+TAB_DSC_DEFINES_PLATFORM_GUID = 'PLATFORM_GUID'
+TAB_DSC_DEFINES_PLATFORM_VERSION = 'PLATFORM_VERSION'
+TAB_DSC_DEFINES_DSC_SPECIFICATION = 'DSC_SPECIFICATION'
+TAB_DSC_DEFINES_OUTPUT_DIRECTORY = 'OUTPUT_DIRECTORY'
+TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES = 'SUPPORTED_ARCHITECTURES'
+TAB_DSC_DEFINES_BUILD_TARGETS = 'BUILD_TARGETS'
+TAB_DSC_DEFINES_SKUID_IDENTIFIER = 'SKUID_IDENTIFIER'
+TAB_DSC_DEFINES_PCD_INFO_GENERATION = 'PCD_INFO_GENERATION'
+TAB_DSC_DEFINES_PCD_VAR_CHECK_GENERATION = 'PCD_VAR_CHECK_GENERATION'
+TAB_DSC_DEFINES_FLASH_DEFINITION = 'FLASH_DEFINITION'
+TAB_DSC_DEFINES_BUILD_NUMBER = 'BUILD_NUMBER'
+TAB_DSC_DEFINES_MAKEFILE_NAME = 'MAKEFILE_NAME'
+TAB_DSC_DEFINES_BS_BASE_ADDRESS = 'BsBaseAddress'
+TAB_DSC_DEFINES_RT_BASE_ADDRESS = 'RtBaseAddress'
+TAB_DSC_DEFINES_RFC_LANGUAGES = 'RFC_LANGUAGES'
+TAB_DSC_DEFINES_ISO_LANGUAGES = 'ISO_LANGUAGES'
+TAB_DSC_DEFINES_DEFINE = 'DEFINE'
+TAB_DSC_DEFINES_VPD_TOOL_GUID = 'VPD_TOOL_GUID'
+TAB_FIX_LOAD_TOP_MEMORY_ADDRESS = 'FIX_LOAD_TOP_MEMORY_ADDRESS'
+TAB_DSC_DEFINES_EDKGLOBAL = 'EDK_GLOBAL'
+TAB_DSC_PREBUILD = 'PREBUILD'
+TAB_DSC_POSTBUILD = 'POSTBUILD'
+#
+# TargetTxt Definitions
+#
+TAB_TAT_DEFINES_ACTIVE_PLATFORM = 'ACTIVE_PLATFORM'
+TAB_TAT_DEFINES_ACTIVE_MODULE = 'ACTIVE_MODULE'
+TAB_TAT_DEFINES_TOOL_CHAIN_CONF = 'TOOL_CHAIN_CONF'
+TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER = 'MAX_CONCURRENT_THREAD_NUMBER'
+TAB_TAT_DEFINES_TARGET = 'TARGET'
+TAB_TAT_DEFINES_TOOL_CHAIN_TAG = 'TOOL_CHAIN_TAG'
+TAB_TAT_DEFINES_TARGET_ARCH = 'TARGET_ARCH'
+TAB_TAT_DEFINES_BUILD_RULE_CONF = "BUILD_RULE_CONF"
+
+#
+# ToolDef Definitions
+#
+TAB_TOD_DEFINES_TARGET = 'TARGET'
+TAB_TOD_DEFINES_TOOL_CHAIN_TAG = 'TOOL_CHAIN_TAG'
+TAB_TOD_DEFINES_TARGET_ARCH = 'TARGET_ARCH'
+TAB_TOD_DEFINES_COMMAND_TYPE = 'COMMAND_TYPE'
+TAB_TOD_DEFINES_FAMILY = 'FAMILY'
+TAB_TOD_DEFINES_BUILDRULEFAMILY = 'BUILDRULEFAMILY'
+TAB_TOD_DEFINES_BUILDRULEORDER = 'BUILDRULEORDER'
+
+#
+# Conditional Statements
+#
+TAB_IF = '!if'
+TAB_END_IF = '!endif'
+TAB_ELSE_IF = '!elseif'
+TAB_ELSE = '!else'
+TAB_IF_DEF = '!ifdef'
+TAB_IF_N_DEF = '!ifndef'
+TAB_IF_EXIST = '!if exist'
+TAB_ERROR = '!error'
+
+#
+# Unknown section
+#
+TAB_UNKNOWN = 'UNKNOWN'
+
+#
+# Build database path
+#
+DATABASE_PATH = ":memory:" #"BuildDatabase.db"
+
+# used by ECC
+MODIFIER_SET = {'IN', 'OUT', 'OPTIONAL', 'UNALIGNED', 'EFI_RUNTIMESERVICE', 'EFI_BOOTSERVICE', 'EFIAPI'}
+
+# Dependency Opcodes
+DEPEX_OPCODE_BEFORE = "BEFORE"
+DEPEX_OPCODE_AFTER = "AFTER"
+DEPEX_OPCODE_PUSH = "PUSH"
+DEPEX_OPCODE_AND = "AND"
+DEPEX_OPCODE_OR = "OR"
+DEPEX_OPCODE_NOT = "NOT"
+DEPEX_OPCODE_END = "END"
+DEPEX_OPCODE_SOR = "SOR"
+DEPEX_OPCODE_TRUE = "TRUE"
+DEPEX_OPCODE_FALSE = "FALSE"
+
+# Dependency Expression
+DEPEX_SUPPORTED_OPCODE_SET = {"BEFORE", "AFTER", "PUSH", "AND", "OR", "NOT", "END", "SOR", "TRUE", "FALSE", '(', ')'}
+
+TAB_STATIC_LIBRARY = "STATIC-LIBRARY-FILE"
+TAB_DYNAMIC_LIBRARY = "DYNAMIC-LIBRARY-FILE"
+TAB_FRAMEWORK_IMAGE = "EFI-IMAGE-FILE"
+TAB_C_CODE_FILE = "C-CODE-FILE"
+TAB_C_HEADER_FILE = "C-HEADER-FILE"
+TAB_UNICODE_FILE = "UNICODE-TEXT-FILE"
+TAB_IMAGE_FILE = "IMAGE-DEFINITION-FILE"
+TAB_DEPENDENCY_EXPRESSION_FILE = "DEPENDENCY-EXPRESSION-FILE"
+TAB_UNKNOWN_FILE = "UNKNOWN-TYPE-FILE"
+TAB_DEFAULT_BINARY_FILE = "_BINARY_FILE_"
+TAB_OBJECT_FILE = "OBJECT-FILE"
+TAB_VFR_FILE = 'VISUAL-FORM-REPRESENTATION-FILE'
+
+# used by BRG
+TAB_BRG_PCD = 'PCD'
+TAB_BRG_LIBRARY = 'Library'
+
+#
+# Build Rule File Version Definition
+#
+TAB_BUILD_RULE_VERSION = "build_rule_version"
+
+# section name for PCDs
+PCDS_DYNAMIC_DEFAULT = "PcdsDynamicDefault"
+PCDS_DYNAMIC_VPD = "PcdsDynamicVpd"
+PCDS_DYNAMIC_HII = "PcdsDynamicHii"
+PCDS_DYNAMICEX_DEFAULT = "PcdsDynamicExDefault"
+PCDS_DYNAMICEX_VPD = "PcdsDynamicExVpd"
+PCDS_DYNAMICEX_HII = "PcdsDynamicExHii"
+
+SECTIONS_HAVE_ITEM_PCD_SET = {PCDS_DYNAMIC_DEFAULT.upper(), PCDS_DYNAMIC_VPD.upper(), PCDS_DYNAMIC_HII.upper(), \
+ PCDS_DYNAMICEX_DEFAULT.upper(), PCDS_DYNAMICEX_VPD.upper(), PCDS_DYNAMICEX_HII.upper()}
+# Section allowed to have items after arch
+SECTIONS_HAVE_ITEM_AFTER_ARCH_SET = {TAB_LIBRARY_CLASSES.upper(), TAB_DEPEX.upper(), TAB_USER_EXTENSIONS.upper(),
+ PCDS_DYNAMIC_DEFAULT.upper(),
+ PCDS_DYNAMIC_VPD.upper(),
+ PCDS_DYNAMIC_HII.upper(),
+ PCDS_DYNAMICEX_DEFAULT.upper(),
+ PCDS_DYNAMICEX_VPD.upper(),
+ PCDS_DYNAMICEX_HII.upper(),
+ TAB_BUILD_OPTIONS.upper(),
+ TAB_PACKAGES.upper(),
+ TAB_INCLUDES.upper()}
+
+#
+# pack codes as used in PcdDb and elsewhere
+#
+PACK_PATTERN_GUID = '=LHHBBBBBBBB'
+PACK_CODE_BY_SIZE = {8:'=Q',
+ 4:'=L',
+ 2:'=H',
+ 1:'=B',
+ 0:'=B',
+ 16:""}
+
+TAB_COMPILER_MSFT = 'MSFT'
diff --git a/roms/edk2/BaseTools/Source/Python/Common/Edk2/Capsule/FmpPayloadHeader.py b/roms/edk2/BaseTools/Source/Python/Common/Edk2/Capsule/FmpPayloadHeader.py
new file mode 100644
index 000000000..ddc142c39
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/Edk2/Capsule/FmpPayloadHeader.py
@@ -0,0 +1,85 @@
+## @file
+# Module that encodes and decodes a FMP_PAYLOAD_HEADER with a payload.
+# The FMP_PAYLOAD_HEADER is processed by the FmpPayloadHeaderLib in the
+# FmpDevicePkg.
+#
+# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+FmpPayloadHeader
+'''
+
+import struct
+
+def _SIGNATURE_32 (A, B, C, D):
+ return struct.unpack ('=I',bytearray (A + B + C + D, 'ascii'))[0]
+
+def _SIGNATURE_32_TO_STRING (Signature):
+ return struct.pack ("<I", Signature).decode ()
+
+class FmpPayloadHeaderClass (object):
+ #
+ # typedef struct {
+ # UINT32 Signature;
+ # UINT32 HeaderSize;
+ # UINT32 FwVersion;
+ # UINT32 LowestSupportedVersion;
+ # } FMP_PAYLOAD_HEADER;
+ #
+ # #define FMP_PAYLOAD_HEADER_SIGNATURE SIGNATURE_32 ('M', 'S', 'S', '1')
+ #
+ _StructFormat = '<IIII'
+ _StructSize = struct.calcsize (_StructFormat)
+
+ _FMP_PAYLOAD_HEADER_SIGNATURE = _SIGNATURE_32 ('M', 'S', 'S', '1')
+
+ def __init__ (self):
+ self._Valid = False
+ self.Signature = self._FMP_PAYLOAD_HEADER_SIGNATURE
+ self.HeaderSize = self._StructSize
+ self.FwVersion = 0x00000000
+ self.LowestSupportedVersion = 0x00000000
+ self.Payload = b''
+
+ def Encode (self):
+ FmpPayloadHeader = struct.pack (
+ self._StructFormat,
+ self.Signature,
+ self.HeaderSize,
+ self.FwVersion,
+ self.LowestSupportedVersion
+ )
+ self._Valid = True
+ return FmpPayloadHeader + self.Payload
+
+ def Decode (self, Buffer):
+ if len (Buffer) < self._StructSize:
+ raise ValueError
+ (Signature, HeaderSize, FwVersion, LowestSupportedVersion) = \
+ struct.unpack (
+ self._StructFormat,
+ Buffer[0:self._StructSize]
+ )
+ if Signature != self._FMP_PAYLOAD_HEADER_SIGNATURE:
+ raise ValueError
+ if HeaderSize < self._StructSize:
+ raise ValueError
+ self.Signature = Signature
+ self.HeaderSize = HeaderSize
+ self.FwVersion = FwVersion
+ self.LowestSupportedVersion = LowestSupportedVersion
+ self.Payload = Buffer[self.HeaderSize:]
+
+ self._Valid = True
+ return self.Payload
+
+ def DumpInfo (self):
+ if not self._Valid:
+ raise ValueError
+ print ('FMP_PAYLOAD_HEADER.Signature = {Signature:08X} ({SignatureString})'.format (Signature = self.Signature, SignatureString = _SIGNATURE_32_TO_STRING (self.Signature)))
+ print ('FMP_PAYLOAD_HEADER.HeaderSize = {HeaderSize:08X}'.format (HeaderSize = self.HeaderSize))
+ print ('FMP_PAYLOAD_HEADER.FwVersion = {FwVersion:08X}'.format (FwVersion = self.FwVersion))
+ print ('FMP_PAYLOAD_HEADER.LowestSupportedVersion = {LowestSupportedVersion:08X}'.format (LowestSupportedVersion = self.LowestSupportedVersion))
+ print ('sizeof (Payload) = {Size:08X}'.format (Size = len (self.Payload)))
diff --git a/roms/edk2/BaseTools/Source/Python/Common/Edk2/Capsule/__init__.py b/roms/edk2/BaseTools/Source/Python/Common/Edk2/Capsule/__init__.py
new file mode 100644
index 000000000..1e69fca2e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/Edk2/Capsule/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'Common.Edk2.Capsule' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/Common/Edk2/__init__.py b/roms/edk2/BaseTools/Source/Python/Common/Edk2/__init__.py
new file mode 100644
index 000000000..168041c40
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/Edk2/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'Common.Edk2' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/Common/EdkLogger.py b/roms/edk2/BaseTools/Source/Python/Common/EdkLogger.py
new file mode 100644
index 000000000..06da4a9d0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/EdkLogger.py
@@ -0,0 +1,383 @@
+## @file
+# This file implements the log mechanism for Python tools.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+# Copyright 2001-2016 by Vinay Sajip. All Rights Reserved.
+#
+# Permission to use, copy, modify, and distribute this software and its
+# documentation for any purpose and without fee is hereby granted,
+# provided that the above copyright notice appear in all copies and that
+# both that copyright notice and this permission notice appear in
+# supporting documentation, and that the name of Vinay Sajip
+# not be used in advertising or publicity pertaining to distribution
+# of the software without specific, written prior permission.
+# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+# This copyright is for QueueHandler.
+
+## Import modules
+from __future__ import absolute_import
+import Common.LongFilePathOs as os, sys, logging
+import traceback
+from .BuildToolError import *
+try:
+ from logging.handlers import QueueHandler
+except:
+ class QueueHandler(logging.Handler):
+ """
+ This handler sends events to a queue. Typically, it would be used together
+ with a multiprocessing Queue to centralise logging to file in one process
+ (in a multi-process application), so as to avoid file write contention
+ between processes.
+
+ This code is new in Python 3.2, but this class can be copy pasted into
+ user code for use with earlier Python versions.
+ """
+
+ def __init__(self, queue):
+ """
+ Initialise an instance, using the passed queue.
+ """
+ logging.Handler.__init__(self)
+ self.queue = queue
+
+ def enqueue(self, record):
+ """
+ Enqueue a record.
+
+ The base implementation uses put_nowait. You may want to override
+ this method if you want to use blocking, timeouts or custom queue
+ implementations.
+ """
+ self.queue.put_nowait(record)
+
+ def prepare(self, record):
+ """
+ Prepares a record for queuing. The object returned by this method is
+ enqueued.
+
+ The base implementation formats the record to merge the message
+ and arguments, and removes unpickleable items from the record
+ in-place.
+
+ You might want to override this method if you want to convert
+ the record to a dict or JSON string, or send a modified copy
+ of the record while leaving the original intact.
+ """
+ # The format operation gets traceback text into record.exc_text
+ # (if there's exception data), and also returns the formatted
+ # message. We can then use this to replace the original
+ # msg + args, as these might be unpickleable. We also zap the
+ # exc_info and exc_text attributes, as they are no longer
+ # needed and, if not None, will typically not be pickleable.
+ msg = self.format(record)
+ record.message = msg
+ record.msg = msg
+ record.args = None
+ record.exc_info = None
+ record.exc_text = None
+ return record
+
+ def emit(self, record):
+ """
+ Emit a record.
+
+ Writes the LogRecord to the queue, preparing it for pickling first.
+ """
+ try:
+ self.enqueue(self.prepare(record))
+ except Exception:
+ self.handleError(record)
+class BlockQueueHandler(QueueHandler):
+ def enqueue(self, record):
+ self.queue.put(record,True)
+## Log level constants
+DEBUG_0 = 1
+DEBUG_1 = 2
+DEBUG_2 = 3
+DEBUG_3 = 4
+DEBUG_4 = 5
+DEBUG_5 = 6
+DEBUG_6 = 7
+DEBUG_7 = 8
+DEBUG_8 = 9
+DEBUG_9 = 10
+VERBOSE = 15
+INFO = 20
+WARN = 30
+QUIET = 40
+ERROR = 50
+SILENT = 99
+
+IsRaiseError = True
+
+# Tool name
+_ToolName = os.path.basename(sys.argv[0])
+
+# For validation purpose
+_LogLevels = [DEBUG_0, DEBUG_1, DEBUG_2, DEBUG_3, DEBUG_4, DEBUG_5,
+ DEBUG_6, DEBUG_7, DEBUG_8, DEBUG_9, VERBOSE, WARN, INFO,
+ ERROR, QUIET, SILENT]
+
+# For DEBUG level (All DEBUG_0~9 are applicable)
+_DebugLogger = logging.getLogger("tool_debug")
+_DebugFormatter = logging.Formatter("[%(asctime)s.%(msecs)d]: %(message)s", datefmt="%H:%M:%S")
+
+# For VERBOSE, INFO, WARN level
+_InfoLogger = logging.getLogger("tool_info")
+_InfoFormatter = logging.Formatter("%(message)s")
+
+# For ERROR level
+_ErrorLogger = logging.getLogger("tool_error")
+_ErrorFormatter = logging.Formatter("%(message)s")
+
+# String templates for ERROR/WARN/DEBUG log message
+_ErrorMessageTemplate = '\n\n%(tool)s...\n%(file)s(%(line)s): error %(errorcode)04X: %(msg)s\n\t%(extra)s'
+_ErrorMessageTemplateWithoutFile = '\n\n%(tool)s...\n : error %(errorcode)04X: %(msg)s\n\t%(extra)s'
+_WarningMessageTemplate = '%(tool)s...\n%(file)s(%(line)s): warning: %(msg)s'
+_WarningMessageTemplateWithoutFile = '%(tool)s: : warning: %(msg)s'
+_DebugMessageTemplate = '%(file)s(%(line)s): debug: \n %(msg)s'
+
+#
+# Flag used to take WARN as ERROR.
+# By default, only ERROR message will break the tools execution.
+#
+_WarningAsError = False
+
+## Log debug message
+#
+# @param Level DEBUG level (DEBUG0~9)
+# @param Message Debug information
+# @param ExtraData More information associated with "Message"
+#
+def debug(Level, Message, ExtraData=None):
+ if _DebugLogger.level > Level:
+ return
+ if Level > DEBUG_9:
+ return
+
+ # Find out the caller method information
+ CallerStack = traceback.extract_stack()[-2]
+ TemplateDict = {
+ "file" : CallerStack[0],
+ "line" : CallerStack[1],
+ "msg" : Message,
+ }
+
+ if ExtraData is not None:
+ LogText = _DebugMessageTemplate % TemplateDict + "\n %s" % ExtraData
+ else:
+ LogText = _DebugMessageTemplate % TemplateDict
+
+ _DebugLogger.log(Level, LogText)
+
+## Log verbose message
+#
+# @param Message Verbose information
+#
+def verbose(Message):
+ return _InfoLogger.log(VERBOSE, Message)
+
+## Log warning message
+#
+# Warning messages are those which might be wrong but won't fail the tool.
+#
+# @param ToolName The name of the tool. If not given, the name of caller
+# method will be used.
+# @param Message Warning information
+# @param File The name of file which caused the warning.
+# @param Line The line number in the "File" which caused the warning.
+# @param ExtraData More information associated with "Message"
+#
+def warn(ToolName, Message, File=None, Line=None, ExtraData=None):
+ if _InfoLogger.level > WARN:
+ return
+
+ # if no tool name given, use caller's source file name as tool name
+ if ToolName is None or ToolName == "":
+ ToolName = os.path.basename(traceback.extract_stack()[-2][0])
+
+ if Line is None:
+ Line = "..."
+ else:
+ Line = "%d" % Line
+
+ TemplateDict = {
+ "tool" : ToolName,
+ "file" : File,
+ "line" : Line,
+ "msg" : Message,
+ }
+
+ if File is not None:
+ LogText = _WarningMessageTemplate % TemplateDict
+ else:
+ LogText = _WarningMessageTemplateWithoutFile % TemplateDict
+
+ if ExtraData is not None:
+ LogText += "\n %s" % ExtraData
+
+ _InfoLogger.log(WARN, LogText)
+
+ # Raise an exception if indicated
+ if _WarningAsError == True:
+ raise FatalError(WARNING_AS_ERROR)
+
+## Log INFO message
+info = _InfoLogger.info
+
+## Log ERROR message
+#
+# Once an error messages is logged, the tool's execution will be broken by raising
+# an exception. If you don't want to break the execution later, you can give
+# "RaiseError" with "False" value.
+#
+# @param ToolName The name of the tool. If not given, the name of caller
+# method will be used.
+# @param ErrorCode The error code
+# @param Message Warning information
+# @param File The name of file which caused the error.
+# @param Line The line number in the "File" which caused the warning.
+# @param ExtraData More information associated with "Message"
+# @param RaiseError Raise an exception to break the tool's execution if
+# it's True. This is the default behavior.
+#
+def error(ToolName, ErrorCode, Message=None, File=None, Line=None, ExtraData=None, RaiseError=IsRaiseError):
+ if Line is None:
+ Line = "..."
+ else:
+ Line = "%d" % Line
+
+ if Message is None:
+ if ErrorCode in gErrorMessage:
+ Message = gErrorMessage[ErrorCode]
+ else:
+ Message = gErrorMessage[UNKNOWN_ERROR]
+
+ if ExtraData is None:
+ ExtraData = ""
+
+ TemplateDict = {
+ "tool" : _ToolName,
+ "file" : File,
+ "line" : Line,
+ "errorcode" : ErrorCode,
+ "msg" : Message,
+ "extra" : ExtraData
+ }
+
+ if File is not None:
+ LogText = _ErrorMessageTemplate % TemplateDict
+ else:
+ LogText = _ErrorMessageTemplateWithoutFile % TemplateDict
+
+ _ErrorLogger.log(ERROR, LogText)
+
+ if RaiseError and IsRaiseError:
+ raise FatalError(ErrorCode)
+
+# Log information which should be always put out
+quiet = _ErrorLogger.error
+
+## Initialize log system
+def LogClientInitialize(log_q):
+ #
+ # Since we use different format to log different levels of message into different
+ # place (stdout or stderr), we have to use different "Logger" objects to do this.
+ #
+ # For DEBUG level (All DEBUG_0~9 are applicable)
+ _DebugLogger.setLevel(INFO)
+ _DebugChannel = BlockQueueHandler(log_q)
+ _DebugChannel.setFormatter(_DebugFormatter)
+ _DebugLogger.addHandler(_DebugChannel)
+
+ # For VERBOSE, INFO, WARN level
+ _InfoLogger.setLevel(INFO)
+ _InfoChannel = BlockQueueHandler(log_q)
+ _InfoChannel.setFormatter(_InfoFormatter)
+ _InfoLogger.addHandler(_InfoChannel)
+
+ # For ERROR level
+ _ErrorLogger.setLevel(INFO)
+ _ErrorCh = BlockQueueHandler(log_q)
+ _ErrorCh.setFormatter(_ErrorFormatter)
+ _ErrorLogger.addHandler(_ErrorCh)
+
+## Set log level
+#
+# @param Level One of log level in _LogLevel
+def SetLevel(Level):
+ if Level not in _LogLevels:
+ info("Not supported log level (%d). Use default level instead." % Level)
+ Level = INFO
+ _DebugLogger.setLevel(Level)
+ _InfoLogger.setLevel(Level)
+ _ErrorLogger.setLevel(Level)
+
+## Initialize log system
+def Initialize():
+ #
+ # Since we use different format to log different levels of message into different
+ # place (stdout or stderr), we have to use different "Logger" objects to do this.
+ #
+ # For DEBUG level (All DEBUG_0~9 are applicable)
+ _DebugLogger.setLevel(INFO)
+ _DebugChannel = logging.StreamHandler(sys.stdout)
+ _DebugChannel.setFormatter(_DebugFormatter)
+ _DebugLogger.addHandler(_DebugChannel)
+
+ # For VERBOSE, INFO, WARN level
+ _InfoLogger.setLevel(INFO)
+ _InfoChannel = logging.StreamHandler(sys.stdout)
+ _InfoChannel.setFormatter(_InfoFormatter)
+ _InfoLogger.addHandler(_InfoChannel)
+
+ # For ERROR level
+ _ErrorLogger.setLevel(INFO)
+ _ErrorCh = logging.StreamHandler(sys.stderr)
+ _ErrorCh.setFormatter(_ErrorFormatter)
+ _ErrorLogger.addHandler(_ErrorCh)
+
+def InitializeForUnitTest():
+ Initialize()
+ SetLevel(SILENT)
+
+## Get current log level
+def GetLevel():
+ return _InfoLogger.getEffectiveLevel()
+
+## Raise up warning as error
+def SetWarningAsError():
+ global _WarningAsError
+ _WarningAsError = True
+
+## Specify a file to store the log message as well as put on console
+#
+# @param LogFile The file path used to store the log message
+#
+def SetLogFile(LogFile):
+ if os.path.exists(LogFile):
+ os.remove(LogFile)
+
+ _Ch = logging.FileHandler(LogFile)
+ _Ch.setFormatter(_DebugFormatter)
+ _DebugLogger.addHandler(_Ch)
+
+ _Ch= logging.FileHandler(LogFile)
+ _Ch.setFormatter(_InfoFormatter)
+ _InfoLogger.addHandler(_Ch)
+
+ _Ch = logging.FileHandler(LogFile)
+ _Ch.setFormatter(_ErrorFormatter)
+ _ErrorLogger.addHandler(_Ch)
+
+if __name__ == '__main__':
+ pass
+
diff --git a/roms/edk2/BaseTools/Source/Python/Common/Expression.py b/roms/edk2/BaseTools/Source/Python/Common/Expression.py
new file mode 100644
index 000000000..07ca039a9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/Expression.py
@@ -0,0 +1,1054 @@
+## @file
+# This file is used to parse and evaluate expression in directive or PCD value.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+## Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+from Common.GlobalData import *
+from CommonDataClass.Exceptions import BadExpression
+from CommonDataClass.Exceptions import WrnExpression
+from .Misc import GuidStringToGuidStructureString, ParseFieldValue,CopyDict
+import Common.EdkLogger as EdkLogger
+import copy
+from Common.DataType import *
+import sys
+from random import sample
+import string
+
+ERR_STRING_EXPR = 'This operator cannot be used in string expression: [%s].'
+ERR_SNYTAX = 'Syntax error, the rest of expression cannot be evaluated: [%s].'
+ERR_MATCH = 'No matching right parenthesis.'
+ERR_STRING_TOKEN = 'Bad string token: [%s].'
+ERR_MACRO_TOKEN = 'Bad macro token: [%s].'
+ERR_EMPTY_TOKEN = 'Empty token is not allowed.'
+ERR_PCD_RESOLVE = 'The PCD should be FeatureFlag type or FixedAtBuild type: [%s].'
+ERR_VALID_TOKEN = 'No more valid token found from rest of string: [%s].'
+ERR_EXPR_TYPE = 'Different types found in expression.'
+ERR_OPERATOR_UNSUPPORT = 'Unsupported operator: [%s]'
+ERR_REL_NOT_IN = 'Expect "IN" after "not" operator.'
+WRN_BOOL_EXPR = 'Operand of boolean type cannot be used in arithmetic expression.'
+WRN_EQCMP_STR_OTHERS = '== Comparison between Operand of string type and Boolean/Number Type always return False.'
+WRN_NECMP_STR_OTHERS = '!= Comparison between Operand of string type and Boolean/Number Type always return True.'
+ERR_RELCMP_STR_OTHERS = 'Operator taking Operand of string type and Boolean/Number Type is not allowed: [%s].'
+ERR_STRING_CMP = 'Unicode string and general string cannot be compared: [%s %s %s]'
+ERR_ARRAY_TOKEN = 'Bad C array or C format GUID token: [%s].'
+ERR_ARRAY_ELE = 'This must be HEX value for NList or Array: [%s].'
+ERR_EMPTY_EXPR = 'Empty expression is not allowed.'
+ERR_IN_OPERAND = 'Macro after IN operator can only be: $(FAMILY), $(ARCH), $(TOOL_CHAIN_TAG) and $(TARGET).'
+
+__ValidString = re.compile(r'[_a-zA-Z][_0-9a-zA-Z]*$')
+_ReLabel = re.compile('LABEL\((\w+)\)')
+_ReOffset = re.compile('OFFSET_OF\((\w+)\)')
+PcdPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-z_]*$')
+
+## SplitString
+# Split string to list according double quote
+# For example: abc"de\"f"ghi"jkl"mn will be: ['abc', '"de\"f"', 'ghi', '"jkl"', 'mn']
+#
+def SplitString(String):
+ # There might be escaped quote: "abc\"def\\\"ghi", 'abc\'def\\\'ghi'
+ RanStr = ''.join(sample(string.ascii_letters + string.digits, 8))
+ String = String.replace('\\\\', RanStr).strip()
+ RetList = []
+ InSingleQuote = False
+ InDoubleQuote = False
+ Item = ''
+ for i, ch in enumerate(String):
+ if ch == '"' and not InSingleQuote:
+ if String[i - 1] != '\\':
+ InDoubleQuote = not InDoubleQuote
+ if not InDoubleQuote:
+ Item += String[i]
+ RetList.append(Item)
+ Item = ''
+ continue
+ if Item:
+ RetList.append(Item)
+ Item = ''
+ elif ch == "'" and not InDoubleQuote:
+ if String[i - 1] != '\\':
+ InSingleQuote = not InSingleQuote
+ if not InSingleQuote:
+ Item += String[i]
+ RetList.append(Item)
+ Item = ''
+ continue
+ if Item:
+ RetList.append(Item)
+ Item = ''
+ Item += String[i]
+ if InSingleQuote or InDoubleQuote:
+ raise BadExpression(ERR_STRING_TOKEN % Item)
+ if Item:
+ RetList.append(Item)
+ for i, ch in enumerate(RetList):
+ if RanStr in ch:
+ RetList[i] = ch.replace(RanStr,'\\\\')
+ return RetList
+
+def SplitPcdValueString(String):
+ # There might be escaped comma in GUID() or DEVICE_PATH() or " "
+ # or ' ' or L' ' or L" "
+ RanStr = ''.join(sample(string.ascii_letters + string.digits, 8))
+ String = String.replace('\\\\', RanStr).strip()
+ RetList = []
+ InParenthesis = 0
+ InSingleQuote = False
+ InDoubleQuote = False
+ Item = ''
+ for i, ch in enumerate(String):
+ if ch == '(':
+ InParenthesis += 1
+ elif ch == ')':
+ if InParenthesis:
+ InParenthesis -= 1
+ else:
+ raise BadExpression(ERR_STRING_TOKEN % Item)
+ elif ch == '"' and not InSingleQuote:
+ if String[i-1] != '\\':
+ InDoubleQuote = not InDoubleQuote
+ elif ch == "'" and not InDoubleQuote:
+ if String[i-1] != '\\':
+ InSingleQuote = not InSingleQuote
+ elif ch == ',':
+ if InParenthesis or InSingleQuote or InDoubleQuote:
+ Item += String[i]
+ continue
+ elif Item:
+ RetList.append(Item)
+ Item = ''
+ continue
+ Item += String[i]
+ if InSingleQuote or InDoubleQuote or InParenthesis:
+ raise BadExpression(ERR_STRING_TOKEN % Item)
+ if Item:
+ RetList.append(Item)
+ for i, ch in enumerate(RetList):
+ if RanStr in ch:
+ RetList[i] = ch.replace(RanStr,'\\\\')
+ return RetList
+
+def IsValidCName(Str):
+ return True if __ValidString.match(Str) else False
+
+def BuildOptionValue(PcdValue, GuidDict):
+ if PcdValue.startswith('H'):
+ InputValue = PcdValue[1:]
+ elif PcdValue.startswith("L'") or PcdValue.startswith("'"):
+ InputValue = PcdValue
+ elif PcdValue.startswith('L'):
+ InputValue = 'L"' + PcdValue[1:] + '"'
+ else:
+ InputValue = PcdValue
+ try:
+ PcdValue = ValueExpressionEx(InputValue, TAB_VOID, GuidDict)(True)
+ except:
+ pass
+
+ return PcdValue
+
+## ReplaceExprMacro
+#
+def ReplaceExprMacro(String, Macros, ExceptionList = None):
+ StrList = SplitString(String)
+ for i, String in enumerate(StrList):
+ InQuote = False
+ if String.startswith('"'):
+ InQuote = True
+ MacroStartPos = String.find('$(')
+ if MacroStartPos < 0:
+ for Pcd in gPlatformPcds:
+ if Pcd in String:
+ if Pcd not in gConditionalPcds:
+ gConditionalPcds.append(Pcd)
+ continue
+ RetStr = ''
+ while MacroStartPos >= 0:
+ RetStr = String[0:MacroStartPos]
+ MacroEndPos = String.find(')', MacroStartPos)
+ if MacroEndPos < 0:
+ raise BadExpression(ERR_MACRO_TOKEN % String[MacroStartPos:])
+ Macro = String[MacroStartPos+2:MacroEndPos]
+ if Macro not in Macros:
+ # From C reference manual:
+ # If an undefined macro name appears in the constant-expression of
+ # !if or !elif, it is replaced by the integer constant 0.
+ RetStr += '0'
+ elif not InQuote:
+ Tklst = RetStr.split()
+ if Tklst and Tklst[-1] in {'IN', 'in'} and ExceptionList and Macro not in ExceptionList:
+ raise BadExpression(ERR_IN_OPERAND)
+ # Make sure the macro in exception list is encapsulated by double quote
+ # For example: DEFINE ARCH = IA32 X64
+ # $(ARCH) is replaced with "IA32 X64"
+ if ExceptionList and Macro in ExceptionList:
+ RetStr += '"' + Macros[Macro] + '"'
+ elif Macros[Macro].strip():
+ RetStr += Macros[Macro]
+ else:
+ RetStr += '""'
+ else:
+ RetStr += Macros[Macro]
+ RetStr += String[MacroEndPos+1:]
+ String = RetStr
+ MacroStartPos = String.find('$(')
+ StrList[i] = RetStr
+ return ''.join(StrList)
+
+# transfer int to string for in/not in expression
+def IntToStr(Value):
+ StrList = []
+ while Value > 0:
+ StrList.append(chr(Value & 0xff))
+ Value = Value >> 8
+ Value = '"' + ''.join(StrList) + '"'
+ return Value
+
+SupportedInMacroList = ['TARGET', 'TOOL_CHAIN_TAG', 'ARCH', 'FAMILY']
+
+class BaseExpression(object):
+ def __init__(self, *args, **kwargs):
+ super(BaseExpression, self).__init__()
+
+ # Check if current token matches the operators given from parameter
+ def _IsOperator(self, OpSet):
+ Idx = self._Idx
+ self._GetOperator()
+ if self._Token in OpSet:
+ if self._Token in self.LogicalOperators:
+ self._Token = self.LogicalOperators[self._Token]
+ return True
+ self._Idx = Idx
+ return False
+
+class ValueExpression(BaseExpression):
+ # Logical operator mapping
+ LogicalOperators = {
+ '&&' : 'and', '||' : 'or',
+ '!' : 'not', 'AND': 'and',
+ 'OR' : 'or' , 'NOT': 'not',
+ 'XOR': '^' , 'xor': '^',
+ 'EQ' : '==' , 'NE' : '!=',
+ 'GT' : '>' , 'LT' : '<',
+ 'GE' : '>=' , 'LE' : '<=',
+ 'IN' : 'in'
+ }
+
+ NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<', '?', ':']
+
+
+ SymbolPattern = re.compile("("
+ "\$\([A-Z][A-Z0-9_]*\)|\$\(\w+\.\w+\)|\w+\.\w+|"
+ "&&|\|\||!(?!=)|"
+ "(?<=\W)AND(?=\W)|(?<=\W)OR(?=\W)|(?<=\W)NOT(?=\W)|(?<=\W)XOR(?=\W)|"
+ "(?<=\W)EQ(?=\W)|(?<=\W)NE(?=\W)|(?<=\W)GT(?=\W)|(?<=\W)LT(?=\W)|(?<=\W)GE(?=\W)|(?<=\W)LE(?=\W)"
+ ")")
+
+ @staticmethod
+ def Eval(Operator, Oprand1, Oprand2 = None):
+ WrnExp = None
+
+ if Operator not in {"==", "!=", ">=", "<=", ">", "<", "in", "not in"} and \
+ (isinstance(Oprand1, type('')) or isinstance(Oprand2, type(''))):
+ raise BadExpression(ERR_STRING_EXPR % Operator)
+ if Operator in {'in', 'not in'}:
+ if not isinstance(Oprand1, type('')):
+ Oprand1 = IntToStr(Oprand1)
+ if not isinstance(Oprand2, type('')):
+ Oprand2 = IntToStr(Oprand2)
+ TypeDict = {
+ type(0) : 0,
+ # For python2 long type
+ type(sys.maxsize + 1) : 0,
+ type('') : 1,
+ type(True) : 2
+ }
+
+ EvalStr = ''
+ if Operator in {"!", "NOT", "not"}:
+ if isinstance(Oprand1, type('')):
+ raise BadExpression(ERR_STRING_EXPR % Operator)
+ EvalStr = 'not Oprand1'
+ elif Operator in {"~"}:
+ if isinstance(Oprand1, type('')):
+ raise BadExpression(ERR_STRING_EXPR % Operator)
+ EvalStr = '~ Oprand1'
+ else:
+ if Operator in {"+", "-"} and (type(True) in {type(Oprand1), type(Oprand2)}):
+ # Boolean in '+'/'-' will be evaluated but raise warning
+ WrnExp = WrnExpression(WRN_BOOL_EXPR)
+ elif type('') in {type(Oprand1), type(Oprand2)} and not isinstance(Oprand1, type(Oprand2)):
+ # == between string and number/boolean will always return False, != return True
+ if Operator == "==":
+ WrnExp = WrnExpression(WRN_EQCMP_STR_OTHERS)
+ WrnExp.result = False
+ raise WrnExp
+ elif Operator == "!=":
+ WrnExp = WrnExpression(WRN_NECMP_STR_OTHERS)
+ WrnExp.result = True
+ raise WrnExp
+ else:
+ raise BadExpression(ERR_RELCMP_STR_OTHERS % Operator)
+ elif TypeDict[type(Oprand1)] != TypeDict[type(Oprand2)]:
+ if Operator in {"==", "!=", ">=", "<=", ">", "<"} and set((TypeDict[type(Oprand1)], TypeDict[type(Oprand2)])) == set((TypeDict[type(True)], TypeDict[type(0)])):
+ # comparison between number and boolean is allowed
+ pass
+ elif Operator in {'&', '|', '^', "and", "or"} and set((TypeDict[type(Oprand1)], TypeDict[type(Oprand2)])) == set((TypeDict[type(True)], TypeDict[type(0)])):
+ # bitwise and logical operation between number and boolean is allowed
+ pass
+ else:
+ raise BadExpression(ERR_EXPR_TYPE)
+ if isinstance(Oprand1, type('')) and isinstance(Oprand2, type('')):
+ if ((Oprand1.startswith('L"') or Oprand1.startswith("L'")) and (not Oprand2.startswith('L"')) and (not Oprand2.startswith("L'"))) or \
+ (((not Oprand1.startswith('L"')) and (not Oprand1.startswith("L'"))) and (Oprand2.startswith('L"') or Oprand2.startswith("L'"))):
+ raise BadExpression(ERR_STRING_CMP % (Oprand1, Operator, Oprand2))
+ if 'in' in Operator and isinstance(Oprand2, type('')):
+ Oprand2 = Oprand2.split()
+ EvalStr = 'Oprand1 ' + Operator + ' Oprand2'
+
+ # Local symbols used by built in eval function
+ Dict = {
+ 'Oprand1' : Oprand1,
+ 'Oprand2' : Oprand2
+ }
+ try:
+ Val = eval(EvalStr, {}, Dict)
+ except Exception as Excpt:
+ raise BadExpression(str(Excpt))
+
+ if Operator in {'and', 'or'}:
+ if Val:
+ Val = True
+ else:
+ Val = False
+
+ if WrnExp:
+ WrnExp.result = Val
+ raise WrnExp
+ return Val
+
+ def __init__(self, Expression, SymbolTable={}):
+ super(ValueExpression, self).__init__(self, Expression, SymbolTable)
+ self._NoProcess = False
+ if not isinstance(Expression, type('')):
+ self._Expr = Expression
+ self._NoProcess = True
+ return
+
+ self._Expr = ReplaceExprMacro(Expression.strip(),
+ SymbolTable,
+ SupportedInMacroList)
+
+ if not self._Expr.strip():
+ raise BadExpression(ERR_EMPTY_EXPR)
+
+ #
+ # The symbol table including PCD and macro mapping
+ #
+ self._Symb = CopyDict(SymbolTable)
+ self._Symb.update(self.LogicalOperators)
+ self._Idx = 0
+ self._Len = len(self._Expr)
+ self._Token = ''
+ self._WarnExcept = None
+
+ # Literal token without any conversion
+ self._LiteralToken = ''
+
+ # Public entry for this class
+ # @param RealValue: False: only evaluate if the expression is true or false, used for conditional expression
+ # True : return the evaluated str(value), used for PCD value
+ #
+ # @return: True or False if RealValue is False
+ # Evaluated value of string format if RealValue is True
+ #
+ def __call__(self, RealValue=False, Depth=0):
+ if self._NoProcess:
+ return self._Expr
+
+ self._Depth = Depth
+
+ self._Expr = self._Expr.strip()
+ if RealValue and Depth == 0:
+ self._Token = self._Expr
+ if self.__IsNumberToken():
+ return self._Expr
+ Token = ''
+ try:
+ Token = self._GetToken()
+ except BadExpression:
+ pass
+ if isinstance(Token, type('')) and Token.startswith('{') and Token.endswith('}') and self._Idx >= self._Len:
+ return self._Expr
+
+ self._Idx = 0
+ self._Token = ''
+
+ Val = self._ConExpr()
+ RealVal = Val
+ if isinstance(Val, type('')):
+ if Val == 'L""':
+ Val = False
+ elif not Val:
+ Val = False
+ RealVal = '""'
+ elif not Val.startswith('L"') and not Val.startswith('{') and not Val.startswith("L'") and not Val.startswith("'"):
+ Val = True
+ RealVal = '"' + RealVal + '"'
+
+ # The expression has been parsed, but the end of expression is not reached
+ # It means the rest does not comply EBNF of <Expression>
+ if self._Idx != self._Len:
+ raise BadExpression(ERR_SNYTAX % self._Expr[self._Idx:])
+
+ if RealValue:
+ RetVal = str(RealVal)
+ elif Val:
+ RetVal = True
+ else:
+ RetVal = False
+
+ if self._WarnExcept:
+ self._WarnExcept.result = RetVal
+ raise self._WarnExcept
+ else:
+ return RetVal
+
+ # Template function to parse binary operators which have same precedence
+ # Expr [Operator Expr]*
+ def _ExprFuncTemplate(self, EvalFunc, OpSet):
+ Val = EvalFunc()
+ while self._IsOperator(OpSet):
+ Op = self._Token
+ if Op == '?':
+ Val2 = EvalFunc()
+ if self._IsOperator({':'}):
+ Val3 = EvalFunc()
+ if Val:
+ Val = Val2
+ else:
+ Val = Val3
+ continue
+ #
+ # PEP 238 -- Changing the Division Operator
+ # x/y to return a reasonable approximation of the mathematical result of the division ("true division")
+ # x//y to return the floor ("floor division")
+ #
+ if Op == '/':
+ Op = '//'
+ try:
+ Val = self.Eval(Op, Val, EvalFunc())
+ except WrnExpression as Warn:
+ self._WarnExcept = Warn
+ Val = Warn.result
+ return Val
+ # A [? B]*
+ def _ConExpr(self):
+ return self._ExprFuncTemplate(self._OrExpr, {'?', ':'})
+
+ # A [|| B]*
+ def _OrExpr(self):
+ return self._ExprFuncTemplate(self._AndExpr, {"OR", "or", "||"})
+
+ # A [&& B]*
+ def _AndExpr(self):
+ return self._ExprFuncTemplate(self._BitOr, {"AND", "and", "&&"})
+
+ # A [ | B]*
+ def _BitOr(self):
+ return self._ExprFuncTemplate(self._BitXor, {"|"})
+
+ # A [ ^ B]*
+ def _BitXor(self):
+ return self._ExprFuncTemplate(self._BitAnd, {"XOR", "xor", "^"})
+
+ # A [ & B]*
+ def _BitAnd(self):
+ return self._ExprFuncTemplate(self._EqExpr, {"&"})
+
+ # A [ == B]*
+ def _EqExpr(self):
+ Val = self._RelExpr()
+ while self._IsOperator({"==", "!=", "EQ", "NE", "IN", "in", "!", "NOT", "not"}):
+ Op = self._Token
+ if Op in {"!", "NOT", "not"}:
+ if not self._IsOperator({"IN", "in"}):
+ raise BadExpression(ERR_REL_NOT_IN)
+ Op += ' ' + self._Token
+ try:
+ Val = self.Eval(Op, Val, self._RelExpr())
+ except WrnExpression as Warn:
+ self._WarnExcept = Warn
+ Val = Warn.result
+ return Val
+
+ # A [ > B]*
+ def _RelExpr(self):
+ return self._ExprFuncTemplate(self._ShiftExpr, {"<=", ">=", "<", ">", "LE", "GE", "LT", "GT"})
+
+ def _ShiftExpr(self):
+ return self._ExprFuncTemplate(self._AddExpr, {"<<", ">>"})
+
+ # A [ + B]*
+ def _AddExpr(self):
+ return self._ExprFuncTemplate(self._MulExpr, {"+", "-"})
+
+ # A [ * B]*
+ def _MulExpr(self):
+ return self._ExprFuncTemplate(self._UnaryExpr, {TAB_STAR, "/", "%"})
+
+ # [!]*A
+ def _UnaryExpr(self):
+ if self._IsOperator({"!", "NOT", "not"}):
+ Val = self._UnaryExpr()
+ try:
+ return self.Eval('not', Val)
+ except WrnExpression as Warn:
+ self._WarnExcept = Warn
+ return Warn.result
+ if self._IsOperator({"~"}):
+ Val = self._UnaryExpr()
+ try:
+ return self.Eval('~', Val)
+ except WrnExpression as Warn:
+ self._WarnExcept = Warn
+ return Warn.result
+ return self._IdenExpr()
+
+ # Parse identifier or encapsulated expression
+ def _IdenExpr(self):
+ Tk = self._GetToken()
+ if Tk == '(':
+ Val = self._ConExpr()
+ try:
+ # _GetToken may also raise BadExpression
+ if self._GetToken() != ')':
+ raise BadExpression(ERR_MATCH)
+ except BadExpression:
+ raise BadExpression(ERR_MATCH)
+ return Val
+ return Tk
+
+ # Skip whitespace or tab
+ def __SkipWS(self):
+ for Char in self._Expr[self._Idx:]:
+ if Char not in ' \t':
+ break
+ self._Idx += 1
+
+ # Try to convert string to number
+ def __IsNumberToken(self):
+ Radix = 10
+ if self._Token.lower()[0:2] == '0x' and len(self._Token) > 2:
+ Radix = 16
+ if self._Token.startswith('"') or self._Token.startswith('L"'):
+ Flag = 0
+ for Index in range(len(self._Token)):
+ if self._Token[Index] in {'"'}:
+ if self._Token[Index - 1] == '\\':
+ continue
+ Flag += 1
+ if Flag == 2 and self._Token.endswith('"'):
+ return True
+ if self._Token.startswith("'") or self._Token.startswith("L'"):
+ Flag = 0
+ for Index in range(len(self._Token)):
+ if self._Token[Index] in {"'"}:
+ if self._Token[Index - 1] == '\\':
+ continue
+ Flag += 1
+ if Flag == 2 and self._Token.endswith("'"):
+ return True
+ try:
+ self._Token = int(self._Token, Radix)
+ return True
+ except ValueError:
+ return False
+ except TypeError:
+ return False
+
+ # Parse array: {...}
+ def __GetArray(self):
+ Token = '{'
+ self._Idx += 1
+ self.__GetNList(True)
+ Token += self._LiteralToken
+ if self._Idx >= self._Len or self._Expr[self._Idx] != '}':
+ raise BadExpression(ERR_ARRAY_TOKEN % Token)
+ Token += '}'
+
+ # All whitespace and tabs in array are already stripped.
+ IsArray = IsGuid = False
+ if len(Token.split(',')) == 11 and len(Token.split(',{')) == 2 \
+ and len(Token.split('},')) == 1:
+ HexLen = [11, 6, 6, 5, 4, 4, 4, 4, 4, 4, 6]
+ HexList= Token.split(',')
+ if HexList[3].startswith('{') and \
+ not [Index for Index, Hex in enumerate(HexList) if len(Hex) > HexLen[Index]]:
+ IsGuid = True
+ if Token.lstrip('{').rstrip('}').find('{') == -1:
+ if not [Hex for Hex in Token.lstrip('{').rstrip('}').split(',') if len(Hex) > 4]:
+ IsArray = True
+ if not IsArray and not IsGuid:
+ raise BadExpression(ERR_ARRAY_TOKEN % Token)
+ self._Idx += 1
+ self._Token = self._LiteralToken = Token
+ return self._Token
+
+ # Parse string, the format must be: "..."
+ def __GetString(self):
+ Idx = self._Idx
+
+ # Skip left quote
+ self._Idx += 1
+
+ # Replace escape \\\", \"
+ if self._Expr[Idx] == '"':
+ Expr = self._Expr[self._Idx:].replace('\\\\', '//').replace('\\\"', '\\\'')
+ for Ch in Expr:
+ self._Idx += 1
+ if Ch == '"':
+ break
+ self._Token = self._LiteralToken = self._Expr[Idx:self._Idx]
+ if not self._Token.endswith('"'):
+ raise BadExpression(ERR_STRING_TOKEN % self._Token)
+ #Replace escape \\\', \'
+ elif self._Expr[Idx] == "'":
+ Expr = self._Expr[self._Idx:].replace('\\\\', '//').replace("\\\'", "\\\"")
+ for Ch in Expr:
+ self._Idx += 1
+ if Ch == "'":
+ break
+ self._Token = self._LiteralToken = self._Expr[Idx:self._Idx]
+ if not self._Token.endswith("'"):
+ raise BadExpression(ERR_STRING_TOKEN % self._Token)
+ self._Token = self._Token[1:-1]
+ return self._Token
+
+ # Get token that is comprised by alphanumeric, underscore or dot(used by PCD)
+ # @param IsAlphaOp: Indicate if parsing general token or script operator(EQ, NE...)
+ def __GetIdToken(self, IsAlphaOp = False):
+ IdToken = ''
+ for Ch in self._Expr[self._Idx:]:
+ if not self.__IsIdChar(Ch) or ('?' in self._Expr and Ch == ':'):
+ break
+ self._Idx += 1
+ IdToken += Ch
+
+ self._Token = self._LiteralToken = IdToken
+ if not IsAlphaOp:
+ self.__ResolveToken()
+ return self._Token
+
+ # Try to resolve token
+ def __ResolveToken(self):
+ if not self._Token:
+ raise BadExpression(ERR_EMPTY_TOKEN)
+
+ # PCD token
+ if PcdPattern.match(self._Token):
+ if self._Token not in self._Symb:
+ Ex = BadExpression(ERR_PCD_RESOLVE % self._Token)
+ Ex.Pcd = self._Token
+ raise Ex
+ self._Token = ValueExpression(self._Symb[self._Token], self._Symb)(True, self._Depth+1)
+ if not isinstance(self._Token, type('')):
+ self._LiteralToken = hex(self._Token)
+ return
+
+ if self._Token.startswith('"'):
+ self._Token = self._Token[1:-1]
+ elif self._Token in {"FALSE", "false", "False"}:
+ self._Token = False
+ elif self._Token in {"TRUE", "true", "True"}:
+ self._Token = True
+ else:
+ self.__IsNumberToken()
+
+ def __GetNList(self, InArray=False):
+ self._GetSingleToken()
+ if not self.__IsHexLiteral():
+ if InArray:
+ raise BadExpression(ERR_ARRAY_ELE % self._Token)
+ return self._Token
+
+ self.__SkipWS()
+ Expr = self._Expr[self._Idx:]
+ if not Expr.startswith(','):
+ return self._Token
+
+ NList = self._LiteralToken
+ while Expr.startswith(','):
+ NList += ','
+ self._Idx += 1
+ self.__SkipWS()
+ self._GetSingleToken()
+ if not self.__IsHexLiteral():
+ raise BadExpression(ERR_ARRAY_ELE % self._Token)
+ NList += self._LiteralToken
+ self.__SkipWS()
+ Expr = self._Expr[self._Idx:]
+ self._Token = self._LiteralToken = NList
+ return self._Token
+
+ def __IsHexLiteral(self):
+ if self._LiteralToken.startswith('{') and \
+ self._LiteralToken.endswith('}'):
+ return True
+
+ if gHexPattern.match(self._LiteralToken):
+ Token = self._LiteralToken[2:]
+ if not Token:
+ self._LiteralToken = '0x0'
+ else:
+ self._LiteralToken = '0x' + Token
+ return True
+ return False
+
+ def _GetToken(self):
+ return self.__GetNList()
+
+ @staticmethod
+ def __IsIdChar(Ch):
+ return Ch in '._:' or Ch.isalnum()
+
+ # Parse operand
+ def _GetSingleToken(self):
+ self.__SkipWS()
+ Expr = self._Expr[self._Idx:]
+ if Expr.startswith('L"'):
+ # Skip L
+ self._Idx += 1
+ UStr = self.__GetString()
+ self._Token = 'L"' + UStr + '"'
+ return self._Token
+ elif Expr.startswith("L'"):
+ # Skip L
+ self._Idx += 1
+ UStr = self.__GetString()
+ self._Token = "L'" + UStr + "'"
+ return self._Token
+ elif Expr.startswith("'"):
+ UStr = self.__GetString()
+ self._Token = "'" + UStr + "'"
+ return self._Token
+ elif Expr.startswith('UINT'):
+ Re = re.compile('(?:UINT8|UINT16|UINT32|UINT64)\((.+)\)')
+ try:
+ RetValue = Re.search(Expr).group(1)
+ except:
+ raise BadExpression('Invalid Expression %s' % Expr)
+ Idx = self._Idx
+ for Ch in Expr:
+ self._Idx += 1
+ if Ch == '(':
+ Prefix = self._Expr[Idx:self._Idx - 1]
+ Idx = self._Idx
+ if Ch == ')':
+ TmpValue = self._Expr[Idx :self._Idx - 1]
+ TmpValue = ValueExpression(TmpValue)(True)
+ TmpValue = '0x%x' % int(TmpValue) if not isinstance(TmpValue, type('')) else TmpValue
+ break
+ self._Token, Size = ParseFieldValue(Prefix + '(' + TmpValue + ')')
+ return self._Token
+
+ self._Token = ''
+ if Expr:
+ Ch = Expr[0]
+ Match = gGuidPattern.match(Expr)
+ if Match and not Expr[Match.end():Match.end()+1].isalnum() \
+ and Expr[Match.end():Match.end()+1] != '_':
+ self._Idx += Match.end()
+ self._Token = ValueExpression(GuidStringToGuidStructureString(Expr[0:Match.end()]))(True, self._Depth+1)
+ return self._Token
+ elif self.__IsIdChar(Ch):
+ return self.__GetIdToken()
+ elif Ch == '"':
+ return self.__GetString()
+ elif Ch == '{':
+ return self.__GetArray()
+ elif Ch == '(' or Ch == ')':
+ self._Idx += 1
+ self._Token = Ch
+ return self._Token
+
+ raise BadExpression(ERR_VALID_TOKEN % Expr)
+
+ # Parse operator
+ def _GetOperator(self):
+ self.__SkipWS()
+ LegalOpLst = ['&&', '||', '!=', '==', '>=', '<='] + self.NonLetterOpLst + ['?', ':']
+
+ self._Token = ''
+ Expr = self._Expr[self._Idx:]
+
+ # Reach end of expression
+ if not Expr:
+ return ''
+
+ # Script operator: LT, GT, LE, GE, EQ, NE, and, or, xor, not
+ if Expr[0].isalpha():
+ return self.__GetIdToken(True)
+
+ # Start to get regular operator: +, -, <, > ...
+ if Expr[0] not in self.NonLetterOpLst:
+ return ''
+
+ OpToken = ''
+ for Ch in Expr:
+ if Ch in self.NonLetterOpLst:
+ if Ch in ['!', '~'] and OpToken:
+ break
+ self._Idx += 1
+ OpToken += Ch
+ else:
+ break
+
+ if OpToken not in LegalOpLst:
+ raise BadExpression(ERR_OPERATOR_UNSUPPORT % OpToken)
+ self._Token = OpToken
+ return OpToken
+
+class ValueExpressionEx(ValueExpression):
+ def __init__(self, PcdValue, PcdType, SymbolTable={}):
+ ValueExpression.__init__(self, PcdValue, SymbolTable)
+ self.PcdValue = PcdValue
+ self.PcdType = PcdType
+
+ def __call__(self, RealValue=False, Depth=0):
+ PcdValue = self.PcdValue
+ if "{CODE(" not in PcdValue:
+ try:
+ PcdValue = ValueExpression.__call__(self, RealValue, Depth)
+ if self.PcdType == TAB_VOID and (PcdValue.startswith("'") or PcdValue.startswith("L'")):
+ PcdValue, Size = ParseFieldValue(PcdValue)
+ PcdValueList = []
+ for I in range(Size):
+ PcdValueList.append('0x%02X'%(PcdValue & 0xff))
+ PcdValue = PcdValue >> 8
+ PcdValue = '{' + ','.join(PcdValueList) + '}'
+ elif self.PcdType in TAB_PCD_NUMERIC_TYPES and (PcdValue.startswith("'") or \
+ PcdValue.startswith('"') or PcdValue.startswith("L'") or PcdValue.startswith('L"') or PcdValue.startswith('{')):
+ raise BadExpression
+ except WrnExpression as Value:
+ PcdValue = Value.result
+ except BadExpression as Value:
+ if self.PcdType in TAB_PCD_NUMERIC_TYPES:
+ PcdValue = PcdValue.strip()
+ if PcdValue.startswith('{') and PcdValue.endswith('}'):
+ PcdValue = SplitPcdValueString(PcdValue[1:-1])
+ if isinstance(PcdValue, type([])):
+ TmpValue = 0
+ Size = 0
+ ValueType = ''
+ for Item in PcdValue:
+ Item = Item.strip()
+ if Item.startswith(TAB_UINT8):
+ ItemSize = 1
+ ValueType = TAB_UINT8
+ elif Item.startswith(TAB_UINT16):
+ ItemSize = 2
+ ValueType = TAB_UINT16
+ elif Item.startswith(TAB_UINT32):
+ ItemSize = 4
+ ValueType = TAB_UINT32
+ elif Item.startswith(TAB_UINT64):
+ ItemSize = 8
+ ValueType = TAB_UINT64
+ elif Item[0] in {'"', "'", 'L'}:
+ ItemSize = 0
+ ValueType = TAB_VOID
+ else:
+ ItemSize = 0
+ ValueType = TAB_UINT8
+ Item = ValueExpressionEx(Item, ValueType, self._Symb)(True)
+ if ItemSize == 0:
+ try:
+ tmpValue = int(Item, 0)
+ if tmpValue > 255:
+ raise BadExpression("Byte array number %s should less than 0xFF." % Item)
+ except BadExpression as Value:
+ raise BadExpression(Value)
+ except ValueError:
+ pass
+ ItemValue, ItemSize = ParseFieldValue(Item)
+ else:
+ ItemValue = ParseFieldValue(Item)[0]
+
+ if isinstance(ItemValue, type('')):
+ ItemValue = int(ItemValue, 0)
+
+ TmpValue = (ItemValue << (Size * 8)) | TmpValue
+ Size = Size + ItemSize
+ else:
+ try:
+ TmpValue, Size = ParseFieldValue(PcdValue)
+ except BadExpression as Value:
+ raise BadExpression("Type: %s, Value: %s, %s" % (self.PcdType, PcdValue, Value))
+ if isinstance(TmpValue, type('')):
+ try:
+ TmpValue = int(TmpValue)
+ except:
+ raise BadExpression(Value)
+ else:
+ PcdValue = '0x%0{}X'.format(Size) % (TmpValue)
+ if TmpValue < 0:
+ raise BadExpression('Type %s PCD Value is negative' % self.PcdType)
+ if self.PcdType == TAB_UINT8 and Size > 1:
+ raise BadExpression('Type %s PCD Value Size is Larger than 1 byte' % self.PcdType)
+ if self.PcdType == TAB_UINT16 and Size > 2:
+ raise BadExpression('Type %s PCD Value Size is Larger than 2 byte' % self.PcdType)
+ if self.PcdType == TAB_UINT32 and Size > 4:
+ raise BadExpression('Type %s PCD Value Size is Larger than 4 byte' % self.PcdType)
+ if self.PcdType == TAB_UINT64 and Size > 8:
+ raise BadExpression('Type %s PCD Value Size is Larger than 8 byte' % self.PcdType)
+ else:
+ try:
+ TmpValue = int(PcdValue)
+ TmpList = []
+ if TmpValue.bit_length() == 0:
+ PcdValue = '{0x00}'
+ else:
+ for I in range((TmpValue.bit_length() + 7) // 8):
+ TmpList.append('0x%02x' % ((TmpValue >> I * 8) & 0xff))
+ PcdValue = '{' + ', '.join(TmpList) + '}'
+ except:
+ if PcdValue.strip().startswith('{'):
+ PcdValueList = SplitPcdValueString(PcdValue.strip()[1:-1])
+ LabelDict = {}
+ NewPcdValueList = []
+ LabelOffset = 0
+ for Item in PcdValueList:
+ # compute byte offset of every LABEL
+ LabelList = _ReLabel.findall(Item)
+ Item = _ReLabel.sub('', Item)
+ Item = Item.strip()
+ if LabelList:
+ for Label in LabelList:
+ if not IsValidCName(Label):
+ raise BadExpression('%s is not a valid c variable name' % Label)
+ if Label not in LabelDict:
+ LabelDict[Label] = str(LabelOffset)
+ if Item.startswith(TAB_UINT8):
+ LabelOffset = LabelOffset + 1
+ elif Item.startswith(TAB_UINT16):
+ LabelOffset = LabelOffset + 2
+ elif Item.startswith(TAB_UINT32):
+ LabelOffset = LabelOffset + 4
+ elif Item.startswith(TAB_UINT64):
+ LabelOffset = LabelOffset + 8
+ else:
+ try:
+ ItemValue, ItemSize = ParseFieldValue(Item)
+ LabelOffset = LabelOffset + ItemSize
+ except:
+ LabelOffset = LabelOffset + 1
+
+ for Item in PcdValueList:
+ # for LABEL parse
+ Item = Item.strip()
+ try:
+ Item = _ReLabel.sub('', Item)
+ except:
+ pass
+ try:
+ OffsetList = _ReOffset.findall(Item)
+ except:
+ pass
+ # replace each offset, except errors
+ for Offset in OffsetList:
+ try:
+ Item = Item.replace('OFFSET_OF({})'.format(Offset), LabelDict[Offset])
+ except:
+ raise BadExpression('%s not defined' % Offset)
+
+ NewPcdValueList.append(Item)
+
+ AllPcdValueList = []
+ for Item in NewPcdValueList:
+ Size = 0
+ ValueStr = ''
+ TokenSpaceGuidName = ''
+ if Item.startswith(TAB_GUID) and Item.endswith(')'):
+ try:
+ TokenSpaceGuidName = re.search('GUID\((\w+)\)', Item).group(1)
+ except:
+ pass
+ if TokenSpaceGuidName and TokenSpaceGuidName in self._Symb:
+ Item = 'GUID(' + self._Symb[TokenSpaceGuidName] + ')'
+ elif TokenSpaceGuidName:
+ raise BadExpression('%s not found in DEC file' % TokenSpaceGuidName)
+ Item, Size = ParseFieldValue(Item)
+ for Index in range(0, Size):
+ ValueStr = '0x%02X' % (int(Item) & 255)
+ Item >>= 8
+ AllPcdValueList.append(ValueStr)
+ continue
+ elif Item.startswith('DEVICE_PATH') and Item.endswith(')'):
+ Item, Size = ParseFieldValue(Item)
+ AllPcdValueList.append(Item[1:-1])
+ continue
+ else:
+ ValueType = ""
+ if Item.startswith(TAB_UINT8):
+ ItemSize = 1
+ ValueType = TAB_UINT8
+ elif Item.startswith(TAB_UINT16):
+ ItemSize = 2
+ ValueType = TAB_UINT16
+ elif Item.startswith(TAB_UINT32):
+ ItemSize = 4
+ ValueType = TAB_UINT32
+ elif Item.startswith(TAB_UINT64):
+ ItemSize = 8
+ ValueType = TAB_UINT64
+ else:
+ ItemSize = 0
+ if ValueType:
+ TmpValue = ValueExpressionEx(Item, ValueType, self._Symb)(True)
+ else:
+ TmpValue = ValueExpressionEx(Item, self.PcdType, self._Symb)(True)
+ Item = '0x%x' % TmpValue if not isinstance(TmpValue, type('')) else TmpValue
+ if ItemSize == 0:
+ ItemValue, ItemSize = ParseFieldValue(Item)
+ if Item[0] not in {'"', 'L', '{'} and ItemSize > 1:
+ raise BadExpression("Byte array number %s should less than 0xFF." % Item)
+ else:
+ ItemValue = ParseFieldValue(Item)[0]
+ for I in range(0, ItemSize):
+ ValueStr = '0x%02X' % (int(ItemValue) & 255)
+ ItemValue >>= 8
+ AllPcdValueList.append(ValueStr)
+ Size += ItemSize
+
+ if Size > 0:
+ PcdValue = '{' + ','.join(AllPcdValueList) + '}'
+ else:
+ raise BadExpression("Type: %s, Value: %s, %s"%(self.PcdType, PcdValue, Value))
+
+ if PcdValue == 'True':
+ PcdValue = '1'
+ if PcdValue == 'False':
+ PcdValue = '0'
+
+ if RealValue:
+ return PcdValue
+
+if __name__ == '__main__':
+ pass
+ while True:
+ input = raw_input('Input expr: ')
+ if input in 'qQ':
+ break
+ try:
+ print(ValueExpression(input)(True))
+ print(ValueExpression(input)(False))
+ except WrnExpression as Ex:
+ print(Ex.result)
+ print(str(Ex))
+ except Exception as Ex:
+ print(str(Ex))
diff --git a/roms/edk2/BaseTools/Source/Python/Common/GlobalData.py b/roms/edk2/BaseTools/Source/Python/Common/GlobalData.py
new file mode 100755
index 000000000..61ab3f7e2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/GlobalData.py
@@ -0,0 +1,124 @@
+## @file
+# This file is used to define common static strings used by INF/DEC/DSC files
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+import re
+
+gIsWindows = None
+gWorkspace = "."
+gOptions = None
+gCaseInsensitive = False
+gAllFiles = None
+gCommand = None
+gSKUID_CMD = None
+
+gGlobalDefines = {}
+gPlatformDefines = {}
+# PCD name and value pair for fixed at build and feature flag
+gPlatformPcds = {}
+# PCDs with type that are not fixed at build and feature flag
+gPlatformOtherPcds = {}
+gActivePlatform = None
+gCommandLineDefines = {}
+gEdkGlobal = {}
+gCommandMaxLength = 4096
+# for debug trace purpose when problem occurs
+gProcessingFile = ''
+gBuildingModule = ''
+gSkuids = []
+gDefaultStores = []
+gGuidDict = {}
+
+# definition for a MACRO name. used to create regular expressions below.
+_MacroNamePattern = "[A-Z][A-Z0-9_]*"
+
+## Regular expression for matching macro used in DSC/DEC/INF file inclusion
+gMacroRefPattern = re.compile("\$\(({})\)".format(_MacroNamePattern), re.UNICODE)
+gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
+gMacroNamePattern = re.compile("^{}$".format(_MacroNamePattern))
+
+# definition for a GUID. used to create regular expressions below.
+_HexChar = r"[0-9a-fA-F]"
+_GuidPattern = r"{Hex}{{8}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{12}}".format(Hex=_HexChar)
+
+## Regular expressions for GUID matching
+gGuidPattern = re.compile(r'{}'.format(_GuidPattern))
+gGuidPatternEnd = re.compile(r'{}$'.format(_GuidPattern))
+
+## Regular expressions for HEX matching
+g4HexChar = re.compile(r'{}{{4}}'.format(_HexChar))
+gHexPattern = re.compile(r'0[xX]{}+'.format(_HexChar))
+gHexPatternAll = re.compile(r'0[xX]{}+$'.format(_HexChar))
+
+## Regular expressions for string identifier checking
+gIdentifierPattern = re.compile('^[a-zA-Z][a-zA-Z0-9_]*$', re.UNICODE)
+## Regular expression for GUID c structure format
+_GuidCFormatPattern = r"{{\s*0[xX]{Hex}{{1,8}}\s*,\s*0[xX]{Hex}{{1,4}}\s*,\s*0[xX]{Hex}{{1,4}}" \
+ r"\s*,\s*{{\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
+ r"\s*,\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
+ r"\s*,\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
+ r"\s*,\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}\s*}}\s*}}".format(Hex=_HexChar)
+gGuidCFormatPattern = re.compile(r"{}".format(_GuidCFormatPattern))
+
+#
+# A global variable for whether current build in AutoGen phase or not.
+#
+gAutoGenPhase = False
+
+#
+# The Conf dir outside the workspace dir
+#
+gConfDirectory = ''
+gCmdConfDir = ''
+gBuildDirectory = ''
+#
+# The relative default database file path
+#
+gDatabasePath = ".cache/build.db"
+
+#
+# Build flag for binary build
+#
+gIgnoreSource = False
+
+#
+# FDF parser
+#
+gFdfParser = None
+
+BuildOptionPcd = []
+
+#
+# Mixed PCD name dict
+#
+MixedPcd = {}
+
+# Structure Pcd dict
+gStructurePcd = {}
+gPcdSkuOverrides={}
+# Pcd name for the Pcd which used in the Conditional directives
+gConditionalPcds = []
+
+gUseHashCache = None
+gBinCacheDest = None
+gBinCacheSource = None
+gPlatformHash = None
+gPlatformHashFile = None
+gPackageHash = None
+gPackageHashFile = None
+gModuleHashFile = None
+gCMakeHashFile = None
+gHashChainStatus = None
+gModulePreMakeCacheStatus = None
+gModuleMakeCacheStatus = None
+gFileHashDict = None
+gModuleAllCacheStatus = None
+gModuleCacheHit = None
+
+gEnableGenfdsMultiThread = True
+gSikpAutoGenCache = set()
+# Common lock for the file access in multiple process AutoGens
+file_lock = None
+
diff --git a/roms/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py b/roms/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py
new file mode 100644
index 000000000..190f36d7e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py
@@ -0,0 +1,79 @@
+## @file
+# Override built in module os to provide support for long file path
+#
+# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import absolute_import
+import os
+from . import LongFilePathOsPath
+from Common.LongFilePathSupport import LongFilePath
+import time
+
+path = LongFilePathOsPath
+
+def access(path, mode):
+ return os.access(LongFilePath(path), mode)
+
+def remove(path):
+ Timeout = 0.0
+ while Timeout < 5.0:
+ try:
+ return os.remove(LongFilePath(path))
+ except:
+ time.sleep(0.1)
+ Timeout = Timeout + 0.1
+ return os.remove(LongFilePath(path))
+
+def removedirs(name):
+ return os.removedirs(LongFilePath(name))
+
+def rmdir(path):
+ return os.rmdir(LongFilePath(path))
+
+def mkdir(path):
+ return os.mkdir(LongFilePath(path))
+
+def makedirs(name, mode=0o777):
+ return os.makedirs(LongFilePath(name), mode)
+
+def rename(old, new):
+ return os.rename(LongFilePath(old), LongFilePath(new))
+
+def chdir(path):
+ return os.chdir(LongFilePath(path))
+
+def chmod(path, mode):
+ return os.chmod(LongFilePath(path), mode)
+
+def stat(path):
+ return os.stat(LongFilePath(path))
+
+def utime(path, times):
+ return os.utime(LongFilePath(path), times)
+
+def listdir(path):
+ List = []
+ uList = os.listdir(u"%s" % LongFilePath(path))
+ for Item in uList:
+ List.append(Item)
+ return List
+
+if hasattr(os, 'replace'):
+ def replace(src, dst):
+ return os.replace(LongFilePath(src), LongFilePath(dst))
+
+environ = os.environ
+getcwd = os.getcwd
+chdir = os.chdir
+walk = os.walk
+W_OK = os.W_OK
+F_OK = os.F_OK
+sep = os.sep
+linesep = os.linesep
+getenv = os.getenv
+pathsep = os.pathsep
+name = os.name
+SEEK_SET = os.SEEK_SET
+SEEK_END = os.SEEK_END
diff --git a/roms/edk2/BaseTools/Source/Python/Common/LongFilePathOsPath.py b/roms/edk2/BaseTools/Source/Python/Common/LongFilePathOsPath.py
new file mode 100644
index 000000000..60a053652
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/LongFilePathOsPath.py
@@ -0,0 +1,47 @@
+## @file
+# Override built in module os.path to provide support for long file path
+#
+# Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+import os
+from Common.LongFilePathSupport import LongFilePath
+
+def isfile(path):
+ return os.path.isfile(LongFilePath(path))
+
+def isdir(path):
+ return os.path.isdir(LongFilePath(path))
+
+def exists(path):
+ return os.path.exists(LongFilePath(path))
+
+def getsize(filename):
+ return os.path.getsize(LongFilePath(filename))
+
+def getmtime(filename):
+ return os.path.getmtime(LongFilePath(filename))
+
+def getatime(filename):
+ return os.path.getatime(LongFilePath(filename))
+
+def getctime(filename):
+ return os.path.getctime(LongFilePath(filename))
+
+join = os.path.join
+splitext = os.path.splitext
+splitdrive = os.path.splitdrive
+split = os.path.split
+abspath = os.path.abspath
+basename = os.path.basename
+commonprefix = os.path.commonprefix
+sep = os.path.sep
+normpath = os.path.normpath
+normcase = os.path.normcase
+dirname = os.path.dirname
+islink = os.path.islink
+isabs = os.path.isabs
+realpath = os.path.realpath
+relpath = os.path.relpath
+pardir = os.path.pardir
diff --git a/roms/edk2/BaseTools/Source/Python/Common/LongFilePathSupport.py b/roms/edk2/BaseTools/Source/Python/Common/LongFilePathSupport.py
new file mode 100644
index 000000000..38c439654
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/LongFilePathSupport.py
@@ -0,0 +1,45 @@
+## @file
+# Override built in function file.open to provide support for long file path
+#
+# Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+import os
+import platform
+import shutil
+import codecs
+
+##
+# OpenLongPath
+# Convert a file path to a long file path
+#
+def LongFilePath(FileName):
+ FileName = os.path.normpath(FileName)
+ if platform.system() == 'Windows':
+ if FileName.startswith('\\\\?\\'):
+ return FileName
+ if FileName.startswith('\\\\'):
+ return '\\\\?\\UNC\\' + FileName[2:]
+ if os.path.isabs(FileName):
+ return '\\\\?\\' + FileName
+ return FileName
+
+##
+# OpenLongFilePath
+# wrap open to support opening a long file path
+#
+def OpenLongFilePath(FileName, Mode='r', Buffer= -1):
+ return open(LongFilePath(FileName), Mode, Buffer)
+
+def CodecOpenLongFilePath(Filename, Mode='rb', Encoding=None, Errors='strict', Buffering=1):
+ return codecs.open(LongFilePath(Filename), Mode, Encoding, Errors, Buffering)
+
+##
+# CopyLongFilePath
+# wrap copyfile to support copy a long file path
+#
+def CopyLongFilePath(src, dst):
+ with open(LongFilePath(src), 'rb') as fsrc:
+ with open(LongFilePath(dst), 'wb') as fdst:
+ shutil.copyfileobj(fsrc, fdst)
diff --git a/roms/edk2/BaseTools/Source/Python/Common/Misc.py b/roms/edk2/BaseTools/Source/Python/Common/Misc.py
new file mode 100755
index 000000000..4be795713
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/Misc.py
@@ -0,0 +1,1929 @@
+## @file
+# Common routines used by all tools
+#
+# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+
+import sys
+import string
+import threading
+import time
+import re
+import pickle
+import array
+import shutil
+import filecmp
+from random import sample
+from struct import pack
+import uuid
+import subprocess
+import tempfile
+from collections import OrderedDict
+
+import Common.LongFilePathOs as os
+from Common import EdkLogger as EdkLogger
+from Common import GlobalData as GlobalData
+from Common.DataType import *
+from Common.BuildToolError import *
+from CommonDataClass.DataClass import *
+from Common.Parsing import GetSplitValueList
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.LongFilePathSupport import CopyLongFilePath as CopyLong
+from Common.LongFilePathSupport import LongFilePath as LongFilePath
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+from CommonDataClass.Exceptions import BadExpression
+from Common.caching import cached_property
+import struct
+
+ArrayIndex = re.compile("\[\s*[0-9a-fA-FxX]*\s*\]")
+## Regular expression used to find out place holders in string template
+gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE | re.UNICODE)
+
+## regular expressions for map file processing
+startPatternGeneral = re.compile("^Start[' ']+Length[' ']+Name[' ']+Class")
+addressPatternGeneral = re.compile("^Address[' ']+Publics by Value[' ']+Rva\+Base")
+valuePatternGcc = re.compile('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$')
+pcdPatternGcc = re.compile('^([\da-fA-Fx]+) +([\da-fA-Fx]+)')
+secReGeneral = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[Hh]? +([.\w\$]+) +(\w+)', re.UNICODE)
+
+StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*$')
+
+## Dictionary used to store dependencies of files
+gDependencyDatabase = {} # arch : {file path : [dependent files list]}
+
+#
+# If a module is built more than once with different PCDs or library classes
+# a temporary INF file with same content is created, the temporary file is removed
+# when build exits.
+#
+_TempInfs = []
+
+def GetVariableOffset(mapfilepath, efifilepath, varnames):
+ """ Parse map file to get variable offset in current EFI file
+ @param mapfilepath Map file absolution path
+ @param efifilepath: EFI binary file full path
+ @param varnames iteratable container whose elements are variable names to be searched
+
+ @return List whos elements are tuple with variable name and raw offset
+ """
+ lines = []
+ try:
+ f = open(mapfilepath, 'r')
+ lines = f.readlines()
+ f.close()
+ except:
+ return None
+
+ if len(lines) == 0: return None
+ firstline = lines[0].strip()
+ if re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', firstline):
+ return _parseForXcodeAndClang9(lines, efifilepath, varnames)
+ if (firstline.startswith("Archive member included ") and
+ firstline.endswith(" file (symbol)")):
+ return _parseForGCC(lines, efifilepath, varnames)
+ if firstline.startswith("# Path:"):
+ return _parseForXcodeAndClang9(lines, efifilepath, varnames)
+ return _parseGeneral(lines, efifilepath, varnames)
+
+def _parseForXcodeAndClang9(lines, efifilepath, varnames):
+ status = 0
+ ret = []
+ for line in lines:
+ line = line.strip()
+ if status == 0 and (re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', line) \
+ or line == "# Symbols:"):
+ status = 1
+ continue
+ if status == 1 and len(line) != 0:
+ for varname in varnames:
+ if varname in line:
+ # cannot pregenerate this RegEx since it uses varname from varnames.
+ m = re.match('^([\da-fA-FxX]+)([\s\S]*)([_]*%s)$' % varname, line)
+ if m is not None:
+ ret.append((varname, m.group(1)))
+ return ret
+
+def _parseForGCC(lines, efifilepath, varnames):
+ """ Parse map file generated by GCC linker """
+ status = 0
+ sections = []
+ varoffset = []
+ for index, line in enumerate(lines):
+ line = line.strip()
+ # status machine transection
+ if status == 0 and line == "Memory Configuration":
+ status = 1
+ continue
+ elif status == 1 and line == 'Linker script and memory map':
+ status = 2
+ continue
+ elif status ==2 and line == 'START GROUP':
+ status = 3
+ continue
+
+ # status handler
+ if status == 3:
+ m = valuePatternGcc.match(line)
+ if m is not None:
+ sections.append(m.groups(0))
+ for varname in varnames:
+ Str = ''
+ m = re.match("^.data.(%s)" % varname, line)
+ if m is not None:
+ m = re.match(".data.(%s)$" % varname, line)
+ if m is not None:
+ Str = lines[index + 1]
+ else:
+ Str = line[len(".data.%s" % varname):]
+ if Str:
+ m = pcdPatternGcc.match(Str.strip())
+ if m is not None:
+ varoffset.append((varname, int(m.groups(0)[0], 16), int(sections[-1][1], 16), sections[-1][0]))
+
+ if not varoffset:
+ return []
+ # get section information from efi file
+ efisecs = PeImageClass(efifilepath).SectionHeaderList
+ if efisecs is None or len(efisecs) == 0:
+ return []
+ #redirection
+ redirection = 0
+ for efisec in efisecs:
+ for section in sections:
+ if section[0].strip() == efisec[0].strip() and section[0].strip() == '.text':
+ redirection = int(section[1], 16) - efisec[1]
+
+ ret = []
+ for var in varoffset:
+ for efisec in efisecs:
+ if var[1] >= efisec[1] and var[1] < efisec[1]+efisec[3]:
+ ret.append((var[0], hex(efisec[2] + var[1] - efisec[1] - redirection)))
+ return ret
+
+def _parseGeneral(lines, efifilepath, varnames):
+ status = 0 #0 - beginning of file; 1 - PE section definition; 2 - symbol table
+ secs = [] # key = section name
+ varoffset = []
+ symRe = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\.:\\\\\w\?@\$-]+) +([\da-fA-F]+)', re.UNICODE)
+
+ for line in lines:
+ line = line.strip()
+ if startPatternGeneral.match(line):
+ status = 1
+ continue
+ if addressPatternGeneral.match(line):
+ status = 2
+ continue
+ if line.startswith("entry point at"):
+ status = 3
+ continue
+ if status == 1 and len(line) != 0:
+ m = secReGeneral.match(line)
+ assert m is not None, "Fail to parse the section in map file , line is %s" % line
+ sec_no, sec_start, sec_length, sec_name, sec_class = m.groups(0)
+ secs.append([int(sec_no, 16), int(sec_start, 16), int(sec_length, 16), sec_name, sec_class])
+ if status == 2 and len(line) != 0:
+ for varname in varnames:
+ m = symRe.match(line)
+ assert m is not None, "Fail to parse the symbol in map file, line is %s" % line
+ sec_no, sym_offset, sym_name, vir_addr = m.groups(0)
+ sec_no = int(sec_no, 16)
+ sym_offset = int(sym_offset, 16)
+ vir_addr = int(vir_addr, 16)
+ # cannot pregenerate this RegEx since it uses varname from varnames.
+ m2 = re.match('^[_]*(%s)' % varname, sym_name)
+ if m2 is not None:
+ # fond a binary pcd entry in map file
+ for sec in secs:
+ if sec[0] == sec_no and (sym_offset >= sec[1] and sym_offset < sec[1] + sec[2]):
+ varoffset.append([varname, sec[3], sym_offset, vir_addr, sec_no])
+
+ if not varoffset: return []
+
+ # get section information from efi file
+ efisecs = PeImageClass(efifilepath).SectionHeaderList
+ if efisecs is None or len(efisecs) == 0:
+ return []
+
+ ret = []
+ for var in varoffset:
+ index = 0
+ for efisec in efisecs:
+ index = index + 1
+ if var[1].strip() == efisec[0].strip():
+ ret.append((var[0], hex(efisec[2] + var[2])))
+ elif var[4] == index:
+ ret.append((var[0], hex(efisec[2] + var[2])))
+
+ return ret
+
+## Routine to process duplicated INF
+#
+# This function is called by following two cases:
+# Case 1 in DSC:
+# [components.arch]
+# Pkg/module/module.inf
+# Pkg/module/module.inf {
+# <Defines>
+# FILE_GUID = 0D1B936F-68F3-4589-AFCC-FB8B7AEBC836
+# }
+# Case 2 in FDF:
+# INF Pkg/module/module.inf
+# INF FILE_GUID = 0D1B936F-68F3-4589-AFCC-FB8B7AEBC836 Pkg/module/module.inf
+#
+# This function copies Pkg/module/module.inf to
+# Conf/.cache/0D1B936F-68F3-4589-AFCC-FB8B7AEBC836module.inf
+#
+# @param Path Original PathClass object
+# @param BaseName New file base name
+#
+# @retval return the new PathClass object
+#
+def ProcessDuplicatedInf(Path, BaseName, Workspace):
+ Filename = os.path.split(Path.File)[1]
+ if '.' in Filename:
+ Filename = BaseName + Path.BaseName + Filename[Filename.rfind('.'):]
+ else:
+ Filename = BaseName + Path.BaseName
+
+ DbDir = os.path.split(GlobalData.gDatabasePath)[0]
+
+ #
+ # A temporary INF is copied to database path which must have write permission
+ # The temporary will be removed at the end of build
+ # In case of name conflict, the file name is
+ # FILE_GUIDBaseName (0D1B936F-68F3-4589-AFCC-FB8B7AEBC836module.inf)
+ #
+ TempFullPath = os.path.join(DbDir,
+ Filename)
+ RtPath = PathClass(Path.File, Workspace)
+ #
+ # Modify the full path to temporary path, keep other unchanged
+ #
+ # To build same module more than once, the module path with FILE_GUID overridden has
+ # the file name FILE_GUIDmodule.inf, but the relative path (self.MetaFile.File) is the real path
+ # in DSC which is used as relative path by C files and other files in INF.
+ # A trick was used: all module paths are PathClass instances, after the initialization
+ # of PathClass, the PathClass.Path is overridden by the temporary INF path.
+ #
+ # The reason for creating a temporary INF is:
+ # Platform.Modules which is the base to create ModuleAutoGen objects is a dictionary,
+ # the key is the full path of INF, the value is an object to save overridden library instances, PCDs.
+ # A different key for the same module is needed to create different output directory,
+ # retrieve overridden PCDs, library instances.
+ #
+ # The BaseName is the FILE_GUID which is also the output directory name.
+ #
+ #
+ RtPath.Path = TempFullPath
+ RtPath.BaseName = BaseName
+ RtPath.OriginalPath = Path
+ #
+ # If file exists, compare contents
+ #
+ if os.path.exists(TempFullPath):
+ with open(str(Path), 'rb') as f1, open(TempFullPath, 'rb') as f2:
+ if f1.read() == f2.read():
+ return RtPath
+ _TempInfs.append(TempFullPath)
+ shutil.copy2(str(Path), TempFullPath)
+ return RtPath
+
+## Remove temporary created INFs whose paths were saved in _TempInfs
+#
+def ClearDuplicatedInf():
+ while _TempInfs:
+ File = _TempInfs.pop()
+ if os.path.exists(File):
+ os.remove(File)
+
+## Convert GUID string in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx style to C structure style
+#
+# @param Guid The GUID string
+#
+# @retval string The GUID string in C structure style
+#
+def GuidStringToGuidStructureString(Guid):
+ GuidList = Guid.split('-')
+ Result = '{'
+ for Index in range(0, 3, 1):
+ Result = Result + '0x' + GuidList[Index] + ', '
+ Result = Result + '{0x' + GuidList[3][0:2] + ', 0x' + GuidList[3][2:4]
+ for Index in range(0, 12, 2):
+ Result = Result + ', 0x' + GuidList[4][Index:Index + 2]
+ Result += '}}'
+ return Result
+
+## Convert GUID structure in byte array to xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+#
+# @param GuidValue The GUID value in byte array
+#
+# @retval string The GUID value in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format
+#
+def GuidStructureByteArrayToGuidString(GuidValue):
+ guidValueString = GuidValue.lower().replace("{", "").replace("}", "").replace(" ", "").replace(";", "")
+ guidValueList = guidValueString.split(",")
+ if len(guidValueList) != 16:
+ return ''
+ #EdkLogger.error(None, None, "Invalid GUID value string %s" % GuidValue)
+ try:
+ return "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" % (
+ int(guidValueList[3], 16),
+ int(guidValueList[2], 16),
+ int(guidValueList[1], 16),
+ int(guidValueList[0], 16),
+ int(guidValueList[5], 16),
+ int(guidValueList[4], 16),
+ int(guidValueList[7], 16),
+ int(guidValueList[6], 16),
+ int(guidValueList[8], 16),
+ int(guidValueList[9], 16),
+ int(guidValueList[10], 16),
+ int(guidValueList[11], 16),
+ int(guidValueList[12], 16),
+ int(guidValueList[13], 16),
+ int(guidValueList[14], 16),
+ int(guidValueList[15], 16)
+ )
+ except:
+ return ''
+
+## Convert GUID string in C structure style to xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+#
+# @param GuidValue The GUID value in C structure format
+#
+# @retval string The GUID value in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format
+#
+def GuidStructureStringToGuidString(GuidValue):
+ if not GlobalData.gGuidCFormatPattern.match(GuidValue):
+ return ''
+ guidValueString = GuidValue.lower().replace("{", "").replace("}", "").replace(" ", "").replace(";", "")
+ guidValueList = guidValueString.split(",")
+ if len(guidValueList) != 11:
+ return ''
+ #EdkLogger.error(None, None, "Invalid GUID value string %s" % GuidValue)
+ try:
+ return "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % (
+ int(guidValueList[0], 16),
+ int(guidValueList[1], 16),
+ int(guidValueList[2], 16),
+ int(guidValueList[3], 16),
+ int(guidValueList[4], 16),
+ int(guidValueList[5], 16),
+ int(guidValueList[6], 16),
+ int(guidValueList[7], 16),
+ int(guidValueList[8], 16),
+ int(guidValueList[9], 16),
+ int(guidValueList[10], 16)
+ )
+ except:
+ return ''
+
+## Convert GUID string in C structure style to xxxxxxxx_xxxx_xxxx_xxxx_xxxxxxxxxxxx
+#
+# @param GuidValue The GUID value in C structure format
+#
+# @retval string The GUID value in xxxxxxxx_xxxx_xxxx_xxxx_xxxxxxxxxxxx format
+#
+def GuidStructureStringToGuidValueName(GuidValue):
+ guidValueString = GuidValue.lower().replace("{", "").replace("}", "").replace(" ", "")
+ guidValueList = guidValueString.split(",")
+ if len(guidValueList) != 11:
+ EdkLogger.error(None, FORMAT_INVALID, "Invalid GUID value string [%s]" % GuidValue)
+ return "%08x_%04x_%04x_%02x%02x_%02x%02x%02x%02x%02x%02x" % (
+ int(guidValueList[0], 16),
+ int(guidValueList[1], 16),
+ int(guidValueList[2], 16),
+ int(guidValueList[3], 16),
+ int(guidValueList[4], 16),
+ int(guidValueList[5], 16),
+ int(guidValueList[6], 16),
+ int(guidValueList[7], 16),
+ int(guidValueList[8], 16),
+ int(guidValueList[9], 16),
+ int(guidValueList[10], 16)
+ )
+
+## Create directories
+#
+# @param Directory The directory name
+#
+def CreateDirectory(Directory):
+ if Directory is None or Directory.strip() == "":
+ return True
+ try:
+ if not os.access(Directory, os.F_OK):
+ os.makedirs(Directory)
+ except:
+ return False
+ return True
+
+## Remove directories, including files and sub-directories in it
+#
+# @param Directory The directory name
+#
+def RemoveDirectory(Directory, Recursively=False):
+ if Directory is None or Directory.strip() == "" or not os.path.exists(Directory):
+ return
+ if Recursively:
+ CurrentDirectory = os.getcwd()
+ os.chdir(Directory)
+ for File in os.listdir("."):
+ if os.path.isdir(File):
+ RemoveDirectory(File, Recursively)
+ else:
+ os.remove(File)
+ os.chdir(CurrentDirectory)
+ os.rmdir(Directory)
+
+## Store content in file
+#
+# This method is used to save file only when its content is changed. This is
+# quite useful for "make" system to decide what will be re-built and what won't.
+#
+# @param File The path of file
+# @param Content The new content of the file
+# @param IsBinaryFile The flag indicating if the file is binary file or not
+#
+# @retval True If the file content is changed and the file is renewed
+# @retval False If the file content is the same
+#
+def SaveFileOnChange(File, Content, IsBinaryFile=True, FileLock=None):
+
+ # Convert to long file path format
+ File = LongFilePath(File)
+
+ if os.path.exists(File):
+ if IsBinaryFile:
+ try:
+ with open(File, "rb") as f:
+ if Content == f.read():
+ return False
+ except:
+ EdkLogger.error(None, FILE_OPEN_FAILURE, ExtraData=File)
+ else:
+ try:
+ with open(File, "r") as f:
+ if Content == f.read():
+ return False
+ except:
+ EdkLogger.error(None, FILE_OPEN_FAILURE, ExtraData=File)
+
+ DirName = os.path.dirname(File)
+ if not CreateDirectory(DirName):
+ EdkLogger.error(None, FILE_CREATE_FAILURE, "Could not create directory %s" % DirName)
+ else:
+ if DirName == '':
+ DirName = os.getcwd()
+ if not os.access(DirName, os.W_OK):
+ EdkLogger.error(None, PERMISSION_FAILURE, "Do not have write permission on directory %s" % DirName)
+
+ OpenMode = "w"
+ if IsBinaryFile:
+ OpenMode = "wb"
+
+ # use default file_lock if no input new lock
+ if not FileLock:
+ FileLock = GlobalData.file_lock
+ if FileLock:
+ FileLock.acquire()
+
+
+ if GlobalData.gIsWindows and not os.path.exists(File):
+ try:
+ with open(File, OpenMode) as tf:
+ tf.write(Content)
+ except IOError as X:
+ if GlobalData.gBinCacheSource:
+ EdkLogger.quiet("[cache error]:fails to save file with error: %s" % (X))
+ else:
+ EdkLogger.error(None, FILE_CREATE_FAILURE, ExtraData='IOError %s' % X)
+ finally:
+ if FileLock:
+ FileLock.release()
+ else:
+ try:
+ with open(File, OpenMode) as Fd:
+ Fd.write(Content)
+ except IOError as X:
+ if GlobalData.gBinCacheSource:
+ EdkLogger.quiet("[cache error]:fails to save file with error: %s" % (X))
+ else:
+ EdkLogger.error(None, FILE_CREATE_FAILURE, ExtraData='IOError %s' % X)
+ finally:
+ if FileLock:
+ FileLock.release()
+
+ return True
+
+## Copy source file only if it is different from the destination file
+#
+# This method is used to copy file only if the source file and destination
+# file content are different. This is quite useful to avoid duplicated
+# file writing.
+#
+# @param SrcFile The path of source file
+# @param Dst The path of destination file or folder
+#
+# @retval True The two files content are different and the file is copied
+# @retval False No copy really happen
+#
+def CopyFileOnChange(SrcFile, Dst, FileLock=None):
+
+ # Convert to long file path format
+ SrcFile = LongFilePath(SrcFile)
+ Dst = LongFilePath(Dst)
+
+ if os.path.isdir(SrcFile):
+ EdkLogger.error(None, FILE_COPY_FAILURE, ExtraData='CopyFileOnChange SrcFile is a dir, not a file: %s' % SrcFile)
+ return False
+
+ if os.path.isdir(Dst):
+ DstFile = os.path.join(Dst, os.path.basename(SrcFile))
+ else:
+ DstFile = Dst
+
+ if os.path.exists(DstFile) and filecmp.cmp(SrcFile, DstFile, shallow=False):
+ return False
+
+ DirName = os.path.dirname(DstFile)
+ if not CreateDirectory(DirName):
+ EdkLogger.error(None, FILE_CREATE_FAILURE, "Could not create directory %s" % DirName)
+ else:
+ if DirName == '':
+ DirName = os.getcwd()
+ if not os.access(DirName, os.W_OK):
+ EdkLogger.error(None, PERMISSION_FAILURE, "Do not have write permission on directory %s" % DirName)
+
+ # use default file_lock if no input new lock
+ if not FileLock:
+ FileLock = GlobalData.file_lock
+ if FileLock:
+ FileLock.acquire()
+
+ try:
+ CopyLong(SrcFile, DstFile)
+ except IOError as X:
+ if GlobalData.gBinCacheSource:
+ EdkLogger.quiet("[cache error]:fails to copy file with error: %s" % (X))
+ else:
+ EdkLogger.error(None, FILE_COPY_FAILURE, ExtraData='IOError %s' % X)
+ finally:
+ if FileLock:
+ FileLock.release()
+
+ return True
+
+## Retrieve and cache the real path name in file system
+#
+# @param Root The root directory of path relative to
+#
+# @retval str The path string if the path exists
+# @retval None If path doesn't exist
+#
+class DirCache:
+ _CACHE_ = set()
+ _UPPER_CACHE_ = {}
+
+ def __init__(self, Root):
+ self._Root = Root
+ for F in os.listdir(Root):
+ self._CACHE_.add(F)
+ self._UPPER_CACHE_[F.upper()] = F
+
+ # =[] operator
+ def __getitem__(self, Path):
+ Path = Path[len(os.path.commonprefix([Path, self._Root])):]
+ if not Path:
+ return self._Root
+ if Path and Path[0] == os.path.sep:
+ Path = Path[1:]
+ if Path in self._CACHE_:
+ return os.path.join(self._Root, Path)
+ UpperPath = Path.upper()
+ if UpperPath in self._UPPER_CACHE_:
+ return os.path.join(self._Root, self._UPPER_CACHE_[UpperPath])
+
+ IndexList = []
+ LastSepIndex = -1
+ SepIndex = Path.find(os.path.sep)
+ while SepIndex > -1:
+ Parent = UpperPath[:SepIndex]
+ if Parent not in self._UPPER_CACHE_:
+ break
+ LastSepIndex = SepIndex
+ SepIndex = Path.find(os.path.sep, LastSepIndex + 1)
+
+ if LastSepIndex == -1:
+ return None
+
+ Cwd = os.getcwd()
+ os.chdir(self._Root)
+ SepIndex = LastSepIndex
+ while SepIndex > -1:
+ Parent = Path[:SepIndex]
+ ParentKey = UpperPath[:SepIndex]
+ if ParentKey not in self._UPPER_CACHE_:
+ os.chdir(Cwd)
+ return None
+
+ if Parent in self._CACHE_:
+ ParentDir = Parent
+ else:
+ ParentDir = self._UPPER_CACHE_[ParentKey]
+ for F in os.listdir(ParentDir):
+ Dir = os.path.join(ParentDir, F)
+ self._CACHE_.add(Dir)
+ self._UPPER_CACHE_[Dir.upper()] = Dir
+
+ SepIndex = Path.find(os.path.sep, SepIndex + 1)
+
+ os.chdir(Cwd)
+ if Path in self._CACHE_:
+ return os.path.join(self._Root, Path)
+ elif UpperPath in self._UPPER_CACHE_:
+ return os.path.join(self._Root, self._UPPER_CACHE_[UpperPath])
+ return None
+
+def RealPath(File, Dir='', OverrideDir=''):
+ NewFile = os.path.normpath(os.path.join(Dir, File))
+ NewFile = GlobalData.gAllFiles[NewFile]
+ if not NewFile and OverrideDir:
+ NewFile = os.path.normpath(os.path.join(OverrideDir, File))
+ NewFile = GlobalData.gAllFiles[NewFile]
+ return NewFile
+
+## Get GUID value from given packages
+#
+# @param CName The CName of the GUID
+# @param PackageList List of packages looking-up in
+# @param Inffile The driver file
+#
+# @retval GuidValue if the CName is found in any given package
+# @retval None if the CName is not found in all given packages
+#
+def GuidValue(CName, PackageList, Inffile = None):
+ for P in PackageList:
+ GuidKeys = list(P.Guids.keys())
+ if Inffile and P._PrivateGuids:
+ if not Inffile.startswith(P.MetaFile.Dir):
+ GuidKeys = [x for x in P.Guids if x not in P._PrivateGuids]
+ if CName in GuidKeys:
+ return P.Guids[CName]
+ return None
+
+## A string template class
+#
+# This class implements a template for string replacement. A string template
+# looks like following
+#
+# ${BEGIN} other_string ${placeholder_name} other_string ${END}
+#
+# The string between ${BEGIN} and ${END} will be repeated as many times as the
+# length of "placeholder_name", which is a list passed through a dict. The
+# "placeholder_name" is the key name of the dict. The ${BEGIN} and ${END} can
+# be not used and, in this case, the "placeholder_name" must not a list and it
+# will just be replaced once.
+#
+class TemplateString(object):
+ _REPEAT_START_FLAG = "BEGIN"
+ _REPEAT_END_FLAG = "END"
+
+ class Section(object):
+ _LIST_TYPES = [type([]), type(set()), type((0,))]
+
+ def __init__(self, TemplateSection, PlaceHolderList):
+ self._Template = TemplateSection
+ self._PlaceHolderList = []
+
+ # Split the section into sub-sections according to the position of placeholders
+ if PlaceHolderList:
+ self._SubSectionList = []
+ SubSectionStart = 0
+ #
+ # The placeholders passed in must be in the format of
+ #
+ # PlaceHolderName, PlaceHolderStartPoint, PlaceHolderEndPoint
+ #
+ for PlaceHolder, Start, End in PlaceHolderList:
+ self._SubSectionList.append(TemplateSection[SubSectionStart:Start])
+ self._SubSectionList.append(TemplateSection[Start:End])
+ self._PlaceHolderList.append(PlaceHolder)
+ SubSectionStart = End
+ if SubSectionStart < len(TemplateSection):
+ self._SubSectionList.append(TemplateSection[SubSectionStart:])
+ else:
+ self._SubSectionList = [TemplateSection]
+
+ def __str__(self):
+ return self._Template + " : " + str(self._PlaceHolderList)
+
+ def Instantiate(self, PlaceHolderValues):
+ RepeatTime = -1
+ RepeatPlaceHolders = {}
+ NonRepeatPlaceHolders = {}
+
+ for PlaceHolder in self._PlaceHolderList:
+ if PlaceHolder not in PlaceHolderValues:
+ continue
+ Value = PlaceHolderValues[PlaceHolder]
+ if type(Value) in self._LIST_TYPES:
+ if RepeatTime < 0:
+ RepeatTime = len(Value)
+ elif RepeatTime != len(Value):
+ EdkLogger.error(
+ "TemplateString",
+ PARAMETER_INVALID,
+ "${%s} has different repeat time from others!" % PlaceHolder,
+ ExtraData=str(self._Template)
+ )
+ RepeatPlaceHolders["${%s}" % PlaceHolder] = Value
+ else:
+ NonRepeatPlaceHolders["${%s}" % PlaceHolder] = Value
+
+ if NonRepeatPlaceHolders:
+ StringList = []
+ for S in self._SubSectionList:
+ if S not in NonRepeatPlaceHolders:
+ StringList.append(S)
+ else:
+ StringList.append(str(NonRepeatPlaceHolders[S]))
+ else:
+ StringList = self._SubSectionList
+
+ if RepeatPlaceHolders:
+ TempStringList = []
+ for Index in range(RepeatTime):
+ for S in StringList:
+ if S not in RepeatPlaceHolders:
+ TempStringList.append(S)
+ else:
+ TempStringList.append(str(RepeatPlaceHolders[S][Index]))
+ StringList = TempStringList
+
+ return "".join(StringList)
+
+ ## Constructor
+ def __init__(self, Template=None):
+ self.String = []
+ self.IsBinary = False
+ self._Template = Template
+ self._TemplateSectionList = self._Parse(Template)
+
+ ## str() operator
+ #
+ # @retval string The string replaced
+ #
+ def __str__(self):
+ return "".join(self.String)
+
+ ## Split the template string into fragments per the ${BEGIN} and ${END} flags
+ #
+ # @retval list A list of TemplateString.Section objects
+ #
+ def _Parse(self, Template):
+ SectionStart = 0
+ SearchFrom = 0
+ MatchEnd = 0
+ PlaceHolderList = []
+ TemplateSectionList = []
+ while Template:
+ MatchObj = gPlaceholderPattern.search(Template, SearchFrom)
+ if not MatchObj:
+ if MatchEnd <= len(Template):
+ TemplateSection = TemplateString.Section(Template[SectionStart:], PlaceHolderList)
+ TemplateSectionList.append(TemplateSection)
+ break
+
+ MatchString = MatchObj.group(1)
+ MatchStart = MatchObj.start()
+ MatchEnd = MatchObj.end()
+
+ if MatchString == self._REPEAT_START_FLAG:
+ if MatchStart > SectionStart:
+ TemplateSection = TemplateString.Section(Template[SectionStart:MatchStart], PlaceHolderList)
+ TemplateSectionList.append(TemplateSection)
+ SectionStart = MatchEnd
+ PlaceHolderList = []
+ elif MatchString == self._REPEAT_END_FLAG:
+ TemplateSection = TemplateString.Section(Template[SectionStart:MatchStart], PlaceHolderList)
+ TemplateSectionList.append(TemplateSection)
+ SectionStart = MatchEnd
+ PlaceHolderList = []
+ else:
+ PlaceHolderList.append((MatchString, MatchStart - SectionStart, MatchEnd - SectionStart))
+ SearchFrom = MatchEnd
+ return TemplateSectionList
+
+ ## Replace the string template with dictionary of placeholders and append it to previous one
+ #
+ # @param AppendString The string template to append
+ # @param Dictionary The placeholder dictionaries
+ #
+ def Append(self, AppendString, Dictionary=None):
+ if Dictionary:
+ SectionList = self._Parse(AppendString)
+ self.String.append( "".join(S.Instantiate(Dictionary) for S in SectionList))
+ else:
+ if isinstance(AppendString,list):
+ self.String.extend(AppendString)
+ else:
+ self.String.append(AppendString)
+
+ ## Replace the string template with dictionary of placeholders
+ #
+ # @param Dictionary The placeholder dictionaries
+ #
+ # @retval str The string replaced with placeholder values
+ #
+ def Replace(self, Dictionary=None):
+ return "".join(S.Instantiate(Dictionary) for S in self._TemplateSectionList)
+
+## Progress indicator class
+#
+# This class makes use of thread to print progress on console.
+#
+class Progressor:
+ # for avoiding deadloop
+ _StopFlag = None
+ _ProgressThread = None
+ _CheckInterval = 0.25
+
+ ## Constructor
+ #
+ # @param OpenMessage The string printed before progress characters
+ # @param CloseMessage The string printed after progress characters
+ # @param ProgressChar The character used to indicate the progress
+ # @param Interval The interval in seconds between two progress characters
+ #
+ def __init__(self, OpenMessage="", CloseMessage="", ProgressChar='.', Interval=1.0):
+ self.PromptMessage = OpenMessage
+ self.CodaMessage = CloseMessage
+ self.ProgressChar = ProgressChar
+ self.Interval = Interval
+ if Progressor._StopFlag is None:
+ Progressor._StopFlag = threading.Event()
+
+ ## Start to print progress character
+ #
+ # @param OpenMessage The string printed before progress characters
+ #
+ def Start(self, OpenMessage=None):
+ if OpenMessage is not None:
+ self.PromptMessage = OpenMessage
+ Progressor._StopFlag.clear()
+ if Progressor._ProgressThread is None:
+ Progressor._ProgressThread = threading.Thread(target=self._ProgressThreadEntry)
+ Progressor._ProgressThread.setDaemon(False)
+ Progressor._ProgressThread.start()
+
+ ## Stop printing progress character
+ #
+ # @param CloseMessage The string printed after progress characters
+ #
+ def Stop(self, CloseMessage=None):
+ OriginalCodaMessage = self.CodaMessage
+ if CloseMessage is not None:
+ self.CodaMessage = CloseMessage
+ self.Abort()
+ self.CodaMessage = OriginalCodaMessage
+
+ ## Thread entry method
+ def _ProgressThreadEntry(self):
+ sys.stdout.write(self.PromptMessage + " ")
+ sys.stdout.flush()
+ TimeUp = 0.0
+ while not Progressor._StopFlag.isSet():
+ if TimeUp <= 0.0:
+ sys.stdout.write(self.ProgressChar)
+ sys.stdout.flush()
+ TimeUp = self.Interval
+ time.sleep(self._CheckInterval)
+ TimeUp -= self._CheckInterval
+ sys.stdout.write(" " + self.CodaMessage + "\n")
+ sys.stdout.flush()
+
+ ## Abort the progress display
+ @staticmethod
+ def Abort():
+ if Progressor._StopFlag is not None:
+ Progressor._StopFlag.set()
+ if Progressor._ProgressThread is not None:
+ Progressor._ProgressThread.join()
+ Progressor._ProgressThread = None
+
+
+## Dictionary using prioritized list as key
+#
+class tdict:
+ _ListType = type([])
+ _TupleType = type(())
+ _Wildcard = 'COMMON'
+ _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', TAB_STAR, 'PLATFORM']
+
+ def __init__(self, _Single_=False, _Level_=2):
+ self._Level_ = _Level_
+ self.data = {}
+ self._Single_ = _Single_
+
+ # =[] operator
+ def __getitem__(self, key):
+ KeyType = type(key)
+ RestKeys = None
+ if KeyType == self._ListType or KeyType == self._TupleType:
+ FirstKey = key[0]
+ if len(key) > 1:
+ RestKeys = key[1:]
+ elif self._Level_ > 1:
+ RestKeys = [self._Wildcard for i in range(0, self._Level_ - 1)]
+ else:
+ FirstKey = key
+ if self._Level_ > 1:
+ RestKeys = [self._Wildcard for i in range(0, self._Level_ - 1)]
+
+ if FirstKey is None or str(FirstKey).upper() in self._ValidWildcardList:
+ FirstKey = self._Wildcard
+
+ if self._Single_:
+ return self._GetSingleValue(FirstKey, RestKeys)
+ else:
+ return self._GetAllValues(FirstKey, RestKeys)
+
+ def _GetSingleValue(self, FirstKey, RestKeys):
+ Value = None
+ #print "%s-%s" % (FirstKey, self._Level_) ,
+ if self._Level_ > 1:
+ if FirstKey == self._Wildcard:
+ if FirstKey in self.data:
+ Value = self.data[FirstKey][RestKeys]
+ if Value is None:
+ for Key in self.data:
+ Value = self.data[Key][RestKeys]
+ if Value is not None: break
+ else:
+ if FirstKey in self.data:
+ Value = self.data[FirstKey][RestKeys]
+ if Value is None and self._Wildcard in self.data:
+ #print "Value=None"
+ Value = self.data[self._Wildcard][RestKeys]
+ else:
+ if FirstKey == self._Wildcard:
+ if FirstKey in self.data:
+ Value = self.data[FirstKey]
+ if Value is None:
+ for Key in self.data:
+ Value = self.data[Key]
+ if Value is not None: break
+ else:
+ if FirstKey in self.data:
+ Value = self.data[FirstKey]
+ elif self._Wildcard in self.data:
+ Value = self.data[self._Wildcard]
+ return Value
+
+ def _GetAllValues(self, FirstKey, RestKeys):
+ Value = []
+ if self._Level_ > 1:
+ if FirstKey == self._Wildcard:
+ for Key in self.data:
+ Value += self.data[Key][RestKeys]
+ else:
+ if FirstKey in self.data:
+ Value += self.data[FirstKey][RestKeys]
+ if self._Wildcard in self.data:
+ Value += self.data[self._Wildcard][RestKeys]
+ else:
+ if FirstKey == self._Wildcard:
+ for Key in self.data:
+ Value.append(self.data[Key])
+ else:
+ if FirstKey in self.data:
+ Value.append(self.data[FirstKey])
+ if self._Wildcard in self.data:
+ Value.append(self.data[self._Wildcard])
+ return Value
+
+ ## []= operator
+ def __setitem__(self, key, value):
+ KeyType = type(key)
+ RestKeys = None
+ if KeyType == self._ListType or KeyType == self._TupleType:
+ FirstKey = key[0]
+ if len(key) > 1:
+ RestKeys = key[1:]
+ else:
+ RestKeys = [self._Wildcard for i in range(0, self._Level_ - 1)]
+ else:
+ FirstKey = key
+ if self._Level_ > 1:
+ RestKeys = [self._Wildcard for i in range(0, self._Level_ - 1)]
+
+ if FirstKey in self._ValidWildcardList:
+ FirstKey = self._Wildcard
+
+ if FirstKey not in self.data and self._Level_ > 0:
+ self.data[FirstKey] = tdict(self._Single_, self._Level_ - 1)
+
+ if self._Level_ > 1:
+ self.data[FirstKey][RestKeys] = value
+ else:
+ self.data[FirstKey] = value
+
+ def SetGreedyMode(self):
+ self._Single_ = False
+ if self._Level_ > 1:
+ for Key in self.data:
+ self.data[Key].SetGreedyMode()
+
+ def SetSingleMode(self):
+ self._Single_ = True
+ if self._Level_ > 1:
+ for Key in self.data:
+ self.data[Key].SetSingleMode()
+
+ def GetKeys(self, KeyIndex=0):
+ assert KeyIndex >= 0
+ if KeyIndex == 0:
+ return set(self.data.keys())
+ else:
+ keys = set()
+ for Key in self.data:
+ keys |= self.data[Key].GetKeys(KeyIndex - 1)
+ return keys
+
+def AnalyzePcdExpression(Setting):
+ RanStr = ''.join(sample(string.ascii_letters + string.digits, 8))
+ Setting = Setting.replace('\\\\', RanStr).strip()
+ # There might be escaped quote in a string: \", \\\" , \', \\\'
+ Data = Setting
+ # There might be '|' in string and in ( ... | ... ), replace it with '-'
+ NewStr = ''
+ InSingleQuoteStr = False
+ InDoubleQuoteStr = False
+ Pair = 0
+ for Index, ch in enumerate(Data):
+ if ch == '"' and not InSingleQuoteStr:
+ if Data[Index - 1] != '\\':
+ InDoubleQuoteStr = not InDoubleQuoteStr
+ elif ch == "'" and not InDoubleQuoteStr:
+ if Data[Index - 1] != '\\':
+ InSingleQuoteStr = not InSingleQuoteStr
+ elif ch == '(' and not (InSingleQuoteStr or InDoubleQuoteStr):
+ Pair += 1
+ elif ch == ')' and not (InSingleQuoteStr or InDoubleQuoteStr):
+ Pair -= 1
+
+ if (Pair > 0 or InSingleQuoteStr or InDoubleQuoteStr) and ch == TAB_VALUE_SPLIT:
+ NewStr += '-'
+ else:
+ NewStr += ch
+ FieldList = []
+ StartPos = 0
+ while True:
+ Pos = NewStr.find(TAB_VALUE_SPLIT, StartPos)
+ if Pos < 0:
+ FieldList.append(Setting[StartPos:].strip())
+ break
+ FieldList.append(Setting[StartPos:Pos].strip())
+ StartPos = Pos + 1
+ for i, ch in enumerate(FieldList):
+ if RanStr in ch:
+ FieldList[i] = ch.replace(RanStr,'\\\\')
+ return FieldList
+
+def ParseFieldValue (Value):
+ def ParseDevPathValue (Value):
+ if '\\' in Value:
+ Value.replace('\\', '/').replace(' ', '')
+
+ Cmd = 'DevicePath ' + '"' + Value + '"'
+ try:
+ p = subprocess.Popen(Cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ out, err = p.communicate()
+ except Exception as X:
+ raise BadExpression("DevicePath: %s" % (str(X)) )
+ finally:
+ subprocess._cleanup()
+ p.stdout.close()
+ p.stderr.close()
+ if err:
+ raise BadExpression("DevicePath: %s" % str(err))
+ out = out.decode()
+ Size = len(out.split())
+ out = ','.join(out.split())
+ return '{' + out + '}', Size
+
+ if "{CODE(" in Value:
+ return Value, len(Value.split(","))
+ if isinstance(Value, type(0)):
+ return Value, (Value.bit_length() + 7) // 8
+ if not isinstance(Value, type('')):
+ raise BadExpression('Type %s is %s' %(Value, type(Value)))
+ Value = Value.strip()
+ if Value.startswith(TAB_UINT8) and Value.endswith(')'):
+ Value, Size = ParseFieldValue(Value.split('(', 1)[1][:-1])
+ if Size > 1:
+ raise BadExpression('Value (%s) Size larger than %d' %(Value, Size))
+ return Value, 1
+ if Value.startswith(TAB_UINT16) and Value.endswith(')'):
+ Value, Size = ParseFieldValue(Value.split('(', 1)[1][:-1])
+ if Size > 2:
+ raise BadExpression('Value (%s) Size larger than %d' %(Value, Size))
+ return Value, 2
+ if Value.startswith(TAB_UINT32) and Value.endswith(')'):
+ Value, Size = ParseFieldValue(Value.split('(', 1)[1][:-1])
+ if Size > 4:
+ raise BadExpression('Value (%s) Size larger than %d' %(Value, Size))
+ return Value, 4
+ if Value.startswith(TAB_UINT64) and Value.endswith(')'):
+ Value, Size = ParseFieldValue(Value.split('(', 1)[1][:-1])
+ if Size > 8:
+ raise BadExpression('Value (%s) Size larger than %d' % (Value, Size))
+ return Value, 8
+ if Value.startswith(TAB_GUID) and Value.endswith(')'):
+ Value = Value.split('(', 1)[1][:-1].strip()
+ if Value[0] == '{' and Value[-1] == '}':
+ TmpValue = GuidStructureStringToGuidString(Value)
+ if not TmpValue:
+ raise BadExpression("Invalid GUID value string %s" % Value)
+ Value = TmpValue
+ if Value[0] == '"' and Value[-1] == '"':
+ Value = Value[1:-1]
+ try:
+ Value = uuid.UUID(Value).bytes_le
+ ValueL, ValueH = struct.unpack('2Q', Value)
+ Value = (ValueH << 64 ) | ValueL
+
+ except ValueError as Message:
+ raise BadExpression(Message)
+ return Value, 16
+ if Value.startswith('L"') and Value.endswith('"'):
+ # Unicode String
+ # translate escape character
+ Value = Value[1:]
+ try:
+ Value = eval(Value)
+ except:
+ Value = Value[1:-1]
+ List = list(Value)
+ List.reverse()
+ Value = 0
+ for Char in List:
+ Value = (Value << 16) | ord(Char)
+ return Value, (len(List) + 1) * 2
+ if Value.startswith('"') and Value.endswith('"'):
+ # ASCII String
+ # translate escape character
+ try:
+ Value = eval(Value)
+ except:
+ Value = Value[1:-1]
+ List = list(Value)
+ List.reverse()
+ Value = 0
+ for Char in List:
+ Value = (Value << 8) | ord(Char)
+ return Value, len(List) + 1
+ if Value.startswith("L'") and Value.endswith("'"):
+ # Unicode Character Constant
+ # translate escape character
+ Value = Value[1:]
+ try:
+ Value = eval(Value)
+ except:
+ Value = Value[1:-1]
+ List = list(Value)
+ if len(List) == 0:
+ raise BadExpression('Length %s is %s' % (Value, len(List)))
+ List.reverse()
+ Value = 0
+ for Char in List:
+ Value = (Value << 16) | ord(Char)
+ return Value, len(List) * 2
+ if Value.startswith("'") and Value.endswith("'"):
+ # Character constant
+ # translate escape character
+ try:
+ Value = eval(Value)
+ except:
+ Value = Value[1:-1]
+ List = list(Value)
+ if len(List) == 0:
+ raise BadExpression('Length %s is %s' % (Value, len(List)))
+ List.reverse()
+ Value = 0
+ for Char in List:
+ Value = (Value << 8) | ord(Char)
+ return Value, len(List)
+ if Value.startswith('{') and Value.endswith('}'):
+ # Byte array
+ Value = Value[1:-1]
+ List = [Item.strip() for Item in Value.split(',')]
+ List.reverse()
+ Value = 0
+ RetSize = 0
+ for Item in List:
+ ItemValue, Size = ParseFieldValue(Item)
+ RetSize += Size
+ for I in range(Size):
+ Value = (Value << 8) | ((ItemValue >> 8 * I) & 0xff)
+ return Value, RetSize
+ if Value.startswith('DEVICE_PATH(') and Value.endswith(')'):
+ Value = Value.replace("DEVICE_PATH(", '').rstrip(')')
+ Value = Value.strip().strip('"')
+ return ParseDevPathValue(Value)
+ if Value.lower().startswith('0x'):
+ try:
+ Value = int(Value, 16)
+ except:
+ raise BadExpression("invalid hex value: %s" % Value)
+ if Value == 0:
+ return 0, 1
+ return Value, (Value.bit_length() + 7) // 8
+ if Value[0].isdigit():
+ Value = int(Value, 10)
+ if Value == 0:
+ return 0, 1
+ return Value, (Value.bit_length() + 7) // 8
+ if Value.lower() == 'true':
+ return 1, 1
+ if Value.lower() == 'false':
+ return 0, 1
+ return Value, 1
+
+## AnalyzeDscPcd
+#
+# Analyze DSC PCD value, since there is no data type info in DSC
+# This function is used to match functions (AnalyzePcdData) used for retrieving PCD value from database
+# 1. Feature flag: TokenSpace.PcdCName|PcdValue
+# 2. Fix and Patch:TokenSpace.PcdCName|PcdValue[|VOID*[|MaxSize]]
+# 3. Dynamic default:
+# TokenSpace.PcdCName|PcdValue[|VOID*[|MaxSize]]
+# TokenSpace.PcdCName|PcdValue
+# 4. Dynamic VPD:
+# TokenSpace.PcdCName|VpdOffset[|VpdValue]
+# TokenSpace.PcdCName|VpdOffset[|MaxSize[|VpdValue]]
+# 5. Dynamic HII:
+# TokenSpace.PcdCName|HiiString|VariableGuid|VariableOffset[|HiiValue]
+# PCD value needs to be located in such kind of string, and the PCD value might be an expression in which
+# there might have "|" operator, also in string value.
+#
+# @param Setting: String contain information described above with "TokenSpace.PcdCName|" stripped
+# @param PcdType: PCD type: feature, fixed, dynamic default VPD HII
+# @param DataType: The datum type of PCD: VOID*, UNIT, BOOL
+# @retval:
+# ValueList: A List contain fields described above
+# IsValid: True if conforming EBNF, otherwise False
+# Index: The index where PcdValue is in ValueList
+#
+def AnalyzeDscPcd(Setting, PcdType, DataType=''):
+ FieldList = AnalyzePcdExpression(Setting)
+
+ IsValid = True
+ if PcdType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT):
+ Value = FieldList[0]
+ Size = ''
+ if len(FieldList) > 1 and FieldList[1]:
+ DataType = FieldList[1]
+ if FieldList[1] != TAB_VOID and StructPattern.match(FieldList[1]) is None:
+ IsValid = False
+ if len(FieldList) > 2:
+ Size = FieldList[2]
+ if IsValid:
+ if DataType == "":
+ IsValid = (len(FieldList) <= 1)
+ else:
+ IsValid = (len(FieldList) <= 3)
+
+ if Size:
+ try:
+ int(Size, 16) if Size.upper().startswith("0X") else int(Size)
+ except:
+ IsValid = False
+ Size = -1
+ return [str(Value), DataType, str(Size)], IsValid, 0
+ elif PcdType == MODEL_PCD_FEATURE_FLAG:
+ Value = FieldList[0]
+ Size = ''
+ IsValid = (len(FieldList) <= 1)
+ return [Value, DataType, str(Size)], IsValid, 0
+ elif PcdType in (MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_VPD):
+ VpdOffset = FieldList[0]
+ Value = Size = ''
+ if not DataType == TAB_VOID:
+ if len(FieldList) > 1:
+ Value = FieldList[1]
+ else:
+ if len(FieldList) > 1:
+ Size = FieldList[1]
+ if len(FieldList) > 2:
+ Value = FieldList[2]
+ if DataType == "":
+ IsValid = (len(FieldList) <= 1)
+ else:
+ IsValid = (len(FieldList) <= 3)
+ if Size:
+ try:
+ int(Size, 16) if Size.upper().startswith("0X") else int(Size)
+ except:
+ IsValid = False
+ Size = -1
+ return [VpdOffset, str(Size), Value], IsValid, 2
+ elif PcdType in (MODEL_PCD_DYNAMIC_HII, MODEL_PCD_DYNAMIC_EX_HII):
+ IsValid = (3 <= len(FieldList) <= 5)
+ HiiString = FieldList[0]
+ Guid = Offset = Value = Attribute = ''
+ if len(FieldList) > 1:
+ Guid = FieldList[1]
+ if len(FieldList) > 2:
+ Offset = FieldList[2]
+ if len(FieldList) > 3:
+ Value = FieldList[3]
+ if len(FieldList) > 4:
+ Attribute = FieldList[4]
+ return [HiiString, Guid, Offset, Value, Attribute], IsValid, 3
+ return [], False, 0
+
+## AnalyzePcdData
+#
+# Analyze the pcd Value, Datum type and TokenNumber.
+# Used to avoid split issue while the value string contain "|" character
+#
+# @param[in] Setting: A String contain value/datum type/token number information;
+#
+# @retval ValueList: A List contain value, datum type and toke number.
+#
+def AnalyzePcdData(Setting):
+ ValueList = ['', '', '']
+
+ ValueRe = re.compile(r'^\s*L?\".*\|.*\"')
+ PtrValue = ValueRe.findall(Setting)
+
+ ValueUpdateFlag = False
+
+ if len(PtrValue) >= 1:
+ Setting = re.sub(ValueRe, '', Setting)
+ ValueUpdateFlag = True
+
+ TokenList = Setting.split(TAB_VALUE_SPLIT)
+ ValueList[0:len(TokenList)] = TokenList
+
+ if ValueUpdateFlag:
+ ValueList[0] = PtrValue[0]
+
+ return ValueList
+
+## check format of PCD value against its the datum type
+#
+# For PCD value setting
+#
+def CheckPcdDatum(Type, Value):
+ if Type == TAB_VOID:
+ ValueRe = re.compile(r'\s*L?\".*\"\s*$')
+ if not (((Value.startswith('L"') or Value.startswith('"')) and Value.endswith('"'))
+ or (Value.startswith('{') and Value.endswith('}')) or (Value.startswith("L'") or Value.startswith("'") and Value.endswith("'"))
+ ):
+ return False, "Invalid value [%s] of type [%s]; must be in the form of {...} for array"\
+ ", \"...\" or \'...\' for string, L\"...\" or L\'...\' for unicode string" % (Value, Type)
+ elif ValueRe.match(Value):
+ # Check the chars in UnicodeString or CString is printable
+ if Value.startswith("L"):
+ Value = Value[2:-1]
+ else:
+ Value = Value[1:-1]
+ Printset = set(string.printable)
+ Printset.remove(TAB_PRINTCHAR_VT)
+ Printset.add(TAB_PRINTCHAR_BS)
+ Printset.add(TAB_PRINTCHAR_NUL)
+ if not set(Value).issubset(Printset):
+ PrintList = sorted(Printset)
+ return False, "Invalid PCD string value of type [%s]; must be printable chars %s." % (Type, PrintList)
+ elif Type == 'BOOLEAN':
+ if Value not in ['TRUE', 'True', 'true', '0x1', '0x01', '1', 'FALSE', 'False', 'false', '0x0', '0x00', '0']:
+ return False, "Invalid value [%s] of type [%s]; must be one of TRUE, True, true, 0x1, 0x01, 1"\
+ ", FALSE, False, false, 0x0, 0x00, 0" % (Value, Type)
+ elif Type in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64]:
+ if Value.startswith('0') and not Value.lower().startswith('0x') and len(Value) > 1 and Value.lstrip('0'):
+ Value = Value.lstrip('0')
+ try:
+ if Value and int(Value, 0) < 0:
+ return False, "PCD can't be set to negative value[%s] for datum type [%s]" % (Value, Type)
+ Value = int(Value, 0)
+ if Value > MAX_VAL_TYPE[Type]:
+ return False, "Too large PCD value[%s] for datum type [%s]" % (Value, Type)
+ except:
+ return False, "Invalid value [%s] of type [%s];"\
+ " must be a hexadecimal, decimal or octal in C language format." % (Value, Type)
+ else:
+ return True, "StructurePcd"
+
+ return True, ""
+
+def CommonPath(PathList):
+ P1 = min(PathList).split(os.path.sep)
+ P2 = max(PathList).split(os.path.sep)
+ for Index in range(min(len(P1), len(P2))):
+ if P1[Index] != P2[Index]:
+ return os.path.sep.join(P1[:Index])
+ return os.path.sep.join(P1)
+
+class PathClass(object):
+ def __init__(self, File='', Root='', AlterRoot='', Type='', IsBinary=False,
+ Arch='COMMON', ToolChainFamily='', Target='', TagName='', ToolCode=''):
+ self.Arch = Arch
+ self.File = str(File)
+ if os.path.isabs(self.File):
+ self.Root = ''
+ self.AlterRoot = ''
+ else:
+ self.Root = str(Root)
+ self.AlterRoot = str(AlterRoot)
+
+ # Remove any '.' and '..' in path
+ if self.Root:
+ self.Root = mws.getWs(self.Root, self.File)
+ self.Path = os.path.normpath(os.path.join(self.Root, self.File))
+ self.Root = os.path.normpath(CommonPath([self.Root, self.Path]))
+ # eliminate the side-effect of 'C:'
+ if self.Root[-1] == ':':
+ self.Root += os.path.sep
+ # file path should not start with path separator
+ if self.Root[-1] == os.path.sep:
+ self.File = self.Path[len(self.Root):]
+ else:
+ self.File = self.Path[len(self.Root) + 1:]
+ else:
+ self.Path = os.path.normpath(self.File)
+
+ self.SubDir, self.Name = os.path.split(self.File)
+ self.BaseName, self.Ext = os.path.splitext(self.Name)
+
+ if self.Root:
+ if self.SubDir:
+ self.Dir = os.path.join(self.Root, self.SubDir)
+ else:
+ self.Dir = self.Root
+ else:
+ self.Dir = self.SubDir
+
+ if IsBinary:
+ self.Type = Type
+ else:
+ self.Type = self.Ext.lower()
+
+ self.IsBinary = IsBinary
+ self.Target = Target
+ self.TagName = TagName
+ self.ToolCode = ToolCode
+ self.ToolChainFamily = ToolChainFamily
+ self.OriginalPath = self
+
+ ## Convert the object of this class to a string
+ #
+ # Convert member Path of the class to a string
+ #
+ # @retval string Formatted String
+ #
+ def __str__(self):
+ return self.Path
+
+ ## Override __eq__ function
+ #
+ # Check whether PathClass are the same
+ #
+ # @retval False The two PathClass are different
+ # @retval True The two PathClass are the same
+ #
+ def __eq__(self, Other):
+ return self.Path == str(Other)
+
+ ## Override __cmp__ function
+ #
+ # Customize the comparison operation of two PathClass
+ #
+ # @retval 0 The two PathClass are different
+ # @retval -1 The first PathClass is less than the second PathClass
+ # @retval 1 The first PathClass is Bigger than the second PathClass
+ def __cmp__(self, Other):
+ OtherKey = str(Other)
+
+ SelfKey = self.Path
+ if SelfKey == OtherKey:
+ return 0
+ elif SelfKey > OtherKey:
+ return 1
+ else:
+ return -1
+
+ ## Override __hash__ function
+ #
+ # Use Path as key in hash table
+ #
+ # @retval string Key for hash table
+ #
+ def __hash__(self):
+ return hash(self.Path)
+
+ @cached_property
+ def Key(self):
+ return self.Path.upper()
+
+ @property
+ def TimeStamp(self):
+ return os.stat(self.Path)[8]
+
+ def Validate(self, Type='', CaseSensitive=True):
+ def RealPath2(File, Dir='', OverrideDir=''):
+ NewFile = None
+ if OverrideDir:
+ NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(OverrideDir, File))]
+ if NewFile:
+ if OverrideDir[-1] == os.path.sep:
+ return NewFile[len(OverrideDir):], NewFile[0:len(OverrideDir)]
+ else:
+ return NewFile[len(OverrideDir) + 1:], NewFile[0:len(OverrideDir)]
+ if GlobalData.gAllFiles:
+ NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(Dir, File))]
+ if not NewFile:
+ NewFile = os.path.normpath(os.path.join(Dir, File))
+ if not os.path.exists(NewFile):
+ return None, None
+ if NewFile:
+ if Dir:
+ if Dir[-1] == os.path.sep:
+ return NewFile[len(Dir):], NewFile[0:len(Dir)]
+ else:
+ return NewFile[len(Dir) + 1:], NewFile[0:len(Dir)]
+ else:
+ return NewFile, ''
+
+ return None, None
+
+ if GlobalData.gCaseInsensitive:
+ CaseSensitive = False
+ if Type and Type.lower() != self.Type:
+ return FILE_TYPE_MISMATCH, '%s (expect %s but got %s)' % (self.File, Type, self.Type)
+
+ RealFile, RealRoot = RealPath2(self.File, self.Root, self.AlterRoot)
+ if not RealRoot and not RealFile:
+ RealFile = self.File
+ if self.AlterRoot:
+ RealFile = os.path.join(self.AlterRoot, self.File)
+ elif self.Root:
+ RealFile = os.path.join(self.Root, self.File)
+ if len (mws.getPkgPath()) == 0:
+ return FILE_NOT_FOUND, os.path.join(self.AlterRoot, RealFile)
+ else:
+ return FILE_NOT_FOUND, "%s is not found in packages path:\n\t%s" % (self.File, '\n\t'.join(mws.getPkgPath()))
+
+ ErrorCode = 0
+ ErrorInfo = ''
+ if RealRoot != self.Root or RealFile != self.File:
+ if CaseSensitive and (RealFile != self.File or (RealRoot != self.Root and RealRoot != self.AlterRoot)):
+ ErrorCode = FILE_CASE_MISMATCH
+ ErrorInfo = self.File + '\n\t' + RealFile + " [in file system]"
+
+ self.SubDir, self.Name = os.path.split(RealFile)
+ self.BaseName, self.Ext = os.path.splitext(self.Name)
+ if self.SubDir:
+ self.Dir = os.path.join(RealRoot, self.SubDir)
+ else:
+ self.Dir = RealRoot
+ self.File = RealFile
+ self.Root = RealRoot
+ self.Path = os.path.join(RealRoot, RealFile)
+ return ErrorCode, ErrorInfo
+
+## Parse PE image to get the required PE information.
+#
+class PeImageClass():
+ ## Constructor
+ #
+ # @param File FilePath of PeImage
+ #
+ def __init__(self, PeFile):
+ self.FileName = PeFile
+ self.IsValid = False
+ self.Size = 0
+ self.EntryPoint = 0
+ self.SectionAlignment = 0
+ self.SectionHeaderList = []
+ self.ErrorInfo = ''
+ try:
+ PeObject = open(PeFile, 'rb')
+ except:
+ self.ErrorInfo = self.FileName + ' can not be found\n'
+ return
+ # Read DOS header
+ ByteArray = array.array('B')
+ ByteArray.fromfile(PeObject, 0x3E)
+ ByteList = ByteArray.tolist()
+ # DOS signature should be 'MZ'
+ if self._ByteListToStr (ByteList[0x0:0x2]) != 'MZ':
+ self.ErrorInfo = self.FileName + ' has no valid DOS signature MZ'
+ return
+
+ # Read 4 byte PE Signature
+ PeOffset = self._ByteListToInt(ByteList[0x3C:0x3E])
+ PeObject.seek(PeOffset)
+ ByteArray = array.array('B')
+ ByteArray.fromfile(PeObject, 4)
+ # PE signature should be 'PE\0\0'
+ if ByteArray.tolist() != [ord('P'), ord('E'), 0, 0]:
+ self.ErrorInfo = self.FileName + ' has no valid PE signature PE00'
+ return
+
+ # Read PE file header
+ ByteArray = array.array('B')
+ ByteArray.fromfile(PeObject, 0x14)
+ ByteList = ByteArray.tolist()
+ SecNumber = self._ByteListToInt(ByteList[0x2:0x4])
+ if SecNumber == 0:
+ self.ErrorInfo = self.FileName + ' has no section header'
+ return
+
+ # Read PE optional header
+ OptionalHeaderSize = self._ByteListToInt(ByteArray[0x10:0x12])
+ ByteArray = array.array('B')
+ ByteArray.fromfile(PeObject, OptionalHeaderSize)
+ ByteList = ByteArray.tolist()
+ self.EntryPoint = self._ByteListToInt(ByteList[0x10:0x14])
+ self.SectionAlignment = self._ByteListToInt(ByteList[0x20:0x24])
+ self.Size = self._ByteListToInt(ByteList[0x38:0x3C])
+
+ # Read each Section Header
+ for Index in range(SecNumber):
+ ByteArray = array.array('B')
+ ByteArray.fromfile(PeObject, 0x28)
+ ByteList = ByteArray.tolist()
+ SecName = self._ByteListToStr(ByteList[0:8])
+ SecVirtualSize = self._ByteListToInt(ByteList[8:12])
+ SecRawAddress = self._ByteListToInt(ByteList[20:24])
+ SecVirtualAddress = self._ByteListToInt(ByteList[12:16])
+ self.SectionHeaderList.append((SecName, SecVirtualAddress, SecRawAddress, SecVirtualSize))
+ self.IsValid = True
+ PeObject.close()
+
+ def _ByteListToStr(self, ByteList):
+ String = ''
+ for index in range(len(ByteList)):
+ if ByteList[index] == 0:
+ break
+ String += chr(ByteList[index])
+ return String
+
+ def _ByteListToInt(self, ByteList):
+ Value = 0
+ for index in range(len(ByteList) - 1, -1, -1):
+ Value = (Value << 8) | int(ByteList[index])
+ return Value
+
+class DefaultStore():
+ def __init__(self, DefaultStores ):
+
+ self.DefaultStores = DefaultStores
+ def DefaultStoreID(self, DefaultStoreName):
+ for key, value in self.DefaultStores.items():
+ if value == DefaultStoreName:
+ return key
+ return None
+ def GetDefaultDefault(self):
+ if not self.DefaultStores or "0" in self.DefaultStores:
+ return "0", TAB_DEFAULT_STORES_DEFAULT
+ else:
+ minvalue = min(int(value_str) for value_str in self.DefaultStores)
+ return (str(minvalue), self.DefaultStores[str(minvalue)])
+ def GetMin(self, DefaultSIdList):
+ if not DefaultSIdList:
+ return TAB_DEFAULT_STORES_DEFAULT
+ storeidset = {storeid for storeid, storename in self.DefaultStores.values() if storename in DefaultSIdList}
+ if not storeidset:
+ return ""
+ minid = min(storeidset )
+ for sid, name in self.DefaultStores.values():
+ if sid == minid:
+ return name
+
+class SkuClass():
+ DEFAULT = 0
+ SINGLE = 1
+ MULTIPLE =2
+
+ def __init__(self,SkuIdentifier='', SkuIds=None):
+ if SkuIds is None:
+ SkuIds = {}
+
+ for SkuName in SkuIds:
+ SkuId = SkuIds[SkuName][0]
+ skuid_num = int(SkuId, 16) if SkuId.upper().startswith("0X") else int(SkuId)
+ if skuid_num > 0xFFFFFFFFFFFFFFFF:
+ EdkLogger.error("build", PARAMETER_INVALID,
+ ExtraData = "SKU-ID [%s] value %s exceeds the max value of UINT64"
+ % (SkuName, SkuId))
+
+ self.AvailableSkuIds = OrderedDict()
+ self.SkuIdSet = []
+ self.SkuIdNumberSet = []
+ self.SkuData = SkuIds
+ self._SkuInherit = {}
+ self._SkuIdentifier = SkuIdentifier
+ if SkuIdentifier == '' or SkuIdentifier is None:
+ self.SkuIdSet = ['DEFAULT']
+ self.SkuIdNumberSet = ['0U']
+ elif SkuIdentifier == 'ALL':
+ self.SkuIdSet = list(SkuIds.keys())
+ self.SkuIdNumberSet = [num[0].strip() + 'U' for num in SkuIds.values()]
+ else:
+ r = SkuIdentifier.split('|')
+ self.SkuIdSet=[(r[k].strip()).upper() for k in range(len(r))]
+ k = None
+ try:
+ self.SkuIdNumberSet = [SkuIds[k][0].strip() + 'U' for k in self.SkuIdSet]
+ except Exception:
+ EdkLogger.error("build", PARAMETER_INVALID,
+ ExtraData = "SKU-ID [%s] is not supported by the platform. [Valid SKU-ID: %s]"
+ % (k, " | ".join(SkuIds.keys())))
+ for each in self.SkuIdSet:
+ if each in SkuIds:
+ self.AvailableSkuIds[each] = SkuIds[each][0]
+ else:
+ EdkLogger.error("build", PARAMETER_INVALID,
+ ExtraData="SKU-ID [%s] is not supported by the platform. [Valid SKU-ID: %s]"
+ % (each, " | ".join(SkuIds.keys())))
+ if self.SkuUsageType != SkuClass.SINGLE:
+ self.AvailableSkuIds.update({'DEFAULT':0, 'COMMON':0})
+ if self.SkuIdSet:
+ GlobalData.gSkuids = (self.SkuIdSet)
+ if 'COMMON' in GlobalData.gSkuids:
+ GlobalData.gSkuids.remove('COMMON')
+ if self.SkuUsageType == self.SINGLE:
+ if len(GlobalData.gSkuids) != 1:
+ if 'DEFAULT' in GlobalData.gSkuids:
+ GlobalData.gSkuids.remove('DEFAULT')
+ if GlobalData.gSkuids:
+ GlobalData.gSkuids.sort()
+
+ def GetNextSkuId(self, skuname):
+ if not self._SkuInherit:
+ self._SkuInherit = {}
+ for item in self.SkuData.values():
+ self._SkuInherit[item[1]]=item[2] if item[2] else "DEFAULT"
+ return self._SkuInherit.get(skuname, "DEFAULT")
+
+ def GetSkuChain(self, sku):
+ if sku == "DEFAULT":
+ return ["DEFAULT"]
+ skulist = [sku]
+ nextsku = sku
+ while True:
+ nextsku = self.GetNextSkuId(nextsku)
+ skulist.append(nextsku)
+ if nextsku == "DEFAULT":
+ break
+ skulist.reverse()
+ return skulist
+ def SkuOverrideOrder(self):
+ skuorderset = []
+ for skuname in self.SkuIdSet:
+ skuorderset.append(self.GetSkuChain(skuname))
+
+ skuorder = []
+ for index in range(max(len(item) for item in skuorderset)):
+ for subset in skuorderset:
+ if index > len(subset)-1:
+ continue
+ if subset[index] in skuorder:
+ continue
+ skuorder.append(subset[index])
+
+ return skuorder
+
+ @property
+ def SkuUsageType(self):
+ if self._SkuIdentifier.upper() == "ALL":
+ return SkuClass.MULTIPLE
+
+ if len(self.SkuIdSet) == 1:
+ if self.SkuIdSet[0] == 'DEFAULT':
+ return SkuClass.DEFAULT
+ return SkuClass.SINGLE
+ if len(self.SkuIdSet) == 2 and 'DEFAULT' in self.SkuIdSet:
+ return SkuClass.SINGLE
+ return SkuClass.MULTIPLE
+
+ def DumpSkuIdArrary(self):
+ if self.SkuUsageType == SkuClass.SINGLE:
+ return "{0x0}"
+ ArrayStrList = []
+ for skuname in self.AvailableSkuIds:
+ if skuname == "COMMON":
+ continue
+ while skuname != "DEFAULT":
+ ArrayStrList.append(hex(int(self.AvailableSkuIds[skuname])))
+ skuname = self.GetNextSkuId(skuname)
+ ArrayStrList.append("0x0")
+ return "{{{myList}}}".format(myList=",".join(ArrayStrList))
+
+ @property
+ def AvailableSkuIdSet(self):
+ return self.AvailableSkuIds
+
+ @property
+ def SystemSkuId(self):
+ if self.SkuUsageType == SkuClass.SINGLE:
+ if len(self.SkuIdSet) == 1:
+ return self.SkuIdSet[0]
+ else:
+ return self.SkuIdSet[0] if self.SkuIdSet[0] != 'DEFAULT' else self.SkuIdSet[1]
+ else:
+ return 'DEFAULT'
+
+## Get the integer value from string like "14U" or integer like 2
+#
+# @param Input The object that may be either a integer value or a string
+#
+# @retval Value The integer value that the input represents
+#
+def GetIntegerValue(Input):
+ if not isinstance(Input, str):
+ return Input
+ String = Input
+ if String.endswith("U"):
+ String = String[:-1]
+ if String.endswith("ULL"):
+ String = String[:-3]
+ if String.endswith("LL"):
+ String = String[:-2]
+
+ if String.startswith("0x") or String.startswith("0X"):
+ return int(String, 16)
+ elif String == '':
+ return 0
+ else:
+ return int(String)
+
+#
+# Pack a GUID (registry format) list into a buffer and return it
+#
+def PackGUID(Guid):
+ return pack(PACK_PATTERN_GUID,
+ int(Guid[0], 16),
+ int(Guid[1], 16),
+ int(Guid[2], 16),
+ int(Guid[3][-4:-2], 16),
+ int(Guid[3][-2:], 16),
+ int(Guid[4][-12:-10], 16),
+ int(Guid[4][-10:-8], 16),
+ int(Guid[4][-8:-6], 16),
+ int(Guid[4][-6:-4], 16),
+ int(Guid[4][-4:-2], 16),
+ int(Guid[4][-2:], 16)
+ )
+
+#
+# Pack a GUID (byte) list into a buffer and return it
+#
+def PackByteFormatGUID(Guid):
+ return pack(PACK_PATTERN_GUID,
+ Guid[0],
+ Guid[1],
+ Guid[2],
+ Guid[3],
+ Guid[4],
+ Guid[5],
+ Guid[6],
+ Guid[7],
+ Guid[8],
+ Guid[9],
+ Guid[10],
+ )
+
+## DeepCopy dict/OrderedDict recusively
+#
+# @param ori_dict a nested dict or ordereddict
+#
+# @retval new dict or orderdict
+#
+def CopyDict(ori_dict):
+ dict_type = ori_dict.__class__
+ if dict_type not in (dict,OrderedDict):
+ return ori_dict
+ new_dict = dict_type()
+ for key in ori_dict:
+ if isinstance(ori_dict[key],(dict,OrderedDict)):
+ new_dict[key] = CopyDict(ori_dict[key])
+ else:
+ new_dict[key] = ori_dict[key]
+ return new_dict
+
+#
+# Remove the c/c++ comments: // and /* */
+#
+def RemoveCComments(ctext):
+ return re.sub('//.*?\n|/\*.*?\*/', '\n', ctext, flags=re.S)
diff --git a/roms/edk2/BaseTools/Source/Python/Common/MultipleWorkspace.py b/roms/edk2/BaseTools/Source/Python/Common/MultipleWorkspace.py
new file mode 100644
index 000000000..ad5d48588
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/MultipleWorkspace.py
@@ -0,0 +1,150 @@
+## @file
+# manage multiple workspace file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+import Common.LongFilePathOs as os
+from Common.DataType import TAB_WORKSPACE
+
+## MultipleWorkspace
+#
+# This class manage multiple workspace behavior
+#
+# @param class:
+#
+# @var WORKSPACE: defined the current WORKSPACE
+# @var PACKAGES_PATH: defined the other WORKSPACE, if current WORKSPACE is invalid, search valid WORKSPACE from PACKAGES_PATH
+#
+class MultipleWorkspace(object):
+ WORKSPACE = ''
+ PACKAGES_PATH = None
+
+ ## convertPackagePath()
+ #
+ # Convert path to match workspace.
+ #
+ # @param cls The class pointer
+ # @param Ws The current WORKSPACE
+ # @param Path Path to be converted to match workspace.
+ #
+ @classmethod
+ def convertPackagePath(cls, Ws, Path):
+ if str(os.path.normcase (Path)).startswith(Ws):
+ return os.path.join(Ws, os.path.relpath(Path, Ws))
+ return Path
+
+ ## setWs()
+ #
+ # set WORKSPACE and PACKAGES_PATH environment
+ #
+ # @param cls The class pointer
+ # @param Ws initialize WORKSPACE variable
+ # @param PackagesPath initialize PackagesPath variable
+ #
+ @classmethod
+ def setWs(cls, Ws, PackagesPath=None):
+ cls.WORKSPACE = Ws
+ if PackagesPath:
+ cls.PACKAGES_PATH = [cls.convertPackagePath (Ws, os.path.normpath(Path.strip())) for Path in PackagesPath.split(os.pathsep)]
+ else:
+ cls.PACKAGES_PATH = []
+
+ ## join()
+ #
+ # rewrite os.path.join function
+ #
+ # @param cls The class pointer
+ # @param Ws the current WORKSPACE
+ # @param *p path of the inf/dec/dsc/fdf/conf file
+ # @retval Path the absolute path of specified file
+ #
+ @classmethod
+ def join(cls, Ws, *p):
+ Path = os.path.join(Ws, *p)
+ if not os.path.exists(Path):
+ for Pkg in cls.PACKAGES_PATH:
+ Path = os.path.join(Pkg, *p)
+ if os.path.exists(Path):
+ return Path
+ Path = os.path.join(Ws, *p)
+ return Path
+
+ ## relpath()
+ #
+ # rewrite os.path.relpath function
+ #
+ # @param cls The class pointer
+ # @param Path path of the inf/dec/dsc/fdf/conf file
+ # @param Ws the current WORKSPACE
+ # @retval Path the relative path of specified file
+ #
+ @classmethod
+ def relpath(cls, Path, Ws):
+ for Pkg in cls.PACKAGES_PATH:
+ if Path.lower().startswith(Pkg.lower()):
+ Path = os.path.relpath(Path, Pkg)
+ return Path
+ if Path.lower().startswith(Ws.lower()):
+ Path = os.path.relpath(Path, Ws)
+ return Path
+
+ ## getWs()
+ #
+ # get valid workspace for the path
+ #
+ # @param cls The class pointer
+ # @param Ws the current WORKSPACE
+ # @param Path path of the inf/dec/dsc/fdf/conf file
+ # @retval Ws the valid workspace relative to the specified file path
+ #
+ @classmethod
+ def getWs(cls, Ws, Path):
+ absPath = os.path.join(Ws, Path)
+ if not os.path.exists(absPath):
+ for Pkg in cls.PACKAGES_PATH:
+ absPath = os.path.join(Pkg, Path)
+ if os.path.exists(absPath):
+ return Pkg
+ return Ws
+
+ ## handleWsMacro()
+ #
+ # handle the $(WORKSPACE) tag, if current workspace is invalid path relative the tool, replace it.
+ #
+ # @param cls The class pointer
+ # @retval PathStr Path string include the $(WORKSPACE)
+ #
+ @classmethod
+ def handleWsMacro(cls, PathStr):
+ if TAB_WORKSPACE in PathStr:
+ PathList = PathStr.split()
+ if PathList:
+ for i, str in enumerate(PathList):
+ MacroStartPos = str.find(TAB_WORKSPACE)
+ if MacroStartPos != -1:
+ Substr = str[MacroStartPos:]
+ Path = Substr.replace(TAB_WORKSPACE, cls.WORKSPACE).strip()
+ if not os.path.exists(Path):
+ for Pkg in cls.PACKAGES_PATH:
+ Path = Substr.replace(TAB_WORKSPACE, Pkg).strip()
+ if os.path.exists(Path):
+ break
+ PathList[i] = str[0:MacroStartPos] + Path
+ PathStr = ' '.join(PathList)
+ return PathStr
+
+ ## getPkgPath()
+ #
+ # get all package paths.
+ #
+ # @param cls The class pointer
+ #
+ @classmethod
+ def getPkgPath(cls):
+ return cls.PACKAGES_PATH
+
diff --git a/roms/edk2/BaseTools/Source/Python/Common/Parsing.py b/roms/edk2/BaseTools/Source/Python/Common/Parsing.py
new file mode 100644
index 000000000..740283a04
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/Parsing.py
@@ -0,0 +1,906 @@
+## @file
+# This file is used to define common parsing related functions used in parsing INF/DEC/DSC process
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from .StringUtils import *
+from CommonDataClass.DataClass import *
+from .DataType import *
+
+## ParseDefineMacro
+#
+# Search whole table to find all defined Macro and replaced them with the real values
+#
+def ParseDefineMacro2(Table, RecordSets, GlobalMacro):
+ Macros = {}
+ #
+ # Find all DEFINE macros in section [Header] and its section
+ #
+ SqlCommand = """select Value1, Value2, BelongsToItem, StartLine, Arch from %s
+ where Model = %s
+ and Enabled > -1""" % (Table.Table, MODEL_META_DATA_DEFINE)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+ Macros[Record[0]] = Record[1]
+
+ #
+ # Overridden by Global Macros
+ #
+ Macros.update(GlobalMacro)
+
+ #
+ # Replace the Macros
+ #
+ for Value in (v for v in RecordSets.values() if v):
+ for Item in Value:
+ Item[0] = ReplaceMacro(Item[0], Macros)
+
+## ParseDefineMacro
+#
+# Search whole table to find all defined Macro and replaced them with the real values
+#
+def ParseDefineMacro(Table, GlobalMacro):
+ Macros = {}
+ #
+ # Find all DEFINE macros
+ #
+ SqlCommand = """select Value1, Value2, BelongsToItem, StartLine, Arch from %s
+ where Model = %s
+ and Enabled > -1""" % (Table.Table, MODEL_META_DATA_DEFINE)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+#***************************************************************************************************************************************************
+# The follow SqlCommand (expr replace) is not supported in Sqlite 3.3.4 which is used in Python 2.5 *
+# Reserved Only *
+# SqlCommand = """update %s set Value1 = replace(Value1, '%s', '%s') *
+# where ID in (select ID from %s *
+# where Model = %s *
+# and Value1 like '%%%s%%' *
+# and StartLine > %s *
+# and Enabled > -1 *
+# and Arch = '%s')""" % \ *
+# (self.TblDsc.Table, Record[0], Record[1], self.TblDsc.Table, Record[2], Record[1], Record[3], Record[4]) *
+#***************************************************************************************************************************************************
+ Macros[Record[0]] = Record[1]
+
+ #
+ # Overridden by Global Macros
+ #
+ Macros.update(GlobalMacro)
+
+ #
+ # Found all defined macro and replaced
+ #
+ SqlCommand = """select ID, Value1 from %s
+ where Model != %s
+ and Value1 like '%%$(%%' and Value1 like '%%)%%'
+ and Enabled > -1""" % (Table.Table, MODEL_META_DATA_DEFINE)
+ FoundRecords = Table.Exec(SqlCommand)
+ for FoundRecord in FoundRecords:
+ NewValue = ReplaceMacro(FoundRecord[1], Macros)
+ SqlCommand = """update %s set Value1 = '%s'
+ where ID = %s""" % (Table.Table, ConvertToSqlString2(NewValue), FoundRecord[0])
+ Table.Exec(SqlCommand)
+
+##QueryDefinesItem
+#
+# Search item of section [Defines] by name, return its values
+#
+# @param Table: The Table to be executed
+# @param Name: The Name of item of section [Defines]
+# @param Arch: The Arch of item of section [Defines]
+#
+# @retval RecordSet: A list of all matched records
+#
+def QueryDefinesItem(Table, Name, Arch, BelongsToFile):
+ SqlCommand = """select Value2 from %s
+ where Model = %s
+ and Value1 = '%s'
+ and Arch = '%s'
+ and BelongsToFile = %s
+ and Enabled > -1""" % (Table.Table, MODEL_META_DATA_HEADER, ConvertToSqlString2(Name), ConvertToSqlString2(Arch), BelongsToFile)
+ RecordSet = Table.Exec(SqlCommand)
+ if len(RecordSet) < 1:
+ SqlCommand = """select Value2 from %s
+ where Model = %s
+ and Value1 = '%s'
+ and Arch = '%s'
+ and BelongsToFile = %s
+ and Enabled > -1""" % (Table.Table, MODEL_META_DATA_HEADER, ConvertToSqlString2(Name), ConvertToSqlString2(TAB_ARCH_COMMON.upper()), BelongsToFile)
+ RecordSet = Table.Exec(SqlCommand)
+ if len(RecordSet) == 1:
+ if Name == TAB_INF_DEFINES_LIBRARY_CLASS:
+ return [RecordSet[0][0]]
+ else:
+ return GetSplitValueList(RecordSet[0][0])
+ elif len(RecordSet) < 1:
+ return ['']
+ elif len(RecordSet) > 1:
+ RetVal = []
+ for Record in RecordSet:
+ if Name == TAB_INF_DEFINES_LIBRARY_CLASS:
+ RetVal.append(Record[0])
+ else:
+ Items = GetSplitValueList(Record[0])
+ for Item in Items:
+ RetVal.append(Item)
+ return RetVal
+
+##QueryDefinesItem
+#
+# Search item of section [Defines] by name, return its values
+#
+# @param Table: The Table to be executed
+# @param Name: The Name of item of section [Defines]
+# @param Arch: The Arch of item of section [Defines]
+#
+# @retval RecordSet: A list of all matched records
+#
+def QueryDefinesItem2(Table, Arch, BelongsToFile):
+ SqlCommand = """select Value1, Value2, StartLine from %s
+ where Model = %s
+ and Arch = '%s'
+ and BelongsToFile = %s
+ and Enabled > -1""" % (Table.Table, MODEL_META_DATA_HEADER, ConvertToSqlString2(Arch), BelongsToFile)
+ RecordSet = Table.Exec(SqlCommand)
+ if len(RecordSet) < 1:
+ SqlCommand = """select Value1, Value2, StartLine from %s
+ where Model = %s
+ and Arch = '%s'
+ and BelongsToFile = %s
+ and Enabled > -1""" % (Table.Table, MODEL_META_DATA_HEADER, ConvertToSqlString2(TAB_ARCH_COMMON), BelongsToFile)
+ RecordSet = Table.Exec(SqlCommand)
+
+ return RecordSet
+
+##QueryDscItem
+#
+# Search all dsc item for a specific section
+#
+# @param Table: The Table to be executed
+# @param Model: The type of section
+#
+# @retval RecordSet: A list of all matched records
+#
+def QueryDscItem(Table, Model, BelongsToItem, BelongsToFile):
+ SqlCommand = """select Value1, Arch, StartLine, ID, Value2 from %s
+ where Model = %s
+ and BelongsToItem = %s
+ and BelongsToFile = %s
+ and Enabled > -1""" % (Table.Table, Model, BelongsToItem, BelongsToFile)
+ return Table.Exec(SqlCommand)
+
+##QueryDecItem
+#
+# Search all dec item for a specific section
+#
+# @param Table: The Table to be executed
+# @param Model: The type of section
+#
+# @retval RecordSet: A list of all matched records
+#
+def QueryDecItem(Table, Model, BelongsToItem):
+ SqlCommand = """select Value1, Arch, StartLine, ID, Value2 from %s
+ where Model = %s
+ and BelongsToItem = %s
+ and Enabled > -1""" % (Table.Table, Model, BelongsToItem)
+ return Table.Exec(SqlCommand)
+
+##QueryInfItem
+#
+# Search all dec item for a specific section
+#
+# @param Table: The Table to be executed
+# @param Model: The type of section
+#
+# @retval RecordSet: A list of all matched records
+#
+def QueryInfItem(Table, Model, BelongsToItem):
+ SqlCommand = """select Value1, Arch, StartLine, ID, Value2 from %s
+ where Model = %s
+ and BelongsToItem = %s
+ and Enabled > -1""" % (Table.Table, Model, BelongsToItem)
+ return Table.Exec(SqlCommand)
+
+## GetBuildOption
+#
+# Parse a string with format "[<Family>:]<ToolFlag>=Flag"
+# Return (Family, ToolFlag, Flag)
+#
+# @param String: String with BuildOption statement
+# @param File: The file which defines build option, used in error report
+#
+# @retval truple() A truple structure as (Family, ToolChain, Flag)
+#
+def GetBuildOption(String, File, LineNo = -1):
+ (Family, ToolChain, Flag) = ('', '', '')
+ if String.find(TAB_EQUAL_SPLIT) < 0:
+ RaiseParserError(String, 'BuildOptions', File, '[<Family>:]<ToolFlag>=Flag', LineNo)
+ else:
+ List = GetSplitValueList(String, TAB_EQUAL_SPLIT, MaxSplit = 1)
+ if List[0].find(':') > -1:
+ Family = List[0][ : List[0].find(':')].strip()
+ ToolChain = List[0][List[0].find(':') + 1 : ].strip()
+ else:
+ ToolChain = List[0].strip()
+ Flag = List[1].strip()
+ return (Family, ToolChain, Flag)
+
+## Get Library Class
+#
+# Get Library of Dsc as <LibraryClassKeyWord>|<LibraryInstance>
+#
+# @param Item: String as <LibraryClassKeyWord>|<LibraryInstance>
+# @param ContainerFile: The file which describes the library class, used for error report
+#
+# @retval (LibraryClassKeyWord, LibraryInstance, [SUP_MODULE_LIST]) Formatted Library Item
+#
+def GetLibraryClass(Item, ContainerFile, WorkspaceDir, LineNo = -1):
+ List = GetSplitValueList(Item[0])
+ SupMod = SUP_MODULE_LIST_STRING
+ if len(List) != 2:
+ RaiseParserError(Item[0], 'LibraryClasses', ContainerFile, '<LibraryClassKeyWord>|<LibraryInstance>')
+ else:
+ CheckFileType(List[1], '.Inf', ContainerFile, 'library class instance', Item[0], LineNo)
+ CheckFileExist(WorkspaceDir, List[1], ContainerFile, 'LibraryClasses', Item[0], LineNo)
+ if Item[1] != '':
+ SupMod = Item[1]
+
+ return (List[0], List[1], SupMod)
+
+## Get Library Class
+#
+# Get Library of Dsc as <LibraryClassKeyWord>[|<LibraryInstance>][|<TokenSpaceGuidCName>.<PcdCName>]
+#
+# @param Item: String as <LibraryClassKeyWord>|<LibraryInstance>
+# @param ContainerFile: The file which describes the library class, used for error report
+#
+# @retval (LibraryClassKeyWord, LibraryInstance, [SUP_MODULE_LIST]) Formatted Library Item
+#
+def GetLibraryClassOfInf(Item, ContainerFile, WorkspaceDir, LineNo = -1):
+ ItemList = GetSplitValueList((Item[0] + DataType.TAB_VALUE_SPLIT * 2))
+ SupMod = SUP_MODULE_LIST_STRING
+
+ if len(ItemList) > 5:
+ RaiseParserError(Item[0], 'LibraryClasses', ContainerFile, '<LibraryClassKeyWord>[|<LibraryInstance>][|<TokenSpaceGuidCName>.<PcdCName>]')
+ else:
+ CheckFileType(ItemList[1], '.Inf', ContainerFile, 'LibraryClasses', Item[0], LineNo)
+ CheckFileExist(WorkspaceDir, ItemList[1], ContainerFile, 'LibraryClasses', Item[0], LineNo)
+ if ItemList[2] != '':
+ CheckPcdTokenInfo(ItemList[2], 'LibraryClasses', ContainerFile, LineNo)
+ if Item[1] != '':
+ SupMod = Item[1]
+
+ return (ItemList[0], ItemList[1], ItemList[2], SupMod)
+
+## CheckPcdTokenInfo
+#
+# Check if PcdTokenInfo is following <TokenSpaceGuidCName>.<PcdCName>
+#
+# @param TokenInfoString: String to be checked
+# @param Section: Used for error report
+# @param File: Used for error report
+#
+# @retval True PcdTokenInfo is in correct format
+#
+def CheckPcdTokenInfo(TokenInfoString, Section, File, LineNo = -1):
+ Format = '<TokenSpaceGuidCName>.<PcdCName>'
+ if TokenInfoString != '' and TokenInfoString is not None:
+ TokenInfoList = GetSplitValueList(TokenInfoString, TAB_SPLIT)
+ if len(TokenInfoList) == 2:
+ return True
+
+ RaiseParserError(TokenInfoString, Section, File, Format, LineNo)
+
+## Get Pcd
+#
+# Get Pcd of Dsc as <PcdTokenSpaceGuidCName>.<TokenCName>|<Value>[|<Type>|<MaximumDatumSize>]
+#
+# @param Item: String as <PcdTokenSpaceGuidCName>.<TokenCName>|<Value>[|<Type>|<MaximumDatumSize>]
+# @param ContainerFile: The file which describes the pcd, used for error report
+#
+# @retval (TokenInfo[1], TokenInfo[0], List[1], List[2], List[3], Type)
+#
+def GetPcd(Item, Type, ContainerFile, LineNo = -1):
+ TokenGuid, TokenName, Value, MaximumDatumSize, Token = '', '', '', '', ''
+ List = GetSplitValueList(Item + TAB_VALUE_SPLIT * 2)
+
+ if len(List) < 4 or len(List) > 6:
+ RaiseParserError(Item, 'Pcds' + Type, ContainerFile, '<PcdTokenSpaceGuidCName>.<TokenCName>|<Value>[|<Type>|<MaximumDatumSize>]', LineNo)
+ else:
+ Value = List[1]
+ MaximumDatumSize = List[2]
+ Token = List[3]
+
+ if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo):
+ (TokenGuid, TokenName) = GetSplitValueList(List[0], TAB_SPLIT)
+
+ return (TokenName, TokenGuid, Value, MaximumDatumSize, Token, Type)
+
+## Get FeatureFlagPcd
+#
+# Get FeatureFlagPcd of Dsc as <PcdTokenSpaceGuidCName>.<TokenCName>|TRUE/FALSE
+#
+# @param Item: String as <PcdTokenSpaceGuidCName>.<TokenCName>|TRUE/FALSE
+# @param ContainerFile: The file which describes the pcd, used for error report
+#
+# @retval (TokenInfo[1], TokenInfo[0], List[1], Type)
+#
+def GetFeatureFlagPcd(Item, Type, ContainerFile, LineNo = -1):
+ TokenGuid, TokenName, Value = '', '', ''
+ List = GetSplitValueList(Item)
+ if len(List) != 2:
+ RaiseParserError(Item, 'Pcds' + Type, ContainerFile, '<PcdTokenSpaceGuidCName>.<TokenCName>|TRUE/FALSE', LineNo)
+ else:
+ Value = List[1]
+ if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo):
+ (TokenGuid, TokenName) = GetSplitValueList(List[0], DataType.TAB_SPLIT)
+
+ return (TokenName, TokenGuid, Value, Type)
+
+## Get DynamicDefaultPcd
+#
+# Get DynamicDefaultPcd of Dsc as <PcdTokenSpaceGuidCName>.<TokenCName>|<Value>[|<DatumTyp>[|<MaxDatumSize>]]
+#
+# @param Item: String as <PcdTokenSpaceGuidCName>.<TokenCName>|TRUE/FALSE
+# @param ContainerFile: The file which describes the pcd, used for error report
+#
+# @retval (TokenInfo[1], TokenInfo[0], List[1], List[2], List[3], Type)
+#
+def GetDynamicDefaultPcd(Item, Type, ContainerFile, LineNo = -1):
+ TokenGuid, TokenName, Value, DatumTyp, MaxDatumSize = '', '', '', '', ''
+ List = GetSplitValueList(Item + TAB_VALUE_SPLIT * 2)
+ if len(List) < 4 or len(List) > 8:
+ RaiseParserError(Item, 'Pcds' + Type, ContainerFile, '<PcdTokenSpaceGuidCName>.<TokenCName>|<Value>[|<DatumTyp>[|<MaxDatumSize>]]', LineNo)
+ else:
+ Value = List[1]
+ DatumTyp = List[2]
+ MaxDatumSize = List[3]
+ if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo):
+ (TokenGuid, TokenName) = GetSplitValueList(List[0], TAB_SPLIT)
+
+ return (TokenName, TokenGuid, Value, DatumTyp, MaxDatumSize, Type)
+
+## Get DynamicHiiPcd
+#
+# Get DynamicHiiPcd of Dsc as <PcdTokenSpaceGuidCName>.<TokenCName>|<String>|<VariableGuidCName>|<VariableOffset>[|<DefaultValue>[|<MaximumDatumSize>]]
+#
+# @param Item: String as <PcdTokenSpaceGuidCName>.<TokenCName>|TRUE/FALSE
+# @param ContainerFile: The file which describes the pcd, used for error report
+#
+# @retval (TokenInfo[1], TokenInfo[0], List[1], List[2], List[3], List[4], List[5], Type)
+#
+def GetDynamicHiiPcd(Item, Type, ContainerFile, LineNo = -1):
+ TokenGuid, TokenName, L1, L2, L3, L4, L5 = '', '', '', '', '', '', ''
+ List = GetSplitValueList(Item + TAB_VALUE_SPLIT * 2)
+ if len(List) < 6 or len(List) > 8:
+ RaiseParserError(Item, 'Pcds' + Type, ContainerFile, '<PcdTokenSpaceGuidCName>.<TokenCName>|<String>|<VariableGuidCName>|<VariableOffset>[|<DefaultValue>[|<MaximumDatumSize>]]', LineNo)
+ else:
+ L1, L2, L3, L4, L5 = List[1], List[2], List[3], List[4], List[5]
+ if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo):
+ (TokenGuid, TokenName) = GetSplitValueList(List[0], DataType.TAB_SPLIT)
+
+ return (TokenName, TokenGuid, L1, L2, L3, L4, L5, Type)
+
+## Get DynamicVpdPcd
+#
+# Get DynamicVpdPcd of Dsc as <PcdTokenSpaceGuidCName>.<TokenCName>|<VpdOffset>[|<MaximumDatumSize>]
+#
+# @param Item: String as <PcdTokenSpaceGuidCName>.<TokenCName>|TRUE/FALSE
+# @param ContainerFile: The file which describes the pcd, used for error report
+#
+# @retval (TokenInfo[1], TokenInfo[0], List[1], List[2], Type)
+#
+def GetDynamicVpdPcd(Item, Type, ContainerFile, LineNo = -1):
+ TokenGuid, TokenName, L1, L2 = '', '', '', ''
+ List = GetSplitValueList(Item + TAB_VALUE_SPLIT)
+ if len(List) < 3 or len(List) > 4:
+ RaiseParserError(Item, 'Pcds' + Type, ContainerFile, '<PcdTokenSpaceGuidCName>.<TokenCName>|<VpdOffset>[|<MaximumDatumSize>]', LineNo)
+ else:
+ L1, L2 = List[1], List[2]
+ if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo):
+ (TokenGuid, TokenName) = GetSplitValueList(List[0], DataType.TAB_SPLIT)
+
+ return (TokenName, TokenGuid, L1, L2, Type)
+
+## GetComponent
+#
+# Parse block of the components defined in dsc file
+# Set KeyValues as [ ['component name', [lib1, lib2, lib3], [bo1, bo2, bo3], [pcd1, pcd2, pcd3]], ...]
+#
+# @param Lines: The content to be parsed
+# @param KeyValues: To store data after parsing
+#
+# @retval True Get component successfully
+#
+def GetComponent(Lines, KeyValues):
+ (findBlock, findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, False, False, False, False)
+ ListItem = None
+ LibraryClassItem = []
+ BuildOption = []
+ Pcd = []
+
+ for Line in Lines:
+ Line = Line[0]
+
+ #
+ # Ignore !include statement
+ #
+ if Line.upper().find(TAB_INCLUDE.upper() + ' ') > -1 or Line.upper().find(TAB_DEFINE + ' ') > -1:
+ continue
+
+ if findBlock == False:
+ ListItem = Line
+ #
+ # find '{' at line tail
+ #
+ if Line.endswith('{'):
+ findBlock = True
+ ListItem = CleanString(Line.rsplit('{', 1)[0], DataType.TAB_COMMENT_SPLIT)
+
+ #
+ # Parse a block content
+ #
+ if findBlock:
+ if Line.find('<LibraryClasses>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (True, False, False, False, False, False, False)
+ continue
+ if Line.find('<BuildOptions>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, True, False, False, False, False, False)
+ continue
+ if Line.find('<PcdsFeatureFlag>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, True, False, False, False, False)
+ continue
+ if Line.find('<PcdsPatchableInModule>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, True, False, False, False)
+ continue
+ if Line.find('<PcdsFixedAtBuild>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, True, False, False)
+ continue
+ if Line.find('<PcdsDynamic>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, False, True, False)
+ continue
+ if Line.find('<PcdsDynamicEx>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, False, False, True)
+ continue
+ if Line.endswith('}'):
+ #
+ # find '}' at line tail
+ #
+ KeyValues.append([ListItem, LibraryClassItem, BuildOption, Pcd])
+ (findBlock, findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, False, False, False, False)
+ LibraryClassItem, BuildOption, Pcd = [], [], []
+ continue
+
+ if findBlock:
+ if findLibraryClass:
+ LibraryClassItem.append(Line)
+ elif findBuildOption:
+ BuildOption.append(Line)
+ elif findPcdsFeatureFlag:
+ Pcd.append((DataType.TAB_PCDS_FEATURE_FLAG_NULL, Line))
+ elif findPcdsPatchableInModule:
+ Pcd.append((DataType.TAB_PCDS_PATCHABLE_IN_MODULE_NULL, Line))
+ elif findPcdsFixedAtBuild:
+ Pcd.append((DataType.TAB_PCDS_FIXED_AT_BUILD_NULL, Line))
+ elif findPcdsDynamic:
+ Pcd.append((DataType.TAB_PCDS_DYNAMIC_DEFAULT_NULL, Line))
+ elif findPcdsDynamicEx:
+ Pcd.append((DataType.TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL, Line))
+ else:
+ KeyValues.append([ListItem, [], [], []])
+
+ return True
+
+## GetExec
+#
+# Parse a string with format "InfFilename [EXEC = ExecFilename]"
+# Return (InfFilename, ExecFilename)
+#
+# @param String: String with EXEC statement
+#
+# @retval truple() A pair as (InfFilename, ExecFilename)
+#
+def GetExec(String):
+ InfFilename = ''
+ ExecFilename = ''
+ if String.find('EXEC') > -1:
+ InfFilename = String[ : String.find('EXEC')].strip()
+ ExecFilename = String[String.find('EXEC') + len('EXEC') : ].strip()
+ else:
+ InfFilename = String.strip()
+
+ return (InfFilename, ExecFilename)
+
+## GetComponents
+#
+# Parse block of the components defined in dsc file
+# Set KeyValues as [ ['component name', [lib1, lib2, lib3], [bo1, bo2, bo3], [pcd1, pcd2, pcd3]], ...]
+#
+# @param Lines: The content to be parsed
+# @param Key: Reserved
+# @param KeyValues: To store data after parsing
+# @param CommentCharacter: Comment char, used to ignore comment content
+#
+# @retval True Get component successfully
+#
+def GetComponents(Lines, Key, KeyValues, CommentCharacter):
+ if Lines.find(DataType.TAB_SECTION_END) > -1:
+ Lines = Lines.split(DataType.TAB_SECTION_END, 1)[1]
+ (findBlock, findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, False, False, False, False)
+ ListItem = None
+ LibraryClassItem = []
+ BuildOption = []
+ Pcd = []
+
+ LineList = Lines.split('\n')
+ for Line in LineList:
+ Line = CleanString(Line, CommentCharacter)
+ if Line is None or Line == '':
+ continue
+
+ if findBlock == False:
+ ListItem = Line
+ #
+ # find '{' at line tail
+ #
+ if Line.endswith('{'):
+ findBlock = True
+ ListItem = CleanString(Line.rsplit('{', 1)[0], CommentCharacter)
+
+ #
+ # Parse a block content
+ #
+ if findBlock:
+ if Line.find('<LibraryClasses>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (True, False, False, False, False, False, False)
+ continue
+ if Line.find('<BuildOptions>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, True, False, False, False, False, False)
+ continue
+ if Line.find('<PcdsFeatureFlag>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, True, False, False, False, False)
+ continue
+ if Line.find('<PcdsPatchableInModule>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, True, False, False, False)
+ continue
+ if Line.find('<PcdsFixedAtBuild>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, True, False, False)
+ continue
+ if Line.find('<PcdsDynamic>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, False, True, False)
+ continue
+ if Line.find('<PcdsDynamicEx>') != -1:
+ (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, False, False, True)
+ continue
+ if Line.endswith('}'):
+ #
+ # find '}' at line tail
+ #
+ KeyValues.append([ListItem, LibraryClassItem, BuildOption, Pcd])
+ (findBlock, findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, False, False, False, False)
+ LibraryClassItem, BuildOption, Pcd = [], [], []
+ continue
+
+ if findBlock:
+ if findLibraryClass:
+ LibraryClassItem.append(Line)
+ elif findBuildOption:
+ BuildOption.append(Line)
+ elif findPcdsFeatureFlag:
+ Pcd.append((DataType.TAB_PCDS_FEATURE_FLAG, Line))
+ elif findPcdsPatchableInModule:
+ Pcd.append((DataType.TAB_PCDS_PATCHABLE_IN_MODULE, Line))
+ elif findPcdsFixedAtBuild:
+ Pcd.append((DataType.TAB_PCDS_FIXED_AT_BUILD, Line))
+ elif findPcdsDynamic:
+ Pcd.append((DataType.TAB_PCDS_DYNAMIC, Line))
+ elif findPcdsDynamicEx:
+ Pcd.append((DataType.TAB_PCDS_DYNAMIC_EX, Line))
+ else:
+ KeyValues.append([ListItem, [], [], []])
+
+ return True
+
+## Get Source
+#
+# Get Source of Inf as <Filename>[|<Family>[|<TagName>[|<ToolCode>[|<PcdFeatureFlag>]]]]
+#
+# @param Item: String as <Filename>[|<Family>[|<TagName>[|<ToolCode>[|<PcdFeatureFlag>]]]]
+# @param ContainerFile: The file which describes the library class, used for error report
+#
+# @retval (List[0], List[1], List[2], List[3], List[4])
+#
+def GetSource(Item, ContainerFile, FileRelativePath, LineNo = -1):
+ ItemNew = Item + DataType.TAB_VALUE_SPLIT * 4
+ List = GetSplitValueList(ItemNew)
+ if len(List) < 5 or len(List) > 9:
+ RaiseParserError(Item, 'Sources', ContainerFile, '<Filename>[|<Family>[|<TagName>[|<ToolCode>[|<PcdFeatureFlag>]]]]', LineNo)
+ List[0] = NormPath(List[0])
+ CheckFileExist(FileRelativePath, List[0], ContainerFile, 'Sources', Item, LineNo)
+ if List[4] != '':
+ CheckPcdTokenInfo(List[4], 'Sources', ContainerFile, LineNo)
+
+ return (List[0], List[1], List[2], List[3], List[4])
+
+## Get Binary
+#
+# Get Binary of Inf as <Filename>[|<Family>[|<TagName>[|<ToolCode>[|<PcdFeatureFlag>]]]]
+#
+# @param Item: String as <Filename>[|<Family>[|<TagName>[|<ToolCode>[|<PcdFeatureFlag>]]]]
+# @param ContainerFile: The file which describes the library class, used for error report
+#
+# @retval (List[0], List[1], List[2], List[3])
+# @retval List
+#
+def GetBinary(Item, ContainerFile, FileRelativePath, LineNo = -1):
+ ItemNew = Item + DataType.TAB_VALUE_SPLIT
+ List = GetSplitValueList(ItemNew)
+ if len(List) != 4 and len(List) != 5:
+ RaiseParserError(Item, 'Binaries', ContainerFile, "<FileType>|<Filename>|<Target>[|<TokenSpaceGuidCName>.<PcdCName>]", LineNo)
+ else:
+ if List[3] != '':
+ CheckPcdTokenInfo(List[3], 'Binaries', ContainerFile, LineNo)
+
+ if len(List) == 4:
+ return (List[0], List[1], List[2], List[3])
+ elif len(List) == 3:
+ return (List[0], List[1], List[2], '')
+ elif len(List) == 2:
+ return (List[0], List[1], '', '')
+ elif len(List) == 1:
+ return (List[0], '', '', '')
+
+## Get Guids/Protocols/Ppis
+#
+# Get Guids/Protocols/Ppis of Inf as <GuidCName>[|<PcdFeatureFlag>]
+#
+# @param Item: String as <GuidCName>[|<PcdFeatureFlag>]
+# @param Type: Type of parsing string
+# @param ContainerFile: The file which describes the library class, used for error report
+#
+# @retval (List[0], List[1])
+#
+def GetGuidsProtocolsPpisOfInf(Item, Type, ContainerFile, LineNo = -1):
+ ItemNew = Item + TAB_VALUE_SPLIT
+ List = GetSplitValueList(ItemNew)
+ if List[1] != '':
+ CheckPcdTokenInfo(List[1], Type, ContainerFile, LineNo)
+
+ return (List[0], List[1])
+
+## Get Guids/Protocols/Ppis
+#
+# Get Guids/Protocols/Ppis of Dec as <GuidCName>=<GuidValue>
+#
+# @param Item: String as <GuidCName>=<GuidValue>
+# @param Type: Type of parsing string
+# @param ContainerFile: The file which describes the library class, used for error report
+#
+# @retval (List[0], List[1])
+#
+def GetGuidsProtocolsPpisOfDec(Item, Type, ContainerFile, LineNo = -1):
+ List = GetSplitValueList(Item, DataType.TAB_EQUAL_SPLIT)
+ if len(List) != 2:
+ RaiseParserError(Item, Type, ContainerFile, '<CName>=<GuidValue>', LineNo)
+
+ return (List[0], List[1])
+
+## GetPackage
+#
+# Get Package of Inf as <PackagePath>[|<PcdFeatureFlag>]
+#
+# @param Item: String as <PackagePath>[|<PcdFeatureFlag>]
+# @param Type: Type of parsing string
+# @param ContainerFile: The file which describes the library class, used for error report
+#
+# @retval (List[0], List[1])
+#
+def GetPackage(Item, ContainerFile, FileRelativePath, LineNo = -1):
+ ItemNew = Item + TAB_VALUE_SPLIT
+ List = GetSplitValueList(ItemNew)
+ CheckFileType(List[0], '.Dec', ContainerFile, 'package', List[0], LineNo)
+ CheckFileExist(FileRelativePath, List[0], ContainerFile, 'Packages', List[0], LineNo)
+
+ if List[1] != '':
+ CheckPcdTokenInfo(List[1], 'Packages', ContainerFile, LineNo)
+
+ return (List[0], List[1])
+
+## Get Pcd Values of Inf
+#
+# Get Pcd of Inf as <TokenSpaceGuidCName>.<PcdCName>[|<Value>]
+#
+# @param Item: The string describes pcd
+# @param Type: The type of Pcd
+# @param File: The file which describes the pcd, used for error report
+#
+# @retval (TokenSpcCName, TokenCName, Value, ItemType) Formatted Pcd Item
+#
+def GetPcdOfInf(Item, Type, File, LineNo):
+ Format = '<TokenSpaceGuidCName>.<PcdCName>[|<Value>]'
+ TokenGuid, TokenName, Value, InfType = '', '', '', ''
+
+ if Type == TAB_PCDS_FIXED_AT_BUILD:
+ InfType = TAB_INF_FIXED_PCD
+ elif Type == TAB_PCDS_PATCHABLE_IN_MODULE:
+ InfType = TAB_INF_PATCH_PCD
+ elif Type == TAB_PCDS_FEATURE_FLAG:
+ InfType = TAB_INF_FEATURE_PCD
+ elif Type == TAB_PCDS_DYNAMIC_EX:
+ InfType = TAB_INF_PCD_EX
+ elif Type == TAB_PCDS_DYNAMIC:
+ InfType = TAB_INF_PCD
+ List = GetSplitValueList(Item + DataType.TAB_VALUE_SPLIT)
+ if len(List) < 2 or len(List) > 3:
+ RaiseParserError(Item, InfType, File, Format, LineNo)
+ else:
+ Value = List[1]
+ TokenInfo = GetSplitValueList(List[0], DataType.TAB_SPLIT)
+ if len(TokenInfo) != 2:
+ RaiseParserError(Item, InfType, File, Format, LineNo)
+ else:
+ TokenGuid = TokenInfo[0]
+ TokenName = TokenInfo[1]
+
+ return (TokenGuid, TokenName, Value, Type)
+
+
+## Get Pcd Values of Dec
+#
+# Get Pcd of Dec as <TokenSpcCName>.<TokenCName>|<Value>|<DatumType>|<Token>
+# @retval (TokenSpcCName, TokenCName, Value, DatumType, Token, ItemType) Formatted Pcd Item
+#
+def GetPcdOfDec(Item, Type, File, LineNo = -1):
+ Format = '<TokenSpaceGuidCName>.<PcdCName>|<Value>|<DatumType>|<Token>'
+ TokenGuid, TokenName, Value, DatumType, Token = '', '', '', '', ''
+ List = GetSplitValueList(Item)
+ if len(List) != 4:
+ RaiseParserError(Item, 'Pcds' + Type, File, Format, LineNo)
+ else:
+ Value = List[1]
+ DatumType = List[2]
+ Token = List[3]
+ TokenInfo = GetSplitValueList(List[0], DataType.TAB_SPLIT)
+ if len(TokenInfo) != 2:
+ RaiseParserError(Item, 'Pcds' + Type, File, Format, LineNo)
+ else:
+ TokenGuid = TokenInfo[0]
+ TokenName = TokenInfo[1]
+
+ return (TokenGuid, TokenName, Value, DatumType, Token, Type)
+
+## Parse DEFINE statement
+#
+# Get DEFINE macros
+#
+# 1. Insert a record into TblDec
+# Value1: Macro Name
+# Value2: Macro Value
+#
+def ParseDefine(LineValue, StartLine, Table, FileID, Filename, SectionName, SectionModel, Arch):
+ EdkLogger.debug(EdkLogger.DEBUG_2, "DEFINE statement '%s' found in section %s" % (LineValue, SectionName))
+ Define = GetSplitValueList(CleanString(LineValue[LineValue.upper().find(DataType.TAB_DEFINE.upper() + ' ') + len(DataType.TAB_DEFINE + ' ') : ]), TAB_EQUAL_SPLIT, 1)
+ Table.Insert(MODEL_META_DATA_DEFINE, Define[0], Define[1], '', '', '', Arch, SectionModel, FileID, StartLine, -1, StartLine, -1, 0)
+
+## InsertSectionItems
+#
+# Insert item data of a section to a dict
+#
+def InsertSectionItems(Model, CurrentSection, SectionItemList, ArchList, ThirdList, RecordSet):
+ # Insert each item data of a section
+ for Index in range(0, len(ArchList)):
+ Arch = ArchList[Index]
+ Third = ThirdList[Index]
+ if Arch == '':
+ Arch = TAB_ARCH_COMMON
+
+ Records = RecordSet[Model]
+ for SectionItem in SectionItemList:
+ BelongsToItem, EndLine, EndColumn = -1, -1, -1
+ LineValue, StartLine, EndLine, Comment = SectionItem[0], SectionItem[1], SectionItem[1], SectionItem[2]
+
+ EdkLogger.debug(4, "Parsing %s ..." %LineValue)
+ # And then parse DEFINE statement
+ if LineValue.upper().find(DataType.TAB_DEFINE.upper() + ' ') > -1:
+ continue
+
+ # At last parse other sections
+ ID = -1
+ Records.append([LineValue, Arch, StartLine, ID, Third, Comment])
+
+ if RecordSet != {}:
+ RecordSet[Model] = Records
+
+## Insert records to database
+#
+# Insert item data of a section to database
+# @param Table: The Table to be inserted
+# @param FileID: The ID of belonging file
+# @param Filename: The name of belonging file
+# @param CurrentSection: The name of current section
+# @param SectionItemList: A list of items of the section
+# @param ArchList: A list of arches
+# @param ThirdList: A list of third parameters, ModuleType for LibraryClass and SkuId for Dynamic Pcds
+# @param IfDefList: A list of all conditional statements
+# @param RecordSet: A dict of all parsed records
+#
+def InsertSectionItemsIntoDatabase(Table, FileID, Filename, Model, CurrentSection, SectionItemList, ArchList, ThirdList, IfDefList, RecordSet):
+ #
+ # Insert each item data of a section
+ #
+ for Index in range(0, len(ArchList)):
+ Arch = ArchList[Index]
+ Third = ThirdList[Index]
+ if Arch == '':
+ Arch = TAB_ARCH_COMMON
+
+ Records = RecordSet[Model]
+ for SectionItem in SectionItemList:
+ BelongsToItem, EndLine, EndColumn = -1, -1, -1
+ LineValue, StartLine, EndLine = SectionItem[0], SectionItem[1], SectionItem[1]
+
+ EdkLogger.debug(4, "Parsing %s ..." %LineValue)
+ #
+ # And then parse DEFINE statement
+ #
+ if LineValue.upper().find(DataType.TAB_DEFINE.upper() + ' ') > -1:
+ ParseDefine(LineValue, StartLine, Table, FileID, Filename, CurrentSection, Model, Arch)
+ continue
+
+ #
+ # At last parse other sections
+ #
+ ID = Table.Insert(Model, LineValue, Third, Third, '', '', Arch, -1, FileID, StartLine, -1, StartLine, -1, 0)
+ Records.append([LineValue, Arch, StartLine, ID, Third])
+
+ if RecordSet != {}:
+ RecordSet[Model] = Records
+
+## GenMetaDatSectionItem
+def GenMetaDatSectionItem(Key, Value, List):
+ if Key not in List:
+ List[Key] = [Value]
+ else:
+ List[Key].append(Value)
+
+## IsValidWord
+#
+# Check whether the word is valid.
+# <Word> ::= (a-zA-Z0-9_)(a-zA-Z0-9_-){0,} Alphanumeric characters with
+# optional
+# dash "-" and/or underscore "_" characters. No whitespace
+# characters are permitted.
+#
+# @param Word: The word string need to be checked.
+#
+def IsValidWord(Word):
+ if not Word:
+ return False
+ #
+ # The first char should be alpha, _ or Digit.
+ #
+ if not Word[0].isalnum() and \
+ not Word[0] == '_' and \
+ not Word[0].isdigit():
+ return False
+
+ LastChar = ''
+ for Char in Word[1:]:
+ if (not Char.isalpha()) and \
+ (not Char.isdigit()) and \
+ Char != '-' and \
+ Char != '_' and \
+ Char != '.':
+ return False
+ if Char == '.' and LastChar == '.':
+ return False
+ LastChar = Char
+
+ return True
diff --git a/roms/edk2/BaseTools/Source/Python/Common/RangeExpression.py b/roms/edk2/BaseTools/Source/Python/Common/RangeExpression.py
new file mode 100644
index 000000000..039d28146
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/RangeExpression.py
@@ -0,0 +1,694 @@
+# # @file
+# This file is used to parse and evaluate range expression in Pcd declaration.
+#
+# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+# # Import Modules
+#
+from __future__ import print_function
+from Common.GlobalData import *
+from CommonDataClass.Exceptions import BadExpression
+from CommonDataClass.Exceptions import WrnExpression
+import uuid
+from Common.Expression import PcdPattern, BaseExpression
+from Common.DataType import *
+from re import compile
+
+ERR_STRING_EXPR = 'This operator cannot be used in string expression: [%s].'
+ERR_SNYTAX = 'Syntax error, the rest of expression cannot be evaluated: [%s].'
+ERR_MATCH = 'No matching right parenthesis.'
+ERR_STRING_TOKEN = 'Bad string token: [%s].'
+ERR_MACRO_TOKEN = 'Bad macro token: [%s].'
+ERR_EMPTY_TOKEN = 'Empty token is not allowed.'
+ERR_PCD_RESOLVE = 'The PCD should be FeatureFlag type or FixedAtBuild type: [%s].'
+ERR_VALID_TOKEN = 'No more valid token found from rest of string: [%s].'
+ERR_EXPR_TYPE = 'Different types found in expression.'
+ERR_OPERATOR_UNSUPPORT = 'Unsupported operator: [%s]'
+ERR_REL_NOT_IN = 'Expect "IN" after "not" operator.'
+WRN_BOOL_EXPR = 'Operand of boolean type cannot be used in arithmetic expression.'
+WRN_EQCMP_STR_OTHERS = '== Comparison between Operand of string type and Boolean/Number Type always return False.'
+WRN_NECMP_STR_OTHERS = '!= Comparison between Operand of string type and Boolean/Number Type always return True.'
+ERR_RELCMP_STR_OTHERS = 'Operator taking Operand of string type and Boolean/Number Type is not allowed: [%s].'
+ERR_STRING_CMP = 'Unicode string and general string cannot be compared: [%s %s %s]'
+ERR_ARRAY_TOKEN = 'Bad C array or C format GUID token: [%s].'
+ERR_ARRAY_ELE = 'This must be HEX value for NList or Array: [%s].'
+ERR_EMPTY_EXPR = 'Empty expression is not allowed.'
+ERR_IN_OPERAND = 'Macro after IN operator can only be: $(FAMILY), $(ARCH), $(TOOL_CHAIN_TAG) and $(TARGET).'
+
+class RangeObject(object):
+ def __init__(self, start, end, empty = False):
+
+ if int(start) < int(end):
+ self.start = int(start)
+ self.end = int(end)
+ else:
+ self.start = int(end)
+ self.end = int(start)
+ self.empty = empty
+
+class RangeContainer(object):
+ def __init__(self):
+ self.rangelist = []
+
+ def push(self, RangeObject):
+ self.rangelist.append(RangeObject)
+ self.rangelist = sorted(self.rangelist, key = lambda rangeobj : rangeobj.start)
+ self.merge()
+
+ def pop(self):
+ for item in self.rangelist:
+ yield item
+
+ def __clean__(self):
+ newrangelist = []
+ for rangeobj in self.rangelist:
+ if rangeobj.empty == True:
+ continue
+ else:
+ newrangelist.append(rangeobj)
+ self.rangelist = newrangelist
+ def merge(self):
+ self.__clean__()
+ for i in range(0, len(self.rangelist) - 1):
+ if self.rangelist[i + 1].start > self.rangelist[i].end:
+ continue
+ else:
+ self.rangelist[i + 1].start = self.rangelist[i].start
+ self.rangelist[i + 1].end = self.rangelist[i + 1].end > self.rangelist[i].end and self.rangelist[i + 1].end or self.rangelist[i].end
+ self.rangelist[i].empty = True
+
+ self.__clean__()
+
+ def dump(self):
+ print("----------------------")
+ rangelist = ""
+ for object in self.rangelist:
+ rangelist = rangelist + "[%d , %d]" % (object.start, object.end)
+ print(rangelist)
+
+
+class XOROperatorObject(object):
+ def __init__(self):
+ pass
+ def Calculate(self, Operand, DataType, SymbolTable):
+ if isinstance(Operand, type('')) and not Operand.isalnum():
+ Expr = "XOR ..."
+ raise BadExpression(ERR_SNYTAX % Expr)
+ rangeId = str(uuid.uuid1())
+ rangeContainer = RangeContainer()
+ rangeContainer.push(RangeObject(0, int(Operand) - 1))
+ rangeContainer.push(RangeObject(int(Operand) + 1, MAX_VAL_TYPE[DataType]))
+ SymbolTable[rangeId] = rangeContainer
+ return rangeId
+
+class LEOperatorObject(object):
+ def __init__(self):
+ pass
+ def Calculate(self, Operand, DataType, SymbolTable):
+ if isinstance(Operand, type('')) and not Operand.isalnum():
+ Expr = "LE ..."
+ raise BadExpression(ERR_SNYTAX % Expr)
+ rangeId1 = str(uuid.uuid1())
+ rangeContainer = RangeContainer()
+ rangeContainer.push(RangeObject(0, int(Operand)))
+ SymbolTable[rangeId1] = rangeContainer
+ return rangeId1
+class LTOperatorObject(object):
+ def __init__(self):
+ pass
+ def Calculate(self, Operand, DataType, SymbolTable):
+ if isinstance(Operand, type('')) and not Operand.isalnum():
+ Expr = "LT ..."
+ raise BadExpression(ERR_SNYTAX % Expr)
+ rangeId1 = str(uuid.uuid1())
+ rangeContainer = RangeContainer()
+ rangeContainer.push(RangeObject(0, int(Operand) - 1))
+ SymbolTable[rangeId1] = rangeContainer
+ return rangeId1
+
+class GEOperatorObject(object):
+ def __init__(self):
+ pass
+ def Calculate(self, Operand, DataType, SymbolTable):
+ if isinstance(Operand, type('')) and not Operand.isalnum():
+ Expr = "GE ..."
+ raise BadExpression(ERR_SNYTAX % Expr)
+ rangeId1 = str(uuid.uuid1())
+ rangeContainer = RangeContainer()
+ rangeContainer.push(RangeObject(int(Operand), MAX_VAL_TYPE[DataType]))
+ SymbolTable[rangeId1] = rangeContainer
+ return rangeId1
+
+class GTOperatorObject(object):
+ def __init__(self):
+ pass
+ def Calculate(self, Operand, DataType, SymbolTable):
+ if isinstance(Operand, type('')) and not Operand.isalnum():
+ Expr = "GT ..."
+ raise BadExpression(ERR_SNYTAX % Expr)
+ rangeId1 = str(uuid.uuid1())
+ rangeContainer = RangeContainer()
+ rangeContainer.push(RangeObject(int(Operand) + 1, MAX_VAL_TYPE[DataType]))
+ SymbolTable[rangeId1] = rangeContainer
+ return rangeId1
+
+class EQOperatorObject(object):
+ def __init__(self):
+ pass
+ def Calculate(self, Operand, DataType, SymbolTable):
+ if isinstance(Operand, type('')) and not Operand.isalnum():
+ Expr = "EQ ..."
+ raise BadExpression(ERR_SNYTAX % Expr)
+ rangeId1 = str(uuid.uuid1())
+ rangeContainer = RangeContainer()
+ rangeContainer.push(RangeObject(int(Operand), int(Operand)))
+ SymbolTable[rangeId1] = rangeContainer
+ return rangeId1
+
+def GetOperatorObject(Operator):
+ if Operator == '>':
+ return GTOperatorObject()
+ elif Operator == '>=':
+ return GEOperatorObject()
+ elif Operator == '<':
+ return LTOperatorObject()
+ elif Operator == '<=':
+ return LEOperatorObject()
+ elif Operator == '==':
+ return EQOperatorObject()
+ elif Operator == '^':
+ return XOROperatorObject()
+ else:
+ raise BadExpression("Bad Operator")
+
+class RangeExpression(BaseExpression):
+ # Logical operator mapping
+ LogicalOperators = {
+ '&&' : 'and', '||' : 'or',
+ '!' : 'not', 'AND': 'and',
+ 'OR' : 'or' , 'NOT': 'not',
+ 'XOR': '^' , 'xor': '^',
+ 'EQ' : '==' , 'NE' : '!=',
+ 'GT' : '>' , 'LT' : '<',
+ 'GE' : '>=' , 'LE' : '<=',
+ 'IN' : 'in'
+ }
+
+ NonLetterOpLst = ['+', '-', '&', '|', '^', '!', '=', '>', '<']
+
+ RangePattern = compile(r'[0-9]+ - [0-9]+')
+
+ def preProcessRangeExpr(self, expr):
+ # convert hex to int
+ # convert interval to object index. ex. 1 - 10 to a GUID
+ expr = expr.strip()
+ NumberDict = {}
+ for HexNumber in gHexPattern.findall(expr):
+ Number = str(int(HexNumber, 16))
+ NumberDict[HexNumber] = Number
+ for HexNum in NumberDict:
+ expr = expr.replace(HexNum, NumberDict[HexNum])
+
+ rangedict = {}
+ for validrange in self.RangePattern.findall(expr):
+ start, end = validrange.split(" - ")
+ start = start.strip()
+ end = end.strip()
+ rangeid = str(uuid.uuid1())
+ rangeContainer = RangeContainer()
+ rangeContainer.push(RangeObject(start, end))
+ self.operanddict[str(rangeid)] = rangeContainer
+ rangedict[validrange] = str(rangeid)
+
+ for validrange in rangedict:
+ expr = expr.replace(validrange, rangedict[validrange])
+
+ self._Expr = expr
+ return expr
+
+
+ def EvalRange(self, Operator, Oprand):
+
+ operatorobj = GetOperatorObject(Operator)
+ return operatorobj.Calculate(Oprand, self.PcdDataType, self.operanddict)
+
+ def Rangeintersection(self, Oprand1, Oprand2):
+ rangeContainer1 = self.operanddict[Oprand1]
+ rangeContainer2 = self.operanddict[Oprand2]
+ rangeContainer = RangeContainer()
+ for range1 in rangeContainer1.pop():
+ for range2 in rangeContainer2.pop():
+ start1 = range1.start
+ end1 = range1.end
+ start2 = range2.start
+ end2 = range2.end
+ if start1 >= start2:
+ start1, start2 = start2, start1
+ end1, end2 = end2, end1
+ if range1.empty:
+ rangeid = str(uuid.uuid1())
+ rangeContainer.push(RangeObject(0, 0, True))
+ if end1 < start2:
+ rangeid = str(uuid.uuid1())
+ rangeContainer.push(RangeObject(0, 0, True))
+ elif end1 == start2:
+ rangeid = str(uuid.uuid1())
+ rangeContainer.push(RangeObject(end1, end1))
+ elif end1 <= end2 and end1 > start2:
+ rangeid = str(uuid.uuid1())
+ rangeContainer.push(RangeObject(start2, end1))
+ elif end1 >= end2:
+ rangeid = str(uuid.uuid1())
+ rangeContainer.push(RangeObject(start2, end2))
+
+ self.operanddict[rangeid] = rangeContainer
+# rangeContainer.dump()
+ return rangeid
+
+ def Rangecollections(self, Oprand1, Oprand2):
+
+ rangeContainer1 = self.operanddict[Oprand1]
+ rangeContainer2 = self.operanddict[Oprand2]
+ rangeContainer = RangeContainer()
+
+ for rangeobj in rangeContainer2.pop():
+ rangeContainer.push(rangeobj)
+ for rangeobj in rangeContainer1.pop():
+ rangeContainer.push(rangeobj)
+
+ rangeid = str(uuid.uuid1())
+ self.operanddict[rangeid] = rangeContainer
+
+# rangeContainer.dump()
+ return rangeid
+
+
+ def NegativeRange(self, Oprand1):
+ rangeContainer1 = self.operanddict[Oprand1]
+
+
+ rangeids = []
+
+ for rangeobj in rangeContainer1.pop():
+ rangeContainer = RangeContainer()
+ rangeid = str(uuid.uuid1())
+ if rangeobj.empty:
+ rangeContainer.push(RangeObject(0, MAX_VAL_TYPE[self.PcdDataType]))
+ else:
+ if rangeobj.start > 0:
+ rangeContainer.push(RangeObject(0, rangeobj.start - 1))
+ if rangeobj.end < MAX_VAL_TYPE[self.PcdDataType]:
+ rangeContainer.push(RangeObject(rangeobj.end + 1, MAX_VAL_TYPE[self.PcdDataType]))
+ self.operanddict[rangeid] = rangeContainer
+ rangeids.append(rangeid)
+
+ if len(rangeids) == 0:
+ rangeContainer = RangeContainer()
+ rangeContainer.push(RangeObject(0, MAX_VAL_TYPE[self.PcdDataType]))
+ rangeid = str(uuid.uuid1())
+ self.operanddict[rangeid] = rangeContainer
+ return rangeid
+
+ if len(rangeids) == 1:
+ return rangeids[0]
+
+ re = self.Rangeintersection(rangeids[0], rangeids[1])
+ for i in range(2, len(rangeids)):
+ re = self.Rangeintersection(re, rangeids[i])
+
+ rangeid2 = str(uuid.uuid1())
+ self.operanddict[rangeid2] = self.operanddict[re]
+ return rangeid2
+
+ def Eval(self, Operator, Oprand1, Oprand2 = None):
+
+ if Operator in ["!", "NOT", "not"]:
+ if not gGuidPattern.match(Oprand1.strip()):
+ raise BadExpression(ERR_STRING_EXPR % Operator)
+ return self.NegativeRange(Oprand1)
+ else:
+ if Operator in ["==", ">=", "<=", ">", "<", '^']:
+ return self.EvalRange(Operator, Oprand1)
+ elif Operator == 'and' :
+ if not gGuidPatternEnd.match(Oprand1.strip()) or not gGuidPatternEnd.match(Oprand2.strip()):
+ raise BadExpression(ERR_STRING_EXPR % Operator)
+ return self.Rangeintersection(Oprand1, Oprand2)
+ elif Operator == 'or':
+ if not gGuidPatternEnd.match(Oprand1.strip()) or not gGuidPatternEnd.match(Oprand2.strip()):
+ raise BadExpression(ERR_STRING_EXPR % Operator)
+ return self.Rangecollections(Oprand1, Oprand2)
+ else:
+ raise BadExpression(ERR_STRING_EXPR % Operator)
+
+
+ def __init__(self, Expression, PcdDataType, SymbolTable = None):
+ if SymbolTable is None:
+ SymbolTable = {}
+ super(RangeExpression, self).__init__(self, Expression, PcdDataType, SymbolTable)
+ self._NoProcess = False
+ if not isinstance(Expression, type('')):
+ self._Expr = Expression
+ self._NoProcess = True
+ return
+
+ self._Expr = Expression.strip()
+
+ if not self._Expr.strip():
+ raise BadExpression(ERR_EMPTY_EXPR)
+
+ #
+ # The symbol table including PCD and macro mapping
+ #
+ self._Symb = SymbolTable
+ self._Symb.update(self.LogicalOperators)
+ self._Idx = 0
+ self._Len = len(self._Expr)
+ self._Token = ''
+ self._WarnExcept = None
+
+
+ # Literal token without any conversion
+ self._LiteralToken = ''
+
+ # store the operand object
+ self.operanddict = {}
+ # The Pcd max value depends on PcdDataType
+ self.PcdDataType = PcdDataType
+
+ # Public entry for this class
+ # @param RealValue: False: only evaluate if the expression is true or false, used for conditional expression
+ # True : return the evaluated str(value), used for PCD value
+ #
+ # @return: True or False if RealValue is False
+ # Evaluated value of string format if RealValue is True
+ #
+ def __call__(self, RealValue = False, Depth = 0):
+ if self._NoProcess:
+ return self._Expr
+
+ self._Depth = Depth
+
+ self._Expr = self._Expr.strip()
+
+ self.preProcessRangeExpr(self._Expr)
+
+ # check if the expression does not need to evaluate
+ if RealValue and Depth == 0:
+ self._Token = self._Expr
+ if gGuidPatternEnd.match(self._Expr):
+ return [self.operanddict[self._Expr] ]
+
+ self._Idx = 0
+ self._Token = ''
+
+ Val = self._OrExpr()
+ RealVal = Val
+
+ RangeIdList = RealVal.split("or")
+ RangeList = []
+ for rangeid in RangeIdList:
+ RangeList.append(self.operanddict[rangeid.strip()])
+
+ return RangeList
+
+ # Template function to parse binary operators which have same precedence
+ # Expr [Operator Expr]*
+ def _ExprFuncTemplate(self, EvalFunc, OpSet):
+ Val = EvalFunc()
+ while self._IsOperator(OpSet):
+ Op = self._Token
+ try:
+ Val = self.Eval(Op, Val, EvalFunc())
+ except WrnExpression as Warn:
+ self._WarnExcept = Warn
+ Val = Warn.result
+ return Val
+
+ # A [|| B]*
+ def _OrExpr(self):
+ return self._ExprFuncTemplate(self._AndExpr, {"OR", "or"})
+
+ # A [&& B]*
+ def _AndExpr(self):
+ return self._ExprFuncTemplate(self._NeExpr, {"AND", "and"})
+
+ def _NeExpr(self):
+ Val = self._RelExpr()
+ while self._IsOperator({"!=", "NOT", "not"}):
+ Op = self._Token
+ if Op in ["!", "NOT", "not"]:
+ if not self._IsOperator({"IN", "in"}):
+ raise BadExpression(ERR_REL_NOT_IN)
+ Op += ' ' + self._Token
+ try:
+ Val = self.Eval(Op, Val, self._RelExpr())
+ except WrnExpression as Warn:
+ self._WarnExcept = Warn
+ Val = Warn.result
+ return Val
+
+ # [!]*A
+ def _RelExpr(self):
+ if self._IsOperator({"NOT", "LE", "GE", "LT", "GT", "EQ", "XOR"}):
+ Token = self._Token
+ Val = self._NeExpr()
+ try:
+ return self.Eval(Token, Val)
+ except WrnExpression as Warn:
+ self._WarnExcept = Warn
+ return Warn.result
+ return self._IdenExpr()
+
+ # Parse identifier or encapsulated expression
+ def _IdenExpr(self):
+ Tk = self._GetToken()
+ if Tk == '(':
+ Val = self._OrExpr()
+ try:
+ # _GetToken may also raise BadExpression
+ if self._GetToken() != ')':
+ raise BadExpression(ERR_MATCH)
+ except BadExpression:
+ raise BadExpression(ERR_MATCH)
+ return Val
+ return Tk
+
+ # Skip whitespace or tab
+ def __SkipWS(self):
+ for Char in self._Expr[self._Idx:]:
+ if Char not in ' \t':
+ break
+ self._Idx += 1
+
+ # Try to convert string to number
+ def __IsNumberToken(self):
+ Radix = 10
+ if self._Token.lower()[0:2] == '0x' and len(self._Token) > 2:
+ Radix = 16
+ try:
+ self._Token = int(self._Token, Radix)
+ return True
+ except ValueError:
+ return False
+ except TypeError:
+ return False
+
+ # Parse array: {...}
+ def __GetArray(self):
+ Token = '{'
+ self._Idx += 1
+ self.__GetNList(True)
+ Token += self._LiteralToken
+ if self._Idx >= self._Len or self._Expr[self._Idx] != '}':
+ raise BadExpression(ERR_ARRAY_TOKEN % Token)
+ Token += '}'
+
+ # All whitespace and tabs in array are already stripped.
+ IsArray = IsGuid = False
+ if len(Token.split(',')) == 11 and len(Token.split(',{')) == 2 \
+ and len(Token.split('},')) == 1:
+ HexLen = [11, 6, 6, 5, 4, 4, 4, 4, 4, 4, 6]
+ HexList = Token.split(',')
+ if HexList[3].startswith('{') and \
+ not [Index for Index, Hex in enumerate(HexList) if len(Hex) > HexLen[Index]]:
+ IsGuid = True
+ if Token.lstrip('{').rstrip('}').find('{') == -1:
+ if not [Hex for Hex in Token.lstrip('{').rstrip('}').split(',') if len(Hex) > 4]:
+ IsArray = True
+ if not IsArray and not IsGuid:
+ raise BadExpression(ERR_ARRAY_TOKEN % Token)
+ self._Idx += 1
+ self._Token = self._LiteralToken = Token
+ return self._Token
+
+ # Parse string, the format must be: "..."
+ def __GetString(self):
+ Idx = self._Idx
+
+ # Skip left quote
+ self._Idx += 1
+
+ # Replace escape \\\", \"
+ Expr = self._Expr[self._Idx:].replace('\\\\', '//').replace('\\\"', '\\\'')
+ for Ch in Expr:
+ self._Idx += 1
+ if Ch == '"':
+ break
+ self._Token = self._LiteralToken = self._Expr[Idx:self._Idx]
+ if not self._Token.endswith('"'):
+ raise BadExpression(ERR_STRING_TOKEN % self._Token)
+ self._Token = self._Token[1:-1]
+ return self._Token
+
+ # Get token that is comprised by alphanumeric, underscore or dot(used by PCD)
+ # @param IsAlphaOp: Indicate if parsing general token or script operator(EQ, NE...)
+ def __GetIdToken(self, IsAlphaOp = False):
+ IdToken = ''
+ for Ch in self._Expr[self._Idx:]:
+ if not self.__IsIdChar(Ch):
+ break
+ self._Idx += 1
+ IdToken += Ch
+
+ self._Token = self._LiteralToken = IdToken
+ if not IsAlphaOp:
+ self.__ResolveToken()
+ return self._Token
+
+ # Try to resolve token
+ def __ResolveToken(self):
+ if not self._Token:
+ raise BadExpression(ERR_EMPTY_TOKEN)
+
+ # PCD token
+ if PcdPattern.match(self._Token):
+ if self._Token not in self._Symb:
+ Ex = BadExpression(ERR_PCD_RESOLVE % self._Token)
+ Ex.Pcd = self._Token
+ raise Ex
+ self._Token = RangeExpression(self._Symb[self._Token], self._Symb)(True, self._Depth + 1)
+ if not isinstance(self._Token, type('')):
+ self._LiteralToken = hex(self._Token)
+ return
+
+ if self._Token.startswith('"'):
+ self._Token = self._Token[1:-1]
+ elif self._Token in ["FALSE", "false", "False"]:
+ self._Token = False
+ elif self._Token in ["TRUE", "true", "True"]:
+ self._Token = True
+ else:
+ self.__IsNumberToken()
+
+ def __GetNList(self, InArray = False):
+ self._GetSingleToken()
+ if not self.__IsHexLiteral():
+ if InArray:
+ raise BadExpression(ERR_ARRAY_ELE % self._Token)
+ return self._Token
+
+ self.__SkipWS()
+ Expr = self._Expr[self._Idx:]
+ if not Expr.startswith(','):
+ return self._Token
+
+ NList = self._LiteralToken
+ while Expr.startswith(','):
+ NList += ','
+ self._Idx += 1
+ self.__SkipWS()
+ self._GetSingleToken()
+ if not self.__IsHexLiteral():
+ raise BadExpression(ERR_ARRAY_ELE % self._Token)
+ NList += self._LiteralToken
+ self.__SkipWS()
+ Expr = self._Expr[self._Idx:]
+ self._Token = self._LiteralToken = NList
+ return self._Token
+
+ def __IsHexLiteral(self):
+ if self._LiteralToken.startswith('{') and \
+ self._LiteralToken.endswith('}'):
+ return True
+
+ if gHexPattern.match(self._LiteralToken):
+ Token = self._LiteralToken[2:]
+ Token = Token.lstrip('0')
+ if not Token:
+ self._LiteralToken = '0x0'
+ else:
+ self._LiteralToken = '0x' + Token.lower()
+ return True
+ return False
+
+ def _GetToken(self):
+ return self.__GetNList()
+
+ @staticmethod
+ def __IsIdChar(Ch):
+ return Ch in '._/:' or Ch.isalnum()
+
+ # Parse operand
+ def _GetSingleToken(self):
+ self.__SkipWS()
+ Expr = self._Expr[self._Idx:]
+ if Expr.startswith('L"'):
+ # Skip L
+ self._Idx += 1
+ UStr = self.__GetString()
+ self._Token = 'L"' + UStr + '"'
+ return self._Token
+
+ self._Token = ''
+ if Expr:
+ Ch = Expr[0]
+ Match = gGuidPattern.match(Expr)
+ if Match and not Expr[Match.end():Match.end() + 1].isalnum() \
+ and Expr[Match.end():Match.end() + 1] != '_':
+ self._Idx += Match.end()
+ self._Token = Expr[0:Match.end()]
+ return self._Token
+ elif self.__IsIdChar(Ch):
+ return self.__GetIdToken()
+ elif Ch == '(' or Ch == ')':
+ self._Idx += 1
+ self._Token = Ch
+ return self._Token
+
+ raise BadExpression(ERR_VALID_TOKEN % Expr)
+
+ # Parse operator
+ def _GetOperator(self):
+ self.__SkipWS()
+ LegalOpLst = ['&&', '||', '!=', '==', '>=', '<='] + self.NonLetterOpLst
+
+ self._Token = ''
+ Expr = self._Expr[self._Idx:]
+
+ # Reach end of expression
+ if not Expr:
+ return ''
+
+ # Script operator: LT, GT, LE, GE, EQ, NE, and, or, xor, not
+ if Expr[0].isalpha():
+ return self.__GetIdToken(True)
+
+ # Start to get regular operator: +, -, <, > ...
+ if Expr[0] not in self.NonLetterOpLst:
+ return ''
+
+ OpToken = ''
+ for Ch in Expr:
+ if Ch in self.NonLetterOpLst:
+ if '!' == Ch and OpToken:
+ break
+ self._Idx += 1
+ OpToken += Ch
+ else:
+ break
+
+ if OpToken not in LegalOpLst:
+ raise BadExpression(ERR_OPERATOR_UNSUPPORT % OpToken)
+ self._Token = OpToken
+ return OpToken
diff --git a/roms/edk2/BaseTools/Source/Python/Common/StringUtils.py b/roms/edk2/BaseTools/Source/Python/Common/StringUtils.py
new file mode 100644
index 000000000..73dafa797
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/StringUtils.py
@@ -0,0 +1,873 @@
+## @file
+# This file is used to define common string related functions used in parsing process
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import re
+from . import DataType
+import Common.LongFilePathOs as os
+import string
+from . import EdkLogger as EdkLogger
+
+from . import GlobalData
+from .BuildToolError import *
+from CommonDataClass.Exceptions import *
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+
+gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$', re.IGNORECASE)
+gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
+
+## GetSplitValueList
+#
+# Get a value list from a string with multiple values split with SplitTag
+# The default SplitTag is DataType.TAB_VALUE_SPLIT
+# 'AAA|BBB|CCC' -> ['AAA', 'BBB', 'CCC']
+#
+# @param String: The input string to be splitted
+# @param SplitTag: The split key, default is DataType.TAB_VALUE_SPLIT
+# @param MaxSplit: The max number of split values, default is -1
+#
+# @retval list() A list for splitted string
+#
+def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
+ ValueList = []
+ Last = 0
+ Escaped = False
+ InSingleQuoteString = False
+ InDoubleQuoteString = False
+ InParenthesis = 0
+ for Index in range(0, len(String)):
+ Char = String[Index]
+
+ if not Escaped:
+ # Found a splitter not in a string, split it
+ if (not InSingleQuoteString or not InDoubleQuoteString) and InParenthesis == 0 and Char == SplitTag:
+ ValueList.append(String[Last:Index].strip())
+ Last = Index + 1
+ if MaxSplit > 0 and len(ValueList) >= MaxSplit:
+ break
+
+ if Char == '\\' and (InSingleQuoteString or InDoubleQuoteString):
+ Escaped = True
+ elif Char == '"' and not InSingleQuoteString:
+ if not InDoubleQuoteString:
+ InDoubleQuoteString = True
+ else:
+ InDoubleQuoteString = False
+ elif Char == "'" and not InDoubleQuoteString:
+ if not InSingleQuoteString:
+ InSingleQuoteString = True
+ else:
+ InSingleQuoteString = False
+ elif Char == '(':
+ InParenthesis = InParenthesis + 1
+ elif Char == ')':
+ InParenthesis = InParenthesis - 1
+ else:
+ Escaped = False
+
+ if Last < len(String):
+ ValueList.append(String[Last:].strip())
+ elif Last == len(String):
+ ValueList.append('')
+
+ return ValueList
+
+## GetSplitList
+#
+# Get a value list from a string with multiple values split with SplitString
+# The default SplitTag is DataType.TAB_VALUE_SPLIT
+# 'AAA|BBB|CCC' -> ['AAA', 'BBB', 'CCC']
+#
+# @param String: The input string to be splitted
+# @param SplitStr: The split key, default is DataType.TAB_VALUE_SPLIT
+# @param MaxSplit: The max number of split values, default is -1
+#
+# @retval list() A list for splitted string
+#
+def GetSplitList(String, SplitStr=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
+ return list(map(lambda l: l.strip(), String.split(SplitStr, MaxSplit)))
+
+## MergeArches
+#
+# Find a key's all arches in dict, add the new arch to the list
+# If not exist any arch, set the arch directly
+#
+# @param Dict: The input value for Dict
+# @param Key: The input value for Key
+# @param Arch: The Arch to be added or merged
+#
+def MergeArches(Dict, Key, Arch):
+ if Key in Dict:
+ Dict[Key].append(Arch)
+ else:
+ Dict[Key] = Arch.split()
+
+## GenDefines
+#
+# Parse a string with format "DEFINE <VarName> = <PATH>"
+# Generate a map Defines[VarName] = PATH
+# Return False if invalid format
+#
+# @param String: String with DEFINE statement
+# @param Arch: Supported Arch
+# @param Defines: DEFINE statement to be parsed
+#
+# @retval 0 DEFINE statement found, and valid
+# @retval 1 DEFINE statement found, but not valid
+# @retval -1 DEFINE statement not found
+#
+def GenDefines(String, Arch, Defines):
+ if String.find(DataType.TAB_DEFINE + ' ') > -1:
+ List = String.replace(DataType.TAB_DEFINE + ' ', '').split(DataType.TAB_EQUAL_SPLIT)
+ if len(List) == 2:
+ Defines[(CleanString(List[0]), Arch)] = CleanString(List[1])
+ return 0
+ else:
+ return -1
+
+ return 1
+
+## GenInclude
+#
+# Parse a string with format "!include <Filename>"
+# Return the file path
+# Return False if invalid format or NOT FOUND
+#
+# @param String: String with INCLUDE statement
+# @param IncludeFiles: INCLUDE statement to be parsed
+# @param Arch: Supported Arch
+#
+# @retval True
+# @retval False
+#
+def GenInclude(String, IncludeFiles, Arch):
+ if String.upper().find(DataType.TAB_INCLUDE.upper() + ' ') > -1:
+ IncludeFile = CleanString(String[String.upper().find(DataType.TAB_INCLUDE.upper() + ' ') + len(DataType.TAB_INCLUDE + ' ') : ])
+ MergeArches(IncludeFiles, IncludeFile, Arch)
+ return True
+ else:
+ return False
+
+## GetLibraryClassesWithModuleType
+#
+# Get Library Class definition when no module type defined
+#
+# @param Lines: The content to be parsed
+# @param Key: Reserved
+# @param KeyValues: To store data after parsing
+# @param CommentCharacter: Comment char, used to ignore comment content
+#
+# @retval True Get library classes successfully
+#
+def GetLibraryClassesWithModuleType(Lines, Key, KeyValues, CommentCharacter):
+ newKey = SplitModuleType(Key)
+ Lines = Lines.split(DataType.TAB_SECTION_END, 1)[1]
+ LineList = Lines.splitlines()
+ for Line in LineList:
+ Line = CleanString(Line, CommentCharacter)
+ if Line != '' and Line[0] != CommentCharacter:
+ KeyValues.append([CleanString(Line, CommentCharacter), newKey[1]])
+
+ return True
+
+## GetDynamics
+#
+# Get Dynamic Pcds
+#
+# @param Lines: The content to be parsed
+# @param Key: Reserved
+# @param KeyValues: To store data after parsing
+# @param CommentCharacter: Comment char, used to ignore comment content
+#
+# @retval True Get Dynamic Pcds successfully
+#
+def GetDynamics(Lines, Key, KeyValues, CommentCharacter):
+ #
+ # Get SkuId Name List
+ #
+ SkuIdNameList = SplitModuleType(Key)
+
+ Lines = Lines.split(DataType.TAB_SECTION_END, 1)[1]
+ LineList = Lines.splitlines()
+ for Line in LineList:
+ Line = CleanString(Line, CommentCharacter)
+ if Line != '' and Line[0] != CommentCharacter:
+ KeyValues.append([CleanString(Line, CommentCharacter), SkuIdNameList[1]])
+
+ return True
+
+## SplitModuleType
+#
+# Split ModuleType out of section defien to get key
+# [LibraryClass.Arch.ModuleType|ModuleType|ModuleType] -> [ 'LibraryClass.Arch', ['ModuleType', 'ModuleType', 'ModuleType'] ]
+#
+# @param Key: String to be parsed
+#
+# @retval ReturnValue A list for module types
+#
+def SplitModuleType(Key):
+ KeyList = Key.split(DataType.TAB_SPLIT)
+ #
+ # Fill in for arch
+ #
+ KeyList.append('')
+ #
+ # Fill in for moduletype
+ #
+ KeyList.append('')
+ ReturnValue = []
+ KeyValue = KeyList[0]
+ if KeyList[1] != '':
+ KeyValue = KeyValue + DataType.TAB_SPLIT + KeyList[1]
+ ReturnValue.append(KeyValue)
+ ReturnValue.append(GetSplitValueList(KeyList[2]))
+
+ return ReturnValue
+
+## Replace macro in strings list
+#
+# This method replace macros used in a given string list. The macros are
+# given in a dictionary.
+#
+# @param StringList StringList to be processed
+# @param MacroDefinitions The macro definitions in the form of dictionary
+# @param SelfReplacement To decide whether replace un-defined macro to ''
+#
+# @retval NewList A new string list whose macros are replaced
+#
+def ReplaceMacros(StringList, MacroDefinitions=None, SelfReplacement=False):
+ NewList = []
+ if MacroDefinitions is None:
+ MacroDefinitions = {}
+ for String in StringList:
+ if isinstance(String, type('')):
+ NewList.append(ReplaceMacro(String, MacroDefinitions, SelfReplacement))
+ else:
+ NewList.append(String)
+
+ return NewList
+
+## Replace macro in string
+#
+# This method replace macros used in given string. The macros are given in a
+# dictionary.
+#
+# @param String String to be processed
+# @param MacroDefinitions The macro definitions in the form of dictionary
+# @param SelfReplacement To decide whether replace un-defined macro to ''
+#
+# @retval string The string whose macros are replaced
+#
+def ReplaceMacro(String, MacroDefinitions=None, SelfReplacement=False, RaiseError=False):
+ LastString = String
+ if MacroDefinitions is None:
+ MacroDefinitions = {}
+ while String and MacroDefinitions:
+ MacroUsed = GlobalData.gMacroRefPattern.findall(String)
+ # no macro found in String, stop replacing
+ if len(MacroUsed) == 0:
+ break
+
+ for Macro in MacroUsed:
+ if Macro not in MacroDefinitions:
+ if RaiseError:
+ raise SymbolNotFound("%s not defined" % Macro)
+ if SelfReplacement:
+ String = String.replace("$(%s)" % Macro, '')
+ continue
+ if "$(%s)" % Macro not in MacroDefinitions[Macro]:
+ String = String.replace("$(%s)" % Macro, MacroDefinitions[Macro])
+ # in case there's macro not defined
+ if String == LastString:
+ break
+ LastString = String
+
+ return String
+
+## NormPath
+#
+# Create a normal path
+# And replace DEFINE in the path
+#
+# @param Path: The input value for Path to be converted
+# @param Defines: A set for DEFINE statement
+#
+# @retval Path Formatted path
+#
+def NormPath(Path, Defines=None):
+ IsRelativePath = False
+ if Path:
+ if Path[0] == '.':
+ IsRelativePath = True
+ #
+ # Replace with Define
+ #
+ if Defines:
+ Path = ReplaceMacro(Path, Defines)
+ #
+ # To local path format
+ #
+ Path = os.path.normpath(Path)
+ if Path.startswith(GlobalData.gWorkspace) and not Path.startswith(GlobalData.gBuildDirectory) and not os.path.exists(Path):
+ Path = Path[len (GlobalData.gWorkspace):]
+ if Path[0] == os.path.sep:
+ Path = Path[1:]
+ Path = mws.join(GlobalData.gWorkspace, Path)
+
+ if IsRelativePath and Path[0] != '.':
+ Path = os.path.join('.', Path)
+
+ return Path
+
+## CleanString
+#
+# Remove comments in a string
+# Remove spaces
+#
+# @param Line: The string to be cleaned
+# @param CommentCharacter: Comment char, used to ignore comment content, default is DataType.TAB_COMMENT_SPLIT
+#
+# @retval Path Formatted path
+#
+def CleanString(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False, BuildOption=False):
+ #
+ # remove whitespace
+ #
+ Line = Line.strip();
+ #
+ # Replace Edk's comment character
+ #
+ if AllowCppStyleComment:
+ Line = Line.replace(DataType.TAB_COMMENT_EDK_SPLIT, CommentCharacter)
+ #
+ # remove comments, but we should escape comment character in string
+ #
+ InDoubleQuoteString = False
+ InSingleQuoteString = False
+ CommentInString = False
+ for Index in range(0, len(Line)):
+ if Line[Index] == '"' and not InSingleQuoteString:
+ InDoubleQuoteString = not InDoubleQuoteString
+ elif Line[Index] == "'" and not InDoubleQuoteString:
+ InSingleQuoteString = not InSingleQuoteString
+ elif Line[Index] == CommentCharacter and (InSingleQuoteString or InDoubleQuoteString):
+ CommentInString = True
+ elif Line[Index] == CommentCharacter and not (InSingleQuoteString or InDoubleQuoteString):
+ Line = Line[0: Index]
+ break
+
+ if CommentInString and BuildOption:
+ Line = Line.replace('"', '')
+ ChIndex = Line.find('#')
+ while ChIndex >= 0:
+ if GlobalData.gIsWindows:
+ if ChIndex == 0 or Line[ChIndex - 1] != '^':
+ Line = Line[0:ChIndex] + '^' + Line[ChIndex:]
+ ChIndex = Line.find('#', ChIndex + 2)
+ else:
+ ChIndex = Line.find('#', ChIndex + 1)
+ else:
+ if ChIndex == 0 or Line[ChIndex - 1] != '\\':
+ Line = Line[0:ChIndex] + '\\' + Line[ChIndex:]
+ ChIndex = Line.find('#', ChIndex + 2)
+ else:
+ ChIndex = Line.find('#', ChIndex + 1)
+ #
+ # remove whitespace again
+ #
+ Line = Line.strip();
+
+ return Line
+
+## CleanString2
+#
+# Split statement with comments in a string
+# Remove spaces
+#
+# @param Line: The string to be cleaned
+# @param CommentCharacter: Comment char, used to ignore comment content, default is DataType.TAB_COMMENT_SPLIT
+#
+# @retval Path Formatted path
+#
+def CleanString2(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False):
+ #
+ # remove whitespace
+ #
+ Line = Line.strip();
+ #
+ # Replace Edk's comment character
+ #
+ if AllowCppStyleComment:
+ Line = Line.replace(DataType.TAB_COMMENT_EDK_SPLIT, CommentCharacter)
+ #
+ # separate comments and statements, but we should escape comment character in string
+ #
+ InDoubleQuoteString = False
+ InSingleQuoteString = False
+ CommentInString = False
+ Comment = ''
+ for Index in range(0, len(Line)):
+ if Line[Index] == '"' and not InSingleQuoteString:
+ InDoubleQuoteString = not InDoubleQuoteString
+ elif Line[Index] == "'" and not InDoubleQuoteString:
+ InSingleQuoteString = not InSingleQuoteString
+ elif Line[Index] == CommentCharacter and (InDoubleQuoteString or InSingleQuoteString):
+ CommentInString = True
+ elif Line[Index] == CommentCharacter and not (InDoubleQuoteString or InSingleQuoteString):
+ Comment = Line[Index:].strip()
+ Line = Line[0:Index].strip()
+ break
+
+ return Line, Comment
+
+## GetMultipleValuesOfKeyFromLines
+#
+# Parse multiple strings to clean comment and spaces
+# The result is saved to KeyValues
+#
+# @param Lines: The content to be parsed
+# @param Key: Reserved
+# @param KeyValues: To store data after parsing
+# @param CommentCharacter: Comment char, used to ignore comment content
+#
+# @retval True Successfully executed
+#
+def GetMultipleValuesOfKeyFromLines(Lines, Key, KeyValues, CommentCharacter):
+ Lines = Lines.split(DataType.TAB_SECTION_END, 1)[1]
+ LineList = Lines.split('\n')
+ for Line in LineList:
+ Line = CleanString(Line, CommentCharacter)
+ if Line != '' and Line[0] != CommentCharacter:
+ KeyValues.append(Line)
+
+ return True
+
+## GetDefineValue
+#
+# Parse a DEFINE statement to get defined value
+# DEFINE Key Value
+#
+# @param String: The content to be parsed
+# @param Key: The key of DEFINE statement
+# @param CommentCharacter: Comment char, used to ignore comment content
+#
+# @retval string The defined value
+#
+def GetDefineValue(String, Key, CommentCharacter):
+ String = CleanString(String)
+ return String[String.find(Key + ' ') + len(Key + ' ') : ]
+
+## GetHexVerValue
+#
+# Get a Hex Version Value
+#
+# @param VerString: The version string to be parsed
+#
+#
+# @retval: If VerString is incorrectly formatted, return "None" which will break the build.
+# If VerString is correctly formatted, return a Hex value of the Version Number (0xmmmmnnnn)
+# where mmmm is the major number and nnnn is the adjusted minor number.
+#
+def GetHexVerValue(VerString):
+ VerString = CleanString(VerString)
+
+ if gHumanReadableVerPatt.match(VerString):
+ ValueList = VerString.split('.')
+ Major = ValueList[0]
+ Minor = ValueList[1]
+ if len(Minor) == 1:
+ Minor += '0'
+ DeciValue = (int(Major) << 16) + int(Minor);
+ return "0x%08x" % DeciValue
+ elif gHexVerPatt.match(VerString):
+ return VerString
+ else:
+ return None
+
+
+## GetSingleValueOfKeyFromLines
+#
+# Parse multiple strings as below to get value of each definition line
+# Key1 = Value1
+# Key2 = Value2
+# The result is saved to Dictionary
+#
+# @param Lines: The content to be parsed
+# @param Dictionary: To store data after parsing
+# @param CommentCharacter: Comment char, be used to ignore comment content
+# @param KeySplitCharacter: Key split char, between key name and key value. Key1 = Value1, '=' is the key split char
+# @param ValueSplitFlag: Value split flag, be used to decide if has multiple values
+# @param ValueSplitCharacter: Value split char, be used to split multiple values. Key1 = Value1|Value2, '|' is the value split char
+#
+# @retval True Successfully executed
+#
+def GetSingleValueOfKeyFromLines(Lines, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):
+ Lines = Lines.split('\n')
+ Keys = []
+ Value = ''
+ DefineValues = ['']
+ SpecValues = ['']
+
+ for Line in Lines:
+ #
+ # Handle DEFINE and SPEC
+ #
+ if Line.find(DataType.TAB_INF_DEFINES_DEFINE + ' ') > -1:
+ if '' in DefineValues:
+ DefineValues.remove('')
+ DefineValues.append(GetDefineValue(Line, DataType.TAB_INF_DEFINES_DEFINE, CommentCharacter))
+ continue
+ if Line.find(DataType.TAB_INF_DEFINES_SPEC + ' ') > -1:
+ if '' in SpecValues:
+ SpecValues.remove('')
+ SpecValues.append(GetDefineValue(Line, DataType.TAB_INF_DEFINES_SPEC, CommentCharacter))
+ continue
+
+ #
+ # Handle Others
+ #
+ LineList = Line.split(KeySplitCharacter, 1)
+ if len(LineList) >= 2:
+ Key = LineList[0].split()
+ if len(Key) == 1 and Key[0][0] != CommentCharacter:
+ #
+ # Remove comments and white spaces
+ #
+ LineList[1] = CleanString(LineList[1], CommentCharacter)
+ if ValueSplitFlag:
+ Value = list(map(string.strip, LineList[1].split(ValueSplitCharacter)))
+ else:
+ Value = CleanString(LineList[1], CommentCharacter).splitlines()
+
+ if Key[0] in Dictionary:
+ if Key[0] not in Keys:
+ Dictionary[Key[0]] = Value
+ Keys.append(Key[0])
+ else:
+ Dictionary[Key[0]].extend(Value)
+ else:
+ Dictionary[DataType.TAB_INF_DEFINES_MACRO][Key[0]] = Value[0]
+
+ if DefineValues == []:
+ DefineValues = ['']
+ if SpecValues == []:
+ SpecValues = ['']
+ Dictionary[DataType.TAB_INF_DEFINES_DEFINE] = DefineValues
+ Dictionary[DataType.TAB_INF_DEFINES_SPEC] = SpecValues
+
+ return True
+
+## The content to be parsed
+#
+# Do pre-check for a file before it is parsed
+# Check $()
+# Check []
+#
+# @param FileName: Used for error report
+# @param FileContent: File content to be parsed
+# @param SupSectionTag: Used for error report
+#
+def PreCheck(FileName, FileContent, SupSectionTag):
+ LineNo = 0
+ IsFailed = False
+ NewFileContent = ''
+ for Line in FileContent.splitlines():
+ LineNo = LineNo + 1
+ #
+ # Clean current line
+ #
+ Line = CleanString(Line)
+
+ #
+ # Remove commented line
+ #
+ if Line.find(DataType.TAB_COMMA_SPLIT) == 0:
+ Line = ''
+ #
+ # Check $()
+ #
+ if Line.find('$') > -1:
+ if Line.find('$(') < 0 or Line.find(')') < 0:
+ EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError=EdkLogger.IsRaiseError)
+
+ #
+ # Check []
+ #
+ if Line.find('[') > -1 or Line.find(']') > -1:
+ #
+ # Only get one '[' or one ']'
+ #
+ if not (Line.find('[') > -1 and Line.find(']') > -1):
+ EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError=EdkLogger.IsRaiseError)
+
+ #
+ # Regenerate FileContent
+ #
+ NewFileContent = NewFileContent + Line + '\r\n'
+
+ if IsFailed:
+ EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError=EdkLogger.IsRaiseError)
+
+ return NewFileContent
+
+## CheckFileType
+#
+# Check if the Filename is including ExtName
+# Return True if it exists
+# Raise a error message if it not exists
+#
+# @param CheckFilename: Name of the file to be checked
+# @param ExtName: Ext name of the file to be checked
+# @param ContainerFilename: The container file which describes the file to be checked, used for error report
+# @param SectionName: Used for error report
+# @param Line: The line in container file which defines the file to be checked
+#
+# @retval True The file type is correct
+#
+def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line, LineNo= -1):
+ if CheckFilename != '' and CheckFilename is not None:
+ (Root, Ext) = os.path.splitext(CheckFilename)
+ if Ext.upper() != ExtName.upper():
+ ContainerFile = open(ContainerFilename, 'r').read()
+ if LineNo == -1:
+ LineNo = GetLineNo(ContainerFile, Line)
+ ErrorMsg = "Invalid %s. '%s' is found, but '%s' file is needed" % (SectionName, CheckFilename, ExtName)
+ EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, Line=LineNo,
+ File=ContainerFilename, RaiseError=EdkLogger.IsRaiseError)
+
+ return True
+
+## CheckFileExist
+#
+# Check if the file exists
+# Return True if it exists
+# Raise a error message if it not exists
+#
+# @param CheckFilename: Name of the file to be checked
+# @param WorkspaceDir: Current workspace dir
+# @param ContainerFilename: The container file which describes the file to be checked, used for error report
+# @param SectionName: Used for error report
+# @param Line: The line in container file which defines the file to be checked
+#
+# @retval The file full path if the file exists
+#
+def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName, Line, LineNo= -1):
+ CheckFile = ''
+ if CheckFilename != '' and CheckFilename is not None:
+ CheckFile = WorkspaceFile(WorkspaceDir, CheckFilename)
+ if not os.path.isfile(CheckFile):
+ ContainerFile = open(ContainerFilename, 'r').read()
+ if LineNo == -1:
+ LineNo = GetLineNo(ContainerFile, Line)
+ ErrorMsg = "Can't find file '%s' defined in section '%s'" % (CheckFile, SectionName)
+ EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg,
+ File=ContainerFilename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
+
+ return CheckFile
+
+## GetLineNo
+#
+# Find the index of a line in a file
+#
+# @param FileContent: Search scope
+# @param Line: Search key
+#
+# @retval int Index of the line
+# @retval -1 The line is not found
+#
+def GetLineNo(FileContent, Line, IsIgnoreComment=True):
+ LineList = FileContent.splitlines()
+ for Index in range(len(LineList)):
+ if LineList[Index].find(Line) > -1:
+ #
+ # Ignore statement in comment
+ #
+ if IsIgnoreComment:
+ if LineList[Index].strip()[0] == DataType.TAB_COMMENT_SPLIT:
+ continue
+ return Index + 1
+
+ return -1
+
+## RaiseParserError
+#
+# Raise a parser error
+#
+# @param Line: String which has error
+# @param Section: Used for error report
+# @param File: File which has the string
+# @param Format: Correct format
+#
+def RaiseParserError(Line, Section, File, Format='', LineNo= -1):
+ if LineNo == -1:
+ LineNo = GetLineNo(open(os.path.normpath(File), 'r').read(), Line)
+ ErrorMsg = "Invalid statement '%s' is found in section '%s'" % (Line, Section)
+ if Format != '':
+ Format = "Correct format is " + Format
+ EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=File, Line=LineNo, ExtraData=Format, RaiseError=EdkLogger.IsRaiseError)
+
+## WorkspaceFile
+#
+# Return a full path with workspace dir
+#
+# @param WorkspaceDir: Workspace dir
+# @param Filename: Relative file name
+#
+# @retval string A full path
+#
+def WorkspaceFile(WorkspaceDir, Filename):
+ return mws.join(NormPath(WorkspaceDir), NormPath(Filename))
+
+## Split string
+#
+# Remove '"' which startswith and endswith string
+#
+# @param String: The string need to be split
+#
+# @retval String: The string after removed '""'
+#
+def SplitString(String):
+ if String.startswith('\"'):
+ String = String[1:]
+ if String.endswith('\"'):
+ String = String[:-1]
+
+ return String
+
+## Convert To Sql String
+#
+# 1. Replace "'" with "''" in each item of StringList
+#
+# @param StringList: A list for strings to be converted
+#
+def ConvertToSqlString(StringList):
+ return list(map(lambda s: s.replace("'", "''"), StringList))
+
+## Convert To Sql String
+#
+# 1. Replace "'" with "''" in the String
+#
+# @param String: A String to be converted
+#
+def ConvertToSqlString2(String):
+ return String.replace("'", "''")
+
+#
+# Remove comment block
+#
+def RemoveBlockComment(Lines):
+ IsFindBlockComment = False
+ IsFindBlockCode = False
+ ReservedLine = ''
+ NewLines = []
+
+ for Line in Lines:
+ Line = Line.strip()
+ #
+ # Remove comment block
+ #
+ if Line.find(DataType.TAB_COMMENT_EDK_START) > -1:
+ ReservedLine = GetSplitList(Line, DataType.TAB_COMMENT_EDK_START, 1)[0]
+ IsFindBlockComment = True
+ if Line.find(DataType.TAB_COMMENT_EDK_END) > -1:
+ Line = ReservedLine + GetSplitList(Line, DataType.TAB_COMMENT_EDK_END, 1)[1]
+ ReservedLine = ''
+ IsFindBlockComment = False
+ if IsFindBlockComment:
+ NewLines.append('')
+ continue
+
+ NewLines.append(Line)
+ return NewLines
+
+#
+# Get String of a List
+#
+def GetStringOfList(List, Split=' '):
+ if not isinstance(List, type([])):
+ return List
+ Str = ''
+ for Item in List:
+ Str = Str + Item + Split
+
+ return Str.strip()
+
+#
+# Get HelpTextList from HelpTextClassList
+#
+def GetHelpTextList(HelpTextClassList):
+ List = []
+ if HelpTextClassList:
+ for HelpText in HelpTextClassList:
+ if HelpText.String.endswith('\n'):
+ HelpText.String = HelpText.String[0: len(HelpText.String) - len('\n')]
+ List.extend(HelpText.String.split('\n'))
+
+ return List
+
+def StringToArray(String):
+ if String.startswith('L"'):
+ if String == "L\"\"":
+ return "{0x00,0x00}"
+ else:
+ return "{%s,0x00,0x00}" % ",".join("0x%02x,0x00" % ord(C) for C in String[2:-1])
+ elif String.startswith('"'):
+ if String == "\"\"":
+ return "{0x00,0x00}"
+ else:
+ StringLen = len(String[1:-1])
+ if StringLen % 2:
+ return "{%s,0x00}" % ",".join("0x%02x" % ord(C) for C in String[1:-1])
+ else:
+ return "{%s,0x00,0x00}" % ",".join("0x%02x" % ord(C) for C in String[1:-1])
+ elif String.startswith('{'):
+ return "{%s}" % ",".join(C.strip() for C in String[1:-1].split(','))
+ else:
+ if len(String.split()) % 2:
+ return '{%s,0}' % ','.join(String.split())
+ else:
+ return '{%s,0,0}' % ','.join(String.split())
+
+def StringArrayLength(String):
+ if String.startswith('L"'):
+ return (len(String) - 3 + 1) * 2
+ elif String.startswith('"'):
+ return (len(String) - 2 + 1)
+ else:
+ return len(String.split()) + 1
+
+def RemoveDupOption(OptionString, Which="/I", Against=None):
+ OptionList = OptionString.split()
+ ValueList = []
+ if Against:
+ ValueList += Against
+ for Index in range(len(OptionList)):
+ Opt = OptionList[Index]
+ if not Opt.startswith(Which):
+ continue
+ if len(Opt) > len(Which):
+ Val = Opt[len(Which):]
+ else:
+ Val = ""
+ if Val in ValueList:
+ OptionList[Index] = ""
+ else:
+ ValueList.append(Val)
+ return " ".join(OptionList)
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ pass
+
diff --git a/roms/edk2/BaseTools/Source/Python/Common/TargetTxtClassObject.py b/roms/edk2/BaseTools/Source/Python/Common/TargetTxtClassObject.py
new file mode 100644
index 000000000..363c38302
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/TargetTxtClassObject.py
@@ -0,0 +1,199 @@
+## @file
+# This file is used to define each component of Target.txt file
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+
+import Common.GlobalData as GlobalData
+import Common.LongFilePathOs as os
+from . import EdkLogger
+from . import DataType
+from .BuildToolError import *
+
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+
+gDefaultTargetTxtFile = "target.txt"
+
+## TargetTxtClassObject
+#
+# This class defined content used in file target.txt
+#
+# @param object: Inherited from object class
+# @param Filename: Input value for full path of target.txt
+#
+# @var TargetTxtDictionary: To store keys and values defined in target.txt
+#
+class TargetTxtClassObject(object):
+ def __init__(self, Filename = None):
+ self.TargetTxtDictionary = {
+ DataType.TAB_TAT_DEFINES_ACTIVE_PLATFORM : '',
+ DataType.TAB_TAT_DEFINES_ACTIVE_MODULE : '',
+ DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF : '',
+ DataType.TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER : '',
+ DataType.TAB_TAT_DEFINES_TARGET : [],
+ DataType.TAB_TAT_DEFINES_TOOL_CHAIN_TAG : [],
+ DataType.TAB_TAT_DEFINES_TARGET_ARCH : [],
+ DataType.TAB_TAT_DEFINES_BUILD_RULE_CONF : '',
+ }
+ self.ConfDirectoryPath = ""
+ if Filename is not None:
+ self.LoadTargetTxtFile(Filename)
+
+ ## LoadTargetTxtFile
+ #
+ # Load target.txt file and parse it, return a set structure to store keys and values
+ #
+ # @param Filename: Input value for full path of target.txt
+ #
+ # @retval set() A set structure to store keys and values
+ # @retval 1 Error happenes in parsing
+ #
+ def LoadTargetTxtFile(self, Filename):
+ if os.path.exists(Filename) and os.path.isfile(Filename):
+ return self.ConvertTextFileToDict(Filename, '#', '=')
+ else:
+ EdkLogger.error("Target.txt Parser", FILE_NOT_FOUND, ExtraData=Filename)
+ return 1
+
+ ## ConvertTextFileToDict
+ #
+ # Convert a text file to a dictionary of (name:value) pairs.
+ # The data is saved to self.TargetTxtDictionary
+ #
+ # @param FileName: Text filename
+ # @param CommentCharacter: Comment char, be used to ignore comment content
+ # @param KeySplitCharacter: Key split char, between key name and key value. Key1 = Value1, '=' is the key split char
+ #
+ # @retval 0 Convert successfully
+ # @retval 1 Open file failed
+ #
+ def ConvertTextFileToDict(self, FileName, CommentCharacter, KeySplitCharacter):
+ F = None
+ try:
+ F = open(FileName, 'r')
+ self.ConfDirectoryPath = os.path.dirname(FileName)
+ except:
+ EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=FileName)
+ if F is not None:
+ F.close()
+
+ for Line in F:
+ Line = Line.strip()
+ if Line.startswith(CommentCharacter) or Line == '':
+ continue
+
+ LineList = Line.split(KeySplitCharacter, 1)
+ Key = LineList[0].strip()
+ if len(LineList) == 2:
+ Value = LineList[1].strip()
+ else:
+ Value = ""
+
+ if Key in [DataType.TAB_TAT_DEFINES_ACTIVE_PLATFORM, DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF, \
+ DataType.TAB_TAT_DEFINES_ACTIVE_MODULE, DataType.TAB_TAT_DEFINES_BUILD_RULE_CONF]:
+ self.TargetTxtDictionary[Key] = Value.replace('\\', '/')
+ if Key == DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF and self.TargetTxtDictionary[Key]:
+ if self.TargetTxtDictionary[Key].startswith("Conf/"):
+ Tools_Def = os.path.join(self.ConfDirectoryPath, self.TargetTxtDictionary[Key].strip())
+ if not os.path.exists(Tools_Def) or not os.path.isfile(Tools_Def):
+ # If Conf/Conf does not exist, try just the Conf/ directory
+ Tools_Def = os.path.join(self.ConfDirectoryPath, self.TargetTxtDictionary[Key].replace("Conf/", "", 1).strip())
+ else:
+ # The File pointed to by TOOL_CHAIN_CONF is not in a Conf/ directory
+ Tools_Def = os.path.join(self.ConfDirectoryPath, self.TargetTxtDictionary[Key].strip())
+ self.TargetTxtDictionary[Key] = Tools_Def
+ if Key == DataType.TAB_TAT_DEFINES_BUILD_RULE_CONF and self.TargetTxtDictionary[Key]:
+ if self.TargetTxtDictionary[Key].startswith("Conf/"):
+ Build_Rule = os.path.join(self.ConfDirectoryPath, self.TargetTxtDictionary[Key].strip())
+ if not os.path.exists(Build_Rule) or not os.path.isfile(Build_Rule):
+ # If Conf/Conf does not exist, try just the Conf/ directory
+ Build_Rule = os.path.join(self.ConfDirectoryPath, self.TargetTxtDictionary[Key].replace("Conf/", "", 1).strip())
+ else:
+ # The File pointed to by BUILD_RULE_CONF is not in a Conf/ directory
+ Build_Rule = os.path.join(self.ConfDirectoryPath, self.TargetTxtDictionary[Key].strip())
+ self.TargetTxtDictionary[Key] = Build_Rule
+ elif Key in [DataType.TAB_TAT_DEFINES_TARGET, DataType.TAB_TAT_DEFINES_TARGET_ARCH, \
+ DataType.TAB_TAT_DEFINES_TOOL_CHAIN_TAG]:
+ self.TargetTxtDictionary[Key] = Value.split()
+ elif Key == DataType.TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER:
+ try:
+ V = int(Value, 0)
+ except:
+ EdkLogger.error("build", FORMAT_INVALID, "Invalid number of [%s]: %s." % (Key, Value),
+ File=FileName)
+ self.TargetTxtDictionary[Key] = Value
+ #elif Key not in GlobalData.gGlobalDefines:
+ # GlobalData.gGlobalDefines[Key] = Value
+
+ F.close()
+ return 0
+
+## TargetTxtDict
+#
+# Load target.txt in input Conf dir
+#
+# @param ConfDir: Conf dir
+#
+# @retval Target An instance of TargetTxtClassObject() with loaded target.txt
+#
+
+class TargetTxtDict():
+
+ def __new__(cls, *args, **kw):
+ if not hasattr(cls, '_instance'):
+ orig = super(TargetTxtDict, cls)
+ cls._instance = orig.__new__(cls, *args, **kw)
+ return cls._instance
+
+ def __init__(self):
+ if not hasattr(self, 'Target'):
+ self.TxtTarget = None
+
+ @property
+ def Target(self):
+ if not self.TxtTarget:
+ self._GetTarget()
+ return self.TxtTarget
+
+ def _GetTarget(self):
+ Target = TargetTxtClassObject()
+ ConfDirectory = GlobalData.gCmdConfDir
+ if ConfDirectory:
+ # Get alternate Conf location, if it is absolute, then just use the absolute directory name
+ ConfDirectoryPath = os.path.normpath(ConfDirectory)
+
+ if not os.path.isabs(ConfDirectoryPath):
+ # Since alternate directory name is not absolute, the alternate directory is located within the WORKSPACE
+ # This also handles someone specifying the Conf directory in the workspace. Using --conf=Conf
+ ConfDirectoryPath = mws.join(os.environ["WORKSPACE"], ConfDirectoryPath)
+ else:
+ if "CONF_PATH" in os.environ:
+ ConfDirectoryPath = os.path.normcase(os.path.normpath(os.environ["CONF_PATH"]))
+ else:
+ # Get standard WORKSPACE/Conf use the absolute path to the WORKSPACE/Conf
+ ConfDirectoryPath = mws.join(os.environ["WORKSPACE"], 'Conf')
+ GlobalData.gConfDirectory = ConfDirectoryPath
+ targettxt = os.path.normpath(os.path.join(ConfDirectoryPath, gDefaultTargetTxtFile))
+ if os.path.exists(targettxt):
+ Target.LoadTargetTxtFile(targettxt)
+ self.TxtTarget = Target
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ pass
+ Target = TargetTxtDict(os.getenv("WORKSPACE"))
+ print(Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER])
+ print(Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TARGET])
+ print(Target.TargetTxtDictionary)
diff --git a/roms/edk2/BaseTools/Source/Python/Common/ToolDefClassObject.py b/roms/edk2/BaseTools/Source/Python/Common/ToolDefClassObject.py
new file mode 100644
index 000000000..8e70407cb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/ToolDefClassObject.py
@@ -0,0 +1,307 @@
+## @file
+# This file is used to define each component of tools_def.txt file
+#
+# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.LongFilePathOs as os
+import re
+from . import EdkLogger
+
+from .BuildToolError import *
+from Common.TargetTxtClassObject import TargetTxtDict
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.Misc import PathClass
+from Common.StringUtils import NormPath
+import Common.GlobalData as GlobalData
+from Common import GlobalData
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+from .DataType import TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\
+ TAB_TOD_DEFINES_TARGET_ARCH, TAB_TOD_DEFINES_COMMAND_TYPE\
+ , TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFAMILY,\
+ TAB_STAR, TAB_TAT_DEFINES_TOOL_CHAIN_CONF
+
+
+##
+# Static variables used for pattern
+#
+gMacroRefPattern = re.compile('(DEF\([^\(\)]+\))')
+gEnvRefPattern = re.compile('(ENV\([^\(\)]+\))')
+gMacroDefPattern = re.compile("DEFINE\s+([^\s]+)")
+gDefaultToolsDefFile = "tools_def.txt"
+
+## ToolDefClassObject
+#
+# This class defined content used in file tools_def.txt
+#
+# @param object: Inherited from object class
+# @param Filename: Input value for full path of tools_def.txt
+#
+# @var ToolsDefTxtDictionary: To store keys and values defined in target.txt
+# @var MacroDictionary: To store keys and values defined in DEFINE statement
+#
+class ToolDefClassObject(object):
+ def __init__(self, FileName=None):
+ self.ToolsDefTxtDictionary = {}
+ self.MacroDictionary = {}
+ for Env in os.environ:
+ self.MacroDictionary["ENV(%s)" % Env] = os.environ[Env]
+
+ if FileName is not None:
+ self.LoadToolDefFile(FileName)
+
+ ## LoadToolDefFile
+ #
+ # Load target.txt file and parse it
+ #
+ # @param Filename: Input value for full path of tools_def.txt
+ #
+ def LoadToolDefFile(self, FileName):
+ # set multiple workspace
+ PackagesPath = os.getenv("PACKAGES_PATH")
+ mws.setWs(GlobalData.gWorkspace, PackagesPath)
+
+ self.ToolsDefTxtDatabase = {
+ TAB_TOD_DEFINES_TARGET : [],
+ TAB_TOD_DEFINES_TOOL_CHAIN_TAG : [],
+ TAB_TOD_DEFINES_TARGET_ARCH : [],
+ TAB_TOD_DEFINES_COMMAND_TYPE : []
+ }
+
+ self.IncludeToolDefFile(FileName)
+
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET]))
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG]))
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH]))
+
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE]))
+
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET].sort()
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG].sort()
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH].sort()
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE].sort()
+
+ KeyList = [TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TAG, TAB_TOD_DEFINES_TARGET_ARCH, TAB_TOD_DEFINES_COMMAND_TYPE]
+ for Index in range(3, -1, -1):
+ # make a copy of the keys to enumerate over to prevent issues when
+ # adding/removing items from the original dict.
+ for Key in list(self.ToolsDefTxtDictionary.keys()):
+ List = Key.split('_')
+ if List[Index] == TAB_STAR:
+ for String in self.ToolsDefTxtDatabase[KeyList[Index]]:
+ List[Index] = String
+ NewKey = '%s_%s_%s_%s_%s' % tuple(List)
+ if NewKey not in self.ToolsDefTxtDictionary:
+ self.ToolsDefTxtDictionary[NewKey] = self.ToolsDefTxtDictionary[Key]
+ del self.ToolsDefTxtDictionary[Key]
+ elif List[Index] not in self.ToolsDefTxtDatabase[KeyList[Index]]:
+ del self.ToolsDefTxtDictionary[Key]
+
+
+ ## IncludeToolDefFile
+ #
+ # Load target.txt file and parse it as if its contents were inside the main file
+ #
+ # @param Filename: Input value for full path of tools_def.txt
+ #
+ def IncludeToolDefFile(self, FileName):
+ FileContent = []
+ if os.path.isfile(FileName):
+ try:
+ F = open(FileName, 'r')
+ FileContent = F.readlines()
+ except:
+ EdkLogger.error("tools_def.txt parser", FILE_OPEN_FAILURE, ExtraData=FileName)
+ else:
+ EdkLogger.error("tools_def.txt parser", FILE_NOT_FOUND, ExtraData=FileName)
+
+ for Index in range(len(FileContent)):
+ Line = FileContent[Index].strip()
+ if Line == "" or Line[0] == '#':
+ continue
+
+ if Line.startswith("!include"):
+ IncFile = Line[8:].strip()
+ Done, IncFile = self.ExpandMacros(IncFile)
+ if not Done:
+ EdkLogger.error("tools_def.txt parser", ATTRIBUTE_NOT_AVAILABLE,
+ "Macro or Environment has not been defined",
+ ExtraData=IncFile[4:-1], File=FileName, Line=Index+1)
+ IncFile = NormPath(IncFile)
+
+ if not os.path.isabs(IncFile):
+ #
+ # try WORKSPACE
+ #
+ IncFileTmp = PathClass(IncFile, GlobalData.gWorkspace)
+ ErrorCode = IncFileTmp.Validate()[0]
+ if ErrorCode != 0:
+ #
+ # try PACKAGES_PATH
+ #
+ IncFileTmp = mws.join(GlobalData.gWorkspace, IncFile)
+ if not os.path.exists(IncFileTmp):
+ #
+ # try directory of current file
+ #
+ IncFileTmp = PathClass(IncFile, os.path.dirname(FileName))
+ ErrorCode = IncFileTmp.Validate()[0]
+ if ErrorCode != 0:
+ EdkLogger.error("tools_def.txt parser", FILE_NOT_FOUND, ExtraData=IncFile)
+
+ if isinstance(IncFileTmp, PathClass):
+ IncFile = IncFileTmp.Path
+ else:
+ IncFile = IncFileTmp
+
+ self.IncludeToolDefFile(IncFile)
+ continue
+
+ NameValuePair = Line.split("=", 1)
+ if len(NameValuePair) != 2:
+ EdkLogger.warn("tools_def.txt parser", "Line %d: not correct assignment statement, skipped" % (Index + 1))
+ continue
+
+ Name = NameValuePair[0].strip()
+ Value = NameValuePair[1].strip()
+
+ if Name == "IDENTIFIER":
+ EdkLogger.debug(EdkLogger.DEBUG_8, "Line %d: Found identifier statement, skipped: %s" % ((Index + 1), Value))
+ continue
+
+ MacroDefinition = gMacroDefPattern.findall(Name)
+ if MacroDefinition != []:
+ Done, Value = self.ExpandMacros(Value)
+ if not Done:
+ EdkLogger.error("tools_def.txt parser", ATTRIBUTE_NOT_AVAILABLE,
+ "Macro or Environment has not been defined",
+ ExtraData=Value[4:-1], File=FileName, Line=Index+1)
+
+ MacroName = MacroDefinition[0].strip()
+ self.MacroDictionary["DEF(%s)" % MacroName] = Value
+ EdkLogger.debug(EdkLogger.DEBUG_8, "Line %d: Found macro: %s = %s" % ((Index + 1), MacroName, Value))
+ continue
+
+ Done, Value = self.ExpandMacros(Value)
+ if not Done:
+ EdkLogger.error("tools_def.txt parser", ATTRIBUTE_NOT_AVAILABLE,
+ "Macro or Environment has not been defined",
+ ExtraData=Value[4:-1], File=FileName, Line=Index+1)
+
+ List = Name.split('_')
+ if len(List) != 5:
+ EdkLogger.verbose("Line %d: Not a valid name of definition: %s" % ((Index + 1), Name))
+ continue
+ elif List[4] == TAB_STAR:
+ EdkLogger.verbose("Line %d: '*' is not allowed in last field: %s" % ((Index + 1), Name))
+ continue
+ else:
+ self.ToolsDefTxtDictionary[Name] = Value
+ if List[0] != TAB_STAR:
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] += [List[0]]
+ if List[1] != TAB_STAR:
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] += [List[1]]
+ if List[2] != TAB_STAR:
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] += [List[2]]
+ if List[3] != TAB_STAR:
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE] += [List[3]]
+ if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == TAB_STAR and List[3] == TAB_STAR:
+ if TAB_TOD_DEFINES_FAMILY not in self.ToolsDefTxtDatabase:
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = {}
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] = Value
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY] = {}
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] = Value
+ elif List[1] not in self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] = Value
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] = Value
+ elif self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] != Value:
+ EdkLogger.verbose("Line %d: No override allowed for the family of a tool chain: %s" % ((Index + 1), Name))
+ if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == TAB_STAR and List[3] == TAB_STAR:
+ if TAB_TOD_DEFINES_BUILDRULEFAMILY not in self.ToolsDefTxtDatabase \
+ or List[1] not in self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:
+ EdkLogger.verbose("Line %d: The family is not specified, but BuildRuleFamily is specified for the tool chain: %s" % ((Index + 1), Name))
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] = Value
+
+ ## ExpandMacros
+ #
+ # Replace defined macros with real value
+ #
+ # @param Value: The string with unreplaced macros
+ #
+ # @retval Value: The string which has been replaced with real value
+ #
+ def ExpandMacros(self, Value):
+ # os.environ contains all environment variables uppercase on Windows which cause the key in the self.MacroDictionary is uppercase, but Ref may not
+ EnvReference = gEnvRefPattern.findall(Value)
+ for Ref in EnvReference:
+ if Ref not in self.MacroDictionary and Ref.upper() not in self.MacroDictionary:
+ Value = Value.replace(Ref, "")
+ else:
+ if Ref in self.MacroDictionary:
+ Value = Value.replace(Ref, self.MacroDictionary[Ref])
+ else:
+ Value = Value.replace(Ref, self.MacroDictionary[Ref.upper()])
+ MacroReference = gMacroRefPattern.findall(Value)
+ for Ref in MacroReference:
+ if Ref not in self.MacroDictionary:
+ return False, Ref
+ Value = Value.replace(Ref, self.MacroDictionary[Ref])
+
+ return True, Value
+
+## ToolDefDict
+#
+# Load tools_def.txt in input Conf dir
+#
+# @param ConfDir: Conf dir
+#
+# @retval ToolDef An instance of ToolDefClassObject() with loaded tools_def.txt
+#
+
+
+class ToolDefDict():
+
+ def __new__(cls, ConfDir, *args, **kw):
+ if not hasattr(cls, '_instance'):
+ orig = super(ToolDefDict, cls)
+ cls._instance = orig.__new__(cls, *args, **kw)
+ return cls._instance
+
+ def __init__(self, ConfDir):
+ self.ConfDir = ConfDir
+ if not hasattr(self, 'ToolDef'):
+ self._ToolDef = None
+
+ @property
+ def ToolDef(self):
+ if not self._ToolDef:
+ self._GetToolDef()
+ return self._ToolDef
+
+ def _GetToolDef(self):
+ TargetObj = TargetTxtDict()
+ Target = TargetObj.Target
+ ToolDef = ToolDefClassObject()
+ if TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
+ ToolsDefFile = Target.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
+ if ToolsDefFile:
+ ToolDef.LoadToolDefFile(os.path.normpath(ToolsDefFile))
+ else:
+ ToolDef.LoadToolDefFile(os.path.normpath(os.path.join(self.ConfDir, gDefaultToolsDefFile)))
+ else:
+ ToolDef.LoadToolDefFile(os.path.normpath(os.path.join(self.ConfDir, gDefaultToolsDefFile)))
+ self._ToolDef = ToolDef
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ ToolDef = ToolDefDict(os.getenv("WORKSPACE"))
+ pass
diff --git a/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/CapsuleDependency.py b/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/CapsuleDependency.py
new file mode 100644
index 000000000..74004857a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/CapsuleDependency.py
@@ -0,0 +1,409 @@
+## @file
+# Module that encodes and decodes a capsule dependency.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+import struct
+import json
+import sys
+import uuid
+import re
+
+'''
+CapsuleDependency
+'''
+
+class OpConvert (object):
+ def __init__ (self):
+ # Opcode: (OperandSize, PackSize, PackFmt, EncodeConvert, DecodeConvert)
+ self._DepexOperations = {0x00: (16, 16, 's', self.Str2Guid, self.Guid2Str),
+ 0x01: (4, 1, 'I', self.Str2Uint, self.Uint2Str),
+ 0x02: (1, 0, 's', self.Str2Utf8, self.Byte2Str),
+ }
+
+ def Str2Uint (self, Data):
+ try:
+ Value = int (Data, 16)
+ except:
+ Message = '{Data} is not a valid integer value.'.format (Data = Data)
+ raise ValueError (Message)
+ if Value < 0 or Value > 0xFFFFFFFF:
+ Message = '{Data} is not an UINT32.'.format (Data = Data)
+ raise ValueError (Message)
+ return Value
+
+ def Uint2Str (self, Data):
+ if Data < 0 or Data > 0xFFFFFFFF:
+ Message = '{Data} is not an UINT32.'.format (Data = Data)
+ raise ValueError (Message)
+ return "0x{Data:08x}".format (Data = Data)
+
+ def Str2Guid (self, Data):
+ try:
+ Guid = uuid.UUID (Data)
+ except:
+ Message = '{Data} is not a valid registry format GUID value.'.format (Data = Data)
+ raise ValueError (Message)
+ return Guid.bytes_le
+
+ def Guid2Str (self, Data):
+ try:
+ Guid = uuid.UUID (bytes_le = Data)
+ except:
+ Message = '{Data} is not a valid binary format GUID value.'.format (Data = Data)
+ raise ValueError (Message)
+ return str (Guid).upper ()
+
+ def Str2Utf8 (self, Data):
+ if isinstance (Data, str):
+ return Data.encode ('utf-8')
+ else:
+ Message = '{Data} is not a valid string.'.format (Data = Data)
+ raise ValueError (Message)
+
+ def Byte2Str (self, Data):
+ if isinstance (Data, bytes):
+ if Data[-1:] == b'\x00':
+ return str (Data[:-1], 'utf-8')
+ else:
+ return str (Data, 'utf-8')
+ else:
+ Message = '{Data} is not a valid binary string.'.format (Data = Data)
+ raise ValueError (Message)
+
+ def OpEncode (self, Opcode, Operand = None):
+ BinTemp = struct.pack ('<b', Opcode)
+ if Opcode <= 0x02 and Operand != None:
+ OperandSize, PackSize, PackFmt, EncodeConvert, DecodeConvert = self._DepexOperations[Opcode]
+ Value = EncodeConvert (Operand)
+ if Opcode == 0x02:
+ PackSize = len (Value) + 1
+ BinTemp += struct.pack ('<{PackSize}{PackFmt}'.format (PackSize = PackSize, PackFmt = PackFmt), Value)
+ return BinTemp
+
+ def OpDecode (self, Buffer):
+ Opcode = struct.unpack ('<b', Buffer[0:1])[0]
+ if Opcode <= 0x02:
+ OperandSize, PackSize, PackFmt, EncodeConvert, DecodeConvert = self._DepexOperations[Opcode]
+ if Opcode == 0x02:
+ try:
+ PackSize = Buffer[1:].index (b'\x00') + 1
+ OperandSize = PackSize
+ except:
+ Message = 'CapsuleDependency: OpConvert: error: decode failed with wrong opcode/string.'
+ raise ValueError (Message)
+ try:
+ Operand = DecodeConvert (struct.unpack ('<{PackSize}{PackFmt}'.format (PackSize = PackSize, PackFmt = PackFmt), Buffer[1:1+OperandSize])[0])
+ except:
+ Message = 'CapsuleDependency: OpConvert: error: decode failed with unpack failure.'
+ raise ValueError (Message)
+ else:
+ Operand = None
+ OperandSize = 0
+ return (Opcode, Operand, OperandSize)
+
+class CapsuleDependencyClass (object):
+ # //**************************************************************
+ # // Image Attribute - Dependency
+ # //**************************************************************
+ # typedef struct {
+ # UINT8 Dependencies[];
+ # } EFI_FIRMWARE_IMAGE_DEP
+
+ # {expression operator : [precedence, opcode, type (1:unary/2:binocular)]}
+ _opReference = {'&&': [2, 0x03, 2],
+ '||': [1, 0x04, 2],
+ '~': [5, 0x05, 1],
+ '==': [3, 0x08, 2],
+ '>': [4, 0x09, 2],
+ '>=': [4, 0x0A, 2],
+ '<': [4, 0x0B, 2],
+ '<=': [4, 0x0C, 2],
+ }
+
+ def __init__ (self):
+ self.Payload = b''
+ self._DepexExp = None
+ self._DepexList = []
+ self._DepexDump = []
+ self.Depex = b''
+ self._Valid = False
+ self._DepexSize = 0
+ self._opReferenceReverse = {v[1] : k for k, v in self._opReference.items ()}
+ self.OpConverter = OpConvert ()
+
+ @property
+ def DepexExp (self):
+ return self._DepexExp
+
+ @DepexExp.setter
+ def DepexExp (self, DepexExp = ''):
+ if isinstance (DepexExp, str):
+ DepexExp = re.sub (r'\n',r' ',DepexExp)
+ DepexExp = re.sub (r'\(',r' ( ',DepexExp)
+ DepexExp = re.sub (r'\)',r' ) ',DepexExp)
+ DepexExp = re.sub (r'~',r' ~ ',DepexExp)
+ self._DepexList = re.findall(r"[^\s\"\']+|\"[^\"]*\"|\'[^\']*\'",DepexExp)
+ self._DepexExp = " ".join(self._DepexList)
+
+ else:
+ Msg = 'Input Depex Expression is not valid string.'
+ raise ValueError (Msg)
+
+ def IsValidOperator (self, op):
+ return op in self._opReference.keys ()
+
+ def IsValidUnaryOperator (self, op):
+ return op in self._opReference.keys () and self._opReference[op][2] == 1
+
+ def IsValidBinocularOperator (self, op):
+ return op in self._opReference.keys () and self._opReference[op][2] == 2
+
+ def IsValidGuid (self, operand):
+ try:
+ uuid.UUID (operand)
+ except:
+ return False
+ return True
+
+ def IsValidVersion (self, operand):
+ try:
+ Value = int (operand, 16)
+ if Value < 0 or Value > 0xFFFFFFFF:
+ return False
+ except:
+ return False
+ return True
+
+ def IsValidBoolean (self, operand):
+ try:
+ return operand.upper () in ['TRUE', 'FALSE']
+ except:
+ return False
+
+ def IsValidOperand (self, operand):
+ return self.IsValidVersion (operand) or self.IsValidGuid (operand) or self.IsValidBoolean (operand)
+
+ def IsValidString (self, operand):
+ return operand[0] == "\"" and operand[-1] == "\"" and len(operand) >= 2
+
+ # Check if priority of current operater is greater than pervious op
+ def PriorityNotGreater (self, prevOp, currOp):
+ return self._opReference[currOp][0] <= self._opReference[prevOp][0]
+
+ def ValidateDepex (self):
+ OpList = self._DepexList
+
+ i = 0
+ while i < len (OpList):
+ Op = OpList[i]
+
+ if Op == 'DECLARE':
+ i += 1
+ if i >= len (OpList):
+ Msg = 'No more Operand after {Op}.'.format (Op = OpList[i-1])
+ raise IndexError (Msg)
+ # Check valid string
+ if not self.IsValidString(OpList[i]):
+ Msg = '{Operand} after {Op} is not a valid expression input.'.format (Operand = OpList[i], Op = OpList[i-1])
+ raise ValueError (Msg)
+
+ elif Op == '(':
+ # Expression cannot end with (
+ if i == len (OpList) - 1:
+ Msg = 'Expression cannot end with \'(\''
+ raise ValueError (Msg)
+ # The previous op after '(' cannot be a binocular operator
+ if self.IsValidBinocularOperator (OpList[i+1]) :
+ Msg = '{Op} after \'(\' is not a valid expression input.'.format (Op = OpList[i+1])
+ raise ValueError (Msg)
+
+ elif Op == ')':
+ # Expression cannot start with )
+ if i == 0:
+ Msg = 'Expression cannot start with \')\''
+ raise ValueError (Msg)
+ # The previous op before ')' cannot be an operator
+ if self.IsValidOperator (OpList[i-1]):
+ Msg = '{Op} before \')\' is not a valid expression input.'.format (Op = OpList[i-1])
+ raise ValueError (Msg)
+ # The next op after ')' cannot be operand or unary operator
+ if (i + 1) < len (OpList) and (self.IsValidOperand (OpList[i+1]) or self.IsValidUnaryOperator (OpList[i+1])):
+ Msg = '{Op} after \')\' is not a valid expression input.'.format (Op = OpList[i+1])
+ raise ValueError (Msg)
+
+ elif self.IsValidOperand (Op):
+ # The next expression of operand cannot be operand or unary operator
+ if (i + 1) < len (OpList) and (self.IsValidOperand (OpList[i+1]) or self.IsValidUnaryOperator (OpList[i+1])):
+ Msg = '{Op} after {PrevOp} is not a valid expression input.'.format (Op = OpList[i+1], PrevOp = Op)
+ raise ValueError (Msg)
+
+ elif self.IsValidOperator (Op):
+ # The next op of operator cannot binocular operator
+ if (i + 1) < len (OpList) and self.IsValidBinocularOperator (OpList[i+1]):
+ Msg = '{Op} after {PrevOp} is not a valid expression input.'.format (Op = OpList[i+1], PrevOp = Op)
+ raise ValueError (Msg)
+ # The first op can not be binocular operator
+ if i == 0 and self.IsValidBinocularOperator (Op):
+ Msg = 'Expression cannot start with an operator {Op}.'.format (Op = Op)
+ raise ValueError (Msg)
+ # The last op can not be operator
+ if i == len (OpList) - 1:
+ Msg = 'Expression cannot ended with an operator {Op}.'.format (Op = Op)
+ raise ValueError (Msg)
+ # The next op of unary operator cannot be guid / version
+ if self.IsValidUnaryOperator (Op) and (self.IsValidGuid (OpList[i+1]) or self.IsValidVersion (OpList[i+1])):
+ Msg = '{Op} after {PrevOp} is not a valid expression input.'.format (Op = OpList[i+1], PrevOp = Op)
+ raise ValueError (Msg)
+
+ else:
+ Msg = '{Op} is not a valid expression input.'.format (Op = Op)
+ raise ValueError (Msg)
+ i += 1
+
+ def Encode (self):
+ # initialize
+ self.Depex = b''
+ self._DepexDump = []
+ OperandStack = []
+ OpeartorStack = []
+ OpList = self._DepexList
+
+ self.ValidateDepex ()
+
+ # convert
+ i = 0
+ while i < len (OpList):
+ Op = OpList[i]
+ if Op == 'DECLARE':
+ # This declare next expression value is a VERSION_STRING
+ i += 1
+ self.Depex += self.OpConverter.OpEncode (0x02, OpList[i][1:-1])
+
+ elif Op == '(':
+ OpeartorStack.append (Op)
+
+ elif Op == ')':
+ while (OpeartorStack and OpeartorStack[-1] != '('):
+ Operator = OpeartorStack.pop ()
+ self.Depex += self.OpConverter.OpEncode (self._opReference[Operator][1])
+ try:
+ OpeartorStack.pop () # pop out '('
+ except:
+ Msg = 'Pop out \'(\' failed, too many \')\''
+ raise ValueError (Msg)
+
+ elif self.IsValidGuid (Op):
+ if not OperandStack:
+ OperandStack.append (self.OpConverter.OpEncode (0x00, Op))
+ else:
+ # accroding to uefi spec 2.8, the guid/version operands is a reversed order in firmware comparison.
+ self.Depex += self.OpConverter.OpEncode (0x00, Op)
+ self.Depex += OperandStack.pop ()
+
+ elif self.IsValidVersion (Op):
+ if not OperandStack:
+ OperandStack.append (self.OpConverter.OpEncode (0x01, Op))
+ else:
+ # accroding to uefi spec 2.8, the guid/version operands is a reversed order in firmware comparison.
+ self.Depex += self.OpConverter.OpEncode (0x01, Op)
+ self.Depex += OperandStack.pop ()
+
+ elif self.IsValidBoolean (Op):
+ if Op.upper () == 'FALSE':
+ self.Depex += self.OpConverter.OpEncode (0x07)
+ elif Op.upper () == 'TRUE':
+ self.Depex += self.OpConverter.OpEncode (0x06)
+
+ elif self.IsValidOperator (Op):
+ while (OpeartorStack and OpeartorStack[-1] != '(' and self.PriorityNotGreater (OpeartorStack[-1], Op)):
+ Operator = OpeartorStack.pop ()
+ self.Depex += self.OpConverter.OpEncode (self._opReference[Operator][1])
+ OpeartorStack.append (Op)
+
+ i += 1
+
+ while OpeartorStack:
+ Operator = OpeartorStack.pop ()
+ if Operator == '(':
+ Msg = 'Too many \'(\'.'
+ raise ValueError (Msg)
+ self.Depex += self.OpConverter.OpEncode (self._opReference[Operator][1])
+ self.Depex += self.OpConverter.OpEncode (0x0D)
+
+ self._Valid = True
+ self._DepexSize = len (self.Depex)
+ return self.Depex + self.Payload
+
+ def Decode (self, Buffer):
+ # initialize
+ self.Depex = Buffer
+ OperandStack = []
+ DepexLen = 0
+
+ while True:
+ Opcode, Operand, OperandSize = self.OpConverter.OpDecode (Buffer[DepexLen:])
+ DepexLen += OperandSize + 1
+
+ if Opcode == 0x0D:
+ break
+
+ elif Opcode == 0x02:
+ if not OperandStack:
+ OperandStack.append ('DECLARE \"{String}\"'.format (String = Operand))
+ else:
+ PrevOperand = OperandStack.pop ()
+ OperandStack.append ('{Operand} DECLARE \"{String}\"'.format (Operand = PrevOperand, String = Operand))
+
+ elif Opcode in [0x00, 0x01]:
+ OperandStack.append (Operand)
+
+ elif Opcode == 0x06:
+ OperandStack.append ('TRUE')
+
+ elif Opcode == 0x07:
+ OperandStack.append ('FALSE')
+
+ elif self.IsValidOperator (self._opReferenceReverse[Opcode]):
+ Operator = self._opReferenceReverse[Opcode]
+ if self.IsValidUnaryOperator (self._opReferenceReverse[Opcode]) and len (OperandStack) >= 1:
+ Oprand = OperandStack.pop ()
+ OperandStack.append (' ( {Operator} {Oprand} )'.format (Operator = Operator, Oprand = Oprand))
+ elif self.IsValidBinocularOperator (self._opReferenceReverse[Opcode]) and len (OperandStack) >= 2:
+ Oprand1 = OperandStack.pop ()
+ Oprand2 = OperandStack.pop ()
+ OperandStack.append (' ( {Oprand1} {Operator} {Oprand2} )'.format (Operator = Operator, Oprand1 = Oprand1, Oprand2 = Oprand2))
+ else:
+ Msg = 'No enough Operands for {Opcode:02X}.'.format (Opcode = Opcode)
+ raise ValueError (Msg)
+
+ else:
+ Msg = '{Opcode:02X} is not a valid OpCode.'.format (Opcode = Opcode)
+ raise ValueError (Msg)
+
+ self.DepexExp = OperandStack[0].strip (' ')
+ self.Payload = Buffer[DepexLen:]
+ self._Valid = True
+ self._DepexSize = DepexLen
+ return self.Payload
+
+
+ def DumpInfo (self):
+ DepexLen = 0
+ Opcode = None
+ Buffer = self.Depex
+
+ if self._Valid == True:
+ print ('EFI_FIRMWARE_IMAGE_DEP.Dependencies = {')
+ while Opcode != 0x0D:
+ Opcode, Operand, OperandSize = self.OpConverter.OpDecode (Buffer[DepexLen:])
+ DepexLen += OperandSize + 1
+ if Operand:
+ print (' {Opcode:02X}, {Operand},'.format (Opcode = Opcode, Operand = Operand))
+ else:
+ print (' {Opcode:02X},'.format (Opcode = Opcode))
+ print ('}')
+
+ print ('sizeof (EFI_FIRMWARE_IMAGE_DEP.Dependencies) = {Size:08X}'.format (Size = self._DepexSize))
+ print ('sizeof (Payload) = {Size:08X}'.format (Size = len (self.Payload)))
diff --git a/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/FmpAuthHeader.py b/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/FmpAuthHeader.py
new file mode 100644
index 000000000..48c605faa
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/FmpAuthHeader.py
@@ -0,0 +1,190 @@
+## @file
+# Module that encodes and decodes a EFI_FIRMWARE_IMAGE_AUTHENTICATION with
+# certificate data and payload data.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+FmpAuthHeader
+'''
+
+import struct
+import uuid
+
+class FmpAuthHeaderClass (object):
+ # ///
+ # /// Image Attribute -Authentication Required
+ # ///
+ # typedef struct {
+ # ///
+ # /// It is included in the signature of AuthInfo. It is used to ensure freshness/no replay.
+ # /// It is incremented during each firmware image operation.
+ # ///
+ # UINT64 MonotonicCount;
+ # ///
+ # /// Provides the authorization for the firmware image operations. It is a signature across
+ # /// the image data and the Monotonic Count value. Caller uses the private key that is
+ # /// associated with a public key that has been provisioned via the key exchange.
+ # /// Because this is defined as a signature, WIN_CERTIFICATE_UEFI_GUID.CertType must
+ # /// be EFI_CERT_TYPE_PKCS7_GUID.
+ # ///
+ # WIN_CERTIFICATE_UEFI_GUID AuthInfo;
+ # } EFI_FIRMWARE_IMAGE_AUTHENTICATION;
+ #
+ # ///
+ # /// Certificate which encapsulates a GUID-specific digital signature
+ # ///
+ # typedef struct {
+ # ///
+ # /// This is the standard WIN_CERTIFICATE header, where
+ # /// wCertificateType is set to WIN_CERT_TYPE_EFI_GUID.
+ # ///
+ # WIN_CERTIFICATE Hdr;
+ # ///
+ # /// This is the unique id which determines the
+ # /// format of the CertData. .
+ # ///
+ # EFI_GUID CertType;
+ # ///
+ # /// The following is the certificate data. The format of
+ # /// the data is determined by the CertType.
+ # /// If CertType is EFI_CERT_TYPE_RSA2048_SHA256_GUID,
+ # /// the CertData will be EFI_CERT_BLOCK_RSA_2048_SHA256 structure.
+ # ///
+ # UINT8 CertData[1];
+ # } WIN_CERTIFICATE_UEFI_GUID;
+ #
+ # ///
+ # /// The WIN_CERTIFICATE structure is part of the PE/COFF specification.
+ # ///
+ # typedef struct {
+ # ///
+ # /// The length of the entire certificate,
+ # /// including the length of the header, in bytes.
+ # ///
+ # UINT32 dwLength;
+ # ///
+ # /// The revision level of the WIN_CERTIFICATE
+ # /// structure. The current revision level is 0x0200.
+ # ///
+ # UINT16 wRevision;
+ # ///
+ # /// The certificate type. See WIN_CERT_TYPE_xxx for the UEFI
+ # /// certificate types. The UEFI specification reserves the range of
+ # /// certificate type values from 0x0EF0 to 0x0EFF.
+ # ///
+ # UINT16 wCertificateType;
+ # ///
+ # /// The following is the actual certificate. The format of
+ # /// the certificate depends on wCertificateType.
+ # ///
+ # /// UINT8 bCertificate[ANYSIZE_ARRAY];
+ # ///
+ # } WIN_CERTIFICATE;
+ #
+ # #define WIN_CERT_TYPE_EFI_GUID 0x0EF1
+ #
+ # ///
+ # /// This identifies a signature containing a DER-encoded PKCS #7 version 1.5 [RFC2315]
+ # /// SignedData value.
+ # ///
+ # #define EFI_CERT_TYPE_PKCS7_GUID \
+ # { \
+ # 0x4aafd29d, 0x68df, 0x49ee, {0x8a, 0xa9, 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7} \
+ # }
+
+ _StructFormat = '<QIHH16s'
+ _StructSize = struct.calcsize (_StructFormat)
+
+ _MonotonicCountFormat = '<Q'
+ _MonotonicCountSize = struct.calcsize (_MonotonicCountFormat)
+
+ _StructAuthInfoFormat = '<IHH16s'
+ _StructAuthInfoSize = struct.calcsize (_StructAuthInfoFormat)
+
+ _WIN_CERT_REVISION = 0x0200
+ _WIN_CERT_TYPE_EFI_GUID = 0x0EF1
+ _EFI_CERT_TYPE_PKCS7_GUID = uuid.UUID ('4aafd29d-68df-49ee-8aa9-347d375665a7')
+
+ def __init__ (self):
+ self._Valid = False
+ self.MonotonicCount = 0
+ self.dwLength = self._StructAuthInfoSize
+ self.wRevision = self._WIN_CERT_REVISION
+ self.wCertificateType = self._WIN_CERT_TYPE_EFI_GUID
+ self.CertType = self._EFI_CERT_TYPE_PKCS7_GUID
+ self.CertData = b''
+ self.Payload = b''
+
+
+ def Encode (self):
+ if self.wRevision != self._WIN_CERT_REVISION:
+ raise ValueError
+ if self.wCertificateType != self._WIN_CERT_TYPE_EFI_GUID:
+ raise ValueError
+ if self.CertType != self._EFI_CERT_TYPE_PKCS7_GUID:
+ raise ValueError
+ self.dwLength = self._StructAuthInfoSize + len (self.CertData)
+
+ FmpAuthHeader = struct.pack (
+ self._StructFormat,
+ self.MonotonicCount,
+ self.dwLength,
+ self.wRevision,
+ self.wCertificateType,
+ self.CertType.bytes_le
+ )
+ self._Valid = True
+
+ return FmpAuthHeader + self.CertData + self.Payload
+
+ def Decode (self, Buffer):
+ if len (Buffer) < self._StructSize:
+ raise ValueError
+ (MonotonicCount, dwLength, wRevision, wCertificateType, CertType) = \
+ struct.unpack (
+ self._StructFormat,
+ Buffer[0:self._StructSize]
+ )
+ if dwLength < self._StructAuthInfoSize:
+ raise ValueError
+ if wRevision != self._WIN_CERT_REVISION:
+ raise ValueError
+ if wCertificateType != self._WIN_CERT_TYPE_EFI_GUID:
+ raise ValueError
+ if CertType != self._EFI_CERT_TYPE_PKCS7_GUID.bytes_le:
+ raise ValueError
+ self.MonotonicCount = MonotonicCount
+ self.dwLength = dwLength
+ self.wRevision = wRevision
+ self.wCertificateType = wCertificateType
+ self.CertType = uuid.UUID (bytes_le = CertType)
+ self.CertData = Buffer[self._StructSize:self._MonotonicCountSize + self.dwLength]
+ self.Payload = Buffer[self._MonotonicCountSize + self.dwLength:]
+ self._Valid = True
+ return self.Payload
+
+ def IsSigned (self, Buffer):
+ if len (Buffer) < self._StructSize:
+ return False
+ (MonotonicCount, dwLength, wRevision, wCertificateType, CertType) = \
+ struct.unpack (
+ self._StructFormat,
+ Buffer[0:self._StructSize]
+ )
+ if CertType != self._EFI_CERT_TYPE_PKCS7_GUID.bytes_le:
+ return False
+ return True
+
+ def DumpInfo (self):
+ if not self._Valid:
+ raise ValueError
+ print ('EFI_FIRMWARE_IMAGE_AUTHENTICATION.MonotonicCount = {MonotonicCount:016X}'.format (MonotonicCount = self.MonotonicCount))
+ print ('EFI_FIRMWARE_IMAGE_AUTHENTICATION.AuthInfo.Hdr.dwLength = {dwLength:08X}'.format (dwLength = self.dwLength))
+ print ('EFI_FIRMWARE_IMAGE_AUTHENTICATION.AuthInfo.Hdr.wRevision = {wRevision:04X}'.format (wRevision = self.wRevision))
+ print ('EFI_FIRMWARE_IMAGE_AUTHENTICATION.AuthInfo.Hdr.wCertificateType = {wCertificateType:04X}'.format (wCertificateType = self.wCertificateType))
+ print ('EFI_FIRMWARE_IMAGE_AUTHENTICATION.AuthInfo.CertType = {Guid}'.format (Guid = str(self.CertType).upper()))
+ print ('sizeof (EFI_FIRMWARE_IMAGE_AUTHENTICATION.AuthInfo.CertData) = {Size:08X}'.format (Size = len (self.CertData)))
+ print ('sizeof (Payload) = {Size:08X}'.format (Size = len (self.Payload)))
diff --git a/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py b/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py
new file mode 100644
index 000000000..91d24919c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py
@@ -0,0 +1,298 @@
+## @file
+# Module that encodes and decodes a EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER with
+# a payload.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+FmpCapsuleHeader
+'''
+
+import struct
+import uuid
+
+class FmpCapsuleImageHeaderClass (object):
+ # typedef struct {
+ # UINT32 Version;
+ #
+ # ///
+ # /// Used to identify device firmware targeted by this update. This guid is matched by
+ # /// system firmware against ImageTypeId field within a EFI_FIRMWARE_IMAGE_DESCRIPTOR
+ # ///
+ # EFI_GUID UpdateImageTypeId;
+ #
+ # ///
+ # /// Passed as ImageIndex in call to EFI_FIRMWARE_MANAGEMENT_PROTOCOL.SetImage ()
+ # ///
+ # UINT8 UpdateImageIndex;
+ # UINT8 reserved_bytes[3];
+ #
+ # ///
+ # /// Size of the binary update image which immediately follows this structure
+ # ///
+ # UINT32 UpdateImageSize;
+ #
+ # ///
+ # /// Size of the VendorCode bytes which optionally immediately follow binary update image in the capsule
+ # ///
+ # UINT32 UpdateVendorCodeSize;
+ #
+ # ///
+ # /// The HardwareInstance to target with this update. If value is zero it means match all
+ # /// HardwareInstances. This field allows update software to target only a single device in
+ # /// cases where there are more than one device with the same ImageTypeId GUID.
+ # /// This header is outside the signed data of the Authentication Info structure and
+ # /// therefore can be modified without changing the Auth data.
+ # ///
+ # UINT64 UpdateHardwareInstance;
+ # } EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER;
+ #
+ # #define EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION 0x00000002
+
+ _StructFormat = '<I16sB3BIIQ'
+ _StructSize = struct.calcsize (_StructFormat)
+
+ EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION = 0x00000002
+
+ def __init__ (self):
+ self._Valid = False
+ self.Version = self.EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION
+ self.UpdateImageTypeId = uuid.UUID ('00000000-0000-0000-0000-000000000000')
+ self.UpdateImageIndex = 0
+ self.UpdateImageSize = 0
+ self.UpdateVendorCodeSize = 0
+ self.UpdateHardwareInstance = 0x0000000000000000
+ self.Payload = b''
+ self.VendorCodeBytes = b''
+
+ def Encode (self):
+ self.UpdateImageSize = len (self.Payload)
+ self.UpdateVendorCodeSize = len (self.VendorCodeBytes)
+ FmpCapsuleImageHeader = struct.pack (
+ self._StructFormat,
+ self.Version,
+ self.UpdateImageTypeId.bytes_le,
+ self.UpdateImageIndex,
+ 0,0,0,
+ self.UpdateImageSize,
+ self.UpdateVendorCodeSize,
+ self.UpdateHardwareInstance
+ )
+ self._Valid = True
+ return FmpCapsuleImageHeader + self.Payload + self.VendorCodeBytes
+
+ def Decode (self, Buffer):
+ if len (Buffer) < self._StructSize:
+ raise ValueError
+ (Version, UpdateImageTypeId, UpdateImageIndex, r0, r1, r2, UpdateImageSize, UpdateVendorCodeSize, UpdateHardwareInstance) = \
+ struct.unpack (
+ self._StructFormat,
+ Buffer[0:self._StructSize]
+ )
+
+ if Version < self.EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION:
+ raise ValueError
+ if UpdateImageIndex < 1:
+ raise ValueError
+ if UpdateImageSize + UpdateVendorCodeSize != len (Buffer[self._StructSize:]):
+ raise ValueError
+
+ self.Version = Version
+ self.UpdateImageTypeId = uuid.UUID (bytes_le = UpdateImageTypeId)
+ self.UpdateImageIndex = UpdateImageIndex
+ self.UpdateImageSize = UpdateImageSize
+ self.UpdateVendorCodeSize = UpdateVendorCodeSize
+ self.UpdateHardwareInstance = UpdateHardwareInstance
+ self.Payload = Buffer[self._StructSize:self._StructSize + UpdateImageSize]
+ self.VendorCodeBytes = Buffer[self._StructSize + UpdateImageSize:]
+ self._Valid = True
+ return Buffer[self._StructSize:]
+
+ def DumpInfo (self):
+ if not self._Valid:
+ raise ValueError
+ print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER.Version = {Version:08X}'.format (Version = self.Version))
+ print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER.UpdateImageTypeId = {UpdateImageTypeId}'.format (UpdateImageTypeId = str(self.UpdateImageTypeId).upper()))
+ print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER.UpdateImageIndex = {UpdateImageIndex:08X}'.format (UpdateImageIndex = self.UpdateImageIndex))
+ print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER.UpdateImageSize = {UpdateImageSize:08X}'.format (UpdateImageSize = self.UpdateImageSize))
+ print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER.UpdateVendorCodeSize = {UpdateVendorCodeSize:08X}'.format (UpdateVendorCodeSize = self.UpdateVendorCodeSize))
+ print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER.UpdateHardwareInstance = {UpdateHardwareInstance:016X}'.format (UpdateHardwareInstance = self.UpdateHardwareInstance))
+ print ('sizeof (Payload) = {Size:08X}'.format (Size = len (self.Payload)))
+ print ('sizeof (VendorCodeBytes) = {Size:08X}'.format (Size = len (self.VendorCodeBytes)))
+
+class FmpCapsuleHeaderClass (object):
+ # typedef struct {
+ # UINT32 Version;
+ #
+ # ///
+ # /// The number of drivers included in the capsule and the number of corresponding
+ # /// offsets stored in ItemOffsetList array.
+ # ///
+ # UINT16 EmbeddedDriverCount;
+ #
+ # ///
+ # /// The number of payload items included in the capsule and the number of
+ # /// corresponding offsets stored in the ItemOffsetList array.
+ # ///
+ # UINT16 PayloadItemCount;
+ #
+ # ///
+ # /// Variable length array of dimension [EmbeddedDriverCount + PayloadItemCount]
+ # /// containing offsets of each of the drivers and payload items contained within the capsule
+ # ///
+ # // UINT64 ItemOffsetList[];
+ # } EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER;
+ #
+ # #define EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER_INIT_VERSION 0x00000001
+ _StructFormat = '<IHH'
+ _StructSize = struct.calcsize (_StructFormat)
+
+ _ItemOffsetFormat = '<Q'
+ _ItemOffsetSize = struct.calcsize (_ItemOffsetFormat)
+
+ EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER_INIT_VERSION = 0x00000001
+
+ def __init__ (self):
+ self._Valid = False
+ self.Version = self.EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER_INIT_VERSION
+ self.EmbeddedDriverCount = 0
+ self.PayloadItemCount = 0
+ self._ItemOffsetList = []
+ self._EmbeddedDriverList = []
+ self._PayloadList = []
+ self._FmpCapsuleImageHeaderList = []
+
+ def AddEmbeddedDriver (self, EmbeddedDriver):
+ self._EmbeddedDriverList.append (EmbeddedDriver)
+
+ def GetEmbeddedDriver (self, Index):
+ if Index > len (self._EmbeddedDriverList):
+ raise ValueError
+ return self._EmbeddedDriverList[Index]
+
+ def AddPayload (self, UpdateImageTypeId, Payload = b'', VendorCodeBytes = b'', HardwareInstance = 0, UpdateImageIndex = 1):
+ self._PayloadList.append ((UpdateImageTypeId, Payload, VendorCodeBytes, HardwareInstance, UpdateImageIndex))
+
+ def GetFmpCapsuleImageHeader (self, Index):
+ if Index >= len (self._FmpCapsuleImageHeaderList):
+ raise ValueError
+ return self._FmpCapsuleImageHeaderList[Index]
+
+ def Encode (self):
+ self.EmbeddedDriverCount = len (self._EmbeddedDriverList)
+ self.PayloadItemCount = len (self._PayloadList)
+
+ FmpCapsuleHeader = struct.pack (
+ self._StructFormat,
+ self.Version,
+ self.EmbeddedDriverCount,
+ self.PayloadItemCount
+ )
+
+ FmpCapsuleData = b''
+ Offset = self._StructSize + (self.EmbeddedDriverCount + self.PayloadItemCount) * self._ItemOffsetSize
+ for EmbeddedDriver in self._EmbeddedDriverList:
+ FmpCapsuleData = FmpCapsuleData + EmbeddedDriver
+ self._ItemOffsetList.append (Offset)
+ Offset = Offset + len (EmbeddedDriver)
+ Index = 1
+ for (UpdateImageTypeId, Payload, VendorCodeBytes, HardwareInstance, UpdateImageIndex) in self._PayloadList:
+ FmpCapsuleImageHeader = FmpCapsuleImageHeaderClass ()
+ FmpCapsuleImageHeader.UpdateImageTypeId = UpdateImageTypeId
+ FmpCapsuleImageHeader.UpdateImageIndex = UpdateImageIndex
+ FmpCapsuleImageHeader.Payload = Payload
+ FmpCapsuleImageHeader.VendorCodeBytes = VendorCodeBytes
+ FmpCapsuleImageHeader.UpdateHardwareInstance = HardwareInstance
+ FmpCapsuleImage = FmpCapsuleImageHeader.Encode ()
+ FmpCapsuleData = FmpCapsuleData + FmpCapsuleImage
+
+ self._ItemOffsetList.append (Offset)
+ self._FmpCapsuleImageHeaderList.append (FmpCapsuleImageHeader)
+
+ Offset = Offset + len (FmpCapsuleImage)
+ Index = Index + 1
+
+ for Offset in self._ItemOffsetList:
+ FmpCapsuleHeader = FmpCapsuleHeader + struct.pack (self._ItemOffsetFormat, Offset)
+
+ self._Valid = True
+ return FmpCapsuleHeader + FmpCapsuleData
+
+ def Decode (self, Buffer):
+ if len (Buffer) < self._StructSize:
+ raise ValueError
+ (Version, EmbeddedDriverCount, PayloadItemCount) = \
+ struct.unpack (
+ self._StructFormat,
+ Buffer[0:self._StructSize]
+ )
+ if Version < self.EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER_INIT_VERSION:
+ raise ValueError
+
+ self.Version = Version
+ self.EmbeddedDriverCount = EmbeddedDriverCount
+ self.PayloadItemCount = PayloadItemCount
+ self._ItemOffsetList = []
+ self._EmbeddedDriverList = []
+ self._PayloadList = []
+ self._FmpCapsuleImageHeaderList = []
+
+ #
+ # Parse the ItemOffsetList values
+ #
+ Offset = self._StructSize
+ for Index in range (0, EmbeddedDriverCount + PayloadItemCount):
+ ItemOffset = struct.unpack (self._ItemOffsetFormat, Buffer[Offset:Offset + self._ItemOffsetSize])[0]
+ if ItemOffset >= len (Buffer):
+ raise ValueError
+ self._ItemOffsetList.append (ItemOffset)
+ Offset = Offset + self._ItemOffsetSize
+ Result = Buffer[Offset:]
+
+ #
+ # Parse the EmbeddedDrivers
+ #
+ for Index in range (0, EmbeddedDriverCount):
+ Offset = self._ItemOffsetList[Index]
+ if Index < (len (self._ItemOffsetList) - 1):
+ Length = self._ItemOffsetList[Index + 1] - Offset
+ else:
+ Length = len (Buffer) - Offset
+ self.AddEmbeddedDriver (Buffer[Offset:Offset + Length])
+
+ #
+ # Parse the Payloads that are FMP Capsule Images
+ #
+ for Index in range (EmbeddedDriverCount, EmbeddedDriverCount + PayloadItemCount):
+ Offset = self._ItemOffsetList[Index]
+ if Index < (len (self._ItemOffsetList) - 1):
+ Length = self._ItemOffsetList[Index + 1] - Offset
+ else:
+ Length = len (Buffer) - Offset
+ FmpCapsuleImageHeader = FmpCapsuleImageHeaderClass ()
+ FmpCapsuleImageHeader.Decode (Buffer[Offset:Offset + Length])
+ self.AddPayload (
+ FmpCapsuleImageHeader.UpdateImageTypeId,
+ FmpCapsuleImageHeader.Payload,
+ FmpCapsuleImageHeader.VendorCodeBytes
+ )
+ self._FmpCapsuleImageHeaderList.append (FmpCapsuleImageHeader)
+
+ self._Valid = True
+ return Result
+
+ def DumpInfo (self):
+ if not self._Valid:
+ raise ValueError
+ print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER.Version = {Version:08X}'.format (Version = self.Version))
+ print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER.EmbeddedDriverCount = {EmbeddedDriverCount:08X}'.format (EmbeddedDriverCount = self.EmbeddedDriverCount))
+ for EmbeddedDriver in self._EmbeddedDriverList:
+ print (' sizeof (EmbeddedDriver) = {Size:08X}'.format (Size = len (EmbeddedDriver)))
+ print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER.PayloadItemCount = {PayloadItemCount:08X}'.format (PayloadItemCount = self.PayloadItemCount))
+ print ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER.ItemOffsetList = ')
+ for Offset in self._ItemOffsetList:
+ print (' {Offset:016X}'.format (Offset = Offset))
+ for FmpCapsuleImageHeader in self._FmpCapsuleImageHeaderList:
+ FmpCapsuleImageHeader.DumpInfo ()
diff --git a/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/UefiCapsuleHeader.py b/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/UefiCapsuleHeader.py
new file mode 100644
index 000000000..0e5902869
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/UefiCapsuleHeader.py
@@ -0,0 +1,130 @@
+## @file
+# Module that encodes and decodes a EFI_CAPSULE_HEADER with a payload
+#
+# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+UefiCapsuleHeader
+'''
+
+import struct
+import uuid
+
+class UefiCapsuleHeaderClass (object):
+ # typedef struct {
+ # ///
+ # /// A GUID that defines the contents of a capsule.
+ # ///
+ # EFI_GUID CapsuleGuid;
+ # ///
+ # /// The size of the capsule header. This may be larger than the size of
+ # /// the EFI_CAPSULE_HEADER since CapsuleGuid may imply
+ # /// extended header entries
+ # ///
+ # UINT32 HeaderSize;
+ # ///
+ # /// Bit-mapped list describing the capsule attributes. The Flag values
+ # /// of 0x0000 - 0xFFFF are defined by CapsuleGuid. Flag values
+ # /// of 0x10000 - 0xFFFFFFFF are defined by this specification
+ # ///
+ # UINT32 Flags;
+ # ///
+ # /// Size in bytes of the capsule.
+ # ///
+ # UINT32 CapsuleImageSize;
+ # } EFI_CAPSULE_HEADER;
+ #
+ # #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000
+ # #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000
+ # #define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
+ #
+ _StructFormat = '<16sIIII'
+ _StructSize = struct.calcsize (_StructFormat)
+
+ EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID = uuid.UUID ('6DCBD5ED-E82D-4C44-BDA1-7194199AD92A')
+
+ _CAPSULE_FLAGS_PERSIST_ACROSS_RESET = 0x00010000
+ _CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE = 0x00020000
+ _CAPSULE_FLAGS_INITIATE_RESET = 0x00040000
+
+ def __init__ (self):
+ self._Valid = False
+ self.CapsuleGuid = self.EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID
+ self.HeaderSize = self._StructSize
+ self.OemFlags = 0x0000
+ self.PersistAcrossReset = False
+ self.PopulateSystemTable = False
+ self.InitiateReset = False
+ self.CapsuleImageSize = self.HeaderSize
+ self.Payload = b''
+
+ def Encode (self):
+ Flags = self.OemFlags
+ if self.PersistAcrossReset:
+ Flags = Flags | self._CAPSULE_FLAGS_PERSIST_ACROSS_RESET
+ if self.PopulateSystemTable:
+ Flags = Flags | self._CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE
+ if self.InitiateReset:
+ Flags = Flags | self._CAPSULE_FLAGS_INITIATE_RESET
+
+ self.CapsuleImageSize = self.HeaderSize + len (self.Payload)
+
+ UefiCapsuleHeader = struct.pack (
+ self._StructFormat,
+ self.CapsuleGuid.bytes_le,
+ self.HeaderSize,
+ Flags,
+ self.CapsuleImageSize,
+ 0
+ )
+ self._Valid = True
+ return UefiCapsuleHeader + self.Payload
+
+ def Decode (self, Buffer):
+ if len (Buffer) < self._StructSize:
+ raise ValueError
+ (CapsuleGuid, HeaderSize, Flags, CapsuleImageSize, Reserved) = \
+ struct.unpack (
+ self._StructFormat,
+ Buffer[0:self._StructSize]
+ )
+ if HeaderSize < self._StructSize:
+ raise ValueError
+ if CapsuleImageSize != len (Buffer):
+ raise ValueError
+ self.CapsuleGuid = uuid.UUID (bytes_le = CapsuleGuid)
+ self.HeaderSize = HeaderSize
+ self.OemFlags = Flags & 0xffff
+ self.PersistAcrossReset = (Flags & self._CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0
+ self.PopulateSystemTable = (Flags & self._CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) != 0
+ self.InitiateReset = (Flags & self._CAPSULE_FLAGS_INITIATE_RESET) != 0
+ self.CapsuleImageSize = CapsuleImageSize
+ self.Payload = Buffer[self.HeaderSize:]
+
+ self._Valid = True
+ return self.Payload
+
+ def DumpInfo (self):
+ if not self._Valid:
+ raise ValueError
+ Flags = self.OemFlags
+ if self.PersistAcrossReset:
+ Flags = Flags | self._CAPSULE_FLAGS_PERSIST_ACROSS_RESET
+ if self.PopulateSystemTable:
+ Flags = Flags | self._CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE
+ if self.InitiateReset:
+ Flags = Flags | self._CAPSULE_FLAGS_INITIATE_RESET
+ print ('EFI_CAPSULE_HEADER.CapsuleGuid = {Guid}'.format (Guid = str(self.CapsuleGuid).upper()))
+ print ('EFI_CAPSULE_HEADER.HeaderSize = {Size:08X}'.format (Size = self.HeaderSize))
+ print ('EFI_CAPSULE_HEADER.Flags = {Flags:08X}'.format (Flags = Flags))
+ print (' OEM Flags = {Flags:04X}'.format (Flags = self.OemFlags))
+ if self.PersistAcrossReset:
+ print (' CAPSULE_FLAGS_PERSIST_ACROSS_RESET')
+ if self.PopulateSystemTable:
+ print (' CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE')
+ if self.InitiateReset:
+ print (' CAPSULE_FLAGS_INITIATE_RESET')
+ print ('EFI_CAPSULE_HEADER.CapsuleImageSize = {Size:08X}'.format (Size = self.CapsuleImageSize))
+ print ('sizeof (Payload) = {Size:08X}'.format (Size = len (self.Payload)))
diff --git a/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/__init__.py b/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/__init__.py
new file mode 100644
index 000000000..329adcd51
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/Uefi/Capsule/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'Common.Uefi.Capsule' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/Common/Uefi/__init__.py b/roms/edk2/BaseTools/Source/Python/Common/Uefi/__init__.py
new file mode 100644
index 000000000..213883d04
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/Uefi/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'Common.Uefi' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/Common/VariableAttributes.py b/roms/edk2/BaseTools/Source/Python/Common/VariableAttributes.py
new file mode 100644
index 000000000..90c43f87d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/VariableAttributes.py
@@ -0,0 +1,51 @@
+# # @file
+#
+# This file is used to handle the variable attributes and property information
+#
+#
+# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+class VariableAttributes(object):
+ EFI_VARIABLE_NON_VOLATILE = 0x00000001
+ EFI_VARIABLE_BOOTSERVICE_ACCESS = 0x00000002
+ EFI_VARIABLE_RUNTIME_ACCESS = 0x00000004
+ VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY = 0x00000001
+ VarAttributesMap = {
+ "NV":EFI_VARIABLE_NON_VOLATILE,
+ "BS":EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ "RT":EFI_VARIABLE_RUNTIME_ACCESS,
+ "RO":VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY
+ }
+
+ def __init__(self):
+ pass
+
+ @staticmethod
+ def GetVarAttributes(var_attr_str):
+ VarAttr = 0x00000000
+ VarProp = 0x00000000
+
+ attr_list = var_attr_str.split(",")
+ for attr in attr_list:
+ attr = attr.strip()
+ if attr == 'RO':
+ VarProp = VariableAttributes.VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY
+ else:
+ VarAttr = VarAttr | VariableAttributes.VarAttributesMap.get(attr, 0x00000000)
+ return VarAttr, VarProp
+ @staticmethod
+ def ValidateVarAttributes(var_attr_str):
+ if not var_attr_str:
+ return True, ""
+ attr_list = var_attr_str.split(",")
+ attr_temp = []
+ for attr in attr_list:
+ attr = attr.strip()
+ attr_temp.append(attr)
+ if attr not in VariableAttributes.VarAttributesMap:
+ return False, "The variable attribute %s is not support to be specified in dsc file. Supported variable attribute are ['BS','NV','RT','RO'] "
+ if 'RT' in attr_temp and 'BS' not in attr_temp:
+ return False, "the RT attribute need the BS attribute to be present"
+ return True, ""
diff --git a/roms/edk2/BaseTools/Source/Python/Common/VpdInfoFile.py b/roms/edk2/BaseTools/Source/Python/Common/VpdInfoFile.py
new file mode 100644
index 000000000..4249b9f89
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/VpdInfoFile.py
@@ -0,0 +1,255 @@
+## @file
+#
+# This package manage the VPD PCD information file which will be generated
+# by build tool's autogen.
+# The VPD PCD information file will be input for third-party BPDG tool which
+# is pointed by *_*_*_VPD_TOOL_GUID in conf/tools_def.txt
+#
+#
+# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+from __future__ import print_function
+import Common.LongFilePathOs as os
+import re
+import Common.EdkLogger as EdkLogger
+import Common.BuildToolError as BuildToolError
+import subprocess
+import Common.GlobalData as GlobalData
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.Misc import SaveFileOnChange
+from Common.DataType import *
+
+FILE_COMMENT_TEMPLATE = \
+"""
+## @file
+#
+# THIS IS AUTO-GENERATED FILE BY BUILD TOOLS AND PLEASE DO NOT MAKE MODIFICATION.
+#
+# This file lists all VPD informations for a platform collected by build.exe.
+#
+# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+
+"""
+
+## The class manage VpdInfoFile.
+#
+# This file contains an ordered (based on position in the DSC file) list of the PCDs specified in the platform description file (DSC). The Value field that will be assigned to the PCD comes from the DSC file, INF file (if not defined in the DSC file) or the DEC file (if not defined in the INF file). This file is used as an input to the BPDG tool.
+# Format for this file (using EBNF notation) is:
+# <File> :: = [<CommentBlock>]
+# [<PcdEntry>]*
+# <CommentBlock> ::= ["#" <String> <EOL>]*
+# <PcdEntry> ::= <PcdName> "|" <Offset> "|" <Size> "|" <Value> <EOL>
+# <PcdName> ::= <TokenSpaceCName> "." <PcdCName>
+# <TokenSpaceCName> ::= C Variable Name of the Token Space GUID
+# <PcdCName> ::= C Variable Name of the PCD
+# <Offset> ::= {TAB_STAR} {<HexNumber>}
+# <HexNumber> ::= "0x" (a-fA-F0-9){1,8}
+# <Size> ::= <HexNumber>
+# <Value> ::= {<HexNumber>} {<NonNegativeInt>} {<QString>} {<Array>}
+# <NonNegativeInt> ::= (0-9)+
+# <QString> ::= ["L"] <DblQuote> <String> <DblQuote>
+# <DblQuote> ::= 0x22
+# <Array> ::= {<CArray>} {<NList>}
+# <CArray> ::= "{" <HexNumber> ["," <HexNumber>]* "}"
+# <NList> ::= <HexNumber> ["," <HexNumber>]*
+#
+class VpdInfoFile:
+
+ _rVpdPcdLine = None
+ ## Constructor
+ def __init__(self):
+ ## Dictionary for VPD in following format
+ #
+ # Key : PcdClassObject instance.
+ # @see BuildClassObject.PcdClassObject
+ # Value : offset in different SKU such as [sku1_offset, sku2_offset]
+ self._VpdArray = {}
+ self._VpdInfo = {}
+
+ ## Add a VPD PCD collected from platform's autogen when building.
+ #
+ # @param vpds The list of VPD PCD collected for a platform.
+ # @see BuildClassObject.PcdClassObject
+ #
+ # @param offset integer value for VPD's offset in specific SKU.
+ #
+ def Add(self, Vpd, skuname, Offset):
+ if (Vpd is None):
+ EdkLogger.error("VpdInfoFile", BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
+
+ if not (Offset >= "0" or Offset == TAB_STAR):
+ EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID, "Invalid offset parameter: %s." % Offset)
+
+ if Vpd.DatumType == TAB_VOID:
+ if Vpd.MaxDatumSize <= "0":
+ EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID,
+ "Invalid max datum size for VPD PCD %s.%s" % (Vpd.TokenSpaceGuidCName, Vpd.TokenCName))
+ elif Vpd.DatumType in TAB_PCD_NUMERIC_TYPES:
+ if not Vpd.MaxDatumSize:
+ Vpd.MaxDatumSize = MAX_SIZE_TYPE[Vpd.DatumType]
+ else:
+ if Vpd.MaxDatumSize <= "0":
+ EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID,
+ "Invalid max datum size for VPD PCD %s.%s" % (Vpd.TokenSpaceGuidCName, Vpd.TokenCName))
+
+ if Vpd not in self._VpdArray:
+ #
+ # If there is no Vpd instance in dict, that imply this offset for a given SKU is a new one
+ #
+ self._VpdArray[Vpd] = {}
+
+ self._VpdArray[Vpd].update({skuname:Offset})
+
+
+ ## Generate VPD PCD information into a text file
+ #
+ # If parameter FilePath is invalid, then assert.
+ # If
+ # @param FilePath The given file path which would hold VPD information
+ def Write(self, FilePath):
+ if not (FilePath is not None or len(FilePath) != 0):
+ EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID,
+ "Invalid parameter FilePath: %s." % FilePath)
+
+ Content = FILE_COMMENT_TEMPLATE
+ Pcds = sorted(self._VpdArray.keys(), key=lambda x: x.TokenCName)
+ for Pcd in Pcds:
+ i = 0
+ PcdTokenCName = Pcd.TokenCName
+ for PcdItem in GlobalData.MixedPcd:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ PcdTokenCName = PcdItem[0]
+ for skuname in self._VpdArray[Pcd]:
+ PcdValue = str(Pcd.SkuInfoList[skuname].DefaultValue).strip()
+ if PcdValue == "" :
+ PcdValue = Pcd.DefaultValue
+
+ Content += "%s.%s|%s|%s|%s|%s \n" % (Pcd.TokenSpaceGuidCName, PcdTokenCName, skuname, str(self._VpdArray[Pcd][skuname]).strip(), str(Pcd.MaxDatumSize).strip(), PcdValue)
+ i += 1
+
+ return SaveFileOnChange(FilePath, Content, False)
+
+ ## Read an existing VPD PCD info file.
+ #
+ # This routine will read VPD PCD information from existing file and construct
+ # internal PcdClassObject array.
+ # This routine could be used by third-party tool to parse VPD info file content.
+ #
+ # @param FilePath The full path string for existing VPD PCD info file.
+ def Read(self, FilePath):
+ try:
+ fd = open(FilePath, "r")
+ except:
+ EdkLogger.error("VpdInfoFile",
+ BuildToolError.FILE_OPEN_FAILURE,
+ "Fail to open file %s for written." % FilePath)
+ Lines = fd.readlines()
+ for Line in Lines:
+ Line = Line.strip()
+ if len(Line) == 0 or Line.startswith("#"):
+ continue
+
+ #
+ # the line must follow output format defined in BPDG spec.
+ #
+ try:
+ PcdName, SkuId, Offset, Size, Value = Line.split("#")[0].split("|")
+ PcdName, SkuId, Offset, Size, Value = PcdName.strip(), SkuId.strip(), Offset.strip(), Size.strip(), Value.strip()
+ TokenSpaceName, PcdTokenName = PcdName.split(".")
+ except:
+ EdkLogger.error("BPDG", BuildToolError.PARSER_ERROR, "Fail to parse VPD information file %s" % FilePath)
+
+ Found = False
+
+ if (TokenSpaceName, PcdTokenName) not in self._VpdInfo:
+ self._VpdInfo[(TokenSpaceName, PcdTokenName)] = {}
+ self._VpdInfo[(TokenSpaceName, PcdTokenName)][(SkuId, Offset)] = Value
+ for VpdObject in self._VpdArray:
+ VpdObjectTokenCName = VpdObject.TokenCName
+ for PcdItem in GlobalData.MixedPcd:
+ if (VpdObject.TokenCName, VpdObject.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ VpdObjectTokenCName = PcdItem[0]
+ for sku in VpdObject.SkuInfoList:
+ if VpdObject.TokenSpaceGuidCName == TokenSpaceName and VpdObjectTokenCName == PcdTokenName.strip() and sku == SkuId:
+ if self._VpdArray[VpdObject][sku] == TAB_STAR:
+ if Offset == TAB_STAR:
+ EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed up by third-party BPDG tool." % PcdName)
+ self._VpdArray[VpdObject][sku] = Offset
+ Found = True
+ if not Found:
+ EdkLogger.error("BPDG", BuildToolError.PARSER_ERROR, "Can not find PCD defined in VPD guid file.")
+
+ ## Get count of VPD PCD collected from platform's autogen when building.
+ #
+ # @return The integer count value
+ def GetCount(self):
+ Count = 0
+ for OffsetList in self._VpdArray.values():
+ Count += len(OffsetList)
+
+ return Count
+
+ ## Get an offset value for a given VPD PCD
+ #
+ # Because BPDG only support one Sku, so only return offset for SKU default.
+ #
+ # @param vpd A given VPD PCD
+ def GetOffset(self, vpd):
+ if vpd not in self._VpdArray:
+ return None
+
+ if len(self._VpdArray[vpd]) == 0:
+ return None
+
+ return self._VpdArray[vpd]
+ def GetVpdInfo(self, arg):
+ (PcdTokenName, TokenSpaceName) = arg
+ return [(sku,offset,value) for (sku,offset),value in self._VpdInfo.get((TokenSpaceName, PcdTokenName)).items()]
+
+## Call external BPDG tool to process VPD file
+#
+# @param ToolPath The string path name for BPDG tool
+# @param VpdFileName The string path name for VPD information guid.txt
+#
+def CallExtenalBPDGTool(ToolPath, VpdFileName):
+ assert ToolPath is not None, "Invalid parameter ToolPath"
+ assert VpdFileName is not None and os.path.exists(VpdFileName), "Invalid parameter VpdFileName"
+
+ OutputDir = os.path.dirname(VpdFileName)
+ FileName = os.path.basename(VpdFileName)
+ BaseName, ext = os.path.splitext(FileName)
+ OutputMapFileName = os.path.join(OutputDir, "%s.map" % BaseName)
+ OutputBinFileName = os.path.join(OutputDir, "%s.bin" % BaseName)
+
+ try:
+ PopenObject = subprocess.Popen(' '.join([ToolPath,
+ '-o', OutputBinFileName,
+ '-m', OutputMapFileName,
+ '-q',
+ '-f',
+ VpdFileName]),
+ stdout=subprocess.PIPE,
+ stderr= subprocess.PIPE,
+ shell=True)
+ except Exception as X:
+ EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData=str(X))
+ (out, error) = PopenObject.communicate()
+ print(out.decode())
+ while PopenObject.returncode is None :
+ PopenObject.wait()
+
+ if PopenObject.returncode != 0:
+ EdkLogger.debug(EdkLogger.DEBUG_1, "Fail to call BPDG tool", str(error))
+ EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, "Fail to execute BPDG tool with exit code: %d, the error message is: \n %s" % \
+ (PopenObject.returncode, str(error)))
+
+ return PopenObject.returncode
diff --git a/roms/edk2/BaseTools/Source/Python/Common/__init__.py b/roms/edk2/BaseTools/Source/Python/Common/__init__.py
new file mode 100644
index 000000000..7aaef6ae3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'Common' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/Common/caching.py b/roms/edk2/BaseTools/Source/Python/Common/caching.py
new file mode 100644
index 000000000..fda30f732
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Common/caching.py
@@ -0,0 +1,41 @@
+## @file
+# help with caching in BaseTools
+#
+# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+## Import Modules
+#
+
+# for class function
+class cached_class_function(object):
+ def __init__(self, function):
+ self._function = function
+ def __get__(self, obj, cls):
+ def CallMeHere(*args,**kwargs):
+ Value = self._function(obj, *args,**kwargs)
+ obj.__dict__[self._function.__name__] = lambda *args,**kwargs:Value
+ return Value
+ return CallMeHere
+
+# for class property
+class cached_property(object):
+ def __init__(self, function):
+ self._function = function
+ def __get__(self, obj, cls):
+ Value = obj.__dict__[self._function.__name__] = self._function(obj)
+ return Value
+
+# for non-class function
+class cached_basic_function(object):
+ def __init__(self, function):
+ self._function = function
+ # wrapper to call _do since <class>.__dict__ doesn't support changing __call__
+ def __call__(self,*args,**kwargs):
+ return self._do(*args,**kwargs)
+ def _do(self,*args,**kwargs):
+ Value = self._function(*args,**kwargs)
+ self.__dict__['_do'] = lambda self,*args,**kwargs:Value
+ return Value
diff --git a/roms/edk2/BaseTools/Source/Python/CommonDataClass/CommonClass.py b/roms/edk2/BaseTools/Source/Python/CommonDataClass/CommonClass.py
new file mode 100644
index 000000000..bcf52c7b7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/CommonDataClass/CommonClass.py
@@ -0,0 +1,91 @@
+## @file
+# This file is used to define common items of class object
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+
+## SkuInfoClass
+#
+# This class defined SkuInfo item used in Module/Platform/Package files
+#
+# @param object: Inherited from object class
+# @param SkuIdName: Input value for SkuIdName, default is ''
+# @param SkuId: Input value for SkuId, default is ''
+# @param VariableName: Input value for VariableName, default is ''
+# @param VariableGuid: Input value for VariableGuid, default is ''
+# @param VariableOffset: Input value for VariableOffset, default is ''
+# @param HiiDefaultValue: Input value for HiiDefaultValue, default is ''
+# @param VpdOffset: Input value for VpdOffset, default is ''
+# @param DefaultValue: Input value for DefaultValue, default is ''
+#
+# @var SkuIdName: To store value for SkuIdName
+# @var SkuId: To store value for SkuId
+# @var VariableName: To store value for VariableName
+# @var VariableGuid: To store value for VariableGuid
+# @var VariableOffset: To store value for VariableOffset
+# @var HiiDefaultValue: To store value for HiiDefaultValue
+# @var VpdOffset: To store value for VpdOffset
+# @var DefaultValue: To store value for DefaultValue
+#
+class SkuInfoClass(object):
+ def __init__(self, SkuIdName = '', SkuId = '', VariableName = '', VariableGuid = '', VariableOffset = '',
+ HiiDefaultValue = '', VpdOffset = '', DefaultValue = '', VariableGuidValue = '', VariableAttribute = '', DefaultStore = None):
+ self.SkuIdName = SkuIdName
+ self.SkuId = SkuId
+
+ #
+ # Used by Hii
+ #
+ if DefaultStore is None:
+ DefaultStore = {}
+ self.VariableName = VariableName
+ self.VariableGuid = VariableGuid
+ self.VariableGuidValue = VariableGuidValue
+ self.VariableOffset = VariableOffset
+ self.HiiDefaultValue = HiiDefaultValue
+ self.VariableAttribute = VariableAttribute
+ self.DefaultStoreDict = DefaultStore
+
+ #
+ # Used by Vpd
+ #
+ self.VpdOffset = VpdOffset
+
+ #
+ # Used by Default
+ #
+ self.DefaultValue = DefaultValue
+
+ ## Convert the class to a string
+ #
+ # Convert each member of the class to string
+ # Organize to a single line format string
+ #
+ # @retval Rtn Formatted String
+ #
+ def __str__(self):
+ Rtn = 'SkuId = ' + str(self.SkuId) + "," + \
+ 'SkuIdName = ' + str(self.SkuIdName) + "," + \
+ 'VariableName = ' + str(self.VariableName) + "," + \
+ 'VariableGuid = ' + str(self.VariableGuid) + "," + \
+ 'VariableOffset = ' + str(self.VariableOffset) + "," + \
+ 'HiiDefaultValue = ' + str(self.HiiDefaultValue) + "," + \
+ 'VpdOffset = ' + str(self.VpdOffset) + "," + \
+ 'DefaultValue = ' + str(self.DefaultValue) + ","
+ return Rtn
+
+ def __deepcopy__(self,memo):
+ new_sku = SkuInfoClass()
+ new_sku.SkuIdName = self.SkuIdName
+ new_sku.SkuId = self.SkuId
+ new_sku.VariableName = self.VariableName
+ new_sku.VariableGuid = self.VariableGuid
+ new_sku.VariableGuidValue = self.VariableGuidValue
+ new_sku.VariableOffset = self.VariableOffset
+ new_sku.HiiDefaultValue = self.HiiDefaultValue
+ new_sku.VariableAttribute = self.VariableAttribute
+ new_sku.DefaultStoreDict = {key:value for key,value in self.DefaultStoreDict.items()}
+ new_sku.VpdOffset = self.VpdOffset
+ new_sku.DefaultValue = self.DefaultValue
+ return new_sku
diff --git a/roms/edk2/BaseTools/Source/Python/CommonDataClass/DataClass.py b/roms/edk2/BaseTools/Source/Python/CommonDataClass/DataClass.py
new file mode 100644
index 000000000..6f35bd4c8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/CommonDataClass/DataClass.py
@@ -0,0 +1,369 @@
+## @file
+# This file is used to define class for data structure used in ECC
+#
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+##
+# Import Modules
+#
+import Common.EdkLogger as EdkLogger
+
+##
+# Static values for data models
+#
+MODEL_UNKNOWN = 0
+
+MODEL_FILE_C = 1001
+MODEL_FILE_H = 1002
+MODEL_FILE_ASM = 1003
+MODEL_FILE_INF = 1011
+MODEL_FILE_DEC = 1012
+MODEL_FILE_DSC = 1013
+MODEL_FILE_FDF = 1014
+MODEL_FILE_INC = 1015
+MODEL_FILE_CIF = 1016
+MODEL_FILE_UNI = 1017
+MODEL_FILE_OTHERS = 1099
+
+MODEL_IDENTIFIER_FILE_HEADER = 2001
+MODEL_IDENTIFIER_FUNCTION_HEADER = 2002
+MODEL_IDENTIFIER_COMMENT = 2003
+MODEL_IDENTIFIER_PARAMETER = 2004
+MODEL_IDENTIFIER_STRUCTURE = 2005
+MODEL_IDENTIFIER_VARIABLE = 2006
+MODEL_IDENTIFIER_INCLUDE = 2007
+MODEL_IDENTIFIER_PREDICATE_EXPRESSION = 2008
+MODEL_IDENTIFIER_ENUMERATE = 2009
+MODEL_IDENTIFIER_PCD = 2010
+MODEL_IDENTIFIER_UNION = 2011
+MODEL_IDENTIFIER_MACRO_IFDEF = 2012
+MODEL_IDENTIFIER_MACRO_IFNDEF = 2013
+MODEL_IDENTIFIER_MACRO_DEFINE = 2014
+MODEL_IDENTIFIER_MACRO_ENDIF = 2015
+MODEL_IDENTIFIER_MACRO_PROGMA = 2016
+MODEL_IDENTIFIER_FUNCTION_CALLING = 2018
+MODEL_IDENTIFIER_TYPEDEF = 2017
+MODEL_IDENTIFIER_FUNCTION_DECLARATION = 2019
+MODEL_IDENTIFIER_ASSIGNMENT_EXPRESSION = 2020
+
+MODEL_EFI_PROTOCOL = 3001
+MODEL_EFI_PPI = 3002
+MODEL_EFI_GUID = 3003
+MODEL_EFI_LIBRARY_CLASS = 3004
+MODEL_EFI_LIBRARY_INSTANCE = 3005
+MODEL_EFI_PCD = 3006
+MODEL_EFI_SOURCE_FILE = 3007
+MODEL_EFI_BINARY_FILE = 3008
+MODEL_EFI_SKU_ID = 3009
+MODEL_EFI_INCLUDE = 3010
+MODEL_EFI_DEPEX = 3011
+MODEL_EFI_DEFAULT_STORES = 3012
+
+MODEL_PCD = 4000
+MODEL_PCD_FIXED_AT_BUILD = 4001
+MODEL_PCD_PATCHABLE_IN_MODULE = 4002
+MODEL_PCD_FEATURE_FLAG = 4003
+MODEL_PCD_DYNAMIC_EX = 4004
+MODEL_PCD_DYNAMIC_EX_DEFAULT = 4005
+MODEL_PCD_DYNAMIC_EX_VPD = 4006
+MODEL_PCD_DYNAMIC_EX_HII = 4007
+MODEL_PCD_DYNAMIC = 4008
+MODEL_PCD_DYNAMIC_DEFAULT = 4009
+MODEL_PCD_DYNAMIC_VPD = 4010
+MODEL_PCD_DYNAMIC_HII = 4011
+MODEL_PCD_TYPE_LIST = [MODEL_PCD_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC_DEFAULT,
+ MODEL_PCD_DYNAMIC_HII,
+ MODEL_PCD_DYNAMIC_VPD,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT,
+ MODEL_PCD_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD
+ ]
+
+MODEL_META_DATA_HEADER_COMMENT = 5000
+MODEL_META_DATA_HEADER = 5001
+MODEL_META_DATA_INCLUDE = 5002
+MODEL_META_DATA_DEFINE = 5003
+MODEL_META_DATA_CONDITIONAL_STATEMENT_IF = 5004
+MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE = 5005
+MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF = 5006
+MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF = 5007
+MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR = 5400
+MODEL_META_DATA_BUILD_OPTION = 5008
+MODEL_META_DATA_COMPONENT = 5009
+MODEL_META_DATA_USER_EXTENSION = 5010
+MODEL_META_DATA_PACKAGE = 5011
+MODEL_META_DATA_NMAKE = 5012
+MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF = 5013
+MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF = 5014
+MODEL_META_DATA_COMMENT = 5016
+MODEL_META_DATA_GLOBAL_DEFINE = 5017
+MODEL_META_DATA_SECTION_HEADER = 5100
+MODEL_META_DATA_SUBSECTION_HEADER = 5200
+MODEL_META_DATA_TAIL_COMMENT = 5300
+
+MODEL_EXTERNAL_DEPENDENCY = 10000
+
+MODEL_LIST = [('MODEL_UNKNOWN', MODEL_UNKNOWN),
+ ('MODEL_FILE_C', MODEL_FILE_C),
+ ('MODEL_FILE_H', MODEL_FILE_H),
+ ('MODEL_FILE_ASM', MODEL_FILE_ASM),
+ ('MODEL_FILE_INF', MODEL_FILE_INF),
+ ('MODEL_FILE_DEC', MODEL_FILE_DEC),
+ ('MODEL_FILE_DSC', MODEL_FILE_DSC),
+ ('MODEL_FILE_FDF', MODEL_FILE_FDF),
+ ('MODEL_FILE_INC', MODEL_FILE_INC),
+ ('MODEL_FILE_CIF', MODEL_FILE_CIF),
+ ('MODEL_FILE_OTHERS', MODEL_FILE_OTHERS),
+ ('MODEL_IDENTIFIER_FILE_HEADER', MODEL_IDENTIFIER_FILE_HEADER),
+ ('MODEL_IDENTIFIER_FUNCTION_HEADER', MODEL_IDENTIFIER_FUNCTION_HEADER),
+ ('MODEL_IDENTIFIER_COMMENT', MODEL_IDENTIFIER_COMMENT),
+ ('MODEL_IDENTIFIER_PARAMETER', MODEL_IDENTIFIER_PARAMETER),
+ ('MODEL_IDENTIFIER_STRUCTURE', MODEL_IDENTIFIER_STRUCTURE),
+ ('MODEL_IDENTIFIER_VARIABLE', MODEL_IDENTIFIER_VARIABLE),
+ ('MODEL_IDENTIFIER_INCLUDE', MODEL_IDENTIFIER_INCLUDE),
+ ('MODEL_IDENTIFIER_PREDICATE_EXPRESSION', MODEL_IDENTIFIER_PREDICATE_EXPRESSION),
+ ('MODEL_IDENTIFIER_ENUMERATE', MODEL_IDENTIFIER_ENUMERATE),
+ ('MODEL_IDENTIFIER_PCD', MODEL_IDENTIFIER_PCD),
+ ('MODEL_IDENTIFIER_UNION', MODEL_IDENTIFIER_UNION),
+ ('MODEL_IDENTIFIER_MACRO_IFDEF', MODEL_IDENTIFIER_MACRO_IFDEF),
+ ('MODEL_IDENTIFIER_MACRO_IFNDEF', MODEL_IDENTIFIER_MACRO_IFNDEF),
+ ('MODEL_IDENTIFIER_MACRO_DEFINE', MODEL_IDENTIFIER_MACRO_DEFINE),
+ ('MODEL_IDENTIFIER_MACRO_ENDIF', MODEL_IDENTIFIER_MACRO_ENDIF),
+ ('MODEL_IDENTIFIER_MACRO_PROGMA', MODEL_IDENTIFIER_MACRO_PROGMA),
+ ('MODEL_IDENTIFIER_FUNCTION_CALLING', MODEL_IDENTIFIER_FUNCTION_CALLING),
+ ('MODEL_IDENTIFIER_TYPEDEF', MODEL_IDENTIFIER_TYPEDEF),
+ ('MODEL_IDENTIFIER_FUNCTION_DECLARATION', MODEL_IDENTIFIER_FUNCTION_DECLARATION),
+ ('MODEL_IDENTIFIER_ASSIGNMENT_EXPRESSION', MODEL_IDENTIFIER_ASSIGNMENT_EXPRESSION),
+ ('MODEL_EFI_PROTOCOL', MODEL_EFI_PROTOCOL),
+ ('MODEL_EFI_PPI', MODEL_EFI_PPI),
+ ('MODEL_EFI_GUID', MODEL_EFI_GUID),
+ ('MODEL_EFI_LIBRARY_CLASS', MODEL_EFI_LIBRARY_CLASS),
+ ('MODEL_EFI_LIBRARY_INSTANCE', MODEL_EFI_LIBRARY_INSTANCE),
+ ('MODEL_EFI_PCD', MODEL_EFI_PCD),
+ ('MODEL_EFI_SKU_ID', MODEL_EFI_SKU_ID),
+ ('MODEL_EFI_INCLUDE', MODEL_EFI_INCLUDE),
+ ('MODEL_EFI_DEPEX', MODEL_EFI_DEPEX),
+ ('MODEL_IDENTIFIER_UNION', MODEL_IDENTIFIER_UNION),
+ ('MODEL_EFI_SOURCE_FILE', MODEL_EFI_SOURCE_FILE),
+ ('MODEL_EFI_BINARY_FILE', MODEL_EFI_BINARY_FILE),
+ ('MODEL_PCD', MODEL_PCD),
+ ('MODEL_PCD_FIXED_AT_BUILD', MODEL_PCD_FIXED_AT_BUILD),
+ ('MODEL_PCD_PATCHABLE_IN_MODULE', MODEL_PCD_PATCHABLE_IN_MODULE),
+ ('MODEL_PCD_FEATURE_FLAG', MODEL_PCD_FEATURE_FLAG),
+ ('MODEL_PCD_DYNAMIC_EX', MODEL_PCD_DYNAMIC_EX),
+ ('MODEL_PCD_DYNAMIC_EX_DEFAULT', MODEL_PCD_DYNAMIC_EX_DEFAULT),
+ ('MODEL_PCD_DYNAMIC_EX_VPD', MODEL_PCD_DYNAMIC_EX_VPD),
+ ('MODEL_PCD_DYNAMIC_EX_HII', MODEL_PCD_DYNAMIC_EX_HII),
+ ('MODEL_PCD_DYNAMIC', MODEL_PCD_DYNAMIC),
+ ('MODEL_PCD_DYNAMIC_DEFAULT', MODEL_PCD_DYNAMIC_DEFAULT),
+ ('MODEL_PCD_DYNAMIC_VPD', MODEL_PCD_DYNAMIC_VPD),
+ ('MODEL_PCD_DYNAMIC_HII', MODEL_PCD_DYNAMIC_HII),
+ ("MODEL_META_DATA_HEADER", MODEL_META_DATA_HEADER),
+ ("MODEL_META_DATA_INCLUDE", MODEL_META_DATA_INCLUDE),
+ ("MODEL_META_DATA_DEFINE", MODEL_META_DATA_DEFINE),
+ ("MODEL_META_DATA_CONDITIONAL_STATEMENT_IF", MODEL_META_DATA_CONDITIONAL_STATEMENT_IF),
+ ("MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE", MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE),
+ ("MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF", MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF),
+ ("MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF", MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF),
+ ("MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR", MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR),
+ ("MODEL_META_DATA_BUILD_OPTION", MODEL_META_DATA_BUILD_OPTION),
+ ("MODEL_META_DATA_COMPONENT", MODEL_META_DATA_COMPONENT),
+ ('MODEL_META_DATA_USER_EXTENSION', MODEL_META_DATA_USER_EXTENSION),
+ ('MODEL_META_DATA_PACKAGE', MODEL_META_DATA_PACKAGE),
+ ('MODEL_META_DATA_NMAKE', MODEL_META_DATA_NMAKE),
+ ('MODEL_META_DATA_COMMENT', MODEL_META_DATA_COMMENT)
+ ]
+
+## FunctionClass
+#
+# This class defines a structure of a function
+#
+# @param ID: ID of a Function
+# @param Header: Header of a Function
+# @param Modifier: Modifier of a Function
+# @param Name: Name of a Function
+# @param ReturnStatement: ReturnStatement of a Function
+# @param StartLine: StartLine of a Function
+# @param StartColumn: StartColumn of a Function
+# @param EndLine: EndLine of a Function
+# @param EndColumn: EndColumn of a Function
+# @param BodyStartLine: BodyStartLine of a Function Body
+# @param BodyStartColumn: BodyStartColumn of a Function Body
+# @param BelongsToFile: The Function belongs to which file
+# @param IdentifierList: IdentifierList of a File
+# @param PcdList: PcdList of a File
+#
+# @var ID: ID of a Function
+# @var Header: Header of a Function
+# @var Modifier: Modifier of a Function
+# @var Name: Name of a Function
+# @var ReturnStatement: ReturnStatement of a Function
+# @var StartLine: StartLine of a Function
+# @var StartColumn: StartColumn of a Function
+# @var EndLine: EndLine of a Function
+# @var EndColumn: EndColumn of a Function
+# @var BodyStartLine: StartLine of a Function Body
+# @var BodyStartColumn: StartColumn of a Function Body
+# @var BelongsToFile: The Function belongs to which file
+# @var IdentifierList: IdentifierList of a File
+# @var PcdList: PcdList of a File
+#
+class FunctionClass(object):
+ def __init__(self, ID = -1, Header = '', Modifier = '', Name = '', ReturnStatement = '', \
+ StartLine = -1, StartColumn = -1, EndLine = -1, EndColumn = -1, \
+ BodyStartLine = -1, BodyStartColumn = -1, BelongsToFile = -1, \
+ IdentifierList = [], PcdList = [], \
+ FunNameStartLine = -1, FunNameStartColumn = -1):
+ self.ID = ID
+ self.Header = Header
+ self.Modifier = Modifier
+ self.Name = Name
+ self.ReturnStatement = ReturnStatement
+ self.StartLine = StartLine
+ self.StartColumn = StartColumn
+ self.EndLine = EndLine
+ self.EndColumn = EndColumn
+ self.BodyStartLine = BodyStartLine
+ self.BodyStartColumn = BodyStartColumn
+ self.BelongsToFile = BelongsToFile
+ self.FunNameStartLine = FunNameStartLine
+ self.FunNameStartColumn = FunNameStartColumn
+
+ self.IdentifierList = IdentifierList
+ self.PcdList = PcdList
+
+## IdentifierClass
+#
+# This class defines a structure of a variable
+#
+# @param ID: ID of a Identifier
+# @param Modifier: Modifier of a Identifier
+# @param Type: Type of a Identifier
+# @param Name: Name of a Identifier
+# @param Value: Value of a Identifier
+# @param Model: Model of a Identifier
+# @param BelongsToFile: The Identifier belongs to which file
+# @param BelongsToFunction: The Identifier belongs to which function
+# @param StartLine: StartLine of a Identifier
+# @param StartColumn: StartColumn of a Identifier
+# @param EndLine: EndLine of a Identifier
+# @param EndColumn: EndColumn of a Identifier
+#
+# @var ID: ID of a Identifier
+# @var Modifier: Modifier of a Identifier
+# @var Type: Type of a Identifier
+# @var Name: Name of a Identifier
+# @var Value: Value of a Identifier
+# @var Model: Model of a Identifier
+# @var BelongsToFile: The Identifier belongs to which file
+# @var BelongsToFunction: The Identifier belongs to which function
+# @var StartLine: StartLine of a Identifier
+# @var StartColumn: StartColumn of a Identifier
+# @var EndLine: EndLine of a Identifier
+# @var EndColumn: EndColumn of a Identifier
+#
+class IdentifierClass(object):
+ def __init__(self, ID = -1, Modifier = '', Type = '', Name = '', Value = '', Model = MODEL_UNKNOWN, \
+ BelongsToFile = -1, BelongsToFunction = -1, StartLine = -1, StartColumn = -1, EndLine = -1, EndColumn = -1):
+ self.ID = ID
+ self.Modifier = Modifier
+ self.Type = Type
+ self.Name = Name
+ self.Value = Value
+ self.Model = Model
+ self.BelongsToFile = BelongsToFile
+ self.BelongsToFunction = BelongsToFunction
+ self.StartLine = StartLine
+ self.StartColumn = StartColumn
+ self.EndLine = EndLine
+ self.EndColumn = EndColumn
+
+## PcdClass
+#
+# This class defines a structure of a Pcd
+#
+# @param ID: ID of a Pcd
+# @param CName: CName of a Pcd
+# @param TokenSpaceGuidCName: TokenSpaceGuidCName of a Pcd
+# @param Token: Token of a Pcd
+# @param DatumType: DatumType of a Pcd
+# @param Model: Model of a Pcd
+# @param BelongsToFile: The Pcd belongs to which file
+# @param BelongsToFunction: The Pcd belongs to which function
+# @param StartLine: StartLine of a Pcd
+# @param StartColumn: StartColumn of a Pcd
+# @param EndLine: EndLine of a Pcd
+# @param EndColumn: EndColumn of a Pcd
+#
+# @var ID: ID of a Pcd
+# @var CName: CName of a Pcd
+# @var TokenSpaceGuidCName: TokenSpaceGuidCName of a Pcd
+# @var Token: Token of a Pcd
+# @var DatumType: DatumType of a Pcd
+# @var Model: Model of a Pcd
+# @var BelongsToFile: The Pcd belongs to which file
+# @var BelongsToFunction: The Pcd belongs to which function
+# @var StartLine: StartLine of a Pcd
+# @var StartColumn: StartColumn of a Pcd
+# @var EndLine: EndLine of a Pcd
+# @var EndColumn: EndColumn of a Pcd
+#
+class PcdDataClass(object):
+ def __init__(self, ID = -1, CName = '', TokenSpaceGuidCName = '', Token = '', DatumType = '', Model = MODEL_UNKNOWN, \
+ BelongsToFile = -1, BelongsToFunction = -1, StartLine = -1, StartColumn = -1, EndLine = -1, EndColumn = -1):
+ self.ID = ID
+ self.CName = CName
+ self.TokenSpaceGuidCName = TokenSpaceGuidCName
+ self.Token = Token
+ self.DatumType = DatumType
+ self.BelongsToFile = BelongsToFile
+ self.BelongsToFunction = BelongsToFunction
+ self.StartLine = StartLine
+ self.StartColumn = StartColumn
+ self.EndLine = EndLine
+ self.EndColumn = EndColumn
+
+## FileClass
+#
+# This class defines a structure of a file
+#
+# @param ID: ID of a File
+# @param Name: Name of a File
+# @param ExtName: ExtName of a File
+# @param Path: Path of a File
+# @param FullPath: FullPath of a File
+# @param Model: Model of a File
+# @param TimeStamp: TimeStamp of a File
+# @param FunctionList: FunctionList of a File
+# @param IdentifierList: IdentifierList of a File
+# @param PcdList: PcdList of a File
+#
+# @var ID: ID of a File
+# @var Name: Name of a File
+# @var ExtName: ExtName of a File
+# @var Path: Path of a File
+# @var FullPath: FullPath of a File
+# @var Model: Model of a File
+# @var TimeStamp: TimeStamp of a File
+# @var FunctionList: FunctionList of a File
+# @var IdentifierList: IdentifierList of a File
+# @var PcdList: PcdList of a File
+#
+class FileClass(object):
+ def __init__(self, ID = -1, Name = '', ExtName = '', Path = '', FullPath = '', Model = MODEL_UNKNOWN, TimeStamp = '', \
+ FunctionList = [], IdentifierList = [], PcdList = []):
+ self.ID = ID
+ self.Name = Name
+ self.ExtName = ExtName
+ self.Path = Path
+ self.FullPath = FullPath
+ self.Model = Model
+ self.TimeStamp = TimeStamp
+
+ self.FunctionList = FunctionList
+ self.IdentifierList = IdentifierList
+ self.PcdList = PcdList
diff --git a/roms/edk2/BaseTools/Source/Python/CommonDataClass/Exceptions.py b/roms/edk2/BaseTools/Source/Python/CommonDataClass/Exceptions.py
new file mode 100644
index 000000000..4489b757e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/CommonDataClass/Exceptions.py
@@ -0,0 +1,23 @@
+## @file
+# This file is used to define common Exceptions class used in python tools
+#
+# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+## Exceptions used in Expression
+class EvaluationException(Exception):
+ pass
+
+class BadExpression(EvaluationException):
+ pass
+
+class WrnExpression(Exception):
+ pass
+
+## Exceptions used in macro replacements
+class MacroException(Exception):
+ pass
+
+class SymbolNotFound(MacroException):
+ pass
+
diff --git a/roms/edk2/BaseTools/Source/Python/CommonDataClass/FdfClass.py b/roms/edk2/BaseTools/Source/Python/CommonDataClass/FdfClass.py
new file mode 100644
index 000000000..2fbb7b436
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/CommonDataClass/FdfClass.py
@@ -0,0 +1,312 @@
+## @file
+# classes represent data in FDF
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+## FD data in FDF
+#
+#
+class FDClassObject:
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ self.FdUiName = ''
+ self.CreateFileName = None
+ self.BaseAddress = None
+ self.BaseAddressPcd = None
+ self.Size = None
+ self.SizePcd = None
+ self.ErasePolarity = None
+ # 3-tuple list (blockSize, numBlocks, pcd)
+ self.BlockSizeList = []
+ # DefineVarDict[var] = value
+ self.DefineVarDict = {}
+ # SetVarDict[var] = value
+ self.SetVarDict = {}
+ self.RegionList = []
+
+## FFS data in FDF
+#
+#
+class FfsClassObject:
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ self.NameGuid = None
+ self.Fixed = False
+ self.CheckSum = False
+ self.Alignment = None
+ self.SectionList = []
+
+## FILE statement data in FDF
+#
+#
+class FileStatementClassObject (FfsClassObject) :
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ FfsClassObject.__init__(self)
+ self.FvFileType = None
+ self.FileName = None
+ self.KeyStringList = []
+ self.FvName = None
+ self.FdName = None
+ self.DefineVarDict = {}
+ self.KeepReloc = None
+
+## INF statement data in FDF
+#
+#
+class FfsInfStatementClassObject(FfsClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ FfsClassObject.__init__(self)
+ self.Rule = None
+ self.Version = None
+ self.Ui = None
+ self.InfFileName = None
+ self.BuildNum = ''
+ self.KeyStringList = []
+ self.KeepReloc = None
+ self.UseArch = None
+
+## section data in FDF
+#
+#
+class SectionClassObject:
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ self.Alignment = None
+
+## Depex expression section in FDF
+#
+#
+class DepexSectionClassObject (SectionClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ self.DepexType = None
+ self.Expression = None
+ self.ExpressionProcessed = False
+
+## Compress section data in FDF
+#
+#
+class CompressSectionClassObject (SectionClassObject) :
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ SectionClassObject.__init__(self)
+ self.CompType = None
+ self.SectionList = []
+
+## Data section data in FDF
+#
+#
+class DataSectionClassObject (SectionClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ SectionClassObject.__init__(self)
+ self.SecType = None
+ self.SectFileName = None
+ self.SectionList = []
+ self.KeepReloc = True
+
+## Rule section data in FDF
+#
+#
+class EfiSectionClassObject (SectionClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ SectionClassObject.__init__(self)
+ self.SectionType = None
+ self.Optional = False
+ self.FileType = None
+ self.StringData = None
+ self.FileName = None
+ self.FileExtension = None
+ self.BuildNum = None
+ self.KeepReloc = None
+
+## FV image section data in FDF
+#
+#
+class FvImageSectionClassObject (SectionClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ SectionClassObject.__init__(self)
+ self.Fv = None
+ self.FvName = None
+ self.FvFileType = None
+ self.FvFileName = None
+ self.FvFileExtension = None
+ self.FvAddr = None
+
+## GUIDed section data in FDF
+#
+#
+class GuidSectionClassObject (SectionClassObject) :
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ SectionClassObject.__init__(self)
+ self.NameGuid = None
+ self.SectionList = []
+ self.SectionType = None
+ self.ProcessRequired = False
+ self.AuthStatusValid = False
+ self.ExtraHeaderSize = -1
+ self.FvAddr = []
+ self.FvParentAddr = None
+ self.IncludeFvSection = False
+
+## UI section data in FDF
+#
+#
+class UiSectionClassObject (SectionClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ SectionClassObject.__init__(self)
+ self.StringData = None
+ self.FileName = None
+
+## Version section data in FDF
+#
+#
+class VerSectionClassObject (SectionClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ SectionClassObject.__init__(self)
+ self.BuildNum = None
+ self.StringData = None
+ self.FileName = None
+
+## Rule data in FDF
+#
+#
+class RuleClassObject :
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ self.Arch = None
+ self.ModuleType = None # For Module Type
+ self.TemplateName = None
+ self.NameGuid = None
+ self.Fixed = False
+ self.Alignment = None
+ self.SectAlignment = None
+ self.CheckSum = False
+ self.FvFileType = None # for Ffs File Type
+ self.KeyStringList = []
+ self.KeepReloc = None
+
+## Complex rule data in FDF
+#
+#
+class RuleComplexFileClassObject(RuleClassObject) :
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ RuleClassObject.__init__(self)
+ self.SectionList = []
+
+## Simple rule data in FDF
+#
+#
+class RuleSimpleFileClassObject(RuleClassObject) :
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ RuleClassObject.__init__(self)
+ self.FileName = None
+ self.SectionType = ''
+ self.FileExtension = None
+
+## File extension rule data in FDF
+#
+#
+class RuleFileExtensionClassObject(RuleClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ RuleClassObject.__init__(self)
+ self.FileExtension = None
+
+## Capsule data in FDF
+#
+#
+class CapsuleClassObject :
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ self.SpecName = None
+ self.UiCapsuleName = None
+ self.CreateFile = None
+ self.GroupIdNumber = None
+ # DefineVarDict[var] = value
+ self.DefineVarDict = {}
+ # SetVarDict[var] = value
+ self.SetVarDict = {}
+ # TokensDict[var] = value
+ self.TokensDict = {}
+ self.CapsuleDataList = []
+ self.FmpPayloadList = []
+
+## OptionROM data in FDF
+#
+#
+class OptionRomClassObject:
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ self.DriverName = None
+ self.FfsList = []
+
diff --git a/roms/edk2/BaseTools/Source/Python/CommonDataClass/__init__.py b/roms/edk2/BaseTools/Source/Python/CommonDataClass/__init__.py
new file mode 100644
index 000000000..81af4c07a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/CommonDataClass/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'CommonDataClass' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/C.g b/roms/edk2/BaseTools/Source/Python/Ecc/C.g
new file mode 100644
index 000000000..386956d7d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/C.g
@@ -0,0 +1,673 @@
+/* @file
+ This file is used to be the grammar file of ECC tool
+
+ Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+*/
+
+grammar C;
+options {
+ language=Python;
+ backtrack=true;
+ memoize=true;
+ k=2;
+}
+
+@lexer::header{
+## @file
+# The file defines the Lexer for C source files.
+#
+# THIS FILE IS AUTO-GENERATED. PLEASE DO NOT MODIFY THIS FILE.
+# This file is generated by running:
+# java org.antlr.Tool C.g
+#
+# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
+#
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License which accompanies this
+# distribution. The full text of the license may be found at:
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+}
+
+@header {
+## @file
+# The file defines the parser for C source files.
+#
+# THIS FILE IS AUTO-GENERATED. PLEASE DO NOT MODIFY THIS FILE.
+# This file is generated by running:
+# java org.antlr.Tool C.g
+#
+# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
+#
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License which accompanies this
+# distribution. The full text of the license may be found at:
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+import CodeFragment
+import FileProfile
+}
+
+@members {
+
+ def printTokenInfo(self, line, offset, tokenText):
+ print str(line)+ ',' + str(offset) + ':' + str(tokenText)
+
+ def StorePredicateExpression(self, StartLine, StartOffset, EndLine, EndOffset, Text):
+ PredExp = CodeFragment.PredicateExpression(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.PredicateExpressionList.append(PredExp)
+
+ def StoreEnumerationDefinition(self, StartLine, StartOffset, EndLine, EndOffset, Text):
+ EnumDef = CodeFragment.EnumerationDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.EnumerationDefinitionList.append(EnumDef)
+
+ def StoreStructUnionDefinition(self, StartLine, StartOffset, EndLine, EndOffset, Text):
+ SUDef = CodeFragment.StructUnionDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.StructUnionDefinitionList.append(SUDef)
+
+ def StoreTypedefDefinition(self, StartLine, StartOffset, EndLine, EndOffset, FromText, ToText):
+ Tdef = CodeFragment.TypedefDefinition(FromText, ToText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.TypedefDefinitionList.append(Tdef)
+
+ def StoreFunctionDefinition(self, StartLine, StartOffset, EndLine, EndOffset, ModifierText, DeclText, LeftBraceLine, LeftBraceOffset, DeclLine, DeclOffset):
+ FuncDef = CodeFragment.FunctionDefinition(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset), (LeftBraceLine, LeftBraceOffset), (DeclLine, DeclOffset))
+ FileProfile.FunctionDefinitionList.append(FuncDef)
+
+ def StoreVariableDeclaration(self, StartLine, StartOffset, EndLine, EndOffset, ModifierText, DeclText):
+ VarDecl = CodeFragment.VariableDeclaration(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.VariableDeclarationList.append(VarDecl)
+
+ def StoreFunctionCalling(self, StartLine, StartOffset, EndLine, EndOffset, FuncName, ParamList):
+ FuncCall = CodeFragment.FunctionCalling(FuncName, ParamList, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.FunctionCallingList.append(FuncCall)
+
+}
+
+translation_unit
+ : external_declaration*
+ ;
+
+
+/*function_declaration
+@after{
+ print $function_declaration.text
+}
+ : declaration_specifiers IDENTIFIER '(' parameter_list ')' ';'
+ ;
+*/
+external_declaration
+options {k=1;}
+/*@after{
+ print $external_declaration.text
+}*/
+ : ( declaration_specifiers? declarator declaration* '{' )=> function_definition
+ | declaration
+ | macro_statement (';')?
+ ;
+
+
+
+function_definition
+scope {
+ ModifierText;
+ DeclText;
+ LBLine;
+ LBOffset;
+ DeclLine;
+ DeclOffset;
+}
+@init {
+ $function_definition::ModifierText = '';
+ $function_definition::DeclText = '';
+ $function_definition::LBLine = 0;
+ $function_definition::LBOffset = 0;
+ $function_definition::DeclLine = 0;
+ $function_definition::DeclOffset = 0;
+}
+@after{
+ self.StoreFunctionDefinition($function_definition.start.line, $function_definition.start.charPositionInLine, $function_definition.stop.line, $function_definition.stop.charPositionInLine, $function_definition::ModifierText, $function_definition::DeclText, $function_definition::LBLine, $function_definition::LBOffset, $function_definition::DeclLine, $function_definition::DeclOffset)
+}
+ : d=declaration_specifiers? declarator
+ ( declaration+ a=compound_statement // K&R style
+ | b=compound_statement // ANSI style
+ ) {
+ if d != None:
+ $function_definition::ModifierText = $declaration_specifiers.text
+ else:
+ $function_definition::ModifierText = ''
+ $function_definition::DeclText = $declarator.text
+ $function_definition::DeclLine = $declarator.start.line
+ $function_definition::DeclOffset = $declarator.start.charPositionInLine
+ if a != None:
+ $function_definition::LBLine = $a.start.line
+ $function_definition::LBOffset = $a.start.charPositionInLine
+ else:
+ $function_definition::LBLine = $b.start.line
+ $function_definition::LBOffset = $b.start.charPositionInLine
+ }
+ ;
+
+declaration
+ : a='typedef' b=declaration_specifiers?
+ c=init_declarator_list d=';'
+ {
+ if b != None:
+ self.StoreTypedefDefinition($a.line, $a.charPositionInLine, $d.line, $d.charPositionInLine, $b.text, $c.text)
+ else:
+ self.StoreTypedefDefinition($a.line, $a.charPositionInLine, $d.line, $d.charPositionInLine, '', $c.text)
+ }
+ | s=declaration_specifiers t=init_declarator_list? e=';'
+ {
+ if t != None:
+ self.StoreVariableDeclaration($s.start.line, $s.start.charPositionInLine, $t.start.line, $t.start.charPositionInLine, $s.text, $t.text)
+ }
+ ;
+
+declaration_specifiers
+ : ( storage_class_specifier
+ | type_specifier
+ | type_qualifier
+ )+
+ ;
+
+init_declarator_list
+ : init_declarator (',' init_declarator)*
+ ;
+
+init_declarator
+ : declarator ('=' initializer)?
+ ;
+
+storage_class_specifier
+ : 'extern'
+ | 'static'
+ | 'auto'
+ | 'register'
+ | 'STATIC'
+ ;
+
+type_specifier
+ : 'void'
+ | 'char'
+ | 'short'
+ | 'int'
+ | 'long'
+ | 'float'
+ | 'double'
+ | 'signed'
+ | 'unsigned'
+ | s=struct_or_union_specifier
+ {
+ if s.stop != None:
+ self.StoreStructUnionDefinition($s.start.line, $s.start.charPositionInLine, $s.stop.line, $s.stop.charPositionInLine, $s.text)
+ }
+ | e=enum_specifier
+ {
+ if e.stop != None:
+ self.StoreEnumerationDefinition($e.start.line, $e.start.charPositionInLine, $e.stop.line, $e.stop.charPositionInLine, $e.text)
+ }
+ | (IDENTIFIER type_qualifier* declarator)=> type_id
+ ;
+
+type_id
+ : IDENTIFIER
+ //{self.printTokenInfo($a.line, $a.pos, $a.text)}
+ ;
+
+struct_or_union_specifier
+options {k=3;}
+ : struct_or_union IDENTIFIER? '{' struct_declaration_list '}'
+ | struct_or_union IDENTIFIER
+ ;
+
+struct_or_union
+ : 'struct'
+ | 'union'
+ ;
+
+struct_declaration_list
+ : struct_declaration+
+ ;
+
+struct_declaration
+ : specifier_qualifier_list struct_declarator_list ';'
+ ;
+
+specifier_qualifier_list
+ : ( type_qualifier | type_specifier )+
+ ;
+
+struct_declarator_list
+ : struct_declarator (',' struct_declarator)*
+ ;
+
+struct_declarator
+ : declarator (':' constant_expression)?
+ | ':' constant_expression
+ ;
+
+enum_specifier
+options {k=3;}
+ : 'enum' '{' enumerator_list ','? '}'
+ | 'enum' IDENTIFIER '{' enumerator_list ','? '}'
+ | 'enum' IDENTIFIER
+ ;
+
+enumerator_list
+ : enumerator (',' enumerator)*
+ ;
+
+enumerator
+ : IDENTIFIER ('=' constant_expression)?
+ ;
+
+type_qualifier
+ : 'const'
+ | 'volatile'
+ | 'IN'
+ | 'OUT'
+ | 'OPTIONAL'
+ | 'CONST'
+ | 'UNALIGNED'
+ | 'VOLATILE'
+ | 'GLOBAL_REMOVE_IF_UNREFERENCED'
+ | 'EFIAPI'
+ | 'EFI_BOOTSERVICE'
+ | 'EFI_RUNTIMESERVICE'
+ | 'PACKED'
+ ;
+
+declarator
+ : pointer? ('EFIAPI')? ('EFI_BOOTSERVICE')? ('EFI_RUNTIMESERVICE')? direct_declarator
+// | ('EFIAPI')? ('EFI_BOOTSERVICE')? ('EFI_RUNTIMESERVICE')? pointer? direct_declarator
+ | pointer
+ ;
+
+direct_declarator
+ : IDENTIFIER declarator_suffix*
+ | '(' ('EFIAPI')? declarator ')' declarator_suffix+
+ ;
+
+declarator_suffix
+ : '[' constant_expression ']'
+ | '[' ']'
+ | '(' parameter_type_list ')'
+ | '(' identifier_list ')'
+ | '(' ')'
+ ;
+
+pointer
+ : '*' type_qualifier+ pointer?
+ | '*' pointer
+ | '*'
+ ;
+
+parameter_type_list
+ : parameter_list (',' ('OPTIONAL')? '...')?
+ ;
+
+parameter_list
+ : parameter_declaration (',' ('OPTIONAL')? parameter_declaration)*
+ ;
+
+parameter_declaration
+ : declaration_specifiers (declarator|abstract_declarator)* ('OPTIONAL')?
+ //accomerdate user-defined type only, no declarator follow.
+ | pointer* IDENTIFIER
+ ;
+
+identifier_list
+ : IDENTIFIER
+ (',' IDENTIFIER)*
+ ;
+
+type_name
+ : specifier_qualifier_list abstract_declarator?
+ | type_id
+ ;
+
+abstract_declarator
+ : pointer direct_abstract_declarator?
+ | direct_abstract_declarator
+ ;
+
+direct_abstract_declarator
+ : ( '(' abstract_declarator ')' | abstract_declarator_suffix ) abstract_declarator_suffix*
+ ;
+
+abstract_declarator_suffix
+ : '[' ']'
+ | '[' constant_expression ']'
+ | '(' ')'
+ | '(' parameter_type_list ')'
+ ;
+
+initializer
+
+ : assignment_expression
+ | '{' initializer_list ','? '}'
+ ;
+
+initializer_list
+ : initializer (',' initializer )*
+ ;
+
+// E x p r e s s i o n s
+
+argument_expression_list
+ : assignment_expression ('OPTIONAL')? (',' assignment_expression ('OPTIONAL')?)*
+ ;
+
+additive_expression
+ : (multiplicative_expression) ('+' multiplicative_expression | '-' multiplicative_expression)*
+ ;
+
+multiplicative_expression
+ : (cast_expression) ('*' cast_expression | '/' cast_expression | '%' cast_expression)*
+ ;
+
+cast_expression
+ : '(' type_name ')' cast_expression
+ | unary_expression
+ ;
+
+unary_expression
+ : postfix_expression
+ | '++' unary_expression
+ | '--' unary_expression
+ | unary_operator cast_expression
+ | 'sizeof' unary_expression
+ | 'sizeof' '(' type_name ')'
+ ;
+
+postfix_expression
+scope {
+ FuncCallText;
+}
+@init {
+ $postfix_expression::FuncCallText = '';
+}
+ : p=primary_expression {$postfix_expression::FuncCallText += $p.text}
+ ( '[' expression ']'
+ | '(' a=')'{self.StoreFunctionCalling($p.start.line, $p.start.charPositionInLine, $a.line, $a.charPositionInLine, $postfix_expression::FuncCallText, '')}
+ | '(' c=argument_expression_list b=')' {self.StoreFunctionCalling($p.start.line, $p.start.charPositionInLine, $b.line, $b.charPositionInLine, $postfix_expression::FuncCallText, $c.text)}
+ | '(' macro_parameter_list ')'
+ | '.' x=IDENTIFIER {$postfix_expression::FuncCallText += '.' + $x.text}
+ | '*' y=IDENTIFIER {$postfix_expression::FuncCallText = $y.text}
+ | '->' z=IDENTIFIER {$postfix_expression::FuncCallText += '->' + $z.text}
+ | '++'
+ | '--'
+ )*
+ ;
+
+macro_parameter_list
+ : parameter_declaration (',' parameter_declaration)*
+ ;
+
+unary_operator
+ : '&'
+ | '*'
+ | '+'
+ | '-'
+ | '~'
+ | '!'
+ ;
+
+primary_expression
+ : IDENTIFIER
+ | constant
+ | '(' expression ')'
+ ;
+
+constant
+ : HEX_LITERAL
+ | OCTAL_LITERAL
+ | DECIMAL_LITERAL
+ | CHARACTER_LITERAL
+ | (IDENTIFIER* STRING_LITERAL+)+ IDENTIFIER*
+ | FLOATING_POINT_LITERAL
+ ;
+
+/////
+
+expression
+ : assignment_expression (',' assignment_expression)*
+ ;
+
+constant_expression
+ : conditional_expression
+ ;
+
+assignment_expression
+ : lvalue assignment_operator assignment_expression
+ | conditional_expression
+ ;
+
+lvalue
+ : unary_expression
+ ;
+
+assignment_operator
+ : '='
+ | '*='
+ | '/='
+ | '%='
+ | '+='
+ | '-='
+ | '<<='
+ | '>>='
+ | '&='
+ | '^='
+ | '|='
+ ;
+
+conditional_expression
+ : e=logical_or_expression ('?' expression ':' conditional_expression {self.StorePredicateExpression($e.start.line, $e.start.charPositionInLine, $e.stop.line, $e.stop.charPositionInLine, $e.text)})?
+ ;
+
+logical_or_expression
+ : logical_and_expression ('||' logical_and_expression)*
+ ;
+
+logical_and_expression
+ : inclusive_or_expression ('&&' inclusive_or_expression)*
+ ;
+
+inclusive_or_expression
+ : exclusive_or_expression ('|' exclusive_or_expression)*
+ ;
+
+exclusive_or_expression
+ : and_expression ('^' and_expression)*
+ ;
+
+and_expression
+ : equality_expression ('&' equality_expression)*
+ ;
+equality_expression
+ : relational_expression (('=='|'!=') relational_expression )*
+ ;
+
+relational_expression
+ : shift_expression (('<'|'>'|'<='|'>=') shift_expression)*
+ ;
+
+shift_expression
+ : additive_expression (('<<'|'>>') additive_expression)*
+ ;
+
+// S t a t e m e n t s
+
+statement
+ : labeled_statement
+ | compound_statement
+ | expression_statement
+ | selection_statement
+ | iteration_statement
+ | jump_statement
+ | macro_statement
+ | asm2_statement
+ | asm1_statement
+ | asm_statement
+ | declaration
+ ;
+
+asm2_statement
+ : '__asm__'? IDENTIFIER '(' (~(';'))* ')' ';'
+ ;
+
+asm1_statement
+ : '_asm' '{' (~('}'))* '}'
+ ;
+
+asm_statement
+ : '__asm' '{' (~('}'))* '}'
+ ;
+
+macro_statement
+ : IDENTIFIER '(' declaration* statement_list? expression? ')'
+ ;
+
+labeled_statement
+ : IDENTIFIER ':' statement
+ | 'case' constant_expression ':' statement
+ | 'default' ':' statement
+ ;
+
+compound_statement
+ : '{' declaration* statement_list? '}'
+ ;
+
+statement_list
+ : statement+
+ ;
+
+expression_statement
+ : ';'
+ | expression ';'
+ ;
+
+selection_statement
+ : 'if' '(' e=expression ')' {self.StorePredicateExpression($e.start.line, $e.start.charPositionInLine, $e.stop.line, $e.stop.charPositionInLine, $e.text)} statement (options {k=1; backtrack=false;}:'else' statement)?
+ | 'switch' '(' expression ')' statement
+ ;
+
+iteration_statement
+ : 'while' '(' e=expression ')' statement {self.StorePredicateExpression($e.start.line, $e.start.charPositionInLine, $e.stop.line, $e.stop.charPositionInLine, $e.text)}
+ | 'do' statement 'while' '(' e=expression ')' ';' {self.StorePredicateExpression($e.start.line, $e.start.charPositionInLine, $e.stop.line, $e.stop.charPositionInLine, $e.text)}
+ | 'for' '(' expression_statement e=expression_statement expression? ')' statement {self.StorePredicateExpression($e.start.line, $e.start.charPositionInLine, $e.stop.line, $e.stop.charPositionInLine, $e.text)}
+ ;
+
+jump_statement
+ : 'goto' IDENTIFIER ';'
+ | 'continue' ';'
+ | 'break' ';'
+ | 'return' ';'
+ | 'return' expression ';'
+ ;
+
+IDENTIFIER
+ : LETTER (LETTER|'0'..'9')*
+ ;
+
+fragment
+LETTER
+ : '$'
+ | 'A'..'Z'
+ | 'a'..'z'
+ | '_'
+ ;
+
+CHARACTER_LITERAL
+ : ('L')? '\'' ( EscapeSequence | ~('\''|'\\') ) '\''
+ ;
+
+STRING_LITERAL
+ : ('L')? '"' ( EscapeSequence | ~('\\'|'"') )* '"'
+ ;
+
+HEX_LITERAL : '0' ('x'|'X') HexDigit+ IntegerTypeSuffix? ;
+
+DECIMAL_LITERAL : ('0' | '1'..'9' '0'..'9'*) IntegerTypeSuffix? ;
+
+OCTAL_LITERAL : '0' ('0'..'7')+ IntegerTypeSuffix? ;
+
+fragment
+HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;
+
+fragment
+IntegerTypeSuffix
+ : ('u'|'U')
+ | ('l'|'L')
+ | ('u'|'U') ('l'|'L')
+ | ('u'|'U') ('l'|'L') ('l'|'L')
+ ;
+
+FLOATING_POINT_LITERAL
+ : ('0'..'9')+ '.' ('0'..'9')* Exponent? FloatTypeSuffix?
+ | '.' ('0'..'9')+ Exponent? FloatTypeSuffix?
+ | ('0'..'9')+ Exponent FloatTypeSuffix?
+ | ('0'..'9')+ Exponent? FloatTypeSuffix
+ ;
+
+fragment
+Exponent : ('e'|'E') ('+'|'-')? ('0'..'9')+ ;
+
+fragment
+FloatTypeSuffix : ('f'|'F'|'d'|'D') ;
+
+fragment
+EscapeSequence
+ : '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
+ | OctalEscape
+ ;
+
+fragment
+OctalEscape
+ : '\\' ('0'..'3') ('0'..'7') ('0'..'7')
+ | '\\' ('0'..'7') ('0'..'7')
+ | '\\' ('0'..'7')
+ ;
+
+fragment
+UnicodeEscape
+ : '\\' 'u' HexDigit HexDigit HexDigit HexDigit
+ ;
+
+WS : (' '|'\r'|'\t'|'\u000C'|'\n') {$channel=HIDDEN;}
+ ;
+
+// ignore '\' of line concatenation
+BS : ('\\') {$channel=HIDDEN;}
+ ;
+
+// ignore function modifiers
+//FUNC_MODIFIERS : 'EFIAPI' {$channel=HIDDEN;}
+// ;
+
+UnicodeVocabulary
+ : '\u0003'..'\uFFFE'
+ ;
+COMMENT
+ : '/*' ( options {greedy=false;} : . )* '*/' {$channel=HIDDEN;}
+ ;
+
+
+LINE_COMMENT
+ : '//' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
+ ;
+
+// ignore #line info for now
+LINE_COMMAND
+ : '#' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
+ ;
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/CParser3/CLexer.py b/roms/edk2/BaseTools/Source/Python/Ecc/CParser3/CLexer.py
new file mode 100644
index 000000000..ca03adea7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/CParser3/CLexer.py
@@ -0,0 +1,4941 @@
+# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53
+
+from antlr3 import *
+from antlr3.compat import set, frozenset
+
+## @file
+# The file defines the Lexer for C source files.
+#
+# THIS FILE IS AUTO-GENERATED. PLEASE DO NOT MODIFY THIS FILE.
+# This file is generated by running:
+# java org.antlr.Tool C.g
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+
+
+# for convenience in actions
+HIDDEN = BaseRecognizer.HIDDEN
+
+# token types
+T114=114
+T115=115
+T116=116
+T117=117
+FloatTypeSuffix=16
+LETTER=11
+T29=29
+T28=28
+T27=27
+T26=26
+T25=25
+EOF=-1
+STRING_LITERAL=9
+FLOATING_POINT_LITERAL=10
+T38=38
+T37=37
+T39=39
+T34=34
+COMMENT=22
+T33=33
+T36=36
+T35=35
+T30=30
+T32=32
+T31=31
+LINE_COMMENT=23
+IntegerTypeSuffix=14
+CHARACTER_LITERAL=8
+T49=49
+T48=48
+T100=100
+T43=43
+T42=42
+T102=102
+T41=41
+T101=101
+T40=40
+T47=47
+T46=46
+T45=45
+T44=44
+T109=109
+T107=107
+T108=108
+T105=105
+WS=19
+T106=106
+T103=103
+T104=104
+T50=50
+LINE_COMMAND=24
+T59=59
+T113=113
+T52=52
+T112=112
+T51=51
+T111=111
+T54=54
+T110=110
+EscapeSequence=12
+DECIMAL_LITERAL=7
+T53=53
+T56=56
+T55=55
+T58=58
+T57=57
+T75=75
+T76=76
+T73=73
+T74=74
+T79=79
+T77=77
+T78=78
+Exponent=15
+HexDigit=13
+T72=72
+T71=71
+T70=70
+T62=62
+T63=63
+T64=64
+T65=65
+T66=66
+T67=67
+T68=68
+T69=69
+IDENTIFIER=4
+UnicodeVocabulary=21
+HEX_LITERAL=5
+T61=61
+T60=60
+T99=99
+T97=97
+BS=20
+T98=98
+T95=95
+T96=96
+OCTAL_LITERAL=6
+T94=94
+Tokens=118
+T93=93
+T92=92
+T91=91
+T90=90
+T88=88
+T89=89
+T84=84
+T85=85
+T86=86
+T87=87
+UnicodeEscape=18
+T81=81
+T80=80
+T83=83
+OctalEscape=17
+T82=82
+
+class CLexer(Lexer):
+
+ grammarFileName = "C.g"
+
+ def __init__(self, input=None):
+ Lexer.__init__(self, input)
+ self.dfa25 = self.DFA25(
+ self, 25,
+ eot = self.DFA25_eot,
+ eof = self.DFA25_eof,
+ min = self.DFA25_min,
+ max = self.DFA25_max,
+ accept = self.DFA25_accept,
+ special = self.DFA25_special,
+ transition = self.DFA25_transition
+ )
+ self.dfa35 = self.DFA35(
+ self, 35,
+ eot = self.DFA35_eot,
+ eof = self.DFA35_eof,
+ min = self.DFA35_min,
+ max = self.DFA35_max,
+ accept = self.DFA35_accept,
+ special = self.DFA35_special,
+ transition = self.DFA35_transition
+ )
+
+
+
+
+
+
+ # $ANTLR start T25
+ def mT25(self, ):
+
+ try:
+ self.type = T25
+
+ # C.g:27:5: ( ';' )
+ # C.g:27:7: ';'
+ self.match(u';')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T25
+
+
+
+ # $ANTLR start T26
+ def mT26(self, ):
+
+ try:
+ self.type = T26
+
+ # C.g:28:5: ( 'typedef' )
+ # C.g:28:7: 'typedef'
+ self.match("typedef")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T26
+
+
+
+ # $ANTLR start T27
+ def mT27(self, ):
+
+ try:
+ self.type = T27
+
+ # C.g:29:5: ( ',' )
+ # C.g:29:7: ','
+ self.match(u',')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T27
+
+
+
+ # $ANTLR start T28
+ def mT28(self, ):
+
+ try:
+ self.type = T28
+
+ # C.g:30:5: ( '=' )
+ # C.g:30:7: '='
+ self.match(u'=')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T28
+
+
+
+ # $ANTLR start T29
+ def mT29(self, ):
+
+ try:
+ self.type = T29
+
+ # C.g:31:5: ( 'extern' )
+ # C.g:31:7: 'extern'
+ self.match("extern")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T29
+
+
+
+ # $ANTLR start T30
+ def mT30(self, ):
+
+ try:
+ self.type = T30
+
+ # C.g:32:5: ( 'static' )
+ # C.g:32:7: 'static'
+ self.match("static")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T30
+
+
+
+ # $ANTLR start T31
+ def mT31(self, ):
+
+ try:
+ self.type = T31
+
+ # C.g:33:5: ( 'auto' )
+ # C.g:33:7: 'auto'
+ self.match("auto")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T31
+
+
+
+ # $ANTLR start T32
+ def mT32(self, ):
+
+ try:
+ self.type = T32
+
+ # C.g:34:5: ( 'register' )
+ # C.g:34:7: 'register'
+ self.match("register")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T32
+
+
+
+ # $ANTLR start T33
+ def mT33(self, ):
+
+ try:
+ self.type = T33
+
+ # C.g:35:5: ( 'STATIC' )
+ # C.g:35:7: 'STATIC'
+ self.match("STATIC")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T33
+
+
+
+ # $ANTLR start T34
+ def mT34(self, ):
+
+ try:
+ self.type = T34
+
+ # C.g:36:5: ( 'void' )
+ # C.g:36:7: 'void'
+ self.match("void")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T34
+
+
+
+ # $ANTLR start T35
+ def mT35(self, ):
+
+ try:
+ self.type = T35
+
+ # C.g:37:5: ( 'char' )
+ # C.g:37:7: 'char'
+ self.match("char")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T35
+
+
+
+ # $ANTLR start T36
+ def mT36(self, ):
+
+ try:
+ self.type = T36
+
+ # C.g:38:5: ( 'short' )
+ # C.g:38:7: 'short'
+ self.match("short")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T36
+
+
+
+ # $ANTLR start T37
+ def mT37(self, ):
+
+ try:
+ self.type = T37
+
+ # C.g:39:5: ( 'int' )
+ # C.g:39:7: 'int'
+ self.match("int")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T37
+
+
+
+ # $ANTLR start T38
+ def mT38(self, ):
+
+ try:
+ self.type = T38
+
+ # C.g:40:5: ( 'long' )
+ # C.g:40:7: 'long'
+ self.match("long")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T38
+
+
+
+ # $ANTLR start T39
+ def mT39(self, ):
+
+ try:
+ self.type = T39
+
+ # C.g:41:5: ( 'float' )
+ # C.g:41:7: 'float'
+ self.match("float")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T39
+
+
+
+ # $ANTLR start T40
+ def mT40(self, ):
+
+ try:
+ self.type = T40
+
+ # C.g:42:5: ( 'double' )
+ # C.g:42:7: 'double'
+ self.match("double")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T40
+
+
+
+ # $ANTLR start T41
+ def mT41(self, ):
+
+ try:
+ self.type = T41
+
+ # C.g:43:5: ( 'signed' )
+ # C.g:43:7: 'signed'
+ self.match("signed")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T41
+
+
+
+ # $ANTLR start T42
+ def mT42(self, ):
+
+ try:
+ self.type = T42
+
+ # C.g:44:5: ( 'unsigned' )
+ # C.g:44:7: 'unsigned'
+ self.match("unsigned")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T42
+
+
+
+ # $ANTLR start T43
+ def mT43(self, ):
+
+ try:
+ self.type = T43
+
+ # C.g:45:5: ( '{' )
+ # C.g:45:7: '{'
+ self.match(u'{')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T43
+
+
+
+ # $ANTLR start T44
+ def mT44(self, ):
+
+ try:
+ self.type = T44
+
+ # C.g:46:5: ( '}' )
+ # C.g:46:7: '}'
+ self.match(u'}')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T44
+
+
+
+ # $ANTLR start T45
+ def mT45(self, ):
+
+ try:
+ self.type = T45
+
+ # C.g:47:5: ( 'struct' )
+ # C.g:47:7: 'struct'
+ self.match("struct")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T45
+
+
+
+ # $ANTLR start T46
+ def mT46(self, ):
+
+ try:
+ self.type = T46
+
+ # C.g:48:5: ( 'union' )
+ # C.g:48:7: 'union'
+ self.match("union")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T46
+
+
+
+ # $ANTLR start T47
+ def mT47(self, ):
+
+ try:
+ self.type = T47
+
+ # C.g:49:5: ( ':' )
+ # C.g:49:7: ':'
+ self.match(u':')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T47
+
+
+
+ # $ANTLR start T48
+ def mT48(self, ):
+
+ try:
+ self.type = T48
+
+ # C.g:50:5: ( 'enum' )
+ # C.g:50:7: 'enum'
+ self.match("enum")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T48
+
+
+
+ # $ANTLR start T49
+ def mT49(self, ):
+
+ try:
+ self.type = T49
+
+ # C.g:51:5: ( 'const' )
+ # C.g:51:7: 'const'
+ self.match("const")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T49
+
+
+
+ # $ANTLR start T50
+ def mT50(self, ):
+
+ try:
+ self.type = T50
+
+ # C.g:52:5: ( 'volatile' )
+ # C.g:52:7: 'volatile'
+ self.match("volatile")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T50
+
+
+
+ # $ANTLR start T51
+ def mT51(self, ):
+
+ try:
+ self.type = T51
+
+ # C.g:53:5: ( 'IN' )
+ # C.g:53:7: 'IN'
+ self.match("IN")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T51
+
+
+
+ # $ANTLR start T52
+ def mT52(self, ):
+
+ try:
+ self.type = T52
+
+ # C.g:54:5: ( 'OUT' )
+ # C.g:54:7: 'OUT'
+ self.match("OUT")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T52
+
+
+
+ # $ANTLR start T53
+ def mT53(self, ):
+
+ try:
+ self.type = T53
+
+ # C.g:55:5: ( 'OPTIONAL' )
+ # C.g:55:7: 'OPTIONAL'
+ self.match("OPTIONAL")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T53
+
+
+
+ # $ANTLR start T54
+ def mT54(self, ):
+
+ try:
+ self.type = T54
+
+ # C.g:56:5: ( 'CONST' )
+ # C.g:56:7: 'CONST'
+ self.match("CONST")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T54
+
+
+
+ # $ANTLR start T55
+ def mT55(self, ):
+
+ try:
+ self.type = T55
+
+ # C.g:57:5: ( 'UNALIGNED' )
+ # C.g:57:7: 'UNALIGNED'
+ self.match("UNALIGNED")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T55
+
+
+
+ # $ANTLR start T56
+ def mT56(self, ):
+
+ try:
+ self.type = T56
+
+ # C.g:58:5: ( 'VOLATILE' )
+ # C.g:58:7: 'VOLATILE'
+ self.match("VOLATILE")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T56
+
+
+
+ # $ANTLR start T57
+ def mT57(self, ):
+
+ try:
+ self.type = T57
+
+ # C.g:59:5: ( 'GLOBAL_REMOVE_IF_UNREFERENCED' )
+ # C.g:59:7: 'GLOBAL_REMOVE_IF_UNREFERENCED'
+ self.match("GLOBAL_REMOVE_IF_UNREFERENCED")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T57
+
+
+
+ # $ANTLR start T58
+ def mT58(self, ):
+
+ try:
+ self.type = T58
+
+ # C.g:60:5: ( 'EFIAPI' )
+ # C.g:60:7: 'EFIAPI'
+ self.match("EFIAPI")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T58
+
+
+
+ # $ANTLR start T59
+ def mT59(self, ):
+
+ try:
+ self.type = T59
+
+ # C.g:61:5: ( 'EFI_BOOTSERVICE' )
+ # C.g:61:7: 'EFI_BOOTSERVICE'
+ self.match("EFI_BOOTSERVICE")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T59
+
+
+
+ # $ANTLR start T60
+ def mT60(self, ):
+
+ try:
+ self.type = T60
+
+ # C.g:62:5: ( 'EFI_RUNTIMESERVICE' )
+ # C.g:62:7: 'EFI_RUNTIMESERVICE'
+ self.match("EFI_RUNTIMESERVICE")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T60
+
+
+
+ # $ANTLR start T61
+ def mT61(self, ):
+
+ try:
+ self.type = T61
+
+ # C.g:63:5: ( 'PACKED' )
+ # C.g:63:7: 'PACKED'
+ self.match("PACKED")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T61
+
+
+
+ # $ANTLR start T62
+ def mT62(self, ):
+
+ try:
+ self.type = T62
+
+ # C.g:64:5: ( '(' )
+ # C.g:64:7: '('
+ self.match(u'(')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T62
+
+
+
+ # $ANTLR start T63
+ def mT63(self, ):
+
+ try:
+ self.type = T63
+
+ # C.g:65:5: ( ')' )
+ # C.g:65:7: ')'
+ self.match(u')')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T63
+
+
+
+ # $ANTLR start T64
+ def mT64(self, ):
+
+ try:
+ self.type = T64
+
+ # C.g:66:5: ( '[' )
+ # C.g:66:7: '['
+ self.match(u'[')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T64
+
+
+
+ # $ANTLR start T65
+ def mT65(self, ):
+
+ try:
+ self.type = T65
+
+ # C.g:67:5: ( ']' )
+ # C.g:67:7: ']'
+ self.match(u']')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T65
+
+
+
+ # $ANTLR start T66
+ def mT66(self, ):
+
+ try:
+ self.type = T66
+
+ # C.g:68:5: ( '*' )
+ # C.g:68:7: '*'
+ self.match(u'*')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T66
+
+
+
+ # $ANTLR start T67
+ def mT67(self, ):
+
+ try:
+ self.type = T67
+
+ # C.g:69:5: ( '...' )
+ # C.g:69:7: '...'
+ self.match("...")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T67
+
+
+
+ # $ANTLR start T68
+ def mT68(self, ):
+
+ try:
+ self.type = T68
+
+ # C.g:70:5: ( '+' )
+ # C.g:70:7: '+'
+ self.match(u'+')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T68
+
+
+
+ # $ANTLR start T69
+ def mT69(self, ):
+
+ try:
+ self.type = T69
+
+ # C.g:71:5: ( '-' )
+ # C.g:71:7: '-'
+ self.match(u'-')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T69
+
+
+
+ # $ANTLR start T70
+ def mT70(self, ):
+
+ try:
+ self.type = T70
+
+ # C.g:72:5: ( '/' )
+ # C.g:72:7: '/'
+ self.match(u'/')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T70
+
+
+
+ # $ANTLR start T71
+ def mT71(self, ):
+
+ try:
+ self.type = T71
+
+ # C.g:73:5: ( '%' )
+ # C.g:73:7: '%'
+ self.match(u'%')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T71
+
+
+
+ # $ANTLR start T72
+ def mT72(self, ):
+
+ try:
+ self.type = T72
+
+ # C.g:74:5: ( '++' )
+ # C.g:74:7: '++'
+ self.match("++")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T72
+
+
+
+ # $ANTLR start T73
+ def mT73(self, ):
+
+ try:
+ self.type = T73
+
+ # C.g:75:5: ( '--' )
+ # C.g:75:7: '--'
+ self.match("--")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T73
+
+
+
+ # $ANTLR start T74
+ def mT74(self, ):
+
+ try:
+ self.type = T74
+
+ # C.g:76:5: ( 'sizeof' )
+ # C.g:76:7: 'sizeof'
+ self.match("sizeof")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T74
+
+
+
+ # $ANTLR start T75
+ def mT75(self, ):
+
+ try:
+ self.type = T75
+
+ # C.g:77:5: ( '.' )
+ # C.g:77:7: '.'
+ self.match(u'.')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T75
+
+
+
+ # $ANTLR start T76
+ def mT76(self, ):
+
+ try:
+ self.type = T76
+
+ # C.g:78:5: ( '->' )
+ # C.g:78:7: '->'
+ self.match("->")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T76
+
+
+
+ # $ANTLR start T77
+ def mT77(self, ):
+
+ try:
+ self.type = T77
+
+ # C.g:79:5: ( '&' )
+ # C.g:79:7: '&'
+ self.match(u'&')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T77
+
+
+
+ # $ANTLR start T78
+ def mT78(self, ):
+
+ try:
+ self.type = T78
+
+ # C.g:80:5: ( '~' )
+ # C.g:80:7: '~'
+ self.match(u'~')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T78
+
+
+
+ # $ANTLR start T79
+ def mT79(self, ):
+
+ try:
+ self.type = T79
+
+ # C.g:81:5: ( '!' )
+ # C.g:81:7: '!'
+ self.match(u'!')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T79
+
+
+
+ # $ANTLR start T80
+ def mT80(self, ):
+
+ try:
+ self.type = T80
+
+ # C.g:82:5: ( '*=' )
+ # C.g:82:7: '*='
+ self.match("*=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T80
+
+
+
+ # $ANTLR start T81
+ def mT81(self, ):
+
+ try:
+ self.type = T81
+
+ # C.g:83:5: ( '/=' )
+ # C.g:83:7: '/='
+ self.match("/=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T81
+
+
+
+ # $ANTLR start T82
+ def mT82(self, ):
+
+ try:
+ self.type = T82
+
+ # C.g:84:5: ( '%=' )
+ # C.g:84:7: '%='
+ self.match("%=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T82
+
+
+
+ # $ANTLR start T83
+ def mT83(self, ):
+
+ try:
+ self.type = T83
+
+ # C.g:85:5: ( '+=' )
+ # C.g:85:7: '+='
+ self.match("+=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T83
+
+
+
+ # $ANTLR start T84
+ def mT84(self, ):
+
+ try:
+ self.type = T84
+
+ # C.g:86:5: ( '-=' )
+ # C.g:86:7: '-='
+ self.match("-=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T84
+
+
+
+ # $ANTLR start T85
+ def mT85(self, ):
+
+ try:
+ self.type = T85
+
+ # C.g:87:5: ( '<<=' )
+ # C.g:87:7: '<<='
+ self.match("<<=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T85
+
+
+
+ # $ANTLR start T86
+ def mT86(self, ):
+
+ try:
+ self.type = T86
+
+ # C.g:88:5: ( '>>=' )
+ # C.g:88:7: '>>='
+ self.match(">>=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T86
+
+
+
+ # $ANTLR start T87
+ def mT87(self, ):
+
+ try:
+ self.type = T87
+
+ # C.g:89:5: ( '&=' )
+ # C.g:89:7: '&='
+ self.match("&=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T87
+
+
+
+ # $ANTLR start T88
+ def mT88(self, ):
+
+ try:
+ self.type = T88
+
+ # C.g:90:5: ( '^=' )
+ # C.g:90:7: '^='
+ self.match("^=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T88
+
+
+
+ # $ANTLR start T89
+ def mT89(self, ):
+
+ try:
+ self.type = T89
+
+ # C.g:91:5: ( '|=' )
+ # C.g:91:7: '|='
+ self.match("|=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T89
+
+
+
+ # $ANTLR start T90
+ def mT90(self, ):
+
+ try:
+ self.type = T90
+
+ # C.g:92:5: ( '?' )
+ # C.g:92:7: '?'
+ self.match(u'?')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T90
+
+
+
+ # $ANTLR start T91
+ def mT91(self, ):
+
+ try:
+ self.type = T91
+
+ # C.g:93:5: ( '||' )
+ # C.g:93:7: '||'
+ self.match("||")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T91
+
+
+
+ # $ANTLR start T92
+ def mT92(self, ):
+
+ try:
+ self.type = T92
+
+ # C.g:94:5: ( '&&' )
+ # C.g:94:7: '&&'
+ self.match("&&")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T92
+
+
+
+ # $ANTLR start T93
+ def mT93(self, ):
+
+ try:
+ self.type = T93
+
+ # C.g:95:5: ( '|' )
+ # C.g:95:7: '|'
+ self.match(u'|')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T93
+
+
+
+ # $ANTLR start T94
+ def mT94(self, ):
+
+ try:
+ self.type = T94
+
+ # C.g:96:5: ( '^' )
+ # C.g:96:7: '^'
+ self.match(u'^')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T94
+
+
+
+ # $ANTLR start T95
+ def mT95(self, ):
+
+ try:
+ self.type = T95
+
+ # C.g:97:5: ( '==' )
+ # C.g:97:7: '=='
+ self.match("==")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T95
+
+
+
+ # $ANTLR start T96
+ def mT96(self, ):
+
+ try:
+ self.type = T96
+
+ # C.g:98:5: ( '!=' )
+ # C.g:98:7: '!='
+ self.match("!=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T96
+
+
+
+ # $ANTLR start T97
+ def mT97(self, ):
+
+ try:
+ self.type = T97
+
+ # C.g:99:5: ( '<' )
+ # C.g:99:7: '<'
+ self.match(u'<')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T97
+
+
+
+ # $ANTLR start T98
+ def mT98(self, ):
+
+ try:
+ self.type = T98
+
+ # C.g:100:5: ( '>' )
+ # C.g:100:7: '>'
+ self.match(u'>')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T98
+
+
+
+ # $ANTLR start T99
+ def mT99(self, ):
+
+ try:
+ self.type = T99
+
+ # C.g:101:5: ( '<=' )
+ # C.g:101:7: '<='
+ self.match("<=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T99
+
+
+
+ # $ANTLR start T100
+ def mT100(self, ):
+
+ try:
+ self.type = T100
+
+ # C.g:102:6: ( '>=' )
+ # C.g:102:8: '>='
+ self.match(">=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T100
+
+
+
+ # $ANTLR start T101
+ def mT101(self, ):
+
+ try:
+ self.type = T101
+
+ # C.g:103:6: ( '<<' )
+ # C.g:103:8: '<<'
+ self.match("<<")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T101
+
+
+
+ # $ANTLR start T102
+ def mT102(self, ):
+
+ try:
+ self.type = T102
+
+ # C.g:104:6: ( '>>' )
+ # C.g:104:8: '>>'
+ self.match(">>")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T102
+
+
+
+ # $ANTLR start T103
+ def mT103(self, ):
+
+ try:
+ self.type = T103
+
+ # C.g:105:6: ( '__asm__' )
+ # C.g:105:8: '__asm__'
+ self.match("__asm__")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T103
+
+
+
+ # $ANTLR start T104
+ def mT104(self, ):
+
+ try:
+ self.type = T104
+
+ # C.g:106:6: ( '_asm' )
+ # C.g:106:8: '_asm'
+ self.match("_asm")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T104
+
+
+
+ # $ANTLR start T105
+ def mT105(self, ):
+
+ try:
+ self.type = T105
+
+ # C.g:107:6: ( '__asm' )
+ # C.g:107:8: '__asm'
+ self.match("__asm")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T105
+
+
+
+ # $ANTLR start T106
+ def mT106(self, ):
+
+ try:
+ self.type = T106
+
+ # C.g:108:6: ( 'case' )
+ # C.g:108:8: 'case'
+ self.match("case")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T106
+
+
+
+ # $ANTLR start T107
+ def mT107(self, ):
+
+ try:
+ self.type = T107
+
+ # C.g:109:6: ( 'default' )
+ # C.g:109:8: 'default'
+ self.match("default")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T107
+
+
+
+ # $ANTLR start T108
+ def mT108(self, ):
+
+ try:
+ self.type = T108
+
+ # C.g:110:6: ( 'if' )
+ # C.g:110:8: 'if'
+ self.match("if")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T108
+
+
+
+ # $ANTLR start T109
+ def mT109(self, ):
+
+ try:
+ self.type = T109
+
+ # C.g:111:6: ( 'else' )
+ # C.g:111:8: 'else'
+ self.match("else")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T109
+
+
+
+ # $ANTLR start T110
+ def mT110(self, ):
+
+ try:
+ self.type = T110
+
+ # C.g:112:6: ( 'switch' )
+ # C.g:112:8: 'switch'
+ self.match("switch")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T110
+
+
+
+ # $ANTLR start T111
+ def mT111(self, ):
+
+ try:
+ self.type = T111
+
+ # C.g:113:6: ( 'while' )
+ # C.g:113:8: 'while'
+ self.match("while")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T111
+
+
+
+ # $ANTLR start T112
+ def mT112(self, ):
+
+ try:
+ self.type = T112
+
+ # C.g:114:6: ( 'do' )
+ # C.g:114:8: 'do'
+ self.match("do")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T112
+
+
+
+ # $ANTLR start T113
+ def mT113(self, ):
+
+ try:
+ self.type = T113
+
+ # C.g:115:6: ( 'for' )
+ # C.g:115:8: 'for'
+ self.match("for")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T113
+
+
+
+ # $ANTLR start T114
+ def mT114(self, ):
+
+ try:
+ self.type = T114
+
+ # C.g:116:6: ( 'goto' )
+ # C.g:116:8: 'goto'
+ self.match("goto")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T114
+
+
+
+ # $ANTLR start T115
+ def mT115(self, ):
+
+ try:
+ self.type = T115
+
+ # C.g:117:6: ( 'continue' )
+ # C.g:117:8: 'continue'
+ self.match("continue")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T115
+
+
+
+ # $ANTLR start T116
+ def mT116(self, ):
+
+ try:
+ self.type = T116
+
+ # C.g:118:6: ( 'break' )
+ # C.g:118:8: 'break'
+ self.match("break")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T116
+
+
+
+ # $ANTLR start T117
+ def mT117(self, ):
+
+ try:
+ self.type = T117
+
+ # C.g:119:6: ( 'return' )
+ # C.g:119:8: 'return'
+ self.match("return")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T117
+
+
+
+ # $ANTLR start IDENTIFIER
+ def mIDENTIFIER(self, ):
+
+ try:
+ self.type = IDENTIFIER
+
+ # C.g:586:2: ( LETTER ( LETTER | '0' .. '9' )* )
+ # C.g:586:4: LETTER ( LETTER | '0' .. '9' )*
+ self.mLETTER()
+
+ # C.g:586:11: ( LETTER | '0' .. '9' )*
+ while True: #loop1
+ alt1 = 2
+ LA1_0 = self.input.LA(1)
+
+ if (LA1_0 == u'$' or (u'0' <= LA1_0 <= u'9') or (u'A' <= LA1_0 <= u'Z') or LA1_0 == u'_' or (u'a' <= LA1_0 <= u'z')) :
+ alt1 = 1
+
+
+ if alt1 == 1:
+ # C.g:
+ if self.input.LA(1) == u'$' or (u'0' <= self.input.LA(1) <= u'9') or (u'A' <= self.input.LA(1) <= u'Z') or self.input.LA(1) == u'_' or (u'a' <= self.input.LA(1) <= u'z'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ else:
+ break #loop1
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end IDENTIFIER
+
+
+
+ # $ANTLR start LETTER
+ def mLETTER(self, ):
+
+ try:
+ # C.g:591:2: ( '$' | 'A' .. 'Z' | 'a' .. 'z' | '_' )
+ # C.g:
+ if self.input.LA(1) == u'$' or (u'A' <= self.input.LA(1) <= u'Z') or self.input.LA(1) == u'_' or (u'a' <= self.input.LA(1) <= u'z'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end LETTER
+
+
+
+ # $ANTLR start CHARACTER_LITERAL
+ def mCHARACTER_LITERAL(self, ):
+
+ try:
+ self.type = CHARACTER_LITERAL
+
+ # C.g:598:5: ( ( 'L' )? '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\'' )
+ # C.g:598:9: ( 'L' )? '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\''
+ # C.g:598:9: ( 'L' )?
+ alt2 = 2
+ LA2_0 = self.input.LA(1)
+
+ if (LA2_0 == u'L') :
+ alt2 = 1
+ if alt2 == 1:
+ # C.g:598:10: 'L'
+ self.match(u'L')
+
+
+
+
+ self.match(u'\'')
+
+ # C.g:598:21: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) )
+ alt3 = 2
+ LA3_0 = self.input.LA(1)
+
+ if (LA3_0 == u'\\') :
+ alt3 = 1
+ elif ((u'\u0000' <= LA3_0 <= u'&') or (u'(' <= LA3_0 <= u'[') or (u']' <= LA3_0 <= u'\uFFFE')) :
+ alt3 = 2
+ else:
+ nvae = NoViableAltException("598:21: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) )", 3, 0, self.input)
+
+ raise nvae
+
+ if alt3 == 1:
+ # C.g:598:23: EscapeSequence
+ self.mEscapeSequence()
+
+
+
+ elif alt3 == 2:
+ # C.g:598:40: ~ ( '\\'' | '\\\\' )
+ if (u'\u0000' <= self.input.LA(1) <= u'&') or (u'(' <= self.input.LA(1) <= u'[') or (u']' <= self.input.LA(1) <= u'\uFFFE'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+
+ self.match(u'\'')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end CHARACTER_LITERAL
+
+
+
+ # $ANTLR start STRING_LITERAL
+ def mSTRING_LITERAL(self, ):
+
+ try:
+ self.type = STRING_LITERAL
+
+ # C.g:602:5: ( ( 'L' )? '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
+ # C.g:602:8: ( 'L' )? '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"'
+ # C.g:602:8: ( 'L' )?
+ alt4 = 2
+ LA4_0 = self.input.LA(1)
+
+ if (LA4_0 == u'L') :
+ alt4 = 1
+ if alt4 == 1:
+ # C.g:602:9: 'L'
+ self.match(u'L')
+
+
+
+
+ self.match(u'"')
+
+ # C.g:602:19: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )*
+ while True: #loop5
+ alt5 = 3
+ LA5_0 = self.input.LA(1)
+
+ if (LA5_0 == u'\\') :
+ alt5 = 1
+ elif ((u'\u0000' <= LA5_0 <= u'!') or (u'#' <= LA5_0 <= u'[') or (u']' <= LA5_0 <= u'\uFFFE')) :
+ alt5 = 2
+
+
+ if alt5 == 1:
+ # C.g:602:21: EscapeSequence
+ self.mEscapeSequence()
+
+
+
+ elif alt5 == 2:
+ # C.g:602:38: ~ ( '\\\\' | '\"' )
+ if (u'\u0000' <= self.input.LA(1) <= u'!') or (u'#' <= self.input.LA(1) <= u'[') or (u']' <= self.input.LA(1) <= u'\uFFFE'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ else:
+ break #loop5
+
+
+ self.match(u'"')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end STRING_LITERAL
+
+
+
+ # $ANTLR start HEX_LITERAL
+ def mHEX_LITERAL(self, ):
+
+ try:
+ self.type = HEX_LITERAL
+
+ # C.g:605:13: ( '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? )
+ # C.g:605:15: '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )?
+ self.match(u'0')
+
+ if self.input.LA(1) == u'X' or self.input.LA(1) == u'x':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+ # C.g:605:29: ( HexDigit )+
+ cnt6 = 0
+ while True: #loop6
+ alt6 = 2
+ LA6_0 = self.input.LA(1)
+
+ if ((u'0' <= LA6_0 <= u'9') or (u'A' <= LA6_0 <= u'F') or (u'a' <= LA6_0 <= u'f')) :
+ alt6 = 1
+
+
+ if alt6 == 1:
+ # C.g:605:29: HexDigit
+ self.mHexDigit()
+
+
+
+ else:
+ if cnt6 >= 1:
+ break #loop6
+
+ eee = EarlyExitException(6, self.input)
+ raise eee
+
+ cnt6 += 1
+
+
+ # C.g:605:39: ( IntegerTypeSuffix )?
+ alt7 = 2
+ LA7_0 = self.input.LA(1)
+
+ if (LA7_0 == u'L' or LA7_0 == u'U' or LA7_0 == u'l' or LA7_0 == u'u') :
+ alt7 = 1
+ if alt7 == 1:
+ # C.g:605:39: IntegerTypeSuffix
+ self.mIntegerTypeSuffix()
+
+
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end HEX_LITERAL
+
+
+
+ # $ANTLR start DECIMAL_LITERAL
+ def mDECIMAL_LITERAL(self, ):
+
+ try:
+ self.type = DECIMAL_LITERAL
+
+ # C.g:607:17: ( ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )? )
+ # C.g:607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )?
+ # C.g:607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* )
+ alt9 = 2
+ LA9_0 = self.input.LA(1)
+
+ if (LA9_0 == u'0') :
+ alt9 = 1
+ elif ((u'1' <= LA9_0 <= u'9')) :
+ alt9 = 2
+ else:
+ nvae = NoViableAltException("607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* )", 9, 0, self.input)
+
+ raise nvae
+
+ if alt9 == 1:
+ # C.g:607:20: '0'
+ self.match(u'0')
+
+
+
+ elif alt9 == 2:
+ # C.g:607:26: '1' .. '9' ( '0' .. '9' )*
+ self.matchRange(u'1', u'9')
+
+ # C.g:607:35: ( '0' .. '9' )*
+ while True: #loop8
+ alt8 = 2
+ LA8_0 = self.input.LA(1)
+
+ if ((u'0' <= LA8_0 <= u'9')) :
+ alt8 = 1
+
+
+ if alt8 == 1:
+ # C.g:607:35: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ break #loop8
+
+
+
+
+
+ # C.g:607:46: ( IntegerTypeSuffix )?
+ alt10 = 2
+ LA10_0 = self.input.LA(1)
+
+ if (LA10_0 == u'L' or LA10_0 == u'U' or LA10_0 == u'l' or LA10_0 == u'u') :
+ alt10 = 1
+ if alt10 == 1:
+ # C.g:607:46: IntegerTypeSuffix
+ self.mIntegerTypeSuffix()
+
+
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end DECIMAL_LITERAL
+
+
+
+ # $ANTLR start OCTAL_LITERAL
+ def mOCTAL_LITERAL(self, ):
+
+ try:
+ self.type = OCTAL_LITERAL
+
+ # C.g:609:15: ( '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )? )
+ # C.g:609:17: '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )?
+ self.match(u'0')
+
+ # C.g:609:21: ( '0' .. '7' )+
+ cnt11 = 0
+ while True: #loop11
+ alt11 = 2
+ LA11_0 = self.input.LA(1)
+
+ if ((u'0' <= LA11_0 <= u'7')) :
+ alt11 = 1
+
+
+ if alt11 == 1:
+ # C.g:609:22: '0' .. '7'
+ self.matchRange(u'0', u'7')
+
+
+
+ else:
+ if cnt11 >= 1:
+ break #loop11
+
+ eee = EarlyExitException(11, self.input)
+ raise eee
+
+ cnt11 += 1
+
+
+ # C.g:609:33: ( IntegerTypeSuffix )?
+ alt12 = 2
+ LA12_0 = self.input.LA(1)
+
+ if (LA12_0 == u'L' or LA12_0 == u'U' or LA12_0 == u'l' or LA12_0 == u'u') :
+ alt12 = 1
+ if alt12 == 1:
+ # C.g:609:33: IntegerTypeSuffix
+ self.mIntegerTypeSuffix()
+
+
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end OCTAL_LITERAL
+
+
+
+ # $ANTLR start HexDigit
+ def mHexDigit(self, ):
+
+ try:
+ # C.g:612:10: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) )
+ # C.g:612:12: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )
+ if (u'0' <= self.input.LA(1) <= u'9') or (u'A' <= self.input.LA(1) <= u'F') or (u'a' <= self.input.LA(1) <= u'f'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end HexDigit
+
+
+
+ # $ANTLR start IntegerTypeSuffix
+ def mIntegerTypeSuffix(self, ):
+
+ try:
+ # C.g:616:2: ( ( 'u' | 'U' ) | ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) )
+ alt13 = 4
+ LA13_0 = self.input.LA(1)
+
+ if (LA13_0 == u'U' or LA13_0 == u'u') :
+ LA13_1 = self.input.LA(2)
+
+ if (LA13_1 == u'L' or LA13_1 == u'l') :
+ LA13_3 = self.input.LA(3)
+
+ if (LA13_3 == u'L' or LA13_3 == u'l') :
+ alt13 = 4
+ else:
+ alt13 = 3
+ else:
+ alt13 = 1
+ elif (LA13_0 == u'L' or LA13_0 == u'l') :
+ alt13 = 2
+ else:
+ nvae = NoViableAltException("614:1: fragment IntegerTypeSuffix : ( ( 'u' | 'U' ) | ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) );", 13, 0, self.input)
+
+ raise nvae
+
+ if alt13 == 1:
+ # C.g:616:4: ( 'u' | 'U' )
+ if self.input.LA(1) == u'U' or self.input.LA(1) == u'u':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ elif alt13 == 2:
+ # C.g:617:4: ( 'l' | 'L' )
+ if self.input.LA(1) == u'L' or self.input.LA(1) == u'l':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ elif alt13 == 3:
+ # C.g:618:4: ( 'u' | 'U' ) ( 'l' | 'L' )
+ if self.input.LA(1) == u'U' or self.input.LA(1) == u'u':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+ if self.input.LA(1) == u'L' or self.input.LA(1) == u'l':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ elif alt13 == 4:
+ # C.g:619:4: ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' )
+ if self.input.LA(1) == u'U' or self.input.LA(1) == u'u':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+ if self.input.LA(1) == u'L' or self.input.LA(1) == u'l':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+ if self.input.LA(1) == u'L' or self.input.LA(1) == u'l':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end IntegerTypeSuffix
+
+
+
+ # $ANTLR start FLOATING_POINT_LITERAL
+ def mFLOATING_POINT_LITERAL(self, ):
+
+ try:
+ self.type = FLOATING_POINT_LITERAL
+
+ # C.g:623:5: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? | '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? | ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? | ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix )
+ alt25 = 4
+ alt25 = self.dfa25.predict(self.input)
+ if alt25 == 1:
+ # C.g:623:9: ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )?
+ # C.g:623:9: ( '0' .. '9' )+
+ cnt14 = 0
+ while True: #loop14
+ alt14 = 2
+ LA14_0 = self.input.LA(1)
+
+ if ((u'0' <= LA14_0 <= u'9')) :
+ alt14 = 1
+
+
+ if alt14 == 1:
+ # C.g:623:10: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ if cnt14 >= 1:
+ break #loop14
+
+ eee = EarlyExitException(14, self.input)
+ raise eee
+
+ cnt14 += 1
+
+
+ self.match(u'.')
+
+ # C.g:623:25: ( '0' .. '9' )*
+ while True: #loop15
+ alt15 = 2
+ LA15_0 = self.input.LA(1)
+
+ if ((u'0' <= LA15_0 <= u'9')) :
+ alt15 = 1
+
+
+ if alt15 == 1:
+ # C.g:623:26: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ break #loop15
+
+
+ # C.g:623:37: ( Exponent )?
+ alt16 = 2
+ LA16_0 = self.input.LA(1)
+
+ if (LA16_0 == u'E' or LA16_0 == u'e') :
+ alt16 = 1
+ if alt16 == 1:
+ # C.g:623:37: Exponent
+ self.mExponent()
+
+
+
+
+ # C.g:623:47: ( FloatTypeSuffix )?
+ alt17 = 2
+ LA17_0 = self.input.LA(1)
+
+ if (LA17_0 == u'D' or LA17_0 == u'F' or LA17_0 == u'd' or LA17_0 == u'f') :
+ alt17 = 1
+ if alt17 == 1:
+ # C.g:623:47: FloatTypeSuffix
+ self.mFloatTypeSuffix()
+
+
+
+
+
+
+ elif alt25 == 2:
+ # C.g:624:9: '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )?
+ self.match(u'.')
+
+ # C.g:624:13: ( '0' .. '9' )+
+ cnt18 = 0
+ while True: #loop18
+ alt18 = 2
+ LA18_0 = self.input.LA(1)
+
+ if ((u'0' <= LA18_0 <= u'9')) :
+ alt18 = 1
+
+
+ if alt18 == 1:
+ # C.g:624:14: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ if cnt18 >= 1:
+ break #loop18
+
+ eee = EarlyExitException(18, self.input)
+ raise eee
+
+ cnt18 += 1
+
+
+ # C.g:624:25: ( Exponent )?
+ alt19 = 2
+ LA19_0 = self.input.LA(1)
+
+ if (LA19_0 == u'E' or LA19_0 == u'e') :
+ alt19 = 1
+ if alt19 == 1:
+ # C.g:624:25: Exponent
+ self.mExponent()
+
+
+
+
+ # C.g:624:35: ( FloatTypeSuffix )?
+ alt20 = 2
+ LA20_0 = self.input.LA(1)
+
+ if (LA20_0 == u'D' or LA20_0 == u'F' or LA20_0 == u'd' or LA20_0 == u'f') :
+ alt20 = 1
+ if alt20 == 1:
+ # C.g:624:35: FloatTypeSuffix
+ self.mFloatTypeSuffix()
+
+
+
+
+
+
+ elif alt25 == 3:
+ # C.g:625:9: ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )?
+ # C.g:625:9: ( '0' .. '9' )+
+ cnt21 = 0
+ while True: #loop21
+ alt21 = 2
+ LA21_0 = self.input.LA(1)
+
+ if ((u'0' <= LA21_0 <= u'9')) :
+ alt21 = 1
+
+
+ if alt21 == 1:
+ # C.g:625:10: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ if cnt21 >= 1:
+ break #loop21
+
+ eee = EarlyExitException(21, self.input)
+ raise eee
+
+ cnt21 += 1
+
+
+ self.mExponent()
+
+ # C.g:625:30: ( FloatTypeSuffix )?
+ alt22 = 2
+ LA22_0 = self.input.LA(1)
+
+ if (LA22_0 == u'D' or LA22_0 == u'F' or LA22_0 == u'd' or LA22_0 == u'f') :
+ alt22 = 1
+ if alt22 == 1:
+ # C.g:625:30: FloatTypeSuffix
+ self.mFloatTypeSuffix()
+
+
+
+
+
+
+ elif alt25 == 4:
+ # C.g:626:9: ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix
+ # C.g:626:9: ( '0' .. '9' )+
+ cnt23 = 0
+ while True: #loop23
+ alt23 = 2
+ LA23_0 = self.input.LA(1)
+
+ if ((u'0' <= LA23_0 <= u'9')) :
+ alt23 = 1
+
+
+ if alt23 == 1:
+ # C.g:626:10: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ if cnt23 >= 1:
+ break #loop23
+
+ eee = EarlyExitException(23, self.input)
+ raise eee
+
+ cnt23 += 1
+
+
+ # C.g:626:21: ( Exponent )?
+ alt24 = 2
+ LA24_0 = self.input.LA(1)
+
+ if (LA24_0 == u'E' or LA24_0 == u'e') :
+ alt24 = 1
+ if alt24 == 1:
+ # C.g:626:21: Exponent
+ self.mExponent()
+
+
+
+
+ self.mFloatTypeSuffix()
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end FLOATING_POINT_LITERAL
+
+
+
+ # $ANTLR start Exponent
+ def mExponent(self, ):
+
+ try:
+ # C.g:630:10: ( ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ )
+ # C.g:630:12: ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+
+ if self.input.LA(1) == u'E' or self.input.LA(1) == u'e':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+ # C.g:630:22: ( '+' | '-' )?
+ alt26 = 2
+ LA26_0 = self.input.LA(1)
+
+ if (LA26_0 == u'+' or LA26_0 == u'-') :
+ alt26 = 1
+ if alt26 == 1:
+ # C.g:
+ if self.input.LA(1) == u'+' or self.input.LA(1) == u'-':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+
+ # C.g:630:33: ( '0' .. '9' )+
+ cnt27 = 0
+ while True: #loop27
+ alt27 = 2
+ LA27_0 = self.input.LA(1)
+
+ if ((u'0' <= LA27_0 <= u'9')) :
+ alt27 = 1
+
+
+ if alt27 == 1:
+ # C.g:630:34: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ if cnt27 >= 1:
+ break #loop27
+
+ eee = EarlyExitException(27, self.input)
+ raise eee
+
+ cnt27 += 1
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end Exponent
+
+
+
+ # $ANTLR start FloatTypeSuffix
+ def mFloatTypeSuffix(self, ):
+
+ try:
+ # C.g:633:17: ( ( 'f' | 'F' | 'd' | 'D' ) )
+ # C.g:633:19: ( 'f' | 'F' | 'd' | 'D' )
+ if self.input.LA(1) == u'D' or self.input.LA(1) == u'F' or self.input.LA(1) == u'd' or self.input.LA(1) == u'f':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end FloatTypeSuffix
+
+
+
+ # $ANTLR start EscapeSequence
+ def mEscapeSequence(self, ):
+
+ try:
+ # C.g:637:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape )
+ alt28 = 2
+ LA28_0 = self.input.LA(1)
+
+ if (LA28_0 == u'\\') :
+ LA28_1 = self.input.LA(2)
+
+ if (LA28_1 == u'"' or LA28_1 == u'\'' or LA28_1 == u'\\' or LA28_1 == u'b' or LA28_1 == u'f' or LA28_1 == u'n' or LA28_1 == u'r' or LA28_1 == u't') :
+ alt28 = 1
+ elif ((u'0' <= LA28_1 <= u'7')) :
+ alt28 = 2
+ else:
+ nvae = NoViableAltException("635:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape );", 28, 1, self.input)
+
+ raise nvae
+
+ else:
+ nvae = NoViableAltException("635:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape );", 28, 0, self.input)
+
+ raise nvae
+
+ if alt28 == 1:
+ # C.g:637:8: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' )
+ self.match(u'\\')
+
+ if self.input.LA(1) == u'"' or self.input.LA(1) == u'\'' or self.input.LA(1) == u'\\' or self.input.LA(1) == u'b' or self.input.LA(1) == u'f' or self.input.LA(1) == u'n' or self.input.LA(1) == u'r' or self.input.LA(1) == u't':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ elif alt28 == 2:
+ # C.g:638:9: OctalEscape
+ self.mOctalEscape()
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end EscapeSequence
+
+
+
+ # $ANTLR start OctalEscape
+ def mOctalEscape(self, ):
+
+ try:
+ # C.g:643:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
+ alt29 = 3
+ LA29_0 = self.input.LA(1)
+
+ if (LA29_0 == u'\\') :
+ LA29_1 = self.input.LA(2)
+
+ if ((u'0' <= LA29_1 <= u'3')) :
+ LA29_2 = self.input.LA(3)
+
+ if ((u'0' <= LA29_2 <= u'7')) :
+ LA29_4 = self.input.LA(4)
+
+ if ((u'0' <= LA29_4 <= u'7')) :
+ alt29 = 1
+ else:
+ alt29 = 2
+ else:
+ alt29 = 3
+ elif ((u'4' <= LA29_1 <= u'7')) :
+ LA29_3 = self.input.LA(3)
+
+ if ((u'0' <= LA29_3 <= u'7')) :
+ alt29 = 2
+ else:
+ alt29 = 3
+ else:
+ nvae = NoViableAltException("641:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 29, 1, self.input)
+
+ raise nvae
+
+ else:
+ nvae = NoViableAltException("641:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 29, 0, self.input)
+
+ raise nvae
+
+ if alt29 == 1:
+ # C.g:643:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
+ self.match(u'\\')
+
+ # C.g:643:14: ( '0' .. '3' )
+ # C.g:643:15: '0' .. '3'
+ self.matchRange(u'0', u'3')
+
+
+
+
+ # C.g:643:25: ( '0' .. '7' )
+ # C.g:643:26: '0' .. '7'
+ self.matchRange(u'0', u'7')
+
+
+
+
+ # C.g:643:36: ( '0' .. '7' )
+ # C.g:643:37: '0' .. '7'
+ self.matchRange(u'0', u'7')
+
+
+
+
+
+
+ elif alt29 == 2:
+ # C.g:644:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
+ self.match(u'\\')
+
+ # C.g:644:14: ( '0' .. '7' )
+ # C.g:644:15: '0' .. '7'
+ self.matchRange(u'0', u'7')
+
+
+
+
+ # C.g:644:25: ( '0' .. '7' )
+ # C.g:644:26: '0' .. '7'
+ self.matchRange(u'0', u'7')
+
+
+
+
+
+
+ elif alt29 == 3:
+ # C.g:645:9: '\\\\' ( '0' .. '7' )
+ self.match(u'\\')
+
+ # C.g:645:14: ( '0' .. '7' )
+ # C.g:645:15: '0' .. '7'
+ self.matchRange(u'0', u'7')
+
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end OctalEscape
+
+
+
+ # $ANTLR start UnicodeEscape
+ def mUnicodeEscape(self, ):
+
+ try:
+ # C.g:650:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit )
+ # C.g:650:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit
+ self.match(u'\\')
+
+ self.match(u'u')
+
+ self.mHexDigit()
+
+ self.mHexDigit()
+
+ self.mHexDigit()
+
+ self.mHexDigit()
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end UnicodeEscape
+
+
+
+ # $ANTLR start WS
+ def mWS(self, ):
+
+ try:
+ self.type = WS
+
+ # C.g:653:5: ( ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) )
+ # C.g:653:8: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' )
+ if (u'\t' <= self.input.LA(1) <= u'\n') or (u'\f' <= self.input.LA(1) <= u'\r') or self.input.LA(1) == u' ':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+ #action start
+ self.channel=HIDDEN;
+ #action end
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end WS
+
+
+
+ # $ANTLR start BS
+ def mBS(self, ):
+
+ try:
+ self.type = BS
+
+ # C.g:657:5: ( ( '\\\\' ) )
+ # C.g:657:7: ( '\\\\' )
+ # C.g:657:7: ( '\\\\' )
+ # C.g:657:8: '\\\\'
+ self.match(u'\\')
+
+
+
+
+ #action start
+ self.channel=HIDDEN;
+ #action end
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end BS
+
+
+
+ # $ANTLR start UnicodeVocabulary
+ def mUnicodeVocabulary(self, ):
+
+ try:
+ self.type = UnicodeVocabulary
+
+ # C.g:665:5: ( '\\u0003' .. '\\uFFFE' )
+ # C.g:665:7: '\\u0003' .. '\\uFFFE'
+ self.matchRange(u'\u0003', u'\uFFFE')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end UnicodeVocabulary
+
+
+
+ # $ANTLR start COMMENT
+ def mCOMMENT(self, ):
+
+ try:
+ self.type = COMMENT
+
+ # C.g:668:5: ( '/*' ( options {greedy=false; } : . )* '*/' )
+ # C.g:668:9: '/*' ( options {greedy=false; } : . )* '*/'
+ self.match("/*")
+
+
+ # C.g:668:14: ( options {greedy=false; } : . )*
+ while True: #loop30
+ alt30 = 2
+ LA30_0 = self.input.LA(1)
+
+ if (LA30_0 == u'*') :
+ LA30_1 = self.input.LA(2)
+
+ if (LA30_1 == u'/') :
+ alt30 = 2
+ elif ((u'\u0000' <= LA30_1 <= u'.') or (u'0' <= LA30_1 <= u'\uFFFE')) :
+ alt30 = 1
+
+
+ elif ((u'\u0000' <= LA30_0 <= u')') or (u'+' <= LA30_0 <= u'\uFFFE')) :
+ alt30 = 1
+
+
+ if alt30 == 1:
+ # C.g:668:42: .
+ self.matchAny()
+
+
+
+ else:
+ break #loop30
+
+
+ self.match("*/")
+
+
+ #action start
+ self.channel=HIDDEN;
+ #action end
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end COMMENT
+
+
+
+ # $ANTLR start LINE_COMMENT
+ def mLINE_COMMENT(self, ):
+
+ try:
+ self.type = LINE_COMMENT
+
+ # C.g:673:5: ( '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' )
+ # C.g:673:7: '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n'
+ self.match("//")
+
+
+ # C.g:673:12: (~ ( '\\n' | '\\r' ) )*
+ while True: #loop31
+ alt31 = 2
+ LA31_0 = self.input.LA(1)
+
+ if ((u'\u0000' <= LA31_0 <= u'\t') or (u'\u000B' <= LA31_0 <= u'\f') or (u'\u000E' <= LA31_0 <= u'\uFFFE')) :
+ alt31 = 1
+
+
+ if alt31 == 1:
+ # C.g:673:12: ~ ( '\\n' | '\\r' )
+ if (u'\u0000' <= self.input.LA(1) <= u'\t') or (u'\u000B' <= self.input.LA(1) <= u'\f') or (u'\u000E' <= self.input.LA(1) <= u'\uFFFE'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ else:
+ break #loop31
+
+
+ # C.g:673:26: ( '\\r' )?
+ alt32 = 2
+ LA32_0 = self.input.LA(1)
+
+ if (LA32_0 == u'\r') :
+ alt32 = 1
+ if alt32 == 1:
+ # C.g:673:26: '\\r'
+ self.match(u'\r')
+
+
+
+
+ self.match(u'\n')
+
+ #action start
+ self.channel=HIDDEN;
+ #action end
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end LINE_COMMENT
+
+
+
+ # $ANTLR start LINE_COMMAND
+ def mLINE_COMMAND(self, ):
+
+ try:
+ self.type = LINE_COMMAND
+
+ # C.g:678:5: ( '#' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' )
+ # C.g:678:7: '#' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n'
+ self.match(u'#')
+
+ # C.g:678:11: (~ ( '\\n' | '\\r' ) )*
+ while True: #loop33
+ alt33 = 2
+ LA33_0 = self.input.LA(1)
+
+ if ((u'\u0000' <= LA33_0 <= u'\t') or (u'\u000B' <= LA33_0 <= u'\f') or (u'\u000E' <= LA33_0 <= u'\uFFFE')) :
+ alt33 = 1
+
+
+ if alt33 == 1:
+ # C.g:678:11: ~ ( '\\n' | '\\r' )
+ if (u'\u0000' <= self.input.LA(1) <= u'\t') or (u'\u000B' <= self.input.LA(1) <= u'\f') or (u'\u000E' <= self.input.LA(1) <= u'\uFFFE'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ else:
+ break #loop33
+
+
+ # C.g:678:25: ( '\\r' )?
+ alt34 = 2
+ LA34_0 = self.input.LA(1)
+
+ if (LA34_0 == u'\r') :
+ alt34 = 1
+ if alt34 == 1:
+ # C.g:678:25: '\\r'
+ self.match(u'\r')
+
+
+
+
+ self.match(u'\n')
+
+ #action start
+ self.channel=HIDDEN;
+ #action end
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end LINE_COMMAND
+
+
+
+ def mTokens(self):
+ # C.g:1:8: ( T25 | T26 | T27 | T28 | T29 | T30 | T31 | T32 | T33 | T34 | T35 | T36 | T37 | T38 | T39 | T40 | T41 | T42 | T43 | T44 | T45 | T46 | T47 | T48 | T49 | T50 | T51 | T52 | T53 | T54 | T55 | T56 | T57 | T58 | T59 | T60 | T61 | T62 | T63 | T64 | T65 | T66 | T67 | T68 | T69 | T70 | T71 | T72 | T73 | T74 | T75 | T76 | T77 | T78 | T79 | T80 | T81 | T82 | T83 | T84 | T85 | T86 | T87 | T88 | T89 | T90 | T91 | T92 | T93 | T94 | T95 | T96 | T97 | T98 | T99 | T100 | T101 | T102 | T103 | T104 | T105 | T106 | T107 | T108 | T109 | T110 | T111 | T112 | T113 | T114 | T115 | T116 | T117 | IDENTIFIER | CHARACTER_LITERAL | STRING_LITERAL | HEX_LITERAL | DECIMAL_LITERAL | OCTAL_LITERAL | FLOATING_POINT_LITERAL | WS | BS | UnicodeVocabulary | COMMENT | LINE_COMMENT | LINE_COMMAND )
+ alt35 = 106
+ alt35 = self.dfa35.predict(self.input)
+ if alt35 == 1:
+ # C.g:1:10: T25
+ self.mT25()
+
+
+
+ elif alt35 == 2:
+ # C.g:1:14: T26
+ self.mT26()
+
+
+
+ elif alt35 == 3:
+ # C.g:1:18: T27
+ self.mT27()
+
+
+
+ elif alt35 == 4:
+ # C.g:1:22: T28
+ self.mT28()
+
+
+
+ elif alt35 == 5:
+ # C.g:1:26: T29
+ self.mT29()
+
+
+
+ elif alt35 == 6:
+ # C.g:1:30: T30
+ self.mT30()
+
+
+
+ elif alt35 == 7:
+ # C.g:1:34: T31
+ self.mT31()
+
+
+
+ elif alt35 == 8:
+ # C.g:1:38: T32
+ self.mT32()
+
+
+
+ elif alt35 == 9:
+ # C.g:1:42: T33
+ self.mT33()
+
+
+
+ elif alt35 == 10:
+ # C.g:1:46: T34
+ self.mT34()
+
+
+
+ elif alt35 == 11:
+ # C.g:1:50: T35
+ self.mT35()
+
+
+
+ elif alt35 == 12:
+ # C.g:1:54: T36
+ self.mT36()
+
+
+
+ elif alt35 == 13:
+ # C.g:1:58: T37
+ self.mT37()
+
+
+
+ elif alt35 == 14:
+ # C.g:1:62: T38
+ self.mT38()
+
+
+
+ elif alt35 == 15:
+ # C.g:1:66: T39
+ self.mT39()
+
+
+
+ elif alt35 == 16:
+ # C.g:1:70: T40
+ self.mT40()
+
+
+
+ elif alt35 == 17:
+ # C.g:1:74: T41
+ self.mT41()
+
+
+
+ elif alt35 == 18:
+ # C.g:1:78: T42
+ self.mT42()
+
+
+
+ elif alt35 == 19:
+ # C.g:1:82: T43
+ self.mT43()
+
+
+
+ elif alt35 == 20:
+ # C.g:1:86: T44
+ self.mT44()
+
+
+
+ elif alt35 == 21:
+ # C.g:1:90: T45
+ self.mT45()
+
+
+
+ elif alt35 == 22:
+ # C.g:1:94: T46
+ self.mT46()
+
+
+
+ elif alt35 == 23:
+ # C.g:1:98: T47
+ self.mT47()
+
+
+
+ elif alt35 == 24:
+ # C.g:1:102: T48
+ self.mT48()
+
+
+
+ elif alt35 == 25:
+ # C.g:1:106: T49
+ self.mT49()
+
+
+
+ elif alt35 == 26:
+ # C.g:1:110: T50
+ self.mT50()
+
+
+
+ elif alt35 == 27:
+ # C.g:1:114: T51
+ self.mT51()
+
+
+
+ elif alt35 == 28:
+ # C.g:1:118: T52
+ self.mT52()
+
+
+
+ elif alt35 == 29:
+ # C.g:1:122: T53
+ self.mT53()
+
+
+
+ elif alt35 == 30:
+ # C.g:1:126: T54
+ self.mT54()
+
+
+
+ elif alt35 == 31:
+ # C.g:1:130: T55
+ self.mT55()
+
+
+
+ elif alt35 == 32:
+ # C.g:1:134: T56
+ self.mT56()
+
+
+
+ elif alt35 == 33:
+ # C.g:1:138: T57
+ self.mT57()
+
+
+
+ elif alt35 == 34:
+ # C.g:1:142: T58
+ self.mT58()
+
+
+
+ elif alt35 == 35:
+ # C.g:1:146: T59
+ self.mT59()
+
+
+
+ elif alt35 == 36:
+ # C.g:1:150: T60
+ self.mT60()
+
+
+
+ elif alt35 == 37:
+ # C.g:1:154: T61
+ self.mT61()
+
+
+
+ elif alt35 == 38:
+ # C.g:1:158: T62
+ self.mT62()
+
+
+
+ elif alt35 == 39:
+ # C.g:1:162: T63
+ self.mT63()
+
+
+
+ elif alt35 == 40:
+ # C.g:1:166: T64
+ self.mT64()
+
+
+
+ elif alt35 == 41:
+ # C.g:1:170: T65
+ self.mT65()
+
+
+
+ elif alt35 == 42:
+ # C.g:1:174: T66
+ self.mT66()
+
+
+
+ elif alt35 == 43:
+ # C.g:1:178: T67
+ self.mT67()
+
+
+
+ elif alt35 == 44:
+ # C.g:1:182: T68
+ self.mT68()
+
+
+
+ elif alt35 == 45:
+ # C.g:1:186: T69
+ self.mT69()
+
+
+
+ elif alt35 == 46:
+ # C.g:1:190: T70
+ self.mT70()
+
+
+
+ elif alt35 == 47:
+ # C.g:1:194: T71
+ self.mT71()
+
+
+
+ elif alt35 == 48:
+ # C.g:1:198: T72
+ self.mT72()
+
+
+
+ elif alt35 == 49:
+ # C.g:1:202: T73
+ self.mT73()
+
+
+
+ elif alt35 == 50:
+ # C.g:1:206: T74
+ self.mT74()
+
+
+
+ elif alt35 == 51:
+ # C.g:1:210: T75
+ self.mT75()
+
+
+
+ elif alt35 == 52:
+ # C.g:1:214: T76
+ self.mT76()
+
+
+
+ elif alt35 == 53:
+ # C.g:1:218: T77
+ self.mT77()
+
+
+
+ elif alt35 == 54:
+ # C.g:1:222: T78
+ self.mT78()
+
+
+
+ elif alt35 == 55:
+ # C.g:1:226: T79
+ self.mT79()
+
+
+
+ elif alt35 == 56:
+ # C.g:1:230: T80
+ self.mT80()
+
+
+
+ elif alt35 == 57:
+ # C.g:1:234: T81
+ self.mT81()
+
+
+
+ elif alt35 == 58:
+ # C.g:1:238: T82
+ self.mT82()
+
+
+
+ elif alt35 == 59:
+ # C.g:1:242: T83
+ self.mT83()
+
+
+
+ elif alt35 == 60:
+ # C.g:1:246: T84
+ self.mT84()
+
+
+
+ elif alt35 == 61:
+ # C.g:1:250: T85
+ self.mT85()
+
+
+
+ elif alt35 == 62:
+ # C.g:1:254: T86
+ self.mT86()
+
+
+
+ elif alt35 == 63:
+ # C.g:1:258: T87
+ self.mT87()
+
+
+
+ elif alt35 == 64:
+ # C.g:1:262: T88
+ self.mT88()
+
+
+
+ elif alt35 == 65:
+ # C.g:1:266: T89
+ self.mT89()
+
+
+
+ elif alt35 == 66:
+ # C.g:1:270: T90
+ self.mT90()
+
+
+
+ elif alt35 == 67:
+ # C.g:1:274: T91
+ self.mT91()
+
+
+
+ elif alt35 == 68:
+ # C.g:1:278: T92
+ self.mT92()
+
+
+
+ elif alt35 == 69:
+ # C.g:1:282: T93
+ self.mT93()
+
+
+
+ elif alt35 == 70:
+ # C.g:1:286: T94
+ self.mT94()
+
+
+
+ elif alt35 == 71:
+ # C.g:1:290: T95
+ self.mT95()
+
+
+
+ elif alt35 == 72:
+ # C.g:1:294: T96
+ self.mT96()
+
+
+
+ elif alt35 == 73:
+ # C.g:1:298: T97
+ self.mT97()
+
+
+
+ elif alt35 == 74:
+ # C.g:1:302: T98
+ self.mT98()
+
+
+
+ elif alt35 == 75:
+ # C.g:1:306: T99
+ self.mT99()
+
+
+
+ elif alt35 == 76:
+ # C.g:1:310: T100
+ self.mT100()
+
+
+
+ elif alt35 == 77:
+ # C.g:1:315: T101
+ self.mT101()
+
+
+
+ elif alt35 == 78:
+ # C.g:1:320: T102
+ self.mT102()
+
+
+
+ elif alt35 == 79:
+ # C.g:1:325: T103
+ self.mT103()
+
+
+
+ elif alt35 == 80:
+ # C.g:1:330: T104
+ self.mT104()
+
+
+
+ elif alt35 == 81:
+ # C.g:1:335: T105
+ self.mT105()
+
+
+
+ elif alt35 == 82:
+ # C.g:1:340: T106
+ self.mT106()
+
+
+
+ elif alt35 == 83:
+ # C.g:1:345: T107
+ self.mT107()
+
+
+
+ elif alt35 == 84:
+ # C.g:1:350: T108
+ self.mT108()
+
+
+
+ elif alt35 == 85:
+ # C.g:1:355: T109
+ self.mT109()
+
+
+
+ elif alt35 == 86:
+ # C.g:1:360: T110
+ self.mT110()
+
+
+
+ elif alt35 == 87:
+ # C.g:1:365: T111
+ self.mT111()
+
+
+
+ elif alt35 == 88:
+ # C.g:1:370: T112
+ self.mT112()
+
+
+
+ elif alt35 == 89:
+ # C.g:1:375: T113
+ self.mT113()
+
+
+
+ elif alt35 == 90:
+ # C.g:1:380: T114
+ self.mT114()
+
+
+
+ elif alt35 == 91:
+ # C.g:1:385: T115
+ self.mT115()
+
+
+
+ elif alt35 == 92:
+ # C.g:1:390: T116
+ self.mT116()
+
+
+
+ elif alt35 == 93:
+ # C.g:1:395: T117
+ self.mT117()
+
+
+
+ elif alt35 == 94:
+ # C.g:1:400: IDENTIFIER
+ self.mIDENTIFIER()
+
+
+
+ elif alt35 == 95:
+ # C.g:1:411: CHARACTER_LITERAL
+ self.mCHARACTER_LITERAL()
+
+
+
+ elif alt35 == 96:
+ # C.g:1:429: STRING_LITERAL
+ self.mSTRING_LITERAL()
+
+
+
+ elif alt35 == 97:
+ # C.g:1:444: HEX_LITERAL
+ self.mHEX_LITERAL()
+
+
+
+ elif alt35 == 98:
+ # C.g:1:456: DECIMAL_LITERAL
+ self.mDECIMAL_LITERAL()
+
+
+
+ elif alt35 == 99:
+ # C.g:1:472: OCTAL_LITERAL
+ self.mOCTAL_LITERAL()
+
+
+
+ elif alt35 == 100:
+ # C.g:1:486: FLOATING_POINT_LITERAL
+ self.mFLOATING_POINT_LITERAL()
+
+
+
+ elif alt35 == 101:
+ # C.g:1:509: WS
+ self.mWS()
+
+
+
+ elif alt35 == 102:
+ # C.g:1:512: BS
+ self.mBS()
+
+
+
+ elif alt35 == 103:
+ # C.g:1:515: UnicodeVocabulary
+ self.mUnicodeVocabulary()
+
+
+
+ elif alt35 == 104:
+ # C.g:1:533: COMMENT
+ self.mCOMMENT()
+
+
+
+ elif alt35 == 105:
+ # C.g:1:541: LINE_COMMENT
+ self.mLINE_COMMENT()
+
+
+
+ elif alt35 == 106:
+ # C.g:1:554: LINE_COMMAND
+ self.mLINE_COMMAND()
+
+
+
+
+
+
+
+
+ # lookup tables for DFA #25
+
+ DFA25_eot = DFA.unpack(
+ u"\7\uffff\1\10\2\uffff"
+ )
+
+ DFA25_eof = DFA.unpack(
+ u"\12\uffff"
+ )
+
+ DFA25_min = DFA.unpack(
+ u"\2\56\2\uffff\1\53\1\uffff\2\60\2\uffff"
+ )
+
+ DFA25_max = DFA.unpack(
+ u"\1\71\1\146\2\uffff\1\71\1\uffff\1\71\1\146\2\uffff"
+ )
+
+ DFA25_accept = DFA.unpack(
+ u"\2\uffff\1\2\1\1\1\uffff\1\4\2\uffff\2\3"
+ )
+
+ DFA25_special = DFA.unpack(
+ u"\12\uffff"
+ )
+
+
+ DFA25_transition = [
+ DFA.unpack(u"\1\2\1\uffff\12\1"),
+ DFA.unpack(u"\1\3\1\uffff\12\1\12\uffff\1\5\1\4\1\5\35\uffff\1\5"
+ u"\1\4\1\5"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\6\1\uffff\1\6\2\uffff\12\7"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\12\7"),
+ DFA.unpack(u"\12\7\12\uffff\1\11\1\uffff\1\11\35\uffff\1\11\1\uffff"
+ u"\1\11"),
+ DFA.unpack(u""),
+ DFA.unpack(u"")
+ ]
+
+ # class definition for DFA #25
+
+ DFA25 = DFA
+ # lookup tables for DFA #35
+
+ DFA35_eot = DFA.unpack(
+ u"\2\uffff\1\76\1\uffff\1\101\14\76\3\uffff\10\76\4\uffff\1\151\1"
+ u"\153\1\157\1\163\1\167\1\171\1\174\1\uffff\1\177\1\u0082\1\u0085"
+ u"\1\u0087\1\u008a\1\uffff\5\76\1\uffff\2\73\2\u0095\2\uffff\1\73"
+ u"\2\uffff\1\76\4\uffff\16\76\1\u00ad\5\76\1\u00b4\1\76\3\uffff\1"
+ u"\u00b7\10\76\34\uffff\1\u00c1\2\uffff\1\u00c3\10\uffff\5\76\3\uffff"
+ u"\1\u00c9\1\uffff\1\u0095\3\uffff\23\76\1\uffff\1\u00de\1\76\1\u00e0"
+ u"\3\76\1\uffff\2\76\1\uffff\1\76\1\u00e7\6\76\4\uffff\5\76\1\uffff"
+ u"\1\76\1\u00f5\1\76\1\u00f7\6\76\1\u00fe\4\76\1\u0103\1\u0104\2"
+ u"\76\1\u0107\1\uffff\1\u0108\1\uffff\6\76\1\uffff\10\76\1\u0118"
+ u"\1\76\1\u011a\2\76\1\uffff\1\76\1\uffff\5\76\1\u0123\1\uffff\4"
+ u"\76\2\uffff\1\76\1\u0129\2\uffff\1\u012a\3\76\1\u012e\1\76\1\u0130"
+ u"\7\76\1\u0139\1\uffff\1\u013a\1\uffff\1\u013b\1\76\1\u013d\1\u013e"
+ u"\1\u013f\1\u0140\1\u0141\1\u0142\1\uffff\1\76\1\u0144\1\u0145\2"
+ u"\76\2\uffff\1\76\1\u0149\1\76\1\uffff\1\76\1\uffff\5\76\1\u0151"
+ u"\1\u0152\1\76\3\uffff\1\u0154\6\uffff\1\76\2\uffff\2\76\1\u0158"
+ u"\1\uffff\7\76\2\uffff\1\u0160\1\uffff\1\u0161\1\u0162\1\u0163\1"
+ u"\uffff\1\u0164\1\u0165\1\76\1\u0167\3\76\6\uffff\1\u016b\1\uffff"
+ u"\3\76\1\uffff\21\76\1\u0180\2\76\1\uffff\3\76\1\u0186\1\76\1\uffff"
+ u"\11\76\1\u0191\1\uffff"
+ )
+
+ DFA35_eof = DFA.unpack(
+ u"\u0192\uffff"
+ )
+
+ DFA35_min = DFA.unpack(
+ u"\1\3\1\uffff\1\171\1\uffff\1\75\1\154\1\150\1\165\1\145\1\124\1"
+ u"\157\1\141\1\146\1\157\1\154\1\145\1\156\3\uffff\1\116\1\120\1"
+ u"\117\1\116\1\117\1\114\1\106\1\101\4\uffff\1\75\1\56\1\53\1\55"
+ u"\1\52\1\75\1\46\1\uffff\1\75\1\74\3\75\1\uffff\1\137\1\150\1\157"
+ u"\1\162\1\42\1\uffff\2\0\2\56\2\uffff\1\0\2\uffff\1\160\4\uffff"
+ u"\1\163\1\164\1\165\1\151\1\141\1\147\1\157\1\164\1\147\1\101\1"
+ u"\151\1\163\1\156\1\141\1\44\1\164\1\156\1\162\1\157\1\146\1\44"
+ u"\1\151\3\uffff\1\44\2\124\1\116\1\101\1\114\1\117\1\111\1\103\34"
+ u"\uffff\1\75\2\uffff\1\75\10\uffff\1\141\1\163\1\151\1\164\1\145"
+ u"\3\uffff\1\56\1\uffff\1\56\3\uffff\3\145\1\155\2\164\1\165\1\145"
+ u"\1\156\1\162\1\157\1\151\1\165\1\124\1\141\1\144\1\145\1\163\1"
+ u"\162\1\uffff\1\44\1\147\1\44\2\141\1\142\1\uffff\1\151\1\157\1"
+ u"\uffff\1\111\1\44\1\123\1\114\1\101\1\102\1\101\1\113\4\uffff\1"
+ u"\163\1\155\1\154\1\157\1\141\1\uffff\1\144\1\44\1\162\1\44\1\143"
+ u"\1\151\1\143\1\157\1\145\1\164\1\44\1\163\1\162\1\111\1\164\2\44"
+ u"\1\151\1\164\1\44\1\uffff\1\44\1\uffff\1\164\1\165\1\154\1\147"
+ u"\1\156\1\117\1\uffff\1\124\1\111\1\124\1\101\1\102\1\120\1\105"
+ u"\1\155\1\44\1\145\1\44\1\153\1\145\1\uffff\1\156\1\uffff\1\150"
+ u"\1\143\1\164\1\146\1\144\1\44\1\uffff\1\164\1\156\1\103\1\151\2"
+ u"\uffff\1\156\1\44\2\uffff\1\44\1\154\1\145\1\156\1\44\1\116\1\44"
+ u"\1\107\1\111\1\114\1\125\1\117\1\111\1\104\1\44\1\uffff\1\44\1"
+ u"\uffff\1\44\1\146\6\44\1\uffff\1\145\2\44\1\154\1\165\2\uffff\1"
+ u"\164\1\44\1\145\1\uffff\1\101\1\uffff\1\116\1\114\1\137\1\116\1"
+ u"\117\2\44\1\137\3\uffff\1\44\6\uffff\1\162\2\uffff\2\145\1\44\1"
+ u"\uffff\1\144\1\114\2\105\1\122\2\124\2\uffff\1\44\1\uffff\3\44"
+ u"\1\uffff\2\44\1\104\1\44\1\105\1\111\1\123\6\uffff\1\44\1\uffff"
+ u"\2\115\1\105\1\uffff\1\117\1\105\1\122\1\126\1\123\1\126\2\105"
+ u"\1\111\1\137\1\122\1\103\1\111\1\126\1\105\1\106\1\111\1\44\1\137"
+ u"\1\103\1\uffff\1\125\1\105\1\116\1\44\1\122\1\uffff\1\105\1\106"
+ u"\1\105\1\122\1\105\1\116\1\103\1\105\1\104\1\44\1\uffff"
+ )
+
+ DFA35_max = DFA.unpack(
+ u"\1\ufffe\1\uffff\1\171\1\uffff\1\75\1\170\1\167\1\165\1\145\1\124"
+ u"\2\157\1\156\3\157\1\156\3\uffff\1\116\1\125\1\117\1\116\1\117"
+ u"\1\114\1\106\1\101\4\uffff\1\75\1\71\1\75\1\76\3\75\1\uffff\2\75"
+ u"\1\76\1\75\1\174\1\uffff\1\141\1\150\1\157\1\162\1\47\1\uffff\2"
+ u"\ufffe\1\170\1\146\2\uffff\1\ufffe\2\uffff\1\160\4\uffff\1\163"
+ u"\1\164\1\165\1\151\1\162\1\172\1\157\2\164\1\101\1\154\1\163\1"
+ u"\156\1\141\1\172\1\164\1\156\1\162\1\157\1\146\1\172\1\163\3\uffff"
+ u"\1\172\2\124\1\116\1\101\1\114\1\117\1\111\1\103\34\uffff\1\75"
+ u"\2\uffff\1\75\10\uffff\1\141\1\163\1\151\1\164\1\145\3\uffff\1"
+ u"\146\1\uffff\1\146\3\uffff\3\145\1\155\2\164\1\165\1\145\1\156"
+ u"\1\162\1\157\1\151\1\165\1\124\1\141\1\144\1\145\1\164\1\162\1"
+ u"\uffff\1\172\1\147\1\172\2\141\1\142\1\uffff\1\151\1\157\1\uffff"
+ u"\1\111\1\172\1\123\1\114\1\101\1\102\1\137\1\113\4\uffff\1\163"
+ u"\1\155\1\154\1\157\1\141\1\uffff\1\144\1\172\1\162\1\172\1\143"
+ u"\1\151\1\143\1\157\1\145\1\164\1\172\1\163\1\162\1\111\1\164\2"
+ u"\172\1\151\1\164\1\172\1\uffff\1\172\1\uffff\1\164\1\165\1\154"
+ u"\1\147\1\156\1\117\1\uffff\1\124\1\111\1\124\1\101\1\122\1\120"
+ u"\1\105\1\155\1\172\1\145\1\172\1\153\1\145\1\uffff\1\156\1\uffff"
+ u"\1\150\1\143\1\164\1\146\1\144\1\172\1\uffff\1\164\1\156\1\103"
+ u"\1\151\2\uffff\1\156\1\172\2\uffff\1\172\1\154\1\145\1\156\1\172"
+ u"\1\116\1\172\1\107\1\111\1\114\1\125\1\117\1\111\1\104\1\172\1"
+ u"\uffff\1\172\1\uffff\1\172\1\146\6\172\1\uffff\1\145\2\172\1\154"
+ u"\1\165\2\uffff\1\164\1\172\1\145\1\uffff\1\101\1\uffff\1\116\1"
+ u"\114\1\137\1\116\1\117\2\172\1\137\3\uffff\1\172\6\uffff\1\162"
+ u"\2\uffff\2\145\1\172\1\uffff\1\144\1\114\2\105\1\122\2\124\2\uffff"
+ u"\1\172\1\uffff\3\172\1\uffff\2\172\1\104\1\172\1\105\1\111\1\123"
+ u"\6\uffff\1\172\1\uffff\2\115\1\105\1\uffff\1\117\1\105\1\122\1"
+ u"\126\1\123\1\126\2\105\1\111\1\137\1\122\1\103\1\111\1\126\1\105"
+ u"\1\106\1\111\1\172\1\137\1\103\1\uffff\1\125\1\105\1\116\1\172"
+ u"\1\122\1\uffff\1\105\1\106\1\105\1\122\1\105\1\116\1\103\1\105"
+ u"\1\104\1\172\1\uffff"
+ )
+
+ DFA35_accept = DFA.unpack(
+ u"\1\uffff\1\1\1\uffff\1\3\15\uffff\1\23\1\24\1\27\10\uffff\1\46"
+ u"\1\47\1\50\1\51\7\uffff\1\66\5\uffff\1\102\5\uffff\1\136\4\uffff"
+ u"\1\145\1\146\1\uffff\1\147\1\1\1\uffff\1\136\1\3\1\107\1\4\26\uffff"
+ u"\1\23\1\24\1\27\11\uffff\1\46\1\47\1\50\1\51\1\70\1\52\1\53\1\63"
+ u"\1\144\1\73\1\60\1\54\1\74\1\64\1\61\1\55\1\150\1\151\1\71\1\56"
+ u"\1\72\1\57\1\77\1\104\1\65\1\66\1\110\1\67\1\uffff\1\113\1\111"
+ u"\1\uffff\1\114\1\112\1\100\1\106\1\103\1\101\1\105\1\102\5\uffff"
+ u"\1\140\1\137\1\141\1\uffff\1\142\1\uffff\1\145\1\146\1\152\23\uffff"
+ u"\1\124\6\uffff\1\130\2\uffff\1\33\10\uffff\1\75\1\115\1\76\1\116"
+ u"\5\uffff\1\143\24\uffff\1\15\1\uffff\1\131\6\uffff\1\34\15\uffff"
+ u"\1\125\1\uffff\1\30\6\uffff\1\7\4\uffff\1\12\1\122\2\uffff\1\13"
+ u"\1\16\17\uffff\1\120\1\uffff\1\132\10\uffff\1\14\5\uffff\1\31\1"
+ u"\17\3\uffff\1\26\1\uffff\1\36\10\uffff\1\121\1\127\1\134\1\uffff"
+ u"\1\5\1\126\1\6\1\25\1\62\1\21\1\uffff\1\135\1\11\3\uffff\1\20\7"
+ u"\uffff\1\42\1\45\1\uffff\1\2\3\uffff\1\123\7\uffff\1\117\1\10\1"
+ u"\32\1\133\1\22\1\35\1\uffff\1\40\3\uffff\1\37\24\uffff\1\43\5\uffff"
+ u"\1\44\12\uffff\1\41"
+ )
+
+ DFA35_special = DFA.unpack(
+ u"\u0192\uffff"
+ )
+
+
+ DFA35_transition = [
+ DFA.unpack(u"\6\73\2\70\1\73\2\70\22\73\1\70\1\50\1\65\1\72\1\63"
+ u"\1\45\1\46\1\64\1\34\1\35\1\40\1\42\1\3\1\43\1\41\1\44\1\66\11"
+ u"\67\1\23\1\1\1\51\1\4\1\52\1\55\1\73\2\63\1\26\1\63\1\32\1\63\1"
+ u"\31\1\63\1\24\2\63\1\62\2\63\1\25\1\33\2\63\1\11\1\63\1\27\1\30"
+ u"\4\63\1\36\1\71\1\37\1\53\1\56\1\73\1\7\1\61\1\13\1\17\1\5\1\16"
+ u"\1\60\1\63\1\14\2\63\1\15\5\63\1\10\1\6\1\2\1\20\1\12\1\57\3\63"
+ u"\1\21\1\54\1\22\1\47\uff80\73"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\75"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\100"),
+ DFA.unpack(u"\1\102\1\uffff\1\104\11\uffff\1\103"),
+ DFA.unpack(u"\1\110\1\107\12\uffff\1\106\2\uffff\1\105"),
+ DFA.unpack(u"\1\111"),
+ DFA.unpack(u"\1\112"),
+ DFA.unpack(u"\1\113"),
+ DFA.unpack(u"\1\114"),
+ DFA.unpack(u"\1\115\6\uffff\1\117\6\uffff\1\116"),
+ DFA.unpack(u"\1\120\7\uffff\1\121"),
+ DFA.unpack(u"\1\122"),
+ DFA.unpack(u"\1\124\2\uffff\1\123"),
+ DFA.unpack(u"\1\125\11\uffff\1\126"),
+ DFA.unpack(u"\1\127"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\133"),
+ DFA.unpack(u"\1\134\4\uffff\1\135"),
+ DFA.unpack(u"\1\136"),
+ DFA.unpack(u"\1\137"),
+ DFA.unpack(u"\1\140"),
+ DFA.unpack(u"\1\141"),
+ DFA.unpack(u"\1\142"),
+ DFA.unpack(u"\1\143"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\150"),
+ DFA.unpack(u"\1\152\1\uffff\12\154"),
+ DFA.unpack(u"\1\156\21\uffff\1\155"),
+ DFA.unpack(u"\1\162\17\uffff\1\160\1\161"),
+ DFA.unpack(u"\1\164\4\uffff\1\165\15\uffff\1\166"),
+ DFA.unpack(u"\1\170"),
+ DFA.unpack(u"\1\173\26\uffff\1\172"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\176"),
+ DFA.unpack(u"\1\u0080\1\u0081"),
+ DFA.unpack(u"\1\u0084\1\u0083"),
+ DFA.unpack(u"\1\u0086"),
+ DFA.unpack(u"\1\u0089\76\uffff\1\u0088"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u008c\1\uffff\1\u008d"),
+ DFA.unpack(u"\1\u008e"),
+ DFA.unpack(u"\1\u008f"),
+ DFA.unpack(u"\1\u0090"),
+ DFA.unpack(u"\1\u0091\4\uffff\1\u0092"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\47\u0092\1\uffff\uffd7\u0092"),
+ DFA.unpack(u"\uffff\u0091"),
+ DFA.unpack(u"\1\154\1\uffff\10\u0094\2\154\12\uffff\3\154\21\uffff"
+ u"\1\u0093\13\uffff\3\154\21\uffff\1\u0093"),
+ DFA.unpack(u"\1\154\1\uffff\12\u0096\12\uffff\3\154\35\uffff\3\154"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\uffff\u0099"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u009a"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u009b"),
+ DFA.unpack(u"\1\u009c"),
+ DFA.unpack(u"\1\u009d"),
+ DFA.unpack(u"\1\u009e"),
+ DFA.unpack(u"\1\u009f\20\uffff\1\u00a0"),
+ DFA.unpack(u"\1\u00a2\22\uffff\1\u00a1"),
+ DFA.unpack(u"\1\u00a3"),
+ DFA.unpack(u"\1\u00a4"),
+ DFA.unpack(u"\1\u00a5\14\uffff\1\u00a6"),
+ DFA.unpack(u"\1\u00a7"),
+ DFA.unpack(u"\1\u00a9\2\uffff\1\u00a8"),
+ DFA.unpack(u"\1\u00aa"),
+ DFA.unpack(u"\1\u00ab"),
+ DFA.unpack(u"\1\u00ac"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00ae"),
+ DFA.unpack(u"\1\u00af"),
+ DFA.unpack(u"\1\u00b0"),
+ DFA.unpack(u"\1\u00b1"),
+ DFA.unpack(u"\1\u00b2"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\24\76\1\u00b3\5\76"),
+ DFA.unpack(u"\1\u00b6\11\uffff\1\u00b5"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00b8"),
+ DFA.unpack(u"\1\u00b9"),
+ DFA.unpack(u"\1\u00ba"),
+ DFA.unpack(u"\1\u00bb"),
+ DFA.unpack(u"\1\u00bc"),
+ DFA.unpack(u"\1\u00bd"),
+ DFA.unpack(u"\1\u00be"),
+ DFA.unpack(u"\1\u00bf"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00c0"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00c2"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00c4"),
+ DFA.unpack(u"\1\u00c5"),
+ DFA.unpack(u"\1\u00c6"),
+ DFA.unpack(u"\1\u00c7"),
+ DFA.unpack(u"\1\u00c8"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\154\1\uffff\10\u0094\2\154\12\uffff\3\154\35\uffff"
+ u"\3\154"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\154\1\uffff\12\u0096\12\uffff\3\154\35\uffff\3\154"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00ca"),
+ DFA.unpack(u"\1\u00cb"),
+ DFA.unpack(u"\1\u00cc"),
+ DFA.unpack(u"\1\u00cd"),
+ DFA.unpack(u"\1\u00ce"),
+ DFA.unpack(u"\1\u00cf"),
+ DFA.unpack(u"\1\u00d0"),
+ DFA.unpack(u"\1\u00d1"),
+ DFA.unpack(u"\1\u00d2"),
+ DFA.unpack(u"\1\u00d3"),
+ DFA.unpack(u"\1\u00d4"),
+ DFA.unpack(u"\1\u00d5"),
+ DFA.unpack(u"\1\u00d6"),
+ DFA.unpack(u"\1\u00d7"),
+ DFA.unpack(u"\1\u00d8"),
+ DFA.unpack(u"\1\u00d9"),
+ DFA.unpack(u"\1\u00da"),
+ DFA.unpack(u"\1\u00dc\1\u00db"),
+ DFA.unpack(u"\1\u00dd"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00df"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00e1"),
+ DFA.unpack(u"\1\u00e2"),
+ DFA.unpack(u"\1\u00e3"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00e4"),
+ DFA.unpack(u"\1\u00e5"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00e6"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00e8"),
+ DFA.unpack(u"\1\u00e9"),
+ DFA.unpack(u"\1\u00ea"),
+ DFA.unpack(u"\1\u00eb"),
+ DFA.unpack(u"\1\u00ed\35\uffff\1\u00ec"),
+ DFA.unpack(u"\1\u00ee"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00ef"),
+ DFA.unpack(u"\1\u00f0"),
+ DFA.unpack(u"\1\u00f1"),
+ DFA.unpack(u"\1\u00f2"),
+ DFA.unpack(u"\1\u00f3"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00f4"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00f6"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00f8"),
+ DFA.unpack(u"\1\u00f9"),
+ DFA.unpack(u"\1\u00fa"),
+ DFA.unpack(u"\1\u00fb"),
+ DFA.unpack(u"\1\u00fc"),
+ DFA.unpack(u"\1\u00fd"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00ff"),
+ DFA.unpack(u"\1\u0100"),
+ DFA.unpack(u"\1\u0101"),
+ DFA.unpack(u"\1\u0102"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0105"),
+ DFA.unpack(u"\1\u0106"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0109"),
+ DFA.unpack(u"\1\u010a"),
+ DFA.unpack(u"\1\u010b"),
+ DFA.unpack(u"\1\u010c"),
+ DFA.unpack(u"\1\u010d"),
+ DFA.unpack(u"\1\u010e"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u010f"),
+ DFA.unpack(u"\1\u0110"),
+ DFA.unpack(u"\1\u0111"),
+ DFA.unpack(u"\1\u0112"),
+ DFA.unpack(u"\1\u0114\17\uffff\1\u0113"),
+ DFA.unpack(u"\1\u0115"),
+ DFA.unpack(u"\1\u0116"),
+ DFA.unpack(u"\1\u0117"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0119"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u011b"),
+ DFA.unpack(u"\1\u011c"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u011d"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u011e"),
+ DFA.unpack(u"\1\u011f"),
+ DFA.unpack(u"\1\u0120"),
+ DFA.unpack(u"\1\u0121"),
+ DFA.unpack(u"\1\u0122"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0124"),
+ DFA.unpack(u"\1\u0125"),
+ DFA.unpack(u"\1\u0126"),
+ DFA.unpack(u"\1\u0127"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0128"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u012b"),
+ DFA.unpack(u"\1\u012c"),
+ DFA.unpack(u"\1\u012d"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u012f"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0131"),
+ DFA.unpack(u"\1\u0132"),
+ DFA.unpack(u"\1\u0133"),
+ DFA.unpack(u"\1\u0134"),
+ DFA.unpack(u"\1\u0135"),
+ DFA.unpack(u"\1\u0136"),
+ DFA.unpack(u"\1\u0137"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\u0138\1"
+ u"\uffff\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u013c"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0143"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0146"),
+ DFA.unpack(u"\1\u0147"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0148"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u014a"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u014b"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u014c"),
+ DFA.unpack(u"\1\u014d"),
+ DFA.unpack(u"\1\u014e"),
+ DFA.unpack(u"\1\u014f"),
+ DFA.unpack(u"\1\u0150"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0153"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0155"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0156"),
+ DFA.unpack(u"\1\u0157"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0159"),
+ DFA.unpack(u"\1\u015a"),
+ DFA.unpack(u"\1\u015b"),
+ DFA.unpack(u"\1\u015c"),
+ DFA.unpack(u"\1\u015d"),
+ DFA.unpack(u"\1\u015e"),
+ DFA.unpack(u"\1\u015f"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0166"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0168"),
+ DFA.unpack(u"\1\u0169"),
+ DFA.unpack(u"\1\u016a"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u016c"),
+ DFA.unpack(u"\1\u016d"),
+ DFA.unpack(u"\1\u016e"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u016f"),
+ DFA.unpack(u"\1\u0170"),
+ DFA.unpack(u"\1\u0171"),
+ DFA.unpack(u"\1\u0172"),
+ DFA.unpack(u"\1\u0173"),
+ DFA.unpack(u"\1\u0174"),
+ DFA.unpack(u"\1\u0175"),
+ DFA.unpack(u"\1\u0176"),
+ DFA.unpack(u"\1\u0177"),
+ DFA.unpack(u"\1\u0178"),
+ DFA.unpack(u"\1\u0179"),
+ DFA.unpack(u"\1\u017a"),
+ DFA.unpack(u"\1\u017b"),
+ DFA.unpack(u"\1\u017c"),
+ DFA.unpack(u"\1\u017d"),
+ DFA.unpack(u"\1\u017e"),
+ DFA.unpack(u"\1\u017f"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0181"),
+ DFA.unpack(u"\1\u0182"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0183"),
+ DFA.unpack(u"\1\u0184"),
+ DFA.unpack(u"\1\u0185"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0187"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0188"),
+ DFA.unpack(u"\1\u0189"),
+ DFA.unpack(u"\1\u018a"),
+ DFA.unpack(u"\1\u018b"),
+ DFA.unpack(u"\1\u018c"),
+ DFA.unpack(u"\1\u018d"),
+ DFA.unpack(u"\1\u018e"),
+ DFA.unpack(u"\1\u018f"),
+ DFA.unpack(u"\1\u0190"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"")
+ ]
+
+ # class definition for DFA #35
+
+ DFA35 = DFA
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/CParser3/CParser.py b/roms/edk2/BaseTools/Source/Python/Ecc/CParser3/CParser.py
new file mode 100644
index 000000000..b07839796
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/CParser3/CParser.py
@@ -0,0 +1,18833 @@
+# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53
+
+from __future__ import print_function
+from __future__ import absolute_import
+from antlr3 import *
+from antlr3.compat import set, frozenset
+
+## @file
+# The file defines the parser for C source files.
+#
+# THIS FILE IS AUTO-GENERATED. PLEASE DO NOT MODIFY THIS FILE.
+# This file is generated by running:
+# java org.antlr.Tool C.g
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+from Ecc import CodeFragment
+from Ecc import FileProfile
+
+
+
+# for convenience in actions
+HIDDEN = BaseRecognizer.HIDDEN
+
+# token types
+BS=20
+LINE_COMMENT=23
+FloatTypeSuffix=16
+IntegerTypeSuffix=14
+LETTER=11
+OCTAL_LITERAL=6
+CHARACTER_LITERAL=8
+Exponent=15
+EOF=-1
+HexDigit=13
+STRING_LITERAL=9
+WS=19
+FLOATING_POINT_LITERAL=10
+IDENTIFIER=4
+UnicodeEscape=18
+LINE_COMMAND=24
+UnicodeVocabulary=21
+HEX_LITERAL=5
+COMMENT=22
+DECIMAL_LITERAL=7
+EscapeSequence=12
+OctalEscape=17
+
+# token names
+tokenNames = [
+ "<invalid>", "<EOR>", "<DOWN>", "<UP>",
+ "IDENTIFIER", "HEX_LITERAL", "OCTAL_LITERAL", "DECIMAL_LITERAL", "CHARACTER_LITERAL",
+ "STRING_LITERAL", "FLOATING_POINT_LITERAL", "LETTER", "EscapeSequence",
+ "HexDigit", "IntegerTypeSuffix", "Exponent", "FloatTypeSuffix", "OctalEscape",
+ "UnicodeEscape", "WS", "BS", "UnicodeVocabulary", "COMMENT", "LINE_COMMENT",
+ "LINE_COMMAND", "';'", "'typedef'", "','", "'='", "'extern'", "'static'",
+ "'auto'", "'register'", "'STATIC'", "'void'", "'char'", "'short'", "'int'",
+ "'long'", "'float'", "'double'", "'signed'", "'unsigned'", "'{'", "'}'",
+ "'struct'", "'union'", "':'", "'enum'", "'const'", "'volatile'", "'IN'",
+ "'OUT'", "'OPTIONAL'", "'CONST'", "'UNALIGNED'", "'VOLATILE'", "'GLOBAL_REMOVE_IF_UNREFERENCED'",
+ "'EFIAPI'", "'EFI_BOOTSERVICE'", "'EFI_RUNTIMESERVICE'", "'PACKED'",
+ "'('", "')'", "'['", "']'", "'*'", "'...'", "'+'", "'-'", "'/'", "'%'",
+ "'++'", "'--'", "'sizeof'", "'.'", "'->'", "'&'", "'~'", "'!'", "'*='",
+ "'/='", "'%='", "'+='", "'-='", "'<<='", "'>>='", "'&='", "'^='", "'|='",
+ "'?'", "'||'", "'&&'", "'|'", "'^'", "'=='", "'!='", "'<'", "'>'", "'<='",
+ "'>='", "'<<'", "'>>'", "'__asm__'", "'_asm'", "'__asm'", "'case'",
+ "'default'", "'if'", "'else'", "'switch'", "'while'", "'do'", "'for'",
+ "'goto'", "'continue'", "'break'", "'return'"
+]
+
+
+class function_definition_scope(object):
+ def __init__(self):
+ self.ModifierText = None
+ self.DeclText = None
+ self.LBLine = None
+ self.LBOffset = None
+ self.DeclLine = None
+ self.DeclOffset = None
+class postfix_expression_scope(object):
+ def __init__(self):
+ self.FuncCallText = None
+
+
+class CParser(Parser):
+ grammarFileName = "C.g"
+ tokenNames = tokenNames
+
+ def __init__(self, input):
+ Parser.__init__(self, input)
+ self.ruleMemo = {}
+
+ self.function_definition_stack = []
+ self.postfix_expression_stack = []
+
+ def printTokenInfo(self, line, offset, tokenText):
+ print(str(line)+ ',' + str(offset) + ':' + str(tokenText))
+
+ def StorePredicateExpression(self, StartLine, StartOffset, EndLine, EndOffset, Text):
+ PredExp = CodeFragment.PredicateExpression(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.PredicateExpressionList.append(PredExp)
+
+ def StoreEnumerationDefinition(self, StartLine, StartOffset, EndLine, EndOffset, Text):
+ EnumDef = CodeFragment.EnumerationDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.EnumerationDefinitionList.append(EnumDef)
+
+ def StoreStructUnionDefinition(self, StartLine, StartOffset, EndLine, EndOffset, Text):
+ SUDef = CodeFragment.StructUnionDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.StructUnionDefinitionList.append(SUDef)
+
+ def StoreTypedefDefinition(self, StartLine, StartOffset, EndLine, EndOffset, FromText, ToText):
+ Tdef = CodeFragment.TypedefDefinition(FromText, ToText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.TypedefDefinitionList.append(Tdef)
+
+ def StoreFunctionDefinition(self, StartLine, StartOffset, EndLine, EndOffset, ModifierText, DeclText, LeftBraceLine, LeftBraceOffset, DeclLine, DeclOffset):
+ FuncDef = CodeFragment.FunctionDefinition(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset), (LeftBraceLine, LeftBraceOffset), (DeclLine, DeclOffset))
+ FileProfile.FunctionDefinitionList.append(FuncDef)
+
+ def StoreVariableDeclaration(self, StartLine, StartOffset, EndLine, EndOffset, ModifierText, DeclText):
+ VarDecl = CodeFragment.VariableDeclaration(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.VariableDeclarationList.append(VarDecl)
+
+ def StoreFunctionCalling(self, StartLine, StartOffset, EndLine, EndOffset, FuncName, ParamList):
+ FuncCall = CodeFragment.FunctionCalling(FuncName, ParamList, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.FunctionCallingList.append(FuncCall)
+
+
+
+
+ # $ANTLR start translation_unit
+ # C.g:102:1: translation_unit : ( external_declaration )* ;
+ def translation_unit(self, ):
+
+ translation_unit_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 1):
+ return
+
+ # C.g:103:2: ( ( external_declaration )* )
+ # C.g:103:4: ( external_declaration )*
+ # C.g:103:4: ( external_declaration )*
+ while True: #loop1
+ alt1 = 2
+ LA1_0 = self.input.LA(1)
+
+ if (LA1_0 == IDENTIFIER or LA1_0 == 26 or (29 <= LA1_0 <= 42) or (45 <= LA1_0 <= 46) or (48 <= LA1_0 <= 62) or LA1_0 == 66) :
+ alt1 = 1
+
+
+ if alt1 == 1:
+ # C.g:0:0: external_declaration
+ self.following.append(self.FOLLOW_external_declaration_in_translation_unit74)
+ self.external_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop1
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 1, translation_unit_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end translation_unit
+
+
+ # $ANTLR start external_declaration
+ # C.g:114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );
+ def external_declaration(self, ):
+
+ external_declaration_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 2):
+ return
+
+ # C.g:119:2: ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? )
+ alt3 = 3
+ LA3_0 = self.input.LA(1)
+
+ if ((29 <= LA3_0 <= 33)) :
+ LA3_1 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 1, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 34) :
+ LA3_2 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 2, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 35) :
+ LA3_3 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 3, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 36) :
+ LA3_4 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 4, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 37) :
+ LA3_5 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 5, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 38) :
+ LA3_6 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 6, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 39) :
+ LA3_7 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 7, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 40) :
+ LA3_8 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 8, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 41) :
+ LA3_9 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 9, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 42) :
+ LA3_10 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 10, self.input)
+
+ raise nvae
+
+ elif ((45 <= LA3_0 <= 46)) :
+ LA3_11 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 11, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 48) :
+ LA3_12 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 12, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == IDENTIFIER) :
+ LA3_13 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ elif (True) :
+ alt3 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 13, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 58) :
+ LA3_14 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 14, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 66) and (self.synpred4()):
+ alt3 = 1
+ elif (LA3_0 == 59) :
+ LA3_16 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 16, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 60) :
+ LA3_17 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 17, self.input)
+
+ raise nvae
+
+ elif ((49 <= LA3_0 <= 57) or LA3_0 == 61) :
+ LA3_18 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 18, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 62) and (self.synpred4()):
+ alt3 = 1
+ elif (LA3_0 == 26) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 0, self.input)
+
+ raise nvae
+
+ if alt3 == 1:
+ # C.g:119:4: ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition
+ self.following.append(self.FOLLOW_function_definition_in_external_declaration113)
+ self.function_definition()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt3 == 2:
+ # C.g:120:4: declaration
+ self.following.append(self.FOLLOW_declaration_in_external_declaration118)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt3 == 3:
+ # C.g:121:4: macro_statement ( ';' )?
+ self.following.append(self.FOLLOW_macro_statement_in_external_declaration123)
+ self.macro_statement()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:121:20: ( ';' )?
+ alt2 = 2
+ LA2_0 = self.input.LA(1)
+
+ if (LA2_0 == 25) :
+ alt2 = 1
+ if alt2 == 1:
+ # C.g:121:21: ';'
+ self.match(self.input, 25, self.FOLLOW_25_in_external_declaration126)
+ if self.failed:
+ return
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 2, external_declaration_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end external_declaration
+
+ class function_definition_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start function_definition
+ # C.g:126:1: function_definition : (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) ;
+ def function_definition(self, ):
+ self.function_definition_stack.append(function_definition_scope())
+ retval = self.function_definition_return()
+ retval.start = self.input.LT(1)
+ function_definition_StartIndex = self.input.index()
+ d = None
+
+ a = None
+
+ b = None
+
+ declarator1 = None
+
+
+
+ self.function_definition_stack[-1].ModifierText = ''
+ self.function_definition_stack[-1].DeclText = ''
+ self.function_definition_stack[-1].LBLine = 0
+ self.function_definition_stack[-1].LBOffset = 0
+ self.function_definition_stack[-1].DeclLine = 0
+ self.function_definition_stack[-1].DeclOffset = 0
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 3):
+ return retval
+
+ # C.g:146:2: ( (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) )
+ # C.g:146:4: (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement )
+ # C.g:146:5: (d= declaration_specifiers )?
+ alt4 = 2
+ LA4 = self.input.LA(1)
+ if LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33 or LA4 == 34 or LA4 == 35 or LA4 == 36 or LA4 == 37 or LA4 == 38 or LA4 == 39 or LA4 == 40 or LA4 == 41 or LA4 == 42 or LA4 == 45 or LA4 == 46 or LA4 == 48 or LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61:
+ alt4 = 1
+ elif LA4 == IDENTIFIER:
+ LA4 = self.input.LA(2)
+ if LA4 == 66:
+ alt4 = 1
+ elif LA4 == 58:
+ LA4_21 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 59:
+ LA4_22 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 60:
+ LA4_23 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == IDENTIFIER:
+ LA4_24 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 62:
+ LA4_25 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33:
+ LA4_26 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 34:
+ LA4_27 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 35:
+ LA4_28 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 36:
+ LA4_29 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 37:
+ LA4_30 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 38:
+ LA4_31 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 39:
+ LA4_32 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 40:
+ LA4_33 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 41:
+ LA4_34 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 42:
+ LA4_35 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 45 or LA4 == 46:
+ LA4_36 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 48:
+ LA4_37 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61:
+ LA4_38 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 58:
+ LA4_14 = self.input.LA(2)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 59:
+ LA4_16 = self.input.LA(2)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 60:
+ LA4_17 = self.input.LA(2)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ if alt4 == 1:
+ # C.g:0:0: d= declaration_specifiers
+ self.following.append(self.FOLLOW_declaration_specifiers_in_function_definition157)
+ d = self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+
+ self.following.append(self.FOLLOW_declarator_in_function_definition160)
+ declarator1 = self.declarator()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:147:3: ( ( declaration )+ a= compound_statement | b= compound_statement )
+ alt6 = 2
+ LA6_0 = self.input.LA(1)
+
+ if (LA6_0 == IDENTIFIER or LA6_0 == 26 or (29 <= LA6_0 <= 42) or (45 <= LA6_0 <= 46) or (48 <= LA6_0 <= 61)) :
+ alt6 = 1
+ elif (LA6_0 == 43) :
+ alt6 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("147:3: ( ( declaration )+ a= compound_statement | b= compound_statement )", 6, 0, self.input)
+
+ raise nvae
+
+ if alt6 == 1:
+ # C.g:147:5: ( declaration )+ a= compound_statement
+ # C.g:147:5: ( declaration )+
+ cnt5 = 0
+ while True: #loop5
+ alt5 = 2
+ LA5_0 = self.input.LA(1)
+
+ if (LA5_0 == IDENTIFIER or LA5_0 == 26 or (29 <= LA5_0 <= 42) or (45 <= LA5_0 <= 46) or (48 <= LA5_0 <= 61)) :
+ alt5 = 1
+
+
+ if alt5 == 1:
+ # C.g:0:0: declaration
+ self.following.append(self.FOLLOW_declaration_in_function_definition166)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ else:
+ if cnt5 >= 1:
+ break #loop5
+
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ eee = EarlyExitException(5, self.input)
+ raise eee
+
+ cnt5 += 1
+
+
+ self.following.append(self.FOLLOW_compound_statement_in_function_definition171)
+ a = self.compound_statement()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ elif alt6 == 2:
+ # C.g:148:5: b= compound_statement
+ self.following.append(self.FOLLOW_compound_statement_in_function_definition180)
+ b = self.compound_statement()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+
+ if self.backtracking == 0:
+
+ if d is not None:
+ self.function_definition_stack[-1].ModifierText = self.input.toString(d.start, d.stop)
+ else:
+ self.function_definition_stack[-1].ModifierText = ''
+ self.function_definition_stack[-1].DeclText = self.input.toString(declarator1.start, declarator1.stop)
+ self.function_definition_stack[-1].DeclLine = declarator1.start.line
+ self.function_definition_stack[-1].DeclOffset = declarator1.start.charPositionInLine
+ if a is not None:
+ self.function_definition_stack[-1].LBLine = a.start.line
+ self.function_definition_stack[-1].LBOffset = a.start.charPositionInLine
+ else:
+ self.function_definition_stack[-1].LBLine = b.start.line
+ self.function_definition_stack[-1].LBOffset = b.start.charPositionInLine
+
+
+
+
+
+ retval.stop = self.input.LT(-1)
+
+ if self.backtracking == 0:
+
+ self.StoreFunctionDefinition(retval.start.line, retval.start.charPositionInLine, retval.stop.line, retval.stop.charPositionInLine, self.function_definition_stack[-1].ModifierText, self.function_definition_stack[-1].DeclText, self.function_definition_stack[-1].LBLine, self.function_definition_stack[-1].LBOffset, self.function_definition_stack[-1].DeclLine, self.function_definition_stack[-1].DeclOffset)
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 3, function_definition_StartIndex)
+
+ self.function_definition_stack.pop()
+ pass
+
+ return retval
+
+ # $ANTLR end function_definition
+
+
+ # $ANTLR start declaration
+ # C.g:166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' );
+ def declaration(self, ):
+
+ declaration_StartIndex = self.input.index()
+ a = None
+ d = None
+ e = None
+ b = None
+
+ c = None
+
+ s = None
+
+ t = None
+
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 4):
+ return
+
+ # C.g:167:2: (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' )
+ alt9 = 2
+ LA9_0 = self.input.LA(1)
+
+ if (LA9_0 == 26) :
+ alt9 = 1
+ elif (LA9_0 == IDENTIFIER or (29 <= LA9_0 <= 42) or (45 <= LA9_0 <= 46) or (48 <= LA9_0 <= 61)) :
+ alt9 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' );", 9, 0, self.input)
+
+ raise nvae
+
+ if alt9 == 1:
+ # C.g:167:4: a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';'
+ a = self.input.LT(1)
+ self.match(self.input, 26, self.FOLLOW_26_in_declaration203)
+ if self.failed:
+ return
+ # C.g:167:17: (b= declaration_specifiers )?
+ alt7 = 2
+ LA7 = self.input.LA(1)
+ if LA7 == 29 or LA7 == 30 or LA7 == 31 or LA7 == 32 or LA7 == 33 or LA7 == 34 or LA7 == 35 or LA7 == 36 or LA7 == 37 or LA7 == 38 or LA7 == 39 or LA7 == 40 or LA7 == 41 or LA7 == 42 or LA7 == 45 or LA7 == 46 or LA7 == 48 or LA7 == 49 or LA7 == 50 or LA7 == 51 or LA7 == 52 or LA7 == 53 or LA7 == 54 or LA7 == 55 or LA7 == 56 or LA7 == 57 or LA7 == 61:
+ alt7 = 1
+ elif LA7 == IDENTIFIER:
+ LA7_13 = self.input.LA(2)
+
+ if (LA7_13 == 62) :
+ LA7_21 = self.input.LA(3)
+
+ if (self.synpred10()) :
+ alt7 = 1
+ elif (LA7_13 == IDENTIFIER or (29 <= LA7_13 <= 42) or (45 <= LA7_13 <= 46) or (48 <= LA7_13 <= 61) or LA7_13 == 66) :
+ alt7 = 1
+ elif LA7 == 58:
+ LA7_14 = self.input.LA(2)
+
+ if (self.synpred10()) :
+ alt7 = 1
+ elif LA7 == 59:
+ LA7_16 = self.input.LA(2)
+
+ if (self.synpred10()) :
+ alt7 = 1
+ elif LA7 == 60:
+ LA7_17 = self.input.LA(2)
+
+ if (self.synpred10()) :
+ alt7 = 1
+ if alt7 == 1:
+ # C.g:0:0: b= declaration_specifiers
+ self.following.append(self.FOLLOW_declaration_specifiers_in_declaration207)
+ b = self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ self.following.append(self.FOLLOW_init_declarator_list_in_declaration216)
+ c = self.init_declarator_list()
+ self.following.pop()
+ if self.failed:
+ return
+ d = self.input.LT(1)
+ self.match(self.input, 25, self.FOLLOW_25_in_declaration220)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+
+ if b is not None:
+ self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, self.input.toString(b.start, b.stop), self.input.toString(c.start, c.stop))
+ else:
+ self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, '', self.input.toString(c.start, c.stop))
+
+
+
+
+ elif alt9 == 2:
+ # C.g:175:4: s= declaration_specifiers (t= init_declarator_list )? e= ';'
+ self.following.append(self.FOLLOW_declaration_specifiers_in_declaration234)
+ s = self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:175:30: (t= init_declarator_list )?
+ alt8 = 2
+ LA8_0 = self.input.LA(1)
+
+ if (LA8_0 == IDENTIFIER or (58 <= LA8_0 <= 60) or LA8_0 == 62 or LA8_0 == 66) :
+ alt8 = 1
+ if alt8 == 1:
+ # C.g:0:0: t= init_declarator_list
+ self.following.append(self.FOLLOW_init_declarator_list_in_declaration238)
+ t = self.init_declarator_list()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ e = self.input.LT(1)
+ self.match(self.input, 25, self.FOLLOW_25_in_declaration243)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+
+ if t is not None:
+ self.StoreVariableDeclaration(s.start.line, s.start.charPositionInLine, t.start.line, t.start.charPositionInLine, self.input.toString(s.start, s.stop), self.input.toString(t.start, t.stop))
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 4, declaration_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end declaration
+
+ class declaration_specifiers_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start declaration_specifiers
+ # C.g:182:1: declaration_specifiers : ( storage_class_specifier | type_specifier | type_qualifier )+ ;
+ def declaration_specifiers(self, ):
+
+ retval = self.declaration_specifiers_return()
+ retval.start = self.input.LT(1)
+ declaration_specifiers_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 5):
+ return retval
+
+ # C.g:183:2: ( ( storage_class_specifier | type_specifier | type_qualifier )+ )
+ # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+
+ # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+
+ cnt10 = 0
+ while True: #loop10
+ alt10 = 4
+ LA10 = self.input.LA(1)
+ if LA10 == 58:
+ LA10_2 = self.input.LA(2)
+
+ if (self.synpred15()) :
+ alt10 = 3
+
+
+ elif LA10 == 59:
+ LA10_3 = self.input.LA(2)
+
+ if (self.synpred15()) :
+ alt10 = 3
+
+
+ elif LA10 == 60:
+ LA10_4 = self.input.LA(2)
+
+ if (self.synpred15()) :
+ alt10 = 3
+
+
+ elif LA10 == IDENTIFIER:
+ LA10_5 = self.input.LA(2)
+
+ if (self.synpred14()) :
+ alt10 = 2
+
+
+ elif LA10 == 53:
+ LA10_9 = self.input.LA(2)
+
+ if (self.synpred15()) :
+ alt10 = 3
+
+
+ elif LA10 == 29 or LA10 == 30 or LA10 == 31 or LA10 == 32 or LA10 == 33:
+ alt10 = 1
+ elif LA10 == 34 or LA10 == 35 or LA10 == 36 or LA10 == 37 or LA10 == 38 or LA10 == 39 or LA10 == 40 or LA10 == 41 or LA10 == 42 or LA10 == 45 or LA10 == 46 or LA10 == 48:
+ alt10 = 2
+ elif LA10 == 49 or LA10 == 50 or LA10 == 51 or LA10 == 52 or LA10 == 54 or LA10 == 55 or LA10 == 56 or LA10 == 57 or LA10 == 61:
+ alt10 = 3
+
+ if alt10 == 1:
+ # C.g:183:10: storage_class_specifier
+ self.following.append(self.FOLLOW_storage_class_specifier_in_declaration_specifiers264)
+ self.storage_class_specifier()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ elif alt10 == 2:
+ # C.g:184:7: type_specifier
+ self.following.append(self.FOLLOW_type_specifier_in_declaration_specifiers272)
+ self.type_specifier()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ elif alt10 == 3:
+ # C.g:185:13: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_declaration_specifiers286)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ else:
+ if cnt10 >= 1:
+ break #loop10
+
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ eee = EarlyExitException(10, self.input)
+ raise eee
+
+ cnt10 += 1
+
+
+
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 5, declaration_specifiers_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end declaration_specifiers
+
+ class init_declarator_list_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start init_declarator_list
+ # C.g:189:1: init_declarator_list : init_declarator ( ',' init_declarator )* ;
+ def init_declarator_list(self, ):
+
+ retval = self.init_declarator_list_return()
+ retval.start = self.input.LT(1)
+ init_declarator_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 6):
+ return retval
+
+ # C.g:190:2: ( init_declarator ( ',' init_declarator )* )
+ # C.g:190:4: init_declarator ( ',' init_declarator )*
+ self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list308)
+ self.init_declarator()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:190:20: ( ',' init_declarator )*
+ while True: #loop11
+ alt11 = 2
+ LA11_0 = self.input.LA(1)
+
+ if (LA11_0 == 27) :
+ alt11 = 1
+
+
+ if alt11 == 1:
+ # C.g:190:21: ',' init_declarator
+ self.match(self.input, 27, self.FOLLOW_27_in_init_declarator_list311)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list313)
+ self.init_declarator()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ else:
+ break #loop11
+
+
+
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 6, init_declarator_list_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end init_declarator_list
+
+
+ # $ANTLR start init_declarator
+ # C.g:193:1: init_declarator : declarator ( '=' initializer )? ;
+ def init_declarator(self, ):
+
+ init_declarator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 7):
+ return
+
+ # C.g:194:2: ( declarator ( '=' initializer )? )
+ # C.g:194:4: declarator ( '=' initializer )?
+ self.following.append(self.FOLLOW_declarator_in_init_declarator326)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:194:15: ( '=' initializer )?
+ alt12 = 2
+ LA12_0 = self.input.LA(1)
+
+ if (LA12_0 == 28) :
+ alt12 = 1
+ if alt12 == 1:
+ # C.g:194:16: '=' initializer
+ self.match(self.input, 28, self.FOLLOW_28_in_init_declarator329)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_initializer_in_init_declarator331)
+ self.initializer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 7, init_declarator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end init_declarator
+
+
+ # $ANTLR start storage_class_specifier
+ # C.g:197:1: storage_class_specifier : ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' );
+ def storage_class_specifier(self, ):
+
+ storage_class_specifier_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 8):
+ return
+
+ # C.g:198:2: ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' )
+ # C.g:
+ if (29 <= self.input.LA(1) <= 33):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_storage_class_specifier0
+ )
+ raise mse
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 8, storage_class_specifier_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end storage_class_specifier
+
+
+ # $ANTLR start type_specifier
+ # C.g:205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id );
+ def type_specifier(self, ):
+
+ type_specifier_StartIndex = self.input.index()
+ s = None
+
+ e = None
+
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 9):
+ return
+
+ # C.g:206:2: ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id )
+ alt13 = 12
+ LA13_0 = self.input.LA(1)
+
+ if (LA13_0 == 34) :
+ alt13 = 1
+ elif (LA13_0 == 35) :
+ alt13 = 2
+ elif (LA13_0 == 36) :
+ alt13 = 3
+ elif (LA13_0 == 37) :
+ alt13 = 4
+ elif (LA13_0 == 38) :
+ alt13 = 5
+ elif (LA13_0 == 39) :
+ alt13 = 6
+ elif (LA13_0 == 40) :
+ alt13 = 7
+ elif (LA13_0 == 41) :
+ alt13 = 8
+ elif (LA13_0 == 42) :
+ alt13 = 9
+ elif ((45 <= LA13_0 <= 46)) :
+ alt13 = 10
+ elif (LA13_0 == 48) :
+ alt13 = 11
+ elif (LA13_0 == IDENTIFIER) and (self.synpred34()):
+ alt13 = 12
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id );", 13, 0, self.input)
+
+ raise nvae
+
+ if alt13 == 1:
+ # C.g:206:4: 'void'
+ self.match(self.input, 34, self.FOLLOW_34_in_type_specifier376)
+ if self.failed:
+ return
+
+
+ elif alt13 == 2:
+ # C.g:207:4: 'char'
+ self.match(self.input, 35, self.FOLLOW_35_in_type_specifier381)
+ if self.failed:
+ return
+
+
+ elif alt13 == 3:
+ # C.g:208:4: 'short'
+ self.match(self.input, 36, self.FOLLOW_36_in_type_specifier386)
+ if self.failed:
+ return
+
+
+ elif alt13 == 4:
+ # C.g:209:4: 'int'
+ self.match(self.input, 37, self.FOLLOW_37_in_type_specifier391)
+ if self.failed:
+ return
+
+
+ elif alt13 == 5:
+ # C.g:210:4: 'long'
+ self.match(self.input, 38, self.FOLLOW_38_in_type_specifier396)
+ if self.failed:
+ return
+
+
+ elif alt13 == 6:
+ # C.g:211:4: 'float'
+ self.match(self.input, 39, self.FOLLOW_39_in_type_specifier401)
+ if self.failed:
+ return
+
+
+ elif alt13 == 7:
+ # C.g:212:4: 'double'
+ self.match(self.input, 40, self.FOLLOW_40_in_type_specifier406)
+ if self.failed:
+ return
+
+
+ elif alt13 == 8:
+ # C.g:213:4: 'signed'
+ self.match(self.input, 41, self.FOLLOW_41_in_type_specifier411)
+ if self.failed:
+ return
+
+
+ elif alt13 == 9:
+ # C.g:214:4: 'unsigned'
+ self.match(self.input, 42, self.FOLLOW_42_in_type_specifier416)
+ if self.failed:
+ return
+
+
+ elif alt13 == 10:
+ # C.g:215:4: s= struct_or_union_specifier
+ self.following.append(self.FOLLOW_struct_or_union_specifier_in_type_specifier423)
+ s = self.struct_or_union_specifier()
+ self.following.pop()
+ if self.failed:
+ return
+ if self.backtracking == 0:
+
+ if s.stop is not None:
+ self.StoreStructUnionDefinition(s.start.line, s.start.charPositionInLine, s.stop.line, s.stop.charPositionInLine, self.input.toString(s.start, s.stop))
+
+
+
+
+ elif alt13 == 11:
+ # C.g:220:4: e= enum_specifier
+ self.following.append(self.FOLLOW_enum_specifier_in_type_specifier433)
+ e = self.enum_specifier()
+ self.following.pop()
+ if self.failed:
+ return
+ if self.backtracking == 0:
+
+ if e.stop is not None:
+ self.StoreEnumerationDefinition(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start, e.stop))
+
+
+
+
+ elif alt13 == 12:
+ # C.g:225:4: ( IDENTIFIER ( type_qualifier )* declarator )=> type_id
+ self.following.append(self.FOLLOW_type_id_in_type_specifier451)
+ self.type_id()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 9, type_specifier_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end type_specifier
+
+
+ # $ANTLR start type_id
+ # C.g:228:1: type_id : IDENTIFIER ;
+ def type_id(self, ):
+
+ type_id_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 10):
+ return
+
+ # C.g:229:5: ( IDENTIFIER )
+ # C.g:229:9: IDENTIFIER
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_type_id467)
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 10, type_id_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end type_id
+
+ class struct_or_union_specifier_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start struct_or_union_specifier
+ # C.g:233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );
+ def struct_or_union_specifier(self, ):
+
+ retval = self.struct_or_union_specifier_return()
+ retval.start = self.input.LT(1)
+ struct_or_union_specifier_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 11):
+ return retval
+
+ # C.g:235:2: ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER )
+ alt15 = 2
+ LA15_0 = self.input.LA(1)
+
+ if ((45 <= LA15_0 <= 46)) :
+ LA15_1 = self.input.LA(2)
+
+ if (LA15_1 == IDENTIFIER) :
+ LA15_2 = self.input.LA(3)
+
+ if (LA15_2 == 43) :
+ alt15 = 1
+ elif (LA15_2 == EOF or LA15_2 == IDENTIFIER or LA15_2 == 25 or LA15_2 == 27 or (29 <= LA15_2 <= 42) or (45 <= LA15_2 <= 64) or LA15_2 == 66) :
+ alt15 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 2, self.input)
+
+ raise nvae
+
+ elif (LA15_1 == 43) :
+ alt15 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 1, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 0, self.input)
+
+ raise nvae
+
+ if alt15 == 1:
+ # C.g:235:4: struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}'
+ self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier494)
+ self.struct_or_union()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:235:20: ( IDENTIFIER )?
+ alt14 = 2
+ LA14_0 = self.input.LA(1)
+
+ if (LA14_0 == IDENTIFIER) :
+ alt14 = 1
+ if alt14 == 1:
+ # C.g:0:0: IDENTIFIER
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier496)
+ if self.failed:
+ return retval
+
+
+
+ self.match(self.input, 43, self.FOLLOW_43_in_struct_or_union_specifier499)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_struct_declaration_list_in_struct_or_union_specifier501)
+ self.struct_declaration_list()
+ self.following.pop()
+ if self.failed:
+ return retval
+ self.match(self.input, 44, self.FOLLOW_44_in_struct_or_union_specifier503)
+ if self.failed:
+ return retval
+
+
+ elif alt15 == 2:
+ # C.g:236:4: struct_or_union IDENTIFIER
+ self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier508)
+ self.struct_or_union()
+ self.following.pop()
+ if self.failed:
+ return retval
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier510)
+ if self.failed:
+ return retval
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 11, struct_or_union_specifier_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end struct_or_union_specifier
+
+
+ # $ANTLR start struct_or_union
+ # C.g:239:1: struct_or_union : ( 'struct' | 'union' );
+ def struct_or_union(self, ):
+
+ struct_or_union_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 12):
+ return
+
+ # C.g:240:2: ( 'struct' | 'union' )
+ # C.g:
+ if (45 <= self.input.LA(1) <= 46):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_struct_or_union0
+ )
+ raise mse
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 12, struct_or_union_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end struct_or_union
+
+
+ # $ANTLR start struct_declaration_list
+ # C.g:244:1: struct_declaration_list : ( struct_declaration )+ ;
+ def struct_declaration_list(self, ):
+
+ struct_declaration_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 13):
+ return
+
+ # C.g:245:2: ( ( struct_declaration )+ )
+ # C.g:245:4: ( struct_declaration )+
+ # C.g:245:4: ( struct_declaration )+
+ cnt16 = 0
+ while True: #loop16
+ alt16 = 2
+ LA16_0 = self.input.LA(1)
+
+ if (LA16_0 == IDENTIFIER or (34 <= LA16_0 <= 42) or (45 <= LA16_0 <= 46) or (48 <= LA16_0 <= 61)) :
+ alt16 = 1
+
+
+ if alt16 == 1:
+ # C.g:0:0: struct_declaration
+ self.following.append(self.FOLLOW_struct_declaration_in_struct_declaration_list537)
+ self.struct_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ if cnt16 >= 1:
+ break #loop16
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(16, self.input)
+ raise eee
+
+ cnt16 += 1
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 13, struct_declaration_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end struct_declaration_list
+
+
+ # $ANTLR start struct_declaration
+ # C.g:248:1: struct_declaration : specifier_qualifier_list struct_declarator_list ';' ;
+ def struct_declaration(self, ):
+
+ struct_declaration_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 14):
+ return
+
+ # C.g:249:2: ( specifier_qualifier_list struct_declarator_list ';' )
+ # C.g:249:4: specifier_qualifier_list struct_declarator_list ';'
+ self.following.append(self.FOLLOW_specifier_qualifier_list_in_struct_declaration549)
+ self.specifier_qualifier_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_struct_declarator_list_in_struct_declaration551)
+ self.struct_declarator_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_struct_declaration553)
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 14, struct_declaration_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end struct_declaration
+
+
+ # $ANTLR start specifier_qualifier_list
+ # C.g:252:1: specifier_qualifier_list : ( type_qualifier | type_specifier )+ ;
+ def specifier_qualifier_list(self, ):
+
+ specifier_qualifier_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 15):
+ return
+
+ # C.g:253:2: ( ( type_qualifier | type_specifier )+ )
+ # C.g:253:4: ( type_qualifier | type_specifier )+
+ # C.g:253:4: ( type_qualifier | type_specifier )+
+ cnt17 = 0
+ while True: #loop17
+ alt17 = 3
+ LA17 = self.input.LA(1)
+ if LA17 == 58:
+ LA17_2 = self.input.LA(2)
+
+ if (self.synpred39()) :
+ alt17 = 1
+
+
+ elif LA17 == 59:
+ LA17_3 = self.input.LA(2)
+
+ if (self.synpred39()) :
+ alt17 = 1
+
+
+ elif LA17 == 60:
+ LA17_4 = self.input.LA(2)
+
+ if (self.synpred39()) :
+ alt17 = 1
+
+
+ elif LA17 == IDENTIFIER:
+ LA17 = self.input.LA(2)
+ if LA17 == EOF or LA17 == IDENTIFIER or LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48 or LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 58 or LA17 == 59 or LA17 == 60 or LA17 == 61 or LA17 == 63 or LA17 == 66:
+ alt17 = 2
+ elif LA17 == 62:
+ LA17_94 = self.input.LA(3)
+
+ if (self.synpred40()) :
+ alt17 = 2
+
+
+ elif LA17 == 47:
+ LA17_95 = self.input.LA(3)
+
+ if (self.synpred40()) :
+ alt17 = 2
+
+
+ elif LA17 == 64:
+ LA17_96 = self.input.LA(3)
+
+ if (self.synpred40()) :
+ alt17 = 2
+
+
+
+ elif LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 61:
+ alt17 = 1
+ elif LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48:
+ alt17 = 2
+
+ if alt17 == 1:
+ # C.g:253:6: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_specifier_qualifier_list566)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt17 == 2:
+ # C.g:253:23: type_specifier
+ self.following.append(self.FOLLOW_type_specifier_in_specifier_qualifier_list570)
+ self.type_specifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ if cnt17 >= 1:
+ break #loop17
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(17, self.input)
+ raise eee
+
+ cnt17 += 1
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 15, specifier_qualifier_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end specifier_qualifier_list
+
+
+ # $ANTLR start struct_declarator_list
+ # C.g:256:1: struct_declarator_list : struct_declarator ( ',' struct_declarator )* ;
+ def struct_declarator_list(self, ):
+
+ struct_declarator_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 16):
+ return
+
+ # C.g:257:2: ( struct_declarator ( ',' struct_declarator )* )
+ # C.g:257:4: struct_declarator ( ',' struct_declarator )*
+ self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list584)
+ self.struct_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:257:22: ( ',' struct_declarator )*
+ while True: #loop18
+ alt18 = 2
+ LA18_0 = self.input.LA(1)
+
+ if (LA18_0 == 27) :
+ alt18 = 1
+
+
+ if alt18 == 1:
+ # C.g:257:23: ',' struct_declarator
+ self.match(self.input, 27, self.FOLLOW_27_in_struct_declarator_list587)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list589)
+ self.struct_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop18
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 16, struct_declarator_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end struct_declarator_list
+
+
+ # $ANTLR start struct_declarator
+ # C.g:260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression );
+ def struct_declarator(self, ):
+
+ struct_declarator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 17):
+ return
+
+ # C.g:261:2: ( declarator ( ':' constant_expression )? | ':' constant_expression )
+ alt20 = 2
+ LA20_0 = self.input.LA(1)
+
+ if (LA20_0 == IDENTIFIER or (58 <= LA20_0 <= 60) or LA20_0 == 62 or LA20_0 == 66) :
+ alt20 = 1
+ elif (LA20_0 == 47) :
+ alt20 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression );", 20, 0, self.input)
+
+ raise nvae
+
+ if alt20 == 1:
+ # C.g:261:4: declarator ( ':' constant_expression )?
+ self.following.append(self.FOLLOW_declarator_in_struct_declarator602)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:261:15: ( ':' constant_expression )?
+ alt19 = 2
+ LA19_0 = self.input.LA(1)
+
+ if (LA19_0 == 47) :
+ alt19 = 1
+ if alt19 == 1:
+ # C.g:261:16: ':' constant_expression
+ self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator605)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_constant_expression_in_struct_declarator607)
+ self.constant_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ elif alt20 == 2:
+ # C.g:262:4: ':' constant_expression
+ self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator614)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_constant_expression_in_struct_declarator616)
+ self.constant_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 17, struct_declarator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end struct_declarator
+
+ class enum_specifier_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start enum_specifier
+ # C.g:265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );
+ def enum_specifier(self, ):
+
+ retval = self.enum_specifier_return()
+ retval.start = self.input.LT(1)
+ enum_specifier_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 18):
+ return retval
+
+ # C.g:267:2: ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER )
+ alt23 = 3
+ LA23_0 = self.input.LA(1)
+
+ if (LA23_0 == 48) :
+ LA23_1 = self.input.LA(2)
+
+ if (LA23_1 == IDENTIFIER) :
+ LA23_2 = self.input.LA(3)
+
+ if (LA23_2 == 43) :
+ alt23 = 2
+ elif (LA23_2 == EOF or LA23_2 == IDENTIFIER or LA23_2 == 25 or LA23_2 == 27 or (29 <= LA23_2 <= 42) or (45 <= LA23_2 <= 64) or LA23_2 == 66) :
+ alt23 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 2, self.input)
+
+ raise nvae
+
+ elif (LA23_1 == 43) :
+ alt23 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 1, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 0, self.input)
+
+ raise nvae
+
+ if alt23 == 1:
+ # C.g:267:4: 'enum' '{' enumerator_list ( ',' )? '}'
+ self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier634)
+ if self.failed:
+ return retval
+ self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier636)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier638)
+ self.enumerator_list()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:267:31: ( ',' )?
+ alt21 = 2
+ LA21_0 = self.input.LA(1)
+
+ if (LA21_0 == 27) :
+ alt21 = 1
+ if alt21 == 1:
+ # C.g:0:0: ','
+ self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier640)
+ if self.failed:
+ return retval
+
+
+
+ self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier643)
+ if self.failed:
+ return retval
+
+
+ elif alt23 == 2:
+ # C.g:268:4: 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}'
+ self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier648)
+ if self.failed:
+ return retval
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier650)
+ if self.failed:
+ return retval
+ self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier652)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier654)
+ self.enumerator_list()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:268:42: ( ',' )?
+ alt22 = 2
+ LA22_0 = self.input.LA(1)
+
+ if (LA22_0 == 27) :
+ alt22 = 1
+ if alt22 == 1:
+ # C.g:0:0: ','
+ self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier656)
+ if self.failed:
+ return retval
+
+
+
+ self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier659)
+ if self.failed:
+ return retval
+
+
+ elif alt23 == 3:
+ # C.g:269:4: 'enum' IDENTIFIER
+ self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier664)
+ if self.failed:
+ return retval
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier666)
+ if self.failed:
+ return retval
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 18, enum_specifier_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end enum_specifier
+
+
+ # $ANTLR start enumerator_list
+ # C.g:272:1: enumerator_list : enumerator ( ',' enumerator )* ;
+ def enumerator_list(self, ):
+
+ enumerator_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 19):
+ return
+
+ # C.g:273:2: ( enumerator ( ',' enumerator )* )
+ # C.g:273:4: enumerator ( ',' enumerator )*
+ self.following.append(self.FOLLOW_enumerator_in_enumerator_list677)
+ self.enumerator()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:273:15: ( ',' enumerator )*
+ while True: #loop24
+ alt24 = 2
+ LA24_0 = self.input.LA(1)
+
+ if (LA24_0 == 27) :
+ LA24_1 = self.input.LA(2)
+
+ if (LA24_1 == IDENTIFIER) :
+ alt24 = 1
+
+
+
+
+ if alt24 == 1:
+ # C.g:273:16: ',' enumerator
+ self.match(self.input, 27, self.FOLLOW_27_in_enumerator_list680)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_enumerator_in_enumerator_list682)
+ self.enumerator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop24
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 19, enumerator_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end enumerator_list
+
+
+ # $ANTLR start enumerator
+ # C.g:276:1: enumerator : IDENTIFIER ( '=' constant_expression )? ;
+ def enumerator(self, ):
+
+ enumerator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 20):
+ return
+
+ # C.g:277:2: ( IDENTIFIER ( '=' constant_expression )? )
+ # C.g:277:4: IDENTIFIER ( '=' constant_expression )?
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enumerator695)
+ if self.failed:
+ return
+ # C.g:277:15: ( '=' constant_expression )?
+ alt25 = 2
+ LA25_0 = self.input.LA(1)
+
+ if (LA25_0 == 28) :
+ alt25 = 1
+ if alt25 == 1:
+ # C.g:277:16: '=' constant_expression
+ self.match(self.input, 28, self.FOLLOW_28_in_enumerator698)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_constant_expression_in_enumerator700)
+ self.constant_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 20, enumerator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end enumerator
+
+
+ # $ANTLR start type_qualifier
+ # C.g:280:1: type_qualifier : ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' );
+ def type_qualifier(self, ):
+
+ type_qualifier_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 21):
+ return
+
+ # C.g:281:2: ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' )
+ # C.g:
+ if (49 <= self.input.LA(1) <= 61):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_type_qualifier0
+ )
+ raise mse
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 21, type_qualifier_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end type_qualifier
+
+ class declarator_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start declarator
+ # C.g:296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );
+ def declarator(self, ):
+
+ retval = self.declarator_return()
+ retval.start = self.input.LT(1)
+ declarator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 22):
+ return retval
+
+ # C.g:297:2: ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer )
+ alt30 = 2
+ LA30_0 = self.input.LA(1)
+
+ if (LA30_0 == 66) :
+ LA30_1 = self.input.LA(2)
+
+ if (self.synpred66()) :
+ alt30 = 1
+ elif (True) :
+ alt30 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 1, self.input)
+
+ raise nvae
+
+ elif (LA30_0 == IDENTIFIER or (58 <= LA30_0 <= 60) or LA30_0 == 62) :
+ alt30 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 0, self.input)
+
+ raise nvae
+
+ if alt30 == 1:
+ # C.g:297:4: ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator
+ # C.g:297:4: ( pointer )?
+ alt26 = 2
+ LA26_0 = self.input.LA(1)
+
+ if (LA26_0 == 66) :
+ alt26 = 1
+ if alt26 == 1:
+ # C.g:0:0: pointer
+ self.following.append(self.FOLLOW_pointer_in_declarator784)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+
+ # C.g:297:13: ( 'EFIAPI' )?
+ alt27 = 2
+ LA27_0 = self.input.LA(1)
+
+ if (LA27_0 == 58) :
+ alt27 = 1
+ if alt27 == 1:
+ # C.g:297:14: 'EFIAPI'
+ self.match(self.input, 58, self.FOLLOW_58_in_declarator788)
+ if self.failed:
+ return retval
+
+
+
+ # C.g:297:25: ( 'EFI_BOOTSERVICE' )?
+ alt28 = 2
+ LA28_0 = self.input.LA(1)
+
+ if (LA28_0 == 59) :
+ alt28 = 1
+ if alt28 == 1:
+ # C.g:297:26: 'EFI_BOOTSERVICE'
+ self.match(self.input, 59, self.FOLLOW_59_in_declarator793)
+ if self.failed:
+ return retval
+
+
+
+ # C.g:297:46: ( 'EFI_RUNTIMESERVICE' )?
+ alt29 = 2
+ LA29_0 = self.input.LA(1)
+
+ if (LA29_0 == 60) :
+ alt29 = 1
+ if alt29 == 1:
+ # C.g:297:47: 'EFI_RUNTIMESERVICE'
+ self.match(self.input, 60, self.FOLLOW_60_in_declarator798)
+ if self.failed:
+ return retval
+
+
+
+ self.following.append(self.FOLLOW_direct_declarator_in_declarator802)
+ self.direct_declarator()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ elif alt30 == 2:
+ # C.g:299:4: pointer
+ self.following.append(self.FOLLOW_pointer_in_declarator808)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 22, declarator_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end declarator
+
+
+ # $ANTLR start direct_declarator
+ # C.g:302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ );
+ def direct_declarator(self, ):
+
+ direct_declarator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 23):
+ return
+
+ # C.g:303:2: ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ )
+ alt34 = 2
+ LA34_0 = self.input.LA(1)
+
+ if (LA34_0 == IDENTIFIER) :
+ alt34 = 1
+ elif (LA34_0 == 62) :
+ alt34 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ );", 34, 0, self.input)
+
+ raise nvae
+
+ if alt34 == 1:
+ # C.g:303:4: IDENTIFIER ( declarator_suffix )*
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_direct_declarator819)
+ if self.failed:
+ return
+ # C.g:303:15: ( declarator_suffix )*
+ while True: #loop31
+ alt31 = 2
+ LA31_0 = self.input.LA(1)
+
+ if (LA31_0 == 62) :
+ LA31 = self.input.LA(2)
+ if LA31 == 63:
+ LA31_30 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 58:
+ LA31_31 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 66:
+ LA31_32 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 59:
+ LA31_33 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 60:
+ LA31_34 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == IDENTIFIER:
+ LA31_35 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 29 or LA31 == 30 or LA31 == 31 or LA31 == 32 or LA31 == 33:
+ LA31_37 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 34:
+ LA31_38 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 35:
+ LA31_39 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 36:
+ LA31_40 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 37:
+ LA31_41 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 38:
+ LA31_42 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 39:
+ LA31_43 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 40:
+ LA31_44 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 41:
+ LA31_45 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 42:
+ LA31_46 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 45 or LA31 == 46:
+ LA31_47 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 48:
+ LA31_48 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 49 or LA31 == 50 or LA31 == 51 or LA31 == 52 or LA31 == 53 or LA31 == 54 or LA31 == 55 or LA31 == 56 or LA31 == 57 or LA31 == 61:
+ LA31_49 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+
+ elif (LA31_0 == 64) :
+ LA31 = self.input.LA(2)
+ if LA31 == 65:
+ LA31_51 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 62:
+ LA31_52 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == IDENTIFIER:
+ LA31_53 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == HEX_LITERAL:
+ LA31_54 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == OCTAL_LITERAL:
+ LA31_55 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == DECIMAL_LITERAL:
+ LA31_56 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == CHARACTER_LITERAL:
+ LA31_57 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == STRING_LITERAL:
+ LA31_58 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == FLOATING_POINT_LITERAL:
+ LA31_59 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 72:
+ LA31_60 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 73:
+ LA31_61 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 66 or LA31 == 68 or LA31 == 69 or LA31 == 77 or LA31 == 78 or LA31 == 79:
+ LA31_62 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 74:
+ LA31_63 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+
+
+
+ if alt31 == 1:
+ # C.g:0:0: declarator_suffix
+ self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator821)
+ self.declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop31
+
+
+
+
+ elif alt34 == 2:
+ # C.g:304:4: '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+
+ self.match(self.input, 62, self.FOLLOW_62_in_direct_declarator827)
+ if self.failed:
+ return
+ # C.g:304:8: ( 'EFIAPI' )?
+ alt32 = 2
+ LA32_0 = self.input.LA(1)
+
+ if (LA32_0 == 58) :
+ LA32_1 = self.input.LA(2)
+
+ if (self.synpred69()) :
+ alt32 = 1
+ if alt32 == 1:
+ # C.g:304:9: 'EFIAPI'
+ self.match(self.input, 58, self.FOLLOW_58_in_direct_declarator830)
+ if self.failed:
+ return
+
+
+
+ self.following.append(self.FOLLOW_declarator_in_direct_declarator834)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_direct_declarator836)
+ if self.failed:
+ return
+ # C.g:304:35: ( declarator_suffix )+
+ cnt33 = 0
+ while True: #loop33
+ alt33 = 2
+ LA33_0 = self.input.LA(1)
+
+ if (LA33_0 == 62) :
+ LA33 = self.input.LA(2)
+ if LA33 == 63:
+ LA33_30 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 58:
+ LA33_31 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 66:
+ LA33_32 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 59:
+ LA33_33 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 60:
+ LA33_34 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == IDENTIFIER:
+ LA33_35 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 29 or LA33 == 30 or LA33 == 31 or LA33 == 32 or LA33 == 33:
+ LA33_37 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 34:
+ LA33_38 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 35:
+ LA33_39 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 36:
+ LA33_40 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 37:
+ LA33_41 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 38:
+ LA33_42 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 39:
+ LA33_43 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 40:
+ LA33_44 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 41:
+ LA33_45 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 42:
+ LA33_46 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 45 or LA33 == 46:
+ LA33_47 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 48:
+ LA33_48 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 49 or LA33 == 50 or LA33 == 51 or LA33 == 52 or LA33 == 53 or LA33 == 54 or LA33 == 55 or LA33 == 56 or LA33 == 57 or LA33 == 61:
+ LA33_49 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+
+ elif (LA33_0 == 64) :
+ LA33 = self.input.LA(2)
+ if LA33 == 65:
+ LA33_51 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 62:
+ LA33_52 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == IDENTIFIER:
+ LA33_53 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == HEX_LITERAL:
+ LA33_54 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == OCTAL_LITERAL:
+ LA33_55 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == DECIMAL_LITERAL:
+ LA33_56 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == CHARACTER_LITERAL:
+ LA33_57 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == STRING_LITERAL:
+ LA33_58 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == FLOATING_POINT_LITERAL:
+ LA33_59 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 72:
+ LA33_60 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 73:
+ LA33_61 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 66 or LA33 == 68 or LA33 == 69 or LA33 == 77 or LA33 == 78 or LA33 == 79:
+ LA33_62 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 74:
+ LA33_63 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+
+
+
+ if alt33 == 1:
+ # C.g:0:0: declarator_suffix
+ self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator838)
+ self.declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ if cnt33 >= 1:
+ break #loop33
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(33, self.input)
+ raise eee
+
+ cnt33 += 1
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 23, direct_declarator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end direct_declarator
+
+
+ # $ANTLR start declarator_suffix
+ # C.g:307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );
+ def declarator_suffix(self, ):
+
+ declarator_suffix_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 24):
+ return
+
+ # C.g:308:2: ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' )
+ alt35 = 5
+ LA35_0 = self.input.LA(1)
+
+ if (LA35_0 == 64) :
+ LA35_1 = self.input.LA(2)
+
+ if (LA35_1 == 65) :
+ alt35 = 2
+ elif ((IDENTIFIER <= LA35_1 <= FLOATING_POINT_LITERAL) or LA35_1 == 62 or LA35_1 == 66 or (68 <= LA35_1 <= 69) or (72 <= LA35_1 <= 74) or (77 <= LA35_1 <= 79)) :
+ alt35 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 1, self.input)
+
+ raise nvae
+
+ elif (LA35_0 == 62) :
+ LA35 = self.input.LA(2)
+ if LA35 == 63:
+ alt35 = 5
+ elif LA35 == 29 or LA35 == 30 or LA35 == 31 or LA35 == 32 or LA35 == 33 or LA35 == 34 or LA35 == 35 or LA35 == 36 or LA35 == 37 or LA35 == 38 or LA35 == 39 or LA35 == 40 or LA35 == 41 or LA35 == 42 or LA35 == 45 or LA35 == 46 or LA35 == 48 or LA35 == 49 or LA35 == 50 or LA35 == 51 or LA35 == 52 or LA35 == 53 or LA35 == 54 or LA35 == 55 or LA35 == 56 or LA35 == 57 or LA35 == 58 or LA35 == 59 or LA35 == 60 or LA35 == 61 or LA35 == 66:
+ alt35 = 3
+ elif LA35 == IDENTIFIER:
+ LA35_29 = self.input.LA(3)
+
+ if (self.synpred73()) :
+ alt35 = 3
+ elif (self.synpred74()) :
+ alt35 = 4
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 29, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 2, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 0, self.input)
+
+ raise nvae
+
+ if alt35 == 1:
+ # C.g:308:6: '[' constant_expression ']'
+ self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix852)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_constant_expression_in_declarator_suffix854)
+ self.constant_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix856)
+ if self.failed:
+ return
+
+
+ elif alt35 == 2:
+ # C.g:309:9: '[' ']'
+ self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix866)
+ if self.failed:
+ return
+ self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix868)
+ if self.failed:
+ return
+
+
+ elif alt35 == 3:
+ # C.g:310:9: '(' parameter_type_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix878)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_parameter_type_list_in_declarator_suffix880)
+ self.parameter_type_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix882)
+ if self.failed:
+ return
+
+
+ elif alt35 == 4:
+ # C.g:311:9: '(' identifier_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix892)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_identifier_list_in_declarator_suffix894)
+ self.identifier_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix896)
+ if self.failed:
+ return
+
+
+ elif alt35 == 5:
+ # C.g:312:9: '(' ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix906)
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix908)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 24, declarator_suffix_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end declarator_suffix
+
+
+ # $ANTLR start pointer
+ # C.g:315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );
+ def pointer(self, ):
+
+ pointer_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 25):
+ return
+
+ # C.g:316:2: ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' )
+ alt38 = 3
+ LA38_0 = self.input.LA(1)
+
+ if (LA38_0 == 66) :
+ LA38 = self.input.LA(2)
+ if LA38 == 66:
+ LA38_2 = self.input.LA(3)
+
+ if (self.synpred78()) :
+ alt38 = 2
+ elif (True) :
+ alt38 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 2, self.input)
+
+ raise nvae
+
+ elif LA38 == 58:
+ LA38_3 = self.input.LA(3)
+
+ if (self.synpred77()) :
+ alt38 = 1
+ elif (True) :
+ alt38 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 3, self.input)
+
+ raise nvae
+
+ elif LA38 == 59:
+ LA38_4 = self.input.LA(3)
+
+ if (self.synpred77()) :
+ alt38 = 1
+ elif (True) :
+ alt38 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 4, self.input)
+
+ raise nvae
+
+ elif LA38 == 60:
+ LA38_5 = self.input.LA(3)
+
+ if (self.synpred77()) :
+ alt38 = 1
+ elif (True) :
+ alt38 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 5, self.input)
+
+ raise nvae
+
+ elif LA38 == EOF or LA38 == IDENTIFIER or LA38 == 25 or LA38 == 26 or LA38 == 27 or LA38 == 28 or LA38 == 29 or LA38 == 30 or LA38 == 31 or LA38 == 32 or LA38 == 33 or LA38 == 34 or LA38 == 35 or LA38 == 36 or LA38 == 37 or LA38 == 38 or LA38 == 39 or LA38 == 40 or LA38 == 41 or LA38 == 42 or LA38 == 43 or LA38 == 45 or LA38 == 46 or LA38 == 47 or LA38 == 48 or LA38 == 62 or LA38 == 63 or LA38 == 64:
+ alt38 = 3
+ elif LA38 == 53:
+ LA38_21 = self.input.LA(3)
+
+ if (self.synpred77()) :
+ alt38 = 1
+ elif (True) :
+ alt38 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 21, self.input)
+
+ raise nvae
+
+ elif LA38 == 49 or LA38 == 50 or LA38 == 51 or LA38 == 52 or LA38 == 54 or LA38 == 55 or LA38 == 56 or LA38 == 57 or LA38 == 61:
+ LA38_29 = self.input.LA(3)
+
+ if (self.synpred77()) :
+ alt38 = 1
+ elif (True) :
+ alt38 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 29, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 1, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 0, self.input)
+
+ raise nvae
+
+ if alt38 == 1:
+ # C.g:316:4: '*' ( type_qualifier )+ ( pointer )?
+ self.match(self.input, 66, self.FOLLOW_66_in_pointer919)
+ if self.failed:
+ return
+ # C.g:316:8: ( type_qualifier )+
+ cnt36 = 0
+ while True: #loop36
+ alt36 = 2
+ LA36 = self.input.LA(1)
+ if LA36 == 58:
+ LA36_2 = self.input.LA(2)
+
+ if (self.synpred75()) :
+ alt36 = 1
+
+
+ elif LA36 == 59:
+ LA36_3 = self.input.LA(2)
+
+ if (self.synpred75()) :
+ alt36 = 1
+
+
+ elif LA36 == 60:
+ LA36_4 = self.input.LA(2)
+
+ if (self.synpred75()) :
+ alt36 = 1
+
+
+ elif LA36 == 53:
+ LA36_20 = self.input.LA(2)
+
+ if (self.synpred75()) :
+ alt36 = 1
+
+
+ elif LA36 == 49 or LA36 == 50 or LA36 == 51 or LA36 == 52 or LA36 == 54 or LA36 == 55 or LA36 == 56 or LA36 == 57 or LA36 == 61:
+ LA36_28 = self.input.LA(2)
+
+ if (self.synpred75()) :
+ alt36 = 1
+
+
+
+ if alt36 == 1:
+ # C.g:0:0: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_pointer921)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ if cnt36 >= 1:
+ break #loop36
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(36, self.input)
+ raise eee
+
+ cnt36 += 1
+
+
+ # C.g:316:24: ( pointer )?
+ alt37 = 2
+ LA37_0 = self.input.LA(1)
+
+ if (LA37_0 == 66) :
+ LA37_1 = self.input.LA(2)
+
+ if (self.synpred76()) :
+ alt37 = 1
+ if alt37 == 1:
+ # C.g:0:0: pointer
+ self.following.append(self.FOLLOW_pointer_in_pointer924)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ elif alt38 == 2:
+ # C.g:317:4: '*' pointer
+ self.match(self.input, 66, self.FOLLOW_66_in_pointer930)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_pointer_in_pointer932)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt38 == 3:
+ # C.g:318:4: '*'
+ self.match(self.input, 66, self.FOLLOW_66_in_pointer937)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 25, pointer_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end pointer
+
+
+ # $ANTLR start parameter_type_list
+ # C.g:321:1: parameter_type_list : parameter_list ( ',' ( 'OPTIONAL' )? '...' )? ;
+ def parameter_type_list(self, ):
+
+ parameter_type_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 26):
+ return
+
+ # C.g:322:2: ( parameter_list ( ',' ( 'OPTIONAL' )? '...' )? )
+ # C.g:322:4: parameter_list ( ',' ( 'OPTIONAL' )? '...' )?
+ self.following.append(self.FOLLOW_parameter_list_in_parameter_type_list948)
+ self.parameter_list()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:322:19: ( ',' ( 'OPTIONAL' )? '...' )?
+ alt40 = 2
+ LA40_0 = self.input.LA(1)
+
+ if (LA40_0 == 27) :
+ alt40 = 1
+ if alt40 == 1:
+ # C.g:322:20: ',' ( 'OPTIONAL' )? '...'
+ self.match(self.input, 27, self.FOLLOW_27_in_parameter_type_list951)
+ if self.failed:
+ return
+ # C.g:322:24: ( 'OPTIONAL' )?
+ alt39 = 2
+ LA39_0 = self.input.LA(1)
+
+ if (LA39_0 == 53) :
+ alt39 = 1
+ if alt39 == 1:
+ # C.g:322:25: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_parameter_type_list954)
+ if self.failed:
+ return
+
+
+
+ self.match(self.input, 67, self.FOLLOW_67_in_parameter_type_list958)
+ if self.failed:
+ return
+
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 26, parameter_type_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end parameter_type_list
+
+
+ # $ANTLR start parameter_list
+ # C.g:325:1: parameter_list : parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* ;
+ def parameter_list(self, ):
+
+ parameter_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 27):
+ return
+
+ # C.g:326:2: ( parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* )
+ # C.g:326:4: parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )*
+ self.following.append(self.FOLLOW_parameter_declaration_in_parameter_list971)
+ self.parameter_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:326:26: ( ',' ( 'OPTIONAL' )? parameter_declaration )*
+ while True: #loop42
+ alt42 = 2
+ LA42_0 = self.input.LA(1)
+
+ if (LA42_0 == 27) :
+ LA42_1 = self.input.LA(2)
+
+ if (LA42_1 == 53) :
+ LA42_3 = self.input.LA(3)
+
+ if (self.synpred82()) :
+ alt42 = 1
+
+
+ elif (LA42_1 == IDENTIFIER or (29 <= LA42_1 <= 42) or (45 <= LA42_1 <= 46) or (48 <= LA42_1 <= 52) or (54 <= LA42_1 <= 61) or LA42_1 == 66) :
+ alt42 = 1
+
+
+
+
+ if alt42 == 1:
+ # C.g:326:27: ',' ( 'OPTIONAL' )? parameter_declaration
+ self.match(self.input, 27, self.FOLLOW_27_in_parameter_list974)
+ if self.failed:
+ return
+ # C.g:326:31: ( 'OPTIONAL' )?
+ alt41 = 2
+ LA41_0 = self.input.LA(1)
+
+ if (LA41_0 == 53) :
+ LA41_1 = self.input.LA(2)
+
+ if (self.synpred81()) :
+ alt41 = 1
+ if alt41 == 1:
+ # C.g:326:32: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_parameter_list977)
+ if self.failed:
+ return
+
+
+
+ self.following.append(self.FOLLOW_parameter_declaration_in_parameter_list981)
+ self.parameter_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop42
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 27, parameter_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end parameter_list
+
+
+ # $ANTLR start parameter_declaration
+ # C.g:329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );
+ def parameter_declaration(self, ):
+
+ parameter_declaration_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 28):
+ return
+
+ # C.g:330:2: ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER )
+ alt46 = 2
+ LA46 = self.input.LA(1)
+ if LA46 == 29 or LA46 == 30 or LA46 == 31 or LA46 == 32 or LA46 == 33 or LA46 == 34 or LA46 == 35 or LA46 == 36 or LA46 == 37 or LA46 == 38 or LA46 == 39 or LA46 == 40 or LA46 == 41 or LA46 == 42 or LA46 == 45 or LA46 == 46 or LA46 == 48 or LA46 == 49 or LA46 == 50 or LA46 == 51 or LA46 == 52 or LA46 == 53 or LA46 == 54 or LA46 == 55 or LA46 == 56 or LA46 == 57 or LA46 == 58 or LA46 == 59 or LA46 == 60 or LA46 == 61:
+ alt46 = 1
+ elif LA46 == IDENTIFIER:
+ LA46_13 = self.input.LA(2)
+
+ if (self.synpred86()) :
+ alt46 = 1
+ elif (True) :
+ alt46 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );", 46, 13, self.input)
+
+ raise nvae
+
+ elif LA46 == 66:
+ alt46 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );", 46, 0, self.input)
+
+ raise nvae
+
+ if alt46 == 1:
+ # C.g:330:4: declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )?
+ self.following.append(self.FOLLOW_declaration_specifiers_in_parameter_declaration994)
+ self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:330:27: ( declarator | abstract_declarator )*
+ while True: #loop43
+ alt43 = 3
+ LA43 = self.input.LA(1)
+ if LA43 == 66:
+ LA43_5 = self.input.LA(2)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+ elif LA43 == IDENTIFIER or LA43 == 58 or LA43 == 59 or LA43 == 60:
+ alt43 = 1
+ elif LA43 == 62:
+ LA43 = self.input.LA(2)
+ if LA43 == 29 or LA43 == 30 or LA43 == 31 or LA43 == 32 or LA43 == 33 or LA43 == 34 or LA43 == 35 or LA43 == 36 or LA43 == 37 or LA43 == 38 or LA43 == 39 or LA43 == 40 or LA43 == 41 or LA43 == 42 or LA43 == 45 or LA43 == 46 or LA43 == 48 or LA43 == 49 or LA43 == 50 or LA43 == 51 or LA43 == 52 or LA43 == 53 or LA43 == 54 or LA43 == 55 or LA43 == 56 or LA43 == 57 or LA43 == 61 or LA43 == 63 or LA43 == 64:
+ alt43 = 2
+ elif LA43 == IDENTIFIER:
+ LA43_37 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+ elif LA43 == 58:
+ LA43_38 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+ elif LA43 == 66:
+ LA43_39 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+ elif LA43 == 59:
+ LA43_40 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+ elif LA43 == 60:
+ LA43_41 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+ elif LA43 == 62:
+ LA43_43 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+
+ elif LA43 == 64:
+ alt43 = 2
+
+ if alt43 == 1:
+ # C.g:330:28: declarator
+ self.following.append(self.FOLLOW_declarator_in_parameter_declaration997)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt43 == 2:
+ # C.g:330:39: abstract_declarator
+ self.following.append(self.FOLLOW_abstract_declarator_in_parameter_declaration999)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop43
+
+
+ # C.g:330:61: ( 'OPTIONAL' )?
+ alt44 = 2
+ LA44_0 = self.input.LA(1)
+
+ if (LA44_0 == 53) :
+ alt44 = 1
+ if alt44 == 1:
+ # C.g:330:62: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_parameter_declaration1004)
+ if self.failed:
+ return
+
+
+
+
+
+ elif alt46 == 2:
+ # C.g:332:4: ( pointer )* IDENTIFIER
+ # C.g:332:4: ( pointer )*
+ while True: #loop45
+ alt45 = 2
+ LA45_0 = self.input.LA(1)
+
+ if (LA45_0 == 66) :
+ alt45 = 1
+
+
+ if alt45 == 1:
+ # C.g:0:0: pointer
+ self.following.append(self.FOLLOW_pointer_in_parameter_declaration1013)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop45
+
+
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_parameter_declaration1016)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 28, parameter_declaration_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end parameter_declaration
+
+
+ # $ANTLR start identifier_list
+ # C.g:335:1: identifier_list : IDENTIFIER ( ',' IDENTIFIER )* ;
+ def identifier_list(self, ):
+
+ identifier_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 29):
+ return
+
+ # C.g:336:2: ( IDENTIFIER ( ',' IDENTIFIER )* )
+ # C.g:336:4: IDENTIFIER ( ',' IDENTIFIER )*
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_identifier_list1027)
+ if self.failed:
+ return
+ # C.g:337:2: ( ',' IDENTIFIER )*
+ while True: #loop47
+ alt47 = 2
+ LA47_0 = self.input.LA(1)
+
+ if (LA47_0 == 27) :
+ alt47 = 1
+
+
+ if alt47 == 1:
+ # C.g:337:3: ',' IDENTIFIER
+ self.match(self.input, 27, self.FOLLOW_27_in_identifier_list1031)
+ if self.failed:
+ return
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_identifier_list1033)
+ if self.failed:
+ return
+
+
+ else:
+ break #loop47
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 29, identifier_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end identifier_list
+
+
+ # $ANTLR start type_name
+ # C.g:340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );
+ def type_name(self, ):
+
+ type_name_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 30):
+ return
+
+ # C.g:341:2: ( specifier_qualifier_list ( abstract_declarator )? | type_id )
+ alt49 = 2
+ LA49_0 = self.input.LA(1)
+
+ if ((34 <= LA49_0 <= 42) or (45 <= LA49_0 <= 46) or (48 <= LA49_0 <= 61)) :
+ alt49 = 1
+ elif (LA49_0 == IDENTIFIER) :
+ LA49_13 = self.input.LA(2)
+
+ if (self.synpred90()) :
+ alt49 = 1
+ elif (True) :
+ alt49 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );", 49, 13, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );", 49, 0, self.input)
+
+ raise nvae
+
+ if alt49 == 1:
+ # C.g:341:4: specifier_qualifier_list ( abstract_declarator )?
+ self.following.append(self.FOLLOW_specifier_qualifier_list_in_type_name1046)
+ self.specifier_qualifier_list()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:341:29: ( abstract_declarator )?
+ alt48 = 2
+ LA48_0 = self.input.LA(1)
+
+ if (LA48_0 == 62 or LA48_0 == 64 or LA48_0 == 66) :
+ alt48 = 1
+ if alt48 == 1:
+ # C.g:0:0: abstract_declarator
+ self.following.append(self.FOLLOW_abstract_declarator_in_type_name1048)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ elif alt49 == 2:
+ # C.g:342:4: type_id
+ self.following.append(self.FOLLOW_type_id_in_type_name1054)
+ self.type_id()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 30, type_name_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end type_name
+
+
+ # $ANTLR start abstract_declarator
+ # C.g:345:1: abstract_declarator : ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator );
+ def abstract_declarator(self, ):
+
+ abstract_declarator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 31):
+ return
+
+ # C.g:346:2: ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator )
+ alt51 = 2
+ LA51_0 = self.input.LA(1)
+
+ if (LA51_0 == 66) :
+ alt51 = 1
+ elif (LA51_0 == 62 or LA51_0 == 64) :
+ alt51 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("345:1: abstract_declarator : ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator );", 51, 0, self.input)
+
+ raise nvae
+
+ if alt51 == 1:
+ # C.g:346:4: pointer ( direct_abstract_declarator )?
+ self.following.append(self.FOLLOW_pointer_in_abstract_declarator1065)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:346:12: ( direct_abstract_declarator )?
+ alt50 = 2
+ LA50_0 = self.input.LA(1)
+
+ if (LA50_0 == 62) :
+ LA50 = self.input.LA(2)
+ if LA50 == 63:
+ LA50_12 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 58:
+ LA50_13 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 66:
+ LA50_14 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 59:
+ LA50_15 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 60:
+ LA50_16 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == IDENTIFIER:
+ LA50_17 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 62:
+ LA50_18 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 64:
+ LA50_19 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 29 or LA50 == 30 or LA50 == 31 or LA50 == 32 or LA50 == 33:
+ LA50_20 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 34:
+ LA50_21 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 35:
+ LA50_22 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 36:
+ LA50_23 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 37:
+ LA50_24 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 38:
+ LA50_25 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 39:
+ LA50_26 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 40:
+ LA50_27 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 41:
+ LA50_28 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 42:
+ LA50_29 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 45 or LA50 == 46:
+ LA50_30 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 48:
+ LA50_31 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 49 or LA50 == 50 or LA50 == 51 or LA50 == 52 or LA50 == 53 or LA50 == 54 or LA50 == 55 or LA50 == 56 or LA50 == 57 or LA50 == 61:
+ LA50_32 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif (LA50_0 == 64) :
+ LA50 = self.input.LA(2)
+ if LA50 == 65:
+ LA50_33 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 62:
+ LA50_34 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == IDENTIFIER:
+ LA50_35 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == HEX_LITERAL:
+ LA50_36 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == OCTAL_LITERAL:
+ LA50_37 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == DECIMAL_LITERAL:
+ LA50_38 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == CHARACTER_LITERAL:
+ LA50_39 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == STRING_LITERAL:
+ LA50_40 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == FLOATING_POINT_LITERAL:
+ LA50_41 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 72:
+ LA50_42 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 73:
+ LA50_43 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 66 or LA50 == 68 or LA50 == 69 or LA50 == 77 or LA50 == 78 or LA50 == 79:
+ LA50_44 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 74:
+ LA50_45 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ if alt50 == 1:
+ # C.g:0:0: direct_abstract_declarator
+ self.following.append(self.FOLLOW_direct_abstract_declarator_in_abstract_declarator1067)
+ self.direct_abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ elif alt51 == 2:
+ # C.g:347:4: direct_abstract_declarator
+ self.following.append(self.FOLLOW_direct_abstract_declarator_in_abstract_declarator1073)
+ self.direct_abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 31, abstract_declarator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end abstract_declarator
+
+
+ # $ANTLR start direct_abstract_declarator
+ # C.g:350:1: direct_abstract_declarator : ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* ;
+ def direct_abstract_declarator(self, ):
+
+ direct_abstract_declarator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 32):
+ return
+
+ # C.g:351:2: ( ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* )
+ # C.g:351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )*
+ # C.g:351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )
+ alt52 = 2
+ LA52_0 = self.input.LA(1)
+
+ if (LA52_0 == 62) :
+ LA52 = self.input.LA(2)
+ if LA52 == IDENTIFIER or LA52 == 29 or LA52 == 30 or LA52 == 31 or LA52 == 32 or LA52 == 33 or LA52 == 34 or LA52 == 35 or LA52 == 36 or LA52 == 37 or LA52 == 38 or LA52 == 39 or LA52 == 40 or LA52 == 41 or LA52 == 42 or LA52 == 45 or LA52 == 46 or LA52 == 48 or LA52 == 49 or LA52 == 50 or LA52 == 51 or LA52 == 52 or LA52 == 53 or LA52 == 54 or LA52 == 55 or LA52 == 56 or LA52 == 57 or LA52 == 58 or LA52 == 59 or LA52 == 60 or LA52 == 61 or LA52 == 63:
+ alt52 = 2
+ elif LA52 == 66:
+ LA52_18 = self.input.LA(3)
+
+ if (self.synpred93()) :
+ alt52 = 1
+ elif (True) :
+ alt52 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 18, self.input)
+
+ raise nvae
+
+ elif LA52 == 62 or LA52 == 64:
+ alt52 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 1, self.input)
+
+ raise nvae
+
+ elif (LA52_0 == 64) :
+ alt52 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 0, self.input)
+
+ raise nvae
+
+ if alt52 == 1:
+ # C.g:351:6: '(' abstract_declarator ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_direct_abstract_declarator1086)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_abstract_declarator_in_direct_abstract_declarator1088)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_direct_abstract_declarator1090)
+ if self.failed:
+ return
+
+
+ elif alt52 == 2:
+ # C.g:351:36: abstract_declarator_suffix
+ self.following.append(self.FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1094)
+ self.abstract_declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ # C.g:351:65: ( abstract_declarator_suffix )*
+ while True: #loop53
+ alt53 = 2
+ LA53_0 = self.input.LA(1)
+
+ if (LA53_0 == 62) :
+ LA53 = self.input.LA(2)
+ if LA53 == 63:
+ LA53_12 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 58:
+ LA53_13 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 66:
+ LA53_14 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 59:
+ LA53_15 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 60:
+ LA53_16 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == IDENTIFIER:
+ LA53_17 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 29 or LA53 == 30 or LA53 == 31 or LA53 == 32 or LA53 == 33:
+ LA53_19 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 34:
+ LA53_20 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 35:
+ LA53_21 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 36:
+ LA53_22 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 37:
+ LA53_23 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 38:
+ LA53_24 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 39:
+ LA53_25 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 40:
+ LA53_26 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 41:
+ LA53_27 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 42:
+ LA53_28 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 45 or LA53 == 46:
+ LA53_29 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 48:
+ LA53_30 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 49 or LA53 == 50 or LA53 == 51 or LA53 == 52 or LA53 == 53 or LA53 == 54 or LA53 == 55 or LA53 == 56 or LA53 == 57 or LA53 == 61:
+ LA53_31 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+
+ elif (LA53_0 == 64) :
+ LA53 = self.input.LA(2)
+ if LA53 == 65:
+ LA53_33 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 62:
+ LA53_34 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == IDENTIFIER:
+ LA53_35 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == HEX_LITERAL:
+ LA53_36 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == OCTAL_LITERAL:
+ LA53_37 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == DECIMAL_LITERAL:
+ LA53_38 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == CHARACTER_LITERAL:
+ LA53_39 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == STRING_LITERAL:
+ LA53_40 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == FLOATING_POINT_LITERAL:
+ LA53_41 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 72:
+ LA53_42 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 73:
+ LA53_43 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 66 or LA53 == 68 or LA53 == 69 or LA53 == 77 or LA53 == 78 or LA53 == 79:
+ LA53_44 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 74:
+ LA53_45 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+
+
+
+ if alt53 == 1:
+ # C.g:0:0: abstract_declarator_suffix
+ self.following.append(self.FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1098)
+ self.abstract_declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop53
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 32, direct_abstract_declarator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end direct_abstract_declarator
+
+
+ # $ANTLR start abstract_declarator_suffix
+ # C.g:354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );
+ def abstract_declarator_suffix(self, ):
+
+ abstract_declarator_suffix_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 33):
+ return
+
+ # C.g:355:2: ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' )
+ alt54 = 4
+ LA54_0 = self.input.LA(1)
+
+ if (LA54_0 == 64) :
+ LA54_1 = self.input.LA(2)
+
+ if (LA54_1 == 65) :
+ alt54 = 1
+ elif ((IDENTIFIER <= LA54_1 <= FLOATING_POINT_LITERAL) or LA54_1 == 62 or LA54_1 == 66 or (68 <= LA54_1 <= 69) or (72 <= LA54_1 <= 74) or (77 <= LA54_1 <= 79)) :
+ alt54 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 1, self.input)
+
+ raise nvae
+
+ elif (LA54_0 == 62) :
+ LA54_2 = self.input.LA(2)
+
+ if (LA54_2 == 63) :
+ alt54 = 3
+ elif (LA54_2 == IDENTIFIER or (29 <= LA54_2 <= 42) or (45 <= LA54_2 <= 46) or (48 <= LA54_2 <= 61) or LA54_2 == 66) :
+ alt54 = 4
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 2, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 0, self.input)
+
+ raise nvae
+
+ if alt54 == 1:
+ # C.g:355:4: '[' ']'
+ self.match(self.input, 64, self.FOLLOW_64_in_abstract_declarator_suffix1110)
+ if self.failed:
+ return
+ self.match(self.input, 65, self.FOLLOW_65_in_abstract_declarator_suffix1112)
+ if self.failed:
+ return
+
+
+ elif alt54 == 2:
+ # C.g:356:4: '[' constant_expression ']'
+ self.match(self.input, 64, self.FOLLOW_64_in_abstract_declarator_suffix1117)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_constant_expression_in_abstract_declarator_suffix1119)
+ self.constant_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 65, self.FOLLOW_65_in_abstract_declarator_suffix1121)
+ if self.failed:
+ return
+
+
+ elif alt54 == 3:
+ # C.g:357:4: '(' ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_abstract_declarator_suffix1126)
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_abstract_declarator_suffix1128)
+ if self.failed:
+ return
+
+
+ elif alt54 == 4:
+ # C.g:358:4: '(' parameter_type_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_abstract_declarator_suffix1133)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_parameter_type_list_in_abstract_declarator_suffix1135)
+ self.parameter_type_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_abstract_declarator_suffix1137)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 33, abstract_declarator_suffix_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end abstract_declarator_suffix
+
+
+ # $ANTLR start initializer
+ # C.g:361:1: initializer : ( assignment_expression | '{' initializer_list ( ',' )? '}' );
+ def initializer(self, ):
+
+ initializer_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 34):
+ return
+
+ # C.g:363:2: ( assignment_expression | '{' initializer_list ( ',' )? '}' )
+ alt56 = 2
+ LA56_0 = self.input.LA(1)
+
+ if ((IDENTIFIER <= LA56_0 <= FLOATING_POINT_LITERAL) or LA56_0 == 62 or LA56_0 == 66 or (68 <= LA56_0 <= 69) or (72 <= LA56_0 <= 74) or (77 <= LA56_0 <= 79)) :
+ alt56 = 1
+ elif (LA56_0 == 43) :
+ alt56 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("361:1: initializer : ( assignment_expression | '{' initializer_list ( ',' )? '}' );", 56, 0, self.input)
+
+ raise nvae
+
+ if alt56 == 1:
+ # C.g:363:4: assignment_expression
+ self.following.append(self.FOLLOW_assignment_expression_in_initializer1150)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt56 == 2:
+ # C.g:364:4: '{' initializer_list ( ',' )? '}'
+ self.match(self.input, 43, self.FOLLOW_43_in_initializer1155)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_initializer_list_in_initializer1157)
+ self.initializer_list()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:364:25: ( ',' )?
+ alt55 = 2
+ LA55_0 = self.input.LA(1)
+
+ if (LA55_0 == 27) :
+ alt55 = 1
+ if alt55 == 1:
+ # C.g:0:0: ','
+ self.match(self.input, 27, self.FOLLOW_27_in_initializer1159)
+ if self.failed:
+ return
+
+
+
+ self.match(self.input, 44, self.FOLLOW_44_in_initializer1162)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 34, initializer_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end initializer
+
+
+ # $ANTLR start initializer_list
+ # C.g:367:1: initializer_list : initializer ( ',' initializer )* ;
+ def initializer_list(self, ):
+
+ initializer_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 35):
+ return
+
+ # C.g:368:2: ( initializer ( ',' initializer )* )
+ # C.g:368:4: initializer ( ',' initializer )*
+ self.following.append(self.FOLLOW_initializer_in_initializer_list1173)
+ self.initializer()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:368:16: ( ',' initializer )*
+ while True: #loop57
+ alt57 = 2
+ LA57_0 = self.input.LA(1)
+
+ if (LA57_0 == 27) :
+ LA57_1 = self.input.LA(2)
+
+ if ((IDENTIFIER <= LA57_1 <= FLOATING_POINT_LITERAL) or LA57_1 == 43 or LA57_1 == 62 or LA57_1 == 66 or (68 <= LA57_1 <= 69) or (72 <= LA57_1 <= 74) or (77 <= LA57_1 <= 79)) :
+ alt57 = 1
+
+
+
+
+ if alt57 == 1:
+ # C.g:368:17: ',' initializer
+ self.match(self.input, 27, self.FOLLOW_27_in_initializer_list1176)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_initializer_in_initializer_list1178)
+ self.initializer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop57
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 35, initializer_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end initializer_list
+
+ class argument_expression_list_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start argument_expression_list
+ # C.g:373:1: argument_expression_list : assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* ;
+ def argument_expression_list(self, ):
+
+ retval = self.argument_expression_list_return()
+ retval.start = self.input.LT(1)
+ argument_expression_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 36):
+ return retval
+
+ # C.g:374:2: ( assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* )
+ # C.g:374:6: assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )*
+ self.following.append(self.FOLLOW_assignment_expression_in_argument_expression_list1196)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:374:28: ( 'OPTIONAL' )?
+ alt58 = 2
+ LA58_0 = self.input.LA(1)
+
+ if (LA58_0 == 53) :
+ alt58 = 1
+ if alt58 == 1:
+ # C.g:374:29: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_argument_expression_list1199)
+ if self.failed:
+ return retval
+
+
+
+ # C.g:374:42: ( ',' assignment_expression ( 'OPTIONAL' )? )*
+ while True: #loop60
+ alt60 = 2
+ LA60_0 = self.input.LA(1)
+
+ if (LA60_0 == 27) :
+ alt60 = 1
+
+
+ if alt60 == 1:
+ # C.g:374:43: ',' assignment_expression ( 'OPTIONAL' )?
+ self.match(self.input, 27, self.FOLLOW_27_in_argument_expression_list1204)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_assignment_expression_in_argument_expression_list1206)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:374:69: ( 'OPTIONAL' )?
+ alt59 = 2
+ LA59_0 = self.input.LA(1)
+
+ if (LA59_0 == 53) :
+ alt59 = 1
+ if alt59 == 1:
+ # C.g:374:70: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_argument_expression_list1209)
+ if self.failed:
+ return retval
+
+
+
+
+
+ else:
+ break #loop60
+
+
+
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 36, argument_expression_list_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end argument_expression_list
+
+
+ # $ANTLR start additive_expression
+ # C.g:377:1: additive_expression : ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* ;
+ def additive_expression(self, ):
+
+ additive_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 37):
+ return
+
+ # C.g:378:2: ( ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* )
+ # C.g:378:4: ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )*
+ # C.g:378:4: ( multiplicative_expression )
+ # C.g:378:5: multiplicative_expression
+ self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1225)
+ self.multiplicative_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ # C.g:378:32: ( '+' multiplicative_expression | '-' multiplicative_expression )*
+ while True: #loop61
+ alt61 = 3
+ LA61_0 = self.input.LA(1)
+
+ if (LA61_0 == 68) :
+ alt61 = 1
+ elif (LA61_0 == 69) :
+ alt61 = 2
+
+
+ if alt61 == 1:
+ # C.g:378:33: '+' multiplicative_expression
+ self.match(self.input, 68, self.FOLLOW_68_in_additive_expression1229)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1231)
+ self.multiplicative_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt61 == 2:
+ # C.g:378:65: '-' multiplicative_expression
+ self.match(self.input, 69, self.FOLLOW_69_in_additive_expression1235)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1237)
+ self.multiplicative_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop61
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 37, additive_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end additive_expression
+
+
+ # $ANTLR start multiplicative_expression
+ # C.g:381:1: multiplicative_expression : ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* ;
+ def multiplicative_expression(self, ):
+
+ multiplicative_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 38):
+ return
+
+ # C.g:382:2: ( ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* )
+ # C.g:382:4: ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )*
+ # C.g:382:4: ( cast_expression )
+ # C.g:382:5: cast_expression
+ self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1251)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ # C.g:382:22: ( '*' cast_expression | '/' cast_expression | '%' cast_expression )*
+ while True: #loop62
+ alt62 = 4
+ LA62 = self.input.LA(1)
+ if LA62 == 66:
+ alt62 = 1
+ elif LA62 == 70:
+ alt62 = 2
+ elif LA62 == 71:
+ alt62 = 3
+
+ if alt62 == 1:
+ # C.g:382:23: '*' cast_expression
+ self.match(self.input, 66, self.FOLLOW_66_in_multiplicative_expression1255)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1257)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt62 == 2:
+ # C.g:382:45: '/' cast_expression
+ self.match(self.input, 70, self.FOLLOW_70_in_multiplicative_expression1261)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1263)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt62 == 3:
+ # C.g:382:67: '%' cast_expression
+ self.match(self.input, 71, self.FOLLOW_71_in_multiplicative_expression1267)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1269)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop62
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 38, multiplicative_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end multiplicative_expression
+
+
+ # $ANTLR start cast_expression
+ # C.g:385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );
+ def cast_expression(self, ):
+
+ cast_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 39):
+ return
+
+ # C.g:386:2: ( '(' type_name ')' cast_expression | unary_expression )
+ alt63 = 2
+ LA63_0 = self.input.LA(1)
+
+ if (LA63_0 == 62) :
+ LA63 = self.input.LA(2)
+ if LA63 == 34 or LA63 == 35 or LA63 == 36 or LA63 == 37 or LA63 == 38 or LA63 == 39 or LA63 == 40 or LA63 == 41 or LA63 == 42 or LA63 == 45 or LA63 == 46 or LA63 == 48 or LA63 == 49 or LA63 == 50 or LA63 == 51 or LA63 == 52 or LA63 == 53 or LA63 == 54 or LA63 == 55 or LA63 == 56 or LA63 == 57 or LA63 == 58 or LA63 == 59 or LA63 == 60 or LA63 == 61:
+ alt63 = 1
+ elif LA63 == IDENTIFIER:
+ LA63_25 = self.input.LA(3)
+
+ if (self.synpred109()) :
+ alt63 = 1
+ elif (True) :
+ alt63 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 25, self.input)
+
+ raise nvae
+
+ elif LA63 == HEX_LITERAL or LA63 == OCTAL_LITERAL or LA63 == DECIMAL_LITERAL or LA63 == CHARACTER_LITERAL or LA63 == STRING_LITERAL or LA63 == FLOATING_POINT_LITERAL or LA63 == 62 or LA63 == 66 or LA63 == 68 or LA63 == 69 or LA63 == 72 or LA63 == 73 or LA63 == 74 or LA63 == 77 or LA63 == 78 or LA63 == 79:
+ alt63 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 1, self.input)
+
+ raise nvae
+
+ elif ((IDENTIFIER <= LA63_0 <= FLOATING_POINT_LITERAL) or LA63_0 == 66 or (68 <= LA63_0 <= 69) or (72 <= LA63_0 <= 74) or (77 <= LA63_0 <= 79)) :
+ alt63 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 0, self.input)
+
+ raise nvae
+
+ if alt63 == 1:
+ # C.g:386:4: '(' type_name ')' cast_expression
+ self.match(self.input, 62, self.FOLLOW_62_in_cast_expression1282)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_type_name_in_cast_expression1284)
+ self.type_name()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_cast_expression1286)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_cast_expression_in_cast_expression1288)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt63 == 2:
+ # C.g:387:4: unary_expression
+ self.following.append(self.FOLLOW_unary_expression_in_cast_expression1293)
+ self.unary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 39, cast_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end cast_expression
+
+
+ # $ANTLR start unary_expression
+ # C.g:390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );
+ def unary_expression(self, ):
+
+ unary_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 40):
+ return
+
+ # C.g:391:2: ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' )
+ alt64 = 6
+ LA64 = self.input.LA(1)
+ if LA64 == IDENTIFIER or LA64 == HEX_LITERAL or LA64 == OCTAL_LITERAL or LA64 == DECIMAL_LITERAL or LA64 == CHARACTER_LITERAL or LA64 == STRING_LITERAL or LA64 == FLOATING_POINT_LITERAL or LA64 == 62:
+ alt64 = 1
+ elif LA64 == 72:
+ alt64 = 2
+ elif LA64 == 73:
+ alt64 = 3
+ elif LA64 == 66 or LA64 == 68 or LA64 == 69 or LA64 == 77 or LA64 == 78 or LA64 == 79:
+ alt64 = 4
+ elif LA64 == 74:
+ LA64_12 = self.input.LA(2)
+
+ if (LA64_12 == 62) :
+ LA64_13 = self.input.LA(3)
+
+ if (self.synpred114()) :
+ alt64 = 5
+ elif (True) :
+ alt64 = 6
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 13, self.input)
+
+ raise nvae
+
+ elif ((IDENTIFIER <= LA64_12 <= FLOATING_POINT_LITERAL) or LA64_12 == 66 or (68 <= LA64_12 <= 69) or (72 <= LA64_12 <= 74) or (77 <= LA64_12 <= 79)) :
+ alt64 = 5
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 12, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 0, self.input)
+
+ raise nvae
+
+ if alt64 == 1:
+ # C.g:391:4: postfix_expression
+ self.following.append(self.FOLLOW_postfix_expression_in_unary_expression1304)
+ self.postfix_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt64 == 2:
+ # C.g:392:4: '++' unary_expression
+ self.match(self.input, 72, self.FOLLOW_72_in_unary_expression1309)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_unary_expression_in_unary_expression1311)
+ self.unary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt64 == 3:
+ # C.g:393:4: '--' unary_expression
+ self.match(self.input, 73, self.FOLLOW_73_in_unary_expression1316)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_unary_expression_in_unary_expression1318)
+ self.unary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt64 == 4:
+ # C.g:394:4: unary_operator cast_expression
+ self.following.append(self.FOLLOW_unary_operator_in_unary_expression1323)
+ self.unary_operator()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_cast_expression_in_unary_expression1325)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt64 == 5:
+ # C.g:395:4: 'sizeof' unary_expression
+ self.match(self.input, 74, self.FOLLOW_74_in_unary_expression1330)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_unary_expression_in_unary_expression1332)
+ self.unary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt64 == 6:
+ # C.g:396:4: 'sizeof' '(' type_name ')'
+ self.match(self.input, 74, self.FOLLOW_74_in_unary_expression1337)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_unary_expression1339)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_type_name_in_unary_expression1341)
+ self.type_name()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_unary_expression1343)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 40, unary_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end unary_expression
+
+
+ # $ANTLR start postfix_expression
+ # C.g:399:1: postfix_expression : p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* ;
+ def postfix_expression(self, ):
+ self.postfix_expression_stack.append(postfix_expression_scope())
+ postfix_expression_StartIndex = self.input.index()
+ a = None
+ b = None
+ x = None
+ y = None
+ z = None
+ p = None
+
+ c = None
+
+
+
+ self.postfix_expression_stack[-1].FuncCallText = ''
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 41):
+ return
+
+ # C.g:406:2: (p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* )
+ # C.g:406:6: p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )*
+ self.following.append(self.FOLLOW_primary_expression_in_postfix_expression1367)
+ p = self.primary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.postfix_expression_stack[-1].FuncCallText += self.input.toString(p.start, p.stop)
+
+ # C.g:407:9: ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )*
+ while True: #loop65
+ alt65 = 10
+ LA65 = self.input.LA(1)
+ if LA65 == 66:
+ LA65_1 = self.input.LA(2)
+
+ if (LA65_1 == IDENTIFIER) :
+ LA65_30 = self.input.LA(3)
+
+ if (self.synpred120()) :
+ alt65 = 6
+
+
+
+
+ elif LA65 == 64:
+ alt65 = 1
+ elif LA65 == 62:
+ LA65 = self.input.LA(2)
+ if LA65 == 63:
+ alt65 = 2
+ elif LA65 == 29 or LA65 == 30 or LA65 == 31 or LA65 == 32 or LA65 == 33 or LA65 == 34 or LA65 == 35 or LA65 == 36 or LA65 == 37 or LA65 == 38 or LA65 == 39 or LA65 == 40 or LA65 == 41 or LA65 == 42 or LA65 == 45 or LA65 == 46 or LA65 == 48 or LA65 == 49 or LA65 == 50 or LA65 == 51 or LA65 == 52 or LA65 == 53 or LA65 == 54 or LA65 == 55 or LA65 == 56 or LA65 == 57 or LA65 == 58 or LA65 == 59 or LA65 == 60 or LA65 == 61:
+ alt65 = 4
+ elif LA65 == IDENTIFIER:
+ LA65_55 = self.input.LA(3)
+
+ if (self.synpred117()) :
+ alt65 = 3
+ elif (self.synpred118()) :
+ alt65 = 4
+
+
+ elif LA65 == 66:
+ LA65_57 = self.input.LA(3)
+
+ if (self.synpred117()) :
+ alt65 = 3
+ elif (self.synpred118()) :
+ alt65 = 4
+
+
+ elif LA65 == HEX_LITERAL or LA65 == OCTAL_LITERAL or LA65 == DECIMAL_LITERAL or LA65 == CHARACTER_LITERAL or LA65 == STRING_LITERAL or LA65 == FLOATING_POINT_LITERAL or LA65 == 62 or LA65 == 68 or LA65 == 69 or LA65 == 72 or LA65 == 73 or LA65 == 74 or LA65 == 77 or LA65 == 78 or LA65 == 79:
+ alt65 = 3
+
+ elif LA65 == 75:
+ alt65 = 5
+ elif LA65 == 76:
+ alt65 = 7
+ elif LA65 == 72:
+ alt65 = 8
+ elif LA65 == 73:
+ alt65 = 9
+
+ if alt65 == 1:
+ # C.g:407:13: '[' expression ']'
+ self.match(self.input, 64, self.FOLLOW_64_in_postfix_expression1383)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_postfix_expression1385)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 65, self.FOLLOW_65_in_postfix_expression1387)
+ if self.failed:
+ return
+
+
+ elif alt65 == 2:
+ # C.g:408:13: '(' a= ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1401)
+ if self.failed:
+ return
+ a = self.input.LT(1)
+ self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1405)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StoreFunctionCalling(p.start.line, p.start.charPositionInLine, a.line, a.charPositionInLine, self.postfix_expression_stack[-1].FuncCallText, '')
+
+
+
+ elif alt65 == 3:
+ # C.g:409:13: '(' c= argument_expression_list b= ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1420)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_argument_expression_list_in_postfix_expression1424)
+ c = self.argument_expression_list()
+ self.following.pop()
+ if self.failed:
+ return
+ b = self.input.LT(1)
+ self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1428)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StoreFunctionCalling(p.start.line, p.start.charPositionInLine, b.line, b.charPositionInLine, self.postfix_expression_stack[-1].FuncCallText, self.input.toString(c.start, c.stop))
+
+
+
+ elif alt65 == 4:
+ # C.g:410:13: '(' macro_parameter_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1444)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_macro_parameter_list_in_postfix_expression1446)
+ self.macro_parameter_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1448)
+ if self.failed:
+ return
+
+
+ elif alt65 == 5:
+ # C.g:411:13: '.' x= IDENTIFIER
+ self.match(self.input, 75, self.FOLLOW_75_in_postfix_expression1462)
+ if self.failed:
+ return
+ x = self.input.LT(1)
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1466)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.postfix_expression_stack[-1].FuncCallText += '.' + x.text
+
+
+
+ elif alt65 == 6:
+ # C.g:412:13: '*' y= IDENTIFIER
+ self.match(self.input, 66, self.FOLLOW_66_in_postfix_expression1482)
+ if self.failed:
+ return
+ y = self.input.LT(1)
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1486)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.postfix_expression_stack[-1].FuncCallText = y.text
+
+
+
+ elif alt65 == 7:
+ # C.g:413:13: '->' z= IDENTIFIER
+ self.match(self.input, 76, self.FOLLOW_76_in_postfix_expression1502)
+ if self.failed:
+ return
+ z = self.input.LT(1)
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1506)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.postfix_expression_stack[-1].FuncCallText += '->' + z.text
+
+
+
+ elif alt65 == 8:
+ # C.g:414:13: '++'
+ self.match(self.input, 72, self.FOLLOW_72_in_postfix_expression1522)
+ if self.failed:
+ return
+
+
+ elif alt65 == 9:
+ # C.g:415:13: '--'
+ self.match(self.input, 73, self.FOLLOW_73_in_postfix_expression1536)
+ if self.failed:
+ return
+
+
+ else:
+ break #loop65
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 41, postfix_expression_StartIndex)
+
+ self.postfix_expression_stack.pop()
+ pass
+
+ return
+
+ # $ANTLR end postfix_expression
+
+
+ # $ANTLR start macro_parameter_list
+ # C.g:419:1: macro_parameter_list : parameter_declaration ( ',' parameter_declaration )* ;
+ def macro_parameter_list(self, ):
+
+ macro_parameter_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 42):
+ return
+
+ # C.g:420:2: ( parameter_declaration ( ',' parameter_declaration )* )
+ # C.g:420:4: parameter_declaration ( ',' parameter_declaration )*
+ self.following.append(self.FOLLOW_parameter_declaration_in_macro_parameter_list1559)
+ self.parameter_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:420:26: ( ',' parameter_declaration )*
+ while True: #loop66
+ alt66 = 2
+ LA66_0 = self.input.LA(1)
+
+ if (LA66_0 == 27) :
+ alt66 = 1
+
+
+ if alt66 == 1:
+ # C.g:420:27: ',' parameter_declaration
+ self.match(self.input, 27, self.FOLLOW_27_in_macro_parameter_list1562)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_parameter_declaration_in_macro_parameter_list1564)
+ self.parameter_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop66
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 42, macro_parameter_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end macro_parameter_list
+
+
+ # $ANTLR start unary_operator
+ # C.g:423:1: unary_operator : ( '&' | '*' | '+' | '-' | '~' | '!' );
+ def unary_operator(self, ):
+
+ unary_operator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 43):
+ return
+
+ # C.g:424:2: ( '&' | '*' | '+' | '-' | '~' | '!' )
+ # C.g:
+ if self.input.LA(1) == 66 or (68 <= self.input.LA(1) <= 69) or (77 <= self.input.LA(1) <= 79):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_unary_operator0
+ )
+ raise mse
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 43, unary_operator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end unary_operator
+
+ class primary_expression_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start primary_expression
+ # C.g:432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );
+ def primary_expression(self, ):
+
+ retval = self.primary_expression_return()
+ retval.start = self.input.LT(1)
+ primary_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 44):
+ return retval
+
+ # C.g:433:2: ( IDENTIFIER | constant | '(' expression ')' )
+ alt67 = 3
+ LA67 = self.input.LA(1)
+ if LA67 == IDENTIFIER:
+ LA67_1 = self.input.LA(2)
+
+ if (LA67_1 == EOF or LA67_1 == 25 or (27 <= LA67_1 <= 28) or LA67_1 == 44 or LA67_1 == 47 or LA67_1 == 53 or (62 <= LA67_1 <= 66) or (68 <= LA67_1 <= 73) or (75 <= LA67_1 <= 77) or (80 <= LA67_1 <= 102)) :
+ alt67 = 1
+ elif (LA67_1 == IDENTIFIER or LA67_1 == STRING_LITERAL) :
+ alt67 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );", 67, 1, self.input)
+
+ raise nvae
+
+ elif LA67 == HEX_LITERAL or LA67 == OCTAL_LITERAL or LA67 == DECIMAL_LITERAL or LA67 == CHARACTER_LITERAL or LA67 == STRING_LITERAL or LA67 == FLOATING_POINT_LITERAL:
+ alt67 = 2
+ elif LA67 == 62:
+ alt67 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );", 67, 0, self.input)
+
+ raise nvae
+
+ if alt67 == 1:
+ # C.g:433:4: IDENTIFIER
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_primary_expression1613)
+ if self.failed:
+ return retval
+
+
+ elif alt67 == 2:
+ # C.g:434:4: constant
+ self.following.append(self.FOLLOW_constant_in_primary_expression1618)
+ self.constant()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ elif alt67 == 3:
+ # C.g:435:4: '(' expression ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_primary_expression1623)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_expression_in_primary_expression1625)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+ self.match(self.input, 63, self.FOLLOW_63_in_primary_expression1627)
+ if self.failed:
+ return retval
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 44, primary_expression_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end primary_expression
+
+
+ # $ANTLR start constant
+ # C.g:438:1: constant : ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL );
+ def constant(self, ):
+
+ constant_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 45):
+ return
+
+ # C.g:439:5: ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL )
+ alt72 = 6
+ LA72 = self.input.LA(1)
+ if LA72 == HEX_LITERAL:
+ alt72 = 1
+ elif LA72 == OCTAL_LITERAL:
+ alt72 = 2
+ elif LA72 == DECIMAL_LITERAL:
+ alt72 = 3
+ elif LA72 == CHARACTER_LITERAL:
+ alt72 = 4
+ elif LA72 == IDENTIFIER or LA72 == STRING_LITERAL:
+ alt72 = 5
+ elif LA72 == FLOATING_POINT_LITERAL:
+ alt72 = 6
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("438:1: constant : ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL );", 72, 0, self.input)
+
+ raise nvae
+
+ if alt72 == 1:
+ # C.g:439:9: HEX_LITERAL
+ self.match(self.input, HEX_LITERAL, self.FOLLOW_HEX_LITERAL_in_constant1643)
+ if self.failed:
+ return
+
+
+ elif alt72 == 2:
+ # C.g:440:9: OCTAL_LITERAL
+ self.match(self.input, OCTAL_LITERAL, self.FOLLOW_OCTAL_LITERAL_in_constant1653)
+ if self.failed:
+ return
+
+
+ elif alt72 == 3:
+ # C.g:441:9: DECIMAL_LITERAL
+ self.match(self.input, DECIMAL_LITERAL, self.FOLLOW_DECIMAL_LITERAL_in_constant1663)
+ if self.failed:
+ return
+
+
+ elif alt72 == 4:
+ # C.g:442:7: CHARACTER_LITERAL
+ self.match(self.input, CHARACTER_LITERAL, self.FOLLOW_CHARACTER_LITERAL_in_constant1671)
+ if self.failed:
+ return
+
+
+ elif alt72 == 5:
+ # C.g:443:7: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )*
+ # C.g:443:7: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+
+ cnt70 = 0
+ while True: #loop70
+ alt70 = 2
+ LA70_0 = self.input.LA(1)
+
+ if (LA70_0 == IDENTIFIER) :
+ LA70_1 = self.input.LA(2)
+
+ if (LA70_1 == STRING_LITERAL) :
+ alt70 = 1
+ elif (LA70_1 == IDENTIFIER) :
+ LA70_33 = self.input.LA(3)
+
+ if (self.synpred138()) :
+ alt70 = 1
+
+
+
+
+ elif (LA70_0 == STRING_LITERAL) :
+ alt70 = 1
+
+
+ if alt70 == 1:
+ # C.g:443:8: ( IDENTIFIER )* ( STRING_LITERAL )+
+ # C.g:443:8: ( IDENTIFIER )*
+ while True: #loop68
+ alt68 = 2
+ LA68_0 = self.input.LA(1)
+
+ if (LA68_0 == IDENTIFIER) :
+ alt68 = 1
+
+
+ if alt68 == 1:
+ # C.g:0:0: IDENTIFIER
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_constant1680)
+ if self.failed:
+ return
+
+
+ else:
+ break #loop68
+
+
+ # C.g:443:20: ( STRING_LITERAL )+
+ cnt69 = 0
+ while True: #loop69
+ alt69 = 2
+ LA69_0 = self.input.LA(1)
+
+ if (LA69_0 == STRING_LITERAL) :
+ LA69_31 = self.input.LA(2)
+
+ if (self.synpred137()) :
+ alt69 = 1
+
+
+
+
+ if alt69 == 1:
+ # C.g:0:0: STRING_LITERAL
+ self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_constant1683)
+ if self.failed:
+ return
+
+
+ else:
+ if cnt69 >= 1:
+ break #loop69
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(69, self.input)
+ raise eee
+
+ cnt69 += 1
+
+
+
+
+ else:
+ if cnt70 >= 1:
+ break #loop70
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(70, self.input)
+ raise eee
+
+ cnt70 += 1
+
+
+ # C.g:443:38: ( IDENTIFIER )*
+ while True: #loop71
+ alt71 = 2
+ LA71_0 = self.input.LA(1)
+
+ if (LA71_0 == IDENTIFIER) :
+ alt71 = 1
+
+
+ if alt71 == 1:
+ # C.g:0:0: IDENTIFIER
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_constant1688)
+ if self.failed:
+ return
+
+
+ else:
+ break #loop71
+
+
+
+
+ elif alt72 == 6:
+ # C.g:444:9: FLOATING_POINT_LITERAL
+ self.match(self.input, FLOATING_POINT_LITERAL, self.FOLLOW_FLOATING_POINT_LITERAL_in_constant1699)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 45, constant_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end constant
+
+ class expression_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start expression
+ # C.g:449:1: expression : assignment_expression ( ',' assignment_expression )* ;
+ def expression(self, ):
+
+ retval = self.expression_return()
+ retval.start = self.input.LT(1)
+ expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 46):
+ return retval
+
+ # C.g:450:2: ( assignment_expression ( ',' assignment_expression )* )
+ # C.g:450:4: assignment_expression ( ',' assignment_expression )*
+ self.following.append(self.FOLLOW_assignment_expression_in_expression1715)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:450:26: ( ',' assignment_expression )*
+ while True: #loop73
+ alt73 = 2
+ LA73_0 = self.input.LA(1)
+
+ if (LA73_0 == 27) :
+ alt73 = 1
+
+
+ if alt73 == 1:
+ # C.g:450:27: ',' assignment_expression
+ self.match(self.input, 27, self.FOLLOW_27_in_expression1718)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_assignment_expression_in_expression1720)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ else:
+ break #loop73
+
+
+
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 46, expression_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end expression
+
+
+ # $ANTLR start constant_expression
+ # C.g:453:1: constant_expression : conditional_expression ;
+ def constant_expression(self, ):
+
+ constant_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 47):
+ return
+
+ # C.g:454:2: ( conditional_expression )
+ # C.g:454:4: conditional_expression
+ self.following.append(self.FOLLOW_conditional_expression_in_constant_expression1733)
+ self.conditional_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 47, constant_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end constant_expression
+
+
+ # $ANTLR start assignment_expression
+ # C.g:457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );
+ def assignment_expression(self, ):
+
+ assignment_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 48):
+ return
+
+ # C.g:458:2: ( lvalue assignment_operator assignment_expression | conditional_expression )
+ alt74 = 2
+ LA74 = self.input.LA(1)
+ if LA74 == IDENTIFIER:
+ LA74 = self.input.LA(2)
+ if LA74 == 64:
+ LA74_13 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 13, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_14 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 14, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_15 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 15, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_16 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 16, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_17 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 17, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_18 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 18, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_19 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 19, self.input)
+
+ raise nvae
+
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ elif LA74 == STRING_LITERAL:
+ LA74_21 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 21, self.input)
+
+ raise nvae
+
+ elif LA74 == IDENTIFIER:
+ LA74_22 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 22, self.input)
+
+ raise nvae
+
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 1, self.input)
+
+ raise nvae
+
+ elif LA74 == HEX_LITERAL:
+ LA74 = self.input.LA(2)
+ if LA74 == 64:
+ LA74_44 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 44, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_45 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 45, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_46 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 46, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_47 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 47, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_48 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 48, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_49 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 49, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_50 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 50, self.input)
+
+ raise nvae
+
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 2, self.input)
+
+ raise nvae
+
+ elif LA74 == OCTAL_LITERAL:
+ LA74 = self.input.LA(2)
+ if LA74 == 64:
+ LA74_73 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 73, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_74 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 74, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_75 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 75, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_76 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 76, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_77 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 77, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_78 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 78, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_79 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 79, self.input)
+
+ raise nvae
+
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 3, self.input)
+
+ raise nvae
+
+ elif LA74 == DECIMAL_LITERAL:
+ LA74 = self.input.LA(2)
+ if LA74 == 64:
+ LA74_102 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 102, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_103 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 103, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_104 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 104, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_105 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 105, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_106 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 106, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_107 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 107, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_108 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 108, self.input)
+
+ raise nvae
+
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 4, self.input)
+
+ raise nvae
+
+ elif LA74 == CHARACTER_LITERAL:
+ LA74 = self.input.LA(2)
+ if LA74 == 64:
+ LA74_131 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 131, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_132 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 132, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_133 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 133, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_134 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 134, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_135 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 135, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_136 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 136, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_137 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 137, self.input)
+
+ raise nvae
+
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 5, self.input)
+
+ raise nvae
+
+ elif LA74 == STRING_LITERAL:
+ LA74 = self.input.LA(2)
+ if LA74 == IDENTIFIER:
+ LA74_160 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 160, self.input)
+
+ raise nvae
+
+ elif LA74 == 64:
+ LA74_161 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 161, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_162 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 162, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_163 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 163, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_164 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 164, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_165 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 165, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_166 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 166, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_167 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 167, self.input)
+
+ raise nvae
+
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ elif LA74 == STRING_LITERAL:
+ LA74_189 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 189, self.input)
+
+ raise nvae
+
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 6, self.input)
+
+ raise nvae
+
+ elif LA74 == FLOATING_POINT_LITERAL:
+ LA74 = self.input.LA(2)
+ if LA74 == 64:
+ LA74_191 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 191, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_192 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 192, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_193 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 193, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_194 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 194, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_195 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 195, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_196 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 196, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_197 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 197, self.input)
+
+ raise nvae
+
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 7, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74 = self.input.LA(2)
+ if LA74 == IDENTIFIER:
+ LA74_220 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 220, self.input)
+
+ raise nvae
+
+ elif LA74 == HEX_LITERAL:
+ LA74_221 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 221, self.input)
+
+ raise nvae
+
+ elif LA74 == OCTAL_LITERAL:
+ LA74_222 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 222, self.input)
+
+ raise nvae
+
+ elif LA74 == DECIMAL_LITERAL:
+ LA74_223 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 223, self.input)
+
+ raise nvae
+
+ elif LA74 == CHARACTER_LITERAL:
+ LA74_224 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 224, self.input)
+
+ raise nvae
+
+ elif LA74 == STRING_LITERAL:
+ LA74_225 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 225, self.input)
+
+ raise nvae
+
+ elif LA74 == FLOATING_POINT_LITERAL:
+ LA74_226 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 226, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_227 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 227, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_228 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 228, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_229 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 229, self.input)
+
+ raise nvae
+
+ elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79:
+ LA74_230 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 230, self.input)
+
+ raise nvae
+
+ elif LA74 == 74:
+ LA74_231 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 231, self.input)
+
+ raise nvae
+
+ elif LA74 == 34 or LA74 == 35 or LA74 == 36 or LA74 == 37 or LA74 == 38 or LA74 == 39 or LA74 == 40 or LA74 == 41 or LA74 == 42 or LA74 == 45 or LA74 == 46 or LA74 == 48 or LA74 == 49 or LA74 == 50 or LA74 == 51 or LA74 == 52 or LA74 == 53 or LA74 == 54 or LA74 == 55 or LA74 == 56 or LA74 == 57 or LA74 == 58 or LA74 == 59 or LA74 == 60 or LA74 == 61:
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 8, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74 = self.input.LA(2)
+ if LA74 == IDENTIFIER:
+ LA74_244 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 244, self.input)
+
+ raise nvae
+
+ elif LA74 == HEX_LITERAL:
+ LA74_245 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 245, self.input)
+
+ raise nvae
+
+ elif LA74 == OCTAL_LITERAL:
+ LA74_246 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 246, self.input)
+
+ raise nvae
+
+ elif LA74 == DECIMAL_LITERAL:
+ LA74_247 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 247, self.input)
+
+ raise nvae
+
+ elif LA74 == CHARACTER_LITERAL:
+ LA74_248 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 248, self.input)
+
+ raise nvae
+
+ elif LA74 == STRING_LITERAL:
+ LA74_249 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 249, self.input)
+
+ raise nvae
+
+ elif LA74 == FLOATING_POINT_LITERAL:
+ LA74_250 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 250, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_251 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 251, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_252 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 252, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_253 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 253, self.input)
+
+ raise nvae
+
+ elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79:
+ LA74_254 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 254, self.input)
+
+ raise nvae
+
+ elif LA74 == 74:
+ LA74_255 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 255, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 9, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74 = self.input.LA(2)
+ if LA74 == IDENTIFIER:
+ LA74_256 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 256, self.input)
+
+ raise nvae
+
+ elif LA74 == HEX_LITERAL:
+ LA74_257 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 257, self.input)
+
+ raise nvae
+
+ elif LA74 == OCTAL_LITERAL:
+ LA74_258 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 258, self.input)
+
+ raise nvae
+
+ elif LA74 == DECIMAL_LITERAL:
+ LA74_259 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 259, self.input)
+
+ raise nvae
+
+ elif LA74 == CHARACTER_LITERAL:
+ LA74_260 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 260, self.input)
+
+ raise nvae
+
+ elif LA74 == STRING_LITERAL:
+ LA74_261 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 261, self.input)
+
+ raise nvae
+
+ elif LA74 == FLOATING_POINT_LITERAL:
+ LA74_262 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 262, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_263 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 263, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_264 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 264, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_265 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 265, self.input)
+
+ raise nvae
+
+ elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79:
+ LA74_266 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 266, self.input)
+
+ raise nvae
+
+ elif LA74 == 74:
+ LA74_267 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 267, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 10, self.input)
+
+ raise nvae
+
+ elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79:
+ LA74 = self.input.LA(2)
+ if LA74 == 62:
+ LA74_268 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 268, self.input)
+
+ raise nvae
+
+ elif LA74 == IDENTIFIER:
+ LA74_269 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 269, self.input)
+
+ raise nvae
+
+ elif LA74 == HEX_LITERAL:
+ LA74_270 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 270, self.input)
+
+ raise nvae
+
+ elif LA74 == OCTAL_LITERAL:
+ LA74_271 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 271, self.input)
+
+ raise nvae
+
+ elif LA74 == DECIMAL_LITERAL:
+ LA74_272 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 272, self.input)
+
+ raise nvae
+
+ elif LA74 == CHARACTER_LITERAL:
+ LA74_273 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 273, self.input)
+
+ raise nvae
+
+ elif LA74 == STRING_LITERAL:
+ LA74_274 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 274, self.input)
+
+ raise nvae
+
+ elif LA74 == FLOATING_POINT_LITERAL:
+ LA74_275 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 275, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_276 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 276, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_277 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 277, self.input)
+
+ raise nvae
+
+ elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79:
+ LA74_278 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 278, self.input)
+
+ raise nvae
+
+ elif LA74 == 74:
+ LA74_279 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 279, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 11, self.input)
+
+ raise nvae
+
+ elif LA74 == 74:
+ LA74 = self.input.LA(2)
+ if LA74 == 62:
+ LA74_280 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 280, self.input)
+
+ raise nvae
+
+ elif LA74 == IDENTIFIER:
+ LA74_281 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 281, self.input)
+
+ raise nvae
+
+ elif LA74 == HEX_LITERAL:
+ LA74_282 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 282, self.input)
+
+ raise nvae
+
+ elif LA74 == OCTAL_LITERAL:
+ LA74_283 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 283, self.input)
+
+ raise nvae
+
+ elif LA74 == DECIMAL_LITERAL:
+ LA74_284 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 284, self.input)
+
+ raise nvae
+
+ elif LA74 == CHARACTER_LITERAL:
+ LA74_285 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 285, self.input)
+
+ raise nvae
+
+ elif LA74 == STRING_LITERAL:
+ LA74_286 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 286, self.input)
+
+ raise nvae
+
+ elif LA74 == FLOATING_POINT_LITERAL:
+ LA74_287 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 287, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_288 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 288, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_289 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 289, self.input)
+
+ raise nvae
+
+ elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79:
+ LA74_290 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 290, self.input)
+
+ raise nvae
+
+ elif LA74 == 74:
+ LA74_291 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 291, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 12, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 0, self.input)
+
+ raise nvae
+
+ if alt74 == 1:
+ # C.g:458:4: lvalue assignment_operator assignment_expression
+ self.following.append(self.FOLLOW_lvalue_in_assignment_expression1744)
+ self.lvalue()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_assignment_operator_in_assignment_expression1746)
+ self.assignment_operator()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_assignment_expression_in_assignment_expression1748)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt74 == 2:
+ # C.g:459:4: conditional_expression
+ self.following.append(self.FOLLOW_conditional_expression_in_assignment_expression1753)
+ self.conditional_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 48, assignment_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end assignment_expression
+
+
+ # $ANTLR start lvalue
+ # C.g:462:1: lvalue : unary_expression ;
+ def lvalue(self, ):
+
+ lvalue_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 49):
+ return
+
+ # C.g:463:2: ( unary_expression )
+ # C.g:463:4: unary_expression
+ self.following.append(self.FOLLOW_unary_expression_in_lvalue1765)
+ self.unary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 49, lvalue_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end lvalue
+
+
+ # $ANTLR start assignment_operator
+ # C.g:466:1: assignment_operator : ( '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' );
+ def assignment_operator(self, ):
+
+ assignment_operator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 50):
+ return
+
+ # C.g:467:2: ( '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' )
+ # C.g:
+ if self.input.LA(1) == 28 or (80 <= self.input.LA(1) <= 89):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_assignment_operator0
+ )
+ raise mse
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 50, assignment_operator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end assignment_operator
+
+
+ # $ANTLR start conditional_expression
+ # C.g:480:1: conditional_expression : e= logical_or_expression ( '?' expression ':' conditional_expression )? ;
+ def conditional_expression(self, ):
+
+ conditional_expression_StartIndex = self.input.index()
+ e = None
+
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 51):
+ return
+
+ # C.g:481:2: (e= logical_or_expression ( '?' expression ':' conditional_expression )? )
+ # C.g:481:4: e= logical_or_expression ( '?' expression ':' conditional_expression )?
+ self.following.append(self.FOLLOW_logical_or_expression_in_conditional_expression1839)
+ e = self.logical_or_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:481:28: ( '?' expression ':' conditional_expression )?
+ alt75 = 2
+ LA75_0 = self.input.LA(1)
+
+ if (LA75_0 == 90) :
+ alt75 = 1
+ if alt75 == 1:
+ # C.g:481:29: '?' expression ':' conditional_expression
+ self.match(self.input, 90, self.FOLLOW_90_in_conditional_expression1842)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_conditional_expression1844)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 47, self.FOLLOW_47_in_conditional_expression1846)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_conditional_expression_in_conditional_expression1848)
+ self.conditional_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start, e.stop))
+
+
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 51, conditional_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end conditional_expression
+
+ class logical_or_expression_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start logical_or_expression
+ # C.g:484:1: logical_or_expression : logical_and_expression ( '||' logical_and_expression )* ;
+ def logical_or_expression(self, ):
+
+ retval = self.logical_or_expression_return()
+ retval.start = self.input.LT(1)
+ logical_or_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 52):
+ return retval
+
+ # C.g:485:2: ( logical_and_expression ( '||' logical_and_expression )* )
+ # C.g:485:4: logical_and_expression ( '||' logical_and_expression )*
+ self.following.append(self.FOLLOW_logical_and_expression_in_logical_or_expression1863)
+ self.logical_and_expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:485:27: ( '||' logical_and_expression )*
+ while True: #loop76
+ alt76 = 2
+ LA76_0 = self.input.LA(1)
+
+ if (LA76_0 == 91) :
+ alt76 = 1
+
+
+ if alt76 == 1:
+ # C.g:485:28: '||' logical_and_expression
+ self.match(self.input, 91, self.FOLLOW_91_in_logical_or_expression1866)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_logical_and_expression_in_logical_or_expression1868)
+ self.logical_and_expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ else:
+ break #loop76
+
+
+
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 52, logical_or_expression_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end logical_or_expression
+
+
+ # $ANTLR start logical_and_expression
+ # C.g:488:1: logical_and_expression : inclusive_or_expression ( '&&' inclusive_or_expression )* ;
+ def logical_and_expression(self, ):
+
+ logical_and_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 53):
+ return
+
+ # C.g:489:2: ( inclusive_or_expression ( '&&' inclusive_or_expression )* )
+ # C.g:489:4: inclusive_or_expression ( '&&' inclusive_or_expression )*
+ self.following.append(self.FOLLOW_inclusive_or_expression_in_logical_and_expression1881)
+ self.inclusive_or_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:489:28: ( '&&' inclusive_or_expression )*
+ while True: #loop77
+ alt77 = 2
+ LA77_0 = self.input.LA(1)
+
+ if (LA77_0 == 92) :
+ alt77 = 1
+
+
+ if alt77 == 1:
+ # C.g:489:29: '&&' inclusive_or_expression
+ self.match(self.input, 92, self.FOLLOW_92_in_logical_and_expression1884)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_inclusive_or_expression_in_logical_and_expression1886)
+ self.inclusive_or_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop77
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 53, logical_and_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end logical_and_expression
+
+
+ # $ANTLR start inclusive_or_expression
+ # C.g:492:1: inclusive_or_expression : exclusive_or_expression ( '|' exclusive_or_expression )* ;
+ def inclusive_or_expression(self, ):
+
+ inclusive_or_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 54):
+ return
+
+ # C.g:493:2: ( exclusive_or_expression ( '|' exclusive_or_expression )* )
+ # C.g:493:4: exclusive_or_expression ( '|' exclusive_or_expression )*
+ self.following.append(self.FOLLOW_exclusive_or_expression_in_inclusive_or_expression1899)
+ self.exclusive_or_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:493:28: ( '|' exclusive_or_expression )*
+ while True: #loop78
+ alt78 = 2
+ LA78_0 = self.input.LA(1)
+
+ if (LA78_0 == 93) :
+ alt78 = 1
+
+
+ if alt78 == 1:
+ # C.g:493:29: '|' exclusive_or_expression
+ self.match(self.input, 93, self.FOLLOW_93_in_inclusive_or_expression1902)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_exclusive_or_expression_in_inclusive_or_expression1904)
+ self.exclusive_or_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop78
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 54, inclusive_or_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end inclusive_or_expression
+
+
+ # $ANTLR start exclusive_or_expression
+ # C.g:496:1: exclusive_or_expression : and_expression ( '^' and_expression )* ;
+ def exclusive_or_expression(self, ):
+
+ exclusive_or_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 55):
+ return
+
+ # C.g:497:2: ( and_expression ( '^' and_expression )* )
+ # C.g:497:4: and_expression ( '^' and_expression )*
+ self.following.append(self.FOLLOW_and_expression_in_exclusive_or_expression1917)
+ self.and_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:497:19: ( '^' and_expression )*
+ while True: #loop79
+ alt79 = 2
+ LA79_0 = self.input.LA(1)
+
+ if (LA79_0 == 94) :
+ alt79 = 1
+
+
+ if alt79 == 1:
+ # C.g:497:20: '^' and_expression
+ self.match(self.input, 94, self.FOLLOW_94_in_exclusive_or_expression1920)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_and_expression_in_exclusive_or_expression1922)
+ self.and_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop79
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 55, exclusive_or_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end exclusive_or_expression
+
+
+ # $ANTLR start and_expression
+ # C.g:500:1: and_expression : equality_expression ( '&' equality_expression )* ;
+ def and_expression(self, ):
+
+ and_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 56):
+ return
+
+ # C.g:501:2: ( equality_expression ( '&' equality_expression )* )
+ # C.g:501:4: equality_expression ( '&' equality_expression )*
+ self.following.append(self.FOLLOW_equality_expression_in_and_expression1935)
+ self.equality_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:501:24: ( '&' equality_expression )*
+ while True: #loop80
+ alt80 = 2
+ LA80_0 = self.input.LA(1)
+
+ if (LA80_0 == 77) :
+ alt80 = 1
+
+
+ if alt80 == 1:
+ # C.g:501:25: '&' equality_expression
+ self.match(self.input, 77, self.FOLLOW_77_in_and_expression1938)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_equality_expression_in_and_expression1940)
+ self.equality_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop80
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 56, and_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end and_expression
+
+
+ # $ANTLR start equality_expression
+ # C.g:503:1: equality_expression : relational_expression ( ( '==' | '!=' ) relational_expression )* ;
+ def equality_expression(self, ):
+
+ equality_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 57):
+ return
+
+ # C.g:504:2: ( relational_expression ( ( '==' | '!=' ) relational_expression )* )
+ # C.g:504:4: relational_expression ( ( '==' | '!=' ) relational_expression )*
+ self.following.append(self.FOLLOW_relational_expression_in_equality_expression1952)
+ self.relational_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:504:26: ( ( '==' | '!=' ) relational_expression )*
+ while True: #loop81
+ alt81 = 2
+ LA81_0 = self.input.LA(1)
+
+ if ((95 <= LA81_0 <= 96)) :
+ alt81 = 1
+
+
+ if alt81 == 1:
+ # C.g:504:27: ( '==' | '!=' ) relational_expression
+ if (95 <= self.input.LA(1) <= 96):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_equality_expression1955
+ )
+ raise mse
+
+
+ self.following.append(self.FOLLOW_relational_expression_in_equality_expression1961)
+ self.relational_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop81
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 57, equality_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end equality_expression
+
+
+ # $ANTLR start relational_expression
+ # C.g:507:1: relational_expression : shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* ;
+ def relational_expression(self, ):
+
+ relational_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 58):
+ return
+
+ # C.g:508:2: ( shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* )
+ # C.g:508:4: shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )*
+ self.following.append(self.FOLLOW_shift_expression_in_relational_expression1975)
+ self.shift_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:508:21: ( ( '<' | '>' | '<=' | '>=' ) shift_expression )*
+ while True: #loop82
+ alt82 = 2
+ LA82_0 = self.input.LA(1)
+
+ if ((97 <= LA82_0 <= 100)) :
+ alt82 = 1
+
+
+ if alt82 == 1:
+ # C.g:508:22: ( '<' | '>' | '<=' | '>=' ) shift_expression
+ if (97 <= self.input.LA(1) <= 100):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_relational_expression1978
+ )
+ raise mse
+
+
+ self.following.append(self.FOLLOW_shift_expression_in_relational_expression1988)
+ self.shift_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop82
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 58, relational_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end relational_expression
+
+
+ # $ANTLR start shift_expression
+ # C.g:511:1: shift_expression : additive_expression ( ( '<<' | '>>' ) additive_expression )* ;
+ def shift_expression(self, ):
+
+ shift_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 59):
+ return
+
+ # C.g:512:2: ( additive_expression ( ( '<<' | '>>' ) additive_expression )* )
+ # C.g:512:4: additive_expression ( ( '<<' | '>>' ) additive_expression )*
+ self.following.append(self.FOLLOW_additive_expression_in_shift_expression2001)
+ self.additive_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:512:24: ( ( '<<' | '>>' ) additive_expression )*
+ while True: #loop83
+ alt83 = 2
+ LA83_0 = self.input.LA(1)
+
+ if ((101 <= LA83_0 <= 102)) :
+ alt83 = 1
+
+
+ if alt83 == 1:
+ # C.g:512:25: ( '<<' | '>>' ) additive_expression
+ if (101 <= self.input.LA(1) <= 102):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_shift_expression2004
+ )
+ raise mse
+
+
+ self.following.append(self.FOLLOW_additive_expression_in_shift_expression2010)
+ self.additive_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop83
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 59, shift_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end shift_expression
+
+
+ # $ANTLR start statement
+ # C.g:517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );
+ def statement(self, ):
+
+ statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 60):
+ return
+
+ # C.g:518:2: ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration )
+ alt84 = 11
+ LA84 = self.input.LA(1)
+ if LA84 == IDENTIFIER:
+ LA84 = self.input.LA(2)
+ if LA84 == 62:
+ LA84_43 = self.input.LA(3)
+
+ if (self.synpred169()) :
+ alt84 = 3
+ elif (self.synpred173()) :
+ alt84 = 7
+ elif (self.synpred174()) :
+ alt84 = 8
+ elif (True) :
+ alt84 = 11
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 43, self.input)
+
+ raise nvae
+
+ elif LA84 == 47:
+ alt84 = 1
+ elif LA84 == STRING_LITERAL or LA84 == 27 or LA84 == 28 or LA84 == 64 or LA84 == 68 or LA84 == 69 or LA84 == 70 or LA84 == 71 or LA84 == 72 or LA84 == 73 or LA84 == 75 or LA84 == 76 or LA84 == 77 or LA84 == 80 or LA84 == 81 or LA84 == 82 or LA84 == 83 or LA84 == 84 or LA84 == 85 or LA84 == 86 or LA84 == 87 or LA84 == 88 or LA84 == 89 or LA84 == 90 or LA84 == 91 or LA84 == 92 or LA84 == 93 or LA84 == 94 or LA84 == 95 or LA84 == 96 or LA84 == 97 or LA84 == 98 or LA84 == 99 or LA84 == 100 or LA84 == 101 or LA84 == 102:
+ alt84 = 3
+ elif LA84 == 66:
+ LA84_47 = self.input.LA(3)
+
+ if (self.synpred169()) :
+ alt84 = 3
+ elif (True) :
+ alt84 = 11
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 47, self.input)
+
+ raise nvae
+
+ elif LA84 == IDENTIFIER:
+ LA84_53 = self.input.LA(3)
+
+ if (self.synpred169()) :
+ alt84 = 3
+ elif (True) :
+ alt84 = 11
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 53, self.input)
+
+ raise nvae
+
+ elif LA84 == 25:
+ LA84_68 = self.input.LA(3)
+
+ if (self.synpred169()) :
+ alt84 = 3
+ elif (True) :
+ alt84 = 11
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 68, self.input)
+
+ raise nvae
+
+ elif LA84 == 29 or LA84 == 30 or LA84 == 31 or LA84 == 32 or LA84 == 33 or LA84 == 34 or LA84 == 35 or LA84 == 36 or LA84 == 37 or LA84 == 38 or LA84 == 39 or LA84 == 40 or LA84 == 41 or LA84 == 42 or LA84 == 45 or LA84 == 46 or LA84 == 48 or LA84 == 49 or LA84 == 50 or LA84 == 51 or LA84 == 52 or LA84 == 53 or LA84 == 54 or LA84 == 55 or LA84 == 56 or LA84 == 57 or LA84 == 58 or LA84 == 59 or LA84 == 60 or LA84 == 61:
+ alt84 = 11
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 1, self.input)
+
+ raise nvae
+
+ elif LA84 == 106 or LA84 == 107:
+ alt84 = 1
+ elif LA84 == 43:
+ alt84 = 2
+ elif LA84 == HEX_LITERAL or LA84 == OCTAL_LITERAL or LA84 == DECIMAL_LITERAL or LA84 == CHARACTER_LITERAL or LA84 == STRING_LITERAL or LA84 == FLOATING_POINT_LITERAL or LA84 == 25 or LA84 == 62 or LA84 == 66 or LA84 == 68 or LA84 == 69 or LA84 == 72 or LA84 == 73 or LA84 == 74 or LA84 == 77 or LA84 == 78 or LA84 == 79:
+ alt84 = 3
+ elif LA84 == 108 or LA84 == 110:
+ alt84 = 4
+ elif LA84 == 111 or LA84 == 112 or LA84 == 113:
+ alt84 = 5
+ elif LA84 == 114 or LA84 == 115 or LA84 == 116 or LA84 == 117:
+ alt84 = 6
+ elif LA84 == 103:
+ alt84 = 8
+ elif LA84 == 104:
+ alt84 = 9
+ elif LA84 == 105:
+ alt84 = 10
+ elif LA84 == 26 or LA84 == 29 or LA84 == 30 or LA84 == 31 or LA84 == 32 or LA84 == 33 or LA84 == 34 or LA84 == 35 or LA84 == 36 or LA84 == 37 or LA84 == 38 or LA84 == 39 or LA84 == 40 or LA84 == 41 or LA84 == 42 or LA84 == 45 or LA84 == 46 or LA84 == 48 or LA84 == 49 or LA84 == 50 or LA84 == 51 or LA84 == 52 or LA84 == 53 or LA84 == 54 or LA84 == 55 or LA84 == 56 or LA84 == 57 or LA84 == 58 or LA84 == 59 or LA84 == 60 or LA84 == 61:
+ alt84 = 11
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 0, self.input)
+
+ raise nvae
+
+ if alt84 == 1:
+ # C.g:518:4: labeled_statement
+ self.following.append(self.FOLLOW_labeled_statement_in_statement2025)
+ self.labeled_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 2:
+ # C.g:519:4: compound_statement
+ self.following.append(self.FOLLOW_compound_statement_in_statement2030)
+ self.compound_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 3:
+ # C.g:520:4: expression_statement
+ self.following.append(self.FOLLOW_expression_statement_in_statement2035)
+ self.expression_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 4:
+ # C.g:521:4: selection_statement
+ self.following.append(self.FOLLOW_selection_statement_in_statement2040)
+ self.selection_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 5:
+ # C.g:522:4: iteration_statement
+ self.following.append(self.FOLLOW_iteration_statement_in_statement2045)
+ self.iteration_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 6:
+ # C.g:523:4: jump_statement
+ self.following.append(self.FOLLOW_jump_statement_in_statement2050)
+ self.jump_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 7:
+ # C.g:524:4: macro_statement
+ self.following.append(self.FOLLOW_macro_statement_in_statement2055)
+ self.macro_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 8:
+ # C.g:525:4: asm2_statement
+ self.following.append(self.FOLLOW_asm2_statement_in_statement2060)
+ self.asm2_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 9:
+ # C.g:526:4: asm1_statement
+ self.following.append(self.FOLLOW_asm1_statement_in_statement2065)
+ self.asm1_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 10:
+ # C.g:527:4: asm_statement
+ self.following.append(self.FOLLOW_asm_statement_in_statement2070)
+ self.asm_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 11:
+ # C.g:528:4: declaration
+ self.following.append(self.FOLLOW_declaration_in_statement2075)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 60, statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end statement
+
+
+ # $ANTLR start asm2_statement
+ # C.g:531:1: asm2_statement : ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' ;
+ def asm2_statement(self, ):
+
+ asm2_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 61):
+ return
+
+ # C.g:532:2: ( ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' )
+ # C.g:532:4: ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';'
+ # C.g:532:4: ( '__asm__' )?
+ alt85 = 2
+ LA85_0 = self.input.LA(1)
+
+ if (LA85_0 == 103) :
+ alt85 = 1
+ if alt85 == 1:
+ # C.g:0:0: '__asm__'
+ self.match(self.input, 103, self.FOLLOW_103_in_asm2_statement2086)
+ if self.failed:
+ return
+
+
+
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_asm2_statement2089)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_asm2_statement2091)
+ if self.failed:
+ return
+ # C.g:532:30: (~ ( ';' ) )*
+ while True: #loop86
+ alt86 = 2
+ LA86_0 = self.input.LA(1)
+
+ if (LA86_0 == 63) :
+ LA86_1 = self.input.LA(2)
+
+ if ((IDENTIFIER <= LA86_1 <= LINE_COMMAND) or (26 <= LA86_1 <= 117)) :
+ alt86 = 1
+
+
+ elif ((IDENTIFIER <= LA86_0 <= LINE_COMMAND) or (26 <= LA86_0 <= 62) or (64 <= LA86_0 <= 117)) :
+ alt86 = 1
+
+
+ if alt86 == 1:
+ # C.g:532:31: ~ ( ';' )
+ if (IDENTIFIER <= self.input.LA(1) <= LINE_COMMAND) or (26 <= self.input.LA(1) <= 117):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_asm2_statement2094
+ )
+ raise mse
+
+
+
+
+ else:
+ break #loop86
+
+
+ self.match(self.input, 63, self.FOLLOW_63_in_asm2_statement2101)
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_asm2_statement2103)
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 61, asm2_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end asm2_statement
+
+
+ # $ANTLR start asm1_statement
+ # C.g:535:1: asm1_statement : '_asm' '{' (~ ( '}' ) )* '}' ;
+ def asm1_statement(self, ):
+
+ asm1_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 62):
+ return
+
+ # C.g:536:2: ( '_asm' '{' (~ ( '}' ) )* '}' )
+ # C.g:536:4: '_asm' '{' (~ ( '}' ) )* '}'
+ self.match(self.input, 104, self.FOLLOW_104_in_asm1_statement2115)
+ if self.failed:
+ return
+ self.match(self.input, 43, self.FOLLOW_43_in_asm1_statement2117)
+ if self.failed:
+ return
+ # C.g:536:15: (~ ( '}' ) )*
+ while True: #loop87
+ alt87 = 2
+ LA87_0 = self.input.LA(1)
+
+ if ((IDENTIFIER <= LA87_0 <= 43) or (45 <= LA87_0 <= 117)) :
+ alt87 = 1
+
+
+ if alt87 == 1:
+ # C.g:536:16: ~ ( '}' )
+ if (IDENTIFIER <= self.input.LA(1) <= 43) or (45 <= self.input.LA(1) <= 117):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_asm1_statement2120
+ )
+ raise mse
+
+
+
+
+ else:
+ break #loop87
+
+
+ self.match(self.input, 44, self.FOLLOW_44_in_asm1_statement2127)
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 62, asm1_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end asm1_statement
+
+
+ # $ANTLR start asm_statement
+ # C.g:539:1: asm_statement : '__asm' '{' (~ ( '}' ) )* '}' ;
+ def asm_statement(self, ):
+
+ asm_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 63):
+ return
+
+ # C.g:540:2: ( '__asm' '{' (~ ( '}' ) )* '}' )
+ # C.g:540:4: '__asm' '{' (~ ( '}' ) )* '}'
+ self.match(self.input, 105, self.FOLLOW_105_in_asm_statement2138)
+ if self.failed:
+ return
+ self.match(self.input, 43, self.FOLLOW_43_in_asm_statement2140)
+ if self.failed:
+ return
+ # C.g:540:16: (~ ( '}' ) )*
+ while True: #loop88
+ alt88 = 2
+ LA88_0 = self.input.LA(1)
+
+ if ((IDENTIFIER <= LA88_0 <= 43) or (45 <= LA88_0 <= 117)) :
+ alt88 = 1
+
+
+ if alt88 == 1:
+ # C.g:540:17: ~ ( '}' )
+ if (IDENTIFIER <= self.input.LA(1) <= 43) or (45 <= self.input.LA(1) <= 117):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_asm_statement2143
+ )
+ raise mse
+
+
+
+
+ else:
+ break #loop88
+
+
+ self.match(self.input, 44, self.FOLLOW_44_in_asm_statement2150)
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 63, asm_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end asm_statement
+
+
+ # $ANTLR start macro_statement
+ # C.g:543:1: macro_statement : IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' ;
+ def macro_statement(self, ):
+
+ macro_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 64):
+ return
+
+ # C.g:544:2: ( IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' )
+ # C.g:544:4: IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')'
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_macro_statement2162)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_macro_statement2164)
+ if self.failed:
+ return
+ # C.g:544:19: ( declaration )*
+ while True: #loop89
+ alt89 = 2
+ LA89 = self.input.LA(1)
+ if LA89 == IDENTIFIER:
+ LA89 = self.input.LA(2)
+ if LA89 == 62:
+ LA89_45 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_47 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 66:
+ LA89_50 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_68 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_71 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_72 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_73 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_74 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_75 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_76 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_77 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_78 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_79 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_80 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_81 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_82 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_83 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_84 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_85 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_86 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 26:
+ LA89 = self.input.LA(2)
+ if LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_87 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_88 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_89 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_90 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_91 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_92 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_93 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_94 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_95 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_96 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_97 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_98 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_99 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_100 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 66:
+ LA89_101 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_102 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_103 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_104 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_105 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_106 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_107 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_108 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_109 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_110 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_111 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_112 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_113 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_114 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_115 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_116 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_117 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_118 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_119 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_120 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_121 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_122 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_123 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_124 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_125 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 34:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_126 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_127 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_128 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_129 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_130 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_131 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_132 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_133 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_134 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_135 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_136 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_137 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_138 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_139 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_140 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_141 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_142 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_143 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_144 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_145 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 35:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_146 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_147 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_148 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_149 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_150 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_151 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_152 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_153 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_154 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_155 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_156 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_157 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_158 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_159 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_160 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_161 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_162 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_163 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_164 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_165 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 36:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_166 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_167 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_168 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_169 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_170 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_171 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_172 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_173 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_174 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_175 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_176 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_177 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_178 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_179 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_180 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_181 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_182 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_183 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_184 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_185 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 37:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_186 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_187 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_188 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_189 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_190 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_191 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_192 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_193 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_194 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_195 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_196 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_197 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_198 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_199 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_200 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_201 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_202 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_203 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_204 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_205 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 38:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_206 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_207 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_208 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_209 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_210 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_211 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_212 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_213 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_214 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_215 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_216 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_217 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_218 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_219 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_220 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_221 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_222 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_223 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_224 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_225 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 39:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_226 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_227 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_228 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_229 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_230 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_231 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_232 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_233 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_234 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_235 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_236 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_237 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_238 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_239 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_240 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_241 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_242 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_243 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_244 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_245 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 40:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_246 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_247 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_248 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_249 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_250 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_251 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_252 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_253 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_254 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_255 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_256 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_257 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_258 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_259 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_260 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_261 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_262 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_263 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_264 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_265 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 41:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_266 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_267 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_268 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_269 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_270 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_271 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_272 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_273 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_274 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_275 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_276 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_277 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_278 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_279 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_280 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_281 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_282 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_283 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_284 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_285 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 42:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_286 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_287 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_288 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_289 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_290 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_291 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_292 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_293 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_294 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_295 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_296 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_297 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_298 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_299 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_300 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_301 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_302 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_303 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_304 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_305 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_40 = self.input.LA(2)
+
+ if (LA89_40 == IDENTIFIER) :
+ LA89_306 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif (LA89_40 == 43) :
+ LA89_307 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+
+ elif LA89 == 48:
+ LA89_41 = self.input.LA(2)
+
+ if (LA89_41 == 43) :
+ LA89_308 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif (LA89_41 == IDENTIFIER) :
+ LA89_309 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 58 or LA89 == 59 or LA89 == 60 or LA89 == 61:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_310 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_311 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_312 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_313 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_314 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_315 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_316 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_317 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_318 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_319 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_320 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_321 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_322 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_323 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_324 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_325 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_326 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_327 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_328 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_329 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+
+ if alt89 == 1:
+ # C.g:0:0: declaration
+ self.following.append(self.FOLLOW_declaration_in_macro_statement2166)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop89
+
+
+ # C.g:544:33: ( statement_list )?
+ alt90 = 2
+ LA90 = self.input.LA(1)
+ if LA90 == IDENTIFIER:
+ LA90 = self.input.LA(2)
+ if LA90 == 25 or LA90 == 29 or LA90 == 30 or LA90 == 31 or LA90 == 32 or LA90 == 33 or LA90 == 34 or LA90 == 35 or LA90 == 36 or LA90 == 37 or LA90 == 38 or LA90 == 39 or LA90 == 40 or LA90 == 41 or LA90 == 42 or LA90 == 45 or LA90 == 46 or LA90 == 47 or LA90 == 48 or LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61:
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_45 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_46 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == IDENTIFIER:
+ LA90_47 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 64:
+ LA90_48 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_49 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_50 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_51 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_52 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_53 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_54 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_55 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_56 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_57 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_58 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_59 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_60 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_61 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_62 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_63 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_64 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_65 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_66 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_67 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_70 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25 or LA90 == 26 or LA90 == 29 or LA90 == 30 or LA90 == 31 or LA90 == 32 or LA90 == 33 or LA90 == 34 or LA90 == 35 or LA90 == 36 or LA90 == 37 or LA90 == 38 or LA90 == 39 or LA90 == 40 or LA90 == 41 or LA90 == 42 or LA90 == 43 or LA90 == 45 or LA90 == 46 or LA90 == 48 or LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61 or LA90 == 103 or LA90 == 104 or LA90 == 105 or LA90 == 106 or LA90 == 107 or LA90 == 108 or LA90 == 110 or LA90 == 111 or LA90 == 112 or LA90 == 113 or LA90 == 114 or LA90 == 115 or LA90 == 116 or LA90 == 117:
+ alt90 = 1
+ elif LA90 == HEX_LITERAL:
+ LA90 = self.input.LA(2)
+ if LA90 == 64:
+ LA90_87 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_88 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_89 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_90 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_91 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_92 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_93 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_94 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_95 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_96 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_97 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_98 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_99 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_100 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_101 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_102 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_103 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_104 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_105 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_106 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_107 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_108 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25:
+ alt90 = 1
+ elif LA90 == OCTAL_LITERAL:
+ LA90 = self.input.LA(2)
+ if LA90 == 64:
+ LA90_111 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_112 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_113 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_114 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_115 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_116 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_117 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_118 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_119 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_120 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_121 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_122 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_123 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_124 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_125 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_126 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_127 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_128 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_129 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_130 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_131 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25:
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_134 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == DECIMAL_LITERAL:
+ LA90 = self.input.LA(2)
+ if LA90 == 64:
+ LA90_135 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_136 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_137 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_138 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_139 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_140 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_141 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_142 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_143 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_144 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_145 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_146 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_147 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_148 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_149 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_150 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_151 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_152 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_153 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_154 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_155 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_156 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25:
+ alt90 = 1
+ elif LA90 == CHARACTER_LITERAL:
+ LA90 = self.input.LA(2)
+ if LA90 == 64:
+ LA90_159 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_160 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_161 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_162 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_163 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_164 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_165 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_166 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_167 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_168 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_169 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_170 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_171 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_172 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_173 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_174 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_175 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_176 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_177 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_178 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_179 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25:
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_181 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90 = self.input.LA(2)
+ if LA90 == IDENTIFIER:
+ LA90_183 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 64:
+ LA90_184 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_185 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_186 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_187 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_188 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_189 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_190 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_191 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_192 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_193 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_194 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_195 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_196 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_197 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_198 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_199 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_200 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_201 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_202 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_203 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_204 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_205 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_206 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25:
+ alt90 = 1
+ elif LA90 == FLOATING_POINT_LITERAL:
+ LA90 = self.input.LA(2)
+ if LA90 == 64:
+ LA90_209 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_210 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_211 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_212 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_213 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_214 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_215 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_216 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_217 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_218 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_219 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_220 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_221 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_222 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_223 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_224 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_225 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_226 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_227 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_228 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_229 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_230 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25:
+ alt90 = 1
+ elif LA90 == 62:
+ LA90 = self.input.LA(2)
+ if LA90 == IDENTIFIER:
+ LA90_233 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == HEX_LITERAL:
+ LA90_234 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == OCTAL_LITERAL:
+ LA90_235 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == DECIMAL_LITERAL:
+ LA90_236 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == CHARACTER_LITERAL:
+ LA90_237 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_238 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == FLOATING_POINT_LITERAL:
+ LA90_239 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_240 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_241 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_242 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79:
+ LA90_243 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 74:
+ LA90_244 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61:
+ LA90_245 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 34:
+ LA90_246 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 35:
+ LA90_247 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 36:
+ LA90_248 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 37:
+ LA90_249 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 38:
+ LA90_250 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 39:
+ LA90_251 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 40:
+ LA90_252 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 41:
+ LA90_253 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 42:
+ LA90_254 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 45 or LA90 == 46:
+ LA90_255 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 48:
+ LA90_256 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90 = self.input.LA(2)
+ if LA90 == IDENTIFIER:
+ LA90_257 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == HEX_LITERAL:
+ LA90_258 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == OCTAL_LITERAL:
+ LA90_259 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == DECIMAL_LITERAL:
+ LA90_260 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == CHARACTER_LITERAL:
+ LA90_261 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_262 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == FLOATING_POINT_LITERAL:
+ LA90_263 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_264 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_265 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_266 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79:
+ LA90_267 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 74:
+ LA90_268 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90 = self.input.LA(2)
+ if LA90 == IDENTIFIER:
+ LA90_269 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == HEX_LITERAL:
+ LA90_270 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == OCTAL_LITERAL:
+ LA90_271 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == DECIMAL_LITERAL:
+ LA90_272 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == CHARACTER_LITERAL:
+ LA90_273 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_274 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == FLOATING_POINT_LITERAL:
+ LA90_275 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_276 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_277 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_278 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79:
+ LA90_279 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 74:
+ LA90_280 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79:
+ LA90 = self.input.LA(2)
+ if LA90 == 62:
+ LA90_281 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == IDENTIFIER:
+ LA90_282 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == HEX_LITERAL:
+ LA90_283 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == OCTAL_LITERAL:
+ LA90_284 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == DECIMAL_LITERAL:
+ LA90_285 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == CHARACTER_LITERAL:
+ LA90_286 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_287 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == FLOATING_POINT_LITERAL:
+ LA90_288 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_289 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_290 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79:
+ LA90_291 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 74:
+ LA90_292 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 74:
+ LA90 = self.input.LA(2)
+ if LA90 == 62:
+ LA90_293 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == IDENTIFIER:
+ LA90_294 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == HEX_LITERAL:
+ LA90_295 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == OCTAL_LITERAL:
+ LA90_296 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == DECIMAL_LITERAL:
+ LA90_297 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == CHARACTER_LITERAL:
+ LA90_298 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_299 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == FLOATING_POINT_LITERAL:
+ LA90_300 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_301 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_302 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79:
+ LA90_303 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 74:
+ LA90_304 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ if alt90 == 1:
+ # C.g:0:0: statement_list
+ self.following.append(self.FOLLOW_statement_list_in_macro_statement2170)
+ self.statement_list()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ # C.g:544:49: ( expression )?
+ alt91 = 2
+ LA91_0 = self.input.LA(1)
+
+ if ((IDENTIFIER <= LA91_0 <= FLOATING_POINT_LITERAL) or LA91_0 == 62 or LA91_0 == 66 or (68 <= LA91_0 <= 69) or (72 <= LA91_0 <= 74) or (77 <= LA91_0 <= 79)) :
+ alt91 = 1
+ if alt91 == 1:
+ # C.g:0:0: expression
+ self.following.append(self.FOLLOW_expression_in_macro_statement2173)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ self.match(self.input, 63, self.FOLLOW_63_in_macro_statement2176)
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 64, macro_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end macro_statement
+
+
+ # $ANTLR start labeled_statement
+ # C.g:547:1: labeled_statement : ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement );
+ def labeled_statement(self, ):
+
+ labeled_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 65):
+ return
+
+ # C.g:548:2: ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement )
+ alt92 = 3
+ LA92 = self.input.LA(1)
+ if LA92 == IDENTIFIER:
+ alt92 = 1
+ elif LA92 == 106:
+ alt92 = 2
+ elif LA92 == 107:
+ alt92 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("547:1: labeled_statement : ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement );", 92, 0, self.input)
+
+ raise nvae
+
+ if alt92 == 1:
+ # C.g:548:4: IDENTIFIER ':' statement
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_labeled_statement2188)
+ if self.failed:
+ return
+ self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2190)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_labeled_statement2192)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt92 == 2:
+ # C.g:549:4: 'case' constant_expression ':' statement
+ self.match(self.input, 106, self.FOLLOW_106_in_labeled_statement2197)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_constant_expression_in_labeled_statement2199)
+ self.constant_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2201)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_labeled_statement2203)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt92 == 3:
+ # C.g:550:4: 'default' ':' statement
+ self.match(self.input, 107, self.FOLLOW_107_in_labeled_statement2208)
+ if self.failed:
+ return
+ self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2210)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_labeled_statement2212)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 65, labeled_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end labeled_statement
+
+ class compound_statement_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start compound_statement
+ # C.g:553:1: compound_statement : '{' ( declaration )* ( statement_list )? '}' ;
+ def compound_statement(self, ):
+
+ retval = self.compound_statement_return()
+ retval.start = self.input.LT(1)
+ compound_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 66):
+ return retval
+
+ # C.g:554:2: ( '{' ( declaration )* ( statement_list )? '}' )
+ # C.g:554:4: '{' ( declaration )* ( statement_list )? '}'
+ self.match(self.input, 43, self.FOLLOW_43_in_compound_statement2223)
+ if self.failed:
+ return retval
+ # C.g:554:8: ( declaration )*
+ while True: #loop93
+ alt93 = 2
+ LA93 = self.input.LA(1)
+ if LA93 == IDENTIFIER:
+ LA93 = self.input.LA(2)
+ if LA93 == 62:
+ LA93_44 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_47 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 66:
+ LA93_48 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_49 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_50 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_51 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_52 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_53 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_54 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_55 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_56 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_57 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_58 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_59 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_60 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_61 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_62 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_63 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_64 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_65 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 26:
+ LA93 = self.input.LA(2)
+ if LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_86 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_87 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_88 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_89 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_90 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_91 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_92 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_93 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_94 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_95 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_96 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_97 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_98 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_99 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 66:
+ LA93_100 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_101 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_102 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_103 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_104 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_105 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_106 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_107 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_108 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_109 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_110 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_111 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_112 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_113 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_114 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_115 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_116 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_117 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_118 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_119 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_120 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_121 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_122 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_123 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_124 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 34:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_125 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_126 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_127 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_128 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_129 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_130 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_131 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_132 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_133 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_134 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_135 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_136 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_137 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_138 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_139 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_140 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_141 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_142 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_143 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_144 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 35:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_145 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_146 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_147 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_148 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_149 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_150 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_151 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_152 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_153 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_154 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_155 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_156 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_157 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_158 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_159 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_160 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_161 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_162 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_163 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_164 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 36:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_165 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_166 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_167 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_168 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_169 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_170 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_171 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_172 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_173 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_174 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_175 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_176 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_177 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_178 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_179 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_180 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_181 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_182 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_183 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_184 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 37:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_185 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_186 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_187 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_188 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_189 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_190 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_191 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_192 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_193 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_194 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_195 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_196 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_197 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_198 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_199 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_200 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_201 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_202 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_203 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_204 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 38:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_205 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_206 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_207 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_208 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_209 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_210 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_211 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_212 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_213 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_214 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_215 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_216 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_217 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_218 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_219 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_220 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_221 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_222 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_223 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_224 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 39:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_225 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_226 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_227 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_228 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_229 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_230 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_231 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_232 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_233 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_234 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_235 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_236 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_237 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_238 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_239 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_240 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_241 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_242 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_243 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_244 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 40:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_245 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_246 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_247 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_248 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_249 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_250 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_251 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_252 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_253 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_254 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_255 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_256 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_257 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_258 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_259 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_260 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_261 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_262 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_263 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_264 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 41:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_265 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_266 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_267 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_268 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_269 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_270 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_271 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_272 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_273 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_274 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_275 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_276 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_277 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_278 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_279 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_280 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_281 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_282 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_283 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_284 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 42:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_285 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_286 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_287 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_288 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_289 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_290 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_291 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_292 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_293 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_294 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_295 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_296 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_297 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_298 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_299 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_300 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_301 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_302 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_303 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_304 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_40 = self.input.LA(2)
+
+ if (LA93_40 == IDENTIFIER) :
+ LA93_305 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif (LA93_40 == 43) :
+ LA93_306 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+
+ elif LA93 == 48:
+ LA93_41 = self.input.LA(2)
+
+ if (LA93_41 == 43) :
+ LA93_307 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif (LA93_41 == IDENTIFIER) :
+ LA93_308 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 58 or LA93 == 59 or LA93 == 60 or LA93 == 61:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_309 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_310 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_311 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_312 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_313 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_314 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_315 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_316 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_317 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_318 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_319 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_320 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_321 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_322 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_323 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_324 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_325 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_326 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_327 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_328 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+
+ if alt93 == 1:
+ # C.g:0:0: declaration
+ self.following.append(self.FOLLOW_declaration_in_compound_statement2225)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ else:
+ break #loop93
+
+
+ # C.g:554:21: ( statement_list )?
+ alt94 = 2
+ LA94_0 = self.input.LA(1)
+
+ if ((IDENTIFIER <= LA94_0 <= FLOATING_POINT_LITERAL) or (25 <= LA94_0 <= 26) or (29 <= LA94_0 <= 43) or (45 <= LA94_0 <= 46) or (48 <= LA94_0 <= 62) or LA94_0 == 66 or (68 <= LA94_0 <= 69) or (72 <= LA94_0 <= 74) or (77 <= LA94_0 <= 79) or (103 <= LA94_0 <= 108) or (110 <= LA94_0 <= 117)) :
+ alt94 = 1
+ if alt94 == 1:
+ # C.g:0:0: statement_list
+ self.following.append(self.FOLLOW_statement_list_in_compound_statement2228)
+ self.statement_list()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+
+ self.match(self.input, 44, self.FOLLOW_44_in_compound_statement2231)
+ if self.failed:
+ return retval
+
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 66, compound_statement_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end compound_statement
+
+
+ # $ANTLR start statement_list
+ # C.g:557:1: statement_list : ( statement )+ ;
+ def statement_list(self, ):
+
+ statement_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 67):
+ return
+
+ # C.g:558:2: ( ( statement )+ )
+ # C.g:558:4: ( statement )+
+ # C.g:558:4: ( statement )+
+ cnt95 = 0
+ while True: #loop95
+ alt95 = 2
+ LA95 = self.input.LA(1)
+ if LA95 == IDENTIFIER:
+ LA95 = self.input.LA(2)
+ if LA95 == 62:
+ LA95_46 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25 or LA95 == 29 or LA95 == 30 or LA95 == 31 or LA95 == 32 or LA95 == 33 or LA95 == 34 or LA95 == 35 or LA95 == 36 or LA95 == 37 or LA95 == 38 or LA95 == 39 or LA95 == 40 or LA95 == 41 or LA95 == 42 or LA95 == 45 or LA95 == 46 or LA95 == 47 or LA95 == 48 or LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61:
+ alt95 = 1
+ elif LA95 == STRING_LITERAL:
+ LA95_48 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == IDENTIFIER:
+ LA95_49 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 64:
+ LA95_50 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_51 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_52 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_53 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_54 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_55 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_56 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_57 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_58 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_59 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_60 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_61 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_62 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_63 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_64 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_65 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_66 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_67 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_68 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_69 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_88 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == HEX_LITERAL:
+ LA95 = self.input.LA(2)
+ if LA95 == 64:
+ LA95_89 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_90 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_91 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_92 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_93 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_94 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_95 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_96 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_97 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_98 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_99 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_100 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_101 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_102 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_103 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_104 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_105 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_106 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_107 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_108 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_109 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_110 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25:
+ alt95 = 1
+
+ elif LA95 == OCTAL_LITERAL:
+ LA95 = self.input.LA(2)
+ if LA95 == 64:
+ LA95_113 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_114 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_115 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_116 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_117 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_118 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_119 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_120 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_121 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_122 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_123 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_124 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_125 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_126 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_127 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_128 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_129 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_130 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_131 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_132 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_133 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_135 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25:
+ alt95 = 1
+
+ elif LA95 == DECIMAL_LITERAL:
+ LA95 = self.input.LA(2)
+ if LA95 == 64:
+ LA95_137 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_138 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_139 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_140 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_141 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_142 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_143 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_144 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_145 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_146 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_147 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_148 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_149 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_150 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_151 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_152 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_153 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_154 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_155 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_156 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_157 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_158 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25:
+ alt95 = 1
+
+ elif LA95 == CHARACTER_LITERAL:
+ LA95 = self.input.LA(2)
+ if LA95 == 64:
+ LA95_161 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_162 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_163 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_164 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_165 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_166 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_167 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_168 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_169 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_170 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_171 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_172 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_173 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_174 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_175 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_176 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_177 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_178 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_179 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_180 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_181 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_182 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25:
+ alt95 = 1
+
+ elif LA95 == STRING_LITERAL:
+ LA95 = self.input.LA(2)
+ if LA95 == IDENTIFIER:
+ LA95_185 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 64:
+ LA95_186 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_187 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_188 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_189 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_190 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_191 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_192 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_193 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_194 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_195 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_196 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_197 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_198 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_199 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_200 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_201 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_202 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_203 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_204 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_205 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_206 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25:
+ alt95 = 1
+ elif LA95 == STRING_LITERAL:
+ LA95_208 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_209 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == FLOATING_POINT_LITERAL:
+ LA95 = self.input.LA(2)
+ if LA95 == 64:
+ LA95_211 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_212 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_213 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_214 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_215 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_216 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_217 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_218 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_219 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_220 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_221 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_222 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_223 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_224 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_225 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_226 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_227 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_228 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_229 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_230 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_231 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25:
+ alt95 = 1
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_234 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == 62:
+ LA95 = self.input.LA(2)
+ if LA95 == IDENTIFIER:
+ LA95_235 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == HEX_LITERAL:
+ LA95_236 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == OCTAL_LITERAL:
+ LA95_237 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == DECIMAL_LITERAL:
+ LA95_238 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == CHARACTER_LITERAL:
+ LA95_239 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == STRING_LITERAL:
+ LA95_240 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == FLOATING_POINT_LITERAL:
+ LA95_241 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_242 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_243 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_244 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79:
+ LA95_245 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 74:
+ LA95_246 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61:
+ LA95_247 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 34:
+ LA95_248 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 35:
+ LA95_249 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 36:
+ LA95_250 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 37:
+ LA95_251 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 38:
+ LA95_252 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 39:
+ LA95_253 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 40:
+ LA95_254 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 41:
+ LA95_255 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 42:
+ LA95_256 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 45 or LA95 == 46:
+ LA95_257 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 48:
+ LA95_258 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == 72:
+ LA95 = self.input.LA(2)
+ if LA95 == IDENTIFIER:
+ LA95_259 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == HEX_LITERAL:
+ LA95_260 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == OCTAL_LITERAL:
+ LA95_261 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == DECIMAL_LITERAL:
+ LA95_262 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == CHARACTER_LITERAL:
+ LA95_263 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == STRING_LITERAL:
+ LA95_264 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == FLOATING_POINT_LITERAL:
+ LA95_265 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_266 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_267 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_268 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79:
+ LA95_269 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 74:
+ LA95_270 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == 73:
+ LA95 = self.input.LA(2)
+ if LA95 == IDENTIFIER:
+ LA95_271 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == HEX_LITERAL:
+ LA95_272 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == OCTAL_LITERAL:
+ LA95_273 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == DECIMAL_LITERAL:
+ LA95_274 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == CHARACTER_LITERAL:
+ LA95_275 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == STRING_LITERAL:
+ LA95_276 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == FLOATING_POINT_LITERAL:
+ LA95_277 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_278 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_279 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_280 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79:
+ LA95_281 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 74:
+ LA95_282 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79:
+ LA95 = self.input.LA(2)
+ if LA95 == 62:
+ LA95_283 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == IDENTIFIER:
+ LA95_284 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == HEX_LITERAL:
+ LA95_285 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == OCTAL_LITERAL:
+ LA95_286 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == DECIMAL_LITERAL:
+ LA95_287 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == CHARACTER_LITERAL:
+ LA95_288 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == STRING_LITERAL:
+ LA95_289 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == FLOATING_POINT_LITERAL:
+ LA95_290 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_291 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_292 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79:
+ LA95_293 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 74:
+ LA95_294 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == 74:
+ LA95 = self.input.LA(2)
+ if LA95 == 62:
+ LA95_295 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == IDENTIFIER:
+ LA95_296 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == HEX_LITERAL:
+ LA95_297 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == OCTAL_LITERAL:
+ LA95_298 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == DECIMAL_LITERAL:
+ LA95_299 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == CHARACTER_LITERAL:
+ LA95_300 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == STRING_LITERAL:
+ LA95_301 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == FLOATING_POINT_LITERAL:
+ LA95_302 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_303 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_304 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79:
+ LA95_305 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 74:
+ LA95_306 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == 25 or LA95 == 26 or LA95 == 29 or LA95 == 30 or LA95 == 31 or LA95 == 32 or LA95 == 33 or LA95 == 34 or LA95 == 35 or LA95 == 36 or LA95 == 37 or LA95 == 38 or LA95 == 39 or LA95 == 40 or LA95 == 41 or LA95 == 42 or LA95 == 43 or LA95 == 45 or LA95 == 46 or LA95 == 48 or LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61 or LA95 == 103 or LA95 == 104 or LA95 == 105 or LA95 == 106 or LA95 == 107 or LA95 == 108 or LA95 == 110 or LA95 == 111 or LA95 == 112 or LA95 == 113 or LA95 == 114 or LA95 == 115 or LA95 == 116 or LA95 == 117:
+ alt95 = 1
+
+ if alt95 == 1:
+ # C.g:0:0: statement
+ self.following.append(self.FOLLOW_statement_in_statement_list2242)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ if cnt95 >= 1:
+ break #loop95
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(95, self.input)
+ raise eee
+
+ cnt95 += 1
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 67, statement_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end statement_list
+
+ class expression_statement_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start expression_statement
+ # C.g:561:1: expression_statement : ( ';' | expression ';' );
+ def expression_statement(self, ):
+
+ retval = self.expression_statement_return()
+ retval.start = self.input.LT(1)
+ expression_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 68):
+ return retval
+
+ # C.g:562:2: ( ';' | expression ';' )
+ alt96 = 2
+ LA96_0 = self.input.LA(1)
+
+ if (LA96_0 == 25) :
+ alt96 = 1
+ elif ((IDENTIFIER <= LA96_0 <= FLOATING_POINT_LITERAL) or LA96_0 == 62 or LA96_0 == 66 or (68 <= LA96_0 <= 69) or (72 <= LA96_0 <= 74) or (77 <= LA96_0 <= 79)) :
+ alt96 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("561:1: expression_statement : ( ';' | expression ';' );", 96, 0, self.input)
+
+ raise nvae
+
+ if alt96 == 1:
+ # C.g:562:4: ';'
+ self.match(self.input, 25, self.FOLLOW_25_in_expression_statement2254)
+ if self.failed:
+ return retval
+
+
+ elif alt96 == 2:
+ # C.g:563:4: expression ';'
+ self.following.append(self.FOLLOW_expression_in_expression_statement2259)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+ self.match(self.input, 25, self.FOLLOW_25_in_expression_statement2261)
+ if self.failed:
+ return retval
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 68, expression_statement_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end expression_statement
+
+
+ # $ANTLR start selection_statement
+ # C.g:566:1: selection_statement : ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement );
+ def selection_statement(self, ):
+
+ selection_statement_StartIndex = self.input.index()
+ e = None
+
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 69):
+ return
+
+ # C.g:567:2: ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement )
+ alt98 = 2
+ LA98_0 = self.input.LA(1)
+
+ if (LA98_0 == 108) :
+ alt98 = 1
+ elif (LA98_0 == 110) :
+ alt98 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("566:1: selection_statement : ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement );", 98, 0, self.input)
+
+ raise nvae
+
+ if alt98 == 1:
+ # C.g:567:4: 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )?
+ self.match(self.input, 108, self.FOLLOW_108_in_selection_statement2272)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_selection_statement2274)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_selection_statement2278)
+ e = self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_selection_statement2280)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start, e.stop))
+
+ self.following.append(self.FOLLOW_statement_in_selection_statement2284)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:567:167: ( options {k=1; backtrack=false; } : 'else' statement )?
+ alt97 = 2
+ LA97_0 = self.input.LA(1)
+
+ if (LA97_0 == 109) :
+ alt97 = 1
+ if alt97 == 1:
+ # C.g:567:200: 'else' statement
+ self.match(self.input, 109, self.FOLLOW_109_in_selection_statement2299)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_selection_statement2301)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ elif alt98 == 2:
+ # C.g:568:4: 'switch' '(' expression ')' statement
+ self.match(self.input, 110, self.FOLLOW_110_in_selection_statement2308)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_selection_statement2310)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_selection_statement2312)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_selection_statement2314)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_selection_statement2316)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 69, selection_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end selection_statement
+
+
+ # $ANTLR start iteration_statement
+ # C.g:571:1: iteration_statement : ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement );
+ def iteration_statement(self, ):
+
+ iteration_statement_StartIndex = self.input.index()
+ e = None
+
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 70):
+ return
+
+ # C.g:572:2: ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement )
+ alt100 = 3
+ LA100 = self.input.LA(1)
+ if LA100 == 111:
+ alt100 = 1
+ elif LA100 == 112:
+ alt100 = 2
+ elif LA100 == 113:
+ alt100 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("571:1: iteration_statement : ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement );", 100, 0, self.input)
+
+ raise nvae
+
+ if alt100 == 1:
+ # C.g:572:4: 'while' '(' e= expression ')' statement
+ self.match(self.input, 111, self.FOLLOW_111_in_iteration_statement2327)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2329)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_iteration_statement2333)
+ e = self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2335)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_iteration_statement2337)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start, e.stop))
+
+
+
+ elif alt100 == 2:
+ # C.g:573:4: 'do' statement 'while' '(' e= expression ')' ';'
+ self.match(self.input, 112, self.FOLLOW_112_in_iteration_statement2344)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_iteration_statement2346)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 111, self.FOLLOW_111_in_iteration_statement2348)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2350)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_iteration_statement2354)
+ e = self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2356)
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_iteration_statement2358)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start, e.stop))
+
+
+
+ elif alt100 == 3:
+ # C.g:574:4: 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement
+ self.match(self.input, 113, self.FOLLOW_113_in_iteration_statement2365)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2367)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_statement_in_iteration_statement2369)
+ self.expression_statement()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_statement_in_iteration_statement2373)
+ e = self.expression_statement()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:574:58: ( expression )?
+ alt99 = 2
+ LA99_0 = self.input.LA(1)
+
+ if ((IDENTIFIER <= LA99_0 <= FLOATING_POINT_LITERAL) or LA99_0 == 62 or LA99_0 == 66 or (68 <= LA99_0 <= 69) or (72 <= LA99_0 <= 74) or (77 <= LA99_0 <= 79)) :
+ alt99 = 1
+ if alt99 == 1:
+ # C.g:0:0: expression
+ self.following.append(self.FOLLOW_expression_in_iteration_statement2375)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2378)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_iteration_statement2380)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start, e.stop))
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 70, iteration_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end iteration_statement
+
+
+ # $ANTLR start jump_statement
+ # C.g:577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );
+ def jump_statement(self, ):
+
+ jump_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 71):
+ return
+
+ # C.g:578:2: ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' )
+ alt101 = 5
+ LA101 = self.input.LA(1)
+ if LA101 == 114:
+ alt101 = 1
+ elif LA101 == 115:
+ alt101 = 2
+ elif LA101 == 116:
+ alt101 = 3
+ elif LA101 == 117:
+ LA101_4 = self.input.LA(2)
+
+ if (LA101_4 == 25) :
+ alt101 = 4
+ elif ((IDENTIFIER <= LA101_4 <= FLOATING_POINT_LITERAL) or LA101_4 == 62 or LA101_4 == 66 or (68 <= LA101_4 <= 69) or (72 <= LA101_4 <= 74) or (77 <= LA101_4 <= 79)) :
+ alt101 = 5
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );", 101, 4, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );", 101, 0, self.input)
+
+ raise nvae
+
+ if alt101 == 1:
+ # C.g:578:4: 'goto' IDENTIFIER ';'
+ self.match(self.input, 114, self.FOLLOW_114_in_jump_statement2393)
+ if self.failed:
+ return
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_jump_statement2395)
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2397)
+ if self.failed:
+ return
+
+
+ elif alt101 == 2:
+ # C.g:579:4: 'continue' ';'
+ self.match(self.input, 115, self.FOLLOW_115_in_jump_statement2402)
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2404)
+ if self.failed:
+ return
+
+
+ elif alt101 == 3:
+ # C.g:580:4: 'break' ';'
+ self.match(self.input, 116, self.FOLLOW_116_in_jump_statement2409)
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2411)
+ if self.failed:
+ return
+
+
+ elif alt101 == 4:
+ # C.g:581:4: 'return' ';'
+ self.match(self.input, 117, self.FOLLOW_117_in_jump_statement2416)
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2418)
+ if self.failed:
+ return
+
+
+ elif alt101 == 5:
+ # C.g:582:4: 'return' expression ';'
+ self.match(self.input, 117, self.FOLLOW_117_in_jump_statement2423)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_jump_statement2425)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2427)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 71, jump_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end jump_statement
+
+ # $ANTLR start synpred2
+ def synpred2_fragment(self, ):
+ # C.g:119:6: ( declaration_specifiers )
+ # C.g:119:6: declaration_specifiers
+ self.following.append(self.FOLLOW_declaration_specifiers_in_synpred2100)
+ self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred2
+
+
+
+ # $ANTLR start synpred4
+ def synpred4_fragment(self, ):
+ # C.g:119:4: ( ( declaration_specifiers )? declarator ( declaration )* '{' )
+ # C.g:119:6: ( declaration_specifiers )? declarator ( declaration )* '{'
+ # C.g:119:6: ( declaration_specifiers )?
+ alt102 = 2
+ LA102 = self.input.LA(1)
+ if LA102 == 29 or LA102 == 30 or LA102 == 31 or LA102 == 32 or LA102 == 33 or LA102 == 34 or LA102 == 35 or LA102 == 36 or LA102 == 37 or LA102 == 38 or LA102 == 39 or LA102 == 40 or LA102 == 41 or LA102 == 42 or LA102 == 45 or LA102 == 46 or LA102 == 48 or LA102 == 49 or LA102 == 50 or LA102 == 51 or LA102 == 52 or LA102 == 53 or LA102 == 54 or LA102 == 55 or LA102 == 56 or LA102 == 57 or LA102 == 61:
+ alt102 = 1
+ elif LA102 == IDENTIFIER:
+ LA102 = self.input.LA(2)
+ if LA102 == 62:
+ LA102_21 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 29 or LA102 == 30 or LA102 == 31 or LA102 == 32 or LA102 == 33:
+ LA102_23 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 34:
+ LA102_24 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 35:
+ LA102_25 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 36:
+ LA102_26 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 37:
+ LA102_27 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 38:
+ LA102_28 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 39:
+ LA102_29 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 40:
+ LA102_30 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 41:
+ LA102_31 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 42:
+ LA102_32 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 45 or LA102 == 46:
+ LA102_33 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 48:
+ LA102_34 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == IDENTIFIER:
+ LA102_35 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 58:
+ LA102_36 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 66:
+ alt102 = 1
+ elif LA102 == 59:
+ LA102_39 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 60:
+ LA102_40 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 49 or LA102 == 50 or LA102 == 51 or LA102 == 52 or LA102 == 53 or LA102 == 54 or LA102 == 55 or LA102 == 56 or LA102 == 57 or LA102 == 61:
+ LA102_41 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 58:
+ LA102_14 = self.input.LA(2)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 59:
+ LA102_16 = self.input.LA(2)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 60:
+ LA102_17 = self.input.LA(2)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ if alt102 == 1:
+ # C.g:0:0: declaration_specifiers
+ self.following.append(self.FOLLOW_declaration_specifiers_in_synpred4100)
+ self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ self.following.append(self.FOLLOW_declarator_in_synpred4103)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:119:41: ( declaration )*
+ while True: #loop103
+ alt103 = 2
+ LA103_0 = self.input.LA(1)
+
+ if (LA103_0 == IDENTIFIER or LA103_0 == 26 or (29 <= LA103_0 <= 42) or (45 <= LA103_0 <= 46) or (48 <= LA103_0 <= 61)) :
+ alt103 = 1
+
+
+ if alt103 == 1:
+ # C.g:0:0: declaration
+ self.following.append(self.FOLLOW_declaration_in_synpred4105)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop103
+
+
+ self.match(self.input, 43, self.FOLLOW_43_in_synpred4108)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred4
+
+
+
+ # $ANTLR start synpred5
+ def synpred5_fragment(self, ):
+ # C.g:120:4: ( declaration )
+ # C.g:120:4: declaration
+ self.following.append(self.FOLLOW_declaration_in_synpred5118)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred5
+
+
+
+ # $ANTLR start synpred7
+ def synpred7_fragment(self, ):
+ # C.g:146:6: ( declaration_specifiers )
+ # C.g:146:6: declaration_specifiers
+ self.following.append(self.FOLLOW_declaration_specifiers_in_synpred7157)
+ self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred7
+
+
+
+ # $ANTLR start synpred10
+ def synpred10_fragment(self, ):
+ # C.g:167:18: ( declaration_specifiers )
+ # C.g:167:18: declaration_specifiers
+ self.following.append(self.FOLLOW_declaration_specifiers_in_synpred10207)
+ self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred10
+
+
+
+ # $ANTLR start synpred14
+ def synpred14_fragment(self, ):
+ # C.g:184:7: ( type_specifier )
+ # C.g:184:7: type_specifier
+ self.following.append(self.FOLLOW_type_specifier_in_synpred14272)
+ self.type_specifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred14
+
+
+
+ # $ANTLR start synpred15
+ def synpred15_fragment(self, ):
+ # C.g:185:13: ( type_qualifier )
+ # C.g:185:13: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_synpred15286)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred15
+
+
+
+ # $ANTLR start synpred33
+ def synpred33_fragment(self, ):
+ # C.g:225:16: ( type_qualifier )
+ # C.g:225:16: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_synpred33444)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred33
+
+
+
+ # $ANTLR start synpred34
+ def synpred34_fragment(self, ):
+ # C.g:225:4: ( IDENTIFIER ( type_qualifier )* declarator )
+ # C.g:225:5: IDENTIFIER ( type_qualifier )* declarator
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred34442)
+ if self.failed:
+ return
+ # C.g:225:16: ( type_qualifier )*
+ while True: #loop106
+ alt106 = 2
+ LA106 = self.input.LA(1)
+ if LA106 == 58:
+ LA106_2 = self.input.LA(2)
+
+ if (self.synpred33()) :
+ alt106 = 1
+
+
+ elif LA106 == 59:
+ LA106_3 = self.input.LA(2)
+
+ if (self.synpred33()) :
+ alt106 = 1
+
+
+ elif LA106 == 60:
+ LA106_4 = self.input.LA(2)
+
+ if (self.synpred33()) :
+ alt106 = 1
+
+
+ elif LA106 == 49 or LA106 == 50 or LA106 == 51 or LA106 == 52 or LA106 == 53 or LA106 == 54 or LA106 == 55 or LA106 == 56 or LA106 == 57 or LA106 == 61:
+ alt106 = 1
+
+ if alt106 == 1:
+ # C.g:0:0: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_synpred34444)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop106
+
+
+ self.following.append(self.FOLLOW_declarator_in_synpred34447)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred34
+
+
+
+ # $ANTLR start synpred39
+ def synpred39_fragment(self, ):
+ # C.g:253:6: ( type_qualifier )
+ # C.g:253:6: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_synpred39566)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred39
+
+
+
+ # $ANTLR start synpred40
+ def synpred40_fragment(self, ):
+ # C.g:253:23: ( type_specifier )
+ # C.g:253:23: type_specifier
+ self.following.append(self.FOLLOW_type_specifier_in_synpred40570)
+ self.type_specifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred40
+
+
+
+ # $ANTLR start synpred66
+ def synpred66_fragment(self, ):
+ # C.g:297:4: ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator )
+ # C.g:297:4: ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator
+ # C.g:297:4: ( pointer )?
+ alt111 = 2
+ LA111_0 = self.input.LA(1)
+
+ if (LA111_0 == 66) :
+ alt111 = 1
+ if alt111 == 1:
+ # C.g:0:0: pointer
+ self.following.append(self.FOLLOW_pointer_in_synpred66784)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ # C.g:297:13: ( 'EFIAPI' )?
+ alt112 = 2
+ LA112_0 = self.input.LA(1)
+
+ if (LA112_0 == 58) :
+ alt112 = 1
+ if alt112 == 1:
+ # C.g:297:14: 'EFIAPI'
+ self.match(self.input, 58, self.FOLLOW_58_in_synpred66788)
+ if self.failed:
+ return
+
+
+
+ # C.g:297:25: ( 'EFI_BOOTSERVICE' )?
+ alt113 = 2
+ LA113_0 = self.input.LA(1)
+
+ if (LA113_0 == 59) :
+ alt113 = 1
+ if alt113 == 1:
+ # C.g:297:26: 'EFI_BOOTSERVICE'
+ self.match(self.input, 59, self.FOLLOW_59_in_synpred66793)
+ if self.failed:
+ return
+
+
+
+ # C.g:297:46: ( 'EFI_RUNTIMESERVICE' )?
+ alt114 = 2
+ LA114_0 = self.input.LA(1)
+
+ if (LA114_0 == 60) :
+ alt114 = 1
+ if alt114 == 1:
+ # C.g:297:47: 'EFI_RUNTIMESERVICE'
+ self.match(self.input, 60, self.FOLLOW_60_in_synpred66798)
+ if self.failed:
+ return
+
+
+
+ self.following.append(self.FOLLOW_direct_declarator_in_synpred66802)
+ self.direct_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred66
+
+
+
+ # $ANTLR start synpred67
+ def synpred67_fragment(self, ):
+ # C.g:303:15: ( declarator_suffix )
+ # C.g:303:15: declarator_suffix
+ self.following.append(self.FOLLOW_declarator_suffix_in_synpred67821)
+ self.declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred67
+
+
+
+ # $ANTLR start synpred69
+ def synpred69_fragment(self, ):
+ # C.g:304:9: ( 'EFIAPI' )
+ # C.g:304:9: 'EFIAPI'
+ self.match(self.input, 58, self.FOLLOW_58_in_synpred69830)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred69
+
+
+
+ # $ANTLR start synpred70
+ def synpred70_fragment(self, ):
+ # C.g:304:35: ( declarator_suffix )
+ # C.g:304:35: declarator_suffix
+ self.following.append(self.FOLLOW_declarator_suffix_in_synpred70838)
+ self.declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred70
+
+
+
+ # $ANTLR start synpred73
+ def synpred73_fragment(self, ):
+ # C.g:310:9: ( '(' parameter_type_list ')' )
+ # C.g:310:9: '(' parameter_type_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_synpred73878)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_parameter_type_list_in_synpred73880)
+ self.parameter_type_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_synpred73882)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred73
+
+
+
+ # $ANTLR start synpred74
+ def synpred74_fragment(self, ):
+ # C.g:311:9: ( '(' identifier_list ')' )
+ # C.g:311:9: '(' identifier_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_synpred74892)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_identifier_list_in_synpred74894)
+ self.identifier_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_synpred74896)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred74
+
+
+
+ # $ANTLR start synpred75
+ def synpred75_fragment(self, ):
+ # C.g:316:8: ( type_qualifier )
+ # C.g:316:8: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_synpred75921)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred75
+
+
+
+ # $ANTLR start synpred76
+ def synpred76_fragment(self, ):
+ # C.g:316:24: ( pointer )
+ # C.g:316:24: pointer
+ self.following.append(self.FOLLOW_pointer_in_synpred76924)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred76
+
+
+
+ # $ANTLR start synpred77
+ def synpred77_fragment(self, ):
+ # C.g:316:4: ( '*' ( type_qualifier )+ ( pointer )? )
+ # C.g:316:4: '*' ( type_qualifier )+ ( pointer )?
+ self.match(self.input, 66, self.FOLLOW_66_in_synpred77919)
+ if self.failed:
+ return
+ # C.g:316:8: ( type_qualifier )+
+ cnt116 = 0
+ while True: #loop116
+ alt116 = 2
+ LA116_0 = self.input.LA(1)
+
+ if ((49 <= LA116_0 <= 61)) :
+ alt116 = 1
+
+
+ if alt116 == 1:
+ # C.g:0:0: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_synpred77921)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ if cnt116 >= 1:
+ break #loop116
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(116, self.input)
+ raise eee
+
+ cnt116 += 1
+
+
+ # C.g:316:24: ( pointer )?
+ alt117 = 2
+ LA117_0 = self.input.LA(1)
+
+ if (LA117_0 == 66) :
+ alt117 = 1
+ if alt117 == 1:
+ # C.g:0:0: pointer
+ self.following.append(self.FOLLOW_pointer_in_synpred77924)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ # $ANTLR end synpred77
+
+
+
+ # $ANTLR start synpred78
+ def synpred78_fragment(self, ):
+ # C.g:317:4: ( '*' pointer )
+ # C.g:317:4: '*' pointer
+ self.match(self.input, 66, self.FOLLOW_66_in_synpred78930)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_pointer_in_synpred78932)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred78
+
+
+
+ # $ANTLR start synpred81
+ def synpred81_fragment(self, ):
+ # C.g:326:32: ( 'OPTIONAL' )
+ # C.g:326:32: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_synpred81977)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred81
+
+
+
+ # $ANTLR start synpred82
+ def synpred82_fragment(self, ):
+ # C.g:326:27: ( ',' ( 'OPTIONAL' )? parameter_declaration )
+ # C.g:326:27: ',' ( 'OPTIONAL' )? parameter_declaration
+ self.match(self.input, 27, self.FOLLOW_27_in_synpred82974)
+ if self.failed:
+ return
+ # C.g:326:31: ( 'OPTIONAL' )?
+ alt119 = 2
+ LA119_0 = self.input.LA(1)
+
+ if (LA119_0 == 53) :
+ LA119_1 = self.input.LA(2)
+
+ if (self.synpred81()) :
+ alt119 = 1
+ if alt119 == 1:
+ # C.g:326:32: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_synpred82977)
+ if self.failed:
+ return
+
+
+
+ self.following.append(self.FOLLOW_parameter_declaration_in_synpred82981)
+ self.parameter_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred82
+
+
+
+ # $ANTLR start synpred83
+ def synpred83_fragment(self, ):
+ # C.g:330:28: ( declarator )
+ # C.g:330:28: declarator
+ self.following.append(self.FOLLOW_declarator_in_synpred83997)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred83
+
+
+
+ # $ANTLR start synpred84
+ def synpred84_fragment(self, ):
+ # C.g:330:39: ( abstract_declarator )
+ # C.g:330:39: abstract_declarator
+ self.following.append(self.FOLLOW_abstract_declarator_in_synpred84999)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred84
+
+
+
+ # $ANTLR start synpred86
+ def synpred86_fragment(self, ):
+ # C.g:330:4: ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? )
+ # C.g:330:4: declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )?
+ self.following.append(self.FOLLOW_declaration_specifiers_in_synpred86994)
+ self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:330:27: ( declarator | abstract_declarator )*
+ while True: #loop120
+ alt120 = 3
+ LA120 = self.input.LA(1)
+ if LA120 == 66:
+ LA120_3 = self.input.LA(2)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+ elif LA120 == IDENTIFIER or LA120 == 58 or LA120 == 59 or LA120 == 60:
+ alt120 = 1
+ elif LA120 == 62:
+ LA120 = self.input.LA(2)
+ if LA120 == 29 or LA120 == 30 or LA120 == 31 or LA120 == 32 or LA120 == 33 or LA120 == 34 or LA120 == 35 or LA120 == 36 or LA120 == 37 or LA120 == 38 or LA120 == 39 or LA120 == 40 or LA120 == 41 or LA120 == 42 or LA120 == 45 or LA120 == 46 or LA120 == 48 or LA120 == 49 or LA120 == 50 or LA120 == 51 or LA120 == 52 or LA120 == 53 or LA120 == 54 or LA120 == 55 or LA120 == 56 or LA120 == 57 or LA120 == 61 or LA120 == 63 or LA120 == 64:
+ alt120 = 2
+ elif LA120 == 58:
+ LA120_21 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+ elif LA120 == 66:
+ LA120_22 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+ elif LA120 == 59:
+ LA120_23 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+ elif LA120 == 60:
+ LA120_24 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+ elif LA120 == IDENTIFIER:
+ LA120_25 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+ elif LA120 == 62:
+ LA120_26 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+
+ elif LA120 == 64:
+ alt120 = 2
+
+ if alt120 == 1:
+ # C.g:330:28: declarator
+ self.following.append(self.FOLLOW_declarator_in_synpred86997)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt120 == 2:
+ # C.g:330:39: abstract_declarator
+ self.following.append(self.FOLLOW_abstract_declarator_in_synpred86999)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop120
+
+
+ # C.g:330:61: ( 'OPTIONAL' )?
+ alt121 = 2
+ LA121_0 = self.input.LA(1)
+
+ if (LA121_0 == 53) :
+ alt121 = 1
+ if alt121 == 1:
+ # C.g:330:62: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_synpred861004)
+ if self.failed:
+ return
+
+
+
+
+
+ # $ANTLR end synpred86
+
+
+
+ # $ANTLR start synpred90
+ def synpred90_fragment(self, ):
+ # C.g:341:4: ( specifier_qualifier_list ( abstract_declarator )? )
+ # C.g:341:4: specifier_qualifier_list ( abstract_declarator )?
+ self.following.append(self.FOLLOW_specifier_qualifier_list_in_synpred901046)
+ self.specifier_qualifier_list()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:341:29: ( abstract_declarator )?
+ alt122 = 2
+ LA122_0 = self.input.LA(1)
+
+ if (LA122_0 == 62 or LA122_0 == 64 or LA122_0 == 66) :
+ alt122 = 1
+ if alt122 == 1:
+ # C.g:0:0: abstract_declarator
+ self.following.append(self.FOLLOW_abstract_declarator_in_synpred901048)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ # $ANTLR end synpred90
+
+
+
+ # $ANTLR start synpred91
+ def synpred91_fragment(self, ):
+ # C.g:346:12: ( direct_abstract_declarator )
+ # C.g:346:12: direct_abstract_declarator
+ self.following.append(self.FOLLOW_direct_abstract_declarator_in_synpred911067)
+ self.direct_abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred91
+
+
+
+ # $ANTLR start synpred93
+ def synpred93_fragment(self, ):
+ # C.g:351:6: ( '(' abstract_declarator ')' )
+ # C.g:351:6: '(' abstract_declarator ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_synpred931086)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_abstract_declarator_in_synpred931088)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_synpred931090)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred93
+
+
+
+ # $ANTLR start synpred94
+ def synpred94_fragment(self, ):
+ # C.g:351:65: ( abstract_declarator_suffix )
+ # C.g:351:65: abstract_declarator_suffix
+ self.following.append(self.FOLLOW_abstract_declarator_suffix_in_synpred941098)
+ self.abstract_declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred94
+
+
+
+ # $ANTLR start synpred109
+ def synpred109_fragment(self, ):
+ # C.g:386:4: ( '(' type_name ')' cast_expression )
+ # C.g:386:4: '(' type_name ')' cast_expression
+ self.match(self.input, 62, self.FOLLOW_62_in_synpred1091282)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_type_name_in_synpred1091284)
+ self.type_name()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_synpred1091286)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_cast_expression_in_synpred1091288)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred109
+
+
+
+ # $ANTLR start synpred114
+ def synpred114_fragment(self, ):
+ # C.g:395:4: ( 'sizeof' unary_expression )
+ # C.g:395:4: 'sizeof' unary_expression
+ self.match(self.input, 74, self.FOLLOW_74_in_synpred1141330)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_unary_expression_in_synpred1141332)
+ self.unary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred114
+
+
+
+ # $ANTLR start synpred117
+ def synpred117_fragment(self, ):
+ # C.g:409:13: ( '(' argument_expression_list ')' )
+ # C.g:409:13: '(' argument_expression_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_synpred1171420)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_argument_expression_list_in_synpred1171424)
+ self.argument_expression_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_synpred1171428)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred117
+
+
+
+ # $ANTLR start synpred118
+ def synpred118_fragment(self, ):
+ # C.g:410:13: ( '(' macro_parameter_list ')' )
+ # C.g:410:13: '(' macro_parameter_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_synpred1181444)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_macro_parameter_list_in_synpred1181446)
+ self.macro_parameter_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_synpred1181448)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred118
+
+
+
+ # $ANTLR start synpred120
+ def synpred120_fragment(self, ):
+ # C.g:412:13: ( '*' IDENTIFIER )
+ # C.g:412:13: '*' IDENTIFIER
+ self.match(self.input, 66, self.FOLLOW_66_in_synpred1201482)
+ if self.failed:
+ return
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred1201486)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred120
+
+
+
+ # $ANTLR start synpred137
+ def synpred137_fragment(self, ):
+ # C.g:443:20: ( STRING_LITERAL )
+ # C.g:443:20: STRING_LITERAL
+ self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_synpred1371683)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred137
+
+
+
+ # $ANTLR start synpred138
+ def synpred138_fragment(self, ):
+ # C.g:443:8: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )
+ # C.g:443:8: ( IDENTIFIER )* ( STRING_LITERAL )+
+ # C.g:443:8: ( IDENTIFIER )*
+ while True: #loop125
+ alt125 = 2
+ LA125_0 = self.input.LA(1)
+
+ if (LA125_0 == IDENTIFIER) :
+ alt125 = 1
+
+
+ if alt125 == 1:
+ # C.g:0:0: IDENTIFIER
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred1381680)
+ if self.failed:
+ return
+
+
+ else:
+ break #loop125
+
+
+ # C.g:443:20: ( STRING_LITERAL )+
+ cnt126 = 0
+ while True: #loop126
+ alt126 = 2
+ LA126_0 = self.input.LA(1)
+
+ if (LA126_0 == STRING_LITERAL) :
+ alt126 = 1
+
+
+ if alt126 == 1:
+ # C.g:0:0: STRING_LITERAL
+ self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_synpred1381683)
+ if self.failed:
+ return
+
+
+ else:
+ if cnt126 >= 1:
+ break #loop126
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(126, self.input)
+ raise eee
+
+ cnt126 += 1
+
+
+
+
+ # $ANTLR end synpred138
+
+
+
+ # $ANTLR start synpred142
+ def synpred142_fragment(self, ):
+ # C.g:458:4: ( lvalue assignment_operator assignment_expression )
+ # C.g:458:4: lvalue assignment_operator assignment_expression
+ self.following.append(self.FOLLOW_lvalue_in_synpred1421744)
+ self.lvalue()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_assignment_operator_in_synpred1421746)
+ self.assignment_operator()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_assignment_expression_in_synpred1421748)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred142
+
+
+
+ # $ANTLR start synpred169
+ def synpred169_fragment(self, ):
+ # C.g:520:4: ( expression_statement )
+ # C.g:520:4: expression_statement
+ self.following.append(self.FOLLOW_expression_statement_in_synpred1692035)
+ self.expression_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred169
+
+
+
+ # $ANTLR start synpred173
+ def synpred173_fragment(self, ):
+ # C.g:524:4: ( macro_statement )
+ # C.g:524:4: macro_statement
+ self.following.append(self.FOLLOW_macro_statement_in_synpred1732055)
+ self.macro_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred173
+
+
+
+ # $ANTLR start synpred174
+ def synpred174_fragment(self, ):
+ # C.g:525:4: ( asm2_statement )
+ # C.g:525:4: asm2_statement
+ self.following.append(self.FOLLOW_asm2_statement_in_synpred1742060)
+ self.asm2_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred174
+
+
+
+ # $ANTLR start synpred181
+ def synpred181_fragment(self, ):
+ # C.g:544:19: ( declaration )
+ # C.g:544:19: declaration
+ self.following.append(self.FOLLOW_declaration_in_synpred1812166)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred181
+
+
+
+ # $ANTLR start synpred182
+ def synpred182_fragment(self, ):
+ # C.g:544:33: ( statement_list )
+ # C.g:544:33: statement_list
+ self.following.append(self.FOLLOW_statement_list_in_synpred1822170)
+ self.statement_list()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred182
+
+
+
+ # $ANTLR start synpred186
+ def synpred186_fragment(self, ):
+ # C.g:554:8: ( declaration )
+ # C.g:554:8: declaration
+ self.following.append(self.FOLLOW_declaration_in_synpred1862225)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred186
+
+
+
+ # $ANTLR start synpred188
+ def synpred188_fragment(self, ):
+ # C.g:558:4: ( statement )
+ # C.g:558:4: statement
+ self.following.append(self.FOLLOW_statement_in_synpred1882242)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred188
+
+
+
+ def synpred69(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred69_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred81(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred81_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred82(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred82_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred66(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred66_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred83(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred83_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred84(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred84_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred67(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred67_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred86(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred86_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred120(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred120_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred40(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred40_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred142(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred142_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred182(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred182_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred109(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred109_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred181(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred181_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred186(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred186_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred188(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred188_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred169(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred169_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred117(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred117_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred70(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred70_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred118(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred118_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred34(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred34_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred33(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred33_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred94(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred94_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred39(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred39_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred74(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred74_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred114(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred114_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred93(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred93_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred75(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred75_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred137(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred137_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred90(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred90_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred138(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred138_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred91(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred91_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred73(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred73_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred5(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred5_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred78(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred78_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred7(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred7_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred76(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred76_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred77(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred77_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred2(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred2_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred4(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred4_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred174(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred174_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred173(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred173_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred14(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred14_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred15(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred15_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred10(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred10_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+
+
+
+
+ FOLLOW_external_declaration_in_translation_unit74 = frozenset([1, 4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66])
+ FOLLOW_function_definition_in_external_declaration113 = frozenset([1])
+ FOLLOW_declaration_in_external_declaration118 = frozenset([1])
+ FOLLOW_macro_statement_in_external_declaration123 = frozenset([1, 25])
+ FOLLOW_25_in_external_declaration126 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_function_definition157 = frozenset([4, 58, 59, 60, 62, 66])
+ FOLLOW_declarator_in_function_definition160 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_declaration_in_function_definition166 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_compound_statement_in_function_definition171 = frozenset([1])
+ FOLLOW_compound_statement_in_function_definition180 = frozenset([1])
+ FOLLOW_26_in_declaration203 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66])
+ FOLLOW_declaration_specifiers_in_declaration207 = frozenset([4, 58, 59, 60, 62, 66])
+ FOLLOW_init_declarator_list_in_declaration216 = frozenset([25])
+ FOLLOW_25_in_declaration220 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_declaration234 = frozenset([4, 25, 58, 59, 60, 62, 66])
+ FOLLOW_init_declarator_list_in_declaration238 = frozenset([25])
+ FOLLOW_25_in_declaration243 = frozenset([1])
+ FOLLOW_storage_class_specifier_in_declaration_specifiers264 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_specifier_in_declaration_specifiers272 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_qualifier_in_declaration_specifiers286 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_init_declarator_in_init_declarator_list308 = frozenset([1, 27])
+ FOLLOW_27_in_init_declarator_list311 = frozenset([4, 58, 59, 60, 62, 66])
+ FOLLOW_init_declarator_in_init_declarator_list313 = frozenset([1, 27])
+ FOLLOW_declarator_in_init_declarator326 = frozenset([1, 28])
+ FOLLOW_28_in_init_declarator329 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_initializer_in_init_declarator331 = frozenset([1])
+ FOLLOW_set_in_storage_class_specifier0 = frozenset([1])
+ FOLLOW_34_in_type_specifier376 = frozenset([1])
+ FOLLOW_35_in_type_specifier381 = frozenset([1])
+ FOLLOW_36_in_type_specifier386 = frozenset([1])
+ FOLLOW_37_in_type_specifier391 = frozenset([1])
+ FOLLOW_38_in_type_specifier396 = frozenset([1])
+ FOLLOW_39_in_type_specifier401 = frozenset([1])
+ FOLLOW_40_in_type_specifier406 = frozenset([1])
+ FOLLOW_41_in_type_specifier411 = frozenset([1])
+ FOLLOW_42_in_type_specifier416 = frozenset([1])
+ FOLLOW_struct_or_union_specifier_in_type_specifier423 = frozenset([1])
+ FOLLOW_enum_specifier_in_type_specifier433 = frozenset([1])
+ FOLLOW_type_id_in_type_specifier451 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_type_id467 = frozenset([1])
+ FOLLOW_struct_or_union_in_struct_or_union_specifier494 = frozenset([4, 43])
+ FOLLOW_IDENTIFIER_in_struct_or_union_specifier496 = frozenset([43])
+ FOLLOW_43_in_struct_or_union_specifier499 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_struct_declaration_list_in_struct_or_union_specifier501 = frozenset([44])
+ FOLLOW_44_in_struct_or_union_specifier503 = frozenset([1])
+ FOLLOW_struct_or_union_in_struct_or_union_specifier508 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_struct_or_union_specifier510 = frozenset([1])
+ FOLLOW_set_in_struct_or_union0 = frozenset([1])
+ FOLLOW_struct_declaration_in_struct_declaration_list537 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_specifier_qualifier_list_in_struct_declaration549 = frozenset([4, 47, 58, 59, 60, 62, 66])
+ FOLLOW_struct_declarator_list_in_struct_declaration551 = frozenset([25])
+ FOLLOW_25_in_struct_declaration553 = frozenset([1])
+ FOLLOW_type_qualifier_in_specifier_qualifier_list566 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_specifier_in_specifier_qualifier_list570 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_struct_declarator_in_struct_declarator_list584 = frozenset([1, 27])
+ FOLLOW_27_in_struct_declarator_list587 = frozenset([4, 47, 58, 59, 60, 62, 66])
+ FOLLOW_struct_declarator_in_struct_declarator_list589 = frozenset([1, 27])
+ FOLLOW_declarator_in_struct_declarator602 = frozenset([1, 47])
+ FOLLOW_47_in_struct_declarator605 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_constant_expression_in_struct_declarator607 = frozenset([1])
+ FOLLOW_47_in_struct_declarator614 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_constant_expression_in_struct_declarator616 = frozenset([1])
+ FOLLOW_48_in_enum_specifier634 = frozenset([43])
+ FOLLOW_43_in_enum_specifier636 = frozenset([4])
+ FOLLOW_enumerator_list_in_enum_specifier638 = frozenset([27, 44])
+ FOLLOW_27_in_enum_specifier640 = frozenset([44])
+ FOLLOW_44_in_enum_specifier643 = frozenset([1])
+ FOLLOW_48_in_enum_specifier648 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_enum_specifier650 = frozenset([43])
+ FOLLOW_43_in_enum_specifier652 = frozenset([4])
+ FOLLOW_enumerator_list_in_enum_specifier654 = frozenset([27, 44])
+ FOLLOW_27_in_enum_specifier656 = frozenset([44])
+ FOLLOW_44_in_enum_specifier659 = frozenset([1])
+ FOLLOW_48_in_enum_specifier664 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_enum_specifier666 = frozenset([1])
+ FOLLOW_enumerator_in_enumerator_list677 = frozenset([1, 27])
+ FOLLOW_27_in_enumerator_list680 = frozenset([4])
+ FOLLOW_enumerator_in_enumerator_list682 = frozenset([1, 27])
+ FOLLOW_IDENTIFIER_in_enumerator695 = frozenset([1, 28])
+ FOLLOW_28_in_enumerator698 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_constant_expression_in_enumerator700 = frozenset([1])
+ FOLLOW_set_in_type_qualifier0 = frozenset([1])
+ FOLLOW_pointer_in_declarator784 = frozenset([4, 58, 59, 60, 62])
+ FOLLOW_58_in_declarator788 = frozenset([4, 59, 60, 62])
+ FOLLOW_59_in_declarator793 = frozenset([4, 60, 62])
+ FOLLOW_60_in_declarator798 = frozenset([4, 62])
+ FOLLOW_direct_declarator_in_declarator802 = frozenset([1])
+ FOLLOW_pointer_in_declarator808 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_direct_declarator819 = frozenset([1, 62, 64])
+ FOLLOW_declarator_suffix_in_direct_declarator821 = frozenset([1, 62, 64])
+ FOLLOW_62_in_direct_declarator827 = frozenset([4, 58, 59, 60, 62, 66])
+ FOLLOW_58_in_direct_declarator830 = frozenset([4, 58, 59, 60, 62, 66])
+ FOLLOW_declarator_in_direct_declarator834 = frozenset([63])
+ FOLLOW_63_in_direct_declarator836 = frozenset([62, 64])
+ FOLLOW_declarator_suffix_in_direct_declarator838 = frozenset([1, 62, 64])
+ FOLLOW_64_in_declarator_suffix852 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_constant_expression_in_declarator_suffix854 = frozenset([65])
+ FOLLOW_65_in_declarator_suffix856 = frozenset([1])
+ FOLLOW_64_in_declarator_suffix866 = frozenset([65])
+ FOLLOW_65_in_declarator_suffix868 = frozenset([1])
+ FOLLOW_62_in_declarator_suffix878 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_parameter_type_list_in_declarator_suffix880 = frozenset([63])
+ FOLLOW_63_in_declarator_suffix882 = frozenset([1])
+ FOLLOW_62_in_declarator_suffix892 = frozenset([4])
+ FOLLOW_identifier_list_in_declarator_suffix894 = frozenset([63])
+ FOLLOW_63_in_declarator_suffix896 = frozenset([1])
+ FOLLOW_62_in_declarator_suffix906 = frozenset([63])
+ FOLLOW_63_in_declarator_suffix908 = frozenset([1])
+ FOLLOW_66_in_pointer919 = frozenset([49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_qualifier_in_pointer921 = frozenset([1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_pointer_in_pointer924 = frozenset([1])
+ FOLLOW_66_in_pointer930 = frozenset([66])
+ FOLLOW_pointer_in_pointer932 = frozenset([1])
+ FOLLOW_66_in_pointer937 = frozenset([1])
+ FOLLOW_parameter_list_in_parameter_type_list948 = frozenset([1, 27])
+ FOLLOW_27_in_parameter_type_list951 = frozenset([53, 67])
+ FOLLOW_53_in_parameter_type_list954 = frozenset([67])
+ FOLLOW_67_in_parameter_type_list958 = frozenset([1])
+ FOLLOW_parameter_declaration_in_parameter_list971 = frozenset([1, 27])
+ FOLLOW_27_in_parameter_list974 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_53_in_parameter_list977 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_parameter_declaration_in_parameter_list981 = frozenset([1, 27])
+ FOLLOW_declaration_specifiers_in_parameter_declaration994 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66])
+ FOLLOW_declarator_in_parameter_declaration997 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66])
+ FOLLOW_abstract_declarator_in_parameter_declaration999 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66])
+ FOLLOW_53_in_parameter_declaration1004 = frozenset([1])
+ FOLLOW_pointer_in_parameter_declaration1013 = frozenset([4, 66])
+ FOLLOW_IDENTIFIER_in_parameter_declaration1016 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_identifier_list1027 = frozenset([1, 27])
+ FOLLOW_27_in_identifier_list1031 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_identifier_list1033 = frozenset([1, 27])
+ FOLLOW_specifier_qualifier_list_in_type_name1046 = frozenset([1, 62, 64, 66])
+ FOLLOW_abstract_declarator_in_type_name1048 = frozenset([1])
+ FOLLOW_type_id_in_type_name1054 = frozenset([1])
+ FOLLOW_pointer_in_abstract_declarator1065 = frozenset([1, 62, 64])
+ FOLLOW_direct_abstract_declarator_in_abstract_declarator1067 = frozenset([1])
+ FOLLOW_direct_abstract_declarator_in_abstract_declarator1073 = frozenset([1])
+ FOLLOW_62_in_direct_abstract_declarator1086 = frozenset([62, 64, 66])
+ FOLLOW_abstract_declarator_in_direct_abstract_declarator1088 = frozenset([63])
+ FOLLOW_63_in_direct_abstract_declarator1090 = frozenset([1, 62, 64])
+ FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1094 = frozenset([1, 62, 64])
+ FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1098 = frozenset([1, 62, 64])
+ FOLLOW_64_in_abstract_declarator_suffix1110 = frozenset([65])
+ FOLLOW_65_in_abstract_declarator_suffix1112 = frozenset([1])
+ FOLLOW_64_in_abstract_declarator_suffix1117 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_constant_expression_in_abstract_declarator_suffix1119 = frozenset([65])
+ FOLLOW_65_in_abstract_declarator_suffix1121 = frozenset([1])
+ FOLLOW_62_in_abstract_declarator_suffix1126 = frozenset([63])
+ FOLLOW_63_in_abstract_declarator_suffix1128 = frozenset([1])
+ FOLLOW_62_in_abstract_declarator_suffix1133 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_parameter_type_list_in_abstract_declarator_suffix1135 = frozenset([63])
+ FOLLOW_63_in_abstract_declarator_suffix1137 = frozenset([1])
+ FOLLOW_assignment_expression_in_initializer1150 = frozenset([1])
+ FOLLOW_43_in_initializer1155 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_initializer_list_in_initializer1157 = frozenset([27, 44])
+ FOLLOW_27_in_initializer1159 = frozenset([44])
+ FOLLOW_44_in_initializer1162 = frozenset([1])
+ FOLLOW_initializer_in_initializer_list1173 = frozenset([1, 27])
+ FOLLOW_27_in_initializer_list1176 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_initializer_in_initializer_list1178 = frozenset([1, 27])
+ FOLLOW_assignment_expression_in_argument_expression_list1196 = frozenset([1, 27, 53])
+ FOLLOW_53_in_argument_expression_list1199 = frozenset([1, 27])
+ FOLLOW_27_in_argument_expression_list1204 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_assignment_expression_in_argument_expression_list1206 = frozenset([1, 27, 53])
+ FOLLOW_53_in_argument_expression_list1209 = frozenset([1, 27])
+ FOLLOW_multiplicative_expression_in_additive_expression1225 = frozenset([1, 68, 69])
+ FOLLOW_68_in_additive_expression1229 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_multiplicative_expression_in_additive_expression1231 = frozenset([1, 68, 69])
+ FOLLOW_69_in_additive_expression1235 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_multiplicative_expression_in_additive_expression1237 = frozenset([1, 68, 69])
+ FOLLOW_cast_expression_in_multiplicative_expression1251 = frozenset([1, 66, 70, 71])
+ FOLLOW_66_in_multiplicative_expression1255 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_cast_expression_in_multiplicative_expression1257 = frozenset([1, 66, 70, 71])
+ FOLLOW_70_in_multiplicative_expression1261 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_cast_expression_in_multiplicative_expression1263 = frozenset([1, 66, 70, 71])
+ FOLLOW_71_in_multiplicative_expression1267 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_cast_expression_in_multiplicative_expression1269 = frozenset([1, 66, 70, 71])
+ FOLLOW_62_in_cast_expression1282 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_name_in_cast_expression1284 = frozenset([63])
+ FOLLOW_63_in_cast_expression1286 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_cast_expression_in_cast_expression1288 = frozenset([1])
+ FOLLOW_unary_expression_in_cast_expression1293 = frozenset([1])
+ FOLLOW_postfix_expression_in_unary_expression1304 = frozenset([1])
+ FOLLOW_72_in_unary_expression1309 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_unary_expression_in_unary_expression1311 = frozenset([1])
+ FOLLOW_73_in_unary_expression1316 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_unary_expression_in_unary_expression1318 = frozenset([1])
+ FOLLOW_unary_operator_in_unary_expression1323 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_cast_expression_in_unary_expression1325 = frozenset([1])
+ FOLLOW_74_in_unary_expression1330 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_unary_expression_in_unary_expression1332 = frozenset([1])
+ FOLLOW_74_in_unary_expression1337 = frozenset([62])
+ FOLLOW_62_in_unary_expression1339 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_name_in_unary_expression1341 = frozenset([63])
+ FOLLOW_63_in_unary_expression1343 = frozenset([1])
+ FOLLOW_primary_expression_in_postfix_expression1367 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_64_in_postfix_expression1383 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_postfix_expression1385 = frozenset([65])
+ FOLLOW_65_in_postfix_expression1387 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_62_in_postfix_expression1401 = frozenset([63])
+ FOLLOW_63_in_postfix_expression1405 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_62_in_postfix_expression1420 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_argument_expression_list_in_postfix_expression1424 = frozenset([63])
+ FOLLOW_63_in_postfix_expression1428 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_62_in_postfix_expression1444 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_macro_parameter_list_in_postfix_expression1446 = frozenset([63])
+ FOLLOW_63_in_postfix_expression1448 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_75_in_postfix_expression1462 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_postfix_expression1466 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_66_in_postfix_expression1482 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_postfix_expression1486 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_76_in_postfix_expression1502 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_postfix_expression1506 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_72_in_postfix_expression1522 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_73_in_postfix_expression1536 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_parameter_declaration_in_macro_parameter_list1559 = frozenset([1, 27])
+ FOLLOW_27_in_macro_parameter_list1562 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_parameter_declaration_in_macro_parameter_list1564 = frozenset([1, 27])
+ FOLLOW_set_in_unary_operator0 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_primary_expression1613 = frozenset([1])
+ FOLLOW_constant_in_primary_expression1618 = frozenset([1])
+ FOLLOW_62_in_primary_expression1623 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_primary_expression1625 = frozenset([63])
+ FOLLOW_63_in_primary_expression1627 = frozenset([1])
+ FOLLOW_HEX_LITERAL_in_constant1643 = frozenset([1])
+ FOLLOW_OCTAL_LITERAL_in_constant1653 = frozenset([1])
+ FOLLOW_DECIMAL_LITERAL_in_constant1663 = frozenset([1])
+ FOLLOW_CHARACTER_LITERAL_in_constant1671 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_constant1680 = frozenset([4, 9])
+ FOLLOW_STRING_LITERAL_in_constant1683 = frozenset([1, 4, 9])
+ FOLLOW_IDENTIFIER_in_constant1688 = frozenset([1, 4])
+ FOLLOW_FLOATING_POINT_LITERAL_in_constant1699 = frozenset([1])
+ FOLLOW_assignment_expression_in_expression1715 = frozenset([1, 27])
+ FOLLOW_27_in_expression1718 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_assignment_expression_in_expression1720 = frozenset([1, 27])
+ FOLLOW_conditional_expression_in_constant_expression1733 = frozenset([1])
+ FOLLOW_lvalue_in_assignment_expression1744 = frozenset([28, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89])
+ FOLLOW_assignment_operator_in_assignment_expression1746 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_assignment_expression_in_assignment_expression1748 = frozenset([1])
+ FOLLOW_conditional_expression_in_assignment_expression1753 = frozenset([1])
+ FOLLOW_unary_expression_in_lvalue1765 = frozenset([1])
+ FOLLOW_set_in_assignment_operator0 = frozenset([1])
+ FOLLOW_logical_or_expression_in_conditional_expression1839 = frozenset([1, 90])
+ FOLLOW_90_in_conditional_expression1842 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_conditional_expression1844 = frozenset([47])
+ FOLLOW_47_in_conditional_expression1846 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_conditional_expression_in_conditional_expression1848 = frozenset([1])
+ FOLLOW_logical_and_expression_in_logical_or_expression1863 = frozenset([1, 91])
+ FOLLOW_91_in_logical_or_expression1866 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_logical_and_expression_in_logical_or_expression1868 = frozenset([1, 91])
+ FOLLOW_inclusive_or_expression_in_logical_and_expression1881 = frozenset([1, 92])
+ FOLLOW_92_in_logical_and_expression1884 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_inclusive_or_expression_in_logical_and_expression1886 = frozenset([1, 92])
+ FOLLOW_exclusive_or_expression_in_inclusive_or_expression1899 = frozenset([1, 93])
+ FOLLOW_93_in_inclusive_or_expression1902 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_exclusive_or_expression_in_inclusive_or_expression1904 = frozenset([1, 93])
+ FOLLOW_and_expression_in_exclusive_or_expression1917 = frozenset([1, 94])
+ FOLLOW_94_in_exclusive_or_expression1920 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_and_expression_in_exclusive_or_expression1922 = frozenset([1, 94])
+ FOLLOW_equality_expression_in_and_expression1935 = frozenset([1, 77])
+ FOLLOW_77_in_and_expression1938 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_equality_expression_in_and_expression1940 = frozenset([1, 77])
+ FOLLOW_relational_expression_in_equality_expression1952 = frozenset([1, 95, 96])
+ FOLLOW_set_in_equality_expression1955 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_relational_expression_in_equality_expression1961 = frozenset([1, 95, 96])
+ FOLLOW_shift_expression_in_relational_expression1975 = frozenset([1, 97, 98, 99, 100])
+ FOLLOW_set_in_relational_expression1978 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_shift_expression_in_relational_expression1988 = frozenset([1, 97, 98, 99, 100])
+ FOLLOW_additive_expression_in_shift_expression2001 = frozenset([1, 101, 102])
+ FOLLOW_set_in_shift_expression2004 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_additive_expression_in_shift_expression2010 = frozenset([1, 101, 102])
+ FOLLOW_labeled_statement_in_statement2025 = frozenset([1])
+ FOLLOW_compound_statement_in_statement2030 = frozenset([1])
+ FOLLOW_expression_statement_in_statement2035 = frozenset([1])
+ FOLLOW_selection_statement_in_statement2040 = frozenset([1])
+ FOLLOW_iteration_statement_in_statement2045 = frozenset([1])
+ FOLLOW_jump_statement_in_statement2050 = frozenset([1])
+ FOLLOW_macro_statement_in_statement2055 = frozenset([1])
+ FOLLOW_asm2_statement_in_statement2060 = frozenset([1])
+ FOLLOW_asm1_statement_in_statement2065 = frozenset([1])
+ FOLLOW_asm_statement_in_statement2070 = frozenset([1])
+ FOLLOW_declaration_in_statement2075 = frozenset([1])
+ FOLLOW_103_in_asm2_statement2086 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_asm2_statement2089 = frozenset([62])
+ FOLLOW_62_in_asm2_statement2091 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_set_in_asm2_statement2094 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_63_in_asm2_statement2101 = frozenset([25])
+ FOLLOW_25_in_asm2_statement2103 = frozenset([1])
+ FOLLOW_104_in_asm1_statement2115 = frozenset([43])
+ FOLLOW_43_in_asm1_statement2117 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_set_in_asm1_statement2120 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_44_in_asm1_statement2127 = frozenset([1])
+ FOLLOW_105_in_asm_statement2138 = frozenset([43])
+ FOLLOW_43_in_asm_statement2140 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_set_in_asm_statement2143 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_44_in_asm_statement2150 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_macro_statement2162 = frozenset([62])
+ FOLLOW_62_in_macro_statement2164 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_declaration_in_macro_statement2166 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_list_in_macro_statement2170 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_macro_statement2173 = frozenset([63])
+ FOLLOW_63_in_macro_statement2176 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_labeled_statement2188 = frozenset([47])
+ FOLLOW_47_in_labeled_statement2190 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_labeled_statement2192 = frozenset([1])
+ FOLLOW_106_in_labeled_statement2197 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_constant_expression_in_labeled_statement2199 = frozenset([47])
+ FOLLOW_47_in_labeled_statement2201 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_labeled_statement2203 = frozenset([1])
+ FOLLOW_107_in_labeled_statement2208 = frozenset([47])
+ FOLLOW_47_in_labeled_statement2210 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_labeled_statement2212 = frozenset([1])
+ FOLLOW_43_in_compound_statement2223 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_declaration_in_compound_statement2225 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_list_in_compound_statement2228 = frozenset([44])
+ FOLLOW_44_in_compound_statement2231 = frozenset([1])
+ FOLLOW_statement_in_statement_list2242 = frozenset([1, 4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_25_in_expression_statement2254 = frozenset([1])
+ FOLLOW_expression_in_expression_statement2259 = frozenset([25])
+ FOLLOW_25_in_expression_statement2261 = frozenset([1])
+ FOLLOW_108_in_selection_statement2272 = frozenset([62])
+ FOLLOW_62_in_selection_statement2274 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_selection_statement2278 = frozenset([63])
+ FOLLOW_63_in_selection_statement2280 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_selection_statement2284 = frozenset([1, 109])
+ FOLLOW_109_in_selection_statement2299 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_selection_statement2301 = frozenset([1])
+ FOLLOW_110_in_selection_statement2308 = frozenset([62])
+ FOLLOW_62_in_selection_statement2310 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_selection_statement2312 = frozenset([63])
+ FOLLOW_63_in_selection_statement2314 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_selection_statement2316 = frozenset([1])
+ FOLLOW_111_in_iteration_statement2327 = frozenset([62])
+ FOLLOW_62_in_iteration_statement2329 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_iteration_statement2333 = frozenset([63])
+ FOLLOW_63_in_iteration_statement2335 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_iteration_statement2337 = frozenset([1])
+ FOLLOW_112_in_iteration_statement2344 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_iteration_statement2346 = frozenset([111])
+ FOLLOW_111_in_iteration_statement2348 = frozenset([62])
+ FOLLOW_62_in_iteration_statement2350 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_iteration_statement2354 = frozenset([63])
+ FOLLOW_63_in_iteration_statement2356 = frozenset([25])
+ FOLLOW_25_in_iteration_statement2358 = frozenset([1])
+ FOLLOW_113_in_iteration_statement2365 = frozenset([62])
+ FOLLOW_62_in_iteration_statement2367 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_statement_in_iteration_statement2369 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_statement_in_iteration_statement2373 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_iteration_statement2375 = frozenset([63])
+ FOLLOW_63_in_iteration_statement2378 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_iteration_statement2380 = frozenset([1])
+ FOLLOW_114_in_jump_statement2393 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_jump_statement2395 = frozenset([25])
+ FOLLOW_25_in_jump_statement2397 = frozenset([1])
+ FOLLOW_115_in_jump_statement2402 = frozenset([25])
+ FOLLOW_25_in_jump_statement2404 = frozenset([1])
+ FOLLOW_116_in_jump_statement2409 = frozenset([25])
+ FOLLOW_25_in_jump_statement2411 = frozenset([1])
+ FOLLOW_117_in_jump_statement2416 = frozenset([25])
+ FOLLOW_25_in_jump_statement2418 = frozenset([1])
+ FOLLOW_117_in_jump_statement2423 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_jump_statement2425 = frozenset([25])
+ FOLLOW_25_in_jump_statement2427 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_synpred2100 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_synpred4100 = frozenset([4, 58, 59, 60, 62, 66])
+ FOLLOW_declarator_in_synpred4103 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_declaration_in_synpred4105 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_43_in_synpred4108 = frozenset([1])
+ FOLLOW_declaration_in_synpred5118 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_synpred7157 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_synpred10207 = frozenset([1])
+ FOLLOW_type_specifier_in_synpred14272 = frozenset([1])
+ FOLLOW_type_qualifier_in_synpred15286 = frozenset([1])
+ FOLLOW_type_qualifier_in_synpred33444 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_synpred34442 = frozenset([4, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66])
+ FOLLOW_type_qualifier_in_synpred34444 = frozenset([4, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66])
+ FOLLOW_declarator_in_synpred34447 = frozenset([1])
+ FOLLOW_type_qualifier_in_synpred39566 = frozenset([1])
+ FOLLOW_type_specifier_in_synpred40570 = frozenset([1])
+ FOLLOW_pointer_in_synpred66784 = frozenset([4, 58, 59, 60, 62])
+ FOLLOW_58_in_synpred66788 = frozenset([4, 59, 60, 62])
+ FOLLOW_59_in_synpred66793 = frozenset([4, 60, 62])
+ FOLLOW_60_in_synpred66798 = frozenset([4, 62])
+ FOLLOW_direct_declarator_in_synpred66802 = frozenset([1])
+ FOLLOW_declarator_suffix_in_synpred67821 = frozenset([1])
+ FOLLOW_58_in_synpred69830 = frozenset([1])
+ FOLLOW_declarator_suffix_in_synpred70838 = frozenset([1])
+ FOLLOW_62_in_synpred73878 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_parameter_type_list_in_synpred73880 = frozenset([63])
+ FOLLOW_63_in_synpred73882 = frozenset([1])
+ FOLLOW_62_in_synpred74892 = frozenset([4])
+ FOLLOW_identifier_list_in_synpred74894 = frozenset([63])
+ FOLLOW_63_in_synpred74896 = frozenset([1])
+ FOLLOW_type_qualifier_in_synpred75921 = frozenset([1])
+ FOLLOW_pointer_in_synpred76924 = frozenset([1])
+ FOLLOW_66_in_synpred77919 = frozenset([49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_qualifier_in_synpred77921 = frozenset([1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_pointer_in_synpred77924 = frozenset([1])
+ FOLLOW_66_in_synpred78930 = frozenset([66])
+ FOLLOW_pointer_in_synpred78932 = frozenset([1])
+ FOLLOW_53_in_synpred81977 = frozenset([1])
+ FOLLOW_27_in_synpred82974 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_53_in_synpred82977 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_parameter_declaration_in_synpred82981 = frozenset([1])
+ FOLLOW_declarator_in_synpred83997 = frozenset([1])
+ FOLLOW_abstract_declarator_in_synpred84999 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_synpred86994 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66])
+ FOLLOW_declarator_in_synpred86997 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66])
+ FOLLOW_abstract_declarator_in_synpred86999 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66])
+ FOLLOW_53_in_synpred861004 = frozenset([1])
+ FOLLOW_specifier_qualifier_list_in_synpred901046 = frozenset([1, 62, 64, 66])
+ FOLLOW_abstract_declarator_in_synpred901048 = frozenset([1])
+ FOLLOW_direct_abstract_declarator_in_synpred911067 = frozenset([1])
+ FOLLOW_62_in_synpred931086 = frozenset([62, 64, 66])
+ FOLLOW_abstract_declarator_in_synpred931088 = frozenset([63])
+ FOLLOW_63_in_synpred931090 = frozenset([1])
+ FOLLOW_abstract_declarator_suffix_in_synpred941098 = frozenset([1])
+ FOLLOW_62_in_synpred1091282 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_name_in_synpred1091284 = frozenset([63])
+ FOLLOW_63_in_synpred1091286 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_cast_expression_in_synpred1091288 = frozenset([1])
+ FOLLOW_74_in_synpred1141330 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_unary_expression_in_synpred1141332 = frozenset([1])
+ FOLLOW_62_in_synpred1171420 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_argument_expression_list_in_synpred1171424 = frozenset([63])
+ FOLLOW_63_in_synpred1171428 = frozenset([1])
+ FOLLOW_62_in_synpred1181444 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_macro_parameter_list_in_synpred1181446 = frozenset([63])
+ FOLLOW_63_in_synpred1181448 = frozenset([1])
+ FOLLOW_66_in_synpred1201482 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_synpred1201486 = frozenset([1])
+ FOLLOW_STRING_LITERAL_in_synpred1371683 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_synpred1381680 = frozenset([4, 9])
+ FOLLOW_STRING_LITERAL_in_synpred1381683 = frozenset([1, 9])
+ FOLLOW_lvalue_in_synpred1421744 = frozenset([28, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89])
+ FOLLOW_assignment_operator_in_synpred1421746 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_assignment_expression_in_synpred1421748 = frozenset([1])
+ FOLLOW_expression_statement_in_synpred1692035 = frozenset([1])
+ FOLLOW_macro_statement_in_synpred1732055 = frozenset([1])
+ FOLLOW_asm2_statement_in_synpred1742060 = frozenset([1])
+ FOLLOW_declaration_in_synpred1812166 = frozenset([1])
+ FOLLOW_statement_list_in_synpred1822170 = frozenset([1])
+ FOLLOW_declaration_in_synpred1862225 = frozenset([1])
+ FOLLOW_statement_in_synpred1882242 = frozenset([1])
+
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/CParser3/__init__.py b/roms/edk2/BaseTools/Source/Python/Ecc/CParser3/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/CParser3/__init__.py
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/C.g4 b/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/C.g4
new file mode 100644
index 000000000..ffc5c121a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/C.g4
@@ -0,0 +1,631 @@
+/* @file
+ This file is used to be the grammar file of ECC tool
+
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+*/
+
+
+grammar C;
+options {
+ language=Python;
+}
+
+
+@header {
+## @file
+# The file defines the parser for C source files.
+#
+# THIS FILE IS AUTO-GENENERATED. PLEASE DON NOT MODIFY THIS FILE.
+# This file is generated by running:
+# java org.antlr.Tool C.g
+#
+# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
+#
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License which accompanies this
+# distribution. The full text of the license may be found at:
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+import Ecc.CodeFragment as CodeFragment
+import Ecc.FileProfile as FileProfile
+}
+
+@members {
+
+def printTokenInfo(self, line, offset, tokenText):
+ print(str(line)+ ',' + str(offset) + ':' + str(tokenText))
+
+def StorePredicateExpression(self, StartLine, StartOffset, EndLine, EndOffset, Text):
+ PredExp = CodeFragment.PredicateExpression(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.PredicateExpressionList.append(PredExp)
+
+def StoreEnumerationDefinition(self, StartLine, StartOffset, EndLine, EndOffset, Text):
+ EnumDef = CodeFragment.EnumerationDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.EnumerationDefinitionList.append(EnumDef)
+
+def StoreStructUnionDefinition(self, StartLine, StartOffset, EndLine, EndOffset, Text):
+ SUDef = CodeFragment.StructUnionDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.StructUnionDefinitionList.append(SUDef)
+
+def StoreTypedefDefinition(self, StartLine, StartOffset, EndLine, EndOffset, FromText, ToText):
+ Tdef = CodeFragment.TypedefDefinition(FromText, ToText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.TypedefDefinitionList.append(Tdef)
+
+def StoreFunctionDefinition(self, StartLine, StartOffset, EndLine, EndOffset, ModifierText, DeclText, LeftBraceLine, LeftBraceOffset, DeclLine, DeclOffset):
+ FuncDef = CodeFragment.FunctionDefinition(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset), (LeftBraceLine, LeftBraceOffset), (DeclLine, DeclOffset))
+ FileProfile.FunctionDefinitionList.append(FuncDef)
+
+def StoreVariableDeclaration(self, StartLine, StartOffset, EndLine, EndOffset, ModifierText, DeclText):
+ VarDecl = CodeFragment.VariableDeclaration(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.VariableDeclarationList.append(VarDecl)
+
+def StoreFunctionCalling(self, StartLine, StartOffset, EndLine, EndOffset, FuncName, ParamList):
+ FuncCall = CodeFragment.FunctionCalling(FuncName, ParamList, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.FunctionCallingList.append(FuncCall)
+
+}
+
+translation_unit
+ : external_declaration*
+ ;
+
+
+external_declaration
+ : ( declaration_specifiers? declarator declaration* '{' )
+ | function_definition
+ | declaration
+ | macro_statement (';')?
+ ;
+
+function_definition
+locals [String ModifierText = '', String DeclText = '', int LBLine = 0, int LBOffset = 0, int DeclLine = 0, int DeclOffset = 0]
+@init {
+ModifierText = '';
+DeclText = '';
+LBLine = 0;
+LBOffset = 0;
+DeclLine = 0;
+DeclOffset = 0;
+}
+@after{
+self.StoreFunctionDefinition(localctx.start.line, localctx.start.column, localctx.stop.line, localctx.stop.column, ModifierText, DeclText, LBLine, LBOffset, DeclLine, DeclOffset)
+}
+ : d=declaration_specifiers? declarator
+ ( declaration+ a=compound_statement // K&R style
+ | b=compound_statement // ANSI style
+ ) {
+if localctx.d != None:
+ ModifierText = $declaration_specifiers.text
+else:
+ ModifierText = ''
+DeclText = $declarator.text
+DeclLine = $declarator.start.line
+DeclOffset = $declarator.start.column
+if localctx.a != None:
+ LBLine = $a.start.line
+ LBOffset = $a.start.column
+else:
+ LBLine = $b.start.line
+ LBOffset = $b.start.column
+ }
+ ;
+
+
+declaration_specifiers
+ : ( storage_class_specifier
+ | type_specifier
+ | type_qualifier
+ )+
+ ;
+
+declaration
+ : a='typedef' b=declaration_specifiers? c=init_declarator_list d=';'
+ {
+if localctx.b is not None:
+ self.StoreTypedefDefinition(localctx.a.line, localctx.a.column, $d.line, localctx.d.column, $b.text, $c.text)
+else:
+ self.StoreTypedefDefinition(localctx.a.line, localctx.a.column, $d.line, localctx.d.column, '', $c.text)
+ }
+ | s=declaration_specifiers t=init_declarator_list? e=';'
+ {
+if localctx.t is not None:
+ self.StoreVariableDeclaration($s.start.line, $s.start.column, $t.start.line, $t.start.column, $s.text, $t.text)
+}
+ ;
+
+init_declarator_list
+ : init_declarator (',' init_declarator)*
+ ;
+
+init_declarator
+ : declarator ('=' initializer)?
+ ;
+
+storage_class_specifier
+ : 'extern'
+ | 'static'
+ | 'auto'
+ | 'register'
+ | 'STATIC'
+ ;
+
+type_specifier
+ : 'void'
+ | 'char'
+ | 'short'
+ | 'int'
+ | 'long'
+ | 'float'
+ | 'double'
+ | 'signed'
+ | 'unsigned'
+ | s=struct_or_union_specifier
+ {
+if localctx.s.stop is not None:
+ self.StoreStructUnionDefinition($s.start.line, $s.start.column, $s.stop.line, $s.stop.column, $s.text)
+}
+ | e=enum_specifier
+ {
+if localctx.e.stop is not None:
+ self.StoreEnumerationDefinition($e.start.line, $e.start.column, $e.stop.line, $e.stop.column, $e.text)
+}
+ | (IDENTIFIER type_qualifier* declarator)
+ | type_id
+ ;
+
+type_id
+ : IDENTIFIER
+ //{self.printTokenInfo($a.line, $a.pos, $a.text)}
+ ;
+
+struct_or_union_specifier
+ : struct_or_union IDENTIFIER? '{' struct_declaration_list '}'
+ | struct_or_union IDENTIFIER
+ ;
+
+struct_or_union
+ : 'struct'
+ | 'union'
+ ;
+
+struct_declaration_list
+ : struct_declaration+
+ ;
+
+struct_declaration
+ : specifier_qualifier_list struct_declarator_list ';'
+ ;
+
+specifier_qualifier_list
+ : ( type_qualifier | type_specifier )+
+ ;
+
+struct_declarator_list
+ : struct_declarator (',' struct_declarator)*
+ ;
+
+struct_declarator
+ : declarator (':' constant_expression)?
+ | ':' constant_expression
+ ;
+
+enum_specifier
+ : 'enum' '{' enumerator_list ','? '}'
+ | 'enum' IDENTIFIER '{' enumerator_list ','? '}'
+ | 'enum' IDENTIFIER
+ ;
+
+enumerator_list
+ : enumerator (',' enumerator)*
+ ;
+
+enumerator
+ : IDENTIFIER ('=' constant_expression)?
+ ;
+
+type_qualifier
+ : 'const'
+ | 'volatile'
+ | 'IN'
+ | 'OUT'
+ | 'OPTIONAL'
+ | 'CONST'
+ | 'UNALIGNED'
+ | 'VOLATILE'
+ | 'GLOBAL_REMOVE_IF_UNREFERENCED'
+ | 'EFIAPI'
+ | 'EFI_BOOTSERVICE'
+ | 'EFI_RUNTIMESERVICE'
+ | 'PACKED'
+ ;
+
+declarator
+ : pointer? ('EFIAPI')? ('EFI_BOOTSERVICE')? ('EFI_RUNTIMESERVICE')? direct_declarator
+// | ('EFIAPI')? ('EFI_BOOTSERVICE')? ('EFI_RUNTIMESERVICE')? pointer? direct_declarator
+ | pointer
+ ;
+
+direct_declarator
+ : IDENTIFIER declarator_suffix*
+ | '(' ('EFIAPI')? declarator ')' declarator_suffix+
+ ;
+
+declarator_suffix
+ : '[' constant_expression ']'
+ | '[' ']'
+ | '(' parameter_type_list ')'
+ | '(' identifier_list ')'
+ | '(' ')'
+ ;
+
+pointer
+ : '*' type_qualifier+ pointer?
+ | '*' pointer
+ | '*'
+ ;
+
+parameter_type_list
+ : parameter_list (',' ('OPTIONAL')? '...')?
+ ;
+
+parameter_list
+ : parameter_declaration (',' ('OPTIONAL')? parameter_declaration)*
+ ;
+
+parameter_declaration
+ : declaration_specifiers (declarator|abstract_declarator)* ('OPTIONAL')?
+ //accomerdate user-defined type only, no declarator follow.
+ | pointer* IDENTIFIER
+ ;
+
+identifier_list
+ : IDENTIFIER
+ (',' IDENTIFIER)*
+ ;
+
+type_name
+ : specifier_qualifier_list abstract_declarator?
+ | type_id
+ ;
+
+abstract_declarator
+ : pointer direct_abstract_declarator?
+ | direct_abstract_declarator
+ ;
+
+direct_abstract_declarator
+ : ( '(' abstract_declarator ')' | abstract_declarator_suffix ) abstract_declarator_suffix*
+ ;
+
+abstract_declarator_suffix
+ : '[' ']'
+ | '[' constant_expression ']'
+ | '(' ')'
+ | '(' parameter_type_list ')'
+ ;
+
+initializer
+
+ : assignment_expression
+ | '{' initializer_list ','? '}'
+ ;
+
+initializer_list
+ : initializer (',' initializer )*
+ ;
+
+// E x p r e s s i o n s
+
+argument_expression_list
+ : assignment_expression ('OPTIONAL')? (',' assignment_expression ('OPTIONAL')?)*
+ ;
+
+additive_expression
+ : (multiplicative_expression) ('+' multiplicative_expression | '-' multiplicative_expression)*
+ ;
+
+multiplicative_expression
+ : (cast_expression) ('*' cast_expression | '/' cast_expression | '%' cast_expression)*
+ ;
+
+cast_expression
+ : '(' type_name ')' cast_expression
+ | unary_expression
+ ;
+
+unary_expression
+ : postfix_expression
+ | '++' unary_expression
+ | '--' unary_expression
+ | unary_operator cast_expression
+ | 'sizeof' unary_expression
+ | 'sizeof' '(' type_name ')'
+ ;
+
+postfix_expression
+locals [FuncCallText='']
+@init
+ {
+self.FuncCallText=''
+ }
+ : p=primary_expression {self.FuncCallText += $p.text}
+ ( '[' expression ']'
+ | '(' a=')'{self.StoreFunctionCalling($p.start.line, $p.start.column, $a.line, localctx.a.column, self.FuncCallText, '')}
+ | '(' c=argument_expression_list b=')' {self.StoreFunctionCalling($p.start.line, $p.start.column, $b.line, localctx.b.column, self.FuncCallText, $c.text)}
+ | '(' macro_parameter_list ')'
+ | '.' x=IDENTIFIER {self.FuncCallText += '.' + $x.text}
+ | '*' y=IDENTIFIER {self.FuncCallText = $y.text}
+ | '->' z=IDENTIFIER {self.FuncCallText += '->' + $z.text}
+ | '++'
+ | '--'
+ )*
+ ;
+
+macro_parameter_list
+ : parameter_declaration (',' parameter_declaration)*
+ ;
+
+unary_operator
+ : '&'
+ | '*'
+ | '+'
+ | '-'
+ | '~'
+ | '!'
+ ;
+
+primary_expression
+ : IDENTIFIER
+ | constant
+ | '(' expression ')'
+ ;
+
+constant
+ : HEX_LITERAL
+ | OCTAL_LITERAL
+ | DECIMAL_LITERAL
+ | CHARACTER_LITERAL
+ | (IDENTIFIER* STRING_LITERAL+)+ IDENTIFIER*
+ | FLOATING_POINT_LITERAL
+ ;
+
+/////
+
+expression
+ : assignment_expression (',' assignment_expression)*
+ ;
+
+constant_expression
+ : conditional_expression
+ ;
+
+assignment_expression
+ : lvalue assignment_operator assignment_expression
+ | conditional_expression
+ ;
+
+lvalue
+ : unary_expression
+ ;
+
+assignment_operator
+ : '='
+ | '*='
+ | '/='
+ | '%='
+ | '+='
+ | '-='
+ | '<<='
+ | '>>='
+ | '&='
+ | '^='
+ | '|='
+ ;
+
+conditional_expression
+ : e=logical_or_expression ('?' expression ':' conditional_expression {self.StorePredicateExpression($e.start.line, $e.start.column, $e.stop.line, $e.stop.column, $e.text)})?
+ ;
+
+logical_or_expression
+ : logical_and_expression ('||' logical_and_expression)*
+ ;
+
+logical_and_expression
+ : inclusive_or_expression ('&&' inclusive_or_expression)*
+ ;
+
+inclusive_or_expression
+ : exclusive_or_expression ('|' exclusive_or_expression)*
+ ;
+
+exclusive_or_expression
+ : and_expression ('^' and_expression)*
+ ;
+
+and_expression
+ : equality_expression ('&' equality_expression)*
+ ;
+equality_expression
+ : relational_expression (('=='|'!=') relational_expression )*
+ ;
+
+relational_expression
+ : shift_expression (('<'|'>'|'<='|'>=') shift_expression)*
+ ;
+
+shift_expression
+ : additive_expression (('<<'|'>>') additive_expression)*
+ ;
+
+// S t a t e m e n t s
+
+statement
+ : labeled_statement
+ | compound_statement
+ | expression_statement
+ | selection_statement
+ | iteration_statement
+ | jump_statement
+ | macro_statement
+ | asm2_statement
+ | asm1_statement
+ | asm_statement
+ | declaration
+ ;
+
+asm2_statement
+ : '__asm__'? IDENTIFIER '(' (~(';'))* ')' ';'
+ ;
+
+asm1_statement
+ : '_asm' '{' (~('}'))* '}'
+ ;
+
+asm_statement
+ : '__asm' '{' (~('}'))* '}'
+ ;
+
+macro_statement
+ : IDENTIFIER '(' declaration* statement_list? expression? ')'
+ ;
+
+labeled_statement
+ : IDENTIFIER ':' statement
+ | 'case' constant_expression ':' statement
+ | 'default' ':' statement
+ ;
+
+compound_statement
+ : '{' declaration* statement_list? '}'
+ ;
+
+statement_list
+ : statement+
+ ;
+
+expression_statement
+ : ';'
+ | expression ';'
+ ;
+
+selection_statement
+ : 'if' '(' e=expression ')' {self.StorePredicateExpression($e.start.line, $e.start.column, $e.stop.line, $e.stop.column, $e.text)} statement (:'else' statement)?
+ | 'switch' '(' expression ')' statement
+ ;
+
+iteration_statement
+ : 'while' '(' e=expression ')' statement {self.StorePredicateExpression($e.start.line, $e.start.column, $e.stop.line, $e.stop.column, $e.text)}
+ | 'do' statement 'while' '(' e=expression ')' ';' {self.StorePredicateExpression($e.start.line, $e.start.column, $e.stop.line, $e.stop.column, $e.text)}
+ //| 'for' '(' expression_statement e=expression_statement expression? ')' statement {self.StorePredicateExpression($e.start.line, $e.start.column, $e.stop.line, $e.stop.column, $e.text)}
+ ;
+
+jump_statement
+ : 'goto' IDENTIFIER ';'
+ | 'continue' ';'
+ | 'break' ';'
+ | 'return' ';'
+ | 'return' expression ';'
+ ;
+
+IDENTIFIER
+ : LETTER (LETTER|'0'..'9')*
+ ;
+
+fragment
+LETTER
+ : '$'
+ | 'A'..'Z'
+ | 'a'..'z'
+ | '_'
+ ;
+
+CHARACTER_LITERAL
+ : ('L')? '\'' ( EscapeSequence | ~('\''|'\\') ) '\''
+ ;
+
+STRING_LITERAL
+ : ('L')? '"' ( EscapeSequence | ~('\\'|'"') )* '"'
+ ;
+
+HEX_LITERAL : '0' ('x'|'X') HexDigit+ IntegerTypeSuffix? ;
+
+DECIMAL_LITERAL : ('0' | '1'..'9' '0'..'9'*) IntegerTypeSuffix? ;
+
+OCTAL_LITERAL : '0' ('0'..'7')+ IntegerTypeSuffix? ;
+
+fragment
+HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;
+
+fragment
+IntegerTypeSuffix
+ : ('u'|'U')
+ | ('l'|'L')
+ | ('u'|'U') ('l'|'L')
+ | ('u'|'U') ('l'|'L') ('l'|'L')
+ ;
+
+FLOATING_POINT_LITERAL
+ : ('0'..'9')+ '.' ('0'..'9')* Exponent? FloatTypeSuffix?
+ | '.' ('0'..'9')+ Exponent? FloatTypeSuffix?
+ | ('0'..'9')+ Exponent FloatTypeSuffix?
+ | ('0'..'9')+ Exponent? FloatTypeSuffix
+ ;
+
+fragment
+Exponent : ('e'|'E') ('+'|'-')? ('0'..'9')+ ;
+
+fragment
+FloatTypeSuffix : ('f'|'F'|'d'|'D') ;
+
+fragment
+EscapeSequence
+ : '\\' ('b'|'t'|'n'|'f'|'r'|'\''|'\\')
+ | OctalEscape
+ ;
+
+fragment
+OctalEscape
+ : '\\' ('0'..'3') ('0'..'7') ('0'..'7')
+ | '\\' ('0'..'7') ('0'..'7')
+ | '\\' ('0'..'7')
+ ;
+
+fragment
+UnicodeEscape
+ : '\\' 'u' HexDigit HexDigit HexDigit HexDigit
+ ;
+
+WS : (' '|'\r'|'\t'|'\u000C'|'\n')
+ -> channel(HIDDEN)
+ ;
+
+// ingore '\' of line concatenation
+BS : ('\\')
+ -> channel(HIDDEN)
+ ;
+
+UnicodeVocabulary
+ : '\u0003'..'\uFFFE'
+ ;
+
+COMMENT
+ : '/*' .*? '*/'
+ -> channel(HIDDEN)
+ ;
+
+LINE_COMMENT
+ : '//' ~('\n'|'\r')* '\r'? '\n'
+ -> channel(HIDDEN)
+ ;
+
+// ignore #line info for now
+LINE_COMMAND
+ : '#' ~('\n'|'\r')* '\r'? '\n'
+ -> channel(HIDDEN)
+ ;
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/CLexer.py b/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/CLexer.py
new file mode 100644
index 000000000..a2cc5bf56
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/CLexer.py
@@ -0,0 +1,626 @@
+# Generated from C.g4 by ANTLR 4.7.1
+from antlr4 import *
+from io import StringIO
+from typing.io import TextIO
+import sys
+
+
+## @file
+# The file defines the parser for C source files.
+#
+# THIS FILE IS AUTO-GENENERATED. PLEASE DON NOT MODIFY THIS FILE.
+# This file is generated by running:
+# java org.antlr.Tool C.g
+#
+# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+import Ecc.CodeFragment as CodeFragment
+import Ecc.FileProfile as FileProfile
+
+def serializedATN():
+ with StringIO() as buf:
+ buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2k")
+ buf.write("\u0383\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7")
+ buf.write("\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r")
+ buf.write("\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23")
+ buf.write("\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30")
+ buf.write("\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36")
+ buf.write("\t\36\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%")
+ buf.write("\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4,\t,\4-\t-\4.")
+ buf.write("\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64")
+ buf.write("\t\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:")
+ buf.write("\4;\t;\4<\t<\4=\t=\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\t")
+ buf.write("C\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4I\tI\4J\tJ\4K\tK\4L\t")
+ buf.write("L\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\tT\4U\t")
+ buf.write("U\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4")
+ buf.write("^\t^\4_\t_\4`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4")
+ buf.write("g\tg\4h\th\4i\ti\4j\tj\4k\tk\4l\tl\4m\tm\4n\tn\4o\to\4")
+ buf.write("p\tp\4q\tq\4r\tr\3\2\3\2\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3")
+ buf.write("\4\3\4\3\4\3\5\3\5\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7")
+ buf.write("\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\n\3")
+ buf.write("\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\13")
+ buf.write("\3\13\3\13\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\16")
+ buf.write("\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3\20\3\20")
+ buf.write("\3\20\3\20\3\20\3\21\3\21\3\21\3\21\3\21\3\21\3\22\3\22")
+ buf.write("\3\22\3\22\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3\23\3\23")
+ buf.write("\3\23\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\25")
+ buf.write("\3\25\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\27\3\27\3\27")
+ buf.write("\3\27\3\27\3\27\3\30\3\30\3\31\3\31\3\31\3\31\3\31\3\32")
+ buf.write("\3\32\3\32\3\32\3\32\3\32\3\33\3\33\3\33\3\33\3\33\3\33")
+ buf.write("\3\33\3\33\3\33\3\34\3\34\3\34\3\35\3\35\3\35\3\35\3\36")
+ buf.write("\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\37\3\37\3\37")
+ buf.write("\3\37\3\37\3\37\3 \3 \3 \3 \3 \3 \3 \3 \3 \3 \3!\3!\3")
+ buf.write("!\3!\3!\3!\3!\3!\3!\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3")
+ buf.write("\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"")
+ buf.write("\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3#\3#\3#\3#\3#\3#\3#")
+ buf.write("\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3%\3")
+ buf.write("%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3")
+ buf.write("&\3&\3&\3&\3&\3&\3&\3\'\3\'\3(\3(\3)\3)\3*\3*\3+\3+\3")
+ buf.write(",\3,\3,\3,\3-\3-\3.\3.\3/\3/\3\60\3\60\3\61\3\61\3\61")
+ buf.write("\3\62\3\62\3\62\3\63\3\63\3\63\3\63\3\63\3\63\3\63\3\64")
+ buf.write("\3\64\3\65\3\65\3\65\3\66\3\66\3\67\3\67\38\38\39\39\3")
+ buf.write("9\3:\3:\3:\3;\3;\3;\3<\3<\3<\3=\3=\3=\3>\3>\3>\3>\3?\3")
+ buf.write("?\3?\3?\3@\3@\3@\3A\3A\3A\3B\3B\3B\3C\3C\3D\3D\3D\3E\3")
+ buf.write("E\3E\3F\3F\3G\3G\3H\3H\3H\3I\3I\3I\3J\3J\3K\3K\3L\3L\3")
+ buf.write("L\3M\3M\3M\3N\3N\3N\3O\3O\3O\3P\3P\3P\3P\3P\3P\3P\3P\3")
+ buf.write("Q\3Q\3Q\3Q\3Q\3R\3R\3R\3R\3R\3R\3S\3S\3S\3S\3S\3T\3T\3")
+ buf.write("T\3T\3T\3T\3T\3T\3U\3U\3U\3V\3V\3V\3V\3V\3W\3W\3W\3W\3")
+ buf.write("W\3W\3W\3X\3X\3X\3X\3X\3X\3Y\3Y\3Y\3Z\3Z\3Z\3Z\3Z\3[\3")
+ buf.write("[\3[\3[\3[\3[\3[\3[\3[\3\\\3\\\3\\\3\\\3\\\3\\\3]\3]\3")
+ buf.write("]\3]\3]\3]\3]\3^\3^\3^\7^\u02b2\n^\f^\16^\u02b5\13^\3")
+ buf.write("_\3_\3`\5`\u02ba\n`\3`\3`\3`\5`\u02bf\n`\3`\3`\3a\5a\u02c4")
+ buf.write("\na\3a\3a\3a\7a\u02c9\na\fa\16a\u02cc\13a\3a\3a\3b\3b")
+ buf.write("\3b\6b\u02d3\nb\rb\16b\u02d4\3b\5b\u02d8\nb\3c\3c\3c\7")
+ buf.write("c\u02dd\nc\fc\16c\u02e0\13c\5c\u02e2\nc\3c\5c\u02e5\n")
+ buf.write("c\3d\3d\6d\u02e9\nd\rd\16d\u02ea\3d\5d\u02ee\nd\3e\3e")
+ buf.write("\3f\3f\3f\3f\3f\3f\5f\u02f8\nf\3g\6g\u02fb\ng\rg\16g\u02fc")
+ buf.write("\3g\3g\7g\u0301\ng\fg\16g\u0304\13g\3g\5g\u0307\ng\3g")
+ buf.write("\5g\u030a\ng\3g\3g\6g\u030e\ng\rg\16g\u030f\3g\5g\u0313")
+ buf.write("\ng\3g\5g\u0316\ng\3g\6g\u0319\ng\rg\16g\u031a\3g\3g\5")
+ buf.write("g\u031f\ng\3g\6g\u0322\ng\rg\16g\u0323\3g\5g\u0327\ng")
+ buf.write("\3g\5g\u032a\ng\3h\3h\5h\u032e\nh\3h\6h\u0331\nh\rh\16")
+ buf.write("h\u0332\3i\3i\3j\3j\3j\5j\u033a\nj\3k\3k\3k\3k\3k\3k\3")
+ buf.write("k\3k\3k\5k\u0345\nk\3l\3l\3l\3l\3l\3l\3l\3m\3m\3m\3m\3")
+ buf.write("n\3n\3n\3n\3o\3o\3p\3p\3p\3p\7p\u035c\np\fp\16p\u035f")
+ buf.write("\13p\3p\3p\3p\3p\3p\3q\3q\3q\3q\7q\u036a\nq\fq\16q\u036d")
+ buf.write("\13q\3q\5q\u0370\nq\3q\3q\3q\3q\3r\3r\7r\u0378\nr\fr\16")
+ buf.write("r\u037b\13r\3r\5r\u037e\nr\3r\3r\3r\3r\3\u035d\2s\3\3")
+ buf.write("\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16")
+ buf.write("\33\17\35\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61")
+ buf.write("\32\63\33\65\34\67\359\36;\37= ?!A\"C#E$G%I&K\'M(O)Q*")
+ buf.write("S+U,W-Y.[/]\60_\61a\62c\63e\64g\65i\66k\67m8o9q:s;u<w")
+ buf.write("=y>{?}@\177A\u0081B\u0083C\u0085D\u0087E\u0089F\u008b")
+ buf.write("G\u008dH\u008fI\u0091J\u0093K\u0095L\u0097M\u0099N\u009b")
+ buf.write("O\u009dP\u009fQ\u00a1R\u00a3S\u00a5T\u00a7U\u00a9V\u00ab")
+ buf.write("W\u00adX\u00afY\u00b1Z\u00b3[\u00b5\\\u00b7]\u00b9^\u00bb")
+ buf.write("_\u00bd\2\u00bf`\u00c1a\u00c3b\u00c5c\u00c7d\u00c9\2\u00cb")
+ buf.write("\2\u00cde\u00cf\2\u00d1\2\u00d3\2\u00d5\2\u00d7\2\u00d9")
+ buf.write("f\u00dbg\u00ddh\u00dfi\u00e1j\u00e3k\3\2\20\6\2&&C\\a")
+ buf.write("ac|\4\2))^^\4\2$$^^\4\2ZZzz\5\2\62;CHch\6\2NNWWnnww\4")
+ buf.write("\2WWww\4\2NNnn\4\2GGgg\4\2--//\6\2FFHHffhh\t\2))^^ddh")
+ buf.write("hppttvv\5\2\13\f\16\17\"\"\4\2\f\f\17\17\2\u03a2\2\3\3")
+ buf.write("\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2")
+ buf.write("\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2")
+ buf.write("\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2")
+ buf.write("\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2")
+ buf.write("\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3")
+ buf.write("\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2")
+ buf.write("\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3")
+ buf.write("\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K")
+ buf.write("\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2")
+ buf.write("U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2")
+ buf.write("\2_\3\2\2\2\2a\3\2\2\2\2c\3\2\2\2\2e\3\2\2\2\2g\3\2\2")
+ buf.write("\2\2i\3\2\2\2\2k\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2\2q\3\2")
+ buf.write("\2\2\2s\3\2\2\2\2u\3\2\2\2\2w\3\2\2\2\2y\3\2\2\2\2{\3")
+ buf.write("\2\2\2\2}\3\2\2\2\2\177\3\2\2\2\2\u0081\3\2\2\2\2\u0083")
+ buf.write("\3\2\2\2\2\u0085\3\2\2\2\2\u0087\3\2\2\2\2\u0089\3\2\2")
+ buf.write("\2\2\u008b\3\2\2\2\2\u008d\3\2\2\2\2\u008f\3\2\2\2\2\u0091")
+ buf.write("\3\2\2\2\2\u0093\3\2\2\2\2\u0095\3\2\2\2\2\u0097\3\2\2")
+ buf.write("\2\2\u0099\3\2\2\2\2\u009b\3\2\2\2\2\u009d\3\2\2\2\2\u009f")
+ buf.write("\3\2\2\2\2\u00a1\3\2\2\2\2\u00a3\3\2\2\2\2\u00a5\3\2\2")
+ buf.write("\2\2\u00a7\3\2\2\2\2\u00a9\3\2\2\2\2\u00ab\3\2\2\2\2\u00ad")
+ buf.write("\3\2\2\2\2\u00af\3\2\2\2\2\u00b1\3\2\2\2\2\u00b3\3\2\2")
+ buf.write("\2\2\u00b5\3\2\2\2\2\u00b7\3\2\2\2\2\u00b9\3\2\2\2\2\u00bb")
+ buf.write("\3\2\2\2\2\u00bf\3\2\2\2\2\u00c1\3\2\2\2\2\u00c3\3\2\2")
+ buf.write("\2\2\u00c5\3\2\2\2\2\u00c7\3\2\2\2\2\u00cd\3\2\2\2\2\u00d9")
+ buf.write("\3\2\2\2\2\u00db\3\2\2\2\2\u00dd\3\2\2\2\2\u00df\3\2\2")
+ buf.write("\2\2\u00e1\3\2\2\2\2\u00e3\3\2\2\2\3\u00e5\3\2\2\2\5\u00e7")
+ buf.write("\3\2\2\2\7\u00e9\3\2\2\2\t\u00f1\3\2\2\2\13\u00f3\3\2")
+ buf.write("\2\2\r\u00f5\3\2\2\2\17\u00fc\3\2\2\2\21\u0103\3\2\2\2")
+ buf.write("\23\u0108\3\2\2\2\25\u0111\3\2\2\2\27\u0118\3\2\2\2\31")
+ buf.write("\u011d\3\2\2\2\33\u0122\3\2\2\2\35\u0128\3\2\2\2\37\u012c")
+ buf.write("\3\2\2\2!\u0131\3\2\2\2#\u0137\3\2\2\2%\u013e\3\2\2\2")
+ buf.write("\'\u0145\3\2\2\2)\u014e\3\2\2\2+\u0150\3\2\2\2-\u0157")
+ buf.write("\3\2\2\2/\u015d\3\2\2\2\61\u015f\3\2\2\2\63\u0164\3\2")
+ buf.write("\2\2\65\u016a\3\2\2\2\67\u0173\3\2\2\29\u0176\3\2\2\2")
+ buf.write(";\u017a\3\2\2\2=\u0183\3\2\2\2?\u0189\3\2\2\2A\u0193\3")
+ buf.write("\2\2\2C\u019c\3\2\2\2E\u01ba\3\2\2\2G\u01c1\3\2\2\2I\u01d1")
+ buf.write("\3\2\2\2K\u01e4\3\2\2\2M\u01eb\3\2\2\2O\u01ed\3\2\2\2")
+ buf.write("Q\u01ef\3\2\2\2S\u01f1\3\2\2\2U\u01f3\3\2\2\2W\u01f5\3")
+ buf.write("\2\2\2Y\u01f9\3\2\2\2[\u01fb\3\2\2\2]\u01fd\3\2\2\2_\u01ff")
+ buf.write("\3\2\2\2a\u0201\3\2\2\2c\u0204\3\2\2\2e\u0207\3\2\2\2")
+ buf.write("g\u020e\3\2\2\2i\u0210\3\2\2\2k\u0213\3\2\2\2m\u0215\3")
+ buf.write("\2\2\2o\u0217\3\2\2\2q\u0219\3\2\2\2s\u021c\3\2\2\2u\u021f")
+ buf.write("\3\2\2\2w\u0222\3\2\2\2y\u0225\3\2\2\2{\u0228\3\2\2\2")
+ buf.write("}\u022c\3\2\2\2\177\u0230\3\2\2\2\u0081\u0233\3\2\2\2")
+ buf.write("\u0083\u0236\3\2\2\2\u0085\u0239\3\2\2\2\u0087\u023b\3")
+ buf.write("\2\2\2\u0089\u023e\3\2\2\2\u008b\u0241\3\2\2\2\u008d\u0243")
+ buf.write("\3\2\2\2\u008f\u0245\3\2\2\2\u0091\u0248\3\2\2\2\u0093")
+ buf.write("\u024b\3\2\2\2\u0095\u024d\3\2\2\2\u0097\u024f\3\2\2\2")
+ buf.write("\u0099\u0252\3\2\2\2\u009b\u0255\3\2\2\2\u009d\u0258\3")
+ buf.write("\2\2\2\u009f\u025b\3\2\2\2\u00a1\u0263\3\2\2\2\u00a3\u0268")
+ buf.write("\3\2\2\2\u00a5\u026e\3\2\2\2\u00a7\u0273\3\2\2\2\u00a9")
+ buf.write("\u027b\3\2\2\2\u00ab\u027e\3\2\2\2\u00ad\u0283\3\2\2\2")
+ buf.write("\u00af\u028a\3\2\2\2\u00b1\u0290\3\2\2\2\u00b3\u0293\3")
+ buf.write("\2\2\2\u00b5\u0298\3\2\2\2\u00b7\u02a1\3\2\2\2\u00b9\u02a7")
+ buf.write("\3\2\2\2\u00bb\u02ae\3\2\2\2\u00bd\u02b6\3\2\2\2\u00bf")
+ buf.write("\u02b9\3\2\2\2\u00c1\u02c3\3\2\2\2\u00c3\u02cf\3\2\2\2")
+ buf.write("\u00c5\u02e1\3\2\2\2\u00c7\u02e6\3\2\2\2\u00c9\u02ef\3")
+ buf.write("\2\2\2\u00cb\u02f7\3\2\2\2\u00cd\u0329\3\2\2\2\u00cf\u032b")
+ buf.write("\3\2\2\2\u00d1\u0334\3\2\2\2\u00d3\u0339\3\2\2\2\u00d5")
+ buf.write("\u0344\3\2\2\2\u00d7\u0346\3\2\2\2\u00d9\u034d\3\2\2\2")
+ buf.write("\u00db\u0351\3\2\2\2\u00dd\u0355\3\2\2\2\u00df\u0357\3")
+ buf.write("\2\2\2\u00e1\u0365\3\2\2\2\u00e3\u0375\3\2\2\2\u00e5\u00e6")
+ buf.write("\7}\2\2\u00e6\4\3\2\2\2\u00e7\u00e8\7=\2\2\u00e8\6\3\2")
+ buf.write("\2\2\u00e9\u00ea\7v\2\2\u00ea\u00eb\7{\2\2\u00eb\u00ec")
+ buf.write("\7r\2\2\u00ec\u00ed\7g\2\2\u00ed\u00ee\7f\2\2\u00ee\u00ef")
+ buf.write("\7g\2\2\u00ef\u00f0\7h\2\2\u00f0\b\3\2\2\2\u00f1\u00f2")
+ buf.write("\7.\2\2\u00f2\n\3\2\2\2\u00f3\u00f4\7?\2\2\u00f4\f\3\2")
+ buf.write("\2\2\u00f5\u00f6\7g\2\2\u00f6\u00f7\7z\2\2\u00f7\u00f8")
+ buf.write("\7v\2\2\u00f8\u00f9\7g\2\2\u00f9\u00fa\7t\2\2\u00fa\u00fb")
+ buf.write("\7p\2\2\u00fb\16\3\2\2\2\u00fc\u00fd\7u\2\2\u00fd\u00fe")
+ buf.write("\7v\2\2\u00fe\u00ff\7c\2\2\u00ff\u0100\7v\2\2\u0100\u0101")
+ buf.write("\7k\2\2\u0101\u0102\7e\2\2\u0102\20\3\2\2\2\u0103\u0104")
+ buf.write("\7c\2\2\u0104\u0105\7w\2\2\u0105\u0106\7v\2\2\u0106\u0107")
+ buf.write("\7q\2\2\u0107\22\3\2\2\2\u0108\u0109\7t\2\2\u0109\u010a")
+ buf.write("\7g\2\2\u010a\u010b\7i\2\2\u010b\u010c\7k\2\2\u010c\u010d")
+ buf.write("\7u\2\2\u010d\u010e\7v\2\2\u010e\u010f\7g\2\2\u010f\u0110")
+ buf.write("\7t\2\2\u0110\24\3\2\2\2\u0111\u0112\7U\2\2\u0112\u0113")
+ buf.write("\7V\2\2\u0113\u0114\7C\2\2\u0114\u0115\7V\2\2\u0115\u0116")
+ buf.write("\7K\2\2\u0116\u0117\7E\2\2\u0117\26\3\2\2\2\u0118\u0119")
+ buf.write("\7x\2\2\u0119\u011a\7q\2\2\u011a\u011b\7k\2\2\u011b\u011c")
+ buf.write("\7f\2\2\u011c\30\3\2\2\2\u011d\u011e\7e\2\2\u011e\u011f")
+ buf.write("\7j\2\2\u011f\u0120\7c\2\2\u0120\u0121\7t\2\2\u0121\32")
+ buf.write("\3\2\2\2\u0122\u0123\7u\2\2\u0123\u0124\7j\2\2\u0124\u0125")
+ buf.write("\7q\2\2\u0125\u0126\7t\2\2\u0126\u0127\7v\2\2\u0127\34")
+ buf.write("\3\2\2\2\u0128\u0129\7k\2\2\u0129\u012a\7p\2\2\u012a\u012b")
+ buf.write("\7v\2\2\u012b\36\3\2\2\2\u012c\u012d\7n\2\2\u012d\u012e")
+ buf.write("\7q\2\2\u012e\u012f\7p\2\2\u012f\u0130\7i\2\2\u0130 \3")
+ buf.write("\2\2\2\u0131\u0132\7h\2\2\u0132\u0133\7n\2\2\u0133\u0134")
+ buf.write("\7q\2\2\u0134\u0135\7c\2\2\u0135\u0136\7v\2\2\u0136\"")
+ buf.write("\3\2\2\2\u0137\u0138\7f\2\2\u0138\u0139\7q\2\2\u0139\u013a")
+ buf.write("\7w\2\2\u013a\u013b\7d\2\2\u013b\u013c\7n\2\2\u013c\u013d")
+ buf.write("\7g\2\2\u013d$\3\2\2\2\u013e\u013f\7u\2\2\u013f\u0140")
+ buf.write("\7k\2\2\u0140\u0141\7i\2\2\u0141\u0142\7p\2\2\u0142\u0143")
+ buf.write("\7g\2\2\u0143\u0144\7f\2\2\u0144&\3\2\2\2\u0145\u0146")
+ buf.write("\7w\2\2\u0146\u0147\7p\2\2\u0147\u0148\7u\2\2\u0148\u0149")
+ buf.write("\7k\2\2\u0149\u014a\7i\2\2\u014a\u014b\7p\2\2\u014b\u014c")
+ buf.write("\7g\2\2\u014c\u014d\7f\2\2\u014d(\3\2\2\2\u014e\u014f")
+ buf.write("\7\177\2\2\u014f*\3\2\2\2\u0150\u0151\7u\2\2\u0151\u0152")
+ buf.write("\7v\2\2\u0152\u0153\7t\2\2\u0153\u0154\7w\2\2\u0154\u0155")
+ buf.write("\7e\2\2\u0155\u0156\7v\2\2\u0156,\3\2\2\2\u0157\u0158")
+ buf.write("\7w\2\2\u0158\u0159\7p\2\2\u0159\u015a\7k\2\2\u015a\u015b")
+ buf.write("\7q\2\2\u015b\u015c\7p\2\2\u015c.\3\2\2\2\u015d\u015e")
+ buf.write("\7<\2\2\u015e\60\3\2\2\2\u015f\u0160\7g\2\2\u0160\u0161")
+ buf.write("\7p\2\2\u0161\u0162\7w\2\2\u0162\u0163\7o\2\2\u0163\62")
+ buf.write("\3\2\2\2\u0164\u0165\7e\2\2\u0165\u0166\7q\2\2\u0166\u0167")
+ buf.write("\7p\2\2\u0167\u0168\7u\2\2\u0168\u0169\7v\2\2\u0169\64")
+ buf.write("\3\2\2\2\u016a\u016b\7x\2\2\u016b\u016c\7q\2\2\u016c\u016d")
+ buf.write("\7n\2\2\u016d\u016e\7c\2\2\u016e\u016f\7v\2\2\u016f\u0170")
+ buf.write("\7k\2\2\u0170\u0171\7n\2\2\u0171\u0172\7g\2\2\u0172\66")
+ buf.write("\3\2\2\2\u0173\u0174\7K\2\2\u0174\u0175\7P\2\2\u01758")
+ buf.write("\3\2\2\2\u0176\u0177\7Q\2\2\u0177\u0178\7W\2\2\u0178\u0179")
+ buf.write("\7V\2\2\u0179:\3\2\2\2\u017a\u017b\7Q\2\2\u017b\u017c")
+ buf.write("\7R\2\2\u017c\u017d\7V\2\2\u017d\u017e\7K\2\2\u017e\u017f")
+ buf.write("\7Q\2\2\u017f\u0180\7P\2\2\u0180\u0181\7C\2\2\u0181\u0182")
+ buf.write("\7N\2\2\u0182<\3\2\2\2\u0183\u0184\7E\2\2\u0184\u0185")
+ buf.write("\7Q\2\2\u0185\u0186\7P\2\2\u0186\u0187\7U\2\2\u0187\u0188")
+ buf.write("\7V\2\2\u0188>\3\2\2\2\u0189\u018a\7W\2\2\u018a\u018b")
+ buf.write("\7P\2\2\u018b\u018c\7C\2\2\u018c\u018d\7N\2\2\u018d\u018e")
+ buf.write("\7K\2\2\u018e\u018f\7I\2\2\u018f\u0190\7P\2\2\u0190\u0191")
+ buf.write("\7G\2\2\u0191\u0192\7F\2\2\u0192@\3\2\2\2\u0193\u0194")
+ buf.write("\7X\2\2\u0194\u0195\7Q\2\2\u0195\u0196\7N\2\2\u0196\u0197")
+ buf.write("\7C\2\2\u0197\u0198\7V\2\2\u0198\u0199\7K\2\2\u0199\u019a")
+ buf.write("\7N\2\2\u019a\u019b\7G\2\2\u019bB\3\2\2\2\u019c\u019d")
+ buf.write("\7I\2\2\u019d\u019e\7N\2\2\u019e\u019f\7Q\2\2\u019f\u01a0")
+ buf.write("\7D\2\2\u01a0\u01a1\7C\2\2\u01a1\u01a2\7N\2\2\u01a2\u01a3")
+ buf.write("\7a\2\2\u01a3\u01a4\7T\2\2\u01a4\u01a5\7G\2\2\u01a5\u01a6")
+ buf.write("\7O\2\2\u01a6\u01a7\7Q\2\2\u01a7\u01a8\7X\2\2\u01a8\u01a9")
+ buf.write("\7G\2\2\u01a9\u01aa\7a\2\2\u01aa\u01ab\7K\2\2\u01ab\u01ac")
+ buf.write("\7H\2\2\u01ac\u01ad\7a\2\2\u01ad\u01ae\7W\2\2\u01ae\u01af")
+ buf.write("\7P\2\2\u01af\u01b0\7T\2\2\u01b0\u01b1\7G\2\2\u01b1\u01b2")
+ buf.write("\7H\2\2\u01b2\u01b3\7G\2\2\u01b3\u01b4\7T\2\2\u01b4\u01b5")
+ buf.write("\7G\2\2\u01b5\u01b6\7P\2\2\u01b6\u01b7\7E\2\2\u01b7\u01b8")
+ buf.write("\7G\2\2\u01b8\u01b9\7F\2\2\u01b9D\3\2\2\2\u01ba\u01bb")
+ buf.write("\7G\2\2\u01bb\u01bc\7H\2\2\u01bc\u01bd\7K\2\2\u01bd\u01be")
+ buf.write("\7C\2\2\u01be\u01bf\7R\2\2\u01bf\u01c0\7K\2\2\u01c0F\3")
+ buf.write("\2\2\2\u01c1\u01c2\7G\2\2\u01c2\u01c3\7H\2\2\u01c3\u01c4")
+ buf.write("\7K\2\2\u01c4\u01c5\7a\2\2\u01c5\u01c6\7D\2\2\u01c6\u01c7")
+ buf.write("\7Q\2\2\u01c7\u01c8\7Q\2\2\u01c8\u01c9\7V\2\2\u01c9\u01ca")
+ buf.write("\7U\2\2\u01ca\u01cb\7G\2\2\u01cb\u01cc\7T\2\2\u01cc\u01cd")
+ buf.write("\7X\2\2\u01cd\u01ce\7K\2\2\u01ce\u01cf\7E\2\2\u01cf\u01d0")
+ buf.write("\7G\2\2\u01d0H\3\2\2\2\u01d1\u01d2\7G\2\2\u01d2\u01d3")
+ buf.write("\7H\2\2\u01d3\u01d4\7K\2\2\u01d4\u01d5\7a\2\2\u01d5\u01d6")
+ buf.write("\7T\2\2\u01d6\u01d7\7W\2\2\u01d7\u01d8\7P\2\2\u01d8\u01d9")
+ buf.write("\7V\2\2\u01d9\u01da\7K\2\2\u01da\u01db\7O\2\2\u01db\u01dc")
+ buf.write("\7G\2\2\u01dc\u01dd\7U\2\2\u01dd\u01de\7G\2\2\u01de\u01df")
+ buf.write("\7T\2\2\u01df\u01e0\7X\2\2\u01e0\u01e1\7K\2\2\u01e1\u01e2")
+ buf.write("\7E\2\2\u01e2\u01e3\7G\2\2\u01e3J\3\2\2\2\u01e4\u01e5")
+ buf.write("\7R\2\2\u01e5\u01e6\7C\2\2\u01e6\u01e7\7E\2\2\u01e7\u01e8")
+ buf.write("\7M\2\2\u01e8\u01e9\7G\2\2\u01e9\u01ea\7F\2\2\u01eaL\3")
+ buf.write("\2\2\2\u01eb\u01ec\7*\2\2\u01ecN\3\2\2\2\u01ed\u01ee\7")
+ buf.write("+\2\2\u01eeP\3\2\2\2\u01ef\u01f0\7]\2\2\u01f0R\3\2\2\2")
+ buf.write("\u01f1\u01f2\7_\2\2\u01f2T\3\2\2\2\u01f3\u01f4\7,\2\2")
+ buf.write("\u01f4V\3\2\2\2\u01f5\u01f6\7\60\2\2\u01f6\u01f7\7\60")
+ buf.write("\2\2\u01f7\u01f8\7\60\2\2\u01f8X\3\2\2\2\u01f9\u01fa\7")
+ buf.write("-\2\2\u01faZ\3\2\2\2\u01fb\u01fc\7/\2\2\u01fc\\\3\2\2")
+ buf.write("\2\u01fd\u01fe\7\61\2\2\u01fe^\3\2\2\2\u01ff\u0200\7\'")
+ buf.write("\2\2\u0200`\3\2\2\2\u0201\u0202\7-\2\2\u0202\u0203\7-")
+ buf.write("\2\2\u0203b\3\2\2\2\u0204\u0205\7/\2\2\u0205\u0206\7/")
+ buf.write("\2\2\u0206d\3\2\2\2\u0207\u0208\7u\2\2\u0208\u0209\7k")
+ buf.write("\2\2\u0209\u020a\7|\2\2\u020a\u020b\7g\2\2\u020b\u020c")
+ buf.write("\7q\2\2\u020c\u020d\7h\2\2\u020df\3\2\2\2\u020e\u020f")
+ buf.write("\7\60\2\2\u020fh\3\2\2\2\u0210\u0211\7/\2\2\u0211\u0212")
+ buf.write("\7@\2\2\u0212j\3\2\2\2\u0213\u0214\7(\2\2\u0214l\3\2\2")
+ buf.write("\2\u0215\u0216\7\u0080\2\2\u0216n\3\2\2\2\u0217\u0218")
+ buf.write("\7#\2\2\u0218p\3\2\2\2\u0219\u021a\7,\2\2\u021a\u021b")
+ buf.write("\7?\2\2\u021br\3\2\2\2\u021c\u021d\7\61\2\2\u021d\u021e")
+ buf.write("\7?\2\2\u021et\3\2\2\2\u021f\u0220\7\'\2\2\u0220\u0221")
+ buf.write("\7?\2\2\u0221v\3\2\2\2\u0222\u0223\7-\2\2\u0223\u0224")
+ buf.write("\7?\2\2\u0224x\3\2\2\2\u0225\u0226\7/\2\2\u0226\u0227")
+ buf.write("\7?\2\2\u0227z\3\2\2\2\u0228\u0229\7>\2\2\u0229\u022a")
+ buf.write("\7>\2\2\u022a\u022b\7?\2\2\u022b|\3\2\2\2\u022c\u022d")
+ buf.write("\7@\2\2\u022d\u022e\7@\2\2\u022e\u022f\7?\2\2\u022f~\3")
+ buf.write("\2\2\2\u0230\u0231\7(\2\2\u0231\u0232\7?\2\2\u0232\u0080")
+ buf.write("\3\2\2\2\u0233\u0234\7`\2\2\u0234\u0235\7?\2\2\u0235\u0082")
+ buf.write("\3\2\2\2\u0236\u0237\7~\2\2\u0237\u0238\7?\2\2\u0238\u0084")
+ buf.write("\3\2\2\2\u0239\u023a\7A\2\2\u023a\u0086\3\2\2\2\u023b")
+ buf.write("\u023c\7~\2\2\u023c\u023d\7~\2\2\u023d\u0088\3\2\2\2\u023e")
+ buf.write("\u023f\7(\2\2\u023f\u0240\7(\2\2\u0240\u008a\3\2\2\2\u0241")
+ buf.write("\u0242\7~\2\2\u0242\u008c\3\2\2\2\u0243\u0244\7`\2\2\u0244")
+ buf.write("\u008e\3\2\2\2\u0245\u0246\7?\2\2\u0246\u0247\7?\2\2\u0247")
+ buf.write("\u0090\3\2\2\2\u0248\u0249\7#\2\2\u0249\u024a\7?\2\2\u024a")
+ buf.write("\u0092\3\2\2\2\u024b\u024c\7>\2\2\u024c\u0094\3\2\2\2")
+ buf.write("\u024d\u024e\7@\2\2\u024e\u0096\3\2\2\2\u024f\u0250\7")
+ buf.write(">\2\2\u0250\u0251\7?\2\2\u0251\u0098\3\2\2\2\u0252\u0253")
+ buf.write("\7@\2\2\u0253\u0254\7?\2\2\u0254\u009a\3\2\2\2\u0255\u0256")
+ buf.write("\7>\2\2\u0256\u0257\7>\2\2\u0257\u009c\3\2\2\2\u0258\u0259")
+ buf.write("\7@\2\2\u0259\u025a\7@\2\2\u025a\u009e\3\2\2\2\u025b\u025c")
+ buf.write("\7a\2\2\u025c\u025d\7a\2\2\u025d\u025e\7c\2\2\u025e\u025f")
+ buf.write("\7u\2\2\u025f\u0260\7o\2\2\u0260\u0261\7a\2\2\u0261\u0262")
+ buf.write("\7a\2\2\u0262\u00a0\3\2\2\2\u0263\u0264\7a\2\2\u0264\u0265")
+ buf.write("\7c\2\2\u0265\u0266\7u\2\2\u0266\u0267\7o\2\2\u0267\u00a2")
+ buf.write("\3\2\2\2\u0268\u0269\7a\2\2\u0269\u026a\7a\2\2\u026a\u026b")
+ buf.write("\7c\2\2\u026b\u026c\7u\2\2\u026c\u026d\7o\2\2\u026d\u00a4")
+ buf.write("\3\2\2\2\u026e\u026f\7e\2\2\u026f\u0270\7c\2\2\u0270\u0271")
+ buf.write("\7u\2\2\u0271\u0272\7g\2\2\u0272\u00a6\3\2\2\2\u0273\u0274")
+ buf.write("\7f\2\2\u0274\u0275\7g\2\2\u0275\u0276\7h\2\2\u0276\u0277")
+ buf.write("\7c\2\2\u0277\u0278\7w\2\2\u0278\u0279\7n\2\2\u0279\u027a")
+ buf.write("\7v\2\2\u027a\u00a8\3\2\2\2\u027b\u027c\7k\2\2\u027c\u027d")
+ buf.write("\7h\2\2\u027d\u00aa\3\2\2\2\u027e\u027f\7g\2\2\u027f\u0280")
+ buf.write("\7n\2\2\u0280\u0281\7u\2\2\u0281\u0282\7g\2\2\u0282\u00ac")
+ buf.write("\3\2\2\2\u0283\u0284\7u\2\2\u0284\u0285\7y\2\2\u0285\u0286")
+ buf.write("\7k\2\2\u0286\u0287\7v\2\2\u0287\u0288\7e\2\2\u0288\u0289")
+ buf.write("\7j\2\2\u0289\u00ae\3\2\2\2\u028a\u028b\7y\2\2\u028b\u028c")
+ buf.write("\7j\2\2\u028c\u028d\7k\2\2\u028d\u028e\7n\2\2\u028e\u028f")
+ buf.write("\7g\2\2\u028f\u00b0\3\2\2\2\u0290\u0291\7f\2\2\u0291\u0292")
+ buf.write("\7q\2\2\u0292\u00b2\3\2\2\2\u0293\u0294\7i\2\2\u0294\u0295")
+ buf.write("\7q\2\2\u0295\u0296\7v\2\2\u0296\u0297\7q\2\2\u0297\u00b4")
+ buf.write("\3\2\2\2\u0298\u0299\7e\2\2\u0299\u029a\7q\2\2\u029a\u029b")
+ buf.write("\7p\2\2\u029b\u029c\7v\2\2\u029c\u029d\7k\2\2\u029d\u029e")
+ buf.write("\7p\2\2\u029e\u029f\7w\2\2\u029f\u02a0\7g\2\2\u02a0\u00b6")
+ buf.write("\3\2\2\2\u02a1\u02a2\7d\2\2\u02a2\u02a3\7t\2\2\u02a3\u02a4")
+ buf.write("\7g\2\2\u02a4\u02a5\7c\2\2\u02a5\u02a6\7m\2\2\u02a6\u00b8")
+ buf.write("\3\2\2\2\u02a7\u02a8\7t\2\2\u02a8\u02a9\7g\2\2\u02a9\u02aa")
+ buf.write("\7v\2\2\u02aa\u02ab\7w\2\2\u02ab\u02ac\7t\2\2\u02ac\u02ad")
+ buf.write("\7p\2\2\u02ad\u00ba\3\2\2\2\u02ae\u02b3\5\u00bd_\2\u02af")
+ buf.write("\u02b2\5\u00bd_\2\u02b0\u02b2\4\62;\2\u02b1\u02af\3\2")
+ buf.write("\2\2\u02b1\u02b0\3\2\2\2\u02b2\u02b5\3\2\2\2\u02b3\u02b1")
+ buf.write("\3\2\2\2\u02b3\u02b4\3\2\2\2\u02b4\u00bc\3\2\2\2\u02b5")
+ buf.write("\u02b3\3\2\2\2\u02b6\u02b7\t\2\2\2\u02b7\u00be\3\2\2\2")
+ buf.write("\u02b8\u02ba\7N\2\2\u02b9\u02b8\3\2\2\2\u02b9\u02ba\3")
+ buf.write("\2\2\2\u02ba\u02bb\3\2\2\2\u02bb\u02be\7)\2\2\u02bc\u02bf")
+ buf.write("\5\u00d3j\2\u02bd\u02bf\n\3\2\2\u02be\u02bc\3\2\2\2\u02be")
+ buf.write("\u02bd\3\2\2\2\u02bf\u02c0\3\2\2\2\u02c0\u02c1\7)\2\2")
+ buf.write("\u02c1\u00c0\3\2\2\2\u02c2\u02c4\7N\2\2\u02c3\u02c2\3")
+ buf.write("\2\2\2\u02c3\u02c4\3\2\2\2\u02c4\u02c5\3\2\2\2\u02c5\u02ca")
+ buf.write("\7$\2\2\u02c6\u02c9\5\u00d3j\2\u02c7\u02c9\n\4\2\2\u02c8")
+ buf.write("\u02c6\3\2\2\2\u02c8\u02c7\3\2\2\2\u02c9\u02cc\3\2\2\2")
+ buf.write("\u02ca\u02c8\3\2\2\2\u02ca\u02cb\3\2\2\2\u02cb\u02cd\3")
+ buf.write("\2\2\2\u02cc\u02ca\3\2\2\2\u02cd\u02ce\7$\2\2\u02ce\u00c2")
+ buf.write("\3\2\2\2\u02cf\u02d0\7\62\2\2\u02d0\u02d2\t\5\2\2\u02d1")
+ buf.write("\u02d3\5\u00c9e\2\u02d2\u02d1\3\2\2\2\u02d3\u02d4\3\2")
+ buf.write("\2\2\u02d4\u02d2\3\2\2\2\u02d4\u02d5\3\2\2\2\u02d5\u02d7")
+ buf.write("\3\2\2\2\u02d6\u02d8\5\u00cbf\2\u02d7\u02d6\3\2\2\2\u02d7")
+ buf.write("\u02d8\3\2\2\2\u02d8\u00c4\3\2\2\2\u02d9\u02e2\7\62\2")
+ buf.write("\2\u02da\u02de\4\63;\2\u02db\u02dd\4\62;\2\u02dc\u02db")
+ buf.write("\3\2\2\2\u02dd\u02e0\3\2\2\2\u02de\u02dc\3\2\2\2\u02de")
+ buf.write("\u02df\3\2\2\2\u02df\u02e2\3\2\2\2\u02e0\u02de\3\2\2\2")
+ buf.write("\u02e1\u02d9\3\2\2\2\u02e1\u02da\3\2\2\2\u02e2\u02e4\3")
+ buf.write("\2\2\2\u02e3\u02e5\5\u00cbf\2\u02e4\u02e3\3\2\2\2\u02e4")
+ buf.write("\u02e5\3\2\2\2\u02e5\u00c6\3\2\2\2\u02e6\u02e8\7\62\2")
+ buf.write("\2\u02e7\u02e9\4\629\2\u02e8\u02e7\3\2\2\2\u02e9\u02ea")
+ buf.write("\3\2\2\2\u02ea\u02e8\3\2\2\2\u02ea\u02eb\3\2\2\2\u02eb")
+ buf.write("\u02ed\3\2\2\2\u02ec\u02ee\5\u00cbf\2\u02ed\u02ec\3\2")
+ buf.write("\2\2\u02ed\u02ee\3\2\2\2\u02ee\u00c8\3\2\2\2\u02ef\u02f0")
+ buf.write("\t\6\2\2\u02f0\u00ca\3\2\2\2\u02f1\u02f8\t\7\2\2\u02f2")
+ buf.write("\u02f3\t\b\2\2\u02f3\u02f8\t\t\2\2\u02f4\u02f5\t\b\2\2")
+ buf.write("\u02f5\u02f6\t\t\2\2\u02f6\u02f8\t\t\2\2\u02f7\u02f1\3")
+ buf.write("\2\2\2\u02f7\u02f2\3\2\2\2\u02f7\u02f4\3\2\2\2\u02f8\u00cc")
+ buf.write("\3\2\2\2\u02f9\u02fb\4\62;\2\u02fa\u02f9\3\2\2\2\u02fb")
+ buf.write("\u02fc\3\2\2\2\u02fc\u02fa\3\2\2\2\u02fc\u02fd\3\2\2\2")
+ buf.write("\u02fd\u02fe\3\2\2\2\u02fe\u0302\7\60\2\2\u02ff\u0301")
+ buf.write("\4\62;\2\u0300\u02ff\3\2\2\2\u0301\u0304\3\2\2\2\u0302")
+ buf.write("\u0300\3\2\2\2\u0302\u0303\3\2\2\2\u0303\u0306\3\2\2\2")
+ buf.write("\u0304\u0302\3\2\2\2\u0305\u0307\5\u00cfh\2\u0306\u0305")
+ buf.write("\3\2\2\2\u0306\u0307\3\2\2\2\u0307\u0309\3\2\2\2\u0308")
+ buf.write("\u030a\5\u00d1i\2\u0309\u0308\3\2\2\2\u0309\u030a\3\2")
+ buf.write("\2\2\u030a\u032a\3\2\2\2\u030b\u030d\7\60\2\2\u030c\u030e")
+ buf.write("\4\62;\2\u030d\u030c\3\2\2\2\u030e\u030f\3\2\2\2\u030f")
+ buf.write("\u030d\3\2\2\2\u030f\u0310\3\2\2\2\u0310\u0312\3\2\2\2")
+ buf.write("\u0311\u0313\5\u00cfh\2\u0312\u0311\3\2\2\2\u0312\u0313")
+ buf.write("\3\2\2\2\u0313\u0315\3\2\2\2\u0314\u0316\5\u00d1i\2\u0315")
+ buf.write("\u0314\3\2\2\2\u0315\u0316\3\2\2\2\u0316\u032a\3\2\2\2")
+ buf.write("\u0317\u0319\4\62;\2\u0318\u0317\3\2\2\2\u0319\u031a\3")
+ buf.write("\2\2\2\u031a\u0318\3\2\2\2\u031a\u031b\3\2\2\2\u031b\u031c")
+ buf.write("\3\2\2\2\u031c\u031e\5\u00cfh\2\u031d\u031f\5\u00d1i\2")
+ buf.write("\u031e\u031d\3\2\2\2\u031e\u031f\3\2\2\2\u031f\u032a\3")
+ buf.write("\2\2\2\u0320\u0322\4\62;\2\u0321\u0320\3\2\2\2\u0322\u0323")
+ buf.write("\3\2\2\2\u0323\u0321\3\2\2\2\u0323\u0324\3\2\2\2\u0324")
+ buf.write("\u0326\3\2\2\2\u0325\u0327\5\u00cfh\2\u0326\u0325\3\2")
+ buf.write("\2\2\u0326\u0327\3\2\2\2\u0327\u0328\3\2\2\2\u0328\u032a")
+ buf.write("\5\u00d1i\2\u0329\u02fa\3\2\2\2\u0329\u030b\3\2\2\2\u0329")
+ buf.write("\u0318\3\2\2\2\u0329\u0321\3\2\2\2\u032a\u00ce\3\2\2\2")
+ buf.write("\u032b\u032d\t\n\2\2\u032c\u032e\t\13\2\2\u032d\u032c")
+ buf.write("\3\2\2\2\u032d\u032e\3\2\2\2\u032e\u0330\3\2\2\2\u032f")
+ buf.write("\u0331\4\62;\2\u0330\u032f\3\2\2\2\u0331\u0332\3\2\2\2")
+ buf.write("\u0332\u0330\3\2\2\2\u0332\u0333\3\2\2\2\u0333\u00d0\3")
+ buf.write("\2\2\2\u0334\u0335\t\f\2\2\u0335\u00d2\3\2\2\2\u0336\u0337")
+ buf.write("\7^\2\2\u0337\u033a\t\r\2\2\u0338\u033a\5\u00d5k\2\u0339")
+ buf.write("\u0336\3\2\2\2\u0339\u0338\3\2\2\2\u033a\u00d4\3\2\2\2")
+ buf.write("\u033b\u033c\7^\2\2\u033c\u033d\4\62\65\2\u033d\u033e")
+ buf.write("\4\629\2\u033e\u0345\4\629\2\u033f\u0340\7^\2\2\u0340")
+ buf.write("\u0341\4\629\2\u0341\u0345\4\629\2\u0342\u0343\7^\2\2")
+ buf.write("\u0343\u0345\4\629\2\u0344\u033b\3\2\2\2\u0344\u033f\3")
+ buf.write("\2\2\2\u0344\u0342\3\2\2\2\u0345\u00d6\3\2\2\2\u0346\u0347")
+ buf.write("\7^\2\2\u0347\u0348\7w\2\2\u0348\u0349\5\u00c9e\2\u0349")
+ buf.write("\u034a\5\u00c9e\2\u034a\u034b\5\u00c9e\2\u034b\u034c\5")
+ buf.write("\u00c9e\2\u034c\u00d8\3\2\2\2\u034d\u034e\t\16\2\2\u034e")
+ buf.write("\u034f\3\2\2\2\u034f\u0350\bm\2\2\u0350\u00da\3\2\2\2")
+ buf.write("\u0351\u0352\7^\2\2\u0352\u0353\3\2\2\2\u0353\u0354\b")
+ buf.write("n\2\2\u0354\u00dc\3\2\2\2\u0355\u0356\4\5\0\2\u0356\u00de")
+ buf.write("\3\2\2\2\u0357\u0358\7\61\2\2\u0358\u0359\7,\2\2\u0359")
+ buf.write("\u035d\3\2\2\2\u035a\u035c\13\2\2\2\u035b\u035a\3\2\2")
+ buf.write("\2\u035c\u035f\3\2\2\2\u035d\u035e\3\2\2\2\u035d\u035b")
+ buf.write("\3\2\2\2\u035e\u0360\3\2\2\2\u035f\u035d\3\2\2\2\u0360")
+ buf.write("\u0361\7,\2\2\u0361\u0362\7\61\2\2\u0362\u0363\3\2\2\2")
+ buf.write("\u0363\u0364\bp\2\2\u0364\u00e0\3\2\2\2\u0365\u0366\7")
+ buf.write("\61\2\2\u0366\u0367\7\61\2\2\u0367\u036b\3\2\2\2\u0368")
+ buf.write("\u036a\n\17\2\2\u0369\u0368\3\2\2\2\u036a\u036d\3\2\2")
+ buf.write("\2\u036b\u0369\3\2\2\2\u036b\u036c\3\2\2\2\u036c\u036f")
+ buf.write("\3\2\2\2\u036d\u036b\3\2\2\2\u036e\u0370\7\17\2\2\u036f")
+ buf.write("\u036e\3\2\2\2\u036f\u0370\3\2\2\2\u0370\u0371\3\2\2\2")
+ buf.write("\u0371\u0372\7\f\2\2\u0372\u0373\3\2\2\2\u0373\u0374\b")
+ buf.write("q\2\2\u0374\u00e2\3\2\2\2\u0375\u0379\7%\2\2\u0376\u0378")
+ buf.write("\n\17\2\2\u0377\u0376\3\2\2\2\u0378\u037b\3\2\2\2\u0379")
+ buf.write("\u0377\3\2\2\2\u0379\u037a\3\2\2\2\u037a\u037d\3\2\2\2")
+ buf.write("\u037b\u0379\3\2\2\2\u037c\u037e\7\17\2\2\u037d\u037c")
+ buf.write("\3\2\2\2\u037d\u037e\3\2\2\2\u037e\u037f\3\2\2\2\u037f")
+ buf.write("\u0380\7\f\2\2\u0380\u0381\3\2\2\2\u0381\u0382\br\2\2")
+ buf.write("\u0382\u00e4\3\2\2\2\'\2\u02b1\u02b3\u02b9\u02be\u02c3")
+ buf.write("\u02c8\u02ca\u02d4\u02d7\u02de\u02e1\u02e4\u02ea\u02ed")
+ buf.write("\u02f7\u02fc\u0302\u0306\u0309\u030f\u0312\u0315\u031a")
+ buf.write("\u031e\u0323\u0326\u0329\u032d\u0332\u0339\u0344\u035d")
+ buf.write("\u036b\u036f\u0379\u037d\3\2\3\2")
+ return buf.getvalue()
+
+
+class CLexer(Lexer):
+
+ atn = ATNDeserializer().deserialize(serializedATN())
+
+ decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
+
+ T__0 = 1
+ T__1 = 2
+ T__2 = 3
+ T__3 = 4
+ T__4 = 5
+ T__5 = 6
+ T__6 = 7
+ T__7 = 8
+ T__8 = 9
+ T__9 = 10
+ T__10 = 11
+ T__11 = 12
+ T__12 = 13
+ T__13 = 14
+ T__14 = 15
+ T__15 = 16
+ T__16 = 17
+ T__17 = 18
+ T__18 = 19
+ T__19 = 20
+ T__20 = 21
+ T__21 = 22
+ T__22 = 23
+ T__23 = 24
+ T__24 = 25
+ T__25 = 26
+ T__26 = 27
+ T__27 = 28
+ T__28 = 29
+ T__29 = 30
+ T__30 = 31
+ T__31 = 32
+ T__32 = 33
+ T__33 = 34
+ T__34 = 35
+ T__35 = 36
+ T__36 = 37
+ T__37 = 38
+ T__38 = 39
+ T__39 = 40
+ T__40 = 41
+ T__41 = 42
+ T__42 = 43
+ T__43 = 44
+ T__44 = 45
+ T__45 = 46
+ T__46 = 47
+ T__47 = 48
+ T__48 = 49
+ T__49 = 50
+ T__50 = 51
+ T__51 = 52
+ T__52 = 53
+ T__53 = 54
+ T__54 = 55
+ T__55 = 56
+ T__56 = 57
+ T__57 = 58
+ T__58 = 59
+ T__59 = 60
+ T__60 = 61
+ T__61 = 62
+ T__62 = 63
+ T__63 = 64
+ T__64 = 65
+ T__65 = 66
+ T__66 = 67
+ T__67 = 68
+ T__68 = 69
+ T__69 = 70
+ T__70 = 71
+ T__71 = 72
+ T__72 = 73
+ T__73 = 74
+ T__74 = 75
+ T__75 = 76
+ T__76 = 77
+ T__77 = 78
+ T__78 = 79
+ T__79 = 80
+ T__80 = 81
+ T__81 = 82
+ T__82 = 83
+ T__83 = 84
+ T__84 = 85
+ T__85 = 86
+ T__86 = 87
+ T__87 = 88
+ T__88 = 89
+ T__89 = 90
+ T__90 = 91
+ T__91 = 92
+ IDENTIFIER = 93
+ CHARACTER_LITERAL = 94
+ STRING_LITERAL = 95
+ HEX_LITERAL = 96
+ DECIMAL_LITERAL = 97
+ OCTAL_LITERAL = 98
+ FLOATING_POINT_LITERAL = 99
+ WS = 100
+ BS = 101
+ UnicodeVocabulary = 102
+ COMMENT = 103
+ LINE_COMMENT = 104
+ LINE_COMMAND = 105
+
+ channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ]
+
+ modeNames = [ "DEFAULT_MODE" ]
+
+ literalNames = [ "<INVALID>",
+ "'{'", "';'", "'typedef'", "','", "'='", "'extern'", "'static'",
+ "'auto'", "'register'", "'STATIC'", "'void'", "'char'", "'short'",
+ "'int'", "'long'", "'float'", "'double'", "'signed'", "'unsigned'",
+ "'}'", "'struct'", "'union'", "':'", "'enum'", "'const'", "'volatile'",
+ "'IN'", "'OUT'", "'OPTIONAL'", "'CONST'", "'UNALIGNED'", "'VOLATILE'",
+ "'GLOBAL_REMOVE_IF_UNREFERENCED'", "'EFIAPI'", "'EFI_BOOTSERVICE'",
+ "'EFI_RUNTIMESERVICE'", "'PACKED'", "'('", "')'", "'['", "']'",
+ "'*'", "'...'", "'+'", "'-'", "'/'", "'%'", "'++'", "'--'",
+ "'sizeof'", "'.'", "'->'", "'&'", "'~'", "'!'", "'*='", "'/='",
+ "'%='", "'+='", "'-='", "'<<='", "'>>='", "'&='", "'^='", "'|='",
+ "'?'", "'||'", "'&&'", "'|'", "'^'", "'=='", "'!='", "'<'",
+ "'>'", "'<='", "'>='", "'<<'", "'>>'", "'__asm__'", "'_asm'",
+ "'__asm'", "'case'", "'default'", "'if'", "'else'", "'switch'",
+ "'while'", "'do'", "'goto'", "'continue'", "'break'", "'return'" ]
+
+ symbolicNames = [ "<INVALID>",
+ "IDENTIFIER", "CHARACTER_LITERAL", "STRING_LITERAL", "HEX_LITERAL",
+ "DECIMAL_LITERAL", "OCTAL_LITERAL", "FLOATING_POINT_LITERAL",
+ "WS", "BS", "UnicodeVocabulary", "COMMENT", "LINE_COMMENT",
+ "LINE_COMMAND" ]
+
+ ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6",
+ "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "T__13",
+ "T__14", "T__15", "T__16", "T__17", "T__18", "T__19",
+ "T__20", "T__21", "T__22", "T__23", "T__24", "T__25",
+ "T__26", "T__27", "T__28", "T__29", "T__30", "T__31",
+ "T__32", "T__33", "T__34", "T__35", "T__36", "T__37",
+ "T__38", "T__39", "T__40", "T__41", "T__42", "T__43",
+ "T__44", "T__45", "T__46", "T__47", "T__48", "T__49",
+ "T__50", "T__51", "T__52", "T__53", "T__54", "T__55",
+ "T__56", "T__57", "T__58", "T__59", "T__60", "T__61",
+ "T__62", "T__63", "T__64", "T__65", "T__66", "T__67",
+ "T__68", "T__69", "T__70", "T__71", "T__72", "T__73",
+ "T__74", "T__75", "T__76", "T__77", "T__78", "T__79",
+ "T__80", "T__81", "T__82", "T__83", "T__84", "T__85",
+ "T__86", "T__87", "T__88", "T__89", "T__90", "T__91",
+ "IDENTIFIER", "LETTER", "CHARACTER_LITERAL", "STRING_LITERAL",
+ "HEX_LITERAL", "DECIMAL_LITERAL", "OCTAL_LITERAL", "HexDigit",
+ "IntegerTypeSuffix", "FLOATING_POINT_LITERAL", "Exponent",
+ "FloatTypeSuffix", "EscapeSequence", "OctalEscape", "UnicodeEscape",
+ "WS", "BS", "UnicodeVocabulary", "COMMENT", "LINE_COMMENT",
+ "LINE_COMMAND" ]
+
+ grammarFileName = "C.g4"
+
+ # @param output= sys.stdout Type: TextIO
+ def __init__(self,input=None,output= sys.stdout):
+ super().__init__(input, output)
+ self.checkVersion("4.7.1")
+ self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
+ self._actions = None
+ self._predicates = None
+
+
+
+ def printTokenInfo(self,line,offset,tokenText):
+ print(str(line)+ ',' + str(offset) + ':' + str(tokenText))
+
+ def StorePredicateExpression(self,StartLine,StartOffset,EndLine,EndOffset,Text):
+ PredExp = CodeFragment.PredicateExpression(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.PredicateExpressionList.append(PredExp)
+
+ def StoreEnumerationDefinition(self,StartLine,StartOffset,EndLine,EndOffset,Text):
+ EnumDef = CodeFragment.EnumerationDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.EnumerationDefinitionList.append(EnumDef)
+
+ def StoreStructUnionDefinition(self,StartLine,StartOffset,EndLine,EndOffset,Text):
+ SUDef = CodeFragment.StructUnionDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.StructUnionDefinitionList.append(SUDef)
+
+ def StoreTypedefDefinition(self,StartLine,StartOffset,EndLine,EndOffset,FromText,ToText):
+ Tdef = CodeFragment.TypedefDefinition(FromText, ToText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.TypedefDefinitionList.append(Tdef)
+
+ def StoreFunctionDefinition(self,StartLine,StartOffset,EndLine,EndOffset,ModifierText,DeclText,LeftBraceLine,LeftBraceOffset,DeclLine,DeclOffset):
+ FuncDef = CodeFragment.FunctionDefinition(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset), (LeftBraceLine, LeftBraceOffset), (DeclLine, DeclOffset))
+ FileProfile.FunctionDefinitionList.append(FuncDef)
+
+ def StoreVariableDeclaration(self,StartLine,StartOffset,EndLine,EndOffset,ModifierText,DeclText):
+ VarDecl = CodeFragment.VariableDeclaration(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.VariableDeclarationList.append(VarDecl)
+
+ def StoreFunctionCalling(self,StartLine,StartOffset,EndLine,EndOffset,FuncName,ParamList):
+ FuncCall = CodeFragment.FunctionCalling(FuncName, ParamList, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.FunctionCallingList.append(FuncCall)
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/CListener.py b/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/CListener.py
new file mode 100644
index 000000000..bb4351d92
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/CListener.py
@@ -0,0 +1,809 @@
+# Generated from C.g4 by ANTLR 4.7.1
+from antlr4 import *
+if __name__ is not None and "." in __name__:
+ from .CParser import CParser
+else:
+ from CParser import CParser
+
+## @file
+# The file defines the parser for C source files.
+#
+# THIS FILE IS AUTO-GENENERATED. PLEASE DON NOT MODIFY THIS FILE.
+# This file is generated by running:
+# java org.antlr.Tool C.g
+#
+# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+import Ecc.CodeFragment as CodeFragment
+import Ecc.FileProfile as FileProfile
+
+
+# This class defines a complete listener for a parse tree produced by CParser.
+class CListener(ParseTreeListener):
+
+ # Enter a parse tree produced by CParser#translation_unit.
+ # @param ctx Type: CParser.Translation_unitContext
+ def enterTranslation_unit(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#translation_unit.
+ # @param ctx Type: CParser.Translation_unitContext
+ def exitTranslation_unit(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#external_declaration.
+ # @param ctx Type: CParser.External_declarationContext
+ def enterExternal_declaration(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#external_declaration.
+ # @param ctx Type: CParser.External_declarationContext
+ def exitExternal_declaration(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#function_definition.
+ # @param ctx Type: CParser.Function_definitionContext
+ def enterFunction_definition(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#function_definition.
+ # @param ctx Type: CParser.Function_definitionContext
+ def exitFunction_definition(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#declaration_specifiers.
+ # @param ctx Type: CParser.Declaration_specifiersContext
+ def enterDeclaration_specifiers(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#declaration_specifiers.
+ # @param ctx Type: CParser.Declaration_specifiersContext
+ def exitDeclaration_specifiers(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#declaration.
+ # @param ctx Type: CParser.DeclarationContext
+ def enterDeclaration(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#declaration.
+ # @param ctx Type: CParser.DeclarationContext
+ def exitDeclaration(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#init_declarator_list.
+ # @param ctx Type: CParser.Init_declarator_listContext
+ def enterInit_declarator_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#init_declarator_list.
+ # @param ctx Type: CParser.Init_declarator_listContext
+ def exitInit_declarator_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#init_declarator.
+ # @param ctx Type: CParser.Init_declaratorContext
+ def enterInit_declarator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#init_declarator.
+ # @param ctx Type: CParser.Init_declaratorContext
+ def exitInit_declarator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#storage_class_specifier.
+ # @param ctx Type: CParser.Storage_class_specifierContext
+ def enterStorage_class_specifier(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#storage_class_specifier.
+ # @param ctx Type: CParser.Storage_class_specifierContext
+ def exitStorage_class_specifier(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#type_specifier.
+ # @param ctx Type: CParser.Type_specifierContext
+ def enterType_specifier(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#type_specifier.
+ # @param ctx Type: CParser.Type_specifierContext
+ def exitType_specifier(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#type_id.
+ # @param ctx Type: CParser.Type_idContext
+ def enterType_id(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#type_id.
+ # @param ctx Type: CParser.Type_idContext
+ def exitType_id(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#struct_or_union_specifier.
+ # @param ctx Type: CParser.Struct_or_union_specifierContext
+ def enterStruct_or_union_specifier(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#struct_or_union_specifier.
+ # @param ctx Type: CParser.Struct_or_union_specifierContext
+ def exitStruct_or_union_specifier(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#struct_or_union.
+ # @param ctx Type: CParser.Struct_or_unionContext
+ def enterStruct_or_union(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#struct_or_union.
+ # @param ctx Type: CParser.Struct_or_unionContext
+ def exitStruct_or_union(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#struct_declaration_list.
+ # @param ctx Type: CParser.Struct_declaration_listContext
+ def enterStruct_declaration_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#struct_declaration_list.
+ # @param ctx Type: CParser.Struct_declaration_listContext
+ def exitStruct_declaration_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#struct_declaration.
+ # @param ctx Type: CParser.Struct_declarationContext
+ def enterStruct_declaration(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#struct_declaration.
+ # @param ctx Type: CParser.Struct_declarationContext
+ def exitStruct_declaration(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#specifier_qualifier_list.
+ # @param ctx Type: CParser.Specifier_qualifier_listContext
+ def enterSpecifier_qualifier_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#specifier_qualifier_list.
+ # @param ctx Type: CParser.Specifier_qualifier_listContext
+ def exitSpecifier_qualifier_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#struct_declarator_list.
+ # @param ctx Type: CParser.Struct_declarator_listContext
+ def enterStruct_declarator_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#struct_declarator_list.
+ # @param ctx Type: CParser.Struct_declarator_listContext
+ def exitStruct_declarator_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#struct_declarator.
+ # @param ctx Type: CParser.Struct_declaratorContext
+ def enterStruct_declarator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#struct_declarator.
+ # @param ctx Type: CParser.Struct_declaratorContext
+ def exitStruct_declarator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#enum_specifier.
+ # @param ctx Type: CParser.Enum_specifierContext
+ def enterEnum_specifier(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#enum_specifier.
+ # @param ctx Type: CParser.Enum_specifierContext
+ def exitEnum_specifier(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#enumerator_list.
+ # @param ctx Type: CParser.Enumerator_listContext
+ def enterEnumerator_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#enumerator_list.
+ # @param ctx Type: CParser.Enumerator_listContext
+ def exitEnumerator_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#enumerator.
+ # @param ctx Type: CParser.EnumeratorContext
+ def enterEnumerator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#enumerator.
+ # @param ctx Type: CParser.EnumeratorContext
+ def exitEnumerator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#type_qualifier.
+ # @param ctx Type: CParser.Type_qualifierContext
+ def enterType_qualifier(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#type_qualifier.
+ # @param ctx Type: CParser.Type_qualifierContext
+ def exitType_qualifier(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#declarator.
+ # @param ctx Type: CParser.DeclaratorContext
+ def enterDeclarator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#declarator.
+ # @param ctx Type: CParser.DeclaratorContext
+ def exitDeclarator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#direct_declarator.
+ # @param ctx Type: CParser.Direct_declaratorContext
+ def enterDirect_declarator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#direct_declarator.
+ # @param ctx Type: CParser.Direct_declaratorContext
+ def exitDirect_declarator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#declarator_suffix.
+ # @param ctx Type: CParser.Declarator_suffixContext
+ def enterDeclarator_suffix(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#declarator_suffix.
+ # @param ctx Type: CParser.Declarator_suffixContext
+ def exitDeclarator_suffix(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#pointer.
+ # @param ctx Type: CParser.PointerContext
+ def enterPointer(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#pointer.
+ # @param ctx Type: CParser.PointerContext
+ def exitPointer(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#parameter_type_list.
+ # @param ctx Type: CParser.Parameter_type_listContext
+ def enterParameter_type_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#parameter_type_list.
+ # @param ctx Type: CParser.Parameter_type_listContext
+ def exitParameter_type_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#parameter_list.
+ # @param ctx Type: CParser.Parameter_listContext
+ def enterParameter_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#parameter_list.
+ # @param ctx Type: CParser.Parameter_listContext
+ def exitParameter_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#parameter_declaration.
+ # @param ctx Type: CParser.Parameter_declarationContext
+ def enterParameter_declaration(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#parameter_declaration.
+ # @param ctx Type: CParser.Parameter_declarationContext
+ def exitParameter_declaration(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#identifier_list.
+ # @param ctx Type: CParser.Identifier_listContext
+ def enterIdentifier_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#identifier_list.
+ # @param ctx Type: CParser.Identifier_listContext
+ def exitIdentifier_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#type_name.
+ # @param ctx Type: CParser.Type_nameContext
+ def enterType_name(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#type_name.
+ # @param ctx Type: CParser.Type_nameContext
+ def exitType_name(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#abstract_declarator.
+ # @param ctx Type: CParser.Abstract_declaratorContext
+ def enterAbstract_declarator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#abstract_declarator.
+ # @param ctx Type: CParser.Abstract_declaratorContext
+ def exitAbstract_declarator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#direct_abstract_declarator.
+ # @param ctx Type: CParser.Direct_abstract_declaratorContext
+ def enterDirect_abstract_declarator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#direct_abstract_declarator.
+ # @param ctx Type: CParser.Direct_abstract_declaratorContext
+ def exitDirect_abstract_declarator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#abstract_declarator_suffix.
+ # @param ctx Type: CParser.Abstract_declarator_suffixContext
+ def enterAbstract_declarator_suffix(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#abstract_declarator_suffix.
+ # @param ctx Type: CParser.Abstract_declarator_suffixContext
+ def exitAbstract_declarator_suffix(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#initializer.
+ # @param ctx Type: CParser.InitializerContext
+ def enterInitializer(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#initializer.
+ # @param ctx Type: CParser.InitializerContext
+ def exitInitializer(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#initializer_list.
+ # @param ctx Type: CParser.Initializer_listContext
+ def enterInitializer_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#initializer_list.
+ # @param ctx Type: CParser.Initializer_listContext
+ def exitInitializer_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#argument_expression_list.
+ # @param ctx Type: CParser.Argument_expression_listContext
+ def enterArgument_expression_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#argument_expression_list.
+ # @param ctx Type: CParser.Argument_expression_listContext
+ def exitArgument_expression_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#additive_expression.
+ # @param ctx Type: CParser.Additive_expressionContext
+ def enterAdditive_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#additive_expression.
+ # @param ctx Type: CParser.Additive_expressionContext
+ def exitAdditive_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#multiplicative_expression.
+ # @param ctx Type: CParser.Multiplicative_expressionContext
+ def enterMultiplicative_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#multiplicative_expression.
+ # @param ctx Type: CParser.Multiplicative_expressionContext
+ def exitMultiplicative_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#cast_expression.
+ # @param ctx Type: CParser.Cast_expressionContext
+ def enterCast_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#cast_expression.
+ # @param ctx Type: CParser.Cast_expressionContext
+ def exitCast_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#unary_expression.
+ # @param ctx Type: CParser.Unary_expressionContext
+ def enterUnary_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#unary_expression.
+ # @param ctx Type: CParser.Unary_expressionContext
+ def exitUnary_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#postfix_expression.
+ # @param ctx Type: CParser.Postfix_expressionContext
+ def enterPostfix_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#postfix_expression.
+ # @param ctx Type: CParser.Postfix_expressionContext
+ def exitPostfix_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#macro_parameter_list.
+ # @param ctx Type: CParser.Macro_parameter_listContext
+ def enterMacro_parameter_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#macro_parameter_list.
+ # @param ctx Type: CParser.Macro_parameter_listContext
+ def exitMacro_parameter_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#unary_operator.
+ # @param ctx Type: CParser.Unary_operatorContext
+ def enterUnary_operator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#unary_operator.
+ # @param ctx Type: CParser.Unary_operatorContext
+ def exitUnary_operator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#primary_expression.
+ # @param ctx Type: CParser.Primary_expressionContext
+ def enterPrimary_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#primary_expression.
+ # @param ctx Type: CParser.Primary_expressionContext
+ def exitPrimary_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#constant.
+ # @param ctx Type: CParser.ConstantContext
+ def enterConstant(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#constant.
+ # @param ctx Type: CParser.ConstantContext
+ def exitConstant(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#expression.
+ # @param ctx Type: CParser.ExpressionContext
+ def enterExpression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#expression.
+ # @param ctx Type: CParser.ExpressionContext
+ def exitExpression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#constant_expression.
+ # @param ctx Type: CParser.Constant_expressionContext
+ def enterConstant_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#constant_expression.
+ # @param ctx Type: CParser.Constant_expressionContext
+ def exitConstant_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#assignment_expression.
+ # @param ctx Type: CParser.Assignment_expressionContext
+ def enterAssignment_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#assignment_expression.
+ # @param ctx Type: CParser.Assignment_expressionContext
+ def exitAssignment_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#lvalue.
+ # @param ctx Type: CParser.LvalueContext
+ def enterLvalue(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#lvalue.
+ # @param ctx Type: CParser.LvalueContext
+ def exitLvalue(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#assignment_operator.
+ # @param ctx Type: CParser.Assignment_operatorContext
+ def enterAssignment_operator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#assignment_operator.
+ # @param ctx Type: CParser.Assignment_operatorContext
+ def exitAssignment_operator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#conditional_expression.
+ # @param ctx Type: CParser.Conditional_expressionContext
+ def enterConditional_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#conditional_expression.
+ # @param ctx Type: CParser.Conditional_expressionContext
+ def exitConditional_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#logical_or_expression.
+ # @param ctx Type: CParser.Logical_or_expressionContext
+ def enterLogical_or_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#logical_or_expression.
+ # @param ctx Type: CParser.Logical_or_expressionContext
+ def exitLogical_or_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#logical_and_expression.
+ # @param ctx Type: CParser.Logical_and_expressionContext
+ def enterLogical_and_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#logical_and_expression.
+ # @param ctx Type: CParser.Logical_and_expressionContext
+ def exitLogical_and_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#inclusive_or_expression.
+ # @param ctx Type: CParser.Inclusive_or_expressionContext
+ def enterInclusive_or_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#inclusive_or_expression.
+ # @param ctx Type: CParser.Inclusive_or_expressionContext
+ def exitInclusive_or_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#exclusive_or_expression.
+ # @param ctx Type: CParser.Exclusive_or_expressionContext
+ def enterExclusive_or_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#exclusive_or_expression.
+ # @param ctx Type: CParser.Exclusive_or_expressionContext
+ def exitExclusive_or_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#and_expression.
+ # @param ctx Type: CParser.And_expressionContext
+ def enterAnd_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#and_expression.
+ # @param ctx Type: CParser.And_expressionContext
+ def exitAnd_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#equality_expression.
+ # @param ctx Type: CParser.Equality_expressionContext
+ def enterEquality_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#equality_expression.
+ # @param ctx Type: CParser.Equality_expressionContext
+ def exitEquality_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#relational_expression.
+ # @param ctx Type: CParser.Relational_expressionContext
+ def enterRelational_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#relational_expression.
+ # @param ctx Type: CParser.Relational_expressionContext
+ def exitRelational_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#shift_expression.
+ # @param ctx Type: CParser.Shift_expressionContext
+ def enterShift_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#shift_expression.
+ # @param ctx Type: CParser.Shift_expressionContext
+ def exitShift_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#statement.
+ # @param ctx Type: CParser.StatementContext
+ def enterStatement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#statement.
+ # @param ctx Type: CParser.StatementContext
+ def exitStatement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#asm2_statement.
+ # @param ctx Type: CParser.Asm2_statementContext
+ def enterAsm2_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#asm2_statement.
+ # @param ctx Type: CParser.Asm2_statementContext
+ def exitAsm2_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#asm1_statement.
+ # @param ctx Type: CParser.Asm1_statementContext
+ def enterAsm1_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#asm1_statement.
+ # @param ctx Type: CParser.Asm1_statementContext
+ def exitAsm1_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#asm_statement.
+ # @param ctx Type: CParser.Asm_statementContext
+ def enterAsm_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#asm_statement.
+ # @param ctx Type: CParser.Asm_statementContext
+ def exitAsm_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#macro_statement.
+ # @param ctx Type: CParser.Macro_statementContext
+ def enterMacro_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#macro_statement.
+ # @param ctx Type: CParser.Macro_statementContext
+ def exitMacro_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#labeled_statement.
+ # @param ctx Type: CParser.Labeled_statementContext
+ def enterLabeled_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#labeled_statement.
+ # @param ctx Type: CParser.Labeled_statementContext
+ def exitLabeled_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#compound_statement.
+ # @param ctx Type: CParser.Compound_statementContext
+ def enterCompound_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#compound_statement.
+ # @param ctx Type: CParser.Compound_statementContext
+ def exitCompound_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#statement_list.
+ # @param ctx Type: CParser.Statement_listContext
+ def enterStatement_list(self,ctx):
+ pass
+
+
+ # Exit a parse tree produced by CParser#statement_list.
+ # @param ctx Type: CParser.Statement_listContext
+ def exitStatement_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#expression_statement.
+ # @param ctx Type: CParser.Expression_statementContext
+ def enterExpression_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#expression_statement.
+ # @param ctx Type: CParser.Expression_statementContext
+ def exitExpression_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#selection_statement.
+ # @param ctx Type: CParser.Selection_statementContext
+ def enterSelection_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#selection_statement.
+ # @param ctx Type: CParser.Selection_statementContext
+ def exitSelection_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#iteration_statement.
+ # @param ctx Type: CParser.Iteration_statementContext
+ def enterIteration_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#iteration_statement.
+ # @param ctx Type: CParser.Iteration_statementContext
+ def exitIteration_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#jump_statement.
+ # @param ctx Type: CParser.Jump_statementContext
+ def enterJump_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#jump_statement.
+ # @param ctx Type: CParser.Jump_statementContext
+ def exitJump_statement(self,ctx):
+ pass
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/CParser.py b/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/CParser.py
new file mode 100644
index 000000000..31d23d55a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/CParser.py
@@ -0,0 +1,6273 @@
+# Generated from C.g4 by ANTLR 4.7.1
+# encoding: utf-8
+from antlr4 import *
+from io import StringIO
+from typing.io import TextIO
+import sys
+
+
+## @file
+# The file defines the parser for C source files.
+#
+# THIS FILE IS AUTO-GENENERATED. PLEASE DON NOT MODIFY THIS FILE.
+# This file is generated by running:
+# java org.antlr.Tool C.g
+#
+# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+import Ecc.CodeFragment as CodeFragment
+import Ecc.FileProfile as FileProfile
+
+def serializedATN():
+ with StringIO() as buf:
+ buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3k")
+ buf.write("\u0380\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
+ buf.write("\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16")
+ buf.write("\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
+ buf.write("\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31")
+ buf.write("\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36")
+ buf.write("\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t")
+ buf.write("&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4,\t,\4-\t-\4.\t.\4")
+ buf.write("/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t\64")
+ buf.write("\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t")
+ buf.write(";\4<\t<\4=\t=\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\t")
+ buf.write("D\4E\tE\4F\tF\4G\tG\4H\tH\3\2\7\2\u0092\n\2\f\2\16\2\u0095")
+ buf.write("\13\2\3\3\5\3\u0098\n\3\3\3\3\3\7\3\u009c\n\3\f\3\16\3")
+ buf.write("\u009f\13\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3\u00a7\n\3\5\3")
+ buf.write("\u00a9\n\3\3\4\5\4\u00ac\n\4\3\4\3\4\6\4\u00b0\n\4\r\4")
+ buf.write("\16\4\u00b1\3\4\3\4\3\4\5\4\u00b7\n\4\3\4\3\4\3\5\3\5")
+ buf.write("\3\5\6\5\u00be\n\5\r\5\16\5\u00bf\3\6\3\6\5\6\u00c4\n")
+ buf.write("\6\3\6\3\6\3\6\3\6\3\6\3\6\5\6\u00cc\n\6\3\6\3\6\3\6\5")
+ buf.write("\6\u00d1\n\6\3\7\3\7\3\7\7\7\u00d6\n\7\f\7\16\7\u00d9")
+ buf.write("\13\7\3\b\3\b\3\b\5\b\u00de\n\b\3\t\3\t\3\n\3\n\3\n\3")
+ buf.write("\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n")
+ buf.write("\7\n\u00f3\n\n\f\n\16\n\u00f6\13\n\3\n\3\n\5\n\u00fa\n")
+ buf.write("\n\3\13\3\13\3\f\3\f\5\f\u0100\n\f\3\f\3\f\3\f\3\f\3\f")
+ buf.write("\3\f\3\f\5\f\u0109\n\f\3\r\3\r\3\16\6\16\u010e\n\16\r")
+ buf.write("\16\16\16\u010f\3\17\3\17\3\17\3\17\3\20\3\20\6\20\u0118")
+ buf.write("\n\20\r\20\16\20\u0119\3\21\3\21\3\21\7\21\u011f\n\21")
+ buf.write("\f\21\16\21\u0122\13\21\3\22\3\22\3\22\5\22\u0127\n\22")
+ buf.write("\3\22\3\22\5\22\u012b\n\22\3\23\3\23\3\23\3\23\5\23\u0131")
+ buf.write("\n\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\5\23\u013a\n")
+ buf.write("\23\3\23\3\23\3\23\3\23\5\23\u0140\n\23\3\24\3\24\3\24")
+ buf.write("\7\24\u0145\n\24\f\24\16\24\u0148\13\24\3\25\3\25\3\25")
+ buf.write("\5\25\u014d\n\25\3\26\3\26\3\27\5\27\u0152\n\27\3\27\5")
+ buf.write("\27\u0155\n\27\3\27\5\27\u0158\n\27\3\27\5\27\u015b\n")
+ buf.write("\27\3\27\3\27\5\27\u015f\n\27\3\30\3\30\7\30\u0163\n\30")
+ buf.write("\f\30\16\30\u0166\13\30\3\30\3\30\5\30\u016a\n\30\3\30")
+ buf.write("\3\30\3\30\6\30\u016f\n\30\r\30\16\30\u0170\5\30\u0173")
+ buf.write("\n\30\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31")
+ buf.write("\3\31\3\31\3\31\3\31\3\31\3\31\5\31\u0185\n\31\3\32\3")
+ buf.write("\32\6\32\u0189\n\32\r\32\16\32\u018a\3\32\5\32\u018e\n")
+ buf.write("\32\3\32\3\32\3\32\5\32\u0193\n\32\3\33\3\33\3\33\5\33")
+ buf.write("\u0198\n\33\3\33\5\33\u019b\n\33\3\34\3\34\3\34\5\34\u01a0")
+ buf.write("\n\34\3\34\7\34\u01a3\n\34\f\34\16\34\u01a6\13\34\3\35")
+ buf.write("\3\35\3\35\7\35\u01ab\n\35\f\35\16\35\u01ae\13\35\3\35")
+ buf.write("\5\35\u01b1\n\35\3\35\7\35\u01b4\n\35\f\35\16\35\u01b7")
+ buf.write("\13\35\3\35\5\35\u01ba\n\35\3\36\3\36\3\36\7\36\u01bf")
+ buf.write("\n\36\f\36\16\36\u01c2\13\36\3\37\3\37\5\37\u01c6\n\37")
+ buf.write("\3\37\5\37\u01c9\n\37\3 \3 \5 \u01cd\n \3 \5 \u01d0\n")
+ buf.write(" \3!\3!\3!\3!\3!\5!\u01d7\n!\3!\7!\u01da\n!\f!\16!\u01dd")
+ buf.write("\13!\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\5")
+ buf.write("\"\u01eb\n\"\3#\3#\3#\3#\5#\u01f1\n#\3#\3#\5#\u01f5\n")
+ buf.write("#\3$\3$\3$\7$\u01fa\n$\f$\16$\u01fd\13$\3%\3%\5%\u0201")
+ buf.write("\n%\3%\3%\3%\5%\u0206\n%\7%\u0208\n%\f%\16%\u020b\13%")
+ buf.write("\3&\3&\3&\3&\3&\7&\u0212\n&\f&\16&\u0215\13&\3\'\3\'\3")
+ buf.write("\'\3\'\3\'\3\'\3\'\7\'\u021e\n\'\f\'\16\'\u0221\13\'\3")
+ buf.write("(\3(\3(\3(\3(\3(\5(\u0229\n(\3)\3)\3)\3)\3)\3)\3)\3)\3")
+ buf.write(")\3)\3)\3)\3)\3)\3)\5)\u023a\n)\3*\3*\3*\3*\3*\3*\3*\3")
+ buf.write("*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3")
+ buf.write("*\3*\3*\3*\7*\u0259\n*\f*\16*\u025c\13*\3+\3+\3+\7+\u0261")
+ buf.write("\n+\f+\16+\u0264\13+\3,\3,\3-\3-\3-\3-\3-\3-\5-\u026e")
+ buf.write("\n-\3.\3.\3.\3.\3.\7.\u0275\n.\f.\16.\u0278\13.\3.\6.")
+ buf.write("\u027b\n.\r.\16.\u027c\6.\u027f\n.\r.\16.\u0280\3.\7.")
+ buf.write("\u0284\n.\f.\16.\u0287\13.\3.\5.\u028a\n.\3/\3/\3/\7/")
+ buf.write("\u028f\n/\f/\16/\u0292\13/\3\60\3\60\3\61\3\61\3\61\3")
+ buf.write("\61\3\61\5\61\u029b\n\61\3\62\3\62\3\63\3\63\3\64\3\64")
+ buf.write("\3\64\3\64\3\64\3\64\3\64\5\64\u02a8\n\64\3\65\3\65\3")
+ buf.write("\65\7\65\u02ad\n\65\f\65\16\65\u02b0\13\65\3\66\3\66\3")
+ buf.write("\66\7\66\u02b5\n\66\f\66\16\66\u02b8\13\66\3\67\3\67\3")
+ buf.write("\67\7\67\u02bd\n\67\f\67\16\67\u02c0\13\67\38\38\38\7")
+ buf.write("8\u02c5\n8\f8\168\u02c8\138\39\39\39\79\u02cd\n9\f9\16")
+ buf.write("9\u02d0\139\3:\3:\3:\7:\u02d5\n:\f:\16:\u02d8\13:\3;\3")
+ buf.write(";\3;\7;\u02dd\n;\f;\16;\u02e0\13;\3<\3<\3<\7<\u02e5\n")
+ buf.write("<\f<\16<\u02e8\13<\3=\3=\3=\3=\3=\3=\3=\3=\3=\3=\3=\5")
+ buf.write("=\u02f5\n=\3>\5>\u02f8\n>\3>\3>\3>\7>\u02fd\n>\f>\16>")
+ buf.write("\u0300\13>\3>\3>\3>\3?\3?\3?\7?\u0308\n?\f?\16?\u030b")
+ buf.write("\13?\3?\3?\3@\3@\3@\7@\u0312\n@\f@\16@\u0315\13@\3@\3")
+ buf.write("@\3A\3A\3A\7A\u031c\nA\fA\16A\u031f\13A\3A\5A\u0322\n")
+ buf.write("A\3A\5A\u0325\nA\3A\3A\3B\3B\3B\3B\3B\3B\3B\3B\3B\3B\3")
+ buf.write("B\5B\u0334\nB\3C\3C\7C\u0338\nC\fC\16C\u033b\13C\3C\5")
+ buf.write("C\u033e\nC\3C\3C\3D\6D\u0343\nD\rD\16D\u0344\3E\3E\3E")
+ buf.write("\3E\5E\u034b\nE\3F\3F\3F\3F\3F\3F\3F\3F\5F\u0355\nF\3")
+ buf.write("F\3F\3F\3F\3F\3F\5F\u035d\nF\3G\3G\3G\3G\3G\3G\3G\3G\3")
+ buf.write("G\3G\3G\3G\3G\3G\3G\3G\5G\u036f\nG\3H\3H\3H\3H\3H\3H\3")
+ buf.write("H\3H\3H\3H\3H\3H\3H\5H\u037e\nH\3H\2\2I\2\4\6\b\n\f\16")
+ buf.write("\20\22\24\26\30\32\34\36 \"$&(*,.\60\62\64\668:<>@BDF")
+ buf.write("HJLNPRTVXZ\\^`bdfhjlnprtvxz|~\u0080\u0082\u0084\u0086")
+ buf.write("\u0088\u008a\u008c\u008e\2\f\3\2\b\f\3\2\27\30\3\2\33")
+ buf.write("\'\5\2,,./\679\4\2\7\7:C\3\2IJ\3\2KN\3\2OP\3\2\4\4\3\2")
+ buf.write("\26\26\2\u03d8\2\u0093\3\2\2\2\4\u00a8\3\2\2\2\6\u00ab")
+ buf.write("\3\2\2\2\b\u00bd\3\2\2\2\n\u00d0\3\2\2\2\f\u00d2\3\2\2")
+ buf.write("\2\16\u00da\3\2\2\2\20\u00df\3\2\2\2\22\u00f9\3\2\2\2")
+ buf.write("\24\u00fb\3\2\2\2\26\u0108\3\2\2\2\30\u010a\3\2\2\2\32")
+ buf.write("\u010d\3\2\2\2\34\u0111\3\2\2\2\36\u0117\3\2\2\2 \u011b")
+ buf.write("\3\2\2\2\"\u012a\3\2\2\2$\u013f\3\2\2\2&\u0141\3\2\2\2")
+ buf.write("(\u0149\3\2\2\2*\u014e\3\2\2\2,\u015e\3\2\2\2.\u0172\3")
+ buf.write("\2\2\2\60\u0184\3\2\2\2\62\u0192\3\2\2\2\64\u0194\3\2")
+ buf.write("\2\2\66\u019c\3\2\2\28\u01b9\3\2\2\2:\u01bb\3\2\2\2<\u01c8")
+ buf.write("\3\2\2\2>\u01cf\3\2\2\2@\u01d6\3\2\2\2B\u01ea\3\2\2\2")
+ buf.write("D\u01f4\3\2\2\2F\u01f6\3\2\2\2H\u01fe\3\2\2\2J\u020c\3")
+ buf.write("\2\2\2L\u0216\3\2\2\2N\u0228\3\2\2\2P\u0239\3\2\2\2R\u023b")
+ buf.write("\3\2\2\2T\u025d\3\2\2\2V\u0265\3\2\2\2X\u026d\3\2\2\2")
+ buf.write("Z\u0289\3\2\2\2\\\u028b\3\2\2\2^\u0293\3\2\2\2`\u029a")
+ buf.write("\3\2\2\2b\u029c\3\2\2\2d\u029e\3\2\2\2f\u02a0\3\2\2\2")
+ buf.write("h\u02a9\3\2\2\2j\u02b1\3\2\2\2l\u02b9\3\2\2\2n\u02c1\3")
+ buf.write("\2\2\2p\u02c9\3\2\2\2r\u02d1\3\2\2\2t\u02d9\3\2\2\2v\u02e1")
+ buf.write("\3\2\2\2x\u02f4\3\2\2\2z\u02f7\3\2\2\2|\u0304\3\2\2\2")
+ buf.write("~\u030e\3\2\2\2\u0080\u0318\3\2\2\2\u0082\u0333\3\2\2")
+ buf.write("\2\u0084\u0335\3\2\2\2\u0086\u0342\3\2\2\2\u0088\u034a")
+ buf.write("\3\2\2\2\u008a\u035c\3\2\2\2\u008c\u036e\3\2\2\2\u008e")
+ buf.write("\u037d\3\2\2\2\u0090\u0092\5\4\3\2\u0091\u0090\3\2\2\2")
+ buf.write("\u0092\u0095\3\2\2\2\u0093\u0091\3\2\2\2\u0093\u0094\3")
+ buf.write("\2\2\2\u0094\3\3\2\2\2\u0095\u0093\3\2\2\2\u0096\u0098")
+ buf.write("\5\b\5\2\u0097\u0096\3\2\2\2\u0097\u0098\3\2\2\2\u0098")
+ buf.write("\u0099\3\2\2\2\u0099\u009d\5,\27\2\u009a\u009c\5\n\6\2")
+ buf.write("\u009b\u009a\3\2\2\2\u009c\u009f\3\2\2\2\u009d\u009b\3")
+ buf.write("\2\2\2\u009d\u009e\3\2\2\2\u009e\u00a0\3\2\2\2\u009f\u009d")
+ buf.write("\3\2\2\2\u00a0\u00a1\7\3\2\2\u00a1\u00a9\3\2\2\2\u00a2")
+ buf.write("\u00a9\5\6\4\2\u00a3\u00a9\5\n\6\2\u00a4\u00a6\5\u0080")
+ buf.write("A\2\u00a5\u00a7\7\4\2\2\u00a6\u00a5\3\2\2\2\u00a6\u00a7")
+ buf.write("\3\2\2\2\u00a7\u00a9\3\2\2\2\u00a8\u0097\3\2\2\2\u00a8")
+ buf.write("\u00a2\3\2\2\2\u00a8\u00a3\3\2\2\2\u00a8\u00a4\3\2\2\2")
+ buf.write("\u00a9\5\3\2\2\2\u00aa\u00ac\5\b\5\2\u00ab\u00aa\3\2\2")
+ buf.write("\2\u00ab\u00ac\3\2\2\2\u00ac\u00ad\3\2\2\2\u00ad\u00b6")
+ buf.write("\5,\27\2\u00ae\u00b0\5\n\6\2\u00af\u00ae\3\2\2\2\u00b0")
+ buf.write("\u00b1\3\2\2\2\u00b1\u00af\3\2\2\2\u00b1\u00b2\3\2\2\2")
+ buf.write("\u00b2\u00b3\3\2\2\2\u00b3\u00b4\5\u0084C\2\u00b4\u00b7")
+ buf.write("\3\2\2\2\u00b5\u00b7\5\u0084C\2\u00b6\u00af\3\2\2\2\u00b6")
+ buf.write("\u00b5\3\2\2\2\u00b7\u00b8\3\2\2\2\u00b8\u00b9\b\4\1\2")
+ buf.write("\u00b9\7\3\2\2\2\u00ba\u00be\5\20\t\2\u00bb\u00be\5\22")
+ buf.write("\n\2\u00bc\u00be\5*\26\2\u00bd\u00ba\3\2\2\2\u00bd\u00bb")
+ buf.write("\3\2\2\2\u00bd\u00bc\3\2\2\2\u00be\u00bf\3\2\2\2\u00bf")
+ buf.write("\u00bd\3\2\2\2\u00bf\u00c0\3\2\2\2\u00c0\t\3\2\2\2\u00c1")
+ buf.write("\u00c3\7\5\2\2\u00c2\u00c4\5\b\5\2\u00c3\u00c2\3\2\2\2")
+ buf.write("\u00c3\u00c4\3\2\2\2\u00c4\u00c5\3\2\2\2\u00c5\u00c6\5")
+ buf.write("\f\7\2\u00c6\u00c7\7\4\2\2\u00c7\u00c8\b\6\1\2\u00c8\u00d1")
+ buf.write("\3\2\2\2\u00c9\u00cb\5\b\5\2\u00ca\u00cc\5\f\7\2\u00cb")
+ buf.write("\u00ca\3\2\2\2\u00cb\u00cc\3\2\2\2\u00cc\u00cd\3\2\2\2")
+ buf.write("\u00cd\u00ce\7\4\2\2\u00ce\u00cf\b\6\1\2\u00cf\u00d1\3")
+ buf.write("\2\2\2\u00d0\u00c1\3\2\2\2\u00d0\u00c9\3\2\2\2\u00d1\13")
+ buf.write("\3\2\2\2\u00d2\u00d7\5\16\b\2\u00d3\u00d4\7\6\2\2\u00d4")
+ buf.write("\u00d6\5\16\b\2\u00d5\u00d3\3\2\2\2\u00d6\u00d9\3\2\2")
+ buf.write("\2\u00d7\u00d5\3\2\2\2\u00d7\u00d8\3\2\2\2\u00d8\r\3\2")
+ buf.write("\2\2\u00d9\u00d7\3\2\2\2\u00da\u00dd\5,\27\2\u00db\u00dc")
+ buf.write("\7\7\2\2\u00dc\u00de\5D#\2\u00dd\u00db\3\2\2\2\u00dd\u00de")
+ buf.write("\3\2\2\2\u00de\17\3\2\2\2\u00df\u00e0\t\2\2\2\u00e0\21")
+ buf.write("\3\2\2\2\u00e1\u00fa\7\r\2\2\u00e2\u00fa\7\16\2\2\u00e3")
+ buf.write("\u00fa\7\17\2\2\u00e4\u00fa\7\20\2\2\u00e5\u00fa\7\21")
+ buf.write("\2\2\u00e6\u00fa\7\22\2\2\u00e7\u00fa\7\23\2\2\u00e8\u00fa")
+ buf.write("\7\24\2\2\u00e9\u00fa\7\25\2\2\u00ea\u00eb\5\26\f\2\u00eb")
+ buf.write("\u00ec\b\n\1\2\u00ec\u00fa\3\2\2\2\u00ed\u00ee\5$\23\2")
+ buf.write("\u00ee\u00ef\b\n\1\2\u00ef\u00fa\3\2\2\2\u00f0\u00f4\7")
+ buf.write("_\2\2\u00f1\u00f3\5*\26\2\u00f2\u00f1\3\2\2\2\u00f3\u00f6")
+ buf.write("\3\2\2\2\u00f4\u00f2\3\2\2\2\u00f4\u00f5\3\2\2\2\u00f5")
+ buf.write("\u00f7\3\2\2\2\u00f6\u00f4\3\2\2\2\u00f7\u00fa\5,\27\2")
+ buf.write("\u00f8\u00fa\5\24\13\2\u00f9\u00e1\3\2\2\2\u00f9\u00e2")
+ buf.write("\3\2\2\2\u00f9\u00e3\3\2\2\2\u00f9\u00e4\3\2\2\2\u00f9")
+ buf.write("\u00e5\3\2\2\2\u00f9\u00e6\3\2\2\2\u00f9\u00e7\3\2\2\2")
+ buf.write("\u00f9\u00e8\3\2\2\2\u00f9\u00e9\3\2\2\2\u00f9\u00ea\3")
+ buf.write("\2\2\2\u00f9\u00ed\3\2\2\2\u00f9\u00f0\3\2\2\2\u00f9\u00f8")
+ buf.write("\3\2\2\2\u00fa\23\3\2\2\2\u00fb\u00fc\7_\2\2\u00fc\25")
+ buf.write("\3\2\2\2\u00fd\u00ff\5\30\r\2\u00fe\u0100\7_\2\2\u00ff")
+ buf.write("\u00fe\3\2\2\2\u00ff\u0100\3\2\2\2\u0100\u0101\3\2\2\2")
+ buf.write("\u0101\u0102\7\3\2\2\u0102\u0103\5\32\16\2\u0103\u0104")
+ buf.write("\7\26\2\2\u0104\u0109\3\2\2\2\u0105\u0106\5\30\r\2\u0106")
+ buf.write("\u0107\7_\2\2\u0107\u0109\3\2\2\2\u0108\u00fd\3\2\2\2")
+ buf.write("\u0108\u0105\3\2\2\2\u0109\27\3\2\2\2\u010a\u010b\t\3")
+ buf.write("\2\2\u010b\31\3\2\2\2\u010c\u010e\5\34\17\2\u010d\u010c")
+ buf.write("\3\2\2\2\u010e\u010f\3\2\2\2\u010f\u010d\3\2\2\2\u010f")
+ buf.write("\u0110\3\2\2\2\u0110\33\3\2\2\2\u0111\u0112\5\36\20\2")
+ buf.write("\u0112\u0113\5 \21\2\u0113\u0114\7\4\2\2\u0114\35\3\2")
+ buf.write("\2\2\u0115\u0118\5*\26\2\u0116\u0118\5\22\n\2\u0117\u0115")
+ buf.write("\3\2\2\2\u0117\u0116\3\2\2\2\u0118\u0119\3\2\2\2\u0119")
+ buf.write("\u0117\3\2\2\2\u0119\u011a\3\2\2\2\u011a\37\3\2\2\2\u011b")
+ buf.write("\u0120\5\"\22\2\u011c\u011d\7\6\2\2\u011d\u011f\5\"\22")
+ buf.write("\2\u011e\u011c\3\2\2\2\u011f\u0122\3\2\2\2\u0120\u011e")
+ buf.write("\3\2\2\2\u0120\u0121\3\2\2\2\u0121!\3\2\2\2\u0122\u0120")
+ buf.write("\3\2\2\2\u0123\u0126\5,\27\2\u0124\u0125\7\31\2\2\u0125")
+ buf.write("\u0127\5^\60\2\u0126\u0124\3\2\2\2\u0126\u0127\3\2\2\2")
+ buf.write("\u0127\u012b\3\2\2\2\u0128\u0129\7\31\2\2\u0129\u012b")
+ buf.write("\5^\60\2\u012a\u0123\3\2\2\2\u012a\u0128\3\2\2\2\u012b")
+ buf.write("#\3\2\2\2\u012c\u012d\7\32\2\2\u012d\u012e\7\3\2\2\u012e")
+ buf.write("\u0130\5&\24\2\u012f\u0131\7\6\2\2\u0130\u012f\3\2\2\2")
+ buf.write("\u0130\u0131\3\2\2\2\u0131\u0132\3\2\2\2\u0132\u0133\7")
+ buf.write("\26\2\2\u0133\u0140\3\2\2\2\u0134\u0135\7\32\2\2\u0135")
+ buf.write("\u0136\7_\2\2\u0136\u0137\7\3\2\2\u0137\u0139\5&\24\2")
+ buf.write("\u0138\u013a\7\6\2\2\u0139\u0138\3\2\2\2\u0139\u013a\3")
+ buf.write("\2\2\2\u013a\u013b\3\2\2\2\u013b\u013c\7\26\2\2\u013c")
+ buf.write("\u0140\3\2\2\2\u013d\u013e\7\32\2\2\u013e\u0140\7_\2\2")
+ buf.write("\u013f\u012c\3\2\2\2\u013f\u0134\3\2\2\2\u013f\u013d\3")
+ buf.write("\2\2\2\u0140%\3\2\2\2\u0141\u0146\5(\25\2\u0142\u0143")
+ buf.write("\7\6\2\2\u0143\u0145\5(\25\2\u0144\u0142\3\2\2\2\u0145")
+ buf.write("\u0148\3\2\2\2\u0146\u0144\3\2\2\2\u0146\u0147\3\2\2\2")
+ buf.write("\u0147\'\3\2\2\2\u0148\u0146\3\2\2\2\u0149\u014c\7_\2")
+ buf.write("\2\u014a\u014b\7\7\2\2\u014b\u014d\5^\60\2\u014c\u014a")
+ buf.write("\3\2\2\2\u014c\u014d\3\2\2\2\u014d)\3\2\2\2\u014e\u014f")
+ buf.write("\t\4\2\2\u014f+\3\2\2\2\u0150\u0152\5\62\32\2\u0151\u0150")
+ buf.write("\3\2\2\2\u0151\u0152\3\2\2\2\u0152\u0154\3\2\2\2\u0153")
+ buf.write("\u0155\7$\2\2\u0154\u0153\3\2\2\2\u0154\u0155\3\2\2\2")
+ buf.write("\u0155\u0157\3\2\2\2\u0156\u0158\7%\2\2\u0157\u0156\3")
+ buf.write("\2\2\2\u0157\u0158\3\2\2\2\u0158\u015a\3\2\2\2\u0159\u015b")
+ buf.write("\7&\2\2\u015a\u0159\3\2\2\2\u015a\u015b\3\2\2\2\u015b")
+ buf.write("\u015c\3\2\2\2\u015c\u015f\5.\30\2\u015d\u015f\5\62\32")
+ buf.write("\2\u015e\u0151\3\2\2\2\u015e\u015d\3\2\2\2\u015f-\3\2")
+ buf.write("\2\2\u0160\u0164\7_\2\2\u0161\u0163\5\60\31\2\u0162\u0161")
+ buf.write("\3\2\2\2\u0163\u0166\3\2\2\2\u0164\u0162\3\2\2\2\u0164")
+ buf.write("\u0165\3\2\2\2\u0165\u0173\3\2\2\2\u0166\u0164\3\2\2\2")
+ buf.write("\u0167\u0169\7(\2\2\u0168\u016a\7$\2\2\u0169\u0168\3\2")
+ buf.write("\2\2\u0169\u016a\3\2\2\2\u016a\u016b\3\2\2\2\u016b\u016c")
+ buf.write("\5,\27\2\u016c\u016e\7)\2\2\u016d\u016f\5\60\31\2\u016e")
+ buf.write("\u016d\3\2\2\2\u016f\u0170\3\2\2\2\u0170\u016e\3\2\2\2")
+ buf.write("\u0170\u0171\3\2\2\2\u0171\u0173\3\2\2\2\u0172\u0160\3")
+ buf.write("\2\2\2\u0172\u0167\3\2\2\2\u0173/\3\2\2\2\u0174\u0175")
+ buf.write("\7*\2\2\u0175\u0176\5^\60\2\u0176\u0177\7+\2\2\u0177\u0185")
+ buf.write("\3\2\2\2\u0178\u0179\7*\2\2\u0179\u0185\7+\2\2\u017a\u017b")
+ buf.write("\7(\2\2\u017b\u017c\5\64\33\2\u017c\u017d\7)\2\2\u017d")
+ buf.write("\u0185\3\2\2\2\u017e\u017f\7(\2\2\u017f\u0180\5:\36\2")
+ buf.write("\u0180\u0181\7)\2\2\u0181\u0185\3\2\2\2\u0182\u0183\7")
+ buf.write("(\2\2\u0183\u0185\7)\2\2\u0184\u0174\3\2\2\2\u0184\u0178")
+ buf.write("\3\2\2\2\u0184\u017a\3\2\2\2\u0184\u017e\3\2\2\2\u0184")
+ buf.write("\u0182\3\2\2\2\u0185\61\3\2\2\2\u0186\u0188\7,\2\2\u0187")
+ buf.write("\u0189\5*\26\2\u0188\u0187\3\2\2\2\u0189\u018a\3\2\2\2")
+ buf.write("\u018a\u0188\3\2\2\2\u018a\u018b\3\2\2\2\u018b\u018d\3")
+ buf.write("\2\2\2\u018c\u018e\5\62\32\2\u018d\u018c\3\2\2\2\u018d")
+ buf.write("\u018e\3\2\2\2\u018e\u0193\3\2\2\2\u018f\u0190\7,\2\2")
+ buf.write("\u0190\u0193\5\62\32\2\u0191\u0193\7,\2\2\u0192\u0186")
+ buf.write("\3\2\2\2\u0192\u018f\3\2\2\2\u0192\u0191\3\2\2\2\u0193")
+ buf.write("\63\3\2\2\2\u0194\u019a\5\66\34\2\u0195\u0197\7\6\2\2")
+ buf.write("\u0196\u0198\7\37\2\2\u0197\u0196\3\2\2\2\u0197\u0198")
+ buf.write("\3\2\2\2\u0198\u0199\3\2\2\2\u0199\u019b\7-\2\2\u019a")
+ buf.write("\u0195\3\2\2\2\u019a\u019b\3\2\2\2\u019b\65\3\2\2\2\u019c")
+ buf.write("\u01a4\58\35\2\u019d\u019f\7\6\2\2\u019e\u01a0\7\37\2")
+ buf.write("\2\u019f\u019e\3\2\2\2\u019f\u01a0\3\2\2\2\u01a0\u01a1")
+ buf.write("\3\2\2\2\u01a1\u01a3\58\35\2\u01a2\u019d\3\2\2\2\u01a3")
+ buf.write("\u01a6\3\2\2\2\u01a4\u01a2\3\2\2\2\u01a4\u01a5\3\2\2\2")
+ buf.write("\u01a5\67\3\2\2\2\u01a6\u01a4\3\2\2\2\u01a7\u01ac\5\b")
+ buf.write("\5\2\u01a8\u01ab\5,\27\2\u01a9\u01ab\5> \2\u01aa\u01a8")
+ buf.write("\3\2\2\2\u01aa\u01a9\3\2\2\2\u01ab\u01ae\3\2\2\2\u01ac")
+ buf.write("\u01aa\3\2\2\2\u01ac\u01ad\3\2\2\2\u01ad\u01b0\3\2\2\2")
+ buf.write("\u01ae\u01ac\3\2\2\2\u01af\u01b1\7\37\2\2\u01b0\u01af")
+ buf.write("\3\2\2\2\u01b0\u01b1\3\2\2\2\u01b1\u01ba\3\2\2\2\u01b2")
+ buf.write("\u01b4\5\62\32\2\u01b3\u01b2\3\2\2\2\u01b4\u01b7\3\2\2")
+ buf.write("\2\u01b5\u01b3\3\2\2\2\u01b5\u01b6\3\2\2\2\u01b6\u01b8")
+ buf.write("\3\2\2\2\u01b7\u01b5\3\2\2\2\u01b8\u01ba\7_\2\2\u01b9")
+ buf.write("\u01a7\3\2\2\2\u01b9\u01b5\3\2\2\2\u01ba9\3\2\2\2\u01bb")
+ buf.write("\u01c0\7_\2\2\u01bc\u01bd\7\6\2\2\u01bd\u01bf\7_\2\2\u01be")
+ buf.write("\u01bc\3\2\2\2\u01bf\u01c2\3\2\2\2\u01c0\u01be\3\2\2\2")
+ buf.write("\u01c0\u01c1\3\2\2\2\u01c1;\3\2\2\2\u01c2\u01c0\3\2\2")
+ buf.write("\2\u01c3\u01c5\5\36\20\2\u01c4\u01c6\5> \2\u01c5\u01c4")
+ buf.write("\3\2\2\2\u01c5\u01c6\3\2\2\2\u01c6\u01c9\3\2\2\2\u01c7")
+ buf.write("\u01c9\5\24\13\2\u01c8\u01c3\3\2\2\2\u01c8\u01c7\3\2\2")
+ buf.write("\2\u01c9=\3\2\2\2\u01ca\u01cc\5\62\32\2\u01cb\u01cd\5")
+ buf.write("@!\2\u01cc\u01cb\3\2\2\2\u01cc\u01cd\3\2\2\2\u01cd\u01d0")
+ buf.write("\3\2\2\2\u01ce\u01d0\5@!\2\u01cf\u01ca\3\2\2\2\u01cf\u01ce")
+ buf.write("\3\2\2\2\u01d0?\3\2\2\2\u01d1\u01d2\7(\2\2\u01d2\u01d3")
+ buf.write("\5> \2\u01d3\u01d4\7)\2\2\u01d4\u01d7\3\2\2\2\u01d5\u01d7")
+ buf.write("\5B\"\2\u01d6\u01d1\3\2\2\2\u01d6\u01d5\3\2\2\2\u01d7")
+ buf.write("\u01db\3\2\2\2\u01d8\u01da\5B\"\2\u01d9\u01d8\3\2\2\2")
+ buf.write("\u01da\u01dd\3\2\2\2\u01db\u01d9\3\2\2\2\u01db\u01dc\3")
+ buf.write("\2\2\2\u01dcA\3\2\2\2\u01dd\u01db\3\2\2\2\u01de\u01df")
+ buf.write("\7*\2\2\u01df\u01eb\7+\2\2\u01e0\u01e1\7*\2\2\u01e1\u01e2")
+ buf.write("\5^\60\2\u01e2\u01e3\7+\2\2\u01e3\u01eb\3\2\2\2\u01e4")
+ buf.write("\u01e5\7(\2\2\u01e5\u01eb\7)\2\2\u01e6\u01e7\7(\2\2\u01e7")
+ buf.write("\u01e8\5\64\33\2\u01e8\u01e9\7)\2\2\u01e9\u01eb\3\2\2")
+ buf.write("\2\u01ea\u01de\3\2\2\2\u01ea\u01e0\3\2\2\2\u01ea\u01e4")
+ buf.write("\3\2\2\2\u01ea\u01e6\3\2\2\2\u01ebC\3\2\2\2\u01ec\u01f5")
+ buf.write("\5`\61\2\u01ed\u01ee\7\3\2\2\u01ee\u01f0\5F$\2\u01ef\u01f1")
+ buf.write("\7\6\2\2\u01f0\u01ef\3\2\2\2\u01f0\u01f1\3\2\2\2\u01f1")
+ buf.write("\u01f2\3\2\2\2\u01f2\u01f3\7\26\2\2\u01f3\u01f5\3\2\2")
+ buf.write("\2\u01f4\u01ec\3\2\2\2\u01f4\u01ed\3\2\2\2\u01f5E\3\2")
+ buf.write("\2\2\u01f6\u01fb\5D#\2\u01f7\u01f8\7\6\2\2\u01f8\u01fa")
+ buf.write("\5D#\2\u01f9\u01f7\3\2\2\2\u01fa\u01fd\3\2\2\2\u01fb\u01f9")
+ buf.write("\3\2\2\2\u01fb\u01fc\3\2\2\2\u01fcG\3\2\2\2\u01fd\u01fb")
+ buf.write("\3\2\2\2\u01fe\u0200\5`\61\2\u01ff\u0201\7\37\2\2\u0200")
+ buf.write("\u01ff\3\2\2\2\u0200\u0201\3\2\2\2\u0201\u0209\3\2\2\2")
+ buf.write("\u0202\u0203\7\6\2\2\u0203\u0205\5`\61\2\u0204\u0206\7")
+ buf.write("\37\2\2\u0205\u0204\3\2\2\2\u0205\u0206\3\2\2\2\u0206")
+ buf.write("\u0208\3\2\2\2\u0207\u0202\3\2\2\2\u0208\u020b\3\2\2\2")
+ buf.write("\u0209\u0207\3\2\2\2\u0209\u020a\3\2\2\2\u020aI\3\2\2")
+ buf.write("\2\u020b\u0209\3\2\2\2\u020c\u0213\5L\'\2\u020d\u020e")
+ buf.write("\7.\2\2\u020e\u0212\5L\'\2\u020f\u0210\7/\2\2\u0210\u0212")
+ buf.write("\5L\'\2\u0211\u020d\3\2\2\2\u0211\u020f\3\2\2\2\u0212")
+ buf.write("\u0215\3\2\2\2\u0213\u0211\3\2\2\2\u0213\u0214\3\2\2\2")
+ buf.write("\u0214K\3\2\2\2\u0215\u0213\3\2\2\2\u0216\u021f\5N(\2")
+ buf.write("\u0217\u0218\7,\2\2\u0218\u021e\5N(\2\u0219\u021a\7\60")
+ buf.write("\2\2\u021a\u021e\5N(\2\u021b\u021c\7\61\2\2\u021c\u021e")
+ buf.write("\5N(\2\u021d\u0217\3\2\2\2\u021d\u0219\3\2\2\2\u021d\u021b")
+ buf.write("\3\2\2\2\u021e\u0221\3\2\2\2\u021f\u021d\3\2\2\2\u021f")
+ buf.write("\u0220\3\2\2\2\u0220M\3\2\2\2\u0221\u021f\3\2\2\2\u0222")
+ buf.write("\u0223\7(\2\2\u0223\u0224\5<\37\2\u0224\u0225\7)\2\2\u0225")
+ buf.write("\u0226\5N(\2\u0226\u0229\3\2\2\2\u0227\u0229\5P)\2\u0228")
+ buf.write("\u0222\3\2\2\2\u0228\u0227\3\2\2\2\u0229O\3\2\2\2\u022a")
+ buf.write("\u023a\5R*\2\u022b\u022c\7\62\2\2\u022c\u023a\5P)\2\u022d")
+ buf.write("\u022e\7\63\2\2\u022e\u023a\5P)\2\u022f\u0230\5V,\2\u0230")
+ buf.write("\u0231\5N(\2\u0231\u023a\3\2\2\2\u0232\u0233\7\64\2\2")
+ buf.write("\u0233\u023a\5P)\2\u0234\u0235\7\64\2\2\u0235\u0236\7")
+ buf.write("(\2\2\u0236\u0237\5<\37\2\u0237\u0238\7)\2\2\u0238\u023a")
+ buf.write("\3\2\2\2\u0239\u022a\3\2\2\2\u0239\u022b\3\2\2\2\u0239")
+ buf.write("\u022d\3\2\2\2\u0239\u022f\3\2\2\2\u0239\u0232\3\2\2\2")
+ buf.write("\u0239\u0234\3\2\2\2\u023aQ\3\2\2\2\u023b\u023c\5X-\2")
+ buf.write("\u023c\u025a\b*\1\2\u023d\u023e\7*\2\2\u023e\u023f\5\\")
+ buf.write("/\2\u023f\u0240\7+\2\2\u0240\u0259\3\2\2\2\u0241\u0242")
+ buf.write("\7(\2\2\u0242\u0243\7)\2\2\u0243\u0259\b*\1\2\u0244\u0245")
+ buf.write("\7(\2\2\u0245\u0246\5H%\2\u0246\u0247\7)\2\2\u0247\u0248")
+ buf.write("\b*\1\2\u0248\u0259\3\2\2\2\u0249\u024a\7(\2\2\u024a\u024b")
+ buf.write("\5T+\2\u024b\u024c\7)\2\2\u024c\u0259\3\2\2\2\u024d\u024e")
+ buf.write("\7\65\2\2\u024e\u024f\7_\2\2\u024f\u0259\b*\1\2\u0250")
+ buf.write("\u0251\7,\2\2\u0251\u0252\7_\2\2\u0252\u0259\b*\1\2\u0253")
+ buf.write("\u0254\7\66\2\2\u0254\u0255\7_\2\2\u0255\u0259\b*\1\2")
+ buf.write("\u0256\u0259\7\62\2\2\u0257\u0259\7\63\2\2\u0258\u023d")
+ buf.write("\3\2\2\2\u0258\u0241\3\2\2\2\u0258\u0244\3\2\2\2\u0258")
+ buf.write("\u0249\3\2\2\2\u0258\u024d\3\2\2\2\u0258\u0250\3\2\2\2")
+ buf.write("\u0258\u0253\3\2\2\2\u0258\u0256\3\2\2\2\u0258\u0257\3")
+ buf.write("\2\2\2\u0259\u025c\3\2\2\2\u025a\u0258\3\2\2\2\u025a\u025b")
+ buf.write("\3\2\2\2\u025bS\3\2\2\2\u025c\u025a\3\2\2\2\u025d\u0262")
+ buf.write("\58\35\2\u025e\u025f\7\6\2\2\u025f\u0261\58\35\2\u0260")
+ buf.write("\u025e\3\2\2\2\u0261\u0264\3\2\2\2\u0262\u0260\3\2\2\2")
+ buf.write("\u0262\u0263\3\2\2\2\u0263U\3\2\2\2\u0264\u0262\3\2\2")
+ buf.write("\2\u0265\u0266\t\5\2\2\u0266W\3\2\2\2\u0267\u026e\7_\2")
+ buf.write("\2\u0268\u026e\5Z.\2\u0269\u026a\7(\2\2\u026a\u026b\5")
+ buf.write("\\/\2\u026b\u026c\7)\2\2\u026c\u026e\3\2\2\2\u026d\u0267")
+ buf.write("\3\2\2\2\u026d\u0268\3\2\2\2\u026d\u0269\3\2\2\2\u026e")
+ buf.write("Y\3\2\2\2\u026f\u028a\7b\2\2\u0270\u028a\7d\2\2\u0271")
+ buf.write("\u028a\7c\2\2\u0272\u028a\7`\2\2\u0273\u0275\7_\2\2\u0274")
+ buf.write("\u0273\3\2\2\2\u0275\u0278\3\2\2\2\u0276\u0274\3\2\2\2")
+ buf.write("\u0276\u0277\3\2\2\2\u0277\u027a\3\2\2\2\u0278\u0276\3")
+ buf.write("\2\2\2\u0279\u027b\7a\2\2\u027a\u0279\3\2\2\2\u027b\u027c")
+ buf.write("\3\2\2\2\u027c\u027a\3\2\2\2\u027c\u027d\3\2\2\2\u027d")
+ buf.write("\u027f\3\2\2\2\u027e\u0276\3\2\2\2\u027f\u0280\3\2\2\2")
+ buf.write("\u0280\u027e\3\2\2\2\u0280\u0281\3\2\2\2\u0281\u0285\3")
+ buf.write("\2\2\2\u0282\u0284\7_\2\2\u0283\u0282\3\2\2\2\u0284\u0287")
+ buf.write("\3\2\2\2\u0285\u0283\3\2\2\2\u0285\u0286\3\2\2\2\u0286")
+ buf.write("\u028a\3\2\2\2\u0287\u0285\3\2\2\2\u0288\u028a\7e\2\2")
+ buf.write("\u0289\u026f\3\2\2\2\u0289\u0270\3\2\2\2\u0289\u0271\3")
+ buf.write("\2\2\2\u0289\u0272\3\2\2\2\u0289\u027e\3\2\2\2\u0289\u0288")
+ buf.write("\3\2\2\2\u028a[\3\2\2\2\u028b\u0290\5`\61\2\u028c\u028d")
+ buf.write("\7\6\2\2\u028d\u028f\5`\61\2\u028e\u028c\3\2\2\2\u028f")
+ buf.write("\u0292\3\2\2\2\u0290\u028e\3\2\2\2\u0290\u0291\3\2\2\2")
+ buf.write("\u0291]\3\2\2\2\u0292\u0290\3\2\2\2\u0293\u0294\5f\64")
+ buf.write("\2\u0294_\3\2\2\2\u0295\u0296\5b\62\2\u0296\u0297\5d\63")
+ buf.write("\2\u0297\u0298\5`\61\2\u0298\u029b\3\2\2\2\u0299\u029b")
+ buf.write("\5f\64\2\u029a\u0295\3\2\2\2\u029a\u0299\3\2\2\2\u029b")
+ buf.write("a\3\2\2\2\u029c\u029d\5P)\2\u029dc\3\2\2\2\u029e\u029f")
+ buf.write("\t\6\2\2\u029fe\3\2\2\2\u02a0\u02a7\5h\65\2\u02a1\u02a2")
+ buf.write("\7D\2\2\u02a2\u02a3\5\\/\2\u02a3\u02a4\7\31\2\2\u02a4")
+ buf.write("\u02a5\5f\64\2\u02a5\u02a6\b\64\1\2\u02a6\u02a8\3\2\2")
+ buf.write("\2\u02a7\u02a1\3\2\2\2\u02a7\u02a8\3\2\2\2\u02a8g\3\2")
+ buf.write("\2\2\u02a9\u02ae\5j\66\2\u02aa\u02ab\7E\2\2\u02ab\u02ad")
+ buf.write("\5j\66\2\u02ac\u02aa\3\2\2\2\u02ad\u02b0\3\2\2\2\u02ae")
+ buf.write("\u02ac\3\2\2\2\u02ae\u02af\3\2\2\2\u02afi\3\2\2\2\u02b0")
+ buf.write("\u02ae\3\2\2\2\u02b1\u02b6\5l\67\2\u02b2\u02b3\7F\2\2")
+ buf.write("\u02b3\u02b5\5l\67\2\u02b4\u02b2\3\2\2\2\u02b5\u02b8\3")
+ buf.write("\2\2\2\u02b6\u02b4\3\2\2\2\u02b6\u02b7\3\2\2\2\u02b7k")
+ buf.write("\3\2\2\2\u02b8\u02b6\3\2\2\2\u02b9\u02be\5n8\2\u02ba\u02bb")
+ buf.write("\7G\2\2\u02bb\u02bd\5n8\2\u02bc\u02ba\3\2\2\2\u02bd\u02c0")
+ buf.write("\3\2\2\2\u02be\u02bc\3\2\2\2\u02be\u02bf\3\2\2\2\u02bf")
+ buf.write("m\3\2\2\2\u02c0\u02be\3\2\2\2\u02c1\u02c6\5p9\2\u02c2")
+ buf.write("\u02c3\7H\2\2\u02c3\u02c5\5p9\2\u02c4\u02c2\3\2\2\2\u02c5")
+ buf.write("\u02c8\3\2\2\2\u02c6\u02c4\3\2\2\2\u02c6\u02c7\3\2\2\2")
+ buf.write("\u02c7o\3\2\2\2\u02c8\u02c6\3\2\2\2\u02c9\u02ce\5r:\2")
+ buf.write("\u02ca\u02cb\7\67\2\2\u02cb\u02cd\5r:\2\u02cc\u02ca\3")
+ buf.write("\2\2\2\u02cd\u02d0\3\2\2\2\u02ce\u02cc\3\2\2\2\u02ce\u02cf")
+ buf.write("\3\2\2\2\u02cfq\3\2\2\2\u02d0\u02ce\3\2\2\2\u02d1\u02d6")
+ buf.write("\5t;\2\u02d2\u02d3\t\7\2\2\u02d3\u02d5\5t;\2\u02d4\u02d2")
+ buf.write("\3\2\2\2\u02d5\u02d8\3\2\2\2\u02d6\u02d4\3\2\2\2\u02d6")
+ buf.write("\u02d7\3\2\2\2\u02d7s\3\2\2\2\u02d8\u02d6\3\2\2\2\u02d9")
+ buf.write("\u02de\5v<\2\u02da\u02db\t\b\2\2\u02db\u02dd\5v<\2\u02dc")
+ buf.write("\u02da\3\2\2\2\u02dd\u02e0\3\2\2\2\u02de\u02dc\3\2\2\2")
+ buf.write("\u02de\u02df\3\2\2\2\u02dfu\3\2\2\2\u02e0\u02de\3\2\2")
+ buf.write("\2\u02e1\u02e6\5J&\2\u02e2\u02e3\t\t\2\2\u02e3\u02e5\5")
+ buf.write("J&\2\u02e4\u02e2\3\2\2\2\u02e5\u02e8\3\2\2\2\u02e6\u02e4")
+ buf.write("\3\2\2\2\u02e6\u02e7\3\2\2\2\u02e7w\3\2\2\2\u02e8\u02e6")
+ buf.write("\3\2\2\2\u02e9\u02f5\5\u0082B\2\u02ea\u02f5\5\u0084C\2")
+ buf.write("\u02eb\u02f5\5\u0088E\2\u02ec\u02f5\5\u008aF\2\u02ed\u02f5")
+ buf.write("\5\u008cG\2\u02ee\u02f5\5\u008eH\2\u02ef\u02f5\5\u0080")
+ buf.write("A\2\u02f0\u02f5\5z>\2\u02f1\u02f5\5|?\2\u02f2\u02f5\5")
+ buf.write("~@\2\u02f3\u02f5\5\n\6\2\u02f4\u02e9\3\2\2\2\u02f4\u02ea")
+ buf.write("\3\2\2\2\u02f4\u02eb\3\2\2\2\u02f4\u02ec\3\2\2\2\u02f4")
+ buf.write("\u02ed\3\2\2\2\u02f4\u02ee\3\2\2\2\u02f4\u02ef\3\2\2\2")
+ buf.write("\u02f4\u02f0\3\2\2\2\u02f4\u02f1\3\2\2\2\u02f4\u02f2\3")
+ buf.write("\2\2\2\u02f4\u02f3\3\2\2\2\u02f5y\3\2\2\2\u02f6\u02f8")
+ buf.write("\7Q\2\2\u02f7\u02f6\3\2\2\2\u02f7\u02f8\3\2\2\2\u02f8")
+ buf.write("\u02f9\3\2\2\2\u02f9\u02fa\7_\2\2\u02fa\u02fe\7(\2\2\u02fb")
+ buf.write("\u02fd\n\n\2\2\u02fc\u02fb\3\2\2\2\u02fd\u0300\3\2\2\2")
+ buf.write("\u02fe\u02fc\3\2\2\2\u02fe\u02ff\3\2\2\2\u02ff\u0301\3")
+ buf.write("\2\2\2\u0300\u02fe\3\2\2\2\u0301\u0302\7)\2\2\u0302\u0303")
+ buf.write("\7\4\2\2\u0303{\3\2\2\2\u0304\u0305\7R\2\2\u0305\u0309")
+ buf.write("\7\3\2\2\u0306\u0308\n\13\2\2\u0307\u0306\3\2\2\2\u0308")
+ buf.write("\u030b\3\2\2\2\u0309\u0307\3\2\2\2\u0309\u030a\3\2\2\2")
+ buf.write("\u030a\u030c\3\2\2\2\u030b\u0309\3\2\2\2\u030c\u030d\7")
+ buf.write("\26\2\2\u030d}\3\2\2\2\u030e\u030f\7S\2\2\u030f\u0313")
+ buf.write("\7\3\2\2\u0310\u0312\n\13\2\2\u0311\u0310\3\2\2\2\u0312")
+ buf.write("\u0315\3\2\2\2\u0313\u0311\3\2\2\2\u0313\u0314\3\2\2\2")
+ buf.write("\u0314\u0316\3\2\2\2\u0315\u0313\3\2\2\2\u0316\u0317\7")
+ buf.write("\26\2\2\u0317\177\3\2\2\2\u0318\u0319\7_\2\2\u0319\u031d")
+ buf.write("\7(\2\2\u031a\u031c\5\n\6\2\u031b\u031a\3\2\2\2\u031c")
+ buf.write("\u031f\3\2\2\2\u031d\u031b\3\2\2\2\u031d\u031e\3\2\2\2")
+ buf.write("\u031e\u0321\3\2\2\2\u031f\u031d\3\2\2\2\u0320\u0322\5")
+ buf.write("\u0086D\2\u0321\u0320\3\2\2\2\u0321\u0322\3\2\2\2\u0322")
+ buf.write("\u0324\3\2\2\2\u0323\u0325\5\\/\2\u0324\u0323\3\2\2\2")
+ buf.write("\u0324\u0325\3\2\2\2\u0325\u0326\3\2\2\2\u0326\u0327\7")
+ buf.write(")\2\2\u0327\u0081\3\2\2\2\u0328\u0329\7_\2\2\u0329\u032a")
+ buf.write("\7\31\2\2\u032a\u0334\5x=\2\u032b\u032c\7T\2\2\u032c\u032d")
+ buf.write("\5^\60\2\u032d\u032e\7\31\2\2\u032e\u032f\5x=\2\u032f")
+ buf.write("\u0334\3\2\2\2\u0330\u0331\7U\2\2\u0331\u0332\7\31\2\2")
+ buf.write("\u0332\u0334\5x=\2\u0333\u0328\3\2\2\2\u0333\u032b\3\2")
+ buf.write("\2\2\u0333\u0330\3\2\2\2\u0334\u0083\3\2\2\2\u0335\u0339")
+ buf.write("\7\3\2\2\u0336\u0338\5\n\6\2\u0337\u0336\3\2\2\2\u0338")
+ buf.write("\u033b\3\2\2\2\u0339\u0337\3\2\2\2\u0339\u033a\3\2\2\2")
+ buf.write("\u033a\u033d\3\2\2\2\u033b\u0339\3\2\2\2\u033c\u033e\5")
+ buf.write("\u0086D\2\u033d\u033c\3\2\2\2\u033d\u033e\3\2\2\2\u033e")
+ buf.write("\u033f\3\2\2\2\u033f\u0340\7\26\2\2\u0340\u0085\3\2\2")
+ buf.write("\2\u0341\u0343\5x=\2\u0342\u0341\3\2\2\2\u0343\u0344\3")
+ buf.write("\2\2\2\u0344\u0342\3\2\2\2\u0344\u0345\3\2\2\2\u0345\u0087")
+ buf.write("\3\2\2\2\u0346\u034b\7\4\2\2\u0347\u0348\5\\/\2\u0348")
+ buf.write("\u0349\7\4\2\2\u0349\u034b\3\2\2\2\u034a\u0346\3\2\2\2")
+ buf.write("\u034a\u0347\3\2\2\2\u034b\u0089\3\2\2\2\u034c\u034d\7")
+ buf.write("V\2\2\u034d\u034e\7(\2\2\u034e\u034f\5\\/\2\u034f\u0350")
+ buf.write("\7)\2\2\u0350\u0351\bF\1\2\u0351\u0354\5x=\2\u0352\u0353")
+ buf.write("\7W\2\2\u0353\u0355\5x=\2\u0354\u0352\3\2\2\2\u0354\u0355")
+ buf.write("\3\2\2\2\u0355\u035d\3\2\2\2\u0356\u0357\7X\2\2\u0357")
+ buf.write("\u0358\7(\2\2\u0358\u0359\5\\/\2\u0359\u035a\7)\2\2\u035a")
+ buf.write("\u035b\5x=\2\u035b\u035d\3\2\2\2\u035c\u034c\3\2\2\2\u035c")
+ buf.write("\u0356\3\2\2\2\u035d\u008b\3\2\2\2\u035e\u035f\7Y\2\2")
+ buf.write("\u035f\u0360\7(\2\2\u0360\u0361\5\\/\2\u0361\u0362\7)")
+ buf.write("\2\2\u0362\u0363\5x=\2\u0363\u0364\bG\1\2\u0364\u036f")
+ buf.write("\3\2\2\2\u0365\u0366\7Z\2\2\u0366\u0367\5x=\2\u0367\u0368")
+ buf.write("\7Y\2\2\u0368\u0369\7(\2\2\u0369\u036a\5\\/\2\u036a\u036b")
+ buf.write("\7)\2\2\u036b\u036c\7\4\2\2\u036c\u036d\bG\1\2\u036d\u036f")
+ buf.write("\3\2\2\2\u036e\u035e\3\2\2\2\u036e\u0365\3\2\2\2\u036f")
+ buf.write("\u008d\3\2\2\2\u0370\u0371\7[\2\2\u0371\u0372\7_\2\2\u0372")
+ buf.write("\u037e\7\4\2\2\u0373\u0374\7\\\2\2\u0374\u037e\7\4\2\2")
+ buf.write("\u0375\u0376\7]\2\2\u0376\u037e\7\4\2\2\u0377\u0378\7")
+ buf.write("^\2\2\u0378\u037e\7\4\2\2\u0379\u037a\7^\2\2\u037a\u037b")
+ buf.write("\5\\/\2\u037b\u037c\7\4\2\2\u037c\u037e\3\2\2\2\u037d")
+ buf.write("\u0370\3\2\2\2\u037d\u0373\3\2\2\2\u037d\u0375\3\2\2\2")
+ buf.write("\u037d\u0377\3\2\2\2\u037d\u0379\3\2\2\2\u037e\u008f\3")
+ buf.write("\2\2\2o\u0093\u0097\u009d\u00a6\u00a8\u00ab\u00b1\u00b6")
+ buf.write("\u00bd\u00bf\u00c3\u00cb\u00d0\u00d7\u00dd\u00f4\u00f9")
+ buf.write("\u00ff\u0108\u010f\u0117\u0119\u0120\u0126\u012a\u0130")
+ buf.write("\u0139\u013f\u0146\u014c\u0151\u0154\u0157\u015a\u015e")
+ buf.write("\u0164\u0169\u0170\u0172\u0184\u018a\u018d\u0192\u0197")
+ buf.write("\u019a\u019f\u01a4\u01aa\u01ac\u01b0\u01b5\u01b9\u01c0")
+ buf.write("\u01c5\u01c8\u01cc\u01cf\u01d6\u01db\u01ea\u01f0\u01f4")
+ buf.write("\u01fb\u0200\u0205\u0209\u0211\u0213\u021d\u021f\u0228")
+ buf.write("\u0239\u0258\u025a\u0262\u026d\u0276\u027c\u0280\u0285")
+ buf.write("\u0289\u0290\u029a\u02a7\u02ae\u02b6\u02be\u02c6\u02ce")
+ buf.write("\u02d6\u02de\u02e6\u02f4\u02f7\u02fe\u0309\u0313\u031d")
+ buf.write("\u0321\u0324\u0333\u0339\u033d\u0344\u034a\u0354\u035c")
+ buf.write("\u036e\u037d")
+ return buf.getvalue()
+
+
+class CParser ( Parser ):
+
+ grammarFileName = "C.g4"
+
+ atn = ATNDeserializer().deserialize(serializedATN())
+
+ decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
+
+ sharedContextCache = PredictionContextCache()
+
+ literalNames = [ "<INVALID>", "'{'", "';'", "'typedef'", "','", "'='",
+ "'extern'", "'static'", "'auto'", "'register'", "'STATIC'",
+ "'void'", "'char'", "'short'", "'int'", "'long'", "'float'",
+ "'double'", "'signed'", "'unsigned'", "'}'", "'struct'",
+ "'union'", "':'", "'enum'", "'const'", "'volatile'",
+ "'IN'", "'OUT'", "'OPTIONAL'", "'CONST'", "'UNALIGNED'",
+ "'VOLATILE'", "'GLOBAL_REMOVE_IF_UNREFERENCED'", "'EFIAPI'",
+ "'EFI_BOOTSERVICE'", "'EFI_RUNTIMESERVICE'", "'PACKED'",
+ "'('", "')'", "'['", "']'", "'*'", "'...'", "'+'",
+ "'-'", "'/'", "'%'", "'++'", "'--'", "'sizeof'", "'.'",
+ "'->'", "'&'", "'~'", "'!'", "'*='", "'/='", "'%='",
+ "'+='", "'-='", "'<<='", "'>>='", "'&='", "'^='", "'|='",
+ "'?'", "'||'", "'&&'", "'|'", "'^'", "'=='", "'!='",
+ "'<'", "'>'", "'<='", "'>='", "'<<'", "'>>'", "'__asm__'",
+ "'_asm'", "'__asm'", "'case'", "'default'", "'if'",
+ "'else'", "'switch'", "'while'", "'do'", "'goto'",
+ "'continue'", "'break'", "'return'" ]
+
+ symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "IDENTIFIER", "CHARACTER_LITERAL", "STRING_LITERAL",
+ "HEX_LITERAL", "DECIMAL_LITERAL", "OCTAL_LITERAL",
+ "FLOATING_POINT_LITERAL", "WS", "BS", "UnicodeVocabulary",
+ "COMMENT", "LINE_COMMENT", "LINE_COMMAND" ]
+
+ RULE_translation_unit = 0
+ RULE_external_declaration = 1
+ RULE_function_definition = 2
+ RULE_declaration_specifiers = 3
+ RULE_declaration = 4
+ RULE_init_declarator_list = 5
+ RULE_init_declarator = 6
+ RULE_storage_class_specifier = 7
+ RULE_type_specifier = 8
+ RULE_type_id = 9
+ RULE_struct_or_union_specifier = 10
+ RULE_struct_or_union = 11
+ RULE_struct_declaration_list = 12
+ RULE_struct_declaration = 13
+ RULE_specifier_qualifier_list = 14
+ RULE_struct_declarator_list = 15
+ RULE_struct_declarator = 16
+ RULE_enum_specifier = 17
+ RULE_enumerator_list = 18
+ RULE_enumerator = 19
+ RULE_type_qualifier = 20
+ RULE_declarator = 21
+ RULE_direct_declarator = 22
+ RULE_declarator_suffix = 23
+ RULE_pointer = 24
+ RULE_parameter_type_list = 25
+ RULE_parameter_list = 26
+ RULE_parameter_declaration = 27
+ RULE_identifier_list = 28
+ RULE_type_name = 29
+ RULE_abstract_declarator = 30
+ RULE_direct_abstract_declarator = 31
+ RULE_abstract_declarator_suffix = 32
+ RULE_initializer = 33
+ RULE_initializer_list = 34
+ RULE_argument_expression_list = 35
+ RULE_additive_expression = 36
+ RULE_multiplicative_expression = 37
+ RULE_cast_expression = 38
+ RULE_unary_expression = 39
+ RULE_postfix_expression = 40
+ RULE_macro_parameter_list = 41
+ RULE_unary_operator = 42
+ RULE_primary_expression = 43
+ RULE_constant = 44
+ RULE_expression = 45
+ RULE_constant_expression = 46
+ RULE_assignment_expression = 47
+ RULE_lvalue = 48
+ RULE_assignment_operator = 49
+ RULE_conditional_expression = 50
+ RULE_logical_or_expression = 51
+ RULE_logical_and_expression = 52
+ RULE_inclusive_or_expression = 53
+ RULE_exclusive_or_expression = 54
+ RULE_and_expression = 55
+ RULE_equality_expression = 56
+ RULE_relational_expression = 57
+ RULE_shift_expression = 58
+ RULE_statement = 59
+ RULE_asm2_statement = 60
+ RULE_asm1_statement = 61
+ RULE_asm_statement = 62
+ RULE_macro_statement = 63
+ RULE_labeled_statement = 64
+ RULE_compound_statement = 65
+ RULE_statement_list = 66
+ RULE_expression_statement = 67
+ RULE_selection_statement = 68
+ RULE_iteration_statement = 69
+ RULE_jump_statement = 70
+
+ ruleNames = [ "translation_unit", "external_declaration", "function_definition",
+ "declaration_specifiers", "declaration", "init_declarator_list",
+ "init_declarator", "storage_class_specifier", "type_specifier",
+ "type_id", "struct_or_union_specifier", "struct_or_union",
+ "struct_declaration_list", "struct_declaration", "specifier_qualifier_list",
+ "struct_declarator_list", "struct_declarator", "enum_specifier",
+ "enumerator_list", "enumerator", "type_qualifier", "declarator",
+ "direct_declarator", "declarator_suffix", "pointer",
+ "parameter_type_list", "parameter_list", "parameter_declaration",
+ "identifier_list", "type_name", "abstract_declarator",
+ "direct_abstract_declarator", "abstract_declarator_suffix",
+ "initializer", "initializer_list", "argument_expression_list",
+ "additive_expression", "multiplicative_expression", "cast_expression",
+ "unary_expression", "postfix_expression", "macro_parameter_list",
+ "unary_operator", "primary_expression", "constant", "expression",
+ "constant_expression", "assignment_expression", "lvalue",
+ "assignment_operator", "conditional_expression", "logical_or_expression",
+ "logical_and_expression", "inclusive_or_expression",
+ "exclusive_or_expression", "and_expression", "equality_expression",
+ "relational_expression", "shift_expression", "statement",
+ "asm2_statement", "asm1_statement", "asm_statement",
+ "macro_statement", "labeled_statement", "compound_statement",
+ "statement_list", "expression_statement", "selection_statement",
+ "iteration_statement", "jump_statement" ]
+
+ EOF = Token.EOF
+ T__0=1
+ T__1=2
+ T__2=3
+ T__3=4
+ T__4=5
+ T__5=6
+ T__6=7
+ T__7=8
+ T__8=9
+ T__9=10
+ T__10=11
+ T__11=12
+ T__12=13
+ T__13=14
+ T__14=15
+ T__15=16
+ T__16=17
+ T__17=18
+ T__18=19
+ T__19=20
+ T__20=21
+ T__21=22
+ T__22=23
+ T__23=24
+ T__24=25
+ T__25=26
+ T__26=27
+ T__27=28
+ T__28=29
+ T__29=30
+ T__30=31
+ T__31=32
+ T__32=33
+ T__33=34
+ T__34=35
+ T__35=36
+ T__36=37
+ T__37=38
+ T__38=39
+ T__39=40
+ T__40=41
+ T__41=42
+ T__42=43
+ T__43=44
+ T__44=45
+ T__45=46
+ T__46=47
+ T__47=48
+ T__48=49
+ T__49=50
+ T__50=51
+ T__51=52
+ T__52=53
+ T__53=54
+ T__54=55
+ T__55=56
+ T__56=57
+ T__57=58
+ T__58=59
+ T__59=60
+ T__60=61
+ T__61=62
+ T__62=63
+ T__63=64
+ T__64=65
+ T__65=66
+ T__66=67
+ T__67=68
+ T__68=69
+ T__69=70
+ T__70=71
+ T__71=72
+ T__72=73
+ T__73=74
+ T__74=75
+ T__75=76
+ T__76=77
+ T__77=78
+ T__78=79
+ T__79=80
+ T__80=81
+ T__81=82
+ T__82=83
+ T__83=84
+ T__84=85
+ T__85=86
+ T__86=87
+ T__87=88
+ T__88=89
+ T__89=90
+ T__90=91
+ T__91=92
+ IDENTIFIER=93
+ CHARACTER_LITERAL=94
+ STRING_LITERAL=95
+ HEX_LITERAL=96
+ DECIMAL_LITERAL=97
+ OCTAL_LITERAL=98
+ FLOATING_POINT_LITERAL=99
+ WS=100
+ BS=101
+ UnicodeVocabulary=102
+ COMMENT=103
+ LINE_COMMENT=104
+ LINE_COMMAND=105
+
+ # @param input Type: TokenStream
+ # @param output= sys.stdout Type: TextIO
+ def __init__(self,input,output= sys.stdout):
+ super().__init__(input, output)
+ self.checkVersion("4.7.1")
+ self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
+ self._predicates = None
+
+
+
+
+ def printTokenInfo(self,line,offset,tokenText):
+ print(str(line)+ ',' + str(offset) + ':' + str(tokenText))
+
+ def StorePredicateExpression(self,StartLine,StartOffset,EndLine,EndOffset,Text):
+ PredExp = CodeFragment.PredicateExpression(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.PredicateExpressionList.append(PredExp)
+
+ def StoreEnumerationDefinition(self,StartLine,StartOffset,EndLine,EndOffset,Text):
+ EnumDef = CodeFragment.EnumerationDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.EnumerationDefinitionList.append(EnumDef)
+
+ def StoreStructUnionDefinition(self,StartLine,StartOffset,EndLine,EndOffset,Text):
+ SUDef = CodeFragment.StructUnionDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.StructUnionDefinitionList.append(SUDef)
+
+ def StoreTypedefDefinition(self,StartLine,StartOffset,EndLine,EndOffset,FromText,ToText):
+ Tdef = CodeFragment.TypedefDefinition(FromText, ToText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.TypedefDefinitionList.append(Tdef)
+
+ def StoreFunctionDefinition(self,StartLine,StartOffset,EndLine,EndOffset,ModifierText,DeclText,LeftBraceLine,LeftBraceOffset,DeclLine,DeclOffset):
+ FuncDef = CodeFragment.FunctionDefinition(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset), (LeftBraceLine, LeftBraceOffset), (DeclLine, DeclOffset))
+ FileProfile.FunctionDefinitionList.append(FuncDef)
+
+ def StoreVariableDeclaration(self,StartLine,StartOffset,EndLine,EndOffset,ModifierText,DeclText):
+ VarDecl = CodeFragment.VariableDeclaration(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.VariableDeclarationList.append(VarDecl)
+
+ def StoreFunctionCalling(self,StartLine,StartOffset,EndLine,EndOffset,FuncName,ParamList):
+ FuncCall = CodeFragment.FunctionCalling(FuncName, ParamList, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.FunctionCallingList.append(FuncCall)
+
+
+
+ class Translation_unitContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def external_declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.External_declarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.External_declarationContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_translation_unit
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterTranslation_unit" ):
+ listener.enterTranslation_unit(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitTranslation_unit" ):
+ listener.exitTranslation_unit(self)
+
+
+
+
+ def translation_unit(self):
+
+ localctx = CParser.Translation_unitContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 0, self.RULE_translation_unit)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 145
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__2) | (1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9) | (1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36) | (1 << CParser.T__37) | (1 << CParser.T__41))) != 0) or _la==CParser.IDENTIFIER:
+ self.state = 142
+ self.external_declaration()
+ self.state = 147
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class External_declarationContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def declarator(self):
+ return self.getTypedRuleContext(CParser.DeclaratorContext,0)
+
+
+ def declaration_specifiers(self):
+ return self.getTypedRuleContext(CParser.Declaration_specifiersContext,0)
+
+
+ # @param i=None Type: int
+ def declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.DeclarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.DeclarationContext,i)
+
+
+ def function_definition(self):
+ return self.getTypedRuleContext(CParser.Function_definitionContext,0)
+
+
+ def macro_statement(self):
+ return self.getTypedRuleContext(CParser.Macro_statementContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_external_declaration
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterExternal_declaration" ):
+ listener.enterExternal_declaration(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitExternal_declaration" ):
+ listener.exitExternal_declaration(self)
+
+
+
+
+ def external_declaration(self):
+
+ localctx = CParser.External_declarationContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 2, self.RULE_external_declaration)
+ self._la = 0 # Token type
+ try:
+ self.state = 166
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,4,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 149
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,1,self._ctx)
+ if la_ == 1:
+ self.state = 148
+ self.declaration_specifiers()
+
+
+ self.state = 151
+ self.declarator()
+ self.state = 155
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__2) | (1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9) | (1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36))) != 0) or _la==CParser.IDENTIFIER:
+ self.state = 152
+ self.declaration()
+ self.state = 157
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 158
+ self.match(CParser.T__0)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 160
+ self.function_definition()
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 161
+ self.declaration()
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 162
+ self.macro_statement()
+ self.state = 164
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__1:
+ self.state = 163
+ self.match(CParser.T__1)
+
+
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Function_definitionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.ModifierText = ''
+ self.DeclText = ''
+ self.LBLine = 0
+ self.LBOffset = 0
+ self.DeclLine = 0
+ self.DeclOffset = 0
+ self.d = None # Declaration_specifiersContext
+ self._declaration_specifiers = None # Declaration_specifiersContext
+ self._declarator = None # DeclaratorContext
+ self.a = None # Compound_statementContext
+ self.b = None # Compound_statementContext
+
+ def declarator(self):
+ return self.getTypedRuleContext(CParser.DeclaratorContext,0)
+
+
+ def compound_statement(self):
+ return self.getTypedRuleContext(CParser.Compound_statementContext,0)
+
+
+ def declaration_specifiers(self):
+ return self.getTypedRuleContext(CParser.Declaration_specifiersContext,0)
+
+
+ # @param i=None Type: int
+ def declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.DeclarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.DeclarationContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_function_definition
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterFunction_definition" ):
+ listener.enterFunction_definition(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitFunction_definition" ):
+ listener.exitFunction_definition(self)
+
+
+
+
+ def function_definition(self):
+
+ localctx = CParser.Function_definitionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 4, self.RULE_function_definition)
+
+ ModifierText = '';
+ DeclText = '';
+ LBLine = 0;
+ LBOffset = 0;
+ DeclLine = 0;
+ DeclOffset = 0;
+
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 169
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,5,self._ctx)
+ if la_ == 1:
+ self.state = 168
+ localctx.d = localctx._declaration_specifiers = self.declaration_specifiers()
+
+
+ self.state = 171
+ localctx._declarator = self.declarator()
+ self.state = 180
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__2, CParser.T__5, CParser.T__6, CParser.T__7, CParser.T__8, CParser.T__9, CParser.T__10, CParser.T__11, CParser.T__12, CParser.T__13, CParser.T__14, CParser.T__15, CParser.T__16, CParser.T__17, CParser.T__18, CParser.T__20, CParser.T__21, CParser.T__23, CParser.T__24, CParser.T__25, CParser.T__26, CParser.T__27, CParser.T__28, CParser.T__29, CParser.T__30, CParser.T__31, CParser.T__32, CParser.T__33, CParser.T__34, CParser.T__35, CParser.T__36, CParser.IDENTIFIER]:
+ self.state = 173
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while True:
+ self.state = 172
+ self.declaration()
+ self.state = 175
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__2) | (1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9) | (1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36))) != 0) or _la==CParser.IDENTIFIER):
+ break
+
+ self.state = 177
+ localctx.a = self.compound_statement()
+ pass
+ elif token in [CParser.T__0]:
+ self.state = 179
+ localctx.b = self.compound_statement()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+
+ if localctx.d != None:
+ ModifierText = (None if localctx._declaration_specifiers is None else self._input.getText((localctx._declaration_specifiers.start,localctx._declaration_specifiers.stop)))
+ else:
+ ModifierText = ''
+ DeclText = (None if localctx._declarator is None else self._input.getText((localctx._declarator.start,localctx._declarator.stop)))
+ DeclLine = (None if localctx._declarator is None else localctx._declarator.start).line
+ DeclOffset = (None if localctx._declarator is None else localctx._declarator.start).column
+ if localctx.a != None:
+ LBLine = (None if localctx.a is None else localctx.a.start).line
+ LBOffset = (None if localctx.a is None else localctx.a.start).column
+ else:
+ LBLine = (None if localctx.b is None else localctx.b.start).line
+ LBOffset = (None if localctx.b is None else localctx.b.start).column
+
+ self._ctx.stop = self._input.LT(-1)
+
+ self.StoreFunctionDefinition(localctx.start.line, localctx.start.column, localctx.stop.line, localctx.stop.column, ModifierText, DeclText, LBLine, LBOffset, DeclLine, DeclOffset)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Declaration_specifiersContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def storage_class_specifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Storage_class_specifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Storage_class_specifierContext,i)
+
+
+ # @param i=None Type: int
+ def type_specifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Type_specifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Type_specifierContext,i)
+
+
+ # @param i=None Type: int
+ def type_qualifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Type_qualifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Type_qualifierContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_declaration_specifiers
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterDeclaration_specifiers" ):
+ listener.enterDeclaration_specifiers(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitDeclaration_specifiers" ):
+ listener.exitDeclaration_specifiers(self)
+
+
+
+
+ def declaration_specifiers(self):
+
+ localctx = CParser.Declaration_specifiersContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 6, self.RULE_declaration_specifiers)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 187
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 187
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__5, CParser.T__6, CParser.T__7, CParser.T__8, CParser.T__9]:
+ self.state = 184
+ self.storage_class_specifier()
+ pass
+ elif token in [CParser.T__10, CParser.T__11, CParser.T__12, CParser.T__13, CParser.T__14, CParser.T__15, CParser.T__16, CParser.T__17, CParser.T__18, CParser.T__20, CParser.T__21, CParser.T__23, CParser.IDENTIFIER]:
+ self.state = 185
+ self.type_specifier()
+ pass
+ elif token in [CParser.T__24, CParser.T__25, CParser.T__26, CParser.T__27, CParser.T__28, CParser.T__29, CParser.T__30, CParser.T__31, CParser.T__32, CParser.T__33, CParser.T__34, CParser.T__35, CParser.T__36]:
+ self.state = 186
+ self.type_qualifier()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 189
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,9,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class DeclarationContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.a = None # Token
+ self.b = None # Declaration_specifiersContext
+ self.c = None # Init_declarator_listContext
+ self.d = None # Token
+ self.s = None # Declaration_specifiersContext
+ self.t = None # Init_declarator_listContext
+ self.e = None # Token
+
+ def init_declarator_list(self):
+ return self.getTypedRuleContext(CParser.Init_declarator_listContext,0)
+
+
+ def declaration_specifiers(self):
+ return self.getTypedRuleContext(CParser.Declaration_specifiersContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_declaration
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterDeclaration" ):
+ listener.enterDeclaration(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitDeclaration" ):
+ listener.exitDeclaration(self)
+
+
+
+
+ def declaration(self):
+
+ localctx = CParser.DeclarationContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 8, self.RULE_declaration)
+ self._la = 0 # Token type
+ try:
+ self.state = 206
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__2]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 191
+ localctx.a = self.match(CParser.T__2)
+ self.state = 193
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,10,self._ctx)
+ if la_ == 1:
+ self.state = 192
+ localctx.b = self.declaration_specifiers()
+
+
+ self.state = 195
+ localctx.c = self.init_declarator_list()
+ self.state = 196
+ localctx.d = self.match(CParser.T__1)
+
+ if localctx.b is not None:
+ self.StoreTypedefDefinition(localctx.a.line, localctx.a.column, (0 if localctx.d is None else localctx.d.line), localctx.d.column, (None if localctx.b is None else self._input.getText((localctx.b.start,localctx.b.stop))), (None if localctx.c is None else self._input.getText((localctx.c.start,localctx.c.stop))))
+ else:
+ self.StoreTypedefDefinition(localctx.a.line, localctx.a.column, (0 if localctx.d is None else localctx.d.line), localctx.d.column, '', (None if localctx.c is None else self._input.getText((localctx.c.start,localctx.c.stop))))
+
+ pass
+ elif token in [CParser.T__5, CParser.T__6, CParser.T__7, CParser.T__8, CParser.T__9, CParser.T__10, CParser.T__11, CParser.T__12, CParser.T__13, CParser.T__14, CParser.T__15, CParser.T__16, CParser.T__17, CParser.T__18, CParser.T__20, CParser.T__21, CParser.T__23, CParser.T__24, CParser.T__25, CParser.T__26, CParser.T__27, CParser.T__28, CParser.T__29, CParser.T__30, CParser.T__31, CParser.T__32, CParser.T__33, CParser.T__34, CParser.T__35, CParser.T__36, CParser.IDENTIFIER]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 199
+ localctx.s = self.declaration_specifiers()
+ self.state = 201
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if ((((_la - 34)) & ~0x3f) == 0 and ((1 << (_la - 34)) & ((1 << (CParser.T__33 - 34)) | (1 << (CParser.T__34 - 34)) | (1 << (CParser.T__35 - 34)) | (1 << (CParser.T__37 - 34)) | (1 << (CParser.T__41 - 34)) | (1 << (CParser.IDENTIFIER - 34)))) != 0):
+ self.state = 200
+ localctx.t = self.init_declarator_list()
+
+
+ self.state = 203
+ localctx.e = self.match(CParser.T__1)
+
+ if localctx.t is not None:
+ self.StoreVariableDeclaration((None if localctx.s is None else localctx.s.start).line, (None if localctx.s is None else localctx.s.start).column, (None if localctx.t is None else localctx.t.start).line, (None if localctx.t is None else localctx.t.start).column, (None if localctx.s is None else self._input.getText((localctx.s.start,localctx.s.stop))), (None if localctx.t is None else self._input.getText((localctx.t.start,localctx.t.stop))))
+
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Init_declarator_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def init_declarator(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Init_declaratorContext)
+ else:
+ return self.getTypedRuleContext(CParser.Init_declaratorContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_init_declarator_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterInit_declarator_list" ):
+ listener.enterInit_declarator_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitInit_declarator_list" ):
+ listener.exitInit_declarator_list(self)
+
+
+
+
+ def init_declarator_list(self):
+
+ localctx = CParser.Init_declarator_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 10, self.RULE_init_declarator_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 208
+ self.init_declarator()
+ self.state = 213
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__3:
+ self.state = 209
+ self.match(CParser.T__3)
+ self.state = 210
+ self.init_declarator()
+ self.state = 215
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Init_declaratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def declarator(self):
+ return self.getTypedRuleContext(CParser.DeclaratorContext,0)
+
+
+ def initializer(self):
+ return self.getTypedRuleContext(CParser.InitializerContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_init_declarator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterInit_declarator" ):
+ listener.enterInit_declarator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitInit_declarator" ):
+ listener.exitInit_declarator(self)
+
+
+
+
+ def init_declarator(self):
+
+ localctx = CParser.Init_declaratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 12, self.RULE_init_declarator)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 216
+ self.declarator()
+ self.state = 219
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__4:
+ self.state = 217
+ self.match(CParser.T__4)
+ self.state = 218
+ self.initializer()
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Storage_class_specifierContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_storage_class_specifier
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStorage_class_specifier" ):
+ listener.enterStorage_class_specifier(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStorage_class_specifier" ):
+ listener.exitStorage_class_specifier(self)
+
+
+
+
+ def storage_class_specifier(self):
+
+ localctx = CParser.Storage_class_specifierContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 14, self.RULE_storage_class_specifier)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 221
+ _la = self._input.LA(1)
+ if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9))) != 0)):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Type_specifierContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.s = None # Struct_or_union_specifierContext
+ self.e = None # Enum_specifierContext
+
+ def struct_or_union_specifier(self):
+ return self.getTypedRuleContext(CParser.Struct_or_union_specifierContext,0)
+
+
+ def enum_specifier(self):
+ return self.getTypedRuleContext(CParser.Enum_specifierContext,0)
+
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def declarator(self):
+ return self.getTypedRuleContext(CParser.DeclaratorContext,0)
+
+
+ # @param i=None Type: int
+ def type_qualifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Type_qualifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Type_qualifierContext,i)
+
+
+ def type_id(self):
+ return self.getTypedRuleContext(CParser.Type_idContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_type_specifier
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterType_specifier" ):
+ listener.enterType_specifier(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitType_specifier" ):
+ listener.exitType_specifier(self)
+
+
+
+
+ def type_specifier(self):
+
+ localctx = CParser.Type_specifierContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 16, self.RULE_type_specifier)
+ try:
+ self.state = 247
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,16,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 223
+ self.match(CParser.T__10)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 224
+ self.match(CParser.T__11)
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 225
+ self.match(CParser.T__12)
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 226
+ self.match(CParser.T__13)
+ pass
+
+ elif la_ == 5:
+ self.enterOuterAlt(localctx, 5)
+ self.state = 227
+ self.match(CParser.T__14)
+ pass
+
+ elif la_ == 6:
+ self.enterOuterAlt(localctx, 6)
+ self.state = 228
+ self.match(CParser.T__15)
+ pass
+
+ elif la_ == 7:
+ self.enterOuterAlt(localctx, 7)
+ self.state = 229
+ self.match(CParser.T__16)
+ pass
+
+ elif la_ == 8:
+ self.enterOuterAlt(localctx, 8)
+ self.state = 230
+ self.match(CParser.T__17)
+ pass
+
+ elif la_ == 9:
+ self.enterOuterAlt(localctx, 9)
+ self.state = 231
+ self.match(CParser.T__18)
+ pass
+
+ elif la_ == 10:
+ self.enterOuterAlt(localctx, 10)
+ self.state = 232
+ localctx.s = self.struct_or_union_specifier()
+
+ if localctx.s.stop is not None:
+ self.StoreStructUnionDefinition((None if localctx.s is None else localctx.s.start).line, (None if localctx.s is None else localctx.s.start).column, (None if localctx.s is None else localctx.s.stop).line, (None if localctx.s is None else localctx.s.stop).column, (None if localctx.s is None else self._input.getText((localctx.s.start,localctx.s.stop))))
+
+ pass
+
+ elif la_ == 11:
+ self.enterOuterAlt(localctx, 11)
+ self.state = 235
+ localctx.e = self.enum_specifier()
+
+ if localctx.e.stop is not None:
+ self.StoreEnumerationDefinition((None if localctx.e is None else localctx.e.start).line, (None if localctx.e is None else localctx.e.start).column, (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is None else localctx.e.stop).column, (None if localctx.e is None else self._input.getText((localctx.e.start,localctx.e.stop))))
+
+ pass
+
+ elif la_ == 12:
+ self.enterOuterAlt(localctx, 12)
+ self.state = 238
+ self.match(CParser.IDENTIFIER)
+ self.state = 242
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,15,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 239
+ self.type_qualifier()
+ self.state = 244
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,15,self._ctx)
+
+ self.state = 245
+ self.declarator()
+ pass
+
+ elif la_ == 13:
+ self.enterOuterAlt(localctx, 13)
+ self.state = 246
+ self.type_id()
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Type_idContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def getRuleIndex(self):
+ return CParser.RULE_type_id
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterType_id" ):
+ listener.enterType_id(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitType_id" ):
+ listener.exitType_id(self)
+
+
+
+
+ def type_id(self):
+
+ localctx = CParser.Type_idContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 18, self.RULE_type_id)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 249
+ self.match(CParser.IDENTIFIER)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Struct_or_union_specifierContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def struct_or_union(self):
+ return self.getTypedRuleContext(CParser.Struct_or_unionContext,0)
+
+
+ def struct_declaration_list(self):
+ return self.getTypedRuleContext(CParser.Struct_declaration_listContext,0)
+
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def getRuleIndex(self):
+ return CParser.RULE_struct_or_union_specifier
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStruct_or_union_specifier" ):
+ listener.enterStruct_or_union_specifier(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStruct_or_union_specifier" ):
+ listener.exitStruct_or_union_specifier(self)
+
+
+
+
+ def struct_or_union_specifier(self):
+
+ localctx = CParser.Struct_or_union_specifierContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 20, self.RULE_struct_or_union_specifier)
+ self._la = 0 # Token type
+ try:
+ self.state = 262
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,18,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 251
+ self.struct_or_union()
+ self.state = 253
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.IDENTIFIER:
+ self.state = 252
+ self.match(CParser.IDENTIFIER)
+
+
+ self.state = 255
+ self.match(CParser.T__0)
+ self.state = 256
+ self.struct_declaration_list()
+ self.state = 257
+ self.match(CParser.T__19)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 259
+ self.struct_or_union()
+ self.state = 260
+ self.match(CParser.IDENTIFIER)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Struct_or_unionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_struct_or_union
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStruct_or_union" ):
+ listener.enterStruct_or_union(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStruct_or_union" ):
+ listener.exitStruct_or_union(self)
+
+
+
+
+ def struct_or_union(self):
+
+ localctx = CParser.Struct_or_unionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 22, self.RULE_struct_or_union)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 264
+ _la = self._input.LA(1)
+ if not(_la==CParser.T__20 or _la==CParser.T__21):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Struct_declaration_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def struct_declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Struct_declarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.Struct_declarationContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_struct_declaration_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStruct_declaration_list" ):
+ listener.enterStruct_declaration_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStruct_declaration_list" ):
+ listener.exitStruct_declaration_list(self)
+
+
+
+
+ def struct_declaration_list(self):
+
+ localctx = CParser.Struct_declaration_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 24, self.RULE_struct_declaration_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 267
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while True:
+ self.state = 266
+ self.struct_declaration()
+ self.state = 269
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36))) != 0) or _la==CParser.IDENTIFIER):
+ break
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Struct_declarationContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def specifier_qualifier_list(self):
+ return self.getTypedRuleContext(CParser.Specifier_qualifier_listContext,0)
+
+
+ def struct_declarator_list(self):
+ return self.getTypedRuleContext(CParser.Struct_declarator_listContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_struct_declaration
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStruct_declaration" ):
+ listener.enterStruct_declaration(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStruct_declaration" ):
+ listener.exitStruct_declaration(self)
+
+
+
+
+ def struct_declaration(self):
+
+ localctx = CParser.Struct_declarationContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 26, self.RULE_struct_declaration)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 271
+ self.specifier_qualifier_list()
+ self.state = 272
+ self.struct_declarator_list()
+ self.state = 273
+ self.match(CParser.T__1)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Specifier_qualifier_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def type_qualifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Type_qualifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Type_qualifierContext,i)
+
+
+ # @param i=None Type: int
+ def type_specifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Type_specifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Type_specifierContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_specifier_qualifier_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterSpecifier_qualifier_list" ):
+ listener.enterSpecifier_qualifier_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitSpecifier_qualifier_list" ):
+ listener.exitSpecifier_qualifier_list(self)
+
+
+
+
+ def specifier_qualifier_list(self):
+
+ localctx = CParser.Specifier_qualifier_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 28, self.RULE_specifier_qualifier_list)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 277
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 277
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__24, CParser.T__25, CParser.T__26, CParser.T__27, CParser.T__28, CParser.T__29, CParser.T__30, CParser.T__31, CParser.T__32, CParser.T__33, CParser.T__34, CParser.T__35, CParser.T__36]:
+ self.state = 275
+ self.type_qualifier()
+ pass
+ elif token in [CParser.T__10, CParser.T__11, CParser.T__12, CParser.T__13, CParser.T__14, CParser.T__15, CParser.T__16, CParser.T__17, CParser.T__18, CParser.T__20, CParser.T__21, CParser.T__23, CParser.IDENTIFIER]:
+ self.state = 276
+ self.type_specifier()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 279
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,21,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Struct_declarator_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def struct_declarator(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Struct_declaratorContext)
+ else:
+ return self.getTypedRuleContext(CParser.Struct_declaratorContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_struct_declarator_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStruct_declarator_list" ):
+ listener.enterStruct_declarator_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStruct_declarator_list" ):
+ listener.exitStruct_declarator_list(self)
+
+
+
+
+ def struct_declarator_list(self):
+
+ localctx = CParser.Struct_declarator_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 30, self.RULE_struct_declarator_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 281
+ self.struct_declarator()
+ self.state = 286
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__3:
+ self.state = 282
+ self.match(CParser.T__3)
+ self.state = 283
+ self.struct_declarator()
+ self.state = 288
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Struct_declaratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def declarator(self):
+ return self.getTypedRuleContext(CParser.DeclaratorContext,0)
+
+
+ def constant_expression(self):
+ return self.getTypedRuleContext(CParser.Constant_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_struct_declarator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStruct_declarator" ):
+ listener.enterStruct_declarator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStruct_declarator" ):
+ listener.exitStruct_declarator(self)
+
+
+
+
+ def struct_declarator(self):
+
+ localctx = CParser.Struct_declaratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 32, self.RULE_struct_declarator)
+ self._la = 0 # Token type
+ try:
+ self.state = 296
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__33, CParser.T__34, CParser.T__35, CParser.T__37, CParser.T__41, CParser.IDENTIFIER]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 289
+ self.declarator()
+ self.state = 292
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__22:
+ self.state = 290
+ self.match(CParser.T__22)
+ self.state = 291
+ self.constant_expression()
+
+
+ pass
+ elif token in [CParser.T__22]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 294
+ self.match(CParser.T__22)
+ self.state = 295
+ self.constant_expression()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Enum_specifierContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def enumerator_list(self):
+ return self.getTypedRuleContext(CParser.Enumerator_listContext,0)
+
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def getRuleIndex(self):
+ return CParser.RULE_enum_specifier
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterEnum_specifier" ):
+ listener.enterEnum_specifier(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitEnum_specifier" ):
+ listener.exitEnum_specifier(self)
+
+
+
+
+ def enum_specifier(self):
+
+ localctx = CParser.Enum_specifierContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 34, self.RULE_enum_specifier)
+ self._la = 0 # Token type
+ try:
+ self.state = 317
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,27,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 298
+ self.match(CParser.T__23)
+ self.state = 299
+ self.match(CParser.T__0)
+ self.state = 300
+ self.enumerator_list()
+ self.state = 302
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__3:
+ self.state = 301
+ self.match(CParser.T__3)
+
+
+ self.state = 304
+ self.match(CParser.T__19)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 306
+ self.match(CParser.T__23)
+ self.state = 307
+ self.match(CParser.IDENTIFIER)
+ self.state = 308
+ self.match(CParser.T__0)
+ self.state = 309
+ self.enumerator_list()
+ self.state = 311
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__3:
+ self.state = 310
+ self.match(CParser.T__3)
+
+
+ self.state = 313
+ self.match(CParser.T__19)
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 315
+ self.match(CParser.T__23)
+ self.state = 316
+ self.match(CParser.IDENTIFIER)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Enumerator_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def enumerator(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.EnumeratorContext)
+ else:
+ return self.getTypedRuleContext(CParser.EnumeratorContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_enumerator_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterEnumerator_list" ):
+ listener.enterEnumerator_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitEnumerator_list" ):
+ listener.exitEnumerator_list(self)
+
+
+
+
+ def enumerator_list(self):
+
+ localctx = CParser.Enumerator_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 36, self.RULE_enumerator_list)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 319
+ self.enumerator()
+ self.state = 324
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,28,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 320
+ self.match(CParser.T__3)
+ self.state = 321
+ self.enumerator()
+ self.state = 326
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,28,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class EnumeratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def constant_expression(self):
+ return self.getTypedRuleContext(CParser.Constant_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_enumerator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterEnumerator" ):
+ listener.enterEnumerator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitEnumerator" ):
+ listener.exitEnumerator(self)
+
+
+
+
+ def enumerator(self):
+
+ localctx = CParser.EnumeratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 38, self.RULE_enumerator)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 327
+ self.match(CParser.IDENTIFIER)
+ self.state = 330
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__4:
+ self.state = 328
+ self.match(CParser.T__4)
+ self.state = 329
+ self.constant_expression()
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Type_qualifierContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_type_qualifier
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterType_qualifier" ):
+ listener.enterType_qualifier(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitType_qualifier" ):
+ listener.exitType_qualifier(self)
+
+
+
+
+ def type_qualifier(self):
+
+ localctx = CParser.Type_qualifierContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 40, self.RULE_type_qualifier)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 332
+ _la = self._input.LA(1)
+ if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36))) != 0)):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class DeclaratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def direct_declarator(self):
+ return self.getTypedRuleContext(CParser.Direct_declaratorContext,0)
+
+
+ def pointer(self):
+ return self.getTypedRuleContext(CParser.PointerContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_declarator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterDeclarator" ):
+ listener.enterDeclarator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitDeclarator" ):
+ listener.exitDeclarator(self)
+
+
+
+
+ def declarator(self):
+
+ localctx = CParser.DeclaratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 42, self.RULE_declarator)
+ self._la = 0 # Token type
+ try:
+ self.state = 348
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,34,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 335
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__41:
+ self.state = 334
+ self.pointer()
+
+
+ self.state = 338
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__33:
+ self.state = 337
+ self.match(CParser.T__33)
+
+
+ self.state = 341
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__34:
+ self.state = 340
+ self.match(CParser.T__34)
+
+
+ self.state = 344
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__35:
+ self.state = 343
+ self.match(CParser.T__35)
+
+
+ self.state = 346
+ self.direct_declarator()
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 347
+ self.pointer()
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Direct_declaratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ # @param i=None Type: int
+ def declarator_suffix(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Declarator_suffixContext)
+ else:
+ return self.getTypedRuleContext(CParser.Declarator_suffixContext,i)
+
+
+ def declarator(self):
+ return self.getTypedRuleContext(CParser.DeclaratorContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_direct_declarator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterDirect_declarator" ):
+ listener.enterDirect_declarator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitDirect_declarator" ):
+ listener.exitDirect_declarator(self)
+
+
+
+
+ def direct_declarator(self):
+
+ localctx = CParser.Direct_declaratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 44, self.RULE_direct_declarator)
+ try:
+ self.state = 368
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.IDENTIFIER]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 350
+ self.match(CParser.IDENTIFIER)
+ self.state = 354
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,35,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 351
+ self.declarator_suffix()
+ self.state = 356
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,35,self._ctx)
+
+ pass
+ elif token in [CParser.T__37]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 357
+ self.match(CParser.T__37)
+ self.state = 359
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,36,self._ctx)
+ if la_ == 1:
+ self.state = 358
+ self.match(CParser.T__33)
+
+
+ self.state = 361
+ self.declarator()
+ self.state = 362
+ self.match(CParser.T__38)
+ self.state = 364
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 363
+ self.declarator_suffix()
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 366
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,37,self._ctx)
+
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Declarator_suffixContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def constant_expression(self):
+ return self.getTypedRuleContext(CParser.Constant_expressionContext,0)
+
+
+ def parameter_type_list(self):
+ return self.getTypedRuleContext(CParser.Parameter_type_listContext,0)
+
+
+ def identifier_list(self):
+ return self.getTypedRuleContext(CParser.Identifier_listContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_declarator_suffix
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterDeclarator_suffix" ):
+ listener.enterDeclarator_suffix(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitDeclarator_suffix" ):
+ listener.exitDeclarator_suffix(self)
+
+
+
+
+ def declarator_suffix(self):
+
+ localctx = CParser.Declarator_suffixContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 46, self.RULE_declarator_suffix)
+ try:
+ self.state = 386
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,39,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 370
+ self.match(CParser.T__39)
+ self.state = 371
+ self.constant_expression()
+ self.state = 372
+ self.match(CParser.T__40)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 374
+ self.match(CParser.T__39)
+ self.state = 375
+ self.match(CParser.T__40)
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 376
+ self.match(CParser.T__37)
+ self.state = 377
+ self.parameter_type_list()
+ self.state = 378
+ self.match(CParser.T__38)
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 380
+ self.match(CParser.T__37)
+ self.state = 381
+ self.identifier_list()
+ self.state = 382
+ self.match(CParser.T__38)
+ pass
+
+ elif la_ == 5:
+ self.enterOuterAlt(localctx, 5)
+ self.state = 384
+ self.match(CParser.T__37)
+ self.state = 385
+ self.match(CParser.T__38)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class PointerContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def type_qualifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Type_qualifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Type_qualifierContext,i)
+
+
+ def pointer(self):
+ return self.getTypedRuleContext(CParser.PointerContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_pointer
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterPointer" ):
+ listener.enterPointer(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitPointer" ):
+ listener.exitPointer(self)
+
+
+
+
+ def pointer(self):
+
+ localctx = CParser.PointerContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 48, self.RULE_pointer)
+ try:
+ self.state = 400
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,42,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 388
+ self.match(CParser.T__41)
+ self.state = 390
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 389
+ self.type_qualifier()
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 392
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,40,self._ctx)
+
+ self.state = 395
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,41,self._ctx)
+ if la_ == 1:
+ self.state = 394
+ self.pointer()
+
+
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 397
+ self.match(CParser.T__41)
+ self.state = 398
+ self.pointer()
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 399
+ self.match(CParser.T__41)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Parameter_type_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def parameter_list(self):
+ return self.getTypedRuleContext(CParser.Parameter_listContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_parameter_type_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterParameter_type_list" ):
+ listener.enterParameter_type_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitParameter_type_list" ):
+ listener.exitParameter_type_list(self)
+
+
+
+
+ def parameter_type_list(self):
+
+ localctx = CParser.Parameter_type_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 50, self.RULE_parameter_type_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 402
+ self.parameter_list()
+ self.state = 408
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__3:
+ self.state = 403
+ self.match(CParser.T__3)
+ self.state = 405
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__28:
+ self.state = 404
+ self.match(CParser.T__28)
+
+
+ self.state = 407
+ self.match(CParser.T__42)
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Parameter_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def parameter_declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Parameter_declarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.Parameter_declarationContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_parameter_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterParameter_list" ):
+ listener.enterParameter_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitParameter_list" ):
+ listener.exitParameter_list(self)
+
+
+
+
+ def parameter_list(self):
+
+ localctx = CParser.Parameter_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 52, self.RULE_parameter_list)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 410
+ self.parameter_declaration()
+ self.state = 418
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,46,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 411
+ self.match(CParser.T__3)
+ self.state = 413
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,45,self._ctx)
+ if la_ == 1:
+ self.state = 412
+ self.match(CParser.T__28)
+
+
+ self.state = 415
+ self.parameter_declaration()
+ self.state = 420
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,46,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Parameter_declarationContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def declaration_specifiers(self):
+ return self.getTypedRuleContext(CParser.Declaration_specifiersContext,0)
+
+
+ # @param i=None Type: int
+ def declarator(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.DeclaratorContext)
+ else:
+ return self.getTypedRuleContext(CParser.DeclaratorContext,i)
+
+
+ # @param i=None Type: int
+ def abstract_declarator(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Abstract_declaratorContext)
+ else:
+ return self.getTypedRuleContext(CParser.Abstract_declaratorContext,i)
+
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ # @param i=None Type: int
+ def pointer(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.PointerContext)
+ else:
+ return self.getTypedRuleContext(CParser.PointerContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_parameter_declaration
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterParameter_declaration" ):
+ listener.enterParameter_declaration(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitParameter_declaration" ):
+ listener.exitParameter_declaration(self)
+
+
+
+
+ def parameter_declaration(self):
+
+ localctx = CParser.Parameter_declarationContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 54, self.RULE_parameter_declaration)
+ self._la = 0 # Token type
+ try:
+ self.state = 439
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,51,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 421
+ self.declaration_specifiers()
+ self.state = 426
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while ((((_la - 34)) & ~0x3f) == 0 and ((1 << (_la - 34)) & ((1 << (CParser.T__33 - 34)) | (1 << (CParser.T__34 - 34)) | (1 << (CParser.T__35 - 34)) | (1 << (CParser.T__37 - 34)) | (1 << (CParser.T__39 - 34)) | (1 << (CParser.T__41 - 34)) | (1 << (CParser.IDENTIFIER - 34)))) != 0):
+ self.state = 424
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,47,self._ctx)
+ if la_ == 1:
+ self.state = 422
+ self.declarator()
+ pass
+
+ elif la_ == 2:
+ self.state = 423
+ self.abstract_declarator()
+ pass
+
+
+ self.state = 428
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 430
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__28:
+ self.state = 429
+ self.match(CParser.T__28)
+
+
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 435
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__41:
+ self.state = 432
+ self.pointer()
+ self.state = 437
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 438
+ self.match(CParser.IDENTIFIER)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Identifier_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def IDENTIFIER(self,i=None):
+ if i is None:
+ return self.getTokens(CParser.IDENTIFIER)
+ else:
+ return self.getToken(CParser.IDENTIFIER, i)
+
+ def getRuleIndex(self):
+ return CParser.RULE_identifier_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterIdentifier_list" ):
+ listener.enterIdentifier_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitIdentifier_list" ):
+ listener.exitIdentifier_list(self)
+
+
+
+
+ def identifier_list(self):
+
+ localctx = CParser.Identifier_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 56, self.RULE_identifier_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 441
+ self.match(CParser.IDENTIFIER)
+ self.state = 446
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__3:
+ self.state = 442
+ self.match(CParser.T__3)
+ self.state = 443
+ self.match(CParser.IDENTIFIER)
+ self.state = 448
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Type_nameContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def specifier_qualifier_list(self):
+ return self.getTypedRuleContext(CParser.Specifier_qualifier_listContext,0)
+
+
+ def abstract_declarator(self):
+ return self.getTypedRuleContext(CParser.Abstract_declaratorContext,0)
+
+
+ def type_id(self):
+ return self.getTypedRuleContext(CParser.Type_idContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_type_name
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterType_name" ):
+ listener.enterType_name(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitType_name" ):
+ listener.exitType_name(self)
+
+
+
+
+ def type_name(self):
+
+ localctx = CParser.Type_nameContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 58, self.RULE_type_name)
+ self._la = 0 # Token type
+ try:
+ self.state = 454
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,54,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 449
+ self.specifier_qualifier_list()
+ self.state = 451
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__37) | (1 << CParser.T__39) | (1 << CParser.T__41))) != 0):
+ self.state = 450
+ self.abstract_declarator()
+
+
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 453
+ self.type_id()
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Abstract_declaratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def pointer(self):
+ return self.getTypedRuleContext(CParser.PointerContext,0)
+
+
+ def direct_abstract_declarator(self):
+ return self.getTypedRuleContext(CParser.Direct_abstract_declaratorContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_abstract_declarator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAbstract_declarator" ):
+ listener.enterAbstract_declarator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAbstract_declarator" ):
+ listener.exitAbstract_declarator(self)
+
+
+
+
+ def abstract_declarator(self):
+
+ localctx = CParser.Abstract_declaratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 60, self.RULE_abstract_declarator)
+ try:
+ self.state = 461
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__41]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 456
+ self.pointer()
+ self.state = 458
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,55,self._ctx)
+ if la_ == 1:
+ self.state = 457
+ self.direct_abstract_declarator()
+
+
+ pass
+ elif token in [CParser.T__37, CParser.T__39]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 460
+ self.direct_abstract_declarator()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Direct_abstract_declaratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def abstract_declarator(self):
+ return self.getTypedRuleContext(CParser.Abstract_declaratorContext,0)
+
+
+ # @param i=None Type: int
+ def abstract_declarator_suffix(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Abstract_declarator_suffixContext)
+ else:
+ return self.getTypedRuleContext(CParser.Abstract_declarator_suffixContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_direct_abstract_declarator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterDirect_abstract_declarator" ):
+ listener.enterDirect_abstract_declarator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitDirect_abstract_declarator" ):
+ listener.exitDirect_abstract_declarator(self)
+
+
+
+ def direct_abstract_declarator(self):
+
+ localctx = CParser.Direct_abstract_declaratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 62, self.RULE_direct_abstract_declarator)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 468
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,57,self._ctx)
+ if la_ == 1:
+ self.state = 463
+ self.match(CParser.T__37)
+ self.state = 464
+ self.abstract_declarator()
+ self.state = 465
+ self.match(CParser.T__38)
+ pass
+
+ elif la_ == 2:
+ self.state = 467
+ self.abstract_declarator_suffix()
+ pass
+
+
+ self.state = 473
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,58,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 470
+ self.abstract_declarator_suffix()
+ self.state = 475
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,58,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Abstract_declarator_suffixContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def constant_expression(self):
+ return self.getTypedRuleContext(CParser.Constant_expressionContext,0)
+
+
+ def parameter_type_list(self):
+ return self.getTypedRuleContext(CParser.Parameter_type_listContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_abstract_declarator_suffix
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAbstract_declarator_suffix" ):
+ listener.enterAbstract_declarator_suffix(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAbstract_declarator_suffix" ):
+ listener.exitAbstract_declarator_suffix(self)
+
+
+
+
+ def abstract_declarator_suffix(self):
+
+ localctx = CParser.Abstract_declarator_suffixContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 64, self.RULE_abstract_declarator_suffix)
+ try:
+ self.state = 488
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,59,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 476
+ self.match(CParser.T__39)
+ self.state = 477
+ self.match(CParser.T__40)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 478
+ self.match(CParser.T__39)
+ self.state = 479
+ self.constant_expression()
+ self.state = 480
+ self.match(CParser.T__40)
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 482
+ self.match(CParser.T__37)
+ self.state = 483
+ self.match(CParser.T__38)
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 484
+ self.match(CParser.T__37)
+ self.state = 485
+ self.parameter_type_list()
+ self.state = 486
+ self.match(CParser.T__38)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class InitializerContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def assignment_expression(self):
+ return self.getTypedRuleContext(CParser.Assignment_expressionContext,0)
+
+
+ def initializer_list(self):
+ return self.getTypedRuleContext(CParser.Initializer_listContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_initializer
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterInitializer" ):
+ listener.enterInitializer(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitInitializer" ):
+ listener.exitInitializer(self)
+
+
+
+
+ def initializer(self):
+
+ localctx = CParser.InitializerContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 66, self.RULE_initializer)
+ self._la = 0 # Token type
+ try:
+ self.state = 498
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__37, CParser.T__41, CParser.T__43, CParser.T__44, CParser.T__47, CParser.T__48, CParser.T__49, CParser.T__52, CParser.T__53, CParser.T__54, CParser.IDENTIFIER, CParser.CHARACTER_LITERAL, CParser.STRING_LITERAL, CParser.HEX_LITERAL, CParser.DECIMAL_LITERAL, CParser.OCTAL_LITERAL, CParser.FLOATING_POINT_LITERAL]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 490
+ self.assignment_expression()
+ pass
+ elif token in [CParser.T__0]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 491
+ self.match(CParser.T__0)
+ self.state = 492
+ self.initializer_list()
+ self.state = 494
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__3:
+ self.state = 493
+ self.match(CParser.T__3)
+
+
+ self.state = 496
+ self.match(CParser.T__19)
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Initializer_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def initializer(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.InitializerContext)
+ else:
+ return self.getTypedRuleContext(CParser.InitializerContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_initializer_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterInitializer_list" ):
+ listener.enterInitializer_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitInitializer_list" ):
+ listener.exitInitializer_list(self)
+
+
+
+
+ def initializer_list(self):
+
+ localctx = CParser.Initializer_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 68, self.RULE_initializer_list)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 500
+ self.initializer()
+ self.state = 505
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,62,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 501
+ self.match(CParser.T__3)
+ self.state = 502
+ self.initializer()
+ self.state = 507
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,62,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Argument_expression_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def assignment_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Assignment_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Assignment_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_argument_expression_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterArgument_expression_list" ):
+ listener.enterArgument_expression_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitArgument_expression_list" ):
+ listener.exitArgument_expression_list(self)
+
+
+
+
+ def argument_expression_list(self):
+
+ localctx = CParser.Argument_expression_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 70, self.RULE_argument_expression_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 508
+ self.assignment_expression()
+ self.state = 510
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__28:
+ self.state = 509
+ self.match(CParser.T__28)
+
+
+ self.state = 519
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__3:
+ self.state = 512
+ self.match(CParser.T__3)
+ self.state = 513
+ self.assignment_expression()
+ self.state = 515
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__28:
+ self.state = 514
+ self.match(CParser.T__28)
+
+
+ self.state = 521
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Additive_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def multiplicative_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Multiplicative_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Multiplicative_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_additive_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAdditive_expression" ):
+ listener.enterAdditive_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAdditive_expression" ):
+ listener.exitAdditive_expression(self)
+
+
+
+
+ def additive_expression(self):
+
+ localctx = CParser.Additive_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 72, self.RULE_additive_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 522
+ self.multiplicative_expression()
+ self.state = 529
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__43 or _la==CParser.T__44:
+ self.state = 527
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__43]:
+ self.state = 523
+ self.match(CParser.T__43)
+ self.state = 524
+ self.multiplicative_expression()
+ pass
+ elif token in [CParser.T__44]:
+ self.state = 525
+ self.match(CParser.T__44)
+ self.state = 526
+ self.multiplicative_expression()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ self.state = 531
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Multiplicative_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def cast_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Cast_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Cast_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_multiplicative_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterMultiplicative_expression" ):
+ listener.enterMultiplicative_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitMultiplicative_expression" ):
+ listener.exitMultiplicative_expression(self)
+
+
+
+
+ def multiplicative_expression(self):
+
+ localctx = CParser.Multiplicative_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 74, self.RULE_multiplicative_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 532
+ self.cast_expression()
+ self.state = 541
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__41) | (1 << CParser.T__45) | (1 << CParser.T__46))) != 0):
+ self.state = 539
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__41]:
+ self.state = 533
+ self.match(CParser.T__41)
+ self.state = 534
+ self.cast_expression()
+ pass
+ elif token in [CParser.T__45]:
+ self.state = 535
+ self.match(CParser.T__45)
+ self.state = 536
+ self.cast_expression()
+ pass
+ elif token in [CParser.T__46]:
+ self.state = 537
+ self.match(CParser.T__46)
+ self.state = 538
+ self.cast_expression()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ self.state = 543
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Cast_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def type_name(self):
+ return self.getTypedRuleContext(CParser.Type_nameContext,0)
+
+
+ def cast_expression(self):
+ return self.getTypedRuleContext(CParser.Cast_expressionContext,0)
+
+
+ def unary_expression(self):
+ return self.getTypedRuleContext(CParser.Unary_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_cast_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterCast_expression" ):
+ listener.enterCast_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitCast_expression" ):
+ listener.exitCast_expression(self)
+
+
+
+
+ def cast_expression(self):
+
+ localctx = CParser.Cast_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 76, self.RULE_cast_expression)
+ try:
+ self.state = 550
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,70,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 544
+ self.match(CParser.T__37)
+ self.state = 545
+ self.type_name()
+ self.state = 546
+ self.match(CParser.T__38)
+ self.state = 547
+ self.cast_expression()
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 549
+ self.unary_expression()
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Unary_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def postfix_expression(self):
+ return self.getTypedRuleContext(CParser.Postfix_expressionContext,0)
+
+
+ def unary_expression(self):
+ return self.getTypedRuleContext(CParser.Unary_expressionContext,0)
+
+
+ def unary_operator(self):
+ return self.getTypedRuleContext(CParser.Unary_operatorContext,0)
+
+
+ def cast_expression(self):
+ return self.getTypedRuleContext(CParser.Cast_expressionContext,0)
+
+
+ def type_name(self):
+ return self.getTypedRuleContext(CParser.Type_nameContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_unary_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterUnary_expression" ):
+ listener.enterUnary_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitUnary_expression" ):
+ listener.exitUnary_expression(self)
+
+
+
+
+ def unary_expression(self):
+
+ localctx = CParser.Unary_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 78, self.RULE_unary_expression)
+ try:
+ self.state = 567
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,71,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 552
+ self.postfix_expression()
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 553
+ self.match(CParser.T__47)
+ self.state = 554
+ self.unary_expression()
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 555
+ self.match(CParser.T__48)
+ self.state = 556
+ self.unary_expression()
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 557
+ self.unary_operator()
+ self.state = 558
+ self.cast_expression()
+ pass
+
+ elif la_ == 5:
+ self.enterOuterAlt(localctx, 5)
+ self.state = 560
+ self.match(CParser.T__49)
+ self.state = 561
+ self.unary_expression()
+ pass
+
+ elif la_ == 6:
+ self.enterOuterAlt(localctx, 6)
+ self.state = 562
+ self.match(CParser.T__49)
+ self.state = 563
+ self.match(CParser.T__37)
+ self.state = 564
+ self.type_name()
+ self.state = 565
+ self.match(CParser.T__38)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Postfix_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.FuncCallText = ''
+ self.p = None # Primary_expressionContext
+ self.a = None # Token
+ self.c = None # Argument_expression_listContext
+ self.b = None # Token
+ self.x = None # Token
+ self.y = None # Token
+ self.z = None # Token
+
+ def primary_expression(self):
+ return self.getTypedRuleContext(CParser.Primary_expressionContext,0)
+
+
+ # @param i=None Type: int
+ def expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.ExpressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.ExpressionContext,i)
+
+
+ # @param i=None Type: int
+ def macro_parameter_list(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Macro_parameter_listContext)
+ else:
+ return self.getTypedRuleContext(CParser.Macro_parameter_listContext,i)
+
+
+ # @param i=None Type: int
+ def argument_expression_list(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Argument_expression_listContext)
+ else:
+ return self.getTypedRuleContext(CParser.Argument_expression_listContext,i)
+
+
+ # @param i=None Type: int
+ def IDENTIFIER(self,i=None):
+ if i is None:
+ return self.getTokens(CParser.IDENTIFIER)
+ else:
+ return self.getToken(CParser.IDENTIFIER, i)
+
+ def getRuleIndex(self):
+ return CParser.RULE_postfix_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterPostfix_expression" ):
+ listener.enterPostfix_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitPostfix_expression" ):
+ listener.exitPostfix_expression(self)
+
+
+
+
+ def postfix_expression(self):
+
+ localctx = CParser.Postfix_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 80, self.RULE_postfix_expression)
+
+ self.FuncCallText=''
+
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 569
+ localctx.p = self.primary_expression()
+ self.FuncCallText += (None if localctx.p is None else self._input.getText((localctx.p.start,localctx.p.stop)))
+ self.state = 600
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,73,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 598
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,72,self._ctx)
+ if la_ == 1:
+ self.state = 571
+ self.match(CParser.T__39)
+ self.state = 572
+ self.expression()
+ self.state = 573
+ self.match(CParser.T__40)
+ pass
+
+ elif la_ == 2:
+ self.state = 575
+ self.match(CParser.T__37)
+ self.state = 576
+ localctx.a = self.match(CParser.T__38)
+ self.StoreFunctionCalling((None if localctx.p is None else localctx.p.start).line, (None if localctx.p is None else localctx.p.start).column, (0 if localctx.a is None else localctx.a.line), localctx.a.column, self.FuncCallText, '')
+ pass
+
+ elif la_ == 3:
+ self.state = 578
+ self.match(CParser.T__37)
+ self.state = 579
+ localctx.c = self.argument_expression_list()
+ self.state = 580
+ localctx.b = self.match(CParser.T__38)
+ self.StoreFunctionCalling((None if localctx.p is None else localctx.p.start).line, (None if localctx.p is None else localctx.p.start).column, (0 if localctx.b is None else localctx.b.line), localctx.b.column, self.FuncCallText, (None if localctx.c is None else self._input.getText((localctx.c.start,localctx.c.stop))))
+ pass
+
+ elif la_ == 4:
+ self.state = 583
+ self.match(CParser.T__37)
+ self.state = 584
+ self.macro_parameter_list()
+ self.state = 585
+ self.match(CParser.T__38)
+ pass
+
+ elif la_ == 5:
+ self.state = 587
+ self.match(CParser.T__50)
+ self.state = 588
+ localctx.x = self.match(CParser.IDENTIFIER)
+ self.FuncCallText += '.' + (None if localctx.x is None else localctx.x.text)
+ pass
+
+ elif la_ == 6:
+ self.state = 590
+ self.match(CParser.T__41)
+ self.state = 591
+ localctx.y = self.match(CParser.IDENTIFIER)
+ self.FuncCallText = (None if localctx.y is None else localctx.y.text)
+ pass
+
+ elif la_ == 7:
+ self.state = 593
+ self.match(CParser.T__51)
+ self.state = 594
+ localctx.z = self.match(CParser.IDENTIFIER)
+ self.FuncCallText += '->' + (None if localctx.z is None else localctx.z.text)
+ pass
+
+ elif la_ == 8:
+ self.state = 596
+ self.match(CParser.T__47)
+ pass
+
+ elif la_ == 9:
+ self.state = 597
+ self.match(CParser.T__48)
+ pass
+
+
+ self.state = 602
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,73,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Macro_parameter_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def parameter_declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Parameter_declarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.Parameter_declarationContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_macro_parameter_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterMacro_parameter_list" ):
+ listener.enterMacro_parameter_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitMacro_parameter_list" ):
+ listener.exitMacro_parameter_list(self)
+
+
+
+
+ def macro_parameter_list(self):
+
+ localctx = CParser.Macro_parameter_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 82, self.RULE_macro_parameter_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 603
+ self.parameter_declaration()
+ self.state = 608
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__3:
+ self.state = 604
+ self.match(CParser.T__3)
+ self.state = 605
+ self.parameter_declaration()
+ self.state = 610
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Unary_operatorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_unary_operator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterUnary_operator" ):
+ listener.enterUnary_operator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitUnary_operator" ):
+ listener.exitUnary_operator(self)
+
+
+
+
+ def unary_operator(self):
+
+ localctx = CParser.Unary_operatorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 84, self.RULE_unary_operator)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 611
+ _la = self._input.LA(1)
+ if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__41) | (1 << CParser.T__43) | (1 << CParser.T__44) | (1 << CParser.T__52) | (1 << CParser.T__53) | (1 << CParser.T__54))) != 0)):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Primary_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def constant(self):
+ return self.getTypedRuleContext(CParser.ConstantContext,0)
+
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_primary_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterPrimary_expression" ):
+ listener.enterPrimary_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitPrimary_expression" ):
+ listener.exitPrimary_expression(self)
+
+
+
+
+ def primary_expression(self):
+
+ localctx = CParser.Primary_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 86, self.RULE_primary_expression)
+ try:
+ self.state = 619
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,75,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 613
+ self.match(CParser.IDENTIFIER)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 614
+ self.constant()
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 615
+ self.match(CParser.T__37)
+ self.state = 616
+ self.expression()
+ self.state = 617
+ self.match(CParser.T__38)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class ConstantContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def HEX_LITERAL(self):
+ return self.getToken(CParser.HEX_LITERAL, 0)
+
+ def OCTAL_LITERAL(self):
+ return self.getToken(CParser.OCTAL_LITERAL, 0)
+
+ def DECIMAL_LITERAL(self):
+ return self.getToken(CParser.DECIMAL_LITERAL, 0)
+
+ def CHARACTER_LITERAL(self):
+ return self.getToken(CParser.CHARACTER_LITERAL, 0)
+
+ # @param i=None Type: int
+ def IDENTIFIER(self,i=None):
+ if i is None:
+ return self.getTokens(CParser.IDENTIFIER)
+ else:
+ return self.getToken(CParser.IDENTIFIER, i)
+
+ # @param i=None Type: int
+ def STRING_LITERAL(self,i=None):
+ if i is None:
+ return self.getTokens(CParser.STRING_LITERAL)
+ else:
+ return self.getToken(CParser.STRING_LITERAL, i)
+
+ def FLOATING_POINT_LITERAL(self):
+ return self.getToken(CParser.FLOATING_POINT_LITERAL, 0)
+
+ def getRuleIndex(self):
+ return CParser.RULE_constant
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterConstant" ):
+ listener.enterConstant(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitConstant" ):
+ listener.exitConstant(self)
+
+
+
+
+ def constant(self):
+
+ localctx = CParser.ConstantContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 88, self.RULE_constant)
+ self._la = 0 # Token type
+ try:
+ self.state = 647
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.HEX_LITERAL]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 621
+ self.match(CParser.HEX_LITERAL)
+ pass
+ elif token in [CParser.OCTAL_LITERAL]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 622
+ self.match(CParser.OCTAL_LITERAL)
+ pass
+ elif token in [CParser.DECIMAL_LITERAL]:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 623
+ self.match(CParser.DECIMAL_LITERAL)
+ pass
+ elif token in [CParser.CHARACTER_LITERAL]:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 624
+ self.match(CParser.CHARACTER_LITERAL)
+ pass
+ elif token in [CParser.IDENTIFIER, CParser.STRING_LITERAL]:
+ self.enterOuterAlt(localctx, 5)
+ self.state = 636
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 628
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.IDENTIFIER:
+ self.state = 625
+ self.match(CParser.IDENTIFIER)
+ self.state = 630
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 632
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 631
+ self.match(CParser.STRING_LITERAL)
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 634
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,77,self._ctx)
+
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 638
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,78,self._ctx)
+
+ self.state = 643
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.IDENTIFIER:
+ self.state = 640
+ self.match(CParser.IDENTIFIER)
+ self.state = 645
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ pass
+ elif token in [CParser.FLOATING_POINT_LITERAL]:
+ self.enterOuterAlt(localctx, 6)
+ self.state = 646
+ self.match(CParser.FLOATING_POINT_LITERAL)
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class ExpressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def assignment_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Assignment_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Assignment_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterExpression" ):
+ listener.enterExpression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitExpression" ):
+ listener.exitExpression(self)
+
+
+
+
+ def expression(self):
+
+ localctx = CParser.ExpressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 90, self.RULE_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 649
+ self.assignment_expression()
+ self.state = 654
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__3:
+ self.state = 650
+ self.match(CParser.T__3)
+ self.state = 651
+ self.assignment_expression()
+ self.state = 656
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Constant_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def conditional_expression(self):
+ return self.getTypedRuleContext(CParser.Conditional_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_constant_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterConstant_expression" ):
+ listener.enterConstant_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitConstant_expression" ):
+ listener.exitConstant_expression(self)
+
+
+
+
+ def constant_expression(self):
+
+ localctx = CParser.Constant_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 92, self.RULE_constant_expression)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 657
+ self.conditional_expression()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Assignment_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def lvalue(self):
+ return self.getTypedRuleContext(CParser.LvalueContext,0)
+
+
+ def assignment_operator(self):
+ return self.getTypedRuleContext(CParser.Assignment_operatorContext,0)
+
+
+ def assignment_expression(self):
+ return self.getTypedRuleContext(CParser.Assignment_expressionContext,0)
+
+
+ def conditional_expression(self):
+ return self.getTypedRuleContext(CParser.Conditional_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_assignment_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAssignment_expression" ):
+ listener.enterAssignment_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAssignment_expression" ):
+ listener.exitAssignment_expression(self)
+
+
+
+
+ def assignment_expression(self):
+
+ localctx = CParser.Assignment_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 94, self.RULE_assignment_expression)
+ try:
+ self.state = 664
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,82,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 659
+ self.lvalue()
+ self.state = 660
+ self.assignment_operator()
+ self.state = 661
+ self.assignment_expression()
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 663
+ self.conditional_expression()
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class LvalueContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def unary_expression(self):
+ return self.getTypedRuleContext(CParser.Unary_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_lvalue
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterLvalue" ):
+ listener.enterLvalue(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitLvalue" ):
+ listener.exitLvalue(self)
+
+
+
+
+ def lvalue(self):
+
+ localctx = CParser.LvalueContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 96, self.RULE_lvalue)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 666
+ self.unary_expression()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Assignment_operatorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_assignment_operator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAssignment_operator" ):
+ listener.enterAssignment_operator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAssignment_operator" ):
+ listener.exitAssignment_operator(self)
+
+
+
+
+ def assignment_operator(self):
+
+ localctx = CParser.Assignment_operatorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 98, self.RULE_assignment_operator)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 668
+ _la = self._input.LA(1)
+ if not(((((_la - 5)) & ~0x3f) == 0 and ((1 << (_la - 5)) & ((1 << (CParser.T__4 - 5)) | (1 << (CParser.T__55 - 5)) | (1 << (CParser.T__56 - 5)) | (1 << (CParser.T__57 - 5)) | (1 << (CParser.T__58 - 5)) | (1 << (CParser.T__59 - 5)) | (1 << (CParser.T__60 - 5)) | (1 << (CParser.T__61 - 5)) | (1 << (CParser.T__62 - 5)) | (1 << (CParser.T__63 - 5)) | (1 << (CParser.T__64 - 5)))) != 0)):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Conditional_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.e = None # Logical_or_expressionContext
+
+ def logical_or_expression(self):
+ return self.getTypedRuleContext(CParser.Logical_or_expressionContext,0)
+
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def conditional_expression(self):
+ return self.getTypedRuleContext(CParser.Conditional_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_conditional_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterConditional_expression" ):
+ listener.enterConditional_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitConditional_expression" ):
+ listener.exitConditional_expression(self)
+
+
+
+
+ def conditional_expression(self):
+
+ localctx = CParser.Conditional_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 100, self.RULE_conditional_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 670
+ localctx.e = self.logical_or_expression()
+ self.state = 677
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__65:
+ self.state = 671
+ self.match(CParser.T__65)
+ self.state = 672
+ self.expression()
+ self.state = 673
+ self.match(CParser.T__22)
+ self.state = 674
+ self.conditional_expression()
+ self.StorePredicateExpression((None if localctx.e is None else localctx.e.start).line, (None if localctx.e is None else localctx.e.start).column, (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is None else localctx.e.stop).column, (None if localctx.e is None else self._input.getText((localctx.e.start,localctx.e.stop))))
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Logical_or_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def logical_and_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Logical_and_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Logical_and_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_logical_or_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterLogical_or_expression" ):
+ listener.enterLogical_or_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitLogical_or_expression" ):
+ listener.exitLogical_or_expression(self)
+
+
+
+
+ def logical_or_expression(self):
+
+ localctx = CParser.Logical_or_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 102, self.RULE_logical_or_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 679
+ self.logical_and_expression()
+ self.state = 684
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__66:
+ self.state = 680
+ self.match(CParser.T__66)
+ self.state = 681
+ self.logical_and_expression()
+ self.state = 686
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Logical_and_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def inclusive_or_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Inclusive_or_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Inclusive_or_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_logical_and_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterLogical_and_expression" ):
+ listener.enterLogical_and_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitLogical_and_expression" ):
+ listener.exitLogical_and_expression(self)
+
+
+
+
+ def logical_and_expression(self):
+
+ localctx = CParser.Logical_and_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 104, self.RULE_logical_and_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 687
+ self.inclusive_or_expression()
+ self.state = 692
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__67:
+ self.state = 688
+ self.match(CParser.T__67)
+ self.state = 689
+ self.inclusive_or_expression()
+ self.state = 694
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Inclusive_or_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def exclusive_or_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Exclusive_or_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Exclusive_or_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_inclusive_or_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterInclusive_or_expression" ):
+ listener.enterInclusive_or_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitInclusive_or_expression" ):
+ listener.exitInclusive_or_expression(self)
+
+
+
+
+ def inclusive_or_expression(self):
+
+ localctx = CParser.Inclusive_or_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 106, self.RULE_inclusive_or_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 695
+ self.exclusive_or_expression()
+ self.state = 700
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__68:
+ self.state = 696
+ self.match(CParser.T__68)
+ self.state = 697
+ self.exclusive_or_expression()
+ self.state = 702
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Exclusive_or_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def and_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.And_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.And_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_exclusive_or_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterExclusive_or_expression" ):
+ listener.enterExclusive_or_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitExclusive_or_expression" ):
+ listener.exitExclusive_or_expression(self)
+
+
+
+
+ def exclusive_or_expression(self):
+
+ localctx = CParser.Exclusive_or_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 108, self.RULE_exclusive_or_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 703
+ self.and_expression()
+ self.state = 708
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__69:
+ self.state = 704
+ self.match(CParser.T__69)
+ self.state = 705
+ self.and_expression()
+ self.state = 710
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class And_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def equality_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Equality_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Equality_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_and_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAnd_expression" ):
+ listener.enterAnd_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAnd_expression" ):
+ listener.exitAnd_expression(self)
+
+
+
+
+ def and_expression(self):
+
+ localctx = CParser.And_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 110, self.RULE_and_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 711
+ self.equality_expression()
+ self.state = 716
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__52:
+ self.state = 712
+ self.match(CParser.T__52)
+ self.state = 713
+ self.equality_expression()
+ self.state = 718
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Equality_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def relational_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Relational_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Relational_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_equality_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterEquality_expression" ):
+ listener.enterEquality_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitEquality_expression" ):
+ listener.exitEquality_expression(self)
+
+
+
+
+ def equality_expression(self):
+
+ localctx = CParser.Equality_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 112, self.RULE_equality_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 719
+ self.relational_expression()
+ self.state = 724
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__70 or _la==CParser.T__71:
+ self.state = 720
+ _la = self._input.LA(1)
+ if not(_la==CParser.T__70 or _la==CParser.T__71):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 721
+ self.relational_expression()
+ self.state = 726
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Relational_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def shift_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Shift_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Shift_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_relational_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterRelational_expression" ):
+ listener.enterRelational_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitRelational_expression" ):
+ listener.exitRelational_expression(self)
+
+
+
+
+ def relational_expression(self):
+
+ localctx = CParser.Relational_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 114, self.RULE_relational_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 727
+ self.shift_expression()
+ self.state = 732
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while ((((_la - 73)) & ~0x3f) == 0 and ((1 << (_la - 73)) & ((1 << (CParser.T__72 - 73)) | (1 << (CParser.T__73 - 73)) | (1 << (CParser.T__74 - 73)) | (1 << (CParser.T__75 - 73)))) != 0):
+ self.state = 728
+ _la = self._input.LA(1)
+ if not(((((_la - 73)) & ~0x3f) == 0 and ((1 << (_la - 73)) & ((1 << (CParser.T__72 - 73)) | (1 << (CParser.T__73 - 73)) | (1 << (CParser.T__74 - 73)) | (1 << (CParser.T__75 - 73)))) != 0)):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 729
+ self.shift_expression()
+ self.state = 734
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Shift_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def additive_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Additive_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Additive_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_shift_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterShift_expression" ):
+ listener.enterShift_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitShift_expression" ):
+ listener.exitShift_expression(self)
+
+
+
+
+ def shift_expression(self):
+
+ localctx = CParser.Shift_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 116, self.RULE_shift_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 735
+ self.additive_expression()
+ self.state = 740
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__76 or _la==CParser.T__77:
+ self.state = 736
+ _la = self._input.LA(1)
+ if not(_la==CParser.T__76 or _la==CParser.T__77):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 737
+ self.additive_expression()
+ self.state = 742
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class StatementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def labeled_statement(self):
+ return self.getTypedRuleContext(CParser.Labeled_statementContext,0)
+
+
+ def compound_statement(self):
+ return self.getTypedRuleContext(CParser.Compound_statementContext,0)
+
+
+ def expression_statement(self):
+ return self.getTypedRuleContext(CParser.Expression_statementContext,0)
+
+
+ def selection_statement(self):
+ return self.getTypedRuleContext(CParser.Selection_statementContext,0)
+
+
+ def iteration_statement(self):
+ return self.getTypedRuleContext(CParser.Iteration_statementContext,0)
+
+
+ def jump_statement(self):
+ return self.getTypedRuleContext(CParser.Jump_statementContext,0)
+
+
+ def macro_statement(self):
+ return self.getTypedRuleContext(CParser.Macro_statementContext,0)
+
+
+ def asm2_statement(self):
+ return self.getTypedRuleContext(CParser.Asm2_statementContext,0)
+
+
+ def asm1_statement(self):
+ return self.getTypedRuleContext(CParser.Asm1_statementContext,0)
+
+
+ def asm_statement(self):
+ return self.getTypedRuleContext(CParser.Asm_statementContext,0)
+
+
+ def declaration(self):
+ return self.getTypedRuleContext(CParser.DeclarationContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStatement" ):
+ listener.enterStatement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStatement" ):
+ listener.exitStatement(self)
+
+
+
+
+ def statement(self):
+
+ localctx = CParser.StatementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 118, self.RULE_statement)
+ try:
+ self.state = 754
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,92,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 743
+ self.labeled_statement()
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 744
+ self.compound_statement()
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 745
+ self.expression_statement()
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 746
+ self.selection_statement()
+ pass
+
+ elif la_ == 5:
+ self.enterOuterAlt(localctx, 5)
+ self.state = 747
+ self.iteration_statement()
+ pass
+
+ elif la_ == 6:
+ self.enterOuterAlt(localctx, 6)
+ self.state = 748
+ self.jump_statement()
+ pass
+
+ elif la_ == 7:
+ self.enterOuterAlt(localctx, 7)
+ self.state = 749
+ self.macro_statement()
+ pass
+
+ elif la_ == 8:
+ self.enterOuterAlt(localctx, 8)
+ self.state = 750
+ self.asm2_statement()
+ pass
+
+ elif la_ == 9:
+ self.enterOuterAlt(localctx, 9)
+ self.state = 751
+ self.asm1_statement()
+ pass
+
+ elif la_ == 10:
+ self.enterOuterAlt(localctx, 10)
+ self.state = 752
+ self.asm_statement()
+ pass
+
+ elif la_ == 11:
+ self.enterOuterAlt(localctx, 11)
+ self.state = 753
+ self.declaration()
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Asm2_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def getRuleIndex(self):
+ return CParser.RULE_asm2_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAsm2_statement" ):
+ listener.enterAsm2_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAsm2_statement" ):
+ listener.exitAsm2_statement(self)
+
+
+
+
+ def asm2_statement(self):
+
+ localctx = CParser.Asm2_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 120, self.RULE_asm2_statement)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 757
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__78:
+ self.state = 756
+ self.match(CParser.T__78)
+
+
+ self.state = 759
+ self.match(CParser.IDENTIFIER)
+ self.state = 760
+ self.match(CParser.T__37)
+ self.state = 764
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,94,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 761
+ _la = self._input.LA(1)
+ if _la <= 0 or _la==CParser.T__1:
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 766
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,94,self._ctx)
+
+ self.state = 767
+ self.match(CParser.T__38)
+ self.state = 768
+ self.match(CParser.T__1)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Asm1_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_asm1_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAsm1_statement" ):
+ listener.enterAsm1_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAsm1_statement" ):
+ listener.exitAsm1_statement(self)
+
+
+
+
+ def asm1_statement(self):
+
+ localctx = CParser.Asm1_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 122, self.RULE_asm1_statement)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 770
+ self.match(CParser.T__79)
+ self.state = 771
+ self.match(CParser.T__0)
+ self.state = 775
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__0) | (1 << CParser.T__1) | (1 << CParser.T__2) | (1 << CParser.T__3) | (1 << CParser.T__4) | (1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9) | (1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__22) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36) | (1 << CParser.T__37) | (1 << CParser.T__38) | (1 << CParser.T__39) | (1 << CParser.T__40) | (1 << CParser.T__41) | (1 << CParser.T__42) | (1 << CParser.T__43) | (1 << CParser.T__44) | (1 << CParser.T__45) | (1 << CParser.T__46) | (1 << CParser.T__47) | (1 << CParser.T__48) | (1 << CParser.T__49) | (1 << CParser.T__50) | (1 << CParser.T__51) | (1 << CParser.T__52) | (1 << CParser.T__53) | (1 << CParser.T__54) | (1 << CParser.T__55) | (1 << CParser.T__56) | (1 << CParser.T__57) | (1 << CParser.T__58) | (1 << CParser.T__59) | (1 << CParser.T__60) | (1 << CParser.T__61) | (1 << CParser.T__62))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (CParser.T__63 - 64)) | (1 << (CParser.T__64 - 64)) | (1 << (CParser.T__65 - 64)) | (1 << (CParser.T__66 - 64)) | (1 << (CParser.T__67 - 64)) | (1 << (CParser.T__68 - 64)) | (1 << (CParser.T__69 - 64)) | (1 << (CParser.T__70 - 64)) | (1 << (CParser.T__71 - 64)) | (1 << (CParser.T__72 - 64)) | (1 << (CParser.T__73 - 64)) | (1 << (CParser.T__74 - 64)) | (1 << (CParser.T__75 - 64)) | (1 << (CParser.T__76 - 64)) | (1 << (CParser.T__77 - 64)) | (1 << (CParser.T__78 - 64)) | (1 << (CParser.T__79 - 64)) | (1 << (CParser.T__80 - 64)) | (1 << (CParser.T__81 - 64)) | (1 << (CParser.T__82 - 64)) | (1 << (CParser.T__83 - 64)) | (1 << (CParser.T__84 - 64)) | (1 << (CParser.T__85 - 64)) | (1 << (CParser.T__86 - 64)) | (1 << (CParser.T__87 - 64)) | (1 << (CParser.T__88 - 64)) | (1 << (CParser.T__89 - 64)) | (1 << (CParser.T__90 - 64)) | (1 << (CParser.T__91 - 64)) | (1 << (CParser.IDENTIFIER - 64)) | (1 << (CParser.CHARACTER_LITERAL - 64)) | (1 << (CParser.STRING_LITERAL - 64)) | (1 << (CParser.HEX_LITERAL - 64)) | (1 << (CParser.DECIMAL_LITERAL - 64)) | (1 << (CParser.OCTAL_LITERAL - 64)) | (1 << (CParser.FLOATING_POINT_LITERAL - 64)) | (1 << (CParser.WS - 64)) | (1 << (CParser.BS - 64)) | (1 << (CParser.UnicodeVocabulary - 64)) | (1 << (CParser.COMMENT - 64)) | (1 << (CParser.LINE_COMMENT - 64)) | (1 << (CParser.LINE_COMMAND - 64)))) != 0):
+ self.state = 772
+ _la = self._input.LA(1)
+ if _la <= 0 or _la==CParser.T__19:
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 777
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 778
+ self.match(CParser.T__19)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Asm_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_asm_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAsm_statement" ):
+ listener.enterAsm_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAsm_statement" ):
+ listener.exitAsm_statement(self)
+
+
+
+
+ def asm_statement(self):
+
+ localctx = CParser.Asm_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 124, self.RULE_asm_statement)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 780
+ self.match(CParser.T__80)
+ self.state = 781
+ self.match(CParser.T__0)
+ self.state = 785
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__0) | (1 << CParser.T__1) | (1 << CParser.T__2) | (1 << CParser.T__3) | (1 << CParser.T__4) | (1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9) | (1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__22) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36) | (1 << CParser.T__37) | (1 << CParser.T__38) | (1 << CParser.T__39) | (1 << CParser.T__40) | (1 << CParser.T__41) | (1 << CParser.T__42) | (1 << CParser.T__43) | (1 << CParser.T__44) | (1 << CParser.T__45) | (1 << CParser.T__46) | (1 << CParser.T__47) | (1 << CParser.T__48) | (1 << CParser.T__49) | (1 << CParser.T__50) | (1 << CParser.T__51) | (1 << CParser.T__52) | (1 << CParser.T__53) | (1 << CParser.T__54) | (1 << CParser.T__55) | (1 << CParser.T__56) | (1 << CParser.T__57) | (1 << CParser.T__58) | (1 << CParser.T__59) | (1 << CParser.T__60) | (1 << CParser.T__61) | (1 << CParser.T__62))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (CParser.T__63 - 64)) | (1 << (CParser.T__64 - 64)) | (1 << (CParser.T__65 - 64)) | (1 << (CParser.T__66 - 64)) | (1 << (CParser.T__67 - 64)) | (1 << (CParser.T__68 - 64)) | (1 << (CParser.T__69 - 64)) | (1 << (CParser.T__70 - 64)) | (1 << (CParser.T__71 - 64)) | (1 << (CParser.T__72 - 64)) | (1 << (CParser.T__73 - 64)) | (1 << (CParser.T__74 - 64)) | (1 << (CParser.T__75 - 64)) | (1 << (CParser.T__76 - 64)) | (1 << (CParser.T__77 - 64)) | (1 << (CParser.T__78 - 64)) | (1 << (CParser.T__79 - 64)) | (1 << (CParser.T__80 - 64)) | (1 << (CParser.T__81 - 64)) | (1 << (CParser.T__82 - 64)) | (1 << (CParser.T__83 - 64)) | (1 << (CParser.T__84 - 64)) | (1 << (CParser.T__85 - 64)) | (1 << (CParser.T__86 - 64)) | (1 << (CParser.T__87 - 64)) | (1 << (CParser.T__88 - 64)) | (1 << (CParser.T__89 - 64)) | (1 << (CParser.T__90 - 64)) | (1 << (CParser.T__91 - 64)) | (1 << (CParser.IDENTIFIER - 64)) | (1 << (CParser.CHARACTER_LITERAL - 64)) | (1 << (CParser.STRING_LITERAL - 64)) | (1 << (CParser.HEX_LITERAL - 64)) | (1 << (CParser.DECIMAL_LITERAL - 64)) | (1 << (CParser.OCTAL_LITERAL - 64)) | (1 << (CParser.FLOATING_POINT_LITERAL - 64)) | (1 << (CParser.WS - 64)) | (1 << (CParser.BS - 64)) | (1 << (CParser.UnicodeVocabulary - 64)) | (1 << (CParser.COMMENT - 64)) | (1 << (CParser.LINE_COMMENT - 64)) | (1 << (CParser.LINE_COMMAND - 64)))) != 0):
+ self.state = 782
+ _la = self._input.LA(1)
+ if _la <= 0 or _la==CParser.T__19:
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 787
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 788
+ self.match(CParser.T__19)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Macro_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ # @param i=None Type: int
+ def declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.DeclarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.DeclarationContext,i)
+
+
+ def statement_list(self):
+ return self.getTypedRuleContext(CParser.Statement_listContext,0)
+
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_macro_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterMacro_statement" ):
+ listener.enterMacro_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitMacro_statement" ):
+ listener.exitMacro_statement(self)
+
+
+
+
+ def macro_statement(self):
+
+ localctx = CParser.Macro_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 126, self.RULE_macro_statement)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 790
+ self.match(CParser.IDENTIFIER)
+ self.state = 791
+ self.match(CParser.T__37)
+ self.state = 795
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,97,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 792
+ self.declaration()
+ self.state = 797
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,97,self._ctx)
+
+ self.state = 799
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,98,self._ctx)
+ if la_ == 1:
+ self.state = 798
+ self.statement_list()
+
+
+ self.state = 802
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if ((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & ((1 << (CParser.T__37 - 38)) | (1 << (CParser.T__41 - 38)) | (1 << (CParser.T__43 - 38)) | (1 << (CParser.T__44 - 38)) | (1 << (CParser.T__47 - 38)) | (1 << (CParser.T__48 - 38)) | (1 << (CParser.T__49 - 38)) | (1 << (CParser.T__52 - 38)) | (1 << (CParser.T__53 - 38)) | (1 << (CParser.T__54 - 38)) | (1 << (CParser.IDENTIFIER - 38)) | (1 << (CParser.CHARACTER_LITERAL - 38)) | (1 << (CParser.STRING_LITERAL - 38)) | (1 << (CParser.HEX_LITERAL - 38)) | (1 << (CParser.DECIMAL_LITERAL - 38)) | (1 << (CParser.OCTAL_LITERAL - 38)) | (1 << (CParser.FLOATING_POINT_LITERAL - 38)))) != 0):
+ self.state = 801
+ self.expression()
+
+
+ self.state = 804
+ self.match(CParser.T__38)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Labeled_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def statement(self):
+ return self.getTypedRuleContext(CParser.StatementContext,0)
+
+
+ def constant_expression(self):
+ return self.getTypedRuleContext(CParser.Constant_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_labeled_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterLabeled_statement" ):
+ listener.enterLabeled_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitLabeled_statement" ):
+ listener.exitLabeled_statement(self)
+
+
+
+
+ def labeled_statement(self):
+
+ localctx = CParser.Labeled_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 128, self.RULE_labeled_statement)
+ try:
+ self.state = 817
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.IDENTIFIER]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 806
+ self.match(CParser.IDENTIFIER)
+ self.state = 807
+ self.match(CParser.T__22)
+ self.state = 808
+ self.statement()
+ pass
+ elif token in [CParser.T__81]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 809
+ self.match(CParser.T__81)
+ self.state = 810
+ self.constant_expression()
+ self.state = 811
+ self.match(CParser.T__22)
+ self.state = 812
+ self.statement()
+ pass
+ elif token in [CParser.T__82]:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 814
+ self.match(CParser.T__82)
+ self.state = 815
+ self.match(CParser.T__22)
+ self.state = 816
+ self.statement()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Compound_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.DeclarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.DeclarationContext,i)
+
+
+ def statement_list(self):
+ return self.getTypedRuleContext(CParser.Statement_listContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_compound_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterCompound_statement" ):
+ listener.enterCompound_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitCompound_statement" ):
+ listener.exitCompound_statement(self)
+
+
+
+
+ def compound_statement(self):
+
+ localctx = CParser.Compound_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 130, self.RULE_compound_statement)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 819
+ self.match(CParser.T__0)
+ self.state = 823
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,101,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 820
+ self.declaration()
+ self.state = 825
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,101,self._ctx)
+
+ self.state = 827
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__0) | (1 << CParser.T__1) | (1 << CParser.T__2) | (1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9) | (1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36) | (1 << CParser.T__37) | (1 << CParser.T__41) | (1 << CParser.T__43) | (1 << CParser.T__44) | (1 << CParser.T__47) | (1 << CParser.T__48) | (1 << CParser.T__49) | (1 << CParser.T__52) | (1 << CParser.T__53) | (1 << CParser.T__54))) != 0) or ((((_la - 79)) & ~0x3f) == 0 and ((1 << (_la - 79)) & ((1 << (CParser.T__78 - 79)) | (1 << (CParser.T__79 - 79)) | (1 << (CParser.T__80 - 79)) | (1 << (CParser.T__81 - 79)) | (1 << (CParser.T__82 - 79)) | (1 << (CParser.T__83 - 79)) | (1 << (CParser.T__85 - 79)) | (1 << (CParser.T__86 - 79)) | (1 << (CParser.T__87 - 79)) | (1 << (CParser.T__88 - 79)) | (1 << (CParser.T__89 - 79)) | (1 << (CParser.T__90 - 79)) | (1 << (CParser.T__91 - 79)) | (1 << (CParser.IDENTIFIER - 79)) | (1 << (CParser.CHARACTER_LITERAL - 79)) | (1 << (CParser.STRING_LITERAL - 79)) | (1 << (CParser.HEX_LITERAL - 79)) | (1 << (CParser.DECIMAL_LITERAL - 79)) | (1 << (CParser.OCTAL_LITERAL - 79)) | (1 << (CParser.FLOATING_POINT_LITERAL - 79)))) != 0):
+ self.state = 826
+ self.statement_list()
+
+
+ self.state = 829
+ self.match(CParser.T__19)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Statement_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def statement(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.StatementContext)
+ else:
+ return self.getTypedRuleContext(CParser.StatementContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_statement_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStatement_list" ):
+ listener.enterStatement_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStatement_list" ):
+ listener.exitStatement_list(self)
+
+
+
+
+ def statement_list(self):
+
+ localctx = CParser.Statement_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 132, self.RULE_statement_list)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 832
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 831
+ self.statement()
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 834
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,103,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Expression_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_expression_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterExpression_statement" ):
+ listener.enterExpression_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitExpression_statement" ):
+ listener.exitExpression_statement(self)
+
+
+
+
+ def expression_statement(self):
+
+ localctx = CParser.Expression_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 134, self.RULE_expression_statement)
+ try:
+ self.state = 840
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__1]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 836
+ self.match(CParser.T__1)
+ pass
+ elif token in [CParser.T__37, CParser.T__41, CParser.T__43, CParser.T__44, CParser.T__47, CParser.T__48, CParser.T__49, CParser.T__52, CParser.T__53, CParser.T__54, CParser.IDENTIFIER, CParser.CHARACTER_LITERAL, CParser.STRING_LITERAL, CParser.HEX_LITERAL, CParser.DECIMAL_LITERAL, CParser.OCTAL_LITERAL, CParser.FLOATING_POINT_LITERAL]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 837
+ self.expression()
+ self.state = 838
+ self.match(CParser.T__1)
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Selection_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.e = None # ExpressionContext
+
+ # @param i=None Type: int
+ def statement(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.StatementContext)
+ else:
+ return self.getTypedRuleContext(CParser.StatementContext,i)
+
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_selection_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterSelection_statement" ):
+ listener.enterSelection_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitSelection_statement" ):
+ listener.exitSelection_statement(self)
+
+
+
+
+ def selection_statement(self):
+
+ localctx = CParser.Selection_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 136, self.RULE_selection_statement)
+ try:
+ self.state = 858
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__83]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 842
+ self.match(CParser.T__83)
+ self.state = 843
+ self.match(CParser.T__37)
+ self.state = 844
+ localctx.e = self.expression()
+ self.state = 845
+ self.match(CParser.T__38)
+ self.StorePredicateExpression((None if localctx.e is None else localctx.e.start).line, (None if localctx.e is None else localctx.e.start).column, (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is None else localctx.e.stop).column, (None if localctx.e is None else self._input.getText((localctx.e.start,localctx.e.stop))))
+ self.state = 847
+ self.statement()
+ self.state = 850
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,105,self._ctx)
+ if la_ == 1:
+ self.state = 848
+ self.match(CParser.T__84)
+ self.state = 849
+ self.statement()
+
+
+ pass
+ elif token in [CParser.T__85]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 852
+ self.match(CParser.T__85)
+ self.state = 853
+ self.match(CParser.T__37)
+ self.state = 854
+ self.expression()
+ self.state = 855
+ self.match(CParser.T__38)
+ self.state = 856
+ self.statement()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Iteration_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.e = None # ExpressionContext
+
+ def statement(self):
+ return self.getTypedRuleContext(CParser.StatementContext,0)
+
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_iteration_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterIteration_statement" ):
+ listener.enterIteration_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitIteration_statement" ):
+ listener.exitIteration_statement(self)
+
+
+
+
+ def iteration_statement(self):
+
+ localctx = CParser.Iteration_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 138, self.RULE_iteration_statement)
+ try:
+ self.state = 876
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__86]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 860
+ self.match(CParser.T__86)
+ self.state = 861
+ self.match(CParser.T__37)
+ self.state = 862
+ localctx.e = self.expression()
+ self.state = 863
+ self.match(CParser.T__38)
+ self.state = 864
+ self.statement()
+ self.StorePredicateExpression((None if localctx.e is None else localctx.e.start).line, (None if localctx.e is None else localctx.e.start).column, (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is None else localctx.e.stop).column, (None if localctx.e is None else self._input.getText((localctx.e.start,localctx.e.stop))))
+ pass
+ elif token in [CParser.T__87]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 867
+ self.match(CParser.T__87)
+ self.state = 868
+ self.statement()
+ self.state = 869
+ self.match(CParser.T__86)
+ self.state = 870
+ self.match(CParser.T__37)
+ self.state = 871
+ localctx.e = self.expression()
+ self.state = 872
+ self.match(CParser.T__38)
+ self.state = 873
+ self.match(CParser.T__1)
+ self.StorePredicateExpression((None if localctx.e is None else localctx.e.start).line, (None if localctx.e is None else localctx.e.start).column, (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is None else localctx.e.stop).column, (None if localctx.e is None else self._input.getText((localctx.e.start,localctx.e.stop))))
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Jump_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_jump_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterJump_statement" ):
+ listener.enterJump_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitJump_statement" ):
+ listener.exitJump_statement(self)
+
+
+
+
+ def jump_statement(self):
+
+ localctx = CParser.Jump_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 140, self.RULE_jump_statement)
+ try:
+ self.state = 891
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,108,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 878
+ self.match(CParser.T__88)
+ self.state = 879
+ self.match(CParser.IDENTIFIER)
+ self.state = 880
+ self.match(CParser.T__1)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 881
+ self.match(CParser.T__89)
+ self.state = 882
+ self.match(CParser.T__1)
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 883
+ self.match(CParser.T__90)
+ self.state = 884
+ self.match(CParser.T__1)
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 885
+ self.match(CParser.T__91)
+ self.state = 886
+ self.match(CParser.T__1)
+ pass
+
+ elif la_ == 5:
+ self.enterOuterAlt(localctx, 5)
+ self.state = 887
+ self.match(CParser.T__91)
+ self.state = 888
+ self.expression()
+ self.state = 889
+ self.match(CParser.T__1)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/__init__.py b/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/CParser4/__init__.py
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/Check.py b/roms/edk2/BaseTools/Source/Python/Ecc/Check.py
new file mode 100644
index 000000000..6087abfa4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/Check.py
@@ -0,0 +1,1532 @@
+## @file
+# This file is used to define checkpoints used by ECC tool
+#
+# Copyright (c) 2008 - 2020, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+from __future__ import absolute_import
+import Common.LongFilePathOs as os
+import re
+from CommonDataClass.DataClass import *
+import Common.DataType as DT
+from Ecc.EccToolError import *
+from Ecc.MetaDataParser import ParseHeaderCommentSection
+from Ecc import EccGlobalData
+from Ecc import c
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+
+## Check
+#
+# This class is to define checkpoints used by ECC tool
+#
+# @param object: Inherited from object class
+#
+class Check(object):
+ def __init__(self):
+ pass
+
+ # Check all required checkpoints
+ def Check(self):
+ self.GeneralCheck()
+ self.MetaDataFileCheck()
+ self.DoxygenCheck()
+ self.IncludeFileCheck()
+ self.PredicateExpressionCheck()
+ self.DeclAndDataTypeCheck()
+ self.FunctionLayoutCheck()
+ self.NamingConventionCheck()
+ self.SmmCommParaCheck()
+
+ def SmmCommParaCheck(self):
+ self.SmmCommParaCheckBufferType()
+
+
+ # Check if SMM communication function has correct parameter type
+ # 1. Get function calling with instance./->Communicate() interface
+ # and make sure the protocol instance is of type EFI_SMM_COMMUNICATION_PROTOCOL.
+ # 2. Find the origin of the 2nd parameter of Communicate() interface, if -
+ # a. it is a local buffer on stack
+ # report error.
+ # b. it is a global buffer, check the driver that holds the global buffer is of type DXE_RUNTIME_DRIVER
+ # report success.
+ # c. it is a buffer by AllocatePage/AllocatePool (may be wrapped by nested function calls),
+ # check the EFI_MEMORY_TYPE to be EfiRuntimeServicesCode,EfiRuntimeServicesData,
+ # EfiACPIMemoryNVS or EfiReservedMemoryType
+ # report success.
+ # d. it is a buffer located via EFI_SYSTEM_TABLE.ConfigurationTable (may be wrapped by nested function calls)
+ # report warning to indicate human code review.
+ # e. it is a buffer from other kind of pointers (may need to trace into nested function calls to locate),
+ # repeat checks in a.b.c and d.
+ def SmmCommParaCheckBufferType(self):
+ if EccGlobalData.gConfig.SmmCommParaCheckBufferType == '1' or EccGlobalData.gConfig.SmmCommParaCheckAll == '1':
+ EdkLogger.quiet("Checking SMM communication parameter type ...")
+ # Get all EFI_SMM_COMMUNICATION_PROTOCOL interface
+ CommApiList = []
+ for IdentifierTable in EccGlobalData.gIdentifierTableList:
+ SqlCommand = """select ID, Name, BelongsToFile from %s
+ where Modifier = 'EFI_SMM_COMMUNICATION_PROTOCOL*' """ % (IdentifierTable)
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ if RecordSet:
+ for Record in RecordSet:
+ if Record[1] not in CommApiList:
+ CommApiList.append(Record[1])
+ # For each interface, check the second parameter
+ for CommApi in CommApiList:
+ for IdentifierTable in EccGlobalData.gIdentifierTableList:
+ SqlCommand = """select ID, Name, Value, BelongsToFile, StartLine from %s
+ where Name = '%s->Communicate' and Model = %s""" \
+ % (IdentifierTable, CommApi, MODEL_IDENTIFIER_FUNCTION_CALLING)
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ if RecordSet:
+ # print IdentifierTable
+ for Record in RecordSet:
+ # Get the second parameter for Communicate function
+ SecondPara = Record[2].split(',')[1].strip()
+ SecondParaIndex = None
+ if SecondPara.startswith('&'):
+ SecondPara = SecondPara[1:]
+ if SecondPara.endswith(']'):
+ SecondParaIndex = SecondPara[SecondPara.find('[') + 1:-1]
+ SecondPara = SecondPara[:SecondPara.find('[')]
+ # Get the ID
+ Id = Record[0]
+ # Get the BelongsToFile
+ BelongsToFile = Record[3]
+ # Get the source file path
+ SqlCommand = """select FullPath from File where ID = %s""" % BelongsToFile
+ NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ FullPath = NewRecordSet[0][0]
+ # Get the line no of function calling
+ StartLine = Record[4]
+ # Get the module type
+ SqlCommand = """select Value3 from INF where BelongsToFile = (select ID from File
+ where Path = (select Path from File where ID = %s) and Model = 1011)
+ and Value2 = 'MODULE_TYPE'""" % BelongsToFile
+ NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ ModuleType = NewRecordSet[0][0] if NewRecordSet else None
+
+ # print BelongsToFile, FullPath, StartLine, ModuleType, SecondPara
+
+ Value = FindPara(FullPath, SecondPara, StartLine)
+ # Find the value of the parameter
+ if Value:
+ if 'AllocatePage' in Value \
+ or 'AllocatePool' in Value \
+ or 'AllocateRuntimePool' in Value \
+ or 'AllocateZeroPool' in Value:
+ pass
+ else:
+ if '->' in Value:
+ if not EccGlobalData.gException.IsException(
+ ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE, Value):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE,
+ OtherMsg="Please review the buffer type"
+ + "is correct or not. If it is correct" +
+ " please add [%s] to exception list"
+ % Value,
+ BelongsToTable=IdentifierTable,
+ BelongsToItem=Id)
+ else:
+ if not EccGlobalData.gException.IsException(
+ ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE, Value):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE,
+ OtherMsg="Please review the buffer type"
+ + "is correct or not. If it is correct" +
+ " please add [%s] to exception list"
+ % Value,
+ BelongsToTable=IdentifierTable,
+ BelongsToItem=Id)
+
+
+ # Not find the value of the parameter
+ else:
+ SqlCommand = """select ID, Modifier, Name, Value, Model, BelongsToFunction from %s
+ where Name = '%s' and StartLine < %s order by StartLine DESC""" \
+ % (IdentifierTable, SecondPara, StartLine)
+ NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ if NewRecordSet:
+ Value = NewRecordSet[0][1]
+ if 'AllocatePage' in Value \
+ or 'AllocatePool' in Value \
+ or 'AllocateRuntimePool' in Value \
+ or 'AllocateZeroPool' in Value:
+ pass
+ else:
+ if not EccGlobalData.gException.IsException(
+ ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE, Value):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE,
+ OtherMsg="Please review the buffer type"
+ + "is correct or not. If it is correct" +
+ " please add [%s] to exception list"
+ % Value,
+ BelongsToTable=IdentifierTable,
+ BelongsToItem=Id)
+ else:
+ pass
+
+ # Check UNI files
+ def UniCheck(self):
+ if EccGlobalData.gConfig.GeneralCheckUni == '1' or EccGlobalData.gConfig.GeneralCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking whether UNI file is UTF-16 ...")
+ SqlCommand = """select ID, FullPath, ExtName from File where ExtName like 'uni'"""
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ File = Record[1]
+ FileIn = open(File, 'rb').read(2)
+ if FileIn != '\xff\xfe':
+ OtherMsg = "File %s is not a valid UTF-16 UNI file" % Record[1]
+ EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_UNI, OtherMsg=OtherMsg, BelongsToTable='File', BelongsToItem=Record[0])
+
+ # General Checking
+ def GeneralCheck(self):
+ self.GeneralCheckNonAcsii()
+ self.UniCheck()
+ self.GeneralCheckNoTab()
+ self.GeneralCheckLineEnding()
+ self.GeneralCheckTrailingWhiteSpaceLine()
+
+ # Check whether NO Tab is used, replaced with spaces
+ def GeneralCheckNoTab(self):
+ if EccGlobalData.gConfig.GeneralCheckNoTab == '1' or EccGlobalData.gConfig.GeneralCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking No TAB used in file ...")
+ SqlCommand = """select ID, FullPath, ExtName from File where ExtName in ('.dec', '.inf', '.dsc', 'c', 'h')"""
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ if Record[2].upper() not in EccGlobalData.gConfig.BinaryExtList:
+ op = open(Record[1]).readlines()
+ IndexOfLine = 0
+ for Line in op:
+ IndexOfLine += 1
+ IndexOfChar = 0
+ for Char in Line:
+ IndexOfChar += 1
+ if Char == '\t':
+ OtherMsg = "File %s has TAB char at line %s column %s" % (Record[1], IndexOfLine, IndexOfChar)
+ EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_NO_TAB, OtherMsg=OtherMsg, BelongsToTable='File', BelongsToItem=Record[0])
+
+ # Check Only use CRLF (Carriage Return Line Feed) line endings.
+ def GeneralCheckLineEnding(self):
+ if EccGlobalData.gConfig.GeneralCheckLineEnding == '1' or EccGlobalData.gConfig.GeneralCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking line ending in file ...")
+ SqlCommand = """select ID, FullPath, ExtName from File where ExtName in ('.dec', '.inf', '.dsc', 'c', 'h')"""
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ if Record[2].upper() not in EccGlobalData.gConfig.BinaryExtList:
+ op = open(Record[1], 'rb').readlines()
+ IndexOfLine = 0
+ for Line in op:
+ IndexOfLine += 1
+ if not bytes.decode(Line).endswith('\r\n'):
+ OtherMsg = "File %s has invalid line ending at line %s" % (Record[1], IndexOfLine)
+ EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_INVALID_LINE_ENDING, OtherMsg=OtherMsg, BelongsToTable='File', BelongsToItem=Record[0])
+
+ # Check if there is no trailing white space in one line.
+ def GeneralCheckTrailingWhiteSpaceLine(self):
+ if EccGlobalData.gConfig.GeneralCheckTrailingWhiteSpaceLine == '1' or EccGlobalData.gConfig.GeneralCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking trailing white space line in file ...")
+ SqlCommand = """select ID, FullPath, ExtName from File where ExtName in ('.dec', '.inf', '.dsc', 'c', 'h')"""
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ if Record[2].upper() not in EccGlobalData.gConfig.BinaryExtList:
+ op = open(Record[1], 'r').readlines()
+ IndexOfLine = 0
+ for Line in op:
+ IndexOfLine += 1
+ if Line.replace('\r', '').replace('\n', '').endswith(' '):
+ OtherMsg = "File %s has trailing white spaces at line %s" % (Record[1], IndexOfLine)
+ EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_TRAILING_WHITE_SPACE_LINE, OtherMsg=OtherMsg, BelongsToTable='File', BelongsToItem=Record[0])
+
+ # Check whether file has non ACSII char
+ def GeneralCheckNonAcsii(self):
+ if EccGlobalData.gConfig.GeneralCheckNonAcsii == '1' or EccGlobalData.gConfig.GeneralCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking Non-ACSII char in file ...")
+ SqlCommand = """select ID, FullPath, ExtName from File where ExtName in ('.dec', '.inf', '.dsc', 'c', 'h')"""
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ if Record[2].upper() not in EccGlobalData.gConfig.BinaryExtList:
+ op = open(Record[1]).readlines()
+ IndexOfLine = 0
+ for Line in op:
+ IndexOfLine += 1
+ IndexOfChar = 0
+ for Char in Line:
+ IndexOfChar += 1
+ if ord(Char) > 126:
+ OtherMsg = "File %s has Non-ASCII char at line %s column %s" % (Record[1], IndexOfLine, IndexOfChar)
+ EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_NON_ACSII, OtherMsg=OtherMsg, BelongsToTable='File', BelongsToItem=Record[0])
+
+ # C Function Layout Checking
+ def FunctionLayoutCheck(self):
+ self.FunctionLayoutCheckReturnType()
+ self.FunctionLayoutCheckModifier()
+ self.FunctionLayoutCheckName()
+ self.FunctionLayoutCheckPrototype()
+ self.FunctionLayoutCheckBody()
+ self.FunctionLayoutCheckLocalVariable()
+ self.FunctionLayoutCheckDeprecated()
+
+ # To check if the deprecated functions are used
+ def FunctionLayoutCheckDeprecated(self):
+ if EccGlobalData.gConfig.CFunctionLayoutCheckNoDeprecated == '1' or EccGlobalData.gConfig.CFunctionLayoutCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking function no deprecated one being used ...")
+
+ DeprecatedFunctionSet = ('UnicodeValueToString',
+ 'AsciiValueToString',
+ 'StrCpy',
+ 'StrnCpy',
+ 'StrCat',
+ 'StrnCat',
+ 'UnicodeStrToAsciiStr',
+ 'AsciiStrCpy',
+ 'AsciiStrnCpy',
+ 'AsciiStrCat',
+ 'AsciiStrnCat',
+ 'AsciiStrToUnicodeStr',
+ 'PcdSet8',
+ 'PcdSet16',
+ 'PcdSet32',
+ 'PcdSet64',
+ 'PcdSetPtr',
+ 'PcdSetBool',
+ 'PcdSetEx8',
+ 'PcdSetEx16',
+ 'PcdSetEx32',
+ 'PcdSetEx64',
+ 'PcdSetExPtr',
+ 'PcdSetExBool',
+ 'LibPcdSet8',
+ 'LibPcdSet16',
+ 'LibPcdSet32',
+ 'LibPcdSet64',
+ 'LibPcdSetPtr',
+ 'LibPcdSetBool',
+ 'LibPcdSetEx8',
+ 'LibPcdSetEx16',
+ 'LibPcdSetEx32',
+ 'LibPcdSetEx64',
+ 'LibPcdSetExPtr',
+ 'LibPcdSetExBool',
+ 'GetVariable',
+ 'GetEfiGlobalVariable',
+ )
+
+ for IdentifierTable in EccGlobalData.gIdentifierTableList:
+ SqlCommand = """select ID, Name, BelongsToFile from %s
+ where Model = %s """ % (IdentifierTable, MODEL_IDENTIFIER_FUNCTION_CALLING)
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ for Key in DeprecatedFunctionSet:
+ if Key == Record[1]:
+ if not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_DEPRECATE, Key):
+ OtherMsg = 'The function [%s] is deprecated which should NOT be used' % Key
+ EccGlobalData.gDb.TblReport.Insert(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_DEPRECATE,
+ OtherMsg=OtherMsg,
+ BelongsToTable=IdentifierTable,
+ BelongsToItem=Record[0])
+
+ def WalkTree(self):
+ IgnoredPattern = c.GetIgnoredDirListPattern()
+ for Dirpath, Dirnames, Filenames in os.walk(EccGlobalData.gTarget):
+ for Dir in Dirnames:
+ Dirname = os.path.join(Dirpath, Dir)
+ if os.path.islink(Dirname):
+ Dirname = os.path.realpath(Dirname)
+ if os.path.isdir(Dirname):
+ # symlinks to directories are treated as directories
+ Dirnames.remove(Dir)
+ Dirnames.append(Dirname)
+ if IgnoredPattern.match(Dirpath.upper()):
+ continue
+ for f in Filenames[:]:
+ if f.lower() in EccGlobalData.gConfig.SkipFileList:
+ Filenames.remove(f)
+ yield (Dirpath, Dirnames, Filenames)
+
+ # Check whether return type exists and in the first line
+ def FunctionLayoutCheckReturnType(self):
+ if EccGlobalData.gConfig.CFunctionLayoutCheckReturnType == '1' or EccGlobalData.gConfig.CFunctionLayoutCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking function layout return type ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.c', '.h'):
+# FullName = os.path.join(Dirpath, F)
+# c.CheckFuncLayoutReturnType(FullName)
+ for FullName in EccGlobalData.gCFileList + EccGlobalData.gHFileList:
+ c.CheckFuncLayoutReturnType(FullName)
+
+ # Check whether any optional functional modifiers exist and next to the return type
+ def FunctionLayoutCheckModifier(self):
+ if EccGlobalData.gConfig.CFunctionLayoutCheckOptionalFunctionalModifier == '1' or EccGlobalData.gConfig.CFunctionLayoutCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking function layout modifier ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.c', '.h'):
+# FullName = os.path.join(Dirpath, F)
+# c.CheckFuncLayoutModifier(FullName)
+ for FullName in EccGlobalData.gCFileList + EccGlobalData.gHFileList:
+ c.CheckFuncLayoutModifier(FullName)
+
+ # Check whether the next line contains the function name, left justified, followed by the beginning of the parameter list
+ # Check whether the closing parenthesis is on its own line and also indented two spaces
+ def FunctionLayoutCheckName(self):
+ if EccGlobalData.gConfig.CFunctionLayoutCheckFunctionName == '1' or EccGlobalData.gConfig.CFunctionLayoutCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking function layout function name ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.c', '.h'):
+# FullName = os.path.join(Dirpath, F)
+# c.CheckFuncLayoutName(FullName)
+ for FullName in EccGlobalData.gCFileList + EccGlobalData.gHFileList:
+ c.CheckFuncLayoutName(FullName)
+
+ # Check whether the function prototypes in include files have the same form as function definitions
+ def FunctionLayoutCheckPrototype(self):
+ if EccGlobalData.gConfig.CFunctionLayoutCheckFunctionPrototype == '1' or EccGlobalData.gConfig.CFunctionLayoutCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking function layout function prototype ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.c'):
+# FullName = os.path.join(Dirpath, F)
+# EdkLogger.quiet("[PROTOTYPE]" + FullName)
+# c.CheckFuncLayoutPrototype(FullName)
+ for FullName in EccGlobalData.gCFileList:
+ EdkLogger.quiet("[PROTOTYPE]" + FullName)
+ c.CheckFuncLayoutPrototype(FullName)
+
+ # Check whether the body of a function is contained by open and close braces that must be in the first column
+ def FunctionLayoutCheckBody(self):
+ if EccGlobalData.gConfig.CFunctionLayoutCheckFunctionBody == '1' or EccGlobalData.gConfig.CFunctionLayoutCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking function layout function body ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.c'):
+# FullName = os.path.join(Dirpath, F)
+# c.CheckFuncLayoutBody(FullName)
+ for FullName in EccGlobalData.gCFileList:
+ c.CheckFuncLayoutBody(FullName)
+
+ # Check whether the data declarations is the first code in a module.
+ # self.CFunctionLayoutCheckDataDeclaration = 1
+ # Check whether no initialization of a variable as part of its declaration
+ def FunctionLayoutCheckLocalVariable(self):
+ if EccGlobalData.gConfig.CFunctionLayoutCheckNoInitOfVariable == '1' or EccGlobalData.gConfig.CFunctionLayoutCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking function layout local variables ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.c'):
+# FullName = os.path.join(Dirpath, F)
+# c.CheckFuncLayoutLocalVariable(FullName)
+
+ for FullName in EccGlobalData.gCFileList:
+ c.CheckFuncLayoutLocalVariable(FullName)
+
+ # Check whether no use of STATIC for functions
+ # self.CFunctionLayoutCheckNoStatic = 1
+
+ # Declarations and Data Types Checking
+ def DeclAndDataTypeCheck(self):
+ self.DeclCheckNoUseCType()
+ self.DeclCheckInOutModifier()
+ self.DeclCheckEFIAPIModifier()
+ self.DeclCheckEnumeratedType()
+ self.DeclCheckStructureDeclaration()
+ self.DeclCheckSameStructure()
+ self.DeclCheckUnionType()
+
+
+ # Check whether no use of int, unsigned, char, void, long in any .c, .h or .asl files.
+ def DeclCheckNoUseCType(self):
+ if EccGlobalData.gConfig.DeclarationDataTypeCheckNoUseCType == '1' or EccGlobalData.gConfig.DeclarationDataTypeCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking Declaration No use C type ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.h', '.c'):
+# FullName = os.path.join(Dirpath, F)
+# c.CheckDeclNoUseCType(FullName)
+ for FullName in EccGlobalData.gCFileList + EccGlobalData.gHFileList:
+ c.CheckDeclNoUseCType(FullName)
+
+ # Check whether the modifiers IN, OUT, OPTIONAL, and UNALIGNED are used only to qualify arguments to a function and should not appear in a data type declaration
+ def DeclCheckInOutModifier(self):
+ if EccGlobalData.gConfig.DeclarationDataTypeCheckInOutModifier == '1' or EccGlobalData.gConfig.DeclarationDataTypeCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking Declaration argument modifier ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.h', '.c'):
+# FullName = os.path.join(Dirpath, F)
+# c.CheckDeclArgModifier(FullName)
+ for FullName in EccGlobalData.gCFileList + EccGlobalData.gHFileList:
+ c.CheckDeclArgModifier(FullName)
+
+ # Check whether the EFIAPI modifier should be used at the entry of drivers, events, and member functions of protocols
+ def DeclCheckEFIAPIModifier(self):
+ if EccGlobalData.gConfig.DeclarationDataTypeCheckEFIAPIModifier == '1' or EccGlobalData.gConfig.DeclarationDataTypeCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ pass
+
+ # Check whether Enumerated Type has a 'typedef' and the name is capital
+ def DeclCheckEnumeratedType(self):
+ if EccGlobalData.gConfig.DeclarationDataTypeCheckEnumeratedType == '1' or EccGlobalData.gConfig.DeclarationDataTypeCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking Declaration enum typedef ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.h', '.c'):
+# FullName = os.path.join(Dirpath, F)
+# EdkLogger.quiet("[ENUM]" + FullName)
+# c.CheckDeclEnumTypedef(FullName)
+ for FullName in EccGlobalData.gCFileList + EccGlobalData.gHFileList:
+ EdkLogger.quiet("[ENUM]" + FullName)
+ c.CheckDeclEnumTypedef(FullName)
+
+ # Check whether Structure Type has a 'typedef' and the name is capital
+ def DeclCheckStructureDeclaration(self):
+ if EccGlobalData.gConfig.DeclarationDataTypeCheckStructureDeclaration == '1' or EccGlobalData.gConfig.DeclarationDataTypeCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking Declaration struct typedef ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.h', '.c'):
+# FullName = os.path.join(Dirpath, F)
+# EdkLogger.quiet("[STRUCT]" + FullName)
+# c.CheckDeclStructTypedef(FullName)
+ for FullName in EccGlobalData.gCFileList + EccGlobalData.gHFileList:
+ EdkLogger.quiet("[STRUCT]" + FullName)
+ c.CheckDeclStructTypedef(FullName)
+
+ # Check whether having same Structure
+ def DeclCheckSameStructure(self):
+ if EccGlobalData.gConfig.DeclarationDataTypeCheckSameStructure == '1' or EccGlobalData.gConfig.DeclarationDataTypeCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking same struct ...")
+ AllStructure = {}
+ for IdentifierTable in EccGlobalData.gIdentifierTableList:
+ SqlCommand = """select ID, Name, BelongsToFile from %s where Model = %s""" % (IdentifierTable, MODEL_IDENTIFIER_STRUCTURE)
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ if Record[1] != '':
+ if Record[1] not in AllStructure.keys():
+ AllStructure[Record[1]] = Record[2]
+ else:
+ ID = AllStructure[Record[1]]
+ SqlCommand = """select FullPath from File where ID = %s """ % ID
+ NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ OtherMsg = "The structure name '%s' is duplicate" % Record[1]
+ if NewRecordSet != []:
+ OtherMsg = "The structure name [%s] is duplicate with the one defined in %s, maybe struct NOT typedefed or the typedef new type NOT used to qualify variables" % (Record[1], NewRecordSet[0][0])
+ if not EccGlobalData.gException.IsException(ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE, Record[1]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE, OtherMsg=OtherMsg, BelongsToTable=IdentifierTable, BelongsToItem=Record[0])
+
+ # Check whether Union Type has a 'typedef' and the name is capital
+ def DeclCheckUnionType(self):
+ if EccGlobalData.gConfig.DeclarationDataTypeCheckUnionType == '1' or EccGlobalData.gConfig.DeclarationDataTypeCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking Declaration union typedef ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.h', '.c'):
+# FullName = os.path.join(Dirpath, F)
+# EdkLogger.quiet("[UNION]" + FullName)
+# c.CheckDeclUnionTypedef(FullName)
+ for FullName in EccGlobalData.gCFileList + EccGlobalData.gHFileList:
+ EdkLogger.quiet("[UNION]" + FullName)
+ c.CheckDeclUnionTypedef(FullName)
+
+ # Predicate Expression Checking
+ def PredicateExpressionCheck(self):
+ self.PredicateExpressionCheckBooleanValue()
+ self.PredicateExpressionCheckNonBooleanOperator()
+ self.PredicateExpressionCheckComparisonNullType()
+
+ # Check whether Boolean values, variable type BOOLEAN not use explicit comparisons to TRUE or FALSE
+ def PredicateExpressionCheckBooleanValue(self):
+ if EccGlobalData.gConfig.PredicateExpressionCheckBooleanValue == '1' or EccGlobalData.gConfig.PredicateExpressionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking predicate expression Boolean value ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.c'):
+# FullName = os.path.join(Dirpath, F)
+# EdkLogger.quiet("[BOOLEAN]" + FullName)
+# c.CheckBooleanValueComparison(FullName)
+ for FullName in EccGlobalData.gCFileList:
+ EdkLogger.quiet("[BOOLEAN]" + FullName)
+ c.CheckBooleanValueComparison(FullName)
+
+ # Check whether Non-Boolean comparisons use a compare operator (==, !=, >, < >=, <=).
+ def PredicateExpressionCheckNonBooleanOperator(self):
+ if EccGlobalData.gConfig.PredicateExpressionCheckNonBooleanOperator == '1' or EccGlobalData.gConfig.PredicateExpressionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking predicate expression Non-Boolean variable...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.c'):
+# FullName = os.path.join(Dirpath, F)
+# EdkLogger.quiet("[NON-BOOLEAN]" + FullName)
+# c.CheckNonBooleanValueComparison(FullName)
+ for FullName in EccGlobalData.gCFileList:
+ EdkLogger.quiet("[NON-BOOLEAN]" + FullName)
+ c.CheckNonBooleanValueComparison(FullName)
+
+ # Check whether a comparison of any pointer to zero must be done via the NULL type
+ def PredicateExpressionCheckComparisonNullType(self):
+ if EccGlobalData.gConfig.PredicateExpressionCheckComparisonNullType == '1' or EccGlobalData.gConfig.PredicateExpressionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking predicate expression NULL pointer ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.c'):
+# FullName = os.path.join(Dirpath, F)
+# EdkLogger.quiet("[POINTER]" + FullName)
+# c.CheckPointerNullComparison(FullName)
+ for FullName in EccGlobalData.gCFileList:
+ EdkLogger.quiet("[POINTER]" + FullName)
+ c.CheckPointerNullComparison(FullName)
+
+ # Include file checking
+ def IncludeFileCheck(self):
+ self.IncludeFileCheckIfndef()
+ self.IncludeFileCheckData()
+ self.IncludeFileCheckSameName()
+
+ # Check whether having include files with same name
+ def IncludeFileCheckSameName(self):
+ if EccGlobalData.gConfig.IncludeFileCheckSameName == '1' or EccGlobalData.gConfig.IncludeFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking same header file name ...")
+ SqlCommand = """select ID, FullPath from File
+ where Model = 1002 order by Name """
+ RecordDict = {}
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ List = Record[1].replace('/', '\\').split('\\')
+ if len(List) >= 2:
+ Key = List[-2] + '\\' + List[-1]
+ else:
+ Key = List[0]
+ if Key not in RecordDict:
+ RecordDict[Key] = [Record]
+ else:
+ RecordDict[Key].append(Record)
+
+ for Key in RecordDict:
+ if len(RecordDict[Key]) > 1:
+ for Item in RecordDict[Key]:
+ Path = mws.relpath(Item[1], EccGlobalData.gWorkspace)
+ if not EccGlobalData.gException.IsException(ERROR_INCLUDE_FILE_CHECK_NAME, Path):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_INCLUDE_FILE_CHECK_NAME, OtherMsg="The file name for [%s] is duplicate" % Path, BelongsToTable='File', BelongsToItem=Item[0])
+
+ # Check whether all include file contents is guarded by a #ifndef statement.
+ def IncludeFileCheckIfndef(self):
+ if EccGlobalData.gConfig.IncludeFileCheckIfndefStatement == '1' or EccGlobalData.gConfig.IncludeFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking header file ifndef ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.h'):
+# FullName = os.path.join(Dirpath, F)
+# MsgList = c.CheckHeaderFileIfndef(FullName)
+ for FullName in EccGlobalData.gHFileList:
+ MsgList = c.CheckHeaderFileIfndef(FullName)
+
+ # Check whether include files NOT contain code or define data variables
+ def IncludeFileCheckData(self):
+ if EccGlobalData.gConfig.IncludeFileCheckData == '1' or EccGlobalData.gConfig.IncludeFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking header file data ...")
+
+ # Get all typedef functions
+ gAllTypedefFun = []
+ for IdentifierTable in EccGlobalData.gIdentifierTableList:
+ SqlCommand = """select Name from %s
+ where Model = %s """ % (IdentifierTable, MODEL_IDENTIFIER_TYPEDEF)
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ if Record[0].startswith('('):
+ gAllTypedefFun.append(Record[0])
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.h'):
+# FullName = os.path.join(Dirpath, F)
+# MsgList = c.CheckHeaderFileData(FullName)
+ for FullName in EccGlobalData.gHFileList:
+ MsgList = c.CheckHeaderFileData(FullName, gAllTypedefFun)
+
+ # Doxygen document checking
+ def DoxygenCheck(self):
+ self.DoxygenCheckFileHeader()
+ self.DoxygenCheckFunctionHeader()
+ self.DoxygenCheckCommentDescription()
+ self.DoxygenCheckCommentFormat()
+ self.DoxygenCheckCommand()
+
+ # Check whether the file headers are followed Doxygen special documentation blocks in section 2.3.5
+ def DoxygenCheckFileHeader(self):
+ if EccGlobalData.gConfig.DoxygenCheckFileHeader == '1' or EccGlobalData.gConfig.DoxygenCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking Doxygen file header ...")
+
+ for Dirpath, Dirnames, Filenames in self.WalkTree():
+ for F in Filenames:
+ Ext = os.path.splitext(F)[1]
+ if Ext in ('.h', '.c'):
+ FullName = os.path.join(Dirpath, F)
+ MsgList = c.CheckFileHeaderDoxygenComments(FullName)
+ elif Ext in ('.inf', '.dec', '.dsc', '.fdf'):
+ FullName = os.path.join(Dirpath, F)
+ op = open(FullName).readlines()
+ FileLinesList = op
+ LineNo = 0
+ CurrentSection = MODEL_UNKNOWN
+ HeaderSectionLines = []
+ HeaderCommentStart = False
+ HeaderCommentEnd = False
+
+ for Line in FileLinesList:
+ LineNo = LineNo + 1
+ Line = Line.strip()
+ if (LineNo < len(FileLinesList) - 1):
+ NextLine = FileLinesList[LineNo].strip()
+
+ #
+ # blank line
+ #
+ if (Line == '' or not Line) and LineNo == len(FileLinesList):
+ LastSectionFalg = True
+
+ #
+ # check whether file header comment section started
+ #
+ if Line.startswith('#') and \
+ (Line.find('@file') > -1) and \
+ not HeaderCommentStart:
+ if CurrentSection != MODEL_UNKNOWN:
+ SqlStatement = """ select ID from File where FullPath like '%s'""" % FullName
+ ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ Msg = 'INF/DEC/DSC/FDF file header comment should begin with ""## @file"" or ""# @file""at the very top file'
+ EccGlobalData.gDb.TblReport.Insert(ERROR_DOXYGEN_CHECK_FILE_HEADER, Msg, "File", Result[0])
+
+ else:
+ CurrentSection = MODEL_IDENTIFIER_FILE_HEADER
+ #
+ # Append the first line to section lines.
+ #
+ HeaderSectionLines.append((Line, LineNo))
+ HeaderCommentStart = True
+ continue
+
+ #
+ # Collect Header content.
+ #
+ if (Line.startswith('#') and CurrentSection == MODEL_IDENTIFIER_FILE_HEADER) and\
+ HeaderCommentStart and not Line.startswith('##') and not\
+ HeaderCommentEnd and NextLine != '':
+ HeaderSectionLines.append((Line, LineNo))
+ continue
+ #
+ # Header content end
+ #
+ if (Line.startswith('##') or not Line.strip().startswith("#")) and HeaderCommentStart \
+ and not HeaderCommentEnd:
+ if Line.startswith('##'):
+ HeaderCommentEnd = True
+ HeaderSectionLines.append((Line, LineNo))
+ ParseHeaderCommentSection(HeaderSectionLines, FullName)
+ break
+ if HeaderCommentStart == False:
+ SqlStatement = """ select ID from File where FullPath like '%s'""" % FullName
+ ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ Msg = 'INF/DEC/DSC/FDF file header comment should begin with ""## @file"" or ""# @file"" at the very top file'
+ EccGlobalData.gDb.TblReport.Insert(ERROR_DOXYGEN_CHECK_FILE_HEADER, Msg, "File", Result[0])
+ if HeaderCommentEnd == False:
+ SqlStatement = """ select ID from File where FullPath like '%s'""" % FullName
+ ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ Msg = 'INF/DEC/DSC/FDF file header comment should end with ""##"" at the end of file header comment block'
+ # Check whether File header Comment End with '##'
+ if EccGlobalData.gConfig.HeaderCheckFileCommentEnd == '1' or EccGlobalData.gConfig.HeaderCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EccGlobalData.gDb.TblReport.Insert(ERROR_DOXYGEN_CHECK_FILE_HEADER, Msg, "File", Result[0])
+
+
+
+ # Check whether the function headers are followed Doxygen special documentation blocks in section 2.3.5
+ def DoxygenCheckFunctionHeader(self):
+ if EccGlobalData.gConfig.DoxygenCheckFunctionHeader == '1' or EccGlobalData.gConfig.DoxygenCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking Doxygen function header ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.h', '.c'):
+# FullName = os.path.join(Dirpath, F)
+# MsgList = c.CheckFuncHeaderDoxygenComments(FullName)
+ for FullName in EccGlobalData.gCFileList + EccGlobalData.gHFileList:
+ MsgList = c.CheckFuncHeaderDoxygenComments(FullName)
+
+
+ # Check whether the first line of text in a comment block is a brief description of the element being documented.
+ # The brief description must end with a period.
+ def DoxygenCheckCommentDescription(self):
+ if EccGlobalData.gConfig.DoxygenCheckCommentDescription == '1' or EccGlobalData.gConfig.DoxygenCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ pass
+
+ # Check whether comment lines with '///< ... text ...' format, if it is used, it should be after the code section.
+ def DoxygenCheckCommentFormat(self):
+ if EccGlobalData.gConfig.DoxygenCheckCommentFormat == '1' or EccGlobalData.gConfig.DoxygenCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking Doxygen comment ///< ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.h', '.c'):
+# FullName = os.path.join(Dirpath, F)
+# MsgList = c.CheckDoxygenTripleForwardSlash(FullName)
+ for FullName in EccGlobalData.gCFileList + EccGlobalData.gHFileList:
+ MsgList = c.CheckDoxygenTripleForwardSlash(FullName)
+
+ # Check whether only Doxygen commands allowed to mark the code are @bug and @todo.
+ def DoxygenCheckCommand(self):
+ if EccGlobalData.gConfig.DoxygenCheckCommand == '1' or EccGlobalData.gConfig.DoxygenCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking Doxygen command ...")
+
+# for Dirpath, Dirnames, Filenames in self.WalkTree():
+# for F in Filenames:
+# if os.path.splitext(F)[1] in ('.h', '.c'):
+# FullName = os.path.join(Dirpath, F)
+# MsgList = c.CheckDoxygenCommand(FullName)
+ for FullName in EccGlobalData.gCFileList + EccGlobalData.gHFileList:
+ MsgList = c.CheckDoxygenCommand(FullName)
+
+ # Meta-Data File Processing Checking
+ def MetaDataFileCheck(self):
+ self.MetaDataFileCheckPathName()
+ self.MetaDataFileCheckGenerateFileList()
+ self.MetaDataFileCheckLibraryInstance()
+ self.MetaDataFileCheckLibraryInstanceDependent()
+ self.MetaDataFileCheckLibraryInstanceOrder()
+ self.MetaDataFileCheckLibraryNoUse()
+ self.MetaDataFileCheckLibraryDefinedInDec()
+ self.MetaDataFileCheckBinaryInfInFdf()
+ self.MetaDataFileCheckPcdDuplicate()
+ self.MetaDataFileCheckPcdFlash()
+ self.MetaDataFileCheckPcdNoUse()
+ self.MetaDataFileCheckGuidDuplicate()
+ self.MetaDataFileCheckModuleFileNoUse()
+ self.MetaDataFileCheckPcdType()
+ self.MetaDataFileCheckModuleFileGuidDuplication()
+ self.MetaDataFileCheckModuleFileGuidFormat()
+ self.MetaDataFileCheckModuleFileProtocolFormat()
+ self.MetaDataFileCheckModuleFilePpiFormat()
+ self.MetaDataFileCheckModuleFilePcdFormat()
+
+ # Check whether each file defined in meta-data exists
+ def MetaDataFileCheckPathName(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckPathName == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ # This item is covered when parsing Inf/Dec/Dsc files
+ pass
+
+ # Generate a list for all files defined in meta-data files
+ def MetaDataFileCheckGenerateFileList(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckGenerateFileList == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ # This item is covered when parsing Inf/Dec/Dsc files
+ pass
+
+ # Check whether all Library Instances defined for a given module (or dependent library instance) match the module's type.
+ # Each Library Instance must specify the Supported Module Types in its Inf file,
+ # and any module specifying the library instance must be one of the supported types.
+ def MetaDataFileCheckLibraryInstance(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckLibraryInstance == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking for library instance type issue ...")
+ SqlCommand = """select A.ID, A.Value3, B.Value3 from Inf as A left join Inf as B
+ where A.Value2 = 'LIBRARY_CLASS' and A.Model = %s
+ and B.Value2 = 'MODULE_TYPE' and B.Model = %s and A.BelongsToFile = B.BelongsToFile
+ group by A.BelongsToFile""" % (MODEL_META_DATA_HEADER, MODEL_META_DATA_HEADER)
+ RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
+ LibraryClasses = {}
+ for Record in RecordSet:
+ List = Record[1].split('|', 1)
+ SupModType = []
+ if len(List) == 1:
+ SupModType = DT.SUP_MODULE_LIST_STRING.split(DT.TAB_VALUE_SPLIT)
+ elif len(List) == 2:
+ SupModType = List[1].split()
+
+ if List[0] not in LibraryClasses:
+ LibraryClasses[List[0]] = SupModType
+ else:
+ for Item in SupModType:
+ if Item not in LibraryClasses[List[0]]:
+ LibraryClasses[List[0]].append(Item)
+
+ if Record[2] != DT.SUP_MODULE_BASE and Record[2] not in SupModType:
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2, OtherMsg="The Library Class '%s' does not specify its supported module types" % (List[0]), BelongsToTable='Inf', BelongsToItem=Record[0])
+
+ SqlCommand = """select A.ID, A.Value1, B.Value3 from Inf as A left join Inf as B
+ where A.Model = %s and B.Value2 = '%s' and B.Model = %s
+ and B.BelongsToFile = A.BelongsToFile""" \
+ % (MODEL_EFI_LIBRARY_CLASS, 'MODULE_TYPE', MODEL_META_DATA_HEADER)
+ RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
+ # Merge all LibraryClasses' supmodlist
+ RecordDict = {}
+ for Record in RecordSet:
+ if Record[1] not in RecordDict:
+ RecordDict[Record[1]] = [str(Record[2])]
+ else:
+ if Record[2] not in RecordDict[Record[1]]:
+ RecordDict[Record[1]].append(Record[2])
+
+ for Record in RecordSet:
+ if Record[1] in LibraryClasses:
+ if Record[2] not in LibraryClasses[Record[1]] and DT.SUP_MODULE_BASE not in RecordDict[Record[1]]:
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg="The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
+ else:
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg="The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
+
+ # Check whether a Library Instance has been defined for all dependent library classes
+ def MetaDataFileCheckLibraryInstanceDependent(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckLibraryInstanceDependent == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking for library instance dependent issue ...")
+ SqlCommand = """select ID, Value1, Value2 from Dsc where Model = %s""" % MODEL_EFI_LIBRARY_CLASS
+ LibraryClasses = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
+ for LibraryClass in LibraryClasses:
+ if LibraryClass[1].upper() == 'NULL' or LibraryClass[1].startswith('!ifdef') or LibraryClass[1].startswith('!ifndef') or LibraryClass[1].endswith('!endif'):
+ continue
+ else:
+ LibraryIns = os.path.normpath(mws.join(EccGlobalData.gWorkspace, LibraryClass[2]))
+ SkipDirString = '|'.join(EccGlobalData.gConfig.SkipDirList)
+ p = re.compile(r'.*[\\/](?:%s^\S)[\\/]?.*' % SkipDirString)
+ if p.match(os.path.split(LibraryIns)[0].upper()):
+ continue
+ SqlCommand = """select Value3 from Inf where BelongsToFile =
+ (select ID from File where lower(FullPath) = lower('%s'))
+ and Value2 = '%s'""" % (LibraryIns, DT.PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS)
+ RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
+ IsFound = False
+ for Record in RecordSet:
+ LibName = Record[0].split('|', 1)[0]
+ if LibraryClass[1] == LibName:
+ IsFound = True
+ if not IsFound:
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, LibraryClass[1]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, OtherMsg="The Library Class [%s] is not specified in '%s'" % (LibraryClass[1], LibraryClass[2]), BelongsToTable='Dsc', BelongsToItem=LibraryClass[0])
+
+ # Check whether the Library Instances specified by the LibraryClasses sections are listed in order of dependencies
+ def MetaDataFileCheckLibraryInstanceOrder(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckLibraryInstanceOrder == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ # This checkpoint is not necessary for Ecc check
+ pass
+
+ # Check whether the unnecessary inclusion of library classes in the Inf file
+ # Check whether the unnecessary duplication of library classe names in the DSC file
+ def MetaDataFileCheckLibraryNoUse(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckLibraryNoUse == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking for library instance not used ...")
+ SqlCommand = """select ID, Value1 from Inf as A where A.Model = %s and A.Value1 not in (select B.Value1 from Dsc as B where Model = %s)""" % (MODEL_EFI_LIBRARY_CLASS, MODEL_EFI_LIBRARY_CLASS)
+ RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
+ for Record in RecordSet:
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, Record[1]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, OtherMsg="The Library Class [%s] is not used in any platform" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
+ SqlCommand = """
+ select A.ID, A.Value1, A.BelongsToFile, A.StartLine, B.StartLine from Dsc as A left join Dsc as B
+ where A.Model = %s and B.Model = %s and A.Scope1 = B.Scope1 and A.Scope2 = B.Scope2 and A.ID != B.ID
+ and A.Value1 = B.Value1 and A.Value2 != B.Value2 and A.BelongsToItem = -1 and B.BelongsToItem = -1 and A.StartLine != B.StartLine and B.BelongsToFile = A.BelongsToFile""" \
+ % (MODEL_EFI_LIBRARY_CLASS, MODEL_EFI_LIBRARY_CLASS)
+ RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
+ for Record in RecordSet:
+ if Record[3] and Record[4] and Record[3] != Record[4] and Record[1] != 'NULL':
+ SqlCommand = """select FullPath from File where ID = %s""" % (Record[2])
+ FilePathList = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for FilePath in FilePathList:
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_NAME_DUPLICATE, Record[1]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NAME_DUPLICATE, OtherMsg="The Library Class [%s] is duplicated in '%s' line %s and line %s." % (Record[1], FilePath, Record[3], Record[4]), BelongsToTable='Dsc', BelongsToItem=Record[0])
+
+ # Check the header file in Include\Library directory whether be defined in the package DEC file.
+ def MetaDataFileCheckLibraryDefinedInDec(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckLibraryDefinedInDec == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking for library instance whether be defined in the package dec file ...")
+ SqlCommand = """
+ select A.Value1, A.StartLine, A.ID, B.Value1 from Inf as A left join Dec as B
+ on A.Model = B.Model and A.Value1 = B.Value1 where A.Model=%s
+ """ % MODEL_EFI_LIBRARY_CLASS
+ RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
+ for Record in RecordSet:
+ LibraryInInf, Line, ID, LibraryDec = Record
+ if not LibraryDec:
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED, LibraryInInf):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED, \
+ OtherMsg="The Library Class [%s] in %s line is not defined in the associated package file." % (LibraryInInf, Line),
+ BelongsToTable='Inf', BelongsToItem=ID)
+
+ # Check whether an Inf file is specified in the FDF file, but not in the Dsc file, then the Inf file must be for a Binary module only
+ def MetaDataFileCheckBinaryInfInFdf(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckBinaryInfInFdf == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking for non-binary modules defined in FDF files ...")
+ SqlCommand = """select A.ID, A.Value1 from Fdf as A
+ where A.Model = %s
+ and A.Enabled > -1
+ and A.Value1 not in
+ (select B.Value1 from Dsc as B
+ where B.Model = %s
+ and B.Enabled > -1)""" % (MODEL_META_DATA_COMPONENT, MODEL_META_DATA_COMPONENT)
+ RecordSet = EccGlobalData.gDb.TblFdf.Exec(SqlCommand)
+ for Record in RecordSet:
+ FdfID = Record[0]
+ FilePath = Record[1]
+ FilePath = os.path.normpath(mws.join(EccGlobalData.gWorkspace, FilePath))
+ SqlCommand = """select ID from Inf where Model = %s and BelongsToFile = (select ID from File where FullPath like '%s')
+ """ % (MODEL_EFI_SOURCE_FILE, FilePath)
+ NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ if NewRecordSet != []:
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF, FilePath):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF, OtherMsg="File [%s] defined in FDF file and not in DSC file must be a binary module" % (FilePath), BelongsToTable='Fdf', BelongsToItem=FdfID)
+
+ # Check whether a PCD is set in a Dsc file or the FDF file, but not in both.
+ def MetaDataFileCheckPcdDuplicate(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckPcdDuplicate == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking for duplicate PCDs defined in both DSC and FDF files ...")
+ SqlCommand = """
+ select A.ID, A.Value1, A.Value2, A.BelongsToFile, B.ID, B.Value1, B.Value2, B.BelongsToFile from Dsc as A, Fdf as B
+ where A.Model >= %s and A.Model < %s
+ and B.Model >= %s and B.Model < %s
+ and A.Value1 = B.Value1
+ and A.Value2 = B.Value2
+ and A.Enabled > -1
+ and B.Enabled > -1
+ group by A.ID
+ """ % (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER)
+ RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
+ for Record in RecordSet:
+ SqlCommand1 = """select Name from File where ID = %s""" % Record[3]
+ SqlCommand2 = """select Name from File where ID = %s""" % Record[7]
+ DscFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand1)[0][0])[0]
+ FdfFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand2)[0][0])[0]
+ if DscFileName != FdfFileName:
+ continue
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1] + '.' + Record[2]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined in both FDF file and DSC file" % (Record[1] + '.' + Record[2]), BelongsToTable='Dsc', BelongsToItem=Record[0])
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[5] + '.' + Record[6]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined in both FDF file and DSC file" % (Record[5] + '.' + Record[6]), BelongsToTable='Fdf', BelongsToItem=Record[4])
+
+ EdkLogger.quiet("Checking for duplicate PCDs defined in DEC files ...")
+ SqlCommand = """
+ select A.ID, A.Value1, A.Value2, A.Model, B.Model from Dec as A left join Dec as B
+ where A.Model >= %s and A.Model < %s
+ and B.Model >= %s and B.Model < %s
+ and A.Value1 = B.Value1
+ and A.Value2 = B.Value2
+ and A.Scope1 = B.Scope1
+ and A.ID != B.ID
+ and A.Model = B.Model
+ and A.Enabled > -1
+ and B.Enabled > -1
+ and A.BelongsToFile = B.BelongsToFile
+ group by A.ID
+ """ % (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER)
+ RecordSet = EccGlobalData.gDb.TblDec.Exec(SqlCommand)
+ for Record in RecordSet:
+ RecordCat = Record[1] + '.' + Record[2]
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, RecordCat):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined duplicated in DEC file" % RecordCat, BelongsToTable='Dec', BelongsToItem=Record[0])
+
+ # Check whether PCD settings in the FDF file can only be related to flash.
+ def MetaDataFileCheckPcdFlash(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckPcdFlash == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking only Flash related PCDs are used in FDF ...")
+ SqlCommand = """
+ select ID, Value1, Value2, BelongsToFile from Fdf as A
+ where A.Model >= %s and Model < %s
+ and A.Enabled > -1
+ and A.Value2 not like '%%Flash%%'
+ """ % (MODEL_PCD, MODEL_META_DATA_HEADER)
+ RecordSet = EccGlobalData.gDb.TblFdf.Exec(SqlCommand)
+ for Record in RecordSet:
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, Record[1] + '.' + Record[2]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, OtherMsg="The PCD [%s] defined in FDF file is not related to Flash" % (Record[1] + '.' + Record[2]), BelongsToTable='Fdf', BelongsToItem=Record[0])
+
+ # Check whether PCDs used in Inf files but not specified in Dsc or FDF files
+ def MetaDataFileCheckPcdNoUse(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckPcdNoUse == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking for non-specified PCDs ...")
+ SqlCommand = """
+ select ID, Value1, Value2, BelongsToFile from Inf as A
+ where A.Model >= %s and Model < %s
+ and A.Enabled > -1
+ and (A.Value1, A.Value2) not in
+ (select Value1, Value2 from Dsc as B
+ where B.Model >= %s and B.Model < %s
+ and B.Enabled > -1)
+ and (A.Value1, A.Value2) not in
+ (select Value1, Value2 from Fdf as C
+ where C.Model >= %s and C.Model < %s
+ and C.Enabled > -1)
+ """ % (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER)
+ RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
+ for Record in RecordSet:
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, Record[1] + '.' + Record[2]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, OtherMsg="The PCD [%s] defined in INF file is not specified in either DSC or FDF files" % (Record[1] + '.' + Record[2]), BelongsToTable='Inf', BelongsToItem=Record[0])
+
+ # Check whether having duplicate guids defined for Guid/Protocol/Ppi
+ def MetaDataFileCheckGuidDuplicate(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckGuidDuplicate == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking for duplicate GUID/PPI/PROTOCOL ...")
+ # Check Guid
+ self.CheckGuidProtocolPpi(ERROR_META_DATA_FILE_CHECK_DUPLICATE_GUID, MODEL_EFI_GUID, EccGlobalData.gDb.TblDec)
+ self.CheckGuidProtocolPpi(ERROR_META_DATA_FILE_CHECK_DUPLICATE_GUID, MODEL_EFI_GUID, EccGlobalData.gDb.TblDsc)
+ self.CheckGuidProtocolPpiValue(ERROR_META_DATA_FILE_CHECK_DUPLICATE_GUID, MODEL_EFI_GUID)
+ # Check protocol
+ self.CheckGuidProtocolPpi(ERROR_META_DATA_FILE_CHECK_DUPLICATE_PROTOCOL, MODEL_EFI_PROTOCOL, EccGlobalData.gDb.TblDec)
+ self.CheckGuidProtocolPpi(ERROR_META_DATA_FILE_CHECK_DUPLICATE_PROTOCOL, MODEL_EFI_PROTOCOL, EccGlobalData.gDb.TblDsc)
+ self.CheckGuidProtocolPpiValue(ERROR_META_DATA_FILE_CHECK_DUPLICATE_PROTOCOL, MODEL_EFI_PROTOCOL)
+ # Check ppi
+ self.CheckGuidProtocolPpi(ERROR_META_DATA_FILE_CHECK_DUPLICATE_PPI, MODEL_EFI_PPI, EccGlobalData.gDb.TblDec)
+ self.CheckGuidProtocolPpi(ERROR_META_DATA_FILE_CHECK_DUPLICATE_PPI, MODEL_EFI_PPI, EccGlobalData.gDb.TblDsc)
+ self.CheckGuidProtocolPpiValue(ERROR_META_DATA_FILE_CHECK_DUPLICATE_PPI, MODEL_EFI_PPI)
+
+ # Check whether all files under module directory are described in INF files
+ def MetaDataFileCheckModuleFileNoUse(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckModuleFileNoUse == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking for no used module files ...")
+ SqlCommand = """
+ select upper(Path) from File where ID in (select BelongsToFile from Inf where BelongsToFile != -1)
+ """
+ InfPathSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
+ InfPathList = []
+ for Item in InfPathSet:
+ if Item[0] not in InfPathList:
+ InfPathList.append(Item[0])
+ SqlCommand = """
+ select ID, Path, FullPath from File where upper(FullPath) not in
+ (select upper(A.Path) || '%s' || upper(B.Value1) from File as A, INF as B
+ where A.ID in (select BelongsToFile from INF where Model = %s group by BelongsToFile) and
+ B.BelongsToFile = A.ID and B.Model = %s)
+ and (Model = %s or Model = %s)
+ """ % (os.sep, MODEL_EFI_SOURCE_FILE, MODEL_EFI_SOURCE_FILE, MODEL_FILE_C, MODEL_FILE_H)
+ RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
+ for Record in RecordSet:
+ Path = Record[1]
+ Path = Path.upper().replace('\X64', '').replace('\IA32', '').replace('\EBC', '').replace('\IPF', '').replace('\ARM', '')
+ if Path in InfPathList:
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, Record[2]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, OtherMsg="The source file [%s] is existing in module directory but it is not described in INF file." % (Record[2]), BelongsToTable='File', BelongsToItem=Record[0])
+
+ # Check whether the PCD is correctly used in C function via its type
+ def MetaDataFileCheckPcdType(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckPcdType == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking for pcd type in c code function usage ...")
+ SqlCommand = """
+ select ID, Model, Value1, Value2, BelongsToFile from INF where Model > %s and Model < %s
+ """ % (MODEL_PCD, MODEL_META_DATA_HEADER)
+ PcdSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
+ for Pcd in PcdSet:
+ Model = Pcd[1]
+ PcdName = Pcd[2]
+ if Pcd[3]:
+ PcdName = Pcd[3]
+ BelongsToFile = Pcd[4]
+ SqlCommand = """
+ select ID from File where FullPath in
+ (select B.Path || '%s' || A.Value1 from INF as A, File as B where A.Model = %s and A.BelongsToFile = %s
+ and B.ID = %s and (B.Model = %s or B.Model = %s))
+ """ % (os.sep, MODEL_EFI_SOURCE_FILE, BelongsToFile, BelongsToFile, MODEL_FILE_C, MODEL_FILE_H)
+ TableSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Tbl in TableSet:
+ TblName = 'Identifier' + str(Tbl[0])
+ SqlCommand = """
+ select Name, ID from %s where value like '%s' and Model = %s
+ """ % (TblName, PcdName, MODEL_IDENTIFIER_FUNCTION_CALLING)
+ RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
+ TblNumber = TblName.replace('Identifier', '')
+ for Record in RecordSet:
+ FunName = Record[0]
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, FunName):
+ if Model in [MODEL_PCD_FIXED_AT_BUILD] and not FunName.startswith('FixedPcdGet'):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg="The pcd '%s' is defined as a FixPcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable=TblName, BelongsToItem=Record[1])
+ if Model in [MODEL_PCD_FEATURE_FLAG] and (not FunName.startswith('FeaturePcdGet') and not FunName.startswith('FeaturePcdSet')):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg="The pcd '%s' is defined as a FeaturePcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable=TblName, BelongsToItem=Record[1])
+ if Model in [MODEL_PCD_PATCHABLE_IN_MODULE] and (not FunName.startswith('PatchablePcdGet') and not FunName.startswith('PatchablePcdSet')):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg="The pcd '%s' is defined as a PatchablePcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable=TblName, BelongsToItem=Record[1])
+
+ #ERROR_META_DATA_FILE_CHECK_PCD_TYPE
+ pass
+
+ # Internal worker function to get the INF workspace relative path from FileID
+ def GetInfFilePathFromID(self, FileID):
+ Table = EccGlobalData.gDb.TblFile
+ SqlCommand = """select A.FullPath from %s as A where A.ID = %s""" % (Table.Table, FileID)
+ RecordSet = Table.Exec(SqlCommand)
+ Path = ""
+ for Record in RecordSet:
+ Path = mws.relpath(Record[0], EccGlobalData.gWorkspace)
+ return Path
+
+ # Check whether two module INFs under one workspace has the same FILE_GUID value
+ def MetaDataFileCheckModuleFileGuidDuplication(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidDuplication == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking for pcd type in c code function usage ...")
+ Table = EccGlobalData.gDb.TblInf
+ SqlCommand = """
+ select A.ID, A.Value3, A.BelongsToFile, B.BelongsToFile from %s as A, %s as B
+ where A.Value2 = 'FILE_GUID' and B.Value2 = 'FILE_GUID' and
+ A.Value3 = B.Value3 and A.ID != B.ID group by A.ID
+ """ % (Table.Table, Table.Table)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+ InfPath1 = self.GetInfFilePathFromID(Record[2])
+ InfPath2 = self.GetInfFilePathFromID(Record[3])
+ if InfPath1 and InfPath2:
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, InfPath1):
+ Msg = "The FILE_GUID of INF file [%s] is duplicated with that of %s" % (InfPath1, InfPath2)
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+
+
+ # Check Guid Format in module INF
+ def MetaDataFileCheckModuleFileGuidFormat(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Check Guid Format in module INF ...")
+ Table = EccGlobalData.gDb.TblInf
+ SqlCommand = """
+ select ID, Value1, Usage, BelongsToFile from %s where Model = %s group by ID
+ """ % (Table.Table, MODEL_EFI_GUID)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+ Value1 = Record[1]
+ Value2 = Record[2]
+ GuidCommentList = []
+ InfPath = self.GetInfFilePathFromID(Record[3])
+ Msg = "The GUID format of %s in INF file [%s] does not follow rules" % (Value1, InfPath)
+ if Value2.startswith(DT.TAB_SPECIAL_COMMENT):
+ GuidCommentList = Value2[2:].split(DT.TAB_SPECIAL_COMMENT)
+ if GuidCommentList[0].strip().startswith(DT.TAB_INF_USAGE_UNDEFINED):
+ continue
+ elif len(GuidCommentList) > 1:
+ if not GuidCommentList[0].strip().startswith((DT.TAB_INF_USAGE_PRO,
+ DT.TAB_INF_USAGE_SOME_PRO,
+ DT.TAB_INF_USAGE_CON,
+ DT.TAB_INF_USAGE_SOME_CON)):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_GUID, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ if not (GuidCommentList[1].strip()).startswith(DT.TAB_INF_GUIDTYPE_VAR) and \
+ not GuidCommentList[1].strip().startswith((DT.TAB_INF_GUIDTYPE_EVENT,
+ DT.TAB_INF_GUIDTYPE_HII,
+ DT.TAB_INF_GUIDTYPE_FILE,
+ DT.TAB_INF_GUIDTYPE_HOB,
+ DT.TAB_INF_GUIDTYPE_FV,
+ DT.TAB_INF_GUIDTYPE_ST,
+ DT.TAB_INF_GUIDTYPE_TSG,
+ DT.TAB_INF_GUIDTYPE_GUID,
+ DT.TAB_INF_GUIDTYPE_PROTOCOL,
+ DT.TAB_INF_GUIDTYPE_PPI,
+ DT.TAB_INF_USAGE_UNDEFINED)):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_GUID, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ else:
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_GUID, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ else:
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_GUID, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+
+ # Check Protocol Format in module INF
+ def MetaDataFileCheckModuleFileProtocolFormat(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckModuleFileProtocolFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Check Protocol Format in module INF ...")
+ Table = EccGlobalData.gDb.TblInf
+ SqlCommand = """
+ select ID, Value1, Usage, BelongsToFile from %s where Model = %s group by ID
+ """ % (Table.Table, MODEL_EFI_PROTOCOL)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+ Value1 = Record[1]
+ Value2 = Record[2]
+ GuidCommentList = []
+ InfPath = self.GetInfFilePathFromID(Record[3])
+ Msg = "The Protocol format of %s in INF file [%s] does not follow rules" % (Value1, InfPath)
+ if Value2.startswith(DT.TAB_SPECIAL_COMMENT):
+ GuidCommentList = Value2[2:].split(DT.TAB_SPECIAL_COMMENT)
+ if len(GuidCommentList) >= 1:
+ if not GuidCommentList[0].strip().startswith((DT.TAB_INF_USAGE_PRO,
+ DT.TAB_INF_USAGE_SOME_PRO,
+ DT.TAB_INF_USAGE_CON,
+ DT.TAB_INF_USAGE_SOME_CON,
+ DT.TAB_INF_USAGE_NOTIFY,
+ DT.TAB_INF_USAGE_TO_START,
+ DT.TAB_INF_USAGE_BY_START,
+ DT.TAB_INF_USAGE_UNDEFINED)):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PROTOCOL, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ else:
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PROTOCOL, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+
+
+ # Check Ppi Format in module INF
+ def MetaDataFileCheckModuleFilePpiFormat(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePpiFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Check Ppi Format in module INF ...")
+ Table = EccGlobalData.gDb.TblInf
+ SqlCommand = """
+ select ID, Value1, Usage, BelongsToFile from %s where Model = %s group by ID
+ """ % (Table.Table, MODEL_EFI_PPI)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+ Value1 = Record[1]
+ Value2 = Record[2]
+ GuidCommentList = []
+ InfPath = self.GetInfFilePathFromID(Record[3])
+ Msg = "The Ppi format of %s in INF file [%s] does not follow rules" % (Value1, InfPath)
+ if Value2.startswith(DT.TAB_SPECIAL_COMMENT):
+ GuidCommentList = Value2[2:].split(DT.TAB_SPECIAL_COMMENT)
+ if len(GuidCommentList) >= 1:
+ if not GuidCommentList[0].strip().startswith((DT.TAB_INF_USAGE_PRO,
+ DT.TAB_INF_USAGE_SOME_PRO,
+ DT.TAB_INF_USAGE_CON,
+ DT.TAB_INF_USAGE_SOME_CON,
+ DT.TAB_INF_USAGE_NOTIFY,
+ DT.TAB_INF_USAGE_UNDEFINED)):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PPI, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ else:
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PPI, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+
+ # Check Pcd Format in module INF
+ def MetaDataFileCheckModuleFilePcdFormat(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePcdFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Check Pcd Format in module INF ...")
+ Table = EccGlobalData.gDb.TblInf
+ SqlCommand = """
+ select ID, Model, Value1, Value2, Usage, BelongsToFile from %s where Model >= %s and Model < %s group by ID
+ """ % (Table.Table, MODEL_PCD, MODEL_META_DATA_HEADER)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+ Model = Record[1]
+ PcdName = Record[2] + '.' + Record[3]
+ Usage = Record[4]
+ PcdCommentList = []
+ InfPath = self.GetInfFilePathFromID(Record[5])
+ Msg = "The Pcd format of %s in INF file [%s] does not follow rules" % (PcdName, InfPath)
+ if Usage.startswith(DT.TAB_SPECIAL_COMMENT):
+ PcdCommentList = Usage[2:].split(DT.TAB_SPECIAL_COMMENT)
+ if len(PcdCommentList) >= 1:
+ if Model in [MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_FEATURE_FLAG] \
+ and not PcdCommentList[0].strip().startswith((DT.TAB_INF_USAGE_SOME_PRO,
+ DT.TAB_INF_USAGE_CON,
+ DT.TAB_INF_USAGE_UNDEFINED)):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PCD, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ if Model in [MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC, MODEL_PCD_DYNAMIC_EX] \
+ and not PcdCommentList[0].strip().startswith((DT.TAB_INF_USAGE_PRO,
+ DT.TAB_INF_USAGE_SOME_PRO,
+ DT.TAB_INF_USAGE_CON,
+ DT.TAB_INF_USAGE_SOME_CON,
+ DT.TAB_INF_USAGE_UNDEFINED)):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PCD, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ else:
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PCD, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+
+ # Check whether these is duplicate Guid/Ppi/Protocol name
+ def CheckGuidProtocolPpi(self, ErrorID, Model, Table):
+ Name = ''
+ if Model == MODEL_EFI_GUID:
+ Name = 'guid'
+ if Model == MODEL_EFI_PROTOCOL:
+ Name = 'protocol'
+ if Model == MODEL_EFI_PPI:
+ Name = 'ppi'
+ SqlCommand = """
+ select A.ID, A.Value1 from %s as A, %s as B
+ where A.Model = %s and B.Model = %s
+ and A.Value1 like B.Value1 and A.ID != B.ID
+ and A.Scope1 = B.Scope1
+ and A.Enabled > -1
+ and B.Enabled > -1
+ group by A.ID
+ """ % (Table.Table, Table.Table, Model, Model)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+ if not EccGlobalData.gException.IsException(ErrorID, Record[1]):
+ EccGlobalData.gDb.TblReport.Insert(ErrorID, OtherMsg="The %s name [%s] is defined more than one time" % (Name.upper(), Record[1]), BelongsToTable=Table.Table, BelongsToItem=Record[0])
+
+ # Check whether these is duplicate Guid/Ppi/Protocol value
+ def CheckGuidProtocolPpiValue(self, ErrorID, Model):
+ Name = ''
+ Table = EccGlobalData.gDb.TblDec
+ if Model == MODEL_EFI_GUID:
+ Name = 'guid'
+ if Model == MODEL_EFI_PROTOCOL:
+ Name = 'protocol'
+ if Model == MODEL_EFI_PPI:
+ Name = 'ppi'
+ SqlCommand = """
+ select A.ID, A.Value1, A.Value2 from %s as A, %s as B
+ where A.Model = %s and B.Model = %s
+ and A.Value2 like B.Value2 and A.ID != B.ID
+ and A.Scope1 = B.Scope1 and A.Value1 != B.Value1
+ group by A.ID
+ """ % (Table.Table, Table.Table, Model, Model)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+ if not EccGlobalData.gException.IsException(ErrorID, Record[2]):
+ EccGlobalData.gDb.TblReport.Insert(ErrorID, OtherMsg="The %s value [%s] is used more than one time" % (Name.upper(), Record[2]), BelongsToTable=Table.Table, BelongsToItem=Record[0])
+
+ # Naming Convention Check
+ def NamingConventionCheck(self):
+ if EccGlobalData.gConfig.NamingConventionCheckDefineStatement == '1' \
+ or EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' \
+ or EccGlobalData.gConfig.NamingConventionCheckIfndefStatement == '1' \
+ or EccGlobalData.gConfig.NamingConventionCheckVariableName == '1' \
+ or EccGlobalData.gConfig.NamingConventionCheckSingleCharacterVariable == '1' \
+ or EccGlobalData.gConfig.NamingConventionCheckAll == '1'\
+ or EccGlobalData.gConfig.CheckAll == '1':
+ for Dirpath, Dirnames, Filenames in self.WalkTree():
+ for F in Filenames:
+ if os.path.splitext(F)[1] in ('.h', '.c'):
+ FullName = os.path.join(Dirpath, F)
+ Id = c.GetTableID(FullName)
+ if Id < 0:
+ continue
+ FileTable = 'Identifier' + str(Id)
+ self.NamingConventionCheckDefineStatement(FileTable)
+ self.NamingConventionCheckTypedefStatement(FileTable)
+ self.NamingConventionCheckVariableName(FileTable)
+ self.NamingConventionCheckSingleCharacterVariable(FileTable)
+ if os.path.splitext(F)[1] in ('.h'):
+ self.NamingConventionCheckIfndefStatement(FileTable)
+
+ self.NamingConventionCheckPathName()
+ self.NamingConventionCheckFunctionName()
+
+ # Check whether only capital letters are used for #define declarations
+ def NamingConventionCheckDefineStatement(self, FileTable):
+ if EccGlobalData.gConfig.NamingConventionCheckDefineStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking naming convention of #define statement ...")
+
+ SqlCommand = """select ID, Value from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_MACRO_DEFINE)
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ Name = Record[1].strip().split()[1]
+ if Name.find('(') != -1:
+ Name = Name[0:Name.find('(')]
+ if Name.upper() != Name:
+ if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT, Name):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT, OtherMsg="The #define name [%s] does not follow the rules" % (Name), BelongsToTable=FileTable, BelongsToItem=Record[0])
+
+ # Check whether only capital letters are used for typedef declarations
+ def NamingConventionCheckTypedefStatement(self, FileTable):
+ if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking naming convention of #typedef statement ...")
+
+ SqlCommand = """select ID, Name from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_TYPEDEF)
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ Name = Record[1].strip()
+ if Name != '' and Name is not None:
+ if Name[0] == '(':
+ Name = Name[1:Name.find(')')]
+ if Name.find('(') > -1:
+ Name = Name[Name.find('(') + 1 : Name.find(')')]
+ Name = Name.replace('WINAPI', '')
+ Name = Name.replace('*', '').strip()
+ if Name.upper() != Name:
+ if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, Name):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, OtherMsg="The #typedef name [%s] does not follow the rules" % (Name), BelongsToTable=FileTable, BelongsToItem=Record[0])
+
+ # Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'.
+ def NamingConventionCheckIfndefStatement(self, FileTable):
+ if EccGlobalData.gConfig.NamingConventionCheckIfndefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking naming convention of #ifndef statement ...")
+
+ SqlCommand = """select ID, Value from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF)
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ Name = Record[1].replace('#ifndef', '').strip()
+ if Name[-1] != '_':
+ if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT, Name):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT, OtherMsg="The #ifndef name [%s] does not follow the rules" % (Name), BelongsToTable=FileTable, BelongsToItem=Record[0])
+
+ # Rule for path name, variable name and function name
+ # 1. First character should be upper case
+ # 2. Existing lower case in a word
+ # 3. No space existence
+ # Check whether the path name followed the rule
+ def NamingConventionCheckPathName(self):
+ if EccGlobalData.gConfig.NamingConventionCheckPathName == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking naming convention of file path name ...")
+ Pattern = re.compile(r'^[A-Z]+\S*[a-z]\S*$')
+ SqlCommand = """select ID, Name from File"""
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ if not Pattern.match(Record[1]):
+ if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_PATH_NAME, Record[1]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_PATH_NAME, OtherMsg="The file path [%s] does not follow the rules" % (Record[1]), BelongsToTable='File', BelongsToItem=Record[0])
+
+ # Rule for path name, variable name and function name
+ # 1. First character should be upper case
+ # 2. Existing lower case in a word
+ # 3. No space existence
+ # 4. Global variable name must start with a 'g'
+ # Check whether the variable name followed the rule
+ def NamingConventionCheckVariableName(self, FileTable):
+ if EccGlobalData.gConfig.NamingConventionCheckVariableName == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking naming convention of variable name ...")
+ Pattern = re.compile(r'^[A-Zgm]+\S*[a-z]\S*$')
+
+ SqlCommand = """select ID, Name, Modifier from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_VARIABLE)
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ Var = Record[1]
+ Modifier = Record[2]
+ if Var.startswith('CONST'):
+ Var = Var[5:].lstrip()
+ if not Pattern.match(Var) and not (Modifier.endswith('*') and Var.startswith('p')):
+ if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Record[1]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable=FileTable, BelongsToItem=Record[0])
+
+ # Rule for path name, variable name and function name
+ # 1. First character should be upper case
+ # 2. Existing lower case in a word
+ # 3. No space existence
+ # Check whether the function name followed the rule
+ def NamingConventionCheckFunctionName(self):
+ if EccGlobalData.gConfig.NamingConventionCheckFunctionName == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking naming convention of function name ...")
+ Pattern = re.compile(r'^[A-Z]+\S*[a-z]\S*$')
+ SqlCommand = """select ID, Name from Function"""
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ if not Pattern.match(Record[1]):
+ if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME, Record[1]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME, OtherMsg="The function name [%s] does not follow the rules" % (Record[1]), BelongsToTable='Function', BelongsToItem=Record[0])
+
+ # Check whether NO use short variable name with single character
+ def NamingConventionCheckSingleCharacterVariable(self, FileTable):
+ if EccGlobalData.gConfig.NamingConventionCheckSingleCharacterVariable == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking naming convention of single character variable name ...")
+
+ SqlCommand = """select ID, Name from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_VARIABLE)
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ Variable = Record[1].replace('*', '')
+ if len(Variable) == 1:
+ if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, Record[1]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable=FileTable, BelongsToItem=Record[0])
+
+def FindPara(FilePath, Para, CallingLine):
+ Lines = open(FilePath).readlines()
+ Line = ''
+ for Index in range(CallingLine - 1, 0, -1):
+ # Find the nearest statement for Para
+ Line = Lines[Index].strip()
+ if Line.startswith('%s = ' % Para):
+ Line = Line.strip()
+ return Line
+ break
+
+ return ''
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ Check = Check()
+ Check.Check()
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/CodeFragment.py b/roms/edk2/BaseTools/Source/Python/Ecc/CodeFragment.py
new file mode 100644
index 000000000..8ced51f25
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/CodeFragment.py
@@ -0,0 +1,159 @@
+## @file
+# fragments of source file
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+
+## The description of comment contents and start & end position
+#
+#
+class Comment :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ # @param CommentType The type of comment (T_COMMENT_TWO_SLASH or T_COMMENT_SLASH_STAR).
+ #
+ def __init__(self, Str, Begin, End, CommentType):
+ self.Content = Str
+ self.StartPos = Begin
+ self.EndPos = End
+ self.Type = CommentType
+
+## The description of preprocess directives and start & end position
+#
+#
+class PP_Directive :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, Str, Begin, End):
+ self.Content = Str
+ self.StartPos = Begin
+ self.EndPos = End
+
+## The description of predicate expression and start & end position
+#
+#
+class PredicateExpression :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, Str, Begin, End):
+ self.Content = Str
+ self.StartPos = Begin
+ self.EndPos = End
+
+## The description of function definition and start & end position
+#
+#
+class FunctionDefinition :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ # @param LBPos The left brace position tuple.
+ #
+ def __init__(self, ModifierStr, DeclStr, Begin, End, LBPos, NamePos):
+ self.Modifier = ModifierStr
+ self.Declarator = DeclStr
+ self.StartPos = Begin
+ self.EndPos = End
+ self.LeftBracePos = LBPos
+ self.NamePos = NamePos
+
+## The description of variable declaration and start & end position
+#
+#
+class VariableDeclaration :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param NamePos The name position tuple.
+ #
+ def __init__(self, ModifierStr, DeclStr, Begin, NamePos):
+ self.Modifier = ModifierStr
+ self.Declarator = DeclStr
+ self.StartPos = Begin
+ self.NameStartPos = NamePos
+
+## The description of enum definition and start & end position
+#
+#
+class EnumerationDefinition :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, Str, Begin, End):
+ self.Content = Str
+ self.StartPos = Begin
+ self.EndPos = End
+
+## The description of struct/union definition and start & end position
+#
+#
+class StructUnionDefinition :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, Str, Begin, End):
+ self.Content = Str
+ self.StartPos = Begin
+ self.EndPos = End
+
+## The description of 'Typedef' definition and start & end position
+#
+#
+class TypedefDefinition :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, FromStr, ToStr, Begin, End):
+ self.FromType = FromStr
+ self.ToType = ToStr
+ self.StartPos = Begin
+ self.EndPos = End
+
+class FunctionCalling:
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, Name, Param, Begin, End):
+ self.FuncName = Name
+ self.ParamList = Param
+ self.StartPos = Begin
+ self.EndPos = End
+
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py b/roms/edk2/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
new file mode 100644
index 000000000..d8d6aff08
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
@@ -0,0 +1,595 @@
+## @file
+# preprocess source file
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+
+from __future__ import print_function
+from __future__ import absolute_import
+import re
+import Common.LongFilePathOs as os
+import sys
+if sys.version_info.major == 3:
+ import antlr4 as antlr
+ from Ecc.CParser4.CLexer import CLexer
+ from Ecc.CParser4.CParser import CParser
+else:
+ import antlr3 as antlr
+ antlr.InputStream = antlr.StringStream
+ from Ecc.CParser3.CLexer import CLexer
+ from Ecc.CParser3.CParser import CParser
+
+
+from Ecc import FileProfile
+from Ecc.CodeFragment import Comment
+from Ecc.CodeFragment import PP_Directive
+from Ecc.ParserWarning import Warning
+
+
+##define T_CHAR_SPACE ' '
+##define T_CHAR_NULL '\0'
+##define T_CHAR_CR '\r'
+##define T_CHAR_TAB '\t'
+##define T_CHAR_LF '\n'
+##define T_CHAR_SLASH '/'
+##define T_CHAR_BACKSLASH '\\'
+##define T_CHAR_DOUBLE_QUOTE '\"'
+##define T_CHAR_SINGLE_QUOTE '\''
+##define T_CHAR_STAR '*'
+##define T_CHAR_HASH '#'
+
+(T_CHAR_SPACE, T_CHAR_NULL, T_CHAR_CR, T_CHAR_TAB, T_CHAR_LF, T_CHAR_SLASH, \
+T_CHAR_BACKSLASH, T_CHAR_DOUBLE_QUOTE, T_CHAR_SINGLE_QUOTE, T_CHAR_STAR, T_CHAR_HASH) = \
+(' ', '\0', '\r', '\t', '\n', '/', '\\', '\"', '\'', '*', '#')
+
+SEPERATOR_TUPLE = ('=', '|', ',', '{', '}')
+
+(T_COMMENT_TWO_SLASH, T_COMMENT_SLASH_STAR) = (0, 1)
+
+(T_PP_INCLUDE, T_PP_DEFINE, T_PP_OTHERS) = (0, 1, 2)
+
+## The collector for source code fragments.
+#
+# PreprocessFile method should be called prior to ParseFile
+#
+# GetNext*** procedures mean these procedures will get next token first, then make judgement.
+# Get*** procedures mean these procedures will make judgement on current token only.
+#
+class CodeFragmentCollector:
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param FileName The file that to be parsed
+ #
+ def __init__(self, FileName):
+ self.Profile = FileProfile.FileProfile(FileName)
+ self.Profile.FileLinesList.append(T_CHAR_LF)
+ self.FileName = FileName
+ self.CurrentLineNumber = 1
+ self.CurrentOffsetWithinLine = 0
+ self.TokenReleaceList = []
+ self.__Token = ""
+ self.__SkippedChars = ""
+
+ ## __EndOfFile() method
+ #
+ # Judge current buffer pos is at file end
+ #
+ # @param self The object pointer
+ # @retval True Current File buffer position is at file end
+ # @retval False Current File buffer position is NOT at file end
+ #
+ def __EndOfFile(self):
+ NumberOfLines = len(self.Profile.FileLinesList)
+ SizeOfLastLine = NumberOfLines
+ if NumberOfLines > 0:
+ SizeOfLastLine = len(self.Profile.FileLinesList[-1])
+
+ if self.CurrentLineNumber == NumberOfLines and self.CurrentOffsetWithinLine >= SizeOfLastLine - 1:
+ return True
+ elif self.CurrentLineNumber > NumberOfLines:
+ return True
+ else:
+ return False
+
+ ## __EndOfLine() method
+ #
+ # Judge current buffer pos is at line end
+ #
+ # @param self The object pointer
+ # @retval True Current File buffer position is at line end
+ # @retval False Current File buffer position is NOT at line end
+ #
+ def __EndOfLine(self):
+ SizeOfCurrentLine = len(self.Profile.FileLinesList[self.CurrentLineNumber - 1])
+ if self.CurrentOffsetWithinLine >= SizeOfCurrentLine - 1:
+ return True
+ else:
+ return False
+
+ ## Rewind() method
+ #
+ # Reset file data buffer to the initial state
+ #
+ # @param self The object pointer
+ #
+ def Rewind(self):
+ self.CurrentLineNumber = 1
+ self.CurrentOffsetWithinLine = 0
+
+ ## __UndoOneChar() method
+ #
+ # Go back one char in the file buffer
+ #
+ # @param self The object pointer
+ # @retval True Successfully go back one char
+ # @retval False Not able to go back one char as file beginning reached
+ #
+ def __UndoOneChar(self):
+
+ if self.CurrentLineNumber == 1 and self.CurrentOffsetWithinLine == 0:
+ return False
+ elif self.CurrentOffsetWithinLine == 0:
+ self.CurrentLineNumber -= 1
+ self.CurrentOffsetWithinLine = len(self.__CurrentLine()) - 1
+ else:
+ self.CurrentOffsetWithinLine -= 1
+ return True
+
+ ## __GetOneChar() method
+ #
+ # Move forward one char in the file buffer
+ #
+ # @param self The object pointer
+ #
+ def __GetOneChar(self):
+ if self.CurrentOffsetWithinLine == len(self.Profile.FileLinesList[self.CurrentLineNumber - 1]) - 1:
+ self.CurrentLineNumber += 1
+ self.CurrentOffsetWithinLine = 0
+ else:
+ self.CurrentOffsetWithinLine += 1
+
+ ## __CurrentChar() method
+ #
+ # Get the char pointed to by the file buffer pointer
+ #
+ # @param self The object pointer
+ # @retval Char Current char
+ #
+ def __CurrentChar(self):
+ CurrentChar = self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine]
+# if CurrentChar > 255:
+# raise Warning("Non-Ascii char found At Line %d, offset %d" % (self.CurrentLineNumber, self.CurrentOffsetWithinLine), self.FileName, self.CurrentLineNumber)
+ return CurrentChar
+
+ ## __NextChar() method
+ #
+ # Get the one char pass the char pointed to by the file buffer pointer
+ #
+ # @param self The object pointer
+ # @retval Char Next char
+ #
+ def __NextChar(self):
+ if self.CurrentOffsetWithinLine == len(self.Profile.FileLinesList[self.CurrentLineNumber - 1]) - 1:
+ return self.Profile.FileLinesList[self.CurrentLineNumber][0]
+ else:
+ return self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine + 1]
+
+ ## __SetCurrentCharValue() method
+ #
+ # Modify the value of current char
+ #
+ # @param self The object pointer
+ # @param Value The new value of current char
+ #
+ def __SetCurrentCharValue(self, Value):
+ self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine] = Value
+
+ ## __SetCharValue() method
+ #
+ # Modify the value of current char
+ #
+ # @param self The object pointer
+ # @param Value The new value of current char
+ #
+ def __SetCharValue(self, Line, Offset, Value):
+ self.Profile.FileLinesList[Line - 1][Offset] = Value
+
+ ## __CurrentLine() method
+ #
+ # Get the list that contains current line contents
+ #
+ # @param self The object pointer
+ # @retval List current line contents
+ #
+ def __CurrentLine(self):
+ return self.Profile.FileLinesList[self.CurrentLineNumber - 1]
+
+ ## __InsertComma() method
+ #
+ # Insert ',' to replace PP
+ #
+ # @param self The object pointer
+ # @retval List current line contents
+ #
+ def __InsertComma(self, Line):
+
+
+ if self.Profile.FileLinesList[Line - 1][0] != T_CHAR_HASH:
+ BeforeHashPart = str(self.Profile.FileLinesList[Line - 1]).split(T_CHAR_HASH)[0]
+ if BeforeHashPart.rstrip().endswith(T_CHAR_COMMA) or BeforeHashPart.rstrip().endswith(';'):
+ return
+
+ if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(','):
+ return
+
+ if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(';'):
+ return
+
+ if str(self.Profile.FileLinesList[Line]).lstrip().startswith(',') or str(self.Profile.FileLinesList[Line]).lstrip().startswith(';'):
+ return
+
+ self.Profile.FileLinesList[Line - 1].insert(self.CurrentOffsetWithinLine, ',')
+
+ ## PreprocessFile() method
+ #
+ # Preprocess file contents, replace comments with spaces.
+ # In the end, rewind the file buffer pointer to the beginning
+ # BUGBUG: No !include statement processing contained in this procedure
+ # !include statement should be expanded at the same FileLinesList[CurrentLineNumber - 1]
+ #
+ # @param self The object pointer
+ #
+ def PreprocessFile(self):
+
+ self.Rewind()
+ InComment = False
+ DoubleSlashComment = False
+ HashComment = False
+ PPExtend = False
+ CommentObj = None
+ PPDirectiveObj = None
+ # HashComment in quoted string " " is ignored.
+ InString = False
+ InCharLiteral = False
+
+ self.Profile.FileLinesList = [list(s) for s in self.Profile.FileLinesListFromFile]
+ while not self.__EndOfFile():
+
+ if not InComment and self.__CurrentChar() == T_CHAR_DOUBLE_QUOTE:
+ InString = not InString
+
+ if not InComment and self.__CurrentChar() == T_CHAR_SINGLE_QUOTE:
+ InCharLiteral = not InCharLiteral
+ # meet new line, then no longer in a comment for // and '#'
+ if self.__CurrentChar() == T_CHAR_LF:
+ if HashComment and PPDirectiveObj is not None:
+ if PPDirectiveObj.Content.rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):
+ PPDirectiveObj.Content += T_CHAR_LF
+ PPExtend = True
+ else:
+ PPExtend = False
+
+ EndLinePos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
+
+ if InComment and DoubleSlashComment:
+ InComment = False
+ DoubleSlashComment = False
+ CommentObj.Content += T_CHAR_LF
+ CommentObj.EndPos = EndLinePos
+ FileProfile.CommentList.append(CommentObj)
+ CommentObj = None
+ if InComment and HashComment and not PPExtend:
+ InComment = False
+ HashComment = False
+ PPDirectiveObj.Content += T_CHAR_LF
+ PPDirectiveObj.EndPos = EndLinePos
+ FileProfile.PPDirectiveList.append(PPDirectiveObj)
+ PPDirectiveObj = None
+
+ if InString or InCharLiteral:
+ CurrentLine = "".join(self.__CurrentLine())
+ if CurrentLine.rstrip(T_CHAR_LF).rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):
+ SlashIndex = CurrentLine.rindex(T_CHAR_BACKSLASH)
+ self.__SetCharValue(self.CurrentLineNumber, SlashIndex, T_CHAR_SPACE)
+
+ if InComment and not DoubleSlashComment and not HashComment:
+ CommentObj.Content += T_CHAR_LF
+ self.CurrentLineNumber += 1
+ self.CurrentOffsetWithinLine = 0
+ # check for */ comment end
+ elif InComment and not DoubleSlashComment and not HashComment and self.__CurrentChar() == T_CHAR_STAR and self.__NextChar() == T_CHAR_SLASH:
+ CommentObj.Content += self.__CurrentChar()
+# self.__SetCurrentCharValue(T_CHAR_SPACE)
+ self.__GetOneChar()
+ CommentObj.Content += self.__CurrentChar()
+# self.__SetCurrentCharValue(T_CHAR_SPACE)
+ CommentObj.EndPos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
+ FileProfile.CommentList.append(CommentObj)
+ CommentObj = None
+ self.__GetOneChar()
+ InComment = False
+ # set comments to spaces
+ elif InComment:
+ if HashComment:
+ # // follows hash PP directive
+ if self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_SLASH:
+ InComment = False
+ HashComment = False
+ PPDirectiveObj.EndPos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine - 1)
+ FileProfile.PPDirectiveList.append(PPDirectiveObj)
+ PPDirectiveObj = None
+ continue
+ else:
+ PPDirectiveObj.Content += self.__CurrentChar()
+ if PPExtend:
+ self.__SetCurrentCharValue(T_CHAR_SPACE)
+ else:
+ CommentObj.Content += self.__CurrentChar()
+# self.__SetCurrentCharValue(T_CHAR_SPACE)
+ self.__GetOneChar()
+ # check for // comment
+ elif self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_SLASH:
+ InComment = True
+ DoubleSlashComment = True
+ CommentObj = Comment('', (self.CurrentLineNumber, self.CurrentOffsetWithinLine), None, T_COMMENT_TWO_SLASH)
+ # check for '#' comment
+ elif self.__CurrentChar() == T_CHAR_HASH and not InString and not InCharLiteral:
+ InComment = True
+ HashComment = True
+ PPDirectiveObj = PP_Directive('', (self.CurrentLineNumber, self.CurrentOffsetWithinLine), None)
+ # check for /* comment start
+ elif self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_STAR:
+ CommentObj = Comment('', (self.CurrentLineNumber, self.CurrentOffsetWithinLine), None, T_COMMENT_SLASH_STAR)
+ CommentObj.Content += self.__CurrentChar()
+# self.__SetCurrentCharValue( T_CHAR_SPACE)
+ self.__GetOneChar()
+ CommentObj.Content += self.__CurrentChar()
+# self.__SetCurrentCharValue( T_CHAR_SPACE)
+ self.__GetOneChar()
+ InComment = True
+ else:
+ self.__GetOneChar()
+
+ EndLinePos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
+
+ if InComment and DoubleSlashComment:
+ CommentObj.EndPos = EndLinePos
+ FileProfile.CommentList.append(CommentObj)
+ if InComment and HashComment and not PPExtend:
+ PPDirectiveObj.EndPos = EndLinePos
+ FileProfile.PPDirectiveList.append(PPDirectiveObj)
+
+ self.Rewind()
+
+ def PreprocessFileWithClear(self):
+
+ self.Rewind()
+ InComment = False
+ DoubleSlashComment = False
+ HashComment = False
+ PPExtend = False
+ CommentObj = None
+ PPDirectiveObj = None
+ # HashComment in quoted string " " is ignored.
+ InString = False
+ InCharLiteral = False
+
+ self.Profile.FileLinesList = [list(s) for s in self.Profile.FileLinesListFromFile]
+ while not self.__EndOfFile():
+
+ if not InComment and self.__CurrentChar() == T_CHAR_DOUBLE_QUOTE:
+ InString = not InString
+
+ if not InComment and self.__CurrentChar() == T_CHAR_SINGLE_QUOTE:
+ InCharLiteral = not InCharLiteral
+ # meet new line, then no longer in a comment for // and '#'
+ if self.__CurrentChar() == T_CHAR_LF:
+ if HashComment and PPDirectiveObj is not None:
+ if PPDirectiveObj.Content.rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):
+ PPDirectiveObj.Content += T_CHAR_LF
+ PPExtend = True
+ else:
+ PPExtend = False
+
+ EndLinePos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
+
+ if InComment and DoubleSlashComment:
+ InComment = False
+ DoubleSlashComment = False
+ CommentObj.Content += T_CHAR_LF
+ CommentObj.EndPos = EndLinePos
+ FileProfile.CommentList.append(CommentObj)
+ CommentObj = None
+ if InComment and HashComment and not PPExtend:
+ InComment = False
+ HashComment = False
+ PPDirectiveObj.Content += T_CHAR_LF
+ PPDirectiveObj.EndPos = EndLinePos
+ FileProfile.PPDirectiveList.append(PPDirectiveObj)
+ PPDirectiveObj = None
+
+ if InString or InCharLiteral:
+ CurrentLine = "".join(self.__CurrentLine())
+ if CurrentLine.rstrip(T_CHAR_LF).rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):
+ SlashIndex = CurrentLine.rindex(T_CHAR_BACKSLASH)
+ self.__SetCharValue(self.CurrentLineNumber, SlashIndex, T_CHAR_SPACE)
+
+ if InComment and not DoubleSlashComment and not HashComment:
+ CommentObj.Content += T_CHAR_LF
+ self.CurrentLineNumber += 1
+ self.CurrentOffsetWithinLine = 0
+ # check for */ comment end
+ elif InComment and not DoubleSlashComment and not HashComment and self.__CurrentChar() == T_CHAR_STAR and self.__NextChar() == T_CHAR_SLASH:
+ CommentObj.Content += self.__CurrentChar()
+ self.__SetCurrentCharValue(T_CHAR_SPACE)
+ self.__GetOneChar()
+ CommentObj.Content += self.__CurrentChar()
+ self.__SetCurrentCharValue(T_CHAR_SPACE)
+ CommentObj.EndPos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
+ FileProfile.CommentList.append(CommentObj)
+ CommentObj = None
+ self.__GetOneChar()
+ InComment = False
+ # set comments to spaces
+ elif InComment:
+ if HashComment:
+ # // follows hash PP directive
+ if self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_SLASH:
+ InComment = False
+ HashComment = False
+ PPDirectiveObj.EndPos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine - 1)
+ FileProfile.PPDirectiveList.append(PPDirectiveObj)
+ PPDirectiveObj = None
+ continue
+ else:
+ PPDirectiveObj.Content += self.__CurrentChar()
+# if PPExtend:
+# self.__SetCurrentCharValue(T_CHAR_SPACE)
+ else:
+ CommentObj.Content += self.__CurrentChar()
+ self.__SetCurrentCharValue(T_CHAR_SPACE)
+ self.__GetOneChar()
+ # check for // comment
+ elif self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_SLASH:
+ InComment = True
+ DoubleSlashComment = True
+ CommentObj = Comment('', (self.CurrentLineNumber, self.CurrentOffsetWithinLine), None, T_COMMENT_TWO_SLASH)
+ # check for '#' comment
+ elif self.__CurrentChar() == T_CHAR_HASH and not InString and not InCharLiteral:
+ InComment = True
+ HashComment = True
+ PPDirectiveObj = PP_Directive('', (self.CurrentLineNumber, self.CurrentOffsetWithinLine), None)
+ # check for /* comment start
+ elif self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_STAR:
+ CommentObj = Comment('', (self.CurrentLineNumber, self.CurrentOffsetWithinLine), None, T_COMMENT_SLASH_STAR)
+ CommentObj.Content += self.__CurrentChar()
+ self.__SetCurrentCharValue( T_CHAR_SPACE)
+ self.__GetOneChar()
+ CommentObj.Content += self.__CurrentChar()
+ self.__SetCurrentCharValue( T_CHAR_SPACE)
+ self.__GetOneChar()
+ InComment = True
+ else:
+ self.__GetOneChar()
+
+ EndLinePos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
+
+ if InComment and DoubleSlashComment:
+ CommentObj.EndPos = EndLinePos
+ FileProfile.CommentList.append(CommentObj)
+ if InComment and HashComment and not PPExtend:
+ PPDirectiveObj.EndPos = EndLinePos
+ FileProfile.PPDirectiveList.append(PPDirectiveObj)
+ self.Rewind()
+
+ ## ParseFile() method
+ #
+ # Parse the file profile buffer to extract fd, fv ... information
+ # Exception will be raised if syntax error found
+ #
+ # @param self The object pointer
+ #
+ def ParseFile(self):
+ self.PreprocessFile()
+ # restore from ListOfList to ListOfString
+ self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]
+ FileStringContents = ''
+ for fileLine in self.Profile.FileLinesList:
+ FileStringContents += fileLine
+ for Token in self.TokenReleaceList:
+ if Token in FileStringContents:
+ FileStringContents = FileStringContents.replace(Token, 'TOKENSTRING')
+ cStream = antlr.InputStream(FileStringContents)
+ lexer = CLexer(cStream)
+ tStream = antlr.CommonTokenStream(lexer)
+ parser = CParser(tStream)
+ parser.translation_unit()
+
+ def ParseFileWithClearedPPDirective(self):
+ self.PreprocessFileWithClear()
+ # restore from ListOfList to ListOfString
+ self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]
+ FileStringContents = ''
+ for fileLine in self.Profile.FileLinesList:
+ FileStringContents += fileLine
+ cStream = antlr.InputStream(FileStringContents)
+ lexer = CLexer(cStream)
+ tStream = antlr.CommonTokenStream(lexer)
+ parser = CParser(tStream)
+ parser.translation_unit()
+
+ def CleanFileProfileBuffer(self):
+ FileProfile.CommentList = []
+ FileProfile.PPDirectiveList = []
+ FileProfile.PredicateExpressionList = []
+ FileProfile.FunctionDefinitionList = []
+ FileProfile.VariableDeclarationList = []
+ FileProfile.EnumerationDefinitionList = []
+ FileProfile.StructUnionDefinitionList = []
+ FileProfile.TypedefDefinitionList = []
+ FileProfile.FunctionCallingList = []
+
+ def PrintFragments(self):
+
+ print('################# ' + self.FileName + '#####################')
+
+ print('/****************************************/')
+ print('/*************** COMMENTS ***************/')
+ print('/****************************************/')
+ for comment in FileProfile.CommentList:
+ print(str(comment.StartPos) + comment.Content)
+
+ print('/****************************************/')
+ print('/********* PREPROCESS DIRECTIVES ********/')
+ print('/****************************************/')
+ for pp in FileProfile.PPDirectiveList:
+ print(str(pp.StartPos) + pp.Content)
+
+ print('/****************************************/')
+ print('/********* VARIABLE DECLARATIONS ********/')
+ print('/****************************************/')
+ for var in FileProfile.VariableDeclarationList:
+ print(str(var.StartPos) + var.Modifier + ' '+ var.Declarator)
+
+ print('/****************************************/')
+ print('/********* FUNCTION DEFINITIONS *********/')
+ print('/****************************************/')
+ for func in FileProfile.FunctionDefinitionList:
+ print(str(func.StartPos) + func.Modifier + ' '+ func.Declarator + ' ' + str(func.NamePos))
+
+ print('/****************************************/')
+ print('/************ ENUMERATIONS **************/')
+ print('/****************************************/')
+ for enum in FileProfile.EnumerationDefinitionList:
+ print(str(enum.StartPos) + enum.Content)
+
+ print('/****************************************/')
+ print('/*********** STRUCTS/UNIONS *************/')
+ print('/****************************************/')
+ for su in FileProfile.StructUnionDefinitionList:
+ print(str(su.StartPos) + su.Content)
+
+ print('/****************************************/')
+ print('/********* PREDICATE EXPRESSIONS ********/')
+ print('/****************************************/')
+ for predexp in FileProfile.PredicateExpressionList:
+ print(str(predexp.StartPos) + predexp.Content)
+
+ print('/****************************************/')
+ print('/************** TYPEDEFS ****************/')
+ print('/****************************************/')
+ for typedef in FileProfile.TypedefDefinitionList:
+ print(str(typedef.StartPos) + typedef.ToType)
+
+if __name__ == "__main__":
+
+ collector = CodeFragmentCollector(sys.argv[1])
+ collector.PreprocessFile()
+ print("For Test.")
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/Configuration.py b/roms/edk2/BaseTools/Source/Python/Ecc/Configuration.py
new file mode 100644
index 000000000..9d9feaca5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/Configuration.py
@@ -0,0 +1,444 @@
+## @file
+# This file is used to define class Configuration
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+import Common.LongFilePathOs as os
+import Common.EdkLogger as EdkLogger
+from Common.DataType import *
+from Common.StringUtils import *
+from Common.LongFilePathSupport import OpenLongFilePath as open
+
+_ConfigFileToInternalTranslation = {
+ # not same
+ "ModifierList":"ModifierSet",
+
+ # same
+ # please keep this in correct alphabetical order.
+ "AutoCorrect":"AutoCorrect",
+ "BinaryExtList":"BinaryExtList",
+ "CFunctionLayoutCheckAll":"CFunctionLayoutCheckAll",
+ "CFunctionLayoutCheckDataDeclaration":"CFunctionLayoutCheckDataDeclaration",
+ "CFunctionLayoutCheckFunctionBody":"CFunctionLayoutCheckFunctionBody",
+ "CFunctionLayoutCheckFunctionName":"CFunctionLayoutCheckFunctionName",
+ "CFunctionLayoutCheckFunctionPrototype":"CFunctionLayoutCheckFunctionPrototype",
+ "CFunctionLayoutCheckNoInitOfVariable":"CFunctionLayoutCheckNoInitOfVariable",
+ "CFunctionLayoutCheckNoStatic":"CFunctionLayoutCheckNoStatic",
+ "CFunctionLayoutCheckOptionalFunctionalModifier":"CFunctionLayoutCheckOptionalFunctionalModifier",
+ "CFunctionLayoutCheckReturnType":"CFunctionLayoutCheckReturnType",
+ "CheckAll":"CheckAll",
+ "Copyright":"Copyright",
+ "DeclarationDataTypeCheckAll":"DeclarationDataTypeCheckAll",
+ "DeclarationDataTypeCheckEFIAPIModifier":"DeclarationDataTypeCheckEFIAPIModifier",
+ "DeclarationDataTypeCheckEnumeratedType":"DeclarationDataTypeCheckEnumeratedType",
+ "DeclarationDataTypeCheckInOutModifier":"DeclarationDataTypeCheckInOutModifier",
+ "DeclarationDataTypeCheckNoUseCType":"DeclarationDataTypeCheckNoUseCType",
+ "DeclarationDataTypeCheckSameStructure":"DeclarationDataTypeCheckSameStructure",
+ "DeclarationDataTypeCheckStructureDeclaration":"DeclarationDataTypeCheckStructureDeclaration",
+ "DeclarationDataTypeCheckUnionType":"DeclarationDataTypeCheckUnionType",
+ "DoxygenCheckAll":"DoxygenCheckAll",
+ "DoxygenCheckCommand":"DoxygenCheckCommand",
+ "DoxygenCheckCommentDescription":"DoxygenCheckCommentDescription",
+ "DoxygenCheckCommentFormat":"DoxygenCheckCommentFormat",
+ "DoxygenCheckFileHeader":"DoxygenCheckFileHeader",
+ "DoxygenCheckFunctionHeader":"DoxygenCheckFunctionHeader",
+ "GeneralCheckAll":"GeneralCheckAll",
+ "GeneralCheckCarriageReturn":"GeneralCheckCarriageReturn",
+ "GeneralCheckFileExistence":"GeneralCheckFileExistence",
+ "GeneralCheckIndentation":"GeneralCheckIndentation",
+ "GeneralCheckIndentationWidth":"GeneralCheckIndentationWidth",
+ "GeneralCheckLine":"GeneralCheckLine",
+ "GeneralCheckLineEnding":"GeneralCheckLineEnding",
+ "GeneralCheckLineWidth":"GeneralCheckLineWidth",
+ "GeneralCheckNoProgma":"GeneralCheckNoProgma",
+ "GeneralCheckNoTab":"GeneralCheckNoTab",
+ "GeneralCheckNo_Asm":"GeneralCheckNo_Asm",
+ "GeneralCheckNonAcsii":"GeneralCheckNonAcsii",
+ "GeneralCheckTabWidth":"GeneralCheckTabWidth",
+ "GeneralCheckTrailingWhiteSpaceLine":"GeneralCheckTrailingWhiteSpaceLine",
+ "GeneralCheckUni":"GeneralCheckUni",
+ "HeaderCheckAll":"HeaderCheckAll",
+ "HeaderCheckCFileCommentLicenseFormat":"HeaderCheckCFileCommentLicenseFormat",
+ "HeaderCheckCFileCommentReferenceFormat":"HeaderCheckCFileCommentReferenceFormat",
+ "HeaderCheckCFileCommentStartSpacesNum":"HeaderCheckCFileCommentStartSpacesNum",
+ "HeaderCheckFile":"HeaderCheckFile",
+ "HeaderCheckFileCommentEnd":"HeaderCheckFileCommentEnd",
+ "HeaderCheckFunction":"HeaderCheckFunction",
+ "IncludeFileCheckAll":"IncludeFileCheckAll",
+ "IncludeFileCheckData":"IncludeFileCheckData",
+ "IncludeFileCheckIfndefStatement":"IncludeFileCheckIfndefStatement",
+ "IncludeFileCheckSameName":"IncludeFileCheckSameName",
+ "MetaDataFileCheckAll":"MetaDataFileCheckAll",
+ "MetaDataFileCheckBinaryInfInFdf":"MetaDataFileCheckBinaryInfInFdf",
+ "MetaDataFileCheckGenerateFileList":"MetaDataFileCheckGenerateFileList",
+ "MetaDataFileCheckGuidDuplicate":"MetaDataFileCheckGuidDuplicate",
+ "MetaDataFileCheckLibraryDefinedInDec":"MetaDataFileCheckLibraryDefinedInDec",
+ "MetaDataFileCheckLibraryInstance":"MetaDataFileCheckLibraryInstance",
+ "MetaDataFileCheckLibraryInstanceDependent":"MetaDataFileCheckLibraryInstanceDependent",
+ "MetaDataFileCheckLibraryInstanceOrder":"MetaDataFileCheckLibraryInstanceOrder",
+ "MetaDataFileCheckLibraryNoUse":"MetaDataFileCheckLibraryNoUse",
+ "MetaDataFileCheckModuleFileGuidDuplication":"MetaDataFileCheckModuleFileGuidDuplication",
+ "MetaDataFileCheckModuleFileGuidFormat":"MetaDataFileCheckModuleFileGuidFormat",
+ "MetaDataFileCheckModuleFileNoUse":"MetaDataFileCheckModuleFileNoUse",
+ "MetaDataFileCheckModuleFilePcdFormat":"MetaDataFileCheckModuleFilePcdFormat",
+ "MetaDataFileCheckModuleFilePpiFormat":"MetaDataFileCheckModuleFilePpiFormat",
+ "MetaDataFileCheckModuleFileProtocolFormat":"MetaDataFileCheckModuleFileProtocolFormat",
+ "MetaDataFileCheckPathName":"MetaDataFileCheckPathName",
+ "MetaDataFileCheckPathOfGenerateFileList":"MetaDataFileCheckPathOfGenerateFileList",
+ "MetaDataFileCheckPcdDuplicate":"MetaDataFileCheckPcdDuplicate",
+ "MetaDataFileCheckPcdFlash":"MetaDataFileCheckPcdFlash",
+ "MetaDataFileCheckPcdNoUse":"MetaDataFileCheckPcdNoUse",
+ "MetaDataFileCheckPcdType":"MetaDataFileCheckPcdType",
+ "NamingConventionCheckAll":"NamingConventionCheckAll",
+ "NamingConventionCheckDefineStatement":"NamingConventionCheckDefineStatement",
+ "NamingConventionCheckFunctionName":"NamingConventionCheckFunctionName",
+ "NamingConventionCheckIfndefStatement":"NamingConventionCheckIfndefStatement",
+ "NamingConventionCheckPathName":"NamingConventionCheckPathName",
+ "NamingConventionCheckSingleCharacterVariable":"NamingConventionCheckSingleCharacterVariable",
+ "NamingConventionCheckTypedefStatement":"NamingConventionCheckTypedefStatement",
+ "NamingConventionCheckVariableName":"NamingConventionCheckVariableName",
+ "PredicateExpressionCheckAll":"PredicateExpressionCheckAll",
+ "PredicateExpressionCheckBooleanValue":"PredicateExpressionCheckBooleanValue",
+ "PredicateExpressionCheckComparisonNullType":"PredicateExpressionCheckComparisonNullType",
+ "PredicateExpressionCheckNonBooleanOperator":"PredicateExpressionCheckNonBooleanOperator",
+ "ScanOnlyDirList":"ScanOnlyDirList",
+ "SkipDirList":"SkipDirList",
+ "SkipFileList":"SkipFileList",
+ "SmmCommParaCheckAll":"SmmCommParaCheckAll",
+ "SmmCommParaCheckBufferType":"SmmCommParaCheckBufferType",
+ "SpaceCheckAll":"SpaceCheckAll",
+ "SpellingCheckAll":"SpellingCheckAll",
+ "TokenReleaceList":"TokenReleaceList",
+ "UniCheckAll":"UniCheckAll",
+ "UniCheckHelpInfo":"UniCheckHelpInfo",
+ "UniCheckPCDInfo":"UniCheckPCDInfo",
+ "Version":"Version"
+ }
+
+## Configuration
+#
+# This class is used to define all items in configuration file
+#
+# @param Filename: The name of configuration file, the default is config.ini
+#
+class Configuration(object):
+ def __init__(self, Filename):
+ self.Filename = Filename
+
+ self.Version = 0.1
+
+ ## Identify to if check all items
+ # 1 - Check all items and ignore all other detailed items
+ # 0 - Not check all items, the tool will go through all other detailed items to decide to check or not
+ #
+ self.CheckAll = 0
+
+ ## Identify to if automatically correct mistakes
+ # 1 - Automatically correct
+ # 0 - Not automatically correct
+ # Only the following check points can be automatically corrected, others not listed below are not supported even it is 1
+ #
+ # GeneralCheckTab
+ # GeneralCheckIndentation
+ # GeneralCheckLine
+ # GeneralCheckCarriageReturn
+ # SpaceCheckAll
+ #
+ self.AutoCorrect = 0
+
+ # List customized Modifer here, split with ','
+ # Defaultly use the definition in class DataType
+ self.ModifierSet = MODIFIER_SET
+
+ ## General Checking
+ self.GeneralCheckAll = 0
+
+ # Check whether NO Tab is used, replaced with spaces
+ self.GeneralCheckNoTab = 1
+ # The width of Tab
+ self.GeneralCheckTabWidth = 2
+ # Check whether the indentation is followed coding style
+ self.GeneralCheckIndentation = 1
+ # The width of indentation
+ self.GeneralCheckIndentationWidth = 2
+ # Check whether no line is exceeding defined widty
+ self.GeneralCheckLine = 1
+ # The width of a line
+ self.GeneralCheckLineWidth = 120
+ # Check whether no use of _asm in the source file
+ self.GeneralCheckNo_Asm = 1
+ # Check whether no use of "#progma" in source file except "#pragma pack(#)".
+ self.GeneralCheckNoProgma = 1
+ # Check whether there is a carriage return at the end of the file
+ self.GeneralCheckCarriageReturn = 1
+ # Check whether the file exists
+ self.GeneralCheckFileExistence = 1
+ # Check whether file has non ACSII char
+ self.GeneralCheckNonAcsii = 1
+ # Check whether UNI file is valid
+ self.GeneralCheckUni = 1
+ # Check Only use CRLF (Carriage Return Line Feed) line endings.
+ self.GeneralCheckLineEnding = 1
+ # Check if there is no trailing white space in one line.
+ self.GeneralCheckTrailingWhiteSpaceLine = 1
+
+ self.CFunctionLayoutCheckNoDeprecated = 1
+
+ ## Space Checking
+ self.SpaceCheckAll = 1
+
+ ## Predicate Expression Checking
+ self.PredicateExpressionCheckAll = 0
+
+ # Check whether Boolean values, variable type BOOLEAN not use explicit comparisons to TRUE or FALSE
+ self.PredicateExpressionCheckBooleanValue = 1
+ # Check whether Non-Boolean comparisons use a compare operator (==, !=, >, < >=, <=).
+ self.PredicateExpressionCheckNonBooleanOperator = 1
+ # Check whether a comparison of any pointer to zero must be done via the NULL type
+ self.PredicateExpressionCheckComparisonNullType = 1
+
+ ## Headers Checking
+ self.HeaderCheckAll = 0
+
+ # Check whether File header exists
+ self.HeaderCheckFile = 1
+ # Check whether Function header exists
+ self.HeaderCheckFunction = 1
+ # Check whether Meta data File header Comment End with '##'
+ self.HeaderCheckFileCommentEnd = 1
+ # Check whether C File header Comment content start with two spaces
+ self.HeaderCheckCFileCommentStartSpacesNum = 1
+ # Check whether C File header Comment's each reference at list should begin with a bullet character '-'
+ self.HeaderCheckCFileCommentReferenceFormat = 1
+ # Check whether C File header Comment have the License immediately after the ""Copyright"" line
+ self.HeaderCheckCFileCommentLicenseFormat = 1
+
+ ## C Function Layout Checking
+ self.CFunctionLayoutCheckAll = 0
+
+ # Check whether return type exists and in the first line
+ self.CFunctionLayoutCheckReturnType = 1
+ # Check whether any optional functional modifiers exist and next to the return type
+ self.CFunctionLayoutCheckOptionalFunctionalModifier = 1
+ # Check whether the next line contains the function name, left justified, followed by the beginning of the parameter list
+ # Check whether the closing parenthesis is on its own line and also indented two spaces
+ self.CFunctionLayoutCheckFunctionName = 1
+ # Check whether the function prototypes in include files have the same form as function definitions
+ self.CFunctionLayoutCheckFunctionPrototype = 1
+ # Check whether the body of a function is contained by open and close braces that must be in the first column
+ self.CFunctionLayoutCheckFunctionBody = 1
+ # Check whether the data declarations is the first code in a module.
+ self.CFunctionLayoutCheckDataDeclaration = 1
+ # Check whether no initialization of a variable as part of its declaration
+ self.CFunctionLayoutCheckNoInitOfVariable = 1
+ # Check whether no use of STATIC for functions
+ self.CFunctionLayoutCheckNoStatic = 1
+
+ ## Include Files Checking
+ self.IncludeFileCheckAll = 0
+
+ #Check whether having include files with same name
+ self.IncludeFileCheckSameName = 1
+ # Check whether all include file contents is guarded by a #ifndef statement.
+ # the #ifndef must be the first line of code following the file header comment
+ # the #endif must appear on the last line in the file
+ self.IncludeFileCheckIfndefStatement = 1
+ # Check whether include files contain only public or only private data
+ # Check whether include files NOT contain code or define data variables
+ self.IncludeFileCheckData = 1
+
+ ## Declarations and Data Types Checking
+ self.DeclarationDataTypeCheckAll = 0
+
+ # Check whether no use of int, unsigned, char, void, long in any .c, .h or .asl files.
+ self.DeclarationDataTypeCheckNoUseCType = 1
+ # Check whether the modifiers IN, OUT, OPTIONAL, and UNALIGNED are used only to qualify arguments to a function and should not appear in a data type declaration
+ self.DeclarationDataTypeCheckInOutModifier = 1
+ # Check whether the EFIAPI modifier should be used at the entry of drivers, events, and member functions of protocols
+ self.DeclarationDataTypeCheckEFIAPIModifier = 1
+ # Check whether Enumerated Type has a 'typedef' and the name is capital
+ self.DeclarationDataTypeCheckEnumeratedType = 1
+ # Check whether Structure Type has a 'typedef' and the name is capital
+ self.DeclarationDataTypeCheckStructureDeclaration = 1
+ # Check whether having same Structure
+ self.DeclarationDataTypeCheckSameStructure = 1
+ # Check whether Union Type has a 'typedef' and the name is capital
+ self.DeclarationDataTypeCheckUnionType = 1
+
+ ## Naming Conventions Checking
+ self.NamingConventionCheckAll = 0
+
+ # Check whether only capital letters are used for #define declarations
+ self.NamingConventionCheckDefineStatement = 1
+ # Check whether only capital letters are used for typedef declarations
+ self.NamingConventionCheckTypedefStatement = 1
+ # Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'.
+ self.NamingConventionCheckIfndefStatement = 1
+ # Rule for path name, variable name and function name
+ # 1. First character should be upper case
+ # 2. Existing lower case in a word
+ # 3. No space existence
+ # Check whether the path name followed the rule
+ self.NamingConventionCheckPathName = 1
+ # Check whether the variable name followed the rule
+ self.NamingConventionCheckVariableName = 1
+ # Check whether the function name followed the rule
+ self.NamingConventionCheckFunctionName = 1
+ # Check whether NO use short variable name with single character
+ self.NamingConventionCheckSingleCharacterVariable = 1
+
+ ## Doxygen Checking
+ self.DoxygenCheckAll = 0
+
+ # Check whether the file headers are followed Doxygen special documentation blocks in section 2.3.5
+ self.DoxygenCheckFileHeader = 1
+ # Check whether the function headers are followed Doxygen special documentation blocks in section 2.3.5
+ self.DoxygenCheckFunctionHeader = 1
+ # Check whether the first line of text in a comment block is a brief description of the element being documented.
+ # The brief description must end with a period.
+ self.DoxygenCheckCommentDescription = 1
+ # Check whether comment lines with '///< ... text ...' format, if it is used, it should be after the code section.
+ self.DoxygenCheckCommentFormat = 1
+ # Check whether only Doxygen commands allowed to mark the code are @bug and @todo.
+ self.DoxygenCheckCommand = 1
+
+ ## Meta-Data File Processing Checking
+ self.MetaDataFileCheckAll = 0
+
+ # Check whether each file defined in meta-data exists
+ self.MetaDataFileCheckPathName = 1
+ # Generate a list for all files defined in meta-data files
+ self.MetaDataFileCheckGenerateFileList = 1
+ # The path of log file
+ self.MetaDataFileCheckPathOfGenerateFileList = 'File.log'
+ # Check whether all Library Instances defined for a given module (or dependent library instance) match the module's type.
+ # Each Library Instance must specify the Supported Module Types in its INF file,
+ # and any module specifying the library instance must be one of the supported types.
+ self.MetaDataFileCheckLibraryInstance = 1
+ # Check whether a Library Instance has been defined for all dependent library classes
+ self.MetaDataFileCheckLibraryInstanceDependent = 1
+ # Check whether the Library Instances specified by the LibraryClasses sections are listed in order of dependencies
+ self.MetaDataFileCheckLibraryInstanceOrder = 1
+ # Check whether the unnecessary inclusion of library classes in the INF file
+ self.MetaDataFileCheckLibraryNoUse = 1
+ # Check the header file in Include\Library directory whether be defined in the package DEC file.
+ self.MetaDataFileCheckLibraryDefinedInDec = 1
+ # Check whether an INF file is specified in the FDF file, but not in the DSC file, then the INF file must be for a Binary module only
+ self.MetaDataFileCheckBinaryInfInFdf = 1
+ # Not to report error and warning related OS include file such as "windows.h" and "stdio.h"
+ # Check whether a PCD is set in a DSC file or the FDF file, but not in both.
+ self.MetaDataFileCheckPcdDuplicate = 1
+ # Check whether PCD settings in the FDF file can only be related to flash.
+ self.MetaDataFileCheckPcdFlash = 1
+ # Check whether PCDs used in INF files but not specified in DSC or FDF files
+ self.MetaDataFileCheckPcdNoUse = 1
+ # Check whether having duplicate guids defined for Guid/Protocol/Ppi
+ self.MetaDataFileCheckGuidDuplicate = 1
+ # Check whether all files under module directory are described in INF files
+ self.MetaDataFileCheckModuleFileNoUse = 1
+ # Check whether the PCD is correctly used in C function via its type
+ self.MetaDataFileCheckPcdType = 1
+ # Check whether there are FILE_GUID duplication among different INF files
+ self.MetaDataFileCheckModuleFileGuidDuplication = 1
+
+ # Check Guid Format in INF files
+ self.MetaDataFileCheckModuleFileGuidFormat = 1
+ # Check Protocol Format in INF files
+ self.MetaDataFileCheckModuleFileProtocolFormat = 1
+ # Check Ppi Format in INF files
+ self.MetaDataFileCheckModuleFilePpiFormat = 1
+ # Check Pcd Format in INF files
+ self.MetaDataFileCheckModuleFilePcdFormat = 1
+
+ # Check UNI file
+ self.UniCheckAll = 0
+ # Check INF or DEC file whether defined the localized information in the associated UNI file.
+ self.UniCheckHelpInfo = 1
+ # Check PCD whether defined the prompt, help in the DEC file and localized information in the associated UNI file.
+ self.UniCheckPCDInfo = 1
+
+ # Check SMM communication function parameter
+ self.SmmCommParaCheckAll = 0
+ # Check if the EFI_SMM_COMMUNICATION_PROTOCOL parameter buffer type is Reserved / ACPI NVS or UEFI RT code/data
+ self.SmmCommParaCheckBufferType = -1
+
+ #
+ # The check points in this section are reserved
+ #
+ # GotoStatementCheckAll = 0
+ #
+ self.SpellingCheckAll = 0
+
+ # The directory listed here will not be parsed, split with ','
+ self.SkipDirList = []
+
+ # The file listed here will not be parsed, split with ','
+ self.SkipFileList = []
+
+ # A list for binary file ext name
+ self.BinaryExtList = []
+
+ # A list for only scanned folders
+ self.ScanOnlyDirList = []
+
+ # A list for Copyright format
+ self.Copyright = []
+
+ self.TokenReleaceList = []
+
+ self.ParseConfig()
+
+ def ParseConfig(self):
+ Filepath = os.path.normpath(self.Filename)
+ if not os.path.isfile(Filepath):
+ ErrorMsg = "Can't find configuration file '%s'" % Filepath
+ EdkLogger.error("Ecc", EdkLogger.ECC_ERROR, ErrorMsg, File = Filepath)
+
+ LineNo = 0
+ for Line in open(Filepath, 'r'):
+ LineNo = LineNo + 1
+ Line = CleanString(Line)
+ if Line != '':
+ List = GetSplitValueList(Line, TAB_EQUAL_SPLIT)
+ if List[0] not in _ConfigFileToInternalTranslation:
+ ErrorMsg = "Invalid configuration option '%s' was found" % List[0]
+ EdkLogger.error("Ecc", EdkLogger.ECC_ERROR, ErrorMsg, File = Filepath, Line = LineNo)
+ assert _ConfigFileToInternalTranslation[List[0]] in self.__dict__
+ if List[0] == 'ModifierList':
+ List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
+ if List[0] == 'MetaDataFileCheckPathOfGenerateFileList' and List[1] == "":
+ continue
+ if List[0] == 'SkipDirList':
+ List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
+ if List[0] == 'SkipFileList':
+ List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
+ if List[0] == 'BinaryExtList':
+ List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
+ if List[0] == 'Copyright':
+ List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
+ if List[0] == 'TokenReleaceList':
+ List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
+ self.__dict__[_ConfigFileToInternalTranslation[List[0]]] = List[1]
+
+ def ShowMe(self):
+ print(self.Filename)
+ for Key in self.__dict__.keys():
+ print(Key, '=', self.__dict__[Key])
+
+#
+# test that our dict and out class still match in contents.
+#
+if __name__ == '__main__':
+ myconfig = Configuration("BaseTools\Source\Python\Ecc\config.ini")
+ for each in myconfig.__dict__:
+ if each == "Filename":
+ continue
+ assert each in _ConfigFileToInternalTranslation.values()
+ for each in _ConfigFileToInternalTranslation.values():
+ assert each in myconfig.__dict__
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/Database.py b/roms/edk2/BaseTools/Source/Python/Ecc/Database.py
new file mode 100644
index 000000000..a5b70c520
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/Database.py
@@ -0,0 +1,340 @@
+## @file
+# This file is used to create a database used by ECC tool
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import sqlite3
+import Common.LongFilePathOs as os, time
+
+import Common.EdkLogger as EdkLogger
+import CommonDataClass.DataClass as DataClass
+
+from Table.TableDataModel import TableDataModel
+from Table.TableFile import TableFile
+from Table.TableFunction import TableFunction
+from Table.TablePcd import TablePcd
+from Table.TableIdentifier import TableIdentifier
+from Table.TableReport import TableReport
+from Ecc.MetaFileWorkspace.MetaFileTable import ModuleTable
+from Ecc.MetaFileWorkspace.MetaFileTable import PackageTable
+from Ecc.MetaFileWorkspace.MetaFileTable import PlatformTable
+from Table.TableFdf import TableFdf
+
+##
+# Static definitions
+#
+DATABASE_PATH = "Ecc.db"
+
+## Database
+#
+# This class defined the ECC database
+# During the phase of initialization, the database will create all tables and
+# insert all records of table DataModel
+#
+# @param object: Inherited from object class
+# @param DbPath: A string for the path of the ECC database
+#
+# @var Conn: Connection of the ECC database
+# @var Cur: Cursor of the connection
+# @var TblDataModel: Local instance for TableDataModel
+#
+class Database(object):
+ def __init__(self, DbPath):
+ self.DbPath = DbPath
+ self.Conn = None
+ self.Cur = None
+ self.TblDataModel = None
+ self.TblFile = None
+ self.TblFunction = None
+ self.TblIdentifier = None
+ self.TblPcd = None
+ self.TblReport = None
+ self.TblInf = None
+ self.TblDec = None
+ self.TblDsc = None
+ self.TblFdf = None
+
+ ## Initialize ECC database
+ #
+ # 1. Delete all old existing tables
+ # 2. Create new tables
+ # 3. Initialize table DataModel
+ #
+ def InitDatabase(self, NewDatabase = True):
+ EdkLogger.verbose("\nInitialize ECC database started ...")
+ #
+ # Drop all old existing tables
+ #
+ if NewDatabase:
+ if os.path.exists(self.DbPath):
+ os.remove(self.DbPath)
+ self.Conn = sqlite3.connect(self.DbPath, isolation_level = 'DEFERRED')
+ self.Conn.execute("PRAGMA page_size=4096")
+ self.Conn.execute("PRAGMA synchronous=OFF")
+ # to avoid non-ascii character conversion error
+ self.Conn.text_factory = str
+ self.Cur = self.Conn.cursor()
+
+ self.TblDataModel = TableDataModel(self.Cur)
+ self.TblFile = TableFile(self.Cur)
+ self.TblFunction = TableFunction(self.Cur)
+ self.TblIdentifier = TableIdentifier(self.Cur)
+ self.TblPcd = TablePcd(self.Cur)
+ self.TblReport = TableReport(self.Cur)
+ self.TblInf = ModuleTable(self.Cur)
+ self.TblDec = PackageTable(self.Cur)
+ self.TblDsc = PlatformTable(self.Cur)
+ self.TblFdf = TableFdf(self.Cur)
+
+ #
+ # Create new tables
+ #
+ if NewDatabase:
+ self.TblDataModel.Create()
+ self.TblFile.Create()
+ self.TblFunction.Create()
+ self.TblPcd.Create()
+ self.TblReport.Create()
+ self.TblInf.Create()
+ self.TblDec.Create()
+ self.TblDsc.Create()
+ self.TblFdf.Create()
+
+ #
+ # Init each table's ID
+ #
+ self.TblDataModel.InitID()
+ self.TblFile.InitID()
+ self.TblFunction.InitID()
+ self.TblPcd.InitID()
+ self.TblReport.InitID()
+ self.TblInf.InitID()
+ self.TblDec.InitID()
+ self.TblDsc.InitID()
+ self.TblFdf.InitID()
+
+ #
+ # Initialize table DataModel
+ #
+ if NewDatabase:
+ self.TblDataModel.InitTable()
+
+ EdkLogger.verbose("Initialize ECC database ... DONE!")
+
+ ## Query a table
+ #
+ # @param Table: The instance of the table to be queried
+ #
+ def QueryTable(self, Table):
+ Table.Query()
+
+ ## Close entire database
+ #
+ # Commit all first
+ # Close the connection and cursor
+ #
+ def Close(self):
+ #
+ # Commit to file
+ #
+ self.Conn.commit()
+
+ #
+ # Close connection and cursor
+ #
+ self.Cur.close()
+ self.Conn.close()
+
+ ## Insert one file information
+ #
+ # Insert one file's information to the database
+ # 1. Create a record in TableFile
+ # 2. Create functions one by one
+ # 2.1 Create variables of function one by one
+ # 2.2 Create pcds of function one by one
+ # 3. Create variables one by one
+ # 4. Create pcds one by one
+ #
+ def InsertOneFile(self, File):
+ #
+ # Insert a record for file
+ #
+ FileID = self.TblFile.Insert(File.Name, File.ExtName, File.Path, File.FullPath, Model = File.Model, TimeStamp = File.TimeStamp)
+
+ if File.Model == DataClass.MODEL_FILE_C or File.Model == DataClass.MODEL_FILE_H:
+ IdTable = TableIdentifier(self.Cur)
+ IdTable.Table = "Identifier%s" % FileID
+ IdTable.Create()
+ #
+ # Insert function of file
+ #
+ for Function in File.FunctionList:
+ FunctionID = self.TblFunction.Insert(Function.Header, Function.Modifier, Function.Name, Function.ReturnStatement, \
+ Function.StartLine, Function.StartColumn, Function.EndLine, Function.EndColumn, \
+ Function.BodyStartLine, Function.BodyStartColumn, FileID, \
+ Function.FunNameStartLine, Function.FunNameStartColumn)
+ #
+ # Insert Identifier of function
+ #
+ for Identifier in Function.IdentifierList:
+ IdentifierID = IdTable.Insert(Identifier.Modifier, Identifier.Type, Identifier.Name, Identifier.Value, Identifier.Model, \
+ FileID, FunctionID, Identifier.StartLine, Identifier.StartColumn, Identifier.EndLine, Identifier.EndColumn)
+ #
+ # Insert Pcd of function
+ #
+ for Pcd in Function.PcdList:
+ PcdID = self.TblPcd.Insert(Pcd.CName, Pcd.TokenSpaceGuidCName, Pcd.Token, Pcd.DatumType, Pcd.Model, \
+ FileID, FunctionID, Pcd.StartLine, Pcd.StartColumn, Pcd.EndLine, Pcd.EndColumn)
+ #
+ # Insert Identifier of file
+ #
+ for Identifier in File.IdentifierList:
+ IdentifierID = IdTable.Insert(Identifier.Modifier, Identifier.Type, Identifier.Name, Identifier.Value, Identifier.Model, \
+ FileID, -1, Identifier.StartLine, Identifier.StartColumn, Identifier.EndLine, Identifier.EndColumn)
+ #
+ # Insert Pcd of file
+ #
+ for Pcd in File.PcdList:
+ PcdID = self.TblPcd.Insert(Pcd.CName, Pcd.TokenSpaceGuidCName, Pcd.Token, Pcd.DatumType, Pcd.Model, \
+ FileID, -1, Pcd.StartLine, Pcd.StartColumn, Pcd.EndLine, Pcd.EndColumn)
+
+ EdkLogger.verbose("Insert information from file %s ... DONE!" % File.FullPath)
+
+ ## UpdateIdentifierBelongsToFunction
+ #
+ # Update the field "BelongsToFunction" for each Identifier
+ #
+ #
+ def UpdateIdentifierBelongsToFunction_disabled(self):
+ EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers started ...")
+
+ SqlCommand = """select ID, BelongsToFile, StartLine, EndLine, Model from Identifier"""
+ EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
+ self.Cur.execute(SqlCommand)
+ Records = self.Cur.fetchall()
+ for Record in Records:
+ IdentifierID = Record[0]
+ BelongsToFile = Record[1]
+ StartLine = Record[2]
+ EndLine = Record[3]
+ Model = Record[4]
+
+ #
+ # Check whether an identifier belongs to a function
+ #
+ EdkLogger.debug(4, "For common identifiers ... ")
+ SqlCommand = """select ID from Function
+ where StartLine < %s and EndLine > %s
+ and BelongsToFile = %s""" % (StartLine, EndLine, BelongsToFile)
+ EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
+ self.Cur.execute(SqlCommand)
+ IDs = self.Cur.fetchall()
+ for ID in IDs:
+ SqlCommand = """Update Identifier set BelongsToFunction = %s where ID = %s""" % (ID[0], IdentifierID)
+ EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
+ self.Cur.execute(SqlCommand)
+
+ #
+ # Check whether the identifier is a function header
+ #
+ EdkLogger.debug(4, "For function headers ... ")
+ if Model == DataClass.MODEL_IDENTIFIER_COMMENT:
+ SqlCommand = """select ID from Function
+ where StartLine = %s + 1
+ and BelongsToFile = %s""" % (EndLine, BelongsToFile)
+ EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
+ self.Cur.execute(SqlCommand)
+ IDs = self.Cur.fetchall()
+ for ID in IDs:
+ SqlCommand = """Update Identifier set BelongsToFunction = %s, Model = %s where ID = %s""" % (ID[0], DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER, IdentifierID)
+ EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
+ self.Cur.execute(SqlCommand)
+
+ EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers ... DONE")
+
+
+ ## UpdateIdentifierBelongsToFunction
+ #
+ # Update the field "BelongsToFunction" for each Identifier
+ #
+ #
+ def UpdateIdentifierBelongsToFunction(self):
+ EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers started ...")
+
+ SqlCommand = """select ID, BelongsToFile, StartLine, EndLine from Function"""
+ Records = self.TblFunction.Exec(SqlCommand)
+ Data1 = []
+ Data2 = []
+ for Record in Records:
+ FunctionID = Record[0]
+ BelongsToFile = Record[1]
+ StartLine = Record[2]
+ EndLine = Record[3]
+ #Data1.append(("'file%s'" % BelongsToFile, FunctionID, BelongsToFile, StartLine, EndLine))
+ #Data2.append(("'file%s'" % BelongsToFile, FunctionID, DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER, BelongsToFile, DataClass.MODEL_IDENTIFIER_COMMENT, StartLine - 1))
+
+ SqlCommand = """Update Identifier%s set BelongsToFunction = %s where BelongsToFile = %s and StartLine > %s and EndLine < %s""" % \
+ (BelongsToFile, FunctionID, BelongsToFile, StartLine, EndLine)
+ self.TblIdentifier.Exec(SqlCommand)
+
+ SqlCommand = """Update Identifier%s set BelongsToFunction = %s, Model = %s where BelongsToFile = %s and Model = %s and EndLine = %s""" % \
+ (BelongsToFile, FunctionID, DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER, BelongsToFile, DataClass.MODEL_IDENTIFIER_COMMENT, StartLine - 1)
+ self.TblIdentifier.Exec(SqlCommand)
+# #
+# # Check whether an identifier belongs to a function
+# #
+# print Data1
+# SqlCommand = """Update ? set BelongsToFunction = ? where BelongsToFile = ? and StartLine > ? and EndLine < ?"""
+# print SqlCommand
+# EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
+# self.Cur.executemany(SqlCommand, Data1)
+#
+# #
+# # Check whether the identifier is a function header
+# #
+# EdkLogger.debug(4, "For function headers ... ")
+# SqlCommand = """Update ? set BelongsToFunction = ?, Model = ? where BelongsToFile = ? and Model = ? and EndLine = ?"""
+# EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
+# self.Cur.executemany(SqlCommand, Data2)
+#
+# EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers ... DONE")
+
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ EdkLogger.Initialize()
+ #EdkLogger.SetLevel(EdkLogger.VERBOSE)
+ EdkLogger.SetLevel(EdkLogger.DEBUG_0)
+ EdkLogger.verbose("Start at " + time.strftime('%H:%M:%S', time.localtime()))
+
+ Db = Database(DATABASE_PATH)
+ Db.InitDatabase()
+ Db.QueryTable(Db.TblDataModel)
+
+ identifier1 = DataClass.IdentifierClass(-1, '', '', "i''1", 'aaa', DataClass.MODEL_IDENTIFIER_COMMENT, 1, -1, 32, 43, 54, 43)
+ identifier2 = DataClass.IdentifierClass(-1, '', '', 'i1', 'aaa', DataClass.MODEL_IDENTIFIER_COMMENT, 1, -1, 15, 43, 20, 43)
+ identifier3 = DataClass.IdentifierClass(-1, '', '', 'i1', 'aaa', DataClass.MODEL_IDENTIFIER_COMMENT, 1, -1, 55, 43, 58, 43)
+ identifier4 = DataClass.IdentifierClass(-1, '', '', "i1'", 'aaa', DataClass.MODEL_IDENTIFIER_COMMENT, 1, -1, 77, 43, 88, 43)
+ fun1 = DataClass.FunctionClass(-1, '', '', 'fun1', '', 21, 2, 60, 45, 1, 23, 0, [], [])
+ file = DataClass.FileClass(-1, 'F1', 'c', 'C:\\', 'C:\\F1.exe', DataClass.MODEL_FILE_C, '2007-12-28', [fun1], [identifier1, identifier2, identifier3, identifier4], [])
+ Db.InsertOneFile(file)
+ Db.UpdateIdentifierBelongsToFunction()
+
+ Db.QueryTable(Db.TblFile)
+ Db.QueryTable(Db.TblFunction)
+ Db.QueryTable(Db.TblPcd)
+ Db.QueryTable(Db.TblIdentifier)
+
+ Db.Close()
+ EdkLogger.verbose("End at " + time.strftime('%H:%M:%S', time.localtime()))
+
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/EccGlobalData.py b/roms/edk2/BaseTools/Source/Python/Ecc/EccGlobalData.py
new file mode 100644
index 000000000..89036dba0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/EccGlobalData.py
@@ -0,0 +1,21 @@
+## @file
+# This file is used to save global datas used by ECC tool
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+import Common.LongFilePathOs as os
+
+gWorkspace = ''
+gTarget = ''
+gConfig = None
+gDb = None
+gIdentifierTableList = []
+gCFileList = []
+gHFileList = []
+gUFileList = []
+gException = None
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/EccMain.py b/roms/edk2/BaseTools/Source/Python/Ecc/EccMain.py
new file mode 100644
index 000000000..72edbea3b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/EccMain.py
@@ -0,0 +1,415 @@
+## @file
+# This file is used to be the main entrance of ECC tool
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) Microsoft Corporation.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.LongFilePathOs as os, time, glob, sys
+import Common.EdkLogger as EdkLogger
+from Ecc import Database
+from Ecc import EccGlobalData
+from Ecc.MetaDataParser import *
+from optparse import OptionParser
+from Ecc.Configuration import Configuration
+from Ecc.Check import Check
+import Common.GlobalData as GlobalData
+
+from Common.StringUtils import NormPath
+from Common.BuildVersion import gBUILD_VERSION
+from Common import BuildToolError
+from Common.Misc import PathClass
+from Common.Misc import DirCache
+from Ecc.MetaFileWorkspace.MetaFileParser import DscParser
+from Ecc.MetaFileWorkspace.MetaFileParser import DecParser
+from Ecc.MetaFileWorkspace.MetaFileParser import InfParser
+from Ecc.MetaFileWorkspace.MetaFileParser import Fdf
+from Ecc.MetaFileWorkspace.MetaFileTable import MetaFileStorage
+from Ecc import c
+import re, string
+from Ecc.Exception import *
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+
+## Ecc
+#
+# This class is used to define Ecc main entrance
+#
+# @param object: Inherited from object class
+#
+class Ecc(object):
+ def __init__(self):
+ # Version and Copyright
+ self.VersionNumber = ("1.0" + " Build " + gBUILD_VERSION)
+ self.Version = "%prog Version " + self.VersionNumber
+ self.Copyright = "Copyright (c) 2009 - 2018, Intel Corporation All rights reserved."
+
+ self.InitDefaultConfigIni()
+ self.OutputFile = 'output.txt'
+ self.ReportFile = 'Report.csv'
+ self.ExceptionFile = 'exception.xml'
+ self.IsInit = True
+ self.ScanSourceCode = True
+ self.ScanMetaData = True
+ self.MetaFile = ''
+ self.OnlyScan = None
+
+ # Parse the options and args
+ self.ParseOption()
+ EdkLogger.info(time.strftime("%H:%M:%S, %b.%d %Y ", time.localtime()) + "[00:00]" + "\n")
+
+ WorkspaceDir = os.path.normcase(os.path.normpath(os.environ["WORKSPACE"]))
+ os.environ["WORKSPACE"] = WorkspaceDir
+
+ # set multiple workspace
+ PackagesPath = os.getenv("PACKAGES_PATH")
+ mws.setWs(WorkspaceDir, PackagesPath)
+
+ GlobalData.gWorkspace = WorkspaceDir
+
+ GlobalData.gGlobalDefines["WORKSPACE"] = WorkspaceDir
+
+ EdkLogger.info("Loading ECC configuration ... done")
+ # Generate checkpoints list
+ EccGlobalData.gConfig = Configuration(self.ConfigFile)
+
+ # Generate exception list
+ EccGlobalData.gException = ExceptionCheck(self.ExceptionFile)
+
+ # Init Ecc database
+ EccGlobalData.gDb = Database.Database(Database.DATABASE_PATH)
+ EccGlobalData.gDb.InitDatabase(self.IsInit)
+
+ #
+ # Get files real name in workspace dir
+ #
+ GlobalData.gAllFiles = DirCache(GlobalData.gWorkspace)
+
+ # Build ECC database
+# self.BuildDatabase()
+ self.DetectOnlyScanDirs()
+
+ # Start to check
+ self.Check()
+
+ # Show report
+ self.GenReport()
+
+ # Close Database
+ EccGlobalData.gDb.Close()
+
+ def InitDefaultConfigIni(self):
+ paths = map(lambda p: os.path.join(p, 'Ecc', 'config.ini'), sys.path)
+ paths = (os.path.realpath('config.ini'),) + tuple(paths)
+ for path in paths:
+ if os.path.exists(path):
+ self.ConfigFile = path
+ return
+ self.ConfigFile = 'config.ini'
+
+
+ ## DetectOnlyScan
+ #
+ # Detect whether only scanned folders have been enabled
+ #
+ def DetectOnlyScanDirs(self):
+ if self.OnlyScan == True:
+ OnlyScanDirs = []
+ # Use regex here if multiple spaces or TAB exists in ScanOnlyDirList in config.ini file
+ for folder in re.finditer(r'\S+', EccGlobalData.gConfig.ScanOnlyDirList):
+ OnlyScanDirs.append(folder.group())
+ if len(OnlyScanDirs) != 0:
+ self.BuildDatabase(OnlyScanDirs)
+ else:
+ EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Use -f option need to fill specific folders in config.ini file")
+ else:
+ self.BuildDatabase()
+
+
+ ## BuildDatabase
+ #
+ # Build the database for target
+ #
+ def BuildDatabase(self, SpeciDirs = None):
+ # Clean report table
+ EccGlobalData.gDb.TblReport.Drop()
+ EccGlobalData.gDb.TblReport.Create()
+
+ # Build database
+ if self.IsInit:
+ if self.ScanMetaData:
+ EdkLogger.quiet("Building database for Meta Data File ...")
+ self.BuildMetaDataFileDatabase(SpeciDirs)
+ if self.ScanSourceCode:
+ EdkLogger.quiet("Building database for Meta Data File Done!")
+ if SpeciDirs is None:
+ c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget)
+ else:
+ for specificDir in SpeciDirs:
+ c.CollectSourceCodeDataIntoDB(os.path.join(EccGlobalData.gTarget, specificDir))
+
+ EccGlobalData.gIdentifierTableList = GetTableList((MODEL_FILE_C, MODEL_FILE_H), 'Identifier', EccGlobalData.gDb)
+ EccGlobalData.gCFileList = GetFileList(MODEL_FILE_C, EccGlobalData.gDb)
+ EccGlobalData.gHFileList = GetFileList(MODEL_FILE_H, EccGlobalData.gDb)
+ EccGlobalData.gUFileList = GetFileList(MODEL_FILE_UNI, EccGlobalData.gDb)
+
+ ## BuildMetaDataFileDatabase
+ #
+ # Build the database for meta data files
+ #
+ def BuildMetaDataFileDatabase(self, SpecificDirs = None):
+ ScanFolders = []
+ if SpecificDirs is None:
+ ScanFolders.append(EccGlobalData.gTarget)
+ else:
+ for specificDir in SpecificDirs:
+ ScanFolders.append(os.path.join(EccGlobalData.gTarget, specificDir))
+ EdkLogger.quiet("Building database for meta data files ...")
+ Op = open(EccGlobalData.gConfig.MetaDataFileCheckPathOfGenerateFileList, 'w+')
+ #SkipDirs = Read from config file
+ SkipDirs = EccGlobalData.gConfig.SkipDirList
+ SkipDirString = '|'.join(SkipDirs)
+# p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % SkipDirString)
+ p = re.compile(r'.*[\\/](?:%s^\S)[\\/]?.*' % SkipDirString)
+ for scanFolder in ScanFolders:
+ for Root, Dirs, Files in os.walk(scanFolder):
+ if p.match(Root.upper()):
+ continue
+ for Dir in Dirs:
+ Dirname = os.path.join(Root, Dir)
+ if os.path.islink(Dirname):
+ Dirname = os.path.realpath(Dirname)
+ if os.path.isdir(Dirname):
+ # symlinks to directories are treated as directories
+ Dirs.remove(Dir)
+ Dirs.append(Dirname)
+
+ for File in Files:
+ if len(File) > 4 and File[-4:].upper() == ".DEC":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ #Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ self.MetaFile = DecParser(Filename, MODEL_FILE_DEC, EccGlobalData.gDb.TblDec)
+ self.MetaFile.Start()
+ continue
+ if len(File) > 4 and File[-4:].upper() == ".DSC":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ #Dsc(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ self.MetaFile = DscParser(PathClass(Filename, Root), MODEL_FILE_DSC, MetaFileStorage(EccGlobalData.gDb.TblDsc.Cur, Filename, MODEL_FILE_DSC, True))
+ # always do post-process, in case of macros change
+ self.MetaFile.DoPostProcess()
+ self.MetaFile.Start()
+ self.MetaFile._PostProcess()
+ continue
+ if len(File) > 4 and File[-4:].upper() == ".INF":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ #Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ self.MetaFile = InfParser(Filename, MODEL_FILE_INF, EccGlobalData.gDb.TblInf)
+ self.MetaFile.Start()
+ continue
+ if len(File) > 4 and File[-4:].upper() == ".FDF":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ continue
+ if len(File) > 4 and File[-4:].upper() == ".UNI":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ FileID = EccGlobalData.gDb.TblFile.InsertFile(Filename, MODEL_FILE_UNI)
+ EccGlobalData.gDb.TblReport.UpdateBelongsToItemByFile(FileID, File)
+ continue
+
+ Op.close()
+
+ # Commit to database
+ EccGlobalData.gDb.Conn.commit()
+
+ EdkLogger.quiet("Building database for meta data files done!")
+
+ ##
+ #
+ # Check each checkpoint
+ #
+ def Check(self):
+ EdkLogger.quiet("Checking ...")
+ EccCheck = Check()
+ EccCheck.Check()
+ EdkLogger.quiet("Checking done!")
+
+ ##
+ #
+ # Generate the scan report
+ #
+ def GenReport(self):
+ EdkLogger.quiet("Generating report ...")
+ EccGlobalData.gDb.TblReport.ToCSV(self.ReportFile)
+ EdkLogger.quiet("Generating report done!")
+
+ def GetRealPathCase(self, path):
+ TmpPath = path.rstrip(os.sep)
+ PathParts = TmpPath.split(os.sep)
+ if len(PathParts) == 0:
+ return path
+ if len(PathParts) == 1:
+ if PathParts[0].strip().endswith(':'):
+ return PathParts[0].upper()
+ # Relative dir, list . current dir
+ Dirs = os.listdir('.')
+ for Dir in Dirs:
+ if Dir.upper() == PathParts[0].upper():
+ return Dir
+
+ if PathParts[0].strip().endswith(':'):
+ PathParts[0] = PathParts[0].upper()
+ ParentDir = PathParts[0]
+ RealPath = ParentDir
+ if PathParts[0] == '':
+ RealPath = os.sep
+ ParentDir = os.sep
+
+ PathParts.remove(PathParts[0]) # need to remove the parent
+ for Part in PathParts:
+ Dirs = os.listdir(ParentDir + os.sep)
+ for Dir in Dirs:
+ if Dir.upper() == Part.upper():
+ RealPath += os.sep
+ RealPath += Dir
+ break
+ ParentDir += os.sep
+ ParentDir += Dir
+
+ return RealPath
+
+ ## ParseOption
+ #
+ # Parse options
+ #
+ def ParseOption(self):
+ (Options, Target) = self.EccOptionParser()
+
+ if Options.Workspace:
+ os.environ["WORKSPACE"] = Options.Workspace
+
+ # Check workspace environment
+ if "WORKSPACE" not in os.environ:
+ EdkLogger.error("ECC", BuildToolError.ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",
+ ExtraData="WORKSPACE")
+ else:
+ EccGlobalData.gWorkspace = os.path.normpath(os.getenv("WORKSPACE"))
+ if not os.path.exists(EccGlobalData.gWorkspace):
+ EdkLogger.error("ECC", BuildToolError.FILE_NOT_FOUND, ExtraData="WORKSPACE = %s" % EccGlobalData.gWorkspace)
+ os.environ["WORKSPACE"] = EccGlobalData.gWorkspace
+ # Set log level
+ self.SetLogLevel(Options)
+
+ # Set other options
+ if Options.ConfigFile is not None:
+ self.ConfigFile = Options.ConfigFile
+ if Options.OutputFile is not None:
+ self.OutputFile = Options.OutputFile
+ if Options.ReportFile is not None:
+ self.ReportFile = Options.ReportFile
+ if Options.ExceptionFile is not None:
+ self.ExceptionFile = Options.ExceptionFile
+ if Options.Target is not None:
+ if not os.path.isdir(Options.Target):
+ EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Target [%s] does NOT exist" % Options.Target)
+ else:
+ EccGlobalData.gTarget = self.GetRealPathCase(os.path.normpath(Options.Target))
+ else:
+ EdkLogger.warn("Ecc", EdkLogger.ECC_ERROR, "The target source tree was not specified, using current WORKSPACE instead!")
+ EccGlobalData.gTarget = os.path.normpath(os.getenv("WORKSPACE"))
+ if Options.keepdatabase is not None:
+ self.IsInit = False
+ if Options.metadata is not None and Options.sourcecode is not None:
+ EdkLogger.error("ECC", BuildToolError.OPTION_CONFLICT, ExtraData="-m and -s can't be specified at one time")
+ if Options.metadata is not None:
+ self.ScanSourceCode = False
+ if Options.sourcecode is not None:
+ self.ScanMetaData = False
+ if Options.folders is not None:
+ self.OnlyScan = True
+
+ ## SetLogLevel
+ #
+ # Set current log level of the tool based on args
+ #
+ # @param Option: The option list including log level setting
+ #
+ def SetLogLevel(self, Option):
+ if Option.verbose is not None:
+ EdkLogger.SetLevel(EdkLogger.VERBOSE)
+ elif Option.quiet is not None:
+ EdkLogger.SetLevel(EdkLogger.QUIET)
+ elif Option.debug is not None:
+ EdkLogger.SetLevel(Option.debug + 1)
+ else:
+ EdkLogger.SetLevel(EdkLogger.INFO)
+
+ ## Parse command line options
+ #
+ # Using standard Python module optparse to parse command line option of this tool.
+ #
+ # @retval Opt A optparse.Values object containing the parsed options
+ # @retval Args Target of build command
+ #
+ def EccOptionParser(self):
+ Parser = OptionParser(description = self.Copyright, version = self.Version, prog = "Ecc.exe", usage = "%prog [options]")
+ Parser.add_option("-t", "--target sourcepath", action="store", type="string", dest='Target',
+ help="Check all files under the target workspace.")
+ Parser.add_option("-c", "--config filename", action="store", type="string", dest="ConfigFile",
+ help="Specify a configuration file. Defaultly use config.ini under ECC tool directory.")
+ Parser.add_option("-o", "--outfile filename", action="store", type="string", dest="OutputFile",
+ help="Specify the name of an output file, if and only if one filename was specified.")
+ Parser.add_option("-r", "--reportfile filename", action="store", type="string", dest="ReportFile",
+ help="Specify the name of an report file, if and only if one filename was specified.")
+ Parser.add_option("-e", "--exceptionfile filename", action="store", type="string", dest="ExceptionFile",
+ help="Specify the name of an exception file, if and only if one filename was specified.")
+ Parser.add_option("-m", "--metadata", action="store_true", type=None, help="Only scan meta-data files information if this option is specified.")
+ Parser.add_option("-s", "--sourcecode", action="store_true", type=None, help="Only scan source code files information if this option is specified.")
+ Parser.add_option("-k", "--keepdatabase", action="store_true", type=None, help="The existing Ecc database will not be cleaned except report information if this option is specified.")
+ Parser.add_option("-l", "--log filename", action="store", dest="LogFile", help="""If specified, the tool should emit the changes that
+ were made by the tool after printing the result message.
+ If filename, the emit to the file, otherwise emit to
+ standard output. If no modifications were made, then do not
+ create a log file, or output a log message.""")
+ Parser.add_option("-q", "--quiet", action="store_true", type=None, help="Disable all messages except FATAL ERRORS.")
+ Parser.add_option("-v", "--verbose", action="store_true", type=None, help="Turn on verbose output with informational messages printed, "\
+ "including library instances selected, final dependency expression, "\
+ "and warning messages, etc.")
+ Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
+ Parser.add_option("-w", "--workspace", action="store", type="string", dest='Workspace', help="Specify workspace.")
+ Parser.add_option("-f", "--folders", action="store_true", type=None, help="Only scanning specified folders which are recorded in config.ini file.")
+
+ (Opt, Args)=Parser.parse_args()
+
+ return (Opt, Args)
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ # Initialize log system
+ EdkLogger.Initialize()
+ EdkLogger.IsRaiseError = False
+
+ StartTime = time.perf_counter()
+ Ecc = Ecc()
+ FinishTime = time.perf_counter()
+
+ BuildDuration = time.strftime("%M:%S", time.gmtime(int(round(FinishTime - StartTime))))
+ EdkLogger.quiet("\n%s [%s]" % (time.strftime("%H:%M:%S, %b.%d %Y", time.localtime()), BuildDuration))
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/EccToolError.py b/roms/edk2/BaseTools/Source/Python/Ecc/EccToolError.py
new file mode 100644
index 000000000..0ff3b4267
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/EccToolError.py
@@ -0,0 +1,204 @@
+## @file
+# Standardized Error Handling infrastructures.
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+ERROR_GENERAL_CHECK_ALL = 1000
+ERROR_GENERAL_CHECK_NO_TAB = 1001
+ERROR_GENERAL_CHECK_INDENTATION = 1002
+ERROR_GENERAL_CHECK_LINE = 1003
+ERROR_GENERAL_CHECK_NO_ASM = 1004
+ERROR_GENERAL_CHECK_NO_PROGMA = 1005
+ERROR_GENERAL_CHECK_CARRIAGE_RETURN = 1006
+ERROR_GENERAL_CHECK_FILE_EXISTENCE = 1007
+ERROR_GENERAL_CHECK_NON_ACSII = 1008
+ERROR_GENERAL_CHECK_UNI = 1009
+ERROR_GENERAL_CHECK_UNI_HELP_INFO = 1010
+ERROR_GENERAL_CHECK_INVALID_LINE_ENDING = 1011
+ERROR_GENERAL_CHECK_TRAILING_WHITE_SPACE_LINE = 1012
+
+ERROR_SPACE_CHECK_ALL = 2000
+
+ERROR_PREDICATE_EXPRESSION_CHECK_ALL = 3000
+ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE = 3001
+ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR = 3002
+ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE = 3003
+
+ERROR_HEADER_CHECK_ALL = 4000
+ERROR_HEADER_CHECK_FILE = 4001
+ERROR_HEADER_CHECK_FUNCTION = 4002
+
+ERROR_C_FUNCTION_LAYOUT_CHECK_ALL = 5000
+ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE = 5001
+ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER = 5002
+ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME = 5003
+ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE = 5004
+ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY = 5005
+ERROR_C_FUNCTION_LAYOUT_CHECK_DATA_DECLARATION = 5006
+ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE = 5007
+ERROR_C_FUNCTION_LAYOUT_CHECK_NO_STATIC = 5008
+ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_2 = 5009
+ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3 = 5010
+
+ERROR_INCLUDE_FILE_CHECK_ALL = 6000
+ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_1 = 6001
+ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_2 = 6002
+ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_3 = 6003
+ERROR_INCLUDE_FILE_CHECK_DATA = 6004
+ERROR_INCLUDE_FILE_CHECK_NAME = 6005
+
+ERROR_DECLARATION_DATA_TYPE_CHECK_ALL = 7000
+ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE = 7001
+ERROR_DECLARATION_DATA_TYPE_CHECK_IN_OUT_MODIFIER = 7002
+ERROR_DECLARATION_DATA_TYPE_CHECK_EFI_API_MODIFIER = 7003
+ERROR_DECLARATION_DATA_TYPE_CHECK_ENUMERATED_TYPE = 7004
+ERROR_DECLARATION_DATA_TYPE_CHECK_STRUCTURE_DECLARATION = 7005
+ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE = 7007
+ERROR_DECLARATION_DATA_TYPE_CHECK_UNION_TYPE = 7006
+ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE = 7008
+
+ERROR_NAMING_CONVENTION_CHECK_ALL = 8000
+ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT = 8001
+ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT = 8002
+ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT = 8003
+ERROR_NAMING_CONVENTION_CHECK_PATH_NAME = 8004
+ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME = 8005
+ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME = 8006
+ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE = 8007
+
+ERROR_DOXYGEN_CHECK_ALL = 9000
+ERROR_DOXYGEN_CHECK_FILE_HEADER = 9001
+ERROR_DOXYGEN_CHECK_FUNCTION_HEADER = 9002
+ERROR_DOXYGEN_CHECK_COMMENT_DESCRIPTION = 9003
+ERROR_DOXYGEN_CHECK_COMMENT_FORMAT = 9004
+ERROR_DOXYGEN_CHECK_COMMAND = 9005
+
+ERROR_META_DATA_FILE_CHECK_ALL = 10000
+ERROR_META_DATA_FILE_CHECK_PATH_NAME = 10001
+ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1 = 10002
+ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2 = 10003
+ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT = 10004
+ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_ORDER = 10005
+ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE = 10006
+ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF = 10007
+ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE = 10008
+ERROR_META_DATA_FILE_CHECK_PCD_FLASH = 10009
+ERROR_META_DATA_FILE_CHECK_PCD_NO_USE = 10010
+ERROR_META_DATA_FILE_CHECK_DUPLICATE_GUID = 10011
+ERROR_META_DATA_FILE_CHECK_DUPLICATE_PROTOCOL = 10012
+ERROR_META_DATA_FILE_CHECK_DUPLICATE_PPI = 10013
+ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE = 10014
+ERROR_META_DATA_FILE_CHECK_PCD_TYPE = 10015
+ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION = 10016
+ERROR_META_DATA_FILE_CHECK_LIBRARY_NAME_DUPLICATE = 10017
+ERROR_META_DATA_FILE_CHECK_FORMAT_GUID = 10018
+ERROR_META_DATA_FILE_CHECK_FORMAT_PROTOCOL = 10019
+ERROR_META_DATA_FILE_CHECK_FORMAT_PPI = 10020
+ERROR_META_DATA_FILE_CHECK_FORMAT_PCD = 10021
+ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED = 10022
+
+ERROR_SPELLING_CHECK_ALL = 11000
+
+ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE = 12001
+
+gEccErrorMessage = {
+ ERROR_GENERAL_CHECK_ALL : "",
+ ERROR_GENERAL_CHECK_NO_TAB : "'TAB' character is not allowed in source code, please replace each 'TAB' with two spaces.",
+ ERROR_GENERAL_CHECK_INDENTATION : "Indentation does not follow coding style",
+ ERROR_GENERAL_CHECK_LINE : "The width of each line does not follow coding style",
+ ERROR_GENERAL_CHECK_NO_ASM : "There should be no use of _asm in the source file",
+ ERROR_GENERAL_CHECK_NO_PROGMA : """There should be no use of "#progma" in source file except "#pragma pack(#)\"""",
+ ERROR_GENERAL_CHECK_CARRIAGE_RETURN : "There should be a carriage return at the end of the file",
+ ERROR_GENERAL_CHECK_FILE_EXISTENCE : "File not found",
+ ERROR_GENERAL_CHECK_NON_ACSII : "File has invalid Non-ACSII char",
+ ERROR_GENERAL_CHECK_UNI : "File is not a valid UTF-16 UNI file",
+ ERROR_GENERAL_CHECK_UNI_HELP_INFO : "UNI file that is associated by INF or DEC file need define the prompt and help information.",
+ ERROR_GENERAL_CHECK_INVALID_LINE_ENDING : "Only CRLF (Carriage Return Line Feed) is allowed to line ending.",
+ ERROR_GENERAL_CHECK_TRAILING_WHITE_SPACE_LINE : "There should be no trailing white space in one line.",
+
+ ERROR_SPACE_CHECK_ALL : "",
+
+ ERROR_PREDICATE_EXPRESSION_CHECK_ALL : "",
+ ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE : "Boolean values and variable type BOOLEAN should not use explicit comparisons to TRUE or FALSE",
+ ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR : "Non-Boolean comparisons should use a compare operator (==, !=, >, < >=, <=)",
+ ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE : "A comparison of any pointer to zero must be done via the NULL type",
+
+ ERROR_HEADER_CHECK_ALL : "",
+ ERROR_HEADER_CHECK_FILE : "File header doesn't exist",
+ ERROR_HEADER_CHECK_FUNCTION : "Function header doesn't exist",
+
+ ERROR_C_FUNCTION_LAYOUT_CHECK_ALL : "",
+ ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE : "Return type of a function should exist and in the first line",
+ ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER : "Any optional functional modifiers should exist and next to the return type",
+ ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME : """Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces""",
+ ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE : "Function prototypes in include files have the same form as function definitions",
+ ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_2 : "Function prototypes in include files have different parameter number with function definitions",
+ ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3 : "Function prototypes in include files have different parameter modifier with function definitions",
+ ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY : "The body of a function should be contained by open and close braces that must be in the first column",
+ ERROR_C_FUNCTION_LAYOUT_CHECK_DATA_DECLARATION : "The data declarations should be the first code in a module",
+ ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE : "There should be no initialization of a variable as part of its declaration",
+ ERROR_C_FUNCTION_LAYOUT_CHECK_NO_STATIC : "There should be no use of STATIC for functions",
+
+ ERROR_INCLUDE_FILE_CHECK_ALL : "",
+ ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_1 : "All include file contents should be guarded by a #ifndef statement.",
+ ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_2 : "The #ifndef must be the first line of code following the file header comment",
+ ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_3 : "The #endif must appear on the last line in the file",
+ ERROR_INCLUDE_FILE_CHECK_DATA : "Include files should contain only public or only private data and cannot contain code or define data variables",
+ ERROR_INCLUDE_FILE_CHECK_NAME : "No permission for the include file with same names",
+
+ ERROR_DECLARATION_DATA_TYPE_CHECK_ALL : "",
+ ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE : "There should be no use of int, unsigned, char, void, long in any .c, .h or .asl files",
+ ERROR_DECLARATION_DATA_TYPE_CHECK_IN_OUT_MODIFIER : """The modifiers IN, OUT, OPTIONAL, and UNALIGNED should be used only to qualify arguments to a function and should not appear in a data type declaration""",
+ ERROR_DECLARATION_DATA_TYPE_CHECK_EFI_API_MODIFIER : "The EFIAPI modifier should be used at the entry of drivers, events, and member functions of protocols",
+ ERROR_DECLARATION_DATA_TYPE_CHECK_ENUMERATED_TYPE : "Enumerated Type should have a 'typedef' and the name must be in capital letters",
+ ERROR_DECLARATION_DATA_TYPE_CHECK_STRUCTURE_DECLARATION : "Structure Type should have a 'typedef' and the name must be in capital letters",
+ ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE : "No permission for the structure with same names",
+ ERROR_DECLARATION_DATA_TYPE_CHECK_UNION_TYPE : "Union Type should have a 'typedef' and the name must be in capital letters",
+ ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE : "Complex types should be typedef-ed",
+
+ ERROR_NAMING_CONVENTION_CHECK_ALL : "",
+ ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT : "Only capital letters are allowed to be used for #define declarations",
+ ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT : "Only capital letters are allowed to be used for typedef declarations",
+ ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT : "The #ifndef at the start of an include file should use both prefix and postfix underscore characters, '_'",
+ ERROR_NAMING_CONVENTION_CHECK_PATH_NAME : """Path name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters""",
+ ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME : """Variable name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters 4. Global variable name must start with a 'g'""",
+ ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME : """Function name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters""",
+ ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE : "There should be no use of short (single character) variable names",
+
+ ERROR_DOXYGEN_CHECK_ALL : "",
+ ERROR_DOXYGEN_CHECK_FILE_HEADER : "The file headers should follow Doxygen special documentation blocks in section 2.3.5",
+ ERROR_DOXYGEN_CHECK_FUNCTION_HEADER : "The function headers should follow Doxygen special documentation blocks in section 2.3.5",
+ ERROR_DOXYGEN_CHECK_COMMENT_DESCRIPTION : """The first line of text in a comment block should be a brief description of the element being documented and the brief description must end with a period.""",
+ ERROR_DOXYGEN_CHECK_COMMENT_FORMAT : "For comment line with '///< ... text ...' format, if it is used, it should be after the code section",
+ ERROR_DOXYGEN_CHECK_COMMAND : "Only Doxygen commands '@bug', '@todo', '@example', '@file', '@attention', '@param', '@post', '@pre', '@retval', '@return', '@sa', '@since', '@test', '@note', '@par', '@endcode', '@code', '@{', '@}' are allowed to mark the code",
+
+ ERROR_META_DATA_FILE_CHECK_ALL : "",
+ ERROR_META_DATA_FILE_CHECK_PATH_NAME : "The file defined in meta-data does not exist",
+ ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1 : "A library instances defined for a given module (or dependent library instance) doesn't match the module's type.",
+ ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2 : "A library instance must specify the Supported Module Types in its INF file",
+ ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT : "A library instance must be defined for all dependent library classes",
+ ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_ORDER : "The library Instances specified by the LibraryClasses sections should be listed in order of dependencies",
+ ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE : "There should be no unnecessary inclusion of library classes in the INF file",
+ ERROR_META_DATA_FILE_CHECK_LIBRARY_NAME_DUPLICATE : "Duplicate Library Class Name found",
+ ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF : "An INF file is specified in the FDF file, but not in the DSC file, therefore the INF file must be for a Binary module only",
+ ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE : "Duplicate PCDs found",
+ ERROR_META_DATA_FILE_CHECK_PCD_FLASH : "PCD settings in the FDF file should only be related to flash",
+ ERROR_META_DATA_FILE_CHECK_PCD_NO_USE : "There should be no PCDs declared in INF files that are not specified in in either a DSC or FDF file",
+ ERROR_META_DATA_FILE_CHECK_DUPLICATE_GUID : "Duplicate GUID found",
+ ERROR_META_DATA_FILE_CHECK_DUPLICATE_PROTOCOL : "Duplicate PROTOCOL found",
+ ERROR_META_DATA_FILE_CHECK_DUPLICATE_PPI : "Duplicate PPI found",
+ ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE : "No used module files found",
+ ERROR_META_DATA_FILE_CHECK_PCD_TYPE : "Wrong C code function used for this kind of PCD",
+ ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION : "Module file has FILE_GUID collision with other module file",
+ ERROR_META_DATA_FILE_CHECK_FORMAT_GUID : "Wrong GUID Format used in Module file",
+ ERROR_META_DATA_FILE_CHECK_FORMAT_PROTOCOL : "Wrong Protocol Format used in Module file",
+ ERROR_META_DATA_FILE_CHECK_FORMAT_PPI : "Wrong Ppi Format used in Module file",
+ ERROR_META_DATA_FILE_CHECK_FORMAT_PCD : "Wrong Pcd Format used in Module file",
+ ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED : "Not defined LibraryClass used in the Module file.",
+ ERROR_SPELLING_CHECK_ALL : "",
+
+ ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE : "SMM communication function may use wrong parameter type",
+ }
+
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/Exception.py b/roms/edk2/BaseTools/Source/Python/Ecc/Exception.py
new file mode 100644
index 000000000..9251b8d7c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/Exception.py
@@ -0,0 +1,83 @@
+## @file
+# This file is used to parse exception items found by ECC tool
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+from Ecc.Xml.XmlRoutines import *
+import Common.LongFilePathOs as os
+
+# ExceptionXml to parse Exception Node of XML file
+class ExceptionXml(object):
+ def __init__(self):
+ self.KeyWord = ''
+ self.ErrorID = ''
+ self.FilePath = ''
+
+ def FromXml(self, Item, Key):
+ self.KeyWord = XmlElement(Item, '%s/KeyWord' % Key)
+ self.ErrorID = XmlElement(Item, '%s/ErrorID' % Key)
+ self.FilePath = os.path.normpath(XmlElement(Item, '%s/FilePath' % Key))
+
+ def __str__(self):
+ return 'ErrorID = %s KeyWord = %s FilePath = %s' %(self.ErrorID, self.KeyWord, self.FilePath)
+
+# ExceptionListXml to parse Exception Node List of XML file
+class ExceptionListXml(object):
+ def __init__(self):
+ self.List = []
+
+ def FromXmlFile(self, FilePath):
+ XmlContent = XmlParseFile(FilePath)
+ for Item in XmlList(XmlContent, '/ExceptionList/Exception'):
+ Exp = ExceptionXml()
+ Exp.FromXml(Item, 'Exception')
+ self.List.append(Exp)
+
+ def ToList(self):
+ RtnList = []
+ for Item in self.List:
+ #RtnList.append((Item.ErrorID, Item.KeyWord, Item.FilePath))
+ RtnList.append((Item.ErrorID, Item.KeyWord))
+
+ return RtnList
+
+ def __str__(self):
+ RtnStr = ''
+ if self.List:
+ for Item in self.List:
+ RtnStr = RtnStr + str(Item) + '\n'
+ return RtnStr
+
+# A class to check exception
+class ExceptionCheck(object):
+ def __init__(self, FilePath = None):
+ self.ExceptionList = []
+ self.ExceptionListXml = ExceptionListXml()
+ self.LoadExceptionListXml(FilePath)
+
+ def LoadExceptionListXml(self, FilePath):
+ if FilePath and os.path.isfile(FilePath):
+ self.ExceptionListXml.FromXmlFile(FilePath)
+ self.ExceptionList = self.ExceptionListXml.ToList()
+
+ def IsException(self, ErrorID, KeyWord, FileID=-1):
+ if (str(ErrorID), KeyWord.replace('\r\n', '\n')) in self.ExceptionList:
+ return True
+ else:
+ return False
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ El = ExceptionCheck('C:\\Hess\\Project\\BuildTool\\src\\Ecc\\exception.xml')
+ print(El.ExceptionList)
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/FileProfile.py b/roms/edk2/BaseTools/Source/Python/Ecc/FileProfile.py
new file mode 100644
index 000000000..eedf263b1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/FileProfile.py
@@ -0,0 +1,51 @@
+## @file
+# fragments of source file
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+
+from __future__ import absolute_import
+import re
+import Common.LongFilePathOs as os
+from Ecc.ParserWarning import Warning
+from Common.LongFilePathSupport import OpenLongFilePath as open
+
+CommentList = []
+PPDirectiveList = []
+PredicateExpressionList = []
+FunctionDefinitionList = []
+VariableDeclarationList = []
+EnumerationDefinitionList = []
+StructUnionDefinitionList = []
+TypedefDefinitionList = []
+FunctionCallingList = []
+
+## record file data when parsing source
+#
+# May raise Exception when opening file.
+#
+class FileProfile :
+
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param FileName The file that to be parsed
+ #
+ def __init__(self, FileName):
+ self.FileLinesList = []
+ self.FileLinesListFromFile = []
+ try:
+ fsock = open(FileName, "r")
+ try:
+ self.FileLinesListFromFile = fsock.readlines()
+ finally:
+ fsock.close()
+
+ except IOError:
+ raise Warning("Error when opening file %s" % FileName)
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/MetaDataParser.py b/roms/edk2/BaseTools/Source/Python/Ecc/MetaDataParser.py
new file mode 100644
index 000000000..0fd9b6c4e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/MetaDataParser.py
@@ -0,0 +1,267 @@
+## @file
+# This file is used to define common parser functions for meta-data
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import absolute_import
+import Common.LongFilePathOs as os
+from CommonDataClass.DataClass import *
+from Ecc.EccToolError import *
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+from Ecc import EccGlobalData
+import re
+## Get the include path list for a source file
+#
+# 1. Find the source file belongs to which inf file
+# 2. Find the inf's package
+# 3. Return the include path list of the package
+#
+def GetIncludeListOfFile(WorkSpace, Filepath, Db):
+ IncludeList = []
+ Filepath = os.path.normpath(Filepath)
+ SqlCommand = """
+ select Value1, FullPath from Inf, File where Inf.Model = %s and Inf.BelongsToFile in(
+ select distinct B.BelongsToFile from File as A left join Inf as B
+ where A.ID = B.BelongsToFile and B.Model = %s and (A.Path || '%s' || B.Value1) = '%s')
+ and Inf.BelongsToFile = File.ID""" \
+ % (MODEL_META_DATA_PACKAGE, MODEL_EFI_SOURCE_FILE, '\\', Filepath)
+ RecordSet = Db.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ DecFullPath = os.path.normpath(mws.join(WorkSpace, Record[0]))
+ InfFullPath = os.path.normpath(mws.join(WorkSpace, Record[1]))
+ (DecPath, DecName) = os.path.split(DecFullPath)
+ (InfPath, InfName) = os.path.split(InfFullPath)
+ SqlCommand = """select Value1 from Dec where BelongsToFile =
+ (select ID from File where FullPath = '%s') and Model = %s""" \
+ % (DecFullPath, MODEL_EFI_INCLUDE)
+ NewRecordSet = Db.TblDec.Exec(SqlCommand)
+ if InfPath not in IncludeList:
+ IncludeList.append(InfPath)
+ for NewRecord in NewRecordSet:
+ IncludePath = os.path.normpath(os.path.join(DecPath, NewRecord[0]))
+ if IncludePath not in IncludeList:
+ IncludeList.append(IncludePath)
+
+ return IncludeList
+
+## Get the file list
+#
+# Search table file and find all specific type files
+#
+def GetFileList(FileModel, Db):
+ FileList = []
+ SqlCommand = """select FullPath from File where Model = %s""" % str(FileModel)
+ RecordSet = Db.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ FileList.append(Record[0])
+
+ return FileList
+
+## Get the table list
+#
+# Search table file and find all small tables
+#
+def GetTableList(FileModelList, Table, Db):
+ TableList = []
+ SqlCommand = """select ID from File where Model in %s""" % str(FileModelList)
+ RecordSet = Db.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ TableName = Table + str(Record[0])
+ TableList.append(TableName)
+
+ return TableList
+
+## ParseHeaderCommentSection
+#
+# Parse Header comment section lines, extract Abstract, Description, Copyright
+# , License lines
+#
+# @param CommentList: List of (Comment, LineNumber)
+# @param FileName: FileName of the comment
+#
+def ParseHeaderCommentSection(CommentList, FileName = None):
+
+ Abstract = ''
+ Description = ''
+ Copyright = ''
+ License = ''
+ EndOfLine = "\n"
+ STR_HEADER_COMMENT_START = "@file"
+
+ #
+ # used to indicate the state of processing header comment section of dec,
+ # inf files
+ #
+ HEADER_COMMENT_NOT_STARTED = -1
+ HEADER_COMMENT_STARTED = 0
+ HEADER_COMMENT_FILE = 1
+ HEADER_COMMENT_ABSTRACT = 2
+ HEADER_COMMENT_DESCRIPTION = 3
+ HEADER_COMMENT_COPYRIGHT = 4
+ HEADER_COMMENT_LICENSE = 5
+ HEADER_COMMENT_END = 6
+ #
+ # first find the last copyright line
+ #
+ Last = 0
+ HeaderCommentStage = HEADER_COMMENT_NOT_STARTED
+ for Index in range(len(CommentList) - 1, 0, -1):
+ Line = CommentList[Index][0]
+ if _IsCopyrightLine(Line):
+ Last = Index
+ break
+
+ for Item in CommentList:
+ Line = Item[0]
+ LineNo = Item[1]
+
+ if not Line.startswith('#') and Line:
+ SqlStatement = """ select ID from File where FullPath like '%s'""" % FileName
+ ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ Msg = 'Comment must start with #'
+ EccGlobalData.gDb.TblReport.Insert(ERROR_DOXYGEN_CHECK_FILE_HEADER, Msg, "File", Result[0])
+ Comment = CleanString2(Line)[1]
+ Comment = Comment.strip()
+ #
+ # if there are blank lines between License or Description, keep them as they would be
+ # indication of different block; or in the position that Abstract should be, also keep it
+ # as it indicates that no abstract
+ #
+ if not Comment and HeaderCommentStage not in [HEADER_COMMENT_LICENSE, \
+ HEADER_COMMENT_DESCRIPTION, HEADER_COMMENT_ABSTRACT]:
+ continue
+
+ if HeaderCommentStage == HEADER_COMMENT_NOT_STARTED:
+ if Comment.startswith(STR_HEADER_COMMENT_START):
+ HeaderCommentStage = HEADER_COMMENT_ABSTRACT
+ else:
+ License += Comment + EndOfLine
+ else:
+ if HeaderCommentStage == HEADER_COMMENT_ABSTRACT:
+ #
+ # in case there is no abstract and description
+ #
+ if not Comment:
+ Abstract = ''
+ HeaderCommentStage = HEADER_COMMENT_DESCRIPTION
+ elif _IsCopyrightLine(Comment):
+ Copyright += Comment + EndOfLine
+ HeaderCommentStage = HEADER_COMMENT_COPYRIGHT
+ else:
+ Abstract += Comment + EndOfLine
+ HeaderCommentStage = HEADER_COMMENT_DESCRIPTION
+ elif HeaderCommentStage == HEADER_COMMENT_DESCRIPTION:
+ #
+ # in case there is no description
+ #
+ if _IsCopyrightLine(Comment):
+ Copyright += Comment + EndOfLine
+ HeaderCommentStage = HEADER_COMMENT_COPYRIGHT
+ else:
+ Description += Comment + EndOfLine
+ elif HeaderCommentStage == HEADER_COMMENT_COPYRIGHT:
+ if _IsCopyrightLine(Comment):
+ Copyright += Comment + EndOfLine
+ else:
+ #
+ # Contents after copyright line are license, those non-copyright lines in between
+ # copyright line will be discarded
+ #
+ if LineNo > Last:
+ if License:
+ License += EndOfLine
+ License += Comment + EndOfLine
+ HeaderCommentStage = HEADER_COMMENT_LICENSE
+ else:
+ if not Comment and not License:
+ continue
+ License += Comment + EndOfLine
+
+ if not Copyright.strip():
+ SqlStatement = """ select ID from File where FullPath like '%s'""" % FileName
+ ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ Msg = 'Header comment section must have copyright information'
+ EccGlobalData.gDb.TblReport.Insert(ERROR_DOXYGEN_CHECK_FILE_HEADER, Msg, "File", Result[0])
+
+ if not License.strip():
+ SqlStatement = """ select ID from File where FullPath like '%s'""" % FileName
+ ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ Msg = 'Header comment section must have license information'
+ EccGlobalData.gDb.TblReport.Insert(ERROR_DOXYGEN_CHECK_FILE_HEADER, Msg, "File", Result[0])
+
+ if not Abstract.strip() or Abstract.find('Component description file') > -1:
+ SqlStatement = """ select ID from File where FullPath like '%s'""" % FileName
+ ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ Msg = 'Header comment section must have Abstract information.'
+ EccGlobalData.gDb.TblReport.Insert(ERROR_DOXYGEN_CHECK_FILE_HEADER, Msg, "File", Result[0])
+
+ return Abstract.strip(), Description.strip(), Copyright.strip(), License.strip()
+
+## _IsCopyrightLine
+# check whether current line is copyright line, the criteria is whether there is case insensitive keyword "Copyright"
+# followed by zero or more white space characters followed by a "(" character
+#
+# @param LineContent: the line need to be checked
+# @return: True if current line is copyright line, False else
+#
+def _IsCopyrightLine (LineContent):
+ LineContent = LineContent.upper()
+ Result = False
+
+ ReIsCopyrightRe = re.compile(r"""(^|\s)COPYRIGHT *\(""", re.DOTALL)
+ if ReIsCopyrightRe.search(LineContent):
+ Result = True
+
+ return Result
+
+
+## CleanString2
+#
+# Split comments in a string
+# Remove spaces
+#
+# @param Line: The string to be cleaned
+# @param CommentCharacter: Comment char, used to ignore comment content,
+# default is DataType.TAB_COMMENT_SPLIT
+#
+def CleanString2(Line, CommentCharacter='#', AllowCppStyleComment=False):
+ #
+ # remove whitespace
+ #
+ Line = Line.strip()
+ #
+ # Replace EDK1's comment character
+ #
+ if AllowCppStyleComment:
+ Line = Line.replace('//', CommentCharacter)
+ #
+ # separate comments and statements
+ #
+ LineParts = Line.split(CommentCharacter, 1)
+ #
+ # remove whitespace again
+ #
+ Line = LineParts[0].strip()
+ if len(LineParts) > 1:
+ Comment = LineParts[1].strip()
+ #
+ # Remove prefixed and trailing comment characters
+ #
+ Start = 0
+ End = len(Comment)
+ while Start < End and Comment.startswith(CommentCharacter, Start, End):
+ Start += 1
+ while End >= 0 and Comment.endswith(CommentCharacter, Start, End):
+ End -= 1
+ Comment = Comment[Start:End]
+ Comment = Comment.strip()
+ else:
+ Comment = ''
+
+ return Line, Comment
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py b/roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
new file mode 100644
index 000000000..1d7f6eb10
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
@@ -0,0 +1,213 @@
+## @file
+# This file is used to create/update/query/erase table for files
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+import Common.LongFilePathOs as os
+
+import Common.EdkLogger as EdkLogger
+from CommonDataClass import DataClass
+from CommonDataClass.DataClass import FileClass
+
+## Convert to SQL required string format
+def ConvertToSqlString(StringList):
+ return map(lambda s: "'" + s.replace("'", "''") + "'", StringList)
+
+## TableFile
+#
+# This class defined a common table
+#
+# @param object: Inherited from object class
+#
+# @param Cursor: Cursor of the database
+# @param TableName: Name of the table
+#
+class Table(object):
+ _COLUMN_ = ''
+ _ID_STEP_ = 1
+ _ID_MAX_ = 0x80000000
+ _DUMMY_ = 0
+
+ def __init__(self, Cursor, Name='', IdBase=0, Temporary=False):
+ self.Cur = Cursor
+ self.Table = Name
+ self.IdBase = int(IdBase)
+ self.ID = int(IdBase)
+ self.Temporary = Temporary
+
+ def __str__(self):
+ return self.Table
+
+ ## Create table
+ #
+ # Create a table
+ #
+ def Create(self, NewTable=True):
+ if NewTable:
+ self.Drop()
+
+ if self.Temporary:
+ SqlCommand = """create temp table IF NOT EXISTS %s (%s)""" % (self.Table, self._COLUMN_)
+ else:
+ SqlCommand = """create table IF NOT EXISTS %s (%s)""" % (self.Table, self._COLUMN_)
+ EdkLogger.debug(EdkLogger.DEBUG_8, SqlCommand)
+ self.Cur.execute(SqlCommand)
+ self.ID = self.GetId()
+
+ ## Insert table
+ #
+ # Insert a record into a table
+ #
+ def Insert(self, *Args):
+ self.ID = self.ID + self._ID_STEP_
+ if self.ID >= (self.IdBase + self._ID_MAX_):
+ self.ID = self.IdBase + self._ID_STEP_
+ Values = ", ".join(str(Arg) for Arg in Args)
+ SqlCommand = "insert into %s values(%s, %s)" % (self.Table, self.ID, Values)
+ EdkLogger.debug(EdkLogger.DEBUG_5, SqlCommand)
+ self.Cur.execute(SqlCommand)
+ return self.ID
+
+ ## Query table
+ #
+ # Query all records of the table
+ #
+ def Query(self):
+ SqlCommand = """select * from %s""" % self.Table
+ self.Cur.execute(SqlCommand)
+ for Rs in self.Cur:
+ EdkLogger.verbose(str(Rs))
+ TotalCount = self.GetId()
+
+ ## Drop a table
+ #
+ # Drop the table
+ #
+ def Drop(self):
+ SqlCommand = """drop table IF EXISTS %s""" % self.Table
+ try:
+ self.Cur.execute(SqlCommand)
+ except Exception as e:
+ print("An error occurred when Drop a table:", e.args[0])
+
+ ## Get count
+ #
+ # Get a count of all records of the table
+ #
+ # @retval Count: Total count of all records
+ #
+ def GetCount(self):
+ SqlCommand = """select count(ID) from %s""" % self.Table
+ Record = self.Cur.execute(SqlCommand).fetchall()
+ return Record[0][0]
+
+ def GetId(self):
+ SqlCommand = """select max(ID) from %s""" % self.Table
+ Record = self.Cur.execute(SqlCommand).fetchall()
+ Id = Record[0][0]
+ if Id is None:
+ Id = self.IdBase
+ return Id
+
+ ## Init the ID of the table
+ #
+ # Init the ID of the table
+ #
+ def InitID(self):
+ self.ID = self.GetId()
+
+ ## Exec
+ #
+ # Exec Sql Command, return result
+ #
+ # @param SqlCommand: The SqlCommand to be executed
+ #
+ # @retval RecordSet: The result after executed
+ #
+ def Exec(self, SqlCommand):
+ EdkLogger.debug(EdkLogger.DEBUG_5, SqlCommand)
+ self.Cur.execute(SqlCommand)
+ RecordSet = self.Cur.fetchall()
+ return RecordSet
+
+ def SetEndFlag(self):
+ pass
+
+ def IsIntegral(self):
+ Result = self.Exec("select min(ID) from %s" % (self.Table))
+ if Result[0][0] != -1:
+ return False
+ return True
+
+ def GetAll(self):
+ return self.Exec("select * from %s where ID > 0 order by ID" % (self.Table))
+
+
+## TableDataModel
+#
+# This class defined a table used for data model
+#
+# @param object: Inherited from object class
+#
+#
+class TableDataModel(Table):
+ _COLUMN_ = """
+ ID INTEGER PRIMARY KEY,
+ CrossIndex INTEGER NOT NULL,
+ Name VARCHAR NOT NULL,
+ Description VARCHAR
+ """
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor, 'DataModel')
+
+ ## Insert table
+ #
+ # Insert a record into table DataModel
+ #
+ # @param ID: ID of a ModelType
+ # @param CrossIndex: CrossIndex of a ModelType
+ # @param Name: Name of a ModelType
+ # @param Description: Description of a ModelType
+ #
+ def Insert(self, CrossIndex, Name, Description):
+ (Name, Description) = ConvertToSqlString((Name, Description))
+ return Table.Insert(self, CrossIndex, Name, Description)
+
+ ## Init table
+ #
+ # Create all default records of table DataModel
+ #
+ def InitTable(self):
+ EdkLogger.verbose("\nInitialize table DataModel started ...")
+ Count = self.GetCount()
+ if Count is not None and Count != 0:
+ return
+ for Item in DataClass.MODEL_LIST:
+ CrossIndex = Item[1]
+ Name = Item[0]
+ Description = Item[0]
+ self.Insert(CrossIndex, Name, Description)
+ EdkLogger.verbose("Initialize table DataModel ... DONE!")
+
+ ## Get CrossIndex
+ #
+ # Get a model's cross index from its name
+ #
+ # @param ModelName: Name of the model
+ # @retval CrossIndex: CrossIndex of the model
+ #
+ def GetCrossIndex(self, ModelName):
+ CrossIndex = -1
+ SqlCommand = """select CrossIndex from DataModel where name = '""" + ModelName + """'"""
+ self.Cur.execute(SqlCommand)
+ for Item in self.Cur:
+ CrossIndex = Item[0]
+
+ return CrossIndex
+
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py b/roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
new file mode 100644
index 000000000..9c27c8e16
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
@@ -0,0 +1,2089 @@
+## @file
+# This file is used to parse meta files
+#
+# Copyright (c) 2008 - 2020, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.LongFilePathOs as os
+import re
+import time
+import copy
+from hashlib import md5
+import Common.EdkLogger as EdkLogger
+import Common.GlobalData as GlobalData
+import Ecc.EccGlobalData as EccGlobalData
+import Ecc.EccToolError as EccToolError
+
+from CommonDataClass.DataClass import *
+from Common.DataType import *
+from Common.StringUtils import *
+from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, PathClass, AnalyzePcdData
+from Common.Expression import *
+from CommonDataClass.Exceptions import *
+
+from Ecc.MetaFileWorkspace.MetaFileTable import MetaFileStorage
+from GenFds.FdfParser import FdfParser
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.LongFilePathSupport import CodecOpenLongFilePath
+
+## A decorator used to parse macro definition
+def ParseMacro(Parser):
+ def MacroParser(self):
+ Match = GlobalData.gMacroDefPattern.match(self._CurrentLine)
+ if not Match:
+ # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method
+ Parser(self)
+ return
+
+ TokenList = GetSplitValueList(self._CurrentLine[Match.end(1):], TAB_EQUAL_SPLIT, 1)
+ # Syntax check
+ if not TokenList[0]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No macro name given",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ if len(TokenList) < 2:
+ TokenList.append('')
+
+ Type = Match.group(1)
+ Name, Value = TokenList
+ # Global macros can be only defined via environment variable
+ if Name in GlobalData.gGlobalDefines:
+ EdkLogger.error('Parser', FORMAT_INVALID, "%s can only be defined via environment variable" % Name,
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ # Only upper case letters, digit and '_' are allowed
+ if not GlobalData.gMacroNamePattern.match(Name):
+ EdkLogger.error('Parser', FORMAT_INVALID, "The macro name must be in the pattern [A-Z][A-Z0-9_]*",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+
+ Value = ReplaceMacro(Value, self._Macros)
+ self._ItemType = MODEL_META_DATA_DEFINE
+ # DEFINE defined macros
+ if Type == TAB_DSC_DEFINES_DEFINE:
+ if isinstance(self, DecParser):
+ if MODEL_META_DATA_HEADER in self._SectionType:
+ self._FileLocalMacros[Name] = Value
+ else:
+ for Scope in self._Scope:
+ self._SectionsMacroDict.setdefault((Scope[2], Scope[0], Scope[1]), {})[Name] = Value
+ elif self._SectionType == MODEL_META_DATA_HEADER:
+ self._FileLocalMacros[Name] = Value
+ else:
+ SectionDictKey = self._SectionType, self._Scope[0][0], self._Scope[0][1]
+ if SectionDictKey not in self._SectionsMacroDict:
+ self._SectionsMacroDict[SectionDictKey] = {}
+ SectionLocalMacros = self._SectionsMacroDict[SectionDictKey]
+ SectionLocalMacros[Name] = Value
+ # EDK_GLOBAL defined macros
+ elif not isinstance(self, DscParser):
+ EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used in .dsc file",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ elif self._SectionType != MODEL_META_DATA_HEADER:
+ EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used under [Defines] section",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ elif (Name in self._FileLocalMacros) and (self._FileLocalMacros[Name] != Value):
+ EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL defined a macro with the same name and different value as one defined by 'DEFINE'",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+
+ self._ValueList = [Type, Name, Value]
+
+ return MacroParser
+
+## Base class of parser
+#
+# This class is used for derivation purpose. The specific parser for one kind
+# type file must derive this class and implement some public interfaces.
+#
+# @param FilePath The path of platform description file
+# @param FileType The raw data of DSC file
+# @param Table Database used to retrieve module/package information
+# @param Macros Macros used for replacement in file
+# @param Owner Owner ID (for sub-section parsing)
+# @param From ID from which the data comes (for !INCLUDE directive)
+#
+class MetaFileParser(object):
+ # data type (file content) for specific file type
+ DataType = {}
+
+ # Parser objects used to implement singleton
+ MetaFiles = {}
+
+ ## Factory method
+ #
+ # One file, one parser object. This factory method makes sure that there's
+ # only one object constructed for one meta file.
+ #
+ # @param Class class object of real AutoGen class
+ # (InfParser, DecParser or DscParser)
+ # @param FilePath The path of meta file
+ # @param *args The specific class related parameters
+ # @param **kwargs The specific class related dict parameters
+ #
+ def __new__(Class, FilePath, *args, **kwargs):
+ if FilePath in Class.MetaFiles:
+ return Class.MetaFiles[FilePath]
+ else:
+ ParserObject = super(MetaFileParser, Class).__new__(Class)
+ Class.MetaFiles[FilePath] = ParserObject
+ return ParserObject
+
+ ## Constructor of MetaFileParser
+ #
+ # Initialize object of MetaFileParser
+ #
+ # @param FilePath The path of platform description file
+ # @param FileType The raw data of DSC file
+ # @param Table Database used to retrieve module/package information
+ # @param Macros Macros used for replacement in file
+ # @param Owner Owner ID (for sub-section parsing)
+ # @param From ID from which the data comes (for !INCLUDE directive)
+ #
+ def __init__(self, FilePath, FileType, Table, Owner=-1, From=-1):
+ self._Table = Table
+ self._RawTable = Table
+ self._FileType = FileType
+ self.MetaFile = FilePath
+ self._Defines = {}
+ self._FileLocalMacros = {}
+ self._SectionsMacroDict = {}
+
+ # for recursive parsing
+ self._Owner = [Owner]
+ self._From = From
+
+ # parsr status for parsing
+ self._ValueList = ['', '', '', '', '']
+ self._Scope = []
+ self._LineIndex = 0
+ self._CurrentLine = ''
+ self._SectionType = MODEL_UNKNOWN
+ self._SectionName = ''
+ self._InSubsection = False
+ self._SubsectionType = MODEL_UNKNOWN
+ self._SubsectionName = ''
+ self._ItemType = MODEL_UNKNOWN
+ self._LastItem = -1
+ self._Enabled = 0
+ self._Finished = False
+ self._PostProcessed = False
+ # Different version of meta-file has different way to parse.
+ self._Version = 0
+ # UNI object and extra UNI object
+ self._UniObj = None
+ self._UniExtraObj = None
+
+ ## Store the parsed data in table
+ def _Store(self, *Args):
+ return self._Table.Insert(*Args)
+
+ ## Virtual method for starting parse
+ def Start(self):
+ raise NotImplementedError
+
+ ## Notify a post-process is needed
+ def DoPostProcess(self):
+ self._PostProcessed = False
+
+ ## Set parsing complete flag in both class and table
+ def _Done(self):
+ self._Finished = True
+ ## Do not set end flag when processing included files
+ if self._From == -1:
+ self._Table.SetEndFlag()
+
+ def _PostProcess(self):
+ self._PostProcessed = True
+
+ ## Get the parse complete flag
+ def _GetFinished(self):
+ return self._Finished
+
+ ## Set the complete flag
+ def _SetFinished(self, Value):
+ self._Finished = Value
+
+ ## Use [] style to query data in table, just for readability
+ #
+ # DataInfo = [data_type, scope1(arch), scope2(platform/moduletype)]
+ #
+ def __getitem__(self, DataInfo):
+ if not isinstance(DataInfo, type(())):
+ DataInfo = (DataInfo,)
+
+ # Parse the file first, if necessary
+ if not self._Finished:
+ if self._RawTable.IsIntegrity():
+ self._Finished = True
+ else:
+ self._Table = self._RawTable
+ self._PostProcessed = False
+ self.Start()
+
+ # No specific ARCH or Platform given, use raw data
+ if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] is None):
+ return self._RawTable.Query(*DataInfo)
+
+ # Do post-process if necessary
+ if not self._PostProcessed:
+ self._PostProcess()
+
+ return self._Table.Query(*DataInfo)
+
+ ## Data parser for the common format in different type of file
+ #
+ # The common format in the meatfile is like
+ #
+ # xxx1 | xxx2 | xxx3
+ #
+ @ParseMacro
+ def _CommonParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ self._ValueList[0:len(TokenList)] = TokenList
+
+ ## Data parser for the format in which there's path
+ #
+ # Only path can have macro used. So we need to replace them before use.
+ #
+ @ParseMacro
+ def _PathParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ self._ValueList[0:len(TokenList)] = TokenList
+ # Don't do macro replacement for dsc file at this point
+ if not isinstance(self, DscParser):
+ Macros = self._Macros
+ self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList]
+
+ ## Skip unsupported data
+ def _Skip(self):
+ if self._SectionName == TAB_USER_EXTENSIONS.upper() and self._CurrentLine.upper().endswith('.UNI'):
+ if EccGlobalData.gConfig.UniCheckHelpInfo == '1' or EccGlobalData.gConfig.UniCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ ExtraUni = self._CurrentLine.strip()
+ ExtraUniFile = os.path.join(os.path.dirname(self.MetaFile), ExtraUni)
+ IsModuleUni = self.MetaFile.upper().endswith('.INF')
+ self._UniExtraObj = UniParser(ExtraUniFile, IsExtraUni=True, IsModuleUni=IsModuleUni)
+ self._UniExtraObj.Start()
+ else:
+ EdkLogger.warn("Parser", "Unrecognized content", File=self.MetaFile,
+ Line=self._LineIndex + 1, ExtraData=self._CurrentLine);
+ self._ValueList[0:1] = [self._CurrentLine]
+
+ ## Section header parser
+ #
+ # The section header is always in following format:
+ #
+ # [section_name.arch<.platform|module_type>]
+ #
+ def _SectionHeaderParser(self):
+ self._Scope = []
+ self._SectionName = ''
+ ArchList = set()
+ for Item in GetSplitValueList(self._CurrentLine[1:-1], TAB_COMMA_SPLIT):
+ if Item == '':
+ continue
+ ItemList = GetSplitValueList(Item, TAB_SPLIT)
+ # different section should not mix in one section
+ if self._SectionName != '' and self._SectionName != ItemList[0].upper():
+ EdkLogger.error('Parser', FORMAT_INVALID, "Different section names in the same section",
+ File=self.MetaFile, Line=self._LineIndex+1, ExtraData=self._CurrentLine)
+ self._SectionName = ItemList[0].upper()
+ if self._SectionName in self.DataType:
+ self._SectionType = self.DataType[self._SectionName]
+ else:
+ self._SectionType = MODEL_UNKNOWN
+ EdkLogger.warn("Parser", "Unrecognized section", File=self.MetaFile,
+ Line=self._LineIndex+1, ExtraData=self._CurrentLine)
+ # S1 is always Arch
+ if len(ItemList) > 1:
+ S1 = ItemList[1].upper()
+ else:
+ S1 = 'COMMON'
+ ArchList.add(S1)
+ # S2 may be Platform or ModuleType
+ if len(ItemList) > 2:
+ S2 = ItemList[2].upper()
+ else:
+ S2 = 'COMMON'
+ self._Scope.append([S1, S2])
+
+ # 'COMMON' must not be used with specific ARCHs at the same section
+ if 'COMMON' in ArchList and len(ArchList) > 1:
+ EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs",
+ File=self.MetaFile, Line=self._LineIndex+1, ExtraData=self._CurrentLine)
+ # If the section information is needed later, it should be stored in database
+ self._ValueList[0] = self._SectionName
+
+ ## [defines] section parser
+ @ParseMacro
+ def _DefineParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+ self._ValueList[1:len(TokenList)] = TokenList
+ if not self._ValueList[1]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No name specified",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ if not self._ValueList[2]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+
+ self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList]
+ Name, Value = self._ValueList[1], self._ValueList[2]
+ # Sometimes, we need to make differences between EDK and EDK2 modules
+ if Name == 'INF_VERSION':
+ try:
+ self._Version = int(Value, 0)
+ except:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ elif Name == 'MODULE_UNI_FILE':
+ UniFile = os.path.join(os.path.dirname(self.MetaFile), Value)
+ if os.path.exists(UniFile):
+ self._UniObj = UniParser(UniFile, IsExtraUni=False, IsModuleUni=True)
+ self._UniObj.Start()
+ else:
+ EdkLogger.error('Parser', FILE_NOT_FOUND, "Module UNI file %s is missing." % Value,
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1,
+ RaiseError=False)
+ elif Name == 'PACKAGE_UNI_FILE':
+ UniFile = os.path.join(os.path.dirname(self.MetaFile), Value)
+ if os.path.exists(UniFile):
+ self._UniObj = UniParser(UniFile, IsExtraUni=False, IsModuleUni=False)
+
+ if isinstance(self, InfParser) and self._Version < 0x00010005:
+ # EDK module allows using defines as macros
+ self._FileLocalMacros[Name] = Value
+ self._Defines[Name] = Value
+
+ ## [BuildOptions] section parser
+ @ParseMacro
+ def _BuildOptionParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+ TokenList2 = GetSplitValueList(TokenList[0], ':', 1)
+ if len(TokenList2) == 2:
+ self._ValueList[0] = TokenList2[0] # toolchain family
+ self._ValueList[1] = TokenList2[1] # keys
+ else:
+ self._ValueList[1] = TokenList[0]
+ if len(TokenList) == 2 and not isinstance(self, DscParser): # value
+ self._ValueList[2] = ReplaceMacro(TokenList[1], self._Macros)
+
+ if self._ValueList[1].count('_') != 4:
+ EdkLogger.error(
+ 'Parser',
+ FORMAT_INVALID,
+ "'%s' must be in format of <TARGET>_<TOOLCHAIN>_<ARCH>_<TOOL>_FLAGS" % self._ValueList[1],
+ ExtraData=self._CurrentLine,
+ File=self.MetaFile,
+ Line=self._LineIndex+1
+ )
+
+ def _GetMacros(self):
+ Macros = {}
+ Macros.update(self._FileLocalMacros)
+ Macros.update(self._GetApplicableSectionMacro())
+ return Macros
+
+
+ ## Get section Macros that are applicable to current line, which may come from other sections
+ ## that share the same name while scope is wider
+ def _GetApplicableSectionMacro(self):
+ Macros = {}
+ for Scope1, Scope2 in [("COMMON", "COMMON"), ("COMMON", self._Scope[0][1]),
+ (self._Scope[0][0], "COMMON"), (self._Scope[0][0], self._Scope[0][1])]:
+ if (self._SectionType, Scope1, Scope2) in self._SectionsMacroDict:
+ Macros.update(self._SectionsMacroDict[(self._SectionType, Scope1, Scope2)])
+ return Macros
+
+ _SectionParser = {}
+ Finished = property(_GetFinished, _SetFinished)
+ _Macros = property(_GetMacros)
+
+
+## INF file parser class
+#
+# @param FilePath The path of platform description file
+# @param FileType The raw data of DSC file
+# @param Table Database used to retrieve module/package information
+# @param Macros Macros used for replacement in file
+#
+class InfParser(MetaFileParser):
+ # INF file supported data types (one type per section)
+ DataType = {
+ TAB_UNKNOWN.upper() : MODEL_UNKNOWN,
+ TAB_INF_DEFINES.upper() : MODEL_META_DATA_HEADER,
+ TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE,
+ TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION,
+ TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE,
+ TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE,
+ TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS,
+ TAB_PACKAGES.upper() : MODEL_META_DATA_PACKAGE,
+ TAB_NMAKE.upper() : MODEL_META_DATA_NMAKE,
+ TAB_INF_FIXED_PCD.upper() : MODEL_PCD_FIXED_AT_BUILD,
+ TAB_INF_PATCH_PCD.upper() : MODEL_PCD_PATCHABLE_IN_MODULE,
+ TAB_INF_FEATURE_PCD.upper() : MODEL_PCD_FEATURE_FLAG,
+ TAB_INF_PCD_EX.upper() : MODEL_PCD_DYNAMIC_EX,
+ TAB_INF_PCD.upper() : MODEL_PCD_DYNAMIC,
+ TAB_SOURCES.upper() : MODEL_EFI_SOURCE_FILE,
+ TAB_GUIDS.upper() : MODEL_EFI_GUID,
+ TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL,
+ TAB_PPIS.upper() : MODEL_EFI_PPI,
+ TAB_DEPEX.upper() : MODEL_EFI_DEPEX,
+ TAB_BINARIES.upper() : MODEL_EFI_BINARY_FILE,
+ TAB_USER_EXTENSIONS.upper() : MODEL_META_DATA_USER_EXTENSION
+ }
+
+ ## Constructor of InfParser
+ #
+ # Initialize object of InfParser
+ #
+ # @param FilePath The path of module description file
+ # @param FileType The raw data of DSC file
+ # @param Table Database used to retrieve module/package information
+ # @param Macros Macros used for replacement in file
+ #
+ def __init__(self, FilePath, FileType, Table):
+ # prevent re-initialization
+ if hasattr(self, "_Table"):
+ return
+ MetaFileParser.__init__(self, FilePath, FileType, Table)
+ self.TblFile = EccGlobalData.gDb.TblFile
+ self.FileID = -1
+
+ ## Parser starter
+ def Start(self):
+ NmakeLine = ''
+ Content = ''
+ Usage = ''
+ try:
+ Content = open(str(self.MetaFile), 'r').readlines()
+ except:
+ EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile)
+ #
+ # Insert a record for file
+ #
+ Filename = NormPath(self.MetaFile)
+ FileID = self.TblFile.GetFileId(Filename)
+ if FileID:
+ self.FileID = FileID
+ else:
+ self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_INF)
+
+ # parse the file line by line
+ IsFindBlockComment = False
+
+ for Index in range(0, len(Content)):
+ if self._SectionType in [MODEL_EFI_GUID,
+ MODEL_EFI_PROTOCOL,
+ MODEL_EFI_PPI,
+ MODEL_PCD_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC]:
+ Line = Content[Index].strip()
+ if Line.startswith(TAB_SPECIAL_COMMENT):
+ Usage += ' ' + Line[Line.find(TAB_SPECIAL_COMMENT):]
+ continue
+ elif Line.startswith(TAB_COMMENT_SPLIT):
+ continue
+ elif Line.find(TAB_COMMENT_SPLIT) > 0:
+ Usage += ' ' + Line[Line.find(TAB_COMMENT_SPLIT):]
+ Line = Line[:Line.find(TAB_COMMENT_SPLIT)]
+ else:
+ # skip empty, commented, block commented lines
+ Line = CleanString(Content[Index], AllowCppStyleComment=True)
+ Usage = ''
+ NextLine = ''
+ if Index + 1 < len(Content):
+ NextLine = CleanString(Content[Index + 1])
+ if Line == '':
+ continue
+ if Line.find(DataType.TAB_COMMENT_EDK_START) > -1:
+ IsFindBlockComment = True
+ continue
+ if Line.find(DataType.TAB_COMMENT_EDK_END) > -1:
+ IsFindBlockComment = False
+ continue
+ if IsFindBlockComment:
+ continue
+
+ self._LineIndex = Index
+ self._CurrentLine = Line
+
+ # section header
+ if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END:
+ self._SectionHeaderParser()
+ # Check invalid sections
+ if self._Version < 0x00010005:
+ if self._SectionType in [MODEL_META_DATA_BUILD_OPTION,
+ MODEL_EFI_LIBRARY_CLASS,
+ MODEL_META_DATA_PACKAGE,
+ MODEL_PCD_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC,
+ MODEL_EFI_GUID,
+ MODEL_EFI_PROTOCOL,
+ MODEL_EFI_PPI,
+ MODEL_META_DATA_USER_EXTENSION]:
+ EdkLogger.error('Parser', FORMAT_INVALID,
+ "Section [%s] is not allowed in inf file without version" % (self._SectionName),
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ elif self._SectionType in [MODEL_EFI_INCLUDE,
+ MODEL_EFI_LIBRARY_INSTANCE,
+ MODEL_META_DATA_NMAKE]:
+ EdkLogger.error('Parser', FORMAT_INVALID,
+ "Section [%s] is not allowed in inf file with version 0x%08x" % (self._SectionName, self._Version),
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ continue
+ # merge two lines specified by '\' in section NMAKE
+ elif self._SectionType == MODEL_META_DATA_NMAKE:
+ if Line[-1] == '\\':
+ if NextLine == '':
+ self._CurrentLine = NmakeLine + Line[0:-1]
+ NmakeLine = ''
+ else:
+ if NextLine[0] == TAB_SECTION_START and NextLine[-1] == TAB_SECTION_END:
+ self._CurrentLine = NmakeLine + Line[0:-1]
+ NmakeLine = ''
+ else:
+ NmakeLine = NmakeLine + ' ' + Line[0:-1]
+ continue
+ else:
+ self._CurrentLine = NmakeLine + Line
+ NmakeLine = ''
+
+ # section content
+ self._ValueList = ['', '', '']
+ # parse current line, result will be put in self._ValueList
+ self._SectionParser[self._SectionType](self)
+ if self._ValueList is None or self._ItemType == MODEL_META_DATA_DEFINE:
+ self._ItemType = -1
+ continue
+ #
+ # Model, Value1, Value2, Value3, Arch, Platform, BelongsToItem=-1,
+ # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1
+ #
+ self._ValueList[0] = self._ValueList[0].replace('/', '\\')
+ Usage = Usage.strip()
+ for Arch, Platform in self._Scope:
+ self._Store(self._SectionType,
+ self._ValueList[0],
+ self._ValueList[1],
+ self._ValueList[2],
+ Arch,
+ Platform,
+ self._Owner[-1],
+ self.FileID,
+ self._LineIndex+1,
+ -1,
+ self._LineIndex+1,
+ -1,
+ 0,
+ Usage
+ )
+ Usage = ''
+ if IsFindBlockComment:
+ EdkLogger.error("Parser", FORMAT_INVALID, "Open block comments (starting with /*) are expected to end with */",
+ File=self.MetaFile)
+ self._Done()
+
+ ## Data parser for the format in which there's path
+ #
+ # Only path can have macro used. So we need to replace them before use.
+ #
+ def _IncludeParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ self._ValueList[0:len(TokenList)] = TokenList
+ Macros = self._Macros
+ if Macros:
+ for Index in range(0, len(self._ValueList)):
+ Value = self._ValueList[Index]
+ if not Value:
+ continue
+
+ self._ValueList[Index] = ReplaceMacro(Value, Macros)
+
+ ## Parse [Sources] section
+ #
+ # Only path can have macro used. So we need to replace them before use.
+ #
+ @ParseMacro
+ def _SourceFileParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ self._ValueList[0:len(TokenList)] = TokenList
+ Macros = self._Macros
+ # For Acpi tables, remove macro like ' TABLE_NAME=Sata1'
+ if 'COMPONENT_TYPE' in Macros:
+ if self._Defines['COMPONENT_TYPE'].upper() == 'ACPITABLE':
+ self._ValueList[0] = GetSplitValueList(self._ValueList[0], ' ', 1)[0]
+ if self._Defines['BASE_NAME'] == 'Microcode':
+ pass
+ self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList]
+
+ ## Parse [Binaries] section
+ #
+ # Only path can have macro used. So we need to replace them before use.
+ #
+ @ParseMacro
+ def _BinaryFileParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 2)
+ if len(TokenList) < 2:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No file type or path specified",
+ ExtraData=self._CurrentLine + " (<FileType> | <FilePath> [| <Target>])",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ if not TokenList[0]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No file type specified",
+ ExtraData=self._CurrentLine + " (<FileType> | <FilePath> [| <Target>])",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ if not TokenList[1]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No file path specified",
+ ExtraData=self._CurrentLine + " (<FileType> | <FilePath> [| <Target>])",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ self._ValueList[0:len(TokenList)] = TokenList
+ self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros)
+
+ ## [nmake] section parser (Edk.x style only)
+ def _NmakeParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+ self._ValueList[0:len(TokenList)] = TokenList
+ # remove macros
+ self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros)
+ # remove self-reference in macro setting
+ #self._ValueList[1] = ReplaceMacro(self._ValueList[1], {self._ValueList[0]:''})
+
+ ## [FixedPcd], [FeaturePcd], [PatchPcd], [Pcd] and [PcdEx] sections parser
+ @ParseMacro
+ def _PcdParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
+ ValueList = GetSplitValueList(TokenList[0], TAB_SPLIT)
+ if len(ValueList) != 2:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Illegal token space GUID and PCD name format",
+ ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<PcdCName>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ self._ValueList[0:1] = ValueList
+ if len(TokenList) > 1:
+ self._ValueList[2] = TokenList[1]
+ if self._ValueList[0] == '' or self._ValueList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",
+ ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<PcdCName>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+
+ # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0.
+ if self._ValueList[2] != '':
+ InfPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
+ if InfPcdValueList[0] in ['True', 'true', 'TRUE']:
+ self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '1', 1);
+ elif InfPcdValueList[0] in ['False', 'false', 'FALSE']:
+ self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1);
+
+ ## [depex] section parser
+ @ParseMacro
+ def _DepexParser(self):
+ self._ValueList[0:1] = [self._CurrentLine]
+
+ _SectionParser = {
+ MODEL_UNKNOWN : MetaFileParser._Skip,
+ MODEL_META_DATA_HEADER : MetaFileParser._DefineParser,
+ MODEL_META_DATA_BUILD_OPTION : MetaFileParser._BuildOptionParser,
+ MODEL_EFI_INCLUDE : _IncludeParser, # for Edk.x modules
+ MODEL_EFI_LIBRARY_INSTANCE : MetaFileParser._CommonParser, # for Edk.x modules
+ MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser,
+ MODEL_META_DATA_PACKAGE : MetaFileParser._PathParser,
+ MODEL_META_DATA_NMAKE : _NmakeParser, # for Edk.x modules
+ MODEL_PCD_FIXED_AT_BUILD : _PcdParser,
+ MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser,
+ MODEL_PCD_FEATURE_FLAG : _PcdParser,
+ MODEL_PCD_DYNAMIC_EX : _PcdParser,
+ MODEL_PCD_DYNAMIC : _PcdParser,
+ MODEL_EFI_SOURCE_FILE : _SourceFileParser,
+ MODEL_EFI_GUID : MetaFileParser._CommonParser,
+ MODEL_EFI_PROTOCOL : MetaFileParser._CommonParser,
+ MODEL_EFI_PPI : MetaFileParser._CommonParser,
+ MODEL_EFI_DEPEX : _DepexParser,
+ MODEL_EFI_BINARY_FILE : _BinaryFileParser,
+ MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip,
+ }
+
+## DSC file parser class
+#
+# @param FilePath The path of platform description file
+# @param FileType The raw data of DSC file
+# @param Table Database used to retrieve module/package information
+# @param Macros Macros used for replacement in file
+# @param Owner Owner ID (for sub-section parsing)
+# @param From ID from which the data comes (for !INCLUDE directive)
+#
+class DscParser(MetaFileParser):
+ # DSC file supported data types (one type per section)
+ DataType = {
+ TAB_SKUIDS.upper() : MODEL_EFI_SKU_ID,
+ TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE,
+ TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS,
+ TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION,
+ TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : MODEL_PCD_FIXED_AT_BUILD,
+ TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : MODEL_PCD_PATCHABLE_IN_MODULE,
+ TAB_PCDS_FEATURE_FLAG_NULL.upper() : MODEL_PCD_FEATURE_FLAG,
+ TAB_PCDS_DYNAMIC_DEFAULT_NULL.upper() : MODEL_PCD_DYNAMIC_DEFAULT,
+ TAB_PCDS_DYNAMIC_HII_NULL.upper() : MODEL_PCD_DYNAMIC_HII,
+ TAB_PCDS_DYNAMIC_VPD_NULL.upper() : MODEL_PCD_DYNAMIC_VPD,
+ TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL.upper() : MODEL_PCD_DYNAMIC_EX_DEFAULT,
+ TAB_PCDS_DYNAMIC_EX_HII_NULL.upper() : MODEL_PCD_DYNAMIC_EX_HII,
+ TAB_PCDS_DYNAMIC_EX_VPD_NULL.upper() : MODEL_PCD_DYNAMIC_EX_VPD,
+ TAB_COMPONENTS.upper() : MODEL_META_DATA_COMPONENT,
+ TAB_DSC_DEFINES.upper() : MODEL_META_DATA_HEADER,
+ TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE,
+ TAB_DSC_DEFINES_EDKGLOBAL : MODEL_META_DATA_GLOBAL_DEFINE,
+ TAB_INCLUDE.upper() : MODEL_META_DATA_INCLUDE,
+ TAB_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+ TAB_IF_DEF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
+ TAB_IF_N_DEF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF,
+ TAB_ELSE_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF,
+ TAB_ELSE.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE,
+ TAB_END_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF,
+ TAB_ERROR.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR,
+ }
+
+ # Valid names in define section
+ DefineKeywords = [
+ "DSC_SPECIFICATION",
+ "PLATFORM_NAME",
+ "PLATFORM_GUID",
+ "PLATFORM_VERSION",
+ "SKUID_IDENTIFIER",
+ "PCD_INFO_GENERATION",
+ "SUPPORTED_ARCHITECTURES",
+ "BUILD_TARGETS",
+ "OUTPUT_DIRECTORY",
+ "FLASH_DEFINITION",
+ "BUILD_NUMBER",
+ "RFC_LANGUAGES",
+ "ISO_LANGUAGES",
+ "TIME_STAMP_FILE",
+ "VPD_TOOL_GUID",
+ "FIX_LOAD_TOP_MEMORY_ADDRESS"
+ ]
+
+ SubSectionDefineKeywords = [
+ "FILE_GUID"
+ ]
+
+ SymbolPattern = ValueExpression.SymbolPattern
+
+ ## Constructor of DscParser
+ #
+ # Initialize object of DscParser
+ #
+ # @param FilePath The path of platform description file
+ # @param FileType The raw data of DSC file
+ # @param Table Database used to retrieve module/package information
+ # @param Macros Macros used for replacement in file
+ # @param Owner Owner ID (for sub-section parsing)
+ # @param From ID from which the data comes (for !INCLUDE directive)
+ #
+ def __init__(self, FilePath, FileType, Table, Owner=-1, From=-1):
+ # prevent re-initialization
+ if hasattr(self, "_Table"):
+ return
+ MetaFileParser.__init__(self, FilePath, FileType, Table, Owner, From)
+ self._Version = 0x00010005 # Only EDK2 dsc file is supported
+ # to store conditional directive evaluation result
+ self._DirectiveStack = []
+ self._DirectiveEvalStack = []
+ self._Enabled = 1
+
+ # Final valid replacable symbols
+ self._Symbols = {}
+ #
+ # Map the ID between the original table and new table to track
+ # the owner item
+ #
+ self._IdMapping = {-1:-1}
+
+ self.TblFile = EccGlobalData.gDb.TblFile
+ self.FileID = -1
+
+ ## Parser starter
+ def Start(self):
+ Content = ''
+ try:
+ Content = open(str(self.MetaFile.Path), 'r').readlines()
+ except:
+ EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile)
+ #
+ # Insert a record for file
+ #
+ Filename = NormPath(self.MetaFile.Path)
+ FileID = self.TblFile.GetFileId(Filename)
+ if FileID:
+ self.FileID = FileID
+ else:
+ self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_DSC)
+
+
+ for Index in range(0, len(Content)):
+ Line = CleanString(Content[Index])
+ # skip empty line
+ if Line == '':
+ continue
+
+ self._CurrentLine = Line
+ self._LineIndex = Index
+ if self._InSubsection and self._Owner[-1] == -1:
+ self._Owner.append(self._LastItem)
+
+ # section header
+ if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END:
+ self._SectionType = MODEL_META_DATA_SECTION_HEADER
+ # subsection ending
+ elif Line[0] == '}' and self._InSubsection:
+ self._InSubsection = False
+ self._SubsectionType = MODEL_UNKNOWN
+ self._SubsectionName = ''
+ self._Owner[-1] = -1
+ continue
+ # subsection header
+ elif Line[0] == TAB_OPTION_START and Line[-1] == TAB_OPTION_END:
+ self._SubsectionType = MODEL_META_DATA_SUBSECTION_HEADER
+ # directive line
+ elif Line[0] == '!':
+ self._DirectiveParser()
+ continue
+
+ if self._InSubsection:
+ SectionType = self._SubsectionType
+ else:
+ SectionType = self._SectionType
+ self._ItemType = SectionType
+
+ self._ValueList = ['', '', '']
+ self._SectionParser[SectionType](self)
+ if self._ValueList is None:
+ continue
+ #
+ # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,
+ # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1
+ #
+ for Arch, ModuleType in self._Scope:
+ self._LastItem = self._Store(
+ self._ItemType,
+ self._ValueList[0],
+ self._ValueList[1],
+ self._ValueList[2],
+ Arch,
+ ModuleType,
+ self._Owner[-1],
+ self.FileID,
+ self._From,
+ self._LineIndex+1,
+ -1,
+ self._LineIndex+1,
+ -1,
+ self._Enabled
+ )
+
+ if self._DirectiveStack:
+ Type, Line, Text = self._DirectiveStack[-1]
+ EdkLogger.error('Parser', FORMAT_INVALID, "No matching '!endif' found",
+ ExtraData=Text, File=self.MetaFile, Line=Line)
+ self._Done()
+
+ ## <subsection_header> parser
+ def _SubsectionHeaderParser(self):
+ self._SubsectionName = self._CurrentLine[1:-1].upper()
+ if self._SubsectionName in self.DataType:
+ self._SubsectionType = self.DataType[self._SubsectionName]
+ else:
+ self._SubsectionType = MODEL_UNKNOWN
+ EdkLogger.warn("Parser", "Unrecognized sub-section", File=self.MetaFile,
+ Line=self._LineIndex+1, ExtraData=self._CurrentLine)
+ self._ValueList[0] = self._SubsectionName
+
+ ## Directive statement parser
+ def _DirectiveParser(self):
+ self._ValueList = ['', '', '']
+ TokenList = GetSplitValueList(self._CurrentLine, ' ', 1)
+ self._ValueList[0:len(TokenList)] = TokenList
+
+ # Syntax check
+ DirectiveName = self._ValueList[0].upper()
+ if DirectiveName not in self.DataType:
+ EdkLogger.error("Parser", FORMAT_INVALID, "Unknown directive [%s]" % DirectiveName,
+ File=self.MetaFile, Line=self._LineIndex+1)
+ if DirectiveName in ['!IF', '!IFDEF', '!INCLUDE', '!IFNDEF', '!ELSEIF'] and self._ValueList[1] == '':
+ EdkLogger.error("Parser", FORMAT_INVALID, "Missing expression",
+ File=self.MetaFile, Line=self._LineIndex+1,
+ ExtraData=self._CurrentLine)
+
+ ItemType = self.DataType[DirectiveName]
+ if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF:
+ # Remove all directives between !if and !endif, including themselves
+ while self._DirectiveStack:
+ # Remove any !else or !elseif
+ DirectiveInfo = self._DirectiveStack.pop()
+ if DirectiveInfo[0] in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]:
+ break
+ else:
+ EdkLogger.error("Parser", FORMAT_INVALID, "Redundant '!endif'",
+ File=self.MetaFile, Line=self._LineIndex+1,
+ ExtraData=self._CurrentLine)
+ elif ItemType != MODEL_META_DATA_INCLUDE:
+ # Break if there's a !else is followed by a !elseif
+ if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF and \
+ self._DirectiveStack and \
+ self._DirectiveStack[-1][0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE:
+ EdkLogger.error("Parser", FORMAT_INVALID, "'!elseif' after '!else'",
+ File=self.MetaFile, Line=self._LineIndex+1,
+ ExtraData=self._CurrentLine)
+ self._DirectiveStack.append((ItemType, self._LineIndex+1, self._CurrentLine))
+ elif self._From > 0:
+ EdkLogger.error('Parser', FORMAT_INVALID,
+ "No '!include' allowed in included file",
+ ExtraData=self._CurrentLine, File=self.MetaFile,
+ Line=self._LineIndex+1)
+
+ #
+ # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,
+ # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1
+ #
+ self._LastItem = self._Store(
+ ItemType,
+ self._ValueList[0],
+ self._ValueList[1],
+ self._ValueList[2],
+ 'COMMON',
+ 'COMMON',
+ self._Owner[-1],
+ self.FileID,
+ self._From,
+ self._LineIndex+1,
+ -1,
+ self._LineIndex+1,
+ -1,
+ 0
+ )
+
+ ## [defines] section parser
+ @ParseMacro
+ def _DefineParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+ self._ValueList[1:len(TokenList)] = TokenList
+
+ # Syntax check
+ if not self._ValueList[1]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No name specified",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ if not self._ValueList[2]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ if (not self._ValueList[1] in self.DefineKeywords and
+ (self._InSubsection and self._ValueList[1] not in self.SubSectionDefineKeywords)):
+ EdkLogger.error('Parser', FORMAT_INVALID,
+ "Unknown keyword found: %s. "
+ "If this is a macro you must "
+ "add it as a DEFINE in the DSC" % self._ValueList[1],
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ self._Defines[self._ValueList[1]] = self._ValueList[2]
+ self._ItemType = self.DataType[TAB_DSC_DEFINES.upper()]
+
+ @ParseMacro
+ def _SkuIdParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ if len(TokenList) != 2:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '<Integer>|<UiName>'",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ self._ValueList[0:len(TokenList)] = TokenList
+
+ ## Parse Edk style of library modules
+ def _LibraryInstanceParser(self):
+ self._ValueList[0] = self._CurrentLine
+
+ ## PCD sections parser
+ #
+ # [PcdsFixedAtBuild]
+ # [PcdsPatchableInModule]
+ # [PcdsFeatureFlag]
+ # [PcdsDynamicEx
+ # [PcdsDynamicExDefault]
+ # [PcdsDynamicExVpd]
+ # [PcdsDynamicExHii]
+ # [PcdsDynamic]
+ # [PcdsDynamicDefault]
+ # [PcdsDynamicVpd]
+ # [PcdsDynamicHii]
+ #
+ @ParseMacro
+ def _PcdParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
+ self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT)
+ if len(TokenList) == 2:
+ self._ValueList[2] = TokenList[1]
+ if self._ValueList[0] == '' or self._ValueList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",
+ ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<TokenCName>|<PcdValue>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ if self._ValueList[2] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No PCD value given",
+ ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<TokenCName>|<PcdValue>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0.
+ DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
+ if DscPcdValueList[0] in ['True', 'true', 'TRUE']:
+ self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '1', 1);
+ elif DscPcdValueList[0] in ['False', 'false', 'FALSE']:
+ self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '0', 1);
+
+ ## [components] section parser
+ @ParseMacro
+ def _ComponentParser(self):
+ if self._CurrentLine[-1] == '{':
+ self._ValueList[0] = self._CurrentLine[0:-1].strip()
+ self._InSubsection = True
+ else:
+ self._ValueList[0] = self._CurrentLine
+
+ ## [LibraryClasses] section
+ @ParseMacro
+ def _LibraryClassParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ if len(TokenList) < 2:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No library class or instance specified",
+ ExtraData=self._CurrentLine + " (<LibraryClassName>|<LibraryInstancePath>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ if TokenList[0] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No library class specified",
+ ExtraData=self._CurrentLine + " (<LibraryClassName>|<LibraryInstancePath>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ if TokenList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No library instance specified",
+ ExtraData=self._CurrentLine + " (<LibraryClassName>|<LibraryInstancePath>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+
+ self._ValueList[0:len(TokenList)] = TokenList
+
+
+ ## [BuildOptions] section parser
+ @ParseMacro
+ def _BuildOptionParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+ TokenList2 = GetSplitValueList(TokenList[0], ':', 1)
+ if len(TokenList2) == 2:
+ self._ValueList[0] = TokenList2[0] # toolchain family
+ self._ValueList[1] = TokenList2[1] # keys
+ else:
+ self._ValueList[1] = TokenList[0]
+ if len(TokenList) == 2: # value
+ self._ValueList[2] = TokenList[1]
+
+ if self._ValueList[1].count('_') != 4:
+ EdkLogger.error(
+ 'Parser',
+ FORMAT_INVALID,
+ "'%s' must be in format of <TARGET>_<TOOLCHAIN>_<ARCH>_<TOOL>_FLAGS" % self._ValueList[1],
+ ExtraData=self._CurrentLine,
+ File=self.MetaFile,
+ Line=self._LineIndex+1
+ )
+
+ ## Override parent's method since we'll do all macro replacements in parser
+ def _GetMacros(self):
+ Macros = dict( [('ARCH', 'IA32'), ('FAMILY', TAB_COMPILER_MSFT), ('TOOL_CHAIN_TAG', 'VS2008x86'), ('TARGET', 'DEBUG')])
+ Macros.update(self._FileLocalMacros)
+ Macros.update(self._GetApplicableSectionMacro())
+ Macros.update(GlobalData.gEdkGlobal)
+ Macros.update(GlobalData.gPlatformDefines)
+ Macros.update(GlobalData.gCommandLineDefines)
+ # PCD cannot be referenced in macro definition
+ if self._ItemType not in [MODEL_META_DATA_DEFINE, MODEL_META_DATA_GLOBAL_DEFINE]:
+ Macros.update(self._Symbols)
+ return Macros
+
+ def _PostProcess(self):
+ Processer = {
+ MODEL_META_DATA_SECTION_HEADER : self.__ProcessSectionHeader,
+ MODEL_META_DATA_SUBSECTION_HEADER : self.__ProcessSubsectionHeader,
+ MODEL_META_DATA_HEADER : self.__ProcessDefine,
+ MODEL_META_DATA_DEFINE : self.__ProcessDefine,
+ MODEL_META_DATA_GLOBAL_DEFINE : self.__ProcessDefine,
+ MODEL_META_DATA_INCLUDE : self.__ProcessDirective,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IF : self.__ProcessDirective,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE : self.__ProcessDirective,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF : self.__ProcessDirective,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF : self.__ProcessDirective,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF : self.__ProcessDirective,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF : self.__ProcessDirective,
+ MODEL_EFI_SKU_ID : self.__ProcessSkuId,
+ MODEL_EFI_LIBRARY_INSTANCE : self.__ProcessLibraryInstance,
+ MODEL_EFI_LIBRARY_CLASS : self.__ProcessLibraryClass,
+ MODEL_PCD_FIXED_AT_BUILD : self.__ProcessPcd,
+ MODEL_PCD_PATCHABLE_IN_MODULE : self.__ProcessPcd,
+ MODEL_PCD_FEATURE_FLAG : self.__ProcessPcd,
+ MODEL_PCD_DYNAMIC_DEFAULT : self.__ProcessPcd,
+ MODEL_PCD_DYNAMIC_HII : self.__ProcessPcd,
+ MODEL_PCD_DYNAMIC_VPD : self.__ProcessPcd,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : self.__ProcessPcd,
+ MODEL_PCD_DYNAMIC_EX_HII : self.__ProcessPcd,
+ MODEL_PCD_DYNAMIC_EX_VPD : self.__ProcessPcd,
+ MODEL_META_DATA_COMPONENT : self.__ProcessComponent,
+ MODEL_META_DATA_BUILD_OPTION : self.__ProcessBuildOption,
+ MODEL_UNKNOWN : self._Skip,
+ MODEL_META_DATA_USER_EXTENSION : self._Skip,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR : self._Skip,
+ }
+
+ self._RawTable = self._Table
+ self._Table = MetaFileStorage(self._RawTable.Cur, self.MetaFile, MODEL_FILE_DSC, True)
+ self._DirectiveStack = []
+ self._DirectiveEvalStack = []
+ self._FileWithError = self.MetaFile
+ self._FileLocalMacros = {}
+ self._SectionsMacroDict = {}
+ GlobalData.gPlatformDefines = {}
+
+ # Get all macro and PCD which has straitforward value
+ self.__RetrievePcdValue()
+ self._Content = self._RawTable.GetAll()
+ self._ContentIndex = 0
+ while self._ContentIndex < len(self._Content) :
+ Id, self._ItemType, V1, V2, V3, S1, S2, Owner, BelongsToFile, self._From, \
+ LineStart, ColStart, LineEnd, ColEnd, Enabled = self._Content[self._ContentIndex]
+
+ if self._From < 0:
+ self._FileWithError = self.MetaFile
+
+ self._ContentIndex += 1
+
+ self._Scope = [[S1, S2]]
+ self._LineIndex = LineStart - 1
+ self._ValueList = [V1, V2, V3]
+
+ try:
+ Processer[self._ItemType]()
+ except EvaluationException as Excpt:
+ #
+ # Only catch expression evaluation error here. We need to report
+ # the precise number of line on which the error occurred
+ #
+ pass
+# EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt),
+# File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+# Line=self._LineIndex+1)
+ except MacroException as Excpt:
+ EdkLogger.error('Parser', FORMAT_INVALID, str(Excpt),
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex+1)
+
+ if self._ValueList is None:
+ continue
+
+ NewOwner = self._IdMapping.get(Owner, -1)
+ self._Enabled = int((not self._DirectiveEvalStack) or (False not in self._DirectiveEvalStack))
+ self._LastItem = self._Store(
+ self._ItemType,
+ self._ValueList[0],
+ self._ValueList[1],
+ self._ValueList[2],
+ S1,
+ S2,
+ NewOwner,
+ BelongsToFile,
+ self._From,
+ self._LineIndex+1,
+ -1,
+ self._LineIndex+1,
+ -1,
+ self._Enabled
+ )
+ self._IdMapping[Id] = self._LastItem
+
+ RecordList = self._Table.GetAll()
+
+ self._RawTable.Drop()
+ self._Table.Drop()
+ for Record in RecordList:
+ EccGlobalData.gDb.TblDsc.Insert(Record[1], Record[2], Record[3], Record[4], Record[5], Record[6], Record[7], Record[8], Record[9], Record[10], Record[11], Record[12], Record[13], Record[14])
+ GlobalData.gPlatformDefines.update(self._FileLocalMacros)
+ self._PostProcessed = True
+ self._Content = None
+
+ def __ProcessSectionHeader(self):
+ self._SectionName = self._ValueList[0]
+ if self._SectionName in self.DataType:
+ self._SectionType = self.DataType[self._SectionName]
+ else:
+ self._SectionType = MODEL_UNKNOWN
+
+ def __ProcessSubsectionHeader(self):
+ self._SubsectionName = self._ValueList[0]
+ if self._SubsectionName in self.DataType:
+ self._SubsectionType = self.DataType[self._SubsectionName]
+ else:
+ self._SubsectionType = MODEL_UNKNOWN
+
+ def __RetrievePcdValue(self):
+ Records = self._RawTable.Query(MODEL_PCD_FEATURE_FLAG, BelongsToItem=-1.0)
+ for TokenSpaceGuid, PcdName, Value, Dummy2, Dummy3, ID, Line in Records:
+ Value, DatumType, MaxDatumSize = AnalyzePcdData(Value)
+ # Only use PCD whose value is straitforward (no macro and PCD)
+ if self.SymbolPattern.findall(Value):
+ continue
+ Name = TokenSpaceGuid + '.' + PcdName
+ # Don't use PCD with different values.
+ if Name in self._Symbols and self._Symbols[Name] != Value:
+ self._Symbols.pop(Name)
+ continue
+ self._Symbols[Name] = Value
+
+ Records = self._RawTable.Query(MODEL_PCD_FIXED_AT_BUILD, BelongsToItem=-1.0)
+ for TokenSpaceGuid, PcdName, Value, Dummy2, Dummy3, ID, Line in Records:
+ Value, DatumType, MaxDatumSize = AnalyzePcdData(Value)
+ # Only use PCD whose value is straitforward (no macro and PCD)
+ if self.SymbolPattern.findall(Value):
+ continue
+ Name = TokenSpaceGuid+'.'+PcdName
+ # Don't use PCD with different values.
+ if Name in self._Symbols and self._Symbols[Name] != Value:
+ self._Symbols.pop(Name)
+ continue
+ self._Symbols[Name] = Value
+
+ def __ProcessDefine(self):
+ if not self._Enabled:
+ return
+
+ Type, Name, Value = self._ValueList
+ Value = ReplaceMacro(Value, self._Macros, False)
+ if self._ItemType == MODEL_META_DATA_DEFINE:
+ if self._SectionType == MODEL_META_DATA_HEADER:
+ self._FileLocalMacros[Name] = Value
+ else:
+ SectionDictKey = self._SectionType, self._Scope[0][0], self._Scope[0][1]
+ if SectionDictKey not in self._SectionsMacroDict:
+ self._SectionsMacroDict[SectionDictKey] = {}
+ SectionLocalMacros = self._SectionsMacroDict[SectionDictKey]
+ SectionLocalMacros[Name] = Value
+ elif self._ItemType == MODEL_META_DATA_GLOBAL_DEFINE:
+ GlobalData.gEdkGlobal[Name] = Value
+
+ #
+ # Keyword in [Defines] section can be used as Macros
+ #
+ if (self._ItemType == MODEL_META_DATA_HEADER) and (self._SectionType == MODEL_META_DATA_HEADER):
+ self._FileLocalMacros[Name] = Value
+
+ self._ValueList = [Type, Name, Value]
+
+ def __ProcessDirective(self):
+ Result = None
+ if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF]:
+ Macros = self._Macros
+ Macros.update(GlobalData.gGlobalDefines)
+ try:
+ Result = ValueExpression(self._ValueList[1], Macros)()
+ except SymbolNotFound as Exc:
+ EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1])
+ Result = False
+ except WrnExpression as Excpt:
+ #
+ # Catch expression evaluation warning here. We need to report
+ # the precise number of line and return the evaluation result
+ #
+ EdkLogger.warn('Parser', "Suspicious expression: %s" % str(Excpt),
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex+1)
+ Result = Excpt.result
+ except BadExpression as Exc:
+ EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1])
+ Result = False
+
+ if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]:
+ self._DirectiveStack.append(self._ItemType)
+ if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IF:
+ Result = bool(Result)
+ else:
+ Macro = self._ValueList[1]
+ Macro = Macro[2:-1] if (Macro.startswith("$(") and Macro.endswith(")")) else Macro
+ Result = Macro in self._Macros
+ if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF:
+ Result = not Result
+ self._DirectiveEvalStack.append(Result)
+ elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF:
+ self._DirectiveStack.append(self._ItemType)
+ self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1]
+ self._DirectiveEvalStack.append(bool(Result))
+ elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE:
+ self._DirectiveStack[-1] = self._ItemType
+ self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1]
+ elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF:
+ # Back to the nearest !if/!ifdef/!ifndef
+ while self._DirectiveStack:
+ self._DirectiveEvalStack.pop()
+ Directive = self._DirectiveStack.pop()
+ if Directive in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]:
+ break
+ elif self._ItemType == MODEL_META_DATA_INCLUDE:
+ # The included file must be relative to workspace or same directory as DSC file
+ __IncludeMacros = {}
+ #
+ # Allow using system environment variables in path after !include
+ #
+ __IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE']
+
+ #
+ # Allow using MACROs comes from [Defines] section to keep compatible.
+ #
+ __IncludeMacros.update(self._Macros)
+
+ IncludedFile = NormPath(ReplaceMacro(self._ValueList[1], __IncludeMacros, RaiseError=True))
+ #
+ # First search the include file under the same directory as DSC file
+ #
+ IncludedFile1 = PathClass(IncludedFile, self.MetaFile.Dir)
+ ErrorCode, ErrorInfo1 = IncludedFile1.Validate()
+ if ErrorCode != 0:
+ #
+ # Also search file under the WORKSPACE directory
+ #
+ IncludedFile1 = PathClass(IncludedFile, GlobalData.gWorkspace)
+ ErrorCode, ErrorInfo2 = IncludedFile1.Validate()
+ if ErrorCode != 0:
+ EdkLogger.error('parser', ErrorCode, File=self._FileWithError,
+ Line=self._LineIndex+1, ExtraData=ErrorInfo1 + "\n"+ ErrorInfo2)
+
+ self._FileWithError = IncludedFile1
+
+ IncludedFileTable = MetaFileStorage(self._Table.Cur, IncludedFile1, MODEL_FILE_DSC, True)
+ Owner = self._Content[self._ContentIndex-1][0]
+ Parser = DscParser(IncludedFile1, self._FileType, IncludedFileTable,
+ Owner=Owner, From=Owner)
+
+ # set the parser status with current status
+ Parser._SectionName = self._SectionName
+ Parser._SectionType = self._SectionType
+ Parser._Scope = self._Scope
+ Parser._Enabled = self._Enabled
+ # Parse the included file
+ Parser.Start()
+
+ # update current status with sub-parser's status
+ self._SectionName = Parser._SectionName
+ self._SectionType = Parser._SectionType
+ self._Scope = Parser._Scope
+ self._Enabled = Parser._Enabled
+
+ # Insert all records in the table for the included file into dsc file table
+ Records = IncludedFileTable.GetAll()
+ if Records:
+ self._Content[self._ContentIndex:self._ContentIndex] = Records
+ self._Content.pop(self._ContentIndex-1)
+ self._ValueList = None
+ self._ContentIndex -= 1
+
+ def __ProcessSkuId(self):
+ self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=True)
+ for Value in self._ValueList]
+
+ def __ProcessLibraryInstance(self):
+ self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList]
+
+ def __ProcessLibraryClass(self):
+ self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros, RaiseError=True)
+
+ def __ProcessPcd(self):
+ ValueList = GetSplitValueList(self._ValueList[2])
+ #
+ # PCD value can be an expression
+ #
+ if len(ValueList) > 1 and ValueList[1] == TAB_VOID:
+ PcdValue = ValueList[0]
+ try:
+ ValueList[0] = ValueExpression(PcdValue, self._Macros)(True)
+ except WrnExpression as Value:
+ ValueList[0] = Value.result
+ else:
+ PcdValue = ValueList[-1]
+ try:
+ ValueList[-1] = ValueExpression(PcdValue, self._Macros)(True)
+ except WrnExpression as Value:
+ ValueList[-1] = Value.result
+
+ if ValueList[-1] == 'True':
+ ValueList[-1] = '1'
+ if ValueList[-1] == 'False':
+ ValueList[-1] = '0'
+
+ self._ValueList[2] = '|'.join(ValueList)
+
+ def __ProcessComponent(self):
+ self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros)
+
+ def __ProcessBuildOption(self):
+ self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=False)
+ for Value in self._ValueList]
+
+ _SectionParser = {
+ MODEL_META_DATA_HEADER : _DefineParser,
+ MODEL_EFI_SKU_ID : _SkuIdParser,
+ MODEL_EFI_LIBRARY_INSTANCE : _LibraryInstanceParser,
+ MODEL_EFI_LIBRARY_CLASS : _LibraryClassParser,
+ MODEL_PCD_FIXED_AT_BUILD : _PcdParser,
+ MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser,
+ MODEL_PCD_FEATURE_FLAG : _PcdParser,
+ MODEL_PCD_DYNAMIC_DEFAULT : _PcdParser,
+ MODEL_PCD_DYNAMIC_HII : _PcdParser,
+ MODEL_PCD_DYNAMIC_VPD : _PcdParser,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : _PcdParser,
+ MODEL_PCD_DYNAMIC_EX_HII : _PcdParser,
+ MODEL_PCD_DYNAMIC_EX_VPD : _PcdParser,
+ MODEL_META_DATA_COMPONENT : _ComponentParser,
+ MODEL_META_DATA_BUILD_OPTION : _BuildOptionParser,
+ MODEL_UNKNOWN : MetaFileParser._Skip,
+ MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip,
+ MODEL_META_DATA_SECTION_HEADER : MetaFileParser._SectionHeaderParser,
+ MODEL_META_DATA_SUBSECTION_HEADER : _SubsectionHeaderParser,
+ }
+
+ _Macros = property(_GetMacros)
+
+## DEC file parser class
+#
+# @param FilePath The path of platform description file
+# @param FileType The raw data of DSC file
+# @param Table Database used to retrieve module/package information
+# @param Macros Macros used for replacement in file
+#
+class DecParser(MetaFileParser):
+ # DEC file supported data types (one type per section)
+ DataType = {
+ TAB_DEC_DEFINES.upper() : MODEL_META_DATA_HEADER,
+ TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE,
+ TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE,
+ TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS,
+ TAB_GUIDS.upper() : MODEL_EFI_GUID,
+ TAB_PPIS.upper() : MODEL_EFI_PPI,
+ TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL,
+ TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : MODEL_PCD_FIXED_AT_BUILD,
+ TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : MODEL_PCD_PATCHABLE_IN_MODULE,
+ TAB_PCDS_FEATURE_FLAG_NULL.upper() : MODEL_PCD_FEATURE_FLAG,
+ TAB_PCDS_DYNAMIC_NULL.upper() : MODEL_PCD_DYNAMIC,
+ TAB_PCDS_DYNAMIC_EX_NULL.upper() : MODEL_PCD_DYNAMIC_EX,
+ }
+
+ ## Constructor of DecParser
+ #
+ # Initialize object of DecParser
+ #
+ # @param FilePath The path of platform description file
+ # @param FileType The raw data of DSC file
+ # @param Table Database used to retrieve module/package information
+ # @param Macros Macros used for replacement in file
+ #
+ def __init__(self, FilePath, FileType, Table):
+ # prevent re-initialization
+ if hasattr(self, "_Table"):
+ return
+ MetaFileParser.__init__(self, FilePath, FileType, Table)
+ self._Comments = []
+ self._Version = 0x00010005 # Only EDK2 dec file is supported
+ self.TblFile = EccGlobalData.gDb.TblFile
+ self.FileID = -1
+
+ self._CurrentStructurePcdName = ""
+ self._include_flag = False
+ self._package_flag = False
+
+ ## Parser starter
+ def Start(self):
+ Content = ''
+ try:
+ Content = open(str(self.MetaFile), 'r').readlines()
+ except:
+ EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile)
+
+ #
+ # Insert a record for file
+ #
+ Filename = NormPath(self.MetaFile)
+ FileID = self.TblFile.GetFileId(Filename)
+ if FileID:
+ self.FileID = FileID
+ else:
+ self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_DEC)
+
+ for Index in range(0, len(Content)):
+ Line, Comment = CleanString2(Content[Index])
+ self._CurrentLine = Line
+ self._LineIndex = Index
+
+ # save comment for later use
+ if Comment:
+ self._Comments.append((Comment, self._LineIndex+1))
+ # skip empty line
+ if Line == '':
+ continue
+
+ # section header
+ if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END:
+ self._SectionHeaderParser()
+ self._Comments = []
+ continue
+ elif len(self._SectionType) == 0:
+ self._Comments = []
+ continue
+
+ # section content
+ self._ValueList = ['', '', '']
+ self._SectionParser[self._SectionType[0]](self)
+ if self._ValueList is None or self._ItemType == MODEL_META_DATA_DEFINE:
+ self._ItemType = -1
+ self._Comments = []
+ continue
+
+ #
+ # Model, Value1, Value2, Value3, Arch, BelongsToItem=-1, LineBegin=-1,
+ # ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, FeatureFlag='', Enabled=-1
+ #
+ for Arch, ModuleType, Type in self._Scope:
+ self._LastItem = self._Store(
+ Type,
+ self._ValueList[0],
+ self._ValueList[1],
+ self._ValueList[2],
+ Arch,
+ ModuleType,
+ self._Owner[-1],
+ self.FileID,
+ self._LineIndex+1,
+ -1,
+ self._LineIndex+1,
+ -1,
+ 0
+ )
+ for Comment, LineNo in self._Comments:
+ self._Store(
+ MODEL_META_DATA_COMMENT,
+ Comment,
+ self._ValueList[0],
+ self._ValueList[1],
+ Arch,
+ ModuleType,
+ self._LastItem,
+ self.FileID,
+ LineNo,
+ -1,
+ LineNo,
+ -1,
+ 0
+ )
+ self._Comments = []
+ self._Done()
+
+ def _GetApplicableSectionMacro(self):
+ Macros = {}
+ for S1, S2, SectionType in self._Scope:
+ for Scope1, Scope2 in [("COMMON", "COMMON"), ("COMMON", S2), (S1, "COMMON"), (S1, S2)]:
+ if (SectionType, Scope1, Scope2) in self._SectionsMacroDict:
+ Macros.update(self._SectionsMacroDict[(SectionType, Scope1, Scope2)])
+ return Macros
+
+ ## Section header parser
+ #
+ # The section header is always in following format:
+ #
+ # [section_name.arch<.platform|module_type>]
+ #
+ def _SectionHeaderParser(self):
+ self._Scope = []
+ self._SectionName = ''
+ self._SectionType = []
+ ArchList = set()
+ for Item in GetSplitValueList(self._CurrentLine[1:-1], TAB_COMMA_SPLIT):
+ if Item == '':
+ continue
+ ItemList = GetSplitValueList(Item, TAB_SPLIT)
+
+ # different types of PCD are permissible in one section
+ self._SectionName = ItemList[0].upper()
+ if self._SectionName in self.DataType:
+ if self.DataType[self._SectionName] not in self._SectionType:
+ self._SectionType.append(self.DataType[self._SectionName])
+ else:
+ EdkLogger.warn("Parser", "Unrecognized section", File=self.MetaFile,
+ Line=self._LineIndex+1, ExtraData=self._CurrentLine)
+ continue
+
+ if MODEL_PCD_FEATURE_FLAG in self._SectionType and len(self._SectionType) > 1:
+ EdkLogger.error(
+ 'Parser',
+ FORMAT_INVALID,
+ "%s must not be in the same section of other types of PCD" % TAB_PCDS_FEATURE_FLAG_NULL,
+ File=self.MetaFile,
+ Line=self._LineIndex+1,
+ ExtraData=self._CurrentLine
+ )
+ # S1 is always Arch
+ if len(ItemList) > 1:
+ S1 = ItemList[1].upper()
+ else:
+ S1 = 'COMMON'
+ ArchList.add(S1)
+ # S2 may be Platform or ModuleType
+ if len(ItemList) > 2:
+ S2 = ItemList[2].upper()
+ else:
+ S2 = 'COMMON'
+ if [S1, S2, self.DataType[self._SectionName]] not in self._Scope:
+ self._Scope.append([S1, S2, self.DataType[self._SectionName]])
+
+ # 'COMMON' must not be used with specific ARCHs at the same section
+ if 'COMMON' in ArchList and len(ArchList) > 1:
+ EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs",
+ File=self.MetaFile, Line=self._LineIndex+1, ExtraData=self._CurrentLine)
+
+ ## [guids], [ppis] and [protocols] section parser
+ @ParseMacro
+ def _GuidParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+ if len(TokenList) < 2:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name or value specified",
+ ExtraData=self._CurrentLine + " (<CName> = <GuidValueInCFormat>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ if TokenList[0] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name specified",
+ ExtraData=self._CurrentLine + " (<CName> = <GuidValueInCFormat>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ if TokenList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No GUID value specified",
+ ExtraData=self._CurrentLine + " (<CName> = <GuidValueInCFormat>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ if TokenList[1][0] != '{' or TokenList[1][-1] != '}' or GuidStructureStringToGuidString(TokenList[1]) == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid GUID value format",
+ ExtraData=self._CurrentLine + \
+ " (<CName> = <GuidValueInCFormat:{8,4,4,{2,2,2,2,2,2,2,2}}>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ self._ValueList[0] = TokenList[0]
+ #Parse the Guid value format
+ GuidValueList = TokenList[1].strip(' {}').split(',')
+ Index = 0
+ HexList = []
+ if len(GuidValueList) == 11:
+ for GuidValue in GuidValueList:
+ GuidValue = GuidValue.strip()
+ if GuidValue.startswith('0x') or GuidValue.startswith('0X'):
+ HexList.append('0x' + str(GuidValue[2:]))
+ Index += 1
+ continue
+ else:
+ if GuidValue.startswith('{'):
+ GuidValue = GuidValue.lstrip(' {')
+ HexList.append('0x' + str(GuidValue[2:]))
+ Index += 1
+ self._ValueList[1] = "{ %s, %s, %s, { %s, %s, %s, %s, %s, %s, %s, %s }}" % (HexList[0], HexList[1], HexList[2], HexList[3], HexList[4], HexList[5], HexList[6], HexList[7], HexList[8], HexList[9], HexList[10])
+ else:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid GUID value format",
+ ExtraData=self._CurrentLine + \
+ " (<CName> = <GuidValueInCFormat:{8,4,4,{2,2,2,2,2,2,2,2}}>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ self._ValueList[0] = ''
+
+ def ParsePcdName(self,namelist):
+ if "[" in namelist[1]:
+ pcdname = namelist[1][:namelist[1].index("[")]
+ arrayindex = namelist[1][namelist[1].index("["):]
+ namelist[1] = pcdname
+ if len(namelist) == 2:
+ namelist.append(arrayindex)
+ else:
+ namelist[2] = ".".join((arrayindex,namelist[2]))
+ return namelist
+
+ def StructPcdParser(self):
+ self._ValueList[0] = self._CurrentStructurePcdName
+
+ if "|" not in self._CurrentLine:
+ if "<HeaderFiles>" == self._CurrentLine:
+ self._include_flag = True
+ self._package_flag = False
+ self._ValueList = None
+ return
+ if "<Packages>" == self._CurrentLine:
+ self._package_flag = True
+ self._ValueList = None
+ self._include_flag = False
+ return
+
+ if self._include_flag:
+ self._ValueList[1] = "<HeaderFiles>_" + md5(self._CurrentLine.encode('utf-8')).hexdigest()
+ self._ValueList[2] = self._CurrentLine
+ if self._package_flag and "}" != self._CurrentLine:
+ self._ValueList[1] = "<Packages>_" + md5(self._CurrentLine.encode('utf-8')).hexdigest()
+ self._ValueList[2] = self._CurrentLine
+ if self._CurrentLine == "}":
+ self._package_flag = False
+ self._include_flag = False
+ self._ValueList = None
+ else:
+ PcdTockens = self._CurrentLine.split(TAB_VALUE_SPLIT)
+ PcdNames = self.ParsePcdName(PcdTockens[0].split(TAB_SPLIT))
+ if len(PcdNames) == 2:
+ if PcdNames[1].strip().endswith("]"):
+ PcdName = PcdNames[1][:PcdNames[1].index('[')]
+ Index = PcdNames[1][PcdNames[1].index('['):]
+ self._ValueList[0] = TAB_SPLIT.join((PcdNames[0], PcdName))
+ self._ValueList[1] = Index
+ self._ValueList[2] = PcdTockens[1]
+ else:
+ self._CurrentStructurePcdName = ""
+ else:
+ if self._CurrentStructurePcdName != TAB_SPLIT.join(PcdNames[:2]):
+ EdkLogger.error('Parser', FORMAT_INVALID, "Pcd Name does not match: %s and %s " % (
+ self._CurrentStructurePcdName, TAB_SPLIT.join(PcdNames[:2])),
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ self._ValueList[1] = TAB_SPLIT.join(PcdNames[2:])
+ self._ValueList[2] = PcdTockens[1]
+
+ ## PCD sections parser
+ #
+ # [PcdsFixedAtBuild]
+ # [PcdsPatchableInModule]
+ # [PcdsFeatureFlag]
+ # [PcdsDynamicEx
+ # [PcdsDynamic]
+ #
+ @ParseMacro
+ def _PcdParser(self):
+ if self._CurrentStructurePcdName:
+ self.StructPcdParser()
+ return
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
+ self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT)
+ # check PCD information
+ if self._ValueList[0] == '' or self._ValueList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ # check PCD datum information
+ if len(TokenList) < 2 or TokenList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Datum information given",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+
+
+ ValueRe = re.compile(r'^\s*L?\".*\|.*\"')
+ PtrValue = ValueRe.findall(TokenList[1])
+
+ # Has VOID* type string, may contain "|" character in the string.
+ if len(PtrValue) != 0:
+ ptrValueList = re.sub(ValueRe, '', TokenList[1])
+ ValueList = GetSplitValueList(ptrValueList)
+ ValueList[0] = PtrValue[0]
+ else:
+ ValueList = GetSplitValueList(TokenList[1])
+
+
+ # check if there's enough datum information given
+ if len(ValueList) != 3:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum information given",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ # check default value
+ if ValueList[0] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "Missing DefaultValue in PCD Datum information",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ # check datum type
+ if ValueList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "Missing DatumType in PCD Datum information",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ # check token of the PCD
+ if ValueList[2] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "Missing Token in PCD Datum information",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex+1)
+ # check format of default value against the datum type
+ IsValid, Cause = CheckPcdDatum(ValueList[1], ValueList[0])
+ if not IsValid:
+ EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=self._CurrentLine,
+ File=self.MetaFile, Line=self._LineIndex+1)
+ if Cause == "StructurePcd":
+ self._CurrentStructurePcdName = TAB_SPLIT.join(self._ValueList[0:2])
+ self._ValueList[0] = self._CurrentStructurePcdName
+ self._ValueList[1] = ValueList[1].strip()
+
+ if EccGlobalData.gConfig.UniCheckPCDInfo == '1' or EccGlobalData.gConfig.UniCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ # check Description, Prompt information
+ PatternDesc = re.compile('##\s*([\x21-\x7E\s]*)', re.S)
+ PatternPrompt = re.compile('#\s+@Prompt\s+([\x21-\x7E\s]*)', re.S)
+ Description = None
+ Prompt = None
+ # check @ValidRange, @ValidList and @Expression format valid
+ ErrorCodeValid = '0x0 <= %s <= 0xFFFFFFFF'
+ PatternValidRangeIn = '(NOT)?\s*(\d+\s*-\s*\d+|0[xX][a-fA-F0-9]+\s*-\s*0[xX][a-fA-F0-9]+|LT\s*\d+|LT\s*0[xX][a-fA-F0-9]+|GT\s*\d+|GT\s*0[xX][a-fA-F0-9]+|LE\s*\d+|LE\s*0[xX][a-fA-F0-9]+|GE\s*\d+|GE\s*0[xX][a-fA-F0-9]+|XOR\s*\d+|XOR\s*0[xX][a-fA-F0-9]+|EQ\s*\d+|EQ\s*0[xX][a-fA-F0-9]+)'
+ PatternValidRng = re.compile('^' + '(NOT)?\s*' + PatternValidRangeIn + '$')
+ for Comment in self._Comments:
+ Comm = Comment[0].strip()
+ if not Comm:
+ continue
+ if not Description:
+ Description = PatternDesc.findall(Comm)
+ if not Prompt:
+ Prompt = PatternPrompt.findall(Comm)
+ if Comm[0] == '#':
+ ValidFormt = Comm.lstrip('#')
+ ValidFormt = ValidFormt.lstrip()
+ if ValidFormt[0:11] == '@ValidRange':
+ ValidFormt = ValidFormt[11:]
+ ValidFormt = ValidFormt.lstrip()
+ try:
+ ErrorCode, Expression = ValidFormt.split('|', 1)
+ except ValueError:
+ ErrorCode = '0x0'
+ Expression = ValidFormt
+ ErrorCode, Expression = ErrorCode.strip(), Expression.strip()
+ try:
+ if not eval(ErrorCodeValid % ErrorCode):
+ EdkLogger.warn('Parser', '@ValidRange ErrorCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0]))
+ except:
+ EdkLogger.warn('Parser', '@ValidRange ErrorCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0]))
+ if not PatternValidRng.search(Expression):
+ EdkLogger.warn('Parser', '@ValidRange Expression(%s) of PCD %s is incorrect format.' % (Expression, TokenList[0]))
+ if ValidFormt[0:10] == '@ValidList':
+ ValidFormt = ValidFormt[10:]
+ ValidFormt = ValidFormt.lstrip()
+ try:
+ ErrorCode, Expression = ValidFormt.split('|', 1)
+ except ValueError:
+ ErrorCode = '0x0'
+ Expression = ValidFormt
+ ErrorCode, Expression = ErrorCode.strip(), Expression.strip()
+ try:
+ if not eval(ErrorCodeValid % ErrorCode):
+ EdkLogger.warn('Parser', '@ValidList ErrorCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0]))
+ except:
+ EdkLogger.warn('Parser', '@ValidList ErrorCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0]))
+ Values = Expression.split(',')
+ for Value in Values:
+ Value = Value.strip()
+ try:
+ eval(Value)
+ except:
+ EdkLogger.warn('Parser', '@ValidList Expression of PCD %s include a invalid value(%s).' % (TokenList[0], Value))
+ break
+ if ValidFormt[0:11] == '@Expression':
+ ValidFormt = ValidFormt[11:]
+ ValidFormt = ValidFormt.lstrip()
+ try:
+ ErrorCode, Expression = ValidFormt.split('|', 1)
+ except ValueError:
+ ErrorCode = '0x0'
+ Expression = ValidFormt
+ ErrorCode, Expression = ErrorCode.strip(), Expression.strip()
+ try:
+ if not eval(ErrorCodeValid % ErrorCode):
+ EdkLogger.warn('Parser', '@Expression ErrorCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0]))
+ except:
+ EdkLogger.warn('Parser', '@Expression ErrorCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0]))
+ if not Expression:
+ EdkLogger.warn('Parser', '@Expression Expression of PCD %s is incorrect format.' % TokenList[0])
+ if not Description:
+ EdkLogger.warn('Parser', 'PCD %s Description information is not provided.' % TokenList[0])
+ if not Prompt:
+ EdkLogger.warn('Parser', 'PCD %s Prompt information is not provided.' % TokenList[0])
+ # check Description, Prompt localization information
+ if self._UniObj:
+ self._UniObj.CheckPcdInfo(TokenList[0])
+
+ if ValueList[0] in ['True', 'true', 'TRUE']:
+ ValueList[0] = '1'
+ elif ValueList[0] in ['False', 'false', 'FALSE']:
+ ValueList[0] = '0'
+
+ self._ValueList[2] = ValueList[0].strip() + '|' + ValueList[1].strip() + '|' + ValueList[2].strip()
+
+ _SectionParser = {
+ MODEL_META_DATA_HEADER : MetaFileParser._DefineParser,
+ MODEL_EFI_INCLUDE : MetaFileParser._PathParser,
+ MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser,
+ MODEL_EFI_GUID : _GuidParser,
+ MODEL_EFI_PPI : _GuidParser,
+ MODEL_EFI_PROTOCOL : _GuidParser,
+ MODEL_PCD_FIXED_AT_BUILD : _PcdParser,
+ MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser,
+ MODEL_PCD_FEATURE_FLAG : _PcdParser,
+ MODEL_PCD_DYNAMIC : _PcdParser,
+ MODEL_PCD_DYNAMIC_EX : _PcdParser,
+ MODEL_UNKNOWN : MetaFileParser._Skip,
+ MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip,
+ }
+
+
+## Fdf
+#
+# This class defined the structure used in Fdf object
+#
+# @param Filename: Input value for Ffilename of Fdf file, default is None
+# @param WorkspaceDir: Input value for current workspace directory, default is None
+#
+class Fdf(object):
+ def __init__(self, Filename = None, IsToDatabase = False, WorkspaceDir = None, Database = None):
+ self.WorkspaceDir = WorkspaceDir
+ self.IsToDatabase = IsToDatabase
+
+ self.Cur = Database.Cur
+ self.TblFile = Database.TblFile
+ self.TblFdf = Database.TblFdf
+ self.FileID = -1
+ self.FileList = {}
+
+ #
+ # Load Fdf file if filename is not None
+ #
+ if Filename is not None:
+ try:
+ self.LoadFdfFile(Filename)
+ except Exception:
+ pass
+
+ #
+ # Insert a FDF file record into database
+ #
+ def InsertFile(self, Filename):
+ FileID = -1
+ Filename = NormPath(Filename)
+ if Filename not in self.FileList:
+ FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_FDF)
+ self.FileList[Filename] = FileID
+
+ return self.FileList[Filename]
+
+
+ ## Load Fdf file
+ #
+ # Load the file if it exists
+ #
+ # @param Filename: Input value for filename of Fdf file
+ #
+ def LoadFdfFile(self, Filename):
+ FileList = []
+ #
+ # Parse Fdf file
+ #
+ Filename = NormPath(Filename)
+ Fdf = FdfParser(Filename)
+ Fdf.ParseFile()
+
+ #
+ # Insert inf file and pcd information
+ #
+ if self.IsToDatabase:
+ (Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled) = \
+ (0, '', '', '', 'COMMON', 'COMMON', -1, -1, -1, -1, -1, -1, 0)
+ for Index in range(0, len(Fdf.Profile.PcdDict)):
+ pass
+ for Key in Fdf.Profile.PcdDict.keys():
+ Model = MODEL_PCD
+ Value1 = Key[1]
+ Value2 = Key[0]
+ FileName = Fdf.Profile.PcdFileLineDict[Key][0]
+ StartLine = Fdf.Profile.PcdFileLineDict[Key][1]
+ BelongsToFile = self.InsertFile(FileName)
+ self.TblFdf.Insert(Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled)
+ for Index in range(0, len(Fdf.Profile.InfList)):
+ Model = MODEL_META_DATA_COMPONENT
+ Value1 = Fdf.Profile.InfList[Index]
+ Value2 = ''
+ FileName = Fdf.Profile.InfFileLineList[Index][0]
+ StartLine = Fdf.Profile.InfFileLineList[Index][1]
+ BelongsToFile = self.InsertFile(FileName)
+ self.TblFdf.Insert(Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled)
+
+class UniParser(object):
+ # IsExtraUni defined the UNI file is Module UNI or extra Module UNI
+ # IsModuleUni defined the UNI file is Module UNI or Package UNI
+ def __init__(self, FilePath, IsExtraUni=False, IsModuleUni=True):
+ self.FilePath = FilePath
+ self.FileName = os.path.basename(FilePath)
+ self.IsExtraUni = IsExtraUni
+ self.IsModuleUni = IsModuleUni
+ self.FileIn = None
+ self.Missing = []
+ self.__read()
+
+ def __read(self):
+ try:
+ self.FileIn = CodecOpenLongFilePath(self.FilePath, Mode='rb', Encoding='utf_8').read()
+ except UnicodeError:
+ self.FileIn = CodecOpenLongFilePath(self.FilePath, Mode='rb', Encoding='utf_16').read()
+ except UnicodeError:
+ self.FileIn = CodecOpenLongFilePath(self.FilePath, Mode='rb', Encoding='utf_16_le').read()
+ except IOError:
+ self.FileIn = ""
+
+ def Start(self):
+ if self.IsModuleUni:
+ if self.IsExtraUni:
+ ModuleName = self.CheckKeyValid('STR_PROPERTIES_MODULE_NAME')
+ self.PrintLog('STR_PROPERTIES_MODULE_NAME', ModuleName)
+ else:
+ ModuleAbstract = self.CheckKeyValid('STR_MODULE_ABSTRACT')
+ self.PrintLog('STR_MODULE_ABSTRACT', ModuleAbstract)
+ ModuleDescription = self.CheckKeyValid('STR_MODULE_DESCRIPTION')
+ self.PrintLog('STR_MODULE_DESCRIPTION', ModuleDescription)
+ else:
+ if self.IsExtraUni:
+ PackageName = self.CheckKeyValid('STR_PROPERTIES_PACKAGE_NAME')
+ self.PrintLog('STR_PROPERTIES_PACKAGE_NAME', PackageName)
+ else:
+ PackageAbstract = self.CheckKeyValid('STR_PACKAGE_ABSTRACT')
+ self.PrintLog('STR_PACKAGE_ABSTRACT', PackageAbstract)
+ PackageDescription = self.CheckKeyValid('STR_PACKAGE_DESCRIPTION')
+ self.PrintLog('STR_PACKAGE_DESCRIPTION', PackageDescription)
+
+ def CheckKeyValid(self, Key, Contents=None):
+ if not Contents:
+ Contents = self.FileIn
+ KeyPattern = re.compile('#string\s+%s\s+.*?#language.*?".*?"' % Key, re.S)
+ if KeyPattern.search(Contents):
+ return True
+ return False
+
+ def CheckPcdInfo(self, PcdCName):
+ PromptKey = 'STR_%s_PROMPT' % PcdCName.replace('.', '_')
+ PcdPrompt = self.CheckKeyValid(PromptKey)
+ self.PrintLog(PromptKey, PcdPrompt)
+ HelpKey = 'STR_%s_HELP' % PcdCName.replace('.', '_')
+ PcdHelp = self.CheckKeyValid(HelpKey)
+ self.PrintLog(HelpKey, PcdHelp)
+
+ def PrintLog(self, Key, Value):
+ if not Value and Key not in self.Missing:
+ Msg = '%s is missing in the %s file.' % (Key, self.FileName)
+ EdkLogger.warn('Parser', Msg)
+ EccGlobalData.gDb.TblReport.Insert(EccToolError.ERROR_GENERAL_CHECK_UNI_HELP_INFO, OtherMsg=Msg, BelongsToTable='File', BelongsToItem=-2)
+ self.Missing.append(Key)
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ pass
+
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py b/roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py
new file mode 100644
index 000000000..0914aec46
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py
@@ -0,0 +1,329 @@
+## @file
+# This file is used to create/update/query/erase a meta file table
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import uuid
+
+import Common.EdkLogger as EdkLogger
+import Ecc.EccGlobalData as EccGlobalData
+
+from Ecc.MetaFileWorkspace.MetaDataTable import Table
+from Ecc.MetaFileWorkspace.MetaDataTable import ConvertToSqlString
+from CommonDataClass.DataClass import MODEL_FILE_DSC, MODEL_FILE_DEC, MODEL_FILE_INF, \
+ MODEL_FILE_OTHERS
+
+class MetaFileTable(Table):
+ ## Constructor
+ def __init__(self, Cursor, MetaFile, FileType, TableName, Temporary = False):
+ self.MetaFile = MetaFile
+ self.TblFile = EccGlobalData.gDb.TblFile
+ if (FileType == MODEL_FILE_INF):
+ TableName = "Inf"
+ if (FileType == MODEL_FILE_DSC):
+ if Temporary:
+ TableName = "_%s_%s" % ("Dsc", uuid.uuid4().hex)
+ else:
+ TableName = "Dsc"
+ if (FileType == MODEL_FILE_DEC):
+ TableName = "Dec"
+
+ Table.__init__(self, Cursor, TableName, 0, Temporary)
+ self.Create(False)
+
+
+## Python class representation of table storing module data
+class ModuleTable(MetaFileTable):
+ _COLUMN_ = '''
+ ID REAL PRIMARY KEY,
+ Model INTEGER NOT NULL,
+ Value1 TEXT NOT NULL,
+ Value2 TEXT,
+ Value3 TEXT,
+ Usage TEXT,
+ Scope1 TEXT,
+ Scope2 TEXT,
+ BelongsToItem REAL NOT NULL,
+ BelongsToFile SINGLE NOT NULL,
+ StartLine INTEGER NOT NULL,
+ StartColumn INTEGER NOT NULL,
+ EndLine INTEGER NOT NULL,
+ EndColumn INTEGER NOT NULL,
+ Enabled INTEGER DEFAULT 0
+ '''
+ # used as table end flag, in case the changes to database is not committed to db file
+ _DUMMY_ = "-1, -1, '====', '====', '====', '====', '====', -1, -1, -1, -1, -1, -1, -1"
+
+ ## Constructor
+ def __init__(self, Cursor):
+ MetaFileTable.__init__(self, Cursor, '', MODEL_FILE_INF, "Inf", False)
+
+ ## Insert a record into table Inf
+ #
+ # @param Model: Model of a Inf item
+ # @param Value1: Value1 of a Inf item
+ # @param Value2: Value2 of a Inf item
+ # @param Value3: Value3 of a Inf item
+ # @param Scope1: Arch of a Inf item
+ # @param Scope2 Platform os a Inf item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param StartLine: StartLine of a Inf item
+ # @param StartColumn: StartColumn of a Inf item
+ # @param EndLine: EndLine of a Inf item
+ # @param EndColumn: EndColumn of a Inf item
+ # @param Enabled: If this item enabled
+ #
+ def Insert(self, Model, Value1, Value2, Value3, Scope1='COMMON', Scope2='COMMON',
+ BelongsToItem=-1, BelongsToFile = -1, StartLine=-1, StartColumn=-1, EndLine=-1, EndColumn=-1, Enabled=0, Usage=''):
+ (Value1, Value2, Value3, Usage, Scope1, Scope2) = ConvertToSqlString((Value1, Value2, Value3, Usage, Scope1, Scope2))
+ return Table.Insert(
+ self,
+ Model,
+ Value1,
+ Value2,
+ Value3,
+ Usage,
+ Scope1,
+ Scope2,
+ BelongsToItem,
+ BelongsToFile,
+ StartLine,
+ StartColumn,
+ EndLine,
+ EndColumn,
+ Enabled
+ )
+
+ ## Query table
+ #
+ # @param Model: The Model of Record
+ # @param Arch: The Arch attribute of Record
+ # @param Platform The Platform attribute of Record
+ #
+ # @retval: A recordSet of all found records
+ #
+ def Query(self, Model, Arch=None, Platform=None):
+ ConditionString = "Model=%s AND Enabled>=0" % Model
+ ValueString = "Value1,Value2,Value3,Usage,Scope1,Scope2,ID,StartLine"
+
+ if Arch is not None and Arch != 'COMMON':
+ ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Arch
+ if Platform is not None and Platform != 'COMMON':
+ ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT')" % Platform
+
+ SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)
+ return self.Exec(SqlCommand)
+
+## Python class representation of table storing package data
+class PackageTable(MetaFileTable):
+ _COLUMN_ = '''
+ ID REAL PRIMARY KEY,
+ Model INTEGER NOT NULL,
+ Value1 TEXT NOT NULL,
+ Value2 TEXT,
+ Value3 TEXT,
+ Scope1 TEXT,
+ Scope2 TEXT,
+ BelongsToItem REAL NOT NULL,
+ BelongsToFile SINGLE NOT NULL,
+ StartLine INTEGER NOT NULL,
+ StartColumn INTEGER NOT NULL,
+ EndLine INTEGER NOT NULL,
+ EndColumn INTEGER NOT NULL,
+ Enabled INTEGER DEFAULT 0
+ '''
+ # used as table end flag, in case the changes to database is not committed to db file
+ _DUMMY_ = "-1, -1, '====', '====', '====', '====', '====', -1, -1, -1, -1, -1, -1, -1"
+
+ ## Constructor
+ def __init__(self, Cursor):
+ MetaFileTable.__init__(self, Cursor, '', MODEL_FILE_DEC, "Dec", False)
+
+ ## Insert table
+ #
+ # Insert a record into table Dec
+ #
+ # @param Model: Model of a Dec item
+ # @param Value1: Value1 of a Dec item
+ # @param Value2: Value2 of a Dec item
+ # @param Value3: Value3 of a Dec item
+ # @param Scope1: Arch of a Dec item
+ # @param Scope2: Module type of a Dec item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param StartLine: StartLine of a Dec item
+ # @param StartColumn: StartColumn of a Dec item
+ # @param EndLine: EndLine of a Dec item
+ # @param EndColumn: EndColumn of a Dec item
+ # @param Enabled: If this item enabled
+ #
+ def Insert(self, Model, Value1, Value2, Value3, Scope1='COMMON', Scope2='COMMON',
+ BelongsToItem=-1, BelongsToFile = -1, StartLine=-1, StartColumn=-1, EndLine=-1, EndColumn=-1, Enabled=0):
+ (Value1, Value2, Value3, Scope1, Scope2) = ConvertToSqlString((Value1, Value2, Value3, Scope1, Scope2))
+ return Table.Insert(
+ self,
+ Model,
+ Value1,
+ Value2,
+ Value3,
+ Scope1,
+ Scope2,
+ BelongsToItem,
+ BelongsToFile,
+ StartLine,
+ StartColumn,
+ EndLine,
+ EndColumn,
+ Enabled
+ )
+
+ ## Query table
+ #
+ # @param Model: The Model of Record
+ # @param Arch: The Arch attribute of Record
+ #
+ # @retval: A recordSet of all found records
+ #
+ def Query(self, Model, Arch=None):
+ ConditionString = "Model=%s AND Enabled>=0" % Model
+ ValueString = "Value1,Value2,Value3,Scope1,ID,StartLine"
+
+ if Arch is not None and Arch != 'COMMON':
+ ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Arch
+
+ SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)
+ return self.Exec(SqlCommand)
+
+## Python class representation of table storing platform data
+class PlatformTable(MetaFileTable):
+ _COLUMN_ = '''
+ ID REAL PRIMARY KEY,
+ Model INTEGER NOT NULL,
+ Value1 TEXT NOT NULL,
+ Value2 TEXT,
+ Value3 TEXT,
+ Scope1 TEXT,
+ Scope2 TEXT,
+ BelongsToItem REAL NOT NULL,
+ BelongsToFile SINGLE NOT NULL,
+ FromItem REAL NOT NULL,
+ StartLine INTEGER NOT NULL,
+ StartColumn INTEGER NOT NULL,
+ EndLine INTEGER NOT NULL,
+ EndColumn INTEGER NOT NULL,
+ Enabled INTEGER DEFAULT 0
+ '''
+ # used as table end flag, in case the changes to database is not committed to db file
+ _DUMMY_ = "-1, -1, '====', '====', '====', '====', '====', -1, -1, -1, -1, -1, -1, -1, -1"
+
+ ## Constructor
+ def __init__(self, Cursor, MetaFile = '', FileType = MODEL_FILE_DSC, Temporary = False):
+ MetaFileTable.__init__(self, Cursor, MetaFile, FileType, "Dsc", Temporary)
+
+ ## Insert table
+ #
+ # Insert a record into table Dsc
+ #
+ # @param Model: Model of a Dsc item
+ # @param Value1: Value1 of a Dsc item
+ # @param Value2: Value2 of a Dsc item
+ # @param Value3: Value3 of a Dsc item
+ # @param Scope1: Arch of a Dsc item
+ # @param Scope2: Module type of a Dsc item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param FromItem: The item belongs to which dsc file
+ # @param StartLine: StartLine of a Dsc item
+ # @param StartColumn: StartColumn of a Dsc item
+ # @param EndLine: EndLine of a Dsc item
+ # @param EndColumn: EndColumn of a Dsc item
+ # @param Enabled: If this item enabled
+ #
+ def Insert(self, Model, Value1, Value2, Value3, Scope1='COMMON', Scope2='COMMON', BelongsToItem=-1, BelongsToFile = -1,
+ FromItem=-1, StartLine=-1, StartColumn=-1, EndLine=-1, EndColumn=-1, Enabled=1):
+ (Value1, Value2, Value3, Scope1, Scope2) = ConvertToSqlString((Value1, Value2, Value3, Scope1, Scope2))
+ return Table.Insert(
+ self,
+ Model,
+ Value1,
+ Value2,
+ Value3,
+ Scope1,
+ Scope2,
+ BelongsToItem,
+ BelongsToFile,
+ FromItem,
+ StartLine,
+ StartColumn,
+ EndLine,
+ EndColumn,
+ Enabled
+ )
+
+ ## Query table
+ #
+ # @param Model: The Model of Record
+ # @param Scope1: Arch of a Dsc item
+ # @param Scope2: Module type of a Dsc item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param FromItem: The item belongs to which dsc file
+ #
+ # @retval: A recordSet of all found records
+ #
+ def Query(self, Model, Scope1=None, Scope2=None, BelongsToItem=None, FromItem=None):
+ ConditionString = "Model=%s AND Enabled>0" % Model
+ ValueString = "Value1,Value2,Value3,Scope1,Scope2,ID,StartLine"
+
+ if Scope1 is not None and Scope1 != 'COMMON':
+ ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Scope1
+ if Scope2 is not None and Scope2 != 'COMMON':
+ ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT')" % Scope2
+
+ if BelongsToItem is not None:
+ ConditionString += " AND BelongsToItem=%s" % BelongsToItem
+ else:
+ ConditionString += " AND BelongsToItem<0"
+
+ if FromItem is not None:
+ ConditionString += " AND FromItem=%s" % FromItem
+
+ SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)
+ return self.Exec(SqlCommand)
+
+## Factory class to produce different storage for different type of meta-file
+class MetaFileStorage(object):
+ _FILE_TABLE_ = {
+ MODEL_FILE_INF : ModuleTable,
+ MODEL_FILE_DEC : PackageTable,
+ MODEL_FILE_DSC : PlatformTable,
+ MODEL_FILE_OTHERS : MetaFileTable,
+ }
+
+ _FILE_TYPE_ = {
+ ".inf" : MODEL_FILE_INF,
+ ".dec" : MODEL_FILE_DEC,
+ ".dsc" : MODEL_FILE_DSC,
+ }
+
+ ## Constructor
+ def __new__(Class, Cursor, MetaFile, FileType=None, Temporary=False):
+ # no type given, try to find one
+ if not FileType:
+ if MetaFile.Type in self._FILE_TYPE_:
+ FileType = Class._FILE_TYPE_[MetaFile.Type]
+ else:
+ FileType = MODEL_FILE_OTHERS
+
+ # don't pass the type around if it's well known
+ if FileType == MODEL_FILE_OTHERS:
+ Args = (Cursor, MetaFile, FileType, Temporary)
+ else:
+ Args = (Cursor, MetaFile, FileType, Temporary)
+
+ # create the storage object and return it to caller
+ return Class._FILE_TABLE_[FileType](*Args)
+
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/__init__.py b/roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/__init__.py
new file mode 100644
index 000000000..85ae9937c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/MetaFileWorkspace/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'Workspace' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/ParserWarning.py b/roms/edk2/BaseTools/Source/Python/Ecc/ParserWarning.py
new file mode 100644
index 000000000..2ae66d484
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/ParserWarning.py
@@ -0,0 +1,24 @@
+## @file
+# This file is used to be the warning class of ECC tool
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+## The exception class that used to report error messages when preprocessing
+#
+# Currently the "ToolName" is set to be "ECC PP".
+#
+class Warning (Exception):
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param File The FDF name
+ # @param Line The Line number that error occurs
+ #
+ def __init__(self, Str, File = None, Line = None):
+ self.message = Str
+ self.FileName = File
+ self.LineNumber = Line
+ self.ToolName = 'ECC PP'
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py b/roms/edk2/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py
new file mode 100644
index 000000000..b02f663b1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py
@@ -0,0 +1,225 @@
+## @file
+# This is an XML API that uses a syntax similar to XPath, but it is written in
+# standard python so that no extra python packages are required to use it.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+import xml.dom.minidom
+import codecs
+from Common.LongFilePathSupport import OpenLongFilePath as open
+
+## Create a element of XML
+#
+# @param Name
+# @param String
+# @param NodeList
+# @param AttributeList
+#
+# @revel Element
+#
+def CreateXmlElement(Name, String, NodeList, AttributeList):
+ Doc = xml.dom.minidom.Document()
+ Element = Doc.createElement(Name)
+ if String != '' and String is not None:
+ Element.appendChild(Doc.createTextNode(String))
+
+ for Item in NodeList:
+ if isinstance(Item, type([])):
+ Key = Item[0]
+ Value = Item[1]
+ if Key != '' and Key is not None and Value != '' and Value is not None:
+ Node = Doc.createElement(Key)
+ Node.appendChild(Doc.createTextNode(Value))
+ Element.appendChild(Node)
+ else:
+ Element.appendChild(Item)
+ for Item in AttributeList:
+ Key = Item[0]
+ Value = Item[1]
+ if Key != '' and Key is not None and Value != '' and Value is not None:
+ Element.setAttribute(Key, Value)
+
+ return Element
+
+## Get a list of XML nodes using XPath style syntax.
+#
+# Return a list of XML DOM nodes from the root Dom specified by XPath String.
+# If the input Dom or String is not valid, then an empty list is returned.
+#
+# @param Dom The root XML DOM node.
+# @param String A XPath style path.
+#
+# @revel Nodes A list of XML nodes matching XPath style Sting.
+#
+def XmlList(Dom, String):
+ if String is None or String == "" or Dom is None or Dom == "":
+ return []
+ if Dom.nodeType == Dom.DOCUMENT_NODE:
+ Dom = Dom.documentElement
+ if String[0] == "/":
+ String = String[1:]
+ TagList = String.split('/')
+ Nodes = [Dom]
+ Index = 0
+ End = len(TagList) - 1
+ while Index <= End:
+ ChildNodes = []
+ for Node in Nodes:
+ if Node.nodeType == Node.ELEMENT_NODE and Node.tagName == TagList[Index]:
+ if Index < End:
+ ChildNodes.extend(Node.childNodes)
+ else:
+ ChildNodes.append(Node)
+ Nodes = ChildNodes
+ ChildNodes = []
+ Index += 1
+
+ return Nodes
+
+
+## Get a single XML node using XPath style syntax.
+#
+# Return a single XML DOM node from the root Dom specified by XPath String.
+# If the input Dom or String is not valid, then an empty string is returned.
+#
+# @param Dom The root XML DOM node.
+# @param String A XPath style path.
+#
+# @revel Node A single XML node matching XPath style Sting.
+#
+def XmlNode(Dom, String):
+ if String is None or String == "" or Dom is None or Dom == "":
+ return ""
+ if Dom.nodeType == Dom.DOCUMENT_NODE:
+ Dom = Dom.documentElement
+ if String[0] == "/":
+ String = String[1:]
+ TagList = String.split('/')
+ Index = 0
+ End = len(TagList) - 1
+ ChildNodes = [Dom]
+ while Index <= End:
+ for Node in ChildNodes:
+ if Node.nodeType == Node.ELEMENT_NODE and Node.tagName == TagList[Index]:
+ if Index < End:
+ ChildNodes = Node.childNodes
+ else:
+ return Node
+ break
+ Index += 1
+ return ""
+
+
+## Get a single XML element using XPath style syntax.
+#
+# Return a single XML element from the root Dom specified by XPath String.
+# If the input Dom or String is not valid, then an empty string is returned.
+#
+# @param Dom The root XML DOM object.
+# @param Strin A XPath style path.
+#
+# @revel Element An XML element matching XPath style Sting.
+#
+def XmlElement(Dom, String):
+ try:
+ return XmlNode(Dom, String).firstChild.data.strip()
+ except:
+ return ""
+
+
+## Get a single XML element of the current node.
+#
+# Return a single XML element specified by the current root Dom.
+# If the input Dom is not valid, then an empty string is returned.
+#
+# @param Dom The root XML DOM object.
+#
+# @revel Element An XML element in current root Dom.
+#
+def XmlElementData(Dom):
+ try:
+ return Dom.firstChild.data.strip()
+ except:
+ return ""
+
+
+## Get a list of XML elements using XPath style syntax.
+#
+# Return a list of XML elements from the root Dom specified by XPath String.
+# If the input Dom or String is not valid, then an empty list is returned.
+#
+# @param Dom The root XML DOM object.
+# @param String A XPath style path.
+#
+# @revel Elements A list of XML elements matching XPath style Sting.
+#
+def XmlElementList(Dom, String):
+ return map(XmlElementData, XmlList(Dom, String))
+
+
+## Get the XML attribute of the current node.
+#
+# Return a single XML attribute named Attribute from the current root Dom.
+# If the input Dom or Attribute is not valid, then an empty string is returned.
+#
+# @param Dom The root XML DOM object.
+# @param Attribute The name of Attribute.
+#
+# @revel Element A single XML element matching XPath style Sting.
+#
+def XmlAttribute(Dom, Attribute):
+ try:
+ return Dom.getAttribute(Attribute).strip()
+ except:
+ return ''
+
+
+## Get the XML node name of the current node.
+#
+# Return a single XML node name from the current root Dom.
+# If the input Dom is not valid, then an empty string is returned.
+#
+# @param Dom The root XML DOM object.
+#
+# @revel Element A single XML element matching XPath style Sting.
+#
+def XmlNodeName(Dom):
+ try:
+ return Dom.nodeName.strip()
+ except:
+ return ''
+
+## Parse an XML file.
+#
+# Parse the input XML file named FileName and return a XML DOM it stands for.
+# If the input File is not a valid XML file, then an empty string is returned.
+#
+# @param FileName The XML file name.
+#
+# @revel Dom The Dom object achieved from the XML file.
+#
+def XmlParseFile(FileName):
+ try:
+ XmlFile = codecs.open(FileName,encoding='utf_8_sig')
+ Dom = xml.dom.minidom.parse(XmlFile)
+ XmlFile.close()
+ return Dom
+ except Exception as X:
+ print(X)
+ return ""
+
+# This acts like the main() function for the script, unless it is 'import'ed
+# into another script.
+if __name__ == '__main__':
+ # Nothing to do here. Could do some unit tests.
+ A = CreateXmlElement('AAA', 'CCC', [['AAA', '111'], ['BBB', '222']], [['A', '1'], ['B', '2']])
+ B = CreateXmlElement('ZZZ', 'CCC', [['XXX', '111'], ['YYY', '222']], [['A', '1'], ['B', '2']])
+ C = CreateXmlList('DDD', 'EEE', [A, B], ['FFF', 'GGG'])
+ print(C.toprettyxml(indent = " "))
+ pass
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/Xml/__init__.py b/roms/edk2/BaseTools/Source/Python/Ecc/Xml/__init__.py
new file mode 100644
index 000000000..172e49845
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/Xml/__init__.py
@@ -0,0 +1,14 @@
+## @file
+# Python 'Library' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Xml
+'''
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/__init__.py b/roms/edk2/BaseTools/Source/Python/Ecc/__init__.py
new file mode 100644
index 000000000..a1cac674d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'Ecc' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/c.py b/roms/edk2/BaseTools/Source/Python/Ecc/c.py
new file mode 100644
index 000000000..a30122a45
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/c.py
@@ -0,0 +1,2651 @@
+## @file
+# This file is used to be the c coding style checking of ECC tool
+#
+# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import print_function
+from __future__ import absolute_import
+import sys
+import Common.LongFilePathOs as os
+import re
+import string
+from Ecc import CodeFragmentCollector
+from Ecc import FileProfile
+from CommonDataClass import DataClass
+from Ecc import Database
+from Common import EdkLogger
+from Ecc.EccToolError import *
+from Ecc import EccGlobalData
+from Ecc import MetaDataParser
+
+IncludeFileListDict = {}
+AllIncludeFileListDict = {}
+IncludePathListDict = {}
+ComplexTypeDict = {}
+SUDict = {}
+IgnoredKeywordList = ['EFI_ERROR']
+
+def GetIgnoredDirListPattern():
+ skipList = list(EccGlobalData.gConfig.SkipDirList) + ['.svn']
+ DirString = '|'.join(skipList)
+ p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % DirString)
+ return p
+
+def GetFuncDeclPattern():
+ p = re.compile(r'(?:EFIAPI|EFI_BOOT_SERVICE|EFI_RUNTIME_SERVICE)?\s*[_\w]+\s*\(.*\)$', re.DOTALL)
+ return p
+
+def GetArrayPattern():
+ p = re.compile(r'[_\w]*\s*[\[.*\]]+')
+ return p
+
+def GetTypedefFuncPointerPattern():
+ p = re.compile('[_\w\s]*\([\w\s]*\*+\s*[_\w]+\s*\)\s*\(.*\)', re.DOTALL)
+ return p
+
+def GetDB():
+ return EccGlobalData.gDb
+
+def GetConfig():
+ return EccGlobalData.gConfig
+
+def PrintErrorMsg(ErrorType, Msg, TableName, ItemId):
+ Msg = Msg.replace('\n', '').replace('\r', '')
+ MsgPartList = Msg.split()
+ Msg = ''
+ for Part in MsgPartList:
+ Msg += Part
+ Msg += ' '
+ GetDB().TblReport.Insert(ErrorType, OtherMsg=Msg, BelongsToTable=TableName, BelongsToItem=ItemId)
+
+def GetIdType(Str):
+ Type = DataClass.MODEL_UNKNOWN
+ Str = Str.replace('#', '# ')
+ List = Str.split()
+ if List[1] == 'include':
+ Type = DataClass.MODEL_IDENTIFIER_INCLUDE
+ elif List[1] == 'define':
+ Type = DataClass.MODEL_IDENTIFIER_MACRO_DEFINE
+ elif List[1] == 'ifdef':
+ Type = DataClass.MODEL_IDENTIFIER_MACRO_IFDEF
+ elif List[1] == 'ifndef':
+ Type = DataClass.MODEL_IDENTIFIER_MACRO_IFNDEF
+ elif List[1] == 'endif':
+ Type = DataClass.MODEL_IDENTIFIER_MACRO_ENDIF
+ elif List[1] == 'pragma':
+ Type = DataClass.MODEL_IDENTIFIER_MACRO_PROGMA
+ else:
+ Type = DataClass.MODEL_UNKNOWN
+ return Type
+
+def SuOccurInTypedef (Su, TdList):
+ for Td in TdList:
+ if Su.StartPos[0] == Td.StartPos[0] and Su.EndPos[0] == Td.EndPos[0]:
+ return True
+ return False
+
+def GetIdentifierList():
+ IdList = []
+ for comment in FileProfile.CommentList:
+ IdComment = DataClass.IdentifierClass(-1, '', '', '', comment.Content, DataClass.MODEL_IDENTIFIER_COMMENT, -1, -1, comment.StartPos[0], comment.StartPos[1], comment.EndPos[0], comment.EndPos[1])
+ IdList.append(IdComment)
+
+ for pp in FileProfile.PPDirectiveList:
+ Type = GetIdType(pp.Content)
+ IdPP = DataClass.IdentifierClass(-1, '', '', '', pp.Content, Type, -1, -1, pp.StartPos[0], pp.StartPos[1], pp.EndPos[0], pp.EndPos[1])
+ IdList.append(IdPP)
+
+ for pe in FileProfile.PredicateExpressionList:
+ IdPE = DataClass.IdentifierClass(-1, '', '', '', pe.Content, DataClass.MODEL_IDENTIFIER_PREDICATE_EXPRESSION, -1, -1, pe.StartPos[0], pe.StartPos[1], pe.EndPos[0], pe.EndPos[1])
+ IdList.append(IdPE)
+
+ FuncDeclPattern = GetFuncDeclPattern()
+ ArrayPattern = GetArrayPattern()
+ for var in FileProfile.VariableDeclarationList:
+ DeclText = var.Declarator.lstrip()
+ FuncPointerPattern = GetTypedefFuncPointerPattern()
+ if FuncPointerPattern.match(DeclText):
+ continue
+ VarNameStartLine = var.NameStartPos[0]
+ VarNameStartColumn = var.NameStartPos[1]
+ FirstChar = DeclText[0]
+ while not FirstChar.isalpha() and FirstChar != '_':
+ if FirstChar == '*':
+ var.Modifier += '*'
+ VarNameStartColumn += 1
+ DeclText = DeclText.lstrip('*')
+ elif FirstChar == '\r':
+ DeclText = DeclText.lstrip('\r\n').lstrip('\r')
+ VarNameStartLine += 1
+ VarNameStartColumn = 0
+ elif FirstChar == '\n':
+ DeclText = DeclText.lstrip('\n')
+ VarNameStartLine += 1
+ VarNameStartColumn = 0
+ elif FirstChar == ' ':
+ DeclText = DeclText.lstrip(' ')
+ VarNameStartColumn += 1
+ elif FirstChar == '\t':
+ DeclText = DeclText.lstrip('\t')
+ VarNameStartColumn += 8
+ else:
+ DeclText = DeclText[1:]
+ VarNameStartColumn += 1
+ FirstChar = DeclText[0]
+
+ var.Declarator = DeclText
+ if FuncDeclPattern.match(var.Declarator):
+ DeclSplitList = var.Declarator.split('(')
+ FuncName = DeclSplitList[0].strip()
+ FuncNamePartList = FuncName.split()
+ if len(FuncNamePartList) > 1:
+ FuncName = FuncNamePartList[-1].strip()
+ NameStart = DeclSplitList[0].rfind(FuncName)
+ var.Declarator = var.Declarator[NameStart:]
+ if NameStart > 0:
+ var.Modifier += ' ' + DeclSplitList[0][0:NameStart]
+ Index = 0
+ PreChar = ''
+ while Index < NameStart:
+ FirstChar = DeclSplitList[0][Index]
+ if DeclSplitList[0][Index:].startswith('EFIAPI'):
+ Index += 6
+ VarNameStartColumn += 6
+ PreChar = ''
+ continue
+ elif FirstChar == '\r':
+ Index += 1
+ VarNameStartLine += 1
+ VarNameStartColumn = 0
+ elif FirstChar == '\n':
+ Index += 1
+ if PreChar != '\r':
+ VarNameStartLine += 1
+ VarNameStartColumn = 0
+ elif FirstChar == ' ':
+ Index += 1
+ VarNameStartColumn += 1
+ elif FirstChar == '\t':
+ Index += 1
+ VarNameStartColumn += 8
+ else:
+ Index += 1
+ VarNameStartColumn += 1
+ PreChar = FirstChar
+ IdVar = DataClass.IdentifierClass(-1, var.Modifier, '', var.Declarator, FuncName, DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION, -1, -1, var.StartPos[0], var.StartPos[1], VarNameStartLine, VarNameStartColumn)
+ IdList.append(IdVar)
+ continue
+
+ if var.Declarator.find('{') == -1:
+ for decl in var.Declarator.split(','):
+ DeclList = decl.split('=')
+ Name = DeclList[0].strip()
+ if ArrayPattern.match(Name):
+ LSBPos = var.Declarator.find('[')
+ var.Modifier += ' ' + Name[LSBPos:]
+ Name = Name[0:LSBPos]
+
+ IdVar = DataClass.IdentifierClass(-1, var.Modifier, '', Name, (len(DeclList) > 1 and [DeclList[1]]or [''])[0], DataClass.MODEL_IDENTIFIER_VARIABLE, -1, -1, var.StartPos[0], var.StartPos[1], VarNameStartLine, VarNameStartColumn)
+ IdList.append(IdVar)
+ else:
+ DeclList = var.Declarator.split('=')
+ Name = DeclList[0].strip()
+ if ArrayPattern.match(Name):
+ LSBPos = var.Declarator.find('[')
+ var.Modifier += ' ' + Name[LSBPos:]
+ Name = Name[0:LSBPos]
+ IdVar = DataClass.IdentifierClass(-1, var.Modifier, '', Name, (len(DeclList) > 1 and [DeclList[1]]or [''])[0], DataClass.MODEL_IDENTIFIER_VARIABLE, -1, -1, var.StartPos[0], var.StartPos[1], VarNameStartLine, VarNameStartColumn)
+ IdList.append(IdVar)
+
+ for enum in FileProfile.EnumerationDefinitionList:
+ LBPos = enum.Content.find('{')
+ RBPos = enum.Content.find('}')
+ Name = enum.Content[4:LBPos].strip()
+ Value = enum.Content[LBPos + 1:RBPos]
+ IdEnum = DataClass.IdentifierClass(-1, '', '', Name, Value, DataClass.MODEL_IDENTIFIER_ENUMERATE, -1, -1, enum.StartPos[0], enum.StartPos[1], enum.EndPos[0], enum.EndPos[1])
+ IdList.append(IdEnum)
+
+ for su in FileProfile.StructUnionDefinitionList:
+ if SuOccurInTypedef(su, FileProfile.TypedefDefinitionList):
+ continue
+ Type = DataClass.MODEL_IDENTIFIER_STRUCTURE
+ SkipLen = 6
+ if su.Content.startswith('union'):
+ Type = DataClass.MODEL_IDENTIFIER_UNION
+ SkipLen = 5
+ LBPos = su.Content.find('{')
+ RBPos = su.Content.find('}')
+ if LBPos == -1 or RBPos == -1:
+ Name = su.Content[SkipLen:].strip()
+ Value = ''
+ else:
+ Name = su.Content[SkipLen:LBPos].strip()
+ Value = su.Content[LBPos:RBPos + 1]
+ IdPE = DataClass.IdentifierClass(-1, '', '', Name, Value, Type, -1, -1, su.StartPos[0], su.StartPos[1], su.EndPos[0], su.EndPos[1])
+ IdList.append(IdPE)
+
+ TdFuncPointerPattern = GetTypedefFuncPointerPattern()
+ for td in FileProfile.TypedefDefinitionList:
+ Modifier = ''
+ Name = td.ToType
+ Value = td.FromType
+ if TdFuncPointerPattern.match(td.ToType):
+ Modifier = td.FromType
+ LBPos = td.ToType.find('(')
+ TmpStr = td.ToType[LBPos + 1:].strip()
+ StarPos = TmpStr.find('*')
+ if StarPos != -1:
+ Modifier += ' ' + TmpStr[0:StarPos]
+ while TmpStr[StarPos] == '*':
+# Modifier += ' ' + '*'
+ StarPos += 1
+ TmpStr = TmpStr[StarPos:].strip()
+ RBPos = TmpStr.find(')')
+ Name = TmpStr[0:RBPos]
+ Value = 'FP' + TmpStr[RBPos + 1:]
+ else:
+ while Name.startswith('*'):
+ Value += ' ' + '*'
+ Name = Name.lstrip('*').strip()
+
+ if Name.find('[') != -1:
+ LBPos = Name.find('[')
+ RBPos = Name.rfind(']')
+ Value += Name[LBPos : RBPos + 1]
+ Name = Name[0 : LBPos]
+
+ IdTd = DataClass.IdentifierClass(-1, Modifier, '', Name, Value, DataClass.MODEL_IDENTIFIER_TYPEDEF, -1, -1, td.StartPos[0], td.StartPos[1], td.EndPos[0], td.EndPos[1])
+ IdList.append(IdTd)
+
+ for funcCall in FileProfile.FunctionCallingList:
+ IdFC = DataClass.IdentifierClass(-1, '', '', funcCall.FuncName, funcCall.ParamList, DataClass.MODEL_IDENTIFIER_FUNCTION_CALLING, -1, -1, funcCall.StartPos[0], funcCall.StartPos[1], funcCall.EndPos[0], funcCall.EndPos[1])
+ IdList.append(IdFC)
+ return IdList
+
+def StripNonAlnumChars(Str):
+ StrippedStr = ''
+ for Char in Str:
+ if Char.isalnum() or Char == '_':
+ StrippedStr += Char
+ return StrippedStr
+
+def GetParamList(FuncDeclarator, FuncNameLine=0, FuncNameOffset=0):
+ FuncDeclarator = StripComments(FuncDeclarator)
+ ParamIdList = []
+ #DeclSplitList = FuncDeclarator.split('(')
+ LBPos = FuncDeclarator.find('(')
+ #if len(DeclSplitList) < 2:
+ if LBPos == -1:
+ return ParamIdList
+ #FuncName = DeclSplitList[0]
+ FuncName = FuncDeclarator[0:LBPos]
+ #ParamStr = DeclSplitList[1].rstrip(')')
+ ParamStr = FuncDeclarator[LBPos + 1:].rstrip(')')
+ LineSkipped = 0
+ OffsetSkipped = 0
+ TailChar = FuncName[-1]
+ while not TailChar.isalpha() and TailChar != '_':
+
+ if TailChar == '\n':
+ FuncName = FuncName.rstrip('\r\n').rstrip('\n')
+ LineSkipped += 1
+ OffsetSkipped = 0
+ elif TailChar == '\r':
+ FuncName = FuncName.rstrip('\r')
+ LineSkipped += 1
+ OffsetSkipped = 0
+ elif TailChar == ' ':
+ FuncName = FuncName.rstrip(' ')
+ OffsetSkipped += 1
+ elif TailChar == '\t':
+ FuncName = FuncName.rstrip('\t')
+ OffsetSkipped += 8
+ else:
+ FuncName = FuncName[:-1]
+ TailChar = FuncName[-1]
+
+ OffsetSkipped += 1 #skip '('
+
+ for p in ParamStr.split(','):
+ ListP = p.split()
+ if len(ListP) == 0:
+ continue
+ ParamName = ListP[-1]
+ DeclText = ParamName.strip()
+ RightSpacePos = p.rfind(ParamName)
+ ParamModifier = p[0:RightSpacePos]
+ if ParamName == 'OPTIONAL':
+ if ParamModifier == '':
+ ParamModifier += ' ' + 'OPTIONAL'
+ DeclText = ''
+ else:
+ ParamName = ListP[-2]
+ DeclText = ParamName.strip()
+ RightSpacePos = p.rfind(ParamName)
+ ParamModifier = p[0:RightSpacePos]
+ ParamModifier += 'OPTIONAL'
+ while DeclText.startswith('*'):
+ ParamModifier += ' ' + '*'
+ DeclText = DeclText.lstrip('*').strip()
+ ParamName = DeclText
+ # ignore array length if exists.
+ LBIndex = ParamName.find('[')
+ if LBIndex != -1:
+ ParamName = ParamName[0:LBIndex]
+
+ Start = RightSpacePos
+ Index = 0
+ PreChar = ''
+ while Index < Start:
+ FirstChar = p[Index]
+
+ if FirstChar == '\r':
+ Index += 1
+ LineSkipped += 1
+ OffsetSkipped = 0
+ elif FirstChar == '\n':
+ Index += 1
+ if PreChar != '\r':
+ LineSkipped += 1
+ OffsetSkipped = 0
+ elif FirstChar == ' ':
+ Index += 1
+ OffsetSkipped += 1
+ elif FirstChar == '\t':
+ Index += 1
+ OffsetSkipped += 8
+ else:
+ Index += 1
+ OffsetSkipped += 1
+ PreChar = FirstChar
+
+ ParamBeginLine = FuncNameLine + LineSkipped
+ ParamBeginOffset = FuncNameOffset + OffsetSkipped
+
+ Index = Start + len(ParamName)
+ PreChar = ''
+ while Index < len(p):
+ FirstChar = p[Index]
+
+ if FirstChar == '\r':
+ Index += 1
+ LineSkipped += 1
+ OffsetSkipped = 0
+ elif FirstChar == '\n':
+ Index += 1
+ if PreChar != '\r':
+ LineSkipped += 1
+ OffsetSkipped = 0
+ elif FirstChar == ' ':
+ Index += 1
+ OffsetSkipped += 1
+ elif FirstChar == '\t':
+ Index += 1
+ OffsetSkipped += 8
+ else:
+ Index += 1
+ OffsetSkipped += 1
+ PreChar = FirstChar
+
+ ParamEndLine = FuncNameLine + LineSkipped
+ ParamEndOffset = FuncNameOffset + OffsetSkipped
+ if ParamName != '...':
+ ParamName = StripNonAlnumChars(ParamName)
+ IdParam = DataClass.IdentifierClass(-1, ParamModifier, '', ParamName, '', DataClass.MODEL_IDENTIFIER_PARAMETER, -1, -1, ParamBeginLine, ParamBeginOffset, ParamEndLine, ParamEndOffset)
+ ParamIdList.append(IdParam)
+
+ OffsetSkipped += 1 #skip ','
+
+ return ParamIdList
+
+def GetFunctionList():
+ FuncObjList = []
+ for FuncDef in FileProfile.FunctionDefinitionList:
+ ParamIdList = []
+ DeclText = FuncDef.Declarator.lstrip()
+ FuncNameStartLine = FuncDef.NamePos[0]
+ FuncNameStartColumn = FuncDef.NamePos[1]
+ FirstChar = DeclText[0]
+ while not FirstChar.isalpha() and FirstChar != '_':
+ if FirstChar == '*':
+ FuncDef.Modifier += '*'
+ FuncNameStartColumn += 1
+ DeclText = DeclText.lstrip('*')
+ elif FirstChar == '\r':
+ DeclText = DeclText.lstrip('\r\n').lstrip('\r')
+ FuncNameStartLine += 1
+ FuncNameStartColumn = 0
+ elif FirstChar == '\n':
+ DeclText = DeclText.lstrip('\n')
+ FuncNameStartLine += 1
+ FuncNameStartColumn = 0
+ elif FirstChar == ' ':
+ DeclText = DeclText.lstrip(' ')
+ FuncNameStartColumn += 1
+ elif FirstChar == '\t':
+ DeclText = DeclText.lstrip('\t')
+ FuncNameStartColumn += 8
+ else:
+ DeclText = DeclText[1:]
+ FuncNameStartColumn += 1
+ FirstChar = DeclText[0]
+
+ FuncDef.Declarator = DeclText
+ DeclSplitList = FuncDef.Declarator.split('(')
+ if len(DeclSplitList) < 2:
+ continue
+
+ FuncName = DeclSplitList[0]
+ FuncNamePartList = FuncName.split()
+ if len(FuncNamePartList) > 1:
+ FuncName = FuncNamePartList[-1]
+ NameStart = DeclSplitList[0].rfind(FuncName)
+ if NameStart > 0:
+ FuncDef.Modifier += ' ' + DeclSplitList[0][0:NameStart]
+ Index = 0
+ PreChar = ''
+ while Index < NameStart:
+ FirstChar = DeclSplitList[0][Index]
+ if DeclSplitList[0][Index:].startswith('EFIAPI'):
+ Index += 6
+ FuncNameStartColumn += 6
+ PreChar = ''
+ continue
+ elif FirstChar == '\r':
+ Index += 1
+ FuncNameStartLine += 1
+ FuncNameStartColumn = 0
+ elif FirstChar == '\n':
+ Index += 1
+ if PreChar != '\r':
+ FuncNameStartLine += 1
+ FuncNameStartColumn = 0
+ elif FirstChar == ' ':
+ Index += 1
+ FuncNameStartColumn += 1
+ elif FirstChar == '\t':
+ Index += 1
+ FuncNameStartColumn += 8
+ else:
+ Index += 1
+ FuncNameStartColumn += 1
+ PreChar = FirstChar
+
+ FuncObj = DataClass.FunctionClass(-1, FuncDef.Declarator, FuncDef.Modifier, FuncName.strip(), '', FuncDef.StartPos[0], FuncDef.StartPos[1], FuncDef.EndPos[0], FuncDef.EndPos[1], FuncDef.LeftBracePos[0], FuncDef.LeftBracePos[1], -1, ParamIdList, [], FuncNameStartLine, FuncNameStartColumn)
+ FuncObjList.append(FuncObj)
+
+ return FuncObjList
+
+def GetFileModificationTimeFromDB(FullFileName):
+ TimeValue = 0.0
+ Db = GetDB()
+ SqlStatement = """ select TimeStamp
+ from File
+ where FullPath = \'%s\'
+ """ % (FullFileName)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ TimeValue = Result[0]
+ return TimeValue
+
+def CollectSourceCodeDataIntoDB(RootDir):
+ FileObjList = []
+ tuple = os.walk(RootDir)
+ IgnoredPattern = GetIgnoredDirListPattern()
+ ParseErrorFileList = []
+ TokenReleaceList = EccGlobalData.gConfig.TokenReleaceList
+ TokenReleaceList.extend(['L",\\\""'])
+
+ for dirpath, dirnames, filenames in tuple:
+ if IgnoredPattern.match(dirpath.upper()):
+ continue
+
+ for Dir in dirnames:
+ Dirname = os.path.join(dirpath, Dir)
+ if os.path.islink(Dirname):
+ Dirname = os.path.realpath(Dirname)
+ if os.path.isdir(Dirname):
+ # symlinks to directories are treated as directories
+ dirnames.remove(Dir)
+ dirnames.append(Dirname)
+
+ for f in filenames:
+ if f.lower() in EccGlobalData.gConfig.SkipFileList:
+ continue
+ collector = None
+ FullName = os.path.normpath(os.path.join(dirpath, f))
+ model = DataClass.MODEL_FILE_OTHERS
+ if os.path.splitext(f)[1] in ('.h', '.c'):
+ EdkLogger.info("Parsing " + FullName)
+ model = f.endswith('c') and DataClass.MODEL_FILE_C or DataClass.MODEL_FILE_H
+ collector = CodeFragmentCollector.CodeFragmentCollector(FullName)
+ collector.TokenReleaceList = TokenReleaceList
+ try:
+ collector.ParseFile()
+ except UnicodeError:
+ ParseErrorFileList.append(FullName)
+ collector.CleanFileProfileBuffer()
+ collector.ParseFileWithClearedPPDirective()
+# collector.PrintFragments()
+ BaseName = os.path.basename(f)
+ DirName = os.path.dirname(FullName)
+ Ext = os.path.splitext(f)[1].lstrip('.')
+ ModifiedTime = os.path.getmtime(FullName)
+ FileObj = DataClass.FileClass(-1, BaseName, Ext, DirName, FullName, model, ModifiedTime, GetFunctionList(), GetIdentifierList(), [])
+ FileObjList.append(FileObj)
+ if collector:
+ collector.CleanFileProfileBuffer()
+
+ if len(ParseErrorFileList) > 0:
+ EdkLogger.info("Found unrecoverable error during parsing:\n\t%s\n" % "\n\t".join(ParseErrorFileList))
+
+ Db = GetDB()
+ for file in FileObjList:
+ if file.ExtName.upper() not in ['INF', 'DEC', 'DSC', 'FDF']:
+ Db.InsertOneFile(file)
+
+ Db.UpdateIdentifierBelongsToFunction()
+
+def GetTableID(FullFileName, ErrorMsgList=None):
+ if ErrorMsgList is None:
+ ErrorMsgList = []
+
+ Db = GetDB()
+ SqlStatement = """ select ID
+ from File
+ where FullPath like '%s'
+ """ % FullFileName
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+
+ FileID = -1
+ for Result in ResultSet:
+ if FileID != -1:
+ ErrorMsgList.append('Duplicate file ID found in DB for file %s' % FullFileName)
+ return - 2
+ FileID = Result[0]
+ if FileID == -1:
+ ErrorMsgList.append('NO file ID found in DB for file %s' % FullFileName)
+ return - 1
+ return FileID
+
+def GetIncludeFileList(FullFileName):
+ if os.path.splitext(FullFileName)[1].upper() not in ('.H'):
+ return []
+ IFList = IncludeFileListDict.get(FullFileName)
+ if IFList is not None:
+ return IFList
+
+ FileID = GetTableID(FullFileName)
+ if FileID < 0:
+ return []
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Value
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_INCLUDE)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ IncludeFileListDict[FullFileName] = ResultSet
+ return ResultSet
+
+def GetFullPathOfIncludeFile(Str, IncludePathList):
+ for IncludePath in IncludePathList:
+ FullPath = os.path.join(IncludePath, Str)
+ FullPath = os.path.normpath(FullPath)
+ if os.path.exists(FullPath):
+ return FullPath
+ return None
+
+def GetAllIncludeFiles(FullFileName):
+ if AllIncludeFileListDict.get(FullFileName) is not None:
+ return AllIncludeFileListDict.get(FullFileName)
+
+ FileDirName = os.path.dirname(FullFileName)
+ IncludePathList = IncludePathListDict.get(FileDirName)
+ if IncludePathList is None:
+ IncludePathList = MetaDataParser.GetIncludeListOfFile(EccGlobalData.gWorkspace, FullFileName, GetDB())
+ if FileDirName not in IncludePathList:
+ IncludePathList.insert(0, FileDirName)
+ IncludePathListDict[FileDirName] = IncludePathList
+ IncludeFileQueue = []
+ for IncludeFile in GetIncludeFileList(FullFileName):
+ FileName = IncludeFile[0].lstrip('#').strip()
+ FileName = FileName.lstrip('include').strip()
+ FileName = FileName.strip('\"')
+ FileName = FileName.lstrip('<').rstrip('>').strip()
+ FullPath = GetFullPathOfIncludeFile(FileName, IncludePathList)
+ if FullPath is not None:
+ IncludeFileQueue.append(FullPath)
+
+ i = 0
+ while i < len(IncludeFileQueue):
+ for IncludeFile in GetIncludeFileList(IncludeFileQueue[i]):
+ FileName = IncludeFile[0].lstrip('#').strip()
+ FileName = FileName.lstrip('include').strip()
+ FileName = FileName.strip('\"')
+ FileName = FileName.lstrip('<').rstrip('>').strip()
+ FullPath = GetFullPathOfIncludeFile(FileName, IncludePathList)
+ if FullPath is not None and FullPath not in IncludeFileQueue:
+ IncludeFileQueue.insert(i + 1, FullPath)
+ i += 1
+
+ AllIncludeFileListDict[FullFileName] = IncludeFileQueue
+ return IncludeFileQueue
+
+def GetPredicateListFromPredicateExpStr(PES):
+
+ PredicateList = []
+ i = 0
+ PredicateBegin = 0
+ #PredicateEnd = 0
+ LogicOpPos = -1
+ p = GetFuncDeclPattern()
+ while i < len(PES) - 1:
+ if (PES[i].isalnum() or PES[i] == '_' or PES[i] == '*') and LogicOpPos > PredicateBegin:
+ PredicateBegin = i
+ if (PES[i] == '&' and PES[i + 1] == '&') or (PES[i] == '|' and PES[i + 1] == '|'):
+ LogicOpPos = i
+ Exp = PES[PredicateBegin:i].strip()
+ # Exp may contain '.' or '->'
+ TmpExp = Exp.replace('.', '').replace('->', '')
+ if p.match(TmpExp):
+ PredicateList.append(Exp)
+ else:
+ PredicateList.append(Exp.rstrip(';').rstrip(')').strip())
+ i += 1
+
+ if PredicateBegin > LogicOpPos:
+ while PredicateBegin < len(PES):
+ if PES[PredicateBegin].isalnum() or PES[PredicateBegin] == '_' or PES[PredicateBegin] == '*':
+ break
+ PredicateBegin += 1
+ Exp = PES[PredicateBegin:len(PES)].strip()
+ # Exp may contain '.' or '->'
+ TmpExp = Exp.replace('.', '').replace('->', '')
+ if p.match(TmpExp):
+ PredicateList.append(Exp)
+ else:
+ PredicateList.append(Exp.rstrip(';').rstrip(')').strip())
+ return PredicateList
+
+def GetCNameList(Lvalue, StarList=[]):
+ Lvalue += ' '
+ i = 0
+ SearchBegin = 0
+ VarStart = -1
+ VarEnd = -1
+ VarList = []
+
+ while SearchBegin < len(Lvalue):
+ while i < len(Lvalue):
+ if Lvalue[i].isalnum() or Lvalue[i] == '_':
+ if VarStart == -1:
+ VarStart = i
+ VarEnd = i
+ i += 1
+ elif VarEnd != -1:
+ VarList.append(Lvalue[VarStart:VarEnd + 1])
+ i += 1
+ break
+ else:
+ if VarStart == -1 and Lvalue[i] == '*':
+ StarList.append('*')
+ i += 1
+ if VarEnd == -1:
+ break
+
+
+ DotIndex = Lvalue[VarEnd:].find('.')
+ ArrowIndex = Lvalue[VarEnd:].find('->')
+ if DotIndex == -1 and ArrowIndex == -1:
+ break
+ elif DotIndex == -1 and ArrowIndex != -1:
+ SearchBegin = VarEnd + ArrowIndex
+ elif ArrowIndex == -1 and DotIndex != -1:
+ SearchBegin = VarEnd + DotIndex
+ else:
+ SearchBegin = VarEnd + ((DotIndex < ArrowIndex) and DotIndex or ArrowIndex)
+
+ i = SearchBegin
+ VarStart = -1
+ VarEnd = -1
+
+ return VarList
+
+def SplitPredicateByOp(Str, Op, IsFuncCalling=False):
+
+ Name = Str.strip()
+ Value = None
+
+ if IsFuncCalling:
+ Index = 0
+ LBFound = False
+ UnmatchedLBCount = 0
+ while Index < len(Str):
+ while not LBFound and Str[Index] != '_' and not Str[Index].isalnum():
+ Index += 1
+
+ while not LBFound and (Str[Index].isalnum() or Str[Index] == '_'):
+ Index += 1
+ # maybe type-cast at the beginning, skip it.
+ RemainingStr = Str[Index:].lstrip()
+ if RemainingStr.startswith(')') and not LBFound:
+ Index += 1
+ continue
+
+ if RemainingStr.startswith('(') and not LBFound:
+ LBFound = True
+
+ if Str[Index] == '(':
+ UnmatchedLBCount += 1
+ Index += 1
+ continue
+
+ if Str[Index] == ')':
+ UnmatchedLBCount -= 1
+ Index += 1
+ if UnmatchedLBCount == 0:
+ break
+ continue
+
+ Index += 1
+
+ if UnmatchedLBCount > 0:
+ return [Name]
+
+ IndexInRemainingStr = Str[Index:].find(Op)
+ if IndexInRemainingStr == -1:
+ return [Name]
+
+ Name = Str[0:Index + IndexInRemainingStr].strip()
+ Value = Str[Index + IndexInRemainingStr + len(Op):].strip().strip(')')
+ return [Name, Value]
+
+ TmpStr = Str.rstrip(';').rstrip(')')
+ while True:
+ Index = TmpStr.rfind(Op)
+ if Index == -1:
+ return [Name]
+
+ if Str[Index - 1].isalnum() or Str[Index - 1].isspace() or Str[Index - 1] == ')' or Str[Index - 1] == ']':
+ Name = Str[0:Index].strip()
+ Value = Str[Index + len(Op):].strip()
+ return [Name, Value]
+
+ TmpStr = Str[0:Index - 1]
+
+def SplitPredicateStr(Str):
+
+ Str = Str.lstrip('(')
+ IsFuncCalling = False
+ p = GetFuncDeclPattern()
+ TmpStr = Str.replace('.', '').replace('->', '')
+ if p.match(TmpStr):
+ IsFuncCalling = True
+
+ PredPartList = SplitPredicateByOp(Str, '==', IsFuncCalling)
+ if len(PredPartList) > 1:
+ return [PredPartList, '==']
+
+ PredPartList = SplitPredicateByOp(Str, '!=', IsFuncCalling)
+ if len(PredPartList) > 1:
+ return [PredPartList, '!=']
+
+ PredPartList = SplitPredicateByOp(Str, '>=', IsFuncCalling)
+ if len(PredPartList) > 1:
+ return [PredPartList, '>=']
+
+ PredPartList = SplitPredicateByOp(Str, '<=', IsFuncCalling)
+ if len(PredPartList) > 1:
+ return [PredPartList, '<=']
+
+ PredPartList = SplitPredicateByOp(Str, '>', IsFuncCalling)
+ if len(PredPartList) > 1:
+ return [PredPartList, '>']
+
+ PredPartList = SplitPredicateByOp(Str, '<', IsFuncCalling)
+ if len(PredPartList) > 1:
+ return [PredPartList, '<']
+
+ return [[Str, None], None]
+
+def GetFuncContainsPE(ExpLine, ResultSet):
+ for Result in ResultSet:
+ if Result[0] < ExpLine and Result[1] > ExpLine:
+ return Result
+ return None
+
+def PatternInModifier(Modifier, SubStr):
+ PartList = Modifier.split()
+ for Part in PartList:
+ if Part == SubStr:
+ return True
+ return False
+
+def GetDataTypeFromModifier(ModifierStr):
+ MList = ModifierStr.split()
+ ReturnType = ''
+ for M in MList:
+ if M in EccGlobalData.gConfig.ModifierSet:
+ continue
+ # remove array suffix
+ if M.startswith('[') or M.endswith(']'):
+ continue
+ ReturnType += M + ' '
+
+ ReturnType = ReturnType.strip()
+ if len(ReturnType) == 0:
+ ReturnType = 'VOID'
+ return ReturnType
+
+def DiffModifier(Str1, Str2):
+ PartList1 = Str1.split()
+ PartList2 = Str2.split()
+ if PartList1 == PartList2:
+ return False
+ else:
+ return True
+
+def GetTypedefDict(FullFileName):
+
+ Dict = ComplexTypeDict.get(FullFileName)
+ if Dict is not None:
+ return Dict
+
+ FileID = GetTableID(FullFileName)
+ FileTable = 'Identifier' + str(FileID)
+ Db = GetDB()
+ SqlStatement = """ select Modifier, Name, Value, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_TYPEDEF)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+
+ Dict = {}
+ for Result in ResultSet:
+ if len(Result[0]) == 0:
+ Dict[Result[1]] = Result[2]
+
+ IncludeFileList = GetAllIncludeFiles(FullFileName)
+ for F in IncludeFileList:
+ FileID = GetTableID(F)
+ if FileID < 0:
+ continue
+
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Modifier, Name, Value, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_TYPEDEF)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+
+ for Result in ResultSet:
+ if not Result[2].startswith('FP ('):
+ Dict[Result[1]] = Result[2]
+ else:
+ if len(Result[0]) == 0:
+ Dict[Result[1]] = 'VOID'
+ else:
+ Dict[Result[1]] = GetDataTypeFromModifier(Result[0])
+
+ ComplexTypeDict[FullFileName] = Dict
+ return Dict
+
+def GetSUDict(FullFileName):
+
+ Dict = SUDict.get(FullFileName)
+ if Dict is not None:
+ return Dict
+
+ FileID = GetTableID(FullFileName)
+ FileTable = 'Identifier' + str(FileID)
+ Db = GetDB()
+ SqlStatement = """ select Name, Value, ID
+ from %s
+ where Model = %d or Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_STRUCTURE, DataClass.MODEL_IDENTIFIER_UNION)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+
+ Dict = {}
+ for Result in ResultSet:
+ if len(Result[1]) > 0:
+ Dict[Result[0]] = Result[1]
+
+ IncludeFileList = GetAllIncludeFiles(FullFileName)
+ for F in IncludeFileList:
+ FileID = GetTableID(F)
+ if FileID < 0:
+ continue
+
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Name, Value, ID
+ from %s
+ where Model = %d or Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_STRUCTURE, DataClass.MODEL_IDENTIFIER_UNION)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+
+ for Result in ResultSet:
+ if len(Result[1]) > 0:
+ Dict[Result[0]] = Result[1]
+
+ SUDict[FullFileName] = Dict
+ return Dict
+
+def StripComments(Str):
+ Str += ' '
+ ListFromStr = list(Str)
+
+ InComment = False
+ DoubleSlashComment = False
+ Index = 0
+ while Index < len(ListFromStr):
+ # meet new line, then no longer in a comment for //
+ if ListFromStr[Index] == '\n':
+ if InComment and DoubleSlashComment:
+ InComment = False
+ DoubleSlashComment = False
+ Index += 1
+ # check for */ comment end
+ elif InComment and not DoubleSlashComment and ListFromStr[Index] == '*' and ListFromStr[Index + 1] == '/':
+ ListFromStr[Index] = ' '
+ Index += 1
+ ListFromStr[Index] = ' '
+ Index += 1
+ InComment = False
+ # set comments to spaces
+ elif InComment:
+ ListFromStr[Index] = ' '
+ Index += 1
+ # check for // comment
+ elif ListFromStr[Index] == '/' and ListFromStr[Index + 1] == '/':
+ InComment = True
+ DoubleSlashComment = True
+
+ # check for /* comment start
+ elif ListFromStr[Index] == '/' and ListFromStr[Index + 1] == '*':
+ ListFromStr[Index] = ' '
+ Index += 1
+ ListFromStr[Index] = ' '
+ Index += 1
+ InComment = True
+ else:
+ Index += 1
+
+ # restore from List to String
+ Str = "".join(ListFromStr)
+ Str = Str.rstrip(' ')
+
+ return Str
+
+def GetFinalTypeValue(Type, FieldName, TypedefDict, SUDict):
+ Value = TypedefDict.get(Type)
+ if Value is None:
+ Value = SUDict.get(Type)
+ if Value is None:
+ return None
+
+ LBPos = Value.find('{')
+ while LBPos == -1:
+ FTList = Value.split()
+ for FT in FTList:
+ if FT not in ('struct', 'union'):
+ Value = TypedefDict.get(FT)
+ if Value is None:
+ Value = SUDict.get(FT)
+ break
+
+ if Value is None:
+ return None
+
+ LBPos = Value.find('{')
+
+# RBPos = Value.find('}')
+ Fields = Value[LBPos + 1:]
+ Fields = StripComments(Fields)
+ FieldsList = Fields.split(';')
+ for Field in FieldsList:
+ Field = Field.strip()
+ Index = Field.rfind(FieldName)
+ if Index < 1:
+ continue
+ if not Field[Index - 1].isalnum():
+ if Index + len(FieldName) == len(Field):
+ Type = GetDataTypeFromModifier(Field[0:Index])
+ return Type.strip()
+ else:
+ # For the condition that the field in struct is an array with [] suffixes...
+ if not Field[Index + len(FieldName)].isalnum():
+ Type = GetDataTypeFromModifier(Field[0:Index])
+ return Type.strip()
+
+ return None
+
+def GetRealType(Type, TypedefDict, TargetType=None):
+ if TargetType is not None and Type == TargetType:
+ return Type
+ while TypedefDict.get(Type):
+ Type = TypedefDict.get(Type)
+ if TargetType is not None and Type == TargetType:
+ return Type
+ return Type
+
+def GetTypeInfo(RefList, Modifier, FullFileName, TargetType=None):
+ TypedefDict = GetTypedefDict(FullFileName)
+ SUDict = GetSUDict(FullFileName)
+ Type = GetDataTypeFromModifier(Modifier).replace('*', '').strip()
+
+ Type = Type.split()[-1]
+ Index = 0
+ while Index < len(RefList):
+ FieldName = RefList[Index]
+ FromType = GetFinalTypeValue(Type, FieldName, TypedefDict, SUDict)
+ if FromType is None:
+ return None
+ # we want to determine the exact type.
+ if TargetType is not None:
+ Type = FromType.split()[0]
+ # we only want to check if it is a pointer
+ else:
+ Type = FromType
+ if Type.find('*') != -1 and Index == len(RefList) - 1:
+ return Type
+ Type = FromType.split()[0]
+
+ Index += 1
+
+ Type = GetRealType(Type, TypedefDict, TargetType)
+
+ return Type
+
+def GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall=False, TargetType=None, StarList=None):
+
+ PredVar = PredVarList[0]
+ FileID = GetTableID(FullFileName)
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ # search variable in include files
+
+ # it is a function call, search function declarations and definitions
+ if IsFuncCall:
+ SqlStatement = """ select Modifier, ID
+ from %s
+ where Model = %d and Value = \'%s\'
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION, PredVar)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+
+ for Result in ResultSet:
+ Type = GetDataTypeFromModifier(Result[0]).split()[-1]
+ TypedefDict = GetTypedefDict(FullFileName)
+ Type = GetRealType(Type, TypedefDict, TargetType)
+ return Type
+
+ IncludeFileList = GetAllIncludeFiles(FullFileName)
+ for F in IncludeFileList:
+ FileID = GetTableID(F)
+ if FileID < 0:
+ continue
+
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Modifier, ID
+ from %s
+ where Model = %d and Value = \'%s\'
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION, PredVar)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+
+ for Result in ResultSet:
+ Type = GetDataTypeFromModifier(Result[0]).split()[-1]
+ TypedefDict = GetTypedefDict(FullFileName)
+ Type = GetRealType(Type, TypedefDict, TargetType)
+ return Type
+
+ FileID = GetTableID(FullFileName)
+ SqlStatement = """ select Modifier, ID
+ from Function
+ where BelongsToFile = %d and Name = \'%s\'
+ """ % (FileID, PredVar)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+
+ for Result in ResultSet:
+ Type = GetDataTypeFromModifier(Result[0]).split()[-1]
+ TypedefDict = GetTypedefDict(FullFileName)
+ Type = GetRealType(Type, TypedefDict, TargetType)
+ return Type
+
+ for F in IncludeFileList:
+ FileID = GetTableID(F)
+ if FileID < 0:
+ continue
+
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Modifier, ID
+ from Function
+ where BelongsToFile = %d and Name = \'%s\'
+ """ % (FileID, PredVar)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+
+ for Result in ResultSet:
+ Type = GetDataTypeFromModifier(Result[0]).split()[-1]
+ TypedefDict = GetTypedefDict(FullFileName)
+ Type = GetRealType(Type, TypedefDict, TargetType)
+ return Type
+
+ return None
+
+ # really variable, search local variable first
+ SqlStatement = """ select Modifier, ID
+ from %s
+ where Model = %d and Name = \'%s\' and StartLine >= %d and StartLine <= %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_VARIABLE, PredVar, FuncRecord[0], FuncRecord[1])
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ VarFound = False
+ for Result in ResultSet:
+ if len(PredVarList) > 1:
+ Type = GetTypeInfo(PredVarList[1:], Result[0], FullFileName, TargetType)
+ return Type
+ else:
+# Type = GetDataTypeFromModifier(Result[0]).split()[-1]
+ TypeList = GetDataTypeFromModifier(Result[0]).split()
+ Type = TypeList[-1]
+ if len(TypeList) > 1 and StarList is not None:
+ for Star in StarList:
+ Type = Type.strip()
+ Type = Type.rstrip(Star)
+ # Get real type after de-reference pointers.
+ if len(Type.strip()) == 0:
+ Type = TypeList[-2]
+ TypedefDict = GetTypedefDict(FullFileName)
+ Type = GetRealType(Type, TypedefDict, TargetType)
+ return Type
+
+ # search function parameters second
+ ParamList = GetParamList(FuncRecord[2])
+ for Param in ParamList:
+ if Param.Name.strip() == PredVar:
+ if len(PredVarList) > 1:
+ Type = GetTypeInfo(PredVarList[1:], Param.Modifier, FullFileName, TargetType)
+ return Type
+ else:
+ TypeList = GetDataTypeFromModifier(Param.Modifier).split()
+ Type = TypeList[-1]
+ if Type == '*' and len(TypeList) >= 2:
+ Type = TypeList[-2]
+ if len(TypeList) > 1 and StarList is not None:
+ for Star in StarList:
+ Type = Type.strip()
+ Type = Type.rstrip(Star)
+ # Get real type after de-reference pointers.
+ if len(Type.strip()) == 0:
+ Type = TypeList[-2]
+ TypedefDict = GetTypedefDict(FullFileName)
+ Type = GetRealType(Type, TypedefDict, TargetType)
+ return Type
+
+ # search global variable next
+ SqlStatement = """ select Modifier, ID
+ from %s
+ where Model = %d and Name = \'%s\' and BelongsToFunction = -1
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_VARIABLE, PredVar)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+
+ for Result in ResultSet:
+ if len(PredVarList) > 1:
+ Type = GetTypeInfo(PredVarList[1:], Result[0], FullFileName, TargetType)
+ return Type
+ else:
+ TypeList = GetDataTypeFromModifier(Result[0]).split()
+ Type = TypeList[-1]
+ if len(TypeList) > 1 and StarList is not None:
+ for Star in StarList:
+ Type = Type.strip()
+ Type = Type.rstrip(Star)
+ # Get real type after de-reference pointers.
+ if len(Type.strip()) == 0:
+ Type = TypeList[-2]
+ TypedefDict = GetTypedefDict(FullFileName)
+ Type = GetRealType(Type, TypedefDict, TargetType)
+ return Type
+
+ IncludeFileList = GetAllIncludeFiles(FullFileName)
+ for F in IncludeFileList:
+ FileID = GetTableID(F)
+ if FileID < 0:
+ continue
+
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Modifier, ID
+ from %s
+ where Model = %d and BelongsToFunction = -1 and Name = \'%s\'
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_VARIABLE, PredVar)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+
+ for Result in ResultSet:
+ if len(PredVarList) > 1:
+ Type = GetTypeInfo(PredVarList[1:], Result[0], FullFileName, TargetType)
+ return Type
+ else:
+ TypeList = GetDataTypeFromModifier(Result[0]).split()
+ Type = TypeList[-1]
+ if len(TypeList) > 1 and StarList is not None:
+ for Star in StarList:
+ Type = Type.strip()
+ Type = Type.rstrip(Star)
+ # Get real type after de-reference pointers.
+ if len(Type.strip()) == 0:
+ Type = TypeList[-2]
+ TypedefDict = GetTypedefDict(FullFileName)
+ Type = GetRealType(Type, TypedefDict, TargetType)
+ return Type
+
+def GetTypeFromArray(Type, Var):
+ Count = Var.count('[')
+
+ while Count > 0:
+ Type = Type.strip()
+ Type = Type.rstrip('*')
+ Count = Count - 1
+
+ return Type
+
+def CheckFuncLayoutReturnType(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Modifier, ID, StartLine, StartColumn, EndLine, Value
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ ReturnType = GetDataTypeFromModifier(Result[0])
+ TypeStart = ReturnType.split()[0]
+ FuncName = Result[5]
+ if EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, FuncName):
+ continue
+ Result0 = Result[0]
+ if Result0.upper().startswith('STATIC'):
+ Result0 = Result0[6:].strip()
+ Index = Result0.find(TypeStart)
+ if Index != 0 or Result[3] != 0:
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, '[%s] Return Type should appear at the start of line' % FuncName, FileTable, Result[1])
+
+ if Result[2] == Result[4]:
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, '[%s] Return Type should appear on its own line' % FuncName, FileTable, Result[1])
+
+ SqlStatement = """ select Modifier, ID, StartLine, StartColumn, FunNameStartLine, Name
+ from Function
+ where BelongsToFile = %d
+ """ % (FileID)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ ReturnType = GetDataTypeFromModifier(Result[0])
+ TypeStart = ReturnType.split()[0]
+ FuncName = Result[5]
+ if EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, FuncName):
+ continue
+ Result0 = Result[0]
+ if Result0.upper().startswith('STATIC'):
+ Result0 = Result0[6:].strip()
+ Index = Result0.find(TypeStart)
+ if Index != 0 or Result[3] != 0:
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, '[%s] Return Type should appear at the start of line' % FuncName, 'Function', Result[1])
+
+def CheckFuncLayoutModifier(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Modifier, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ ReturnType = GetDataTypeFromModifier(Result[0])
+ TypeStart = ReturnType.split()[0]
+ Result0 = Result[0]
+ if Result0.upper().startswith('STATIC'):
+ Result0 = Result0[6:].strip()
+ Index = Result0.find(TypeStart)
+ if Index != 0:
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER, '', FileTable, Result[1])
+
+ SqlStatement = """ select Modifier, ID
+ from Function
+ where BelongsToFile = %d
+ """ % (FileID)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ ReturnType = GetDataTypeFromModifier(Result[0])
+ TypeStart = ReturnType.split()[0]
+ Result0 = Result[0]
+ if Result0.upper().startswith('STATIC'):
+ Result0 = Result0[6:].strip()
+ Index = Result0.find(TypeStart)
+ if Index != 0:
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER, '', 'Function', Result[1])
+
+def CheckFuncLayoutName(FullFileName):
+ ErrorMsgList = []
+ # Parameter variable format pattern.
+ Pattern = re.compile(r'^[A-Z]+\S*[a-z]\S*$')
+ ParamIgnoreList = ('VOID', '...')
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Name, ID, EndColumn, Value
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ FuncName = Result[3]
+ if EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME, FuncName):
+ continue
+ if Result[2] != 0:
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME, 'Function name [%s] should appear at the start of a line' % FuncName, FileTable, Result[1])
+ ParamList = GetParamList(Result[0])
+ if len(ParamList) == 0:
+ continue
+ StartLine = 0
+ for Param in ParamList:
+ if Param.StartLine <= StartLine:
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME, 'Parameter %s should be in its own line.' % Param.Name, FileTable, Result[1])
+ if Param.StartLine - StartLine > 1:
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME, 'Empty line appears before Parameter %s.' % Param.Name, FileTable, Result[1])
+ if not Pattern.match(Param.Name) and not Param.Name in ParamIgnoreList and not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Param.Name):
+ PrintErrorMsg(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, 'Parameter [%s] NOT follow naming convention.' % Param.Name, FileTable, Result[1])
+ StartLine = Param.StartLine
+
+ if not Result[0].endswith('\n )') and not Result[0].endswith('\r )'):
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME, '\')\' should be on a new line and indented two spaces', FileTable, Result[1])
+
+ SqlStatement = """ select Modifier, ID, FunNameStartColumn, Name
+ from Function
+ where BelongsToFile = %d
+ """ % (FileID)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ FuncName = Result[3]
+ if EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME, FuncName):
+ continue
+ if Result[2] != 0:
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME, 'Function name [%s] should appear at the start of a line' % FuncName, 'Function', Result[1])
+ ParamList = GetParamList(Result[0])
+ if len(ParamList) == 0:
+ continue
+ StartLine = 0
+ for Param in ParamList:
+ if Param.StartLine <= StartLine:
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME, 'Parameter %s should be in its own line.' % Param.Name, 'Function', Result[1])
+ if Param.StartLine - StartLine > 1:
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME, 'Empty line appears before Parameter %s.' % Param.Name, 'Function', Result[1])
+ if not Pattern.match(Param.Name) and not Param.Name in ParamIgnoreList and not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Param.Name):
+ PrintErrorMsg(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, 'Parameter [%s] NOT follow naming convention.' % Param.Name, FileTable, Result[1])
+ StartLine = Param.StartLine
+ if not Result[0].endswith('\n )') and not Result[0].endswith('\r )'):
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME, '\')\' should be on a new line and indented two spaces', 'Function', Result[1])
+
+def CheckFuncLayoutPrototype(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ FileTable = 'Identifier' + str(FileID)
+ Db = GetDB()
+ SqlStatement = """ select Modifier, Header, Name, ID
+ from Function
+ where BelongsToFile = %d
+ """ % (FileID)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ if len(ResultSet) == 0:
+ return ErrorMsgList
+
+ FuncDefList = []
+ for Result in ResultSet:
+ FuncDefList.append(Result)
+
+ SqlStatement = """ select Modifier, Name, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ FuncDeclList = []
+ for Result in ResultSet:
+ FuncDeclList.append(Result)
+
+ UndeclFuncList = []
+ for FuncDef in FuncDefList:
+ FuncName = FuncDef[2].strip()
+ FuncModifier = FuncDef[0]
+ FuncDefHeader = FuncDef[1]
+ for FuncDecl in FuncDeclList:
+ LBPos = FuncDecl[1].find('(')
+ DeclName = FuncDecl[1][0:LBPos].strip()
+ DeclModifier = FuncDecl[0]
+ if DeclName == FuncName:
+ if DiffModifier(FuncModifier, DeclModifier) and not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE, FuncName):
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE, 'Function [%s] modifier different with prototype.' % FuncName, 'Function', FuncDef[3])
+ ParamListOfDef = GetParamList(FuncDefHeader)
+ ParamListOfDecl = GetParamList(FuncDecl[1])
+ if len(ParamListOfDef) != len(ParamListOfDecl) and not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_2, FuncName):
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_2, 'Parameter number different in function [%s].' % FuncName, 'Function', FuncDef[3])
+ break
+
+ Index = 0
+ while Index < len(ParamListOfDef):
+ if DiffModifier(ParamListOfDef[Index].Modifier, ParamListOfDecl[Index].Modifier) and not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3, FuncName):
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3, 'Parameter %s has different modifier with prototype in function [%s].' % (ParamListOfDef[Index].Name, FuncName), 'Function', FuncDef[3])
+ Index += 1
+ break
+ else:
+ UndeclFuncList.append(FuncDef)
+
+ IncludeFileList = GetAllIncludeFiles(FullFileName)
+ FuncDeclList = []
+ for F in IncludeFileList:
+ FileID = GetTableID(F, ErrorMsgList)
+ if FileID < 0:
+ continue
+
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Modifier, Name, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+
+ for Result in ResultSet:
+ FuncDeclList.append(Result)
+
+ for FuncDef in UndeclFuncList:
+ FuncName = FuncDef[2].strip()
+ FuncModifier = FuncDef[0]
+ FuncDefHeader = FuncDef[1]
+ for FuncDecl in FuncDeclList:
+ LBPos = FuncDecl[1].find('(')
+ DeclName = FuncDecl[1][0:LBPos].strip()
+ DeclModifier = FuncDecl[0]
+ if DeclName == FuncName:
+ if DiffModifier(FuncModifier, DeclModifier) and not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE, FuncName):
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE, 'Function [%s] modifier different with prototype.' % FuncName, 'Function', FuncDef[3])
+ ParamListOfDef = GetParamList(FuncDefHeader)
+ ParamListOfDecl = GetParamList(FuncDecl[1])
+ if len(ParamListOfDef) != len(ParamListOfDecl) and not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_2, FuncName):
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_2, 'Parameter number different in function [%s].' % FuncName, 'Function', FuncDef[3])
+ break
+
+ Index = 0
+ while Index < len(ParamListOfDef):
+ if DiffModifier(ParamListOfDef[Index].Modifier, ParamListOfDecl[Index].Modifier) and not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3, FuncName):
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3, 'Parameter %s has different modifier with prototype in function [%s].' % (ParamListOfDef[Index].Name, FuncName), 'Function', FuncDef[3])
+ Index += 1
+ break
+
+def CheckFuncLayoutBody(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ FileTable = 'Identifier' + str(FileID)
+ Db = GetDB()
+ SqlStatement = """ select BodyStartColumn, EndColumn, ID, Name
+ from Function
+ where BelongsToFile = %d
+ """ % (FileID)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ if len(ResultSet) == 0:
+ return ErrorMsgList
+ for Result in ResultSet:
+ if Result[0] != 0:
+ if not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY, Result[3]):
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY,
+ 'The open brace should be at the very beginning of a line for the function [%s].' % Result[3],
+ 'Function', Result[2])
+ if Result[1] != 0:
+ if not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY, Result[3]):
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY,
+ 'The close brace should be at the very beginning of a line for the function [%s].' % Result[3],
+ 'Function', Result[2])
+
+def CheckFuncLayoutLocalVariable(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select ID
+ from Function
+ where BelongsToFile = %d
+ """ % (FileID)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ if len(ResultSet) == 0:
+ return ErrorMsgList
+ FL = []
+ for Result in ResultSet:
+ FL.append(Result)
+
+ for F in FL:
+ SqlStatement = """ select Name, Value, ID, Modifier
+ from %s
+ where Model = %d and BelongsToFunction = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_VARIABLE, F[0])
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ if len(ResultSet) == 0:
+ continue
+
+ for Result in ResultSet:
+ if len(Result[1]) > 0 and 'CONST' not in Result[3]:
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE, 'Variable Name: %s' % Result[0], FileTable, Result[2])
+
+def CheckMemberVariableFormat(Name, Value, FileTable, TdId, ModelId):
+ ErrMsgList = []
+ # Member variable format pattern.
+ Pattern = re.compile(r'^[A-Z]+\S*[a-z]\S*$')
+
+ LBPos = Value.find('{')
+ RBPos = Value.rfind('}')
+ if LBPos == -1 or RBPos == -1:
+ return ErrMsgList
+
+ Fields = Value[LBPos + 1 : RBPos]
+ Fields = StripComments(Fields).strip()
+ NestPos = Fields.find ('struct')
+ if NestPos != -1 and (NestPos + len('struct') < len(Fields)) and ModelId != DataClass.MODEL_IDENTIFIER_UNION:
+ if not Fields[NestPos + len('struct') + 1].isalnum():
+ if not EccGlobalData.gException.IsException(ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE, Name):
+ PrintErrorMsg(ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE, 'Nested struct in [%s].' % (Name), FileTable, TdId)
+ return ErrMsgList
+ NestPos = Fields.find ('union')
+ if NestPos != -1 and (NestPos + len('union') < len(Fields)):
+ if not Fields[NestPos + len('union') + 1].isalnum():
+ if not EccGlobalData.gException.IsException(ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE, Name):
+ PrintErrorMsg(ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE, 'Nested union in [%s].' % (Name), FileTable, TdId)
+ return ErrMsgList
+ NestPos = Fields.find ('enum')
+ if NestPos != -1 and (NestPos + len('enum') < len(Fields)):
+ if not Fields[NestPos + len('enum') + 1].isalnum():
+ if not EccGlobalData.gException.IsException(ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE, Name):
+ PrintErrorMsg(ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE, 'Nested enum in [%s].' % (Name), FileTable, TdId)
+ return ErrMsgList
+
+ if ModelId == DataClass.MODEL_IDENTIFIER_ENUMERATE:
+ FieldsList = Fields.split(',')
+ # deal with enum is pre-assigned a value by function call ( , , , ...)
+ QuoteCount = 0
+ Index = 0
+ RemoveCurrentElement = False
+ while Index < len(FieldsList):
+ Field = FieldsList[Index]
+
+ if Field.find('(') != -1:
+ QuoteCount += 1
+ RemoveCurrentElement = True
+ Index += 1
+ continue
+
+ if Field.find(')') != -1 and QuoteCount > 0:
+ QuoteCount -= 1
+
+ if RemoveCurrentElement:
+ FieldsList.remove(Field)
+ if QuoteCount == 0:
+ RemoveCurrentElement = False
+ continue
+
+ if QuoteCount == 0:
+ RemoveCurrentElement = False
+
+ Index += 1
+ else:
+ FieldsList = Fields.split(';')
+
+ for Field in FieldsList:
+ Field = Field.strip()
+ if Field == '':
+ continue
+ # For the condition that the field in struct is an array with [] suffixes...
+ if Field[-1] == ']':
+ LBPos = Field.find('[')
+ Field = Field[0:LBPos]
+ # For the condition that bit field ": Number"
+ if Field.find(':') != -1:
+ ColonPos = Field.find(':')
+ Field = Field[0:ColonPos]
+
+ Field = Field.strip()
+ if Field == '':
+ continue
+ if Field.startswith("#"):
+ continue
+ # Enum could directly assign value to variable
+ Field = Field.split('=')[0].strip()
+ TokenList = Field.split()
+ # Remove pointers before variable
+ Token = TokenList[-1]
+ if Token in ['OPTIONAL']:
+ Token = TokenList[-2]
+ if not Pattern.match(Token.lstrip('*')):
+ ErrMsgList.append(Token.lstrip('*'))
+
+ return ErrMsgList
+
+def CheckDeclTypedefFormat(FullFileName, ModelId):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Name, StartLine, EndLine, ID, Value
+ from %s
+ where Model = %d
+ """ % (FileTable, ModelId)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ ResultList = []
+ for Result in ResultSet:
+ ResultList.append(Result)
+
+ ErrorType = ERROR_DECLARATION_DATA_TYPE_CHECK_ALL
+ if ModelId == DataClass.MODEL_IDENTIFIER_STRUCTURE:
+ ErrorType = ERROR_DECLARATION_DATA_TYPE_CHECK_STRUCTURE_DECLARATION
+ elif ModelId == DataClass.MODEL_IDENTIFIER_ENUMERATE:
+ ErrorType = ERROR_DECLARATION_DATA_TYPE_CHECK_ENUMERATED_TYPE
+ elif ModelId == DataClass.MODEL_IDENTIFIER_UNION:
+ ErrorType = ERROR_DECLARATION_DATA_TYPE_CHECK_UNION_TYPE
+
+ SqlStatement = """ select Modifier, Name, Value, StartLine, EndLine, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_TYPEDEF)
+ TdSet = Db.TblFile.Exec(SqlStatement)
+ TdList = []
+ for Td in TdSet:
+ TdList.append(Td)
+ # Check member variable name format that from typedefs of ONLY this file.
+ for Td in TdList:
+ Name = Td[1].strip()
+ Value = Td[2].strip()
+ if Value.startswith('enum'):
+ ValueModelId = DataClass.MODEL_IDENTIFIER_ENUMERATE
+ elif Value.startswith('struct'):
+ ValueModelId = DataClass.MODEL_IDENTIFIER_STRUCTURE
+ elif Value.startswith('union'):
+ ValueModelId = DataClass.MODEL_IDENTIFIER_UNION
+ else:
+ continue
+
+ if ValueModelId != ModelId:
+ continue
+ # Check member variable format.
+ ErrMsgList = CheckMemberVariableFormat(Name, Value, FileTable, Td[5], ModelId)
+ for ErrMsg in ErrMsgList:
+ if EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Name + '.' + ErrMsg):
+ continue
+ PrintErrorMsg(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, 'Member variable [%s] NOT follow naming convention.' % (Name + '.' + ErrMsg), FileTable, Td[5])
+
+ # First check in current file to see whether struct/union/enum is typedef-ed.
+ UntypedefedList = []
+ for Result in ResultList:
+ # Check member variable format.
+ Name = Result[0].strip()
+ Value = Result[4].strip()
+ if Value.startswith('enum'):
+ ValueModelId = DataClass.MODEL_IDENTIFIER_ENUMERATE
+ elif Value.startswith('struct'):
+ ValueModelId = DataClass.MODEL_IDENTIFIER_STRUCTURE
+ elif Value.startswith('union'):
+ ValueModelId = DataClass.MODEL_IDENTIFIER_UNION
+ else:
+ continue
+
+ if ValueModelId != ModelId:
+ continue
+ ErrMsgList = CheckMemberVariableFormat(Name, Value, FileTable, Result[3], ModelId)
+ for ErrMsg in ErrMsgList:
+ if EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Result[0] + '.' + ErrMsg):
+ continue
+ PrintErrorMsg(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, 'Member variable [%s] NOT follow naming convention.' % (Result[0] + '.' + ErrMsg), FileTable, Result[3])
+ # Check whether it is typedefed.
+ Found = False
+ for Td in TdList:
+ # skip function pointer
+ if len(Td[0]) > 0:
+ continue
+ if Result[1] >= Td[3] and Td[4] >= Result[2]:
+ Found = True
+ if not Td[1].isupper():
+ PrintErrorMsg(ErrorType, 'Typedef should be UPPER case', FileTable, Td[5])
+ if Result[0] in Td[2].split():
+ Found = True
+ if not Td[1].isupper():
+ PrintErrorMsg(ErrorType, 'Typedef should be UPPER case', FileTable, Td[5])
+ if Found:
+ break
+
+ if not Found:
+ UntypedefedList.append(Result)
+ continue
+
+ if len(UntypedefedList) == 0:
+ return
+
+ IncludeFileList = GetAllIncludeFiles(FullFileName)
+ TdList = []
+ for F in IncludeFileList:
+ FileID = GetTableID(F, ErrorMsgList)
+ if FileID < 0:
+ continue
+
+ IncludeFileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Modifier, Name, Value, StartLine, EndLine, ID
+ from %s
+ where Model = %d
+ """ % (IncludeFileTable, DataClass.MODEL_IDENTIFIER_TYPEDEF)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ TdList.extend(ResultSet)
+
+ for Result in UntypedefedList:
+
+ # Check whether it is typedefed.
+ Found = False
+ for Td in TdList:
+
+ if len(Td[0]) > 0:
+ continue
+ if Result[1] >= Td[3] and Td[4] >= Result[2]:
+ Found = True
+ if not Td[1].isupper():
+ PrintErrorMsg(ErrorType, 'Typedef should be UPPER case', FileTable, Td[5])
+ if Result[0] in Td[2].split():
+ Found = True
+ if not Td[1].isupper():
+ PrintErrorMsg(ErrorType, 'Typedef should be UPPER case', FileTable, Td[5])
+ if Found:
+ break
+
+ if not Found:
+ PrintErrorMsg(ErrorType, 'No Typedef for %s' % Result[0], FileTable, Result[3])
+ continue
+
+def CheckDeclStructTypedef(FullFileName):
+ CheckDeclTypedefFormat(FullFileName, DataClass.MODEL_IDENTIFIER_STRUCTURE)
+
+def CheckDeclEnumTypedef(FullFileName):
+ CheckDeclTypedefFormat(FullFileName, DataClass.MODEL_IDENTIFIER_ENUMERATE)
+
+def CheckDeclUnionTypedef(FullFileName):
+ CheckDeclTypedefFormat(FullFileName, DataClass.MODEL_IDENTIFIER_UNION)
+
+def CheckDeclArgModifier(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Modifier, Name, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_VARIABLE)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ ModifierTuple = ('IN', 'OUT', 'OPTIONAL', 'UNALIGNED')
+ MAX_MODIFIER_LENGTH = 100
+ for Result in ResultSet:
+ for Modifier in ModifierTuple:
+ if PatternInModifier(Result[0], Modifier) and len(Result[0]) < MAX_MODIFIER_LENGTH:
+ PrintErrorMsg(ERROR_DECLARATION_DATA_TYPE_CHECK_IN_OUT_MODIFIER, 'Variable Modifier %s' % Result[0], FileTable, Result[2])
+ break
+
+ SqlStatement = """ select Modifier, Name, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ for Modifier in ModifierTuple:
+ if PatternInModifier(Result[0], Modifier):
+ PrintErrorMsg(ERROR_DECLARATION_DATA_TYPE_CHECK_IN_OUT_MODIFIER, 'Return Type Modifier %s' % Result[0], FileTable, Result[2])
+ break
+
+ SqlStatement = """ select Modifier, Header, ID
+ from Function
+ where BelongsToFile = %d
+ """ % (FileID)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ for Modifier in ModifierTuple:
+ if PatternInModifier(Result[0], Modifier):
+ PrintErrorMsg(ERROR_DECLARATION_DATA_TYPE_CHECK_IN_OUT_MODIFIER, 'Return Type Modifier %s' % Result[0], FileTable, Result[2])
+ break
+
+def CheckDeclNoUseCType(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Modifier, Name, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_VARIABLE)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ CTypeTuple = ('int', 'unsigned', 'char', 'void', 'long')
+ for Result in ResultSet:
+ for Type in CTypeTuple:
+ if PatternInModifier(Result[0], Type):
+ if EccGlobalData.gException.IsException(ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE,
+ Result[0] + ' ' + Result[1]):
+ continue
+ PrintErrorMsg(ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE,
+ 'Invalid variable type (%s) in definition [%s]' % (Type, Result[0] + ' ' + Result[1]),
+ FileTable,
+ Result[2])
+ break
+
+ SqlStatement = """ select Modifier, Name, ID, Value
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ ParamList = GetParamList(Result[1])
+ FuncName = Result[3]
+ if EccGlobalData.gException.IsException(ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE, FuncName):
+ continue
+ for Type in CTypeTuple:
+ if PatternInModifier(Result[0], Type):
+ PrintErrorMsg(ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE, '%s Return type %s' % (FuncName, Result[0]), FileTable, Result[2])
+
+ for Param in ParamList:
+ if PatternInModifier(Param.Modifier, Type):
+ PrintErrorMsg(ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE, 'Parameter %s' % Param.Name, FileTable, Result[2])
+
+ SqlStatement = """ select Modifier, Header, ID, Name
+ from Function
+ where BelongsToFile = %d
+ """ % (FileID)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ ParamList = GetParamList(Result[1])
+ FuncName = Result[3]
+ if EccGlobalData.gException.IsException(ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE, FuncName):
+ continue
+ for Type in CTypeTuple:
+ if PatternInModifier(Result[0], Type):
+ PrintErrorMsg(ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE, '[%s] Return type %s' % (FuncName, Result[0]), FileTable, Result[2])
+
+ for Param in ParamList:
+ if PatternInModifier(Param.Modifier, Type):
+ PrintErrorMsg(ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE, 'Parameter %s' % Param.Name, FileTable, Result[2])
+
+
+def CheckPointerNullComparison(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ # cache the found function return type to accelerate later checking in this file.
+ FuncReturnTypeDict = {}
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Value, StartLine, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_PREDICATE_EXPRESSION)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ if len(ResultSet) == 0:
+ return
+ PSL = []
+ for Result in ResultSet:
+ PSL.append([Result[0], Result[1], Result[2]])
+
+ SqlStatement = """ select BodyStartLine, EndLine, Header, Modifier, ID
+ from Function
+ where BelongsToFile = %d
+ """ % (FileID)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ FL = []
+ for Result in ResultSet:
+ FL.append([Result[0], Result[1], Result[2], Result[3], Result[4]])
+
+ p = GetFuncDeclPattern()
+ for Str in PSL:
+ FuncRecord = GetFuncContainsPE(Str[1], FL)
+ if FuncRecord is None:
+ continue
+
+ for Exp in GetPredicateListFromPredicateExpStr(Str[0]):
+ PredInfo = SplitPredicateStr(Exp)
+ if PredInfo[1] is None:
+ PredVarStr = PredInfo[0][0].strip()
+ IsFuncCall = False
+ SearchInCache = False
+ # PredVarStr may contain '.' or '->'
+ TmpStr = PredVarStr.replace('.', '').replace('->', '')
+ if p.match(TmpStr):
+ PredVarStr = PredVarStr[0:PredVarStr.find('(')]
+ SearchInCache = True
+ # Only direct function call using IsFuncCall branch. Multi-level ref. function call is considered a variable.
+ if TmpStr.startswith(PredVarStr):
+ IsFuncCall = True
+
+ if PredVarStr.strip() in IgnoredKeywordList:
+ continue
+ StarList = []
+ PredVarList = GetCNameList(PredVarStr, StarList)
+ # No variable found, maybe value first? like (0 == VarName)
+ if len(PredVarList) == 0:
+ continue
+ if SearchInCache:
+ Type = FuncReturnTypeDict.get(PredVarStr)
+ if Type is not None:
+ if Type.find('*') != -1 and Type != 'BOOLEAN*':
+ PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
+ continue
+
+ if PredVarStr in FuncReturnTypeDict:
+ continue
+
+ Type = GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall, None, StarList)
+ if SearchInCache:
+ FuncReturnTypeDict[PredVarStr] = Type
+ if Type is None:
+ continue
+ Type = GetTypeFromArray(Type, PredVarStr)
+ if Type.find('*') != -1 and Type != 'BOOLEAN*':
+ PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
+
+def CheckNonBooleanValueComparison(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ # cache the found function return type to accelerate later checking in this file.
+ FuncReturnTypeDict = {}
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Value, StartLine, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_PREDICATE_EXPRESSION)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ if len(ResultSet) == 0:
+ return
+ PSL = []
+ for Result in ResultSet:
+ PSL.append([Result[0], Result[1], Result[2]])
+
+ SqlStatement = """ select BodyStartLine, EndLine, Header, Modifier, ID
+ from Function
+ where BelongsToFile = %d
+ """ % (FileID)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ FL = []
+ for Result in ResultSet:
+ FL.append([Result[0], Result[1], Result[2], Result[3], Result[4]])
+
+ p = GetFuncDeclPattern()
+ for Str in PSL:
+ FuncRecord = GetFuncContainsPE(Str[1], FL)
+ if FuncRecord is None:
+ continue
+
+ for Exp in GetPredicateListFromPredicateExpStr(Str[0]):
+ PredInfo = SplitPredicateStr(Exp)
+ if PredInfo[1] is None:
+ PredVarStr = PredInfo[0][0].strip()
+ IsFuncCall = False
+ SearchInCache = False
+ # PredVarStr may contain '.' or '->'
+ TmpStr = PredVarStr.replace('.', '').replace('->', '')
+ if p.match(TmpStr):
+ PredVarStr = PredVarStr[0:PredVarStr.find('(')]
+ SearchInCache = True
+ # Only direct function call using IsFuncCall branch. Multi-level ref. function call is considered a variable.
+ if TmpStr.startswith(PredVarStr):
+ IsFuncCall = True
+
+ if PredVarStr.strip() in IgnoredKeywordList:
+ continue
+ StarList = []
+ PredVarList = GetCNameList(PredVarStr, StarList)
+ # No variable found, maybe value first? like (0 == VarName)
+ if len(PredVarList) == 0:
+ continue
+
+ if SearchInCache:
+ Type = FuncReturnTypeDict.get(PredVarStr)
+ if Type is not None:
+ if Type.find('BOOLEAN') == -1:
+ PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
+ continue
+
+ if PredVarStr in FuncReturnTypeDict:
+ continue
+ Type = GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall, 'BOOLEAN', StarList)
+ if SearchInCache:
+ FuncReturnTypeDict[PredVarStr] = Type
+ if Type is None:
+ continue
+ if Type.find('BOOLEAN') == -1:
+ PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
+
+
+def CheckBooleanValueComparison(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ # cache the found function return type to accelerate later checking in this file.
+ FuncReturnTypeDict = {}
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Value, StartLine, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_PREDICATE_EXPRESSION)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ if len(ResultSet) == 0:
+ return
+ PSL = []
+ for Result in ResultSet:
+ PSL.append([Result[0], Result[1], Result[2]])
+
+ SqlStatement = """ select BodyStartLine, EndLine, Header, Modifier, ID
+ from Function
+ where BelongsToFile = %d
+ """ % (FileID)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ FL = []
+ for Result in ResultSet:
+ FL.append([Result[0], Result[1], Result[2], Result[3], Result[4]])
+
+ p = GetFuncDeclPattern()
+ for Str in PSL:
+ FuncRecord = GetFuncContainsPE(Str[1], FL)
+ if FuncRecord is None:
+ continue
+
+ for Exp in GetPredicateListFromPredicateExpStr(Str[0]):
+ PredInfo = SplitPredicateStr(Exp)
+ if PredInfo[1] in ('==', '!=') and PredInfo[0][1] in ('TRUE', 'FALSE'):
+ PredVarStr = PredInfo[0][0].strip()
+ IsFuncCall = False
+ SearchInCache = False
+ # PredVarStr may contain '.' or '->'
+ TmpStr = PredVarStr.replace('.', '').replace('->', '')
+ if p.match(TmpStr):
+ PredVarStr = PredVarStr[0:PredVarStr.find('(')]
+ SearchInCache = True
+ # Only direct function call using IsFuncCall branch. Multi-level ref. function call is considered a variable.
+ if TmpStr.startswith(PredVarStr):
+ IsFuncCall = True
+
+ if PredVarStr.strip() in IgnoredKeywordList:
+ continue
+ StarList = []
+ PredVarList = GetCNameList(PredVarStr, StarList)
+ # No variable found, maybe value first? like (0 == VarName)
+ if len(PredVarList) == 0:
+ continue
+
+ if SearchInCache:
+ Type = FuncReturnTypeDict.get(PredVarStr)
+ if Type is not None:
+ if Type.find('BOOLEAN') != -1:
+ PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
+ continue
+
+ if PredVarStr in FuncReturnTypeDict:
+ continue
+
+ Type = GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall, 'BOOLEAN', StarList)
+ if SearchInCache:
+ FuncReturnTypeDict[PredVarStr] = Type
+ if Type is None:
+ continue
+ if Type.find('BOOLEAN') != -1:
+ PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
+
+
+def CheckHeaderFileData(FullFileName, AllTypedefFun=[]):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select ID, Modifier
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_VARIABLE)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ if not Result[1].startswith('extern'):
+ for Item in AllTypedefFun:
+ if '(%s)' % Result[1] in Item:
+ break
+ else:
+ PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Variable definition appears in header file', FileTable, Result[0])
+
+ SqlStatement = """ select ID
+ from Function
+ where BelongsToFile = %d
+ """ % FileID
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Function definition appears in header file', 'Function', Result[0])
+
+ return ErrorMsgList
+
+def CheckHeaderFileIfndef(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Value, StartLine
+ from %s
+ where Model = %d order by StartLine
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_MACRO_IFNDEF)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ if len(ResultSet) == 0:
+ PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_1, '', 'File', FileID)
+ return ErrorMsgList
+ for Result in ResultSet:
+ SqlStatement = """ select Value, EndLine
+ from %s
+ where EndLine < %d
+ """ % (FileTable, Result[1])
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ if not Result[0].startswith('/*') and not Result[0].startswith('//'):
+ PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_2, '', 'File', FileID)
+ break
+
+ SqlStatement = """ select Value
+ from %s
+ where StartLine > (select max(EndLine) from %s where Model = %d)
+ """ % (FileTable, FileTable, DataClass.MODEL_IDENTIFIER_MACRO_ENDIF)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ if not Result[0].startswith('/*') and not Result[0].startswith('//'):
+ PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_3, '', 'File', FileID)
+ return ErrorMsgList
+
+def CheckDoxygenCommand(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Value, ID
+ from %s
+ where Model = %d or Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_COMMENT, DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ DoxygenCommandList = ['bug', 'todo', 'example', 'file', 'attention', 'param', 'post', 'pre', 'retval',
+ 'return', 'sa', 'since', 'test', 'note', 'par', 'endcode', 'code']
+ for Result in ResultSet:
+ CommentStr = Result[0]
+ CommentPartList = CommentStr.split()
+ for Part in CommentPartList:
+ if Part.upper() == 'BUGBUG':
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_COMMAND, 'Bug should be marked with doxygen tag @bug', FileTable, Result[1])
+ if Part.upper() == 'TODO':
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_COMMAND, 'ToDo should be marked with doxygen tag @todo', FileTable, Result[1])
+ if Part.startswith('@'):
+ if EccGlobalData.gException.IsException(ERROR_DOXYGEN_CHECK_COMMAND, Part):
+ continue
+ if not Part.replace('@', '').strip():
+ continue
+ if Part.lstrip('@') in ['{', '}']:
+ continue
+ if Part.lstrip('@').isalpha():
+ if Part.lstrip('@') not in DoxygenCommandList:
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_COMMAND, 'Unknown doxygen command %s' % Part, FileTable, Result[1])
+ else:
+ Index = Part.find('[')
+ if Index == -1:
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_COMMAND, 'Unknown doxygen command %s' % Part, FileTable, Result[1])
+ RealCmd = Part[1:Index]
+ if RealCmd not in DoxygenCommandList:
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_COMMAND, 'Unknown doxygen command %s' % Part, FileTable, Result[1])
+
+
+def CheckDoxygenTripleForwardSlash(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ Db = GetDB()
+
+ SqlStatement = """ select ID, BodyStartLine, BodyStartColumn, EndLine, EndColumn
+ from Function
+ where BelongsToFile = %d
+ """ % (FileID)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ if len(ResultSet) == 0:
+ return
+
+ FuncDefSet = []
+ for Result in ResultSet:
+ FuncDefSet.append(Result)
+
+
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Value, ID, StartLine, StartColumn, EndLine, EndColumn
+ from %s
+ where Model = %d
+
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_COMMENT)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ CommentSet = []
+ try:
+ for Result in ResultSet:
+ CommentSet.append(Result)
+ except:
+ print('Unrecognized chars in comment of file %s', FullFileName)
+
+
+ for Result in CommentSet:
+ CommentStr = Result[0]
+ StartLine = Result[2]
+ StartColumn = Result[3]
+ EndLine = Result[4]
+ EndColumn = Result[5]
+ if not CommentStr.startswith('///<'):
+ continue
+
+ Found = False
+ for FuncDef in FuncDefSet:
+ if StartLine == FuncDef[1] and StartColumn > FuncDef[2] and EndLine == FuncDef[3] and EndColumn < FuncDef[4]:
+ Found = True
+ break
+ if StartLine > FuncDef[1] and EndLine < FuncDef[3]:
+ Found = True
+ break
+ if StartLine == FuncDef[1] and StartColumn > FuncDef[2] and EndLine < FuncDef[3]:
+ Found = True
+ break
+ if StartLine > FuncDef[1] and EndLine == FuncDef[3] and EndColumn < FuncDef[4]:
+ Found = True
+ break
+ if Found:
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_COMMENT_FORMAT, '', FileTable, Result[1])
+
+
+def CheckFileHeaderDoxygenComments(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Value, ID
+ from %s
+ where Model = %d and (StartLine = 1 or StartLine = 7 or StartLine = 8) and StartColumn = 0
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_COMMENT)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ if len(ResultSet) == 0:
+ PrintErrorMsg(ERROR_HEADER_CHECK_FILE, 'No File License header appear at the very beginning of file.', 'File', FileID)
+ return ErrorMsgList
+
+ NoHeaderCommentStartFlag = True
+ NoHeaderCommentEndFlag = True
+ NoHeaderCommentPeriodFlag = True
+ NoCopyrightFlag = True
+ NoLicenseFlag = True
+ NoRevReferFlag = True
+ NextLineIndex = 0
+ for Result in ResultSet:
+ FileStartFlag = False
+ CommentStrList = []
+ CommentStr = Result[0].strip()
+ CommentStrListTemp = CommentStr.split('\n')
+ if (len(CommentStrListTemp) <= 1):
+ # For Mac
+ CommentStrListTemp = CommentStr.split('\r')
+ # Skip the content before the file header
+ for CommentLine in CommentStrListTemp:
+ if CommentLine.strip().startswith('/** @file'):
+ FileStartFlag = True
+ if FileStartFlag == True:
+ CommentStrList.append(CommentLine)
+
+ ID = Result[1]
+ Index = 0
+ if CommentStrList and CommentStrList[0].strip().startswith('/** @file'):
+ NoHeaderCommentStartFlag = False
+ else:
+ continue
+ if CommentStrList and CommentStrList[-1].strip().endswith('**/'):
+ NoHeaderCommentEndFlag = False
+ else:
+ continue
+
+ for CommentLine in CommentStrList:
+ Index = Index + 1
+ NextLineIndex = Index
+ if CommentLine.startswith('/** @file'):
+ continue
+ if CommentLine.startswith('**/'):
+ break
+ # Check whether C File header Comment content start with two spaces.
+ if EccGlobalData.gConfig.HeaderCheckCFileCommentStartSpacesNum == '1' or EccGlobalData.gConfig.HeaderCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ if CommentLine.startswith('/** @file') == False and CommentLine.startswith('**/') == False and CommentLine.strip() and CommentLine.startswith(' ') == False:
+ PrintErrorMsg(ERROR_HEADER_CHECK_FILE, 'File header comment content should start with two spaces at each line', FileTable, ID)
+
+ CommentLine = CommentLine.strip()
+ if CommentLine.startswith('Copyright') or ('Copyright' in CommentLine and CommentLine.lower().startswith('(c)')):
+ NoCopyrightFlag = False
+ if CommentLine.find('All rights reserved') == -1:
+ for Copyright in EccGlobalData.gConfig.Copyright:
+ if CommentLine.find(Copyright) > -1:
+ PrintErrorMsg(ERROR_HEADER_CHECK_FILE, '""All rights reserved"" announcement should be following the ""Copyright"" at the same line', FileTable, ID)
+ break
+ if CommentLine.endswith('<BR>') == -1:
+ PrintErrorMsg(ERROR_HEADER_CHECK_FILE, 'The ""<BR>"" at the end of the Copyright line is required', FileTable, ID)
+ if NextLineIndex < len(CommentStrList) and CommentStrList[NextLineIndex].strip().startswith('Copyright') == False and CommentStrList[NextLineIndex].strip():
+ NoLicenseFlag = False
+ if CommentLine.startswith('@par Revision Reference:'):
+ NoRevReferFlag = False
+ RefListFlag = False
+ for RefLine in CommentStrList[NextLineIndex:]:
+ if RefLine.strip() and (NextLineIndex + 1) < len(CommentStrList) and CommentStrList[NextLineIndex+1].strip() and CommentStrList[NextLineIndex+1].strip().startswith('**/') == False:
+ RefListFlag = True
+ if RefLine.strip() == False or RefLine.strip().startswith('**/'):
+ RefListFlag = False
+ break
+ # Check whether C File header Comment's each reference at list should begin with a bullet character.
+ if EccGlobalData.gConfig.HeaderCheckCFileCommentReferenceFormat == '1' or EccGlobalData.gConfig.HeaderCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ if RefListFlag == True:
+ if RefLine.strip() and RefLine.strip().startswith('**/') == False and RefLine.startswith(' -') == False:
+ PrintErrorMsg(ERROR_HEADER_CHECK_FILE, 'Each reference on a separate line should begin with a bullet character ""-"" ', FileTable, ID)
+
+ if NoHeaderCommentStartFlag:
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_FILE_HEADER, 'File header comment should begin with ""/** @file""', FileTable, ID)
+ return
+ if NoHeaderCommentEndFlag:
+ PrintErrorMsg(ERROR_HEADER_CHECK_FILE, 'File header comment should end with ""**/""', FileTable, ID)
+ return
+ if NoCopyrightFlag:
+ PrintErrorMsg(ERROR_HEADER_CHECK_FILE, 'File header comment missing the ""Copyright""', FileTable, ID)
+ #Check whether C File header Comment have the License immediately after the ""Copyright"" line.
+ if EccGlobalData.gConfig.HeaderCheckCFileCommentLicenseFormat == '1' or EccGlobalData.gConfig.HeaderCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ if NoLicenseFlag:
+ PrintErrorMsg(ERROR_HEADER_CHECK_FILE, 'File header comment should have the License immediately after the ""Copyright"" line', FileTable, ID)
+
+def CheckFuncHeaderDoxygenComments(FullFileName):
+ ErrorMsgList = []
+
+ FileID = GetTableID(FullFileName, ErrorMsgList)
+ if FileID < 0:
+ return ErrorMsgList
+
+ Db = GetDB()
+ FileTable = 'Identifier' + str(FileID)
+ SqlStatement = """ select Value, StartLine, EndLine, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_COMMENT)
+
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ CommentSet = []
+ try:
+ for Result in ResultSet:
+ CommentSet.append(Result)
+ except:
+ print('Unrecognized chars in comment of file %s', FullFileName)
+
+ # Func Decl check
+ SqlStatement = """ select Modifier, Name, StartLine, ID, Value
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ FuncName = Result[4]
+ FunctionHeaderComment = CheckCommentImmediatelyPrecedeFunctionHeader(Result[1], Result[2], CommentSet)
+ if FunctionHeaderComment:
+ CheckFunctionHeaderConsistentWithDoxygenComment(Result[0], Result[1], Result[2], FunctionHeaderComment[0], FunctionHeaderComment[1], ErrorMsgList, FunctionHeaderComment[3], FileTable)
+ else:
+ if EccGlobalData.gException.IsException(ERROR_HEADER_CHECK_FUNCTION, FuncName):
+ continue
+ ErrorMsgList.append('Line %d :Function %s has NO comment immediately preceding it.' % (Result[2], Result[1]))
+ PrintErrorMsg(ERROR_HEADER_CHECK_FUNCTION, 'Function [%s] has NO comment immediately preceding it.' % (FuncName), FileTable, Result[3])
+
+ # Func Def check
+ SqlStatement = """ select Value, StartLine, EndLine, ID
+ from %s
+ where Model = %d
+ """ % (FileTable, DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER)
+
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ CommentSet = []
+ try:
+ for Result in ResultSet:
+ CommentSet.append(Result)
+ except:
+ print('Unrecognized chars in comment of file %s', FullFileName)
+
+ SqlStatement = """ select Modifier, Header, StartLine, ID, Name
+ from Function
+ where BelongsToFile = %d
+ """ % (FileID)
+ ResultSet = Db.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ FuncName = Result[4]
+ FunctionHeaderComment = CheckCommentImmediatelyPrecedeFunctionHeader(Result[1], Result[2], CommentSet)
+ if FunctionHeaderComment:
+ CheckFunctionHeaderConsistentWithDoxygenComment(Result[0], Result[1], Result[2], FunctionHeaderComment[0], FunctionHeaderComment[1], ErrorMsgList, FunctionHeaderComment[3], FileTable)
+ else:
+ if EccGlobalData.gException.IsException(ERROR_HEADER_CHECK_FUNCTION, FuncName):
+ continue
+ ErrorMsgList.append('Line %d :Function [%s] has NO comment immediately preceding it.' % (Result[2], Result[1]))
+ PrintErrorMsg(ERROR_HEADER_CHECK_FUNCTION, 'Function [%s] has NO comment immediately preceding it.' % (FuncName), 'Function', Result[3])
+ return ErrorMsgList
+
+def CheckCommentImmediatelyPrecedeFunctionHeader(FuncName, FuncStartLine, CommentSet):
+
+ for Comment in CommentSet:
+ if Comment[2] == FuncStartLine - 1:
+ return Comment
+ return None
+
+def GetDoxygenStrFromComment(Str):
+ DoxygenStrList = []
+ ParamTagList = Str.split('@param')
+ if len(ParamTagList) > 1:
+ i = 1
+ while i < len(ParamTagList):
+ DoxygenStrList.append('@param' + ParamTagList[i])
+ i += 1
+
+ Str = ParamTagList[0]
+
+ RetvalTagList = ParamTagList[-1].split('@retval')
+ if len(RetvalTagList) > 1:
+ if len(ParamTagList) > 1:
+ DoxygenStrList[-1] = '@param' + RetvalTagList[0]
+ i = 1
+ while i < len(RetvalTagList):
+ DoxygenStrList.append('@retval' + RetvalTagList[i])
+ i += 1
+
+ ReturnTagList = RetvalTagList[-1].split('@return')
+ if len(ReturnTagList) > 1:
+ if len(RetvalTagList) > 1:
+ DoxygenStrList[-1] = '@retval' + ReturnTagList[0]
+ elif len(ParamTagList) > 1:
+ DoxygenStrList[-1] = '@param' + ReturnTagList[0]
+ i = 1
+ while i < len(ReturnTagList):
+ DoxygenStrList.append('@return' + ReturnTagList[i])
+ i += 1
+
+ if len(DoxygenStrList) > 0:
+ DoxygenStrList[-1] = DoxygenStrList[-1].rstrip('--*/')
+
+ return DoxygenStrList
+
+def CheckGeneralDoxygenCommentLayout(Str, StartLine, ErrorMsgList, CommentId= -1, TableName=''):
+ #/** --*/ @retval after @param
+ if not Str.startswith('/**'):
+ ErrorMsgList.append('Line %d : Comment does NOT have prefix /** ' % StartLine)
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'Comment does NOT have prefix /** ', TableName, CommentId)
+ if not Str.endswith('**/'):
+ ErrorMsgList.append('Line %d : Comment does NOT have tail **/ ' % StartLine)
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'Comment does NOT have tail **/ ', TableName, CommentId)
+ FirstRetvalIndex = Str.find('@retval')
+ LastParamIndex = Str.rfind('@param')
+ if (FirstRetvalIndex > 0) and (LastParamIndex > 0) and (FirstRetvalIndex < LastParamIndex):
+ ErrorMsgList.append('Line %d : @retval appear before @param ' % StartLine)
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, @retval appear before @param ', TableName, CommentId)
+
+def CheckFunctionHeaderConsistentWithDoxygenComment(FuncModifier, FuncHeader, FuncStartLine, CommentStr, CommentStartLine, ErrorMsgList, CommentId= -1, TableName=''):
+
+ ParamList = GetParamList(FuncHeader)
+ CheckGeneralDoxygenCommentLayout(CommentStr, CommentStartLine, ErrorMsgList, CommentId, TableName)
+ DescriptionStr = CommentStr
+ DoxygenStrList = GetDoxygenStrFromComment(DescriptionStr)
+ if DescriptionStr.find('.') == -1:
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_COMMENT_DESCRIPTION, 'Comment description should end with period \'.\'', TableName, CommentId)
+ DoxygenTagNumber = len(DoxygenStrList)
+ ParamNumber = len(ParamList)
+ for Param in ParamList:
+ if Param.Name.upper() == 'VOID' and ParamNumber == 1:
+ ParamNumber -= 1
+ Index = 0
+ if ParamNumber > 0 and DoxygenTagNumber > 0:
+ while Index < ParamNumber and Index < DoxygenTagNumber:
+ ParamModifier = ParamList[Index].Modifier
+ ParamName = ParamList[Index].Name.strip()
+ Tag = DoxygenStrList[Index].strip(' ')
+ if (not Tag[-1] == ('\n')) and (not Tag[-1] == ('\r')):
+ ErrorMsgList.append('Line %d : in Comment, <%s> does NOT end with new line ' % (CommentStartLine, Tag.replace('\n', '').replace('\r', '')))
+ PrintErrorMsg(ERROR_HEADER_CHECK_FUNCTION, 'in Comment, <%s> does NOT end with new line ' % (Tag.replace('\n', '').replace('\r', '')), TableName, CommentId)
+ TagPartList = Tag.split()
+ if len(TagPartList) < 2:
+ ErrorMsgList.append('Line %d : in Comment, <%s> does NOT contain doxygen contents ' % (CommentStartLine, Tag.replace('\n', '').replace('\r', '')))
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, <%s> does NOT contain doxygen contents ' % (Tag.replace('\n', '').replace('\r', '')), TableName, CommentId)
+ Index += 1
+ continue
+ LBPos = Tag.find('[')
+ RBPos = Tag.find(']')
+ ParamToLBContent = Tag[len('@param'):LBPos].strip()
+ if LBPos > 0 and len(ParamToLBContent) == 0 and RBPos > LBPos:
+ InOutStr = ''
+ ModifierPartList = ParamModifier.split()
+ for Part in ModifierPartList:
+ if Part.strip() == 'IN':
+ InOutStr += 'in'
+ if Part.strip() == 'OUT':
+ if InOutStr != '':
+ InOutStr += ', out'
+ else:
+ InOutStr = 'out'
+
+ if InOutStr != '':
+ if Tag.find('[' + InOutStr + ']') == -1:
+ if InOutStr != 'in, out':
+ ErrorMsgList.append('Line %d : in Comment, <%s> does NOT have %s ' % (CommentStartLine, (TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), '[' + InOutStr + ']'))
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, <%s> does NOT have %s ' % ((TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), '[' + InOutStr + ']'), TableName, CommentId)
+ else:
+ if Tag.find('[in,out]') == -1:
+ ErrorMsgList.append('Line %d : in Comment, <%s> does NOT have %s ' % (CommentStartLine, (TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), '[' + InOutStr + ']'))
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, <%s> does NOT have %s ' % ((TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), '[' + InOutStr + ']'), TableName, CommentId)
+
+
+ if Tag.find(ParamName) == -1 and ParamName != 'VOID' and ParamName != 'void':
+ ErrorMsgList.append('Line %d : in Comment, <%s> does NOT consistent with parameter name %s ' % (CommentStartLine, (TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), ParamName))
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, <%s> does NOT consistent with parameter name %s ' % ((TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), ParamName), TableName, CommentId)
+ Index += 1
+
+ if Index < ParamNumber:
+ ErrorMsgList.append('Line %d : Number of doxygen tags in comment less than number of function parameters' % CommentStartLine)
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'Number of doxygen tags in comment less than number of function parameters ', TableName, CommentId)
+ # VOID return type, NOT VOID*. VOID* should be matched with a doxygen tag.
+ if (FuncModifier.find('VOID') != -1 or FuncModifier.find('void') != -1) and FuncModifier.find('*') == -1:
+
+ # assume we allow a return description tag for void func. return. that's why 'DoxygenTagNumber - 1' is used instead of 'DoxygenTagNumber'
+ if Index < DoxygenTagNumber - 1 or (Index < DoxygenTagNumber and DoxygenStrList[Index].startswith('@retval')):
+ ErrorMsgList.append('Line %d : VOID return type need NO doxygen tags in comment' % CommentStartLine)
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'VOID return type need no doxygen tags in comment ', TableName, CommentId)
+ else:
+ if Index < DoxygenTagNumber and not DoxygenStrList[Index].startswith('@retval') and not DoxygenStrList[Index].startswith('@return'):
+ ErrorMsgList.append('Line %d : Number of @param doxygen tags in comment does NOT match number of function parameters' % CommentStartLine)
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'Number of @param doxygen tags in comment does NOT match number of function parameters ', TableName, CommentId)
+ else:
+ if ParamNumber == 0 and DoxygenTagNumber != 0 and ((FuncModifier.find('VOID') != -1 or FuncModifier.find('void') != -1) and FuncModifier.find('*') == -1):
+ ErrorMsgList.append('Line %d : VOID return type need NO doxygen tags in comment' % CommentStartLine)
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'VOID return type need NO doxygen tags in comment ', TableName, CommentId)
+ if ParamNumber != 0 and DoxygenTagNumber == 0:
+ ErrorMsgList.append('Line %d : No doxygen tags in comment' % CommentStartLine)
+ PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'No doxygen tags in comment ', TableName, CommentId)
+
+if __name__ == '__main__':
+
+# EdkLogger.Initialize()
+# EdkLogger.SetLevel(EdkLogger.QUIET)
+# CollectSourceCodeDataIntoDB(sys.argv[1])
+ try:
+ test_file = sys.argv[1]
+ except IndexError as v:
+ print("Usage: %s filename" % sys.argv[0])
+ sys.exit(1)
+ MsgList = CheckFuncHeaderDoxygenComments(test_file)
+ for Msg in MsgList:
+ print(Msg)
+ print('Done!')
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/config.ini b/roms/edk2/BaseTools/Source/Python/Ecc/config.ini
new file mode 100644
index 000000000..5529d0f2d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/config.ini
@@ -0,0 +1,281 @@
+## @file
+# This file is used to set configuration of ECC tool
+# For the items listed below, 1 means valid, 0 means invalid
+#
+# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+#
+# Identify the version of current configuration
+#
+Version = 0.1
+
+#
+# Identify to if check all items
+# 1 - Check all items and ignore all other detailed items
+# 0 - Not check all items, the tool will go through all other detailed items to decide to check or not
+#
+CheckAll = 0
+
+#
+# Identify to if automatically correct mistakes
+# 1 - Automatically correct
+# 0 - Not automatically correct
+# Only the following check points can be automatically corrected, others not listed below are not supported even it is 1
+#
+# GeneralCheckTab
+# GeneralCheckIndentation
+# GeneralCheckLine
+# GeneralCheckCarriageReturn
+# SpaceCheckAll
+#
+AutoCorrect = 1
+
+#
+# List customized Modifer here, split with ','
+#
+ModifierList = IN, OUT, OPTIONAL, UNALIGNED, EFI_RUNTIMESERVICE, EFI_BOOTSERVICE, EFIAPI, TPMINTERNALAPI, STATIC
+
+#
+# General Checking
+#
+GeneralCheckAll = 0
+
+# Check whether NO Tab is used, replaced with spaces
+GeneralCheckNoTab = 1
+# The width of Tab
+GeneralCheckTabWidth = 2
+# Check whether the indentation is followed coding style
+GeneralCheckIndentation = 1
+# The width of indentation
+GeneralCheckIndentationWidth = 2
+# Check whether no line is exceeding defined widty
+GeneralCheckLine = 1
+# The width of a line
+GeneralCheckLineWidth = 120
+# Check whether no use of _asm in the source file
+GeneralCheckNo_Asm = 1
+# Check whether no use of "#progma" in source file except "#pragma pack(#)".
+GeneralCheckNoProgma = 1
+# Check whether there is a carriage return at the end of the file
+GeneralCheckCarriageReturn = 1
+# Check whether the file exists
+GeneralCheckFileExistence = 1
+# Check whether file has non ACSII char
+GeneralCheckNonAcsii = 1
+# Check whether UNI file is valid
+GeneralCheckUni = 1
+# Check Only use CRLF (Carriage Return Line Feed) line endings.
+GeneralCheckLineEnding = 1
+# Check if there is no trailing white space in one line.
+GeneralCheckTrailingWhiteSpaceLine = 1
+
+#
+# Space Checking
+#
+SpaceCheckAll = 1
+
+#
+# Predicate Expression Checking
+#
+PredicateExpressionCheckAll = 0
+
+# Check whether Boolean values, variable type BOOLEAN not use explicit comparisons to TRUE or FALSE
+PredicateExpressionCheckBooleanValue = 1
+# Check whether Non-Boolean comparisons use a compare operator (==, !=, >, < >=, <=).
+PredicateExpressionCheckNonBooleanOperator = 1
+# Check whether a comparison of any pointer to zero must be done via the NULL type
+PredicateExpressionCheckComparisonNullType = 1
+
+#
+# Headers Checking
+#
+HeaderCheckAll = 0
+
+# Check whether File header exists
+HeaderCheckFile = 1
+# Check whether Function header exists
+HeaderCheckFunction = 1
+# Check whether Meta data File header Comment End with '##'
+HeaderCheckFileCommentEnd = 0
+# Check whether C File header Comment content start with two spaces
+HeaderCheckCFileCommentStartSpacesNum = 0
+# Check whether C File header Comment's each reference at list should begin with a bullet character '-'
+HeaderCheckCFileCommentReferenceFormat = 0
+# Check whether C File header Comment have the License immediately after the ""Copyright"" line
+HeaderCheckCFileCommentLicenseFormat = 0
+
+#
+# C Function Layout Checking
+#
+CFunctionLayoutCheckAll = 0
+
+# Check whether return type exists and in the first line
+CFunctionLayoutCheckReturnType = 1
+# Check whether any optional functional modifiers exist and next to the return type
+CFunctionLayoutCheckOptionalFunctionalModifier = 1
+# Check whether the next line contains the function name, left justified, followed by the beginning of the parameter list
+# Check whether the closing parenthesis is on its own line and also indented two spaces
+CFunctionLayoutCheckFunctionName = 1
+# Check whether the function prototypes in include files have the same form as function definitions
+CFunctionLayoutCheckFunctionPrototype = 1
+# Check whether the body of a function is contained by open and close braces that must be in the first column
+CFunctionLayoutCheckFunctionBody = 1
+# Check whether the data declarations is the first code in a module.
+CFunctionLayoutCheckDataDeclaration = 1
+# Check whether no initialization of a variable as part of its declaration
+CFunctionLayoutCheckNoInitOfVariable = 1
+# Check whether no use of STATIC for functions
+CFunctionLayoutCheckNoStatic = 1
+
+#
+# Include Files Checking
+#
+IncludeFileCheckAll = 0
+
+#Check whether having include files with same name
+IncludeFileCheckSameName = 1
+# Check whether all include file contents is guarded by a #ifndef statement.
+# the #ifndef must be the first line of code following the file header comment
+# the #endif must appear on the last line in the file
+IncludeFileCheckIfndefStatement = 1
+# Check whether include files contain only public or only private data
+# Check whether include files NOT contain code or define data variables
+IncludeFileCheckData = 1
+
+#
+# Declarations and Data Types Checking
+#
+DeclarationDataTypeCheckAll = 0
+
+# Check whether no use of int, unsigned, char, void, static, long in any .c, .h or .asl files.
+DeclarationDataTypeCheckNoUseCType = 1
+# Check whether the modifiers IN, OUT, OPTIONAL, and UNALIGNED are used only to qualify arguments to a function and should not appear in a data type declaration
+DeclarationDataTypeCheckInOutModifier = 1
+# Check whether the EFIAPI modifier should be used at the entry of drivers, events, and member functions of protocols
+DeclarationDataTypeCheckEFIAPIModifier = 1
+# Check whether Enumerated Type has a 'typedef' and the name is capital
+DeclarationDataTypeCheckEnumeratedType = 1
+# Check whether Structure Type has a 'typedef' and the name is capital
+DeclarationDataTypeCheckStructureDeclaration = 1
+# Check whether having same Structure
+DeclarationDataTypeCheckSameStructure = 1
+# Check whether Union Type has a 'typedef' and the name is capital
+DeclarationDataTypeCheckUnionType = 1
+
+
+#
+# Naming Conventions Checking
+#
+NamingConventionCheckAll = 0
+
+# Check whether only capital letters are used for #define declarations
+NamingConventionCheckDefineStatement = 1
+# Check whether only capital letters are used for typedef declarations
+NamingConventionCheckTypedefStatement = 1
+# Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'.
+NamingConventionCheckIfndefStatement = 1
+# Rule for path name, variable name and function name
+# 1. First character should be upper case
+# 2. Existing lower case in a word
+# 3. No space existence
+# 4. Global variable name must start by a 'g'
+# Check whether the path name followed the rule
+NamingConventionCheckPathName = 1
+# Check whether the variable name followed the rule
+NamingConventionCheckVariableName = 1
+# Check whether the function name followed the rule
+NamingConventionCheckFunctionName = 1
+# Check whether NO use short variable name with single character
+NamingConventionCheckSingleCharacterVariable = 1
+
+#
+# Doxygen Checking
+#
+DoxygenCheckAll = 0
+
+# Check whether the file headers are followed Doxygen special documentation blocks in section 2.3.5
+DoxygenCheckFileHeader = 1
+# Check whether the function headers are followed Doxygen special documentation blocks in section 2.3.5
+DoxygenCheckFunctionHeader = 1
+# Check whether the first line of text in a comment block is a brief description of the element being documented.
+# The brief description must end with a period.
+DoxygenCheckCommentDescription = 1
+# Check whether comment lines with '///< ... text ...' format, if it is used, it should be after the code section.
+DoxygenCheckCommentFormat = 1
+# Check whether only Doxygen commands allowed to mark the code are @bug and @todo.
+DoxygenCheckCommand = 1
+
+#
+# Meta-Data File Processing Checking
+#
+MetaDataFileCheckAll = 0
+
+# Check whether each file defined in meta-data exists
+MetaDataFileCheckPathName = 1
+# Generate a list for all files defined in meta-data files
+MetaDataFileCheckGenerateFileList = 1
+# The path of log file
+MetaDataFileCheckPathOfGenerateFileList = File.log
+# Check whether all Library Instances defined for a given module (or dependent library instance) match the module's type.
+# Each Library Instance must specify the Supported Module Types in its INF file,
+# and any module specifying the library instance must be one of the supported types.
+MetaDataFileCheckLibraryInstance = 1
+# Check whether a Library Instance has been defined for all dependent library classes
+MetaDataFileCheckLibraryInstanceDependent = 1
+# Check whether the Library Instances specified by the LibraryClasses sections are listed in order of dependencies
+MetaDataFileCheckLibraryInstanceOrder = 1
+# Check whether the unnecessary inclusion of library classes in the INF file
+MetaDataFileCheckLibraryNoUse = 1
+# Check the header file in Include\Library directory whether be defined in the package DEC file.
+MetaDataFileCheckLibraryDefinedInDec = 1
+# Check whether an INF file is specified in the FDF file, but not in the DSC file, then the INF file must be for a Binary module only
+MetaDataFileCheckBinaryInfInFdf = 1
+# Not to report error and warning related OS include file such as "windows.h" and "stdio.h".
+# Check whether a PCD is set in a DSC file or the FDF file, but not in both.
+MetaDataFileCheckPcdDuplicate = 1
+# Check whether PCD settings in the FDF file can only be related to flash.
+MetaDataFileCheckPcdFlash = 1
+# Check whether PCDs used in INF files but not specified in DSC or FDF files
+MetaDataFileCheckPcdNoUse = 0
+# Check whether having duplicate guids defined for Guid/Protocol/Ppi
+MetaDataFileCheckGuidDuplicate = 1
+# Check whether all files under module directory are described in INF files
+MetaDataFileCheckModuleFileNoUse = 1
+# Check whether the PCD is correctly used in C function via its type
+MetaDataFileCheckPcdType = 1
+# Check whether there are FILE_GUID duplication among different INF files
+MetaDataFileCheckModuleFileGuidDuplication = 1
+
+#
+# Uni File Processing Checking
+#
+UniCheckAll = 0
+# Check INF or DEC file whether defined the localized information in the associated UNI file.
+UniCheckHelpInfo = 1
+# Check PCD whether defined the prompt, help in the DEC file and localized information in the associated UNI file.
+UniCheckPCDInfo = 1
+# Uncheck whether UNI file is in UTF-16 format
+GeneralCheckUni = -1
+
+#
+# SMM Communicate Function Parameter Checking
+#
+SmmCommParaCheckAll = 0
+# Check if the EFI_SMM_COMMUNICATION_PROTOCOL parameter buffer type is Reserved / ACPI NVS or UEFI RT code/data
+SmmCommParaCheckBufferType = 1
+
+#
+# The check points in this section are reserved
+#
+# GotoStatementCheckAll = 0
+# SpellingCheckAll = 0
+#
+
+# A list for binary file ext name
+BinaryExtList = EXE, EFI, FV, ROM, DLL, COM, BMP, GIF, PYD, CMP, BIN, JPG, UNI, RAW, COM2, LIB, DEPEX, SYS, DB
+# A list for only scanning dirs, the dirs should be the top folder(s) under workspace
+ScanOnlyDirList = ScanFolder1 ScanFolder2
+# A list for Used to circumvent special strings
+TokenReleaceList = L'', L'\"', L"\"", L''', L""", L"\"\"", L"\"^", L" \"", L"\" \""
diff --git a/roms/edk2/BaseTools/Source/Python/Ecc/exception.xml b/roms/edk2/BaseTools/Source/Python/Ecc/exception.xml
new file mode 100644
index 000000000..8133904fb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Ecc/exception.xml
@@ -0,0 +1,315 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ExceptionList xmlns="http://www.uefi.org/2008/2.1" xmlns:xsi="http:/www.w3.org/2001/XMLSchema-instance">
+ <Copyright>Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.</Copyright>
+ <License>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+ </License>
+ <Exception>
+ <KeyWord>__debugbreak</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>__readmsr</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>__writemsr</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedCompareExchange</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedCompareExchange64</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedDecrement</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedIncrement</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_break</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_inp</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_inpw</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_inpd</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_outp</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_outpw</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_outpd</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_ReadWriteBarrier</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>InternalX86DisablePaging32</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>InternalX86EnablePaging32</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>InternalLongJump</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>SetJump</KeyWord>
+ <ErrorID>4002</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>__debugbreak</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>__readmsr</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>__writemsr</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedCompareExchange</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedCompareExchange64</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedDecrement</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedIncrement</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_inp</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_inpw</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_inpd</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_outp</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_outpw</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_outpd</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_ReadWriteBarrier</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>IoRead8</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>IoWrite8</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>IoRead16</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>IoWrite16</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>IoRead32</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>IoWrite32</KeyWord>
+ <ErrorID>5001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>__debugbreak</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>__readmsr</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>__writemsr</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedCompareExchange</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedCompareExchange64</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedDecrement</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedIncrement</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_inp</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_inpw</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_inpd</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_outp</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_outpw</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_outpd</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_ReadWriteBarrier</KeyWord>
+ <ErrorID>5003</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>__debugbreak</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>__readmsr</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>__writemsr</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedCompareExchange</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedCompareExchange64</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedDecrement</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_InterlockedIncrement</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_inp</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_inpw</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_inpd</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_outp</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_outpw</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_outpd</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_ReadWriteBarrier</KeyWord>
+ <ErrorID>7001</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>@</KeyWord>
+ <ErrorID>9005</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>@R1</KeyWord>
+ <ErrorID>9005</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>@R2</KeyWord>
+ <ErrorID>9005</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>@Rx</KeyWord>
+ <ErrorID>9005</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>@R2.</KeyWord>
+ <ErrorID>9005</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>_DriverUnloadHandler</KeyWord>
+ <ErrorID>8006</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>ASSERT</KeyWord>
+ <ErrorID>10015</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>REPORT_STATUS_CODE</KeyWord>
+ <ErrorID>10015</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>REPORT_STATUS_CODE_WITH_EXTENDED_DATA</KeyWord>
+ <ErrorID>10015</ErrorID>
+ </Exception>
+ <Exception>
+ <KeyWord>REPORT_STATUS_CODE_WITH_DEVICE_PATH</KeyWord>
+ <ErrorID>10015</ErrorID>
+ </Exception>
+</ExceptionList> \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/CParser3/CLexer.py b/roms/edk2/BaseTools/Source/Python/Eot/CParser3/CLexer.py
new file mode 100644
index 000000000..ca03adea7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/CParser3/CLexer.py
@@ -0,0 +1,4941 @@
+# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53
+
+from antlr3 import *
+from antlr3.compat import set, frozenset
+
+## @file
+# The file defines the Lexer for C source files.
+#
+# THIS FILE IS AUTO-GENERATED. PLEASE DO NOT MODIFY THIS FILE.
+# This file is generated by running:
+# java org.antlr.Tool C.g
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+
+
+# for convenience in actions
+HIDDEN = BaseRecognizer.HIDDEN
+
+# token types
+T114=114
+T115=115
+T116=116
+T117=117
+FloatTypeSuffix=16
+LETTER=11
+T29=29
+T28=28
+T27=27
+T26=26
+T25=25
+EOF=-1
+STRING_LITERAL=9
+FLOATING_POINT_LITERAL=10
+T38=38
+T37=37
+T39=39
+T34=34
+COMMENT=22
+T33=33
+T36=36
+T35=35
+T30=30
+T32=32
+T31=31
+LINE_COMMENT=23
+IntegerTypeSuffix=14
+CHARACTER_LITERAL=8
+T49=49
+T48=48
+T100=100
+T43=43
+T42=42
+T102=102
+T41=41
+T101=101
+T40=40
+T47=47
+T46=46
+T45=45
+T44=44
+T109=109
+T107=107
+T108=108
+T105=105
+WS=19
+T106=106
+T103=103
+T104=104
+T50=50
+LINE_COMMAND=24
+T59=59
+T113=113
+T52=52
+T112=112
+T51=51
+T111=111
+T54=54
+T110=110
+EscapeSequence=12
+DECIMAL_LITERAL=7
+T53=53
+T56=56
+T55=55
+T58=58
+T57=57
+T75=75
+T76=76
+T73=73
+T74=74
+T79=79
+T77=77
+T78=78
+Exponent=15
+HexDigit=13
+T72=72
+T71=71
+T70=70
+T62=62
+T63=63
+T64=64
+T65=65
+T66=66
+T67=67
+T68=68
+T69=69
+IDENTIFIER=4
+UnicodeVocabulary=21
+HEX_LITERAL=5
+T61=61
+T60=60
+T99=99
+T97=97
+BS=20
+T98=98
+T95=95
+T96=96
+OCTAL_LITERAL=6
+T94=94
+Tokens=118
+T93=93
+T92=92
+T91=91
+T90=90
+T88=88
+T89=89
+T84=84
+T85=85
+T86=86
+T87=87
+UnicodeEscape=18
+T81=81
+T80=80
+T83=83
+OctalEscape=17
+T82=82
+
+class CLexer(Lexer):
+
+ grammarFileName = "C.g"
+
+ def __init__(self, input=None):
+ Lexer.__init__(self, input)
+ self.dfa25 = self.DFA25(
+ self, 25,
+ eot = self.DFA25_eot,
+ eof = self.DFA25_eof,
+ min = self.DFA25_min,
+ max = self.DFA25_max,
+ accept = self.DFA25_accept,
+ special = self.DFA25_special,
+ transition = self.DFA25_transition
+ )
+ self.dfa35 = self.DFA35(
+ self, 35,
+ eot = self.DFA35_eot,
+ eof = self.DFA35_eof,
+ min = self.DFA35_min,
+ max = self.DFA35_max,
+ accept = self.DFA35_accept,
+ special = self.DFA35_special,
+ transition = self.DFA35_transition
+ )
+
+
+
+
+
+
+ # $ANTLR start T25
+ def mT25(self, ):
+
+ try:
+ self.type = T25
+
+ # C.g:27:5: ( ';' )
+ # C.g:27:7: ';'
+ self.match(u';')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T25
+
+
+
+ # $ANTLR start T26
+ def mT26(self, ):
+
+ try:
+ self.type = T26
+
+ # C.g:28:5: ( 'typedef' )
+ # C.g:28:7: 'typedef'
+ self.match("typedef")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T26
+
+
+
+ # $ANTLR start T27
+ def mT27(self, ):
+
+ try:
+ self.type = T27
+
+ # C.g:29:5: ( ',' )
+ # C.g:29:7: ','
+ self.match(u',')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T27
+
+
+
+ # $ANTLR start T28
+ def mT28(self, ):
+
+ try:
+ self.type = T28
+
+ # C.g:30:5: ( '=' )
+ # C.g:30:7: '='
+ self.match(u'=')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T28
+
+
+
+ # $ANTLR start T29
+ def mT29(self, ):
+
+ try:
+ self.type = T29
+
+ # C.g:31:5: ( 'extern' )
+ # C.g:31:7: 'extern'
+ self.match("extern")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T29
+
+
+
+ # $ANTLR start T30
+ def mT30(self, ):
+
+ try:
+ self.type = T30
+
+ # C.g:32:5: ( 'static' )
+ # C.g:32:7: 'static'
+ self.match("static")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T30
+
+
+
+ # $ANTLR start T31
+ def mT31(self, ):
+
+ try:
+ self.type = T31
+
+ # C.g:33:5: ( 'auto' )
+ # C.g:33:7: 'auto'
+ self.match("auto")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T31
+
+
+
+ # $ANTLR start T32
+ def mT32(self, ):
+
+ try:
+ self.type = T32
+
+ # C.g:34:5: ( 'register' )
+ # C.g:34:7: 'register'
+ self.match("register")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T32
+
+
+
+ # $ANTLR start T33
+ def mT33(self, ):
+
+ try:
+ self.type = T33
+
+ # C.g:35:5: ( 'STATIC' )
+ # C.g:35:7: 'STATIC'
+ self.match("STATIC")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T33
+
+
+
+ # $ANTLR start T34
+ def mT34(self, ):
+
+ try:
+ self.type = T34
+
+ # C.g:36:5: ( 'void' )
+ # C.g:36:7: 'void'
+ self.match("void")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T34
+
+
+
+ # $ANTLR start T35
+ def mT35(self, ):
+
+ try:
+ self.type = T35
+
+ # C.g:37:5: ( 'char' )
+ # C.g:37:7: 'char'
+ self.match("char")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T35
+
+
+
+ # $ANTLR start T36
+ def mT36(self, ):
+
+ try:
+ self.type = T36
+
+ # C.g:38:5: ( 'short' )
+ # C.g:38:7: 'short'
+ self.match("short")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T36
+
+
+
+ # $ANTLR start T37
+ def mT37(self, ):
+
+ try:
+ self.type = T37
+
+ # C.g:39:5: ( 'int' )
+ # C.g:39:7: 'int'
+ self.match("int")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T37
+
+
+
+ # $ANTLR start T38
+ def mT38(self, ):
+
+ try:
+ self.type = T38
+
+ # C.g:40:5: ( 'long' )
+ # C.g:40:7: 'long'
+ self.match("long")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T38
+
+
+
+ # $ANTLR start T39
+ def mT39(self, ):
+
+ try:
+ self.type = T39
+
+ # C.g:41:5: ( 'float' )
+ # C.g:41:7: 'float'
+ self.match("float")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T39
+
+
+
+ # $ANTLR start T40
+ def mT40(self, ):
+
+ try:
+ self.type = T40
+
+ # C.g:42:5: ( 'double' )
+ # C.g:42:7: 'double'
+ self.match("double")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T40
+
+
+
+ # $ANTLR start T41
+ def mT41(self, ):
+
+ try:
+ self.type = T41
+
+ # C.g:43:5: ( 'signed' )
+ # C.g:43:7: 'signed'
+ self.match("signed")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T41
+
+
+
+ # $ANTLR start T42
+ def mT42(self, ):
+
+ try:
+ self.type = T42
+
+ # C.g:44:5: ( 'unsigned' )
+ # C.g:44:7: 'unsigned'
+ self.match("unsigned")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T42
+
+
+
+ # $ANTLR start T43
+ def mT43(self, ):
+
+ try:
+ self.type = T43
+
+ # C.g:45:5: ( '{' )
+ # C.g:45:7: '{'
+ self.match(u'{')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T43
+
+
+
+ # $ANTLR start T44
+ def mT44(self, ):
+
+ try:
+ self.type = T44
+
+ # C.g:46:5: ( '}' )
+ # C.g:46:7: '}'
+ self.match(u'}')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T44
+
+
+
+ # $ANTLR start T45
+ def mT45(self, ):
+
+ try:
+ self.type = T45
+
+ # C.g:47:5: ( 'struct' )
+ # C.g:47:7: 'struct'
+ self.match("struct")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T45
+
+
+
+ # $ANTLR start T46
+ def mT46(self, ):
+
+ try:
+ self.type = T46
+
+ # C.g:48:5: ( 'union' )
+ # C.g:48:7: 'union'
+ self.match("union")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T46
+
+
+
+ # $ANTLR start T47
+ def mT47(self, ):
+
+ try:
+ self.type = T47
+
+ # C.g:49:5: ( ':' )
+ # C.g:49:7: ':'
+ self.match(u':')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T47
+
+
+
+ # $ANTLR start T48
+ def mT48(self, ):
+
+ try:
+ self.type = T48
+
+ # C.g:50:5: ( 'enum' )
+ # C.g:50:7: 'enum'
+ self.match("enum")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T48
+
+
+
+ # $ANTLR start T49
+ def mT49(self, ):
+
+ try:
+ self.type = T49
+
+ # C.g:51:5: ( 'const' )
+ # C.g:51:7: 'const'
+ self.match("const")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T49
+
+
+
+ # $ANTLR start T50
+ def mT50(self, ):
+
+ try:
+ self.type = T50
+
+ # C.g:52:5: ( 'volatile' )
+ # C.g:52:7: 'volatile'
+ self.match("volatile")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T50
+
+
+
+ # $ANTLR start T51
+ def mT51(self, ):
+
+ try:
+ self.type = T51
+
+ # C.g:53:5: ( 'IN' )
+ # C.g:53:7: 'IN'
+ self.match("IN")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T51
+
+
+
+ # $ANTLR start T52
+ def mT52(self, ):
+
+ try:
+ self.type = T52
+
+ # C.g:54:5: ( 'OUT' )
+ # C.g:54:7: 'OUT'
+ self.match("OUT")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T52
+
+
+
+ # $ANTLR start T53
+ def mT53(self, ):
+
+ try:
+ self.type = T53
+
+ # C.g:55:5: ( 'OPTIONAL' )
+ # C.g:55:7: 'OPTIONAL'
+ self.match("OPTIONAL")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T53
+
+
+
+ # $ANTLR start T54
+ def mT54(self, ):
+
+ try:
+ self.type = T54
+
+ # C.g:56:5: ( 'CONST' )
+ # C.g:56:7: 'CONST'
+ self.match("CONST")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T54
+
+
+
+ # $ANTLR start T55
+ def mT55(self, ):
+
+ try:
+ self.type = T55
+
+ # C.g:57:5: ( 'UNALIGNED' )
+ # C.g:57:7: 'UNALIGNED'
+ self.match("UNALIGNED")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T55
+
+
+
+ # $ANTLR start T56
+ def mT56(self, ):
+
+ try:
+ self.type = T56
+
+ # C.g:58:5: ( 'VOLATILE' )
+ # C.g:58:7: 'VOLATILE'
+ self.match("VOLATILE")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T56
+
+
+
+ # $ANTLR start T57
+ def mT57(self, ):
+
+ try:
+ self.type = T57
+
+ # C.g:59:5: ( 'GLOBAL_REMOVE_IF_UNREFERENCED' )
+ # C.g:59:7: 'GLOBAL_REMOVE_IF_UNREFERENCED'
+ self.match("GLOBAL_REMOVE_IF_UNREFERENCED")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T57
+
+
+
+ # $ANTLR start T58
+ def mT58(self, ):
+
+ try:
+ self.type = T58
+
+ # C.g:60:5: ( 'EFIAPI' )
+ # C.g:60:7: 'EFIAPI'
+ self.match("EFIAPI")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T58
+
+
+
+ # $ANTLR start T59
+ def mT59(self, ):
+
+ try:
+ self.type = T59
+
+ # C.g:61:5: ( 'EFI_BOOTSERVICE' )
+ # C.g:61:7: 'EFI_BOOTSERVICE'
+ self.match("EFI_BOOTSERVICE")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T59
+
+
+
+ # $ANTLR start T60
+ def mT60(self, ):
+
+ try:
+ self.type = T60
+
+ # C.g:62:5: ( 'EFI_RUNTIMESERVICE' )
+ # C.g:62:7: 'EFI_RUNTIMESERVICE'
+ self.match("EFI_RUNTIMESERVICE")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T60
+
+
+
+ # $ANTLR start T61
+ def mT61(self, ):
+
+ try:
+ self.type = T61
+
+ # C.g:63:5: ( 'PACKED' )
+ # C.g:63:7: 'PACKED'
+ self.match("PACKED")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T61
+
+
+
+ # $ANTLR start T62
+ def mT62(self, ):
+
+ try:
+ self.type = T62
+
+ # C.g:64:5: ( '(' )
+ # C.g:64:7: '('
+ self.match(u'(')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T62
+
+
+
+ # $ANTLR start T63
+ def mT63(self, ):
+
+ try:
+ self.type = T63
+
+ # C.g:65:5: ( ')' )
+ # C.g:65:7: ')'
+ self.match(u')')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T63
+
+
+
+ # $ANTLR start T64
+ def mT64(self, ):
+
+ try:
+ self.type = T64
+
+ # C.g:66:5: ( '[' )
+ # C.g:66:7: '['
+ self.match(u'[')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T64
+
+
+
+ # $ANTLR start T65
+ def mT65(self, ):
+
+ try:
+ self.type = T65
+
+ # C.g:67:5: ( ']' )
+ # C.g:67:7: ']'
+ self.match(u']')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T65
+
+
+
+ # $ANTLR start T66
+ def mT66(self, ):
+
+ try:
+ self.type = T66
+
+ # C.g:68:5: ( '*' )
+ # C.g:68:7: '*'
+ self.match(u'*')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T66
+
+
+
+ # $ANTLR start T67
+ def mT67(self, ):
+
+ try:
+ self.type = T67
+
+ # C.g:69:5: ( '...' )
+ # C.g:69:7: '...'
+ self.match("...")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T67
+
+
+
+ # $ANTLR start T68
+ def mT68(self, ):
+
+ try:
+ self.type = T68
+
+ # C.g:70:5: ( '+' )
+ # C.g:70:7: '+'
+ self.match(u'+')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T68
+
+
+
+ # $ANTLR start T69
+ def mT69(self, ):
+
+ try:
+ self.type = T69
+
+ # C.g:71:5: ( '-' )
+ # C.g:71:7: '-'
+ self.match(u'-')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T69
+
+
+
+ # $ANTLR start T70
+ def mT70(self, ):
+
+ try:
+ self.type = T70
+
+ # C.g:72:5: ( '/' )
+ # C.g:72:7: '/'
+ self.match(u'/')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T70
+
+
+
+ # $ANTLR start T71
+ def mT71(self, ):
+
+ try:
+ self.type = T71
+
+ # C.g:73:5: ( '%' )
+ # C.g:73:7: '%'
+ self.match(u'%')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T71
+
+
+
+ # $ANTLR start T72
+ def mT72(self, ):
+
+ try:
+ self.type = T72
+
+ # C.g:74:5: ( '++' )
+ # C.g:74:7: '++'
+ self.match("++")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T72
+
+
+
+ # $ANTLR start T73
+ def mT73(self, ):
+
+ try:
+ self.type = T73
+
+ # C.g:75:5: ( '--' )
+ # C.g:75:7: '--'
+ self.match("--")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T73
+
+
+
+ # $ANTLR start T74
+ def mT74(self, ):
+
+ try:
+ self.type = T74
+
+ # C.g:76:5: ( 'sizeof' )
+ # C.g:76:7: 'sizeof'
+ self.match("sizeof")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T74
+
+
+
+ # $ANTLR start T75
+ def mT75(self, ):
+
+ try:
+ self.type = T75
+
+ # C.g:77:5: ( '.' )
+ # C.g:77:7: '.'
+ self.match(u'.')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T75
+
+
+
+ # $ANTLR start T76
+ def mT76(self, ):
+
+ try:
+ self.type = T76
+
+ # C.g:78:5: ( '->' )
+ # C.g:78:7: '->'
+ self.match("->")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T76
+
+
+
+ # $ANTLR start T77
+ def mT77(self, ):
+
+ try:
+ self.type = T77
+
+ # C.g:79:5: ( '&' )
+ # C.g:79:7: '&'
+ self.match(u'&')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T77
+
+
+
+ # $ANTLR start T78
+ def mT78(self, ):
+
+ try:
+ self.type = T78
+
+ # C.g:80:5: ( '~' )
+ # C.g:80:7: '~'
+ self.match(u'~')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T78
+
+
+
+ # $ANTLR start T79
+ def mT79(self, ):
+
+ try:
+ self.type = T79
+
+ # C.g:81:5: ( '!' )
+ # C.g:81:7: '!'
+ self.match(u'!')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T79
+
+
+
+ # $ANTLR start T80
+ def mT80(self, ):
+
+ try:
+ self.type = T80
+
+ # C.g:82:5: ( '*=' )
+ # C.g:82:7: '*='
+ self.match("*=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T80
+
+
+
+ # $ANTLR start T81
+ def mT81(self, ):
+
+ try:
+ self.type = T81
+
+ # C.g:83:5: ( '/=' )
+ # C.g:83:7: '/='
+ self.match("/=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T81
+
+
+
+ # $ANTLR start T82
+ def mT82(self, ):
+
+ try:
+ self.type = T82
+
+ # C.g:84:5: ( '%=' )
+ # C.g:84:7: '%='
+ self.match("%=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T82
+
+
+
+ # $ANTLR start T83
+ def mT83(self, ):
+
+ try:
+ self.type = T83
+
+ # C.g:85:5: ( '+=' )
+ # C.g:85:7: '+='
+ self.match("+=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T83
+
+
+
+ # $ANTLR start T84
+ def mT84(self, ):
+
+ try:
+ self.type = T84
+
+ # C.g:86:5: ( '-=' )
+ # C.g:86:7: '-='
+ self.match("-=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T84
+
+
+
+ # $ANTLR start T85
+ def mT85(self, ):
+
+ try:
+ self.type = T85
+
+ # C.g:87:5: ( '<<=' )
+ # C.g:87:7: '<<='
+ self.match("<<=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T85
+
+
+
+ # $ANTLR start T86
+ def mT86(self, ):
+
+ try:
+ self.type = T86
+
+ # C.g:88:5: ( '>>=' )
+ # C.g:88:7: '>>='
+ self.match(">>=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T86
+
+
+
+ # $ANTLR start T87
+ def mT87(self, ):
+
+ try:
+ self.type = T87
+
+ # C.g:89:5: ( '&=' )
+ # C.g:89:7: '&='
+ self.match("&=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T87
+
+
+
+ # $ANTLR start T88
+ def mT88(self, ):
+
+ try:
+ self.type = T88
+
+ # C.g:90:5: ( '^=' )
+ # C.g:90:7: '^='
+ self.match("^=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T88
+
+
+
+ # $ANTLR start T89
+ def mT89(self, ):
+
+ try:
+ self.type = T89
+
+ # C.g:91:5: ( '|=' )
+ # C.g:91:7: '|='
+ self.match("|=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T89
+
+
+
+ # $ANTLR start T90
+ def mT90(self, ):
+
+ try:
+ self.type = T90
+
+ # C.g:92:5: ( '?' )
+ # C.g:92:7: '?'
+ self.match(u'?')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T90
+
+
+
+ # $ANTLR start T91
+ def mT91(self, ):
+
+ try:
+ self.type = T91
+
+ # C.g:93:5: ( '||' )
+ # C.g:93:7: '||'
+ self.match("||")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T91
+
+
+
+ # $ANTLR start T92
+ def mT92(self, ):
+
+ try:
+ self.type = T92
+
+ # C.g:94:5: ( '&&' )
+ # C.g:94:7: '&&'
+ self.match("&&")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T92
+
+
+
+ # $ANTLR start T93
+ def mT93(self, ):
+
+ try:
+ self.type = T93
+
+ # C.g:95:5: ( '|' )
+ # C.g:95:7: '|'
+ self.match(u'|')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T93
+
+
+
+ # $ANTLR start T94
+ def mT94(self, ):
+
+ try:
+ self.type = T94
+
+ # C.g:96:5: ( '^' )
+ # C.g:96:7: '^'
+ self.match(u'^')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T94
+
+
+
+ # $ANTLR start T95
+ def mT95(self, ):
+
+ try:
+ self.type = T95
+
+ # C.g:97:5: ( '==' )
+ # C.g:97:7: '=='
+ self.match("==")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T95
+
+
+
+ # $ANTLR start T96
+ def mT96(self, ):
+
+ try:
+ self.type = T96
+
+ # C.g:98:5: ( '!=' )
+ # C.g:98:7: '!='
+ self.match("!=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T96
+
+
+
+ # $ANTLR start T97
+ def mT97(self, ):
+
+ try:
+ self.type = T97
+
+ # C.g:99:5: ( '<' )
+ # C.g:99:7: '<'
+ self.match(u'<')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T97
+
+
+
+ # $ANTLR start T98
+ def mT98(self, ):
+
+ try:
+ self.type = T98
+
+ # C.g:100:5: ( '>' )
+ # C.g:100:7: '>'
+ self.match(u'>')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T98
+
+
+
+ # $ANTLR start T99
+ def mT99(self, ):
+
+ try:
+ self.type = T99
+
+ # C.g:101:5: ( '<=' )
+ # C.g:101:7: '<='
+ self.match("<=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T99
+
+
+
+ # $ANTLR start T100
+ def mT100(self, ):
+
+ try:
+ self.type = T100
+
+ # C.g:102:6: ( '>=' )
+ # C.g:102:8: '>='
+ self.match(">=")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T100
+
+
+
+ # $ANTLR start T101
+ def mT101(self, ):
+
+ try:
+ self.type = T101
+
+ # C.g:103:6: ( '<<' )
+ # C.g:103:8: '<<'
+ self.match("<<")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T101
+
+
+
+ # $ANTLR start T102
+ def mT102(self, ):
+
+ try:
+ self.type = T102
+
+ # C.g:104:6: ( '>>' )
+ # C.g:104:8: '>>'
+ self.match(">>")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T102
+
+
+
+ # $ANTLR start T103
+ def mT103(self, ):
+
+ try:
+ self.type = T103
+
+ # C.g:105:6: ( '__asm__' )
+ # C.g:105:8: '__asm__'
+ self.match("__asm__")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T103
+
+
+
+ # $ANTLR start T104
+ def mT104(self, ):
+
+ try:
+ self.type = T104
+
+ # C.g:106:6: ( '_asm' )
+ # C.g:106:8: '_asm'
+ self.match("_asm")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T104
+
+
+
+ # $ANTLR start T105
+ def mT105(self, ):
+
+ try:
+ self.type = T105
+
+ # C.g:107:6: ( '__asm' )
+ # C.g:107:8: '__asm'
+ self.match("__asm")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T105
+
+
+
+ # $ANTLR start T106
+ def mT106(self, ):
+
+ try:
+ self.type = T106
+
+ # C.g:108:6: ( 'case' )
+ # C.g:108:8: 'case'
+ self.match("case")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T106
+
+
+
+ # $ANTLR start T107
+ def mT107(self, ):
+
+ try:
+ self.type = T107
+
+ # C.g:109:6: ( 'default' )
+ # C.g:109:8: 'default'
+ self.match("default")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T107
+
+
+
+ # $ANTLR start T108
+ def mT108(self, ):
+
+ try:
+ self.type = T108
+
+ # C.g:110:6: ( 'if' )
+ # C.g:110:8: 'if'
+ self.match("if")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T108
+
+
+
+ # $ANTLR start T109
+ def mT109(self, ):
+
+ try:
+ self.type = T109
+
+ # C.g:111:6: ( 'else' )
+ # C.g:111:8: 'else'
+ self.match("else")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T109
+
+
+
+ # $ANTLR start T110
+ def mT110(self, ):
+
+ try:
+ self.type = T110
+
+ # C.g:112:6: ( 'switch' )
+ # C.g:112:8: 'switch'
+ self.match("switch")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T110
+
+
+
+ # $ANTLR start T111
+ def mT111(self, ):
+
+ try:
+ self.type = T111
+
+ # C.g:113:6: ( 'while' )
+ # C.g:113:8: 'while'
+ self.match("while")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T111
+
+
+
+ # $ANTLR start T112
+ def mT112(self, ):
+
+ try:
+ self.type = T112
+
+ # C.g:114:6: ( 'do' )
+ # C.g:114:8: 'do'
+ self.match("do")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T112
+
+
+
+ # $ANTLR start T113
+ def mT113(self, ):
+
+ try:
+ self.type = T113
+
+ # C.g:115:6: ( 'for' )
+ # C.g:115:8: 'for'
+ self.match("for")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T113
+
+
+
+ # $ANTLR start T114
+ def mT114(self, ):
+
+ try:
+ self.type = T114
+
+ # C.g:116:6: ( 'goto' )
+ # C.g:116:8: 'goto'
+ self.match("goto")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T114
+
+
+
+ # $ANTLR start T115
+ def mT115(self, ):
+
+ try:
+ self.type = T115
+
+ # C.g:117:6: ( 'continue' )
+ # C.g:117:8: 'continue'
+ self.match("continue")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T115
+
+
+
+ # $ANTLR start T116
+ def mT116(self, ):
+
+ try:
+ self.type = T116
+
+ # C.g:118:6: ( 'break' )
+ # C.g:118:8: 'break'
+ self.match("break")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T116
+
+
+
+ # $ANTLR start T117
+ def mT117(self, ):
+
+ try:
+ self.type = T117
+
+ # C.g:119:6: ( 'return' )
+ # C.g:119:8: 'return'
+ self.match("return")
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end T117
+
+
+
+ # $ANTLR start IDENTIFIER
+ def mIDENTIFIER(self, ):
+
+ try:
+ self.type = IDENTIFIER
+
+ # C.g:586:2: ( LETTER ( LETTER | '0' .. '9' )* )
+ # C.g:586:4: LETTER ( LETTER | '0' .. '9' )*
+ self.mLETTER()
+
+ # C.g:586:11: ( LETTER | '0' .. '9' )*
+ while True: #loop1
+ alt1 = 2
+ LA1_0 = self.input.LA(1)
+
+ if (LA1_0 == u'$' or (u'0' <= LA1_0 <= u'9') or (u'A' <= LA1_0 <= u'Z') or LA1_0 == u'_' or (u'a' <= LA1_0 <= u'z')) :
+ alt1 = 1
+
+
+ if alt1 == 1:
+ # C.g:
+ if self.input.LA(1) == u'$' or (u'0' <= self.input.LA(1) <= u'9') or (u'A' <= self.input.LA(1) <= u'Z') or self.input.LA(1) == u'_' or (u'a' <= self.input.LA(1) <= u'z'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ else:
+ break #loop1
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end IDENTIFIER
+
+
+
+ # $ANTLR start LETTER
+ def mLETTER(self, ):
+
+ try:
+ # C.g:591:2: ( '$' | 'A' .. 'Z' | 'a' .. 'z' | '_' )
+ # C.g:
+ if self.input.LA(1) == u'$' or (u'A' <= self.input.LA(1) <= u'Z') or self.input.LA(1) == u'_' or (u'a' <= self.input.LA(1) <= u'z'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end LETTER
+
+
+
+ # $ANTLR start CHARACTER_LITERAL
+ def mCHARACTER_LITERAL(self, ):
+
+ try:
+ self.type = CHARACTER_LITERAL
+
+ # C.g:598:5: ( ( 'L' )? '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\'' )
+ # C.g:598:9: ( 'L' )? '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\''
+ # C.g:598:9: ( 'L' )?
+ alt2 = 2
+ LA2_0 = self.input.LA(1)
+
+ if (LA2_0 == u'L') :
+ alt2 = 1
+ if alt2 == 1:
+ # C.g:598:10: 'L'
+ self.match(u'L')
+
+
+
+
+ self.match(u'\'')
+
+ # C.g:598:21: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) )
+ alt3 = 2
+ LA3_0 = self.input.LA(1)
+
+ if (LA3_0 == u'\\') :
+ alt3 = 1
+ elif ((u'\u0000' <= LA3_0 <= u'&') or (u'(' <= LA3_0 <= u'[') or (u']' <= LA3_0 <= u'\uFFFE')) :
+ alt3 = 2
+ else:
+ nvae = NoViableAltException("598:21: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) )", 3, 0, self.input)
+
+ raise nvae
+
+ if alt3 == 1:
+ # C.g:598:23: EscapeSequence
+ self.mEscapeSequence()
+
+
+
+ elif alt3 == 2:
+ # C.g:598:40: ~ ( '\\'' | '\\\\' )
+ if (u'\u0000' <= self.input.LA(1) <= u'&') or (u'(' <= self.input.LA(1) <= u'[') or (u']' <= self.input.LA(1) <= u'\uFFFE'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+
+ self.match(u'\'')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end CHARACTER_LITERAL
+
+
+
+ # $ANTLR start STRING_LITERAL
+ def mSTRING_LITERAL(self, ):
+
+ try:
+ self.type = STRING_LITERAL
+
+ # C.g:602:5: ( ( 'L' )? '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' )
+ # C.g:602:8: ( 'L' )? '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"'
+ # C.g:602:8: ( 'L' )?
+ alt4 = 2
+ LA4_0 = self.input.LA(1)
+
+ if (LA4_0 == u'L') :
+ alt4 = 1
+ if alt4 == 1:
+ # C.g:602:9: 'L'
+ self.match(u'L')
+
+
+
+
+ self.match(u'"')
+
+ # C.g:602:19: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )*
+ while True: #loop5
+ alt5 = 3
+ LA5_0 = self.input.LA(1)
+
+ if (LA5_0 == u'\\') :
+ alt5 = 1
+ elif ((u'\u0000' <= LA5_0 <= u'!') or (u'#' <= LA5_0 <= u'[') or (u']' <= LA5_0 <= u'\uFFFE')) :
+ alt5 = 2
+
+
+ if alt5 == 1:
+ # C.g:602:21: EscapeSequence
+ self.mEscapeSequence()
+
+
+
+ elif alt5 == 2:
+ # C.g:602:38: ~ ( '\\\\' | '\"' )
+ if (u'\u0000' <= self.input.LA(1) <= u'!') or (u'#' <= self.input.LA(1) <= u'[') or (u']' <= self.input.LA(1) <= u'\uFFFE'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ else:
+ break #loop5
+
+
+ self.match(u'"')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end STRING_LITERAL
+
+
+
+ # $ANTLR start HEX_LITERAL
+ def mHEX_LITERAL(self, ):
+
+ try:
+ self.type = HEX_LITERAL
+
+ # C.g:605:13: ( '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? )
+ # C.g:605:15: '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )?
+ self.match(u'0')
+
+ if self.input.LA(1) == u'X' or self.input.LA(1) == u'x':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+ # C.g:605:29: ( HexDigit )+
+ cnt6 = 0
+ while True: #loop6
+ alt6 = 2
+ LA6_0 = self.input.LA(1)
+
+ if ((u'0' <= LA6_0 <= u'9') or (u'A' <= LA6_0 <= u'F') or (u'a' <= LA6_0 <= u'f')) :
+ alt6 = 1
+
+
+ if alt6 == 1:
+ # C.g:605:29: HexDigit
+ self.mHexDigit()
+
+
+
+ else:
+ if cnt6 >= 1:
+ break #loop6
+
+ eee = EarlyExitException(6, self.input)
+ raise eee
+
+ cnt6 += 1
+
+
+ # C.g:605:39: ( IntegerTypeSuffix )?
+ alt7 = 2
+ LA7_0 = self.input.LA(1)
+
+ if (LA7_0 == u'L' or LA7_0 == u'U' or LA7_0 == u'l' or LA7_0 == u'u') :
+ alt7 = 1
+ if alt7 == 1:
+ # C.g:605:39: IntegerTypeSuffix
+ self.mIntegerTypeSuffix()
+
+
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end HEX_LITERAL
+
+
+
+ # $ANTLR start DECIMAL_LITERAL
+ def mDECIMAL_LITERAL(self, ):
+
+ try:
+ self.type = DECIMAL_LITERAL
+
+ # C.g:607:17: ( ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )? )
+ # C.g:607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )?
+ # C.g:607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* )
+ alt9 = 2
+ LA9_0 = self.input.LA(1)
+
+ if (LA9_0 == u'0') :
+ alt9 = 1
+ elif ((u'1' <= LA9_0 <= u'9')) :
+ alt9 = 2
+ else:
+ nvae = NoViableAltException("607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* )", 9, 0, self.input)
+
+ raise nvae
+
+ if alt9 == 1:
+ # C.g:607:20: '0'
+ self.match(u'0')
+
+
+
+ elif alt9 == 2:
+ # C.g:607:26: '1' .. '9' ( '0' .. '9' )*
+ self.matchRange(u'1', u'9')
+
+ # C.g:607:35: ( '0' .. '9' )*
+ while True: #loop8
+ alt8 = 2
+ LA8_0 = self.input.LA(1)
+
+ if ((u'0' <= LA8_0 <= u'9')) :
+ alt8 = 1
+
+
+ if alt8 == 1:
+ # C.g:607:35: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ break #loop8
+
+
+
+
+
+ # C.g:607:46: ( IntegerTypeSuffix )?
+ alt10 = 2
+ LA10_0 = self.input.LA(1)
+
+ if (LA10_0 == u'L' or LA10_0 == u'U' or LA10_0 == u'l' or LA10_0 == u'u') :
+ alt10 = 1
+ if alt10 == 1:
+ # C.g:607:46: IntegerTypeSuffix
+ self.mIntegerTypeSuffix()
+
+
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end DECIMAL_LITERAL
+
+
+
+ # $ANTLR start OCTAL_LITERAL
+ def mOCTAL_LITERAL(self, ):
+
+ try:
+ self.type = OCTAL_LITERAL
+
+ # C.g:609:15: ( '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )? )
+ # C.g:609:17: '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )?
+ self.match(u'0')
+
+ # C.g:609:21: ( '0' .. '7' )+
+ cnt11 = 0
+ while True: #loop11
+ alt11 = 2
+ LA11_0 = self.input.LA(1)
+
+ if ((u'0' <= LA11_0 <= u'7')) :
+ alt11 = 1
+
+
+ if alt11 == 1:
+ # C.g:609:22: '0' .. '7'
+ self.matchRange(u'0', u'7')
+
+
+
+ else:
+ if cnt11 >= 1:
+ break #loop11
+
+ eee = EarlyExitException(11, self.input)
+ raise eee
+
+ cnt11 += 1
+
+
+ # C.g:609:33: ( IntegerTypeSuffix )?
+ alt12 = 2
+ LA12_0 = self.input.LA(1)
+
+ if (LA12_0 == u'L' or LA12_0 == u'U' or LA12_0 == u'l' or LA12_0 == u'u') :
+ alt12 = 1
+ if alt12 == 1:
+ # C.g:609:33: IntegerTypeSuffix
+ self.mIntegerTypeSuffix()
+
+
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end OCTAL_LITERAL
+
+
+
+ # $ANTLR start HexDigit
+ def mHexDigit(self, ):
+
+ try:
+ # C.g:612:10: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) )
+ # C.g:612:12: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )
+ if (u'0' <= self.input.LA(1) <= u'9') or (u'A' <= self.input.LA(1) <= u'F') or (u'a' <= self.input.LA(1) <= u'f'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end HexDigit
+
+
+
+ # $ANTLR start IntegerTypeSuffix
+ def mIntegerTypeSuffix(self, ):
+
+ try:
+ # C.g:616:2: ( ( 'u' | 'U' ) | ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) )
+ alt13 = 4
+ LA13_0 = self.input.LA(1)
+
+ if (LA13_0 == u'U' or LA13_0 == u'u') :
+ LA13_1 = self.input.LA(2)
+
+ if (LA13_1 == u'L' or LA13_1 == u'l') :
+ LA13_3 = self.input.LA(3)
+
+ if (LA13_3 == u'L' or LA13_3 == u'l') :
+ alt13 = 4
+ else:
+ alt13 = 3
+ else:
+ alt13 = 1
+ elif (LA13_0 == u'L' or LA13_0 == u'l') :
+ alt13 = 2
+ else:
+ nvae = NoViableAltException("614:1: fragment IntegerTypeSuffix : ( ( 'u' | 'U' ) | ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) );", 13, 0, self.input)
+
+ raise nvae
+
+ if alt13 == 1:
+ # C.g:616:4: ( 'u' | 'U' )
+ if self.input.LA(1) == u'U' or self.input.LA(1) == u'u':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ elif alt13 == 2:
+ # C.g:617:4: ( 'l' | 'L' )
+ if self.input.LA(1) == u'L' or self.input.LA(1) == u'l':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ elif alt13 == 3:
+ # C.g:618:4: ( 'u' | 'U' ) ( 'l' | 'L' )
+ if self.input.LA(1) == u'U' or self.input.LA(1) == u'u':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+ if self.input.LA(1) == u'L' or self.input.LA(1) == u'l':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ elif alt13 == 4:
+ # C.g:619:4: ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' )
+ if self.input.LA(1) == u'U' or self.input.LA(1) == u'u':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+ if self.input.LA(1) == u'L' or self.input.LA(1) == u'l':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+ if self.input.LA(1) == u'L' or self.input.LA(1) == u'l':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end IntegerTypeSuffix
+
+
+
+ # $ANTLR start FLOATING_POINT_LITERAL
+ def mFLOATING_POINT_LITERAL(self, ):
+
+ try:
+ self.type = FLOATING_POINT_LITERAL
+
+ # C.g:623:5: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? | '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? | ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? | ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix )
+ alt25 = 4
+ alt25 = self.dfa25.predict(self.input)
+ if alt25 == 1:
+ # C.g:623:9: ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )?
+ # C.g:623:9: ( '0' .. '9' )+
+ cnt14 = 0
+ while True: #loop14
+ alt14 = 2
+ LA14_0 = self.input.LA(1)
+
+ if ((u'0' <= LA14_0 <= u'9')) :
+ alt14 = 1
+
+
+ if alt14 == 1:
+ # C.g:623:10: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ if cnt14 >= 1:
+ break #loop14
+
+ eee = EarlyExitException(14, self.input)
+ raise eee
+
+ cnt14 += 1
+
+
+ self.match(u'.')
+
+ # C.g:623:25: ( '0' .. '9' )*
+ while True: #loop15
+ alt15 = 2
+ LA15_0 = self.input.LA(1)
+
+ if ((u'0' <= LA15_0 <= u'9')) :
+ alt15 = 1
+
+
+ if alt15 == 1:
+ # C.g:623:26: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ break #loop15
+
+
+ # C.g:623:37: ( Exponent )?
+ alt16 = 2
+ LA16_0 = self.input.LA(1)
+
+ if (LA16_0 == u'E' or LA16_0 == u'e') :
+ alt16 = 1
+ if alt16 == 1:
+ # C.g:623:37: Exponent
+ self.mExponent()
+
+
+
+
+ # C.g:623:47: ( FloatTypeSuffix )?
+ alt17 = 2
+ LA17_0 = self.input.LA(1)
+
+ if (LA17_0 == u'D' or LA17_0 == u'F' or LA17_0 == u'd' or LA17_0 == u'f') :
+ alt17 = 1
+ if alt17 == 1:
+ # C.g:623:47: FloatTypeSuffix
+ self.mFloatTypeSuffix()
+
+
+
+
+
+
+ elif alt25 == 2:
+ # C.g:624:9: '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )?
+ self.match(u'.')
+
+ # C.g:624:13: ( '0' .. '9' )+
+ cnt18 = 0
+ while True: #loop18
+ alt18 = 2
+ LA18_0 = self.input.LA(1)
+
+ if ((u'0' <= LA18_0 <= u'9')) :
+ alt18 = 1
+
+
+ if alt18 == 1:
+ # C.g:624:14: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ if cnt18 >= 1:
+ break #loop18
+
+ eee = EarlyExitException(18, self.input)
+ raise eee
+
+ cnt18 += 1
+
+
+ # C.g:624:25: ( Exponent )?
+ alt19 = 2
+ LA19_0 = self.input.LA(1)
+
+ if (LA19_0 == u'E' or LA19_0 == u'e') :
+ alt19 = 1
+ if alt19 == 1:
+ # C.g:624:25: Exponent
+ self.mExponent()
+
+
+
+
+ # C.g:624:35: ( FloatTypeSuffix )?
+ alt20 = 2
+ LA20_0 = self.input.LA(1)
+
+ if (LA20_0 == u'D' or LA20_0 == u'F' or LA20_0 == u'd' or LA20_0 == u'f') :
+ alt20 = 1
+ if alt20 == 1:
+ # C.g:624:35: FloatTypeSuffix
+ self.mFloatTypeSuffix()
+
+
+
+
+
+
+ elif alt25 == 3:
+ # C.g:625:9: ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )?
+ # C.g:625:9: ( '0' .. '9' )+
+ cnt21 = 0
+ while True: #loop21
+ alt21 = 2
+ LA21_0 = self.input.LA(1)
+
+ if ((u'0' <= LA21_0 <= u'9')) :
+ alt21 = 1
+
+
+ if alt21 == 1:
+ # C.g:625:10: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ if cnt21 >= 1:
+ break #loop21
+
+ eee = EarlyExitException(21, self.input)
+ raise eee
+
+ cnt21 += 1
+
+
+ self.mExponent()
+
+ # C.g:625:30: ( FloatTypeSuffix )?
+ alt22 = 2
+ LA22_0 = self.input.LA(1)
+
+ if (LA22_0 == u'D' or LA22_0 == u'F' or LA22_0 == u'd' or LA22_0 == u'f') :
+ alt22 = 1
+ if alt22 == 1:
+ # C.g:625:30: FloatTypeSuffix
+ self.mFloatTypeSuffix()
+
+
+
+
+
+
+ elif alt25 == 4:
+ # C.g:626:9: ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix
+ # C.g:626:9: ( '0' .. '9' )+
+ cnt23 = 0
+ while True: #loop23
+ alt23 = 2
+ LA23_0 = self.input.LA(1)
+
+ if ((u'0' <= LA23_0 <= u'9')) :
+ alt23 = 1
+
+
+ if alt23 == 1:
+ # C.g:626:10: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ if cnt23 >= 1:
+ break #loop23
+
+ eee = EarlyExitException(23, self.input)
+ raise eee
+
+ cnt23 += 1
+
+
+ # C.g:626:21: ( Exponent )?
+ alt24 = 2
+ LA24_0 = self.input.LA(1)
+
+ if (LA24_0 == u'E' or LA24_0 == u'e') :
+ alt24 = 1
+ if alt24 == 1:
+ # C.g:626:21: Exponent
+ self.mExponent()
+
+
+
+
+ self.mFloatTypeSuffix()
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end FLOATING_POINT_LITERAL
+
+
+
+ # $ANTLR start Exponent
+ def mExponent(self, ):
+
+ try:
+ # C.g:630:10: ( ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ )
+ # C.g:630:12: ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+
+ if self.input.LA(1) == u'E' or self.input.LA(1) == u'e':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+ # C.g:630:22: ( '+' | '-' )?
+ alt26 = 2
+ LA26_0 = self.input.LA(1)
+
+ if (LA26_0 == u'+' or LA26_0 == u'-') :
+ alt26 = 1
+ if alt26 == 1:
+ # C.g:
+ if self.input.LA(1) == u'+' or self.input.LA(1) == u'-':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+
+ # C.g:630:33: ( '0' .. '9' )+
+ cnt27 = 0
+ while True: #loop27
+ alt27 = 2
+ LA27_0 = self.input.LA(1)
+
+ if ((u'0' <= LA27_0 <= u'9')) :
+ alt27 = 1
+
+
+ if alt27 == 1:
+ # C.g:630:34: '0' .. '9'
+ self.matchRange(u'0', u'9')
+
+
+
+ else:
+ if cnt27 >= 1:
+ break #loop27
+
+ eee = EarlyExitException(27, self.input)
+ raise eee
+
+ cnt27 += 1
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end Exponent
+
+
+
+ # $ANTLR start FloatTypeSuffix
+ def mFloatTypeSuffix(self, ):
+
+ try:
+ # C.g:633:17: ( ( 'f' | 'F' | 'd' | 'D' ) )
+ # C.g:633:19: ( 'f' | 'F' | 'd' | 'D' )
+ if self.input.LA(1) == u'D' or self.input.LA(1) == u'F' or self.input.LA(1) == u'd' or self.input.LA(1) == u'f':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end FloatTypeSuffix
+
+
+
+ # $ANTLR start EscapeSequence
+ def mEscapeSequence(self, ):
+
+ try:
+ # C.g:637:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape )
+ alt28 = 2
+ LA28_0 = self.input.LA(1)
+
+ if (LA28_0 == u'\\') :
+ LA28_1 = self.input.LA(2)
+
+ if (LA28_1 == u'"' or LA28_1 == u'\'' or LA28_1 == u'\\' or LA28_1 == u'b' or LA28_1 == u'f' or LA28_1 == u'n' or LA28_1 == u'r' or LA28_1 == u't') :
+ alt28 = 1
+ elif ((u'0' <= LA28_1 <= u'7')) :
+ alt28 = 2
+ else:
+ nvae = NoViableAltException("635:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape );", 28, 1, self.input)
+
+ raise nvae
+
+ else:
+ nvae = NoViableAltException("635:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape );", 28, 0, self.input)
+
+ raise nvae
+
+ if alt28 == 1:
+ # C.g:637:8: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' )
+ self.match(u'\\')
+
+ if self.input.LA(1) == u'"' or self.input.LA(1) == u'\'' or self.input.LA(1) == u'\\' or self.input.LA(1) == u'b' or self.input.LA(1) == u'f' or self.input.LA(1) == u'n' or self.input.LA(1) == u'r' or self.input.LA(1) == u't':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ elif alt28 == 2:
+ # C.g:638:9: OctalEscape
+ self.mOctalEscape()
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end EscapeSequence
+
+
+
+ # $ANTLR start OctalEscape
+ def mOctalEscape(self, ):
+
+ try:
+ # C.g:643:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
+ alt29 = 3
+ LA29_0 = self.input.LA(1)
+
+ if (LA29_0 == u'\\') :
+ LA29_1 = self.input.LA(2)
+
+ if ((u'0' <= LA29_1 <= u'3')) :
+ LA29_2 = self.input.LA(3)
+
+ if ((u'0' <= LA29_2 <= u'7')) :
+ LA29_4 = self.input.LA(4)
+
+ if ((u'0' <= LA29_4 <= u'7')) :
+ alt29 = 1
+ else:
+ alt29 = 2
+ else:
+ alt29 = 3
+ elif ((u'4' <= LA29_1 <= u'7')) :
+ LA29_3 = self.input.LA(3)
+
+ if ((u'0' <= LA29_3 <= u'7')) :
+ alt29 = 2
+ else:
+ alt29 = 3
+ else:
+ nvae = NoViableAltException("641:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 29, 1, self.input)
+
+ raise nvae
+
+ else:
+ nvae = NoViableAltException("641:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 29, 0, self.input)
+
+ raise nvae
+
+ if alt29 == 1:
+ # C.g:643:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
+ self.match(u'\\')
+
+ # C.g:643:14: ( '0' .. '3' )
+ # C.g:643:15: '0' .. '3'
+ self.matchRange(u'0', u'3')
+
+
+
+
+ # C.g:643:25: ( '0' .. '7' )
+ # C.g:643:26: '0' .. '7'
+ self.matchRange(u'0', u'7')
+
+
+
+
+ # C.g:643:36: ( '0' .. '7' )
+ # C.g:643:37: '0' .. '7'
+ self.matchRange(u'0', u'7')
+
+
+
+
+
+
+ elif alt29 == 2:
+ # C.g:644:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
+ self.match(u'\\')
+
+ # C.g:644:14: ( '0' .. '7' )
+ # C.g:644:15: '0' .. '7'
+ self.matchRange(u'0', u'7')
+
+
+
+
+ # C.g:644:25: ( '0' .. '7' )
+ # C.g:644:26: '0' .. '7'
+ self.matchRange(u'0', u'7')
+
+
+
+
+
+
+ elif alt29 == 3:
+ # C.g:645:9: '\\\\' ( '0' .. '7' )
+ self.match(u'\\')
+
+ # C.g:645:14: ( '0' .. '7' )
+ # C.g:645:15: '0' .. '7'
+ self.matchRange(u'0', u'7')
+
+
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end OctalEscape
+
+
+
+ # $ANTLR start UnicodeEscape
+ def mUnicodeEscape(self, ):
+
+ try:
+ # C.g:650:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit )
+ # C.g:650:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit
+ self.match(u'\\')
+
+ self.match(u'u')
+
+ self.mHexDigit()
+
+ self.mHexDigit()
+
+ self.mHexDigit()
+
+ self.mHexDigit()
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end UnicodeEscape
+
+
+
+ # $ANTLR start WS
+ def mWS(self, ):
+
+ try:
+ self.type = WS
+
+ # C.g:653:5: ( ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) )
+ # C.g:653:8: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' )
+ if (u'\t' <= self.input.LA(1) <= u'\n') or (u'\f' <= self.input.LA(1) <= u'\r') or self.input.LA(1) == u' ':
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+ #action start
+ self.channel=HIDDEN;
+ #action end
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end WS
+
+
+
+ # $ANTLR start BS
+ def mBS(self, ):
+
+ try:
+ self.type = BS
+
+ # C.g:657:5: ( ( '\\\\' ) )
+ # C.g:657:7: ( '\\\\' )
+ # C.g:657:7: ( '\\\\' )
+ # C.g:657:8: '\\\\'
+ self.match(u'\\')
+
+
+
+
+ #action start
+ self.channel=HIDDEN;
+ #action end
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end BS
+
+
+
+ # $ANTLR start UnicodeVocabulary
+ def mUnicodeVocabulary(self, ):
+
+ try:
+ self.type = UnicodeVocabulary
+
+ # C.g:665:5: ( '\\u0003' .. '\\uFFFE' )
+ # C.g:665:7: '\\u0003' .. '\\uFFFE'
+ self.matchRange(u'\u0003', u'\uFFFE')
+
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end UnicodeVocabulary
+
+
+
+ # $ANTLR start COMMENT
+ def mCOMMENT(self, ):
+
+ try:
+ self.type = COMMENT
+
+ # C.g:668:5: ( '/*' ( options {greedy=false; } : . )* '*/' )
+ # C.g:668:9: '/*' ( options {greedy=false; } : . )* '*/'
+ self.match("/*")
+
+
+ # C.g:668:14: ( options {greedy=false; } : . )*
+ while True: #loop30
+ alt30 = 2
+ LA30_0 = self.input.LA(1)
+
+ if (LA30_0 == u'*') :
+ LA30_1 = self.input.LA(2)
+
+ if (LA30_1 == u'/') :
+ alt30 = 2
+ elif ((u'\u0000' <= LA30_1 <= u'.') or (u'0' <= LA30_1 <= u'\uFFFE')) :
+ alt30 = 1
+
+
+ elif ((u'\u0000' <= LA30_0 <= u')') or (u'+' <= LA30_0 <= u'\uFFFE')) :
+ alt30 = 1
+
+
+ if alt30 == 1:
+ # C.g:668:42: .
+ self.matchAny()
+
+
+
+ else:
+ break #loop30
+
+
+ self.match("*/")
+
+
+ #action start
+ self.channel=HIDDEN;
+ #action end
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end COMMENT
+
+
+
+ # $ANTLR start LINE_COMMENT
+ def mLINE_COMMENT(self, ):
+
+ try:
+ self.type = LINE_COMMENT
+
+ # C.g:673:5: ( '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' )
+ # C.g:673:7: '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n'
+ self.match("//")
+
+
+ # C.g:673:12: (~ ( '\\n' | '\\r' ) )*
+ while True: #loop31
+ alt31 = 2
+ LA31_0 = self.input.LA(1)
+
+ if ((u'\u0000' <= LA31_0 <= u'\t') or (u'\u000B' <= LA31_0 <= u'\f') or (u'\u000E' <= LA31_0 <= u'\uFFFE')) :
+ alt31 = 1
+
+
+ if alt31 == 1:
+ # C.g:673:12: ~ ( '\\n' | '\\r' )
+ if (u'\u0000' <= self.input.LA(1) <= u'\t') or (u'\u000B' <= self.input.LA(1) <= u'\f') or (u'\u000E' <= self.input.LA(1) <= u'\uFFFE'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ else:
+ break #loop31
+
+
+ # C.g:673:26: ( '\\r' )?
+ alt32 = 2
+ LA32_0 = self.input.LA(1)
+
+ if (LA32_0 == u'\r') :
+ alt32 = 1
+ if alt32 == 1:
+ # C.g:673:26: '\\r'
+ self.match(u'\r')
+
+
+
+
+ self.match(u'\n')
+
+ #action start
+ self.channel=HIDDEN;
+ #action end
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end LINE_COMMENT
+
+
+
+ # $ANTLR start LINE_COMMAND
+ def mLINE_COMMAND(self, ):
+
+ try:
+ self.type = LINE_COMMAND
+
+ # C.g:678:5: ( '#' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' )
+ # C.g:678:7: '#' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n'
+ self.match(u'#')
+
+ # C.g:678:11: (~ ( '\\n' | '\\r' ) )*
+ while True: #loop33
+ alt33 = 2
+ LA33_0 = self.input.LA(1)
+
+ if ((u'\u0000' <= LA33_0 <= u'\t') or (u'\u000B' <= LA33_0 <= u'\f') or (u'\u000E' <= LA33_0 <= u'\uFFFE')) :
+ alt33 = 1
+
+
+ if alt33 == 1:
+ # C.g:678:11: ~ ( '\\n' | '\\r' )
+ if (u'\u0000' <= self.input.LA(1) <= u'\t') or (u'\u000B' <= self.input.LA(1) <= u'\f') or (u'\u000E' <= self.input.LA(1) <= u'\uFFFE'):
+ self.input.consume();
+
+ else:
+ mse = MismatchedSetException(None, self.input)
+ self.recover(mse)
+ raise mse
+
+
+
+
+ else:
+ break #loop33
+
+
+ # C.g:678:25: ( '\\r' )?
+ alt34 = 2
+ LA34_0 = self.input.LA(1)
+
+ if (LA34_0 == u'\r') :
+ alt34 = 1
+ if alt34 == 1:
+ # C.g:678:25: '\\r'
+ self.match(u'\r')
+
+
+
+
+ self.match(u'\n')
+
+ #action start
+ self.channel=HIDDEN;
+ #action end
+
+
+
+
+ finally:
+
+ pass
+
+ # $ANTLR end LINE_COMMAND
+
+
+
+ def mTokens(self):
+ # C.g:1:8: ( T25 | T26 | T27 | T28 | T29 | T30 | T31 | T32 | T33 | T34 | T35 | T36 | T37 | T38 | T39 | T40 | T41 | T42 | T43 | T44 | T45 | T46 | T47 | T48 | T49 | T50 | T51 | T52 | T53 | T54 | T55 | T56 | T57 | T58 | T59 | T60 | T61 | T62 | T63 | T64 | T65 | T66 | T67 | T68 | T69 | T70 | T71 | T72 | T73 | T74 | T75 | T76 | T77 | T78 | T79 | T80 | T81 | T82 | T83 | T84 | T85 | T86 | T87 | T88 | T89 | T90 | T91 | T92 | T93 | T94 | T95 | T96 | T97 | T98 | T99 | T100 | T101 | T102 | T103 | T104 | T105 | T106 | T107 | T108 | T109 | T110 | T111 | T112 | T113 | T114 | T115 | T116 | T117 | IDENTIFIER | CHARACTER_LITERAL | STRING_LITERAL | HEX_LITERAL | DECIMAL_LITERAL | OCTAL_LITERAL | FLOATING_POINT_LITERAL | WS | BS | UnicodeVocabulary | COMMENT | LINE_COMMENT | LINE_COMMAND )
+ alt35 = 106
+ alt35 = self.dfa35.predict(self.input)
+ if alt35 == 1:
+ # C.g:1:10: T25
+ self.mT25()
+
+
+
+ elif alt35 == 2:
+ # C.g:1:14: T26
+ self.mT26()
+
+
+
+ elif alt35 == 3:
+ # C.g:1:18: T27
+ self.mT27()
+
+
+
+ elif alt35 == 4:
+ # C.g:1:22: T28
+ self.mT28()
+
+
+
+ elif alt35 == 5:
+ # C.g:1:26: T29
+ self.mT29()
+
+
+
+ elif alt35 == 6:
+ # C.g:1:30: T30
+ self.mT30()
+
+
+
+ elif alt35 == 7:
+ # C.g:1:34: T31
+ self.mT31()
+
+
+
+ elif alt35 == 8:
+ # C.g:1:38: T32
+ self.mT32()
+
+
+
+ elif alt35 == 9:
+ # C.g:1:42: T33
+ self.mT33()
+
+
+
+ elif alt35 == 10:
+ # C.g:1:46: T34
+ self.mT34()
+
+
+
+ elif alt35 == 11:
+ # C.g:1:50: T35
+ self.mT35()
+
+
+
+ elif alt35 == 12:
+ # C.g:1:54: T36
+ self.mT36()
+
+
+
+ elif alt35 == 13:
+ # C.g:1:58: T37
+ self.mT37()
+
+
+
+ elif alt35 == 14:
+ # C.g:1:62: T38
+ self.mT38()
+
+
+
+ elif alt35 == 15:
+ # C.g:1:66: T39
+ self.mT39()
+
+
+
+ elif alt35 == 16:
+ # C.g:1:70: T40
+ self.mT40()
+
+
+
+ elif alt35 == 17:
+ # C.g:1:74: T41
+ self.mT41()
+
+
+
+ elif alt35 == 18:
+ # C.g:1:78: T42
+ self.mT42()
+
+
+
+ elif alt35 == 19:
+ # C.g:1:82: T43
+ self.mT43()
+
+
+
+ elif alt35 == 20:
+ # C.g:1:86: T44
+ self.mT44()
+
+
+
+ elif alt35 == 21:
+ # C.g:1:90: T45
+ self.mT45()
+
+
+
+ elif alt35 == 22:
+ # C.g:1:94: T46
+ self.mT46()
+
+
+
+ elif alt35 == 23:
+ # C.g:1:98: T47
+ self.mT47()
+
+
+
+ elif alt35 == 24:
+ # C.g:1:102: T48
+ self.mT48()
+
+
+
+ elif alt35 == 25:
+ # C.g:1:106: T49
+ self.mT49()
+
+
+
+ elif alt35 == 26:
+ # C.g:1:110: T50
+ self.mT50()
+
+
+
+ elif alt35 == 27:
+ # C.g:1:114: T51
+ self.mT51()
+
+
+
+ elif alt35 == 28:
+ # C.g:1:118: T52
+ self.mT52()
+
+
+
+ elif alt35 == 29:
+ # C.g:1:122: T53
+ self.mT53()
+
+
+
+ elif alt35 == 30:
+ # C.g:1:126: T54
+ self.mT54()
+
+
+
+ elif alt35 == 31:
+ # C.g:1:130: T55
+ self.mT55()
+
+
+
+ elif alt35 == 32:
+ # C.g:1:134: T56
+ self.mT56()
+
+
+
+ elif alt35 == 33:
+ # C.g:1:138: T57
+ self.mT57()
+
+
+
+ elif alt35 == 34:
+ # C.g:1:142: T58
+ self.mT58()
+
+
+
+ elif alt35 == 35:
+ # C.g:1:146: T59
+ self.mT59()
+
+
+
+ elif alt35 == 36:
+ # C.g:1:150: T60
+ self.mT60()
+
+
+
+ elif alt35 == 37:
+ # C.g:1:154: T61
+ self.mT61()
+
+
+
+ elif alt35 == 38:
+ # C.g:1:158: T62
+ self.mT62()
+
+
+
+ elif alt35 == 39:
+ # C.g:1:162: T63
+ self.mT63()
+
+
+
+ elif alt35 == 40:
+ # C.g:1:166: T64
+ self.mT64()
+
+
+
+ elif alt35 == 41:
+ # C.g:1:170: T65
+ self.mT65()
+
+
+
+ elif alt35 == 42:
+ # C.g:1:174: T66
+ self.mT66()
+
+
+
+ elif alt35 == 43:
+ # C.g:1:178: T67
+ self.mT67()
+
+
+
+ elif alt35 == 44:
+ # C.g:1:182: T68
+ self.mT68()
+
+
+
+ elif alt35 == 45:
+ # C.g:1:186: T69
+ self.mT69()
+
+
+
+ elif alt35 == 46:
+ # C.g:1:190: T70
+ self.mT70()
+
+
+
+ elif alt35 == 47:
+ # C.g:1:194: T71
+ self.mT71()
+
+
+
+ elif alt35 == 48:
+ # C.g:1:198: T72
+ self.mT72()
+
+
+
+ elif alt35 == 49:
+ # C.g:1:202: T73
+ self.mT73()
+
+
+
+ elif alt35 == 50:
+ # C.g:1:206: T74
+ self.mT74()
+
+
+
+ elif alt35 == 51:
+ # C.g:1:210: T75
+ self.mT75()
+
+
+
+ elif alt35 == 52:
+ # C.g:1:214: T76
+ self.mT76()
+
+
+
+ elif alt35 == 53:
+ # C.g:1:218: T77
+ self.mT77()
+
+
+
+ elif alt35 == 54:
+ # C.g:1:222: T78
+ self.mT78()
+
+
+
+ elif alt35 == 55:
+ # C.g:1:226: T79
+ self.mT79()
+
+
+
+ elif alt35 == 56:
+ # C.g:1:230: T80
+ self.mT80()
+
+
+
+ elif alt35 == 57:
+ # C.g:1:234: T81
+ self.mT81()
+
+
+
+ elif alt35 == 58:
+ # C.g:1:238: T82
+ self.mT82()
+
+
+
+ elif alt35 == 59:
+ # C.g:1:242: T83
+ self.mT83()
+
+
+
+ elif alt35 == 60:
+ # C.g:1:246: T84
+ self.mT84()
+
+
+
+ elif alt35 == 61:
+ # C.g:1:250: T85
+ self.mT85()
+
+
+
+ elif alt35 == 62:
+ # C.g:1:254: T86
+ self.mT86()
+
+
+
+ elif alt35 == 63:
+ # C.g:1:258: T87
+ self.mT87()
+
+
+
+ elif alt35 == 64:
+ # C.g:1:262: T88
+ self.mT88()
+
+
+
+ elif alt35 == 65:
+ # C.g:1:266: T89
+ self.mT89()
+
+
+
+ elif alt35 == 66:
+ # C.g:1:270: T90
+ self.mT90()
+
+
+
+ elif alt35 == 67:
+ # C.g:1:274: T91
+ self.mT91()
+
+
+
+ elif alt35 == 68:
+ # C.g:1:278: T92
+ self.mT92()
+
+
+
+ elif alt35 == 69:
+ # C.g:1:282: T93
+ self.mT93()
+
+
+
+ elif alt35 == 70:
+ # C.g:1:286: T94
+ self.mT94()
+
+
+
+ elif alt35 == 71:
+ # C.g:1:290: T95
+ self.mT95()
+
+
+
+ elif alt35 == 72:
+ # C.g:1:294: T96
+ self.mT96()
+
+
+
+ elif alt35 == 73:
+ # C.g:1:298: T97
+ self.mT97()
+
+
+
+ elif alt35 == 74:
+ # C.g:1:302: T98
+ self.mT98()
+
+
+
+ elif alt35 == 75:
+ # C.g:1:306: T99
+ self.mT99()
+
+
+
+ elif alt35 == 76:
+ # C.g:1:310: T100
+ self.mT100()
+
+
+
+ elif alt35 == 77:
+ # C.g:1:315: T101
+ self.mT101()
+
+
+
+ elif alt35 == 78:
+ # C.g:1:320: T102
+ self.mT102()
+
+
+
+ elif alt35 == 79:
+ # C.g:1:325: T103
+ self.mT103()
+
+
+
+ elif alt35 == 80:
+ # C.g:1:330: T104
+ self.mT104()
+
+
+
+ elif alt35 == 81:
+ # C.g:1:335: T105
+ self.mT105()
+
+
+
+ elif alt35 == 82:
+ # C.g:1:340: T106
+ self.mT106()
+
+
+
+ elif alt35 == 83:
+ # C.g:1:345: T107
+ self.mT107()
+
+
+
+ elif alt35 == 84:
+ # C.g:1:350: T108
+ self.mT108()
+
+
+
+ elif alt35 == 85:
+ # C.g:1:355: T109
+ self.mT109()
+
+
+
+ elif alt35 == 86:
+ # C.g:1:360: T110
+ self.mT110()
+
+
+
+ elif alt35 == 87:
+ # C.g:1:365: T111
+ self.mT111()
+
+
+
+ elif alt35 == 88:
+ # C.g:1:370: T112
+ self.mT112()
+
+
+
+ elif alt35 == 89:
+ # C.g:1:375: T113
+ self.mT113()
+
+
+
+ elif alt35 == 90:
+ # C.g:1:380: T114
+ self.mT114()
+
+
+
+ elif alt35 == 91:
+ # C.g:1:385: T115
+ self.mT115()
+
+
+
+ elif alt35 == 92:
+ # C.g:1:390: T116
+ self.mT116()
+
+
+
+ elif alt35 == 93:
+ # C.g:1:395: T117
+ self.mT117()
+
+
+
+ elif alt35 == 94:
+ # C.g:1:400: IDENTIFIER
+ self.mIDENTIFIER()
+
+
+
+ elif alt35 == 95:
+ # C.g:1:411: CHARACTER_LITERAL
+ self.mCHARACTER_LITERAL()
+
+
+
+ elif alt35 == 96:
+ # C.g:1:429: STRING_LITERAL
+ self.mSTRING_LITERAL()
+
+
+
+ elif alt35 == 97:
+ # C.g:1:444: HEX_LITERAL
+ self.mHEX_LITERAL()
+
+
+
+ elif alt35 == 98:
+ # C.g:1:456: DECIMAL_LITERAL
+ self.mDECIMAL_LITERAL()
+
+
+
+ elif alt35 == 99:
+ # C.g:1:472: OCTAL_LITERAL
+ self.mOCTAL_LITERAL()
+
+
+
+ elif alt35 == 100:
+ # C.g:1:486: FLOATING_POINT_LITERAL
+ self.mFLOATING_POINT_LITERAL()
+
+
+
+ elif alt35 == 101:
+ # C.g:1:509: WS
+ self.mWS()
+
+
+
+ elif alt35 == 102:
+ # C.g:1:512: BS
+ self.mBS()
+
+
+
+ elif alt35 == 103:
+ # C.g:1:515: UnicodeVocabulary
+ self.mUnicodeVocabulary()
+
+
+
+ elif alt35 == 104:
+ # C.g:1:533: COMMENT
+ self.mCOMMENT()
+
+
+
+ elif alt35 == 105:
+ # C.g:1:541: LINE_COMMENT
+ self.mLINE_COMMENT()
+
+
+
+ elif alt35 == 106:
+ # C.g:1:554: LINE_COMMAND
+ self.mLINE_COMMAND()
+
+
+
+
+
+
+
+
+ # lookup tables for DFA #25
+
+ DFA25_eot = DFA.unpack(
+ u"\7\uffff\1\10\2\uffff"
+ )
+
+ DFA25_eof = DFA.unpack(
+ u"\12\uffff"
+ )
+
+ DFA25_min = DFA.unpack(
+ u"\2\56\2\uffff\1\53\1\uffff\2\60\2\uffff"
+ )
+
+ DFA25_max = DFA.unpack(
+ u"\1\71\1\146\2\uffff\1\71\1\uffff\1\71\1\146\2\uffff"
+ )
+
+ DFA25_accept = DFA.unpack(
+ u"\2\uffff\1\2\1\1\1\uffff\1\4\2\uffff\2\3"
+ )
+
+ DFA25_special = DFA.unpack(
+ u"\12\uffff"
+ )
+
+
+ DFA25_transition = [
+ DFA.unpack(u"\1\2\1\uffff\12\1"),
+ DFA.unpack(u"\1\3\1\uffff\12\1\12\uffff\1\5\1\4\1\5\35\uffff\1\5"
+ u"\1\4\1\5"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\6\1\uffff\1\6\2\uffff\12\7"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\12\7"),
+ DFA.unpack(u"\12\7\12\uffff\1\11\1\uffff\1\11\35\uffff\1\11\1\uffff"
+ u"\1\11"),
+ DFA.unpack(u""),
+ DFA.unpack(u"")
+ ]
+
+ # class definition for DFA #25
+
+ DFA25 = DFA
+ # lookup tables for DFA #35
+
+ DFA35_eot = DFA.unpack(
+ u"\2\uffff\1\76\1\uffff\1\101\14\76\3\uffff\10\76\4\uffff\1\151\1"
+ u"\153\1\157\1\163\1\167\1\171\1\174\1\uffff\1\177\1\u0082\1\u0085"
+ u"\1\u0087\1\u008a\1\uffff\5\76\1\uffff\2\73\2\u0095\2\uffff\1\73"
+ u"\2\uffff\1\76\4\uffff\16\76\1\u00ad\5\76\1\u00b4\1\76\3\uffff\1"
+ u"\u00b7\10\76\34\uffff\1\u00c1\2\uffff\1\u00c3\10\uffff\5\76\3\uffff"
+ u"\1\u00c9\1\uffff\1\u0095\3\uffff\23\76\1\uffff\1\u00de\1\76\1\u00e0"
+ u"\3\76\1\uffff\2\76\1\uffff\1\76\1\u00e7\6\76\4\uffff\5\76\1\uffff"
+ u"\1\76\1\u00f5\1\76\1\u00f7\6\76\1\u00fe\4\76\1\u0103\1\u0104\2"
+ u"\76\1\u0107\1\uffff\1\u0108\1\uffff\6\76\1\uffff\10\76\1\u0118"
+ u"\1\76\1\u011a\2\76\1\uffff\1\76\1\uffff\5\76\1\u0123\1\uffff\4"
+ u"\76\2\uffff\1\76\1\u0129\2\uffff\1\u012a\3\76\1\u012e\1\76\1\u0130"
+ u"\7\76\1\u0139\1\uffff\1\u013a\1\uffff\1\u013b\1\76\1\u013d\1\u013e"
+ u"\1\u013f\1\u0140\1\u0141\1\u0142\1\uffff\1\76\1\u0144\1\u0145\2"
+ u"\76\2\uffff\1\76\1\u0149\1\76\1\uffff\1\76\1\uffff\5\76\1\u0151"
+ u"\1\u0152\1\76\3\uffff\1\u0154\6\uffff\1\76\2\uffff\2\76\1\u0158"
+ u"\1\uffff\7\76\2\uffff\1\u0160\1\uffff\1\u0161\1\u0162\1\u0163\1"
+ u"\uffff\1\u0164\1\u0165\1\76\1\u0167\3\76\6\uffff\1\u016b\1\uffff"
+ u"\3\76\1\uffff\21\76\1\u0180\2\76\1\uffff\3\76\1\u0186\1\76\1\uffff"
+ u"\11\76\1\u0191\1\uffff"
+ )
+
+ DFA35_eof = DFA.unpack(
+ u"\u0192\uffff"
+ )
+
+ DFA35_min = DFA.unpack(
+ u"\1\3\1\uffff\1\171\1\uffff\1\75\1\154\1\150\1\165\1\145\1\124\1"
+ u"\157\1\141\1\146\1\157\1\154\1\145\1\156\3\uffff\1\116\1\120\1"
+ u"\117\1\116\1\117\1\114\1\106\1\101\4\uffff\1\75\1\56\1\53\1\55"
+ u"\1\52\1\75\1\46\1\uffff\1\75\1\74\3\75\1\uffff\1\137\1\150\1\157"
+ u"\1\162\1\42\1\uffff\2\0\2\56\2\uffff\1\0\2\uffff\1\160\4\uffff"
+ u"\1\163\1\164\1\165\1\151\1\141\1\147\1\157\1\164\1\147\1\101\1"
+ u"\151\1\163\1\156\1\141\1\44\1\164\1\156\1\162\1\157\1\146\1\44"
+ u"\1\151\3\uffff\1\44\2\124\1\116\1\101\1\114\1\117\1\111\1\103\34"
+ u"\uffff\1\75\2\uffff\1\75\10\uffff\1\141\1\163\1\151\1\164\1\145"
+ u"\3\uffff\1\56\1\uffff\1\56\3\uffff\3\145\1\155\2\164\1\165\1\145"
+ u"\1\156\1\162\1\157\1\151\1\165\1\124\1\141\1\144\1\145\1\163\1"
+ u"\162\1\uffff\1\44\1\147\1\44\2\141\1\142\1\uffff\1\151\1\157\1"
+ u"\uffff\1\111\1\44\1\123\1\114\1\101\1\102\1\101\1\113\4\uffff\1"
+ u"\163\1\155\1\154\1\157\1\141\1\uffff\1\144\1\44\1\162\1\44\1\143"
+ u"\1\151\1\143\1\157\1\145\1\164\1\44\1\163\1\162\1\111\1\164\2\44"
+ u"\1\151\1\164\1\44\1\uffff\1\44\1\uffff\1\164\1\165\1\154\1\147"
+ u"\1\156\1\117\1\uffff\1\124\1\111\1\124\1\101\1\102\1\120\1\105"
+ u"\1\155\1\44\1\145\1\44\1\153\1\145\1\uffff\1\156\1\uffff\1\150"
+ u"\1\143\1\164\1\146\1\144\1\44\1\uffff\1\164\1\156\1\103\1\151\2"
+ u"\uffff\1\156\1\44\2\uffff\1\44\1\154\1\145\1\156\1\44\1\116\1\44"
+ u"\1\107\1\111\1\114\1\125\1\117\1\111\1\104\1\44\1\uffff\1\44\1"
+ u"\uffff\1\44\1\146\6\44\1\uffff\1\145\2\44\1\154\1\165\2\uffff\1"
+ u"\164\1\44\1\145\1\uffff\1\101\1\uffff\1\116\1\114\1\137\1\116\1"
+ u"\117\2\44\1\137\3\uffff\1\44\6\uffff\1\162\2\uffff\2\145\1\44\1"
+ u"\uffff\1\144\1\114\2\105\1\122\2\124\2\uffff\1\44\1\uffff\3\44"
+ u"\1\uffff\2\44\1\104\1\44\1\105\1\111\1\123\6\uffff\1\44\1\uffff"
+ u"\2\115\1\105\1\uffff\1\117\1\105\1\122\1\126\1\123\1\126\2\105"
+ u"\1\111\1\137\1\122\1\103\1\111\1\126\1\105\1\106\1\111\1\44\1\137"
+ u"\1\103\1\uffff\1\125\1\105\1\116\1\44\1\122\1\uffff\1\105\1\106"
+ u"\1\105\1\122\1\105\1\116\1\103\1\105\1\104\1\44\1\uffff"
+ )
+
+ DFA35_max = DFA.unpack(
+ u"\1\ufffe\1\uffff\1\171\1\uffff\1\75\1\170\1\167\1\165\1\145\1\124"
+ u"\2\157\1\156\3\157\1\156\3\uffff\1\116\1\125\1\117\1\116\1\117"
+ u"\1\114\1\106\1\101\4\uffff\1\75\1\71\1\75\1\76\3\75\1\uffff\2\75"
+ u"\1\76\1\75\1\174\1\uffff\1\141\1\150\1\157\1\162\1\47\1\uffff\2"
+ u"\ufffe\1\170\1\146\2\uffff\1\ufffe\2\uffff\1\160\4\uffff\1\163"
+ u"\1\164\1\165\1\151\1\162\1\172\1\157\2\164\1\101\1\154\1\163\1"
+ u"\156\1\141\1\172\1\164\1\156\1\162\1\157\1\146\1\172\1\163\3\uffff"
+ u"\1\172\2\124\1\116\1\101\1\114\1\117\1\111\1\103\34\uffff\1\75"
+ u"\2\uffff\1\75\10\uffff\1\141\1\163\1\151\1\164\1\145\3\uffff\1"
+ u"\146\1\uffff\1\146\3\uffff\3\145\1\155\2\164\1\165\1\145\1\156"
+ u"\1\162\1\157\1\151\1\165\1\124\1\141\1\144\1\145\1\164\1\162\1"
+ u"\uffff\1\172\1\147\1\172\2\141\1\142\1\uffff\1\151\1\157\1\uffff"
+ u"\1\111\1\172\1\123\1\114\1\101\1\102\1\137\1\113\4\uffff\1\163"
+ u"\1\155\1\154\1\157\1\141\1\uffff\1\144\1\172\1\162\1\172\1\143"
+ u"\1\151\1\143\1\157\1\145\1\164\1\172\1\163\1\162\1\111\1\164\2"
+ u"\172\1\151\1\164\1\172\1\uffff\1\172\1\uffff\1\164\1\165\1\154"
+ u"\1\147\1\156\1\117\1\uffff\1\124\1\111\1\124\1\101\1\122\1\120"
+ u"\1\105\1\155\1\172\1\145\1\172\1\153\1\145\1\uffff\1\156\1\uffff"
+ u"\1\150\1\143\1\164\1\146\1\144\1\172\1\uffff\1\164\1\156\1\103"
+ u"\1\151\2\uffff\1\156\1\172\2\uffff\1\172\1\154\1\145\1\156\1\172"
+ u"\1\116\1\172\1\107\1\111\1\114\1\125\1\117\1\111\1\104\1\172\1"
+ u"\uffff\1\172\1\uffff\1\172\1\146\6\172\1\uffff\1\145\2\172\1\154"
+ u"\1\165\2\uffff\1\164\1\172\1\145\1\uffff\1\101\1\uffff\1\116\1"
+ u"\114\1\137\1\116\1\117\2\172\1\137\3\uffff\1\172\6\uffff\1\162"
+ u"\2\uffff\2\145\1\172\1\uffff\1\144\1\114\2\105\1\122\2\124\2\uffff"
+ u"\1\172\1\uffff\3\172\1\uffff\2\172\1\104\1\172\1\105\1\111\1\123"
+ u"\6\uffff\1\172\1\uffff\2\115\1\105\1\uffff\1\117\1\105\1\122\1"
+ u"\126\1\123\1\126\2\105\1\111\1\137\1\122\1\103\1\111\1\126\1\105"
+ u"\1\106\1\111\1\172\1\137\1\103\1\uffff\1\125\1\105\1\116\1\172"
+ u"\1\122\1\uffff\1\105\1\106\1\105\1\122\1\105\1\116\1\103\1\105"
+ u"\1\104\1\172\1\uffff"
+ )
+
+ DFA35_accept = DFA.unpack(
+ u"\1\uffff\1\1\1\uffff\1\3\15\uffff\1\23\1\24\1\27\10\uffff\1\46"
+ u"\1\47\1\50\1\51\7\uffff\1\66\5\uffff\1\102\5\uffff\1\136\4\uffff"
+ u"\1\145\1\146\1\uffff\1\147\1\1\1\uffff\1\136\1\3\1\107\1\4\26\uffff"
+ u"\1\23\1\24\1\27\11\uffff\1\46\1\47\1\50\1\51\1\70\1\52\1\53\1\63"
+ u"\1\144\1\73\1\60\1\54\1\74\1\64\1\61\1\55\1\150\1\151\1\71\1\56"
+ u"\1\72\1\57\1\77\1\104\1\65\1\66\1\110\1\67\1\uffff\1\113\1\111"
+ u"\1\uffff\1\114\1\112\1\100\1\106\1\103\1\101\1\105\1\102\5\uffff"
+ u"\1\140\1\137\1\141\1\uffff\1\142\1\uffff\1\145\1\146\1\152\23\uffff"
+ u"\1\124\6\uffff\1\130\2\uffff\1\33\10\uffff\1\75\1\115\1\76\1\116"
+ u"\5\uffff\1\143\24\uffff\1\15\1\uffff\1\131\6\uffff\1\34\15\uffff"
+ u"\1\125\1\uffff\1\30\6\uffff\1\7\4\uffff\1\12\1\122\2\uffff\1\13"
+ u"\1\16\17\uffff\1\120\1\uffff\1\132\10\uffff\1\14\5\uffff\1\31\1"
+ u"\17\3\uffff\1\26\1\uffff\1\36\10\uffff\1\121\1\127\1\134\1\uffff"
+ u"\1\5\1\126\1\6\1\25\1\62\1\21\1\uffff\1\135\1\11\3\uffff\1\20\7"
+ u"\uffff\1\42\1\45\1\uffff\1\2\3\uffff\1\123\7\uffff\1\117\1\10\1"
+ u"\32\1\133\1\22\1\35\1\uffff\1\40\3\uffff\1\37\24\uffff\1\43\5\uffff"
+ u"\1\44\12\uffff\1\41"
+ )
+
+ DFA35_special = DFA.unpack(
+ u"\u0192\uffff"
+ )
+
+
+ DFA35_transition = [
+ DFA.unpack(u"\6\73\2\70\1\73\2\70\22\73\1\70\1\50\1\65\1\72\1\63"
+ u"\1\45\1\46\1\64\1\34\1\35\1\40\1\42\1\3\1\43\1\41\1\44\1\66\11"
+ u"\67\1\23\1\1\1\51\1\4\1\52\1\55\1\73\2\63\1\26\1\63\1\32\1\63\1"
+ u"\31\1\63\1\24\2\63\1\62\2\63\1\25\1\33\2\63\1\11\1\63\1\27\1\30"
+ u"\4\63\1\36\1\71\1\37\1\53\1\56\1\73\1\7\1\61\1\13\1\17\1\5\1\16"
+ u"\1\60\1\63\1\14\2\63\1\15\5\63\1\10\1\6\1\2\1\20\1\12\1\57\3\63"
+ u"\1\21\1\54\1\22\1\47\uff80\73"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\75"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\100"),
+ DFA.unpack(u"\1\102\1\uffff\1\104\11\uffff\1\103"),
+ DFA.unpack(u"\1\110\1\107\12\uffff\1\106\2\uffff\1\105"),
+ DFA.unpack(u"\1\111"),
+ DFA.unpack(u"\1\112"),
+ DFA.unpack(u"\1\113"),
+ DFA.unpack(u"\1\114"),
+ DFA.unpack(u"\1\115\6\uffff\1\117\6\uffff\1\116"),
+ DFA.unpack(u"\1\120\7\uffff\1\121"),
+ DFA.unpack(u"\1\122"),
+ DFA.unpack(u"\1\124\2\uffff\1\123"),
+ DFA.unpack(u"\1\125\11\uffff\1\126"),
+ DFA.unpack(u"\1\127"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\133"),
+ DFA.unpack(u"\1\134\4\uffff\1\135"),
+ DFA.unpack(u"\1\136"),
+ DFA.unpack(u"\1\137"),
+ DFA.unpack(u"\1\140"),
+ DFA.unpack(u"\1\141"),
+ DFA.unpack(u"\1\142"),
+ DFA.unpack(u"\1\143"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\150"),
+ DFA.unpack(u"\1\152\1\uffff\12\154"),
+ DFA.unpack(u"\1\156\21\uffff\1\155"),
+ DFA.unpack(u"\1\162\17\uffff\1\160\1\161"),
+ DFA.unpack(u"\1\164\4\uffff\1\165\15\uffff\1\166"),
+ DFA.unpack(u"\1\170"),
+ DFA.unpack(u"\1\173\26\uffff\1\172"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\176"),
+ DFA.unpack(u"\1\u0080\1\u0081"),
+ DFA.unpack(u"\1\u0084\1\u0083"),
+ DFA.unpack(u"\1\u0086"),
+ DFA.unpack(u"\1\u0089\76\uffff\1\u0088"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u008c\1\uffff\1\u008d"),
+ DFA.unpack(u"\1\u008e"),
+ DFA.unpack(u"\1\u008f"),
+ DFA.unpack(u"\1\u0090"),
+ DFA.unpack(u"\1\u0091\4\uffff\1\u0092"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\47\u0092\1\uffff\uffd7\u0092"),
+ DFA.unpack(u"\uffff\u0091"),
+ DFA.unpack(u"\1\154\1\uffff\10\u0094\2\154\12\uffff\3\154\21\uffff"
+ u"\1\u0093\13\uffff\3\154\21\uffff\1\u0093"),
+ DFA.unpack(u"\1\154\1\uffff\12\u0096\12\uffff\3\154\35\uffff\3\154"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\uffff\u0099"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u009a"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u009b"),
+ DFA.unpack(u"\1\u009c"),
+ DFA.unpack(u"\1\u009d"),
+ DFA.unpack(u"\1\u009e"),
+ DFA.unpack(u"\1\u009f\20\uffff\1\u00a0"),
+ DFA.unpack(u"\1\u00a2\22\uffff\1\u00a1"),
+ DFA.unpack(u"\1\u00a3"),
+ DFA.unpack(u"\1\u00a4"),
+ DFA.unpack(u"\1\u00a5\14\uffff\1\u00a6"),
+ DFA.unpack(u"\1\u00a7"),
+ DFA.unpack(u"\1\u00a9\2\uffff\1\u00a8"),
+ DFA.unpack(u"\1\u00aa"),
+ DFA.unpack(u"\1\u00ab"),
+ DFA.unpack(u"\1\u00ac"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00ae"),
+ DFA.unpack(u"\1\u00af"),
+ DFA.unpack(u"\1\u00b0"),
+ DFA.unpack(u"\1\u00b1"),
+ DFA.unpack(u"\1\u00b2"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\24\76\1\u00b3\5\76"),
+ DFA.unpack(u"\1\u00b6\11\uffff\1\u00b5"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00b8"),
+ DFA.unpack(u"\1\u00b9"),
+ DFA.unpack(u"\1\u00ba"),
+ DFA.unpack(u"\1\u00bb"),
+ DFA.unpack(u"\1\u00bc"),
+ DFA.unpack(u"\1\u00bd"),
+ DFA.unpack(u"\1\u00be"),
+ DFA.unpack(u"\1\u00bf"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00c0"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00c2"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00c4"),
+ DFA.unpack(u"\1\u00c5"),
+ DFA.unpack(u"\1\u00c6"),
+ DFA.unpack(u"\1\u00c7"),
+ DFA.unpack(u"\1\u00c8"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\154\1\uffff\10\u0094\2\154\12\uffff\3\154\35\uffff"
+ u"\3\154"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\154\1\uffff\12\u0096\12\uffff\3\154\35\uffff\3\154"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00ca"),
+ DFA.unpack(u"\1\u00cb"),
+ DFA.unpack(u"\1\u00cc"),
+ DFA.unpack(u"\1\u00cd"),
+ DFA.unpack(u"\1\u00ce"),
+ DFA.unpack(u"\1\u00cf"),
+ DFA.unpack(u"\1\u00d0"),
+ DFA.unpack(u"\1\u00d1"),
+ DFA.unpack(u"\1\u00d2"),
+ DFA.unpack(u"\1\u00d3"),
+ DFA.unpack(u"\1\u00d4"),
+ DFA.unpack(u"\1\u00d5"),
+ DFA.unpack(u"\1\u00d6"),
+ DFA.unpack(u"\1\u00d7"),
+ DFA.unpack(u"\1\u00d8"),
+ DFA.unpack(u"\1\u00d9"),
+ DFA.unpack(u"\1\u00da"),
+ DFA.unpack(u"\1\u00dc\1\u00db"),
+ DFA.unpack(u"\1\u00dd"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00df"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00e1"),
+ DFA.unpack(u"\1\u00e2"),
+ DFA.unpack(u"\1\u00e3"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00e4"),
+ DFA.unpack(u"\1\u00e5"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00e6"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00e8"),
+ DFA.unpack(u"\1\u00e9"),
+ DFA.unpack(u"\1\u00ea"),
+ DFA.unpack(u"\1\u00eb"),
+ DFA.unpack(u"\1\u00ed\35\uffff\1\u00ec"),
+ DFA.unpack(u"\1\u00ee"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00ef"),
+ DFA.unpack(u"\1\u00f0"),
+ DFA.unpack(u"\1\u00f1"),
+ DFA.unpack(u"\1\u00f2"),
+ DFA.unpack(u"\1\u00f3"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u00f4"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00f6"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00f8"),
+ DFA.unpack(u"\1\u00f9"),
+ DFA.unpack(u"\1\u00fa"),
+ DFA.unpack(u"\1\u00fb"),
+ DFA.unpack(u"\1\u00fc"),
+ DFA.unpack(u"\1\u00fd"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u00ff"),
+ DFA.unpack(u"\1\u0100"),
+ DFA.unpack(u"\1\u0101"),
+ DFA.unpack(u"\1\u0102"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0105"),
+ DFA.unpack(u"\1\u0106"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0109"),
+ DFA.unpack(u"\1\u010a"),
+ DFA.unpack(u"\1\u010b"),
+ DFA.unpack(u"\1\u010c"),
+ DFA.unpack(u"\1\u010d"),
+ DFA.unpack(u"\1\u010e"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u010f"),
+ DFA.unpack(u"\1\u0110"),
+ DFA.unpack(u"\1\u0111"),
+ DFA.unpack(u"\1\u0112"),
+ DFA.unpack(u"\1\u0114\17\uffff\1\u0113"),
+ DFA.unpack(u"\1\u0115"),
+ DFA.unpack(u"\1\u0116"),
+ DFA.unpack(u"\1\u0117"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0119"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u011b"),
+ DFA.unpack(u"\1\u011c"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u011d"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u011e"),
+ DFA.unpack(u"\1\u011f"),
+ DFA.unpack(u"\1\u0120"),
+ DFA.unpack(u"\1\u0121"),
+ DFA.unpack(u"\1\u0122"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0124"),
+ DFA.unpack(u"\1\u0125"),
+ DFA.unpack(u"\1\u0126"),
+ DFA.unpack(u"\1\u0127"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0128"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u012b"),
+ DFA.unpack(u"\1\u012c"),
+ DFA.unpack(u"\1\u012d"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u012f"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0131"),
+ DFA.unpack(u"\1\u0132"),
+ DFA.unpack(u"\1\u0133"),
+ DFA.unpack(u"\1\u0134"),
+ DFA.unpack(u"\1\u0135"),
+ DFA.unpack(u"\1\u0136"),
+ DFA.unpack(u"\1\u0137"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\u0138\1"
+ u"\uffff\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u013c"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0143"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0146"),
+ DFA.unpack(u"\1\u0147"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0148"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u014a"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u014b"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u014c"),
+ DFA.unpack(u"\1\u014d"),
+ DFA.unpack(u"\1\u014e"),
+ DFA.unpack(u"\1\u014f"),
+ DFA.unpack(u"\1\u0150"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0153"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0155"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0156"),
+ DFA.unpack(u"\1\u0157"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0159"),
+ DFA.unpack(u"\1\u015a"),
+ DFA.unpack(u"\1\u015b"),
+ DFA.unpack(u"\1\u015c"),
+ DFA.unpack(u"\1\u015d"),
+ DFA.unpack(u"\1\u015e"),
+ DFA.unpack(u"\1\u015f"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0166"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0168"),
+ DFA.unpack(u"\1\u0169"),
+ DFA.unpack(u"\1\u016a"),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u016c"),
+ DFA.unpack(u"\1\u016d"),
+ DFA.unpack(u"\1\u016e"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u016f"),
+ DFA.unpack(u"\1\u0170"),
+ DFA.unpack(u"\1\u0171"),
+ DFA.unpack(u"\1\u0172"),
+ DFA.unpack(u"\1\u0173"),
+ DFA.unpack(u"\1\u0174"),
+ DFA.unpack(u"\1\u0175"),
+ DFA.unpack(u"\1\u0176"),
+ DFA.unpack(u"\1\u0177"),
+ DFA.unpack(u"\1\u0178"),
+ DFA.unpack(u"\1\u0179"),
+ DFA.unpack(u"\1\u017a"),
+ DFA.unpack(u"\1\u017b"),
+ DFA.unpack(u"\1\u017c"),
+ DFA.unpack(u"\1\u017d"),
+ DFA.unpack(u"\1\u017e"),
+ DFA.unpack(u"\1\u017f"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0181"),
+ DFA.unpack(u"\1\u0182"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0183"),
+ DFA.unpack(u"\1\u0184"),
+ DFA.unpack(u"\1\u0185"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"\1\u0187"),
+ DFA.unpack(u""),
+ DFA.unpack(u"\1\u0188"),
+ DFA.unpack(u"\1\u0189"),
+ DFA.unpack(u"\1\u018a"),
+ DFA.unpack(u"\1\u018b"),
+ DFA.unpack(u"\1\u018c"),
+ DFA.unpack(u"\1\u018d"),
+ DFA.unpack(u"\1\u018e"),
+ DFA.unpack(u"\1\u018f"),
+ DFA.unpack(u"\1\u0190"),
+ DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff"
+ u"\32\76"),
+ DFA.unpack(u"")
+ ]
+
+ # class definition for DFA #35
+
+ DFA35 = DFA
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/CParser3/CParser.py b/roms/edk2/BaseTools/Source/Python/Eot/CParser3/CParser.py
new file mode 100644
index 000000000..42bb4d2a1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/CParser3/CParser.py
@@ -0,0 +1,18833 @@
+# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53
+
+from __future__ import print_function
+from __future__ import absolute_import
+from antlr3 import *
+from antlr3.compat import set, frozenset
+
+## @file
+# The file defines the parser for C source files.
+#
+# THIS FILE IS AUTO-GENERATED. PLEASE DO NOT MODIFY THIS FILE.
+# This file is generated by running:
+# java org.antlr.Tool C.g
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+from . import CodeFragment
+from . import FileProfile
+
+
+
+# for convenience in actions
+HIDDEN = BaseRecognizer.HIDDEN
+
+# token types
+BS=20
+LINE_COMMENT=23
+FloatTypeSuffix=16
+IntegerTypeSuffix=14
+LETTER=11
+OCTAL_LITERAL=6
+CHARACTER_LITERAL=8
+Exponent=15
+EOF=-1
+HexDigit=13
+STRING_LITERAL=9
+WS=19
+FLOATING_POINT_LITERAL=10
+IDENTIFIER=4
+UnicodeEscape=18
+LINE_COMMAND=24
+UnicodeVocabulary=21
+HEX_LITERAL=5
+COMMENT=22
+DECIMAL_LITERAL=7
+EscapeSequence=12
+OctalEscape=17
+
+# token names
+tokenNames = [
+ "<invalid>", "<EOR>", "<DOWN>", "<UP>",
+ "IDENTIFIER", "HEX_LITERAL", "OCTAL_LITERAL", "DECIMAL_LITERAL", "CHARACTER_LITERAL",
+ "STRING_LITERAL", "FLOATING_POINT_LITERAL", "LETTER", "EscapeSequence",
+ "HexDigit", "IntegerTypeSuffix", "Exponent", "FloatTypeSuffix", "OctalEscape",
+ "UnicodeEscape", "WS", "BS", "UnicodeVocabulary", "COMMENT", "LINE_COMMENT",
+ "LINE_COMMAND", "';'", "'typedef'", "','", "'='", "'extern'", "'static'",
+ "'auto'", "'register'", "'STATIC'", "'void'", "'char'", "'short'", "'int'",
+ "'long'", "'float'", "'double'", "'signed'", "'unsigned'", "'{'", "'}'",
+ "'struct'", "'union'", "':'", "'enum'", "'const'", "'volatile'", "'IN'",
+ "'OUT'", "'OPTIONAL'", "'CONST'", "'UNALIGNED'", "'VOLATILE'", "'GLOBAL_REMOVE_IF_UNREFERENCED'",
+ "'EFIAPI'", "'EFI_BOOTSERVICE'", "'EFI_RUNTIMESERVICE'", "'PACKED'",
+ "'('", "')'", "'['", "']'", "'*'", "'...'", "'+'", "'-'", "'/'", "'%'",
+ "'++'", "'--'", "'sizeof'", "'.'", "'->'", "'&'", "'~'", "'!'", "'*='",
+ "'/='", "'%='", "'+='", "'-='", "'<<='", "'>>='", "'&='", "'^='", "'|='",
+ "'?'", "'||'", "'&&'", "'|'", "'^'", "'=='", "'!='", "'<'", "'>'", "'<='",
+ "'>='", "'<<'", "'>>'", "'__asm__'", "'_asm'", "'__asm'", "'case'",
+ "'default'", "'if'", "'else'", "'switch'", "'while'", "'do'", "'for'",
+ "'goto'", "'continue'", "'break'", "'return'"
+]
+
+
+class function_definition_scope(object):
+ def __init__(self):
+ self.ModifierText = None
+ self.DeclText = None
+ self.LBLine = None
+ self.LBOffset = None
+ self.DeclLine = None
+ self.DeclOffset = None
+class postfix_expression_scope(object):
+ def __init__(self):
+ self.FuncCallText = None
+
+
+class CParser(Parser):
+ grammarFileName = "C.g"
+ tokenNames = tokenNames
+
+ def __init__(self, input):
+ Parser.__init__(self, input)
+ self.ruleMemo = {}
+
+ self.function_definition_stack = []
+ self.postfix_expression_stack = []
+
+ def printTokenInfo(self, line, offset, tokenText):
+ print(str(line)+ ',' + str(offset) + ':' + str(tokenText))
+
+ def StorePredicateExpression(self, StartLine, StartOffset, EndLine, EndOffset, Text):
+ PredExp = CodeFragment.PredicateExpression(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.PredicateExpressionList.append(PredExp)
+
+ def StoreEnumerationDefinition(self, StartLine, StartOffset, EndLine, EndOffset, Text):
+ EnumDef = CodeFragment.EnumerationDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.EnumerationDefinitionList.append(EnumDef)
+
+ def StoreStructUnionDefinition(self, StartLine, StartOffset, EndLine, EndOffset, Text):
+ SUDef = CodeFragment.StructUnionDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.StructUnionDefinitionList.append(SUDef)
+
+ def StoreTypedefDefinition(self, StartLine, StartOffset, EndLine, EndOffset, FromText, ToText):
+ Tdef = CodeFragment.TypedefDefinition(FromText, ToText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.TypedefDefinitionList.append(Tdef)
+
+ def StoreFunctionDefinition(self, StartLine, StartOffset, EndLine, EndOffset, ModifierText, DeclText, LeftBraceLine, LeftBraceOffset, DeclLine, DeclOffset):
+ FuncDef = CodeFragment.FunctionDefinition(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset), (LeftBraceLine, LeftBraceOffset), (DeclLine, DeclOffset))
+ FileProfile.FunctionDefinitionList.append(FuncDef)
+
+ def StoreVariableDeclaration(self, StartLine, StartOffset, EndLine, EndOffset, ModifierText, DeclText):
+ VarDecl = CodeFragment.VariableDeclaration(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.VariableDeclarationList.append(VarDecl)
+
+ def StoreFunctionCalling(self, StartLine, StartOffset, EndLine, EndOffset, FuncName, ParamList):
+ FuncCall = CodeFragment.FunctionCalling(FuncName, ParamList, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.FunctionCallingList.append(FuncCall)
+
+
+
+
+ # $ANTLR start translation_unit
+ # C.g:102:1: translation_unit : ( external_declaration )* ;
+ def translation_unit(self, ):
+
+ translation_unit_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 1):
+ return
+
+ # C.g:103:2: ( ( external_declaration )* )
+ # C.g:103:4: ( external_declaration )*
+ # C.g:103:4: ( external_declaration )*
+ while True: #loop1
+ alt1 = 2
+ LA1_0 = self.input.LA(1)
+
+ if (LA1_0 == IDENTIFIER or LA1_0 == 26 or (29 <= LA1_0 <= 42) or (45 <= LA1_0 <= 46) or (48 <= LA1_0 <= 62) or LA1_0 == 66) :
+ alt1 = 1
+
+
+ if alt1 == 1:
+ # C.g:0:0: external_declaration
+ self.following.append(self.FOLLOW_external_declaration_in_translation_unit74)
+ self.external_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop1
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 1, translation_unit_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end translation_unit
+
+
+ # $ANTLR start external_declaration
+ # C.g:114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );
+ def external_declaration(self, ):
+
+ external_declaration_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 2):
+ return
+
+ # C.g:119:2: ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? )
+ alt3 = 3
+ LA3_0 = self.input.LA(1)
+
+ if ((29 <= LA3_0 <= 33)) :
+ LA3_1 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 1, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 34) :
+ LA3_2 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 2, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 35) :
+ LA3_3 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 3, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 36) :
+ LA3_4 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 4, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 37) :
+ LA3_5 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 5, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 38) :
+ LA3_6 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 6, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 39) :
+ LA3_7 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 7, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 40) :
+ LA3_8 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 8, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 41) :
+ LA3_9 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 9, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 42) :
+ LA3_10 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 10, self.input)
+
+ raise nvae
+
+ elif ((45 <= LA3_0 <= 46)) :
+ LA3_11 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 11, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 48) :
+ LA3_12 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 12, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == IDENTIFIER) :
+ LA3_13 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ elif (True) :
+ alt3 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 13, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 58) :
+ LA3_14 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 14, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 66) and (self.synpred4()):
+ alt3 = 1
+ elif (LA3_0 == 59) :
+ LA3_16 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 16, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 60) :
+ LA3_17 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 17, self.input)
+
+ raise nvae
+
+ elif ((49 <= LA3_0 <= 57) or LA3_0 == 61) :
+ LA3_18 = self.input.LA(2)
+
+ if (self.synpred4()) :
+ alt3 = 1
+ elif (self.synpred5()) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 18, self.input)
+
+ raise nvae
+
+ elif (LA3_0 == 62) and (self.synpred4()):
+ alt3 = 1
+ elif (LA3_0 == 26) :
+ alt3 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 0, self.input)
+
+ raise nvae
+
+ if alt3 == 1:
+ # C.g:119:4: ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition
+ self.following.append(self.FOLLOW_function_definition_in_external_declaration113)
+ self.function_definition()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt3 == 2:
+ # C.g:120:4: declaration
+ self.following.append(self.FOLLOW_declaration_in_external_declaration118)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt3 == 3:
+ # C.g:121:4: macro_statement ( ';' )?
+ self.following.append(self.FOLLOW_macro_statement_in_external_declaration123)
+ self.macro_statement()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:121:20: ( ';' )?
+ alt2 = 2
+ LA2_0 = self.input.LA(1)
+
+ if (LA2_0 == 25) :
+ alt2 = 1
+ if alt2 == 1:
+ # C.g:121:21: ';'
+ self.match(self.input, 25, self.FOLLOW_25_in_external_declaration126)
+ if self.failed:
+ return
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 2, external_declaration_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end external_declaration
+
+ class function_definition_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start function_definition
+ # C.g:126:1: function_definition : (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) ;
+ def function_definition(self, ):
+ self.function_definition_stack.append(function_definition_scope())
+ retval = self.function_definition_return()
+ retval.start = self.input.LT(1)
+ function_definition_StartIndex = self.input.index()
+ d = None
+
+ a = None
+
+ b = None
+
+ declarator1 = None
+
+
+
+ self.function_definition_stack[-1].ModifierText = ''
+ self.function_definition_stack[-1].DeclText = ''
+ self.function_definition_stack[-1].LBLine = 0
+ self.function_definition_stack[-1].LBOffset = 0
+ self.function_definition_stack[-1].DeclLine = 0
+ self.function_definition_stack[-1].DeclOffset = 0
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 3):
+ return retval
+
+ # C.g:146:2: ( (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) )
+ # C.g:146:4: (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement )
+ # C.g:146:5: (d= declaration_specifiers )?
+ alt4 = 2
+ LA4 = self.input.LA(1)
+ if LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33 or LA4 == 34 or LA4 == 35 or LA4 == 36 or LA4 == 37 or LA4 == 38 or LA4 == 39 or LA4 == 40 or LA4 == 41 or LA4 == 42 or LA4 == 45 or LA4 == 46 or LA4 == 48 or LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61:
+ alt4 = 1
+ elif LA4 == IDENTIFIER:
+ LA4 = self.input.LA(2)
+ if LA4 == 66:
+ alt4 = 1
+ elif LA4 == 58:
+ LA4_21 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 59:
+ LA4_22 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 60:
+ LA4_23 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == IDENTIFIER:
+ LA4_24 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 62:
+ LA4_25 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33:
+ LA4_26 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 34:
+ LA4_27 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 35:
+ LA4_28 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 36:
+ LA4_29 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 37:
+ LA4_30 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 38:
+ LA4_31 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 39:
+ LA4_32 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 40:
+ LA4_33 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 41:
+ LA4_34 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 42:
+ LA4_35 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 45 or LA4 == 46:
+ LA4_36 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 48:
+ LA4_37 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61:
+ LA4_38 = self.input.LA(3)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 58:
+ LA4_14 = self.input.LA(2)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 59:
+ LA4_16 = self.input.LA(2)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ elif LA4 == 60:
+ LA4_17 = self.input.LA(2)
+
+ if (self.synpred7()) :
+ alt4 = 1
+ if alt4 == 1:
+ # C.g:0:0: d= declaration_specifiers
+ self.following.append(self.FOLLOW_declaration_specifiers_in_function_definition157)
+ d = self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+
+ self.following.append(self.FOLLOW_declarator_in_function_definition160)
+ declarator1 = self.declarator()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:147:3: ( ( declaration )+ a= compound_statement | b= compound_statement )
+ alt6 = 2
+ LA6_0 = self.input.LA(1)
+
+ if (LA6_0 == IDENTIFIER or LA6_0 == 26 or (29 <= LA6_0 <= 42) or (45 <= LA6_0 <= 46) or (48 <= LA6_0 <= 61)) :
+ alt6 = 1
+ elif (LA6_0 == 43) :
+ alt6 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("147:3: ( ( declaration )+ a= compound_statement | b= compound_statement )", 6, 0, self.input)
+
+ raise nvae
+
+ if alt6 == 1:
+ # C.g:147:5: ( declaration )+ a= compound_statement
+ # C.g:147:5: ( declaration )+
+ cnt5 = 0
+ while True: #loop5
+ alt5 = 2
+ LA5_0 = self.input.LA(1)
+
+ if (LA5_0 == IDENTIFIER or LA5_0 == 26 or (29 <= LA5_0 <= 42) or (45 <= LA5_0 <= 46) or (48 <= LA5_0 <= 61)) :
+ alt5 = 1
+
+
+ if alt5 == 1:
+ # C.g:0:0: declaration
+ self.following.append(self.FOLLOW_declaration_in_function_definition166)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ else:
+ if cnt5 >= 1:
+ break #loop5
+
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ eee = EarlyExitException(5, self.input)
+ raise eee
+
+ cnt5 += 1
+
+
+ self.following.append(self.FOLLOW_compound_statement_in_function_definition171)
+ a = self.compound_statement()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ elif alt6 == 2:
+ # C.g:148:5: b= compound_statement
+ self.following.append(self.FOLLOW_compound_statement_in_function_definition180)
+ b = self.compound_statement()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+
+ if self.backtracking == 0:
+
+ if d is not None:
+ self.function_definition_stack[-1].ModifierText = self.input.toString(d.start, d.stop)
+ else:
+ self.function_definition_stack[-1].ModifierText = ''
+ self.function_definition_stack[-1].DeclText = self.input.toString(declarator1.start, declarator1.stop)
+ self.function_definition_stack[-1].DeclLine = declarator1.start.line
+ self.function_definition_stack[-1].DeclOffset = declarator1.start.charPositionInLine
+ if a is not None:
+ self.function_definition_stack[-1].LBLine = a.start.line
+ self.function_definition_stack[-1].LBOffset = a.start.charPositionInLine
+ else:
+ self.function_definition_stack[-1].LBLine = b.start.line
+ self.function_definition_stack[-1].LBOffset = b.start.charPositionInLine
+
+
+
+
+
+ retval.stop = self.input.LT(-1)
+
+ if self.backtracking == 0:
+
+ self.StoreFunctionDefinition(retval.start.line, retval.start.charPositionInLine, retval.stop.line, retval.stop.charPositionInLine, self.function_definition_stack[-1].ModifierText, self.function_definition_stack[-1].DeclText, self.function_definition_stack[-1].LBLine, self.function_definition_stack[-1].LBOffset, self.function_definition_stack[-1].DeclLine, self.function_definition_stack[-1].DeclOffset)
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 3, function_definition_StartIndex)
+
+ self.function_definition_stack.pop()
+ pass
+
+ return retval
+
+ # $ANTLR end function_definition
+
+
+ # $ANTLR start declaration
+ # C.g:166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' );
+ def declaration(self, ):
+
+ declaration_StartIndex = self.input.index()
+ a = None
+ d = None
+ e = None
+ b = None
+
+ c = None
+
+ s = None
+
+ t = None
+
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 4):
+ return
+
+ # C.g:167:2: (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' )
+ alt9 = 2
+ LA9_0 = self.input.LA(1)
+
+ if (LA9_0 == 26) :
+ alt9 = 1
+ elif (LA9_0 == IDENTIFIER or (29 <= LA9_0 <= 42) or (45 <= LA9_0 <= 46) or (48 <= LA9_0 <= 61)) :
+ alt9 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' );", 9, 0, self.input)
+
+ raise nvae
+
+ if alt9 == 1:
+ # C.g:167:4: a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';'
+ a = self.input.LT(1)
+ self.match(self.input, 26, self.FOLLOW_26_in_declaration203)
+ if self.failed:
+ return
+ # C.g:167:17: (b= declaration_specifiers )?
+ alt7 = 2
+ LA7 = self.input.LA(1)
+ if LA7 == 29 or LA7 == 30 or LA7 == 31 or LA7 == 32 or LA7 == 33 or LA7 == 34 or LA7 == 35 or LA7 == 36 or LA7 == 37 or LA7 == 38 or LA7 == 39 or LA7 == 40 or LA7 == 41 or LA7 == 42 or LA7 == 45 or LA7 == 46 or LA7 == 48 or LA7 == 49 or LA7 == 50 or LA7 == 51 or LA7 == 52 or LA7 == 53 or LA7 == 54 or LA7 == 55 or LA7 == 56 or LA7 == 57 or LA7 == 61:
+ alt7 = 1
+ elif LA7 == IDENTIFIER:
+ LA7_13 = self.input.LA(2)
+
+ if (LA7_13 == 62) :
+ LA7_21 = self.input.LA(3)
+
+ if (self.synpred10()) :
+ alt7 = 1
+ elif (LA7_13 == IDENTIFIER or (29 <= LA7_13 <= 42) or (45 <= LA7_13 <= 46) or (48 <= LA7_13 <= 61) or LA7_13 == 66) :
+ alt7 = 1
+ elif LA7 == 58:
+ LA7_14 = self.input.LA(2)
+
+ if (self.synpred10()) :
+ alt7 = 1
+ elif LA7 == 59:
+ LA7_16 = self.input.LA(2)
+
+ if (self.synpred10()) :
+ alt7 = 1
+ elif LA7 == 60:
+ LA7_17 = self.input.LA(2)
+
+ if (self.synpred10()) :
+ alt7 = 1
+ if alt7 == 1:
+ # C.g:0:0: b= declaration_specifiers
+ self.following.append(self.FOLLOW_declaration_specifiers_in_declaration207)
+ b = self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ self.following.append(self.FOLLOW_init_declarator_list_in_declaration216)
+ c = self.init_declarator_list()
+ self.following.pop()
+ if self.failed:
+ return
+ d = self.input.LT(1)
+ self.match(self.input, 25, self.FOLLOW_25_in_declaration220)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+
+ if b is not None:
+ self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, self.input.toString(b.start, b.stop), self.input.toString(c.start, c.stop))
+ else:
+ self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, '', self.input.toString(c.start, c.stop))
+
+
+
+
+ elif alt9 == 2:
+ # C.g:175:4: s= declaration_specifiers (t= init_declarator_list )? e= ';'
+ self.following.append(self.FOLLOW_declaration_specifiers_in_declaration234)
+ s = self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:175:30: (t= init_declarator_list )?
+ alt8 = 2
+ LA8_0 = self.input.LA(1)
+
+ if (LA8_0 == IDENTIFIER or (58 <= LA8_0 <= 60) or LA8_0 == 62 or LA8_0 == 66) :
+ alt8 = 1
+ if alt8 == 1:
+ # C.g:0:0: t= init_declarator_list
+ self.following.append(self.FOLLOW_init_declarator_list_in_declaration238)
+ t = self.init_declarator_list()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ e = self.input.LT(1)
+ self.match(self.input, 25, self.FOLLOW_25_in_declaration243)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+
+ if t is not None:
+ self.StoreVariableDeclaration(s.start.line, s.start.charPositionInLine, t.start.line, t.start.charPositionInLine, self.input.toString(s.start, s.stop), self.input.toString(t.start, t.stop))
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 4, declaration_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end declaration
+
+ class declaration_specifiers_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start declaration_specifiers
+ # C.g:182:1: declaration_specifiers : ( storage_class_specifier | type_specifier | type_qualifier )+ ;
+ def declaration_specifiers(self, ):
+
+ retval = self.declaration_specifiers_return()
+ retval.start = self.input.LT(1)
+ declaration_specifiers_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 5):
+ return retval
+
+ # C.g:183:2: ( ( storage_class_specifier | type_specifier | type_qualifier )+ )
+ # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+
+ # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+
+ cnt10 = 0
+ while True: #loop10
+ alt10 = 4
+ LA10 = self.input.LA(1)
+ if LA10 == 58:
+ LA10_2 = self.input.LA(2)
+
+ if (self.synpred15()) :
+ alt10 = 3
+
+
+ elif LA10 == 59:
+ LA10_3 = self.input.LA(2)
+
+ if (self.synpred15()) :
+ alt10 = 3
+
+
+ elif LA10 == 60:
+ LA10_4 = self.input.LA(2)
+
+ if (self.synpred15()) :
+ alt10 = 3
+
+
+ elif LA10 == IDENTIFIER:
+ LA10_5 = self.input.LA(2)
+
+ if (self.synpred14()) :
+ alt10 = 2
+
+
+ elif LA10 == 53:
+ LA10_9 = self.input.LA(2)
+
+ if (self.synpred15()) :
+ alt10 = 3
+
+
+ elif LA10 == 29 or LA10 == 30 or LA10 == 31 or LA10 == 32 or LA10 == 33:
+ alt10 = 1
+ elif LA10 == 34 or LA10 == 35 or LA10 == 36 or LA10 == 37 or LA10 == 38 or LA10 == 39 or LA10 == 40 or LA10 == 41 or LA10 == 42 or LA10 == 45 or LA10 == 46 or LA10 == 48:
+ alt10 = 2
+ elif LA10 == 49 or LA10 == 50 or LA10 == 51 or LA10 == 52 or LA10 == 54 or LA10 == 55 or LA10 == 56 or LA10 == 57 or LA10 == 61:
+ alt10 = 3
+
+ if alt10 == 1:
+ # C.g:183:10: storage_class_specifier
+ self.following.append(self.FOLLOW_storage_class_specifier_in_declaration_specifiers264)
+ self.storage_class_specifier()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ elif alt10 == 2:
+ # C.g:184:7: type_specifier
+ self.following.append(self.FOLLOW_type_specifier_in_declaration_specifiers272)
+ self.type_specifier()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ elif alt10 == 3:
+ # C.g:185:13: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_declaration_specifiers286)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ else:
+ if cnt10 >= 1:
+ break #loop10
+
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ eee = EarlyExitException(10, self.input)
+ raise eee
+
+ cnt10 += 1
+
+
+
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 5, declaration_specifiers_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end declaration_specifiers
+
+ class init_declarator_list_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start init_declarator_list
+ # C.g:189:1: init_declarator_list : init_declarator ( ',' init_declarator )* ;
+ def init_declarator_list(self, ):
+
+ retval = self.init_declarator_list_return()
+ retval.start = self.input.LT(1)
+ init_declarator_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 6):
+ return retval
+
+ # C.g:190:2: ( init_declarator ( ',' init_declarator )* )
+ # C.g:190:4: init_declarator ( ',' init_declarator )*
+ self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list308)
+ self.init_declarator()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:190:20: ( ',' init_declarator )*
+ while True: #loop11
+ alt11 = 2
+ LA11_0 = self.input.LA(1)
+
+ if (LA11_0 == 27) :
+ alt11 = 1
+
+
+ if alt11 == 1:
+ # C.g:190:21: ',' init_declarator
+ self.match(self.input, 27, self.FOLLOW_27_in_init_declarator_list311)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list313)
+ self.init_declarator()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ else:
+ break #loop11
+
+
+
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 6, init_declarator_list_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end init_declarator_list
+
+
+ # $ANTLR start init_declarator
+ # C.g:193:1: init_declarator : declarator ( '=' initializer )? ;
+ def init_declarator(self, ):
+
+ init_declarator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 7):
+ return
+
+ # C.g:194:2: ( declarator ( '=' initializer )? )
+ # C.g:194:4: declarator ( '=' initializer )?
+ self.following.append(self.FOLLOW_declarator_in_init_declarator326)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:194:15: ( '=' initializer )?
+ alt12 = 2
+ LA12_0 = self.input.LA(1)
+
+ if (LA12_0 == 28) :
+ alt12 = 1
+ if alt12 == 1:
+ # C.g:194:16: '=' initializer
+ self.match(self.input, 28, self.FOLLOW_28_in_init_declarator329)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_initializer_in_init_declarator331)
+ self.initializer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 7, init_declarator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end init_declarator
+
+
+ # $ANTLR start storage_class_specifier
+ # C.g:197:1: storage_class_specifier : ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' );
+ def storage_class_specifier(self, ):
+
+ storage_class_specifier_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 8):
+ return
+
+ # C.g:198:2: ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' )
+ # C.g:
+ if (29 <= self.input.LA(1) <= 33):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_storage_class_specifier0
+ )
+ raise mse
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 8, storage_class_specifier_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end storage_class_specifier
+
+
+ # $ANTLR start type_specifier
+ # C.g:205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id );
+ def type_specifier(self, ):
+
+ type_specifier_StartIndex = self.input.index()
+ s = None
+
+ e = None
+
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 9):
+ return
+
+ # C.g:206:2: ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id )
+ alt13 = 12
+ LA13_0 = self.input.LA(1)
+
+ if (LA13_0 == 34) :
+ alt13 = 1
+ elif (LA13_0 == 35) :
+ alt13 = 2
+ elif (LA13_0 == 36) :
+ alt13 = 3
+ elif (LA13_0 == 37) :
+ alt13 = 4
+ elif (LA13_0 == 38) :
+ alt13 = 5
+ elif (LA13_0 == 39) :
+ alt13 = 6
+ elif (LA13_0 == 40) :
+ alt13 = 7
+ elif (LA13_0 == 41) :
+ alt13 = 8
+ elif (LA13_0 == 42) :
+ alt13 = 9
+ elif ((45 <= LA13_0 <= 46)) :
+ alt13 = 10
+ elif (LA13_0 == 48) :
+ alt13 = 11
+ elif (LA13_0 == IDENTIFIER) and (self.synpred34()):
+ alt13 = 12
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id );", 13, 0, self.input)
+
+ raise nvae
+
+ if alt13 == 1:
+ # C.g:206:4: 'void'
+ self.match(self.input, 34, self.FOLLOW_34_in_type_specifier376)
+ if self.failed:
+ return
+
+
+ elif alt13 == 2:
+ # C.g:207:4: 'char'
+ self.match(self.input, 35, self.FOLLOW_35_in_type_specifier381)
+ if self.failed:
+ return
+
+
+ elif alt13 == 3:
+ # C.g:208:4: 'short'
+ self.match(self.input, 36, self.FOLLOW_36_in_type_specifier386)
+ if self.failed:
+ return
+
+
+ elif alt13 == 4:
+ # C.g:209:4: 'int'
+ self.match(self.input, 37, self.FOLLOW_37_in_type_specifier391)
+ if self.failed:
+ return
+
+
+ elif alt13 == 5:
+ # C.g:210:4: 'long'
+ self.match(self.input, 38, self.FOLLOW_38_in_type_specifier396)
+ if self.failed:
+ return
+
+
+ elif alt13 == 6:
+ # C.g:211:4: 'float'
+ self.match(self.input, 39, self.FOLLOW_39_in_type_specifier401)
+ if self.failed:
+ return
+
+
+ elif alt13 == 7:
+ # C.g:212:4: 'double'
+ self.match(self.input, 40, self.FOLLOW_40_in_type_specifier406)
+ if self.failed:
+ return
+
+
+ elif alt13 == 8:
+ # C.g:213:4: 'signed'
+ self.match(self.input, 41, self.FOLLOW_41_in_type_specifier411)
+ if self.failed:
+ return
+
+
+ elif alt13 == 9:
+ # C.g:214:4: 'unsigned'
+ self.match(self.input, 42, self.FOLLOW_42_in_type_specifier416)
+ if self.failed:
+ return
+
+
+ elif alt13 == 10:
+ # C.g:215:4: s= struct_or_union_specifier
+ self.following.append(self.FOLLOW_struct_or_union_specifier_in_type_specifier423)
+ s = self.struct_or_union_specifier()
+ self.following.pop()
+ if self.failed:
+ return
+ if self.backtracking == 0:
+
+ if s.stop is not None:
+ self.StoreStructUnionDefinition(s.start.line, s.start.charPositionInLine, s.stop.line, s.stop.charPositionInLine, self.input.toString(s.start, s.stop))
+
+
+
+
+ elif alt13 == 11:
+ # C.g:220:4: e= enum_specifier
+ self.following.append(self.FOLLOW_enum_specifier_in_type_specifier433)
+ e = self.enum_specifier()
+ self.following.pop()
+ if self.failed:
+ return
+ if self.backtracking == 0:
+
+ if e.stop is not None:
+ self.StoreEnumerationDefinition(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start, e.stop))
+
+
+
+
+ elif alt13 == 12:
+ # C.g:225:4: ( IDENTIFIER ( type_qualifier )* declarator )=> type_id
+ self.following.append(self.FOLLOW_type_id_in_type_specifier451)
+ self.type_id()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 9, type_specifier_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end type_specifier
+
+
+ # $ANTLR start type_id
+ # C.g:228:1: type_id : IDENTIFIER ;
+ def type_id(self, ):
+
+ type_id_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 10):
+ return
+
+ # C.g:229:5: ( IDENTIFIER )
+ # C.g:229:9: IDENTIFIER
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_type_id467)
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 10, type_id_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end type_id
+
+ class struct_or_union_specifier_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start struct_or_union_specifier
+ # C.g:233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );
+ def struct_or_union_specifier(self, ):
+
+ retval = self.struct_or_union_specifier_return()
+ retval.start = self.input.LT(1)
+ struct_or_union_specifier_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 11):
+ return retval
+
+ # C.g:235:2: ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER )
+ alt15 = 2
+ LA15_0 = self.input.LA(1)
+
+ if ((45 <= LA15_0 <= 46)) :
+ LA15_1 = self.input.LA(2)
+
+ if (LA15_1 == IDENTIFIER) :
+ LA15_2 = self.input.LA(3)
+
+ if (LA15_2 == 43) :
+ alt15 = 1
+ elif (LA15_2 == EOF or LA15_2 == IDENTIFIER or LA15_2 == 25 or LA15_2 == 27 or (29 <= LA15_2 <= 42) or (45 <= LA15_2 <= 64) or LA15_2 == 66) :
+ alt15 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 2, self.input)
+
+ raise nvae
+
+ elif (LA15_1 == 43) :
+ alt15 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 1, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 0, self.input)
+
+ raise nvae
+
+ if alt15 == 1:
+ # C.g:235:4: struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}'
+ self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier494)
+ self.struct_or_union()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:235:20: ( IDENTIFIER )?
+ alt14 = 2
+ LA14_0 = self.input.LA(1)
+
+ if (LA14_0 == IDENTIFIER) :
+ alt14 = 1
+ if alt14 == 1:
+ # C.g:0:0: IDENTIFIER
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier496)
+ if self.failed:
+ return retval
+
+
+
+ self.match(self.input, 43, self.FOLLOW_43_in_struct_or_union_specifier499)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_struct_declaration_list_in_struct_or_union_specifier501)
+ self.struct_declaration_list()
+ self.following.pop()
+ if self.failed:
+ return retval
+ self.match(self.input, 44, self.FOLLOW_44_in_struct_or_union_specifier503)
+ if self.failed:
+ return retval
+
+
+ elif alt15 == 2:
+ # C.g:236:4: struct_or_union IDENTIFIER
+ self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier508)
+ self.struct_or_union()
+ self.following.pop()
+ if self.failed:
+ return retval
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier510)
+ if self.failed:
+ return retval
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 11, struct_or_union_specifier_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end struct_or_union_specifier
+
+
+ # $ANTLR start struct_or_union
+ # C.g:239:1: struct_or_union : ( 'struct' | 'union' );
+ def struct_or_union(self, ):
+
+ struct_or_union_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 12):
+ return
+
+ # C.g:240:2: ( 'struct' | 'union' )
+ # C.g:
+ if (45 <= self.input.LA(1) <= 46):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_struct_or_union0
+ )
+ raise mse
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 12, struct_or_union_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end struct_or_union
+
+
+ # $ANTLR start struct_declaration_list
+ # C.g:244:1: struct_declaration_list : ( struct_declaration )+ ;
+ def struct_declaration_list(self, ):
+
+ struct_declaration_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 13):
+ return
+
+ # C.g:245:2: ( ( struct_declaration )+ )
+ # C.g:245:4: ( struct_declaration )+
+ # C.g:245:4: ( struct_declaration )+
+ cnt16 = 0
+ while True: #loop16
+ alt16 = 2
+ LA16_0 = self.input.LA(1)
+
+ if (LA16_0 == IDENTIFIER or (34 <= LA16_0 <= 42) or (45 <= LA16_0 <= 46) or (48 <= LA16_0 <= 61)) :
+ alt16 = 1
+
+
+ if alt16 == 1:
+ # C.g:0:0: struct_declaration
+ self.following.append(self.FOLLOW_struct_declaration_in_struct_declaration_list537)
+ self.struct_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ if cnt16 >= 1:
+ break #loop16
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(16, self.input)
+ raise eee
+
+ cnt16 += 1
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 13, struct_declaration_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end struct_declaration_list
+
+
+ # $ANTLR start struct_declaration
+ # C.g:248:1: struct_declaration : specifier_qualifier_list struct_declarator_list ';' ;
+ def struct_declaration(self, ):
+
+ struct_declaration_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 14):
+ return
+
+ # C.g:249:2: ( specifier_qualifier_list struct_declarator_list ';' )
+ # C.g:249:4: specifier_qualifier_list struct_declarator_list ';'
+ self.following.append(self.FOLLOW_specifier_qualifier_list_in_struct_declaration549)
+ self.specifier_qualifier_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_struct_declarator_list_in_struct_declaration551)
+ self.struct_declarator_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_struct_declaration553)
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 14, struct_declaration_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end struct_declaration
+
+
+ # $ANTLR start specifier_qualifier_list
+ # C.g:252:1: specifier_qualifier_list : ( type_qualifier | type_specifier )+ ;
+ def specifier_qualifier_list(self, ):
+
+ specifier_qualifier_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 15):
+ return
+
+ # C.g:253:2: ( ( type_qualifier | type_specifier )+ )
+ # C.g:253:4: ( type_qualifier | type_specifier )+
+ # C.g:253:4: ( type_qualifier | type_specifier )+
+ cnt17 = 0
+ while True: #loop17
+ alt17 = 3
+ LA17 = self.input.LA(1)
+ if LA17 == 58:
+ LA17_2 = self.input.LA(2)
+
+ if (self.synpred39()) :
+ alt17 = 1
+
+
+ elif LA17 == 59:
+ LA17_3 = self.input.LA(2)
+
+ if (self.synpred39()) :
+ alt17 = 1
+
+
+ elif LA17 == 60:
+ LA17_4 = self.input.LA(2)
+
+ if (self.synpred39()) :
+ alt17 = 1
+
+
+ elif LA17 == IDENTIFIER:
+ LA17 = self.input.LA(2)
+ if LA17 == EOF or LA17 == IDENTIFIER or LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48 or LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 58 or LA17 == 59 or LA17 == 60 or LA17 == 61 or LA17 == 63 or LA17 == 66:
+ alt17 = 2
+ elif LA17 == 62:
+ LA17_94 = self.input.LA(3)
+
+ if (self.synpred40()) :
+ alt17 = 2
+
+
+ elif LA17 == 47:
+ LA17_95 = self.input.LA(3)
+
+ if (self.synpred40()) :
+ alt17 = 2
+
+
+ elif LA17 == 64:
+ LA17_96 = self.input.LA(3)
+
+ if (self.synpred40()) :
+ alt17 = 2
+
+
+
+ elif LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 61:
+ alt17 = 1
+ elif LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48:
+ alt17 = 2
+
+ if alt17 == 1:
+ # C.g:253:6: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_specifier_qualifier_list566)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt17 == 2:
+ # C.g:253:23: type_specifier
+ self.following.append(self.FOLLOW_type_specifier_in_specifier_qualifier_list570)
+ self.type_specifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ if cnt17 >= 1:
+ break #loop17
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(17, self.input)
+ raise eee
+
+ cnt17 += 1
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 15, specifier_qualifier_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end specifier_qualifier_list
+
+
+ # $ANTLR start struct_declarator_list
+ # C.g:256:1: struct_declarator_list : struct_declarator ( ',' struct_declarator )* ;
+ def struct_declarator_list(self, ):
+
+ struct_declarator_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 16):
+ return
+
+ # C.g:257:2: ( struct_declarator ( ',' struct_declarator )* )
+ # C.g:257:4: struct_declarator ( ',' struct_declarator )*
+ self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list584)
+ self.struct_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:257:22: ( ',' struct_declarator )*
+ while True: #loop18
+ alt18 = 2
+ LA18_0 = self.input.LA(1)
+
+ if (LA18_0 == 27) :
+ alt18 = 1
+
+
+ if alt18 == 1:
+ # C.g:257:23: ',' struct_declarator
+ self.match(self.input, 27, self.FOLLOW_27_in_struct_declarator_list587)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list589)
+ self.struct_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop18
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 16, struct_declarator_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end struct_declarator_list
+
+
+ # $ANTLR start struct_declarator
+ # C.g:260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression );
+ def struct_declarator(self, ):
+
+ struct_declarator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 17):
+ return
+
+ # C.g:261:2: ( declarator ( ':' constant_expression )? | ':' constant_expression )
+ alt20 = 2
+ LA20_0 = self.input.LA(1)
+
+ if (LA20_0 == IDENTIFIER or (58 <= LA20_0 <= 60) or LA20_0 == 62 or LA20_0 == 66) :
+ alt20 = 1
+ elif (LA20_0 == 47) :
+ alt20 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression );", 20, 0, self.input)
+
+ raise nvae
+
+ if alt20 == 1:
+ # C.g:261:4: declarator ( ':' constant_expression )?
+ self.following.append(self.FOLLOW_declarator_in_struct_declarator602)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:261:15: ( ':' constant_expression )?
+ alt19 = 2
+ LA19_0 = self.input.LA(1)
+
+ if (LA19_0 == 47) :
+ alt19 = 1
+ if alt19 == 1:
+ # C.g:261:16: ':' constant_expression
+ self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator605)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_constant_expression_in_struct_declarator607)
+ self.constant_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ elif alt20 == 2:
+ # C.g:262:4: ':' constant_expression
+ self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator614)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_constant_expression_in_struct_declarator616)
+ self.constant_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 17, struct_declarator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end struct_declarator
+
+ class enum_specifier_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start enum_specifier
+ # C.g:265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );
+ def enum_specifier(self, ):
+
+ retval = self.enum_specifier_return()
+ retval.start = self.input.LT(1)
+ enum_specifier_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 18):
+ return retval
+
+ # C.g:267:2: ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER )
+ alt23 = 3
+ LA23_0 = self.input.LA(1)
+
+ if (LA23_0 == 48) :
+ LA23_1 = self.input.LA(2)
+
+ if (LA23_1 == IDENTIFIER) :
+ LA23_2 = self.input.LA(3)
+
+ if (LA23_2 == 43) :
+ alt23 = 2
+ elif (LA23_2 == EOF or LA23_2 == IDENTIFIER or LA23_2 == 25 or LA23_2 == 27 or (29 <= LA23_2 <= 42) or (45 <= LA23_2 <= 64) or LA23_2 == 66) :
+ alt23 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 2, self.input)
+
+ raise nvae
+
+ elif (LA23_1 == 43) :
+ alt23 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 1, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 0, self.input)
+
+ raise nvae
+
+ if alt23 == 1:
+ # C.g:267:4: 'enum' '{' enumerator_list ( ',' )? '}'
+ self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier634)
+ if self.failed:
+ return retval
+ self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier636)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier638)
+ self.enumerator_list()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:267:31: ( ',' )?
+ alt21 = 2
+ LA21_0 = self.input.LA(1)
+
+ if (LA21_0 == 27) :
+ alt21 = 1
+ if alt21 == 1:
+ # C.g:0:0: ','
+ self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier640)
+ if self.failed:
+ return retval
+
+
+
+ self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier643)
+ if self.failed:
+ return retval
+
+
+ elif alt23 == 2:
+ # C.g:268:4: 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}'
+ self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier648)
+ if self.failed:
+ return retval
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier650)
+ if self.failed:
+ return retval
+ self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier652)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier654)
+ self.enumerator_list()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:268:42: ( ',' )?
+ alt22 = 2
+ LA22_0 = self.input.LA(1)
+
+ if (LA22_0 == 27) :
+ alt22 = 1
+ if alt22 == 1:
+ # C.g:0:0: ','
+ self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier656)
+ if self.failed:
+ return retval
+
+
+
+ self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier659)
+ if self.failed:
+ return retval
+
+
+ elif alt23 == 3:
+ # C.g:269:4: 'enum' IDENTIFIER
+ self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier664)
+ if self.failed:
+ return retval
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier666)
+ if self.failed:
+ return retval
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 18, enum_specifier_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end enum_specifier
+
+
+ # $ANTLR start enumerator_list
+ # C.g:272:1: enumerator_list : enumerator ( ',' enumerator )* ;
+ def enumerator_list(self, ):
+
+ enumerator_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 19):
+ return
+
+ # C.g:273:2: ( enumerator ( ',' enumerator )* )
+ # C.g:273:4: enumerator ( ',' enumerator )*
+ self.following.append(self.FOLLOW_enumerator_in_enumerator_list677)
+ self.enumerator()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:273:15: ( ',' enumerator )*
+ while True: #loop24
+ alt24 = 2
+ LA24_0 = self.input.LA(1)
+
+ if (LA24_0 == 27) :
+ LA24_1 = self.input.LA(2)
+
+ if (LA24_1 == IDENTIFIER) :
+ alt24 = 1
+
+
+
+
+ if alt24 == 1:
+ # C.g:273:16: ',' enumerator
+ self.match(self.input, 27, self.FOLLOW_27_in_enumerator_list680)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_enumerator_in_enumerator_list682)
+ self.enumerator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop24
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 19, enumerator_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end enumerator_list
+
+
+ # $ANTLR start enumerator
+ # C.g:276:1: enumerator : IDENTIFIER ( '=' constant_expression )? ;
+ def enumerator(self, ):
+
+ enumerator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 20):
+ return
+
+ # C.g:277:2: ( IDENTIFIER ( '=' constant_expression )? )
+ # C.g:277:4: IDENTIFIER ( '=' constant_expression )?
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enumerator695)
+ if self.failed:
+ return
+ # C.g:277:15: ( '=' constant_expression )?
+ alt25 = 2
+ LA25_0 = self.input.LA(1)
+
+ if (LA25_0 == 28) :
+ alt25 = 1
+ if alt25 == 1:
+ # C.g:277:16: '=' constant_expression
+ self.match(self.input, 28, self.FOLLOW_28_in_enumerator698)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_constant_expression_in_enumerator700)
+ self.constant_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 20, enumerator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end enumerator
+
+
+ # $ANTLR start type_qualifier
+ # C.g:280:1: type_qualifier : ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' );
+ def type_qualifier(self, ):
+
+ type_qualifier_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 21):
+ return
+
+ # C.g:281:2: ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' )
+ # C.g:
+ if (49 <= self.input.LA(1) <= 61):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_type_qualifier0
+ )
+ raise mse
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 21, type_qualifier_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end type_qualifier
+
+ class declarator_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start declarator
+ # C.g:296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );
+ def declarator(self, ):
+
+ retval = self.declarator_return()
+ retval.start = self.input.LT(1)
+ declarator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 22):
+ return retval
+
+ # C.g:297:2: ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer )
+ alt30 = 2
+ LA30_0 = self.input.LA(1)
+
+ if (LA30_0 == 66) :
+ LA30_1 = self.input.LA(2)
+
+ if (self.synpred66()) :
+ alt30 = 1
+ elif (True) :
+ alt30 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 1, self.input)
+
+ raise nvae
+
+ elif (LA30_0 == IDENTIFIER or (58 <= LA30_0 <= 60) or LA30_0 == 62) :
+ alt30 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 0, self.input)
+
+ raise nvae
+
+ if alt30 == 1:
+ # C.g:297:4: ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator
+ # C.g:297:4: ( pointer )?
+ alt26 = 2
+ LA26_0 = self.input.LA(1)
+
+ if (LA26_0 == 66) :
+ alt26 = 1
+ if alt26 == 1:
+ # C.g:0:0: pointer
+ self.following.append(self.FOLLOW_pointer_in_declarator784)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+
+ # C.g:297:13: ( 'EFIAPI' )?
+ alt27 = 2
+ LA27_0 = self.input.LA(1)
+
+ if (LA27_0 == 58) :
+ alt27 = 1
+ if alt27 == 1:
+ # C.g:297:14: 'EFIAPI'
+ self.match(self.input, 58, self.FOLLOW_58_in_declarator788)
+ if self.failed:
+ return retval
+
+
+
+ # C.g:297:25: ( 'EFI_BOOTSERVICE' )?
+ alt28 = 2
+ LA28_0 = self.input.LA(1)
+
+ if (LA28_0 == 59) :
+ alt28 = 1
+ if alt28 == 1:
+ # C.g:297:26: 'EFI_BOOTSERVICE'
+ self.match(self.input, 59, self.FOLLOW_59_in_declarator793)
+ if self.failed:
+ return retval
+
+
+
+ # C.g:297:46: ( 'EFI_RUNTIMESERVICE' )?
+ alt29 = 2
+ LA29_0 = self.input.LA(1)
+
+ if (LA29_0 == 60) :
+ alt29 = 1
+ if alt29 == 1:
+ # C.g:297:47: 'EFI_RUNTIMESERVICE'
+ self.match(self.input, 60, self.FOLLOW_60_in_declarator798)
+ if self.failed:
+ return retval
+
+
+
+ self.following.append(self.FOLLOW_direct_declarator_in_declarator802)
+ self.direct_declarator()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ elif alt30 == 2:
+ # C.g:299:4: pointer
+ self.following.append(self.FOLLOW_pointer_in_declarator808)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 22, declarator_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end declarator
+
+
+ # $ANTLR start direct_declarator
+ # C.g:302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ );
+ def direct_declarator(self, ):
+
+ direct_declarator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 23):
+ return
+
+ # C.g:303:2: ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ )
+ alt34 = 2
+ LA34_0 = self.input.LA(1)
+
+ if (LA34_0 == IDENTIFIER) :
+ alt34 = 1
+ elif (LA34_0 == 62) :
+ alt34 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ );", 34, 0, self.input)
+
+ raise nvae
+
+ if alt34 == 1:
+ # C.g:303:4: IDENTIFIER ( declarator_suffix )*
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_direct_declarator819)
+ if self.failed:
+ return
+ # C.g:303:15: ( declarator_suffix )*
+ while True: #loop31
+ alt31 = 2
+ LA31_0 = self.input.LA(1)
+
+ if (LA31_0 == 62) :
+ LA31 = self.input.LA(2)
+ if LA31 == 63:
+ LA31_30 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 58:
+ LA31_31 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 66:
+ LA31_32 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 59:
+ LA31_33 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 60:
+ LA31_34 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == IDENTIFIER:
+ LA31_35 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 29 or LA31 == 30 or LA31 == 31 or LA31 == 32 or LA31 == 33:
+ LA31_37 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 34:
+ LA31_38 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 35:
+ LA31_39 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 36:
+ LA31_40 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 37:
+ LA31_41 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 38:
+ LA31_42 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 39:
+ LA31_43 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 40:
+ LA31_44 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 41:
+ LA31_45 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 42:
+ LA31_46 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 45 or LA31 == 46:
+ LA31_47 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 48:
+ LA31_48 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 49 or LA31 == 50 or LA31 == 51 or LA31 == 52 or LA31 == 53 or LA31 == 54 or LA31 == 55 or LA31 == 56 or LA31 == 57 or LA31 == 61:
+ LA31_49 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+
+ elif (LA31_0 == 64) :
+ LA31 = self.input.LA(2)
+ if LA31 == 65:
+ LA31_51 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 62:
+ LA31_52 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == IDENTIFIER:
+ LA31_53 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == HEX_LITERAL:
+ LA31_54 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == OCTAL_LITERAL:
+ LA31_55 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == DECIMAL_LITERAL:
+ LA31_56 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == CHARACTER_LITERAL:
+ LA31_57 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == STRING_LITERAL:
+ LA31_58 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == FLOATING_POINT_LITERAL:
+ LA31_59 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 72:
+ LA31_60 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 73:
+ LA31_61 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 66 or LA31 == 68 or LA31 == 69 or LA31 == 77 or LA31 == 78 or LA31 == 79:
+ LA31_62 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+ elif LA31 == 74:
+ LA31_63 = self.input.LA(3)
+
+ if (self.synpred67()) :
+ alt31 = 1
+
+
+
+
+
+ if alt31 == 1:
+ # C.g:0:0: declarator_suffix
+ self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator821)
+ self.declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop31
+
+
+
+
+ elif alt34 == 2:
+ # C.g:304:4: '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+
+ self.match(self.input, 62, self.FOLLOW_62_in_direct_declarator827)
+ if self.failed:
+ return
+ # C.g:304:8: ( 'EFIAPI' )?
+ alt32 = 2
+ LA32_0 = self.input.LA(1)
+
+ if (LA32_0 == 58) :
+ LA32_1 = self.input.LA(2)
+
+ if (self.synpred69()) :
+ alt32 = 1
+ if alt32 == 1:
+ # C.g:304:9: 'EFIAPI'
+ self.match(self.input, 58, self.FOLLOW_58_in_direct_declarator830)
+ if self.failed:
+ return
+
+
+
+ self.following.append(self.FOLLOW_declarator_in_direct_declarator834)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_direct_declarator836)
+ if self.failed:
+ return
+ # C.g:304:35: ( declarator_suffix )+
+ cnt33 = 0
+ while True: #loop33
+ alt33 = 2
+ LA33_0 = self.input.LA(1)
+
+ if (LA33_0 == 62) :
+ LA33 = self.input.LA(2)
+ if LA33 == 63:
+ LA33_30 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 58:
+ LA33_31 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 66:
+ LA33_32 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 59:
+ LA33_33 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 60:
+ LA33_34 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == IDENTIFIER:
+ LA33_35 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 29 or LA33 == 30 or LA33 == 31 or LA33 == 32 or LA33 == 33:
+ LA33_37 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 34:
+ LA33_38 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 35:
+ LA33_39 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 36:
+ LA33_40 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 37:
+ LA33_41 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 38:
+ LA33_42 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 39:
+ LA33_43 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 40:
+ LA33_44 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 41:
+ LA33_45 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 42:
+ LA33_46 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 45 or LA33 == 46:
+ LA33_47 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 48:
+ LA33_48 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 49 or LA33 == 50 or LA33 == 51 or LA33 == 52 or LA33 == 53 or LA33 == 54 or LA33 == 55 or LA33 == 56 or LA33 == 57 or LA33 == 61:
+ LA33_49 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+
+ elif (LA33_0 == 64) :
+ LA33 = self.input.LA(2)
+ if LA33 == 65:
+ LA33_51 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 62:
+ LA33_52 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == IDENTIFIER:
+ LA33_53 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == HEX_LITERAL:
+ LA33_54 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == OCTAL_LITERAL:
+ LA33_55 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == DECIMAL_LITERAL:
+ LA33_56 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == CHARACTER_LITERAL:
+ LA33_57 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == STRING_LITERAL:
+ LA33_58 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == FLOATING_POINT_LITERAL:
+ LA33_59 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 72:
+ LA33_60 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 73:
+ LA33_61 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 66 or LA33 == 68 or LA33 == 69 or LA33 == 77 or LA33 == 78 or LA33 == 79:
+ LA33_62 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+ elif LA33 == 74:
+ LA33_63 = self.input.LA(3)
+
+ if (self.synpred70()) :
+ alt33 = 1
+
+
+
+
+
+ if alt33 == 1:
+ # C.g:0:0: declarator_suffix
+ self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator838)
+ self.declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ if cnt33 >= 1:
+ break #loop33
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(33, self.input)
+ raise eee
+
+ cnt33 += 1
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 23, direct_declarator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end direct_declarator
+
+
+ # $ANTLR start declarator_suffix
+ # C.g:307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );
+ def declarator_suffix(self, ):
+
+ declarator_suffix_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 24):
+ return
+
+ # C.g:308:2: ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' )
+ alt35 = 5
+ LA35_0 = self.input.LA(1)
+
+ if (LA35_0 == 64) :
+ LA35_1 = self.input.LA(2)
+
+ if (LA35_1 == 65) :
+ alt35 = 2
+ elif ((IDENTIFIER <= LA35_1 <= FLOATING_POINT_LITERAL) or LA35_1 == 62 or LA35_1 == 66 or (68 <= LA35_1 <= 69) or (72 <= LA35_1 <= 74) or (77 <= LA35_1 <= 79)) :
+ alt35 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 1, self.input)
+
+ raise nvae
+
+ elif (LA35_0 == 62) :
+ LA35 = self.input.LA(2)
+ if LA35 == 63:
+ alt35 = 5
+ elif LA35 == 29 or LA35 == 30 or LA35 == 31 or LA35 == 32 or LA35 == 33 or LA35 == 34 or LA35 == 35 or LA35 == 36 or LA35 == 37 or LA35 == 38 or LA35 == 39 or LA35 == 40 or LA35 == 41 or LA35 == 42 or LA35 == 45 or LA35 == 46 or LA35 == 48 or LA35 == 49 or LA35 == 50 or LA35 == 51 or LA35 == 52 or LA35 == 53 or LA35 == 54 or LA35 == 55 or LA35 == 56 or LA35 == 57 or LA35 == 58 or LA35 == 59 or LA35 == 60 or LA35 == 61 or LA35 == 66:
+ alt35 = 3
+ elif LA35 == IDENTIFIER:
+ LA35_29 = self.input.LA(3)
+
+ if (self.synpred73()) :
+ alt35 = 3
+ elif (self.synpred74()) :
+ alt35 = 4
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 29, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 2, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 0, self.input)
+
+ raise nvae
+
+ if alt35 == 1:
+ # C.g:308:6: '[' constant_expression ']'
+ self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix852)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_constant_expression_in_declarator_suffix854)
+ self.constant_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix856)
+ if self.failed:
+ return
+
+
+ elif alt35 == 2:
+ # C.g:309:9: '[' ']'
+ self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix866)
+ if self.failed:
+ return
+ self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix868)
+ if self.failed:
+ return
+
+
+ elif alt35 == 3:
+ # C.g:310:9: '(' parameter_type_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix878)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_parameter_type_list_in_declarator_suffix880)
+ self.parameter_type_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix882)
+ if self.failed:
+ return
+
+
+ elif alt35 == 4:
+ # C.g:311:9: '(' identifier_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix892)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_identifier_list_in_declarator_suffix894)
+ self.identifier_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix896)
+ if self.failed:
+ return
+
+
+ elif alt35 == 5:
+ # C.g:312:9: '(' ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix906)
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix908)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 24, declarator_suffix_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end declarator_suffix
+
+
+ # $ANTLR start pointer
+ # C.g:315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );
+ def pointer(self, ):
+
+ pointer_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 25):
+ return
+
+ # C.g:316:2: ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' )
+ alt38 = 3
+ LA38_0 = self.input.LA(1)
+
+ if (LA38_0 == 66) :
+ LA38 = self.input.LA(2)
+ if LA38 == 66:
+ LA38_2 = self.input.LA(3)
+
+ if (self.synpred78()) :
+ alt38 = 2
+ elif (True) :
+ alt38 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 2, self.input)
+
+ raise nvae
+
+ elif LA38 == 58:
+ LA38_3 = self.input.LA(3)
+
+ if (self.synpred77()) :
+ alt38 = 1
+ elif (True) :
+ alt38 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 3, self.input)
+
+ raise nvae
+
+ elif LA38 == 59:
+ LA38_4 = self.input.LA(3)
+
+ if (self.synpred77()) :
+ alt38 = 1
+ elif (True) :
+ alt38 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 4, self.input)
+
+ raise nvae
+
+ elif LA38 == 60:
+ LA38_5 = self.input.LA(3)
+
+ if (self.synpred77()) :
+ alt38 = 1
+ elif (True) :
+ alt38 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 5, self.input)
+
+ raise nvae
+
+ elif LA38 == EOF or LA38 == IDENTIFIER or LA38 == 25 or LA38 == 26 or LA38 == 27 or LA38 == 28 or LA38 == 29 or LA38 == 30 or LA38 == 31 or LA38 == 32 or LA38 == 33 or LA38 == 34 or LA38 == 35 or LA38 == 36 or LA38 == 37 or LA38 == 38 or LA38 == 39 or LA38 == 40 or LA38 == 41 or LA38 == 42 or LA38 == 43 or LA38 == 45 or LA38 == 46 or LA38 == 47 or LA38 == 48 or LA38 == 62 or LA38 == 63 or LA38 == 64:
+ alt38 = 3
+ elif LA38 == 53:
+ LA38_21 = self.input.LA(3)
+
+ if (self.synpred77()) :
+ alt38 = 1
+ elif (True) :
+ alt38 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 21, self.input)
+
+ raise nvae
+
+ elif LA38 == 49 or LA38 == 50 or LA38 == 51 or LA38 == 52 or LA38 == 54 or LA38 == 55 or LA38 == 56 or LA38 == 57 or LA38 == 61:
+ LA38_29 = self.input.LA(3)
+
+ if (self.synpred77()) :
+ alt38 = 1
+ elif (True) :
+ alt38 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 29, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 1, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 0, self.input)
+
+ raise nvae
+
+ if alt38 == 1:
+ # C.g:316:4: '*' ( type_qualifier )+ ( pointer )?
+ self.match(self.input, 66, self.FOLLOW_66_in_pointer919)
+ if self.failed:
+ return
+ # C.g:316:8: ( type_qualifier )+
+ cnt36 = 0
+ while True: #loop36
+ alt36 = 2
+ LA36 = self.input.LA(1)
+ if LA36 == 58:
+ LA36_2 = self.input.LA(2)
+
+ if (self.synpred75()) :
+ alt36 = 1
+
+
+ elif LA36 == 59:
+ LA36_3 = self.input.LA(2)
+
+ if (self.synpred75()) :
+ alt36 = 1
+
+
+ elif LA36 == 60:
+ LA36_4 = self.input.LA(2)
+
+ if (self.synpred75()) :
+ alt36 = 1
+
+
+ elif LA36 == 53:
+ LA36_20 = self.input.LA(2)
+
+ if (self.synpred75()) :
+ alt36 = 1
+
+
+ elif LA36 == 49 or LA36 == 50 or LA36 == 51 or LA36 == 52 or LA36 == 54 or LA36 == 55 or LA36 == 56 or LA36 == 57 or LA36 == 61:
+ LA36_28 = self.input.LA(2)
+
+ if (self.synpred75()) :
+ alt36 = 1
+
+
+
+ if alt36 == 1:
+ # C.g:0:0: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_pointer921)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ if cnt36 >= 1:
+ break #loop36
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(36, self.input)
+ raise eee
+
+ cnt36 += 1
+
+
+ # C.g:316:24: ( pointer )?
+ alt37 = 2
+ LA37_0 = self.input.LA(1)
+
+ if (LA37_0 == 66) :
+ LA37_1 = self.input.LA(2)
+
+ if (self.synpred76()) :
+ alt37 = 1
+ if alt37 == 1:
+ # C.g:0:0: pointer
+ self.following.append(self.FOLLOW_pointer_in_pointer924)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ elif alt38 == 2:
+ # C.g:317:4: '*' pointer
+ self.match(self.input, 66, self.FOLLOW_66_in_pointer930)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_pointer_in_pointer932)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt38 == 3:
+ # C.g:318:4: '*'
+ self.match(self.input, 66, self.FOLLOW_66_in_pointer937)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 25, pointer_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end pointer
+
+
+ # $ANTLR start parameter_type_list
+ # C.g:321:1: parameter_type_list : parameter_list ( ',' ( 'OPTIONAL' )? '...' )? ;
+ def parameter_type_list(self, ):
+
+ parameter_type_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 26):
+ return
+
+ # C.g:322:2: ( parameter_list ( ',' ( 'OPTIONAL' )? '...' )? )
+ # C.g:322:4: parameter_list ( ',' ( 'OPTIONAL' )? '...' )?
+ self.following.append(self.FOLLOW_parameter_list_in_parameter_type_list948)
+ self.parameter_list()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:322:19: ( ',' ( 'OPTIONAL' )? '...' )?
+ alt40 = 2
+ LA40_0 = self.input.LA(1)
+
+ if (LA40_0 == 27) :
+ alt40 = 1
+ if alt40 == 1:
+ # C.g:322:20: ',' ( 'OPTIONAL' )? '...'
+ self.match(self.input, 27, self.FOLLOW_27_in_parameter_type_list951)
+ if self.failed:
+ return
+ # C.g:322:24: ( 'OPTIONAL' )?
+ alt39 = 2
+ LA39_0 = self.input.LA(1)
+
+ if (LA39_0 == 53) :
+ alt39 = 1
+ if alt39 == 1:
+ # C.g:322:25: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_parameter_type_list954)
+ if self.failed:
+ return
+
+
+
+ self.match(self.input, 67, self.FOLLOW_67_in_parameter_type_list958)
+ if self.failed:
+ return
+
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 26, parameter_type_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end parameter_type_list
+
+
+ # $ANTLR start parameter_list
+ # C.g:325:1: parameter_list : parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* ;
+ def parameter_list(self, ):
+
+ parameter_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 27):
+ return
+
+ # C.g:326:2: ( parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* )
+ # C.g:326:4: parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )*
+ self.following.append(self.FOLLOW_parameter_declaration_in_parameter_list971)
+ self.parameter_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:326:26: ( ',' ( 'OPTIONAL' )? parameter_declaration )*
+ while True: #loop42
+ alt42 = 2
+ LA42_0 = self.input.LA(1)
+
+ if (LA42_0 == 27) :
+ LA42_1 = self.input.LA(2)
+
+ if (LA42_1 == 53) :
+ LA42_3 = self.input.LA(3)
+
+ if (self.synpred82()) :
+ alt42 = 1
+
+
+ elif (LA42_1 == IDENTIFIER or (29 <= LA42_1 <= 42) or (45 <= LA42_1 <= 46) or (48 <= LA42_1 <= 52) or (54 <= LA42_1 <= 61) or LA42_1 == 66) :
+ alt42 = 1
+
+
+
+
+ if alt42 == 1:
+ # C.g:326:27: ',' ( 'OPTIONAL' )? parameter_declaration
+ self.match(self.input, 27, self.FOLLOW_27_in_parameter_list974)
+ if self.failed:
+ return
+ # C.g:326:31: ( 'OPTIONAL' )?
+ alt41 = 2
+ LA41_0 = self.input.LA(1)
+
+ if (LA41_0 == 53) :
+ LA41_1 = self.input.LA(2)
+
+ if (self.synpred81()) :
+ alt41 = 1
+ if alt41 == 1:
+ # C.g:326:32: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_parameter_list977)
+ if self.failed:
+ return
+
+
+
+ self.following.append(self.FOLLOW_parameter_declaration_in_parameter_list981)
+ self.parameter_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop42
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 27, parameter_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end parameter_list
+
+
+ # $ANTLR start parameter_declaration
+ # C.g:329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );
+ def parameter_declaration(self, ):
+
+ parameter_declaration_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 28):
+ return
+
+ # C.g:330:2: ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER )
+ alt46 = 2
+ LA46 = self.input.LA(1)
+ if LA46 == 29 or LA46 == 30 or LA46 == 31 or LA46 == 32 or LA46 == 33 or LA46 == 34 or LA46 == 35 or LA46 == 36 or LA46 == 37 or LA46 == 38 or LA46 == 39 or LA46 == 40 or LA46 == 41 or LA46 == 42 or LA46 == 45 or LA46 == 46 or LA46 == 48 or LA46 == 49 or LA46 == 50 or LA46 == 51 or LA46 == 52 or LA46 == 53 or LA46 == 54 or LA46 == 55 or LA46 == 56 or LA46 == 57 or LA46 == 58 or LA46 == 59 or LA46 == 60 or LA46 == 61:
+ alt46 = 1
+ elif LA46 == IDENTIFIER:
+ LA46_13 = self.input.LA(2)
+
+ if (self.synpred86()) :
+ alt46 = 1
+ elif (True) :
+ alt46 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );", 46, 13, self.input)
+
+ raise nvae
+
+ elif LA46 == 66:
+ alt46 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );", 46, 0, self.input)
+
+ raise nvae
+
+ if alt46 == 1:
+ # C.g:330:4: declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )?
+ self.following.append(self.FOLLOW_declaration_specifiers_in_parameter_declaration994)
+ self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:330:27: ( declarator | abstract_declarator )*
+ while True: #loop43
+ alt43 = 3
+ LA43 = self.input.LA(1)
+ if LA43 == 66:
+ LA43_5 = self.input.LA(2)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+ elif LA43 == IDENTIFIER or LA43 == 58 or LA43 == 59 or LA43 == 60:
+ alt43 = 1
+ elif LA43 == 62:
+ LA43 = self.input.LA(2)
+ if LA43 == 29 or LA43 == 30 or LA43 == 31 or LA43 == 32 or LA43 == 33 or LA43 == 34 or LA43 == 35 or LA43 == 36 or LA43 == 37 or LA43 == 38 or LA43 == 39 or LA43 == 40 or LA43 == 41 or LA43 == 42 or LA43 == 45 or LA43 == 46 or LA43 == 48 or LA43 == 49 or LA43 == 50 or LA43 == 51 or LA43 == 52 or LA43 == 53 or LA43 == 54 or LA43 == 55 or LA43 == 56 or LA43 == 57 or LA43 == 61 or LA43 == 63 or LA43 == 64:
+ alt43 = 2
+ elif LA43 == IDENTIFIER:
+ LA43_37 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+ elif LA43 == 58:
+ LA43_38 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+ elif LA43 == 66:
+ LA43_39 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+ elif LA43 == 59:
+ LA43_40 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+ elif LA43 == 60:
+ LA43_41 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+ elif LA43 == 62:
+ LA43_43 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt43 = 1
+ elif (self.synpred84()) :
+ alt43 = 2
+
+
+
+ elif LA43 == 64:
+ alt43 = 2
+
+ if alt43 == 1:
+ # C.g:330:28: declarator
+ self.following.append(self.FOLLOW_declarator_in_parameter_declaration997)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt43 == 2:
+ # C.g:330:39: abstract_declarator
+ self.following.append(self.FOLLOW_abstract_declarator_in_parameter_declaration999)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop43
+
+
+ # C.g:330:61: ( 'OPTIONAL' )?
+ alt44 = 2
+ LA44_0 = self.input.LA(1)
+
+ if (LA44_0 == 53) :
+ alt44 = 1
+ if alt44 == 1:
+ # C.g:330:62: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_parameter_declaration1004)
+ if self.failed:
+ return
+
+
+
+
+
+ elif alt46 == 2:
+ # C.g:332:4: ( pointer )* IDENTIFIER
+ # C.g:332:4: ( pointer )*
+ while True: #loop45
+ alt45 = 2
+ LA45_0 = self.input.LA(1)
+
+ if (LA45_0 == 66) :
+ alt45 = 1
+
+
+ if alt45 == 1:
+ # C.g:0:0: pointer
+ self.following.append(self.FOLLOW_pointer_in_parameter_declaration1013)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop45
+
+
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_parameter_declaration1016)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 28, parameter_declaration_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end parameter_declaration
+
+
+ # $ANTLR start identifier_list
+ # C.g:335:1: identifier_list : IDENTIFIER ( ',' IDENTIFIER )* ;
+ def identifier_list(self, ):
+
+ identifier_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 29):
+ return
+
+ # C.g:336:2: ( IDENTIFIER ( ',' IDENTIFIER )* )
+ # C.g:336:4: IDENTIFIER ( ',' IDENTIFIER )*
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_identifier_list1027)
+ if self.failed:
+ return
+ # C.g:337:2: ( ',' IDENTIFIER )*
+ while True: #loop47
+ alt47 = 2
+ LA47_0 = self.input.LA(1)
+
+ if (LA47_0 == 27) :
+ alt47 = 1
+
+
+ if alt47 == 1:
+ # C.g:337:3: ',' IDENTIFIER
+ self.match(self.input, 27, self.FOLLOW_27_in_identifier_list1031)
+ if self.failed:
+ return
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_identifier_list1033)
+ if self.failed:
+ return
+
+
+ else:
+ break #loop47
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 29, identifier_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end identifier_list
+
+
+ # $ANTLR start type_name
+ # C.g:340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );
+ def type_name(self, ):
+
+ type_name_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 30):
+ return
+
+ # C.g:341:2: ( specifier_qualifier_list ( abstract_declarator )? | type_id )
+ alt49 = 2
+ LA49_0 = self.input.LA(1)
+
+ if ((34 <= LA49_0 <= 42) or (45 <= LA49_0 <= 46) or (48 <= LA49_0 <= 61)) :
+ alt49 = 1
+ elif (LA49_0 == IDENTIFIER) :
+ LA49_13 = self.input.LA(2)
+
+ if (self.synpred90()) :
+ alt49 = 1
+ elif (True) :
+ alt49 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );", 49, 13, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );", 49, 0, self.input)
+
+ raise nvae
+
+ if alt49 == 1:
+ # C.g:341:4: specifier_qualifier_list ( abstract_declarator )?
+ self.following.append(self.FOLLOW_specifier_qualifier_list_in_type_name1046)
+ self.specifier_qualifier_list()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:341:29: ( abstract_declarator )?
+ alt48 = 2
+ LA48_0 = self.input.LA(1)
+
+ if (LA48_0 == 62 or LA48_0 == 64 or LA48_0 == 66) :
+ alt48 = 1
+ if alt48 == 1:
+ # C.g:0:0: abstract_declarator
+ self.following.append(self.FOLLOW_abstract_declarator_in_type_name1048)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ elif alt49 == 2:
+ # C.g:342:4: type_id
+ self.following.append(self.FOLLOW_type_id_in_type_name1054)
+ self.type_id()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 30, type_name_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end type_name
+
+
+ # $ANTLR start abstract_declarator
+ # C.g:345:1: abstract_declarator : ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator );
+ def abstract_declarator(self, ):
+
+ abstract_declarator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 31):
+ return
+
+ # C.g:346:2: ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator )
+ alt51 = 2
+ LA51_0 = self.input.LA(1)
+
+ if (LA51_0 == 66) :
+ alt51 = 1
+ elif (LA51_0 == 62 or LA51_0 == 64) :
+ alt51 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("345:1: abstract_declarator : ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator );", 51, 0, self.input)
+
+ raise nvae
+
+ if alt51 == 1:
+ # C.g:346:4: pointer ( direct_abstract_declarator )?
+ self.following.append(self.FOLLOW_pointer_in_abstract_declarator1065)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:346:12: ( direct_abstract_declarator )?
+ alt50 = 2
+ LA50_0 = self.input.LA(1)
+
+ if (LA50_0 == 62) :
+ LA50 = self.input.LA(2)
+ if LA50 == 63:
+ LA50_12 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 58:
+ LA50_13 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 66:
+ LA50_14 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 59:
+ LA50_15 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 60:
+ LA50_16 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == IDENTIFIER:
+ LA50_17 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 62:
+ LA50_18 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 64:
+ LA50_19 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 29 or LA50 == 30 or LA50 == 31 or LA50 == 32 or LA50 == 33:
+ LA50_20 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 34:
+ LA50_21 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 35:
+ LA50_22 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 36:
+ LA50_23 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 37:
+ LA50_24 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 38:
+ LA50_25 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 39:
+ LA50_26 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 40:
+ LA50_27 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 41:
+ LA50_28 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 42:
+ LA50_29 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 45 or LA50 == 46:
+ LA50_30 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 48:
+ LA50_31 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 49 or LA50 == 50 or LA50 == 51 or LA50 == 52 or LA50 == 53 or LA50 == 54 or LA50 == 55 or LA50 == 56 or LA50 == 57 or LA50 == 61:
+ LA50_32 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif (LA50_0 == 64) :
+ LA50 = self.input.LA(2)
+ if LA50 == 65:
+ LA50_33 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 62:
+ LA50_34 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == IDENTIFIER:
+ LA50_35 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == HEX_LITERAL:
+ LA50_36 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == OCTAL_LITERAL:
+ LA50_37 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == DECIMAL_LITERAL:
+ LA50_38 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == CHARACTER_LITERAL:
+ LA50_39 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == STRING_LITERAL:
+ LA50_40 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == FLOATING_POINT_LITERAL:
+ LA50_41 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 72:
+ LA50_42 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 73:
+ LA50_43 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 66 or LA50 == 68 or LA50 == 69 or LA50 == 77 or LA50 == 78 or LA50 == 79:
+ LA50_44 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ elif LA50 == 74:
+ LA50_45 = self.input.LA(3)
+
+ if (self.synpred91()) :
+ alt50 = 1
+ if alt50 == 1:
+ # C.g:0:0: direct_abstract_declarator
+ self.following.append(self.FOLLOW_direct_abstract_declarator_in_abstract_declarator1067)
+ self.direct_abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ elif alt51 == 2:
+ # C.g:347:4: direct_abstract_declarator
+ self.following.append(self.FOLLOW_direct_abstract_declarator_in_abstract_declarator1073)
+ self.direct_abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 31, abstract_declarator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end abstract_declarator
+
+
+ # $ANTLR start direct_abstract_declarator
+ # C.g:350:1: direct_abstract_declarator : ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* ;
+ def direct_abstract_declarator(self, ):
+
+ direct_abstract_declarator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 32):
+ return
+
+ # C.g:351:2: ( ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* )
+ # C.g:351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )*
+ # C.g:351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )
+ alt52 = 2
+ LA52_0 = self.input.LA(1)
+
+ if (LA52_0 == 62) :
+ LA52 = self.input.LA(2)
+ if LA52 == IDENTIFIER or LA52 == 29 or LA52 == 30 or LA52 == 31 or LA52 == 32 or LA52 == 33 or LA52 == 34 or LA52 == 35 or LA52 == 36 or LA52 == 37 or LA52 == 38 or LA52 == 39 or LA52 == 40 or LA52 == 41 or LA52 == 42 or LA52 == 45 or LA52 == 46 or LA52 == 48 or LA52 == 49 or LA52 == 50 or LA52 == 51 or LA52 == 52 or LA52 == 53 or LA52 == 54 or LA52 == 55 or LA52 == 56 or LA52 == 57 or LA52 == 58 or LA52 == 59 or LA52 == 60 or LA52 == 61 or LA52 == 63:
+ alt52 = 2
+ elif LA52 == 66:
+ LA52_18 = self.input.LA(3)
+
+ if (self.synpred93()) :
+ alt52 = 1
+ elif (True) :
+ alt52 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 18, self.input)
+
+ raise nvae
+
+ elif LA52 == 62 or LA52 == 64:
+ alt52 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 1, self.input)
+
+ raise nvae
+
+ elif (LA52_0 == 64) :
+ alt52 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 0, self.input)
+
+ raise nvae
+
+ if alt52 == 1:
+ # C.g:351:6: '(' abstract_declarator ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_direct_abstract_declarator1086)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_abstract_declarator_in_direct_abstract_declarator1088)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_direct_abstract_declarator1090)
+ if self.failed:
+ return
+
+
+ elif alt52 == 2:
+ # C.g:351:36: abstract_declarator_suffix
+ self.following.append(self.FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1094)
+ self.abstract_declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ # C.g:351:65: ( abstract_declarator_suffix )*
+ while True: #loop53
+ alt53 = 2
+ LA53_0 = self.input.LA(1)
+
+ if (LA53_0 == 62) :
+ LA53 = self.input.LA(2)
+ if LA53 == 63:
+ LA53_12 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 58:
+ LA53_13 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 66:
+ LA53_14 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 59:
+ LA53_15 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 60:
+ LA53_16 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == IDENTIFIER:
+ LA53_17 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 29 or LA53 == 30 or LA53 == 31 or LA53 == 32 or LA53 == 33:
+ LA53_19 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 34:
+ LA53_20 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 35:
+ LA53_21 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 36:
+ LA53_22 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 37:
+ LA53_23 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 38:
+ LA53_24 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 39:
+ LA53_25 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 40:
+ LA53_26 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 41:
+ LA53_27 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 42:
+ LA53_28 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 45 or LA53 == 46:
+ LA53_29 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 48:
+ LA53_30 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 49 or LA53 == 50 or LA53 == 51 or LA53 == 52 or LA53 == 53 or LA53 == 54 or LA53 == 55 or LA53 == 56 or LA53 == 57 or LA53 == 61:
+ LA53_31 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+
+ elif (LA53_0 == 64) :
+ LA53 = self.input.LA(2)
+ if LA53 == 65:
+ LA53_33 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 62:
+ LA53_34 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == IDENTIFIER:
+ LA53_35 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == HEX_LITERAL:
+ LA53_36 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == OCTAL_LITERAL:
+ LA53_37 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == DECIMAL_LITERAL:
+ LA53_38 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == CHARACTER_LITERAL:
+ LA53_39 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == STRING_LITERAL:
+ LA53_40 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == FLOATING_POINT_LITERAL:
+ LA53_41 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 72:
+ LA53_42 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 73:
+ LA53_43 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 66 or LA53 == 68 or LA53 == 69 or LA53 == 77 or LA53 == 78 or LA53 == 79:
+ LA53_44 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+ elif LA53 == 74:
+ LA53_45 = self.input.LA(3)
+
+ if (self.synpred94()) :
+ alt53 = 1
+
+
+
+
+
+ if alt53 == 1:
+ # C.g:0:0: abstract_declarator_suffix
+ self.following.append(self.FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1098)
+ self.abstract_declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop53
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 32, direct_abstract_declarator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end direct_abstract_declarator
+
+
+ # $ANTLR start abstract_declarator_suffix
+ # C.g:354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );
+ def abstract_declarator_suffix(self, ):
+
+ abstract_declarator_suffix_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 33):
+ return
+
+ # C.g:355:2: ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' )
+ alt54 = 4
+ LA54_0 = self.input.LA(1)
+
+ if (LA54_0 == 64) :
+ LA54_1 = self.input.LA(2)
+
+ if (LA54_1 == 65) :
+ alt54 = 1
+ elif ((IDENTIFIER <= LA54_1 <= FLOATING_POINT_LITERAL) or LA54_1 == 62 or LA54_1 == 66 or (68 <= LA54_1 <= 69) or (72 <= LA54_1 <= 74) or (77 <= LA54_1 <= 79)) :
+ alt54 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 1, self.input)
+
+ raise nvae
+
+ elif (LA54_0 == 62) :
+ LA54_2 = self.input.LA(2)
+
+ if (LA54_2 == 63) :
+ alt54 = 3
+ elif (LA54_2 == IDENTIFIER or (29 <= LA54_2 <= 42) or (45 <= LA54_2 <= 46) or (48 <= LA54_2 <= 61) or LA54_2 == 66) :
+ alt54 = 4
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 2, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 0, self.input)
+
+ raise nvae
+
+ if alt54 == 1:
+ # C.g:355:4: '[' ']'
+ self.match(self.input, 64, self.FOLLOW_64_in_abstract_declarator_suffix1110)
+ if self.failed:
+ return
+ self.match(self.input, 65, self.FOLLOW_65_in_abstract_declarator_suffix1112)
+ if self.failed:
+ return
+
+
+ elif alt54 == 2:
+ # C.g:356:4: '[' constant_expression ']'
+ self.match(self.input, 64, self.FOLLOW_64_in_abstract_declarator_suffix1117)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_constant_expression_in_abstract_declarator_suffix1119)
+ self.constant_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 65, self.FOLLOW_65_in_abstract_declarator_suffix1121)
+ if self.failed:
+ return
+
+
+ elif alt54 == 3:
+ # C.g:357:4: '(' ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_abstract_declarator_suffix1126)
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_abstract_declarator_suffix1128)
+ if self.failed:
+ return
+
+
+ elif alt54 == 4:
+ # C.g:358:4: '(' parameter_type_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_abstract_declarator_suffix1133)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_parameter_type_list_in_abstract_declarator_suffix1135)
+ self.parameter_type_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_abstract_declarator_suffix1137)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 33, abstract_declarator_suffix_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end abstract_declarator_suffix
+
+
+ # $ANTLR start initializer
+ # C.g:361:1: initializer : ( assignment_expression | '{' initializer_list ( ',' )? '}' );
+ def initializer(self, ):
+
+ initializer_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 34):
+ return
+
+ # C.g:363:2: ( assignment_expression | '{' initializer_list ( ',' )? '}' )
+ alt56 = 2
+ LA56_0 = self.input.LA(1)
+
+ if ((IDENTIFIER <= LA56_0 <= FLOATING_POINT_LITERAL) or LA56_0 == 62 or LA56_0 == 66 or (68 <= LA56_0 <= 69) or (72 <= LA56_0 <= 74) or (77 <= LA56_0 <= 79)) :
+ alt56 = 1
+ elif (LA56_0 == 43) :
+ alt56 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("361:1: initializer : ( assignment_expression | '{' initializer_list ( ',' )? '}' );", 56, 0, self.input)
+
+ raise nvae
+
+ if alt56 == 1:
+ # C.g:363:4: assignment_expression
+ self.following.append(self.FOLLOW_assignment_expression_in_initializer1150)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt56 == 2:
+ # C.g:364:4: '{' initializer_list ( ',' )? '}'
+ self.match(self.input, 43, self.FOLLOW_43_in_initializer1155)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_initializer_list_in_initializer1157)
+ self.initializer_list()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:364:25: ( ',' )?
+ alt55 = 2
+ LA55_0 = self.input.LA(1)
+
+ if (LA55_0 == 27) :
+ alt55 = 1
+ if alt55 == 1:
+ # C.g:0:0: ','
+ self.match(self.input, 27, self.FOLLOW_27_in_initializer1159)
+ if self.failed:
+ return
+
+
+
+ self.match(self.input, 44, self.FOLLOW_44_in_initializer1162)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 34, initializer_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end initializer
+
+
+ # $ANTLR start initializer_list
+ # C.g:367:1: initializer_list : initializer ( ',' initializer )* ;
+ def initializer_list(self, ):
+
+ initializer_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 35):
+ return
+
+ # C.g:368:2: ( initializer ( ',' initializer )* )
+ # C.g:368:4: initializer ( ',' initializer )*
+ self.following.append(self.FOLLOW_initializer_in_initializer_list1173)
+ self.initializer()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:368:16: ( ',' initializer )*
+ while True: #loop57
+ alt57 = 2
+ LA57_0 = self.input.LA(1)
+
+ if (LA57_0 == 27) :
+ LA57_1 = self.input.LA(2)
+
+ if ((IDENTIFIER <= LA57_1 <= FLOATING_POINT_LITERAL) or LA57_1 == 43 or LA57_1 == 62 or LA57_1 == 66 or (68 <= LA57_1 <= 69) or (72 <= LA57_1 <= 74) or (77 <= LA57_1 <= 79)) :
+ alt57 = 1
+
+
+
+
+ if alt57 == 1:
+ # C.g:368:17: ',' initializer
+ self.match(self.input, 27, self.FOLLOW_27_in_initializer_list1176)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_initializer_in_initializer_list1178)
+ self.initializer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop57
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 35, initializer_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end initializer_list
+
+ class argument_expression_list_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start argument_expression_list
+ # C.g:373:1: argument_expression_list : assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* ;
+ def argument_expression_list(self, ):
+
+ retval = self.argument_expression_list_return()
+ retval.start = self.input.LT(1)
+ argument_expression_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 36):
+ return retval
+
+ # C.g:374:2: ( assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* )
+ # C.g:374:6: assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )*
+ self.following.append(self.FOLLOW_assignment_expression_in_argument_expression_list1196)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:374:28: ( 'OPTIONAL' )?
+ alt58 = 2
+ LA58_0 = self.input.LA(1)
+
+ if (LA58_0 == 53) :
+ alt58 = 1
+ if alt58 == 1:
+ # C.g:374:29: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_argument_expression_list1199)
+ if self.failed:
+ return retval
+
+
+
+ # C.g:374:42: ( ',' assignment_expression ( 'OPTIONAL' )? )*
+ while True: #loop60
+ alt60 = 2
+ LA60_0 = self.input.LA(1)
+
+ if (LA60_0 == 27) :
+ alt60 = 1
+
+
+ if alt60 == 1:
+ # C.g:374:43: ',' assignment_expression ( 'OPTIONAL' )?
+ self.match(self.input, 27, self.FOLLOW_27_in_argument_expression_list1204)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_assignment_expression_in_argument_expression_list1206)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:374:69: ( 'OPTIONAL' )?
+ alt59 = 2
+ LA59_0 = self.input.LA(1)
+
+ if (LA59_0 == 53) :
+ alt59 = 1
+ if alt59 == 1:
+ # C.g:374:70: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_argument_expression_list1209)
+ if self.failed:
+ return retval
+
+
+
+
+
+ else:
+ break #loop60
+
+
+
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 36, argument_expression_list_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end argument_expression_list
+
+
+ # $ANTLR start additive_expression
+ # C.g:377:1: additive_expression : ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* ;
+ def additive_expression(self, ):
+
+ additive_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 37):
+ return
+
+ # C.g:378:2: ( ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* )
+ # C.g:378:4: ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )*
+ # C.g:378:4: ( multiplicative_expression )
+ # C.g:378:5: multiplicative_expression
+ self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1225)
+ self.multiplicative_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ # C.g:378:32: ( '+' multiplicative_expression | '-' multiplicative_expression )*
+ while True: #loop61
+ alt61 = 3
+ LA61_0 = self.input.LA(1)
+
+ if (LA61_0 == 68) :
+ alt61 = 1
+ elif (LA61_0 == 69) :
+ alt61 = 2
+
+
+ if alt61 == 1:
+ # C.g:378:33: '+' multiplicative_expression
+ self.match(self.input, 68, self.FOLLOW_68_in_additive_expression1229)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1231)
+ self.multiplicative_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt61 == 2:
+ # C.g:378:65: '-' multiplicative_expression
+ self.match(self.input, 69, self.FOLLOW_69_in_additive_expression1235)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1237)
+ self.multiplicative_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop61
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 37, additive_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end additive_expression
+
+
+ # $ANTLR start multiplicative_expression
+ # C.g:381:1: multiplicative_expression : ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* ;
+ def multiplicative_expression(self, ):
+
+ multiplicative_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 38):
+ return
+
+ # C.g:382:2: ( ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* )
+ # C.g:382:4: ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )*
+ # C.g:382:4: ( cast_expression )
+ # C.g:382:5: cast_expression
+ self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1251)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ # C.g:382:22: ( '*' cast_expression | '/' cast_expression | '%' cast_expression )*
+ while True: #loop62
+ alt62 = 4
+ LA62 = self.input.LA(1)
+ if LA62 == 66:
+ alt62 = 1
+ elif LA62 == 70:
+ alt62 = 2
+ elif LA62 == 71:
+ alt62 = 3
+
+ if alt62 == 1:
+ # C.g:382:23: '*' cast_expression
+ self.match(self.input, 66, self.FOLLOW_66_in_multiplicative_expression1255)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1257)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt62 == 2:
+ # C.g:382:45: '/' cast_expression
+ self.match(self.input, 70, self.FOLLOW_70_in_multiplicative_expression1261)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1263)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt62 == 3:
+ # C.g:382:67: '%' cast_expression
+ self.match(self.input, 71, self.FOLLOW_71_in_multiplicative_expression1267)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1269)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop62
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 38, multiplicative_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end multiplicative_expression
+
+
+ # $ANTLR start cast_expression
+ # C.g:385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );
+ def cast_expression(self, ):
+
+ cast_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 39):
+ return
+
+ # C.g:386:2: ( '(' type_name ')' cast_expression | unary_expression )
+ alt63 = 2
+ LA63_0 = self.input.LA(1)
+
+ if (LA63_0 == 62) :
+ LA63 = self.input.LA(2)
+ if LA63 == 34 or LA63 == 35 or LA63 == 36 or LA63 == 37 or LA63 == 38 or LA63 == 39 or LA63 == 40 or LA63 == 41 or LA63 == 42 or LA63 == 45 or LA63 == 46 or LA63 == 48 or LA63 == 49 or LA63 == 50 or LA63 == 51 or LA63 == 52 or LA63 == 53 or LA63 == 54 or LA63 == 55 or LA63 == 56 or LA63 == 57 or LA63 == 58 or LA63 == 59 or LA63 == 60 or LA63 == 61:
+ alt63 = 1
+ elif LA63 == IDENTIFIER:
+ LA63_25 = self.input.LA(3)
+
+ if (self.synpred109()) :
+ alt63 = 1
+ elif (True) :
+ alt63 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 25, self.input)
+
+ raise nvae
+
+ elif LA63 == HEX_LITERAL or LA63 == OCTAL_LITERAL or LA63 == DECIMAL_LITERAL or LA63 == CHARACTER_LITERAL or LA63 == STRING_LITERAL or LA63 == FLOATING_POINT_LITERAL or LA63 == 62 or LA63 == 66 or LA63 == 68 or LA63 == 69 or LA63 == 72 or LA63 == 73 or LA63 == 74 or LA63 == 77 or LA63 == 78 or LA63 == 79:
+ alt63 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 1, self.input)
+
+ raise nvae
+
+ elif ((IDENTIFIER <= LA63_0 <= FLOATING_POINT_LITERAL) or LA63_0 == 66 or (68 <= LA63_0 <= 69) or (72 <= LA63_0 <= 74) or (77 <= LA63_0 <= 79)) :
+ alt63 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 0, self.input)
+
+ raise nvae
+
+ if alt63 == 1:
+ # C.g:386:4: '(' type_name ')' cast_expression
+ self.match(self.input, 62, self.FOLLOW_62_in_cast_expression1282)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_type_name_in_cast_expression1284)
+ self.type_name()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_cast_expression1286)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_cast_expression_in_cast_expression1288)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt63 == 2:
+ # C.g:387:4: unary_expression
+ self.following.append(self.FOLLOW_unary_expression_in_cast_expression1293)
+ self.unary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 39, cast_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end cast_expression
+
+
+ # $ANTLR start unary_expression
+ # C.g:390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );
+ def unary_expression(self, ):
+
+ unary_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 40):
+ return
+
+ # C.g:391:2: ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' )
+ alt64 = 6
+ LA64 = self.input.LA(1)
+ if LA64 == IDENTIFIER or LA64 == HEX_LITERAL or LA64 == OCTAL_LITERAL or LA64 == DECIMAL_LITERAL or LA64 == CHARACTER_LITERAL or LA64 == STRING_LITERAL or LA64 == FLOATING_POINT_LITERAL or LA64 == 62:
+ alt64 = 1
+ elif LA64 == 72:
+ alt64 = 2
+ elif LA64 == 73:
+ alt64 = 3
+ elif LA64 == 66 or LA64 == 68 or LA64 == 69 or LA64 == 77 or LA64 == 78 or LA64 == 79:
+ alt64 = 4
+ elif LA64 == 74:
+ LA64_12 = self.input.LA(2)
+
+ if (LA64_12 == 62) :
+ LA64_13 = self.input.LA(3)
+
+ if (self.synpred114()) :
+ alt64 = 5
+ elif (True) :
+ alt64 = 6
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 13, self.input)
+
+ raise nvae
+
+ elif ((IDENTIFIER <= LA64_12 <= FLOATING_POINT_LITERAL) or LA64_12 == 66 or (68 <= LA64_12 <= 69) or (72 <= LA64_12 <= 74) or (77 <= LA64_12 <= 79)) :
+ alt64 = 5
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 12, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 0, self.input)
+
+ raise nvae
+
+ if alt64 == 1:
+ # C.g:391:4: postfix_expression
+ self.following.append(self.FOLLOW_postfix_expression_in_unary_expression1304)
+ self.postfix_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt64 == 2:
+ # C.g:392:4: '++' unary_expression
+ self.match(self.input, 72, self.FOLLOW_72_in_unary_expression1309)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_unary_expression_in_unary_expression1311)
+ self.unary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt64 == 3:
+ # C.g:393:4: '--' unary_expression
+ self.match(self.input, 73, self.FOLLOW_73_in_unary_expression1316)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_unary_expression_in_unary_expression1318)
+ self.unary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt64 == 4:
+ # C.g:394:4: unary_operator cast_expression
+ self.following.append(self.FOLLOW_unary_operator_in_unary_expression1323)
+ self.unary_operator()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_cast_expression_in_unary_expression1325)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt64 == 5:
+ # C.g:395:4: 'sizeof' unary_expression
+ self.match(self.input, 74, self.FOLLOW_74_in_unary_expression1330)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_unary_expression_in_unary_expression1332)
+ self.unary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt64 == 6:
+ # C.g:396:4: 'sizeof' '(' type_name ')'
+ self.match(self.input, 74, self.FOLLOW_74_in_unary_expression1337)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_unary_expression1339)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_type_name_in_unary_expression1341)
+ self.type_name()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_unary_expression1343)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 40, unary_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end unary_expression
+
+
+ # $ANTLR start postfix_expression
+ # C.g:399:1: postfix_expression : p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* ;
+ def postfix_expression(self, ):
+ self.postfix_expression_stack.append(postfix_expression_scope())
+ postfix_expression_StartIndex = self.input.index()
+ a = None
+ b = None
+ x = None
+ y = None
+ z = None
+ p = None
+
+ c = None
+
+
+
+ self.postfix_expression_stack[-1].FuncCallText = ''
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 41):
+ return
+
+ # C.g:406:2: (p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* )
+ # C.g:406:6: p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )*
+ self.following.append(self.FOLLOW_primary_expression_in_postfix_expression1367)
+ p = self.primary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.postfix_expression_stack[-1].FuncCallText += self.input.toString(p.start, p.stop)
+
+ # C.g:407:9: ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )*
+ while True: #loop65
+ alt65 = 10
+ LA65 = self.input.LA(1)
+ if LA65 == 66:
+ LA65_1 = self.input.LA(2)
+
+ if (LA65_1 == IDENTIFIER) :
+ LA65_30 = self.input.LA(3)
+
+ if (self.synpred120()) :
+ alt65 = 6
+
+
+
+
+ elif LA65 == 64:
+ alt65 = 1
+ elif LA65 == 62:
+ LA65 = self.input.LA(2)
+ if LA65 == 63:
+ alt65 = 2
+ elif LA65 == 29 or LA65 == 30 or LA65 == 31 or LA65 == 32 or LA65 == 33 or LA65 == 34 or LA65 == 35 or LA65 == 36 or LA65 == 37 or LA65 == 38 or LA65 == 39 or LA65 == 40 or LA65 == 41 or LA65 == 42 or LA65 == 45 or LA65 == 46 or LA65 == 48 or LA65 == 49 or LA65 == 50 or LA65 == 51 or LA65 == 52 or LA65 == 53 or LA65 == 54 or LA65 == 55 or LA65 == 56 or LA65 == 57 or LA65 == 58 or LA65 == 59 or LA65 == 60 or LA65 == 61:
+ alt65 = 4
+ elif LA65 == IDENTIFIER:
+ LA65_55 = self.input.LA(3)
+
+ if (self.synpred117()) :
+ alt65 = 3
+ elif (self.synpred118()) :
+ alt65 = 4
+
+
+ elif LA65 == 66:
+ LA65_57 = self.input.LA(3)
+
+ if (self.synpred117()) :
+ alt65 = 3
+ elif (self.synpred118()) :
+ alt65 = 4
+
+
+ elif LA65 == HEX_LITERAL or LA65 == OCTAL_LITERAL or LA65 == DECIMAL_LITERAL or LA65 == CHARACTER_LITERAL or LA65 == STRING_LITERAL or LA65 == FLOATING_POINT_LITERAL or LA65 == 62 or LA65 == 68 or LA65 == 69 or LA65 == 72 or LA65 == 73 or LA65 == 74 or LA65 == 77 or LA65 == 78 or LA65 == 79:
+ alt65 = 3
+
+ elif LA65 == 75:
+ alt65 = 5
+ elif LA65 == 76:
+ alt65 = 7
+ elif LA65 == 72:
+ alt65 = 8
+ elif LA65 == 73:
+ alt65 = 9
+
+ if alt65 == 1:
+ # C.g:407:13: '[' expression ']'
+ self.match(self.input, 64, self.FOLLOW_64_in_postfix_expression1383)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_postfix_expression1385)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 65, self.FOLLOW_65_in_postfix_expression1387)
+ if self.failed:
+ return
+
+
+ elif alt65 == 2:
+ # C.g:408:13: '(' a= ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1401)
+ if self.failed:
+ return
+ a = self.input.LT(1)
+ self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1405)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StoreFunctionCalling(p.start.line, p.start.charPositionInLine, a.line, a.charPositionInLine, self.postfix_expression_stack[-1].FuncCallText, '')
+
+
+
+ elif alt65 == 3:
+ # C.g:409:13: '(' c= argument_expression_list b= ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1420)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_argument_expression_list_in_postfix_expression1424)
+ c = self.argument_expression_list()
+ self.following.pop()
+ if self.failed:
+ return
+ b = self.input.LT(1)
+ self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1428)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StoreFunctionCalling(p.start.line, p.start.charPositionInLine, b.line, b.charPositionInLine, self.postfix_expression_stack[-1].FuncCallText, self.input.toString(c.start, c.stop))
+
+
+
+ elif alt65 == 4:
+ # C.g:410:13: '(' macro_parameter_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1444)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_macro_parameter_list_in_postfix_expression1446)
+ self.macro_parameter_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1448)
+ if self.failed:
+ return
+
+
+ elif alt65 == 5:
+ # C.g:411:13: '.' x= IDENTIFIER
+ self.match(self.input, 75, self.FOLLOW_75_in_postfix_expression1462)
+ if self.failed:
+ return
+ x = self.input.LT(1)
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1466)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.postfix_expression_stack[-1].FuncCallText += '.' + x.text
+
+
+
+ elif alt65 == 6:
+ # C.g:412:13: '*' y= IDENTIFIER
+ self.match(self.input, 66, self.FOLLOW_66_in_postfix_expression1482)
+ if self.failed:
+ return
+ y = self.input.LT(1)
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1486)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.postfix_expression_stack[-1].FuncCallText = y.text
+
+
+
+ elif alt65 == 7:
+ # C.g:413:13: '->' z= IDENTIFIER
+ self.match(self.input, 76, self.FOLLOW_76_in_postfix_expression1502)
+ if self.failed:
+ return
+ z = self.input.LT(1)
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1506)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.postfix_expression_stack[-1].FuncCallText += '->' + z.text
+
+
+
+ elif alt65 == 8:
+ # C.g:414:13: '++'
+ self.match(self.input, 72, self.FOLLOW_72_in_postfix_expression1522)
+ if self.failed:
+ return
+
+
+ elif alt65 == 9:
+ # C.g:415:13: '--'
+ self.match(self.input, 73, self.FOLLOW_73_in_postfix_expression1536)
+ if self.failed:
+ return
+
+
+ else:
+ break #loop65
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 41, postfix_expression_StartIndex)
+
+ self.postfix_expression_stack.pop()
+ pass
+
+ return
+
+ # $ANTLR end postfix_expression
+
+
+ # $ANTLR start macro_parameter_list
+ # C.g:419:1: macro_parameter_list : parameter_declaration ( ',' parameter_declaration )* ;
+ def macro_parameter_list(self, ):
+
+ macro_parameter_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 42):
+ return
+
+ # C.g:420:2: ( parameter_declaration ( ',' parameter_declaration )* )
+ # C.g:420:4: parameter_declaration ( ',' parameter_declaration )*
+ self.following.append(self.FOLLOW_parameter_declaration_in_macro_parameter_list1559)
+ self.parameter_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:420:26: ( ',' parameter_declaration )*
+ while True: #loop66
+ alt66 = 2
+ LA66_0 = self.input.LA(1)
+
+ if (LA66_0 == 27) :
+ alt66 = 1
+
+
+ if alt66 == 1:
+ # C.g:420:27: ',' parameter_declaration
+ self.match(self.input, 27, self.FOLLOW_27_in_macro_parameter_list1562)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_parameter_declaration_in_macro_parameter_list1564)
+ self.parameter_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop66
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 42, macro_parameter_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end macro_parameter_list
+
+
+ # $ANTLR start unary_operator
+ # C.g:423:1: unary_operator : ( '&' | '*' | '+' | '-' | '~' | '!' );
+ def unary_operator(self, ):
+
+ unary_operator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 43):
+ return
+
+ # C.g:424:2: ( '&' | '*' | '+' | '-' | '~' | '!' )
+ # C.g:
+ if self.input.LA(1) == 66 or (68 <= self.input.LA(1) <= 69) or (77 <= self.input.LA(1) <= 79):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_unary_operator0
+ )
+ raise mse
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 43, unary_operator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end unary_operator
+
+ class primary_expression_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start primary_expression
+ # C.g:432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );
+ def primary_expression(self, ):
+
+ retval = self.primary_expression_return()
+ retval.start = self.input.LT(1)
+ primary_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 44):
+ return retval
+
+ # C.g:433:2: ( IDENTIFIER | constant | '(' expression ')' )
+ alt67 = 3
+ LA67 = self.input.LA(1)
+ if LA67 == IDENTIFIER:
+ LA67_1 = self.input.LA(2)
+
+ if (LA67_1 == EOF or LA67_1 == 25 or (27 <= LA67_1 <= 28) or LA67_1 == 44 or LA67_1 == 47 or LA67_1 == 53 or (62 <= LA67_1 <= 66) or (68 <= LA67_1 <= 73) or (75 <= LA67_1 <= 77) or (80 <= LA67_1 <= 102)) :
+ alt67 = 1
+ elif (LA67_1 == IDENTIFIER or LA67_1 == STRING_LITERAL) :
+ alt67 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );", 67, 1, self.input)
+
+ raise nvae
+
+ elif LA67 == HEX_LITERAL or LA67 == OCTAL_LITERAL or LA67 == DECIMAL_LITERAL or LA67 == CHARACTER_LITERAL or LA67 == STRING_LITERAL or LA67 == FLOATING_POINT_LITERAL:
+ alt67 = 2
+ elif LA67 == 62:
+ alt67 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );", 67, 0, self.input)
+
+ raise nvae
+
+ if alt67 == 1:
+ # C.g:433:4: IDENTIFIER
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_primary_expression1613)
+ if self.failed:
+ return retval
+
+
+ elif alt67 == 2:
+ # C.g:434:4: constant
+ self.following.append(self.FOLLOW_constant_in_primary_expression1618)
+ self.constant()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ elif alt67 == 3:
+ # C.g:435:4: '(' expression ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_primary_expression1623)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_expression_in_primary_expression1625)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+ self.match(self.input, 63, self.FOLLOW_63_in_primary_expression1627)
+ if self.failed:
+ return retval
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 44, primary_expression_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end primary_expression
+
+
+ # $ANTLR start constant
+ # C.g:438:1: constant : ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL );
+ def constant(self, ):
+
+ constant_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 45):
+ return
+
+ # C.g:439:5: ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL )
+ alt72 = 6
+ LA72 = self.input.LA(1)
+ if LA72 == HEX_LITERAL:
+ alt72 = 1
+ elif LA72 == OCTAL_LITERAL:
+ alt72 = 2
+ elif LA72 == DECIMAL_LITERAL:
+ alt72 = 3
+ elif LA72 == CHARACTER_LITERAL:
+ alt72 = 4
+ elif LA72 == IDENTIFIER or LA72 == STRING_LITERAL:
+ alt72 = 5
+ elif LA72 == FLOATING_POINT_LITERAL:
+ alt72 = 6
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("438:1: constant : ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL );", 72, 0, self.input)
+
+ raise nvae
+
+ if alt72 == 1:
+ # C.g:439:9: HEX_LITERAL
+ self.match(self.input, HEX_LITERAL, self.FOLLOW_HEX_LITERAL_in_constant1643)
+ if self.failed:
+ return
+
+
+ elif alt72 == 2:
+ # C.g:440:9: OCTAL_LITERAL
+ self.match(self.input, OCTAL_LITERAL, self.FOLLOW_OCTAL_LITERAL_in_constant1653)
+ if self.failed:
+ return
+
+
+ elif alt72 == 3:
+ # C.g:441:9: DECIMAL_LITERAL
+ self.match(self.input, DECIMAL_LITERAL, self.FOLLOW_DECIMAL_LITERAL_in_constant1663)
+ if self.failed:
+ return
+
+
+ elif alt72 == 4:
+ # C.g:442:7: CHARACTER_LITERAL
+ self.match(self.input, CHARACTER_LITERAL, self.FOLLOW_CHARACTER_LITERAL_in_constant1671)
+ if self.failed:
+ return
+
+
+ elif alt72 == 5:
+ # C.g:443:7: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )*
+ # C.g:443:7: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+
+ cnt70 = 0
+ while True: #loop70
+ alt70 = 2
+ LA70_0 = self.input.LA(1)
+
+ if (LA70_0 == IDENTIFIER) :
+ LA70_1 = self.input.LA(2)
+
+ if (LA70_1 == STRING_LITERAL) :
+ alt70 = 1
+ elif (LA70_1 == IDENTIFIER) :
+ LA70_33 = self.input.LA(3)
+
+ if (self.synpred138()) :
+ alt70 = 1
+
+
+
+
+ elif (LA70_0 == STRING_LITERAL) :
+ alt70 = 1
+
+
+ if alt70 == 1:
+ # C.g:443:8: ( IDENTIFIER )* ( STRING_LITERAL )+
+ # C.g:443:8: ( IDENTIFIER )*
+ while True: #loop68
+ alt68 = 2
+ LA68_0 = self.input.LA(1)
+
+ if (LA68_0 == IDENTIFIER) :
+ alt68 = 1
+
+
+ if alt68 == 1:
+ # C.g:0:0: IDENTIFIER
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_constant1680)
+ if self.failed:
+ return
+
+
+ else:
+ break #loop68
+
+
+ # C.g:443:20: ( STRING_LITERAL )+
+ cnt69 = 0
+ while True: #loop69
+ alt69 = 2
+ LA69_0 = self.input.LA(1)
+
+ if (LA69_0 == STRING_LITERAL) :
+ LA69_31 = self.input.LA(2)
+
+ if (self.synpred137()) :
+ alt69 = 1
+
+
+
+
+ if alt69 == 1:
+ # C.g:0:0: STRING_LITERAL
+ self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_constant1683)
+ if self.failed:
+ return
+
+
+ else:
+ if cnt69 >= 1:
+ break #loop69
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(69, self.input)
+ raise eee
+
+ cnt69 += 1
+
+
+
+
+ else:
+ if cnt70 >= 1:
+ break #loop70
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(70, self.input)
+ raise eee
+
+ cnt70 += 1
+
+
+ # C.g:443:38: ( IDENTIFIER )*
+ while True: #loop71
+ alt71 = 2
+ LA71_0 = self.input.LA(1)
+
+ if (LA71_0 == IDENTIFIER) :
+ alt71 = 1
+
+
+ if alt71 == 1:
+ # C.g:0:0: IDENTIFIER
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_constant1688)
+ if self.failed:
+ return
+
+
+ else:
+ break #loop71
+
+
+
+
+ elif alt72 == 6:
+ # C.g:444:9: FLOATING_POINT_LITERAL
+ self.match(self.input, FLOATING_POINT_LITERAL, self.FOLLOW_FLOATING_POINT_LITERAL_in_constant1699)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 45, constant_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end constant
+
+ class expression_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start expression
+ # C.g:449:1: expression : assignment_expression ( ',' assignment_expression )* ;
+ def expression(self, ):
+
+ retval = self.expression_return()
+ retval.start = self.input.LT(1)
+ expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 46):
+ return retval
+
+ # C.g:450:2: ( assignment_expression ( ',' assignment_expression )* )
+ # C.g:450:4: assignment_expression ( ',' assignment_expression )*
+ self.following.append(self.FOLLOW_assignment_expression_in_expression1715)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:450:26: ( ',' assignment_expression )*
+ while True: #loop73
+ alt73 = 2
+ LA73_0 = self.input.LA(1)
+
+ if (LA73_0 == 27) :
+ alt73 = 1
+
+
+ if alt73 == 1:
+ # C.g:450:27: ',' assignment_expression
+ self.match(self.input, 27, self.FOLLOW_27_in_expression1718)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_assignment_expression_in_expression1720)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ else:
+ break #loop73
+
+
+
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 46, expression_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end expression
+
+
+ # $ANTLR start constant_expression
+ # C.g:453:1: constant_expression : conditional_expression ;
+ def constant_expression(self, ):
+
+ constant_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 47):
+ return
+
+ # C.g:454:2: ( conditional_expression )
+ # C.g:454:4: conditional_expression
+ self.following.append(self.FOLLOW_conditional_expression_in_constant_expression1733)
+ self.conditional_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 47, constant_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end constant_expression
+
+
+ # $ANTLR start assignment_expression
+ # C.g:457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );
+ def assignment_expression(self, ):
+
+ assignment_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 48):
+ return
+
+ # C.g:458:2: ( lvalue assignment_operator assignment_expression | conditional_expression )
+ alt74 = 2
+ LA74 = self.input.LA(1)
+ if LA74 == IDENTIFIER:
+ LA74 = self.input.LA(2)
+ if LA74 == 64:
+ LA74_13 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 13, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_14 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 14, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_15 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 15, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_16 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 16, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_17 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 17, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_18 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 18, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_19 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 19, self.input)
+
+ raise nvae
+
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ elif LA74 == STRING_LITERAL:
+ LA74_21 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 21, self.input)
+
+ raise nvae
+
+ elif LA74 == IDENTIFIER:
+ LA74_22 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 22, self.input)
+
+ raise nvae
+
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 1, self.input)
+
+ raise nvae
+
+ elif LA74 == HEX_LITERAL:
+ LA74 = self.input.LA(2)
+ if LA74 == 64:
+ LA74_44 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 44, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_45 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 45, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_46 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 46, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_47 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 47, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_48 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 48, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_49 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 49, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_50 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 50, self.input)
+
+ raise nvae
+
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 2, self.input)
+
+ raise nvae
+
+ elif LA74 == OCTAL_LITERAL:
+ LA74 = self.input.LA(2)
+ if LA74 == 64:
+ LA74_73 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 73, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_74 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 74, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_75 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 75, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_76 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 76, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_77 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 77, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_78 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 78, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_79 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 79, self.input)
+
+ raise nvae
+
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 3, self.input)
+
+ raise nvae
+
+ elif LA74 == DECIMAL_LITERAL:
+ LA74 = self.input.LA(2)
+ if LA74 == 64:
+ LA74_102 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 102, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_103 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 103, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_104 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 104, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_105 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 105, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_106 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 106, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_107 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 107, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_108 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 108, self.input)
+
+ raise nvae
+
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 4, self.input)
+
+ raise nvae
+
+ elif LA74 == CHARACTER_LITERAL:
+ LA74 = self.input.LA(2)
+ if LA74 == 64:
+ LA74_131 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 131, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_132 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 132, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_133 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 133, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_134 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 134, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_135 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 135, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_136 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 136, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_137 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 137, self.input)
+
+ raise nvae
+
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 5, self.input)
+
+ raise nvae
+
+ elif LA74 == STRING_LITERAL:
+ LA74 = self.input.LA(2)
+ if LA74 == IDENTIFIER:
+ LA74_160 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 160, self.input)
+
+ raise nvae
+
+ elif LA74 == 64:
+ LA74_161 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 161, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_162 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 162, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_163 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 163, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_164 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 164, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_165 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 165, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_166 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 166, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_167 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 167, self.input)
+
+ raise nvae
+
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ elif LA74 == STRING_LITERAL:
+ LA74_189 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 189, self.input)
+
+ raise nvae
+
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 6, self.input)
+
+ raise nvae
+
+ elif LA74 == FLOATING_POINT_LITERAL:
+ LA74 = self.input.LA(2)
+ if LA74 == 64:
+ LA74_191 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 191, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_192 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 192, self.input)
+
+ raise nvae
+
+ elif LA74 == 75:
+ LA74_193 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 193, self.input)
+
+ raise nvae
+
+ elif LA74 == 66:
+ LA74_194 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 194, self.input)
+
+ raise nvae
+
+ elif LA74 == 76:
+ LA74_195 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 195, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_196 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 196, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_197 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 197, self.input)
+
+ raise nvae
+
+ elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102:
+ alt74 = 2
+ elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89:
+ alt74 = 1
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 7, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74 = self.input.LA(2)
+ if LA74 == IDENTIFIER:
+ LA74_220 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 220, self.input)
+
+ raise nvae
+
+ elif LA74 == HEX_LITERAL:
+ LA74_221 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 221, self.input)
+
+ raise nvae
+
+ elif LA74 == OCTAL_LITERAL:
+ LA74_222 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 222, self.input)
+
+ raise nvae
+
+ elif LA74 == DECIMAL_LITERAL:
+ LA74_223 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 223, self.input)
+
+ raise nvae
+
+ elif LA74 == CHARACTER_LITERAL:
+ LA74_224 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 224, self.input)
+
+ raise nvae
+
+ elif LA74 == STRING_LITERAL:
+ LA74_225 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 225, self.input)
+
+ raise nvae
+
+ elif LA74 == FLOATING_POINT_LITERAL:
+ LA74_226 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 226, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_227 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 227, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_228 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 228, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_229 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 229, self.input)
+
+ raise nvae
+
+ elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79:
+ LA74_230 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 230, self.input)
+
+ raise nvae
+
+ elif LA74 == 74:
+ LA74_231 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 231, self.input)
+
+ raise nvae
+
+ elif LA74 == 34 or LA74 == 35 or LA74 == 36 or LA74 == 37 or LA74 == 38 or LA74 == 39 or LA74 == 40 or LA74 == 41 or LA74 == 42 or LA74 == 45 or LA74 == 46 or LA74 == 48 or LA74 == 49 or LA74 == 50 or LA74 == 51 or LA74 == 52 or LA74 == 53 or LA74 == 54 or LA74 == 55 or LA74 == 56 or LA74 == 57 or LA74 == 58 or LA74 == 59 or LA74 == 60 or LA74 == 61:
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 8, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74 = self.input.LA(2)
+ if LA74 == IDENTIFIER:
+ LA74_244 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 244, self.input)
+
+ raise nvae
+
+ elif LA74 == HEX_LITERAL:
+ LA74_245 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 245, self.input)
+
+ raise nvae
+
+ elif LA74 == OCTAL_LITERAL:
+ LA74_246 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 246, self.input)
+
+ raise nvae
+
+ elif LA74 == DECIMAL_LITERAL:
+ LA74_247 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 247, self.input)
+
+ raise nvae
+
+ elif LA74 == CHARACTER_LITERAL:
+ LA74_248 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 248, self.input)
+
+ raise nvae
+
+ elif LA74 == STRING_LITERAL:
+ LA74_249 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 249, self.input)
+
+ raise nvae
+
+ elif LA74 == FLOATING_POINT_LITERAL:
+ LA74_250 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 250, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_251 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 251, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_252 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 252, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_253 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 253, self.input)
+
+ raise nvae
+
+ elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79:
+ LA74_254 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 254, self.input)
+
+ raise nvae
+
+ elif LA74 == 74:
+ LA74_255 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 255, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 9, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74 = self.input.LA(2)
+ if LA74 == IDENTIFIER:
+ LA74_256 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 256, self.input)
+
+ raise nvae
+
+ elif LA74 == HEX_LITERAL:
+ LA74_257 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 257, self.input)
+
+ raise nvae
+
+ elif LA74 == OCTAL_LITERAL:
+ LA74_258 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 258, self.input)
+
+ raise nvae
+
+ elif LA74 == DECIMAL_LITERAL:
+ LA74_259 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 259, self.input)
+
+ raise nvae
+
+ elif LA74 == CHARACTER_LITERAL:
+ LA74_260 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 260, self.input)
+
+ raise nvae
+
+ elif LA74 == STRING_LITERAL:
+ LA74_261 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 261, self.input)
+
+ raise nvae
+
+ elif LA74 == FLOATING_POINT_LITERAL:
+ LA74_262 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 262, self.input)
+
+ raise nvae
+
+ elif LA74 == 62:
+ LA74_263 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 263, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_264 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 264, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_265 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 265, self.input)
+
+ raise nvae
+
+ elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79:
+ LA74_266 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 266, self.input)
+
+ raise nvae
+
+ elif LA74 == 74:
+ LA74_267 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 267, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 10, self.input)
+
+ raise nvae
+
+ elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79:
+ LA74 = self.input.LA(2)
+ if LA74 == 62:
+ LA74_268 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 268, self.input)
+
+ raise nvae
+
+ elif LA74 == IDENTIFIER:
+ LA74_269 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 269, self.input)
+
+ raise nvae
+
+ elif LA74 == HEX_LITERAL:
+ LA74_270 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 270, self.input)
+
+ raise nvae
+
+ elif LA74 == OCTAL_LITERAL:
+ LA74_271 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 271, self.input)
+
+ raise nvae
+
+ elif LA74 == DECIMAL_LITERAL:
+ LA74_272 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 272, self.input)
+
+ raise nvae
+
+ elif LA74 == CHARACTER_LITERAL:
+ LA74_273 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 273, self.input)
+
+ raise nvae
+
+ elif LA74 == STRING_LITERAL:
+ LA74_274 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 274, self.input)
+
+ raise nvae
+
+ elif LA74 == FLOATING_POINT_LITERAL:
+ LA74_275 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 275, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_276 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 276, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_277 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 277, self.input)
+
+ raise nvae
+
+ elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79:
+ LA74_278 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 278, self.input)
+
+ raise nvae
+
+ elif LA74 == 74:
+ LA74_279 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 279, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 11, self.input)
+
+ raise nvae
+
+ elif LA74 == 74:
+ LA74 = self.input.LA(2)
+ if LA74 == 62:
+ LA74_280 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 280, self.input)
+
+ raise nvae
+
+ elif LA74 == IDENTIFIER:
+ LA74_281 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 281, self.input)
+
+ raise nvae
+
+ elif LA74 == HEX_LITERAL:
+ LA74_282 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 282, self.input)
+
+ raise nvae
+
+ elif LA74 == OCTAL_LITERAL:
+ LA74_283 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 283, self.input)
+
+ raise nvae
+
+ elif LA74 == DECIMAL_LITERAL:
+ LA74_284 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 284, self.input)
+
+ raise nvae
+
+ elif LA74 == CHARACTER_LITERAL:
+ LA74_285 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 285, self.input)
+
+ raise nvae
+
+ elif LA74 == STRING_LITERAL:
+ LA74_286 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 286, self.input)
+
+ raise nvae
+
+ elif LA74 == FLOATING_POINT_LITERAL:
+ LA74_287 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 287, self.input)
+
+ raise nvae
+
+ elif LA74 == 72:
+ LA74_288 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 288, self.input)
+
+ raise nvae
+
+ elif LA74 == 73:
+ LA74_289 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 289, self.input)
+
+ raise nvae
+
+ elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79:
+ LA74_290 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 290, self.input)
+
+ raise nvae
+
+ elif LA74 == 74:
+ LA74_291 = self.input.LA(3)
+
+ if (self.synpred142()) :
+ alt74 = 1
+ elif (True) :
+ alt74 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 291, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 12, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 0, self.input)
+
+ raise nvae
+
+ if alt74 == 1:
+ # C.g:458:4: lvalue assignment_operator assignment_expression
+ self.following.append(self.FOLLOW_lvalue_in_assignment_expression1744)
+ self.lvalue()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_assignment_operator_in_assignment_expression1746)
+ self.assignment_operator()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_assignment_expression_in_assignment_expression1748)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt74 == 2:
+ # C.g:459:4: conditional_expression
+ self.following.append(self.FOLLOW_conditional_expression_in_assignment_expression1753)
+ self.conditional_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 48, assignment_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end assignment_expression
+
+
+ # $ANTLR start lvalue
+ # C.g:462:1: lvalue : unary_expression ;
+ def lvalue(self, ):
+
+ lvalue_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 49):
+ return
+
+ # C.g:463:2: ( unary_expression )
+ # C.g:463:4: unary_expression
+ self.following.append(self.FOLLOW_unary_expression_in_lvalue1765)
+ self.unary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 49, lvalue_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end lvalue
+
+
+ # $ANTLR start assignment_operator
+ # C.g:466:1: assignment_operator : ( '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' );
+ def assignment_operator(self, ):
+
+ assignment_operator_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 50):
+ return
+
+ # C.g:467:2: ( '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' )
+ # C.g:
+ if self.input.LA(1) == 28 or (80 <= self.input.LA(1) <= 89):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_assignment_operator0
+ )
+ raise mse
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 50, assignment_operator_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end assignment_operator
+
+
+ # $ANTLR start conditional_expression
+ # C.g:480:1: conditional_expression : e= logical_or_expression ( '?' expression ':' conditional_expression )? ;
+ def conditional_expression(self, ):
+
+ conditional_expression_StartIndex = self.input.index()
+ e = None
+
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 51):
+ return
+
+ # C.g:481:2: (e= logical_or_expression ( '?' expression ':' conditional_expression )? )
+ # C.g:481:4: e= logical_or_expression ( '?' expression ':' conditional_expression )?
+ self.following.append(self.FOLLOW_logical_or_expression_in_conditional_expression1839)
+ e = self.logical_or_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:481:28: ( '?' expression ':' conditional_expression )?
+ alt75 = 2
+ LA75_0 = self.input.LA(1)
+
+ if (LA75_0 == 90) :
+ alt75 = 1
+ if alt75 == 1:
+ # C.g:481:29: '?' expression ':' conditional_expression
+ self.match(self.input, 90, self.FOLLOW_90_in_conditional_expression1842)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_conditional_expression1844)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 47, self.FOLLOW_47_in_conditional_expression1846)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_conditional_expression_in_conditional_expression1848)
+ self.conditional_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start, e.stop))
+
+
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 51, conditional_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end conditional_expression
+
+ class logical_or_expression_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start logical_or_expression
+ # C.g:484:1: logical_or_expression : logical_and_expression ( '||' logical_and_expression )* ;
+ def logical_or_expression(self, ):
+
+ retval = self.logical_or_expression_return()
+ retval.start = self.input.LT(1)
+ logical_or_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 52):
+ return retval
+
+ # C.g:485:2: ( logical_and_expression ( '||' logical_and_expression )* )
+ # C.g:485:4: logical_and_expression ( '||' logical_and_expression )*
+ self.following.append(self.FOLLOW_logical_and_expression_in_logical_or_expression1863)
+ self.logical_and_expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+ # C.g:485:27: ( '||' logical_and_expression )*
+ while True: #loop76
+ alt76 = 2
+ LA76_0 = self.input.LA(1)
+
+ if (LA76_0 == 91) :
+ alt76 = 1
+
+
+ if alt76 == 1:
+ # C.g:485:28: '||' logical_and_expression
+ self.match(self.input, 91, self.FOLLOW_91_in_logical_or_expression1866)
+ if self.failed:
+ return retval
+ self.following.append(self.FOLLOW_logical_and_expression_in_logical_or_expression1868)
+ self.logical_and_expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ else:
+ break #loop76
+
+
+
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 52, logical_or_expression_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end logical_or_expression
+
+
+ # $ANTLR start logical_and_expression
+ # C.g:488:1: logical_and_expression : inclusive_or_expression ( '&&' inclusive_or_expression )* ;
+ def logical_and_expression(self, ):
+
+ logical_and_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 53):
+ return
+
+ # C.g:489:2: ( inclusive_or_expression ( '&&' inclusive_or_expression )* )
+ # C.g:489:4: inclusive_or_expression ( '&&' inclusive_or_expression )*
+ self.following.append(self.FOLLOW_inclusive_or_expression_in_logical_and_expression1881)
+ self.inclusive_or_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:489:28: ( '&&' inclusive_or_expression )*
+ while True: #loop77
+ alt77 = 2
+ LA77_0 = self.input.LA(1)
+
+ if (LA77_0 == 92) :
+ alt77 = 1
+
+
+ if alt77 == 1:
+ # C.g:489:29: '&&' inclusive_or_expression
+ self.match(self.input, 92, self.FOLLOW_92_in_logical_and_expression1884)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_inclusive_or_expression_in_logical_and_expression1886)
+ self.inclusive_or_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop77
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 53, logical_and_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end logical_and_expression
+
+
+ # $ANTLR start inclusive_or_expression
+ # C.g:492:1: inclusive_or_expression : exclusive_or_expression ( '|' exclusive_or_expression )* ;
+ def inclusive_or_expression(self, ):
+
+ inclusive_or_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 54):
+ return
+
+ # C.g:493:2: ( exclusive_or_expression ( '|' exclusive_or_expression )* )
+ # C.g:493:4: exclusive_or_expression ( '|' exclusive_or_expression )*
+ self.following.append(self.FOLLOW_exclusive_or_expression_in_inclusive_or_expression1899)
+ self.exclusive_or_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:493:28: ( '|' exclusive_or_expression )*
+ while True: #loop78
+ alt78 = 2
+ LA78_0 = self.input.LA(1)
+
+ if (LA78_0 == 93) :
+ alt78 = 1
+
+
+ if alt78 == 1:
+ # C.g:493:29: '|' exclusive_or_expression
+ self.match(self.input, 93, self.FOLLOW_93_in_inclusive_or_expression1902)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_exclusive_or_expression_in_inclusive_or_expression1904)
+ self.exclusive_or_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop78
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 54, inclusive_or_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end inclusive_or_expression
+
+
+ # $ANTLR start exclusive_or_expression
+ # C.g:496:1: exclusive_or_expression : and_expression ( '^' and_expression )* ;
+ def exclusive_or_expression(self, ):
+
+ exclusive_or_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 55):
+ return
+
+ # C.g:497:2: ( and_expression ( '^' and_expression )* )
+ # C.g:497:4: and_expression ( '^' and_expression )*
+ self.following.append(self.FOLLOW_and_expression_in_exclusive_or_expression1917)
+ self.and_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:497:19: ( '^' and_expression )*
+ while True: #loop79
+ alt79 = 2
+ LA79_0 = self.input.LA(1)
+
+ if (LA79_0 == 94) :
+ alt79 = 1
+
+
+ if alt79 == 1:
+ # C.g:497:20: '^' and_expression
+ self.match(self.input, 94, self.FOLLOW_94_in_exclusive_or_expression1920)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_and_expression_in_exclusive_or_expression1922)
+ self.and_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop79
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 55, exclusive_or_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end exclusive_or_expression
+
+
+ # $ANTLR start and_expression
+ # C.g:500:1: and_expression : equality_expression ( '&' equality_expression )* ;
+ def and_expression(self, ):
+
+ and_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 56):
+ return
+
+ # C.g:501:2: ( equality_expression ( '&' equality_expression )* )
+ # C.g:501:4: equality_expression ( '&' equality_expression )*
+ self.following.append(self.FOLLOW_equality_expression_in_and_expression1935)
+ self.equality_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:501:24: ( '&' equality_expression )*
+ while True: #loop80
+ alt80 = 2
+ LA80_0 = self.input.LA(1)
+
+ if (LA80_0 == 77) :
+ alt80 = 1
+
+
+ if alt80 == 1:
+ # C.g:501:25: '&' equality_expression
+ self.match(self.input, 77, self.FOLLOW_77_in_and_expression1938)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_equality_expression_in_and_expression1940)
+ self.equality_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop80
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 56, and_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end and_expression
+
+
+ # $ANTLR start equality_expression
+ # C.g:503:1: equality_expression : relational_expression ( ( '==' | '!=' ) relational_expression )* ;
+ def equality_expression(self, ):
+
+ equality_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 57):
+ return
+
+ # C.g:504:2: ( relational_expression ( ( '==' | '!=' ) relational_expression )* )
+ # C.g:504:4: relational_expression ( ( '==' | '!=' ) relational_expression )*
+ self.following.append(self.FOLLOW_relational_expression_in_equality_expression1952)
+ self.relational_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:504:26: ( ( '==' | '!=' ) relational_expression )*
+ while True: #loop81
+ alt81 = 2
+ LA81_0 = self.input.LA(1)
+
+ if ((95 <= LA81_0 <= 96)) :
+ alt81 = 1
+
+
+ if alt81 == 1:
+ # C.g:504:27: ( '==' | '!=' ) relational_expression
+ if (95 <= self.input.LA(1) <= 96):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_equality_expression1955
+ )
+ raise mse
+
+
+ self.following.append(self.FOLLOW_relational_expression_in_equality_expression1961)
+ self.relational_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop81
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 57, equality_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end equality_expression
+
+
+ # $ANTLR start relational_expression
+ # C.g:507:1: relational_expression : shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* ;
+ def relational_expression(self, ):
+
+ relational_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 58):
+ return
+
+ # C.g:508:2: ( shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* )
+ # C.g:508:4: shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )*
+ self.following.append(self.FOLLOW_shift_expression_in_relational_expression1975)
+ self.shift_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:508:21: ( ( '<' | '>' | '<=' | '>=' ) shift_expression )*
+ while True: #loop82
+ alt82 = 2
+ LA82_0 = self.input.LA(1)
+
+ if ((97 <= LA82_0 <= 100)) :
+ alt82 = 1
+
+
+ if alt82 == 1:
+ # C.g:508:22: ( '<' | '>' | '<=' | '>=' ) shift_expression
+ if (97 <= self.input.LA(1) <= 100):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_relational_expression1978
+ )
+ raise mse
+
+
+ self.following.append(self.FOLLOW_shift_expression_in_relational_expression1988)
+ self.shift_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop82
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 58, relational_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end relational_expression
+
+
+ # $ANTLR start shift_expression
+ # C.g:511:1: shift_expression : additive_expression ( ( '<<' | '>>' ) additive_expression )* ;
+ def shift_expression(self, ):
+
+ shift_expression_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 59):
+ return
+
+ # C.g:512:2: ( additive_expression ( ( '<<' | '>>' ) additive_expression )* )
+ # C.g:512:4: additive_expression ( ( '<<' | '>>' ) additive_expression )*
+ self.following.append(self.FOLLOW_additive_expression_in_shift_expression2001)
+ self.additive_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:512:24: ( ( '<<' | '>>' ) additive_expression )*
+ while True: #loop83
+ alt83 = 2
+ LA83_0 = self.input.LA(1)
+
+ if ((101 <= LA83_0 <= 102)) :
+ alt83 = 1
+
+
+ if alt83 == 1:
+ # C.g:512:25: ( '<<' | '>>' ) additive_expression
+ if (101 <= self.input.LA(1) <= 102):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_shift_expression2004
+ )
+ raise mse
+
+
+ self.following.append(self.FOLLOW_additive_expression_in_shift_expression2010)
+ self.additive_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop83
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 59, shift_expression_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end shift_expression
+
+
+ # $ANTLR start statement
+ # C.g:517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );
+ def statement(self, ):
+
+ statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 60):
+ return
+
+ # C.g:518:2: ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration )
+ alt84 = 11
+ LA84 = self.input.LA(1)
+ if LA84 == IDENTIFIER:
+ LA84 = self.input.LA(2)
+ if LA84 == 62:
+ LA84_43 = self.input.LA(3)
+
+ if (self.synpred169()) :
+ alt84 = 3
+ elif (self.synpred173()) :
+ alt84 = 7
+ elif (self.synpred174()) :
+ alt84 = 8
+ elif (True) :
+ alt84 = 11
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 43, self.input)
+
+ raise nvae
+
+ elif LA84 == 47:
+ alt84 = 1
+ elif LA84 == STRING_LITERAL or LA84 == 27 or LA84 == 28 or LA84 == 64 or LA84 == 68 or LA84 == 69 or LA84 == 70 or LA84 == 71 or LA84 == 72 or LA84 == 73 or LA84 == 75 or LA84 == 76 or LA84 == 77 or LA84 == 80 or LA84 == 81 or LA84 == 82 or LA84 == 83 or LA84 == 84 or LA84 == 85 or LA84 == 86 or LA84 == 87 or LA84 == 88 or LA84 == 89 or LA84 == 90 or LA84 == 91 or LA84 == 92 or LA84 == 93 or LA84 == 94 or LA84 == 95 or LA84 == 96 or LA84 == 97 or LA84 == 98 or LA84 == 99 or LA84 == 100 or LA84 == 101 or LA84 == 102:
+ alt84 = 3
+ elif LA84 == 66:
+ LA84_47 = self.input.LA(3)
+
+ if (self.synpred169()) :
+ alt84 = 3
+ elif (True) :
+ alt84 = 11
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 47, self.input)
+
+ raise nvae
+
+ elif LA84 == IDENTIFIER:
+ LA84_53 = self.input.LA(3)
+
+ if (self.synpred169()) :
+ alt84 = 3
+ elif (True) :
+ alt84 = 11
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 53, self.input)
+
+ raise nvae
+
+ elif LA84 == 25:
+ LA84_68 = self.input.LA(3)
+
+ if (self.synpred169()) :
+ alt84 = 3
+ elif (True) :
+ alt84 = 11
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 68, self.input)
+
+ raise nvae
+
+ elif LA84 == 29 or LA84 == 30 or LA84 == 31 or LA84 == 32 or LA84 == 33 or LA84 == 34 or LA84 == 35 or LA84 == 36 or LA84 == 37 or LA84 == 38 or LA84 == 39 or LA84 == 40 or LA84 == 41 or LA84 == 42 or LA84 == 45 or LA84 == 46 or LA84 == 48 or LA84 == 49 or LA84 == 50 or LA84 == 51 or LA84 == 52 or LA84 == 53 or LA84 == 54 or LA84 == 55 or LA84 == 56 or LA84 == 57 or LA84 == 58 or LA84 == 59 or LA84 == 60 or LA84 == 61:
+ alt84 = 11
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 1, self.input)
+
+ raise nvae
+
+ elif LA84 == 106 or LA84 == 107:
+ alt84 = 1
+ elif LA84 == 43:
+ alt84 = 2
+ elif LA84 == HEX_LITERAL or LA84 == OCTAL_LITERAL or LA84 == DECIMAL_LITERAL or LA84 == CHARACTER_LITERAL or LA84 == STRING_LITERAL or LA84 == FLOATING_POINT_LITERAL or LA84 == 25 or LA84 == 62 or LA84 == 66 or LA84 == 68 or LA84 == 69 or LA84 == 72 or LA84 == 73 or LA84 == 74 or LA84 == 77 or LA84 == 78 or LA84 == 79:
+ alt84 = 3
+ elif LA84 == 108 or LA84 == 110:
+ alt84 = 4
+ elif LA84 == 111 or LA84 == 112 or LA84 == 113:
+ alt84 = 5
+ elif LA84 == 114 or LA84 == 115 or LA84 == 116 or LA84 == 117:
+ alt84 = 6
+ elif LA84 == 103:
+ alt84 = 8
+ elif LA84 == 104:
+ alt84 = 9
+ elif LA84 == 105:
+ alt84 = 10
+ elif LA84 == 26 or LA84 == 29 or LA84 == 30 or LA84 == 31 or LA84 == 32 or LA84 == 33 or LA84 == 34 or LA84 == 35 or LA84 == 36 or LA84 == 37 or LA84 == 38 or LA84 == 39 or LA84 == 40 or LA84 == 41 or LA84 == 42 or LA84 == 45 or LA84 == 46 or LA84 == 48 or LA84 == 49 or LA84 == 50 or LA84 == 51 or LA84 == 52 or LA84 == 53 or LA84 == 54 or LA84 == 55 or LA84 == 56 or LA84 == 57 or LA84 == 58 or LA84 == 59 or LA84 == 60 or LA84 == 61:
+ alt84 = 11
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 0, self.input)
+
+ raise nvae
+
+ if alt84 == 1:
+ # C.g:518:4: labeled_statement
+ self.following.append(self.FOLLOW_labeled_statement_in_statement2025)
+ self.labeled_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 2:
+ # C.g:519:4: compound_statement
+ self.following.append(self.FOLLOW_compound_statement_in_statement2030)
+ self.compound_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 3:
+ # C.g:520:4: expression_statement
+ self.following.append(self.FOLLOW_expression_statement_in_statement2035)
+ self.expression_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 4:
+ # C.g:521:4: selection_statement
+ self.following.append(self.FOLLOW_selection_statement_in_statement2040)
+ self.selection_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 5:
+ # C.g:522:4: iteration_statement
+ self.following.append(self.FOLLOW_iteration_statement_in_statement2045)
+ self.iteration_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 6:
+ # C.g:523:4: jump_statement
+ self.following.append(self.FOLLOW_jump_statement_in_statement2050)
+ self.jump_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 7:
+ # C.g:524:4: macro_statement
+ self.following.append(self.FOLLOW_macro_statement_in_statement2055)
+ self.macro_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 8:
+ # C.g:525:4: asm2_statement
+ self.following.append(self.FOLLOW_asm2_statement_in_statement2060)
+ self.asm2_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 9:
+ # C.g:526:4: asm1_statement
+ self.following.append(self.FOLLOW_asm1_statement_in_statement2065)
+ self.asm1_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 10:
+ # C.g:527:4: asm_statement
+ self.following.append(self.FOLLOW_asm_statement_in_statement2070)
+ self.asm_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt84 == 11:
+ # C.g:528:4: declaration
+ self.following.append(self.FOLLOW_declaration_in_statement2075)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 60, statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end statement
+
+
+ # $ANTLR start asm2_statement
+ # C.g:531:1: asm2_statement : ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' ;
+ def asm2_statement(self, ):
+
+ asm2_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 61):
+ return
+
+ # C.g:532:2: ( ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' )
+ # C.g:532:4: ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';'
+ # C.g:532:4: ( '__asm__' )?
+ alt85 = 2
+ LA85_0 = self.input.LA(1)
+
+ if (LA85_0 == 103) :
+ alt85 = 1
+ if alt85 == 1:
+ # C.g:0:0: '__asm__'
+ self.match(self.input, 103, self.FOLLOW_103_in_asm2_statement2086)
+ if self.failed:
+ return
+
+
+
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_asm2_statement2089)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_asm2_statement2091)
+ if self.failed:
+ return
+ # C.g:532:30: (~ ( ';' ) )*
+ while True: #loop86
+ alt86 = 2
+ LA86_0 = self.input.LA(1)
+
+ if (LA86_0 == 63) :
+ LA86_1 = self.input.LA(2)
+
+ if ((IDENTIFIER <= LA86_1 <= LINE_COMMAND) or (26 <= LA86_1 <= 117)) :
+ alt86 = 1
+
+
+ elif ((IDENTIFIER <= LA86_0 <= LINE_COMMAND) or (26 <= LA86_0 <= 62) or (64 <= LA86_0 <= 117)) :
+ alt86 = 1
+
+
+ if alt86 == 1:
+ # C.g:532:31: ~ ( ';' )
+ if (IDENTIFIER <= self.input.LA(1) <= LINE_COMMAND) or (26 <= self.input.LA(1) <= 117):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_asm2_statement2094
+ )
+ raise mse
+
+
+
+
+ else:
+ break #loop86
+
+
+ self.match(self.input, 63, self.FOLLOW_63_in_asm2_statement2101)
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_asm2_statement2103)
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 61, asm2_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end asm2_statement
+
+
+ # $ANTLR start asm1_statement
+ # C.g:535:1: asm1_statement : '_asm' '{' (~ ( '}' ) )* '}' ;
+ def asm1_statement(self, ):
+
+ asm1_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 62):
+ return
+
+ # C.g:536:2: ( '_asm' '{' (~ ( '}' ) )* '}' )
+ # C.g:536:4: '_asm' '{' (~ ( '}' ) )* '}'
+ self.match(self.input, 104, self.FOLLOW_104_in_asm1_statement2115)
+ if self.failed:
+ return
+ self.match(self.input, 43, self.FOLLOW_43_in_asm1_statement2117)
+ if self.failed:
+ return
+ # C.g:536:15: (~ ( '}' ) )*
+ while True: #loop87
+ alt87 = 2
+ LA87_0 = self.input.LA(1)
+
+ if ((IDENTIFIER <= LA87_0 <= 43) or (45 <= LA87_0 <= 117)) :
+ alt87 = 1
+
+
+ if alt87 == 1:
+ # C.g:536:16: ~ ( '}' )
+ if (IDENTIFIER <= self.input.LA(1) <= 43) or (45 <= self.input.LA(1) <= 117):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_asm1_statement2120
+ )
+ raise mse
+
+
+
+
+ else:
+ break #loop87
+
+
+ self.match(self.input, 44, self.FOLLOW_44_in_asm1_statement2127)
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 62, asm1_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end asm1_statement
+
+
+ # $ANTLR start asm_statement
+ # C.g:539:1: asm_statement : '__asm' '{' (~ ( '}' ) )* '}' ;
+ def asm_statement(self, ):
+
+ asm_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 63):
+ return
+
+ # C.g:540:2: ( '__asm' '{' (~ ( '}' ) )* '}' )
+ # C.g:540:4: '__asm' '{' (~ ( '}' ) )* '}'
+ self.match(self.input, 105, self.FOLLOW_105_in_asm_statement2138)
+ if self.failed:
+ return
+ self.match(self.input, 43, self.FOLLOW_43_in_asm_statement2140)
+ if self.failed:
+ return
+ # C.g:540:16: (~ ( '}' ) )*
+ while True: #loop88
+ alt88 = 2
+ LA88_0 = self.input.LA(1)
+
+ if ((IDENTIFIER <= LA88_0 <= 43) or (45 <= LA88_0 <= 117)) :
+ alt88 = 1
+
+
+ if alt88 == 1:
+ # C.g:540:17: ~ ( '}' )
+ if (IDENTIFIER <= self.input.LA(1) <= 43) or (45 <= self.input.LA(1) <= 117):
+ self.input.consume();
+ self.errorRecovery = False
+ self.failed = False
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ mse = MismatchedSetException(None, self.input)
+ self.recoverFromMismatchedSet(
+ self.input, mse, self.FOLLOW_set_in_asm_statement2143
+ )
+ raise mse
+
+
+
+
+ else:
+ break #loop88
+
+
+ self.match(self.input, 44, self.FOLLOW_44_in_asm_statement2150)
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 63, asm_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end asm_statement
+
+
+ # $ANTLR start macro_statement
+ # C.g:543:1: macro_statement : IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' ;
+ def macro_statement(self, ):
+
+ macro_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 64):
+ return
+
+ # C.g:544:2: ( IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' )
+ # C.g:544:4: IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')'
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_macro_statement2162)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_macro_statement2164)
+ if self.failed:
+ return
+ # C.g:544:19: ( declaration )*
+ while True: #loop89
+ alt89 = 2
+ LA89 = self.input.LA(1)
+ if LA89 == IDENTIFIER:
+ LA89 = self.input.LA(2)
+ if LA89 == 62:
+ LA89_45 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_47 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 66:
+ LA89_50 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_68 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_71 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_72 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_73 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_74 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_75 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_76 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_77 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_78 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_79 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_80 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_81 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_82 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_83 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_84 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_85 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_86 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 26:
+ LA89 = self.input.LA(2)
+ if LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_87 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_88 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_89 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_90 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_91 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_92 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_93 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_94 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_95 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_96 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_97 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_98 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_99 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_100 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 66:
+ LA89_101 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_102 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_103 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_104 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_105 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_106 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_107 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_108 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_109 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_110 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_111 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_112 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_113 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_114 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_115 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_116 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_117 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_118 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_119 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_120 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_121 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_122 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_123 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_124 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_125 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 34:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_126 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_127 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_128 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_129 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_130 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_131 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_132 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_133 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_134 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_135 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_136 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_137 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_138 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_139 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_140 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_141 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_142 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_143 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_144 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_145 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 35:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_146 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_147 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_148 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_149 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_150 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_151 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_152 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_153 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_154 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_155 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_156 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_157 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_158 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_159 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_160 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_161 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_162 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_163 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_164 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_165 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 36:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_166 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_167 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_168 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_169 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_170 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_171 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_172 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_173 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_174 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_175 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_176 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_177 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_178 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_179 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_180 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_181 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_182 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_183 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_184 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_185 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 37:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_186 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_187 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_188 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_189 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_190 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_191 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_192 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_193 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_194 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_195 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_196 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_197 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_198 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_199 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_200 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_201 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_202 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_203 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_204 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_205 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 38:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_206 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_207 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_208 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_209 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_210 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_211 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_212 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_213 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_214 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_215 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_216 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_217 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_218 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_219 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_220 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_221 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_222 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_223 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_224 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_225 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 39:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_226 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_227 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_228 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_229 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_230 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_231 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_232 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_233 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_234 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_235 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_236 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_237 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_238 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_239 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_240 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_241 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_242 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_243 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_244 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_245 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 40:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_246 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_247 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_248 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_249 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_250 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_251 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_252 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_253 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_254 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_255 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_256 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_257 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_258 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_259 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_260 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_261 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_262 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_263 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_264 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_265 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 41:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_266 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_267 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_268 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_269 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_270 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_271 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_272 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_273 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_274 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_275 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_276 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_277 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_278 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_279 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_280 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_281 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_282 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_283 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_284 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_285 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 42:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_286 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_287 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_288 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_289 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_290 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_291 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_292 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_293 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_294 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_295 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_296 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_297 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_298 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_299 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_300 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_301 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_302 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_303 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_304 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_305 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_40 = self.input.LA(2)
+
+ if (LA89_40 == IDENTIFIER) :
+ LA89_306 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif (LA89_40 == 43) :
+ LA89_307 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+
+ elif LA89 == 48:
+ LA89_41 = self.input.LA(2)
+
+ if (LA89_41 == 43) :
+ LA89_308 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif (LA89_41 == IDENTIFIER) :
+ LA89_309 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 58 or LA89 == 59 or LA89 == 60 or LA89 == 61:
+ LA89 = self.input.LA(2)
+ if LA89 == 66:
+ LA89_310 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 58:
+ LA89_311 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 59:
+ LA89_312 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 60:
+ LA89_313 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == IDENTIFIER:
+ LA89_314 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 62:
+ LA89_315 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 25:
+ LA89_316 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33:
+ LA89_317 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 34:
+ LA89_318 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 35:
+ LA89_319 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 36:
+ LA89_320 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 37:
+ LA89_321 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 38:
+ LA89_322 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 39:
+ LA89_323 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 40:
+ LA89_324 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 41:
+ LA89_325 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 42:
+ LA89_326 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 45 or LA89 == 46:
+ LA89_327 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 48:
+ LA89_328 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+ elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61:
+ LA89_329 = self.input.LA(3)
+
+ if (self.synpred181()) :
+ alt89 = 1
+
+
+
+
+ if alt89 == 1:
+ # C.g:0:0: declaration
+ self.following.append(self.FOLLOW_declaration_in_macro_statement2166)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop89
+
+
+ # C.g:544:33: ( statement_list )?
+ alt90 = 2
+ LA90 = self.input.LA(1)
+ if LA90 == IDENTIFIER:
+ LA90 = self.input.LA(2)
+ if LA90 == 25 or LA90 == 29 or LA90 == 30 or LA90 == 31 or LA90 == 32 or LA90 == 33 or LA90 == 34 or LA90 == 35 or LA90 == 36 or LA90 == 37 or LA90 == 38 or LA90 == 39 or LA90 == 40 or LA90 == 41 or LA90 == 42 or LA90 == 45 or LA90 == 46 or LA90 == 47 or LA90 == 48 or LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61:
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_45 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_46 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == IDENTIFIER:
+ LA90_47 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 64:
+ LA90_48 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_49 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_50 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_51 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_52 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_53 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_54 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_55 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_56 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_57 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_58 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_59 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_60 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_61 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_62 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_63 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_64 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_65 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_66 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_67 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_70 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25 or LA90 == 26 or LA90 == 29 or LA90 == 30 or LA90 == 31 or LA90 == 32 or LA90 == 33 or LA90 == 34 or LA90 == 35 or LA90 == 36 or LA90 == 37 or LA90 == 38 or LA90 == 39 or LA90 == 40 or LA90 == 41 or LA90 == 42 or LA90 == 43 or LA90 == 45 or LA90 == 46 or LA90 == 48 or LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61 or LA90 == 103 or LA90 == 104 or LA90 == 105 or LA90 == 106 or LA90 == 107 or LA90 == 108 or LA90 == 110 or LA90 == 111 or LA90 == 112 or LA90 == 113 or LA90 == 114 or LA90 == 115 or LA90 == 116 or LA90 == 117:
+ alt90 = 1
+ elif LA90 == HEX_LITERAL:
+ LA90 = self.input.LA(2)
+ if LA90 == 64:
+ LA90_87 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_88 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_89 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_90 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_91 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_92 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_93 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_94 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_95 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_96 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_97 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_98 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_99 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_100 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_101 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_102 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_103 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_104 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_105 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_106 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_107 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_108 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25:
+ alt90 = 1
+ elif LA90 == OCTAL_LITERAL:
+ LA90 = self.input.LA(2)
+ if LA90 == 64:
+ LA90_111 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_112 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_113 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_114 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_115 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_116 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_117 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_118 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_119 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_120 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_121 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_122 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_123 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_124 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_125 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_126 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_127 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_128 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_129 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_130 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_131 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25:
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_134 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == DECIMAL_LITERAL:
+ LA90 = self.input.LA(2)
+ if LA90 == 64:
+ LA90_135 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_136 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_137 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_138 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_139 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_140 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_141 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_142 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_143 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_144 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_145 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_146 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_147 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_148 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_149 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_150 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_151 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_152 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_153 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_154 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_155 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_156 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25:
+ alt90 = 1
+ elif LA90 == CHARACTER_LITERAL:
+ LA90 = self.input.LA(2)
+ if LA90 == 64:
+ LA90_159 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_160 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_161 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_162 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_163 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_164 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_165 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_166 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_167 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_168 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_169 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_170 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_171 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_172 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_173 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_174 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_175 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_176 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_177 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_178 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_179 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25:
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_181 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90 = self.input.LA(2)
+ if LA90 == IDENTIFIER:
+ LA90_183 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 64:
+ LA90_184 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_185 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_186 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_187 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_188 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_189 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_190 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_191 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_192 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_193 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_194 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_195 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_196 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_197 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_198 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_199 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_200 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_201 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_202 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_203 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_204 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_205 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_206 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25:
+ alt90 = 1
+ elif LA90 == FLOATING_POINT_LITERAL:
+ LA90 = self.input.LA(2)
+ if LA90 == 64:
+ LA90_209 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_210 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 75:
+ LA90_211 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66:
+ LA90_212 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 76:
+ LA90_213 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_214 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_215 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89:
+ LA90_216 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 70:
+ LA90_217 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 71:
+ LA90_218 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 68:
+ LA90_219 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 69:
+ LA90_220 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 101 or LA90 == 102:
+ LA90_221 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100:
+ LA90_222 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 95 or LA90 == 96:
+ LA90_223 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 77:
+ LA90_224 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 94:
+ LA90_225 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 93:
+ LA90_226 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 92:
+ LA90_227 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 91:
+ LA90_228 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 90:
+ LA90_229 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 27:
+ LA90_230 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 25:
+ alt90 = 1
+ elif LA90 == 62:
+ LA90 = self.input.LA(2)
+ if LA90 == IDENTIFIER:
+ LA90_233 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == HEX_LITERAL:
+ LA90_234 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == OCTAL_LITERAL:
+ LA90_235 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == DECIMAL_LITERAL:
+ LA90_236 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == CHARACTER_LITERAL:
+ LA90_237 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_238 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == FLOATING_POINT_LITERAL:
+ LA90_239 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_240 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_241 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_242 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79:
+ LA90_243 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 74:
+ LA90_244 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61:
+ LA90_245 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 34:
+ LA90_246 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 35:
+ LA90_247 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 36:
+ LA90_248 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 37:
+ LA90_249 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 38:
+ LA90_250 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 39:
+ LA90_251 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 40:
+ LA90_252 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 41:
+ LA90_253 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 42:
+ LA90_254 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 45 or LA90 == 46:
+ LA90_255 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 48:
+ LA90_256 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90 = self.input.LA(2)
+ if LA90 == IDENTIFIER:
+ LA90_257 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == HEX_LITERAL:
+ LA90_258 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == OCTAL_LITERAL:
+ LA90_259 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == DECIMAL_LITERAL:
+ LA90_260 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == CHARACTER_LITERAL:
+ LA90_261 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_262 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == FLOATING_POINT_LITERAL:
+ LA90_263 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_264 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_265 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_266 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79:
+ LA90_267 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 74:
+ LA90_268 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90 = self.input.LA(2)
+ if LA90 == IDENTIFIER:
+ LA90_269 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == HEX_LITERAL:
+ LA90_270 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == OCTAL_LITERAL:
+ LA90_271 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == DECIMAL_LITERAL:
+ LA90_272 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == CHARACTER_LITERAL:
+ LA90_273 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_274 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == FLOATING_POINT_LITERAL:
+ LA90_275 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 62:
+ LA90_276 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_277 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_278 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79:
+ LA90_279 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 74:
+ LA90_280 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79:
+ LA90 = self.input.LA(2)
+ if LA90 == 62:
+ LA90_281 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == IDENTIFIER:
+ LA90_282 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == HEX_LITERAL:
+ LA90_283 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == OCTAL_LITERAL:
+ LA90_284 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == DECIMAL_LITERAL:
+ LA90_285 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == CHARACTER_LITERAL:
+ LA90_286 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_287 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == FLOATING_POINT_LITERAL:
+ LA90_288 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_289 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_290 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79:
+ LA90_291 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 74:
+ LA90_292 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 74:
+ LA90 = self.input.LA(2)
+ if LA90 == 62:
+ LA90_293 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == IDENTIFIER:
+ LA90_294 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == HEX_LITERAL:
+ LA90_295 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == OCTAL_LITERAL:
+ LA90_296 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == DECIMAL_LITERAL:
+ LA90_297 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == CHARACTER_LITERAL:
+ LA90_298 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == STRING_LITERAL:
+ LA90_299 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == FLOATING_POINT_LITERAL:
+ LA90_300 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 72:
+ LA90_301 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 73:
+ LA90_302 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79:
+ LA90_303 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ elif LA90 == 74:
+ LA90_304 = self.input.LA(3)
+
+ if (self.synpred182()) :
+ alt90 = 1
+ if alt90 == 1:
+ # C.g:0:0: statement_list
+ self.following.append(self.FOLLOW_statement_list_in_macro_statement2170)
+ self.statement_list()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ # C.g:544:49: ( expression )?
+ alt91 = 2
+ LA91_0 = self.input.LA(1)
+
+ if ((IDENTIFIER <= LA91_0 <= FLOATING_POINT_LITERAL) or LA91_0 == 62 or LA91_0 == 66 or (68 <= LA91_0 <= 69) or (72 <= LA91_0 <= 74) or (77 <= LA91_0 <= 79)) :
+ alt91 = 1
+ if alt91 == 1:
+ # C.g:0:0: expression
+ self.following.append(self.FOLLOW_expression_in_macro_statement2173)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ self.match(self.input, 63, self.FOLLOW_63_in_macro_statement2176)
+ if self.failed:
+ return
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 64, macro_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end macro_statement
+
+
+ # $ANTLR start labeled_statement
+ # C.g:547:1: labeled_statement : ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement );
+ def labeled_statement(self, ):
+
+ labeled_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 65):
+ return
+
+ # C.g:548:2: ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement )
+ alt92 = 3
+ LA92 = self.input.LA(1)
+ if LA92 == IDENTIFIER:
+ alt92 = 1
+ elif LA92 == 106:
+ alt92 = 2
+ elif LA92 == 107:
+ alt92 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("547:1: labeled_statement : ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement );", 92, 0, self.input)
+
+ raise nvae
+
+ if alt92 == 1:
+ # C.g:548:4: IDENTIFIER ':' statement
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_labeled_statement2188)
+ if self.failed:
+ return
+ self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2190)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_labeled_statement2192)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt92 == 2:
+ # C.g:549:4: 'case' constant_expression ':' statement
+ self.match(self.input, 106, self.FOLLOW_106_in_labeled_statement2197)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_constant_expression_in_labeled_statement2199)
+ self.constant_expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2201)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_labeled_statement2203)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt92 == 3:
+ # C.g:550:4: 'default' ':' statement
+ self.match(self.input, 107, self.FOLLOW_107_in_labeled_statement2208)
+ if self.failed:
+ return
+ self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2210)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_labeled_statement2212)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 65, labeled_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end labeled_statement
+
+ class compound_statement_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start compound_statement
+ # C.g:553:1: compound_statement : '{' ( declaration )* ( statement_list )? '}' ;
+ def compound_statement(self, ):
+
+ retval = self.compound_statement_return()
+ retval.start = self.input.LT(1)
+ compound_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 66):
+ return retval
+
+ # C.g:554:2: ( '{' ( declaration )* ( statement_list )? '}' )
+ # C.g:554:4: '{' ( declaration )* ( statement_list )? '}'
+ self.match(self.input, 43, self.FOLLOW_43_in_compound_statement2223)
+ if self.failed:
+ return retval
+ # C.g:554:8: ( declaration )*
+ while True: #loop93
+ alt93 = 2
+ LA93 = self.input.LA(1)
+ if LA93 == IDENTIFIER:
+ LA93 = self.input.LA(2)
+ if LA93 == 62:
+ LA93_44 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_47 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 66:
+ LA93_48 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_49 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_50 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_51 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_52 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_53 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_54 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_55 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_56 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_57 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_58 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_59 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_60 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_61 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_62 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_63 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_64 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_65 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 26:
+ LA93 = self.input.LA(2)
+ if LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_86 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_87 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_88 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_89 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_90 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_91 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_92 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_93 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_94 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_95 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_96 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_97 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_98 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_99 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 66:
+ LA93_100 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_101 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_102 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_103 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_104 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_105 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_106 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_107 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_108 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_109 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_110 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_111 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_112 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_113 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_114 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_115 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_116 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_117 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_118 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_119 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_120 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_121 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_122 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_123 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_124 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 34:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_125 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_126 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_127 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_128 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_129 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_130 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_131 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_132 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_133 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_134 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_135 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_136 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_137 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_138 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_139 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_140 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_141 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_142 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_143 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_144 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 35:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_145 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_146 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_147 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_148 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_149 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_150 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_151 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_152 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_153 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_154 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_155 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_156 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_157 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_158 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_159 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_160 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_161 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_162 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_163 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_164 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 36:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_165 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_166 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_167 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_168 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_169 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_170 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_171 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_172 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_173 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_174 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_175 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_176 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_177 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_178 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_179 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_180 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_181 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_182 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_183 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_184 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 37:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_185 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_186 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_187 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_188 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_189 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_190 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_191 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_192 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_193 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_194 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_195 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_196 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_197 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_198 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_199 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_200 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_201 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_202 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_203 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_204 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 38:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_205 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_206 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_207 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_208 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_209 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_210 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_211 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_212 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_213 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_214 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_215 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_216 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_217 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_218 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_219 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_220 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_221 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_222 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_223 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_224 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 39:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_225 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_226 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_227 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_228 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_229 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_230 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_231 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_232 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_233 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_234 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_235 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_236 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_237 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_238 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_239 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_240 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_241 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_242 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_243 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_244 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 40:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_245 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_246 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_247 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_248 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_249 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_250 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_251 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_252 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_253 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_254 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_255 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_256 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_257 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_258 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_259 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_260 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_261 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_262 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_263 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_264 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 41:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_265 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_266 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_267 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_268 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_269 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_270 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_271 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_272 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_273 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_274 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_275 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_276 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_277 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_278 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_279 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_280 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_281 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_282 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_283 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_284 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 42:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_285 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_286 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_287 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_288 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_289 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_290 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_291 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_292 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_293 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_294 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_295 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_296 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_297 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_298 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_299 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_300 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_301 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_302 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_303 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_304 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_40 = self.input.LA(2)
+
+ if (LA93_40 == IDENTIFIER) :
+ LA93_305 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif (LA93_40 == 43) :
+ LA93_306 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+
+ elif LA93 == 48:
+ LA93_41 = self.input.LA(2)
+
+ if (LA93_41 == 43) :
+ LA93_307 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif (LA93_41 == IDENTIFIER) :
+ LA93_308 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 58 or LA93 == 59 or LA93 == 60 or LA93 == 61:
+ LA93 = self.input.LA(2)
+ if LA93 == 66:
+ LA93_309 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 58:
+ LA93_310 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 59:
+ LA93_311 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 60:
+ LA93_312 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == IDENTIFIER:
+ LA93_313 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 62:
+ LA93_314 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 25:
+ LA93_315 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33:
+ LA93_316 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 34:
+ LA93_317 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 35:
+ LA93_318 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 36:
+ LA93_319 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 37:
+ LA93_320 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 38:
+ LA93_321 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 39:
+ LA93_322 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 40:
+ LA93_323 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 41:
+ LA93_324 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 42:
+ LA93_325 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 45 or LA93 == 46:
+ LA93_326 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 48:
+ LA93_327 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+ elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61:
+ LA93_328 = self.input.LA(3)
+
+ if (self.synpred186()) :
+ alt93 = 1
+
+
+
+
+ if alt93 == 1:
+ # C.g:0:0: declaration
+ self.following.append(self.FOLLOW_declaration_in_compound_statement2225)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+ else:
+ break #loop93
+
+
+ # C.g:554:21: ( statement_list )?
+ alt94 = 2
+ LA94_0 = self.input.LA(1)
+
+ if ((IDENTIFIER <= LA94_0 <= FLOATING_POINT_LITERAL) or (25 <= LA94_0 <= 26) or (29 <= LA94_0 <= 43) or (45 <= LA94_0 <= 46) or (48 <= LA94_0 <= 62) or LA94_0 == 66 or (68 <= LA94_0 <= 69) or (72 <= LA94_0 <= 74) or (77 <= LA94_0 <= 79) or (103 <= LA94_0 <= 108) or (110 <= LA94_0 <= 117)) :
+ alt94 = 1
+ if alt94 == 1:
+ # C.g:0:0: statement_list
+ self.following.append(self.FOLLOW_statement_list_in_compound_statement2228)
+ self.statement_list()
+ self.following.pop()
+ if self.failed:
+ return retval
+
+
+
+ self.match(self.input, 44, self.FOLLOW_44_in_compound_statement2231)
+ if self.failed:
+ return retval
+
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 66, compound_statement_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end compound_statement
+
+
+ # $ANTLR start statement_list
+ # C.g:557:1: statement_list : ( statement )+ ;
+ def statement_list(self, ):
+
+ statement_list_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 67):
+ return
+
+ # C.g:558:2: ( ( statement )+ )
+ # C.g:558:4: ( statement )+
+ # C.g:558:4: ( statement )+
+ cnt95 = 0
+ while True: #loop95
+ alt95 = 2
+ LA95 = self.input.LA(1)
+ if LA95 == IDENTIFIER:
+ LA95 = self.input.LA(2)
+ if LA95 == 62:
+ LA95_46 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25 or LA95 == 29 or LA95 == 30 or LA95 == 31 or LA95 == 32 or LA95 == 33 or LA95 == 34 or LA95 == 35 or LA95 == 36 or LA95 == 37 or LA95 == 38 or LA95 == 39 or LA95 == 40 or LA95 == 41 or LA95 == 42 or LA95 == 45 or LA95 == 46 or LA95 == 47 or LA95 == 48 or LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61:
+ alt95 = 1
+ elif LA95 == STRING_LITERAL:
+ LA95_48 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == IDENTIFIER:
+ LA95_49 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 64:
+ LA95_50 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_51 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_52 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_53 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_54 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_55 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_56 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_57 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_58 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_59 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_60 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_61 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_62 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_63 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_64 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_65 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_66 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_67 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_68 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_69 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_88 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == HEX_LITERAL:
+ LA95 = self.input.LA(2)
+ if LA95 == 64:
+ LA95_89 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_90 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_91 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_92 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_93 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_94 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_95 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_96 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_97 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_98 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_99 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_100 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_101 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_102 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_103 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_104 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_105 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_106 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_107 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_108 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_109 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_110 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25:
+ alt95 = 1
+
+ elif LA95 == OCTAL_LITERAL:
+ LA95 = self.input.LA(2)
+ if LA95 == 64:
+ LA95_113 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_114 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_115 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_116 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_117 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_118 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_119 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_120 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_121 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_122 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_123 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_124 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_125 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_126 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_127 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_128 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_129 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_130 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_131 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_132 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_133 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_135 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25:
+ alt95 = 1
+
+ elif LA95 == DECIMAL_LITERAL:
+ LA95 = self.input.LA(2)
+ if LA95 == 64:
+ LA95_137 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_138 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_139 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_140 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_141 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_142 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_143 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_144 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_145 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_146 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_147 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_148 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_149 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_150 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_151 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_152 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_153 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_154 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_155 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_156 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_157 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_158 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25:
+ alt95 = 1
+
+ elif LA95 == CHARACTER_LITERAL:
+ LA95 = self.input.LA(2)
+ if LA95 == 64:
+ LA95_161 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_162 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_163 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_164 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_165 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_166 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_167 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_168 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_169 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_170 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_171 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_172 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_173 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_174 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_175 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_176 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_177 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_178 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_179 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_180 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_181 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_182 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25:
+ alt95 = 1
+
+ elif LA95 == STRING_LITERAL:
+ LA95 = self.input.LA(2)
+ if LA95 == IDENTIFIER:
+ LA95_185 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 64:
+ LA95_186 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_187 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_188 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_189 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_190 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_191 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_192 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_193 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_194 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_195 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_196 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_197 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_198 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_199 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_200 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_201 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_202 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_203 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_204 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_205 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_206 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25:
+ alt95 = 1
+ elif LA95 == STRING_LITERAL:
+ LA95_208 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_209 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == FLOATING_POINT_LITERAL:
+ LA95 = self.input.LA(2)
+ if LA95 == 64:
+ LA95_211 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_212 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 75:
+ LA95_213 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66:
+ LA95_214 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 76:
+ LA95_215 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_216 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_217 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 70:
+ LA95_218 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 71:
+ LA95_219 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 68:
+ LA95_220 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 69:
+ LA95_221 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 101 or LA95 == 102:
+ LA95_222 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100:
+ LA95_223 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 95 or LA95 == 96:
+ LA95_224 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 77:
+ LA95_225 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 94:
+ LA95_226 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 93:
+ LA95_227 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 92:
+ LA95_228 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 91:
+ LA95_229 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 90:
+ LA95_230 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 27:
+ LA95_231 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 25:
+ alt95 = 1
+ elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89:
+ LA95_234 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == 62:
+ LA95 = self.input.LA(2)
+ if LA95 == IDENTIFIER:
+ LA95_235 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == HEX_LITERAL:
+ LA95_236 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == OCTAL_LITERAL:
+ LA95_237 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == DECIMAL_LITERAL:
+ LA95_238 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == CHARACTER_LITERAL:
+ LA95_239 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == STRING_LITERAL:
+ LA95_240 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == FLOATING_POINT_LITERAL:
+ LA95_241 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_242 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_243 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_244 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79:
+ LA95_245 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 74:
+ LA95_246 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61:
+ LA95_247 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 34:
+ LA95_248 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 35:
+ LA95_249 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 36:
+ LA95_250 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 37:
+ LA95_251 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 38:
+ LA95_252 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 39:
+ LA95_253 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 40:
+ LA95_254 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 41:
+ LA95_255 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 42:
+ LA95_256 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 45 or LA95 == 46:
+ LA95_257 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 48:
+ LA95_258 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == 72:
+ LA95 = self.input.LA(2)
+ if LA95 == IDENTIFIER:
+ LA95_259 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == HEX_LITERAL:
+ LA95_260 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == OCTAL_LITERAL:
+ LA95_261 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == DECIMAL_LITERAL:
+ LA95_262 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == CHARACTER_LITERAL:
+ LA95_263 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == STRING_LITERAL:
+ LA95_264 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == FLOATING_POINT_LITERAL:
+ LA95_265 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_266 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_267 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_268 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79:
+ LA95_269 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 74:
+ LA95_270 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == 73:
+ LA95 = self.input.LA(2)
+ if LA95 == IDENTIFIER:
+ LA95_271 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == HEX_LITERAL:
+ LA95_272 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == OCTAL_LITERAL:
+ LA95_273 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == DECIMAL_LITERAL:
+ LA95_274 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == CHARACTER_LITERAL:
+ LA95_275 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == STRING_LITERAL:
+ LA95_276 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == FLOATING_POINT_LITERAL:
+ LA95_277 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 62:
+ LA95_278 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_279 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_280 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79:
+ LA95_281 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 74:
+ LA95_282 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79:
+ LA95 = self.input.LA(2)
+ if LA95 == 62:
+ LA95_283 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == IDENTIFIER:
+ LA95_284 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == HEX_LITERAL:
+ LA95_285 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == OCTAL_LITERAL:
+ LA95_286 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == DECIMAL_LITERAL:
+ LA95_287 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == CHARACTER_LITERAL:
+ LA95_288 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == STRING_LITERAL:
+ LA95_289 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == FLOATING_POINT_LITERAL:
+ LA95_290 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_291 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_292 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79:
+ LA95_293 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 74:
+ LA95_294 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == 74:
+ LA95 = self.input.LA(2)
+ if LA95 == 62:
+ LA95_295 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == IDENTIFIER:
+ LA95_296 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == HEX_LITERAL:
+ LA95_297 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == OCTAL_LITERAL:
+ LA95_298 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == DECIMAL_LITERAL:
+ LA95_299 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == CHARACTER_LITERAL:
+ LA95_300 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == STRING_LITERAL:
+ LA95_301 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == FLOATING_POINT_LITERAL:
+ LA95_302 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 72:
+ LA95_303 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 73:
+ LA95_304 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79:
+ LA95_305 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+ elif LA95 == 74:
+ LA95_306 = self.input.LA(3)
+
+ if (self.synpred188()) :
+ alt95 = 1
+
+
+
+ elif LA95 == 25 or LA95 == 26 or LA95 == 29 or LA95 == 30 or LA95 == 31 or LA95 == 32 or LA95 == 33 or LA95 == 34 or LA95 == 35 or LA95 == 36 or LA95 == 37 or LA95 == 38 or LA95 == 39 or LA95 == 40 or LA95 == 41 or LA95 == 42 or LA95 == 43 or LA95 == 45 or LA95 == 46 or LA95 == 48 or LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61 or LA95 == 103 or LA95 == 104 or LA95 == 105 or LA95 == 106 or LA95 == 107 or LA95 == 108 or LA95 == 110 or LA95 == 111 or LA95 == 112 or LA95 == 113 or LA95 == 114 or LA95 == 115 or LA95 == 116 or LA95 == 117:
+ alt95 = 1
+
+ if alt95 == 1:
+ # C.g:0:0: statement
+ self.following.append(self.FOLLOW_statement_in_statement_list2242)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ if cnt95 >= 1:
+ break #loop95
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(95, self.input)
+ raise eee
+
+ cnt95 += 1
+
+
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 67, statement_list_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end statement_list
+
+ class expression_statement_return(object):
+ def __init__(self):
+ self.start = None
+ self.stop = None
+
+
+
+ # $ANTLR start expression_statement
+ # C.g:561:1: expression_statement : ( ';' | expression ';' );
+ def expression_statement(self, ):
+
+ retval = self.expression_statement_return()
+ retval.start = self.input.LT(1)
+ expression_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 68):
+ return retval
+
+ # C.g:562:2: ( ';' | expression ';' )
+ alt96 = 2
+ LA96_0 = self.input.LA(1)
+
+ if (LA96_0 == 25) :
+ alt96 = 1
+ elif ((IDENTIFIER <= LA96_0 <= FLOATING_POINT_LITERAL) or LA96_0 == 62 or LA96_0 == 66 or (68 <= LA96_0 <= 69) or (72 <= LA96_0 <= 74) or (77 <= LA96_0 <= 79)) :
+ alt96 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return retval
+
+ nvae = NoViableAltException("561:1: expression_statement : ( ';' | expression ';' );", 96, 0, self.input)
+
+ raise nvae
+
+ if alt96 == 1:
+ # C.g:562:4: ';'
+ self.match(self.input, 25, self.FOLLOW_25_in_expression_statement2254)
+ if self.failed:
+ return retval
+
+
+ elif alt96 == 2:
+ # C.g:563:4: expression ';'
+ self.following.append(self.FOLLOW_expression_in_expression_statement2259)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return retval
+ self.match(self.input, 25, self.FOLLOW_25_in_expression_statement2261)
+ if self.failed:
+ return retval
+
+
+ retval.stop = self.input.LT(-1)
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 68, expression_statement_StartIndex)
+
+ pass
+
+ return retval
+
+ # $ANTLR end expression_statement
+
+
+ # $ANTLR start selection_statement
+ # C.g:566:1: selection_statement : ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement );
+ def selection_statement(self, ):
+
+ selection_statement_StartIndex = self.input.index()
+ e = None
+
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 69):
+ return
+
+ # C.g:567:2: ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement )
+ alt98 = 2
+ LA98_0 = self.input.LA(1)
+
+ if (LA98_0 == 108) :
+ alt98 = 1
+ elif (LA98_0 == 110) :
+ alt98 = 2
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("566:1: selection_statement : ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement );", 98, 0, self.input)
+
+ raise nvae
+
+ if alt98 == 1:
+ # C.g:567:4: 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )?
+ self.match(self.input, 108, self.FOLLOW_108_in_selection_statement2272)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_selection_statement2274)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_selection_statement2278)
+ e = self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_selection_statement2280)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start, e.stop))
+
+ self.following.append(self.FOLLOW_statement_in_selection_statement2284)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:567:167: ( options {k=1; backtrack=false; } : 'else' statement )?
+ alt97 = 2
+ LA97_0 = self.input.LA(1)
+
+ if (LA97_0 == 109) :
+ alt97 = 1
+ if alt97 == 1:
+ # C.g:567:200: 'else' statement
+ self.match(self.input, 109, self.FOLLOW_109_in_selection_statement2299)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_selection_statement2301)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ elif alt98 == 2:
+ # C.g:568:4: 'switch' '(' expression ')' statement
+ self.match(self.input, 110, self.FOLLOW_110_in_selection_statement2308)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_selection_statement2310)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_selection_statement2312)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_selection_statement2314)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_selection_statement2316)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 69, selection_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end selection_statement
+
+
+ # $ANTLR start iteration_statement
+ # C.g:571:1: iteration_statement : ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement );
+ def iteration_statement(self, ):
+
+ iteration_statement_StartIndex = self.input.index()
+ e = None
+
+
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 70):
+ return
+
+ # C.g:572:2: ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement )
+ alt100 = 3
+ LA100 = self.input.LA(1)
+ if LA100 == 111:
+ alt100 = 1
+ elif LA100 == 112:
+ alt100 = 2
+ elif LA100 == 113:
+ alt100 = 3
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("571:1: iteration_statement : ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement );", 100, 0, self.input)
+
+ raise nvae
+
+ if alt100 == 1:
+ # C.g:572:4: 'while' '(' e= expression ')' statement
+ self.match(self.input, 111, self.FOLLOW_111_in_iteration_statement2327)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2329)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_iteration_statement2333)
+ e = self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2335)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_iteration_statement2337)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start, e.stop))
+
+
+
+ elif alt100 == 2:
+ # C.g:573:4: 'do' statement 'while' '(' e= expression ')' ';'
+ self.match(self.input, 112, self.FOLLOW_112_in_iteration_statement2344)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_iteration_statement2346)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 111, self.FOLLOW_111_in_iteration_statement2348)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2350)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_iteration_statement2354)
+ e = self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2356)
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_iteration_statement2358)
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start, e.stop))
+
+
+
+ elif alt100 == 3:
+ # C.g:574:4: 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement
+ self.match(self.input, 113, self.FOLLOW_113_in_iteration_statement2365)
+ if self.failed:
+ return
+ self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2367)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_statement_in_iteration_statement2369)
+ self.expression_statement()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_statement_in_iteration_statement2373)
+ e = self.expression_statement()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:574:58: ( expression )?
+ alt99 = 2
+ LA99_0 = self.input.LA(1)
+
+ if ((IDENTIFIER <= LA99_0 <= FLOATING_POINT_LITERAL) or LA99_0 == 62 or LA99_0 == 66 or (68 <= LA99_0 <= 69) or (72 <= LA99_0 <= 74) or (77 <= LA99_0 <= 79)) :
+ alt99 = 1
+ if alt99 == 1:
+ # C.g:0:0: expression
+ self.following.append(self.FOLLOW_expression_in_iteration_statement2375)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2378)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_statement_in_iteration_statement2380)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+ if self.backtracking == 0:
+ self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start, e.stop))
+
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 70, iteration_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end iteration_statement
+
+
+ # $ANTLR start jump_statement
+ # C.g:577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );
+ def jump_statement(self, ):
+
+ jump_statement_StartIndex = self.input.index()
+ try:
+ try:
+ if self.backtracking > 0 and self.alreadyParsedRule(self.input, 71):
+ return
+
+ # C.g:578:2: ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' )
+ alt101 = 5
+ LA101 = self.input.LA(1)
+ if LA101 == 114:
+ alt101 = 1
+ elif LA101 == 115:
+ alt101 = 2
+ elif LA101 == 116:
+ alt101 = 3
+ elif LA101 == 117:
+ LA101_4 = self.input.LA(2)
+
+ if (LA101_4 == 25) :
+ alt101 = 4
+ elif ((IDENTIFIER <= LA101_4 <= FLOATING_POINT_LITERAL) or LA101_4 == 62 or LA101_4 == 66 or (68 <= LA101_4 <= 69) or (72 <= LA101_4 <= 74) or (77 <= LA101_4 <= 79)) :
+ alt101 = 5
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );", 101, 4, self.input)
+
+ raise nvae
+
+ else:
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ nvae = NoViableAltException("577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );", 101, 0, self.input)
+
+ raise nvae
+
+ if alt101 == 1:
+ # C.g:578:4: 'goto' IDENTIFIER ';'
+ self.match(self.input, 114, self.FOLLOW_114_in_jump_statement2393)
+ if self.failed:
+ return
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_jump_statement2395)
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2397)
+ if self.failed:
+ return
+
+
+ elif alt101 == 2:
+ # C.g:579:4: 'continue' ';'
+ self.match(self.input, 115, self.FOLLOW_115_in_jump_statement2402)
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2404)
+ if self.failed:
+ return
+
+
+ elif alt101 == 3:
+ # C.g:580:4: 'break' ';'
+ self.match(self.input, 116, self.FOLLOW_116_in_jump_statement2409)
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2411)
+ if self.failed:
+ return
+
+
+ elif alt101 == 4:
+ # C.g:581:4: 'return' ';'
+ self.match(self.input, 117, self.FOLLOW_117_in_jump_statement2416)
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2418)
+ if self.failed:
+ return
+
+
+ elif alt101 == 5:
+ # C.g:582:4: 'return' expression ';'
+ self.match(self.input, 117, self.FOLLOW_117_in_jump_statement2423)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_expression_in_jump_statement2425)
+ self.expression()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2427)
+ if self.failed:
+ return
+
+
+
+ except RecognitionException as re:
+ self.reportError(re)
+ self.recover(self.input, re)
+ finally:
+ if self.backtracking > 0:
+ self.memoize(self.input, 71, jump_statement_StartIndex)
+
+ pass
+
+ return
+
+ # $ANTLR end jump_statement
+
+ # $ANTLR start synpred2
+ def synpred2_fragment(self, ):
+ # C.g:119:6: ( declaration_specifiers )
+ # C.g:119:6: declaration_specifiers
+ self.following.append(self.FOLLOW_declaration_specifiers_in_synpred2100)
+ self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred2
+
+
+
+ # $ANTLR start synpred4
+ def synpred4_fragment(self, ):
+ # C.g:119:4: ( ( declaration_specifiers )? declarator ( declaration )* '{' )
+ # C.g:119:6: ( declaration_specifiers )? declarator ( declaration )* '{'
+ # C.g:119:6: ( declaration_specifiers )?
+ alt102 = 2
+ LA102 = self.input.LA(1)
+ if LA102 == 29 or LA102 == 30 or LA102 == 31 or LA102 == 32 or LA102 == 33 or LA102 == 34 or LA102 == 35 or LA102 == 36 or LA102 == 37 or LA102 == 38 or LA102 == 39 or LA102 == 40 or LA102 == 41 or LA102 == 42 or LA102 == 45 or LA102 == 46 or LA102 == 48 or LA102 == 49 or LA102 == 50 or LA102 == 51 or LA102 == 52 or LA102 == 53 or LA102 == 54 or LA102 == 55 or LA102 == 56 or LA102 == 57 or LA102 == 61:
+ alt102 = 1
+ elif LA102 == IDENTIFIER:
+ LA102 = self.input.LA(2)
+ if LA102 == 62:
+ LA102_21 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 29 or LA102 == 30 or LA102 == 31 or LA102 == 32 or LA102 == 33:
+ LA102_23 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 34:
+ LA102_24 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 35:
+ LA102_25 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 36:
+ LA102_26 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 37:
+ LA102_27 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 38:
+ LA102_28 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 39:
+ LA102_29 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 40:
+ LA102_30 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 41:
+ LA102_31 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 42:
+ LA102_32 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 45 or LA102 == 46:
+ LA102_33 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 48:
+ LA102_34 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == IDENTIFIER:
+ LA102_35 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 58:
+ LA102_36 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 66:
+ alt102 = 1
+ elif LA102 == 59:
+ LA102_39 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 60:
+ LA102_40 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 49 or LA102 == 50 or LA102 == 51 or LA102 == 52 or LA102 == 53 or LA102 == 54 or LA102 == 55 or LA102 == 56 or LA102 == 57 or LA102 == 61:
+ LA102_41 = self.input.LA(3)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 58:
+ LA102_14 = self.input.LA(2)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 59:
+ LA102_16 = self.input.LA(2)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ elif LA102 == 60:
+ LA102_17 = self.input.LA(2)
+
+ if (self.synpred2()) :
+ alt102 = 1
+ if alt102 == 1:
+ # C.g:0:0: declaration_specifiers
+ self.following.append(self.FOLLOW_declaration_specifiers_in_synpred4100)
+ self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ self.following.append(self.FOLLOW_declarator_in_synpred4103)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:119:41: ( declaration )*
+ while True: #loop103
+ alt103 = 2
+ LA103_0 = self.input.LA(1)
+
+ if (LA103_0 == IDENTIFIER or LA103_0 == 26 or (29 <= LA103_0 <= 42) or (45 <= LA103_0 <= 46) or (48 <= LA103_0 <= 61)) :
+ alt103 = 1
+
+
+ if alt103 == 1:
+ # C.g:0:0: declaration
+ self.following.append(self.FOLLOW_declaration_in_synpred4105)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop103
+
+
+ self.match(self.input, 43, self.FOLLOW_43_in_synpred4108)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred4
+
+
+
+ # $ANTLR start synpred5
+ def synpred5_fragment(self, ):
+ # C.g:120:4: ( declaration )
+ # C.g:120:4: declaration
+ self.following.append(self.FOLLOW_declaration_in_synpred5118)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred5
+
+
+
+ # $ANTLR start synpred7
+ def synpred7_fragment(self, ):
+ # C.g:146:6: ( declaration_specifiers )
+ # C.g:146:6: declaration_specifiers
+ self.following.append(self.FOLLOW_declaration_specifiers_in_synpred7157)
+ self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred7
+
+
+
+ # $ANTLR start synpred10
+ def synpred10_fragment(self, ):
+ # C.g:167:18: ( declaration_specifiers )
+ # C.g:167:18: declaration_specifiers
+ self.following.append(self.FOLLOW_declaration_specifiers_in_synpred10207)
+ self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred10
+
+
+
+ # $ANTLR start synpred14
+ def synpred14_fragment(self, ):
+ # C.g:184:7: ( type_specifier )
+ # C.g:184:7: type_specifier
+ self.following.append(self.FOLLOW_type_specifier_in_synpred14272)
+ self.type_specifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred14
+
+
+
+ # $ANTLR start synpred15
+ def synpred15_fragment(self, ):
+ # C.g:185:13: ( type_qualifier )
+ # C.g:185:13: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_synpred15286)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred15
+
+
+
+ # $ANTLR start synpred33
+ def synpred33_fragment(self, ):
+ # C.g:225:16: ( type_qualifier )
+ # C.g:225:16: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_synpred33444)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred33
+
+
+
+ # $ANTLR start synpred34
+ def synpred34_fragment(self, ):
+ # C.g:225:4: ( IDENTIFIER ( type_qualifier )* declarator )
+ # C.g:225:5: IDENTIFIER ( type_qualifier )* declarator
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred34442)
+ if self.failed:
+ return
+ # C.g:225:16: ( type_qualifier )*
+ while True: #loop106
+ alt106 = 2
+ LA106 = self.input.LA(1)
+ if LA106 == 58:
+ LA106_2 = self.input.LA(2)
+
+ if (self.synpred33()) :
+ alt106 = 1
+
+
+ elif LA106 == 59:
+ LA106_3 = self.input.LA(2)
+
+ if (self.synpred33()) :
+ alt106 = 1
+
+
+ elif LA106 == 60:
+ LA106_4 = self.input.LA(2)
+
+ if (self.synpred33()) :
+ alt106 = 1
+
+
+ elif LA106 == 49 or LA106 == 50 or LA106 == 51 or LA106 == 52 or LA106 == 53 or LA106 == 54 or LA106 == 55 or LA106 == 56 or LA106 == 57 or LA106 == 61:
+ alt106 = 1
+
+ if alt106 == 1:
+ # C.g:0:0: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_synpred34444)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop106
+
+
+ self.following.append(self.FOLLOW_declarator_in_synpred34447)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred34
+
+
+
+ # $ANTLR start synpred39
+ def synpred39_fragment(self, ):
+ # C.g:253:6: ( type_qualifier )
+ # C.g:253:6: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_synpred39566)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred39
+
+
+
+ # $ANTLR start synpred40
+ def synpred40_fragment(self, ):
+ # C.g:253:23: ( type_specifier )
+ # C.g:253:23: type_specifier
+ self.following.append(self.FOLLOW_type_specifier_in_synpred40570)
+ self.type_specifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred40
+
+
+
+ # $ANTLR start synpred66
+ def synpred66_fragment(self, ):
+ # C.g:297:4: ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator )
+ # C.g:297:4: ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator
+ # C.g:297:4: ( pointer )?
+ alt111 = 2
+ LA111_0 = self.input.LA(1)
+
+ if (LA111_0 == 66) :
+ alt111 = 1
+ if alt111 == 1:
+ # C.g:0:0: pointer
+ self.following.append(self.FOLLOW_pointer_in_synpred66784)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+ # C.g:297:13: ( 'EFIAPI' )?
+ alt112 = 2
+ LA112_0 = self.input.LA(1)
+
+ if (LA112_0 == 58) :
+ alt112 = 1
+ if alt112 == 1:
+ # C.g:297:14: 'EFIAPI'
+ self.match(self.input, 58, self.FOLLOW_58_in_synpred66788)
+ if self.failed:
+ return
+
+
+
+ # C.g:297:25: ( 'EFI_BOOTSERVICE' )?
+ alt113 = 2
+ LA113_0 = self.input.LA(1)
+
+ if (LA113_0 == 59) :
+ alt113 = 1
+ if alt113 == 1:
+ # C.g:297:26: 'EFI_BOOTSERVICE'
+ self.match(self.input, 59, self.FOLLOW_59_in_synpred66793)
+ if self.failed:
+ return
+
+
+
+ # C.g:297:46: ( 'EFI_RUNTIMESERVICE' )?
+ alt114 = 2
+ LA114_0 = self.input.LA(1)
+
+ if (LA114_0 == 60) :
+ alt114 = 1
+ if alt114 == 1:
+ # C.g:297:47: 'EFI_RUNTIMESERVICE'
+ self.match(self.input, 60, self.FOLLOW_60_in_synpred66798)
+ if self.failed:
+ return
+
+
+
+ self.following.append(self.FOLLOW_direct_declarator_in_synpred66802)
+ self.direct_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred66
+
+
+
+ # $ANTLR start synpred67
+ def synpred67_fragment(self, ):
+ # C.g:303:15: ( declarator_suffix )
+ # C.g:303:15: declarator_suffix
+ self.following.append(self.FOLLOW_declarator_suffix_in_synpred67821)
+ self.declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred67
+
+
+
+ # $ANTLR start synpred69
+ def synpred69_fragment(self, ):
+ # C.g:304:9: ( 'EFIAPI' )
+ # C.g:304:9: 'EFIAPI'
+ self.match(self.input, 58, self.FOLLOW_58_in_synpred69830)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred69
+
+
+
+ # $ANTLR start synpred70
+ def synpred70_fragment(self, ):
+ # C.g:304:35: ( declarator_suffix )
+ # C.g:304:35: declarator_suffix
+ self.following.append(self.FOLLOW_declarator_suffix_in_synpred70838)
+ self.declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred70
+
+
+
+ # $ANTLR start synpred73
+ def synpred73_fragment(self, ):
+ # C.g:310:9: ( '(' parameter_type_list ')' )
+ # C.g:310:9: '(' parameter_type_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_synpred73878)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_parameter_type_list_in_synpred73880)
+ self.parameter_type_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_synpred73882)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred73
+
+
+
+ # $ANTLR start synpred74
+ def synpred74_fragment(self, ):
+ # C.g:311:9: ( '(' identifier_list ')' )
+ # C.g:311:9: '(' identifier_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_synpred74892)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_identifier_list_in_synpred74894)
+ self.identifier_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_synpred74896)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred74
+
+
+
+ # $ANTLR start synpred75
+ def synpred75_fragment(self, ):
+ # C.g:316:8: ( type_qualifier )
+ # C.g:316:8: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_synpred75921)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred75
+
+
+
+ # $ANTLR start synpred76
+ def synpred76_fragment(self, ):
+ # C.g:316:24: ( pointer )
+ # C.g:316:24: pointer
+ self.following.append(self.FOLLOW_pointer_in_synpred76924)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred76
+
+
+
+ # $ANTLR start synpred77
+ def synpred77_fragment(self, ):
+ # C.g:316:4: ( '*' ( type_qualifier )+ ( pointer )? )
+ # C.g:316:4: '*' ( type_qualifier )+ ( pointer )?
+ self.match(self.input, 66, self.FOLLOW_66_in_synpred77919)
+ if self.failed:
+ return
+ # C.g:316:8: ( type_qualifier )+
+ cnt116 = 0
+ while True: #loop116
+ alt116 = 2
+ LA116_0 = self.input.LA(1)
+
+ if ((49 <= LA116_0 <= 61)) :
+ alt116 = 1
+
+
+ if alt116 == 1:
+ # C.g:0:0: type_qualifier
+ self.following.append(self.FOLLOW_type_qualifier_in_synpred77921)
+ self.type_qualifier()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ if cnt116 >= 1:
+ break #loop116
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(116, self.input)
+ raise eee
+
+ cnt116 += 1
+
+
+ # C.g:316:24: ( pointer )?
+ alt117 = 2
+ LA117_0 = self.input.LA(1)
+
+ if (LA117_0 == 66) :
+ alt117 = 1
+ if alt117 == 1:
+ # C.g:0:0: pointer
+ self.following.append(self.FOLLOW_pointer_in_synpred77924)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ # $ANTLR end synpred77
+
+
+
+ # $ANTLR start synpred78
+ def synpred78_fragment(self, ):
+ # C.g:317:4: ( '*' pointer )
+ # C.g:317:4: '*' pointer
+ self.match(self.input, 66, self.FOLLOW_66_in_synpred78930)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_pointer_in_synpred78932)
+ self.pointer()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred78
+
+
+
+ # $ANTLR start synpred81
+ def synpred81_fragment(self, ):
+ # C.g:326:32: ( 'OPTIONAL' )
+ # C.g:326:32: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_synpred81977)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred81
+
+
+
+ # $ANTLR start synpred82
+ def synpred82_fragment(self, ):
+ # C.g:326:27: ( ',' ( 'OPTIONAL' )? parameter_declaration )
+ # C.g:326:27: ',' ( 'OPTIONAL' )? parameter_declaration
+ self.match(self.input, 27, self.FOLLOW_27_in_synpred82974)
+ if self.failed:
+ return
+ # C.g:326:31: ( 'OPTIONAL' )?
+ alt119 = 2
+ LA119_0 = self.input.LA(1)
+
+ if (LA119_0 == 53) :
+ LA119_1 = self.input.LA(2)
+
+ if (self.synpred81()) :
+ alt119 = 1
+ if alt119 == 1:
+ # C.g:326:32: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_synpred82977)
+ if self.failed:
+ return
+
+
+
+ self.following.append(self.FOLLOW_parameter_declaration_in_synpred82981)
+ self.parameter_declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred82
+
+
+
+ # $ANTLR start synpred83
+ def synpred83_fragment(self, ):
+ # C.g:330:28: ( declarator )
+ # C.g:330:28: declarator
+ self.following.append(self.FOLLOW_declarator_in_synpred83997)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred83
+
+
+
+ # $ANTLR start synpred84
+ def synpred84_fragment(self, ):
+ # C.g:330:39: ( abstract_declarator )
+ # C.g:330:39: abstract_declarator
+ self.following.append(self.FOLLOW_abstract_declarator_in_synpred84999)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred84
+
+
+
+ # $ANTLR start synpred86
+ def synpred86_fragment(self, ):
+ # C.g:330:4: ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? )
+ # C.g:330:4: declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )?
+ self.following.append(self.FOLLOW_declaration_specifiers_in_synpred86994)
+ self.declaration_specifiers()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:330:27: ( declarator | abstract_declarator )*
+ while True: #loop120
+ alt120 = 3
+ LA120 = self.input.LA(1)
+ if LA120 == 66:
+ LA120_3 = self.input.LA(2)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+ elif LA120 == IDENTIFIER or LA120 == 58 or LA120 == 59 or LA120 == 60:
+ alt120 = 1
+ elif LA120 == 62:
+ LA120 = self.input.LA(2)
+ if LA120 == 29 or LA120 == 30 or LA120 == 31 or LA120 == 32 or LA120 == 33 or LA120 == 34 or LA120 == 35 or LA120 == 36 or LA120 == 37 or LA120 == 38 or LA120 == 39 or LA120 == 40 or LA120 == 41 or LA120 == 42 or LA120 == 45 or LA120 == 46 or LA120 == 48 or LA120 == 49 or LA120 == 50 or LA120 == 51 or LA120 == 52 or LA120 == 53 or LA120 == 54 or LA120 == 55 or LA120 == 56 or LA120 == 57 or LA120 == 61 or LA120 == 63 or LA120 == 64:
+ alt120 = 2
+ elif LA120 == 58:
+ LA120_21 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+ elif LA120 == 66:
+ LA120_22 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+ elif LA120 == 59:
+ LA120_23 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+ elif LA120 == 60:
+ LA120_24 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+ elif LA120 == IDENTIFIER:
+ LA120_25 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+ elif LA120 == 62:
+ LA120_26 = self.input.LA(3)
+
+ if (self.synpred83()) :
+ alt120 = 1
+ elif (self.synpred84()) :
+ alt120 = 2
+
+
+
+ elif LA120 == 64:
+ alt120 = 2
+
+ if alt120 == 1:
+ # C.g:330:28: declarator
+ self.following.append(self.FOLLOW_declarator_in_synpred86997)
+ self.declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ elif alt120 == 2:
+ # C.g:330:39: abstract_declarator
+ self.following.append(self.FOLLOW_abstract_declarator_in_synpred86999)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ else:
+ break #loop120
+
+
+ # C.g:330:61: ( 'OPTIONAL' )?
+ alt121 = 2
+ LA121_0 = self.input.LA(1)
+
+ if (LA121_0 == 53) :
+ alt121 = 1
+ if alt121 == 1:
+ # C.g:330:62: 'OPTIONAL'
+ self.match(self.input, 53, self.FOLLOW_53_in_synpred861004)
+ if self.failed:
+ return
+
+
+
+
+
+ # $ANTLR end synpred86
+
+
+
+ # $ANTLR start synpred90
+ def synpred90_fragment(self, ):
+ # C.g:341:4: ( specifier_qualifier_list ( abstract_declarator )? )
+ # C.g:341:4: specifier_qualifier_list ( abstract_declarator )?
+ self.following.append(self.FOLLOW_specifier_qualifier_list_in_synpred901046)
+ self.specifier_qualifier_list()
+ self.following.pop()
+ if self.failed:
+ return
+ # C.g:341:29: ( abstract_declarator )?
+ alt122 = 2
+ LA122_0 = self.input.LA(1)
+
+ if (LA122_0 == 62 or LA122_0 == 64 or LA122_0 == 66) :
+ alt122 = 1
+ if alt122 == 1:
+ # C.g:0:0: abstract_declarator
+ self.following.append(self.FOLLOW_abstract_declarator_in_synpred901048)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+
+
+
+ # $ANTLR end synpred90
+
+
+
+ # $ANTLR start synpred91
+ def synpred91_fragment(self, ):
+ # C.g:346:12: ( direct_abstract_declarator )
+ # C.g:346:12: direct_abstract_declarator
+ self.following.append(self.FOLLOW_direct_abstract_declarator_in_synpred911067)
+ self.direct_abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred91
+
+
+
+ # $ANTLR start synpred93
+ def synpred93_fragment(self, ):
+ # C.g:351:6: ( '(' abstract_declarator ')' )
+ # C.g:351:6: '(' abstract_declarator ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_synpred931086)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_abstract_declarator_in_synpred931088)
+ self.abstract_declarator()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_synpred931090)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred93
+
+
+
+ # $ANTLR start synpred94
+ def synpred94_fragment(self, ):
+ # C.g:351:65: ( abstract_declarator_suffix )
+ # C.g:351:65: abstract_declarator_suffix
+ self.following.append(self.FOLLOW_abstract_declarator_suffix_in_synpred941098)
+ self.abstract_declarator_suffix()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred94
+
+
+
+ # $ANTLR start synpred109
+ def synpred109_fragment(self, ):
+ # C.g:386:4: ( '(' type_name ')' cast_expression )
+ # C.g:386:4: '(' type_name ')' cast_expression
+ self.match(self.input, 62, self.FOLLOW_62_in_synpred1091282)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_type_name_in_synpred1091284)
+ self.type_name()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_synpred1091286)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_cast_expression_in_synpred1091288)
+ self.cast_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred109
+
+
+
+ # $ANTLR start synpred114
+ def synpred114_fragment(self, ):
+ # C.g:395:4: ( 'sizeof' unary_expression )
+ # C.g:395:4: 'sizeof' unary_expression
+ self.match(self.input, 74, self.FOLLOW_74_in_synpred1141330)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_unary_expression_in_synpred1141332)
+ self.unary_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred114
+
+
+
+ # $ANTLR start synpred117
+ def synpred117_fragment(self, ):
+ # C.g:409:13: ( '(' argument_expression_list ')' )
+ # C.g:409:13: '(' argument_expression_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_synpred1171420)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_argument_expression_list_in_synpred1171424)
+ self.argument_expression_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_synpred1171428)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred117
+
+
+
+ # $ANTLR start synpred118
+ def synpred118_fragment(self, ):
+ # C.g:410:13: ( '(' macro_parameter_list ')' )
+ # C.g:410:13: '(' macro_parameter_list ')'
+ self.match(self.input, 62, self.FOLLOW_62_in_synpred1181444)
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_macro_parameter_list_in_synpred1181446)
+ self.macro_parameter_list()
+ self.following.pop()
+ if self.failed:
+ return
+ self.match(self.input, 63, self.FOLLOW_63_in_synpred1181448)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred118
+
+
+
+ # $ANTLR start synpred120
+ def synpred120_fragment(self, ):
+ # C.g:412:13: ( '*' IDENTIFIER )
+ # C.g:412:13: '*' IDENTIFIER
+ self.match(self.input, 66, self.FOLLOW_66_in_synpred1201482)
+ if self.failed:
+ return
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred1201486)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred120
+
+
+
+ # $ANTLR start synpred137
+ def synpred137_fragment(self, ):
+ # C.g:443:20: ( STRING_LITERAL )
+ # C.g:443:20: STRING_LITERAL
+ self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_synpred1371683)
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred137
+
+
+
+ # $ANTLR start synpred138
+ def synpred138_fragment(self, ):
+ # C.g:443:8: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )
+ # C.g:443:8: ( IDENTIFIER )* ( STRING_LITERAL )+
+ # C.g:443:8: ( IDENTIFIER )*
+ while True: #loop125
+ alt125 = 2
+ LA125_0 = self.input.LA(1)
+
+ if (LA125_0 == IDENTIFIER) :
+ alt125 = 1
+
+
+ if alt125 == 1:
+ # C.g:0:0: IDENTIFIER
+ self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred1381680)
+ if self.failed:
+ return
+
+
+ else:
+ break #loop125
+
+
+ # C.g:443:20: ( STRING_LITERAL )+
+ cnt126 = 0
+ while True: #loop126
+ alt126 = 2
+ LA126_0 = self.input.LA(1)
+
+ if (LA126_0 == STRING_LITERAL) :
+ alt126 = 1
+
+
+ if alt126 == 1:
+ # C.g:0:0: STRING_LITERAL
+ self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_synpred1381683)
+ if self.failed:
+ return
+
+
+ else:
+ if cnt126 >= 1:
+ break #loop126
+
+ if self.backtracking > 0:
+ self.failed = True
+ return
+
+ eee = EarlyExitException(126, self.input)
+ raise eee
+
+ cnt126 += 1
+
+
+
+
+ # $ANTLR end synpred138
+
+
+
+ # $ANTLR start synpred142
+ def synpred142_fragment(self, ):
+ # C.g:458:4: ( lvalue assignment_operator assignment_expression )
+ # C.g:458:4: lvalue assignment_operator assignment_expression
+ self.following.append(self.FOLLOW_lvalue_in_synpred1421744)
+ self.lvalue()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_assignment_operator_in_synpred1421746)
+ self.assignment_operator()
+ self.following.pop()
+ if self.failed:
+ return
+ self.following.append(self.FOLLOW_assignment_expression_in_synpred1421748)
+ self.assignment_expression()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred142
+
+
+
+ # $ANTLR start synpred169
+ def synpred169_fragment(self, ):
+ # C.g:520:4: ( expression_statement )
+ # C.g:520:4: expression_statement
+ self.following.append(self.FOLLOW_expression_statement_in_synpred1692035)
+ self.expression_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred169
+
+
+
+ # $ANTLR start synpred173
+ def synpred173_fragment(self, ):
+ # C.g:524:4: ( macro_statement )
+ # C.g:524:4: macro_statement
+ self.following.append(self.FOLLOW_macro_statement_in_synpred1732055)
+ self.macro_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred173
+
+
+
+ # $ANTLR start synpred174
+ def synpred174_fragment(self, ):
+ # C.g:525:4: ( asm2_statement )
+ # C.g:525:4: asm2_statement
+ self.following.append(self.FOLLOW_asm2_statement_in_synpred1742060)
+ self.asm2_statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred174
+
+
+
+ # $ANTLR start synpred181
+ def synpred181_fragment(self, ):
+ # C.g:544:19: ( declaration )
+ # C.g:544:19: declaration
+ self.following.append(self.FOLLOW_declaration_in_synpred1812166)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred181
+
+
+
+ # $ANTLR start synpred182
+ def synpred182_fragment(self, ):
+ # C.g:544:33: ( statement_list )
+ # C.g:544:33: statement_list
+ self.following.append(self.FOLLOW_statement_list_in_synpred1822170)
+ self.statement_list()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred182
+
+
+
+ # $ANTLR start synpred186
+ def synpred186_fragment(self, ):
+ # C.g:554:8: ( declaration )
+ # C.g:554:8: declaration
+ self.following.append(self.FOLLOW_declaration_in_synpred1862225)
+ self.declaration()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred186
+
+
+
+ # $ANTLR start synpred188
+ def synpred188_fragment(self, ):
+ # C.g:558:4: ( statement )
+ # C.g:558:4: statement
+ self.following.append(self.FOLLOW_statement_in_synpred1882242)
+ self.statement()
+ self.following.pop()
+ if self.failed:
+ return
+
+
+ # $ANTLR end synpred188
+
+
+
+ def synpred69(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred69_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred81(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred81_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred82(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred82_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred66(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred66_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred83(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred83_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred84(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred84_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred67(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred67_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred86(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred86_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred120(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred120_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred40(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred40_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred142(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred142_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred182(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred182_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred109(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred109_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred181(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred181_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred186(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred186_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred188(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred188_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred169(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred169_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred117(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred117_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred70(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred70_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred118(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred118_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred34(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred34_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred33(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred33_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred94(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred94_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred39(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred39_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred74(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred74_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred114(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred114_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred93(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred93_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred75(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred75_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred137(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred137_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred90(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred90_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred138(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred138_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred91(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred91_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred73(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred73_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred5(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred5_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred78(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred78_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred7(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred7_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred76(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred76_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred77(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred77_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred2(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred2_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred4(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred4_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred174(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred174_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred173(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred173_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred14(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred14_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred15(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred15_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+ def synpred10(self):
+ self.backtracking += 1
+ start = self.input.mark()
+ self.synpred10_fragment()
+ success = not self.failed
+ self.input.rewind(start)
+ self.backtracking -= 1
+ self.failed = False
+ return success
+
+
+
+
+
+ FOLLOW_external_declaration_in_translation_unit74 = frozenset([1, 4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66])
+ FOLLOW_function_definition_in_external_declaration113 = frozenset([1])
+ FOLLOW_declaration_in_external_declaration118 = frozenset([1])
+ FOLLOW_macro_statement_in_external_declaration123 = frozenset([1, 25])
+ FOLLOW_25_in_external_declaration126 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_function_definition157 = frozenset([4, 58, 59, 60, 62, 66])
+ FOLLOW_declarator_in_function_definition160 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_declaration_in_function_definition166 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_compound_statement_in_function_definition171 = frozenset([1])
+ FOLLOW_compound_statement_in_function_definition180 = frozenset([1])
+ FOLLOW_26_in_declaration203 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66])
+ FOLLOW_declaration_specifiers_in_declaration207 = frozenset([4, 58, 59, 60, 62, 66])
+ FOLLOW_init_declarator_list_in_declaration216 = frozenset([25])
+ FOLLOW_25_in_declaration220 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_declaration234 = frozenset([4, 25, 58, 59, 60, 62, 66])
+ FOLLOW_init_declarator_list_in_declaration238 = frozenset([25])
+ FOLLOW_25_in_declaration243 = frozenset([1])
+ FOLLOW_storage_class_specifier_in_declaration_specifiers264 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_specifier_in_declaration_specifiers272 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_qualifier_in_declaration_specifiers286 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_init_declarator_in_init_declarator_list308 = frozenset([1, 27])
+ FOLLOW_27_in_init_declarator_list311 = frozenset([4, 58, 59, 60, 62, 66])
+ FOLLOW_init_declarator_in_init_declarator_list313 = frozenset([1, 27])
+ FOLLOW_declarator_in_init_declarator326 = frozenset([1, 28])
+ FOLLOW_28_in_init_declarator329 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_initializer_in_init_declarator331 = frozenset([1])
+ FOLLOW_set_in_storage_class_specifier0 = frozenset([1])
+ FOLLOW_34_in_type_specifier376 = frozenset([1])
+ FOLLOW_35_in_type_specifier381 = frozenset([1])
+ FOLLOW_36_in_type_specifier386 = frozenset([1])
+ FOLLOW_37_in_type_specifier391 = frozenset([1])
+ FOLLOW_38_in_type_specifier396 = frozenset([1])
+ FOLLOW_39_in_type_specifier401 = frozenset([1])
+ FOLLOW_40_in_type_specifier406 = frozenset([1])
+ FOLLOW_41_in_type_specifier411 = frozenset([1])
+ FOLLOW_42_in_type_specifier416 = frozenset([1])
+ FOLLOW_struct_or_union_specifier_in_type_specifier423 = frozenset([1])
+ FOLLOW_enum_specifier_in_type_specifier433 = frozenset([1])
+ FOLLOW_type_id_in_type_specifier451 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_type_id467 = frozenset([1])
+ FOLLOW_struct_or_union_in_struct_or_union_specifier494 = frozenset([4, 43])
+ FOLLOW_IDENTIFIER_in_struct_or_union_specifier496 = frozenset([43])
+ FOLLOW_43_in_struct_or_union_specifier499 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_struct_declaration_list_in_struct_or_union_specifier501 = frozenset([44])
+ FOLLOW_44_in_struct_or_union_specifier503 = frozenset([1])
+ FOLLOW_struct_or_union_in_struct_or_union_specifier508 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_struct_or_union_specifier510 = frozenset([1])
+ FOLLOW_set_in_struct_or_union0 = frozenset([1])
+ FOLLOW_struct_declaration_in_struct_declaration_list537 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_specifier_qualifier_list_in_struct_declaration549 = frozenset([4, 47, 58, 59, 60, 62, 66])
+ FOLLOW_struct_declarator_list_in_struct_declaration551 = frozenset([25])
+ FOLLOW_25_in_struct_declaration553 = frozenset([1])
+ FOLLOW_type_qualifier_in_specifier_qualifier_list566 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_specifier_in_specifier_qualifier_list570 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_struct_declarator_in_struct_declarator_list584 = frozenset([1, 27])
+ FOLLOW_27_in_struct_declarator_list587 = frozenset([4, 47, 58, 59, 60, 62, 66])
+ FOLLOW_struct_declarator_in_struct_declarator_list589 = frozenset([1, 27])
+ FOLLOW_declarator_in_struct_declarator602 = frozenset([1, 47])
+ FOLLOW_47_in_struct_declarator605 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_constant_expression_in_struct_declarator607 = frozenset([1])
+ FOLLOW_47_in_struct_declarator614 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_constant_expression_in_struct_declarator616 = frozenset([1])
+ FOLLOW_48_in_enum_specifier634 = frozenset([43])
+ FOLLOW_43_in_enum_specifier636 = frozenset([4])
+ FOLLOW_enumerator_list_in_enum_specifier638 = frozenset([27, 44])
+ FOLLOW_27_in_enum_specifier640 = frozenset([44])
+ FOLLOW_44_in_enum_specifier643 = frozenset([1])
+ FOLLOW_48_in_enum_specifier648 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_enum_specifier650 = frozenset([43])
+ FOLLOW_43_in_enum_specifier652 = frozenset([4])
+ FOLLOW_enumerator_list_in_enum_specifier654 = frozenset([27, 44])
+ FOLLOW_27_in_enum_specifier656 = frozenset([44])
+ FOLLOW_44_in_enum_specifier659 = frozenset([1])
+ FOLLOW_48_in_enum_specifier664 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_enum_specifier666 = frozenset([1])
+ FOLLOW_enumerator_in_enumerator_list677 = frozenset([1, 27])
+ FOLLOW_27_in_enumerator_list680 = frozenset([4])
+ FOLLOW_enumerator_in_enumerator_list682 = frozenset([1, 27])
+ FOLLOW_IDENTIFIER_in_enumerator695 = frozenset([1, 28])
+ FOLLOW_28_in_enumerator698 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_constant_expression_in_enumerator700 = frozenset([1])
+ FOLLOW_set_in_type_qualifier0 = frozenset([1])
+ FOLLOW_pointer_in_declarator784 = frozenset([4, 58, 59, 60, 62])
+ FOLLOW_58_in_declarator788 = frozenset([4, 59, 60, 62])
+ FOLLOW_59_in_declarator793 = frozenset([4, 60, 62])
+ FOLLOW_60_in_declarator798 = frozenset([4, 62])
+ FOLLOW_direct_declarator_in_declarator802 = frozenset([1])
+ FOLLOW_pointer_in_declarator808 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_direct_declarator819 = frozenset([1, 62, 64])
+ FOLLOW_declarator_suffix_in_direct_declarator821 = frozenset([1, 62, 64])
+ FOLLOW_62_in_direct_declarator827 = frozenset([4, 58, 59, 60, 62, 66])
+ FOLLOW_58_in_direct_declarator830 = frozenset([4, 58, 59, 60, 62, 66])
+ FOLLOW_declarator_in_direct_declarator834 = frozenset([63])
+ FOLLOW_63_in_direct_declarator836 = frozenset([62, 64])
+ FOLLOW_declarator_suffix_in_direct_declarator838 = frozenset([1, 62, 64])
+ FOLLOW_64_in_declarator_suffix852 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_constant_expression_in_declarator_suffix854 = frozenset([65])
+ FOLLOW_65_in_declarator_suffix856 = frozenset([1])
+ FOLLOW_64_in_declarator_suffix866 = frozenset([65])
+ FOLLOW_65_in_declarator_suffix868 = frozenset([1])
+ FOLLOW_62_in_declarator_suffix878 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_parameter_type_list_in_declarator_suffix880 = frozenset([63])
+ FOLLOW_63_in_declarator_suffix882 = frozenset([1])
+ FOLLOW_62_in_declarator_suffix892 = frozenset([4])
+ FOLLOW_identifier_list_in_declarator_suffix894 = frozenset([63])
+ FOLLOW_63_in_declarator_suffix896 = frozenset([1])
+ FOLLOW_62_in_declarator_suffix906 = frozenset([63])
+ FOLLOW_63_in_declarator_suffix908 = frozenset([1])
+ FOLLOW_66_in_pointer919 = frozenset([49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_qualifier_in_pointer921 = frozenset([1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_pointer_in_pointer924 = frozenset([1])
+ FOLLOW_66_in_pointer930 = frozenset([66])
+ FOLLOW_pointer_in_pointer932 = frozenset([1])
+ FOLLOW_66_in_pointer937 = frozenset([1])
+ FOLLOW_parameter_list_in_parameter_type_list948 = frozenset([1, 27])
+ FOLLOW_27_in_parameter_type_list951 = frozenset([53, 67])
+ FOLLOW_53_in_parameter_type_list954 = frozenset([67])
+ FOLLOW_67_in_parameter_type_list958 = frozenset([1])
+ FOLLOW_parameter_declaration_in_parameter_list971 = frozenset([1, 27])
+ FOLLOW_27_in_parameter_list974 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_53_in_parameter_list977 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_parameter_declaration_in_parameter_list981 = frozenset([1, 27])
+ FOLLOW_declaration_specifiers_in_parameter_declaration994 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66])
+ FOLLOW_declarator_in_parameter_declaration997 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66])
+ FOLLOW_abstract_declarator_in_parameter_declaration999 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66])
+ FOLLOW_53_in_parameter_declaration1004 = frozenset([1])
+ FOLLOW_pointer_in_parameter_declaration1013 = frozenset([4, 66])
+ FOLLOW_IDENTIFIER_in_parameter_declaration1016 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_identifier_list1027 = frozenset([1, 27])
+ FOLLOW_27_in_identifier_list1031 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_identifier_list1033 = frozenset([1, 27])
+ FOLLOW_specifier_qualifier_list_in_type_name1046 = frozenset([1, 62, 64, 66])
+ FOLLOW_abstract_declarator_in_type_name1048 = frozenset([1])
+ FOLLOW_type_id_in_type_name1054 = frozenset([1])
+ FOLLOW_pointer_in_abstract_declarator1065 = frozenset([1, 62, 64])
+ FOLLOW_direct_abstract_declarator_in_abstract_declarator1067 = frozenset([1])
+ FOLLOW_direct_abstract_declarator_in_abstract_declarator1073 = frozenset([1])
+ FOLLOW_62_in_direct_abstract_declarator1086 = frozenset([62, 64, 66])
+ FOLLOW_abstract_declarator_in_direct_abstract_declarator1088 = frozenset([63])
+ FOLLOW_63_in_direct_abstract_declarator1090 = frozenset([1, 62, 64])
+ FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1094 = frozenset([1, 62, 64])
+ FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1098 = frozenset([1, 62, 64])
+ FOLLOW_64_in_abstract_declarator_suffix1110 = frozenset([65])
+ FOLLOW_65_in_abstract_declarator_suffix1112 = frozenset([1])
+ FOLLOW_64_in_abstract_declarator_suffix1117 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_constant_expression_in_abstract_declarator_suffix1119 = frozenset([65])
+ FOLLOW_65_in_abstract_declarator_suffix1121 = frozenset([1])
+ FOLLOW_62_in_abstract_declarator_suffix1126 = frozenset([63])
+ FOLLOW_63_in_abstract_declarator_suffix1128 = frozenset([1])
+ FOLLOW_62_in_abstract_declarator_suffix1133 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_parameter_type_list_in_abstract_declarator_suffix1135 = frozenset([63])
+ FOLLOW_63_in_abstract_declarator_suffix1137 = frozenset([1])
+ FOLLOW_assignment_expression_in_initializer1150 = frozenset([1])
+ FOLLOW_43_in_initializer1155 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_initializer_list_in_initializer1157 = frozenset([27, 44])
+ FOLLOW_27_in_initializer1159 = frozenset([44])
+ FOLLOW_44_in_initializer1162 = frozenset([1])
+ FOLLOW_initializer_in_initializer_list1173 = frozenset([1, 27])
+ FOLLOW_27_in_initializer_list1176 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_initializer_in_initializer_list1178 = frozenset([1, 27])
+ FOLLOW_assignment_expression_in_argument_expression_list1196 = frozenset([1, 27, 53])
+ FOLLOW_53_in_argument_expression_list1199 = frozenset([1, 27])
+ FOLLOW_27_in_argument_expression_list1204 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_assignment_expression_in_argument_expression_list1206 = frozenset([1, 27, 53])
+ FOLLOW_53_in_argument_expression_list1209 = frozenset([1, 27])
+ FOLLOW_multiplicative_expression_in_additive_expression1225 = frozenset([1, 68, 69])
+ FOLLOW_68_in_additive_expression1229 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_multiplicative_expression_in_additive_expression1231 = frozenset([1, 68, 69])
+ FOLLOW_69_in_additive_expression1235 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_multiplicative_expression_in_additive_expression1237 = frozenset([1, 68, 69])
+ FOLLOW_cast_expression_in_multiplicative_expression1251 = frozenset([1, 66, 70, 71])
+ FOLLOW_66_in_multiplicative_expression1255 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_cast_expression_in_multiplicative_expression1257 = frozenset([1, 66, 70, 71])
+ FOLLOW_70_in_multiplicative_expression1261 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_cast_expression_in_multiplicative_expression1263 = frozenset([1, 66, 70, 71])
+ FOLLOW_71_in_multiplicative_expression1267 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_cast_expression_in_multiplicative_expression1269 = frozenset([1, 66, 70, 71])
+ FOLLOW_62_in_cast_expression1282 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_name_in_cast_expression1284 = frozenset([63])
+ FOLLOW_63_in_cast_expression1286 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_cast_expression_in_cast_expression1288 = frozenset([1])
+ FOLLOW_unary_expression_in_cast_expression1293 = frozenset([1])
+ FOLLOW_postfix_expression_in_unary_expression1304 = frozenset([1])
+ FOLLOW_72_in_unary_expression1309 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_unary_expression_in_unary_expression1311 = frozenset([1])
+ FOLLOW_73_in_unary_expression1316 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_unary_expression_in_unary_expression1318 = frozenset([1])
+ FOLLOW_unary_operator_in_unary_expression1323 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_cast_expression_in_unary_expression1325 = frozenset([1])
+ FOLLOW_74_in_unary_expression1330 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_unary_expression_in_unary_expression1332 = frozenset([1])
+ FOLLOW_74_in_unary_expression1337 = frozenset([62])
+ FOLLOW_62_in_unary_expression1339 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_name_in_unary_expression1341 = frozenset([63])
+ FOLLOW_63_in_unary_expression1343 = frozenset([1])
+ FOLLOW_primary_expression_in_postfix_expression1367 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_64_in_postfix_expression1383 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_postfix_expression1385 = frozenset([65])
+ FOLLOW_65_in_postfix_expression1387 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_62_in_postfix_expression1401 = frozenset([63])
+ FOLLOW_63_in_postfix_expression1405 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_62_in_postfix_expression1420 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_argument_expression_list_in_postfix_expression1424 = frozenset([63])
+ FOLLOW_63_in_postfix_expression1428 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_62_in_postfix_expression1444 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_macro_parameter_list_in_postfix_expression1446 = frozenset([63])
+ FOLLOW_63_in_postfix_expression1448 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_75_in_postfix_expression1462 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_postfix_expression1466 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_66_in_postfix_expression1482 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_postfix_expression1486 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_76_in_postfix_expression1502 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_postfix_expression1506 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_72_in_postfix_expression1522 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_73_in_postfix_expression1536 = frozenset([1, 62, 64, 66, 72, 73, 75, 76])
+ FOLLOW_parameter_declaration_in_macro_parameter_list1559 = frozenset([1, 27])
+ FOLLOW_27_in_macro_parameter_list1562 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_parameter_declaration_in_macro_parameter_list1564 = frozenset([1, 27])
+ FOLLOW_set_in_unary_operator0 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_primary_expression1613 = frozenset([1])
+ FOLLOW_constant_in_primary_expression1618 = frozenset([1])
+ FOLLOW_62_in_primary_expression1623 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_primary_expression1625 = frozenset([63])
+ FOLLOW_63_in_primary_expression1627 = frozenset([1])
+ FOLLOW_HEX_LITERAL_in_constant1643 = frozenset([1])
+ FOLLOW_OCTAL_LITERAL_in_constant1653 = frozenset([1])
+ FOLLOW_DECIMAL_LITERAL_in_constant1663 = frozenset([1])
+ FOLLOW_CHARACTER_LITERAL_in_constant1671 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_constant1680 = frozenset([4, 9])
+ FOLLOW_STRING_LITERAL_in_constant1683 = frozenset([1, 4, 9])
+ FOLLOW_IDENTIFIER_in_constant1688 = frozenset([1, 4])
+ FOLLOW_FLOATING_POINT_LITERAL_in_constant1699 = frozenset([1])
+ FOLLOW_assignment_expression_in_expression1715 = frozenset([1, 27])
+ FOLLOW_27_in_expression1718 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_assignment_expression_in_expression1720 = frozenset([1, 27])
+ FOLLOW_conditional_expression_in_constant_expression1733 = frozenset([1])
+ FOLLOW_lvalue_in_assignment_expression1744 = frozenset([28, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89])
+ FOLLOW_assignment_operator_in_assignment_expression1746 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_assignment_expression_in_assignment_expression1748 = frozenset([1])
+ FOLLOW_conditional_expression_in_assignment_expression1753 = frozenset([1])
+ FOLLOW_unary_expression_in_lvalue1765 = frozenset([1])
+ FOLLOW_set_in_assignment_operator0 = frozenset([1])
+ FOLLOW_logical_or_expression_in_conditional_expression1839 = frozenset([1, 90])
+ FOLLOW_90_in_conditional_expression1842 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_conditional_expression1844 = frozenset([47])
+ FOLLOW_47_in_conditional_expression1846 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_conditional_expression_in_conditional_expression1848 = frozenset([1])
+ FOLLOW_logical_and_expression_in_logical_or_expression1863 = frozenset([1, 91])
+ FOLLOW_91_in_logical_or_expression1866 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_logical_and_expression_in_logical_or_expression1868 = frozenset([1, 91])
+ FOLLOW_inclusive_or_expression_in_logical_and_expression1881 = frozenset([1, 92])
+ FOLLOW_92_in_logical_and_expression1884 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_inclusive_or_expression_in_logical_and_expression1886 = frozenset([1, 92])
+ FOLLOW_exclusive_or_expression_in_inclusive_or_expression1899 = frozenset([1, 93])
+ FOLLOW_93_in_inclusive_or_expression1902 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_exclusive_or_expression_in_inclusive_or_expression1904 = frozenset([1, 93])
+ FOLLOW_and_expression_in_exclusive_or_expression1917 = frozenset([1, 94])
+ FOLLOW_94_in_exclusive_or_expression1920 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_and_expression_in_exclusive_or_expression1922 = frozenset([1, 94])
+ FOLLOW_equality_expression_in_and_expression1935 = frozenset([1, 77])
+ FOLLOW_77_in_and_expression1938 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_equality_expression_in_and_expression1940 = frozenset([1, 77])
+ FOLLOW_relational_expression_in_equality_expression1952 = frozenset([1, 95, 96])
+ FOLLOW_set_in_equality_expression1955 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_relational_expression_in_equality_expression1961 = frozenset([1, 95, 96])
+ FOLLOW_shift_expression_in_relational_expression1975 = frozenset([1, 97, 98, 99, 100])
+ FOLLOW_set_in_relational_expression1978 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_shift_expression_in_relational_expression1988 = frozenset([1, 97, 98, 99, 100])
+ FOLLOW_additive_expression_in_shift_expression2001 = frozenset([1, 101, 102])
+ FOLLOW_set_in_shift_expression2004 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_additive_expression_in_shift_expression2010 = frozenset([1, 101, 102])
+ FOLLOW_labeled_statement_in_statement2025 = frozenset([1])
+ FOLLOW_compound_statement_in_statement2030 = frozenset([1])
+ FOLLOW_expression_statement_in_statement2035 = frozenset([1])
+ FOLLOW_selection_statement_in_statement2040 = frozenset([1])
+ FOLLOW_iteration_statement_in_statement2045 = frozenset([1])
+ FOLLOW_jump_statement_in_statement2050 = frozenset([1])
+ FOLLOW_macro_statement_in_statement2055 = frozenset([1])
+ FOLLOW_asm2_statement_in_statement2060 = frozenset([1])
+ FOLLOW_asm1_statement_in_statement2065 = frozenset([1])
+ FOLLOW_asm_statement_in_statement2070 = frozenset([1])
+ FOLLOW_declaration_in_statement2075 = frozenset([1])
+ FOLLOW_103_in_asm2_statement2086 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_asm2_statement2089 = frozenset([62])
+ FOLLOW_62_in_asm2_statement2091 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_set_in_asm2_statement2094 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_63_in_asm2_statement2101 = frozenset([25])
+ FOLLOW_25_in_asm2_statement2103 = frozenset([1])
+ FOLLOW_104_in_asm1_statement2115 = frozenset([43])
+ FOLLOW_43_in_asm1_statement2117 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_set_in_asm1_statement2120 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_44_in_asm1_statement2127 = frozenset([1])
+ FOLLOW_105_in_asm_statement2138 = frozenset([43])
+ FOLLOW_43_in_asm_statement2140 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_set_in_asm_statement2143 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_44_in_asm_statement2150 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_macro_statement2162 = frozenset([62])
+ FOLLOW_62_in_macro_statement2164 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_declaration_in_macro_statement2166 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_list_in_macro_statement2170 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_macro_statement2173 = frozenset([63])
+ FOLLOW_63_in_macro_statement2176 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_labeled_statement2188 = frozenset([47])
+ FOLLOW_47_in_labeled_statement2190 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_labeled_statement2192 = frozenset([1])
+ FOLLOW_106_in_labeled_statement2197 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_constant_expression_in_labeled_statement2199 = frozenset([47])
+ FOLLOW_47_in_labeled_statement2201 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_labeled_statement2203 = frozenset([1])
+ FOLLOW_107_in_labeled_statement2208 = frozenset([47])
+ FOLLOW_47_in_labeled_statement2210 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_labeled_statement2212 = frozenset([1])
+ FOLLOW_43_in_compound_statement2223 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_declaration_in_compound_statement2225 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_list_in_compound_statement2228 = frozenset([44])
+ FOLLOW_44_in_compound_statement2231 = frozenset([1])
+ FOLLOW_statement_in_statement_list2242 = frozenset([1, 4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_25_in_expression_statement2254 = frozenset([1])
+ FOLLOW_expression_in_expression_statement2259 = frozenset([25])
+ FOLLOW_25_in_expression_statement2261 = frozenset([1])
+ FOLLOW_108_in_selection_statement2272 = frozenset([62])
+ FOLLOW_62_in_selection_statement2274 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_selection_statement2278 = frozenset([63])
+ FOLLOW_63_in_selection_statement2280 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_selection_statement2284 = frozenset([1, 109])
+ FOLLOW_109_in_selection_statement2299 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_selection_statement2301 = frozenset([1])
+ FOLLOW_110_in_selection_statement2308 = frozenset([62])
+ FOLLOW_62_in_selection_statement2310 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_selection_statement2312 = frozenset([63])
+ FOLLOW_63_in_selection_statement2314 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_selection_statement2316 = frozenset([1])
+ FOLLOW_111_in_iteration_statement2327 = frozenset([62])
+ FOLLOW_62_in_iteration_statement2329 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_iteration_statement2333 = frozenset([63])
+ FOLLOW_63_in_iteration_statement2335 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_iteration_statement2337 = frozenset([1])
+ FOLLOW_112_in_iteration_statement2344 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_iteration_statement2346 = frozenset([111])
+ FOLLOW_111_in_iteration_statement2348 = frozenset([62])
+ FOLLOW_62_in_iteration_statement2350 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_iteration_statement2354 = frozenset([63])
+ FOLLOW_63_in_iteration_statement2356 = frozenset([25])
+ FOLLOW_25_in_iteration_statement2358 = frozenset([1])
+ FOLLOW_113_in_iteration_statement2365 = frozenset([62])
+ FOLLOW_62_in_iteration_statement2367 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_statement_in_iteration_statement2369 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_statement_in_iteration_statement2373 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_iteration_statement2375 = frozenset([63])
+ FOLLOW_63_in_iteration_statement2378 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117])
+ FOLLOW_statement_in_iteration_statement2380 = frozenset([1])
+ FOLLOW_114_in_jump_statement2393 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_jump_statement2395 = frozenset([25])
+ FOLLOW_25_in_jump_statement2397 = frozenset([1])
+ FOLLOW_115_in_jump_statement2402 = frozenset([25])
+ FOLLOW_25_in_jump_statement2404 = frozenset([1])
+ FOLLOW_116_in_jump_statement2409 = frozenset([25])
+ FOLLOW_25_in_jump_statement2411 = frozenset([1])
+ FOLLOW_117_in_jump_statement2416 = frozenset([25])
+ FOLLOW_25_in_jump_statement2418 = frozenset([1])
+ FOLLOW_117_in_jump_statement2423 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_expression_in_jump_statement2425 = frozenset([25])
+ FOLLOW_25_in_jump_statement2427 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_synpred2100 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_synpred4100 = frozenset([4, 58, 59, 60, 62, 66])
+ FOLLOW_declarator_in_synpred4103 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_declaration_in_synpred4105 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_43_in_synpred4108 = frozenset([1])
+ FOLLOW_declaration_in_synpred5118 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_synpred7157 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_synpred10207 = frozenset([1])
+ FOLLOW_type_specifier_in_synpred14272 = frozenset([1])
+ FOLLOW_type_qualifier_in_synpred15286 = frozenset([1])
+ FOLLOW_type_qualifier_in_synpred33444 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_synpred34442 = frozenset([4, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66])
+ FOLLOW_type_qualifier_in_synpred34444 = frozenset([4, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66])
+ FOLLOW_declarator_in_synpred34447 = frozenset([1])
+ FOLLOW_type_qualifier_in_synpred39566 = frozenset([1])
+ FOLLOW_type_specifier_in_synpred40570 = frozenset([1])
+ FOLLOW_pointer_in_synpred66784 = frozenset([4, 58, 59, 60, 62])
+ FOLLOW_58_in_synpred66788 = frozenset([4, 59, 60, 62])
+ FOLLOW_59_in_synpred66793 = frozenset([4, 60, 62])
+ FOLLOW_60_in_synpred66798 = frozenset([4, 62])
+ FOLLOW_direct_declarator_in_synpred66802 = frozenset([1])
+ FOLLOW_declarator_suffix_in_synpred67821 = frozenset([1])
+ FOLLOW_58_in_synpred69830 = frozenset([1])
+ FOLLOW_declarator_suffix_in_synpred70838 = frozenset([1])
+ FOLLOW_62_in_synpred73878 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_parameter_type_list_in_synpred73880 = frozenset([63])
+ FOLLOW_63_in_synpred73882 = frozenset([1])
+ FOLLOW_62_in_synpred74892 = frozenset([4])
+ FOLLOW_identifier_list_in_synpred74894 = frozenset([63])
+ FOLLOW_63_in_synpred74896 = frozenset([1])
+ FOLLOW_type_qualifier_in_synpred75921 = frozenset([1])
+ FOLLOW_pointer_in_synpred76924 = frozenset([1])
+ FOLLOW_66_in_synpred77919 = frozenset([49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_qualifier_in_synpred77921 = frozenset([1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_pointer_in_synpred77924 = frozenset([1])
+ FOLLOW_66_in_synpred78930 = frozenset([66])
+ FOLLOW_pointer_in_synpred78932 = frozenset([1])
+ FOLLOW_53_in_synpred81977 = frozenset([1])
+ FOLLOW_27_in_synpred82974 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_53_in_synpred82977 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_parameter_declaration_in_synpred82981 = frozenset([1])
+ FOLLOW_declarator_in_synpred83997 = frozenset([1])
+ FOLLOW_abstract_declarator_in_synpred84999 = frozenset([1])
+ FOLLOW_declaration_specifiers_in_synpred86994 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66])
+ FOLLOW_declarator_in_synpred86997 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66])
+ FOLLOW_abstract_declarator_in_synpred86999 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66])
+ FOLLOW_53_in_synpred861004 = frozenset([1])
+ FOLLOW_specifier_qualifier_list_in_synpred901046 = frozenset([1, 62, 64, 66])
+ FOLLOW_abstract_declarator_in_synpred901048 = frozenset([1])
+ FOLLOW_direct_abstract_declarator_in_synpred911067 = frozenset([1])
+ FOLLOW_62_in_synpred931086 = frozenset([62, 64, 66])
+ FOLLOW_abstract_declarator_in_synpred931088 = frozenset([63])
+ FOLLOW_63_in_synpred931090 = frozenset([1])
+ FOLLOW_abstract_declarator_suffix_in_synpred941098 = frozenset([1])
+ FOLLOW_62_in_synpred1091282 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61])
+ FOLLOW_type_name_in_synpred1091284 = frozenset([63])
+ FOLLOW_63_in_synpred1091286 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_cast_expression_in_synpred1091288 = frozenset([1])
+ FOLLOW_74_in_synpred1141330 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_unary_expression_in_synpred1141332 = frozenset([1])
+ FOLLOW_62_in_synpred1171420 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_argument_expression_list_in_synpred1171424 = frozenset([63])
+ FOLLOW_63_in_synpred1171428 = frozenset([1])
+ FOLLOW_62_in_synpred1181444 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66])
+ FOLLOW_macro_parameter_list_in_synpred1181446 = frozenset([63])
+ FOLLOW_63_in_synpred1181448 = frozenset([1])
+ FOLLOW_66_in_synpred1201482 = frozenset([4])
+ FOLLOW_IDENTIFIER_in_synpred1201486 = frozenset([1])
+ FOLLOW_STRING_LITERAL_in_synpred1371683 = frozenset([1])
+ FOLLOW_IDENTIFIER_in_synpred1381680 = frozenset([4, 9])
+ FOLLOW_STRING_LITERAL_in_synpred1381683 = frozenset([1, 9])
+ FOLLOW_lvalue_in_synpred1421744 = frozenset([28, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89])
+ FOLLOW_assignment_operator_in_synpred1421746 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79])
+ FOLLOW_assignment_expression_in_synpred1421748 = frozenset([1])
+ FOLLOW_expression_statement_in_synpred1692035 = frozenset([1])
+ FOLLOW_macro_statement_in_synpred1732055 = frozenset([1])
+ FOLLOW_asm2_statement_in_synpred1742060 = frozenset([1])
+ FOLLOW_declaration_in_synpred1812166 = frozenset([1])
+ FOLLOW_statement_list_in_synpred1822170 = frozenset([1])
+ FOLLOW_declaration_in_synpred1862225 = frozenset([1])
+ FOLLOW_statement_in_synpred1882242 = frozenset([1])
+
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/CParser3/__init__.py b/roms/edk2/BaseTools/Source/Python/Eot/CParser3/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/CParser3/__init__.py
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/CParser4/CLexer.py b/roms/edk2/BaseTools/Source/Python/Eot/CParser4/CLexer.py
new file mode 100644
index 000000000..54374fd6e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/CParser4/CLexer.py
@@ -0,0 +1,627 @@
+# Generated from C.g4 by ANTLR 4.7.1
+from antlr4 import *
+from io import StringIO
+from typing.io import TextIO
+import sys
+
+
+## @file
+# The file defines the parser for C source files.
+#
+# THIS FILE IS AUTO-GENENERATED. PLEASE DON NOT MODIFY THIS FILE.
+# This file is generated by running:
+# java org.antlr.Tool C.g
+#
+# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+import Ecc.CodeFragment as CodeFragment
+import Ecc.FileProfile as FileProfile
+
+
+def serializedATN():
+ with StringIO() as buf:
+ buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2k")
+ buf.write("\u0383\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7")
+ buf.write("\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r")
+ buf.write("\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23")
+ buf.write("\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30")
+ buf.write("\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36")
+ buf.write("\t\36\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%")
+ buf.write("\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4,\t,\4-\t-\4.")
+ buf.write("\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64")
+ buf.write("\t\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:")
+ buf.write("\4;\t;\4<\t<\4=\t=\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\t")
+ buf.write("C\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4I\tI\4J\tJ\4K\tK\4L\t")
+ buf.write("L\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\tT\4U\t")
+ buf.write("U\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4")
+ buf.write("^\t^\4_\t_\4`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4")
+ buf.write("g\tg\4h\th\4i\ti\4j\tj\4k\tk\4l\tl\4m\tm\4n\tn\4o\to\4")
+ buf.write("p\tp\4q\tq\4r\tr\3\2\3\2\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3")
+ buf.write("\4\3\4\3\4\3\5\3\5\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7")
+ buf.write("\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\n\3")
+ buf.write("\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\13")
+ buf.write("\3\13\3\13\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\16")
+ buf.write("\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3\20\3\20")
+ buf.write("\3\20\3\20\3\20\3\21\3\21\3\21\3\21\3\21\3\21\3\22\3\22")
+ buf.write("\3\22\3\22\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3\23\3\23")
+ buf.write("\3\23\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\25")
+ buf.write("\3\25\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\27\3\27\3\27")
+ buf.write("\3\27\3\27\3\27\3\30\3\30\3\31\3\31\3\31\3\31\3\31\3\32")
+ buf.write("\3\32\3\32\3\32\3\32\3\32\3\33\3\33\3\33\3\33\3\33\3\33")
+ buf.write("\3\33\3\33\3\33\3\34\3\34\3\34\3\35\3\35\3\35\3\35\3\36")
+ buf.write("\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\37\3\37\3\37")
+ buf.write("\3\37\3\37\3\37\3 \3 \3 \3 \3 \3 \3 \3 \3 \3 \3!\3!\3")
+ buf.write("!\3!\3!\3!\3!\3!\3!\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3")
+ buf.write("\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"")
+ buf.write("\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3#\3#\3#\3#\3#\3#\3#")
+ buf.write("\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3%\3")
+ buf.write("%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3")
+ buf.write("&\3&\3&\3&\3&\3&\3&\3\'\3\'\3(\3(\3)\3)\3*\3*\3+\3+\3")
+ buf.write(",\3,\3,\3,\3-\3-\3.\3.\3/\3/\3\60\3\60\3\61\3\61\3\61")
+ buf.write("\3\62\3\62\3\62\3\63\3\63\3\63\3\63\3\63\3\63\3\63\3\64")
+ buf.write("\3\64\3\65\3\65\3\65\3\66\3\66\3\67\3\67\38\38\39\39\3")
+ buf.write("9\3:\3:\3:\3;\3;\3;\3<\3<\3<\3=\3=\3=\3>\3>\3>\3>\3?\3")
+ buf.write("?\3?\3?\3@\3@\3@\3A\3A\3A\3B\3B\3B\3C\3C\3D\3D\3D\3E\3")
+ buf.write("E\3E\3F\3F\3G\3G\3H\3H\3H\3I\3I\3I\3J\3J\3K\3K\3L\3L\3")
+ buf.write("L\3M\3M\3M\3N\3N\3N\3O\3O\3O\3P\3P\3P\3P\3P\3P\3P\3P\3")
+ buf.write("Q\3Q\3Q\3Q\3Q\3R\3R\3R\3R\3R\3R\3S\3S\3S\3S\3S\3T\3T\3")
+ buf.write("T\3T\3T\3T\3T\3T\3U\3U\3U\3V\3V\3V\3V\3V\3W\3W\3W\3W\3")
+ buf.write("W\3W\3W\3X\3X\3X\3X\3X\3X\3Y\3Y\3Y\3Z\3Z\3Z\3Z\3Z\3[\3")
+ buf.write("[\3[\3[\3[\3[\3[\3[\3[\3\\\3\\\3\\\3\\\3\\\3\\\3]\3]\3")
+ buf.write("]\3]\3]\3]\3]\3^\3^\3^\7^\u02b2\n^\f^\16^\u02b5\13^\3")
+ buf.write("_\3_\3`\5`\u02ba\n`\3`\3`\3`\5`\u02bf\n`\3`\3`\3a\5a\u02c4")
+ buf.write("\na\3a\3a\3a\7a\u02c9\na\fa\16a\u02cc\13a\3a\3a\3b\3b")
+ buf.write("\3b\6b\u02d3\nb\rb\16b\u02d4\3b\5b\u02d8\nb\3c\3c\3c\7")
+ buf.write("c\u02dd\nc\fc\16c\u02e0\13c\5c\u02e2\nc\3c\5c\u02e5\n")
+ buf.write("c\3d\3d\6d\u02e9\nd\rd\16d\u02ea\3d\5d\u02ee\nd\3e\3e")
+ buf.write("\3f\3f\3f\3f\3f\3f\5f\u02f8\nf\3g\6g\u02fb\ng\rg\16g\u02fc")
+ buf.write("\3g\3g\7g\u0301\ng\fg\16g\u0304\13g\3g\5g\u0307\ng\3g")
+ buf.write("\5g\u030a\ng\3g\3g\6g\u030e\ng\rg\16g\u030f\3g\5g\u0313")
+ buf.write("\ng\3g\5g\u0316\ng\3g\6g\u0319\ng\rg\16g\u031a\3g\3g\5")
+ buf.write("g\u031f\ng\3g\6g\u0322\ng\rg\16g\u0323\3g\5g\u0327\ng")
+ buf.write("\3g\5g\u032a\ng\3h\3h\5h\u032e\nh\3h\6h\u0331\nh\rh\16")
+ buf.write("h\u0332\3i\3i\3j\3j\3j\5j\u033a\nj\3k\3k\3k\3k\3k\3k\3")
+ buf.write("k\3k\3k\5k\u0345\nk\3l\3l\3l\3l\3l\3l\3l\3m\3m\3m\3m\3")
+ buf.write("n\3n\3n\3n\3o\3o\3p\3p\3p\3p\7p\u035c\np\fp\16p\u035f")
+ buf.write("\13p\3p\3p\3p\3p\3p\3q\3q\3q\3q\7q\u036a\nq\fq\16q\u036d")
+ buf.write("\13q\3q\5q\u0370\nq\3q\3q\3q\3q\3r\3r\7r\u0378\nr\fr\16")
+ buf.write("r\u037b\13r\3r\5r\u037e\nr\3r\3r\3r\3r\3\u035d\2s\3\3")
+ buf.write("\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16")
+ buf.write("\33\17\35\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61")
+ buf.write("\32\63\33\65\34\67\359\36;\37= ?!A\"C#E$G%I&K\'M(O)Q*")
+ buf.write("S+U,W-Y.[/]\60_\61a\62c\63e\64g\65i\66k\67m8o9q:s;u<w")
+ buf.write("=y>{?}@\177A\u0081B\u0083C\u0085D\u0087E\u0089F\u008b")
+ buf.write("G\u008dH\u008fI\u0091J\u0093K\u0095L\u0097M\u0099N\u009b")
+ buf.write("O\u009dP\u009fQ\u00a1R\u00a3S\u00a5T\u00a7U\u00a9V\u00ab")
+ buf.write("W\u00adX\u00afY\u00b1Z\u00b3[\u00b5\\\u00b7]\u00b9^\u00bb")
+ buf.write("_\u00bd\2\u00bf`\u00c1a\u00c3b\u00c5c\u00c7d\u00c9\2\u00cb")
+ buf.write("\2\u00cde\u00cf\2\u00d1\2\u00d3\2\u00d5\2\u00d7\2\u00d9")
+ buf.write("f\u00dbg\u00ddh\u00dfi\u00e1j\u00e3k\3\2\20\6\2&&C\\a")
+ buf.write("ac|\4\2))^^\4\2$$^^\4\2ZZzz\5\2\62;CHch\6\2NNWWnnww\4")
+ buf.write("\2WWww\4\2NNnn\4\2GGgg\4\2--//\6\2FFHHffhh\t\2))^^ddh")
+ buf.write("hppttvv\5\2\13\f\16\17\"\"\4\2\f\f\17\17\2\u03a2\2\3\3")
+ buf.write("\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2")
+ buf.write("\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2")
+ buf.write("\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2")
+ buf.write("\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2")
+ buf.write("\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3")
+ buf.write("\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2")
+ buf.write("\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3")
+ buf.write("\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K")
+ buf.write("\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2")
+ buf.write("U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2")
+ buf.write("\2_\3\2\2\2\2a\3\2\2\2\2c\3\2\2\2\2e\3\2\2\2\2g\3\2\2")
+ buf.write("\2\2i\3\2\2\2\2k\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2\2q\3\2")
+ buf.write("\2\2\2s\3\2\2\2\2u\3\2\2\2\2w\3\2\2\2\2y\3\2\2\2\2{\3")
+ buf.write("\2\2\2\2}\3\2\2\2\2\177\3\2\2\2\2\u0081\3\2\2\2\2\u0083")
+ buf.write("\3\2\2\2\2\u0085\3\2\2\2\2\u0087\3\2\2\2\2\u0089\3\2\2")
+ buf.write("\2\2\u008b\3\2\2\2\2\u008d\3\2\2\2\2\u008f\3\2\2\2\2\u0091")
+ buf.write("\3\2\2\2\2\u0093\3\2\2\2\2\u0095\3\2\2\2\2\u0097\3\2\2")
+ buf.write("\2\2\u0099\3\2\2\2\2\u009b\3\2\2\2\2\u009d\3\2\2\2\2\u009f")
+ buf.write("\3\2\2\2\2\u00a1\3\2\2\2\2\u00a3\3\2\2\2\2\u00a5\3\2\2")
+ buf.write("\2\2\u00a7\3\2\2\2\2\u00a9\3\2\2\2\2\u00ab\3\2\2\2\2\u00ad")
+ buf.write("\3\2\2\2\2\u00af\3\2\2\2\2\u00b1\3\2\2\2\2\u00b3\3\2\2")
+ buf.write("\2\2\u00b5\3\2\2\2\2\u00b7\3\2\2\2\2\u00b9\3\2\2\2\2\u00bb")
+ buf.write("\3\2\2\2\2\u00bf\3\2\2\2\2\u00c1\3\2\2\2\2\u00c3\3\2\2")
+ buf.write("\2\2\u00c5\3\2\2\2\2\u00c7\3\2\2\2\2\u00cd\3\2\2\2\2\u00d9")
+ buf.write("\3\2\2\2\2\u00db\3\2\2\2\2\u00dd\3\2\2\2\2\u00df\3\2\2")
+ buf.write("\2\2\u00e1\3\2\2\2\2\u00e3\3\2\2\2\3\u00e5\3\2\2\2\5\u00e7")
+ buf.write("\3\2\2\2\7\u00e9\3\2\2\2\t\u00f1\3\2\2\2\13\u00f3\3\2")
+ buf.write("\2\2\r\u00f5\3\2\2\2\17\u00fc\3\2\2\2\21\u0103\3\2\2\2")
+ buf.write("\23\u0108\3\2\2\2\25\u0111\3\2\2\2\27\u0118\3\2\2\2\31")
+ buf.write("\u011d\3\2\2\2\33\u0122\3\2\2\2\35\u0128\3\2\2\2\37\u012c")
+ buf.write("\3\2\2\2!\u0131\3\2\2\2#\u0137\3\2\2\2%\u013e\3\2\2\2")
+ buf.write("\'\u0145\3\2\2\2)\u014e\3\2\2\2+\u0150\3\2\2\2-\u0157")
+ buf.write("\3\2\2\2/\u015d\3\2\2\2\61\u015f\3\2\2\2\63\u0164\3\2")
+ buf.write("\2\2\65\u016a\3\2\2\2\67\u0173\3\2\2\29\u0176\3\2\2\2")
+ buf.write(";\u017a\3\2\2\2=\u0183\3\2\2\2?\u0189\3\2\2\2A\u0193\3")
+ buf.write("\2\2\2C\u019c\3\2\2\2E\u01ba\3\2\2\2G\u01c1\3\2\2\2I\u01d1")
+ buf.write("\3\2\2\2K\u01e4\3\2\2\2M\u01eb\3\2\2\2O\u01ed\3\2\2\2")
+ buf.write("Q\u01ef\3\2\2\2S\u01f1\3\2\2\2U\u01f3\3\2\2\2W\u01f5\3")
+ buf.write("\2\2\2Y\u01f9\3\2\2\2[\u01fb\3\2\2\2]\u01fd\3\2\2\2_\u01ff")
+ buf.write("\3\2\2\2a\u0201\3\2\2\2c\u0204\3\2\2\2e\u0207\3\2\2\2")
+ buf.write("g\u020e\3\2\2\2i\u0210\3\2\2\2k\u0213\3\2\2\2m\u0215\3")
+ buf.write("\2\2\2o\u0217\3\2\2\2q\u0219\3\2\2\2s\u021c\3\2\2\2u\u021f")
+ buf.write("\3\2\2\2w\u0222\3\2\2\2y\u0225\3\2\2\2{\u0228\3\2\2\2")
+ buf.write("}\u022c\3\2\2\2\177\u0230\3\2\2\2\u0081\u0233\3\2\2\2")
+ buf.write("\u0083\u0236\3\2\2\2\u0085\u0239\3\2\2\2\u0087\u023b\3")
+ buf.write("\2\2\2\u0089\u023e\3\2\2\2\u008b\u0241\3\2\2\2\u008d\u0243")
+ buf.write("\3\2\2\2\u008f\u0245\3\2\2\2\u0091\u0248\3\2\2\2\u0093")
+ buf.write("\u024b\3\2\2\2\u0095\u024d\3\2\2\2\u0097\u024f\3\2\2\2")
+ buf.write("\u0099\u0252\3\2\2\2\u009b\u0255\3\2\2\2\u009d\u0258\3")
+ buf.write("\2\2\2\u009f\u025b\3\2\2\2\u00a1\u0263\3\2\2\2\u00a3\u0268")
+ buf.write("\3\2\2\2\u00a5\u026e\3\2\2\2\u00a7\u0273\3\2\2\2\u00a9")
+ buf.write("\u027b\3\2\2\2\u00ab\u027e\3\2\2\2\u00ad\u0283\3\2\2\2")
+ buf.write("\u00af\u028a\3\2\2\2\u00b1\u0290\3\2\2\2\u00b3\u0293\3")
+ buf.write("\2\2\2\u00b5\u0298\3\2\2\2\u00b7\u02a1\3\2\2\2\u00b9\u02a7")
+ buf.write("\3\2\2\2\u00bb\u02ae\3\2\2\2\u00bd\u02b6\3\2\2\2\u00bf")
+ buf.write("\u02b9\3\2\2\2\u00c1\u02c3\3\2\2\2\u00c3\u02cf\3\2\2\2")
+ buf.write("\u00c5\u02e1\3\2\2\2\u00c7\u02e6\3\2\2\2\u00c9\u02ef\3")
+ buf.write("\2\2\2\u00cb\u02f7\3\2\2\2\u00cd\u0329\3\2\2\2\u00cf\u032b")
+ buf.write("\3\2\2\2\u00d1\u0334\3\2\2\2\u00d3\u0339\3\2\2\2\u00d5")
+ buf.write("\u0344\3\2\2\2\u00d7\u0346\3\2\2\2\u00d9\u034d\3\2\2\2")
+ buf.write("\u00db\u0351\3\2\2\2\u00dd\u0355\3\2\2\2\u00df\u0357\3")
+ buf.write("\2\2\2\u00e1\u0365\3\2\2\2\u00e3\u0375\3\2\2\2\u00e5\u00e6")
+ buf.write("\7}\2\2\u00e6\4\3\2\2\2\u00e7\u00e8\7=\2\2\u00e8\6\3\2")
+ buf.write("\2\2\u00e9\u00ea\7v\2\2\u00ea\u00eb\7{\2\2\u00eb\u00ec")
+ buf.write("\7r\2\2\u00ec\u00ed\7g\2\2\u00ed\u00ee\7f\2\2\u00ee\u00ef")
+ buf.write("\7g\2\2\u00ef\u00f0\7h\2\2\u00f0\b\3\2\2\2\u00f1\u00f2")
+ buf.write("\7.\2\2\u00f2\n\3\2\2\2\u00f3\u00f4\7?\2\2\u00f4\f\3\2")
+ buf.write("\2\2\u00f5\u00f6\7g\2\2\u00f6\u00f7\7z\2\2\u00f7\u00f8")
+ buf.write("\7v\2\2\u00f8\u00f9\7g\2\2\u00f9\u00fa\7t\2\2\u00fa\u00fb")
+ buf.write("\7p\2\2\u00fb\16\3\2\2\2\u00fc\u00fd\7u\2\2\u00fd\u00fe")
+ buf.write("\7v\2\2\u00fe\u00ff\7c\2\2\u00ff\u0100\7v\2\2\u0100\u0101")
+ buf.write("\7k\2\2\u0101\u0102\7e\2\2\u0102\20\3\2\2\2\u0103\u0104")
+ buf.write("\7c\2\2\u0104\u0105\7w\2\2\u0105\u0106\7v\2\2\u0106\u0107")
+ buf.write("\7q\2\2\u0107\22\3\2\2\2\u0108\u0109\7t\2\2\u0109\u010a")
+ buf.write("\7g\2\2\u010a\u010b\7i\2\2\u010b\u010c\7k\2\2\u010c\u010d")
+ buf.write("\7u\2\2\u010d\u010e\7v\2\2\u010e\u010f\7g\2\2\u010f\u0110")
+ buf.write("\7t\2\2\u0110\24\3\2\2\2\u0111\u0112\7U\2\2\u0112\u0113")
+ buf.write("\7V\2\2\u0113\u0114\7C\2\2\u0114\u0115\7V\2\2\u0115\u0116")
+ buf.write("\7K\2\2\u0116\u0117\7E\2\2\u0117\26\3\2\2\2\u0118\u0119")
+ buf.write("\7x\2\2\u0119\u011a\7q\2\2\u011a\u011b\7k\2\2\u011b\u011c")
+ buf.write("\7f\2\2\u011c\30\3\2\2\2\u011d\u011e\7e\2\2\u011e\u011f")
+ buf.write("\7j\2\2\u011f\u0120\7c\2\2\u0120\u0121\7t\2\2\u0121\32")
+ buf.write("\3\2\2\2\u0122\u0123\7u\2\2\u0123\u0124\7j\2\2\u0124\u0125")
+ buf.write("\7q\2\2\u0125\u0126\7t\2\2\u0126\u0127\7v\2\2\u0127\34")
+ buf.write("\3\2\2\2\u0128\u0129\7k\2\2\u0129\u012a\7p\2\2\u012a\u012b")
+ buf.write("\7v\2\2\u012b\36\3\2\2\2\u012c\u012d\7n\2\2\u012d\u012e")
+ buf.write("\7q\2\2\u012e\u012f\7p\2\2\u012f\u0130\7i\2\2\u0130 \3")
+ buf.write("\2\2\2\u0131\u0132\7h\2\2\u0132\u0133\7n\2\2\u0133\u0134")
+ buf.write("\7q\2\2\u0134\u0135\7c\2\2\u0135\u0136\7v\2\2\u0136\"")
+ buf.write("\3\2\2\2\u0137\u0138\7f\2\2\u0138\u0139\7q\2\2\u0139\u013a")
+ buf.write("\7w\2\2\u013a\u013b\7d\2\2\u013b\u013c\7n\2\2\u013c\u013d")
+ buf.write("\7g\2\2\u013d$\3\2\2\2\u013e\u013f\7u\2\2\u013f\u0140")
+ buf.write("\7k\2\2\u0140\u0141\7i\2\2\u0141\u0142\7p\2\2\u0142\u0143")
+ buf.write("\7g\2\2\u0143\u0144\7f\2\2\u0144&\3\2\2\2\u0145\u0146")
+ buf.write("\7w\2\2\u0146\u0147\7p\2\2\u0147\u0148\7u\2\2\u0148\u0149")
+ buf.write("\7k\2\2\u0149\u014a\7i\2\2\u014a\u014b\7p\2\2\u014b\u014c")
+ buf.write("\7g\2\2\u014c\u014d\7f\2\2\u014d(\3\2\2\2\u014e\u014f")
+ buf.write("\7\177\2\2\u014f*\3\2\2\2\u0150\u0151\7u\2\2\u0151\u0152")
+ buf.write("\7v\2\2\u0152\u0153\7t\2\2\u0153\u0154\7w\2\2\u0154\u0155")
+ buf.write("\7e\2\2\u0155\u0156\7v\2\2\u0156,\3\2\2\2\u0157\u0158")
+ buf.write("\7w\2\2\u0158\u0159\7p\2\2\u0159\u015a\7k\2\2\u015a\u015b")
+ buf.write("\7q\2\2\u015b\u015c\7p\2\2\u015c.\3\2\2\2\u015d\u015e")
+ buf.write("\7<\2\2\u015e\60\3\2\2\2\u015f\u0160\7g\2\2\u0160\u0161")
+ buf.write("\7p\2\2\u0161\u0162\7w\2\2\u0162\u0163\7o\2\2\u0163\62")
+ buf.write("\3\2\2\2\u0164\u0165\7e\2\2\u0165\u0166\7q\2\2\u0166\u0167")
+ buf.write("\7p\2\2\u0167\u0168\7u\2\2\u0168\u0169\7v\2\2\u0169\64")
+ buf.write("\3\2\2\2\u016a\u016b\7x\2\2\u016b\u016c\7q\2\2\u016c\u016d")
+ buf.write("\7n\2\2\u016d\u016e\7c\2\2\u016e\u016f\7v\2\2\u016f\u0170")
+ buf.write("\7k\2\2\u0170\u0171\7n\2\2\u0171\u0172\7g\2\2\u0172\66")
+ buf.write("\3\2\2\2\u0173\u0174\7K\2\2\u0174\u0175\7P\2\2\u01758")
+ buf.write("\3\2\2\2\u0176\u0177\7Q\2\2\u0177\u0178\7W\2\2\u0178\u0179")
+ buf.write("\7V\2\2\u0179:\3\2\2\2\u017a\u017b\7Q\2\2\u017b\u017c")
+ buf.write("\7R\2\2\u017c\u017d\7V\2\2\u017d\u017e\7K\2\2\u017e\u017f")
+ buf.write("\7Q\2\2\u017f\u0180\7P\2\2\u0180\u0181\7C\2\2\u0181\u0182")
+ buf.write("\7N\2\2\u0182<\3\2\2\2\u0183\u0184\7E\2\2\u0184\u0185")
+ buf.write("\7Q\2\2\u0185\u0186\7P\2\2\u0186\u0187\7U\2\2\u0187\u0188")
+ buf.write("\7V\2\2\u0188>\3\2\2\2\u0189\u018a\7W\2\2\u018a\u018b")
+ buf.write("\7P\2\2\u018b\u018c\7C\2\2\u018c\u018d\7N\2\2\u018d\u018e")
+ buf.write("\7K\2\2\u018e\u018f\7I\2\2\u018f\u0190\7P\2\2\u0190\u0191")
+ buf.write("\7G\2\2\u0191\u0192\7F\2\2\u0192@\3\2\2\2\u0193\u0194")
+ buf.write("\7X\2\2\u0194\u0195\7Q\2\2\u0195\u0196\7N\2\2\u0196\u0197")
+ buf.write("\7C\2\2\u0197\u0198\7V\2\2\u0198\u0199\7K\2\2\u0199\u019a")
+ buf.write("\7N\2\2\u019a\u019b\7G\2\2\u019bB\3\2\2\2\u019c\u019d")
+ buf.write("\7I\2\2\u019d\u019e\7N\2\2\u019e\u019f\7Q\2\2\u019f\u01a0")
+ buf.write("\7D\2\2\u01a0\u01a1\7C\2\2\u01a1\u01a2\7N\2\2\u01a2\u01a3")
+ buf.write("\7a\2\2\u01a3\u01a4\7T\2\2\u01a4\u01a5\7G\2\2\u01a5\u01a6")
+ buf.write("\7O\2\2\u01a6\u01a7\7Q\2\2\u01a7\u01a8\7X\2\2\u01a8\u01a9")
+ buf.write("\7G\2\2\u01a9\u01aa\7a\2\2\u01aa\u01ab\7K\2\2\u01ab\u01ac")
+ buf.write("\7H\2\2\u01ac\u01ad\7a\2\2\u01ad\u01ae\7W\2\2\u01ae\u01af")
+ buf.write("\7P\2\2\u01af\u01b0\7T\2\2\u01b0\u01b1\7G\2\2\u01b1\u01b2")
+ buf.write("\7H\2\2\u01b2\u01b3\7G\2\2\u01b3\u01b4\7T\2\2\u01b4\u01b5")
+ buf.write("\7G\2\2\u01b5\u01b6\7P\2\2\u01b6\u01b7\7E\2\2\u01b7\u01b8")
+ buf.write("\7G\2\2\u01b8\u01b9\7F\2\2\u01b9D\3\2\2\2\u01ba\u01bb")
+ buf.write("\7G\2\2\u01bb\u01bc\7H\2\2\u01bc\u01bd\7K\2\2\u01bd\u01be")
+ buf.write("\7C\2\2\u01be\u01bf\7R\2\2\u01bf\u01c0\7K\2\2\u01c0F\3")
+ buf.write("\2\2\2\u01c1\u01c2\7G\2\2\u01c2\u01c3\7H\2\2\u01c3\u01c4")
+ buf.write("\7K\2\2\u01c4\u01c5\7a\2\2\u01c5\u01c6\7D\2\2\u01c6\u01c7")
+ buf.write("\7Q\2\2\u01c7\u01c8\7Q\2\2\u01c8\u01c9\7V\2\2\u01c9\u01ca")
+ buf.write("\7U\2\2\u01ca\u01cb\7G\2\2\u01cb\u01cc\7T\2\2\u01cc\u01cd")
+ buf.write("\7X\2\2\u01cd\u01ce\7K\2\2\u01ce\u01cf\7E\2\2\u01cf\u01d0")
+ buf.write("\7G\2\2\u01d0H\3\2\2\2\u01d1\u01d2\7G\2\2\u01d2\u01d3")
+ buf.write("\7H\2\2\u01d3\u01d4\7K\2\2\u01d4\u01d5\7a\2\2\u01d5\u01d6")
+ buf.write("\7T\2\2\u01d6\u01d7\7W\2\2\u01d7\u01d8\7P\2\2\u01d8\u01d9")
+ buf.write("\7V\2\2\u01d9\u01da\7K\2\2\u01da\u01db\7O\2\2\u01db\u01dc")
+ buf.write("\7G\2\2\u01dc\u01dd\7U\2\2\u01dd\u01de\7G\2\2\u01de\u01df")
+ buf.write("\7T\2\2\u01df\u01e0\7X\2\2\u01e0\u01e1\7K\2\2\u01e1\u01e2")
+ buf.write("\7E\2\2\u01e2\u01e3\7G\2\2\u01e3J\3\2\2\2\u01e4\u01e5")
+ buf.write("\7R\2\2\u01e5\u01e6\7C\2\2\u01e6\u01e7\7E\2\2\u01e7\u01e8")
+ buf.write("\7M\2\2\u01e8\u01e9\7G\2\2\u01e9\u01ea\7F\2\2\u01eaL\3")
+ buf.write("\2\2\2\u01eb\u01ec\7*\2\2\u01ecN\3\2\2\2\u01ed\u01ee\7")
+ buf.write("+\2\2\u01eeP\3\2\2\2\u01ef\u01f0\7]\2\2\u01f0R\3\2\2\2")
+ buf.write("\u01f1\u01f2\7_\2\2\u01f2T\3\2\2\2\u01f3\u01f4\7,\2\2")
+ buf.write("\u01f4V\3\2\2\2\u01f5\u01f6\7\60\2\2\u01f6\u01f7\7\60")
+ buf.write("\2\2\u01f7\u01f8\7\60\2\2\u01f8X\3\2\2\2\u01f9\u01fa\7")
+ buf.write("-\2\2\u01faZ\3\2\2\2\u01fb\u01fc\7/\2\2\u01fc\\\3\2\2")
+ buf.write("\2\u01fd\u01fe\7\61\2\2\u01fe^\3\2\2\2\u01ff\u0200\7\'")
+ buf.write("\2\2\u0200`\3\2\2\2\u0201\u0202\7-\2\2\u0202\u0203\7-")
+ buf.write("\2\2\u0203b\3\2\2\2\u0204\u0205\7/\2\2\u0205\u0206\7/")
+ buf.write("\2\2\u0206d\3\2\2\2\u0207\u0208\7u\2\2\u0208\u0209\7k")
+ buf.write("\2\2\u0209\u020a\7|\2\2\u020a\u020b\7g\2\2\u020b\u020c")
+ buf.write("\7q\2\2\u020c\u020d\7h\2\2\u020df\3\2\2\2\u020e\u020f")
+ buf.write("\7\60\2\2\u020fh\3\2\2\2\u0210\u0211\7/\2\2\u0211\u0212")
+ buf.write("\7@\2\2\u0212j\3\2\2\2\u0213\u0214\7(\2\2\u0214l\3\2\2")
+ buf.write("\2\u0215\u0216\7\u0080\2\2\u0216n\3\2\2\2\u0217\u0218")
+ buf.write("\7#\2\2\u0218p\3\2\2\2\u0219\u021a\7,\2\2\u021a\u021b")
+ buf.write("\7?\2\2\u021br\3\2\2\2\u021c\u021d\7\61\2\2\u021d\u021e")
+ buf.write("\7?\2\2\u021et\3\2\2\2\u021f\u0220\7\'\2\2\u0220\u0221")
+ buf.write("\7?\2\2\u0221v\3\2\2\2\u0222\u0223\7-\2\2\u0223\u0224")
+ buf.write("\7?\2\2\u0224x\3\2\2\2\u0225\u0226\7/\2\2\u0226\u0227")
+ buf.write("\7?\2\2\u0227z\3\2\2\2\u0228\u0229\7>\2\2\u0229\u022a")
+ buf.write("\7>\2\2\u022a\u022b\7?\2\2\u022b|\3\2\2\2\u022c\u022d")
+ buf.write("\7@\2\2\u022d\u022e\7@\2\2\u022e\u022f\7?\2\2\u022f~\3")
+ buf.write("\2\2\2\u0230\u0231\7(\2\2\u0231\u0232\7?\2\2\u0232\u0080")
+ buf.write("\3\2\2\2\u0233\u0234\7`\2\2\u0234\u0235\7?\2\2\u0235\u0082")
+ buf.write("\3\2\2\2\u0236\u0237\7~\2\2\u0237\u0238\7?\2\2\u0238\u0084")
+ buf.write("\3\2\2\2\u0239\u023a\7A\2\2\u023a\u0086\3\2\2\2\u023b")
+ buf.write("\u023c\7~\2\2\u023c\u023d\7~\2\2\u023d\u0088\3\2\2\2\u023e")
+ buf.write("\u023f\7(\2\2\u023f\u0240\7(\2\2\u0240\u008a\3\2\2\2\u0241")
+ buf.write("\u0242\7~\2\2\u0242\u008c\3\2\2\2\u0243\u0244\7`\2\2\u0244")
+ buf.write("\u008e\3\2\2\2\u0245\u0246\7?\2\2\u0246\u0247\7?\2\2\u0247")
+ buf.write("\u0090\3\2\2\2\u0248\u0249\7#\2\2\u0249\u024a\7?\2\2\u024a")
+ buf.write("\u0092\3\2\2\2\u024b\u024c\7>\2\2\u024c\u0094\3\2\2\2")
+ buf.write("\u024d\u024e\7@\2\2\u024e\u0096\3\2\2\2\u024f\u0250\7")
+ buf.write(">\2\2\u0250\u0251\7?\2\2\u0251\u0098\3\2\2\2\u0252\u0253")
+ buf.write("\7@\2\2\u0253\u0254\7?\2\2\u0254\u009a\3\2\2\2\u0255\u0256")
+ buf.write("\7>\2\2\u0256\u0257\7>\2\2\u0257\u009c\3\2\2\2\u0258\u0259")
+ buf.write("\7@\2\2\u0259\u025a\7@\2\2\u025a\u009e\3\2\2\2\u025b\u025c")
+ buf.write("\7a\2\2\u025c\u025d\7a\2\2\u025d\u025e\7c\2\2\u025e\u025f")
+ buf.write("\7u\2\2\u025f\u0260\7o\2\2\u0260\u0261\7a\2\2\u0261\u0262")
+ buf.write("\7a\2\2\u0262\u00a0\3\2\2\2\u0263\u0264\7a\2\2\u0264\u0265")
+ buf.write("\7c\2\2\u0265\u0266\7u\2\2\u0266\u0267\7o\2\2\u0267\u00a2")
+ buf.write("\3\2\2\2\u0268\u0269\7a\2\2\u0269\u026a\7a\2\2\u026a\u026b")
+ buf.write("\7c\2\2\u026b\u026c\7u\2\2\u026c\u026d\7o\2\2\u026d\u00a4")
+ buf.write("\3\2\2\2\u026e\u026f\7e\2\2\u026f\u0270\7c\2\2\u0270\u0271")
+ buf.write("\7u\2\2\u0271\u0272\7g\2\2\u0272\u00a6\3\2\2\2\u0273\u0274")
+ buf.write("\7f\2\2\u0274\u0275\7g\2\2\u0275\u0276\7h\2\2\u0276\u0277")
+ buf.write("\7c\2\2\u0277\u0278\7w\2\2\u0278\u0279\7n\2\2\u0279\u027a")
+ buf.write("\7v\2\2\u027a\u00a8\3\2\2\2\u027b\u027c\7k\2\2\u027c\u027d")
+ buf.write("\7h\2\2\u027d\u00aa\3\2\2\2\u027e\u027f\7g\2\2\u027f\u0280")
+ buf.write("\7n\2\2\u0280\u0281\7u\2\2\u0281\u0282\7g\2\2\u0282\u00ac")
+ buf.write("\3\2\2\2\u0283\u0284\7u\2\2\u0284\u0285\7y\2\2\u0285\u0286")
+ buf.write("\7k\2\2\u0286\u0287\7v\2\2\u0287\u0288\7e\2\2\u0288\u0289")
+ buf.write("\7j\2\2\u0289\u00ae\3\2\2\2\u028a\u028b\7y\2\2\u028b\u028c")
+ buf.write("\7j\2\2\u028c\u028d\7k\2\2\u028d\u028e\7n\2\2\u028e\u028f")
+ buf.write("\7g\2\2\u028f\u00b0\3\2\2\2\u0290\u0291\7f\2\2\u0291\u0292")
+ buf.write("\7q\2\2\u0292\u00b2\3\2\2\2\u0293\u0294\7i\2\2\u0294\u0295")
+ buf.write("\7q\2\2\u0295\u0296\7v\2\2\u0296\u0297\7q\2\2\u0297\u00b4")
+ buf.write("\3\2\2\2\u0298\u0299\7e\2\2\u0299\u029a\7q\2\2\u029a\u029b")
+ buf.write("\7p\2\2\u029b\u029c\7v\2\2\u029c\u029d\7k\2\2\u029d\u029e")
+ buf.write("\7p\2\2\u029e\u029f\7w\2\2\u029f\u02a0\7g\2\2\u02a0\u00b6")
+ buf.write("\3\2\2\2\u02a1\u02a2\7d\2\2\u02a2\u02a3\7t\2\2\u02a3\u02a4")
+ buf.write("\7g\2\2\u02a4\u02a5\7c\2\2\u02a5\u02a6\7m\2\2\u02a6\u00b8")
+ buf.write("\3\2\2\2\u02a7\u02a8\7t\2\2\u02a8\u02a9\7g\2\2\u02a9\u02aa")
+ buf.write("\7v\2\2\u02aa\u02ab\7w\2\2\u02ab\u02ac\7t\2\2\u02ac\u02ad")
+ buf.write("\7p\2\2\u02ad\u00ba\3\2\2\2\u02ae\u02b3\5\u00bd_\2\u02af")
+ buf.write("\u02b2\5\u00bd_\2\u02b0\u02b2\4\62;\2\u02b1\u02af\3\2")
+ buf.write("\2\2\u02b1\u02b0\3\2\2\2\u02b2\u02b5\3\2\2\2\u02b3\u02b1")
+ buf.write("\3\2\2\2\u02b3\u02b4\3\2\2\2\u02b4\u00bc\3\2\2\2\u02b5")
+ buf.write("\u02b3\3\2\2\2\u02b6\u02b7\t\2\2\2\u02b7\u00be\3\2\2\2")
+ buf.write("\u02b8\u02ba\7N\2\2\u02b9\u02b8\3\2\2\2\u02b9\u02ba\3")
+ buf.write("\2\2\2\u02ba\u02bb\3\2\2\2\u02bb\u02be\7)\2\2\u02bc\u02bf")
+ buf.write("\5\u00d3j\2\u02bd\u02bf\n\3\2\2\u02be\u02bc\3\2\2\2\u02be")
+ buf.write("\u02bd\3\2\2\2\u02bf\u02c0\3\2\2\2\u02c0\u02c1\7)\2\2")
+ buf.write("\u02c1\u00c0\3\2\2\2\u02c2\u02c4\7N\2\2\u02c3\u02c2\3")
+ buf.write("\2\2\2\u02c3\u02c4\3\2\2\2\u02c4\u02c5\3\2\2\2\u02c5\u02ca")
+ buf.write("\7$\2\2\u02c6\u02c9\5\u00d3j\2\u02c7\u02c9\n\4\2\2\u02c8")
+ buf.write("\u02c6\3\2\2\2\u02c8\u02c7\3\2\2\2\u02c9\u02cc\3\2\2\2")
+ buf.write("\u02ca\u02c8\3\2\2\2\u02ca\u02cb\3\2\2\2\u02cb\u02cd\3")
+ buf.write("\2\2\2\u02cc\u02ca\3\2\2\2\u02cd\u02ce\7$\2\2\u02ce\u00c2")
+ buf.write("\3\2\2\2\u02cf\u02d0\7\62\2\2\u02d0\u02d2\t\5\2\2\u02d1")
+ buf.write("\u02d3\5\u00c9e\2\u02d2\u02d1\3\2\2\2\u02d3\u02d4\3\2")
+ buf.write("\2\2\u02d4\u02d2\3\2\2\2\u02d4\u02d5\3\2\2\2\u02d5\u02d7")
+ buf.write("\3\2\2\2\u02d6\u02d8\5\u00cbf\2\u02d7\u02d6\3\2\2\2\u02d7")
+ buf.write("\u02d8\3\2\2\2\u02d8\u00c4\3\2\2\2\u02d9\u02e2\7\62\2")
+ buf.write("\2\u02da\u02de\4\63;\2\u02db\u02dd\4\62;\2\u02dc\u02db")
+ buf.write("\3\2\2\2\u02dd\u02e0\3\2\2\2\u02de\u02dc\3\2\2\2\u02de")
+ buf.write("\u02df\3\2\2\2\u02df\u02e2\3\2\2\2\u02e0\u02de\3\2\2\2")
+ buf.write("\u02e1\u02d9\3\2\2\2\u02e1\u02da\3\2\2\2\u02e2\u02e4\3")
+ buf.write("\2\2\2\u02e3\u02e5\5\u00cbf\2\u02e4\u02e3\3\2\2\2\u02e4")
+ buf.write("\u02e5\3\2\2\2\u02e5\u00c6\3\2\2\2\u02e6\u02e8\7\62\2")
+ buf.write("\2\u02e7\u02e9\4\629\2\u02e8\u02e7\3\2\2\2\u02e9\u02ea")
+ buf.write("\3\2\2\2\u02ea\u02e8\3\2\2\2\u02ea\u02eb\3\2\2\2\u02eb")
+ buf.write("\u02ed\3\2\2\2\u02ec\u02ee\5\u00cbf\2\u02ed\u02ec\3\2")
+ buf.write("\2\2\u02ed\u02ee\3\2\2\2\u02ee\u00c8\3\2\2\2\u02ef\u02f0")
+ buf.write("\t\6\2\2\u02f0\u00ca\3\2\2\2\u02f1\u02f8\t\7\2\2\u02f2")
+ buf.write("\u02f3\t\b\2\2\u02f3\u02f8\t\t\2\2\u02f4\u02f5\t\b\2\2")
+ buf.write("\u02f5\u02f6\t\t\2\2\u02f6\u02f8\t\t\2\2\u02f7\u02f1\3")
+ buf.write("\2\2\2\u02f7\u02f2\3\2\2\2\u02f7\u02f4\3\2\2\2\u02f8\u00cc")
+ buf.write("\3\2\2\2\u02f9\u02fb\4\62;\2\u02fa\u02f9\3\2\2\2\u02fb")
+ buf.write("\u02fc\3\2\2\2\u02fc\u02fa\3\2\2\2\u02fc\u02fd\3\2\2\2")
+ buf.write("\u02fd\u02fe\3\2\2\2\u02fe\u0302\7\60\2\2\u02ff\u0301")
+ buf.write("\4\62;\2\u0300\u02ff\3\2\2\2\u0301\u0304\3\2\2\2\u0302")
+ buf.write("\u0300\3\2\2\2\u0302\u0303\3\2\2\2\u0303\u0306\3\2\2\2")
+ buf.write("\u0304\u0302\3\2\2\2\u0305\u0307\5\u00cfh\2\u0306\u0305")
+ buf.write("\3\2\2\2\u0306\u0307\3\2\2\2\u0307\u0309\3\2\2\2\u0308")
+ buf.write("\u030a\5\u00d1i\2\u0309\u0308\3\2\2\2\u0309\u030a\3\2")
+ buf.write("\2\2\u030a\u032a\3\2\2\2\u030b\u030d\7\60\2\2\u030c\u030e")
+ buf.write("\4\62;\2\u030d\u030c\3\2\2\2\u030e\u030f\3\2\2\2\u030f")
+ buf.write("\u030d\3\2\2\2\u030f\u0310\3\2\2\2\u0310\u0312\3\2\2\2")
+ buf.write("\u0311\u0313\5\u00cfh\2\u0312\u0311\3\2\2\2\u0312\u0313")
+ buf.write("\3\2\2\2\u0313\u0315\3\2\2\2\u0314\u0316\5\u00d1i\2\u0315")
+ buf.write("\u0314\3\2\2\2\u0315\u0316\3\2\2\2\u0316\u032a\3\2\2\2")
+ buf.write("\u0317\u0319\4\62;\2\u0318\u0317\3\2\2\2\u0319\u031a\3")
+ buf.write("\2\2\2\u031a\u0318\3\2\2\2\u031a\u031b\3\2\2\2\u031b\u031c")
+ buf.write("\3\2\2\2\u031c\u031e\5\u00cfh\2\u031d\u031f\5\u00d1i\2")
+ buf.write("\u031e\u031d\3\2\2\2\u031e\u031f\3\2\2\2\u031f\u032a\3")
+ buf.write("\2\2\2\u0320\u0322\4\62;\2\u0321\u0320\3\2\2\2\u0322\u0323")
+ buf.write("\3\2\2\2\u0323\u0321\3\2\2\2\u0323\u0324\3\2\2\2\u0324")
+ buf.write("\u0326\3\2\2\2\u0325\u0327\5\u00cfh\2\u0326\u0325\3\2")
+ buf.write("\2\2\u0326\u0327\3\2\2\2\u0327\u0328\3\2\2\2\u0328\u032a")
+ buf.write("\5\u00d1i\2\u0329\u02fa\3\2\2\2\u0329\u030b\3\2\2\2\u0329")
+ buf.write("\u0318\3\2\2\2\u0329\u0321\3\2\2\2\u032a\u00ce\3\2\2\2")
+ buf.write("\u032b\u032d\t\n\2\2\u032c\u032e\t\13\2\2\u032d\u032c")
+ buf.write("\3\2\2\2\u032d\u032e\3\2\2\2\u032e\u0330\3\2\2\2\u032f")
+ buf.write("\u0331\4\62;\2\u0330\u032f\3\2\2\2\u0331\u0332\3\2\2\2")
+ buf.write("\u0332\u0330\3\2\2\2\u0332\u0333\3\2\2\2\u0333\u00d0\3")
+ buf.write("\2\2\2\u0334\u0335\t\f\2\2\u0335\u00d2\3\2\2\2\u0336\u0337")
+ buf.write("\7^\2\2\u0337\u033a\t\r\2\2\u0338\u033a\5\u00d5k\2\u0339")
+ buf.write("\u0336\3\2\2\2\u0339\u0338\3\2\2\2\u033a\u00d4\3\2\2\2")
+ buf.write("\u033b\u033c\7^\2\2\u033c\u033d\4\62\65\2\u033d\u033e")
+ buf.write("\4\629\2\u033e\u0345\4\629\2\u033f\u0340\7^\2\2\u0340")
+ buf.write("\u0341\4\629\2\u0341\u0345\4\629\2\u0342\u0343\7^\2\2")
+ buf.write("\u0343\u0345\4\629\2\u0344\u033b\3\2\2\2\u0344\u033f\3")
+ buf.write("\2\2\2\u0344\u0342\3\2\2\2\u0345\u00d6\3\2\2\2\u0346\u0347")
+ buf.write("\7^\2\2\u0347\u0348\7w\2\2\u0348\u0349\5\u00c9e\2\u0349")
+ buf.write("\u034a\5\u00c9e\2\u034a\u034b\5\u00c9e\2\u034b\u034c\5")
+ buf.write("\u00c9e\2\u034c\u00d8\3\2\2\2\u034d\u034e\t\16\2\2\u034e")
+ buf.write("\u034f\3\2\2\2\u034f\u0350\bm\2\2\u0350\u00da\3\2\2\2")
+ buf.write("\u0351\u0352\7^\2\2\u0352\u0353\3\2\2\2\u0353\u0354\b")
+ buf.write("n\2\2\u0354\u00dc\3\2\2\2\u0355\u0356\4\5\0\2\u0356\u00de")
+ buf.write("\3\2\2\2\u0357\u0358\7\61\2\2\u0358\u0359\7,\2\2\u0359")
+ buf.write("\u035d\3\2\2\2\u035a\u035c\13\2\2\2\u035b\u035a\3\2\2")
+ buf.write("\2\u035c\u035f\3\2\2\2\u035d\u035e\3\2\2\2\u035d\u035b")
+ buf.write("\3\2\2\2\u035e\u0360\3\2\2\2\u035f\u035d\3\2\2\2\u0360")
+ buf.write("\u0361\7,\2\2\u0361\u0362\7\61\2\2\u0362\u0363\3\2\2\2")
+ buf.write("\u0363\u0364\bp\2\2\u0364\u00e0\3\2\2\2\u0365\u0366\7")
+ buf.write("\61\2\2\u0366\u0367\7\61\2\2\u0367\u036b\3\2\2\2\u0368")
+ buf.write("\u036a\n\17\2\2\u0369\u0368\3\2\2\2\u036a\u036d\3\2\2")
+ buf.write("\2\u036b\u0369\3\2\2\2\u036b\u036c\3\2\2\2\u036c\u036f")
+ buf.write("\3\2\2\2\u036d\u036b\3\2\2\2\u036e\u0370\7\17\2\2\u036f")
+ buf.write("\u036e\3\2\2\2\u036f\u0370\3\2\2\2\u0370\u0371\3\2\2\2")
+ buf.write("\u0371\u0372\7\f\2\2\u0372\u0373\3\2\2\2\u0373\u0374\b")
+ buf.write("q\2\2\u0374\u00e2\3\2\2\2\u0375\u0379\7%\2\2\u0376\u0378")
+ buf.write("\n\17\2\2\u0377\u0376\3\2\2\2\u0378\u037b\3\2\2\2\u0379")
+ buf.write("\u0377\3\2\2\2\u0379\u037a\3\2\2\2\u037a\u037d\3\2\2\2")
+ buf.write("\u037b\u0379\3\2\2\2\u037c\u037e\7\17\2\2\u037d\u037c")
+ buf.write("\3\2\2\2\u037d\u037e\3\2\2\2\u037e\u037f\3\2\2\2\u037f")
+ buf.write("\u0380\7\f\2\2\u0380\u0381\3\2\2\2\u0381\u0382\br\2\2")
+ buf.write("\u0382\u00e4\3\2\2\2\'\2\u02b1\u02b3\u02b9\u02be\u02c3")
+ buf.write("\u02c8\u02ca\u02d4\u02d7\u02de\u02e1\u02e4\u02ea\u02ed")
+ buf.write("\u02f7\u02fc\u0302\u0306\u0309\u030f\u0312\u0315\u031a")
+ buf.write("\u031e\u0323\u0326\u0329\u032d\u0332\u0339\u0344\u035d")
+ buf.write("\u036b\u036f\u0379\u037d\3\2\3\2")
+ return buf.getvalue()
+
+
+class CLexer(Lexer):
+
+ atn = ATNDeserializer().deserialize(serializedATN())
+
+ decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
+
+ T__0 = 1
+ T__1 = 2
+ T__2 = 3
+ T__3 = 4
+ T__4 = 5
+ T__5 = 6
+ T__6 = 7
+ T__7 = 8
+ T__8 = 9
+ T__9 = 10
+ T__10 = 11
+ T__11 = 12
+ T__12 = 13
+ T__13 = 14
+ T__14 = 15
+ T__15 = 16
+ T__16 = 17
+ T__17 = 18
+ T__18 = 19
+ T__19 = 20
+ T__20 = 21
+ T__21 = 22
+ T__22 = 23
+ T__23 = 24
+ T__24 = 25
+ T__25 = 26
+ T__26 = 27
+ T__27 = 28
+ T__28 = 29
+ T__29 = 30
+ T__30 = 31
+ T__31 = 32
+ T__32 = 33
+ T__33 = 34
+ T__34 = 35
+ T__35 = 36
+ T__36 = 37
+ T__37 = 38
+ T__38 = 39
+ T__39 = 40
+ T__40 = 41
+ T__41 = 42
+ T__42 = 43
+ T__43 = 44
+ T__44 = 45
+ T__45 = 46
+ T__46 = 47
+ T__47 = 48
+ T__48 = 49
+ T__49 = 50
+ T__50 = 51
+ T__51 = 52
+ T__52 = 53
+ T__53 = 54
+ T__54 = 55
+ T__55 = 56
+ T__56 = 57
+ T__57 = 58
+ T__58 = 59
+ T__59 = 60
+ T__60 = 61
+ T__61 = 62
+ T__62 = 63
+ T__63 = 64
+ T__64 = 65
+ T__65 = 66
+ T__66 = 67
+ T__67 = 68
+ T__68 = 69
+ T__69 = 70
+ T__70 = 71
+ T__71 = 72
+ T__72 = 73
+ T__73 = 74
+ T__74 = 75
+ T__75 = 76
+ T__76 = 77
+ T__77 = 78
+ T__78 = 79
+ T__79 = 80
+ T__80 = 81
+ T__81 = 82
+ T__82 = 83
+ T__83 = 84
+ T__84 = 85
+ T__85 = 86
+ T__86 = 87
+ T__87 = 88
+ T__88 = 89
+ T__89 = 90
+ T__90 = 91
+ T__91 = 92
+ IDENTIFIER = 93
+ CHARACTER_LITERAL = 94
+ STRING_LITERAL = 95
+ HEX_LITERAL = 96
+ DECIMAL_LITERAL = 97
+ OCTAL_LITERAL = 98
+ FLOATING_POINT_LITERAL = 99
+ WS = 100
+ BS = 101
+ UnicodeVocabulary = 102
+ COMMENT = 103
+ LINE_COMMENT = 104
+ LINE_COMMAND = 105
+
+ channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ]
+
+ modeNames = [ "DEFAULT_MODE" ]
+
+ literalNames = [ "<INVALID>",
+ "'{'", "';'", "'typedef'", "','", "'='", "'extern'", "'static'",
+ "'auto'", "'register'", "'STATIC'", "'void'", "'char'", "'short'",
+ "'int'", "'long'", "'float'", "'double'", "'signed'", "'unsigned'",
+ "'}'", "'struct'", "'union'", "':'", "'enum'", "'const'", "'volatile'",
+ "'IN'", "'OUT'", "'OPTIONAL'", "'CONST'", "'UNALIGNED'", "'VOLATILE'",
+ "'GLOBAL_REMOVE_IF_UNREFERENCED'", "'EFIAPI'", "'EFI_BOOTSERVICE'",
+ "'EFI_RUNTIMESERVICE'", "'PACKED'", "'('", "')'", "'['", "']'",
+ "'*'", "'...'", "'+'", "'-'", "'/'", "'%'", "'++'", "'--'",
+ "'sizeof'", "'.'", "'->'", "'&'", "'~'", "'!'", "'*='", "'/='",
+ "'%='", "'+='", "'-='", "'<<='", "'>>='", "'&='", "'^='", "'|='",
+ "'?'", "'||'", "'&&'", "'|'", "'^'", "'=='", "'!='", "'<'",
+ "'>'", "'<='", "'>='", "'<<'", "'>>'", "'__asm__'", "'_asm'",
+ "'__asm'", "'case'", "'default'", "'if'", "'else'", "'switch'",
+ "'while'", "'do'", "'goto'", "'continue'", "'break'", "'return'" ]
+
+ symbolicNames = [ "<INVALID>",
+ "IDENTIFIER", "CHARACTER_LITERAL", "STRING_LITERAL", "HEX_LITERAL",
+ "DECIMAL_LITERAL", "OCTAL_LITERAL", "FLOATING_POINT_LITERAL",
+ "WS", "BS", "UnicodeVocabulary", "COMMENT", "LINE_COMMENT",
+ "LINE_COMMAND" ]
+
+ ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6",
+ "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "T__13",
+ "T__14", "T__15", "T__16", "T__17", "T__18", "T__19",
+ "T__20", "T__21", "T__22", "T__23", "T__24", "T__25",
+ "T__26", "T__27", "T__28", "T__29", "T__30", "T__31",
+ "T__32", "T__33", "T__34", "T__35", "T__36", "T__37",
+ "T__38", "T__39", "T__40", "T__41", "T__42", "T__43",
+ "T__44", "T__45", "T__46", "T__47", "T__48", "T__49",
+ "T__50", "T__51", "T__52", "T__53", "T__54", "T__55",
+ "T__56", "T__57", "T__58", "T__59", "T__60", "T__61",
+ "T__62", "T__63", "T__64", "T__65", "T__66", "T__67",
+ "T__68", "T__69", "T__70", "T__71", "T__72", "T__73",
+ "T__74", "T__75", "T__76", "T__77", "T__78", "T__79",
+ "T__80", "T__81", "T__82", "T__83", "T__84", "T__85",
+ "T__86", "T__87", "T__88", "T__89", "T__90", "T__91",
+ "IDENTIFIER", "LETTER", "CHARACTER_LITERAL", "STRING_LITERAL",
+ "HEX_LITERAL", "DECIMAL_LITERAL", "OCTAL_LITERAL", "HexDigit",
+ "IntegerTypeSuffix", "FLOATING_POINT_LITERAL", "Exponent",
+ "FloatTypeSuffix", "EscapeSequence", "OctalEscape", "UnicodeEscape",
+ "WS", "BS", "UnicodeVocabulary", "COMMENT", "LINE_COMMENT",
+ "LINE_COMMAND" ]
+
+ grammarFileName = "C.g4"
+
+ # @param output= sys.stdout Type: TextIO
+ def __init__(self,input=None,output= sys.stdout):
+ super().__init__(input, output)
+ self.checkVersion("4.7.1")
+ self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
+ self._actions = None
+ self._predicates = None
+
+
+
+ def printTokenInfo(self,line,offset,tokenText):
+ print(str(line)+ ',' + str(offset) + ':' + str(tokenText))
+
+ def StorePredicateExpression(self,StartLine,StartOffset,EndLine,EndOffset,Text):
+ PredExp = CodeFragment.PredicateExpression(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.PredicateExpressionList.append(PredExp)
+
+ def StoreEnumerationDefinition(self,StartLine,StartOffset,EndLine,EndOffset,Text):
+ EnumDef = CodeFragment.EnumerationDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.EnumerationDefinitionList.append(EnumDef)
+
+ def StoreStructUnionDefinition(self,StartLine,StartOffset,EndLine,EndOffset,Text):
+ SUDef = CodeFragment.StructUnionDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.StructUnionDefinitionList.append(SUDef)
+
+ def StoreTypedefDefinition(self,StartLine,StartOffset,EndLine,EndOffset,FromText,ToText):
+ Tdef = CodeFragment.TypedefDefinition(FromText, ToText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.TypedefDefinitionList.append(Tdef)
+
+ def StoreFunctionDefinition(self,StartLine,StartOffset,EndLine,EndOffset,ModifierText,DeclText,LeftBraceLine,LeftBraceOffset,DeclLine,DeclOffset):
+ FuncDef = CodeFragment.FunctionDefinition(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset), (LeftBraceLine, LeftBraceOffset), (DeclLine, DeclOffset))
+ FileProfile.FunctionDefinitionList.append(FuncDef)
+
+ def StoreVariableDeclaration(self,StartLine,StartOffset,EndLine,EndOffset,ModifierText,DeclText):
+ VarDecl = CodeFragment.VariableDeclaration(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.VariableDeclarationList.append(VarDecl)
+
+ def StoreFunctionCalling(self,StartLine,StartOffset,EndLine,EndOffset,FuncName,ParamList):
+ FuncCall = CodeFragment.FunctionCalling(FuncName, ParamList, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.FunctionCallingList.append(FuncCall)
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/CParser4/CListener.py b/roms/edk2/BaseTools/Source/Python/Eot/CParser4/CListener.py
new file mode 100644
index 000000000..46f7f1b3d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/CParser4/CListener.py
@@ -0,0 +1,808 @@
+# Generated from C.g4 by ANTLR 4.7.1
+from antlr4 import *
+if __name__ is not None and "." in __name__:
+ from .CParser import CParser
+else:
+ from CParser import CParser
+
+## @file
+# The file defines the parser for C source files.
+#
+# THIS FILE IS AUTO-GENENERATED. PLEASE DON NOT MODIFY THIS FILE.
+# This file is generated by running:
+# java org.antlr.Tool C.g
+#
+# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+import Ecc.CodeFragment as CodeFragment
+import Ecc.FileProfile as FileProfile
+
+
+# This class defines a complete listener for a parse tree produced by CParser.
+class CListener(ParseTreeListener):
+
+ # Enter a parse tree produced by CParser#translation_unit.
+ # @param ctx Type: CParser.Translation_unitContext
+ def enterTranslation_unit(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#translation_unit.
+ # @param ctx Type: CParser.Translation_unitContext
+ def exitTranslation_unit(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#external_declaration.
+ # @param ctx Type: CParser.External_declarationContext
+ def enterExternal_declaration(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#external_declaration.
+ # @param ctx Type: CParser.External_declarationContext
+ def exitExternal_declaration(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#function_definition.
+ # @param ctx Type: CParser.Function_definitionContext
+ def enterFunction_definition(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#function_definition.
+ # @param ctx Type: CParser.Function_definitionContext
+ def exitFunction_definition(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#declaration_specifiers.
+ # @param ctx Type: CParser.Declaration_specifiersContext
+ def enterDeclaration_specifiers(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#declaration_specifiers.
+ # @param ctx Type: CParser.Declaration_specifiersContext
+ def exitDeclaration_specifiers(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#declaration.
+ # @param ctx Type: CParser.DeclarationContext
+ def enterDeclaration(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#declaration.
+ # @param ctx Type: CParser.DeclarationContext
+ def exitDeclaration(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#init_declarator_list.
+ # @param ctx Type: CParser.Init_declarator_listContext
+ def enterInit_declarator_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#init_declarator_list.
+ # @param ctx Type: CParser.Init_declarator_listContext
+ def exitInit_declarator_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#init_declarator.
+ # @param ctx Type: CParser.Init_declaratorContext
+ def enterInit_declarator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#init_declarator.
+ # @param ctx Type: CParser.Init_declaratorContext
+ def exitInit_declarator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#storage_class_specifier.
+ # @param ctx Type: CParser.Storage_class_specifierContext
+ def enterStorage_class_specifier(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#storage_class_specifier.
+ # @param ctx Type: CParser.Storage_class_specifierContext
+ def exitStorage_class_specifier(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#type_specifier.
+ # @param ctx Type: CParser.Type_specifierContext
+ def enterType_specifier(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#type_specifier.
+ # @param ctx Type: CParser.Type_specifierContext
+ def exitType_specifier(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#type_id.
+ # @param ctx Type: CParser.Type_idContext
+ def enterType_id(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#type_id.
+ # @param ctx Type: CParser.Type_idContext
+ def exitType_id(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#struct_or_union_specifier.
+ # @param ctx Type: CParser.Struct_or_union_specifierContext
+ def enterStruct_or_union_specifier(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#struct_or_union_specifier.
+ # @param ctx Type: CParser.Struct_or_union_specifierContext
+ def exitStruct_or_union_specifier(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#struct_or_union.
+ # @param ctx Type: CParser.Struct_or_unionContext
+ def enterStruct_or_union(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#struct_or_union.
+ # @param ctx Type: CParser.Struct_or_unionContext
+ def exitStruct_or_union(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#struct_declaration_list.
+ # @param ctx Type: CParser.Struct_declaration_listContext
+ def enterStruct_declaration_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#struct_declaration_list.
+ # @param ctx Type: CParser.Struct_declaration_listContext
+ def exitStruct_declaration_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#struct_declaration.
+ # @param ctx Type: CParser.Struct_declarationContext
+ def enterStruct_declaration(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#struct_declaration.
+ # @param ctx Type: CParser.Struct_declarationContext
+ def exitStruct_declaration(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#specifier_qualifier_list.
+ # @param ctx Type: CParser.Specifier_qualifier_listContext
+ def enterSpecifier_qualifier_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#specifier_qualifier_list.
+ # @param ctx Type: CParser.Specifier_qualifier_listContext
+ def exitSpecifier_qualifier_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#struct_declarator_list.
+ # @param ctx Type: CParser.Struct_declarator_listContext
+ def enterStruct_declarator_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#struct_declarator_list.
+ # @param ctx Type: CParser.Struct_declarator_listContext
+ def exitStruct_declarator_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#struct_declarator.
+ # @param ctx Type: CParser.Struct_declaratorContext
+ def enterStruct_declarator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#struct_declarator.
+ # @param ctx Type: CParser.Struct_declaratorContext
+ def exitStruct_declarator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#enum_specifier.
+ # @param ctx Type: CParser.Enum_specifierContext
+ def enterEnum_specifier(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#enum_specifier.
+ # @param ctx Type: CParser.Enum_specifierContext
+ def exitEnum_specifier(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#enumerator_list.
+ # @param ctx Type: CParser.Enumerator_listContext
+ def enterEnumerator_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#enumerator_list.
+ # @param ctx Type: CParser.Enumerator_listContext
+ def exitEnumerator_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#enumerator.
+ # @param ctx Type: CParser.EnumeratorContext
+ def enterEnumerator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#enumerator.
+ # @param ctx Type: CParser.EnumeratorContext
+ def exitEnumerator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#type_qualifier.
+ # @param ctx Type: CParser.Type_qualifierContext
+ def enterType_qualifier(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#type_qualifier.
+ # @param ctx Type: CParser.Type_qualifierContext
+ def exitType_qualifier(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#declarator.
+ # @param ctx Type: CParser.DeclaratorContext
+ def enterDeclarator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#declarator.
+ # @param ctx Type: CParser.DeclaratorContext
+ def exitDeclarator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#direct_declarator.
+ # @param ctx Type: CParser.Direct_declaratorContext
+ def enterDirect_declarator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#direct_declarator.
+ # @param ctx Type: CParser.Direct_declaratorContext
+ def exitDirect_declarator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#declarator_suffix.
+ # @param ctx Type: CParser.Declarator_suffixContext
+ def enterDeclarator_suffix(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#declarator_suffix.
+ # @param ctx Type: CParser.Declarator_suffixContext
+ def exitDeclarator_suffix(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#pointer.
+ # @param ctx Type: CParser.PointerContext
+ def enterPointer(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#pointer.
+ # @param ctx Type: CParser.PointerContext
+ def exitPointer(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#parameter_type_list.
+ # @param ctx Type: CParser.Parameter_type_listContext
+ def enterParameter_type_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#parameter_type_list.
+ # @param ctx Type: CParser.Parameter_type_listContext
+ def exitParameter_type_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#parameter_list.
+ # @param ctx Type: CParser.Parameter_listContext
+ def enterParameter_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#parameter_list.
+ # @param ctx Type: CParser.Parameter_listContext
+ def exitParameter_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#parameter_declaration.
+ # @param ctx Type: CParser.Parameter_declarationContext
+ def enterParameter_declaration(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#parameter_declaration.
+ # @param ctx Type: CParser.Parameter_declarationContext
+ def exitParameter_declaration(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#identifier_list.
+ # @param ctx Type: CParser.Identifier_listContext
+ def enterIdentifier_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#identifier_list.
+ # @param ctx Type: CParser.Identifier_listContext
+ def exitIdentifier_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#type_name.
+ # @param ctx Type: CParser.Type_nameContext
+ def enterType_name(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#type_name.
+ # @param ctx Type: CParser.Type_nameContext
+ def exitType_name(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#abstract_declarator.
+ # @param ctx Type: CParser.Abstract_declaratorContext
+ def enterAbstract_declarator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#abstract_declarator.
+ # @param ctx Type: CParser.Abstract_declaratorContext
+ def exitAbstract_declarator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#direct_abstract_declarator.
+ # @param ctx Type: CParser.Direct_abstract_declaratorContext
+ def enterDirect_abstract_declarator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#direct_abstract_declarator.
+ # @param ctx Type: CParser.Direct_abstract_declaratorContext
+ def exitDirect_abstract_declarator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#abstract_declarator_suffix.
+ # @param ctx Type: CParser.Abstract_declarator_suffixContext
+ def enterAbstract_declarator_suffix(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#abstract_declarator_suffix.
+ # @param ctx Type: CParser.Abstract_declarator_suffixContext
+ def exitAbstract_declarator_suffix(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#initializer.
+ # @param ctx Type: CParser.InitializerContext
+ def enterInitializer(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#initializer.
+ # @param ctx Type: CParser.InitializerContext
+ def exitInitializer(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#initializer_list.
+ # @param ctx Type: CParser.Initializer_listContext
+ def enterInitializer_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#initializer_list.
+ # @param ctx Type: CParser.Initializer_listContext
+ def exitInitializer_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#argument_expression_list.
+ # @param ctx Type: CParser.Argument_expression_listContext
+ def enterArgument_expression_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#argument_expression_list.
+ # @param ctx Type: CParser.Argument_expression_listContext
+ def exitArgument_expression_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#additive_expression.
+ # @param ctx Type: CParser.Additive_expressionContext
+ def enterAdditive_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#additive_expression.
+ # @param ctx Type: CParser.Additive_expressionContext
+ def exitAdditive_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#multiplicative_expression.
+ # @param ctx Type: CParser.Multiplicative_expressionContext
+ def enterMultiplicative_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#multiplicative_expression.
+ # @param ctx Type: CParser.Multiplicative_expressionContext
+ def exitMultiplicative_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#cast_expression.
+ # @param ctx Type: CParser.Cast_expressionContext
+ def enterCast_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#cast_expression.
+ # @param ctx Type: CParser.Cast_expressionContext
+ def exitCast_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#unary_expression.
+ # @param ctx Type: CParser.Unary_expressionContext
+ def enterUnary_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#unary_expression.
+ # @param ctx Type: CParser.Unary_expressionContext
+ def exitUnary_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#postfix_expression.
+ # @param ctx Type: CParser.Postfix_expressionContext
+ def enterPostfix_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#postfix_expression.
+ # @param ctx Type: CParser.Postfix_expressionContext
+ def exitPostfix_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#macro_parameter_list.
+ # @param ctx Type: CParser.Macro_parameter_listContext
+ def enterMacro_parameter_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#macro_parameter_list.
+ # @param ctx Type: CParser.Macro_parameter_listContext
+ def exitMacro_parameter_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#unary_operator.
+ # @param ctx Type: CParser.Unary_operatorContext
+ def enterUnary_operator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#unary_operator.
+ # @param ctx Type: CParser.Unary_operatorContext
+ def exitUnary_operator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#primary_expression.
+ # @param ctx Type: CParser.Primary_expressionContext
+ def enterPrimary_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#primary_expression.
+ # @param ctx Type: CParser.Primary_expressionContext
+ def exitPrimary_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#constant.
+ # @param ctx Type: CParser.ConstantContext
+ def enterConstant(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#constant.
+ # @param ctx Type: CParser.ConstantContext
+ def exitConstant(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#expression.
+ # @param ctx Type: CParser.ExpressionContext
+ def enterExpression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#expression.
+ # @param ctx Type: CParser.ExpressionContext
+ def exitExpression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#constant_expression.
+ # @param ctx Type: CParser.Constant_expressionContext
+ def enterConstant_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#constant_expression.
+ # @param ctx Type: CParser.Constant_expressionContext
+ def exitConstant_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#assignment_expression.
+ # @param ctx Type: CParser.Assignment_expressionContext
+ def enterAssignment_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#assignment_expression.
+ # @param ctx Type: CParser.Assignment_expressionContext
+ def exitAssignment_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#lvalue.
+ # @param ctx Type: CParser.LvalueContext
+ def enterLvalue(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#lvalue.
+ # @param ctx Type: CParser.LvalueContext
+ def exitLvalue(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#assignment_operator.
+ # @param ctx Type: CParser.Assignment_operatorContext
+ def enterAssignment_operator(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#assignment_operator.
+ # @param ctx Type: CParser.Assignment_operatorContext
+ def exitAssignment_operator(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#conditional_expression.
+ # @param ctx Type: CParser.Conditional_expressionContext
+ def enterConditional_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#conditional_expression.
+ # @param ctx Type: CParser.Conditional_expressionContext
+ def exitConditional_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#logical_or_expression.
+ # @param ctx Type: CParser.Logical_or_expressionContext
+ def enterLogical_or_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#logical_or_expression.
+ # @param ctx Type: CParser.Logical_or_expressionContext
+ def exitLogical_or_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#logical_and_expression.
+ # @param ctx Type: CParser.Logical_and_expressionContext
+ def enterLogical_and_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#logical_and_expression.
+ # @param ctx Type: CParser.Logical_and_expressionContext
+ def exitLogical_and_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#inclusive_or_expression.
+ # @param ctx Type: CParser.Inclusive_or_expressionContext
+ def enterInclusive_or_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#inclusive_or_expression.
+ # @param ctx Type: CParser.Inclusive_or_expressionContext
+ def exitInclusive_or_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#exclusive_or_expression.
+ # @param ctx Type: CParser.Exclusive_or_expressionContext
+ def enterExclusive_or_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#exclusive_or_expression.
+ # @param ctx Type: CParser.Exclusive_or_expressionContext
+ def exitExclusive_or_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#and_expression.
+ # @param ctx Type: CParser.And_expressionContext
+ def enterAnd_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#and_expression.
+ # @param ctx Type: CParser.And_expressionContext
+ def exitAnd_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#equality_expression.
+ # @param ctx Type: CParser.Equality_expressionContext
+ def enterEquality_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#equality_expression.
+ # @param ctx Type: CParser.Equality_expressionContext
+ def exitEquality_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#relational_expression.
+ # @param ctx Type: CParser.Relational_expressionContext
+ def enterRelational_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#relational_expression.
+ # @param ctx Type: CParser.Relational_expressionContext
+ def exitRelational_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#shift_expression.
+ # @param ctx Type: CParser.Shift_expressionContext
+ def enterShift_expression(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#shift_expression.
+ # @param ctx Type: CParser.Shift_expressionContext
+ def exitShift_expression(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#statement.
+ # @param ctx Type: CParser.StatementContext
+ def enterStatement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#statement.
+ # @param ctx Type: CParser.StatementContext
+ def exitStatement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#asm2_statement.
+ # @param ctx Type: CParser.Asm2_statementContext
+ def enterAsm2_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#asm2_statement.
+ # @param ctx Type: CParser.Asm2_statementContext
+ def exitAsm2_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#asm1_statement.
+ # @param ctx Type: CParser.Asm1_statementContext
+ def enterAsm1_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#asm1_statement.
+ # @param ctx Type: CParser.Asm1_statementContext
+ def exitAsm1_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#asm_statement.
+ # @param ctx Type: CParser.Asm_statementContext
+ def enterAsm_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#asm_statement.
+ # @param ctx Type: CParser.Asm_statementContext
+ def exitAsm_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#macro_statement.
+ # @param ctx Type: CParser.Macro_statementContext
+ def enterMacro_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#macro_statement.
+ # @param ctx Type: CParser.Macro_statementContext
+ def exitMacro_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#labeled_statement.
+ # @param ctx Type: CParser.Labeled_statementContext
+ def enterLabeled_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#labeled_statement.
+ # @param ctx Type: CParser.Labeled_statementContext
+ def exitLabeled_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#compound_statement.
+ # @param ctx Type: CParser.Compound_statementContext
+ def enterCompound_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#compound_statement.
+ # @param ctx Type: CParser.Compound_statementContext
+ def exitCompound_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#statement_list.
+ # @param ctx Type: CParser.Statement_listContext
+ def enterStatement_list(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#statement_list.
+ # @param ctx Type: CParser.Statement_listContext
+ def exitStatement_list(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#expression_statement.
+ # @param ctx Type: CParser.Expression_statementContext
+ def enterExpression_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#expression_statement.
+ # @param ctx Type: CParser.Expression_statementContext
+ def exitExpression_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#selection_statement.
+ # @param ctx Type: CParser.Selection_statementContext
+ def enterSelection_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#selection_statement.
+ # @param ctx Type: CParser.Selection_statementContext
+ def exitSelection_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#iteration_statement.
+ # @param ctx Type: CParser.Iteration_statementContext
+ def enterIteration_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#iteration_statement.
+ # @param ctx Type: CParser.Iteration_statementContext
+ def exitIteration_statement(self,ctx):
+ pass
+
+
+ # Enter a parse tree produced by CParser#jump_statement.
+ # @param ctx Type: CParser.Jump_statementContext
+ def enterJump_statement(self,ctx):
+ pass
+
+ # Exit a parse tree produced by CParser#jump_statement.
+ # @param ctx Type: CParser.Jump_statementContext
+ def exitJump_statement(self,ctx):
+ pass
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/CParser4/CParser.py b/roms/edk2/BaseTools/Source/Python/Eot/CParser4/CParser.py
new file mode 100644
index 000000000..31d23d55a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/CParser4/CParser.py
@@ -0,0 +1,6273 @@
+# Generated from C.g4 by ANTLR 4.7.1
+# encoding: utf-8
+from antlr4 import *
+from io import StringIO
+from typing.io import TextIO
+import sys
+
+
+## @file
+# The file defines the parser for C source files.
+#
+# THIS FILE IS AUTO-GENENERATED. PLEASE DON NOT MODIFY THIS FILE.
+# This file is generated by running:
+# java org.antlr.Tool C.g
+#
+# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+import Ecc.CodeFragment as CodeFragment
+import Ecc.FileProfile as FileProfile
+
+def serializedATN():
+ with StringIO() as buf:
+ buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3k")
+ buf.write("\u0380\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
+ buf.write("\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16")
+ buf.write("\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
+ buf.write("\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31")
+ buf.write("\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36")
+ buf.write("\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t")
+ buf.write("&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4,\t,\4-\t-\4.\t.\4")
+ buf.write("/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t\64")
+ buf.write("\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t")
+ buf.write(";\4<\t<\4=\t=\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\t")
+ buf.write("D\4E\tE\4F\tF\4G\tG\4H\tH\3\2\7\2\u0092\n\2\f\2\16\2\u0095")
+ buf.write("\13\2\3\3\5\3\u0098\n\3\3\3\3\3\7\3\u009c\n\3\f\3\16\3")
+ buf.write("\u009f\13\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3\u00a7\n\3\5\3")
+ buf.write("\u00a9\n\3\3\4\5\4\u00ac\n\4\3\4\3\4\6\4\u00b0\n\4\r\4")
+ buf.write("\16\4\u00b1\3\4\3\4\3\4\5\4\u00b7\n\4\3\4\3\4\3\5\3\5")
+ buf.write("\3\5\6\5\u00be\n\5\r\5\16\5\u00bf\3\6\3\6\5\6\u00c4\n")
+ buf.write("\6\3\6\3\6\3\6\3\6\3\6\3\6\5\6\u00cc\n\6\3\6\3\6\3\6\5")
+ buf.write("\6\u00d1\n\6\3\7\3\7\3\7\7\7\u00d6\n\7\f\7\16\7\u00d9")
+ buf.write("\13\7\3\b\3\b\3\b\5\b\u00de\n\b\3\t\3\t\3\n\3\n\3\n\3")
+ buf.write("\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n")
+ buf.write("\7\n\u00f3\n\n\f\n\16\n\u00f6\13\n\3\n\3\n\5\n\u00fa\n")
+ buf.write("\n\3\13\3\13\3\f\3\f\5\f\u0100\n\f\3\f\3\f\3\f\3\f\3\f")
+ buf.write("\3\f\3\f\5\f\u0109\n\f\3\r\3\r\3\16\6\16\u010e\n\16\r")
+ buf.write("\16\16\16\u010f\3\17\3\17\3\17\3\17\3\20\3\20\6\20\u0118")
+ buf.write("\n\20\r\20\16\20\u0119\3\21\3\21\3\21\7\21\u011f\n\21")
+ buf.write("\f\21\16\21\u0122\13\21\3\22\3\22\3\22\5\22\u0127\n\22")
+ buf.write("\3\22\3\22\5\22\u012b\n\22\3\23\3\23\3\23\3\23\5\23\u0131")
+ buf.write("\n\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\5\23\u013a\n")
+ buf.write("\23\3\23\3\23\3\23\3\23\5\23\u0140\n\23\3\24\3\24\3\24")
+ buf.write("\7\24\u0145\n\24\f\24\16\24\u0148\13\24\3\25\3\25\3\25")
+ buf.write("\5\25\u014d\n\25\3\26\3\26\3\27\5\27\u0152\n\27\3\27\5")
+ buf.write("\27\u0155\n\27\3\27\5\27\u0158\n\27\3\27\5\27\u015b\n")
+ buf.write("\27\3\27\3\27\5\27\u015f\n\27\3\30\3\30\7\30\u0163\n\30")
+ buf.write("\f\30\16\30\u0166\13\30\3\30\3\30\5\30\u016a\n\30\3\30")
+ buf.write("\3\30\3\30\6\30\u016f\n\30\r\30\16\30\u0170\5\30\u0173")
+ buf.write("\n\30\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31")
+ buf.write("\3\31\3\31\3\31\3\31\3\31\3\31\5\31\u0185\n\31\3\32\3")
+ buf.write("\32\6\32\u0189\n\32\r\32\16\32\u018a\3\32\5\32\u018e\n")
+ buf.write("\32\3\32\3\32\3\32\5\32\u0193\n\32\3\33\3\33\3\33\5\33")
+ buf.write("\u0198\n\33\3\33\5\33\u019b\n\33\3\34\3\34\3\34\5\34\u01a0")
+ buf.write("\n\34\3\34\7\34\u01a3\n\34\f\34\16\34\u01a6\13\34\3\35")
+ buf.write("\3\35\3\35\7\35\u01ab\n\35\f\35\16\35\u01ae\13\35\3\35")
+ buf.write("\5\35\u01b1\n\35\3\35\7\35\u01b4\n\35\f\35\16\35\u01b7")
+ buf.write("\13\35\3\35\5\35\u01ba\n\35\3\36\3\36\3\36\7\36\u01bf")
+ buf.write("\n\36\f\36\16\36\u01c2\13\36\3\37\3\37\5\37\u01c6\n\37")
+ buf.write("\3\37\5\37\u01c9\n\37\3 \3 \5 \u01cd\n \3 \5 \u01d0\n")
+ buf.write(" \3!\3!\3!\3!\3!\5!\u01d7\n!\3!\7!\u01da\n!\f!\16!\u01dd")
+ buf.write("\13!\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\5")
+ buf.write("\"\u01eb\n\"\3#\3#\3#\3#\5#\u01f1\n#\3#\3#\5#\u01f5\n")
+ buf.write("#\3$\3$\3$\7$\u01fa\n$\f$\16$\u01fd\13$\3%\3%\5%\u0201")
+ buf.write("\n%\3%\3%\3%\5%\u0206\n%\7%\u0208\n%\f%\16%\u020b\13%")
+ buf.write("\3&\3&\3&\3&\3&\7&\u0212\n&\f&\16&\u0215\13&\3\'\3\'\3")
+ buf.write("\'\3\'\3\'\3\'\3\'\7\'\u021e\n\'\f\'\16\'\u0221\13\'\3")
+ buf.write("(\3(\3(\3(\3(\3(\5(\u0229\n(\3)\3)\3)\3)\3)\3)\3)\3)\3")
+ buf.write(")\3)\3)\3)\3)\3)\3)\5)\u023a\n)\3*\3*\3*\3*\3*\3*\3*\3")
+ buf.write("*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3*\3")
+ buf.write("*\3*\3*\3*\7*\u0259\n*\f*\16*\u025c\13*\3+\3+\3+\7+\u0261")
+ buf.write("\n+\f+\16+\u0264\13+\3,\3,\3-\3-\3-\3-\3-\3-\5-\u026e")
+ buf.write("\n-\3.\3.\3.\3.\3.\7.\u0275\n.\f.\16.\u0278\13.\3.\6.")
+ buf.write("\u027b\n.\r.\16.\u027c\6.\u027f\n.\r.\16.\u0280\3.\7.")
+ buf.write("\u0284\n.\f.\16.\u0287\13.\3.\5.\u028a\n.\3/\3/\3/\7/")
+ buf.write("\u028f\n/\f/\16/\u0292\13/\3\60\3\60\3\61\3\61\3\61\3")
+ buf.write("\61\3\61\5\61\u029b\n\61\3\62\3\62\3\63\3\63\3\64\3\64")
+ buf.write("\3\64\3\64\3\64\3\64\3\64\5\64\u02a8\n\64\3\65\3\65\3")
+ buf.write("\65\7\65\u02ad\n\65\f\65\16\65\u02b0\13\65\3\66\3\66\3")
+ buf.write("\66\7\66\u02b5\n\66\f\66\16\66\u02b8\13\66\3\67\3\67\3")
+ buf.write("\67\7\67\u02bd\n\67\f\67\16\67\u02c0\13\67\38\38\38\7")
+ buf.write("8\u02c5\n8\f8\168\u02c8\138\39\39\39\79\u02cd\n9\f9\16")
+ buf.write("9\u02d0\139\3:\3:\3:\7:\u02d5\n:\f:\16:\u02d8\13:\3;\3")
+ buf.write(";\3;\7;\u02dd\n;\f;\16;\u02e0\13;\3<\3<\3<\7<\u02e5\n")
+ buf.write("<\f<\16<\u02e8\13<\3=\3=\3=\3=\3=\3=\3=\3=\3=\3=\3=\5")
+ buf.write("=\u02f5\n=\3>\5>\u02f8\n>\3>\3>\3>\7>\u02fd\n>\f>\16>")
+ buf.write("\u0300\13>\3>\3>\3>\3?\3?\3?\7?\u0308\n?\f?\16?\u030b")
+ buf.write("\13?\3?\3?\3@\3@\3@\7@\u0312\n@\f@\16@\u0315\13@\3@\3")
+ buf.write("@\3A\3A\3A\7A\u031c\nA\fA\16A\u031f\13A\3A\5A\u0322\n")
+ buf.write("A\3A\5A\u0325\nA\3A\3A\3B\3B\3B\3B\3B\3B\3B\3B\3B\3B\3")
+ buf.write("B\5B\u0334\nB\3C\3C\7C\u0338\nC\fC\16C\u033b\13C\3C\5")
+ buf.write("C\u033e\nC\3C\3C\3D\6D\u0343\nD\rD\16D\u0344\3E\3E\3E")
+ buf.write("\3E\5E\u034b\nE\3F\3F\3F\3F\3F\3F\3F\3F\5F\u0355\nF\3")
+ buf.write("F\3F\3F\3F\3F\3F\5F\u035d\nF\3G\3G\3G\3G\3G\3G\3G\3G\3")
+ buf.write("G\3G\3G\3G\3G\3G\3G\3G\5G\u036f\nG\3H\3H\3H\3H\3H\3H\3")
+ buf.write("H\3H\3H\3H\3H\3H\3H\5H\u037e\nH\3H\2\2I\2\4\6\b\n\f\16")
+ buf.write("\20\22\24\26\30\32\34\36 \"$&(*,.\60\62\64\668:<>@BDF")
+ buf.write("HJLNPRTVXZ\\^`bdfhjlnprtvxz|~\u0080\u0082\u0084\u0086")
+ buf.write("\u0088\u008a\u008c\u008e\2\f\3\2\b\f\3\2\27\30\3\2\33")
+ buf.write("\'\5\2,,./\679\4\2\7\7:C\3\2IJ\3\2KN\3\2OP\3\2\4\4\3\2")
+ buf.write("\26\26\2\u03d8\2\u0093\3\2\2\2\4\u00a8\3\2\2\2\6\u00ab")
+ buf.write("\3\2\2\2\b\u00bd\3\2\2\2\n\u00d0\3\2\2\2\f\u00d2\3\2\2")
+ buf.write("\2\16\u00da\3\2\2\2\20\u00df\3\2\2\2\22\u00f9\3\2\2\2")
+ buf.write("\24\u00fb\3\2\2\2\26\u0108\3\2\2\2\30\u010a\3\2\2\2\32")
+ buf.write("\u010d\3\2\2\2\34\u0111\3\2\2\2\36\u0117\3\2\2\2 \u011b")
+ buf.write("\3\2\2\2\"\u012a\3\2\2\2$\u013f\3\2\2\2&\u0141\3\2\2\2")
+ buf.write("(\u0149\3\2\2\2*\u014e\3\2\2\2,\u015e\3\2\2\2.\u0172\3")
+ buf.write("\2\2\2\60\u0184\3\2\2\2\62\u0192\3\2\2\2\64\u0194\3\2")
+ buf.write("\2\2\66\u019c\3\2\2\28\u01b9\3\2\2\2:\u01bb\3\2\2\2<\u01c8")
+ buf.write("\3\2\2\2>\u01cf\3\2\2\2@\u01d6\3\2\2\2B\u01ea\3\2\2\2")
+ buf.write("D\u01f4\3\2\2\2F\u01f6\3\2\2\2H\u01fe\3\2\2\2J\u020c\3")
+ buf.write("\2\2\2L\u0216\3\2\2\2N\u0228\3\2\2\2P\u0239\3\2\2\2R\u023b")
+ buf.write("\3\2\2\2T\u025d\3\2\2\2V\u0265\3\2\2\2X\u026d\3\2\2\2")
+ buf.write("Z\u0289\3\2\2\2\\\u028b\3\2\2\2^\u0293\3\2\2\2`\u029a")
+ buf.write("\3\2\2\2b\u029c\3\2\2\2d\u029e\3\2\2\2f\u02a0\3\2\2\2")
+ buf.write("h\u02a9\3\2\2\2j\u02b1\3\2\2\2l\u02b9\3\2\2\2n\u02c1\3")
+ buf.write("\2\2\2p\u02c9\3\2\2\2r\u02d1\3\2\2\2t\u02d9\3\2\2\2v\u02e1")
+ buf.write("\3\2\2\2x\u02f4\3\2\2\2z\u02f7\3\2\2\2|\u0304\3\2\2\2")
+ buf.write("~\u030e\3\2\2\2\u0080\u0318\3\2\2\2\u0082\u0333\3\2\2")
+ buf.write("\2\u0084\u0335\3\2\2\2\u0086\u0342\3\2\2\2\u0088\u034a")
+ buf.write("\3\2\2\2\u008a\u035c\3\2\2\2\u008c\u036e\3\2\2\2\u008e")
+ buf.write("\u037d\3\2\2\2\u0090\u0092\5\4\3\2\u0091\u0090\3\2\2\2")
+ buf.write("\u0092\u0095\3\2\2\2\u0093\u0091\3\2\2\2\u0093\u0094\3")
+ buf.write("\2\2\2\u0094\3\3\2\2\2\u0095\u0093\3\2\2\2\u0096\u0098")
+ buf.write("\5\b\5\2\u0097\u0096\3\2\2\2\u0097\u0098\3\2\2\2\u0098")
+ buf.write("\u0099\3\2\2\2\u0099\u009d\5,\27\2\u009a\u009c\5\n\6\2")
+ buf.write("\u009b\u009a\3\2\2\2\u009c\u009f\3\2\2\2\u009d\u009b\3")
+ buf.write("\2\2\2\u009d\u009e\3\2\2\2\u009e\u00a0\3\2\2\2\u009f\u009d")
+ buf.write("\3\2\2\2\u00a0\u00a1\7\3\2\2\u00a1\u00a9\3\2\2\2\u00a2")
+ buf.write("\u00a9\5\6\4\2\u00a3\u00a9\5\n\6\2\u00a4\u00a6\5\u0080")
+ buf.write("A\2\u00a5\u00a7\7\4\2\2\u00a6\u00a5\3\2\2\2\u00a6\u00a7")
+ buf.write("\3\2\2\2\u00a7\u00a9\3\2\2\2\u00a8\u0097\3\2\2\2\u00a8")
+ buf.write("\u00a2\3\2\2\2\u00a8\u00a3\3\2\2\2\u00a8\u00a4\3\2\2\2")
+ buf.write("\u00a9\5\3\2\2\2\u00aa\u00ac\5\b\5\2\u00ab\u00aa\3\2\2")
+ buf.write("\2\u00ab\u00ac\3\2\2\2\u00ac\u00ad\3\2\2\2\u00ad\u00b6")
+ buf.write("\5,\27\2\u00ae\u00b0\5\n\6\2\u00af\u00ae\3\2\2\2\u00b0")
+ buf.write("\u00b1\3\2\2\2\u00b1\u00af\3\2\2\2\u00b1\u00b2\3\2\2\2")
+ buf.write("\u00b2\u00b3\3\2\2\2\u00b3\u00b4\5\u0084C\2\u00b4\u00b7")
+ buf.write("\3\2\2\2\u00b5\u00b7\5\u0084C\2\u00b6\u00af\3\2\2\2\u00b6")
+ buf.write("\u00b5\3\2\2\2\u00b7\u00b8\3\2\2\2\u00b8\u00b9\b\4\1\2")
+ buf.write("\u00b9\7\3\2\2\2\u00ba\u00be\5\20\t\2\u00bb\u00be\5\22")
+ buf.write("\n\2\u00bc\u00be\5*\26\2\u00bd\u00ba\3\2\2\2\u00bd\u00bb")
+ buf.write("\3\2\2\2\u00bd\u00bc\3\2\2\2\u00be\u00bf\3\2\2\2\u00bf")
+ buf.write("\u00bd\3\2\2\2\u00bf\u00c0\3\2\2\2\u00c0\t\3\2\2\2\u00c1")
+ buf.write("\u00c3\7\5\2\2\u00c2\u00c4\5\b\5\2\u00c3\u00c2\3\2\2\2")
+ buf.write("\u00c3\u00c4\3\2\2\2\u00c4\u00c5\3\2\2\2\u00c5\u00c6\5")
+ buf.write("\f\7\2\u00c6\u00c7\7\4\2\2\u00c7\u00c8\b\6\1\2\u00c8\u00d1")
+ buf.write("\3\2\2\2\u00c9\u00cb\5\b\5\2\u00ca\u00cc\5\f\7\2\u00cb")
+ buf.write("\u00ca\3\2\2\2\u00cb\u00cc\3\2\2\2\u00cc\u00cd\3\2\2\2")
+ buf.write("\u00cd\u00ce\7\4\2\2\u00ce\u00cf\b\6\1\2\u00cf\u00d1\3")
+ buf.write("\2\2\2\u00d0\u00c1\3\2\2\2\u00d0\u00c9\3\2\2\2\u00d1\13")
+ buf.write("\3\2\2\2\u00d2\u00d7\5\16\b\2\u00d3\u00d4\7\6\2\2\u00d4")
+ buf.write("\u00d6\5\16\b\2\u00d5\u00d3\3\2\2\2\u00d6\u00d9\3\2\2")
+ buf.write("\2\u00d7\u00d5\3\2\2\2\u00d7\u00d8\3\2\2\2\u00d8\r\3\2")
+ buf.write("\2\2\u00d9\u00d7\3\2\2\2\u00da\u00dd\5,\27\2\u00db\u00dc")
+ buf.write("\7\7\2\2\u00dc\u00de\5D#\2\u00dd\u00db\3\2\2\2\u00dd\u00de")
+ buf.write("\3\2\2\2\u00de\17\3\2\2\2\u00df\u00e0\t\2\2\2\u00e0\21")
+ buf.write("\3\2\2\2\u00e1\u00fa\7\r\2\2\u00e2\u00fa\7\16\2\2\u00e3")
+ buf.write("\u00fa\7\17\2\2\u00e4\u00fa\7\20\2\2\u00e5\u00fa\7\21")
+ buf.write("\2\2\u00e6\u00fa\7\22\2\2\u00e7\u00fa\7\23\2\2\u00e8\u00fa")
+ buf.write("\7\24\2\2\u00e9\u00fa\7\25\2\2\u00ea\u00eb\5\26\f\2\u00eb")
+ buf.write("\u00ec\b\n\1\2\u00ec\u00fa\3\2\2\2\u00ed\u00ee\5$\23\2")
+ buf.write("\u00ee\u00ef\b\n\1\2\u00ef\u00fa\3\2\2\2\u00f0\u00f4\7")
+ buf.write("_\2\2\u00f1\u00f3\5*\26\2\u00f2\u00f1\3\2\2\2\u00f3\u00f6")
+ buf.write("\3\2\2\2\u00f4\u00f2\3\2\2\2\u00f4\u00f5\3\2\2\2\u00f5")
+ buf.write("\u00f7\3\2\2\2\u00f6\u00f4\3\2\2\2\u00f7\u00fa\5,\27\2")
+ buf.write("\u00f8\u00fa\5\24\13\2\u00f9\u00e1\3\2\2\2\u00f9\u00e2")
+ buf.write("\3\2\2\2\u00f9\u00e3\3\2\2\2\u00f9\u00e4\3\2\2\2\u00f9")
+ buf.write("\u00e5\3\2\2\2\u00f9\u00e6\3\2\2\2\u00f9\u00e7\3\2\2\2")
+ buf.write("\u00f9\u00e8\3\2\2\2\u00f9\u00e9\3\2\2\2\u00f9\u00ea\3")
+ buf.write("\2\2\2\u00f9\u00ed\3\2\2\2\u00f9\u00f0\3\2\2\2\u00f9\u00f8")
+ buf.write("\3\2\2\2\u00fa\23\3\2\2\2\u00fb\u00fc\7_\2\2\u00fc\25")
+ buf.write("\3\2\2\2\u00fd\u00ff\5\30\r\2\u00fe\u0100\7_\2\2\u00ff")
+ buf.write("\u00fe\3\2\2\2\u00ff\u0100\3\2\2\2\u0100\u0101\3\2\2\2")
+ buf.write("\u0101\u0102\7\3\2\2\u0102\u0103\5\32\16\2\u0103\u0104")
+ buf.write("\7\26\2\2\u0104\u0109\3\2\2\2\u0105\u0106\5\30\r\2\u0106")
+ buf.write("\u0107\7_\2\2\u0107\u0109\3\2\2\2\u0108\u00fd\3\2\2\2")
+ buf.write("\u0108\u0105\3\2\2\2\u0109\27\3\2\2\2\u010a\u010b\t\3")
+ buf.write("\2\2\u010b\31\3\2\2\2\u010c\u010e\5\34\17\2\u010d\u010c")
+ buf.write("\3\2\2\2\u010e\u010f\3\2\2\2\u010f\u010d\3\2\2\2\u010f")
+ buf.write("\u0110\3\2\2\2\u0110\33\3\2\2\2\u0111\u0112\5\36\20\2")
+ buf.write("\u0112\u0113\5 \21\2\u0113\u0114\7\4\2\2\u0114\35\3\2")
+ buf.write("\2\2\u0115\u0118\5*\26\2\u0116\u0118\5\22\n\2\u0117\u0115")
+ buf.write("\3\2\2\2\u0117\u0116\3\2\2\2\u0118\u0119\3\2\2\2\u0119")
+ buf.write("\u0117\3\2\2\2\u0119\u011a\3\2\2\2\u011a\37\3\2\2\2\u011b")
+ buf.write("\u0120\5\"\22\2\u011c\u011d\7\6\2\2\u011d\u011f\5\"\22")
+ buf.write("\2\u011e\u011c\3\2\2\2\u011f\u0122\3\2\2\2\u0120\u011e")
+ buf.write("\3\2\2\2\u0120\u0121\3\2\2\2\u0121!\3\2\2\2\u0122\u0120")
+ buf.write("\3\2\2\2\u0123\u0126\5,\27\2\u0124\u0125\7\31\2\2\u0125")
+ buf.write("\u0127\5^\60\2\u0126\u0124\3\2\2\2\u0126\u0127\3\2\2\2")
+ buf.write("\u0127\u012b\3\2\2\2\u0128\u0129\7\31\2\2\u0129\u012b")
+ buf.write("\5^\60\2\u012a\u0123\3\2\2\2\u012a\u0128\3\2\2\2\u012b")
+ buf.write("#\3\2\2\2\u012c\u012d\7\32\2\2\u012d\u012e\7\3\2\2\u012e")
+ buf.write("\u0130\5&\24\2\u012f\u0131\7\6\2\2\u0130\u012f\3\2\2\2")
+ buf.write("\u0130\u0131\3\2\2\2\u0131\u0132\3\2\2\2\u0132\u0133\7")
+ buf.write("\26\2\2\u0133\u0140\3\2\2\2\u0134\u0135\7\32\2\2\u0135")
+ buf.write("\u0136\7_\2\2\u0136\u0137\7\3\2\2\u0137\u0139\5&\24\2")
+ buf.write("\u0138\u013a\7\6\2\2\u0139\u0138\3\2\2\2\u0139\u013a\3")
+ buf.write("\2\2\2\u013a\u013b\3\2\2\2\u013b\u013c\7\26\2\2\u013c")
+ buf.write("\u0140\3\2\2\2\u013d\u013e\7\32\2\2\u013e\u0140\7_\2\2")
+ buf.write("\u013f\u012c\3\2\2\2\u013f\u0134\3\2\2\2\u013f\u013d\3")
+ buf.write("\2\2\2\u0140%\3\2\2\2\u0141\u0146\5(\25\2\u0142\u0143")
+ buf.write("\7\6\2\2\u0143\u0145\5(\25\2\u0144\u0142\3\2\2\2\u0145")
+ buf.write("\u0148\3\2\2\2\u0146\u0144\3\2\2\2\u0146\u0147\3\2\2\2")
+ buf.write("\u0147\'\3\2\2\2\u0148\u0146\3\2\2\2\u0149\u014c\7_\2")
+ buf.write("\2\u014a\u014b\7\7\2\2\u014b\u014d\5^\60\2\u014c\u014a")
+ buf.write("\3\2\2\2\u014c\u014d\3\2\2\2\u014d)\3\2\2\2\u014e\u014f")
+ buf.write("\t\4\2\2\u014f+\3\2\2\2\u0150\u0152\5\62\32\2\u0151\u0150")
+ buf.write("\3\2\2\2\u0151\u0152\3\2\2\2\u0152\u0154\3\2\2\2\u0153")
+ buf.write("\u0155\7$\2\2\u0154\u0153\3\2\2\2\u0154\u0155\3\2\2\2")
+ buf.write("\u0155\u0157\3\2\2\2\u0156\u0158\7%\2\2\u0157\u0156\3")
+ buf.write("\2\2\2\u0157\u0158\3\2\2\2\u0158\u015a\3\2\2\2\u0159\u015b")
+ buf.write("\7&\2\2\u015a\u0159\3\2\2\2\u015a\u015b\3\2\2\2\u015b")
+ buf.write("\u015c\3\2\2\2\u015c\u015f\5.\30\2\u015d\u015f\5\62\32")
+ buf.write("\2\u015e\u0151\3\2\2\2\u015e\u015d\3\2\2\2\u015f-\3\2")
+ buf.write("\2\2\u0160\u0164\7_\2\2\u0161\u0163\5\60\31\2\u0162\u0161")
+ buf.write("\3\2\2\2\u0163\u0166\3\2\2\2\u0164\u0162\3\2\2\2\u0164")
+ buf.write("\u0165\3\2\2\2\u0165\u0173\3\2\2\2\u0166\u0164\3\2\2\2")
+ buf.write("\u0167\u0169\7(\2\2\u0168\u016a\7$\2\2\u0169\u0168\3\2")
+ buf.write("\2\2\u0169\u016a\3\2\2\2\u016a\u016b\3\2\2\2\u016b\u016c")
+ buf.write("\5,\27\2\u016c\u016e\7)\2\2\u016d\u016f\5\60\31\2\u016e")
+ buf.write("\u016d\3\2\2\2\u016f\u0170\3\2\2\2\u0170\u016e\3\2\2\2")
+ buf.write("\u0170\u0171\3\2\2\2\u0171\u0173\3\2\2\2\u0172\u0160\3")
+ buf.write("\2\2\2\u0172\u0167\3\2\2\2\u0173/\3\2\2\2\u0174\u0175")
+ buf.write("\7*\2\2\u0175\u0176\5^\60\2\u0176\u0177\7+\2\2\u0177\u0185")
+ buf.write("\3\2\2\2\u0178\u0179\7*\2\2\u0179\u0185\7+\2\2\u017a\u017b")
+ buf.write("\7(\2\2\u017b\u017c\5\64\33\2\u017c\u017d\7)\2\2\u017d")
+ buf.write("\u0185\3\2\2\2\u017e\u017f\7(\2\2\u017f\u0180\5:\36\2")
+ buf.write("\u0180\u0181\7)\2\2\u0181\u0185\3\2\2\2\u0182\u0183\7")
+ buf.write("(\2\2\u0183\u0185\7)\2\2\u0184\u0174\3\2\2\2\u0184\u0178")
+ buf.write("\3\2\2\2\u0184\u017a\3\2\2\2\u0184\u017e\3\2\2\2\u0184")
+ buf.write("\u0182\3\2\2\2\u0185\61\3\2\2\2\u0186\u0188\7,\2\2\u0187")
+ buf.write("\u0189\5*\26\2\u0188\u0187\3\2\2\2\u0189\u018a\3\2\2\2")
+ buf.write("\u018a\u0188\3\2\2\2\u018a\u018b\3\2\2\2\u018b\u018d\3")
+ buf.write("\2\2\2\u018c\u018e\5\62\32\2\u018d\u018c\3\2\2\2\u018d")
+ buf.write("\u018e\3\2\2\2\u018e\u0193\3\2\2\2\u018f\u0190\7,\2\2")
+ buf.write("\u0190\u0193\5\62\32\2\u0191\u0193\7,\2\2\u0192\u0186")
+ buf.write("\3\2\2\2\u0192\u018f\3\2\2\2\u0192\u0191\3\2\2\2\u0193")
+ buf.write("\63\3\2\2\2\u0194\u019a\5\66\34\2\u0195\u0197\7\6\2\2")
+ buf.write("\u0196\u0198\7\37\2\2\u0197\u0196\3\2\2\2\u0197\u0198")
+ buf.write("\3\2\2\2\u0198\u0199\3\2\2\2\u0199\u019b\7-\2\2\u019a")
+ buf.write("\u0195\3\2\2\2\u019a\u019b\3\2\2\2\u019b\65\3\2\2\2\u019c")
+ buf.write("\u01a4\58\35\2\u019d\u019f\7\6\2\2\u019e\u01a0\7\37\2")
+ buf.write("\2\u019f\u019e\3\2\2\2\u019f\u01a0\3\2\2\2\u01a0\u01a1")
+ buf.write("\3\2\2\2\u01a1\u01a3\58\35\2\u01a2\u019d\3\2\2\2\u01a3")
+ buf.write("\u01a6\3\2\2\2\u01a4\u01a2\3\2\2\2\u01a4\u01a5\3\2\2\2")
+ buf.write("\u01a5\67\3\2\2\2\u01a6\u01a4\3\2\2\2\u01a7\u01ac\5\b")
+ buf.write("\5\2\u01a8\u01ab\5,\27\2\u01a9\u01ab\5> \2\u01aa\u01a8")
+ buf.write("\3\2\2\2\u01aa\u01a9\3\2\2\2\u01ab\u01ae\3\2\2\2\u01ac")
+ buf.write("\u01aa\3\2\2\2\u01ac\u01ad\3\2\2\2\u01ad\u01b0\3\2\2\2")
+ buf.write("\u01ae\u01ac\3\2\2\2\u01af\u01b1\7\37\2\2\u01b0\u01af")
+ buf.write("\3\2\2\2\u01b0\u01b1\3\2\2\2\u01b1\u01ba\3\2\2\2\u01b2")
+ buf.write("\u01b4\5\62\32\2\u01b3\u01b2\3\2\2\2\u01b4\u01b7\3\2\2")
+ buf.write("\2\u01b5\u01b3\3\2\2\2\u01b5\u01b6\3\2\2\2\u01b6\u01b8")
+ buf.write("\3\2\2\2\u01b7\u01b5\3\2\2\2\u01b8\u01ba\7_\2\2\u01b9")
+ buf.write("\u01a7\3\2\2\2\u01b9\u01b5\3\2\2\2\u01ba9\3\2\2\2\u01bb")
+ buf.write("\u01c0\7_\2\2\u01bc\u01bd\7\6\2\2\u01bd\u01bf\7_\2\2\u01be")
+ buf.write("\u01bc\3\2\2\2\u01bf\u01c2\3\2\2\2\u01c0\u01be\3\2\2\2")
+ buf.write("\u01c0\u01c1\3\2\2\2\u01c1;\3\2\2\2\u01c2\u01c0\3\2\2")
+ buf.write("\2\u01c3\u01c5\5\36\20\2\u01c4\u01c6\5> \2\u01c5\u01c4")
+ buf.write("\3\2\2\2\u01c5\u01c6\3\2\2\2\u01c6\u01c9\3\2\2\2\u01c7")
+ buf.write("\u01c9\5\24\13\2\u01c8\u01c3\3\2\2\2\u01c8\u01c7\3\2\2")
+ buf.write("\2\u01c9=\3\2\2\2\u01ca\u01cc\5\62\32\2\u01cb\u01cd\5")
+ buf.write("@!\2\u01cc\u01cb\3\2\2\2\u01cc\u01cd\3\2\2\2\u01cd\u01d0")
+ buf.write("\3\2\2\2\u01ce\u01d0\5@!\2\u01cf\u01ca\3\2\2\2\u01cf\u01ce")
+ buf.write("\3\2\2\2\u01d0?\3\2\2\2\u01d1\u01d2\7(\2\2\u01d2\u01d3")
+ buf.write("\5> \2\u01d3\u01d4\7)\2\2\u01d4\u01d7\3\2\2\2\u01d5\u01d7")
+ buf.write("\5B\"\2\u01d6\u01d1\3\2\2\2\u01d6\u01d5\3\2\2\2\u01d7")
+ buf.write("\u01db\3\2\2\2\u01d8\u01da\5B\"\2\u01d9\u01d8\3\2\2\2")
+ buf.write("\u01da\u01dd\3\2\2\2\u01db\u01d9\3\2\2\2\u01db\u01dc\3")
+ buf.write("\2\2\2\u01dcA\3\2\2\2\u01dd\u01db\3\2\2\2\u01de\u01df")
+ buf.write("\7*\2\2\u01df\u01eb\7+\2\2\u01e0\u01e1\7*\2\2\u01e1\u01e2")
+ buf.write("\5^\60\2\u01e2\u01e3\7+\2\2\u01e3\u01eb\3\2\2\2\u01e4")
+ buf.write("\u01e5\7(\2\2\u01e5\u01eb\7)\2\2\u01e6\u01e7\7(\2\2\u01e7")
+ buf.write("\u01e8\5\64\33\2\u01e8\u01e9\7)\2\2\u01e9\u01eb\3\2\2")
+ buf.write("\2\u01ea\u01de\3\2\2\2\u01ea\u01e0\3\2\2\2\u01ea\u01e4")
+ buf.write("\3\2\2\2\u01ea\u01e6\3\2\2\2\u01ebC\3\2\2\2\u01ec\u01f5")
+ buf.write("\5`\61\2\u01ed\u01ee\7\3\2\2\u01ee\u01f0\5F$\2\u01ef\u01f1")
+ buf.write("\7\6\2\2\u01f0\u01ef\3\2\2\2\u01f0\u01f1\3\2\2\2\u01f1")
+ buf.write("\u01f2\3\2\2\2\u01f2\u01f3\7\26\2\2\u01f3\u01f5\3\2\2")
+ buf.write("\2\u01f4\u01ec\3\2\2\2\u01f4\u01ed\3\2\2\2\u01f5E\3\2")
+ buf.write("\2\2\u01f6\u01fb\5D#\2\u01f7\u01f8\7\6\2\2\u01f8\u01fa")
+ buf.write("\5D#\2\u01f9\u01f7\3\2\2\2\u01fa\u01fd\3\2\2\2\u01fb\u01f9")
+ buf.write("\3\2\2\2\u01fb\u01fc\3\2\2\2\u01fcG\3\2\2\2\u01fd\u01fb")
+ buf.write("\3\2\2\2\u01fe\u0200\5`\61\2\u01ff\u0201\7\37\2\2\u0200")
+ buf.write("\u01ff\3\2\2\2\u0200\u0201\3\2\2\2\u0201\u0209\3\2\2\2")
+ buf.write("\u0202\u0203\7\6\2\2\u0203\u0205\5`\61\2\u0204\u0206\7")
+ buf.write("\37\2\2\u0205\u0204\3\2\2\2\u0205\u0206\3\2\2\2\u0206")
+ buf.write("\u0208\3\2\2\2\u0207\u0202\3\2\2\2\u0208\u020b\3\2\2\2")
+ buf.write("\u0209\u0207\3\2\2\2\u0209\u020a\3\2\2\2\u020aI\3\2\2")
+ buf.write("\2\u020b\u0209\3\2\2\2\u020c\u0213\5L\'\2\u020d\u020e")
+ buf.write("\7.\2\2\u020e\u0212\5L\'\2\u020f\u0210\7/\2\2\u0210\u0212")
+ buf.write("\5L\'\2\u0211\u020d\3\2\2\2\u0211\u020f\3\2\2\2\u0212")
+ buf.write("\u0215\3\2\2\2\u0213\u0211\3\2\2\2\u0213\u0214\3\2\2\2")
+ buf.write("\u0214K\3\2\2\2\u0215\u0213\3\2\2\2\u0216\u021f\5N(\2")
+ buf.write("\u0217\u0218\7,\2\2\u0218\u021e\5N(\2\u0219\u021a\7\60")
+ buf.write("\2\2\u021a\u021e\5N(\2\u021b\u021c\7\61\2\2\u021c\u021e")
+ buf.write("\5N(\2\u021d\u0217\3\2\2\2\u021d\u0219\3\2\2\2\u021d\u021b")
+ buf.write("\3\2\2\2\u021e\u0221\3\2\2\2\u021f\u021d\3\2\2\2\u021f")
+ buf.write("\u0220\3\2\2\2\u0220M\3\2\2\2\u0221\u021f\3\2\2\2\u0222")
+ buf.write("\u0223\7(\2\2\u0223\u0224\5<\37\2\u0224\u0225\7)\2\2\u0225")
+ buf.write("\u0226\5N(\2\u0226\u0229\3\2\2\2\u0227\u0229\5P)\2\u0228")
+ buf.write("\u0222\3\2\2\2\u0228\u0227\3\2\2\2\u0229O\3\2\2\2\u022a")
+ buf.write("\u023a\5R*\2\u022b\u022c\7\62\2\2\u022c\u023a\5P)\2\u022d")
+ buf.write("\u022e\7\63\2\2\u022e\u023a\5P)\2\u022f\u0230\5V,\2\u0230")
+ buf.write("\u0231\5N(\2\u0231\u023a\3\2\2\2\u0232\u0233\7\64\2\2")
+ buf.write("\u0233\u023a\5P)\2\u0234\u0235\7\64\2\2\u0235\u0236\7")
+ buf.write("(\2\2\u0236\u0237\5<\37\2\u0237\u0238\7)\2\2\u0238\u023a")
+ buf.write("\3\2\2\2\u0239\u022a\3\2\2\2\u0239\u022b\3\2\2\2\u0239")
+ buf.write("\u022d\3\2\2\2\u0239\u022f\3\2\2\2\u0239\u0232\3\2\2\2")
+ buf.write("\u0239\u0234\3\2\2\2\u023aQ\3\2\2\2\u023b\u023c\5X-\2")
+ buf.write("\u023c\u025a\b*\1\2\u023d\u023e\7*\2\2\u023e\u023f\5\\")
+ buf.write("/\2\u023f\u0240\7+\2\2\u0240\u0259\3\2\2\2\u0241\u0242")
+ buf.write("\7(\2\2\u0242\u0243\7)\2\2\u0243\u0259\b*\1\2\u0244\u0245")
+ buf.write("\7(\2\2\u0245\u0246\5H%\2\u0246\u0247\7)\2\2\u0247\u0248")
+ buf.write("\b*\1\2\u0248\u0259\3\2\2\2\u0249\u024a\7(\2\2\u024a\u024b")
+ buf.write("\5T+\2\u024b\u024c\7)\2\2\u024c\u0259\3\2\2\2\u024d\u024e")
+ buf.write("\7\65\2\2\u024e\u024f\7_\2\2\u024f\u0259\b*\1\2\u0250")
+ buf.write("\u0251\7,\2\2\u0251\u0252\7_\2\2\u0252\u0259\b*\1\2\u0253")
+ buf.write("\u0254\7\66\2\2\u0254\u0255\7_\2\2\u0255\u0259\b*\1\2")
+ buf.write("\u0256\u0259\7\62\2\2\u0257\u0259\7\63\2\2\u0258\u023d")
+ buf.write("\3\2\2\2\u0258\u0241\3\2\2\2\u0258\u0244\3\2\2\2\u0258")
+ buf.write("\u0249\3\2\2\2\u0258\u024d\3\2\2\2\u0258\u0250\3\2\2\2")
+ buf.write("\u0258\u0253\3\2\2\2\u0258\u0256\3\2\2\2\u0258\u0257\3")
+ buf.write("\2\2\2\u0259\u025c\3\2\2\2\u025a\u0258\3\2\2\2\u025a\u025b")
+ buf.write("\3\2\2\2\u025bS\3\2\2\2\u025c\u025a\3\2\2\2\u025d\u0262")
+ buf.write("\58\35\2\u025e\u025f\7\6\2\2\u025f\u0261\58\35\2\u0260")
+ buf.write("\u025e\3\2\2\2\u0261\u0264\3\2\2\2\u0262\u0260\3\2\2\2")
+ buf.write("\u0262\u0263\3\2\2\2\u0263U\3\2\2\2\u0264\u0262\3\2\2")
+ buf.write("\2\u0265\u0266\t\5\2\2\u0266W\3\2\2\2\u0267\u026e\7_\2")
+ buf.write("\2\u0268\u026e\5Z.\2\u0269\u026a\7(\2\2\u026a\u026b\5")
+ buf.write("\\/\2\u026b\u026c\7)\2\2\u026c\u026e\3\2\2\2\u026d\u0267")
+ buf.write("\3\2\2\2\u026d\u0268\3\2\2\2\u026d\u0269\3\2\2\2\u026e")
+ buf.write("Y\3\2\2\2\u026f\u028a\7b\2\2\u0270\u028a\7d\2\2\u0271")
+ buf.write("\u028a\7c\2\2\u0272\u028a\7`\2\2\u0273\u0275\7_\2\2\u0274")
+ buf.write("\u0273\3\2\2\2\u0275\u0278\3\2\2\2\u0276\u0274\3\2\2\2")
+ buf.write("\u0276\u0277\3\2\2\2\u0277\u027a\3\2\2\2\u0278\u0276\3")
+ buf.write("\2\2\2\u0279\u027b\7a\2\2\u027a\u0279\3\2\2\2\u027b\u027c")
+ buf.write("\3\2\2\2\u027c\u027a\3\2\2\2\u027c\u027d\3\2\2\2\u027d")
+ buf.write("\u027f\3\2\2\2\u027e\u0276\3\2\2\2\u027f\u0280\3\2\2\2")
+ buf.write("\u0280\u027e\3\2\2\2\u0280\u0281\3\2\2\2\u0281\u0285\3")
+ buf.write("\2\2\2\u0282\u0284\7_\2\2\u0283\u0282\3\2\2\2\u0284\u0287")
+ buf.write("\3\2\2\2\u0285\u0283\3\2\2\2\u0285\u0286\3\2\2\2\u0286")
+ buf.write("\u028a\3\2\2\2\u0287\u0285\3\2\2\2\u0288\u028a\7e\2\2")
+ buf.write("\u0289\u026f\3\2\2\2\u0289\u0270\3\2\2\2\u0289\u0271\3")
+ buf.write("\2\2\2\u0289\u0272\3\2\2\2\u0289\u027e\3\2\2\2\u0289\u0288")
+ buf.write("\3\2\2\2\u028a[\3\2\2\2\u028b\u0290\5`\61\2\u028c\u028d")
+ buf.write("\7\6\2\2\u028d\u028f\5`\61\2\u028e\u028c\3\2\2\2\u028f")
+ buf.write("\u0292\3\2\2\2\u0290\u028e\3\2\2\2\u0290\u0291\3\2\2\2")
+ buf.write("\u0291]\3\2\2\2\u0292\u0290\3\2\2\2\u0293\u0294\5f\64")
+ buf.write("\2\u0294_\3\2\2\2\u0295\u0296\5b\62\2\u0296\u0297\5d\63")
+ buf.write("\2\u0297\u0298\5`\61\2\u0298\u029b\3\2\2\2\u0299\u029b")
+ buf.write("\5f\64\2\u029a\u0295\3\2\2\2\u029a\u0299\3\2\2\2\u029b")
+ buf.write("a\3\2\2\2\u029c\u029d\5P)\2\u029dc\3\2\2\2\u029e\u029f")
+ buf.write("\t\6\2\2\u029fe\3\2\2\2\u02a0\u02a7\5h\65\2\u02a1\u02a2")
+ buf.write("\7D\2\2\u02a2\u02a3\5\\/\2\u02a3\u02a4\7\31\2\2\u02a4")
+ buf.write("\u02a5\5f\64\2\u02a5\u02a6\b\64\1\2\u02a6\u02a8\3\2\2")
+ buf.write("\2\u02a7\u02a1\3\2\2\2\u02a7\u02a8\3\2\2\2\u02a8g\3\2")
+ buf.write("\2\2\u02a9\u02ae\5j\66\2\u02aa\u02ab\7E\2\2\u02ab\u02ad")
+ buf.write("\5j\66\2\u02ac\u02aa\3\2\2\2\u02ad\u02b0\3\2\2\2\u02ae")
+ buf.write("\u02ac\3\2\2\2\u02ae\u02af\3\2\2\2\u02afi\3\2\2\2\u02b0")
+ buf.write("\u02ae\3\2\2\2\u02b1\u02b6\5l\67\2\u02b2\u02b3\7F\2\2")
+ buf.write("\u02b3\u02b5\5l\67\2\u02b4\u02b2\3\2\2\2\u02b5\u02b8\3")
+ buf.write("\2\2\2\u02b6\u02b4\3\2\2\2\u02b6\u02b7\3\2\2\2\u02b7k")
+ buf.write("\3\2\2\2\u02b8\u02b6\3\2\2\2\u02b9\u02be\5n8\2\u02ba\u02bb")
+ buf.write("\7G\2\2\u02bb\u02bd\5n8\2\u02bc\u02ba\3\2\2\2\u02bd\u02c0")
+ buf.write("\3\2\2\2\u02be\u02bc\3\2\2\2\u02be\u02bf\3\2\2\2\u02bf")
+ buf.write("m\3\2\2\2\u02c0\u02be\3\2\2\2\u02c1\u02c6\5p9\2\u02c2")
+ buf.write("\u02c3\7H\2\2\u02c3\u02c5\5p9\2\u02c4\u02c2\3\2\2\2\u02c5")
+ buf.write("\u02c8\3\2\2\2\u02c6\u02c4\3\2\2\2\u02c6\u02c7\3\2\2\2")
+ buf.write("\u02c7o\3\2\2\2\u02c8\u02c6\3\2\2\2\u02c9\u02ce\5r:\2")
+ buf.write("\u02ca\u02cb\7\67\2\2\u02cb\u02cd\5r:\2\u02cc\u02ca\3")
+ buf.write("\2\2\2\u02cd\u02d0\3\2\2\2\u02ce\u02cc\3\2\2\2\u02ce\u02cf")
+ buf.write("\3\2\2\2\u02cfq\3\2\2\2\u02d0\u02ce\3\2\2\2\u02d1\u02d6")
+ buf.write("\5t;\2\u02d2\u02d3\t\7\2\2\u02d3\u02d5\5t;\2\u02d4\u02d2")
+ buf.write("\3\2\2\2\u02d5\u02d8\3\2\2\2\u02d6\u02d4\3\2\2\2\u02d6")
+ buf.write("\u02d7\3\2\2\2\u02d7s\3\2\2\2\u02d8\u02d6\3\2\2\2\u02d9")
+ buf.write("\u02de\5v<\2\u02da\u02db\t\b\2\2\u02db\u02dd\5v<\2\u02dc")
+ buf.write("\u02da\3\2\2\2\u02dd\u02e0\3\2\2\2\u02de\u02dc\3\2\2\2")
+ buf.write("\u02de\u02df\3\2\2\2\u02dfu\3\2\2\2\u02e0\u02de\3\2\2")
+ buf.write("\2\u02e1\u02e6\5J&\2\u02e2\u02e3\t\t\2\2\u02e3\u02e5\5")
+ buf.write("J&\2\u02e4\u02e2\3\2\2\2\u02e5\u02e8\3\2\2\2\u02e6\u02e4")
+ buf.write("\3\2\2\2\u02e6\u02e7\3\2\2\2\u02e7w\3\2\2\2\u02e8\u02e6")
+ buf.write("\3\2\2\2\u02e9\u02f5\5\u0082B\2\u02ea\u02f5\5\u0084C\2")
+ buf.write("\u02eb\u02f5\5\u0088E\2\u02ec\u02f5\5\u008aF\2\u02ed\u02f5")
+ buf.write("\5\u008cG\2\u02ee\u02f5\5\u008eH\2\u02ef\u02f5\5\u0080")
+ buf.write("A\2\u02f0\u02f5\5z>\2\u02f1\u02f5\5|?\2\u02f2\u02f5\5")
+ buf.write("~@\2\u02f3\u02f5\5\n\6\2\u02f4\u02e9\3\2\2\2\u02f4\u02ea")
+ buf.write("\3\2\2\2\u02f4\u02eb\3\2\2\2\u02f4\u02ec\3\2\2\2\u02f4")
+ buf.write("\u02ed\3\2\2\2\u02f4\u02ee\3\2\2\2\u02f4\u02ef\3\2\2\2")
+ buf.write("\u02f4\u02f0\3\2\2\2\u02f4\u02f1\3\2\2\2\u02f4\u02f2\3")
+ buf.write("\2\2\2\u02f4\u02f3\3\2\2\2\u02f5y\3\2\2\2\u02f6\u02f8")
+ buf.write("\7Q\2\2\u02f7\u02f6\3\2\2\2\u02f7\u02f8\3\2\2\2\u02f8")
+ buf.write("\u02f9\3\2\2\2\u02f9\u02fa\7_\2\2\u02fa\u02fe\7(\2\2\u02fb")
+ buf.write("\u02fd\n\n\2\2\u02fc\u02fb\3\2\2\2\u02fd\u0300\3\2\2\2")
+ buf.write("\u02fe\u02fc\3\2\2\2\u02fe\u02ff\3\2\2\2\u02ff\u0301\3")
+ buf.write("\2\2\2\u0300\u02fe\3\2\2\2\u0301\u0302\7)\2\2\u0302\u0303")
+ buf.write("\7\4\2\2\u0303{\3\2\2\2\u0304\u0305\7R\2\2\u0305\u0309")
+ buf.write("\7\3\2\2\u0306\u0308\n\13\2\2\u0307\u0306\3\2\2\2\u0308")
+ buf.write("\u030b\3\2\2\2\u0309\u0307\3\2\2\2\u0309\u030a\3\2\2\2")
+ buf.write("\u030a\u030c\3\2\2\2\u030b\u0309\3\2\2\2\u030c\u030d\7")
+ buf.write("\26\2\2\u030d}\3\2\2\2\u030e\u030f\7S\2\2\u030f\u0313")
+ buf.write("\7\3\2\2\u0310\u0312\n\13\2\2\u0311\u0310\3\2\2\2\u0312")
+ buf.write("\u0315\3\2\2\2\u0313\u0311\3\2\2\2\u0313\u0314\3\2\2\2")
+ buf.write("\u0314\u0316\3\2\2\2\u0315\u0313\3\2\2\2\u0316\u0317\7")
+ buf.write("\26\2\2\u0317\177\3\2\2\2\u0318\u0319\7_\2\2\u0319\u031d")
+ buf.write("\7(\2\2\u031a\u031c\5\n\6\2\u031b\u031a\3\2\2\2\u031c")
+ buf.write("\u031f\3\2\2\2\u031d\u031b\3\2\2\2\u031d\u031e\3\2\2\2")
+ buf.write("\u031e\u0321\3\2\2\2\u031f\u031d\3\2\2\2\u0320\u0322\5")
+ buf.write("\u0086D\2\u0321\u0320\3\2\2\2\u0321\u0322\3\2\2\2\u0322")
+ buf.write("\u0324\3\2\2\2\u0323\u0325\5\\/\2\u0324\u0323\3\2\2\2")
+ buf.write("\u0324\u0325\3\2\2\2\u0325\u0326\3\2\2\2\u0326\u0327\7")
+ buf.write(")\2\2\u0327\u0081\3\2\2\2\u0328\u0329\7_\2\2\u0329\u032a")
+ buf.write("\7\31\2\2\u032a\u0334\5x=\2\u032b\u032c\7T\2\2\u032c\u032d")
+ buf.write("\5^\60\2\u032d\u032e\7\31\2\2\u032e\u032f\5x=\2\u032f")
+ buf.write("\u0334\3\2\2\2\u0330\u0331\7U\2\2\u0331\u0332\7\31\2\2")
+ buf.write("\u0332\u0334\5x=\2\u0333\u0328\3\2\2\2\u0333\u032b\3\2")
+ buf.write("\2\2\u0333\u0330\3\2\2\2\u0334\u0083\3\2\2\2\u0335\u0339")
+ buf.write("\7\3\2\2\u0336\u0338\5\n\6\2\u0337\u0336\3\2\2\2\u0338")
+ buf.write("\u033b\3\2\2\2\u0339\u0337\3\2\2\2\u0339\u033a\3\2\2\2")
+ buf.write("\u033a\u033d\3\2\2\2\u033b\u0339\3\2\2\2\u033c\u033e\5")
+ buf.write("\u0086D\2\u033d\u033c\3\2\2\2\u033d\u033e\3\2\2\2\u033e")
+ buf.write("\u033f\3\2\2\2\u033f\u0340\7\26\2\2\u0340\u0085\3\2\2")
+ buf.write("\2\u0341\u0343\5x=\2\u0342\u0341\3\2\2\2\u0343\u0344\3")
+ buf.write("\2\2\2\u0344\u0342\3\2\2\2\u0344\u0345\3\2\2\2\u0345\u0087")
+ buf.write("\3\2\2\2\u0346\u034b\7\4\2\2\u0347\u0348\5\\/\2\u0348")
+ buf.write("\u0349\7\4\2\2\u0349\u034b\3\2\2\2\u034a\u0346\3\2\2\2")
+ buf.write("\u034a\u0347\3\2\2\2\u034b\u0089\3\2\2\2\u034c\u034d\7")
+ buf.write("V\2\2\u034d\u034e\7(\2\2\u034e\u034f\5\\/\2\u034f\u0350")
+ buf.write("\7)\2\2\u0350\u0351\bF\1\2\u0351\u0354\5x=\2\u0352\u0353")
+ buf.write("\7W\2\2\u0353\u0355\5x=\2\u0354\u0352\3\2\2\2\u0354\u0355")
+ buf.write("\3\2\2\2\u0355\u035d\3\2\2\2\u0356\u0357\7X\2\2\u0357")
+ buf.write("\u0358\7(\2\2\u0358\u0359\5\\/\2\u0359\u035a\7)\2\2\u035a")
+ buf.write("\u035b\5x=\2\u035b\u035d\3\2\2\2\u035c\u034c\3\2\2\2\u035c")
+ buf.write("\u0356\3\2\2\2\u035d\u008b\3\2\2\2\u035e\u035f\7Y\2\2")
+ buf.write("\u035f\u0360\7(\2\2\u0360\u0361\5\\/\2\u0361\u0362\7)")
+ buf.write("\2\2\u0362\u0363\5x=\2\u0363\u0364\bG\1\2\u0364\u036f")
+ buf.write("\3\2\2\2\u0365\u0366\7Z\2\2\u0366\u0367\5x=\2\u0367\u0368")
+ buf.write("\7Y\2\2\u0368\u0369\7(\2\2\u0369\u036a\5\\/\2\u036a\u036b")
+ buf.write("\7)\2\2\u036b\u036c\7\4\2\2\u036c\u036d\bG\1\2\u036d\u036f")
+ buf.write("\3\2\2\2\u036e\u035e\3\2\2\2\u036e\u0365\3\2\2\2\u036f")
+ buf.write("\u008d\3\2\2\2\u0370\u0371\7[\2\2\u0371\u0372\7_\2\2\u0372")
+ buf.write("\u037e\7\4\2\2\u0373\u0374\7\\\2\2\u0374\u037e\7\4\2\2")
+ buf.write("\u0375\u0376\7]\2\2\u0376\u037e\7\4\2\2\u0377\u0378\7")
+ buf.write("^\2\2\u0378\u037e\7\4\2\2\u0379\u037a\7^\2\2\u037a\u037b")
+ buf.write("\5\\/\2\u037b\u037c\7\4\2\2\u037c\u037e\3\2\2\2\u037d")
+ buf.write("\u0370\3\2\2\2\u037d\u0373\3\2\2\2\u037d\u0375\3\2\2\2")
+ buf.write("\u037d\u0377\3\2\2\2\u037d\u0379\3\2\2\2\u037e\u008f\3")
+ buf.write("\2\2\2o\u0093\u0097\u009d\u00a6\u00a8\u00ab\u00b1\u00b6")
+ buf.write("\u00bd\u00bf\u00c3\u00cb\u00d0\u00d7\u00dd\u00f4\u00f9")
+ buf.write("\u00ff\u0108\u010f\u0117\u0119\u0120\u0126\u012a\u0130")
+ buf.write("\u0139\u013f\u0146\u014c\u0151\u0154\u0157\u015a\u015e")
+ buf.write("\u0164\u0169\u0170\u0172\u0184\u018a\u018d\u0192\u0197")
+ buf.write("\u019a\u019f\u01a4\u01aa\u01ac\u01b0\u01b5\u01b9\u01c0")
+ buf.write("\u01c5\u01c8\u01cc\u01cf\u01d6\u01db\u01ea\u01f0\u01f4")
+ buf.write("\u01fb\u0200\u0205\u0209\u0211\u0213\u021d\u021f\u0228")
+ buf.write("\u0239\u0258\u025a\u0262\u026d\u0276\u027c\u0280\u0285")
+ buf.write("\u0289\u0290\u029a\u02a7\u02ae\u02b6\u02be\u02c6\u02ce")
+ buf.write("\u02d6\u02de\u02e6\u02f4\u02f7\u02fe\u0309\u0313\u031d")
+ buf.write("\u0321\u0324\u0333\u0339\u033d\u0344\u034a\u0354\u035c")
+ buf.write("\u036e\u037d")
+ return buf.getvalue()
+
+
+class CParser ( Parser ):
+
+ grammarFileName = "C.g4"
+
+ atn = ATNDeserializer().deserialize(serializedATN())
+
+ decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
+
+ sharedContextCache = PredictionContextCache()
+
+ literalNames = [ "<INVALID>", "'{'", "';'", "'typedef'", "','", "'='",
+ "'extern'", "'static'", "'auto'", "'register'", "'STATIC'",
+ "'void'", "'char'", "'short'", "'int'", "'long'", "'float'",
+ "'double'", "'signed'", "'unsigned'", "'}'", "'struct'",
+ "'union'", "':'", "'enum'", "'const'", "'volatile'",
+ "'IN'", "'OUT'", "'OPTIONAL'", "'CONST'", "'UNALIGNED'",
+ "'VOLATILE'", "'GLOBAL_REMOVE_IF_UNREFERENCED'", "'EFIAPI'",
+ "'EFI_BOOTSERVICE'", "'EFI_RUNTIMESERVICE'", "'PACKED'",
+ "'('", "')'", "'['", "']'", "'*'", "'...'", "'+'",
+ "'-'", "'/'", "'%'", "'++'", "'--'", "'sizeof'", "'.'",
+ "'->'", "'&'", "'~'", "'!'", "'*='", "'/='", "'%='",
+ "'+='", "'-='", "'<<='", "'>>='", "'&='", "'^='", "'|='",
+ "'?'", "'||'", "'&&'", "'|'", "'^'", "'=='", "'!='",
+ "'<'", "'>'", "'<='", "'>='", "'<<'", "'>>'", "'__asm__'",
+ "'_asm'", "'__asm'", "'case'", "'default'", "'if'",
+ "'else'", "'switch'", "'while'", "'do'", "'goto'",
+ "'continue'", "'break'", "'return'" ]
+
+ symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
+ "<INVALID>", "IDENTIFIER", "CHARACTER_LITERAL", "STRING_LITERAL",
+ "HEX_LITERAL", "DECIMAL_LITERAL", "OCTAL_LITERAL",
+ "FLOATING_POINT_LITERAL", "WS", "BS", "UnicodeVocabulary",
+ "COMMENT", "LINE_COMMENT", "LINE_COMMAND" ]
+
+ RULE_translation_unit = 0
+ RULE_external_declaration = 1
+ RULE_function_definition = 2
+ RULE_declaration_specifiers = 3
+ RULE_declaration = 4
+ RULE_init_declarator_list = 5
+ RULE_init_declarator = 6
+ RULE_storage_class_specifier = 7
+ RULE_type_specifier = 8
+ RULE_type_id = 9
+ RULE_struct_or_union_specifier = 10
+ RULE_struct_or_union = 11
+ RULE_struct_declaration_list = 12
+ RULE_struct_declaration = 13
+ RULE_specifier_qualifier_list = 14
+ RULE_struct_declarator_list = 15
+ RULE_struct_declarator = 16
+ RULE_enum_specifier = 17
+ RULE_enumerator_list = 18
+ RULE_enumerator = 19
+ RULE_type_qualifier = 20
+ RULE_declarator = 21
+ RULE_direct_declarator = 22
+ RULE_declarator_suffix = 23
+ RULE_pointer = 24
+ RULE_parameter_type_list = 25
+ RULE_parameter_list = 26
+ RULE_parameter_declaration = 27
+ RULE_identifier_list = 28
+ RULE_type_name = 29
+ RULE_abstract_declarator = 30
+ RULE_direct_abstract_declarator = 31
+ RULE_abstract_declarator_suffix = 32
+ RULE_initializer = 33
+ RULE_initializer_list = 34
+ RULE_argument_expression_list = 35
+ RULE_additive_expression = 36
+ RULE_multiplicative_expression = 37
+ RULE_cast_expression = 38
+ RULE_unary_expression = 39
+ RULE_postfix_expression = 40
+ RULE_macro_parameter_list = 41
+ RULE_unary_operator = 42
+ RULE_primary_expression = 43
+ RULE_constant = 44
+ RULE_expression = 45
+ RULE_constant_expression = 46
+ RULE_assignment_expression = 47
+ RULE_lvalue = 48
+ RULE_assignment_operator = 49
+ RULE_conditional_expression = 50
+ RULE_logical_or_expression = 51
+ RULE_logical_and_expression = 52
+ RULE_inclusive_or_expression = 53
+ RULE_exclusive_or_expression = 54
+ RULE_and_expression = 55
+ RULE_equality_expression = 56
+ RULE_relational_expression = 57
+ RULE_shift_expression = 58
+ RULE_statement = 59
+ RULE_asm2_statement = 60
+ RULE_asm1_statement = 61
+ RULE_asm_statement = 62
+ RULE_macro_statement = 63
+ RULE_labeled_statement = 64
+ RULE_compound_statement = 65
+ RULE_statement_list = 66
+ RULE_expression_statement = 67
+ RULE_selection_statement = 68
+ RULE_iteration_statement = 69
+ RULE_jump_statement = 70
+
+ ruleNames = [ "translation_unit", "external_declaration", "function_definition",
+ "declaration_specifiers", "declaration", "init_declarator_list",
+ "init_declarator", "storage_class_specifier", "type_specifier",
+ "type_id", "struct_or_union_specifier", "struct_or_union",
+ "struct_declaration_list", "struct_declaration", "specifier_qualifier_list",
+ "struct_declarator_list", "struct_declarator", "enum_specifier",
+ "enumerator_list", "enumerator", "type_qualifier", "declarator",
+ "direct_declarator", "declarator_suffix", "pointer",
+ "parameter_type_list", "parameter_list", "parameter_declaration",
+ "identifier_list", "type_name", "abstract_declarator",
+ "direct_abstract_declarator", "abstract_declarator_suffix",
+ "initializer", "initializer_list", "argument_expression_list",
+ "additive_expression", "multiplicative_expression", "cast_expression",
+ "unary_expression", "postfix_expression", "macro_parameter_list",
+ "unary_operator", "primary_expression", "constant", "expression",
+ "constant_expression", "assignment_expression", "lvalue",
+ "assignment_operator", "conditional_expression", "logical_or_expression",
+ "logical_and_expression", "inclusive_or_expression",
+ "exclusive_or_expression", "and_expression", "equality_expression",
+ "relational_expression", "shift_expression", "statement",
+ "asm2_statement", "asm1_statement", "asm_statement",
+ "macro_statement", "labeled_statement", "compound_statement",
+ "statement_list", "expression_statement", "selection_statement",
+ "iteration_statement", "jump_statement" ]
+
+ EOF = Token.EOF
+ T__0=1
+ T__1=2
+ T__2=3
+ T__3=4
+ T__4=5
+ T__5=6
+ T__6=7
+ T__7=8
+ T__8=9
+ T__9=10
+ T__10=11
+ T__11=12
+ T__12=13
+ T__13=14
+ T__14=15
+ T__15=16
+ T__16=17
+ T__17=18
+ T__18=19
+ T__19=20
+ T__20=21
+ T__21=22
+ T__22=23
+ T__23=24
+ T__24=25
+ T__25=26
+ T__26=27
+ T__27=28
+ T__28=29
+ T__29=30
+ T__30=31
+ T__31=32
+ T__32=33
+ T__33=34
+ T__34=35
+ T__35=36
+ T__36=37
+ T__37=38
+ T__38=39
+ T__39=40
+ T__40=41
+ T__41=42
+ T__42=43
+ T__43=44
+ T__44=45
+ T__45=46
+ T__46=47
+ T__47=48
+ T__48=49
+ T__49=50
+ T__50=51
+ T__51=52
+ T__52=53
+ T__53=54
+ T__54=55
+ T__55=56
+ T__56=57
+ T__57=58
+ T__58=59
+ T__59=60
+ T__60=61
+ T__61=62
+ T__62=63
+ T__63=64
+ T__64=65
+ T__65=66
+ T__66=67
+ T__67=68
+ T__68=69
+ T__69=70
+ T__70=71
+ T__71=72
+ T__72=73
+ T__73=74
+ T__74=75
+ T__75=76
+ T__76=77
+ T__77=78
+ T__78=79
+ T__79=80
+ T__80=81
+ T__81=82
+ T__82=83
+ T__83=84
+ T__84=85
+ T__85=86
+ T__86=87
+ T__87=88
+ T__88=89
+ T__89=90
+ T__90=91
+ T__91=92
+ IDENTIFIER=93
+ CHARACTER_LITERAL=94
+ STRING_LITERAL=95
+ HEX_LITERAL=96
+ DECIMAL_LITERAL=97
+ OCTAL_LITERAL=98
+ FLOATING_POINT_LITERAL=99
+ WS=100
+ BS=101
+ UnicodeVocabulary=102
+ COMMENT=103
+ LINE_COMMENT=104
+ LINE_COMMAND=105
+
+ # @param input Type: TokenStream
+ # @param output= sys.stdout Type: TextIO
+ def __init__(self,input,output= sys.stdout):
+ super().__init__(input, output)
+ self.checkVersion("4.7.1")
+ self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
+ self._predicates = None
+
+
+
+
+ def printTokenInfo(self,line,offset,tokenText):
+ print(str(line)+ ',' + str(offset) + ':' + str(tokenText))
+
+ def StorePredicateExpression(self,StartLine,StartOffset,EndLine,EndOffset,Text):
+ PredExp = CodeFragment.PredicateExpression(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.PredicateExpressionList.append(PredExp)
+
+ def StoreEnumerationDefinition(self,StartLine,StartOffset,EndLine,EndOffset,Text):
+ EnumDef = CodeFragment.EnumerationDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.EnumerationDefinitionList.append(EnumDef)
+
+ def StoreStructUnionDefinition(self,StartLine,StartOffset,EndLine,EndOffset,Text):
+ SUDef = CodeFragment.StructUnionDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.StructUnionDefinitionList.append(SUDef)
+
+ def StoreTypedefDefinition(self,StartLine,StartOffset,EndLine,EndOffset,FromText,ToText):
+ Tdef = CodeFragment.TypedefDefinition(FromText, ToText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.TypedefDefinitionList.append(Tdef)
+
+ def StoreFunctionDefinition(self,StartLine,StartOffset,EndLine,EndOffset,ModifierText,DeclText,LeftBraceLine,LeftBraceOffset,DeclLine,DeclOffset):
+ FuncDef = CodeFragment.FunctionDefinition(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset), (LeftBraceLine, LeftBraceOffset), (DeclLine, DeclOffset))
+ FileProfile.FunctionDefinitionList.append(FuncDef)
+
+ def StoreVariableDeclaration(self,StartLine,StartOffset,EndLine,EndOffset,ModifierText,DeclText):
+ VarDecl = CodeFragment.VariableDeclaration(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.VariableDeclarationList.append(VarDecl)
+
+ def StoreFunctionCalling(self,StartLine,StartOffset,EndLine,EndOffset,FuncName,ParamList):
+ FuncCall = CodeFragment.FunctionCalling(FuncName, ParamList, (StartLine, StartOffset), (EndLine, EndOffset))
+ FileProfile.FunctionCallingList.append(FuncCall)
+
+
+
+ class Translation_unitContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def external_declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.External_declarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.External_declarationContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_translation_unit
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterTranslation_unit" ):
+ listener.enterTranslation_unit(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitTranslation_unit" ):
+ listener.exitTranslation_unit(self)
+
+
+
+
+ def translation_unit(self):
+
+ localctx = CParser.Translation_unitContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 0, self.RULE_translation_unit)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 145
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__2) | (1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9) | (1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36) | (1 << CParser.T__37) | (1 << CParser.T__41))) != 0) or _la==CParser.IDENTIFIER:
+ self.state = 142
+ self.external_declaration()
+ self.state = 147
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class External_declarationContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def declarator(self):
+ return self.getTypedRuleContext(CParser.DeclaratorContext,0)
+
+
+ def declaration_specifiers(self):
+ return self.getTypedRuleContext(CParser.Declaration_specifiersContext,0)
+
+
+ # @param i=None Type: int
+ def declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.DeclarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.DeclarationContext,i)
+
+
+ def function_definition(self):
+ return self.getTypedRuleContext(CParser.Function_definitionContext,0)
+
+
+ def macro_statement(self):
+ return self.getTypedRuleContext(CParser.Macro_statementContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_external_declaration
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterExternal_declaration" ):
+ listener.enterExternal_declaration(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitExternal_declaration" ):
+ listener.exitExternal_declaration(self)
+
+
+
+
+ def external_declaration(self):
+
+ localctx = CParser.External_declarationContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 2, self.RULE_external_declaration)
+ self._la = 0 # Token type
+ try:
+ self.state = 166
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,4,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 149
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,1,self._ctx)
+ if la_ == 1:
+ self.state = 148
+ self.declaration_specifiers()
+
+
+ self.state = 151
+ self.declarator()
+ self.state = 155
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__2) | (1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9) | (1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36))) != 0) or _la==CParser.IDENTIFIER:
+ self.state = 152
+ self.declaration()
+ self.state = 157
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 158
+ self.match(CParser.T__0)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 160
+ self.function_definition()
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 161
+ self.declaration()
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 162
+ self.macro_statement()
+ self.state = 164
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__1:
+ self.state = 163
+ self.match(CParser.T__1)
+
+
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Function_definitionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.ModifierText = ''
+ self.DeclText = ''
+ self.LBLine = 0
+ self.LBOffset = 0
+ self.DeclLine = 0
+ self.DeclOffset = 0
+ self.d = None # Declaration_specifiersContext
+ self._declaration_specifiers = None # Declaration_specifiersContext
+ self._declarator = None # DeclaratorContext
+ self.a = None # Compound_statementContext
+ self.b = None # Compound_statementContext
+
+ def declarator(self):
+ return self.getTypedRuleContext(CParser.DeclaratorContext,0)
+
+
+ def compound_statement(self):
+ return self.getTypedRuleContext(CParser.Compound_statementContext,0)
+
+
+ def declaration_specifiers(self):
+ return self.getTypedRuleContext(CParser.Declaration_specifiersContext,0)
+
+
+ # @param i=None Type: int
+ def declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.DeclarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.DeclarationContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_function_definition
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterFunction_definition" ):
+ listener.enterFunction_definition(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitFunction_definition" ):
+ listener.exitFunction_definition(self)
+
+
+
+
+ def function_definition(self):
+
+ localctx = CParser.Function_definitionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 4, self.RULE_function_definition)
+
+ ModifierText = '';
+ DeclText = '';
+ LBLine = 0;
+ LBOffset = 0;
+ DeclLine = 0;
+ DeclOffset = 0;
+
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 169
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,5,self._ctx)
+ if la_ == 1:
+ self.state = 168
+ localctx.d = localctx._declaration_specifiers = self.declaration_specifiers()
+
+
+ self.state = 171
+ localctx._declarator = self.declarator()
+ self.state = 180
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__2, CParser.T__5, CParser.T__6, CParser.T__7, CParser.T__8, CParser.T__9, CParser.T__10, CParser.T__11, CParser.T__12, CParser.T__13, CParser.T__14, CParser.T__15, CParser.T__16, CParser.T__17, CParser.T__18, CParser.T__20, CParser.T__21, CParser.T__23, CParser.T__24, CParser.T__25, CParser.T__26, CParser.T__27, CParser.T__28, CParser.T__29, CParser.T__30, CParser.T__31, CParser.T__32, CParser.T__33, CParser.T__34, CParser.T__35, CParser.T__36, CParser.IDENTIFIER]:
+ self.state = 173
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while True:
+ self.state = 172
+ self.declaration()
+ self.state = 175
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__2) | (1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9) | (1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36))) != 0) or _la==CParser.IDENTIFIER):
+ break
+
+ self.state = 177
+ localctx.a = self.compound_statement()
+ pass
+ elif token in [CParser.T__0]:
+ self.state = 179
+ localctx.b = self.compound_statement()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+
+ if localctx.d != None:
+ ModifierText = (None if localctx._declaration_specifiers is None else self._input.getText((localctx._declaration_specifiers.start,localctx._declaration_specifiers.stop)))
+ else:
+ ModifierText = ''
+ DeclText = (None if localctx._declarator is None else self._input.getText((localctx._declarator.start,localctx._declarator.stop)))
+ DeclLine = (None if localctx._declarator is None else localctx._declarator.start).line
+ DeclOffset = (None if localctx._declarator is None else localctx._declarator.start).column
+ if localctx.a != None:
+ LBLine = (None if localctx.a is None else localctx.a.start).line
+ LBOffset = (None if localctx.a is None else localctx.a.start).column
+ else:
+ LBLine = (None if localctx.b is None else localctx.b.start).line
+ LBOffset = (None if localctx.b is None else localctx.b.start).column
+
+ self._ctx.stop = self._input.LT(-1)
+
+ self.StoreFunctionDefinition(localctx.start.line, localctx.start.column, localctx.stop.line, localctx.stop.column, ModifierText, DeclText, LBLine, LBOffset, DeclLine, DeclOffset)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Declaration_specifiersContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def storage_class_specifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Storage_class_specifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Storage_class_specifierContext,i)
+
+
+ # @param i=None Type: int
+ def type_specifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Type_specifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Type_specifierContext,i)
+
+
+ # @param i=None Type: int
+ def type_qualifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Type_qualifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Type_qualifierContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_declaration_specifiers
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterDeclaration_specifiers" ):
+ listener.enterDeclaration_specifiers(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitDeclaration_specifiers" ):
+ listener.exitDeclaration_specifiers(self)
+
+
+
+
+ def declaration_specifiers(self):
+
+ localctx = CParser.Declaration_specifiersContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 6, self.RULE_declaration_specifiers)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 187
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 187
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__5, CParser.T__6, CParser.T__7, CParser.T__8, CParser.T__9]:
+ self.state = 184
+ self.storage_class_specifier()
+ pass
+ elif token in [CParser.T__10, CParser.T__11, CParser.T__12, CParser.T__13, CParser.T__14, CParser.T__15, CParser.T__16, CParser.T__17, CParser.T__18, CParser.T__20, CParser.T__21, CParser.T__23, CParser.IDENTIFIER]:
+ self.state = 185
+ self.type_specifier()
+ pass
+ elif token in [CParser.T__24, CParser.T__25, CParser.T__26, CParser.T__27, CParser.T__28, CParser.T__29, CParser.T__30, CParser.T__31, CParser.T__32, CParser.T__33, CParser.T__34, CParser.T__35, CParser.T__36]:
+ self.state = 186
+ self.type_qualifier()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 189
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,9,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class DeclarationContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.a = None # Token
+ self.b = None # Declaration_specifiersContext
+ self.c = None # Init_declarator_listContext
+ self.d = None # Token
+ self.s = None # Declaration_specifiersContext
+ self.t = None # Init_declarator_listContext
+ self.e = None # Token
+
+ def init_declarator_list(self):
+ return self.getTypedRuleContext(CParser.Init_declarator_listContext,0)
+
+
+ def declaration_specifiers(self):
+ return self.getTypedRuleContext(CParser.Declaration_specifiersContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_declaration
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterDeclaration" ):
+ listener.enterDeclaration(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitDeclaration" ):
+ listener.exitDeclaration(self)
+
+
+
+
+ def declaration(self):
+
+ localctx = CParser.DeclarationContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 8, self.RULE_declaration)
+ self._la = 0 # Token type
+ try:
+ self.state = 206
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__2]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 191
+ localctx.a = self.match(CParser.T__2)
+ self.state = 193
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,10,self._ctx)
+ if la_ == 1:
+ self.state = 192
+ localctx.b = self.declaration_specifiers()
+
+
+ self.state = 195
+ localctx.c = self.init_declarator_list()
+ self.state = 196
+ localctx.d = self.match(CParser.T__1)
+
+ if localctx.b is not None:
+ self.StoreTypedefDefinition(localctx.a.line, localctx.a.column, (0 if localctx.d is None else localctx.d.line), localctx.d.column, (None if localctx.b is None else self._input.getText((localctx.b.start,localctx.b.stop))), (None if localctx.c is None else self._input.getText((localctx.c.start,localctx.c.stop))))
+ else:
+ self.StoreTypedefDefinition(localctx.a.line, localctx.a.column, (0 if localctx.d is None else localctx.d.line), localctx.d.column, '', (None if localctx.c is None else self._input.getText((localctx.c.start,localctx.c.stop))))
+
+ pass
+ elif token in [CParser.T__5, CParser.T__6, CParser.T__7, CParser.T__8, CParser.T__9, CParser.T__10, CParser.T__11, CParser.T__12, CParser.T__13, CParser.T__14, CParser.T__15, CParser.T__16, CParser.T__17, CParser.T__18, CParser.T__20, CParser.T__21, CParser.T__23, CParser.T__24, CParser.T__25, CParser.T__26, CParser.T__27, CParser.T__28, CParser.T__29, CParser.T__30, CParser.T__31, CParser.T__32, CParser.T__33, CParser.T__34, CParser.T__35, CParser.T__36, CParser.IDENTIFIER]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 199
+ localctx.s = self.declaration_specifiers()
+ self.state = 201
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if ((((_la - 34)) & ~0x3f) == 0 and ((1 << (_la - 34)) & ((1 << (CParser.T__33 - 34)) | (1 << (CParser.T__34 - 34)) | (1 << (CParser.T__35 - 34)) | (1 << (CParser.T__37 - 34)) | (1 << (CParser.T__41 - 34)) | (1 << (CParser.IDENTIFIER - 34)))) != 0):
+ self.state = 200
+ localctx.t = self.init_declarator_list()
+
+
+ self.state = 203
+ localctx.e = self.match(CParser.T__1)
+
+ if localctx.t is not None:
+ self.StoreVariableDeclaration((None if localctx.s is None else localctx.s.start).line, (None if localctx.s is None else localctx.s.start).column, (None if localctx.t is None else localctx.t.start).line, (None if localctx.t is None else localctx.t.start).column, (None if localctx.s is None else self._input.getText((localctx.s.start,localctx.s.stop))), (None if localctx.t is None else self._input.getText((localctx.t.start,localctx.t.stop))))
+
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Init_declarator_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def init_declarator(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Init_declaratorContext)
+ else:
+ return self.getTypedRuleContext(CParser.Init_declaratorContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_init_declarator_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterInit_declarator_list" ):
+ listener.enterInit_declarator_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitInit_declarator_list" ):
+ listener.exitInit_declarator_list(self)
+
+
+
+
+ def init_declarator_list(self):
+
+ localctx = CParser.Init_declarator_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 10, self.RULE_init_declarator_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 208
+ self.init_declarator()
+ self.state = 213
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__3:
+ self.state = 209
+ self.match(CParser.T__3)
+ self.state = 210
+ self.init_declarator()
+ self.state = 215
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Init_declaratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def declarator(self):
+ return self.getTypedRuleContext(CParser.DeclaratorContext,0)
+
+
+ def initializer(self):
+ return self.getTypedRuleContext(CParser.InitializerContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_init_declarator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterInit_declarator" ):
+ listener.enterInit_declarator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitInit_declarator" ):
+ listener.exitInit_declarator(self)
+
+
+
+
+ def init_declarator(self):
+
+ localctx = CParser.Init_declaratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 12, self.RULE_init_declarator)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 216
+ self.declarator()
+ self.state = 219
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__4:
+ self.state = 217
+ self.match(CParser.T__4)
+ self.state = 218
+ self.initializer()
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Storage_class_specifierContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_storage_class_specifier
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStorage_class_specifier" ):
+ listener.enterStorage_class_specifier(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStorage_class_specifier" ):
+ listener.exitStorage_class_specifier(self)
+
+
+
+
+ def storage_class_specifier(self):
+
+ localctx = CParser.Storage_class_specifierContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 14, self.RULE_storage_class_specifier)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 221
+ _la = self._input.LA(1)
+ if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9))) != 0)):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Type_specifierContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.s = None # Struct_or_union_specifierContext
+ self.e = None # Enum_specifierContext
+
+ def struct_or_union_specifier(self):
+ return self.getTypedRuleContext(CParser.Struct_or_union_specifierContext,0)
+
+
+ def enum_specifier(self):
+ return self.getTypedRuleContext(CParser.Enum_specifierContext,0)
+
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def declarator(self):
+ return self.getTypedRuleContext(CParser.DeclaratorContext,0)
+
+
+ # @param i=None Type: int
+ def type_qualifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Type_qualifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Type_qualifierContext,i)
+
+
+ def type_id(self):
+ return self.getTypedRuleContext(CParser.Type_idContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_type_specifier
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterType_specifier" ):
+ listener.enterType_specifier(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitType_specifier" ):
+ listener.exitType_specifier(self)
+
+
+
+
+ def type_specifier(self):
+
+ localctx = CParser.Type_specifierContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 16, self.RULE_type_specifier)
+ try:
+ self.state = 247
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,16,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 223
+ self.match(CParser.T__10)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 224
+ self.match(CParser.T__11)
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 225
+ self.match(CParser.T__12)
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 226
+ self.match(CParser.T__13)
+ pass
+
+ elif la_ == 5:
+ self.enterOuterAlt(localctx, 5)
+ self.state = 227
+ self.match(CParser.T__14)
+ pass
+
+ elif la_ == 6:
+ self.enterOuterAlt(localctx, 6)
+ self.state = 228
+ self.match(CParser.T__15)
+ pass
+
+ elif la_ == 7:
+ self.enterOuterAlt(localctx, 7)
+ self.state = 229
+ self.match(CParser.T__16)
+ pass
+
+ elif la_ == 8:
+ self.enterOuterAlt(localctx, 8)
+ self.state = 230
+ self.match(CParser.T__17)
+ pass
+
+ elif la_ == 9:
+ self.enterOuterAlt(localctx, 9)
+ self.state = 231
+ self.match(CParser.T__18)
+ pass
+
+ elif la_ == 10:
+ self.enterOuterAlt(localctx, 10)
+ self.state = 232
+ localctx.s = self.struct_or_union_specifier()
+
+ if localctx.s.stop is not None:
+ self.StoreStructUnionDefinition((None if localctx.s is None else localctx.s.start).line, (None if localctx.s is None else localctx.s.start).column, (None if localctx.s is None else localctx.s.stop).line, (None if localctx.s is None else localctx.s.stop).column, (None if localctx.s is None else self._input.getText((localctx.s.start,localctx.s.stop))))
+
+ pass
+
+ elif la_ == 11:
+ self.enterOuterAlt(localctx, 11)
+ self.state = 235
+ localctx.e = self.enum_specifier()
+
+ if localctx.e.stop is not None:
+ self.StoreEnumerationDefinition((None if localctx.e is None else localctx.e.start).line, (None if localctx.e is None else localctx.e.start).column, (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is None else localctx.e.stop).column, (None if localctx.e is None else self._input.getText((localctx.e.start,localctx.e.stop))))
+
+ pass
+
+ elif la_ == 12:
+ self.enterOuterAlt(localctx, 12)
+ self.state = 238
+ self.match(CParser.IDENTIFIER)
+ self.state = 242
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,15,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 239
+ self.type_qualifier()
+ self.state = 244
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,15,self._ctx)
+
+ self.state = 245
+ self.declarator()
+ pass
+
+ elif la_ == 13:
+ self.enterOuterAlt(localctx, 13)
+ self.state = 246
+ self.type_id()
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Type_idContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def getRuleIndex(self):
+ return CParser.RULE_type_id
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterType_id" ):
+ listener.enterType_id(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitType_id" ):
+ listener.exitType_id(self)
+
+
+
+
+ def type_id(self):
+
+ localctx = CParser.Type_idContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 18, self.RULE_type_id)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 249
+ self.match(CParser.IDENTIFIER)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Struct_or_union_specifierContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def struct_or_union(self):
+ return self.getTypedRuleContext(CParser.Struct_or_unionContext,0)
+
+
+ def struct_declaration_list(self):
+ return self.getTypedRuleContext(CParser.Struct_declaration_listContext,0)
+
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def getRuleIndex(self):
+ return CParser.RULE_struct_or_union_specifier
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStruct_or_union_specifier" ):
+ listener.enterStruct_or_union_specifier(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStruct_or_union_specifier" ):
+ listener.exitStruct_or_union_specifier(self)
+
+
+
+
+ def struct_or_union_specifier(self):
+
+ localctx = CParser.Struct_or_union_specifierContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 20, self.RULE_struct_or_union_specifier)
+ self._la = 0 # Token type
+ try:
+ self.state = 262
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,18,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 251
+ self.struct_or_union()
+ self.state = 253
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.IDENTIFIER:
+ self.state = 252
+ self.match(CParser.IDENTIFIER)
+
+
+ self.state = 255
+ self.match(CParser.T__0)
+ self.state = 256
+ self.struct_declaration_list()
+ self.state = 257
+ self.match(CParser.T__19)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 259
+ self.struct_or_union()
+ self.state = 260
+ self.match(CParser.IDENTIFIER)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Struct_or_unionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_struct_or_union
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStruct_or_union" ):
+ listener.enterStruct_or_union(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStruct_or_union" ):
+ listener.exitStruct_or_union(self)
+
+
+
+
+ def struct_or_union(self):
+
+ localctx = CParser.Struct_or_unionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 22, self.RULE_struct_or_union)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 264
+ _la = self._input.LA(1)
+ if not(_la==CParser.T__20 or _la==CParser.T__21):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Struct_declaration_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def struct_declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Struct_declarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.Struct_declarationContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_struct_declaration_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStruct_declaration_list" ):
+ listener.enterStruct_declaration_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStruct_declaration_list" ):
+ listener.exitStruct_declaration_list(self)
+
+
+
+
+ def struct_declaration_list(self):
+
+ localctx = CParser.Struct_declaration_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 24, self.RULE_struct_declaration_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 267
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while True:
+ self.state = 266
+ self.struct_declaration()
+ self.state = 269
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36))) != 0) or _la==CParser.IDENTIFIER):
+ break
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Struct_declarationContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def specifier_qualifier_list(self):
+ return self.getTypedRuleContext(CParser.Specifier_qualifier_listContext,0)
+
+
+ def struct_declarator_list(self):
+ return self.getTypedRuleContext(CParser.Struct_declarator_listContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_struct_declaration
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStruct_declaration" ):
+ listener.enterStruct_declaration(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStruct_declaration" ):
+ listener.exitStruct_declaration(self)
+
+
+
+
+ def struct_declaration(self):
+
+ localctx = CParser.Struct_declarationContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 26, self.RULE_struct_declaration)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 271
+ self.specifier_qualifier_list()
+ self.state = 272
+ self.struct_declarator_list()
+ self.state = 273
+ self.match(CParser.T__1)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Specifier_qualifier_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def type_qualifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Type_qualifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Type_qualifierContext,i)
+
+
+ # @param i=None Type: int
+ def type_specifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Type_specifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Type_specifierContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_specifier_qualifier_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterSpecifier_qualifier_list" ):
+ listener.enterSpecifier_qualifier_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitSpecifier_qualifier_list" ):
+ listener.exitSpecifier_qualifier_list(self)
+
+
+
+
+ def specifier_qualifier_list(self):
+
+ localctx = CParser.Specifier_qualifier_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 28, self.RULE_specifier_qualifier_list)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 277
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 277
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__24, CParser.T__25, CParser.T__26, CParser.T__27, CParser.T__28, CParser.T__29, CParser.T__30, CParser.T__31, CParser.T__32, CParser.T__33, CParser.T__34, CParser.T__35, CParser.T__36]:
+ self.state = 275
+ self.type_qualifier()
+ pass
+ elif token in [CParser.T__10, CParser.T__11, CParser.T__12, CParser.T__13, CParser.T__14, CParser.T__15, CParser.T__16, CParser.T__17, CParser.T__18, CParser.T__20, CParser.T__21, CParser.T__23, CParser.IDENTIFIER]:
+ self.state = 276
+ self.type_specifier()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 279
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,21,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Struct_declarator_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def struct_declarator(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Struct_declaratorContext)
+ else:
+ return self.getTypedRuleContext(CParser.Struct_declaratorContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_struct_declarator_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStruct_declarator_list" ):
+ listener.enterStruct_declarator_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStruct_declarator_list" ):
+ listener.exitStruct_declarator_list(self)
+
+
+
+
+ def struct_declarator_list(self):
+
+ localctx = CParser.Struct_declarator_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 30, self.RULE_struct_declarator_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 281
+ self.struct_declarator()
+ self.state = 286
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__3:
+ self.state = 282
+ self.match(CParser.T__3)
+ self.state = 283
+ self.struct_declarator()
+ self.state = 288
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Struct_declaratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def declarator(self):
+ return self.getTypedRuleContext(CParser.DeclaratorContext,0)
+
+
+ def constant_expression(self):
+ return self.getTypedRuleContext(CParser.Constant_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_struct_declarator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStruct_declarator" ):
+ listener.enterStruct_declarator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStruct_declarator" ):
+ listener.exitStruct_declarator(self)
+
+
+
+
+ def struct_declarator(self):
+
+ localctx = CParser.Struct_declaratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 32, self.RULE_struct_declarator)
+ self._la = 0 # Token type
+ try:
+ self.state = 296
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__33, CParser.T__34, CParser.T__35, CParser.T__37, CParser.T__41, CParser.IDENTIFIER]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 289
+ self.declarator()
+ self.state = 292
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__22:
+ self.state = 290
+ self.match(CParser.T__22)
+ self.state = 291
+ self.constant_expression()
+
+
+ pass
+ elif token in [CParser.T__22]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 294
+ self.match(CParser.T__22)
+ self.state = 295
+ self.constant_expression()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Enum_specifierContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def enumerator_list(self):
+ return self.getTypedRuleContext(CParser.Enumerator_listContext,0)
+
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def getRuleIndex(self):
+ return CParser.RULE_enum_specifier
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterEnum_specifier" ):
+ listener.enterEnum_specifier(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitEnum_specifier" ):
+ listener.exitEnum_specifier(self)
+
+
+
+
+ def enum_specifier(self):
+
+ localctx = CParser.Enum_specifierContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 34, self.RULE_enum_specifier)
+ self._la = 0 # Token type
+ try:
+ self.state = 317
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,27,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 298
+ self.match(CParser.T__23)
+ self.state = 299
+ self.match(CParser.T__0)
+ self.state = 300
+ self.enumerator_list()
+ self.state = 302
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__3:
+ self.state = 301
+ self.match(CParser.T__3)
+
+
+ self.state = 304
+ self.match(CParser.T__19)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 306
+ self.match(CParser.T__23)
+ self.state = 307
+ self.match(CParser.IDENTIFIER)
+ self.state = 308
+ self.match(CParser.T__0)
+ self.state = 309
+ self.enumerator_list()
+ self.state = 311
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__3:
+ self.state = 310
+ self.match(CParser.T__3)
+
+
+ self.state = 313
+ self.match(CParser.T__19)
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 315
+ self.match(CParser.T__23)
+ self.state = 316
+ self.match(CParser.IDENTIFIER)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Enumerator_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def enumerator(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.EnumeratorContext)
+ else:
+ return self.getTypedRuleContext(CParser.EnumeratorContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_enumerator_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterEnumerator_list" ):
+ listener.enterEnumerator_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitEnumerator_list" ):
+ listener.exitEnumerator_list(self)
+
+
+
+
+ def enumerator_list(self):
+
+ localctx = CParser.Enumerator_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 36, self.RULE_enumerator_list)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 319
+ self.enumerator()
+ self.state = 324
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,28,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 320
+ self.match(CParser.T__3)
+ self.state = 321
+ self.enumerator()
+ self.state = 326
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,28,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class EnumeratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def constant_expression(self):
+ return self.getTypedRuleContext(CParser.Constant_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_enumerator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterEnumerator" ):
+ listener.enterEnumerator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitEnumerator" ):
+ listener.exitEnumerator(self)
+
+
+
+
+ def enumerator(self):
+
+ localctx = CParser.EnumeratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 38, self.RULE_enumerator)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 327
+ self.match(CParser.IDENTIFIER)
+ self.state = 330
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__4:
+ self.state = 328
+ self.match(CParser.T__4)
+ self.state = 329
+ self.constant_expression()
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Type_qualifierContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_type_qualifier
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterType_qualifier" ):
+ listener.enterType_qualifier(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitType_qualifier" ):
+ listener.exitType_qualifier(self)
+
+
+
+
+ def type_qualifier(self):
+
+ localctx = CParser.Type_qualifierContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 40, self.RULE_type_qualifier)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 332
+ _la = self._input.LA(1)
+ if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36))) != 0)):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class DeclaratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def direct_declarator(self):
+ return self.getTypedRuleContext(CParser.Direct_declaratorContext,0)
+
+
+ def pointer(self):
+ return self.getTypedRuleContext(CParser.PointerContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_declarator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterDeclarator" ):
+ listener.enterDeclarator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitDeclarator" ):
+ listener.exitDeclarator(self)
+
+
+
+
+ def declarator(self):
+
+ localctx = CParser.DeclaratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 42, self.RULE_declarator)
+ self._la = 0 # Token type
+ try:
+ self.state = 348
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,34,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 335
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__41:
+ self.state = 334
+ self.pointer()
+
+
+ self.state = 338
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__33:
+ self.state = 337
+ self.match(CParser.T__33)
+
+
+ self.state = 341
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__34:
+ self.state = 340
+ self.match(CParser.T__34)
+
+
+ self.state = 344
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__35:
+ self.state = 343
+ self.match(CParser.T__35)
+
+
+ self.state = 346
+ self.direct_declarator()
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 347
+ self.pointer()
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Direct_declaratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ # @param i=None Type: int
+ def declarator_suffix(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Declarator_suffixContext)
+ else:
+ return self.getTypedRuleContext(CParser.Declarator_suffixContext,i)
+
+
+ def declarator(self):
+ return self.getTypedRuleContext(CParser.DeclaratorContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_direct_declarator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterDirect_declarator" ):
+ listener.enterDirect_declarator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitDirect_declarator" ):
+ listener.exitDirect_declarator(self)
+
+
+
+
+ def direct_declarator(self):
+
+ localctx = CParser.Direct_declaratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 44, self.RULE_direct_declarator)
+ try:
+ self.state = 368
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.IDENTIFIER]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 350
+ self.match(CParser.IDENTIFIER)
+ self.state = 354
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,35,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 351
+ self.declarator_suffix()
+ self.state = 356
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,35,self._ctx)
+
+ pass
+ elif token in [CParser.T__37]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 357
+ self.match(CParser.T__37)
+ self.state = 359
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,36,self._ctx)
+ if la_ == 1:
+ self.state = 358
+ self.match(CParser.T__33)
+
+
+ self.state = 361
+ self.declarator()
+ self.state = 362
+ self.match(CParser.T__38)
+ self.state = 364
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 363
+ self.declarator_suffix()
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 366
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,37,self._ctx)
+
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Declarator_suffixContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def constant_expression(self):
+ return self.getTypedRuleContext(CParser.Constant_expressionContext,0)
+
+
+ def parameter_type_list(self):
+ return self.getTypedRuleContext(CParser.Parameter_type_listContext,0)
+
+
+ def identifier_list(self):
+ return self.getTypedRuleContext(CParser.Identifier_listContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_declarator_suffix
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterDeclarator_suffix" ):
+ listener.enterDeclarator_suffix(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitDeclarator_suffix" ):
+ listener.exitDeclarator_suffix(self)
+
+
+
+
+ def declarator_suffix(self):
+
+ localctx = CParser.Declarator_suffixContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 46, self.RULE_declarator_suffix)
+ try:
+ self.state = 386
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,39,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 370
+ self.match(CParser.T__39)
+ self.state = 371
+ self.constant_expression()
+ self.state = 372
+ self.match(CParser.T__40)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 374
+ self.match(CParser.T__39)
+ self.state = 375
+ self.match(CParser.T__40)
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 376
+ self.match(CParser.T__37)
+ self.state = 377
+ self.parameter_type_list()
+ self.state = 378
+ self.match(CParser.T__38)
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 380
+ self.match(CParser.T__37)
+ self.state = 381
+ self.identifier_list()
+ self.state = 382
+ self.match(CParser.T__38)
+ pass
+
+ elif la_ == 5:
+ self.enterOuterAlt(localctx, 5)
+ self.state = 384
+ self.match(CParser.T__37)
+ self.state = 385
+ self.match(CParser.T__38)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class PointerContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def type_qualifier(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Type_qualifierContext)
+ else:
+ return self.getTypedRuleContext(CParser.Type_qualifierContext,i)
+
+
+ def pointer(self):
+ return self.getTypedRuleContext(CParser.PointerContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_pointer
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterPointer" ):
+ listener.enterPointer(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitPointer" ):
+ listener.exitPointer(self)
+
+
+
+
+ def pointer(self):
+
+ localctx = CParser.PointerContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 48, self.RULE_pointer)
+ try:
+ self.state = 400
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,42,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 388
+ self.match(CParser.T__41)
+ self.state = 390
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 389
+ self.type_qualifier()
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 392
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,40,self._ctx)
+
+ self.state = 395
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,41,self._ctx)
+ if la_ == 1:
+ self.state = 394
+ self.pointer()
+
+
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 397
+ self.match(CParser.T__41)
+ self.state = 398
+ self.pointer()
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 399
+ self.match(CParser.T__41)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Parameter_type_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def parameter_list(self):
+ return self.getTypedRuleContext(CParser.Parameter_listContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_parameter_type_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterParameter_type_list" ):
+ listener.enterParameter_type_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitParameter_type_list" ):
+ listener.exitParameter_type_list(self)
+
+
+
+
+ def parameter_type_list(self):
+
+ localctx = CParser.Parameter_type_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 50, self.RULE_parameter_type_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 402
+ self.parameter_list()
+ self.state = 408
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__3:
+ self.state = 403
+ self.match(CParser.T__3)
+ self.state = 405
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__28:
+ self.state = 404
+ self.match(CParser.T__28)
+
+
+ self.state = 407
+ self.match(CParser.T__42)
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Parameter_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def parameter_declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Parameter_declarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.Parameter_declarationContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_parameter_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterParameter_list" ):
+ listener.enterParameter_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitParameter_list" ):
+ listener.exitParameter_list(self)
+
+
+
+
+ def parameter_list(self):
+
+ localctx = CParser.Parameter_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 52, self.RULE_parameter_list)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 410
+ self.parameter_declaration()
+ self.state = 418
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,46,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 411
+ self.match(CParser.T__3)
+ self.state = 413
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,45,self._ctx)
+ if la_ == 1:
+ self.state = 412
+ self.match(CParser.T__28)
+
+
+ self.state = 415
+ self.parameter_declaration()
+ self.state = 420
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,46,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Parameter_declarationContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def declaration_specifiers(self):
+ return self.getTypedRuleContext(CParser.Declaration_specifiersContext,0)
+
+
+ # @param i=None Type: int
+ def declarator(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.DeclaratorContext)
+ else:
+ return self.getTypedRuleContext(CParser.DeclaratorContext,i)
+
+
+ # @param i=None Type: int
+ def abstract_declarator(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Abstract_declaratorContext)
+ else:
+ return self.getTypedRuleContext(CParser.Abstract_declaratorContext,i)
+
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ # @param i=None Type: int
+ def pointer(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.PointerContext)
+ else:
+ return self.getTypedRuleContext(CParser.PointerContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_parameter_declaration
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterParameter_declaration" ):
+ listener.enterParameter_declaration(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitParameter_declaration" ):
+ listener.exitParameter_declaration(self)
+
+
+
+
+ def parameter_declaration(self):
+
+ localctx = CParser.Parameter_declarationContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 54, self.RULE_parameter_declaration)
+ self._la = 0 # Token type
+ try:
+ self.state = 439
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,51,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 421
+ self.declaration_specifiers()
+ self.state = 426
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while ((((_la - 34)) & ~0x3f) == 0 and ((1 << (_la - 34)) & ((1 << (CParser.T__33 - 34)) | (1 << (CParser.T__34 - 34)) | (1 << (CParser.T__35 - 34)) | (1 << (CParser.T__37 - 34)) | (1 << (CParser.T__39 - 34)) | (1 << (CParser.T__41 - 34)) | (1 << (CParser.IDENTIFIER - 34)))) != 0):
+ self.state = 424
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,47,self._ctx)
+ if la_ == 1:
+ self.state = 422
+ self.declarator()
+ pass
+
+ elif la_ == 2:
+ self.state = 423
+ self.abstract_declarator()
+ pass
+
+
+ self.state = 428
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 430
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__28:
+ self.state = 429
+ self.match(CParser.T__28)
+
+
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 435
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__41:
+ self.state = 432
+ self.pointer()
+ self.state = 437
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 438
+ self.match(CParser.IDENTIFIER)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Identifier_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def IDENTIFIER(self,i=None):
+ if i is None:
+ return self.getTokens(CParser.IDENTIFIER)
+ else:
+ return self.getToken(CParser.IDENTIFIER, i)
+
+ def getRuleIndex(self):
+ return CParser.RULE_identifier_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterIdentifier_list" ):
+ listener.enterIdentifier_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitIdentifier_list" ):
+ listener.exitIdentifier_list(self)
+
+
+
+
+ def identifier_list(self):
+
+ localctx = CParser.Identifier_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 56, self.RULE_identifier_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 441
+ self.match(CParser.IDENTIFIER)
+ self.state = 446
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__3:
+ self.state = 442
+ self.match(CParser.T__3)
+ self.state = 443
+ self.match(CParser.IDENTIFIER)
+ self.state = 448
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Type_nameContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def specifier_qualifier_list(self):
+ return self.getTypedRuleContext(CParser.Specifier_qualifier_listContext,0)
+
+
+ def abstract_declarator(self):
+ return self.getTypedRuleContext(CParser.Abstract_declaratorContext,0)
+
+
+ def type_id(self):
+ return self.getTypedRuleContext(CParser.Type_idContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_type_name
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterType_name" ):
+ listener.enterType_name(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitType_name" ):
+ listener.exitType_name(self)
+
+
+
+
+ def type_name(self):
+
+ localctx = CParser.Type_nameContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 58, self.RULE_type_name)
+ self._la = 0 # Token type
+ try:
+ self.state = 454
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,54,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 449
+ self.specifier_qualifier_list()
+ self.state = 451
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__37) | (1 << CParser.T__39) | (1 << CParser.T__41))) != 0):
+ self.state = 450
+ self.abstract_declarator()
+
+
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 453
+ self.type_id()
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Abstract_declaratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def pointer(self):
+ return self.getTypedRuleContext(CParser.PointerContext,0)
+
+
+ def direct_abstract_declarator(self):
+ return self.getTypedRuleContext(CParser.Direct_abstract_declaratorContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_abstract_declarator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAbstract_declarator" ):
+ listener.enterAbstract_declarator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAbstract_declarator" ):
+ listener.exitAbstract_declarator(self)
+
+
+
+
+ def abstract_declarator(self):
+
+ localctx = CParser.Abstract_declaratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 60, self.RULE_abstract_declarator)
+ try:
+ self.state = 461
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__41]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 456
+ self.pointer()
+ self.state = 458
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,55,self._ctx)
+ if la_ == 1:
+ self.state = 457
+ self.direct_abstract_declarator()
+
+
+ pass
+ elif token in [CParser.T__37, CParser.T__39]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 460
+ self.direct_abstract_declarator()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Direct_abstract_declaratorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def abstract_declarator(self):
+ return self.getTypedRuleContext(CParser.Abstract_declaratorContext,0)
+
+
+ # @param i=None Type: int
+ def abstract_declarator_suffix(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Abstract_declarator_suffixContext)
+ else:
+ return self.getTypedRuleContext(CParser.Abstract_declarator_suffixContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_direct_abstract_declarator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterDirect_abstract_declarator" ):
+ listener.enterDirect_abstract_declarator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitDirect_abstract_declarator" ):
+ listener.exitDirect_abstract_declarator(self)
+
+
+
+ def direct_abstract_declarator(self):
+
+ localctx = CParser.Direct_abstract_declaratorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 62, self.RULE_direct_abstract_declarator)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 468
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,57,self._ctx)
+ if la_ == 1:
+ self.state = 463
+ self.match(CParser.T__37)
+ self.state = 464
+ self.abstract_declarator()
+ self.state = 465
+ self.match(CParser.T__38)
+ pass
+
+ elif la_ == 2:
+ self.state = 467
+ self.abstract_declarator_suffix()
+ pass
+
+
+ self.state = 473
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,58,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 470
+ self.abstract_declarator_suffix()
+ self.state = 475
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,58,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Abstract_declarator_suffixContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def constant_expression(self):
+ return self.getTypedRuleContext(CParser.Constant_expressionContext,0)
+
+
+ def parameter_type_list(self):
+ return self.getTypedRuleContext(CParser.Parameter_type_listContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_abstract_declarator_suffix
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAbstract_declarator_suffix" ):
+ listener.enterAbstract_declarator_suffix(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAbstract_declarator_suffix" ):
+ listener.exitAbstract_declarator_suffix(self)
+
+
+
+
+ def abstract_declarator_suffix(self):
+
+ localctx = CParser.Abstract_declarator_suffixContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 64, self.RULE_abstract_declarator_suffix)
+ try:
+ self.state = 488
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,59,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 476
+ self.match(CParser.T__39)
+ self.state = 477
+ self.match(CParser.T__40)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 478
+ self.match(CParser.T__39)
+ self.state = 479
+ self.constant_expression()
+ self.state = 480
+ self.match(CParser.T__40)
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 482
+ self.match(CParser.T__37)
+ self.state = 483
+ self.match(CParser.T__38)
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 484
+ self.match(CParser.T__37)
+ self.state = 485
+ self.parameter_type_list()
+ self.state = 486
+ self.match(CParser.T__38)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class InitializerContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def assignment_expression(self):
+ return self.getTypedRuleContext(CParser.Assignment_expressionContext,0)
+
+
+ def initializer_list(self):
+ return self.getTypedRuleContext(CParser.Initializer_listContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_initializer
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterInitializer" ):
+ listener.enterInitializer(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitInitializer" ):
+ listener.exitInitializer(self)
+
+
+
+
+ def initializer(self):
+
+ localctx = CParser.InitializerContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 66, self.RULE_initializer)
+ self._la = 0 # Token type
+ try:
+ self.state = 498
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__37, CParser.T__41, CParser.T__43, CParser.T__44, CParser.T__47, CParser.T__48, CParser.T__49, CParser.T__52, CParser.T__53, CParser.T__54, CParser.IDENTIFIER, CParser.CHARACTER_LITERAL, CParser.STRING_LITERAL, CParser.HEX_LITERAL, CParser.DECIMAL_LITERAL, CParser.OCTAL_LITERAL, CParser.FLOATING_POINT_LITERAL]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 490
+ self.assignment_expression()
+ pass
+ elif token in [CParser.T__0]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 491
+ self.match(CParser.T__0)
+ self.state = 492
+ self.initializer_list()
+ self.state = 494
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__3:
+ self.state = 493
+ self.match(CParser.T__3)
+
+
+ self.state = 496
+ self.match(CParser.T__19)
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Initializer_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def initializer(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.InitializerContext)
+ else:
+ return self.getTypedRuleContext(CParser.InitializerContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_initializer_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterInitializer_list" ):
+ listener.enterInitializer_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitInitializer_list" ):
+ listener.exitInitializer_list(self)
+
+
+
+
+ def initializer_list(self):
+
+ localctx = CParser.Initializer_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 68, self.RULE_initializer_list)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 500
+ self.initializer()
+ self.state = 505
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,62,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 501
+ self.match(CParser.T__3)
+ self.state = 502
+ self.initializer()
+ self.state = 507
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,62,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Argument_expression_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def assignment_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Assignment_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Assignment_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_argument_expression_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterArgument_expression_list" ):
+ listener.enterArgument_expression_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitArgument_expression_list" ):
+ listener.exitArgument_expression_list(self)
+
+
+
+
+ def argument_expression_list(self):
+
+ localctx = CParser.Argument_expression_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 70, self.RULE_argument_expression_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 508
+ self.assignment_expression()
+ self.state = 510
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__28:
+ self.state = 509
+ self.match(CParser.T__28)
+
+
+ self.state = 519
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__3:
+ self.state = 512
+ self.match(CParser.T__3)
+ self.state = 513
+ self.assignment_expression()
+ self.state = 515
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__28:
+ self.state = 514
+ self.match(CParser.T__28)
+
+
+ self.state = 521
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Additive_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def multiplicative_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Multiplicative_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Multiplicative_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_additive_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAdditive_expression" ):
+ listener.enterAdditive_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAdditive_expression" ):
+ listener.exitAdditive_expression(self)
+
+
+
+
+ def additive_expression(self):
+
+ localctx = CParser.Additive_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 72, self.RULE_additive_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 522
+ self.multiplicative_expression()
+ self.state = 529
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__43 or _la==CParser.T__44:
+ self.state = 527
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__43]:
+ self.state = 523
+ self.match(CParser.T__43)
+ self.state = 524
+ self.multiplicative_expression()
+ pass
+ elif token in [CParser.T__44]:
+ self.state = 525
+ self.match(CParser.T__44)
+ self.state = 526
+ self.multiplicative_expression()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ self.state = 531
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Multiplicative_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def cast_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Cast_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Cast_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_multiplicative_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterMultiplicative_expression" ):
+ listener.enterMultiplicative_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitMultiplicative_expression" ):
+ listener.exitMultiplicative_expression(self)
+
+
+
+
+ def multiplicative_expression(self):
+
+ localctx = CParser.Multiplicative_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 74, self.RULE_multiplicative_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 532
+ self.cast_expression()
+ self.state = 541
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__41) | (1 << CParser.T__45) | (1 << CParser.T__46))) != 0):
+ self.state = 539
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__41]:
+ self.state = 533
+ self.match(CParser.T__41)
+ self.state = 534
+ self.cast_expression()
+ pass
+ elif token in [CParser.T__45]:
+ self.state = 535
+ self.match(CParser.T__45)
+ self.state = 536
+ self.cast_expression()
+ pass
+ elif token in [CParser.T__46]:
+ self.state = 537
+ self.match(CParser.T__46)
+ self.state = 538
+ self.cast_expression()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ self.state = 543
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Cast_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def type_name(self):
+ return self.getTypedRuleContext(CParser.Type_nameContext,0)
+
+
+ def cast_expression(self):
+ return self.getTypedRuleContext(CParser.Cast_expressionContext,0)
+
+
+ def unary_expression(self):
+ return self.getTypedRuleContext(CParser.Unary_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_cast_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterCast_expression" ):
+ listener.enterCast_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitCast_expression" ):
+ listener.exitCast_expression(self)
+
+
+
+
+ def cast_expression(self):
+
+ localctx = CParser.Cast_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 76, self.RULE_cast_expression)
+ try:
+ self.state = 550
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,70,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 544
+ self.match(CParser.T__37)
+ self.state = 545
+ self.type_name()
+ self.state = 546
+ self.match(CParser.T__38)
+ self.state = 547
+ self.cast_expression()
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 549
+ self.unary_expression()
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Unary_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def postfix_expression(self):
+ return self.getTypedRuleContext(CParser.Postfix_expressionContext,0)
+
+
+ def unary_expression(self):
+ return self.getTypedRuleContext(CParser.Unary_expressionContext,0)
+
+
+ def unary_operator(self):
+ return self.getTypedRuleContext(CParser.Unary_operatorContext,0)
+
+
+ def cast_expression(self):
+ return self.getTypedRuleContext(CParser.Cast_expressionContext,0)
+
+
+ def type_name(self):
+ return self.getTypedRuleContext(CParser.Type_nameContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_unary_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterUnary_expression" ):
+ listener.enterUnary_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitUnary_expression" ):
+ listener.exitUnary_expression(self)
+
+
+
+
+ def unary_expression(self):
+
+ localctx = CParser.Unary_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 78, self.RULE_unary_expression)
+ try:
+ self.state = 567
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,71,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 552
+ self.postfix_expression()
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 553
+ self.match(CParser.T__47)
+ self.state = 554
+ self.unary_expression()
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 555
+ self.match(CParser.T__48)
+ self.state = 556
+ self.unary_expression()
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 557
+ self.unary_operator()
+ self.state = 558
+ self.cast_expression()
+ pass
+
+ elif la_ == 5:
+ self.enterOuterAlt(localctx, 5)
+ self.state = 560
+ self.match(CParser.T__49)
+ self.state = 561
+ self.unary_expression()
+ pass
+
+ elif la_ == 6:
+ self.enterOuterAlt(localctx, 6)
+ self.state = 562
+ self.match(CParser.T__49)
+ self.state = 563
+ self.match(CParser.T__37)
+ self.state = 564
+ self.type_name()
+ self.state = 565
+ self.match(CParser.T__38)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Postfix_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.FuncCallText = ''
+ self.p = None # Primary_expressionContext
+ self.a = None # Token
+ self.c = None # Argument_expression_listContext
+ self.b = None # Token
+ self.x = None # Token
+ self.y = None # Token
+ self.z = None # Token
+
+ def primary_expression(self):
+ return self.getTypedRuleContext(CParser.Primary_expressionContext,0)
+
+
+ # @param i=None Type: int
+ def expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.ExpressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.ExpressionContext,i)
+
+
+ # @param i=None Type: int
+ def macro_parameter_list(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Macro_parameter_listContext)
+ else:
+ return self.getTypedRuleContext(CParser.Macro_parameter_listContext,i)
+
+
+ # @param i=None Type: int
+ def argument_expression_list(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Argument_expression_listContext)
+ else:
+ return self.getTypedRuleContext(CParser.Argument_expression_listContext,i)
+
+
+ # @param i=None Type: int
+ def IDENTIFIER(self,i=None):
+ if i is None:
+ return self.getTokens(CParser.IDENTIFIER)
+ else:
+ return self.getToken(CParser.IDENTIFIER, i)
+
+ def getRuleIndex(self):
+ return CParser.RULE_postfix_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterPostfix_expression" ):
+ listener.enterPostfix_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitPostfix_expression" ):
+ listener.exitPostfix_expression(self)
+
+
+
+
+ def postfix_expression(self):
+
+ localctx = CParser.Postfix_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 80, self.RULE_postfix_expression)
+
+ self.FuncCallText=''
+
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 569
+ localctx.p = self.primary_expression()
+ self.FuncCallText += (None if localctx.p is None else self._input.getText((localctx.p.start,localctx.p.stop)))
+ self.state = 600
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,73,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 598
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,72,self._ctx)
+ if la_ == 1:
+ self.state = 571
+ self.match(CParser.T__39)
+ self.state = 572
+ self.expression()
+ self.state = 573
+ self.match(CParser.T__40)
+ pass
+
+ elif la_ == 2:
+ self.state = 575
+ self.match(CParser.T__37)
+ self.state = 576
+ localctx.a = self.match(CParser.T__38)
+ self.StoreFunctionCalling((None if localctx.p is None else localctx.p.start).line, (None if localctx.p is None else localctx.p.start).column, (0 if localctx.a is None else localctx.a.line), localctx.a.column, self.FuncCallText, '')
+ pass
+
+ elif la_ == 3:
+ self.state = 578
+ self.match(CParser.T__37)
+ self.state = 579
+ localctx.c = self.argument_expression_list()
+ self.state = 580
+ localctx.b = self.match(CParser.T__38)
+ self.StoreFunctionCalling((None if localctx.p is None else localctx.p.start).line, (None if localctx.p is None else localctx.p.start).column, (0 if localctx.b is None else localctx.b.line), localctx.b.column, self.FuncCallText, (None if localctx.c is None else self._input.getText((localctx.c.start,localctx.c.stop))))
+ pass
+
+ elif la_ == 4:
+ self.state = 583
+ self.match(CParser.T__37)
+ self.state = 584
+ self.macro_parameter_list()
+ self.state = 585
+ self.match(CParser.T__38)
+ pass
+
+ elif la_ == 5:
+ self.state = 587
+ self.match(CParser.T__50)
+ self.state = 588
+ localctx.x = self.match(CParser.IDENTIFIER)
+ self.FuncCallText += '.' + (None if localctx.x is None else localctx.x.text)
+ pass
+
+ elif la_ == 6:
+ self.state = 590
+ self.match(CParser.T__41)
+ self.state = 591
+ localctx.y = self.match(CParser.IDENTIFIER)
+ self.FuncCallText = (None if localctx.y is None else localctx.y.text)
+ pass
+
+ elif la_ == 7:
+ self.state = 593
+ self.match(CParser.T__51)
+ self.state = 594
+ localctx.z = self.match(CParser.IDENTIFIER)
+ self.FuncCallText += '->' + (None if localctx.z is None else localctx.z.text)
+ pass
+
+ elif la_ == 8:
+ self.state = 596
+ self.match(CParser.T__47)
+ pass
+
+ elif la_ == 9:
+ self.state = 597
+ self.match(CParser.T__48)
+ pass
+
+
+ self.state = 602
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,73,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Macro_parameter_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def parameter_declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Parameter_declarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.Parameter_declarationContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_macro_parameter_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterMacro_parameter_list" ):
+ listener.enterMacro_parameter_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitMacro_parameter_list" ):
+ listener.exitMacro_parameter_list(self)
+
+
+
+
+ def macro_parameter_list(self):
+
+ localctx = CParser.Macro_parameter_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 82, self.RULE_macro_parameter_list)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 603
+ self.parameter_declaration()
+ self.state = 608
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__3:
+ self.state = 604
+ self.match(CParser.T__3)
+ self.state = 605
+ self.parameter_declaration()
+ self.state = 610
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Unary_operatorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_unary_operator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterUnary_operator" ):
+ listener.enterUnary_operator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitUnary_operator" ):
+ listener.exitUnary_operator(self)
+
+
+
+
+ def unary_operator(self):
+
+ localctx = CParser.Unary_operatorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 84, self.RULE_unary_operator)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 611
+ _la = self._input.LA(1)
+ if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__41) | (1 << CParser.T__43) | (1 << CParser.T__44) | (1 << CParser.T__52) | (1 << CParser.T__53) | (1 << CParser.T__54))) != 0)):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Primary_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def constant(self):
+ return self.getTypedRuleContext(CParser.ConstantContext,0)
+
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_primary_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterPrimary_expression" ):
+ listener.enterPrimary_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitPrimary_expression" ):
+ listener.exitPrimary_expression(self)
+
+
+
+
+ def primary_expression(self):
+
+ localctx = CParser.Primary_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 86, self.RULE_primary_expression)
+ try:
+ self.state = 619
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,75,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 613
+ self.match(CParser.IDENTIFIER)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 614
+ self.constant()
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 615
+ self.match(CParser.T__37)
+ self.state = 616
+ self.expression()
+ self.state = 617
+ self.match(CParser.T__38)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class ConstantContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def HEX_LITERAL(self):
+ return self.getToken(CParser.HEX_LITERAL, 0)
+
+ def OCTAL_LITERAL(self):
+ return self.getToken(CParser.OCTAL_LITERAL, 0)
+
+ def DECIMAL_LITERAL(self):
+ return self.getToken(CParser.DECIMAL_LITERAL, 0)
+
+ def CHARACTER_LITERAL(self):
+ return self.getToken(CParser.CHARACTER_LITERAL, 0)
+
+ # @param i=None Type: int
+ def IDENTIFIER(self,i=None):
+ if i is None:
+ return self.getTokens(CParser.IDENTIFIER)
+ else:
+ return self.getToken(CParser.IDENTIFIER, i)
+
+ # @param i=None Type: int
+ def STRING_LITERAL(self,i=None):
+ if i is None:
+ return self.getTokens(CParser.STRING_LITERAL)
+ else:
+ return self.getToken(CParser.STRING_LITERAL, i)
+
+ def FLOATING_POINT_LITERAL(self):
+ return self.getToken(CParser.FLOATING_POINT_LITERAL, 0)
+
+ def getRuleIndex(self):
+ return CParser.RULE_constant
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterConstant" ):
+ listener.enterConstant(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitConstant" ):
+ listener.exitConstant(self)
+
+
+
+
+ def constant(self):
+
+ localctx = CParser.ConstantContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 88, self.RULE_constant)
+ self._la = 0 # Token type
+ try:
+ self.state = 647
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.HEX_LITERAL]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 621
+ self.match(CParser.HEX_LITERAL)
+ pass
+ elif token in [CParser.OCTAL_LITERAL]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 622
+ self.match(CParser.OCTAL_LITERAL)
+ pass
+ elif token in [CParser.DECIMAL_LITERAL]:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 623
+ self.match(CParser.DECIMAL_LITERAL)
+ pass
+ elif token in [CParser.CHARACTER_LITERAL]:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 624
+ self.match(CParser.CHARACTER_LITERAL)
+ pass
+ elif token in [CParser.IDENTIFIER, CParser.STRING_LITERAL]:
+ self.enterOuterAlt(localctx, 5)
+ self.state = 636
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 628
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.IDENTIFIER:
+ self.state = 625
+ self.match(CParser.IDENTIFIER)
+ self.state = 630
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 632
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 631
+ self.match(CParser.STRING_LITERAL)
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 634
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,77,self._ctx)
+
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 638
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,78,self._ctx)
+
+ self.state = 643
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.IDENTIFIER:
+ self.state = 640
+ self.match(CParser.IDENTIFIER)
+ self.state = 645
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ pass
+ elif token in [CParser.FLOATING_POINT_LITERAL]:
+ self.enterOuterAlt(localctx, 6)
+ self.state = 646
+ self.match(CParser.FLOATING_POINT_LITERAL)
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class ExpressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def assignment_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Assignment_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Assignment_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterExpression" ):
+ listener.enterExpression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitExpression" ):
+ listener.exitExpression(self)
+
+
+
+
+ def expression(self):
+
+ localctx = CParser.ExpressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 90, self.RULE_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 649
+ self.assignment_expression()
+ self.state = 654
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__3:
+ self.state = 650
+ self.match(CParser.T__3)
+ self.state = 651
+ self.assignment_expression()
+ self.state = 656
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Constant_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def conditional_expression(self):
+ return self.getTypedRuleContext(CParser.Conditional_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_constant_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterConstant_expression" ):
+ listener.enterConstant_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitConstant_expression" ):
+ listener.exitConstant_expression(self)
+
+
+
+
+ def constant_expression(self):
+
+ localctx = CParser.Constant_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 92, self.RULE_constant_expression)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 657
+ self.conditional_expression()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Assignment_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def lvalue(self):
+ return self.getTypedRuleContext(CParser.LvalueContext,0)
+
+
+ def assignment_operator(self):
+ return self.getTypedRuleContext(CParser.Assignment_operatorContext,0)
+
+
+ def assignment_expression(self):
+ return self.getTypedRuleContext(CParser.Assignment_expressionContext,0)
+
+
+ def conditional_expression(self):
+ return self.getTypedRuleContext(CParser.Conditional_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_assignment_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAssignment_expression" ):
+ listener.enterAssignment_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAssignment_expression" ):
+ listener.exitAssignment_expression(self)
+
+
+
+
+ def assignment_expression(self):
+
+ localctx = CParser.Assignment_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 94, self.RULE_assignment_expression)
+ try:
+ self.state = 664
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,82,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 659
+ self.lvalue()
+ self.state = 660
+ self.assignment_operator()
+ self.state = 661
+ self.assignment_expression()
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 663
+ self.conditional_expression()
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class LvalueContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def unary_expression(self):
+ return self.getTypedRuleContext(CParser.Unary_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_lvalue
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterLvalue" ):
+ listener.enterLvalue(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitLvalue" ):
+ listener.exitLvalue(self)
+
+
+
+
+ def lvalue(self):
+
+ localctx = CParser.LvalueContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 96, self.RULE_lvalue)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 666
+ self.unary_expression()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Assignment_operatorContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_assignment_operator
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAssignment_operator" ):
+ listener.enterAssignment_operator(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAssignment_operator" ):
+ listener.exitAssignment_operator(self)
+
+
+
+
+ def assignment_operator(self):
+
+ localctx = CParser.Assignment_operatorContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 98, self.RULE_assignment_operator)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 668
+ _la = self._input.LA(1)
+ if not(((((_la - 5)) & ~0x3f) == 0 and ((1 << (_la - 5)) & ((1 << (CParser.T__4 - 5)) | (1 << (CParser.T__55 - 5)) | (1 << (CParser.T__56 - 5)) | (1 << (CParser.T__57 - 5)) | (1 << (CParser.T__58 - 5)) | (1 << (CParser.T__59 - 5)) | (1 << (CParser.T__60 - 5)) | (1 << (CParser.T__61 - 5)) | (1 << (CParser.T__62 - 5)) | (1 << (CParser.T__63 - 5)) | (1 << (CParser.T__64 - 5)))) != 0)):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Conditional_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.e = None # Logical_or_expressionContext
+
+ def logical_or_expression(self):
+ return self.getTypedRuleContext(CParser.Logical_or_expressionContext,0)
+
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def conditional_expression(self):
+ return self.getTypedRuleContext(CParser.Conditional_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_conditional_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterConditional_expression" ):
+ listener.enterConditional_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitConditional_expression" ):
+ listener.exitConditional_expression(self)
+
+
+
+
+ def conditional_expression(self):
+
+ localctx = CParser.Conditional_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 100, self.RULE_conditional_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 670
+ localctx.e = self.logical_or_expression()
+ self.state = 677
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__65:
+ self.state = 671
+ self.match(CParser.T__65)
+ self.state = 672
+ self.expression()
+ self.state = 673
+ self.match(CParser.T__22)
+ self.state = 674
+ self.conditional_expression()
+ self.StorePredicateExpression((None if localctx.e is None else localctx.e.start).line, (None if localctx.e is None else localctx.e.start).column, (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is None else localctx.e.stop).column, (None if localctx.e is None else self._input.getText((localctx.e.start,localctx.e.stop))))
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Logical_or_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def logical_and_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Logical_and_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Logical_and_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_logical_or_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterLogical_or_expression" ):
+ listener.enterLogical_or_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitLogical_or_expression" ):
+ listener.exitLogical_or_expression(self)
+
+
+
+
+ def logical_or_expression(self):
+
+ localctx = CParser.Logical_or_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 102, self.RULE_logical_or_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 679
+ self.logical_and_expression()
+ self.state = 684
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__66:
+ self.state = 680
+ self.match(CParser.T__66)
+ self.state = 681
+ self.logical_and_expression()
+ self.state = 686
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Logical_and_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def inclusive_or_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Inclusive_or_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Inclusive_or_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_logical_and_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterLogical_and_expression" ):
+ listener.enterLogical_and_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitLogical_and_expression" ):
+ listener.exitLogical_and_expression(self)
+
+
+
+
+ def logical_and_expression(self):
+
+ localctx = CParser.Logical_and_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 104, self.RULE_logical_and_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 687
+ self.inclusive_or_expression()
+ self.state = 692
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__67:
+ self.state = 688
+ self.match(CParser.T__67)
+ self.state = 689
+ self.inclusive_or_expression()
+ self.state = 694
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Inclusive_or_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def exclusive_or_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Exclusive_or_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Exclusive_or_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_inclusive_or_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterInclusive_or_expression" ):
+ listener.enterInclusive_or_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitInclusive_or_expression" ):
+ listener.exitInclusive_or_expression(self)
+
+
+
+
+ def inclusive_or_expression(self):
+
+ localctx = CParser.Inclusive_or_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 106, self.RULE_inclusive_or_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 695
+ self.exclusive_or_expression()
+ self.state = 700
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__68:
+ self.state = 696
+ self.match(CParser.T__68)
+ self.state = 697
+ self.exclusive_or_expression()
+ self.state = 702
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Exclusive_or_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def and_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.And_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.And_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_exclusive_or_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterExclusive_or_expression" ):
+ listener.enterExclusive_or_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitExclusive_or_expression" ):
+ listener.exitExclusive_or_expression(self)
+
+
+
+
+ def exclusive_or_expression(self):
+
+ localctx = CParser.Exclusive_or_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 108, self.RULE_exclusive_or_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 703
+ self.and_expression()
+ self.state = 708
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__69:
+ self.state = 704
+ self.match(CParser.T__69)
+ self.state = 705
+ self.and_expression()
+ self.state = 710
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class And_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def equality_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Equality_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Equality_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_and_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAnd_expression" ):
+ listener.enterAnd_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAnd_expression" ):
+ listener.exitAnd_expression(self)
+
+
+
+
+ def and_expression(self):
+
+ localctx = CParser.And_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 110, self.RULE_and_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 711
+ self.equality_expression()
+ self.state = 716
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__52:
+ self.state = 712
+ self.match(CParser.T__52)
+ self.state = 713
+ self.equality_expression()
+ self.state = 718
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Equality_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def relational_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Relational_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Relational_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_equality_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterEquality_expression" ):
+ listener.enterEquality_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitEquality_expression" ):
+ listener.exitEquality_expression(self)
+
+
+
+
+ def equality_expression(self):
+
+ localctx = CParser.Equality_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 112, self.RULE_equality_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 719
+ self.relational_expression()
+ self.state = 724
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__70 or _la==CParser.T__71:
+ self.state = 720
+ _la = self._input.LA(1)
+ if not(_la==CParser.T__70 or _la==CParser.T__71):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 721
+ self.relational_expression()
+ self.state = 726
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Relational_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def shift_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Shift_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Shift_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_relational_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterRelational_expression" ):
+ listener.enterRelational_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitRelational_expression" ):
+ listener.exitRelational_expression(self)
+
+
+
+
+ def relational_expression(self):
+
+ localctx = CParser.Relational_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 114, self.RULE_relational_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 727
+ self.shift_expression()
+ self.state = 732
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while ((((_la - 73)) & ~0x3f) == 0 and ((1 << (_la - 73)) & ((1 << (CParser.T__72 - 73)) | (1 << (CParser.T__73 - 73)) | (1 << (CParser.T__74 - 73)) | (1 << (CParser.T__75 - 73)))) != 0):
+ self.state = 728
+ _la = self._input.LA(1)
+ if not(((((_la - 73)) & ~0x3f) == 0 and ((1 << (_la - 73)) & ((1 << (CParser.T__72 - 73)) | (1 << (CParser.T__73 - 73)) | (1 << (CParser.T__74 - 73)) | (1 << (CParser.T__75 - 73)))) != 0)):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 729
+ self.shift_expression()
+ self.state = 734
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Shift_expressionContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def additive_expression(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.Additive_expressionContext)
+ else:
+ return self.getTypedRuleContext(CParser.Additive_expressionContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_shift_expression
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterShift_expression" ):
+ listener.enterShift_expression(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitShift_expression" ):
+ listener.exitShift_expression(self)
+
+
+
+
+ def shift_expression(self):
+
+ localctx = CParser.Shift_expressionContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 116, self.RULE_shift_expression)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 735
+ self.additive_expression()
+ self.state = 740
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while _la==CParser.T__76 or _la==CParser.T__77:
+ self.state = 736
+ _la = self._input.LA(1)
+ if not(_la==CParser.T__76 or _la==CParser.T__77):
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 737
+ self.additive_expression()
+ self.state = 742
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class StatementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def labeled_statement(self):
+ return self.getTypedRuleContext(CParser.Labeled_statementContext,0)
+
+
+ def compound_statement(self):
+ return self.getTypedRuleContext(CParser.Compound_statementContext,0)
+
+
+ def expression_statement(self):
+ return self.getTypedRuleContext(CParser.Expression_statementContext,0)
+
+
+ def selection_statement(self):
+ return self.getTypedRuleContext(CParser.Selection_statementContext,0)
+
+
+ def iteration_statement(self):
+ return self.getTypedRuleContext(CParser.Iteration_statementContext,0)
+
+
+ def jump_statement(self):
+ return self.getTypedRuleContext(CParser.Jump_statementContext,0)
+
+
+ def macro_statement(self):
+ return self.getTypedRuleContext(CParser.Macro_statementContext,0)
+
+
+ def asm2_statement(self):
+ return self.getTypedRuleContext(CParser.Asm2_statementContext,0)
+
+
+ def asm1_statement(self):
+ return self.getTypedRuleContext(CParser.Asm1_statementContext,0)
+
+
+ def asm_statement(self):
+ return self.getTypedRuleContext(CParser.Asm_statementContext,0)
+
+
+ def declaration(self):
+ return self.getTypedRuleContext(CParser.DeclarationContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStatement" ):
+ listener.enterStatement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStatement" ):
+ listener.exitStatement(self)
+
+
+
+
+ def statement(self):
+
+ localctx = CParser.StatementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 118, self.RULE_statement)
+ try:
+ self.state = 754
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,92,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 743
+ self.labeled_statement()
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 744
+ self.compound_statement()
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 745
+ self.expression_statement()
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 746
+ self.selection_statement()
+ pass
+
+ elif la_ == 5:
+ self.enterOuterAlt(localctx, 5)
+ self.state = 747
+ self.iteration_statement()
+ pass
+
+ elif la_ == 6:
+ self.enterOuterAlt(localctx, 6)
+ self.state = 748
+ self.jump_statement()
+ pass
+
+ elif la_ == 7:
+ self.enterOuterAlt(localctx, 7)
+ self.state = 749
+ self.macro_statement()
+ pass
+
+ elif la_ == 8:
+ self.enterOuterAlt(localctx, 8)
+ self.state = 750
+ self.asm2_statement()
+ pass
+
+ elif la_ == 9:
+ self.enterOuterAlt(localctx, 9)
+ self.state = 751
+ self.asm1_statement()
+ pass
+
+ elif la_ == 10:
+ self.enterOuterAlt(localctx, 10)
+ self.state = 752
+ self.asm_statement()
+ pass
+
+ elif la_ == 11:
+ self.enterOuterAlt(localctx, 11)
+ self.state = 753
+ self.declaration()
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Asm2_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def getRuleIndex(self):
+ return CParser.RULE_asm2_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAsm2_statement" ):
+ listener.enterAsm2_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAsm2_statement" ):
+ listener.exitAsm2_statement(self)
+
+
+
+
+ def asm2_statement(self):
+
+ localctx = CParser.Asm2_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 120, self.RULE_asm2_statement)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 757
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if _la==CParser.T__78:
+ self.state = 756
+ self.match(CParser.T__78)
+
+
+ self.state = 759
+ self.match(CParser.IDENTIFIER)
+ self.state = 760
+ self.match(CParser.T__37)
+ self.state = 764
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,94,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 761
+ _la = self._input.LA(1)
+ if _la <= 0 or _la==CParser.T__1:
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 766
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,94,self._ctx)
+
+ self.state = 767
+ self.match(CParser.T__38)
+ self.state = 768
+ self.match(CParser.T__1)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Asm1_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_asm1_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAsm1_statement" ):
+ listener.enterAsm1_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAsm1_statement" ):
+ listener.exitAsm1_statement(self)
+
+
+
+
+ def asm1_statement(self):
+
+ localctx = CParser.Asm1_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 122, self.RULE_asm1_statement)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 770
+ self.match(CParser.T__79)
+ self.state = 771
+ self.match(CParser.T__0)
+ self.state = 775
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__0) | (1 << CParser.T__1) | (1 << CParser.T__2) | (1 << CParser.T__3) | (1 << CParser.T__4) | (1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9) | (1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__22) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36) | (1 << CParser.T__37) | (1 << CParser.T__38) | (1 << CParser.T__39) | (1 << CParser.T__40) | (1 << CParser.T__41) | (1 << CParser.T__42) | (1 << CParser.T__43) | (1 << CParser.T__44) | (1 << CParser.T__45) | (1 << CParser.T__46) | (1 << CParser.T__47) | (1 << CParser.T__48) | (1 << CParser.T__49) | (1 << CParser.T__50) | (1 << CParser.T__51) | (1 << CParser.T__52) | (1 << CParser.T__53) | (1 << CParser.T__54) | (1 << CParser.T__55) | (1 << CParser.T__56) | (1 << CParser.T__57) | (1 << CParser.T__58) | (1 << CParser.T__59) | (1 << CParser.T__60) | (1 << CParser.T__61) | (1 << CParser.T__62))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (CParser.T__63 - 64)) | (1 << (CParser.T__64 - 64)) | (1 << (CParser.T__65 - 64)) | (1 << (CParser.T__66 - 64)) | (1 << (CParser.T__67 - 64)) | (1 << (CParser.T__68 - 64)) | (1 << (CParser.T__69 - 64)) | (1 << (CParser.T__70 - 64)) | (1 << (CParser.T__71 - 64)) | (1 << (CParser.T__72 - 64)) | (1 << (CParser.T__73 - 64)) | (1 << (CParser.T__74 - 64)) | (1 << (CParser.T__75 - 64)) | (1 << (CParser.T__76 - 64)) | (1 << (CParser.T__77 - 64)) | (1 << (CParser.T__78 - 64)) | (1 << (CParser.T__79 - 64)) | (1 << (CParser.T__80 - 64)) | (1 << (CParser.T__81 - 64)) | (1 << (CParser.T__82 - 64)) | (1 << (CParser.T__83 - 64)) | (1 << (CParser.T__84 - 64)) | (1 << (CParser.T__85 - 64)) | (1 << (CParser.T__86 - 64)) | (1 << (CParser.T__87 - 64)) | (1 << (CParser.T__88 - 64)) | (1 << (CParser.T__89 - 64)) | (1 << (CParser.T__90 - 64)) | (1 << (CParser.T__91 - 64)) | (1 << (CParser.IDENTIFIER - 64)) | (1 << (CParser.CHARACTER_LITERAL - 64)) | (1 << (CParser.STRING_LITERAL - 64)) | (1 << (CParser.HEX_LITERAL - 64)) | (1 << (CParser.DECIMAL_LITERAL - 64)) | (1 << (CParser.OCTAL_LITERAL - 64)) | (1 << (CParser.FLOATING_POINT_LITERAL - 64)) | (1 << (CParser.WS - 64)) | (1 << (CParser.BS - 64)) | (1 << (CParser.UnicodeVocabulary - 64)) | (1 << (CParser.COMMENT - 64)) | (1 << (CParser.LINE_COMMENT - 64)) | (1 << (CParser.LINE_COMMAND - 64)))) != 0):
+ self.state = 772
+ _la = self._input.LA(1)
+ if _la <= 0 or _la==CParser.T__19:
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 777
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 778
+ self.match(CParser.T__19)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Asm_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_asm_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterAsm_statement" ):
+ listener.enterAsm_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitAsm_statement" ):
+ listener.exitAsm_statement(self)
+
+
+
+
+ def asm_statement(self):
+
+ localctx = CParser.Asm_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 124, self.RULE_asm_statement)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 780
+ self.match(CParser.T__80)
+ self.state = 781
+ self.match(CParser.T__0)
+ self.state = 785
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__0) | (1 << CParser.T__1) | (1 << CParser.T__2) | (1 << CParser.T__3) | (1 << CParser.T__4) | (1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9) | (1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__22) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36) | (1 << CParser.T__37) | (1 << CParser.T__38) | (1 << CParser.T__39) | (1 << CParser.T__40) | (1 << CParser.T__41) | (1 << CParser.T__42) | (1 << CParser.T__43) | (1 << CParser.T__44) | (1 << CParser.T__45) | (1 << CParser.T__46) | (1 << CParser.T__47) | (1 << CParser.T__48) | (1 << CParser.T__49) | (1 << CParser.T__50) | (1 << CParser.T__51) | (1 << CParser.T__52) | (1 << CParser.T__53) | (1 << CParser.T__54) | (1 << CParser.T__55) | (1 << CParser.T__56) | (1 << CParser.T__57) | (1 << CParser.T__58) | (1 << CParser.T__59) | (1 << CParser.T__60) | (1 << CParser.T__61) | (1 << CParser.T__62))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (CParser.T__63 - 64)) | (1 << (CParser.T__64 - 64)) | (1 << (CParser.T__65 - 64)) | (1 << (CParser.T__66 - 64)) | (1 << (CParser.T__67 - 64)) | (1 << (CParser.T__68 - 64)) | (1 << (CParser.T__69 - 64)) | (1 << (CParser.T__70 - 64)) | (1 << (CParser.T__71 - 64)) | (1 << (CParser.T__72 - 64)) | (1 << (CParser.T__73 - 64)) | (1 << (CParser.T__74 - 64)) | (1 << (CParser.T__75 - 64)) | (1 << (CParser.T__76 - 64)) | (1 << (CParser.T__77 - 64)) | (1 << (CParser.T__78 - 64)) | (1 << (CParser.T__79 - 64)) | (1 << (CParser.T__80 - 64)) | (1 << (CParser.T__81 - 64)) | (1 << (CParser.T__82 - 64)) | (1 << (CParser.T__83 - 64)) | (1 << (CParser.T__84 - 64)) | (1 << (CParser.T__85 - 64)) | (1 << (CParser.T__86 - 64)) | (1 << (CParser.T__87 - 64)) | (1 << (CParser.T__88 - 64)) | (1 << (CParser.T__89 - 64)) | (1 << (CParser.T__90 - 64)) | (1 << (CParser.T__91 - 64)) | (1 << (CParser.IDENTIFIER - 64)) | (1 << (CParser.CHARACTER_LITERAL - 64)) | (1 << (CParser.STRING_LITERAL - 64)) | (1 << (CParser.HEX_LITERAL - 64)) | (1 << (CParser.DECIMAL_LITERAL - 64)) | (1 << (CParser.OCTAL_LITERAL - 64)) | (1 << (CParser.FLOATING_POINT_LITERAL - 64)) | (1 << (CParser.WS - 64)) | (1 << (CParser.BS - 64)) | (1 << (CParser.UnicodeVocabulary - 64)) | (1 << (CParser.COMMENT - 64)) | (1 << (CParser.LINE_COMMENT - 64)) | (1 << (CParser.LINE_COMMAND - 64)))) != 0):
+ self.state = 782
+ _la = self._input.LA(1)
+ if _la <= 0 or _la==CParser.T__19:
+ self._errHandler.recoverInline(self)
+ else:
+ self._errHandler.reportMatch(self)
+ self.consume()
+ self.state = 787
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+
+ self.state = 788
+ self.match(CParser.T__19)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Macro_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ # @param i=None Type: int
+ def declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.DeclarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.DeclarationContext,i)
+
+
+ def statement_list(self):
+ return self.getTypedRuleContext(CParser.Statement_listContext,0)
+
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_macro_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterMacro_statement" ):
+ listener.enterMacro_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitMacro_statement" ):
+ listener.exitMacro_statement(self)
+
+
+
+
+ def macro_statement(self):
+
+ localctx = CParser.Macro_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 126, self.RULE_macro_statement)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 790
+ self.match(CParser.IDENTIFIER)
+ self.state = 791
+ self.match(CParser.T__37)
+ self.state = 795
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,97,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 792
+ self.declaration()
+ self.state = 797
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,97,self._ctx)
+
+ self.state = 799
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,98,self._ctx)
+ if la_ == 1:
+ self.state = 798
+ self.statement_list()
+
+
+ self.state = 802
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if ((((_la - 38)) & ~0x3f) == 0 and ((1 << (_la - 38)) & ((1 << (CParser.T__37 - 38)) | (1 << (CParser.T__41 - 38)) | (1 << (CParser.T__43 - 38)) | (1 << (CParser.T__44 - 38)) | (1 << (CParser.T__47 - 38)) | (1 << (CParser.T__48 - 38)) | (1 << (CParser.T__49 - 38)) | (1 << (CParser.T__52 - 38)) | (1 << (CParser.T__53 - 38)) | (1 << (CParser.T__54 - 38)) | (1 << (CParser.IDENTIFIER - 38)) | (1 << (CParser.CHARACTER_LITERAL - 38)) | (1 << (CParser.STRING_LITERAL - 38)) | (1 << (CParser.HEX_LITERAL - 38)) | (1 << (CParser.DECIMAL_LITERAL - 38)) | (1 << (CParser.OCTAL_LITERAL - 38)) | (1 << (CParser.FLOATING_POINT_LITERAL - 38)))) != 0):
+ self.state = 801
+ self.expression()
+
+
+ self.state = 804
+ self.match(CParser.T__38)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Labeled_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def statement(self):
+ return self.getTypedRuleContext(CParser.StatementContext,0)
+
+
+ def constant_expression(self):
+ return self.getTypedRuleContext(CParser.Constant_expressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_labeled_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterLabeled_statement" ):
+ listener.enterLabeled_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitLabeled_statement" ):
+ listener.exitLabeled_statement(self)
+
+
+
+
+ def labeled_statement(self):
+
+ localctx = CParser.Labeled_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 128, self.RULE_labeled_statement)
+ try:
+ self.state = 817
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.IDENTIFIER]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 806
+ self.match(CParser.IDENTIFIER)
+ self.state = 807
+ self.match(CParser.T__22)
+ self.state = 808
+ self.statement()
+ pass
+ elif token in [CParser.T__81]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 809
+ self.match(CParser.T__81)
+ self.state = 810
+ self.constant_expression()
+ self.state = 811
+ self.match(CParser.T__22)
+ self.state = 812
+ self.statement()
+ pass
+ elif token in [CParser.T__82]:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 814
+ self.match(CParser.T__82)
+ self.state = 815
+ self.match(CParser.T__22)
+ self.state = 816
+ self.statement()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Compound_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def declaration(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.DeclarationContext)
+ else:
+ return self.getTypedRuleContext(CParser.DeclarationContext,i)
+
+
+ def statement_list(self):
+ return self.getTypedRuleContext(CParser.Statement_listContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_compound_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterCompound_statement" ):
+ listener.enterCompound_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitCompound_statement" ):
+ listener.exitCompound_statement(self)
+
+
+
+
+ def compound_statement(self):
+
+ localctx = CParser.Compound_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 130, self.RULE_compound_statement)
+ self._la = 0 # Token type
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 819
+ self.match(CParser.T__0)
+ self.state = 823
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,101,self._ctx)
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt==1:
+ self.state = 820
+ self.declaration()
+ self.state = 825
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,101,self._ctx)
+
+ self.state = 827
+ self._errHandler.sync(self)
+ _la = self._input.LA(1)
+ if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << CParser.T__0) | (1 << CParser.T__1) | (1 << CParser.T__2) | (1 << CParser.T__5) | (1 << CParser.T__6) | (1 << CParser.T__7) | (1 << CParser.T__8) | (1 << CParser.T__9) | (1 << CParser.T__10) | (1 << CParser.T__11) | (1 << CParser.T__12) | (1 << CParser.T__13) | (1 << CParser.T__14) | (1 << CParser.T__15) | (1 << CParser.T__16) | (1 << CParser.T__17) | (1 << CParser.T__18) | (1 << CParser.T__20) | (1 << CParser.T__21) | (1 << CParser.T__23) | (1 << CParser.T__24) | (1 << CParser.T__25) | (1 << CParser.T__26) | (1 << CParser.T__27) | (1 << CParser.T__28) | (1 << CParser.T__29) | (1 << CParser.T__30) | (1 << CParser.T__31) | (1 << CParser.T__32) | (1 << CParser.T__33) | (1 << CParser.T__34) | (1 << CParser.T__35) | (1 << CParser.T__36) | (1 << CParser.T__37) | (1 << CParser.T__41) | (1 << CParser.T__43) | (1 << CParser.T__44) | (1 << CParser.T__47) | (1 << CParser.T__48) | (1 << CParser.T__49) | (1 << CParser.T__52) | (1 << CParser.T__53) | (1 << CParser.T__54))) != 0) or ((((_la - 79)) & ~0x3f) == 0 and ((1 << (_la - 79)) & ((1 << (CParser.T__78 - 79)) | (1 << (CParser.T__79 - 79)) | (1 << (CParser.T__80 - 79)) | (1 << (CParser.T__81 - 79)) | (1 << (CParser.T__82 - 79)) | (1 << (CParser.T__83 - 79)) | (1 << (CParser.T__85 - 79)) | (1 << (CParser.T__86 - 79)) | (1 << (CParser.T__87 - 79)) | (1 << (CParser.T__88 - 79)) | (1 << (CParser.T__89 - 79)) | (1 << (CParser.T__90 - 79)) | (1 << (CParser.T__91 - 79)) | (1 << (CParser.IDENTIFIER - 79)) | (1 << (CParser.CHARACTER_LITERAL - 79)) | (1 << (CParser.STRING_LITERAL - 79)) | (1 << (CParser.HEX_LITERAL - 79)) | (1 << (CParser.DECIMAL_LITERAL - 79)) | (1 << (CParser.OCTAL_LITERAL - 79)) | (1 << (CParser.FLOATING_POINT_LITERAL - 79)))) != 0):
+ self.state = 826
+ self.statement_list()
+
+
+ self.state = 829
+ self.match(CParser.T__19)
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Statement_listContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ # @param i=None Type: int
+ def statement(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.StatementContext)
+ else:
+ return self.getTypedRuleContext(CParser.StatementContext,i)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_statement_list
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterStatement_list" ):
+ listener.enterStatement_list(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitStatement_list" ):
+ listener.exitStatement_list(self)
+
+
+
+
+ def statement_list(self):
+
+ localctx = CParser.Statement_listContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 132, self.RULE_statement_list)
+ try:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 832
+ self._errHandler.sync(self)
+ _alt = 1
+ while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
+ if _alt == 1:
+ self.state = 831
+ self.statement()
+
+ else:
+ raise NoViableAltException(self)
+ self.state = 834
+ self._errHandler.sync(self)
+ _alt = self._interp.adaptivePredict(self._input,103,self._ctx)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Expression_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_expression_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterExpression_statement" ):
+ listener.enterExpression_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitExpression_statement" ):
+ listener.exitExpression_statement(self)
+
+
+
+
+ def expression_statement(self):
+
+ localctx = CParser.Expression_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 134, self.RULE_expression_statement)
+ try:
+ self.state = 840
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__1]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 836
+ self.match(CParser.T__1)
+ pass
+ elif token in [CParser.T__37, CParser.T__41, CParser.T__43, CParser.T__44, CParser.T__47, CParser.T__48, CParser.T__49, CParser.T__52, CParser.T__53, CParser.T__54, CParser.IDENTIFIER, CParser.CHARACTER_LITERAL, CParser.STRING_LITERAL, CParser.HEX_LITERAL, CParser.DECIMAL_LITERAL, CParser.OCTAL_LITERAL, CParser.FLOATING_POINT_LITERAL]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 837
+ self.expression()
+ self.state = 838
+ self.match(CParser.T__1)
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Selection_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.e = None # ExpressionContext
+
+ # @param i=None Type: int
+ def statement(self,i=None):
+ if i is None:
+ return self.getTypedRuleContexts(CParser.StatementContext)
+ else:
+ return self.getTypedRuleContext(CParser.StatementContext,i)
+
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_selection_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterSelection_statement" ):
+ listener.enterSelection_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitSelection_statement" ):
+ listener.exitSelection_statement(self)
+
+
+
+
+ def selection_statement(self):
+
+ localctx = CParser.Selection_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 136, self.RULE_selection_statement)
+ try:
+ self.state = 858
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__83]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 842
+ self.match(CParser.T__83)
+ self.state = 843
+ self.match(CParser.T__37)
+ self.state = 844
+ localctx.e = self.expression()
+ self.state = 845
+ self.match(CParser.T__38)
+ self.StorePredicateExpression((None if localctx.e is None else localctx.e.start).line, (None if localctx.e is None else localctx.e.start).column, (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is None else localctx.e.stop).column, (None if localctx.e is None else self._input.getText((localctx.e.start,localctx.e.stop))))
+ self.state = 847
+ self.statement()
+ self.state = 850
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,105,self._ctx)
+ if la_ == 1:
+ self.state = 848
+ self.match(CParser.T__84)
+ self.state = 849
+ self.statement()
+
+
+ pass
+ elif token in [CParser.T__85]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 852
+ self.match(CParser.T__85)
+ self.state = 853
+ self.match(CParser.T__37)
+ self.state = 854
+ self.expression()
+ self.state = 855
+ self.match(CParser.T__38)
+ self.state = 856
+ self.statement()
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Iteration_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+ self.e = None # ExpressionContext
+
+ def statement(self):
+ return self.getTypedRuleContext(CParser.StatementContext,0)
+
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_iteration_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterIteration_statement" ):
+ listener.enterIteration_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitIteration_statement" ):
+ listener.exitIteration_statement(self)
+
+
+
+
+ def iteration_statement(self):
+
+ localctx = CParser.Iteration_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 138, self.RULE_iteration_statement)
+ try:
+ self.state = 876
+ self._errHandler.sync(self)
+ token = self._input.LA(1)
+ if token in [CParser.T__86]:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 860
+ self.match(CParser.T__86)
+ self.state = 861
+ self.match(CParser.T__37)
+ self.state = 862
+ localctx.e = self.expression()
+ self.state = 863
+ self.match(CParser.T__38)
+ self.state = 864
+ self.statement()
+ self.StorePredicateExpression((None if localctx.e is None else localctx.e.start).line, (None if localctx.e is None else localctx.e.start).column, (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is None else localctx.e.stop).column, (None if localctx.e is None else self._input.getText((localctx.e.start,localctx.e.stop))))
+ pass
+ elif token in [CParser.T__87]:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 867
+ self.match(CParser.T__87)
+ self.state = 868
+ self.statement()
+ self.state = 869
+ self.match(CParser.T__86)
+ self.state = 870
+ self.match(CParser.T__37)
+ self.state = 871
+ localctx.e = self.expression()
+ self.state = 872
+ self.match(CParser.T__38)
+ self.state = 873
+ self.match(CParser.T__1)
+ self.StorePredicateExpression((None if localctx.e is None else localctx.e.start).line, (None if localctx.e is None else localctx.e.start).column, (None if localctx.e is None else localctx.e.stop).line, (None if localctx.e is None else localctx.e.stop).column, (None if localctx.e is None else self._input.getText((localctx.e.start,localctx.e.stop))))
+ pass
+ else:
+ raise NoViableAltException(self)
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+ class Jump_statementContext(ParserRuleContext):
+
+ # @param parent=None Type: ParserRuleContext
+ # @param invokingState=-1 Type: int
+ def __init__(self,parser,parent=None,invokingState=-1):
+ super().__init__(parent, invokingState)
+ self.parser = parser
+
+ def IDENTIFIER(self):
+ return self.getToken(CParser.IDENTIFIER, 0)
+
+ def expression(self):
+ return self.getTypedRuleContext(CParser.ExpressionContext,0)
+
+
+ def getRuleIndex(self):
+ return CParser.RULE_jump_statement
+
+ # @param listener Type: ParseTreeListener
+ def enterRule(self,listener):
+ if hasattr( listener, "enterJump_statement" ):
+ listener.enterJump_statement(self)
+
+ # @param listener Type: ParseTreeListener
+ def exitRule(self,listener):
+ if hasattr( listener, "exitJump_statement" ):
+ listener.exitJump_statement(self)
+
+
+
+
+ def jump_statement(self):
+
+ localctx = CParser.Jump_statementContext(self, self._ctx, self.state)
+ self.enterRule(localctx, 140, self.RULE_jump_statement)
+ try:
+ self.state = 891
+ self._errHandler.sync(self)
+ la_ = self._interp.adaptivePredict(self._input,108,self._ctx)
+ if la_ == 1:
+ self.enterOuterAlt(localctx, 1)
+ self.state = 878
+ self.match(CParser.T__88)
+ self.state = 879
+ self.match(CParser.IDENTIFIER)
+ self.state = 880
+ self.match(CParser.T__1)
+ pass
+
+ elif la_ == 2:
+ self.enterOuterAlt(localctx, 2)
+ self.state = 881
+ self.match(CParser.T__89)
+ self.state = 882
+ self.match(CParser.T__1)
+ pass
+
+ elif la_ == 3:
+ self.enterOuterAlt(localctx, 3)
+ self.state = 883
+ self.match(CParser.T__90)
+ self.state = 884
+ self.match(CParser.T__1)
+ pass
+
+ elif la_ == 4:
+ self.enterOuterAlt(localctx, 4)
+ self.state = 885
+ self.match(CParser.T__91)
+ self.state = 886
+ self.match(CParser.T__1)
+ pass
+
+ elif la_ == 5:
+ self.enterOuterAlt(localctx, 5)
+ self.state = 887
+ self.match(CParser.T__91)
+ self.state = 888
+ self.expression()
+ self.state = 889
+ self.match(CParser.T__1)
+ pass
+
+
+ except RecognitionException as re:
+ localctx.exception = re
+ self._errHandler.reportError(self, re)
+ self._errHandler.recover(self, re)
+ finally:
+ self.exitRule()
+ return localctx
+
+
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/CParser4/__init__.py b/roms/edk2/BaseTools/Source/Python/Eot/CParser4/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/CParser4/__init__.py
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/CodeFragment.py b/roms/edk2/BaseTools/Source/Python/Eot/CodeFragment.py
new file mode 100644
index 000000000..94c3f52d5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/CodeFragment.py
@@ -0,0 +1,179 @@
+## @file
+# fragments of source file
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+
+## The description of comment contents and start & end position
+#
+#
+class Comment :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ # @param CommentType The type of comment (T_COMMENT_TWO_SLASH or T_COMMENT_SLASH_STAR).
+ #
+ def __init__(self, Str, Begin, End, CommentType):
+ self.Content = Str
+ self.StartPos = Begin
+ self.EndPos = End
+ self.Type = CommentType
+
+## The description of preprocess directives and start & end position
+#
+#
+class PP_Directive :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, Str, Begin, End):
+ self.Content = Str
+ self.StartPos = Begin
+ self.EndPos = End
+
+## The description of assignment expression and start & end position
+#
+#
+class AssignmentExpression :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, Lvalue, Op, Exp, Begin, End):
+ self.Name = Lvalue
+ self.Operator = Op
+ self.Value = Exp
+ self.StartPos = Begin
+ self.EndPos = End
+
+## The description of predicate expression and start & end position
+#
+#
+class PredicateExpression :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, Str, Begin, End):
+ self.Content = Str
+ self.StartPos = Begin
+ self.EndPos = End
+
+## The description of function definition and start & end position
+#
+#
+class FunctionDefinition :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ # @param LBPos The left brace position tuple.
+ #
+ def __init__(self, ModifierStr, DeclStr, Begin, End, LBPos, NamePos):
+ self.Modifier = ModifierStr
+ self.Declarator = DeclStr
+ self.StartPos = Begin
+ self.EndPos = End
+ self.LeftBracePos = LBPos
+ self.NamePos = NamePos
+
+## The description of variable declaration and start & end position
+#
+#
+class VariableDeclaration :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, ModifierStr, DeclStr, Begin, End):
+ self.Modifier = ModifierStr
+ self.Declarator = DeclStr
+ self.StartPos = Begin
+ self.EndPos = End
+
+## The description of enum definition and start & end position
+#
+#
+class EnumerationDefinition :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, Str, Begin, End):
+ self.Content = Str
+ self.StartPos = Begin
+ self.EndPos = End
+
+## The description of struct/union definition and start & end position
+#
+#
+class StructUnionDefinition :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, Str, Begin, End):
+ self.Content = Str
+ self.StartPos = Begin
+ self.EndPos = End
+
+## The description of 'Typedef' definition and start & end position
+#
+#
+class TypedefDefinition :
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, FromStr, ToStr, Begin, End):
+ self.FromType = FromStr
+ self.ToType = ToStr
+ self.StartPos = Begin
+ self.EndPos = End
+
+## The description of function calling definition and start & end position
+#
+#
+class FunctionCalling:
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param Begin The start position tuple.
+ # @param End The end position tuple.
+ #
+ def __init__(self, Name, Param, Begin, End):
+ self.FuncName = Name
+ self.ParamList = Param
+ self.StartPos = Begin
+ self.EndPos = End
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/CodeFragmentCollector.py b/roms/edk2/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
new file mode 100644
index 000000000..a5c1ceeae
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
@@ -0,0 +1,435 @@
+## @file
+# preprocess source file
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+import re
+import Common.LongFilePathOs as os
+import sys
+
+if sys.version_info.major == 3:
+ import antlr4 as antlr
+ from Eot.CParser4.CLexer import CLexer
+ from Eot.CParser4.CParser import CParser
+else:
+ import antlr3 as antlr
+ antlr.InputStream = antlr.StringStream
+ from Eot.CParser3.CLexer import CLexer
+ from Eot.CParser3.CParser import CParser
+
+from Eot import FileProfile
+from Eot.CodeFragment import PP_Directive
+from Eot.ParserWarning import Warning
+
+
+##define T_CHAR_SPACE ' '
+##define T_CHAR_NULL '\0'
+##define T_CHAR_CR '\r'
+##define T_CHAR_TAB '\t'
+##define T_CHAR_LF '\n'
+##define T_CHAR_SLASH '/'
+##define T_CHAR_BACKSLASH '\\'
+##define T_CHAR_DOUBLE_QUOTE '\"'
+##define T_CHAR_SINGLE_QUOTE '\''
+##define T_CHAR_STAR '*'
+##define T_CHAR_HASH '#'
+
+(T_CHAR_SPACE, T_CHAR_NULL, T_CHAR_CR, T_CHAR_TAB, T_CHAR_LF, T_CHAR_SLASH, \
+T_CHAR_BACKSLASH, T_CHAR_DOUBLE_QUOTE, T_CHAR_SINGLE_QUOTE, T_CHAR_STAR, T_CHAR_HASH) = \
+(' ', '\0', '\r', '\t', '\n', '/', '\\', '\"', '\'', '*', '#')
+
+SEPERATOR_TUPLE = ('=', '|', ',', '{', '}')
+
+(T_COMMENT_TWO_SLASH, T_COMMENT_SLASH_STAR) = (0, 1)
+
+(T_PP_INCLUDE, T_PP_DEFINE, T_PP_OTHERS) = (0, 1, 2)
+
+## The collector for source code fragments.
+#
+# PreprocessFile method should be called prior to ParseFile
+#
+# GetNext*** procedures mean these procedures will get next token first, then make judgement.
+# Get*** procedures mean these procedures will make judgement on current token only.
+#
+class CodeFragmentCollector:
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param FileName The file that to be parsed
+ #
+ def __init__(self, FileName):
+ self.Profile = FileProfile.FileProfile(FileName)
+ self.Profile.FileLinesList.append(T_CHAR_LF)
+ self.FileName = FileName
+ self.CurrentLineNumber = 1
+ self.CurrentOffsetWithinLine = 0
+
+ self.__Token = ""
+ self.__SkippedChars = ""
+
+ ## __EndOfFile() method
+ #
+ # Judge current buffer pos is at file end
+ #
+ # @param self The object pointer
+ # @retval True Current File buffer position is at file end
+ # @retval False Current File buffer position is NOT at file end
+ #
+ def __EndOfFile(self):
+ NumberOfLines = len(self.Profile.FileLinesList)
+ SizeOfLastLine = len(self.Profile.FileLinesList[-1])
+ if self.CurrentLineNumber == NumberOfLines and self.CurrentOffsetWithinLine >= SizeOfLastLine - 1:
+ return True
+ elif self.CurrentLineNumber > NumberOfLines:
+ return True
+ else:
+ return False
+
+ ## __EndOfLine() method
+ #
+ # Judge current buffer pos is at line end
+ #
+ # @param self The object pointer
+ # @retval True Current File buffer position is at line end
+ # @retval False Current File buffer position is NOT at line end
+ #
+ def __EndOfLine(self):
+ SizeOfCurrentLine = len(self.Profile.FileLinesList[self.CurrentLineNumber - 1])
+ if self.CurrentOffsetWithinLine >= SizeOfCurrentLine - 1:
+ return True
+ else:
+ return False
+
+ ## Rewind() method
+ #
+ # Reset file data buffer to the initial state
+ #
+ # @param self The object pointer
+ #
+ def Rewind(self):
+ self.CurrentLineNumber = 1
+ self.CurrentOffsetWithinLine = 0
+
+ ## __UndoOneChar() method
+ #
+ # Go back one char in the file buffer
+ #
+ # @param self The object pointer
+ # @retval True Successfully go back one char
+ # @retval False Not able to go back one char as file beginning reached
+ #
+ def __UndoOneChar(self):
+
+ if self.CurrentLineNumber == 1 and self.CurrentOffsetWithinLine == 0:
+ return False
+ elif self.CurrentOffsetWithinLine == 0:
+ self.CurrentLineNumber -= 1
+ self.CurrentOffsetWithinLine = len(self.__CurrentLine()) - 1
+ else:
+ self.CurrentOffsetWithinLine -= 1
+ return True
+
+ ## __GetOneChar() method
+ #
+ # Move forward one char in the file buffer
+ #
+ # @param self The object pointer
+ #
+ def __GetOneChar(self):
+ if self.CurrentOffsetWithinLine == len(self.Profile.FileLinesList[self.CurrentLineNumber - 1]) - 1:
+ self.CurrentLineNumber += 1
+ self.CurrentOffsetWithinLine = 0
+ else:
+ self.CurrentOffsetWithinLine += 1
+
+ ## __CurrentChar() method
+ #
+ # Get the char pointed to by the file buffer pointer
+ #
+ # @param self The object pointer
+ # @retval Char Current char
+ #
+ def __CurrentChar(self):
+ CurrentChar = self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine]
+
+ return CurrentChar
+
+ ## __NextChar() method
+ #
+ # Get the one char pass the char pointed to by the file buffer pointer
+ #
+ # @param self The object pointer
+ # @retval Char Next char
+ #
+ def __NextChar(self):
+ if self.CurrentOffsetWithinLine == len(self.Profile.FileLinesList[self.CurrentLineNumber - 1]) - 1:
+ return self.Profile.FileLinesList[self.CurrentLineNumber][0]
+ else:
+ return self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine + 1]
+
+ ## __SetCurrentCharValue() method
+ #
+ # Modify the value of current char
+ #
+ # @param self The object pointer
+ # @param Value The new value of current char
+ #
+ def __SetCurrentCharValue(self, Value):
+ self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine] = Value
+
+ ## __SetCharValue() method
+ #
+ # Modify the value of current char
+ #
+ # @param self The object pointer
+ # @param Value The new value of current char
+ #
+ def __SetCharValue(self, Line, Offset, Value):
+ self.Profile.FileLinesList[Line - 1][Offset] = Value
+
+ ## __CurrentLine() method
+ #
+ # Get the list that contains current line contents
+ #
+ # @param self The object pointer
+ # @retval List current line contents
+ #
+ def __CurrentLine(self):
+ return self.Profile.FileLinesList[self.CurrentLineNumber - 1]
+
+ ## __InsertComma() method
+ #
+ # Insert ',' to replace PP
+ #
+ # @param self The object pointer
+ # @retval List current line contents
+ #
+ def __InsertComma(self, Line):
+
+
+ if self.Profile.FileLinesList[Line - 1][0] != T_CHAR_HASH:
+ BeforeHashPart = str(self.Profile.FileLinesList[Line - 1]).split(T_CHAR_HASH)[0]
+ if BeforeHashPart.rstrip().endswith(T_CHAR_COMMA) or BeforeHashPart.rstrip().endswith(';'):
+ return
+
+ if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(','):
+ return
+
+ if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(';'):
+ return
+
+ if str(self.Profile.FileLinesList[Line]).lstrip().startswith(',') or str(self.Profile.FileLinesList[Line]).lstrip().startswith(';'):
+ return
+
+ self.Profile.FileLinesList[Line - 1].insert(self.CurrentOffsetWithinLine, ',')
+
+ ## PreprocessFileWithClear() method
+ #
+ # Run a preprocess for the file to clean all comments
+ #
+ # @param self The object pointer
+ #
+ def PreprocessFileWithClear(self):
+
+ self.Rewind()
+ InComment = False
+ DoubleSlashComment = False
+ HashComment = False
+ PPExtend = False
+ PPDirectiveObj = None
+ # HashComment in quoted string " " is ignored.
+ InString = False
+ InCharLiteral = False
+
+ self.Profile.FileLinesList = [list(s) for s in self.Profile.FileLinesListFromFile]
+ while not self.__EndOfFile():
+
+ if not InComment and self.__CurrentChar() == T_CHAR_DOUBLE_QUOTE:
+ InString = not InString
+
+ if not InComment and self.__CurrentChar() == T_CHAR_SINGLE_QUOTE:
+ InCharLiteral = not InCharLiteral
+ # meet new line, then no longer in a comment for // and '#'
+ if self.__CurrentChar() == T_CHAR_LF:
+ if HashComment and PPDirectiveObj is not None:
+ if PPDirectiveObj.Content.rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):
+ PPDirectiveObj.Content += T_CHAR_LF
+ PPExtend = True
+ else:
+ PPExtend = False
+
+ EndLinePos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
+
+ if InComment and DoubleSlashComment:
+ InComment = False
+ DoubleSlashComment = False
+
+ if InComment and HashComment and not PPExtend:
+ InComment = False
+ HashComment = False
+ PPDirectiveObj.Content += T_CHAR_LF
+ PPDirectiveObj.EndPos = EndLinePos
+ FileProfile.PPDirectiveList.append(PPDirectiveObj)
+ PPDirectiveObj = None
+
+ if InString or InCharLiteral:
+ CurrentLine = "".join(self.__CurrentLine())
+ if CurrentLine.rstrip(T_CHAR_LF).rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):
+ SlashIndex = CurrentLine.rindex(T_CHAR_BACKSLASH)
+ self.__SetCharValue(self.CurrentLineNumber, SlashIndex, T_CHAR_SPACE)
+
+ self.CurrentLineNumber += 1
+ self.CurrentOffsetWithinLine = 0
+ # check for */ comment end
+ elif InComment and not DoubleSlashComment and not HashComment and self.__CurrentChar() == T_CHAR_STAR and self.__NextChar() == T_CHAR_SLASH:
+
+ self.__SetCurrentCharValue(T_CHAR_SPACE)
+ self.__GetOneChar()
+ self.__SetCurrentCharValue(T_CHAR_SPACE)
+ self.__GetOneChar()
+ InComment = False
+ # set comments to spaces
+ elif InComment:
+ if HashComment:
+ # // follows hash PP directive
+ if self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_SLASH:
+ InComment = False
+ HashComment = False
+ PPDirectiveObj.EndPos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine - 1)
+ FileProfile.PPDirectiveList.append(PPDirectiveObj)
+ PPDirectiveObj = None
+ continue
+ else:
+ PPDirectiveObj.Content += self.__CurrentChar()
+
+ self.__SetCurrentCharValue(T_CHAR_SPACE)
+ self.__GetOneChar()
+ # check for // comment
+ elif self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_SLASH:
+ InComment = True
+ DoubleSlashComment = True
+
+ # check for '#' comment
+ elif self.__CurrentChar() == T_CHAR_HASH and not InString and not InCharLiteral:
+ InComment = True
+ HashComment = True
+ PPDirectiveObj = PP_Directive('', (self.CurrentLineNumber, self.CurrentOffsetWithinLine), None)
+ # check for /* comment start
+ elif self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_STAR:
+
+ self.__SetCurrentCharValue( T_CHAR_SPACE)
+ self.__GetOneChar()
+ self.__SetCurrentCharValue( T_CHAR_SPACE)
+ self.__GetOneChar()
+ InComment = True
+ else:
+ self.__GetOneChar()
+
+ EndLinePos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
+
+ if InComment and HashComment and not PPExtend:
+ PPDirectiveObj.EndPos = EndLinePos
+ FileProfile.PPDirectiveList.append(PPDirectiveObj)
+ self.Rewind()
+
+ ## ParseFile() method
+ #
+ # Parse the file profile buffer to extract fd, fv ... information
+ # Exception will be raised if syntax error found
+ #
+ # @param self The object pointer
+ #
+ def ParseFile(self):
+ self.PreprocessFileWithClear()
+ # restore from ListOfList to ListOfString
+ self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]
+ FileStringContents = ''
+ for fileLine in self.Profile.FileLinesList:
+ FileStringContents += fileLine
+ cStream = antlr.InputStream(FileStringContents)
+ lexer = CLexer(cStream)
+ tStream = antlr.CommonTokenStream(lexer)
+ parser = CParser(tStream)
+ parser.translation_unit()
+
+ ## CleanFileProfileBuffer() method
+ #
+ # Reset all contents of the profile of a file
+ #
+ def CleanFileProfileBuffer(self):
+
+ FileProfile.PPDirectiveList = []
+ FileProfile.AssignmentExpressionList = []
+ FileProfile.FunctionDefinitionList = []
+ FileProfile.VariableDeclarationList = []
+ FileProfile.EnumerationDefinitionList = []
+ FileProfile.StructUnionDefinitionList = []
+ FileProfile.TypedefDefinitionList = []
+ FileProfile.FunctionCallingList = []
+
+ ## PrintFragments() method
+ #
+ # Print the contents of the profile of a file
+ #
+ def PrintFragments(self):
+
+ print('################# ' + self.FileName + '#####################')
+
+ print('/****************************************/')
+ print('/************** ASSIGNMENTS *************/')
+ print('/****************************************/')
+ for assign in FileProfile.AssignmentExpressionList:
+ print(str(assign.StartPos) + assign.Name + assign.Operator + assign.Value)
+
+ print('/****************************************/')
+ print('/********* PREPROCESS DIRECTIVES ********/')
+ print('/****************************************/')
+ for pp in FileProfile.PPDirectiveList:
+ print(str(pp.StartPos) + pp.Content)
+
+ print('/****************************************/')
+ print('/********* VARIABLE DECLARATIONS ********/')
+ print('/****************************************/')
+ for var in FileProfile.VariableDeclarationList:
+ print(str(var.StartPos) + var.Modifier + ' '+ var.Declarator)
+
+ print('/****************************************/')
+ print('/********* FUNCTION DEFINITIONS *********/')
+ print('/****************************************/')
+ for func in FileProfile.FunctionDefinitionList:
+ print(str(func.StartPos) + func.Modifier + ' '+ func.Declarator + ' ' + str(func.NamePos))
+
+ print('/****************************************/')
+ print('/************ ENUMERATIONS **************/')
+ print('/****************************************/')
+ for enum in FileProfile.EnumerationDefinitionList:
+ print(str(enum.StartPos) + enum.Content)
+
+ print('/****************************************/')
+ print('/*********** STRUCTS/UNIONS *************/')
+ print('/****************************************/')
+ for su in FileProfile.StructUnionDefinitionList:
+ print(str(su.StartPos) + su.Content)
+
+ print('/****************************************/')
+ print('/************** TYPEDEFS ****************/')
+ print('/****************************************/')
+ for typedef in FileProfile.TypedefDefinitionList:
+ print(str(typedef.StartPos) + typedef.ToType)
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == "__main__":
+
+ print("For Test.")
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/Database.py b/roms/edk2/BaseTools/Source/Python/Eot/Database.py
new file mode 100644
index 000000000..fca08b96b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/Database.py
@@ -0,0 +1,249 @@
+## @file
+# This file is used to create a database used by EOT tool
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+import sqlite3
+import Common.LongFilePathOs as os, time
+
+import Common.EdkLogger as EdkLogger
+import CommonDataClass.DataClass as DataClass
+
+from Table.TableDataModel import TableDataModel
+from Table.TableFile import TableFile
+from Table.TableFunction import TableFunction
+from Table.TableIdentifier import TableIdentifier
+from Table.TableEotReport import TableEotReport
+from Table.TableInf import TableInf
+from Table.TableDec import TableDec
+from Table.TableDsc import TableDsc
+from Table.TableFdf import TableFdf
+from Table.TableQuery import TableQuery
+
+##
+# Static definitions
+#
+DATABASE_PATH = "Eot.db"
+
+## Database class
+#
+# This class defined the EOT database
+# During the phase of initialization, the database will create all tables and
+# insert all records of table DataModel
+#
+class Database(object):
+ ## The constructor
+ #
+ # @param self: The object pointer
+ # @param DbPath: The file path of the database
+ #
+ def __init__(self, DbPath):
+ self.DbPath = DbPath
+ self.Conn = None
+ self.Cur = None
+ self.TblDataModel = None
+ self.TblFile = None
+ self.TblFunction = None
+ self.TblIdentifier = None
+ self.TblReport = None
+ self.TblInf = None
+ self.TblDec = None
+ self.TblDsc = None
+ self.TblFdf = None
+ self.TblQuery = None
+ self.TblQuery2 = None
+
+ ## InitDatabase() method
+ # 1. Delete all old existing tables
+ # 2. Create new tables
+ # 3. Initialize table DataModel
+ #
+ # @param self: The object pointer
+ # @param NewDatabase: Check if it needs to create a new database
+ #
+ def InitDatabase(self, NewDatabase = True):
+ EdkLogger.verbose("\nInitialize EOT database started ...")
+ #
+ # Drop all old existing tables
+ #
+ if NewDatabase:
+ if os.path.exists(self.DbPath):
+ os.remove(self.DbPath)
+ self.Conn = sqlite3.connect(self.DbPath, isolation_level = 'DEFERRED')
+ self.Conn.execute("PRAGMA page_size=8192")
+ self.Conn.execute("PRAGMA synchronous=OFF")
+ # to avoid non-ascii character conversion error
+ self.Conn.text_factory = str
+ self.Cur = self.Conn.cursor()
+
+ self.TblDataModel = TableDataModel(self.Cur)
+ self.TblFile = TableFile(self.Cur)
+ self.TblFunction = TableFunction(self.Cur)
+ self.TblIdentifier = TableIdentifier(self.Cur)
+ self.TblReport = TableEotReport(self.Cur)
+ self.TblInf = TableInf(self.Cur)
+ self.TblDec = TableDec(self.Cur)
+ self.TblDsc = TableDsc(self.Cur)
+ self.TblFdf = TableFdf(self.Cur)
+ self.TblQuery = TableQuery(self.Cur)
+ self.TblQuery2 = TableQuery(self.Cur)
+ self.TblQuery2.Table = 'Query2'
+
+ # Create new tables
+ if NewDatabase:
+ self.TblDataModel.Create()
+ self.TblFile.Create()
+ self.TblFunction.Create()
+ self.TblReport.Create()
+ self.TblInf.Create()
+ self.TblDec.Create()
+ self.TblDsc.Create()
+ self.TblFdf.Create()
+ self.TblQuery.Create()
+ self.TblQuery2.Create()
+
+ # Init each table's ID
+ self.TblDataModel.InitID()
+ self.TblFile.InitID()
+ self.TblFunction.InitID()
+ self.TblReport.InitID()
+ self.TblInf.InitID()
+ self.TblDec.InitID()
+ self.TblDsc.InitID()
+ self.TblFdf.InitID()
+ self.TblQuery.Drop()
+ self.TblQuery.Create()
+ self.TblQuery.InitID()
+ self.TblQuery2.Drop()
+ self.TblQuery2.Create()
+ self.TblQuery2.InitID()
+
+ # Initialize table DataModel
+ if NewDatabase:
+ self.TblDataModel.InitTable()
+
+ EdkLogger.verbose("Initialize EOT database ... DONE!")
+
+ ## QueryTable() method
+ #
+ # Query a table
+ #
+ # @param self: The object pointer
+ # @param Table: The instance of the table to be queried
+ #
+ def QueryTable(self, Table):
+ Table.Query()
+
+ ## Close() method
+ #
+ # Commit all first
+ # Close the connection and cursor
+ #
+ def Close(self):
+ # Commit to file
+ self.Conn.commit()
+
+ # Close connection and cursor
+ self.Cur.close()
+ self.Conn.close()
+
+ ## InsertOneFile() method
+ #
+ # Insert one file's information to the database
+ # 1. Create a record in TableFile
+ # 2. Create functions one by one
+ # 2.1 Create variables of function one by one
+ # 2.2 Create pcds of function one by one
+ # 3. Create variables one by one
+ # 4. Create pcds one by one
+ #
+ # @param self: The object pointer
+ # @param File: The object of the file to be inserted
+ #
+ def InsertOneFile(self, File):
+ # Insert a record for file
+ FileID = self.TblFile.Insert(File.Name, File.ExtName, File.Path, File.FullPath, Model = File.Model, TimeStamp = File.TimeStamp)
+ IdTable = TableIdentifier(self.Cur)
+ IdTable.Table = "Identifier%s" % FileID
+ IdTable.Create()
+
+ # Insert function of file
+ for Function in File.FunctionList:
+ FunctionID = self.TblFunction.Insert(Function.Header, Function.Modifier, Function.Name, Function.ReturnStatement, \
+ Function.StartLine, Function.StartColumn, Function.EndLine, Function.EndColumn, \
+ Function.BodyStartLine, Function.BodyStartColumn, FileID, \
+ Function.FunNameStartLine, Function.FunNameStartColumn)
+
+ # Insert Identifier of function
+ for Identifier in Function.IdentifierList:
+ IdentifierID = IdTable.Insert(Identifier.Modifier, Identifier.Type, Identifier.Name, Identifier.Value, Identifier.Model, \
+ FileID, FunctionID, Identifier.StartLine, Identifier.StartColumn, Identifier.EndLine, Identifier.EndColumn)
+ # Insert Identifier of file
+ for Identifier in File.IdentifierList:
+ IdentifierID = IdTable.Insert(Identifier.Modifier, Identifier.Type, Identifier.Name, Identifier.Value, Identifier.Model, \
+ FileID, -1, Identifier.StartLine, Identifier.StartColumn, Identifier.EndLine, Identifier.EndColumn)
+
+ EdkLogger.verbose("Insert information from file %s ... DONE!" % File.FullPath)
+
+ ## UpdateIdentifierBelongsToFunction() method
+ #
+ # Update the field "BelongsToFunction" for each Identifier
+ #
+ # @param self: The object pointer
+ #
+ def UpdateIdentifierBelongsToFunction(self):
+ EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers started ...")
+
+ SqlCommand = """select ID, BelongsToFile, StartLine, EndLine from Function"""
+ Records = self.TblFunction.Exec(SqlCommand)
+ Data1 = []
+ Data2 = []
+ for Record in Records:
+ FunctionID = Record[0]
+ BelongsToFile = Record[1]
+ StartLine = Record[2]
+ EndLine = Record[3]
+
+ SqlCommand = """Update Identifier%s set BelongsToFunction = %s where BelongsToFile = %s and StartLine > %s and EndLine < %s""" % \
+ (BelongsToFile, FunctionID, BelongsToFile, StartLine, EndLine)
+ self.TblIdentifier.Exec(SqlCommand)
+
+ SqlCommand = """Update Identifier%s set BelongsToFunction = %s, Model = %s where BelongsToFile = %s and Model = %s and EndLine = %s""" % \
+ (BelongsToFile, FunctionID, DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER, BelongsToFile, DataClass.MODEL_IDENTIFIER_COMMENT, StartLine - 1)
+ self.TblIdentifier.Exec(SqlCommand)
+
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ EdkLogger.Initialize()
+ EdkLogger.SetLevel(EdkLogger.DEBUG_0)
+ EdkLogger.verbose("Start at " + time.strftime('%H:%M:%S', time.localtime()))
+
+ Db = Database(DATABASE_PATH)
+ Db.InitDatabase()
+ Db.QueryTable(Db.TblDataModel)
+
+ identifier1 = DataClass.IdentifierClass(-1, '', '', "i''1", 'aaa', DataClass.MODEL_IDENTIFIER_COMMENT, 1, -1, 32, 43, 54, 43)
+ identifier2 = DataClass.IdentifierClass(-1, '', '', 'i1', 'aaa', DataClass.MODEL_IDENTIFIER_COMMENT, 1, -1, 15, 43, 20, 43)
+ identifier3 = DataClass.IdentifierClass(-1, '', '', 'i1', 'aaa', DataClass.MODEL_IDENTIFIER_COMMENT, 1, -1, 55, 43, 58, 43)
+ identifier4 = DataClass.IdentifierClass(-1, '', '', "i1'", 'aaa', DataClass.MODEL_IDENTIFIER_COMMENT, 1, -1, 77, 43, 88, 43)
+ fun1 = DataClass.FunctionClass(-1, '', '', 'fun1', '', 21, 2, 60, 45, 1, 23, 0, [], [])
+ file = DataClass.FileClass(-1, 'F1', 'c', 'C:\\', 'C:\\F1.exe', DataClass.MODEL_FILE_C, '2007-12-28', [fun1], [identifier1, identifier2, identifier3, identifier4], [])
+ Db.InsertOneFile(file)
+
+ Db.QueryTable(Db.TblFile)
+ Db.QueryTable(Db.TblFunction)
+ Db.QueryTable(Db.TblIdentifier)
+
+ Db.Close()
+ EdkLogger.verbose("End at " + time.strftime('%H:%M:%S', time.localtime()))
+
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/EfiCompressor.pyd b/roms/edk2/BaseTools/Source/Python/Eot/EfiCompressor.pyd
new file mode 100644
index 000000000..9de9beb40
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/EfiCompressor.pyd
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/EotGlobalData.py b/roms/edk2/BaseTools/Source/Python/Eot/EotGlobalData.py
new file mode 100644
index 000000000..3218f86f4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/EotGlobalData.py
@@ -0,0 +1,105 @@
+## @file
+# This file is used to save global datas
+#
+# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from collections import OrderedDict
+from Common.LongFilePathSupport import OpenLongFilePath as open
+
+gEFI_SOURCE = ''
+gEDK_SOURCE = ''
+gWORKSPACE = ''
+gSHELL_INF = 'Application\Shell'
+gMAKE_FILE = ''
+gDSC_FILE = ''
+gFV_FILE = []
+gFV = []
+gMAP_FILE = []
+gMap = {}
+
+
+gDb = ''
+gIdentifierTableList = []
+
+# Global macro
+gMACRO = {}
+gMACRO['EFI_SOURCE'] = gEFI_SOURCE
+gMACRO['EDK_SOURCE'] = gEDK_SOURCE
+gMACRO['SHELL_INF'] = gSHELL_INF
+gMACRO['CAPSULE_INF'] = ''
+
+# Log file for unmatched variables
+gUN_MATCHED_LOG = 'Log_UnMatched.log'
+gOP_UN_MATCHED = open(gUN_MATCHED_LOG, 'w+')
+
+# Log file for all INF files
+gINF_FILES = 'Log_Inf_File.log'
+gOP_INF = open(gINF_FILES, 'w+')
+
+# Log file for not dispatched PEIM/DRIVER
+gUN_DISPATCHED_LOG = 'Log_UnDispatched.log'
+gOP_UN_DISPATCHED = open(gUN_DISPATCHED_LOG, 'w+')
+
+# Log file for unmatched variables in function calling
+gUN_MATCHED_IN_LIBRARY_CALLING_LOG = 'Log_UnMatchedInLibraryCalling.log'
+gOP_UN_MATCHED_IN_LIBRARY_CALLING = open(gUN_MATCHED_IN_LIBRARY_CALLING_LOG, 'w+')
+
+# Log file for order of dispatched PEIM/DRIVER
+gDISPATCH_ORDER_LOG = 'Log_DispatchOrder.log'
+gOP_DISPATCH_ORDER = open(gDISPATCH_ORDER_LOG, 'w+')
+
+# Log file for found source files
+gSOURCE_FILES = 'Log_SourceFiles.log'
+gOP_SOURCE_FILES = open(gSOURCE_FILES, 'w+')
+
+# Dict for GUID found in DEC files
+gGuidDict = dict()
+
+# Dict for PROTOCOL
+gProtocolList = {}
+# Dict for PPI
+gPpiList = {}
+
+
+# Dict for consumed PPI function calling
+gConsumedPpiLibrary = OrderedDict()
+gConsumedPpiLibrary['EfiCommonLocateInterface'] = 0
+gConsumedPpiLibrary['PeiServicesLocatePpi'] = 0
+
+# Dict for produced PROTOCOL function calling
+gProducedProtocolLibrary = OrderedDict()
+gProducedProtocolLibrary['RegisterEsalClass'] = 0
+gProducedProtocolLibrary['CoreInstallProtocolInterface'] = 1
+gProducedProtocolLibrary['CoreInstallMultipleProtocolInterfaces'] = -1
+gProducedProtocolLibrary['EfiInstallProtocolInterface'] = 1
+gProducedProtocolLibrary['EfiReinstallProtocolInterface'] = 1
+gProducedProtocolLibrary['EfiLibNamedEventSignal'] = 0
+gProducedProtocolLibrary['LibInstallProtocolInterfaces'] = 1
+gProducedProtocolLibrary['LibReinstallProtocolInterfaces'] = 1
+
+# Dict for consumed PROTOCOL function calling
+gConsumedProtocolLibrary = OrderedDict()
+gConsumedProtocolLibrary['EfiHandleProtocol'] = 0
+gConsumedProtocolLibrary['EfiLocateProtocolHandleBuffers'] = 0
+gConsumedProtocolLibrary['EfiLocateProtocolInterface'] = 0
+gConsumedProtocolLibrary['EfiHandleProtocol'] = 1
+
+# Dict for callback PROTOCOL function calling
+gCallbackProtocolLibrary = OrderedDict()
+gCallbackProtocolLibrary['EfiRegisterProtocolCallback'] = 2
+
+gArchProtocolGuids = {'665e3ff6-46cc-11d4-9a38-0090273fc14d',
+ '26baccb1-6f42-11d4-bce7-0080c73c8881',
+ '26baccb2-6f42-11d4-bce7-0080c73c8881',
+ '1da97072-bddc-4b30-99f1-72a0b56fff2a',
+ '27cfac87-46cc-11d4-9a38-0090273fc14d',
+ '27cfac88-46cc-11d4-9a38-0090273fc14d',
+ 'b7dfb4e1-052f-449f-87be-9818fc91b733',
+ 'a46423e3-4617-49f1-b9ff-d1bfa9115839',
+ 'd2b2b828-0826-48a7-b3df-983c006024f0',
+ '26baccb3-6f42-11d4-bce7-0080c73c8881',
+ '1e5668e2-8481-11d4-bcf1-0080c73c8881',
+ '6441f818-6362-4e44-b570-7dba31dd2453',
+ '665e3ff5-46cc-11d4-9a38-0090273fc14d'}
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/EotMain.py b/roms/edk2/BaseTools/Source/Python/Eot/EotMain.py
new file mode 100644
index 000000000..791fcdfea
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/EotMain.py
@@ -0,0 +1,1713 @@
+## @file
+# This file is used to be the main entrance of EOT tool
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.LongFilePathOs as os, time, glob
+import Common.EdkLogger as EdkLogger
+import Eot.EotGlobalData as EotGlobalData
+from optparse import OptionParser
+from Common.StringUtils import NormPath
+from Common import BuildToolError
+from Common.Misc import GuidStructureStringToGuidString
+from collections import OrderedDict as sdict
+from Eot.Parser import *
+from Eot.InfParserLite import EdkInfParser
+from Common.StringUtils import GetSplitValueList
+from Eot import c
+from Eot import Database
+from array import array
+from Eot.Report import Report
+from Common.BuildVersion import gBUILD_VERSION
+from Eot.Parser import ConvertGuid
+from Common.LongFilePathSupport import OpenLongFilePath as open
+import struct
+import uuid
+import copy
+import codecs
+from GenFds.AprioriSection import DXE_APRIORI_GUID, PEI_APRIORI_GUID
+
+gGuidStringFormat = "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"
+gIndention = -4
+
+class Image(array):
+ _HEADER_ = struct.Struct("")
+ _HEADER_SIZE_ = _HEADER_.size
+
+ def __new__(cls, *args, **kwargs):
+ return array.__new__(cls, 'B')
+
+ def __init__(self, ID=None):
+ if ID is None:
+ self._ID_ = str(uuid.uuid1()).upper()
+ else:
+ self._ID_ = ID
+ self._BUF_ = None
+ self._LEN_ = None
+ self._OFF_ = None
+
+ self._SubImages = sdict() # {offset: Image()}
+
+ array.__init__(self)
+
+ def __repr__(self):
+ return self._ID_
+
+ def __len__(self):
+ Len = array.__len__(self)
+ for Offset in self._SubImages.keys():
+ Len += len(self._SubImages[Offset])
+ return Len
+
+ def _Unpack(self):
+ self.extend(self._BUF_[self._OFF_ : self._OFF_ + self._LEN_])
+ return len(self)
+
+ def _Pack(self, PadByte=0xFF):
+ raise NotImplementedError
+
+ def frombuffer(self, Buffer, Offset=0, Size=None):
+ self._BUF_ = Buffer
+ self._OFF_ = Offset
+ # we may need the Size information in advance if it's given
+ self._LEN_ = Size
+ self._LEN_ = self._Unpack()
+
+ def empty(self):
+ del self[0:]
+
+ def GetField(self, FieldStruct, Offset=0):
+ return FieldStruct.unpack_from(self, Offset)
+
+ def SetField(self, FieldStruct, Offset, *args):
+ # check if there's enough space
+ Size = FieldStruct.size
+ if Size > len(self):
+ self.extend([0] * (Size - len(self)))
+ FieldStruct.pack_into(self, Offset, *args)
+
+ def _SetData(self, Data):
+ if len(self) < self._HEADER_SIZE_:
+ self.extend([0] * (self._HEADER_SIZE_ - len(self)))
+ else:
+ del self[self._HEADER_SIZE_:]
+ self.extend(Data)
+
+ def _GetData(self):
+ if len(self) > self._HEADER_SIZE_:
+ return self[self._HEADER_SIZE_:]
+ return None
+
+ Data = property(_GetData, _SetData)
+
+## CompressedImage() class
+#
+# A class for Compressed Image
+#
+class CompressedImage(Image):
+ # UncompressedLength = 4-byte
+ # CompressionType = 1-byte
+ _HEADER_ = struct.Struct("1I 1B")
+ _HEADER_SIZE_ = _HEADER_.size
+
+ _ORIG_SIZE_ = struct.Struct("1I")
+ _CMPRS_TYPE_ = struct.Struct("4x 1B")
+
+ def __init__(self, CompressedData=None, CompressionType=None, UncompressedLength=None):
+ Image.__init__(self)
+ if UncompressedLength is not None:
+ self.UncompressedLength = UncompressedLength
+ if CompressionType is not None:
+ self.CompressionType = CompressionType
+ if CompressedData is not None:
+ self.Data = CompressedData
+
+ def __str__(self):
+ global gIndention
+ S = "algorithm=%s uncompressed=%x" % (self.CompressionType, self.UncompressedLength)
+ for Sec in self.Sections:
+ S += '\n' + str(Sec)
+
+ return S
+
+ def _SetOriginalSize(self, Size):
+ self.SetField(self._ORIG_SIZE_, 0, Size)
+
+ def _GetOriginalSize(self):
+ return self.GetField(self._ORIG_SIZE_)[0]
+
+ def _SetCompressionType(self, Type):
+ self.SetField(self._CMPRS_TYPE_, 0, Type)
+
+ def _GetCompressionType(self):
+ return self.GetField(self._CMPRS_TYPE_)[0]
+
+ def _GetSections(self):
+ try:
+ TmpData = DeCompress('Efi', self[self._HEADER_SIZE_:])
+ DecData = array('B')
+ DecData.fromstring(TmpData)
+ except:
+ TmpData = DeCompress('Framework', self[self._HEADER_SIZE_:])
+ DecData = array('B')
+ DecData.fromstring(TmpData)
+
+ SectionList = []
+ Offset = 0
+ while Offset < len(DecData):
+ Sec = Section()
+ try:
+ Sec.frombuffer(DecData, Offset)
+ Offset += Sec.Size
+ # the section is aligned to 4-byte boundary
+ except:
+ break
+ SectionList.append(Sec)
+ return SectionList
+
+ UncompressedLength = property(_GetOriginalSize, _SetOriginalSize)
+ CompressionType = property(_GetCompressionType, _SetCompressionType)
+ Sections = property(_GetSections)
+
+## Ui() class
+#
+# A class for Ui
+#
+class Ui(Image):
+ _HEADER_ = struct.Struct("")
+ _HEADER_SIZE_ = 0
+
+ def __init__(self):
+ Image.__init__(self)
+
+ def __str__(self):
+ return self.String
+
+ def _Unpack(self):
+ # keep header in this Image object
+ self.empty()
+ self.extend(self._BUF_[self._OFF_ : self._OFF_ + self._LEN_])
+ return len(self)
+
+ def _GetUiString(self):
+ return codecs.utf_16_decode(self[0:-2].tostring())[0]
+
+ String = property(_GetUiString)
+
+## Depex() class
+#
+# A class for Depex
+#
+class Depex(Image):
+ _HEADER_ = struct.Struct("")
+ _HEADER_SIZE_ = 0
+
+ _GUID_ = struct.Struct("1I2H8B")
+ _OPCODE_ = struct.Struct("1B")
+
+ _OPCODE_STRING_ = {
+ 0x00 : "BEFORE",
+ 0x01 : "AFTER",
+ 0x02 : "PUSH",
+ 0x03 : "AND",
+ 0x04 : "OR",
+ 0x05 : "NOT",
+ 0x06 : "TRUE",
+ 0x07 : "FALSE",
+ 0x08 : "END",
+ 0x09 : "SOR"
+ }
+
+ _NEXT_ = {
+ -1 : _OPCODE_, # first one in depex must be an opcdoe
+ 0x00 : _GUID_, #"BEFORE",
+ 0x01 : _GUID_, #"AFTER",
+ 0x02 : _GUID_, #"PUSH",
+ 0x03 : _OPCODE_, #"AND",
+ 0x04 : _OPCODE_, #"OR",
+ 0x05 : _OPCODE_, #"NOT",
+ 0x06 : _OPCODE_, #"TRUE",
+ 0x07 : _OPCODE_, #"FALSE",
+ 0x08 : None, #"END",
+ 0x09 : _OPCODE_, #"SOR"
+ }
+
+ def __init__(self):
+ Image.__init__(self)
+ self._ExprList = []
+
+ def __str__(self):
+ global gIndention
+ gIndention += 4
+ Indention = ' ' * gIndention
+ S = '\n'
+ for T in self.Expression:
+ if T in self._OPCODE_STRING_:
+ S += Indention + self._OPCODE_STRING_[T]
+ if T not in [0x00, 0x01, 0x02]:
+ S += '\n'
+ else:
+ S += ' ' + gGuidStringFormat % T + '\n'
+ gIndention -= 4
+ return S
+
+ def _Unpack(self):
+ # keep header in this Image object
+ self.empty()
+ self.extend(self._BUF_[self._OFF_ : self._OFF_ + self._LEN_])
+ return len(self)
+
+ def _GetExpression(self):
+ if self._ExprList == []:
+ Offset = 0
+ CurrentData = self._OPCODE_
+ while Offset < len(self):
+ Token = CurrentData.unpack_from(self, Offset)
+ Offset += CurrentData.size
+ if len(Token) == 1:
+ Token = Token[0]
+ if Token in self._NEXT_:
+ CurrentData = self._NEXT_[Token]
+ else:
+ CurrentData = self._GUID_
+ else:
+ CurrentData = self._OPCODE_
+ self._ExprList.append(Token)
+ if CurrentData is None:
+ break
+ return self._ExprList
+
+ Expression = property(_GetExpression)
+
+# # FirmwareVolume() class
+#
+# A class for Firmware Volume
+#
+class FirmwareVolume(Image):
+ # Read FvLength, Attributes, HeaderLength, Checksum
+ _HEADER_ = struct.Struct("16x 1I2H8B 1Q 4x 1I 1H 1H")
+ _HEADER_SIZE_ = _HEADER_.size
+
+ _FfsGuid = "8C8CE578-8A3D-4F1C-9935-896185C32DD3"
+
+ _GUID_ = struct.Struct("16x 1I2H8B")
+ _LENGTH_ = struct.Struct("16x 16x 1Q")
+ _SIG_ = struct.Struct("16x 16x 8x 1I")
+ _ATTR_ = struct.Struct("16x 16x 8x 4x 1I")
+ _HLEN_ = struct.Struct("16x 16x 8x 4x 4x 1H")
+ _CHECKSUM_ = struct.Struct("16x 16x 8x 4x 4x 2x 1H")
+
+ def __init__(self, Name=''):
+ Image.__init__(self)
+ self.Name = Name
+ self.FfsDict = sdict()
+ self.OrderedFfsDict = sdict()
+ self.UnDispatchedFfsDict = sdict()
+ self.ProtocolList = sdict()
+
+ def CheckArchProtocol(self):
+ for Item in EotGlobalData.gArchProtocolGuids:
+ if Item.lower() not in EotGlobalData.gProtocolList:
+ return False
+ return True
+
+ def ParseDepex(self, Depex, Type):
+ List = None
+ if Type == 'Ppi':
+ List = EotGlobalData.gPpiList
+ if Type == 'Protocol':
+ List = EotGlobalData.gProtocolList
+ DepexStack = []
+ DepexList = []
+ DepexString = ''
+ FileDepex = None
+ CouldBeLoaded = True
+ for Index in range(0, len(Depex.Expression)):
+ Item = Depex.Expression[Index]
+ if Item == 0x00:
+ Index = Index + 1
+ Guid = gGuidStringFormat % Depex.Expression[Index]
+ if Guid in self.OrderedFfsDict and Depex.Expression[Index + 1] == 0x08:
+ return (True, 'BEFORE %s' % Guid, [Guid, 'BEFORE'])
+ elif Item == 0x01:
+ Index = Index + 1
+ Guid = gGuidStringFormat % Depex.Expression[Index]
+ if Guid in self.OrderedFfsDict and Depex.Expression[Index + 1] == 0x08:
+ return (True, 'AFTER %s' % Guid, [Guid, 'AFTER'])
+ elif Item == 0x02:
+ Index = Index + 1
+ Guid = gGuidStringFormat % Depex.Expression[Index]
+ if Guid.lower() in List:
+ DepexStack.append(True)
+ DepexList.append(Guid)
+ else:
+ DepexStack.append(False)
+ DepexList.append(Guid)
+ continue
+ elif Item == 0x03 or Item == 0x04:
+ DepexStack.append(eval(str(DepexStack.pop()) + ' ' + Depex._OPCODE_STRING_[Item].lower() + ' ' + str(DepexStack.pop())))
+ DepexList.append(str(DepexList.pop()) + ' ' + Depex._OPCODE_STRING_[Item].upper() + ' ' + str(DepexList.pop()))
+ elif Item == 0x05:
+ DepexStack.append(eval(Depex._OPCODE_STRING_[Item].lower() + ' ' + str(DepexStack.pop())))
+ DepexList.append(Depex._OPCODE_STRING_[Item].lower() + ' ' + str(DepexList.pop()))
+ elif Item == 0x06:
+ DepexStack.append(True)
+ DepexList.append('TRUE')
+ DepexString = DepexString + 'TRUE' + ' '
+ elif Item == 0x07:
+ DepexStack.append(False)
+ DepexList.append('False')
+ DepexString = DepexString + 'FALSE' + ' '
+ elif Item == 0x08:
+ if Index != len(Depex.Expression) - 1:
+ CouldBeLoaded = False
+ else:
+ CouldBeLoaded = DepexStack.pop()
+ else:
+ CouldBeLoaded = False
+ if DepexList != []:
+ DepexString = DepexList[0].strip()
+ return (CouldBeLoaded, DepexString, FileDepex)
+
+ def Dispatch(self, Db=None):
+ if Db is None:
+ return False
+ self.UnDispatchedFfsDict = copy.copy(self.FfsDict)
+ # Find PeiCore, DexCore, PeiPriori, DxePriori first
+ FfsSecCoreGuid = None
+ FfsPeiCoreGuid = None
+ FfsDxeCoreGuid = None
+ FfsPeiPrioriGuid = None
+ FfsDxePrioriGuid = None
+ for FfsID in list(self.UnDispatchedFfsDict.keys()):
+ Ffs = self.UnDispatchedFfsDict[FfsID]
+ if Ffs.Type == 0x03:
+ FfsSecCoreGuid = FfsID
+ continue
+ if Ffs.Type == 0x04:
+ FfsPeiCoreGuid = FfsID
+ continue
+ if Ffs.Type == 0x05:
+ FfsDxeCoreGuid = FfsID
+ continue
+ if Ffs.Guid.lower() == PEI_APRIORI_GUID.lower():
+ FfsPeiPrioriGuid = FfsID
+ continue
+ if Ffs.Guid.lower() == DXE_APRIORI_GUID.lower():
+ FfsDxePrioriGuid = FfsID
+ continue
+
+ # Parse SEC_CORE first
+ if FfsSecCoreGuid is not None:
+ self.OrderedFfsDict[FfsSecCoreGuid] = self.UnDispatchedFfsDict.pop(FfsSecCoreGuid)
+ self.LoadPpi(Db, FfsSecCoreGuid)
+
+ # Parse PEI first
+ if FfsPeiCoreGuid is not None:
+ self.OrderedFfsDict[FfsPeiCoreGuid] = self.UnDispatchedFfsDict.pop(FfsPeiCoreGuid)
+ self.LoadPpi(Db, FfsPeiCoreGuid)
+ if FfsPeiPrioriGuid is not None:
+ # Load PEIM described in priori file
+ FfsPeiPriori = self.UnDispatchedFfsDict.pop(FfsPeiPrioriGuid)
+ if len(FfsPeiPriori.Sections) == 1:
+ Section = FfsPeiPriori.Sections.popitem()[1]
+ if Section.Type == 0x19:
+ GuidStruct = struct.Struct('1I2H8B')
+ Start = 4
+ while len(Section) > Start:
+ Guid = GuidStruct.unpack_from(Section[Start : Start + 16])
+ GuidString = gGuidStringFormat % Guid
+ Start = Start + 16
+ if GuidString in self.UnDispatchedFfsDict:
+ self.OrderedFfsDict[GuidString] = self.UnDispatchedFfsDict.pop(GuidString)
+ self.LoadPpi(Db, GuidString)
+
+ self.DisPatchPei(Db)
+
+ # Parse DXE then
+ if FfsDxeCoreGuid is not None:
+ self.OrderedFfsDict[FfsDxeCoreGuid] = self.UnDispatchedFfsDict.pop(FfsDxeCoreGuid)
+ self.LoadProtocol(Db, FfsDxeCoreGuid)
+ if FfsDxePrioriGuid is not None:
+ # Load PEIM described in priori file
+ FfsDxePriori = self.UnDispatchedFfsDict.pop(FfsDxePrioriGuid)
+ if len(FfsDxePriori.Sections) == 1:
+ Section = FfsDxePriori.Sections.popitem()[1]
+ if Section.Type == 0x19:
+ GuidStruct = struct.Struct('1I2H8B')
+ Start = 4
+ while len(Section) > Start:
+ Guid = GuidStruct.unpack_from(Section[Start : Start + 16])
+ GuidString = gGuidStringFormat % Guid
+ Start = Start + 16
+ if GuidString in self.UnDispatchedFfsDict:
+ self.OrderedFfsDict[GuidString] = self.UnDispatchedFfsDict.pop(GuidString)
+ self.LoadProtocol(Db, GuidString)
+
+ self.DisPatchDxe(Db)
+
+ def LoadProtocol(self, Db, ModuleGuid):
+ SqlCommand = """select GuidValue from Report
+ where SourceFileFullPath in
+ (select Value1 from Inf where BelongsToFile =
+ (select BelongsToFile from Inf
+ where Value1 = 'FILE_GUID' and Value2 like '%s' and Model = %s)
+ and Model = %s)
+ and ItemType = 'Protocol' and ItemMode = 'Produced'""" \
+ % (ModuleGuid, 5001, 3007)
+ RecordSet = Db.TblReport.Exec(SqlCommand)
+ for Record in RecordSet:
+ SqlCommand = """select Value2 from Inf where BelongsToFile =
+ (select DISTINCT BelongsToFile from Inf
+ where Value1 =
+ (select SourceFileFullPath from Report
+ where GuidValue like '%s' and ItemMode = 'Callback'))
+ and Value1 = 'FILE_GUID'""" % Record[0]
+ CallBackSet = Db.TblReport.Exec(SqlCommand)
+ if CallBackSet != []:
+ EotGlobalData.gProtocolList[Record[0].lower()] = ModuleGuid
+ else:
+ EotGlobalData.gProtocolList[Record[0].lower()] = ModuleGuid
+
+ def LoadPpi(self, Db, ModuleGuid):
+ SqlCommand = """select GuidValue from Report
+ where SourceFileFullPath in
+ (select Value1 from Inf where BelongsToFile =
+ (select BelongsToFile from Inf
+ where Value1 = 'FILE_GUID' and Value2 like '%s' and Model = %s)
+ and Model = %s)
+ and ItemType = 'Ppi' and ItemMode = 'Produced'""" \
+ % (ModuleGuid, 5001, 3007)
+ RecordSet = Db.TblReport.Exec(SqlCommand)
+ for Record in RecordSet:
+ EotGlobalData.gPpiList[Record[0].lower()] = ModuleGuid
+
+ def DisPatchDxe(self, Db):
+ IsInstalled = False
+ ScheduleList = sdict()
+ for FfsID in list(self.UnDispatchedFfsDict.keys()):
+ CouldBeLoaded = False
+ DepexString = ''
+ FileDepex = None
+ Ffs = self.UnDispatchedFfsDict[FfsID]
+ if Ffs.Type == 0x07:
+ # Get Depex
+ IsFoundDepex = False
+ for Section in Ffs.Sections.values():
+ # Find Depex
+ if Section.Type == 0x13:
+ IsFoundDepex = True
+ CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(Section._SubImages[4], 'Protocol')
+ break
+ if Section.Type == 0x01:
+ CompressSections = Section._SubImages[4]
+ for CompressSection in CompressSections.Sections:
+ if CompressSection.Type == 0x13:
+ IsFoundDepex = True
+ CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(CompressSection._SubImages[4], 'Protocol')
+ break
+ if CompressSection.Type == 0x02:
+ NewSections = CompressSection._SubImages[4]
+ for NewSection in NewSections.Sections:
+ if NewSection.Type == 0x13:
+ IsFoundDepex = True
+ CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(NewSection._SubImages[4], 'Protocol')
+ break
+
+ # Not find Depex
+ if not IsFoundDepex:
+ CouldBeLoaded = self.CheckArchProtocol()
+ DepexString = ''
+ FileDepex = None
+
+ # Append New Ffs
+ if CouldBeLoaded:
+ IsInstalled = True
+ NewFfs = self.UnDispatchedFfsDict.pop(FfsID)
+ NewFfs.Depex = DepexString
+ if FileDepex is not None:
+ ScheduleList.insert(FileDepex[1], FfsID, NewFfs, FileDepex[0])
+ else:
+ ScheduleList[FfsID] = NewFfs
+ else:
+ self.UnDispatchedFfsDict[FfsID].Depex = DepexString
+
+ for FfsID in ScheduleList.keys():
+ NewFfs = ScheduleList.pop(FfsID)
+ FfsName = 'UnKnown'
+ self.OrderedFfsDict[FfsID] = NewFfs
+ self.LoadProtocol(Db, FfsID)
+
+ SqlCommand = """select Value2 from Inf
+ where BelongsToFile = (select BelongsToFile from Inf where Value1 = 'FILE_GUID' and lower(Value2) = lower('%s') and Model = %s)
+ and Model = %s and Value1='BASE_NAME'""" % (FfsID, 5001, 5001)
+ RecordSet = Db.TblReport.Exec(SqlCommand)
+ if RecordSet != []:
+ FfsName = RecordSet[0][0]
+
+ if IsInstalled:
+ self.DisPatchDxe(Db)
+
+ def DisPatchPei(self, Db):
+ IsInstalled = False
+ for FfsID in list(self.UnDispatchedFfsDict.keys()):
+ CouldBeLoaded = True
+ DepexString = ''
+ FileDepex = None
+ Ffs = self.UnDispatchedFfsDict[FfsID]
+ if Ffs.Type == 0x06 or Ffs.Type == 0x08:
+ # Get Depex
+ for Section in Ffs.Sections.values():
+ if Section.Type == 0x1B:
+ CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(Section._SubImages[4], 'Ppi')
+ break
+ if Section.Type == 0x01:
+ CompressSections = Section._SubImages[4]
+ for CompressSection in CompressSections.Sections:
+ if CompressSection.Type == 0x1B:
+ CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(CompressSection._SubImages[4], 'Ppi')
+ break
+ if CompressSection.Type == 0x02:
+ NewSections = CompressSection._SubImages[4]
+ for NewSection in NewSections.Sections:
+ if NewSection.Type == 0x1B:
+ CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(NewSection._SubImages[4], 'Ppi')
+ break
+
+ # Append New Ffs
+ if CouldBeLoaded:
+ IsInstalled = True
+ NewFfs = self.UnDispatchedFfsDict.pop(FfsID)
+ NewFfs.Depex = DepexString
+ self.OrderedFfsDict[FfsID] = NewFfs
+ self.LoadPpi(Db, FfsID)
+ else:
+ self.UnDispatchedFfsDict[FfsID].Depex = DepexString
+
+ if IsInstalled:
+ self.DisPatchPei(Db)
+
+
+ def __str__(self):
+ global gIndention
+ gIndention += 4
+ FvInfo = '\n' + ' ' * gIndention
+ FvInfo += "[FV:%s] file_system=%s size=%x checksum=%s\n" % (self.Name, self.FileSystemGuid, self.Size, self.Checksum)
+ FfsInfo = "\n".join([str(self.FfsDict[FfsId]) for FfsId in self.FfsDict])
+ gIndention -= 4
+ return FvInfo + FfsInfo
+
+ def _Unpack(self):
+ Size = self._LENGTH_.unpack_from(self._BUF_, self._OFF_)[0]
+ self.empty()
+ self.extend(self._BUF_[self._OFF_:self._OFF_ + Size])
+
+ # traverse the FFS
+ EndOfFv = Size
+ FfsStartAddress = self.HeaderSize
+ LastFfsObj = None
+ while FfsStartAddress < EndOfFv:
+ FfsObj = Ffs()
+ FfsObj.frombuffer(self, FfsStartAddress)
+ FfsId = repr(FfsObj)
+ if ((self.Attributes & 0x00000800) != 0 and len(FfsObj) == 0xFFFFFF) \
+ or ((self.Attributes & 0x00000800) == 0 and len(FfsObj) == 0):
+ if LastFfsObj is not None:
+ LastFfsObj.FreeSpace = EndOfFv - LastFfsObj._OFF_ - len(LastFfsObj)
+ else:
+ if FfsId in self.FfsDict:
+ EdkLogger.error("FV", 0, "Duplicate GUID in FFS",
+ ExtraData="\t%s @ %s\n\t%s @ %s" \
+ % (FfsObj.Guid, FfsObj.Offset,
+ self.FfsDict[FfsId].Guid, self.FfsDict[FfsId].Offset))
+ self.FfsDict[FfsId] = FfsObj
+ if LastFfsObj is not None:
+ LastFfsObj.FreeSpace = FfsStartAddress - LastFfsObj._OFF_ - len(LastFfsObj)
+
+ FfsStartAddress += len(FfsObj)
+ #
+ # align to next 8-byte aligned address: A = (A + 8 - 1) & (~(8 - 1))
+ # The next FFS must be at the latest next 8-byte aligned address
+ #
+ FfsStartAddress = (FfsStartAddress + 7) & (~7)
+ LastFfsObj = FfsObj
+
+ def _GetAttributes(self):
+ return self.GetField(self._ATTR_, 0)[0]
+
+ def _GetSize(self):
+ return self.GetField(self._LENGTH_, 0)[0]
+
+ def _GetChecksum(self):
+ return self.GetField(self._CHECKSUM_, 0)[0]
+
+ def _GetHeaderLength(self):
+ return self.GetField(self._HLEN_, 0)[0]
+
+ def _GetFileSystemGuid(self):
+ return gGuidStringFormat % self.GetField(self._GUID_, 0)
+
+ Attributes = property(_GetAttributes)
+ Size = property(_GetSize)
+ Checksum = property(_GetChecksum)
+ HeaderSize = property(_GetHeaderLength)
+ FileSystemGuid = property(_GetFileSystemGuid)
+
+## GuidDefinedImage() class
+#
+# A class for GUID Defined Image
+#
+class GuidDefinedImage(Image):
+ _HEADER_ = struct.Struct("1I2H8B 1H 1H")
+ _HEADER_SIZE_ = _HEADER_.size
+
+ _GUID_ = struct.Struct("1I2H8B")
+ _DATA_OFFSET_ = struct.Struct("16x 1H")
+ _ATTR_ = struct.Struct("18x 1H")
+
+ CRC32_GUID = "FC1BCDB0-7D31-49AA-936A-A4600D9DD083"
+ TIANO_COMPRESS_GUID = 'A31280AD-481E-41B6-95E8-127F4C984779'
+ LZMA_COMPRESS_GUID = 'EE4E5898-3914-4259-9D6E-DC7BD79403CF'
+
+ def __init__(self, SectionDefinitionGuid=None, DataOffset=None, Attributes=None, Data=None):
+ Image.__init__(self)
+ if SectionDefinitionGuid is not None:
+ self.SectionDefinitionGuid = SectionDefinitionGuid
+ if DataOffset is not None:
+ self.DataOffset = DataOffset
+ if Attributes is not None:
+ self.Attributes = Attributes
+ if Data is not None:
+ self.Data = Data
+
+ def __str__(self):
+ S = "guid=%s" % (gGuidStringFormat % self.SectionDefinitionGuid)
+ for Sec in self.Sections:
+ S += "\n" + str(Sec)
+ return S
+
+ def _Unpack(self):
+ # keep header in this Image object
+ self.empty()
+ self.extend(self._BUF_[self._OFF_ : self._OFF_ + self._LEN_])
+ return len(self)
+
+ def _SetAttribute(self, Attribute):
+ self.SetField(self._ATTR_, 0, Attribute)
+
+ def _GetAttribute(self):
+ return self.GetField(self._ATTR_)[0]
+
+ def _SetGuid(self, Guid):
+ self.SetField(self._GUID_, 0, Guid)
+
+ def _GetGuid(self):
+ return self.GetField(self._GUID_)
+
+ def _SetDataOffset(self, Offset):
+ self.SetField(self._DATA_OFFSET_, 0, Offset)
+
+ def _GetDataOffset(self):
+ return self.GetField(self._DATA_OFFSET_)[0]
+
+ def _GetSections(self):
+ SectionList = []
+ Guid = gGuidStringFormat % self.SectionDefinitionGuid
+ if Guid == self.CRC32_GUID:
+ # skip the CRC32 value, we don't do CRC32 verification here
+ Offset = self.DataOffset - 4
+ while Offset < len(self):
+ Sec = Section()
+ try:
+ Sec.frombuffer(self, Offset)
+ Offset += Sec.Size
+ # the section is aligned to 4-byte boundary
+ Offset = (Offset + 3) & (~3)
+ except:
+ break
+ SectionList.append(Sec)
+ elif Guid == self.TIANO_COMPRESS_GUID:
+ try:
+ # skip the header
+ Offset = self.DataOffset - 4
+ TmpData = DeCompress('Framework', self[self.Offset:])
+ DecData = array('B')
+ DecData.fromstring(TmpData)
+ Offset = 0
+ while Offset < len(DecData):
+ Sec = Section()
+ try:
+ Sec.frombuffer(DecData, Offset)
+ Offset += Sec.Size
+ # the section is aligned to 4-byte boundary
+ Offset = (Offset + 3) & (~3)
+ except:
+ break
+ SectionList.append(Sec)
+ except:
+ pass
+ elif Guid == self.LZMA_COMPRESS_GUID:
+ try:
+ # skip the header
+ Offset = self.DataOffset - 4
+
+ TmpData = DeCompress('Lzma', self[self.Offset:])
+ DecData = array('B')
+ DecData.fromstring(TmpData)
+ Offset = 0
+ while Offset < len(DecData):
+ Sec = Section()
+ try:
+ Sec.frombuffer(DecData, Offset)
+ Offset += Sec.Size
+ # the section is aligned to 4-byte boundary
+ Offset = (Offset + 3) & (~3)
+ except:
+ break
+ SectionList.append(Sec)
+ except:
+ pass
+
+ return SectionList
+
+ Attributes = property(_GetAttribute, _SetAttribute)
+ SectionDefinitionGuid = property(_GetGuid, _SetGuid)
+ DataOffset = property(_GetDataOffset, _SetDataOffset)
+ Sections = property(_GetSections)
+
+## Section() class
+#
+# A class for Section
+#
+class Section(Image):
+ _TypeName = {
+ 0x00 : "<unknown>",
+ 0x01 : "COMPRESSION",
+ 0x02 : "GUID_DEFINED",
+ 0x10 : "PE32",
+ 0x11 : "PIC",
+ 0x12 : "TE",
+ 0x13 : "DXE_DEPEX",
+ 0x14 : "VERSION",
+ 0x15 : "USER_INTERFACE",
+ 0x16 : "COMPATIBILITY16",
+ 0x17 : "FIRMWARE_VOLUME_IMAGE",
+ 0x18 : "FREEFORM_SUBTYPE_GUID",
+ 0x19 : "RAW",
+ 0x1B : "PEI_DEPEX"
+ }
+
+ _SectionSubImages = {
+ 0x01 : CompressedImage,
+ 0x02 : GuidDefinedImage,
+ 0x17 : FirmwareVolume,
+ 0x13 : Depex,
+ 0x1B : Depex,
+ 0x15 : Ui
+ }
+
+ # Size = 3-byte
+ # Type = 1-byte
+ _HEADER_ = struct.Struct("3B 1B")
+ _HEADER_SIZE_ = _HEADER_.size
+
+ # SubTypeGuid
+ # _FREE_FORM_SUBTYPE_GUID_HEADER_ = struct.Struct("1I2H8B")
+ _SIZE_ = struct.Struct("3B")
+ _TYPE_ = struct.Struct("3x 1B")
+
+ def __init__(self, Type=None, Size=None):
+ Image.__init__(self)
+ self._Alignment = 1
+ if Type is not None:
+ self.Type = Type
+ if Size is not None:
+ self.Size = Size
+
+ def __str__(self):
+ global gIndention
+ gIndention += 4
+ SectionInfo = ' ' * gIndention
+ if self.Type in self._TypeName:
+ SectionInfo += "[SECTION:%s] offset=%x size=%x" % (self._TypeName[self.Type], self._OFF_, self.Size)
+ else:
+ SectionInfo += "[SECTION:%x<unknown>] offset=%x size=%x " % (self.Type, self._OFF_, self.Size)
+ for Offset in self._SubImages.keys():
+ SectionInfo += ", " + str(self._SubImages[Offset])
+ gIndention -= 4
+ return SectionInfo
+
+ def _Unpack(self):
+ self.empty()
+ Type, = self._TYPE_.unpack_from(self._BUF_, self._OFF_)
+ Size1, Size2, Size3 = self._SIZE_.unpack_from(self._BUF_, self._OFF_)
+ Size = Size1 + (Size2 << 8) + (Size3 << 16)
+
+ if Type not in self._SectionSubImages:
+ # no need to extract sub-image, keep all in this Image object
+ self.extend(self._BUF_[self._OFF_ : self._OFF_ + Size])
+ else:
+ # keep header in this Image object
+ self.extend(self._BUF_[self._OFF_ : self._OFF_ + self._HEADER_SIZE_])
+ #
+ # use new Image object to represent payload, which may be another kind
+ # of image such as PE32
+ #
+ PayloadOffset = self._HEADER_SIZE_
+ PayloadLen = self.Size - self._HEADER_SIZE_
+ Payload = self._SectionSubImages[self.Type]()
+ Payload.frombuffer(self._BUF_, self._OFF_ + self._HEADER_SIZE_, PayloadLen)
+ self._SubImages[PayloadOffset] = Payload
+
+ return Size
+
+ def _SetSize(self, Size):
+ Size1 = Size & 0xFF
+ Size2 = (Size & 0xFF00) >> 8
+ Size3 = (Size & 0xFF0000) >> 16
+ self.SetField(self._SIZE_, 0, Size1, Size2, Size3)
+
+ def _GetSize(self):
+ Size1, Size2, Size3 = self.GetField(self._SIZE_)
+ return Size1 + (Size2 << 8) + (Size3 << 16)
+
+ def _SetType(self, Type):
+ self.SetField(self._TYPE_, 0, Type)
+
+ def _GetType(self):
+ return self.GetField(self._TYPE_)[0]
+
+ def _GetAlignment(self):
+ return self._Alignment
+
+ def _SetAlignment(self, Alignment):
+ self._Alignment = Alignment
+ AlignmentMask = Alignment - 1
+ # section alignment is actually for payload, so we need to add header size
+ PayloadOffset = self._OFF_ + self._HEADER_SIZE_
+ if (PayloadOffset & (~AlignmentMask)) == 0:
+ return
+ NewOffset = (PayloadOffset + AlignmentMask) & (~AlignmentMask)
+ while (NewOffset - PayloadOffset) < self._HEADER_SIZE_:
+ NewOffset += self._Alignment
+
+ def tofile(self, f):
+ self.Size = len(self)
+ Image.tofile(self, f)
+ for Offset in self._SubImages:
+ self._SubImages[Offset].tofile(f)
+
+ Type = property(_GetType, _SetType)
+ Size = property(_GetSize, _SetSize)
+ Alignment = property(_GetAlignment, _SetAlignment)
+
+## Ffs() class
+#
+# A class for Ffs Section
+#
+class Ffs(Image):
+ _FfsFormat = "24B%(payload_size)sB"
+ # skip IntegrityCheck
+ _HEADER_ = struct.Struct("1I2H8B 2x 1B 1B 3B 1B")
+ _HEADER_SIZE_ = _HEADER_.size
+
+ _NAME_ = struct.Struct("1I2H8B")
+ _INT_CHECK_ = struct.Struct("16x 1H")
+ _TYPE_ = struct.Struct("18x 1B")
+ _ATTR_ = struct.Struct("19x 1B")
+ _SIZE_ = struct.Struct("20x 3B")
+ _STATE_ = struct.Struct("23x 1B")
+
+ FFS_ATTRIB_FIXED = 0x04
+ FFS_ATTRIB_DATA_ALIGNMENT = 0x38
+ FFS_ATTRIB_CHECKSUM = 0x40
+
+ _TypeName = {
+ 0x00 : "<unknown>",
+ 0x01 : "RAW",
+ 0x02 : "FREEFORM",
+ 0x03 : "SECURITY_CORE",
+ 0x04 : "PEI_CORE",
+ 0x05 : "DXE_CORE",
+ 0x06 : "PEIM",
+ 0x07 : "DRIVER",
+ 0x08 : "COMBINED_PEIM_DRIVER",
+ 0x09 : "APPLICATION",
+ 0x0A : "SMM",
+ 0x0B : "FIRMWARE_VOLUME_IMAGE",
+ 0x0C : "COMBINED_SMM_DXE",
+ 0x0D : "SMM_CORE",
+ 0x0E : "MM_STANDALONE",
+ 0x0F : "MM_CORE_STANDALONE",
+ 0xc0 : "OEM_MIN",
+ 0xdf : "OEM_MAX",
+ 0xe0 : "DEBUG_MIN",
+ 0xef : "DEBUG_MAX",
+ 0xf0 : "FFS_MIN",
+ 0xff : "FFS_MAX",
+ 0xf0 : "FFS_PAD",
+ }
+
+ def __init__(self):
+ Image.__init__(self)
+ self.FreeSpace = 0
+
+ self.Sections = sdict()
+ self.Depex = ''
+
+ self.__ID__ = None
+
+ def __str__(self):
+ global gIndention
+ gIndention += 4
+ Indention = ' ' * gIndention
+ FfsInfo = Indention
+ FfsInfo += "[FFS:%s] offset=%x size=%x guid=%s free_space=%x alignment=%s\n" % \
+ (Ffs._TypeName[self.Type], self._OFF_, self.Size, self.Guid, self.FreeSpace, self.Alignment)
+ SectionInfo = '\n'.join([str(self.Sections[Offset]) for Offset in self.Sections.keys()])
+ gIndention -= 4
+ return FfsInfo + SectionInfo + "\n"
+
+ def __len__(self):
+ return self.Size
+
+ def __repr__(self):
+ return self.__ID__
+
+ def _Unpack(self):
+ Size1, Size2, Size3 = self._SIZE_.unpack_from(self._BUF_, self._OFF_)
+ Size = Size1 + (Size2 << 8) + (Size3 << 16)
+ self.empty()
+ self.extend(self._BUF_[self._OFF_ : self._OFF_ + Size])
+
+ # Pad FFS may use the same GUID. We need to avoid it.
+ if self.Type == 0xf0:
+ self.__ID__ = str(uuid.uuid1()).upper()
+ else:
+ self.__ID__ = self.Guid
+
+ # Traverse the SECTION. RAW and PAD do not have sections
+ if self.Type not in [0xf0, 0x01] and Size > 0 and Size < 0xFFFFFF:
+ EndOfFfs = Size
+ SectionStartAddress = self._HEADER_SIZE_
+ while SectionStartAddress < EndOfFfs:
+ SectionObj = Section()
+ SectionObj.frombuffer(self, SectionStartAddress)
+ #f = open(repr(SectionObj), 'wb')
+ #SectionObj.Size = 0
+ #SectionObj.tofile(f)
+ #f.close()
+ self.Sections[SectionStartAddress] = SectionObj
+ SectionStartAddress += len(SectionObj)
+ SectionStartAddress = (SectionStartAddress + 3) & (~3)
+
+ def Pack(self):
+ pass
+
+ def SetFreeSpace(self, Size):
+ self.FreeSpace = Size
+
+ def _GetGuid(self):
+ return gGuidStringFormat % self.Name
+
+ def _SetName(self, Value):
+ # Guid1, Guid2, Guid3, Guid4, Guid5, Guid6, Guid7, Guid8, Guid9, Guid10, Guid11
+ self.SetField(self._NAME_, 0, Value)
+
+ def _GetName(self):
+ # Guid1, Guid2, Guid3, Guid4, Guid5, Guid6, Guid7, Guid8, Guid9, Guid10, Guid11
+ return self.GetField(self._NAME_)
+
+ def _SetSize(self, Size):
+ Size1 = Size & 0xFF
+ Size2 = (Size & 0xFF00) >> 8
+ Size3 = (Size & 0xFF0000) >> 16
+ self.SetField(self._SIZE_, 0, Size1, Size2, Size3)
+
+ def _GetSize(self):
+ Size1, Size2, Size3 = self.GetField(self._SIZE_)
+ return Size1 + (Size2 << 8) + (Size3 << 16)
+
+ def _SetType(self, Type):
+ self.SetField(self._TYPE_, 0, Type)
+
+ def _GetType(self):
+ return self.GetField(self._TYPE_)[0]
+
+ def _SetAttributes(self, Value):
+ self.SetField(self._ATTR_, 0, Value)
+
+ def _GetAttributes(self):
+ return self.GetField(self._ATTR_)[0]
+
+ def _GetFixed(self):
+ if (self.Attributes & self.FFS_ATTRIB_FIXED) != 0:
+ return True
+ return False
+
+ def _GetCheckSum(self):
+ if (self.Attributes & self.FFS_ATTRIB_CHECKSUM) != 0:
+ return True
+ return False
+
+ def _GetAlignment(self):
+ return (self.Attributes & self.FFS_ATTRIB_DATA_ALIGNMENT) >> 3
+
+ def _SetState(self, Value):
+ self.SetField(self._STATE_, 0, Value)
+
+ def _GetState(self):
+ return self.GetField(self._STATE_)[0]
+
+ Name = property(_GetName, _SetName)
+ Guid = property(_GetGuid)
+ Type = property(_GetType, _SetType)
+ Size = property(_GetSize, _SetSize)
+ Attributes = property(_GetAttributes, _SetAttributes)
+ Fixed = property(_GetFixed)
+ Checksum = property(_GetCheckSum)
+ Alignment = property(_GetAlignment)
+ State = property(_GetState, _SetState)
+
+
+## MultipleFv() class
+#
+# A class for Multiple FV
+#
+class MultipleFv(FirmwareVolume):
+ def __init__(self, FvList):
+ FirmwareVolume.__init__(self)
+ self.BasicInfo = []
+ for FvPath in FvList:
+ Fd = None
+ FvName = os.path.splitext(os.path.split(FvPath)[1])[0]
+ if FvPath.strip():
+ Fd = open(FvPath, 'rb')
+ Buf = array('B')
+ try:
+ Buf.fromfile(Fd, os.path.getsize(FvPath))
+ except EOFError:
+ pass
+
+ Fv = FirmwareVolume(FvName)
+ Fv.frombuffer(Buf, 0, len(Buf))
+
+ self.BasicInfo.append([Fv.Name, Fv.FileSystemGuid, Fv.Size])
+ self.FfsDict.update(Fv.FfsDict)
+
+## Class Eot
+#
+# This class is used to define Eot main entrance
+#
+# @param object: Inherited from object class
+#
+class Eot(object):
+ ## The constructor
+ #
+ # @param self: The object pointer
+ #
+ def __init__(self, CommandLineOption=True, IsInit=True, SourceFileList=None, \
+ IncludeDirList=None, DecFileList=None, GuidList=None, LogFile=None,
+ FvFileList="", MapFileList="", Report='Report.html', Dispatch=None):
+ # Version and Copyright
+ self.VersionNumber = ("0.02" + " " + gBUILD_VERSION)
+ self.Version = "%prog Version " + self.VersionNumber
+ self.Copyright = "Copyright (c) 2008 - 2018, Intel Corporation All rights reserved."
+ self.Report = Report
+
+ self.IsInit = IsInit
+ self.SourceFileList = SourceFileList
+ self.IncludeDirList = IncludeDirList
+ self.DecFileList = DecFileList
+ self.GuidList = GuidList
+ self.LogFile = LogFile
+ self.FvFileList = FvFileList
+ self.MapFileList = MapFileList
+ self.Dispatch = Dispatch
+
+ # Check workspace environment
+ if "EFI_SOURCE" not in os.environ:
+ if "EDK_SOURCE" not in os.environ:
+ pass
+ else:
+ EotGlobalData.gEDK_SOURCE = os.path.normpath(os.getenv("EDK_SOURCE"))
+ else:
+ EotGlobalData.gEFI_SOURCE = os.path.normpath(os.getenv("EFI_SOURCE"))
+ EotGlobalData.gEDK_SOURCE = os.path.join(EotGlobalData.gEFI_SOURCE, 'Edk')
+
+ if "WORKSPACE" not in os.environ:
+ EdkLogger.error("EOT", BuildToolError.ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",
+ ExtraData="WORKSPACE")
+ else:
+ EotGlobalData.gWORKSPACE = os.path.normpath(os.getenv("WORKSPACE"))
+
+ EotGlobalData.gMACRO['WORKSPACE'] = EotGlobalData.gWORKSPACE
+ EotGlobalData.gMACRO['EFI_SOURCE'] = EotGlobalData.gEFI_SOURCE
+ EotGlobalData.gMACRO['EDK_SOURCE'] = EotGlobalData.gEDK_SOURCE
+
+ # Parse the options and args
+ if CommandLineOption:
+ self.ParseOption()
+
+ if self.FvFileList:
+ for FvFile in GetSplitValueList(self.FvFileList, ' '):
+ FvFile = os.path.normpath(FvFile)
+ if not os.path.isfile(FvFile):
+ EdkLogger.error("Eot", EdkLogger.EOT_ERROR, "Can not find file %s " % FvFile)
+ EotGlobalData.gFV_FILE.append(FvFile)
+ else:
+ EdkLogger.error("Eot", EdkLogger.EOT_ERROR, "The fv file list of target platform was not specified")
+
+ if self.MapFileList:
+ for MapFile in GetSplitValueList(self.MapFileList, ' '):
+ MapFile = os.path.normpath(MapFile)
+ if not os.path.isfile(MapFile):
+ EdkLogger.error("Eot", EdkLogger.EOT_ERROR, "Can not find file %s " % MapFile)
+ EotGlobalData.gMAP_FILE.append(MapFile)
+
+ # Generate source file list
+ self.GenerateSourceFileList(self.SourceFileList, self.IncludeDirList)
+
+ # Generate guid list of dec file list
+ self.ParseDecFile(self.DecFileList)
+
+ # Generate guid list from GUID list file
+ self.ParseGuidList(self.GuidList)
+
+ # Init Eot database
+ EotGlobalData.gDb = Database.Database(Database.DATABASE_PATH)
+ EotGlobalData.gDb.InitDatabase(self.IsInit)
+
+ # Build ECC database
+ self.BuildDatabase()
+
+ # Parse Ppi/Protocol
+ self.ParseExecutionOrder()
+
+ # Merge Identifier tables
+ self.GenerateQueryTable()
+
+ # Generate report database
+ self.GenerateReportDatabase()
+
+ # Load Fv Info
+ self.LoadFvInfo()
+
+ # Load Map Info
+ self.LoadMapInfo()
+
+ # Generate Report
+ self.GenerateReport()
+
+ # Convert log file
+ self.ConvertLogFile(self.LogFile)
+
+ # DONE
+ EdkLogger.quiet("EOT FINISHED!")
+
+ # Close Database
+ EotGlobalData.gDb.Close()
+
+ ## ParseDecFile() method
+ #
+ # parse DEC file and get all GUID names with GUID values as {GuidName : GuidValue}
+ # The Dict is stored in EotGlobalData.gGuidDict
+ #
+ # @param self: The object pointer
+ # @param DecFileList: A list of all DEC files
+ #
+ def ParseDecFile(self, DecFileList):
+ if DecFileList:
+ path = os.path.normpath(DecFileList)
+ lfr = open(path, 'rb')
+ for line in lfr:
+ path = os.path.normpath(os.path.join(EotGlobalData.gWORKSPACE, line.strip()))
+ if os.path.exists(path):
+ dfr = open(path, 'rb')
+ for line in dfr:
+ line = CleanString(line)
+ list = line.split('=')
+ if len(list) == 2:
+ EotGlobalData.gGuidDict[list[0].strip()] = GuidStructureStringToGuidString(list[1].strip())
+
+
+ ## ParseGuidList() method
+ #
+ # Parse Guid list and get all GUID names with GUID values as {GuidName : GuidValue}
+ # The Dict is stored in EotGlobalData.gGuidDict
+ #
+ # @param self: The object pointer
+ # @param GuidList: A list of all GUID and its value
+ #
+ def ParseGuidList(self, GuidList):
+ Path = os.path.join(EotGlobalData.gWORKSPACE, GuidList)
+ if os.path.isfile(Path):
+ for Line in open(Path):
+ if Line.strip():
+ (GuidName, GuidValue) = Line.split()
+ EotGlobalData.gGuidDict[GuidName] = GuidValue
+
+ ## ConvertLogFile() method
+ #
+ # Parse a real running log file to get real dispatch order
+ # The result is saved to old file name + '.new'
+ #
+ # @param self: The object pointer
+ # @param LogFile: A real running log file name
+ #
+ def ConvertLogFile(self, LogFile):
+ newline = []
+ lfr = None
+ lfw = None
+ if LogFile:
+ lfr = open(LogFile, 'rb')
+ lfw = open(LogFile + '.new', 'wb')
+ for line in lfr:
+ line = line.strip()
+ line = line.replace('.efi', '')
+ index = line.find("Loading PEIM at ")
+ if index > -1:
+ newline.append(line[index + 55 : ])
+ continue
+ index = line.find("Loading driver at ")
+ if index > -1:
+ newline.append(line[index + 57 : ])
+ continue
+
+ for line in newline:
+ lfw.write(line + '\r\n')
+
+ if lfr:
+ lfr.close()
+ if lfw:
+ lfw.close()
+
+ ## GenerateSourceFileList() method
+ #
+ # Generate a list of all source files
+ # 1. Search the file list one by one
+ # 2. Store inf file name with source file names under it like
+ # { INF file name: [source file1, source file2, ...]}
+ # 3. Search the include list to find all .h files
+ # 4. Store source file list to EotGlobalData.gSOURCE_FILES
+ # 5. Store INF file list to EotGlobalData.gINF_FILES
+ #
+ # @param self: The object pointer
+ # @param SourceFileList: A list of all source files
+ # @param IncludeFileList: A list of all include files
+ #
+ def GenerateSourceFileList(self, SourceFileList, IncludeFileList):
+ EdkLogger.quiet("Generating source files list ... ")
+ mSourceFileList = []
+ mInfFileList = []
+ mDecFileList = []
+ mFileList = {}
+ mCurrentInfFile = ''
+ mCurrentSourceFileList = []
+
+ if SourceFileList:
+ sfl = open(SourceFileList, 'r')
+ for line in sfl:
+ line = os.path.normpath(os.path.join(EotGlobalData.gWORKSPACE, line.strip()))
+ if line[-2:].upper() == '.C' or line[-2:].upper() == '.H':
+ if line not in mCurrentSourceFileList:
+ mCurrentSourceFileList.append(line)
+ mSourceFileList.append(line)
+ EotGlobalData.gOP_SOURCE_FILES.write('%s\n' % line)
+ if line[-4:].upper() == '.INF':
+ if mCurrentInfFile != '':
+ mFileList[mCurrentInfFile] = mCurrentSourceFileList
+ mCurrentSourceFileList = []
+ mCurrentInfFile = os.path.normpath(os.path.join(EotGlobalData.gWORKSPACE, line))
+ EotGlobalData.gOP_INF.write('%s\n' % mCurrentInfFile)
+ if mCurrentInfFile not in mFileList:
+ mFileList[mCurrentInfFile] = mCurrentSourceFileList
+
+ # Get all include files from packages
+ if IncludeFileList:
+ ifl = open(IncludeFileList, 'rb')
+ for line in ifl:
+ if not line.strip():
+ continue
+ newline = os.path.normpath(os.path.join(EotGlobalData.gWORKSPACE, line.strip()))
+ for Root, Dirs, Files in os.walk(str(newline)):
+ for File in Files:
+ FullPath = os.path.normpath(os.path.join(Root, File))
+ if FullPath not in mSourceFileList and File[-2:].upper() == '.H':
+ mSourceFileList.append(FullPath)
+ EotGlobalData.gOP_SOURCE_FILES.write('%s\n' % FullPath)
+ if FullPath not in mDecFileList and File.upper().find('.DEC') > -1:
+ mDecFileList.append(FullPath)
+
+ EotGlobalData.gSOURCE_FILES = mSourceFileList
+ EotGlobalData.gOP_SOURCE_FILES.close()
+
+ EotGlobalData.gINF_FILES = mFileList
+ EotGlobalData.gOP_INF.close()
+
+ ## GenerateReport() method
+ #
+ # Generate final HTML report
+ #
+ # @param self: The object pointer
+ #
+ def GenerateReport(self):
+ EdkLogger.quiet("Generating report file ... ")
+ Rep = Report(self.Report, EotGlobalData.gFV, self.Dispatch)
+ Rep.GenerateReport()
+
+ ## LoadMapInfo() method
+ #
+ # Load map files and parse them
+ #
+ # @param self: The object pointer
+ #
+ def LoadMapInfo(self):
+ if EotGlobalData.gMAP_FILE != []:
+ EdkLogger.quiet("Parsing Map file ... ")
+ EotGlobalData.gMap = ParseMapFile(EotGlobalData.gMAP_FILE)
+
+ ## LoadFvInfo() method
+ #
+ # Load FV binary files and parse them
+ #
+ # @param self: The object pointer
+ #
+ def LoadFvInfo(self):
+ EdkLogger.quiet("Parsing FV file ... ")
+ EotGlobalData.gFV = MultipleFv(EotGlobalData.gFV_FILE)
+ EotGlobalData.gFV.Dispatch(EotGlobalData.gDb)
+
+ for Protocol in EotGlobalData.gProtocolList:
+ EotGlobalData.gOP_UN_MATCHED_IN_LIBRARY_CALLING.write('%s\n' %Protocol)
+
+ ## GenerateReportDatabase() method
+ #
+ # Generate data for the information needed by report
+ # 1. Update name, macro and value of all found PPI/PROTOCOL GUID
+ # 2. Install hard coded PPI/PROTOCOL
+ #
+ # @param self: The object pointer
+ #
+ def GenerateReportDatabase(self):
+ EdkLogger.quiet("Generating the cross-reference table of GUID for Ppi/Protocol ... ")
+
+ # Update Protocol/Ppi Guid
+ SqlCommand = """select DISTINCT GuidName from Report"""
+ RecordSet = EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ for Record in RecordSet:
+ GuidName = Record[0]
+ GuidMacro = ''
+ GuidMacro2 = ''
+ GuidValue = ''
+
+ # Find guid value defined in Dec file
+ if GuidName in EotGlobalData.gGuidDict:
+ GuidValue = EotGlobalData.gGuidDict[GuidName]
+ SqlCommand = """update Report set GuidMacro = '%s', GuidValue = '%s' where GuidName = '%s'""" %(GuidMacro, GuidValue, GuidName)
+ EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ continue
+
+ # Search defined Macros for guid name
+ SqlCommand ="""select DISTINCT Value, Modifier from Query where Name like '%s'""" % GuidName
+ GuidMacroSet = EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ # Ignore NULL result
+ if not GuidMacroSet:
+ continue
+ GuidMacro = GuidMacroSet[0][0].strip()
+ if not GuidMacro:
+ continue
+ # Find Guid value of Guid Macro
+ SqlCommand ="""select DISTINCT Value from Query2 where Value like '%%%s%%' and Model = %s""" % (GuidMacro, MODEL_IDENTIFIER_MACRO_DEFINE)
+ GuidValueSet = EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ if GuidValueSet != []:
+ GuidValue = GuidValueSet[0][0]
+ GuidValue = GuidValue[GuidValue.find(GuidMacro) + len(GuidMacro) :]
+ GuidValue = GuidValue.lower().replace('\\', '').replace('\r', '').replace('\n', '').replace('l', '').strip()
+ GuidValue = GuidStructureStringToGuidString(GuidValue)
+ SqlCommand = """update Report set GuidMacro = '%s', GuidValue = '%s' where GuidName = '%s'""" %(GuidMacro, GuidValue, GuidName)
+ EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ continue
+
+ # Update Hard Coded Ppi/Protocol
+ SqlCommand = """select DISTINCT GuidValue, ItemType from Report where ModuleID = -2 and ItemMode = 'Produced'"""
+ RecordSet = EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ for Record in RecordSet:
+ if Record[1] == 'Ppi':
+ EotGlobalData.gPpiList[Record[0].lower()] = -2
+ if Record[1] == 'Protocol':
+ EotGlobalData.gProtocolList[Record[0].lower()] = -2
+
+ ## GenerateQueryTable() method
+ #
+ # Generate two tables improve query performance
+ #
+ # @param self: The object pointer
+ #
+ def GenerateQueryTable(self):
+ EdkLogger.quiet("Generating temp query table for analysis ... ")
+ for Identifier in EotGlobalData.gIdentifierTableList:
+ SqlCommand = """insert into Query (Name, Modifier, Value, Model)
+ select Name, Modifier, Value, Model from %s where (Model = %s or Model = %s)""" \
+ % (Identifier[0], MODEL_IDENTIFIER_VARIABLE, MODEL_IDENTIFIER_ASSIGNMENT_EXPRESSION)
+ EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ SqlCommand = """insert into Query2 (Name, Modifier, Value, Model)
+ select Name, Modifier, Value, Model from %s where Model = %s""" \
+ % (Identifier[0], MODEL_IDENTIFIER_MACRO_DEFINE)
+ EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+
+ ## ParseExecutionOrder() method
+ #
+ # Get final execution order
+ # 1. Search all PPI
+ # 2. Search all PROTOCOL
+ #
+ # @param self: The object pointer
+ #
+ def ParseExecutionOrder(self):
+ EdkLogger.quiet("Searching Ppi/Protocol ... ")
+ for Identifier in EotGlobalData.gIdentifierTableList:
+ ModuleID, ModuleName, ModuleGuid, SourceFileID, SourceFileFullPath, ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue, BelongsToFunction, Enabled = \
+ -1, '', '', -1, '', '', '', '', '', '', '', '', 0
+
+ SourceFileID = Identifier[0].replace('Identifier', '')
+ SourceFileFullPath = Identifier[1]
+ Identifier = Identifier[0]
+
+ # Find Ppis
+ ItemMode = 'Produced'
+ SqlCommand = """select Value, Name, BelongsToFile, StartLine, EndLine from %s
+ where (Name like '%%%s%%' or Name like '%%%s%%' or Name like '%%%s%%') and Model = %s""" \
+ % (Identifier, '.InstallPpi', '->InstallPpi', 'PeiInstallPpi', MODEL_IDENTIFIER_FUNCTION_CALLING)
+ SearchPpi(SqlCommand, Identifier, SourceFileID, SourceFileFullPath, ItemMode)
+
+ ItemMode = 'Produced'
+ SqlCommand = """select Value, Name, BelongsToFile, StartLine, EndLine from %s
+ where (Name like '%%%s%%' or Name like '%%%s%%') and Model = %s""" \
+ % (Identifier, '.ReInstallPpi', '->ReInstallPpi', MODEL_IDENTIFIER_FUNCTION_CALLING)
+ SearchPpi(SqlCommand, Identifier, SourceFileID, SourceFileFullPath, ItemMode, 2)
+
+ SearchPpiCallFunction(Identifier, SourceFileID, SourceFileFullPath, ItemMode)
+
+ ItemMode = 'Consumed'
+ SqlCommand = """select Value, Name, BelongsToFile, StartLine, EndLine from %s
+ where (Name like '%%%s%%' or Name like '%%%s%%') and Model = %s""" \
+ % (Identifier, '.LocatePpi', '->LocatePpi', MODEL_IDENTIFIER_FUNCTION_CALLING)
+ SearchPpi(SqlCommand, Identifier, SourceFileID, SourceFileFullPath, ItemMode)
+
+ SearchFunctionCalling(Identifier, SourceFileID, SourceFileFullPath, 'Ppi', ItemMode)
+
+ ItemMode = 'Callback'
+ SqlCommand = """select Value, Name, BelongsToFile, StartLine, EndLine from %s
+ where (Name like '%%%s%%' or Name like '%%%s%%') and Model = %s""" \
+ % (Identifier, '.NotifyPpi', '->NotifyPpi', MODEL_IDENTIFIER_FUNCTION_CALLING)
+ SearchPpi(SqlCommand, Identifier, SourceFileID, SourceFileFullPath, ItemMode)
+
+ # Find Protocols
+ ItemMode = 'Produced'
+ SqlCommand = """select Value, Name, BelongsToFile, StartLine, EndLine from %s
+ where (Name like '%%%s%%' or Name like '%%%s%%' or Name like '%%%s%%' or Name like '%%%s%%') and Model = %s""" \
+ % (Identifier, '.InstallProtocolInterface', '.ReInstallProtocolInterface', '->InstallProtocolInterface', '->ReInstallProtocolInterface', MODEL_IDENTIFIER_FUNCTION_CALLING)
+ SearchProtocols(SqlCommand, Identifier, SourceFileID, SourceFileFullPath, ItemMode, 1)
+
+ SqlCommand = """select Value, Name, BelongsToFile, StartLine, EndLine from %s
+ where (Name like '%%%s%%' or Name like '%%%s%%') and Model = %s""" \
+ % (Identifier, '.InstallMultipleProtocolInterfaces', '->InstallMultipleProtocolInterfaces', MODEL_IDENTIFIER_FUNCTION_CALLING)
+ SearchProtocols(SqlCommand, Identifier, SourceFileID, SourceFileFullPath, ItemMode, 2)
+
+ SearchFunctionCalling(Identifier, SourceFileID, SourceFileFullPath, 'Protocol', ItemMode)
+
+ ItemMode = 'Consumed'
+ SqlCommand = """select Value, Name, BelongsToFile, StartLine, EndLine from %s
+ where (Name like '%%%s%%' or Name like '%%%s%%') and Model = %s""" \
+ % (Identifier, '.LocateProtocol', '->LocateProtocol', MODEL_IDENTIFIER_FUNCTION_CALLING)
+ SearchProtocols(SqlCommand, Identifier, SourceFileID, SourceFileFullPath, ItemMode, 0)
+
+ SqlCommand = """select Value, Name, BelongsToFile, StartLine, EndLine from %s
+ where (Name like '%%%s%%' or Name like '%%%s%%') and Model = %s""" \
+ % (Identifier, '.HandleProtocol', '->HandleProtocol', MODEL_IDENTIFIER_FUNCTION_CALLING)
+ SearchProtocols(SqlCommand, Identifier, SourceFileID, SourceFileFullPath, ItemMode, 1)
+
+ SearchFunctionCalling(Identifier, SourceFileID, SourceFileFullPath, 'Protocol', ItemMode)
+
+ ItemMode = 'Callback'
+ SqlCommand = """select Value, Name, BelongsToFile, StartLine, EndLine from %s
+ where (Name like '%%%s%%' or Name like '%%%s%%') and Model = %s""" \
+ % (Identifier, '.RegisterProtocolNotify', '->RegisterProtocolNotify', MODEL_IDENTIFIER_FUNCTION_CALLING)
+ SearchProtocols(SqlCommand, Identifier, SourceFileID, SourceFileFullPath, ItemMode, 0)
+
+ SearchFunctionCalling(Identifier, SourceFileID, SourceFileFullPath, 'Protocol', ItemMode)
+
+ # Hard Code
+ EotGlobalData.gDb.TblReport.Insert(-2, '', '', -1, '', '', 'Ppi', 'Produced', 'gEfiSecPlatformInformationPpiGuid', '', '', '', 0)
+ EotGlobalData.gDb.TblReport.Insert(-2, '', '', -1, '', '', 'Ppi', 'Produced', 'gEfiNtLoadAsDllPpiGuid', '', '', '', 0)
+ EotGlobalData.gDb.TblReport.Insert(-2, '', '', -1, '', '', 'Ppi', 'Produced', 'gNtPeiLoadFileGuid', '', '', '', 0)
+ EotGlobalData.gDb.TblReport.Insert(-2, '', '', -1, '', '', 'Ppi', 'Produced', 'gPeiNtAutoScanPpiGuid', '', '', '', 0)
+ EotGlobalData.gDb.TblReport.Insert(-2, '', '', -1, '', '', 'Ppi', 'Produced', 'gNtFwhPpiGuid', '', '', '', 0)
+ EotGlobalData.gDb.TblReport.Insert(-2, '', '', -1, '', '', 'Ppi', 'Produced', 'gPeiNtThunkPpiGuid', '', '', '', 0)
+ EotGlobalData.gDb.TblReport.Insert(-2, '', '', -1, '', '', 'Ppi', 'Produced', 'gPeiPlatformTypePpiGuid', '', '', '', 0)
+ EotGlobalData.gDb.TblReport.Insert(-2, '', '', -1, '', '', 'Ppi', 'Produced', 'gPeiFrequencySelectionCpuPpiGuid', '', '', '', 0)
+ EotGlobalData.gDb.TblReport.Insert(-2, '', '', -1, '', '', 'Ppi', 'Produced', 'gPeiCachePpiGuid', '', '', '', 0)
+
+ EotGlobalData.gDb.Conn.commit()
+
+
+ ## BuildDatabase() methoc
+ #
+ # Build the database for target
+ #
+ # @param self: The object pointer
+ #
+ def BuildDatabase(self):
+ # Clean report table
+ EotGlobalData.gDb.TblReport.Drop()
+ EotGlobalData.gDb.TblReport.Create()
+
+ # Build database
+ if self.IsInit:
+ self.BuildMetaDataFileDatabase(EotGlobalData.gINF_FILES)
+ EdkLogger.quiet("Building database for source code ...")
+ c.CreateCCodeDB(EotGlobalData.gSOURCE_FILES)
+ EdkLogger.quiet("Building database for source code done!")
+
+ EotGlobalData.gIdentifierTableList = GetTableList((MODEL_FILE_C, MODEL_FILE_H), 'Identifier', EotGlobalData.gDb)
+
+ ## BuildMetaDataFileDatabase() method
+ #
+ # Build the database for meta data files
+ #
+ # @param self: The object pointer
+ # @param Inf_Files: A list for all INF files
+ #
+ def BuildMetaDataFileDatabase(self, Inf_Files):
+ EdkLogger.quiet("Building database for meta data files ...")
+ for InfFile in Inf_Files:
+ if not InfFile:
+ continue
+ EdkLogger.quiet("Parsing %s ..." % str(InfFile))
+ EdkInfParser(InfFile, EotGlobalData.gDb, Inf_Files[InfFile])
+
+ EotGlobalData.gDb.Conn.commit()
+ EdkLogger.quiet("Building database for meta data files done!")
+
+ ## ParseOption() method
+ #
+ # Parse command line options
+ #
+ # @param self: The object pointer
+ #
+ def ParseOption(self):
+ (Options, Target) = self.EotOptionParser()
+
+ # Set log level
+ self.SetLogLevel(Options)
+
+ if Options.FvFileList:
+ self.FvFileList = Options.FvFileList
+
+ if Options.MapFileList:
+ self.MapFileList = Options.FvMapFileList
+
+ if Options.SourceFileList:
+ self.SourceFileList = Options.SourceFileList
+
+ if Options.IncludeDirList:
+ self.IncludeDirList = Options.IncludeDirList
+
+ if Options.DecFileList:
+ self.DecFileList = Options.DecFileList
+
+ if Options.GuidList:
+ self.GuidList = Options.GuidList
+
+ if Options.LogFile:
+ self.LogFile = Options.LogFile
+
+ if Options.keepdatabase:
+ self.IsInit = False
+
+ ## SetLogLevel() method
+ #
+ # Set current log level of the tool based on args
+ #
+ # @param self: The object pointer
+ # @param Option: The option list including log level setting
+ #
+ def SetLogLevel(self, Option):
+ if Option.verbose is not None:
+ EdkLogger.SetLevel(EdkLogger.VERBOSE)
+ elif Option.quiet is not None:
+ EdkLogger.SetLevel(EdkLogger.QUIET)
+ elif Option.debug is not None:
+ EdkLogger.SetLevel(Option.debug + 1)
+ else:
+ EdkLogger.SetLevel(EdkLogger.INFO)
+
+ ## EotOptionParser() method
+ #
+ # Using standard Python module optparse to parse command line option of this tool.
+ #
+ # @param self: The object pointer
+ #
+ # @retval Opt A optparse.Values object containing the parsed options
+ # @retval Args Target of build command
+ #
+ def EotOptionParser(self):
+ Parser = OptionParser(description = self.Copyright, version = self.Version, prog = "Eot.exe", usage = "%prog [options]")
+ Parser.add_option("-m", "--makefile filename", action="store", type="string", dest='MakeFile',
+ help="Specify a makefile for the platform.")
+ Parser.add_option("-c", "--dsc filename", action="store", type="string", dest="DscFile",
+ help="Specify a dsc file for the platform.")
+ Parser.add_option("-f", "--fv filename", action="store", type="string", dest="FvFileList",
+ help="Specify fv file list, quoted by \"\".")
+ Parser.add_option("-a", "--map filename", action="store", type="string", dest="MapFileList",
+ help="Specify map file list, quoted by \"\".")
+ Parser.add_option("-s", "--source files", action="store", type="string", dest="SourceFileList",
+ help="Specify source file list by a file")
+ Parser.add_option("-i", "--include dirs", action="store", type="string", dest="IncludeDirList",
+ help="Specify include dir list by a file")
+ Parser.add_option("-e", "--dec files", action="store", type="string", dest="DecFileList",
+ help="Specify dec file list by a file")
+ Parser.add_option("-g", "--guid list", action="store", type="string", dest="GuidList",
+ help="Specify guid file list by a file")
+ Parser.add_option("-l", "--log filename", action="store", type="string", dest="LogFile",
+ help="Specify real execution log file")
+
+ Parser.add_option("-k", "--keepdatabase", action="store_true", type=None, help="The existing Eot database will not be cleaned except report information if this option is specified.")
+
+ Parser.add_option("-q", "--quiet", action="store_true", type=None, help="Disable all messages except FATAL ERRORS.")
+ Parser.add_option("-v", "--verbose", action="store_true", type=None, help="Turn on verbose output with informational messages printed, "\
+ "including library instances selected, final dependency expression, "\
+ "and warning messages, etc.")
+ Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
+
+ (Opt, Args)=Parser.parse_args()
+
+ return (Opt, Args)
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ # Initialize log system
+ EdkLogger.Initialize()
+ EdkLogger.IsRaiseError = False
+ EdkLogger.quiet(time.strftime("%H:%M:%S, %b.%d %Y ", time.localtime()) + "[00:00]" + "\n")
+
+ StartTime = time.clock()
+ Eot = Eot(CommandLineOption=False,
+ SourceFileList=r'C:\TestEot\Source.txt',
+ GuidList=r'C:\TestEot\Guid.txt',
+ FvFileList=r'C:\TestEot\FVRECOVERY.Fv')
+ FinishTime = time.clock()
+
+ BuildDuration = time.strftime("%M:%S", time.gmtime(int(round(FinishTime - StartTime))))
+ EdkLogger.quiet("\n%s [%s]" % (time.strftime("%H:%M:%S, %b.%d %Y", time.localtime()), BuildDuration))
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/EotToolError.py b/roms/edk2/BaseTools/Source/Python/Eot/EotToolError.py
new file mode 100644
index 000000000..d4f4f3a18
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/EotToolError.py
@@ -0,0 +1,15 @@
+## @file
+# Standardized Error Handling infrastructures.
+#
+# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+# Error id
+ERROR_1 = 1000
+
+# Error message
+gEccErrorMessage = {
+ ERROR_1 : "RESERVED"
+ }
+
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/FileProfile.py b/roms/edk2/BaseTools/Source/Python/Eot/FileProfile.py
new file mode 100644
index 000000000..1f3ec156d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/FileProfile.py
@@ -0,0 +1,54 @@
+## @file
+# fragments of source file
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+
+from __future__ import absolute_import
+import re
+import Common.LongFilePathOs as os
+from .ParserWarning import Warning
+from Common.LongFilePathSupport import OpenLongFilePath as open
+
+# Profile contents of a file
+PPDirectiveList = []
+AssignmentExpressionList = []
+PredicateExpressionList = []
+FunctionDefinitionList = []
+VariableDeclarationList = []
+EnumerationDefinitionList = []
+StructUnionDefinitionList = []
+TypedefDefinitionList = []
+FunctionCallingList = []
+
+## Class FileProfile
+#
+# record file data when parsing source
+#
+# May raise Exception when opening file.
+#
+class FileProfile :
+
+ ## The constructor
+ #
+ # @param self: The object pointer
+ # @param FileName: The file that to be parsed
+ #
+ def __init__(self, FileName):
+ self.FileLinesList = []
+ self.FileLinesListFromFile = []
+ try:
+ fsock = open(FileName, "rb", 0)
+ try:
+ self.FileLinesListFromFile = fsock.readlines()
+ finally:
+ fsock.close()
+
+ except IOError:
+ raise Warning("Error when opening file %s" % FileName)
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/Identification.py b/roms/edk2/BaseTools/Source/Python/Eot/Identification.py
new file mode 100644
index 000000000..31d47602e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/Identification.py
@@ -0,0 +1,52 @@
+## @file
+# This file is used to define the identification of INF/DEC/DSC files
+#
+# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+## Identification
+#
+# This class defined basic Identification information structure which is used by INF/DEC/DSC files
+#
+# @param object: Inherited from object class
+#
+# @var FileName: To store data for Filename
+# @var FileFullPath: To store data for full path of the file
+# @var FileRelativePath: To store data for relative path of the file
+# @var RunStatus: Status of build system running
+#
+class Identification(object):
+ def __init__(self):
+ self.FileName = ''
+ self.FileFullPath = ''
+ self.FileRelativePath = ''
+ self.PackagePath = ''
+
+ ## GetFileName
+ #
+ # Reserved
+ #
+ def GetFileName(self, FileFullPath, FileRelativePath):
+ pass
+
+ ## GetFileName
+ #
+ # Reserved
+ #
+ def GetFileFullPath(self, FileName, FileRelativePath):
+ pass
+
+ ## GetFileName
+ #
+ # Reserved
+ #
+ def GetFileRelativePath(self, FileName, FileFullPath):
+ pass
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ id = Identification()
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/InfParserLite.py b/roms/edk2/BaseTools/Source/Python/Eot/InfParserLite.py
new file mode 100644
index 000000000..2c6bc50b6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/InfParserLite.py
@@ -0,0 +1,148 @@
+## @file
+# This file is used to parse INF file of EDK project
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+
+import Common.LongFilePathOs as os
+import Common.EdkLogger as EdkLogger
+from Common.DataType import *
+from CommonDataClass.DataClass import *
+from Eot.Identification import Identification
+from Common.StringUtils import *
+from Eot.Parser import *
+from Eot import Database
+from Eot import EotGlobalData
+
+## EdkInfParser() class
+#
+# This class defined basic INF object which is used by inheriting
+#
+# @param object: Inherited from object class
+#
+class EdkInfParser(object):
+ ## The constructor
+ #
+ # @param self: The object pointer
+ # @param Filename: INF file name
+ # @param Database: Eot database
+ # @param SourceFileList: A list for all source file belonging this INF file
+ #
+ def __init__(self, Filename = None, Database = None, SourceFileList = None):
+ self.Identification = Identification()
+ self.Sources = []
+ self.Macros = {}
+
+ self.Cur = Database.Cur
+ self.TblFile = Database.TblFile
+ self.TblInf = Database.TblInf
+ self.FileID = -1
+
+ # Load Inf file if filename is not None
+ if Filename is not None:
+ self.LoadInfFile(Filename)
+
+ if SourceFileList:
+ for Item in SourceFileList:
+ self.TblInf.Insert(MODEL_EFI_SOURCE_FILE, Item, '', '', '', '', 'COMMON', -1, self.FileID, -1, -1, -1, -1, 0)
+
+
+ ## LoadInffile() method
+ #
+ # Load INF file and insert a record in database
+ #
+ # @param self: The object pointer
+ # @param Filename: Input value for filename of Inf file
+ #
+ def LoadInfFile(self, Filename = None):
+ # Insert a record for file
+ Filename = NormPath(Filename)
+ self.Identification.FileFullPath = Filename
+ (self.Identification.FileRelativePath, self.Identification.FileName) = os.path.split(Filename)
+
+ self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_INF)
+
+ self.ParseInf(PreProcess(Filename, False), self.Identification.FileRelativePath, Filename)
+
+ ## ParserSource() method
+ #
+ # Parse Source section and insert records in database
+ #
+ # @param self: The object pointer
+ # @param CurrentSection: current section name
+ # @param SectionItemList: the item belonging current section
+ # @param ArchList: A list for arch for this section
+ # @param ThirdList: A list for third item for this section
+ #
+ def ParserSource(self, CurrentSection, SectionItemList, ArchList, ThirdList):
+ for Index in range(0, len(ArchList)):
+ Arch = ArchList[Index]
+ Third = ThirdList[Index]
+ if Arch == '':
+ Arch = TAB_ARCH_COMMON
+
+ for Item in SectionItemList:
+ if CurrentSection.upper() == 'defines'.upper():
+ (Name, Value) = AddToSelfMacro(self.Macros, Item[0])
+ self.TblInf.Insert(MODEL_META_DATA_HEADER, Name, Value, Third, '', '', Arch, -1, self.FileID, Item[1], -1, Item[1], -1, 0)
+
+ ## ParseInf() method
+ #
+ # Parse INF file and get sections information
+ #
+ # @param self: The object pointer
+ # @param Lines: contents of INF file
+ # @param FileRelativePath: relative path of the file
+ # @param Filename: file name of INF file
+ #
+ def ParseInf(self, Lines = [], FileRelativePath = '', Filename = ''):
+ IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \
+ [], [], TAB_UNKNOWN, [], [], []
+ LineNo = 0
+
+ for Line in Lines:
+ LineNo = LineNo + 1
+ if Line == '':
+ continue
+ if Line.startswith(TAB_SECTION_START) and Line.endswith(TAB_SECTION_END):
+ self.ParserSource(CurrentSection, SectionItemList, ArchList, ThirdList)
+
+ # Parse the new section
+ SectionItemList = []
+ ArchList = []
+ ThirdList = []
+ # Parse section name
+ CurrentSection = ''
+ LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT)
+ for Item in LineList:
+ ItemList = GetSplitValueList(Item, TAB_SPLIT)
+ if CurrentSection == '':
+ CurrentSection = ItemList[0]
+ else:
+ if CurrentSection != ItemList[0]:
+ EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo)
+ ItemList.append('')
+ ItemList.append('')
+ if len(ItemList) > 5:
+ RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
+ else:
+ ArchList.append(ItemList[1].upper())
+ ThirdList.append(ItemList[2])
+
+ continue
+
+ # Add a section item
+ SectionItemList.append([Line, LineNo])
+ # End of parse
+
+ self.ParserSource(CurrentSection, SectionItemList, ArchList, ThirdList)
+ #End of For
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/LzmaCompressor.pyd b/roms/edk2/BaseTools/Source/Python/Eot/LzmaCompressor.pyd
new file mode 100644
index 000000000..337c055e2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/LzmaCompressor.pyd
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/Parser.py b/roms/edk2/BaseTools/Source/Python/Eot/Parser.py
new file mode 100644
index 000000000..f204051d0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/Parser.py
@@ -0,0 +1,869 @@
+## @file
+# This file is used to define common parsing related functions used in parsing
+# Inf/Dsc/Makefile process
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.LongFilePathOs as os, re
+import Common.EdkLogger as EdkLogger
+from Common.DataType import *
+from CommonDataClass.DataClass import *
+from Common.StringUtils import CleanString, GetSplitValueList, ReplaceMacro
+from . import EotGlobalData
+from Common.StringUtils import GetSplitList
+from Common.LongFilePathSupport import OpenLongFilePath as open
+
+import subprocess
+
+## DeCompress
+#
+# Call external decompress tool to decompress the fv section
+#
+def DeCompress(Method, Input):
+ # Write the input to a temp file
+ open('_Temp.bin', 'wb').write(Input)
+ cmd = ''
+ if Method == 'Lzma':
+ cmd = r'LzmaCompress -o _New.bin -d _Temp.bin'
+ if Method == 'Efi':
+ cmd = r'TianoCompress -d --uefi -o _New.bin _Temp.bin'
+ if Method == 'Framework':
+ cmd = r'TianoCompress -d -o _New.bin _Temp.bin'
+
+ # Call tool to create the decompressed output file
+ Process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ Process.communicate()[0]
+
+ # Return the beffer of New.bin
+ if os.path.exists('_New.bin'):
+ return open('_New.bin', 'rb').read()
+
+
+## PreProcess() method
+#
+# Pre process a file
+#
+# 1. Remove all comments
+# 2. Merge multiple lines code to one line
+#
+# @param Filename: Name of the file to be parsed
+# @param MergeMultipleLines: Switch for if merge multiple lines
+# @param LineNo: Default line no
+#
+# @return Lines: The file contents after removing comments
+#
+def PreProcess(Filename, MergeMultipleLines = True, LineNo = -1):
+ Lines = []
+ Filename = os.path.normpath(Filename)
+ if not os.path.isfile(Filename):
+ EdkLogger.error("Eot", EdkLogger.FILE_NOT_FOUND, ExtraData=Filename)
+
+ IsFindBlockComment = False
+ IsFindBlockCode = False
+ ReservedLine = ''
+ ReservedLineLength = 0
+ for Line in open(Filename, 'r'):
+ Line = Line.strip()
+ # Remove comment block
+ if Line.find(TAB_COMMENT_EDK_START) > -1:
+ ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
+ IsFindBlockComment = True
+ if Line.find(TAB_COMMENT_EDK_END) > -1:
+ Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
+ ReservedLine = ''
+ IsFindBlockComment = False
+ if IsFindBlockComment:
+ Lines.append('')
+ continue
+
+ # Remove comments at tail and remove spaces again
+ Line = CleanString(Line)
+ if Line == '':
+ Lines.append('')
+ continue
+
+ if MergeMultipleLines:
+ # Add multiple lines to one line
+ if IsFindBlockCode and Line[-1] != TAB_SLASH:
+ ReservedLine = (ReservedLine + TAB_SPACE_SPLIT + Line).strip()
+ Lines.append(ReservedLine)
+ for Index in (0, ReservedLineLength):
+ Lines.append('')
+ ReservedLine = ''
+ ReservedLineLength = 0
+ IsFindBlockCode = False
+ continue
+ if Line[-1] == TAB_SLASH:
+ ReservedLine = ReservedLine + TAB_SPACE_SPLIT + Line[0:-1].strip()
+ ReservedLineLength = ReservedLineLength + 1
+ IsFindBlockCode = True
+ continue
+
+ Lines.append(Line)
+
+ return Lines
+
+## AddToGlobalMacro() method
+#
+# Add a macro to EotGlobalData.gMACRO
+#
+# @param Name: Name of the macro
+# @param Value: Value of the macro
+#
+def AddToGlobalMacro(Name, Value):
+ Value = ReplaceMacro(Value, EotGlobalData.gMACRO, True)
+ EotGlobalData.gMACRO[Name] = Value
+
+## AddToSelfMacro() method
+#
+# Parse a line of macro definition and add it to a macro set
+#
+# @param SelfMacro: The self macro set
+# @param Line: The line of a macro definition
+#
+# @return Name: Name of macro
+# @return Value: Value of macro
+#
+def AddToSelfMacro(SelfMacro, Line):
+ Name, Value = '', ''
+ List = GetSplitValueList(Line, TAB_EQUAL_SPLIT, 1)
+ if len(List) == 2:
+ Name = List[0]
+ Value = List[1]
+ Value = ReplaceMacro(Value, EotGlobalData.gMACRO, True)
+ Value = ReplaceMacro(Value, SelfMacro, True)
+ SelfMacro[Name] = Value
+
+ return (Name, Value)
+
+## GetIncludeListOfFile() method
+#
+# Get the include path list for a source file
+#
+# 1. Find the source file belongs to which INF file
+# 2. Find the inf's package
+# 3. Return the include path list of the package
+#
+# @param WorkSpace: WORKSPACE path
+# @param Filepath: File path
+# @param Db: Eot database
+#
+# @return IncludeList: A list of include directories
+#
+def GetIncludeListOfFile(WorkSpace, Filepath, Db):
+ IncludeList = []
+ Filepath = os.path.normpath(Filepath)
+ SqlCommand = """
+ select Value1 from Inf where Model = %s and BelongsToFile in(
+ select distinct B.BelongsToFile from File as A left join Inf as B
+ where A.ID = B.BelongsToFile and B.Model = %s and (A.Path || '%s' || B.Value1) = '%s')""" \
+ % (MODEL_META_DATA_PACKAGE, MODEL_EFI_SOURCE_FILE, '\\', Filepath)
+ RecordSet = Db.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ DecFullPath = os.path.normpath(os.path.join(WorkSpace, Record[0]))
+ (DecPath, DecName) = os.path.split(DecFullPath)
+ SqlCommand = """select Value1 from Dec where BelongsToFile =
+ (select ID from File where FullPath = '%s') and Model = %s""" \
+ % (DecFullPath, MODEL_EFI_INCLUDE)
+ NewRecordSet = Db.TblDec.Exec(SqlCommand)
+ for NewRecord in NewRecordSet:
+ IncludePath = os.path.normpath(os.path.join(DecPath, NewRecord[0]))
+ if IncludePath not in IncludeList:
+ IncludeList.append(IncludePath)
+
+ return IncludeList
+
+## GetTableList() method
+#
+# Search table file and find all small tables
+#
+# @param FileModelList: Model code for the file list
+# @param Table: Table to insert records
+# @param Db: Eot database
+#
+# @return TableList: A list of tables
+#
+def GetTableList(FileModelList, Table, Db):
+ TableList = []
+ SqlCommand = """select ID, FullPath from File where Model in %s""" % str(FileModelList)
+ RecordSet = Db.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ TableName = Table + str(Record[0])
+ TableList.append([TableName, Record[1]])
+
+ return TableList
+
+## GetAllIncludeDir() method
+#
+# Find all Include directories
+#
+# @param Db: Eot database
+#
+# @return IncludeList: A list of include directories
+#
+def GetAllIncludeDirs(Db):
+ IncludeList = []
+ SqlCommand = """select distinct Value1 from Inf where Model = %s order by Value1""" % MODEL_EFI_INCLUDE
+ RecordSet = Db.TblInf.Exec(SqlCommand)
+
+ for Record in RecordSet:
+ IncludeList.append(Record[0])
+
+ return IncludeList
+
+## GetAllIncludeFiles() method
+#
+# Find all Include files
+#
+# @param Db: Eot database
+#
+# @return IncludeFileList: A list of include files
+#
+def GetAllIncludeFiles(Db):
+ IncludeList = GetAllIncludeDirs(Db)
+ IncludeFileList = []
+
+ for Dir in IncludeList:
+ if os.path.isdir(Dir):
+ SubDir = os.listdir(Dir)
+ for Item in SubDir:
+ if os.path.isfile(Item):
+ IncludeFileList.append(Item)
+
+ return IncludeFileList
+
+## GetAllSourceFiles() method
+#
+# Find all source files
+#
+# @param Db: Eot database
+#
+# @return SourceFileList: A list of source files
+#
+def GetAllSourceFiles(Db):
+ SourceFileList = []
+ SqlCommand = """select distinct Value1 from Inf where Model = %s order by Value1""" % MODEL_EFI_SOURCE_FILE
+ RecordSet = Db.TblInf.Exec(SqlCommand)
+
+ for Record in RecordSet:
+ SourceFileList.append(Record[0])
+
+ return SourceFileList
+
+## GetAllFiles() method
+#
+# Find all files, both source files and include files
+#
+# @param Db: Eot database
+#
+# @return FileList: A list of files
+#
+def GetAllFiles(Db):
+ FileList = []
+ IncludeFileList = GetAllIncludeFiles(Db)
+ SourceFileList = GetAllSourceFiles(Db)
+ for Item in IncludeFileList:
+ if os.path.isfile(Item) and Item not in FileList:
+ FileList.append(Item)
+ for Item in SourceFileList:
+ if os.path.isfile(Item) and Item not in FileList:
+ FileList.append(Item)
+
+ return FileList
+
+## ParseConditionalStatement() method
+#
+# Parse conditional statement
+#
+# @param Line: One line to be parsed
+# @param Macros: A set of all macro
+# @param StatusSet: A set of all status
+#
+# @retval True: Find keyword of conditional statement
+# @retval False: Not find keyword of conditional statement
+#
+def ParseConditionalStatement(Line, Macros, StatusSet):
+ NewLine = Line.upper()
+ if NewLine.find(TAB_IF_EXIST.upper()) > -1:
+ IfLine = Line[NewLine.find(TAB_IF_EXIST) + len(TAB_IF_EXIST) + 1:].strip()
+ IfLine = ReplaceMacro(IfLine, EotGlobalData.gMACRO, True)
+ IfLine = ReplaceMacro(IfLine, Macros, True)
+ IfLine = IfLine.replace("\"", '')
+ IfLine = IfLine.replace("(", '')
+ IfLine = IfLine.replace(")", '')
+ Status = os.path.exists(os.path.normpath(IfLine))
+ StatusSet.append([Status])
+ return True
+ if NewLine.find(TAB_IF_DEF.upper()) > -1:
+ IfLine = Line[NewLine.find(TAB_IF_DEF) + len(TAB_IF_DEF) + 1:].strip()
+ Status = False
+ if IfLine in Macros or IfLine in EotGlobalData.gMACRO:
+ Status = True
+ StatusSet.append([Status])
+ return True
+ if NewLine.find(TAB_IF_N_DEF.upper()) > -1:
+ IfLine = Line[NewLine.find(TAB_IF_N_DEF) + len(TAB_IF_N_DEF) + 1:].strip()
+ Status = False
+ if IfLine not in Macros and IfLine not in EotGlobalData.gMACRO:
+ Status = True
+ StatusSet.append([Status])
+ return True
+ if NewLine.find(TAB_IF.upper()) > -1:
+ IfLine = Line[NewLine.find(TAB_IF) + len(TAB_IF) + 1:].strip()
+ Status = ParseConditionalStatementMacros(IfLine, Macros)
+ StatusSet.append([Status])
+ return True
+ if NewLine.find(TAB_ELSE_IF.upper()) > -1:
+ IfLine = Line[NewLine.find(TAB_ELSE_IF) + len(TAB_ELSE_IF) + 1:].strip()
+ Status = ParseConditionalStatementMacros(IfLine, Macros)
+ StatusSet[-1].append(Status)
+ return True
+ if NewLine.find(TAB_ELSE.upper()) > -1:
+ Status = False
+ for Item in StatusSet[-1]:
+ Status = Status or Item
+ StatusSet[-1].append(not Status)
+ return True
+ if NewLine.find(TAB_END_IF.upper()) > -1:
+ StatusSet.pop()
+ return True
+
+ return False
+
+## ParseConditionalStatement() method
+#
+# Parse conditional statement with Macros
+#
+# @param Line: One line to be parsed
+# @param Macros: A set of macros
+#
+# @return Line: New line after replacing macros
+#
+def ParseConditionalStatementMacros(Line, Macros):
+ if Line.upper().find('DEFINED(') > -1 or Line.upper().find('EXIST') > -1:
+ return False
+ Line = ReplaceMacro(Line, EotGlobalData.gMACRO, True)
+ Line = ReplaceMacro(Line, Macros, True)
+ Line = Line.replace("&&", "and")
+ Line = Line.replace("||", "or")
+ return eval(Line)
+
+## GetConditionalStatementStatus() method
+#
+# 1. Assume the latest status as True
+# 2. Pop the top status of status set, previous status
+# 3. Compare the latest one and the previous one and get new status
+#
+# @param StatusSet: A set of all status
+#
+# @return Status: The final status
+#
+def GetConditionalStatementStatus(StatusSet):
+ Status = True
+ for Item in StatusSet:
+ Status = Status and Item[-1]
+
+ return Status
+
+## SearchBelongsToFunction() method
+#
+# Search all functions belong to the file
+#
+# @param BelongsToFile: File id
+# @param StartLine: Start line of search scope
+# @param EndLine: End line of search scope
+#
+# @return: The found function
+#
+def SearchBelongsToFunction(BelongsToFile, StartLine, EndLine):
+ SqlCommand = """select ID, Name from Function where BelongsToFile = %s and StartLine <= %s and EndLine >= %s""" %(BelongsToFile, StartLine, EndLine)
+ RecordSet = EotGlobalData.gDb.TblFunction.Exec(SqlCommand)
+ if RecordSet != []:
+ return RecordSet[0][0], RecordSet[0][1]
+ else:
+ return -1, ''
+
+## SearchPpiCallFunction() method
+#
+# Search all used PPI calling function 'PeiServicesReInstallPpi' and 'PeiServicesInstallPpi'
+# Store the result to database
+#
+# @param Identifier: Table id
+# @param SourceFileID: Source file id
+# @param SourceFileFullPath: Source file full path
+# @param ItemMode: Mode of the item
+#
+def SearchPpiCallFunction(Identifier, SourceFileID, SourceFileFullPath, ItemMode):
+ ItemName, ItemType, GuidName, GuidMacro, GuidValue = '', 'Ppi', '', '', ''
+ SqlCommand = """select Value, Name, BelongsToFile, StartLine, EndLine from %s
+ where (Name like '%%%s%%' and Model = %s)""" \
+ % (Identifier, 'PeiServicesReInstallPpi', MODEL_IDENTIFIER_FUNCTION_CALLING)
+ BelongsToFunctionID, BelongsToFunction = -1, ''
+ Db = EotGlobalData.gDb.TblReport
+ RecordSet = Db.Exec(SqlCommand)
+ for Record in RecordSet:
+ Index = 0
+ BelongsToFile, StartLine, EndLine = Record[2], Record[3], Record[4]
+ BelongsToFunctionID, BelongsToFunction = SearchBelongsToFunction(BelongsToFile, StartLine, EndLine)
+ VariableList = Record[0].split(',')
+ for Variable in VariableList:
+ Variable = Variable.strip()
+ # Get index of the variable
+ if Variable.find('[') > -1:
+ Index = int(Variable[Variable.find('[') + 1 : Variable.find(']')])
+ Variable = Variable[:Variable.find('[')]
+ # Get variable name
+ if Variable.startswith('&'):
+ Variable = Variable[1:]
+ # Get variable value
+ SqlCommand = """select Value from %s where (Name like '%%%s%%') and Model = %s""" \
+ % (Identifier, Variable, MODEL_IDENTIFIER_VARIABLE)
+ NewRecordSet = Db.Exec(SqlCommand)
+ if NewRecordSet:
+ NewRecord = NewRecordSet[0][0]
+ VariableValueList = NewRecord.split('},')
+ if len(VariableValueList) > Index:
+ VariableValue = VariableValueList[Index]
+ NewVariableValueList = VariableValue.split(',')
+ if len(NewVariableValueList) > 1:
+ NewVariableValue = NewVariableValueList[1].strip()
+ if NewVariableValue.startswith('&'):
+ Db.Insert(-1, '', '', SourceFileID, SourceFileFullPath, ItemName, ItemType, ItemMode, NewVariableValue[1:], GuidMacro, GuidValue, BelongsToFunction, 0)
+ continue
+ else:
+ EotGlobalData.gOP_UN_MATCHED.write('%s, %s, %s, %s, %s, %s\n' % (ItemType, ItemMode, SourceFileID, SourceFileFullPath, StartLine, NewParameter))
+
+ ItemName, ItemType, GuidName, GuidMacro, GuidValue = '', 'Ppi', '', '', ''
+ SqlCommand = """select Value, Name, BelongsToFile, StartLine, EndLine from %s
+ where (Value like '%%%s%%' and Model = %s)""" \
+ % (Identifier, 'PeiServicesInstallPpi', MODEL_IDENTIFIER_ASSIGNMENT_EXPRESSION)
+ BelongsToFunctionID, BelongsToFunction = -1, ''
+ Db = EotGlobalData.gDb.TblReport
+ RecordSet = Db.Exec(SqlCommand)
+
+ SqlCommand = """select Value, Name, BelongsToFile, StartLine, EndLine from %s
+ where (Name like '%%%s%%' and Model = %s)""" \
+ % (Identifier, 'PeiServicesInstallPpi', MODEL_IDENTIFIER_FUNCTION_CALLING)
+ Db = EotGlobalData.gDb.TblReport
+ RecordSet2 = Db.Exec(SqlCommand)
+
+ for Record in RecordSet + RecordSet2:
+ if Record == []:
+ continue
+ Index = 0
+ BelongsToFile, StartLine, EndLine = Record[2], Record[3], Record[4]
+ BelongsToFunctionID, BelongsToFunction = SearchBelongsToFunction(BelongsToFile, StartLine, EndLine)
+ Variable = Record[0].replace('PeiServicesInstallPpi', '').replace('(', '').replace(')', '').replace('&', '').strip()
+ Variable = Variable[Variable.find(',') + 1:].strip()
+ # Get index of the variable
+ if Variable.find('[') > -1:
+ Index = int(Variable[Variable.find('[') + 1 : Variable.find(']')])
+ Variable = Variable[:Variable.find('[')]
+ # Get variable name
+ if Variable.startswith('&'):
+ Variable = Variable[1:]
+ # Get variable value
+ SqlCommand = """select Value from %s where (Name like '%%%s%%') and Model = %s""" \
+ % (Identifier, Variable, MODEL_IDENTIFIER_VARIABLE)
+ NewRecordSet = Db.Exec(SqlCommand)
+ if NewRecordSet:
+ NewRecord = NewRecordSet[0][0]
+ VariableValueList = NewRecord.split('},')
+ for VariableValue in VariableValueList[Index:]:
+ NewVariableValueList = VariableValue.split(',')
+ if len(NewVariableValueList) > 1:
+ NewVariableValue = NewVariableValueList[1].strip()
+ if NewVariableValue.startswith('&'):
+ Db.Insert(-1, '', '', SourceFileID, SourceFileFullPath, ItemName, ItemType, ItemMode, NewVariableValue[1:], GuidMacro, GuidValue, BelongsToFunction, 0)
+ continue
+ else:
+ EotGlobalData.gOP_UN_MATCHED.write('%s, %s, %s, %s, %s, %s\n' % (ItemType, ItemMode, SourceFileID, SourceFileFullPath, StartLine, NewParameter))
+
+## SearchPpis() method
+#
+# Search all used PPI calling function
+# Store the result to database
+#
+# @param SqlCommand: SQL command statement
+# @param Table: Table id
+# @param SourceFileID: Source file id
+# @param SourceFileFullPath: Source file full path
+# @param ItemMode: Mode of the item
+# @param PpiMode: Mode of PPI
+#
+def SearchPpi(SqlCommand, Table, SourceFileID, SourceFileFullPath, ItemMode, PpiMode = 1):
+ ItemName, ItemType, GuidName, GuidMacro, GuidValue = '', 'Ppi', '', '', ''
+ BelongsToFunctionID, BelongsToFunction = -1, ''
+ Db = EotGlobalData.gDb.TblReport
+ RecordSet = Db.Exec(SqlCommand)
+ for Record in RecordSet:
+ Parameter = GetPpiParameter(Record[0], PpiMode)
+ BelongsToFile, StartLine, EndLine = Record[2], Record[3], Record[4]
+ # Get BelongsToFunction
+ BelongsToFunctionID, BelongsToFunction = SearchBelongsToFunction(BelongsToFile, StartLine, EndLine)
+
+ # Default is Not Found
+ IsFound = False
+
+ # For Consumed Ppi
+ if ItemMode == 'Consumed':
+ if Parameter.startswith('g'):
+ Db.Insert(-1, '', '', SourceFileID, SourceFileFullPath, ItemName, ItemType, ItemMode, Parameter, GuidMacro, GuidValue, BelongsToFunction, 0)
+ else:
+ EotGlobalData.gOP_UN_MATCHED.write('%s, %s, %s, %s, %s, %s\n' % (ItemType, ItemMode, SourceFileID, SourceFileFullPath, StartLine, Parameter))
+ continue
+
+ # Direct Parameter.Guid
+ SqlCommand = """select Value from %s where (Name like '%%%s.Guid%%' or Name like '%%%s->Guid%%') and Model = %s""" % (Table, Parameter, Parameter, MODEL_IDENTIFIER_ASSIGNMENT_EXPRESSION)
+ NewRecordSet = Db.Exec(SqlCommand)
+ for NewRecord in NewRecordSet:
+ GuidName = GetParameterName(NewRecord[0])
+ Db.Insert(-1, '', '', SourceFileID, SourceFileFullPath, ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue, BelongsToFunction, 0)
+ IsFound = True
+
+ # Defined Parameter
+ if not IsFound:
+ Key = Parameter
+ if Key.rfind(' ') > -1:
+ Key = Key[Key.rfind(' ') : ].strip().replace('&', '')
+ Value = FindKeyValue(EotGlobalData.gDb.TblFile, Table, Key)
+ List = GetSplitValueList(Value.replace('\n', ''), TAB_COMMA_SPLIT)
+ if len(List) > 1:
+ GuidName = GetParameterName(List[1])
+ Db.Insert(-1, '', '', SourceFileID, SourceFileFullPath, ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue, BelongsToFunction, 0)
+ IsFound = True
+
+ # A list Parameter
+ if not IsFound:
+ Start = Parameter.find('[')
+ End = Parameter.find(']')
+ if Start > -1 and End > -1 and Start < End:
+ try:
+ Index = int(Parameter[Start + 1 : End])
+ Parameter = Parameter[0 : Start]
+ SqlCommand = """select Value from %s where Name = '%s' and Model = %s""" % (Table, Parameter, MODEL_IDENTIFIER_VARIABLE)
+ NewRecordSet = Db.Exec(SqlCommand)
+ for NewRecord in NewRecordSet:
+ NewParameter = GetSplitValueList(NewRecord[0], '}')[Index]
+ GuidName = GetPpiParameter(NewParameter[NewParameter.find('{') : ])
+ Db.Insert(-1, '', '', SourceFileID, SourceFileFullPath, ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue, BelongsToFunction, 0)
+ IsFound = True
+ except Exception:
+ pass
+
+ # A External Parameter
+ if not IsFound:
+ SqlCommand = """select File.ID from Inf, File
+ where BelongsToFile = (select BelongsToFile from Inf where Value1 = '%s')
+ and Inf.Model = %s and Inf.Value1 = File.FullPath and File.Model = %s""" % (SourceFileFullPath, MODEL_EFI_SOURCE_FILE, MODEL_FILE_C)
+ NewRecordSet = Db.Exec(SqlCommand)
+ for NewRecord in NewRecordSet:
+ Table = 'Identifier' + str(NewRecord[0])
+ SqlCommand = """select Value from %s where Name = '%s' and Modifier = 'EFI_PEI_PPI_DESCRIPTOR' and Model = %s""" % (Table, Parameter, MODEL_IDENTIFIER_VARIABLE)
+ PpiSet = Db.Exec(SqlCommand)
+ if PpiSet != []:
+ GuidName = GetPpiParameter(PpiSet[0][0])
+ if GuidName != '':
+ Db.Insert(-1, '', '', SourceFileID, SourceFileFullPath, ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue, BelongsToFunction, 0)
+ IsFound = True
+ break
+
+ if not IsFound:
+ EotGlobalData.gOP_UN_MATCHED.write('%s, %s, %s, %s, %s, %s\n' % (ItemType, ItemMode, SourceFileID, SourceFileFullPath, StartLine, Parameter))
+
+## SearchProtocols() method
+#
+# Search all used PROTOCOL calling function
+# Store the result to database
+#
+# @param SqlCommand: SQL command statement
+# @param Table: Table id
+# @param SourceFileID: Source file id
+# @param SourceFileFullPath: Source file full path
+# @param ItemMode: Mode of the item
+# @param ProtocolMode: Mode of PROTOCOL
+#
+def SearchProtocols(SqlCommand, Table, SourceFileID, SourceFileFullPath, ItemMode, ProtocolMode):
+ ItemName, ItemType, GuidName, GuidMacro, GuidValue = '', 'Protocol', '', '', ''
+ BelongsToFunctionID, BelongsToFunction = -1, ''
+ Db = EotGlobalData.gDb.TblReport
+ RecordSet = Db.Exec(SqlCommand)
+ for Record in RecordSet:
+ Parameter = ''
+ BelongsToFile, StartLine, EndLine = Record[2], Record[3], Record[4]
+ # Get BelongsToFunction
+ BelongsToFunctionID, BelongsToFunction = SearchBelongsToFunction(BelongsToFile, StartLine, EndLine)
+
+ # Default is Not Found
+ IsFound = False
+
+ if ProtocolMode == 0 or ProtocolMode == 1:
+ Parameter = GetProtocolParameter(Record[0], ProtocolMode)
+ if Parameter.startswith('g') or Parameter.endswith('Guid') or Parameter == 'ShellEnvProtocol' or Parameter == 'ShellInterfaceProtocol':
+ GuidName = GetParameterName(Parameter)
+ Db.Insert(-1, '', '', SourceFileID, SourceFileFullPath, ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue, BelongsToFunction, 0)
+ IsFound = True
+
+ if ProtocolMode == 2:
+ Protocols = GetSplitValueList(Record[0], TAB_COMMA_SPLIT)
+ for Protocol in Protocols:
+ if Protocol.startswith('&') and Protocol.endswith('Guid'):
+ GuidName = GetParameterName(Protocol)
+ Db.Insert(-1, '', '', SourceFileID, SourceFileFullPath, ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue, BelongsToFunction, 0)
+ IsFound = True
+ else:
+ NewValue = FindKeyValue(EotGlobalData.gDb.TblFile, Table, Protocol)
+ if Protocol != NewValue and NewValue.endswith('Guid'):
+ GuidName = GetParameterName(NewValue)
+ Db.Insert(-1, '', '', SourceFileID, SourceFileFullPath, ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue, BelongsToFunction, 0)
+ IsFound = True
+
+ if not IsFound:
+ if BelongsToFunction in EotGlobalData.gProducedProtocolLibrary or BelongsToFunction in EotGlobalData.gConsumedProtocolLibrary:
+ EotGlobalData.gOP_UN_MATCHED_IN_LIBRARY_CALLING.write('%s, %s, %s, %s, %s, %s, %s\n' % (ItemType, ItemMode, SourceFileID, SourceFileFullPath, StartLine, Parameter, BelongsToFunction))
+ else:
+ EotGlobalData.gOP_UN_MATCHED.write('%s, %s, %s, %s, %s, %s\n' % (ItemType, ItemMode, SourceFileID, SourceFileFullPath, StartLine, Parameter))
+
+## SearchFunctionCalling() method
+#
+# Search all used PPI/PROTOCOL calling function by library
+# Store the result to database
+#
+# @param SqlCommand: SQL command statement
+# @param Table: Table id
+# @param SourceFileID: Source file id
+# @param SourceFileFullPath: Source file full path
+# @param ItemType: Type of the item, PPI or PROTOCOL
+# @param ItemMode: Mode of item
+#
+def SearchFunctionCalling(Table, SourceFileID, SourceFileFullPath, ItemType, ItemMode):
+ LibraryList = {}
+ Db = EotGlobalData.gDb.TblReport
+ Parameters, ItemName, GuidName, GuidMacro, GuidValue, BelongsToFunction = [], '', '', '', '', ''
+ if ItemType == 'Protocol' and ItemMode == 'Produced':
+ LibraryList = EotGlobalData.gProducedProtocolLibrary
+ elif ItemType == 'Protocol' and ItemMode == 'Consumed':
+ LibraryList = EotGlobalData.gConsumedProtocolLibrary
+ elif ItemType == 'Protocol' and ItemMode == 'Callback':
+ LibraryList = EotGlobalData.gCallbackProtocolLibrary
+ elif ItemType == 'Ppi' and ItemMode == 'Produced':
+ LibraryList = EotGlobalData.gProducedPpiLibrary
+ elif ItemType == 'Ppi' and ItemMode == 'Consumed':
+ LibraryList = EotGlobalData.gConsumedPpiLibrary
+
+ for Library in LibraryList:
+ Index = LibraryList[Library]
+ SqlCommand = """select Value, StartLine from %s
+ where Name like '%%%s%%' and Model = %s""" \
+ % (Table, Library, MODEL_IDENTIFIER_FUNCTION_CALLING)
+ RecordSet = Db.Exec(SqlCommand)
+ for Record in RecordSet:
+ IsFound = False
+ if Index == -1:
+ ParameterList = GetSplitValueList(Record[0], TAB_COMMA_SPLIT)
+ for Parameter in ParameterList:
+ Parameters.append(GetParameterName(Parameter))
+ else:
+ Parameters = [GetProtocolParameter(Record[0], Index)]
+ StartLine = Record[1]
+ for Parameter in Parameters:
+ if Parameter.startswith('g') or Parameter.endswith('Guid') or Parameter == 'ShellEnvProtocol' or Parameter == 'ShellInterfaceProtocol':
+ GuidName = GetParameterName(Parameter)
+ Db.Insert(-1, '', '', SourceFileID, SourceFileFullPath, ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue, BelongsToFunction, 0)
+ IsFound = True
+
+ if not IsFound:
+ EotGlobalData.gOP_UN_MATCHED.write('%s, %s, %s, %s, %s, %s\n' % (ItemType, ItemMode, SourceFileID, SourceFileFullPath, StartLine, Parameter))
+
+## FindProtocols() method
+#
+# Find defined protocols
+#
+# @param SqlCommand: SQL command statement
+# @param Table: Table id
+# @param SourceFileID: Source file id
+# @param SourceFileFullPath: Source file full path
+# @param ItemName: String of protocol definition
+# @param ItemType: Type of the item, PPI or PROTOCOL
+# @param ItemMode: Mode of item
+#
+#def FindProtocols(Db, SqlCommand, Table, SourceFileID, SourceFileFullPath, ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue):
+# BelongsToFunction = ''
+# RecordSet = Db.Exec(SqlCommand)
+# for Record in RecordSet:
+# IsFound = True
+# Parameter = GetProtocolParameter(Record[0])
+
+## GetProtocolParameter() method
+#
+# Parse string of protocol and find parameters
+#
+# @param Parameter: Parameter to be parsed
+# @param Index: The index of the parameter
+#
+# @return: call common GetParameter
+#
+def GetProtocolParameter(Parameter, Index = 1):
+ return GetParameter(Parameter, Index)
+
+## GetPpiParameter() method
+#
+# Parse string of ppi and find parameters
+#
+# @param Parameter: Parameter to be parsed
+# @param Index: The index of the parameter
+#
+# @return: call common GetParameter
+#
+def GetPpiParameter(Parameter, Index = 1):
+ return GetParameter(Parameter, Index)
+
+## GetParameter() method
+#
+# Get a parameter by index
+#
+# @param Parameter: Parameter to be parsed
+# @param Index: The index of the parameter
+#
+# @return Parameter: The found parameter
+#
+def GetParameter(Parameter, Index = 1):
+ ParameterList = GetSplitValueList(Parameter, TAB_COMMA_SPLIT)
+ if len(ParameterList) > Index:
+ Parameter = GetParameterName(ParameterList[Index])
+
+ return Parameter
+
+ return ''
+
+## GetParameterName() method
+#
+# Get a parameter name
+#
+# @param Parameter: Parameter to be parsed
+#
+# @return: The name of parameter
+#
+def GetParameterName(Parameter):
+ if isinstance(Parameter, type('')) and Parameter.startswith('&'):
+ return Parameter[1:].replace('{', '').replace('}', '').replace('\r', '').replace('\n', '').strip()
+ else:
+ return Parameter.strip()
+
+## FindKeyValue() method
+#
+# Find key value of a variable
+#
+# @param Db: Database to be searched
+# @param Table: Table to be searched
+# @param Key: The keyword
+#
+# @return Value: The value of the keyword
+#
+def FindKeyValue(Db, Table, Key):
+ SqlCommand = """select Value from %s where Name = '%s' and (Model = %s or Model = %s)""" % (Table, Key, MODEL_IDENTIFIER_VARIABLE, MODEL_IDENTIFIER_ASSIGNMENT_EXPRESSION)
+ RecordSet = Db.Exec(SqlCommand)
+ Value = ''
+ for Record in RecordSet:
+ if Record[0] != 'NULL':
+ Value = FindKeyValue(Db, Table, GetParameterName(Record[0]))
+
+ if Value != '':
+ return Value
+ else:
+ return Key
+
+## ParseMapFile() method
+#
+# Parse map files to get a dict of 'ModuleName' : {FunName : FunAddress}
+#
+# @param Files: A list of map files
+#
+# @return AllMaps: An object of all map files
+#
+def ParseMapFile(Files):
+ AllMaps = {}
+ CurrentModule = ''
+ CurrentMaps = {}
+ for File in Files:
+ Content = open(File, 'r').readlines()
+ for Line in Content:
+ Line = CleanString(Line)
+ # skip empty line
+ if Line == '':
+ continue
+
+ if Line.find('(') > -1 and Line.find(')') > -1:
+ if CurrentModule != '' and CurrentMaps != {}:
+ AllMaps[CurrentModule] = CurrentMaps
+ CurrentModule = Line[:Line.find('(')]
+ CurrentMaps = {}
+ continue
+ else:
+ Name = ''
+ Address = ''
+ List = Line.split()
+ Address = List[0]
+ if List[1] == 'F' or List[1] == 'FS':
+ Name = List[2]
+ else:
+ Name = List[1]
+ CurrentMaps[Name] = Address
+ continue
+
+ return AllMaps
+
+## ConvertGuid
+#
+# Convert a GUID to a GUID with all upper letters
+#
+# @param guid: The GUID to be converted
+#
+# @param newGuid: The GUID with all upper letters.
+#
+def ConvertGuid(guid):
+ numList = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
+ newGuid = ''
+ if guid.startswith('g'):
+ guid = guid[1:]
+ for i in guid:
+ if i.upper() == i and i not in numList:
+ newGuid = newGuid + ('_' + i)
+ else:
+ newGuid = newGuid + i.upper()
+ if newGuid.startswith('_'):
+ newGuid = newGuid[1:]
+ if newGuid.endswith('_'):
+ newGuid = newGuid[:-1]
+
+ return newGuid
+
+## ConvertGuid2() method
+#
+# Convert a GUID to a GUID with new string instead of old string
+#
+# @param guid: The GUID to be converted
+# @param old: Old string to be replaced
+# @param new: New string to replace the old one
+#
+# @param newGuid: The GUID after replacement
+#
+def ConvertGuid2(guid, old, new):
+ newGuid = ConvertGuid(guid)
+ newGuid = newGuid.replace(old, new)
+
+ return newGuid
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ pass
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/ParserWarning.py b/roms/edk2/BaseTools/Source/Python/Eot/ParserWarning.py
new file mode 100644
index 000000000..e84990a49
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/ParserWarning.py
@@ -0,0 +1,20 @@
+## @file
+# Warning information of Eot
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+class Warning (Exception):
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param File The FDF name
+ # @param Line The Line number that error occurs
+ #
+ def __init__(self, Str, File = None, Line = None):
+ self.message = Str
+ self.FileName = File
+ self.LineNumber = Line
+ self.ToolName = 'EOT'
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/Report.py b/roms/edk2/BaseTools/Source/Python/Eot/Report.py
new file mode 100644
index 000000000..9d99fe22a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/Report.py
@@ -0,0 +1,468 @@
+## @file
+# This file is used to create report for Eot tool
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.LongFilePathOs as os
+from . import EotGlobalData
+from Common.LongFilePathSupport import OpenLongFilePath as open
+
+## Report() class
+#
+# This class defined Report
+#
+# @param object: Inherited from object class
+#
+class Report(object):
+ ## The constructor
+ #
+ # @param self: The object pointer
+ # @param ReportName: name of the report
+ # @param FvObj: FV object after parsing FV images
+ #
+ def __init__(self, ReportName = 'Report.html', FvObj = None, DispatchName=None):
+ self.ReportName = ReportName
+ self.Op = open(ReportName, 'w+')
+ self.DispatchList = None
+ if DispatchName:
+ self.DispatchList = open(DispatchName, 'w+')
+ self.FvObj = FvObj
+ self.FfsIndex = 0
+ self.PpiIndex = 0
+ self.ProtocolIndex = 0
+ if EotGlobalData.gMACRO['EFI_SOURCE'] == '':
+ EotGlobalData.gMACRO['EFI_SOURCE'] = EotGlobalData.gMACRO['EDK_SOURCE']
+
+ ## WriteLn() method
+ #
+ # Write a line in the report
+ #
+ # @param self: The object pointer
+ # @param Line: The lint to be written into
+ #
+ def WriteLn(self, Line):
+ self.Op.write('%s\n' % Line)
+
+ ## GenerateReport() method
+ #
+ # A caller to generate report
+ #
+ # @param self: The object pointer
+ #
+ def GenerateReport(self):
+ self.GenerateHeader()
+ self.GenerateFv()
+ self.GenerateTail()
+ self.Op.close()
+ self.GenerateUnDispatchedList()
+
+ ## GenerateUnDispatchedList() method
+ #
+ # Create a list for not dispatched items
+ #
+ # @param self: The object pointer
+ #
+ def GenerateUnDispatchedList(self):
+ FvObj = self.FvObj
+ EotGlobalData.gOP_UN_DISPATCHED.write('%s\n' % FvObj.Name)
+ for Item in FvObj.UnDispatchedFfsDict.keys():
+ EotGlobalData.gOP_UN_DISPATCHED.write('%s\n' % FvObj.UnDispatchedFfsDict[Item])
+
+ ## GenerateFv() method
+ #
+ # Generate FV information
+ #
+ # @param self: The object pointer
+ #
+ def GenerateFv(self):
+ FvObj = self.FvObj
+ Content = """ <tr>
+ <td width="20%%"><strong>Name</strong></td>
+ <td width="60%%"><strong>Guid</strong></td>
+ <td width="20%%"><strong>Size</strong></td>
+ </tr>"""
+ self.WriteLn(Content)
+
+ for Info in FvObj.BasicInfo:
+ FvName = Info[0]
+ FvGuid = Info[1]
+ FvSize = Info[2]
+
+ Content = """ <tr>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ </tr>""" % (FvName, FvGuid, FvSize)
+ self.WriteLn(Content)
+
+ Content = """ <td colspan="3"><table width="100%%" border="1">
+ <tr>"""
+ self.WriteLn(Content)
+
+ EotGlobalData.gOP_DISPATCH_ORDER.write('Dispatched:\n')
+ for FfsId in FvObj.OrderedFfsDict.keys():
+ self.GenerateFfs(FvObj.OrderedFfsDict[FfsId])
+ Content = """ </table></td>
+ </tr>"""
+ self.WriteLn(Content)
+
+ # For UnDispatched
+ Content = """ <td colspan="3"><table width="100%%" border="1">
+ <tr>
+ <tr><strong>UnDispatched</strong></tr>"""
+ self.WriteLn(Content)
+
+ EotGlobalData.gOP_DISPATCH_ORDER.write('\nUnDispatched:\n')
+ for FfsId in FvObj.UnDispatchedFfsDict.keys():
+ self.GenerateFfs(FvObj.UnDispatchedFfsDict[FfsId])
+ Content = """ </table></td>
+ </tr>"""
+ self.WriteLn(Content)
+
+ ## GenerateDepex() method
+ #
+ # Generate Depex information
+ #
+ # @param self: The object pointer
+ # @param DepexString: A DEPEX string needed to be parsed
+ #
+ def GenerateDepex(self, DepexString):
+ NonGuidList = ['AND', 'OR', 'NOT', 'BEFORE', 'AFTER', 'TRUE', 'FALSE']
+ ItemList = DepexString.split(' ')
+ DepexString = ''
+ for Item in ItemList:
+ if Item not in NonGuidList:
+ SqlCommand = """select DISTINCT GuidName from Report where GuidValue like '%s' and ItemMode = 'Produced' group by GuidName""" % (Item)
+ RecordSet = EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ if RecordSet != []:
+ Item = RecordSet[0][0]
+ DepexString = DepexString + Item + ' '
+ Content = """ <tr>
+ <td width="5%%"></td>
+ <td width="95%%">%s</td>
+ </tr>""" % (DepexString)
+ self.WriteLn(Content)
+
+ ## GeneratePpi() method
+ #
+ # Generate PPI information
+ #
+ # @param self: The object pointer
+ # @param Name: CName of a GUID
+ # @param Guid: Value of a GUID
+ # @param Type: Type of a GUID
+ #
+ def GeneratePpi(self, Name, Guid, Type):
+ self.GeneratePpiProtocol('Ppi', Name, Guid, Type, self.PpiIndex)
+
+ ## GenerateProtocol() method
+ #
+ # Generate PROTOCOL information
+ #
+ # @param self: The object pointer
+ # @param Name: CName of a GUID
+ # @param Guid: Value of a GUID
+ # @param Type: Type of a GUID
+ #
+ def GenerateProtocol(self, Name, Guid, Type):
+ self.GeneratePpiProtocol('Protocol', Name, Guid, Type, self.ProtocolIndex)
+
+ ## GeneratePpiProtocol() method
+ #
+ # Generate PPI/PROTOCOL information
+ #
+ # @param self: The object pointer
+ # @param Model: Model of a GUID, PPI or PROTOCOL
+ # @param Name: Name of a GUID
+ # @param Guid: Value of a GUID
+ # @param Type: Type of a GUID
+ # @param CName: CName(Index) of a GUID
+ #
+ def GeneratePpiProtocol(self, Model, Name, Guid, Type, CName):
+ Content = """ <tr>
+ <td width="5%%"></td>
+ <td width="10%%">%s</td>
+ <td width="85%%" colspan="3">%s</td>
+ <!-- %s -->
+ </tr>""" % (Model, Name, Guid)
+ self.WriteLn(Content)
+ if Type == 'Produced':
+ SqlCommand = """select DISTINCT SourceFileFullPath, BelongsToFunction from Report where GuidName like '%s' and ItemMode = 'Callback'""" % Name
+ RecordSet = EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ for Record in RecordSet:
+ SqlCommand = """select FullPath from File
+ where ID = (
+ select DISTINCT BelongsToFile from Inf
+ where Value1 like '%s')""" % Record[0]
+ ModuleSet = EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ Inf = ModuleSet[0][0].replace(EotGlobalData.gMACRO['WORKSPACE'], '.')
+ Function = Record[1]
+ Address = ''
+ for Item in EotGlobalData.gMap:
+ if Function in EotGlobalData.gMap[Item]:
+ Address = EotGlobalData.gMap[Item][Function]
+ break
+ if '_' + Function in EotGlobalData.gMap[Item]:
+ Address = EotGlobalData.gMap[Item]['_' + Function]
+ break
+ Content = """ <tr>
+ <td width="5%%"></td>
+ <td width="10%%">%s</td>
+ <td width="40%%">%s</td>
+ <td width="35%%">%s</td>
+ <td width="10%%">%s</td>
+ </tr>""" % ('Callback', Inf, Function, Address)
+ self.WriteLn(Content)
+
+ ## GenerateFfs() method
+ #
+ # Generate FFS information
+ #
+ # @param self: The object pointer
+ # @param FfsObj: FFS object after FV image is parsed
+ #
+ def GenerateFfs(self, FfsObj):
+ self.FfsIndex = self.FfsIndex + 1
+ if FfsObj is not None and FfsObj.Type in [0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xA]:
+ FfsGuid = FfsObj.Guid
+ FfsOffset = FfsObj._OFF_
+ FfsName = 'Unknown-Module'
+ FfsPath = FfsGuid
+ FfsType = FfsObj._TypeName[FfsObj.Type]
+
+ # Hard code for Binary INF
+ if FfsGuid.upper() == '7BB28B99-61BB-11D5-9A5D-0090273FC14D':
+ FfsName = 'Logo'
+
+ if FfsGuid.upper() == '7E374E25-8E01-4FEE-87F2-390C23C606CD':
+ FfsName = 'AcpiTables'
+
+ if FfsGuid.upper() == '961578FE-B6B7-44C3-AF35-6BC705CD2B1F':
+ FfsName = 'Fat'
+
+ # Find FFS Path and Name
+ SqlCommand = """select Value2 from Inf
+ where BelongsToFile = (select BelongsToFile from Inf where Value1 = 'FILE_GUID' and lower(Value2) = lower('%s') and Model = %s)
+ and Model = %s and Value1='BASE_NAME'""" % (FfsGuid, 5001, 5001)
+ RecordSet = EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ if RecordSet != []:
+ FfsName = RecordSet[0][0]
+
+ SqlCommand = """select FullPath from File
+ where ID = (select BelongsToFile from Inf where Value1 = 'FILE_GUID' and lower(Value2) = lower('%s') and Model = %s)
+ and Model = %s""" % (FfsGuid, 5001, 1011)
+ RecordSet = EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ if RecordSet != []:
+ FfsPath = RecordSet[0][0]
+
+ Content = """ <tr>
+ <tr class='styleFfs' id='FfsHeader%s'>
+ <td width="55%%"><span onclick="Display('FfsHeader%s', 'Ffs%s')" onMouseOver="funOnMouseOver()" onMouseOut="funOnMouseOut()">%s</span></td>
+ <td width="15%%">%s</td>
+ <!--<td width="20%%">%s</td>-->
+ <!--<td width="20%%">%s</td>-->
+ <td width="10%%">%s</td>
+ </tr>
+ <tr id='Ffs%s' style='display:none;'>
+ <td colspan="4"><table width="100%%" border="1">""" % (self.FfsIndex, self.FfsIndex, self.FfsIndex, FfsPath, FfsName, FfsGuid, FfsOffset, FfsType, self.FfsIndex)
+
+ if self.DispatchList:
+ if FfsObj.Type in [0x04, 0x06]:
+ self.DispatchList.write("%s %s %s %s\n" % (FfsGuid, "P", FfsName, FfsPath))
+ if FfsObj.Type in [0x05, 0x07, 0x08, 0x0A]:
+ self.DispatchList.write("%s %s %s %s\n" % (FfsGuid, "D", FfsName, FfsPath))
+
+ self.WriteLn(Content)
+
+ EotGlobalData.gOP_DISPATCH_ORDER.write('%s\n' %FfsName)
+
+ if FfsObj.Depex != '':
+ Content = """ <tr>
+ <td><span id='DepexHeader%s' class="styleDepex" onclick="Display('DepexHeader%s', 'Depex%s')" onMouseOver="funOnMouseOver()" onMouseOut="funOnMouseOut()">&nbsp&nbspDEPEX expression</span></td>
+ </tr>
+ <tr id='Depex%s' style='display:none;'>
+ <td><table width="100%%" border="1">""" % (self.FfsIndex, self.FfsIndex, self.FfsIndex, self.FfsIndex)
+ self.WriteLn(Content)
+ self.GenerateDepex(FfsObj.Depex)
+ Content = """ </table></td>
+ </tr>"""
+ self.WriteLn(Content)
+ # End of DEPEX
+
+ # Find Consumed Ppi/Protocol
+ SqlCommand = """select ModuleName, ItemType, GuidName, GuidValue, GuidMacro from Report
+ where SourceFileFullPath in
+ (select Value1 from Inf where BelongsToFile =
+ (select BelongsToFile from Inf
+ where Value1 = 'FILE_GUID' and Value2 like '%s' and Model = %s)
+ and Model = %s)
+ and ItemMode = 'Consumed' group by GuidName order by ItemType""" \
+ % (FfsGuid, 5001, 3007)
+
+ RecordSet = EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ if RecordSet != []:
+ Count = len(RecordSet)
+ Content = """ <tr>
+ <td><span id='ConsumedHeader%s' class="styleConsumed" onclick="Display('ConsumedHeader%s', 'Consumed%s')" onMouseOver="funOnMouseOver()" onMouseOut="funOnMouseOut()">&nbsp&nbspConsumed Ppis/Protocols List (%s)</span></td>
+ </tr>
+ <tr id='Consumed%s' style='display:none;'>
+ <td><table width="100%%" border="1">""" % (self.FfsIndex, self.FfsIndex, self.FfsIndex, Count, self.FfsIndex)
+ self.WriteLn(Content)
+ self.ProtocolIndex = 0
+ for Record in RecordSet:
+ self.ProtocolIndex = self.ProtocolIndex + 1
+ Name = Record[2]
+ CName = Record[4]
+ Guid = Record[3]
+ Type = Record[1]
+ self.GeneratePpiProtocol(Type, Name, Guid, 'Consumed', CName)
+
+ Content = """ </table></td>
+ </tr>"""
+ self.WriteLn(Content)
+ #End of Consumed Ppi/Protocol
+
+ # Find Produced Ppi/Protocol
+ SqlCommand = """select ModuleName, ItemType, GuidName, GuidValue, GuidMacro from Report
+ where SourceFileFullPath in
+ (select Value1 from Inf where BelongsToFile =
+ (select BelongsToFile from Inf
+ where Value1 = 'FILE_GUID' and Value2 like '%s' and Model = %s)
+ and Model = %s)
+ and ItemMode = 'Produced' group by GuidName order by ItemType""" \
+ % (FfsGuid, 5001, 3007)
+
+ RecordSet = EotGlobalData.gDb.TblReport.Exec(SqlCommand)
+ if RecordSet != []:
+ Count = len(RecordSet)
+ Content = """ <tr>
+ <td><span id='ProducedHeader%s' class="styleProduced" onclick="Display('ProducedHeader%s', 'Produced%s')" onMouseOver="funOnMouseOver()" onMouseOut="funOnMouseOut()">&nbsp&nbspProduced Ppis/Protocols List (%s)</span></td>
+ </tr>
+ <tr id='Produced%s' style='display:none;'>
+ <td><table width="100%%" border="1">""" % (self.FfsIndex, self.FfsIndex, self.FfsIndex, Count, self.FfsIndex)
+ self.WriteLn(Content)
+ self.PpiIndex = 0
+ for Record in RecordSet:
+ self.PpiIndex = self.PpiIndex + 1
+ Name = Record[2]
+ CName = Record[4]
+ Guid = Record[3]
+ Type = Record[1]
+ self.GeneratePpiProtocol(Type, Name, Guid, 'Produced', CName)
+
+ Content = """ </table></td>
+ </tr>"""
+ self.WriteLn(Content)
+ RecordSet = None
+ # End of Produced Ppi/Protocol
+
+ Content = """ </table></td>
+ </tr>"""
+ self.WriteLn(Content)
+
+ ## GenerateTail() method
+ #
+ # Generate end tags of HTML report
+ #
+ # @param self: The object pointer
+ #
+ def GenerateTail(self):
+ Tail = """</table>
+</body>
+</html>"""
+ self.WriteLn(Tail)
+
+ ## GenerateHeader() method
+ #
+ # Generate start tags of HTML report
+ #
+ # @param self: The object pointer
+ #
+ def GenerateHeader(self):
+ Header = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title>Execution Order Tool Report</title>
+<meta http-equiv="Content-Type" content="text/html">
+<style type="text/css">
+<!--
+.styleFfs {
+ color: #006600;
+ font-weight: bold;
+}
+.styleDepex {
+ color: #FF0066;
+ font-weight: bold;
+}
+.styleProduced {
+ color: #0000FF;
+ font-weight: bold;
+}
+.styleConsumed {
+ color: #FF00FF;
+ font-weight: bold;
+}
+-->
+</style>
+<Script type="text/javascript">
+function Display(ParentID, SubID)
+{
+ SubItem = document.getElementById(SubID);
+ ParentItem = document.getElementById(ParentID);
+ if (SubItem.style.display == 'none')
+ {
+ SubItem.style.display = ''
+ ParentItem.style.fontWeight = 'normal'
+ }
+ else
+ {
+ SubItem.style.display = 'none'
+ ParentItem.style.fontWeight = 'bold'
+ }
+
+}
+
+function funOnMouseOver()
+{
+ document.body.style.cursor = "hand";
+}
+
+function funOnMouseOut()
+{
+ document.body.style.cursor = "";
+}
+
+</Script>
+</head>
+
+<body>
+<table width="100%%" border="1">"""
+ self.WriteLn(Header)
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ # Initialize log system
+ FilePath = 'FVRECOVERYFLOPPY.fv'
+ if FilePath.lower().endswith(".fv"):
+ fd = open(FilePath, 'rb')
+ buf = array('B')
+ try:
+ buf.fromfile(fd, os.path.getsize(FilePath))
+ except EOFError:
+ pass
+
+ fv = FirmwareVolume("FVRECOVERY", buf, 0)
+
+ report = Report('Report.html', fv)
+ report.GenerateReport()
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/__init__.py b/roms/edk2/BaseTools/Source/Python/Eot/__init__.py
new file mode 100644
index 000000000..ba0b8c81f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'Eot' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/Eot/c.py b/roms/edk2/BaseTools/Source/Python/Eot/c.py
new file mode 100644
index 000000000..dd9530fed
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Eot/c.py
@@ -0,0 +1,383 @@
+## @file
+# preprocess source file
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+import sys
+import Common.LongFilePathOs as os
+import re
+from . import CodeFragmentCollector
+from . import FileProfile
+from CommonDataClass import DataClass
+from Common import EdkLogger
+from .EotToolError import *
+from . import EotGlobalData
+
+# Global Dicts
+IncludeFileListDict = {}
+IncludePathListDict = {}
+ComplexTypeDict = {}
+SUDict = {}
+
+## GetFuncDeclPattern() method
+#
+# Get the pattern of function declaration
+#
+# @return p: the pattern of function declaration
+#
+def GetFuncDeclPattern():
+ p = re.compile(r'(EFIAPI|EFI_BOOT_SERVICE|EFI_RUNTIME_SERVICE)?\s*[_\w]+\s*\(.*\).*', re.DOTALL)
+ return p
+
+## GetArrayPattern() method
+#
+# Get the pattern of array
+#
+# @return p: the pattern of array
+#
+def GetArrayPattern():
+ p = re.compile(r'[_\w]*\s*[\[.*\]]+')
+ return p
+
+## GetTypedefFuncPointerPattern() method
+#
+# Get the pattern of function pointer
+#
+# @return p: the pattern of function pointer
+#
+def GetTypedefFuncPointerPattern():
+ p = re.compile('[_\w\s]*\([\w\s]*\*+\s*[_\w]+\s*\)\s*\(.*\)', re.DOTALL)
+ return p
+
+## GetDB() method
+#
+# Get global database instance
+#
+# @return EotGlobalData.gDb: the global database instance
+#
+def GetDB():
+ return EotGlobalData.gDb
+
+## PrintErrorMsg() method
+#
+# print error message
+#
+# @param ErrorType: Type of error
+# @param Msg: Error message
+# @param TableName: table name of error found
+# @param ItemId: id of item
+#
+def PrintErrorMsg(ErrorType, Msg, TableName, ItemId):
+ Msg = Msg.replace('\n', '').replace('\r', '')
+ MsgPartList = Msg.split()
+ Msg = ''
+ for Part in MsgPartList:
+ Msg += Part
+ Msg += ' '
+ GetDB().TblReport.Insert(ErrorType, OtherMsg = Msg, BelongsToTable = TableName, BelongsToItem = ItemId)
+
+## GetIdType() method
+#
+# Find type of input string
+#
+# @param Str: String to be parsed
+#
+# @return Type: The type of the string
+#
+def GetIdType(Str):
+ Type = DataClass.MODEL_UNKNOWN
+ Str = Str.replace('#', '# ')
+ List = Str.split()
+ if List[1] == 'include':
+ Type = DataClass.MODEL_IDENTIFIER_INCLUDE
+ elif List[1] == 'define':
+ Type = DataClass.MODEL_IDENTIFIER_MACRO_DEFINE
+ elif List[1] == 'ifdef':
+ Type = DataClass.MODEL_IDENTIFIER_MACRO_IFDEF
+ elif List[1] == 'ifndef':
+ Type = DataClass.MODEL_IDENTIFIER_MACRO_IFNDEF
+ elif List[1] == 'endif':
+ Type = DataClass.MODEL_IDENTIFIER_MACRO_ENDIF
+ elif List[1] == 'pragma':
+ Type = DataClass.MODEL_IDENTIFIER_MACRO_PROGMA
+ else:
+ Type = DataClass.MODEL_UNKNOWN
+ return Type
+
+## GetIdentifierList() method
+#
+# Get id of all files
+#
+# @return IdList: The list of all id of files
+#
+def GetIdentifierList():
+ IdList = []
+
+ for pp in FileProfile.PPDirectiveList:
+ Type = GetIdType(pp.Content)
+ IdPP = DataClass.IdentifierClass(-1, '', '', '', pp.Content, Type, -1, -1, pp.StartPos[0], pp.StartPos[1], pp.EndPos[0], pp.EndPos[1])
+ IdList.append(IdPP)
+
+ for ae in FileProfile.AssignmentExpressionList:
+ IdAE = DataClass.IdentifierClass(-1, ae.Operator, '', ae.Name, ae.Value, DataClass.MODEL_IDENTIFIER_ASSIGNMENT_EXPRESSION, -1, -1, ae.StartPos[0], ae.StartPos[1], ae.EndPos[0], ae.EndPos[1])
+ IdList.append(IdAE)
+
+ FuncDeclPattern = GetFuncDeclPattern()
+ ArrayPattern = GetArrayPattern()
+ for var in FileProfile.VariableDeclarationList:
+ DeclText = var.Declarator.strip()
+ while DeclText.startswith('*'):
+ var.Modifier += '*'
+ DeclText = DeclText.lstrip('*').strip()
+ var.Declarator = DeclText
+ if FuncDeclPattern.match(var.Declarator):
+ DeclSplitList = var.Declarator.split('(')
+ FuncName = DeclSplitList[0]
+ FuncNamePartList = FuncName.split()
+ if len(FuncNamePartList) > 1:
+ FuncName = FuncNamePartList[-1]
+ Index = 0
+ while Index < len(FuncNamePartList) - 1:
+ var.Modifier += ' ' + FuncNamePartList[Index]
+ var.Declarator = var.Declarator.lstrip().lstrip(FuncNamePartList[Index])
+ Index += 1
+ IdVar = DataClass.IdentifierClass(-1, var.Modifier, '', var.Declarator, '', DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION, -1, -1, var.StartPos[0], var.StartPos[1], var.EndPos[0], var.EndPos[1])
+ IdList.append(IdVar)
+ continue
+
+ if var.Declarator.find('{') == -1:
+ for decl in var.Declarator.split(','):
+ DeclList = decl.split('=')
+ Name = DeclList[0].strip()
+ if ArrayPattern.match(Name):
+ LSBPos = var.Declarator.find('[')
+ var.Modifier += ' ' + Name[LSBPos:]
+ Name = Name[0:LSBPos]
+
+ IdVar = DataClass.IdentifierClass(-1, var.Modifier, '', Name, (len(DeclList) > 1 and [DeclList[1]]or [''])[0], DataClass.MODEL_IDENTIFIER_VARIABLE, -1, -1, var.StartPos[0], var.StartPos[1], var.EndPos[0], var.EndPos[1])
+ IdList.append(IdVar)
+ else:
+ DeclList = var.Declarator.split('=')
+ Name = DeclList[0].strip()
+ if ArrayPattern.match(Name):
+ LSBPos = var.Declarator.find('[')
+ var.Modifier += ' ' + Name[LSBPos:]
+ Name = Name[0:LSBPos]
+ IdVar = DataClass.IdentifierClass(-1, var.Modifier, '', Name, (len(DeclList) > 1 and [DeclList[1]]or [''])[0], DataClass.MODEL_IDENTIFIER_VARIABLE, -1, -1, var.StartPos[0], var.StartPos[1], var.EndPos[0], var.EndPos[1])
+ IdList.append(IdVar)
+
+ for enum in FileProfile.EnumerationDefinitionList:
+ LBPos = enum.Content.find('{')
+ RBPos = enum.Content.find('}')
+ Name = enum.Content[4:LBPos].strip()
+ Value = enum.Content[LBPos+1:RBPos]
+ IdEnum = DataClass.IdentifierClass(-1, '', '', Name, Value, DataClass.MODEL_IDENTIFIER_ENUMERATE, -1, -1, enum.StartPos[0], enum.StartPos[1], enum.EndPos[0], enum.EndPos[1])
+ IdList.append(IdEnum)
+
+ for su in FileProfile.StructUnionDefinitionList:
+ Type = DataClass.MODEL_IDENTIFIER_STRUCTURE
+ SkipLen = 6
+ if su.Content.startswith('union'):
+ Type = DataClass.MODEL_IDENTIFIER_UNION
+ SkipLen = 5
+ LBPos = su.Content.find('{')
+ RBPos = su.Content.find('}')
+ if LBPos == -1 or RBPos == -1:
+ Name = su.Content[SkipLen:].strip()
+ Value = ''
+ else:
+ Name = su.Content[SkipLen:LBPos].strip()
+ Value = su.Content[LBPos+1:RBPos]
+ IdPE = DataClass.IdentifierClass(-1, '', '', Name, Value, Type, -1, -1, su.StartPos[0], su.StartPos[1], su.EndPos[0], su.EndPos[1])
+ IdList.append(IdPE)
+
+ TdFuncPointerPattern = GetTypedefFuncPointerPattern()
+ for td in FileProfile.TypedefDefinitionList:
+ Modifier = ''
+ Name = td.ToType
+ Value = td.FromType
+ if TdFuncPointerPattern.match(td.ToType):
+ Modifier = td.FromType
+ LBPos = td.ToType.find('(')
+ TmpStr = td.ToType[LBPos+1:].strip()
+ StarPos = TmpStr.find('*')
+ if StarPos != -1:
+ Modifier += ' ' + TmpStr[0:StarPos]
+ while TmpStr[StarPos] == '*':
+ Modifier += ' ' + '*'
+ StarPos += 1
+ TmpStr = TmpStr[StarPos:].strip()
+ RBPos = TmpStr.find(')')
+ Name = TmpStr[0:RBPos]
+ Value = 'FP' + TmpStr[RBPos + 1:]
+
+ IdTd = DataClass.IdentifierClass(-1, Modifier, '', Name, Value, DataClass.MODEL_IDENTIFIER_TYPEDEF, -1, -1, td.StartPos[0], td.StartPos[1], td.EndPos[0], td.EndPos[1])
+ IdList.append(IdTd)
+
+ for funcCall in FileProfile.FunctionCallingList:
+ IdFC = DataClass.IdentifierClass(-1, '', '', funcCall.FuncName, funcCall.ParamList, DataClass.MODEL_IDENTIFIER_FUNCTION_CALLING, -1, -1, funcCall.StartPos[0], funcCall.StartPos[1], funcCall.EndPos[0], funcCall.EndPos[1])
+ IdList.append(IdFC)
+ return IdList
+
+## GetParamList() method
+#
+# Get a list of parameters
+#
+# @param FuncDeclarator: Function declarator
+# @param FuncNameLine: Line number of function name
+# @param FuncNameOffset: Offset of function name
+#
+# @return ParamIdList: A list of parameters
+#
+def GetParamList(FuncDeclarator, FuncNameLine = 0, FuncNameOffset = 0):
+ ParamIdList = []
+ DeclSplitList = FuncDeclarator.split('(')
+ if len(DeclSplitList) < 2:
+ return ParamIdList
+ FuncName = DeclSplitList[0]
+ ParamStr = DeclSplitList[1].rstrip(')')
+ LineSkipped = 0
+ OffsetSkipped = 0
+ Start = 0
+ while FuncName.find('\n', Start) != -1:
+ LineSkipped += 1
+ OffsetSkipped = 0
+ Start += FuncName.find('\n', Start)
+ Start += 1
+ OffsetSkipped += len(FuncName[Start:])
+ OffsetSkipped += 1 #skip '('
+ ParamBeginLine = FuncNameLine + LineSkipped
+ ParamBeginOffset = OffsetSkipped
+ for p in ParamStr.split(','):
+ ListP = p.split()
+ if len(ListP) == 0:
+ continue
+ ParamName = ListP[-1]
+ DeclText = ParamName.strip()
+ RightSpacePos = p.rfind(ParamName)
+ ParamModifier = p[0:RightSpacePos]
+ if ParamName == 'OPTIONAL':
+ if ParamModifier == '':
+ ParamModifier += ' ' + 'OPTIONAL'
+ DeclText = ''
+ else:
+ ParamName = ListP[-2]
+ DeclText = ParamName.strip()
+ RightSpacePos = p.rfind(ParamName)
+ ParamModifier = p[0:RightSpacePos]
+ ParamModifier += 'OPTIONAL'
+ while DeclText.startswith('*'):
+ ParamModifier += ' ' + '*'
+ DeclText = DeclText.lstrip('*').strip()
+ ParamName = DeclText
+
+ Start = 0
+ while p.find('\n', Start) != -1:
+ LineSkipped += 1
+ OffsetSkipped = 0
+ Start += p.find('\n', Start)
+ Start += 1
+ OffsetSkipped += len(p[Start:])
+
+ ParamEndLine = ParamBeginLine + LineSkipped
+ ParamEndOffset = OffsetSkipped
+ IdParam = DataClass.IdentifierClass(-1, ParamModifier, '', ParamName, '', DataClass.MODEL_IDENTIFIER_PARAMETER, -1, -1, ParamBeginLine, ParamBeginOffset, ParamEndLine, ParamEndOffset)
+ ParamIdList.append(IdParam)
+ ParamBeginLine = ParamEndLine
+ ParamBeginOffset = OffsetSkipped + 1 #skip ','
+
+ return ParamIdList
+
+## GetFunctionList()
+#
+# Get a list of functions
+#
+# @return FuncObjList: A list of function objects
+#
+def GetFunctionList():
+ FuncObjList = []
+ for FuncDef in FileProfile.FunctionDefinitionList:
+ ParamIdList = []
+ DeclText = FuncDef.Declarator.strip()
+ while DeclText.startswith('*'):
+ FuncDef.Modifier += '*'
+ DeclText = DeclText.lstrip('*').strip()
+
+ FuncDef.Declarator = FuncDef.Declarator.lstrip('*')
+ DeclSplitList = FuncDef.Declarator.split('(')
+ if len(DeclSplitList) < 2:
+ continue
+
+ FuncName = DeclSplitList[0]
+ FuncNamePartList = FuncName.split()
+ if len(FuncNamePartList) > 1:
+ FuncName = FuncNamePartList[-1]
+ Index = 0
+ while Index < len(FuncNamePartList) - 1:
+ FuncDef.Modifier += ' ' + FuncNamePartList[Index]
+ Index += 1
+
+ FuncObj = DataClass.FunctionClass(-1, FuncDef.Declarator, FuncDef.Modifier, FuncName.strip(), '', FuncDef.StartPos[0], FuncDef.StartPos[1], FuncDef.EndPos[0], FuncDef.EndPos[1], FuncDef.LeftBracePos[0], FuncDef.LeftBracePos[1], -1, ParamIdList, [])
+ FuncObjList.append(FuncObj)
+
+ return FuncObjList
+
+## CreateCCodeDB() method
+#
+# Create database for all c code
+#
+# @param FileNameList: A list of all c code file names
+#
+def CreateCCodeDB(FileNameList):
+ FileObjList = []
+ ParseErrorFileList = []
+ ParsedFiles = {}
+ for FullName in FileNameList:
+ if os.path.splitext(FullName)[1] in ('.h', '.c'):
+ if FullName.lower() in ParsedFiles:
+ continue
+ ParsedFiles[FullName.lower()] = 1
+ EdkLogger.info("Parsing " + FullName)
+ model = FullName.endswith('c') and DataClass.MODEL_FILE_C or DataClass.MODEL_FILE_H
+ collector = CodeFragmentCollector.CodeFragmentCollector(FullName)
+ try:
+ collector.ParseFile()
+ except:
+ ParseErrorFileList.append(FullName)
+ BaseName = os.path.basename(FullName)
+ DirName = os.path.dirname(FullName)
+ Ext = os.path.splitext(BaseName)[1].lstrip('.')
+ ModifiedTime = os.path.getmtime(FullName)
+ FileObj = DataClass.FileClass(-1, BaseName, Ext, DirName, FullName, model, ModifiedTime, GetFunctionList(), GetIdentifierList(), [])
+ FileObjList.append(FileObj)
+ collector.CleanFileProfileBuffer()
+
+ if len(ParseErrorFileList) > 0:
+ EdkLogger.info("Found unrecoverable error during parsing:\n\t%s\n" % "\n\t".join(ParseErrorFileList))
+
+ Db = EotGlobalData.gDb
+ for file in FileObjList:
+ Db.InsertOneFile(file)
+
+ Db.UpdateIdentifierBelongsToFunction()
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+
+ EdkLogger.Initialize()
+ EdkLogger.SetLevel(EdkLogger.QUIET)
+ CollectSourceCodeDataIntoDB(sys.argv[1])
+
+ print('Done!')
diff --git a/roms/edk2/BaseTools/Source/Python/GNUmakefile b/roms/edk2/BaseTools/Source/Python/GNUmakefile
new file mode 100644
index 000000000..499c55e5e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GNUmakefile
@@ -0,0 +1,12 @@
+## @file
+# GNU/Linux makefile for Python tools build.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+all:
+
+clean:
+ find . -name '*.pyc' -exec rm '{}' ';'
+
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/AprioriSection.py b/roms/edk2/BaseTools/Source/Python/GenFds/AprioriSection.py
new file mode 100644
index 000000000..9f64c613e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/AprioriSection.py
@@ -0,0 +1,121 @@
+## @file
+# process APRIORI file data and generate PEI/DXE APRIORI file
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from struct import pack
+import Common.LongFilePathOs as os
+from io import BytesIO
+from .FfsFileStatement import FileStatement
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+from Common.StringUtils import NormPath
+from Common.Misc import SaveFileOnChange, PathClass
+from Common.EdkLogger import error as EdkLoggerError
+from Common.BuildToolError import RESOURCE_NOT_AVAILABLE
+from Common.DataType import TAB_COMMON
+
+DXE_APRIORI_GUID = "FC510EE7-FFDC-11D4-BD41-0080C73C8881"
+PEI_APRIORI_GUID = "1B45CC0A-156A-428A-AF62-49864DA0E6E6"
+
+## process APRIORI file data and generate PEI/DXE APRIORI file
+#
+#
+class AprioriSection (object):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ self.DefineVarDict = {}
+ self.FfsList = []
+ self.AprioriType = ""
+
+ ## GenFfs() method
+ #
+ # Generate FFS for APRIORI file
+ #
+ # @param self The object pointer
+ # @param FvName for whom apriori file generated
+ # @param Dict dictionary contains macro and its value
+ # @retval string Generated file name
+ #
+ def GenFfs (self, FvName, Dict = None, IsMakefile = False):
+ if Dict is None:
+ Dict = {}
+ Buffer = BytesIO()
+ if self.AprioriType == "PEI":
+ AprioriFileGuid = PEI_APRIORI_GUID
+ else:
+ AprioriFileGuid = DXE_APRIORI_GUID
+
+ OutputAprFilePath = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, \
+ GenFdsGlobalVariable.FfsDir,\
+ AprioriFileGuid + FvName)
+ if not os.path.exists(OutputAprFilePath):
+ os.makedirs(OutputAprFilePath)
+
+ OutputAprFileName = os.path.join( OutputAprFilePath, \
+ AprioriFileGuid + FvName + '.Apri' )
+ AprFfsFileName = os.path.join (OutputAprFilePath,\
+ AprioriFileGuid + FvName + '.Ffs')
+
+ Dict.update(self.DefineVarDict)
+ InfFileName = None
+ for FfsObj in self.FfsList:
+ Guid = ""
+ if isinstance(FfsObj, FileStatement):
+ Guid = FfsObj.NameGuid
+ else:
+ InfFileName = NormPath(FfsObj.InfFileName)
+ Arch = FfsObj.GetCurrentArch()
+
+ if Arch:
+ Dict['$(ARCH)'] = Arch
+ InfFileName = GenFdsGlobalVariable.MacroExtend(InfFileName, Dict, Arch)
+
+ if Arch:
+ Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ Guid = Inf.Guid
+ else:
+ Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ Guid = Inf.Guid
+
+ if not Inf.Module.Binaries:
+ EdkLoggerError("GenFds", RESOURCE_NOT_AVAILABLE,
+ "INF %s not found in build ARCH %s!" \
+ % (InfFileName, GenFdsGlobalVariable.ArchList))
+
+ GuidPart = Guid.split('-')
+ Buffer.write(pack('I', int(GuidPart[0], 16)))
+ Buffer.write(pack('H', int(GuidPart[1], 16)))
+ Buffer.write(pack('H', int(GuidPart[2], 16)))
+
+ for Num in range(2):
+ Char = GuidPart[3][Num*2:Num*2+2]
+ Buffer.write(pack('B', int(Char, 16)))
+
+ for Num in range(6):
+ Char = GuidPart[4][Num*2:Num*2+2]
+ Buffer.write(pack('B', int(Char, 16)))
+
+ SaveFileOnChange(OutputAprFileName, Buffer.getvalue())
+
+ RawSectionFileName = os.path.join( OutputAprFilePath, \
+ AprioriFileGuid + FvName + '.raw' )
+ MakefilePath = None
+ if IsMakefile:
+ if not InfFileName:
+ return None
+ MakefilePath = InfFileName, Arch
+ GenFdsGlobalVariable.GenerateSection(RawSectionFileName, [OutputAprFileName], 'EFI_SECTION_RAW', IsMakefile=IsMakefile)
+ GenFdsGlobalVariable.GenerateFfs(AprFfsFileName, [RawSectionFileName],
+ 'EFI_FV_FILETYPE_FREEFORM', AprioriFileGuid, MakefilePath=MakefilePath)
+
+ return AprFfsFileName
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/Capsule.py b/roms/edk2/BaseTools/Source/Python/GenFds/Capsule.py
new file mode 100644
index 000000000..f4bfc74e5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/Capsule.py
@@ -0,0 +1,250 @@
+## @file
+# generate capsule
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from .GenFdsGlobalVariable import GenFdsGlobalVariable, FindExtendTool
+from CommonDataClass.FdfClass import CapsuleClassObject
+import Common.LongFilePathOs as os
+from io import BytesIO
+from Common.Misc import SaveFileOnChange, PackGUID
+import uuid
+from struct import pack
+from Common import EdkLogger
+from Common.BuildToolError import GENFDS_ERROR
+from Common.DataType import TAB_LINE_BREAK
+
+WIN_CERT_REVISION = 0x0200
+WIN_CERT_TYPE_EFI_GUID = 0x0EF1
+EFI_CERT_TYPE_PKCS7_GUID = uuid.UUID('{4aafd29d-68df-49ee-8aa9-347d375665a7}')
+EFI_CERT_TYPE_RSA2048_SHA256_GUID = uuid.UUID('{a7717414-c616-4977-9420-844712a735bf}')
+
+## create inf file describes what goes into capsule and call GenFv to generate capsule
+#
+#
+class Capsule (CapsuleClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ CapsuleClassObject.__init__(self)
+ # For GenFv
+ self.BlockSize = None
+ # For GenFv
+ self.BlockNum = None
+ self.CapsuleName = None
+
+ ## Generate FMP capsule
+ #
+ # @retval string Generated Capsule file path
+ #
+ def GenFmpCapsule(self):
+ #
+ # Generate capsule header
+ # typedef struct {
+ # EFI_GUID CapsuleGuid;
+ # UINT32 HeaderSize;
+ # UINT32 Flags;
+ # UINT32 CapsuleImageSize;
+ # } EFI_CAPSULE_HEADER;
+ #
+ Header = BytesIO()
+ #
+ # Use FMP capsule GUID: 6DCBD5ED-E82D-4C44-BDA1-7194199AD92A
+ #
+ Header.write(PackGUID('6DCBD5ED-E82D-4C44-BDA1-7194199AD92A'.split('-')))
+ HdrSize = 0
+ if 'CAPSULE_HEADER_SIZE' in self.TokensDict:
+ Header.write(pack('=I', int(self.TokensDict['CAPSULE_HEADER_SIZE'], 16)))
+ HdrSize = int(self.TokensDict['CAPSULE_HEADER_SIZE'], 16)
+ else:
+ Header.write(pack('=I', 0x20))
+ HdrSize = 0x20
+ Flags = 0
+ if 'CAPSULE_FLAGS' in self.TokensDict:
+ for flag in self.TokensDict['CAPSULE_FLAGS'].split(','):
+ flag = flag.strip()
+ if flag == 'PopulateSystemTable':
+ Flags |= 0x00010000 | 0x00020000
+ elif flag == 'PersistAcrossReset':
+ Flags |= 0x00010000
+ elif flag == 'InitiateReset':
+ Flags |= 0x00040000
+ Header.write(pack('=I', Flags))
+ #
+ # typedef struct {
+ # UINT32 Version;
+ # UINT16 EmbeddedDriverCount;
+ # UINT16 PayloadItemCount;
+ # // UINT64 ItemOffsetList[];
+ # } EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER;
+ #
+ FwMgrHdr = BytesIO()
+ if 'CAPSULE_HEADER_INIT_VERSION' in self.TokensDict:
+ FwMgrHdr.write(pack('=I', int(self.TokensDict['CAPSULE_HEADER_INIT_VERSION'], 16)))
+ else:
+ FwMgrHdr.write(pack('=I', 0x00000001))
+ FwMgrHdr.write(pack('=HH', len(self.CapsuleDataList), len(self.FmpPayloadList)))
+ FwMgrHdrSize = 4+2+2+8*(len(self.CapsuleDataList)+len(self.FmpPayloadList))
+
+ #
+ # typedef struct _WIN_CERTIFICATE {
+ # UINT32 dwLength;
+ # UINT16 wRevision;
+ # UINT16 wCertificateType;
+ # //UINT8 bCertificate[ANYSIZE_ARRAY];
+ # } WIN_CERTIFICATE;
+ #
+ # typedef struct _WIN_CERTIFICATE_UEFI_GUID {
+ # WIN_CERTIFICATE Hdr;
+ # EFI_GUID CertType;
+ # //UINT8 CertData[ANYSIZE_ARRAY];
+ # } WIN_CERTIFICATE_UEFI_GUID;
+ #
+ # typedef struct {
+ # UINT64 MonotonicCount;
+ # WIN_CERTIFICATE_UEFI_GUID AuthInfo;
+ # } EFI_FIRMWARE_IMAGE_AUTHENTICATION;
+ #
+ # typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
+ # EFI_GUID HashType;
+ # UINT8 PublicKey[256];
+ # UINT8 Signature[256];
+ # } EFI_CERT_BLOCK_RSA_2048_SHA256;
+ #
+
+ PreSize = FwMgrHdrSize
+ Content = BytesIO()
+ for driver in self.CapsuleDataList:
+ FileName = driver.GenCapsuleSubItem()
+ FwMgrHdr.write(pack('=Q', PreSize))
+ PreSize += os.path.getsize(FileName)
+ File = open(FileName, 'rb')
+ Content.write(File.read())
+ File.close()
+ for fmp in self.FmpPayloadList:
+ if fmp.Existed:
+ FwMgrHdr.write(pack('=Q', PreSize))
+ PreSize += len(fmp.Buffer)
+ Content.write(fmp.Buffer)
+ continue
+ if fmp.ImageFile:
+ for Obj in fmp.ImageFile:
+ fmp.ImageFile = Obj.GenCapsuleSubItem()
+ if fmp.VendorCodeFile:
+ for Obj in fmp.VendorCodeFile:
+ fmp.VendorCodeFile = Obj.GenCapsuleSubItem()
+ if fmp.Certificate_Guid:
+ ExternalTool, ExternalOption = FindExtendTool([], GenFdsGlobalVariable.ArchList, fmp.Certificate_Guid)
+ CmdOption = ''
+ CapInputFile = fmp.ImageFile
+ if not os.path.isabs(fmp.ImageFile):
+ CapInputFile = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, fmp.ImageFile)
+ CapOutputTmp = os.path.join(GenFdsGlobalVariable.FvDir, self.UiCapsuleName) + '.tmp'
+ if ExternalTool is None:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "No tool found with GUID %s" % fmp.Certificate_Guid)
+ else:
+ CmdOption += ExternalTool
+ if ExternalOption:
+ CmdOption = CmdOption + ' ' + ExternalOption
+ CmdOption += ' -e ' + ' --monotonic-count ' + str(fmp.MonotonicCount) + ' -o ' + CapOutputTmp + ' ' + CapInputFile
+ CmdList = CmdOption.split()
+ GenFdsGlobalVariable.CallExternalTool(CmdList, "Failed to generate FMP auth capsule")
+ if uuid.UUID(fmp.Certificate_Guid) == EFI_CERT_TYPE_PKCS7_GUID:
+ dwLength = 4 + 2 + 2 + 16 + os.path.getsize(CapOutputTmp) - os.path.getsize(CapInputFile)
+ else:
+ dwLength = 4 + 2 + 2 + 16 + 16 + 256 + 256
+ fmp.ImageFile = CapOutputTmp
+ AuthData = [fmp.MonotonicCount, dwLength, WIN_CERT_REVISION, WIN_CERT_TYPE_EFI_GUID, fmp.Certificate_Guid]
+ fmp.Buffer = fmp.GenCapsuleSubItem(AuthData)
+ else:
+ fmp.Buffer = fmp.GenCapsuleSubItem()
+ FwMgrHdr.write(pack('=Q', PreSize))
+ PreSize += len(fmp.Buffer)
+ Content.write(fmp.Buffer)
+ BodySize = len(FwMgrHdr.getvalue()) + len(Content.getvalue())
+ Header.write(pack('=I', HdrSize + BodySize))
+ #
+ # The real capsule header structure is 28 bytes
+ #
+ Header.write(b'\x00'*(HdrSize-28))
+ Header.write(FwMgrHdr.getvalue())
+ Header.write(Content.getvalue())
+ #
+ # Generate FMP capsule file
+ #
+ CapOutputFile = os.path.join(GenFdsGlobalVariable.FvDir, self.UiCapsuleName) + '.Cap'
+ SaveFileOnChange(CapOutputFile, Header.getvalue(), True)
+ return CapOutputFile
+
+ ## Generate capsule
+ #
+ # @param self The object pointer
+ # @retval string Generated Capsule file path
+ #
+ def GenCapsule(self):
+ if self.UiCapsuleName.upper() + 'cap' in GenFdsGlobalVariable.ImageBinDict:
+ return GenFdsGlobalVariable.ImageBinDict[self.UiCapsuleName.upper() + 'cap']
+
+ GenFdsGlobalVariable.InfLogger( "\nGenerate %s Capsule" %self.UiCapsuleName)
+ if ('CAPSULE_GUID' in self.TokensDict and
+ uuid.UUID(self.TokensDict['CAPSULE_GUID']) == uuid.UUID('6DCBD5ED-E82D-4C44-BDA1-7194199AD92A')):
+ return self.GenFmpCapsule()
+
+ CapInfFile = self.GenCapInf()
+ CapInfFile.append("[files]" + TAB_LINE_BREAK)
+ CapFileList = []
+ for CapsuleDataObj in self.CapsuleDataList:
+ CapsuleDataObj.CapsuleName = self.CapsuleName
+ FileName = CapsuleDataObj.GenCapsuleSubItem()
+ CapsuleDataObj.CapsuleName = None
+ CapFileList.append(FileName)
+ CapInfFile.append("EFI_FILE_NAME = " + \
+ FileName + \
+ TAB_LINE_BREAK)
+ SaveFileOnChange(self.CapInfFileName, ''.join(CapInfFile), False)
+ #
+ # Call GenFv tool to generate capsule
+ #
+ CapOutputFile = os.path.join(GenFdsGlobalVariable.FvDir, self.UiCapsuleName)
+ CapOutputFile = CapOutputFile + '.Cap'
+ GenFdsGlobalVariable.GenerateFirmwareVolume(
+ CapOutputFile,
+ [self.CapInfFileName],
+ Capsule=True,
+ FfsList=CapFileList
+ )
+
+ GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s Capsule Successfully" %self.UiCapsuleName)
+ GenFdsGlobalVariable.SharpCounter = 0
+ GenFdsGlobalVariable.ImageBinDict[self.UiCapsuleName.upper() + 'cap'] = CapOutputFile
+ return CapOutputFile
+
+ ## Generate inf file for capsule
+ #
+ # @param self The object pointer
+ # @retval file inf file object
+ #
+ def GenCapInf(self):
+ self.CapInfFileName = os.path.join(GenFdsGlobalVariable.FvDir,
+ self.UiCapsuleName + "_Cap" + '.inf')
+ CapInfFile = []
+
+ CapInfFile.append("[options]" + TAB_LINE_BREAK)
+
+ for Item in self.TokensDict:
+ CapInfFile.append("EFI_" + \
+ Item + \
+ ' = ' + \
+ self.TokensDict[Item] + \
+ TAB_LINE_BREAK)
+
+ return CapInfFile
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/CapsuleData.py b/roms/edk2/BaseTools/Source/Python/GenFds/CapsuleData.py
new file mode 100644
index 000000000..ebbde7f87
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/CapsuleData.py
@@ -0,0 +1,239 @@
+## @file
+# generate capsule
+#
+# Copyright (c) 2007-2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+from io import BytesIO
+from struct import pack
+import os
+from Common.Misc import SaveFileOnChange
+import uuid
+
+## base class for capsule data
+#
+#
+class CapsuleData:
+ ## The constructor
+ #
+ # @param self The object pointer
+ def __init__(self):
+ pass
+
+ ## generate capsule data
+ #
+ # @param self The object pointer
+ def GenCapsuleSubItem(self):
+ pass
+
+## FFS class for capsule data
+#
+#
+class CapsuleFfs (CapsuleData):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self) :
+ self.Ffs = None
+ self.FvName = None
+
+ ## generate FFS capsule data
+ #
+ # @param self The object pointer
+ # @retval string Generated file name
+ #
+ def GenCapsuleSubItem(self):
+ FfsFile = self.Ffs.GenFfs()
+ return FfsFile
+
+## FV class for capsule data
+#
+#
+class CapsuleFv (CapsuleData):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self) :
+ self.Ffs = None
+ self.FvName = None
+ self.CapsuleName = None
+
+ ## generate FV capsule data
+ #
+ # @param self The object pointer
+ # @retval string Generated file name
+ #
+ def GenCapsuleSubItem(self):
+ if self.FvName.find('.fv') == -1:
+ if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict:
+ FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[self.FvName.upper()]
+ FdBuffer = BytesIO()
+ FvObj.CapsuleName = self.CapsuleName
+ FvFile = FvObj.AddToBuffer(FdBuffer)
+ FvObj.CapsuleName = None
+ FdBuffer.close()
+ return FvFile
+ else:
+ FvFile = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FvName)
+ return FvFile
+
+## FD class for capsule data
+#
+#
+class CapsuleFd (CapsuleData):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self) :
+ self.Ffs = None
+ self.FdName = None
+ self.CapsuleName = None
+
+ ## generate FD capsule data
+ #
+ # @param self The object pointer
+ # @retval string Generated file name
+ #
+ def GenCapsuleSubItem(self):
+ if self.FdName.find('.fd') == -1:
+ if self.FdName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict:
+ FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[self.FdName.upper()]
+ FdFile = FdObj.GenFd()
+ return FdFile
+ else:
+ FdFile = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FdName)
+ return FdFile
+
+## AnyFile class for capsule data
+#
+#
+class CapsuleAnyFile (CapsuleData):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self) :
+ self.Ffs = None
+ self.FileName = None
+
+ ## generate AnyFile capsule data
+ #
+ # @param self The object pointer
+ # @retval string Generated file name
+ #
+ def GenCapsuleSubItem(self):
+ return self.FileName
+
+## Afile class for capsule data
+#
+#
+class CapsuleAfile (CapsuleData):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self) :
+ self.Ffs = None
+ self.FileName = None
+
+ ## generate Afile capsule data
+ #
+ # @param self The object pointer
+ # @retval string Generated file name
+ #
+ def GenCapsuleSubItem(self):
+ return self.FileName
+
+class CapsulePayload(CapsuleData):
+ '''Generate payload file, the header is defined below:
+ #pragma pack(1)
+ typedef struct {
+ UINT32 Version;
+ EFI_GUID UpdateImageTypeId;
+ UINT8 UpdateImageIndex;
+ UINT8 reserved_bytes[3];
+ UINT32 UpdateImageSize;
+ UINT32 UpdateVendorCodeSize;
+ UINT64 UpdateHardwareInstance; //Introduced in v2
+ } EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER;
+ '''
+ def __init__(self):
+ self.UiName = None
+ self.Version = None
+ self.ImageTypeId = None
+ self.ImageIndex = None
+ self.HardwareInstance = None
+ self.ImageFile = []
+ self.VendorCodeFile = []
+ self.Certificate_Guid = None
+ self.MonotonicCount = None
+ self.Existed = False
+ self.Buffer = None
+
+ def GenCapsuleSubItem(self, AuthData=[]):
+ if not self.Version:
+ self.Version = '0x00000002'
+ if not self.ImageIndex:
+ self.ImageIndex = '0x1'
+ if not self.HardwareInstance:
+ self.HardwareInstance = '0x0'
+ ImageFileSize = os.path.getsize(self.ImageFile)
+ if AuthData:
+ # the ImageFileSize need include the full authenticated info size. From first bytes of MonotonicCount to last bytes of certificate.
+ # the 32 bit is the MonotonicCount, dwLength, wRevision, wCertificateType and CertType
+ ImageFileSize += 32
+ VendorFileSize = 0
+ if self.VendorCodeFile:
+ VendorFileSize = os.path.getsize(self.VendorCodeFile)
+
+ #
+ # Fill structure
+ #
+ Guid = self.ImageTypeId.split('-')
+ Buffer = pack('=ILHHBBBBBBBBBBBBIIQ',
+ int(self.Version, 16),
+ int(Guid[0], 16),
+ int(Guid[1], 16),
+ int(Guid[2], 16),
+ int(Guid[3][-4:-2], 16),
+ int(Guid[3][-2:], 16),
+ int(Guid[4][-12:-10], 16),
+ int(Guid[4][-10:-8], 16),
+ int(Guid[4][-8:-6], 16),
+ int(Guid[4][-6:-4], 16),
+ int(Guid[4][-4:-2], 16),
+ int(Guid[4][-2:], 16),
+ int(self.ImageIndex, 16),
+ 0,
+ 0,
+ 0,
+ ImageFileSize,
+ VendorFileSize,
+ int(self.HardwareInstance, 16)
+ )
+ if AuthData:
+ Buffer += pack('QIHH', AuthData[0], AuthData[1], AuthData[2], AuthData[3])
+ Buffer += uuid.UUID(AuthData[4]).bytes_le
+
+ #
+ # Append file content to the structure
+ #
+ ImageFile = open(self.ImageFile, 'rb')
+ Buffer += ImageFile.read()
+ ImageFile.close()
+ if self.VendorCodeFile:
+ VendorFile = open(self.VendorCodeFile, 'rb')
+ Buffer += VendorFile.read()
+ VendorFile.close()
+ self.Existed = True
+ return Buffer
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/CompressSection.py b/roms/edk2/BaseTools/Source/Python/GenFds/CompressSection.py
new file mode 100644
index 000000000..e62280fc1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/CompressSection.py
@@ -0,0 +1,96 @@
+## @file
+# process compress section generation
+#
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from .Ffs import SectionSuffix
+from . import Section
+import subprocess
+import Common.LongFilePathOs as os
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+from CommonDataClass.FdfClass import CompressSectionClassObject
+from Common.DataType import *
+
+## generate compress section
+#
+#
+class CompressSection (CompressSectionClassObject) :
+
+ ## compress types: PI standard and non PI standard
+ CompTypeDict = {
+ 'PI_STD' : 'PI_STD',
+ 'PI_NONE' : 'PI_NONE'
+ }
+
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ CompressSectionClassObject.__init__(self)
+
+ ## GenSection() method
+ #
+ # Generate compressed section
+ #
+ # @param self The object pointer
+ # @param OutputPath Where to place output file
+ # @param ModuleName Which module this section belongs to
+ # @param SecNum Index of section
+ # @param KeyStringList Filter for inputs of section generation
+ # @param FfsInf FfsInfStatement object that contains this section data
+ # @param Dict dictionary contains macro and its value
+ # @retval tuple (Generated file name, section alignment)
+ #
+ def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = None, IsMakefile = False):
+
+ if FfsInf is not None:
+ self.CompType = FfsInf.__ExtendMacro__(self.CompType)
+ self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
+
+ SectFiles = tuple()
+ SectAlign = []
+ Index = 0
+ MaxAlign = None
+ if Dict is None:
+ Dict = {}
+ for Sect in self.SectionList:
+ Index = Index + 1
+ SecIndex = '%s.%d' %(SecNum, Index)
+ ReturnSectList, AlignValue = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict, IsMakefile=IsMakefile)
+ if AlignValue is not None:
+ if MaxAlign is None:
+ MaxAlign = AlignValue
+ if GenFdsGlobalVariable.GetAlignment (AlignValue) > GenFdsGlobalVariable.GetAlignment (MaxAlign):
+ MaxAlign = AlignValue
+ if ReturnSectList != []:
+ if AlignValue is None:
+ AlignValue = "1"
+ for FileData in ReturnSectList:
+ SectFiles += (FileData,)
+ SectAlign.append(AlignValue)
+
+ OutputFile = OutputPath + \
+ os.sep + \
+ ModuleName + \
+ SUP_MODULE_SEC + \
+ SecNum + \
+ SectionSuffix['COMPRESS']
+ OutputFile = os.path.normpath(OutputFile)
+ DummyFile = OutputFile + '.dummy'
+ GenFdsGlobalVariable.GenerateSection(DummyFile, SectFiles, InputAlign=SectAlign, IsMakefile=IsMakefile)
+
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [DummyFile], Section.Section.SectionType['COMPRESS'],
+ CompressionType=self.CompTypeDict[self.CompType], IsMakefile=IsMakefile)
+ OutputFileList = []
+ OutputFileList.append(OutputFile)
+ return OutputFileList, self.Alignment
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/DataSection.py b/roms/edk2/BaseTools/Source/Python/GenFds/DataSection.py
new file mode 100644
index 000000000..f20fd7022
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/DataSection.py
@@ -0,0 +1,124 @@
+## @file
+# process data section generation
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from . import Section
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+import subprocess
+from .Ffs import SectionSuffix
+import Common.LongFilePathOs as os
+from CommonDataClass.FdfClass import DataSectionClassObject
+from Common.Misc import PeImageClass
+from Common.LongFilePathSupport import CopyLongFilePath
+from Common.DataType import *
+
+## generate data section
+#
+#
+class DataSection (DataSectionClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ DataSectionClassObject.__init__(self)
+
+ ## GenSection() method
+ #
+ # Generate compressed section
+ #
+ # @param self The object pointer
+ # @param OutputPath Where to place output file
+ # @param ModuleName Which module this section belongs to
+ # @param SecNum Index of section
+ # @param KeyStringList Filter for inputs of section generation
+ # @param FfsInf FfsInfStatement object that contains this section data
+ # @param Dict dictionary contains macro and its value
+ # @retval tuple (Generated file name list, section alignment)
+ #
+ def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = None, IsMakefile = False):
+ #
+ # Prepare the parameter of GenSection
+ #
+ if Dict is None:
+ Dict = {}
+ if FfsFile is not None:
+ self.SectFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.SectFileName)
+ self.SectFileName = GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict, FfsFile.CurrentArch)
+ else:
+ self.SectFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.SectFileName)
+ self.SectFileName = GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)
+
+ """Check Section file exist or not !"""
+
+ if not os.path.exists(self.SectFileName):
+ self.SectFileName = os.path.join (GenFdsGlobalVariable.WorkSpaceDir,
+ self.SectFileName)
+
+ """Copy Map file to Ffs output"""
+ Filename = GenFdsGlobalVariable.MacroExtend(self.SectFileName)
+ if Filename[(len(Filename)-4):] == '.efi':
+ MapFile = Filename.replace('.efi', '.map')
+ CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')
+ if IsMakefile:
+ if GenFdsGlobalVariable.CopyList == []:
+ GenFdsGlobalVariable.CopyList = [(MapFile, CopyMapFile)]
+ else:
+ GenFdsGlobalVariable.CopyList.append((MapFile, CopyMapFile))
+ else:
+ if os.path.exists(MapFile):
+ if not os.path.exists(CopyMapFile) or (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):
+ CopyLongFilePath(MapFile, CopyMapFile)
+
+ #Get PE Section alignment when align is set to AUTO
+ if self.Alignment == 'Auto' and self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
+ ImageObj = PeImageClass (Filename)
+ if ImageObj.SectionAlignment < 0x400:
+ self.Alignment = str (ImageObj.SectionAlignment)
+ elif ImageObj.SectionAlignment < 0x100000:
+ self.Alignment = str (ImageObj.SectionAlignment // 0x400) + 'K'
+ else:
+ self.Alignment = str (ImageObj.SectionAlignment // 0x100000) + 'M'
+
+ NoStrip = True
+ if self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
+ if self.KeepReloc is not None:
+ NoStrip = self.KeepReloc
+
+ if not NoStrip:
+ FileBeforeStrip = os.path.join(OutputPath, ModuleName + '.efi')
+ if not os.path.exists(FileBeforeStrip) or \
+ (os.path.getmtime(self.SectFileName) > os.path.getmtime(FileBeforeStrip)):
+ CopyLongFilePath(self.SectFileName, FileBeforeStrip)
+ StrippedFile = os.path.join(OutputPath, ModuleName + '.stripped')
+ GenFdsGlobalVariable.GenerateFirmwareImage(
+ StrippedFile,
+ [GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)],
+ Strip=True,
+ IsMakefile = IsMakefile
+ )
+ self.SectFileName = StrippedFile
+
+ if self.SecType == BINARY_FILE_TYPE_TE:
+ TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
+ GenFdsGlobalVariable.GenerateFirmwareImage(
+ TeFile,
+ [GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)],
+ Type='te',
+ IsMakefile = IsMakefile
+ )
+ self.SectFileName = TeFile
+
+ OutputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + SectionSuffix.get(self.SecType))
+ OutputFile = os.path.normpath(OutputFile)
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileName], Section.Section.SectionType.get(self.SecType), IsMakefile = IsMakefile)
+ FileList = [OutputFile]
+ return FileList, self.Alignment
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/DepexSection.py b/roms/edk2/BaseTools/Source/Python/GenFds/DepexSection.py
new file mode 100644
index 000000000..6cabac38c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/DepexSection.py
@@ -0,0 +1,111 @@
+## @file
+# process depex section generation
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from . import Section
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+import Common.LongFilePathOs as os
+from CommonDataClass.FdfClass import DepexSectionClassObject
+from AutoGen.GenDepex import DependencyExpression
+from Common import EdkLogger
+from Common.BuildToolError import *
+from Common.Misc import PathClass
+from Common.DataType import *
+
+## generate data section
+#
+#
+class DepexSection (DepexSectionClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ DepexSectionClassObject.__init__(self)
+
+ def __FindGuidValue(self, CName):
+ for Arch in GenFdsGlobalVariable.ArchList:
+ PkgList = GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform,
+ Arch,
+ GenFdsGlobalVariable.TargetName,
+ GenFdsGlobalVariable.ToolChainTag)
+ for Inf in GenFdsGlobalVariable.FdfParser.Profile.InfList:
+ ModuleData = GenFdsGlobalVariable.WorkSpace.BuildObject[
+ PathClass(Inf, GenFdsGlobalVariable.WorkSpaceDir),
+ Arch,
+ GenFdsGlobalVariable.TargetName,
+ GenFdsGlobalVariable.ToolChainTag
+ ]
+ for Pkg in ModuleData.Packages:
+ if Pkg not in PkgList:
+ PkgList.append(Pkg)
+ for PkgDb in PkgList:
+ if CName in PkgDb.Ppis:
+ return PkgDb.Ppis[CName]
+ if CName in PkgDb.Protocols:
+ return PkgDb.Protocols[CName]
+ if CName in PkgDb.Guids:
+ return PkgDb.Guids[CName]
+ return None
+
+ ## GenSection() method
+ #
+ # Generate compressed section
+ #
+ # @param self The object pointer
+ # @param OutputPath Where to place output file
+ # @param ModuleName Which module this section belongs to
+ # @param SecNum Index of section
+ # @param KeyStringList Filter for inputs of section generation
+ # @param FfsInf FfsInfStatement object that contains this section data
+ # @param Dict dictionary contains macro and its value
+ # @retval tuple (Generated file name list, section alignment)
+ #
+ def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = None, IsMakefile = False):
+ if self.ExpressionProcessed == False:
+ self.Expression = self.Expression.replace("\n", " ").replace("\r", " ")
+ ExpList = self.Expression.split()
+
+ for Exp in ExpList:
+ if Exp.upper() not in ('AND', 'OR', 'NOT', 'TRUE', 'FALSE', 'SOR', 'BEFORE', 'AFTER', 'END'):
+ GuidStr = self.__FindGuidValue(Exp)
+ if GuidStr is None:
+ EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE,
+ "Depex GUID %s could not be found in build DB! (ModuleName: %s)" % (Exp, ModuleName))
+
+ self.Expression = self.Expression.replace(Exp, GuidStr)
+
+ self.Expression = self.Expression.strip()
+ self.ExpressionProcessed = True
+
+ if self.DepexType == 'PEI_DEPEX_EXP':
+ ModuleType = SUP_MODULE_PEIM
+ SecType = BINARY_FILE_TYPE_PEI_DEPEX
+ elif self.DepexType == 'DXE_DEPEX_EXP':
+ ModuleType = SUP_MODULE_DXE_DRIVER
+ SecType = BINARY_FILE_TYPE_DXE_DEPEX
+ elif self.DepexType == 'SMM_DEPEX_EXP':
+ ModuleType = SUP_MODULE_DXE_SMM_DRIVER
+ SecType = BINARY_FILE_TYPE_SMM_DEPEX
+ else:
+ EdkLogger.error("GenFds", FORMAT_INVALID,
+ "Depex type %s is not valid for module %s" % (self.DepexType, ModuleName))
+
+ InputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + '.depex')
+ InputFile = os.path.normpath(InputFile)
+ Depex = DependencyExpression(self.Expression, ModuleType)
+ Depex.Generate(InputFile)
+
+ OutputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + '.dpx')
+ OutputFile = os.path.normpath(OutputFile)
+
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType), IsMakefile=IsMakefile)
+ return [OutputFile], self.Alignment
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/EfiSection.py b/roms/edk2/BaseTools/Source/Python/GenFds/EfiSection.py
new file mode 100644
index 000000000..e7d463904
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/EfiSection.py
@@ -0,0 +1,325 @@
+## @file
+# process rule section generation
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from struct import *
+from . import Section
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+import subprocess
+from .Ffs import SectionSuffix
+import Common.LongFilePathOs as os
+from CommonDataClass.FdfClass import EfiSectionClassObject
+from Common import EdkLogger
+from Common.BuildToolError import *
+from Common.Misc import PeImageClass
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.LongFilePathSupport import CopyLongFilePath
+from Common.DataType import *
+
+## generate rule section
+#
+#
+class EfiSection (EfiSectionClassObject):
+
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ EfiSectionClassObject.__init__(self)
+
+ ## GenSection() method
+ #
+ # Generate rule section
+ #
+ # @param self The object pointer
+ # @param OutputPath Where to place output file
+ # @param ModuleName Which module this section belongs to
+ # @param SecNum Index of section
+ # @param KeyStringList Filter for inputs of section generation
+ # @param FfsInf FfsInfStatement object that contains this section data
+ # @param Dict dictionary contains macro and its value
+ # @retval tuple (Generated file name list, section alignment)
+ #
+ def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = None, IsMakefile = False) :
+
+ if self.FileName is not None and self.FileName.startswith('PCD('):
+ self.FileName = GenFdsGlobalVariable.GetPcdValue(self.FileName)
+ """Prepare the parameter of GenSection"""
+ if FfsInf is not None :
+ InfFileName = FfsInf.InfFileName
+ SectionType = FfsInf.__ExtendMacro__(self.SectionType)
+ Filename = FfsInf.__ExtendMacro__(self.FileName)
+ BuildNum = FfsInf.__ExtendMacro__(self.BuildNum)
+ StringData = FfsInf.__ExtendMacro__(self.StringData)
+ ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')
+ NoStrip = True
+ if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_MM_CORE_STANDALONE) and SectionType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
+ if FfsInf.KeepReloc is not None:
+ NoStrip = FfsInf.KeepReloc
+ elif FfsInf.KeepRelocFromRule is not None:
+ NoStrip = FfsInf.KeepRelocFromRule
+ elif self.KeepReloc is not None:
+ NoStrip = self.KeepReloc
+ elif FfsInf.ShadowFromInfFile is not None:
+ NoStrip = FfsInf.ShadowFromInfFile
+ else:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "Module %s apply rule for None!" %ModuleName)
+
+ """If the file name was pointed out, add it in FileList"""
+ FileList = []
+ if Dict is None:
+ Dict = {}
+ if Filename is not None:
+ Filename = GenFdsGlobalVariable.MacroExtend(Filename, Dict)
+ # check if the path is absolute or relative
+ if os.path.isabs(Filename):
+ Filename = os.path.normpath(Filename)
+ else:
+ Filename = os.path.normpath(os.path.join(FfsInf.EfiOutputPath, Filename))
+
+ if not self.Optional:
+ FileList.append(Filename)
+ elif os.path.exists(Filename):
+ FileList.append(Filename)
+ elif IsMakefile:
+ SuffixMap = FfsInf.GetFinalTargetSuffixMap()
+ if '.depex' in SuffixMap:
+ FileList.append(Filename)
+ else:
+ FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension, Dict, IsMakefile=IsMakefile, SectionType=SectionType)
+ if IsSect :
+ return FileList, self.Alignment
+
+ Index = 0
+ Align = self.Alignment
+
+ """ If Section type is 'VERSION'"""
+ OutputFileList = []
+ if SectionType == 'VERSION':
+
+ InfOverrideVerString = False
+ if FfsInf.Version is not None:
+ #StringData = FfsInf.Version
+ BuildNum = FfsInf.Version
+ InfOverrideVerString = True
+
+ if InfOverrideVerString:
+ #VerTuple = ('-n', '"' + StringData + '"')
+ if BuildNum is not None and BuildNum != '':
+ BuildNumTuple = ('-j', BuildNum)
+ else:
+ BuildNumTuple = tuple()
+
+ Num = SecNum
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + SectionSuffix.get(SectionType))
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
+ #Ui=StringData,
+ Ver=BuildNum,
+ IsMakefile=IsMakefile)
+ OutputFileList.append(OutputFile)
+
+ elif FileList != []:
+ for File in FileList:
+ Index = Index + 1
+ Num = '%s.%d' %(SecNum, Index)
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + SectionSuffix.get(SectionType))
+ f = open(File, 'r')
+ VerString = f.read()
+ f.close()
+ BuildNum = VerString
+ if BuildNum is not None and BuildNum != '':
+ BuildNumTuple = ('-j', BuildNum)
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
+ #Ui=VerString,
+ Ver=BuildNum,
+ IsMakefile=IsMakefile)
+ OutputFileList.append(OutputFile)
+
+ else:
+ BuildNum = StringData
+ if BuildNum is not None and BuildNum != '':
+ BuildNumTuple = ('-j', BuildNum)
+ else:
+ BuildNumTuple = tuple()
+ BuildNumString = ' ' + ' '.join(BuildNumTuple)
+
+ #if VerString == '' and
+ if BuildNumString == '':
+ if self.Optional == True :
+ GenFdsGlobalVariable.VerboseLogger( "Optional Section don't exist!")
+ return [], None
+ else:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss Version Section value" %InfFileName)
+ Num = SecNum
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + SectionSuffix.get(SectionType))
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
+ #Ui=VerString,
+ Ver=BuildNum,
+ IsMakefile=IsMakefile)
+ OutputFileList.append(OutputFile)
+
+ #
+ # If Section Type is BINARY_FILE_TYPE_UI
+ #
+ elif SectionType == BINARY_FILE_TYPE_UI:
+
+ InfOverrideUiString = False
+ if FfsInf.Ui is not None:
+ StringData = FfsInf.Ui
+ InfOverrideUiString = True
+
+ if InfOverrideUiString:
+ Num = SecNum
+ if IsMakefile and StringData == ModuleNameStr:
+ StringData = "$(MODULE_NAME)"
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + SectionSuffix.get(SectionType))
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
+ Ui=StringData, IsMakefile=IsMakefile)
+ OutputFileList.append(OutputFile)
+
+ elif FileList != []:
+ for File in FileList:
+ Index = Index + 1
+ Num = '%s.%d' %(SecNum, Index)
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + SectionSuffix.get(SectionType))
+ f = open(File, 'r')
+ UiString = f.read()
+ f.close()
+ if IsMakefile and UiString == ModuleNameStr:
+ UiString = "$(MODULE_NAME)"
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
+ Ui=UiString, IsMakefile=IsMakefile)
+ OutputFileList.append(OutputFile)
+ else:
+ if StringData is not None and len(StringData) > 0:
+ UiTuple = ('-n', '"' + StringData + '"')
+ else:
+ UiTuple = tuple()
+
+ if self.Optional == True :
+ GenFdsGlobalVariable.VerboseLogger( "Optional Section don't exist!")
+ return '', None
+ else:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss UI Section value" %InfFileName)
+
+ Num = SecNum
+ if IsMakefile and StringData == ModuleNameStr:
+ StringData = "$(MODULE_NAME)"
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + SectionSuffix.get(SectionType))
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',
+ Ui=StringData, IsMakefile=IsMakefile)
+ OutputFileList.append(OutputFile)
+
+ #
+ # If Section Type is BINARY_FILE_TYPE_RAW
+ #
+ elif SectionType == BINARY_FILE_TYPE_RAW:
+ """If File List is empty"""
+ if FileList == []:
+ if self.Optional == True:
+ GenFdsGlobalVariable.VerboseLogger("Optional Section don't exist!")
+ return [], None
+ else:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "Output file for %s section could not be found for %s" % (SectionType, InfFileName))
+
+ elif len(FileList) > 1:
+ EdkLogger.error("GenFds", GENFDS_ERROR,
+ "Files suffixed with %s are not allowed to have more than one file in %s[Binaries] section" % (
+ self.FileExtension, InfFileName))
+ else:
+ for File in FileList:
+ File = GenFdsGlobalVariable.MacroExtend(File, Dict)
+ OutputFileList.append(File)
+
+ else:
+ """If File List is empty"""
+ if FileList == [] :
+ if self.Optional == True:
+ GenFdsGlobalVariable.VerboseLogger("Optional Section don't exist!")
+ return [], None
+ else:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "Output file for %s section could not be found for %s" % (SectionType, InfFileName))
+
+ else:
+ """Convert the File to Section file one by one """
+ for File in FileList:
+ """ Copy Map file to FFS output path """
+ Index = Index + 1
+ Num = '%s.%d' %(SecNum, Index)
+ OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + Num + SectionSuffix.get(SectionType))
+ File = GenFdsGlobalVariable.MacroExtend(File, Dict)
+
+ #Get PE Section alignment when align is set to AUTO
+ if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE):
+ ImageObj = PeImageClass (File)
+ if ImageObj.SectionAlignment < 0x400:
+ Align = str (ImageObj.SectionAlignment)
+ elif ImageObj.SectionAlignment < 0x100000:
+ Align = str (ImageObj.SectionAlignment // 0x400) + 'K'
+ else:
+ Align = str (ImageObj.SectionAlignment // 0x100000) + 'M'
+
+ if File[(len(File)-4):] == '.efi' and FfsInf.InfModule.BaseName == os.path.basename(File)[:-4]:
+ MapFile = File.replace('.efi', '.map')
+ CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')
+ if IsMakefile:
+ if GenFdsGlobalVariable.CopyList == []:
+ GenFdsGlobalVariable.CopyList = [(MapFile, CopyMapFile)]
+ else:
+ GenFdsGlobalVariable.CopyList.append((MapFile, CopyMapFile))
+ else:
+ if os.path.exists(MapFile):
+ if not os.path.exists(CopyMapFile) or \
+ (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):
+ CopyLongFilePath(MapFile, CopyMapFile)
+
+ if not NoStrip:
+ FileBeforeStrip = os.path.join(OutputPath, ModuleName + '.efi')
+ if IsMakefile:
+ if GenFdsGlobalVariable.CopyList == []:
+ GenFdsGlobalVariable.CopyList = [(File, FileBeforeStrip)]
+ else:
+ GenFdsGlobalVariable.CopyList.append((File, FileBeforeStrip))
+ else:
+ if not os.path.exists(FileBeforeStrip) or \
+ (os.path.getmtime(File) > os.path.getmtime(FileBeforeStrip)):
+ CopyLongFilePath(File, FileBeforeStrip)
+ StrippedFile = os.path.join(OutputPath, ModuleName + '.stripped')
+ GenFdsGlobalVariable.GenerateFirmwareImage(
+ StrippedFile,
+ [File],
+ Strip=True,
+ IsMakefile = IsMakefile
+ )
+ File = StrippedFile
+
+ """For TE Section call GenFw to generate TE image"""
+
+ if SectionType == BINARY_FILE_TYPE_TE:
+ TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
+ GenFdsGlobalVariable.GenerateFirmwareImage(
+ TeFile,
+ [File],
+ Type='te',
+ IsMakefile = IsMakefile
+ )
+ File = TeFile
+
+ """Call GenSection"""
+ GenFdsGlobalVariable.GenerateSection(OutputFile,
+ [File],
+ Section.Section.SectionType.get (SectionType),
+ IsMakefile=IsMakefile
+ )
+ OutputFileList.append(OutputFile)
+
+ return OutputFileList, Align
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/Fd.py b/roms/edk2/BaseTools/Source/Python/GenFds/Fd.py
new file mode 100644
index 000000000..973936b6f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/Fd.py
@@ -0,0 +1,155 @@
+## @file
+# process FD generation
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from . import Region
+from . import Fv
+import Common.LongFilePathOs as os
+from io import BytesIO
+import sys
+from struct import *
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+from CommonDataClass.FdfClass import FDClassObject
+from Common import EdkLogger
+from Common.BuildToolError import *
+from Common.Misc import SaveFileOnChange
+from Common.DataType import BINARY_FILE_TYPE_FV
+
+## generate FD
+#
+#
+class FD(FDClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ FDClassObject.__init__(self)
+
+ ## GenFd() method
+ #
+ # Generate FD
+ #
+ # @retval string Generated FD file name
+ #
+ def GenFd (self, Flag = False):
+ if self.FdUiName.upper() + 'fd' in GenFdsGlobalVariable.ImageBinDict:
+ return GenFdsGlobalVariable.ImageBinDict[self.FdUiName.upper() + 'fd']
+
+ #
+ # Print Information
+ #
+ FdFileName = os.path.join(GenFdsGlobalVariable.FvDir, self.FdUiName + '.fd')
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger("\nFd File Name:%s (%s)" %(self.FdUiName, FdFileName))
+
+ Offset = 0x00
+ for item in self.BlockSizeList:
+ Offset = Offset + item[0] * item[1]
+ if Offset != self.Size:
+ EdkLogger.error("GenFds", GENFDS_ERROR, 'FD %s Size not consistent with block array' % self.FdUiName)
+ GenFdsGlobalVariable.VerboseLogger('Following Fv will be add to Fd !!!')
+ for FvObj in GenFdsGlobalVariable.FdfParser.Profile.FvDict:
+ GenFdsGlobalVariable.VerboseLogger(FvObj)
+
+ HasCapsuleRegion = False
+ for RegionObj in self.RegionList:
+ if RegionObj.RegionType == 'CAPSULE':
+ HasCapsuleRegion = True
+ break
+ if HasCapsuleRegion:
+ TempFdBuffer = BytesIO()
+ PreviousRegionStart = -1
+ PreviousRegionSize = 1
+
+ for RegionObj in self.RegionList :
+ if RegionObj.RegionType == 'CAPSULE':
+ continue
+ if RegionObj.Offset + RegionObj.Size <= PreviousRegionStart:
+ pass
+ elif RegionObj.Offset <= PreviousRegionStart or (RegionObj.Offset >=PreviousRegionStart and RegionObj.Offset < PreviousRegionStart + PreviousRegionSize):
+ pass
+ elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize:
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize)))
+ PadRegion = Region.Region()
+ PadRegion.Offset = PreviousRegionStart + PreviousRegionSize
+ PadRegion.Size = RegionObj.Offset - PadRegion.Offset
+ if not Flag:
+ PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.DefineVarDict)
+ PreviousRegionStart = RegionObj.Offset
+ PreviousRegionSize = RegionObj.Size
+ #
+ # Call each region's AddToBuffer function
+ #
+ if PreviousRegionSize > self.Size:
+ pass
+ GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')
+ RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.DefineVarDict)
+
+ FdBuffer = BytesIO()
+ PreviousRegionStart = -1
+ PreviousRegionSize = 1
+ for RegionObj in self.RegionList :
+ if RegionObj.Offset + RegionObj.Size <= PreviousRegionStart:
+ EdkLogger.error("GenFds", GENFDS_ERROR,
+ 'Region offset 0x%X in wrong order with Region starting from 0x%X, size 0x%X\nRegions in FDF must have offsets appear in ascending order.'\
+ % (RegionObj.Offset, PreviousRegionStart, PreviousRegionSize))
+ elif RegionObj.Offset <= PreviousRegionStart or (RegionObj.Offset >=PreviousRegionStart and RegionObj.Offset < PreviousRegionStart + PreviousRegionSize):
+ EdkLogger.error("GenFds", GENFDS_ERROR,
+ 'Region offset 0x%X overlaps with Region starting from 0x%X, size 0x%X' \
+ % (RegionObj.Offset, PreviousRegionStart, PreviousRegionSize))
+ elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize:
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize)))
+ PadRegion = Region.Region()
+ PadRegion.Offset = PreviousRegionStart + PreviousRegionSize
+ PadRegion.Size = RegionObj.Offset - PadRegion.Offset
+ if not Flag:
+ PadRegion.AddToBuffer(FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.DefineVarDict)
+ PreviousRegionStart = RegionObj.Offset
+ PreviousRegionSize = RegionObj.Size
+ #
+ # Verify current region fits within allocated FD section Size
+ #
+ if PreviousRegionStart + PreviousRegionSize > self.Size:
+ EdkLogger.error("GenFds", GENFDS_ERROR,
+ 'FD %s size too small to fit region with offset 0x%X and size 0x%X'
+ % (self.FdUiName, PreviousRegionStart, PreviousRegionSize))
+ #
+ # Call each region's AddToBuffer function
+ #
+ GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')
+ RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFdsGlobalVariable.ImageBinDict, self.DefineVarDict, Flag=Flag)
+ #
+ # Write the buffer contents to Fd file
+ #
+ GenFdsGlobalVariable.VerboseLogger('Write the buffer contents to Fd file')
+ if not Flag:
+ SaveFileOnChange(FdFileName, FdBuffer.getvalue())
+ FdBuffer.close()
+ GenFdsGlobalVariable.ImageBinDict[self.FdUiName.upper() + 'fd'] = FdFileName
+ return FdFileName
+
+ ## generate flash map file
+ #
+ # @param self The object pointer
+ #
+ def GenFlashMap (self):
+ pass
+
+
+
+
+
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/FdfParser.py b/roms/edk2/BaseTools/Source/Python/GenFds/FdfParser.py
new file mode 100644
index 000000000..ea2401b0e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -0,0 +1,4528 @@
+## @file
+# parse FDF file
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+from re import compile, DOTALL
+from string import hexdigits
+from uuid import UUID
+
+from Common.BuildToolError import *
+from Common import EdkLogger
+from Common.Misc import PathClass, tdict, ProcessDuplicatedInf, GuidStructureStringToGuidString
+from Common.StringUtils import NormPath, ReplaceMacro
+from Common import GlobalData
+from Common.Expression import *
+from Common.DataType import *
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+import Common.LongFilePathOs as os
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.RangeExpression import RangeExpression
+from collections import OrderedDict
+
+from .Fd import FD
+from .Region import Region
+from .Fv import FV
+from .AprioriSection import AprioriSection
+from .FfsInfStatement import FfsInfStatement
+from .FfsFileStatement import FileStatement
+from .VerSection import VerSection
+from .UiSection import UiSection
+from .FvImageSection import FvImageSection
+from .DataSection import DataSection
+from .DepexSection import DepexSection
+from .CompressSection import CompressSection
+from .GuidSection import GuidSection
+from .Capsule import EFI_CERT_TYPE_PKCS7_GUID, EFI_CERT_TYPE_RSA2048_SHA256_GUID, Capsule
+from .CapsuleData import CapsuleFfs, CapsulePayload, CapsuleFv, CapsuleFd, CapsuleAnyFile, CapsuleAfile
+from .RuleComplexFile import RuleComplexFile
+from .RuleSimpleFile import RuleSimpleFile
+from .EfiSection import EfiSection
+from .OptionRom import OPTIONROM
+from .OptRomInfStatement import OptRomInfStatement, OverrideAttribs
+from .OptRomFileStatement import OptRomFileStatement
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+
+T_CHAR_CR = '\r'
+T_CHAR_TAB = '\t'
+T_CHAR_DOUBLE_QUOTE = '\"'
+T_CHAR_SINGLE_QUOTE = '\''
+T_CHAR_BRACE_R = '}'
+
+SEPARATORS = {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT, TAB_COMMA_SPLIT, '{', T_CHAR_BRACE_R}
+ALIGNMENTS = {"Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K", "64K", "128K",
+ "256K", "512K", "1M", "2M", "4M", "8M", "16M"}
+ALIGNMENT_NOAUTO = ALIGNMENTS - {"Auto"}
+CR_LB_SET = {T_CHAR_CR, TAB_LINE_BREAK}
+
+RegionSizePattern = compile("\s*(?P<base>(?:0x|0X)?[a-fA-F0-9]+)\s*\|\s*(?P<size>(?:0x|0X)?[a-fA-F0-9]+)\s*")
+RegionSizeGuidPattern = compile("\s*(?P<base>\w+\.\w+[\.\w\[\]]*)\s*\|\s*(?P<size>\w+\.\w+[\.\w\[\]]*)\s*")
+RegionOffsetPcdPattern = compile("\s*(?P<base>\w+\.\w+[\.\w\[\]]*)\s*$")
+ShortcutPcdPattern = compile("\s*\w+\s*=\s*(?P<value>(?:0x|0X)?[a-fA-F0-9]+)\s*\|\s*(?P<name>\w+\.\w+)\s*")
+BaseAddrValuePattern = compile('^0[xX][0-9a-fA-F]+')
+FileExtensionPattern = compile(r'([a-zA-Z][a-zA-Z0-9]*)')
+TokenFindPattern = compile(r'([a-zA-Z0-9\-]+|\$\(TARGET\)|\*)_([a-zA-Z0-9\-]+|\$\(TOOL_CHAIN_TAG\)|\*)_([a-zA-Z0-9\-]+|\$\(ARCH\)|\*)')
+AllIncludeFileList = []
+
+# Get the closest parent
+def GetParentAtLine (Line):
+ for Profile in AllIncludeFileList:
+ if Profile.IsLineInFile(Line):
+ return Profile
+ return None
+
+# Check include loop
+def IsValidInclude (File, Line):
+ for Profile in AllIncludeFileList:
+ if Profile.IsLineInFile(Line) and Profile.FileName == File:
+ return False
+
+ return True
+
+def GetRealFileLine (File, Line):
+ InsertedLines = 0
+ for Profile in AllIncludeFileList:
+ if Profile.IsLineInFile(Line):
+ return Profile.GetLineInFile(Line)
+ elif Line >= Profile.InsertStartLineNumber and Profile.Level == 1:
+ InsertedLines += Profile.GetTotalLines()
+
+ return (File, Line - InsertedLines)
+
+## The exception class that used to report error messages when parsing FDF
+#
+# Currently the "ToolName" is set to be "FdfParser".
+#
+class Warning (Exception):
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Str The message to record
+ # @param File The FDF name
+ # @param Line The Line number that error occurs
+ #
+ def __init__(self, Str, File = None, Line = None):
+ FileLineTuple = GetRealFileLine(File, Line)
+ self.FileName = FileLineTuple[0]
+ self.LineNumber = FileLineTuple[1]
+ self.OriginalLineNumber = Line
+ self.Message = Str
+ self.ToolName = 'FdfParser'
+
+ def __str__(self):
+ return self.Message
+
+ # helper functions to facilitate consistency in warnings
+ # each function is for a different common warning
+ @staticmethod
+ def Expected(Str, File, Line):
+ return Warning("expected {}".format(Str), File, Line)
+ @staticmethod
+ def ExpectedEquals(File, Line):
+ return Warning.Expected("'='", File, Line)
+ @staticmethod
+ def ExpectedCurlyOpen(File, Line):
+ return Warning.Expected("'{'", File, Line)
+ @staticmethod
+ def ExpectedCurlyClose(File, Line):
+ return Warning.Expected("'}'", File, Line)
+ @staticmethod
+ def ExpectedBracketClose(File, Line):
+ return Warning.Expected("']'", File, Line)
+
+## The Include file content class that used to record file data when parsing include file
+#
+# May raise Exception when opening file.
+#
+class IncludeFileProfile:
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param FileName The file that to be parsed
+ #
+ def __init__(self, FileName):
+ self.FileName = FileName
+ self.FileLinesList = []
+ try:
+ with open(FileName, "r") as fsock:
+ self.FileLinesList = fsock.readlines()
+ for index, line in enumerate(self.FileLinesList):
+ if not line.endswith(TAB_LINE_BREAK):
+ self.FileLinesList[index] += TAB_LINE_BREAK
+ except:
+ EdkLogger.error("FdfParser", FILE_OPEN_FAILURE, ExtraData=FileName)
+
+ self.InsertStartLineNumber = None
+ self.InsertAdjust = 0
+ self.IncludeFileList = []
+ self.Level = 1 # first level include file
+
+ def GetTotalLines(self):
+ TotalLines = self.InsertAdjust + len(self.FileLinesList)
+
+ for Profile in self.IncludeFileList:
+ TotalLines += Profile.GetTotalLines()
+
+ return TotalLines
+
+ def IsLineInFile(self, Line):
+ if Line >= self.InsertStartLineNumber and Line < self.InsertStartLineNumber + self.GetTotalLines():
+ return True
+
+ return False
+
+ def GetLineInFile(self, Line):
+ if not self.IsLineInFile (Line):
+ return (self.FileName, -1)
+
+ InsertedLines = self.InsertStartLineNumber
+
+ for Profile in self.IncludeFileList:
+ if Profile.IsLineInFile(Line):
+ return Profile.GetLineInFile(Line)
+ elif Line >= Profile.InsertStartLineNumber:
+ InsertedLines += Profile.GetTotalLines()
+
+ return (self.FileName, Line - InsertedLines + 1)
+
+## The FDF content class that used to record file data when parsing FDF
+#
+# May raise Exception when opening file.
+#
+class FileProfile:
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param FileName The file that to be parsed
+ #
+ def __init__(self, FileName):
+ self.FileLinesList = []
+ try:
+ with open(FileName, "r") as fsock:
+ self.FileLinesList = fsock.readlines()
+
+ except:
+ EdkLogger.error("FdfParser", FILE_OPEN_FAILURE, ExtraData=FileName)
+
+ self.FileName = FileName
+ self.PcdDict = OrderedDict()
+ self.PcdLocalDict = OrderedDict()
+ self.InfList = []
+ self.InfDict = {'ArchTBD':[]}
+ # ECC will use this Dict and List information
+ self.PcdFileLineDict = {}
+ self.InfFileLineList = []
+
+ self.FdDict = {}
+ self.FdNameNotSet = False
+ self.FvDict = {}
+ self.CapsuleDict = {}
+ self.RuleDict = {}
+ self.OptRomDict = {}
+ self.FmpPayloadDict = {}
+
+## The syntax parser for FDF
+#
+# PreprocessFile method should be called prior to ParseFile
+# CycleReferenceCheck method can detect cycles in FDF contents
+#
+# GetNext*** procedures mean these procedures will get next token first, then make judgement.
+# Get*** procedures mean these procedures will make judgement on current token only.
+#
+class FdfParser:
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param FileName The file that to be parsed
+ #
+ def __init__(self, FileName):
+ self.Profile = FileProfile(FileName)
+ self.FileName = FileName
+ self.CurrentLineNumber = 1
+ self.CurrentOffsetWithinLine = 0
+ self.CurrentFdName = None
+ self.CurrentFvName = None
+ self._Token = ""
+ self._SkippedChars = ""
+ GlobalData.gFdfParser = self
+
+ # Used to section info
+ self._CurSection = []
+ # Key: [section name, UI name, arch]
+ # Value: {MACRO_NAME: MACRO_VALUE}
+ self._MacroDict = tdict(True, 3)
+ self._PcdDict = OrderedDict()
+
+ self._WipeOffArea = []
+ if GenFdsGlobalVariable.WorkSpaceDir == '':
+ GenFdsGlobalVariable.WorkSpaceDir = os.getenv("WORKSPACE")
+
+ ## _SkipWhiteSpace() method
+ #
+ # Skip white spaces from current char.
+ #
+ # @param self The object pointer
+ #
+ def _SkipWhiteSpace(self):
+ while not self._EndOfFile():
+ if self._CurrentChar() in {TAB_PRINTCHAR_NUL, T_CHAR_CR, TAB_LINE_BREAK, TAB_SPACE_SPLIT, T_CHAR_TAB}:
+ self._SkippedChars += str(self._CurrentChar())
+ self._GetOneChar()
+ else:
+ return
+ return
+
+ ## _EndOfFile() method
+ #
+ # Judge current buffer pos is at file end
+ #
+ # @param self The object pointer
+ # @retval True Current File buffer position is at file end
+ # @retval False Current File buffer position is NOT at file end
+ #
+ def _EndOfFile(self):
+ NumberOfLines = len(self.Profile.FileLinesList)
+ SizeOfLastLine = len(self.Profile.FileLinesList[-1])
+ if self.CurrentLineNumber == NumberOfLines and self.CurrentOffsetWithinLine >= SizeOfLastLine - 1:
+ return True
+ if self.CurrentLineNumber > NumberOfLines:
+ return True
+ return False
+
+ ## _EndOfLine() method
+ #
+ # Judge current buffer pos is at line end
+ #
+ # @param self The object pointer
+ # @retval True Current File buffer position is at line end
+ # @retval False Current File buffer position is NOT at line end
+ #
+ def _EndOfLine(self):
+ if self.CurrentLineNumber > len(self.Profile.FileLinesList):
+ return True
+ SizeOfCurrentLine = len(self.Profile.FileLinesList[self.CurrentLineNumber - 1])
+ if self.CurrentOffsetWithinLine >= SizeOfCurrentLine:
+ return True
+ return False
+
+ ## Rewind() method
+ #
+ # Reset file data buffer to the initial state
+ #
+ # @param self The object pointer
+ # @param DestLine Optional new destination line number.
+ # @param DestOffset Optional new destination offset.
+ #
+ def Rewind(self, DestLine = 1, DestOffset = 0):
+ self.CurrentLineNumber = DestLine
+ self.CurrentOffsetWithinLine = DestOffset
+
+ ## _UndoOneChar() method
+ #
+ # Go back one char in the file buffer
+ #
+ # @param self The object pointer
+ # @retval True Successfully go back one char
+ # @retval False Not able to go back one char as file beginning reached
+ #
+ def _UndoOneChar(self):
+ if self.CurrentLineNumber == 1 and self.CurrentOffsetWithinLine == 0:
+ return False
+ elif self.CurrentOffsetWithinLine == 0:
+ self.CurrentLineNumber -= 1
+ self.CurrentOffsetWithinLine = len(self._CurrentLine()) - 1
+ else:
+ self.CurrentOffsetWithinLine -= 1
+ return True
+
+ ## _GetOneChar() method
+ #
+ # Move forward one char in the file buffer
+ #
+ # @param self The object pointer
+ #
+ def _GetOneChar(self):
+ if self.CurrentOffsetWithinLine == len(self.Profile.FileLinesList[self.CurrentLineNumber - 1]) - 1:
+ self.CurrentLineNumber += 1
+ self.CurrentOffsetWithinLine = 0
+ else:
+ self.CurrentOffsetWithinLine += 1
+
+ ## _CurrentChar() method
+ #
+ # Get the char pointed to by the file buffer pointer
+ #
+ # @param self The object pointer
+ # @retval Char Current char
+ #
+ def _CurrentChar(self):
+ return self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine]
+
+ ## _NextChar() method
+ #
+ # Get the one char pass the char pointed to by the file buffer pointer
+ #
+ # @param self The object pointer
+ # @retval Char Next char
+ #
+ def _NextChar(self):
+ if self.CurrentOffsetWithinLine == len(self.Profile.FileLinesList[self.CurrentLineNumber - 1]) - 1:
+ return self.Profile.FileLinesList[self.CurrentLineNumber][0]
+ return self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine + 1]
+
+ ## _SetCurrentCharValue() method
+ #
+ # Modify the value of current char
+ #
+ # @param self The object pointer
+ # @param Value The new value of current char
+ #
+ def _SetCurrentCharValue(self, Value):
+ self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine] = Value
+
+ ## _CurrentLine() method
+ #
+ # Get the list that contains current line contents
+ #
+ # @param self The object pointer
+ # @retval List current line contents
+ #
+ def _CurrentLine(self):
+ return self.Profile.FileLinesList[self.CurrentLineNumber - 1]
+
+ def _StringToList(self):
+ self.Profile.FileLinesList = [list(s) for s in self.Profile.FileLinesList]
+ if not self.Profile.FileLinesList:
+ EdkLogger.error('FdfParser', FILE_READ_FAILURE, 'The file is empty!', File=self.FileName)
+ self.Profile.FileLinesList[-1].append(' ')
+
+ def _ReplaceFragment(self, StartPos, EndPos, Value = ' '):
+ if StartPos[0] == EndPos[0]:
+ Offset = StartPos[1]
+ while Offset <= EndPos[1]:
+ self.Profile.FileLinesList[StartPos[0]][Offset] = Value
+ Offset += 1
+ return
+
+ Offset = StartPos[1]
+ while self.Profile.FileLinesList[StartPos[0]][Offset] not in CR_LB_SET:
+ self.Profile.FileLinesList[StartPos[0]][Offset] = Value
+ Offset += 1
+
+ Line = StartPos[0]
+ while Line < EndPos[0]:
+ Offset = 0
+ while self.Profile.FileLinesList[Line][Offset] not in CR_LB_SET:
+ self.Profile.FileLinesList[Line][Offset] = Value
+ Offset += 1
+ Line += 1
+
+ Offset = 0
+ while Offset <= EndPos[1]:
+ self.Profile.FileLinesList[EndPos[0]][Offset] = Value
+ Offset += 1
+
+ def _SetMacroValue(self, Macro, Value):
+ if not self._CurSection:
+ return
+
+ MacroDict = {}
+ if not self._MacroDict[self._CurSection[0], self._CurSection[1], self._CurSection[2]]:
+ self._MacroDict[self._CurSection[0], self._CurSection[1], self._CurSection[2]] = MacroDict
+ else:
+ MacroDict = self._MacroDict[self._CurSection[0], self._CurSection[1], self._CurSection[2]]
+ MacroDict[Macro] = Value
+
+ def _GetMacroValue(self, Macro):
+ # Highest priority
+ if Macro in GlobalData.gCommandLineDefines:
+ return GlobalData.gCommandLineDefines[Macro]
+ if Macro in GlobalData.gGlobalDefines:
+ return GlobalData.gGlobalDefines[Macro]
+
+ if self._CurSection:
+ MacroDict = self._MacroDict[
+ self._CurSection[0],
+ self._CurSection[1],
+ self._CurSection[2]
+ ]
+ if MacroDict and Macro in MacroDict:
+ return MacroDict[Macro]
+
+ # Lowest priority
+ if Macro in GlobalData.gPlatformDefines:
+ return GlobalData.gPlatformDefines[Macro]
+ return None
+
+ def _SectionHeaderParser(self, Section):
+ # [Defines]
+ # [FD.UiName]: use dummy instead if UI name is optional
+ # [FV.UiName]
+ # [Capsule.UiName]
+ # [Rule]: don't take rule section into account, macro is not allowed in this section
+ # [OptionRom.DriverName]
+ self._CurSection = []
+ Section = Section.strip()[1:-1].upper().replace(' ', '').strip(TAB_SPLIT)
+ ItemList = Section.split(TAB_SPLIT)
+ Item = ItemList[0]
+ if Item == '' or Item == 'RULE':
+ return
+
+ if Item == TAB_COMMON_DEFINES.upper():
+ self._CurSection = [TAB_COMMON, TAB_COMMON, TAB_COMMON]
+ elif len(ItemList) > 1:
+ self._CurSection = [ItemList[0], ItemList[1], TAB_COMMON]
+ elif len(ItemList) > 0:
+ self._CurSection = [ItemList[0], 'DUMMY', TAB_COMMON]
+
+ ## PreprocessFile() method
+ #
+ # Preprocess file contents, replace comments with spaces.
+ # In the end, rewind the file buffer pointer to the beginning
+ # BUGBUG: No !include statement processing contained in this procedure
+ # !include statement should be expanded at the same FileLinesList[CurrentLineNumber - 1]
+ #
+ # @param self The object pointer
+ #
+ def PreprocessFile(self):
+ self.Rewind()
+ InComment = False
+ DoubleSlashComment = False
+ HashComment = False
+ # HashComment in quoted string " " is ignored.
+ InString = False
+
+ while not self._EndOfFile():
+
+ if self._CurrentChar() == T_CHAR_DOUBLE_QUOTE and not InComment:
+ InString = not InString
+ # meet new line, then no longer in a comment for // and '#'
+ if self._CurrentChar() == TAB_LINE_BREAK:
+ self.CurrentLineNumber += 1
+ self.CurrentOffsetWithinLine = 0
+ if InComment and DoubleSlashComment:
+ InComment = False
+ DoubleSlashComment = False
+ if InComment and HashComment:
+ InComment = False
+ HashComment = False
+ # check for */ comment end
+ elif InComment and not DoubleSlashComment and not HashComment and self._CurrentChar() == TAB_STAR and self._NextChar() == TAB_BACK_SLASH:
+ self._SetCurrentCharValue(TAB_SPACE_SPLIT)
+ self._GetOneChar()
+ self._SetCurrentCharValue(TAB_SPACE_SPLIT)
+ self._GetOneChar()
+ InComment = False
+ # set comments to spaces
+ elif InComment:
+ self._SetCurrentCharValue(TAB_SPACE_SPLIT)
+ self._GetOneChar()
+ # check for // comment
+ elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() == TAB_BACK_SLASH and not self._EndOfLine():
+ InComment = True
+ DoubleSlashComment = True
+ # check for '#' comment
+ elif self._CurrentChar() == TAB_COMMENT_SPLIT and not self._EndOfLine() and not InString:
+ InComment = True
+ HashComment = True
+ # check for /* comment start
+ elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() == TAB_STAR:
+ self._SetCurrentCharValue(TAB_SPACE_SPLIT)
+ self._GetOneChar()
+ self._SetCurrentCharValue(TAB_SPACE_SPLIT)
+ self._GetOneChar()
+ InComment = True
+ else:
+ self._GetOneChar()
+
+ # restore from ListOfList to ListOfString
+ self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]
+ self.Rewind()
+
+ ## PreprocessIncludeFile() method
+ #
+ # Preprocess file contents, replace !include statements with file contents.
+ # In the end, rewind the file buffer pointer to the beginning
+ #
+ # @param self The object pointer
+ #
+ def PreprocessIncludeFile(self):
+ # nested include support
+ Processed = False
+ MacroDict = {}
+ while self._GetNextToken():
+
+ if self._Token == TAB_DEFINE:
+ if not self._GetNextToken():
+ raise Warning.Expected("Macro name", self.FileName, self.CurrentLineNumber)
+ Macro = self._Token
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ Value = self._GetExpression()
+ MacroDict[Macro] = Value
+
+ elif self._Token == TAB_INCLUDE:
+ Processed = True
+ IncludeLine = self.CurrentLineNumber
+ IncludeOffset = self.CurrentOffsetWithinLine - len(TAB_INCLUDE)
+ if not self._GetNextToken():
+ raise Warning.Expected("include file name", self.FileName, self.CurrentLineNumber)
+ IncFileName = self._Token
+ PreIndex = 0
+ StartPos = IncFileName.find('$(', PreIndex)
+ EndPos = IncFileName.find(')', StartPos+2)
+ while StartPos != -1 and EndPos != -1:
+ Macro = IncFileName[StartPos+2: EndPos]
+ MacroVal = self._GetMacroValue(Macro)
+ if not MacroVal:
+ if Macro in MacroDict:
+ MacroVal = MacroDict[Macro]
+ if MacroVal is not None:
+ IncFileName = IncFileName.replace('$(' + Macro + ')', MacroVal, 1)
+ if MacroVal.find('$(') != -1:
+ PreIndex = StartPos
+ else:
+ PreIndex = StartPos + len(MacroVal)
+ else:
+ raise Warning("The Macro %s is not defined" %Macro, self.FileName, self.CurrentLineNumber)
+ StartPos = IncFileName.find('$(', PreIndex)
+ EndPos = IncFileName.find(')', StartPos+2)
+
+ IncludedFile = NormPath(IncFileName)
+ #
+ # First search the include file under the same directory as FDF file
+ #
+ IncludedFile1 = PathClass(IncludedFile, os.path.dirname(self.FileName))
+ ErrorCode = IncludedFile1.Validate()[0]
+ if ErrorCode != 0:
+ #
+ # Then search the include file under the same directory as DSC file
+ #
+ PlatformDir = ''
+ if GenFdsGlobalVariable.ActivePlatform:
+ PlatformDir = GenFdsGlobalVariable.ActivePlatform.Dir
+ elif GlobalData.gActivePlatform:
+ PlatformDir = GlobalData.gActivePlatform.MetaFile.Dir
+ IncludedFile1 = PathClass(IncludedFile, PlatformDir)
+ ErrorCode = IncludedFile1.Validate()[0]
+ if ErrorCode != 0:
+ #
+ # Also search file under the WORKSPACE directory
+ #
+ IncludedFile1 = PathClass(IncludedFile, GlobalData.gWorkspace)
+ ErrorCode = IncludedFile1.Validate()[0]
+ if ErrorCode != 0:
+ raise Warning("The include file does not exist under below directories: \n%s\n%s\n%s\n"%(os.path.dirname(self.FileName), PlatformDir, GlobalData.gWorkspace),
+ self.FileName, self.CurrentLineNumber)
+
+ if not IsValidInclude (IncludedFile1.Path, self.CurrentLineNumber):
+ raise Warning("The include file {0} is causing a include loop.\n".format (IncludedFile1.Path), self.FileName, self.CurrentLineNumber)
+
+ IncFileProfile = IncludeFileProfile(IncludedFile1.Path)
+
+ CurrentLine = self.CurrentLineNumber
+ CurrentOffset = self.CurrentOffsetWithinLine
+ # list index of the insertion, note that line number is 'CurrentLine + 1'
+ InsertAtLine = CurrentLine
+ ParentProfile = GetParentAtLine (CurrentLine)
+ if ParentProfile is not None:
+ ParentProfile.IncludeFileList.insert(0, IncFileProfile)
+ IncFileProfile.Level = ParentProfile.Level + 1
+ IncFileProfile.InsertStartLineNumber = InsertAtLine + 1
+ # deal with remaining portions after "!include filename", if exists.
+ if self._GetNextToken():
+ if self.CurrentLineNumber == CurrentLine:
+ RemainingLine = self._CurrentLine()[CurrentOffset:]
+ self.Profile.FileLinesList.insert(self.CurrentLineNumber, RemainingLine)
+ IncFileProfile.InsertAdjust += 1
+ self.CurrentLineNumber += 1
+ self.CurrentOffsetWithinLine = 0
+
+ for Line in IncFileProfile.FileLinesList:
+ self.Profile.FileLinesList.insert(InsertAtLine, Line)
+ self.CurrentLineNumber += 1
+ InsertAtLine += 1
+
+ # reversely sorted to better determine error in file
+ AllIncludeFileList.insert(0, IncFileProfile)
+
+ # comment out the processed include file statement
+ TempList = list(self.Profile.FileLinesList[IncludeLine - 1])
+ TempList.insert(IncludeOffset, TAB_COMMENT_SPLIT)
+ self.Profile.FileLinesList[IncludeLine - 1] = ''.join(TempList)
+ if Processed: # Nested and back-to-back support
+ self.Rewind(DestLine = IncFileProfile.InsertStartLineNumber - 1)
+ Processed = False
+ # Preprocess done.
+ self.Rewind()
+
+ @staticmethod
+ def _GetIfListCurrentItemStat(IfList):
+ if len(IfList) == 0:
+ return True
+
+ for Item in IfList:
+ if Item[1] == False:
+ return False
+
+ return True
+
+ ## PreprocessConditionalStatement() method
+ #
+ # Preprocess conditional statement.
+ # In the end, rewind the file buffer pointer to the beginning
+ #
+ # @param self The object pointer
+ #
+ def PreprocessConditionalStatement(self):
+ # IfList is a stack of if branches with elements of list [Pos, CondSatisfied, BranchDetermined]
+ IfList = []
+ RegionLayoutLine = 0
+ ReplacedLine = -1
+ while self._GetNextToken():
+ # Determine section name and the location dependent macro
+ if self._GetIfListCurrentItemStat(IfList):
+ if self._Token.startswith(TAB_SECTION_START):
+ Header = self._Token
+ if not self._Token.endswith(TAB_SECTION_END):
+ self._SkipToToken(TAB_SECTION_END)
+ Header += self._SkippedChars
+ if Header.find('$(') != -1:
+ raise Warning("macro cannot be used in section header", self.FileName, self.CurrentLineNumber)
+ self._SectionHeaderParser(Header)
+ continue
+ # Replace macros except in RULE section or out of section
+ elif self._CurSection and ReplacedLine != self.CurrentLineNumber:
+ ReplacedLine = self.CurrentLineNumber
+ self._UndoToken()
+ CurLine = self.Profile.FileLinesList[ReplacedLine - 1]
+ PreIndex = 0
+ StartPos = CurLine.find('$(', PreIndex)
+ EndPos = CurLine.find(')', StartPos+2)
+ while StartPos != -1 and EndPos != -1 and self._Token not in {TAB_IF_DEF, TAB_IF_N_DEF, TAB_IF, TAB_ELSE_IF}:
+ MacroName = CurLine[StartPos+2: EndPos]
+ MacroValue = self._GetMacroValue(MacroName)
+ if MacroValue is not None:
+ CurLine = CurLine.replace('$(' + MacroName + ')', MacroValue, 1)
+ if MacroValue.find('$(') != -1:
+ PreIndex = StartPos
+ else:
+ PreIndex = StartPos + len(MacroValue)
+ else:
+ PreIndex = EndPos + 1
+ StartPos = CurLine.find('$(', PreIndex)
+ EndPos = CurLine.find(')', StartPos+2)
+ self.Profile.FileLinesList[ReplacedLine - 1] = CurLine
+ continue
+
+ if self._Token == TAB_DEFINE:
+ if self._GetIfListCurrentItemStat(IfList):
+ if not self._CurSection:
+ raise Warning("macro cannot be defined in Rule section or out of section", self.FileName, self.CurrentLineNumber)
+ DefineLine = self.CurrentLineNumber - 1
+ DefineOffset = self.CurrentOffsetWithinLine - len(TAB_DEFINE)
+ if not self._GetNextToken():
+ raise Warning.Expected("Macro name", self.FileName, self.CurrentLineNumber)
+ Macro = self._Token
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ Value = self._GetExpression()
+ self._SetMacroValue(Macro, Value)
+ self._WipeOffArea.append(((DefineLine, DefineOffset), (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
+ elif self._Token == 'SET':
+ if not self._GetIfListCurrentItemStat(IfList):
+ continue
+ SetLine = self.CurrentLineNumber - 1
+ SetOffset = self.CurrentOffsetWithinLine - len('SET')
+ PcdPair = self._GetNextPcdSettings()
+ PcdName = "%s.%s" % (PcdPair[1], PcdPair[0])
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ Value = self._GetExpression()
+ Value = self._EvaluateConditional(Value, self.CurrentLineNumber, 'eval', True)
+
+ self._PcdDict[PcdName] = Value
+
+ self.Profile.PcdDict[PcdPair] = Value
+ self.SetPcdLocalation(PcdPair)
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ self.Profile.PcdFileLineDict[PcdPair] = FileLineTuple
+
+ self._WipeOffArea.append(((SetLine, SetOffset), (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
+ elif self._Token in {TAB_IF_DEF, TAB_IF_N_DEF, TAB_IF}:
+ IfStartPos = (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - len(self._Token))
+ IfList.append([IfStartPos, None, None])
+
+ CondLabel = self._Token
+ Expression = self._GetExpression()
+
+ if CondLabel == TAB_IF:
+ ConditionSatisfied = self._EvaluateConditional(Expression, IfList[-1][0][0] + 1, 'eval')
+ else:
+ ConditionSatisfied = self._EvaluateConditional(Expression, IfList[-1][0][0] + 1, 'in')
+ if CondLabel == TAB_IF_N_DEF:
+ ConditionSatisfied = not ConditionSatisfied
+
+ BranchDetermined = ConditionSatisfied
+ IfList[-1] = [IfList[-1][0], ConditionSatisfied, BranchDetermined]
+ if ConditionSatisfied:
+ self._WipeOffArea.append((IfList[-1][0], (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
+ elif self._Token in {TAB_ELSE_IF, TAB_ELSE}:
+ ElseStartPos = (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - len(self._Token))
+ if len(IfList) <= 0:
+ raise Warning("Missing !if statement", self.FileName, self.CurrentLineNumber)
+
+ if IfList[-1][1]:
+ IfList[-1] = [ElseStartPos, False, True]
+ self._WipeOffArea.append((ElseStartPos, (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
+ else:
+ self._WipeOffArea.append((IfList[-1][0], ElseStartPos))
+ IfList[-1] = [ElseStartPos, True, IfList[-1][2]]
+ if self._Token == TAB_ELSE_IF:
+ Expression = self._GetExpression()
+ ConditionSatisfied = self._EvaluateConditional(Expression, IfList[-1][0][0] + 1, 'eval')
+ IfList[-1] = [IfList[-1][0], ConditionSatisfied, IfList[-1][2]]
+
+ if IfList[-1][1]:
+ if IfList[-1][2]:
+ IfList[-1][1] = False
+ else:
+ IfList[-1][2] = True
+ self._WipeOffArea.append((IfList[-1][0], (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
+ elif self._Token == '!endif':
+ if len(IfList) <= 0:
+ raise Warning("Missing !if statement", self.FileName, self.CurrentLineNumber)
+ if IfList[-1][1]:
+ self._WipeOffArea.append(((self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - len('!endif')), (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
+ else:
+ self._WipeOffArea.append((IfList[-1][0], (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
+
+ IfList.pop()
+ elif not IfList: # Don't use PCDs inside conditional directive
+ if self.CurrentLineNumber <= RegionLayoutLine:
+ # Don't try the same line twice
+ continue
+ SetPcd = ShortcutPcdPattern.match(self.Profile.FileLinesList[self.CurrentLineNumber - 1])
+ if SetPcd:
+ self._PcdDict[SetPcd.group('name')] = SetPcd.group('value')
+ RegionLayoutLine = self.CurrentLineNumber
+ continue
+ RegionSize = RegionSizePattern.match(self.Profile.FileLinesList[self.CurrentLineNumber - 1])
+ if not RegionSize:
+ RegionLayoutLine = self.CurrentLineNumber
+ continue
+ RegionSizeGuid = RegionSizeGuidPattern.match(self.Profile.FileLinesList[self.CurrentLineNumber])
+ if not RegionSizeGuid:
+ RegionLayoutLine = self.CurrentLineNumber + 1
+ continue
+ self._PcdDict[RegionSizeGuid.group('base')] = RegionSize.group('base')
+ self._PcdDict[RegionSizeGuid.group('size')] = RegionSize.group('size')
+ RegionLayoutLine = self.CurrentLineNumber + 1
+
+ if IfList:
+ raise Warning("Missing !endif", self.FileName, self.CurrentLineNumber)
+ self.Rewind()
+
+ def _CollectMacroPcd(self):
+ MacroDict = {}
+
+ # PCD macro
+ MacroDict.update(GlobalData.gPlatformPcds)
+ MacroDict.update(self._PcdDict)
+
+ # Lowest priority
+ MacroDict.update(GlobalData.gPlatformDefines)
+
+ if self._CurSection:
+ # Defines macro
+ ScopeMacro = self._MacroDict[TAB_COMMON, TAB_COMMON, TAB_COMMON]
+ if ScopeMacro:
+ MacroDict.update(ScopeMacro)
+
+ # Section macro
+ ScopeMacro = self._MacroDict[
+ self._CurSection[0],
+ self._CurSection[1],
+ self._CurSection[2]
+ ]
+ if ScopeMacro:
+ MacroDict.update(ScopeMacro)
+
+ MacroDict.update(GlobalData.gGlobalDefines)
+ MacroDict.update(GlobalData.gCommandLineDefines)
+ for Item in GlobalData.BuildOptionPcd:
+ if isinstance(Item, tuple):
+ continue
+ PcdName, TmpValue = Item.split(TAB_EQUAL_SPLIT)
+ TmpValue = BuildOptionValue(TmpValue, {})
+ MacroDict[PcdName.strip()] = TmpValue
+ # Highest priority
+
+ return MacroDict
+
+ def _EvaluateConditional(self, Expression, Line, Op = None, Value = None):
+ MacroPcdDict = self._CollectMacroPcd()
+ if Op == 'eval':
+ try:
+ if Value:
+ return ValueExpression(Expression, MacroPcdDict)(True)
+ else:
+ return ValueExpression(Expression, MacroPcdDict)()
+ except WrnExpression as Excpt:
+ #
+ # Catch expression evaluation warning here. We need to report
+ # the precise number of line and return the evaluation result
+ #
+ EdkLogger.warn('Parser', "Suspicious expression: %s" % str(Excpt),
+ File=self.FileName, ExtraData=self._CurrentLine(),
+ Line=Line)
+ return Excpt.result
+ except Exception as Excpt:
+ if hasattr(Excpt, 'Pcd'):
+ if Excpt.Pcd in GlobalData.gPlatformOtherPcds:
+ Info = GlobalData.gPlatformOtherPcds[Excpt.Pcd]
+ raise Warning("Cannot use this PCD (%s) in an expression as"
+ " it must be defined in a [PcdsFixedAtBuild] or [PcdsFeatureFlag] section"
+ " of the DSC file (%s), and it is currently defined in this section:"
+ " %s, line #: %d." % (Excpt.Pcd, GlobalData.gPlatformOtherPcds['DSCFILE'], Info[0], Info[1]),
+ self.FileName, Line)
+ else:
+ raise Warning("PCD (%s) is not defined in DSC file (%s)" % (Excpt.Pcd, GlobalData.gPlatformOtherPcds['DSCFILE']),
+ self.FileName, Line)
+ else:
+ raise Warning(str(Excpt), self.FileName, Line)
+ else:
+ if Expression.startswith('$(') and Expression[-1] == ')':
+ Expression = Expression[2:-1]
+ return Expression in MacroPcdDict
+
+ ## _IsToken() method
+ #
+ # Check whether input string is found from current char position along
+ # If found, the string value is put into self._Token
+ #
+ # @param self The object pointer
+ # @param String The string to search
+ # @param IgnoreCase Indicate case sensitive/non-sensitive search, default is case sensitive
+ # @retval True Successfully find string, file buffer pointer moved forward
+ # @retval False Not able to find string, file buffer pointer not changed
+ #
+ def _IsToken(self, String, IgnoreCase = False):
+ self._SkipWhiteSpace()
+
+ # Only consider the same line, no multi-line token allowed
+ StartPos = self.CurrentOffsetWithinLine
+ index = -1
+ if IgnoreCase:
+ index = self._CurrentLine()[self.CurrentOffsetWithinLine: ].upper().find(String.upper())
+ else:
+ index = self._CurrentLine()[self.CurrentOffsetWithinLine: ].find(String)
+ if index == 0:
+ self.CurrentOffsetWithinLine += len(String)
+ self._Token = self._CurrentLine()[StartPos: self.CurrentOffsetWithinLine]
+ return True
+ return False
+
+ ## _IsKeyword() method
+ #
+ # Check whether input keyword is found from current char position along, whole word only!
+ # If found, the string value is put into self._Token
+ #
+ # @param self The object pointer
+ # @param Keyword The string to search
+ # @param IgnoreCase Indicate case sensitive/non-sensitive search, default is case sensitive
+ # @retval True Successfully find string, file buffer pointer moved forward
+ # @retval False Not able to find string, file buffer pointer not changed
+ #
+ def _IsKeyword(self, KeyWord, IgnoreCase = False):
+ self._SkipWhiteSpace()
+
+ # Only consider the same line, no multi-line token allowed
+ StartPos = self.CurrentOffsetWithinLine
+ index = -1
+ if IgnoreCase:
+ index = self._CurrentLine()[self.CurrentOffsetWithinLine: ].upper().find(KeyWord.upper())
+ else:
+ index = self._CurrentLine()[self.CurrentOffsetWithinLine: ].find(KeyWord)
+ if index == 0:
+ followingChar = self._CurrentLine()[self.CurrentOffsetWithinLine + len(KeyWord)]
+ if not str(followingChar).isspace() and followingChar not in SEPARATORS:
+ return False
+ self.CurrentOffsetWithinLine += len(KeyWord)
+ self._Token = self._CurrentLine()[StartPos: self.CurrentOffsetWithinLine]
+ return True
+ return False
+
+ def _GetExpression(self):
+ Line = self.Profile.FileLinesList[self.CurrentLineNumber - 1]
+ Index = len(Line) - 1
+ while Line[Index] in CR_LB_SET:
+ Index -= 1
+ ExpressionString = self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine:Index+1]
+ self.CurrentOffsetWithinLine += len(ExpressionString)
+ ExpressionString = ExpressionString.strip()
+ return ExpressionString
+
+ ## _GetNextWord() method
+ #
+ # Get next C name from file lines
+ # If found, the string value is put into self._Token
+ #
+ # @param self The object pointer
+ # @retval True Successfully find a C name string, file buffer pointer moved forward
+ # @retval False Not able to find a C name string, file buffer pointer not changed
+ #
+ def _GetNextWord(self):
+ self._SkipWhiteSpace()
+ if self._EndOfFile():
+ return False
+
+ TempChar = self._CurrentChar()
+ StartPos = self.CurrentOffsetWithinLine
+ if (TempChar >= 'a' and TempChar <= 'z') or (TempChar >= 'A' and TempChar <= 'Z') or TempChar == '_':
+ self._GetOneChar()
+ while not self._EndOfLine():
+ TempChar = self._CurrentChar()
+ if (TempChar >= 'a' and TempChar <= 'z') or (TempChar >= 'A' and TempChar <= 'Z') \
+ or (TempChar >= '0' and TempChar <= '9') or TempChar == '_' or TempChar == '-':
+ self._GetOneChar()
+
+ else:
+ break
+
+ self._Token = self._CurrentLine()[StartPos: self.CurrentOffsetWithinLine]
+ return True
+
+ return False
+
+ def _GetNextPcdWord(self):
+ self._SkipWhiteSpace()
+ if self._EndOfFile():
+ return False
+
+ TempChar = self._CurrentChar()
+ StartPos = self.CurrentOffsetWithinLine
+ if (TempChar >= 'a' and TempChar <= 'z') or (TempChar >= 'A' and TempChar <= 'Z') or TempChar == '_' or TempChar == TAB_SECTION_START or TempChar == TAB_SECTION_END:
+ self._GetOneChar()
+ while not self._EndOfLine():
+ TempChar = self._CurrentChar()
+ if (TempChar >= 'a' and TempChar <= 'z') or (TempChar >= 'A' and TempChar <= 'Z') \
+ or (TempChar >= '0' and TempChar <= '9') or TempChar == '_' or TempChar == '-' or TempChar == TAB_SECTION_START or TempChar == TAB_SECTION_END:
+ self._GetOneChar()
+
+ else:
+ break
+
+ self._Token = self._CurrentLine()[StartPos: self.CurrentOffsetWithinLine]
+ return True
+
+ return False
+
+ ## _GetNextToken() method
+ #
+ # Get next token unit before a separator
+ # If found, the string value is put into self._Token
+ #
+ # @param self The object pointer
+ # @retval True Successfully find a token unit, file buffer pointer moved forward
+ # @retval False Not able to find a token unit, file buffer pointer not changed
+ #
+ def _GetNextToken(self):
+ # Skip leading spaces, if exist.
+ self._SkipWhiteSpace()
+ if self._EndOfFile():
+ return False
+ # Record the token start position, the position of the first non-space char.
+ StartPos = self.CurrentOffsetWithinLine
+ StartLine = self.CurrentLineNumber
+ while StartLine == self.CurrentLineNumber:
+ TempChar = self._CurrentChar()
+ # Try to find the end char that is not a space and not in separator tuple.
+ # That is, when we got a space or any char in the tuple, we got the end of token.
+ if not str(TempChar).isspace() and TempChar not in SEPARATORS:
+ self._GetOneChar()
+ # if we happen to meet a separator as the first char, we must proceed to get it.
+ # That is, we get a token that is a separator char. normally it is the boundary of other tokens.
+ elif StartPos == self.CurrentOffsetWithinLine and TempChar in SEPARATORS:
+ self._GetOneChar()
+ break
+ else:
+ break
+# else:
+# return False
+
+ EndPos = self.CurrentOffsetWithinLine
+ if self.CurrentLineNumber != StartLine:
+ EndPos = len(self.Profile.FileLinesList[StartLine-1])
+ self._Token = self.Profile.FileLinesList[StartLine-1][StartPos: EndPos]
+ if self._Token.lower() in {TAB_IF, TAB_END_IF, TAB_ELSE_IF, TAB_ELSE, TAB_IF_DEF, TAB_IF_N_DEF, TAB_ERROR, TAB_INCLUDE}:
+ self._Token = self._Token.lower()
+ if StartPos != self.CurrentOffsetWithinLine:
+ return True
+ else:
+ return False
+
+ ## _GetNextGuid() method
+ #
+ # Get next token unit before a separator
+ # If found, the GUID string is put into self._Token
+ #
+ # @param self The object pointer
+ # @retval True Successfully find a registry format GUID, file buffer pointer moved forward
+ # @retval False Not able to find a registry format GUID, file buffer pointer not changed
+ #
+ def _GetNextGuid(self):
+ if not self._GetNextToken():
+ return False
+ if GlobalData.gGuidPattern.match(self._Token) is not None:
+ return True
+ elif self._Token in GlobalData.gGuidDict:
+ return True
+ else:
+ self._UndoToken()
+ return False
+
+ @staticmethod
+ def _Verify(Name, Value, Scope):
+ # value verification only applies to numeric values.
+ if Scope not in TAB_PCD_NUMERIC_TYPES:
+ return
+
+ ValueNumber = 0
+ try:
+ ValueNumber = int(Value, 0)
+ except:
+ EdkLogger.error("FdfParser", FORMAT_INVALID, "The value is not valid dec or hex number for %s." % Name)
+ if ValueNumber < 0:
+ EdkLogger.error("FdfParser", FORMAT_INVALID, "The value can't be set to negative value for %s." % Name)
+ if ValueNumber > MAX_VAL_TYPE[Scope]:
+ EdkLogger.error("FdfParser", FORMAT_INVALID, "Too large value for %s." % Name)
+ return True
+
+ ## _UndoToken() method
+ #
+ # Go back one token unit in file buffer
+ #
+ # @param self The object pointer
+ #
+ def _UndoToken(self):
+ self._UndoOneChar()
+ while self._CurrentChar().isspace():
+ if not self._UndoOneChar():
+ self._GetOneChar()
+ return
+
+
+ StartPos = self.CurrentOffsetWithinLine
+ CurrentLine = self.CurrentLineNumber
+ while CurrentLine == self.CurrentLineNumber:
+
+ TempChar = self._CurrentChar()
+ # Try to find the end char that is not a space and not in separator tuple.
+ # That is, when we got a space or any char in the tuple, we got the end of token.
+ if not str(TempChar).isspace() and not TempChar in SEPARATORS:
+ if not self._UndoOneChar():
+ return
+ # if we happen to meet a separator as the first char, we must proceed to get it.
+ # That is, we get a token that is a separator char. normally it is the boundary of other tokens.
+ elif StartPos == self.CurrentOffsetWithinLine and TempChar in SEPARATORS:
+ return
+ else:
+ break
+
+ self._GetOneChar()
+
+ ## _GetNextHexNumber() method
+ #
+ # Get next HEX data before a separator
+ # If found, the HEX data is put into self._Token
+ #
+ # @param self The object pointer
+ # @retval True Successfully find a HEX data, file buffer pointer moved forward
+ # @retval False Not able to find a HEX data, file buffer pointer not changed
+ #
+ def _GetNextHexNumber(self):
+ if not self._GetNextToken():
+ return False
+ if GlobalData.gHexPatternAll.match(self._Token):
+ return True
+ else:
+ self._UndoToken()
+ return False
+
+ ## _GetNextDecimalNumber() method
+ #
+ # Get next decimal data before a separator
+ # If found, the decimal data is put into self._Token
+ #
+ # @param self The object pointer
+ # @retval True Successfully find a decimal data, file buffer pointer moved forward
+ # @retval False Not able to find a decimal data, file buffer pointer not changed
+ #
+ def _GetNextDecimalNumber(self):
+ if not self._GetNextToken():
+ return False
+ if self._Token.isdigit():
+ return True
+ else:
+ self._UndoToken()
+ return False
+
+ def _GetNextPcdSettings(self):
+ if not self._GetNextWord():
+ raise Warning.Expected("<PcdTokenSpaceCName>", self.FileName, self.CurrentLineNumber)
+ pcdTokenSpaceCName = self._Token
+
+ if not self._IsToken(TAB_SPLIT):
+ raise Warning.Expected(".", self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextWord():
+ raise Warning.Expected("<PcdCName>", self.FileName, self.CurrentLineNumber)
+ pcdCName = self._Token
+
+ Fields = []
+ while self._IsToken(TAB_SPLIT):
+ if not self._GetNextPcdWord():
+ raise Warning.Expected("Pcd Fields", self.FileName, self.CurrentLineNumber)
+ Fields.append(self._Token)
+
+ return (pcdCName, pcdTokenSpaceCName,TAB_SPLIT.join(Fields))
+
+ ## _GetStringData() method
+ #
+ # Get string contents quoted in ""
+ # If found, the decimal data is put into self._Token
+ #
+ # @param self The object pointer
+ # @retval True Successfully find a string data, file buffer pointer moved forward
+ # @retval False Not able to find a string data, file buffer pointer not changed
+ #
+ def _GetStringData(self):
+ QuoteToUse = None
+ if self._Token.startswith(T_CHAR_DOUBLE_QUOTE) or self._Token.startswith("L\""):
+ QuoteToUse = T_CHAR_DOUBLE_QUOTE
+ elif self._Token.startswith(T_CHAR_SINGLE_QUOTE) or self._Token.startswith("L\'"):
+ QuoteToUse = T_CHAR_SINGLE_QUOTE
+ else:
+ return False
+
+ self._UndoToken()
+ self._SkipToToken(QuoteToUse)
+ currentLineNumber = self.CurrentLineNumber
+
+ if not self._SkipToToken(QuoteToUse):
+ raise Warning(QuoteToUse, self.FileName, self.CurrentLineNumber)
+ if currentLineNumber != self.CurrentLineNumber:
+ raise Warning(QuoteToUse, self.FileName, self.CurrentLineNumber)
+ self._Token = self._SkippedChars.rstrip(QuoteToUse)
+ return True
+
+ ## _SkipToToken() method
+ #
+ # Search forward in file buffer for the string
+ # The skipped chars are put into self._SkippedChars
+ #
+ # @param self The object pointer
+ # @param String The string to search
+ # @param IgnoreCase Indicate case sensitive/non-sensitive search, default is case sensitive
+ # @retval True Successfully find the string, file buffer pointer moved forward
+ # @retval False Not able to find the string, file buffer pointer not changed
+ #
+ def _SkipToToken(self, String, IgnoreCase = False):
+ StartPos = self.GetFileBufferPos()
+
+ self._SkippedChars = ""
+ while not self._EndOfFile():
+ index = -1
+ if IgnoreCase:
+ index = self._CurrentLine()[self.CurrentOffsetWithinLine: ].upper().find(String.upper())
+ else:
+ index = self._CurrentLine()[self.CurrentOffsetWithinLine: ].find(String)
+ if index == 0:
+ self.CurrentOffsetWithinLine += len(String)
+ self._SkippedChars += String
+ return True
+ self._SkippedChars += str(self._CurrentChar())
+ self._GetOneChar()
+
+ self.SetFileBufferPos(StartPos)
+ self._SkippedChars = ""
+ return False
+
+ ## GetFileBufferPos() method
+ #
+ # Return the tuple of current line and offset within the line
+ #
+ # @param self The object pointer
+ # @retval Tuple Line number and offset pair
+ #
+ def GetFileBufferPos(self):
+ return (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
+
+ ## SetFileBufferPos() method
+ #
+ # Restore the file buffer position
+ #
+ # @param self The object pointer
+ # @param Pos The new file buffer position
+ #
+ def SetFileBufferPos(self, Pos):
+ (self.CurrentLineNumber, self.CurrentOffsetWithinLine) = Pos
+
+ ## Preprocess() method
+ #
+ # Preprocess comment, conditional directive, include directive, replace macro.
+ # Exception will be raised if syntax error found
+ #
+ # @param self The object pointer
+ #
+ def Preprocess(self):
+ self._StringToList()
+ self.PreprocessFile()
+ self.PreprocessIncludeFile()
+ self._StringToList()
+ self.PreprocessFile()
+ self.PreprocessConditionalStatement()
+ self._StringToList()
+ for Pos in self._WipeOffArea:
+ self._ReplaceFragment(Pos[0], Pos[1])
+ self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]
+
+ while self._GetDefines():
+ pass
+
+ ## ParseFile() method
+ #
+ # Parse the file profile buffer to extract fd, fv ... information
+ # Exception will be raised if syntax error found
+ #
+ # @param self The object pointer
+ #
+ def ParseFile(self):
+ try:
+ self.Preprocess()
+ self._GetError()
+ #
+ # Keep processing sections of the FDF until no new sections or a syntax error is found
+ #
+ while self._GetFd() or self._GetFv() or self._GetFmp() or self._GetCapsule() or self._GetRule() or self._GetOptionRom():
+ pass
+
+ except Warning as X:
+ self._UndoToken()
+ #'\n\tGot Token: \"%s\" from File %s\n' % (self._Token, FileLineTuple[0]) + \
+ # At this point, the closest parent would be the included file itself
+ Profile = GetParentAtLine(X.OriginalLineNumber)
+ if Profile is not None:
+ X.Message += ' near line %d, column %d: %s' \
+ % (X.LineNumber, 0, Profile.FileLinesList[X.LineNumber-1])
+ else:
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ X.Message += ' near line %d, column %d: %s' \
+ % (FileLineTuple[1], self.CurrentOffsetWithinLine + 1, self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine:].rstrip(TAB_LINE_BREAK).rstrip(T_CHAR_CR))
+ raise
+
+ ## SectionParser() method
+ #
+ # Parse the file section info
+ # Exception will be raised if syntax error found
+ #
+ # @param self The object pointer
+ # @param section The section string
+
+ def SectionParser(self, section):
+ S = section.upper()
+ if not S.startswith("[DEFINES") and not S.startswith("[FD.") and not S.startswith("[FV.") and not S.startswith("[CAPSULE.") \
+ and not S.startswith("[RULE.") and not S.startswith("[OPTIONROM.") and not S.startswith('[FMPPAYLOAD.'):
+ raise Warning("Unknown section or section appear sequence error (The correct sequence should be [DEFINES], [FD.], [FV.], [Capsule.], [Rule.], [OptionRom.], [FMPPAYLOAD.])", self.FileName, self.CurrentLineNumber)
+
+ ## _GetDefines() method
+ #
+ # Get Defines section contents and store its data into AllMacrosList
+ #
+ # @param self The object pointer
+ # @retval True Successfully find a Defines
+ # @retval False Not able to find a Defines
+ #
+ def _GetDefines(self):
+ if not self._GetNextToken():
+ return False
+
+ S = self._Token.upper()
+ if S.startswith(TAB_SECTION_START) and not S.startswith("[DEFINES"):
+ self.SectionParser(S)
+ self._UndoToken()
+ return False
+
+ self._UndoToken()
+ if not self._IsToken("[DEFINES", True):
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ #print 'Parsing String: %s in File %s, At line: %d, Offset Within Line: %d' \
+ # % (self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], FileLineTuple[1], self.CurrentOffsetWithinLine)
+ raise Warning.Expected("[DEFINES", self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken(TAB_SECTION_END):
+ raise Warning.ExpectedBracketClose(self.FileName, self.CurrentLineNumber)
+
+ while self._GetNextWord():
+ # handle the SET statement
+ if self._Token == 'SET':
+ self._UndoToken()
+ self._GetSetStatement(None)
+ continue
+
+ Macro = self._Token
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken() or self._Token.startswith(TAB_SECTION_START):
+ raise Warning.Expected("MACRO value", self.FileName, self.CurrentLineNumber)
+ Value = self._Token
+
+ return False
+
+ ##_GetError() method
+ def _GetError(self):
+ #save the Current information
+ CurrentLine = self.CurrentLineNumber
+ CurrentOffset = self.CurrentOffsetWithinLine
+ while self._GetNextToken():
+ if self._Token == TAB_ERROR:
+ EdkLogger.error('FdfParser', ERROR_STATEMENT, self._CurrentLine().replace(TAB_ERROR, '', 1), File=self.FileName, Line=self.CurrentLineNumber)
+ self.CurrentLineNumber = CurrentLine
+ self.CurrentOffsetWithinLine = CurrentOffset
+
+ ## _GetFd() method
+ #
+ # Get FD section contents and store its data into FD dictionary of self.Profile
+ #
+ # @param self The object pointer
+ # @retval True Successfully find a FD
+ # @retval False Not able to find a FD
+ #
+ def _GetFd(self):
+ if not self._GetNextToken():
+ return False
+
+ S = self._Token.upper()
+ if S.startswith(TAB_SECTION_START) and not S.startswith("[FD."):
+ if not S.startswith("[FV.") and not S.startswith('[FMPPAYLOAD.') and not S.startswith("[CAPSULE.") \
+ and not S.startswith("[RULE.") and not S.startswith("[OPTIONROM."):
+ raise Warning("Unknown section", self.FileName, self.CurrentLineNumber)
+ self._UndoToken()
+ return False
+
+ self._UndoToken()
+ if not self._IsToken("[FD.", True):
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ #print 'Parsing String: %s in File %s, At line: %d, Offset Within Line: %d' \
+ # % (self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], FileLineTuple[1], self.CurrentOffsetWithinLine)
+ raise Warning.Expected("[FD.]", self.FileName, self.CurrentLineNumber)
+
+ FdName = self._GetUiName()
+ if FdName == "":
+ if len (self.Profile.FdDict) == 0:
+ FdName = GenFdsGlobalVariable.PlatformName
+ if FdName == "" and GlobalData.gActivePlatform:
+ FdName = GlobalData.gActivePlatform.PlatformName
+ self.Profile.FdNameNotSet = True
+ else:
+ raise Warning.Expected("FdName in [FD.] section", self.FileName, self.CurrentLineNumber)
+ self.CurrentFdName = FdName.upper()
+
+ if self.CurrentFdName in self.Profile.FdDict:
+ raise Warning("Unexpected the same FD name", self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken(TAB_SECTION_END):
+ raise Warning.ExpectedBracketClose(self.FileName, self.CurrentLineNumber)
+
+ FdObj = FD()
+ FdObj.FdUiName = self.CurrentFdName
+ self.Profile.FdDict[self.CurrentFdName] = FdObj
+
+ if len (self.Profile.FdDict) > 1 and self.Profile.FdNameNotSet:
+ raise Warning.Expected("all FDs have their name", self.FileName, self.CurrentLineNumber)
+
+ Status = self._GetCreateFile(FdObj)
+ if not Status:
+ raise Warning("FD name error", self.FileName, self.CurrentLineNumber)
+
+ while self._GetTokenStatements(FdObj):
+ pass
+ for Attr in ("BaseAddress", "Size", "ErasePolarity"):
+ if getattr(FdObj, Attr) is None:
+ self._GetNextToken()
+ raise Warning("Keyword %s missing" % Attr, self.FileName, self.CurrentLineNumber)
+
+ if not FdObj.BlockSizeList:
+ FdObj.BlockSizeList.append((1, FdObj.Size, None))
+
+ self._GetDefineStatements(FdObj)
+
+ self._GetSetStatements(FdObj)
+
+ if not self._GetRegionLayout(FdObj):
+ raise Warning.Expected("region layout", self.FileName, self.CurrentLineNumber)
+
+ while self._GetRegionLayout(FdObj):
+ pass
+ return True
+
+ ## _GetUiName() method
+ #
+ # Return the UI name of a section
+ #
+ # @param self The object pointer
+ # @retval FdName UI name
+ #
+ def _GetUiName(self):
+ Name = ""
+ if self._GetNextWord():
+ Name = self._Token
+
+ return Name
+
+ ## _GetCreateFile() method
+ #
+ # Return the output file name of object
+ #
+ # @param self The object pointer
+ # @param Obj object whose data will be stored in file
+ # @retval FdName UI name
+ #
+ def _GetCreateFile(self, Obj):
+ if self._IsKeyword("CREATE_FILE"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("file name", self.FileName, self.CurrentLineNumber)
+
+ FileName = self._Token
+ Obj.CreateFileName = FileName
+
+ return True
+
+ def SetPcdLocalation(self,pcdpair):
+ self.Profile.PcdLocalDict[pcdpair] = (self.Profile.FileName,self.CurrentLineNumber)
+
+ ## _GetTokenStatements() method
+ #
+ # Get token statements
+ #
+ # @param self The object pointer
+ # @param Obj for whom token statement is got
+ #
+ def _GetTokenStatements(self, Obj):
+ if self._IsKeyword("BaseAddress"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextHexNumber():
+ raise Warning.Expected("Hex base address", self.FileName, self.CurrentLineNumber)
+
+ Obj.BaseAddress = self._Token
+
+ if self._IsToken(TAB_VALUE_SPLIT):
+ pcdPair = self._GetNextPcdSettings()
+ Obj.BaseAddressPcd = pcdPair
+ self.Profile.PcdDict[pcdPair] = Obj.BaseAddress
+ self.SetPcdLocalation(pcdPair)
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ self.Profile.PcdFileLineDict[pcdPair] = FileLineTuple
+ return True
+
+ if self._IsKeyword("Size"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextHexNumber():
+ raise Warning.Expected("Hex size", self.FileName, self.CurrentLineNumber)
+
+ Size = self._Token
+ if self._IsToken(TAB_VALUE_SPLIT):
+ pcdPair = self._GetNextPcdSettings()
+ Obj.SizePcd = pcdPair
+ self.Profile.PcdDict[pcdPair] = Size
+ self.SetPcdLocalation(pcdPair)
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ self.Profile.PcdFileLineDict[pcdPair] = FileLineTuple
+ Obj.Size = int(Size, 0)
+ return True
+
+ if self._IsKeyword("ErasePolarity"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("Erase Polarity", self.FileName, self.CurrentLineNumber)
+
+ if not self._Token in {"1", "0"}:
+ raise Warning.Expected("1 or 0 Erase Polarity", self.FileName, self.CurrentLineNumber)
+
+ Obj.ErasePolarity = self._Token
+ return True
+
+ return self._GetBlockStatements(Obj)
+
+ ## _GetAddressStatements() method
+ #
+ # Get address statements
+ #
+ # @param self The object pointer
+ # @param Obj for whom address statement is got
+ # @retval True Successfully find
+ # @retval False Not able to find
+ #
+ def _GetAddressStatements(self, Obj):
+ if self._IsKeyword("BsBaseAddress"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextDecimalNumber() and not self._GetNextHexNumber():
+ raise Warning.Expected("address", self.FileName, self.CurrentLineNumber)
+
+ BsAddress = int(self._Token, 0)
+ Obj.BsBaseAddress = BsAddress
+
+ if self._IsKeyword("RtBaseAddress"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextDecimalNumber() and not self._GetNextHexNumber():
+ raise Warning.Expected("address", self.FileName, self.CurrentLineNumber)
+
+ RtAddress = int(self._Token, 0)
+ Obj.RtBaseAddress = RtAddress
+
+ ## _GetBlockStatements() method
+ #
+ # Get block statements
+ #
+ # @param self The object pointer
+ # @param Obj for whom block statement is got
+ #
+ def _GetBlockStatements(self, Obj):
+ IsBlock = False
+ while self._GetBlockStatement(Obj):
+ IsBlock = True
+
+ Item = Obj.BlockSizeList[-1]
+ if Item[0] is None or Item[1] is None:
+ raise Warning.Expected("block statement", self.FileName, self.CurrentLineNumber)
+ return IsBlock
+
+ ## _GetBlockStatement() method
+ #
+ # Get block statement
+ #
+ # @param self The object pointer
+ # @param Obj for whom block statement is got
+ # @retval True Successfully find
+ # @retval False Not able to find
+ #
+ def _GetBlockStatement(self, Obj):
+ if not self._IsKeyword("BlockSize"):
+ return False
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextHexNumber() and not self._GetNextDecimalNumber():
+ raise Warning.Expected("Hex or Integer block size", self.FileName, self.CurrentLineNumber)
+
+ BlockSize = self._Token
+ BlockSizePcd = None
+ if self._IsToken(TAB_VALUE_SPLIT):
+ PcdPair = self._GetNextPcdSettings()
+ BlockSizePcd = PcdPair
+ self.Profile.PcdDict[PcdPair] = BlockSize
+ self.SetPcdLocalation(PcdPair)
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ self.Profile.PcdFileLineDict[PcdPair] = FileLineTuple
+ BlockSize = int(BlockSize, 0)
+
+ BlockNumber = None
+ if self._IsKeyword("NumBlocks"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextDecimalNumber() and not self._GetNextHexNumber():
+ raise Warning.Expected("block numbers", self.FileName, self.CurrentLineNumber)
+
+ BlockNumber = int(self._Token, 0)
+
+ Obj.BlockSizeList.append((BlockSize, BlockNumber, BlockSizePcd))
+ return True
+
+ ## _GetDefineStatements() method
+ #
+ # Get define statements
+ #
+ # @param self The object pointer
+ # @param Obj for whom define statement is got
+ # @retval True Successfully find
+ # @retval False Not able to find
+ #
+ def _GetDefineStatements(self, Obj):
+ while self._GetDefineStatement(Obj):
+ pass
+
+ ## _GetDefineStatement() method
+ #
+ # Get define statement
+ #
+ # @param self The object pointer
+ # @param Obj for whom define statement is got
+ # @retval True Successfully find
+ # @retval False Not able to find
+ #
+ def _GetDefineStatement(self, Obj):
+ if self._IsKeyword(TAB_DEFINE):
+ self._GetNextToken()
+ Macro = self._Token
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("value", self.FileName, self.CurrentLineNumber)
+
+ Value = self._Token
+ Macro = '$(' + Macro + ')'
+ Obj.DefineVarDict[Macro] = Value
+ return True
+
+ return False
+
+ ## _GetSetStatements() method
+ #
+ # Get set statements
+ #
+ # @param self The object pointer
+ # @param Obj for whom set statement is got
+ # @retval True Successfully find
+ # @retval False Not able to find
+ #
+ def _GetSetStatements(self, Obj):
+ while self._GetSetStatement(Obj):
+ pass
+
+ ## _GetSetStatement() method
+ #
+ # Get set statement
+ #
+ # @param self The object pointer
+ # @param Obj for whom set statement is got
+ # @retval True Successfully find
+ # @retval False Not able to find
+ #
+ def _GetSetStatement(self, Obj):
+ if self._IsKeyword("SET"):
+ PcdPair = self._GetNextPcdSettings()
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ Value = self._GetExpression()
+ Value = self._EvaluateConditional(Value, self.CurrentLineNumber, 'eval', True)
+
+ if Obj:
+ Obj.SetVarDict[PcdPair] = Value
+ self.Profile.PcdDict[PcdPair] = Value
+ self.SetPcdLocalation(PcdPair)
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ self.Profile.PcdFileLineDict[PcdPair] = FileLineTuple
+ return True
+
+ return False
+
+ ## _CalcRegionExpr(self)
+ #
+ # Calculate expression for offset or size of a region
+ #
+ # @return: None if invalid expression
+ # Calculated number if successfully
+ #
+ def _CalcRegionExpr(self):
+ StartPos = self.GetFileBufferPos()
+ Expr = ''
+ PairCount = 0
+ while not self._EndOfFile():
+ CurCh = self._CurrentChar()
+ if CurCh == '(':
+ PairCount += 1
+ elif CurCh == ')':
+ PairCount -= 1
+
+ if CurCh in '|\r\n' and PairCount == 0:
+ break
+ Expr += CurCh
+ self._GetOneChar()
+ try:
+ return int(
+ ValueExpression(Expr,
+ self._CollectMacroPcd()
+ )(True), 0)
+ except Exception:
+ self.SetFileBufferPos(StartPos)
+ return None
+
+ ## _GetRegionLayout() method
+ #
+ # Get region layout for FD
+ #
+ # @param self The object pointer
+ # @param theFd for whom region is got
+ # @retval True Successfully find
+ # @retval False Not able to find
+ #
+ def _GetRegionLayout(self, theFd):
+ Offset = self._CalcRegionExpr()
+ if Offset is None:
+ return False
+
+ RegionObj = Region()
+ RegionObj.Offset = Offset
+ theFd.RegionList.append(RegionObj)
+
+ if not self._IsToken(TAB_VALUE_SPLIT):
+ raise Warning.Expected("'|'", self.FileName, self.CurrentLineNumber)
+
+ Size = self._CalcRegionExpr()
+ if Size is None:
+ raise Warning.Expected("Region Size", self.FileName, self.CurrentLineNumber)
+ RegionObj.Size = Size
+
+ if not self._GetNextWord():
+ return True
+
+ if not self._Token in {"SET", BINARY_FILE_TYPE_FV, "FILE", "DATA", "CAPSULE", "INF"}:
+ #
+ # If next token is a word which is not a valid FV type, it might be part of [PcdOffset[|PcdSize]]
+ # Or it might be next region's offset described by an expression which starts with a PCD.
+ # PcdOffset[|PcdSize] or OffsetPcdExpression|Size
+ #
+ self._UndoToken()
+ IsRegionPcd = (RegionSizeGuidPattern.match(self._CurrentLine()[self.CurrentOffsetWithinLine:]) or
+ RegionOffsetPcdPattern.match(self._CurrentLine()[self.CurrentOffsetWithinLine:]))
+ if IsRegionPcd:
+ RegionObj.PcdOffset = self._GetNextPcdSettings()
+ self.Profile.PcdDict[RegionObj.PcdOffset] = "0x%08X" % (RegionObj.Offset + int(theFd.BaseAddress, 0))
+ self.SetPcdLocalation(RegionObj.PcdOffset)
+ self._PcdDict['%s.%s' % (RegionObj.PcdOffset[1], RegionObj.PcdOffset[0])] = "0x%x" % RegionObj.Offset
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ self.Profile.PcdFileLineDict[RegionObj.PcdOffset] = FileLineTuple
+ if self._IsToken(TAB_VALUE_SPLIT):
+ RegionObj.PcdSize = self._GetNextPcdSettings()
+ self.Profile.PcdDict[RegionObj.PcdSize] = "0x%08X" % RegionObj.Size
+ self.SetPcdLocalation(RegionObj.PcdSize)
+ self._PcdDict['%s.%s' % (RegionObj.PcdSize[1], RegionObj.PcdSize[0])] = "0x%x" % RegionObj.Size
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ self.Profile.PcdFileLineDict[RegionObj.PcdSize] = FileLineTuple
+
+ if not self._GetNextWord():
+ return True
+
+ if self._Token == "SET":
+ self._UndoToken()
+ self._GetSetStatements(RegionObj)
+ if not self._GetNextWord():
+ return True
+
+ elif self._Token == BINARY_FILE_TYPE_FV:
+ self._UndoToken()
+ self._GetRegionFvType(RegionObj)
+
+ elif self._Token == "CAPSULE":
+ self._UndoToken()
+ self._GetRegionCapType(RegionObj)
+
+ elif self._Token == "FILE":
+ self._UndoToken()
+ self._GetRegionFileType(RegionObj)
+
+ elif self._Token == "INF":
+ self._UndoToken()
+ RegionObj.RegionType = "INF"
+ while self._IsKeyword("INF"):
+ self._UndoToken()
+ ffsInf = self._ParseInfStatement()
+ if not ffsInf:
+ break
+ RegionObj.RegionDataList.append(ffsInf)
+
+ elif self._Token == "DATA":
+ self._UndoToken()
+ self._GetRegionDataType(RegionObj)
+ else:
+ self._UndoToken()
+ if self._GetRegionLayout(theFd):
+ return True
+ raise Warning("A valid region type was not found. "
+ "Valid types are [SET, FV, CAPSULE, FILE, DATA, INF]. This error occurred",
+ self.FileName, self.CurrentLineNumber)
+
+ return True
+
+ ## _GetRegionFvType() method
+ #
+ # Get region fv data for region
+ #
+ # @param self The object pointer
+ # @param RegionObj for whom region data is got
+ #
+ def _GetRegionFvType(self, RegionObj):
+ if not self._IsKeyword(BINARY_FILE_TYPE_FV):
+ raise Warning.Expected("'FV'", self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("FV name", self.FileName, self.CurrentLineNumber)
+
+ RegionObj.RegionType = BINARY_FILE_TYPE_FV
+ RegionObj.RegionDataList.append((self._Token).upper())
+
+ while self._IsKeyword(BINARY_FILE_TYPE_FV):
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("FV name", self.FileName, self.CurrentLineNumber)
+
+ RegionObj.RegionDataList.append((self._Token).upper())
+
+ ## _GetRegionCapType() method
+ #
+ # Get region capsule data for region
+ #
+ # @param self The object pointer
+ # @param RegionObj for whom region data is got
+ #
+ def _GetRegionCapType(self, RegionObj):
+ if not self._IsKeyword("CAPSULE"):
+ raise Warning.Expected("'CAPSULE'", self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("CAPSULE name", self.FileName, self.CurrentLineNumber)
+
+ RegionObj.RegionType = "CAPSULE"
+ RegionObj.RegionDataList.append(self._Token)
+
+ while self._IsKeyword("CAPSULE"):
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("CAPSULE name", self.FileName, self.CurrentLineNumber)
+
+ RegionObj.RegionDataList.append(self._Token)
+
+ ## _GetRegionFileType() method
+ #
+ # Get region file data for region
+ #
+ # @param self The object pointer
+ # @param RegionObj for whom region data is got
+ #
+ def _GetRegionFileType(self, RegionObj):
+ if not self._IsKeyword("FILE"):
+ raise Warning.Expected("'FILE'", self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("File name", self.FileName, self.CurrentLineNumber)
+
+ RegionObj.RegionType = "FILE"
+ RegionObj.RegionDataList.append(self._Token)
+
+ while self._IsKeyword("FILE"):
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("FILE name", self.FileName, self.CurrentLineNumber)
+
+ RegionObj.RegionDataList.append(self._Token)
+
+ ## _GetRegionDataType() method
+ #
+ # Get region array data for region
+ #
+ # @param self The object pointer
+ # @param RegionObj for whom region data is got
+ #
+ def _GetRegionDataType(self, RegionObj):
+ if not self._IsKeyword("DATA"):
+ raise Warning.Expected("Region Data type", self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken("{"):
+ raise Warning.ExpectedCurlyOpen(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextHexNumber():
+ raise Warning.Expected("Hex byte", self.FileName, self.CurrentLineNumber)
+
+ if len(self._Token) > 18:
+ raise Warning("Hex string can't be converted to a valid UINT64 value", self.FileName, self.CurrentLineNumber)
+
+ # convert hex string value to byte hex string array
+ AllString = self._Token
+ AllStrLen = len (AllString)
+ DataString = ""
+ while AllStrLen > 4:
+ DataString = DataString + "0x" + AllString[AllStrLen - 2: AllStrLen] + TAB_COMMA_SPLIT
+ AllStrLen = AllStrLen - 2
+ DataString = DataString + AllString[:AllStrLen] + TAB_COMMA_SPLIT
+
+ # byte value array
+ if len (self._Token) <= 4:
+ while self._IsToken(TAB_COMMA_SPLIT):
+ if not self._GetNextHexNumber():
+ raise Warning("Invalid Hex number", self.FileName, self.CurrentLineNumber)
+ if len(self._Token) > 4:
+ raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)
+ DataString += self._Token
+ DataString += TAB_COMMA_SPLIT
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+
+ DataString = DataString.rstrip(TAB_COMMA_SPLIT)
+ RegionObj.RegionType = "DATA"
+ RegionObj.RegionDataList.append(DataString)
+
+ while self._IsKeyword("DATA"):
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken("{"):
+ raise Warning.ExpectedCurlyOpen(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextHexNumber():
+ raise Warning.Expected("Hex byte", self.FileName, self.CurrentLineNumber)
+
+ if len(self._Token) > 18:
+ raise Warning("Hex string can't be converted to a valid UINT64 value", self.FileName, self.CurrentLineNumber)
+
+ # convert hex string value to byte hex string array
+ AllString = self._Token
+ AllStrLen = len (AllString)
+ DataString = ""
+ while AllStrLen > 4:
+ DataString = DataString + "0x" + AllString[AllStrLen - 2: AllStrLen] + TAB_COMMA_SPLIT
+ AllStrLen = AllStrLen - 2
+ DataString = DataString + AllString[:AllStrLen] + TAB_COMMA_SPLIT
+
+ # byte value array
+ if len (self._Token) <= 4:
+ while self._IsToken(TAB_COMMA_SPLIT):
+ if not self._GetNextHexNumber():
+ raise Warning("Invalid Hex number", self.FileName, self.CurrentLineNumber)
+ if len(self._Token) > 4:
+ raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)
+ DataString += self._Token
+ DataString += TAB_COMMA_SPLIT
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+
+ DataString = DataString.rstrip(TAB_COMMA_SPLIT)
+ RegionObj.RegionDataList.append(DataString)
+
+ ## _GetFv() method
+ #
+ # Get FV section contents and store its data into FV dictionary of self.Profile
+ #
+ # @param self The object pointer
+ # @retval True Successfully find a FV
+ # @retval False Not able to find a FV
+ #
+ def _GetFv(self):
+ if not self._GetNextToken():
+ return False
+
+ S = self._Token.upper()
+ if S.startswith(TAB_SECTION_START) and not S.startswith("[FV."):
+ self.SectionParser(S)
+ self._UndoToken()
+ return False
+
+ self._UndoToken()
+ if not self._IsToken("[FV.", True):
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ #print 'Parsing String: %s in File %s, At line: %d, Offset Within Line: %d' \
+ # % (self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], FileLineTuple[1], self.CurrentOffsetWithinLine)
+ raise Warning("Unknown Keyword '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+
+ FvName = self._GetUiName()
+ self.CurrentFvName = FvName.upper()
+
+ if not self._IsToken(TAB_SECTION_END):
+ raise Warning.ExpectedBracketClose(self.FileName, self.CurrentLineNumber)
+
+ FvObj = FV(Name=self.CurrentFvName)
+ self.Profile.FvDict[self.CurrentFvName] = FvObj
+
+ Status = self._GetCreateFile(FvObj)
+ if not Status:
+ raise Warning("FV name error", self.FileName, self.CurrentLineNumber)
+
+ self._GetDefineStatements(FvObj)
+
+ self._GetAddressStatements(FvObj)
+
+ while True:
+ self._GetSetStatements(FvObj)
+
+ if not (self._GetBlockStatement(FvObj) or self._GetFvBaseAddress(FvObj) or
+ self._GetFvForceRebase(FvObj) or self._GetFvAlignment(FvObj) or
+ self._GetFvAttributes(FvObj) or self._GetFvNameGuid(FvObj) or
+ self._GetFvExtEntryStatement(FvObj) or self._GetFvNameString(FvObj)):
+ break
+
+ if FvObj.FvNameString == 'TRUE' and not FvObj.FvNameGuid:
+ raise Warning("FvNameString found but FvNameGuid was not found", self.FileName, self.CurrentLineNumber)
+
+ self._GetAprioriSection(FvObj)
+ self._GetAprioriSection(FvObj)
+
+ while True:
+ isInf = self._GetInfStatement(FvObj)
+ isFile = self._GetFileStatement(FvObj)
+ if not isInf and not isFile:
+ break
+
+ return True
+
+ ## _GetFvAlignment() method
+ #
+ # Get alignment for FV
+ #
+ # @param self The object pointer
+ # @param Obj for whom alignment is got
+ # @retval True Successfully find a alignment statement
+ # @retval False Not able to find a alignment statement
+ #
+ def _GetFvAlignment(self, Obj):
+ if not self._IsKeyword("FvAlignment"):
+ return False
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("alignment value", self.FileName, self.CurrentLineNumber)
+
+ if self._Token.upper() not in {"1", "2", "4", "8", "16", "32", "64", "128", "256", "512", \
+ "1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K", "512K", \
+ "1M", "2M", "4M", "8M", "16M", "32M", "64M", "128M", "256M", "512M", \
+ "1G", "2G"}:
+ raise Warning("Unknown alignment value '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+ Obj.FvAlignment = self._Token
+ return True
+
+ ## _GetFvBaseAddress() method
+ #
+ # Get BaseAddress for FV
+ #
+ # @param self The object pointer
+ # @param Obj for whom FvBaseAddress is got
+ # @retval True Successfully find a FvBaseAddress statement
+ # @retval False Not able to find a FvBaseAddress statement
+ #
+ def _GetFvBaseAddress(self, Obj):
+ if not self._IsKeyword("FvBaseAddress"):
+ return False
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("FV base address value", self.FileName, self.CurrentLineNumber)
+
+ if not BaseAddrValuePattern.match(self._Token.upper()):
+ raise Warning("Unknown FV base address value '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+ Obj.FvBaseAddress = self._Token
+ return True
+
+ ## _GetFvForceRebase() method
+ #
+ # Get FvForceRebase for FV
+ #
+ # @param self The object pointer
+ # @param Obj for whom FvForceRebase is got
+ # @retval True Successfully find a FvForceRebase statement
+ # @retval False Not able to find a FvForceRebase statement
+ #
+ def _GetFvForceRebase(self, Obj):
+ if not self._IsKeyword("FvForceRebase"):
+ return False
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("FvForceRebase value", self.FileName, self.CurrentLineNumber)
+
+ if self._Token.upper() not in {"TRUE", "FALSE", "0", "0X0", "0X00", "1", "0X1", "0X01"}:
+ raise Warning("Unknown FvForceRebase value '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+
+ if self._Token.upper() in {"TRUE", "1", "0X1", "0X01"}:
+ Obj.FvForceRebase = True
+ elif self._Token.upper() in {"FALSE", "0", "0X0", "0X00"}:
+ Obj.FvForceRebase = False
+ else:
+ Obj.FvForceRebase = None
+
+ return True
+
+
+ ## _GetFvAttributes() method
+ #
+ # Get attributes for FV
+ #
+ # @param self The object pointer
+ # @param Obj for whom attribute is got
+ # @retval None
+ #
+ def _GetFvAttributes(self, FvObj):
+ IsWordToken = False
+ while self._GetNextWord():
+ IsWordToken = True
+ name = self._Token
+ if name not in {"ERASE_POLARITY", "MEMORY_MAPPED", \
+ "STICKY_WRITE", "LOCK_CAP", "LOCK_STATUS", "WRITE_ENABLED_CAP", \
+ "WRITE_DISABLED_CAP", "WRITE_STATUS", "READ_ENABLED_CAP", \
+ "READ_DISABLED_CAP", "READ_STATUS", "READ_LOCK_CAP", \
+ "READ_LOCK_STATUS", "WRITE_LOCK_CAP", "WRITE_LOCK_STATUS", \
+ "WRITE_POLICY_RELIABLE", "WEAK_ALIGNMENT", "FvUsedSizeEnable"}:
+ self._UndoToken()
+ return False
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken() or self._Token.upper() not in {"TRUE", "FALSE", "1", "0"}:
+ raise Warning.Expected("TRUE/FALSE (1/0)", self.FileName, self.CurrentLineNumber)
+
+ FvObj.FvAttributeDict[name] = self._Token
+
+ return IsWordToken
+
+ ## _GetFvNameGuid() method
+ #
+ # Get FV GUID for FV
+ #
+ # @param self The object pointer
+ # @param Obj for whom GUID is got
+ # @retval None
+ #
+ def _GetFvNameGuid(self, FvObj):
+ if not self._IsKeyword("FvNameGuid"):
+ return False
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextGuid():
+ raise Warning.Expected("GUID value", self.FileName, self.CurrentLineNumber)
+ if self._Token in GlobalData.gGuidDict:
+ self._Token = GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upper()
+
+ FvObj.FvNameGuid = self._Token
+
+ return True
+
+ def _GetFvNameString(self, FvObj):
+ if not self._IsKeyword("FvNameString"):
+ return False
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken() or self._Token.upper() not in {'TRUE', 'FALSE'}:
+ raise Warning.Expected("TRUE or FALSE for FvNameString", self.FileName, self.CurrentLineNumber)
+
+ FvObj.FvNameString = self._Token
+
+ return True
+
+ def _GetFvExtEntryStatement(self, FvObj):
+ if not (self._IsKeyword("FV_EXT_ENTRY") or self._IsKeyword("FV_EXT_ENTRY_TYPE")):
+ return False
+
+ if not self._IsKeyword ("TYPE"):
+ raise Warning.Expected("'TYPE'", self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextHexNumber() and not self._GetNextDecimalNumber():
+ raise Warning.Expected("Hex FV extension entry type value At Line ", self.FileName, self.CurrentLineNumber)
+
+ FvObj.FvExtEntryTypeValue.append(self._Token)
+
+ if not self._IsToken("{"):
+ raise Warning.ExpectedCurlyOpen(self.FileName, self.CurrentLineNumber)
+
+ if not self._IsKeyword("FILE") and not self._IsKeyword("DATA"):
+ raise Warning.Expected("'FILE' or 'DATA'", self.FileName, self.CurrentLineNumber)
+
+ FvObj.FvExtEntryType.append(self._Token)
+
+ if self._Token == 'DATA':
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken("{"):
+ raise Warning.ExpectedCurlyOpen(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextHexNumber():
+ raise Warning.Expected("Hex byte", self.FileName, self.CurrentLineNumber)
+
+ if len(self._Token) > 4:
+ raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)
+
+ DataString = self._Token
+ DataString += TAB_COMMA_SPLIT
+
+ while self._IsToken(TAB_COMMA_SPLIT):
+ if not self._GetNextHexNumber():
+ raise Warning("Invalid Hex number", self.FileName, self.CurrentLineNumber)
+ if len(self._Token) > 4:
+ raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)
+ DataString += self._Token
+ DataString += TAB_COMMA_SPLIT
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+
+ DataString = DataString.rstrip(TAB_COMMA_SPLIT)
+ FvObj.FvExtEntryData.append(DataString)
+
+ if self._Token == 'FILE':
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("FV Extension Entry file path At Line ", self.FileName, self.CurrentLineNumber)
+
+ FvObj.FvExtEntryData.append(self._Token)
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+
+ return True
+
+ ## _GetAprioriSection() method
+ #
+ # Get token statements
+ #
+ # @param self The object pointer
+ # @param FvObj for whom apriori is got
+ # @retval True Successfully find apriori statement
+ # @retval False Not able to find apriori statement
+ #
+ def _GetAprioriSection(self, FvObj):
+ if not self._IsKeyword("APRIORI"):
+ return False
+
+ if not self._IsKeyword("PEI") and not self._IsKeyword("DXE"):
+ raise Warning.Expected("Apriori file type", self.FileName, self.CurrentLineNumber)
+ AprType = self._Token
+
+ if not self._IsToken("{"):
+ raise Warning.ExpectedCurlyOpen(self.FileName, self.CurrentLineNumber)
+
+ AprSectionObj = AprioriSection()
+ AprSectionObj.AprioriType = AprType
+
+ self._GetDefineStatements(AprSectionObj)
+
+ while True:
+ IsInf = self._GetInfStatement(AprSectionObj)
+ IsFile = self._GetFileStatement(AprSectionObj)
+ if not IsInf and not IsFile:
+ break
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+
+ FvObj.AprioriSectionList.append(AprSectionObj)
+ return True
+
+ def _ParseInfStatement(self):
+ if not self._IsKeyword("INF"):
+ return None
+
+ ffsInf = FfsInfStatement()
+ self._GetInfOptions(ffsInf)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("INF file path", self.FileName, self.CurrentLineNumber)
+ ffsInf.InfFileName = self._Token
+ if not ffsInf.InfFileName.endswith('.inf'):
+ raise Warning.Expected(".inf file path", self.FileName, self.CurrentLineNumber)
+
+ ffsInf.CurrentLineNum = self.CurrentLineNumber
+ ffsInf.CurrentLineContent = self._CurrentLine()
+
+ #Replace $(SAPCE) with real space
+ ffsInf.InfFileName = ffsInf.InfFileName.replace('$(SPACE)', ' ')
+
+ if ffsInf.InfFileName.replace(TAB_WORKSPACE, '').find('$') == -1:
+ #do case sensitive check for file path
+ ErrorCode, ErrorInfo = PathClass(NormPath(ffsInf.InfFileName), GenFdsGlobalVariable.WorkSpaceDir).Validate()
+ if ErrorCode != 0:
+ EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
+
+ NewFileName = ffsInf.InfFileName
+ if ffsInf.OverrideGuid:
+ NewFileName = ProcessDuplicatedInf(PathClass(ffsInf.InfFileName,GenFdsGlobalVariable.WorkSpaceDir), ffsInf.OverrideGuid, GenFdsGlobalVariable.WorkSpaceDir).Path
+
+ if not NewFileName in self.Profile.InfList:
+ self.Profile.InfList.append(NewFileName)
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ self.Profile.InfFileLineList.append(FileLineTuple)
+ if ffsInf.UseArch:
+ if ffsInf.UseArch not in self.Profile.InfDict:
+ self.Profile.InfDict[ffsInf.UseArch] = [ffsInf.InfFileName]
+ else:
+ self.Profile.InfDict[ffsInf.UseArch].append(ffsInf.InfFileName)
+ else:
+ self.Profile.InfDict['ArchTBD'].append(ffsInf.InfFileName)
+
+ if self._IsToken(TAB_VALUE_SPLIT):
+ if self._IsKeyword('RELOCS_STRIPPED'):
+ ffsInf.KeepReloc = False
+ elif self._IsKeyword('RELOCS_RETAINED'):
+ ffsInf.KeepReloc = True
+ else:
+ raise Warning("Unknown reloc strip flag '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+ return ffsInf
+
+ ## _GetInfStatement() method
+ #
+ # Get INF statements
+ #
+ # @param self The object pointer
+ # @param Obj for whom inf statement is got
+ # @retval True Successfully find inf statement
+ # @retval False Not able to find inf statement
+ #
+ def _GetInfStatement(self, Obj, ForCapsule=False):
+ ffsInf = self._ParseInfStatement()
+ if not ffsInf:
+ return False
+
+ if ForCapsule:
+ myCapsuleFfs = CapsuleFfs()
+ myCapsuleFfs.Ffs = ffsInf
+ Obj.CapsuleDataList.append(myCapsuleFfs)
+ else:
+ Obj.FfsList.append(ffsInf)
+ return True
+
+ ## _GetInfOptions() method
+ #
+ # Get options for INF
+ #
+ # @param self The object pointer
+ # @param FfsInfObj for whom option is got
+ #
+ def _GetInfOptions(self, FfsInfObj):
+ if self._IsKeyword("FILE_GUID"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextGuid():
+ raise Warning.Expected("GUID value", self.FileName, self.CurrentLineNumber)
+ if self._Token in GlobalData.gGuidDict:
+ self._Token = GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upper()
+ FfsInfObj.OverrideGuid = self._Token
+
+ if self._IsKeyword("RuleOverride"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken():
+ raise Warning.Expected("Rule name", self.FileName, self.CurrentLineNumber)
+ FfsInfObj.Rule = self._Token
+
+ if self._IsKeyword("VERSION"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken():
+ raise Warning.Expected("Version", self.FileName, self.CurrentLineNumber)
+
+ if self._GetStringData():
+ FfsInfObj.Version = self._Token
+
+ if self._IsKeyword(BINARY_FILE_TYPE_UI):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken():
+ raise Warning.Expected("UI name", self.FileName, self.CurrentLineNumber)
+
+ if self._GetStringData():
+ FfsInfObj.Ui = self._Token
+
+ if self._IsKeyword("USE"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken():
+ raise Warning.Expected("ARCH name", self.FileName, self.CurrentLineNumber)
+ FfsInfObj.UseArch = self._Token
+
+
+ if self._GetNextToken():
+ p = compile(r'([a-zA-Z0-9\-]+|\$\(TARGET\)|\*)_([a-zA-Z0-9\-]+|\$\(TOOL_CHAIN_TAG\)|\*)_([a-zA-Z0-9\-]+|\$\(ARCH\))')
+ if p.match(self._Token) and p.match(self._Token).span()[1] == len(self._Token):
+ FfsInfObj.KeyStringList.append(self._Token)
+ if not self._IsToken(TAB_COMMA_SPLIT):
+ return
+ else:
+ self._UndoToken()
+ return
+
+ while self._GetNextToken():
+ if not p.match(self._Token):
+ raise Warning.Expected("KeyString \"Target_Tag_Arch\"", self.FileName, self.CurrentLineNumber)
+ FfsInfObj.KeyStringList.append(self._Token)
+
+ if not self._IsToken(TAB_COMMA_SPLIT):
+ break
+
+ ## _GetFileStatement() method
+ #
+ # Get FILE statements
+ #
+ # @param self The object pointer
+ # @param Obj for whom FILE statement is got
+ # @retval True Successfully find FILE statement
+ # @retval False Not able to find FILE statement
+ #
+ def _GetFileStatement(self, Obj, ForCapsule = False):
+ if not self._IsKeyword("FILE"):
+ return False
+
+ if not self._GetNextWord():
+ raise Warning.Expected("FFS type", self.FileName, self.CurrentLineNumber)
+
+ if ForCapsule and self._Token == 'DATA':
+ self._UndoToken()
+ self._UndoToken()
+ return False
+
+ FfsFileObj = FileStatement()
+ FfsFileObj.FvFileType = self._Token
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextGuid():
+ if not self._GetNextWord():
+ raise Warning.Expected("File GUID", self.FileName, self.CurrentLineNumber)
+ if self._Token == 'PCD':
+ if not self._IsToken("("):
+ raise Warning.Expected("'('", self.FileName, self.CurrentLineNumber)
+ PcdPair = self._GetNextPcdSettings()
+ if not self._IsToken(")"):
+ raise Warning.Expected("')'", self.FileName, self.CurrentLineNumber)
+ self._Token = 'PCD('+PcdPair[1]+TAB_SPLIT+PcdPair[0]+')'
+
+ if self._Token in GlobalData.gGuidDict:
+ self._Token = GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upper()
+ FfsFileObj.NameGuid = self._Token
+
+ self._GetFilePart(FfsFileObj)
+
+ if ForCapsule:
+ capsuleFfs = CapsuleFfs()
+ capsuleFfs.Ffs = FfsFileObj
+ Obj.CapsuleDataList.append(capsuleFfs)
+ else:
+ Obj.FfsList.append(FfsFileObj)
+
+ return True
+
+ ## _FileCouldHaveRelocFlag() method
+ #
+ # Check whether reloc strip flag can be set for a file type.
+ #
+ # @param FileType The file type to check with
+ # @retval True This type could have relocation strip flag
+ # @retval False No way to have it
+ #
+ @staticmethod
+ def _FileCouldHaveRelocFlag (FileType):
+ if FileType in {SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_MM_CORE_STANDALONE, 'PEI_DXE_COMBO'}:
+ return True
+ else:
+ return False
+
+ ## _SectionCouldHaveRelocFlag() method
+ #
+ # Check whether reloc strip flag can be set for a section type.
+ #
+ # @param SectionType The section type to check with
+ # @retval True This type could have relocation strip flag
+ # @retval False No way to have it
+ #
+ @staticmethod
+ def _SectionCouldHaveRelocFlag (SectionType):
+ if SectionType in {BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32}:
+ return True
+ else:
+ return False
+
+ ## _GetFilePart() method
+ #
+ # Get components for FILE statement
+ #
+ # @param self The object pointer
+ # @param FfsFileObj for whom component is got
+ #
+ def _GetFilePart(self, FfsFileObj):
+ self._GetFileOpts(FfsFileObj)
+
+ if not self._IsToken("{"):
+ if self._IsKeyword('RELOCS_STRIPPED') or self._IsKeyword('RELOCS_RETAINED'):
+ if self._FileCouldHaveRelocFlag(FfsFileObj.FvFileType):
+ if self._Token == 'RELOCS_STRIPPED':
+ FfsFileObj.KeepReloc = False
+ else:
+ FfsFileObj.KeepReloc = True
+ else:
+ raise Warning("File type %s could not have reloc strip flag%d" % (FfsFileObj.FvFileType, self.CurrentLineNumber), self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken("{"):
+ raise Warning.ExpectedCurlyOpen(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("File name or section data", self.FileName, self.CurrentLineNumber)
+
+ if self._Token == BINARY_FILE_TYPE_FV:
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken():
+ raise Warning.Expected("FV name", self.FileName, self.CurrentLineNumber)
+ FfsFileObj.FvName = self._Token
+
+ elif self._Token == "FD":
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken():
+ raise Warning.Expected("FD name", self.FileName, self.CurrentLineNumber)
+ FfsFileObj.FdName = self._Token
+
+ elif self._Token in {TAB_DEFINE, "APRIORI", "SECTION"}:
+ self._UndoToken()
+ self._GetSectionData(FfsFileObj)
+
+ elif hasattr(FfsFileObj, 'FvFileType') and FfsFileObj.FvFileType == 'RAW':
+ self._UndoToken()
+ self._GetRAWData(FfsFileObj)
+
+ else:
+ FfsFileObj.CurrentLineNum = self.CurrentLineNumber
+ FfsFileObj.CurrentLineContent = self._CurrentLine()
+ FfsFileObj.FileName = self._Token.replace('$(SPACE)', ' ')
+ self._VerifyFile(FfsFileObj.FileName)
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+
+ ## _GetRAWData() method
+ #
+ # Get RAW data for FILE statement
+ #
+ # @param self The object pointer
+ # @param FfsFileObj for whom section is got
+ #
+ def _GetRAWData(self, FfsFileObj):
+ FfsFileObj.FileName = []
+ FfsFileObj.SubAlignment = []
+ while True:
+ AlignValue = None
+ if self._GetAlignment():
+ if self._Token not in ALIGNMENTS:
+ raise Warning("Incorrect alignment '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+ #For FFS, Auto is default option same to ""
+ if not self._Token == "Auto":
+ AlignValue = self._Token
+ if not self._GetNextToken():
+ raise Warning.Expected("Filename value", self.FileName, self.CurrentLineNumber)
+
+ FileName = self._Token.replace('$(SPACE)', ' ')
+ if FileName == T_CHAR_BRACE_R:
+ self._UndoToken()
+ raise Warning.Expected("Filename value", self.FileName, self.CurrentLineNumber)
+
+ self._VerifyFile(FileName)
+ File = PathClass(NormPath(FileName), GenFdsGlobalVariable.WorkSpaceDir)
+ FfsFileObj.FileName.append(File.Path)
+ FfsFileObj.SubAlignment.append(AlignValue)
+
+ if self._IsToken(T_CHAR_BRACE_R):
+ self._UndoToken()
+ break
+
+ if len(FfsFileObj.SubAlignment) == 1:
+ FfsFileObj.SubAlignment = FfsFileObj.SubAlignment[0]
+ if len(FfsFileObj.FileName) == 1:
+ FfsFileObj.FileName = FfsFileObj.FileName[0]
+
+ ## _GetFileOpts() method
+ #
+ # Get options for FILE statement
+ #
+ # @param self The object pointer
+ # @param FfsFileObj for whom options is got
+ #
+ def _GetFileOpts(self, FfsFileObj):
+ if self._GetNextToken():
+ if TokenFindPattern.match(self._Token):
+ FfsFileObj.KeyStringList.append(self._Token)
+ if self._IsToken(TAB_COMMA_SPLIT):
+ while self._GetNextToken():
+ if not TokenFindPattern.match(self._Token):
+ raise Warning.Expected("KeyString \"Target_Tag_Arch\"", self.FileName, self.CurrentLineNumber)
+ FfsFileObj.KeyStringList.append(self._Token)
+
+ if not self._IsToken(TAB_COMMA_SPLIT):
+ break
+
+ else:
+ self._UndoToken()
+
+ if self._IsKeyword("FIXED", True):
+ FfsFileObj.Fixed = True
+
+ if self._IsKeyword("CHECKSUM", True):
+ FfsFileObj.CheckSum = True
+
+ if self._GetAlignment():
+ if self._Token not in ALIGNMENTS:
+ raise Warning("Incorrect alignment '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+ #For FFS, Auto is default option same to ""
+ if not self._Token == "Auto":
+ FfsFileObj.Alignment = self._Token
+
+ ## _GetAlignment() method
+ #
+ # Return the alignment value
+ #
+ # @param self The object pointer
+ # @retval True Successfully find alignment
+ # @retval False Not able to find alignment
+ #
+ def _GetAlignment(self):
+ if self._IsKeyword("Align", True):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("alignment value", self.FileName, self.CurrentLineNumber)
+ return True
+
+ return False
+
+ ## _GetSectionData() method
+ #
+ # Get section data for FILE statement
+ #
+ # @param self The object pointer
+ # @param FfsFileObj for whom section is got
+ #
+ def _GetSectionData(self, FfsFileObj):
+ self._GetDefineStatements(FfsFileObj)
+
+ while True:
+ IsLeafSection = self._GetLeafSection(FfsFileObj)
+ IsEncapSection = self._GetEncapsulationSec(FfsFileObj)
+ if not IsLeafSection and not IsEncapSection:
+ break
+
+ ## _GetLeafSection() method
+ #
+ # Get leaf section for Obj
+ #
+ # @param self The object pointer
+ # @param Obj for whom leaf section is got
+ # @retval True Successfully find section statement
+ # @retval False Not able to find section statement
+ #
+ def _GetLeafSection(self, Obj):
+ OldPos = self.GetFileBufferPos()
+
+ if not self._IsKeyword("SECTION"):
+ if len(Obj.SectionList) == 0:
+ raise Warning.Expected("SECTION", self.FileName, self.CurrentLineNumber)
+ else:
+ return False
+
+ AlignValue = None
+ if self._GetAlignment():
+ if self._Token not in ALIGNMENTS:
+ raise Warning("Incorrect alignment '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+ AlignValue = self._Token
+
+ BuildNum = None
+ if self._IsKeyword("BUILD_NUM"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("Build number value", self.FileName, self.CurrentLineNumber)
+
+ BuildNum = self._Token
+
+ if self._IsKeyword("VERSION"):
+ if AlignValue == 'Auto':
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken():
+ raise Warning.Expected("version", self.FileName, self.CurrentLineNumber)
+ VerSectionObj = VerSection()
+ VerSectionObj.Alignment = AlignValue
+ VerSectionObj.BuildNum = BuildNum
+ if self._GetStringData():
+ VerSectionObj.StringData = self._Token
+ else:
+ VerSectionObj.FileName = self._Token
+ Obj.SectionList.append(VerSectionObj)
+
+ elif self._IsKeyword(BINARY_FILE_TYPE_UI):
+ if AlignValue == 'Auto':
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken():
+ raise Warning.Expected("UI", self.FileName, self.CurrentLineNumber)
+ UiSectionObj = UiSection()
+ UiSectionObj.Alignment = AlignValue
+ if self._GetStringData():
+ UiSectionObj.StringData = self._Token
+ else:
+ UiSectionObj.FileName = self._Token
+ Obj.SectionList.append(UiSectionObj)
+
+ elif self._IsKeyword("FV_IMAGE"):
+ if AlignValue == 'Auto':
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken():
+ raise Warning.Expected("FV name or FV file path", self.FileName, self.CurrentLineNumber)
+
+ FvName = self._Token
+ FvObj = None
+
+ if self._IsToken("{"):
+ FvObj = FV()
+ FvObj.UiFvName = FvName.upper()
+ self._GetDefineStatements(FvObj)
+
+ self._GetBlockStatement(FvObj)
+ self._GetSetStatements(FvObj)
+ self._GetFvAlignment(FvObj)
+ self._GetFvAttributes(FvObj)
+
+ while True:
+ IsInf = self._GetInfStatement(FvObj)
+ IsFile = self._GetFileStatement(FvObj)
+ if not IsInf and not IsFile:
+ break
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+
+ FvImageSectionObj = FvImageSection()
+ FvImageSectionObj.Alignment = AlignValue
+ if FvObj is not None:
+ FvImageSectionObj.Fv = FvObj
+ FvImageSectionObj.FvName = None
+ else:
+ FvImageSectionObj.FvName = FvName.upper()
+ FvImageSectionObj.FvFileName = FvName
+
+ Obj.SectionList.append(FvImageSectionObj)
+
+ elif self._IsKeyword("PEI_DEPEX_EXP") or self._IsKeyword("DXE_DEPEX_EXP") or self._IsKeyword("SMM_DEPEX_EXP"):
+ if AlignValue == 'Auto':
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
+ DepexSectionObj = DepexSection()
+ DepexSectionObj.Alignment = AlignValue
+ DepexSectionObj.DepexType = self._Token
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._IsToken("{"):
+ raise Warning.ExpectedCurlyOpen(self.FileName, self.CurrentLineNumber)
+ if not self._SkipToToken(T_CHAR_BRACE_R):
+ raise Warning.Expected("Depex expression ending '}'", self.FileName, self.CurrentLineNumber)
+
+ DepexSectionObj.Expression = self._SkippedChars.rstrip(T_CHAR_BRACE_R)
+ Obj.SectionList.append(DepexSectionObj)
+
+ else:
+ if not self._GetNextWord():
+ raise Warning.Expected("section type", self.FileName, self.CurrentLineNumber)
+
+ # Encapsulation section appear, UndoToken and return
+ if self._Token == "COMPRESS" or self._Token == "GUIDED":
+ self.SetFileBufferPos(OldPos)
+ return False
+
+ if self._Token not in {"COMPAT16", BINARY_FILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\
+ BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, "SUBTYPE_GUID", BINARY_FILE_TYPE_SMM_DEPEX}:
+ raise Warning("Unknown section type '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+ if AlignValue == 'Auto'and (not self._Token == BINARY_FILE_TYPE_PE32) and (not self._Token == BINARY_FILE_TYPE_TE):
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
+
+ # DataSection
+ DataSectionObj = DataSection()
+ DataSectionObj.Alignment = AlignValue
+ DataSectionObj.SecType = self._Token
+
+ if self._IsKeyword('RELOCS_STRIPPED') or self._IsKeyword('RELOCS_RETAINED'):
+ if self._FileCouldHaveRelocFlag(Obj.FvFileType) and self._SectionCouldHaveRelocFlag(DataSectionObj.SecType):
+ if self._Token == 'RELOCS_STRIPPED':
+ DataSectionObj.KeepReloc = False
+ else:
+ DataSectionObj.KeepReloc = True
+ else:
+ raise Warning("File type %s, section type %s, could not have reloc strip flag%d" % (Obj.FvFileType, DataSectionObj.SecType, self.CurrentLineNumber), self.FileName, self.CurrentLineNumber)
+
+ if self._IsToken(TAB_EQUAL_SPLIT):
+ if not self._GetNextToken():
+ raise Warning.Expected("section file path", self.FileName, self.CurrentLineNumber)
+ DataSectionObj.SectFileName = self._Token
+ self._VerifyFile(DataSectionObj.SectFileName)
+ else:
+ if not self._GetCglSection(DataSectionObj):
+ return False
+
+ Obj.SectionList.append(DataSectionObj)
+
+ return True
+
+ ## _VerifyFile
+ #
+ # Check if file exists or not:
+ # If current phase if GenFds, the file must exist;
+ # If current phase is AutoGen and the file is not in $(OUTPUT_DIRECTORY), the file must exist
+ # @param FileName: File path to be verified.
+ #
+ def _VerifyFile(self, FileName):
+ if FileName.replace(TAB_WORKSPACE, '').find('$') != -1:
+ return
+ if not GlobalData.gAutoGenPhase or not self._GetMacroValue(TAB_DSC_DEFINES_OUTPUT_DIRECTORY) in FileName:
+ ErrorCode, ErrorInfo = PathClass(NormPath(FileName), GenFdsGlobalVariable.WorkSpaceDir).Validate()
+ if ErrorCode != 0:
+ EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
+
+ ## _GetCglSection() method
+ #
+ # Get compressed or GUIDed section for Obj
+ #
+ # @param self The object pointer
+ # @param Obj for whom leaf section is got
+ # @param AlignValue alignment value for complex section
+ # @retval True Successfully find section statement
+ # @retval False Not able to find section statement
+ #
+ def _GetCglSection(self, Obj, AlignValue = None):
+
+ if self._IsKeyword("COMPRESS"):
+ type = "PI_STD"
+ if self._IsKeyword("PI_STD") or self._IsKeyword("PI_NONE"):
+ type = self._Token
+
+ if not self._IsToken("{"):
+ raise Warning.ExpectedCurlyOpen(self.FileName, self.CurrentLineNumber)
+
+ CompressSectionObj = CompressSection()
+ CompressSectionObj.Alignment = AlignValue
+ CompressSectionObj.CompType = type
+ # Recursive sections...
+ while True:
+ IsLeafSection = self._GetLeafSection(CompressSectionObj)
+ IsEncapSection = self._GetEncapsulationSec(CompressSectionObj)
+ if not IsLeafSection and not IsEncapSection:
+ break
+
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+ Obj.SectionList.append(CompressSectionObj)
+ return True
+
+ elif self._IsKeyword("GUIDED"):
+ GuidValue = None
+ if self._GetNextGuid():
+ if self._Token in GlobalData.gGuidDict:
+ self._Token = GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upper()
+ GuidValue = self._Token
+
+ AttribDict = self._GetGuidAttrib()
+ if not self._IsToken("{"):
+ raise Warning.ExpectedCurlyOpen(self.FileName, self.CurrentLineNumber)
+ GuidSectionObj = GuidSection()
+ GuidSectionObj.Alignment = AlignValue
+ GuidSectionObj.NameGuid = GuidValue
+ GuidSectionObj.SectionType = "GUIDED"
+ GuidSectionObj.ProcessRequired = AttribDict["PROCESSING_REQUIRED"]
+ GuidSectionObj.AuthStatusValid = AttribDict["AUTH_STATUS_VALID"]
+ GuidSectionObj.ExtraHeaderSize = AttribDict["EXTRA_HEADER_SIZE"]
+ # Recursive sections...
+ while True:
+ IsLeafSection = self._GetLeafSection(GuidSectionObj)
+ IsEncapSection = self._GetEncapsulationSec(GuidSectionObj)
+ if not IsLeafSection and not IsEncapSection:
+ break
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+ Obj.SectionList.append(GuidSectionObj)
+
+ return True
+
+ return False
+
+ ## _GetGuidAttri() method
+ #
+ # Get attributes for GUID section
+ #
+ # @param self The object pointer
+ # @retval AttribDict Dictionary of key-value pair of section attributes
+ #
+ def _GetGuidAttrib(self):
+ AttribDict = {}
+ AttribDict["PROCESSING_REQUIRED"] = "NONE"
+ AttribDict["AUTH_STATUS_VALID"] = "NONE"
+ AttribDict["EXTRA_HEADER_SIZE"] = -1
+ while self._IsKeyword("PROCESSING_REQUIRED") or self._IsKeyword("AUTH_STATUS_VALID") \
+ or self._IsKeyword("EXTRA_HEADER_SIZE"):
+ AttribKey = self._Token
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("TRUE(1)/FALSE(0)/Number", self.FileName, self.CurrentLineNumber)
+ elif AttribKey == "EXTRA_HEADER_SIZE":
+ Base = 10
+ if self._Token[0:2].upper() == "0X":
+ Base = 16
+ try:
+ AttribDict[AttribKey] = int(self._Token, Base)
+ continue
+ except ValueError:
+ raise Warning.Expected("Number", self.FileName, self.CurrentLineNumber)
+ elif self._Token.upper() not in {"TRUE", "FALSE", "1", "0"}:
+ raise Warning.Expected("TRUE/FALSE (1/0)", self.FileName, self.CurrentLineNumber)
+ AttribDict[AttribKey] = self._Token
+
+ return AttribDict
+
+ ## _GetEncapsulationSec() method
+ #
+ # Get encapsulation section for FILE
+ #
+ # @param self The object pointer
+ # @param FfsFile for whom section is got
+ # @retval True Successfully find section statement
+ # @retval False Not able to find section statement
+ #
+ def _GetEncapsulationSec(self, FfsFileObj):
+ OldPos = self.GetFileBufferPos()
+ if not self._IsKeyword("SECTION"):
+ if len(FfsFileObj.SectionList) == 0:
+ raise Warning.Expected("SECTION", self.FileName, self.CurrentLineNumber)
+ else:
+ return False
+
+ AlignValue = None
+ if self._GetAlignment():
+ if self._Token not in ALIGNMENT_NOAUTO:
+ raise Warning("Incorrect alignment '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+ AlignValue = self._Token
+
+ if not self._GetCglSection(FfsFileObj, AlignValue):
+ self.SetFileBufferPos(OldPos)
+ return False
+ else:
+ return True
+
+ def _GetFmp(self):
+ if not self._GetNextToken():
+ return False
+ S = self._Token.upper()
+ if S.startswith(TAB_SECTION_START) and not S.startswith("[FMPPAYLOAD."):
+ self.SectionParser(S)
+ self._UndoToken()
+ return False
+
+ self._UndoToken()
+ self._SkipToToken("[FMPPAYLOAD.", True)
+ FmpUiName = self._GetUiName().upper()
+ if FmpUiName in self.Profile.FmpPayloadDict:
+ raise Warning("Duplicated FMP UI name found: %s" % FmpUiName, self.FileName, self.CurrentLineNumber)
+
+ FmpData = CapsulePayload()
+ FmpData.UiName = FmpUiName
+
+ if not self._IsToken(TAB_SECTION_END):
+ raise Warning.ExpectedBracketClose(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning("The FMP payload section is empty!", self.FileName, self.CurrentLineNumber)
+ FmpKeyList = ['IMAGE_HEADER_INIT_VERSION', 'IMAGE_TYPE_ID', 'IMAGE_INDEX', 'HARDWARE_INSTANCE', 'CERTIFICATE_GUID', 'MONOTONIC_COUNT']
+ while self._Token in FmpKeyList:
+ Name = self._Token
+ FmpKeyList.remove(Name)
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if Name == 'IMAGE_TYPE_ID':
+ if not self._GetNextGuid():
+ raise Warning.Expected("GUID value for IMAGE_TYPE_ID.", self.FileName, self.CurrentLineNumber)
+ FmpData.ImageTypeId = self._Token
+ elif Name == 'CERTIFICATE_GUID':
+ if not self._GetNextGuid():
+ raise Warning.Expected("GUID value for CERTIFICATE_GUID.", self.FileName, self.CurrentLineNumber)
+ FmpData.Certificate_Guid = self._Token
+ if UUID(FmpData.Certificate_Guid) != EFI_CERT_TYPE_RSA2048_SHA256_GUID and UUID(FmpData.Certificate_Guid) != EFI_CERT_TYPE_PKCS7_GUID:
+ raise Warning("Only support EFI_CERT_TYPE_RSA2048_SHA256_GUID or EFI_CERT_TYPE_PKCS7_GUID for CERTIFICATE_GUID.", self.FileName, self.CurrentLineNumber)
+ else:
+ if not self._GetNextToken():
+ raise Warning.Expected("value of %s" % Name, self.FileName, self.CurrentLineNumber)
+ Value = self._Token
+ if Name == 'IMAGE_HEADER_INIT_VERSION':
+ if FdfParser._Verify(Name, Value, 'UINT8'):
+ FmpData.Version = Value
+ elif Name == 'IMAGE_INDEX':
+ if FdfParser._Verify(Name, Value, 'UINT8'):
+ FmpData.ImageIndex = Value
+ elif Name == 'HARDWARE_INSTANCE':
+ if FdfParser._Verify(Name, Value, 'UINT8'):
+ FmpData.HardwareInstance = Value
+ elif Name == 'MONOTONIC_COUNT':
+ if FdfParser._Verify(Name, Value, 'UINT64'):
+ FmpData.MonotonicCount = Value
+ if FmpData.MonotonicCount.upper().startswith('0X'):
+ FmpData.MonotonicCount = int(FmpData.MonotonicCount, 16)
+ else:
+ FmpData.MonotonicCount = int(FmpData.MonotonicCount)
+ if not self._GetNextToken():
+ break
+ else:
+ self._UndoToken()
+
+ if (FmpData.MonotonicCount and not FmpData.Certificate_Guid) or (not FmpData.MonotonicCount and FmpData.Certificate_Guid):
+ EdkLogger.error("FdfParser", FORMAT_INVALID, "CERTIFICATE_GUID and MONOTONIC_COUNT must be work as a pair.")
+
+ # Only the IMAGE_TYPE_ID is required item
+ if FmpKeyList and 'IMAGE_TYPE_ID' in FmpKeyList:
+ raise Warning("'IMAGE_TYPE_ID' in FMP payload section.", self.FileName, self.CurrentLineNumber)
+ # get the Image file and Vendor code file
+ self._GetFMPCapsuleData(FmpData)
+ if not FmpData.ImageFile:
+ raise Warning("Missing image file in FMP payload section.", self.FileName, self.CurrentLineNumber)
+ # check whether more than one Vendor code file
+ if len(FmpData.VendorCodeFile) > 1:
+ raise Warning("Vendor code file max of 1 per FMP payload section.", self.FileName, self.CurrentLineNumber)
+ self.Profile.FmpPayloadDict[FmpUiName] = FmpData
+ return True
+
+ ## _GetCapsule() method
+ #
+ # Get capsule section contents and store its data into capsule list of self.Profile
+ #
+ # @param self The object pointer
+ # @retval True Successfully find a capsule
+ # @retval False Not able to find a capsule
+ #
+ def _GetCapsule(self):
+ if not self._GetNextToken():
+ return False
+
+ S = self._Token.upper()
+ if S.startswith(TAB_SECTION_START) and not S.startswith("[CAPSULE."):
+ self.SectionParser(S)
+ self._UndoToken()
+ return False
+
+ self._UndoToken()
+ if not self._IsToken("[CAPSULE.", True):
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ #print 'Parsing String: %s in File %s, At line: %d, Offset Within Line: %d' \
+ # % (self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], FileLineTuple[1], self.CurrentOffsetWithinLine)
+ raise Warning.Expected("[Capsule.]", self.FileName, self.CurrentLineNumber)
+
+ CapsuleObj = Capsule()
+
+ CapsuleName = self._GetUiName()
+ if not CapsuleName:
+ raise Warning.Expected("capsule name", self.FileName, self.CurrentLineNumber)
+
+ CapsuleObj.UiCapsuleName = CapsuleName.upper()
+
+ if not self._IsToken(TAB_SECTION_END):
+ raise Warning.ExpectedBracketClose(self.FileName, self.CurrentLineNumber)
+
+ if self._IsKeyword("CREATE_FILE"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("file name", self.FileName, self.CurrentLineNumber)
+
+ CapsuleObj.CreateFile = self._Token
+
+ self._GetCapsuleStatements(CapsuleObj)
+ self.Profile.CapsuleDict[CapsuleObj.UiCapsuleName] = CapsuleObj
+ return True
+
+ ## _GetCapsuleStatements() method
+ #
+ # Get statements for capsule
+ #
+ # @param self The object pointer
+ # @param Obj for whom statements are got
+ #
+ def _GetCapsuleStatements(self, Obj):
+ self._GetCapsuleTokens(Obj)
+ self._GetDefineStatements(Obj)
+ self._GetSetStatements(Obj)
+ self._GetCapsuleData(Obj)
+
+ ## _GetCapsuleTokens() method
+ #
+ # Get token statements for capsule
+ #
+ # @param self The object pointer
+ # @param Obj for whom token statements are got
+ #
+ def _GetCapsuleTokens(self, Obj):
+ if not self._GetNextToken():
+ return False
+ while self._Token in {"CAPSULE_GUID", "CAPSULE_HEADER_SIZE", "CAPSULE_FLAGS", "OEM_CAPSULE_FLAGS", "CAPSULE_HEADER_INIT_VERSION"}:
+ Name = self._Token.strip()
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken():
+ raise Warning.Expected("value", self.FileName, self.CurrentLineNumber)
+ if Name == 'CAPSULE_FLAGS':
+ if not self._Token in {"PersistAcrossReset", "PopulateSystemTable", "InitiateReset"}:
+ raise Warning.Expected("PersistAcrossReset, PopulateSystemTable, or InitiateReset", self.FileName, self.CurrentLineNumber)
+ Value = self._Token.strip()
+ while self._IsToken(TAB_COMMA_SPLIT):
+ Value += TAB_COMMA_SPLIT
+ if not self._GetNextToken():
+ raise Warning.Expected("value", self.FileName, self.CurrentLineNumber)
+ if not self._Token in {"PersistAcrossReset", "PopulateSystemTable", "InitiateReset"}:
+ raise Warning.Expected("PersistAcrossReset, PopulateSystemTable, or InitiateReset", self.FileName, self.CurrentLineNumber)
+ Value += self._Token.strip()
+ elif Name == 'OEM_CAPSULE_FLAGS':
+ Value = self._Token.strip()
+ if not Value.upper().startswith('0X'):
+ raise Warning.Expected("hex value starting with 0x", self.FileName, self.CurrentLineNumber)
+ try:
+ Value = int(Value, 0)
+ except ValueError:
+ raise Warning.Expected("hex string failed to convert to value", self.FileName, self.CurrentLineNumber)
+ if not 0x0000 <= Value <= 0xFFFF:
+ raise Warning.Expected("hex value between 0x0000 and 0xFFFF", self.FileName, self.CurrentLineNumber)
+ Value = self._Token.strip()
+ else:
+ Value = self._Token.strip()
+ Obj.TokensDict[Name] = Value
+ if not self._GetNextToken():
+ return False
+ self._UndoToken()
+
+ ## _GetCapsuleData() method
+ #
+ # Get capsule data for capsule
+ #
+ # @param self The object pointer
+ # @param Obj for whom capsule data are got
+ #
+ def _GetCapsuleData(self, Obj):
+ while True:
+ IsInf = self._GetInfStatement(Obj, True)
+ IsFile = self._GetFileStatement(Obj, True)
+ IsFv = self._GetFvStatement(Obj)
+ IsFd = self._GetFdStatement(Obj)
+ IsAnyFile = self._GetAnyFileStatement(Obj)
+ IsAfile = self._GetAfileStatement(Obj)
+ IsFmp = self._GetFmpStatement(Obj)
+ if not (IsInf or IsFile or IsFv or IsFd or IsAnyFile or IsAfile or IsFmp):
+ break
+
+ ## _GetFMPCapsuleData() method
+ #
+ # Get capsule data for FMP capsule
+ #
+ # @param self The object pointer
+ # @param Obj for whom capsule data are got
+ #
+ def _GetFMPCapsuleData(self, Obj):
+ while True:
+ IsFv = self._GetFvStatement(Obj, True)
+ IsFd = self._GetFdStatement(Obj, True)
+ IsAnyFile = self._GetAnyFileStatement(Obj, True)
+ if not (IsFv or IsFd or IsAnyFile):
+ break
+
+ ## _GetFvStatement() method
+ #
+ # Get FV for capsule
+ #
+ # @param self The object pointer
+ # @param CapsuleObj for whom FV is got
+ # @retval True Successfully find a FV statement
+ # @retval False Not able to find a FV statement
+ #
+ def _GetFvStatement(self, CapsuleObj, FMPCapsule = False):
+ if not self._IsKeyword(BINARY_FILE_TYPE_FV):
+ return False
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("FV name", self.FileName, self.CurrentLineNumber)
+
+ if self._Token.upper() not in self.Profile.FvDict:
+ raise Warning("FV name does not exist", self.FileName, self.CurrentLineNumber)
+
+ myCapsuleFv = CapsuleFv()
+ myCapsuleFv.FvName = self._Token
+ if FMPCapsule:
+ if not CapsuleObj.ImageFile:
+ CapsuleObj.ImageFile.append(myCapsuleFv)
+ else:
+ CapsuleObj.VendorCodeFile.append(myCapsuleFv)
+ else:
+ CapsuleObj.CapsuleDataList.append(myCapsuleFv)
+ return True
+
+ ## _GetFdStatement() method
+ #
+ # Get FD for capsule
+ #
+ # @param self The object pointer
+ # @param CapsuleObj for whom FD is got
+ # @retval True Successfully find a FD statement
+ # @retval False Not able to find a FD statement
+ #
+ def _GetFdStatement(self, CapsuleObj, FMPCapsule = False):
+ if not self._IsKeyword("FD"):
+ return False
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("FD name", self.FileName, self.CurrentLineNumber)
+
+ if self._Token.upper() not in self.Profile.FdDict:
+ raise Warning("FD name does not exist", self.FileName, self.CurrentLineNumber)
+
+ myCapsuleFd = CapsuleFd()
+ myCapsuleFd.FdName = self._Token
+ if FMPCapsule:
+ if not CapsuleObj.ImageFile:
+ CapsuleObj.ImageFile.append(myCapsuleFd)
+ else:
+ CapsuleObj.VendorCodeFile.append(myCapsuleFd)
+ else:
+ CapsuleObj.CapsuleDataList.append(myCapsuleFd)
+ return True
+
+ def _GetFmpStatement(self, CapsuleObj):
+ if not self._IsKeyword("FMP_PAYLOAD"):
+ if not self._IsKeyword("FMP"):
+ return False
+
+ if not self._IsKeyword("PAYLOAD"):
+ self._UndoToken()
+ return False
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("payload name after FMP_PAYLOAD =", self.FileName, self.CurrentLineNumber)
+ Payload = self._Token.upper()
+ if Payload not in self.Profile.FmpPayloadDict:
+ raise Warning("This FMP Payload does not exist: %s" % self._Token, self.FileName, self.CurrentLineNumber)
+ CapsuleObj.FmpPayloadList.append(self.Profile.FmpPayloadDict[Payload])
+ return True
+
+ def _ParseRawFileStatement(self):
+ if not self._IsKeyword("FILE"):
+ return None
+
+ if not self._IsKeyword("DATA"):
+ self._UndoToken()
+ return None
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("File name", self.FileName, self.CurrentLineNumber)
+
+ AnyFileName = self._Token
+ self._VerifyFile(AnyFileName)
+
+ if not os.path.isabs(AnyFileName):
+ AnyFileName = mws.join(GenFdsGlobalVariable.WorkSpaceDir, AnyFileName)
+
+ return AnyFileName
+
+ ## _GetAnyFileStatement() method
+ #
+ # Get AnyFile for capsule
+ #
+ # @param self The object pointer
+ # @param CapsuleObj for whom AnyFile is got
+ # @retval True Successfully find a Anyfile statement
+ # @retval False Not able to find a AnyFile statement
+ #
+ def _GetAnyFileStatement(self, CapsuleObj, FMPCapsule = False):
+ AnyFileName = self._ParseRawFileStatement()
+ if not AnyFileName:
+ return False
+
+ myCapsuleAnyFile = CapsuleAnyFile()
+ myCapsuleAnyFile.FileName = AnyFileName
+ if FMPCapsule:
+ if not CapsuleObj.ImageFile:
+ CapsuleObj.ImageFile.append(myCapsuleAnyFile)
+ else:
+ CapsuleObj.VendorCodeFile.append(myCapsuleAnyFile)
+ else:
+ CapsuleObj.CapsuleDataList.append(myCapsuleAnyFile)
+ return True
+
+ ## _GetAfileStatement() method
+ #
+ # Get Afile for capsule
+ #
+ # @param self The object pointer
+ # @param CapsuleObj for whom Afile is got
+ # @retval True Successfully find a Afile statement
+ # @retval False Not able to find a Afile statement
+ #
+ def _GetAfileStatement(self, CapsuleObj):
+ if not self._IsKeyword("APPEND"):
+ return False
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("Afile name", self.FileName, self.CurrentLineNumber)
+
+ AfileName = self._Token
+ AfileBaseName = os.path.basename(AfileName)
+
+ if os.path.splitext(AfileBaseName)[1] not in {".bin", ".BIN", ".Bin", ".dat", ".DAT", ".Dat", ".data", ".DATA", ".Data"}:
+ raise Warning('invalid binary file type, should be one of "bin",BINARY_FILE_TYPE_BIN,"Bin","dat","DAT","Dat","data","DATA","Data"', \
+ self.FileName, self.CurrentLineNumber)
+
+ if not os.path.isabs(AfileName):
+ AfileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(AfileName)
+ self._VerifyFile(AfileName)
+ else:
+ if not os.path.exists(AfileName):
+ raise Warning('%s does not exist' % AfileName, self.FileName, self.CurrentLineNumber)
+ else:
+ pass
+
+ myCapsuleAfile = CapsuleAfile()
+ myCapsuleAfile.FileName = AfileName
+ CapsuleObj.CapsuleDataList.append(myCapsuleAfile)
+ return True
+
+ ## _GetRule() method
+ #
+ # Get Rule section contents and store its data into rule list of self.Profile
+ #
+ # @param self The object pointer
+ # @retval True Successfully find a Rule
+ # @retval False Not able to find a Rule
+ #
+ def _GetRule(self):
+ if not self._GetNextToken():
+ return False
+
+ S = self._Token.upper()
+ if S.startswith(TAB_SECTION_START) and not S.startswith("[RULE."):
+ self.SectionParser(S)
+ self._UndoToken()
+ return False
+ self._UndoToken()
+ if not self._IsToken("[Rule.", True):
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ #print 'Parsing String: %s in File %s, At line: %d, Offset Within Line: %d' \
+ # % (self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], FileLineTuple[1], self.CurrentOffsetWithinLine)
+ raise Warning.Expected("[Rule.]", self.FileName, self.CurrentLineNumber)
+
+ if not self._SkipToToken(TAB_SPLIT):
+ raise Warning.Expected("'.'", self.FileName, self.CurrentLineNumber)
+
+ Arch = self._SkippedChars.rstrip(TAB_SPLIT)
+ if Arch.upper() not in ARCH_SET_FULL:
+ raise Warning("Unknown Arch '%s'" % Arch, self.FileName, self.CurrentLineNumber)
+
+ ModuleType = self._GetModuleType()
+
+ TemplateName = ""
+ if self._IsToken(TAB_SPLIT):
+ if not self._GetNextWord():
+ raise Warning.Expected("template name", self.FileName, self.CurrentLineNumber)
+ TemplateName = self._Token
+
+ if not self._IsToken(TAB_SECTION_END):
+ raise Warning.ExpectedBracketClose(self.FileName, self.CurrentLineNumber)
+
+ RuleObj = self._GetRuleFileStatements()
+ RuleObj.Arch = Arch.upper()
+ RuleObj.ModuleType = ModuleType
+ RuleObj.TemplateName = TemplateName
+ if TemplateName == '':
+ self.Profile.RuleDict['RULE' + \
+ TAB_SPLIT + \
+ Arch.upper() + \
+ TAB_SPLIT + \
+ ModuleType.upper() ] = RuleObj
+ else:
+ self.Profile.RuleDict['RULE' + \
+ TAB_SPLIT + \
+ Arch.upper() + \
+ TAB_SPLIT + \
+ ModuleType.upper() + \
+ TAB_SPLIT + \
+ TemplateName.upper() ] = RuleObj
+ return True
+
+ ## _GetModuleType() method
+ #
+ # Return the module type
+ #
+ # @param self The object pointer
+ # @retval string module type
+ #
+ def _GetModuleType(self):
+ if not self._GetNextWord():
+ raise Warning.Expected("Module type", self.FileName, self.CurrentLineNumber)
+ if self._Token.upper() not in {
+ SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,
+ SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER,
+ SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER,
+ SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_UEFI_DRIVER,
+ SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION,
+ TAB_DEFAULT, SUP_MODULE_BASE,
+ EDK_COMPONENT_TYPE_SECURITY_CORE,
+ EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER,
+ EDK_COMPONENT_TYPE_PIC_PEIM,
+ EDK_COMPONENT_TYPE_RELOCATABLE_PEIM, "PE32_PEIM",
+ EDK_COMPONENT_TYPE_BS_DRIVER, EDK_COMPONENT_TYPE_RT_DRIVER,
+ EDK_COMPONENT_TYPE_SAL_RT_DRIVER,
+ EDK_COMPONENT_TYPE_APPLICATION, "ACPITABLE",
+ SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE,
+ SUP_MODULE_MM_CORE_STANDALONE}:
+ raise Warning("Unknown Module type '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+ return self._Token
+
+ ## _GetFileExtension() method
+ #
+ # Return the file extension
+ #
+ # @param self The object pointer
+ # @retval string file name extension
+ #
+ def _GetFileExtension(self):
+ if not self._IsToken(TAB_SPLIT):
+ raise Warning.Expected("'.'", self.FileName, self.CurrentLineNumber)
+
+ Ext = ""
+ if self._GetNextToken():
+ if FileExtensionPattern.match(self._Token):
+ Ext = self._Token
+ return TAB_SPLIT + Ext
+ else:
+ raise Warning("Unknown file extension '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+
+ else:
+ raise Warning.Expected("file extension", self.FileName, self.CurrentLineNumber)
+
+ ## _GetRuleFileStatement() method
+ #
+ # Get rule contents
+ #
+ # @param self The object pointer
+ # @retval Rule Rule object
+ #
+ def _GetRuleFileStatements(self):
+ if not self._IsKeyword("FILE"):
+ raise Warning.Expected("FILE", self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextWord():
+ raise Warning.Expected("FFS type", self.FileName, self.CurrentLineNumber)
+
+ Type = self._Token.strip().upper()
+ if Type not in {"RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,
+ "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_CORE, EDK_COMPONENT_TYPE_APPLICATION,
+ "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE,
+ SUP_MODULE_MM_CORE_STANDALONE}:
+ raise Warning("Unknown FV type '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._IsKeyword("$(NAMED_GUID)"):
+ if not self._GetNextWord():
+ NamedGuid = self._CurrentLine()[self.CurrentOffsetWithinLine:].split()[0].strip()
+ if GlobalData.gGuidPatternEnd.match(NamedGuid):
+ self.CurrentOffsetWithinLine += len(NamedGuid)
+ self._Token = NamedGuid
+ else:
+ raise Warning.Expected("$(NAMED_GUID)", self.FileName, self.CurrentLineNumber)
+ if self._Token == 'PCD':
+ if not self._IsToken("("):
+ raise Warning.Expected("'('", self.FileName, self.CurrentLineNumber)
+ PcdPair = self._GetNextPcdSettings()
+ if not self._IsToken(")"):
+ raise Warning.Expected("')'", self.FileName, self.CurrentLineNumber)
+ self._Token = 'PCD('+PcdPair[1]+TAB_SPLIT+PcdPair[0]+')'
+
+ NameGuid = self._Token
+
+ KeepReloc = None
+ if self._IsKeyword('RELOCS_STRIPPED') or self._IsKeyword('RELOCS_RETAINED'):
+ if self._FileCouldHaveRelocFlag(Type):
+ if self._Token == 'RELOCS_STRIPPED':
+ KeepReloc = False
+ else:
+ KeepReloc = True
+ else:
+ raise Warning("File type %s could not have reloc strip flag%d" % (Type, self.CurrentLineNumber), self.FileName, self.CurrentLineNumber)
+
+ KeyStringList = []
+ if self._GetNextToken():
+ if TokenFindPattern.match(self._Token):
+ KeyStringList.append(self._Token)
+ if self._IsToken(TAB_COMMA_SPLIT):
+ while self._GetNextToken():
+ if not TokenFindPattern.match(self._Token):
+ raise Warning.Expected("KeyString \"Target_Tag_Arch\"", self.FileName, self.CurrentLineNumber)
+ KeyStringList.append(self._Token)
+
+ if not self._IsToken(TAB_COMMA_SPLIT):
+ break
+
+ else:
+ self._UndoToken()
+
+
+ Fixed = False
+ if self._IsKeyword("Fixed", True):
+ Fixed = True
+
+ CheckSum = False
+ if self._IsKeyword("CheckSum", True):
+ CheckSum = True
+
+ AlignValue = ""
+ if self._GetAlignment():
+ if self._Token not in ALIGNMENTS:
+ raise Warning("Incorrect alignment '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+ #For FFS, Auto is default option same to ""
+ if not self._Token == "Auto":
+ AlignValue = self._Token
+
+ if self._IsToken("{"):
+ # Complex file rule expected
+ NewRule = RuleComplexFile()
+ NewRule.FvFileType = Type
+ NewRule.NameGuid = NameGuid
+ NewRule.Alignment = AlignValue
+ NewRule.CheckSum = CheckSum
+ NewRule.Fixed = Fixed
+ NewRule.KeyStringList = KeyStringList
+ if KeepReloc is not None:
+ NewRule.KeepReloc = KeepReloc
+
+ while True:
+ IsEncapsulate = self._GetRuleEncapsulationSection(NewRule)
+ IsLeaf = self._GetEfiSection(NewRule)
+ if not IsEncapsulate and not IsLeaf:
+ break
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+
+ return NewRule
+
+ else:
+ # Simple file rule expected
+ if not self._GetNextWord():
+ raise Warning.Expected("leaf section type", self.FileName, self.CurrentLineNumber)
+
+ SectionName = self._Token
+
+ if SectionName not in {
+ "COMPAT16", BINARY_FILE_TYPE_PE32,
+ BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE",
+ "RAW",BINARY_FILE_TYPE_DXE_DEPEX, BINARY_FILE_TYPE_UI,
+ BINARY_FILE_TYPE_PEI_DEPEX, "VERSION", "SUBTYPE_GUID",
+ BINARY_FILE_TYPE_SMM_DEPEX}:
+ raise Warning("Unknown leaf section name '%s'" % SectionName, self.FileName, self.CurrentLineNumber)
+
+
+ if self._IsKeyword("Fixed", True):
+ Fixed = True
+
+ if self._IsKeyword("CheckSum", True):
+ CheckSum = True
+
+ SectAlignment = ""
+ if self._GetAlignment():
+ if self._Token not in ALIGNMENTS:
+ raise Warning("Incorrect alignment '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+ if self._Token == 'Auto' and (not SectionName == BINARY_FILE_TYPE_PE32) and (not SectionName == BINARY_FILE_TYPE_TE):
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
+ SectAlignment = self._Token
+
+ Ext = None
+ if self._IsToken(TAB_VALUE_SPLIT):
+ Ext = self._GetFileExtension()
+ elif not self._GetNextToken():
+ raise Warning.Expected("File name", self.FileName, self.CurrentLineNumber)
+
+ NewRule = RuleSimpleFile()
+ NewRule.SectionType = SectionName
+ NewRule.FvFileType = Type
+ NewRule.NameGuid = NameGuid
+ NewRule.Alignment = AlignValue
+ NewRule.SectAlignment = SectAlignment
+ NewRule.CheckSum = CheckSum
+ NewRule.Fixed = Fixed
+ NewRule.KeyStringList = KeyStringList
+ if KeepReloc is not None:
+ NewRule.KeepReloc = KeepReloc
+ NewRule.FileExtension = Ext
+ NewRule.FileName = self._Token
+ return NewRule
+
+ ## _GetEfiSection() method
+ #
+ # Get section list for Rule
+ #
+ # @param self The object pointer
+ # @param Obj for whom section is got
+ # @retval True Successfully find section statement
+ # @retval False Not able to find section statement
+ #
+ def _GetEfiSection(self, Obj):
+ OldPos = self.GetFileBufferPos()
+ EfiSectionObj = EfiSection()
+ if not self._GetNextWord():
+ CurrentLine = self._CurrentLine()[self.CurrentOffsetWithinLine:].split()[0].strip()
+ if self._Token == '{' and Obj.FvFileType == "RAW" and TAB_SPLIT in CurrentLine:
+ if self._IsToken(TAB_VALUE_SPLIT):
+ EfiSectionObj.FileExtension = self._GetFileExtension()
+ elif self._GetNextToken():
+ EfiSectionObj.FileName = self._Token
+ EfiSectionObj.SectionType = BINARY_FILE_TYPE_RAW
+ Obj.SectionList.append(EfiSectionObj)
+ return True
+ else:
+ return False
+ SectionName = self._Token
+
+ if SectionName not in {
+ "COMPAT16", BINARY_FILE_TYPE_PE32,
+ BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE",
+ "RAW",BINARY_FILE_TYPE_DXE_DEPEX, BINARY_FILE_TYPE_UI,
+ BINARY_FILE_TYPE_PEI_DEPEX, "VERSION", "SUBTYPE_GUID",
+ BINARY_FILE_TYPE_SMM_DEPEX, BINARY_FILE_TYPE_GUID}:
+ self._UndoToken()
+ return False
+
+ if SectionName == "FV_IMAGE":
+ FvImageSectionObj = FvImageSection()
+ if self._IsKeyword("FV_IMAGE"):
+ pass
+ if self._IsToken("{"):
+ FvObj = FV()
+ self._GetDefineStatements(FvObj)
+ self._GetBlockStatement(FvObj)
+ self._GetSetStatements(FvObj)
+ self._GetFvAlignment(FvObj)
+ self._GetFvAttributes(FvObj)
+ self._GetAprioriSection(FvObj)
+ self._GetAprioriSection(FvObj)
+
+ while True:
+ IsInf = self._GetInfStatement(FvObj)
+ IsFile = self._GetFileStatement(FvObj)
+ if not IsInf and not IsFile:
+ break
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+ FvImageSectionObj.Fv = FvObj
+ FvImageSectionObj.FvName = None
+
+ else:
+ if not self._IsKeyword(BINARY_FILE_TYPE_FV):
+ raise Warning.Expected("'FV'", self.FileName, self.CurrentLineNumber)
+ FvImageSectionObj.FvFileType = self._Token
+
+ if self._GetAlignment():
+ if self._Token not in ALIGNMENT_NOAUTO:
+ raise Warning("Incorrect alignment '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+ FvImageSectionObj.Alignment = self._Token
+
+ if self._IsToken(TAB_VALUE_SPLIT):
+ FvImageSectionObj.FvFileExtension = self._GetFileExtension()
+ elif self._GetNextToken():
+ if self._Token not in {
+ T_CHAR_BRACE_R, "COMPAT16", BINARY_FILE_TYPE_PE32,
+ BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE,
+ "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,
+ BINARY_FILE_TYPE_UI, "VERSION",
+ BINARY_FILE_TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID,
+ BINARY_FILE_TYPE_SMM_DEPEX}:
+ FvImageSectionObj.FvFileName = self._Token
+ else:
+ self._UndoToken()
+ else:
+ raise Warning.Expected("FV file name", self.FileName, self.CurrentLineNumber)
+
+ Obj.SectionList.append(FvImageSectionObj)
+ return True
+
+ EfiSectionObj.SectionType = SectionName
+
+ if not self._GetNextToken():
+ raise Warning.Expected("file type", self.FileName, self.CurrentLineNumber)
+
+ if self._Token == "STRING":
+ if not self._RuleSectionCouldHaveString(EfiSectionObj.SectionType):
+ raise Warning("%s section could NOT have string data%d" % (EfiSectionObj.SectionType, self.CurrentLineNumber), self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("Quoted String", self.FileName, self.CurrentLineNumber)
+
+ if self._GetStringData():
+ EfiSectionObj.StringData = self._Token
+
+ if self._IsKeyword("BUILD_NUM"):
+ if not self._RuleSectionCouldHaveBuildNum(EfiSectionObj.SectionType):
+ raise Warning("%s section could NOT have BUILD_NUM%d" % (EfiSectionObj.SectionType, self.CurrentLineNumber), self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken():
+ raise Warning.Expected("Build number", self.FileName, self.CurrentLineNumber)
+ EfiSectionObj.BuildNum = self._Token
+
+ else:
+ EfiSectionObj.FileType = self._Token
+ self._CheckRuleSectionFileType(EfiSectionObj.SectionType, EfiSectionObj.FileType)
+
+ if self._IsKeyword("Optional"):
+ if not self._RuleSectionCouldBeOptional(EfiSectionObj.SectionType):
+ raise Warning("%s section could NOT be optional%d" % (EfiSectionObj.SectionType, self.CurrentLineNumber), self.FileName, self.CurrentLineNumber)
+ EfiSectionObj.Optional = True
+
+ if self._IsKeyword("BUILD_NUM"):
+ if not self._RuleSectionCouldHaveBuildNum(EfiSectionObj.SectionType):
+ raise Warning("%s section could NOT have BUILD_NUM%d" % (EfiSectionObj.SectionType, self.CurrentLineNumber), self.FileName, self.CurrentLineNumber)
+
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken():
+ raise Warning.Expected("Build number", self.FileName, self.CurrentLineNumber)
+ EfiSectionObj.BuildNum = self._Token
+
+ if self._GetAlignment():
+ if self._Token not in ALIGNMENTS:
+ raise Warning("Incorrect alignment '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+ if self._Token == 'Auto' and (not SectionName == BINARY_FILE_TYPE_PE32) and (not SectionName == BINARY_FILE_TYPE_TE):
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
+ EfiSectionObj.Alignment = self._Token
+
+ if self._IsKeyword('RELOCS_STRIPPED') or self._IsKeyword('RELOCS_RETAINED'):
+ if self._SectionCouldHaveRelocFlag(EfiSectionObj.SectionType):
+ if self._Token == 'RELOCS_STRIPPED':
+ EfiSectionObj.KeepReloc = False
+ else:
+ EfiSectionObj.KeepReloc = True
+ if Obj.KeepReloc is not None and Obj.KeepReloc != EfiSectionObj.KeepReloc:
+ raise Warning("Section type %s has reloc strip flag conflict with Rule" % EfiSectionObj.SectionType, self.FileName, self.CurrentLineNumber)
+ else:
+ raise Warning("Section type %s could not have reloc strip flag" % EfiSectionObj.SectionType, self.FileName, self.CurrentLineNumber)
+
+
+ if self._IsToken(TAB_VALUE_SPLIT):
+ EfiSectionObj.FileExtension = self._GetFileExtension()
+ elif self._GetNextToken():
+ if self._Token not in {
+ T_CHAR_BRACE_R, "COMPAT16", BINARY_FILE_TYPE_PE32,
+ BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE,
+ "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,
+ BINARY_FILE_TYPE_UI, "VERSION",
+ BINARY_FILE_TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID,
+ BINARY_FILE_TYPE_SMM_DEPEX}:
+
+ if self._Token.startswith('PCD'):
+ self._UndoToken()
+ self._GetNextWord()
+
+ if self._Token == 'PCD':
+ if not self._IsToken("("):
+ raise Warning.Expected("'('", self.FileName, self.CurrentLineNumber)
+ PcdPair = self._GetNextPcdSettings()
+ if not self._IsToken(")"):
+ raise Warning.Expected("')'", self.FileName, self.CurrentLineNumber)
+ self._Token = 'PCD('+PcdPair[1]+TAB_SPLIT+PcdPair[0]+')'
+
+ EfiSectionObj.FileName = self._Token
+
+ else:
+ self._UndoToken()
+ else:
+ raise Warning.Expected("section file name", self.FileName, self.CurrentLineNumber)
+
+ Obj.SectionList.append(EfiSectionObj)
+ return True
+
+ ## _RuleSectionCouldBeOptional() method
+ #
+ # Get whether a section could be optional
+ #
+ # @param SectionType The section type to check
+ # @retval True section could be optional
+ # @retval False section never optional
+ #
+ @staticmethod
+ def _RuleSectionCouldBeOptional(SectionType):
+ if SectionType in {BINARY_FILE_TYPE_DXE_DEPEX, BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, "RAW", BINARY_FILE_TYPE_SMM_DEPEX}:
+ return True
+ else:
+ return False
+
+ ## _RuleSectionCouldHaveBuildNum() method
+ #
+ # Get whether a section could have build number information
+ #
+ # @param SectionType The section type to check
+ # @retval True section could have build number information
+ # @retval False section never have build number information
+ #
+ @staticmethod
+ def _RuleSectionCouldHaveBuildNum(SectionType):
+ if SectionType == "VERSION":
+ return True
+ else:
+ return False
+
+ ## _RuleSectionCouldHaveString() method
+ #
+ # Get whether a section could have string
+ #
+ # @param SectionType The section type to check
+ # @retval True section could have string
+ # @retval False section never have string
+ #
+ @staticmethod
+ def _RuleSectionCouldHaveString(SectionType):
+ if SectionType in {BINARY_FILE_TYPE_UI, "VERSION"}:
+ return True
+ else:
+ return False
+
+ ## _CheckRuleSectionFileType() method
+ #
+ # Get whether a section matches a file type
+ #
+ # @param self The object pointer
+ # @param SectionType The section type to check
+ # @param FileType The file type to check
+ #
+ def _CheckRuleSectionFileType(self, SectionType, FileType):
+ WarningString = "Incorrect section file type '%s'"
+ if SectionType == "COMPAT16":
+ if FileType not in {"COMPAT16", "SEC_COMPAT16"}:
+ raise Warning(WarningString % FileType, self.FileName, self.CurrentLineNumber)
+ elif SectionType == BINARY_FILE_TYPE_PE32:
+ if FileType not in {BINARY_FILE_TYPE_PE32, "SEC_PE32"}:
+ raise Warning(WarningString % FileType, self.FileName, self.CurrentLineNumber)
+ elif SectionType == BINARY_FILE_TYPE_PIC:
+ if FileType not in {BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_PIC}:
+ raise Warning(WarningString % FileType, self.FileName, self.CurrentLineNumber)
+ elif SectionType == BINARY_FILE_TYPE_TE:
+ if FileType not in {BINARY_FILE_TYPE_TE, "SEC_TE"}:
+ raise Warning(WarningString % FileType, self.FileName, self.CurrentLineNumber)
+ elif SectionType == "RAW":
+ if FileType not in {BINARY_FILE_TYPE_BIN, "SEC_BIN", "RAW", "ASL", "ACPI"}:
+ raise Warning(WarningString % FileType, self.FileName, self.CurrentLineNumber)
+ elif SectionType == BINARY_FILE_TYPE_DXE_DEPEX or SectionType == BINARY_FILE_TYPE_SMM_DEPEX:
+ if FileType not in {BINARY_FILE_TYPE_DXE_DEPEX, "SEC_DXE_DEPEX", BINARY_FILE_TYPE_SMM_DEPEX}:
+ raise Warning(WarningString % FileType, self.FileName, self.CurrentLineNumber)
+ elif SectionType == BINARY_FILE_TYPE_UI:
+ if FileType not in {BINARY_FILE_TYPE_UI, "SEC_UI"}:
+ raise Warning(WarningString % FileType, self.FileName, self.CurrentLineNumber)
+ elif SectionType == "VERSION":
+ if FileType not in {"VERSION", "SEC_VERSION"}:
+ raise Warning(WarningString % FileType, self.FileName, self.CurrentLineNumber)
+ elif SectionType == BINARY_FILE_TYPE_PEI_DEPEX:
+ if FileType not in {BINARY_FILE_TYPE_PEI_DEPEX, "SEC_PEI_DEPEX"}:
+ raise Warning(WarningString % FileType, self.FileName, self.CurrentLineNumber)
+ elif SectionType == BINARY_FILE_TYPE_GUID:
+ if FileType not in {BINARY_FILE_TYPE_PE32, "SEC_GUID"}:
+ raise Warning(WarningString % FileType, self.FileName, self.CurrentLineNumber)
+
+ ## _GetRuleEncapsulationSection() method
+ #
+ # Get encapsulation section for Rule
+ #
+ # @param self The object pointer
+ # @param theRule for whom section is got
+ # @retval True Successfully find section statement
+ # @retval False Not able to find section statement
+ #
+ def _GetRuleEncapsulationSection(self, theRule):
+ if self._IsKeyword("COMPRESS"):
+ Type = "PI_STD"
+ if self._IsKeyword("PI_STD") or self._IsKeyword("PI_NONE"):
+ Type = self._Token
+
+ if not self._IsToken("{"):
+ raise Warning.ExpectedCurlyOpen(self.FileName, self.CurrentLineNumber)
+
+ CompressSectionObj = CompressSection()
+
+ CompressSectionObj.CompType = Type
+ # Recursive sections...
+ while True:
+ IsEncapsulate = self._GetRuleEncapsulationSection(CompressSectionObj)
+ IsLeaf = self._GetEfiSection(CompressSectionObj)
+ if not IsEncapsulate and not IsLeaf:
+ break
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+ theRule.SectionList.append(CompressSectionObj)
+
+ return True
+
+ elif self._IsKeyword("GUIDED"):
+ GuidValue = None
+ if self._GetNextGuid():
+ if self._Token in GlobalData.gGuidDict:
+ self._Token = GuidStructureStringToGuidString(GlobalData.gGuidDict[self._Token]).upper()
+ GuidValue = self._Token
+
+ if self._IsKeyword("$(NAMED_GUID)"):
+ GuidValue = self._Token
+
+ AttribDict = self._GetGuidAttrib()
+
+ if not self._IsToken("{"):
+ raise Warning.ExpectedCurlyOpen(self.FileName, self.CurrentLineNumber)
+ GuidSectionObj = GuidSection()
+ GuidSectionObj.NameGuid = GuidValue
+ GuidSectionObj.SectionType = "GUIDED"
+ GuidSectionObj.ProcessRequired = AttribDict["PROCESSING_REQUIRED"]
+ GuidSectionObj.AuthStatusValid = AttribDict["AUTH_STATUS_VALID"]
+ GuidSectionObj.ExtraHeaderSize = AttribDict["EXTRA_HEADER_SIZE"]
+
+ # Efi sections...
+ while True:
+ IsEncapsulate = self._GetRuleEncapsulationSection(GuidSectionObj)
+ IsLeaf = self._GetEfiSection(GuidSectionObj)
+ if not IsEncapsulate and not IsLeaf:
+ break
+
+ if not self._IsToken(T_CHAR_BRACE_R):
+ raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLineNumber)
+ theRule.SectionList.append(GuidSectionObj)
+
+ return True
+
+ return False
+
+ ## _GetOptionRom() method
+ #
+ # Get OptionROM section contents and store its data into OptionROM list of self.Profile
+ #
+ # @param self The object pointer
+ # @retval True Successfully find a OptionROM
+ # @retval False Not able to find a OptionROM
+ #
+ def _GetOptionRom(self):
+ if not self._GetNextToken():
+ return False
+
+ S = self._Token.upper()
+ if S.startswith(TAB_SECTION_START) and not S.startswith("[OPTIONROM."):
+ self.SectionParser(S)
+ self._UndoToken()
+ return False
+
+ self._UndoToken()
+ if not self._IsToken("[OptionRom.", True):
+ raise Warning("Unknown Keyword '%s'" % self._Token, self.FileName, self.CurrentLineNumber)
+
+ OptRomName = self._GetUiName()
+
+ if not self._IsToken(TAB_SECTION_END):
+ raise Warning.ExpectedBracketClose(self.FileName, self.CurrentLineNumber)
+
+ OptRomObj = OPTIONROM(OptRomName)
+ self.Profile.OptRomDict[OptRomName] = OptRomObj
+
+ while True:
+ isInf = self._GetOptRomInfStatement(OptRomObj)
+ isFile = self._GetOptRomFileStatement(OptRomObj)
+ if not isInf and not isFile:
+ break
+
+ return True
+
+ ## _GetOptRomInfStatement() method
+ #
+ # Get INF statements
+ #
+ # @param self The object pointer
+ # @param Obj for whom inf statement is got
+ # @retval True Successfully find inf statement
+ # @retval False Not able to find inf statement
+ #
+ def _GetOptRomInfStatement(self, Obj):
+ if not self._IsKeyword("INF"):
+ return False
+
+ ffsInf = OptRomInfStatement()
+ self._GetInfOptions(ffsInf)
+
+ if not self._GetNextToken():
+ raise Warning.Expected("INF file path", self.FileName, self.CurrentLineNumber)
+ ffsInf.InfFileName = self._Token
+ if ffsInf.InfFileName.replace(TAB_WORKSPACE, '').find('$') == -1:
+ #check for file path
+ ErrorCode, ErrorInfo = PathClass(NormPath(ffsInf.InfFileName), GenFdsGlobalVariable.WorkSpaceDir).Validate()
+ if ErrorCode != 0:
+ EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
+
+ NewFileName = ffsInf.InfFileName
+ if ffsInf.OverrideGuid:
+ NewFileName = ProcessDuplicatedInf(PathClass(ffsInf.InfFileName,GenFdsGlobalVariable.WorkSpaceDir), ffsInf.OverrideGuid, GenFdsGlobalVariable.WorkSpaceDir).Path
+
+ if not NewFileName in self.Profile.InfList:
+ self.Profile.InfList.append(NewFileName)
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)
+ self.Profile.InfFileLineList.append(FileLineTuple)
+ if ffsInf.UseArch:
+ if ffsInf.UseArch not in self.Profile.InfDict:
+ self.Profile.InfDict[ffsInf.UseArch] = [ffsInf.InfFileName]
+ else:
+ self.Profile.InfDict[ffsInf.UseArch].append(ffsInf.InfFileName)
+ else:
+ self.Profile.InfDict['ArchTBD'].append(ffsInf.InfFileName)
+
+
+ self._GetOptRomOverrides (ffsInf)
+
+ Obj.FfsList.append(ffsInf)
+ return True
+
+ ## _GetOptRomOverrides() method
+ #
+ # Get overrides for OptROM INF & FILE
+ #
+ # @param self The object pointer
+ # @param FfsInfObj for whom overrides is got
+ #
+ def _GetOptRomOverrides(self, Obj):
+ if self._IsToken('{'):
+ Overrides = OverrideAttribs()
+ while True:
+ if self._IsKeyword("PCI_VENDOR_ID"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextHexNumber():
+ raise Warning.Expected("Hex vendor id", self.FileName, self.CurrentLineNumber)
+ Overrides.PciVendorId = self._Token
+ continue
+
+ if self._IsKeyword("PCI_CLASS_CODE"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextHexNumber():
+ raise Warning.Expected("Hex class code", self.FileName, self.CurrentLineNumber)
+ Overrides.PciClassCode = self._Token
+ continue
+
+ if self._IsKeyword("PCI_DEVICE_ID"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ # Get a list of PCI IDs
+ Overrides.PciDeviceId = ""
+ while (self._GetNextHexNumber()):
+ Overrides.PciDeviceId = "{} {}".format(Overrides.PciDeviceId, self._Token)
+ if not Overrides.PciDeviceId:
+ raise Warning.Expected("one or more Hex device ids", self.FileName, self.CurrentLineNumber)
+ continue
+
+ if self._IsKeyword("PCI_REVISION"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextHexNumber():
+ raise Warning.Expected("Hex revision", self.FileName, self.CurrentLineNumber)
+ Overrides.PciRevision = self._Token
+ continue
+
+ if self._IsKeyword("PCI_COMPRESS"):
+ if not self._IsToken(TAB_EQUAL_SPLIT):
+ raise Warning.ExpectedEquals(self.FileName, self.CurrentLineNumber)
+ if not self._GetNextToken():
+ raise Warning.Expected("TRUE/FALSE for compress", self.FileName, self.CurrentLineNumber)
+ Overrides.NeedCompress = self._Token.upper() == 'TRUE'
+ continue
+
+ if self._IsToken(T_CHAR_BRACE_R):
+ break
+ else:
+ EdkLogger.error("FdfParser", FORMAT_INVALID, File=self.FileName, Line=self.CurrentLineNumber)
+
+ Obj.OverrideAttribs = Overrides
+
+ ## _GetOptRomFileStatement() method
+ #
+ # Get FILE statements
+ #
+ # @param self The object pointer
+ # @param Obj for whom FILE statement is got
+ # @retval True Successfully find FILE statement
+ # @retval False Not able to find FILE statement
+ #
+ def _GetOptRomFileStatement(self, Obj):
+ if not self._IsKeyword("FILE"):
+ return False
+
+ FfsFileObj = OptRomFileStatement()
+
+ if not self._IsKeyword("EFI") and not self._IsKeyword(BINARY_FILE_TYPE_BIN):
+ raise Warning.Expected("Binary type (EFI/BIN)", self.FileName, self.CurrentLineNumber)
+ FfsFileObj.FileType = self._Token
+
+ if not self._GetNextToken():
+ raise Warning.Expected("File path", self.FileName, self.CurrentLineNumber)
+ FfsFileObj.FileName = self._Token
+ if FfsFileObj.FileName.replace(TAB_WORKSPACE, '').find('$') == -1:
+ #check for file path
+ ErrorCode, ErrorInfo = PathClass(NormPath(FfsFileObj.FileName), GenFdsGlobalVariable.WorkSpaceDir).Validate()
+ if ErrorCode != 0:
+ EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
+
+ if FfsFileObj.FileType == 'EFI':
+ self._GetOptRomOverrides(FfsFileObj)
+
+ Obj.FfsList.append(FfsFileObj)
+
+ return True
+
+ ## _GetCapInFd() method
+ #
+ # Get Cap list contained in FD
+ #
+ # @param self The object pointer
+ # @param FdName FD name
+ # @retval CapList List of Capsule in FD
+ #
+ def _GetCapInFd (self, FdName):
+ CapList = []
+ if FdName.upper() in self.Profile.FdDict:
+ FdObj = self.Profile.FdDict[FdName.upper()]
+ for elementRegion in FdObj.RegionList:
+ if elementRegion.RegionType == 'CAPSULE':
+ for elementRegionData in elementRegion.RegionDataList:
+ if elementRegionData.endswith(".cap"):
+ continue
+ if elementRegionData is not None and elementRegionData.upper() not in CapList:
+ CapList.append(elementRegionData.upper())
+ return CapList
+
+ ## _GetReferencedFdCapTuple() method
+ #
+ # Get FV and FD list referenced by a capsule image
+ #
+ # @param self The object pointer
+ # @param CapObj Capsule section to be searched
+ # @param RefFdList referenced FD by section
+ # @param RefFvList referenced FV by section
+ #
+ def _GetReferencedFdCapTuple(self, CapObj, RefFdList = [], RefFvList = []):
+ for CapsuleDataObj in CapObj.CapsuleDataList:
+ if hasattr(CapsuleDataObj, 'FvName') and CapsuleDataObj.FvName is not None and CapsuleDataObj.FvName.upper() not in RefFvList:
+ RefFvList.append (CapsuleDataObj.FvName.upper())
+ elif hasattr(CapsuleDataObj, 'FdName') and CapsuleDataObj.FdName is not None and CapsuleDataObj.FdName.upper() not in RefFdList:
+ RefFdList.append (CapsuleDataObj.FdName.upper())
+ elif CapsuleDataObj.Ffs is not None:
+ if isinstance(CapsuleDataObj.Ffs, FileStatement):
+ if CapsuleDataObj.Ffs.FvName is not None and CapsuleDataObj.Ffs.FvName.upper() not in RefFvList:
+ RefFvList.append(CapsuleDataObj.Ffs.FvName.upper())
+ elif CapsuleDataObj.Ffs.FdName is not None and CapsuleDataObj.Ffs.FdName.upper() not in RefFdList:
+ RefFdList.append(CapsuleDataObj.Ffs.FdName.upper())
+ else:
+ self._GetReferencedFdFvTupleFromSection(CapsuleDataObj.Ffs, RefFdList, RefFvList)
+
+ ## _GetFvInFd() method
+ #
+ # Get FV list contained in FD
+ #
+ # @param self The object pointer
+ # @param FdName FD name
+ # @retval FvList list of FV in FD
+ #
+ def _GetFvInFd (self, FdName):
+ FvList = []
+ if FdName.upper() in self.Profile.FdDict:
+ FdObj = self.Profile.FdDict[FdName.upper()]
+ for elementRegion in FdObj.RegionList:
+ if elementRegion.RegionType == BINARY_FILE_TYPE_FV:
+ for elementRegionData in elementRegion.RegionDataList:
+ if elementRegionData.endswith(".fv"):
+ continue
+ if elementRegionData is not None and elementRegionData.upper() not in FvList:
+ FvList.append(elementRegionData.upper())
+ return FvList
+
+ ## _GetReferencedFdFvTuple() method
+ #
+ # Get FD and FV list referenced by a FFS file
+ #
+ # @param self The object pointer
+ # @param FfsFile contains sections to be searched
+ # @param RefFdList referenced FD by section
+ # @param RefFvList referenced FV by section
+ #
+ def _GetReferencedFdFvTuple(self, FvObj, RefFdList = [], RefFvList = []):
+ for FfsObj in FvObj.FfsList:
+ if isinstance(FfsObj, FileStatement):
+ if FfsObj.FvName is not None and FfsObj.FvName.upper() not in RefFvList:
+ RefFvList.append(FfsObj.FvName.upper())
+ elif FfsObj.FdName is not None and FfsObj.FdName.upper() not in RefFdList:
+ RefFdList.append(FfsObj.FdName.upper())
+ else:
+ self._GetReferencedFdFvTupleFromSection(FfsObj, RefFdList, RefFvList)
+
+ ## _GetReferencedFdFvTupleFromSection() method
+ #
+ # Get FD and FV list referenced by a FFS section
+ #
+ # @param self The object pointer
+ # @param FfsFile contains sections to be searched
+ # @param FdList referenced FD by section
+ # @param FvList referenced FV by section
+ #
+ def _GetReferencedFdFvTupleFromSection(self, FfsFile, FdList = [], FvList = []):
+ SectionStack = list(FfsFile.SectionList)
+ while SectionStack != []:
+ SectionObj = SectionStack.pop()
+ if isinstance(SectionObj, FvImageSection):
+ if SectionObj.FvName is not None and SectionObj.FvName.upper() not in FvList:
+ FvList.append(SectionObj.FvName.upper())
+ if SectionObj.Fv is not None and SectionObj.Fv.UiFvName is not None and SectionObj.Fv.UiFvName.upper() not in FvList:
+ FvList.append(SectionObj.Fv.UiFvName.upper())
+ self._GetReferencedFdFvTuple(SectionObj.Fv, FdList, FvList)
+
+ if isinstance(SectionObj, CompressSection) or isinstance(SectionObj, GuidSection):
+ SectionStack.extend(SectionObj.SectionList)
+
+ ## CycleReferenceCheck() method
+ #
+ # Check whether cycle reference exists in FDF
+ #
+ # @param self The object pointer
+ # @retval True cycle reference exists
+ # @retval False Not exists cycle reference
+ #
+ def CycleReferenceCheck(self):
+ #
+ # Check the cycle between FV and FD image
+ #
+ MaxLength = len (self.Profile.FvDict)
+ for FvName in self.Profile.FvDict:
+ LogStr = "\nCycle Reference Checking for FV: %s\n" % FvName
+ RefFvStack = set(FvName)
+ FdAnalyzedList = set()
+
+ Index = 0
+ while RefFvStack and Index < MaxLength:
+ Index = Index + 1
+ FvNameFromStack = RefFvStack.pop()
+ if FvNameFromStack.upper() in self.Profile.FvDict:
+ FvObj = self.Profile.FvDict[FvNameFromStack.upper()]
+ else:
+ continue
+
+ RefFdList = []
+ RefFvList = []
+ self._GetReferencedFdFvTuple(FvObj, RefFdList, RefFvList)
+
+ for RefFdName in RefFdList:
+ if RefFdName in FdAnalyzedList:
+ continue
+
+ LogStr += "FV %s contains FD %s\n" % (FvNameFromStack, RefFdName)
+ FvInFdList = self._GetFvInFd(RefFdName)
+ if FvInFdList != []:
+ for FvNameInFd in FvInFdList:
+ LogStr += "FD %s contains FV %s\n" % (RefFdName, FvNameInFd)
+ if FvNameInFd not in RefFvStack:
+ RefFvStack.add(FvNameInFd)
+
+ if FvName in RefFvStack or FvNameFromStack in RefFvStack:
+ EdkLogger.info(LogStr)
+ return True
+ FdAnalyzedList.add(RefFdName)
+
+ for RefFvName in RefFvList:
+ LogStr += "FV %s contains FV %s\n" % (FvNameFromStack, RefFvName)
+ if RefFvName not in RefFvStack:
+ RefFvStack.add(RefFvName)
+
+ if FvName in RefFvStack or FvNameFromStack in RefFvStack:
+ EdkLogger.info(LogStr)
+ return True
+
+ #
+ # Check the cycle between Capsule and FD image
+ #
+ MaxLength = len (self.Profile.CapsuleDict)
+ for CapName in self.Profile.CapsuleDict:
+ #
+ # Capsule image to be checked.
+ #
+ LogStr = "\n\n\nCycle Reference Checking for Capsule: %s\n" % CapName
+ RefCapStack = {CapName}
+ FdAnalyzedList = set()
+ FvAnalyzedList = set()
+
+ Index = 0
+ while RefCapStack and Index < MaxLength:
+ Index = Index + 1
+ CapNameFromStack = RefCapStack.pop()
+ if CapNameFromStack.upper() in self.Profile.CapsuleDict:
+ CapObj = self.Profile.CapsuleDict[CapNameFromStack.upper()]
+ else:
+ continue
+
+ RefFvList = []
+ RefFdList = []
+ self._GetReferencedFdCapTuple(CapObj, RefFdList, RefFvList)
+
+ FvListLength = 0
+ FdListLength = 0
+ while FvListLength < len (RefFvList) or FdListLength < len (RefFdList):
+ for RefFdName in RefFdList:
+ if RefFdName in FdAnalyzedList:
+ continue
+
+ LogStr += "Capsule %s contains FD %s\n" % (CapNameFromStack, RefFdName)
+ for CapNameInFd in self._GetCapInFd(RefFdName):
+ LogStr += "FD %s contains Capsule %s\n" % (RefFdName, CapNameInFd)
+ if CapNameInFd not in RefCapStack:
+ RefCapStack.append(CapNameInFd)
+
+ if CapName in RefCapStack or CapNameFromStack in RefCapStack:
+ EdkLogger.info(LogStr)
+ return True
+
+ for FvNameInFd in self._GetFvInFd(RefFdName):
+ LogStr += "FD %s contains FV %s\n" % (RefFdName, FvNameInFd)
+ if FvNameInFd not in RefFvList:
+ RefFvList.append(FvNameInFd)
+
+ FdAnalyzedList.add(RefFdName)
+ #
+ # the number of the parsed FV and FD image
+ #
+ FvListLength = len (RefFvList)
+ FdListLength = len (RefFdList)
+ for RefFvName in RefFvList:
+ if RefFvName in FvAnalyzedList:
+ continue
+ LogStr += "Capsule %s contains FV %s\n" % (CapNameFromStack, RefFvName)
+ if RefFvName.upper() in self.Profile.FvDict:
+ FvObj = self.Profile.FvDict[RefFvName.upper()]
+ else:
+ continue
+ self._GetReferencedFdFvTuple(FvObj, RefFdList, RefFvList)
+ FvAnalyzedList.add(RefFvName)
+
+ return False
+
+ def GetAllIncludedFile (self):
+ global AllIncludeFileList
+ return AllIncludeFileList
+
+if __name__ == "__main__":
+ import sys
+ try:
+ test_file = sys.argv[1]
+ except IndexError as v:
+ print("Usage: %s filename" % sys.argv[0])
+ sys.exit(1)
+
+ parser = FdfParser(test_file)
+ try:
+ parser.ParseFile()
+ parser.CycleReferenceCheck()
+ except Warning as X:
+ print(str(X))
+ else:
+ print("Success!")
+
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/Ffs.py b/roms/edk2/BaseTools/Source/Python/GenFds/Ffs.py
new file mode 100644
index 000000000..4e58df279
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/Ffs.py
@@ -0,0 +1,49 @@
+## @file
+# process FFS generation
+#
+# Copyright (c) 2007-2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from Common.DataType import *
+
+# mapping between FILE type in FDF and file type for GenFfs
+FdfFvFileTypeToFileType = {
+ SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE',
+ SUP_MODULE_PEI_CORE : 'EFI_FV_FILETYPE_PEI_CORE',
+ SUP_MODULE_PEIM : 'EFI_FV_FILETYPE_PEIM',
+ SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE',
+ 'FREEFORM' : 'EFI_FV_FILETYPE_FREEFORM',
+ 'DRIVER' : 'EFI_FV_FILETYPE_DRIVER',
+ 'APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION',
+ 'FV_IMAGE' : 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE',
+ 'RAW' : 'EFI_FV_FILETYPE_RAW',
+ 'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER',
+ 'SMM' : 'EFI_FV_FILETYPE_SMM',
+ SUP_MODULE_SMM_CORE : 'EFI_FV_FILETYPE_SMM_CORE',
+ SUP_MODULE_MM_STANDALONE : 'EFI_FV_FILETYPE_MM_STANDALONE',
+ SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE'
+}
+
+# mapping between section type in FDF and file suffix
+SectionSuffix = {
+ BINARY_FILE_TYPE_PE32 : '.pe32',
+ BINARY_FILE_TYPE_PIC : '.pic',
+ BINARY_FILE_TYPE_TE : '.te',
+ BINARY_FILE_TYPE_DXE_DEPEX : '.dpx',
+ 'VERSION' : '.ver',
+ BINARY_FILE_TYPE_UI : '.ui',
+ 'COMPAT16' : '.com16',
+ 'RAW' : '.raw',
+ 'FREEFORM_SUBTYPE_GUID': '.guid',
+ 'SUBTYPE_GUID' : '.guid',
+ 'FV_IMAGE' : 'fv.sec',
+ 'COMPRESS' : '.com',
+ 'GUIDED' : '.guided',
+ BINARY_FILE_TYPE_PEI_DEPEX : '.dpx',
+ BINARY_FILE_TYPE_SMM_DEPEX : '.dpx'
+}
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/FfsFileStatement.py b/roms/edk2/BaseTools/Source/Python/GenFds/FfsFileStatement.py
new file mode 100644
index 000000000..9fb62b0a9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/FfsFileStatement.py
@@ -0,0 +1,172 @@
+## @file
+# process FFS generation from FILE statement
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from io import BytesIO
+from struct import pack
+from CommonDataClass.FdfClass import FileStatementClassObject
+from Common import EdkLogger
+from Common.BuildToolError import GENFDS_ERROR
+from Common.Misc import GuidStructureByteArrayToGuidString, SaveFileOnChange
+import Common.LongFilePathOs as os
+from .GuidSection import GuidSection
+from .FvImageSection import FvImageSection
+from .Ffs import FdfFvFileTypeToFileType
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+
+## generate FFS from FILE
+#
+#
+class FileStatement (FileStatementClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ FileStatementClassObject.__init__(self)
+ self.CurrentLineNum = None
+ self.CurrentLineContent = None
+ self.FileName = None
+ self.InfFileName = None
+ self.SubAlignment = None
+
+ ## GenFfs() method
+ #
+ # Generate FFS
+ #
+ # @param self The object pointer
+ # @param Dict dictionary contains macro and value pair
+ # @param FvChildAddr Array of the inside FvImage base address
+ # @param FvParentAddr Parent Fv base address
+ # @retval string Generated FFS file name
+ #
+ def GenFfs(self, Dict = None, FvChildAddr=[], FvParentAddr=None, IsMakefile=False, FvName=None):
+
+ if self.NameGuid and self.NameGuid.startswith('PCD('):
+ PcdValue = GenFdsGlobalVariable.GetPcdValue(self.NameGuid)
+ if len(PcdValue) == 0:
+ EdkLogger.error("GenFds", GENFDS_ERROR, '%s NOT defined.' \
+ % (self.NameGuid))
+ if PcdValue.startswith('{'):
+ PcdValue = GuidStructureByteArrayToGuidString(PcdValue)
+ RegistryGuidStr = PcdValue
+ if len(RegistryGuidStr) == 0:
+ EdkLogger.error("GenFds", GENFDS_ERROR, 'GUID value for %s in wrong format.' \
+ % (self.NameGuid))
+ self.NameGuid = RegistryGuidStr
+
+ Str = self.NameGuid
+ if FvName:
+ Str += FvName
+ OutputDir = os.path.join(GenFdsGlobalVariable.FfsDir, Str)
+ if not os.path.exists(OutputDir):
+ os.makedirs(OutputDir)
+
+ if Dict is None:
+ Dict = {}
+
+ Dict.update(self.DefineVarDict)
+ SectionAlignments = None
+ if self.FvName:
+ Buffer = BytesIO()
+ if self.FvName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FvDict:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (self.FvName))
+ Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())
+ FileName = Fv.AddToBuffer(Buffer)
+ SectionFiles = [FileName]
+
+ elif self.FdName:
+ if self.FdName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FdDict:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "FD (%s) is NOT described in FDF file!" % (self.FdName))
+ Fd = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())
+ FileName = Fd.GenFd()
+ SectionFiles = [FileName]
+
+ elif self.FileName:
+ if hasattr(self, 'FvFileType') and self.FvFileType == 'RAW':
+ if isinstance(self.FileName, list) and isinstance(self.SubAlignment, list) and len(self.FileName) == len(self.SubAlignment):
+ FileContent = BytesIO()
+ MaxAlignIndex = 0
+ MaxAlignValue = 1
+ for Index, File in enumerate(self.FileName):
+ try:
+ f = open(File, 'rb')
+ except:
+ GenFdsGlobalVariable.ErrorLogger("Error opening RAW file %s." % (File))
+ Content = f.read()
+ f.close()
+ AlignValue = 1
+ if self.SubAlignment[Index]:
+ AlignValue = GenFdsGlobalVariable.GetAlignment(self.SubAlignment[Index])
+ if AlignValue > MaxAlignValue:
+ MaxAlignIndex = Index
+ MaxAlignValue = AlignValue
+ FileContent.write(Content)
+ if len(FileContent.getvalue()) % AlignValue != 0:
+ Size = AlignValue - len(FileContent.getvalue()) % AlignValue
+ for i in range(0, Size):
+ FileContent.write(pack('B', 0xFF))
+
+ if FileContent.getvalue() != b'':
+ OutputRAWFile = os.path.join(GenFdsGlobalVariable.FfsDir, self.NameGuid, self.NameGuid + '.raw')
+ SaveFileOnChange(OutputRAWFile, FileContent.getvalue(), True)
+ self.FileName = OutputRAWFile
+ self.SubAlignment = self.SubAlignment[MaxAlignIndex]
+
+ if self.Alignment and self.SubAlignment:
+ if GenFdsGlobalVariable.GetAlignment (self.Alignment) < GenFdsGlobalVariable.GetAlignment (self.SubAlignment):
+ self.Alignment = self.SubAlignment
+ elif self.SubAlignment:
+ self.Alignment = self.SubAlignment
+
+ self.FileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)
+ #Replace $(SAPCE) with real space
+ self.FileName = self.FileName.replace('$(SPACE)', ' ')
+ SectionFiles = [GenFdsGlobalVariable.MacroExtend(self.FileName, Dict)]
+
+ else:
+ SectionFiles = []
+ Index = 0
+ SectionAlignments = []
+ for section in self.SectionList:
+ Index = Index + 1
+ SecIndex = '%d' %Index
+ # process the inside FvImage from FvSection or GuidSection
+ if FvChildAddr != []:
+ if isinstance(section, FvImageSection):
+ section.FvAddr = FvChildAddr.pop(0)
+ elif isinstance(section, GuidSection):
+ section.FvAddr = FvChildAddr
+ if FvParentAddr and isinstance(section, GuidSection):
+ section.FvParentAddr = FvParentAddr
+
+ if self.KeepReloc == False:
+ section.KeepReloc = False
+ sectList, align = section.GenSection(OutputDir, self.NameGuid, SecIndex, self.KeyStringList, None, Dict)
+ if sectList != []:
+ for sect in sectList:
+ SectionFiles.append(sect)
+ SectionAlignments.append(align)
+
+ #
+ # Prepare the parameter
+ #
+ FfsFileOutput = os.path.join(OutputDir, self.NameGuid + '.ffs')
+ GenFdsGlobalVariable.GenerateFfs(FfsFileOutput, SectionFiles,
+ FdfFvFileTypeToFileType.get(self.FvFileType),
+ self.NameGuid,
+ Fixed=self.Fixed,
+ CheckSum=self.CheckSum,
+ Align=self.Alignment,
+ SectionAlign=SectionAlignments
+ )
+
+ return FfsFileOutput
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/roms/edk2/BaseTools/Source/Python/GenFds/FfsInfStatement.py
new file mode 100644
index 000000000..20573ca28
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -0,0 +1,1128 @@
+## @file
+# process FFS generation from INF statement
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2014-2016 Hewlett-Packard Development Company, L.P.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from . import Rule
+import Common.LongFilePathOs as os
+from io import BytesIO
+from struct import *
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+from .Ffs import SectionSuffix,FdfFvFileTypeToFileType
+import subprocess
+import sys
+from . import Section
+from . import RuleSimpleFile
+from . import RuleComplexFile
+from CommonDataClass.FdfClass import FfsInfStatementClassObject
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+from Common.DataType import SUP_MODULE_USER_DEFINED
+from Common.DataType import SUP_MODULE_HOST_APPLICATION
+from Common.StringUtils import *
+from Common.Misc import PathClass
+from Common.Misc import GuidStructureByteArrayToGuidString
+from Common.Misc import ProcessDuplicatedInf
+from Common.Misc import GetVariableOffset
+from Common import EdkLogger
+from Common.BuildToolError import *
+from .GuidSection import GuidSection
+from .FvImageSection import FvImageSection
+from Common.Misc import PeImageClass
+from AutoGen.GenDepex import DependencyExpression
+from PatchPcdValue.PatchPcdValue import PatchBinaryFile
+from Common.LongFilePathSupport import CopyLongFilePath
+from Common.LongFilePathSupport import OpenLongFilePath as open
+import Common.GlobalData as GlobalData
+from .DepexSection import DepexSection
+from Common.Misc import SaveFileOnChange
+from Common.Expression import *
+from Common.DataType import *
+
+## generate FFS from INF
+#
+#
+class FfsInfStatement(FfsInfStatementClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ FfsInfStatementClassObject.__init__(self)
+ self.TargetOverrideList = []
+ self.ShadowFromInfFile = None
+ self.KeepRelocFromRule = None
+ self.InDsc = True
+ self.OptRomDefs = {}
+ self.PiSpecVersion = '0x00000000'
+ self.InfModule = None
+ self.FinalTargetSuffixMap = {}
+ self.CurrentLineNum = None
+ self.CurrentLineContent = None
+ self.FileName = None
+ self.InfFileName = None
+ self.OverrideGuid = None
+ self.PatchedBinFile = ''
+ self.MacroDict = {}
+ self.Depex = False
+
+ ## GetFinalTargetSuffixMap() method
+ #
+ # Get final build target list
+ def GetFinalTargetSuffixMap(self):
+ if not self.InfModule or not self.CurrentArch:
+ return []
+ if not self.FinalTargetSuffixMap:
+ FinalBuildTargetList = GenFdsGlobalVariable.GetModuleCodaTargetList(self.InfModule, self.CurrentArch)
+ for File in FinalBuildTargetList:
+ self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1], []).append(File)
+
+ # Check if current INF module has DEPEX
+ if '.depex' not in self.FinalTargetSuffixMap and self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED and self.InfModule.ModuleType != SUP_MODULE_HOST_APPLICATION \
+ and not self.InfModule.DxsFile and not self.InfModule.LibraryClass:
+ ModuleType = self.InfModule.ModuleType
+ PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+
+ if ModuleType != SUP_MODULE_USER_DEFINED and ModuleType != SUP_MODULE_HOST_APPLICATION:
+ for LibraryClass in PlatformDataBase.LibraryClasses.GetKeys():
+ if LibraryClass.startswith("NULL") and PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
+ self.InfModule.LibraryClasses[LibraryClass] = PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
+
+ StrModule = str(self.InfModule)
+ PlatformModule = None
+ if StrModule in PlatformDataBase.Modules:
+ PlatformModule = PlatformDataBase.Modules[StrModule]
+ for LibraryClass in PlatformModule.LibraryClasses:
+ if LibraryClass.startswith("NULL"):
+ self.InfModule.LibraryClasses[LibraryClass] = PlatformModule.LibraryClasses[LibraryClass]
+
+ DependencyList = [self.InfModule]
+ LibraryInstance = {}
+ DepexList = []
+ while len(DependencyList) > 0:
+ Module = DependencyList.pop(0)
+ if not Module:
+ continue
+ for Dep in Module.Depex[self.CurrentArch, ModuleType]:
+ if DepexList != []:
+ DepexList.append('AND')
+ DepexList.append('(')
+ DepexList.extend(Dep)
+ if DepexList[-1] == 'END': # no need of a END at this time
+ DepexList.pop()
+ DepexList.append(')')
+ if 'BEFORE' in DepexList or 'AFTER' in DepexList:
+ break
+ for LibName in Module.LibraryClasses:
+ if LibName in LibraryInstance:
+ continue
+ if PlatformModule and LibName in PlatformModule.LibraryClasses:
+ LibraryPath = PlatformModule.LibraryClasses[LibName]
+ else:
+ LibraryPath = PlatformDataBase.LibraryClasses[LibName, ModuleType]
+ if not LibraryPath:
+ LibraryPath = Module.LibraryClasses[LibName]
+ if not LibraryPath:
+ continue
+ LibraryModule = GenFdsGlobalVariable.WorkSpace.BuildObject[LibraryPath, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ LibraryInstance[LibName] = LibraryModule
+ DependencyList.append(LibraryModule)
+ if DepexList:
+ Dpx = DependencyExpression(DepexList, ModuleType, True)
+ if len(Dpx.PostfixNotation) != 0:
+ # It means this module has DEPEX
+ self.FinalTargetSuffixMap['.depex'] = [os.path.join(self.EfiOutputPath, self.BaseName) + '.depex']
+ return self.FinalTargetSuffixMap
+
+ ## __InfParse() method
+ #
+ # Parse inf file to get module information
+ #
+ # @param self The object pointer
+ # @param Dict dictionary contains macro and value pair
+ #
+ def __InfParse__(self, Dict = None, IsGenFfs=False):
+
+ GenFdsGlobalVariable.VerboseLogger( " Begine parsing INf file : %s" %self.InfFileName)
+
+ self.InfFileName = self.InfFileName.replace('$(WORKSPACE)', '')
+ if len(self.InfFileName) > 1 and self.InfFileName[0] == '\\' and self.InfFileName[1] == '\\':
+ pass
+ elif self.InfFileName[0] == '\\' or self.InfFileName[0] == '/' :
+ self.InfFileName = self.InfFileName[1:]
+
+ if self.InfFileName.find('$') == -1:
+ InfPath = NormPath(self.InfFileName)
+ if not os.path.exists(InfPath):
+ InfPath = GenFdsGlobalVariable.ReplaceWorkspaceMacro(InfPath)
+ if not os.path.exists(InfPath):
+ EdkLogger.error("GenFds", GENFDS_ERROR, "Non-existant Module %s !" % (self.InfFileName))
+
+ self.CurrentArch = self.GetCurrentArch()
+ #
+ # Get the InfClass object
+ #
+
+ PathClassObj = PathClass(self.InfFileName, GenFdsGlobalVariable.WorkSpaceDir)
+ ErrorCode, ErrorInfo = PathClassObj.Validate(".inf")
+ if ErrorCode != 0:
+ EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
+
+ #
+ # Cache lower case version of INF path before processing FILE_GUID override
+ #
+ InfLowerPath = str(PathClassObj).lower()
+ if self.OverrideGuid:
+ PathClassObj = ProcessDuplicatedInf(PathClassObj, self.OverrideGuid, GenFdsGlobalVariable.WorkSpaceDir)
+ if self.CurrentArch is not None:
+
+ Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassObj, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ #
+ # Set Ffs BaseName, ModuleGuid, ModuleType, Version, OutputPath
+ #
+ self.BaseName = Inf.BaseName
+ self.ModuleGuid = Inf.Guid
+ self.ModuleType = Inf.ModuleType
+ if Inf.Specification is not None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:
+ self.PiSpecVersion = Inf.Specification['PI_SPECIFICATION_VERSION']
+ if Inf.AutoGenVersion < 0x00010005:
+ self.ModuleType = Inf.ComponentType
+ self.VersionString = Inf.Version
+ self.BinFileList = Inf.Binaries
+ self.SourceFileList = Inf.Sources
+ if self.KeepReloc is None and Inf.Shadow:
+ self.ShadowFromInfFile = Inf.Shadow
+
+ else:
+ Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassObj, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ self.BaseName = Inf.BaseName
+ self.ModuleGuid = Inf.Guid
+ self.ModuleType = Inf.ModuleType
+ if Inf.Specification is not None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:
+ self.PiSpecVersion = Inf.Specification['PI_SPECIFICATION_VERSION']
+ self.VersionString = Inf.Version
+ self.BinFileList = Inf.Binaries
+ self.SourceFileList = Inf.Sources
+ if self.BinFileList == []:
+ EdkLogger.error("GenFds", GENFDS_ERROR,
+ "INF %s specified in FDF could not be found in build ARCH %s!" \
+ % (self.InfFileName, GenFdsGlobalVariable.ArchList))
+
+ if self.OverrideGuid:
+ self.ModuleGuid = self.OverrideGuid
+
+ if len(self.SourceFileList) != 0 and not self.InDsc:
+ EdkLogger.warn("GenFds", GENFDS_ERROR, "Module %s NOT found in DSC file; Is it really a binary module?" % (self.InfFileName))
+
+ if self.ModuleType == SUP_MODULE_SMM_CORE and int(self.PiSpecVersion, 16) < 0x0001000A:
+ EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.InfFileName)
+
+ if self.ModuleType == SUP_MODULE_MM_CORE_STANDALONE and int(self.PiSpecVersion, 16) < 0x00010032:
+ EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.InfFileName)
+
+ if Inf._Defs is not None and len(Inf._Defs) > 0:
+ self.OptRomDefs.update(Inf._Defs)
+
+ self.PatchPcds = []
+ InfPcds = Inf.Pcds
+ Platform = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ FdfPcdDict = GenFdsGlobalVariable.FdfParser.Profile.PcdDict
+ PlatformPcds = Platform.Pcds
+
+ # Workaround here: both build and GenFds tool convert the workspace path to lower case
+ # But INF file path in FDF and DSC file may have real case characters.
+ # Try to convert the path to lower case to see if PCDs value are override by DSC.
+ DscModules = {}
+ for DscModule in Platform.Modules:
+ DscModules[str(DscModule).lower()] = Platform.Modules[DscModule]
+ for PcdKey in InfPcds:
+ Pcd = InfPcds[PcdKey]
+ if not hasattr(Pcd, 'Offset'):
+ continue
+ if Pcd.Type != TAB_PCDS_PATCHABLE_IN_MODULE:
+ continue
+ # Override Patchable PCD value by the value from DSC
+ PatchPcd = None
+ if InfLowerPath in DscModules and PcdKey in DscModules[InfLowerPath].Pcds:
+ PatchPcd = DscModules[InfLowerPath].Pcds[PcdKey]
+ elif PcdKey in Platform.Pcds:
+ PatchPcd = Platform.Pcds[PcdKey]
+ DscOverride = False
+ if PatchPcd and Pcd.Type == PatchPcd.Type:
+ DefaultValue = PatchPcd.DefaultValue
+ DscOverride = True
+
+ # Override Patchable PCD value by the value from FDF
+ FdfOverride = False
+ if PcdKey in FdfPcdDict:
+ DefaultValue = FdfPcdDict[PcdKey]
+ FdfOverride = True
+
+ # Override Patchable PCD value by the value from Build Option
+ BuildOptionOverride = False
+ if GlobalData.BuildOptionPcd:
+ for pcd in GlobalData.BuildOptionPcd:
+ if PcdKey == (pcd[1], pcd[0]):
+ if pcd[2]:
+ continue
+ DefaultValue = pcd[3]
+ BuildOptionOverride = True
+ break
+
+ if not DscOverride and not FdfOverride and not BuildOptionOverride:
+ continue
+
+ # Support Flexible PCD format
+ if DefaultValue:
+ try:
+ DefaultValue = ValueExpressionEx(DefaultValue, Pcd.DatumType, Platform._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error("GenFds", GENFDS_ERROR, 'PCD [%s.%s] Value "%s"' %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, DefaultValue), File=self.InfFileName)
+
+ if Pcd.InfDefaultValue:
+ try:
+ Pcd.InfDefaultValue = ValueExpressionEx(Pcd.InfDefaultValue, Pcd.DatumType, Platform._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error("GenFds", GENFDS_ERROR, 'PCD [%s.%s] Value "%s"' %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.DefaultValue), File=self.InfFileName)
+
+ # Check value, if value are equal, no need to patch
+ if Pcd.DatumType == TAB_VOID:
+ if Pcd.InfDefaultValue == DefaultValue or not DefaultValue:
+ continue
+ # Get the string size from FDF or DSC
+ if DefaultValue[0] == 'L':
+ # Remove L"", but the '\0' must be appended
+ MaxDatumSize = str((len(DefaultValue) - 2) * 2)
+ elif DefaultValue[0] == '{':
+ MaxDatumSize = str(len(DefaultValue.split(',')))
+ else:
+ MaxDatumSize = str(len(DefaultValue) - 1)
+ if DscOverride:
+ Pcd.MaxDatumSize = PatchPcd.MaxDatumSize
+ # If no defined the maximum size in DSC, try to get current size from INF
+ if not Pcd.MaxDatumSize:
+ Pcd.MaxDatumSize = str(len(Pcd.InfDefaultValue.split(',')))
+ else:
+ Base1 = Base2 = 10
+ if Pcd.InfDefaultValue.upper().startswith('0X'):
+ Base1 = 16
+ if DefaultValue.upper().startswith('0X'):
+ Base2 = 16
+ try:
+ PcdValueInImg = int(Pcd.InfDefaultValue, Base1)
+ PcdValueInDscOrFdf = int(DefaultValue, Base2)
+ if PcdValueInImg == PcdValueInDscOrFdf:
+ continue
+ except:
+ continue
+ # Check the Pcd size and data type
+ if Pcd.DatumType == TAB_VOID:
+ if int(MaxDatumSize) > int(Pcd.MaxDatumSize):
+ EdkLogger.error("GenFds", GENFDS_ERROR, "The size of VOID* type PCD '%s.%s' exceeds its maximum size %d bytes." \
+ % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, int(MaxDatumSize) - int(Pcd.MaxDatumSize)))
+ else:
+ if PcdValueInDscOrFdf > MAX_VAL_TYPE[Pcd.DatumType] \
+ or PcdValueInImg > MAX_VAL_TYPE[Pcd.DatumType]:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "The size of %s type PCD '%s.%s' doesn't match its data type." \
+ % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
+ self.PatchPcds.append((Pcd, DefaultValue))
+
+ self.InfModule = Inf
+ self.PcdIsDriver = Inf.PcdIsDriver
+ self.IsBinaryModule = Inf.IsBinaryModule
+ if len(Inf.Depex.data) > 0 and len(Inf.DepexExpression.data) > 0:
+ self.Depex = True
+
+ GenFdsGlobalVariable.VerboseLogger("BaseName : %s" % self.BaseName)
+ GenFdsGlobalVariable.VerboseLogger("ModuleGuid : %s" % self.ModuleGuid)
+ GenFdsGlobalVariable.VerboseLogger("ModuleType : %s" % self.ModuleType)
+ GenFdsGlobalVariable.VerboseLogger("VersionString : %s" % self.VersionString)
+ GenFdsGlobalVariable.VerboseLogger("InfFileName :%s" % self.InfFileName)
+
+ #
+ # Set OutputPath = ${WorkSpace}\Build\Fv\Ffs\${ModuleGuid}+ ${ModuleName}\
+ #
+ if IsGenFfs:
+ Rule = self.__GetRule__()
+ if GlobalData.gGuidPatternEnd.match(Rule.NameGuid):
+ self.ModuleGuid = Rule.NameGuid
+ self.OutputPath = os.path.join(GenFdsGlobalVariable.FfsDir, \
+ self.ModuleGuid + self.BaseName)
+ if not os.path.exists(self.OutputPath) :
+ os.makedirs(self.OutputPath)
+
+ self.EfiOutputPath, self.EfiDebugPath = self.__GetEFIOutPutPath__()
+ GenFdsGlobalVariable.VerboseLogger( "ModuelEFIPath: " + self.EfiOutputPath)
+
+ ## PatchEfiFile
+ #
+ # Patch EFI file with patch PCD
+ #
+ # @param EfiFile: EFI file needs to be patched.
+ # @retval: Full path of patched EFI file: self.OutputPath + EfiFile base name
+ # If passed in file does not end with efi, return as is
+ #
+ def PatchEfiFile(self, EfiFile, FileType):
+ #
+ # If the module does not have any patches, then return path to input file
+ #
+ if not self.PatchPcds:
+ return EfiFile
+
+ #
+ # Only patch file if FileType is PE32 or ModuleType is USER_DEFINED
+ #
+ if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType != SUP_MODULE_USER_DEFINED and self.ModuleType != SUP_MODULE_HOST_APPLICATION:
+ return EfiFile
+
+ #
+ # Generate path to patched output file
+ #
+ Basename = os.path.basename(EfiFile)
+ Output = os.path.normpath (os.path.join(self.OutputPath, Basename))
+
+ #
+ # If this file has already been patched, then return the path to the patched file
+ #
+ if self.PatchedBinFile == Output:
+ return Output
+
+ #
+ # If a different file from the same module has already been patched, then generate an error
+ #
+ if self.PatchedBinFile:
+ EdkLogger.error("GenFds", GENFDS_ERROR,
+ 'Only one binary file can be patched:\n'
+ ' a binary file has been patched: %s\n'
+ ' current file: %s' % (self.PatchedBinFile, EfiFile),
+ File=self.InfFileName)
+
+ #
+ # Copy unpatched file contents to output file location to perform patching
+ #
+ CopyLongFilePath(EfiFile, Output)
+
+ #
+ # Apply patches to patched output file
+ #
+ for Pcd, Value in self.PatchPcds:
+ RetVal, RetStr = PatchBinaryFile(Output, int(Pcd.Offset, 0), Pcd.DatumType, Value, Pcd.MaxDatumSize)
+ if RetVal:
+ EdkLogger.error("GenFds", GENFDS_ERROR, RetStr, File=self.InfFileName)
+
+ #
+ # Save the path of the patched output file
+ #
+ self.PatchedBinFile = Output
+
+ #
+ # Return path to patched output file
+ #
+ return Output
+
+ ## GenFfs() method
+ #
+ # Generate FFS
+ #
+ # @param self The object pointer
+ # @param Dict dictionary contains macro and value pair
+ # @param FvChildAddr Array of the inside FvImage base address
+ # @param FvParentAddr Parent Fv base address
+ # @retval string Generated FFS file name
+ #
+ def GenFfs(self, Dict = None, FvChildAddr = [], FvParentAddr=None, IsMakefile=False, FvName=None):
+ #
+ # Parse Inf file get Module related information
+ #
+ if Dict is None:
+ Dict = {}
+ self.__InfParse__(Dict, IsGenFfs=True)
+ Arch = self.GetCurrentArch()
+ SrcFile = mws.join( GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName);
+ DestFile = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs')
+
+ SrcFileDir = "."
+ SrcPath = os.path.dirname(SrcFile)
+ SrcFileName = os.path.basename(SrcFile)
+ SrcFileBase, SrcFileExt = os.path.splitext(SrcFileName)
+ DestPath = os.path.dirname(DestFile)
+ DestFileName = os.path.basename(DestFile)
+ DestFileBase, DestFileExt = os.path.splitext(DestFileName)
+ self.MacroDict = {
+ # source file
+ "${src}" : SrcFile,
+ "${s_path}" : SrcPath,
+ "${s_dir}" : SrcFileDir,
+ "${s_name}" : SrcFileName,
+ "${s_base}" : SrcFileBase,
+ "${s_ext}" : SrcFileExt,
+ # destination file
+ "${dst}" : DestFile,
+ "${d_path}" : DestPath,
+ "${d_name}" : DestFileName,
+ "${d_base}" : DestFileBase,
+ "${d_ext}" : DestFileExt
+ }
+ #
+ # Allow binary type module not specify override rule in FDF file.
+ #
+ if len(self.BinFileList) > 0:
+ if self.Rule is None or self.Rule == "":
+ self.Rule = "BINARY"
+
+ if not IsMakefile and GenFdsGlobalVariable.EnableGenfdsMultiThread and self.Rule != 'BINARY':
+ IsMakefile = True
+ #
+ # Get the rule of how to generate Ffs file
+ #
+ Rule = self.__GetRule__()
+ GenFdsGlobalVariable.VerboseLogger( "Packing binaries from inf file : %s" %self.InfFileName)
+ #
+ # Convert Fv File Type for PI1.1 SMM driver.
+ #
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
+ if Rule.FvFileType == 'DRIVER':
+ Rule.FvFileType = 'SMM'
+ #
+ # Framework SMM Driver has no SMM FV file type
+ #
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if Rule.FvFileType == 'SMM' or Rule.FvFileType == SUP_MODULE_SMM_CORE:
+ EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM or SMM_CORE FV file type", File=self.InfFileName)
+ #
+ # For the rule only has simpleFile
+ #
+ MakefilePath = None
+ if self.IsBinaryModule:
+ IsMakefile = False
+ if IsMakefile:
+ PathClassObj = PathClass(self.InfFileName, GenFdsGlobalVariable.WorkSpaceDir)
+ if self.OverrideGuid:
+ PathClassObj = ProcessDuplicatedInf(PathClassObj, self.OverrideGuid, GenFdsGlobalVariable.WorkSpaceDir)
+ MakefilePath = PathClassObj.Path, Arch
+ if isinstance (Rule, RuleSimpleFile.RuleSimpleFile):
+ SectionOutputList = self.__GenSimpleFileSection__(Rule, IsMakefile=IsMakefile)
+ FfsOutput = self.__GenSimpleFileFfs__(Rule, SectionOutputList, MakefilePath=MakefilePath)
+ return FfsOutput
+ #
+ # For Rule has ComplexFile
+ #
+ elif isinstance(Rule, RuleComplexFile.RuleComplexFile):
+ InputSectList, InputSectAlignments = self.__GenComplexFileSection__(Rule, FvChildAddr, FvParentAddr, IsMakefile=IsMakefile)
+ FfsOutput = self.__GenComplexFileFfs__(Rule, InputSectList, InputSectAlignments, MakefilePath=MakefilePath)
+ return FfsOutput
+
+ ## __ExtendMacro__() method
+ #
+ # Replace macro with its value
+ #
+ # @param self The object pointer
+ # @param String The string to be replaced
+ # @retval string Macro replaced string
+ #
+ def __ExtendMacro__ (self, String):
+ MacroDict = {
+ '$(INF_OUTPUT)' : self.EfiOutputPath,
+ '$(MODULE_NAME)' : self.BaseName,
+ '$(BUILD_NUMBER)': self.BuildNum,
+ '$(INF_VERSION)' : self.VersionString,
+ '$(NAMED_GUID)' : self.ModuleGuid
+ }
+ String = GenFdsGlobalVariable.MacroExtend(String, MacroDict)
+ String = GenFdsGlobalVariable.MacroExtend(String, self.MacroDict)
+ return String
+
+ ## __GetRule__() method
+ #
+ # Get correct rule for generating FFS for this INF
+ #
+ # @param self The object pointer
+ # @retval Rule Rule object
+ #
+ def __GetRule__ (self) :
+ CurrentArchList = []
+ if self.CurrentArch is None:
+ CurrentArchList = ['common']
+ else:
+ CurrentArchList.append(self.CurrentArch)
+
+ for CurrentArch in CurrentArchList:
+ RuleName = 'RULE' + \
+ '.' + \
+ CurrentArch.upper() + \
+ '.' + \
+ self.ModuleType.upper()
+ if self.Rule is not None:
+ RuleName = RuleName + \
+ '.' + \
+ self.Rule.upper()
+
+ Rule = GenFdsGlobalVariable.FdfParser.Profile.RuleDict.get(RuleName)
+ if Rule is not None:
+ GenFdsGlobalVariable.VerboseLogger ("Want To Find Rule Name is : " + RuleName)
+ return Rule
+
+ RuleName = 'RULE' + \
+ '.' + \
+ TAB_COMMON + \
+ '.' + \
+ self.ModuleType.upper()
+
+ if self.Rule is not None:
+ RuleName = RuleName + \
+ '.' + \
+ self.Rule.upper()
+
+ GenFdsGlobalVariable.VerboseLogger ('Trying to apply common rule %s for INF %s' % (RuleName, self.InfFileName))
+
+ Rule = GenFdsGlobalVariable.FdfParser.Profile.RuleDict.get(RuleName)
+ if Rule is not None:
+ GenFdsGlobalVariable.VerboseLogger ("Want To Find Rule Name is : " + RuleName)
+ return Rule
+
+ if Rule is None :
+ EdkLogger.error("GenFds", GENFDS_ERROR, 'Don\'t Find common rule %s for INF %s' \
+ % (RuleName, self.InfFileName))
+
+ ## __GetPlatformArchList__() method
+ #
+ # Get Arch list this INF built under
+ #
+ # @param self The object pointer
+ # @retval list Arch list
+ #
+ def __GetPlatformArchList__(self):
+
+ InfFileKey = os.path.normpath(mws.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName))
+ DscArchList = []
+ for Arch in GenFdsGlobalVariable.ArchList :
+ PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ if PlatformDataBase is not None:
+ if InfFileKey in PlatformDataBase.Modules:
+ DscArchList.append (Arch)
+ else:
+ #
+ # BaseTools support build same module more than once, the module path with FILE_GUID overridden has
+ # the file name FILE_GUIDmodule.inf, then PlatformDataBase.Modules use FILE_GUIDmodule.inf as key,
+ # but the path (self.MetaFile.Path) is the real path
+ #
+ for key in PlatformDataBase.Modules:
+ if InfFileKey == str((PlatformDataBase.Modules[key]).MetaFile.Path):
+ DscArchList.append (Arch)
+ break
+
+ return DscArchList
+
+ ## GetCurrentArch() method
+ #
+ # Get Arch list of the module from this INF is to be placed into flash
+ #
+ # @param self The object pointer
+ # @retval list Arch list
+ #
+ def GetCurrentArch(self) :
+
+ TargetArchList = GenFdsGlobalVariable.ArchList
+
+ PlatformArchList = self.__GetPlatformArchList__()
+
+ CurArchList = TargetArchList
+ if PlatformArchList != []:
+ CurArchList = list(set (TargetArchList) & set (PlatformArchList))
+ GenFdsGlobalVariable.VerboseLogger ("Valid target architecture(s) is : " + " ".join(CurArchList))
+
+ ArchList = []
+ if self.KeyStringList != []:
+ for Key in self.KeyStringList:
+ Key = GenFdsGlobalVariable.MacroExtend(Key)
+ Target, Tag, Arch = Key.split('_')
+ if Arch in CurArchList:
+ ArchList.append(Arch)
+ if Target not in self.TargetOverrideList:
+ self.TargetOverrideList.append(Target)
+ else:
+ ArchList = CurArchList
+
+ UseArchList = TargetArchList
+ if self.UseArch is not None:
+ UseArchList = []
+ UseArchList.append(self.UseArch)
+ ArchList = list(set (UseArchList) & set (ArchList))
+
+ self.InfFileName = NormPath(self.InfFileName)
+ if len(PlatformArchList) == 0:
+ self.InDsc = False
+ PathClassObj = PathClass(self.InfFileName, GenFdsGlobalVariable.WorkSpaceDir)
+ ErrorCode, ErrorInfo = PathClassObj.Validate(".inf")
+ if ErrorCode != 0:
+ EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
+ if len(ArchList) == 1:
+ Arch = ArchList[0]
+ return Arch
+ elif len(ArchList) > 1:
+ if len(PlatformArchList) == 0:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "GenFds command line option has multiple ARCHs %s. Not able to determine which ARCH is valid for Module %s !" % (str(ArchList), self.InfFileName))
+ else:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "Module built under multiple ARCHs %s. Not able to determine which output to put into flash for Module %s !" % (str(ArchList), self.InfFileName))
+ else:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "Module %s appears under ARCH %s in platform %s, but current deduced ARCH is %s, so NO build output could be put into flash." \
+ % (self.InfFileName, str(PlatformArchList), GenFdsGlobalVariable.ActivePlatform, str(set (UseArchList) & set (TargetArchList))))
+
+ ## __GetEFIOutPutPath__() method
+ #
+ # Get the output path for generated files
+ #
+ # @param self The object pointer
+ # @retval string Path that output files from this INF go to
+ #
+ def __GetEFIOutPutPath__(self):
+ Arch = ''
+ OutputPath = ''
+ DebugPath = ''
+ (ModulePath, FileName) = os.path.split(self.InfFileName)
+ Index = FileName.rfind('.')
+ FileName = FileName[0:Index]
+ if self.OverrideGuid:
+ FileName = self.OverrideGuid
+ Arch = "NoneArch"
+ if self.CurrentArch is not None:
+ Arch = self.CurrentArch
+
+ OutputPath = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch],
+ Arch,
+ ModulePath,
+ FileName,
+ 'OUTPUT'
+ )
+ DebugPath = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch],
+ Arch,
+ ModulePath,
+ FileName,
+ 'DEBUG'
+ )
+ OutputPath = os.path.realpath(OutputPath)
+ DebugPath = os.path.realpath(DebugPath)
+ return OutputPath, DebugPath
+
+ ## __GenSimpleFileSection__() method
+ #
+ # Generate section by specified file name or a list of files with file extension
+ #
+ # @param self The object pointer
+ # @param Rule The rule object used to generate section
+ # @retval string File name of the generated section file
+ #
+ def __GenSimpleFileSection__(self, Rule, IsMakefile = False):
+ #
+ # Prepare the parameter of GenSection
+ #
+ FileList = []
+ OutputFileList = []
+ GenSecInputFile = None
+ if Rule.FileName is not None:
+ GenSecInputFile = self.__ExtendMacro__(Rule.FileName)
+ if os.path.isabs(GenSecInputFile):
+ GenSecInputFile = os.path.normpath(GenSecInputFile)
+ else:
+ GenSecInputFile = os.path.normpath(os.path.join(self.EfiOutputPath, GenSecInputFile))
+ else:
+ FileList, IsSect = Section.Section.GetFileList(self, '', Rule.FileExtension)
+
+ Index = 1
+ SectionType = Rule.SectionType
+ #
+ # Convert Fv Section Type for PI1.1 SMM driver.
+ #
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
+ if SectionType == BINARY_FILE_TYPE_DXE_DEPEX:
+ SectionType = BINARY_FILE_TYPE_SMM_DEPEX
+ #
+ # Framework SMM Driver has no SMM_DEPEX section type
+ #
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if SectionType == BINARY_FILE_TYPE_SMM_DEPEX:
+ EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
+ NoStrip = True
+ if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):
+ if self.KeepReloc is not None:
+ NoStrip = self.KeepReloc
+ elif Rule.KeepReloc is not None:
+ NoStrip = Rule.KeepReloc
+ elif self.ShadowFromInfFile is not None:
+ NoStrip = self.ShadowFromInfFile
+
+ if FileList != [] :
+ for File in FileList:
+
+ SecNum = '%d' %Index
+ GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \
+ SectionSuffix[SectionType] + SUP_MODULE_SEC + SecNum
+ Index = Index + 1
+ OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)
+ File = GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch)
+
+ #Get PE Section alignment when align is set to AUTO
+ if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE):
+ ImageObj = PeImageClass (File)
+ if ImageObj.SectionAlignment < 0x400:
+ self.Alignment = str (ImageObj.SectionAlignment)
+ elif ImageObj.SectionAlignment < 0x100000:
+ self.Alignment = str (ImageObj.SectionAlignment // 0x400) + 'K'
+ else:
+ self.Alignment = str (ImageObj.SectionAlignment // 0x100000) + 'M'
+
+ if not NoStrip:
+ FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc')
+ if not os.path.exists(FileBeforeStrip) or \
+ (os.path.getmtime(File) > os.path.getmtime(FileBeforeStrip)):
+ CopyLongFilePath(File, FileBeforeStrip)
+ StrippedFile = os.path.join(self.OutputPath, ModuleName + '.stipped')
+ GenFdsGlobalVariable.GenerateFirmwareImage(
+ StrippedFile,
+ [File],
+ Strip=True,
+ IsMakefile=IsMakefile
+ )
+ File = StrippedFile
+
+ if SectionType == BINARY_FILE_TYPE_TE:
+ TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')
+ GenFdsGlobalVariable.GenerateFirmwareImage(
+ TeFile,
+ [File],
+ Type='te',
+ IsMakefile=IsMakefile
+ )
+ File = TeFile
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [File], Section.Section.SectionType[SectionType], IsMakefile=IsMakefile)
+ OutputFileList.append(OutputFile)
+ else:
+ SecNum = '%d' %Index
+ GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \
+ SectionSuffix[SectionType] + SUP_MODULE_SEC + SecNum
+ OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)
+ GenSecInputFile = GenFdsGlobalVariable.MacroExtend(GenSecInputFile, Dict, self.CurrentArch)
+
+ #Get PE Section alignment when align is set to AUTO
+ if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE):
+ ImageObj = PeImageClass (GenSecInputFile)
+ if ImageObj.SectionAlignment < 0x400:
+ self.Alignment = str (ImageObj.SectionAlignment)
+ elif ImageObj.SectionAlignment < 0x100000:
+ self.Alignment = str (ImageObj.SectionAlignment // 0x400) + 'K'
+ else:
+ self.Alignment = str (ImageObj.SectionAlignment // 0x100000) + 'M'
+
+ if not NoStrip:
+ FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc')
+ if not os.path.exists(FileBeforeStrip) or \
+ (os.path.getmtime(GenSecInputFile) > os.path.getmtime(FileBeforeStrip)):
+ CopyLongFilePath(GenSecInputFile, FileBeforeStrip)
+
+ StrippedFile = os.path.join(self.OutputPath, ModuleName + '.stipped')
+ GenFdsGlobalVariable.GenerateFirmwareImage(
+ StrippedFile,
+ [GenSecInputFile],
+ Strip=True,
+ IsMakefile=IsMakefile
+ )
+ GenSecInputFile = StrippedFile
+
+ if SectionType == BINARY_FILE_TYPE_TE:
+ TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')
+ GenFdsGlobalVariable.GenerateFirmwareImage(
+ TeFile,
+ [GenSecInputFile],
+ Type='te',
+ IsMakefile=IsMakefile
+ )
+ GenSecInputFile = TeFile
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [GenSecInputFile], Section.Section.SectionType[SectionType], IsMakefile=IsMakefile)
+ OutputFileList.append(OutputFile)
+
+ return OutputFileList
+
+ ## __GenSimpleFileFfs__() method
+ #
+ # Generate FFS
+ #
+ # @param self The object pointer
+ # @param Rule The rule object used to generate section
+ # @param InputFileList The output file list from GenSection
+ # @retval string Generated FFS file name
+ #
+ def __GenSimpleFileFfs__(self, Rule, InputFileList, MakefilePath = None):
+ FfsOutput = self.OutputPath + \
+ os.sep + \
+ self.__ExtendMacro__(Rule.NameGuid) + \
+ '.ffs'
+
+ GenFdsGlobalVariable.VerboseLogger(self.__ExtendMacro__(Rule.NameGuid))
+ InputSection = []
+ SectionAlignments = []
+ for InputFile in InputFileList:
+ InputSection.append(InputFile)
+ SectionAlignments.append(Rule.SectAlignment)
+
+ if Rule.NameGuid is not None and Rule.NameGuid.startswith('PCD('):
+ PcdValue = GenFdsGlobalVariable.GetPcdValue(Rule.NameGuid)
+ if len(PcdValue) == 0:
+ EdkLogger.error("GenFds", GENFDS_ERROR, '%s NOT defined.' \
+ % (Rule.NameGuid))
+ if PcdValue.startswith('{'):
+ PcdValue = GuidStructureByteArrayToGuidString(PcdValue)
+ RegistryGuidStr = PcdValue
+ if len(RegistryGuidStr) == 0:
+ EdkLogger.error("GenFds", GENFDS_ERROR, 'GUID value for %s in wrong format.' \
+ % (Rule.NameGuid))
+ self.ModuleGuid = RegistryGuidStr
+
+ GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputSection,
+ FdfFvFileTypeToFileType[Rule.FvFileType],
+ self.ModuleGuid, Fixed=Rule.Fixed,
+ CheckSum=Rule.CheckSum, Align=Rule.Alignment,
+ SectionAlign=SectionAlignments,
+ MakefilePath=MakefilePath
+ )
+ return FfsOutput
+
+ ## __GenComplexFileSection__() method
+ #
+ # Generate section by sections in Rule
+ #
+ # @param self The object pointer
+ # @param Rule The rule object used to generate section
+ # @param FvChildAddr Array of the inside FvImage base address
+ # @param FvParentAddr Parent Fv base address
+ # @retval string File name of the generated section file
+ #
+ def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, IsMakefile = False):
+ if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_MM_CORE_STANDALONE):
+ if Rule.KeepReloc is not None:
+ self.KeepRelocFromRule = Rule.KeepReloc
+ SectFiles = []
+ SectAlignments = []
+ Index = 1
+ HasGeneratedFlag = False
+ if self.PcdIsDriver == 'PEI_PCD_DRIVER':
+ if self.IsBinaryModule:
+ PcdExDbFileName = os.path.join(GenFdsGlobalVariable.FvDir, "PEIPcdDataBase.raw")
+ else:
+ PcdExDbFileName = os.path.join(self.EfiOutputPath, "PEIPcdDataBase.raw")
+ PcdExDbSecName = os.path.join(self.OutputPath, "PEIPcdDataBaseSec.raw")
+ GenFdsGlobalVariable.GenerateSection(PcdExDbSecName,
+ [PcdExDbFileName],
+ "EFI_SECTION_RAW",
+ IsMakefile = IsMakefile
+ )
+ SectFiles.append(PcdExDbSecName)
+ SectAlignments.append(None)
+ elif self.PcdIsDriver == 'DXE_PCD_DRIVER':
+ if self.IsBinaryModule:
+ PcdExDbFileName = os.path.join(GenFdsGlobalVariable.FvDir, "DXEPcdDataBase.raw")
+ else:
+ PcdExDbFileName = os.path.join(self.EfiOutputPath, "DXEPcdDataBase.raw")
+ PcdExDbSecName = os.path.join(self.OutputPath, "DXEPcdDataBaseSec.raw")
+ GenFdsGlobalVariable.GenerateSection(PcdExDbSecName,
+ [PcdExDbFileName],
+ "EFI_SECTION_RAW",
+ IsMakefile = IsMakefile
+ )
+ SectFiles.append(PcdExDbSecName)
+ SectAlignments.append(None)
+ for Sect in Rule.SectionList:
+ SecIndex = '%d' %Index
+ SectList = []
+ #
+ # Convert Fv Section Type for PI1.1 SMM driver.
+ #
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:
+ if Sect.SectionType == BINARY_FILE_TYPE_DXE_DEPEX:
+ Sect.SectionType = BINARY_FILE_TYPE_SMM_DEPEX
+ #
+ # Framework SMM Driver has no SMM_DEPEX section type
+ #
+ if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:
+ if Sect.SectionType == BINARY_FILE_TYPE_SMM_DEPEX:
+ EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
+ #
+ # process the inside FvImage from FvSection or GuidSection
+ #
+ if FvChildAddr != []:
+ if isinstance(Sect, FvImageSection):
+ Sect.FvAddr = FvChildAddr.pop(0)
+ elif isinstance(Sect, GuidSection):
+ Sect.FvAddr = FvChildAddr
+ if FvParentAddr is not None and isinstance(Sect, GuidSection):
+ Sect.FvParentAddr = FvParentAddr
+
+ if Rule.KeyStringList != []:
+ SectList, Align = Sect.GenSection(self.OutputPath, self.ModuleGuid, SecIndex, Rule.KeyStringList, self, IsMakefile = IsMakefile)
+ else :
+ SectList, Align = Sect.GenSection(self.OutputPath, self.ModuleGuid, SecIndex, self.KeyStringList, self, IsMakefile = IsMakefile)
+
+ if not HasGeneratedFlag:
+ UniVfrOffsetFileSection = ""
+ ModuleFileName = mws.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName)
+ InfData = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(ModuleFileName), self.CurrentArch]
+ #
+ # Search the source list in InfData to find if there are .vfr file exist.
+ #
+ VfrUniBaseName = {}
+ VfrUniOffsetList = []
+ for SourceFile in InfData.Sources:
+ if SourceFile.Type.upper() == ".VFR" :
+ #
+ # search the .map file to find the offset of vfr binary in the PE32+/TE file.
+ #
+ VfrUniBaseName[SourceFile.BaseName] = (SourceFile.BaseName + "Bin")
+ if SourceFile.Type.upper() == ".UNI" :
+ #
+ # search the .map file to find the offset of Uni strings binary in the PE32+/TE file.
+ #
+ VfrUniBaseName["UniOffsetName"] = (self.BaseName + "Strings")
+
+
+ if len(VfrUniBaseName) > 0:
+ if IsMakefile:
+ if InfData.BuildType != 'UEFI_HII':
+ UniVfrOffsetFileName = os.path.join(self.OutputPath, self.BaseName + '.offset')
+ UniVfrOffsetFileSection = os.path.join(self.OutputPath, self.BaseName + 'Offset' + '.raw')
+ UniVfrOffsetFileNameList = []
+ UniVfrOffsetFileNameList.append(UniVfrOffsetFileName)
+ TrimCmd = "Trim --Vfr-Uni-Offset -o %s --ModuleName=%s --DebugDir=%s " % (UniVfrOffsetFileName, self.BaseName, self.EfiDebugPath)
+ GenFdsGlobalVariable.SecCmdList.append(TrimCmd)
+ GenFdsGlobalVariable.GenerateSection(UniVfrOffsetFileSection,
+ [UniVfrOffsetFileName],
+ "EFI_SECTION_RAW",
+ IsMakefile = True
+ )
+ else:
+ VfrUniOffsetList = self.__GetBuildOutputMapFileVfrUniInfo(VfrUniBaseName)
+ #
+ # Generate the Raw data of raw section
+ #
+ if VfrUniOffsetList:
+ UniVfrOffsetFileName = os.path.join(self.OutputPath, self.BaseName + '.offset')
+ UniVfrOffsetFileSection = os.path.join(self.OutputPath, self.BaseName + 'Offset' + '.raw')
+ FfsInfStatement.__GenUniVfrOffsetFile (VfrUniOffsetList, UniVfrOffsetFileName)
+ UniVfrOffsetFileNameList = []
+ UniVfrOffsetFileNameList.append(UniVfrOffsetFileName)
+ """Call GenSection"""
+
+ GenFdsGlobalVariable.GenerateSection(UniVfrOffsetFileSection,
+ UniVfrOffsetFileNameList,
+ "EFI_SECTION_RAW"
+ )
+ #os.remove(UniVfrOffsetFileName)
+ if UniVfrOffsetFileSection:
+ SectList.append(UniVfrOffsetFileSection)
+ HasGeneratedFlag = True
+
+ for SecName in SectList :
+ SectFiles.append(SecName)
+ SectAlignments.append(Align)
+ Index = Index + 1
+ return SectFiles, SectAlignments
+
+ ## __GenComplexFileFfs__() method
+ #
+ # Generate FFS
+ #
+ # @param self The object pointer
+ # @param Rule The rule object used to generate section
+ # @param InputFileList The output file list from GenSection
+ # @retval string Generated FFS file name
+ #
+ def __GenComplexFileFfs__(self, Rule, InputFile, Alignments, MakefilePath = None):
+
+ if Rule.NameGuid is not None and Rule.NameGuid.startswith('PCD('):
+ PcdValue = GenFdsGlobalVariable.GetPcdValue(Rule.NameGuid)
+ if len(PcdValue) == 0:
+ EdkLogger.error("GenFds", GENFDS_ERROR, '%s NOT defined.' \
+ % (Rule.NameGuid))
+ if PcdValue.startswith('{'):
+ PcdValue = GuidStructureByteArrayToGuidString(PcdValue)
+ RegistryGuidStr = PcdValue
+ if len(RegistryGuidStr) == 0:
+ EdkLogger.error("GenFds", GENFDS_ERROR, 'GUID value for %s in wrong format.' \
+ % (Rule.NameGuid))
+ self.ModuleGuid = RegistryGuidStr
+
+ FfsOutput = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs')
+ GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputFile,
+ FdfFvFileTypeToFileType[Rule.FvFileType],
+ self.ModuleGuid, Fixed=Rule.Fixed,
+ CheckSum=Rule.CheckSum, Align=Rule.Alignment,
+ SectionAlign=Alignments,
+ MakefilePath=MakefilePath
+ )
+ return FfsOutput
+
+ ## __GetBuildOutputMapFileVfrUniInfo() method
+ #
+ # Find the offset of UNI/INF object offset in the EFI image file.
+ #
+ # @param self The object pointer
+ # @param VfrUniBaseName A name list contain the UNI/INF object name.
+ # @retval RetValue A list contain offset of UNI/INF object.
+ #
+ def __GetBuildOutputMapFileVfrUniInfo(self, VfrUniBaseName):
+ MapFileName = os.path.join(self.EfiOutputPath, self.BaseName + ".map")
+ EfiFileName = os.path.join(self.EfiOutputPath, self.BaseName + ".efi")
+ return GetVariableOffset(MapFileName, EfiFileName, list(VfrUniBaseName.values()))
+
+ ## __GenUniVfrOffsetFile() method
+ #
+ # Generate the offset file for the module which contain VFR or UNI file.
+ #
+ # @param VfrUniOffsetList A list contain the VFR/UNI offsets in the EFI image file.
+ # @param UniVfrOffsetFileName The output offset file name.
+ #
+ @staticmethod
+ def __GenUniVfrOffsetFile(VfrUniOffsetList, UniVfrOffsetFileName):
+
+ # Use a instance of StringIO to cache data
+ fStringIO = BytesIO()
+
+ for Item in VfrUniOffsetList:
+ if (Item[0].find("Strings") != -1):
+ #
+ # UNI offset in image.
+ # GUID + Offset
+ # { 0x8913c5e0, 0x33f6, 0x4d86, { 0x9b, 0xf1, 0x43, 0xef, 0x89, 0xfc, 0x6, 0x66 } }
+ #
+ UniGuid = b'\xe0\xc5\x13\x89\xf63\x86M\x9b\xf1C\xef\x89\xfc\x06f'
+ fStringIO.write(UniGuid)
+ UniValue = pack ('Q', int (Item[1], 16))
+ fStringIO.write (UniValue)
+ else:
+ #
+ # VFR binary offset in image.
+ # GUID + Offset
+ # { 0xd0bc7cb4, 0x6a47, 0x495f, { 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2 } };
+ #
+ VfrGuid = b'\xb4|\xbc\xd0Gj_I\xaa\x11q\x07F\xda\x06\xa2'
+ fStringIO.write(VfrGuid)
+ type (Item[1])
+ VfrValue = pack ('Q', int (Item[1], 16))
+ fStringIO.write (VfrValue)
+
+ #
+ # write data into file.
+ #
+ try :
+ SaveFileOnChange(UniVfrOffsetFileName, fStringIO.getvalue())
+ except:
+ EdkLogger.error("GenFds", FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the file been locked or using by other applications." %UniVfrOffsetFileName, None)
+
+ fStringIO.close ()
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/Fv.py b/roms/edk2/BaseTools/Source/Python/GenFds/Fv.py
new file mode 100644
index 000000000..16c944a0b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/Fv.py
@@ -0,0 +1,431 @@
+## @file
+# process FV generation
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.LongFilePathOs as os
+import subprocess
+from io import BytesIO
+from struct import *
+from . import FfsFileStatement
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+from Common.Misc import SaveFileOnChange, PackGUID
+from Common.LongFilePathSupport import CopyLongFilePath
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.DataType import *
+
+FV_UI_EXT_ENTY_GUID = 'A67DF1FA-8DE8-4E98-AF09-4BDF2EFFBC7C'
+
+## generate FV
+#
+#
+class FV (object):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self, Name=None):
+ self.UiFvName = Name
+ self.CreateFileName = None
+ self.BlockSizeList = []
+ self.DefineVarDict = {}
+ self.SetVarDict = {}
+ self.FvAlignment = None
+ self.FvAttributeDict = {}
+ self.FvNameGuid = None
+ self.FvNameString = None
+ self.AprioriSectionList = []
+ self.FfsList = []
+ self.BsBaseAddress = None
+ self.RtBaseAddress = None
+ self.FvInfFile = None
+ self.FvAddressFile = None
+ self.BaseAddress = None
+ self.InfFileName = None
+ self.FvAddressFileName = None
+ self.CapsuleName = None
+ self.FvBaseAddress = None
+ self.FvForceRebase = None
+ self.FvRegionInFD = None
+ self.UsedSizeEnable = False
+ self.FvExtEntryTypeValue = []
+ self.FvExtEntryType = []
+ self.FvExtEntryData = []
+ ## AddToBuffer()
+ #
+ # Generate Fv and add it to the Buffer
+ #
+ # @param self The object pointer
+ # @param Buffer The buffer generated FV data will be put
+ # @param BaseAddress base address of FV
+ # @param BlockSize block size of FV
+ # @param BlockNum How many blocks in FV
+ # @param ErasePolarity Flash erase polarity
+ # @param MacroDict macro value pair
+ # @retval string Generated FV file path
+ #
+ def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', MacroDict = None, Flag=False):
+ if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFdsGlobalVariable.ImageBinDict:
+ return GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 'fv']
+ if MacroDict is None:
+ MacroDict = {}
+
+ #
+ # Check whether FV in Capsule is in FD flash region.
+ # If yes, return error. Doesn't support FV in Capsule image is also in FD flash region.
+ #
+ if self.CapsuleName is not None:
+ for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
+ for RegionObj in FdObj.RegionList:
+ if RegionObj.RegionType == BINARY_FILE_TYPE_FV:
+ for RegionData in RegionObj.RegionDataList:
+ if RegionData.endswith(".fv"):
+ continue
+ elif RegionData.upper() + 'fv' in GenFdsGlobalVariable.ImageBinDict:
+ continue
+ elif self.UiFvName.upper() == RegionData.upper():
+ GenFdsGlobalVariable.ErrorLogger("Capsule %s in FD region can't contain a FV %s in FD region." % (self.CapsuleName, self.UiFvName.upper()))
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger( "\nGenerating %s FV" %self.UiFvName)
+ GenFdsGlobalVariable.LargeFileInFvFlags.append(False)
+ FFSGuid = None
+
+ if self.FvBaseAddress is not None:
+ BaseAddress = self.FvBaseAddress
+ if not Flag:
+ self._InitializeInf(BaseAddress, BlockSize, BlockNum, ErasePloarity)
+ #
+ # First Process the Apriori section
+ #
+ MacroDict.update(self.DefineVarDict)
+
+ GenFdsGlobalVariable.VerboseLogger('First generate Apriori file !')
+ FfsFileList = []
+ for AprSection in self.AprioriSectionList:
+ FileName = AprSection.GenFfs (self.UiFvName, MacroDict, IsMakefile=Flag)
+ FfsFileList.append(FileName)
+ # Add Apriori file name to Inf file
+ if not Flag:
+ self.FvInfFile.append("EFI_FILE_NAME = " + \
+ FileName + \
+ TAB_LINE_BREAK)
+
+ # Process Modules in FfsList
+ for FfsFile in self.FfsList:
+ if Flag:
+ if isinstance(FfsFile, FfsFileStatement.FileStatement):
+ continue
+ if GenFdsGlobalVariable.EnableGenfdsMultiThread and GenFdsGlobalVariable.ModuleFile and GenFdsGlobalVariable.ModuleFile.Path.find(os.path.normpath(FfsFile.InfFileName)) == -1:
+ continue
+ FileName = FfsFile.GenFfs(MacroDict, FvParentAddr=BaseAddress, IsMakefile=Flag, FvName=self.UiFvName)
+ FfsFileList.append(FileName)
+ if not Flag:
+ self.FvInfFile.append("EFI_FILE_NAME = " + \
+ FileName + \
+ TAB_LINE_BREAK)
+ if not Flag:
+ FvInfFile = ''.join(self.FvInfFile)
+ SaveFileOnChange(self.InfFileName, FvInfFile, False)
+ #
+ # Call GenFv tool
+ #
+ FvOutputFile = os.path.join(GenFdsGlobalVariable.FvDir, self.UiFvName)
+ FvOutputFile = FvOutputFile + '.Fv'
+ # BUGBUG: FvOutputFile could be specified from FDF file (FV section, CreateFile statement)
+ if self.CreateFileName is not None:
+ FvOutputFile = self.CreateFileName
+
+ if Flag:
+ GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
+ return FvOutputFile
+
+ FvInfoFileName = os.path.join(GenFdsGlobalVariable.FfsDir, self.UiFvName + '.inf')
+ if not Flag:
+ CopyLongFilePath(GenFdsGlobalVariable.FvAddressFileName, FvInfoFileName)
+ OrigFvInfo = None
+ if os.path.exists (FvInfoFileName):
+ OrigFvInfo = open(FvInfoFileName, 'r').read()
+ if GenFdsGlobalVariable.LargeFileInFvFlags[-1]:
+ FFSGuid = GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID
+ GenFdsGlobalVariable.GenerateFirmwareVolume(
+ FvOutputFile,
+ [self.InfFileName],
+ AddressFile=FvInfoFileName,
+ FfsList=FfsFileList,
+ ForceRebase=self.FvForceRebase,
+ FileSystemGuid=FFSGuid
+ )
+
+ NewFvInfo = None
+ if os.path.exists (FvInfoFileName):
+ NewFvInfo = open(FvInfoFileName, 'r').read()
+ if NewFvInfo is not None and NewFvInfo != OrigFvInfo:
+ FvChildAddr = []
+ AddFileObj = open(FvInfoFileName, 'r')
+ AddrStrings = AddFileObj.readlines()
+ AddrKeyFound = False
+ for AddrString in AddrStrings:
+ if AddrKeyFound:
+ #get base address for the inside FvImage
+ FvChildAddr.append (AddrString)
+ elif AddrString.find ("[FV_BASE_ADDRESS]") != -1:
+ AddrKeyFound = True
+ AddFileObj.close()
+
+ if FvChildAddr != []:
+ # Update Ffs again
+ for FfsFile in self.FfsList:
+ FileName = FfsFile.GenFfs(MacroDict, FvChildAddr, BaseAddress, IsMakefile=Flag, FvName=self.UiFvName)
+
+ if GenFdsGlobalVariable.LargeFileInFvFlags[-1]:
+ FFSGuid = GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID;
+ #Update GenFv again
+ GenFdsGlobalVariable.GenerateFirmwareVolume(
+ FvOutputFile,
+ [self.InfFileName],
+ AddressFile=FvInfoFileName,
+ FfsList=FfsFileList,
+ ForceRebase=self.FvForceRebase,
+ FileSystemGuid=FFSGuid
+ )
+
+ #
+ # Write the Fv contents to Buffer
+ #
+ if os.path.isfile(FvOutputFile) and os.path.getsize(FvOutputFile) >= 0x48:
+ FvFileObj = open(FvOutputFile, 'rb')
+ # PI FvHeader is 0x48 byte
+ FvHeaderBuffer = FvFileObj.read(0x48)
+ Signature = FvHeaderBuffer[0x28:0x32]
+ if Signature and Signature.startswith(b'_FVH'):
+ GenFdsGlobalVariable.VerboseLogger("\nGenerate %s FV Successfully" % self.UiFvName)
+ GenFdsGlobalVariable.SharpCounter = 0
+
+ FvFileObj.seek(0)
+ Buffer.write(FvFileObj.read())
+ # FV alignment position.
+ FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E:0x2F]) & 0x1F)
+ if FvAlignmentValue >= 0x400:
+ if FvAlignmentValue >= 0x100000:
+ if FvAlignmentValue >= 0x1000000:
+ #The max alignment supported by FFS is 16M.
+ self.FvAlignment = "16M"
+ else:
+ self.FvAlignment = str(FvAlignmentValue // 0x100000) + "M"
+ else:
+ self.FvAlignment = str(FvAlignmentValue // 0x400) + "K"
+ else:
+ # FvAlignmentValue is less than 1K
+ self.FvAlignment = str (FvAlignmentValue)
+ FvFileObj.close()
+ GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
+ GenFdsGlobalVariable.LargeFileInFvFlags.pop()
+ else:
+ GenFdsGlobalVariable.ErrorLogger("Invalid FV file %s." % self.UiFvName)
+ else:
+ GenFdsGlobalVariable.ErrorLogger("Failed to generate %s FV file." %self.UiFvName)
+ return FvOutputFile
+
+ ## _GetBlockSize()
+ #
+ # Calculate FV's block size
+ # Inherit block size from FD if no block size specified in FV
+ #
+ def _GetBlockSize(self):
+ if self.BlockSizeList:
+ return True
+
+ for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
+ for RegionObj in FdObj.RegionList:
+ if RegionObj.RegionType != BINARY_FILE_TYPE_FV:
+ continue
+ for RegionData in RegionObj.RegionDataList:
+ #
+ # Found the FD and region that contain this FV
+ #
+ if self.UiFvName.upper() == RegionData.upper():
+ RegionObj.BlockInfoOfRegion(FdObj.BlockSizeList, self)
+ if self.BlockSizeList:
+ return True
+ return False
+
+ ## _InitializeInf()
+ #
+ # Initialize the inf file to create FV
+ #
+ # @param self The object pointer
+ # @param BaseAddress base address of FV
+ # @param BlockSize block size of FV
+ # @param BlockNum How many blocks in FV
+ # @param ErasePolarity Flash erase polarity
+ #
+ def _InitializeInf (self, BaseAddress = None, BlockSize= None, BlockNum = None, ErasePloarity='1'):
+ #
+ # Create FV inf file
+ #
+ self.InfFileName = os.path.join(GenFdsGlobalVariable.FvDir,
+ self.UiFvName + '.inf')
+ self.FvInfFile = []
+
+ #
+ # Add [Options]
+ #
+ self.FvInfFile.append("[options]" + TAB_LINE_BREAK)
+ if BaseAddress is not None:
+ self.FvInfFile.append("EFI_BASE_ADDRESS = " + \
+ BaseAddress + \
+ TAB_LINE_BREAK)
+
+ if BlockSize is not None:
+ self.FvInfFile.append("EFI_BLOCK_SIZE = " + \
+ '0x%X' %BlockSize + \
+ TAB_LINE_BREAK)
+ if BlockNum is not None:
+ self.FvInfFile.append("EFI_NUM_BLOCKS = " + \
+ ' 0x%X' %BlockNum + \
+ TAB_LINE_BREAK)
+ else:
+ if self.BlockSizeList == []:
+ if not self._GetBlockSize():
+ #set default block size is 1
+ self.FvInfFile.append("EFI_BLOCK_SIZE = 0x1" + TAB_LINE_BREAK)
+
+ for BlockSize in self.BlockSizeList:
+ if BlockSize[0] is not None:
+ self.FvInfFile.append("EFI_BLOCK_SIZE = " + \
+ '0x%X' %BlockSize[0] + \
+ TAB_LINE_BREAK)
+
+ if BlockSize[1] is not None:
+ self.FvInfFile.append("EFI_NUM_BLOCKS = " + \
+ ' 0x%X' %BlockSize[1] + \
+ TAB_LINE_BREAK)
+
+ if self.BsBaseAddress is not None:
+ self.FvInfFile.append('EFI_BOOT_DRIVER_BASE_ADDRESS = ' + \
+ '0x%X' %self.BsBaseAddress)
+ if self.RtBaseAddress is not None:
+ self.FvInfFile.append('EFI_RUNTIME_DRIVER_BASE_ADDRESS = ' + \
+ '0x%X' %self.RtBaseAddress)
+ #
+ # Add attribute
+ #
+ self.FvInfFile.append("[attributes]" + TAB_LINE_BREAK)
+
+ self.FvInfFile.append("EFI_ERASE_POLARITY = " + \
+ ' %s' %ErasePloarity + \
+ TAB_LINE_BREAK)
+ if not (self.FvAttributeDict is None):
+ for FvAttribute in self.FvAttributeDict.keys():
+ if FvAttribute == "FvUsedSizeEnable":
+ if self.FvAttributeDict[FvAttribute].upper() in ('TRUE', '1'):
+ self.UsedSizeEnable = True
+ continue
+ self.FvInfFile.append("EFI_" + \
+ FvAttribute + \
+ ' = ' + \
+ self.FvAttributeDict[FvAttribute] + \
+ TAB_LINE_BREAK )
+ if self.FvAlignment is not None:
+ self.FvInfFile.append("EFI_FVB2_ALIGNMENT_" + \
+ self.FvAlignment.strip() + \
+ " = TRUE" + \
+ TAB_LINE_BREAK)
+
+ #
+ # Generate FV extension header file
+ #
+ if not self.FvNameGuid:
+ if len(self.FvExtEntryType) > 0 or self.UsedSizeEnable:
+ GenFdsGlobalVariable.ErrorLogger("FV Extension Header Entries declared for %s with no FvNameGuid declaration." % (self.UiFvName))
+ else:
+ TotalSize = 16 + 4
+ Buffer = bytearray()
+ if self.UsedSizeEnable:
+ TotalSize += (4 + 4)
+ ## define EFI_FV_EXT_TYPE_USED_SIZE_TYPE 0x03
+ #typedef struct
+ # {
+ # EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;
+ # UINT32 UsedSize;
+ # } EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE;
+ Buffer += pack('HHL', 8, 3, 0)
+
+ if self.FvNameString == 'TRUE':
+ #
+ # Create EXT entry for FV UI name
+ # This GUID is used: A67DF1FA-8DE8-4E98-AF09-4BDF2EFFBC7C
+ #
+ FvUiLen = len(self.UiFvName)
+ TotalSize += (FvUiLen + 16 + 4)
+ Guid = FV_UI_EXT_ENTY_GUID.split('-')
+ #
+ # Layout:
+ # EFI_FIRMWARE_VOLUME_EXT_ENTRY: size 4
+ # GUID: size 16
+ # FV UI name
+ #
+ Buffer += (pack('HH', (FvUiLen + 16 + 4), 0x0002)
+ + PackGUID(Guid)
+ + self.UiFvName.encode('utf-8'))
+
+ for Index in range (0, len(self.FvExtEntryType)):
+ if self.FvExtEntryType[Index] == 'FILE':
+ # check if the path is absolute or relative
+ if os.path.isabs(self.FvExtEntryData[Index]):
+ FileFullPath = os.path.normpath(self.FvExtEntryData[Index])
+ else:
+ FileFullPath = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.FvExtEntryData[Index]))
+ # check if the file path exists or not
+ if not os.path.isfile(FileFullPath):
+ GenFdsGlobalVariable.ErrorLogger("Error opening FV Extension Header Entry file %s." % (self.FvExtEntryData[Index]))
+ FvExtFile = open (FileFullPath, 'rb')
+ FvExtFile.seek(0, 2)
+ Size = FvExtFile.tell()
+ if Size >= 0x10000:
+ GenFdsGlobalVariable.ErrorLogger("The size of FV Extension Header Entry file %s exceeds 0x10000." % (self.FvExtEntryData[Index]))
+ TotalSize += (Size + 4)
+ FvExtFile.seek(0)
+ Buffer += pack('HH', (Size + 4), int(self.FvExtEntryTypeValue[Index], 16))
+ Buffer += FvExtFile.read()
+ FvExtFile.close()
+ if self.FvExtEntryType[Index] == 'DATA':
+ ByteList = self.FvExtEntryData[Index].split(',')
+ Size = len (ByteList)
+ if Size >= 0x10000:
+ GenFdsGlobalVariable.ErrorLogger("The size of FV Extension Header Entry data %s exceeds 0x10000." % (self.FvExtEntryData[Index]))
+ TotalSize += (Size + 4)
+ Buffer += pack('HH', (Size + 4), int(self.FvExtEntryTypeValue[Index], 16))
+ for Index1 in range (0, Size):
+ Buffer += pack('B', int(ByteList[Index1], 16))
+
+ Guid = self.FvNameGuid.split('-')
+ Buffer = PackGUID(Guid) + pack('=L', TotalSize) + Buffer
+
+ #
+ # Generate FV extension header file if the total size is not zero
+ #
+ if TotalSize > 0:
+ FvExtHeaderFileName = os.path.join(GenFdsGlobalVariable.FvDir, self.UiFvName + '.ext')
+ FvExtHeaderFile = BytesIO()
+ FvExtHeaderFile.write(Buffer)
+ Changed = SaveFileOnChange(FvExtHeaderFileName, FvExtHeaderFile.getvalue(), True)
+ FvExtHeaderFile.close()
+ if Changed:
+ if os.path.exists (self.InfFileName):
+ os.remove (self.InfFileName)
+ self.FvInfFile.append("EFI_FV_EXT_HEADER_FILE_NAME = " + \
+ FvExtHeaderFileName + \
+ TAB_LINE_BREAK)
+
+ #
+ # Add [Files]
+ #
+ self.FvInfFile.append("[files]" + TAB_LINE_BREAK)
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/FvImageSection.py b/roms/edk2/BaseTools/Source/Python/GenFds/FvImageSection.py
new file mode 100644
index 000000000..ff2d5ca3c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/FvImageSection.py
@@ -0,0 +1,158 @@
+## @file
+# process FV image section generation
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from . import Section
+from io import BytesIO
+from .Ffs import SectionSuffix
+import subprocess
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+import Common.LongFilePathOs as os
+from CommonDataClass.FdfClass import FvImageSectionClassObject
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+from Common import EdkLogger
+from Common.BuildToolError import *
+from Common.DataType import *
+
+## generate FV image section
+#
+#
+class FvImageSection(FvImageSectionClassObject):
+
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ FvImageSectionClassObject.__init__(self)
+
+ ## GenSection() method
+ #
+ # Generate FV image section
+ #
+ # @param self The object pointer
+ # @param OutputPath Where to place output file
+ # @param ModuleName Which module this section belongs to
+ # @param SecNum Index of section
+ # @param KeyStringList Filter for inputs of section generation
+ # @param FfsInf FfsInfStatement object that contains this section data
+ # @param Dict dictionary contains macro and its value
+ # @retval tuple (Generated file name, section alignment)
+ #
+ def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = None, IsMakefile = False):
+
+ OutputFileList = []
+ if Dict is None:
+ Dict = {}
+ if self.FvFileType is not None:
+ FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FvFileType, self.FvFileExtension)
+ if IsSect :
+ return FileList, self.Alignment
+
+ Num = SecNum
+
+ MaxFvAlignment = 0
+ for FvFileName in FileList:
+ FvAlignmentValue = 0
+ if os.path.isfile(FvFileName):
+ FvFileObj = open (FvFileName, 'rb')
+ FvFileObj.seek(0)
+ # PI FvHeader is 0x48 byte
+ FvHeaderBuffer = FvFileObj.read(0x48)
+ # FV alignment position.
+ if isinstance(FvHeaderBuffer[0x2E], str):
+ FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E]) & 0x1F)
+ else:
+ FvAlignmentValue = 1 << (FvHeaderBuffer[0x2E] & 0x1F)
+ FvFileObj.close()
+ if FvAlignmentValue > MaxFvAlignment:
+ MaxFvAlignment = FvAlignmentValue
+
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + SectionSuffix.get("FV_IMAGE"))
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)
+ OutputFileList.append(OutputFile)
+
+ # MaxFvAlignment is larger than or equal to 1K
+ if MaxFvAlignment >= 0x400:
+ if MaxFvAlignment >= 0x100000:
+ #The max alignment supported by FFS is 16M.
+ if MaxFvAlignment >= 0x1000000:
+ self.Alignment = "16M"
+ else:
+ self.Alignment = str(MaxFvAlignment // 0x100000) + "M"
+ else:
+ self.Alignment = str (MaxFvAlignment // 0x400) + "K"
+ else:
+ # MaxFvAlignment is less than 1K
+ self.Alignment = str (MaxFvAlignment)
+
+ return OutputFileList, self.Alignment
+ #
+ # Generate Fv
+ #
+ if self.FvName is not None:
+ Buffer = BytesIO()
+ Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName)
+ if Fv is not None:
+ self.Fv = Fv
+ if not self.FvAddr and self.Fv.BaseAddress:
+ self.FvAddr = self.Fv.BaseAddress
+ FvFileName = Fv.AddToBuffer(Buffer, self.FvAddr, MacroDict = Dict, Flag=IsMakefile)
+ if Fv.FvAlignment is not None:
+ if self.Alignment is None:
+ self.Alignment = Fv.FvAlignment
+ else:
+ if GenFdsGlobalVariable.GetAlignment (Fv.FvAlignment) > GenFdsGlobalVariable.GetAlignment (self.Alignment):
+ self.Alignment = Fv.FvAlignment
+ else:
+ if self.FvFileName is not None:
+ FvFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FvFileName)
+ if os.path.isfile(FvFileName):
+ FvFileObj = open (FvFileName, 'rb')
+ FvFileObj.seek(0)
+ # PI FvHeader is 0x48 byte
+ FvHeaderBuffer = FvFileObj.read(0x48)
+ # FV alignment position.
+ if isinstance(FvHeaderBuffer[0x2E], str):
+ FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E]) & 0x1F)
+ else:
+ FvAlignmentValue = 1 << (FvHeaderBuffer[0x2E] & 0x1F)
+ # FvAlignmentValue is larger than or equal to 1K
+ if FvAlignmentValue >= 0x400:
+ if FvAlignmentValue >= 0x100000:
+ #The max alignment supported by FFS is 16M.
+ if FvAlignmentValue >= 0x1000000:
+ self.Alignment = "16M"
+ else:
+ self.Alignment = str(FvAlignmentValue // 0x100000) + "M"
+ else:
+ self.Alignment = str (FvAlignmentValue // 0x400) + "K"
+ else:
+ # FvAlignmentValue is less than 1K
+ self.Alignment = str (FvAlignmentValue)
+ FvFileObj.close()
+ else:
+ if len (mws.getPkgPath()) == 0:
+ EdkLogger.error("GenFds", FILE_NOT_FOUND, "%s is not found in WORKSPACE: %s" % self.FvFileName, GenFdsGlobalVariable.WorkSpaceDir)
+ else:
+ EdkLogger.error("GenFds", FILE_NOT_FOUND, "%s is not found in packages path:\n\t%s" % (self.FvFileName, '\n\t'.join(mws.getPkgPath())))
+
+ else:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "FvImageSection Failed! %s NOT found in FDF" % self.FvName)
+
+ #
+ # Prepare the parameter of GenSection
+ #
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + SectionSuffix.get("FV_IMAGE"))
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)
+ OutputFileList.append(OutputFile)
+
+ return OutputFileList, self.Alignment
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/GenFds.py b/roms/edk2/BaseTools/Source/Python/GenFds/GenFds.py
new file mode 100644
index 000000000..d5511f4c4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/GenFds.py
@@ -0,0 +1,797 @@
+## @file
+# generate flash image
+#
+# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+from re import compile
+from optparse import OptionParser
+from sys import exit
+from glob import glob
+from struct import unpack
+from linecache import getlines
+from io import BytesIO
+
+import Common.LongFilePathOs as os
+from Common.TargetTxtClassObject import TargetTxtDict
+from Common.DataType import *
+import Common.GlobalData as GlobalData
+from Common import EdkLogger
+from Common.StringUtils import NormPath
+from Common.Misc import DirCache, PathClass, GuidStructureStringToGuidString
+from Common.Misc import SaveFileOnChange, ClearDuplicatedInf
+from Common.BuildVersion import gBUILD_VERSION
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+from Common.BuildToolError import FatalError, GENFDS_ERROR, CODE_ERROR, FORMAT_INVALID, RESOURCE_NOT_AVAILABLE, FILE_NOT_FOUND, OPTION_MISSING, FORMAT_NOT_SUPPORTED, OPTION_VALUE_INVALID, PARAMETER_INVALID
+from Workspace.WorkspaceDatabase import WorkspaceDatabase
+
+from .FdfParser import FdfParser, Warning
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+from .FfsFileStatement import FileStatement
+import Common.DataType as DataType
+from struct import Struct
+
+## Version and Copyright
+versionNumber = "1.0" + ' ' + gBUILD_VERSION
+__version__ = "%prog Version " + versionNumber
+__copyright__ = "Copyright (c) 2007 - 2018, Intel Corporation All rights reserved."
+
+## Tool entrance method
+#
+# This method mainly dispatch specific methods per the command line options.
+# If no error found, return zero value so the caller of this tool can know
+# if it's executed successfully or not.
+#
+# @retval 0 Tool was successful
+# @retval 1 Tool failed
+#
+def main():
+ global Options
+ Options = myOptionParser()
+ EdkLogger.Initialize()
+ return GenFdsApi(OptionsToCommandDict(Options))
+
+def resetFdsGlobalVariable():
+ GenFdsGlobalVariable.FvDir = ''
+ GenFdsGlobalVariable.OutputDirDict = {}
+ GenFdsGlobalVariable.BinDir = ''
+ # will be FvDir + os.sep + 'Ffs'
+ GenFdsGlobalVariable.FfsDir = ''
+ GenFdsGlobalVariable.FdfParser = None
+ GenFdsGlobalVariable.LibDir = ''
+ GenFdsGlobalVariable.WorkSpace = None
+ GenFdsGlobalVariable.WorkSpaceDir = ''
+ GenFdsGlobalVariable.ConfDir = ''
+ GenFdsGlobalVariable.OutputDirFromDscDict = {}
+ GenFdsGlobalVariable.TargetName = ''
+ GenFdsGlobalVariable.ToolChainTag = ''
+ GenFdsGlobalVariable.RuleDict = {}
+ GenFdsGlobalVariable.ArchList = None
+ GenFdsGlobalVariable.ActivePlatform = None
+ GenFdsGlobalVariable.FvAddressFileName = ''
+ GenFdsGlobalVariable.VerboseMode = False
+ GenFdsGlobalVariable.DebugLevel = -1
+ GenFdsGlobalVariable.SharpCounter = 0
+ GenFdsGlobalVariable.SharpNumberPerLine = 40
+ GenFdsGlobalVariable.FdfFile = ''
+ GenFdsGlobalVariable.FdfFileTimeStamp = 0
+ GenFdsGlobalVariable.FixedLoadAddress = False
+ GenFdsGlobalVariable.PlatformName = ''
+
+ GenFdsGlobalVariable.BuildRuleFamily = DataType.TAB_COMPILER_MSFT
+ GenFdsGlobalVariable.ToolChainFamily = DataType.TAB_COMPILER_MSFT
+ GenFdsGlobalVariable.__BuildRuleDatabase = None
+ GenFdsGlobalVariable.GuidToolDefinition = {}
+ GenFdsGlobalVariable.FfsCmdDict = {}
+ GenFdsGlobalVariable.SecCmdList = []
+ GenFdsGlobalVariable.CopyList = []
+ GenFdsGlobalVariable.ModuleFile = ''
+ GenFdsGlobalVariable.EnableGenfdsMultiThread = True
+
+ GenFdsGlobalVariable.LargeFileInFvFlags = []
+ GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID = '5473C07A-3DCB-4dca-BD6F-1E9689E7349A'
+ GenFdsGlobalVariable.LARGE_FILE_SIZE = 0x1000000
+
+ GenFdsGlobalVariable.SectionHeader = Struct("3B 1B")
+
+ # FvName, FdName, CapName in FDF, Image file name
+ GenFdsGlobalVariable.ImageBinDict = {}
+
+def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
+ global Workspace
+ Workspace = ""
+ ArchList = None
+ ReturnCode = 0
+ resetFdsGlobalVariable()
+
+ try:
+ if FdsCommandDict.get("verbose"):
+ EdkLogger.SetLevel(EdkLogger.VERBOSE)
+ GenFdsGlobalVariable.VerboseMode = True
+
+ if FdsCommandDict.get("FixedAddress"):
+ GenFdsGlobalVariable.FixedLoadAddress = True
+
+ if FdsCommandDict.get("quiet"):
+ EdkLogger.SetLevel(EdkLogger.QUIET)
+ if FdsCommandDict.get("debug"):
+ EdkLogger.SetLevel(FdsCommandDict.get("debug") + 1)
+ GenFdsGlobalVariable.DebugLevel = FdsCommandDict.get("debug")
+ else:
+ EdkLogger.SetLevel(EdkLogger.INFO)
+
+ if not FdsCommandDict.get("Workspace",os.environ.get('WORKSPACE')):
+ EdkLogger.error("GenFds", OPTION_MISSING, "WORKSPACE not defined",
+ ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.")
+ elif not os.path.exists(FdsCommandDict.get("Workspace",os.environ.get('WORKSPACE'))):
+ EdkLogger.error("GenFds", PARAMETER_INVALID, "WORKSPACE is invalid",
+ ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.")
+ else:
+ Workspace = os.path.normcase(FdsCommandDict.get("Workspace",os.environ.get('WORKSPACE')))
+ GenFdsGlobalVariable.WorkSpaceDir = Workspace
+ if FdsCommandDict.get("debug"):
+ GenFdsGlobalVariable.VerboseLogger("Using Workspace:" + Workspace)
+ if FdsCommandDict.get("GenfdsMultiThread"):
+ GenFdsGlobalVariable.EnableGenfdsMultiThread = True
+ else:
+ GenFdsGlobalVariable.EnableGenfdsMultiThread = False
+ os.chdir(GenFdsGlobalVariable.WorkSpaceDir)
+
+ # set multiple workspace
+ PackagesPath = os.getenv("PACKAGES_PATH")
+ mws.setWs(GenFdsGlobalVariable.WorkSpaceDir, PackagesPath)
+
+ if FdsCommandDict.get("fdf_file"):
+ FdfFilename = FdsCommandDict.get("fdf_file")[0].Path
+ FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename)
+
+ if FdfFilename[0:2] == '..':
+ FdfFilename = os.path.realpath(FdfFilename)
+ if not os.path.isabs(FdfFilename):
+ FdfFilename = mws.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename)
+ if not os.path.exists(FdfFilename):
+ EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=FdfFilename)
+
+ GenFdsGlobalVariable.FdfFile = FdfFilename
+ GenFdsGlobalVariable.FdfFileTimeStamp = os.path.getmtime(FdfFilename)
+ else:
+ EdkLogger.error("GenFds", OPTION_MISSING, "Missing FDF filename")
+
+ if FdsCommandDict.get("build_target"):
+ GenFdsGlobalVariable.TargetName = FdsCommandDict.get("build_target")
+
+ if FdsCommandDict.get("toolchain_tag"):
+ GenFdsGlobalVariable.ToolChainTag = FdsCommandDict.get("toolchain_tag")
+
+ if FdsCommandDict.get("active_platform"):
+ ActivePlatform = FdsCommandDict.get("active_platform")
+ ActivePlatform = GenFdsGlobalVariable.ReplaceWorkspaceMacro(ActivePlatform)
+
+ if ActivePlatform[0:2] == '..':
+ ActivePlatform = os.path.realpath(ActivePlatform)
+
+ if not os.path.isabs (ActivePlatform):
+ ActivePlatform = mws.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform)
+
+ if not os.path.exists(ActivePlatform):
+ EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
+ else:
+ EdkLogger.error("GenFds", OPTION_MISSING, "Missing active platform")
+
+ GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform))
+
+ if FdsCommandDict.get("conf_directory"):
+ # Get alternate Conf location, if it is absolute, then just use the absolute directory name
+ ConfDirectoryPath = os.path.normpath(FdsCommandDict.get("conf_directory"))
+ if ConfDirectoryPath.startswith('"'):
+ ConfDirectoryPath = ConfDirectoryPath[1:]
+ if ConfDirectoryPath.endswith('"'):
+ ConfDirectoryPath = ConfDirectoryPath[:-1]
+ if not os.path.isabs(ConfDirectoryPath):
+ # Since alternate directory name is not absolute, the alternate directory is located within the WORKSPACE
+ # This also handles someone specifying the Conf directory in the workspace. Using --conf=Conf
+ ConfDirectoryPath = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ConfDirectoryPath)
+ else:
+ if "CONF_PATH" in os.environ:
+ ConfDirectoryPath = os.path.normcase(os.environ["CONF_PATH"])
+ else:
+ # Get standard WORKSPACE/Conf, use the absolute path to the WORKSPACE/Conf
+ ConfDirectoryPath = mws.join(GenFdsGlobalVariable.WorkSpaceDir, 'Conf')
+ GenFdsGlobalVariable.ConfDir = ConfDirectoryPath
+ if not GlobalData.gConfDirectory:
+ GlobalData.gConfDirectory = GenFdsGlobalVariable.ConfDir
+ BuildConfigurationFile = os.path.normpath(os.path.join(ConfDirectoryPath, "target.txt"))
+ if os.path.isfile(BuildConfigurationFile) == True:
+ # if no build target given in command line, get it from target.txt
+ TargetObj = TargetTxtDict()
+ TargetTxt = TargetObj.Target
+ if not GenFdsGlobalVariable.TargetName:
+ BuildTargetList = TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_TARGET]
+ if len(BuildTargetList) != 1:
+ EdkLogger.error("GenFds", OPTION_VALUE_INVALID, ExtraData="Only allows one instance for Target.")
+ GenFdsGlobalVariable.TargetName = BuildTargetList[0]
+
+ # if no tool chain given in command line, get it from target.txt
+ if not GenFdsGlobalVariable.ToolChainTag:
+ ToolChainList = TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_TAG]
+ if ToolChainList is None or len(ToolChainList) == 0:
+ EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE, ExtraData="No toolchain given. Don't know how to build.")
+ if len(ToolChainList) != 1:
+ EdkLogger.error("GenFds", OPTION_VALUE_INVALID, ExtraData="Only allows one instance for ToolChain.")
+ GenFdsGlobalVariable.ToolChainTag = ToolChainList[0]
+ else:
+ EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=BuildConfigurationFile)
+
+ #Set global flag for build mode
+ GlobalData.gIgnoreSource = FdsCommandDict.get("IgnoreSources")
+
+ if FdsCommandDict.get("macro"):
+ for Pair in FdsCommandDict.get("macro"):
+ if Pair.startswith('"'):
+ Pair = Pair[1:]
+ if Pair.endswith('"'):
+ Pair = Pair[:-1]
+ List = Pair.split('=')
+ if len(List) == 2:
+ if not List[1].strip():
+ EdkLogger.error("GenFds", OPTION_VALUE_INVALID, ExtraData="No Value given for Macro %s" %List[0])
+ if List[0].strip() in ["WORKSPACE", "TARGET", "TOOLCHAIN"]:
+ GlobalData.gGlobalDefines[List[0].strip()] = List[1].strip()
+ else:
+ GlobalData.gCommandLineDefines[List[0].strip()] = List[1].strip()
+ else:
+ GlobalData.gCommandLineDefines[List[0].strip()] = "TRUE"
+ os.environ["WORKSPACE"] = Workspace
+
+ # Use the -t and -b option as gGlobalDefines's TOOLCHAIN and TARGET if they are not defined
+ if "TARGET" not in GlobalData.gGlobalDefines:
+ GlobalData.gGlobalDefines["TARGET"] = GenFdsGlobalVariable.TargetName
+ if "TOOLCHAIN" not in GlobalData.gGlobalDefines:
+ GlobalData.gGlobalDefines["TOOLCHAIN"] = GenFdsGlobalVariable.ToolChainTag
+ if "TOOL_CHAIN_TAG" not in GlobalData.gGlobalDefines:
+ GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = GenFdsGlobalVariable.ToolChainTag
+
+ """call Workspace build create database"""
+ GlobalData.gDatabasePath = os.path.normpath(os.path.join(ConfDirectoryPath, GlobalData.gDatabasePath))
+
+ if WorkSpaceDataBase:
+ BuildWorkSpace = WorkSpaceDataBase
+ else:
+ BuildWorkSpace = WorkspaceDatabase()
+ #
+ # Get files real name in workspace dir
+ #
+ GlobalData.gAllFiles = DirCache(Workspace)
+ GlobalData.gWorkspace = Workspace
+
+ if FdsCommandDict.get("build_architecture_list"):
+ ArchList = FdsCommandDict.get("build_architecture_list").split(',')
+ else:
+ ArchList = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, TAB_COMMON, FdsCommandDict.get("build_target"), FdsCommandDict.get("toolchain_tag")].SupArchList
+
+ TargetArchList = set(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, TAB_COMMON, FdsCommandDict.get("build_target"), FdsCommandDict.get("toolchain_tag")].SupArchList) & set(ArchList)
+ if len(TargetArchList) == 0:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "Target ARCH %s not in platform supported ARCH %s" % (str(ArchList), str(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, TAB_COMMON].SupArchList)))
+
+ for Arch in ArchList:
+ GenFdsGlobalVariable.OutputDirFromDscDict[Arch] = NormPath(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, FdsCommandDict.get("build_target"), FdsCommandDict.get("toolchain_tag")].OutputDirectory)
+
+ # assign platform name based on last entry in ArchList
+ GenFdsGlobalVariable.PlatformName = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, ArchList[-1], FdsCommandDict.get("build_target"), FdsCommandDict.get("toolchain_tag")].PlatformName
+
+ if FdsCommandDict.get("platform_build_directory"):
+ OutputDirFromCommandLine = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdsCommandDict.get("platform_build_directory"))
+ if not os.path.isabs (OutputDirFromCommandLine):
+ OutputDirFromCommandLine = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, OutputDirFromCommandLine)
+ for Arch in ArchList:
+ GenFdsGlobalVariable.OutputDirDict[Arch] = OutputDirFromCommandLine
+ else:
+ for Arch in ArchList:
+ GenFdsGlobalVariable.OutputDirDict[Arch] = os.path.join(GenFdsGlobalVariable.OutputDirFromDscDict[Arch], GenFdsGlobalVariable.TargetName + '_' + GenFdsGlobalVariable.ToolChainTag)
+
+ for Key in GenFdsGlobalVariable.OutputDirDict:
+ OutputDir = GenFdsGlobalVariable.OutputDirDict[Key]
+ if OutputDir[0:2] == '..':
+ OutputDir = os.path.realpath(OutputDir)
+
+ if OutputDir[1] != ':':
+ OutputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, OutputDir)
+
+ if not os.path.exists(OutputDir):
+ EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=OutputDir)
+ GenFdsGlobalVariable.OutputDirDict[Key] = OutputDir
+
+ """ Parse Fdf file, has to place after build Workspace as FDF may contain macros from DSC file """
+ if WorkSpaceDataBase:
+ FdfParserObj = GlobalData.gFdfParser
+ else:
+ FdfParserObj = FdfParser(FdfFilename)
+ FdfParserObj.ParseFile()
+
+ if FdfParserObj.CycleReferenceCheck():
+ EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Cycle Reference Detected in FDF file")
+
+ if FdsCommandDict.get("fd"):
+ if FdsCommandDict.get("fd")[0].upper() in FdfParserObj.Profile.FdDict:
+ GenFds.OnlyGenerateThisFd = FdsCommandDict.get("fd")[0]
+ else:
+ EdkLogger.error("GenFds", OPTION_VALUE_INVALID,
+ "No such an FD in FDF file: %s" % FdsCommandDict.get("fd")[0])
+
+ if FdsCommandDict.get("fv"):
+ if FdsCommandDict.get("fv")[0].upper() in FdfParserObj.Profile.FvDict:
+ GenFds.OnlyGenerateThisFv = FdsCommandDict.get("fv")[0]
+ else:
+ EdkLogger.error("GenFds", OPTION_VALUE_INVALID,
+ "No such an FV in FDF file: %s" % FdsCommandDict.get("fv")[0])
+
+ if FdsCommandDict.get("cap"):
+ if FdsCommandDict.get("cap")[0].upper() in FdfParserObj.Profile.CapsuleDict:
+ GenFds.OnlyGenerateThisCap = FdsCommandDict.get("cap")[0]
+ else:
+ EdkLogger.error("GenFds", OPTION_VALUE_INVALID,
+ "No such a Capsule in FDF file: %s" % FdsCommandDict.get("cap")[0])
+
+ GenFdsGlobalVariable.WorkSpace = BuildWorkSpace
+ if ArchList:
+ GenFdsGlobalVariable.ArchList = ArchList
+
+ # Dsc Build Data will handle Pcd Settings from CommandLine.
+
+ """Modify images from build output if the feature of loading driver at fixed address is on."""
+ if GenFdsGlobalVariable.FixedLoadAddress:
+ GenFds.PreprocessImage(BuildWorkSpace, GenFdsGlobalVariable.ActivePlatform)
+
+ # Record the FV Region info that may specific in the FD
+ if FdfParserObj.Profile.FvDict and FdfParserObj.Profile.FdDict:
+ for FvObj in FdfParserObj.Profile.FvDict.values():
+ for FdObj in FdfParserObj.Profile.FdDict.values():
+ for RegionObj in FdObj.RegionList:
+ if RegionObj.RegionType != BINARY_FILE_TYPE_FV:
+ continue
+ for RegionData in RegionObj.RegionDataList:
+ if FvObj.UiFvName.upper() == RegionData.upper():
+ if not FvObj.BaseAddress:
+ FvObj.BaseAddress = '0x%x' % (int(FdObj.BaseAddress, 0) + RegionObj.Offset)
+ if FvObj.FvRegionInFD:
+ if FvObj.FvRegionInFD != RegionObj.Size:
+ EdkLogger.error("GenFds", FORMAT_INVALID, "The FV %s's region is specified in multiple FD with different value." %FvObj.UiFvName)
+ else:
+ FvObj.FvRegionInFD = RegionObj.Size
+ RegionObj.BlockInfoOfRegion(FdObj.BlockSizeList, FvObj)
+
+ """Call GenFds"""
+ GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList)
+
+ """Generate GUID cross reference file"""
+ GenFds.GenerateGuidXRefFile(BuildWorkSpace, ArchList, FdfParserObj)
+
+ """Display FV space info."""
+ GenFds.DisplayFvSpaceInfo(FdfParserObj)
+
+ except Warning as X:
+ EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError=False)
+ ReturnCode = FORMAT_INVALID
+ except FatalError as X:
+ if FdsCommandDict.get("debug") is not None:
+ import traceback
+ EdkLogger.quiet(traceback.format_exc())
+ ReturnCode = X.args[0]
+ except:
+ import traceback
+ EdkLogger.error(
+ "\nPython",
+ CODE_ERROR,
+ "Tools code failure",
+ ExtraData="Please send email to %s for help, attaching following call stack trace!\n" % MSG_EDKII_MAIL_ADDR,
+ RaiseError=False
+ )
+ EdkLogger.quiet(traceback.format_exc())
+ ReturnCode = CODE_ERROR
+ finally:
+ ClearDuplicatedInf()
+ return ReturnCode
+
+def OptionsToCommandDict(Options):
+ FdsCommandDict = {}
+ FdsCommandDict["verbose"] = Options.verbose
+ FdsCommandDict["FixedAddress"] = Options.FixedAddress
+ FdsCommandDict["quiet"] = Options.quiet
+ FdsCommandDict["debug"] = Options.debug
+ FdsCommandDict["Workspace"] = Options.Workspace
+ FdsCommandDict["GenfdsMultiThread"] = not Options.NoGenfdsMultiThread
+ FdsCommandDict["fdf_file"] = [PathClass(Options.filename)] if Options.filename else []
+ FdsCommandDict["build_target"] = Options.BuildTarget
+ FdsCommandDict["toolchain_tag"] = Options.ToolChain
+ FdsCommandDict["active_platform"] = Options.activePlatform
+ FdsCommandDict["OptionPcd"] = Options.OptionPcd
+ FdsCommandDict["conf_directory"] = Options.ConfDirectory
+ FdsCommandDict["IgnoreSources"] = Options.IgnoreSources
+ FdsCommandDict["macro"] = Options.Macros
+ FdsCommandDict["build_architecture_list"] = Options.archList
+ FdsCommandDict["platform_build_directory"] = Options.outputDir
+ FdsCommandDict["fd"] = [Options.uiFdName] if Options.uiFdName else []
+ FdsCommandDict["fv"] = [Options.uiFvName] if Options.uiFvName else []
+ FdsCommandDict["cap"] = [Options.uiCapName] if Options.uiCapName else []
+ return FdsCommandDict
+
+
+gParamCheck = []
+def SingleCheckCallback(option, opt_str, value, parser):
+ if option not in gParamCheck:
+ setattr(parser.values, option.dest, value)
+ gParamCheck.append(option)
+ else:
+ parser.error("Option %s only allows one instance in command line!" % option)
+
+## Parse command line options
+#
+# Using standard Python module optparse to parse command line option of this tool.
+#
+# @retval Opt A optparse.Values object containing the parsed options
+#
+def myOptionParser():
+ usage = "%prog [options] -f input_file -a arch_list -b build_target -p active_platform -t tool_chain_tag -D \"MacroName [= MacroValue]\""
+ Parser = OptionParser(usage=usage, description=__copyright__, version="%prog " + str(versionNumber))
+ Parser.add_option("-f", "--file", dest="filename", type="string", help="Name of FDF file to convert", action="callback", callback=SingleCheckCallback)
+ Parser.add_option("-a", "--arch", dest="archList", help="comma separated list containing one or more of: IA32, X64, IPF, ARM, AARCH64 or EBC which should be built, overrides target.txt?s TARGET_ARCH")
+ Parser.add_option("-q", "--quiet", action="store_true", type=None, help="Disable all messages except FATAL ERRORS.")
+ Parser.add_option("-v", "--verbose", action="store_true", type=None, help="Turn on verbose output with informational messages printed.")
+ Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
+ Parser.add_option("-p", "--platform", type="string", dest="activePlatform", help="Set the ACTIVE_PLATFORM, overrides target.txt ACTIVE_PLATFORM setting.",
+ action="callback", callback=SingleCheckCallback)
+ Parser.add_option("-w", "--workspace", type="string", dest="Workspace", default=os.environ.get('WORKSPACE'), help="Set the WORKSPACE",
+ action="callback", callback=SingleCheckCallback)
+ Parser.add_option("-o", "--outputDir", type="string", dest="outputDir", help="Name of Build Output directory",
+ action="callback", callback=SingleCheckCallback)
+ Parser.add_option("-r", "--rom_image", dest="uiFdName", help="Build the image using the [FD] section named by FdUiName.")
+ Parser.add_option("-i", "--FvImage", dest="uiFvName", help="Build the FV image using the [FV] section named by UiFvName")
+ Parser.add_option("-C", "--CapsuleImage", dest="uiCapName", help="Build the Capsule image using the [Capsule] section named by UiCapName")
+ Parser.add_option("-b", "--buildtarget", type="string", dest="BuildTarget", help="Set the build TARGET, overrides target.txt TARGET setting.",
+ action="callback", callback=SingleCheckCallback)
+ Parser.add_option("-t", "--tagname", type="string", dest="ToolChain", help="Using the tools: TOOL_CHAIN_TAG name to build the platform.",
+ action="callback", callback=SingleCheckCallback)
+ Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".")
+ Parser.add_option("-s", "--specifyaddress", dest="FixedAddress", action="store_true", type=None, help="Specify driver load address.")
+ Parser.add_option("--conf", action="store", type="string", dest="ConfDirectory", help="Specify the customized Conf directory.")
+ Parser.add_option("--ignore-sources", action="store_true", dest="IgnoreSources", default=False, help="Focus to a binary build and ignore all source files")
+ Parser.add_option("--pcd", action="append", dest="OptionPcd", help="Set PCD value by command line. Format: \"PcdName=Value\" ")
+ Parser.add_option("--genfds-multi-thread", action="store_true", dest="GenfdsMultiThread", default=True, help="Enable GenFds multi thread to generate ffs file.")
+ Parser.add_option("--no-genfds-multi-thread", action="store_true", dest="NoGenfdsMultiThread", default=False, help="Disable GenFds multi thread to generate ffs file.")
+
+ Options, _ = Parser.parse_args()
+ return Options
+
+## The class implementing the EDK2 flash image generation process
+#
+# This process includes:
+# 1. Collect workspace information, includes platform and module information
+# 2. Call methods of Fd class to generate FD
+# 3. Call methods of Fv class to generate FV that not belong to FD
+#
+class GenFds(object):
+ FdfParsef = None
+ OnlyGenerateThisFd = None
+ OnlyGenerateThisFv = None
+ OnlyGenerateThisCap = None
+
+ ## GenFd()
+ #
+ # @param OutputDir Output directory
+ # @param FdfParserObject FDF contents parser
+ # @param Workspace The directory of workspace
+ # @param ArchList The Arch list of platform
+ #
+ @staticmethod
+ def GenFd (OutputDir, FdfParserObject, WorkSpace, ArchList):
+ GenFdsGlobalVariable.SetDir ('', FdfParserObject, WorkSpace, ArchList)
+
+ GenFdsGlobalVariable.VerboseLogger(" Generate all Fd images and their required FV and Capsule images!")
+ if GenFds.OnlyGenerateThisCap is not None and GenFds.OnlyGenerateThisCap.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict:
+ CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[GenFds.OnlyGenerateThisCap.upper()]
+ if CapsuleObj is not None:
+ CapsuleObj.GenCapsule()
+ return
+
+ if GenFds.OnlyGenerateThisFd is not None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict:
+ FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[GenFds.OnlyGenerateThisFd.upper()]
+ if FdObj is not None:
+ FdObj.GenFd()
+ return
+ elif GenFds.OnlyGenerateThisFd is None and GenFds.OnlyGenerateThisFv is None:
+ for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
+ FdObj.GenFd()
+
+ GenFdsGlobalVariable.VerboseLogger("\n Generate other FV images! ")
+ if GenFds.OnlyGenerateThisFv is not None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict:
+ FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[GenFds.OnlyGenerateThisFv.upper()]
+ if FvObj is not None:
+ Buffer = BytesIO()
+ FvObj.AddToBuffer(Buffer)
+ Buffer.close()
+ return
+ elif GenFds.OnlyGenerateThisFv is None:
+ for FvObj in GenFdsGlobalVariable.FdfParser.Profile.FvDict.values():
+ Buffer = BytesIO()
+ FvObj.AddToBuffer(Buffer)
+ Buffer.close()
+
+ if GenFds.OnlyGenerateThisFv is None and GenFds.OnlyGenerateThisFd is None and GenFds.OnlyGenerateThisCap is None:
+ if GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict != {}:
+ GenFdsGlobalVariable.VerboseLogger("\n Generate other Capsule images!")
+ for CapsuleObj in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.values():
+ CapsuleObj.GenCapsule()
+
+ if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}:
+ GenFdsGlobalVariable.VerboseLogger("\n Generate all Option ROM!")
+ for OptRomObj in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.values():
+ OptRomObj.AddToBuffer(None)
+
+ @staticmethod
+ def GenFfsMakefile(OutputDir, FdfParserObject, WorkSpace, ArchList, GlobalData):
+ GenFdsGlobalVariable.SetEnv(FdfParserObject, WorkSpace, ArchList, GlobalData)
+ for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
+ FdObj.GenFd(Flag=True)
+
+ for FvObj in GenFdsGlobalVariable.FdfParser.Profile.FvDict.values():
+ FvObj.AddToBuffer(Buffer=None, Flag=True)
+
+ if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}:
+ for OptRomObj in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.values():
+ OptRomObj.AddToBuffer(Buffer=None, Flag=True)
+
+ return GenFdsGlobalVariable.FfsCmdDict
+
+ ## GetFvBlockSize()
+ #
+ # @param FvObj Whose block size to get
+ # @retval int Block size value
+ #
+ @staticmethod
+ def GetFvBlockSize(FvObj):
+ DefaultBlockSize = 0x1
+ FdObj = None
+ if GenFds.OnlyGenerateThisFd is not None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict:
+ FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[GenFds.OnlyGenerateThisFd.upper()]
+ if FdObj is None:
+ for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
+ for ElementRegion in ElementFd.RegionList:
+ if ElementRegion.RegionType == BINARY_FILE_TYPE_FV:
+ for ElementRegionData in ElementRegion.RegionDataList:
+ if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName:
+ if FvObj.BlockSizeList != []:
+ return FvObj.BlockSizeList[0][0]
+ else:
+ return ElementRegion.BlockSizeOfRegion(ElementFd.BlockSizeList)
+ if FvObj.BlockSizeList != []:
+ return FvObj.BlockSizeList[0][0]
+ return DefaultBlockSize
+ else:
+ for ElementRegion in FdObj.RegionList:
+ if ElementRegion.RegionType == BINARY_FILE_TYPE_FV:
+ for ElementRegionData in ElementRegion.RegionDataList:
+ if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName:
+ if FvObj.BlockSizeList != []:
+ return FvObj.BlockSizeList[0][0]
+ else:
+ return ElementRegion.BlockSizeOfRegion(ElementFd.BlockSizeList)
+ return DefaultBlockSize
+
+ ## DisplayFvSpaceInfo()
+ #
+ # @param FvObj Whose block size to get
+ # @retval None
+ #
+ @staticmethod
+ def DisplayFvSpaceInfo(FdfParserObject):
+
+ FvSpaceInfoList = []
+ MaxFvNameLength = 0
+ for FvName in FdfParserObject.Profile.FvDict:
+ if len(FvName) > MaxFvNameLength:
+ MaxFvNameLength = len(FvName)
+ FvSpaceInfoFileName = os.path.join(GenFdsGlobalVariable.FvDir, FvName.upper() + '.Fv.map')
+ if os.path.exists(FvSpaceInfoFileName):
+ FileLinesList = getlines(FvSpaceInfoFileName)
+ TotalFound = False
+ Total = ''
+ UsedFound = False
+ Used = ''
+ FreeFound = False
+ Free = ''
+ for Line in FileLinesList:
+ NameValue = Line.split('=')
+ if len(NameValue) == 2:
+ if NameValue[0].strip() == 'EFI_FV_TOTAL_SIZE':
+ TotalFound = True
+ Total = NameValue[1].strip()
+ if NameValue[0].strip() == 'EFI_FV_TAKEN_SIZE':
+ UsedFound = True
+ Used = NameValue[1].strip()
+ if NameValue[0].strip() == 'EFI_FV_SPACE_SIZE':
+ FreeFound = True
+ Free = NameValue[1].strip()
+
+ if TotalFound and UsedFound and FreeFound:
+ FvSpaceInfoList.append((FvName, Total, Used, Free))
+
+ GenFdsGlobalVariable.InfLogger('\nFV Space Information')
+ for FvSpaceInfo in FvSpaceInfoList:
+ Name = FvSpaceInfo[0]
+ TotalSizeValue = int(FvSpaceInfo[1], 0)
+ UsedSizeValue = int(FvSpaceInfo[2], 0)
+ FreeSizeValue = int(FvSpaceInfo[3], 0)
+ if UsedSizeValue == TotalSizeValue:
+ Percentage = '100'
+ else:
+ Percentage = str((UsedSizeValue + 0.0) / TotalSizeValue)[0:4].lstrip('0.')
+
+ GenFdsGlobalVariable.InfLogger(Name + ' ' + '[' + Percentage + '%Full] ' + str(TotalSizeValue) + ' total, ' + str(UsedSizeValue) + ' used, ' + str(FreeSizeValue) + ' free')
+
+ ## PreprocessImage()
+ #
+ # @param BuildDb Database from build meta data files
+ # @param DscFile modules from dsc file will be preprocessed
+ # @retval None
+ #
+ @staticmethod
+ def PreprocessImage(BuildDb, DscFile):
+ PcdDict = BuildDb.BuildObject[DscFile, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Pcds
+ PcdValue = ''
+ for Key in PcdDict:
+ PcdObj = PcdDict[Key]
+ if PcdObj.TokenCName == 'PcdBsBaseAddress':
+ PcdValue = PcdObj.DefaultValue
+ break
+
+ if PcdValue == '':
+ return
+
+ Int64PcdValue = int(PcdValue, 0)
+ if Int64PcdValue == 0 or Int64PcdValue < -1:
+ return
+
+ TopAddress = 0
+ if Int64PcdValue > 0:
+ TopAddress = Int64PcdValue
+
+ ModuleDict = BuildDb.BuildObject[DscFile, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Modules
+ for Key in ModuleDict:
+ ModuleObj = BuildDb.BuildObject[Key, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ print(ModuleObj.BaseName + ' ' + ModuleObj.ModuleType)
+
+ @staticmethod
+ def GenerateGuidXRefFile(BuildDb, ArchList, FdfParserObj):
+ GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref")
+ GuidXRefFile = []
+ PkgGuidDict = {}
+ GuidDict = {}
+ ModuleList = []
+ FileGuidList = []
+ VariableGuidSet = set()
+ for Arch in ArchList:
+ PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ PkgList = GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag)
+ for P in PkgList:
+ PkgGuidDict.update(P.Guids)
+ for Name, Guid in PlatformDataBase.Pcds:
+ Pcd = PlatformDataBase.Pcds[Name, Guid]
+ if Pcd.Type in [TAB_PCDS_DYNAMIC_HII, TAB_PCDS_DYNAMIC_EX_HII]:
+ for SkuId in Pcd.SkuInfoList:
+ Sku = Pcd.SkuInfoList[SkuId]
+ if Sku.VariableGuid in VariableGuidSet:continue
+ VariableGuidSet.add(Sku.VariableGuid)
+ if Sku.VariableGuid and Sku.VariableGuid in PkgGuidDict.keys():
+ GuidDict[Sku.VariableGuid] = PkgGuidDict[Sku.VariableGuid]
+ for ModuleFile in PlatformDataBase.Modules:
+ Module = BuildDb.BuildObject[ModuleFile, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ if Module in ModuleList:
+ continue
+ else:
+ ModuleList.append(Module)
+ if GlobalData.gGuidPattern.match(ModuleFile.BaseName):
+ GuidXRefFile.append("%s %s\n" % (ModuleFile.BaseName, Module.BaseName))
+ else:
+ GuidXRefFile.append("%s %s\n" % (Module.Guid, Module.BaseName))
+ GuidDict.update(Module.Protocols)
+ GuidDict.update(Module.Guids)
+ GuidDict.update(Module.Ppis)
+ for FvName in FdfParserObj.Profile.FvDict:
+ for FfsObj in FdfParserObj.Profile.FvDict[FvName].FfsList:
+ if not isinstance(FfsObj, FileStatement):
+ InfPath = PathClass(NormPath(mws.join(GenFdsGlobalVariable.WorkSpaceDir, FfsObj.InfFileName)))
+ FdfModule = BuildDb.BuildObject[InfPath, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ if FdfModule in ModuleList:
+ continue
+ else:
+ ModuleList.append(FdfModule)
+ GuidXRefFile.append("%s %s\n" % (FdfModule.Guid, FdfModule.BaseName))
+ GuidDict.update(FdfModule.Protocols)
+ GuidDict.update(FdfModule.Guids)
+ GuidDict.update(FdfModule.Ppis)
+ else:
+ FileStatementGuid = FfsObj.NameGuid
+ if FileStatementGuid in FileGuidList:
+ continue
+ else:
+ FileGuidList.append(FileStatementGuid)
+ Name = []
+ FfsPath = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
+ FfsPath = glob(os.path.join(FfsPath, FileStatementGuid) + TAB_STAR)
+ if not FfsPath:
+ continue
+ if not os.path.exists(FfsPath[0]):
+ continue
+ MatchDict = {}
+ ReFileEnds = compile('\S+(.ui)$|\S+(fv.sec.txt)$|\S+(.pe32.txt)$|\S+(.te.txt)$|\S+(.pic.txt)$|\S+(.raw.txt)$|\S+(.ffs.txt)$')
+ FileList = os.listdir(FfsPath[0])
+ for File in FileList:
+ Match = ReFileEnds.search(File)
+ if Match:
+ for Index in range(1, 8):
+ if Match.group(Index) and Match.group(Index) in MatchDict:
+ MatchDict[Match.group(Index)].append(File)
+ elif Match.group(Index):
+ MatchDict[Match.group(Index)] = [File]
+ if not MatchDict:
+ continue
+ if '.ui' in MatchDict:
+ for File in MatchDict['.ui']:
+ with open(os.path.join(FfsPath[0], File), 'rb') as F:
+ F.read()
+ length = F.tell()
+ F.seek(4)
+ TmpStr = unpack('%dh' % ((length - 4) // 2), F.read())
+ Name = ''.join(chr(c) for c in TmpStr[:-1])
+ else:
+ FileList = []
+ if 'fv.sec.txt' in MatchDict:
+ FileList = MatchDict['fv.sec.txt']
+ elif '.pe32.txt' in MatchDict:
+ FileList = MatchDict['.pe32.txt']
+ elif '.te.txt' in MatchDict:
+ FileList = MatchDict['.te.txt']
+ elif '.pic.txt' in MatchDict:
+ FileList = MatchDict['.pic.txt']
+ elif '.raw.txt' in MatchDict:
+ FileList = MatchDict['.raw.txt']
+ elif '.ffs.txt' in MatchDict:
+ FileList = MatchDict['.ffs.txt']
+ else:
+ pass
+ for File in FileList:
+ with open(os.path.join(FfsPath[0], File), 'r') as F:
+ Name.append((F.read().split()[-1]))
+ if not Name:
+ continue
+
+ Name = ' '.join(Name) if isinstance(Name, type([])) else Name
+ GuidXRefFile.append("%s %s\n" %(FileStatementGuid, Name))
+
+ # Append GUIDs, Protocols, and PPIs to the Xref file
+ GuidXRefFile.append("\n")
+ for key, item in GuidDict.items():
+ GuidXRefFile.append("%s %s\n" % (GuidStructureStringToGuidString(item).upper(), key))
+
+ if GuidXRefFile:
+ GuidXRefFile = ''.join(GuidXRefFile)
+ SaveFileOnChange(GuidXRefFileName, GuidXRefFile, False)
+ GenFdsGlobalVariable.InfLogger("\nGUID cross reference file can be found at %s" % GuidXRefFileName)
+ elif os.path.exists(GuidXRefFileName):
+ os.remove(GuidXRefFileName)
+
+
+if __name__ == '__main__':
+ r = main()
+ ## 0-127 is a safe return range, and 1 is a standard default error
+ if r < 0 or r > 127:
+ r = 1
+ exit(r)
+
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/roms/edk2/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
new file mode 100644
index 000000000..dc1727c46
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -0,0 +1,919 @@
+## @file
+# Global variables for GenFds
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+
+import Common.LongFilePathOs as os
+import sys
+from sys import stdout
+from subprocess import PIPE,Popen
+from struct import Struct
+from array import array
+
+from Common.BuildToolError import COMMAND_FAILURE,GENFDS_ERROR
+from Common import EdkLogger
+from Common.Misc import SaveFileOnChange
+
+from Common.TargetTxtClassObject import TargetTxtDict
+from Common.ToolDefClassObject import ToolDefDict
+from AutoGen.BuildEngine import ToolBuildRule
+import Common.DataType as DataType
+from Common.Misc import PathClass
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+import Common.GlobalData as GlobalData
+
+## Global variables
+#
+#
+class GenFdsGlobalVariable:
+ FvDir = ''
+ OutputDirDict = {}
+ BinDir = ''
+ # will be FvDir + os.sep + 'Ffs'
+ FfsDir = ''
+ FdfParser = None
+ LibDir = ''
+ WorkSpace = None
+ WorkSpaceDir = ''
+ ConfDir = ''
+ OutputDirFromDscDict = {}
+ TargetName = ''
+ ToolChainTag = ''
+ RuleDict = {}
+ ArchList = None
+ ActivePlatform = None
+ FvAddressFileName = ''
+ VerboseMode = False
+ DebugLevel = -1
+ SharpCounter = 0
+ SharpNumberPerLine = 40
+ FdfFile = ''
+ FdfFileTimeStamp = 0
+ FixedLoadAddress = False
+ PlatformName = ''
+
+ BuildRuleFamily = DataType.TAB_COMPILER_MSFT
+ ToolChainFamily = DataType.TAB_COMPILER_MSFT
+ __BuildRuleDatabase = None
+ GuidToolDefinition = {}
+ FfsCmdDict = {}
+ SecCmdList = []
+ CopyList = []
+ ModuleFile = ''
+ EnableGenfdsMultiThread = True
+
+ #
+ # The list whose element are flags to indicate if large FFS or SECTION files exist in FV.
+ # At the beginning of each generation of FV, false flag is appended to the list,
+ # after the call to GenerateSection returns, check the size of the output file,
+ # if it is greater than 0xFFFFFF, the tail flag in list is set to true,
+ # and EFI_FIRMWARE_FILE_SYSTEM3_GUID is passed to C GenFv.
+ # At the end of generation of FV, pop the flag.
+ # List is used as a stack to handle nested FV generation.
+ #
+ LargeFileInFvFlags = []
+ EFI_FIRMWARE_FILE_SYSTEM3_GUID = '5473C07A-3DCB-4dca-BD6F-1E9689E7349A'
+ LARGE_FILE_SIZE = 0x1000000
+
+ SectionHeader = Struct("3B 1B")
+
+ # FvName, FdName, CapName in FDF, Image file name
+ ImageBinDict = {}
+
+ ## LoadBuildRule
+ #
+ @staticmethod
+ def _LoadBuildRule():
+ if GenFdsGlobalVariable.__BuildRuleDatabase:
+ return GenFdsGlobalVariable.__BuildRuleDatabase
+ BuildRule = ToolBuildRule()
+ GenFdsGlobalVariable.__BuildRuleDatabase = BuildRule.ToolBuildRule
+ TargetObj = TargetTxtDict()
+ ToolDefinitionFile = TargetObj.Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
+ if ToolDefinitionFile == '':
+ ToolDefinitionFile = "Conf/tools_def.txt"
+ if os.path.isfile(ToolDefinitionFile):
+ ToolDefObj = ToolDefDict((os.path.join(os.getenv("WORKSPACE"), "Conf")))
+ ToolDefinition = ToolDefObj.ToolDef.ToolsDefTxtDatabase
+ if DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY in ToolDefinition \
+ and GenFdsGlobalVariable.ToolChainTag in ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY] \
+ and ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlobalVariable.ToolChainTag]:
+ GenFdsGlobalVariable.BuildRuleFamily = ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlobalVariable.ToolChainTag]
+
+ if DataType.TAB_TOD_DEFINES_FAMILY in ToolDefinition \
+ and GenFdsGlobalVariable.ToolChainTag in ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY] \
+ and ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY][GenFdsGlobalVariable.ToolChainTag]:
+ GenFdsGlobalVariable.ToolChainFamily = ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY][GenFdsGlobalVariable.ToolChainTag]
+ return GenFdsGlobalVariable.__BuildRuleDatabase
+
+ ## GetBuildRules
+ # @param Inf: object of InfBuildData
+ # @param Arch: current arch
+ #
+ @staticmethod
+ def GetBuildRules(Inf, Arch):
+ if not Arch:
+ Arch = DataType.TAB_COMMON
+
+ if not Arch in GenFdsGlobalVariable.OutputDirDict:
+ return {}
+
+ BuildRuleDatabase = GenFdsGlobalVariable._LoadBuildRule()
+ if not BuildRuleDatabase:
+ return {}
+
+ PathClassObj = PathClass(Inf.MetaFile.File,
+ GenFdsGlobalVariable.WorkSpaceDir)
+ BuildDir = os.path.join(
+ GenFdsGlobalVariable.OutputDirDict[Arch],
+ Arch,
+ PathClassObj.SubDir,
+ PathClassObj.BaseName
+ )
+ BinDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch], Arch)
+ Macro = {
+ "WORKSPACE":GenFdsGlobalVariable.WorkSpaceDir,
+ "MODULE_NAME":Inf.BaseName,
+ "MODULE_GUID":Inf.Guid,
+ "MODULE_VERSION":Inf.Version,
+ "MODULE_TYPE":Inf.ModuleType,
+ "MODULE_FILE":str(PathClassObj),
+ "MODULE_FILE_BASE_NAME":PathClassObj.BaseName,
+ "MODULE_RELATIVE_DIR":PathClassObj.SubDir,
+ "MODULE_DIR":PathClassObj.SubDir,
+ "BASE_NAME":Inf.BaseName,
+ "ARCH":Arch,
+ "TOOLCHAIN":GenFdsGlobalVariable.ToolChainTag,
+ "TOOLCHAIN_TAG":GenFdsGlobalVariable.ToolChainTag,
+ "TOOL_CHAIN_TAG":GenFdsGlobalVariable.ToolChainTag,
+ "TARGET":GenFdsGlobalVariable.TargetName,
+ "BUILD_DIR":GenFdsGlobalVariable.OutputDirDict[Arch],
+ "BIN_DIR":BinDir,
+ "LIB_DIR":BinDir,
+ "MODULE_BUILD_DIR":BuildDir,
+ "OUTPUT_DIR":os.path.join(BuildDir, "OUTPUT"),
+ "DEBUG_DIR":os.path.join(BuildDir, "DEBUG")
+ }
+
+ BuildRules = {}
+ for Type in BuildRuleDatabase.FileTypeList:
+ #first try getting build rule by BuildRuleFamily
+ RuleObject = BuildRuleDatabase[Type, Inf.BuildType, Arch, GenFdsGlobalVariable.BuildRuleFamily]
+ if not RuleObject:
+ # build type is always module type, but ...
+ if Inf.ModuleType != Inf.BuildType:
+ RuleObject = BuildRuleDatabase[Type, Inf.ModuleType, Arch, GenFdsGlobalVariable.BuildRuleFamily]
+ #second try getting build rule by ToolChainFamily
+ if not RuleObject:
+ RuleObject = BuildRuleDatabase[Type, Inf.BuildType, Arch, GenFdsGlobalVariable.ToolChainFamily]
+ if not RuleObject:
+ # build type is always module type, but ...
+ if Inf.ModuleType != Inf.BuildType:
+ RuleObject = BuildRuleDatabase[Type, Inf.ModuleType, Arch, GenFdsGlobalVariable.ToolChainFamily]
+ if not RuleObject:
+ continue
+ RuleObject = RuleObject.Instantiate(Macro)
+ BuildRules[Type] = RuleObject
+ for Ext in RuleObject.SourceFileExtList:
+ BuildRules[Ext] = RuleObject
+ return BuildRules
+
+ ## GetModuleCodaTargetList
+ #
+ # @param Inf: object of InfBuildData
+ # @param Arch: current arch
+ #
+ @staticmethod
+ def GetModuleCodaTargetList(Inf, Arch):
+ BuildRules = GenFdsGlobalVariable.GetBuildRules(Inf, Arch)
+ if not BuildRules:
+ return []
+
+ TargetList = set()
+ FileList = []
+
+ if not Inf.IsBinaryModule:
+ for File in Inf.Sources:
+ if File.TagName in {"", DataType.TAB_STAR, GenFdsGlobalVariable.ToolChainTag} and \
+ File.ToolChainFamily in {"", DataType.TAB_STAR, GenFdsGlobalVariable.ToolChainFamily}:
+ FileList.append((File, DataType.TAB_UNKNOWN_FILE))
+
+ for File in Inf.Binaries:
+ if File.Target in {DataType.TAB_COMMON, DataType.TAB_STAR, GenFdsGlobalVariable.TargetName}:
+ FileList.append((File, File.Type))
+
+ for File, FileType in FileList:
+ LastTarget = None
+ RuleChain = []
+ SourceList = [File]
+ Index = 0
+ while Index < len(SourceList):
+ Source = SourceList[Index]
+ Index = Index + 1
+
+ if File.IsBinary and File == Source and Inf.Binaries and File in Inf.Binaries:
+ # Skip all files that are not binary libraries
+ if not Inf.LibraryClass:
+ continue
+ RuleObject = BuildRules[DataType.TAB_DEFAULT_BINARY_FILE]
+ elif FileType in BuildRules:
+ RuleObject = BuildRules[FileType]
+ elif Source.Ext in BuildRules:
+ RuleObject = BuildRules[Source.Ext]
+ else:
+ # stop at no more rules
+ if LastTarget:
+ TargetList.add(str(LastTarget))
+ break
+
+ FileType = RuleObject.SourceFileType
+
+ # stop at STATIC_LIBRARY for library
+ if Inf.LibraryClass and FileType == DataType.TAB_STATIC_LIBRARY:
+ if LastTarget:
+ TargetList.add(str(LastTarget))
+ break
+
+ Target = RuleObject.Apply(Source)
+ if not Target:
+ if LastTarget:
+ TargetList.add(str(LastTarget))
+ break
+ elif not Target.Outputs:
+ # Only do build for target with outputs
+ TargetList.add(str(Target))
+
+ # to avoid cyclic rule
+ if FileType in RuleChain:
+ break
+
+ RuleChain.append(FileType)
+ SourceList.extend(Target.Outputs)
+ LastTarget = Target
+ FileType = DataType.TAB_UNKNOWN_FILE
+ for Cmd in Target.Commands:
+ if "$(CP)" == Cmd.split()[0]:
+ CpTarget = Cmd.split()[2]
+ TargetList.add(CpTarget)
+
+ return list(TargetList)
+
+ ## SetDir()
+ #
+ # @param OutputDir Output directory
+ # @param FdfParser FDF contents parser
+ # @param Workspace The directory of workspace
+ # @param ArchList The Arch list of platform
+ #
+ @staticmethod
+ def SetDir (OutputDir, FdfParser, WorkSpace, ArchList):
+ GenFdsGlobalVariable.VerboseLogger("GenFdsGlobalVariable.OutputDir:%s" % OutputDir)
+ GenFdsGlobalVariable.FdfParser = FdfParser
+ GenFdsGlobalVariable.WorkSpace = WorkSpace
+ GenFdsGlobalVariable.FvDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[ArchList[0]], DataType.TAB_FV_DIRECTORY)
+ if not os.path.exists(GenFdsGlobalVariable.FvDir):
+ os.makedirs(GenFdsGlobalVariable.FvDir)
+ GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
+ if not os.path.exists(GenFdsGlobalVariable.FfsDir):
+ os.makedirs(GenFdsGlobalVariable.FfsDir)
+
+ #
+ # Create FV Address inf file
+ #
+ GenFdsGlobalVariable.FvAddressFileName = os.path.join(GenFdsGlobalVariable.FfsDir, 'FvAddress.inf')
+ FvAddressFile = open(GenFdsGlobalVariable.FvAddressFileName, 'w')
+ #
+ # Add [Options]
+ #
+ FvAddressFile.writelines("[options]" + DataType.TAB_LINE_BREAK)
+ BsAddress = '0'
+ for Arch in ArchList:
+ if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].BsBaseAddress:
+ BsAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].BsBaseAddress
+ break
+
+ FvAddressFile.writelines("EFI_BOOT_DRIVER_BASE_ADDRESS = " + \
+ BsAddress + \
+ DataType.TAB_LINE_BREAK)
+
+ RtAddress = '0'
+ for Arch in reversed(ArchList):
+ temp = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtBaseAddress
+ if temp:
+ RtAddress = temp
+ break
+
+ FvAddressFile.writelines("EFI_RUNTIME_DRIVER_BASE_ADDRESS = " + \
+ RtAddress + \
+ DataType.TAB_LINE_BREAK)
+
+ FvAddressFile.close()
+
+ @staticmethod
+ def SetEnv(FdfParser, WorkSpace, ArchList, GlobalData):
+ GenFdsGlobalVariable.ModuleFile = WorkSpace.ModuleFile
+ GenFdsGlobalVariable.FdfParser = FdfParser
+ GenFdsGlobalVariable.WorkSpace = WorkSpace.Db
+ GenFdsGlobalVariable.ArchList = ArchList
+ GenFdsGlobalVariable.ToolChainTag = GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]
+ GenFdsGlobalVariable.TargetName = GlobalData.gGlobalDefines["TARGET"]
+ GenFdsGlobalVariable.ActivePlatform = GlobalData.gActivePlatform
+ GenFdsGlobalVariable.ConfDir = GlobalData.gConfDirectory
+ GenFdsGlobalVariable.EnableGenfdsMultiThread = GlobalData.gEnableGenfdsMultiThread
+ for Arch in ArchList:
+ GenFdsGlobalVariable.OutputDirDict[Arch] = os.path.normpath(
+ os.path.join(GlobalData.gWorkspace,
+ WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GlobalData.gGlobalDefines['TARGET'],
+ GlobalData.gGlobalDefines['TOOLCHAIN']].OutputDirectory,
+ GlobalData.gGlobalDefines['TARGET'] +'_' + GlobalData.gGlobalDefines['TOOLCHAIN']))
+ GenFdsGlobalVariable.OutputDirFromDscDict[Arch] = os.path.normpath(
+ WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,
+ GlobalData.gGlobalDefines['TARGET'], GlobalData.gGlobalDefines['TOOLCHAIN']].OutputDirectory)
+ GenFdsGlobalVariable.PlatformName = WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,
+ GlobalData.gGlobalDefines['TARGET'],
+ GlobalData.gGlobalDefines['TOOLCHAIN']].PlatformName
+ GenFdsGlobalVariable.FvDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[ArchList[0]], DataType.TAB_FV_DIRECTORY)
+ if not os.path.exists(GenFdsGlobalVariable.FvDir):
+ os.makedirs(GenFdsGlobalVariable.FvDir)
+ GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
+ if not os.path.exists(GenFdsGlobalVariable.FfsDir):
+ os.makedirs(GenFdsGlobalVariable.FfsDir)
+
+ #
+ # Create FV Address inf file
+ #
+ GenFdsGlobalVariable.FvAddressFileName = os.path.join(GenFdsGlobalVariable.FfsDir, 'FvAddress.inf')
+ FvAddressFile = open(GenFdsGlobalVariable.FvAddressFileName, 'w')
+ #
+ # Add [Options]
+ #
+ FvAddressFile.writelines("[options]" + DataType.TAB_LINE_BREAK)
+ BsAddress = '0'
+ for Arch in ArchList:
+ BsAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,
+ GlobalData.gGlobalDefines['TARGET'],
+ GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]].BsBaseAddress
+ if BsAddress:
+ break
+
+ FvAddressFile.writelines("EFI_BOOT_DRIVER_BASE_ADDRESS = " + \
+ BsAddress + \
+ DataType.TAB_LINE_BREAK)
+
+ RtAddress = '0'
+ for Arch in reversed(ArchList):
+ temp = GenFdsGlobalVariable.WorkSpace.BuildObject[
+ GenFdsGlobalVariable.ActivePlatform, Arch, GlobalData.gGlobalDefines['TARGET'],
+ GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]].RtBaseAddress
+ if temp:
+ RtAddress = temp
+ break
+
+ FvAddressFile.writelines("EFI_RUNTIME_DRIVER_BASE_ADDRESS = " + \
+ RtAddress + \
+ DataType.TAB_LINE_BREAK)
+
+ FvAddressFile.close()
+
+ ## ReplaceWorkspaceMacro()
+ #
+ # @param String String that may contain macro
+ #
+ @staticmethod
+ def ReplaceWorkspaceMacro(String):
+ String = mws.handleWsMacro(String)
+ Str = String.replace('$(WORKSPACE)', GenFdsGlobalVariable.WorkSpaceDir)
+ if os.path.exists(Str):
+ if not os.path.isabs(Str):
+ Str = os.path.abspath(Str)
+ else:
+ Str = mws.join(GenFdsGlobalVariable.WorkSpaceDir, String)
+ return os.path.normpath(Str)
+
+ ## Check if the input files are newer than output files
+ #
+ # @param Output Path of output file
+ # @param Input Path list of input files
+ #
+ # @retval True if Output doesn't exist, or any Input is newer
+ # @retval False if all Input is older than Output
+ #
+ @staticmethod
+ def NeedsUpdate(Output, Input):
+ if not os.path.exists(Output):
+ return True
+ # always update "Output" if no "Input" given
+ if not Input:
+ return True
+
+ # if fdf file is changed after the 'Output" is generated, update the 'Output'
+ OutputTime = os.path.getmtime(Output)
+ if GenFdsGlobalVariable.FdfFileTimeStamp > OutputTime:
+ return True
+
+ for F in Input:
+ # always update "Output" if any "Input" doesn't exist
+ if not os.path.exists(F):
+ return True
+ # always update "Output" if any "Input" is newer than "Output"
+ if os.path.getmtime(F) > OutputTime:
+ return True
+ return False
+
+ @staticmethod
+ def GenerateSection(Output, Input, Type=None, CompressionType=None, Guid=None,
+ GuidHdrLen=None, GuidAttr=[], Ui=None, Ver=None, InputAlign=[], BuildNumber=None, DummyFile=None, IsMakefile=False):
+ Cmd = ["GenSec"]
+ if Type:
+ Cmd += ("-s", Type)
+ if CompressionType:
+ Cmd += ("-c", CompressionType)
+ if Guid:
+ Cmd += ("-g", Guid)
+ if DummyFile:
+ Cmd += ("--dummy", DummyFile)
+ if GuidHdrLen:
+ Cmd += ("-l", GuidHdrLen)
+ #Add each guided attribute
+ for Attr in GuidAttr:
+ Cmd += ("-r", Attr)
+ #Section Align is only for dummy section without section type
+ for SecAlign in InputAlign:
+ Cmd += ("--sectionalign", SecAlign)
+
+ CommandFile = Output + '.txt'
+ if Ui:
+ if IsMakefile:
+ if Ui == "$(MODULE_NAME)":
+ Cmd += ('-n', Ui)
+ else:
+ Cmd += ("-n", '"' + Ui + '"')
+ Cmd += ("-o", Output)
+ if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
+ GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
+ else:
+ SectionData = array('B', [0, 0, 0, 0])
+ SectionData.fromstring(Ui.encode("utf_16_le"))
+ SectionData.append(0)
+ SectionData.append(0)
+ Len = len(SectionData)
+ GenFdsGlobalVariable.SectionHeader.pack_into(SectionData, 0, Len & 0xff, (Len >> 8) & 0xff, (Len >> 16) & 0xff, 0x15)
+ SaveFileOnChange(Output, SectionData.tostring())
+
+ elif Ver:
+ Cmd += ("-n", Ver)
+ if BuildNumber:
+ Cmd += ("-j", BuildNumber)
+ Cmd += ("-o", Output)
+
+ SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
+ if IsMakefile:
+ if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
+ GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
+ else:
+ if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):
+ return
+ GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")
+ else:
+ Cmd += ("-o", Output)
+ Cmd += Input
+
+ SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
+ if IsMakefile:
+ if sys.platform == "win32":
+ Cmd = ['if', 'exist', Input[0]] + Cmd
+ else:
+ Cmd = ['-test', '-e', Input[0], "&&"] + Cmd
+ if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
+ GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
+ elif GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):
+ GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
+ GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")
+ if (os.path.getsize(Output) >= GenFdsGlobalVariable.LARGE_FILE_SIZE and
+ GenFdsGlobalVariable.LargeFileInFvFlags):
+ GenFdsGlobalVariable.LargeFileInFvFlags[-1] = True
+
+ @staticmethod
+ def GetAlignment (AlignString):
+ if not AlignString:
+ return 0
+ if AlignString.endswith('K'):
+ return int (AlignString.rstrip('K')) * 1024
+ if AlignString.endswith('M'):
+ return int (AlignString.rstrip('M')) * 1024 * 1024
+ if AlignString.endswith('G'):
+ return int (AlignString.rstrip('G')) * 1024 * 1024 * 1024
+ return int (AlignString)
+
+ @staticmethod
+ def GenerateFfs(Output, Input, Type, Guid, Fixed=False, CheckSum=False, Align=None,
+ SectionAlign=None, MakefilePath=None):
+ Cmd = ["GenFfs", "-t", Type, "-g", Guid]
+ mFfsValidAlign = ["0", "8", "16", "128", "512", "1K", "4K", "32K", "64K", "128K", "256K", "512K", "1M", "2M", "4M", "8M", "16M"]
+ if Fixed == True:
+ Cmd.append("-x")
+ if CheckSum:
+ Cmd.append("-s")
+ if Align:
+ if Align not in mFfsValidAlign:
+ Align = GenFdsGlobalVariable.GetAlignment (Align)
+ for index in range(0, len(mFfsValidAlign) - 1):
+ if ((Align > GenFdsGlobalVariable.GetAlignment(mFfsValidAlign[index])) and (Align <= GenFdsGlobalVariable.GetAlignment(mFfsValidAlign[index + 1]))):
+ break
+ Align = mFfsValidAlign[index + 1]
+ Cmd += ("-a", Align)
+
+ Cmd += ("-o", Output)
+ for I in range(0, len(Input)):
+ if MakefilePath:
+ Cmd += ("-oi", Input[I])
+ else:
+ Cmd += ("-i", Input[I])
+ if SectionAlign and SectionAlign[I]:
+ Cmd += ("-n", SectionAlign[I])
+
+ CommandFile = Output + '.txt'
+ SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
+
+ GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
+ if MakefilePath:
+ if (tuple(Cmd), tuple(GenFdsGlobalVariable.SecCmdList), tuple(GenFdsGlobalVariable.CopyList)) not in GenFdsGlobalVariable.FfsCmdDict:
+ GenFdsGlobalVariable.FfsCmdDict[tuple(Cmd), tuple(GenFdsGlobalVariable.SecCmdList), tuple(GenFdsGlobalVariable.CopyList)] = MakefilePath
+ GenFdsGlobalVariable.SecCmdList = []
+ GenFdsGlobalVariable.CopyList = []
+ else:
+ if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):
+ return
+ GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FFS")
+
+ @staticmethod
+ def GenerateFirmwareVolume(Output, Input, BaseAddress=None, ForceRebase=None, Capsule=False, Dump=False,
+ AddressFile=None, MapFile=None, FfsList=[], FileSystemGuid=None):
+ if not GenFdsGlobalVariable.NeedsUpdate(Output, Input+FfsList):
+ return
+ GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
+
+ Cmd = ["GenFv"]
+ if BaseAddress:
+ Cmd += ("-r", BaseAddress)
+
+ if ForceRebase == False:
+ Cmd += ("-F", "FALSE")
+ elif ForceRebase == True:
+ Cmd += ("-F", "TRUE")
+
+ if Capsule:
+ Cmd.append("-c")
+ if Dump:
+ Cmd.append("-p")
+ if AddressFile:
+ Cmd += ("-a", AddressFile)
+ if MapFile:
+ Cmd += ("-m", MapFile)
+ if FileSystemGuid:
+ Cmd += ("-g", FileSystemGuid)
+ Cmd += ("-o", Output)
+ for I in Input:
+ Cmd += ("-i", I)
+
+ GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FV")
+
+ @staticmethod
+ def GenerateFirmwareImage(Output, Input, Type="efi", SubType=None, Zero=False,
+ Strip=False, Replace=False, TimeStamp=None, Join=False,
+ Align=None, Padding=None, Convert=False, IsMakefile=False):
+ if not GenFdsGlobalVariable.NeedsUpdate(Output, Input) and not IsMakefile:
+ return
+ GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
+
+ Cmd = ["GenFw"]
+ if Type.lower() == "te":
+ Cmd.append("-t")
+ if SubType:
+ Cmd += ("-e", SubType)
+ if TimeStamp:
+ Cmd += ("-s", TimeStamp)
+ if Align:
+ Cmd += ("-a", Align)
+ if Padding:
+ Cmd += ("-p", Padding)
+ if Zero:
+ Cmd.append("-z")
+ if Strip:
+ Cmd.append("-l")
+ if Replace:
+ Cmd.append("-r")
+ if Join:
+ Cmd.append("-j")
+ if Convert:
+ Cmd.append("-m")
+ Cmd += ("-o", Output)
+ Cmd += Input
+ if IsMakefile:
+ if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
+ GenFdsGlobalVariable.SecCmdList.append(" ".join(Cmd).strip())
+ else:
+ GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate firmware image")
+
+ @staticmethod
+ def GenerateOptionRom(Output, EfiInput, BinaryInput, Compress=False, ClassCode=None,
+ Revision=None, DeviceId=None, VendorId=None, IsMakefile=False):
+ InputList = []
+ Cmd = ["EfiRom"]
+ if EfiInput:
+
+ if Compress:
+ Cmd.append("-ec")
+ else:
+ Cmd.append("-e")
+
+ for EfiFile in EfiInput:
+ Cmd.append(EfiFile)
+ InputList.append (EfiFile)
+
+ if BinaryInput:
+ Cmd.append("-b")
+ for BinFile in BinaryInput:
+ Cmd.append(BinFile)
+ InputList.append (BinFile)
+
+ # Check List
+ if not GenFdsGlobalVariable.NeedsUpdate(Output, InputList) and not IsMakefile:
+ return
+ GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList))
+
+ if ClassCode:
+ Cmd += ("-l", ClassCode)
+ if Revision:
+ Cmd += ("-r", Revision)
+ if DeviceId:
+ Cmd += ("-i", DeviceId)
+ if VendorId:
+ Cmd += ("-f", VendorId)
+
+ Cmd += ("-o", Output)
+ if IsMakefile:
+ if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
+ GenFdsGlobalVariable.SecCmdList.append(" ".join(Cmd).strip())
+ else:
+ GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate option rom")
+
+ @staticmethod
+ def GuidTool(Output, Input, ToolPath, Options='', returnValue=[], IsMakefile=False):
+ if not GenFdsGlobalVariable.NeedsUpdate(Output, Input) and not IsMakefile:
+ return
+ GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
+
+ Cmd = [ToolPath, ]
+ Cmd += Options.split(' ')
+ Cmd += ("-o", Output)
+ Cmd += Input
+ if IsMakefile:
+ if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
+ GenFdsGlobalVariable.SecCmdList.append(" ".join(Cmd).strip())
+ else:
+ GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to call " + ToolPath, returnValue)
+
+ @staticmethod
+ def CallExternalTool (cmd, errorMess, returnValue=[]):
+
+ if type(cmd) not in (tuple, list):
+ GenFdsGlobalVariable.ErrorLogger("ToolError! Invalid parameter type in call to CallExternalTool")
+
+ if GenFdsGlobalVariable.DebugLevel != -1:
+ cmd += ('--debug', str(GenFdsGlobalVariable.DebugLevel))
+ GenFdsGlobalVariable.InfLogger (cmd)
+
+ if GenFdsGlobalVariable.VerboseMode:
+ cmd += ('-v',)
+ GenFdsGlobalVariable.InfLogger (cmd)
+ else:
+ stdout.write ('#')
+ stdout.flush()
+ GenFdsGlobalVariable.SharpCounter = GenFdsGlobalVariable.SharpCounter + 1
+ if GenFdsGlobalVariable.SharpCounter % GenFdsGlobalVariable.SharpNumberPerLine == 0:
+ stdout.write('\n')
+
+ try:
+ PopenObject = Popen(' '.join(cmd), stdout=PIPE, stderr=PIPE, shell=True)
+ except Exception as X:
+ EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))
+ (out, error) = PopenObject.communicate()
+
+ while PopenObject.returncode is None:
+ PopenObject.wait()
+ if returnValue != [] and returnValue[0] != 0:
+ #get command return value
+ returnValue[0] = PopenObject.returncode
+ return
+ if PopenObject.returncode != 0 or GenFdsGlobalVariable.VerboseMode or GenFdsGlobalVariable.DebugLevel != -1:
+ GenFdsGlobalVariable.InfLogger ("Return Value = %d" % PopenObject.returncode)
+ GenFdsGlobalVariable.InfLogger(out.decode(encoding='utf-8', errors='ignore'))
+ GenFdsGlobalVariable.InfLogger(error.decode(encoding='utf-8', errors='ignore'))
+ if PopenObject.returncode != 0:
+ print("###", cmd)
+ EdkLogger.error("GenFds", COMMAND_FAILURE, errorMess)
+
+ @staticmethod
+ def VerboseLogger (msg):
+ EdkLogger.verbose(msg)
+
+ @staticmethod
+ def InfLogger (msg):
+ EdkLogger.info(msg)
+
+ @staticmethod
+ def ErrorLogger (msg, File=None, Line=None, ExtraData=None):
+ EdkLogger.error('GenFds', GENFDS_ERROR, msg, File, Line, ExtraData)
+
+ @staticmethod
+ def DebugLogger (Level, msg):
+ EdkLogger.debug(Level, msg)
+
+ ## MacroExtend()
+ #
+ # @param Str String that may contain macro
+ # @param MacroDict Dictionary that contains macro value pair
+ #
+ @staticmethod
+ def MacroExtend (Str, MacroDict=None, Arch=DataType.TAB_COMMON):
+ if Str is None:
+ return None
+
+ Dict = {'$(WORKSPACE)': GenFdsGlobalVariable.WorkSpaceDir,
+# '$(OUTPUT_DIRECTORY)': GenFdsGlobalVariable.OutputDirFromDsc,
+ '$(TARGET)': GenFdsGlobalVariable.TargetName,
+ '$(TOOL_CHAIN_TAG)': GenFdsGlobalVariable.ToolChainTag,
+ '$(SPACE)': ' '
+ }
+
+ if Arch != DataType.TAB_COMMON and Arch in GenFdsGlobalVariable.ArchList:
+ OutputDir = GenFdsGlobalVariable.OutputDirFromDscDict[Arch]
+ else:
+ OutputDir = GenFdsGlobalVariable.OutputDirFromDscDict[GenFdsGlobalVariable.ArchList[0]]
+
+ Dict['$(OUTPUT_DIRECTORY)'] = OutputDir
+
+ if MacroDict:
+ Dict.update(MacroDict)
+
+ for key in Dict:
+ if Str.find(key) >= 0:
+ Str = Str.replace (key, Dict[key])
+
+ if Str.find('$(ARCH)') >= 0:
+ if len(GenFdsGlobalVariable.ArchList) == 1:
+ Str = Str.replace('$(ARCH)', GenFdsGlobalVariable.ArchList[0])
+ else:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "No way to determine $(ARCH) for %s" % Str)
+
+ return Str
+
+ ## GetPcdValue()
+ #
+ # @param PcdPattern pattern that labels a PCD.
+ #
+ @staticmethod
+ def GetPcdValue (PcdPattern):
+ if PcdPattern is None:
+ return None
+ if PcdPattern.startswith('PCD('):
+ PcdPair = PcdPattern[4:].rstrip(')').strip().split('.')
+ else:
+ PcdPair = PcdPattern.strip().split('.')
+ TokenSpace = PcdPair[0]
+ TokenCName = PcdPair[1]
+
+ for Arch in GenFdsGlobalVariable.ArchList:
+ Platform = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ PcdDict = Platform.Pcds
+ for Key in PcdDict:
+ PcdObj = PcdDict[Key]
+ if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
+ if PcdObj.Type != DataType.TAB_PCDS_FIXED_AT_BUILD:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
+ if PcdObj.DatumType != DataType.TAB_VOID:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
+
+ return PcdObj.DefaultValue
+
+ for Package in GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform,
+ Arch,
+ GenFdsGlobalVariable.TargetName,
+ GenFdsGlobalVariable.ToolChainTag):
+ PcdDict = Package.Pcds
+ for Key in PcdDict:
+ PcdObj = PcdDict[Key]
+ if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
+ if PcdObj.Type != DataType.TAB_PCDS_FIXED_AT_BUILD:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
+ if PcdObj.DatumType != DataType.TAB_VOID:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
+
+ return PcdObj.DefaultValue
+
+ return ''
+
+## FindExtendTool()
+#
+# Find location of tools to process data
+#
+# @param KeyStringList Filter for inputs of section generation
+# @param CurrentArchList Arch list
+# @param NameGuid The Guid name
+#
+def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
+ ToolDefObj = ToolDefDict((os.path.join(os.getenv("WORKSPACE"), "Conf")))
+ ToolDef = ToolDefObj.ToolDef
+ ToolDb = ToolDef.ToolsDefTxtDatabase
+ # if user not specify filter, try to deduce it from global data.
+ if KeyStringList is None or KeyStringList == []:
+ Target = GenFdsGlobalVariable.TargetName
+ ToolChain = GenFdsGlobalVariable.ToolChainTag
+ if ToolChain not in ToolDb['TOOL_CHAIN_TAG']:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "Can not find external tool because tool tag %s is not defined in tools_def.txt!" % ToolChain)
+ KeyStringList = [Target + '_' + ToolChain + '_' + CurrentArchList[0]]
+ for Arch in CurrentArchList:
+ if Target + '_' + ToolChain + '_' + Arch not in KeyStringList:
+ KeyStringList.append(Target + '_' + ToolChain + '_' + Arch)
+
+ if GenFdsGlobalVariable.GuidToolDefinition:
+ if NameGuid in GenFdsGlobalVariable.GuidToolDefinition:
+ return GenFdsGlobalVariable.GuidToolDefinition[NameGuid]
+
+ ToolDefinition = ToolDef.ToolsDefTxtDictionary
+ ToolPathTmp = None
+ ToolOption = None
+ ToolPathKey = None
+ ToolOptionKey = None
+ KeyList = None
+ for tool_def in ToolDefinition.items():
+ if NameGuid.lower() == tool_def[1].lower():
+ KeyList = tool_def[0].split('_')
+ Key = KeyList[0] + \
+ '_' + \
+ KeyList[1] + \
+ '_' + \
+ KeyList[2]
+ if Key in KeyStringList and KeyList[4] == DataType.TAB_GUID:
+ ToolPathKey = Key + '_' + KeyList[3] + '_PATH'
+ ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'
+ ToolPath = ToolDefinition.get(ToolPathKey)
+ ToolOption = ToolDefinition.get(ToolOptionKey)
+ if ToolPathTmp is None:
+ ToolPathTmp = ToolPath
+ else:
+ if ToolPathTmp != ToolPath:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "Don't know which tool to use, %s or %s ?" % (ToolPathTmp, ToolPath))
+
+ BuildOption = {}
+ for Arch in CurrentArchList:
+ Platform = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ # key is (ToolChainFamily, ToolChain, CodeBase)
+ for item in Platform.BuildOptions:
+ if '_PATH' in item[1] or '_FLAGS' in item[1] or '_GUID' in item[1]:
+ if not item[0] or (item[0] and GenFdsGlobalVariable.ToolChainFamily== item[0]):
+ if item[1] not in BuildOption:
+ BuildOption[item[1]] = Platform.BuildOptions[item]
+ if BuildOption:
+ ToolList = [DataType.TAB_TOD_DEFINES_TARGET, DataType.TAB_TOD_DEFINES_TOOL_CHAIN_TAG, DataType.TAB_TOD_DEFINES_TARGET_ARCH]
+ for Index in range(2, -1, -1):
+ for Key in list(BuildOption.keys()):
+ List = Key.split('_')
+ if List[Index] == DataType.TAB_STAR:
+ for String in ToolDb[ToolList[Index]]:
+ if String in [Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]:
+ List[Index] = String
+ NewKey = '%s_%s_%s_%s_%s' % tuple(List)
+ if NewKey not in BuildOption:
+ BuildOption[NewKey] = BuildOption[Key]
+ continue
+ del BuildOption[Key]
+ elif List[Index] not in ToolDb[ToolList[Index]]:
+ del BuildOption[Key]
+ if BuildOption:
+ if not KeyList:
+ for Op in BuildOption:
+ if NameGuid == BuildOption[Op]:
+ KeyList = Op.split('_')
+ Key = KeyList[0] + '_' + KeyList[1] +'_' + KeyList[2]
+ if Key in KeyStringList and KeyList[4] == DataType.TAB_GUID:
+ ToolPathKey = Key + '_' + KeyList[3] + '_PATH'
+ ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'
+ if ToolPathKey in BuildOption:
+ ToolPathTmp = BuildOption[ToolPathKey]
+ if ToolOptionKey in BuildOption:
+ ToolOption = BuildOption[ToolOptionKey]
+
+ GenFdsGlobalVariable.GuidToolDefinition[NameGuid] = (ToolPathTmp, ToolOption)
+ return ToolPathTmp, ToolOption
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/GuidSection.py b/roms/edk2/BaseTools/Source/Python/GenFds/GuidSection.py
new file mode 100644
index 000000000..8db6e2feb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/GuidSection.py
@@ -0,0 +1,278 @@
+## @file
+# process GUIDed section generation
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from . import Section
+import subprocess
+from .Ffs import SectionSuffix
+import Common.LongFilePathOs as os
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+from .GenFdsGlobalVariable import FindExtendTool
+from CommonDataClass.FdfClass import GuidSectionClassObject
+import sys
+from Common import EdkLogger
+from Common.BuildToolError import *
+from .FvImageSection import FvImageSection
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.DataType import *
+
+## generate GUIDed section
+#
+#
+class GuidSection(GuidSectionClassObject) :
+
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ GuidSectionClassObject.__init__(self)
+
+ ## GenSection() method
+ #
+ # Generate GUIDed section
+ #
+ # @param self The object pointer
+ # @param OutputPath Where to place output file
+ # @param ModuleName Which module this section belongs to
+ # @param SecNum Index of section
+ # @param KeyStringList Filter for inputs of section generation
+ # @param FfsInf FfsInfStatement object that contains this section data
+ # @param Dict dictionary contains macro and its value
+ # @retval tuple (Generated file name, section alignment)
+ #
+ def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf=None, Dict=None, IsMakefile=False):
+ #
+ # Generate all section
+ #
+ self.KeyStringList = KeyStringList
+ self.CurrentArchList = GenFdsGlobalVariable.ArchList
+ if FfsInf is not None:
+ self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
+ self.NameGuid = FfsInf.__ExtendMacro__(self.NameGuid)
+ self.SectionType = FfsInf.__ExtendMacro__(self.SectionType)
+ self.CurrentArchList = [FfsInf.CurrentArch]
+
+ SectFile = tuple()
+ SectAlign = []
+ Index = 0
+ MaxAlign = None
+ if Dict is None:
+ Dict = {}
+ if self.FvAddr != []:
+ FvAddrIsSet = True
+ else:
+ FvAddrIsSet = False
+
+ if self.ProcessRequired in ("TRUE", "1"):
+ if self.FvAddr != []:
+ #no use FvAddr when the image is processed.
+ self.FvAddr = []
+ if self.FvParentAddr is not None:
+ #no use Parent Addr when the image is processed.
+ self.FvParentAddr = None
+
+ for Sect in self.SectionList:
+ Index = Index + 1
+ SecIndex = '%s.%d' % (SecNum, Index)
+ # set base address for inside FvImage
+ if isinstance(Sect, FvImageSection):
+ if self.FvAddr != []:
+ Sect.FvAddr = self.FvAddr.pop(0)
+ self.IncludeFvSection = True
+ elif isinstance(Sect, GuidSection):
+ Sect.FvAddr = self.FvAddr
+ Sect.FvParentAddr = self.FvParentAddr
+ ReturnSectList, align = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict, IsMakefile=IsMakefile)
+ if isinstance(Sect, GuidSection):
+ if Sect.IncludeFvSection:
+ self.IncludeFvSection = Sect.IncludeFvSection
+
+ if align is not None:
+ if MaxAlign is None:
+ MaxAlign = align
+ if GenFdsGlobalVariable.GetAlignment (align) > GenFdsGlobalVariable.GetAlignment (MaxAlign):
+ MaxAlign = align
+ if ReturnSectList != []:
+ if align is None:
+ align = "1"
+ for file in ReturnSectList:
+ SectFile += (file,)
+ SectAlign.append(align)
+
+ if MaxAlign is not None:
+ if self.Alignment is None:
+ self.Alignment = MaxAlign
+ else:
+ if GenFdsGlobalVariable.GetAlignment (MaxAlign) > GenFdsGlobalVariable.GetAlignment (self.Alignment):
+ self.Alignment = MaxAlign
+
+ OutputFile = OutputPath + \
+ os.sep + \
+ ModuleName + \
+ SUP_MODULE_SEC + \
+ SecNum + \
+ SectionSuffix['GUIDED']
+ OutputFile = os.path.normpath(OutputFile)
+
+ ExternalTool = None
+ ExternalOption = None
+ if self.NameGuid is not None:
+ ExternalTool, ExternalOption = FindExtendTool(self.KeyStringList, self.CurrentArchList, self.NameGuid)
+
+ #
+ # If not have GUID , call default
+ # GENCRC32 section
+ #
+ if self.NameGuid is None :
+ GenFdsGlobalVariable.VerboseLogger("Use GenSection function Generate CRC32 Section")
+ GenFdsGlobalVariable.GenerateSection(OutputFile, SectFile, Section.Section.SectionType[self.SectionType], InputAlign=SectAlign, IsMakefile=IsMakefile)
+ OutputFileList = []
+ OutputFileList.append(OutputFile)
+ return OutputFileList, self.Alignment
+ #or GUID not in External Tool List
+ elif ExternalTool is None:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "No tool found with GUID %s" % self.NameGuid)
+ else:
+ DummyFile = OutputFile + ".dummy"
+ #
+ # Call GenSection with DUMMY section type.
+ #
+ GenFdsGlobalVariable.GenerateSection(DummyFile, SectFile, InputAlign=SectAlign, IsMakefile=IsMakefile)
+ #
+ # Use external tool process the Output
+ #
+ TempFile = OutputPath + \
+ os.sep + \
+ ModuleName + \
+ SUP_MODULE_SEC + \
+ SecNum + \
+ '.tmp'
+ TempFile = os.path.normpath(TempFile)
+ #
+ # Remove temp file if its time stamp is older than dummy file
+ # Just in case the external tool fails at this time but succeeded before
+ # Error should be reported if the external tool does not generate a new output based on new input
+ #
+ if os.path.exists(TempFile) and os.path.exists(DummyFile) and os.path.getmtime(TempFile) < os.path.getmtime(DummyFile):
+ os.remove(TempFile)
+
+ FirstCall = False
+ CmdOption = '-e'
+ if ExternalOption is not None:
+ CmdOption = CmdOption + ' ' + ExternalOption
+ if not GenFdsGlobalVariable.EnableGenfdsMultiThread:
+ if self.ProcessRequired not in ("TRUE", "1") and self.IncludeFvSection and not FvAddrIsSet and self.FvParentAddr is not None:
+ #FirstCall is only set for the encapsulated flash FV image without process required attribute.
+ FirstCall = True
+ #
+ # Call external tool
+ #
+ ReturnValue = [1]
+ if FirstCall:
+ #first try to call the guided tool with -z option and CmdOption for the no process required guided tool.
+ GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, '-z' + ' ' + CmdOption, ReturnValue)
+
+ #
+ # when no call or first call failed, ReturnValue are not 1.
+ # Call the guided tool with CmdOption
+ #
+ if ReturnValue[0] != 0:
+ FirstCall = False
+ ReturnValue[0] = 0
+ GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, CmdOption)
+ #
+ # There is external tool which does not follow standard rule which return nonzero if tool fails
+ # The output file has to be checked
+ #
+
+ if not os.path.exists(TempFile) :
+ EdkLogger.error("GenFds", COMMAND_FAILURE, 'Fail to call %s, no output file was generated' % ExternalTool)
+
+ FileHandleIn = open(DummyFile, 'rb')
+ FileHandleIn.seek(0, 2)
+ InputFileSize = FileHandleIn.tell()
+
+ FileHandleOut = open(TempFile, 'rb')
+ FileHandleOut.seek(0, 2)
+ TempFileSize = FileHandleOut.tell()
+
+ Attribute = []
+ HeaderLength = None
+ if self.ExtraHeaderSize != -1:
+ HeaderLength = str(self.ExtraHeaderSize)
+
+ if self.ProcessRequired == "NONE" and HeaderLength is None:
+ if TempFileSize > InputFileSize:
+ FileHandleIn.seek(0)
+ BufferIn = FileHandleIn.read()
+ FileHandleOut.seek(0)
+ BufferOut = FileHandleOut.read()
+ if BufferIn == BufferOut[TempFileSize - InputFileSize:]:
+ HeaderLength = str(TempFileSize - InputFileSize)
+ #auto sec guided attribute with process required
+ if HeaderLength is None:
+ Attribute.append('PROCESSING_REQUIRED')
+
+ FileHandleIn.close()
+ FileHandleOut.close()
+
+ if FirstCall and 'PROCESSING_REQUIRED' in Attribute:
+ # Guided data by -z option on first call is the process required data. Call the guided tool with the real option.
+ GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, CmdOption)
+
+ #
+ # Call Gensection Add Section Header
+ #
+ if self.ProcessRequired in ("TRUE", "1"):
+ if 'PROCESSING_REQUIRED' not in Attribute:
+ Attribute.append('PROCESSING_REQUIRED')
+
+ if self.AuthStatusValid in ("TRUE", "1"):
+ Attribute.append('AUTH_STATUS_VALID')
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [TempFile], Section.Section.SectionType['GUIDED'],
+ Guid=self.NameGuid, GuidAttr=Attribute, GuidHdrLen=HeaderLength)
+
+ else:
+ #add input file for GenSec get PROCESSING_REQUIRED
+ GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, CmdOption, IsMakefile=IsMakefile)
+ Attribute = []
+ HeaderLength = None
+ if self.ExtraHeaderSize != -1:
+ HeaderLength = str(self.ExtraHeaderSize)
+ if self.AuthStatusValid in ("TRUE", "1"):
+ Attribute.append('AUTH_STATUS_VALID')
+ if self.ProcessRequired == "NONE" and HeaderLength is None:
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [TempFile], Section.Section.SectionType['GUIDED'],
+ Guid=self.NameGuid, GuidAttr=Attribute,
+ GuidHdrLen=HeaderLength, DummyFile=DummyFile, IsMakefile=IsMakefile)
+ else:
+ if self.ProcessRequired in ("TRUE", "1"):
+ if 'PROCESSING_REQUIRED' not in Attribute:
+ Attribute.append('PROCESSING_REQUIRED')
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [TempFile], Section.Section.SectionType['GUIDED'],
+ Guid=self.NameGuid, GuidAttr=Attribute,
+ GuidHdrLen=HeaderLength, IsMakefile=IsMakefile)
+
+ OutputFileList = []
+ OutputFileList.append(OutputFile)
+ if 'PROCESSING_REQUIRED' in Attribute:
+ # reset guided section alignment to none for the processed required guided data
+ self.Alignment = None
+ self.IncludeFvSection = False
+ self.ProcessRequired = "TRUE"
+ if IsMakefile and self.Alignment is not None and self.Alignment.strip() == '0':
+ self.Alignment = '1'
+ return OutputFileList, self.Alignment
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/OptRomFileStatement.py b/roms/edk2/BaseTools/Source/Python/GenFds/OptRomFileStatement.py
new file mode 100644
index 000000000..1bd4d4572
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/OptRomFileStatement.py
@@ -0,0 +1,48 @@
+## @file
+# process OptionROM generation from FILE statement
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.LongFilePathOs as os
+
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+##
+#
+#
+class OptRomFileStatement:
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ self.FileName = None
+ self.FileType = None
+ self.OverrideAttribs = None
+
+ ## GenFfs() method
+ #
+ # Generate FFS
+ #
+ # @param self The object pointer
+ # @param Dict dictionary contains macro and value pair
+ # @retval string Generated FFS file name
+ #
+ def GenFfs(self, Dict = None, IsMakefile=False):
+
+ if Dict is None:
+ Dict = {}
+
+ if self.FileName is not None:
+ self.FileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)
+
+ return self.FileName
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/roms/edk2/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
new file mode 100644
index 000000000..8b570ed6b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
@@ -0,0 +1,159 @@
+## @file
+# process OptionROM generation from INF statement
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from . import RuleSimpleFile
+from . import RuleComplexFile
+from . import Section
+import Common.GlobalData as GlobalData
+
+from Common.DataType import *
+from Common.StringUtils import *
+from .FfsInfStatement import FfsInfStatement
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+
+##
+#
+#
+class OptRomInfStatement (FfsInfStatement):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ FfsInfStatement.__init__(self)
+ self.OverrideAttribs = None
+
+ ## __GetOptRomParams() method
+ #
+ # Parse inf file to get option ROM related parameters
+ #
+ # @param self The object pointer
+ #
+ def __GetOptRomParams(self):
+ if self.OverrideAttribs is None:
+ self.OverrideAttribs = OverrideAttribs()
+
+ if self.OverrideAttribs.NeedCompress is None:
+ self.OverrideAttribs.NeedCompress = self.OptRomDefs.get ('PCI_COMPRESS')
+ if self.OverrideAttribs.NeedCompress is not None:
+ if self.OverrideAttribs.NeedCompress.upper() not in ('TRUE', 'FALSE'):
+ GenFdsGlobalVariable.ErrorLogger( "Expected TRUE/FALSE for PCI_COMPRESS: %s" %self.InfFileName)
+ self.OverrideAttribs.NeedCompress = \
+ self.OverrideAttribs.NeedCompress.upper() == 'TRUE'
+
+ if self.OverrideAttribs.PciVendorId is None:
+ self.OverrideAttribs.PciVendorId = self.OptRomDefs.get ('PCI_VENDOR_ID')
+
+ if self.OverrideAttribs.PciClassCode is None:
+ self.OverrideAttribs.PciClassCode = self.OptRomDefs.get ('PCI_CLASS_CODE')
+
+ if self.OverrideAttribs.PciDeviceId is None:
+ self.OverrideAttribs.PciDeviceId = self.OptRomDefs.get ('PCI_DEVICE_ID')
+
+ if self.OverrideAttribs.PciRevision is None:
+ self.OverrideAttribs.PciRevision = self.OptRomDefs.get ('PCI_REVISION')
+
+# InfObj = GenFdsGlobalVariable.WorkSpace.BuildObject[self.PathClassObj, self.CurrentArch]
+# RecordList = InfObj._RawData[MODEL_META_DATA_HEADER, InfObj._Arch, InfObj._Platform]
+# for Record in RecordList:
+# Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False)
+# Name = Record[0]
+ ## GenFfs() method
+ #
+ # Generate FFS
+ #
+ # @param self The object pointer
+ # @retval string Generated .efi file name
+ #
+ def GenFfs(self, IsMakefile=False):
+ #
+ # Parse Inf file get Module related information
+ #
+
+ self.__InfParse__()
+ self.__GetOptRomParams()
+ #
+ # Get the rule of how to generate Ffs file
+ #
+ Rule = self.__GetRule__()
+ GenFdsGlobalVariable.VerboseLogger( "Packing binaries from inf file : %s" %self.InfFileName)
+ #
+ # For the rule only has simpleFile
+ #
+ if isinstance (Rule, RuleSimpleFile.RuleSimpleFile) :
+ EfiOutputList = self.__GenSimpleFileSection__(Rule, IsMakefile=IsMakefile)
+ return EfiOutputList
+ #
+ # For Rule has ComplexFile
+ #
+ elif isinstance(Rule, RuleComplexFile.RuleComplexFile):
+ EfiOutputList = self.__GenComplexFileSection__(Rule, IsMakefile=IsMakefile)
+ return EfiOutputList
+
+ ## __GenSimpleFileSection__() method
+ #
+ # Get .efi files according to simple rule.
+ #
+ # @param self The object pointer
+ # @param Rule The rule object used to generate section
+ # @retval string File name of the generated section file
+ #
+ def __GenSimpleFileSection__(self, Rule, IsMakefile = False):
+ #
+ # Prepare the parameter of GenSection
+ #
+
+ OutputFileList = []
+ if Rule.FileName is not None:
+ GenSecInputFile = self.__ExtendMacro__(Rule.FileName)
+ OutputFileList.append(GenSecInputFile)
+ else:
+ OutputFileList, IsSect = Section.Section.GetFileList(self, '', Rule.FileExtension)
+
+ return OutputFileList
+
+
+ ## __GenComplexFileSection__() method
+ #
+ # Get .efi by sections in complex Rule
+ #
+ # @param self The object pointer
+ # @param Rule The rule object used to generate section
+ # @retval string File name of the generated section file
+ #
+ def __GenComplexFileSection__(self, Rule, IsMakefile=False):
+
+ OutputFileList = []
+ for Sect in Rule.SectionList:
+ if Sect.SectionType == BINARY_FILE_TYPE_PE32:
+ if Sect.FileName is not None:
+ GenSecInputFile = self.__ExtendMacro__(Sect.FileName)
+ OutputFileList.append(GenSecInputFile)
+ else:
+ FileList, IsSect = Section.Section.GetFileList(self, '', Sect.FileExtension)
+ OutputFileList.extend(FileList)
+
+ return OutputFileList
+
+class OverrideAttribs:
+
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+
+ self.PciVendorId = None
+ self.PciClassCode = None
+ self.PciDeviceId = None
+ self.PciRevision = None
+ self.NeedCompress = None
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/OptionRom.py b/roms/edk2/BaseTools/Source/Python/GenFds/OptionRom.py
new file mode 100644
index 000000000..61d669de8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/OptionRom.py
@@ -0,0 +1,131 @@
+## @file
+# process OptionROM generation
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.LongFilePathOs as os
+import subprocess
+
+from . import OptRomInfStatement
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+from CommonDataClass.FdfClass import OptionRomClassObject
+from Common.Misc import SaveFileOnChange
+from Common import EdkLogger
+from Common.BuildToolError import *
+
+##
+#
+#
+class OPTIONROM (OptionRomClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self, Name = ""):
+ OptionRomClassObject.__init__(self)
+ self.DriverName = Name
+
+ ## AddToBuffer()
+ #
+ # Generate Option ROM
+ #
+ # @param self The object pointer
+ # @param Buffer The buffer generated OptROM data will be put
+ # @retval string Generated OptROM file path
+ #
+ def AddToBuffer (self, Buffer, Flag=False) :
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger( "\nGenerating %s Option ROM ..." %self.DriverName)
+
+ EfiFileList = []
+ BinFileList = []
+
+ # Process Modules in FfsList
+ for FfsFile in self.FfsList :
+
+ if isinstance(FfsFile, OptRomInfStatement.OptRomInfStatement):
+ FilePathNameList = FfsFile.GenFfs(IsMakefile=Flag)
+ if len(FilePathNameList) == 0:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "Module %s not produce .efi files, so NO file could be put into option ROM." % (FfsFile.InfFileName))
+ if FfsFile.OverrideAttribs is None:
+ EfiFileList.extend(FilePathNameList)
+ else:
+ FileName = os.path.basename(FilePathNameList[0])
+ TmpOutputDir = os.path.join(GenFdsGlobalVariable.FvDir, self.DriverName, FfsFile.CurrentArch)
+ if not os.path.exists(TmpOutputDir) :
+ os.makedirs(TmpOutputDir)
+ TmpOutputFile = os.path.join(TmpOutputDir, FileName+'.tmp')
+
+ GenFdsGlobalVariable.GenerateOptionRom(TmpOutputFile,
+ FilePathNameList,
+ [],
+ FfsFile.OverrideAttribs.NeedCompress,
+ FfsFile.OverrideAttribs.PciClassCode,
+ FfsFile.OverrideAttribs.PciRevision,
+ FfsFile.OverrideAttribs.PciDeviceId,
+ FfsFile.OverrideAttribs.PciVendorId,
+ IsMakefile = Flag)
+ BinFileList.append(TmpOutputFile)
+ else:
+ FilePathName = FfsFile.GenFfs(IsMakefile=Flag)
+ if FfsFile.OverrideAttribs is not None:
+ FileName = os.path.basename(FilePathName)
+ TmpOutputDir = os.path.join(GenFdsGlobalVariable.FvDir, self.DriverName, FfsFile.CurrentArch)
+ if not os.path.exists(TmpOutputDir) :
+ os.makedirs(TmpOutputDir)
+ TmpOutputFile = os.path.join(TmpOutputDir, FileName+'.tmp')
+
+ GenFdsGlobalVariable.GenerateOptionRom(TmpOutputFile,
+ [FilePathName],
+ [],
+ FfsFile.OverrideAttribs.NeedCompress,
+ FfsFile.OverrideAttribs.PciClassCode,
+ FfsFile.OverrideAttribs.PciRevision,
+ FfsFile.OverrideAttribs.PciDeviceId,
+ FfsFile.OverrideAttribs.PciVendorId,
+ IsMakefile=Flag)
+ BinFileList.append(TmpOutputFile)
+ else:
+ if FfsFile.FileType == 'EFI':
+ EfiFileList.append(FilePathName)
+ else:
+ BinFileList.append(FilePathName)
+
+ #
+ # Call EfiRom tool
+ #
+ OutputFile = os.path.join(GenFdsGlobalVariable.FvDir, self.DriverName)
+ OutputFile = OutputFile + '.rom'
+
+ GenFdsGlobalVariable.GenerateOptionRom(
+ OutputFile,
+ EfiFileList,
+ BinFileList,
+ IsMakefile=Flag)
+
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger( "\nGenerate %s Option ROM Successfully" %self.DriverName)
+ GenFdsGlobalVariable.SharpCounter = 0
+
+ return OutputFile
+
+class OverrideAttribs:
+
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+
+ self.PciVendorId = None
+ self.PciClassCode = None
+ self.PciDeviceId = None
+ self.PciRevision = None
+ self.NeedCompress = None
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/Region.py b/roms/edk2/BaseTools/Source/Python/GenFds/Region.py
new file mode 100644
index 000000000..e95cfcf96
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/Region.py
@@ -0,0 +1,348 @@
+## @file
+# process FD Region generation
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from struct import *
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+from io import BytesIO
+import string
+import Common.LongFilePathOs as os
+from stat import *
+from Common import EdkLogger
+from Common.BuildToolError import *
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+from Common.DataType import BINARY_FILE_TYPE_FV
+
+## generate Region
+#
+#
+class Region(object):
+
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ self.Offset = None # The begin position of the Region
+ self.Size = None # The Size of the Region
+ self.PcdOffset = None
+ self.PcdSize = None
+ self.SetVarDict = {}
+ self.RegionType = None
+ self.RegionDataList = []
+
+ ## PadBuffer()
+ #
+ # Add padding bytes to the Buffer
+ #
+ # @param Buffer The buffer the generated region data will be put
+ # in
+ # @param ErasePolarity Flash erase polarity
+ # @param Size Number of padding bytes requested
+ #
+
+ def PadBuffer(self, Buffer, ErasePolarity, Size):
+ if Size > 0:
+ if (ErasePolarity == '1') :
+ PadByte = pack('B', 0xFF)
+ else:
+ PadByte = pack('B', 0)
+ for i in range(0, Size):
+ Buffer.write(PadByte)
+
+ ## AddToBuffer()
+ #
+ # Add region data to the Buffer
+ #
+ # @param self The object pointer
+ # @param Buffer The buffer generated region data will be put
+ # @param BaseAddress base address of region
+ # @param BlockSize block size of region
+ # @param BlockNum How many blocks in region
+ # @param ErasePolarity Flash erase polarity
+ # @param MacroDict macro value pair
+ # @retval string Generated FV file path
+ #
+
+ def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, ImageBinDict, MacroDict=None, Flag=False):
+ Size = self.Size
+ if MacroDict is None:
+ MacroDict = {}
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset)
+ GenFdsGlobalVariable.InfLogger(" Region Size = 0x%X" % Size)
+ GenFdsGlobalVariable.SharpCounter = 0
+ if Flag and (self.RegionType != BINARY_FILE_TYPE_FV):
+ return
+
+ if self.RegionType == BINARY_FILE_TYPE_FV:
+ #
+ # Get Fv from FvDict
+ #
+ self.FvAddress = int(BaseAddress, 16) + self.Offset
+ FvBaseAddress = '0x%X' % self.FvAddress
+ FvOffset = 0
+ for RegionData in self.RegionDataList:
+ FileName = None
+ if RegionData.endswith(".fv"):
+ RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger(' Region FV File Name = .fv : %s' % RegionData)
+ if RegionData[1] != ':' :
+ RegionData = mws.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
+ if not os.path.exists(RegionData):
+ EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)
+
+ FileName = RegionData
+ elif RegionData.upper() + 'fv' in ImageBinDict:
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger(' Region Name = FV')
+ FileName = ImageBinDict[RegionData.upper() + 'fv']
+ else:
+ #
+ # Generate FvImage.
+ #
+ FvObj = None
+ if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict:
+ FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[RegionData.upper()]
+
+ if FvObj is not None :
+ if not Flag:
+ GenFdsGlobalVariable.InfLogger(' Region Name = FV')
+ #
+ # Call GenFv tool
+ #
+ self.BlockInfoOfRegion(BlockSizeList, FvObj)
+ self.FvAddress = self.FvAddress + FvOffset
+ FvAlignValue = GenFdsGlobalVariable.GetAlignment(FvObj.FvAlignment)
+ if self.FvAddress % FvAlignValue != 0:
+ EdkLogger.error("GenFds", GENFDS_ERROR,
+ "FV (%s) is NOT %s Aligned!" % (FvObj.UiFvName, FvObj.FvAlignment))
+ FvBuffer = BytesIO()
+ FvBaseAddress = '0x%X' % self.FvAddress
+ BlockSize = None
+ BlockNum = None
+ FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, Flag=Flag)
+ if Flag:
+ continue
+
+ FvBufferLen = len(FvBuffer.getvalue())
+ if FvBufferLen > Size:
+ FvBuffer.close()
+ EdkLogger.error("GenFds", GENFDS_ERROR,
+ "Size of FV (%s) is larger than Region Size 0x%X specified." % (RegionData, Size))
+ #
+ # Put the generated image into FD buffer.
+ #
+ Buffer.write(FvBuffer.getvalue())
+ FvBuffer.close()
+ FvOffset = FvOffset + FvBufferLen
+ Size = Size - FvBufferLen
+ continue
+ else:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (RegionData))
+ #
+ # Add the exist Fv image into FD buffer
+ #
+ if not Flag:
+ if FileName is not None:
+ FileLength = os.stat(FileName)[ST_SIZE]
+ if FileLength > Size:
+ EdkLogger.error("GenFds", GENFDS_ERROR,
+ "Size of FV File (%s) is larger than Region Size 0x%X specified." \
+ % (RegionData, Size))
+ BinFile = open(FileName, 'rb')
+ Buffer.write(BinFile.read())
+ BinFile.close()
+ Size = Size - FileLength
+ #
+ # Pad the left buffer
+ #
+ if not Flag:
+ self.PadBuffer(Buffer, ErasePolarity, Size)
+
+ if self.RegionType == 'CAPSULE':
+ #
+ # Get Capsule from Capsule Dict
+ #
+ for RegionData in self.RegionDataList:
+ if RegionData.endswith(".cap"):
+ RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
+ GenFdsGlobalVariable.InfLogger(' Region CAPSULE Image Name = .cap : %s' % RegionData)
+ if RegionData[1] != ':' :
+ RegionData = mws.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
+ if not os.path.exists(RegionData):
+ EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)
+
+ FileName = RegionData
+ elif RegionData.upper() + 'cap' in ImageBinDict:
+ GenFdsGlobalVariable.InfLogger(' Region Name = CAPSULE')
+ FileName = ImageBinDict[RegionData.upper() + 'cap']
+ else:
+ #
+ # Generate Capsule image and Put it into FD buffer
+ #
+ CapsuleObj = None
+ if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict:
+ CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[RegionData.upper()]
+
+ if CapsuleObj is not None :
+ CapsuleObj.CapsuleName = RegionData.upper()
+ GenFdsGlobalVariable.InfLogger(' Region Name = CAPSULE')
+ #
+ # Call GenFv tool to generate Capsule Image
+ #
+ FileName = CapsuleObj.GenCapsule()
+ CapsuleObj.CapsuleName = None
+ else:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "Capsule (%s) is NOT described in FDF file!" % (RegionData))
+
+ #
+ # Add the capsule image into FD buffer
+ #
+ FileLength = os.stat(FileName)[ST_SIZE]
+ if FileLength > Size:
+ EdkLogger.error("GenFds", GENFDS_ERROR,
+ "Size 0x%X of Capsule File (%s) is larger than Region Size 0x%X specified." \
+ % (FileLength, RegionData, Size))
+ BinFile = open(FileName, 'rb')
+ Buffer.write(BinFile.read())
+ BinFile.close()
+ Size = Size - FileLength
+ #
+ # Pad the left buffer
+ #
+ self.PadBuffer(Buffer, ErasePolarity, Size)
+
+ if self.RegionType in ('FILE', 'INF'):
+ for RegionData in self.RegionDataList:
+ if self.RegionType == 'INF':
+ RegionData.__InfParse__(None)
+ if len(RegionData.BinFileList) != 1:
+ EdkLogger.error('GenFds', GENFDS_ERROR, 'INF in FD region can only contain one binary: %s' % RegionData)
+ File = RegionData.BinFileList[0]
+ RegionData = RegionData.PatchEfiFile(File.Path, File.Type)
+ else:
+ RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
+ if RegionData[1] != ':' :
+ RegionData = mws.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
+ if not os.path.exists(RegionData):
+ EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)
+ #
+ # Add the file image into FD buffer
+ #
+ FileLength = os.stat(RegionData)[ST_SIZE]
+ if FileLength > Size:
+ EdkLogger.error("GenFds", GENFDS_ERROR,
+ "Size of File (%s) is larger than Region Size 0x%X specified." \
+ % (RegionData, Size))
+ GenFdsGlobalVariable.InfLogger(' Region File Name = %s' % RegionData)
+ BinFile = open(RegionData, 'rb')
+ Buffer.write(BinFile.read())
+ BinFile.close()
+ Size = Size - FileLength
+ #
+ # Pad the left buffer
+ #
+ self.PadBuffer(Buffer, ErasePolarity, Size)
+
+ if self.RegionType == 'DATA' :
+ GenFdsGlobalVariable.InfLogger(' Region Name = DATA')
+ DataSize = 0
+ for RegionData in self.RegionDataList:
+ Data = RegionData.split(',')
+ DataSize = DataSize + len(Data)
+ if DataSize > Size:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "Size of DATA is larger than Region Size ")
+ else:
+ for item in Data :
+ Buffer.write(pack('B', int(item, 16)))
+ Size = Size - DataSize
+ #
+ # Pad the left buffer
+ #
+ self.PadBuffer(Buffer, ErasePolarity, Size)
+
+ if self.RegionType is None:
+ GenFdsGlobalVariable.InfLogger(' Region Name = None')
+ self.PadBuffer(Buffer, ErasePolarity, Size)
+
+ ## BlockSizeOfRegion()
+ #
+ # @param BlockSizeList List of block information
+ # @param FvObj The object for FV
+ #
+ def BlockInfoOfRegion(self, BlockSizeList, FvObj):
+ Start = 0
+ End = 0
+ RemindingSize = self.Size
+ ExpectedList = []
+ for (BlockSize, BlockNum, pcd) in BlockSizeList:
+ End = Start + BlockSize * BlockNum
+ # region not started yet
+ if self.Offset >= End:
+ Start = End
+ continue
+ # region located in current blocks
+ else:
+ # region ended within current blocks
+ if self.Offset + self.Size <= End:
+ ExpectedList.append((BlockSize, (RemindingSize + BlockSize - 1) // BlockSize))
+ break
+ # region not ended yet
+ else:
+ # region not started in middle of current blocks
+ if self.Offset <= Start:
+ UsedBlockNum = BlockNum
+ # region started in middle of current blocks
+ else:
+ UsedBlockNum = (End - self.Offset) // BlockSize
+ Start = End
+ ExpectedList.append((BlockSize, UsedBlockNum))
+ RemindingSize -= BlockSize * UsedBlockNum
+
+ if FvObj.BlockSizeList == []:
+ FvObj.BlockSizeList = ExpectedList
+ else:
+ # first check whether FvObj.BlockSizeList items have only "BlockSize" or "NumBlocks",
+ # if so, use ExpectedList
+ for Item in FvObj.BlockSizeList:
+ if Item[0] is None or Item[1] is None:
+ FvObj.BlockSizeList = ExpectedList
+ break
+ # make sure region size is no smaller than the summed block size in FV
+ Sum = 0
+ for Item in FvObj.BlockSizeList:
+ Sum += Item[0] * Item[1]
+ if self.Size < Sum:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "Total Size of FV %s 0x%x is larger than Region Size 0x%x "
+ % (FvObj.UiFvName, Sum, self.Size))
+ # check whether the BlockStatements in FV section is appropriate
+ ExpectedListData = ''
+ for Item in ExpectedList:
+ ExpectedListData += "BlockSize = 0x%x\n\tNumBlocks = 0x%x\n\t" % Item
+ Index = 0
+ for Item in FvObj.BlockSizeList:
+ if Item[0] != ExpectedList[Index][0]:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "BlockStatements of FV %s are not align with FD's, suggested FV BlockStatement"
+ % FvObj.UiFvName, ExtraData=ExpectedListData)
+ elif Item[1] != ExpectedList[Index][1]:
+ if (Item[1] < ExpectedList[Index][1]) and (Index == len(FvObj.BlockSizeList) - 1):
+ break;
+ else:
+ EdkLogger.error("GenFds", GENFDS_ERROR, "BlockStatements of FV %s are not align with FD's, suggested FV BlockStatement"
+ % FvObj.UiFvName, ExtraData=ExpectedListData)
+ else:
+ Index += 1
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/Rule.py b/roms/edk2/BaseTools/Source/Python/GenFds/Rule.py
new file mode 100644
index 000000000..6561c0efd
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/Rule.py
@@ -0,0 +1,23 @@
+## @file
+# Rule object for generating FFS
+#
+# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from CommonDataClass.FdfClass import RuleClassObject
+
+## Rule base class
+#
+#
+class Rule(RuleClassObject):
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ RuleClassObject.__init__(self)
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/RuleComplexFile.py b/roms/edk2/BaseTools/Source/Python/GenFds/RuleComplexFile.py
new file mode 100644
index 000000000..198f4f0a9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/RuleComplexFile.py
@@ -0,0 +1,25 @@
+## @file
+# Complex Rule object for generating FFS
+#
+# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from . import Rule
+from CommonDataClass.FdfClass import RuleComplexFileClassObject
+
+## complex rule
+#
+#
+class RuleComplexFile(RuleComplexFileClassObject) :
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ RuleComplexFileClassObject.__init__(self)
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/RuleSimpleFile.py b/roms/edk2/BaseTools/Source/Python/GenFds/RuleSimpleFile.py
new file mode 100644
index 000000000..772c768cc
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/RuleSimpleFile.py
@@ -0,0 +1,25 @@
+## @file
+# Simple Rule object for generating FFS
+#
+# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from . import Rule
+from CommonDataClass.FdfClass import RuleSimpleFileClassObject
+
+## simple rule
+#
+#
+class RuleSimpleFile (RuleSimpleFileClassObject) :
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ RuleSimpleFileClassObject.__init__(self)
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/Section.py b/roms/edk2/BaseTools/Source/Python/GenFds/Section.py
new file mode 100644
index 000000000..2acb70f41
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/Section.py
@@ -0,0 +1,169 @@
+## @file
+# section base class
+#
+# Copyright (c) 2007-2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from CommonDataClass.FdfClass import SectionClassObject
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+import Common.LongFilePathOs as os, glob
+from Common import EdkLogger
+from Common.BuildToolError import *
+from Common.DataType import *
+
+## section base class
+#
+#
+class Section (SectionClassObject):
+ SectionType = {
+ 'RAW' : 'EFI_SECTION_RAW',
+ 'FREEFORM' : 'EFI_SECTION_FREEFORM_SUBTYPE_GUID',
+ BINARY_FILE_TYPE_PE32 : 'EFI_SECTION_PE32',
+ BINARY_FILE_TYPE_PIC : 'EFI_SECTION_PIC',
+ BINARY_FILE_TYPE_TE : 'EFI_SECTION_TE',
+ 'FV_IMAGE' : 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE',
+ BINARY_FILE_TYPE_DXE_DEPEX : 'EFI_SECTION_DXE_DEPEX',
+ BINARY_FILE_TYPE_PEI_DEPEX : 'EFI_SECTION_PEI_DEPEX',
+ 'GUIDED' : 'EFI_SECTION_GUID_DEFINED',
+ 'COMPRESS' : 'EFI_SECTION_COMPRESSION',
+ BINARY_FILE_TYPE_UI : 'EFI_SECTION_USER_INTERFACE',
+ BINARY_FILE_TYPE_SMM_DEPEX : 'EFI_SECTION_SMM_DEPEX'
+ }
+
+ BinFileType = {
+ BINARY_FILE_TYPE_GUID : '.guid',
+ 'ACPI' : '.acpi',
+ 'ASL' : '.asl' ,
+ BINARY_FILE_TYPE_UEFI_APP : '.app',
+ BINARY_FILE_TYPE_LIB : '.lib',
+ BINARY_FILE_TYPE_PE32 : '.pe32',
+ BINARY_FILE_TYPE_PIC : '.pic',
+ BINARY_FILE_TYPE_PEI_DEPEX : '.depex',
+ 'SEC_PEI_DEPEX' : '.depex',
+ BINARY_FILE_TYPE_TE : '.te',
+ BINARY_FILE_TYPE_UNI_VER : '.ver',
+ BINARY_FILE_TYPE_VER : '.ver',
+ BINARY_FILE_TYPE_UNI_UI : '.ui',
+ BINARY_FILE_TYPE_UI : '.ui',
+ BINARY_FILE_TYPE_BIN : '.bin',
+ 'RAW' : '.raw',
+ 'COMPAT16' : '.comp16',
+ BINARY_FILE_TYPE_FV : '.fv'
+ }
+
+ SectFileType = {
+ 'SEC_GUID' : '.sec' ,
+ 'SEC_PE32' : '.sec' ,
+ 'SEC_PIC' : '.sec',
+ 'SEC_TE' : '.sec',
+ 'SEC_VER' : '.sec',
+ 'SEC_UI' : '.sec',
+ 'SEC_COMPAT16' : '.sec',
+ 'SEC_BIN' : '.sec'
+ }
+
+ ToolGuid = {
+ '0xa31280ad-0x481e-0x41b6-0x95e8-0x127f-0x4c984779' : 'TianoCompress',
+ '0xee4e5898-0x3914-0x4259-0x9d6e-0xdc7b-0xd79403cf' : 'LzmaCompress'
+ }
+
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ SectionClassObject.__init__(self)
+
+ ## GenSection() method
+ #
+ # virtual function
+ #
+ # @param self The object pointer
+ # @param OutputPath Where to place output file
+ # @param ModuleName Which module this section belongs to
+ # @param SecNum Index of section
+ # @param KeyStringList Filter for inputs of section generation
+ # @param FfsInf FfsInfStatement object that contains this section data
+ # @param Dict dictionary contains macro and its value
+ #
+ def GenSection(self, OutputPath, GuidName, SecNum, keyStringList, FfsInf = None, Dict = None):
+ pass
+
+ ## GetFileList() method
+ #
+ # Generate compressed section
+ #
+ # @param self The object pointer
+ # @param FfsInf FfsInfStatement object that contains file list
+ # @param FileType File type to get
+ # @param FileExtension File extension to get
+ # @param Dict dictionary contains macro and its value
+ # @retval tuple (File list, boolean)
+ #
+ def GetFileList(FfsInf, FileType, FileExtension, Dict = None, IsMakefile=False, SectionType=None):
+ IsSect = FileType in Section.SectFileType
+
+ if FileExtension is not None:
+ Suffix = FileExtension
+ elif IsSect :
+ Suffix = Section.SectionType.get(FileType)
+ else:
+ Suffix = Section.BinFileType.get(FileType)
+ if FfsInf is None:
+ EdkLogger.error("GenFds", GENFDS_ERROR, 'Inf File does not exist!')
+
+ FileList = []
+ if FileType is not None:
+ for File in FfsInf.BinFileList:
+ if File.Arch == TAB_ARCH_COMMON or FfsInf.CurrentArch == File.Arch:
+ if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \
+ and FileType == 'DXE_DPEX' and File.Type == BINARY_FILE_TYPE_SMM_DEPEX) \
+ or (FileType == BINARY_FILE_TYPE_TE and File.Type == BINARY_FILE_TYPE_PE32):
+ if TAB_STAR in FfsInf.TargetOverrideList or File.Target == TAB_STAR or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
+ FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type))
+ else:
+ GenFdsGlobalVariable.InfLogger ("\nBuild Target \'%s\' of File %s is not in the Scope of %s specified by INF %s in FDF" %(File.Target, File.File, FfsInf.TargetOverrideList, FfsInf.InfFileName))
+ else:
+ GenFdsGlobalVariable.VerboseLogger ("\nFile Type \'%s\' of File %s in %s is not same with file type \'%s\' from Rule in FDF" %(File.Type, File.File, FfsInf.InfFileName, FileType))
+ else:
+ GenFdsGlobalVariable.InfLogger ("\nCurrent ARCH \'%s\' of File %s is not in the Support Arch Scope of %s specified by INF %s in FDF" %(FfsInf.CurrentArch, File.File, File.Arch, FfsInf.InfFileName))
+
+ elif FileType is None and SectionType == BINARY_FILE_TYPE_RAW:
+ for File in FfsInf.BinFileList:
+ if File.Ext == Suffix:
+ FileList.append(File.Path)
+
+ if (not IsMakefile and Suffix is not None and os.path.exists(FfsInf.EfiOutputPath)) or (IsMakefile and Suffix is not None):
+ #
+ # Get Makefile path and time stamp
+ #
+ MakefileDir = FfsInf.EfiOutputPath[:-len('OUTPUT')]
+ Makefile = os.path.join(MakefileDir, 'Makefile')
+ if not os.path.exists(Makefile):
+ Makefile = os.path.join(MakefileDir, 'GNUmakefile')
+ if os.path.exists(Makefile):
+ # Update to search files with suffix in all sub-dirs.
+ Tuple = os.walk(FfsInf.EfiOutputPath)
+ for Dirpath, Dirnames, Filenames in Tuple:
+ for F in Filenames:
+ if os.path.splitext(F)[1] == Suffix:
+ FullName = os.path.join(Dirpath, F)
+ if os.path.getmtime(FullName) > os.path.getmtime(Makefile):
+ FileList.append(FullName)
+ if not FileList:
+ SuffixMap = FfsInf.GetFinalTargetSuffixMap()
+ if Suffix in SuffixMap:
+ FileList.extend(SuffixMap[Suffix])
+
+ #Process the file lists is alphabetical for a same section type
+ if len (FileList) > 1:
+ FileList.sort()
+
+ return FileList, IsSect
+ GetFileList = staticmethod(GetFileList)
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/UiSection.py b/roms/edk2/BaseTools/Source/Python/GenFds/UiSection.py
new file mode 100644
index 000000000..f643058bd
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/UiSection.py
@@ -0,0 +1,74 @@
+## @file
+# process UI section generation
+#
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from . import Section
+from .Ffs import SectionSuffix
+import subprocess
+import Common.LongFilePathOs as os
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+from CommonDataClass.FdfClass import UiSectionClassObject
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.DataType import *
+
+## generate UI section
+#
+#
+class UiSection (UiSectionClassObject):
+
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ UiSectionClassObject.__init__(self)
+
+ ## GenSection() method
+ #
+ # Generate UI section
+ #
+ # @param self The object pointer
+ # @param OutputPath Where to place output file
+ # @param ModuleName Which module this section belongs to
+ # @param SecNum Index of section
+ # @param KeyStringList Filter for inputs of section generation
+ # @param FfsInf FfsInfStatement object that contains this section data
+ # @param Dict dictionary contains macro and its value
+ # @retval tuple (Generated file name, section alignment)
+ #
+ def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf=None, Dict=None, IsMakefile = False):
+ #
+ # Prepare the parameter of GenSection
+ #
+ if FfsInf is not None:
+ self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
+ self.StringData = FfsInf.__ExtendMacro__(self.StringData)
+ self.FileName = FfsInf.__ExtendMacro__(self.FileName)
+
+ OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + SectionSuffix.get(BINARY_FILE_TYPE_UI))
+
+ if self.StringData is not None :
+ NameString = self.StringData
+ elif self.FileName is not None:
+ if Dict is None:
+ Dict = {}
+ FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)
+ FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict)
+ FileObj = open(FileNameStr, 'r')
+ NameString = FileObj.read()
+ FileObj.close()
+ else:
+ NameString = ''
+ GenFdsGlobalVariable.GenerateSection(OutputFile, None, 'EFI_SECTION_USER_INTERFACE', Ui=NameString, IsMakefile=IsMakefile)
+
+ OutputFileList = []
+ OutputFileList.append(OutputFile)
+ return OutputFileList, self.Alignment
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/VerSection.py b/roms/edk2/BaseTools/Source/Python/GenFds/VerSection.py
new file mode 100644
index 000000000..7280e80cb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/VerSection.py
@@ -0,0 +1,76 @@
+## @file
+# process Version section generation
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from .Ffs import SectionSuffix
+import Common.LongFilePathOs as os
+from .GenFdsGlobalVariable import GenFdsGlobalVariable
+from CommonDataClass.FdfClass import VerSectionClassObject
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.DataType import SUP_MODULE_SEC
+
+## generate version section
+#
+#
+class VerSection (VerSectionClassObject):
+
+ ## The constructor
+ #
+ # @param self The object pointer
+ #
+ def __init__(self):
+ VerSectionClassObject.__init__(self)
+
+ ## GenSection() method
+ #
+ # Generate version section
+ #
+ # @param self The object pointer
+ # @param OutputPath Where to place output file
+ # @param ModuleName Which module this section belongs to
+ # @param SecNum Index of section
+ # @param KeyStringList Filter for inputs of section generation
+ # @param FfsInf FfsInfStatement object that contains this section data
+ # @param Dict dictionary contains macro and its value
+ # @retval tuple (Generated file name, section alignment)
+ #
+ def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf=None, Dict=None, IsMakefile = False):
+ #
+ # Prepare the parameter of GenSection
+ #
+ if FfsInf:
+ self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
+ self.BuildNum = FfsInf.__ExtendMacro__(self.BuildNum)
+ self.StringData = FfsInf.__ExtendMacro__(self.StringData)
+ self.FileName = FfsInf.__ExtendMacro__(self.FileName)
+
+ OutputFile = os.path.join(OutputPath,
+ ModuleName + SUP_MODULE_SEC + SecNum + SectionSuffix.get('VERSION'))
+ OutputFile = os.path.normpath(OutputFile)
+
+ # Get String Data
+ StringData = ''
+ if self.StringData:
+ StringData = self.StringData
+ elif self.FileName:
+ if Dict is None:
+ Dict = {}
+ FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)
+ FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict)
+ FileObj = open(FileNameStr, 'r')
+ StringData = FileObj.read()
+ StringData = '"' + StringData + '"'
+ FileObj.close()
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
+ Ver=StringData, BuildNumber=self.BuildNum, IsMakefile=IsMakefile)
+ OutputFileList = []
+ OutputFileList.append(OutputFile)
+ return OutputFileList, self.Alignment
diff --git a/roms/edk2/BaseTools/Source/Python/GenFds/__init__.py b/roms/edk2/BaseTools/Source/Python/GenFds/__init__.py
new file mode 100644
index 000000000..09ea47ea5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenFds/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'GenFds' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py b/roms/edk2/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
new file mode 100644
index 000000000..d962ab0ad
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
@@ -0,0 +1,228 @@
+## @file
+# Generate PCD table for 'Patchable In Module' type PCD with given .map file.
+# The Patch PCD table like:
+#
+# PCD Name Offset in binary
+# ======== ================
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+
+#====================================== External Libraries ========================================
+from __future__ import print_function
+import optparse
+import Common.LongFilePathOs as os
+import re
+import array
+
+from Common.BuildToolError import *
+import Common.EdkLogger as EdkLogger
+from Common.Misc import PeImageClass, startPatternGeneral, addressPatternGeneral, valuePatternGcc, pcdPatternGcc, secReGeneral
+from Common.BuildVersion import gBUILD_VERSION
+from Common.LongFilePathSupport import OpenLongFilePath as open
+
+# Version and Copyright
+__version_number__ = ("0.10" + " " + gBUILD_VERSION)
+__version__ = "%prog Version " + __version_number__
+__copyright__ = "Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved."
+
+#====================================== Internal Libraries ========================================
+
+#============================================== Code ===============================================
+symRe = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\.\-:\\\\\w\?@\$<>]+) +([\da-fA-F]+)', re.UNICODE)
+
+def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
+ """ Parse map file to get binary patch pcd information
+ @param path Map file absolution path
+
+ @return a list which element hold (PcdName, Offset, SectionName)
+ """
+ lines = []
+ try:
+ f = open(mapfilepath, 'r')
+ lines = f.readlines()
+ f.close()
+ except:
+ return None
+
+ if len(lines) == 0: return None
+ firstline = lines[0].strip()
+ if re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', firstline):
+ return _parseForXcodeAndClang9(lines, efifilepath)
+ if (firstline.startswith("Archive member included ") and
+ firstline.endswith(" file (symbol)")):
+ return _parseForGCC(lines, efifilepath)
+ if firstline.startswith("# Path:"):
+ return _parseForXcodeAndClang9(lines, efifilepath)
+ return _parseGeneral(lines, efifilepath)
+
+def _parseForXcodeAndClang9(lines, efifilepath):
+ valuePattern = re.compile('^([\da-fA-FxX]+)([\s\S]*)([_]*_gPcd_BinaryPatch_([\w]+))')
+ status = 0
+ pcds = []
+ for line in lines:
+ line = line.strip()
+ if status == 0 and (re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', line) \
+ or line == "# Symbols:"):
+ status = 1
+ continue
+ if status == 1 and len(line) != 0:
+ if '_gPcd_BinaryPatch_' in line:
+ m = valuePattern.match(line)
+ if m is not None:
+ pcds.append((m.groups(0)[3], int(m.groups(0)[0], 16)))
+ return pcds
+
+def _parseForGCC(lines, efifilepath):
+ """ Parse map file generated by GCC linker """
+ dataPattern = re.compile('^.data._gPcd_BinaryPatch_([\w_\d]+)$')
+ status = 0
+ imageBase = -1
+ sections = []
+ bpcds = []
+ for index, line in enumerate(lines):
+ line = line.strip()
+ # status machine transection
+ if status == 0 and line == "Memory Configuration":
+ status = 1
+ continue
+ elif status == 1 and line == 'Linker script and memory map':
+ status = 2
+ continue
+ elif status ==2 and line == 'START GROUP':
+ status = 3
+ continue
+
+ # status handler
+ if status == 3:
+ m = valuePatternGcc.match(line)
+ if m is not None:
+ sections.append(m.groups(0))
+ if status == 3:
+ m = dataPattern.match(line)
+ if m is not None:
+ if lines[index + 1]:
+ PcdName = m.groups(0)[0]
+ m = pcdPatternGcc.match(lines[index + 1].strip())
+ if m is not None:
+ bpcds.append((PcdName, int(m.groups(0)[0], 16), int(sections[-1][1], 16), sections[-1][0]))
+
+ # get section information from efi file
+ efisecs = PeImageClass(efifilepath).SectionHeaderList
+ if efisecs is None or len(efisecs) == 0:
+ return None
+ #redirection
+ redirection = 0
+ for efisec in efisecs:
+ for section in sections:
+ if section[0].strip() == efisec[0].strip() and section[0].strip() == '.text':
+ redirection = int(section[1], 16) - efisec[1]
+ pcds = []
+ for pcd in bpcds:
+ for efisec in efisecs:
+ if pcd[1] >= efisec[1] and pcd[1] < efisec[1]+efisec[3]:
+ #assert efisec[0].strip() == pcd[3].strip() and efisec[1] + redirection == pcd[2], "There are some differences between map file and efi file"
+ pcds.append([pcd[0], efisec[2] + pcd[1] - efisec[1] - redirection, efisec[0]])
+ return pcds
+
+def _parseGeneral(lines, efifilepath):
+ """ For MSFT, ICC, EBC
+ @param lines line array for map file
+
+ @return a list which element hold (PcdName, Offset, SectionName)
+ """
+ status = 0 #0 - beginning of file; 1 - PE section definition; 2 - symbol table
+ secs = [] # key = section name
+ bPcds = []
+ symPattern = re.compile('^[_]+gPcd_BinaryPatch_([\w]+)')
+
+ for line in lines:
+ line = line.strip()
+ if startPatternGeneral.match(line):
+ status = 1
+ continue
+ if addressPatternGeneral.match(line):
+ status = 2
+ continue
+ if line.startswith("entry point at"):
+ status = 3
+ continue
+ if status == 1 and len(line) != 0:
+ m = secReGeneral.match(line)
+ assert m is not None, "Fail to parse the section in map file , line is %s" % line
+ sec_no, sec_start, sec_length, sec_name, sec_class = m.groups(0)
+ secs.append([int(sec_no, 16), int(sec_start, 16), int(sec_length, 16), sec_name, sec_class])
+ if status == 2 and len(line) != 0:
+ m = symRe.match(line)
+ assert m is not None, "Fail to parse the symbol in map file, line is %s" % line
+ sec_no, sym_offset, sym_name, vir_addr = m.groups(0)
+ sec_no = int(sec_no, 16)
+ sym_offset = int(sym_offset, 16)
+ vir_addr = int(vir_addr, 16)
+ m2 = symPattern.match(sym_name)
+ if m2 is not None:
+ # fond a binary pcd entry in map file
+ for sec in secs:
+ if sec[0] == sec_no and (sym_offset >= sec[1] and sym_offset < sec[1] + sec[2]):
+ bPcds.append([m2.groups(0)[0], sec[3], sym_offset, vir_addr, sec_no])
+
+ if len(bPcds) == 0: return None
+
+ # get section information from efi file
+ efisecs = PeImageClass(efifilepath).SectionHeaderList
+ if efisecs is None or len(efisecs) == 0:
+ return None
+
+ pcds = []
+ for pcd in bPcds:
+ index = 0
+ for efisec in efisecs:
+ index = index + 1
+ if pcd[1].strip() == efisec[0].strip():
+ pcds.append([pcd[0], efisec[2] + pcd[2], efisec[0]])
+ elif pcd[4] == index:
+ pcds.append([pcd[0], efisec[2] + pcd[2], efisec[0]])
+ return pcds
+
+def generatePcdTable(list, pcdpath):
+ try:
+ f = open(pcdpath, 'w')
+ except:
+ pass
+
+ f.write('PCD Name Offset Section Name\r\n')
+
+ for pcditem in list:
+ f.write('%-30s 0x%-08X %-6s\r\n' % (pcditem[0], pcditem[1], pcditem[2]))
+ f.close()
+
+ #print 'Success to generate Binary Patch PCD table at %s!' % pcdpath
+
+if __name__ == '__main__':
+ UsageString = "%prog -m <MapFile> -e <EfiFile> -o <OutFile>"
+ AdditionalNotes = "\nPCD table is generated in file name with .BinaryPcdTable.txt postfix"
+ parser = optparse.OptionParser(description=__copyright__, version=__version__, usage=UsageString)
+ parser.add_option('-m', '--mapfile', action='store', dest='mapfile',
+ help='Absolute path of module map file.')
+ parser.add_option('-e', '--efifile', action='store', dest='efifile',
+ help='Absolute path of EFI binary file.')
+ parser.add_option('-o', '--outputfile', action='store', dest='outfile',
+ help='Absolute path of output file to store the got patchable PCD table.')
+
+ (options, args) = parser.parse_args()
+
+ if options.mapfile is None or options.efifile is None:
+ print(parser.get_usage())
+ elif os.path.exists(options.mapfile) and os.path.exists(options.efifile):
+ list = parsePcdInfoFromMapFile(options.mapfile, options.efifile)
+ if list is not None:
+ if options.outfile is not None:
+ generatePcdTable(list, options.outfile)
+ else:
+ generatePcdTable(list, options.mapfile.replace('.map', '.BinaryPcdTable.txt'))
+ else:
+ print('Fail to generate Patch PCD Table based on map file and efi file')
+ else:
+ print('Fail to generate Patch PCD Table for fail to find map file or efi file!')
diff --git a/roms/edk2/BaseTools/Source/Python/GenPatchPcdTable/__init__.py b/roms/edk2/BaseTools/Source/Python/GenPatchPcdTable/__init__.py
new file mode 100644
index 000000000..70b46a525
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/GenPatchPcdTable/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'GenPatchPcdTable' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/Makefile b/roms/edk2/BaseTools/Source/Python/Makefile
new file mode 100644
index 000000000..6c3bedbad
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Makefile
@@ -0,0 +1,13 @@
+## @file
+# Windows makefile for Python tools build.
+#
+# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+all:
+
+clean:
+cleanall:
+ @del /f /q $(BASE_TOOLS_PATH)\Source\Python\*.pyc
+
diff --git a/roms/edk2/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py b/roms/edk2/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py
new file mode 100644
index 000000000..d35cd7927
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py
@@ -0,0 +1,280 @@
+## @file
+# Patch value into the binary file.
+#
+# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+import Common.LongFilePathOs as os
+from Common.LongFilePathSupport import OpenLongFilePath as open
+import sys
+
+from optparse import OptionParser
+from optparse import make_option
+from Common.BuildToolError import *
+import Common.EdkLogger as EdkLogger
+from Common.BuildVersion import gBUILD_VERSION
+import array
+from Common.DataType import *
+
+# Version and Copyright
+__version_number__ = ("0.10" + " " + gBUILD_VERSION)
+__version__ = "%prog Version " + __version_number__
+__copyright__ = "Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved."
+
+## PatchBinaryFile method
+#
+# This method mainly patches the data into binary file.
+#
+# @param FileName File path of the binary file
+# @param ValueOffset Offset value
+# @param TypeName DataType Name
+# @param Value Value String
+# @param MaxSize MaxSize value
+#
+# @retval 0 File is updated successfully.
+# @retval not 0 File is updated failed.
+#
+def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
+ #
+ # Length of Binary File
+ #
+ FileHandle = open(FileName, 'rb')
+ FileHandle.seek (0, 2)
+ FileLength = FileHandle.tell()
+ FileHandle.close()
+ #
+ # Unify string to upper string
+ #
+ TypeName = TypeName.upper()
+ #
+ # Get PCD value data length
+ #
+ ValueLength = 0
+ if TypeName == 'BOOLEAN':
+ ValueLength = 1
+ elif TypeName == TAB_UINT8:
+ ValueLength = 1
+ elif TypeName == TAB_UINT16:
+ ValueLength = 2
+ elif TypeName == TAB_UINT32:
+ ValueLength = 4
+ elif TypeName == TAB_UINT64:
+ ValueLength = 8
+ elif TypeName == TAB_VOID:
+ if MaxSize == 0:
+ return OPTION_MISSING, "PcdMaxSize is not specified for VOID* type PCD."
+ ValueLength = int(MaxSize)
+ else:
+ return PARAMETER_INVALID, "PCD type %s is not valid." % (CommandOptions.PcdTypeName)
+ #
+ # Check PcdValue is in the input binary file.
+ #
+ if ValueOffset + ValueLength > FileLength:
+ return PARAMETER_INVALID, "PcdOffset + PcdMaxSize(DataType) is larger than the input file size."
+ #
+ # Read binary file into array
+ #
+ FileHandle = open(FileName, 'rb')
+ ByteArray = array.array('B')
+ ByteArray.fromfile(FileHandle, FileLength)
+ FileHandle.close()
+ OrigByteList = ByteArray.tolist()
+ ByteList = ByteArray.tolist()
+ #
+ # Clear the data in file
+ #
+ for Index in range(ValueLength):
+ ByteList[ValueOffset + Index] = 0
+ #
+ # Patch value into offset
+ #
+ SavedStr = ValueString
+ ValueString = ValueString.upper()
+ ValueNumber = 0
+ if TypeName == 'BOOLEAN':
+ #
+ # Get PCD value for BOOLEAN data type
+ #
+ try:
+ if ValueString == 'TRUE':
+ ValueNumber = 1
+ elif ValueString == 'FALSE':
+ ValueNumber = 0
+ ValueNumber = int (ValueString, 0)
+ if ValueNumber != 0:
+ ValueNumber = 1
+ except:
+ return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." % (ValueString)
+ #
+ # Set PCD value into binary data
+ #
+ ByteList[ValueOffset] = ValueNumber
+ elif TypeName in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ #
+ # Get PCD value for UINT* data type
+ #
+ try:
+ ValueNumber = int (ValueString, 0)
+ except:
+ return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." % (ValueString)
+ #
+ # Set PCD value into binary data
+ #
+ for Index in range(ValueLength):
+ ByteList[ValueOffset + Index] = ValueNumber % 0x100
+ ValueNumber = ValueNumber // 0x100
+ elif TypeName == TAB_VOID:
+ ValueString = SavedStr
+ if ValueString.startswith('L"'):
+ #
+ # Patch Unicode String
+ #
+ Index = 0
+ for ByteString in ValueString[2:-1]:
+ #
+ # Reserve zero as unicode tail
+ #
+ if Index + 2 >= ValueLength:
+ break
+ #
+ # Set string value one by one/ 0x100
+ #
+ ByteList[ValueOffset + Index] = ord(ByteString)
+ Index = Index + 2
+ elif ValueString.startswith("{") and ValueString.endswith("}"):
+ #
+ # Patch {0x1, 0x2, ...} byte by byte
+ #
+ ValueList = ValueString[1 : len(ValueString) - 1].split(',')
+ Index = 0
+ try:
+ for ByteString in ValueList:
+ ByteString = ByteString.strip()
+ if ByteString.upper().startswith('0X'):
+ ByteValue = int(ByteString, 16)
+ else:
+ ByteValue = int(ByteString)
+ ByteList[ValueOffset + Index] = ByteValue % 0x100
+ Index = Index + 1
+ if Index >= ValueLength:
+ break
+ except:
+ return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string array." % (ValueString)
+ else:
+ #
+ # Patch ascii string
+ #
+ Index = 0
+ for ByteString in ValueString[1:-1]:
+ #
+ # Reserve zero as string tail
+ #
+ if Index + 1 >= ValueLength:
+ break
+ #
+ # Set string value one by one
+ #
+ ByteList[ValueOffset + Index] = ord(ByteString)
+ Index = Index + 1
+ #
+ # Update new data into input file.
+ #
+ if ByteList != OrigByteList:
+ ByteArray = array.array('B')
+ ByteArray.fromlist(ByteList)
+ FileHandle = open(FileName, 'wb')
+ ByteArray.tofile(FileHandle)
+ FileHandle.close()
+ return 0, "Patch Value into File %s successfully." % (FileName)
+
+## Parse command line options
+#
+# Using standard Python module optparse to parse command line option of this tool.
+#
+# @retval Options A optparse.Values object containing the parsed options
+# @retval InputFile Path of file to be trimmed
+#
+def Options():
+ OptionList = [
+ make_option("-f", "--offset", dest="PcdOffset", action="store", type="int",
+ help="Start offset to the image is used to store PCD value."),
+ make_option("-u", "--value", dest="PcdValue", action="store",
+ help="PCD value will be updated into the image."),
+ make_option("-t", "--type", dest="PcdTypeName", action="store",
+ help="The name of PCD data type may be one of VOID*,BOOLEAN, UINT8, UINT16, UINT32, UINT64."),
+ make_option("-s", "--maxsize", dest="PcdMaxSize", action="store", type="int",
+ help="Max size of data buffer is taken by PCD value.It must be set when PCD type is VOID*."),
+ make_option("-v", "--verbose", dest="LogLevel", action="store_const", const=EdkLogger.VERBOSE,
+ help="Run verbosely"),
+ make_option("-d", "--debug", dest="LogLevel", type="int",
+ help="Run with debug information"),
+ make_option("-q", "--quiet", dest="LogLevel", action="store_const", const=EdkLogger.QUIET,
+ help="Run quietly"),
+ make_option("-?", action="help", help="show this help message and exit"),
+ ]
+
+ # use clearer usage to override default usage message
+ UsageString = "%prog -f Offset -u Value -t Type [-s MaxSize] <input_file>"
+
+ Parser = OptionParser(description=__copyright__, version=__version__, option_list=OptionList, usage=UsageString)
+ Parser.set_defaults(LogLevel=EdkLogger.INFO)
+
+ Options, Args = Parser.parse_args()
+
+ # error check
+ if len(Args) == 0:
+ EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData=Parser.get_usage())
+
+ InputFile = Args[len(Args) - 1]
+ return Options, InputFile
+
+## Entrance method
+#
+# This method mainly dispatch specific methods per the command line options.
+# If no error found, return zero value so the caller of this tool can know
+# if it's executed successfully or not.
+#
+# @retval 0 Tool was successful
+# @retval 1 Tool failed
+#
+def Main():
+ try:
+ #
+ # Check input parameter
+ #
+ EdkLogger.Initialize()
+ CommandOptions, InputFile = Options()
+ if CommandOptions.LogLevel < EdkLogger.DEBUG_9:
+ EdkLogger.SetLevel(CommandOptions.LogLevel + 1)
+ else:
+ EdkLogger.SetLevel(CommandOptions.LogLevel)
+ if not os.path.exists (InputFile):
+ EdkLogger.error("PatchPcdValue", FILE_NOT_FOUND, ExtraData=InputFile)
+ return 1
+ if CommandOptions.PcdOffset is None or CommandOptions.PcdValue is None or CommandOptions.PcdTypeName is None:
+ EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdOffset or PcdValue of PcdTypeName is not specified.")
+ return 1
+ if CommandOptions.PcdTypeName.upper() not in TAB_PCD_NUMERIC_TYPES_VOID:
+ EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData="PCD type %s is not valid." % (CommandOptions.PcdTypeName))
+ return 1
+ if CommandOptions.PcdTypeName.upper() == TAB_VOID and CommandOptions.PcdMaxSize is None:
+ EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdMaxSize is not specified for VOID* type PCD.")
+ return 1
+ #
+ # Patch value into binary image.
+ #
+ ReturnValue, ErrorInfo = PatchBinaryFile (InputFile, CommandOptions.PcdOffset, CommandOptions.PcdTypeName, CommandOptions.PcdValue, CommandOptions.PcdMaxSize)
+ if ReturnValue != 0:
+ EdkLogger.error("PatchPcdValue", ReturnValue, ExtraData=ErrorInfo)
+ return 1
+ return 0
+ except:
+ return 1
+
+if __name__ == '__main__':
+ r = Main()
+ sys.exit(r)
diff --git a/roms/edk2/BaseTools/Source/Python/PatchPcdValue/__init__.py b/roms/edk2/BaseTools/Source/Python/PatchPcdValue/__init__.py
new file mode 100644
index 000000000..08275ed6e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/PatchPcdValue/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'PatchPcdValue' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
new file mode 100644
index 000000000..5d4c3a859
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
@@ -0,0 +1,280 @@
+## @file
+# This tool adds EFI_FIRMWARE_IMAGE_AUTHENTICATION for a binary.
+#
+# This tool only support CertType - EFI_CERT_TYPE_PKCS7_GUID
+# {0x4aafd29d, 0x68df, 0x49ee, {0x8a, 0xa9, 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7}}
+#
+# This tool has been tested with OpenSSL.
+#
+# Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Pkcs7Sign
+'''
+from __future__ import print_function
+
+import os
+import sys
+import argparse
+import subprocess
+import uuid
+import struct
+import collections
+from Common.BuildVersion import gBUILD_VERSION
+
+#
+# Globals for help information
+#
+__prog__ = 'Pkcs7Sign'
+__version__ = '%s Version %s' % (__prog__, '0.9 ' + gBUILD_VERSION)
+__copyright__ = 'Copyright (c) 2016, Intel Corporation. All rights reserved.'
+__usage__ = '%s -e|-d [options] <input_file>' % (__prog__)
+
+#
+# GUID for PKCS7 from UEFI Specification
+#
+WIN_CERT_REVISION = 0x0200
+WIN_CERT_TYPE_EFI_GUID = 0x0EF1
+EFI_CERT_TYPE_PKCS7_GUID = uuid.UUID('{4aafd29d-68df-49ee-8aa9-347d375665a7}')
+
+#
+# typedef struct _WIN_CERTIFICATE {
+# UINT32 dwLength;
+# UINT16 wRevision;
+# UINT16 wCertificateType;
+# //UINT8 bCertificate[ANYSIZE_ARRAY];
+# } WIN_CERTIFICATE;
+#
+# typedef struct _WIN_CERTIFICATE_UEFI_GUID {
+# WIN_CERTIFICATE Hdr;
+# EFI_GUID CertType;
+# //UINT8 CertData[ANYSIZE_ARRAY];
+# } WIN_CERTIFICATE_UEFI_GUID;
+#
+# typedef struct {
+# UINT64 MonotonicCount;
+# WIN_CERTIFICATE_UEFI_GUID AuthInfo;
+# } EFI_FIRMWARE_IMAGE_AUTHENTICATION;
+#
+
+#
+# Filename of test signing private cert that is stored in same directory as this tool
+#
+TEST_SIGNER_PRIVATE_CERT_FILENAME = 'TestCert.pem'
+TEST_OTHER_PUBLIC_CERT_FILENAME = 'TestSub.pub.pem'
+TEST_TRUSTED_PUBLIC_CERT_FILENAME = 'TestRoot.pub.pem'
+
+if __name__ == '__main__':
+ #
+ # Create command line argument parser object
+ #
+ parser = argparse.ArgumentParser(prog=__prog__, usage=__usage__, description=__copyright__, conflict_handler='resolve')
+ group = parser.add_mutually_exclusive_group(required=True)
+ group.add_argument("-e", action="store_true", dest='Encode', help='encode file')
+ group.add_argument("-d", action="store_true", dest='Decode', help='decode file')
+ group.add_argument("--version", action='version', version=__version__)
+ parser.add_argument("-o", "--output", dest='OutputFile', type=str, metavar='filename', help="specify the output filename", required=True)
+ parser.add_argument("--signer-private-cert", dest='SignerPrivateCertFile', type=argparse.FileType('rb'), help="specify the signer private cert filename. If not specified, a test signer private cert is used.")
+ parser.add_argument("--other-public-cert", dest='OtherPublicCertFile', type=argparse.FileType('rb'), help="specify the other public cert filename. If not specified, a test other public cert is used.")
+ parser.add_argument("--trusted-public-cert", dest='TrustedPublicCertFile', type=argparse.FileType('rb'), help="specify the trusted public cert filename. If not specified, a test trusted public cert is used.")
+ parser.add_argument("--monotonic-count", dest='MonotonicCountStr', type=str, help="specify the MonotonicCount in FMP capsule. If not specified, 0 is used.")
+ parser.add_argument("--signature-size", dest='SignatureSizeStr', type=str, help="specify the signature size for decode process.")
+ parser.add_argument("-v", "--verbose", dest='Verbose', action="store_true", help="increase output messages")
+ parser.add_argument("-q", "--quiet", dest='Quiet', action="store_true", help="reduce output messages")
+ parser.add_argument("--debug", dest='Debug', type=int, metavar='[0-9]', choices=range(0, 10), default=0, help="set debug level")
+ parser.add_argument(metavar="input_file", dest='InputFile', type=argparse.FileType('rb'), help="specify the input filename")
+
+ #
+ # Parse command line arguments
+ #
+ args = parser.parse_args()
+
+ #
+ # Generate file path to Open SSL command
+ #
+ OpenSslCommand = 'openssl'
+ try:
+ OpenSslPath = os.environ['OPENSSL_PATH']
+ OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand)
+ if ' ' in OpenSslCommand:
+ OpenSslCommand = '"' + OpenSslCommand + '"'
+ except:
+ pass
+
+ #
+ # Verify that Open SSL command is available
+ #
+ try:
+ Process = subprocess.Popen('%s version' % (OpenSslCommand), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ except:
+ print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
+ sys.exit(1)
+
+ Version = Process.communicate()
+ if Process.returncode != 0:
+ print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
+ sys.exit(Process.returncode)
+ print(Version[0].decode())
+
+ #
+ # Read input file into a buffer and save input filename
+ #
+ args.InputFileName = args.InputFile.name
+ args.InputFileBuffer = args.InputFile.read()
+ args.InputFile.close()
+
+ #
+ # Save output filename and check if path exists
+ #
+ OutputDir = os.path.dirname(args.OutputFile)
+ if not os.path.exists(OutputDir):
+ print('ERROR: The output path does not exist: %s' % OutputDir)
+ sys.exit(1)
+ args.OutputFileName = args.OutputFile
+
+ try:
+ if args.MonotonicCountStr.upper().startswith('0X'):
+ args.MonotonicCountValue = int(args.MonotonicCountStr, 16)
+ else:
+ args.MonotonicCountValue = int(args.MonotonicCountStr)
+ except:
+ args.MonotonicCountValue = int(0)
+
+ if args.Encode:
+ #
+ # Save signer private cert filename and close private cert file
+ #
+ try:
+ args.SignerPrivateCertFileName = args.SignerPrivateCertFile.name
+ args.SignerPrivateCertFile.close()
+ except:
+ try:
+ #
+ # Get path to currently executing script or executable
+ #
+ if hasattr(sys, 'frozen'):
+ Pkcs7ToolPath = sys.executable
+ else:
+ Pkcs7ToolPath = sys.argv[0]
+ if Pkcs7ToolPath.startswith('"'):
+ Pkcs7ToolPath = Pkcs7ToolPath[1:]
+ if Pkcs7ToolPath.endswith('"'):
+ Pkcs7ToolPath = RsaToolPath[:-1]
+ args.SignerPrivateCertFileName = os.path.join(os.path.dirname(os.path.realpath(Pkcs7ToolPath)), TEST_SIGNER_PRIVATE_CERT_FILENAME)
+ args.SignerPrivateCertFile = open(args.SignerPrivateCertFileName, 'rb')
+ args.SignerPrivateCertFile.close()
+ except:
+ print('ERROR: test signer private cert file %s missing' % (args.SignerPrivateCertFileName))
+ sys.exit(1)
+
+ #
+ # Save other public cert filename and close public cert file
+ #
+ try:
+ args.OtherPublicCertFileName = args.OtherPublicCertFile.name
+ args.OtherPublicCertFile.close()
+ except:
+ try:
+ #
+ # Get path to currently executing script or executable
+ #
+ if hasattr(sys, 'frozen'):
+ Pkcs7ToolPath = sys.executable
+ else:
+ Pkcs7ToolPath = sys.argv[0]
+ if Pkcs7ToolPath.startswith('"'):
+ Pkcs7ToolPath = Pkcs7ToolPath[1:]
+ if Pkcs7ToolPath.endswith('"'):
+ Pkcs7ToolPath = RsaToolPath[:-1]
+ args.OtherPublicCertFileName = os.path.join(os.path.dirname(os.path.realpath(Pkcs7ToolPath)), TEST_OTHER_PUBLIC_CERT_FILENAME)
+ args.OtherPublicCertFile = open(args.OtherPublicCertFileName, 'rb')
+ args.OtherPublicCertFile.close()
+ except:
+ print('ERROR: test other public cert file %s missing' % (args.OtherPublicCertFileName))
+ sys.exit(1)
+
+ format = "%dsQ" % len(args.InputFileBuffer)
+ FullInputFileBuffer = struct.pack(format, args.InputFileBuffer, args.MonotonicCountValue)
+
+ #
+ # Sign the input file using the specified private key and capture signature from STDOUT
+ #
+ Process = subprocess.Popen('%s smime -sign -binary -signer "%s" -outform DER -md sha256 -certfile "%s"' % (OpenSslCommand, args.SignerPrivateCertFileName, args.OtherPublicCertFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ Signature = Process.communicate(input=FullInputFileBuffer)[0]
+ if Process.returncode != 0:
+ sys.exit(Process.returncode)
+
+ #
+ # Write output file that contains Signature, and Input data
+ #
+ args.OutputFile = open(args.OutputFileName, 'wb')
+ args.OutputFile.write(Signature)
+ args.OutputFile.write(args.InputFileBuffer)
+ args.OutputFile.close()
+
+ if args.Decode:
+ #
+ # Save trusted public cert filename and close public cert file
+ #
+ try:
+ args.TrustedPublicCertFileName = args.TrustedPublicCertFile.name
+ args.TrustedPublicCertFile.close()
+ except:
+ try:
+ #
+ # Get path to currently executing script or executable
+ #
+ if hasattr(sys, 'frozen'):
+ Pkcs7ToolPath = sys.executable
+ else:
+ Pkcs7ToolPath = sys.argv[0]
+ if Pkcs7ToolPath.startswith('"'):
+ Pkcs7ToolPath = Pkcs7ToolPath[1:]
+ if Pkcs7ToolPath.endswith('"'):
+ Pkcs7ToolPath = RsaToolPath[:-1]
+ args.TrustedPublicCertFileName = os.path.join(os.path.dirname(os.path.realpath(Pkcs7ToolPath)), TEST_TRUSTED_PUBLIC_CERT_FILENAME)
+ args.TrustedPublicCertFile = open(args.TrustedPublicCertFileName, 'rb')
+ args.TrustedPublicCertFile.close()
+ except:
+ print('ERROR: test trusted public cert file %s missing' % (args.TrustedPublicCertFileName))
+ sys.exit(1)
+
+ if not args.SignatureSizeStr:
+ print("ERROR: please use the option --signature-size to specify the size of the signature data!")
+ sys.exit(1)
+ else:
+ if args.SignatureSizeStr.upper().startswith('0X'):
+ SignatureSize = int(args.SignatureSizeStr, 16)
+ else:
+ SignatureSize = int(args.SignatureSizeStr)
+ if SignatureSize < 0:
+ print("ERROR: The value of option --signature-size can't be set to negative value!")
+ sys.exit(1)
+ elif SignatureSize > len(args.InputFileBuffer):
+ print("ERROR: The value of option --signature-size is exceed the size of the input file !")
+ sys.exit(1)
+
+ args.SignatureBuffer = args.InputFileBuffer[0:SignatureSize]
+ args.InputFileBuffer = args.InputFileBuffer[SignatureSize:]
+
+ format = "%dsQ" % len(args.InputFileBuffer)
+ FullInputFileBuffer = struct.pack(format, args.InputFileBuffer, args.MonotonicCountValue)
+
+ #
+ # Save output file contents from input file
+ #
+ open(args.OutputFileName, 'wb').write(FullInputFileBuffer)
+
+ #
+ # Verify signature
+ #
+ Process = subprocess.Popen('%s smime -verify -inform DER -content %s -CAfile %s' % (OpenSslCommand, args.OutputFileName, args.TrustedPublicCertFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ Process.communicate(input=args.SignatureBuffer)[0]
+ if Process.returncode != 0:
+ print('ERROR: Verification failed')
+ os.remove (args.OutputFileName)
+ sys.exit(Process.returncode)
+
+ open(args.OutputFileName, 'wb').write(args.InputFileBuffer)
diff --git a/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/Readme.md b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/Readme.md
new file mode 100644
index 000000000..a7b9caf52
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/Readme.md
@@ -0,0 +1,158 @@
+# Step by step to generate sample self-signed X.509 certificate chain and sign data with PKCS7 structure
+
+This readme demonstrates how to generate 3-layer X.509 certificate chain (RootCA -> IntermediateCA -> SigningCert) with OpenSSL commands, and user MUST set a UNIQUE Subject Name ("Common Name") on these three different certificates.
+
+## How to generate a self-signed X.509 certificate chain via OPENSSL
+* Set OPENSSL environment.
+
+NOTE: Below steps are required for Windows. Linux may already have the OPENSSL environment correctly.
+
+ set OPENSSL_HOME=c:\home\openssl\openssl-[version]
+ set OPENSSL_CONF=%OPENSSL_HOME%\apps\openssl.cnf
+
+When a user uses OpenSSL (req or ca command) to generate the certificates, OpenSSL will use the openssl.cnf file as the configuration data (can use "-config path/to/openssl.cnf" to describe the specific config file).
+
+The user need check the openssl.cnf file, to find your CA path setting, e.g. check if the path exists in [ CA_default ] section.
+
+ [ CA_default ]
+ dir = ./demoCA # Where everything is kept
+
+You may need the following steps for initialization:
+
+ rd ./demoCA /S/Q
+ mkdir ./demoCA
+ echo.>./demoCA/index.txt
+ echo 01 > ./demoCA/serial
+ mkdir ./demoCA/newcerts
+
+OpenSSL will apply the options from the specified sections in openssl.cnf when creating certificates or certificate signing requests. Make sure your configuration in openssl.cnf is correct and rational for certificate constraints.
+The following sample sections were used when generating test certificates in this readme.
+ ...
+ [ req ]
+ default_bits = 2048
+ default_keyfile = privkey.pem
+ distinguished_name = req_distinguished_name
+ attributes = req_attributes
+ x509_extensions = v3_ca # The extensions to add to the self signed cert
+ ...
+ [ v3_ca ]
+ # Extensions for a typical Root CA.
+ subjectKeyIdentifier=hash
+ authorityKeyIdentifier=keyid:always,issuer
+ basicConstraints = critical,CA:true
+ keyUsage = critical, digitalSignature, cRLSign, keyCertSign
+ ...
+ [ v3_intermediate_ca ]
+ # Extensions for a typical intermediate CA.
+ subjectKeyIdentifier = hash
+ authorityKeyIdentifier = keyid:always,issuer
+ basicConstraints = critical, CA:true
+ keyUsage = critical, digitalSignature, cRLSign, keyCertSign
+ ...
+ [ usr_cert ]
+ # Extensions for user end certificates.
+ basicConstraints = CA:FALSE
+ nsCertType = client, email
+ subjectKeyIdentifier = hash
+ authorityKeyIdentifier = keyid,issuer
+ keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment
+ extendedKeyUsage = clientAuth, emailProtection
+ ...
+
+* Generate the certificate chain:
+
+NOTE: User MUST set a UNIQUE "Common Name" on the different certificate
+
+1) Generate the Root Pair:
+
+Generate a root key:
+
+ openssl genrsa -aes256 -out TestRoot.key 2048
+
+Generate a self-signed root certificate:
+
+ openssl req -extensions v3_ca -new -x509 -days 3650 -key TestRoot.key -out TestRoot.crt
+ openssl x509 -in TestRoot.crt -out TestRoot.cer -outform DER
+ openssl x509 -inform DER -in TestRoot.cer -outform PEM -out TestRoot.pub.pem
+
+2) Generate the Intermediate Pair:
+
+Generate the intermediate key:
+
+ openssl genrsa -aes256 -out TestSub.key 2048
+
+Generate the intermediate certificate:
+
+ openssl req -new -days 3650 -key TestSub.key -out TestSub.csr
+ openssl ca -extensions v3_intermediate_ca -in TestSub.csr -days 3650 -out TestSub.crt -cert TestRoot.crt -keyfile TestRoot.key
+ openssl x509 -in TestSub.crt -out TestSub.cer -outform DER
+ openssl x509 -inform DER -in TestSub.cer -outform PEM -out TestSub.pub.pem
+
+3) Generate User Key Pair for Data Signing:
+
+Generate User key:
+
+ openssl genrsa -aes256 -out TestCert.key 2048
+
+Generate User certificate:
+
+ openssl req -new -days 3650 -key TestCert.key -out TestCert.csr
+ openssl ca -extensions usr_cert -in TestCert.csr -days 3650 -out TestCert.crt -cert TestSub.crt -keyfile TestSub.key
+ openssl x509 -in TestCert.crt -out TestCert.cer -outform DER
+ openssl x509 -inform DER -in TestCert.cer -outform PEM -out TestCert.pub.pem
+
+Convert Key and Certificate for signing. Password is removed with -nodes flag for convenience in this sample.
+
+ openssl pkcs12 -export -out TestCert.pfx -inkey TestCert.key -in TestCert.crt
+ openssl pkcs12 -in TestCert.pfx -nodes -out TestCert.pem
+
+* Verify Data Signing & Verification with new X.509 Certificate Chain
+
+1) Sign a Binary File to generate a detached PKCS7 signature:
+
+ openssl smime -sign -binary -signer TestCert.pem -outform DER -md sha256 -certfile TestSub.pub.pem -out test.bin.p7 -in test.bin
+
+2) Verify PKCS7 Signature of a Binary File:
+
+ openssl smime -verify -inform DER -in test.bin.p7 -content test.bin -CAfile TestRoot.pub.pem -out test.org.bin
+
+## Generate DSC PCD include files for Certificate
+
+The `BinToPcd` utility can be used to convert the binary Certificate file to a
+text file can be included from a DSC file to set a PCD to the contents of the
+Certificate file.
+
+The following 2 PCDs can be set to the PKCS7 Certificate value. The first one
+supports a single certificate. The second one supports multiple certificate
+values using the XDR format.
+* `gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer`
+* `gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr`
+
+Generate DSC PCD include files:
+```
+BinToPcd.py -i TestRoot.cer -p gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer -o TestRoot.cer.gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer.inc
+BinToPcd.py -i TestRoot.cer -p gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr -x -o TestRoot.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc
+```
+
+These files can be used in `!include` statements in DSC file PCD sections. For example:
+
+* Platform scoped fixed at build PCD section
+```
+[PcdsFixedAtBuild]
+ !include BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer.inc
+```
+
+* Platform scoped patchable in module PCD section
+```
+[PcdsPatchableInModule]
+ !include BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc
+```
+
+* Module scoped fixed at build PCD section
+```
+[Components]
+ FmpDevicePkg/FmpDxe/FmpDxe.inf {
+ <PcdsFixedAtBuild>
+ !include BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc
+ }
+```
diff --git a/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestCert.pem b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestCert.pem
new file mode 100644
index 000000000..637856752
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestCert.pem
@@ -0,0 +1,60 @@
+Bag Attributes
+ localKeyID: 32 25 22 FA 81 B3 BF 25 E2 F7 8F 0B 1B C4 50 70 BB B7 85 96
+subject=/C=CN/ST=SH/O=TianoCore/OU=EDKII/CN=TestCert/emailAddress=edkii@tianocore.org
+issuer=/C=CN/ST=SH/O=TianoCore/OU=EDKII/CN=TestSub/emailAddress=edkii@tianocore.org
+-----BEGIN CERTIFICATE-----
+MIIEKzCCAxOgAwIBAgICEAMwDQYJKoZIhvcNAQELBQAwdDELMAkGA1UEBhMCQ04x
+CzAJBgNVBAgMAlNIMRIwEAYDVQQKDAlUaWFub0NvcmUxDjAMBgNVBAsMBUVES0lJ
+MRAwDgYDVQQDDAdUZXN0U3ViMSIwIAYJKoZIhvcNAQkBFhNlZGtpaUB0aWFub2Nv
+cmUub3JnMB4XDTE3MDQxMDA4MzgwNFoXDTE4MDQxMDA4MzgwNFowdTELMAkGA1UE
+BhMCQ04xCzAJBgNVBAgMAlNIMRIwEAYDVQQKDAlUaWFub0NvcmUxDjAMBgNVBAsM
+BUVES0lJMREwDwYDVQQDDAhUZXN0Q2VydDEiMCAGCSqGSIb3DQEJARYTZWRraWlA
+dGlhbm9jb3JlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPe+
+2NX/Tf0iWMJgYMXMoWOiveX9FGx9YcwH+BKn9ZPZHig6CsZ6B17fwBWek8rIOAOR
+W8FL+UyRhsnKF/oKjMN7awiLjackjq8m0bPFHVl4dJooulHmSPCsRMeG/pWs4DVP
+WiIoF1uvXN6MZ3zt0hofgqPnGjJQF0HLECrPqyBv7sit9fIaNZ/clqcR3ZqdXQRU
+fEk7dE8pg+ZjNNa/5WTGwSBB7Ieku4jGbKybvpj6FtEP/8YyAJC3fOD+Y4PIQCnF
+xzWchOGrFcoeqgf/hLhzoiRvalgnvjczbo3W4sgFwFD/WxoDqb1l1moHyOubw5oT
+CdD+J+QwdFl1kCkG+K8CAwEAAaOBxTCBwjAJBgNVHRMEAjAAMBEGCWCGSAGG+EIB
+AQQEAwIFoDAzBglghkgBhvhCAQ0EJhYkT3BlblNTTCBHZW5lcmF0ZWQgQ2xpZW50
+IENlcnRpZmljYXRlMB0GA1UdDgQWBBTACEuCjiL/cFrP+l8hECWctq+Q+TAfBgNV
+HSMEGDAWgBTWnWbWSXz6II1ddWkqQQp6A1ql6zAOBgNVHQ8BAf8EBAMCBeAwHQYD
+VR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMEMA0GCSqGSIb3DQEBCwUAA4IBAQA7
+vYHdpk9u63dpMKAt5MrKU9dxVn/wuqNaYQMucvQLpcE12fgWMhV2wOHlmk3fJxq7
+CnD8QVaRbL3OQYWQQDA+sGNSJ9r71WFFET++94Rny6BzTz+dkrvIS4WaL/vLZ17c
+/gOsMCZUlhodxDcSSkachab3eE/VTEzOMUm41YYeW7USIoNSSgkWSnwZQVgcIg93
+F9X6lIr0Ik6rxHMq2ManiuSh6cMjJMGYGf2/58TySIefrXTe2A3TKQR27OYjfXJO
+l/H7u+4HS9AVCA7b9NihR5iSho5HrWqNC4Mmuz8D8iFOI2nWcek86StDswtoqDtu
+yekXblzF5lQY0goqDiks
+-----END CERTIFICATE-----
+Bag Attributes
+ localKeyID: 32 25 22 FA 81 B3 BF 25 E2 F7 8F 0B 1B C4 50 70 BB B7 85 96
+Key Attributes: <No Attributes>
+-----BEGIN PRIVATE KEY-----
+MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQD3vtjV/039IljC
+YGDFzKFjor3l/RRsfWHMB/gSp/WT2R4oOgrGegde38AVnpPKyDgDkVvBS/lMkYbJ
+yhf6CozDe2sIi42nJI6vJtGzxR1ZeHSaKLpR5kjwrETHhv6VrOA1T1oiKBdbr1ze
+jGd87dIaH4Kj5xoyUBdByxAqz6sgb+7IrfXyGjWf3JanEd2anV0EVHxJO3RPKYPm
+YzTWv+VkxsEgQeyHpLuIxmysm76Y+hbRD//GMgCQt3zg/mODyEApxcc1nIThqxXK
+HqoH/4S4c6Ikb2pYJ743M26N1uLIBcBQ/1saA6m9ZdZqB8jrm8OaEwnQ/ifkMHRZ
+dZApBvivAgMBAAECggEBAJ8NtLJ27T/1vBxWuepjfL217sroFyOrv4y5FQgNMvnP
+q6/Ry7cvAupjJjP7EhFfR67qtIi92PjSeUG18HzEJykdZFMhHTlQnBZRCtKqWzRk
+xB9wxGXuPafeQW4D+hBn4632GvzQ1mYziKEMbShkmr3QuxO1PDlO+A9yahfCKbBx
+SPCo+McV+N4c8ft/0UPMxqJLcZSMWscrBMCw1OhGdHry4CEr+NWHBeAAUWXrGSlq
+BPwM6PT00fku1RwQrw0QZw0YKL8VH5iA/uD8hfuaO2YUlt2Z025csNRyIPrizr6v
+Q8Is7jetqPpXulWSBtSYoghTj97DeYQQsQwck+tQN6kCgYEA/beFmdojyc9CoLkd
+0MgwyPBdWma77rj80PAgeRm0hl2KQa8pA6dL/1y5x3vA25gqBr++q+KmSkYT6z/Z
+n3llOk6pRlSWFlxuSLHVjOb/Qp1V/uxEG68Tg8L/I3SlMWiQ+/MnsXNHh+WEtKcZ
+FCVd0ASA4NbsKYKflT2QgraDB00CgYEA+fmRrwRlkh2OxVrxpGFER2uosYGlwQiq
+Xb75eU8BnpO8CCnXtBK4Uv3J6l/zfc+Tr2LzzgPkQiWd4NF1/EFxCNQA5kxGcPf5
+F4f8dPr8CrADO1JNrX2ITHsosaaC1ImdW/r6tl66Ie2ueCImk5Yfu5DQv7JrKh/d
+lrTEUxJL2esCgYEA2VKBla9MSGjH4XOvHk7busJotC6be3fo1e9ZYWGrSAyHiIvI
+zeBXMHz0hPJz16UXGoDTideyKJyuIyul9Pu+wZrvU9bQWIcD0DDDgtW6gAzUxG8M
+R8pHJO26LVyUwyWWSrmUnmLoOndWnIck7CS1nqC849o0n7nLh8IcLlq3EWECgYEA
+1HkeLE4na2f2R6fChv8qAy7uJ1rUodwUuzQtZsAR11EpXSL7tpLG27veGXpPQ9vh
+Yw1PwAesx9Cjfklr6OtTAbb5wMaKhVExB6BNpL0E6KytQon1foaaCLASadXnlHIY
+L+uHmOWxfk9BodkdQwsyk8JGvPoRfq+xMH0b9qQxltsCgYEAtNf8yvoTXUHa2zje
+PvI6OiQjuiON5UIt9KkQNrIrcm4wiQ2eVdkCQcUstuXtmBtvnsrxlay0jbSz2bV6
+1sWlJIvfZJujC901yMs5+twr6jMuXZ6ashWF1f2UbwgtKvh49PPgly4RhWST3Kp1
+J1AmCrzTwtaNmTZd1g5IYreXpKw=
+-----END PRIVATE KEY-----
diff --git a/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestCert.pub.pem b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestCert.pub.pem
new file mode 100644
index 000000000..f98462718
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestCert.pub.pem
@@ -0,0 +1,25 @@
+-----BEGIN CERTIFICATE-----
+MIIEKzCCAxOgAwIBAgICEAMwDQYJKoZIhvcNAQELBQAwdDELMAkGA1UEBhMCQ04x
+CzAJBgNVBAgMAlNIMRIwEAYDVQQKDAlUaWFub0NvcmUxDjAMBgNVBAsMBUVES0lJ
+MRAwDgYDVQQDDAdUZXN0U3ViMSIwIAYJKoZIhvcNAQkBFhNlZGtpaUB0aWFub2Nv
+cmUub3JnMB4XDTE3MDQxMDA4MzgwNFoXDTE4MDQxMDA4MzgwNFowdTELMAkGA1UE
+BhMCQ04xCzAJBgNVBAgMAlNIMRIwEAYDVQQKDAlUaWFub0NvcmUxDjAMBgNVBAsM
+BUVES0lJMREwDwYDVQQDDAhUZXN0Q2VydDEiMCAGCSqGSIb3DQEJARYTZWRraWlA
+dGlhbm9jb3JlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPe+
+2NX/Tf0iWMJgYMXMoWOiveX9FGx9YcwH+BKn9ZPZHig6CsZ6B17fwBWek8rIOAOR
+W8FL+UyRhsnKF/oKjMN7awiLjackjq8m0bPFHVl4dJooulHmSPCsRMeG/pWs4DVP
+WiIoF1uvXN6MZ3zt0hofgqPnGjJQF0HLECrPqyBv7sit9fIaNZ/clqcR3ZqdXQRU
+fEk7dE8pg+ZjNNa/5WTGwSBB7Ieku4jGbKybvpj6FtEP/8YyAJC3fOD+Y4PIQCnF
+xzWchOGrFcoeqgf/hLhzoiRvalgnvjczbo3W4sgFwFD/WxoDqb1l1moHyOubw5oT
+CdD+J+QwdFl1kCkG+K8CAwEAAaOBxTCBwjAJBgNVHRMEAjAAMBEGCWCGSAGG+EIB
+AQQEAwIFoDAzBglghkgBhvhCAQ0EJhYkT3BlblNTTCBHZW5lcmF0ZWQgQ2xpZW50
+IENlcnRpZmljYXRlMB0GA1UdDgQWBBTACEuCjiL/cFrP+l8hECWctq+Q+TAfBgNV
+HSMEGDAWgBTWnWbWSXz6II1ddWkqQQp6A1ql6zAOBgNVHQ8BAf8EBAMCBeAwHQYD
+VR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMEMA0GCSqGSIb3DQEBCwUAA4IBAQA7
+vYHdpk9u63dpMKAt5MrKU9dxVn/wuqNaYQMucvQLpcE12fgWMhV2wOHlmk3fJxq7
+CnD8QVaRbL3OQYWQQDA+sGNSJ9r71WFFET++94Rny6BzTz+dkrvIS4WaL/vLZ17c
+/gOsMCZUlhodxDcSSkachab3eE/VTEzOMUm41YYeW7USIoNSSgkWSnwZQVgcIg93
+F9X6lIr0Ik6rxHMq2ManiuSh6cMjJMGYGf2/58TySIefrXTe2A3TKQR27OYjfXJO
+l/H7u+4HS9AVCA7b9NihR5iSho5HrWqNC4Mmuz8D8iFOI2nWcek86StDswtoqDtu
+yekXblzF5lQY0goqDiks
+-----END CERTIFICATE-----
diff --git a/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer
new file mode 100644
index 000000000..4c9bf0be5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer
Binary files differ
diff --git a/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer.inc b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer.inc
new file mode 100644
index 000000000..907c70dd9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer.inc
@@ -0,0 +1 @@
+ gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer|{0x30, 0x82, 0x03, 0xEC, 0x30, 0x82, 0x02, 0xD4, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xC0, 0x91, 0xC5, 0xE2, 0xB7, 0x66, 0xC0, 0xF8, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x30, 0x81, 0x82, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x4E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x02, 0x53, 0x48, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x02, 0x53, 0x48, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x09, 0x54, 0x69, 0x61, 0x6E, 0x6F, 0x43, 0x6F, 0x72, 0x65, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x05, 0x45, 0x44, 0x4B, 0x49, 0x49, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x08, 0x54, 0x65, 0x73, 0x74, 0x52, 0x6F, 0x6F, 0x74, 0x31, 0x22, 0x30, 0x20, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x13, 0x65, 0x64, 0x6B, 0x69, 0x69, 0x40, 0x74, 0x69, 0x61, 0x6E, 0x6F, 0x63, 0x6F, 0x72, 0x65, 0x2E, 0x6F, 0x72, 0x67, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x37, 0x30, 0x34, 0x31, 0x30, 0x30, 0x38, 0x32, 0x37, 0x34, 0x30, 0x5A, 0x17, 0x0D, 0x31, 0x37, 0x30, 0x35, 0x31, 0x30, 0x30, 0x38, 0x32, 0x37, 0x34, 0x30, 0x5A, 0x30, 0x81, 0x82, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x4E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x02, 0x53, 0x48, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x02, 0x53, 0x48, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x09, 0x54, 0x69, 0x61, 0x6E, 0x6F, 0x43, 0x6F, 0x72, 0x65, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x05, 0x45, 0x44, 0x4B, 0x49, 0x49, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x08, 0x54, 0x65, 0x73, 0x74, 0x52, 0x6F, 0x6F, 0x74, 0x31, 0x22, 0x30, 0x20, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x13, 0x65, 0x64, 0x6B, 0x69, 0x69, 0x40, 0x74, 0x69, 0x61, 0x6E, 0x6F, 0x63, 0x6F, 0x72, 0x65, 0x2E, 0x6F, 0x72, 0x67, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xB9, 0x29, 0x29, 0x6C, 0x60, 0x0C, 0xD7, 0x23, 0xF6, 0x7D, 0xEE, 0xF0, 0x62, 0xFF, 0xD9, 0xC9, 0xAA, 0x55, 0x8C, 0x81, 0x95, 0x56, 0x3F, 0xB7, 0x56, 0x53, 0xB0, 0xC2, 0x82, 0x12, 0xC5, 0x3B, 0x75, 0x23, 0xB9, 0x4D, 0xD6, 0xC4, 0x55, 0x73, 0xF3, 0xAA, 0x95, 0xA8, 0x1B, 0xF3, 0x93, 0x7E, 0x9E, 0x40, 0xE4, 0x1D, 0x22, 0x9C, 0x93, 0x07, 0x0B, 0xD7, 0xAA, 0x5B, 0xD7, 0xE4, 0x1A, 0x21, 0x84, 0xD7, 0x63, 0x59, 0x03, 0x50, 0x1F, 0xF5, 0x14, 0x55, 0x93, 0x91, 0x9B, 0xF5, 0x52, 0xB0, 0xBF, 0x0E, 0x5C, 0x68, 0x3B, 0x59, 0x52, 0x98, 0x96, 0x56, 0xE1, 0xAB, 0xC4, 0x43, 0xBB, 0x05, 0x57, 0x78, 0x45, 0x01, 0x9F, 0x58, 0x15, 0x53, 0x0E, 0x11, 0x94, 0x2F, 0x0E, 0xF1, 0xA6, 0x19, 0xA2, 0x6E, 0x86, 0x39, 0x2B, 0x33, 0x8D, 0xC7, 0xC5, 0xEB, 0xEE, 0x1E, 0x33, 0xD3, 0x32, 0x94, 0xC1, 0x59, 0xC4, 0x0C, 0x97, 0x0B, 0x12, 0x48, 0x5F, 0x33, 0xF6, 0x60, 0x74, 0x7D, 0x57, 0xC2, 0x13, 0x2D, 0x7D, 0xA9, 0x87, 0xA3, 0x35, 0xEA, 0x91, 0x83, 0x3F, 0x67, 0x7A, 0x92, 0x1F, 0x01, 0x53, 0x9F, 0x62, 0x5F, 0x99, 0x12, 0xFD, 0x73, 0x1B, 0x2D, 0x9E, 0x2B, 0x6C, 0x34, 0x49, 0xAF, 0x4F, 0x07, 0x8F, 0xC0, 0xE9, 0x6B, 0x9E, 0x5F, 0x79, 0x35, 0xDA, 0x2A, 0x5C, 0x88, 0xEE, 0xF6, 0x48, 0x61, 0xDA, 0x96, 0xE3, 0x48, 0x46, 0xA0, 0x94, 0x1C, 0x9D, 0xF6, 0x5C, 0x87, 0x0E, 0xEF, 0x74, 0x09, 0x91, 0x0D, 0x3D, 0x5A, 0xE7, 0xC5, 0x4C, 0x8A, 0x7A, 0xAC, 0xA1, 0x85, 0xB6, 0x67, 0x44, 0x17, 0x55, 0x52, 0x3A, 0xE8, 0x11, 0x4D, 0x58, 0xA2, 0x93, 0x00, 0x62, 0xEA, 0x7B, 0x80, 0xED, 0xCF, 0xBD, 0xDF, 0x75, 0x80, 0x4B, 0xB9, 0x65, 0x63, 0xAD, 0x0B, 0x4D, 0x74, 0xFA, 0x59, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x63, 0x30, 0x61, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x16, 0xAA, 0xD6, 0x8E, 0x1B, 0x2D, 0x43, 0xF3, 0x2D, 0xB0, 0x24, 0xAD, 0x36, 0x65, 0x3F, 0xB2, 0xFA, 0xB1, 0x2C, 0xED, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x16, 0xAA, 0xD6, 0x8E, 0x1B, 0x2D, 0x43, 0xF3, 0x2D, 0xB0, 0x24, 0xAD, 0x36, 0x65, 0x3F, 0xB2, 0xFA, 0xB1, 0x2C, 0xED, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x95, 0xDE, 0xDF, 0xA4, 0x14, 0xDB, 0x92, 0x22, 0x78, 0x1A, 0xBD, 0x31, 0x9D, 0x1E, 0xD7, 0x2F, 0x0A, 0x10, 0x11, 0x5D, 0x74, 0x61, 0xE8, 0x30, 0xC4, 0xF3, 0x15, 0xE9, 0x30, 0x54, 0xF4, 0xBB, 0x0C, 0x04, 0x78, 0x13, 0x5D, 0x2C, 0xDD, 0x8C, 0x92, 0x90, 0xD1, 0x9C, 0xD0, 0xD0, 0x18, 0xA3, 0xA3, 0xFC, 0x8C, 0x28, 0x5A, 0xD4, 0x91, 0x4D, 0x08, 0xC3, 0xF6, 0x1A, 0xC8, 0xDD, 0xA6, 0x08, 0x58, 0xE2, 0x15, 0x95, 0xFB, 0x2D, 0x2D, 0x8A, 0xB1, 0x30, 0x80, 0xBD, 0x9A, 0xB6, 0xE1, 0x2C, 0x20, 0x3E, 0xDD, 0xC4, 0xC7, 0x55, 0x65, 0xCF, 0x28, 0x17, 0xF4, 0xEE, 0xDA, 0xBE, 0x77, 0x70, 0xD5, 0x52, 0xD6, 0x15, 0x7A, 0xFB, 0xAD, 0xAF, 0xFD, 0xD5, 0x45, 0x90, 0x5A, 0xE6, 0x31, 0x42, 0xD7, 0x84, 0xB3, 0x49, 0x56, 0x6A, 0xD3, 0x47, 0xF3, 0xBF, 0x68, 0x60, 0x8B, 0x0F, 0xE2, 0xAF, 0xF4, 0xE3, 0xEC, 0x12, 0xB9, 0xE2, 0x3A, 0x16, 0x11, 0x4E, 0x4D, 0x73, 0x79, 0xAF, 0x47, 0x85, 0x4C, 0x76, 0x26, 0x9E, 0x8B, 0x32, 0xC0, 0x8E, 0xC2, 0xDC, 0x27, 0xA6, 0xEF, 0xAC, 0x93, 0x9E, 0xA1, 0x5E, 0xCF, 0x34, 0x45, 0xE0, 0x2A, 0xC7, 0x9D, 0x4D, 0xD7, 0xD7, 0x37, 0x72, 0x97, 0xF8, 0x58, 0xF9, 0xB6, 0x35, 0x48, 0xF1, 0xD1, 0x0A, 0x72, 0x7F, 0xFD, 0x4D, 0x7C, 0xE9, 0xCC, 0xD8, 0x48, 0x1B, 0x49, 0x52, 0x53, 0xDE, 0x51, 0x01, 0x53, 0x35, 0xBC, 0x90, 0xCD, 0x8C, 0x8A, 0xCC, 0x43, 0x20, 0xA7, 0x45, 0xFF, 0x2B, 0x55, 0xB0, 0x8B, 0x2D, 0xFF, 0x55, 0x15, 0x4B, 0x84, 0xD0, 0xC3, 0xD3, 0x90, 0x9C, 0x94, 0x4B, 0x55, 0xD5, 0x62, 0xEA, 0x22, 0xAB, 0x62, 0x68, 0xDD, 0x53, 0xC6, 0xDC, 0xA5, 0xDD, 0x9A, 0x2D, 0x8E, 0x79, 0x7C, 0x2E, 0x9C, 0xE4, 0x66, 0x80, 0x8C, 0x1D} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc
new file mode 100644
index 000000000..69f7341d6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc
@@ -0,0 +1 @@
+ gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr|{0x00, 0x00, 0x03, 0xF0, 0x30, 0x82, 0x03, 0xEC, 0x30, 0x82, 0x02, 0xD4, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xC0, 0x91, 0xC5, 0xE2, 0xB7, 0x66, 0xC0, 0xF8, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x30, 0x81, 0x82, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x4E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x02, 0x53, 0x48, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x02, 0x53, 0x48, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x09, 0x54, 0x69, 0x61, 0x6E, 0x6F, 0x43, 0x6F, 0x72, 0x65, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x05, 0x45, 0x44, 0x4B, 0x49, 0x49, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x08, 0x54, 0x65, 0x73, 0x74, 0x52, 0x6F, 0x6F, 0x74, 0x31, 0x22, 0x30, 0x20, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x13, 0x65, 0x64, 0x6B, 0x69, 0x69, 0x40, 0x74, 0x69, 0x61, 0x6E, 0x6F, 0x63, 0x6F, 0x72, 0x65, 0x2E, 0x6F, 0x72, 0x67, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x37, 0x30, 0x34, 0x31, 0x30, 0x30, 0x38, 0x32, 0x37, 0x34, 0x30, 0x5A, 0x17, 0x0D, 0x31, 0x37, 0x30, 0x35, 0x31, 0x30, 0x30, 0x38, 0x32, 0x37, 0x34, 0x30, 0x5A, 0x30, 0x81, 0x82, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x4E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x02, 0x53, 0x48, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x02, 0x53, 0x48, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x09, 0x54, 0x69, 0x61, 0x6E, 0x6F, 0x43, 0x6F, 0x72, 0x65, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x05, 0x45, 0x44, 0x4B, 0x49, 0x49, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x08, 0x54, 0x65, 0x73, 0x74, 0x52, 0x6F, 0x6F, 0x74, 0x31, 0x22, 0x30, 0x20, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x13, 0x65, 0x64, 0x6B, 0x69, 0x69, 0x40, 0x74, 0x69, 0x61, 0x6E, 0x6F, 0x63, 0x6F, 0x72, 0x65, 0x2E, 0x6F, 0x72, 0x67, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xB9, 0x29, 0x29, 0x6C, 0x60, 0x0C, 0xD7, 0x23, 0xF6, 0x7D, 0xEE, 0xF0, 0x62, 0xFF, 0xD9, 0xC9, 0xAA, 0x55, 0x8C, 0x81, 0x95, 0x56, 0x3F, 0xB7, 0x56, 0x53, 0xB0, 0xC2, 0x82, 0x12, 0xC5, 0x3B, 0x75, 0x23, 0xB9, 0x4D, 0xD6, 0xC4, 0x55, 0x73, 0xF3, 0xAA, 0x95, 0xA8, 0x1B, 0xF3, 0x93, 0x7E, 0x9E, 0x40, 0xE4, 0x1D, 0x22, 0x9C, 0x93, 0x07, 0x0B, 0xD7, 0xAA, 0x5B, 0xD7, 0xE4, 0x1A, 0x21, 0x84, 0xD7, 0x63, 0x59, 0x03, 0x50, 0x1F, 0xF5, 0x14, 0x55, 0x93, 0x91, 0x9B, 0xF5, 0x52, 0xB0, 0xBF, 0x0E, 0x5C, 0x68, 0x3B, 0x59, 0x52, 0x98, 0x96, 0x56, 0xE1, 0xAB, 0xC4, 0x43, 0xBB, 0x05, 0x57, 0x78, 0x45, 0x01, 0x9F, 0x58, 0x15, 0x53, 0x0E, 0x11, 0x94, 0x2F, 0x0E, 0xF1, 0xA6, 0x19, 0xA2, 0x6E, 0x86, 0x39, 0x2B, 0x33, 0x8D, 0xC7, 0xC5, 0xEB, 0xEE, 0x1E, 0x33, 0xD3, 0x32, 0x94, 0xC1, 0x59, 0xC4, 0x0C, 0x97, 0x0B, 0x12, 0x48, 0x5F, 0x33, 0xF6, 0x60, 0x74, 0x7D, 0x57, 0xC2, 0x13, 0x2D, 0x7D, 0xA9, 0x87, 0xA3, 0x35, 0xEA, 0x91, 0x83, 0x3F, 0x67, 0x7A, 0x92, 0x1F, 0x01, 0x53, 0x9F, 0x62, 0x5F, 0x99, 0x12, 0xFD, 0x73, 0x1B, 0x2D, 0x9E, 0x2B, 0x6C, 0x34, 0x49, 0xAF, 0x4F, 0x07, 0x8F, 0xC0, 0xE9, 0x6B, 0x9E, 0x5F, 0x79, 0x35, 0xDA, 0x2A, 0x5C, 0x88, 0xEE, 0xF6, 0x48, 0x61, 0xDA, 0x96, 0xE3, 0x48, 0x46, 0xA0, 0x94, 0x1C, 0x9D, 0xF6, 0x5C, 0x87, 0x0E, 0xEF, 0x74, 0x09, 0x91, 0x0D, 0x3D, 0x5A, 0xE7, 0xC5, 0x4C, 0x8A, 0x7A, 0xAC, 0xA1, 0x85, 0xB6, 0x67, 0x44, 0x17, 0x55, 0x52, 0x3A, 0xE8, 0x11, 0x4D, 0x58, 0xA2, 0x93, 0x00, 0x62, 0xEA, 0x7B, 0x80, 0xED, 0xCF, 0xBD, 0xDF, 0x75, 0x80, 0x4B, 0xB9, 0x65, 0x63, 0xAD, 0x0B, 0x4D, 0x74, 0xFA, 0x59, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x63, 0x30, 0x61, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x16, 0xAA, 0xD6, 0x8E, 0x1B, 0x2D, 0x43, 0xF3, 0x2D, 0xB0, 0x24, 0xAD, 0x36, 0x65, 0x3F, 0xB2, 0xFA, 0xB1, 0x2C, 0xED, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x16, 0xAA, 0xD6, 0x8E, 0x1B, 0x2D, 0x43, 0xF3, 0x2D, 0xB0, 0x24, 0xAD, 0x36, 0x65, 0x3F, 0xB2, 0xFA, 0xB1, 0x2C, 0xED, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x95, 0xDE, 0xDF, 0xA4, 0x14, 0xDB, 0x92, 0x22, 0x78, 0x1A, 0xBD, 0x31, 0x9D, 0x1E, 0xD7, 0x2F, 0x0A, 0x10, 0x11, 0x5D, 0x74, 0x61, 0xE8, 0x30, 0xC4, 0xF3, 0x15, 0xE9, 0x30, 0x54, 0xF4, 0xBB, 0x0C, 0x04, 0x78, 0x13, 0x5D, 0x2C, 0xDD, 0x8C, 0x92, 0x90, 0xD1, 0x9C, 0xD0, 0xD0, 0x18, 0xA3, 0xA3, 0xFC, 0x8C, 0x28, 0x5A, 0xD4, 0x91, 0x4D, 0x08, 0xC3, 0xF6, 0x1A, 0xC8, 0xDD, 0xA6, 0x08, 0x58, 0xE2, 0x15, 0x95, 0xFB, 0x2D, 0x2D, 0x8A, 0xB1, 0x30, 0x80, 0xBD, 0x9A, 0xB6, 0xE1, 0x2C, 0x20, 0x3E, 0xDD, 0xC4, 0xC7, 0x55, 0x65, 0xCF, 0x28, 0x17, 0xF4, 0xEE, 0xDA, 0xBE, 0x77, 0x70, 0xD5, 0x52, 0xD6, 0x15, 0x7A, 0xFB, 0xAD, 0xAF, 0xFD, 0xD5, 0x45, 0x90, 0x5A, 0xE6, 0x31, 0x42, 0xD7, 0x84, 0xB3, 0x49, 0x56, 0x6A, 0xD3, 0x47, 0xF3, 0xBF, 0x68, 0x60, 0x8B, 0x0F, 0xE2, 0xAF, 0xF4, 0xE3, 0xEC, 0x12, 0xB9, 0xE2, 0x3A, 0x16, 0x11, 0x4E, 0x4D, 0x73, 0x79, 0xAF, 0x47, 0x85, 0x4C, 0x76, 0x26, 0x9E, 0x8B, 0x32, 0xC0, 0x8E, 0xC2, 0xDC, 0x27, 0xA6, 0xEF, 0xAC, 0x93, 0x9E, 0xA1, 0x5E, 0xCF, 0x34, 0x45, 0xE0, 0x2A, 0xC7, 0x9D, 0x4D, 0xD7, 0xD7, 0x37, 0x72, 0x97, 0xF8, 0x58, 0xF9, 0xB6, 0x35, 0x48, 0xF1, 0xD1, 0x0A, 0x72, 0x7F, 0xFD, 0x4D, 0x7C, 0xE9, 0xCC, 0xD8, 0x48, 0x1B, 0x49, 0x52, 0x53, 0xDE, 0x51, 0x01, 0x53, 0x35, 0xBC, 0x90, 0xCD, 0x8C, 0x8A, 0xCC, 0x43, 0x20, 0xA7, 0x45, 0xFF, 0x2B, 0x55, 0xB0, 0x8B, 0x2D, 0xFF, 0x55, 0x15, 0x4B, 0x84, 0xD0, 0xC3, 0xD3, 0x90, 0x9C, 0x94, 0x4B, 0x55, 0xD5, 0x62, 0xEA, 0x22, 0xAB, 0x62, 0x68, 0xDD, 0x53, 0xC6, 0xDC, 0xA5, 0xDD, 0x9A, 0x2D, 0x8E, 0x79, 0x7C, 0x2E, 0x9C, 0xE4, 0x66, 0x80, 0x8C, 0x1D} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pem b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pem
new file mode 100644
index 000000000..1331933c3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pem
@@ -0,0 +1,58 @@
+Bag Attributes
+ localKeyID: F4 2E C8 1D 29 A0 02 47 B7 93 2B 69 8D 8D D1 33 7A E3 09 30
+subject=/C=CN/ST=SH/L=SH/O=TianoCore/OU=EDKII/CN=TestRoot/emailAddress=edkii@tianocore.org
+issuer=/C=CN/ST=SH/L=SH/O=TianoCore/OU=EDKII/CN=TestRoot/emailAddress=edkii@tianocore.org
+-----BEGIN CERTIFICATE-----
+MIID7DCCAtSgAwIBAgIJAMCRxeK3ZsD4MA0GCSqGSIb3DQEBCwUAMIGCMQswCQYD
+VQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNVBAcMAlNIMRIwEAYDVQQKDAlUaWFu
+b0NvcmUxDjAMBgNVBAsMBUVES0lJMREwDwYDVQQDDAhUZXN0Um9vdDEiMCAGCSqG
+SIb3DQEJARYTZWRraWlAdGlhbm9jb3JlLm9yZzAeFw0xNzA0MTAwODI3NDBaFw0x
+NzA1MTAwODI3NDBaMIGCMQswCQYDVQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNV
+BAcMAlNIMRIwEAYDVQQKDAlUaWFub0NvcmUxDjAMBgNVBAsMBUVES0lJMREwDwYD
+VQQDDAhUZXN0Um9vdDEiMCAGCSqGSIb3DQEJARYTZWRraWlAdGlhbm9jb3JlLm9y
+ZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALkpKWxgDNcj9n3u8GL/
+2cmqVYyBlVY/t1ZTsMKCEsU7dSO5TdbEVXPzqpWoG/OTfp5A5B0inJMHC9eqW9fk
+GiGE12NZA1Af9RRVk5Gb9VKwvw5caDtZUpiWVuGrxEO7BVd4RQGfWBVTDhGULw7x
+phmiboY5KzONx8Xr7h4z0zKUwVnEDJcLEkhfM/ZgdH1XwhMtfamHozXqkYM/Z3qS
+HwFTn2JfmRL9cxstnitsNEmvTwePwOlrnl95NdoqXIju9khh2pbjSEaglByd9lyH
+Du90CZENPVrnxUyKeqyhhbZnRBdVUjroEU1YopMAYup7gO3Pvd91gEu5ZWOtC010
++lkCAwEAAaNjMGEwHQYDVR0OBBYEFBaq1o4bLUPzLbAkrTZlP7L6sSztMB8GA1Ud
+IwQYMBaAFBaq1o4bLUPzLbAkrTZlP7L6sSztMA8GA1UdEwEB/wQFMAMBAf8wDgYD
+VR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4IBAQCV3t+kFNuSIngavTGdHtcv
+ChARXXRh6DDE8xXpMFT0uwwEeBNdLN2MkpDRnNDQGKOj/IwoWtSRTQjD9hrI3aYI
+WOIVlfstLYqxMIC9mrbhLCA+3cTHVWXPKBf07tq+d3DVUtYVevutr/3VRZBa5jFC
+14SzSVZq00fzv2hgiw/ir/Tj7BK54joWEU5Nc3mvR4VMdiaeizLAjsLcJ6bvrJOe
+oV7PNEXgKsedTdfXN3KX+Fj5tjVI8dEKcn/9TXzpzNhIG0lSU95RAVM1vJDNjIrM
+QyCnRf8rVbCLLf9VFUuE0MPTkJyUS1XVYuoiq2Jo3VPG3KXdmi2OeXwunORmgIwd
+-----END CERTIFICATE-----
+Bag Attributes
+ localKeyID: F4 2E C8 1D 29 A0 02 47 B7 93 2B 69 8D 8D D1 33 7A E3 09 30
+Key Attributes: <No Attributes>
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC5KSlsYAzXI/Z9
+7vBi/9nJqlWMgZVWP7dWU7DCghLFO3UjuU3WxFVz86qVqBvzk36eQOQdIpyTBwvX
+qlvX5BohhNdjWQNQH/UUVZORm/VSsL8OXGg7WVKYllbhq8RDuwVXeEUBn1gVUw4R
+lC8O8aYZom6GOSszjcfF6+4eM9MylMFZxAyXCxJIXzP2YHR9V8ITLX2ph6M16pGD
+P2d6kh8BU59iX5kS/XMbLZ4rbDRJr08Hj8Dpa55feTXaKlyI7vZIYdqW40hGoJQc
+nfZchw7vdAmRDT1a58VMinqsoYW2Z0QXVVI66BFNWKKTAGLqe4Dtz73fdYBLuWVj
+rQtNdPpZAgMBAAECggEAci5d6wT4Jht5P4N/Ha2kweWWR8UJMFyuVD/bura3mITn
+4ZW92HjOMWjLgupeAkCsTi65/PWBFHG97cqSRHnXW2At6ofTsS9j1JxJGfvQtqNj
+zhlR9XdJperfvN5Nc277BkuWUj/O86d5/4Ef29lMknZGLeNHLs15qiWpe1p+HKvt
++DfL7Prl5qWA5G90QmXgRQJbThl1TYLCYkETB+9m3MIRm8Z01XKH+fm4ahgclEkG
+XaQl04DhMEo7A/sC8NUnozOMEf81Ixkt3wEpoEDtZ+WhRTrgLF23Q4sXAIBMlEfz
+Pz2UaX/9KBT1dRbZseStIjJKMc8qd+pC7Ww2tuHEOQKBgQDmLdFSgHc2URQW/Otj
+fr9S/Z7EPSOA/tmh4dFhQGwzKF4Us838deRz2cRTbgq5BHuBCrMEPRBiX8h4WLEB
+NVZ73JjgOfyshcDXWNg5noc9f24HYHMZnjcFmHNokpyIgxLl2qgN8f03doJEmKkj
+pm/VnfZmkGDd65IXRp8MYMTQOwKBgQDN7ofqKWK5SA+vt+tDOkCYq6eHKb9+ImPh
+PreikT5xc9SMtb0tGlIjKydsiqA9Jv1WRnpUG0fVfMyagBSOrKt9wC143VEvOtkR
+QJehmLLYG97HP7CXtniAWeKuc2pfCd+nGdHLFmduuTEEDcxab5LQc5dvYQ/RfznF
+YVunt73qewKBgQCg11VUpCYpU2CJa7SEMtY4hLbDg8FiazLiVqx7m4u/964+IyKG
+Dk9T0NDKR7PAc2xl0HclOBJR24J27erJ4F6NcKl2za5NU61cDV4SbT8tbvUQvInR
+Veg2xb+nTAOLtKOo8DDMhdMeRXZjvpU6LxwolhfOtYaqq+jK0PNkr933bwKBgA0G
+RiBgR7cyQJO7jSyuVYGSccERuePPZwPLBLBKgWmJiurvX6ynmoRQ6WhrCCF2AtXf
+FUOWih+Nih9HdIVllF8atYWMceML1MjLjguRbdZPRPLTK2cdClgL11NzR0oFhNi7
+wFIY86fEHL6F5OPfZKi8dtp7iBWW919tfe+IpoFbAoGBAMzNKKBHG5eMuKQI/Dww
+50PDHu25TGUiTc1bHx18v7mGlcvhEPkDYAKd3y7FN5VRoooarGYlLDHXez0FvDTa
+ABFUUad70bULTqRTSmld0I9CWWnYs0vaFKgIemddQ7W2eXr7N+N+ED+OK/PvWjMq
+LMKhChf252RfOYdB+WN6alVG
+-----END PRIVATE KEY-----
diff --git a/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pub.pem b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pub.pem
new file mode 100644
index 000000000..ae67e9c1b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pub.pem
@@ -0,0 +1,23 @@
+-----BEGIN CERTIFICATE-----
+MIID7DCCAtSgAwIBAgIJAMCRxeK3ZsD4MA0GCSqGSIb3DQEBCwUAMIGCMQswCQYD
+VQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNVBAcMAlNIMRIwEAYDVQQKDAlUaWFu
+b0NvcmUxDjAMBgNVBAsMBUVES0lJMREwDwYDVQQDDAhUZXN0Um9vdDEiMCAGCSqG
+SIb3DQEJARYTZWRraWlAdGlhbm9jb3JlLm9yZzAeFw0xNzA0MTAwODI3NDBaFw0x
+NzA1MTAwODI3NDBaMIGCMQswCQYDVQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNV
+BAcMAlNIMRIwEAYDVQQKDAlUaWFub0NvcmUxDjAMBgNVBAsMBUVES0lJMREwDwYD
+VQQDDAhUZXN0Um9vdDEiMCAGCSqGSIb3DQEJARYTZWRraWlAdGlhbm9jb3JlLm9y
+ZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALkpKWxgDNcj9n3u8GL/
+2cmqVYyBlVY/t1ZTsMKCEsU7dSO5TdbEVXPzqpWoG/OTfp5A5B0inJMHC9eqW9fk
+GiGE12NZA1Af9RRVk5Gb9VKwvw5caDtZUpiWVuGrxEO7BVd4RQGfWBVTDhGULw7x
+phmiboY5KzONx8Xr7h4z0zKUwVnEDJcLEkhfM/ZgdH1XwhMtfamHozXqkYM/Z3qS
+HwFTn2JfmRL9cxstnitsNEmvTwePwOlrnl95NdoqXIju9khh2pbjSEaglByd9lyH
+Du90CZENPVrnxUyKeqyhhbZnRBdVUjroEU1YopMAYup7gO3Pvd91gEu5ZWOtC010
++lkCAwEAAaNjMGEwHQYDVR0OBBYEFBaq1o4bLUPzLbAkrTZlP7L6sSztMB8GA1Ud
+IwQYMBaAFBaq1o4bLUPzLbAkrTZlP7L6sSztMA8GA1UdEwEB/wQFMAMBAf8wDgYD
+VR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4IBAQCV3t+kFNuSIngavTGdHtcv
+ChARXXRh6DDE8xXpMFT0uwwEeBNdLN2MkpDRnNDQGKOj/IwoWtSRTQjD9hrI3aYI
+WOIVlfstLYqxMIC9mrbhLCA+3cTHVWXPKBf07tq+d3DVUtYVevutr/3VRZBa5jFC
+14SzSVZq00fzv2hgiw/ir/Tj7BK54joWEU5Nc3mvR4VMdiaeizLAjsLcJ6bvrJOe
+oV7PNEXgKsedTdfXN3KX+Fj5tjVI8dEKcn/9TXzpzNhIG0lSU95RAVM1vJDNjIrM
+QyCnRf8rVbCLLf9VFUuE0MPTkJyUS1XVYuoiq2Jo3VPG3KXdmi2OeXwunORmgIwd
+-----END CERTIFICATE-----
diff --git a/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestSub.pem b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestSub.pem
new file mode 100644
index 000000000..de988856e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestSub.pem
@@ -0,0 +1,59 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 4098 (0x1002)
+ Signature Algorithm: sha256WithRSAEncryption
+ Issuer: C = CN, ST = SH, L = SH, O = TianoCore, OU = EDKII, CN = TestRoot, emailAddress = edkii@tianocore.org
+ Validity
+ Not Before: Apr 10 08:33:45 2017 GMT
+ Not After : Apr 10 08:33:45 2018 GMT
+ Subject: C = CN, ST = SH, O = TianoCore, OU = EDKII, CN = TestSub, emailAddress = edkii@tianocore.org
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (2048 bit)
+ Modulus:
+ 00:c5:3a:af:16:34:9a:14:61:74:8c:39:1a:04:1f:
+ 7b:95:d3:40:b7:ea:26:a7:7b:8d:76:d3:86:1b:7c:
+ 07:17:d2:56:72:36:13:b4:6c:75:b7:bf:d1:35:d1:
+ 31:d5:9a:07:c1:62:4e:aa:3d:bd:d8:40:8b:48:9a:
+ c5:46:c4:c3:10:2c:d4:82:d9:6d:f4:c3:de:85:fa:
+ 34:1d:d1:74:7a:5f:16:34:59:2b:2b:03:61:46:62:
+ d7:88:62:59:4d:d8:55:00:52:54:e1:15:5e:a9:ec:
+ d6:e8:51:fd:ef:8e:68:5f:d2:40:d2:61:ef:2c:1d:
+ 5b:a7:6e:14:4c:12:bc:60:81:8e:66:c9:84:51:c2:
+ 89:51:fc:e5:7f:86:9a:78:a4:c1:f7:0f:a9:a5:97:
+ 60:dd:6f:c8:a0:fd:ea:07:2f:01:36:0a:e8:bd:0e:
+ dc:48:2e:85:22:7b:bb:db:68:78:eb:cd:6a:54:07:
+ f7:81:a5:52:8f:f3:5c:09:1e:76:a3:d1:91:8f:ee:
+ 86:2c:85:49:99:96:4f:5f:5b:0d:08:ae:d8:20:e8:
+ e3:67:70:c6:ec:0e:0e:bd:bf:3c:f6:db:e4:45:d5:
+ 7a:bb:9f:d1:3b:18:89:fc:63:ac:c2:30:b8:fa:bb:
+ 8a:24:63:4e:79:58:78:72:ab:27:36:3d:bb:4f:47:
+ d6:ef
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Subject Key Identifier:
+ D6:9D:66:D6:49:7C:FA:20:8D:5D:75:69:2A:41:0A:7A:03:5A:A5:EB
+ X509v3 Authority Key Identifier:
+ keyid:16:AA:D6:8E:1B:2D:43:F3:2D:B0:24:AD:36:65:3F:B2:FA:B1:2C:ED
+
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ X509v3 Key Usage: critical
+ Digital Signature, Certificate Sign, CRL Sign
+ Signature Algorithm: sha256WithRSAEncryption
+ 83:3c:ae:b2:fc:99:3d:33:b3:da:ca:26:83:8c:a9:ae:f8:bb:
+ ad:05:37:97:a5:f8:0d:2b:4e:3e:e5:b7:12:68:f8:64:d4:bd:
+ ff:65:7d:57:98:61:cd:47:10:a5:6a:bd:66:89:74:ce:5e:28:
+ 29:39:67:c9:1f:54:ec:78:76:b1:dd:04:91:63:b6:8c:2f:86:
+ 59:1f:c4:2b:a1:4a:8c:a8:5b:f6:8a:92:f0:83:bb:92:92:5c:
+ b1:1c:18:95:3d:d6:be:6d:79:9d:4f:7b:92:1f:68:f5:1f:cd:
+ f4:37:2d:1e:e3:f6:eb:f2:8a:a4:8d:a1:c5:db:0c:3a:59:01:
+ dc:be:a9:c1:0b:04:ba:e8:02:a9:85:cd:d7:48:0d:f6:60:30:
+ 2b:05:ba:e0:c7:d8:9f:23:14:37:04:0a:a7:bc:b6:c8:25:31:
+ e4:9a:41:a5:83:c2:ee:89:d3:fa:a5:7c:ae:a6:14:22:a4:5f:
+ 73:03:f2:7b:3c:51:f7:76:2a:0a:cf:ee:71:35:1c:bc:ff:3f:
+ 9b:d5:b1:33:e0:b6:fc:2a:c8:ab:84:89:cd:fa:1c:ee:12:8c:
+ 07:ba:93:46:50:b3:3f:73:05:be:67:58:60:90:05:2c:d3:b6:
+ 19:7c:a4:f0:6e:ee:d4:f2:0e:f5:02:79:5f:2c:28:83:1e:83:
+ c6:92:ba:7c
diff --git a/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestSub.pub.pem b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestSub.pub.pem
new file mode 100644
index 000000000..04402ea98
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Pkcs7Sign/TestSub.pub.pem
@@ -0,0 +1,23 @@
+-----BEGIN CERTIFICATE-----
+MIID1jCCAr6gAwIBAgICEAIwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAkNO
+MQswCQYDVQQIDAJTSDELMAkGA1UEBwwCU0gxEjAQBgNVBAoMCVRpYW5vQ29yZTEO
+MAwGA1UECwwFRURLSUkxETAPBgNVBAMMCFRlc3RSb290MSIwIAYJKoZIhvcNAQkB
+FhNlZGtpaUB0aWFub2NvcmUub3JnMB4XDTE3MDQxMDA4MzM0NVoXDTE4MDQxMDA4
+MzM0NVowdDELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAlNIMRIwEAYDVQQKDAlUaWFu
+b0NvcmUxDjAMBgNVBAsMBUVES0lJMRAwDgYDVQQDDAdUZXN0U3ViMSIwIAYJKoZI
+hvcNAQkBFhNlZGtpaUB0aWFub2NvcmUub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOC
+AQ8AMIIBCgKCAQEAxTqvFjSaFGF0jDkaBB97ldNAt+omp3uNdtOGG3wHF9JWcjYT
+tGx1t7/RNdEx1ZoHwWJOqj292ECLSJrFRsTDECzUgtlt9MPehfo0HdF0el8WNFkr
+KwNhRmLXiGJZTdhVAFJU4RVeqezW6FH9745oX9JA0mHvLB1bp24UTBK8YIGOZsmE
+UcKJUfzlf4aaeKTB9w+ppZdg3W/IoP3qBy8BNgrovQ7cSC6FInu722h4681qVAf3
+gaVSj/NcCR52o9GRj+6GLIVJmZZPX1sNCK7YIOjjZ3DG7A4Ovb889tvkRdV6u5/R
+OxiJ/GOswjC4+ruKJGNOeVh4cqsnNj27T0fW7wIDAQABo2MwYTAdBgNVHQ4EFgQU
+1p1m1kl8+iCNXXVpKkEKegNapeswHwYDVR0jBBgwFoAUFqrWjhstQ/MtsCStNmU/
+svqxLO0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcN
+AQELBQADggEBAIM8rrL8mT0zs9rKJoOMqa74u60FN5el+A0rTj7ltxJo+GTUvf9l
+fVeYYc1HEKVqvWaJdM5eKCk5Z8kfVOx4drHdBJFjtowvhlkfxCuhSoyoW/aKkvCD
+u5KSXLEcGJU91r5teZ1Pe5IfaPUfzfQ3LR7j9uvyiqSNocXbDDpZAdy+qcELBLro
+AqmFzddIDfZgMCsFuuDH2J8jFDcECqe8tsglMeSaQaWDwu6J0/qlfK6mFCKkX3MD
+8ns8Ufd2KgrP7nE1HLz/P5vVsTPgtvwqyKuEic36HO4SjAe6k0ZQsz9zBb5nWGCQ
+BSzTthl8pPBu7tTyDvUCeV8sKIMeg8aSunw=
+-----END CERTIFICATE-----
diff --git a/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py b/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
new file mode 100644
index 000000000..6c9b8c464
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
@@ -0,0 +1,170 @@
+## @file
+# This tool can be used to generate new RSA 2048 bit private/public key pairs
+# in a PEM file format using OpenSSL command line utilities that are installed
+# on the path specified by the system environment variable OPENSSL_PATH.
+# This tool can also optionally write one or more SHA 256 hashes of 2048 bit
+# public keys to a binary file, write one or more SHA 256 hashes of 2048 bit
+# public keys to a file in a C structure format, and in verbose mode display
+# one or more SHA 256 hashes of 2048 bit public keys in a C structure format
+# on STDOUT.
+# This tool has been tested with OpenSSL 1.0.1e 11 Feb 2013
+#
+# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Rsa2048Sha256GenerateKeys
+'''
+from __future__ import print_function
+
+import os
+import sys
+import argparse
+import subprocess
+from Common.BuildVersion import gBUILD_VERSION
+
+#
+# Globals for help information
+#
+__prog__ = 'Rsa2048Sha256GenerateKeys'
+__version__ = '%s Version %s' % (__prog__, '0.9 ' + gBUILD_VERSION)
+__copyright__ = 'Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.'
+__usage__ = '%s [options]' % (__prog__)
+
+
+if __name__ == '__main__':
+ #
+ # Create command line argument parser object
+ #
+ parser = argparse.ArgumentParser(prog=__prog__, usage=__usage__, description=__copyright__, conflict_handler='resolve')
+ group = parser.add_mutually_exclusive_group(required=True)
+ group.add_argument("--version", action='version', version=__version__)
+ group.add_argument("-o", "--output", dest='OutputFile', type=argparse.FileType('wb'), metavar='filename', nargs='*', help="specify the output private key filename in PEM format")
+ group.add_argument("-i", "--input", dest='InputFile', type=argparse.FileType('rb'), metavar='filename', nargs='*', help="specify the input private key filename in PEM format")
+ parser.add_argument("--public-key-hash", dest='PublicKeyHashFile', type=argparse.FileType('wb'), help="specify the public key hash filename that is SHA 256 hash of 2048 bit RSA public key in binary format")
+ parser.add_argument("--public-key-hash-c", dest='PublicKeyHashCFile', type=argparse.FileType('wb'), help="specify the public key hash filename that is SHA 256 hash of 2048 bit RSA public key in C structure format")
+ parser.add_argument("-v", "--verbose", dest='Verbose', action="store_true", help="increase output messages")
+ parser.add_argument("-q", "--quiet", dest='Quiet', action="store_true", help="reduce output messages")
+ parser.add_argument("--debug", dest='Debug', type=int, metavar='[0-9]', choices=range(0, 10), default=0, help="set debug level")
+
+ #
+ # Parse command line arguments
+ #
+ args = parser.parse_args()
+
+ #
+ # Generate file path to Open SSL command
+ #
+ OpenSslCommand = 'openssl'
+ try:
+ OpenSslPath = os.environ['OPENSSL_PATH']
+ OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand)
+ if ' ' in OpenSslCommand:
+ OpenSslCommand = '"' + OpenSslCommand + '"'
+ except:
+ pass
+
+ #
+ # Verify that Open SSL command is available
+ #
+ try:
+ Process = subprocess.Popen('%s version' % (OpenSslCommand), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ except:
+ print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
+ sys.exit(1)
+
+ Version = Process.communicate()
+ if Process.returncode != 0:
+ print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
+ sys.exit(Process.returncode)
+ print(Version[0].decode())
+
+ args.PemFileName = []
+
+ #
+ # Check for output file argument
+ #
+ if args.OutputFile is not None:
+ for Item in args.OutputFile:
+ #
+ # Save PEM filename and close output file
+ #
+ args.PemFileName.append(Item.name)
+ Item.close()
+
+ #
+ # Generate private key and save it to output file in a PEM file format
+ #
+ Process = subprocess.Popen('%s genrsa -out %s 2048' % (OpenSslCommand, Item.name), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ Process.communicate()
+ if Process.returncode != 0:
+ print('ERROR: RSA 2048 key generation failed')
+ sys.exit(Process.returncode)
+
+ #
+ # Check for input file argument
+ #
+ if args.InputFile is not None:
+ for Item in args.InputFile:
+ #
+ # Save PEM filename and close input file
+ #
+ args.PemFileName.append(Item.name)
+ Item.close()
+
+ PublicKeyHash = bytearray()
+ for Item in args.PemFileName:
+ #
+ # Extract public key from private key into STDOUT
+ #
+ Process = subprocess.Popen('%s rsa -in %s -modulus -noout' % (OpenSslCommand, Item), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ PublicKeyHexString = Process.communicate()[0].decode().split(b'=')[1].strip()
+ if Process.returncode != 0:
+ print('ERROR: Unable to extract public key from private key')
+ sys.exit(Process.returncode)
+ PublicKey = bytearray()
+ for Index in range (0, len(PublicKeyHexString), 2):
+ PublicKey = PublicKey + PublicKeyHexString[Index:Index + 2]
+
+ #
+ # Generate SHA 256 hash of RSA 2048 bit public key into STDOUT
+ #
+ Process = subprocess.Popen('%s dgst -sha256 -binary' % (OpenSslCommand), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ Process.stdin.write (PublicKey)
+ PublicKeyHash = PublicKeyHash + Process.communicate()[0].decode()
+ if Process.returncode != 0:
+ print('ERROR: Unable to extract SHA 256 hash of public key')
+ sys.exit(Process.returncode)
+
+ #
+ # Write SHA 256 hash of 2048 bit binary public key to public key hash file
+ #
+ try:
+ args.PublicKeyHashFile.write (PublicKeyHash)
+ args.PublicKeyHashFile.close ()
+ except:
+ pass
+
+ #
+ # Convert public key hash to a C structure string
+ #
+ PublicKeyHashC = '{'
+ for Item in PublicKeyHash:
+ PublicKeyHashC = PublicKeyHashC + '0x%02x, ' % (Item)
+ PublicKeyHashC = PublicKeyHashC[:-2] + '}'
+
+ #
+ # Write SHA 256 of 2048 bit binary public key to public key hash C structure file
+ #
+ try:
+ args.PublicKeyHashCFile.write (bytes(PublicKeyHashC))
+ args.PublicKeyHashCFile.close ()
+ except:
+ pass
+
+ #
+ # If verbose is enabled display the public key in C structure format
+ #
+ if args.Verbose:
+ print('PublicKeySha256 = ' + PublicKeyHashC)
diff --git a/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py b/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
new file mode 100644
index 000000000..df0582628
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
@@ -0,0 +1,235 @@
+## @file
+# This tool encodes and decodes GUIDed FFS sections or FMP capsule for a GUID type of
+# EFI_CERT_TYPE_RSA2048_SHA256_GUID defined in the UEFI 2.4 Specification as
+# {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf}}
+# This tool has been tested with OpenSSL 1.0.1e 11 Feb 2013
+#
+# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Rsa2048Sha256Sign
+'''
+from __future__ import print_function
+
+import os
+import sys
+import argparse
+import subprocess
+import uuid
+import struct
+import collections
+from Common.BuildVersion import gBUILD_VERSION
+
+#
+# Globals for help information
+#
+__prog__ = 'Rsa2048Sha256Sign'
+__version__ = '%s Version %s' % (__prog__, '0.9 ' + gBUILD_VERSION)
+__copyright__ = 'Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.'
+__usage__ = '%s -e|-d [options] <input_file>' % (__prog__)
+
+#
+# GUID for SHA 256 Hash Algorithm from UEFI Specification
+#
+EFI_HASH_ALGORITHM_SHA256_GUID = uuid.UUID('{51aa59de-fdf2-4ea3-bc63-875fb7842ee9}')
+
+#
+# Structure definition to unpack EFI_CERT_BLOCK_RSA_2048_SHA256 from UEFI 2.4 Specification
+#
+# typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
+# EFI_GUID HashType;
+# UINT8 PublicKey[256];
+# UINT8 Signature[256];
+# } EFI_CERT_BLOCK_RSA_2048_SHA256;
+#
+EFI_CERT_BLOCK_RSA_2048_SHA256 = collections.namedtuple('EFI_CERT_BLOCK_RSA_2048_SHA256', ['HashType', 'PublicKey', 'Signature'])
+EFI_CERT_BLOCK_RSA_2048_SHA256_STRUCT = struct.Struct('16s256s256s')
+
+#
+# Filename of test signing private key that is stored in same directory as this tool
+#
+TEST_SIGNING_PRIVATE_KEY_FILENAME = 'TestSigningPrivateKey.pem'
+
+if __name__ == '__main__':
+ #
+ # Create command line argument parser object
+ #
+ parser = argparse.ArgumentParser(prog=__prog__, usage=__usage__, description=__copyright__, conflict_handler='resolve')
+ group = parser.add_mutually_exclusive_group(required=True)
+ group.add_argument("-e", action="store_true", dest='Encode', help='encode file')
+ group.add_argument("-d", action="store_true", dest='Decode', help='decode file')
+ group.add_argument("--version", action='version', version=__version__)
+ parser.add_argument("-o", "--output", dest='OutputFile', type=str, metavar='filename', help="specify the output filename", required=True)
+ parser.add_argument("--monotonic-count", dest='MonotonicCountStr', type=str, help="specify the MonotonicCount in FMP capsule.")
+ parser.add_argument("--private-key", dest='PrivateKeyFile', type=argparse.FileType('rb'), help="specify the private key filename. If not specified, a test signing key is used.")
+ parser.add_argument("-v", "--verbose", dest='Verbose', action="store_true", help="increase output messages")
+ parser.add_argument("-q", "--quiet", dest='Quiet', action="store_true", help="reduce output messages")
+ parser.add_argument("--debug", dest='Debug', type=int, metavar='[0-9]', choices=range(0, 10), default=0, help="set debug level")
+ parser.add_argument(metavar="input_file", dest='InputFile', type=argparse.FileType('rb'), help="specify the input filename")
+
+ #
+ # Parse command line arguments
+ #
+ args = parser.parse_args()
+
+ #
+ # Generate file path to Open SSL command
+ #
+ OpenSslCommand = 'openssl'
+ try:
+ OpenSslPath = os.environ['OPENSSL_PATH']
+ OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand)
+ if ' ' in OpenSslCommand:
+ OpenSslCommand = '"' + OpenSslCommand + '"'
+ except:
+ pass
+
+ #
+ # Verify that Open SSL command is available
+ #
+ try:
+ Process = subprocess.Popen('%s version' % (OpenSslCommand), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ except:
+ print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
+ sys.exit(1)
+
+ Version = Process.communicate()
+ if Process.returncode != 0:
+ print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
+ sys.exit(Process.returncode)
+ print(Version[0].decode('utf-8'))
+
+ #
+ # Read input file into a buffer and save input filename
+ #
+ args.InputFileName = args.InputFile.name
+ args.InputFileBuffer = args.InputFile.read()
+ args.InputFile.close()
+
+ #
+ # Save output filename and check if path exists
+ #
+ OutputDir = os.path.dirname(args.OutputFile)
+ if not os.path.exists(OutputDir):
+ print('ERROR: The output path does not exist: %s' % OutputDir)
+ sys.exit(1)
+ args.OutputFileName = args.OutputFile
+
+ #
+ # Save private key filename and close private key file
+ #
+ try:
+ args.PrivateKeyFileName = args.PrivateKeyFile.name
+ args.PrivateKeyFile.close()
+ except:
+ try:
+ #
+ # Get path to currently executing script or executable
+ #
+ if hasattr(sys, 'frozen'):
+ RsaToolPath = sys.executable
+ else:
+ RsaToolPath = sys.argv[0]
+ if RsaToolPath.startswith('"'):
+ RsaToolPath = RsaToolPath[1:]
+ if RsaToolPath.endswith('"'):
+ RsaToolPath = RsaToolPath[:-1]
+ args.PrivateKeyFileName = os.path.join(os.path.dirname(os.path.realpath(RsaToolPath)), TEST_SIGNING_PRIVATE_KEY_FILENAME)
+ args.PrivateKeyFile = open(args.PrivateKeyFileName, 'rb')
+ args.PrivateKeyFile.close()
+ except:
+ print('ERROR: test signing private key file %s missing' % (args.PrivateKeyFileName))
+ sys.exit(1)
+
+ #
+ # Extract public key from private key into STDOUT
+ #
+ Process = subprocess.Popen('%s rsa -in "%s" -modulus -noout' % (OpenSslCommand, args.PrivateKeyFileName), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ PublicKeyHexString = Process.communicate()[0].split(b'=')[1].strip()
+ PublicKeyHexString = PublicKeyHexString.decode('utf-8')
+ PublicKey = ''
+ while len(PublicKeyHexString) > 0:
+ PublicKey = PublicKey + PublicKeyHexString[0:2]
+ PublicKeyHexString=PublicKeyHexString[2:]
+ if Process.returncode != 0:
+ sys.exit(Process.returncode)
+
+ if args.MonotonicCountStr:
+ try:
+ if args.MonotonicCountStr.upper().startswith('0X'):
+ args.MonotonicCountValue = int(args.MonotonicCountStr, 16)
+ else:
+ args.MonotonicCountValue = int(args.MonotonicCountStr)
+ except:
+ pass
+
+ if args.Encode:
+ FullInputFileBuffer = args.InputFileBuffer
+ if args.MonotonicCountStr:
+ format = "%dsQ" % len(args.InputFileBuffer)
+ FullInputFileBuffer = struct.pack(format, args.InputFileBuffer, args.MonotonicCountValue)
+ #
+ # Sign the input file using the specified private key and capture signature from STDOUT
+ #
+ Process = subprocess.Popen('%s dgst -sha256 -sign "%s"' % (OpenSslCommand, args.PrivateKeyFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ Signature = Process.communicate(input=FullInputFileBuffer)[0]
+ if Process.returncode != 0:
+ sys.exit(Process.returncode)
+
+ #
+ # Write output file that contains hash GUID, Public Key, Signature, and Input data
+ #
+ args.OutputFile = open(args.OutputFileName, 'wb')
+ args.OutputFile.write(EFI_HASH_ALGORITHM_SHA256_GUID.bytes_le)
+ args.OutputFile.write(bytearray.fromhex(str(PublicKey)))
+ args.OutputFile.write(Signature)
+ args.OutputFile.write(args.InputFileBuffer)
+ args.OutputFile.close()
+
+ if args.Decode:
+ #
+ # Parse Hash Type, Public Key, and Signature from the section header
+ #
+ Header = EFI_CERT_BLOCK_RSA_2048_SHA256._make(EFI_CERT_BLOCK_RSA_2048_SHA256_STRUCT.unpack_from(args.InputFileBuffer))
+ args.InputFileBuffer = args.InputFileBuffer[EFI_CERT_BLOCK_RSA_2048_SHA256_STRUCT.size:]
+
+ #
+ # Verify that the Hash Type matches the expected SHA256 type
+ #
+ if uuid.UUID(bytes_le = Header.HashType) != EFI_HASH_ALGORITHM_SHA256_GUID:
+ print('ERROR: unsupport hash GUID')
+ sys.exit(1)
+
+ #
+ # Verify the public key
+ #
+ if Header.PublicKey != bytearray.fromhex(PublicKey):
+ print('ERROR: Public key in input file does not match public key from private key file')
+ sys.exit(1)
+
+ FullInputFileBuffer = args.InputFileBuffer
+ if args.MonotonicCountStr:
+ format = "%dsQ" % len(args.InputFileBuffer)
+ FullInputFileBuffer = struct.pack(format, args.InputFileBuffer, args.MonotonicCountValue)
+
+ #
+ # Write Signature to output file
+ #
+ open(args.OutputFileName, 'wb').write(Header.Signature)
+
+ #
+ # Verify signature
+ #
+ Process = subprocess.Popen('%s dgst -sha256 -prverify "%s" -signature %s' % (OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ Process.communicate(input=FullInputFileBuffer)
+ if Process.returncode != 0:
+ print('ERROR: Verification failed')
+ os.remove (args.OutputFileName)
+ sys.exit(Process.returncode)
+
+ #
+ # Save output file contents from input file
+ #
+ open(args.OutputFileName, 'wb').write(args.InputFileBuffer)
diff --git a/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigningPrivateKey.pem b/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigningPrivateKey.pem
new file mode 100644
index 000000000..ced488879
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigningPrivateKey.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEAudErrthutWCNdQy+XWCiKg89B9BPb9GaOtEBL0tIOGCkmAY3
+/aT13OCxR1f4FIGavKT+7aDZDnwyK3g1U/J2q4DdPHzSRoOOK5h9dqRabqEtlgaE
+2OQeLvs20hKARzQEHSj9aaUKPfN/uF7DYENs1N38QqSo//R1FZ4jJ1th5z+4RoIE
+/M3+yaSxGvOi+0FUEW57stqLGMTY8WFZeUOmCuRMGKC+5o57/H2OJa+Nh9rcO+8e
+Nc7/mR5ZB3lbkzq/3Wf9wZcQkCZaIA2uKSEM81I/3SGvu8P9+jfPDJ027dQOdjop
+M+0CA+Id5+XPoUFOy1aWKnM6Keq8BWsqA2f/awIDAQABAoIBAQCElZVfupqz3GLS
+w/cI1ayf6iOX8bDcjmhH013PCx5K69pFhxpoZ03u/nw/9arTpu5r8CbeE0kNJtz9
+W1Zhwb2e/eHeCQpYugG1ZacQApFsIqFOTPR5dbt7tlAVcJILPDg7PkYjHVnDfn0B
+ZsxtYW7ELGiUfL0BdMIeXKmkqXWf9AU37Frky3i1GwmyNy15RWj9T/JS8Wg6G3vq
+ZCqk7nOjMap8vFw0w6Z0FodapEiYxvfLsq/CQxZm5B2IeYPiIXuTif69Fw0Yhm5x
++GBOrrOZjFJuhFWngJg8lkh77P++CfmkX+V9WUHBPYyU6R9WPnpyC9T2sfyrTBG0
+yVc1mGTxAoGBAOtc3EaV7tVqzAQupTI4lyD1+eOfYIzPGbPVYkEQg81ru+O4SuNw
+n8P31L0O1F+YnlhHsDW2B2CsEAi1dFgfj5uUni4Ug42tNZLQKYHy6x436HYj2BRC
+fvju4gUDj2rJaKMo4bb1shpyIZce5APg0kO4Pfp8B29+qaNjJJSm/xdfAoGBAMoc
+KzKIQN+uHnXdRMCTnKStiyxJ5RRlhkeDEgrhjirL3d5GCsNxd1AJUYBEkgs7K6aX
+4HbuJxIypTNQJwqMe4ltGQazOxG4JKv7JB0bchXMBfzGUA4tTbyQ45APFvPhtWG9
+3xwIyJy602dWQzF7nrNkQo81HHgd8RBlQDjY5E91AoGBAJW12KvRfT0llKZoYU4j
+rwYZUJ2YaFrI9WltpvUKIzyMddRxCrnHjuihgSHNCAvS0Y4H868GnYTBjeVsPpg7
+Yyasjz1ycQeykKxVWsG9Gg97spNLU4v3jDqeAQj9bcGYYcW/IGw3ttWZmYI99P3+
+iODolgv5zuT95bv3OXKRExvzAoGAQeJ04oAwRbqJC3saEn0ML1Kzb7iXCNMftugv
+VYS5x5G1veOvVo8CigC/pMS1pxue2yvfbGWuLux7lgKm93VcQCxkYB7FPr18luPD
+ngl4Y0qjGQe8ySJTmQjSZf/FR7NoYXh35remThFJIQKp3NOjpG8mk3CI209HakTX
+brClnJECgYA+Qw69eMTrIIBH2Kw0mazgG9lCoCRA5GF8/qwgH0yxyP0yy/gtxXMs
+nMqwo7X3yIIf5Aracc5MbXfaJgR5fOpCrtu3NJGdHC63JblB//7hXiklGNKDaCiV
+EBkLJ3YHYn8fAr8n+agE0PSfXFVnC1ToPRWUbBcGrgE16bpzn8o9gw==
+-----END RSA PRIVATE KEY-----
diff --git a/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigningPublicKey.bin b/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigningPublicKey.bin
new file mode 100644
index 000000000..8c15a0003
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigningPublicKey.bin
@@ -0,0 +1 @@
+‘)ĽêmÚ³ªoPüÛK~<ÖܤzÝæŒs–¢Ô¦M \ No newline at end of file
diff --git a/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigningPublicKey.txt b/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigningPublicKey.txt
new file mode 100644
index 000000000..7d9716278
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Rsa2048Sha256Sign/TestSigningPublicKey.txt
@@ -0,0 +1 @@
+{0x91, 0x29, 0xc4, 0xbd, 0xea, 0x6d, 0xda, 0xb3, 0xaa, 0x6f, 0x50, 0x16, 0xfc, 0xdb, 0x4b, 0x7e, 0x3c, 0xd6, 0xdc, 0xa4, 0x7a, 0x0e, 0xdd, 0xe6, 0x15, 0x8c, 0x73, 0x96, 0xa2, 0xd4, 0xa6, 0x4d}
diff --git a/roms/edk2/BaseTools/Source/Python/Table/Table.py b/roms/edk2/BaseTools/Source/Python/Table/Table.py
new file mode 100644
index 000000000..7a60313e9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/Table.py
@@ -0,0 +1,114 @@
+## @file
+# This file is used to create/update/query/erase a common table
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+import Common.EdkLogger as EdkLogger
+
+## TableFile
+#
+# This class defined a common table
+#
+# @param object: Inherited from object class
+#
+# @param Cursor: Cursor of the database
+# @param TableName: Name of the table
+#
+class Table(object):
+ def __init__(self, Cursor):
+ self.Cur = Cursor
+ self.Table = ''
+ self.ID = 0
+
+ ## Create table
+ #
+ # Create a table
+ #
+ def Create(self, SqlCommand):
+ self.Cur.execute(SqlCommand)
+ self.ID = 0
+ EdkLogger.verbose(SqlCommand + " ... DONE!")
+
+ ## Insert table
+ #
+ # Insert a record into a table
+ #
+ def Insert(self, SqlCommand):
+ self.Exec(SqlCommand)
+
+ ## Query table
+ #
+ # Query all records of the table
+ #
+ def Query(self):
+ EdkLogger.verbose("\nQuery table %s started ..." % self.Table)
+ SqlCommand = """select * from %s""" % self.Table
+ self.Cur.execute(SqlCommand)
+ for Rs in self.Cur:
+ EdkLogger.verbose(str(Rs))
+
+ TotalCount = self.GetCount()
+ EdkLogger.verbose("*** Total %s records in table %s ***" % (TotalCount, self.Table) )
+ EdkLogger.verbose("Query tabel %s DONE!" % self.Table)
+
+ ## Drop a table
+ #
+ # Drop the table
+ #
+ def Drop(self):
+ SqlCommand = """drop table IF EXISTS %s""" % self.Table
+ self.Cur.execute(SqlCommand)
+ EdkLogger.verbose("Drop tabel %s ... DONE!" % self.Table)
+
+ ## Get count
+ #
+ # Get a count of all records of the table
+ #
+ # @retval Count: Total count of all records
+ #
+ def GetCount(self):
+ SqlCommand = """select count(ID) from %s""" % self.Table
+ self.Cur.execute(SqlCommand)
+ for Item in self.Cur:
+ return Item[0]
+
+ ## Generate ID
+ #
+ # Generate an ID if input ID is -1
+ #
+ # @param ID: Input ID
+ #
+ # @retval ID: New generated ID
+ #
+ def GenerateID(self, ID):
+ if ID == -1:
+ self.ID = self.ID + 1
+
+ return self.ID
+
+ ## Init the ID of the table
+ #
+ # Init the ID of the table
+ #
+ def InitID(self):
+ self.ID = self.GetCount()
+
+ ## Exec
+ #
+ # Exec Sql Command, return result
+ #
+ # @param SqlCommand: The SqlCommand to be executed
+ #
+ # @retval RecordSet: The result after executed
+ #
+ def Exec(self, SqlCommand):
+ EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
+ self.Cur.execute(SqlCommand)
+ RecordSet = self.Cur.fetchall()
+ EdkLogger.debug(4, "RecordSet: %s" % RecordSet)
+ return RecordSet
diff --git a/roms/edk2/BaseTools/Source/Python/Table/TableDataModel.py b/roms/edk2/BaseTools/Source/Python/Table/TableDataModel.py
new file mode 100644
index 000000000..385580745
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/TableDataModel.py
@@ -0,0 +1,90 @@
+## @file
+# This file is used to create/update/query/erase table for data models
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.EdkLogger as EdkLogger
+import CommonDataClass.DataClass as DataClass
+from Table.Table import Table
+from Common.StringUtils import ConvertToSqlString
+
+## TableDataModel
+#
+# This class defined a table used for data model
+#
+# @param object: Inherited from object class
+#
+#
+class TableDataModel(Table):
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor)
+ self.Table = 'DataModel'
+
+ ## Create table
+ #
+ # Create table DataModel
+ #
+ # @param ID: ID of a ModelType
+ # @param CrossIndex: CrossIndex of a ModelType
+ # @param Name: Name of a ModelType
+ # @param Description: Description of a ModelType
+ #
+ def Create(self):
+ SqlCommand = """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
+ CrossIndex INTEGER NOT NULL,
+ Name VARCHAR NOT NULL,
+ Description VARCHAR
+ )""" % self.Table
+ Table.Create(self, SqlCommand)
+
+ ## Insert table
+ #
+ # Insert a record into table DataModel
+ #
+ # @param ID: ID of a ModelType
+ # @param CrossIndex: CrossIndex of a ModelType
+ # @param Name: Name of a ModelType
+ # @param Description: Description of a ModelType
+ #
+ def Insert(self, CrossIndex, Name, Description):
+ self.ID = self.ID + 1
+ (Name, Description) = ConvertToSqlString((Name, Description))
+ SqlCommand = """insert into %s values(%s, %s, '%s', '%s')""" % (self.Table, self.ID, CrossIndex, Name, Description)
+ Table.Insert(self, SqlCommand)
+
+ return self.ID
+
+ ## Init table
+ #
+ # Create all default records of table DataModel
+ #
+ def InitTable(self):
+ EdkLogger.verbose("\nInitialize table DataModel started ...")
+ for Item in DataClass.MODEL_LIST:
+ CrossIndex = Item[1]
+ Name = Item[0]
+ Description = Item[0]
+ self.Insert(CrossIndex, Name, Description)
+ EdkLogger.verbose("Initialize table DataModel ... DONE!")
+
+ ## Get CrossIndex
+ #
+ # Get a model's cross index from its name
+ #
+ # @param ModelName: Name of the model
+ # @retval CrossIndex: CrossIndex of the model
+ #
+ def GetCrossIndex(self, ModelName):
+ CrossIndex = -1
+ SqlCommand = """select CrossIndex from DataModel where name = '""" + ModelName + """'"""
+ self.Cur.execute(SqlCommand)
+ for Item in self.Cur:
+ CrossIndex = Item[0]
+
+ return CrossIndex
diff --git a/roms/edk2/BaseTools/Source/Python/Table/TableDec.py b/roms/edk2/BaseTools/Source/Python/Table/TableDec.py
new file mode 100644
index 000000000..04aa7aaad
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/TableDec.py
@@ -0,0 +1,103 @@
+## @file
+# This file is used to create/update/query/erase table for dec datas
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.EdkLogger as EdkLogger
+import CommonDataClass.DataClass as DataClass
+from Table.Table import Table
+from Common.StringUtils import ConvertToSqlString
+
+## TableDec
+#
+# This class defined a table used for data model
+#
+# @param object: Inherited from object class
+#
+#
+class TableDec(Table):
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor)
+ self.Table = 'Dec'
+
+ ## Create table
+ #
+ # Create table Dec
+ #
+ # @param ID: ID of a Dec item
+ # @param Model: Model of a Dec item
+ # @param Value1: Value1 of a Dec item
+ # @param Value2: Value2 of a Dec item
+ # @param Value3: Value3 of a Dec item
+ # @param Arch: Arch of a Dec item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param BelongsToFile: The item belongs to which dsc file
+ # @param StartLine: StartLine of a Dec item
+ # @param StartColumn: StartColumn of a Dec item
+ # @param EndLine: EndLine of a Dec item
+ # @param EndColumn: EndColumn of a Dec item
+ # @param Enabled: If this item enabled
+ #
+ def Create(self):
+ SqlCommand = """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
+ Model INTEGER NOT NULL,
+ Value1 VARCHAR NOT NULL,
+ Value2 VARCHAR,
+ Value3 VARCHAR,
+ Arch VarCHAR,
+ BelongsToItem SINGLE NOT NULL,
+ BelongsToFile SINGLE NOT NULL,
+ StartLine INTEGER NOT NULL,
+ StartColumn INTEGER NOT NULL,
+ EndLine INTEGER NOT NULL,
+ EndColumn INTEGER NOT NULL,
+ Enabled INTEGER DEFAULT 0
+ )""" % self.Table
+ Table.Create(self, SqlCommand)
+
+ ## Insert table
+ #
+ # Insert a record into table Dec
+ #
+ # @param ID: ID of a Dec item
+ # @param Model: Model of a Dec item
+ # @param Value1: Value1 of a Dec item
+ # @param Value2: Value2 of a Dec item
+ # @param Value3: Value3 of a Dec item
+ # @param Arch: Arch of a Dec item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param BelongsToFile: The item belongs to which dsc file
+ # @param StartLine: StartLine of a Dec item
+ # @param StartColumn: StartColumn of a Dec item
+ # @param EndLine: EndLine of a Dec item
+ # @param EndColumn: EndColumn of a Dec item
+ # @param Enabled: If this item enabled
+ #
+ def Insert(self, Model, Value1, Value2, Value3, Value4, Value5, Arch, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled):
+ self.ID = self.ID + 1
+ (Value1, Value2, Value3, Arch) = ConvertToSqlString((Value1, Value2, Value3, Arch))
+ SqlCommand = """insert into %s values(%s, %s, '%s', '%s', '%s', '%s', %s, %s, %s, %s, %s, %s, %s)""" \
+ % (self.Table, self.ID, Model, Value1, Value2, Value3, Arch, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled)
+ Table.Insert(self, SqlCommand)
+
+ return self.ID
+
+ ## Query table
+ #
+ # @param Model: The Model of Record
+ #
+ # @retval: A recordSet of all found records
+ #
+ def Query(self, Model):
+ SqlCommand = """select ID, Value1, Value2, Value3, Arch, BelongsToItem, BelongsToFile, StartLine from %s
+ where Model = %s
+ and Enabled > -1""" % (self.Table, Model)
+ EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
+ self.Cur.execute(SqlCommand)
+ return self.Cur.fetchall()
diff --git a/roms/edk2/BaseTools/Source/Python/Table/TableDsc.py b/roms/edk2/BaseTools/Source/Python/Table/TableDsc.py
new file mode 100644
index 000000000..deda001ca
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/TableDsc.py
@@ -0,0 +1,103 @@
+from __future__ import absolute_import
+## @file
+# This file is used to create/update/query/erase table for dsc datas
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+import Common.EdkLogger as EdkLogger
+import CommonDataClass.DataClass as DataClass
+from Table.Table import Table
+from Common.StringUtils import ConvertToSqlString
+
+## TableDsc
+#
+# This class defined a table used for data model
+#
+# @param object: Inherited from object class
+#
+#
+class TableDsc(Table):
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor)
+ self.Table = 'Dsc'
+
+ ## Create table
+ #
+ # Create table Dsc
+ #
+ # @param ID: ID of a Dsc item
+ # @param Model: Model of a Dsc item
+ # @param Value1: Value1 of a Dsc item
+ # @param Value2: Value2 of a Dsc item
+ # @param Value3: Value3 of a Dsc item
+ # @param Arch: Arch of a Dsc item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param BelongsToFile: The item belongs to which dsc file
+ # @param StartLine: StartLine of a Dsc item
+ # @param StartColumn: StartColumn of a Dsc item
+ # @param EndLine: EndLine of a Dsc item
+ # @param EndColumn: EndColumn of a Dsc item
+ # @param Enabled: If this item enabled
+ #
+ def Create(self):
+ SqlCommand = """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
+ Model INTEGER NOT NULL,
+ Value1 VARCHAR NOT NULL,
+ Value2 VARCHAR,
+ Value3 VARCHAR,
+ Arch VarCHAR,
+ BelongsToItem SINGLE NOT NULL,
+ BelongsToFile SINGLE NOT NULL,
+ StartLine INTEGER NOT NULL,
+ StartColumn INTEGER NOT NULL,
+ EndLine INTEGER NOT NULL,
+ EndColumn INTEGER NOT NULL,
+ Enabled INTEGER DEFAULT 0
+ )""" % self.Table
+ Table.Create(self, SqlCommand)
+
+ ## Insert table
+ #
+ # Insert a record into table Dsc
+ #
+ # @param ID: ID of a Dsc item
+ # @param Model: Model of a Dsc item
+ # @param Value1: Value1 of a Dsc item
+ # @param Value2: Value2 of a Dsc item
+ # @param Value3: Value3 of a Dsc item
+ # @param Arch: Arch of a Dsc item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param BelongsToFile: The item belongs to which dsc file
+ # @param StartLine: StartLine of a Dsc item
+ # @param StartColumn: StartColumn of a Dsc item
+ # @param EndLine: EndLine of a Dsc item
+ # @param EndColumn: EndColumn of a Dsc item
+ # @param Enabled: If this item enabled
+ #
+ def Insert(self, Model, Value1, Value2, Value3, Arch, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled):
+ self.ID = self.ID + 1
+ (Value1, Value2, Value3, Arch) = ConvertToSqlString((Value1, Value2, Value3, Arch))
+ SqlCommand = """insert into %s values(%s, %s, '%s', '%s', '%s', '%s', %s, %s, %s, %s, %s, %s, %s)""" \
+ % (self.Table, self.ID, Model, Value1, Value2, Value3, Arch, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled)
+ Table.Insert(self, SqlCommand)
+
+ return self.ID
+
+ ## Query table
+ #
+ # @param Model: The Model of Record
+ #
+ # @retval: A recordSet of all found records
+ #
+ def Query(self, Model):
+ SqlCommand = """select ID, Value1, Value2, Value3, Arch, BelongsToItem, BelongsToFile, StartLine from %s
+ where Model = %s
+ and Enabled > -1""" % (self.Table, Model)
+ EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
+ self.Cur.execute(SqlCommand)
+ return self.Cur.fetchall()
diff --git a/roms/edk2/BaseTools/Source/Python/Table/TableEotReport.py b/roms/edk2/BaseTools/Source/Python/Table/TableEotReport.py
new file mode 100644
index 000000000..72bc11f6d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/TableEotReport.py
@@ -0,0 +1,71 @@
+## @file
+# This file is used to create/update/query/erase table for ECC reports
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.EdkLogger as EdkLogger
+import Common.LongFilePathOs as os, time
+from Table.Table import Table
+from Common.StringUtils import ConvertToSqlString2
+import Eot.EotToolError as EotToolError
+import Eot.EotGlobalData as EotGlobalData
+
+## TableReport
+#
+# This class defined a table used for data model
+#
+# @param object: Inherited from object class
+#
+#
+class TableEotReport(Table):
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor)
+ self.Table = 'Report'
+
+ ## Create table
+ #
+ # Create table report
+ #
+ #
+ def Create(self):
+ SqlCommand = """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
+ ModuleID INTEGER DEFAULT -1,
+ ModuleName TEXT DEFAULT '',
+ ModuleGuid TEXT DEFAULT '',
+ SourceFileID INTEGER DEFAULT -1,
+ SourceFileFullPath TEXT DEFAULT '',
+ ItemName TEXT DEFAULT '',
+ ItemType TEXT DEFAULT '',
+ ItemMode TEXT DEFAULT '',
+ GuidName TEXT DEFAULT '',
+ GuidMacro TEXT DEFAULT '',
+ GuidValue TEXT DEFAULT '',
+ BelongsToFunction TEXT DEFAULT '',
+ Enabled INTEGER DEFAULT 0
+ )""" % self.Table
+ Table.Create(self, SqlCommand)
+
+ ## Insert table
+ #
+ # Insert a record into table report
+ #
+ #
+ def Insert(self, ModuleID = -1, ModuleName = '', ModuleGuid = '', SourceFileID = -1, SourceFileFullPath = '', \
+ ItemName = '', ItemType = '', ItemMode = '', GuidName = '', GuidMacro = '', GuidValue = '', BelongsToFunction = '', Enabled = 0):
+ self.ID = self.ID + 1
+ SqlCommand = """insert into %s values(%s, %s, '%s', '%s', %s, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %s)""" \
+ % (self.Table, self.ID, ModuleID, ModuleName, ModuleGuid, SourceFileID, SourceFileFullPath, \
+ ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue, BelongsToFunction, Enabled)
+ Table.Insert(self, SqlCommand)
+
+ def GetMaxID(self):
+ SqlCommand = """select max(ID) from %s""" % self.Table
+ self.Cur.execute(SqlCommand)
+ for Item in self.Cur:
+ return Item[0]
diff --git a/roms/edk2/BaseTools/Source/Python/Table/TableFdf.py b/roms/edk2/BaseTools/Source/Python/Table/TableFdf.py
new file mode 100644
index 000000000..964ddd7a6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/TableFdf.py
@@ -0,0 +1,104 @@
+## @file
+# This file is used to create/update/query/erase table for fdf datas
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.EdkLogger as EdkLogger
+import CommonDataClass.DataClass as DataClass
+from Table.Table import Table
+from Common.StringUtils import ConvertToSqlString
+
+## TableFdf
+#
+# This class defined a table used for data model
+#
+# @param object: Inherited from object class
+#
+#
+class TableFdf(Table):
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor)
+ self.Table = 'Fdf'
+
+ ## Create table
+ #
+ # Create table Fdf
+ #
+ # @param ID: ID of a Fdf item
+ # @param Model: Model of a Fdf item
+ # @param Value1: Value1 of a Fdf item
+ # @param Value2: Value2 of a Fdf item
+ # @param Value3: Value3 of a Fdf item
+ # @param Arch: Arch of a Fdf item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param BelongsToFile: The item belongs to which fdf file
+ # @param StartLine: StartLine of a Fdf item
+ # @param StartColumn: StartColumn of a Fdf item
+ # @param EndLine: EndLine of a Fdf item
+ # @param EndColumn: EndColumn of a Fdf item
+ # @param Enabled: If this item enabled
+ #
+ def Create(self):
+ SqlCommand = """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
+ Model INTEGER NOT NULL,
+ Value1 VARCHAR NOT NULL,
+ Value2 VARCHAR,
+ Value3 VARCHAR,
+ Scope1 VarCHAR,
+ Scope2 VarCHAR,
+ BelongsToItem SINGLE NOT NULL,
+ BelongsToFile SINGLE NOT NULL,
+ StartLine INTEGER NOT NULL,
+ StartColumn INTEGER NOT NULL,
+ EndLine INTEGER NOT NULL,
+ EndColumn INTEGER NOT NULL,
+ Enabled INTEGER DEFAULT 0
+ )""" % self.Table
+ Table.Create(self, SqlCommand)
+
+ ## Insert table
+ #
+ # Insert a record into table Fdf
+ #
+ # @param ID: ID of a Fdf item
+ # @param Model: Model of a Fdf item
+ # @param Value1: Value1 of a Fdf item
+ # @param Value2: Value2 of a Fdf item
+ # @param Value3: Value3 of a Fdf item
+ # @param Arch: Arch of a Fdf item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param BelongsToFile: The item belongs to which fdf file
+ # @param StartLine: StartLine of a Fdf item
+ # @param StartColumn: StartColumn of a Fdf item
+ # @param EndLine: EndLine of a Fdf item
+ # @param EndColumn: EndColumn of a Fdf item
+ # @param Enabled: If this item enabled
+ #
+ def Insert(self, Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled):
+ self.ID = self.ID + 1
+ (Value1, Value2, Value3, Scope1, Scope2) = ConvertToSqlString((Value1, Value2, Value3, Scope1, Scope2))
+ SqlCommand = """insert into %s values(%s, %s, '%s', '%s', '%s', '%s', '%s', %s, %s, %s, %s, %s, %s, %s)""" \
+ % (self.Table, self.ID, Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled)
+ Table.Insert(self, SqlCommand)
+
+ return self.ID
+
+ ## Query table
+ #
+ # @param Model: The Model of Record
+ #
+ # @retval: A recordSet of all found records
+ #
+ def Query(self, Model):
+ SqlCommand = """select ID, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine from %s
+ where Model = %s
+ and Enabled > -1""" % (self.Table, Model)
+ EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
+ self.Cur.execute(SqlCommand)
+ return self.Cur.fetchall()
diff --git a/roms/edk2/BaseTools/Source/Python/Table/TableFile.py b/roms/edk2/BaseTools/Source/Python/Table/TableFile.py
new file mode 100644
index 000000000..c54c38987
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/TableFile.py
@@ -0,0 +1,99 @@
+## @file
+# This file is used to create/update/query/erase table for files
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.EdkLogger as EdkLogger
+from Table.Table import Table
+from Common.StringUtils import ConvertToSqlString
+import Common.LongFilePathOs as os
+from CommonDataClass.DataClass import FileClass
+
+## TableFile
+#
+# This class defined a table used for file
+#
+# @param object: Inherited from object class
+#
+class TableFile(Table):
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor)
+ self.Table = 'File'
+
+ ## Create table
+ #
+ # Create table File
+ #
+ # @param ID: ID of a File
+ # @param Name: Name of a File
+ # @param ExtName: ExtName of a File
+ # @param Path: Path of a File
+ # @param FullPath: FullPath of a File
+ # @param Model: Model of a File
+ # @param TimeStamp: TimeStamp of a File
+ #
+ def Create(self):
+ SqlCommand = """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
+ Name VARCHAR NOT NULL,
+ ExtName VARCHAR,
+ Path VARCHAR,
+ FullPath VARCHAR NOT NULL,
+ Model INTEGER DEFAULT 0,
+ TimeStamp VARCHAR NOT NULL
+ )""" % self.Table
+ Table.Create(self, SqlCommand)
+
+ ## Insert table
+ #
+ # Insert a record into table File
+ #
+ # @param ID: ID of a File
+ # @param Name: Name of a File
+ # @param ExtName: ExtName of a File
+ # @param Path: Path of a File
+ # @param FullPath: FullPath of a File
+ # @param Model: Model of a File
+ # @param TimeStamp: TimeStamp of a File
+ #
+ def Insert(self, Name, ExtName, Path, FullPath, Model, TimeStamp):
+ self.ID = self.ID + 1
+ (Name, ExtName, Path, FullPath) = ConvertToSqlString((Name, ExtName, Path, FullPath))
+ SqlCommand = """insert into %s values(%s, '%s', '%s', '%s', '%s', %s, '%s')""" \
+ % (self.Table, self.ID, Name, ExtName, Path, FullPath, Model, TimeStamp)
+ Table.Insert(self, SqlCommand)
+
+ return self.ID
+ ## InsertFile
+ #
+ # Insert one file to table
+ #
+ # @param FileFullPath: The full path of the file
+ # @param Model: The model of the file
+ #
+ # @retval FileID: The ID after record is inserted
+ #
+ def InsertFile(self, FileFullPath, Model):
+ (Filepath, Name) = os.path.split(FileFullPath)
+ (Root, Ext) = os.path.splitext(FileFullPath)
+ TimeStamp = os.stat(FileFullPath)[8]
+ File = FileClass(-1, Name, Ext, Filepath, FileFullPath, Model, '', [], [], [])
+ return self.Insert(File.Name, File.ExtName, File.Path, File.FullPath, File.Model, TimeStamp)
+
+ ## Get ID of a given file
+ #
+ # @param FilePath Path of file
+ #
+ # @retval ID ID value of given file in the table
+ #
+ def GetFileId(self, File):
+ QueryScript = "select ID from %s where FullPath = '%s'" % (self.Table, str(File))
+ RecordList = self.Exec(QueryScript)
+ if len(RecordList) == 0:
+ return None
+ return RecordList[0][0]
diff --git a/roms/edk2/BaseTools/Source/Python/Table/TableFunction.py b/roms/edk2/BaseTools/Source/Python/Table/TableFunction.py
new file mode 100644
index 000000000..69d240b9a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/TableFunction.py
@@ -0,0 +1,90 @@
+## @file
+# This file is used to create/update/query/erase table for functions
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.EdkLogger as EdkLogger
+from Table.Table import Table
+from Common.StringUtils import ConvertToSqlString
+
+## TableFunction
+#
+# This class defined a table used for function
+#
+# @param Table: Inherited from Table class
+#
+class TableFunction(Table):
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor)
+ self.Table = 'Function'
+
+ ## Create table
+ #
+ # Create table Function
+ #
+ # @param ID: ID of a Function
+ # @param Header: Header of a Function
+ # @param Modifier: Modifier of a Function
+ # @param Name: Name of a Function
+ # @param ReturnStatement: ReturnStatement of a Function
+ # @param StartLine: StartLine of a Function
+ # @param StartColumn: StartColumn of a Function
+ # @param EndLine: EndLine of a Function
+ # @param EndColumn: EndColumn of a Function
+ # @param BodyStartLine: StartLine of a Function body
+ # @param BodyStartColumn: StartColumn of a Function body
+ # @param BelongsToFile: The Function belongs to which file
+ # @param FunNameStartLine: StartLine of a Function name
+ # @param FunNameStartColumn: StartColumn of a Function name
+ #
+ def Create(self):
+ SqlCommand = """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
+ Header TEXT,
+ Modifier VARCHAR,
+ Name VARCHAR NOT NULL,
+ ReturnStatement VARCHAR,
+ StartLine INTEGER NOT NULL,
+ StartColumn INTEGER NOT NULL,
+ EndLine INTEGER NOT NULL,
+ EndColumn INTEGER NOT NULL,
+ BodyStartLine INTEGER NOT NULL,
+ BodyStartColumn INTEGER NOT NULL,
+ BelongsToFile SINGLE NOT NULL,
+ FunNameStartLine INTEGER NOT NULL,
+ FunNameStartColumn INTEGER NOT NULL
+ )""" % self.Table
+ Table.Create(self, SqlCommand)
+
+ ## Insert table
+ #
+ # Insert a record into table Function
+ #
+ # @param ID: ID of a Function
+ # @param Header: Header of a Function
+ # @param Modifier: Modifier of a Function
+ # @param Name: Name of a Function
+ # @param ReturnStatement: ReturnStatement of a Function
+ # @param StartLine: StartLine of a Function
+ # @param StartColumn: StartColumn of a Function
+ # @param EndLine: EndLine of a Function
+ # @param EndColumn: EndColumn of a Function
+ # @param BodyStartLine: StartLine of a Function body
+ # @param BodyStartColumn: StartColumn of a Function body
+ # @param BelongsToFile: The Function belongs to which file
+ # @param FunNameStartLine: StartLine of a Function name
+ # @param FunNameStartColumn: StartColumn of a Function name
+ #
+ def Insert(self, Header, Modifier, Name, ReturnStatement, StartLine, StartColumn, EndLine, EndColumn, BodyStartLine, BodyStartColumn, BelongsToFile, FunNameStartLine, FunNameStartColumn):
+ self.ID = self.ID + 1
+ (Header, Modifier, Name, ReturnStatement) = ConvertToSqlString((Header, Modifier, Name, ReturnStatement))
+ SqlCommand = """insert into %s values(%s, '%s', '%s', '%s', '%s', %s, %s, %s, %s, %s, %s, %s, %s, %s)""" \
+ % (self.Table, self.ID, Header, Modifier, Name, ReturnStatement, StartLine, StartColumn, EndLine, EndColumn, BodyStartLine, BodyStartColumn, BelongsToFile, FunNameStartLine, FunNameStartColumn)
+ Table.Insert(self, SqlCommand)
+
+ return self.ID
diff --git a/roms/edk2/BaseTools/Source/Python/Table/TableIdentifier.py b/roms/edk2/BaseTools/Source/Python/Table/TableIdentifier.py
new file mode 100644
index 000000000..99f5023e9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/TableIdentifier.py
@@ -0,0 +1,85 @@
+## @file
+# This file is used to create/update/query/erase table for Identifiers
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.EdkLogger as EdkLogger
+from Common.StringUtils import ConvertToSqlString
+from Table.Table import Table
+
+## TableIdentifier
+#
+# This class defined a table used for Identifier
+#
+# @param object: Inherited from object class
+#
+#
+class TableIdentifier(Table):
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor)
+ self.Table = 'Identifier'
+
+ ## Create table
+ #
+ # Create table Identifier
+ #
+ # @param ID: ID of a Identifier
+ # @param Modifier: Modifier of a Identifier
+ # @param Type: Type of a Identifier
+ # @param Name: Name of a Identifier
+ # @param Value: Value of a Identifier
+ # @param Model: Model of a Identifier
+ # @param BelongsToFile: The Identifier belongs to which file
+ # @param BelongsToFunction: The Identifier belongs to which function
+ # @param StartLine: StartLine of a Identifier
+ # @param StartColumn: StartColumn of a Identifier
+ # @param EndLine: EndLine of a Identifier
+ # @param EndColumn: EndColumn of a Identifier
+ #
+ def Create(self):
+ SqlCommand = """create table IF NOT EXISTS %s(ID INTEGER PRIMARY KEY,
+ Modifier VARCHAR,
+ Type VARCHAR,
+ Name VARCHAR NOT NULL,
+ Value VARCHAR NOT NULL,
+ Model INTEGER NOT NULL,
+ BelongsToFile SINGLE NOT NULL,
+ BelongsToFunction SINGLE DEFAULT -1,
+ StartLine INTEGER NOT NULL,
+ StartColumn INTEGER NOT NULL,
+ EndLine INTEGER NOT NULL,
+ EndColumn INTEGER NOT NULL
+ )""" % self.Table
+ Table.Create(self, SqlCommand)
+
+ ## Insert table
+ #
+ # Insert a record into table Identifier
+ #
+ # @param ID: ID of a Identifier
+ # @param Modifier: Modifier of a Identifier
+ # @param Type: Type of a Identifier
+ # @param Name: Name of a Identifier
+ # @param Value: Value of a Identifier
+ # @param Model: Model of a Identifier
+ # @param BelongsToFile: The Identifier belongs to which file
+ # @param BelongsToFunction: The Identifier belongs to which function
+ # @param StartLine: StartLine of a Identifier
+ # @param StartColumn: StartColumn of a Identifier
+ # @param EndLine: EndLine of a Identifier
+ # @param EndColumn: EndColumn of a Identifier
+ #
+ def Insert(self, Modifier, Type, Name, Value, Model, BelongsToFile, BelongsToFunction, StartLine, StartColumn, EndLine, EndColumn):
+ self.ID = self.ID + 1
+ (Modifier, Type, Name, Value) = ConvertToSqlString((Modifier, Type, Name, Value))
+ SqlCommand = """insert into %s values(%s, '%s', '%s', '%s', '%s', %s, %s, %s, %s, %s, %s, %s)""" \
+ % (self.Table, self.ID, Modifier, Type, Name, Value, Model, BelongsToFile, BelongsToFunction, StartLine, StartColumn, EndLine, EndColumn)
+ Table.Insert(self, SqlCommand)
+
+ return self.ID
diff --git a/roms/edk2/BaseTools/Source/Python/Table/TableInf.py b/roms/edk2/BaseTools/Source/Python/Table/TableInf.py
new file mode 100644
index 000000000..54af88c37
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/TableInf.py
@@ -0,0 +1,109 @@
+## @file
+# This file is used to create/update/query/erase table for inf datas
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.EdkLogger as EdkLogger
+import CommonDataClass.DataClass as DataClass
+from Table.Table import Table
+from Common.StringUtils import ConvertToSqlString
+
+## TableInf
+#
+# This class defined a table used for data model
+#
+# @param object: Inherited from object class
+#
+#
+class TableInf(Table):
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor)
+ self.Table = 'Inf'
+
+ ## Create table
+ #
+ # Create table Inf
+ #
+ # @param ID: ID of a Inf item
+ # @param Model: Model of a Inf item
+ # @param Value1: Value1 of a Inf item
+ # @param Value2: Value2 of a Inf item
+ # @param Value3: Value3 of a Inf item
+ # @param Value4: Value4 of a Inf item
+ # @param Value5: Value5 of a Inf item
+ # @param Arch: Arch of a Inf item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param BelongsToFile: The item belongs to which dsc file
+ # @param StartLine: StartLine of a Inf item
+ # @param StartColumn: StartColumn of a Inf item
+ # @param EndLine: EndLine of a Inf item
+ # @param EndColumn: EndColumn of a Inf item
+ # @param Enabled: If this item enabled
+ #
+ def Create(self):
+ SqlCommand = """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
+ Model INTEGER NOT NULL,
+ Value1 VARCHAR NOT NULL,
+ Value2 VARCHAR,
+ Value3 VARCHAR,
+ Value4 VARCHAR,
+ Value5 VARCHAR,
+ Arch VarCHAR,
+ BelongsToItem SINGLE NOT NULL,
+ BelongsToFile SINGLE NOT NULL,
+ StartLine INTEGER NOT NULL,
+ StartColumn INTEGER NOT NULL,
+ EndLine INTEGER NOT NULL,
+ EndColumn INTEGER NOT NULL,
+ Enabled INTEGER DEFAULT 0
+ )""" % self.Table
+ Table.Create(self, SqlCommand)
+
+ ## Insert table
+ #
+ # Insert a record into table Inf
+ #
+ # @param ID: ID of a Inf item
+ # @param Model: Model of a Inf item
+ # @param Value1: Value1 of a Inf item
+ # @param Value2: Value2 of a Inf item
+ # @param Value3: Value3 of a Inf item
+ # @param Value4: Value4 of a Inf item
+ # @param Value5: Value5 of a Inf item
+ # @param Arch: Arch of a Inf item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param BelongsToFile: The item belongs to which dsc file
+ # @param StartLine: StartLine of a Inf item
+ # @param StartColumn: StartColumn of a Inf item
+ # @param EndLine: EndLine of a Inf item
+ # @param EndColumn: EndColumn of a Inf item
+ # @param Enabled: If this item enabled
+ #
+ def Insert(self, Model, Value1, Value2, Value3, Value4, Value5, Arch, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled):
+ self.ID = self.ID + 1
+ (Value1, Value2, Value3, Value4, Value5, Arch) = ConvertToSqlString((Value1, Value2, Value3, Value4, Value5, Arch))
+ SqlCommand = """insert into %s values(%s, %s, '%s', '%s', '%s', '%s', '%s', '%s', %s, %s, %s, %s, %s, %s, %s)""" \
+ % (self.Table, self.ID, Model, Value1, Value2, Value3, Value4, Value5, Arch, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled)
+ Table.Insert(self, SqlCommand)
+
+ return self.ID
+
+ ## Query table
+ #
+ # @param Model: The Model of Record
+ #
+ # @retval: A recordSet of all found records
+ #
+ def Query(self, Model):
+ SqlCommand = """select ID, Value1, Value2, Value3, Arch, BelongsToItem, BelongsToFile, StartLine from %s
+ where Model = %s
+ and Enabled > -1""" % (self.Table, Model)
+ EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
+ self.Cur.execute(SqlCommand)
+ return self.Cur.fetchall()
diff --git a/roms/edk2/BaseTools/Source/Python/Table/TablePcd.py b/roms/edk2/BaseTools/Source/Python/Table/TablePcd.py
new file mode 100644
index 000000000..f1e9f5781
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/TablePcd.py
@@ -0,0 +1,85 @@
+## @file
+# This file is used to create/update/query/erase table for pcds
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.EdkLogger as EdkLogger
+from Table.Table import Table
+from Common.StringUtils import ConvertToSqlString
+
+## TablePcd
+#
+# This class defined a table used for pcds
+#
+# @param object: Inherited from object class
+#
+#
+class TablePcd(Table):
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor)
+ self.Table = 'Pcd'
+
+ ## Create table
+ #
+ # Create table Pcd
+ #
+ # @param ID: ID of a Pcd
+ # @param CName: CName of a Pcd
+ # @param TokenSpaceGuidCName: TokenSpaceGuidCName of a Pcd
+ # @param Token: Token of a Pcd
+ # @param DatumType: DatumType of a Pcd
+ # @param Model: Model of a Pcd
+ # @param BelongsToFile: The Pcd belongs to which file
+ # @param BelongsToFunction: The Pcd belongs to which function
+ # @param StartLine: StartLine of a Pcd
+ # @param StartColumn: StartColumn of a Pcd
+ # @param EndLine: EndLine of a Pcd
+ # @param EndColumn: EndColumn of a Pcd
+ #
+ def Create(self):
+ SqlCommand = """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
+ CName VARCHAR NOT NULL,
+ TokenSpaceGuidCName VARCHAR NOT NULL,
+ Token INTEGER,
+ DatumType VARCHAR,
+ Model INTEGER NOT NULL,
+ BelongsToFile SINGLE NOT NULL,
+ BelongsToFunction SINGLE DEFAULT -1,
+ StartLine INTEGER NOT NULL,
+ StartColumn INTEGER NOT NULL,
+ EndLine INTEGER NOT NULL,
+ EndColumn INTEGER NOT NULL
+ )""" % self.Table
+ Table.Create(self, SqlCommand)
+
+ ## Insert table
+ #
+ # Insert a record into table Pcd
+ #
+ # @param ID: ID of a Pcd
+ # @param CName: CName of a Pcd
+ # @param TokenSpaceGuidCName: TokenSpaceGuidCName of a Pcd
+ # @param Token: Token of a Pcd
+ # @param DatumType: DatumType of a Pcd
+ # @param Model: Model of a Pcd
+ # @param BelongsToFile: The Pcd belongs to which file
+ # @param BelongsToFunction: The Pcd belongs to which function
+ # @param StartLine: StartLine of a Pcd
+ # @param StartColumn: StartColumn of a Pcd
+ # @param EndLine: EndLine of a Pcd
+ # @param EndColumn: EndColumn of a Pcd
+ #
+ def Insert(self, CName, TokenSpaceGuidCName, Token, DatumType, Model, BelongsToFile, BelongsToFunction, StartLine, StartColumn, EndLine, EndColumn):
+ self.ID = self.ID + 1
+ (CName, TokenSpaceGuidCName, DatumType) = ConvertToSqlString((CName, TokenSpaceGuidCName, DatumType))
+ SqlCommand = """insert into %s values(%s, '%s', '%s', %s, '%s', %s, %s, %s, %s, %s, %s, %s)""" \
+ % (self.Table, self.ID, CName, TokenSpaceGuidCName, Token, DatumType, Model, BelongsToFile, BelongsToFunction, StartLine, StartColumn, EndLine, EndColumn)
+ Table.Insert(self, SqlCommand)
+
+ return self.ID
diff --git a/roms/edk2/BaseTools/Source/Python/Table/TableQuery.py b/roms/edk2/BaseTools/Source/Python/Table/TableQuery.py
new file mode 100644
index 000000000..3e66fbfc9
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/TableQuery.py
@@ -0,0 +1,63 @@
+## @file
+# This file is used to create/update/query/erase table for Queries
+#
+# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.EdkLogger as EdkLogger
+from Common.StringUtils import ConvertToSqlString
+from Table.Table import Table
+
+## TableQuery
+#
+# This class defined a table used for Query
+#
+# @param object: Inherited from object class
+#
+#
+class TableQuery(Table):
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor)
+ self.Table = 'Query'
+
+ ## Create table
+ #
+ # Create table Query
+ #
+ # @param ID: ID of a Query
+ # @param Name: Name of a Query
+ # @param Modifier: Modifier of a Query
+ # @param Value: Type of a Query
+ # @param Model: Model of a Query
+ #
+ def Create(self):
+ SqlCommand = """create table IF NOT EXISTS %s(ID INTEGER PRIMARY KEY,
+ Name TEXT DEFAULT '',
+ Modifier TEXT DEFAULT '',
+ Value TEXT DEFAULT '',
+ Model INTEGER DEFAULT 0
+ )""" % self.Table
+ Table.Create(self, SqlCommand)
+
+ ## Insert table
+ #
+ # Insert a record into table Query
+ #
+ # @param ID: ID of a Query
+ # @param Name: Name of a Query
+ # @param Modifier: Modifier of a Query
+ # @param Value: Value of a Query
+ # @param Model: Model of a Query
+ #
+ def Insert(self, Name, Modifier, Value, Model):
+ self.ID = self.ID + 1
+ SqlCommand = """insert into %s values(%s, '%s', '%s', '%s', %s)""" \
+ % (self.Table, self.ID, Name, Modifier, Value, Model)
+ Table.Insert(self, SqlCommand)
+
+ return self.ID
diff --git a/roms/edk2/BaseTools/Source/Python/Table/TableReport.py b/roms/edk2/BaseTools/Source/Python/Table/TableReport.py
new file mode 100644
index 000000000..0a77787d8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/TableReport.py
@@ -0,0 +1,127 @@
+## @file
+# This file is used to create/update/query/erase table for ECC reports
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import Common.EdkLogger as EdkLogger
+import Common.LongFilePathOs as os, time
+from Table.Table import Table
+from Common.StringUtils import ConvertToSqlString2
+import Ecc.EccToolError as EccToolError
+import Ecc.EccGlobalData as EccGlobalData
+from Common.LongFilePathSupport import OpenLongFilePath as open
+
+## TableReport
+#
+# This class defined a table used for data model
+#
+# @param object: Inherited from object class
+#
+#
+class TableReport(Table):
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor)
+ self.Table = 'Report'
+
+ ## Create table
+ #
+ # Create table report
+ #
+ # @param ID: ID of an Error
+ # @param ErrorID: ID of an Error TypeModel of a Report item
+ # @param OtherMsg: Other error message besides the standard error message
+ # @param BelongsToItem: The error belongs to which item
+ # @param Enabled: If this error enabled
+ # @param Corrected: if this error corrected
+ #
+ def Create(self):
+ SqlCommand = """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
+ ErrorID INTEGER NOT NULL,
+ OtherMsg TEXT,
+ BelongsToTable TEXT NOT NULL,
+ BelongsToItem SINGLE NOT NULL,
+ Enabled INTEGER DEFAULT 0,
+ Corrected INTEGER DEFAULT -1
+ )""" % self.Table
+ Table.Create(self, SqlCommand)
+
+ ## Insert table
+ #
+ # Insert a record into table report
+ #
+ # @param ID: ID of an Error
+ # @param ErrorID: ID of an Error TypeModel of a report item
+ # @param OtherMsg: Other error message besides the standard error message
+ # @param BelongsToTable: The error item belongs to which table
+ # @param BelongsToItem: The error belongs to which item
+ # @param Enabled: If this error enabled
+ # @param Corrected: if this error corrected
+ #
+ def Insert(self, ErrorID, OtherMsg='', BelongsToTable='', BelongsToItem= -1, Enabled=0, Corrected= -1):
+ self.ID = self.ID + 1
+ SqlCommand = """insert into %s values(%s, %s, '%s', '%s', %s, %s, %s)""" \
+ % (self.Table, self.ID, ErrorID, ConvertToSqlString2(OtherMsg), BelongsToTable, BelongsToItem, Enabled, Corrected)
+ Table.Insert(self, SqlCommand)
+
+ return self.ID
+
+ ## Query table
+ #
+ # @retval: A recordSet of all found records
+ #
+ def Query(self):
+ SqlCommand = """select ID, ErrorID, OtherMsg, BelongsToTable, BelongsToItem, Corrected from %s
+ where Enabled > -1 order by ErrorID, BelongsToItem""" % (self.Table)
+ return self.Exec(SqlCommand)
+
+ ## Update table
+ #
+ def UpdateBelongsToItemByFile(self, ItemID=-1, File=""):
+ SqlCommand = """update Report set BelongsToItem=%s where BelongsToTable='File' and BelongsToItem=-2
+ and OtherMsg like '%%%s%%'""" % (ItemID, File)
+ return self.Exec(SqlCommand)
+
+ ## Convert to CSV
+ #
+ # Get all enabled records from table report and save them to a .csv file
+ #
+ # @param Filename: To filename to save the report content
+ #
+ def ToCSV(self, Filename='Report.csv'):
+ try:
+ File = open(Filename, 'w+')
+ File.write("""No, Error Code, Error Message, File, LineNo, Other Error Message\n""")
+ RecordSet = self.Query()
+ Index = 0
+ for Record in RecordSet:
+ Index = Index + 1
+ ErrorID = Record[1]
+ OtherMsg = Record[2]
+ BelongsToTable = Record[3]
+ BelongsToItem = Record[4]
+ IsCorrected = Record[5]
+ SqlCommand = ''
+ if BelongsToTable == 'File':
+ SqlCommand = """select 1, FullPath from %s where ID = %s
+ """ % (BelongsToTable, BelongsToItem)
+ else:
+ SqlCommand = """select A.StartLine, B.FullPath from %s as A, File as B
+ where A.ID = %s and B.ID = A.BelongsToFile
+ """ % (BelongsToTable, BelongsToItem)
+ NewRecord = self.Exec(SqlCommand)
+ if NewRecord != []:
+ File.write("""%s,%s,"%s",%s,%s,"%s"\n""" % (Index, ErrorID, EccToolError.gEccErrorMessage[ErrorID], NewRecord[0][1], NewRecord[0][0], OtherMsg))
+ EdkLogger.quiet("%s(%s): [%s]%s %s" % (NewRecord[0][1], NewRecord[0][0], ErrorID, EccToolError.gEccErrorMessage[ErrorID], OtherMsg))
+
+ File.close()
+ except IOError:
+ NewFilename = 'Report_' + time.strftime("%Y%m%d_%H%M%S.csv", time.localtime())
+ EdkLogger.warn("ECC", "The report file %s is locked by other progress, use %s instead!" % (Filename, NewFilename))
+ self.ToCSV(NewFilename)
+
diff --git a/roms/edk2/BaseTools/Source/Python/Table/__init__.py b/roms/edk2/BaseTools/Source/Python/Table/__init__.py
new file mode 100644
index 000000000..e901914f3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Table/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'Table' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/TargetTool/TargetTool.py b/roms/edk2/BaseTools/Source/Python/TargetTool/TargetTool.py
new file mode 100644
index 000000000..8e0ca387c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/TargetTool/TargetTool.py
@@ -0,0 +1,254 @@
+## @file
+# Target Tool Parser
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import print_function
+import Common.LongFilePathOs as os
+import sys
+import traceback
+from optparse import OptionParser
+
+import Common.EdkLogger as EdkLogger
+import Common.BuildToolError as BuildToolError
+from Common.DataType import *
+from Common.BuildVersion import gBUILD_VERSION
+from Common.LongFilePathSupport import OpenLongFilePath as open
+
+# To Do 1.set clean, 2. add item, if the line is disabled.
+
+class TargetTool():
+ def __init__(self, opt, args):
+ self.WorkSpace = os.path.normpath(os.getenv('WORKSPACE'))
+ self.Opt = opt
+ self.Arg = args[0]
+ self.FileName = os.path.normpath(os.path.join(self.WorkSpace, 'Conf', 'target.txt'))
+ if os.path.isfile(self.FileName) == False:
+ print("%s does not exist." % self.FileName)
+ sys.exit(1)
+ self.TargetTxtDictionary = {
+ TAB_TAT_DEFINES_ACTIVE_PLATFORM : None,
+ TAB_TAT_DEFINES_TOOL_CHAIN_CONF : None,
+ TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER : None,
+ TAB_TAT_DEFINES_TARGET : None,
+ TAB_TAT_DEFINES_TOOL_CHAIN_TAG : None,
+ TAB_TAT_DEFINES_TARGET_ARCH : None,
+ TAB_TAT_DEFINES_BUILD_RULE_CONF : None,
+ }
+ self.LoadTargetTxtFile(self.FileName)
+
+ def LoadTargetTxtFile(self, filename):
+ if os.path.exists(filename) and os.path.isfile(filename):
+ return self.ConvertTextFileToDict(filename, '#', '=')
+ else:
+ raise ParseError('LoadTargetTxtFile() : No Target.txt file exists.')
+ return 1
+
+#
+# Convert a text file to a dictionary
+#
+ def ConvertTextFileToDict(self, FileName, CommentCharacter, KeySplitCharacter):
+ """Convert a text file to a dictionary of (name:value) pairs."""
+ try:
+ f = open(FileName, 'r')
+ for Line in f:
+ if Line.startswith(CommentCharacter) or Line.strip() == '':
+ continue
+ LineList = Line.split(KeySplitCharacter, 1)
+ if len(LineList) >= 2:
+ Key = LineList[0].strip()
+ if Key.startswith(CommentCharacter) == False and Key in self.TargetTxtDictionary:
+ if Key == TAB_TAT_DEFINES_ACTIVE_PLATFORM or Key == TAB_TAT_DEFINES_TOOL_CHAIN_CONF \
+ or Key == TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER \
+ or Key == TAB_TAT_DEFINES_ACTIVE_MODULE:
+ self.TargetTxtDictionary[Key] = LineList[1].replace('\\', '/').strip()
+ elif Key == TAB_TAT_DEFINES_TARGET or Key == TAB_TAT_DEFINES_TARGET_ARCH \
+ or Key == TAB_TAT_DEFINES_TOOL_CHAIN_TAG or Key == TAB_TAT_DEFINES_BUILD_RULE_CONF:
+ self.TargetTxtDictionary[Key] = LineList[1].split()
+ f.close()
+ return 0
+ except:
+ last_type, last_value, last_tb = sys.exc_info()
+ traceback.print_exception(last_type, last_value, last_tb)
+
+ def Print(self):
+ errMsg = ''
+ for Key in self.TargetTxtDictionary:
+ if isinstance(self.TargetTxtDictionary[Key], type([])):
+ print("%-30s = %s" % (Key, ''.join(elem + ' ' for elem in self.TargetTxtDictionary[Key])))
+ elif self.TargetTxtDictionary[Key] is None:
+ errMsg += " Missing %s configuration information, please use TargetTool to set value!" % Key + os.linesep
+ else:
+ print("%-30s = %s" % (Key, self.TargetTxtDictionary[Key]))
+
+ if errMsg != '':
+ print(os.linesep + 'Warning:' + os.linesep + errMsg)
+
+ def RWFile(self, CommentCharacter, KeySplitCharacter, Num):
+ try:
+ fr = open(self.FileName, 'r')
+ fw = open(os.path.normpath(os.path.join(self.WorkSpace, 'Conf\\targetnew.txt')), 'w')
+
+ existKeys = []
+ for Line in fr:
+ if Line.startswith(CommentCharacter) or Line.strip() == '':
+ fw.write(Line)
+ else:
+ LineList = Line.split(KeySplitCharacter, 1)
+ if len(LineList) >= 2:
+ Key = LineList[0].strip()
+ if Key.startswith(CommentCharacter) == False and Key in self.TargetTxtDictionary:
+ if Key not in existKeys:
+ existKeys.append(Key)
+ else:
+ print("Warning: Found duplicate key item in original configuration files!")
+
+ if Num == 0:
+ Line = "%-30s = \n" % Key
+ else:
+ ret = GetConfigureKeyValue(self, Key)
+ if ret is not None:
+ Line = ret
+ fw.write(Line)
+ for key in self.TargetTxtDictionary:
+ if key not in existKeys:
+ print("Warning: %s does not exist in original configuration file" % key)
+ Line = GetConfigureKeyValue(self, key)
+ if Line is None:
+ Line = "%-30s = " % key
+ fw.write(Line)
+
+ fr.close()
+ fw.close()
+ os.remove(self.FileName)
+ os.rename(os.path.normpath(os.path.join(self.WorkSpace, 'Conf\\targetnew.txt')), self.FileName)
+
+ except:
+ last_type, last_value, last_tb = sys.exc_info()
+ traceback.print_exception(last_type, last_value, last_tb)
+
+def GetConfigureKeyValue(self, Key):
+ Line = None
+ if Key == TAB_TAT_DEFINES_ACTIVE_PLATFORM and self.Opt.DSCFILE is not None:
+ dscFullPath = os.path.join(self.WorkSpace, self.Opt.DSCFILE)
+ if os.path.exists(dscFullPath):
+ Line = "%-30s = %s\n" % (Key, self.Opt.DSCFILE)
+ else:
+ EdkLogger.error("TargetTool", BuildToolError.FILE_NOT_FOUND,
+ "DSC file %s does not exist!" % self.Opt.DSCFILE, RaiseError=False)
+ elif Key == TAB_TAT_DEFINES_TOOL_CHAIN_CONF and self.Opt.TOOL_DEFINITION_FILE is not None:
+ tooldefFullPath = os.path.join(self.WorkSpace, self.Opt.TOOL_DEFINITION_FILE)
+ if os.path.exists(tooldefFullPath):
+ Line = "%-30s = %s\n" % (Key, self.Opt.TOOL_DEFINITION_FILE)
+ else:
+ EdkLogger.error("TargetTool", BuildToolError.FILE_NOT_FOUND,
+ "Tooldef file %s does not exist!" % self.Opt.TOOL_DEFINITION_FILE, RaiseError=False)
+
+ elif self.Opt.NUM >= 2:
+ Line = "%-30s = %s\n" % (Key, 'Enable')
+ elif self.Opt.NUM <= 1:
+ Line = "%-30s = %s\n" % (Key, 'Disable')
+ elif Key == TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER and self.Opt.NUM is not None:
+ Line = "%-30s = %s\n" % (Key, str(self.Opt.NUM))
+ elif Key == TAB_TAT_DEFINES_TARGET and self.Opt.TARGET is not None:
+ Line = "%-30s = %s\n" % (Key, ''.join(elem + ' ' for elem in self.Opt.TARGET))
+ elif Key == TAB_TAT_DEFINES_TARGET_ARCH and self.Opt.TARGET_ARCH is not None:
+ Line = "%-30s = %s\n" % (Key, ''.join(elem + ' ' for elem in self.Opt.TARGET_ARCH))
+ elif Key == TAB_TAT_DEFINES_TOOL_CHAIN_TAG and self.Opt.TOOL_CHAIN_TAG is not None:
+ Line = "%-30s = %s\n" % (Key, self.Opt.TOOL_CHAIN_TAG)
+ elif Key == TAB_TAT_DEFINES_BUILD_RULE_CONF and self.Opt.BUILD_RULE_FILE is not None:
+ buildruleFullPath = os.path.join(self.WorkSpace, self.Opt.BUILD_RULE_FILE)
+ if os.path.exists(buildruleFullPath):
+ Line = "%-30s = %s\n" % (Key, self.Opt.BUILD_RULE_FILE)
+ else:
+ EdkLogger.error("TagetTool", BuildToolError.FILE_NOT_FOUND,
+ "Build rule file %s does not exist!" % self.Opt.BUILD_RULE_FILE, RaiseError=False)
+ return Line
+
+VersionNumber = ("0.01" + " " + gBUILD_VERSION)
+__version__ = "%prog Version " + VersionNumber
+__copyright__ = "Copyright (c) 2007 - 2018, Intel Corporation All rights reserved."
+__usage__ = "%prog [options] {args} \
+\nArgs: \
+\n Clean clean the all default configuration of target.txt. \
+\n Print print the all default configuration of target.txt. \
+\n Set replace the default configuration with expected value specified by option."
+
+gParamCheck = []
+def SingleCheckCallback(option, opt_str, value, parser):
+ if option not in gParamCheck:
+ setattr(parser.values, option.dest, value)
+ gParamCheck.append(option)
+ else:
+ parser.error("Option %s only allows one instance in command line!" % option)
+
+def RangeCheckCallback(option, opt_str, value, parser):
+ if option not in gParamCheck:
+ gParamCheck.append(option)
+ if value < 1 or value > 8:
+ parser.error("The count of multi-thread is not in valid range of 1 ~ 8.")
+ else:
+ setattr(parser.values, option.dest, value)
+ else:
+ parser.error("Option %s only allows one instance in command line!" % option)
+
+def MyOptionParser():
+ parser = OptionParser(version=__version__, prog="TargetTool.exe", usage=__usage__, description=__copyright__)
+ parser.add_option("-a", "--arch", action="append", type="choice", choices=['IA32', 'X64', 'EBC', 'ARM', 'AARCH64', '0'], dest="TARGET_ARCH",
+ help="ARCHS is one of list: IA32, X64, ARM, AARCH64 or EBC, which replaces target.txt's TARGET_ARCH definition. To specify more archs, please repeat this option. 0 will clear this setting in target.txt and can't combine with other value.")
+ parser.add_option("-p", "--platform", action="callback", type="string", dest="DSCFILE", callback=SingleCheckCallback,
+ help="Specify a DSC file, which replace target.txt's ACTIVE_PLATFORM definition. 0 will clear this setting in target.txt and can't combine with other value.")
+ parser.add_option("-c", "--tooldef", action="callback", type="string", dest="TOOL_DEFINITION_FILE", callback=SingleCheckCallback,
+ help="Specify the WORKSPACE relative path of tool_def.txt file, which replace target.txt's TOOL_CHAIN_CONF definition. 0 will clear this setting in target.txt and can't combine with other value.")
+ parser.add_option("-t", "--target", action="append", type="choice", choices=['DEBUG', 'RELEASE', '0'], dest="TARGET",
+ help="TARGET is one of list: DEBUG, RELEASE, which replaces target.txt's TARGET definition. To specify more TARGET, please repeat this option. 0 will clear this setting in target.txt and can't combine with other value.")
+ parser.add_option("-n", "--tagname", action="callback", type="string", dest="TOOL_CHAIN_TAG", callback=SingleCheckCallback,
+ help="Specify the Tool Chain Tagname, which replaces target.txt's TOOL_CHAIN_TAG definition. 0 will clear this setting in target.txt and can't combine with other value.")
+ parser.add_option("-r", "--buildrule", action="callback", type="string", dest="BUILD_RULE_FILE", callback=SingleCheckCallback,
+ help="Specify the build rule configure file, which replaces target.txt's BUILD_RULE_CONF definition. If not specified, the default value Conf/build_rule.txt will be set.")
+ parser.add_option("-m", "--multithreadnum", action="callback", type="int", dest="NUM", callback=RangeCheckCallback,
+ help="Specify the multi-thread number which replace target.txt's MAX_CONCURRENT_THREAD_NUMBER. If the value is less than 2, MULTIPLE_THREAD will be disabled. If the value is larger than 1, MULTIPLE_THREAD will be enabled.")
+ (opt, args)=parser.parse_args()
+ return (opt, args)
+
+if __name__ == '__main__':
+ EdkLogger.Initialize()
+ EdkLogger.SetLevel(EdkLogger.QUIET)
+ if os.getenv('WORKSPACE') is None:
+ print("ERROR: WORKSPACE should be specified or edksetup script should be executed before run TargetTool")
+ sys.exit(1)
+
+ (opt, args) = MyOptionParser()
+ if len(args) != 1 or (args[0].lower() != 'print' and args[0].lower() != 'clean' and args[0].lower() != 'set'):
+ print("The number of args isn't 1 or the value of args is invalid.")
+ sys.exit(1)
+ if opt.NUM is not None and opt.NUM < 1:
+ print("The MAX_CONCURRENT_THREAD_NUMBER must be larger than 0.")
+ sys.exit(1)
+ if opt.TARGET is not None and len(opt.TARGET) > 1:
+ for elem in opt.TARGET:
+ if elem == '0':
+ print("0 will clear the TARGET setting in target.txt and can't combine with other value.")
+ sys.exit(1)
+ if opt.TARGET_ARCH is not None and len(opt.TARGET_ARCH) > 1:
+ for elem in opt.TARGET_ARCH:
+ if elem == '0':
+ print("0 will clear the TARGET_ARCH setting in target.txt and can't combine with other value.")
+ sys.exit(1)
+
+ try:
+ FileHandle = TargetTool(opt, args)
+ if FileHandle.Arg.lower() == 'print':
+ FileHandle.Print()
+ sys.exit(0)
+ elif FileHandle.Arg.lower() == 'clean':
+ FileHandle.RWFile('#', '=', 0)
+ else:
+ FileHandle.RWFile('#', '=', 1)
+ except Exception as e:
+ last_type, last_value, last_tb = sys.exc_info()
+ traceback.print_exception(last_type, last_value, last_tb)
+
diff --git a/roms/edk2/BaseTools/Source/Python/TargetTool/__init__.py b/roms/edk2/BaseTools/Source/Python/TargetTool/__init__.py
new file mode 100644
index 000000000..ae712b44a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/TargetTool/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'TargetTool' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/Trim/Trim.py b/roms/edk2/BaseTools/Source/Python/Trim/Trim.py
new file mode 100644
index 000000000..776474b20
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Trim/Trim.py
@@ -0,0 +1,628 @@
+## @file
+# Trim files preprocessed by compiler
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+import Common.LongFilePathOs as os
+import sys
+import re
+from io import BytesIO
+import codecs
+from optparse import OptionParser
+from optparse import make_option
+from Common.BuildToolError import *
+from Common.Misc import *
+from Common.DataType import *
+from Common.BuildVersion import gBUILD_VERSION
+import Common.EdkLogger as EdkLogger
+from Common.LongFilePathSupport import OpenLongFilePath as open
+
+# Version and Copyright
+__version_number__ = ("0.10" + " " + gBUILD_VERSION)
+__version__ = "%prog Version " + __version_number__
+__copyright__ = "Copyright (c) 2007-2018, Intel Corporation. All rights reserved."
+
+## Regular expression for matching Line Control directive like "#line xxx"
+gLineControlDirective = re.compile('^\s*#(?:line)?\s+([0-9]+)\s+"*([^"]*)"')
+## Regular expression for matching "typedef struct"
+gTypedefPattern = re.compile("^\s*typedef\s+struct(\s+\w+)?\s*[{]*$", re.MULTILINE)
+## Regular expression for matching "#pragma pack"
+gPragmaPattern = re.compile("^\s*#pragma\s+pack", re.MULTILINE)
+## Regular expression for matching "typedef"
+gTypedef_SinglePattern = re.compile("^\s*typedef", re.MULTILINE)
+## Regular expression for matching "typedef struct, typedef union, struct, union"
+gTypedef_MulPattern = re.compile("^\s*(typedef)?\s+(struct|union)(\s+\w+)?\s*[{]*$", re.MULTILINE)
+
+#
+# The following number pattern match will only match if following criteria is met:
+# There is leading non-(alphanumeric or _) character, and no following alphanumeric or _
+# as the pattern is greedily match, so it is ok for the gDecNumberPattern or gHexNumberPattern to grab the maximum match
+#
+## Regular expression for matching HEX number
+gHexNumberPattern = re.compile("(?<=[^a-zA-Z0-9_])(0[xX])([0-9a-fA-F]+)(U(?=$|[^a-zA-Z0-9_]))?")
+## Regular expression for matching decimal number with 'U' postfix
+gDecNumberPattern = re.compile("(?<=[^a-zA-Z0-9_])([0-9]+)U(?=$|[^a-zA-Z0-9_])")
+## Regular expression for matching constant with 'ULL' 'LL' postfix
+gLongNumberPattern = re.compile("(?<=[^a-zA-Z0-9_])(0[xX][0-9a-fA-F]+|[0-9]+)U?LL(?=$|[^a-zA-Z0-9_])")
+
+## Regular expression for matching "Include ()" in asl file
+gAslIncludePattern = re.compile("^(\s*)[iI]nclude\s*\(\"?([^\"\(\)]+)\"\)", re.MULTILINE)
+## Regular expression for matching C style #include "XXX.asl" in asl file
+gAslCIncludePattern = re.compile(r'^(\s*)#include\s*[<"]\s*([-\\/\w.]+)\s*([>"])', re.MULTILINE)
+## Patterns used to convert EDK conventions to EDK2 ECP conventions
+
+## Regular expression for finding header file inclusions
+gIncludePattern = re.compile(r"^[ \t]*[%]?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE | re.IGNORECASE)
+
+
+## file cache to avoid circular include in ASL file
+gIncludedAslFile = []
+
+## Trim preprocessed source code
+#
+# Remove extra content made by preprocessor. The preprocessor must enable the
+# line number generation option when preprocessing.
+#
+# @param Source File to be trimmed
+# @param Target File to store the trimmed content
+# @param Convert If True, convert standard HEX format to MASM format
+#
+def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong):
+ CreateDirectory(os.path.dirname(Target))
+ try:
+ with open(Source, "r") as File:
+ Lines = File.readlines()
+ except IOError:
+ EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source)
+ except:
+ EdkLogger.error("Trim", AUTOGEN_ERROR, "TrimPreprocessedFile: Error while processing file", File=Source)
+
+ PreprocessedFile = ""
+ InjectedFile = ""
+ LineIndexOfOriginalFile = None
+ NewLines = []
+ LineControlDirectiveFound = False
+ for Index in range(len(Lines)):
+ Line = Lines[Index]
+ #
+ # Find out the name of files injected by preprocessor from the lines
+ # with Line Control directive
+ #
+ MatchList = gLineControlDirective.findall(Line)
+ if MatchList != []:
+ MatchList = MatchList[0]
+ if len(MatchList) == 2:
+ LineNumber = int(MatchList[0], 0)
+ InjectedFile = MatchList[1]
+ InjectedFile = os.path.normpath(InjectedFile)
+ InjectedFile = os.path.normcase(InjectedFile)
+ # The first injected file must be the preprocessed file itself
+ if PreprocessedFile == "":
+ PreprocessedFile = InjectedFile
+ LineControlDirectiveFound = True
+ continue
+ elif PreprocessedFile == "" or InjectedFile != PreprocessedFile:
+ continue
+
+ if LineIndexOfOriginalFile is None:
+ #
+ # Any non-empty lines must be from original preprocessed file.
+ # And this must be the first one.
+ #
+ LineIndexOfOriginalFile = Index
+ EdkLogger.verbose("Found original file content starting from line %d"
+ % (LineIndexOfOriginalFile + 1))
+
+ if TrimLong:
+ Line = gLongNumberPattern.sub(r"\1", Line)
+ # convert HEX number format if indicated
+ if ConvertHex:
+ Line = gHexNumberPattern.sub(r"0\2h", Line)
+ else:
+ Line = gHexNumberPattern.sub(r"\1\2", Line)
+
+ # convert Decimal number format
+ Line = gDecNumberPattern.sub(r"\1", Line)
+
+ if LineNumber is not None:
+ EdkLogger.verbose("Got line directive: line=%d" % LineNumber)
+ # in case preprocessor removed some lines, like blank or comment lines
+ if LineNumber <= len(NewLines):
+ # possible?
+ NewLines[LineNumber - 1] = Line
+ else:
+ if LineNumber > (len(NewLines) + 1):
+ for LineIndex in range(len(NewLines), LineNumber-1):
+ NewLines.append(TAB_LINE_BREAK)
+ NewLines.append(Line)
+ LineNumber = None
+ EdkLogger.verbose("Now we have lines: %d" % len(NewLines))
+ else:
+ NewLines.append(Line)
+
+ # in case there's no line directive or linemarker found
+ if (not LineControlDirectiveFound) and NewLines == []:
+ MulPatternFlag = False
+ SinglePatternFlag = False
+ Brace = 0
+ for Index in range(len(Lines)):
+ Line = Lines[Index]
+ if MulPatternFlag == False and gTypedef_MulPattern.search(Line) is None:
+ if SinglePatternFlag == False and gTypedef_SinglePattern.search(Line) is None:
+ # remove "#pragram pack" directive
+ if gPragmaPattern.search(Line) is None:
+ NewLines.append(Line)
+ continue
+ elif SinglePatternFlag == False:
+ SinglePatternFlag = True
+ if Line.find(";") >= 0:
+ SinglePatternFlag = False
+ elif MulPatternFlag == False:
+ # found "typedef struct, typedef union, union, struct", keep its position and set a flag
+ MulPatternFlag = True
+
+ # match { and } to find the end of typedef definition
+ if Line.find("{") >= 0:
+ Brace += 1
+ elif Line.find("}") >= 0:
+ Brace -= 1
+
+ # "typedef struct, typedef union, union, struct" must end with a ";"
+ if Brace == 0 and Line.find(";") >= 0:
+ MulPatternFlag = False
+
+ # save to file
+ try:
+ with open(Target, 'w') as File:
+ File.writelines(NewLines)
+ except:
+ EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target)
+
+## Trim preprocessed VFR file
+#
+# Remove extra content made by preprocessor. The preprocessor doesn't need to
+# enable line number generation option when preprocessing.
+#
+# @param Source File to be trimmed
+# @param Target File to store the trimmed content
+#
+def TrimPreprocessedVfr(Source, Target):
+ CreateDirectory(os.path.dirname(Target))
+
+ try:
+ with open(Source, "r") as File:
+ Lines = File.readlines()
+ except:
+ EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source)
+ # read whole file
+
+ FoundTypedef = False
+ Brace = 0
+ TypedefStart = 0
+ TypedefEnd = 0
+ for Index in range(len(Lines)):
+ Line = Lines[Index]
+ # don't trim the lines from "formset" definition to the end of file
+ if Line.strip() == 'formset':
+ break
+
+ if FoundTypedef == False and (Line.find('#line') == 0 or Line.find('# ') == 0):
+ # empty the line number directive if it's not aomong "typedef struct"
+ Lines[Index] = "\n"
+ continue
+
+ if FoundTypedef == False and gTypedefPattern.search(Line) is None:
+ # keep "#pragram pack" directive
+ if gPragmaPattern.search(Line) is None:
+ Lines[Index] = "\n"
+ continue
+ elif FoundTypedef == False:
+ # found "typedef struct", keept its position and set a flag
+ FoundTypedef = True
+ TypedefStart = Index
+
+ # match { and } to find the end of typedef definition
+ if Line.find("{") >= 0:
+ Brace += 1
+ elif Line.find("}") >= 0:
+ Brace -= 1
+
+ # "typedef struct" must end with a ";"
+ if Brace == 0 and Line.find(";") >= 0:
+ FoundTypedef = False
+ TypedefEnd = Index
+ # keep all "typedef struct" except to GUID, EFI_PLABEL and PAL_CALL_RETURN
+ if Line.strip("} ;\r\n") in [TAB_GUID, "EFI_PLABEL", "PAL_CALL_RETURN"]:
+ for i in range(TypedefStart, TypedefEnd+1):
+ Lines[i] = "\n"
+
+ # save all lines trimmed
+ try:
+ with open(Target, 'w') as File:
+ File.writelines(Lines)
+ except:
+ EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target)
+
+## Read the content ASL file, including ASL included, recursively
+#
+# @param Source File to be read
+# @param Indent Spaces before the Include() statement
+# @param IncludePathList The list of external include file
+# @param LocalSearchPath If LocalSearchPath is specified, this path will be searched
+# first for the included file; otherwise, only the path specified
+# in the IncludePathList will be searched.
+#
+def DoInclude(Source, Indent='', IncludePathList=[], LocalSearchPath=None, IncludeFileList = None, filetype=None):
+ NewFileContent = []
+ if IncludeFileList is None:
+ IncludeFileList = []
+ try:
+ #
+ # Search LocalSearchPath first if it is specified.
+ #
+ if LocalSearchPath:
+ SearchPathList = [LocalSearchPath] + IncludePathList
+ else:
+ SearchPathList = IncludePathList
+
+ for IncludePath in SearchPathList:
+ IncludeFile = os.path.join(IncludePath, Source)
+ if os.path.isfile(IncludeFile):
+ try:
+ with open(IncludeFile, "r") as File:
+ F = File.readlines()
+ except:
+ with codecs.open(IncludeFile, "r", encoding='utf-8') as File:
+ F = File.readlines()
+ break
+ else:
+ EdkLogger.warn("Trim", "Failed to find include file %s" % Source)
+ return []
+ except:
+ EdkLogger.warn("Trim", FILE_OPEN_FAILURE, ExtraData=Source)
+ return []
+
+
+ # avoid A "include" B and B "include" A
+ IncludeFile = os.path.abspath(os.path.normpath(IncludeFile))
+ if IncludeFile in gIncludedAslFile:
+ EdkLogger.warn("Trim", "Circular include",
+ ExtraData= "%s -> %s" % (" -> ".join(gIncludedAslFile), IncludeFile))
+ return []
+ gIncludedAslFile.append(IncludeFile)
+ IncludeFileList.append(IncludeFile.strip())
+ for Line in F:
+ LocalSearchPath = None
+ if filetype == "ASL":
+ Result = gAslIncludePattern.findall(Line)
+ if len(Result) == 0:
+ Result = gAslCIncludePattern.findall(Line)
+ if len(Result) == 0 or os.path.splitext(Result[0][1])[1].lower() not in [".asl", ".asi"]:
+ NewFileContent.append("%s%s" % (Indent, Line))
+ continue
+ #
+ # We should first search the local directory if current file are using pattern #include "XXX"
+ #
+ if Result[0][2] == '"':
+ LocalSearchPath = os.path.dirname(IncludeFile)
+ CurrentIndent = Indent + Result[0][0]
+ IncludedFile = Result[0][1]
+ NewFileContent.extend(DoInclude(IncludedFile, CurrentIndent, IncludePathList, LocalSearchPath,IncludeFileList,filetype))
+ NewFileContent.append("\n")
+ elif filetype == "ASM":
+ Result = gIncludePattern.findall(Line)
+ if len(Result) == 0:
+ NewFileContent.append("%s%s" % (Indent, Line))
+ continue
+
+ IncludedFile = Result[0]
+
+ IncludedFile = IncludedFile.strip()
+ IncludedFile = os.path.normpath(IncludedFile)
+ NewFileContent.extend(DoInclude(IncludedFile, '', IncludePathList, LocalSearchPath,IncludeFileList,filetype))
+ NewFileContent.append("\n")
+
+ gIncludedAslFile.pop()
+
+ return NewFileContent
+
+
+## Trim ASL file
+#
+# Replace ASL include statement with the content the included file
+#
+# @param Source File to be trimmed
+# @param Target File to store the trimmed content
+# @param IncludePathFile The file to log the external include path
+#
+def TrimAslFile(Source, Target, IncludePathFile,AslDeps = False):
+ CreateDirectory(os.path.dirname(Target))
+
+ SourceDir = os.path.dirname(Source)
+ if SourceDir == '':
+ SourceDir = '.'
+
+ #
+ # Add source directory as the first search directory
+ #
+ IncludePathList = [SourceDir]
+
+ #
+ # If additional include path file is specified, append them all
+ # to the search directory list.
+ #
+ if IncludePathFile:
+ try:
+ LineNum = 0
+ with open(IncludePathFile, 'r') as File:
+ FileLines = File.readlines()
+ for Line in FileLines:
+ LineNum += 1
+ if Line.startswith("/I") or Line.startswith ("-I"):
+ IncludePathList.append(Line[2:].strip())
+ else:
+ EdkLogger.warn("Trim", "Invalid include line in include list file.", IncludePathFile, LineNum)
+ except:
+ EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=IncludePathFile)
+ AslIncludes = []
+ Lines = DoInclude(Source, '', IncludePathList,IncludeFileList=AslIncludes,filetype='ASL')
+ AslIncludes = [item for item in AslIncludes if item !=Source]
+ if AslDeps and AslIncludes:
+ SaveFileOnChange(os.path.join(os.path.dirname(Target),os.path.basename(Source))+".trim.deps", " \\\n".join([Source+":"] +AslIncludes),False)
+
+ #
+ # Undef MIN and MAX to avoid collision in ASL source code
+ #
+ Lines.insert(0, "#undef MIN\n#undef MAX\n")
+
+ # save all lines trimmed
+ try:
+ with open(Target, 'w') as File:
+ File.writelines(Lines)
+ except:
+ EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target)
+
+## Trim ASM file
+#
+# Output ASM include statement with the content the included file
+#
+# @param Source File to be trimmed
+# @param Target File to store the trimmed content
+# @param IncludePathFile The file to log the external include path
+#
+def TrimAsmFile(Source, Target, IncludePathFile):
+ CreateDirectory(os.path.dirname(Target))
+
+ SourceDir = os.path.dirname(Source)
+ if SourceDir == '':
+ SourceDir = '.'
+
+ #
+ # Add source directory as the first search directory
+ #
+ IncludePathList = [SourceDir]
+ #
+ # If additional include path file is specified, append them all
+ # to the search directory list.
+ #
+ if IncludePathFile:
+ try:
+ LineNum = 0
+ with open(IncludePathFile, 'r') as File:
+ FileLines = File.readlines()
+ for Line in FileLines:
+ LineNum += 1
+ if Line.startswith("/I") or Line.startswith ("-I"):
+ IncludePathList.append(Line[2:].strip())
+ else:
+ EdkLogger.warn("Trim", "Invalid include line in include list file.", IncludePathFile, LineNum)
+ except:
+ EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=IncludePathFile)
+ AsmIncludes = []
+ Lines = DoInclude(Source, '', IncludePathList,IncludeFileList=AsmIncludes,filetype='ASM')
+ AsmIncludes = [item for item in AsmIncludes if item != Source]
+ if AsmIncludes:
+ SaveFileOnChange(os.path.join(os.path.dirname(Target),os.path.basename(Source))+".trim.deps", " \\\n".join([Source+":"] +AsmIncludes),False)
+ # save all lines trimmed
+ try:
+ with open(Target, 'w') as File:
+ File.writelines(Lines)
+ except:
+ EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target)
+
+def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile):
+ VfrNameList = []
+ if os.path.isdir(DebugDir):
+ for CurrentDir, Dirs, Files in os.walk(DebugDir):
+ for FileName in Files:
+ Name, Ext = os.path.splitext(FileName)
+ if Ext == '.c' and Name != 'AutoGen':
+ VfrNameList.append (Name + 'Bin')
+
+ VfrNameList.append (ModuleName + 'Strings')
+
+ EfiFileName = os.path.join(DebugDir, ModuleName + '.efi')
+ MapFileName = os.path.join(DebugDir, ModuleName + '.map')
+ VfrUniOffsetList = GetVariableOffset(MapFileName, EfiFileName, VfrNameList)
+
+ if not VfrUniOffsetList:
+ return
+
+ try:
+ fInputfile = open(OutputFile, "wb+")
+ except:
+ EdkLogger.error("Trim", FILE_OPEN_FAILURE, "File open failed for %s" %OutputFile, None)
+
+ # Use a instance of BytesIO to cache data
+ fStringIO = BytesIO()
+
+ for Item in VfrUniOffsetList:
+ if (Item[0].find("Strings") != -1):
+ #
+ # UNI offset in image.
+ # GUID + Offset
+ # { 0x8913c5e0, 0x33f6, 0x4d86, { 0x9b, 0xf1, 0x43, 0xef, 0x89, 0xfc, 0x6, 0x66 } }
+ #
+ UniGuid = b'\xe0\xc5\x13\x89\xf63\x86M\x9b\xf1C\xef\x89\xfc\x06f'
+ fStringIO.write(UniGuid)
+ UniValue = pack ('Q', int (Item[1], 16))
+ fStringIO.write (UniValue)
+ else:
+ #
+ # VFR binary offset in image.
+ # GUID + Offset
+ # { 0xd0bc7cb4, 0x6a47, 0x495f, { 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2 } };
+ #
+ VfrGuid = b'\xb4|\xbc\xd0Gj_I\xaa\x11q\x07F\xda\x06\xa2'
+ fStringIO.write(VfrGuid)
+ type (Item[1])
+ VfrValue = pack ('Q', int (Item[1], 16))
+ fStringIO.write (VfrValue)
+
+ #
+ # write data into file.
+ #
+ try :
+ fInputfile.write (fStringIO.getvalue())
+ except:
+ EdkLogger.error("Trim", FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the file been locked or using by other applications." %OutputFile, None)
+
+ fStringIO.close ()
+ fInputfile.close ()
+
+
+## Parse command line options
+#
+# Using standard Python module optparse to parse command line option of this tool.
+#
+# @retval Options A optparse.Values object containing the parsed options
+# @retval InputFile Path of file to be trimmed
+#
+def Options():
+ OptionList = [
+ make_option("-s", "--source-code", dest="FileType", const="SourceCode", action="store_const",
+ help="The input file is preprocessed source code, including C or assembly code"),
+ make_option("-r", "--vfr-file", dest="FileType", const="Vfr", action="store_const",
+ help="The input file is preprocessed VFR file"),
+ make_option("--Vfr-Uni-Offset", dest="FileType", const="VfrOffsetBin", action="store_const",
+ help="The input file is EFI image"),
+ make_option("--asl-deps", dest="AslDeps", const="True", action="store_const",
+ help="Generate Asl dependent files."),
+ make_option("-a", "--asl-file", dest="FileType", const="Asl", action="store_const",
+ help="The input file is ASL file"),
+ make_option( "--asm-file", dest="FileType", const="Asm", action="store_const",
+ help="The input file is asm file"),
+ make_option("-c", "--convert-hex", dest="ConvertHex", action="store_true",
+ help="Convert standard hex format (0xabcd) to MASM format (abcdh)"),
+
+ make_option("-l", "--trim-long", dest="TrimLong", action="store_true",
+ help="Remove postfix of long number"),
+ make_option("-i", "--include-path-file", dest="IncludePathFile",
+ help="The input file is include path list to search for ASL include file"),
+ make_option("-o", "--output", dest="OutputFile",
+ help="File to store the trimmed content"),
+ make_option("--ModuleName", dest="ModuleName", help="The module's BASE_NAME"),
+ make_option("--DebugDir", dest="DebugDir",
+ help="Debug Output directory to store the output files"),
+ make_option("-v", "--verbose", dest="LogLevel", action="store_const", const=EdkLogger.VERBOSE,
+ help="Run verbosely"),
+ make_option("-d", "--debug", dest="LogLevel", type="int",
+ help="Run with debug information"),
+ make_option("-q", "--quiet", dest="LogLevel", action="store_const", const=EdkLogger.QUIET,
+ help="Run quietly"),
+ make_option("-?", action="help", help="show this help message and exit"),
+ ]
+
+ # use clearer usage to override default usage message
+ UsageString = "%prog [-s|-r|-a|--Vfr-Uni-Offset] [-c] [-v|-d <debug_level>|-q] [-i <include_path_file>] [-o <output_file>] [--ModuleName <ModuleName>] [--DebugDir <DebugDir>] [<input_file>]"
+
+ Parser = OptionParser(description=__copyright__, version=__version__, option_list=OptionList, usage=UsageString)
+ Parser.set_defaults(FileType="Vfr")
+ Parser.set_defaults(ConvertHex=False)
+ Parser.set_defaults(LogLevel=EdkLogger.INFO)
+
+ Options, Args = Parser.parse_args()
+
+ # error check
+ if Options.FileType == 'VfrOffsetBin':
+ if len(Args) == 0:
+ return Options, ''
+ elif len(Args) > 1:
+ EdkLogger.error("Trim", OPTION_NOT_SUPPORTED, ExtraData=Parser.get_usage())
+ if len(Args) == 0:
+ EdkLogger.error("Trim", OPTION_MISSING, ExtraData=Parser.get_usage())
+ if len(Args) > 1:
+ EdkLogger.error("Trim", OPTION_NOT_SUPPORTED, ExtraData=Parser.get_usage())
+
+ InputFile = Args[0]
+ return Options, InputFile
+
+## Entrance method
+#
+# This method mainly dispatch specific methods per the command line options.
+# If no error found, return zero value so the caller of this tool can know
+# if it's executed successfully or not.
+#
+# @retval 0 Tool was successful
+# @retval 1 Tool failed
+#
+def Main():
+ try:
+ EdkLogger.Initialize()
+ CommandOptions, InputFile = Options()
+ if CommandOptions.LogLevel < EdkLogger.DEBUG_9:
+ EdkLogger.SetLevel(CommandOptions.LogLevel + 1)
+ else:
+ EdkLogger.SetLevel(CommandOptions.LogLevel)
+ except FatalError as X:
+ return 1
+
+ try:
+ if CommandOptions.FileType == "Vfr":
+ if CommandOptions.OutputFile is None:
+ CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'
+ TrimPreprocessedVfr(InputFile, CommandOptions.OutputFile)
+ elif CommandOptions.FileType == "Asl":
+ if CommandOptions.OutputFile is None:
+ CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'
+ TrimAslFile(InputFile, CommandOptions.OutputFile, CommandOptions.IncludePathFile,CommandOptions.AslDeps)
+ elif CommandOptions.FileType == "VfrOffsetBin":
+ GenerateVfrBinSec(CommandOptions.ModuleName, CommandOptions.DebugDir, CommandOptions.OutputFile)
+ elif CommandOptions.FileType == "Asm":
+ TrimAsmFile(InputFile, CommandOptions.OutputFile, CommandOptions.IncludePathFile)
+ else :
+ if CommandOptions.OutputFile is None:
+ CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'
+ TrimPreprocessedFile(InputFile, CommandOptions.OutputFile, CommandOptions.ConvertHex, CommandOptions.TrimLong)
+ except FatalError as X:
+ import platform
+ import traceback
+ if CommandOptions is not None and CommandOptions.LogLevel <= EdkLogger.DEBUG_9:
+ EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
+ return 1
+ except:
+ import traceback
+ import platform
+ EdkLogger.error(
+ "\nTrim",
+ CODE_ERROR,
+ "Unknown fatal error when trimming [%s]" % InputFile,
+ ExtraData="\n(Please send email to %s for help, attaching following call stack trace!)\n" % MSG_EDKII_MAIL_ADDR,
+ RaiseError=False
+ )
+ EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
+ return 1
+
+ return 0
+
+if __name__ == '__main__':
+ r = Main()
+ ## 0-127 is a safe return range, and 1 is a standard default error
+ if r < 0 or r > 127: r = 1
+ sys.exit(r)
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/BuildVersion.py b/roms/edk2/BaseTools/Source/Python/UPT/BuildVersion.py
new file mode 100644
index 000000000..1b144dc1b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/BuildVersion.py
@@ -0,0 +1,14 @@
+## @file
+#
+# This file is for build version number auto generation
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Build version information
+'''
+
+gBUILD_VERSION = "Developer Build based on Revision: Unknown"
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Core/DependencyRules.py b/roms/edk2/BaseTools/Source/Python/UPT/Core/DependencyRules.py
new file mode 100644
index 000000000..0c801c72d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Core/DependencyRules.py
@@ -0,0 +1,448 @@
+## @file
+# This file is for installed package information database operations
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Dependency
+'''
+
+##
+# Import Modules
+#
+from os.path import dirname
+import os
+
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Library.Parsing import GetWorkspacePackage
+from Library.Parsing import GetWorkspaceModule
+from Library.Parsing import GetPkgInfoFromDec
+from Library.Misc import GetRelativePath
+from Library import GlobalData
+from Logger.ToolError import FatalError
+from Logger.ToolError import EDK1_INF_ERROR
+from Logger.ToolError import UNKNOWN_ERROR
+(DEPEX_CHECK_SUCCESS, DEPEX_CHECK_MODULE_NOT_FOUND, \
+DEPEX_CHECK_PACKAGE_NOT_FOUND, DEPEX_CHECK_DP_NOT_FOUND) = (0, 1, 2, 3)
+
+
+## DependencyRules
+#
+# This class represents the dependency rule check mechanism
+#
+# @param object: Inherited from object class
+#
+class DependencyRules(object):
+ def __init__(self, Datab, ToBeInstalledPkgList=None):
+ self.IpiDb = Datab
+ self.WsPkgList = GetWorkspacePackage()
+ self.WsModuleList = GetWorkspaceModule()
+
+ self.PkgsToBeDepend = [(PkgInfo[1], PkgInfo[2]) for PkgInfo in self.WsPkgList]
+
+ # Add package info from the DIST to be installed.
+ self.PkgsToBeDepend.extend(self.GenToBeInstalledPkgList(ToBeInstalledPkgList))
+
+ def GenToBeInstalledPkgList(self, ToBeInstalledPkgList):
+ if not ToBeInstalledPkgList:
+ return []
+ RtnList = []
+ for Dist in ToBeInstalledPkgList:
+ for Package in Dist.PackageSurfaceArea:
+ RtnList.append((Package[0], Package[1]))
+
+ return RtnList
+
+ ## Check whether a module exists by checking the Guid+Version+Name+Path combination
+ #
+ # @param Guid: Guid of a module
+ # @param Version: Version of a module
+ # @param Name: Name of a module
+ # @param Path: Path of a module
+ # @return: True if module existed, else False
+ #
+ def CheckModuleExists(self, Guid, Version, Name, Path):
+ Logger.Verbose(ST.MSG_CHECK_MODULE_EXIST)
+ ModuleList = self.IpiDb.GetModInPackage(Guid, Version, Name, Path)
+ ModuleList.extend(self.IpiDb.GetStandaloneModule(Guid, Version, Name, Path))
+ Logger.Verbose(ST.MSG_CHECK_MODULE_EXIST_FINISH)
+ if len(ModuleList) > 0:
+ return True
+ else:
+ return False
+
+ ## Check whether a module depex satisfied.
+ #
+ # @param ModuleObj: A module object
+ # @param DpObj: A distribution object
+ # @return: True if module depex satisfied
+ # False else
+ #
+ def CheckModuleDepexSatisfied(self, ModuleObj, DpObj=None):
+ Logger.Verbose(ST.MSG_CHECK_MODULE_DEPEX_START)
+ Result = True
+ Dep = None
+ if ModuleObj.GetPackageDependencyList():
+ Dep = ModuleObj.GetPackageDependencyList()[0]
+ for Dep in ModuleObj.GetPackageDependencyList():
+ #
+ # first check whether the dependency satisfied by current workspace
+ #
+ Exist = self.CheckPackageExists(Dep.GetGuid(), Dep.GetVersion())
+ #
+ # check whether satisfied by current distribution
+ #
+ if not Exist:
+ if DpObj is None:
+ Result = False
+ break
+ for GuidVerPair in DpObj.PackageSurfaceArea.keys():
+ if Dep.GetGuid() == GuidVerPair[0]:
+ if Dep.GetVersion() is None or \
+ len(Dep.GetVersion()) == 0:
+ Result = True
+ break
+ if Dep.GetVersion() == GuidVerPair[1]:
+ Result = True
+ break
+ else:
+ Result = False
+ break
+
+ if not Result:
+ Logger.Error("CheckModuleDepex", UNKNOWN_ERROR, \
+ ST.ERR_DEPENDENCY_NOT_MATCH % (ModuleObj.GetName(), \
+ Dep.GetPackageFilePath(), \
+ Dep.GetGuid(), \
+ Dep.GetVersion()))
+ return Result
+
+ ## Check whether a package exists in a package list specified by PkgsToBeDepend.
+ #
+ # @param Guid: Guid of a package
+ # @param Version: Version of a package
+ # @return: True if package exist
+ # False else
+ #
+ def CheckPackageExists(self, Guid, Version):
+ Logger.Verbose(ST.MSG_CHECK_PACKAGE_START)
+ Found = False
+ for (PkgGuid, PkgVer) in self.PkgsToBeDepend:
+ if (PkgGuid == Guid):
+ #
+ # if version is not empty and not equal, then not match
+ #
+ if Version and (PkgVer != Version):
+ Found = False
+ break
+ else:
+ Found = True
+ break
+ else:
+ Found = False
+
+ Logger.Verbose(ST.MSG_CHECK_PACKAGE_FINISH)
+ return Found
+
+ ## Check whether a package depex satisfied.
+ #
+ # @param PkgObj: A package object
+ # @param DpObj: A distribution object
+ # @return: True if package depex satisfied
+ # False else
+ #
+ def CheckPackageDepexSatisfied(self, PkgObj, DpObj=None):
+ ModuleDict = PkgObj.GetModuleDict()
+ for ModKey in ModuleDict.keys():
+ ModObj = ModuleDict[ModKey]
+ if self.CheckModuleDepexSatisfied(ModObj, DpObj):
+ continue
+ else:
+ return False
+ return True
+
+ ## Check whether a DP exists.
+ #
+ # @param Guid: Guid of a Distribution
+ # @param Version: Version of a Distribution
+ # @return: True if Distribution exist
+ # False else
+ def CheckDpExists(self, Guid, Version):
+ Logger.Verbose(ST.MSG_CHECK_DP_START)
+ DpList = self.IpiDb.GetDp(Guid, Version)
+ if len(DpList) > 0:
+ Found = True
+ else:
+ Found = False
+
+ Logger.Verbose(ST.MSG_CHECK_DP_FINISH)
+ return Found
+
+ ## Check whether a DP depex satisfied by current workspace for Install
+ #
+ # @param DpObj: A distribution object
+ # @return: True if distribution depex satisfied
+ # False else
+ #
+ def CheckInstallDpDepexSatisfied(self, DpObj):
+ return self.CheckDpDepexSatisfied(DpObj)
+
+ # # Check whether multiple DP depex satisfied by current workspace for Install
+ #
+ # @param DpObjList: A distribution object list
+ # @return: True if distribution depex satisfied
+ # False else
+ #
+ def CheckTestInstallPdDepexSatisfied(self, DpObjList):
+ for DpObj in DpObjList:
+ if self.CheckDpDepexSatisfied(DpObj):
+ for PkgKey in DpObj.PackageSurfaceArea.keys():
+ PkgObj = DpObj.PackageSurfaceArea[PkgKey]
+ self.PkgsToBeDepend.append((PkgObj.Guid, PkgObj.Version))
+ else:
+ return False, DpObj
+
+ return True, DpObj
+
+
+ ## Check whether a DP depex satisfied by current workspace
+ # (excluding the original distribution's packages to be replaced) for Replace
+ #
+ # @param DpObj: A distribution object
+ # @param OrigDpGuid: The original distribution's Guid
+ # @param OrigDpVersion: The original distribution's Version
+ #
+ def ReplaceCheckNewDpDepex(self, DpObj, OrigDpGuid, OrigDpVersion):
+ self.PkgsToBeDepend = [(PkgInfo[1], PkgInfo[2]) for PkgInfo in self.WsPkgList]
+ OrigDpPackageList = self.IpiDb.GetPackageListFromDp(OrigDpGuid, OrigDpVersion)
+ for OrigPkgInfo in OrigDpPackageList:
+ Guid, Version = OrigPkgInfo[0], OrigPkgInfo[1]
+ if (Guid, Version) in self.PkgsToBeDepend:
+ self.PkgsToBeDepend.remove((Guid, Version))
+ return self.CheckDpDepexSatisfied(DpObj)
+
+ ## Check whether a DP depex satisfied by current workspace.
+ #
+ # @param DpObj: A distribution object
+ #
+ def CheckDpDepexSatisfied(self, DpObj):
+ for PkgKey in DpObj.PackageSurfaceArea.keys():
+ PkgObj = DpObj.PackageSurfaceArea[PkgKey]
+ if self.CheckPackageDepexSatisfied(PkgObj, DpObj):
+ continue
+ else:
+ return False
+
+ for ModKey in DpObj.ModuleSurfaceArea.keys():
+ ModObj = DpObj.ModuleSurfaceArea[ModKey]
+ if self.CheckModuleDepexSatisfied(ModObj, DpObj):
+ continue
+ else:
+ return False
+
+ return True
+
+ ## Check whether a DP could be removed from current workspace.
+ #
+ # @param DpGuid: File's guid
+ # @param DpVersion: File's version
+ # @retval Removable: True if distribution could be removed, False Else
+ # @retval DependModuleList: the list of modules that make distribution can not be removed
+ #
+ def CheckDpDepexForRemove(self, DpGuid, DpVersion):
+ Removable = True
+ DependModuleList = []
+ WsModuleList = self.WsModuleList
+ #
+ # remove modules that included in current DP
+ # List of item (FilePath)
+ DpModuleList = self.IpiDb.GetDpModuleList(DpGuid, DpVersion)
+ for Module in DpModuleList:
+ if Module in WsModuleList:
+ WsModuleList.remove(Module)
+ else:
+ Logger.Warn("UPT\n",
+ ST.ERR_MODULE_NOT_INSTALLED % Module)
+ #
+ # get packages in current Dp and find the install path
+ # List of item (PkgGuid, PkgVersion, InstallPath)
+ DpPackageList = self.IpiDb.GetPackageListFromDp(DpGuid, DpVersion)
+ DpPackagePathList = []
+ WorkSP = GlobalData.gWORKSPACE
+ for (PkgName, PkgGuid, PkgVersion, DecFile) in self.WsPkgList:
+ if PkgName:
+ pass
+ DecPath = dirname(DecFile)
+ if DecPath.find(WorkSP) > -1:
+ InstallPath = GetRelativePath(DecPath, WorkSP)
+ DecFileRelaPath = GetRelativePath(DecFile, WorkSP)
+ else:
+ InstallPath = DecPath
+ DecFileRelaPath = DecFile
+
+ if (PkgGuid, PkgVersion, InstallPath) in DpPackageList:
+ DpPackagePathList.append(DecFileRelaPath)
+ DpPackageList.remove((PkgGuid, PkgVersion, InstallPath))
+
+ #
+ # the left items in DpPackageList are the packages that installed but not found anymore
+ #
+ for (PkgGuid, PkgVersion, InstallPath) in DpPackageList:
+ Logger.Warn("UPT",
+ ST.WARN_INSTALLED_PACKAGE_NOT_FOUND%(PkgGuid, PkgVersion, InstallPath))
+
+ #
+ # check modules to see if has dependency on package of current DP
+ #
+ for Module in WsModuleList:
+ if (not VerifyRemoveModuleDep(Module, DpPackagePathList)):
+ Removable = False
+ DependModuleList.append(Module)
+ return (Removable, DependModuleList)
+
+
+ ## Check whether a DP could be replaced by a distribution containing NewDpPkgList
+ # from current workspace.
+ #
+ # @param OrigDpGuid: original Dp's Guid
+ # @param OrigDpVersion: original Dp's version
+ # @param NewDpPkgList: a list of package information (Guid, Version) in new Dp
+ # @retval Replaceable: True if distribution could be replaced, False Else
+ # @retval DependModuleList: the list of modules that make distribution can not be replaced
+ #
+ def CheckDpDepexForReplace(self, OrigDpGuid, OrigDpVersion, NewDpPkgList):
+ Replaceable = True
+ DependModuleList = []
+ WsModuleList = self.WsModuleList
+ #
+ # remove modules that included in current DP
+ # List of item (FilePath)
+ DpModuleList = self.IpiDb.GetDpModuleList(OrigDpGuid, OrigDpVersion)
+ for Module in DpModuleList:
+ if Module in WsModuleList:
+ WsModuleList.remove(Module)
+ else:
+ Logger.Warn("UPT\n",
+ ST.ERR_MODULE_NOT_INSTALLED % Module)
+
+ OtherPkgList = NewDpPkgList
+ #
+ # get packages in current Dp and find the install path
+ # List of item (PkgGuid, PkgVersion, InstallPath)
+ DpPackageList = self.IpiDb.GetPackageListFromDp(OrigDpGuid, OrigDpVersion)
+ DpPackagePathList = []
+ WorkSP = GlobalData.gWORKSPACE
+ for (PkgName, PkgGuid, PkgVersion, DecFile) in self.WsPkgList:
+ if PkgName:
+ pass
+ DecPath = dirname(DecFile)
+ if DecPath.find(WorkSP) > -1:
+ InstallPath = GetRelativePath(DecPath, WorkSP)
+ DecFileRelaPath = GetRelativePath(DecFile, WorkSP)
+ else:
+ InstallPath = DecPath
+ DecFileRelaPath = DecFile
+
+ if (PkgGuid, PkgVersion, InstallPath) in DpPackageList:
+ DpPackagePathList.append(DecFileRelaPath)
+ DpPackageList.remove((PkgGuid, PkgVersion, InstallPath))
+ else:
+ OtherPkgList.append((PkgGuid, PkgVersion))
+
+ #
+ # the left items in DpPackageList are the packages that installed but not found anymore
+ #
+ for (PkgGuid, PkgVersion, InstallPath) in DpPackageList:
+ Logger.Warn("UPT",
+ ST.WARN_INSTALLED_PACKAGE_NOT_FOUND%(PkgGuid, PkgVersion, InstallPath))
+
+ #
+ # check modules to see if it can be satisfied by package not belong to removed DP
+ #
+ for Module in WsModuleList:
+ if (not VerifyReplaceModuleDep(Module, DpPackagePathList, OtherPkgList)):
+ Replaceable = False
+ DependModuleList.append(Module)
+ return (Replaceable, DependModuleList)
+
+
+## check whether module depends on packages in DpPackagePathList, return True
+# if found, False else
+#
+# @param Path: a module path
+# @param DpPackagePathList: a list of Package Paths
+# @retval: False: module depends on package in DpPackagePathList
+# True: module doesn't depend on package in DpPackagePathList
+#
+def VerifyRemoveModuleDep(Path, DpPackagePathList):
+ try:
+ for Item in GetPackagePath(Path):
+ if Item in DpPackagePathList:
+ DecPath = os.path.normpath(os.path.join(GlobalData.gWORKSPACE, Item))
+ Logger.Info(ST.MSG_MODULE_DEPEND_ON % (Path, DecPath))
+ return False
+ else:
+ return True
+ except FatalError as ErrCode:
+ if ErrCode.message == EDK1_INF_ERROR:
+ Logger.Warn("UPT",
+ ST.WRN_EDK1_INF_FOUND%Path)
+ return True
+ else:
+ return True
+
+# # GetPackagePath
+#
+# Get Dependency package path from an Inf file path
+#
+def GetPackagePath(InfPath):
+ PackagePath = []
+ if os.path.exists(InfPath):
+ FindSection = False
+ for Line in open(InfPath).readlines():
+ Line = Line.strip()
+ if not Line:
+ continue
+ if Line.startswith('#'):
+ continue
+ if Line.startswith('[Packages') and Line.endswith(']'):
+ FindSection = True
+ continue
+ if Line.startswith('[') and Line.endswith(']') and FindSection:
+ break
+ if FindSection:
+ PackagePath.append(os.path.normpath(Line))
+
+ return PackagePath
+
+## check whether module depends on packages in DpPackagePathList and can not be satisfied by OtherPkgList
+#
+# @param Path: a module path
+# @param DpPackagePathList: a list of Package Paths
+# @param OtherPkgList: a list of Package Information (Guid, Version)
+# @retval: False: module depends on package in DpPackagePathList and can not be satisfied by OtherPkgList
+# True: either module doesn't depend on DpPackagePathList or module depends on DpPackagePathList
+# but can be satisfied by OtherPkgList
+#
+def VerifyReplaceModuleDep(Path, DpPackagePathList, OtherPkgList):
+ try:
+ for Item in GetPackagePath(Path):
+ if Item in DpPackagePathList:
+ DecPath = os.path.normpath(os.path.join(GlobalData.gWORKSPACE, Item))
+ Name, Guid, Version = GetPkgInfoFromDec(DecPath)
+ if (Guid, Version) not in OtherPkgList:
+ Logger.Info(ST.MSG_MODULE_DEPEND_ON % (Path, DecPath))
+ return False
+ else:
+ return True
+ except FatalError as ErrCode:
+ if ErrCode.message == EDK1_INF_ERROR:
+ Logger.Warn("UPT",
+ ST.WRN_EDK1_INF_FOUND%Path)
+ return True
+ else:
+ return True
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py b/roms/edk2/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py
new file mode 100644
index 000000000..5ee79b631
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py
@@ -0,0 +1,267 @@
+## @file
+# This file is used to define a class object to describe a distribution package
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+DistributionPackageClass
+'''
+
+##
+# Import Modules
+#
+import os.path
+
+from Library.Misc import Sdict
+from Library.Misc import GetNonMetaDataFiles
+from PomAdapter.InfPomAlignment import InfPomAlignment
+from PomAdapter.DecPomAlignment import DecPomAlignment
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger.ToolError import OPTION_VALUE_INVALID
+from Logger.ToolError import FatalError
+from Logger.ToolError import EDK1_INF_ERROR
+from Object.POM.CommonObject import IdentificationObject
+from Object.POM.CommonObject import CommonHeaderObject
+from Object.POM.CommonObject import MiscFileObject
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+
+## DistributionPackageHeaderClass
+#
+# @param IdentificationObject: Identification Object
+# @param CommonHeaderObject: Common Header Object
+#
+class DistributionPackageHeaderObject(IdentificationObject, \
+ CommonHeaderObject):
+ def __init__(self):
+ IdentificationObject.__init__(self)
+ CommonHeaderObject.__init__(self)
+ self.ReadOnly = ''
+ self.RePackage = ''
+ self.Vendor = ''
+ self.Date = ''
+ self.Signature = 'Md5Sum'
+ self.XmlSpecification = ''
+
+ def GetReadOnly(self):
+ return self.ReadOnly
+
+ def SetReadOnly(self, ReadOnly):
+ self.ReadOnly = ReadOnly
+
+ def GetRePackage(self):
+ return self.RePackage
+
+ def SetRePackage(self, RePackage):
+ self.RePackage = RePackage
+
+ def GetVendor(self):
+ return self.Vendor
+
+ def SetDate(self, Date):
+ self.Date = Date
+
+ def GetDate(self):
+ return self.Date
+
+ def SetSignature(self, Signature):
+ self.Signature = Signature
+
+ def GetSignature(self):
+ return self.Signature
+
+ def SetXmlSpecification(self, XmlSpecification):
+ self.XmlSpecification = XmlSpecification
+
+ def GetXmlSpecification(self):
+ return self.XmlSpecification
+
+## DistributionPackageClass
+#
+# @param object: DistributionPackageClass
+#
+class DistributionPackageClass(object):
+ def __init__(self):
+ self.Header = DistributionPackageHeaderObject()
+ #
+ # {(Guid, Version, Path) : PackageObj}
+ #
+ self.PackageSurfaceArea = Sdict()
+ #
+ # {(Guid, Version, Name, Path) : ModuleObj}
+ #
+ self.ModuleSurfaceArea = Sdict()
+ self.Tools = MiscFileObject()
+ self.MiscellaneousFiles = MiscFileObject()
+ self.UserExtensions = []
+ self.FileList = []
+
+ ## Get all included packages and modules for a distribution package
+ #
+ # @param WorkspaceDir: WorkspaceDir
+ # @param PackageList: A list of all packages
+ # @param ModuleList: A list of all modules
+ #
+ def GetDistributionPackage(self, WorkspaceDir, PackageList, ModuleList):
+ # Backup WorkspaceDir
+ Root = WorkspaceDir
+
+ #
+ # Get Packages
+ #
+ if PackageList:
+ for PackageFile in PackageList:
+ PackageFileFullPath = mws.join(Root, PackageFile)
+ WorkspaceDir = mws.getWs(Root, PackageFile)
+ DecObj = DecPomAlignment(PackageFileFullPath, WorkspaceDir, CheckMulDec=True)
+ PackageObj = DecObj
+ #
+ # Parser inf file one bye one
+ #
+ ModuleInfFileList = PackageObj.GetModuleFileList()
+ for File in ModuleInfFileList:
+ WsRelPath = os.path.join(PackageObj.GetPackagePath(), File)
+ WsRelPath = os.path.normpath(WsRelPath)
+ if ModuleList and WsRelPath in ModuleList:
+ Logger.Error("UPT",
+ OPTION_VALUE_INVALID,
+ ST.ERR_NOT_STANDALONE_MODULE_ERROR%\
+ (WsRelPath, PackageFile))
+ Filename = os.path.normpath\
+ (os.path.join(PackageObj.GetRelaPath(), File))
+ os.path.splitext(Filename)
+ #
+ # Call INF parser to generate Inf Object.
+ # Actually, this call is not directly call, but wrapped by
+ # Inf class in InfPomAlignment.
+ #
+ try:
+ ModuleObj = InfPomAlignment(Filename, WorkspaceDir, PackageObj.GetPackagePath())
+
+ #
+ # Add module to package
+ #
+ ModuleDict = PackageObj.GetModuleDict()
+ ModuleDict[(ModuleObj.GetGuid(), \
+ ModuleObj.GetVersion(), \
+ ModuleObj.GetName(), \
+ ModuleObj.GetCombinePath())] = ModuleObj
+ PackageObj.SetModuleDict(ModuleDict)
+ except FatalError as ErrCode:
+ if ErrCode.message == EDK1_INF_ERROR:
+ Logger.Warn("UPT",
+ ST.WRN_EDK1_INF_FOUND%Filename)
+ else:
+ raise
+
+ self.PackageSurfaceArea\
+ [(PackageObj.GetGuid(), PackageObj.GetVersion(), \
+ PackageObj.GetCombinePath())] = PackageObj
+
+ #
+ # Get Modules
+ #
+ if ModuleList:
+ for ModuleFile in ModuleList:
+ ModuleFileFullPath = mws.join(Root, ModuleFile)
+ WorkspaceDir = mws.getWs(Root, ModuleFile)
+
+ try:
+ ModuleObj = InfPomAlignment(ModuleFileFullPath, WorkspaceDir)
+ ModuleKey = (ModuleObj.GetGuid(),
+ ModuleObj.GetVersion(),
+ ModuleObj.GetName(),
+ ModuleObj.GetCombinePath())
+ self.ModuleSurfaceArea[ModuleKey] = ModuleObj
+ except FatalError as ErrCode:
+ if ErrCode.message == EDK1_INF_ERROR:
+ Logger.Error("UPT",
+ EDK1_INF_ERROR,
+ ST.WRN_EDK1_INF_FOUND%ModuleFileFullPath,
+ ExtraData=ST.ERR_NOT_SUPPORTED_SA_MODULE)
+ else:
+ raise
+
+ # Recover WorkspaceDir
+ WorkspaceDir = Root
+
+ ## Get all files included for a distribution package, except tool/misc of
+ # distribution level
+ #
+ # @retval DistFileList A list of filepath for NonMetaDataFile, relative to workspace
+ # @retval MetaDataFileList A list of filepath for MetaDataFile, relative to workspace
+ #
+ def GetDistributionFileList(self):
+ MetaDataFileList = []
+ SkipModulesUniList = []
+
+ for Guid, Version, Path in self.PackageSurfaceArea:
+ Package = self.PackageSurfaceArea[Guid, Version, Path]
+ PackagePath = Package.GetPackagePath()
+ FullPath = Package.GetFullPath()
+ MetaDataFileList.append(Path)
+ IncludePathList = Package.GetIncludePathList()
+ for IncludePath in IncludePathList:
+ SearchPath = os.path.normpath(os.path.join(os.path.dirname(FullPath), IncludePath))
+ AddPath = os.path.normpath(os.path.join(PackagePath, IncludePath))
+ self.FileList += GetNonMetaDataFiles(SearchPath, ['CVS', '.svn'], False, AddPath)
+ #
+ # Add the miscellaneous files on DEC file
+ #
+ for MiscFileObj in Package.GetMiscFileList():
+ for FileObj in MiscFileObj.GetFileList():
+ MiscFileFullPath = os.path.normpath(os.path.join(PackagePath, FileObj.GetURI()))
+ if MiscFileFullPath not in self.FileList:
+ self.FileList.append(MiscFileFullPath)
+
+ Module = None
+ ModuleDict = Package.GetModuleDict()
+ for Guid, Version, Name, Path in ModuleDict:
+ Module = ModuleDict[Guid, Version, Name, Path]
+ ModulePath = Module.GetModulePath()
+ FullPath = Module.GetFullPath()
+ PkgRelPath = os.path.normpath(os.path.join(PackagePath, ModulePath))
+ MetaDataFileList.append(Path)
+ SkipList = ['CVS', '.svn']
+ NonMetaDataFileList = []
+ if Module.UniFileClassObject:
+ for UniFile in Module.UniFileClassObject.IncFileList:
+ OriPath = os.path.normpath(os.path.dirname(FullPath))
+ UniFilePath = os.path.normpath(os.path.join(PkgRelPath, UniFile.Path[len(OriPath) + 1:]))
+ if UniFilePath not in SkipModulesUniList:
+ SkipModulesUniList.append(UniFilePath)
+ for IncludeFile in Module.UniFileClassObject.IncludePathList:
+ if IncludeFile not in SkipModulesUniList:
+ SkipModulesUniList.append(IncludeFile)
+ NonMetaDataFileList = GetNonMetaDataFiles(os.path.dirname(FullPath), SkipList, False, PkgRelPath)
+ for NonMetaDataFile in NonMetaDataFileList:
+ if NonMetaDataFile not in self.FileList:
+ self.FileList.append(NonMetaDataFile)
+ for Guid, Version, Name, Path in self.ModuleSurfaceArea:
+ Module = self.ModuleSurfaceArea[Guid, Version, Name, Path]
+ ModulePath = Module.GetModulePath()
+ FullPath = Module.GetFullPath()
+ MetaDataFileList.append(Path)
+ SkipList = ['CVS', '.svn']
+ NonMetaDataFileList = []
+ if Module.UniFileClassObject:
+ for UniFile in Module.UniFileClassObject.IncFileList:
+ OriPath = os.path.normpath(os.path.dirname(FullPath))
+ UniFilePath = os.path.normpath(os.path.join(ModulePath, UniFile.Path[len(OriPath) + 1:]))
+ if UniFilePath not in SkipModulesUniList:
+ SkipModulesUniList.append(UniFilePath)
+ NonMetaDataFileList = GetNonMetaDataFiles(os.path.dirname(FullPath), SkipList, False, ModulePath)
+ for NonMetaDataFile in NonMetaDataFileList:
+ if NonMetaDataFile not in self.FileList:
+ self.FileList.append(NonMetaDataFile)
+
+ for SkipModuleUni in SkipModulesUniList:
+ if SkipModuleUni in self.FileList:
+ self.FileList.remove(SkipModuleUni)
+
+ return self.FileList, MetaDataFileList
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Core/FileHook.py b/roms/edk2/BaseTools/Source/Python/UPT/Core/FileHook.py
new file mode 100644
index 000000000..20712065f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Core/FileHook.py
@@ -0,0 +1,193 @@
+## @file
+# This file hooks file and directory creation and removal
+#
+# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+File hook
+'''
+
+import os
+import stat
+import time
+import zipfile
+from time import sleep
+from Library import GlobalData
+
+__built_in_remove__ = os.remove
+__built_in_mkdir__ = os.mkdir
+__built_in_rmdir__ = os.rmdir
+__built_in_chmod__ = os.chmod
+__built_in_open__ = open
+
+_RMFILE = 0
+_MKFILE = 1
+_RMDIR = 2
+_MKDIR = 3
+_CHMOD = 4
+
+gBACKUPFILE = 'file.backup'
+gEXCEPTION_LIST = ['Conf'+os.sep+'DistributionPackageDatabase.db', '.tmp', gBACKUPFILE]
+
+class _PathInfo:
+ def __init__(self, action, path, mode=-1):
+ self.action = action
+ self.path = path
+ self.mode = mode
+
+class RecoverMgr:
+ def __init__(self, workspace):
+ self.rlist = []
+ self.zip = None
+ self.workspace = os.path.normpath(workspace)
+ self.backupfile = gBACKUPFILE
+ self.zipfile = os.path.join(self.workspace, gBACKUPFILE)
+
+ def _createzip(self):
+ if self.zip:
+ return
+ self.zip = zipfile.ZipFile(self.zipfile, 'w', zipfile.ZIP_DEFLATED)
+
+ def _save(self, tmp, path):
+ if not self._tryhook(path):
+ return
+ self.rlist.append(_PathInfo(tmp, path))
+
+ def bkrmfile(self, path):
+ arc = self._tryhook(path)
+ if arc and os.path.isfile(path):
+ self._createzip()
+ self.zip.write(path, arc.encode('utf_8'))
+ sta = os.stat(path)
+ oldmode = stat.S_IMODE(sta.st_mode)
+ self.rlist.append(_PathInfo(_CHMOD, path, oldmode))
+ self.rlist.append(_PathInfo(_RMFILE, path))
+ __built_in_remove__(path)
+
+ def bkmkfile(self, path, mode, bufsize):
+ if not os.path.exists(path):
+ self._save(_MKFILE, path)
+ return __built_in_open__(path, mode, bufsize)
+
+ def bkrmdir(self, path):
+ if os.path.exists(path):
+ sta = os.stat(path)
+ oldmode = stat.S_IMODE(sta.st_mode)
+ self.rlist.append(_PathInfo(_CHMOD, path, oldmode))
+ self._save(_RMDIR, path)
+ __built_in_rmdir__(path)
+
+ def bkmkdir(self, path, mode):
+ if not os.path.exists(path):
+ self._save(_MKDIR, path)
+ __built_in_mkdir__(path, mode)
+
+ def bkchmod(self, path, mode):
+ if self._tryhook(path) and os.path.exists(path):
+ sta = os.stat(path)
+ oldmode = stat.S_IMODE(sta.st_mode)
+ self.rlist.append(_PathInfo(_CHMOD, path, oldmode))
+ __built_in_chmod__(path, mode)
+
+ def rollback(self):
+ if self.zip:
+ self.zip.close()
+ self.zip = None
+ index = len(self.rlist) - 1
+ while index >= 0:
+ item = self.rlist[index]
+ exist = os.path.exists(item.path)
+ if item.action == _MKFILE and exist:
+ #if not os.access(item.path, os.W_OK):
+ # os.chmod(item.path, S_IWUSR)
+ __built_in_remove__(item.path)
+ elif item.action == _RMFILE and not exist:
+ if not self.zip:
+ self.zip = zipfile.ZipFile(self.zipfile, 'r', zipfile.ZIP_DEFLATED)
+ arcname = os.path.normpath(item.path)
+ arcname = arcname[len(self.workspace)+1:].encode('utf_8')
+ if os.sep != "/" and os.sep in arcname:
+ arcname = arcname.replace(os.sep, '/')
+ mtime = self.zip.getinfo(arcname).date_time
+ content = self.zip.read(arcname)
+ filep = __built_in_open__(item.path, "wb")
+ filep.write(content)
+ filep.close()
+ intime = time.mktime(mtime + (0, 0, 0))
+ os.utime(item.path, (intime, intime))
+ elif item.action == _MKDIR and exist:
+ while True:
+ try:
+ __built_in_rmdir__(item.path)
+ break
+ except IOError:
+ # Sleep a short time and try again
+ # The anti-virus software may delay the file removal in this directory
+ sleep(0.1)
+ elif item.action == _RMDIR and not exist:
+ __built_in_mkdir__(item.path)
+ elif item.action == _CHMOD and exist:
+ try:
+ __built_in_chmod__(item.path, item.mode)
+ except EnvironmentError:
+ pass
+ index -= 1
+ self.commit()
+
+ def commit(self):
+ if self.zip:
+ self.zip.close()
+ __built_in_remove__(self.zipfile)
+
+ # Check if path needs to be hooked
+ def _tryhook(self, path):
+ path = os.path.normpath(path)
+ works = self.workspace if str(self.workspace).endswith(os.sep) else (self.workspace + os.sep)
+ if not path.startswith(works):
+ return ''
+ for exceptdir in gEXCEPTION_LIST:
+ full = os.path.join(self.workspace, exceptdir)
+ if full == path or path.startswith(full + os.sep) or os.path.split(full)[0] == path:
+ return ''
+ return path[len(self.workspace)+1:]
+
+def _hookrm(path):
+ if GlobalData.gRECOVERMGR:
+ GlobalData.gRECOVERMGR.bkrmfile(path)
+ else:
+ __built_in_remove__(path)
+
+def _hookmkdir(path, mode=0o777):
+ if GlobalData.gRECOVERMGR:
+ GlobalData.gRECOVERMGR.bkmkdir(path, mode)
+ else:
+ __built_in_mkdir__(path, mode)
+
+def _hookrmdir(path):
+ if GlobalData.gRECOVERMGR:
+ GlobalData.gRECOVERMGR.bkrmdir(path)
+ else:
+ __built_in_rmdir__(path)
+
+def _hookmkfile(path, mode='r', bufsize=-1):
+ if GlobalData.gRECOVERMGR:
+ return GlobalData.gRECOVERMGR.bkmkfile(path, mode, bufsize)
+ return __built_in_open__(path, mode, bufsize)
+
+def _hookchmod(path, mode):
+ if GlobalData.gRECOVERMGR:
+ GlobalData.gRECOVERMGR.bkchmod(path, mode)
+ else:
+ __built_in_chmod__(path, mode)
+
+def SetRecoverMgr(mgr):
+ GlobalData.gRECOVERMGR = mgr
+
+os.remove = _hookrm
+os.mkdir = _hookmkdir
+os.rmdir = _hookrmdir
+os.chmod = _hookchmod
+__FileHookOpen__ = _hookmkfile
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Core/IpiDb.py b/roms/edk2/BaseTools/Source/Python/UPT/Core/IpiDb.py
new file mode 100644
index 000000000..69895e11c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Core/IpiDb.py
@@ -0,0 +1,922 @@
+## @file
+# This file is for installed package information database operations
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+IpiDb
+'''
+
+##
+# Import Modules
+#
+import sqlite3
+import os.path
+import time
+
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger.ToolError import UPT_ALREADY_RUNNING_ERROR
+from Logger.ToolError import UPT_DB_UPDATE_ERROR
+import platform as pf
+
+## IpiDb
+#
+# This class represents the installed package information database
+# Add/Remove/Get installed distribution package information here.
+#
+#
+# @param object: Inherited from object class
+# @param DbPath: A string for the path of the database
+#
+#
+class IpiDatabase(object):
+ def __init__(self, DbPath, Workspace):
+ Dir = os.path.dirname(DbPath)
+ if not os.path.isdir(Dir):
+ os.mkdir(Dir)
+ self.Conn = sqlite3.connect(u''.join(DbPath), isolation_level='DEFERRED')
+ self.Conn.execute("PRAGMA page_size=4096")
+ self.Conn.execute("PRAGMA synchronous=OFF")
+ self.Cur = self.Conn.cursor()
+ self.DpTable = 'DpInfo'
+ self.PkgTable = 'PkgInfo'
+ self.ModInPkgTable = 'ModInPkgInfo'
+ self.StandaloneModTable = 'StandaloneModInfo'
+ self.ModDepexTable = 'ModDepexInfo'
+ self.DpFileListTable = 'DpFileListInfo'
+ self.DummyTable = 'Dummy'
+ self.Workspace = os.path.normpath(Workspace)
+
+ ## Initialize build database
+ #
+ #
+ def InitDatabase(self, SkipLock = False):
+ Logger.Verbose(ST.MSG_INIT_IPI_START)
+ if not SkipLock:
+ try:
+ #
+ # Create a dummy table, if already existed,
+ # then UPT is already running
+ #
+ SqlCommand = """
+ create table %s (
+ Dummy TEXT NOT NULL,
+ PRIMARY KEY (Dummy)
+ )""" % self.DummyTable
+ self.Cur.execute(SqlCommand)
+ self.Conn.commit()
+ except sqlite3.OperationalError:
+ Logger.Error("UPT",
+ UPT_ALREADY_RUNNING_ERROR,
+ ST.ERR_UPT_ALREADY_RUNNING_ERROR
+ )
+
+ #
+ # Create new table
+ #
+ SqlCommand = """
+ create table IF NOT EXISTS %s (
+ DpGuid TEXT NOT NULL,DpVersion TEXT NOT NULL,
+ InstallTime REAL NOT NULL,
+ NewPkgFileName TEXT NOT NULL,
+ PkgFileName TEXT NOT NULL,
+ RePackage TEXT NOT NULL,
+ PRIMARY KEY (DpGuid, DpVersion)
+ )""" % self.DpTable
+ self.Cur.execute(SqlCommand)
+
+ SqlCommand = """
+ create table IF NOT EXISTS %s (
+ FilePath TEXT NOT NULL,
+ DpGuid TEXT,
+ DpVersion TEXT,
+ Md5Sum TEXT,
+ PRIMARY KEY (FilePath)
+ )""" % self.DpFileListTable
+ self.Cur.execute(SqlCommand)
+
+ SqlCommand = """
+ create table IF NOT EXISTS %s (
+ PackageGuid TEXT NOT NULL,
+ PackageVersion TEXT NOT NULL,
+ InstallTime REAL NOT NULL,
+ DpGuid TEXT,
+ DpVersion TEXT,
+ InstallPath TEXT NOT NULL,
+ PRIMARY KEY (PackageGuid, PackageVersion, InstallPath)
+ )""" % self.PkgTable
+ self.Cur.execute(SqlCommand)
+
+ SqlCommand = """
+ create table IF NOT EXISTS %s (
+ ModuleGuid TEXT NOT NULL,
+ ModuleVersion TEXT NOT NULL,
+ ModuleName TEXT NOT NULL,
+ InstallTime REAL NOT NULL,
+ PackageGuid TEXT,
+ PackageVersion TEXT,
+ InstallPath TEXT NOT NULL,
+ PRIMARY KEY (ModuleGuid, ModuleVersion, ModuleName, InstallPath)
+ )""" % self.ModInPkgTable
+ self.Cur.execute(SqlCommand)
+
+ SqlCommand = """
+ create table IF NOT EXISTS %s (
+ ModuleGuid TEXT NOT NULL,
+ ModuleVersion TEXT NOT NULL,
+ ModuleName TEXT NOT NULL,
+ InstallTime REAL NOT NULL,
+ DpGuid TEXT,
+ DpVersion TEXT,
+ InstallPath TEXT NOT NULL,
+ PRIMARY KEY (ModuleGuid, ModuleVersion, ModuleName, InstallPath)
+ )""" % self.StandaloneModTable
+ self.Cur.execute(SqlCommand)
+
+ SqlCommand = """
+ create table IF NOT EXISTS %s (
+ ModuleGuid TEXT NOT NULL,
+ ModuleVersion TEXT NOT NULL,
+ ModuleName TEXT NOT NULL,
+ InstallPath TEXT NOT NULL,
+ DepexGuid TEXT,
+ DepexVersion TEXT
+ )""" % self.ModDepexTable
+ self.Cur.execute(SqlCommand)
+
+ self.Conn.commit()
+
+ Logger.Verbose(ST.MSG_INIT_IPI_FINISH)
+
+ def RollBack(self):
+ self.Conn.rollback()
+
+ def Commit(self):
+ self.Conn.commit()
+
+ ## Add a distribution install information from DpObj
+ #
+ # @param DpObj:
+ # @param NewDpPkgFileName: New DpPkg File Name
+ # @param DpPkgFileName: DpPkg File Name
+ # @param RePackage: A RePackage
+ #
+ def AddDPObject(self, DpObj, NewDpPkgFileName, DpPkgFileName, RePackage):
+ try:
+ for PkgKey in DpObj.PackageSurfaceArea.keys():
+ PkgGuid = PkgKey[0]
+ PkgVersion = PkgKey[1]
+ PkgInstallPath = PkgKey[2]
+ self._AddPackage(PkgGuid, PkgVersion, DpObj.Header.GetGuid(), \
+ DpObj.Header.GetVersion(), PkgInstallPath)
+ PkgObj = DpObj.PackageSurfaceArea[PkgKey]
+ for ModKey in PkgObj.GetModuleDict().keys():
+ ModGuid = ModKey[0]
+ ModVersion = ModKey[1]
+ ModName = ModKey[2]
+ ModInstallPath = ModKey[3]
+ ModInstallPath = \
+ os.path.normpath(os.path.join(PkgInstallPath, ModInstallPath))
+ self._AddModuleInPackage(ModGuid, ModVersion, ModName, PkgGuid, \
+ PkgVersion, ModInstallPath)
+ ModObj = PkgObj.GetModuleDict()[ModKey]
+ for Dep in ModObj.GetPackageDependencyList():
+ DepexGuid = Dep.GetGuid()
+ DepexVersion = Dep.GetVersion()
+ self._AddModuleDepex(ModGuid, ModVersion, ModName, ModInstallPath, \
+ DepexGuid, DepexVersion)
+ for (FilePath, Md5Sum) in PkgObj.FileList:
+ self._AddDpFilePathList(DpObj.Header.GetGuid(), \
+ DpObj.Header.GetVersion(), FilePath, \
+ Md5Sum)
+
+ for ModKey in DpObj.ModuleSurfaceArea.keys():
+ ModGuid = ModKey[0]
+ ModVersion = ModKey[1]
+ ModName = ModKey[2]
+ ModInstallPath = ModKey[3]
+ self._AddStandaloneModule(ModGuid, ModVersion, ModName, \
+ DpObj.Header.GetGuid(), \
+ DpObj.Header.GetVersion(), \
+ ModInstallPath)
+ ModObj = DpObj.ModuleSurfaceArea[ModKey]
+ for Dep in ModObj.GetPackageDependencyList():
+ DepexGuid = Dep.GetGuid()
+ DepexVersion = Dep.GetVersion()
+ self._AddModuleDepex(ModGuid, ModVersion, ModName, ModInstallPath, \
+ DepexGuid, DepexVersion)
+ for (Path, Md5Sum) in ModObj.FileList:
+ self._AddDpFilePathList(DpObj.Header.GetGuid(), \
+ DpObj.Header.GetVersion(), \
+ Path, Md5Sum)
+
+ #
+ # add tool/misc files
+ #
+ for (Path, Md5Sum) in DpObj.FileList:
+ self._AddDpFilePathList(DpObj.Header.GetGuid(), \
+ DpObj.Header.GetVersion(), Path, Md5Sum)
+
+ self._AddDp(DpObj.Header.GetGuid(), DpObj.Header.GetVersion(), \
+ NewDpPkgFileName, DpPkgFileName, RePackage)
+
+ except sqlite3.IntegrityError as DetailMsg:
+ Logger.Error("UPT",
+ UPT_DB_UPDATE_ERROR,
+ ST.ERR_UPT_DB_UPDATE_ERROR,
+ ExtraData = DetailMsg
+ )
+
+ ## Add a distribution install information
+ #
+ # @param Guid Guid of the distribution package
+ # @param Version Version of the distribution package
+ # @param NewDpFileName the saved filename of distribution package file
+ # @param DistributionFileName the filename of distribution package file
+ #
+ def _AddDp(self, Guid, Version, NewDpFileName, DistributionFileName, \
+ RePackage):
+
+ if Version is None or len(Version.strip()) == 0:
+ Version = 'N/A'
+
+ #
+ # Add newly installed DP information to DB.
+ #
+ if NewDpFileName is None or len(NewDpFileName.strip()) == 0:
+ PkgFileName = 'N/A'
+ else:
+ PkgFileName = NewDpFileName
+ CurrentTime = time.time()
+ SqlCommand = \
+ """insert into %s values('%s', '%s', %s, '%s', '%s', '%s')""" % \
+ (self.DpTable, Guid, Version, CurrentTime, PkgFileName, \
+ DistributionFileName, str(RePackage).upper())
+ self.Cur.execute(SqlCommand)
+
+
+ ## Add a file list from DP
+ #
+ # @param DpGuid: A DpGuid
+ # @param DpVersion: A DpVersion
+ # @param Path: A Path
+ # @param Path: A Md5Sum
+ #
+ def _AddDpFilePathList(self, DpGuid, DpVersion, Path, Md5Sum):
+ Path = os.path.normpath(Path)
+ if pf.system() == 'Windows':
+ if Path.startswith(self.Workspace):
+ Path = Path[len(self.Workspace):]
+ else:
+ if Path.startswith(self.Workspace + os.sep):
+ Path = Path[len(self.Workspace)+1:]
+ SqlCommand = """insert into %s values('%s', '%s', '%s', '%s')""" % \
+ (self.DpFileListTable, Path, DpGuid, DpVersion, Md5Sum)
+
+ self.Cur.execute(SqlCommand)
+
+ ## Add a package install information
+ #
+ # @param Guid: A package guid
+ # @param Version: A package version
+ # @param DpGuid: A DpGuid
+ # @param DpVersion: A DpVersion
+ # @param Path: A Path
+ #
+ def _AddPackage(self, Guid, Version, DpGuid=None, DpVersion=None, Path=''):
+
+ if Version is None or len(Version.strip()) == 0:
+ Version = 'N/A'
+
+ if DpGuid is None or len(DpGuid.strip()) == 0:
+ DpGuid = 'N/A'
+
+ if DpVersion is None or len(DpVersion.strip()) == 0:
+ DpVersion = 'N/A'
+
+ #
+ # Add newly installed package information to DB.
+ #
+ CurrentTime = time.time()
+ SqlCommand = \
+ """insert into %s values('%s', '%s', %s, '%s', '%s', '%s')""" % \
+ (self.PkgTable, Guid, Version, CurrentTime, DpGuid, DpVersion, Path)
+ self.Cur.execute(SqlCommand)
+
+ ## Add a module that from a package install information
+ #
+ # @param Guid: Module Guid
+ # @param Version: Module version
+ # @param Name: Module Name
+ # @param PkgGuid: Package Guid
+ # @param PkgVersion: Package version
+ # @param Path: Package relative path that module installs
+ #
+ def _AddModuleInPackage(self, Guid, Version, Name, PkgGuid=None, \
+ PkgVersion=None, Path=''):
+
+ if Version is None or len(Version.strip()) == 0:
+ Version = 'N/A'
+
+ if PkgGuid is None or len(PkgGuid.strip()) == 0:
+ PkgGuid = 'N/A'
+
+ if PkgVersion is None or len(PkgVersion.strip()) == 0:
+ PkgVersion = 'N/A'
+
+ if os.name == 'posix':
+ Path = Path.replace('\\', os.sep)
+ else:
+ Path = Path.replace('/', os.sep)
+
+ #
+ # Add module from package information to DB.
+ #
+ CurrentTime = time.time()
+ SqlCommand = \
+ """insert into %s values('%s', '%s', '%s', %s, '%s', '%s', '%s')""" % \
+ (self.ModInPkgTable, Guid, Version, Name, CurrentTime, PkgGuid, PkgVersion, \
+ Path)
+ self.Cur.execute(SqlCommand)
+
+ ## Add a module that is standalone install information
+ #
+ # @param Guid: a module Guid
+ # @param Version: a module Version
+ # @param Name: a module name
+ # @param DpGuid: a DpGuid
+ # @param DpVersion: a DpVersion
+ # @param Path: path
+ #
+ def _AddStandaloneModule(self, Guid, Version, Name, DpGuid=None, \
+ DpVersion=None, Path=''):
+
+ if Version is None or len(Version.strip()) == 0:
+ Version = 'N/A'
+
+ if DpGuid is None or len(DpGuid.strip()) == 0:
+ DpGuid = 'N/A'
+
+ if DpVersion is None or len(DpVersion.strip()) == 0:
+ DpVersion = 'N/A'
+
+ #
+ # Add module standalone information to DB.
+ #
+ CurrentTime = time.time()
+ SqlCommand = \
+ """insert into %s values('%s', '%s', '%s', %s, '%s', '%s', '%s')""" % \
+ (self.StandaloneModTable, Guid, Version, Name, CurrentTime, DpGuid, \
+ DpVersion, Path)
+ self.Cur.execute(SqlCommand)
+
+ ## Add a module depex
+ #
+ # @param Guid: a module Guid
+ # @param Version: a module Version
+ # @param Name: a module name
+ # @param DepexGuid: a module DepexGuid
+ # @param DepexVersion: a module DepexVersion
+ #
+ def _AddModuleDepex(self, Guid, Version, Name, Path, DepexGuid=None, \
+ DepexVersion=None):
+
+ if DepexGuid is None or len(DepexGuid.strip()) == 0:
+ DepexGuid = 'N/A'
+
+ if DepexVersion is None or len(DepexVersion.strip()) == 0:
+ DepexVersion = 'N/A'
+
+ if os.name == 'posix':
+ Path = Path.replace('\\', os.sep)
+ else:
+ Path = Path.replace('/', os.sep)
+
+ #
+ # Add module depex information to DB.
+ #
+ SqlCommand = """insert into %s values('%s', '%s', '%s', '%s', '%s', '%s')"""\
+ % (self.ModDepexTable, Guid, Version, Name, Path, DepexGuid, DepexVersion)
+ self.Cur.execute(SqlCommand)
+
+ ## Remove a distribution install information, if no version specified,
+ # remove all DPs with this Guid.
+ #
+ # @param DpGuid: guid of dpex
+ # @param DpVersion: version of dpex
+ #
+ def RemoveDpObj(self, DpGuid, DpVersion):
+
+ PkgList = self.GetPackageListFromDp(DpGuid, DpVersion)
+ #
+ # delete from ModDepex the standalone module's dependency
+ #
+ SqlCommand = \
+ """delete from ModDepexInfo where ModDepexInfo.ModuleGuid in
+ (select ModuleGuid from StandaloneModInfo as B where B.DpGuid = '%s'
+ and B.DpVersion = '%s')
+ and ModDepexInfo.ModuleVersion in
+ (select ModuleVersion from StandaloneModInfo as B
+ where B.DpGuid = '%s' and B.DpVersion = '%s')
+ and ModDepexInfo.ModuleName in
+ (select ModuleName from StandaloneModInfo as B
+ where B.DpGuid = '%s' and B.DpVersion = '%s')
+ and ModDepexInfo.InstallPath in
+ (select InstallPath from StandaloneModInfo as B
+ where B.DpGuid = '%s' and B.DpVersion = '%s') """ % \
+ (DpGuid, DpVersion, DpGuid, DpVersion, DpGuid, DpVersion, DpGuid, DpVersion)
+
+ self.Cur.execute(SqlCommand)
+ #
+ # delete from ModDepex the from pkg module's dependency
+ #
+ for Pkg in PkgList:
+
+ SqlCommand = \
+ """delete from ModDepexInfo where ModDepexInfo.ModuleGuid in
+ (select ModuleGuid from ModInPkgInfo
+ where ModInPkgInfo.PackageGuid ='%s' and
+ ModInPkgInfo.PackageVersion = '%s')
+ and ModDepexInfo.ModuleVersion in
+ (select ModuleVersion from ModInPkgInfo
+ where ModInPkgInfo.PackageGuid ='%s' and
+ ModInPkgInfo.PackageVersion = '%s')
+ and ModDepexInfo.ModuleName in
+ (select ModuleName from ModInPkgInfo
+ where ModInPkgInfo.PackageGuid ='%s' and
+ ModInPkgInfo.PackageVersion = '%s')
+ and ModDepexInfo.InstallPath in
+ (select InstallPath from ModInPkgInfo where
+ ModInPkgInfo.PackageGuid ='%s'
+ and ModInPkgInfo.PackageVersion = '%s')""" \
+ % (Pkg[0], Pkg[1], Pkg[0], Pkg[1], Pkg[0], Pkg[1], Pkg[0], Pkg[1])
+
+ self.Cur.execute(SqlCommand)
+ #
+ # delete the standalone module
+ #
+ SqlCommand = \
+ """delete from %s where DpGuid ='%s' and DpVersion = '%s'""" % \
+ (self.StandaloneModTable, DpGuid, DpVersion)
+ self.Cur.execute(SqlCommand)
+ #
+ # delete the from pkg module
+ #
+ for Pkg in PkgList:
+ SqlCommand = \
+ """delete from %s where %s.PackageGuid ='%s'
+ and %s.PackageVersion = '%s'""" % \
+ (self.ModInPkgTable, self.ModInPkgTable, Pkg[0], \
+ self.ModInPkgTable, Pkg[1])
+ self.Cur.execute(SqlCommand)
+ #
+ # delete packages
+ #
+ SqlCommand = \
+ """delete from %s where DpGuid ='%s' and DpVersion = '%s'""" % \
+ (self.PkgTable, DpGuid, DpVersion)
+ self.Cur.execute(SqlCommand)
+ #
+ # delete file list from DP
+ #
+ SqlCommand = \
+ """delete from %s where DpGuid ='%s' and DpVersion = '%s'""" % \
+ (self.DpFileListTable, DpGuid, DpVersion)
+ self.Cur.execute(SqlCommand)
+ #
+ # delete DP
+ #
+ SqlCommand = \
+ """delete from %s where DpGuid ='%s' and DpVersion = '%s'""" % \
+ (self.DpTable, DpGuid, DpVersion)
+ self.Cur.execute(SqlCommand)
+
+ #self.Conn.commit()
+
+ ## Get a list of distribution install information.
+ #
+ # @param Guid: distribution package guid
+ # @param Version: distribution package version
+ #
+ def GetDp(self, Guid, Version):
+
+ if Version is None or len(Version.strip()) == 0:
+ Version = 'N/A'
+ Logger.Verbose(ST.MSG_GET_DP_INSTALL_LIST)
+ (DpGuid, DpVersion) = (Guid, Version)
+ SqlCommand = """select * from %s where DpGuid ='%s'""" % \
+ (self.DpTable, DpGuid)
+ self.Cur.execute(SqlCommand)
+
+ else:
+ Logger.Verbose(ST.MSG_GET_DP_INSTALL_INFO_START)
+ (DpGuid, DpVersion) = (Guid, Version)
+ SqlCommand = \
+ """select * from %s where DpGuid ='%s' and DpVersion = '%s'""" % \
+ (self.DpTable, DpGuid, DpVersion)
+ self.Cur.execute(SqlCommand)
+
+ DpList = []
+ for DpInfo in self.Cur:
+ DpGuid = DpInfo[0]
+ DpVersion = DpInfo[1]
+ InstallTime = DpInfo[2]
+ PkgFileName = DpInfo[3]
+ DpList.append((DpGuid, DpVersion, InstallTime, PkgFileName))
+
+ Logger.Verbose(ST.MSG_GET_DP_INSTALL_INFO_FINISH)
+ return DpList
+
+ ## Get a list of distribution install dirs
+ #
+ # @param Guid: distribution package guid
+ # @param Version: distribution package version
+ #
+ def GetDpInstallDirList(self, Guid, Version):
+ SqlCommand = """select InstallPath from PkgInfo where DpGuid = '%s' and DpVersion = '%s'""" % (Guid, Version)
+ self.Cur.execute(SqlCommand)
+ DirList = []
+ for Result in self.Cur:
+ if Result[0] not in DirList:
+ DirList.append(Result[0])
+
+ SqlCommand = """select InstallPath from StandaloneModInfo where DpGuid = '%s' and DpVersion = '%s'""" % \
+ (Guid, Version)
+ self.Cur.execute(SqlCommand)
+ for Result in self.Cur:
+ if Result[0] not in DirList:
+ DirList.append(Result[0])
+
+ return DirList
+
+
+ ## Get a list of distribution install file path information.
+ #
+ # @param Guid: distribution package guid
+ # @param Version: distribution package version
+ #
+ def GetDpFileList(self, Guid, Version):
+
+ (DpGuid, DpVersion) = (Guid, Version)
+ SqlCommand = \
+ """select * from %s where DpGuid ='%s' and DpVersion = '%s'""" % \
+ (self.DpFileListTable, DpGuid, DpVersion)
+ self.Cur.execute(SqlCommand)
+
+ PathList = []
+ for Result in self.Cur:
+ Path = Result[0]
+ Md5Sum = Result[3]
+ PathList.append((os.path.join(self.Workspace, Path), Md5Sum))
+
+ return PathList
+
+ ## Get files' repackage attribute if present that are installed into current workspace
+ #
+ # @retval FileDict: a Dict of file, key is file path, value is (DpGuid, DpVersion, NewDpFileName, RePackage)
+ #
+ def GetRePkgDict(self):
+ SqlCommand = """select * from %s """ % (self.DpTable)
+ self.Cur.execute(SqlCommand)
+
+ DpInfoList = []
+ for Result in self.Cur:
+ DpInfoList.append(Result)
+
+ FileDict = {}
+ for Result in DpInfoList:
+ DpGuid = Result[0]
+ DpVersion = Result[1]
+ NewDpFileName = Result[3]
+ RePackage = Result[5]
+ if RePackage == 'TRUE':
+ RePackage = True
+ else:
+ RePackage = False
+ for FileInfo in self.GetDpFileList(DpGuid, DpVersion):
+ PathInfo = FileInfo[0]
+ FileDict[PathInfo] = DpGuid, DpVersion, NewDpFileName, RePackage
+
+ return FileDict
+
+ ## Get (Guid, Version) from distribution file name information.
+ #
+ # @param DistributionFile: Distribution File
+ #
+ def GetDpByName(self, DistributionFile):
+ SqlCommand = """select * from %s where NewPkgFileName = '%s'""" % \
+ (self.DpTable, DistributionFile)
+ self.Cur.execute(SqlCommand)
+
+ for Result in self.Cur:
+ DpGuid = Result[0]
+ DpVersion = Result[1]
+ NewDpFileName = Result[3]
+
+ return (DpGuid, DpVersion, NewDpFileName)
+ else:
+ return (None, None, None)
+
+ ## Get a list of package information.
+ #
+ # @param Guid: package guid
+ # @param Version: package version
+ #
+ def GetPackage(self, Guid, Version, DpGuid='', DpVersion=''):
+
+ if DpVersion == '' or DpGuid == '':
+
+ (PackageGuid, PackageVersion) = (Guid, Version)
+ SqlCommand = """select * from %s where PackageGuid ='%s'
+ and PackageVersion = '%s'""" % (self.PkgTable, PackageGuid, \
+ PackageVersion)
+ self.Cur.execute(SqlCommand)
+
+ elif Version is None or len(Version.strip()) == 0:
+
+ SqlCommand = """select * from %s where PackageGuid ='%s'""" % \
+ (self.PkgTable, Guid)
+ self.Cur.execute(SqlCommand)
+ else:
+ (PackageGuid, PackageVersion) = (Guid, Version)
+ SqlCommand = """select * from %s where PackageGuid ='%s' and
+ PackageVersion = '%s'
+ and DpGuid = '%s' and DpVersion = '%s'""" % \
+ (self.PkgTable, PackageGuid, PackageVersion, \
+ DpGuid, DpVersion)
+ self.Cur.execute(SqlCommand)
+
+ PkgList = []
+ for PkgInfo in self.Cur:
+ PkgGuid = PkgInfo[0]
+ PkgVersion = PkgInfo[1]
+ InstallTime = PkgInfo[2]
+ InstallPath = PkgInfo[5]
+ PkgList.append((PkgGuid, PkgVersion, InstallTime, DpGuid, \
+ DpVersion, InstallPath))
+
+ return PkgList
+
+
+ ## Get a list of module in package information.
+ #
+ # @param Guid: A module guid
+ # @param Version: A module version
+ #
+ def GetModInPackage(self, Guid, Version, Name, Path, PkgGuid='', PkgVersion=''):
+ (ModuleGuid, ModuleVersion, ModuleName, InstallPath) = (Guid, Version, Name, Path)
+ if PkgVersion == '' or PkgGuid == '':
+ SqlCommand = """select * from %s where ModuleGuid ='%s' and
+ ModuleVersion = '%s' and InstallPath = '%s'
+ and ModuleName = '%s'""" % (self.ModInPkgTable, ModuleGuid, \
+ ModuleVersion, InstallPath, ModuleName)
+ self.Cur.execute(SqlCommand)
+ else:
+ SqlCommand = """select * from %s where ModuleGuid ='%s' and
+ ModuleVersion = '%s' and InstallPath = '%s'
+ and ModuleName = '%s' and PackageGuid ='%s'
+ and PackageVersion = '%s'
+ """ % (self.ModInPkgTable, ModuleGuid, \
+ ModuleVersion, InstallPath, ModuleName, PkgGuid, PkgVersion)
+ self.Cur.execute(SqlCommand)
+
+ ModList = []
+ for ModInfo in self.Cur:
+ ModGuid = ModInfo[0]
+ ModVersion = ModInfo[1]
+ InstallTime = ModInfo[2]
+ InstallPath = ModInfo[5]
+ ModList.append((ModGuid, ModVersion, InstallTime, PkgGuid, \
+ PkgVersion, InstallPath))
+
+ return ModList
+
+ ## Get a list of module standalone.
+ #
+ # @param Guid: A module guid
+ # @param Version: A module version
+ #
+ def GetStandaloneModule(self, Guid, Version, Name, Path, DpGuid='', DpVersion=''):
+ (ModuleGuid, ModuleVersion, ModuleName, InstallPath) = (Guid, Version, Name, Path)
+ if DpGuid == '':
+ SqlCommand = """select * from %s where ModuleGuid ='%s' and
+ ModuleVersion = '%s' and InstallPath = '%s'
+ and ModuleName = '%s'""" % (self.StandaloneModTable, ModuleGuid, \
+ ModuleVersion, InstallPath, ModuleName)
+ self.Cur.execute(SqlCommand)
+
+ else:
+ SqlCommand = """select * from %s where ModuleGuid ='%s' and
+ ModuleVersion = '%s' and InstallPath = '%s' and ModuleName = '%s' and DpGuid ='%s' and DpVersion = '%s'
+ """ % (self.StandaloneModTable, ModuleGuid, \
+ ModuleVersion, ModuleName, InstallPath, DpGuid, DpVersion)
+ self.Cur.execute(SqlCommand)
+
+ ModList = []
+ for ModInfo in self.Cur:
+ ModGuid = ModInfo[0]
+ ModVersion = ModInfo[1]
+ InstallTime = ModInfo[2]
+ InstallPath = ModInfo[5]
+ ModList.append((ModGuid, ModVersion, InstallTime, DpGuid, \
+ DpVersion, InstallPath))
+
+ return ModList
+
+ ## Get a list of module information that comes from DP.
+ #
+ # @param DpGuid: A Distribution Guid
+ # @param DpVersion: A Distribution version
+ #
+ def GetSModInsPathListFromDp(self, DpGuid, DpVersion):
+
+ PathList = []
+ SqlCommand = """select InstallPath from %s where DpGuid ='%s'
+ and DpVersion = '%s'
+ """ % (self.StandaloneModTable, DpGuid, DpVersion)
+ self.Cur.execute(SqlCommand)
+
+ for Result in self.Cur:
+ InstallPath = Result[0]
+ PathList.append(InstallPath)
+
+ return PathList
+
+ ## Get a list of package information.
+ #
+ # @param DpGuid: A Distribution Guid
+ # @param DpVersion: A Distribution version
+ #
+ def GetPackageListFromDp(self, DpGuid, DpVersion):
+
+ SqlCommand = """select * from %s where DpGuid ='%s' and
+ DpVersion = '%s' """ % (self.PkgTable, DpGuid, DpVersion)
+ self.Cur.execute(SqlCommand)
+
+ PkgList = []
+ for PkgInfo in self.Cur:
+ PkgGuid = PkgInfo[0]
+ PkgVersion = PkgInfo[1]
+ InstallPath = PkgInfo[5]
+ PkgList.append((PkgGuid, PkgVersion, InstallPath))
+
+ return PkgList
+
+ ## Get a list of modules that depends on package information from a DP.
+ #
+ # @param DpGuid: A Distribution Guid
+ # @param DpVersion: A Distribution version
+ #
+ def GetDpDependentModuleList(self, DpGuid, DpVersion):
+
+ ModList = []
+ PkgList = self.GetPackageListFromDp(DpGuid, DpVersion)
+ if len(PkgList) > 0:
+ return ModList
+
+ for Pkg in PkgList:
+ #
+ # get all in-package modules that depends on current
+ # Pkg (Guid match, Version match or NA) but not belong to
+ # current Pkg
+ #
+ SqlCommand = """select t1.ModuleGuid, t1.ModuleVersion,
+ t1.InstallPath from %s as t1, %s as t2 where
+ t1.ModuleGuid = t2.ModuleGuid and
+ t1.ModuleVersion = t2.ModuleVersion and t2.DepexGuid ='%s'
+ and (t2.DepexVersion = '%s' or t2.DepexVersion = 'N/A') and
+ t1.PackageGuid != '%s' and t1.PackageVersion != '%s'
+ """ % (self.ModInPkgTable, \
+ self.ModDepexTable, Pkg[0], Pkg[1], Pkg[0], \
+ Pkg[1])
+ self.Cur.execute(SqlCommand)
+ for ModInfo in self.Cur:
+ ModGuid = ModInfo[0]
+ ModVersion = ModInfo[1]
+ InstallPath = ModInfo[2]
+ ModList.append((ModGuid, ModVersion, InstallPath))
+
+ #
+ # get all modules from standalone modules that depends on current
+ #Pkg (Guid match, Version match or NA) but not in current dp
+ #
+ SqlCommand = \
+ """select t1.ModuleGuid, t1.ModuleVersion, t1.InstallPath
+ from %s as t1, %s as t2 where t1.ModuleGuid = t2.ModuleGuid and
+ t1.ModuleVersion = t2.ModuleVersion and t2.DepexGuid ='%s'
+ and (t2.DepexVersion = '%s' or t2.DepexVersion = 'N/A') and
+ t1.DpGuid != '%s' and t1.DpVersion != '%s'
+ """ % \
+ (self.StandaloneModTable, self.ModDepexTable, Pkg[0], \
+ Pkg[1], DpGuid, DpVersion)
+ self.Cur.execute(SqlCommand)
+ for ModInfo in self.Cur:
+ ModGuid = ModInfo[0]
+ ModVersion = ModInfo[1]
+ InstallPath = ModInfo[2]
+ ModList.append((ModGuid, ModVersion, InstallPath))
+
+
+ return ModList
+
+ ## Get Dp's list of modules.
+ #
+ # @param DpGuid: A Distribution Guid
+ # @param DpVersion: A Distribution version
+ #
+ def GetDpModuleList(self, DpGuid, DpVersion):
+ ModList = []
+ #
+ # get Dp module list from the DpFileList table
+ #
+ SqlCommand = """select FilePath
+ from %s
+ where DpGuid = '%s' and DpVersion = '%s' and
+ FilePath like '%%.inf'
+ """ % (self.DpFileListTable, DpGuid, DpVersion)
+ self.Cur.execute(SqlCommand)
+ for ModuleInfo in self.Cur:
+ FilePath = ModuleInfo[0]
+ ModList.append(os.path.join(self.Workspace, FilePath))
+
+ return ModList
+
+
+ ## Get a module depex
+ #
+ # @param DpGuid: A module Guid
+ # @param DpVersion: A module version
+ # @param Path:
+ #
+ def GetModuleDepex(self, Guid, Version, Path):
+
+ #
+ # Get module depex information to DB.
+ #
+ SqlCommand = """select * from %s where ModuleGuid ='%s' and
+ ModuleVersion = '%s' and InstallPath ='%s'
+ """ % (self.ModDepexTable, Guid, Version, Path)
+ self.Cur.execute(SqlCommand)
+
+
+ DepexList = []
+ for DepInfo in self.Cur:
+ DepexGuid = DepInfo[3]
+ DepexVersion = DepInfo[4]
+ DepexList.append((DepexGuid, DepexVersion))
+
+ return DepexList
+
+ ## Inventory the distribution installed to current workspace
+ #
+ # Inventory the distribution installed to current workspace
+ #
+ def InventoryDistInstalled(self):
+ SqlCommand = """select * from %s """ % (self.DpTable)
+ self.Cur.execute(SqlCommand)
+
+ DpInfoList = []
+ for Result in self.Cur:
+ DpGuid = Result[0]
+ DpVersion = Result[1]
+ DpAliasName = Result[3]
+ DpFileName = Result[4]
+ DpInfoList.append((DpGuid, DpVersion, DpFileName, DpAliasName))
+
+ return DpInfoList
+
+ ## Close entire database
+ #
+ # Close the connection and cursor
+ #
+ def CloseDb(self):
+ #
+ # drop the dummy table
+ #
+ SqlCommand = """
+ drop table IF EXISTS %s
+ """ % self.DummyTable
+ self.Cur.execute(SqlCommand)
+ self.Conn.commit()
+
+ self.Cur.close()
+ self.Conn.close()
+
+ ## Convert To Sql String
+ #
+ # 1. Replace "'" with "''" in each item of StringList
+ #
+ # @param StringList: A list for strings to be converted
+ #
+ def __ConvertToSqlString(self, StringList):
+ if self.DpTable:
+ pass
+ return list(map(lambda s: s.replace("'", "''"), StringList))
+
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Core/PackageFile.py b/roms/edk2/BaseTools/Source/Python/UPT/Core/PackageFile.py
new file mode 100644
index 000000000..c9157e84d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Core/PackageFile.py
@@ -0,0 +1,250 @@
+## @file
+#
+# PackageFile class represents the zip file of a distribution package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+PackageFile
+'''
+
+##
+# Import Modules
+#
+import os.path
+import zipfile
+import tempfile
+import platform
+
+from Logger.ToolError import FILE_OPEN_FAILURE
+from Logger.ToolError import FILE_CHECKSUM_FAILURE
+from Logger.ToolError import FILE_NOT_FOUND
+from Logger.ToolError import FILE_DECOMPRESS_FAILURE
+from Logger.ToolError import FILE_UNKNOWN_ERROR
+from Logger.ToolError import FILE_WRITE_FAILURE
+from Logger.ToolError import FILE_COMPRESS_FAILURE
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Library.Misc import CreateDirectory
+from Library.Misc import RemoveDirectory
+from Core.FileHook import __FileHookOpen__
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+
+
+class PackageFile:
+ def __init__(self, FileName, Mode="r"):
+ self._FileName = FileName
+ if Mode not in ["r", "w", "a"]:
+ Mode = "r"
+ try:
+ self._ZipFile = zipfile.ZipFile(FileName, Mode, \
+ zipfile.ZIP_DEFLATED)
+ self._Files = {}
+ for Filename in self._ZipFile.namelist():
+ self._Files[os.path.normpath(Filename)] = Filename
+ except BaseException as Xstr:
+ Logger.Error("PackagingTool", FILE_OPEN_FAILURE,
+ ExtraData="%s (%s)" % (FileName, str(Xstr)))
+
+ BadFile = self._ZipFile.testzip()
+ if BadFile is not None:
+ Logger.Error("PackagingTool", FILE_CHECKSUM_FAILURE,
+ ExtraData="[%s] in %s" % (BadFile, FileName))
+
+ def GetZipFile(self):
+ return self._ZipFile
+
+ ## Get file name
+ #
+ def __str__(self):
+ return self._FileName
+
+ ## Extract the file
+ #
+ # @param To: the destination file
+ #
+ def Unpack(self, ToDest):
+ for FileN in self._ZipFile.namelist():
+ ToFile = os.path.normpath(os.path.join(ToDest, FileN))
+ Msg = "%s -> %s" % (FileN, ToFile)
+ Logger.Info(Msg)
+ self.Extract(FileN, ToFile)
+
+ ## Extract the file
+ #
+ # @param File: the extracted file
+ # @param ToFile: the destination file
+ #
+ def UnpackFile(self, File, ToFile):
+ File = File.replace('\\', '/')
+ if File in self._ZipFile.namelist():
+ Msg = "%s -> %s" % (File, ToFile)
+ Logger.Info(Msg)
+ self.Extract(File, ToFile)
+ return ToFile
+
+ return ''
+
+ ## Extract the file
+ #
+ # @param Which: the source path
+ # @param ToDest: the destination path
+ #
+ def Extract(self, Which, ToDest):
+ Which = os.path.normpath(Which)
+ if Which not in self._Files:
+ Logger.Error("PackagingTool", FILE_NOT_FOUND,
+ ExtraData="[%s] in %s" % (Which, self._FileName))
+ try:
+ FileContent = self._ZipFile.read(self._Files[Which])
+ except BaseException as Xstr:
+ Logger.Error("PackagingTool", FILE_DECOMPRESS_FAILURE,
+ ExtraData="[%s] in %s (%s)" % (Which, \
+ self._FileName, \
+ str(Xstr)))
+ try:
+ CreateDirectory(os.path.dirname(ToDest))
+ if os.path.exists(ToDest) and not os.access(ToDest, os.W_OK):
+ Logger.Warn("PackagingTool", \
+ ST.WRN_FILE_NOT_OVERWRITTEN % ToDest)
+ return
+ else:
+ ToFile = __FileHookOpen__(ToDest, 'wb')
+ except BaseException as Xstr:
+ Logger.Error("PackagingTool", FILE_OPEN_FAILURE,
+ ExtraData="%s (%s)" % (ToDest, str(Xstr)))
+
+ try:
+ ToFile.write(FileContent)
+ ToFile.close()
+ except BaseException as Xstr:
+ Logger.Error("PackagingTool", FILE_WRITE_FAILURE,
+ ExtraData="%s (%s)" % (ToDest, str(Xstr)))
+
+ ## Remove the file
+ #
+ # @param Files: the removed files
+ #
+ def Remove(self, Files):
+ TmpDir = os.path.join(tempfile.gettempdir(), ".packaging")
+ if os.path.exists(TmpDir):
+ RemoveDirectory(TmpDir, True)
+
+ os.mkdir(TmpDir)
+ self.Unpack(TmpDir)
+ for SinF in Files:
+ SinF = os.path.normpath(SinF)
+ if SinF not in self._Files:
+ Logger.Error("PackagingTool", FILE_NOT_FOUND,
+ ExtraData="%s is not in %s!" % \
+ (SinF, self._FileName))
+ self._Files.pop(SinF)
+ self._ZipFile.close()
+
+ self._ZipFile = zipfile.ZipFile(self._FileName, "w", \
+ zipfile.ZIP_DEFLATED)
+ Cwd = os.getcwd()
+ os.chdir(TmpDir)
+ self.PackFiles(self._Files)
+ os.chdir(Cwd)
+ RemoveDirectory(TmpDir, True)
+
+ ## Pack the files under Top directory, the directory shown in the zipFile start from BaseDir,
+ # BaseDir should be the parent directory of the Top directory, for example,
+ # Pack(Workspace\Dir1, Workspace) will pack files under Dir1, and the path in the zipfile will
+ # start from Workspace
+ #
+ # @param Top: the top directory
+ # @param BaseDir: the base directory
+ #
+ def Pack(self, Top, BaseDir):
+ if not os.path.isdir(Top):
+ Logger.Error("PackagingTool", FILE_UNKNOWN_ERROR, \
+ "%s is not a directory!" %Top)
+
+ FilesToPack = []
+ Cwd = os.getcwd()
+ os.chdir(BaseDir)
+ RelaDir = Top[Top.upper().find(BaseDir.upper()).\
+ join(len(BaseDir).join(1)):]
+
+ for Root, Dirs, Files in os.walk(RelaDir):
+ if 'CVS' in Dirs:
+ Dirs.remove('CVS')
+ if '.svn' in Dirs:
+ Dirs.remove('.svn')
+
+ for Dir in Dirs:
+ if Dir.startswith('.'):
+ Dirs.remove(Dir)
+ for File1 in Files:
+ if File1.startswith('.'):
+ continue
+ ExtName = os.path.splitext(File1)[1]
+ #
+ # skip '.dec', '.inf', '.dsc', '.fdf' files
+ #
+ if ExtName.lower() in ['.dec', '.inf', '.dsc', '.fdf']:
+ continue
+ FilesToPack.append(os.path.join(Root, File1))
+ self.PackFiles(FilesToPack)
+ os.chdir(Cwd)
+
+ ## Pack the file
+ #
+ # @param Files: the files to pack
+ #
+ def PackFiles(self, Files):
+ for File in Files:
+ Cwd = os.getcwd()
+ os.chdir(mws.getWs(mws.WORKSPACE, File))
+ self.PackFile(File)
+ os.chdir(Cwd)
+
+ ## Pack the file
+ #
+ # @param File: the files to pack
+ # @param ArcName: the Arc Name
+ #
+ def PackFile(self, File, ArcName=None):
+ try:
+ #
+ # avoid packing same file multiple times
+ #
+ if platform.system() != 'Windows':
+ File = File.replace('\\', '/')
+ ZipedFilesNameList = self._ZipFile.namelist()
+ for ZipedFile in ZipedFilesNameList:
+ if File == os.path.normpath(ZipedFile):
+ return
+ Logger.Info("packing ..." + File)
+ self._ZipFile.write(File, ArcName)
+ except BaseException as Xstr:
+ Logger.Error("PackagingTool", FILE_COMPRESS_FAILURE,
+ ExtraData="%s (%s)" % (File, str(Xstr)))
+
+ ## Write data to the packed file
+ #
+ # @param Data: data to write
+ # @param ArcName: the Arc Name
+ #
+ def PackData(self, Data, ArcName):
+ try:
+ if os.path.splitext(ArcName)[1].lower() == '.pkg':
+ Data = Data.encode('utf_8')
+ self._ZipFile.writestr(ArcName, Data)
+ except BaseException as Xstr:
+ Logger.Error("PackagingTool", FILE_COMPRESS_FAILURE,
+ ExtraData="%s (%s)" % (ArcName, str(Xstr)))
+
+ ## Close file
+ #
+ #
+ def Close(self):
+ self._ZipFile.close()
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Core/__init__.py b/roms/edk2/BaseTools/Source/Python/UPT/Core/__init__.py
new file mode 100644
index 000000000..9af96f9c3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Core/__init__.py
@@ -0,0 +1,14 @@
+## @file
+# Python 'Library' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Core init file
+'''
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenDecFile.py b/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenDecFile.py
new file mode 100644
index 000000000..91952a5fe
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenDecFile.py
@@ -0,0 +1,683 @@
+## @file GenDecFile.py
+#
+# This file contained the logical of transfer package object to DEC files.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+GenDEC
+'''
+import os
+import stat
+import codecs
+from hashlib import md5
+from Core.FileHook import __FileHookOpen__
+from Library.Parsing import GenSection
+from Library.CommentGenerating import GenHeaderCommentSection
+from Library.CommentGenerating import GenGenericCommentF
+from Library.CommentGenerating import GenDecTailComment
+from Library.CommentGenerating import _GetHelpStr
+from Library.Misc import GuidStringToGuidStructureString
+from Library.Misc import SaveFileOnChange
+from Library.Misc import ConvertPath
+from Library.Misc import GetLocalValue
+from Library.DataType import TAB_SPACE_SPLIT
+from Library.DataType import TAB_COMMA_SPLIT
+from Library.DataType import END_OF_LINE
+from Library.DataType import TAB_ARCH_COMMON
+from Library.DataType import TAB_VALUE_SPLIT
+from Library.DataType import TAB_COMMENT_SPLIT
+from Library.DataType import TAB_PCD_VALIDRANGE
+from Library.DataType import TAB_PCD_VALIDLIST
+from Library.DataType import TAB_PCD_EXPRESSION
+from Library.DataType import TAB_DEC_DEFINES_DEC_SPECIFICATION
+from Library.DataType import TAB_DEC_DEFINES_PACKAGE_NAME
+from Library.DataType import TAB_DEC_DEFINES_PACKAGE_GUID
+from Library.DataType import TAB_DEC_DEFINES_PACKAGE_VERSION
+from Library.DataType import TAB_DEC_DEFINES_PKG_UNI_FILE
+from Library.DataType import TAB_DEC_PACKAGE_ABSTRACT
+from Library.DataType import TAB_DEC_PACKAGE_DESCRIPTION
+from Library.DataType import TAB_DEC_BINARY_ABSTRACT
+from Library.DataType import TAB_DEC_BINARY_DESCRIPTION
+from Library.DataType import TAB_LANGUAGE_EN_X
+from Library.DataType import TAB_BINARY_HEADER_USERID
+from Library.DataType import TAB_BINARY_HEADER_IDENTIFIER
+from Library.DataType import TAB_COMMENT_EDK1_SPLIT
+from Library.DataType import TAB_ENCODING_UTF16LE
+from Library.DataType import TAB_CAPHEX_START
+from Library.DataType import TAB_HEX_START
+from Library.DataType import TAB_UNDERLINE_SPLIT
+from Library.DataType import TAB_STR_TOKENERR
+from Library.DataType import TAB_STR_TOKENCNAME
+from Library.DataType import TAB_PCD_ERROR_SECTION_COMMENT
+from Library.DataType import TAB_PCD_ERROR
+from Library.DataType import TAB_SECTION_START
+from Library.DataType import TAB_SECTION_END
+from Library.DataType import TAB_SPLIT
+import Library.DataType as DT
+from Library.UniClassObject import FormatUniEntry
+from Library.StringUtils import GetUniFileName
+
+def GenPcd(Package, Content):
+ #
+ # generate [Pcd] section
+ # <TokenSpcCName>.<TokenCName>|<Value>|<DatumType>|<Token>
+ #
+ ValidUsageDict = {}
+ for Pcd in Package.GetPcdList():
+ #
+ # Generate generic comment
+ #
+ HelpTextList = Pcd.GetHelpTextList()
+ HelpStr = _GetHelpStr(HelpTextList)
+ CommentStr = GenGenericCommentF(HelpStr, 2)
+
+ PromptList = Pcd.GetPromptList()
+ PromptStr = _GetHelpStr(PromptList)
+ CommentStr += GenGenericCommentF(PromptStr.strip(), 1, True)
+
+ PcdErrList = Pcd.GetPcdErrorsList()
+ for PcdErr in PcdErrList:
+ CommentStr += GenPcdErrComment(PcdErr)
+ Statement = CommentStr
+
+ CName = Pcd.GetCName()
+ TokenSpaceGuidCName = Pcd.GetTokenSpaceGuidCName()
+ DefaultValue = Pcd.GetDefaultValue()
+ DatumType = Pcd.GetDatumType()
+ Token = Pcd.GetToken()
+ ValidUsage = Pcd.GetValidUsage()
+
+ if ValidUsage == 'FeaturePcd':
+ ValidUsage = 'PcdsFeatureFlag'
+ elif ValidUsage == 'PatchPcd':
+ ValidUsage = 'PcdsPatchableInModule'
+ elif ValidUsage == 'FixedPcd':
+ ValidUsage = 'PcdsFixedAtBuild'
+ elif ValidUsage == 'Pcd':
+ ValidUsage = 'PcdsDynamic'
+ elif ValidUsage == 'PcdEx':
+ ValidUsage = 'PcdsDynamicEx'
+
+ if ValidUsage in ValidUsageDict:
+ NewSectionDict = ValidUsageDict[ValidUsage]
+ else:
+ NewSectionDict = {}
+ ValidUsageDict[ValidUsage] = NewSectionDict
+ Statement += TokenSpaceGuidCName + '.' + CName
+ Statement += '|' + DefaultValue
+ Statement += '|' + DatumType
+ Statement += '|' + Token
+ #
+ # generate tail comment
+ #
+ if Pcd.GetSupModuleList():
+ Statement += GenDecTailComment(Pcd.GetSupModuleList())
+
+ ArchList = sorted(Pcd.GetSupArchList())
+ SortedArch = ' '.join(ArchList)
+ if SortedArch in NewSectionDict:
+ NewSectionDict[SortedArch] = \
+ NewSectionDict[SortedArch] + [Statement]
+ else:
+ NewSectionDict[SortedArch] = [Statement]
+
+ for ValidUsage in ValidUsageDict:
+ Content += GenSection(ValidUsage, ValidUsageDict[ValidUsage], True, True)
+
+ return Content
+
+def GenPcdErrorMsgSection(Package, Content):
+ if not Package.PcdErrorCommentDict:
+ return Content
+
+ #
+ # Generate '# [Error.<TokenSpcCName>]' section
+ #
+ Content += END_OF_LINE + END_OF_LINE
+ SectionComment = TAB_COMMENT_SPLIT + END_OF_LINE
+ SectionComment += TAB_COMMENT_SPLIT + TAB_SPACE_SPLIT + TAB_PCD_ERROR_SECTION_COMMENT + END_OF_LINE
+ SectionComment += TAB_COMMENT_SPLIT + END_OF_LINE
+ TokenSpcCNameList = []
+
+ #
+ # Get TokenSpcCName list in PcdErrorCommentDict in Package object
+ #
+ for (TokenSpcCName, ErrorNumber) in Package.PcdErrorCommentDict:
+ if TokenSpcCName not in TokenSpcCNameList:
+ TokenSpcCNameList.append(TokenSpcCName)
+
+ for TokenSpcCNameItem in TokenSpcCNameList:
+ SectionName = TAB_COMMENT_SPLIT + TAB_SPACE_SPLIT + TAB_SECTION_START + TAB_PCD_ERROR + \
+ TAB_SPLIT + TokenSpcCNameItem + TAB_SECTION_END + END_OF_LINE
+ Content += SectionComment
+ Content += SectionName
+ for (TokenSpcCName, ErrorNumber) in Package.PcdErrorCommentDict:
+ if TokenSpcCNameItem == TokenSpcCName:
+ PcdErrorMsg = GetLocalValue(Package.PcdErrorCommentDict[(TokenSpcCName, ErrorNumber)])
+ SectionItem = TAB_COMMENT_SPLIT + TAB_SPACE_SPLIT + TAB_SPACE_SPLIT + \
+ ErrorNumber + TAB_SPACE_SPLIT + TAB_VALUE_SPLIT + TAB_SPACE_SPLIT + \
+ PcdErrorMsg + END_OF_LINE
+ Content += SectionItem
+
+ Content += TAB_COMMENT_SPLIT
+ return Content
+
+def GenGuidProtocolPpi(Package, Content):
+ #
+ # generate [Guids] section
+ #
+ NewSectionDict = {}
+
+ LeftOffset = 46
+ # Get the line offset need
+ # If the real one < the min one, use the min one
+ # else use the real one
+ for Guid in Package.GetGuidList():
+ if len(Guid.GetCName()) > LeftOffset:
+ LeftOffset = len(Guid.GetCName())
+
+ # Generate
+ for Guid in Package.GetGuidList():
+ #
+ # Generate generic comment
+ #
+ HelpTextList = Guid.GetHelpTextList()
+ HelpStr = _GetHelpStr(HelpTextList)
+ CommentStr = GenGenericCommentF(HelpStr, 2)
+
+ Statement = CommentStr
+ CName = Guid.GetCName()
+ Value = GuidStringToGuidStructureString(Guid.GetGuid())
+ Statement += CName.ljust(LeftOffset) + ' = ' + Value
+ #
+ # generate tail comment
+ #
+ if Guid.GetSupModuleList():
+ Statement += GenDecTailComment(Guid.GetSupModuleList())
+ ArchList = sorted(Guid.GetSupArchList())
+ SortedArch = ' '.join(ArchList)
+ if SortedArch in NewSectionDict:
+ NewSectionDict[SortedArch] = \
+ NewSectionDict[SortedArch] + [Statement]
+ else:
+ NewSectionDict[SortedArch] = [Statement]
+
+ Content += GenSection('Guids', NewSectionDict, True, True)
+
+ #
+ # generate [Protocols] section
+ #
+ NewSectionDict = {}
+ LeftOffset = 46
+ # Get the line offset need
+ # If the real one < the min one, use the min one
+ # else use the real one
+ for Protocol in Package.GetProtocolList():
+ if len(Protocol.GetCName()) > LeftOffset:
+ LeftOffset = len(Protocol.GetCName())
+
+ for Protocol in Package.GetProtocolList():
+ #
+ # Generate generic comment
+ #
+ HelpTextList = Protocol.GetHelpTextList()
+ HelpStr = _GetHelpStr(HelpTextList)
+ CommentStr = GenGenericCommentF(HelpStr, 2)
+
+ Statement = CommentStr
+ CName = Protocol.GetCName()
+ Value = GuidStringToGuidStructureString(Protocol.GetGuid())
+ Statement += CName.ljust(LeftOffset) + ' = ' + Value
+
+ #
+ # generate tail comment
+ #
+ if Protocol.GetSupModuleList():
+ Statement += GenDecTailComment(Protocol.GetSupModuleList())
+ ArchList = sorted(Protocol.GetSupArchList())
+ SortedArch = ' '.join(ArchList)
+ if SortedArch in NewSectionDict:
+ NewSectionDict[SortedArch] = \
+ NewSectionDict[SortedArch] + [Statement]
+ else:
+ NewSectionDict[SortedArch] = [Statement]
+
+ Content += GenSection('Protocols', NewSectionDict, True, True)
+
+ #
+ # generate [Ppis] section
+ #
+ NewSectionDict = {}
+ LeftOffset = 46
+ # Get the line offset need
+ # If the real one < the min one, use the min one
+ # else use the real one
+ for Ppi in Package.GetPpiList():
+ if len(Ppi.GetCName()) > LeftOffset:
+ LeftOffset = len(Ppi.GetCName())
+
+ for Ppi in Package.GetPpiList():
+ #
+ # Generate generic comment
+ #
+ HelpTextList = Ppi.GetHelpTextList()
+ HelpStr = _GetHelpStr(HelpTextList)
+ CommentStr = GenGenericCommentF(HelpStr, 2)
+
+ Statement = CommentStr
+ CName = Ppi.GetCName()
+ Value = GuidStringToGuidStructureString(Ppi.GetGuid())
+ Statement += CName.ljust(LeftOffset) + ' = ' + Value
+
+ #
+ # generate tail comment
+ #
+ if Ppi.GetSupModuleList():
+ Statement += GenDecTailComment(Ppi.GetSupModuleList())
+ ArchList = sorted(Ppi.GetSupArchList())
+ SortedArch = ' '.join(ArchList)
+ if SortedArch in NewSectionDict:
+ NewSectionDict[SortedArch] = \
+ NewSectionDict[SortedArch] + [Statement]
+ else:
+ NewSectionDict[SortedArch] = [Statement]
+
+ Content += GenSection('Ppis', NewSectionDict, True, True)
+
+ return Content
+
+## Transfer Package Object to Dec files
+#
+# Transfer all contents of a standard Package Object to a Dec file
+#
+# @param Package: A Package
+#
+def PackageToDec(Package, DistHeader = None):
+ #
+ # Init global information for the file
+ #
+ ContainerFile = Package.GetFullPath()
+
+ Content = ''
+
+ #
+ # Generate file header
+ #
+ PackageAbstract = GetLocalValue(Package.GetAbstract())
+ PackageDescription = GetLocalValue(Package.GetDescription())
+ PackageCopyright = ''
+ PackageLicense = ''
+ for (Lang, Copyright) in Package.GetCopyright():
+ if Lang:
+ pass
+ PackageCopyright = Copyright
+ for (Lang, License) in Package.GetLicense():
+ if Lang:
+ pass
+ PackageLicense = License
+ if not PackageAbstract and DistHeader:
+ PackageAbstract = GetLocalValue(DistHeader.GetAbstract())
+ if not PackageDescription and DistHeader:
+ PackageDescription = GetLocalValue(DistHeader.GetDescription())
+ if not PackageCopyright and DistHeader:
+ for (Lang, Copyright) in DistHeader.GetCopyright():
+ PackageCopyright = Copyright
+ if not PackageLicense and DistHeader:
+ for (Lang, License) in DistHeader.GetLicense():
+ PackageLicense = License
+
+ #
+ # Generate header comment section of DEC file
+ #
+ Content += GenHeaderCommentSection(PackageAbstract, \
+ PackageDescription, \
+ PackageCopyright, \
+ PackageLicense).replace('\r\n', '\n')
+
+ #
+ # Generate Binary header
+ #
+ for UserExtension in Package.GetUserExtensionList():
+ if UserExtension.GetUserID() == TAB_BINARY_HEADER_USERID \
+ and UserExtension.GetIdentifier() == TAB_BINARY_HEADER_IDENTIFIER:
+ PackageBinaryAbstract = GetLocalValue(UserExtension.GetBinaryAbstract())
+ PackageBinaryDescription = GetLocalValue(UserExtension.GetBinaryDescription())
+ PackageBinaryCopyright = ''
+ PackageBinaryLicense = ''
+ for (Lang, Copyright) in UserExtension.GetBinaryCopyright():
+ PackageBinaryCopyright = Copyright
+ for (Lang, License) in UserExtension.GetBinaryLicense():
+ PackageBinaryLicense = License
+ if PackageBinaryAbstract and PackageBinaryDescription and \
+ PackageBinaryCopyright and PackageBinaryLicense:
+ Content += GenHeaderCommentSection(PackageBinaryAbstract,
+ PackageBinaryDescription,
+ PackageBinaryCopyright,
+ PackageBinaryLicense,
+ True)
+
+ #
+ # Generate PACKAGE_UNI_FILE for the Package
+ #
+ FileHeader = GenHeaderCommentSection(PackageAbstract, PackageDescription, PackageCopyright, PackageLicense, False, \
+ TAB_COMMENT_EDK1_SPLIT)
+ GenPackageUNIEncodeFile(Package, FileHeader)
+
+ #
+ # for each section, maintain a dict, sorted arch will be its key,
+ #statement list will be its data
+ # { 'Arch1 Arch2 Arch3': [statement1, statement2],
+ # 'Arch1' : [statement1, statement3]
+ # }
+ #
+
+ #
+ # generate [Defines] section
+ #
+ LeftOffset = 31
+ NewSectionDict = {TAB_ARCH_COMMON : []}
+ SpecialItemList = []
+
+ Statement = (u'%s ' % TAB_DEC_DEFINES_DEC_SPECIFICATION).ljust(LeftOffset) + u'= %s' % '0x00010017'
+ SpecialItemList.append(Statement)
+
+ BaseName = Package.GetBaseName()
+ if BaseName.startswith('.') or BaseName.startswith('-'):
+ BaseName = '_' + BaseName
+ Statement = (u'%s ' % TAB_DEC_DEFINES_PACKAGE_NAME).ljust(LeftOffset) + u'= %s' % BaseName
+ SpecialItemList.append(Statement)
+
+ Statement = (u'%s ' % TAB_DEC_DEFINES_PACKAGE_VERSION).ljust(LeftOffset) + u'= %s' % Package.GetVersion()
+ SpecialItemList.append(Statement)
+
+ Statement = (u'%s ' % TAB_DEC_DEFINES_PACKAGE_GUID).ljust(LeftOffset) + u'= %s' % Package.GetGuid()
+ SpecialItemList.append(Statement)
+
+ if Package.UNIFlag:
+ Statement = (u'%s ' % TAB_DEC_DEFINES_PKG_UNI_FILE).ljust(LeftOffset) + u'= %s' % Package.GetBaseName() + '.uni'
+ SpecialItemList.append(Statement)
+
+ for SortedArch in NewSectionDict:
+ NewSectionDict[SortedArch] = \
+ NewSectionDict[SortedArch] + SpecialItemList
+ Content += GenSection('Defines', NewSectionDict)
+
+ #
+ # generate [Includes] section
+ #
+ NewSectionDict = {}
+ IncludeArchList = Package.GetIncludeArchList()
+ if IncludeArchList:
+ for Path, ArchList in IncludeArchList:
+ Statement = Path
+ ArchList.sort()
+ SortedArch = ' '.join(ArchList)
+ if SortedArch in NewSectionDict:
+ NewSectionDict[SortedArch] = \
+ NewSectionDict[SortedArch] + [ConvertPath(Statement)]
+ else:
+ NewSectionDict[SortedArch] = [ConvertPath(Statement)]
+
+ Content += GenSection('Includes', NewSectionDict)
+
+ #
+ # generate [guids][protocols][ppis] sections
+ #
+ Content = GenGuidProtocolPpi(Package, Content)
+
+ #
+ # generate [LibraryClasses] section
+ #
+ NewSectionDict = {}
+ for LibraryClass in Package.GetLibraryClassList():
+ #
+ # Generate generic comment
+ #
+ HelpTextList = LibraryClass.GetHelpTextList()
+ HelpStr = _GetHelpStr(HelpTextList)
+ if HelpStr:
+ HelpStr = '@libraryclass' + HelpStr
+ CommentStr = GenGenericCommentF(HelpStr, 2, False, True)
+
+ Statement = CommentStr
+ Name = LibraryClass.GetLibraryClass()
+ IncludeHeader = LibraryClass.GetIncludeHeader()
+ Statement += Name + '|' + ConvertPath(IncludeHeader)
+ #
+ # generate tail comment
+ #
+ if LibraryClass.GetSupModuleList():
+ Statement += \
+ GenDecTailComment(LibraryClass.GetSupModuleList())
+ ArchList = sorted(LibraryClass.GetSupArchList())
+ SortedArch = ' '.join(ArchList)
+ if SortedArch in NewSectionDict:
+ NewSectionDict[SortedArch] = \
+ NewSectionDict[SortedArch] + [Statement]
+ else:
+ NewSectionDict[SortedArch] = [Statement]
+
+ Content += GenSection('LibraryClasses', NewSectionDict, True, True)
+
+ #
+ # Generate '# [Error.<TokenSpcCName>]' section
+ #
+ Content = GenPcdErrorMsgSection(Package, Content)
+
+ Content = GenPcd(Package, Content)
+
+ #
+ # generate [UserExtensions] section
+ #
+ NewSectionDict = {}
+ for UserExtension in Package.GetUserExtensionList():
+ if UserExtension.GetUserID() == TAB_BINARY_HEADER_USERID and \
+ UserExtension.GetIdentifier() == TAB_BINARY_HEADER_IDENTIFIER:
+ continue
+
+ # Generate Private Section first
+ if UserExtension.GetUserID() == DT.TAB_INTEL and UserExtension.GetIdentifier() == DT.TAB_PRIVATE:
+ Content += '\n' + UserExtension.GetStatement()
+ continue
+
+ Statement = UserExtension.GetStatement()
+ if not Statement:
+ continue
+ else:
+ LineList = Statement.split('\n')
+ NewStatement = ""
+ for Line in LineList:
+ NewStatement += " %s\n" % Line
+
+ SectionList = []
+ SectionName = 'UserExtensions'
+ UserId = UserExtension.GetUserID()
+ if UserId:
+ if '.' in UserId:
+ UserId = '"' + UserId + '"'
+ SectionName += '.' + UserId
+ if UserExtension.GetIdentifier():
+ SectionName += '.' + '"' + UserExtension.GetIdentifier() + '"'
+ if not UserExtension.GetSupArchList():
+ SectionList.append(SectionName)
+ else:
+ for Arch in UserExtension.GetSupArchList():
+ SectionList.append(SectionName + '.' + Arch)
+ SectionName = ', '.join(SectionList)
+ SectionName = ''.join(['[', SectionName, ']\n'])
+ Content += '\n' + SectionName + NewStatement
+
+ SaveFileOnChange(ContainerFile, Content, False)
+ if DistHeader.ReadOnly:
+ os.chmod(ContainerFile, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)
+ else:
+ os.chmod(ContainerFile, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH|stat.S_IWUSR|stat.S_IWGRP|stat.S_IWOTH)
+ return ContainerFile
+
+## GenPackageUNIEncodeFile
+# GenPackageUNIEncodeFile, default is a UCS-2LE encode file
+#
+def GenPackageUNIEncodeFile(PackageObject, UniFileHeader = '', Encoding=TAB_ENCODING_UTF16LE):
+ GenUNIFlag = False
+ OnlyLANGUAGE_EN_X = True
+ BinaryAbstract = []
+ BinaryDescription = []
+ #
+ # If more than one language code is used for any element that would be present in the PACKAGE_UNI_FILE,
+ # then the PACKAGE_UNI_FILE must be created.
+ #
+ for (Key, Value) in PackageObject.GetAbstract() + PackageObject.GetDescription():
+ if Key == TAB_LANGUAGE_EN_X:
+ GenUNIFlag = True
+ else:
+ OnlyLANGUAGE_EN_X = False
+
+ for UserExtension in PackageObject.GetUserExtensionList():
+ if UserExtension.GetUserID() == TAB_BINARY_HEADER_USERID \
+ and UserExtension.GetIdentifier() == TAB_BINARY_HEADER_IDENTIFIER:
+ for (Key, Value) in UserExtension.GetBinaryAbstract():
+ if Key == TAB_LANGUAGE_EN_X:
+ GenUNIFlag = True
+ else:
+ OnlyLANGUAGE_EN_X = False
+ BinaryAbstract.append((Key, Value))
+
+ for (Key, Value) in UserExtension.GetBinaryDescription():
+ if Key == TAB_LANGUAGE_EN_X:
+ GenUNIFlag = True
+ else:
+ OnlyLANGUAGE_EN_X = False
+ BinaryDescription.append((Key, Value))
+
+ for Pcd in PackageObject.GetPcdList():
+ for TxtObj in Pcd.GetPromptList() + Pcd.GetHelpTextList():
+ if TxtObj.GetLang() == TAB_LANGUAGE_EN_X:
+ GenUNIFlag = True
+ else:
+ OnlyLANGUAGE_EN_X = False
+
+ for PcdError in Pcd.GetPcdErrorsList():
+ if PcdError.GetErrorNumber().startswith('0x') or PcdError.GetErrorNumber().startswith('0X'):
+ for (Key, Value) in PcdError.GetErrorMessageList():
+ if Key == TAB_LANGUAGE_EN_X:
+ GenUNIFlag = True
+ else:
+ OnlyLANGUAGE_EN_X = False
+ if not GenUNIFlag:
+ return
+ elif OnlyLANGUAGE_EN_X:
+ return
+ else:
+ PackageObject.UNIFlag = True
+
+ if not os.path.exists(os.path.dirname(PackageObject.GetFullPath())):
+ os.makedirs(os.path.dirname(PackageObject.GetFullPath()))
+
+ ContainerFile = GetUniFileName(os.path.dirname(PackageObject.GetFullPath()), PackageObject.GetBaseName())
+
+ Content = UniFileHeader + '\r\n'
+ Content += '\r\n'
+
+ Content += FormatUniEntry('#string ' + TAB_DEC_PACKAGE_ABSTRACT, PackageObject.GetAbstract(), ContainerFile) + '\r\n'
+
+ Content += FormatUniEntry('#string ' + TAB_DEC_PACKAGE_DESCRIPTION, PackageObject.GetDescription(), ContainerFile) \
+ + '\r\n'
+
+ Content += FormatUniEntry('#string ' + TAB_DEC_BINARY_ABSTRACT, BinaryAbstract, ContainerFile) + '\r\n'
+
+ Content += FormatUniEntry('#string ' + TAB_DEC_BINARY_DESCRIPTION, BinaryDescription, ContainerFile) + '\r\n'
+
+ PromptGenList = []
+ HelpTextGenList = []
+ for Pcd in PackageObject.GetPcdList():
+ # Generate Prompt for each Pcd
+ PcdPromptStrName = '#string ' + 'STR_' + Pcd.GetTokenSpaceGuidCName() + '_' + Pcd.GetCName() + '_PROMPT '
+ TokenValueList = []
+ for TxtObj in Pcd.GetPromptList():
+ Lang = TxtObj.GetLang()
+ PromptStr = TxtObj.GetString()
+ #
+ # Avoid generating the same PROMPT entry more than one time.
+ #
+ if (PcdPromptStrName, Lang) not in PromptGenList:
+ TokenValueList.append((Lang, PromptStr))
+ PromptGenList.append((PcdPromptStrName, Lang))
+ PromptString = FormatUniEntry(PcdPromptStrName, TokenValueList, ContainerFile) + '\r\n'
+ if PromptString not in Content:
+ Content += PromptString
+
+ # Generate Help String for each Pcd
+ PcdHelpStrName = '#string ' + 'STR_' + Pcd.GetTokenSpaceGuidCName() + '_' + Pcd.GetCName() + '_HELP '
+ TokenValueList = []
+ for TxtObj in Pcd.GetHelpTextList():
+ Lang = TxtObj.GetLang()
+ HelpStr = TxtObj.GetString()
+ #
+ # Avoid generating the same HELP entry more than one time.
+ #
+ if (PcdHelpStrName, Lang) not in HelpTextGenList:
+ TokenValueList.append((Lang, HelpStr))
+ HelpTextGenList.append((PcdHelpStrName, Lang))
+ HelpTextString = FormatUniEntry(PcdHelpStrName, TokenValueList, ContainerFile) + '\r\n'
+ if HelpTextString not in Content:
+ Content += HelpTextString
+
+ # Generate PcdError for each Pcd if ErrorNo exist.
+ for PcdError in Pcd.GetPcdErrorsList():
+ ErrorNo = PcdError.GetErrorNumber()
+ if ErrorNo.startswith(TAB_HEX_START) or ErrorNo.startswith(TAB_CAPHEX_START):
+ PcdErrStrName = '#string ' + TAB_STR_TOKENCNAME + TAB_UNDERLINE_SPLIT + Pcd.GetTokenSpaceGuidCName() \
+ + TAB_UNDERLINE_SPLIT + TAB_STR_TOKENERR \
+ + TAB_UNDERLINE_SPLIT + ErrorNo[2:]
+ PcdErrString = FormatUniEntry(PcdErrStrName, PcdError.GetErrorMessageList(), ContainerFile) + '\r\n'
+ if PcdErrString not in Content:
+ Content += PcdErrString
+
+ File = codecs.open(ContainerFile, 'w', Encoding)
+ File.write(u'\uFEFF' + Content)
+ File.stream.close()
+ Md5Signature = md5(__FileHookOpen__(str(ContainerFile), 'rb').read())
+ Md5Sum = Md5Signature.hexdigest()
+ if (ContainerFile, Md5Sum) not in PackageObject.FileList:
+ PackageObject.FileList.append((ContainerFile, Md5Sum))
+
+ return ContainerFile
+
+## GenPcdErrComment
+#
+# @param PcdErrObject: PcdErrorObject
+#
+# @retval CommentStr: Generated comment lines, with prefix "#"
+#
+def GenPcdErrComment (PcdErrObject):
+ CommentStr = ''
+ ErrorCode = PcdErrObject.GetErrorNumber()
+ ValidValueRange = PcdErrObject.GetValidValueRange()
+ if ValidValueRange:
+ CommentStr = TAB_COMMENT_SPLIT + TAB_SPACE_SPLIT + TAB_PCD_VALIDRANGE + TAB_SPACE_SPLIT
+ if ErrorCode:
+ CommentStr += ErrorCode + TAB_SPACE_SPLIT + TAB_VALUE_SPLIT + TAB_SPACE_SPLIT
+ CommentStr += ValidValueRange + END_OF_LINE
+
+ ValidValue = PcdErrObject.GetValidValue()
+ if ValidValue:
+ ValidValueList = \
+ [Value for Value in ValidValue.split(TAB_SPACE_SPLIT) if Value]
+ CommentStr = TAB_COMMENT_SPLIT + TAB_SPACE_SPLIT + TAB_PCD_VALIDLIST + TAB_SPACE_SPLIT
+ if ErrorCode:
+ CommentStr += ErrorCode + TAB_SPACE_SPLIT + TAB_VALUE_SPLIT + TAB_SPACE_SPLIT
+ CommentStr += TAB_COMMA_SPLIT.join(ValidValueList) + END_OF_LINE
+
+ Expression = PcdErrObject.GetExpression()
+ if Expression:
+ CommentStr = TAB_COMMENT_SPLIT + TAB_SPACE_SPLIT + TAB_PCD_EXPRESSION + TAB_SPACE_SPLIT
+ if ErrorCode:
+ CommentStr += ErrorCode + TAB_SPACE_SPLIT + TAB_VALUE_SPLIT + TAB_SPACE_SPLIT
+ CommentStr += Expression + END_OF_LINE
+
+ return CommentStr
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py b/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
new file mode 100644
index 000000000..dd6184e04
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
@@ -0,0 +1,1122 @@
+## @file GenInfFile.py
+#
+# This file contained the logical of transfer package object to INF files.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+'''
+GenInf
+'''
+import os
+import stat
+import codecs
+from hashlib import md5
+from Core.FileHook import __FileHookOpen__
+from Library.StringUtils import GetSplitValueList
+from Library.Parsing import GenSection
+from Library.Parsing import GetWorkspacePackage
+from Library.Parsing import ConvertArchForInstall
+from Library.Misc import SaveFileOnChange
+from Library.Misc import IsAllModuleList
+from Library.Misc import Sdict
+from Library.Misc import ConvertPath
+from Library.Misc import ConvertSpec
+from Library.Misc import GetRelativePath
+from Library.Misc import GetLocalValue
+from Library.CommentGenerating import GenHeaderCommentSection
+from Library.CommentGenerating import GenGenericCommentF
+from Library.CommentGenerating import _GetHelpStr
+from Library import GlobalData
+from Logger import StringTable as ST
+from Logger import ToolError
+import Logger.Log as Logger
+from Library import DataType as DT
+from GenMetaFile import GenMetaFileMisc
+from Library.UniClassObject import FormatUniEntry
+from Library.StringUtils import GetUniFileName
+
+
+## Transfer Module Object to Inf files
+#
+# Transfer all contents of a standard Module Object to an Inf file
+# @param ModuleObject: A Module Object
+#
+def ModuleToInf(ModuleObject, PackageObject=None, DistHeader=None):
+ if not GlobalData.gWSPKG_LIST:
+ GlobalData.gWSPKG_LIST = GetWorkspacePackage()
+ #
+ # Init global information for the file
+ #
+ ContainerFile = ModuleObject.GetFullPath()
+
+ Content = ''
+ #
+ # Generate file header, If any Abstract, Description, Copyright or License XML elements are missing,
+ # should 1) use the Abstract, Description, Copyright or License from the PackageSurfaceArea.Header elements
+ # that the module belongs to, or 2) if this is a stand-alone module that is not included in a PackageSurfaceArea,
+ # use the abstract, description, copyright or license from the DistributionPackage.Header elements.
+ #
+ ModuleAbstract = GetLocalValue(ModuleObject.GetAbstract())
+ if not ModuleAbstract and PackageObject:
+ ModuleAbstract = GetLocalValue(PackageObject.GetAbstract())
+ if not ModuleAbstract and DistHeader:
+ ModuleAbstract = GetLocalValue(DistHeader.GetAbstract())
+ ModuleDescription = GetLocalValue(ModuleObject.GetDescription())
+ if not ModuleDescription and PackageObject:
+ ModuleDescription = GetLocalValue(PackageObject.GetDescription())
+ if not ModuleDescription and DistHeader:
+ ModuleDescription = GetLocalValue(DistHeader.GetDescription())
+ ModuleCopyright = ''
+ for (Lang, Copyright) in ModuleObject.GetCopyright():
+ if Lang:
+ pass
+ ModuleCopyright = Copyright
+ if not ModuleCopyright and PackageObject:
+ for (Lang, Copyright) in PackageObject.GetCopyright():
+ if Lang:
+ pass
+ ModuleCopyright = Copyright
+ if not ModuleCopyright and DistHeader:
+ for (Lang, Copyright) in DistHeader.GetCopyright():
+ if Lang:
+ pass
+ ModuleCopyright = Copyright
+ ModuleLicense = ''
+ for (Lang, License) in ModuleObject.GetLicense():
+ if Lang:
+ pass
+ ModuleLicense = License
+ if not ModuleLicense and PackageObject:
+ for (Lang, License) in PackageObject.GetLicense():
+ if Lang:
+ pass
+ ModuleLicense = License
+ if not ModuleLicense and DistHeader:
+ for (Lang, License) in DistHeader.GetLicense():
+ if Lang:
+ pass
+ ModuleLicense = License
+
+ #
+ # Generate header comment section of INF file
+ #
+ Content += GenHeaderCommentSection(ModuleAbstract,
+ ModuleDescription,
+ ModuleCopyright,
+ ModuleLicense).replace('\r\n', '\n')
+
+ #
+ # Generate Binary Header
+ #
+ for UserExtension in ModuleObject.GetUserExtensionList():
+ if UserExtension.GetUserID() == DT.TAB_BINARY_HEADER_USERID \
+ and UserExtension.GetIdentifier() == DT.TAB_BINARY_HEADER_IDENTIFIER:
+ ModuleBinaryAbstract = GetLocalValue(UserExtension.GetBinaryAbstract())
+ ModuleBinaryDescription = GetLocalValue(UserExtension.GetBinaryDescription())
+ ModuleBinaryCopyright = ''
+ ModuleBinaryLicense = ''
+ for (Lang, Copyright) in UserExtension.GetBinaryCopyright():
+ ModuleBinaryCopyright = Copyright
+ for (Lang, License) in UserExtension.GetBinaryLicense():
+ ModuleBinaryLicense = License
+ if ModuleBinaryAbstract and ModuleBinaryDescription and \
+ ModuleBinaryCopyright and ModuleBinaryLicense:
+ Content += GenHeaderCommentSection(ModuleBinaryAbstract,
+ ModuleBinaryDescription,
+ ModuleBinaryCopyright,
+ ModuleBinaryLicense,
+ True)
+
+ #
+ # Generate MODULE_UNI_FILE for module
+ #
+ FileHeader = GenHeaderCommentSection(ModuleAbstract, ModuleDescription, ModuleCopyright, ModuleLicense, False, \
+ DT.TAB_COMMENT_EDK1_SPLIT)
+ ModuleUniFile = GenModuleUNIEncodeFile(ModuleObject, FileHeader)
+ if ModuleUniFile:
+ ModuleObject.SetModuleUniFile(os.path.basename(ModuleUniFile))
+
+ #
+ # Judge whether the INF file is an AsBuild INF.
+ #
+ if ModuleObject.BinaryModule:
+ GlobalData.gIS_BINARY_INF = True
+ else:
+ GlobalData.gIS_BINARY_INF = False
+ #
+ # for each section, maintain a dict, sorted arch will be its key,
+ # statement list will be its data
+ # { 'Arch1 Arch2 Arch3': [statement1, statement2],
+ # 'Arch1' : [statement1, statement3]
+ # }
+ #
+ # Gen section contents
+ #
+ Content += GenDefines(ModuleObject)
+ Content += GenBuildOptions(ModuleObject)
+ Content += GenLibraryClasses(ModuleObject)
+ Content += GenPackages(ModuleObject)
+ Content += GenPcdSections(ModuleObject)
+ Content += GenSources(ModuleObject)
+ Content += GenProtocolPPiSections(ModuleObject.GetProtocolList(), True)
+ Content += GenProtocolPPiSections(ModuleObject.GetPpiList(), False)
+ Content += GenGuidSections(ModuleObject.GetGuidList())
+ Content += GenBinaries(ModuleObject)
+ Content += GenDepex(ModuleObject)
+ __UserExtensionsContent = GenUserExtensions(ModuleObject)
+ Content += __UserExtensionsContent
+ if ModuleObject.GetEventList() or ModuleObject.GetBootModeList() or ModuleObject.GetHobList():
+ Content += '\n'
+ #
+ # generate [Event], [BootMode], [Hob] section
+ #
+ Content += GenSpecialSections(ModuleObject.GetEventList(), 'Event', __UserExtensionsContent)
+ Content += GenSpecialSections(ModuleObject.GetBootModeList(), 'BootMode', __UserExtensionsContent)
+ Content += GenSpecialSections(ModuleObject.GetHobList(), 'Hob', __UserExtensionsContent)
+ SaveFileOnChange(ContainerFile, Content, False)
+ if DistHeader.ReadOnly:
+ os.chmod(ContainerFile, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)
+ else:
+ os.chmod(ContainerFile, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH|stat.S_IWUSR|stat.S_IWGRP|stat.S_IWOTH)
+ return ContainerFile
+
+## GenModuleUNIEncodeFile
+# GenModuleUNIEncodeFile, default is a UCS-2LE encode file
+#
+def GenModuleUNIEncodeFile(ModuleObject, UniFileHeader='', Encoding=DT.TAB_ENCODING_UTF16LE):
+ GenUNIFlag = False
+ OnlyLANGUAGE_EN_X = True
+ BinaryAbstract = []
+ BinaryDescription = []
+ #
+ # If more than one language code is used for any element that would be present in the MODULE_UNI_FILE,
+ # then the MODULE_UNI_FILE must be created.
+ #
+ for (Key, Value) in ModuleObject.GetAbstract() + ModuleObject.GetDescription():
+ if Key == DT.TAB_LANGUAGE_EN_X:
+ GenUNIFlag = True
+ else:
+ OnlyLANGUAGE_EN_X = False
+
+ for UserExtension in ModuleObject.GetUserExtensionList():
+ if UserExtension.GetUserID() == DT.TAB_BINARY_HEADER_USERID \
+ and UserExtension.GetIdentifier() == DT.TAB_BINARY_HEADER_IDENTIFIER:
+ for (Key, Value) in UserExtension.GetBinaryAbstract():
+ if Key == DT.TAB_LANGUAGE_EN_X:
+ GenUNIFlag = True
+ else:
+ OnlyLANGUAGE_EN_X = False
+ BinaryAbstract.append((Key, Value))
+ for (Key, Value) in UserExtension.GetBinaryDescription():
+ if Key == DT.TAB_LANGUAGE_EN_X:
+ GenUNIFlag = True
+ else:
+ OnlyLANGUAGE_EN_X = False
+ BinaryDescription.append((Key, Value))
+
+
+ if not GenUNIFlag:
+ return
+ elif OnlyLANGUAGE_EN_X:
+ return
+ else:
+ ModuleObject.UNIFlag = True
+ ContainerFile = GetUniFileName(os.path.dirname(ModuleObject.GetFullPath()), ModuleObject.GetBaseName())
+
+ if not os.path.exists(os.path.dirname(ModuleObject.GetFullPath())):
+ os.makedirs(os.path.dirname(ModuleObject.GetFullPath()))
+
+ Content = UniFileHeader + '\r\n'
+ Content += '\r\n'
+
+ Content += FormatUniEntry('#string ' + DT.TAB_INF_ABSTRACT, ModuleObject.GetAbstract(), ContainerFile) + '\r\n'
+
+ Content += FormatUniEntry('#string ' + DT.TAB_INF_DESCRIPTION, ModuleObject.GetDescription(), ContainerFile) \
+ + '\r\n'
+
+ BinaryAbstractString = FormatUniEntry('#string ' + DT.TAB_INF_BINARY_ABSTRACT, BinaryAbstract, ContainerFile)
+ if BinaryAbstractString:
+ Content += BinaryAbstractString + '\r\n'
+
+ BinaryDescriptionString = FormatUniEntry('#string ' + DT.TAB_INF_BINARY_DESCRIPTION, BinaryDescription, \
+ ContainerFile)
+ if BinaryDescriptionString:
+ Content += BinaryDescriptionString + '\r\n'
+
+ if not os.path.exists(ContainerFile):
+ File = codecs.open(ContainerFile, 'wb', Encoding)
+ File.write(u'\uFEFF' + Content)
+ File.stream.close()
+ Md5Signature = md5(__FileHookOpen__(str(ContainerFile), 'rb').read())
+ Md5Sum = Md5Signature.hexdigest()
+ if (ContainerFile, Md5Sum) not in ModuleObject.FileList:
+ ModuleObject.FileList.append((ContainerFile, Md5Sum))
+
+ return ContainerFile
+def GenDefines(ModuleObject):
+ #
+ # generate [Defines] section
+ #
+ LeftOffset = 31
+ Content = ''
+ NewSectionDict = {}
+
+ for UserExtension in ModuleObject.GetUserExtensionList():
+ DefinesDict = UserExtension.GetDefinesDict()
+ if not DefinesDict:
+ continue
+ for Statement in DefinesDict:
+ if len(Statement.split(DT.TAB_EQUAL_SPLIT)) > 1:
+ Statement = (u'%s ' % Statement.split(DT.TAB_EQUAL_SPLIT, 1)[0]).ljust(LeftOffset) \
+ + u'= %s' % Statement.split(DT.TAB_EQUAL_SPLIT, 1)[1].lstrip()
+ SortedArch = DT.TAB_ARCH_COMMON
+ if Statement.strip().startswith(DT.TAB_INF_DEFINES_CUSTOM_MAKEFILE):
+ pos = Statement.find(DT.TAB_VALUE_SPLIT)
+ if pos == -1:
+ pos = Statement.find(DT.TAB_EQUAL_SPLIT)
+ Makefile = ConvertPath(Statement[pos + 1:].strip())
+ Statement = Statement[:pos + 1] + ' ' + Makefile
+ if SortedArch in NewSectionDict:
+ NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [Statement]
+ else:
+ NewSectionDict[SortedArch] = [Statement]
+ SpecialStatementList = []
+
+ # TAB_INF_DEFINES_INF_VERSION
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_INF_VERSION).ljust(LeftOffset) + u'= %s' % '0x00010017'
+ SpecialStatementList.append(Statement)
+
+ # BaseName
+ BaseName = ModuleObject.GetBaseName()
+ if BaseName.startswith('.') or BaseName.startswith('-'):
+ BaseName = '_' + BaseName
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_BASE_NAME).ljust(LeftOffset) + u'= %s' % BaseName
+ SpecialStatementList.append(Statement)
+
+ # TAB_INF_DEFINES_FILE_GUID
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_FILE_GUID).ljust(LeftOffset) + u'= %s' % ModuleObject.GetGuid()
+ SpecialStatementList.append(Statement)
+
+ # TAB_INF_DEFINES_VERSION_STRING
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_VERSION_STRING).ljust(LeftOffset) + u'= %s' % ModuleObject.GetVersion()
+ SpecialStatementList.append(Statement)
+
+ # TAB_INF_DEFINES_VERSION_STRING
+ if ModuleObject.UNIFlag:
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_MODULE_UNI_FILE).ljust(LeftOffset) + \
+ u'= %s' % ModuleObject.GetModuleUniFile()
+ SpecialStatementList.append(Statement)
+
+ # TAB_INF_DEFINES_MODULE_TYPE
+ if ModuleObject.GetModuleType():
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_MODULE_TYPE).ljust(LeftOffset) + u'= %s' % ModuleObject.GetModuleType()
+ SpecialStatementList.append(Statement)
+
+ # TAB_INF_DEFINES_PCD_IS_DRIVER
+ if ModuleObject.GetPcdIsDriver():
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_PCD_IS_DRIVER).ljust(LeftOffset) + \
+ u'= %s' % ModuleObject.GetPcdIsDriver()
+ SpecialStatementList.append(Statement)
+
+ # TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION
+ if ModuleObject.GetUefiSpecificationVersion():
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION).ljust(LeftOffset) + \
+ u'= %s' % ModuleObject.GetUefiSpecificationVersion()
+ SpecialStatementList.append(Statement)
+
+ # TAB_INF_DEFINES_PI_SPECIFICATION_VERSION
+ if ModuleObject.GetPiSpecificationVersion():
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_PI_SPECIFICATION_VERSION).ljust(LeftOffset) + \
+ u'= %s' % ModuleObject.GetPiSpecificationVersion()
+ SpecialStatementList.append(Statement)
+
+ # LibraryClass
+ for LibraryClass in ModuleObject.GetLibraryClassList():
+ if LibraryClass.GetUsage() == DT.USAGE_ITEM_PRODUCES or \
+ LibraryClass.GetUsage() == DT.USAGE_ITEM_SOMETIMES_PRODUCES:
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_LIBRARY_CLASS).ljust(LeftOffset) + \
+ u'= %s' % LibraryClass.GetLibraryClass()
+ if LibraryClass.GetSupModuleList():
+ Statement += '|' + DT.TAB_SPACE_SPLIT.join(l for l in LibraryClass.GetSupModuleList())
+ SpecialStatementList.append(Statement)
+
+ # Spec Item
+ for SpecItem in ModuleObject.GetSpecList():
+ Spec, Version = SpecItem
+ Spec = ConvertSpec(Spec)
+ Statement = '%s %s = %s' % (DT.TAB_INF_DEFINES_SPEC, Spec, Version)
+ SpecialStatementList.append(Statement)
+
+ # Extern
+ ExternList = []
+ for Extern in ModuleObject.GetExternList():
+ ArchList = Extern.GetSupArchList()
+ EntryPoint = Extern.GetEntryPoint()
+ UnloadImage = Extern.GetUnloadImage()
+ Constructor = Extern.GetConstructor()
+ Destructor = Extern.GetDestructor()
+ HelpStringList = Extern.GetHelpTextList()
+ FFE = Extern.GetFeatureFlag()
+ ExternList.append([ArchList, EntryPoint, UnloadImage, Constructor, Destructor, FFE, HelpStringList])
+ #
+ # Add VALID_ARCHITECTURES information
+ #
+ ValidArchStatement = None
+ if ModuleObject.SupArchList:
+ ValidArchStatement = '\n' + '# ' + '\n'
+ ValidArchStatement += '# The following information is for reference only and not required by the build tools.\n'
+ ValidArchStatement += '# ' + '\n'
+ ValidArchStatement += '# VALID_ARCHITECTURES = %s' % (' '.join(ModuleObject.SupArchList)) + '\n'
+ ValidArchStatement += '# '
+ if DT.TAB_ARCH_COMMON not in NewSectionDict:
+ NewSectionDict[DT.TAB_ARCH_COMMON] = []
+ NewSectionDict[DT.TAB_ARCH_COMMON] = NewSectionDict[DT.TAB_ARCH_COMMON] + SpecialStatementList
+ GenMetaFileMisc.AddExternToDefineSec(NewSectionDict, DT.TAB_ARCH_COMMON, ExternList)
+ if ValidArchStatement is not None:
+ NewSectionDict[DT.TAB_ARCH_COMMON] = NewSectionDict[DT.TAB_ARCH_COMMON] + [ValidArchStatement]
+ Content += GenSection('Defines', NewSectionDict)
+ return Content
+
+def GenLibraryClasses(ModuleObject):
+ #
+ # generate [LibraryClasses] section
+ #
+ Content = ''
+ NewSectionDict = {}
+ if not GlobalData.gIS_BINARY_INF:
+ for LibraryClass in ModuleObject.GetLibraryClassList():
+ if LibraryClass.GetUsage() == DT.USAGE_ITEM_PRODUCES:
+ continue
+ #
+ # Generate generic comment
+ #
+ HelpTextList = LibraryClass.GetHelpTextList()
+ HelpStr = _GetHelpStr(HelpTextList)
+ CommentStr = GenGenericCommentF(HelpStr)
+ Statement = CommentStr
+ Name = LibraryClass.GetLibraryClass()
+ FFE = LibraryClass.GetFeatureFlag()
+ Statement += Name
+ if FFE:
+ Statement += '|' + FFE
+ ModuleList = LibraryClass.GetSupModuleList()
+ ArchList = LibraryClass.GetSupArchList()
+ for Index in range(0, len(ArchList)):
+ ArchList[Index] = ConvertArchForInstall(ArchList[Index])
+ ArchList.sort()
+ SortedArch = ' '.join(ArchList)
+ KeyList = []
+ if not ModuleList or IsAllModuleList(ModuleList):
+ KeyList = [SortedArch]
+ else:
+ ModuleString = DT.TAB_VALUE_SPLIT.join(l for l in ModuleList)
+ if not ArchList:
+ SortedArch = DT.TAB_ARCH_COMMON
+ KeyList = [SortedArch + '.' + ModuleString]
+ else:
+ KeyList = [Arch + '.' + ModuleString for Arch in ArchList]
+ for Key in KeyList:
+ if Key in NewSectionDict:
+ NewSectionDict[Key] = NewSectionDict[Key] + [Statement]
+ else:
+ NewSectionDict[Key] = [Statement]
+ Content += GenSection('LibraryClasses', NewSectionDict)
+ else:
+ LibraryClassDict = {}
+ for BinaryFile in ModuleObject.GetBinaryFileList():
+ if not BinaryFile.AsBuiltList:
+ continue
+ for LibraryItem in BinaryFile.AsBuiltList[0].LibraryInstancesList:
+ Statement = '# Guid: ' + LibraryItem.Guid + ' Version: ' + LibraryItem.Version
+
+ if len(BinaryFile.SupArchList) == 0:
+ if 'COMMON' in LibraryClassDict and Statement not in LibraryClassDict['COMMON']:
+ LibraryClassDict['COMMON'].append(Statement)
+ else:
+ LibraryClassDict['COMMON'] = ['## @LIB_INSTANCES']
+ LibraryClassDict['COMMON'].append(Statement)
+ else:
+ for Arch in BinaryFile.SupArchList:
+ if Arch in LibraryClassDict:
+ if Statement not in LibraryClassDict[Arch]:
+ LibraryClassDict[Arch].append(Statement)
+ else:
+ continue
+ else:
+ LibraryClassDict[Arch] = ['## @LIB_INSTANCES']
+ LibraryClassDict[Arch].append(Statement)
+ Content += GenSection('LibraryClasses', LibraryClassDict)
+
+ return Content
+
+def GenPackages(ModuleObject):
+ Content = ''
+ #
+ # generate [Packages] section
+ #
+ NewSectionDict = Sdict()
+ WorkspaceDir = GlobalData.gWORKSPACE
+ for PackageDependency in ModuleObject.GetPackageDependencyList():
+ #
+ # Generate generic comment
+ #
+ CommentStr = ''
+ HelpText = PackageDependency.GetHelpText()
+ if HelpText:
+ HelpStr = HelpText.GetString()
+ CommentStr = GenGenericCommentF(HelpStr)
+ Statement = CommentStr
+ Guid = PackageDependency.GetGuid()
+ Version = PackageDependency.GetVersion()
+ FFE = PackageDependency.GetFeatureFlag()
+ Path = ''
+ #
+ # find package path/name
+ #
+ for PkgInfo in GlobalData.gWSPKG_LIST:
+ if Guid == PkgInfo[1]:
+ if (not Version) or (Version == PkgInfo[2]):
+ Path = PkgInfo[3]
+ break
+ #
+ # get relative path
+ #
+ RelaPath = GetRelativePath(Path, WorkspaceDir)
+ Statement += RelaPath.replace('\\', '/')
+ if FFE:
+ Statement += '|' + FFE
+ ArchList = sorted(PackageDependency.GetSupArchList())
+ SortedArch = ' '.join(ArchList)
+ if SortedArch in NewSectionDict:
+ NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [Statement]
+ else:
+ NewSectionDict[SortedArch] = [Statement]
+ Content += GenSection('Packages', NewSectionDict)
+ return Content
+
+def GenSources(ModuleObject):
+ #
+ # generate [Sources] section
+ #
+ Content = ''
+ NewSectionDict = {}
+ for Source in ModuleObject.GetSourceFileList():
+ SourceFile = Source.GetSourceFile()
+ Family = Source.GetFamily()
+ FeatureFlag = Source.GetFeatureFlag()
+ SupArchList = sorted(Source.GetSupArchList())
+ SortedArch = ' '.join(SupArchList)
+ Statement = GenSourceStatement(ConvertPath(SourceFile), Family, FeatureFlag)
+ if SortedArch in NewSectionDict:
+ NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [Statement]
+ else:
+ NewSectionDict[SortedArch] = [Statement]
+ Content += GenSection('Sources', NewSectionDict)
+
+ return Content
+
+def GenDepex(ModuleObject):
+ #
+ # generate [Depex] section
+ #
+ NewSectionDict = Sdict()
+ Content = ''
+ for Depex in ModuleObject.GetPeiDepex() + ModuleObject.GetDxeDepex() + ModuleObject.GetSmmDepex():
+ HelpTextList = Depex.GetHelpTextList()
+ HelpStr = _GetHelpStr(HelpTextList)
+ CommentStr = GenGenericCommentF(HelpStr)
+ SupArchList = Depex.GetSupArchList()
+ SupModList = Depex.GetModuleType()
+ Expression = Depex.GetDepex()
+ Statement = CommentStr + Expression
+ SupArchList.sort()
+ KeyList = []
+ if not SupArchList:
+ SupArchList.append(DT.TAB_ARCH_COMMON.lower())
+ if not SupModList:
+ KeyList = SupArchList
+ else:
+ for ModuleType in SupModList:
+ for Arch in SupArchList:
+ KeyList.append(ConvertArchForInstall(Arch) + '.' + ModuleType)
+ for Key in KeyList:
+ if Key in NewSectionDict:
+ NewSectionDict[Key] = NewSectionDict[Key] + [Statement]
+ else:
+ NewSectionDict[Key] = [Statement]
+ Content += GenSection('Depex', NewSectionDict, False)
+
+ return Content
+## GenUserExtensions
+#
+# GenUserExtensions
+#
+def GenUserExtensions(ModuleObject):
+ NewSectionDict = {}
+ for UserExtension in ModuleObject.GetUserExtensionList():
+ if UserExtension.GetUserID() == DT.TAB_BINARY_HEADER_USERID and \
+ UserExtension.GetIdentifier() == DT.TAB_BINARY_HEADER_IDENTIFIER:
+ continue
+ if UserExtension.GetIdentifier() == 'Depex':
+ continue
+ Statement = UserExtension.GetStatement()
+# Comment the code to support user extension without any statement just the section header in []
+# if not Statement:
+# continue
+ ArchList = UserExtension.GetSupArchList()
+ for Index in range(0, len(ArchList)):
+ ArchList[Index] = ConvertArchForInstall(ArchList[Index])
+ ArchList.sort()
+ KeyList = []
+ CommonPreFix = ''
+ if UserExtension.GetUserID():
+ CommonPreFix = UserExtension.GetUserID()
+ if CommonPreFix.find('.') > -1:
+ CommonPreFix = '"' + CommonPreFix + '"'
+ if UserExtension.GetIdentifier():
+ CommonPreFix += '.' + '"' + UserExtension.GetIdentifier() + '"'
+ if ArchList:
+ KeyList = [CommonPreFix + '.' + Arch for Arch in ArchList]
+ else:
+ KeyList = [CommonPreFix]
+ for Key in KeyList:
+ if Key in NewSectionDict:
+ NewSectionDict[Key] = NewSectionDict[Key] + [Statement]
+ else:
+ NewSectionDict[Key] = [Statement]
+ Content = GenSection('UserExtensions', NewSectionDict, False)
+
+ return Content
+
+# GenSourceStatement
+#
+# @param SourceFile: string of source file path/name
+# @param Family: string of source file family field
+# @param FeatureFlag: string of source file FeatureFlag field
+# @param TagName: string of source file TagName field
+# @param ToolCode: string of source file ToolCode field
+# @param HelpStr: string of source file HelpStr field
+#
+# @retval Statement: The generated statement for source
+#
+def GenSourceStatement(SourceFile, Family, FeatureFlag, TagName=None,
+ ToolCode=None, HelpStr=None):
+ Statement = ''
+ if HelpStr:
+ Statement += GenGenericCommentF(HelpStr)
+ #
+ # format of SourceFile|Family|TagName|ToolCode|FeatureFlag
+ #
+ Statement += SourceFile
+ if TagName is None:
+ TagName = ''
+ if ToolCode is None:
+ ToolCode = ''
+ if HelpStr is None:
+ HelpStr = ''
+ if FeatureFlag:
+ Statement += '|' + Family + '|' + TagName + '|' + ToolCode + '|' + FeatureFlag
+ elif ToolCode:
+ Statement += '|' + Family + '|' + TagName + '|' + ToolCode
+ elif TagName:
+ Statement += '|' + Family + '|' + TagName
+ elif Family:
+ Statement += '|' + Family
+ return Statement
+
+# GenBinaryStatement
+#
+# @param Key: (FileName, FileType, FFE, SortedArch)
+# @param Value: (Target, Family, TagName, Comment)
+#
+#
+def GenBinaryStatement(Key, Value, SubTypeGuidValue=None):
+ (FileName, FileType, FFE, SortedArch) = Key
+ if SortedArch:
+ pass
+ if Value:
+ (Target, Family, TagName, Comment) = Value
+ else:
+ Target = ''
+ Family = ''
+ TagName = ''
+ Comment = ''
+ if Comment:
+ Statement = GenGenericCommentF(Comment)
+ else:
+ Statement = ''
+ if FileType == 'SUBTYPE_GUID' and SubTypeGuidValue:
+ Statement += FileType + '|' + SubTypeGuidValue + '|' + FileName
+ else:
+ Statement += FileType + '|' + FileName
+ if FileType in DT.BINARY_FILE_TYPE_UI_LIST + DT.BINARY_FILE_TYPE_VER_LIST:
+ if FFE:
+ Statement += '|' + Target + '|' + FFE
+ elif Target:
+ Statement += '|' + Target
+ else:
+ if FFE:
+ Statement += '|' + Target + '|' + Family + '|' + TagName + '|' + FFE
+ elif TagName:
+ Statement += '|' + Target + '|' + Family + '|' + TagName
+ elif Family:
+ Statement += '|' + Target + '|' + Family
+ elif Target:
+ Statement += '|' + Target
+ return Statement
+## GenGuidSections
+#
+# @param GuidObjList: List of GuidObject
+# @retVal Content: The generated section contents
+#
+def GenGuidSections(GuidObjList):
+ #
+ # generate [Guids] section
+ #
+ Content = ''
+ GuidDict = Sdict()
+ for Guid in GuidObjList:
+ HelpTextList = Guid.GetHelpTextList()
+ HelpStr = _GetHelpStr(HelpTextList)
+ CName = Guid.GetCName()
+ FFE = Guid.GetFeatureFlag()
+ Statement = CName
+ if FFE:
+ Statement += '|' + FFE
+ Usage = Guid.GetUsage()
+ GuidType = Guid.GetGuidTypeList()[0]
+ VariableName = Guid.GetVariableName()
+ #
+ # Differentiate the generic comment and usage comment as multiple generic comment need to be put at first
+ #
+ if Usage == DT.ITEM_UNDEFINED and GuidType == DT.ITEM_UNDEFINED:
+ # generate list of generic comment
+ Comment = GenGenericCommentF(HelpStr)
+ else:
+ # generate list of other comment
+ Comment = HelpStr.replace('\n', ' ')
+ Comment = Comment.strip()
+ if Comment:
+ Comment = ' # ' + Comment
+ else:
+ Comment = ''
+ if Usage != DT.ITEM_UNDEFINED and GuidType == DT.ITEM_UNDEFINED:
+ Comment = '## ' + Usage + Comment
+ elif GuidType == 'Variable':
+ Comment = '## ' + Usage + ' ## ' + GuidType + ':' + VariableName + Comment
+ else:
+ Comment = '## ' + Usage + ' ## ' + GuidType + Comment
+
+ if Comment:
+ Comment += '\n'
+ #
+ # merge duplicate items
+ #
+ ArchList = sorted(Guid.GetSupArchList())
+ SortedArch = ' '.join(ArchList)
+ if (Statement, SortedArch) in GuidDict:
+ PreviousComment = GuidDict[Statement, SortedArch]
+ Comment = PreviousComment + Comment
+ GuidDict[Statement, SortedArch] = Comment
+ NewSectionDict = GenMetaFileMisc.TransferDict(GuidDict, 'INF_GUID')
+ #
+ # generate the section contents
+ #
+ if NewSectionDict:
+ Content = GenSection('Guids', NewSectionDict)
+
+ return Content
+
+## GenProtocolPPiSections
+#
+# @param ObjList: List of ProtocolObject or Ppi Object
+# @retVal Content: The generated section contents
+#
+def GenProtocolPPiSections(ObjList, IsProtocol):
+ Content = ''
+ Dict = Sdict()
+ for Object in ObjList:
+ HelpTextList = Object.GetHelpTextList()
+ HelpStr = _GetHelpStr(HelpTextList)
+ CName = Object.GetCName()
+ FFE = Object.GetFeatureFlag()
+ Statement = CName
+ if FFE:
+ Statement += '|' + FFE
+ Usage = Object.GetUsage()
+ Notify = Object.GetNotify()
+ #
+ # Differentiate the generic comment and usage comment as consecutive generic comment need to be put together
+ #
+ if Usage == DT.ITEM_UNDEFINED and Notify == '':
+ # generate list of generic comment
+ Comment = GenGenericCommentF(HelpStr)
+ else:
+ # generate list of other comment
+ Comment = HelpStr.replace('\n', ' ')
+ Comment = Comment.strip()
+ if Comment:
+ Comment = ' # ' + Comment
+ else:
+ Comment = ''
+ if Usage == DT.ITEM_UNDEFINED and not Comment and Notify == '':
+ Comment = ''
+ else:
+ if Notify:
+ Comment = '## ' + Usage + ' ## ' + 'NOTIFY' + Comment
+ else:
+ Comment = '## ' + Usage + Comment
+ if Comment:
+ Comment += '\n'
+ #
+ # merge duplicate items
+ #
+ ArchList = sorted(Object.GetSupArchList())
+ SortedArch = ' '.join(ArchList)
+ if (Statement, SortedArch) in Dict:
+ PreviousComment = Dict[Statement, SortedArch]
+ Comment = PreviousComment + Comment
+ Dict[Statement, SortedArch] = Comment
+ NewSectionDict = GenMetaFileMisc.TransferDict(Dict, 'INF_PPI_PROTOCOL')
+ #
+ # generate the section contents
+ #
+ if NewSectionDict:
+ if IsProtocol:
+ Content = GenSection('Protocols', NewSectionDict)
+ else:
+ Content = GenSection('Ppis', NewSectionDict)
+
+ return Content
+
+## GenPcdSections
+#
+#
+def GenPcdSections(ModuleObject):
+ Content = ''
+ if not GlobalData.gIS_BINARY_INF:
+ #
+ # for each Pcd Itemtype, maintain a dict so the same type will be grouped
+ # together
+ #
+ ItemTypeDict = {}
+ for Pcd in ModuleObject.GetPcdList():
+ HelpTextList = Pcd.GetHelpTextList()
+ HelpStr = _GetHelpStr(HelpTextList)
+ Statement = ''
+ CName = Pcd.GetCName()
+ TokenSpaceGuidCName = Pcd.GetTokenSpaceGuidCName()
+ DefaultValue = Pcd.GetDefaultValue()
+ ItemType = Pcd.GetItemType()
+ if ItemType in ItemTypeDict:
+ Dict = ItemTypeDict[ItemType]
+ else:
+ Dict = Sdict()
+ ItemTypeDict[ItemType] = Dict
+ FFE = Pcd.GetFeatureFlag()
+ Statement += TokenSpaceGuidCName + '.' + CName
+ if DefaultValue:
+ Statement += '|' + DefaultValue
+ if FFE:
+ Statement += '|' + FFE
+ elif FFE:
+ Statement += '||' + FFE
+ #
+ # Generate comment
+ #
+ Usage = Pcd.GetValidUsage()
+ # if FeatureFlag Pcd, then assume all Usage is CONSUMES
+ if ItemType == DT.TAB_INF_FEATURE_PCD:
+ Usage = DT.USAGE_ITEM_CONSUMES
+ if Usage == DT.ITEM_UNDEFINED:
+ # generate list of generic comment
+ Comment = GenGenericCommentF(HelpStr)
+ else:
+ # generate list of other comment
+ Comment = HelpStr.replace('\n', ' ')
+ Comment = Comment.strip()
+ if Comment:
+ Comment = ' # ' + Comment
+ else:
+ Comment = ''
+ Comment = '## ' + Usage + Comment
+ if Comment:
+ Comment += '\n'
+ #
+ # Merge duplicate entries
+ #
+ ArchList = sorted(Pcd.GetSupArchList())
+ SortedArch = ' '.join(ArchList)
+ if (Statement, SortedArch) in Dict:
+ PreviousComment = Dict[Statement, SortedArch]
+ Comment = PreviousComment + Comment
+ Dict[Statement, SortedArch] = Comment
+ for ItemType in ItemTypeDict:
+ # First we need to transfer the Dict to use SortedArch as key
+ Dict = ItemTypeDict[ItemType]
+ NewSectionDict = GenMetaFileMisc.TransferDict(Dict, 'INF_PCD')
+ if NewSectionDict:
+ Content += GenSection(ItemType, NewSectionDict)
+ #
+ # For AsBuild INF files
+ #
+ else:
+ Content += GenAsBuiltPacthPcdSections(ModuleObject)
+ Content += GenAsBuiltPcdExSections(ModuleObject)
+
+ return Content
+
+## GenPcdSections
+#
+#
+def GenAsBuiltPacthPcdSections(ModuleObject):
+ PatchPcdDict = {}
+ for BinaryFile in ModuleObject.GetBinaryFileList():
+ if not BinaryFile.AsBuiltList:
+ continue
+ for PatchPcd in BinaryFile.AsBuiltList[0].PatchPcdList:
+ TokenSpaceName = ''
+ PcdCName = PatchPcd.CName
+ PcdValue = PatchPcd.DefaultValue
+ PcdOffset = PatchPcd.Offset
+ TokenSpaceGuidValue = PatchPcd.TokenSpaceGuidValue
+ Token = PatchPcd.Token
+ HelpTextList = PatchPcd.HelpTextList
+ HelpString = ''
+ for HelpStringItem in HelpTextList:
+ for HelpLine in GetSplitValueList(HelpStringItem.String, '\n'):
+ HelpString += '## ' + HelpLine + '\n'
+ TokenSpaceName, PcdCName = GenMetaFileMisc.ObtainPcdName(ModuleObject.PackageDependencyList,
+ TokenSpaceGuidValue,
+ Token)
+ if TokenSpaceName == '' or PcdCName == '':
+ Logger.Error("Upt",
+ ToolError.RESOURCE_NOT_AVAILABLE,
+ ST.ERR_INSTALL_FILE_DEC_FILE_ERROR % (TokenSpaceGuidValue, Token),
+ File=ModuleObject.GetFullPath())
+ Statement = HelpString + TokenSpaceName + '.' + PcdCName + ' | ' + PcdValue + ' | ' + \
+ PcdOffset + DT.TAB_SPACE_SPLIT
+ #
+ # Use binary file's Arch to be Pcd's Arch
+ #
+ ArchList = []
+ FileNameObjList = BinaryFile.GetFileNameList()
+ if FileNameObjList:
+ ArchList = FileNameObjList[0].GetSupArchList()
+ if len(ArchList) == 0:
+ if DT.TAB_ARCH_COMMON in PatchPcdDict:
+ if Statement not in PatchPcdDict[DT.TAB_ARCH_COMMON]:
+ PatchPcdDict[DT.TAB_ARCH_COMMON].append(Statement)
+ else:
+ PatchPcdDict[DT.TAB_ARCH_COMMON] = [Statement]
+ else:
+ for Arch in ArchList:
+ if Arch in PatchPcdDict:
+ if Statement not in PatchPcdDict[Arch]:
+ PatchPcdDict[Arch].append(Statement)
+ else:
+ PatchPcdDict[Arch] = [Statement]
+ return GenSection(DT.TAB_INF_PATCH_PCD, PatchPcdDict)
+## GenPcdSections
+#
+#
+def GenAsBuiltPcdExSections(ModuleObject):
+ PcdExDict = {}
+ for BinaryFile in ModuleObject.GetBinaryFileList():
+ if not BinaryFile.AsBuiltList:
+ continue
+ for PcdExItem in BinaryFile.AsBuiltList[0].PcdExValueList:
+ TokenSpaceName = ''
+ PcdCName = PcdExItem.CName
+ TokenSpaceGuidValue = PcdExItem.TokenSpaceGuidValue
+ Token = PcdExItem.Token
+ HelpTextList = PcdExItem.HelpTextList
+ HelpString = ''
+ for HelpStringItem in HelpTextList:
+ for HelpLine in GetSplitValueList(HelpStringItem.String, '\n'):
+ HelpString += '## ' + HelpLine + '\n'
+ TokenSpaceName, PcdCName = GenMetaFileMisc.ObtainPcdName(ModuleObject.PackageDependencyList,
+ TokenSpaceGuidValue, Token)
+ if TokenSpaceName == '' or PcdCName == '':
+ Logger.Error("Upt",
+ ToolError.RESOURCE_NOT_AVAILABLE,
+ ST.ERR_INSTALL_FILE_DEC_FILE_ERROR % (TokenSpaceGuidValue, Token),
+ File=ModuleObject.GetFullPath())
+
+ Statement = HelpString + TokenSpaceName + DT.TAB_SPLIT + PcdCName + DT.TAB_SPACE_SPLIT
+
+ #
+ # Use binary file's Arch to be Pcd's Arch
+ #
+ ArchList = []
+ FileNameObjList = BinaryFile.GetFileNameList()
+ if FileNameObjList:
+ ArchList = FileNameObjList[0].GetSupArchList()
+
+ if len(ArchList) == 0:
+ if 'COMMON' in PcdExDict:
+ PcdExDict['COMMON'].append(Statement)
+ else:
+ PcdExDict['COMMON'] = [Statement]
+ else:
+ for Arch in ArchList:
+ if Arch in PcdExDict:
+ if Statement not in PcdExDict[Arch]:
+ PcdExDict[Arch].append(Statement)
+ else:
+ PcdExDict[Arch] = [Statement]
+ return GenSection('PcdEx', PcdExDict)
+
+## GenSpecialSections
+# generate special sections for Event/BootMode/Hob
+#
+def GenSpecialSections(ObjectList, SectionName, UserExtensionsContent=''):
+ #
+ # generate section
+ #
+ Content = ''
+ NewSectionDict = {}
+ for Obj in ObjectList:
+ #
+ # Generate comment
+ #
+ CommentStr = ''
+ HelpTextList = Obj.GetHelpTextList()
+ HelpStr = _GetHelpStr(HelpTextList)
+ CommentStr = GenGenericCommentF(HelpStr)
+ if SectionName == 'Hob':
+ Type = Obj.GetHobType()
+ elif SectionName == 'Event':
+ Type = Obj.GetEventType()
+ elif SectionName == 'BootMode':
+ Type = Obj.GetSupportedBootModes()
+ else:
+ assert(SectionName)
+ Usage = Obj.GetUsage()
+
+ # If the content already in UserExtensionsContent then ignore
+ if '[%s]' % SectionName in UserExtensionsContent and Type in UserExtensionsContent:
+ return ''
+
+ Statement = ' ' + Type + ' ## ' + Usage
+ if CommentStr in ['#\n', '#\n#\n']:
+ CommentStr = '#\n#\n#\n'
+ #
+ # the first head comment line should start with '##\n', if it starts with '#\n', then add one '#'
+ # else add '##\n' to meet the format defined in INF spec
+ #
+ if CommentStr.startswith('#\n'):
+ CommentStr = '#' + CommentStr
+ elif CommentStr:
+ CommentStr = '##\n' + CommentStr
+ if CommentStr and not CommentStr.endswith('\n#\n'):
+ CommentStr = CommentStr + '#\n'
+ NewStateMent = CommentStr + Statement
+ SupArch = sorted(Obj.GetSupArchList())
+ SortedArch = ' '.join(SupArch)
+ if SortedArch in NewSectionDict:
+ NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [NewStateMent]
+ else:
+ NewSectionDict[SortedArch] = [NewStateMent]
+ SectionContent = GenSection(SectionName, NewSectionDict)
+ SectionContent = SectionContent.strip()
+ if SectionContent:
+ Content = '# ' + ('\n' + '# ').join(GetSplitValueList(SectionContent, '\n'))
+ Content = Content.lstrip()
+ #
+ # add a return to differentiate it between other possible sections
+ #
+ if Content:
+ Content += '\n'
+ return Content
+## GenBuildOptions
+#
+#
+def GenBuildOptions(ModuleObject):
+ Content = ''
+ if not ModuleObject.BinaryModule:
+ #
+ # generate [BuildOptions] section
+ #
+ NewSectionDict = {}
+ for UserExtension in ModuleObject.GetUserExtensionList():
+ BuildOptionDict = UserExtension.GetBuildOptionDict()
+ if not BuildOptionDict:
+ continue
+ for Arch in BuildOptionDict:
+ if Arch in NewSectionDict:
+ NewSectionDict[Arch] = NewSectionDict[Arch] + [BuildOptionDict[Arch]]
+ else:
+ NewSectionDict[Arch] = [BuildOptionDict[Arch]]
+ Content = GenSection('BuildOptions', NewSectionDict)
+ else:
+ BuildOptionDict = {}
+ for BinaryFile in ModuleObject.GetBinaryFileList():
+ if not BinaryFile.AsBuiltList:
+ continue
+ for BuilOptionItem in BinaryFile.AsBuiltList[0].BinaryBuildFlagList:
+ Statement = '#' + BuilOptionItem.AsBuiltOptionFlags
+ if len(BinaryFile.SupArchList) == 0:
+ if 'COMMON' in BuildOptionDict:
+ if Statement not in BuildOptionDict['COMMON']:
+ BuildOptionDict['COMMON'].append(Statement)
+ else:
+ BuildOptionDict['COMMON'] = ['## @AsBuilt']
+ BuildOptionDict['COMMON'].append(Statement)
+ else:
+ for Arch in BinaryFile.SupArchList:
+ if Arch in BuildOptionDict:
+ if Statement not in BuildOptionDict[Arch]:
+ BuildOptionDict[Arch].append(Statement)
+ else:
+ BuildOptionDict[Arch] = ['## @AsBuilt']
+ BuildOptionDict[Arch].append(Statement)
+ Content = GenSection('BuildOptions', BuildOptionDict)
+
+ return Content
+## GenBinaries
+#
+#
+def GenBinaries(ModuleObject):
+ NewSectionDict = {}
+ BinariesDict = []
+ for UserExtension in ModuleObject.GetUserExtensionList():
+ BinariesDict = UserExtension.GetBinariesDict()
+ if BinariesDict:
+ break
+ for BinaryFile in ModuleObject.GetBinaryFileList():
+ FileNameObjList = BinaryFile.GetFileNameList()
+ for FileNameObj in FileNameObjList:
+ FileName = ConvertPath(FileNameObj.GetFilename())
+ FileType = FileNameObj.GetFileType()
+ FFE = FileNameObj.GetFeatureFlag()
+ ArchList = sorted(FileNameObj.GetSupArchList())
+ SortedArch = ' '.join(ArchList)
+ Key = (FileName, FileType, FFE, SortedArch)
+ if Key in BinariesDict:
+ ValueList = BinariesDict[Key]
+ for ValueItem in ValueList:
+ Statement = GenBinaryStatement(Key, ValueItem)
+ if SortedArch in NewSectionDict:
+ NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [Statement]
+ else:
+ NewSectionDict[SortedArch] = [Statement]
+ #
+ # as we already generated statement for this DictKey here set the Valuelist to be empty
+ # to avoid generate duplicate entries as the DictKey may have multiple entries
+ #
+ BinariesDict[Key] = []
+ else:
+ if FileType == 'SUBTYPE_GUID' and FileNameObj.GetGuidValue():
+ Statement = GenBinaryStatement(Key, None, FileNameObj.GetGuidValue())
+ else:
+ Statement = GenBinaryStatement(Key, None)
+ if SortedArch in NewSectionDict:
+ NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [Statement]
+ else:
+ NewSectionDict[SortedArch] = [Statement]
+ Content = GenSection('Binaries', NewSectionDict)
+
+ return Content
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py b/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py
new file mode 100644
index 000000000..c7146977d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py
@@ -0,0 +1,188 @@
+## @file GenMetaFileMisc.py
+#
+# This file contained the miscellaneous routines for GenMetaFile usage.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+GenMetaFileMisc
+'''
+
+from Library import DataType as DT
+from Library import GlobalData
+from Parser.DecParser import Dec
+
+# AddExternToDefineSec
+#
+# @param SectionDict: string of source file path/name
+# @param Arch: string of source file family field
+# @param ExternList: string of source file FeatureFlag field
+#
+def AddExternToDefineSec(SectionDict, Arch, ExternList):
+ LeftOffset = 31
+ for ArchList, EntryPoint, UnloadImage, Constructor, Destructor, FFE, HelpStringList in ExternList:
+ if Arch or ArchList:
+ if EntryPoint:
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_ENTRY_POINT).ljust(LeftOffset) + u'= %s' % EntryPoint
+ if FFE:
+ Statement += ' | %s' % FFE
+ if len(HelpStringList) > 0:
+ Statement = HelpStringList[0].GetString() + '\n' + Statement
+ if len(HelpStringList) > 1:
+ Statement = Statement + HelpStringList[1].GetString()
+ SectionDict[Arch] = SectionDict[Arch] + [Statement]
+
+ if UnloadImage:
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_UNLOAD_IMAGE).ljust(LeftOffset) + u'= %s' % UnloadImage
+ if FFE:
+ Statement += ' | %s' % FFE
+
+ if len(HelpStringList) > 0:
+ Statement = HelpStringList[0].GetString() + '\n' + Statement
+ if len(HelpStringList) > 1:
+ Statement = Statement + HelpStringList[1].GetString()
+ SectionDict[Arch] = SectionDict[Arch] + [Statement]
+
+ if Constructor:
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_CONSTRUCTOR).ljust(LeftOffset) + u'= %s' % Constructor
+ if FFE:
+ Statement += ' | %s' % FFE
+
+ if len(HelpStringList) > 0:
+ Statement = HelpStringList[0].GetString() + '\n' + Statement
+ if len(HelpStringList) > 1:
+ Statement = Statement + HelpStringList[1].GetString()
+ SectionDict[Arch] = SectionDict[Arch] + [Statement]
+
+ if Destructor:
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_DESTRUCTOR).ljust(LeftOffset) + u'= %s' % Destructor
+ if FFE:
+ Statement += ' | %s' % FFE
+
+ if len(HelpStringList) > 0:
+ Statement = HelpStringList[0].GetString() + '\n' + Statement
+ if len(HelpStringList) > 1:
+ Statement = Statement + HelpStringList[1].GetString()
+ SectionDict[Arch] = SectionDict[Arch] + [Statement]
+
+## ObtainPcdName
+#
+# Using TokenSpaceGuidValue and Token to obtain PcdName from DEC file
+#
+def ObtainPcdName(Packages, TokenSpaceGuidValue, Token):
+ TokenSpaceGuidName = ''
+ PcdCName = ''
+ TokenSpaceGuidNameFound = False
+
+ for PackageDependency in Packages:
+ #
+ # Generate generic comment
+ #
+ Guid = PackageDependency.GetGuid()
+ Version = PackageDependency.GetVersion()
+
+ Path = None
+ #
+ # find package path/name
+ #
+ for PkgInfo in GlobalData.gWSPKG_LIST:
+ if Guid == PkgInfo[1]:
+ if (not Version) or (Version == PkgInfo[2]):
+ Path = PkgInfo[3]
+ break
+
+ # The dependency package in workspace
+ if Path:
+ DecFile = None
+ if Path not in GlobalData.gPackageDict:
+ DecFile = Dec(Path)
+ GlobalData.gPackageDict[Path] = DecFile
+ else:
+ DecFile = GlobalData.gPackageDict[Path]
+
+ DecGuidsDict = DecFile.GetGuidSectionObject().ValueDict
+ DecPcdsDict = DecFile.GetPcdSectionObject().ValueDict
+
+ TokenSpaceGuidName = ''
+ PcdCName = ''
+ TokenSpaceGuidNameFound = False
+
+ #
+ # Get TokenSpaceGuidCName from Guids section
+ #
+ for GuidKey in DecGuidsDict:
+ GuidList = DecGuidsDict[GuidKey]
+ for GuidItem in GuidList:
+ if TokenSpaceGuidValue.upper() == GuidItem.GuidString.upper():
+ TokenSpaceGuidName = GuidItem.GuidCName
+ TokenSpaceGuidNameFound = True
+ break
+ if TokenSpaceGuidNameFound:
+ break
+ #
+ # Retrieve PcdCName from Pcds Section
+ #
+ for PcdKey in DecPcdsDict:
+ PcdList = DecPcdsDict[PcdKey]
+ for PcdItem in PcdList:
+ if TokenSpaceGuidName == PcdItem.TokenSpaceGuidCName and Token == PcdItem.TokenValue:
+ PcdCName = PcdItem.TokenCName
+ return TokenSpaceGuidName, PcdCName
+
+ # The dependency package in ToBeInstalledDist
+ else:
+ for Dist in GlobalData.gTO_BE_INSTALLED_DIST_LIST:
+ for Package in Dist.PackageSurfaceArea.values():
+ if Guid == Package.Guid:
+ for GuidItem in Package.GuidList:
+ if TokenSpaceGuidValue.upper() == GuidItem.Guid.upper():
+ TokenSpaceGuidName = GuidItem.CName
+ TokenSpaceGuidNameFound = True
+ break
+ for PcdItem in Package.PcdList:
+ if TokenSpaceGuidName == PcdItem.TokenSpaceGuidCName and Token == PcdItem.Token:
+ PcdCName = PcdItem.CName
+ return TokenSpaceGuidName, PcdCName
+
+ return TokenSpaceGuidName, PcdCName
+
+## _TransferDict
+# transfer dict that using (Statement, SortedArch) as key,
+# (GenericComment, UsageComment) as value into a dict that using SortedArch as
+# key and NewStatement as value
+#
+def TransferDict(OrigDict, Type=None):
+ NewDict = {}
+ LeftOffset = 0
+ if Type in ['INF_GUID', 'INF_PPI_PROTOCOL']:
+ LeftOffset = 45
+ if Type in ['INF_PCD']:
+ LeftOffset = 75
+ if LeftOffset > 0:
+ for Statement, SortedArch in OrigDict:
+ if len(Statement) > LeftOffset:
+ LeftOffset = len(Statement)
+
+ for Statement, SortedArch in OrigDict:
+ Comment = OrigDict[Statement, SortedArch]
+ #
+ # apply the NComment/1Comment rule
+ #
+ if Comment.find('\n') != len(Comment) - 1:
+ NewStateMent = Comment + Statement
+ else:
+ if LeftOffset:
+ NewStateMent = Statement.ljust(LeftOffset) + ' ' + Comment.rstrip('\n')
+ else:
+ NewStateMent = Statement + ' ' + Comment.rstrip('\n')
+
+ if SortedArch in NewDict:
+ NewDict[SortedArch] = NewDict[SortedArch] + [NewStateMent]
+ else:
+ NewDict[SortedArch] = [NewStateMent]
+
+ return NewDict
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenXmlFile.py b/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenXmlFile.py
new file mode 100644
index 000000000..50d79973b
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/GenXmlFile.py
@@ -0,0 +1,12 @@
+## @file GenXmlFile.py
+#
+# This file contained the logical of generate XML files.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+GenXmlFile
+'''
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/__init__.py b/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/__init__.py
new file mode 100644
index 000000000..508c6d060
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/GenMetaFile/__init__.py
@@ -0,0 +1,14 @@
+## @file
+# Python 'Library' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+GenMetaFile
+'''
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/InstallPkg.py b/roms/edk2/BaseTools/Source/Python/UPT/InstallPkg.py
new file mode 100644
index 000000000..e4c756544
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/InstallPkg.py
@@ -0,0 +1,967 @@
+## @file
+# Install distribution package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+"""
+Install a distribution package
+"""
+##
+# Import Modules
+#
+from Core.FileHook import __FileHookOpen__
+import os.path
+from os import chmod
+from os import SEEK_SET
+from os import SEEK_END
+import stat
+from hashlib import md5
+import copy
+from sys import stdin
+from sys import platform
+from shutil import rmtree
+from shutil import copyfile
+from traceback import format_exc
+from platform import python_version
+
+from Logger import StringTable as ST
+from Logger.ToolError import UNKNOWN_ERROR
+from Logger.ToolError import FILE_UNKNOWN_ERROR
+from Logger.ToolError import OPTION_MISSING
+from Logger.ToolError import UPT_ALREADY_INSTALLED_ERROR
+from Logger.ToolError import FatalError
+from Logger.ToolError import ABORT_ERROR
+from Logger.ToolError import CODE_ERROR
+from Logger.ToolError import FORMAT_INVALID
+from Logger.ToolError import FILE_TYPE_MISMATCH
+import Logger.Log as Logger
+
+from Library.Misc import Sdict
+from Library.Misc import ConvertPath
+from Library.ParserValidate import IsValidInstallPath
+from Xml.XmlParser import DistributionPackageXml
+from GenMetaFile.GenDecFile import PackageToDec
+from GenMetaFile.GenInfFile import ModuleToInf
+from Core.PackageFile import PackageFile
+from Core.PackageFile import FILE_NOT_FOUND
+from Core.PackageFile import FILE_CHECKSUM_FAILURE
+from Core.PackageFile import CreateDirectory
+from Core.DependencyRules import DependencyRules
+from Library import GlobalData
+
+## InstallNewPackage
+#
+# @param WorkspaceDir: Workspace Directory
+# @param Path: Package Path
+# @param CustomPath: whether need to customize path at first
+#
+def InstallNewPackage(WorkspaceDir, Path, CustomPath = False):
+ if os.path.isabs(Path):
+ Logger.Info(ST.MSG_RELATIVE_PATH_ONLY%Path)
+ elif CustomPath:
+ Logger.Info(ST.MSG_NEW_PKG_PATH)
+ else:
+ Path = ConvertPath(Path)
+ Path = os.path.normpath(Path)
+ FullPath = os.path.normpath(os.path.join(WorkspaceDir, Path))
+ if os.path.exists(FullPath):
+ Logger.Info(ST.ERR_DIR_ALREADY_EXIST%FullPath)
+ else:
+ return Path
+
+ Input = stdin.readline()
+ Input = Input.replace('\r', '').replace('\n', '')
+ if Input == '':
+ Logger.Error("InstallPkg", UNKNOWN_ERROR, ST.ERR_USER_INTERRUPT)
+ Input = Input.replace('\r', '').replace('\n', '')
+ return InstallNewPackage(WorkspaceDir, Input, False)
+
+## InstallNewModule
+#
+# @param WorkspaceDir: Workspace Directory
+# @param Path: Standalone Module Path
+# @param PathList: The already installed standalone module Path list
+#
+def InstallNewModule(WorkspaceDir, Path, PathList = None):
+ if PathList is None:
+ PathList = []
+ Path = ConvertPath(Path)
+ Path = os.path.normpath(Path)
+ FullPath = os.path.normpath(os.path.join(WorkspaceDir, Path))
+ if os.path.exists(FullPath) and FullPath not in PathList:
+ Logger.Info(ST.ERR_DIR_ALREADY_EXIST%Path)
+ elif Path == FullPath:
+ Logger.Info(ST.MSG_RELATIVE_PATH_ONLY%FullPath)
+ else:
+ return Path
+
+ Input = stdin.readline()
+ Input = Input.replace('\r', '').replace('\n', '')
+ if Input == '':
+ Logger.Error("InstallPkg", UNKNOWN_ERROR, ST.ERR_USER_INTERRUPT)
+ Input = Input.replace('\r', '').replace('\n', '')
+ return InstallNewModule(WorkspaceDir, Input, PathList)
+
+
+## InstallNewFile
+#
+# @param WorkspaceDir: Workspace Direction
+# @param File: File
+#
+def InstallNewFile(WorkspaceDir, File):
+ FullPath = os.path.normpath(os.path.join(WorkspaceDir, File))
+ if os.path.exists(FullPath):
+ Logger.Info(ST.ERR_FILE_ALREADY_EXIST %File)
+ Input = stdin.readline()
+ Input = Input.replace('\r', '').replace('\n', '')
+ if Input == '':
+ Logger.Error("InstallPkg", UNKNOWN_ERROR, ST.ERR_USER_INTERRUPT)
+ Input = Input.replace('\r', '').replace('\n', '')
+ return InstallNewFile(WorkspaceDir, Input)
+ else:
+ return File
+
+## UnZipDp
+#
+# UnZipDp
+#
+def UnZipDp(WorkspaceDir, DpPkgFileName, Index=1):
+ ContentZipFile = None
+ Logger.Quiet(ST.MSG_UZIP_PARSE_XML)
+ DistFile = PackageFile(DpPkgFileName)
+
+ DpDescFileName, ContentFileName = GetDPFile(DistFile.GetZipFile())
+
+ TempDir = os.path.normpath(os.path.join(WorkspaceDir, "Conf/.tmp%s" % str(Index)))
+ GlobalData.gUNPACK_DIR.append(TempDir)
+ DistPkgFile = DistFile.UnpackFile(DpDescFileName, os.path.normpath(os.path.join(TempDir, DpDescFileName)))
+ if not DistPkgFile:
+ Logger.Error("InstallPkg", FILE_NOT_FOUND, ST.ERR_FILE_BROKEN %DpDescFileName)
+
+ #
+ # Generate distpkg
+ #
+ DistPkgObj = DistributionPackageXml()
+ DistPkg = DistPkgObj.FromXml(DistPkgFile)
+ if DistPkg.Header.RePackage == '':
+ DistPkg.Header.RePackage = False
+ if DistPkg.Header.ReadOnly == '':
+ DistPkg.Header.ReadOnly = False
+
+ #
+ # unzip contents.zip file
+ #
+ ContentFile = DistFile.UnpackFile(ContentFileName, os.path.normpath(os.path.join(TempDir, ContentFileName)))
+ if not ContentFile:
+ Logger.Error("InstallPkg", FILE_NOT_FOUND,
+ ST.ERR_FILE_BROKEN % ContentFileName)
+
+ #
+ # Get file size
+ #
+ FileSize = os.path.getsize(ContentFile)
+
+ if FileSize != 0:
+ ContentZipFile = PackageFile(ContentFile)
+
+ #
+ # verify MD5 signature when existed
+ #
+ if DistPkg.Header.Signature != '':
+ Md5Signature = md5(__FileHookOpen__(ContentFile, 'rb').read())
+ if DistPkg.Header.Signature != Md5Signature.hexdigest():
+ ContentZipFile.Close()
+ Logger.Error("InstallPkg", FILE_CHECKSUM_FAILURE,
+ ExtraData=ContentFile)
+
+ return DistPkg, ContentZipFile, DpPkgFileName, DistFile
+
+## GetPackageList
+#
+# GetPackageList
+#
+def GetPackageList(DistPkg, Dep, WorkspaceDir, Options, ContentZipFile, ModuleList, PackageList):
+ NewDict = Sdict()
+ for Guid, Version, Path in DistPkg.PackageSurfaceArea:
+ PackagePath = Path
+ Package = DistPkg.PackageSurfaceArea[Guid, Version, Path]
+ Logger.Info(ST.MSG_INSTALL_PACKAGE % Package.GetName())
+# if Dep.CheckPackageExists(Guid, Version):
+# Logger.Info(ST.WRN_PACKAGE_EXISTED %(Guid, Version))
+ if Options.UseGuidedPkgPath:
+ GuidedPkgPath = "%s_%s_%s" % (Package.GetName(), Guid, Version)
+ NewPackagePath = InstallNewPackage(WorkspaceDir, GuidedPkgPath, Options.CustomPath)
+ else:
+ NewPackagePath = InstallNewPackage(WorkspaceDir, PackagePath, Options.CustomPath)
+ InstallPackageContent(PackagePath, NewPackagePath, Package, ContentZipFile, Dep, WorkspaceDir, ModuleList,
+ DistPkg.Header.ReadOnly)
+ PackageList.append(Package)
+
+ NewDict[Guid, Version, Package.GetPackagePath()] = Package
+
+ #
+ # Now generate meta-data files, first generate all dec for package
+ # dec should be generated before inf, and inf should be generated after
+ # all packages installed, else hard to resolve modules' package
+ # dependency (Hard to get the location of the newly installed package)
+ #
+ for Package in PackageList:
+ FilePath = PackageToDec(Package, DistPkg.Header)
+ Md5Signature = md5(__FileHookOpen__(str(FilePath), 'rb').read())
+ Md5Sum = Md5Signature.hexdigest()
+ if (FilePath, Md5Sum) not in Package.FileList:
+ Package.FileList.append((FilePath, Md5Sum))
+
+ return NewDict
+
+## GetModuleList
+#
+# GetModuleList
+#
+def GetModuleList(DistPkg, Dep, WorkspaceDir, ContentZipFile, ModuleList):
+ #
+ # ModulePathList will keep track of the standalone module path that
+ # we just installed. If a new module's path in that list
+ # (only multiple INF in one directory will be so), we will
+ # install them directly. If not, we will try to create a new directory
+ # for it.
+ #
+ ModulePathList = []
+
+ #
+ # Check module exist and install
+ #
+ Module = None
+ NewDict = Sdict()
+ for Guid, Version, Name, Path in DistPkg.ModuleSurfaceArea:
+ ModulePath = Path
+ Module = DistPkg.ModuleSurfaceArea[Guid, Version, Name, Path]
+ Logger.Info(ST.MSG_INSTALL_MODULE % Module.GetName())
+ if Dep.CheckModuleExists(Guid, Version, Name, Path):
+ Logger.Quiet(ST.WRN_MODULE_EXISTED %Path)
+ #
+ # here check for the multiple inf share the same module path cases:
+ # they should be installed into the same directory
+ #
+ ModuleFullPath = \
+ os.path.normpath(os.path.join(WorkspaceDir, ModulePath))
+ if ModuleFullPath not in ModulePathList:
+ NewModulePath = InstallNewModule(WorkspaceDir, ModulePath, ModulePathList)
+ NewModuleFullPath = os.path.normpath(os.path.join(WorkspaceDir, NewModulePath))
+ ModulePathList.append(NewModuleFullPath)
+ else:
+ NewModulePath = ModulePath
+
+ InstallModuleContent(ModulePath, NewModulePath, '', Module, ContentZipFile, WorkspaceDir, ModuleList, None,
+ DistPkg.Header.ReadOnly)
+ #
+ # Update module
+ #
+ Module.SetModulePath(Module.GetModulePath().replace(Path, NewModulePath, 1))
+
+ NewDict[Guid, Version, Name, Module.GetModulePath()] = Module
+
+ #
+ # generate all inf for modules
+ #
+ for (Module, Package) in ModuleList:
+ CheckCNameInModuleRedefined(Module, DistPkg)
+ FilePath = ModuleToInf(Module, Package, DistPkg.Header)
+ Md5Signature = md5(__FileHookOpen__(str(FilePath), 'rb').read())
+ Md5Sum = Md5Signature.hexdigest()
+ if Package:
+ if (FilePath, Md5Sum) not in Package.FileList:
+ Package.FileList.append((FilePath, Md5Sum))
+ else:
+ if (FilePath, Md5Sum) not in Module.FileList:
+ Module.FileList.append((FilePath, Md5Sum))
+ #
+ # append the module unicode files to Package FileList
+ #
+ for (FilePath, Md5Sum) in Module.FileList:
+ if str(FilePath).endswith('.uni') and Package and (FilePath, Md5Sum) not in Package.FileList:
+ Package.FileList.append((FilePath, Md5Sum))
+
+ return NewDict
+
+##
+# Get all protocol/ppi/guid CNames and pcd name from all dependent DEC file
+#
+def GetDepProtocolPpiGuidPcdNames(DePackageObjList):
+ #
+ # [[Dec1Protocol1, Dec1Protocol2...], [Dec2Protocols...],...]
+ #
+ DependentProtocolCNames = []
+ DependentPpiCNames = []
+ DependentGuidCNames = []
+ DependentPcdNames = []
+
+ for PackageObj in DePackageObjList:
+ #
+ # Get protocol CName list from all dependent DEC file
+ #
+ ProtocolCNames = []
+ for Protocol in PackageObj.GetProtocolList():
+ if Protocol.GetCName() not in ProtocolCNames:
+ ProtocolCNames.append(Protocol.GetCName())
+
+ DependentProtocolCNames.append(ProtocolCNames)
+
+ #
+ # Get Ppi CName list from all dependent DEC file
+ #
+ PpiCNames = []
+ for Ppi in PackageObj.GetPpiList():
+ if Ppi.GetCName() not in PpiCNames:
+ PpiCNames.append(Ppi.GetCName())
+
+ DependentPpiCNames.append(PpiCNames)
+
+ #
+ # Get Guid CName list from all dependent DEC file
+ #
+ GuidCNames = []
+ for Guid in PackageObj.GetGuidList():
+ if Guid.GetCName() not in GuidCNames:
+ GuidCNames.append(Guid.GetCName())
+
+ DependentGuidCNames.append(GuidCNames)
+
+ #
+ # Get PcdName list from all dependent DEC file
+ #
+ PcdNames = []
+ for Pcd in PackageObj.GetPcdList():
+ PcdName = '.'.join([Pcd.GetTokenSpaceGuidCName(), Pcd.GetCName()])
+ if PcdName not in PcdNames:
+ PcdNames.append(PcdName)
+
+ DependentPcdNames.append(PcdNames)
+
+
+ return DependentProtocolCNames, DependentPpiCNames, DependentGuidCNames, DependentPcdNames
+
+##
+# Check if protocol CName is redefined
+#
+def CheckProtoclCNameRedefined(Module, DependentProtocolCNames):
+ for ProtocolInModule in Module.GetProtocolList():
+ IsCNameDefined = False
+ for PackageProtocolCNames in DependentProtocolCNames:
+ if ProtocolInModule.GetCName() in PackageProtocolCNames:
+ if IsCNameDefined:
+ Logger.Error("\nUPT", FORMAT_INVALID,
+ File = Module.GetFullPath(),
+ ExtraData = \
+ ST.ERR_INF_PARSER_ITEM_DUPLICATE_IN_DEC % ProtocolInModule.GetCName())
+ else:
+ IsCNameDefined = True
+
+##
+# Check if Ppi CName is redefined
+#
+def CheckPpiCNameRedefined(Module, DependentPpiCNames):
+ for PpiInModule in Module.GetPpiList():
+ IsCNameDefined = False
+ for PackagePpiCNames in DependentPpiCNames:
+ if PpiInModule.GetCName() in PackagePpiCNames:
+ if IsCNameDefined:
+ Logger.Error("\nUPT", FORMAT_INVALID,
+ File = Module.GetFullPath(),
+ ExtraData = ST.ERR_INF_PARSER_ITEM_DUPLICATE_IN_DEC % PpiInModule.GetCName())
+ else:
+ IsCNameDefined = True
+
+##
+# Check if Guid CName is redefined
+#
+def CheckGuidCNameRedefined(Module, DependentGuidCNames):
+ for GuidInModule in Module.GetGuidList():
+ IsCNameDefined = False
+ for PackageGuidCNames in DependentGuidCNames:
+ if GuidInModule.GetCName() in PackageGuidCNames:
+ if IsCNameDefined:
+ Logger.Error("\nUPT", FORMAT_INVALID,
+ File = Module.GetFullPath(),
+ ExtraData = \
+ ST.ERR_INF_PARSER_ITEM_DUPLICATE_IN_DEC % GuidInModule.GetCName())
+ else:
+ IsCNameDefined = True
+
+##
+# Check if PcdName is redefined
+#
+def CheckPcdNameRedefined(Module, DependentPcdNames):
+ PcdObjs = []
+ if not Module.GetBinaryFileList():
+ PcdObjs += Module.GetPcdList()
+ else:
+ Binary = Module.GetBinaryFileList()[0]
+ for AsBuild in Binary.GetAsBuiltList():
+ PcdObjs += AsBuild.GetPatchPcdList() + AsBuild.GetPcdExList()
+
+ for PcdObj in PcdObjs:
+ PcdName = '.'.join([PcdObj.GetTokenSpaceGuidCName(), PcdObj.GetCName()])
+ IsPcdNameDefined = False
+ for PcdNames in DependentPcdNames:
+ if PcdName in PcdNames:
+ if IsPcdNameDefined:
+ Logger.Error("\nUPT", FORMAT_INVALID,
+ File = Module.GetFullPath(),
+ ExtraData = ST.ERR_INF_PARSER_ITEM_DUPLICATE_IN_DEC % PcdName)
+ else:
+ IsPcdNameDefined = True
+
+##
+# Check if any Protocol/Ppi/Guid and Pcd name is redefined in its dependent DEC files
+#
+def CheckCNameInModuleRedefined(Module, DistPkg):
+ DePackageObjList = []
+ #
+ # Get all dependent package objects
+ #
+ for Obj in Module.GetPackageDependencyList():
+ Guid = Obj.GetGuid()
+ Version = Obj.GetVersion()
+ for Key in DistPkg.PackageSurfaceArea:
+ if Key[0] == Guid and Key[1] == Version:
+ if DistPkg.PackageSurfaceArea[Key] not in DePackageObjList:
+ DePackageObjList.append(DistPkg.PackageSurfaceArea[Key])
+
+ DependentProtocolCNames, DependentPpiCNames, DependentGuidCNames, DependentPcdNames = \
+ GetDepProtocolPpiGuidPcdNames(DePackageObjList)
+
+ CheckProtoclCNameRedefined(Module, DependentProtocolCNames)
+ CheckPpiCNameRedefined(Module, DependentPpiCNames)
+ CheckGuidCNameRedefined(Module, DependentGuidCNames)
+ CheckPcdNameRedefined(Module, DependentPcdNames)
+
+## GenToolMisc
+#
+# GenToolMisc
+#
+#
+def GenToolMisc(DistPkg, WorkspaceDir, ContentZipFile):
+ ToolObject = DistPkg.Tools
+ MiscObject = DistPkg.MiscellaneousFiles
+ DistPkg.FileList = []
+ FileList = []
+ ToolFileNum = 0
+ FileNum = 0
+ RootDir = WorkspaceDir
+
+ #
+ # FileList stores both tools files and misc files
+ # Misc file list must be appended to FileList *AFTER* Tools file list
+ #
+ if ToolObject:
+ FileList += ToolObject.GetFileList()
+ ToolFileNum = len(ToolObject.GetFileList())
+ if 'EDK_TOOLS_PATH' in os.environ:
+ RootDir = os.environ['EDK_TOOLS_PATH']
+ if MiscObject:
+ FileList += MiscObject.GetFileList()
+ for FileObject in FileList:
+ FileNum += 1
+ if FileNum > ToolFileNum:
+ #
+ # Misc files, root should be changed to WORKSPACE
+ #
+ RootDir = WorkspaceDir
+ File = ConvertPath(FileObject.GetURI())
+ ToFile = os.path.normpath(os.path.join(RootDir, File))
+ if os.path.exists(ToFile):
+ Logger.Info( ST.WRN_FILE_EXISTED % ToFile )
+ #
+ # ask for user input the new file name
+ #
+ Logger.Info( ST.MSG_NEW_FILE_NAME)
+ Input = stdin.readline()
+ Input = Input.replace('\r', '').replace('\n', '')
+ OrigPath = os.path.split(ToFile)[0]
+ ToFile = os.path.normpath(os.path.join(OrigPath, Input))
+ FromFile = os.path.join(FileObject.GetURI())
+ Md5Sum = InstallFile(ContentZipFile, FromFile, ToFile, DistPkg.Header.ReadOnly, FileObject.GetExecutable())
+ DistPkg.FileList.append((ToFile, Md5Sum))
+
+## Tool entrance method
+#
+# This method mainly dispatch specific methods per the command line options.
+# If no error found, return zero value so the caller of this tool can know
+# if it's executed successfully or not.
+#
+# @param Options: command Options
+#
+def Main(Options = None):
+ try:
+ DataBase = GlobalData.gDB
+ WorkspaceDir = GlobalData.gWORKSPACE
+ if not Options.PackageFile:
+ Logger.Error("InstallPkg", OPTION_MISSING, ExtraData=ST.ERR_SPECIFY_PACKAGE)
+
+ # Get all Dist Info
+ DistInfoList = []
+ DistPkgList = []
+ Index = 1
+ for ToBeInstalledDist in Options.PackageFile:
+ #
+ # unzip dist.pkg file
+ #
+ DistInfoList.append(UnZipDp(WorkspaceDir, ToBeInstalledDist, Index))
+ DistPkgList.append(DistInfoList[-1][0])
+ Index += 1
+
+ #
+ # Add dist
+ #
+ GlobalData.gTO_BE_INSTALLED_DIST_LIST.append(DistInfoList[-1][0])
+
+ # Check for dependency
+ Dep = DependencyRules(DataBase, DistPkgList)
+
+ for ToBeInstalledDist in DistInfoList:
+ CheckInstallDpx(Dep, ToBeInstalledDist[0], ToBeInstalledDist[2])
+
+ #
+ # Install distribution
+ #
+ InstallDp(ToBeInstalledDist[0], ToBeInstalledDist[2], ToBeInstalledDist[1],
+ Options, Dep, WorkspaceDir, DataBase)
+ ReturnCode = 0
+
+ except FatalError as XExcept:
+ ReturnCode = XExcept.args[0]
+ if Logger.GetLevel() <= Logger.DEBUG_9:
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + format_exc())
+
+ except KeyboardInterrupt:
+ ReturnCode = ABORT_ERROR
+ if Logger.GetLevel() <= Logger.DEBUG_9:
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + format_exc())
+
+ except:
+ ReturnCode = CODE_ERROR
+ Logger.Error(
+ "\nInstallPkg",
+ CODE_ERROR,
+ ST.ERR_UNKNOWN_FATAL_INSTALL_ERR % Options.PackageFile,
+ ExtraData=ST.MSG_SEARCH_FOR_HELP % ST.MSG_EDKII_MAIL_ADDR,
+ RaiseError=False
+ )
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(),
+ platform) + format_exc())
+ finally:
+ Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_STARTED)
+ for ToBeInstalledDist in DistInfoList:
+ if ToBeInstalledDist[3]:
+ ToBeInstalledDist[3].Close()
+ if ToBeInstalledDist[1]:
+ ToBeInstalledDist[1].Close()
+ for TempDir in GlobalData.gUNPACK_DIR:
+ rmtree(TempDir)
+ GlobalData.gUNPACK_DIR = []
+ Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_DONE)
+ if ReturnCode == 0:
+ Logger.Quiet(ST.MSG_FINISH)
+ return ReturnCode
+
+# BackupDist method
+#
+# This method will backup the Distribution file into the $(WORKSPACE)/conf/upt, and rename it
+# if there is already a same-named distribution existed.
+#
+# @param DpPkgFileName: The distribution path
+# @param Guid: The distribution Guid
+# @param Version: The distribution Version
+# @param WorkspaceDir: The workspace directory
+# @retval NewDpPkgFileName: The exact backup file name
+#
+def BackupDist(DpPkgFileName, Guid, Version, WorkspaceDir):
+ DistFileName = os.path.split(DpPkgFileName)[1]
+ DestDir = os.path.normpath(os.path.join(WorkspaceDir, GlobalData.gUPT_DIR))
+ CreateDirectory(DestDir)
+ DestFile = os.path.normpath(os.path.join(DestDir, DistFileName))
+ if os.path.exists(DestFile):
+ FileName, Ext = os.path.splitext(DistFileName)
+ NewFileName = FileName + '_' + Guid + '_' + Version + Ext
+ DestFile = os.path.normpath(os.path.join(DestDir, NewFileName))
+ if os.path.exists(DestFile):
+ #
+ # ask for user input the new file name
+ #
+ Logger.Info( ST.MSG_NEW_FILE_NAME_FOR_DIST)
+ Input = stdin.readline()
+ Input = Input.replace('\r', '').replace('\n', '')
+ DestFile = os.path.normpath(os.path.join(DestDir, Input))
+ copyfile(DpPkgFileName, DestFile)
+ NewDpPkgFileName = DestFile[DestFile.find(DestDir) + len(DestDir) + 1:]
+ return NewDpPkgFileName
+
+## CheckInstallDpx method
+#
+# check whether distribution could be installed
+#
+# @param Dep: the DependencyRules instance that used to check dependency
+# @param DistPkg: the distribution object
+#
+def CheckInstallDpx(Dep, DistPkg, DistPkgFileName):
+ #
+ # Check distribution package installed or not
+ #
+ if Dep.CheckDpExists(DistPkg.Header.GetGuid(),
+ DistPkg.Header.GetVersion()):
+ Logger.Error("InstallPkg",
+ UPT_ALREADY_INSTALLED_ERROR,
+ ST.WRN_DIST_PKG_INSTALLED % os.path.basename(DistPkgFileName))
+ #
+ # Check distribution dependency (all module dependency should be
+ # satisfied)
+ #
+ if not Dep.CheckInstallDpDepexSatisfied(DistPkg):
+ Logger.Error("InstallPkg", UNKNOWN_ERROR,
+ ST.ERR_PACKAGE_NOT_MATCH_DEPENDENCY,
+ ExtraData=DistPkg.Header.Name)
+
+## InstallModuleContent method
+#
+# If this is standalone module, then Package should be none,
+# ModulePath should be ''
+# @param FromPath: FromPath
+# @param NewPath: NewPath
+# @param ModulePath: ModulePath
+# @param Module: Module
+# @param ContentZipFile: ContentZipFile
+# @param WorkspaceDir: WorkspaceDir
+# @param ModuleList: ModuleList
+# @param Package: Package
+#
+def InstallModuleContent(FromPath, NewPath, ModulePath, Module, ContentZipFile,
+ WorkspaceDir, ModuleList, Package = None, ReadOnly = False):
+
+ if NewPath.startswith("\\") or NewPath.startswith("/"):
+ NewPath = NewPath[1:]
+
+ if not IsValidInstallPath(NewPath):
+ Logger.Error("UPT", FORMAT_INVALID, ST.ERR_FILE_NAME_INVALIDE%NewPath)
+
+ NewModuleFullPath = os.path.normpath(os.path.join(WorkspaceDir, NewPath,
+ ConvertPath(ModulePath)))
+ Module.SetFullPath(os.path.normpath(os.path.join(NewModuleFullPath,
+ ConvertPath(Module.GetName()) + '.inf')))
+ Module.FileList = []
+
+ for MiscFile in Module.GetMiscFileList():
+ if not MiscFile:
+ continue
+ for Item in MiscFile.GetFileList():
+ File = Item.GetURI()
+ if File.startswith("\\") or File.startswith("/"):
+ File = File[1:]
+
+ if not IsValidInstallPath(File):
+ Logger.Error("UPT", FORMAT_INVALID, ST.ERR_FILE_NAME_INVALIDE%File)
+
+ FromFile = os.path.join(FromPath, ModulePath, File)
+ Executable = Item.GetExecutable()
+ ToFile = os.path.normpath(os.path.join(NewModuleFullPath, ConvertPath(File)))
+ Md5Sum = InstallFile(ContentZipFile, FromFile, ToFile, ReadOnly, Executable)
+ if Package and ((ToFile, Md5Sum) not in Package.FileList):
+ Package.FileList.append((ToFile, Md5Sum))
+ elif Package:
+ continue
+ elif (ToFile, Md5Sum) not in Module.FileList:
+ Module.FileList.append((ToFile, Md5Sum))
+ for Item in Module.GetSourceFileList():
+ File = Item.GetSourceFile()
+ if File.startswith("\\") or File.startswith("/"):
+ File = File[1:]
+
+ if not IsValidInstallPath(File):
+ Logger.Error("UPT", FORMAT_INVALID, ST.ERR_FILE_NAME_INVALIDE%File)
+
+ FromFile = os.path.join(FromPath, ModulePath, File)
+ ToFile = os.path.normpath(os.path.join(NewModuleFullPath, ConvertPath(File)))
+ Md5Sum = InstallFile(ContentZipFile, FromFile, ToFile, ReadOnly)
+ if Package and ((ToFile, Md5Sum) not in Package.FileList):
+ Package.FileList.append((ToFile, Md5Sum))
+ elif Package:
+ continue
+ elif (ToFile, Md5Sum) not in Module.FileList:
+ Module.FileList.append((ToFile, Md5Sum))
+ for Item in Module.GetBinaryFileList():
+ FileNameList = Item.GetFileNameList()
+ for FileName in FileNameList:
+ File = FileName.GetFilename()
+ if File.startswith("\\") or File.startswith("/"):
+ File = File[1:]
+
+ if not IsValidInstallPath(File):
+ Logger.Error("UPT", FORMAT_INVALID, ST.ERR_FILE_NAME_INVALIDE%File)
+
+ FromFile = os.path.join(FromPath, ModulePath, File)
+ ToFile = os.path.normpath(os.path.join(NewModuleFullPath, ConvertPath(File)))
+ Md5Sum = InstallFile(ContentZipFile, FromFile, ToFile, ReadOnly)
+ if Package and ((ToFile, Md5Sum) not in Package.FileList):
+ Package.FileList.append((ToFile, Md5Sum))
+ elif Package:
+ continue
+ elif (ToFile, Md5Sum) not in Module.FileList:
+ Module.FileList.append((ToFile, Md5Sum))
+
+ InstallModuleContentZipFile(ContentZipFile, FromPath, ModulePath, WorkspaceDir, NewPath, Module, Package, ReadOnly,
+ ModuleList)
+
+## InstallModuleContentZipFile
+#
+# InstallModuleContentZipFile
+#
+def InstallModuleContentZipFile(ContentZipFile, FromPath, ModulePath, WorkspaceDir, NewPath, Module, Package, ReadOnly,
+ ModuleList):
+ #
+ # Extract other files under current module path in content Zip file but not listed in the description
+ #
+ if ContentZipFile:
+ for FileName in ContentZipFile.GetZipFile().namelist():
+ FileName = os.path.normpath(FileName)
+ CheckPath = os.path.normpath(os.path.join(FromPath, ModulePath))
+ if FileUnderPath(FileName, CheckPath):
+ if FileName.startswith("\\") or FileName.startswith("/"):
+ FileName = FileName[1:]
+
+ if not IsValidInstallPath(FileName):
+ Logger.Error("UPT", FORMAT_INVALID, ST.ERR_FILE_NAME_INVALIDE%FileName)
+
+ FromFile = FileName
+ ToFile = os.path.normpath(os.path.join(WorkspaceDir,
+ ConvertPath(FileName.replace(FromPath, NewPath, 1))))
+ CheckList = copy.copy(Module.FileList)
+ if Package:
+ CheckList += Package.FileList
+ for Item in CheckList:
+ if Item[0] == ToFile:
+ break
+ else:
+ Md5Sum = InstallFile(ContentZipFile, FromFile, ToFile, ReadOnly)
+ if Package and ((ToFile, Md5Sum) not in Package.FileList):
+ Package.FileList.append((ToFile, Md5Sum))
+ elif Package:
+ continue
+ elif (ToFile, Md5Sum) not in Module.FileList:
+ Module.FileList.append((ToFile, Md5Sum))
+
+ ModuleList.append((Module, Package))
+
+## FileUnderPath
+# Check whether FileName started with directory specified by CheckPath
+#
+# @param FileName: the FileName need to be checked
+# @param CheckPath: the path need to be checked against
+# @return: True or False
+#
+def FileUnderPath(FileName, CheckPath):
+ FileName = FileName.replace('\\', '/')
+ FileName = os.path.normpath(FileName)
+ CheckPath = CheckPath.replace('\\', '/')
+ CheckPath = os.path.normpath(CheckPath)
+ if FileName.startswith(CheckPath):
+ RemainingPath = os.path.normpath(FileName.replace(CheckPath, '', 1))
+ while RemainingPath.startswith('\\') or RemainingPath.startswith('/'):
+ RemainingPath = RemainingPath[1:]
+ if FileName == os.path.normpath(os.path.join(CheckPath, RemainingPath)):
+ return True
+
+ return False
+
+## InstallFile
+# Extract File from Zipfile, set file attribute, and return the Md5Sum
+#
+# @return: True or False
+#
+def InstallFile(ContentZipFile, FromFile, ToFile, ReadOnly, Executable=False):
+ if os.path.exists(os.path.normpath(ToFile)):
+ pass
+ else:
+ if not ContentZipFile or not ContentZipFile.UnpackFile(FromFile, ToFile):
+ Logger.Error("UPT", FILE_NOT_FOUND, ST.ERR_INSTALL_FILE_FROM_EMPTY_CONTENT % FromFile)
+
+ if ReadOnly:
+ if not Executable:
+ chmod(ToFile, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
+ else:
+ chmod(ToFile, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
+ elif Executable:
+ chmod(ToFile, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IWUSR | stat.S_IWGRP |
+ stat.S_IWOTH | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
+ else:
+ chmod(ToFile, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH)
+
+ Md5Signature = md5(__FileHookOpen__(str(ToFile), 'rb').read())
+ Md5Sum = Md5Signature.hexdigest()
+
+ return Md5Sum
+
+## InstallPackageContent method
+#
+# @param FromPath: FromPath
+# @param ToPath: ToPath
+# @param Package: Package
+# @param ContentZipFile: ContentZipFile
+# @param Dep: Dep
+# @param WorkspaceDir: WorkspaceDir
+# @param ModuleList: ModuleList
+#
+def InstallPackageContent(FromPath, ToPath, Package, ContentZipFile, Dep,
+ WorkspaceDir, ModuleList, ReadOnly = False):
+ if Dep:
+ pass
+ Package.FileList = []
+
+ if ToPath.startswith("\\") or ToPath.startswith("/"):
+ ToPath = ToPath[1:]
+
+ if not IsValidInstallPath(ToPath):
+ Logger.Error("UPT", FORMAT_INVALID, ST.ERR_FILE_NAME_INVALIDE%ToPath)
+
+ if FromPath.startswith("\\") or FromPath.startswith("/"):
+ FromPath = FromPath[1:]
+
+ if not IsValidInstallPath(FromPath):
+ Logger.Error("UPT", FORMAT_INVALID, ST.ERR_FILE_NAME_INVALIDE%FromPath)
+
+ PackageFullPath = os.path.normpath(os.path.join(WorkspaceDir, ToPath))
+ for MiscFile in Package.GetMiscFileList():
+ for Item in MiscFile.GetFileList():
+ FileName = Item.GetURI()
+ if FileName.startswith("\\") or FileName.startswith("/"):
+ FileName = FileName[1:]
+
+ if not IsValidInstallPath(FileName):
+ Logger.Error("UPT", FORMAT_INVALID, ST.ERR_FILE_NAME_INVALIDE%FileName)
+
+ FromFile = os.path.join(FromPath, FileName)
+ Executable = Item.GetExecutable()
+ ToFile = (os.path.join(PackageFullPath, ConvertPath(FileName)))
+ Md5Sum = InstallFile(ContentZipFile, FromFile, ToFile, ReadOnly, Executable)
+ if (ToFile, Md5Sum) not in Package.FileList:
+ Package.FileList.append((ToFile, Md5Sum))
+ PackageIncludeArchList = []
+ for Item in Package.GetPackageIncludeFileList():
+ FileName = Item.GetFilePath()
+ if FileName.startswith("\\") or FileName.startswith("/"):
+ FileName = FileName[1:]
+
+ if not IsValidInstallPath(FileName):
+ Logger.Error("UPT", FORMAT_INVALID, ST.ERR_FILE_NAME_INVALIDE%FileName)
+
+ FromFile = os.path.join(FromPath, FileName)
+ ToFile = os.path.normpath(os.path.join(PackageFullPath, ConvertPath(FileName)))
+ RetFile = ContentZipFile.UnpackFile(FromFile, ToFile)
+ if RetFile == '':
+ #
+ # a non-exist path in Zipfile will return '', which means an include directory in our case
+ # save the information for later DEC creation usage and also create the directory
+ #
+ PackageIncludeArchList.append([Item.GetFilePath(), Item.GetSupArchList()])
+ CreateDirectory(ToFile)
+ continue
+ if ReadOnly:
+ chmod(ToFile, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)
+ else:
+ chmod(ToFile, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH|stat.S_IWUSR|stat.S_IWGRP|stat.S_IWOTH)
+ Md5Signature = md5(__FileHookOpen__(str(ToFile), 'rb').read())
+ Md5Sum = Md5Signature.hexdigest()
+ if (ToFile, Md5Sum) not in Package.FileList:
+ Package.FileList.append((ToFile, Md5Sum))
+ Package.SetIncludeArchList(PackageIncludeArchList)
+
+ for Item in Package.GetStandardIncludeFileList():
+ FileName = Item.GetFilePath()
+ if FileName.startswith("\\") or FileName.startswith("/"):
+ FileName = FileName[1:]
+
+ if not IsValidInstallPath(FileName):
+ Logger.Error("UPT", FORMAT_INVALID, ST.ERR_FILE_NAME_INVALIDE%FileName)
+
+ FromFile = os.path.join(FromPath, FileName)
+ ToFile = os.path.normpath(os.path.join(PackageFullPath, ConvertPath(FileName)))
+ Md5Sum = InstallFile(ContentZipFile, FromFile, ToFile, ReadOnly)
+ if (ToFile, Md5Sum) not in Package.FileList:
+ Package.FileList.append((ToFile, Md5Sum))
+
+ #
+ # Update package
+ #
+ Package.SetPackagePath(Package.GetPackagePath().replace(FromPath,
+ ToPath, 1))
+ Package.SetFullPath(os.path.normpath(os.path.join(PackageFullPath,
+ ConvertPath(Package.GetName()) + '.dec')))
+
+ #
+ # Install files in module
+ #
+ Module = None
+ ModuleDict = Package.GetModuleDict()
+ for ModuleGuid, ModuleVersion, ModuleName, ModulePath in ModuleDict:
+ Module = ModuleDict[ModuleGuid, ModuleVersion, ModuleName, ModulePath]
+ InstallModuleContent(FromPath, ToPath, ModulePath, Module,
+ ContentZipFile, WorkspaceDir, ModuleList, Package, ReadOnly)
+
+## GetDPFile method
+#
+# @param ZipFile: A ZipFile
+#
+def GetDPFile(ZipFile):
+ ContentFile = ''
+ DescFile = ''
+ for FileName in ZipFile.namelist():
+ if FileName.endswith('.content'):
+ if not ContentFile:
+ ContentFile = FileName
+ continue
+ elif FileName.endswith('.pkg'):
+ if not DescFile:
+ DescFile = FileName
+ continue
+ else:
+ continue
+
+ Logger.Error("PackagingTool", FILE_TYPE_MISMATCH,
+ ExtraData=ST.ERR_DIST_FILE_TOOMANY)
+ if not DescFile or not ContentFile:
+ Logger.Error("PackagingTool", FILE_UNKNOWN_ERROR,
+ ExtraData=ST.ERR_DIST_FILE_TOOFEW)
+ return DescFile, ContentFile
+
+## InstallDp method
+#
+# Install the distribution to current workspace
+#
+def InstallDp(DistPkg, DpPkgFileName, ContentZipFile, Options, Dep, WorkspaceDir, DataBase):
+ #
+ # PackageList, ModuleList record the information for the meta-data
+ # files that need to be generated later
+ #
+ PackageList = []
+ ModuleList = []
+ DistPkg.PackageSurfaceArea = GetPackageList(DistPkg, Dep, WorkspaceDir, Options,
+ ContentZipFile, ModuleList, PackageList)
+
+ DistPkg.ModuleSurfaceArea = GetModuleList(DistPkg, Dep, WorkspaceDir, ContentZipFile, ModuleList)
+
+ GenToolMisc(DistPkg, WorkspaceDir, ContentZipFile)
+
+ #
+ # copy "Distribution File" to directory $(WORKSPACE)/conf/upt
+ #
+ DistFileName = os.path.split(DpPkgFileName)[1]
+ NewDpPkgFileName = BackupDist(DpPkgFileName, DistPkg.Header.GetGuid(), DistPkg.Header.GetVersion(), WorkspaceDir)
+
+ #
+ # update database
+ #
+ Logger.Quiet(ST.MSG_UPDATE_PACKAGE_DATABASE)
+ DataBase.AddDPObject(DistPkg, NewDpPkgFileName, DistFileName,
+ DistPkg.Header.RePackage)
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/InventoryWs.py b/roms/edk2/BaseTools/Source/Python/UPT/InventoryWs.py
new file mode 100644
index 000000000..955b2e510
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/InventoryWs.py
@@ -0,0 +1,111 @@
+## @file
+# Inventory workspace's distribution package information.
+#
+# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+"""
+Inventory workspace's distribution package information.
+"""
+##
+# Import Modules
+#
+from sys import platform
+from traceback import format_exc
+from platform import python_version
+
+from Logger import StringTable as ST
+from Logger.ToolError import FatalError
+from Logger.ToolError import ABORT_ERROR
+from Logger.ToolError import CODE_ERROR
+import Logger.Log as Logger
+
+from Library import GlobalData
+
+## InventoryDistInstalled
+#
+# This method retrieves the installed distribution information from the internal UPT database
+#
+# @param DataBase: the UPT database
+#
+def InventoryDistInstalled(DataBase):
+ DistInstalled = DataBase.InventoryDistInstalled()
+
+ #
+ # find the max length for each item
+ #
+ DpNameStr = "DpName"
+ DpGuidStr = "DpGuid"
+ DpVerStr = "DpVer"
+ DpOriginalNameStr = "DpOriginalName"
+ MaxGuidlen = len(DpGuidStr)
+ MaxVerlen = len(DpVerStr)
+ MaxDpAliasFileNameLen = len(DpNameStr)
+ MaxDpOrigFileNamelen = len(DpOriginalNameStr)
+
+ for (DpGuid, DpVersion, DpOriginalName, DpAliasFileName) in DistInstalled:
+ MaxGuidlen = max(MaxGuidlen, len(DpGuid))
+ MaxVerlen = max(MaxVerlen, len(DpVersion))
+ MaxDpAliasFileNameLen = max(MaxDpAliasFileNameLen, len(DpAliasFileName))
+ MaxDpOrigFileNamelen = max(MaxDpOrigFileNamelen, len(DpOriginalName))
+
+ OutMsgFmt = "%-*s\t%-*s\t%-*s\t%-s"
+ OutMsg = OutMsgFmt % (MaxDpAliasFileNameLen,
+ DpNameStr,
+ MaxGuidlen,
+ DpGuidStr,
+ MaxVerlen,
+ DpVerStr,
+ DpOriginalNameStr)
+ Logger.Info(OutMsg)
+
+ for (DpGuid, DpVersion, DpFileName, DpAliasFileName) in DistInstalled:
+ OutMsg = OutMsgFmt % (MaxDpAliasFileNameLen,
+ DpAliasFileName,
+ MaxGuidlen,
+ DpGuid,
+ MaxVerlen,
+ DpVersion,
+ DpFileName)
+ Logger.Info(OutMsg)
+
+## Tool entrance method
+#
+# This method mainly dispatch specific methods per the command line options.
+# If no error found, return zero value so the caller of this tool can know
+# if it's executed successfully or not.
+#
+# @param Options: command Options
+#
+def Main(Options = None):
+ if Options:
+ pass
+
+ try:
+ DataBase = GlobalData.gDB
+ InventoryDistInstalled(DataBase)
+ ReturnCode = 0
+ except FatalError as XExcept:
+ ReturnCode = XExcept.args[0]
+ if Logger.GetLevel() <= Logger.DEBUG_9:
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + format_exc())
+ except KeyboardInterrupt:
+ ReturnCode = ABORT_ERROR
+ if Logger.GetLevel() <= Logger.DEBUG_9:
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + format_exc())
+ except:
+ ReturnCode = CODE_ERROR
+ Logger.Error("\nInventoryWs",
+ CODE_ERROR,
+ ST.ERR_UNKNOWN_FATAL_INVENTORYWS_ERR,
+ ExtraData=ST.MSG_SEARCH_FOR_HELP % ST.MSG_EDKII_MAIL_ADDR,
+ RaiseError=False
+ )
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(),
+ platform) + format_exc())
+
+ if ReturnCode == 0:
+ Logger.Quiet(ST.MSG_FINISH)
+
+ return ReturnCode
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Library/CommentGenerating.py b/roms/edk2/BaseTools/Source/Python/UPT/Library/CommentGenerating.py
new file mode 100644
index 000000000..bded508f5
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Library/CommentGenerating.py
@@ -0,0 +1,238 @@
+## @file
+# This file is used to define comment generating interface
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+CommentGenerating
+'''
+
+##
+# Import Modules
+#
+from Library.StringUtils import GetSplitValueList
+from Library.DataType import TAB_SPACE_SPLIT
+from Library.DataType import TAB_INF_GUIDTYPE_VAR
+from Library.DataType import USAGE_ITEM_NOTIFY
+from Library.DataType import ITEM_UNDEFINED
+from Library.DataType import TAB_HEADER_COMMENT
+from Library.DataType import TAB_BINARY_HEADER_COMMENT
+from Library.DataType import TAB_COMMENT_SPLIT
+from Library.DataType import TAB_SPECIAL_COMMENT
+from Library.DataType import END_OF_LINE
+from Library.DataType import TAB_COMMENT_EDK1_SPLIT
+from Library.DataType import TAB_COMMENT_EDK1_START
+from Library.DataType import TAB_COMMENT_EDK1_END
+from Library.DataType import TAB_STAR
+from Library.DataType import TAB_PCD_PROMPT
+from Library.UniClassObject import ConvertSpecialUnicodes
+from Library.Misc import GetLocalValue
+## GenTailCommentLines
+#
+# @param TailCommentLines: the tail comment lines that need to be generated
+# @param LeadingSpaceNum: the number of leading space needed for non-first
+# line tail comment
+#
+def GenTailCommentLines (TailCommentLines, LeadingSpaceNum = 0):
+ TailCommentLines = TailCommentLines.rstrip(END_OF_LINE)
+ CommentStr = TAB_SPACE_SPLIT*2 + TAB_SPECIAL_COMMENT + TAB_SPACE_SPLIT + \
+ (END_OF_LINE + LeadingSpaceNum * TAB_SPACE_SPLIT + TAB_SPACE_SPLIT*2 + TAB_SPECIAL_COMMENT + \
+ TAB_SPACE_SPLIT).join(GetSplitValueList(TailCommentLines, END_OF_LINE))
+
+ return CommentStr
+
+## GenGenericComment
+#
+# @param CommentLines: Generic comment Text, maybe Multiple Lines
+#
+def GenGenericComment (CommentLines):
+ if not CommentLines:
+ return ''
+ CommentLines = CommentLines.rstrip(END_OF_LINE)
+ CommentStr = TAB_SPECIAL_COMMENT + TAB_SPACE_SPLIT + (END_OF_LINE + TAB_COMMENT_SPLIT + TAB_SPACE_SPLIT).join\
+ (GetSplitValueList(CommentLines, END_OF_LINE)) + END_OF_LINE
+ return CommentStr
+
+## GenGenericCommentF
+#
+# similar to GenGenericComment but will remove <EOL> at end of comment once,
+# and for line with only <EOL>, '#\n' will be generated instead of '# \n'
+#
+# @param CommentLines: Generic comment Text, maybe Multiple Lines
+# @return CommentStr: Generated comment line
+#
+def GenGenericCommentF (CommentLines, NumOfPound=1, IsPrompt=False, IsInfLibraryClass=False):
+ if not CommentLines:
+ return ''
+ #
+ # if comment end with '\n', then remove it to prevent one extra line
+ # generate later on
+ #
+ if CommentLines.endswith(END_OF_LINE):
+ CommentLines = CommentLines[:-1]
+ CommentStr = ''
+ if IsPrompt:
+ CommentStr += TAB_COMMENT_SPLIT * NumOfPound + TAB_SPACE_SPLIT + TAB_PCD_PROMPT + TAB_SPACE_SPLIT + \
+ CommentLines.replace(END_OF_LINE, '') + END_OF_LINE
+ else:
+ CommentLineList = GetSplitValueList(CommentLines, END_OF_LINE)
+ FindLibraryClass = False
+ for Line in CommentLineList:
+ # If this comment is for @libraryclass and it has multiple lines
+ # make sure the second lines align to the first line after @libraryclass as below
+ #
+ # ## @libraryclass XYZ FIRST_LINE
+ # ## ABC SECOND_LINE
+ #
+ if IsInfLibraryClass and Line.find(u'@libraryclass ') > -1:
+ FindLibraryClass = True
+ if Line == '':
+ CommentStr += TAB_COMMENT_SPLIT * NumOfPound + END_OF_LINE
+ else:
+ if FindLibraryClass and Line.find(u'@libraryclass ') > -1:
+ CommentStr += TAB_COMMENT_SPLIT * NumOfPound + TAB_SPACE_SPLIT + Line + END_OF_LINE
+ elif FindLibraryClass:
+ CommentStr += TAB_COMMENT_SPLIT * NumOfPound + TAB_SPACE_SPLIT * 16 + Line + END_OF_LINE
+ else:
+ CommentStr += TAB_COMMENT_SPLIT * NumOfPound + TAB_SPACE_SPLIT + Line + END_OF_LINE
+
+ return CommentStr
+
+
+## GenHeaderCommentSection
+#
+# Generate Header comment sections
+#
+# @param Abstract One line of abstract
+# @param Description multiple lines of Description
+# @param Copyright possible multiple copyright lines
+# @param License possible multiple license lines
+#
+def GenHeaderCommentSection(Abstract, Description, Copyright, License, IsBinaryHeader=False, \
+ CommChar=TAB_COMMENT_SPLIT):
+ Content = ''
+
+ #
+ # Convert special character to (c), (r) and (tm).
+ #
+ Abstract = ConvertSpecialUnicodes(Abstract)
+ Description = ConvertSpecialUnicodes(Description)
+ if IsBinaryHeader:
+ Content += CommChar * 2 + TAB_SPACE_SPLIT + TAB_BINARY_HEADER_COMMENT + '\r\n'
+ elif CommChar == TAB_COMMENT_EDK1_SPLIT:
+ Content += CommChar + TAB_SPACE_SPLIT + TAB_COMMENT_EDK1_START + TAB_STAR + TAB_SPACE_SPLIT +\
+ TAB_HEADER_COMMENT + '\r\n'
+ else:
+ Content += CommChar * 2 + TAB_SPACE_SPLIT + TAB_HEADER_COMMENT + '\r\n'
+ if Abstract:
+ Abstract = Abstract.rstrip('\r\n')
+ Content += CommChar + TAB_SPACE_SPLIT + ('\r\n' + CommChar + TAB_SPACE_SPLIT).join(GetSplitValueList\
+ (Abstract, '\n'))
+ Content += '\r\n' + CommChar + '\r\n'
+ else:
+ Content += CommChar + '\r\n'
+
+ if Description:
+ Description = Description.rstrip('\r\n')
+ Content += CommChar + TAB_SPACE_SPLIT + ('\r\n' + CommChar + TAB_SPACE_SPLIT).join(GetSplitValueList\
+ (Description, '\n'))
+ Content += '\r\n' + CommChar + '\r\n'
+
+ #
+ # There is no '#\n' line to separate multiple copyright lines in code base
+ #
+ if Copyright:
+ Copyright = Copyright.rstrip('\r\n')
+ Content += CommChar + TAB_SPACE_SPLIT + ('\r\n' + CommChar + TAB_SPACE_SPLIT).join\
+ (GetSplitValueList(Copyright, '\n'))
+ Content += '\r\n' + CommChar + '\r\n'
+
+ if License:
+ License = License.rstrip('\r\n')
+ Content += CommChar + TAB_SPACE_SPLIT + ('\r\n' + CommChar + TAB_SPACE_SPLIT).join(GetSplitValueList\
+ (License, '\n'))
+ Content += '\r\n' + CommChar + '\r\n'
+
+ if CommChar == TAB_COMMENT_EDK1_SPLIT:
+ Content += CommChar + TAB_SPACE_SPLIT + TAB_STAR + TAB_COMMENT_EDK1_END + '\r\n'
+ else:
+ Content += CommChar * 2 + '\r\n'
+
+ return Content
+
+
+## GenInfPcdTailComment
+# Generate Pcd tail comment for Inf, this would be one line comment
+#
+# @param Usage: Usage type
+# @param TailCommentText: Comment text for tail comment
+#
+def GenInfPcdTailComment (Usage, TailCommentText):
+ if (Usage == ITEM_UNDEFINED) and (not TailCommentText):
+ return ''
+
+ CommentLine = TAB_SPACE_SPLIT.join([Usage, TailCommentText])
+ return GenTailCommentLines(CommentLine)
+
+## GenInfProtocolPPITailComment
+# Generate Protocol/PPI tail comment for Inf
+#
+# @param Usage: Usage type
+# @param TailCommentText: Comment text for tail comment
+#
+def GenInfProtocolPPITailComment (Usage, Notify, TailCommentText):
+ if (not Notify) and (Usage == ITEM_UNDEFINED) and (not TailCommentText):
+ return ''
+
+ if Notify:
+ CommentLine = USAGE_ITEM_NOTIFY + " ## "
+ else:
+ CommentLine = ''
+
+ CommentLine += TAB_SPACE_SPLIT.join([Usage, TailCommentText])
+ return GenTailCommentLines(CommentLine)
+
+## GenInfGuidTailComment
+# Generate Guid tail comment for Inf
+#
+# @param Usage: Usage type
+# @param TailCommentText: Comment text for tail comment
+#
+def GenInfGuidTailComment (Usage, GuidTypeList, VariableName, TailCommentText):
+ GuidType = GuidTypeList[0]
+ if (Usage == ITEM_UNDEFINED) and (GuidType == ITEM_UNDEFINED) and \
+ (not TailCommentText):
+ return ''
+
+ FirstLine = Usage + " ## " + GuidType
+ if GuidType == TAB_INF_GUIDTYPE_VAR:
+ FirstLine += ":" + VariableName
+
+ CommentLine = TAB_SPACE_SPLIT.join([FirstLine, TailCommentText])
+ return GenTailCommentLines(CommentLine)
+
+## GenDecGuidTailComment
+#
+# @param SupModuleList: Supported module type list
+#
+def GenDecTailComment (SupModuleList):
+ CommentLine = TAB_SPACE_SPLIT.join(SupModuleList)
+ return GenTailCommentLines(CommentLine)
+
+
+## _GetHelpStr
+# get HelpString from a list of HelpTextObject, the priority refer to
+# related HLD
+#
+# @param HelpTextObjList: List of HelpTextObject
+#
+# @return HelpStr: the help text string found, '' means no help text found
+#
+def _GetHelpStr(HelpTextObjList):
+ ValueList = []
+ for HelpObj in HelpTextObjList:
+ ValueList.append((HelpObj.GetLang(), HelpObj.GetString()))
+ return GetLocalValue(ValueList, True)
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Library/CommentParsing.py b/roms/edk2/BaseTools/Source/Python/UPT/Library/CommentParsing.py
new file mode 100644
index 000000000..7ba9830d3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Library/CommentParsing.py
@@ -0,0 +1,593 @@
+## @file
+# This file is used to define comment parsing interface
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+CommentParsing
+'''
+
+##
+# Import Modules
+#
+import re
+
+from Library.StringUtils import GetSplitValueList
+from Library.StringUtils import CleanString2
+from Library.DataType import HEADER_COMMENT_NOT_STARTED
+from Library.DataType import TAB_COMMENT_SPLIT
+from Library.DataType import HEADER_COMMENT_LICENSE
+from Library.DataType import HEADER_COMMENT_ABSTRACT
+from Library.DataType import HEADER_COMMENT_COPYRIGHT
+from Library.DataType import HEADER_COMMENT_DESCRIPTION
+from Library.DataType import TAB_SPACE_SPLIT
+from Library.DataType import TAB_COMMA_SPLIT
+from Library.DataType import SUP_MODULE_LIST
+from Library.DataType import TAB_VALUE_SPLIT
+from Library.DataType import TAB_PCD_VALIDRANGE
+from Library.DataType import TAB_PCD_VALIDLIST
+from Library.DataType import TAB_PCD_EXPRESSION
+from Library.DataType import TAB_PCD_PROMPT
+from Library.DataType import TAB_CAPHEX_START
+from Library.DataType import TAB_HEX_START
+from Library.DataType import PCD_ERR_CODE_MAX_SIZE
+from Library.ExpressionValidate import IsValidRangeExpr
+from Library.ExpressionValidate import IsValidListExpr
+from Library.ExpressionValidate import IsValidLogicalExpr
+from Object.POM.CommonObject import TextObject
+from Object.POM.CommonObject import PcdErrorObject
+import Logger.Log as Logger
+from Logger.ToolError import FORMAT_INVALID
+from Logger.ToolError import FORMAT_NOT_SUPPORTED
+from Logger import StringTable as ST
+
+## ParseHeaderCommentSection
+#
+# Parse Header comment section lines, extract Abstract, Description, Copyright
+# , License lines
+#
+# @param CommentList: List of (Comment, LineNumber)
+# @param FileName: FileName of the comment
+#
+def ParseHeaderCommentSection(CommentList, FileName = None, IsBinaryHeader = False):
+ Abstract = ''
+ Description = ''
+ Copyright = ''
+ License = ''
+ EndOfLine = "\n"
+ if IsBinaryHeader:
+ STR_HEADER_COMMENT_START = "@BinaryHeader"
+ else:
+ STR_HEADER_COMMENT_START = "@file"
+ HeaderCommentStage = HEADER_COMMENT_NOT_STARTED
+
+ #
+ # first find the last copyright line
+ #
+ Last = 0
+ for Index in range(len(CommentList)-1, 0, -1):
+ Line = CommentList[Index][0]
+ if _IsCopyrightLine(Line):
+ Last = Index
+ break
+
+ for Item in CommentList:
+ Line = Item[0]
+ LineNo = Item[1]
+
+ if not Line.startswith(TAB_COMMENT_SPLIT) and Line:
+ Logger.Error("\nUPT", FORMAT_INVALID, ST.ERR_INVALID_COMMENT_FORMAT, FileName, Item[1])
+ Comment = CleanString2(Line)[1]
+ Comment = Comment.strip()
+ #
+ # if there are blank lines between License or Description, keep them as they would be
+ # indication of different block; or in the position that Abstract should be, also keep it
+ # as it indicates that no abstract
+ #
+ if not Comment and HeaderCommentStage not in [HEADER_COMMENT_LICENSE, \
+ HEADER_COMMENT_DESCRIPTION, HEADER_COMMENT_ABSTRACT]:
+ continue
+
+ if HeaderCommentStage == HEADER_COMMENT_NOT_STARTED:
+ if Comment.startswith(STR_HEADER_COMMENT_START):
+ HeaderCommentStage = HEADER_COMMENT_ABSTRACT
+ else:
+ License += Comment + EndOfLine
+ else:
+ if HeaderCommentStage == HEADER_COMMENT_ABSTRACT:
+ #
+ # in case there is no abstract and description
+ #
+ if not Comment:
+ HeaderCommentStage = HEADER_COMMENT_DESCRIPTION
+ elif _IsCopyrightLine(Comment):
+ Result, ErrMsg = _ValidateCopyright(Comment)
+ ValidateCopyright(Result, ST.WRN_INVALID_COPYRIGHT, FileName, LineNo, ErrMsg)
+ Copyright += Comment + EndOfLine
+ HeaderCommentStage = HEADER_COMMENT_COPYRIGHT
+ else:
+ Abstract += Comment + EndOfLine
+ HeaderCommentStage = HEADER_COMMENT_DESCRIPTION
+ elif HeaderCommentStage == HEADER_COMMENT_DESCRIPTION:
+ #
+ # in case there is no description
+ #
+ if _IsCopyrightLine(Comment):
+ Result, ErrMsg = _ValidateCopyright(Comment)
+ ValidateCopyright(Result, ST.WRN_INVALID_COPYRIGHT, FileName, LineNo, ErrMsg)
+ Copyright += Comment + EndOfLine
+ HeaderCommentStage = HEADER_COMMENT_COPYRIGHT
+ else:
+ Description += Comment + EndOfLine
+ elif HeaderCommentStage == HEADER_COMMENT_COPYRIGHT:
+ if _IsCopyrightLine(Comment):
+ Result, ErrMsg = _ValidateCopyright(Comment)
+ ValidateCopyright(Result, ST.WRN_INVALID_COPYRIGHT, FileName, LineNo, ErrMsg)
+ Copyright += Comment + EndOfLine
+ else:
+ #
+ # Contents after copyright line are license, those non-copyright lines in between
+ # copyright line will be discarded
+ #
+ if LineNo > Last:
+ if License:
+ License += EndOfLine
+ License += Comment + EndOfLine
+ HeaderCommentStage = HEADER_COMMENT_LICENSE
+ else:
+ if not Comment and not License:
+ continue
+ License += Comment + EndOfLine
+
+ return Abstract.strip(), Description.strip(), Copyright.strip(), License.strip()
+
+## _IsCopyrightLine
+# check whether current line is copyright line, the criteria is whether there is case insensitive keyword "Copyright"
+# followed by zero or more white space characters followed by a "(" character
+#
+# @param LineContent: the line need to be checked
+# @return: True if current line is copyright line, False else
+#
+def _IsCopyrightLine (LineContent):
+ LineContent = LineContent.upper()
+ Result = False
+
+ ReIsCopyrightRe = re.compile(r"""(^|\s)COPYRIGHT *\(""", re.DOTALL)
+ if ReIsCopyrightRe.search(LineContent):
+ Result = True
+
+ return Result
+
+## ParseGenericComment
+#
+# @param GenericComment: Generic comment list, element of
+# (CommentLine, LineNum)
+# @param ContainerFile: Input value for filename of Dec file
+#
+def ParseGenericComment (GenericComment, ContainerFile=None, SkipTag=None):
+ if ContainerFile:
+ pass
+ HelpTxt = None
+ HelpStr = ''
+
+ for Item in GenericComment:
+ CommentLine = Item[0]
+ Comment = CleanString2(CommentLine)[1]
+ if SkipTag is not None and Comment.startswith(SkipTag):
+ Comment = Comment.replace(SkipTag, '', 1)
+ HelpStr += Comment + '\n'
+
+ if HelpStr:
+ HelpTxt = TextObject()
+ if HelpStr.endswith('\n') and not HelpStr.endswith('\n\n') and HelpStr != '\n':
+ HelpStr = HelpStr[:-1]
+ HelpTxt.SetString(HelpStr)
+
+ return HelpTxt
+
+## ParsePcdErrorCode
+#
+# @param Value: original ErrorCode value
+# @param ContainerFile: Input value for filename of Dec file
+# @param LineNum: Line Num
+#
+def ParsePcdErrorCode (Value = None, ContainerFile = None, LineNum = None):
+ try:
+ if Value.strip().startswith((TAB_HEX_START, TAB_CAPHEX_START)):
+ Base = 16
+ else:
+ Base = 10
+ ErrorCode = int(Value, Base)
+ if ErrorCode > PCD_ERR_CODE_MAX_SIZE or ErrorCode < 0:
+ Logger.Error('Parser',
+ FORMAT_NOT_SUPPORTED,
+ "The format %s of ErrorCode is not valid, should be UNIT32 type or long type" % Value,
+ File = ContainerFile,
+ Line = LineNum)
+ ErrorCode = '0x%x' % ErrorCode
+ return ErrorCode
+ except ValueError as XStr:
+ if XStr:
+ pass
+ Logger.Error('Parser',
+ FORMAT_NOT_SUPPORTED,
+ "The format %s of ErrorCode is not valid, should be UNIT32 type or long type" % Value,
+ File = ContainerFile,
+ Line = LineNum)
+
+## ParseDecPcdGenericComment
+#
+# @param GenericComment: Generic comment list, element of (CommentLine,
+# LineNum)
+# @param ContainerFile: Input value for filename of Dec file
+#
+def ParseDecPcdGenericComment (GenericComment, ContainerFile, TokenSpaceGuidCName, CName, MacroReplaceDict):
+ HelpStr = ''
+ PromptStr = ''
+ PcdErr = None
+ PcdErrList = []
+ ValidValueNum = 0
+ ValidRangeNum = 0
+ ExpressionNum = 0
+
+ for (CommentLine, LineNum) in GenericComment:
+ Comment = CleanString2(CommentLine)[1]
+ #
+ # To replace Macro
+ #
+ MACRO_PATTERN = '[\t\s]*\$\([A-Z][_A-Z0-9]*\)'
+ MatchedStrs = re.findall(MACRO_PATTERN, Comment)
+ for MatchedStr in MatchedStrs:
+ if MatchedStr:
+ Macro = MatchedStr.strip().lstrip('$(').rstrip(')').strip()
+ if Macro in MacroReplaceDict:
+ Comment = Comment.replace(MatchedStr, MacroReplaceDict[Macro])
+ if Comment.startswith(TAB_PCD_VALIDRANGE):
+ if ValidValueNum > 0 or ExpressionNum > 0:
+ Logger.Error('Parser',
+ FORMAT_NOT_SUPPORTED,
+ ST.WRN_MULTI_PCD_RANGES,
+ File = ContainerFile,
+ Line = LineNum)
+ else:
+ PcdErr = PcdErrorObject()
+ PcdErr.SetTokenSpaceGuidCName(TokenSpaceGuidCName)
+ PcdErr.SetCName(CName)
+ PcdErr.SetFileLine(Comment)
+ PcdErr.SetLineNum(LineNum)
+ ValidRangeNum += 1
+ ValidRange = Comment.replace(TAB_PCD_VALIDRANGE, "", 1).strip()
+ Valid, Cause = _CheckRangeExpression(ValidRange)
+ if Valid:
+ ValueList = ValidRange.split(TAB_VALUE_SPLIT)
+ if len(ValueList) > 1:
+ PcdErr.SetValidValueRange((TAB_VALUE_SPLIT.join(ValueList[1:])).strip())
+ PcdErr.SetErrorNumber(ParsePcdErrorCode(ValueList[0], ContainerFile, LineNum))
+ else:
+ PcdErr.SetValidValueRange(ValidRange)
+ PcdErrList.append(PcdErr)
+ else:
+ Logger.Error("Parser",
+ FORMAT_NOT_SUPPORTED,
+ Cause,
+ ContainerFile,
+ LineNum)
+ elif Comment.startswith(TAB_PCD_VALIDLIST):
+ if ValidRangeNum > 0 or ExpressionNum > 0:
+ Logger.Error('Parser',
+ FORMAT_NOT_SUPPORTED,
+ ST.WRN_MULTI_PCD_RANGES,
+ File = ContainerFile,
+ Line = LineNum)
+ elif ValidValueNum > 0:
+ Logger.Error('Parser',
+ FORMAT_NOT_SUPPORTED,
+ ST.WRN_MULTI_PCD_VALIDVALUE,
+ File = ContainerFile,
+ Line = LineNum)
+ else:
+ PcdErr = PcdErrorObject()
+ PcdErr.SetTokenSpaceGuidCName(TokenSpaceGuidCName)
+ PcdErr.SetCName(CName)
+ PcdErr.SetFileLine(Comment)
+ PcdErr.SetLineNum(LineNum)
+ ValidValueNum += 1
+ ValidValueExpr = Comment.replace(TAB_PCD_VALIDLIST, "", 1).strip()
+ Valid, Cause = _CheckListExpression(ValidValueExpr)
+ if Valid:
+ ValidValue = Comment.replace(TAB_PCD_VALIDLIST, "", 1).replace(TAB_COMMA_SPLIT, TAB_SPACE_SPLIT)
+ ValueList = ValidValue.split(TAB_VALUE_SPLIT)
+ if len(ValueList) > 1:
+ PcdErr.SetValidValue((TAB_VALUE_SPLIT.join(ValueList[1:])).strip())
+ PcdErr.SetErrorNumber(ParsePcdErrorCode(ValueList[0], ContainerFile, LineNum))
+ else:
+ PcdErr.SetValidValue(ValidValue)
+ PcdErrList.append(PcdErr)
+ else:
+ Logger.Error("Parser",
+ FORMAT_NOT_SUPPORTED,
+ Cause,
+ ContainerFile,
+ LineNum)
+ elif Comment.startswith(TAB_PCD_EXPRESSION):
+ if ValidRangeNum > 0 or ValidValueNum > 0:
+ Logger.Error('Parser',
+ FORMAT_NOT_SUPPORTED,
+ ST.WRN_MULTI_PCD_RANGES,
+ File = ContainerFile,
+ Line = LineNum)
+ else:
+ PcdErr = PcdErrorObject()
+ PcdErr.SetTokenSpaceGuidCName(TokenSpaceGuidCName)
+ PcdErr.SetCName(CName)
+ PcdErr.SetFileLine(Comment)
+ PcdErr.SetLineNum(LineNum)
+ ExpressionNum += 1
+ Expression = Comment.replace(TAB_PCD_EXPRESSION, "", 1).strip()
+ Valid, Cause = _CheckExpression(Expression)
+ if Valid:
+ ValueList = Expression.split(TAB_VALUE_SPLIT)
+ if len(ValueList) > 1:
+ PcdErr.SetExpression((TAB_VALUE_SPLIT.join(ValueList[1:])).strip())
+ PcdErr.SetErrorNumber(ParsePcdErrorCode(ValueList[0], ContainerFile, LineNum))
+ else:
+ PcdErr.SetExpression(Expression)
+ PcdErrList.append(PcdErr)
+ else:
+ Logger.Error("Parser",
+ FORMAT_NOT_SUPPORTED,
+ Cause,
+ ContainerFile,
+ LineNum)
+ elif Comment.startswith(TAB_PCD_PROMPT):
+ if PromptStr:
+ Logger.Error('Parser',
+ FORMAT_NOT_SUPPORTED,
+ ST.WRN_MULTI_PCD_PROMPT,
+ File = ContainerFile,
+ Line = LineNum)
+ PromptStr = Comment.replace(TAB_PCD_PROMPT, "", 1).strip()
+ else:
+ if Comment:
+ HelpStr += Comment + '\n'
+
+ #
+ # remove the last EOL if the comment is of format 'FOO\n'
+ #
+ if HelpStr.endswith('\n'):
+ if HelpStr != '\n' and not HelpStr.endswith('\n\n'):
+ HelpStr = HelpStr[:-1]
+
+ return HelpStr, PcdErrList, PromptStr
+
+## ParseDecPcdTailComment
+#
+# @param TailCommentList: Tail comment list of Pcd, item of format (Comment, LineNum)
+# @param ContainerFile: Input value for filename of Dec file
+# @retVal SupModuleList: The supported module type list detected
+# @retVal HelpStr: The generic help text string detected
+#
+def ParseDecPcdTailComment (TailCommentList, ContainerFile):
+ assert(len(TailCommentList) == 1)
+ TailComment = TailCommentList[0][0]
+ LineNum = TailCommentList[0][1]
+
+ Comment = TailComment.lstrip(" #")
+
+ ReFindFirstWordRe = re.compile(r"""^([^ #]*)""", re.DOTALL)
+
+ #
+ # get first word and compare with SUP_MODULE_LIST
+ #
+ MatchObject = ReFindFirstWordRe.match(Comment)
+ if not (MatchObject and MatchObject.group(1) in SUP_MODULE_LIST):
+ return None, Comment
+
+ #
+ # parse line, it must have supported module type specified
+ #
+ if Comment.find(TAB_COMMENT_SPLIT) == -1:
+ Comment += TAB_COMMENT_SPLIT
+ SupMode, HelpStr = GetSplitValueList(Comment, TAB_COMMENT_SPLIT, 1)
+ SupModuleList = []
+ for Mod in GetSplitValueList(SupMode, TAB_SPACE_SPLIT):
+ if not Mod:
+ continue
+ elif Mod not in SUP_MODULE_LIST:
+ Logger.Error("UPT",
+ FORMAT_INVALID,
+ ST.WRN_INVALID_MODULE_TYPE%Mod,
+ ContainerFile,
+ LineNum)
+ else:
+ SupModuleList.append(Mod)
+
+ return SupModuleList, HelpStr
+
+## _CheckListExpression
+#
+# @param Expression: Pcd value list expression
+#
+def _CheckListExpression(Expression):
+ ListExpr = ''
+ if TAB_VALUE_SPLIT in Expression:
+ ListExpr = Expression[Expression.find(TAB_VALUE_SPLIT)+1:]
+ else:
+ ListExpr = Expression
+
+ return IsValidListExpr(ListExpr)
+
+## _CheckExpression
+#
+# @param Expression: Pcd value expression
+#
+def _CheckExpression(Expression):
+ Expr = ''
+ if TAB_VALUE_SPLIT in Expression:
+ Expr = Expression[Expression.find(TAB_VALUE_SPLIT)+1:]
+ else:
+ Expr = Expression
+ return IsValidLogicalExpr(Expr, True)
+
+## _CheckRangeExpression
+#
+# @param Expression: Pcd range expression
+#
+def _CheckRangeExpression(Expression):
+ RangeExpr = ''
+ if TAB_VALUE_SPLIT in Expression:
+ RangeExpr = Expression[Expression.find(TAB_VALUE_SPLIT)+1:]
+ else:
+ RangeExpr = Expression
+
+ return IsValidRangeExpr(RangeExpr)
+
+## ValidateCopyright
+#
+#
+#
+def ValidateCopyright(Result, ErrType, FileName, LineNo, ErrMsg):
+ if not Result:
+ Logger.Warn("\nUPT", ErrType, FileName, LineNo, ErrMsg)
+
+## _ValidateCopyright
+#
+# @param Line: Line that contains copyright information, # stripped
+#
+# @retval Result: True if line is conformed to Spec format, False else
+# @retval ErrMsg: the detailed error description
+#
+def _ValidateCopyright(Line):
+ if Line:
+ pass
+ Result = True
+ ErrMsg = ''
+
+ return Result, ErrMsg
+
+def GenerateTokenList (Comment):
+ #
+ # Tokenize Comment using '#' and ' ' as token separators
+ #
+ ReplacedComment = None
+ while Comment != ReplacedComment:
+ ReplacedComment = Comment
+ Comment = Comment.replace('##', '#').replace(' ', ' ').replace(' ', '#').strip('# ')
+ return Comment.split('#')
+
+
+#
+# Comment - Comment to parse
+# TypeTokens - A dictionary of type token synonyms
+# RemoveTokens - A list of tokens to remove from help text
+# ParseVariable - True for parsing [Guids]. Otherwise False
+#
+def ParseComment (Comment, UsageTokens, TypeTokens, RemoveTokens, ParseVariable):
+ #
+ # Initialize return values
+ #
+ Usage = None
+ Type = None
+ String = None
+
+ Comment = Comment[0]
+
+ NumTokens = 2
+ if ParseVariable:
+ #
+ # Remove white space around first instance of ':' from Comment if 'Variable'
+ # is in front of ':' and Variable is the 1st or 2nd token in Comment.
+ #
+ List = Comment.split(':', 1)
+ if len(List) > 1:
+ SubList = GenerateTokenList (List[0].strip())
+ if len(SubList) in [1, 2] and SubList[-1] == 'Variable':
+ if List[1].strip().find('L"') == 0:
+ Comment = List[0].strip() + ':' + List[1].strip()
+
+ #
+ # Remove first instance of L"<VariableName> from Comment and put into String
+ # if and only if L"<VariableName>" is the 1st token, the 2nd token. Or
+ # L"<VariableName>" is the third token immediately following 'Variable:'.
+ #
+ End = -1
+ Start = Comment.find('Variable:L"')
+ if Start >= 0:
+ String = Comment[Start + 9:]
+ End = String[2:].find('"')
+ else:
+ Start = Comment.find('L"')
+ if Start >= 0:
+ String = Comment[Start:]
+ End = String[2:].find('"')
+ if End >= 0:
+ SubList = GenerateTokenList (Comment[:Start])
+ if len(SubList) < 2:
+ Comment = Comment[:Start] + String[End + 3:]
+ String = String[:End + 3]
+ Type = 'Variable'
+ NumTokens = 1
+
+ #
+ # Initialize HelpText to Comment.
+ # Content will be remove from HelpText as matching tokens are found
+ #
+ HelpText = Comment
+
+ #
+ # Tokenize Comment using '#' and ' ' as token separators
+ #
+ List = GenerateTokenList (Comment)
+
+ #
+ # Search first two tokens for Usage and Type and remove any matching tokens
+ # from HelpText
+ #
+ for Token in List[0:NumTokens]:
+ if Usage is None and Token in UsageTokens:
+ Usage = UsageTokens[Token]
+ HelpText = HelpText.replace(Token, '')
+ if Usage is not None or not ParseVariable:
+ for Token in List[0:NumTokens]:
+ if Type is None and Token in TypeTokens:
+ Type = TypeTokens[Token]
+ HelpText = HelpText.replace(Token, '')
+ if Usage is not None:
+ for Token in List[0:NumTokens]:
+ if Token in RemoveTokens:
+ HelpText = HelpText.replace(Token, '')
+
+ #
+ # If no Usage token is present and set Usage to UNDEFINED
+ #
+ if Usage is None:
+ Usage = 'UNDEFINED'
+
+ #
+ # If no Type token is present and set Type to UNDEFINED
+ #
+ if Type is None:
+ Type = 'UNDEFINED'
+
+ #
+ # If Type is not 'Variable:', then set String to None
+ #
+ if Type != 'Variable':
+ String = None
+
+ #
+ # Strip ' ' and '#' from the beginning of HelpText
+ # If HelpText is an empty string after all parsing is
+ # complete then set HelpText to None
+ #
+ HelpText = HelpText.lstrip('# ')
+ if HelpText == '':
+ HelpText = None
+
+ #
+ # Return parsing results
+ #
+ return Usage, Type, String, HelpText
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Library/DataType.py b/roms/edk2/BaseTools/Source/Python/UPT/Library/DataType.py
new file mode 100644
index 000000000..bd216786a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Library/DataType.py
@@ -0,0 +1,949 @@
+## @file
+# This file is used to define class for data type structure
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+DataType
+'''
+
+##
+# Module List Items
+#
+MODULE_LIST = ["BASE",
+ "SEC",
+ "PEI_CORE",
+ "PEIM",
+ "DXE_CORE",
+ "DXE_DRIVER",
+ "SMM_CORE",
+ "DXE_RUNTIME_DRIVER",
+ "DXE_SAL_DRIVER",
+ "DXE_SMM_DRIVER",
+ "UEFI_DRIVER",
+ "UEFI_APPLICATION",
+ "USER_DEFINED"]
+
+VALID_DEPEX_MODULE_TYPE_LIST = ["PEIM",
+ "DXE_DRIVER",
+ "DXE_SMM_DRIVER",
+ "DXE_RUNTIME_DRIVER",
+ "DXE_SAL_DRIVER",
+ "UEFI_DRIVER",
+ ]
+##
+# Usage List Items
+#
+USAGE_LIST = ["CONSUMES",
+ "SOMETIMES_CONSUMES",
+ "PRODUCES",
+ "SOMETIMES_PRODUCES"]
+
+TAB_LANGUAGE_EN_US = 'en-US'
+TAB_LANGUAGE_ENG = 'eng'
+TAB_LANGUAGE_EN = 'en'
+TAB_LANGUAGE_EN_X = 'en-x-tianocore'
+
+USAGE_ITEM_PRODUCES = 'PRODUCES'
+USAGE_ITEM_SOMETIMES_PRODUCES = 'SOMETIMES_PRODUCES'
+USAGE_ITEM_CONSUMES = 'CONSUMES'
+USAGE_ITEM_SOMETIMES_CONSUMES = 'SOMETIMES_CONSUMES'
+USAGE_ITEM_TO_START = 'TO_START'
+USAGE_ITEM_BY_START = 'BY_START'
+USAGE_ITEM_NOTIFY = 'NOTIFY'
+USAGE_ITEM_UNDEFINED = 'UNDEFINED'
+
+USAGE_CONSUMES_LIST = [USAGE_ITEM_CONSUMES,
+ 'CONSUMED',
+ 'ALWAYS_CONSUMED',
+ 'ALWAYS_CONSUMES'
+ ]
+
+USAGE_PRODUCES_LIST = [USAGE_ITEM_PRODUCES,
+ 'PRODUCED',
+ 'ALWAYS_PRODUCED',
+ 'ALWAYS_PRODUCES'
+ ]
+
+USAGE_SOMETIMES_PRODUCES_LIST = [USAGE_ITEM_SOMETIMES_PRODUCES,
+ 'SOMETIMES_PRODUCED'
+ ]
+
+USAGE_SOMETIMES_CONSUMES_LIST = [USAGE_ITEM_SOMETIMES_CONSUMES,
+ 'SOMETIMES_CONSUMED'
+ ]
+
+ITEM_UNDEFINED = 'UNDEFINED'
+
+TAB_PCD_VALIDRANGE = '@ValidRange'
+TAB_PCD_VALIDLIST = '@ValidList'
+TAB_PCD_EXPRESSION = '@Expression'
+TAB_PCD_PROMPT = '@Prompt'
+TAB_STR_TOKENCNAME = 'STR'
+TAB_STR_TOKENPROMPT = 'PROMPT'
+TAB_STR_TOKENHELP = 'HELP'
+TAB_STR_TOKENERR = 'ERR'
+
+#
+# Dictionary of usage tokens and their synonyms
+#
+ALL_USAGE_TOKENS = {
+ "PRODUCES" : "PRODUCES",
+ "PRODUCED" : "PRODUCES",
+ "ALWAYS_PRODUCES" : "PRODUCES",
+ "ALWAYS_PRODUCED" : "PRODUCES",
+ "SOMETIMES_PRODUCES" : "SOMETIMES_PRODUCES",
+ "SOMETIMES_PRODUCED" : "SOMETIMES_PRODUCES",
+ "CONSUMES" : "CONSUMES",
+ "CONSUMED" : "CONSUMES",
+ "ALWAYS_CONSUMES" : "CONSUMES",
+ "ALWAYS_CONSUMED" : "CONSUMES",
+ "SOMETIMES_CONSUMES" : "SOMETIMES_CONSUMES",
+ "SOMETIMES_CONSUMED" : "SOMETIMES_CONSUMES",
+ "SOMETIME_CONSUMES" : "SOMETIMES_CONSUMES",
+ "UNDEFINED" : "UNDEFINED"
+ }
+
+PROTOCOL_USAGE_TOKENS = {
+ "TO_START" : "TO_START",
+ "BY_START" : "BY_START"
+ }
+
+PROTOCOL_USAGE_TOKENS.update (ALL_USAGE_TOKENS)
+
+#
+# Dictionary of GUID type tokens
+#
+GUID_TYPE_TOKENS = {
+ "Event" : "Event",
+ "File" : "File",
+ "FV" : "FV",
+ "GUID" : "GUID",
+ "Guid" : "GUID",
+ "HII" : "HII",
+ "HOB" : "HOB",
+ "Hob" : "HOB",
+ "Hob:" : "HOB",
+ "SystemTable" : "SystemTable",
+ "TokenSpaceGuid" : "TokenSpaceGuid",
+ "UNDEFINED" : "UNDEFINED"
+ }
+
+#
+# Dictionary of Protocol Notify tokens and their synonyms
+#
+PROTOCOL_NOTIFY_TOKENS = {
+ "NOTIFY" : "NOTIFY",
+ "PROTOCOL_NOTIFY" : "NOTIFY",
+ "UNDEFINED" : "UNDEFINED"
+ }
+
+#
+# Dictionary of PPI Notify tokens and their synonyms
+#
+PPI_NOTIFY_TOKENS = {
+ "NOTIFY" : "NOTIFY",
+ "PPI_NOTIFY" : "NOTIFY",
+ "UNDEFINED" : "UNDEFINED"
+ }
+
+EVENT_TOKENS = {
+ "EVENT_TYPE_PERIODIC_TIMER" : "EVENT_TYPE_PERIODIC_TIMER",
+ "EVENT_TYPE_RELATIVE_TIMER" : "EVENT_TYPE_RELATIVE_TIMER",
+ "UNDEFINED" : "UNDEFINED"
+ }
+
+BOOTMODE_TOKENS = {
+ "FULL" : "FULL",
+ "MINIMAL" : "MINIMAL",
+ "NO_CHANGE" : "NO_CHANGE",
+ "DIAGNOSTICS" : "DIAGNOSTICS",
+ "DEFAULT" : "DEFAULT",
+ "S2_RESUME" : "S2_RESUME",
+ "S3_RESUME" : "S3_RESUME",
+ "S4_RESUME" : "S4_RESUME",
+ "S5_RESUME" : "S5_RESUME",
+ "FLASH_UPDATE" : "FLASH_UPDATE",
+ "RECOVERY_FULL" : "RECOVERY_FULL",
+ "RECOVERY_MINIMAL" : "RECOVERY_MINIMAL",
+ "RECOVERY_NO_CHANGE" : "RECOVERY_NO_CHANGE",
+ "RECOVERY_DIAGNOSTICS" : "RECOVERY_DIAGNOSTICS",
+ "RECOVERY_DEFAULT" : "RECOVERY_DEFAULT",
+ "RECOVERY_S2_RESUME" : "RECOVERY_S2_RESUME",
+ "RECOVERY_S3_RESUME" : "RECOVERY_S3_RESUME",
+ "RECOVERY_S4_RESUME" : "RECOVERY_S4_RESUME",
+ "RECOVERY_S5_RESUME" : "RECOVERY_S5_RESUME",
+ "RECOVERY_FLASH_UPDATE" : "RECOVERY_FLASH_UPDATE",
+ "UNDEFINED" : "UNDEFINED"
+ }
+
+HOB_TOKENS = {
+ "PHIT" : "PHIT",
+ "MEMORY_ALLOCATION" : "MEMORY_ALLOCATION",
+ "LOAD_PEIM" : "LOAD_PEIM",
+ "RESOURCE_DESCRIPTOR" : "RESOURCE_DESCRIPTOR",
+ "FIRMWARE_VOLUME" : "FIRMWARE_VOLUME",
+ "UNDEFINED" : "UNDEFINED"
+ }
+
+##
+# Usage List Items for Protocol
+#
+PROTOCOL_USAGE_LIST = USAGE_LIST + ["TO_START", "BY_START"]
+
+##
+# End of Line
+# Use this but not os.linesep for os.linesep has bug in it.
+#
+END_OF_LINE = '\n'
+
+##
+# Arch List Items
+#
+ARCH_LIST = ["IA32",
+ "X64",
+ "IPF",
+ "EBC",
+ "COMMON"]
+##
+# PCD driver type list items
+#
+PCD_DRIVER_TYPE_LIST = ["PEI_PCD_DRIVER", "DXE_PCD_DRIVER"]
+
+##
+# Boot Mode List Items
+#
+BOOT_MODE_LIST = ["FULL",
+ "MINIMAL",
+ "NO_CHANGE",
+ "DIAGNOSTICS",
+ "DEFAULT",
+ "S2_RESUME",
+ "S3_RESUME",
+ "S4_RESUME",
+ "S5_RESUME",
+ "FLASH_UPDATE",
+ "RECOVERY_FULL",
+ "RECOVERY_MINIMAL",
+ "RECOVERY_NO_CHANGE",
+ "RECOVERY_DIAGNOSTICS",
+ "RECOVERY_DEFAULT",
+ "RECOVERY_S2_RESUME",
+ "RECOVERY_S3_RESUME",
+ "RECOVERY_S4_RESUME",
+ "RECOVERY_S5_RESUME",
+ "RECOVERY_FLASH_UPDATE"]
+
+##
+# Event Type List Items
+#
+EVENT_TYPE_LIST = ["EVENT_TYPE_PERIODIC_TIMER",
+ "EVENT_TYPE_RELATIVE_TIMER"]
+
+##
+# Hob Type List Items
+#
+HOB_TYPE_LIST = ["PHIT",
+ "MEMORY_ALLOCATION",
+ "RESOURCE_DESCRIPTOR",
+ "FIRMWARE_VOLUME",
+ "LOAD_PEIM"]
+
+##
+# GUID_TYPE_LIST
+#
+GUID_TYPE_LIST = ["Event", "File", "FV", "GUID", "HII", "HOB",
+ "SystemTable", "TokenSpaceGuid", "Variable"]
+##
+# PCD Usage Type List of Package
+#
+PCD_USAGE_TYPE_LIST_OF_PACKAGE = ["FeatureFlag", "PatchableInModule",
+ "FixedAtBuild", "Dynamic", "DynamicEx"]
+
+##
+# PCD Usage Type List of Module
+#
+PCD_USAGE_TYPE_LIST_OF_MODULE = ["FEATUREPCD", "PATCHPCD", "FIXEDPCD", "PCD", "PCDEX"]
+##
+# PCD Usage Type List of UPT
+#
+PCD_USAGE_TYPE_LIST_OF_UPT = PCD_USAGE_TYPE_LIST_OF_MODULE
+
+##
+# Binary File Type List
+#
+BINARY_FILE_TYPE_LIST = ["PE32", "PIC", "TE", "DXE_DEPEX", "VER", "UI", "COMPAT16", "FV", "BIN", "RAW",
+ "ACPI", "ASL",
+ "PEI_DEPEX",
+ "SMM_DEPEX",
+ "SUBTYPE_GUID",
+ "DISPOSABLE"
+ ]
+BINARY_FILE_TYPE_LIST_IN_UDP = \
+ ["GUID", "FREEFORM",
+ "UEFI_IMAGE", "PE32", "PIC",
+ "PEI_DEPEX",
+ "DXE_DEPEX",
+ "SMM_DEPEX",
+ "FV", "TE",
+ "BIN", "VER", "UI"
+ ]
+
+SUBTYPE_GUID_BINARY_FILE_TYPE = "FREEFORM"
+##
+# Possible values for COMPONENT_TYPE, and their descriptions, are listed in
+# the table,
+# "Component (module) Types." For each component, the BASE_NAME and
+# COMPONENT_TYPE
+# are required. The COMPONENT_TYPE definition is case sensitive.
+#
+COMPONENT_TYPE_LIST = [
+ "APPLICATION",
+ "ACPITABLE",
+ "APRIORI",
+ "BINARY",
+ "BS_DRIVER",
+ "CONFIG",
+ "FILE",
+ "FVIMAGEFILE",
+ "LIBRARY",
+ "LOGO",
+ "LEGACY16",
+ "MICROCODE",
+ "PE32_PEIM",
+ "PEI_CORE",
+ "RAWFILE",
+ "RT_DRIVER",
+ "SAL_RT_DRIVER",
+ "SECURITY_CORE",
+ "COMBINED_PEIM_DRIVER",
+ "PIC_PEIM",
+ "RELOCATABLE_PEIM"
+ ]
+
+##
+# Common Definitions
+#
+TAB_SPLIT = '.'
+TAB_COMMENT_EDK1_START = '/*'
+TAB_COMMENT_EDK1_END = '*/'
+TAB_COMMENT_EDK1_SPLIT = '//'
+TAB_COMMENT_SPLIT = '#'
+TAB_EQUAL_SPLIT = '='
+TAB_DEQUAL_SPLIT = '=='
+TAB_VALUE_SPLIT = '|'
+TAB_COMMA_SPLIT = ','
+TAB_HORIZON_LINE_SPLIT = '-'
+TAB_SPACE_SPLIT = ' '
+TAB_UNDERLINE_SPLIT = '_'
+TAB_SEMI_COLON_SPLIT = ';'
+TAB_COLON_SPLIT = ':'
+TAB_SECTION_START = '['
+TAB_SECTION_END = ']'
+TAB_OPTION_START = '<'
+TAB_OPTION_END = '>'
+TAB_SLASH = '\\'
+TAB_BACK_SLASH = '/'
+TAB_SPECIAL_COMMENT = '##'
+TAB_HEADER_COMMENT = '@file'
+TAB_BINARY_HEADER_COMMENT = '@BinaryHeader'
+TAB_STAR = '*'
+TAB_ENCODING_UTF16LE = 'utf_16_le'
+TAB_CAPHEX_START = '0X'
+TAB_HEX_START = '0x'
+TAB_PCD_ERROR = 'Error'
+TAB_PCD_ERROR_SECTION_COMMENT = 'Error message section'
+TAB_UNI_FILE_SUFFIXS = ['.uni', '.UNI', '.Uni']
+
+TAB_EDK_SOURCE = '$(EDK_SOURCE)'
+TAB_EFI_SOURCE = '$(EFI_SOURCE)'
+TAB_WORKSPACE = '$(WORKSPACE)'
+
+TAB_ARCH_NULL = ''
+TAB_ARCH_COMMON = 'COMMON'
+TAB_ARCH_IA32 = 'IA32'
+TAB_ARCH_X64 = 'X64'
+TAB_ARCH_IPF = 'IPF'
+TAB_ARCH_ARM = 'ARM'
+TAB_ARCH_EBC = 'EBC'
+
+ARCH_LIST = \
+[TAB_ARCH_IA32, TAB_ARCH_X64, TAB_ARCH_IPF, TAB_ARCH_ARM, TAB_ARCH_EBC]
+
+SUP_MODULE_BASE = 'BASE'
+SUP_MODULE_SEC = 'SEC'
+SUP_MODULE_PEI_CORE = 'PEI_CORE'
+SUP_MODULE_PEIM = 'PEIM'
+SUP_MODULE_DXE_CORE = 'DXE_CORE'
+SUP_MODULE_DXE_DRIVER = 'DXE_DRIVER'
+SUP_MODULE_DXE_RUNTIME_DRIVER = 'DXE_RUNTIME_DRIVER'
+SUP_MODULE_DXE_SAL_DRIVER = 'DXE_SAL_DRIVER'
+SUP_MODULE_DXE_SMM_DRIVER = 'DXE_SMM_DRIVER'
+SUP_MODULE_UEFI_DRIVER = 'UEFI_DRIVER'
+SUP_MODULE_UEFI_APPLICATION = 'UEFI_APPLICATION'
+SUP_MODULE_USER_DEFINED = 'USER_DEFINED'
+SUP_MODULE_SMM_CORE = 'SMM_CORE'
+
+SUP_MODULE_LIST = \
+[SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, \
+SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER, \
+ SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, \
+ SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_UEFI_DRIVER, \
+ SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, \
+ SUP_MODULE_SMM_CORE]
+SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(l for l in SUP_MODULE_LIST)
+
+EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY'
+EDK_COMPONENT_TYPE_SECUARITY_CORE = 'SECUARITY_CORE'
+EDK_COMPONENT_TYPE_PEI_CORE = 'PEI_CORE'
+EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER = 'COMBINED_PEIM_DRIVER'
+EDK_COMPONENT_TYPE_PIC_PEIM = 'PIC_PEIM'
+EDK_COMPONENT_TYPE_RELOCATABLE_PEIM = 'RELOCATABLE_PEIM'
+EDK_COMPONENT_TYPE_BS_DRIVER = 'BS_DRIVER'
+EDK_COMPONENT_TYPE_RT_DRIVER = 'RT_DRIVER'
+EDK_COMPONENT_TYPE_SAL_RT_DRIVER = 'SAL_RT_DRIVER'
+EDK_COMPONENT_TYPE_APPLICATION = 'APPLICATION'
+EDK_NAME = 'EDK'
+EDKII_NAME = 'EDKII'
+
+BINARY_FILE_TYPE_FW = 'FW'
+BINARY_FILE_TYPE_GUID = 'GUID'
+BINARY_FILE_TYPE_PREEFORM = 'PREEFORM'
+BINARY_FILE_TYPE_UEFI_APP = 'UEFI_APP'
+BINARY_FILE_TYPE_UNI_UI = 'UNI_UI'
+BINARY_FILE_TYPE_SEC_UI = 'SEC_UI'
+BINARY_FILE_TYPE_UNI_VER = 'UNI_VER'
+BINARY_FILE_TYPE_SEC_VER = 'SEC_VER'
+BINARY_FILE_TYPE_LIB = 'LIB'
+BINARY_FILE_TYPE_PE32 = 'PE32'
+BINARY_FILE_TYPE_PIC = 'PIC'
+BINARY_FILE_TYPE_PEI_DEPEX = 'PEI_DEPEX'
+BINARY_FILE_TYPE_DXE_DEPEX = 'DXE_DEPEX'
+BINARY_FILE_TYPE_SMM_DEPEX = 'SMM_DEPEX'
+BINARY_FILE_TYPE_TE = 'TE'
+BINARY_FILE_TYPE_VER = 'VER'
+BINARY_FILE_TYPE_UI = 'UI'
+BINARY_FILE_TYPE_BIN = 'BIN'
+BINARY_FILE_TYPE_FV = 'FV'
+BINARY_FILE_TYPE_UI_LIST = [BINARY_FILE_TYPE_UNI_UI,
+ BINARY_FILE_TYPE_SEC_UI,
+ BINARY_FILE_TYPE_UI
+ ]
+BINARY_FILE_TYPE_VER_LIST = [BINARY_FILE_TYPE_UNI_VER,
+ BINARY_FILE_TYPE_SEC_VER,
+ BINARY_FILE_TYPE_VER
+ ]
+
+DEPEX_SECTION_LIST = ['<PEI_DEPEX>',
+ '<DXE_DEPEX>',
+ '<SMM_DEPEX>'
+ ]
+
+PLATFORM_COMPONENT_TYPE_LIBRARY = 'LIBRARY'
+PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS = 'LIBRARY_CLASS'
+PLATFORM_COMPONENT_TYPE_MODULE = 'MODULE'
+
+TAB_LIBRARIES = 'Libraries'
+
+TAB_SOURCE = 'Source'
+TAB_SOURCES = 'Sources'
+TAB_SOURCES_COMMON = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_SOURCES_IA32 = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_IA32
+TAB_SOURCES_X64 = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_X64
+TAB_SOURCES_IPF = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_IPF
+TAB_SOURCES_ARM = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_ARM
+TAB_SOURCES_EBC = TAB_SOURCES + TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_BINARIES = 'Binaries'
+TAB_BINARIES_COMMON = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_BINARIES_IA32 = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_IA32
+TAB_BINARIES_X64 = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_X64
+TAB_BINARIES_IPF = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_IPF
+TAB_BINARIES_ARM = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_ARM
+TAB_BINARIES_EBC = TAB_BINARIES + TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_INCLUDES = 'Includes'
+TAB_INCLUDES_COMMON = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_INCLUDES_IA32 = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_IA32
+TAB_INCLUDES_X64 = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_X64
+TAB_INCLUDES_IPF = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_IPF
+TAB_INCLUDES_ARM = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_ARM
+TAB_INCLUDES_EBC = TAB_INCLUDES + TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_GUIDS = 'Guids'
+TAB_GUIDS_COMMON = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_GUIDS_IA32 = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_IA32
+TAB_GUIDS_X64 = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_X64
+TAB_GUIDS_IPF = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_IPF
+TAB_GUIDS_ARM = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_ARM
+TAB_GUIDS_EBC = TAB_GUIDS + TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_PROTOCOLS = 'Protocols'
+TAB_PROTOCOLS_COMMON = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_PROTOCOLS_IA32 = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_IA32
+TAB_PROTOCOLS_X64 = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_X64
+TAB_PROTOCOLS_IPF = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_IPF
+TAB_PROTOCOLS_ARM = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_ARM
+TAB_PROTOCOLS_EBC = TAB_PROTOCOLS + TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_PPIS = 'Ppis'
+TAB_PPIS_COMMON = TAB_PPIS + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_PPIS_IA32 = TAB_PPIS + TAB_SPLIT + TAB_ARCH_IA32
+TAB_PPIS_X64 = TAB_PPIS + TAB_SPLIT + TAB_ARCH_X64
+TAB_PPIS_IPF = TAB_PPIS + TAB_SPLIT + TAB_ARCH_IPF
+TAB_PPIS_ARM = TAB_PPIS + TAB_SPLIT + TAB_ARCH_ARM
+TAB_PPIS_EBC = TAB_PPIS + TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_LIBRARY_CLASSES = 'LibraryClasses'
+TAB_LIBRARY_CLASSES_COMMON = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_LIBRARY_CLASSES_IA32 = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_IA32
+TAB_LIBRARY_CLASSES_X64 = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_X64
+TAB_LIBRARY_CLASSES_IPF = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_IPF
+TAB_LIBRARY_CLASSES_ARM = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_ARM
+TAB_LIBRARY_CLASSES_EBC = TAB_LIBRARY_CLASSES + TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_PACKAGES = 'Packages'
+TAB_PACKAGES_COMMON = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_PACKAGES_IA32 = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_IA32
+TAB_PACKAGES_X64 = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_X64
+TAB_PACKAGES_IPF = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_IPF
+TAB_PACKAGES_ARM = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_ARM
+TAB_PACKAGES_EBC = TAB_PACKAGES + TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_PCDS = 'Pcds'
+TAB_PCDS_FIXED_AT_BUILD = 'FixedAtBuild'
+TAB_PCDS_PATCHABLE_IN_MODULE = 'PatchableInModule'
+TAB_PCDS_FEATURE_FLAG = 'FeatureFlag'
+TAB_PCDS_DYNAMIC_EX = 'DynamicEx'
+TAB_PCDS_DYNAMIC_EX_DEFAULT = 'DynamicExDefault'
+TAB_PCDS_DYNAMIC_EX_VPD = 'DynamicExVpd'
+TAB_PCDS_DYNAMIC_EX_HII = 'DynamicExHii'
+TAB_PCDS_DYNAMIC = 'Dynamic'
+TAB_PCDS_DYNAMIC_DEFAULT = 'DynamicDefault'
+TAB_PCDS_DYNAMIC_VPD = 'DynamicVpd'
+TAB_PCDS_DYNAMIC_HII = 'DynamicHii'
+
+TAB_PTR_TYPE_PCD = 'VOID*'
+
+PCD_DYNAMIC_TYPE_LIST = [TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, \
+ TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII]
+PCD_DYNAMIC_EX_TYPE_LIST = [TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, \
+ TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII]
+
+## Dynamic-ex PCD types
+#
+gDYNAMIC_EX_PCD = [TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, \
+ TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII]
+
+TAB_PCDS_FIXED_AT_BUILD_NULL = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD
+TAB_PCDS_FIXED_AT_BUILD_COMMON = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + \
+TAB_SPLIT + TAB_ARCH_COMMON
+TAB_PCDS_FIXED_AT_BUILD_IA32 = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + \
+TAB_SPLIT + TAB_ARCH_IA32
+TAB_PCDS_FIXED_AT_BUILD_X64 = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + \
+TAB_SPLIT + TAB_ARCH_X64
+TAB_PCDS_FIXED_AT_BUILD_IPF = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + \
+TAB_SPLIT + TAB_ARCH_IPF
+TAB_PCDS_FIXED_AT_BUILD_ARM = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + \
+TAB_SPLIT + TAB_ARCH_ARM
+TAB_PCDS_FIXED_AT_BUILD_EBC = TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + \
+TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_PCDS_PATCHABLE_IN_MODULE_NULL = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE
+TAB_PCDS_PATCHABLE_IN_MODULE_COMMON = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE \
++ TAB_SPLIT + TAB_ARCH_COMMON
+TAB_PCDS_PATCHABLE_IN_MODULE_IA32 = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + \
+TAB_SPLIT + TAB_ARCH_IA32
+TAB_PCDS_PATCHABLE_IN_MODULE_X64 = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + \
+TAB_SPLIT + TAB_ARCH_X64
+TAB_PCDS_PATCHABLE_IN_MODULE_IPF = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + \
+TAB_SPLIT + TAB_ARCH_IPF
+TAB_PCDS_PATCHABLE_IN_MODULE_ARM = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + \
+TAB_SPLIT + TAB_ARCH_ARM
+TAB_PCDS_PATCHABLE_IN_MODULE_EBC = TAB_PCDS + TAB_PCDS_PATCHABLE_IN_MODULE + \
+TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_PCDS_FEATURE_FLAG_NULL = TAB_PCDS + TAB_PCDS_FEATURE_FLAG
+TAB_PCDS_FEATURE_FLAG_COMMON = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT \
++ TAB_ARCH_COMMON
+TAB_PCDS_FEATURE_FLAG_IA32 = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + \
+TAB_ARCH_IA32
+TAB_PCDS_FEATURE_FLAG_X64 = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + \
+TAB_ARCH_X64
+TAB_PCDS_FEATURE_FLAG_IPF = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + \
+TAB_ARCH_IPF
+TAB_PCDS_FEATURE_FLAG_ARM = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + \
+TAB_ARCH_ARM
+TAB_PCDS_FEATURE_FLAG_EBC = TAB_PCDS + TAB_PCDS_FEATURE_FLAG + TAB_SPLIT + \
+TAB_ARCH_EBC
+
+TAB_PCDS_DYNAMIC_EX_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_EX
+TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_EX_DEFAULT
+TAB_PCDS_DYNAMIC_EX_HII_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_EX_HII
+TAB_PCDS_DYNAMIC_EX_VPD_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_EX_VPD
+TAB_PCDS_DYNAMIC_EX_COMMON = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + \
+TAB_ARCH_COMMON
+TAB_PCDS_DYNAMIC_EX_IA32 = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + \
+TAB_ARCH_IA32
+TAB_PCDS_DYNAMIC_EX_X64 = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + \
+TAB_ARCH_X64
+TAB_PCDS_DYNAMIC_EX_IPF = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + \
+TAB_ARCH_IPF
+TAB_PCDS_DYNAMIC_EX_ARM = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + \
+TAB_ARCH_ARM
+TAB_PCDS_DYNAMIC_EX_EBC = TAB_PCDS + TAB_PCDS_DYNAMIC_EX + TAB_SPLIT + \
+TAB_ARCH_EBC
+
+TAB_PCDS_DYNAMIC_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC
+TAB_PCDS_DYNAMIC_DEFAULT_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_DEFAULT
+TAB_PCDS_DYNAMIC_HII_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_HII
+TAB_PCDS_DYNAMIC_VPD_NULL = TAB_PCDS + TAB_PCDS_DYNAMIC_VPD
+TAB_PCDS_DYNAMIC_COMMON = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + \
+TAB_ARCH_COMMON
+TAB_PCDS_DYNAMIC_IA32 = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_IA32
+TAB_PCDS_DYNAMIC_X64 = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_X64
+TAB_PCDS_DYNAMIC_IPF = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_IPF
+TAB_PCDS_DYNAMIC_ARM = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_ARM
+TAB_PCDS_DYNAMIC_EBC = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_PCD_DYNAMIC_TYPE_LIST = [TAB_PCDS_DYNAMIC_DEFAULT_NULL, \
+ TAB_PCDS_DYNAMIC_VPD_NULL, \
+ TAB_PCDS_DYNAMIC_HII_NULL]
+TAB_PCD_DYNAMIC_EX_TYPE_LIST = [TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL, \
+ TAB_PCDS_DYNAMIC_EX_VPD_NULL, \
+ TAB_PCDS_DYNAMIC_EX_HII_NULL]
+
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE = \
+'PcdLoadFixAddressPeiCodePageNumber'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE_DATA_TYPE = 'UINT32'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE = \
+'PcdLoadFixAddressBootTimeCodePageNumber'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE_DATA_TYPE = 'UINT32'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE = \
+'PcdLoadFixAddressRuntimeCodePageNumber'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE_DATA_TYPE = 'UINT32'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE = \
+'PcdLoadFixAddressSmmCodePageNumber'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE_DATA_TYPE = 'UINT32'
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_LIST = \
+[TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE, \
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE, \
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE, \
+TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE]
+PCD_SECTION_LIST = [TAB_PCDS_FIXED_AT_BUILD_NULL.upper(), \
+ TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper(), \
+ TAB_PCDS_FEATURE_FLAG_NULL.upper(), \
+ TAB_PCDS_DYNAMIC_EX_NULL.upper(), \
+ TAB_PCDS_DYNAMIC_NULL.upper()]
+INF_PCD_SECTION_LIST = ["FixedPcd".upper(), "FeaturePcd".upper(), \
+ "PatchPcd".upper(), "Pcd".upper(), "PcdEx".upper()]
+
+TAB_DEPEX = 'Depex'
+TAB_DEPEX_COMMON = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_DEPEX_IA32 = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_IA32
+TAB_DEPEX_X64 = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_X64
+TAB_DEPEX_IPF = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_IPF
+TAB_DEPEX_ARM = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_ARM
+TAB_DEPEX_EBC = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_SKUIDS = 'SkuIds'
+
+TAB_LIBRARIES = 'Libraries'
+TAB_LIBRARIES_COMMON = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_LIBRARIES_IA32 = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_IA32
+TAB_LIBRARIES_X64 = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_X64
+TAB_LIBRARIES_IPF = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_IPF
+TAB_LIBRARIES_ARM = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_ARM
+TAB_LIBRARIES_EBC = TAB_LIBRARIES + TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_COMPONENTS = 'Components'
+TAB_COMPONENTS_COMMON = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_COMMON
+TAB_COMPONENTS_IA32 = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_IA32
+TAB_COMPONENTS_X64 = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_X64
+TAB_COMPONENTS_IPF = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_IPF
+TAB_COMPONENTS_ARM = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_ARM
+TAB_COMPONENTS_EBC = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_EBC
+
+TAB_BUILD_OPTIONS = 'BuildOptions'
+
+TAB_DEFINE = 'DEFINE'
+TAB_NMAKE = 'Nmake'
+TAB_USER_EXTENSIONS = 'UserExtensions'
+TAB_INCLUDE = '!include'
+TAB_PRIVATE = 'Private'
+TAB_INTEL = 'Intel'
+
+#
+# Common Define
+#
+TAB_COMMON_DEFINES = 'Defines'
+
+#
+# Inf Definitions
+#
+TAB_INF_DEFINES = TAB_COMMON_DEFINES
+TAB_INF_DEFINES_INF_VERSION = 'INF_VERSION'
+TAB_INF_DEFINES_BASE_NAME = 'BASE_NAME'
+TAB_INF_DEFINES_FILE_GUID = 'FILE_GUID'
+TAB_INF_DEFINES_MODULE_TYPE = 'MODULE_TYPE'
+TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION = 'EFI_SPECIFICATION_VERSION'
+TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION = 'UEFI_SPECIFICATION_VERSION'
+TAB_INF_DEFINES_PI_SPECIFICATION_VERSION = 'PI_SPECIFICATION_VERSION'
+TAB_INF_DEFINES_EDK_RELEASE_VERSION = 'EDK_RELEASE_VERSION'
+TAB_INF_DEFINES_MODULE_UNI_FILE = 'MODULE_UNI_FILE'
+TAB_INF_DEFINES_BINARY_MODULE = 'BINARY_MODULE'
+TAB_INF_DEFINES_LIBRARY_CLASS = 'LIBRARY_CLASS'
+TAB_INF_DEFINES_COMPONENT_TYPE = 'COMPONENT_TYPE'
+TAB_INF_DEFINES_MAKEFILE_NAME = 'MAKEFILE_NAME'
+TAB_INF_DEFINES_BUILD_NUMBER = 'BUILD_NUMBER'
+TAB_INF_DEFINES_BUILD_TYPE = 'BUILD_TYPE'
+TAB_INF_DEFINES_FFS_EXT = 'FFS_EXT'
+TAB_INF_DEFINES_FV_EXT = 'FV_EXT'
+TAB_INF_DEFINES_SOURCE_FV = 'SOURCE_FV'
+TAB_INF_DEFINES_PACKAGE = 'PACKAGE'
+TAB_INF_DEFINES_VERSION_NUMBER = 'VERSION_NUMBER'
+TAB_INF_DEFINES_VERSION = 'VERSION'
+TAB_INF_DEFINES_VERSION_STRING = 'VERSION_STRING'
+TAB_INF_DEFINES_PCD_IS_DRIVER = 'PCD_IS_DRIVER'
+TAB_INF_DEFINES_TIANO_EDK1_FLASHMAP_H = 'TIANO_EDK1_FLASHMAP_H'
+TAB_INF_DEFINES_ENTRY_POINT = 'ENTRY_POINT'
+TAB_INF_DEFINES_UNLOAD_IMAGE = 'UNLOAD_IMAGE'
+TAB_INF_DEFINES_CONSTRUCTOR = 'CONSTRUCTOR'
+TAB_INF_DEFINES_DESTRUCTOR = 'DESTRUCTOR'
+TAB_INF_DEFINES_PCI_VENDOR_ID = 'PCI_VENDOR_ID'
+TAB_INF_DEFINES_PCI_DEVICE_ID = 'PCI_DEVICE_ID'
+TAB_INF_DEFINES_PCI_CLASS_CODE = 'PCI_CLASS_CODE'
+TAB_INF_DEFINES_PCI_REVISION = 'PCI_REVISION'
+TAB_INF_DEFINES_PCI_COMPRESS = 'PCI_COMPRESS'
+TAB_INF_DEFINES_DEFINE = 'DEFINE'
+TAB_INF_DEFINES_SPEC = 'SPEC'
+TAB_INF_DEFINES_UEFI_HII_RESOURCE_SECTION = 'UEFI_HII_RESOURCE_SECTION'
+TAB_INF_DEFINES_CUSTOM_MAKEFILE = 'CUSTOM_MAKEFILE'
+TAB_INF_DEFINES_MACRO = '__MACROS__'
+TAB_INF_DEFINES_SHADOW = 'SHADOW'
+TAB_INF_DEFINES_DPX_SOURCE = 'DPX_SOURCE'
+TAB_INF_FIXED_PCD = 'FixedPcd'
+TAB_INF_FEATURE_PCD = 'FeaturePcd'
+TAB_INF_PATCH_PCD = 'PatchPcd'
+TAB_INF_PCD = 'Pcd'
+TAB_INF_PCD_EX = 'PcdEx'
+TAB_INF_GUIDTYPE_VAR = 'Variable'
+TAB_INF_ABSTRACT = 'STR_MODULE_ABSTRACT'
+TAB_INF_DESCRIPTION = 'STR_MODULE_DESCRIPTION'
+TAB_INF_LICENSE = 'STR_MODULE_LICENSE'
+TAB_INF_BINARY_ABSTRACT = 'STR_MODULE_BINARY_ABSTRACT'
+TAB_INF_BINARY_DESCRIPTION = 'STR_MODULE_BINARY_DESCRIPTION'
+TAB_INF_BINARY_LICENSE = 'STR_MODULE_BINARY_LICENSE'
+#
+# Dec Definitions
+#
+TAB_DEC_DEFINES = TAB_COMMON_DEFINES
+TAB_DEC_DEFINES_DEC_SPECIFICATION = 'DEC_SPECIFICATION'
+TAB_DEC_DEFINES_PACKAGE_NAME = 'PACKAGE_NAME'
+TAB_DEC_DEFINES_PACKAGE_GUID = 'PACKAGE_GUID'
+TAB_DEC_DEFINES_PACKAGE_VERSION = 'PACKAGE_VERSION'
+TAB_DEC_DEFINES_PKG_UNI_FILE = 'PACKAGE_UNI_FILE'
+TAB_DEC_PACKAGE_ABSTRACT = 'STR_PACKAGE_ABSTRACT'
+TAB_DEC_PACKAGE_DESCRIPTION = 'STR_PACKAGE_DESCRIPTION'
+TAB_DEC_PACKAGE_LICENSE = 'STR_PACKAGE_LICENSE'
+TAB_DEC_BINARY_ABSTRACT = 'STR_PACKAGE_BINARY_ABSTRACT'
+TAB_DEC_BINARY_DESCRIPTION = 'STR_PACKAGE_BINARY_DESCRIPTION'
+TAB_DEC_BINARY_LICENSE = 'STR_PACKAGE_ASBUILT_LICENSE'
+#
+# Dsc Definitions
+#
+TAB_DSC_DEFINES = TAB_COMMON_DEFINES
+TAB_DSC_DEFINES_PLATFORM_NAME = 'PLATFORM_NAME'
+TAB_DSC_DEFINES_PLATFORM_GUID = 'PLATFORM_GUID'
+TAB_DSC_DEFINES_PLATFORM_VERSION = 'PLATFORM_VERSION'
+TAB_DSC_DEFINES_DSC_SPECIFICATION = 'DSC_SPECIFICATION'
+TAB_DSC_DEFINES_OUTPUT_DIRECTORY = 'OUTPUT_DIRECTORY'
+TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES = 'SUPPORTED_ARCHITECTURES'
+TAB_DSC_DEFINES_BUILD_TARGETS = 'BUILD_TARGETS'
+TAB_DSC_DEFINES_SKUID_IDENTIFIER = 'SKUID_IDENTIFIER'
+TAB_DSC_DEFINES_FLASH_DEFINITION = 'FLASH_DEFINITION'
+TAB_DSC_DEFINES_BUILD_NUMBER = 'BUILD_NUMBER'
+TAB_DSC_DEFINES_MAKEFILE_NAME = 'MAKEFILE_NAME'
+TAB_DSC_DEFINES_BS_BASE_ADDRESS = 'BsBaseAddress'
+TAB_DSC_DEFINES_RT_BASE_ADDRESS = 'RtBaseAddress'
+TAB_DSC_DEFINES_DEFINE = 'DEFINE'
+TAB_FIX_LOAD_TOP_MEMORY_ADDRESS = 'FIX_LOAD_TOP_MEMORY_ADDRESS'
+
+#
+# TargetTxt Definitions
+#
+TAB_TAT_DEFINES_ACTIVE_PLATFORM = 'ACTIVE_PLATFORM'
+TAB_TAT_DEFINES_ACTIVE_MODULE = 'ACTIVE_MODULE'
+TAB_TAT_DEFINES_TOOL_CHAIN_CONF = 'TOOL_CHAIN_CONF'
+TAB_TAT_DEFINES_MULTIPLE_THREAD = 'MULTIPLE_THREAD'
+TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER = 'MAX_CONCURRENT_THREAD_NUMBER'
+TAB_TAT_DEFINES_TARGET = 'TARGET'
+TAB_TAT_DEFINES_TOOL_CHAIN_TAG = 'TOOL_CHAIN_TAG'
+TAB_TAT_DEFINES_TARGET_ARCH = 'TARGET_ARCH'
+TAB_TAT_DEFINES_BUILD_RULE_CONF = "BUILD_RULE_CONF"
+
+#
+# ToolDef Definitions
+#
+TAB_TOD_DEFINES_TARGET = 'TARGET'
+TAB_TOD_DEFINES_TOOL_CHAIN_TAG = 'TOOL_CHAIN_TAG'
+TAB_TOD_DEFINES_TARGET_ARCH = 'TARGET_ARCH'
+TAB_TOD_DEFINES_COMMAND_TYPE = 'COMMAND_TYPE'
+TAB_TOD_DEFINES_FAMILY = 'FAMILY'
+TAB_TOD_DEFINES_BUILDRULEFAMILY = 'BUILDRULEFAMILY'
+
+#
+# Conditional Statements
+#
+TAB_IF = '!if'
+TAB_END_IF = '!endif'
+TAB_ELSE_IF = '!elseif'
+TAB_ELSE = '!else'
+TAB_IF_DEF = '!ifdef'
+TAB_IF_N_DEF = '!ifndef'
+TAB_IF_EXIST = '!if exist'
+
+#
+# Unknown section
+#
+TAB_UNKNOWN = 'UNKNOWN'
+
+#
+# Header section (virtual section for abstract, description, copyright,
+# license)
+#
+TAB_HEADER = 'Header'
+TAB_HEADER_ABSTRACT = 'Abstract'
+TAB_HEADER_DESCRIPTION = 'Description'
+TAB_HEADER_COPYRIGHT = 'Copyright'
+TAB_HEADER_LICENSE = 'License'
+TAB_BINARY_HEADER_IDENTIFIER = 'BinaryHeader'
+TAB_BINARY_HEADER_USERID = 'TianoCore'
+
+#
+# Build database path
+#
+DATABASE_PATH = ":memory:"
+#
+# used by ECC
+#
+MODIFIER_LIST = ['IN', 'OUT', 'OPTIONAL', 'UNALIGNED', 'EFI_RUNTIMESERVICE', \
+ 'EFI_BOOTSERVICE', 'EFIAPI']
+#
+# Dependency Expression
+#
+DEPEX_SUPPORTED_OPCODE = ["BEFORE", "AFTER", "PUSH", "AND", "OR", "NOT", \
+ "END", "SOR", "TRUE", "FALSE", '(', ')']
+
+TAB_STATIC_LIBRARY = "STATIC-LIBRARY-FILE"
+TAB_DYNAMIC_LIBRARY = "DYNAMIC-LIBRARY-FILE"
+TAB_FRAMEWORK_IMAGE = "EFI-IMAGE-FILE"
+TAB_C_CODE_FILE = "C-CODE-FILE"
+TAB_C_HEADER_FILE = "C-HEADER-FILE"
+TAB_UNICODE_FILE = "UNICODE-TEXT-FILE"
+TAB_DEPENDENCY_EXPRESSION_FILE = "DEPENDENCY-EXPRESSION-FILE"
+TAB_UNKNOWN_FILE = "UNKNOWN-TYPE-FILE"
+TAB_DEFAULT_BINARY_FILE = "_BINARY_FILE_"
+#
+# used to indicate the state of processing header comment section of dec,
+# inf files
+#
+HEADER_COMMENT_NOT_STARTED = -1
+HEADER_COMMENT_STARTED = 0
+HEADER_COMMENT_FILE = 1
+HEADER_COMMENT_ABSTRACT = 2
+HEADER_COMMENT_DESCRIPTION = 3
+HEADER_COMMENT_COPYRIGHT = 4
+HEADER_COMMENT_LICENSE = 5
+HEADER_COMMENT_END = 6
+
+#
+# Static values for data models
+#
+MODEL_UNKNOWN = 0
+
+MODEL_FILE_C = 1001
+MODEL_FILE_H = 1002
+MODEL_FILE_ASM = 1003
+MODEL_FILE_INF = 1011
+MODEL_FILE_DEC = 1012
+MODEL_FILE_DSC = 1013
+MODEL_FILE_FDF = 1014
+MODEL_FILE_INC = 1015
+MODEL_FILE_CIF = 1016
+
+MODEL_IDENTIFIER_FILE_HEADER = 2001
+MODEL_IDENTIFIER_FUNCTION_HEADER = 2002
+MODEL_IDENTIFIER_COMMENT = 2003
+MODEL_IDENTIFIER_PARAMETER = 2004
+MODEL_IDENTIFIER_STRUCTURE = 2005
+MODEL_IDENTIFIER_VARIABLE = 2006
+MODEL_IDENTIFIER_INCLUDE = 2007
+MODEL_IDENTIFIER_PREDICATE_EXPRESSION = 2008
+MODEL_IDENTIFIER_ENUMERATE = 2009
+MODEL_IDENTIFIER_PCD = 2010
+MODEL_IDENTIFIER_UNION = 2011
+MODEL_IDENTIFIER_MACRO_IFDEF = 2012
+MODEL_IDENTIFIER_MACRO_IFNDEF = 2013
+MODEL_IDENTIFIER_MACRO_DEFINE = 2014
+MODEL_IDENTIFIER_MACRO_ENDIF = 2015
+MODEL_IDENTIFIER_MACRO_PROGMA = 2016
+MODEL_IDENTIFIER_FUNCTION_CALLING = 2018
+MODEL_IDENTIFIER_TYPEDEF = 2017
+MODEL_IDENTIFIER_FUNCTION_DECLARATION = 2019
+MODEL_IDENTIFIER_ASSIGNMENT_EXPRESSION = 2020
+
+MODEL_EFI_PROTOCOL = 3001
+MODEL_EFI_PPI = 3002
+MODEL_EFI_GUID = 3003
+MODEL_EFI_LIBRARY_CLASS = 3004
+MODEL_EFI_LIBRARY_INSTANCE = 3005
+MODEL_EFI_PCD = 3006
+MODEL_EFI_SOURCE_FILE = 3007
+MODEL_EFI_BINARY_FILE = 3008
+MODEL_EFI_SKU_ID = 3009
+MODEL_EFI_INCLUDE = 3010
+MODEL_EFI_DEPEX = 3011
+
+MODEL_PCD = 4000
+MODEL_PCD_FIXED_AT_BUILD = 4001
+MODEL_PCD_PATCHABLE_IN_MODULE = 4002
+MODEL_PCD_FEATURE_FLAG = 4003
+MODEL_PCD_DYNAMIC_EX = 4004
+MODEL_PCD_DYNAMIC_EX_DEFAULT = 4005
+MODEL_PCD_DYNAMIC_EX_VPD = 4006
+MODEL_PCD_DYNAMIC_EX_HII = 4007
+MODEL_PCD_DYNAMIC = 4008
+MODEL_PCD_DYNAMIC_DEFAULT = 4009
+MODEL_PCD_DYNAMIC_VPD = 4010
+MODEL_PCD_DYNAMIC_HII = 4011
+
+MODEL_META_DATA_FILE_HEADER = 5000
+MODEL_META_DATA_HEADER = 5001
+MODEL_META_DATA_INCLUDE = 5002
+MODEL_META_DATA_DEFINE = 5003
+MODEL_META_DATA_CONDITIONAL_STATEMENT_IF = 5004
+MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE = 5005
+MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF = 5006
+MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF = 5007
+MODEL_META_DATA_BUILD_OPTION = 5008
+MODEL_META_DATA_COMPONENT = 5009
+MODEL_META_DATA_USER_EXTENSION = 5010
+MODEL_META_DATA_PACKAGE = 5011
+MODEL_META_DATA_NMAKE = 5012
+MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF = 50013
+MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF = 5014
+
+TOOL_FAMILY_LIST = ["MSFT",
+ "INTEL",
+ "GCC",
+ "RVCT"
+ ]
+
+TYPE_HOB_SECTION = 'HOB'
+TYPE_EVENT_SECTION = 'EVENT'
+TYPE_BOOTMODE_SECTION = 'BOOTMODE'
+
+PCD_ERR_CODE_MAX_SIZE = 4294967295
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Library/ExpressionValidate.py b/roms/edk2/BaseTools/Source/Python/UPT/Library/ExpressionValidate.py
new file mode 100644
index 000000000..7718ca12e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Library/ExpressionValidate.py
@@ -0,0 +1,567 @@
+## @file
+# This file is used to check PCD logical expression
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+ExpressionValidate
+'''
+from __future__ import print_function
+
+##
+# Import Modules
+#
+import re
+from Logger import StringTable as ST
+
+## IsValidBareCString
+#
+# Check if String is comprised by whitespace(0x20), !(0x21), 0x23 - 0x7E
+# or '\n', '\t', '\f', '\r', '\b', '\0', '\\'
+#
+# @param String: string to be checked
+#
+def IsValidBareCString(String):
+ EscapeList = ['n', 't', 'f', 'r', 'b', '0', '\\', '"']
+ PreChar = ''
+ LastChar = ''
+ for Char in String:
+ LastChar = Char
+ if PreChar == '\\':
+ if Char not in EscapeList:
+ return False
+ if Char == '\\':
+ PreChar = ''
+ continue
+ else:
+ IntChar = ord(Char)
+ if IntChar != 0x20 and IntChar != 0x09 and IntChar != 0x21 \
+ and (IntChar < 0x23 or IntChar > 0x7e):
+ return False
+ PreChar = Char
+
+ # Last char cannot be \ if PreChar is not \
+ if LastChar == '\\' and PreChar == LastChar:
+ return False
+ return True
+
+def _ValidateToken(Token):
+ Token = Token.strip()
+ Index = Token.find("\"")
+ if Index != -1:
+ return IsValidBareCString(Token[Index+1:-1])
+ return True
+
+## _ExprError
+#
+# @param Exception: Exception
+#
+class _ExprError(Exception):
+ def __init__(self, Error = ''):
+ Exception.__init__(self)
+ self.Error = Error
+
+## _ExprBase
+#
+class _ExprBase:
+ HEX_PATTERN = '[\t\s]*0[xX][a-fA-F0-9]+'
+ INT_PATTERN = '[\t\s]*[0-9]+'
+ MACRO_PATTERN = '[\t\s]*\$\(([A-Z][_A-Z0-9]*)\)'
+ PCD_PATTERN = \
+ '[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*\.[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*'
+ QUOTED_PATTERN = '[\t\s]*L?"[^"]*"'
+ BOOL_PATTERN = '[\t\s]*(true|True|TRUE|false|False|FALSE)'
+ def __init__(self, Token):
+ self.Token = Token
+ self.Index = 0
+ self.Len = len(Token)
+
+ ## SkipWhitespace
+ #
+ def SkipWhitespace(self):
+ for Char in self.Token[self.Index:]:
+ if Char not in ' \t':
+ break
+ self.Index += 1
+
+ ## IsCurrentOp
+ #
+ # @param OpList: option list
+ #
+ def IsCurrentOp(self, OpList):
+ self.SkipWhitespace()
+ LetterOp = ["EQ", "NE", "GE", "LE", "GT", "LT", "NOT", "and", "AND",
+ "or", "OR", "XOR"]
+ OpMap = {
+ '|' : '|',
+ '&' : '&',
+ '!' : '=',
+ '>' : '=',
+ '<' : '='
+ }
+
+ for Operator in OpList:
+ if not self.Token[self.Index:].startswith(Operator):
+ continue
+
+ self.Index += len(Operator)
+ Char = self.Token[self.Index : self.Index + 1]
+
+ if (Operator in LetterOp and (Char == '_' or Char.isalnum())) \
+ or (Operator in OpMap and OpMap[Operator] == Char):
+ self.Index -= len(Operator)
+ break
+
+ return True
+
+ return False
+
+## _LogicalExpressionParser
+#
+# @param _ExprBase: _ExprBase object
+#
+class _LogicalExpressionParser(_ExprBase):
+ #
+ # STRINGITEM can only be logical field according to spec
+ #
+ STRINGITEM = -1
+
+ #
+ # Evaluate to True or False
+ #
+ LOGICAL = 0
+ REALLOGICAL = 2
+
+ #
+ # Just arithmetic expression
+ #
+ ARITH = 1
+
+ def __init__(self, Token):
+ _ExprBase.__init__(self, Token)
+ self.Parens = 0
+
+ def _CheckToken(self, MatchList):
+ for Match in MatchList:
+ if Match and Match.start() == 0:
+ if not _ValidateToken(
+ self.Token[self.Index:self.Index+Match.end()]
+ ):
+ return False
+
+ self.Index += Match.end()
+ if self.Token[self.Index - 1] == '"':
+ return True
+ if self.Token[self.Index:self.Index+1] == '_' or \
+ self.Token[self.Index:self.Index+1].isalnum():
+ self.Index -= Match.end()
+ return False
+
+ Token = self.Token[self.Index - Match.end():self.Index]
+ if Token.strip() in ["EQ", "NE", "GE", "LE", "GT", "LT",
+ "NOT", "and", "AND", "or", "OR", "XOR"]:
+ self.Index -= Match.end()
+ return False
+
+ return True
+
+ return False
+
+ def IsAtomicNumVal(self):
+ #
+ # Hex number
+ #
+ Match1 = re.compile(self.HEX_PATTERN).match(self.Token[self.Index:])
+
+ #
+ # Number
+ #
+ Match2 = re.compile(self.INT_PATTERN).match(self.Token[self.Index:])
+
+ #
+ # Macro
+ #
+ Match3 = re.compile(self.MACRO_PATTERN).match(self.Token[self.Index:])
+
+ #
+ # PcdName
+ #
+ Match4 = re.compile(self.PCD_PATTERN).match(self.Token[self.Index:])
+
+ return self._CheckToken([Match1, Match2, Match3, Match4])
+
+
+ def IsAtomicItem(self):
+ #
+ # Macro
+ #
+ Match1 = re.compile(self.MACRO_PATTERN).match(self.Token[self.Index:])
+
+ #
+ # PcdName
+ #
+ Match2 = re.compile(self.PCD_PATTERN).match(self.Token[self.Index:])
+
+ #
+ # Quoted string
+ #
+ Match3 = re.compile(self.QUOTED_PATTERN).\
+ match(self.Token[self.Index:].replace('\\\\', '//').\
+ replace('\\\"', '\\\''))
+
+ return self._CheckToken([Match1, Match2, Match3])
+
+ ## A || B
+ #
+ def LogicalExpression(self):
+ Ret = self.SpecNot()
+ while self.IsCurrentOp(['||', 'OR', 'or', '&&', 'AND', 'and', 'XOR', 'xor', '^']):
+ if self.Token[self.Index-1] == '|' and self.Parens <= 0:
+ raise _ExprError(ST.ERR_EXPR_OR % self.Token)
+ if Ret not in [self.ARITH, self.LOGICAL, self.REALLOGICAL, self.STRINGITEM]:
+ raise _ExprError(ST.ERR_EXPR_LOGICAL % self.Token)
+ Ret = self.SpecNot()
+ if Ret not in [self.ARITH, self.LOGICAL, self.REALLOGICAL, self.STRINGITEM]:
+ raise _ExprError(ST.ERR_EXPR_LOGICAL % self.Token)
+ Ret = self.REALLOGICAL
+ return Ret
+
+ def SpecNot(self):
+ if self.IsCurrentOp(["NOT", "!", "not"]):
+ return self.SpecNot()
+ return self.Rel()
+
+ ## A < B, A > B, A <= B, A >= B
+ #
+ def Rel(self):
+ Ret = self.Expr()
+ if self.IsCurrentOp(["<=", ">=", ">", "<", "GT", "LT", "GE", "LE",
+ "==", "EQ", "!=", "NE"]):
+ if Ret == self.STRINGITEM:
+ raise _ExprError(ST.ERR_EXPR_LOGICAL % self.Token)
+ Ret = self.Expr()
+ if Ret == self.REALLOGICAL:
+ raise _ExprError(ST.ERR_EXPR_LOGICAL % self.Token)
+ Ret = self.REALLOGICAL
+ return Ret
+
+ ## A + B, A - B
+ #
+ def Expr(self):
+ Ret = self.Factor()
+ while self.IsCurrentOp(["+", "-", "&", "|", "^", "XOR", "xor"]):
+ if self.Token[self.Index-1] == '|' and self.Parens <= 0:
+ raise _ExprError(ST.ERR_EXPR_OR)
+ if Ret == self.STRINGITEM or Ret == self.REALLOGICAL:
+ raise _ExprError(ST.ERR_EXPR_LOGICAL % self.Token)
+ Ret = self.Factor()
+ if Ret == self.STRINGITEM or Ret == self.REALLOGICAL:
+ raise _ExprError(ST.ERR_EXPR_LOGICAL % self.Token)
+ Ret = self.ARITH
+ return Ret
+
+ ## Factor
+ #
+ def Factor(self):
+ if self.IsCurrentOp(["("]):
+ self.Parens += 1
+ Ret = self.LogicalExpression()
+ if not self.IsCurrentOp([")"]):
+ raise _ExprError(ST.ERR_EXPR_RIGHT_PAREN % \
+ (self.Token, self.Token[self.Index:]))
+ self.Parens -= 1
+ return Ret
+
+ if self.IsAtomicItem():
+ if self.Token[self.Index - 1] == '"':
+ return self.STRINGITEM
+ return self.LOGICAL
+ elif self.IsAtomicNumVal():
+ return self.ARITH
+ else:
+ raise _ExprError(ST.ERR_EXPR_FACTOR % \
+ (self.Token[self.Index:], self.Token))
+
+ ## IsValidLogicalExpression
+ #
+ def IsValidLogicalExpression(self):
+ if self.Len == 0:
+ return False, ST.ERR_EXPRESS_EMPTY
+ try:
+ if self.LogicalExpression() not in [self.ARITH, self.LOGICAL, self.REALLOGICAL, self.STRINGITEM]:
+ return False, ST.ERR_EXPR_LOGICAL % self.Token
+ except _ExprError as XExcept:
+ return False, XExcept.Error
+ self.SkipWhitespace()
+ if self.Index != self.Len:
+ return False, (ST.ERR_EXPR_BOOLEAN % \
+ (self.Token[self.Index:], self.Token))
+ return True, ''
+
+## _ValidRangeExpressionParser
+#
+class _ValidRangeExpressionParser(_ExprBase):
+ INT_RANGE_PATTERN = '[\t\s]*[0-9]+[\t\s]*-[\t\s]*[0-9]+'
+ HEX_RANGE_PATTERN = \
+ '[\t\s]*0[xX][a-fA-F0-9]+[\t\s]*-[\t\s]*0[xX][a-fA-F0-9]+'
+ def __init__(self, Token):
+ _ExprBase.__init__(self, Token)
+ self.Parens = 0
+ self.HEX = 1
+ self.INT = 2
+ self.IsParenHappen = False
+ self.IsLogicalOpHappen = False
+
+ ## IsValidRangeExpression
+ #
+ def IsValidRangeExpression(self):
+ if self.Len == 0:
+ return False, ST.ERR_EXPR_RANGE_EMPTY
+ try:
+ if self.RangeExpression() not in [self.HEX, self.INT]:
+ return False, ST.ERR_EXPR_RANGE % self.Token
+ except _ExprError as XExcept:
+ return False, XExcept.Error
+
+ self.SkipWhitespace()
+ if self.Index != self.Len:
+ return False, (ST.ERR_EXPR_RANGE % self.Token)
+ return True, ''
+
+ ## RangeExpression
+ #
+ def RangeExpression(self):
+ Ret = self.Unary()
+ while self.IsCurrentOp(['OR', 'AND', 'and', 'or']):
+ self.IsLogicalOpHappen = True
+ if not self.IsParenHappen:
+ raise _ExprError(ST.ERR_PAREN_NOT_USED % self.Token)
+ self.IsParenHappen = False
+ Ret = self.Unary()
+
+ if self.IsCurrentOp(['XOR']):
+ Ret = self.Unary()
+
+ return Ret
+
+ ## Unary
+ #
+ def Unary(self):
+ if self.IsCurrentOp(["NOT"]):
+ return self.Unary()
+
+ return self.ValidRange()
+
+ ## ValidRange
+ #
+ def ValidRange(self):
+ Ret = -1
+ if self.IsCurrentOp(["("]):
+ self.IsLogicalOpHappen = False
+ self.IsParenHappen = True
+ self.Parens += 1
+ if self.Parens > 1:
+ raise _ExprError(ST.ERR_EXPR_RANGE_DOUBLE_PAREN_NESTED % self.Token)
+ Ret = self.RangeExpression()
+ if not self.IsCurrentOp([")"]):
+ raise _ExprError(ST.ERR_EXPR_RIGHT_PAREN % self.Token)
+ self.Parens -= 1
+ return Ret
+
+ if self.IsLogicalOpHappen:
+ raise _ExprError(ST.ERR_PAREN_NOT_USED % self.Token)
+
+ if self.IsCurrentOp(["LT", "GT", "LE", "GE", "EQ", "XOR"]):
+ IntMatch = \
+ re.compile(self.INT_PATTERN).match(self.Token[self.Index:])
+ HexMatch = \
+ re.compile(self.HEX_PATTERN).match(self.Token[self.Index:])
+ if HexMatch and HexMatch.start() == 0:
+ self.Index += HexMatch.end()
+ Ret = self.HEX
+ elif IntMatch and IntMatch.start() == 0:
+ self.Index += IntMatch.end()
+ Ret = self.INT
+ else:
+ raise _ExprError(ST.ERR_EXPR_RANGE_FACTOR % (self.Token[self.Index:], self.Token))
+ else:
+ IntRangeMatch = re.compile(
+ self.INT_RANGE_PATTERN).match(self.Token[self.Index:]
+ )
+ HexRangeMatch = re.compile(
+ self.HEX_RANGE_PATTERN).match(self.Token[self.Index:]
+ )
+ if HexRangeMatch and HexRangeMatch.start() == 0:
+ self.Index += HexRangeMatch.end()
+ Ret = self.HEX
+ elif IntRangeMatch and IntRangeMatch.start() == 0:
+ self.Index += IntRangeMatch.end()
+ Ret = self.INT
+ else:
+ raise _ExprError(ST.ERR_EXPR_RANGE % self.Token)
+
+ return Ret
+
+## _ValidListExpressionParser
+#
+class _ValidListExpressionParser(_ExprBase):
+ VALID_LIST_PATTERN = '(0[xX][0-9a-fA-F]+|[0-9]+)([\t\s]*,[\t\s]*(0[xX][0-9a-fA-F]+|[0-9]+))*'
+ def __init__(self, Token):
+ _ExprBase.__init__(self, Token)
+ self.NUM = 1
+
+ def IsValidListExpression(self):
+ if self.Len == 0:
+ return False, ST.ERR_EXPR_LIST_EMPTY
+ try:
+ if self.ListExpression() not in [self.NUM]:
+ return False, ST.ERR_EXPR_LIST % self.Token
+ except _ExprError as XExcept:
+ return False, XExcept.Error
+
+ self.SkipWhitespace()
+ if self.Index != self.Len:
+ return False, (ST.ERR_EXPR_LIST % self.Token)
+
+ return True, ''
+
+ def ListExpression(self):
+ Ret = -1
+ self.SkipWhitespace()
+ ListMatch = re.compile(self.VALID_LIST_PATTERN).match(self.Token[self.Index:])
+ if ListMatch and ListMatch.start() == 0:
+ self.Index += ListMatch.end()
+ Ret = self.NUM
+ else:
+ raise _ExprError(ST.ERR_EXPR_LIST % self.Token)
+
+ return Ret
+
+## _StringTestParser
+#
+class _StringTestParser(_ExprBase):
+ def __init__(self, Token):
+ _ExprBase.__init__(self, Token)
+
+ ## IsValidStringTest
+ #
+ def IsValidStringTest(self):
+ if self.Len == 0:
+ return False, ST.ERR_EXPR_EMPTY
+ try:
+ self.StringTest()
+ except _ExprError as XExcept:
+ return False, XExcept.Error
+ return True, ''
+
+ ## StringItem
+ #
+ def StringItem(self):
+ Match1 = re.compile(self.QUOTED_PATTERN)\
+ .match(self.Token[self.Index:].replace('\\\\', '//')\
+ .replace('\\\"', '\\\''))
+ Match2 = re.compile(self.MACRO_PATTERN).match(self.Token[self.Index:])
+ Match3 = re.compile(self.PCD_PATTERN).match(self.Token[self.Index:])
+ MatchList = [Match1, Match2, Match3]
+ for Match in MatchList:
+ if Match and Match.start() == 0:
+ if not _ValidateToken(
+ self.Token[self.Index:self.Index+Match.end()]
+ ):
+ raise _ExprError(ST.ERR_EXPR_STRING_ITEM % \
+ (self.Token, self.Token[self.Index:]))
+ self.Index += Match.end()
+ Token = self.Token[self.Index - Match.end():self.Index]
+ if Token.strip() in ["EQ", "NE"]:
+ raise _ExprError(ST.ERR_EXPR_STRING_ITEM % \
+ (self.Token, self.Token[self.Index:]))
+ return
+ else:
+ raise _ExprError(ST.ERR_EXPR_STRING_ITEM % \
+ (self.Token, self.Token[self.Index:]))
+
+ ## StringTest
+ #
+ def StringTest(self):
+ self.StringItem()
+ if not self.IsCurrentOp(["==", "EQ", "!=", "NE"]):
+ raise _ExprError(ST.ERR_EXPR_EQUALITY % \
+ (self.Token[self.Index:], self.Token))
+ self.StringItem()
+ if self.Index != self.Len:
+ raise _ExprError(ST.ERR_EXPR_BOOLEAN % \
+ (self.Token[self.Index:], self.Token))
+
+##
+# Check syntax of string test
+#
+# @param Token: string test token
+#
+def IsValidStringTest(Token, Flag=False):
+ #
+ # Not do the check right now, keep the implementation for future enhancement.
+ #
+ if not Flag:
+ return True, ""
+ return _StringTestParser(Token).IsValidStringTest()
+
+
+##
+# Check syntax of logical expression
+#
+# @param Token: expression token
+#
+def IsValidLogicalExpr(Token, Flag=False):
+ #
+ # Not do the check right now, keep the implementation for future enhancement.
+ #
+ if not Flag:
+ return True, ""
+ return _LogicalExpressionParser(Token).IsValidLogicalExpression()
+
+##
+# Check syntax of range expression
+#
+# @param Token: range expression token
+#
+def IsValidRangeExpr(Token):
+ return _ValidRangeExpressionParser(Token).IsValidRangeExpression()
+
+##
+# Check syntax of value list expression token
+#
+# @param Token: value list expression token
+#
+def IsValidListExpr(Token):
+ return _ValidListExpressionParser(Token).IsValidListExpression()
+
+##
+# Check whether the feature flag expression is valid or not
+#
+# @param Token: feature flag expression
+#
+def IsValidFeatureFlagExp(Token, Flag=False):
+ #
+ # Not do the check right now, keep the implementation for future enhancement.
+ #
+ if not Flag:
+ return True, "", Token
+ else:
+ if Token in ['TRUE', 'FALSE', 'true', 'false', 'True', 'False',
+ '0x1', '0x01', '0x0', '0x00']:
+ return True, ""
+ Valid, Cause = IsValidStringTest(Token, Flag)
+ if not Valid:
+ Valid, Cause = IsValidLogicalExpr(Token, Flag)
+ if not Valid:
+ return False, Cause
+ return True, ""
+
+if __name__ == '__main__':
+# print IsValidRangeExpr('LT 9')
+ print(_LogicalExpressionParser('gCrownBayTokenSpaceGuid.PcdPciDevice1BridgeAddressLE0').IsValidLogicalExpression())
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Library/GlobalData.py b/roms/edk2/BaseTools/Source/Python/UPT/Library/GlobalData.py
new file mode 100644
index 000000000..8e88fb1e3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Library/GlobalData.py
@@ -0,0 +1,110 @@
+## @file
+# This file is used to define common static strings and global data used by UPT
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+GlobalData
+'''
+
+#
+# The workspace directory
+#
+gWORKSPACE = '.'
+gPACKAGE_PATH = None
+
+#
+# INF module directory
+#
+gINF_MODULE_DIR = "."
+gINF_MODULE_NAME = ''
+
+#
+# the directory to holds upt related files
+#
+gUPT_DIR = r"Conf/upt/"
+
+#
+# Log file for invalid meta-data files during force removing
+#
+gINVALID_MODULE_FILE = gUPT_DIR + r"Invalid_Modules.log"
+
+#
+# File name for content zip file in the distribution
+#
+gCONTENT_FILE = "dist.content"
+
+#
+# File name for XML file in the distribution
+#
+gDESC_FILE = 'dist.pkg'
+
+#
+# Case Insensitive flag
+#
+gCASE_INSENSITIVE = ''
+
+#
+# All Files dictionary
+#
+gALL_FILES = {}
+
+#
+# Database instance
+#
+gDB = None
+
+#
+# list for files that are found in module level but not in INF files,
+# items are (File, ModulePath), all these should be relative to $(WORKSPACE)
+#
+gMISS_FILE_IN_MODLIST = []
+
+#
+# Global Current Line
+#
+gINF_CURRENT_LINE = None
+
+#
+# Global pkg list
+#
+gWSPKG_LIST = []
+
+#
+# Flag used to take WARN as ERROR.
+# By default, only ERROR message will break the tools execution.
+#
+gWARNING_AS_ERROR = False
+
+#
+# Used to specify the temp directory to hold the unpacked distribution files
+#
+gUNPACK_DIR = []
+
+#
+# Flag used to mark whether the INF file is Binary INF or not.
+#
+gIS_BINARY_INF = False
+
+#
+# Used by FileHook module.
+#
+gRECOVERMGR = None
+
+#
+# Used by PCD parser
+#
+gPackageDict = {}
+
+#
+# Used by Library instance parser
+# {FilePath: FileObj}
+#
+gLIBINSTANCEDICT = {}
+
+#
+# Store the list of DIST
+#
+gTO_BE_INSTALLED_DIST_LIST = []
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Library/Misc.py b/roms/edk2/BaseTools/Source/Python/UPT/Library/Misc.py
new file mode 100644
index 000000000..77ba3584e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Library/Misc.py
@@ -0,0 +1,989 @@
+## @file
+# Common routines used by all tools
+#
+# Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Misc
+'''
+
+##
+# Import Modules
+#
+import os.path
+from os import access
+from os import F_OK
+from os import makedirs
+from os import getcwd
+from os import chdir
+from os import listdir
+from os import remove
+from os import rmdir
+from os import linesep
+from os import walk
+from os import environ
+import re
+from collections import OrderedDict as Sdict
+
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger import ToolError
+from Library import GlobalData
+from Library.DataType import SUP_MODULE_LIST
+from Library.DataType import END_OF_LINE
+from Library.DataType import TAB_SPLIT
+from Library.DataType import TAB_LANGUAGE_EN_US
+from Library.DataType import TAB_LANGUAGE_EN
+from Library.DataType import TAB_LANGUAGE_EN_X
+from Library.DataType import TAB_UNI_FILE_SUFFIXS
+from Library.StringUtils import GetSplitValueList
+from Library.ParserValidate import IsValidHexVersion
+from Library.ParserValidate import IsValidPath
+from Object.POM.CommonObject import TextObject
+from Core.FileHook import __FileHookOpen__
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+
+## Convert GUID string in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx style to C
+# structure style
+#
+# @param Guid: The GUID string
+#
+def GuidStringToGuidStructureString(Guid):
+ GuidList = Guid.split('-')
+ Result = '{'
+ for Index in range(0, 3, 1):
+ Result = Result + '0x' + GuidList[Index] + ', '
+ Result = Result + '{0x' + GuidList[3][0:2] + ', 0x' + GuidList[3][2:4]
+ for Index in range(0, 12, 2):
+ Result = Result + ', 0x' + GuidList[4][Index:Index + 2]
+ Result += '}}'
+ return Result
+
+## Check whether GUID string is of format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+#
+# @param GuidValue: The GUID value
+#
+def CheckGuidRegFormat(GuidValue):
+ ## Regular expression used to find out register format of GUID
+ #
+ RegFormatGuidPattern = re.compile("^\s*([0-9a-fA-F]){8}-"
+ "([0-9a-fA-F]){4}-"
+ "([0-9a-fA-F]){4}-"
+ "([0-9a-fA-F]){4}-"
+ "([0-9a-fA-F]){12}\s*$")
+
+ if RegFormatGuidPattern.match(GuidValue):
+ return True
+ else:
+ return False
+
+
+## Convert GUID string in C structure style to
+# xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+#
+# @param GuidValue: The GUID value in C structure format
+#
+def GuidStructureStringToGuidString(GuidValue):
+ GuidValueString = GuidValue.lower().replace("{", "").replace("}", "").\
+ replace(" ", "").replace(";", "")
+ GuidValueList = GuidValueString.split(",")
+ if len(GuidValueList) != 11:
+ return ''
+ try:
+ return "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % (
+ int(GuidValueList[0], 16),
+ int(GuidValueList[1], 16),
+ int(GuidValueList[2], 16),
+ int(GuidValueList[3], 16),
+ int(GuidValueList[4], 16),
+ int(GuidValueList[5], 16),
+ int(GuidValueList[6], 16),
+ int(GuidValueList[7], 16),
+ int(GuidValueList[8], 16),
+ int(GuidValueList[9], 16),
+ int(GuidValueList[10], 16)
+ )
+ except BaseException:
+ return ''
+
+## Create directories
+#
+# @param Directory: The directory name
+#
+def CreateDirectory(Directory):
+ if Directory is None or Directory.strip() == "":
+ return True
+ try:
+ if not access(Directory, F_OK):
+ makedirs(Directory)
+ except BaseException:
+ return False
+ return True
+
+## Remove directories, including files and sub-directories in it
+#
+# @param Directory: The directory name
+#
+def RemoveDirectory(Directory, Recursively=False):
+ if Directory is None or Directory.strip() == "" or not \
+ os.path.exists(Directory):
+ return
+ if Recursively:
+ CurrentDirectory = getcwd()
+ chdir(Directory)
+ for File in listdir("."):
+ if os.path.isdir(File):
+ RemoveDirectory(File, Recursively)
+ else:
+ remove(File)
+ chdir(CurrentDirectory)
+ rmdir(Directory)
+
+## Store content in file
+#
+# This method is used to save file only when its content is changed. This is
+# quite useful for "make" system to decide what will be re-built and what
+# won't.
+#
+# @param File: The path of file
+# @param Content: The new content of the file
+# @param IsBinaryFile: The flag indicating if the file is binary file
+# or not
+#
+def SaveFileOnChange(File, Content, IsBinaryFile=True):
+ if os.path.exists(File):
+ if IsBinaryFile:
+ try:
+ if Content == __FileHookOpen__(File, "rb").read():
+ return False
+ except BaseException:
+ Logger.Error(None, ToolError.FILE_OPEN_FAILURE, ExtraData=File)
+ else:
+ try:
+ if Content == __FileHookOpen__(File, "r").read():
+ return False
+ except BaseException:
+ Logger.Error(None, ToolError.FILE_OPEN_FAILURE, ExtraData=File)
+
+ CreateDirectory(os.path.dirname(File))
+ if IsBinaryFile:
+ try:
+ FileFd = __FileHookOpen__(File, "wb")
+ FileFd.write(Content)
+ FileFd.close()
+ except BaseException:
+ Logger.Error(None, ToolError.FILE_CREATE_FAILURE, ExtraData=File)
+ else:
+ try:
+ FileFd = __FileHookOpen__(File, "w")
+ FileFd.write(Content)
+ FileFd.close()
+ except BaseException:
+ Logger.Error(None, ToolError.FILE_CREATE_FAILURE, ExtraData=File)
+
+ return True
+
+## Get all files of a directory
+#
+# @param Root: Root dir
+# @param SkipList : The files need be skipped
+#
+def GetFiles(Root, SkipList=None, FullPath=True):
+ OriPath = os.path.normpath(Root)
+ FileList = []
+ for Root, Dirs, Files in walk(Root):
+ if SkipList:
+ for Item in SkipList:
+ if Item in Dirs:
+ Dirs.remove(Item)
+ if Item in Files:
+ Files.remove(Item)
+ for Dir in Dirs:
+ if Dir.startswith('.'):
+ Dirs.remove(Dir)
+
+ for File in Files:
+ if File.startswith('.'):
+ continue
+ File = os.path.normpath(os.path.join(Root, File))
+ if not FullPath:
+ File = File[len(OriPath) + 1:]
+ FileList.append(File)
+
+ return FileList
+
+## Get all non-metadata files of a directory
+#
+# @param Root: Root Dir
+# @param SkipList : List of path need be skipped
+# @param FullPath: True if the returned file should be full path
+# @param PrefixPath: the path that need to be added to the files found
+# @return: the list of files found
+#
+def GetNonMetaDataFiles(Root, SkipList, FullPath, PrefixPath):
+ FileList = GetFiles(Root, SkipList, FullPath)
+ NewFileList = []
+ for File in FileList:
+ ExtName = os.path.splitext(File)[1]
+ #
+ # skip '.dec', '.inf', '.dsc', '.fdf' files
+ #
+ if ExtName.lower() not in ['.dec', '.inf', '.dsc', '.fdf']:
+ NewFileList.append(os.path.normpath(os.path.join(PrefixPath, File)))
+
+ return NewFileList
+
+## Check if given file exists or not
+#
+# @param File: File name or path to be checked
+# @param Dir: The directory the file is relative to
+#
+def ValidFile(File, Ext=None):
+ File = File.replace('\\', '/')
+ if Ext is not None:
+ FileExt = os.path.splitext(File)[1]
+ if FileExt.lower() != Ext.lower():
+ return False
+ if not os.path.exists(File):
+ return False
+ return True
+
+## RealPath
+#
+# @param File: File name or path to be checked
+# @param Dir: The directory the file is relative to
+# @param OverrideDir: The override directory
+#
+def RealPath(File, Dir='', OverrideDir=''):
+ NewFile = os.path.normpath(os.path.join(Dir, File))
+ NewFile = GlobalData.gALL_FILES[NewFile]
+ if not NewFile and OverrideDir:
+ NewFile = os.path.normpath(os.path.join(OverrideDir, File))
+ NewFile = GlobalData.gALL_FILES[NewFile]
+ return NewFile
+
+## RealPath2
+#
+# @param File: File name or path to be checked
+# @param Dir: The directory the file is relative to
+# @param OverrideDir: The override directory
+#
+def RealPath2(File, Dir='', OverrideDir=''):
+ if OverrideDir:
+ NewFile = GlobalData.gALL_FILES[os.path.normpath(os.path.join\
+ (OverrideDir, File))]
+ if NewFile:
+ if OverrideDir[-1] == os.path.sep:
+ return NewFile[len(OverrideDir):], NewFile[0:len(OverrideDir)]
+ else:
+ return NewFile[len(OverrideDir) + 1:], \
+ NewFile[0:len(OverrideDir)]
+
+ NewFile = GlobalData.gALL_FILES[os.path.normpath(os.path.join(Dir, File))]
+ if NewFile:
+ if Dir:
+ if Dir[-1] == os.path.sep:
+ return NewFile[len(Dir):], NewFile[0:len(Dir)]
+ else:
+ return NewFile[len(Dir) + 1:], NewFile[0:len(Dir)]
+ else:
+ return NewFile, ''
+
+ return None, None
+
+## CommonPath
+#
+# @param PathList: PathList
+#
+def CommonPath(PathList):
+ Path1 = min(PathList).split(os.path.sep)
+ Path2 = max(PathList).split(os.path.sep)
+ for Index in range(min(len(Path1), len(Path2))):
+ if Path1[Index] != Path2[Index]:
+ return os.path.sep.join(Path1[:Index])
+ return os.path.sep.join(Path1)
+
+## PathClass
+#
+class PathClass(object):
+ def __init__(self, File='', Root='', AlterRoot='', Type='', IsBinary=False,
+ Arch='COMMON', ToolChainFamily='', Target='', TagName='', \
+ ToolCode=''):
+ self.Arch = Arch
+ self.File = str(File)
+ if os.path.isabs(self.File):
+ self.Root = ''
+ self.AlterRoot = ''
+ else:
+ self.Root = str(Root)
+ self.AlterRoot = str(AlterRoot)
+
+ #
+ # Remove any '.' and '..' in path
+ #
+ if self.Root:
+ self.Path = os.path.normpath(os.path.join(self.Root, self.File))
+ self.Root = os.path.normpath(CommonPath([self.Root, self.Path]))
+ #
+ # eliminate the side-effect of 'C:'
+ #
+ if self.Root[-1] == ':':
+ self.Root += os.path.sep
+ #
+ # file path should not start with path separator
+ #
+ if self.Root[-1] == os.path.sep:
+ self.File = self.Path[len(self.Root):]
+ else:
+ self.File = self.Path[len(self.Root) + 1:]
+ else:
+ self.Path = os.path.normpath(self.File)
+
+ self.SubDir, self.Name = os.path.split(self.File)
+ self.BaseName, self.Ext = os.path.splitext(self.Name)
+
+ if self.Root:
+ if self.SubDir:
+ self.Dir = os.path.join(self.Root, self.SubDir)
+ else:
+ self.Dir = self.Root
+ else:
+ self.Dir = self.SubDir
+
+ if IsBinary:
+ self.Type = Type
+ else:
+ self.Type = self.Ext.lower()
+
+ self.IsBinary = IsBinary
+ self.Target = Target
+ self.TagName = TagName
+ self.ToolCode = ToolCode
+ self.ToolChainFamily = ToolChainFamily
+
+ self._Key = None
+
+ ## Convert the object of this class to a string
+ #
+ # Convert member Path of the class to a string
+ #
+ def __str__(self):
+ return self.Path
+
+ ## Override __eq__ function
+ #
+ # Check whether PathClass are the same
+ #
+ def __eq__(self, Other):
+ if isinstance(Other, type(self)):
+ return self.Path == Other.Path
+ else:
+ return self.Path == str(Other)
+
+ ## Override __hash__ function
+ #
+ # Use Path as key in hash table
+ #
+ def __hash__(self):
+ return hash(self.Path)
+
+ ## _GetFileKey
+ #
+ def _GetFileKey(self):
+ if self._Key is None:
+ self._Key = self.Path.upper()
+ return self._Key
+ ## Validate
+ #
+ def Validate(self, Type='', CaseSensitive=True):
+ if GlobalData.gCASE_INSENSITIVE:
+ CaseSensitive = False
+ if Type and Type.lower() != self.Type:
+ return ToolError.FILE_TYPE_MISMATCH, '%s (expect %s but got %s)' % \
+ (self.File, Type, self.Type)
+
+ RealFile, RealRoot = RealPath2(self.File, self.Root, self.AlterRoot)
+ if not RealRoot and not RealFile:
+ RealFile = self.File
+ if self.AlterRoot:
+ RealFile = os.path.join(self.AlterRoot, self.File)
+ elif self.Root:
+ RealFile = os.path.join(self.Root, self.File)
+ return ToolError.FILE_NOT_FOUND, os.path.join(self.AlterRoot, RealFile)
+
+ ErrorCode = 0
+ ErrorInfo = ''
+ if RealRoot != self.Root or RealFile != self.File:
+ if CaseSensitive and (RealFile != self.File or \
+ (RealRoot != self.Root and RealRoot != \
+ self.AlterRoot)):
+ ErrorCode = ToolError.FILE_CASE_MISMATCH
+ ErrorInfo = self.File + '\n\t' + RealFile + \
+ " [in file system]"
+
+ self.SubDir, self.Name = os.path.split(RealFile)
+ self.BaseName, self.Ext = os.path.splitext(self.Name)
+ if self.SubDir:
+ self.Dir = os.path.join(RealRoot, self.SubDir)
+ else:
+ self.Dir = RealRoot
+ self.File = RealFile
+ self.Root = RealRoot
+ self.Path = os.path.join(RealRoot, RealFile)
+ return ErrorCode, ErrorInfo
+
+ Key = property(_GetFileKey)
+
+## Get current workspace
+#
+# get WORKSPACE from environment variable if present,if not use current working directory as WORKSPACE
+#
+def GetWorkspace():
+ #
+ # check WORKSPACE
+ #
+ if "WORKSPACE" in environ:
+ WorkspaceDir = os.path.normpath(environ["WORKSPACE"])
+ if not os.path.exists(WorkspaceDir):
+ Logger.Error("UPT",
+ ToolError.UPT_ENVIRON_MISSING_ERROR,
+ ST.ERR_WORKSPACE_NOTEXIST,
+ ExtraData="%s" % WorkspaceDir)
+ else:
+ WorkspaceDir = os.getcwd()
+
+ if WorkspaceDir[-1] == ':':
+ WorkspaceDir += os.sep
+
+ PackagesPath = os.environ.get("PACKAGES_PATH")
+ mws.setWs(WorkspaceDir, PackagesPath)
+
+ return WorkspaceDir, mws.PACKAGES_PATH
+
+## Get relative path
+#
+# use full path and workspace to get relative path
+# the destination of this function is mainly to resolve the root path issue(like c: or c:\)
+#
+# @param Fullpath: a string of fullpath
+# @param Workspace: a string of workspace
+#
+def GetRelativePath(Fullpath, Workspace):
+
+ RelativePath = ''
+ if Workspace.endswith(os.sep):
+ RelativePath = Fullpath[Fullpath.upper().find(Workspace.upper())+len(Workspace):]
+ else:
+ RelativePath = Fullpath[Fullpath.upper().find(Workspace.upper())+len(Workspace)+1:]
+
+ return RelativePath
+
+## Check whether all module types are in list
+#
+# check whether all module types (SUP_MODULE_LIST) are in list
+#
+# @param ModuleList: a list of ModuleType
+#
+def IsAllModuleList(ModuleList):
+ NewModuleList = [Module.upper() for Module in ModuleList]
+ for Module in SUP_MODULE_LIST:
+ if Module not in NewModuleList:
+ return False
+ else:
+ return True
+
+## Dictionary that use comment(GenericComment, TailComment) as value,
+# if a new comment which key already in the dic is inserted, then the
+# comment will be merged.
+# Key is (Statement, SupArch), when TailComment is added, it will ident
+# according to Statement
+#
+class MergeCommentDict(dict):
+ ## []= operator
+ #
+ def __setitem__(self, Key, CommentVal):
+ GenericComment, TailComment = CommentVal
+ if Key in self:
+ OrigVal1, OrigVal2 = dict.__getitem__(self, Key)
+ Statement = Key[0]
+ dict.__setitem__(self, Key, (OrigVal1 + GenericComment, OrigVal2 \
+ + len(Statement) * ' ' + TailComment))
+ else:
+ dict.__setitem__(self, Key, (GenericComment, TailComment))
+
+ ## =[] operator
+ #
+ def __getitem__(self, Key):
+ return dict.__getitem__(self, Key)
+
+
+## GenDummyHelpTextObj
+#
+# @retval HelpTxt: Generated dummy help text object
+#
+def GenDummyHelpTextObj():
+ HelpTxt = TextObject()
+ HelpTxt.SetLang(TAB_LANGUAGE_EN_US)
+ HelpTxt.SetString(' ')
+ return HelpTxt
+
+## ConvertVersionToDecimal, the minor version should be within 0 - 99
+# <HexVersion> ::= "0x" <Major> <Minor>
+# <Major> ::= (a-fA-F0-9){4}
+# <Minor> ::= (a-fA-F0-9){4}
+# <DecVersion> ::= (0-65535) ["." (0-99)]
+#
+# @param StringIn: The string contains version defined in INF file.
+# It can be Decimal or Hex
+#
+def ConvertVersionToDecimal(StringIn):
+ if IsValidHexVersion(StringIn):
+ Value = int(StringIn, 16)
+ Major = Value >> 16
+ Minor = Value & 0xFFFF
+ MinorStr = str(Minor)
+ if len(MinorStr) == 1:
+ MinorStr = '0' + MinorStr
+ return str(Major) + '.' + MinorStr
+ else:
+ if StringIn.find(TAB_SPLIT) != -1:
+ return StringIn
+ elif StringIn:
+ return StringIn + '.0'
+ else:
+ #
+ # when StringIn is '', return it directly
+ #
+ return StringIn
+
+## GetHelpStringByRemoveHashKey
+#
+# Remove hash key at the header of string and return the remain.
+#
+# @param String: The string need to be processed.
+#
+def GetHelpStringByRemoveHashKey(String):
+ ReturnString = ''
+ PattenRemoveHashKey = re.compile(r"^[#+\s]+", re.DOTALL)
+ String = String.strip()
+ if String == '':
+ return String
+
+ LineList = GetSplitValueList(String, END_OF_LINE)
+ for Line in LineList:
+ ValueList = PattenRemoveHashKey.split(Line)
+ if len(ValueList) == 1:
+ ReturnString += ValueList[0] + END_OF_LINE
+ else:
+ ReturnString += ValueList[1] + END_OF_LINE
+
+ if ReturnString.endswith('\n') and not ReturnString.endswith('\n\n') and ReturnString != '\n':
+ ReturnString = ReturnString[:-1]
+
+ return ReturnString
+
+## ConvPathFromAbsToRel
+#
+# Get relative file path from absolute path.
+#
+# @param Path: The string contain file absolute path.
+# @param Root: The string contain the parent path of Path in.
+#
+#
+def ConvPathFromAbsToRel(Path, Root):
+ Path = os.path.normpath(Path)
+ Root = os.path.normpath(Root)
+ FullPath = os.path.normpath(os.path.join(Root, Path))
+
+ #
+ # If Path is absolute path.
+ # It should be in Root.
+ #
+ if os.path.isabs(Path):
+ return FullPath[FullPath.find(Root) + len(Root) + 1:]
+
+ else:
+ return Path
+
+## ConvertPath
+#
+# Convert special characters to '_', '\' to '/'
+# return converted path: Test!1.inf -> Test_1.inf
+#
+# @param Path: Path to be converted
+#
+def ConvertPath(Path):
+ RetPath = ''
+ for Char in Path.strip():
+ if Char.isalnum() or Char in '.-_/':
+ RetPath = RetPath + Char
+ elif Char == '\\':
+ RetPath = RetPath + '/'
+ else:
+ RetPath = RetPath + '_'
+ return RetPath
+
+## ConvertSpec
+#
+# during install, convert the Spec string extract from UPD into INF allowable definition,
+# the difference is period is allowed in the former (not the first letter) but not in the latter.
+# return converted Spec string
+#
+# @param SpecStr: SpecStr to be converted
+#
+def ConvertSpec(SpecStr):
+ RetStr = ''
+ for Char in SpecStr:
+ if Char.isalnum() or Char == '_':
+ RetStr = RetStr + Char
+ else:
+ RetStr = RetStr + '_'
+
+ return RetStr
+
+
+## IsEqualList
+#
+# Judge two lists are identical(contain same item).
+# The rule is elements in List A are in List B and elements in List B are in List A.
+#
+# @param ListA, ListB Lists need to be judged.
+#
+# @return True ListA and ListB are identical
+# @return False ListA and ListB are different with each other
+#
+def IsEqualList(ListA, ListB):
+ if ListA == ListB:
+ return True
+
+ for ItemA in ListA:
+ if not ItemA in ListB:
+ return False
+
+ for ItemB in ListB:
+ if not ItemB in ListA:
+ return False
+
+ return True
+
+## ConvertArchList
+#
+# Convert item in ArchList if the start character is lower case.
+# In UDP spec, Arch is only allowed as: [A-Z]([a-zA-Z0-9])*
+#
+# @param ArchList The ArchList need to be converted.
+#
+# @return NewList The ArchList been converted.
+#
+def ConvertArchList(ArchList):
+ NewArchList = []
+ if not ArchList:
+ return NewArchList
+
+ if isinstance(ArchList, list):
+ for Arch in ArchList:
+ Arch = Arch.upper()
+ NewArchList.append(Arch)
+ elif isinstance(ArchList, str):
+ ArchList = ArchList.upper()
+ NewArchList.append(ArchList)
+
+ return NewArchList
+
+## ProcessLineExtender
+#
+# Process the LineExtender of Line in LineList.
+# If one line ends with a line extender, then it will be combined together with next line.
+#
+# @param LineList The LineList need to be processed.
+#
+# @return NewList The ArchList been processed.
+#
+def ProcessLineExtender(LineList):
+ NewList = []
+ Count = 0
+ while Count < len(LineList):
+ if LineList[Count].strip().endswith("\\") and Count + 1 < len(LineList):
+ NewList.append(LineList[Count].strip()[:-2] + LineList[Count + 1])
+ Count = Count + 1
+ else:
+ NewList.append(LineList[Count])
+
+ Count = Count + 1
+
+ return NewList
+
+## ProcessEdkComment
+#
+# Process EDK style comment in LineList: c style /* */ comment or cpp style // comment
+#
+#
+# @param LineList The LineList need to be processed.
+#
+# @return LineList The LineList been processed.
+# @return FirstPos Where Edk comment is first found, -1 if not found
+#
+def ProcessEdkComment(LineList):
+ FindEdkBlockComment = False
+ Count = 0
+ StartPos = -1
+ EndPos = -1
+ FirstPos = -1
+
+ while(Count < len(LineList)):
+ Line = LineList[Count].strip()
+ if Line.startswith("/*"):
+ #
+ # handling c style comment
+ #
+ StartPos = Count
+ while Count < len(LineList):
+ Line = LineList[Count].strip()
+ if Line.endswith("*/"):
+ if (Count == StartPos) and Line.strip() == '/*/':
+ Count = Count + 1
+ continue
+ EndPos = Count
+ FindEdkBlockComment = True
+ break
+ Count = Count + 1
+
+ if FindEdkBlockComment:
+ if FirstPos == -1:
+ FirstPos = StartPos
+ for Index in range(StartPos, EndPos+1):
+ LineList[Index] = ''
+ FindEdkBlockComment = False
+ elif Line.find("//") != -1 and not Line.startswith("#"):
+ #
+ # handling cpp style comment
+ #
+ LineList[Count] = Line.replace("//", '#')
+ if FirstPos == -1:
+ FirstPos = Count
+
+ Count = Count + 1
+
+ return LineList, FirstPos
+
+## GetLibInstanceInfo
+#
+# Get the information from Library Instance INF file.
+#
+# @param string. A string start with # and followed by INF file path
+# @param WorkSpace. The WorkSpace directory used to combined with INF file path.
+#
+# @return GUID, Version
+def GetLibInstanceInfo(String, WorkSpace, LineNo):
+
+ FileGuidString = ""
+ VerString = ""
+
+ OriginalString = String
+ String = String.strip()
+ if not String:
+ return None, None
+ #
+ # Remove "#" characters at the beginning
+ #
+ String = GetHelpStringByRemoveHashKey(String)
+ String = String.strip()
+
+ #
+ # Validate file name exist.
+ #
+ FullFileName = os.path.normpath(os.path.realpath(os.path.join(WorkSpace, String)))
+ if not (ValidFile(FullFileName)):
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_FILELIST_EXIST % (String),
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=LineNo,
+ ExtraData=OriginalString)
+
+ #
+ # Validate file exist/format.
+ #
+ if IsValidPath(String, WorkSpace):
+ IsValidFileFlag = True
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID % (String),
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=LineNo,
+ ExtraData=OriginalString)
+ return False
+ if IsValidFileFlag:
+ FileLinesList = []
+
+ try:
+ FInputfile = open(FullFileName, "r")
+ try:
+ FileLinesList = FInputfile.readlines()
+ except BaseException:
+ Logger.Error("InfParser",
+ ToolError.FILE_READ_FAILURE,
+ ST.ERR_FILE_OPEN_FAILURE,
+ File=FullFileName)
+ finally:
+ FInputfile.close()
+ except BaseException:
+ Logger.Error("InfParser",
+ ToolError.FILE_READ_FAILURE,
+ ST.ERR_FILE_OPEN_FAILURE,
+ File=FullFileName)
+
+ ReFileGuidPattern = re.compile("^\s*FILE_GUID\s*=.*$")
+ ReVerStringPattern = re.compile("^\s*VERSION_STRING\s*=.*$")
+
+ FileLinesList = ProcessLineExtender(FileLinesList)
+
+ for Line in FileLinesList:
+ if ReFileGuidPattern.match(Line):
+ FileGuidString = Line
+ if ReVerStringPattern.match(Line):
+ VerString = Line
+
+ if FileGuidString:
+ FileGuidString = GetSplitValueList(FileGuidString, '=', 1)[1]
+ if VerString:
+ VerString = GetSplitValueList(VerString, '=', 1)[1]
+
+ return FileGuidString, VerString
+
+## GetLocalValue
+#
+# Generate the local value for INF and DEC file. If Lang attribute not present, then use this value.
+# If present, and there is no element without the Lang attribute, and one of the elements has the rfc1766 code is
+# "en-x-tianocore", or "en-US" if "en-x-tianocore" was not found, or "en" if "en-US" was not found, or startswith 'en'
+# if 'en' was not found, then use this value.
+# If multiple entries of a tag exist which have the same language code, use the last entry.
+#
+# @param ValueList A list need to be processed.
+# @param UseFirstValue: True to use the first value, False to use the last value
+#
+# @return LocalValue
+def GetLocalValue(ValueList, UseFirstValue=False):
+ Value1 = ''
+ Value2 = ''
+ Value3 = ''
+ Value4 = ''
+ Value5 = ''
+ for (Key, Value) in ValueList:
+ if Key == TAB_LANGUAGE_EN_X:
+ if UseFirstValue:
+ if not Value1:
+ Value1 = Value
+ else:
+ Value1 = Value
+ if Key == TAB_LANGUAGE_EN_US:
+ if UseFirstValue:
+ if not Value2:
+ Value2 = Value
+ else:
+ Value2 = Value
+ if Key == TAB_LANGUAGE_EN:
+ if UseFirstValue:
+ if not Value3:
+ Value3 = Value
+ else:
+ Value3 = Value
+ if Key.startswith(TAB_LANGUAGE_EN):
+ if UseFirstValue:
+ if not Value4:
+ Value4 = Value
+ else:
+ Value4 = Value
+ if Key == '':
+ if UseFirstValue:
+ if not Value5:
+ Value5 = Value
+ else:
+ Value5 = Value
+
+ if Value1:
+ return Value1
+ if Value2:
+ return Value2
+ if Value3:
+ return Value3
+ if Value4:
+ return Value4
+ if Value5:
+ return Value5
+
+ return ''
+
+
+## GetCharIndexOutStr
+#
+# Get comment character index outside a string
+#
+# @param Line: The string to be checked
+# @param CommentCharacter: Comment char, used to ignore comment content
+#
+# @retval Index
+#
+def GetCharIndexOutStr(CommentCharacter, Line):
+ #
+ # remove whitespace
+ #
+ Line = Line.strip()
+
+ #
+ # Check whether comment character is in a string
+ #
+ InString = False
+ for Index in range(0, len(Line)):
+ if Line[Index] == '"':
+ InString = not InString
+ elif Line[Index] == CommentCharacter and InString :
+ pass
+ elif Line[Index] == CommentCharacter and (Index +1) < len(Line) and Line[Index+1] == CommentCharacter \
+ and not InString :
+ return Index
+ return -1
+
+## ValidateUNIFilePath
+#
+# Check the UNI file path
+#
+# @param FilePath: The UNI file path
+#
+def ValidateUNIFilePath(Path):
+ Suffix = Path[Path.rfind(TAB_SPLIT):]
+
+ #
+ # Check if the suffix is one of the '.uni', '.UNI', '.Uni'
+ #
+ if Suffix not in TAB_UNI_FILE_SUFFIXS:
+ Logger.Error("Unicode File Parser",
+ ToolError.FORMAT_INVALID,
+ Message=ST.ERR_UNI_FILE_SUFFIX_WRONG,
+ ExtraData=Path)
+
+ #
+ # Check if '..' in the file name(without suffix)
+ #
+ if (TAB_SPLIT + TAB_SPLIT) in Path:
+ Logger.Error("Unicode File Parser",
+ ToolError.FORMAT_INVALID,
+ Message=ST.ERR_UNI_FILE_NAME_INVALID,
+ ExtraData=Path)
+
+ #
+ # Check if the file name is valid according to the DEC and INF specification
+ #
+ Pattern = '[a-zA-Z0-9_][a-zA-Z0-9_\-\.]*'
+ FileName = Path.replace(Suffix, '')
+ InvalidCh = re.sub(Pattern, '', FileName)
+ if InvalidCh:
+ Logger.Error("Unicode File Parser",
+ ToolError.FORMAT_INVALID,
+ Message=ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID,
+ ExtraData=Path)
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Library/ParserValidate.py b/roms/edk2/BaseTools/Source/Python/UPT/Library/ParserValidate.py
new file mode 100644
index 000000000..62f406141
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Library/ParserValidate.py
@@ -0,0 +1,727 @@
+## @file ParserValidate.py
+# Functions for parser validation
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+ParserValidate
+'''
+
+import os.path
+import re
+import platform
+
+from Library.DataType import MODULE_LIST
+from Library.DataType import COMPONENT_TYPE_LIST
+from Library.DataType import PCD_USAGE_TYPE_LIST_OF_MODULE
+from Library.DataType import TAB_SPACE_SPLIT
+from Library.StringUtils import GetSplitValueList
+from Library.ExpressionValidate import IsValidBareCString
+from Library.ExpressionValidate import IsValidFeatureFlagExp
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+
+## __HexDigit() method
+#
+# Whether char input is a Hex data bit
+#
+# @param TempChar: The char to test
+#
+def __HexDigit(TempChar):
+ if (TempChar >= 'a' and TempChar <= 'f') or \
+ (TempChar >= 'A' and TempChar <= 'F') \
+ or (TempChar >= '0' and TempChar <= '9'):
+ return True
+ else:
+ return False
+
+## IsValidHex() method
+#
+# Whether char input is a Hex data.
+#
+# @param TempChar: The char to test
+#
+def IsValidHex(HexStr):
+ if not HexStr.upper().startswith("0X"):
+ return False
+ CharList = [c for c in HexStr[2:] if not __HexDigit(c)]
+ if len(CharList) == 0:
+ return True
+ else:
+ return False
+
+## Judge the input string is valid bool type or not.
+#
+# <TRUE> ::= {"TRUE"} {"true"} {"True"} {"0x1"} {"0x01"}
+# <FALSE> ::= {"FALSE"} {"false"} {"False"} {"0x0"} {"0x00"}
+# <BoolType> ::= {<TRUE>} {<FALSE>}
+#
+# @param BoolString: A string contained the value need to be judged.
+#
+def IsValidBoolType(BoolString):
+ #
+ # Valid True
+ #
+ if BoolString == 'TRUE' or \
+ BoolString == 'True' or \
+ BoolString == 'true' or \
+ BoolString == '0x1' or \
+ BoolString == '0x01':
+ return True
+ #
+ # Valid False
+ #
+ elif BoolString == 'FALSE' or \
+ BoolString == 'False' or \
+ BoolString == 'false' or \
+ BoolString == '0x0' or \
+ BoolString == '0x00':
+ return True
+ #
+ # Invalid bool type
+ #
+ else:
+ return False
+
+## Is Valid Module Type List or not
+#
+# @param ModuleTypeList: A list contain ModuleType strings need to be
+# judged.
+#
+def IsValidInfMoudleTypeList(ModuleTypeList):
+ for ModuleType in ModuleTypeList:
+ return IsValidInfMoudleType(ModuleType)
+
+## Is Valid Module Type or not
+#
+# @param ModuleType: A string contain ModuleType need to be judged.
+#
+def IsValidInfMoudleType(ModuleType):
+ if ModuleType in MODULE_LIST:
+ return True
+ else:
+ return False
+
+## Is Valid Component Type or not
+#
+# @param ComponentType: A string contain ComponentType need to be judged.
+#
+def IsValidInfComponentType(ComponentType):
+ if ComponentType.upper() in COMPONENT_TYPE_LIST:
+ return True
+ else:
+ return False
+
+
+## Is valid Tool Family or not
+#
+# @param ToolFamily: A string contain Tool Family need to be judged.
+# Family := [A-Z]([a-zA-Z0-9])*
+#
+def IsValidToolFamily(ToolFamily):
+ ReIsValidFamily = re.compile(r"^[A-Z]+[A-Za-z0-9]{0,}$", re.DOTALL)
+ if ReIsValidFamily.match(ToolFamily) is None:
+ return False
+ return True
+
+## Is valid Tool TagName or not
+#
+# The TagName sample is MYTOOLS and VS2005.
+#
+# @param TagName: A string contain Tool TagName need to be judged.
+#
+def IsValidToolTagName(TagName):
+ if TagName.strip() == '':
+ return True
+ if TagName.strip() == '*':
+ return True
+ if not IsValidWord(TagName):
+ return False
+ return True
+
+## Is valid arch or not
+#
+# @param Arch The arch string need to be validated
+# <OA> ::= (a-zA-Z)(A-Za-z0-9){0,}
+# <arch> ::= {"IA32"} {"X64"} {"IPF"} {"EBC"} {<OA>}
+# {"common"}
+# @param Arch: Input arch
+#
+def IsValidArch(Arch):
+ if Arch == 'common':
+ return True
+ ReIsValidArch = re.compile(r"^[a-zA-Z]+[a-zA-Z0-9]{0,}$", re.DOTALL)
+ if ReIsValidArch.match(Arch) is None:
+ return False
+ return True
+
+## Is valid family or not
+#
+# <Family> ::= {"MSFT"} {"GCC"} {"INTEL"} {<Usr>} {"*"}
+# <Usr> ::= [A-Z][A-Za-z0-9]{0,}
+#
+# @param family: The family string need to be validated
+#
+def IsValidFamily(Family):
+ Family = Family.strip()
+ if Family == '*':
+ return True
+
+ if Family == '':
+ return True
+
+ ReIsValidFamily = re.compile(r"^[A-Z]+[A-Za-z0-9]{0,}$", re.DOTALL)
+ if ReIsValidFamily.match(Family) is None:
+ return False
+ return True
+
+## Is valid build option name or not
+#
+# @param BuildOptionName: The BuildOptionName string need to be validated
+#
+def IsValidBuildOptionName(BuildOptionName):
+ if not BuildOptionName:
+ return False
+
+ ToolOptionList = GetSplitValueList(BuildOptionName, '_', 4)
+
+ if len(ToolOptionList) != 5:
+ return False
+
+ ReIsValidBuildOption1 = re.compile(r"^\s*(\*)|([A-Z][a-zA-Z0-9]*)$")
+ ReIsValidBuildOption2 = re.compile(r"^\s*(\*)|([a-zA-Z][a-zA-Z0-9]*)$")
+
+ if ReIsValidBuildOption1.match(ToolOptionList[0]) is None:
+ return False
+
+ if ReIsValidBuildOption1.match(ToolOptionList[1]) is None:
+ return False
+
+ if ReIsValidBuildOption2.match(ToolOptionList[2]) is None:
+ return False
+
+ if ToolOptionList[3] == "*" and ToolOptionList[4] not in ['FAMILY', 'DLL', 'DPATH']:
+ return False
+
+ return True
+
+## IsValidToken
+#
+# Check if pattern string matches total token
+#
+# @param ReString: regular string
+# @param Token: Token to be matched
+#
+def IsValidToken(ReString, Token):
+ Match = re.compile(ReString).match(Token)
+ return Match and Match.start() == 0 and Match.end() == len(Token)
+
+## IsValidPath
+#
+# Check if path exist
+#
+# @param Path: Absolute path or relative path to be checked
+# @param Root: Root path
+#
+def IsValidPath(Path, Root):
+ Path = Path.strip()
+ OrigPath = Path.replace('\\', '/')
+
+ Path = os.path.normpath(Path).replace('\\', '/')
+ Root = os.path.normpath(Root).replace('\\', '/')
+ FullPath = mws.join(Root, Path)
+
+ if not os.path.exists(FullPath):
+ return False
+
+ #
+ # If Path is absolute path.
+ # It should be in Root.
+ #
+ if os.path.isabs(Path):
+ if not Path.startswith(Root):
+ return False
+ return True
+
+ #
+ # Check illegal character
+ #
+ for Rel in ['/', './', '../']:
+ if OrigPath.startswith(Rel):
+ return False
+ for Rel in ['//', '/./', '/../']:
+ if Rel in OrigPath:
+ return False
+ for Rel in ['/.', '/..', '/']:
+ if OrigPath.endswith(Rel):
+ return False
+
+ Path = Path.rstrip('/')
+
+ #
+ # Check relative path
+ #
+ for Word in Path.split('/'):
+ if not IsValidWord(Word):
+ return False
+
+ return True
+
+## IsValidInstallPath
+#
+# Check if an install path valid or not.
+#
+# Absolute path or path starts with '.' or path contains '..' are invalid.
+#
+# @param Path: path to be checked
+#
+def IsValidInstallPath(Path):
+ if platform.platform().find("Windows") >= 0:
+ if os.path.isabs(Path):
+ return False
+ else:
+ if Path[1:2] == ':':
+ return False
+ if os.path.isabs(Path):
+ return False
+ if Path.startswith('.'):
+ return False
+
+ if Path.find('..') != -1:
+ return False
+
+ return True
+
+
+## IsValidCFormatGuid
+#
+# Check if GUID format has the from of {8,4,4,{2,2,2,2,2,2,2,2}}
+#
+# @param Guid: Guid to be checked
+#
+def IsValidCFormatGuid(Guid):
+ #
+ # Valid: { 0xf0b11735, 0x87a0, 0x4193, {0xb2, 0x66, 0x53, 0x8c, 0x38,
+ # 0xaf, 0x48, 0xce }}
+ # Invalid: { 0xf0b11735, 0x87a0, 0x4193, {0xb2, 0x66, 0x53, 0x8c, 0x38,
+ # 0xaf, 0x48, 0xce }} 0x123
+ # Invalid: { 0xf0b1 1735, 0x87a0, 0x4193, {0xb2, 0x66, 0x53, 0x8c, 0x38,
+ # 0xaf, 0x48, 0xce }}
+ #
+ List = ['{', 10, ',', 6, ',', 6, ',{', 4, ',', 4, ',', 4,
+ ',', 4, ',', 4, ',', 4, ',', 4, ',', 4, '}}']
+ Index = 0
+ Value = ''
+ SepValue = ''
+ for Char in Guid:
+ if Char not in '{},\t ':
+ Value += Char
+ continue
+ if Value:
+ try:
+ #
+ # Index may out of bound
+ #
+ if not SepValue or SepValue != List[Index]:
+ return False
+ Index += 1
+ SepValue = ''
+
+ if not Value.startswith('0x') and not Value.startswith('0X'):
+ return False
+
+ #
+ # Index may out of bound
+ #
+ if not isinstance(List[Index], type(1)) or \
+ len(Value) > List[Index] or len(Value) < 3:
+ return False
+
+ #
+ # Check if string can be converted to integer
+ # Throw exception if not
+ #
+ int(Value, 16)
+ except BaseException:
+ #
+ # Exception caught means invalid format
+ #
+ return False
+ Value = ''
+ Index += 1
+ if Char in '{},':
+ SepValue += Char
+
+ return SepValue == '}}' and Value == ''
+
+## IsValidPcdType
+#
+# Check whether the PCD type is valid
+#
+# @param PcdTypeString: The PcdType string need to be checked.
+#
+def IsValidPcdType(PcdTypeString):
+ if PcdTypeString.upper() in PCD_USAGE_TYPE_LIST_OF_MODULE:
+ return True
+ else:
+ return False
+
+## IsValidWord
+#
+# Check whether the word is valid.
+# <Word> ::= (a-zA-Z0-9_)(a-zA-Z0-9_-){0,} Alphanumeric characters with
+# optional
+# dash "-" and/or underscore "_" characters. No whitespace
+# characters are permitted.
+#
+# @param Word: The word string need to be checked.
+#
+def IsValidWord(Word):
+ if not Word:
+ return False
+ #
+ # The first char should be alpha, _ or Digit.
+ #
+ if not Word[0].isalnum() and \
+ not Word[0] == '_' and \
+ not Word[0].isdigit():
+ return False
+
+ LastChar = ''
+ for Char in Word[1:]:
+ if (not Char.isalpha()) and \
+ (not Char.isdigit()) and \
+ Char != '-' and \
+ Char != '_' and \
+ Char != '.':
+ return False
+ if Char == '.' and LastChar == '.':
+ return False
+ LastChar = Char
+
+ return True
+
+
+## IsValidSimpleWord
+#
+# Check whether the SimpleWord is valid.
+# <SimpleWord> ::= (a-zA-Z0-9)(a-zA-Z0-9_-){0,}
+# A word that cannot contain a period character.
+#
+# @param Word: The word string need to be checked.
+#
+def IsValidSimpleWord(Word):
+ ReIsValidSimpleWord = \
+ re.compile(r"^[0-9A-Za-z][0-9A-Za-z\-_]*$", re.DOTALL)
+ Word = Word.strip()
+ if not Word:
+ return False
+
+ if not ReIsValidSimpleWord.match(Word):
+ return False
+
+ return True
+
+## IsValidDecVersion
+#
+# Check whether the decimal version is valid.
+# <DecVersion> ::= (0-9){1,} ["." (0-9){1,}]
+#
+# @param Word: The word string need to be checked.
+#
+def IsValidDecVersion(Word):
+ if Word.find('.') > -1:
+ ReIsValidDecVersion = re.compile(r"[0-9]+\.?[0-9]+$")
+ else:
+ ReIsValidDecVersion = re.compile(r"[0-9]+$")
+ if ReIsValidDecVersion.match(Word) is None:
+ return False
+ return True
+
+## IsValidHexVersion
+#
+# Check whether the hex version is valid.
+# <HexVersion> ::= "0x" <Major> <Minor>
+# <Major> ::= <HexDigit>{4}
+# <Minor> ::= <HexDigit>{4}
+#
+# @param Word: The word string need to be checked.
+#
+def IsValidHexVersion(Word):
+ ReIsValidHexVersion = re.compile(r"[0][xX][0-9A-Fa-f]{8}$", re.DOTALL)
+ if ReIsValidHexVersion.match(Word) is None:
+ return False
+
+ return True
+
+## IsValidBuildNumber
+#
+# Check whether the BUILD_NUMBER is valid.
+# ["BUILD_NUMBER" "=" <Integer>{1,4} <EOL>]
+#
+# @param Word: The BUILD_NUMBER string need to be checked.
+#
+def IsValidBuildNumber(Word):
+ ReIsValieBuildNumber = re.compile(r"[0-9]{1,4}$", re.DOTALL)
+ if ReIsValieBuildNumber.match(Word) is None:
+ return False
+
+ return True
+
+## IsValidDepex
+#
+# Check whether the Depex is valid.
+#
+# @param Word: The Depex string need to be checked.
+#
+def IsValidDepex(Word):
+ Index = Word.upper().find("PUSH")
+ if Index > -1:
+ return IsValidCFormatGuid(Word[Index+4:].strip())
+
+ ReIsValidCName = re.compile(r"^[A-Za-z_][0-9A-Za-z_\s\.]*$", re.DOTALL)
+ if ReIsValidCName.match(Word) is None:
+ return False
+
+ return True
+
+## IsValidNormalizedString
+#
+# Check
+# <NormalizedString> ::= <DblQuote> [{<Word>} {<Space>}]{1,} <DblQuote>
+# <Space> ::= 0x20
+#
+# @param String: string to be checked
+#
+def IsValidNormalizedString(String):
+ if String == '':
+ return True
+
+ for Char in String:
+ if Char == '\t':
+ return False
+
+ StringList = GetSplitValueList(String, TAB_SPACE_SPLIT)
+
+ for Item in StringList:
+ if not Item:
+ continue
+ if not IsValidWord(Item):
+ return False
+
+ return True
+
+## IsValidIdString
+#
+# Check whether the IdString is valid.
+#
+# @param IdString: The IdString need to be checked.
+#
+def IsValidIdString(String):
+ if IsValidSimpleWord(String.strip()):
+ return True
+
+ if String.strip().startswith('"') and \
+ String.strip().endswith('"'):
+ String = String[1:-1]
+ if String.strip() == "":
+ return True
+ if IsValidNormalizedString(String):
+ return True
+
+ return False
+
+## IsValidVersionString
+#
+# Check whether the VersionString is valid.
+# <AsciiString> ::= [ [<WhiteSpace>]{0,} [<AsciiChars>]{0,} ] {0,}
+# <WhiteSpace> ::= {<Tab>} {<Space>}
+# <Tab> ::= 0x09
+# <Space> ::= 0x20
+# <AsciiChars> ::= (0x21 - 0x7E)
+#
+# @param VersionString: The VersionString need to be checked.
+#
+def IsValidVersionString(VersionString):
+ VersionString = VersionString.strip()
+ for Char in VersionString:
+ if not (Char >= 0x21 and Char <= 0x7E):
+ return False
+
+ return True
+
+## IsValidPcdValue
+#
+# Check whether the PcdValue is valid.
+#
+# @param VersionString: The PcdValue need to be checked.
+#
+def IsValidPcdValue(PcdValue):
+ for Char in PcdValue:
+ if Char == '\n' or Char == '\t' or Char == '\f':
+ return False
+
+ #
+ # <Boolean>
+ #
+ if IsValidFeatureFlagExp(PcdValue, True)[0]:
+ return True
+
+ #
+ # <Number> ::= {<Integer>} {<HexNumber>}
+ # <Integer> ::= {(0-9)} {(1-9)(0-9){1,}}
+ # <HexNumber> ::= "0x" <HexDigit>{1,}
+ # <HexDigit> ::= (a-fA-F0-9)
+ #
+ if IsValidHex(PcdValue):
+ return True
+
+ ReIsValidIntegerSingle = re.compile(r"^\s*[0-9]\s*$", re.DOTALL)
+ if ReIsValidIntegerSingle.match(PcdValue) is not None:
+ return True
+
+ ReIsValidIntegerMulti = re.compile(r"^\s*[1-9][0-9]+\s*$", re.DOTALL)
+ if ReIsValidIntegerMulti.match(PcdValue) is not None:
+ return True
+
+ #
+ # <StringVal> ::= {<StringType>} {<Array>} {"$(" <MACRO> ")"}
+ # <StringType> ::= {<UnicodeString>} {<CString>}
+ #
+ ReIsValidStringType = re.compile(r"^\s*[\"L].*[\"]\s*$")
+ if ReIsValidStringType.match(PcdValue):
+ IsTrue = False
+ if PcdValue.strip().startswith('L\"'):
+ StringValue = PcdValue.strip().lstrip('L\"').rstrip('\"')
+ if IsValidBareCString(StringValue):
+ IsTrue = True
+ elif PcdValue.strip().startswith('\"'):
+ StringValue = PcdValue.strip().lstrip('\"').rstrip('\"')
+ if IsValidBareCString(StringValue):
+ IsTrue = True
+ if IsTrue:
+ return IsTrue
+
+ #
+ # <Array> ::= {<CArray>} {<NList>} {<CFormatGUID>}
+ # <CArray> ::= "{" [<NList>] <CArray>{0,} "}"
+ # <NList> ::= <HexByte> ["," <HexByte>]{0,}
+ # <HexDigit> ::= (a-fA-F0-9)
+ # <HexByte> ::= "0x" <HexDigit>{1,2}
+ #
+ if IsValidCFormatGuid(PcdValue):
+ return True
+
+ ReIsValidByteHex = re.compile(r"^\s*0x[0-9a-fA-F]{1,2}\s*$", re.DOTALL)
+ if PcdValue.strip().startswith('{') and PcdValue.strip().endswith('}') :
+ StringValue = PcdValue.strip().lstrip('{').rstrip('}')
+ ValueList = StringValue.split(',')
+ AllValidFlag = True
+ for ValueItem in ValueList:
+ if not ReIsValidByteHex.match(ValueItem.strip()):
+ AllValidFlag = False
+
+ if AllValidFlag:
+ return True
+
+ #
+ # NList
+ #
+ AllValidFlag = True
+ ValueList = PcdValue.split(',')
+ for ValueItem in ValueList:
+ if not ReIsValidByteHex.match(ValueItem.strip()):
+ AllValidFlag = False
+
+ if AllValidFlag:
+ return True
+
+ return False
+
+## IsValidCVariableName
+#
+# Check whether the PcdValue is valid.
+#
+# @param VersionString: The PcdValue need to be checked.
+#
+def IsValidCVariableName(CName):
+ ReIsValidCName = re.compile(r"^[A-Za-z_][0-9A-Za-z_]*$", re.DOTALL)
+ if ReIsValidCName.match(CName) is None:
+ return False
+
+ return True
+
+## IsValidIdentifier
+#
+# <Identifier> ::= <NonDigit> <Chars>{0,}
+# <Chars> ::= (a-zA-Z0-9_)
+# <NonDigit> ::= (a-zA-Z_)
+#
+# @param Ident: identifier to be checked
+#
+def IsValidIdentifier(Ident):
+ ReIdent = re.compile(r"^[A-Za-z_][0-9A-Za-z_]*$", re.DOTALL)
+ if ReIdent.match(Ident) is None:
+ return False
+
+ return True
+
+## IsValidDecVersionVal
+#
+# {(0-9){1,} "." (0-99)}
+#
+# @param Ver: version to be checked
+#
+def IsValidDecVersionVal(Ver):
+ ReVersion = re.compile(r"[0-9]+(\.[0-9]{1,2})$")
+
+ if ReVersion.match(Ver) is None:
+ return False
+
+ return True
+
+
+## IsValidLibName
+#
+# (A-Z)(a-zA-Z0-9){0,} and could not be "NULL"
+#
+def IsValidLibName(LibName):
+ if LibName == 'NULL':
+ return False
+ ReLibName = re.compile("^[A-Z]+[a-zA-Z0-9]*$")
+ if not ReLibName.match(LibName):
+ return False
+
+ return True
+
+# IsValidUserId
+#
+# <UserId> ::= (a-zA-Z)(a-zA-Z0-9_.){0,}
+# Words that contain period "." must be encapsulated in double quotation marks.
+#
+def IsValidUserId(UserId):
+ UserId = UserId.strip()
+ Quoted = False
+ if UserId.startswith('"') and UserId.endswith('"'):
+ Quoted = True
+ UserId = UserId[1:-1]
+ if not UserId or not UserId[0].isalpha():
+ return False
+ for Char in UserId[1:]:
+ if not Char.isalnum() and not Char in '_.':
+ return False
+ if Char == '.' and not Quoted:
+ return False
+ return True
+
+#
+# Check if a UTF16-LE file has a BOM header
+#
+def CheckUTF16FileHeader(File):
+ FileIn = open(File, 'rb').read(2)
+ if FileIn != b'\xff\xfe':
+ return False
+
+ return True
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Library/Parsing.py b/roms/edk2/BaseTools/Source/Python/UPT/Library/Parsing.py
new file mode 100644
index 000000000..6fb133745
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Library/Parsing.py
@@ -0,0 +1,1015 @@
+## @file
+# This file is used to define common parsing related functions used in parsing
+# INF/DEC/DSC process
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Parsing
+'''
+from __future__ import absolute_import
+
+##
+# Import Modules
+#
+import os.path
+import re
+
+from Library.StringUtils import RaiseParserError
+from Library.StringUtils import GetSplitValueList
+from Library.StringUtils import CheckFileType
+from Library.StringUtils import CheckFileExist
+from Library.StringUtils import CleanString
+from Library.StringUtils import NormPath
+
+from Logger.ToolError import FILE_NOT_FOUND
+from Logger.ToolError import FatalError
+from Logger.ToolError import FORMAT_INVALID
+
+from Library import DataType
+
+from Library.Misc import GuidStructureStringToGuidString
+from Library.Misc import CheckGuidRegFormat
+from Logger import StringTable as ST
+import Logger.Log as Logger
+
+from Parser.DecParser import Dec
+from . import GlobalData
+
+gPKG_INFO_DICT = {}
+
+## GetBuildOption
+#
+# Parse a string with format "[<Family>:]<ToolFlag>=Flag"
+# Return (Family, ToolFlag, Flag)
+#
+# @param String: String with BuildOption statement
+# @param File: The file which defines build option, used in error report
+#
+def GetBuildOption(String, File, LineNo= -1):
+ (Family, ToolChain, Flag) = ('', '', '')
+ if String.find(DataType.TAB_EQUAL_SPLIT) < 0:
+ RaiseParserError(String, 'BuildOptions', File, \
+ '[<Family>:]<ToolFlag>=Flag', LineNo)
+ else:
+ List = GetSplitValueList(String, DataType.TAB_EQUAL_SPLIT, MaxSplit=1)
+ if List[0].find(':') > -1:
+ Family = List[0][ : List[0].find(':')].strip()
+ ToolChain = List[0][List[0].find(':') + 1 : ].strip()
+ else:
+ ToolChain = List[0].strip()
+ Flag = List[1].strip()
+ return (Family, ToolChain, Flag)
+
+## Get Library Class
+#
+# Get Library of Dsc as <LibraryClassKeyWord>|<LibraryInstance>
+#
+# @param Item: String as <LibraryClassKeyWord>|<LibraryInstance>
+# @param ContainerFile: The file which describes the library class, used for
+# error report
+#
+def GetLibraryClass(Item, ContainerFile, WorkspaceDir, LineNo= -1):
+ List = GetSplitValueList(Item[0])
+ SupMod = DataType.SUP_MODULE_LIST_STRING
+ if len(List) != 2:
+ RaiseParserError(Item[0], 'LibraryClasses', ContainerFile, \
+ '<LibraryClassKeyWord>|<LibraryInstance>')
+ else:
+ CheckFileType(List[1], '.Inf', ContainerFile, \
+ 'library class instance', Item[0], LineNo)
+ CheckFileExist(WorkspaceDir, List[1], ContainerFile, \
+ 'LibraryClasses', Item[0], LineNo)
+ if Item[1] != '':
+ SupMod = Item[1]
+
+ return (List[0], List[1], SupMod)
+
+## Get Library Class
+#
+# Get Library of Dsc as <LibraryClassKeyWord>[|<LibraryInstance>]
+# [|<TokenSpaceGuidCName>.<PcdCName>]
+#
+# @param Item: String as <LibraryClassKeyWord>|<LibraryInstance>
+# @param ContainerFile: The file which describes the library class, used for
+# error report
+#
+def GetLibraryClassOfInf(Item, ContainerFile, WorkspaceDir, LineNo= -1):
+ ItemList = GetSplitValueList((Item[0] + DataType.TAB_VALUE_SPLIT * 2))
+ SupMod = DataType.SUP_MODULE_LIST_STRING
+
+ if len(ItemList) > 5:
+ RaiseParserError\
+ (Item[0], 'LibraryClasses', ContainerFile, \
+ '<LibraryClassKeyWord>[|<LibraryInstance>]\
+ [|<TokenSpaceGuidCName>.<PcdCName>]')
+ else:
+ CheckFileType(ItemList[1], '.Inf', ContainerFile, 'LibraryClasses', \
+ Item[0], LineNo)
+ CheckFileExist(WorkspaceDir, ItemList[1], ContainerFile, \
+ 'LibraryClasses', Item[0], LineNo)
+ if ItemList[2] != '':
+ CheckPcdTokenInfo(ItemList[2], 'LibraryClasses', \
+ ContainerFile, LineNo)
+ if Item[1] != '':
+ SupMod = Item[1]
+
+ return (ItemList[0], ItemList[1], ItemList[2], SupMod)
+
+## CheckPcdTokenInfo
+#
+# Check if PcdTokenInfo is following <TokenSpaceGuidCName>.<PcdCName>
+#
+# @param TokenInfoString: String to be checked
+# @param Section: Used for error report
+# @param File: Used for error report
+#
+def CheckPcdTokenInfo(TokenInfoString, Section, File, LineNo= -1):
+ Format = '<TokenSpaceGuidCName>.<PcdCName>'
+ if TokenInfoString != '' and TokenInfoString is not None:
+ TokenInfoList = GetSplitValueList(TokenInfoString, DataType.TAB_SPLIT)
+ if len(TokenInfoList) == 2:
+ return True
+
+ RaiseParserError(TokenInfoString, Section, File, Format, LineNo)
+
+## Get Pcd
+#
+# Get Pcd of Dsc as <PcdTokenSpaceGuidCName>.<TokenCName>|<Value>
+# [|<Type>|<MaximumDatumSize>]
+#
+# @param Item: String as <PcdTokenSpaceGuidCName>.<TokenCName>|
+# <Value>[|<Type>|<MaximumDatumSize>]
+# @param ContainerFile: The file which describes the pcd, used for error
+# report
+
+#
+def GetPcd(Item, Type, ContainerFile, LineNo= -1):
+ TokenGuid, TokenName, Value, MaximumDatumSize, Token = '', '', '', '', ''
+ List = GetSplitValueList(Item + DataType.TAB_VALUE_SPLIT * 2)
+
+ if len(List) < 4 or len(List) > 6:
+ RaiseParserError(Item, 'Pcds' + Type, ContainerFile, \
+ '<PcdTokenSpaceGuidCName>.<TokenCName>|<Value>\
+ [|<Type>|<MaximumDatumSize>]', LineNo)
+ else:
+ Value = List[1]
+ MaximumDatumSize = List[2]
+ Token = List[3]
+
+ if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo):
+ (TokenGuid, TokenName) = GetSplitValueList(List[0], DataType.TAB_SPLIT)
+
+ return (TokenName, TokenGuid, Value, MaximumDatumSize, Token, Type)
+
+## Get FeatureFlagPcd
+#
+# Get FeatureFlagPcd of Dsc as <PcdTokenSpaceGuidCName>.<TokenCName>|TRUE/FALSE
+#
+# @param Item: String as <PcdTokenSpaceGuidCName>
+# .<TokenCName>|TRUE/FALSE
+# @param ContainerFile: The file which describes the pcd, used for error
+# report
+#
+def GetFeatureFlagPcd(Item, Type, ContainerFile, LineNo= -1):
+ TokenGuid, TokenName, Value = '', '', ''
+ List = GetSplitValueList(Item)
+ if len(List) != 2:
+ RaiseParserError(Item, 'Pcds' + Type, ContainerFile, \
+ '<PcdTokenSpaceGuidCName>.<TokenCName>|TRUE/FALSE', \
+ LineNo)
+ else:
+ Value = List[1]
+ if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo):
+ (TokenGuid, TokenName) = GetSplitValueList(List[0], DataType.TAB_SPLIT)
+
+ return (TokenName, TokenGuid, Value, Type)
+
+## Get DynamicDefaultPcd
+#
+# Get DynamicDefaultPcd of Dsc as <PcdTokenSpaceGuidCName>.<TokenCName>
+# |<Value>[|<DatumTyp>[|<MaxDatumSize>]]
+#
+# @param Item: String as <PcdTokenSpaceGuidCName>.<TokenCName>|
+# TRUE/FALSE
+# @param ContainerFile: The file which describes the pcd, used for error
+# report
+#
+def GetDynamicDefaultPcd(Item, Type, ContainerFile, LineNo= -1):
+ TokenGuid, TokenName, Value, DatumTyp, MaxDatumSize = '', '', '', '', ''
+ List = GetSplitValueList(Item + DataType.TAB_VALUE_SPLIT * 2)
+ if len(List) < 4 or len(List) > 8:
+ RaiseParserError(Item, 'Pcds' + Type, ContainerFile, \
+ '<PcdTokenSpaceGuidCName>.<TokenCName>|<Value>\
+ [|<DatumTyp>[|<MaxDatumSize>]]', LineNo)
+ else:
+ Value = List[1]
+ DatumTyp = List[2]
+ MaxDatumSize = List[3]
+ if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo):
+ (TokenGuid, TokenName) = GetSplitValueList(List[0], DataType.TAB_SPLIT)
+
+ return (TokenName, TokenGuid, Value, DatumTyp, MaxDatumSize, Type)
+
+## Get DynamicHiiPcd
+#
+# Get DynamicHiiPcd of Dsc as <PcdTokenSpaceGuidCName>.<TokenCName>|<String>|
+# <VariableGuidCName>|<VariableOffset>[|<DefaultValue>[|<MaximumDatumSize>]]
+#
+# @param Item: String as <PcdTokenSpaceGuidCName>.<TokenCName>|
+# TRUE/FALSE
+# @param ContainerFile: The file which describes the pcd, used for error
+# report
+#
+def GetDynamicHiiPcd(Item, Type, ContainerFile, LineNo= -1):
+ TokenGuid, TokenName, List1, List2, List3, List4, List5 = \
+ '', '', '', '', '', '', ''
+ List = GetSplitValueList(Item + DataType.TAB_VALUE_SPLIT * 2)
+ if len(List) < 6 or len(List) > 8:
+ RaiseParserError(Item, 'Pcds' + Type, ContainerFile, \
+ '<PcdTokenSpaceGuidCName>.<TokenCName>|<String>|\
+ <VariableGuidCName>|<VariableOffset>[|<DefaultValue>\
+ [|<MaximumDatumSize>]]', LineNo)
+ else:
+ List1, List2, List3, List4, List5 = \
+ List[1], List[2], List[3], List[4], List[5]
+ if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo):
+ (TokenGuid, TokenName) = GetSplitValueList(List[0], DataType.TAB_SPLIT)
+
+ return (TokenName, TokenGuid, List1, List2, List3, List4, List5, Type)
+
+## Get DynamicVpdPcd
+#
+# Get DynamicVpdPcd of Dsc as <PcdTokenSpaceGuidCName>.<TokenCName>|
+# <VpdOffset>[|<MaximumDatumSize>]
+#
+# @param Item: String as <PcdTokenSpaceGuidCName>.<TokenCName>
+# |TRUE/FALSE
+# @param ContainerFile: The file which describes the pcd, used for error
+# report
+#
+def GetDynamicVpdPcd(Item, Type, ContainerFile, LineNo= -1):
+ TokenGuid, TokenName, List1, List2 = '', '', '', ''
+ List = GetSplitValueList(Item + DataType.TAB_VALUE_SPLIT)
+ if len(List) < 3 or len(List) > 4:
+ RaiseParserError(Item, 'Pcds' + Type, ContainerFile, \
+ '<PcdTokenSpaceGuidCName>.<TokenCName>|<VpdOffset>\
+ [|<MaximumDatumSize>]', LineNo)
+ else:
+ List1, List2 = List[1], List[2]
+ if CheckPcdTokenInfo(List[0], 'Pcds' + Type, ContainerFile, LineNo):
+ (TokenGuid, TokenName) = GetSplitValueList(List[0], DataType.TAB_SPLIT)
+
+ return (TokenName, TokenGuid, List1, List2, Type)
+
+## GetComponent
+#
+# Parse block of the components defined in dsc file
+# Set KeyValues as [ ['component name', [lib1, lib2, lib3],
+# [bo1, bo2, bo3], [pcd1, pcd2, pcd3]], ...]
+#
+# @param Lines: The content to be parsed
+# @param KeyValues: To store data after parsing
+#
+def GetComponent(Lines, KeyValues):
+ (FindBlock, FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, FindPcdsDynamic, \
+ FindPcdsDynamicEx) = (False, False, False, False, False, False, False, \
+ False)
+ ListItem = None
+ LibraryClassItem = []
+ BuildOption = []
+ Pcd = []
+
+ for Line in Lines:
+ Line = Line[0]
+ #
+ # Ignore !include statement
+ #
+ if Line.upper().find(DataType.TAB_INCLUDE.upper() + ' ') > -1 or \
+ Line.upper().find(DataType.TAB_DEFINE + ' ') > -1:
+ continue
+
+ if FindBlock == False:
+ ListItem = Line
+ #
+ # find '{' at line tail
+ #
+ if Line.endswith('{'):
+ FindBlock = True
+ ListItem = CleanString(Line.rsplit('{', 1)[0], \
+ DataType.TAB_COMMENT_SPLIT)
+
+ #
+ # Parse a block content
+ #
+ if FindBlock:
+ if Line.find('<LibraryClasses>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (True, False, False, False, False, False, False)
+ continue
+ if Line.find('<BuildOptions>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, True, False, False, False, False, False)
+ continue
+ if Line.find('<PcdsFeatureFlag>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, False, True, False, False, False, False)
+ continue
+ if Line.find('<PcdsPatchableInModule>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, False, False, True, False, False, False)
+ continue
+ if Line.find('<PcdsFixedAtBuild>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, False, False, False, True, False, False)
+ continue
+ if Line.find('<PcdsDynamic>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, False, False, False, False, True, False)
+ continue
+ if Line.find('<PcdsDynamicEx>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, False, False, False, False, False, True)
+ continue
+ if Line.endswith('}'):
+ #
+ # find '}' at line tail
+ #
+ KeyValues.append([ListItem, LibraryClassItem, \
+ BuildOption, Pcd])
+ (FindBlock, FindLibraryClass, FindBuildOption, \
+ FindPcdsFeatureFlag, FindPcdsPatchableInModule, \
+ FindPcdsFixedAtBuild, FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, False, False, False, False, False, False, False)
+ LibraryClassItem, BuildOption, Pcd = [], [], []
+ continue
+
+ if FindBlock:
+ if FindLibraryClass:
+ LibraryClassItem.append(Line)
+ elif FindBuildOption:
+ BuildOption.append(Line)
+ elif FindPcdsFeatureFlag:
+ Pcd.append((DataType.TAB_PCDS_FEATURE_FLAG_NULL, Line))
+ elif FindPcdsPatchableInModule:
+ Pcd.append((DataType.TAB_PCDS_PATCHABLE_IN_MODULE_NULL, Line))
+ elif FindPcdsFixedAtBuild:
+ Pcd.append((DataType.TAB_PCDS_FIXED_AT_BUILD_NULL, Line))
+ elif FindPcdsDynamic:
+ Pcd.append((DataType.TAB_PCDS_DYNAMIC_DEFAULT_NULL, Line))
+ elif FindPcdsDynamicEx:
+ Pcd.append((DataType.TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL, Line))
+ else:
+ KeyValues.append([ListItem, [], [], []])
+
+ return True
+
+## GetExec
+#
+# Parse a string with format "InfFilename [EXEC = ExecFilename]"
+# Return (InfFilename, ExecFilename)
+#
+# @param String: String with EXEC statement
+#
+def GetExec(String):
+ InfFilename = ''
+ ExecFilename = ''
+ if String.find('EXEC') > -1:
+ InfFilename = String[ : String.find('EXEC')].strip()
+ ExecFilename = String[String.find('EXEC') + len('EXEC') : ].strip()
+ else:
+ InfFilename = String.strip()
+
+ return (InfFilename, ExecFilename)
+
+## GetComponents
+#
+# Parse block of the components defined in dsc file
+# Set KeyValues as [ ['component name', [lib1, lib2, lib3], [bo1, bo2, bo3],
+# [pcd1, pcd2, pcd3]], ...]
+#
+# @param Lines: The content to be parsed
+# @param Key: Reserved
+# @param KeyValues: To store data after parsing
+# @param CommentCharacter: Comment char, used to ignore comment content
+#
+# @retval True Get component successfully
+#
+def GetComponents(Lines, KeyValues, CommentCharacter):
+ if Lines.find(DataType.TAB_SECTION_END) > -1:
+ Lines = Lines.split(DataType.TAB_SECTION_END, 1)[1]
+ (FindBlock, FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, FindPcdsDynamic, \
+ FindPcdsDynamicEx) = \
+ (False, False, False, False, False, False, False, False)
+ ListItem = None
+ LibraryClassItem = []
+ BuildOption = []
+ Pcd = []
+
+ LineList = Lines.split('\n')
+ for Line in LineList:
+ Line = CleanString(Line, CommentCharacter)
+ if Line is None or Line == '':
+ continue
+
+ if FindBlock == False:
+ ListItem = Line
+ #
+ # find '{' at line tail
+ #
+ if Line.endswith('{'):
+ FindBlock = True
+ ListItem = CleanString(Line.rsplit('{', 1)[0], CommentCharacter)
+
+ #
+ # Parse a block content
+ #
+ if FindBlock:
+ if Line.find('<LibraryClasses>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (True, False, False, False, False, False, False)
+ continue
+ if Line.find('<BuildOptions>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, True, False, False, False, False, False)
+ continue
+ if Line.find('<PcdsFeatureFlag>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, False, True, False, False, False, False)
+ continue
+ if Line.find('<PcdsPatchableInModule>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, False, False, True, False, False, False)
+ continue
+ if Line.find('<PcdsFixedAtBuild>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, False, False, False, True, False, False)
+ continue
+ if Line.find('<PcdsDynamic>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, False, False, False, False, True, False)
+ continue
+ if Line.find('<PcdsDynamicEx>') != -1:
+ (FindLibraryClass, FindBuildOption, FindPcdsFeatureFlag, \
+ FindPcdsPatchableInModule, FindPcdsFixedAtBuild, \
+ FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, False, False, False, False, False, True)
+ continue
+ if Line.endswith('}'):
+ #
+ # find '}' at line tail
+ #
+ KeyValues.append([ListItem, LibraryClassItem, BuildOption, \
+ Pcd])
+ (FindBlock, FindLibraryClass, FindBuildOption, \
+ FindPcdsFeatureFlag, FindPcdsPatchableInModule, \
+ FindPcdsFixedAtBuild, FindPcdsDynamic, FindPcdsDynamicEx) = \
+ (False, False, False, False, False, False, False, False)
+ LibraryClassItem, BuildOption, Pcd = [], [], []
+ continue
+
+ if FindBlock:
+ if FindLibraryClass:
+ LibraryClassItem.append(Line)
+ elif FindBuildOption:
+ BuildOption.append(Line)
+ elif FindPcdsFeatureFlag:
+ Pcd.append((DataType.TAB_PCDS_FEATURE_FLAG, Line))
+ elif FindPcdsPatchableInModule:
+ Pcd.append((DataType.TAB_PCDS_PATCHABLE_IN_MODULE, Line))
+ elif FindPcdsFixedAtBuild:
+ Pcd.append((DataType.TAB_PCDS_FIXED_AT_BUILD, Line))
+ elif FindPcdsDynamic:
+ Pcd.append((DataType.TAB_PCDS_DYNAMIC, Line))
+ elif FindPcdsDynamicEx:
+ Pcd.append((DataType.TAB_PCDS_DYNAMIC_EX, Line))
+ else:
+ KeyValues.append([ListItem, [], [], []])
+
+ return True
+
+## Get Source
+#
+# Get Source of Inf as <Filename>[|<Family>[|<TagName>[|<ToolCode>
+# [|<PcdFeatureFlag>]]]]
+#
+# @param Item: String as <Filename>[|<Family>[|<TagName>[|<ToolCode>
+# [|<PcdFeatureFlag>]]]]
+# @param ContainerFile: The file which describes the library class, used
+# for error report
+#
+def GetSource(Item, ContainerFile, FileRelativePath, LineNo= -1):
+ ItemNew = Item + DataType.TAB_VALUE_SPLIT * 4
+ List = GetSplitValueList(ItemNew)
+ if len(List) < 5 or len(List) > 9:
+ RaiseParserError(Item, 'Sources', ContainerFile, \
+ '<Filename>[|<Family>[|<TagName>[|<ToolCode>\
+ [|<PcdFeatureFlag>]]]]', LineNo)
+ List[0] = NormPath(List[0])
+ CheckFileExist(FileRelativePath, List[0], ContainerFile, 'Sources', \
+ Item, LineNo)
+ if List[4] != '':
+ CheckPcdTokenInfo(List[4], 'Sources', ContainerFile, LineNo)
+
+ return (List[0], List[1], List[2], List[3], List[4])
+
+## Get Binary
+#
+# Get Binary of Inf as <Filename>[|<Family>[|<TagName>[|<ToolCode>
+# [|<PcdFeatureFlag>]]]]
+#
+# @param Item: String as <Filename>[|<Family>[|<TagName>
+# [|<ToolCode>[|<PcdFeatureFlag>]]]]
+# @param ContainerFile: The file which describes the library class,
+# used for error report
+#
+def GetBinary(Item, ContainerFile, LineNo= -1):
+ ItemNew = Item + DataType.TAB_VALUE_SPLIT
+ List = GetSplitValueList(ItemNew)
+ if len(List) < 3 or len(List) > 5:
+ RaiseParserError(Item, 'Binaries', ContainerFile, \
+ "<FileType>|<Filename>[|<Target>\
+ [|<TokenSpaceGuidCName>.<PcdCName>]]", LineNo)
+
+ if len(List) >= 4:
+ if List[3] != '':
+ CheckPcdTokenInfo(List[3], 'Binaries', ContainerFile, LineNo)
+ return (List[0], List[1], List[2], List[3])
+ elif len(List) == 3:
+ return (List[0], List[1], List[2], '')
+
+## Get Guids/Protocols/Ppis
+#
+# Get Guids/Protocols/Ppis of Inf as <GuidCName>[|<PcdFeatureFlag>]
+#
+# @param Item: String as <GuidCName>[|<PcdFeatureFlag>]
+# @param Type: Type of parsing string
+# @param ContainerFile: The file which describes the library class,
+# used for error report
+#
+def GetGuidsProtocolsPpisOfInf(Item):
+ ItemNew = Item + DataType.TAB_VALUE_SPLIT
+ List = GetSplitValueList(ItemNew)
+ return (List[0], List[1])
+
+## Get Guids/Protocols/Ppis
+#
+# Get Guids/Protocols/Ppis of Dec as <GuidCName>=<GuidValue>
+#
+# @param Item: String as <GuidCName>=<GuidValue>
+# @param Type: Type of parsing string
+# @param ContainerFile: The file which describes the library class,
+# used for error report
+#
+def GetGuidsProtocolsPpisOfDec(Item, Type, ContainerFile, LineNo= -1):
+ List = GetSplitValueList(Item, DataType.TAB_EQUAL_SPLIT)
+ if len(List) != 2:
+ RaiseParserError(Item, Type, ContainerFile, '<CName>=<GuidValue>', \
+ LineNo)
+ #
+ #convert C-Format Guid to Register Format
+ #
+ if List[1][0] == '{' and List[1][-1] == '}':
+ RegisterFormatGuid = GuidStructureStringToGuidString(List[1])
+ if RegisterFormatGuid == '':
+ RaiseParserError(Item, Type, ContainerFile, \
+ 'CFormat or RegisterFormat', LineNo)
+ else:
+ if CheckGuidRegFormat(List[1]):
+ RegisterFormatGuid = List[1]
+ else:
+ RaiseParserError(Item, Type, ContainerFile, \
+ 'CFormat or RegisterFormat', LineNo)
+
+ return (List[0], RegisterFormatGuid)
+
+## GetPackage
+#
+# Get Package of Inf as <PackagePath>[|<PcdFeatureFlag>]
+#
+# @param Item: String as <PackagePath>[|<PcdFeatureFlag>]
+# @param Type: Type of parsing string
+# @param ContainerFile: The file which describes the library class,
+# used for error report
+#
+def GetPackage(Item, ContainerFile, FileRelativePath, LineNo= -1):
+ ItemNew = Item + DataType.TAB_VALUE_SPLIT
+ List = GetSplitValueList(ItemNew)
+ CheckFileType(List[0], '.Dec', ContainerFile, 'package', List[0], LineNo)
+ CheckFileExist(FileRelativePath, List[0], ContainerFile, 'Packages', \
+ List[0], LineNo)
+ if List[1] != '':
+ CheckPcdTokenInfo(List[1], 'Packages', ContainerFile, LineNo)
+
+ return (List[0], List[1])
+
+## Get Pcd Values of Inf
+#
+# Get Pcd of Inf as <TokenSpaceGuidCName>.<PcdCName>[|<Value>]
+#
+# @param Item: The string describes pcd
+# @param Type: The type of Pcd
+# @param File: The file which describes the pcd, used for error report
+#
+def GetPcdOfInf(Item, Type, File, LineNo):
+ Format = '<TokenSpaceGuidCName>.<PcdCName>[|<Value>]'
+ TokenGuid, TokenName, Value, InfType = '', '', '', ''
+
+ if Type == DataType.TAB_PCDS_FIXED_AT_BUILD:
+ InfType = DataType.TAB_INF_FIXED_PCD
+ elif Type == DataType.TAB_PCDS_PATCHABLE_IN_MODULE:
+ InfType = DataType.TAB_INF_PATCH_PCD
+ elif Type == DataType.TAB_PCDS_FEATURE_FLAG:
+ InfType = DataType.TAB_INF_FEATURE_PCD
+ elif Type == DataType.TAB_PCDS_DYNAMIC_EX:
+ InfType = DataType.TAB_INF_PCD_EX
+ elif Type == DataType.TAB_PCDS_DYNAMIC:
+ InfType = DataType.TAB_INF_PCD
+ List = GetSplitValueList(Item, DataType.TAB_VALUE_SPLIT, 1)
+ TokenInfo = GetSplitValueList(List[0], DataType.TAB_SPLIT)
+ if len(TokenInfo) != 2:
+ RaiseParserError(Item, InfType, File, Format, LineNo)
+ else:
+ TokenGuid = TokenInfo[0]
+ TokenName = TokenInfo[1]
+
+ if len(List) > 1:
+ Value = List[1]
+ else:
+ Value = None
+ return (TokenGuid, TokenName, Value, InfType)
+
+
+## Get Pcd Values of Dec
+#
+# Get Pcd of Dec as <TokenSpcCName>.<TokenCName>|<Value>|<DatumType>|<Token>
+# @param Item: Pcd item
+# @param Type: Pcd type
+# @param File: Dec file
+# @param LineNo: Line number
+#
+def GetPcdOfDec(Item, Type, File, LineNo= -1):
+ Format = '<TokenSpaceGuidCName>.<PcdCName>|<Value>|<DatumType>|<Token>'
+ TokenGuid, TokenName, Value, DatumType, Token = '', '', '', '', ''
+ List = GetSplitValueList(Item)
+ if len(List) != 4:
+ RaiseParserError(Item, 'Pcds' + Type, File, Format, LineNo)
+ else:
+ Value = List[1]
+ DatumType = List[2]
+ Token = List[3]
+ TokenInfo = GetSplitValueList(List[0], DataType.TAB_SPLIT)
+ if len(TokenInfo) != 2:
+ RaiseParserError(Item, 'Pcds' + Type, File, Format, LineNo)
+ else:
+ TokenGuid = TokenInfo[0]
+ TokenName = TokenInfo[1]
+
+ return (TokenGuid, TokenName, Value, DatumType, Token, Type)
+
+## Parse DEFINE statement
+#
+# Get DEFINE macros
+#
+# @param LineValue: A DEFINE line value
+# @param StartLine: A DEFINE start line
+# @param Table: A table
+# @param FileID: File ID
+# @param Filename: File name
+# @param SectionName: DEFINE section name
+# @param SectionModel: DEFINE section model
+# @param Arch: DEFINE arch
+#
+def ParseDefine(LineValue, StartLine, Table, FileID, SectionName, \
+ SectionModel, Arch):
+ Logger.Debug(Logger.DEBUG_2, ST.MSG_DEFINE_STATEMENT_FOUND % (LineValue, \
+ SectionName))
+ Define = \
+ GetSplitValueList(CleanString\
+ (LineValue[LineValue.upper().\
+ find(DataType.TAB_DEFINE.upper() + ' ') + \
+ len(DataType.TAB_DEFINE + ' ') : ]), \
+ DataType.TAB_EQUAL_SPLIT, 1)
+ Table.Insert(DataType.MODEL_META_DATA_DEFINE, Define[0], Define[1], '', \
+ '', '', Arch, SectionModel, FileID, StartLine, -1, \
+ StartLine, -1, 0)
+
+## InsertSectionItems
+#
+# Insert item data of a section to a dict
+#
+# @param Model: A model
+# @param CurrentSection: Current section
+# @param SectionItemList: Section item list
+# @param ArchList: Arch list
+# @param ThirdList: Third list
+# @param RecordSet: Record set
+#
+def InsertSectionItems(Model, SectionItemList, ArchList, \
+ ThirdList, RecordSet):
+ #
+ # Insert each item data of a section
+ #
+ for Index in range(0, len(ArchList)):
+ Arch = ArchList[Index]
+ Third = ThirdList[Index]
+ if Arch == '':
+ Arch = DataType.TAB_ARCH_COMMON
+
+ Records = RecordSet[Model]
+ for SectionItem in SectionItemList:
+ LineValue, StartLine, Comment = SectionItem[0], \
+ SectionItem[1], SectionItem[2]
+
+ Logger.Debug(4, ST.MSG_PARSING % LineValue)
+ #
+ # And then parse DEFINE statement
+ #
+ if LineValue.upper().find(DataType.TAB_DEFINE.upper() + ' ') > -1:
+ continue
+ #
+ # At last parse other sections
+ #
+ IdNum = -1
+ Records.append([LineValue, Arch, StartLine, IdNum, Third, Comment])
+
+ if RecordSet != {}:
+ RecordSet[Model] = Records
+
+## GenMetaDatSectionItem
+#
+# @param Key: A key
+# @param Value: A value
+# @param List: A list
+#
+def GenMetaDatSectionItem(Key, Value, List):
+ if Key not in List:
+ List[Key] = [Value]
+ else:
+ List[Key].append(Value)
+
+## GetPkgInfoFromDec
+#
+# get package name, guid, version info from dec files
+#
+# @param Path: File path
+#
+def GetPkgInfoFromDec(Path):
+ PkgName = None
+ PkgGuid = None
+ PkgVersion = None
+
+ Path = Path.replace('\\', '/')
+
+ if not os.path.exists(Path):
+ Logger.Error("\nUPT", FILE_NOT_FOUND, File=Path)
+
+ if Path in gPKG_INFO_DICT:
+ return gPKG_INFO_DICT[Path]
+
+ try:
+ DecParser = None
+ if Path not in GlobalData.gPackageDict:
+ DecParser = Dec(Path)
+ GlobalData.gPackageDict[Path] = DecParser
+ else:
+ DecParser = GlobalData.gPackageDict[Path]
+
+ PkgName = DecParser.GetPackageName()
+ PkgGuid = DecParser.GetPackageGuid()
+ PkgVersion = DecParser.GetPackageVersion()
+ gPKG_INFO_DICT[Path] = (PkgName, PkgGuid, PkgVersion)
+ return PkgName, PkgGuid, PkgVersion
+ except FatalError:
+ return None, None, None
+
+
+## GetWorkspacePackage
+#
+# Get a list of workspace package information.
+#
+def GetWorkspacePackage():
+ DecFileList = []
+ WorkspaceDir = GlobalData.gWORKSPACE
+ PackageDir = GlobalData.gPACKAGE_PATH
+ for PkgRoot in [WorkspaceDir] + PackageDir:
+ for Root, Dirs, Files in os.walk(PkgRoot):
+ if 'CVS' in Dirs:
+ Dirs.remove('CVS')
+ if '.svn' in Dirs:
+ Dirs.remove('.svn')
+ for Dir in Dirs:
+ if Dir.startswith('.'):
+ Dirs.remove(Dir)
+ for FileSp in Files:
+ if FileSp.startswith('.'):
+ continue
+ Ext = os.path.splitext(FileSp)[1]
+ if Ext.lower() in ['.dec']:
+ DecFileList.append\
+ (os.path.normpath(os.path.join(Root, FileSp)))
+ #
+ # abstract package guid, version info from DecFile List
+ #
+ PkgList = []
+ for DecFile in DecFileList:
+ (PkgName, PkgGuid, PkgVersion) = GetPkgInfoFromDec(DecFile)
+ if PkgName and PkgGuid and PkgVersion:
+ PkgList.append((PkgName, PkgGuid, PkgVersion, DecFile))
+
+ return PkgList
+
+## GetWorkspaceModule
+#
+# Get a list of workspace modules.
+#
+def GetWorkspaceModule():
+ InfFileList = []
+ WorkspaceDir = GlobalData.gWORKSPACE
+ for Root, Dirs, Files in os.walk(WorkspaceDir):
+ if 'CVS' in Dirs:
+ Dirs.remove('CVS')
+ if '.svn' in Dirs:
+ Dirs.remove('.svn')
+ if 'Build' in Dirs:
+ Dirs.remove('Build')
+ for Dir in Dirs:
+ if Dir.startswith('.'):
+ Dirs.remove(Dir)
+ for FileSp in Files:
+ if FileSp.startswith('.'):
+ continue
+ Ext = os.path.splitext(FileSp)[1]
+ if Ext.lower() in ['.inf']:
+ InfFileList.append\
+ (os.path.normpath(os.path.join(Root, FileSp)))
+
+ return InfFileList
+
+## MacroParser used to parse macro definition
+#
+# @param Line: The content contain linestring and line number
+# @param FileName: The meta-file file name
+# @param SectionType: Section for the Line belong to
+# @param FileLocalMacros: A list contain Macro defined in [Defines] section.
+#
+def MacroParser(Line, FileName, SectionType, FileLocalMacros):
+ MacroDefPattern = re.compile("^(DEFINE)[ \t]+")
+ LineContent = Line[0]
+ LineNo = Line[1]
+ Match = MacroDefPattern.match(LineContent)
+ if not Match:
+ #
+ # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method
+ #
+ return None, None
+
+ TokenList = GetSplitValueList(LineContent[Match.end(1):], \
+ DataType.TAB_EQUAL_SPLIT, 1)
+ #
+ # Syntax check
+ #
+ if not TokenList[0]:
+ Logger.Error('Parser', FORMAT_INVALID, ST.ERR_MACRONAME_NOGIVEN,
+ ExtraData=LineContent, File=FileName, Line=LineNo)
+ if len(TokenList) < 2:
+ Logger.Error('Parser', FORMAT_INVALID, ST.ERR_MACROVALUE_NOGIVEN,
+ ExtraData=LineContent, File=FileName, Line=LineNo)
+
+ Name, Value = TokenList
+
+ #
+ # DEFINE defined macros
+ #
+ if SectionType == DataType.MODEL_META_DATA_HEADER:
+ FileLocalMacros[Name] = Value
+
+ ReIsValidMacroName = re.compile(r"^[A-Z][A-Z0-9_]*$", re.DOTALL)
+ if ReIsValidMacroName.match(Name) is None:
+ Logger.Error('Parser',
+ FORMAT_INVALID,
+ ST.ERR_MACRONAME_INVALID % (Name),
+ ExtraData=LineContent,
+ File=FileName,
+ Line=LineNo)
+
+ # Validate MACRO Value
+ #
+ # <MacroDefinition> ::= [<Comments>]{0,}
+ # "DEFINE" <MACRO> "=" [{<PATH>} {<VALUE>}] <EOL>
+ # <Value> ::= {<NumVal>} {<Boolean>} {<AsciiString>} {<GUID>}
+ # {<CString>} {<UnicodeString>} {<CArray>}
+ #
+ # The definition of <NumVal>, <PATH>, <Boolean>, <GUID>, <CString>,
+ # <UnicodeString>, <CArray> are subset of <AsciiString>.
+ #
+ ReIsValidMacroValue = re.compile(r"^[\x20-\x7e]*$", re.DOTALL)
+ if ReIsValidMacroValue.match(Value) is None:
+ Logger.Error('Parser',
+ FORMAT_INVALID,
+ ST.ERR_MACROVALUE_INVALID % (Value),
+ ExtraData=LineContent,
+ File=FileName,
+ Line=LineNo)
+
+ return Name, Value
+
+## GenSection
+#
+# generate section contents
+#
+# @param SectionName: indicate the name of the section, details refer to
+# INF, DEC specs
+# @param SectionDict: section statement dict, key is SectionAttrs(arch,
+# moduletype or platform may exist as needed) list
+# separated by space,
+# value is statement
+#
+def GenSection(SectionName, SectionDict, SplitArch=True, NeedBlankLine=False):
+ Content = ''
+ for SectionAttrs in SectionDict:
+ StatementList = SectionDict[SectionAttrs]
+ if SectionAttrs and SectionName != 'Defines' and SectionAttrs.strip().upper() != DataType.TAB_ARCH_COMMON:
+ if SplitArch:
+ ArchList = GetSplitValueList(SectionAttrs, DataType.TAB_SPACE_SPLIT)
+ else:
+ if SectionName != 'UserExtensions':
+ ArchList = GetSplitValueList(SectionAttrs, DataType.TAB_COMMENT_SPLIT)
+ else:
+ ArchList = [SectionAttrs]
+ for Index in range(0, len(ArchList)):
+ ArchList[Index] = ConvertArchForInstall(ArchList[Index])
+ Section = '[' + SectionName + '.' + (', ' + SectionName + '.').join(ArchList) + ']'
+ else:
+ Section = '[' + SectionName + ']'
+ Content += '\n' + Section + '\n'
+ if StatementList is not None:
+ for Statement in StatementList:
+ LineList = Statement.split('\n')
+ NewStatement = ""
+ for Line in LineList:
+ # ignore blank comment
+ if not Line.replace("#", '').strip() and SectionName not in ('Defines', 'Hob', 'Event', 'BootMode'):
+ continue
+ # add two space before non-comments line except the comments in Defines section
+ if Line.strip().startswith('#') and SectionName == 'Defines':
+ NewStatement += "%s\n" % Line
+ continue
+ NewStatement += " %s\n" % Line
+ if NeedBlankLine:
+ Content += NewStatement + '\n'
+ else:
+ Content += NewStatement
+
+ if NeedBlankLine:
+ Content = Content[:-1]
+ if not Content.replace('\\n', '').strip():
+ return ''
+ return Content
+
+## ConvertArchForInstall
+# if Arch.upper() is in "IA32", "X64", "IPF", and "EBC", it must be upper case. "common" must be lower case.
+# Anything else, the case must be preserved
+#
+# @param Arch: the arch string that need to be converted, it should be stripped before pass in
+# @return: the arch string that get converted
+#
+def ConvertArchForInstall(Arch):
+ if Arch.upper() in [DataType.TAB_ARCH_IA32, DataType.TAB_ARCH_X64,
+ DataType.TAB_ARCH_IPF, DataType.TAB_ARCH_EBC]:
+ Arch = Arch.upper()
+ elif Arch.upper() == DataType.TAB_ARCH_COMMON:
+ Arch = Arch.lower()
+
+ return Arch
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Library/StringUtils.py b/roms/edk2/BaseTools/Source/Python/UPT/Library/StringUtils.py
new file mode 100644
index 000000000..fbc5177ca
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Library/StringUtils.py
@@ -0,0 +1,982 @@
+## @file
+# This file is used to define common string related functions used in parsing
+# process
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+'''
+StringUtils
+'''
+##
+# Import Modules
+#
+import re
+import os.path
+import Logger.Log as Logger
+import Library.DataType as DataType
+from Logger.ToolError import FORMAT_INVALID
+from Logger.ToolError import PARSER_ERROR
+from Logger import StringTable as ST
+
+#
+# Regular expression for matching macro used in DSC/DEC/INF file inclusion
+#
+gMACRO_PATTERN = re.compile("\$\(([_A-Z][_A-Z0-9]*)\)", re.UNICODE)
+
+## GetSplitValueList
+#
+# Get a value list from a string with multiple values split with SplitTag
+# The default SplitTag is DataType.TAB_VALUE_SPLIT
+# 'AAA|BBB|CCC' -> ['AAA', 'BBB', 'CCC']
+#
+# @param String: The input string to be splitted
+# @param SplitTag: The split key, default is DataType.TAB_VALUE_SPLIT
+# @param MaxSplit: The max number of split values, default is -1
+#
+#
+def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
+ return list(map(lambda l: l.strip(), String.split(SplitTag, MaxSplit)))
+
+## MergeArches
+#
+# Find a key's all arches in dict, add the new arch to the list
+# If not exist any arch, set the arch directly
+#
+# @param Dict: The input value for Dict
+# @param Key: The input value for Key
+# @param Arch: The Arch to be added or merged
+#
+def MergeArches(Dict, Key, Arch):
+ if Key in Dict.keys():
+ Dict[Key].append(Arch)
+ else:
+ Dict[Key] = Arch.split()
+
+## GenDefines
+#
+# Parse a string with format "DEFINE <VarName> = <PATH>"
+# Generate a map Defines[VarName] = PATH
+# Return False if invalid format
+#
+# @param String: String with DEFINE statement
+# @param Arch: Supported Arch
+# @param Defines: DEFINE statement to be parsed
+#
+def GenDefines(String, Arch, Defines):
+ if String.find(DataType.TAB_DEFINE + ' ') > -1:
+ List = String.replace(DataType.TAB_DEFINE + ' ', '').\
+ split(DataType.TAB_EQUAL_SPLIT)
+ if len(List) == 2:
+ Defines[(CleanString(List[0]), Arch)] = CleanString(List[1])
+ return 0
+ else:
+ return -1
+ return 1
+
+## GetLibraryClassesWithModuleType
+#
+# Get Library Class definition when no module type defined
+#
+# @param Lines: The content to be parsed
+# @param Key: Reserved
+# @param KeyValues: To store data after parsing
+# @param CommentCharacter: Comment char, used to ignore comment content
+#
+def GetLibraryClassesWithModuleType(Lines, Key, KeyValues, CommentCharacter):
+ NewKey = SplitModuleType(Key)
+ Lines = Lines.split(DataType.TAB_SECTION_END, 1)[1]
+ LineList = Lines.splitlines()
+ for Line in LineList:
+ Line = CleanString(Line, CommentCharacter)
+ if Line != '' and Line[0] != CommentCharacter:
+ KeyValues.append([CleanString(Line, CommentCharacter), NewKey[1]])
+
+ return True
+
+## GetDynamics
+#
+# Get Dynamic Pcds
+#
+# @param Lines: The content to be parsed
+# @param Key: Reserved
+# @param KeyValues: To store data after parsing
+# @param CommentCharacter: Comment char, used to ignore comment content
+#
+def GetDynamics(Lines, Key, KeyValues, CommentCharacter):
+ #
+ # Get SkuId Name List
+ #
+ SkuIdNameList = SplitModuleType(Key)
+
+ Lines = Lines.split(DataType.TAB_SECTION_END, 1)[1]
+ LineList = Lines.splitlines()
+ for Line in LineList:
+ Line = CleanString(Line, CommentCharacter)
+ if Line != '' and Line[0] != CommentCharacter:
+ KeyValues.append([CleanString(Line, CommentCharacter), SkuIdNameList[1]])
+
+ return True
+
+## SplitModuleType
+#
+# Split ModuleType out of section defien to get key
+# [LibraryClass.Arch.ModuleType|ModuleType|ModuleType] -> [
+# 'LibraryClass.Arch', ['ModuleType', 'ModuleType', 'ModuleType'] ]
+#
+# @param Key: String to be parsed
+#
+def SplitModuleType(Key):
+ KeyList = Key.split(DataType.TAB_SPLIT)
+ #
+ # Fill in for arch
+ #
+ KeyList.append('')
+ #
+ # Fill in for moduletype
+ #
+ KeyList.append('')
+ ReturnValue = []
+ KeyValue = KeyList[0]
+ if KeyList[1] != '':
+ KeyValue = KeyValue + DataType.TAB_SPLIT + KeyList[1]
+ ReturnValue.append(KeyValue)
+ ReturnValue.append(GetSplitValueList(KeyList[2]))
+
+ return ReturnValue
+
+## Replace macro in string
+#
+# This method replace macros used in given string. The macros are given in a
+# dictionary.
+#
+# @param String String to be processed
+# @param MacroDefinitions The macro definitions in the form of dictionary
+# @param SelfReplacement To decide whether replace un-defined macro to ''
+# @param Line: The content contain line string and line number
+# @param FileName: The meta-file file name
+#
+def ReplaceMacro(String, MacroDefinitions=None, SelfReplacement=False, Line=None, FileName=None, Flag=False):
+ LastString = String
+ if MacroDefinitions is None:
+ MacroDefinitions = {}
+ while MacroDefinitions:
+ QuotedStringList = []
+ HaveQuotedMacroFlag = False
+ if not Flag:
+ MacroUsed = gMACRO_PATTERN.findall(String)
+ else:
+ ReQuotedString = re.compile('\"')
+ QuotedStringList = ReQuotedString.split(String)
+ if len(QuotedStringList) >= 3:
+ HaveQuotedMacroFlag = True
+ Count = 0
+ MacroString = ""
+ for QuotedStringItem in QuotedStringList:
+ Count += 1
+ if Count % 2 != 0:
+ MacroString += QuotedStringItem
+
+ if Count == len(QuotedStringList) and Count % 2 == 0:
+ MacroString += QuotedStringItem
+
+ MacroUsed = gMACRO_PATTERN.findall(MacroString)
+ #
+ # no macro found in String, stop replacing
+ #
+ if len(MacroUsed) == 0:
+ break
+ for Macro in MacroUsed:
+ if Macro not in MacroDefinitions:
+ if SelfReplacement:
+ String = String.replace("$(%s)" % Macro, '')
+ Logger.Debug(5, "Delete undefined MACROs in file %s line %d: %s!" % (FileName, Line[1], Line[0]))
+ continue
+ if not HaveQuotedMacroFlag:
+ String = String.replace("$(%s)" % Macro, MacroDefinitions[Macro])
+ else:
+ Count = 0
+ for QuotedStringItem in QuotedStringList:
+ Count += 1
+ if Count % 2 != 0:
+ QuotedStringList[Count - 1] = QuotedStringList[Count - 1].replace("$(%s)" % Macro,
+ MacroDefinitions[Macro])
+ elif Count == len(QuotedStringList) and Count % 2 == 0:
+ QuotedStringList[Count - 1] = QuotedStringList[Count - 1].replace("$(%s)" % Macro,
+ MacroDefinitions[Macro])
+
+ RetString = ''
+ if HaveQuotedMacroFlag:
+ Count = 0
+ for QuotedStringItem in QuotedStringList:
+ Count += 1
+ if Count != len(QuotedStringList):
+ RetString += QuotedStringList[Count - 1] + "\""
+ else:
+ RetString += QuotedStringList[Count - 1]
+
+ String = RetString
+
+ #
+ # in case there's macro not defined
+ #
+ if String == LastString:
+ break
+ LastString = String
+
+ return String
+
+## NormPath
+#
+# Create a normal path
+# And replace DEFINE in the path
+#
+# @param Path: The input value for Path to be converted
+# @param Defines: A set for DEFINE statement
+#
+def NormPath(Path, Defines=None):
+ IsRelativePath = False
+ if Defines is None:
+ Defines = {}
+ if Path:
+ if Path[0] == '.':
+ IsRelativePath = True
+ #
+ # Replace with Define
+ #
+ if Defines:
+ Path = ReplaceMacro(Path, Defines)
+ #
+ # To local path format
+ #
+ Path = os.path.normpath(Path)
+
+ if IsRelativePath and Path[0] != '.':
+ Path = os.path.join('.', Path)
+ return Path
+
+## CleanString
+#
+# Remove comments in a string
+# Remove spaces
+#
+# @param Line: The string to be cleaned
+# @param CommentCharacter: Comment char, used to ignore comment content,
+# default is DataType.TAB_COMMENT_SPLIT
+#
+def CleanString(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False):
+ #
+ # remove whitespace
+ #
+ Line = Line.strip()
+ #
+ # Replace EDK1's comment character
+ #
+ if AllowCppStyleComment:
+ Line = Line.replace(DataType.TAB_COMMENT_EDK1_SPLIT, CommentCharacter)
+ #
+ # remove comments, but we should escape comment character in string
+ #
+ InString = False
+ for Index in range(0, len(Line)):
+ if Line[Index] == '"':
+ InString = not InString
+ elif Line[Index] == CommentCharacter and not InString:
+ Line = Line[0: Index]
+ break
+ #
+ # remove whitespace again
+ #
+ Line = Line.strip()
+
+ return Line
+
+## CleanString2
+#
+# Split comments in a string
+# Remove spaces
+#
+# @param Line: The string to be cleaned
+# @param CommentCharacter: Comment char, used to ignore comment content,
+# default is DataType.TAB_COMMENT_SPLIT
+#
+def CleanString2(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False):
+ #
+ # remove whitespace
+ #
+ Line = Line.strip()
+ #
+ # Replace EDK1's comment character
+ #
+ if AllowCppStyleComment:
+ Line = Line.replace(DataType.TAB_COMMENT_EDK1_SPLIT, CommentCharacter)
+ #
+ # separate comments and statements
+ #
+ LineParts = Line.split(CommentCharacter, 1)
+ #
+ # remove whitespace again
+ #
+ Line = LineParts[0].strip()
+ if len(LineParts) > 1:
+ Comment = LineParts[1].strip()
+ #
+ # Remove prefixed and trailing comment characters
+ #
+ Start = 0
+ End = len(Comment)
+ while Start < End and Comment.startswith(CommentCharacter, Start, End):
+ Start += 1
+ while End >= 0 and Comment.endswith(CommentCharacter, Start, End):
+ End -= 1
+ Comment = Comment[Start:End]
+ Comment = Comment.strip()
+ else:
+ Comment = ''
+
+ return Line, Comment
+
+## GetMultipleValuesOfKeyFromLines
+#
+# Parse multiple strings to clean comment and spaces
+# The result is saved to KeyValues
+#
+# @param Lines: The content to be parsed
+# @param Key: Reserved
+# @param KeyValues: To store data after parsing
+# @param CommentCharacter: Comment char, used to ignore comment content
+#
+def GetMultipleValuesOfKeyFromLines(Lines, Key, KeyValues, CommentCharacter):
+ if Key:
+ pass
+ if KeyValues:
+ pass
+ Lines = Lines.split(DataType.TAB_SECTION_END, 1)[1]
+ LineList = Lines.split('\n')
+ for Line in LineList:
+ Line = CleanString(Line, CommentCharacter)
+ if Line != '' and Line[0] != CommentCharacter:
+ KeyValues += [Line]
+ return True
+
+## GetDefineValue
+#
+# Parse a DEFINE statement to get defined value
+# DEFINE Key Value
+#
+# @param String: The content to be parsed
+# @param Key: The key of DEFINE statement
+# @param CommentCharacter: Comment char, used to ignore comment content
+#
+def GetDefineValue(String, Key, CommentCharacter):
+ if CommentCharacter:
+ pass
+ String = CleanString(String)
+ return String[String.find(Key + ' ') + len(Key + ' ') : ]
+
+## GetSingleValueOfKeyFromLines
+#
+# Parse multiple strings as below to get value of each definition line
+# Key1 = Value1
+# Key2 = Value2
+# The result is saved to Dictionary
+#
+# @param Lines: The content to be parsed
+# @param Dictionary: To store data after parsing
+# @param CommentCharacter: Comment char, be used to ignore comment content
+# @param KeySplitCharacter: Key split char, between key name and key value.
+# Key1 = Value1, '=' is the key split char
+# @param ValueSplitFlag: Value split flag, be used to decide if has
+# multiple values
+# @param ValueSplitCharacter: Value split char, be used to split multiple
+# values. Key1 = Value1|Value2, '|' is the value
+# split char
+#
+def GetSingleValueOfKeyFromLines(Lines, Dictionary, CommentCharacter, KeySplitCharacter, \
+ ValueSplitFlag, ValueSplitCharacter):
+ Lines = Lines.split('\n')
+ Keys = []
+ Value = ''
+ DefineValues = ['']
+ SpecValues = ['']
+
+ for Line in Lines:
+ #
+ # Handle DEFINE and SPEC
+ #
+ if Line.find(DataType.TAB_INF_DEFINES_DEFINE + ' ') > -1:
+ if '' in DefineValues:
+ DefineValues.remove('')
+ DefineValues.append(GetDefineValue(Line, DataType.TAB_INF_DEFINES_DEFINE, CommentCharacter))
+ continue
+ if Line.find(DataType.TAB_INF_DEFINES_SPEC + ' ') > -1:
+ if '' in SpecValues:
+ SpecValues.remove('')
+ SpecValues.append(GetDefineValue(Line, DataType.TAB_INF_DEFINES_SPEC, CommentCharacter))
+ continue
+
+ #
+ # Handle Others
+ #
+ LineList = Line.split(KeySplitCharacter, 1)
+ if len(LineList) >= 2:
+ Key = LineList[0].split()
+ if len(Key) == 1 and Key[0][0] != CommentCharacter:
+ #
+ # Remove comments and white spaces
+ #
+ LineList[1] = CleanString(LineList[1], CommentCharacter)
+ if ValueSplitFlag:
+ Value = list(map(lambda x: x.strip(), LineList[1].split(ValueSplitCharacter)))
+ else:
+ Value = CleanString(LineList[1], CommentCharacter).splitlines()
+
+ if Key[0] in Dictionary:
+ if Key[0] not in Keys:
+ Dictionary[Key[0]] = Value
+ Keys.append(Key[0])
+ else:
+ Dictionary[Key[0]].extend(Value)
+ else:
+ Dictionary[DataType.TAB_INF_DEFINES_MACRO][Key[0]] = Value[0]
+
+ if DefineValues == []:
+ DefineValues = ['']
+ if SpecValues == []:
+ SpecValues = ['']
+ Dictionary[DataType.TAB_INF_DEFINES_DEFINE] = DefineValues
+ Dictionary[DataType.TAB_INF_DEFINES_SPEC] = SpecValues
+
+ return True
+
+## The content to be parsed
+#
+# Do pre-check for a file before it is parsed
+# Check $()
+# Check []
+#
+# @param FileName: Used for error report
+# @param FileContent: File content to be parsed
+# @param SupSectionTag: Used for error report
+#
+def PreCheck(FileName, FileContent, SupSectionTag):
+ if SupSectionTag:
+ pass
+ LineNo = 0
+ IsFailed = False
+ NewFileContent = ''
+ for Line in FileContent.splitlines():
+ LineNo = LineNo + 1
+ #
+ # Clean current line
+ #
+ Line = CleanString(Line)
+ #
+ # Remove commented line
+ #
+ if Line.find(DataType.TAB_COMMA_SPLIT) == 0:
+ Line = ''
+ #
+ # Check $()
+ #
+ if Line.find('$') > -1:
+ if Line.find('$(') < 0 or Line.find(')') < 0:
+ Logger.Error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError=Logger.IS_RAISE_ERROR)
+ #
+ # Check []
+ #
+ if Line.find('[') > -1 or Line.find(']') > -1:
+ #
+ # Only get one '[' or one ']'
+ #
+ if not (Line.find('[') > -1 and Line.find(']') > -1):
+ Logger.Error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError=Logger.IS_RAISE_ERROR)
+ #
+ # Regenerate FileContent
+ #
+ NewFileContent = NewFileContent + Line + '\r\n'
+
+ if IsFailed:
+ Logger.Error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError=Logger.IS_RAISE_ERROR)
+
+ return NewFileContent
+
+## CheckFileType
+#
+# Check if the Filename is including ExtName
+# Return True if it exists
+# Raise a error message if it not exists
+#
+# @param CheckFilename: Name of the file to be checked
+# @param ExtName: Ext name of the file to be checked
+# @param ContainerFilename: The container file which describes the file to be
+# checked, used for error report
+# @param SectionName: Used for error report
+# @param Line: The line in container file which defines the file
+# to be checked
+#
+def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line, LineNo= -1):
+ if CheckFilename != '' and CheckFilename is not None:
+ (Root, Ext) = os.path.splitext(CheckFilename)
+ if Ext.upper() != ExtName.upper() and Root:
+ ContainerFile = open(ContainerFilename, 'r').read()
+ if LineNo == -1:
+ LineNo = GetLineNo(ContainerFile, Line)
+ ErrorMsg = ST.ERR_SECTIONNAME_INVALID % (SectionName, CheckFilename, ExtName)
+ Logger.Error("Parser", PARSER_ERROR, ErrorMsg, Line=LineNo, \
+ File=ContainerFilename, RaiseError=Logger.IS_RAISE_ERROR)
+
+ return True
+
+## CheckFileExist
+#
+# Check if the file exists
+# Return True if it exists
+# Raise a error message if it not exists
+#
+# @param CheckFilename: Name of the file to be checked
+# @param WorkspaceDir: Current workspace dir
+# @param ContainerFilename: The container file which describes the file to
+# be checked, used for error report
+# @param SectionName: Used for error report
+# @param Line: The line in container file which defines the
+# file to be checked
+#
+def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName, Line, LineNo= -1):
+ CheckFile = ''
+ if CheckFilename != '' and CheckFilename is not None:
+ CheckFile = WorkspaceFile(WorkspaceDir, CheckFilename)
+ if not os.path.isfile(CheckFile):
+ ContainerFile = open(ContainerFilename, 'r').read()
+ if LineNo == -1:
+ LineNo = GetLineNo(ContainerFile, Line)
+ ErrorMsg = ST.ERR_CHECKFILE_NOTFOUND % (CheckFile, SectionName)
+ Logger.Error("Parser", PARSER_ERROR, ErrorMsg,
+ File=ContainerFilename, Line=LineNo, RaiseError=Logger.IS_RAISE_ERROR)
+ return CheckFile
+
+## GetLineNo
+#
+# Find the index of a line in a file
+#
+# @param FileContent: Search scope
+# @param Line: Search key
+#
+def GetLineNo(FileContent, Line, IsIgnoreComment=True):
+ LineList = FileContent.splitlines()
+ for Index in range(len(LineList)):
+ if LineList[Index].find(Line) > -1:
+ #
+ # Ignore statement in comment
+ #
+ if IsIgnoreComment:
+ if LineList[Index].strip()[0] == DataType.TAB_COMMENT_SPLIT:
+ continue
+ return Index + 1
+
+ return -1
+
+## RaiseParserError
+#
+# Raise a parser error
+#
+# @param Line: String which has error
+# @param Section: Used for error report
+# @param File: File which has the string
+# @param Format: Correct format
+#
+def RaiseParserError(Line, Section, File, Format='', LineNo= -1):
+ if LineNo == -1:
+ LineNo = GetLineNo(open(os.path.normpath(File), 'r').read(), Line)
+ ErrorMsg = ST.ERR_INVALID_NOTFOUND % (Line, Section)
+ if Format != '':
+ Format = "Correct format is " + Format
+ Logger.Error("Parser", PARSER_ERROR, ErrorMsg, File=File, Line=LineNo, \
+ ExtraData=Format, RaiseError=Logger.IS_RAISE_ERROR)
+
+## WorkspaceFile
+#
+# Return a full path with workspace dir
+#
+# @param WorkspaceDir: Workspace dir
+# @param Filename: Relative file name
+#
+def WorkspaceFile(WorkspaceDir, Filename):
+ return os.path.join(NormPath(WorkspaceDir), NormPath(Filename))
+
+## Split string
+#
+# Remove '"' which startswith and endswith string
+#
+# @param String: The string need to be split
+#
+def SplitString(String):
+ if String.startswith('\"'):
+ String = String[1:]
+ if String.endswith('\"'):
+ String = String[:-1]
+ return String
+
+## Convert To Sql String
+#
+# Replace "'" with "''" in each item of StringList
+#
+# @param StringList: A list for strings to be converted
+#
+def ConvertToSqlString(StringList):
+ return list(map(lambda s: s.replace("'", "''"), StringList))
+
+## Convert To Sql String
+#
+# Replace "'" with "''" in the String
+#
+# @param String: A String to be converted
+#
+def ConvertToSqlString2(String):
+ return String.replace("'", "''")
+
+## GetStringOfList
+#
+# Get String of a List
+#
+# @param Lines: string list
+# @param Split: split character
+#
+def GetStringOfList(List, Split=' '):
+ if not isinstance(List, type([])):
+ return List
+ Str = ''
+ for Item in List:
+ Str = Str + Item + Split
+ return Str.strip()
+
+## Get HelpTextList
+#
+# Get HelpTextList from HelpTextClassList
+#
+# @param HelpTextClassList: Help Text Class List
+#
+def GetHelpTextList(HelpTextClassList):
+ List = []
+ if HelpTextClassList:
+ for HelpText in HelpTextClassList:
+ if HelpText.String.endswith('\n'):
+ HelpText.String = HelpText.String[0: len(HelpText.String) - len('\n')]
+ List.extend(HelpText.String.split('\n'))
+ return List
+
+## Get String Array Length
+#
+# Get String Array Length
+#
+# @param String: the source string
+#
+def StringArrayLength(String):
+ if String.startswith('L"'):
+ return (len(String) - 3 + 1) * 2
+ elif String.startswith('"'):
+ return (len(String) - 2 + 1)
+ else:
+ return len(String.split()) + 1
+
+## RemoveDupOption
+#
+# Remove Dup Option
+#
+# @param OptionString: the option string
+# @param Which: Which flag
+# @param Against: Against flag
+#
+def RemoveDupOption(OptionString, Which="/I", Against=None):
+ OptionList = OptionString.split()
+ ValueList = []
+ if Against:
+ ValueList += Against
+ for Index in range(len(OptionList)):
+ Opt = OptionList[Index]
+ if not Opt.startswith(Which):
+ continue
+ if len(Opt) > len(Which):
+ Val = Opt[len(Which):]
+ else:
+ Val = ""
+ if Val in ValueList:
+ OptionList[Index] = ""
+ else:
+ ValueList.append(Val)
+ return " ".join(OptionList)
+
+## Check if the string is HexDgit
+#
+# Return true if all characters in the string are digits and there is at
+# least one character
+# or valid Hexs (started with 0x, following by hexdigit letters)
+# , false otherwise.
+# @param string: input string
+#
+def IsHexDigit(Str):
+ try:
+ int(Str, 10)
+ return True
+ except ValueError:
+ if len(Str) > 2 and Str.upper().startswith('0X'):
+ try:
+ int(Str, 16)
+ return True
+ except ValueError:
+ return False
+ return False
+
+## Check if the string is HexDgit and its integer value within limit of UINT32
+#
+# Return true if all characters in the string are digits and there is at
+# least one character
+# or valid Hexs (started with 0x, following by hexdigit letters)
+# , false otherwise.
+# @param string: input string
+#
+def IsHexDigitUINT32(Str):
+ try:
+ Value = int(Str, 10)
+ if (Value <= 0xFFFFFFFF) and (Value >= 0):
+ return True
+ except ValueError:
+ if len(Str) > 2 and Str.upper().startswith('0X'):
+ try:
+ Value = int(Str, 16)
+ if (Value <= 0xFFFFFFFF) and (Value >= 0):
+ return True
+ except ValueError:
+ return False
+ return False
+
+## CleanSpecialChar
+#
+# The ASCII text files of type INF, DEC, INI are edited by developers,
+# and may contain characters that cannot be directly translated to strings that
+# are conformant with the UDP XML Schema. Any characters in this category
+# (0x00-0x08, TAB [0x09], 0x0B, 0x0C, 0x0E-0x1F, 0x80-0xFF)
+# must be converted to a space character[0x20] as part of the parsing process.
+#
+def ConvertSpecialChar(Lines):
+ RetLines = []
+ for line in Lines:
+ ReMatchSpecialChar = re.compile(r"[\x00-\x08]|\x09|\x0b|\x0c|[\x0e-\x1f]|[\x7f-\xff]")
+ RetLines.append(ReMatchSpecialChar.sub(' ', line))
+
+ return RetLines
+
+## __GetTokenList
+#
+# Assume Str is a valid feature flag expression.
+# Return a list which contains tokens: alpha numeric token and other token
+# Whitespace are not stripped
+#
+def __GetTokenList(Str):
+ InQuote = False
+ Token = ''
+ TokenOP = ''
+ PreChar = ''
+ List = []
+ for Char in Str:
+ if InQuote:
+ Token += Char
+ if Char == '"' and PreChar != '\\':
+ InQuote = not InQuote
+ List.append(Token)
+ Token = ''
+ continue
+ if Char == '"':
+ if Token and Token != 'L':
+ List.append(Token)
+ Token = ''
+ if TokenOP:
+ List.append(TokenOP)
+ TokenOP = ''
+ InQuote = not InQuote
+ Token += Char
+ continue
+
+ if not (Char.isalnum() or Char in '_'):
+ TokenOP += Char
+ if Token:
+ List.append(Token)
+ Token = ''
+ else:
+ Token += Char
+ if TokenOP:
+ List.append(TokenOP)
+ TokenOP = ''
+
+ if PreChar == '\\' and Char == '\\':
+ PreChar = ''
+ else:
+ PreChar = Char
+ if Token:
+ List.append(Token)
+ if TokenOP:
+ List.append(TokenOP)
+ return List
+
+## ConvertNEToNOTEQ
+#
+# Convert NE operator to NOT EQ
+# For example: 1 NE 2 -> 1 NOT EQ 2
+#
+# @param Expr: Feature flag expression to be converted
+#
+def ConvertNEToNOTEQ(Expr):
+ List = __GetTokenList(Expr)
+ for Index in range(len(List)):
+ if List[Index] == 'NE':
+ List[Index] = 'NOT EQ'
+ return ''.join(List)
+
+## ConvertNOTEQToNE
+#
+# Convert NOT EQ operator to NE
+# For example: 1 NOT NE 2 -> 1 NE 2
+#
+# @param Expr: Feature flag expression to be converted
+#
+def ConvertNOTEQToNE(Expr):
+ List = __GetTokenList(Expr)
+ HasNOT = False
+ RetList = []
+ for Token in List:
+ if HasNOT and Token == 'EQ':
+ # At least, 'NOT' is in the list
+ while not RetList[-1].strip():
+ RetList.pop()
+ RetList[-1] = 'NE'
+ HasNOT = False
+ continue
+ if Token == 'NOT':
+ HasNOT = True
+ elif Token.strip():
+ HasNOT = False
+ RetList.append(Token)
+
+ return ''.join(RetList)
+
+## SplitPcdEntry
+#
+# Split an PCD entry string to Token.CName and PCD value and FFE.
+# NOTE: PCD Value and FFE can contain "|" in its expression. And in INF specification, have below rule.
+# When using the characters "|" or "||" in an expression, the expression must be encapsulated in
+# open "(" and close ")" parenthesis.
+#
+# @param String An PCD entry string need to be split.
+#
+# @return List [PcdTokenCName, Value, FFE]
+#
+def SplitPcdEntry(String):
+ if not String:
+ return ['', '', ''], False
+
+ PcdTokenCName = ''
+ PcdValue = ''
+ PcdFeatureFlagExp = ''
+
+ ValueList = GetSplitValueList(String, "|", 1)
+
+ #
+ # Only contain TokenCName
+ #
+ if len(ValueList) == 1:
+ return [ValueList[0]], True
+
+ NewValueList = []
+
+ if len(ValueList) == 2:
+ PcdTokenCName = ValueList[0]
+
+ InQuote = False
+ InParenthesis = False
+ StrItem = ''
+ for StrCh in ValueList[1]:
+ if StrCh == '"':
+ InQuote = not InQuote
+ elif StrCh == '(' or StrCh == ')':
+ InParenthesis = not InParenthesis
+
+ if StrCh == '|':
+ if not InQuote or not InParenthesis:
+ NewValueList.append(StrItem.strip())
+ StrItem = ' '
+ continue
+
+ StrItem += StrCh
+
+ NewValueList.append(StrItem.strip())
+
+ if len(NewValueList) == 1:
+ PcdValue = NewValueList[0]
+ return [PcdTokenCName, PcdValue], True
+ elif len(NewValueList) == 2:
+ PcdValue = NewValueList[0]
+ PcdFeatureFlagExp = NewValueList[1]
+ return [PcdTokenCName, PcdValue, PcdFeatureFlagExp], True
+ else:
+ return ['', '', ''], False
+
+ return ['', '', ''], False
+
+## Check if two arches matched?
+#
+# @param Arch1
+# @param Arch2
+#
+def IsMatchArch(Arch1, Arch2):
+ if 'COMMON' in Arch1 or 'COMMON' in Arch2:
+ return True
+ try:
+ if isinstance(Arch1, list) and isinstance(Arch2, list):
+ for Item1 in Arch1:
+ for Item2 in Arch2:
+ if Item1 == Item2:
+ return True
+
+ elif isinstance(Arch1, list):
+ return Arch2 in Arch1
+
+ elif isinstance(Arch2, list):
+ return Arch1 in Arch2
+
+ else:
+ if Arch1 == Arch2:
+ return True
+ except:
+ return False
+
+# Search all files in FilePath to find the FileName with the largest index
+# Return the FileName with index +1 under the FilePath
+#
+def GetUniFileName(FilePath, FileName):
+ Files = []
+ try:
+ Files = os.listdir(FilePath)
+ except:
+ pass
+
+ LargestIndex = -1
+ IndexNotFound = True
+ for File in Files:
+ if File.upper().startswith(FileName.upper()) and File.upper().endswith('.UNI'):
+ Index = File.upper().replace(FileName.upper(), '').replace('.UNI', '')
+ if Index:
+ try:
+ Index = int(Index)
+ except Exception:
+ Index = -1
+ else:
+ IndexNotFound = False
+ Index = 0
+ if Index > LargestIndex:
+ LargestIndex = Index + 1
+
+ if LargestIndex > -1 and not IndexNotFound:
+ return os.path.normpath(os.path.join(FilePath, FileName + str(LargestIndex) + '.uni'))
+ else:
+ return os.path.normpath(os.path.join(FilePath, FileName + '.uni'))
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Library/UniClassObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Library/UniClassObject.py
new file mode 100644
index 000000000..d25f30014
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Library/UniClassObject.py
@@ -0,0 +1,1074 @@
+## @file
+# Collect all defined strings in multiple uni files.
+#
+# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+"""
+Collect all defined strings in multiple uni files
+"""
+from __future__ import print_function
+
+##
+# Import Modules
+#
+import os, codecs, re
+import distutils.util
+from Logger import ToolError
+from Logger import Log as EdkLogger
+from Logger import StringTable as ST
+from Library.StringUtils import GetLineNo
+from Library.Misc import PathClass
+from Library.Misc import GetCharIndexOutStr
+from Library import DataType as DT
+from Library.ParserValidate import CheckUTF16FileHeader
+
+##
+# Static definitions
+#
+UNICODE_WIDE_CHAR = u'\\wide'
+UNICODE_NARROW_CHAR = u'\\narrow'
+UNICODE_NON_BREAKING_CHAR = u'\\nbr'
+UNICODE_UNICODE_CR = '\r'
+UNICODE_UNICODE_LF = '\n'
+
+NARROW_CHAR = u'\uFFF0'
+WIDE_CHAR = u'\uFFF1'
+NON_BREAKING_CHAR = u'\uFFF2'
+CR = u'\u000D'
+LF = u'\u000A'
+NULL = u'\u0000'
+TAB = u'\t'
+BACK_SPLASH = u'\\'
+
+gLANG_CONV_TABLE = {'eng':'en', 'fra':'fr', \
+ 'aar':'aa', 'abk':'ab', 'ave':'ae', 'afr':'af', 'aka':'ak', 'amh':'am', \
+ 'arg':'an', 'ara':'ar', 'asm':'as', 'ava':'av', 'aym':'ay', 'aze':'az', \
+ 'bak':'ba', 'bel':'be', 'bul':'bg', 'bih':'bh', 'bis':'bi', 'bam':'bm', \
+ 'ben':'bn', 'bod':'bo', 'bre':'br', 'bos':'bs', 'cat':'ca', 'che':'ce', \
+ 'cha':'ch', 'cos':'co', 'cre':'cr', 'ces':'cs', 'chu':'cu', 'chv':'cv', \
+ 'cym':'cy', 'dan':'da', 'deu':'de', 'div':'dv', 'dzo':'dz', 'ewe':'ee', \
+ 'ell':'el', 'epo':'eo', 'spa':'es', 'est':'et', 'eus':'eu', 'fas':'fa', \
+ 'ful':'ff', 'fin':'fi', 'fij':'fj', 'fao':'fo', 'fry':'fy', 'gle':'ga', \
+ 'gla':'gd', 'glg':'gl', 'grn':'gn', 'guj':'gu', 'glv':'gv', 'hau':'ha', \
+ 'heb':'he', 'hin':'hi', 'hmo':'ho', 'hrv':'hr', 'hat':'ht', 'hun':'hu', \
+ 'hye':'hy', 'her':'hz', 'ina':'ia', 'ind':'id', 'ile':'ie', 'ibo':'ig', \
+ 'iii':'ii', 'ipk':'ik', 'ido':'io', 'isl':'is', 'ita':'it', 'iku':'iu', \
+ 'jpn':'ja', 'jav':'jv', 'kat':'ka', 'kon':'kg', 'kik':'ki', 'kua':'kj', \
+ 'kaz':'kk', 'kal':'kl', 'khm':'km', 'kan':'kn', 'kor':'ko', 'kau':'kr', \
+ 'kas':'ks', 'kur':'ku', 'kom':'kv', 'cor':'kw', 'kir':'ky', 'lat':'la', \
+ 'ltz':'lb', 'lug':'lg', 'lim':'li', 'lin':'ln', 'lao':'lo', 'lit':'lt', \
+ 'lub':'lu', 'lav':'lv', 'mlg':'mg', 'mah':'mh', 'mri':'mi', 'mkd':'mk', \
+ 'mal':'ml', 'mon':'mn', 'mar':'mr', 'msa':'ms', 'mlt':'mt', 'mya':'my', \
+ 'nau':'na', 'nob':'nb', 'nde':'nd', 'nep':'ne', 'ndo':'ng', 'nld':'nl', \
+ 'nno':'nn', 'nor':'no', 'nbl':'nr', 'nav':'nv', 'nya':'ny', 'oci':'oc', \
+ 'oji':'oj', 'orm':'om', 'ori':'or', 'oss':'os', 'pan':'pa', 'pli':'pi', \
+ 'pol':'pl', 'pus':'ps', 'por':'pt', 'que':'qu', 'roh':'rm', 'run':'rn', \
+ 'ron':'ro', 'rus':'ru', 'kin':'rw', 'san':'sa', 'srd':'sc', 'snd':'sd', \
+ 'sme':'se', 'sag':'sg', 'sin':'si', 'slk':'sk', 'slv':'sl', 'smo':'sm', \
+ 'sna':'sn', 'som':'so', 'sqi':'sq', 'srp':'sr', 'ssw':'ss', 'sot':'st', \
+ 'sun':'su', 'swe':'sv', 'swa':'sw', 'tam':'ta', 'tel':'te', 'tgk':'tg', \
+ 'tha':'th', 'tir':'ti', 'tuk':'tk', 'tgl':'tl', 'tsn':'tn', 'ton':'to', \
+ 'tur':'tr', 'tso':'ts', 'tat':'tt', 'twi':'tw', 'tah':'ty', 'uig':'ug', \
+ 'ukr':'uk', 'urd':'ur', 'uzb':'uz', 'ven':'ve', 'vie':'vi', 'vol':'vo', \
+ 'wln':'wa', 'wol':'wo', 'xho':'xh', 'yid':'yi', 'yor':'yo', 'zha':'za', \
+ 'zho':'zh', 'zul':'zu'}
+
+## Convert a python unicode string to a normal string
+#
+# Convert a python unicode string to a normal string
+# UniToStr(u'I am a string') is 'I am a string'
+#
+# @param Uni: The python unicode string
+#
+# @retval: The formatted normal string
+#
+def UniToStr(Uni):
+ return repr(Uni)[2:-1]
+
+## Convert a unicode string to a Hex list
+#
+# Convert a unicode string to a Hex list
+# UniToHexList('ABC') is ['0x41', '0x00', '0x42', '0x00', '0x43', '0x00']
+#
+# @param Uni: The python unicode string
+#
+# @retval List: The formatted hex list
+#
+def UniToHexList(Uni):
+ List = []
+ for Item in Uni:
+ Temp = '%04X' % ord(Item)
+ List.append('0x' + Temp[2:4])
+ List.append('0x' + Temp[0:2])
+ return List
+
+## Convert special unicode characters
+#
+# Convert special characters to (c), (r) and (tm).
+#
+# @param Uni: The python unicode string
+#
+# @retval NewUni: The converted unicode string
+#
+def ConvertSpecialUnicodes(Uni):
+ OldUni = NewUni = Uni
+ NewUni = NewUni.replace(u'\u00A9', '(c)')
+ NewUni = NewUni.replace(u'\u00AE', '(r)')
+ NewUni = NewUni.replace(u'\u2122', '(tm)')
+ if OldUni == NewUni:
+ NewUni = OldUni
+ return NewUni
+
+## GetLanguageCode1766
+#
+# Check the language code read from .UNI file and convert RFC 4646 codes to RFC 1766 codes
+# RFC 1766 language codes supported in compatibility mode
+# RFC 4646 language codes supported in native mode
+#
+# @param LangName: Language codes read from .UNI file
+#
+# @retval LangName: Valid language code in RFC 1766 format or None
+#
+def GetLanguageCode1766(LangName, File=None):
+ return LangName
+
+ length = len(LangName)
+ if length == 2:
+ if LangName.isalpha():
+ for Key in gLANG_CONV_TABLE.keys():
+ if gLANG_CONV_TABLE.get(Key) == LangName.lower():
+ return Key
+ elif length == 3:
+ if LangName.isalpha() and gLANG_CONV_TABLE.get(LangName.lower()):
+ return LangName
+ else:
+ EdkLogger.Error("Unicode File Parser",
+ ToolError.FORMAT_INVALID,
+ "Invalid RFC 1766 language code : %s" % LangName,
+ File)
+ elif length == 5:
+ if LangName[0:2].isalpha() and LangName[2] == '-':
+ for Key in gLANG_CONV_TABLE.keys():
+ if gLANG_CONV_TABLE.get(Key) == LangName[0:2].lower():
+ return Key
+ elif length >= 6:
+ if LangName[0:2].isalpha() and LangName[2] == '-':
+ for Key in gLANG_CONV_TABLE.keys():
+ if gLANG_CONV_TABLE.get(Key) == LangName[0:2].lower():
+ return Key
+ if LangName[0:3].isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) is None and LangName[3] == '-':
+ for Key in gLANG_CONV_TABLE.keys():
+ if Key == LangName[0:3].lower():
+ return Key
+
+ EdkLogger.Error("Unicode File Parser",
+ ToolError.FORMAT_INVALID,
+ "Invalid RFC 4646 language code : %s" % LangName,
+ File)
+
+## GetLanguageCode
+#
+# Check the language code read from .UNI file and convert RFC 1766 codes to RFC 4646 codes if appropriate
+# RFC 1766 language codes supported in compatibility mode
+# RFC 4646 language codes supported in native mode
+#
+# @param LangName: Language codes read from .UNI file
+#
+# @retval LangName: Valid lanugage code in RFC 4646 format or None
+#
+def GetLanguageCode(LangName, IsCompatibleMode, File):
+ length = len(LangName)
+ if IsCompatibleMode:
+ if length == 3 and LangName.isalpha():
+ TempLangName = gLANG_CONV_TABLE.get(LangName.lower())
+ if TempLangName is not None:
+ return TempLangName
+ return LangName
+ else:
+ EdkLogger.Error("Unicode File Parser",
+ ToolError.FORMAT_INVALID,
+ "Invalid RFC 1766 language code : %s" % LangName,
+ File)
+ if (LangName[0] == 'X' or LangName[0] == 'x') and LangName[1] == '-':
+ return LangName
+ if length == 2:
+ if LangName.isalpha():
+ return LangName
+ elif length == 3:
+ if LangName.isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) is None:
+ return LangName
+ elif length == 5:
+ if LangName[0:2].isalpha() and LangName[2] == '-':
+ return LangName
+ elif length >= 6:
+ if LangName[0:2].isalpha() and LangName[2] == '-':
+ return LangName
+ if LangName[0:3].isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) is None and LangName[3] == '-':
+ return LangName
+
+ EdkLogger.Error("Unicode File Parser",
+ ToolError.FORMAT_INVALID,
+ "Invalid RFC 4646 language code : %s" % LangName,
+ File)
+
+## FormatUniEntry
+#
+# Formatted the entry in Uni file.
+#
+# @param StrTokenName StrTokenName.
+# @param TokenValueList A list need to be processed.
+# @param ContainerFile ContainerFile.
+#
+# @return formatted entry
+def FormatUniEntry(StrTokenName, TokenValueList, ContainerFile):
+ SubContent = ''
+ PreFormatLength = 40
+ if len(StrTokenName) > PreFormatLength:
+ PreFormatLength = len(StrTokenName) + 1
+ for (Lang, Value) in TokenValueList:
+ if not Value or Lang == DT.TAB_LANGUAGE_EN_X:
+ continue
+ if Lang == '':
+ Lang = DT.TAB_LANGUAGE_EN_US
+ if Lang == 'eng':
+ Lang = DT.TAB_LANGUAGE_EN_US
+ elif len(Lang.split('-')[0]) == 3:
+ Lang = GetLanguageCode(Lang.split('-')[0], True, ContainerFile)
+ else:
+ Lang = GetLanguageCode(Lang, False, ContainerFile)
+ ValueList = Value.split('\n')
+ SubValueContent = ''
+ for SubValue in ValueList:
+ if SubValue.strip():
+ SubValueContent += \
+ ' ' * (PreFormatLength + len('#language en-US ')) + '\"%s\\n\"' % SubValue.strip() + '\r\n'
+ SubValueContent = SubValueContent[(PreFormatLength + len('#language en-US ')):SubValueContent.rfind('\\n')] \
+ + '\"' + '\r\n'
+ SubContent += ' '*PreFormatLength + '#language %-5s ' % Lang + SubValueContent
+ if SubContent:
+ SubContent = StrTokenName + ' '*(PreFormatLength - len(StrTokenName)) + SubContent[PreFormatLength:]
+ return SubContent
+
+
+## StringDefClassObject
+#
+# A structure for language definition
+#
+class StringDefClassObject(object):
+ def __init__(self, Name = None, Value = None, Referenced = False, Token = None, UseOtherLangDef = ''):
+ self.StringName = ''
+ self.StringNameByteList = []
+ self.StringValue = ''
+ self.StringValueByteList = ''
+ self.Token = 0
+ self.Referenced = Referenced
+ self.UseOtherLangDef = UseOtherLangDef
+ self.Length = 0
+
+ if Name is not None:
+ self.StringName = Name
+ self.StringNameByteList = UniToHexList(Name)
+ if Value is not None:
+ self.StringValue = Value
+ self.StringValueByteList = UniToHexList(self.StringValue)
+ self.Length = len(self.StringValueByteList)
+ if Token is not None:
+ self.Token = Token
+
+ def __str__(self):
+ return repr(self.StringName) + ' ' + \
+ repr(self.Token) + ' ' + \
+ repr(self.Referenced) + ' ' + \
+ repr(self.StringValue) + ' ' + \
+ repr(self.UseOtherLangDef)
+
+ def UpdateValue(self, Value = None):
+ if Value is not None:
+ if self.StringValue:
+ self.StringValue = self.StringValue + '\r\n' + Value
+ else:
+ self.StringValue = Value
+ self.StringValueByteList = UniToHexList(self.StringValue)
+ self.Length = len(self.StringValueByteList)
+
+## UniFileClassObject
+#
+# A structure for .uni file definition
+#
+class UniFileClassObject(object):
+ def __init__(self, FileList = None, IsCompatibleMode = False, IncludePathList = None):
+ self.FileList = FileList
+ self.File = None
+ self.IncFileList = FileList
+ self.UniFileHeader = ''
+ self.Token = 2
+ self.LanguageDef = [] #[ [u'LanguageIdentifier', u'PrintableName'], ... ]
+ self.OrderedStringList = {} #{ u'LanguageIdentifier' : [StringDefClassObject] }
+ self.OrderedStringDict = {} #{ u'LanguageIdentifier' : {StringName:(IndexInList)} }
+ self.OrderedStringListByToken = {} #{ u'LanguageIdentifier' : {Token: StringDefClassObject} }
+ self.IsCompatibleMode = IsCompatibleMode
+ if not IncludePathList:
+ self.IncludePathList = []
+ else:
+ self.IncludePathList = IncludePathList
+ if len(self.FileList) > 0:
+ self.LoadUniFiles(FileList)
+
+ #
+ # Get Language definition
+ #
+ def GetLangDef(self, File, Line):
+ Lang = distutils.util.split_quoted((Line.split(u"//")[0]))
+ if len(Lang) != 3:
+ try:
+ FileIn = codecs.open(File.Path, mode='rb', encoding='utf_8').readlines()
+ except UnicodeError as Xstr:
+ FileIn = codecs.open(File.Path, mode='rb', encoding='utf_16').readlines()
+ except UnicodeError as Xstr:
+ FileIn = codecs.open(File.Path, mode='rb', encoding='utf_16_le').readlines()
+ except:
+ EdkLogger.Error("Unicode File Parser",
+ ToolError.FILE_OPEN_FAILURE,
+ "File read failure: %s" % str(Xstr),
+ ExtraData=File)
+ LineNo = GetLineNo(FileIn, Line, False)
+ EdkLogger.Error("Unicode File Parser",
+ ToolError.PARSER_ERROR,
+ "Wrong language definition",
+ ExtraData="""%s\n\t*Correct format is like '#langdef en-US "English"'""" % Line,
+ File = File, Line = LineNo)
+ else:
+ LangName = GetLanguageCode(Lang[1], self.IsCompatibleMode, self.File)
+ LangPrintName = Lang[2]
+
+ IsLangInDef = False
+ for Item in self.LanguageDef:
+ if Item[0] == LangName:
+ IsLangInDef = True
+ break
+
+ if not IsLangInDef:
+ self.LanguageDef.append([LangName, LangPrintName])
+
+ #
+ # Add language string
+ #
+ self.AddStringToList(u'$LANGUAGE_NAME', LangName, LangName, 0, True, Index=0)
+ self.AddStringToList(u'$PRINTABLE_LANGUAGE_NAME', LangName, LangPrintName, 1, True, Index=1)
+
+ if not IsLangInDef:
+ #
+ # The found STRING tokens will be added into new language string list
+ # so that the unique STRING identifier is reserved for all languages in the package list.
+ #
+ FirstLangName = self.LanguageDef[0][0]
+ if LangName != FirstLangName:
+ for Index in range (2, len (self.OrderedStringList[FirstLangName])):
+ Item = self.OrderedStringList[FirstLangName][Index]
+ if Item.UseOtherLangDef != '':
+ OtherLang = Item.UseOtherLangDef
+ else:
+ OtherLang = FirstLangName
+ self.OrderedStringList[LangName].append (StringDefClassObject(Item.StringName,
+ '',
+ Item.Referenced,
+ Item.Token,
+ OtherLang))
+ self.OrderedStringDict[LangName][Item.StringName] = len(self.OrderedStringList[LangName]) - 1
+ return True
+
+ #
+ # Get String name and value
+ #
+ def GetStringObject(self, Item):
+ Language = ''
+ Value = ''
+
+ Name = Item.split()[1]
+ # Check the string name is the upper character
+ if Name != '':
+ MatchString = re.match('[A-Z0-9_]+', Name, re.UNICODE)
+ if MatchString is None or MatchString.end(0) != len(Name):
+ EdkLogger.Error("Unicode File Parser",
+ ToolError.FORMAT_INVALID,
+ 'The string token name %s in UNI file %s must be upper case character.' %(Name, self.File))
+ LanguageList = Item.split(u'#language ')
+ for IndexI in range(len(LanguageList)):
+ if IndexI == 0:
+ continue
+ else:
+ Language = LanguageList[IndexI].split()[0]
+ #.replace(u'\r\n', u'')
+ Value = \
+ LanguageList[IndexI][LanguageList[IndexI].find(u'\"') + len(u'\"') : LanguageList[IndexI].rfind(u'\"')]
+ Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File)
+ self.AddStringToList(Name, Language, Value)
+
+ #
+ # Get include file list and load them
+ #
+ def GetIncludeFile(self, Item, Dir = None):
+ if Dir:
+ pass
+ FileName = Item[Item.find(u'!include ') + len(u'!include ') :Item.find(u' ', len(u'!include '))][1:-1]
+ self.LoadUniFile(FileName)
+
+ #
+ # Pre-process before parse .uni file
+ #
+ def PreProcess(self, File, IsIncludeFile=False):
+ if not os.path.exists(File.Path) or not os.path.isfile(File.Path):
+ EdkLogger.Error("Unicode File Parser",
+ ToolError.FILE_NOT_FOUND,
+ ExtraData=File.Path)
+
+ #
+ # Check file header of the Uni file
+ #
+# if not CheckUTF16FileHeader(File.Path):
+# EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID,
+# ExtraData='The file %s is either invalid UTF-16LE or it is missing the BOM.' % File.Path)
+
+ try:
+ FileIn = codecs.open(File.Path, mode='rb', encoding='utf_8').readlines()
+ except UnicodeError as Xstr:
+ FileIn = codecs.open(File.Path, mode='rb', encoding='utf_16').readlines()
+ except UnicodeError:
+ FileIn = codecs.open(File.Path, mode='rb', encoding='utf_16_le').readlines()
+ except:
+ EdkLogger.Error("Unicode File Parser", ToolError.FILE_OPEN_FAILURE, ExtraData=File.Path)
+
+
+ #
+ # get the file header
+ #
+ Lines = []
+ HeaderStart = False
+ HeaderEnd = False
+ if not self.UniFileHeader:
+ FirstGenHeader = True
+ else:
+ FirstGenHeader = False
+ for Line in FileIn:
+ Line = Line.strip()
+ if Line == u'':
+ continue
+ if Line.startswith(DT.TAB_COMMENT_EDK1_SPLIT) and (Line.find(DT.TAB_HEADER_COMMENT) > -1) \
+ and not HeaderEnd and not HeaderStart:
+ HeaderStart = True
+ if not Line.startswith(DT.TAB_COMMENT_EDK1_SPLIT) and HeaderStart and not HeaderEnd:
+ HeaderEnd = True
+ if Line.startswith(DT.TAB_COMMENT_EDK1_SPLIT) and HeaderStart and not HeaderEnd and FirstGenHeader:
+ self.UniFileHeader += Line + '\r\n'
+ continue
+
+ #
+ # Use unique identifier
+ #
+ FindFlag = -1
+ LineCount = 0
+ MultiLineFeedExits = False
+ #
+ # 0: initial value
+ # 1: single String entry exist
+ # 2: line feed exist under the some single String entry
+ #
+ StringEntryExistsFlag = 0
+ for Line in FileIn:
+ Line = FileIn[LineCount]
+ LineCount += 1
+ Line = Line.strip()
+ #
+ # Ignore comment line and empty line
+ #
+ if Line == u'' or Line.startswith(u'//'):
+ #
+ # Change the single line String entry flag status
+ #
+ if StringEntryExistsFlag == 1:
+ StringEntryExistsFlag = 2
+ #
+ # If the '#string' line and the '#language' line are not in the same line,
+ # there should be only one line feed character between them
+ #
+ if MultiLineFeedExits:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
+ continue
+
+ MultiLineFeedExits = False
+ #
+ # Process comment embedded in string define lines
+ #
+ FindFlag = Line.find(u'//')
+ if FindFlag != -1 and Line.find(u'//') < Line.find(u'"'):
+ Line = Line.replace(Line[FindFlag:], u' ')
+ if FileIn[LineCount].strip().startswith('#language'):
+ Line = Line + FileIn[LineCount]
+ FileIn[LineCount-1] = Line
+ FileIn[LineCount] = '\r\n'
+ LineCount -= 1
+ for Index in range (LineCount + 1, len (FileIn) - 1):
+ if (Index == len(FileIn) -1):
+ FileIn[Index] = '\r\n'
+ else:
+ FileIn[Index] = FileIn[Index + 1]
+ continue
+ CommIndex = GetCharIndexOutStr(u'/', Line)
+ if CommIndex > -1:
+ if (len(Line) - 1) > CommIndex:
+ if Line[CommIndex+1] == u'/':
+ Line = Line[:CommIndex].strip()
+ else:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
+ else:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
+
+ Line = Line.replace(UNICODE_WIDE_CHAR, WIDE_CHAR)
+ Line = Line.replace(UNICODE_NARROW_CHAR, NARROW_CHAR)
+ Line = Line.replace(UNICODE_NON_BREAKING_CHAR, NON_BREAKING_CHAR)
+
+ Line = Line.replace(u'\\\\', u'\u0006')
+ Line = Line.replace(u'\\r\\n', CR + LF)
+ Line = Line.replace(u'\\n', CR + LF)
+ Line = Line.replace(u'\\r', CR)
+ Line = Line.replace(u'\\t', u'\t')
+ Line = Line.replace(u'''\"''', u'''"''')
+ Line = Line.replace(u'\t', u' ')
+ Line = Line.replace(u'\u0006', u'\\')
+
+ #
+ # Check if single line has correct '"'
+ #
+ if Line.startswith(u'#string') and Line.find(u'#language') > -1 and Line.find('"') > Line.find(u'#language'):
+ if not Line.endswith('"'):
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID,
+ ExtraData='''The line %s misses '"' at the end of it in file %s'''
+ % (LineCount, File.Path))
+
+ #
+ # Between Name entry and Language entry can not contain line feed
+ #
+ if Line.startswith(u'#string') and Line.find(u'#language') == -1:
+ MultiLineFeedExits = True
+
+ if Line.startswith(u'#string') and Line.find(u'#language') > 0 and Line.find(u'"') < 0:
+ MultiLineFeedExits = True
+
+ #
+ # Between Language entry and String entry can not contain line feed
+ #
+ if Line.startswith(u'#language') and len(Line.split()) == 2:
+ MultiLineFeedExits = True
+
+ #
+ # Check the situation that there only has one '"' for the language entry
+ #
+ if Line.startswith(u'#string') and Line.find(u'#language') > 0 and Line.count(u'"') == 1:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID,
+ ExtraData='''The line %s misses '"' at the end of it in file %s'''
+ % (LineCount, File.Path))
+
+ #
+ # Check the situation that there has more than 2 '"' for the language entry
+ #
+ if Line.startswith(u'#string') and Line.find(u'#language') > 0 and Line.replace(u'\\"', '').count(u'"') > 2:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID,
+ ExtraData='''The line %s has more than 2 '"' for language entry in file %s'''
+ % (LineCount, File.Path))
+
+ #
+ # Between two String entry, can not contain line feed
+ #
+ if Line.startswith(u'"'):
+ if StringEntryExistsFlag == 2:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID,
+ Message=ST.ERR_UNIPARSE_LINEFEED_UP_EXIST % Line, ExtraData=File.Path)
+
+ StringEntryExistsFlag = 1
+ if not Line.endswith('"'):
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID,
+ ExtraData='''The line %s misses '"' at the end of it in file %s'''
+ % (LineCount, File.Path))
+
+ #
+ # Check the situation that there has more than 2 '"' for the language entry
+ #
+ if Line.strip() and Line.replace(u'\\"', '').count(u'"') > 2:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID,
+ ExtraData='''The line %s has more than 2 '"' for language entry in file %s'''
+ % (LineCount, File.Path))
+
+ elif Line.startswith(u'#language'):
+ if StringEntryExistsFlag == 2:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID,
+ Message=ST.ERR_UNI_MISS_STRING_ENTRY % Line, ExtraData=File.Path)
+ StringEntryExistsFlag = 0
+ else:
+ StringEntryExistsFlag = 0
+
+ Lines.append(Line)
+
+ #
+ # Convert string def format as below
+ #
+ # #string MY_STRING_1
+ # #language eng
+ # "My first English string line 1"
+ # "My first English string line 2"
+ # #string MY_STRING_1
+ # #language spa
+ # "Mi segunda secuencia 1"
+ # "Mi segunda secuencia 2"
+ #
+
+ if not IsIncludeFile and not Lines:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, \
+ Message=ST.ERR_UNIPARSE_NO_SECTION_EXIST, \
+ ExtraData=File.Path)
+
+ NewLines = []
+ StrName = u''
+ ExistStrNameList = []
+ for Line in Lines:
+ if StrName and not StrName.split()[1].startswith(DT.TAB_STR_TOKENCNAME + DT.TAB_UNDERLINE_SPLIT):
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, \
+ Message=ST.ERR_UNIPARSE_STRNAME_FORMAT_ERROR % StrName.split()[1], \
+ ExtraData=File.Path)
+
+ if StrName and len(StrName.split()[1].split(DT.TAB_UNDERLINE_SPLIT)) == 4:
+ StringTokenList = StrName.split()[1].split(DT.TAB_UNDERLINE_SPLIT)
+ if (StringTokenList[3].upper() in [DT.TAB_STR_TOKENPROMPT, DT.TAB_STR_TOKENHELP] and \
+ StringTokenList[3] not in [DT.TAB_STR_TOKENPROMPT, DT.TAB_STR_TOKENHELP]) or \
+ (StringTokenList[2].upper() == DT.TAB_STR_TOKENERR and StringTokenList[2] != DT.TAB_STR_TOKENERR):
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, \
+ Message=ST.ERR_UNIPARSE_STRTOKEN_FORMAT_ERROR % StrName.split()[1], \
+ ExtraData=File.Path)
+
+ if Line.count(u'#language') > 1:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, \
+ Message=ST.ERR_UNIPARSE_SEP_LANGENTRY_LINE % Line, \
+ ExtraData=File.Path)
+
+ if Line.startswith(u'//'):
+ continue
+ elif Line.startswith(u'#langdef'):
+ if len(Line.split()) == 2:
+ NewLines.append(Line)
+ continue
+ elif len(Line.split()) > 2 and Line.find(u'"') > 0:
+ NewLines.append(Line[:Line.find(u'"')].strip())
+ NewLines.append(Line[Line.find(u'"'):])
+ else:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
+ elif Line.startswith(u'#string'):
+ if len(Line.split()) == 2:
+ StrName = Line
+ if StrName:
+ if StrName.split()[1] not in ExistStrNameList:
+ ExistStrNameList.append(StrName.split()[1].strip())
+ elif StrName.split()[1] in [DT.TAB_INF_ABSTRACT, DT.TAB_INF_DESCRIPTION, \
+ DT.TAB_INF_BINARY_ABSTRACT, DT.TAB_INF_BINARY_DESCRIPTION, \
+ DT.TAB_DEC_PACKAGE_ABSTRACT, DT.TAB_DEC_PACKAGE_DESCRIPTION, \
+ DT.TAB_DEC_BINARY_ABSTRACT, DT.TAB_DEC_BINARY_DESCRIPTION]:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, \
+ Message=ST.ERR_UNIPARSE_MULTI_ENTRY_EXIST % StrName.split()[1], \
+ ExtraData=File.Path)
+ continue
+ elif len(Line.split()) == 4 and Line.find(u'#language') > 0:
+ if Line[Line.find(u'#language')-1] != ' ' or \
+ Line[Line.find(u'#language')+len(u'#language')] != u' ':
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
+
+ if Line.find(u'"') > 0:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
+
+ StrName = Line.split()[0] + u' ' + Line.split()[1]
+ if StrName:
+ if StrName.split()[1] not in ExistStrNameList:
+ ExistStrNameList.append(StrName.split()[1].strip())
+ elif StrName.split()[1] in [DT.TAB_INF_ABSTRACT, DT.TAB_INF_DESCRIPTION, \
+ DT.TAB_INF_BINARY_ABSTRACT, DT.TAB_INF_BINARY_DESCRIPTION, \
+ DT.TAB_DEC_PACKAGE_ABSTRACT, DT.TAB_DEC_PACKAGE_DESCRIPTION, \
+ DT.TAB_DEC_BINARY_ABSTRACT, DT.TAB_DEC_BINARY_DESCRIPTION]:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, \
+ Message=ST.ERR_UNIPARSE_MULTI_ENTRY_EXIST % StrName.split()[1], \
+ ExtraData=File.Path)
+ if IsIncludeFile:
+ if StrName not in NewLines:
+ NewLines.append((Line[:Line.find(u'#language')]).strip())
+ else:
+ NewLines.append((Line[:Line.find(u'#language')]).strip())
+ NewLines.append((Line[Line.find(u'#language'):]).strip())
+ elif len(Line.split()) > 4 and Line.find(u'#language') > 0 and Line.find(u'"') > 0:
+ if Line[Line.find(u'#language')-1] != u' ' or \
+ Line[Line.find(u'#language')+len(u'#language')] != u' ':
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
+
+ if Line[Line.find(u'"')-1] != u' ':
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
+
+ StrName = Line.split()[0] + u' ' + Line.split()[1]
+ if StrName:
+ if StrName.split()[1] not in ExistStrNameList:
+ ExistStrNameList.append(StrName.split()[1].strip())
+ elif StrName.split()[1] in [DT.TAB_INF_ABSTRACT, DT.TAB_INF_DESCRIPTION, \
+ DT.TAB_INF_BINARY_ABSTRACT, DT.TAB_INF_BINARY_DESCRIPTION, \
+ DT.TAB_DEC_PACKAGE_ABSTRACT, DT.TAB_DEC_PACKAGE_DESCRIPTION, \
+ DT.TAB_DEC_BINARY_ABSTRACT, DT.TAB_DEC_BINARY_DESCRIPTION]:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, \
+ Message=ST.ERR_UNIPARSE_MULTI_ENTRY_EXIST % StrName.split()[1], \
+ ExtraData=File.Path)
+ if IsIncludeFile:
+ if StrName not in NewLines:
+ NewLines.append((Line[:Line.find(u'#language')]).strip())
+ else:
+ NewLines.append((Line[:Line.find(u'#language')]).strip())
+ NewLines.append((Line[Line.find(u'#language'):Line.find(u'"')]).strip())
+ NewLines.append((Line[Line.find(u'"'):]).strip())
+ else:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
+ elif Line.startswith(u'#language'):
+ if len(Line.split()) == 2:
+ if IsIncludeFile:
+ if StrName not in NewLines:
+ NewLines.append(StrName)
+ else:
+ NewLines.append(StrName)
+ NewLines.append(Line)
+ elif len(Line.split()) > 2 and Line.find(u'"') > 0:
+ if IsIncludeFile:
+ if StrName not in NewLines:
+ NewLines.append(StrName)
+ else:
+ NewLines.append(StrName)
+ NewLines.append((Line[:Line.find(u'"')]).strip())
+ NewLines.append((Line[Line.find(u'"'):]).strip())
+ else:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
+ elif Line.startswith(u'"'):
+ if u'#string' in Line or u'#language' in Line:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
+ NewLines.append(Line)
+ else:
+ print(Line)
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
+
+ if StrName and not StrName.split()[1].startswith(u'STR_'):
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, \
+ Message=ST.ERR_UNIPARSE_STRNAME_FORMAT_ERROR % StrName.split()[1], \
+ ExtraData=File.Path)
+
+ if StrName and not NewLines:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, \
+ Message=ST.ERR_UNI_MISS_LANGENTRY % StrName, \
+ ExtraData=File.Path)
+
+ #
+ # Check Abstract, Description, BinaryAbstract and BinaryDescription order,
+ # should be Abstract, Description, BinaryAbstract, BinaryDescription
+ AbstractPosition = -1
+ DescriptionPosition = -1
+ BinaryAbstractPosition = -1
+ BinaryDescriptionPosition = -1
+ for StrName in ExistStrNameList:
+ if DT.TAB_HEADER_ABSTRACT.upper() in StrName:
+ if 'BINARY' in StrName:
+ BinaryAbstractPosition = ExistStrNameList.index(StrName)
+ else:
+ AbstractPosition = ExistStrNameList.index(StrName)
+ if DT.TAB_HEADER_DESCRIPTION.upper() in StrName:
+ if 'BINARY' in StrName:
+ BinaryDescriptionPosition = ExistStrNameList.index(StrName)
+ else:
+ DescriptionPosition = ExistStrNameList.index(StrName)
+
+ OrderList = sorted([AbstractPosition, DescriptionPosition])
+ BinaryOrderList = sorted([BinaryAbstractPosition, BinaryDescriptionPosition])
+ Min = OrderList[0]
+ Max = OrderList[1]
+ BinaryMin = BinaryOrderList[0]
+ BinaryMax = BinaryOrderList[1]
+ if BinaryDescriptionPosition > -1:
+ if not(BinaryDescriptionPosition == BinaryMax and BinaryAbstractPosition == BinaryMin and \
+ BinaryMax > Max):
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, \
+ Message=ST.ERR_UNIPARSE_ENTRY_ORDER_WRONG, \
+ ExtraData=File.Path)
+ elif BinaryAbstractPosition > -1:
+ if not(BinaryAbstractPosition > Max):
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, \
+ Message=ST.ERR_UNIPARSE_ENTRY_ORDER_WRONG, \
+ ExtraData=File.Path)
+
+ if DescriptionPosition > -1:
+ if not(DescriptionPosition == Max and AbstractPosition == Min and \
+ DescriptionPosition > AbstractPosition):
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, \
+ Message=ST.ERR_UNIPARSE_ENTRY_ORDER_WRONG, \
+ ExtraData=File.Path)
+
+ if not self.UniFileHeader:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID,
+ Message = ST.ERR_NO_SOURCE_HEADER,
+ ExtraData=File.Path)
+
+ return NewLines
+
+ #
+ # Load a .uni file
+ #
+ def LoadUniFile(self, File = None):
+ if File is None:
+ EdkLogger.Error("Unicode File Parser",
+ ToolError.PARSER_ERROR,
+ Message='No unicode file is given',
+ ExtraData=File.Path)
+
+ self.File = File
+
+ #
+ # Process special char in file
+ #
+ Lines = self.PreProcess(File)
+
+ #
+ # Get Unicode Information
+ #
+ for IndexI in range(len(Lines)):
+ Line = Lines[IndexI]
+ if (IndexI + 1) < len(Lines):
+ SecondLine = Lines[IndexI + 1]
+ if (IndexI + 2) < len(Lines):
+ ThirdLine = Lines[IndexI + 2]
+
+ #
+ # Get Language def information
+ #
+ if Line.find(u'#langdef ') >= 0:
+ self.GetLangDef(File, Line + u' ' + SecondLine)
+ continue
+
+ Name = ''
+ Language = ''
+ Value = ''
+ CombineToken = False
+ #
+ # Get string def information format as below
+ #
+ # #string MY_STRING_1
+ # #language eng
+ # "My first English string line 1"
+ # "My first English string line 2"
+ # #string MY_STRING_1
+ # #language spa
+ # "Mi segunda secuencia 1"
+ # "Mi segunda secuencia 2"
+ #
+ if Line.find(u'#string ') >= 0 and Line.find(u'#language ') < 0 and \
+ SecondLine.find(u'#string ') < 0 and SecondLine.find(u'#language ') >= 0 and \
+ ThirdLine.find(u'#string ') < 0 and ThirdLine.find(u'#language ') < 0:
+ if Line.find('"') > 0 or SecondLine.find('"') > 0:
+ EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID,
+ Message=ST.ERR_UNIPARSE_DBLQUOTE_UNMATCHED,
+ ExtraData=File.Path)
+
+ Name = Line[Line.find(u'#string ') + len(u'#string ') : ].strip(' ')
+ Language = SecondLine[SecondLine.find(u'#language ') + len(u'#language ') : ].strip(' ')
+ for IndexJ in range(IndexI + 2, len(Lines)):
+ if Lines[IndexJ].find(u'#string ') < 0 and Lines[IndexJ].find(u'#language ') < 0 and \
+ Lines[IndexJ].strip().startswith(u'"') and Lines[IndexJ].strip().endswith(u'"'):
+ if Lines[IndexJ][-2] == ' ':
+ CombineToken = True
+ if CombineToken:
+ if Lines[IndexJ].strip()[1:-1].strip():
+ Value = Value + Lines[IndexJ].strip()[1:-1].rstrip() + ' '
+ else:
+ Value = Value + Lines[IndexJ].strip()[1:-1]
+ CombineToken = False
+ else:
+ Value = Value + Lines[IndexJ].strip()[1:-1] + '\r\n'
+ else:
+ IndexI = IndexJ
+ break
+ if Value.endswith('\r\n'):
+ Value = Value[: Value.rfind('\r\n')]
+ Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File)
+ self.AddStringToList(Name, Language, Value)
+ continue
+
+ #
+ # Load multiple .uni files
+ #
+ def LoadUniFiles(self, FileList):
+ if len(FileList) > 0:
+ for File in FileList:
+ FilePath = File.Path.strip()
+ if FilePath.endswith('.uni') or FilePath.endswith('.UNI') or FilePath.endswith('.Uni'):
+ self.LoadUniFile(File)
+
+ #
+ # Add a string to list
+ #
+ def AddStringToList(self, Name, Language, Value, Token = 0, Referenced = False, UseOtherLangDef = '', Index = -1):
+ for LangNameItem in self.LanguageDef:
+ if Language == LangNameItem[0]:
+ break
+
+ if Language not in self.OrderedStringList:
+ self.OrderedStringList[Language] = []
+ self.OrderedStringDict[Language] = {}
+
+ IsAdded = True
+ if Name in self.OrderedStringDict[Language]:
+ IsAdded = False
+ if Value is not None:
+ ItemIndexInList = self.OrderedStringDict[Language][Name]
+ Item = self.OrderedStringList[Language][ItemIndexInList]
+ Item.UpdateValue(Value)
+ Item.UseOtherLangDef = ''
+
+ if IsAdded:
+ Token = len(self.OrderedStringList[Language])
+ if Index == -1:
+ self.OrderedStringList[Language].append(StringDefClassObject(Name,
+ Value,
+ Referenced,
+ Token,
+ UseOtherLangDef))
+ self.OrderedStringDict[Language][Name] = Token
+ for LangName in self.LanguageDef:
+ #
+ # New STRING token will be added into all language string lists.
+ # so that the unique STRING identifier is reserved for all languages in the package list.
+ #
+ if LangName[0] != Language:
+ if UseOtherLangDef != '':
+ OtherLangDef = UseOtherLangDef
+ else:
+ OtherLangDef = Language
+ self.OrderedStringList[LangName[0]].append(StringDefClassObject(Name,
+ '',
+ Referenced,
+ Token,
+ OtherLangDef))
+ self.OrderedStringDict[LangName[0]][Name] = len(self.OrderedStringList[LangName[0]]) - 1
+ else:
+ self.OrderedStringList[Language].insert(Index, StringDefClassObject(Name,
+ Value,
+ Referenced,
+ Token,
+ UseOtherLangDef))
+ self.OrderedStringDict[Language][Name] = Index
+
+ #
+ # Set the string as referenced
+ #
+ def SetStringReferenced(self, Name):
+ #
+ # String stoken are added in the same order in all language string lists.
+ # So, only update the status of string stoken in first language string list.
+ #
+ Lang = self.LanguageDef[0][0]
+ if Name in self.OrderedStringDict[Lang]:
+ ItemIndexInList = self.OrderedStringDict[Lang][Name]
+ Item = self.OrderedStringList[Lang][ItemIndexInList]
+ Item.Referenced = True
+
+ #
+ # Search the string in language definition by Name
+ #
+ def FindStringValue(self, Name, Lang):
+ if Name in self.OrderedStringDict[Lang]:
+ ItemIndexInList = self.OrderedStringDict[Lang][Name]
+ return self.OrderedStringList[Lang][ItemIndexInList]
+
+ return None
+
+ #
+ # Search the string in language definition by Token
+ #
+ def FindByToken(self, Token, Lang):
+ for Item in self.OrderedStringList[Lang]:
+ if Item.Token == Token:
+ return Item
+
+ return None
+
+ #
+ # Re-order strings and re-generate tokens
+ #
+ def ReToken(self):
+ if len(self.LanguageDef) == 0:
+ return None
+ #
+ # Retoken all language strings according to the status of string stoken in the first language string.
+ #
+ FirstLangName = self.LanguageDef[0][0]
+
+ # Convert the OrderedStringList to be OrderedStringListByToken in order to faciliate future search by token
+ for LangNameItem in self.LanguageDef:
+ self.OrderedStringListByToken[LangNameItem[0]] = {}
+
+ #
+ # Use small token for all referred string stoken.
+ #
+ RefToken = 0
+ for Index in range (0, len (self.OrderedStringList[FirstLangName])):
+ FirstLangItem = self.OrderedStringList[FirstLangName][Index]
+ if FirstLangItem.Referenced == True:
+ for LangNameItem in self.LanguageDef:
+ LangName = LangNameItem[0]
+ OtherLangItem = self.OrderedStringList[LangName][Index]
+ OtherLangItem.Referenced = True
+ OtherLangItem.Token = RefToken
+ self.OrderedStringListByToken[LangName][OtherLangItem.Token] = OtherLangItem
+ RefToken = RefToken + 1
+
+ #
+ # Use big token for all unreferred string stoken.
+ #
+ UnRefToken = 0
+ for Index in range (0, len (self.OrderedStringList[FirstLangName])):
+ FirstLangItem = self.OrderedStringList[FirstLangName][Index]
+ if FirstLangItem.Referenced == False:
+ for LangNameItem in self.LanguageDef:
+ LangName = LangNameItem[0]
+ OtherLangItem = self.OrderedStringList[LangName][Index]
+ OtherLangItem.Token = RefToken + UnRefToken
+ self.OrderedStringListByToken[LangName][OtherLangItem.Token] = OtherLangItem
+ UnRefToken = UnRefToken + 1
+
+ #
+ # Show the instance itself
+ #
+ def ShowMe(self):
+ print(self.LanguageDef)
+ #print self.OrderedStringList
+ for Item in self.OrderedStringList:
+ print(Item)
+ for Member in self.OrderedStringList[Item]:
+ print(str(Member))
+
+ #
+ # Read content from '!include' UNI file
+ #
+ def ReadIncludeUNIfile(self, FilaPath):
+ if self.File:
+ pass
+
+ if not os.path.exists(FilaPath) or not os.path.isfile(FilaPath):
+ EdkLogger.Error("Unicode File Parser",
+ ToolError.FILE_NOT_FOUND,
+ ExtraData=FilaPath)
+ try:
+ FileIn = codecs.open(FilaPath, mode='rb', encoding='utf_8').readlines()
+ except UnicodeError as Xstr:
+ FileIn = codecs.open(FilaPath, mode='rb', encoding='utf_16').readlines()
+ except UnicodeError:
+ FileIn = codecs.open(FilaPath, mode='rb', encoding='utf_16_le').readlines()
+ except:
+ EdkLogger.Error("Unicode File Parser", ToolError.FILE_OPEN_FAILURE, ExtraData=FilaPath)
+ return FileIn
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Library/Xml/XmlRoutines.py b/roms/edk2/BaseTools/Source/Python/UPT/Library/Xml/XmlRoutines.py
new file mode 100644
index 000000000..94e97fa45
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Library/Xml/XmlRoutines.py
@@ -0,0 +1,223 @@
+## @file
+# This is an XML API that uses a syntax similar to XPath, but it is written in
+# standard python so that no extra python packages are required to use it.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+XmlRoutines
+'''
+
+##
+# Import Modules
+#
+import xml.dom.minidom
+import re
+import codecs
+from Logger.ToolError import PARSER_ERROR
+import Logger.Log as Logger
+
+## Create a element of XML
+#
+# @param Name
+# @param String
+# @param NodeList
+# @param AttributeList
+#
+def CreateXmlElement(Name, String, NodeList, AttributeList):
+ Doc = xml.dom.minidom.Document()
+ Element = Doc.createElement(Name)
+ if String != '' and String is not None:
+ Element.appendChild(Doc.createTextNode(String))
+
+ for Item in NodeList:
+ if isinstance(Item, type([])):
+ Key = Item[0]
+ Value = Item[1]
+ if Key != '' and Key is not None and Value != '' and Value is not None:
+ Node = Doc.createElement(Key)
+ Node.appendChild(Doc.createTextNode(Value))
+ Element.appendChild(Node)
+ else:
+ Element.appendChild(Item)
+ for Item in AttributeList:
+ Key = Item[0]
+ Value = Item[1]
+ if Key != '' and Key is not None and Value != '' and Value is not None:
+ Element.setAttribute(Key, Value)
+
+ return Element
+
+## Get a list of XML nodes using XPath style syntax.
+#
+# Return a list of XML DOM nodes from the root Dom specified by XPath String.
+# If the input Dom or String is not valid, then an empty list is returned.
+#
+# @param Dom The root XML DOM node.
+# @param String A XPath style path.
+#
+def XmlList(Dom, String):
+ if String is None or String == "" or Dom is None or Dom == "":
+ return []
+ if Dom.nodeType == Dom.DOCUMENT_NODE:
+ Dom = Dom.documentElement
+ if String[0] == "/":
+ String = String[1:]
+ TagList = String.split('/')
+ Nodes = [Dom]
+ Index = 0
+ End = len(TagList) - 1
+ while Index <= End:
+ ChildNodes = []
+ for Node in Nodes:
+ if Node.nodeType == Node.ELEMENT_NODE and Node.tagName == \
+ TagList[Index]:
+ if Index < End:
+ ChildNodes.extend(Node.childNodes)
+ else:
+ ChildNodes.append(Node)
+ Nodes = ChildNodes
+ ChildNodes = []
+ Index += 1
+
+ return Nodes
+
+
+## Get a single XML node using XPath style syntax.
+#
+# Return a single XML DOM node from the root Dom specified by XPath String.
+# If the input Dom or String is not valid, then an empty string is returned.
+#
+# @param Dom The root XML DOM node.
+# @param String A XPath style path.
+#
+def XmlNode(Dom, String):
+ if String is None or String == "" or Dom is None or Dom == "":
+ return None
+ if Dom.nodeType == Dom.DOCUMENT_NODE:
+ Dom = Dom.documentElement
+ if String[0] == "/":
+ String = String[1:]
+ TagList = String.split('/')
+ Index = 0
+ End = len(TagList) - 1
+ ChildNodes = [Dom]
+ while Index <= End:
+ for Node in ChildNodes:
+ if Node.nodeType == Node.ELEMENT_NODE and \
+ Node.tagName == TagList[Index]:
+ if Index < End:
+ ChildNodes = Node.childNodes
+ else:
+ return Node
+ break
+ Index += 1
+ return None
+
+
+## Get a single XML element using XPath style syntax.
+#
+# Return a single XML element from the root Dom specified by XPath String.
+# If the input Dom or String is not valid, then an empty string is returned.
+#
+# @param Dom The root XML DOM object.
+# @param Strin A XPath style path.
+#
+def XmlElement(Dom, String):
+ try:
+ return XmlNode(Dom, String).firstChild.data.strip()
+ except BaseException:
+ return ""
+
+## Get a single XML element using XPath style syntax.
+#
+# Similar with XmlElement, but do not strip all the leading and tailing space
+# and newline, instead just remove the newline and spaces introduced by
+# toprettyxml()
+#
+# @param Dom The root XML DOM object.
+# @param Strin A XPath style path.
+#
+def XmlElement2(Dom, String):
+ try:
+ HelpStr = XmlNode(Dom, String).firstChild.data
+ gRemovePrettyRe = re.compile(r"""(?:(\n *) )(.*)\1""", re.DOTALL)
+ HelpStr = re.sub(gRemovePrettyRe, r"\2", HelpStr)
+ return HelpStr
+ except BaseException:
+ return ""
+
+
+## Get a single XML element of the current node.
+#
+# Return a single XML element specified by the current root Dom.
+# If the input Dom is not valid, then an empty string is returned.
+#
+# @param Dom The root XML DOM object.
+#
+def XmlElementData(Dom):
+ try:
+ return Dom.firstChild.data.strip()
+ except BaseException:
+ return ""
+
+
+## Get a list of XML elements using XPath style syntax.
+#
+# Return a list of XML elements from the root Dom specified by XPath String.
+# If the input Dom or String is not valid, then an empty list is returned.
+#
+# @param Dom The root XML DOM object.
+# @param String A XPath style path.
+#
+def XmlElementList(Dom, String):
+ return list(map(XmlElementData, XmlList(Dom, String)))
+
+
+## Get the XML attribute of the current node.
+#
+# Return a single XML attribute named Attribute from the current root Dom.
+# If the input Dom or Attribute is not valid, then an empty string is returned.
+#
+# @param Dom The root XML DOM object.
+# @param Attribute The name of Attribute.
+#
+def XmlAttribute(Dom, Attribute):
+ try:
+ return Dom.getAttribute(Attribute)
+ except BaseException:
+ return ''
+
+
+## Get the XML node name of the current node.
+#
+# Return a single XML node name from the current root Dom.
+# If the input Dom is not valid, then an empty string is returned.
+#
+# @param Dom The root XML DOM object.
+#
+def XmlNodeName(Dom):
+ try:
+ return Dom.nodeName.strip()
+ except BaseException:
+ return ''
+
+## Parse an XML file.
+#
+# Parse the input XML file named FileName and return a XML DOM it stands for.
+# If the input File is not a valid XML file, then an empty string is returned.
+#
+# @param FileName The XML file name.
+#
+def XmlParseFile(FileName):
+ try:
+ XmlFile = codecs.open(FileName, 'rb')
+ Dom = xml.dom.minidom.parse(XmlFile)
+ XmlFile.close()
+ return Dom
+ except BaseException as XExcept:
+ XmlFile.close()
+ Logger.Error('\nUPT', PARSER_ERROR, XExcept, File=FileName, RaiseError=True)
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Library/Xml/__init__.py b/roms/edk2/BaseTools/Source/Python/UPT/Library/Xml/__init__.py
new file mode 100644
index 000000000..172e49845
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Library/Xml/__init__.py
@@ -0,0 +1,14 @@
+## @file
+# Python 'Library' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Xml
+'''
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Library/__init__.py b/roms/edk2/BaseTools/Source/Python/UPT/Library/__init__.py
new file mode 100644
index 000000000..07b5b75dd
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Library/__init__.py
@@ -0,0 +1,14 @@
+## @file
+# Python 'Library' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Library
+'''
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Logger/Log.py b/roms/edk2/BaseTools/Source/Python/UPT/Logger/Log.py
new file mode 100644
index 000000000..a2e32a623
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Logger/Log.py
@@ -0,0 +1,319 @@
+## @file
+# This file implements the log mechanism for Python tools.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Logger
+'''
+
+## Import modules
+from sys import argv
+from sys import stdout
+from sys import stderr
+import os.path
+from os import remove
+from logging import getLogger
+from logging import Formatter
+from logging import StreamHandler
+from logging import FileHandler
+from traceback import extract_stack
+
+from Logger.ToolError import FatalError
+from Logger.ToolError import WARNING_AS_ERROR
+from Logger.ToolError import gERROR_MESSAGE
+from Logger.ToolError import UNKNOWN_ERROR
+from Library import GlobalData
+
+#
+# Log level constants
+#
+DEBUG_0 = 1
+DEBUG_1 = 2
+DEBUG_2 = 3
+DEBUG_3 = 4
+DEBUG_4 = 5
+DEBUG_5 = 6
+DEBUG_6 = 7
+DEBUG_7 = 8
+DEBUG_8 = 9
+DEBUG_9 = 10
+VERBOSE = 15
+INFO = 20
+WARN = 30
+QUIET = 40
+QUIET_1 = 41
+ERROR = 50
+SILENT = 60
+
+IS_RAISE_ERROR = True
+SUPRESS_ERROR = False
+
+#
+# Tool name
+#
+_TOOL_NAME = os.path.basename(argv[0])
+#
+# For validation purpose
+#
+_LOG_LEVELS = [DEBUG_0, DEBUG_1, DEBUG_2, DEBUG_3, DEBUG_4, DEBUG_5, DEBUG_6, \
+ DEBUG_7, DEBUG_8, DEBUG_9, VERBOSE, WARN, INFO, ERROR, QUIET, \
+ QUIET_1, SILENT]
+#
+# For DEBUG level (All DEBUG_0~9 are applicable)
+#
+_DEBUG_LOGGER = getLogger("tool_debug")
+_DEBUG_FORMATTER = Formatter("[%(asctime)s.%(msecs)d]: %(message)s", \
+ datefmt="%H:%M:%S")
+#
+# For VERBOSE, INFO, WARN level
+#
+_INFO_LOGGER = getLogger("tool_info")
+_INFO_FORMATTER = Formatter("%(message)s")
+#
+# For ERROR level
+#
+_ERROR_LOGGER = getLogger("tool_error")
+_ERROR_FORMATTER = Formatter("%(message)s")
+
+#
+# String templates for ERROR/WARN/DEBUG log message
+#
+_ERROR_MESSAGE_TEMPLATE = \
+('\n\n%(tool)s...\n%(file)s(%(line)s): error %(errorcode)04X: %(msg)s\n\t%(extra)s')
+
+__ERROR_MESSAGE_TEMPLATE_WITHOUT_FILE = \
+'\n\n%(tool)s...\n : error %(errorcode)04X: %(msg)s\n\t%(extra)s'
+
+_WARNING_MESSAGE_TEMPLATE = '%(tool)s...\n%(file)s(%(line)s): warning: %(msg)s'
+_WARNING_MESSAGE_TEMPLATE_WITHOUT_FILE = '%(tool)s: : warning: %(msg)s'
+_DEBUG_MESSAGE_TEMPLATE = '%(file)s(%(line)s): debug: \n %(msg)s'
+
+
+#
+# Log INFO message
+#
+#Info = _INFO_LOGGER.info
+
+def Info(msg, *args, **kwargs):
+ _INFO_LOGGER.info(msg, *args, **kwargs)
+
+#
+# Log information which should be always put out
+#
+def Quiet(msg, *args, **kwargs):
+ _ERROR_LOGGER.error(msg, *args, **kwargs)
+
+## Log debug message
+#
+# @param Level DEBUG level (DEBUG0~9)
+# @param Message Debug information
+# @param ExtraData More information associated with "Message"
+#
+def Debug(Level, Message, ExtraData=None):
+ if _DEBUG_LOGGER.level > Level:
+ return
+ if Level > DEBUG_9:
+ return
+ #
+ # Find out the caller method information
+ #
+ CallerStack = extract_stack()[-2]
+ TemplateDict = {
+ "file" : CallerStack[0],
+ "line" : CallerStack[1],
+ "msg" : Message,
+ }
+
+ if ExtraData is not None:
+ LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict + "\n %s" % ExtraData
+ else:
+ LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict
+
+ _DEBUG_LOGGER.log(Level, LogText)
+
+## Log verbose message
+#
+# @param Message Verbose information
+#
+def Verbose(Message):
+ return _INFO_LOGGER.log(VERBOSE, Message)
+
+## Log warning message
+#
+# Warning messages are those which might be wrong but won't fail the tool.
+#
+# @param ToolName The name of the tool. If not given, the name of caller
+# method will be used.
+# @param Message Warning information
+# @param File The name of file which caused the warning.
+# @param Line The line number in the "File" which caused the warning.
+# @param ExtraData More information associated with "Message"
+#
+def Warn(ToolName, Message, File=None, Line=None, ExtraData=None):
+ if _INFO_LOGGER.level > WARN:
+ return
+ #
+ # if no tool name given, use caller's source file name as tool name
+ #
+ if ToolName is None or ToolName == "":
+ ToolName = os.path.basename(extract_stack()[-2][0])
+
+ if Line is None:
+ Line = "..."
+ else:
+ Line = "%d" % Line
+
+ TemplateDict = {
+ "tool" : ToolName,
+ "file" : File,
+ "line" : Line,
+ "msg" : Message,
+ }
+
+ if File is not None:
+ LogText = _WARNING_MESSAGE_TEMPLATE % TemplateDict
+ else:
+ LogText = _WARNING_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict
+
+ if ExtraData is not None:
+ LogText += "\n %s" % ExtraData
+
+ _INFO_LOGGER.log(WARN, LogText)
+ #
+ # Raise an exception if indicated
+ #
+ if GlobalData.gWARNING_AS_ERROR == True:
+ raise FatalError(WARNING_AS_ERROR)
+
+## Log ERROR message
+#
+# Once an error messages is logged, the tool's execution will be broken by
+# raising an exception. If you don't want to break the execution later, you
+# can give "RaiseError" with "False" value.
+#
+# @param ToolName The name of the tool. If not given, the name of caller
+# method will be used.
+# @param ErrorCode The error code
+# @param Message Warning information
+# @param File The name of file which caused the error.
+# @param Line The line number in the "File" which caused the warning.
+# @param ExtraData More information associated with "Message"
+# @param RaiseError Raise an exception to break the tool's execution if
+# it's True. This is the default behavior.
+#
+def Error(ToolName, ErrorCode, Message=None, File=None, Line=None, \
+ ExtraData=None, RaiseError=IS_RAISE_ERROR):
+ if ToolName:
+ pass
+ if Line is None:
+ Line = "..."
+ else:
+ Line = "%d" % Line
+
+ if Message is None:
+ if ErrorCode in gERROR_MESSAGE:
+ Message = gERROR_MESSAGE[ErrorCode]
+ else:
+ Message = gERROR_MESSAGE[UNKNOWN_ERROR]
+
+ if ExtraData is None:
+ ExtraData = ""
+
+ TemplateDict = {
+ "tool" : _TOOL_NAME,
+ "file" : File,
+ "line" : Line,
+ "errorcode" : ErrorCode,
+ "msg" : Message,
+ "extra" : ExtraData
+ }
+
+ if File is not None:
+ LogText = _ERROR_MESSAGE_TEMPLATE % TemplateDict
+ else:
+ LogText = __ERROR_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict
+
+ if not SUPRESS_ERROR:
+ _ERROR_LOGGER.log(ERROR, LogText)
+ if RaiseError:
+ raise FatalError(ErrorCode)
+
+
+## Initialize log system
+#
+def Initialize():
+ #
+ # Since we use different format to log different levels of message into
+ # different place (stdout or stderr), we have to use different "Logger"
+ # objects to do this.
+ #
+ # For DEBUG level (All DEBUG_0~9 are applicable)
+ _DEBUG_LOGGER.setLevel(INFO)
+ _DebugChannel = StreamHandler(stdout)
+ _DebugChannel.setFormatter(_DEBUG_FORMATTER)
+ _DEBUG_LOGGER.addHandler(_DebugChannel)
+ #
+ # For VERBOSE, INFO, WARN level
+ #
+ _INFO_LOGGER.setLevel(INFO)
+ _InfoChannel = StreamHandler(stdout)
+ _InfoChannel.setFormatter(_INFO_FORMATTER)
+ _INFO_LOGGER.addHandler(_InfoChannel)
+ #
+ # For ERROR level
+ #
+ _ERROR_LOGGER.setLevel(INFO)
+ _ErrorCh = StreamHandler(stderr)
+ _ErrorCh.setFormatter(_ERROR_FORMATTER)
+ _ERROR_LOGGER.addHandler(_ErrorCh)
+
+
+## Set log level
+#
+# @param Level One of log level in _LogLevel
+#
+def SetLevel(Level):
+ if Level not in _LOG_LEVELS:
+ Info("Not supported log level (%d). Use default level instead." % \
+ Level)
+ Level = INFO
+ _DEBUG_LOGGER.setLevel(Level)
+ _INFO_LOGGER.setLevel(Level)
+ _ERROR_LOGGER.setLevel(Level)
+
+## Get current log level
+#
+def GetLevel():
+ return _INFO_LOGGER.getEffectiveLevel()
+
+## Raise up warning as error
+#
+def SetWarningAsError():
+ GlobalData.gWARNING_AS_ERROR = True
+
+## Specify a file to store the log message as well as put on console
+#
+# @param LogFile The file path used to store the log message
+#
+def SetLogFile(LogFile):
+ if os.path.exists(LogFile):
+ remove(LogFile)
+
+ _Ch = FileHandler(LogFile)
+ _Ch.setFormatter(_DEBUG_FORMATTER)
+ _DEBUG_LOGGER.addHandler(_Ch)
+
+ _Ch = FileHandler(LogFile)
+ _Ch.setFormatter(_INFO_FORMATTER)
+ _INFO_LOGGER.addHandler(_Ch)
+
+ _Ch = FileHandler(LogFile)
+ _Ch.setFormatter(_ERROR_FORMATTER)
+ _ERROR_LOGGER.addHandler(_Ch)
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Logger/StringTable.py b/roms/edk2/BaseTools/Source/Python/UPT/Logger/StringTable.py
new file mode 100644
index 000000000..13c015844
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Logger/StringTable.py
@@ -0,0 +1,860 @@
+## @file
+# This file is used to define strings used in the UPT tool
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+"""
+This file contains user visible strings in a format that can be used for
+localization
+"""
+
+import gettext
+
+#
+# string table starts here...
+#
+
+## strings are classified as following types
+# MSG_...: it is a message string
+# ERR_...: it is a error string
+# WRN_...: it is a warning string
+# HLP_...: it is a help string
+#
+
+_ = gettext.gettext
+
+MSG_USAGE_STRING = _("\n"
+ "UEFI Packaging Tool (UEFIPT)\n"
+ "%prog [options]"
+ )
+
+##
+# Version and Copyright
+#
+MSG_VERSION_NUMBER = _("1.1")
+MSG_VERSION = _("UEFI Packaging Tool (UEFIPT) - Revision " + \
+ MSG_VERSION_NUMBER)
+MSG_COPYRIGHT = _("Copyright (c) 2011 - 2018 Intel Corporation All Rights Reserved.")
+MSG_VERSION_COPYRIGHT = _("\n %s\n %s" % (MSG_VERSION, MSG_COPYRIGHT))
+MSG_USAGE = _("%s [options]\n%s" % ("UPT", MSG_VERSION_COPYRIGHT))
+MSG_DESCRIPTION = _("The UEFIPT is used to create, " + \
+ "install or remove a UEFI Distribution Package. " + \
+ "If WORKSPACE environment variable is present, " + \
+ "then UPT will install packages to the location specified by WORKSPACE, " + \
+ "otherwise UPT will install packages to the current directory. " + \
+ "Option -n will override this default installation location")
+
+#
+# INF Parser related strings.
+#
+ERR_INF_PARSER_HEADER_FILE = _(
+ "The Header comment section should start with an @file at the top.")
+ERR_INF_PARSER_HEADER_MISSGING = _(
+ "The Header comment is missing. It must be corrected before continuing.")
+ERR_INF_PARSER_UNKNOWN_SECTION = _("An unknown section was found. "
+ "It must be corrected before continuing. ")
+ERR_INF_PARSER_NO_SECTION_ERROR = _("No section was found. "
+ "A section must be included before continuing.")
+ERR_INF_PARSER_BUILD_OPTION_FORMAT_INVALID = \
+ _("Build Option format incorrect.")
+ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID = _(
+ "The format of binary %s item is incorrect. "
+ "It should contain at least %d elements.")
+ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID_MAX = _(
+ "The format of binary %s item is invalid, "
+ "it should contain not more than %d elements.")
+ERR_INF_PARSER_BINARY_ITEM_INVALID_FILETYPE = _(
+ "The Binary FileType is incorrect. It should in %s")
+ERR_INF_PARSER_BINARY_ITEM_FILE_NOT_EXIST = _(
+ "The Binary File: %s not exist.")
+ERR_INF_PARSER_BINARY_ITEM_FILENAME_NOT_EXIST = _(
+ "The Binary File Name item not exist")
+ERR_INF_PARSER_BINARY_VER_TYPE = _(
+ "Only this type is allowed: \"%s\".")
+ERR_INF_PARSER_MULTI_DEFINE_SECTION = \
+ _("Multiple define sections found. "
+ "It must be corrected before continuing.")
+ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND = \
+ _("More than 1 %s is defined in DEFINES section. "
+ "It must be corrected before continuing.")
+ERR_INF_PARSER_DEFINE_NAME_INVALID = \
+ _("Incorrect name format for : %s")
+ERR_INF_PARSER_DEFINE_GUID_INVALID = \
+ _("The format of this GUID is incorrect: %s")
+ERR_INF_PARSER_DEFINE_MODULETYPE_INVALID = _("Incorrect MODULE_TYPE: %s")
+ERR_INF_PARSER_DEFINE_FROMAT_INVALID = _("Incorrect format: %s")
+ERR_INF_PARSER_FILE_NOT_EXIST = _("This file does not exist: %s")
+ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID = \
+ _("The file does not exist or not in sub-directories "
+ "or has an incorrect file name of the directory containing the INF or DEC file: %s. "
+ "It must be corrected before continuing")
+ERR_INF_PARSER_DEFINE_SHADOW_INVALID = \
+ _("The SHADOW keyword is only valid for"
+ " SEC, PEI_CORE and PEIM module types.")
+ERR_INF_PARSER_DEFINE_SECTION_HEADER_INVALID = \
+ _("The format of the section header is incorrect")
+ERR_INF_PARSER_DEPEX_SECTION_INVALID = \
+ _("A module can't have a Depex section when its module type is %s")
+ERR_INF_PARSER_DEPEX_SECTION_INVALID_FOR_BASE_LIBRARY_CLASS = \
+ _("A base type library class can't have a Depex section with module type not defined.")
+ERR_INF_PARSER_DEPEX_SECTION_INVALID_FOR_LIBRARY_CLASS = \
+ _("A library class can't have a Depex section when its supported module type list is not defined.")
+ERR_INF_PARSER_DEPEX_SECTION_INVALID_FOR_DRIVER = \
+ _("A driver can't have a Depex section when its module type is UEFI_DRIVER.")
+ERR_INF_PARSER_DEPEX_SECTION_NOT_DETERMINED = \
+ _("Cannot determine the module's Depex type. The Depex's module types are conflict")
+ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST = _(
+ "No %s found in INF file, please check it.")
+ERR_INF_PARSER_DEPEX_SECTION_MODULE_TYPE_ERROR = \
+ _("The module type of [Depex] section is invalid, not support type of %s")
+ERR_INF_PARSER_DEPEX_SECTION_CONTENT_MISSING = \
+ _("Missing content in: %s")
+ERR_INF_PARSER_DEPEX_SECTION_CONTENT_ERROR = \
+ _("The [Depex] section contains invalid content: %s")
+ERR_INF_PARSER_DEPEX_SECTION_SEC_TYPE_ERROR = \
+ _("The format is incorrect. The section type keyword of the content in the"
+ " [Depex] section is only for 'PEI_DEPEX', 'DXE_DEPEX', 'SMM_DEPEX', "
+ "it does not support type: %s")
+ERR_INF_PARSER_UE_SECTION_USER_ID_ERROR = \
+ _("This format is incorrect. "
+ "The UserID: %s in [UserExtension] section is incorrect.")
+ERR_INF_PARSER_UE_SECTION_ID_STRING_ERROR = \
+ _("This format is incorrect. "
+ "IdString: %s in [UserExtension] section is incorrect.")
+ERR_INF_PARSER_LIBRARY_SECTION_CONTENT_ERROR = \
+ _("The format is incorrect. "
+ "You can only have a Library name and a Feature flag in one line.")
+ERR_INF_PARSER_LIBRARY_SECTION_LIBNAME_MISSING = \
+ _("Format invalid. Please specify a library name.")
+ERR_INF_PARSER_SOURCES_SECTION_CONTENT_ERROR = \
+ _("The format is incorrect. It should be formatted as follows: "
+ "FileName, Family | TagName | ToolCode | FeatureFlagExpr.")
+ERR_INF_PARSER_PCD_SECTION_TYPE_ERROR = \
+ _("The PCD section type is incorrect. The value should be this list: %s")
+ERR_INF_PARSER_PCD_SECTION_CONTENT_ERROR = \
+ _("PcdName format invalid."
+ "Should like following: PcdName | Value | FeatureFlag.")
+ERR_INF_PARSER_PCD_NAME_FORMAT_ERROR = \
+ _("Format invalid."
+ "Should like following: <TokenSpaceGuidCName>.<PcdCName> ")
+ERR_INF_PARSER_GUID_PPI_PROTOCOL_SECTION_CONTENT_ERROR = \
+ _("The format is incorrect. "
+ "It should be formatted as follows: CName | FeatureFlag.")
+ERR_INF_PARSER_PACKAGE_SECTION_CONTENT_ERROR = \
+ _("The format is incorrect. "
+ "It should be formatted as follows: <TokenSpaceGuidCName>.<PcdCName>")
+ERR_INF_PARSER_PCD_TAIL_COMMENTS_INVALID = \
+ _("The format is incorrect. "
+ "Multiple usage descriptions must be described on subsequent lines.")
+ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR = \
+ _("This section format is incorrect: %s.")
+ERR_INF_PARSER_SECTION_NAME_DUPLICATE = \
+ _("This section has multiple section names, "
+ "only one section name is permitted.")
+ERR_INF_PARSER_SECTION_ARCH_CONFLICT = \
+ _("The 'common' ARCH must not be used with the specified ARCHs.")
+ERR_INF_PARSER_SOURCE_SECTION_TAGNAME_INVALID = \
+ _("This TagName is incorrect: %s. "
+ "It must be corrected before continuing.")
+ERR_INF_PARSER_TAGNAME_NOT_PERMITTED = \
+ _("TagName is not permitted: %s. "
+ "It must be corrected before continuing.")
+ERR_INF_PARSER_TOOLCODE_NOT_PERMITTED = \
+ _("ToolCode is not permitted: %s. "
+ "It must be corrected before continuing.")
+ERR_INF_PARSER_SOURCE_SECTION_FAMILY_INVALID = \
+ _("This family is incorrect: %s. "
+ "It must be corrected before continuing. ")
+ERR_INF_PARSER_SOURCE_SECTION_SECTIONNAME_INVALID = \
+ _("This SectionName is incorrect: %s. "
+ "It must be corrected before continuing.")
+ERR_INF_PARSER_PCD_CVAR_GUID = \
+ _("TokenSpaceGuidCName must be valid C variable format.")
+ERR_INF_PARSER_PCD_CVAR_PCDCNAME = \
+ _("PcdCName must be valid C variable format.")
+ERR_INF_PARSER_PCD_VALUE_INVALID = \
+ _("The PCD value is incorrect. It must be corrected before continuing.")
+ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID = \
+ _("Incorrect feature flag expression: %s")
+ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING = \
+ _("The feature flag expression is missing. Please specify a feature flag.")
+ERR_INF_PARSER_INVALID_CNAME = \
+ _("Incorrect CName: %s. You must specify a valid C variable name.")
+ERR_INF_PARSER_CNAME_MISSING = \
+ _("Missing CName. Specify a valid C variable name.")
+ERR_INF_PARSER_DEFINE_SECTION_KEYWORD_INVALID = \
+ _("The Define section contains an invalid keyword: \"%s\"."
+ "It must be corrected before continuing.")
+ERR_INF_PARSER_FILE_MISS_DEFINE = \
+ _("The following file listed in the module "
+ "directory is not listed in the INF: %s")
+ERR_INF_PARSER_VERSION_NUMBER_DEPRICATED = \
+ _("VERSION_NUMBER deprecated. "
+ "The INF file %s should be modified to use the VERSION_STRING instead.")
+ERR_INF_PARSER_VER_EXIST_BOTH_NUM_STR = \
+ _("The INF file %s defines both VERSION_NUMBER and VERSION_STRING, "
+ "using VERSION_STRING")
+ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF = _("EDKI INF is not supported")
+ERR_INF_PARSER_EDKI_COMMENT_IN_EDKII = _("The EDKI style comment is not supported in EDKII modules")
+
+ERR_INF_PARSER_FEATUREPCD_USAGE_INVALID = _("The usage for FeaturePcd can only"
+ " be type of \"CONSUMES\".")
+
+ERR_INF_PARSER_DEFINE_ITEM_NO_NAME = _("No name specified")
+ERR_INF_PARSER_DEFINE_ITEM_NO_VALUE = _("No value specified")
+
+ERR_INF_PARSER_MODULETYPE_INVALID = _("Drivers and applications are not allowed to have a MODULE_TYPE of \"BASE\". "
+"Only libraries are permitted to a have a MODULE_TYPE of \"BASE\".")
+ERR_INF_GET_PKG_DEPENDENCY_FAIL = _("Failed to get PackageDependencies information from file %s")
+ERR_INF_NO_PKG_DEPENDENCY_INFO = _("There are no packages defined that use the AsBuilt PCD information.")
+
+#
+# Item duplicate
+#
+ERR_INF_PARSER_ITEM_DUPLICATE_IN_DEC = \
+_('"%s" is redefined in its dependent DEC files')
+ERR_INF_PARSER_ITEM_DUPLICATE = _("%s define duplicated! "
+ "It must be corrected before continuing.")
+ERR_INF_PARSER_ITEM_DUPLICATE_COMMON = _("%s define duplicated! Item listed"
+"in an architectural section must not be listed in the common architectural"
+"section.It must be corrected before continuing.")
+ERR_INF_PARSER_UE_SECTION_DUPLICATE_ERROR = \
+_("%s define duplicated! Each UserExtensions section header must have a "
+ "unique set of UserId, IdString and Arch values. "
+ "It must be corrected before continuing.")
+
+ERR_INF_PARSER_DEFINE_LIB_NAME_INVALID = \
+_("The name 'NULL' for LibraryClass is a reserved word."
+"Please don't use it.")
+
+ERR_GLOBAL_MARCO_INVALID = \
+_("Using global MACRO in INF/DEC is not permitted: %s . "
+"It must be corrected before continuing.")
+
+ERR_MARCO_DEFINITION_MISS_ERROR = \
+_("MACRO expand incorrectly, can not find the MACRO definition. "
+"It must be corrected before continuing.")
+
+#
+# AsBuilt related
+#
+ERR_LIB_CONTATIN_ASBUILD_AND_COMMON = _("A binary INF file should not contain both AsBuilt LIB_INSTANCES information "
+ "and a common library entry.")
+ERR_LIB_INSTANCE_MISS_GUID = _("Could not get FILE_GUID definition from instance INF file.")
+
+ERR_BO_CONTATIN_ASBUILD_AND_COMMON = _("A binary INF file should contain either AsBuilt information "
+ "or a common build option entry, not both.")
+
+ERR_ASBUILD_PCD_SECTION_TYPE = _("The AsBuilt INF file contains a PCD section type that is not permitted: %s.")
+ERR_ASBUILD_PATCHPCD_FORMAT_INVALID = _("The AsBuilt PatchPcd entry must contain 3 elements: PcdName|Value|Offset")
+ERR_ASBUILD_PCDEX_FORMAT_INVALID = _("The AsBuilt PcdEx entry must contain one element: PcdName")
+ERR_ASBUILD_PCD_VALUE_INVALID = \
+ _("The AsBuilt PCD value %s is incorrect or not align with its datum type %s. "
+ "It must be corrected before continuing.")
+ERR_ASBUILD_PCD_TOKENSPACE_GUID_VALUE_MISS = _("Package file value could not be retrieved for %s.")
+ERR_ASBUILD_PCD_DECLARITION_MISS = _("PCD Declaration in DEC files could not be found for: %s.")
+ERR_ASBUILD_PCD_OFFSET_FORMAT_INVALID = _("PCD offset format invalid, number of (0-4294967295) or"
+"Hex number of UINT32 allowed : %s.")
+
+#
+# XML parser related strings
+#
+ERR_XML_PARSER_REQUIRED_ITEM_MISSING = \
+ _("The XML section/attribute '%s' is required under %s, it can't be missing or empty")
+ERR_XML_INVALID_VARIABLENAME = \
+ _("The VariableName of the GUID in the XML tree does not conform to the packaging specification. "
+ "Only a Hex Byte Array of UCS-2 format or L\"string\" is allowed): %s %s %s")
+ERR_XML_INVALID_LIB_SUPMODLIST = _("The LIBRARY_CLASS entry %s must have the list appended using the format as: \n"
+"BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER SMM_CORE DXE_SMM_DRIVER DXE_RUNTIME_DRIVER "
+"DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION USER_DEFINED\n Current is %s.")
+ERR_XML_INVALID_EXTERN_SUPARCHLIST = \
+ _("There is a mismatch of SupArchList %s between the EntryPoint, UnloadImage, Constructor, "
+ "and Destructor elements in the ModuleSurfaceArea.ModuleProperties: SupArchList: %s. ")
+ERR_XML_INVALID_EXTERN_SUPMODLIST = _("The SupModList attribute of the CONSTRUCTOR or DESTRUCTOR element: %s does not "
+"match the Supported Module Types listed after LIBRARY_CLASS = <Keyword> | %s")
+ERR_XML_INVALID_EXTERN_SUPMODLIST_NOT_LIB = _("The module is not a library module. "
+ "The MODULE_TYPE : %s listed in the ModuleSurfaceArea.Header "
+ "must match the SupModList attribute %s")
+ERR_XML_INVALID_BINARY_FILE_TYPE = _("Invalid binary file type %s.")
+
+#
+# Verbosity related strings.
+#
+MSG_DISTRIBUTION_PACKAGE_FILE_EXISTS = _(
+ "The distribution package file %s already exists.\nPress Y to override it."
+ " To exit the application, press any other key.")
+MSG_CHECK_MODULE_EXIST = _(
+ "\nChecking to see if module exists in workspace started ...")
+MSG_CHECK_MODULE_EXIST_FINISH = \
+ _("Checking to see if module exists in workspace ... Done.")
+MSG_CHECK_MODULE_DEPEX_START = _(
+ "\nChecking to see if module depex met by workspace started ...")
+MSG_CHECK_MODULE_DEPEX_FINISH = _(
+ "Checking to see if module depex met by workspace ... Done.")
+MSG_CHECK_PACKAGE_START = _(
+ "\nChecking to see if package exists in workspace started ...")
+MSG_CHECK_PACKAGE_FINISH = _(
+ "Checking to see if package exists in workspace ... Done.")
+MSG_CHECK_DP_START = \
+ _("\nChecking to see if DP exists in workspace ... Done.")
+MSG_CHECK_DP_FINISH = _("Check DP exists in workspace ... Done.")
+MSG_MODULE_DEPEND_ON = _("Module %s depends on Package %s")
+MSG_INIT_IPI_START = _("\nInitialize IPI database started ...")
+MSG_INIT_IPI_FINISH = _("Initialize IPI database ... Done.")
+MSG_GET_DP_INSTALL_LIST = _(
+ "\nGetting list of DP install information started ...")
+MSG_GET_DP_INSTALL_INFO_START = _(
+ "\nGetting list of DP install information started ...")
+MSG_GET_DP_INSTALL_INFO_FINISH = _("Getting DP install information ... Done.")
+MSG_UZIP_PARSE_XML = _(
+ "Unzipping and parsing distribution package XML file ... ")
+MSG_INSTALL_PACKAGE = _("Installing package ... %s")
+MSG_INSTALL_MODULE = _("Installing module ... %s")
+MSG_NEW_FILE_NAME_FOR_DIST = _(
+ "Provide new filename for distribution file to be saved:\n")
+MSG_UPDATE_PACKAGE_DATABASE = _("Update Distribution Package Database ...")
+MSG_PYTHON_ON = _("(Python %s on %s) ")
+MSG_EDKII_MAIL_ADDR = 'devel@edk2.groups.io'
+MSG_SEARCH_FOR_HELP = _(
+ "\n(Please send email to %s for\n"
+ " help, attach the following call stack trace.)\n")
+MSG_REMOVE_TEMP_FILE_STARTED = _("Removing temp files started ... ")
+MSG_REMOVE_TEMP_FILE_DONE = _("Removing temp files ... Done.")
+MSG_FINISH = _("Successfully Done.")
+MSG_COMPRESS_DISTRIBUTION_PKG = _("Compressing Distribution Package File ...")
+MSG_CONFIRM_REMOVE = _(
+ "Some packages or modules depend on this distribution package.\n"
+ "Do you really want to remove it?")
+MSG_CONFIRM_REMOVE2 = _(
+ "This file has been modified: %s. Do you want to remove it?"
+ "Press Y to remove or other key to keep it")
+MSG_CONFIRM_REMOVE3 = _(
+ "This is a newly created file: %s. Are you sure you want to remove it? "
+ "Press Y to remove or any other key to keep it")
+MSG_USER_DELETE_OP = _(
+ "Press Y to delete all files or press any other key to quit:")
+MSG_REMOVE_FILE = _("Removing file: %s ...")
+
+MSG_INITIALIZE_ECC_STARTED = _("\nInitialize ECC database started ...")
+MSG_INITIALIZE_ECC_DONE = _("Initialize ECC database ... Done.")
+MSG_DEFINE_STATEMENT_FOUND = _("DEFINE statement '%s' found in section %s")
+MSG_PARSING = _("Parsing %s ...")
+
+MSG_REPKG_CONFLICT = \
+_("Repackaging is not allowed on this file: %s. "
+ "It was installed from distribution %s(Guid %s Version %s).")
+
+MSG_INVALID_MODULE_INTRODUCED = _("Some modules are not valid after removal.")
+MSG_CHECK_LOG_FILE = _("Please check log file %s for full list")
+MSG_NEW_FILE_NAME = _(
+ "Provide new filename:\n")
+MSG_RELATIVE_PATH_ONLY = _("Please specify a relative path, full path is not allowed: %s")
+MSG_NEW_PKG_PATH = _(
+ "Select package location. To quit with no input, press [Enter].")
+MSG_CHECK_DP_FOR_REPLACE = _("Verifying the dependency rule for replacement of distributions:\n %s replaces %s")
+MSG_CHECK_DP_FOR_INSTALL = _("Verifying the dependency rule for installation of distribution:\n %s")
+MSG_REPLACE_ALREADY_INSTALLED_DP = _("Distribution with the same GUID/Version is already installed, "
+ "replace would result in two instances, which is not allowed")
+MSG_RECOVER_START = _('An error was detected, recovery started ...')
+MSG_RECOVER_DONE = _('Recovery completed.')
+MSG_RECOVER_FAIL = _('Recovery failed.')
+#
+# Error related strings.
+#
+
+ERR_DEPENDENCY_NOT_MATCH = _(
+ "Module %s's dependency on package %s (GUID %s Version %s) "
+ "cannot be satisfied")
+ERR_MODULE_NOT_INSTALLED = _(
+ "This module is not installed in the workspace: %s\n")
+ERR_DIR_ALREADY_EXIST = _(
+ "This directory already exists: %s.\n"
+ "Select another location. Press [Enter] with no input to quit:")
+ERR_USER_INTERRUPT = _("The user has paused the application")
+ERR_DIST_FILE_TOOMANY = _(
+ "Only one .content and one .pkg file in ZIP file are allowed.")
+ERR_DIST_FILE_TOOFEW = _(
+ "Must have one .content and one .pkg file in the ZIP file.")
+ERR_FILE_ALREADY_EXIST = _(
+ "This file already exists: %s.\n"
+ "Select another path to continue. To quit with no input press [Enter]:")
+ERR_SPECIFY_PACKAGE = _(
+ "One distribution package must be specified")
+ERR_FILE_BROKEN = _(
+ "This file is invalid in the distribution package: %s")
+ERR_PACKAGE_NOT_MATCH_DEPENDENCY = _(
+ "This distribution package does not meet the dependency requirements")
+ERR_UNKNOWN_FATAL_INSTALL_ERR = \
+_("Unknown unrecoverable error when installing: %s")
+ERR_UNKNOWN_FATAL_REPLACE_ERR = \
+_("Unknown unrecoverable error during replacement of distributions: %s replaces %s")
+ERR_OPTION_NOT_FOUND = _("Options not found")
+ERR_INVALID_PACKAGE_NAME = _("Incorrect package name: %s. ")
+ERR_INVALID_PACKAGE_PATH = \
+_("Incorrect package path: %s. The path must be a relative path.")
+ERR_NOT_FOUND = _("This was not found: %s")
+ERR_INVALID_MODULE_NAME = _("This is not a valid module name: %s")
+ERR_INVALID_METAFILE_PATH = _('This file must be in sub-directory of WORKSPACE: %s.')
+ERR_INVALID_MODULE_PATH = \
+_("Incorrect module path: %s. The path must be a relative path.")
+ERR_UNKNOWN_FATAL_CREATING_ERR = _("Unknown error when creating: %s")
+ERR_PACKAGE_NOT_INSTALLED = _(
+ "This distribution package not installed: %s")
+ERR_DISTRIBUTION_NOT_INSTALLED = _(
+ "The distribution package is not installed.")
+ERR_UNKNOWN_FATAL_REMOVING_ERR = _("Unknown error when removing package")
+ERR_UNKNOWN_FATAL_INVENTORYWS_ERR = _("Unknown error when inventorying WORKSPACE")
+ERR_NOT_CONFIGURE_WORKSPACE_ENV = _(
+ "The WORKSPACE environment variable must be configured.")
+ERR_NO_TEMPLATE_FILE = _("This package information data file is not found: %s")
+ERR_DEBUG_LEVEL = _(
+ "Not supported debug level. Use default level instead.")
+ERR_REQUIRE_T_OPTION = _(
+ "Option -t is required during distribution creation.")
+ERR_REQUIRE_O_OPTION = _(
+ "Option -o is required during distribution replacement.")
+ERR_REQUIRE_U_OPTION = _(
+ "Option -u is required during distribution replacement.")
+ERR_REQUIRE_I_C_R_OPTION = _(
+ "Options -i, -c and -r are mutually exclusive.")
+ERR_I_C_EXCLUSIVE = \
+_("Option -c and -i are mutually exclusive.")
+ERR_I_R_EXCLUSIVE = \
+_("Option -i and -r are mutually exclusive.")
+ERR_C_R_EXCLUSIVE = \
+_("Option -c and -r are mutually exclusive.")
+ERR_U_ICR_EXCLUSIVE = \
+_("Option -u and -c/-i/-r are mutually exclusive.")
+
+ERR_L_OA_EXCLUSIVE = \
+_("Option -l and -c/-i/-r/-u are mutually exclusive.")
+
+ERR_FAILED_LOAD = _("Failed to load %s\n\t%s")
+ERR_PLACEHOLDER_DIFFERENT_REPEAT = _(
+ "${%s} has different repeat time from others.")
+ERR_KEY_NOTALLOWED = _("This keyword is not allowed: %s")
+ERR_NOT_FOUND_ENVIRONMENT = _("Environment variable not found")
+ERR_WORKSPACE_NOTEXIST = _("WORKSPACE doesn't exist")
+ERR_SPACE_NOTALLOWED = _(
+ "Whitespace characters are not allowed in the WORKSPACE path. ")
+ERR_MACRONAME_NOGIVEN = _("No MACRO name given")
+ERR_MACROVALUE_NOGIVEN = _("No MACRO value given")
+ERR_MACRONAME_INVALID = _("Incorrect MACRO name: %s")
+ERR_MACROVALUE_INVALID = _("Incorrect MACRO value: %s")
+ERR_NAME_ONLY_DEFINE = _(
+ "This variable can only be defined via environment variable: %s")
+ERR_EDK_GLOBAL_SAMENAME = _(
+ "EDK_GLOBAL defined a macro with the same name as one defined by 'DEFINE'")
+ERR_SECTIONNAME_INVALID = _(
+ "An incorrect section name was found: %s. 'The correct file is '%s' .")
+ERR_CHECKFILE_NOTFOUND = _(
+ "Can't find file '%s' defined in section '%s'")
+ERR_INVALID_NOTFOUND = _(
+ "Incorrect statement '%s' was found in section '%s'")
+ERR_TEMPLATE_NOTFOUND = _("This package information data file is not found: %s")
+ERR_SECTION_NAME_INVALID = _('Incorrect section name: %s')
+ERR_SECTION_REDEFINE = _(
+ "This section already defined: %s.")
+ERR_SECTION_NAME_NONE = \
+ _('The section needs to be specified first.')
+ERR_KEYWORD_INVALID = _('Invalid keyword: %s')
+ERR_VALUE_INVALID = _("Invalid \"%s\" value in section [%s].")
+ERR_FILELIST_LOCATION = _(
+ 'The directory "%s" must contain this file: "%s".')
+ERR_KEYWORD_REDEFINE = _(
+ "Keyword in this section can only be used once: %s.")
+ERR_FILELIST_EXIST = _(
+ 'This file does not exist: %s.')
+ERR_COPYRIGHT_CONTENT = _(
+ "The copyright content must contain the word \"Copyright\" (case insensitive).")
+ERR_WRONG_FILELIST_FORMAT = \
+_('File list format is incorrect.'
+ 'The correct format is: filename|key=value[|key=value]')
+ERR_FILELIST_ATTR = _(
+ "The value of attribute \"%s\" includes illegal character.")
+ERR_UNKNOWN_FILELIST_ATTR = _(
+ 'Unknown attribute name: %s.')
+ERR_EMPTY_VALUE = _("Empty value is not allowed")
+ERR_KEYWORD_MANDATORY = _('This keyword is mandatory: %s')
+ERR_BOOLEAN_VALUE = _(
+ 'Value of key [%s] must be true or false, current: [%s]')
+ERR_GUID_VALUE = _(
+ 'GUID must have the format of 8-4-4-4-12 with HEX value. '
+ 'Current value: [%s]')
+ERR_VERSION_VALUE = _(
+ 'The value of key [%s] must be a decimal number. Found: [%s]')
+ERR_VERSION_XMLSPEC = _(
+ 'XmlSpecification value must be 1.1, current: %s.')
+
+ERR_INVALID_GUID = _("Incorrect GUID value string: %s")
+
+ERR_FILE_NOT_FOUND = \
+ _("File or directory not found in workspace")
+ERR_FILE_OPEN_FAILURE = _("Could not open file")
+ERR_FILE_WRITE_FAILURE = _("Could not write file.")
+ERR_FILE_PARSE_FAILURE = _("Could not parse file")
+ERR_FILE_READ_FAILURE = _("Could not read file")
+ERR_FILE_CREATE_FAILURE = _("Could not create file")
+ERR_FILE_CHECKSUM_FAILURE = _("Checksum of file is incorrect")
+ERR_FILE_COMPRESS_FAILURE = _("File compression did not correctly")
+ERR_FILE_DECOMPRESS_FAILURE = \
+ _("File decompression did not complete correctly")
+ERR_FILE_MOVE_FAILURE = _("Move file did not complete successfully")
+ERR_FILE_DELETE_FAILURE = _("File could not be deleted")
+ERR_FILE_COPY_FAILURE = _("File did not copy correctly")
+ERR_FILE_POSITIONING_FAILURE = _("Could not find file seek position")
+ERR_FILE_TYPE_MISMATCH = _("Incorrect file type")
+ERR_FILE_CASE_MISMATCH = _("File name case mismatch")
+ERR_FILE_DUPLICATED = _("Duplicate file found")
+ERR_FILE_UNKNOWN_ERROR = _("Unknown error encountered on file")
+ERR_FILE_NAME_INVALIDE = _("This file name is invalid, it must not be an absolute path or "
+ "contain a period \".\" or \"..\": %s.")
+ERR_OPTION_UNKNOWN = _("Unknown option")
+ERR_OPTION_MISSING = _("Missing option")
+ERR_OPTION_CONFLICT = _("Options conflict")
+ERR_OPTION_VALUE_INVALID = _("Invalid option value")
+ERR_OPTION_DEPRECATED = _("Deprecated option")
+ERR_OPTION_NOT_SUPPORTED = _("Unsupported option")
+ERR_OPTION_UNKNOWN_ERROR = _("Unknown error when processing options")
+ERR_PARAMETER_INVALID = _("Invalid parameter")
+ERR_PARAMETER_MISSING = _("Missing parameter")
+ERR_PARAMETER_UNKNOWN_ERROR = _("Unknown error in parameters")
+ERR_FORMAT_INVALID = _("Invalid syntax/format")
+ERR_FORMAT_NOT_SUPPORTED = _("Syntax/format not supported")
+ERR_FORMAT_UNKNOWN = _("Unknown format")
+ERR_FORMAT_UNKNOWN_ERROR = _("Unknown error in syntax/format ")
+ERR_RESOURCE_NOT_AVAILABLE = _("Not available")
+ERR_RESOURCE_ALLOCATE_FAILURE = _("A resource allocation has failed")
+ERR_RESOURCE_FULL = _("Full")
+ERR_RESOURCE_OVERFLOW = _("Overflow")
+ERR_RESOURCE_UNDERRUN = _("Underrun")
+ERR_RESOURCE_UNKNOWN_ERROR = _("Unknown error")
+ERR_ATTRIBUTE_NOT_AVAILABLE = _("Not available")
+ERR_ATTRIBUTE_RETRIEVE_FAILURE = _("Unable to retrieve")
+ERR_ATTRIBUTE_SET_FAILURE = _("Unable to set")
+ERR_ATTRIBUTE_UPDATE_FAILURE = _("Unable to update")
+ERR_ATTRIBUTE_ACCESS_DENIED = _("Access denied")
+ERR_ATTRIBUTE_UNKNOWN_ERROR = _("Unknown error when accessing")
+ERR_COMMAND_FAILURE = _("Unable to execute command")
+ERR_IO_NOT_READY = _("Not ready")
+ERR_IO_BUSY = _("Busy")
+ERR_IO_TIMEOUT = _("Timeout")
+ERR_IO_UNKNOWN_ERROR = _("Unknown error in IO operation")
+ERR_UNKNOWN_ERROR = _("Unknown error")
+ERR_UPT_ALREADY_INSTALLED_ERROR = _("Already installed")
+ERR_UPT_ENVIRON_MISSING_ERROR = _("Environ missing")
+ERR_UPT_REPKG_ERROR = _("File not allowed for RePackage")
+ERR_UPT_DB_UPDATE_ERROR = _("Update database did not complete successfully")
+ERR_UPT_INI_PARSE_ERROR = _("INI file parse error")
+ERR_COPYRIGHT_MISSING = \
+_("Header comment section must have copyright information")
+ERR_LICENSE_MISSING = \
+_("Header comment section must have license information")
+ERR_INVALID_BINARYHEADER_FORMAT = \
+_("Binary Header comment section must have abstract,description,copyright,license information")
+ERR_MULTIPLE_BINARYHEADER_EXIST = \
+_("the inf file at most support one BinaryHeader at the fileheader section.")
+ERR_INVALID_COMMENT_FORMAT = _("Comment must start with #")
+ERR_USER_ABORT = _("User has stopped the application")
+ERR_DIST_EXT_ERROR = \
+_("Distribution file extension should be '.dist'. Current given: '%s'.")
+ERR_DIST_FILENAME_ONLY_FOR_REMOVE = \
+_("Only distribution filename without path allowed during remove. Current given: '%s'.")
+ERR_NOT_STANDALONE_MODULE_ERROR = \
+ _("Module %s is not a standalone module (found in Package %s)")
+ERR_UPT_ALREADY_RUNNING_ERROR = \
+ _("UPT is already running, only one instance is allowed")
+ERR_MUL_DEC_ERROR = _("Multiple DEC files found within one package directory tree %s: %s, %s")
+ERR_INSTALL_FILE_FROM_EMPTY_CONTENT = _("Error file to be installed is not found in content file: %s")
+ERR_INSTALL_FILE_DEC_FILE_ERROR = _("Could not obtain the TokenSpaceGuidCName and the PcdCName from the DEC files "
+"that the package depends on for this pcd entry: TokenValue: %s Token: %s")
+ERR_NOT_SUPPORTED_SA_MODULE = _("Stand-alone module distribution does not allow EDK 1 INF")
+ERR_INSTALL_DIST_NOT_FOUND = \
+_("Distribution file to be installed is not found in current working directory or workspace: %s")
+ERR_REPLACE_DIST_NOT_FOUND = \
+_("Distribution file for replace function was not found in the current working directory or workspace: %s")
+ERR_DIST_FILENAME_ONLY_FOR_REPLACE_ORIG = \
+_("Only a distribution file name without a path is allowed for "
+ "the distribution to be replaced during replace. Current given: '%s'.")
+ERR_UNIPARSE_DBLQUOTE_UNMATCHED = \
+_("Only Language entry can contain a couple of matched quote in one line")
+ERR_UNIPARSE_NO_SECTION_EXIST = _("No PackageDef or ModuleDef section exists in the UNI file.")
+ERR_UNIPARSE_STRNAME_FORMAT_ERROR = _("The String Token Name %s must start with \"STR_\"")
+ERR_UNIPARSE_SEP_LANGENTRY_LINE = _("Each <LangEntry> should be in a separate line :%s.")
+ERR_UNIPARSE_MULTI_ENTRY_EXIST = \
+_("There are same entries : %s in the UNI file, every kind of entry should be only one.")
+ERR_UNIPARSE_ENTRY_ORDER_WRONG = \
+_("The string entry order in UNI file should be <AbstractStrings>, <DescriptionStrings>, \
+<BinaryAbstractStrings>, <BinaryDescriptionStrings>.")
+ERR_UNIPARSE_STRTOKEN_FORMAT_ERROR = _("The String Token Type %s must be one of the '_PROMPT', '_HELP' and '_ERR_'.")
+ERR_UNIPARSE_LINEFEED_UNDER_EXIST = _("Line feed should not exist under this line: %s.")
+ERR_UNIPARSE_LINEFEED_UP_EXIST = _("Line feed should not exist up this line: %s.")
+ERR_UNI_MISS_STRING_ENTRY = _("String entry missed in this Entry, %s.")
+ERR_UNI_MISS_LANGENTRY = _("Language entry missed in this Entry, %s.")
+ERR_BINARY_HEADER_ORDER = _("Binary header must follow the file header.")
+ERR_NO_SOURCE_HEADER = _("File header statement \"## @file\" must exist at the first place.")
+ERR_UNI_FILE_SUFFIX_WRONG = _("The UNI file must have an extension of '.uni', '.UNI' or '.Uni'")
+ERR_UNI_FILE_NAME_INVALID = _("The use of '..', '../' and './' in the UNI file is prohibited.")
+ERR_UNI_SUBGUID_VALUE_DEFINE_DEC_NOT_FOUND = _("There are no DEC file to define the GUID value for \
+this GUID CName: '%s'.")
+
+#
+# Expression error message
+#
+ERR_EXPR_RIGHT_PAREN = \
+_('Missing ")" in expression "%s".')
+ERR_EXPR_FACTOR = \
+_('"%s" is expected to be HEX, integer, macro, quoted string or PcdName in '
+ 'expression "%s".')
+ERR_EXPR_STRING_ITEM = \
+_('"%s" is expected to be HEX, integer, macro, quoted string or PcdName in '
+ 'expression [%s].')
+ERR_EXPR_EQUALITY = \
+_('"%s" is expected to be ==, EQ, != or NE in expression "%s".')
+ERR_EXPR_BOOLEAN = \
+_('The string "%s" in expression "%s" can not be recognized as a part of the logical expression.')
+ERR_EXPR_EMPTY = _('Boolean value cannot be empty.')
+ERR_EXPRESS_EMPTY = _('Expression can not be empty.')
+ERR_EXPR_LOGICAL = \
+_('The following is not a valid logical expression: "%s".')
+ERR_EXPR_OR = _('The expression: "%s" must be encapsulated in open "(" and close ")" '
+ 'parenthesis when using | or ||.')
+ERR_EXPR_RANGE = \
+_('The following is not a valid range expression: "%s".')
+ERR_EXPR_RANGE_FACTOR = \
+_('"%s" is expected to be HEX, integer in valid range expression "%s".')
+ERR_EXPR_RANGE_DOUBLE_PAREN_NESTED = \
+_('Double parentheses nested is not allowed in valid range expression: "%s".')
+ERR_EXPR_RANGE_EMPTY = _('Valid range can not be empty.')
+ERR_EXPR_LIST_EMPTY = _('Valid list can not be empty.')
+ERR_PAREN_NOT_USED = _('Parenthesis must be used on both sides of "OR", "AND" in valid range : %s.')
+ERR_EXPR_LIST = \
+_('The following is not a valid list expression: "%s".')
+
+
+# DEC parser error message
+#
+ERR_DECPARSE_STATEMENT_EMPTY = \
+_('Must have at least one statement in section %s.')
+ERR_DECPARSE_DEFINE_DEFINED = \
+_('%s already defined in define section.')
+ERR_DECPARSE_DEFINE_SECNAME = \
+_('No arch and others can be followed for define section.')
+ERR_DECPARSE_DEFINE_MULTISEC = \
+_('The DEC file does not allow multiple define sections.')
+ERR_DECPARSE_DEFINE_REQUIRED = \
+_("Field [%s] is required in define section.")
+ERR_DECPARSE_DEFINE_FORMAT = \
+_("Wrong define section format, must be KEY = Value.")
+ERR_DECPARSE_DEFINE_UNKNOWKEY = \
+_("Unknown key [%s] in define section.")
+ERR_DECPARSE_DEFINE_SPEC = \
+_("Specification value must be HEX numbers or decimal numbers.")
+ERR_DECPARSE_DEFINE_PKGNAME = \
+_("Package name must be AlphaNumeric characters.")
+ERR_DECPARSE_DEFINE_PKGGUID = \
+_("GUID format error, must be HEX value with form 8-4-4-4-12.")
+ERR_DECPARSE_DEFINE_PKGVERSION = \
+_("Version number must be decimal number.")
+ERR_DECPARSE_DEFINE_PKGVUNI = \
+_("UNI file name format error or file does not exist.")
+ERR_DECPARSE_INCLUDE = \
+_("Incorrect path: [%s].")
+ERR_DECPARSE_LIBCLASS_SPLIT = \
+_("Library class format error, must be Libraryclass|Headerpath.")
+ERR_DECPARSE_LIBCLASS_EMPTY = \
+_("Class name or file name must not be empty.")
+ERR_DECPARSE_LIBCLASS_LIB = \
+_("Class name format error, must start with upper case letter followed with "
+ "zero or more alphanumeric characters.")
+ERR_DECPARSE_LIBCLASS_PATH_EXT = _("File name must be end with .h.")
+ERR_DECPARSE_LIBCLASS_PATH_DOT = _("Path must not include '..'.")
+ERR_DECPARSE_LIBCLASS_PATH_EXIST = _("File name [%s] does not exist.")
+ERR_DECPARSE_PCD_CVAR_GUID = \
+_("TokenSpaceGuidCName must be valid C variable format.")
+ERR_DECPARSE_PCD_SPLIT = \
+_("Incorrect PcdName. The format must be TokenSpaceGuidCName.PcdCName"
+ "|PcdData|PcdType|Token.")
+ERR_DECPARSE_PCD_NAME = \
+_("Incorrect PCD name. The correct format must be "
+ "<TokenSpaceGuidCName>.<PcdCName>.")
+ERR_DECPARSE_PCD_CVAR_PCDCNAME = \
+_("PcdCName must be valid C variable format.")
+ERR_DECPARSE_PCD_TYPE = \
+_('Incorrect PCD data type. A PCD data type must be one of '
+ '"UINT8", "UINT16", "UINT32", "UINT64", "VOID*", "BOOLEAN".')
+ERR_DECPARSE_PCD_VOID = \
+_("Incorrect value [%s] of type [%s]. Value must be printable and in the "
+ "form of{...} for array, or ""..."" for string, or L""..."""
+ "for unicode string.")
+ERR_DECPARSE_PCD_VALUE_EMPTY = \
+_("Pcd value can not be empty.")
+ERR_DECPARSE_PCD_BOOL = \
+_("Invalid value [%s] of type [%s]; must be expression, TRUE, FALSE, 0 or 1.")
+ERR_DECPARSE_PCD_INT = _("Incorrect value [%s] of type [%s]."\
+" Value must be a hexadecimal, decimal or octal in C language format.")
+ERR_DECPARSE_PCD_INT_NEGTIVE = _("Incorrect value [%s] of type [%s];"
+ " must not be signed number.")
+ERR_DECPARSE_PCD_INT_EXCEED = _("Incorrect value [%s] of type [%s]; "
+ "the number is too long for this type.")
+ERR_DECPARSE_PCD_FEATUREFLAG = \
+_("PcdFeatureFlag only allow BOOLEAN type.")
+ERR_DECPARSE_PCD_TOKEN = \
+_("An incorrect PCD token found: [%s]. "
+ "It must start with 0x followed by 1 - 8 hexadecimal. ")
+ERR_DECPARSE_PCD_TOKEN_INT = _("Incorrect token number [%s]. "
+ "This token number exceeds the maximal value of unsigned 32.")
+ERR_DECPARSE_PCD_TOKEN_UNIQUE = _("Token number must be unique to the token space: %s.")
+ERR_DECPARSE_CGUID = \
+_("No GUID name or value specified, must be <CName> = <GuidValueInCFormat>.")
+ERR_DECPARSE_CGUID_NAME = \
+_("No GUID name specified, must be <CName> = <GuidValueInCFormat>.")
+ERR_DECPARSE_CGUID_GUID = \
+_("No GUID value specified, must be <CName> = <GuidValueInCFormat>.")
+ERR_DECPARSE_CGUID_GUIDFORMAT = \
+_("Incorrect GUID value format, must be <GuidValueInCFormat:"
+ "{8,4,4,{2,2,2,2,2,2,2,2}}>.")
+ERR_DECPARSE_CGUID_NOT_FOUND = _("Unable to find the GUID value of this GUID CName : '%s'.")
+ERR_DECPARSE_FILEOPEN = _("Unable to open: [%s].")
+ERR_DECPARSE_SECTION_EMPTY = _("Empty sections are not allowed.")
+ERR_DECPARSE_SECTION_UE = _("Incorrect UserExtensions format. "
+ "Must be UserExtenxions.UserId.IdString[.Arch]+.")
+ERR_DECPARSE_SECTION_UE_USERID = _("Invalid UserId, must be underscore"
+ "or alphanumeric characters.")
+ERR_DECPARSE_SECTION_UE_IDSTRING = \
+ _("Incorrect IdString, must be \" ... \".")
+ERR_DECPARSE_ARCH = \
+_("Unknown arch, must be 'common' or start with upper case letter followed by"
+ " zero or more upper case letters and numbers.")
+ERR_DECPARSE_SECTION_COMMA = _("Section cannot end with comma.")
+ERR_DECPARSE_SECTION_COMMON = \
+_("'COMMON' must not be used with specific ARCHs in the same section.")
+ERR_DECPARSE_SECTION_IDENTIFY = \
+_("Section header must start with and end with brackets[].")
+ERR_DECPARSE_SECTION_SUBEMPTY = \
+_("Missing a sub-section name in section: [%s]. "
+ "All sub-sections need to have names. ")
+ERR_DECPARSE_SECTION_SUBTOOMANY = _("Too many DOT splits in [%s].")
+ERR_DECPARSE_SECTION_UNKNOW = _("Section name [%s] unknown.")
+ERR_DECPARSE_SECTION_FEATUREFLAG = \
+_("[%s] must not be in the same section as other types of PCD.")
+ERR_DECPARSE_MACRO_PAIR = _("No macro name/value given.")
+ERR_DECPARSE_MACRO_NAME = _("No macro name given.")
+ERR_DECPARSE_MACRO_NAME_UPPER = \
+_("Macro name must start with upper case letter followed "
+"by zero or more upper case letters or numbers. Current macro name is: [%s].")
+ERR_DECPARSE_SECTION_NAME = \
+_('Cannot mix different section names %s.')
+ERR_DECPARSE_BACKSLASH = \
+_('Backslash must be the last character on a line and '
+ 'preceded by a space character.')
+ERR_DECPARSE_BACKSLASH_EMPTY = \
+_('Empty line after previous line that has backslash is not allowed.')
+ERR_DECPARSE_REDEFINE = _(
+ "\"%s\" already defined in line %d.")
+ERR_DECPARSE_MACRO_RESOLVE = _("Macro %s in %s cannot be resolved.")
+ERR_DECPARSE_UE_DUPLICATE = \
+ _("Duplicated UserExtensions header found.")
+ERR_DECPARSE_PCDERRORMSG_MISS_VALUE_SPLIT = \
+ _("Missing '|' between Pcd's error code and Pcd's error message.")
+ERR_DECPARSE_PCD_MISS_ERRORMSG = \
+ _("Missing Pcd's error message.")
+ERR_DECPARSE_PCD_UNMATCHED_ERRORCODE = \
+ _("There is no error message matched with this Pcd error code : %s in both DEC and UNI file.")
+ERR_DECPARSE_PCD_NODEFINED = _("The PCD : %s used in the Expression is undefined.")
+#
+# Used to print the current line content which cause error raise.
+# Be attached to the end of every error message above.
+#
+ERR_DECPARSE_LINE = _(" Parsing line: \"%s\".")
+
+#
+# Warning related strings.
+#
+WRN_PACKAGE_EXISTED = _(
+ "A package with this GUID and Version already exists: "
+ "GUID %s, Version %s.")
+WRN_MODULE_EXISTED = _("This module already exists: %s")
+WRN_FILE_EXISTED = _("This file already exists: %s")
+WRN_FILE_NOT_OVERWRITTEN = \
+_("This file already exist and cannot be overwritten: %s")
+WRN_DIST_PKG_INSTALLED = _("This distribution package %s has previously been installed.")
+WRN_DIST_NOT_FOUND = _(
+ "Distribution is not found at location %s")
+WRN_MULTI_PCD_RANGES = _(
+ "A PCD can only have one type of @ValidRange, @ValidList, and @Expression comment")
+WRN_MULTI_PCD_VALIDVALUE = _(
+ "A PCD can only have one of @ValidList comment")
+WRN_MULTI_PCD_PROMPT = _(
+ "A PCD can only have one of @Prompt comment")
+WRN_MISSING_USAGE = _("Missing usage")
+WRN_INVALID_GUID_TYPE = _("This is and incorrect Guid type: %s")
+WRN_MISSING_GUID_TYPE = _("Missing Guid Type")
+WRN_INVALID_USAGE = _("This is an incorrect Usage: %s")
+WRN_INF_PARSER_MODULE_INVALID_HOB_TYPE = \
+ _("This is an incorrect HOB type: %s")
+WRN_INF_PARSER_MODULE_INVALID_EVENT_TYPE = \
+ _("This is an incorrect EVENT type: %s")
+WRN_INF_PARSER_MODULE_INVALID_BOOTMODE_TYPE = \
+ _("This is an incorrect BOOTMODE type: %s")
+WRN_INVALID_MODULE_TYPE = \
+ _("This is an incorrect Module type: %s")
+WRN_MODULE_PARSE_FAILED = \
+ _("Parsing of this module did not complete correctly: %s.")
+WRN_EDK1_INF_FOUND = \
+ _("EDK 1 module file found: %s")
+WRN_INVALID_COPYRIGHT = \
+ _("Copyright information is not right")
+WARN_SPECIAL_SECTION_LOCATION_WRONG = _("Warning. A special section should be "
+ "at the end of a file or at the end of a section.")
+WARN_INSTALLED_PACKAGE_NOT_FOUND = \
+ _("File not found. The DEC file for a package cannot be found in GUID/Version/Install path: %s %s %s")
+WARN_CUSTOMPATH_OVERRIDE_USEGUIDEDPATH = \
+ _("option selection of --custom-path will override the option --use-guided-paths")
+
+#
+# Help related strings.
+#
+HLP_PRINT_DEBUG_INFO = _(
+ "Print DEBUG statements, where DEBUG_LEVEL is 0-9")
+HLP_PRINT_INFORMATIONAL_STATEMENT = _("Print informational statements")
+HLP_RETURN_NO_DISPLAY = _(
+ "Returns only the exit code, informational and error messages are"
+ " not displayed")
+HLP_RETURN_AND_DISPLAY = _(
+ "Returns the exit code and displays error messages only")
+HLP_SPECIFY_PACKAGE_NAME_INSTALL = _(
+ "Specify the UEFI Distribution Package filename to install")
+HLP_SPECIFY_PACKAGE_NAME_CREATE = _(
+ "Specify the UEFI Distribution Package filename to create")
+HLP_SPECIFY_PACKAGE_NAME_REMOVE = _(
+ "Specify the UEFI Distribution Package filename to remove")
+HLP_SPECIFY_TEMPLATE_NAME_CREATE = _(
+ "Specify Package Information Data filename to create package")
+HLP_SPECIFY_DEC_NAME_CREATE = _(
+ "Specify dec file names to create package")
+HLP_SPECIFY_INF_NAME_CREATE = _(
+ "Specify inf file names to create package")
+HLP_LIST_DIST_INSTALLED = _(
+ "List the UEFI Distribution Packages that have been installed")
+HLP_NO_SUPPORT_GUI = _(
+ "Starting the tool in graphical mode is not supported in this version")
+HLP_DISABLE_PROMPT = _(
+ "Disable user prompts for removing modified files. Valid only when -r is present")
+HLP_CUSTOM_PATH_PROMPT = _(
+ "Enable user prompting for alternate installation directories")
+HLP_SKIP_LOCK_CHECK = _(
+ "Skip the check for multiple instances")
+HLP_SPECIFY_PACKAGE_NAME_REPLACE = _(
+ "Specify the UEFI Distribution Package file name to replace the existing file name")
+HLP_SPECIFY_PACKAGE_NAME_TO_BE_REPLACED = _(
+ "Specify the UEFI Distribution Package file name to be replaced")
+HLP_USE_GUIDED_PATHS = _(
+ "Install packages to the following directory path by default: <PackageName>_<PACKAGE_GUID>_<PACKAGE_VERSION>")
+HLP_TEST_INSTALL = _(
+ "Specify the UEFI Distribution Package filenames to install")
+
+MSG_TEST_INSTALL_PASS = _("All distribution package file are satisfied for dependence check.")
+MSG_TEST_INSTALL_FAIL = _("NOT all distribution package file are satisfied for dependence check.")
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Logger/ToolError.py b/roms/edk2/BaseTools/Source/Python/UPT/Logger/ToolError.py
new file mode 100644
index 000000000..925982beb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Logger/ToolError.py
@@ -0,0 +1,171 @@
+## @file
+# Standardized Error Handling infrastructures.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+ToolError
+'''
+
+import Logger.StringTable as ST
+
+FILE_OPEN_FAILURE = 1
+FILE_WRITE_FAILURE = 2
+FILE_PARSE_FAILURE = 3
+FILE_READ_FAILURE = 4
+FILE_CREATE_FAILURE = 5
+FILE_CHECKSUM_FAILURE = 6
+FILE_COMPRESS_FAILURE = 7
+FILE_DECOMPRESS_FAILURE = 8
+FILE_MOVE_FAILURE = 9
+FILE_DELETE_FAILURE = 10
+FILE_COPY_FAILURE = 11
+FILE_POSITIONING_FAILURE = 12
+FILE_ALREADY_EXIST = 13
+FILE_NOT_FOUND = 14
+FILE_TYPE_MISMATCH = 15
+FILE_CASE_MISMATCH = 16
+FILE_DUPLICATED = 17
+FILE_UNKNOWN_ERROR = 0x0FFF
+
+OPTION_UNKNOWN = 0x1000
+OPTION_MISSING = 0x1001
+OPTION_CONFLICT = 0x1002
+OPTION_VALUE_INVALID = 0x1003
+OPTION_DEPRECATED = 0x1004
+OPTION_NOT_SUPPORTED = 0x1005
+OPTION_UNKNOWN_ERROR = 0x1FFF
+
+PARAMETER_INVALID = 0x2000
+PARAMETER_MISSING = 0x2001
+PARAMETER_UNKNOWN_ERROR = 0x2FFF
+
+FORMAT_INVALID = 0x3000
+FORMAT_NOT_SUPPORTED = 0x3001
+FORMAT_UNKNOWN = 0x3002
+FORMAT_UNKNOWN_ERROR = 0x3FFF
+
+RESOURCE_NOT_AVAILABLE = 0x4000
+RESOURCE_ALLOCATE_FAILURE = 0x4001
+RESOURCE_FULL = 0x4002
+RESOURCE_OVERFLOW = 0x4003
+RESOURCE_UNDERRUN = 0x4004
+RESOURCE_UNKNOWN_ERROR = 0x4FFF
+
+ATTRIBUTE_NOT_AVAILABLE = 0x5000
+ATTRIBUTE_GET_FAILURE = 0x5001
+ATTRIBUTE_SET_FAILURE = 0x5002
+ATTRIBUTE_UPDATE_FAILURE = 0x5003
+ATTRIBUTE_ACCESS_DENIED = 0x5004
+ATTRIBUTE_RETRIEVE_FAILURE = 0x5005
+ATTRIBUTE_UNKNOWN_ERROR = 0x5FFF
+ATTRIBUTE_RETRIEVE_FAILURE = 0x5F00
+
+IO_NOT_READY = 0x6000
+IO_BUSY = 0x6001
+IO_TIMEOUT = 0x6002
+IO_UNKNOWN_ERROR = 0x6FFF
+
+COMMAND_FAILURE = 0x7000
+
+CODE_ERROR = 0xC0DE
+
+AUTOGEN_ERROR = 0xF000
+PARSER_ERROR = 0xF001
+BUILD_ERROR = 0xF002
+GENFDS_ERROR = 0xF003
+ECC_ERROR = 0xF004
+EOT_ERROR = 0xF005
+DDC_ERROR = 0xF009
+WARNING_AS_ERROR = 0xF006
+MIGRATION_ERROR = 0xF010
+EDK1_INF_ERROR = 0xF011
+ABORT_ERROR = 0xFFFE
+UNKNOWN_ERROR = 0xFFFF
+
+UPT_ALREADY_INSTALLED_ERROR = 0xD000
+UPT_ENVIRON_MISSING_ERROR = 0xD001
+UPT_REPKG_ERROR = 0xD002
+UPT_ALREADY_RUNNING_ERROR = 0xD003
+UPT_MUL_DEC_ERROR = 0xD004
+UPT_DB_UPDATE_ERROR = 0xD005
+UPT_INI_PARSE_ERROR = 0xE000
+
+## Error message of each error code
+#
+gERROR_MESSAGE = {
+ FILE_NOT_FOUND : ST.ERR_FILE_NOT_FOUND,
+ FILE_OPEN_FAILURE : ST.ERR_FILE_OPEN_FAILURE,
+ FILE_WRITE_FAILURE : ST.ERR_FILE_WRITE_FAILURE,
+ FILE_PARSE_FAILURE : ST.ERR_FILE_PARSE_FAILURE,
+ FILE_READ_FAILURE : ST.ERR_FILE_READ_FAILURE,
+ FILE_CREATE_FAILURE : ST.ERR_FILE_CREATE_FAILURE,
+ FILE_CHECKSUM_FAILURE : ST.ERR_FILE_CHECKSUM_FAILURE,
+ FILE_COMPRESS_FAILURE : ST.ERR_FILE_COMPRESS_FAILURE,
+ FILE_DECOMPRESS_FAILURE : ST.ERR_FILE_DECOMPRESS_FAILURE,
+ FILE_MOVE_FAILURE : ST.ERR_FILE_MOVE_FAILURE,
+ FILE_DELETE_FAILURE : ST.ERR_FILE_DELETE_FAILURE,
+ FILE_COPY_FAILURE : ST.ERR_FILE_COPY_FAILURE,
+ FILE_POSITIONING_FAILURE: ST.ERR_FILE_POSITIONING_FAILURE,
+ FILE_ALREADY_EXIST : ST.ERR_FILE_ALREADY_EXIST,
+ FILE_TYPE_MISMATCH : ST.ERR_FILE_TYPE_MISMATCH ,
+ FILE_CASE_MISMATCH : ST.ERR_FILE_CASE_MISMATCH,
+ FILE_DUPLICATED : ST.ERR_FILE_DUPLICATED,
+ FILE_UNKNOWN_ERROR : ST.ERR_FILE_UNKNOWN_ERROR,
+
+ OPTION_UNKNOWN : ST.ERR_OPTION_UNKNOWN,
+ OPTION_MISSING : ST.ERR_OPTION_MISSING,
+ OPTION_CONFLICT : ST.ERR_OPTION_CONFLICT,
+ OPTION_VALUE_INVALID : ST.ERR_OPTION_VALUE_INVALID,
+ OPTION_DEPRECATED : ST.ERR_OPTION_DEPRECATED,
+ OPTION_NOT_SUPPORTED : ST.ERR_OPTION_NOT_SUPPORTED,
+ OPTION_UNKNOWN_ERROR : ST.ERR_OPTION_UNKNOWN_ERROR,
+
+ PARAMETER_INVALID : ST.ERR_PARAMETER_INVALID,
+ PARAMETER_MISSING : ST.ERR_PARAMETER_MISSING,
+ PARAMETER_UNKNOWN_ERROR : ST.ERR_PARAMETER_UNKNOWN_ERROR,
+
+ FORMAT_INVALID : ST.ERR_FORMAT_INVALID,
+ FORMAT_NOT_SUPPORTED : ST.ERR_FORMAT_NOT_SUPPORTED,
+ FORMAT_UNKNOWN : ST.ERR_FORMAT_UNKNOWN,
+ FORMAT_UNKNOWN_ERROR : ST.ERR_FORMAT_UNKNOWN_ERROR,
+
+ RESOURCE_NOT_AVAILABLE : ST.ERR_RESOURCE_NOT_AVAILABLE,
+ RESOURCE_ALLOCATE_FAILURE : ST.ERR_RESOURCE_ALLOCATE_FAILURE,
+ RESOURCE_FULL : ST.ERR_RESOURCE_FULL,
+ RESOURCE_OVERFLOW : ST.ERR_RESOURCE_OVERFLOW,
+ RESOURCE_UNDERRUN : ST.ERR_RESOURCE_UNDERRUN,
+ RESOURCE_UNKNOWN_ERROR : ST.ERR_RESOURCE_UNKNOWN_ERROR,
+
+ ATTRIBUTE_NOT_AVAILABLE : ST.ERR_ATTRIBUTE_NOT_AVAILABLE,
+ ATTRIBUTE_RETRIEVE_FAILURE : ST.ERR_ATTRIBUTE_RETRIEVE_FAILURE,
+ ATTRIBUTE_SET_FAILURE : ST.ERR_ATTRIBUTE_SET_FAILURE,
+ ATTRIBUTE_UPDATE_FAILURE: ST.ERR_ATTRIBUTE_UPDATE_FAILURE,
+ ATTRIBUTE_ACCESS_DENIED : ST.ERR_ATTRIBUTE_ACCESS_DENIED,
+ ATTRIBUTE_UNKNOWN_ERROR : ST.ERR_ATTRIBUTE_UNKNOWN_ERROR,
+
+ COMMAND_FAILURE : ST.ERR_COMMAND_FAILURE,
+
+ IO_NOT_READY : ST.ERR_IO_NOT_READY,
+ IO_BUSY : ST.ERR_IO_BUSY,
+ IO_TIMEOUT : ST.ERR_IO_TIMEOUT,
+ IO_UNKNOWN_ERROR : ST.ERR_IO_UNKNOWN_ERROR,
+
+ UNKNOWN_ERROR : ST.ERR_UNKNOWN_ERROR,
+
+ UPT_ALREADY_INSTALLED_ERROR : ST.ERR_UPT_ALREADY_INSTALLED_ERROR,
+ UPT_ENVIRON_MISSING_ERROR : ST.ERR_UPT_ENVIRON_MISSING_ERROR,
+ UPT_REPKG_ERROR : ST.ERR_UPT_REPKG_ERROR,
+ UPT_ALREADY_RUNNING_ERROR : ST.ERR_UPT_ALREADY_RUNNING_ERROR,
+ UPT_MUL_DEC_ERROR : ST.ERR_MUL_DEC_ERROR,
+ UPT_INI_PARSE_ERROR : ST.ERR_UPT_INI_PARSE_ERROR,
+}
+
+## Exception indicating a fatal error
+#
+class FatalError(Exception):
+ pass
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Logger/__init__.py b/roms/edk2/BaseTools/Source/Python/UPT/Logger/__init__.py
new file mode 100644
index 000000000..e53198451
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Logger/__init__.py
@@ -0,0 +1,14 @@
+## @file
+# Python 'Logger' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Logger
+'''
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/MkPkg.py b/roms/edk2/BaseTools/Source/Python/UPT/MkPkg.py
new file mode 100644
index 000000000..c6d4731ed
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/MkPkg.py
@@ -0,0 +1,274 @@
+## @file
+# Install distribution package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+MkPkg
+'''
+
+##
+# Import Modules
+#
+from os import remove
+from os import getcwd
+from os import chdir
+import os.path
+from sys import stdin
+from sys import platform
+from traceback import format_exc
+from platform import python_version
+from hashlib import md5
+from time import strftime
+from time import localtime
+from uuid import uuid4
+
+from Logger import StringTable as ST
+from Logger.ToolError import OPTION_UNKNOWN_ERROR
+from Logger.ToolError import OPTION_VALUE_INVALID
+from Logger.ToolError import ABORT_ERROR
+from Logger.ToolError import UPT_REPKG_ERROR
+from Logger.ToolError import CODE_ERROR
+from Logger.ToolError import FatalError
+from Logger.ToolError import FILE_NOT_FOUND
+import Logger.Log as Logger
+
+from Xml.XmlParser import DistributionPackageXml
+from Xml.IniToXml import IniToXml
+
+from Library import GlobalData
+from Library.ParserValidate import IsValidPath
+
+from Core.DistributionPackageClass import DistributionPackageClass
+from Core.PackageFile import PackageFile
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+
+## CheckForExistingDp
+#
+# Check if there is a same name DP file existing
+# @param Path: The path to be checked
+#
+def CheckForExistingDp(Path):
+ if os.path.exists(Path):
+ Logger.Info(ST.MSG_DISTRIBUTION_PACKAGE_FILE_EXISTS % Path)
+ Input = stdin.readline()
+ Input = Input.replace('\r', '').replace('\n', '')
+ if Input.upper() != "Y":
+ Logger.Error("\nMkPkg", ABORT_ERROR, ST.ERR_USER_ABORT, RaiseError=True)
+
+## Tool entrance method
+#
+# This method mainly dispatch specific methods per the command line options.
+# If no error found, return zero value so the caller of this tool can know
+# if it's executed successfully or not.
+#
+#
+def Main(Options = None):
+ if Options is None:
+ Logger.Error("\nMkPkg", OPTION_UNKNOWN_ERROR, ST.ERR_OPTION_NOT_FOUND)
+ try:
+ DataBase = GlobalData.gDB
+ ContentFileClosed = True
+ WorkspaceDir = GlobalData.gWORKSPACE
+
+ #
+ # Init PackFileToCreate
+ #
+ if not Options.PackFileToCreate:
+ Logger.Error("\nMkPkg", OPTION_UNKNOWN_ERROR, ST.ERR_OPTION_NOT_FOUND)
+
+ #
+ # Handle if the distribution package file already exists
+ #
+ CheckForExistingDp(Options.PackFileToCreate)
+
+ #
+ # Check package file existing and valid
+ #
+ CheckFileList('.DEC', Options.PackageFileList, ST.ERR_INVALID_PACKAGE_NAME, ST.ERR_INVALID_PACKAGE_PATH)
+ #
+ # Check module file existing and valid
+ #
+ CheckFileList('.INF', Options.ModuleFileList, ST.ERR_INVALID_MODULE_NAME, ST.ERR_INVALID_MODULE_PATH)
+
+ #
+ # Get list of files that installed with RePackage attribute available
+ #
+ RePkgDict = DataBase.GetRePkgDict()
+
+ ContentFile = PackageFile(GlobalData.gCONTENT_FILE, "w")
+ ContentFileClosed = False
+
+ #
+ # Add temp distribution header
+ #
+ if Options.PackageInformationDataFile:
+ XmlFile = IniToXml(Options.PackageInformationDataFile)
+ DistPkg = DistributionPackageXml().FromXml(XmlFile)
+ remove(XmlFile)
+
+ #
+ # add distribution level tool/misc files
+ # before pack, current dir should be workspace dir, else the full
+ # path will be in the pack file
+ #
+ Cwd = getcwd()
+ chdir(WorkspaceDir)
+ ToolObject = DistPkg.Tools
+ MiscObject = DistPkg.MiscellaneousFiles
+ FileList = []
+ if ToolObject:
+ FileList += ToolObject.GetFileList()
+ if MiscObject:
+ FileList += MiscObject.GetFileList()
+ for FileObject in FileList:
+ #
+ # If you have unicode file names, please convert them to byte
+ # strings in your desired encoding before passing them to
+ # write().
+ #
+ FromFile = os.path.normpath(FileObject.GetURI()).encode('utf_8')
+ FileFullPath = mws.join(WorkspaceDir, FromFile)
+ if FileFullPath in RePkgDict:
+ (DpGuid, DpVersion, DpName, Repackage) = RePkgDict[FileFullPath]
+ if not Repackage:
+ Logger.Error("\nMkPkg",
+ UPT_REPKG_ERROR,
+ ST.ERR_UPT_REPKG_ERROR,
+ ExtraData=ST.MSG_REPKG_CONFLICT %\
+ (FileFullPath, DpGuid, DpVersion, DpName)
+ )
+ else:
+ DistPkg.Header.RePackage = True
+ ContentFile.PackFile(FromFile)
+ chdir(Cwd)
+
+ #
+ # Add init dp information
+ #
+ else:
+ DistPkg = DistributionPackageClass()
+ DistPkg.Header.Name = 'Distribution Package'
+ DistPkg.Header.Guid = str(uuid4())
+ DistPkg.Header.Version = '1.0'
+
+ DistPkg.GetDistributionPackage(WorkspaceDir, Options.PackageFileList, \
+ Options.ModuleFileList)
+ FileList, MetaDataFileList = DistPkg.GetDistributionFileList()
+ for File in FileList + MetaDataFileList:
+ FileFullPath = os.path.normpath(os.path.join(WorkspaceDir, File))
+ #
+ # check whether file was included in a distribution that can not
+ # be repackaged
+ #
+ if FileFullPath in RePkgDict:
+ (DpGuid, DpVersion, DpName, Repackage) = RePkgDict[FileFullPath]
+ if not Repackage:
+ Logger.Error("\nMkPkg",
+ UPT_REPKG_ERROR,
+ ST.ERR_UPT_REPKG_ERROR,
+ ExtraData = \
+ ST.MSG_REPKG_CONFLICT %(FileFullPath, DpName, \
+ DpGuid, DpVersion)
+ )
+ else:
+ DistPkg.Header.RePackage = True
+
+ Cwd = getcwd()
+ chdir(WorkspaceDir)
+ ContentFile.PackFiles(FileList)
+ chdir(Cwd)
+
+ Logger.Verbose(ST.MSG_COMPRESS_DISTRIBUTION_PKG)
+
+ ContentFile.Close()
+ ContentFileClosed = True
+
+ #
+ # Add Md5Signature
+ #
+ DistPkg.Header.Signature = md5(open(str(ContentFile), 'rb').read()).hexdigest()
+ #
+ # Add current Date
+ #
+ DistPkg.Header.Date = str(strftime("%Y-%m-%dT%H:%M:%S", localtime()))
+
+ #
+ # Finish final dp file
+ #
+ DistPkgFile = PackageFile(Options.PackFileToCreate, "w")
+ DistPkgFile.PackFile(str(ContentFile))
+ DistPkgXml = DistributionPackageXml()
+ DistPkgFile.PackData(DistPkgXml.ToXml(DistPkg), GlobalData.gDESC_FILE)
+ DistPkgFile.Close()
+ Logger.Quiet(ST.MSG_FINISH)
+ ReturnCode = 0
+
+ except FatalError as XExcept:
+ ReturnCode = XExcept.args[0]
+ if Logger.GetLevel() <= Logger.DEBUG_9:
+ Logger.Quiet(ST.MSG_PYTHON_ON % \
+ (python_version(), platform) + format_exc())
+ except KeyboardInterrupt:
+ ReturnCode = ABORT_ERROR
+ if Logger.GetLevel() <= Logger.DEBUG_9:
+ Logger.Quiet(ST.MSG_PYTHON_ON % \
+ (python_version(), platform) + format_exc())
+ except OSError:
+ pass
+ except:
+ Logger.Error(
+ "\nMkPkg",
+ CODE_ERROR,
+ ST.ERR_UNKNOWN_FATAL_CREATING_ERR % \
+ Options.PackFileToCreate,
+ ExtraData=ST.MSG_SEARCH_FOR_HELP % ST.MSG_EDKII_MAIL_ADDR,
+ RaiseError=False
+ )
+ Logger.Quiet(ST.MSG_PYTHON_ON % \
+ (python_version(), platform) + format_exc())
+ ReturnCode = CODE_ERROR
+ finally:
+ if os.path.exists(GlobalData.gCONTENT_FILE):
+ if not ContentFileClosed:
+ ContentFile.Close()
+ os.remove(GlobalData.gCONTENT_FILE)
+
+ return ReturnCode
+
+
+## CheckFileList
+#
+# @param QualifiedExt: QualifiedExt
+# @param FileList: FileList
+# @param ErrorStringExt: ErrorStringExt
+# @param ErrorStringFullPath: ErrorStringFullPath
+#
+def CheckFileList(QualifiedExt, FileList, ErrorStringExt, ErrorStringFullPath):
+ if not FileList:
+ return
+ WorkspaceDir = GlobalData.gWORKSPACE
+ WorkspaceDir = os.path.normpath(WorkspaceDir)
+ for Item in FileList:
+ Ext = os.path.splitext(Item)[1]
+ if Ext.upper() != QualifiedExt.upper():
+ Logger.Error("\nMkPkg", OPTION_VALUE_INVALID, \
+ ErrorStringExt % Item)
+
+ Item = os.path.normpath(Item)
+ Path = mws.join(WorkspaceDir, Item)
+ if not os.path.exists(Path):
+ Logger.Error("\nMkPkg", FILE_NOT_FOUND, ST.ERR_NOT_FOUND % Item)
+ elif Item == Path:
+ Logger.Error("\nMkPkg", OPTION_VALUE_INVALID,
+ ErrorStringFullPath % Item)
+ elif not IsValidPath(Item, WorkspaceDir):
+ Logger.Error("\nMkPkg", OPTION_VALUE_INVALID, \
+ ErrorStringExt % Item)
+
+ if not os.path.split(Item)[0]:
+ Logger.Error("\nMkPkg", OPTION_VALUE_INVALID, \
+ ST.ERR_INVALID_METAFILE_PATH % Item)
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/POM/CommonObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/POM/CommonObject.py
new file mode 100644
index 000000000..ae8fe8306
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/POM/CommonObject.py
@@ -0,0 +1,953 @@
+## @file
+# This file is used to define common items of class object
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+Common Object
+'''
+from Library.DataType import TAB_LANGUAGE_EN_US
+
+## HelpTextObject
+#
+# @param object: Inherited from object class
+#
+class HelpTextObject(object):
+ def __init__(self):
+ self.HelpText = TextObject()
+
+ def SetHelpText(self, HelpText):
+ self.HelpText = HelpText
+
+ def GetHelpText(self):
+ return self.HelpText
+
+## HelpTextListObject
+#
+# @param object: Inherited from object class
+#
+class HelpTextListObject(object):
+ def __init__(self):
+ self.HelpTextList = []
+
+ def SetHelpTextList(self, HelpTextList):
+ self.HelpTextList = HelpTextList
+
+ def GetHelpTextList(self):
+ return self.HelpTextList
+
+## PromptListObject
+#
+# @param object: Inherited from object class
+#
+class PromptListObject(object):
+ def __init__(self):
+ self.PromptList = []
+
+ def SetPromptList(self, PromptList):
+ self.PromptList = PromptList
+
+ def GetPromptList(self):
+ return self.PromptList
+
+## CommonPropertiesObject
+#
+# This class defined common attribution used in Module/Platform/Package files
+#
+# @param object: Inherited from object class
+# @param Usage: Input value for Usage, default is []
+# @param FeatureFlag: Input value for FeatureFalg, default is ''
+# @param SupArchList: Input value for SupArchList, default is []
+# @param HelpText: Input value for HelpText, default is ''
+# @param HelpTextList: Input value for HelpTextList, default is []
+#
+class CommonPropertiesObject(HelpTextObject, HelpTextListObject):
+ def __init__(self):
+ self.Usage = []
+ self.FeatureFlag = ''
+ self.SupArchList = []
+ self.GuidValue = ''
+ HelpTextObject.__init__(self)
+ HelpTextListObject.__init__(self)
+
+ def SetUsage(self, Usage):
+ self.Usage = Usage
+
+ def GetUsage(self):
+ return self.Usage
+
+ def SetFeatureFlag(self, FeatureFlag):
+ self.FeatureFlag = FeatureFlag
+
+ def GetFeatureFlag(self):
+ return self.FeatureFlag
+
+ def SetSupArchList(self, SupArchList):
+ self.SupArchList = SupArchList
+
+ def GetSupArchList(self):
+ return self.SupArchList
+
+ def SetGuidValue(self, GuidValue):
+ self.GuidValue = GuidValue
+
+ def GetGuidValue(self):
+ return self.GuidValue
+
+## CommonHeaderObject
+#
+# This class defined common header items used in Module/Platform/Package files
+#
+# @param object: Inherited from object class
+#
+class CommonHeaderObject(object):
+ def __init__(self):
+ self.AbstractList = []
+ self.DescriptionList = []
+ self.CopyrightList = []
+ self.LicenseList = []
+
+ def SetAbstract(self, Abstract):
+ if isinstance(Abstract, list):
+ self.AbstractList = Abstract
+ else:
+ self.AbstractList.append(Abstract)
+
+ def GetAbstract(self):
+ return self.AbstractList
+
+ def SetDescription(self, Description):
+ if isinstance(Description, list):
+ self.DescriptionList = Description
+ else:
+ self.DescriptionList.append(Description)
+
+ def GetDescription(self):
+ return self.DescriptionList
+
+ def SetCopyright(self, Copyright):
+ if isinstance(Copyright, list):
+ self.CopyrightList = Copyright
+ else:
+ self.CopyrightList.append(Copyright)
+
+ def GetCopyright(self):
+ return self.CopyrightList
+
+ def SetLicense(self, License):
+ if isinstance(License, list):
+ self.LicenseList = License
+ else:
+ self.LicenseList.append(License)
+
+ def GetLicense(self):
+ return self.LicenseList
+
+## BinaryHeaderObject
+#
+# This class defined Binary header items used in Module/Platform/Package files
+#
+# @param object: Inherited from object class
+#
+class BinaryHeaderObject(object):
+ def __init__(self):
+ self.BinaryHeaderAbstractList = []
+ self.BinaryHeaderDescriptionList = []
+ self.BinaryHeaderCopyrightList = []
+ self.BinaryHeaderLicenseList = []
+
+ def SetBinaryHeaderAbstract(self, Abstract):
+ if isinstance(Abstract, list) and Abstract:
+ self.BinaryHeaderAbstractList = Abstract
+ elif isinstance(Abstract, tuple) and Abstract[1]:
+ self.BinaryHeaderAbstractList.append(Abstract)
+
+ def GetBinaryHeaderAbstract(self):
+ return self.BinaryHeaderAbstractList
+
+ def SetBinaryHeaderDescription(self, Description):
+ if isinstance(Description, list) and Description:
+ self.BinaryHeaderDescriptionList = Description
+ elif isinstance(Description, tuple) and Description[1]:
+ self.BinaryHeaderDescriptionList.append(Description)
+
+ def GetBinaryHeaderDescription(self):
+ return self.BinaryHeaderDescriptionList
+
+ def SetBinaryHeaderCopyright(self, Copyright):
+ if isinstance(Copyright, list) and Copyright:
+ self.BinaryHeaderCopyrightList = Copyright
+ elif isinstance(Copyright, tuple) and Copyright[1]:
+ self.BinaryHeaderCopyrightList.append(Copyright)
+
+ def GetBinaryHeaderCopyright(self):
+ return self.BinaryHeaderCopyrightList
+
+ def SetBinaryHeaderLicense(self, License):
+ if isinstance(License, list) and License:
+ self.BinaryHeaderLicenseList = License
+ elif isinstance(License, tuple) and License[1]:
+ self.BinaryHeaderLicenseList.append(License)
+
+ def GetBinaryHeaderLicense(self):
+ return self.BinaryHeaderLicenseList
+
+## ClonedRecordObject
+#
+# This class defined ClonedRecord items used in Module/Platform/Package files
+#
+# @param object: Inherited from object class
+#
+class ClonedRecordObject(object):
+ def __init__(self):
+ self.IdNum = 0
+ self.FarGuid = ''
+ self.PackageGuid = ''
+ self.PackageVersion = ''
+ self.ModuleGuid = ''
+ self.ModuleVersion = ''
+
+ def SetId(self, IdNo):
+ self.IdNum = IdNo
+
+ def GetId(self):
+ return self.IdNum
+
+ def SetFarGuid(self, FarGuid):
+ self.FarGuid = FarGuid
+
+ def GetFarGuid(self):
+ return self.FarGuid
+
+ def SetPackageGuid(self, PackageGuid):
+ self.PackageGuid = PackageGuid
+
+ def GetPackageGuid(self):
+ return self.PackageGuid
+
+ def SetPackageVersion(self, PackageVersion):
+ self.PackageVersion = PackageVersion
+
+ def GetPackageVersion(self):
+ return self.PackageVersion
+
+ def SetModuleGuid(self, ModuleGuid):
+ self.ModuleGuid = ModuleGuid
+
+ def GetModuleGuid(self):
+ return self.ModuleGuid
+
+ def SetModuleVersion(self, ModuleVersion):
+ self.ModuleVersion = ModuleVersion
+
+ def GetModuleVersion(self):
+ return self.ModuleVersion
+
+## TextObject
+#
+# This class defined Text item used in PKG file
+#
+# @param object: Inherited from object class
+#
+class TextObject(object):
+ def __init__(self):
+ self.Lang = TAB_LANGUAGE_EN_US
+ self.String = ''
+
+ def SetLang(self, Lang):
+ self.Lang = Lang
+
+ def GetLang(self):
+ return self.Lang
+
+ def SetString(self, String):
+ self.String = String
+
+ def GetString(self):
+ return self.String
+
+## FileNameObject
+#
+# This class defined File item used in module, for binary files
+#
+# @param CommonPropertiesObject: Inherited from CommonPropertiesObject class
+#
+class FileNameObject(CommonPropertiesObject):
+ def __init__(self):
+ self.FileType = ''
+ self.Filename = ''
+ CommonPropertiesObject.__init__(self)
+
+ def SetFileType(self, FileType):
+ self.FileType = FileType
+
+ def GetFileType(self):
+ return self.FileType
+
+ def SetFilename(self, Filename):
+ self.Filename = Filename
+
+ def GetFilename(self):
+ return self.Filename
+
+## FileObject
+#
+# This class defined File item used in PKG file
+#
+# @param object: Inherited from object class
+#
+class FileObject(object):
+ def __init__(self):
+ self.Executable = ''
+ self.Uri = ''
+ self.OsType = ''
+
+ def SetExecutable(self, Executable):
+ self.Executable = Executable
+
+ def GetExecutable(self):
+ return self.Executable
+
+ def SetURI(self, URI):
+ self.Uri = URI
+
+ def GetURI(self):
+ return self.Uri
+
+ def SetOS(self, OsType):
+ self.OsType = OsType
+
+ def GetOS(self):
+ return self.OsType
+
+##
+# MiscFileObject is used for xml
+#
+# @param CommonHeaderObject: Inherited from CommonHeaderObject class
+#
+class MiscFileObject(CommonHeaderObject):
+ def __init__(self):
+ self.Name = ''
+ self.FileList = []
+ CommonHeaderObject.__init__(self)
+
+ def SetName(self, Name):
+ self.Name = Name
+
+ def GetName(self):
+ return self.Name
+
+ def SetFileList(self, FileList):
+ self.FileList = FileList
+
+ def GetFileList(self):
+ return self.FileList
+
+##
+# ToolsObject
+#
+class ToolsObject(MiscFileObject):
+ pass
+
+## GuidVersionObject
+#
+# This class defined GUID/Version items used in PKG file
+#
+# @param object: Inherited from object class
+#
+class GuidVersionObject(object):
+ def __init__(self):
+ self.Guid = ''
+ self.Version = ''
+
+ def SetGuid(self, Guid):
+ self.Guid = Guid
+
+ def GetGuid(self):
+ return self.Guid
+
+ def SetVersion(self, Version):
+ self.Version = Version
+
+ def GetVersion(self):
+ return self.Version
+
+## IdentificationObject
+#
+# This class defined Identification items used in Module/Platform/Package files
+#
+# @param object: Inherited from object class
+#
+class IdentificationObject(GuidVersionObject):
+ def __init__(self):
+ self.Name = ''
+ self.BaseName = ''
+ self.FileName = ''
+ self.FullPath = ''
+ self.RelaPath = ''
+ self.PackagePath = ''
+ self.ModulePath = ''
+ self.CombinePath = ''
+ GuidVersionObject.__init__(self)
+
+ def SetName(self, Name):
+ self.Name = Name
+
+ def GetName(self):
+ return self.Name
+
+ def SetBaseName(self, BaseName):
+ self.BaseName = BaseName
+
+ def GetBaseName(self):
+ return self.BaseName
+
+ def SetFileName(self, FileName):
+ self.FileName = FileName
+
+ def GetFileName(self):
+ return self.FileName
+
+ def SetFullPath(self, FullPath):
+ self.FullPath = FullPath
+
+ def GetFullPath(self):
+ return self.FullPath
+
+ def SetRelaPath(self, RelaPath):
+ self.RelaPath = RelaPath
+
+ def GetRelaPath(self):
+ return self.RelaPath
+
+ def SetPackagePath(self, PackagePath):
+ self.PackagePath = PackagePath
+
+ def GetPackagePath(self):
+ return self.PackagePath
+
+ def SetModulePath(self, ModulePath):
+ self.ModulePath = ModulePath
+
+ def GetModulePath(self):
+ return self.ModulePath
+
+ def SetCombinePath(self, CombinePath):
+ self.CombinePath = CombinePath
+
+ def GetCombinePath(self):
+ return self.CombinePath
+
+## GuidProtocolPpiCommonObject
+#
+# This class defined Guid, Protocol and Ppi like items used in
+# Module/Platform/Package files
+#
+# @param CommonPropertiesObject: Inherited from CommonPropertiesObject class
+#
+class GuidProtocolPpiCommonObject(CommonPropertiesObject):
+ def __init__(self):
+ self.Name = ''
+ self.CName = ''
+ self.Guid = ''
+ self.SupModuleList = []
+ CommonPropertiesObject.__init__(self)
+
+ def SetName(self, Name):
+ self.Name = Name
+
+ def GetName(self):
+ return self.Name
+
+ def SetCName(self, CName):
+ self.CName = CName
+
+ def GetCName(self):
+ return self.CName
+
+ def SetGuid(self, Guid):
+ self.Guid = Guid
+
+ def GetGuid(self):
+ return self.Guid
+
+ def SetSupModuleList(self, SupModuleList):
+ self.SupModuleList = SupModuleList
+
+ def GetSupModuleList(self):
+ return self.SupModuleList
+
+## GuidObject
+#
+# This class defined Guid item used in Module/Platform/Package files
+#
+# @param GuidProtocolPpiCommonObject: GuidProtocolPpiCommonObject
+#
+class GuidObject(GuidProtocolPpiCommonObject):
+ def __init__(self):
+ self.VariableName = ''
+ self.GuidTypeList = []
+ GuidProtocolPpiCommonObject.__init__(self)
+ def SetVariableName(self, VariableName):
+ self.VariableName = VariableName
+
+ def GetVariableName(self):
+ return self.VariableName
+
+ def SetGuidTypeList(self, GuidTypeList):
+ self.GuidTypeList = GuidTypeList
+
+ def GetGuidTypeList(self):
+ return self.GuidTypeList
+
+## ProtocolObject
+#
+# This class defined Protocol item used in Module/Platform/Package files
+#
+# @param GuidProtocolPpiCommonObject: Inherited from
+# GuidProtocolPpiCommonObject
+#
+class ProtocolObject(GuidProtocolPpiCommonObject):
+ def __init__(self):
+ self.Notify = False
+ GuidProtocolPpiCommonObject.__init__(self)
+ def SetNotify(self, Notify):
+ self.Notify = Notify
+
+ def GetNotify(self):
+ return self.Notify
+
+## PpiObject
+#
+# This class defined Ppi item used in Module/Platform/Package files
+#
+# @param GuidProtocolPpiCommonObject: Inherited from
+# GuidProtocolPpiCommonObject
+#
+class PpiObject(GuidProtocolPpiCommonObject):
+ def __init__(self):
+ self.Notify = False
+ GuidProtocolPpiCommonObject.__init__(self)
+ def SetNotify(self, Notify):
+ self.Notify = Notify
+
+ def GetNotify(self):
+ return self.Notify
+
+## DefineObject
+#
+# This class defined item DEFINE used in Module/Platform/Package files
+#
+# @param object: Inherited from object class
+#
+class DefineClass(object):
+ def __init__(self):
+ self.Define = {}
+
+## UserExtensionObject
+#
+# @param object: Inherited from object class
+#
+class UserExtensionObject(object):
+ def __init__(self):
+ self.UserID = ''
+ self.Identifier = ''
+ self.BinaryAbstractList = []
+ self.BinaryDescriptionList = []
+ self.BinaryCopyrightList = []
+ self.BinaryLicenseList = []
+ self.UniLangDefsList = []
+ #
+ # { Statement : Arch , ... }
+ #
+ self.DefinesDict = {}
+ #
+ # { Arch : Statement , ... }
+ #
+ self.BuildOptionDict = {}
+ self.IncludesDict = {}
+ self.SourcesDict = {}
+ self.BinariesDict = {}
+ #
+ # UserExtension statement from meta-data file [UserExtension] section
+ #
+ self.Statement = ''
+ self.SupArchList = []
+
+ def SetStatement(self, Statement):
+ self.Statement = Statement
+
+ def GetStatement(self):
+ return self.Statement
+
+ def SetSupArchList(self, ArchList):
+ self.SupArchList = ArchList
+
+ def GetSupArchList(self):
+ return self.SupArchList
+
+ def SetUserID(self, UserID):
+ self.UserID = UserID
+
+ def GetUserID(self):
+ return self.UserID
+
+ def SetIdentifier(self, Identifier):
+ self.Identifier = Identifier
+
+ def GetIdentifier(self):
+ return self.Identifier
+
+ def SetUniLangDefsList(self, UniLangDefsList):
+ self.UniLangDefsList = UniLangDefsList
+
+ def GetUniLangDefsList(self):
+ return self.UniLangDefsList
+
+ def SetBinaryAbstract(self, BinaryAbstractList):
+ self.BinaryAbstractList = BinaryAbstractList
+
+ def GetBinaryAbstract(self, Lang=None):
+ if Lang:
+ for (Key, Value) in self.BinaryAbstractList:
+ if Key == Lang:
+ return Value
+ return None
+ else:
+ return self.BinaryAbstractList
+
+ def SetBinaryDescription(self, BinaryDescriptionList):
+ self.BinaryDescriptionList = BinaryDescriptionList
+
+ def GetBinaryDescription(self, Lang=None):
+ if Lang:
+ for (Key, Value) in self.BinaryDescriptionList:
+ if Key == Lang:
+ return Value
+ return None
+ else:
+ return self.BinaryDescriptionList
+
+ def SetBinaryCopyright(self, BinaryCopyrightList):
+ self.BinaryCopyrightList = BinaryCopyrightList
+
+ def GetBinaryCopyright(self, Lang=None):
+ if Lang:
+ for (Key, Value) in self.BinaryCopyrightList:
+ if Key == Lang:
+ return Value
+ return None
+ else:
+ return self.BinaryCopyrightList
+
+ def SetBinaryLicense(self, BinaryLicenseList):
+ self.BinaryLicenseList = BinaryLicenseList
+
+ def GetBinaryLicense(self, Lang=None):
+ if Lang:
+ for (Key, Value) in self.BinaryLicenseList:
+ if Key == Lang:
+ return Value
+ return None
+ else:
+ return self.BinaryLicenseList
+
+ def SetDefinesDict(self, DefinesDict):
+ self.DefinesDict = DefinesDict
+
+ def GetDefinesDict(self):
+ return self.DefinesDict
+
+ def SetBuildOptionDict(self, BuildOptionDict):
+ self.BuildOptionDict = BuildOptionDict
+
+ def GetBuildOptionDict(self):
+ return self.BuildOptionDict
+
+ def SetIncludesDict(self, IncludesDict):
+ self.IncludesDict = IncludesDict
+
+ def GetIncludesDict(self):
+ return self.IncludesDict
+
+ def SetSourcesDict(self, SourcesDict):
+ self.SourcesDict = SourcesDict
+
+ def GetSourcesDict(self):
+ return self.SourcesDict
+
+ def SetBinariesDict(self, BinariesDict):
+ self.BinariesDict = BinariesDict
+
+ def GetBinariesDict(self):
+ return self.BinariesDict
+
+## LibraryClassObject
+#
+# This class defined Library item used in Module/Platform/Package files
+#
+# @param CommonPropertiesObject: Inherited from CommonPropertiesObject class
+#
+class LibraryClassObject(CommonPropertiesObject):
+ def __init__(self):
+ self.LibraryClass = ''
+ self.IncludeHeader = ''
+ self.SupModuleList = []
+ self.RecommendedInstance = GuidVersionObject()
+ CommonPropertiesObject.__init__(self)
+
+ def SetLibraryClass(self, LibraryClass):
+ self.LibraryClass = LibraryClass
+
+ def GetLibraryClass(self):
+ return self.LibraryClass
+
+ def SetSupModuleList(self, SupModuleList):
+ self.SupModuleList = SupModuleList
+
+ def GetSupModuleList(self):
+ return self.SupModuleList
+
+ def SetIncludeHeader(self, IncludeHeader):
+ self.IncludeHeader = IncludeHeader
+
+ def GetIncludeHeader(self):
+ return self.IncludeHeader
+
+ def SetRecommendedInstance(self, RecommendedInstance):
+ self.RecommendedInstance = RecommendedInstance
+
+ def GetRecommendedInstance(self):
+ return self.RecommendedInstance
+
+
+## PcdErrorObject
+#
+# @param object: Inherited from object class
+#
+class PcdErrorObject(object):
+ def __init__(self):
+ self.ValidValue = ''
+ self.ValidValueLang = ''
+ self.ValidValueRange = ''
+ self.Expression = ''
+ self.ErrorNumber = ''
+ self.ErrorMessageList = []
+ self.TokenSpaceGuidCName = ''
+ self.CName = ''
+ self.FileLine = ''
+ self.LineNum = 0
+
+ def SetValidValue(self, ValidValue):
+ self.ValidValue = ValidValue
+
+ def GetValidValue(self):
+ return self.ValidValue
+
+ def SetValidValueLang(self, ValidValueLang):
+ self.ValidValueLang = ValidValueLang
+
+ def GetValidValueLang(self):
+ return self.ValidValueLang
+
+ def SetValidValueRange(self, ValidValueRange):
+ self.ValidValueRange = ValidValueRange
+
+ def GetValidValueRange(self):
+ return self.ValidValueRange
+
+ def SetExpression(self, Expression):
+ self.Expression = Expression
+
+ def GetExpression(self):
+ return self.Expression
+
+ def SetErrorNumber(self, ErrorNumber):
+ self.ErrorNumber = ErrorNumber
+
+ def GetErrorNumber(self):
+ return self.ErrorNumber
+
+ def SetErrorMessageList(self, ErrorMessageList):
+ self.ErrorMessageList = ErrorMessageList
+
+ def GetErrorMessageList(self):
+ return self.ErrorMessageList
+
+ def SetTokenSpaceGuidCName(self, TokenSpaceGuidCName):
+ self.TokenSpaceGuidCName = TokenSpaceGuidCName
+
+ def GetTokenSpaceGuidCName(self):
+ return self.TokenSpaceGuidCName
+
+ def SetCName(self, CName):
+ self.CName = CName
+
+ def GetCName(self):
+ return self.CName
+
+ def SetFileLine(self, FileLine):
+ self.FileLine = FileLine
+
+ def GetFileLine(self):
+ return self.FileLine
+
+ def SetLineNum(self, LineNum):
+ self.LineNum = LineNum
+
+ def GetLineNum(self):
+ return self.LineNum
+
+
+## IncludeObject
+#
+# This class defined Include item used in Module/Platform/Package files
+#
+# @param CommonPropertiesObject: Inherited from CommonPropertiesObject class
+#
+class IncludeObject(CommonPropertiesObject):
+ def __init__(self):
+ self.FilePath = ''
+ self.ModuleType = ''
+ self.SupModuleList = []
+ self.Comment = ''
+ CommonPropertiesObject.__init__(self)
+
+ def SetFilePath(self, FilePath):
+ self.FilePath = FilePath
+
+ def GetFilePath(self):
+ return self.FilePath
+
+ def SetModuleType(self, ModuleType):
+ self.ModuleType = ModuleType
+
+ def GetModuleType(self):
+ return self.ModuleType
+
+ def SetSupModuleList(self, SupModuleList):
+ self.SupModuleList = SupModuleList
+
+ def GetSupModuleList(self):
+ return self.SupModuleList
+
+ def SetComment(self, Comment):
+ self.Comment = Comment
+
+ def GetComment(self):
+ return self.Comment
+
+## PcdObject
+#
+# This class defined Pcd item used in Module/Platform/Package files
+#
+# @param CName: Input value for CName, default is ''
+# @param Token: Input value for Token, default is ''
+# @param TokenSpaceGuidCName: Input value for TokenSpaceGuidCName, default is
+# ''
+# @param DatumType: Input value for DatumType, default is ''
+# @param MaxDatumSize: Input value for MaxDatumSize, default is ''
+# @param DefaultValue: Input value for DefaultValue, default is ''
+# @param ItemType: Input value for ItemType, default is ''
+# @param ValidUsage: Input value for ValidUsage, default is []
+# @param SkuInfoList: Input value for SkuInfoList, default is {}
+# @param SupModuleList: Input value for SupModuleList, default is []
+#
+class PcdObject(CommonPropertiesObject, HelpTextListObject, PromptListObject):
+ def __init__(self):
+ self.PcdCName = ''
+ self.CName = ''
+ self.Token = ''
+ self.TokenSpaceGuidCName = ''
+ self.TokenSpaceGuidValue = ''
+ self.DatumType = ''
+ self.MaxDatumSize = ''
+ self.DefaultValue = ''
+ self.Offset = ''
+ self.ValidUsage = ''
+ self.ItemType = ''
+ self.PcdErrorsList = []
+ self.SupModuleList = []
+ CommonPropertiesObject.__init__(self)
+ HelpTextListObject.__init__(self)
+ PromptListObject.__init__(self)
+
+ def SetPcdCName(self, PcdCName):
+ self.PcdCName = PcdCName
+
+ def GetPcdCName(self):
+ return self.PcdCName
+
+ def SetCName(self, CName):
+ self.CName = CName
+
+ def GetCName(self):
+ return self.CName
+
+ def SetToken(self, Token):
+ self.Token = Token
+
+ def GetOffset(self):
+ return self.Offset
+
+ def SetOffset(self, Offset):
+ self.Offset = Offset
+
+ def GetToken(self):
+ return self.Token
+
+ def SetTokenSpaceGuidCName(self, TokenSpaceGuidCName):
+ self.TokenSpaceGuidCName = TokenSpaceGuidCName
+
+ def GetTokenSpaceGuidCName(self):
+ return self.TokenSpaceGuidCName
+
+ def SetTokenSpaceGuidValue(self, TokenSpaceGuidValue):
+ self.TokenSpaceGuidValue = TokenSpaceGuidValue
+
+ def GetTokenSpaceGuidValue(self):
+ return self.TokenSpaceGuidValue
+
+ def SetDatumType(self, DatumType):
+ self.DatumType = DatumType
+
+ def GetDatumType(self):
+ return self.DatumType
+
+ def SetMaxDatumSize(self, MaxDatumSize):
+ self.MaxDatumSize = MaxDatumSize
+
+ def GetMaxDatumSize(self):
+ return self.MaxDatumSize
+
+ def SetDefaultValue(self, DefaultValue):
+ self.DefaultValue = DefaultValue
+
+ def GetDefaultValue(self):
+ return self.DefaultValue
+
+ def SetValidUsage(self, ValidUsage):
+ self.ValidUsage = ValidUsage
+
+ def GetValidUsage(self):
+ return self.ValidUsage
+
+ def SetPcdErrorsList(self, PcdErrorsList):
+ self.PcdErrorsList = PcdErrorsList
+
+ def GetPcdErrorsList(self):
+ return self.PcdErrorsList
+
+ def SetItemType(self, ItemType):
+ self.ItemType = ItemType
+
+ def GetItemType(self):
+ return self.ItemType
+
+ def SetSupModuleList(self, SupModuleList):
+ self.SupModuleList = SupModuleList
+
+ def GetSupModuleList(self):
+ return self.SupModuleList
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/POM/ModuleObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/POM/ModuleObject.py
new file mode 100644
index 000000000..6e515a2c3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/POM/ModuleObject.py
@@ -0,0 +1,654 @@
+## @file
+# This file is used to define a class object to describe a module
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+ModuleObject
+'''
+
+##
+# Import Modules
+#
+from Object.POM.CommonObject import CommonPropertiesObject
+from Object.POM.CommonObject import IdentificationObject
+from Object.POM.CommonObject import CommonHeaderObject
+from Object.POM.CommonObject import BinaryHeaderObject
+from Object.POM.CommonObject import HelpTextListObject
+from Object.POM.CommonObject import GuidVersionObject
+
+
+##
+# BootModeObject
+#
+class BootModeObject(CommonPropertiesObject, HelpTextListObject):
+ def __init__(self):
+ self.SupportedBootModes = ''
+ CommonPropertiesObject.__init__(self)
+ HelpTextListObject.__init__(self)
+
+ def SetSupportedBootModes(self, SupportedBootModes):
+ self.SupportedBootModes = SupportedBootModes
+
+ def GetSupportedBootModes(self):
+ return self.SupportedBootModes
+
+##
+# EventObject
+#
+class EventObject(CommonPropertiesObject, HelpTextListObject):
+ def __init__(self):
+ self.EventType = ''
+ CommonPropertiesObject.__init__(self)
+ HelpTextListObject.__init__(self)
+
+ def SetEventType(self, EventType):
+ self.EventType = EventType
+
+ def GetEventType(self):
+ return self.EventType
+
+##
+# HobObject
+#
+class HobObject(CommonPropertiesObject, HelpTextListObject):
+ def __init__(self):
+ self.HobType = ''
+ CommonPropertiesObject.__init__(self)
+ HelpTextListObject.__init__(self)
+
+ def SetHobType(self, HobType):
+ self.HobType = HobType
+
+ def GetHobType(self):
+ return self.HobType
+
+##
+# SpecObject
+#
+class SpecObject(object):
+ def __init__(self):
+ self.Spec = ''
+ self.Version = ''
+
+ def SetSpec(self, Spec):
+ self.Spec = Spec
+
+ def GetSpec(self):
+ return self.Spec
+
+ def SetVersion(self, Version):
+ self.Version = Version
+
+ def GetVersion(self):
+ return self.Version
+
+## ModuleHeaderObject
+#
+# This class defined header items used in Module file
+#
+class ModuleHeaderObject(IdentificationObject, CommonHeaderObject, BinaryHeaderObject):
+ def __init__(self):
+ self.IsLibrary = False
+ self.IsLibraryModList = []
+ self.ModuleType = ''
+ self.BinaryModule = False
+ self.PcdIsDriver = ''
+ self.PiSpecificationVersion = ''
+ self.UefiSpecificationVersion = ''
+ self.UNIFlag = False
+ self.ModuleUniFile = ''
+ #
+ # SpecObject
+ #
+ self.SpecList = []
+ #
+ # BootModeObject
+ #
+ self.BootModeList = []
+ #
+ # EventObject
+ #
+ self.EventList = []
+ #
+ # HobObject
+ #
+ self.HobList = []
+ #
+ # LibraryClassObject
+ #
+ self.LibraryClassList = []
+ self.SupArchList = []
+ IdentificationObject.__init__(self)
+ CommonHeaderObject.__init__(self)
+ BinaryHeaderObject.__init__(self)
+
+ def SetIsLibrary(self, IsLibrary):
+ self.IsLibrary = IsLibrary
+
+ def GetIsLibrary(self):
+ return self.IsLibrary
+
+ def SetIsLibraryModList(self, IsLibraryModList):
+ self.IsLibraryModList = IsLibraryModList
+
+ def GetIsLibraryModList(self):
+ return self.IsLibraryModList
+
+ def SetModuleType(self, ModuleType):
+ self.ModuleType = ModuleType
+
+ def GetModuleType(self):
+ return self.ModuleType
+
+ def SetBinaryModule(self, BinaryModule):
+ self.BinaryModule = BinaryModule
+
+ def GetBinaryModule(self):
+ return self.BinaryModule
+
+ def SetPcdIsDriver(self, PcdIsDriver):
+ self.PcdIsDriver = PcdIsDriver
+
+ def GetPcdIsDriver(self):
+ return self.PcdIsDriver
+
+ def SetPiSpecificationVersion(self, PiSpecificationVersion):
+ self.PiSpecificationVersion = PiSpecificationVersion
+
+ def GetPiSpecificationVersion(self):
+ return self.PiSpecificationVersion
+
+ def SetUefiSpecificationVersion(self, UefiSpecificationVersion):
+ self.UefiSpecificationVersion = UefiSpecificationVersion
+
+ def GetUefiSpecificationVersion(self):
+ return self.UefiSpecificationVersion
+
+ def SetSpecList(self, SpecList):
+ self.SpecList = SpecList
+
+ def GetSpecList(self):
+ return self.SpecList
+
+ def SetBootModeList(self, BootModeList):
+ self.BootModeList = BootModeList
+
+ def GetBootModeList(self):
+ return self.BootModeList
+
+ def SetEventList(self, EventList):
+ self.EventList = EventList
+
+ def GetEventList(self):
+ return self.EventList
+
+ def SetHobList(self, HobList):
+ self.HobList = HobList
+
+ def GetHobList(self):
+ return self.HobList
+
+ def SetLibraryClassList(self, LibraryClassList):
+ self.LibraryClassList = LibraryClassList
+
+ def GetLibraryClassList(self):
+ return self.LibraryClassList
+
+ def SetSupArchList(self, SupArchList):
+ self.SupArchList = SupArchList
+
+ def GetSupArchList(self):
+ return self.SupArchList
+
+ def SetModuleUniFile(self, ModuleUniFile):
+ self.ModuleUniFile = ModuleUniFile
+
+ def GetModuleUniFile(self):
+ return self.ModuleUniFile
+##
+# SourceFileObject
+#
+class SourceFileObject(CommonPropertiesObject):
+ def __init__(self):
+ CommonPropertiesObject.__init__(self)
+ self.SourceFile = ''
+ self.TagName = ''
+ self.ToolCode = ''
+ self.Family = ''
+ self.FileType = ''
+
+ def SetSourceFile(self, SourceFile):
+ self.SourceFile = SourceFile
+
+ def GetSourceFile(self):
+ return self.SourceFile
+
+ def SetTagName(self, TagName):
+ self.TagName = TagName
+
+ def GetTagName(self):
+ return self.TagName
+
+ def SetToolCode(self, ToolCode):
+ self.ToolCode = ToolCode
+
+ def GetToolCode(self):
+ return self.ToolCode
+
+ def SetFamily(self, Family):
+ self.Family = Family
+
+ def GetFamily(self):
+ return self.Family
+
+ def SetFileType(self, FileType):
+ self.FileType = FileType
+
+ def GetFileType(self):
+ return self.FileType
+
+
+##
+# BinaryFileObject
+#
+class BinaryFileObject(CommonPropertiesObject):
+ def __init__(self):
+ self.FileNamList = []
+ self.AsBuiltList = []
+ CommonPropertiesObject.__init__(self)
+
+ def SetFileNameList(self, FileNamList):
+ self.FileNamList = FileNamList
+
+ def GetFileNameList(self):
+ return self.FileNamList
+
+ def SetAsBuiltList(self, AsBuiltList):
+ self.AsBuiltList = AsBuiltList
+
+ def GetAsBuiltList(self):
+ return self.AsBuiltList
+
+
+##
+# AsBuildLibraryClassObject
+#
+class AsBuildLibraryClassObject(object):
+ def __init__(self):
+ self.LibGuid = ''
+ self.LibVersion = ''
+ self.SupArchList = []
+
+ def SetLibGuid(self, LibGuid):
+ self.LibGuid = LibGuid
+ def GetLibGuid(self):
+ return self.LibGuid
+
+ def SetLibVersion(self, LibVersion):
+ self.LibVersion = LibVersion
+ def GetLibVersion(self):
+ return self.LibVersion
+
+ def SetSupArchList(self, SupArchList):
+ self.SupArchList = SupArchList
+ def GetSupArchList(self):
+ return self.SupArchList
+
+##
+# AsBuiltObject
+#
+class AsBuiltObject(object):
+ def __init__(self):
+ #
+ # list of PcdObject
+ #
+ self.PatchPcdList = []
+ #
+ # list of PcdObject
+ #
+ self.PcdExValueList = []
+ #
+ # list of GuidVersionObject
+ #
+ self.LibraryInstancesList = []
+ #
+ # List of BinaryBuildFlag object
+ #
+ self.BinaryBuildFlagList = []
+
+ def SetPatchPcdList(self, PatchPcdList):
+ self.PatchPcdList = PatchPcdList
+
+ def GetPatchPcdList(self):
+ return self.PatchPcdList
+
+ def SetPcdExList(self, PcdExValueList):
+ self.PcdExValueList = PcdExValueList
+
+ def GetPcdExList(self):
+ return self.PcdExValueList
+
+ def SetLibraryInstancesList(self, LibraryInstancesList):
+ self.LibraryInstancesList = LibraryInstancesList
+
+ def GetLibraryInstancesList(self):
+ return self.LibraryInstancesList
+
+ def SetBuildFlagsList(self, BinaryBuildFlagList):
+ self.BinaryBuildFlagList = BinaryBuildFlagList
+
+ def GetBuildFlagsList(self):
+ return self.BinaryBuildFlagList
+
+##
+# BinaryBuildFlag, this object will include those fields that are not
+# covered by the UPT Spec BinaryFile field
+#
+class BinaryBuildFlagObject(object):
+ def __init__(self):
+ self.Target = ''
+ self.TagName = ''
+ self.Family = ''
+ self.AsBuiltOptionFlags = ''
+
+ def SetTarget(self, Target):
+ self.Target = Target
+
+ def GetTarget(self):
+ return self.Target
+
+ def SetTagName(self, TagName):
+ self.TagName = TagName
+
+ def GetTagName(self):
+ return self.TagName
+
+ def SetFamily(self, Family):
+ self.Family = Family
+
+ def GetFamily(self):
+ return self.Family
+
+ def SetAsBuiltOptionFlags(self, AsBuiltOptionFlags):
+ self.AsBuiltOptionFlags = AsBuiltOptionFlags
+ def GetAsBuiltOptionFlags(self):
+ return self.AsBuiltOptionFlags
+
+##
+# ExternObject
+#
+class ExternObject(CommonPropertiesObject):
+ def __init__(self):
+ self.EntryPoint = ''
+ self.UnloadImage = ''
+ self.Constructor = ''
+ self.Destructor = ''
+ self.SupModList = []
+ CommonPropertiesObject.__init__(self)
+
+ def SetEntryPoint(self, EntryPoint):
+ self.EntryPoint = EntryPoint
+
+ def GetEntryPoint(self):
+ return self.EntryPoint
+
+ def SetUnloadImage(self, UnloadImage):
+ self.UnloadImage = UnloadImage
+
+ def GetUnloadImage(self):
+ return self.UnloadImage
+
+ def SetConstructor(self, Constructor):
+ self.Constructor = Constructor
+
+ def GetConstructor(self):
+ return self.Constructor
+
+ def SetDestructor(self, Destructor):
+ self.Destructor = Destructor
+
+ def GetDestructor(self):
+ return self.Destructor
+
+ def SetSupModList(self, SupModList):
+ self.SupModList = SupModList
+ def GetSupModList(self):
+ return self.SupModList
+
+##
+# DepexObject
+#
+class DepexObject(CommonPropertiesObject):
+ def __init__(self):
+ self.Depex = ''
+ self.ModuelType = ''
+ CommonPropertiesObject.__init__(self)
+
+ def SetDepex(self, Depex):
+ self.Depex = Depex
+
+ def GetDepex(self):
+ return self.Depex
+
+ def SetModuleType(self, ModuleType):
+ self.ModuelType = ModuleType
+
+ def GetModuleType(self):
+ return self.ModuelType
+
+##
+# PackageDependencyObject
+#
+class PackageDependencyObject(GuidVersionObject, CommonPropertiesObject):
+ def __init__(self):
+ self.Package = ''
+ self.PackageFilePath = ''
+ GuidVersionObject.__init__(self)
+ CommonPropertiesObject.__init__(self)
+
+ def SetPackageFilePath(self, PackageFilePath):
+ self.PackageFilePath = PackageFilePath
+
+ def GetPackageFilePath(self):
+ return self.PackageFilePath
+
+ def SetPackage(self, Package):
+ self.Package = Package
+
+ def GetPackage(self):
+ return self.Package
+
+##
+# BuildOptionObject
+#
+class BuildOptionObject(CommonPropertiesObject):
+ def __init__(self):
+ CommonPropertiesObject.__init__(self)
+ self.BuildOption = ''
+
+ def SetBuildOption(self, BuildOption):
+ self.BuildOption = BuildOption
+
+ def GetBuildOption(self):
+ return self.BuildOption
+
+##
+# ModuleObject
+#
+class ModuleObject(ModuleHeaderObject):
+ def __init__(self):
+ #
+ # {Arch : ModuleHeaderObject}
+ #
+ self.HeaderDict = {}
+ #
+ # LibraryClassObject
+ #
+ self.LibraryClassList = []
+ #
+ # SourceFileObject
+ #
+ self.SourceFileList = []
+ #
+ # BinaryFileObject
+ #
+ self.BinaryFileList = []
+ #
+ # PackageDependencyObject
+ #
+ self.PackageDependencyList = []
+ #
+ # DepexObject
+ #
+ self.PeiDepex = []
+ #
+ # DepexObject
+ #
+ self.DxeDepex = []
+ #
+ # DepexObject
+ #
+ self.SmmDepex = []
+ #
+ # ProtocolObject
+ #
+ self.ProtocolList = []
+ #
+ # PpiObject
+ #
+ self.PpiList = []
+ #
+ # GuidObject
+ #
+ self.GuidList = []
+ #
+ # PcdObject
+ #
+ self.PcdList = []
+ #
+ # ExternObject
+ #
+ self.ExternList = []
+ #
+ # BuildOptionObject
+ #
+ self.BuildOptionList = []
+ #
+ # UserExtensionObject
+ #
+ self.UserExtensionList = []
+ #
+ # MiscFileObject
+ #
+ self.MiscFileList = []
+ #
+ # ClonedFromObject
+ #
+ self.ClonedFrom = None
+
+ ModuleHeaderObject.__init__(self)
+
+ def SetHeaderDict(self, HeaderDict):
+ self.HeaderDict = HeaderDict
+
+ def GetHeaderDict(self):
+ return self.HeaderDict
+
+ def SetLibraryClassList(self, LibraryClassList):
+ self.LibraryClassList = LibraryClassList
+
+ def GetLibraryClassList(self):
+ return self.LibraryClassList
+
+ def SetSourceFileList(self, SourceFileList):
+ self.SourceFileList = SourceFileList
+
+ def GetSourceFileList(self):
+ return self.SourceFileList
+
+ def SetBinaryFileList(self, BinaryFileList):
+ self.BinaryFileList = BinaryFileList
+
+ def GetBinaryFileList(self):
+ return self.BinaryFileList
+
+ def SetPackageDependencyList(self, PackageDependencyList):
+ self.PackageDependencyList = PackageDependencyList
+
+ def GetPackageDependencyList(self):
+ return self.PackageDependencyList
+
+ def SetPeiDepex(self, PeiDepex):
+ self.PeiDepex = PeiDepex
+
+ def GetPeiDepex(self):
+ return self.PeiDepex
+
+ def SetDxeDepex(self, DxeDepex):
+ self.DxeDepex = DxeDepex
+
+ def GetDxeDepex(self):
+ return self.DxeDepex
+
+ def SetSmmDepex(self, SmmDepex):
+ self.SmmDepex = SmmDepex
+
+ def GetSmmDepex(self):
+ return self.SmmDepex
+
+ def SetPpiList(self, PpiList):
+ self.PpiList = PpiList
+
+ def GetPpiList(self):
+ return self.PpiList
+
+ def SetProtocolList(self, ProtocolList):
+ self.ProtocolList = ProtocolList
+
+ def GetProtocolList(self):
+ return self.ProtocolList
+
+ def SetPcdList(self, PcdList):
+ self.PcdList = PcdList
+
+ def GetPcdList(self):
+ return self.PcdList
+
+ def SetGuidList(self, GuidList):
+ self.GuidList = GuidList
+
+ def GetGuidList(self):
+ return self.GuidList
+
+ def SetExternList(self, ExternList):
+ self.ExternList = ExternList
+
+ def GetExternList(self):
+ return self.ExternList
+
+ def SetBuildOptionList(self, BuildOptionList):
+ self.BuildOptionList = BuildOptionList
+
+ def GetBuildOptionList(self):
+ return self.BuildOptionList
+
+ def SetUserExtensionList(self, UserExtensionList):
+ self.UserExtensionList = UserExtensionList
+
+ def GetUserExtensionList(self):
+ return self.UserExtensionList
+
+ def SetMiscFileList(self, MiscFileList):
+ self.MiscFileList = MiscFileList
+
+ def GetMiscFileList(self):
+ return self.MiscFileList
+
+ def SetClonedFrom(self, ClonedFrom):
+ self.ClonedFrom = ClonedFrom
+
+ def GetClonedFrom(self):
+ return self.ClonedFrom
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/POM/PackageObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/POM/PackageObject.py
new file mode 100644
index 000000000..fcc2a3bea
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/POM/PackageObject.py
@@ -0,0 +1,192 @@
+## @file
+# This file is used to define a class object to describe a package
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+PackageObject
+'''
+
+##
+# Import Modules
+#
+from Object.POM.CommonObject import CommonPropertiesObject
+from Object.POM.CommonObject import IdentificationObject
+from Object.POM.CommonObject import CommonHeaderObject
+from Object.POM.CommonObject import BinaryHeaderObject
+from Library.Misc import Sdict
+
+## StandardIncludeFileObject
+#
+class StandardIncludeFileObject(CommonPropertiesObject):
+ def __init__(self):
+ CommonPropertiesObject.__init__(self)
+ self.IncludeFile = ''
+
+ def SetIncludeFile(self, IncludeFile):
+ self.IncludeFile = IncludeFile
+
+ def GetIncludeFile(self):
+ return self.IncludeFile
+
+## PackageIncludeFileObject
+#
+class PackageIncludeFileObject(StandardIncludeFileObject):
+ pass
+
+##
+# PackageObject
+#
+class PackageObject(IdentificationObject, CommonHeaderObject, BinaryHeaderObject):
+ def __init__(self):
+ IdentificationObject.__init__(self)
+ CommonHeaderObject.__init__(self)
+ BinaryHeaderObject.__init__(self)
+ #
+ # LibraryClassObject
+ #
+ self.LibraryClassList = []
+ #
+ # FileObject
+ #
+ self.IncludePathList = []
+ #
+ # StandardIncludeFileObject
+ #
+ self.StandardIncludeFileList = []
+ #
+ # PackageIncludeFileObject
+ #
+ self.PackageIncludeFileList = []
+ #
+ # Include and Arch List, item is (IncludePath, SupArchList-List of Arch), used during install package
+ #
+ self.IncludeArchList = []
+ #
+ # ProtocolObject
+ #
+ self.ProtocolList = []
+ #
+ # PpiObject
+ #
+ self.PpiList = []
+ #
+ # GuidObject
+ #
+ self.GuidList = []
+ #
+ # (PcdObject, PcdErrorObject)
+ #
+ self.PcdList = []
+ #
+ # {(PcdTokenSpaceGuidCName, PcdErrroNumber): PcdErrorMessageList}
+ #
+ self.PcdErrorCommentDict = {}
+ #
+ # UserExtensionObject
+ #
+ self.UserExtensionList = []
+ #
+ # MiscFileObject
+ #
+ self.MiscFileList = []
+ self.ModuleDict = Sdict()
+ #
+ # ClonedRecordObject
+ #
+ self.ClonedFromList = []
+ #
+ # string object
+ #
+ self.ModuleFileList = []
+
+ self.PcdChecks = []
+
+ self.UNIFlag = False
+
+ def SetLibraryClassList(self, LibraryClassList):
+ self.LibraryClassList = LibraryClassList
+
+ def GetLibraryClassList(self):
+ return self.LibraryClassList
+
+ def SetIncludePathList(self, IncludePathList):
+ self.IncludePathList = IncludePathList
+
+ def GetIncludePathList(self):
+ return self.IncludePathList
+
+ def SetIncludeArchList(self, IncludeArchList):
+ self.IncludeArchList = IncludeArchList
+
+ def GetIncludeArchList(self):
+ return self.IncludeArchList
+
+ def SetStandardIncludeFileList(self, StandardIncludeFileList):
+ self.StandardIncludeFileList = StandardIncludeFileList
+
+ def GetStandardIncludeFileList(self):
+ return self.StandardIncludeFileList
+
+ def SetPackageIncludeFileList(self, PackageIncludeFileList):
+ self.PackageIncludeFileList = PackageIncludeFileList
+
+ def GetPackageIncludeFileList(self):
+ return self.PackageIncludeFileList
+
+ def SetProtocolList(self, ProtocolList):
+ self.ProtocolList = ProtocolList
+
+ def GetProtocolList(self):
+ return self.ProtocolList
+
+ def SetPpiList(self, PpiList):
+ self.PpiList = PpiList
+
+ def GetPpiList(self):
+ return self.PpiList
+
+ def SetGuidList(self, GuidList):
+ self.GuidList = GuidList
+
+ def GetGuidList(self):
+ return self.GuidList
+
+ def SetPcdList(self, PcdList):
+ self.PcdList = PcdList
+
+ def GetPcdList(self):
+ return self.PcdList
+
+ def SetUserExtensionList(self, UserExtensionList):
+ self.UserExtensionList = UserExtensionList
+
+ def GetUserExtensionList(self):
+ return self.UserExtensionList
+
+ def SetMiscFileList(self, MiscFileList):
+ self.MiscFileList = MiscFileList
+
+ def GetMiscFileList(self):
+ return self.MiscFileList
+
+ def SetModuleDict(self, ModuleDict):
+ self.ModuleDict = ModuleDict
+
+ def GetModuleDict(self):
+ return self.ModuleDict
+
+ def SetClonedFromList(self, ClonedFromList):
+ self.ClonedFromList = ClonedFromList
+
+ def GetClonedFromList(self):
+ return self.ClonedFromList
+
+ def SetModuleFileList(self, ModuleFileList):
+ self.ModuleFileList = ModuleFileList
+
+ def GetModuleFileList(self):
+ return self.ModuleFileList
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/POM/__init__.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/POM/__init__.py
new file mode 100644
index 000000000..b36e7f658
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/POM/__init__.py
@@ -0,0 +1,14 @@
+## @file
+# Python 'Object' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+POM
+'''
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/DecObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/DecObject.py
new file mode 100644
index 000000000..2a7fcf169
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/DecObject.py
@@ -0,0 +1,605 @@
+## @file
+# This file is used to define class objects for DEC file. It will consumed by
+#DecParser
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+DecObject
+'''
+
+## Import modules
+#
+import os.path
+
+from Library.Misc import Sdict
+from Library.DataType import TAB_GUIDS
+from Library.DataType import TAB_PPIS
+from Library.DataType import TAB_PROTOCOLS
+from Library.DataType import TAB_DEC_DEFINES
+from Library.DataType import TAB_INCLUDES
+from Library.DataType import TAB_LIBRARY_CLASSES
+from Library.DataType import TAB_USER_EXTENSIONS
+from Library.DataType import TAB_PCDS
+from Library.DataType import TAB_ARCH_COMMON
+
+## _DecComments
+#
+# Base class for all data objects which have head and tail comments
+#
+class _DecComments:
+
+ ##constructor
+ #
+ def __init__(self):
+ self._HeadComment = []
+ self._TailComment = []
+
+ ## GetComments
+ #
+ def GetComments(self):
+ return self._HeadComment, self._TailComment
+
+ ## GetHeadComment
+ #
+ def GetHeadComment(self):
+ return self._HeadComment
+
+ ## SetHeadComment
+ #
+ # @param Comment: comment content
+ #
+ def SetHeadComment(self, Comment):
+ self._HeadComment = Comment
+
+ ## GetTailComment
+ #
+ def GetTailComment(self):
+ return self._TailComment
+
+ ## SetTailComment
+ #
+ # @param Comment: comment content
+ #
+ def SetTailComment(self, Comment):
+ self._TailComment = Comment
+
+## _DecBaseObject
+#
+# Base class that hold common info
+#
+class _DecBaseObject(_DecComments):
+ def __init__(self, PkgFullName):
+ _DecComments.__init__(self)
+ #
+ # Key is combined with (Arch, SectionType)
+ # Default is common
+ #
+ self.ValueDict = Sdict()
+ self._PkgFullName = PkgFullName
+ self._PackagePath, self._FileName = os.path.split(PkgFullName)
+ self._SecName = ''
+
+ ## GetSectionName
+ #
+ def GetSectionName(self):
+ return self._SecName
+
+ ## GetPackagePath
+ #
+ def GetPackagePath(self):
+ return self._PackagePath
+
+ ## GetPackageFile
+ #
+ def GetPackageFile(self):
+ return self._FileName
+
+ ## GetPackageFullName
+ #
+ def GetPackageFullName(self):
+ return self._PkgFullName
+
+ ## AddItem
+ # Add sub-item to current object, sub-class should override it if needed
+ #
+ # @param Item: Sub-item to be added
+ # @param Scope: A list store section name and arch info
+ #
+ def AddItem(self, Item, Scope):
+ if not Scope:
+ return
+ if not Item:
+ return
+ ArchModule = []
+ for Ele in Scope:
+ if Ele[1] in self.ValueDict:
+ self.ValueDict[Ele[1]].append(Item)
+ else:
+ self.ValueDict[Ele[1]] = [Item]
+ ArchModule.append(Ele[1])
+ Item.ArchAndModuleType = ArchModule
+
+ ## _GetItemByArch
+ # Helper class used by sub-class
+ # @param Arch: arch
+ #
+ def _GetItemByArch(self, Arch):
+ Arch = Arch.upper()
+ if Arch not in self.ValueDict:
+ return []
+ return self.ValueDict[Arch]
+
+ ## _GetAllItems
+ # Get all items, union all arches, items in returned list are unique
+ #
+ def _GetAllItems(self):
+ Retlst = []
+ for Arch in self.ValueDict:
+ for Item in self.ValueDict[Arch]:
+ if Item not in Retlst:
+ Retlst.append(Item)
+ return Retlst
+
+## _DecItemBaseObject
+#
+# Module type and arch the item belongs to
+#
+class _DecItemBaseObject(_DecComments):
+ def __init__(self):
+ _DecComments.__init__(self)
+ #
+ # Item's arch, if PCD, also include PCD type
+ #
+ self.ArchAndModuleType = []
+
+ ## GetArchList
+ #
+ def GetArchList(self):
+ ArchSet = set()
+ for Arch in self.ArchAndModuleType:
+ ArchSet.add(Arch)
+ return list(ArchSet)
+
+## DecDefineObject
+#
+# Class to hold define section information
+#
+class DecDefineObject(_DecBaseObject):
+ def __init__(self, PkgFullName):
+ _DecBaseObject.__init__(self, PkgFullName)
+ self._SecName = TAB_DEC_DEFINES.upper()
+ self._DecSpec = ''
+ self._PkgName = ''
+ self._PkgGuid = ''
+ self._PkgVersion = ''
+ self._PkgUniFile = ''
+
+ ## GetPackageSpecification
+ #
+ def GetPackageSpecification(self):
+ return self._DecSpec
+
+ def SetPackageSpecification(self, DecSpec):
+ self._DecSpec = DecSpec
+
+ ## GetPackageName
+ #
+ def GetPackageName(self):
+ return self._PkgName
+
+ def SetPackageName(self, PkgName):
+ self._PkgName = PkgName
+
+ ## GetPackageGuid
+ #
+ def GetPackageGuid(self):
+ return self._PkgGuid
+
+ def SetPackageGuid(self, PkgGuid):
+ self._PkgGuid = PkgGuid
+
+ ## GetPackageVersion
+ #
+ def GetPackageVersion(self):
+ return self._PkgVersion
+
+ def SetPackageVersion(self, PkgVersion):
+ self._PkgVersion = PkgVersion
+
+ ## GetPackageUniFile
+ #
+ def GetPackageUniFile(self):
+ return self._PkgUniFile
+
+ def SetPackageUniFile(self, PkgUniFile):
+ self._PkgUniFile = PkgUniFile
+
+ ## GetDefines
+ #
+ def GetDefines(self):
+ return self._GetItemByArch(TAB_ARCH_COMMON)
+
+ ## GetAllDefines
+ #
+ def GetAllDefines(self):
+ return self._GetAllItems()
+
+## DecDefineItemObject
+#
+# Each item of define section
+#
+class DecDefineItemObject(_DecItemBaseObject):
+ def __init__(self):
+ _DecItemBaseObject.__init__(self)
+ self.Key = ''
+ self.Value = ''
+
+ ## __hash__
+ #
+ def __hash__(self):
+ return hash(self.Key + self.Value)
+
+ ## __eq__
+ #
+ def __eq__(self, Other):
+ return id(self) == id(Other)
+
+ ## __str__
+ #
+ def __str__(self):
+ return str(self.ArchAndModuleType) + '\n' + self.Key + \
+ ' = ' + self.Value
+
+## DecIncludeObject
+#
+# Class to hold include section info
+#
+class DecIncludeObject(_DecBaseObject):
+ def __init__(self, PkgFullName):
+ _DecBaseObject.__init__(self, PkgFullName)
+ self._SecName = TAB_INCLUDES.upper()
+
+ ## GetIncludes
+ #
+ def GetIncludes(self, Arch=TAB_ARCH_COMMON):
+ return self._GetItemByArch(Arch)
+
+ ## GetAllIncludes
+ #
+ def GetAllIncludes(self):
+ return self._GetAllItems()
+
+## DecIncludeItemObject
+#
+# Item of include section
+#
+class DecIncludeItemObject(_DecItemBaseObject):
+ def __init__(self, File, Root):
+ self.File = File
+ self.Root = Root
+ _DecItemBaseObject.__init__(self)
+
+ ## __hash__
+ #
+ def __hash__(self):
+ return hash(self.File)
+
+ ## __eq__
+ #
+ def __eq__(self, Other):
+ return id(self) == id(Other)
+
+ ## __str__
+ #
+ def __str__(self):
+ return self.File
+
+## DecLibraryclassObject
+#
+# Class to hold library class section info
+#
+class DecLibraryclassObject(_DecBaseObject):
+ def __init__(self, PkgFullName):
+ _DecBaseObject.__init__(self, PkgFullName)
+ self._PackagePath, self._FileName = os.path.split(PkgFullName)
+ self._SecName = TAB_LIBRARY_CLASSES.upper()
+
+ ## GetLibraryclasses
+ #
+ def GetLibraryclasses(self, Arch=TAB_ARCH_COMMON):
+ return self._GetItemByArch(Arch)
+
+ ## GetAllLibraryclasses
+ #
+ def GetAllLibraryclasses(self):
+ return self._GetAllItems()
+
+## DecLibraryclassItemObject
+# Item of library class section
+#
+class DecLibraryclassItemObject(_DecItemBaseObject):
+ def __init__(self, Libraryclass, File, Root):
+ _DecItemBaseObject.__init__(self)
+ self.File = File
+ self.Root = Root
+ self.Libraryclass = Libraryclass
+
+ ## __hash__
+ #
+ def __hash__(self):
+ return hash(self.Libraryclass + self.File)
+
+ ## __eq__
+ #
+ def __eq__(self, Other):
+ return id(self) == id(Other)
+
+ ## __str__
+ #
+ def __str__(self):
+ return self.Libraryclass + '|' + self.File
+
+## DecPcdObject
+# Class to hold PCD section
+#
+class DecPcdObject(_DecBaseObject):
+ def __init__(self, PkgFullName):
+ _DecBaseObject.__init__(self, PkgFullName)
+ self._SecName = TAB_PCDS.upper()
+
+ ## AddItem
+ #
+ # Diff from base class
+ #
+ # @param Item: Item
+ # @param Scope: Scope
+ #
+ def AddItem(self, Item, Scope):
+ if not Scope:
+ return
+ if not Item:
+ return
+ ArchModule = []
+ for Type, Arch in Scope:
+ if (Type, Arch) in self.ValueDict:
+ self.ValueDict[Type, Arch].append(Item)
+ else:
+ self.ValueDict[Type, Arch] = [Item]
+ ArchModule.append([Type, Arch])
+ Item.ArchAndModuleType = ArchModule
+
+ ## GetPcds
+ #
+ # @param PcdType: PcdType
+ # @param Arch: Arch
+ #
+ def GetPcds(self, PcdType, Arch=TAB_ARCH_COMMON):
+ PcdType = PcdType.upper()
+ Arch = Arch.upper()
+ if (PcdType, Arch) not in self.ValueDict:
+ return []
+ return self.ValueDict[PcdType, Arch]
+
+ ## GetPcdsByType
+ #
+ # @param PcdType: PcdType
+ #
+ def GetPcdsByType(self, PcdType):
+ PcdType = PcdType.upper()
+ Retlst = []
+ for TypeInDict, Arch in self.ValueDict:
+ if TypeInDict != PcdType:
+ continue
+ for Item in self.ValueDict[PcdType, Arch]:
+ if Item not in Retlst:
+ Retlst.append(Item)
+ return Retlst
+
+## DecPcdItemObject
+#
+# Item of PCD section
+#
+# @param _DecItemBaseObject: _DecItemBaseObject object
+#
+class DecPcdItemObject(_DecItemBaseObject):
+ def __init__(self, Guid, Name, Value, DatumType,
+ Token, MaxDatumSize=''):
+ _DecItemBaseObject.__init__(self)
+ self.TokenCName = Name
+ self.TokenSpaceGuidCName = Guid
+ self.DatumType = DatumType
+ self.DefaultValue = Value
+ self.TokenValue = Token
+ self.MaxDatumSize = MaxDatumSize
+
+ ## __hash__
+ #
+ def __hash__(self):
+ return hash(self.TokenSpaceGuidCName + self.TokenCName)
+
+ ## __eq__
+ #
+ def __eq__(self, Other):
+ return id(self) == id(Other)
+
+ ## GetArchListOfType
+ #
+ # @param PcdType: PcdType
+ #
+ def GetArchListOfType(self, PcdType):
+ ItemSet = set()
+ PcdType = PcdType.upper()
+ for Type, Arch in self.ArchAndModuleType:
+ if Type != PcdType:
+ continue
+ ItemSet.add(Arch)
+ return list(ItemSet)
+
+## DecGuidObjectBase
+#
+# Base class for PPI, Protocol, and GUID.
+# Hold same data but has different method for clarification in sub-class
+#
+# @param _DecBaseObject: Dec Base Object
+#
+class DecGuidObjectBase(_DecBaseObject):
+ def __init__(self, PkgFullName):
+ _DecBaseObject.__init__(self, PkgFullName)
+
+ ## GetGuidStyleItems
+ #
+ # @param Arch: Arch
+ #
+ def GetGuidStyleItems(self, Arch=TAB_ARCH_COMMON):
+ return self._GetItemByArch(Arch)
+
+ ## GetGuidStyleAllItems
+ #
+ def GetGuidStyleAllItems(self):
+ return self._GetAllItems()
+
+## DecGuidItemObject
+#
+# Item of GUID, PPI and Protocol section
+#
+# @param _DecItemBaseObject: Dec Item Base Object
+#
+class DecGuidItemObject(_DecItemBaseObject):
+ def __init__(self, CName, GuidCValue, GuidString):
+ _DecItemBaseObject.__init__(self)
+ self.GuidCName = CName
+ self.GuidCValue = GuidCValue
+ self.GuidString = GuidString
+
+ ## __hash__
+ #
+ def __hash__(self):
+ return hash(self.GuidCName)
+
+ ## __eq__
+ #
+ def __eq__(self, Other):
+ return id(self) == id(Other)
+
+ ## __str__
+ #
+ def __str__(self):
+ return self.GuidCName + ' = ' + self.GuidCValue
+
+## DecGuidObject
+#
+# Class for GUID section
+#
+# @param DecGuidObjectBase: Dec Guid Object Base
+#
+class DecGuidObject(DecGuidObjectBase):
+ def __init__(self, PkgFullName):
+ DecGuidObjectBase.__init__(self, PkgFullName)
+ self._SecName = TAB_GUIDS.upper()
+
+ ## GetGuids
+ #
+ # @param Arch: Arch
+ #
+ def GetGuids(self, Arch=TAB_ARCH_COMMON):
+ return self._GetItemByArch(Arch)
+
+ ## GetAllGuids
+ #
+ def GetAllGuids(self):
+ return self._GetAllItems()
+
+## DecPpiObject
+#
+# Class for PPI section
+#
+# @param DecGuidObjectBase: Dec Guid Object Base
+#
+class DecPpiObject(DecGuidObjectBase):
+ def __init__(self, PkgFullName):
+ DecGuidObjectBase.__init__(self, PkgFullName)
+ self._SecName = TAB_PPIS.upper()
+
+ ## GetPpis
+ #
+ # @param Arch: Arch
+ #
+ def GetPpis(self, Arch=TAB_ARCH_COMMON):
+ return self._GetItemByArch(Arch)
+
+ ## GetAllPpis
+ #
+ def GetAllPpis(self):
+ return self._GetAllItems()
+
+## DecProtocolObject
+#
+# Class for protocol section
+#
+# @param DecGuidObjectBase: Dec Guid Object Base
+#
+class DecProtocolObject(DecGuidObjectBase):
+ def __init__(self, PkgFullName):
+ DecGuidObjectBase.__init__(self, PkgFullName)
+ self._SecName = TAB_PROTOCOLS.upper()
+
+ ## GetProtocols
+ #
+ # @param Arch: Arch
+ #
+ def GetProtocols(self, Arch=TAB_ARCH_COMMON):
+ return self._GetItemByArch(Arch)
+
+ ## GetAllProtocols
+ #
+ def GetAllProtocols(self):
+ return self._GetAllItems()
+
+## DecUserExtensionObject
+#
+# Class for user extension section
+#
+# @param _DecBaseObject: Dec Guid Object Base
+#
+class DecUserExtensionObject(_DecBaseObject):
+ def __init__(self, PkgFullName):
+ _DecBaseObject.__init__(self, PkgFullName)
+ self._SecName = TAB_USER_EXTENSIONS.upper()
+ self.ItemList = []
+
+ ## GetProtocols
+ #
+ # @param Item: Item
+ # @param Scope: Scope
+ #
+ def AddItem(self, Item, Scope):
+ if not Scope:
+ pass
+ if not Item:
+ return
+ self.ItemList.append(Item)
+
+ ## GetAllUserExtensions
+ #
+ def GetAllUserExtensions(self):
+ return self.ItemList
+
+
+## DecUserExtensionItemObject
+# Item for user extension section
+#
+# @param _DecItemBaseObject: Dec Item Base Object
+#
+class DecUserExtensionItemObject(_DecItemBaseObject):
+ def __init__(self):
+ _DecItemBaseObject.__init__(self)
+ self.UserString = ''
+ self.UserId = ''
+ self.IdString = ''
+
+
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py
new file mode 100644
index 000000000..6b55d01ab
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py
@@ -0,0 +1,686 @@
+## @file
+# This file is used to define class objects of INF file [Binaries] section.
+# It will consumed by InfParser.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfBinaryObject
+'''
+
+import os
+
+from copy import deepcopy
+from Library import DataType as DT
+from Library import GlobalData
+import Logger.Log as Logger
+from Logger import ToolError
+from Logger import StringTable as ST
+from Library.Misc import Sdict
+
+from Object.Parser.InfCommonObject import InfSectionCommonDef
+from Object.Parser.InfCommonObject import CurrentLine
+from Library.Misc import ConvPathFromAbsToRel
+from Library.ExpressionValidate import IsValidFeatureFlagExp
+from Library.Misc import ValidFile
+from Library.ParserValidate import IsValidPath
+
+
+class InfBianryItem():
+ def __init__(self):
+ self.FileName = ''
+ self.Target = ''
+ self.FeatureFlagExp = ''
+ self.HelpString = ''
+ self.Type = ''
+ self.SupArchList = []
+
+ def SetFileName(self, FileName):
+ self.FileName = FileName
+ def GetFileName(self):
+ return self.FileName
+
+ def SetTarget(self, Target):
+ self.Target = Target
+ def GetTarget(self):
+ return self.Target
+
+ def SetFeatureFlagExp(self, FeatureFlagExp):
+ self.FeatureFlagExp = FeatureFlagExp
+ def GetFeatureFlagExp(self):
+ return self.FeatureFlagExp
+
+ def SetHelpString(self, HelpString):
+ self.HelpString = HelpString
+ def GetHelpString(self):
+ return self.HelpString
+
+ def SetType(self, Type):
+ self.Type = Type
+ def GetType(self):
+ return self.Type
+ def SetSupArchList(self, SupArchList):
+ self.SupArchList = SupArchList
+ def GetSupArchList(self):
+ return self.SupArchList
+
+class InfBianryVerItem(InfBianryItem, CurrentLine):
+ def __init__(self):
+ InfBianryItem.__init__(self)
+ CurrentLine.__init__(self)
+ self.VerTypeName = ''
+
+ def SetVerTypeName(self, VerTypeName):
+ self.VerTypeName = VerTypeName
+ def GetVerTypeName(self):
+ return self.VerTypeName
+
+class InfBianryUiItem(InfBianryItem, CurrentLine):
+ def __init__(self):
+ InfBianryItem.__init__(self)
+ CurrentLine.__init__(self)
+ self.UiTypeName = ''
+
+ def SetUiTypeName(self, UiTypeName):
+ self.UiTypeName = UiTypeName
+ def GetVerTypeName(self):
+ return self.UiTypeName
+
+class InfBianryCommonItem(InfBianryItem, CurrentLine):
+ def __init__(self):
+ self.CommonType = ''
+ self.TagName = ''
+ self.Family = ''
+ self.GuidValue = ''
+ InfBianryItem.__init__(self)
+ CurrentLine.__init__(self)
+
+ def SetCommonType(self, CommonType):
+ self.CommonType = CommonType
+ def GetCommonType(self):
+ return self.CommonType
+
+ def SetTagName(self, TagName):
+ self.TagName = TagName
+ def GetTagName(self):
+ return self.TagName
+
+ def SetFamily(self, Family):
+ self.Family = Family
+ def GetFamily(self):
+ return self.Family
+
+ def SetGuidValue(self, GuidValue):
+ self.GuidValue = GuidValue
+ def GetGuidValue(self):
+ return self.GuidValue
+
+##
+#
+#
+#
+class InfBinariesObject(InfSectionCommonDef):
+ def __init__(self):
+ self.Binaries = Sdict()
+ #
+ # Macro defined in this section should be only used in this section.
+ #
+ self.Macros = {}
+ InfSectionCommonDef.__init__(self)
+
+ ## CheckVer
+ #
+ #
+ def CheckVer(self, Ver, __SupArchList):
+ #
+ # Check Ver
+ #
+ for VerItem in Ver:
+ IsValidFileFlag = False
+ VerContent = VerItem[0]
+ VerComment = VerItem[1]
+ VerCurrentLine = VerItem[2]
+ GlobalData.gINF_CURRENT_LINE = VerCurrentLine
+ InfBianryVerItemObj = None
+ #
+ # Should not less than 2 elements
+ #
+ if len(VerContent) < 2:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID % (VerContent[0], 2),
+ File=VerCurrentLine.GetFileName(),
+ Line=VerCurrentLine.GetLineNo(),
+ ExtraData=VerCurrentLine.GetLineString())
+ return False
+ if len(VerContent) > 4:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID_MAX % (VerContent[0], 4),
+ File=VerCurrentLine.GetFileName(),
+ Line=VerCurrentLine.GetLineNo(),
+ ExtraData=VerCurrentLine.GetLineString())
+ return False
+ if len(VerContent) >= 2:
+ #
+ # Create a Ver Object.
+ #
+ InfBianryVerItemObj = InfBianryVerItem()
+
+ if VerContent[0] != DT.BINARY_FILE_TYPE_VER:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_VER_TYPE % DT.BINARY_FILE_TYPE_VER,
+ File=VerCurrentLine.GetFileName(),
+ Line=VerCurrentLine.GetLineNo(),
+ ExtraData=VerCurrentLine.GetLineString())
+
+ InfBianryVerItemObj.SetVerTypeName(VerContent[0])
+ InfBianryVerItemObj.SetType(VerContent[0])
+ #
+ # Verify File exist or not
+ #
+ FullFileName = os.path.normpath(os.path.realpath(os.path.join(GlobalData.gINF_MODULE_DIR,
+ VerContent[1])))
+ if not (ValidFile(FullFileName) or ValidFile(VerContent[1])):
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_ITEM_FILE_NOT_EXIST % (VerContent[1]),
+ File=VerCurrentLine.GetFileName(),
+ Line=VerCurrentLine.GetLineNo(),
+ ExtraData=VerCurrentLine.GetLineString())
+ #
+ # Validate file exist/format.
+ #
+ if IsValidPath(VerContent[1], GlobalData.gINF_MODULE_DIR):
+ IsValidFileFlag = True
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID % (VerContent[1]),
+ File=VerCurrentLine.GetFileName(),
+ Line=VerCurrentLine.GetLineNo(),
+ ExtraData=VerCurrentLine.GetLineString())
+ return False
+ if IsValidFileFlag:
+ VerContent[0] = ConvPathFromAbsToRel(VerContent[0],
+ GlobalData.gINF_MODULE_DIR)
+ InfBianryVerItemObj.SetFileName(VerContent[1])
+ if len(VerContent) >= 3:
+ #
+ # Add Target information
+ #
+ InfBianryVerItemObj.SetTarget(VerContent[2])
+ if len(VerContent) == 4:
+ if VerContent[3].strip() == '':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
+ File=VerCurrentLine.GetFileName(),
+ Line=VerCurrentLine.GetLineNo(),
+ ExtraData=VerCurrentLine.GetLineString())
+ #
+ # Validate Feature Flag Express
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(VerContent[3].\
+ strip())
+ if not FeatureFlagRtv[0]:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID % (FeatureFlagRtv[1]),
+ File=VerCurrentLine.GetFileName(),
+ Line=VerCurrentLine.GetLineNo(),
+ ExtraData=VerCurrentLine.GetLineString())
+ InfBianryVerItemObj.SetFeatureFlagExp(VerContent[3])
+
+ InfBianryVerItemObj.SetSupArchList(__SupArchList)
+
+ #
+ # Determine binary file name duplicate. Follow below rule:
+ #
+ # A binary filename must not be duplicated within
+ # a [Binaries] section. A binary filename may appear in
+ # multiple architectural [Binaries] sections. A binary
+ # filename listed in an architectural [Binaries] section
+ # must not be listed in the common architectural
+ # [Binaries] section.
+ #
+ # NOTE: This check will not report error now.
+ #
+ for Item in self.Binaries:
+ if Item.GetFileName() == InfBianryVerItemObj.GetFileName():
+ ItemSupArchList = Item.GetSupArchList()
+ for ItemArch in ItemSupArchList:
+ for VerItemObjArch in __SupArchList:
+ if ItemArch == VerItemObjArch:
+ #
+ # ST.ERR_INF_PARSER_ITEM_DUPLICATE
+ #
+ pass
+ if ItemArch.upper() == 'COMMON' or VerItemObjArch.upper() == 'COMMON':
+ #
+ # ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
+ #
+ pass
+
+ if InfBianryVerItemObj is not None:
+ if (InfBianryVerItemObj) in self.Binaries:
+ BinariesList = self.Binaries[InfBianryVerItemObj]
+ BinariesList.append((InfBianryVerItemObj, VerComment))
+ self.Binaries[InfBianryVerItemObj] = BinariesList
+ else:
+ BinariesList = []
+ BinariesList.append((InfBianryVerItemObj, VerComment))
+ self.Binaries[InfBianryVerItemObj] = BinariesList
+
+ ## ParseCommonBinary
+ #
+ # ParseCommonBinary
+ #
+ def ParseCommonBinary(self, CommonBinary, __SupArchList):
+ #
+ # Check common binary definitions
+ # Type | FileName | Target | Family | TagName | FeatureFlagExp
+ #
+ for Item in CommonBinary:
+ IsValidFileFlag = False
+ ItemContent = Item[0]
+ ItemComment = Item[1]
+ CurrentLineOfItem = Item[2]
+ GlobalData.gINF_CURRENT_LINE = CurrentLineOfItem
+ InfBianryCommonItemObj = None
+ if ItemContent[0] == 'SUBTYPE_GUID':
+ if len(ItemContent) < 3:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID % (ItemContent[0], 3),
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+ return False
+ else:
+ if len(ItemContent) < 2:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID % (ItemContent[0], 2),
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+ return False
+
+ if len(ItemContent) > 7:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID_MAX % (ItemContent[0], 7),
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+ return False
+ if len(ItemContent) >= 2:
+ #
+ # Create a Common Object.
+ #
+ InfBianryCommonItemObj = InfBianryCommonItem()
+ #
+ # Convert Binary type.
+ #
+ BinaryFileType = ItemContent[0].strip()
+ if BinaryFileType == 'RAW' or BinaryFileType == 'ACPI' or BinaryFileType == 'ASL':
+ BinaryFileType = 'BIN'
+
+ if BinaryFileType not in DT.BINARY_FILE_TYPE_LIST:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_ITEM_INVALID_FILETYPE % \
+ (DT.BINARY_FILE_TYPE_LIST.__str__()),
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+
+ if BinaryFileType == 'SUBTYPE_GUID':
+ BinaryFileType = 'FREEFORM'
+
+ if BinaryFileType == 'LIB' or BinaryFileType == 'UEFI_APP':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_ITEM_INVALID_FILETYPE % \
+ (DT.BINARY_FILE_TYPE_LIST.__str__()),
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+
+ InfBianryCommonItemObj.SetType(BinaryFileType)
+ InfBianryCommonItemObj.SetCommonType(ItemContent[0])
+ FileName = ''
+ if BinaryFileType == 'FREEFORM':
+ InfBianryCommonItemObj.SetGuidValue(ItemContent[1])
+ if len(ItemContent) >= 3:
+ FileName = ItemContent[2]
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_ITEM_FILENAME_NOT_EXIST,
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+ else:
+ FileName = ItemContent[1]
+ #
+ # Verify File exist or not
+ #
+ FullFileName = os.path.normpath(os.path.realpath(os.path.join(GlobalData.gINF_MODULE_DIR,
+ FileName)))
+ if not (ValidFile(FullFileName) or ValidFile(FileName)):
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_ITEM_FILE_NOT_EXIST % (FileName),
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+ #
+ # Validate file exist/format.
+ #
+ if IsValidPath(FileName, GlobalData.gINF_MODULE_DIR):
+ IsValidFileFlag = True
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID % (FileName),
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+ return False
+ if IsValidFileFlag:
+ ItemContent[0] = ConvPathFromAbsToRel(ItemContent[0], GlobalData.gINF_MODULE_DIR)
+ InfBianryCommonItemObj.SetFileName(FileName)
+ if len(ItemContent) >= 3:
+ #
+ # Add Target information
+ #
+ if BinaryFileType != 'FREEFORM':
+ InfBianryCommonItemObj.SetTarget(ItemContent[2])
+
+ if len(ItemContent) >= 4:
+ #
+ # Add Family information
+ #
+ if BinaryFileType != 'FREEFORM':
+ InfBianryCommonItemObj.SetFamily(ItemContent[3])
+ else:
+ InfBianryCommonItemObj.SetTarget(ItemContent[3])
+
+ if len(ItemContent) >= 5:
+ #
+ # TagName entries are build system specific. If there
+ # is content in the entry, the tool must exit
+ # gracefully with an error message that indicates build
+ # system specific content cannot be distributed using
+ # the UDP
+ #
+ if BinaryFileType != 'FREEFORM':
+ if ItemContent[4].strip() != '':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_TAGNAME_NOT_PERMITTED % (ItemContent[4]),
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+ else:
+ InfBianryCommonItemObj.SetFamily(ItemContent[4])
+
+ if len(ItemContent) >= 6:
+ #
+ # Add FeatureFlagExp
+ #
+ if BinaryFileType != 'FREEFORM':
+ if ItemContent[5].strip() == '':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+ #
+ # Validate Feature Flag Express
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(ItemContent[5].strip())
+ if not FeatureFlagRtv[0]:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID % (FeatureFlagRtv[1]),
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+ InfBianryCommonItemObj.SetFeatureFlagExp(ItemContent[5])
+ else:
+ if ItemContent[5].strip() != '':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_TAGNAME_NOT_PERMITTED % (ItemContent[5]),
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+
+ if len(ItemContent) == 7:
+ if ItemContent[6].strip() == '':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+ #
+ # Validate Feature Flag Express
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(ItemContent[6].strip())
+ if not FeatureFlagRtv[0]:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID % (FeatureFlagRtv[1]),
+ File=CurrentLineOfItem.GetFileName(),
+ Line=CurrentLineOfItem.GetLineNo(),
+ ExtraData=CurrentLineOfItem.GetLineString())
+ InfBianryCommonItemObj.SetFeatureFlagExp(ItemContent[6])
+
+ InfBianryCommonItemObj.SetSupArchList(__SupArchList)
+
+ #
+ # Determine binary file name duplicate. Follow below rule:
+ #
+ # A binary filename must not be duplicated within
+ # a [Binaries] section. A binary filename may appear in
+ # multiple architectural [Binaries] sections. A binary
+ # filename listed in an architectural [Binaries] section
+ # must not be listed in the common architectural
+ # [Binaries] section.
+ #
+ # NOTE: This check will not report error now.
+ #
+# for Item in self.Binaries:
+# if Item.GetFileName() == InfBianryCommonItemObj.GetFileName():
+# ItemSupArchList = Item.GetSupArchList()
+# for ItemArch in ItemSupArchList:
+# for ComItemObjArch in __SupArchList:
+# if ItemArch == ComItemObjArch:
+# #
+# # ST.ERR_INF_PARSER_ITEM_DUPLICATE
+# #
+# pass
+#
+# if ItemArch.upper() == 'COMMON' or ComItemObjArch.upper() == 'COMMON':
+# #
+# # ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
+# #
+# pass
+
+ if InfBianryCommonItemObj is not None:
+ if (InfBianryCommonItemObj) in self.Binaries:
+ BinariesList = self.Binaries[InfBianryCommonItemObj]
+ BinariesList.append((InfBianryCommonItemObj, ItemComment))
+ self.Binaries[InfBianryCommonItemObj] = BinariesList
+ else:
+ BinariesList = []
+ BinariesList.append((InfBianryCommonItemObj, ItemComment))
+ self.Binaries[InfBianryCommonItemObj] = BinariesList
+
+ def SetBinary(self, UiInf=None, Ver=None, CommonBinary=None, ArchList=None):
+
+ __SupArchList = []
+ for ArchItem in ArchList:
+ #
+ # Validate Arch
+ #
+ if (ArchItem == '' or ArchItem is None):
+ ArchItem = 'COMMON'
+ __SupArchList.append(ArchItem)
+
+ if UiInf is not None:
+ if len(UiInf) > 0:
+ #
+ # Check UI
+ #
+ for UiItem in UiInf:
+ IsValidFileFlag = False
+ InfBianryUiItemObj = None
+ UiContent = UiItem[0]
+ UiComment = UiItem[1]
+ UiCurrentLine = UiItem[2]
+ GlobalData.gINF_CURRENT_LINE = deepcopy(UiItem[2])
+ #
+ # Should not less than 2 elements
+ #
+ if len(UiContent) < 2:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID % (UiContent[0], 2),
+ File=UiCurrentLine.GetFileName(),
+ Line=UiCurrentLine.GetLineNo(),
+ ExtraData=UiCurrentLine.GetLineString())
+ return False
+
+ if len(UiContent) > 4:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_ITEM_FORMAT_INVALID_MAX % (UiContent[0], 4),
+ File=UiCurrentLine.GetFileName(),
+ Line=UiCurrentLine.GetLineNo(),
+ ExtraData=UiCurrentLine.GetLineString())
+ return False
+ if len(UiContent) >= 2:
+ #
+ # Create an Ui Object.
+ #
+ InfBianryUiItemObj = InfBianryUiItem()
+ if UiContent[0] != 'UI':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_VER_TYPE % ('UI'),
+ File=UiCurrentLine.GetFileName(),
+ Line=UiCurrentLine.GetLineNo(),
+ ExtraData=UiCurrentLine.GetLineString())
+ InfBianryUiItemObj.SetUiTypeName(UiContent[0])
+ InfBianryUiItemObj.SetType(UiContent[0])
+ #
+ # Verify File exist or not
+ #
+ FullFileName = os.path.normpath(os.path.realpath(os.path.join(GlobalData.gINF_MODULE_DIR,
+ UiContent[1])))
+ if not (ValidFile(FullFileName) or ValidFile(UiContent[1])):
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BINARY_ITEM_FILE_NOT_EXIST % (UiContent[1]),
+ File=UiCurrentLine.GetFileName(),
+ Line=UiCurrentLine.GetLineNo(),
+ ExtraData=UiCurrentLine.GetLineString())
+ #
+ # Validate file exist/format.
+ #
+ if IsValidPath(UiContent[1], GlobalData.gINF_MODULE_DIR):
+ IsValidFileFlag = True
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID % (UiContent[1]),
+ File=UiCurrentLine.GetFileName(),
+ Line=UiCurrentLine.GetLineNo(),
+ ExtraData=UiCurrentLine.GetLineString())
+ return False
+ if IsValidFileFlag:
+ UiContent[0] = ConvPathFromAbsToRel(UiContent[0], GlobalData.gINF_MODULE_DIR)
+ InfBianryUiItemObj.SetFileName(UiContent[1])
+ if len(UiContent) >= 3:
+ #
+ # Add Target information
+ #
+ InfBianryUiItemObj.SetTarget(UiContent[2])
+ if len(UiContent) == 4:
+ if UiContent[3].strip() == '':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
+ File=UiCurrentLine.GetFileName(),
+ Line=UiCurrentLine.GetLineNo(),
+ ExtraData=UiCurrentLine.GetLineString())
+ #
+ # Validate Feature Flag Express
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(UiContent[3].strip())
+ if not FeatureFlagRtv[0]:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID % (FeatureFlagRtv[1]),
+ File=UiCurrentLine.GetFileName(),
+ Line=UiCurrentLine.GetLineNo(),
+ ExtraData=UiCurrentLine.GetLineString())
+ InfBianryUiItemObj.SetFeatureFlagExp(UiContent[3])
+
+ InfBianryUiItemObj.SetSupArchList(__SupArchList)
+
+ #
+ # Determine binary file name duplicate. Follow below rule:
+ #
+ # A binary filename must not be duplicated within
+ # a [Binaries] section. A binary filename may appear in
+ # multiple architectural [Binaries] sections. A binary
+ # filename listed in an architectural [Binaries] section
+ # must not be listed in the common architectural
+ # [Binaries] section.
+ #
+ # NOTE: This check will not report error now.
+ #
+# for Item in self.Binaries:
+# if Item.GetFileName() == InfBianryUiItemObj.GetFileName():
+# ItemSupArchList = Item.GetSupArchList()
+# for ItemArch in ItemSupArchList:
+# for UiItemObjArch in __SupArchList:
+# if ItemArch == UiItemObjArch:
+# #
+# # ST.ERR_INF_PARSER_ITEM_DUPLICATE
+# #
+# pass
+# if ItemArch.upper() == 'COMMON' or UiItemObjArch.upper() == 'COMMON':
+# #
+# # ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
+# #
+# pass
+
+ if InfBianryUiItemObj is not None:
+ if (InfBianryUiItemObj) in self.Binaries:
+ BinariesList = self.Binaries[InfBianryUiItemObj]
+ BinariesList.append((InfBianryUiItemObj, UiComment))
+ self.Binaries[InfBianryUiItemObj] = BinariesList
+ else:
+ BinariesList = []
+ BinariesList.append((InfBianryUiItemObj, UiComment))
+ self.Binaries[InfBianryUiItemObj] = BinariesList
+ if Ver is not None and len(Ver) > 0:
+ self.CheckVer(Ver, __SupArchList)
+ if CommonBinary and len(CommonBinary) > 0:
+ self.ParseCommonBinary(CommonBinary, __SupArchList)
+
+ return True
+
+ def GetBinary(self):
+ return self.Binaries
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfBuildOptionObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfBuildOptionObject.py
new file mode 100644
index 000000000..fdba5db98
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfBuildOptionObject.py
@@ -0,0 +1,87 @@
+## @file
+# This file is used to define class objects of INF file [BuildOptions] section.
+# It will consumed by InfParser.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfBuildOptionObject
+'''
+
+from Library import GlobalData
+
+from Object.Parser.InfCommonObject import InfSectionCommonDef
+
+class InfBuildOptionItem():
+ def __init__(self):
+ self.Content = ''
+ self.SupArchList = []
+ self.AsBuildList = []
+
+ def SetContent(self, Content):
+ self.Content = Content
+ def GetContent(self):
+ return self.Content
+
+ def SetSupArchList(self, SupArchList):
+ self.SupArchList = SupArchList
+ def GetSupArchList(self):
+ return self.SupArchList
+
+ #
+ # AsBuild Information
+ #
+ def SetAsBuildList(self, AsBuildList):
+ self.AsBuildList = AsBuildList
+ def GetAsBuildList(self):
+ return self.AsBuildList
+
+
+## INF BuildOption section
+# Macro define is not permitted for this section.
+#
+#
+class InfBuildOptionsObject(InfSectionCommonDef):
+ def __init__(self):
+ self.BuildOptions = []
+ InfSectionCommonDef.__init__(self)
+ ## SetBuildOptions function
+ #
+ # For BuildOptionName, need to validate its format
+ # For BuildOptionValue, just ignore it.
+ #
+ # @param Arch Indicated which arch of build options belong to.
+ # @param BuildOptCont A list contain BuildOption related information.
+ # The element in the list contain 3 members.
+ # BuildOptionName, BuildOptionValue and IsReplace
+ # flag.
+ #
+ # @return True Build options set/validate successfully
+ # @return False Build options set/validate failed
+ #
+ def SetBuildOptions(self, BuildOptCont, ArchList = None, SectionContent = ''):
+
+ if not GlobalData.gIS_BINARY_INF:
+
+ if SectionContent.strip() != '':
+ InfBuildOptionItemObj = InfBuildOptionItem()
+ InfBuildOptionItemObj.SetContent(SectionContent)
+ InfBuildOptionItemObj.SetSupArchList(ArchList)
+
+ self.BuildOptions.append(InfBuildOptionItemObj)
+ else:
+ #
+ # For AsBuild INF file
+ #
+ if len(BuildOptCont) >= 1:
+ InfBuildOptionItemObj = InfBuildOptionItem()
+ InfBuildOptionItemObj.SetAsBuildList(BuildOptCont)
+ InfBuildOptionItemObj.SetSupArchList(ArchList)
+ self.BuildOptions.append(InfBuildOptionItemObj)
+
+ return True
+
+ def GetBuildOptions(self):
+ return self.BuildOptions
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfCommonObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfCommonObject.py
new file mode 100644
index 000000000..aa23d0878
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfCommonObject.py
@@ -0,0 +1,156 @@
+## @file
+# This file is used to define common class objects for INF file.
+# It will consumed by InfParser
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfCommonObject
+'''
+
+## InfLineCommentObject
+#
+# Comment Object for any line in the INF file
+#
+# #
+# # HeaderComment
+# #
+# Line # TailComment
+#
+class InfLineCommentObject():
+ def __init__(self):
+ self.HeaderComments = ''
+ self.TailComments = ''
+
+ def SetHeaderComments(self, HeaderComments):
+ self.HeaderComments = HeaderComments
+
+ def GetHeaderComments(self):
+ return self.HeaderComments
+
+ def SetTailComments(self, TailComments):
+ self.TailComments = TailComments
+
+ def GetTailComments(self):
+ return self.TailComments
+
+## CurrentLine
+#
+class CurrentLine():
+ def __init__(self):
+ self.LineNo = ''
+ self.LineString = ''
+ self.FileName = ''
+
+ ## SetLineNo
+ #
+ # @param LineNo: LineNo
+ #
+ def SetLineNo(self, LineNo):
+ self.LineNo = LineNo
+
+ ## GetLineNo
+ #
+ def GetLineNo(self):
+ return self.LineNo
+
+ ## SetLineString
+ #
+ # @param LineString: Line String content
+ #
+ def SetLineString(self, LineString):
+ self.LineString = LineString
+
+ ## GetLineString
+ #
+ def GetLineString(self):
+ return self.LineString
+
+ ## SetFileName
+ #
+ # @param FileName: File Name
+ #
+ def SetFileName(self, FileName):
+ self.FileName = FileName
+
+ ## GetFileName
+ #
+ def GetFileName(self):
+ return self.FileName
+
+##
+# Inf Section common data
+#
+class InfSectionCommonDef():
+ def __init__(self):
+ #
+ # #
+ # # HeaderComments at here
+ # #
+ # [xxSection] TailComments at here
+ # data
+ #
+ self.HeaderComments = ''
+ self.TailComments = ''
+ #
+ # The support arch list of this section
+ #
+ self.SupArchList = []
+
+ #
+ # Store all section content
+ # Key is supported Arch
+ #
+ self.AllContent = {}
+
+ ## SetHeaderComments
+ #
+ # @param HeaderComments: HeaderComments
+ #
+ def SetHeaderComments(self, HeaderComments):
+ self.HeaderComments = HeaderComments
+
+ ## GetHeaderComments
+ #
+ def GetHeaderComments(self):
+ return self.HeaderComments
+
+ ## SetTailComments
+ #
+ # @param TailComments: TailComments
+ #
+ def SetTailComments(self, TailComments):
+ self.TailComments = TailComments
+
+ ## GetTailComments
+ #
+ def GetTailComments(self):
+ return self.TailComments
+
+ ## SetSupArchList
+ #
+ # @param Arch: Arch
+ #
+ def SetSupArchList(self, Arch):
+ if Arch not in self.SupArchList:
+ self.SupArchList.append(Arch)
+
+ ## GetSupArchList
+ #
+ def GetSupArchList(self):
+ return self.SupArchList
+
+ ## SetAllContent
+ #
+ # @param ArchList: ArchList
+ # @param Content: Content
+ #
+ def SetAllContent(self, Content):
+ self.AllContent = Content
+
+ ## GetAllContent
+ #
+ def GetAllContent(self):
+ return self.AllContent
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfDefineCommonObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfDefineCommonObject.py
new file mode 100644
index 000000000..738a4c2db
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfDefineCommonObject.py
@@ -0,0 +1,83 @@
+## @file
+# This file is used to define common class objects of [Defines] section for INF file.
+# It will consumed by InfParser
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfDefineCommonObject
+'''
+
+from Object.Parser.InfCommonObject import InfLineCommentObject
+
+## InfDefineImageExeParamItem
+#
+class InfDefineImageExeParamItem():
+ def __init__(self):
+ self.CName = ''
+ self.FeatureFlagExp = ''
+ self.Comments = InfLineCommentObject()
+
+ def SetCName(self, CName):
+ self.CName = CName
+ def GetCName(self):
+ return self.CName
+ def SetFeatureFlagExp(self, FeatureFlagExp):
+ self.FeatureFlagExp = FeatureFlagExp
+ def GetFeatureFlagExp(self):
+ return self.FeatureFlagExp
+
+## InfDefineEntryPointItem
+#
+class InfDefineEntryPointItem(InfDefineImageExeParamItem):
+ def __init__(self):
+ InfDefineImageExeParamItem.__init__(self)
+
+## InfDefineUnloadImageItem
+#
+class InfDefineUnloadImageItem(InfDefineImageExeParamItem):
+ def __init__(self):
+ InfDefineImageExeParamItem.__init__(self)
+
+## InfDefineConstructorItem
+#
+class InfDefineConstructorItem(InfDefineImageExeParamItem):
+ def __init__(self):
+ InfDefineImageExeParamItem.__init__(self)
+ self.SupModList = []
+
+ def SetSupModList(self, SupModList):
+ self.SupModList = SupModList
+ def GetSupModList(self):
+ return self.SupModList
+
+## InfDefineDestructorItem
+#
+class InfDefineDestructorItem(InfDefineImageExeParamItem):
+ def __init__(self):
+ InfDefineImageExeParamItem.__init__(self)
+ self.SupModList = []
+
+ def SetSupModList(self, SupModList):
+ self.SupModList = SupModList
+ def GetSupModList(self):
+ return self.SupModList
+
+## InfDefineLibraryItem
+#
+class InfDefineLibraryItem():
+ def __init__(self):
+ self.LibraryName = ''
+ self.Types = []
+ self.Comments = InfLineCommentObject()
+
+ def SetLibraryName(self, Name):
+ self.LibraryName = Name
+ def GetLibraryName(self):
+ return self.LibraryName
+ def SetTypes(self, Type):
+ self.Types = Type
+ def GetTypes(self):
+ return self.Types
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py
new file mode 100644
index 000000000..a1b691ff0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py
@@ -0,0 +1,1002 @@
+## @file
+# This file is used to define class objects of [Defines] section for INF file.
+# It will consumed by InfParser
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfDefineObject
+'''
+
+import os
+import re
+
+from Logger import StringTable as ST
+from Logger import ToolError
+from Library import GlobalData
+from Library import DataType as DT
+from Library.StringUtils import GetSplitValueList
+from Library.Misc import CheckGuidRegFormat
+from Library.Misc import Sdict
+from Library.Misc import ConvPathFromAbsToRel
+from Library.Misc import ValidateUNIFilePath
+from Library.ExpressionValidate import IsValidFeatureFlagExp
+from Library.ParserValidate import IsValidWord
+from Library.ParserValidate import IsValidInfMoudleType
+from Library.ParserValidate import IsValidHex
+from Library.ParserValidate import IsValidHexVersion
+from Library.ParserValidate import IsValidDecVersion
+from Library.ParserValidate import IsValidCVariableName
+from Library.ParserValidate import IsValidBoolType
+from Library.ParserValidate import IsValidPath
+from Library.ParserValidate import IsValidFamily
+from Library.ParserValidate import IsValidIdentifier
+from Library.ParserValidate import IsValidDecVersionVal
+from Object.Parser.InfCommonObject import InfLineCommentObject
+from Object.Parser.InfCommonObject import CurrentLine
+from Object.Parser.InfCommonObject import InfSectionCommonDef
+from Object.Parser.InfMisc import ErrorInInf
+from Object.Parser.InfDefineCommonObject import InfDefineLibraryItem
+from Object.Parser.InfDefineCommonObject import InfDefineEntryPointItem
+from Object.Parser.InfDefineCommonObject import InfDefineUnloadImageItem
+from Object.Parser.InfDefineCommonObject import InfDefineConstructorItem
+from Object.Parser.InfDefineCommonObject import InfDefineDestructorItem
+
+class InfDefSectionOptionRomInfo():
+ def __init__(self):
+ self.PciVendorId = None
+ self.PciDeviceId = None
+ self.PciClassCode = None
+ self.PciRevision = None
+ self.PciCompress = None
+ self.CurrentLine = ['', -1, '']
+ def SetPciVendorId(self, PciVendorId, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.PciVendorId is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_VENDOR_ID),
+ LineInfo=self.CurrentLine)
+ return False
+ #
+ # The PciVendorId should be hex string.
+ #
+ if (IsValidHex(PciVendorId)):
+ self.PciVendorId = InfDefMember()
+ self.PciVendorId.SetValue(PciVendorId)
+ self.PciVendorId.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(PciVendorId),
+ LineInfo=self.CurrentLine)
+ return False
+
+ def GetPciVendorId(self):
+ return self.PciVendorId
+
+ def SetPciDeviceId(self, PciDeviceId, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.PciDeviceId is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_DEVICE_ID),
+ LineInfo=self.CurrentLine)
+ return False
+ #
+ # The PciDeviceId should be hex string.
+ #
+ if (IsValidHex(PciDeviceId)):
+ self.PciDeviceId = InfDefMember()
+ self.PciDeviceId.SetValue(PciDeviceId)
+ self.PciDeviceId.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(PciDeviceId),
+ LineInfo=self.CurrentLine)
+ return False
+
+ def GetPciDeviceId(self):
+ return self.PciDeviceId
+
+ def SetPciClassCode(self, PciClassCode, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.PciClassCode is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_CLASS_CODE),
+ LineInfo=self.CurrentLine)
+ return False
+ #
+ # The PciClassCode should be 4 bytes hex string.
+ #
+ if (IsValidHex(PciClassCode)):
+ self.PciClassCode = InfDefMember()
+ self.PciClassCode.SetValue(PciClassCode)
+ self.PciClassCode.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%\
+ (PciClassCode),
+ LineInfo=self.CurrentLine)
+ return False
+
+ def GetPciClassCode(self):
+ return self.PciClassCode
+
+ def SetPciRevision(self, PciRevision, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.PciRevision is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_REVISION),
+ LineInfo=self.CurrentLine)
+ return False
+ #
+ # The PciRevision should be 4 bytes hex string.
+ #
+ if (IsValidHex(PciRevision)):
+ self.PciRevision = InfDefMember()
+ self.PciRevision.SetValue(PciRevision)
+ self.PciRevision.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(PciRevision),
+ LineInfo=self.CurrentLine)
+ return False
+
+ def GetPciRevision(self):
+ return self.PciRevision
+
+ def SetPciCompress(self, PciCompress, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.PciCompress is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_COMPRESS),
+ LineInfo=self.CurrentLine)
+ return False
+
+ #
+ # The PciCompress should be 'TRUE' or 'FALSE'.
+ #
+ if (PciCompress == 'TRUE' or PciCompress == 'FALSE'):
+ self.PciCompress = InfDefMember()
+ self.PciCompress.SetValue(PciCompress)
+ self.PciCompress.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(PciCompress),
+ LineInfo=self.CurrentLine)
+ return False
+ def GetPciCompress(self):
+ return self.PciCompress
+##
+# INF [Define] section Object
+#
+class InfDefSection(InfDefSectionOptionRomInfo):
+ def __init__(self):
+ self.BaseName = None
+ self.FileGuid = None
+ self.ModuleType = None
+ self.ModuleUniFileName = None
+ self.InfVersion = None
+ self.EdkReleaseVersion = None
+ self.UefiSpecificationVersion = None
+ self.PiSpecificationVersion = None
+ self.LibraryClass = []
+ self.Package = None
+ self.VersionString = None
+ self.PcdIsDriver = None
+ self.EntryPoint = []
+ self.UnloadImages = []
+ self.Constructor = []
+ self.Destructor = []
+ self.Shadow = None
+ self.CustomMakefile = []
+ self.Specification = []
+ self.UefiHiiResourceSection = None
+ self.DpxSource = []
+ self.CurrentLine = ['', -1, '']
+ InfDefSectionOptionRomInfo.__init__(self)
+
+ ## SetHeadComment
+ #
+ # @param BaseName: BaseName
+ #
+ def SetBaseName(self, BaseName, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.BaseName is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_BASE_NAME),
+ LineInfo=self.CurrentLine)
+ return False
+ if not (BaseName == '' or BaseName is None):
+ if IsValidWord(BaseName) and not BaseName.startswith("_"):
+ self.BaseName = InfDefMember()
+ self.BaseName.SetValue(BaseName)
+ self.BaseName.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_NAME_INVALID%(BaseName),
+ LineInfo=self.CurrentLine)
+ return False
+
+ ## GetBaseName
+ #
+ def GetBaseName(self):
+ return self.BaseName
+
+ ## SetFileGuid
+ #
+ # @param FileGuid: FileGuid
+ #
+ def SetFileGuid(self, FileGuid, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.FileGuid is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
+ %(DT.TAB_INF_DEFINES_FILE_GUID),
+ LineInfo=self.CurrentLine)
+ return False
+ #
+ # Do verification of GUID content/format
+ #
+ if (CheckGuidRegFormat(FileGuid)):
+ self.FileGuid = InfDefMember()
+ self.FileGuid.SetValue(FileGuid)
+ self.FileGuid.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_GUID_INVALID%(FileGuid),
+ LineInfo=self.CurrentLine)
+ return False
+
+ ## GetFileGuid
+ #
+ def GetFileGuid(self):
+ return self.FileGuid
+
+ ## SetModuleType
+ #
+ # @param ModuleType: ModuleType
+ #
+ def SetModuleType(self, ModuleType, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.ModuleType is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
+ %(DT.TAB_INF_DEFINES_MODULE_TYPE),
+ LineInfo=self.CurrentLine)
+ return False
+ #
+ # Valid Module Type or not
+ #
+ if (IsValidInfMoudleType(ModuleType)):
+ self.ModuleType = InfDefMember()
+ self.ModuleType.SetValue(ModuleType)
+ self.ModuleType.CurrentLine = CurrentLine()
+ self.ModuleType.CurrentLine.SetLineNo(self.CurrentLine[1])
+ self.ModuleType.CurrentLine.SetLineString(self.CurrentLine[2])
+ self.ModuleType.CurrentLine.SetFileName(self.CurrentLine[0])
+ self.ModuleType.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_MODULETYPE_INVALID%\
+ (ModuleType),
+ LineInfo=self.CurrentLine)
+ return False
+
+ ## GetModuleType
+ #
+ def GetModuleType(self):
+ return self.ModuleType
+
+ ## SetModuleUniFileName
+ #
+ # @param ModuleUniFileName: ModuleUniFileName
+ #
+ def SetModuleUniFileName(self, ModuleUniFileName, Comments):
+ if Comments:
+ pass
+ if self.ModuleUniFileName is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_MODULE_UNI_FILE),
+ LineInfo=self.CurrentLine)
+ self.ModuleUniFileName = ModuleUniFileName
+
+ ## GetModuleType
+ #
+ def GetModuleUniFileName(self):
+ return self.ModuleUniFileName
+
+ ## SetInfVersion
+ #
+ # @param InfVersion: InfVersion
+ #
+ def SetInfVersion(self, InfVersion, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.InfVersion is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
+ %(DT.TAB_INF_DEFINES_INF_VERSION),
+ LineInfo=self.CurrentLine)
+ return False
+ #
+ # The InfVersion should be 4 bytes hex string.
+ #
+ if (IsValidHex(InfVersion)):
+ if (InfVersion < '0x00010005'):
+ ErrorInInf(ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF,
+ ErrorCode=ToolError.EDK1_INF_ERROR,
+ LineInfo=self.CurrentLine)
+ elif IsValidDecVersionVal(InfVersion):
+ if (InfVersion < 65541):
+ ErrorInInf(ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF,
+ ErrorCode=ToolError.EDK1_INF_ERROR,
+ LineInfo=self.CurrentLine)
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(InfVersion),
+ LineInfo=self.CurrentLine)
+ return False
+
+ self.InfVersion = InfDefMember()
+ self.InfVersion.SetValue(InfVersion)
+ self.InfVersion.Comments = Comments
+ return True
+
+ ## GetInfVersion
+ #
+ def GetInfVersion(self):
+ return self.InfVersion
+
+ ## SetEdkReleaseVersion
+ #
+ # @param EdkReleaseVersion: EdkReleaseVersion
+ #
+ def SetEdkReleaseVersion(self, EdkReleaseVersion, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.EdkReleaseVersion is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
+ %(DT.TAB_INF_DEFINES_EDK_RELEASE_VERSION),
+ LineInfo=self.CurrentLine)
+ return False
+ #
+ # The EdkReleaseVersion should be 4 bytes hex string.
+ #
+ if IsValidHexVersion(EdkReleaseVersion) or \
+ IsValidDecVersionVal(EdkReleaseVersion):
+ self.EdkReleaseVersion = InfDefMember()
+ self.EdkReleaseVersion.SetValue(EdkReleaseVersion)
+ self.EdkReleaseVersion.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID\
+ %(EdkReleaseVersion),
+ LineInfo=self.CurrentLine)
+ return False
+
+ ## GetEdkReleaseVersion
+ #
+ def GetEdkReleaseVersion(self):
+ return self.EdkReleaseVersion
+
+ ## SetUefiSpecificationVersion
+ #
+ # @param UefiSpecificationVersion: UefiSpecificationVersion
+ #
+ def SetUefiSpecificationVersion(self, UefiSpecificationVersion, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.UefiSpecificationVersion is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
+ %(DT.TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION),
+ LineInfo=self.CurrentLine)
+ return False
+ #
+ # The EdkReleaseVersion should be 4 bytes hex string.
+ #
+ if IsValidHexVersion(UefiSpecificationVersion) or \
+ IsValidDecVersionVal(UefiSpecificationVersion):
+ self.UefiSpecificationVersion = InfDefMember()
+ self.UefiSpecificationVersion.SetValue(UefiSpecificationVersion)
+ self.UefiSpecificationVersion.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID\
+ %(UefiSpecificationVersion),
+ LineInfo=self.CurrentLine)
+ return False
+
+ ## GetUefiSpecificationVersion
+ #
+ def GetUefiSpecificationVersion(self):
+ return self.UefiSpecificationVersion
+
+ ## SetPiSpecificationVersion
+ #
+ # @param PiSpecificationVersion: PiSpecificationVersion
+ #
+ def SetPiSpecificationVersion(self, PiSpecificationVersion, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.PiSpecificationVersion is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
+ %(DT.TAB_INF_DEFINES_PI_SPECIFICATION_VERSION),
+ LineInfo=self.CurrentLine)
+ return False
+ #
+ # The EdkReleaseVersion should be 4 bytes hex string.
+ #
+ if IsValidHexVersion(PiSpecificationVersion) or \
+ IsValidDecVersionVal(PiSpecificationVersion):
+ self.PiSpecificationVersion = InfDefMember()
+ self.PiSpecificationVersion.SetValue(PiSpecificationVersion)
+ self.PiSpecificationVersion.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID\
+ %(PiSpecificationVersion),
+ LineInfo=self.CurrentLine)
+ return False
+
+ ## GetPiSpecificationVersion
+ #
+ def GetPiSpecificationVersion(self):
+ return self.PiSpecificationVersion
+
+ ## SetLibraryClass
+ #
+ # @param LibraryClass: LibraryClass
+ #
+ def SetLibraryClass(self, LibraryClass, Comments):
+ ValueList = GetSplitValueList(LibraryClass)
+ Name = ValueList[0]
+ if IsValidWord(Name):
+ InfDefineLibraryItemObj = InfDefineLibraryItem()
+ InfDefineLibraryItemObj.SetLibraryName(Name)
+ InfDefineLibraryItemObj.Comments = Comments
+ if len(ValueList) == 2:
+ Type = ValueList[1]
+ TypeList = GetSplitValueList(Type, ' ')
+ TypeList = [Type for Type in TypeList if Type != '']
+ for Item in TypeList:
+ if Item not in DT.MODULE_LIST:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Item),
+ LineInfo=self.CurrentLine)
+ return False
+ InfDefineLibraryItemObj.SetTypes(TypeList)
+ self.LibraryClass.append(InfDefineLibraryItemObj)
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Name),
+ LineInfo=self.CurrentLine)
+ return False
+
+ return True
+
+ def GetLibraryClass(self):
+ return self.LibraryClass
+
+ def SetVersionString(self, VersionString, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.VersionString is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
+ %(DT.TAB_INF_DEFINES_VERSION_STRING),
+ LineInfo=self.CurrentLine)
+ return False
+ if not IsValidDecVersion(VersionString):
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID\
+ %(VersionString),
+ LineInfo=self.CurrentLine)
+ self.VersionString = InfDefMember()
+ self.VersionString.SetValue(VersionString)
+ self.VersionString.Comments = Comments
+ return True
+
+
+ def GetVersionString(self):
+ return self.VersionString
+
+ def SetPcdIsDriver(self, PcdIsDriver, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.PcdIsDriver is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
+ %(DT.TAB_INF_DEFINES_PCD_IS_DRIVER),
+ LineInfo=self.CurrentLine)
+ return False
+ if PcdIsDriver == 'PEI_PCD_DRIVER' or PcdIsDriver == 'DXE_PCD_DRIVER':
+ self.PcdIsDriver = InfDefMember()
+ self.PcdIsDriver.SetValue(PcdIsDriver)
+ self.PcdIsDriver.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(PcdIsDriver),
+ LineInfo=self.CurrentLine)
+ return False
+
+ def GetPcdIsDriver(self):
+ return self.PcdIsDriver
+
+ #
+ # SetEntryPoint
+ #
+ def SetEntryPoint(self, EntryPoint, Comments):
+ #
+ # It can be a list
+ #
+ ValueList = []
+ TokenList = GetSplitValueList(EntryPoint, DT.TAB_VALUE_SPLIT)
+ ValueList[0:len(TokenList)] = TokenList
+ InfDefineEntryPointItemObj = InfDefineEntryPointItem()
+ if not IsValidCVariableName(ValueList[0]):
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%\
+ (ValueList[0]),
+ LineInfo=self.CurrentLine)
+ InfDefineEntryPointItemObj.SetCName(ValueList[0])
+ if len(ValueList) == 2:
+ if ValueList[1].strip() == '':
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%\
+ (ValueList[1]),
+ LineInfo=self.CurrentLine)
+ #
+ # Validate FFE
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(ValueList[1].strip())
+ if not FeatureFlagRtv[0]:
+ ErrorInInf(ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%\
+ (FeatureFlagRtv[1]),
+ LineInfo=self.CurrentLine)
+ InfDefineEntryPointItemObj.SetFeatureFlagExp(ValueList[1])
+ if len(ValueList) > 2:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(EntryPoint),
+ LineInfo=self.CurrentLine)
+ InfDefineEntryPointItemObj.Comments = Comments
+ self.EntryPoint.append(InfDefineEntryPointItemObj)
+
+ def GetEntryPoint(self):
+ return self.EntryPoint
+
+ #
+ # SetUnloadImages
+ #
+ def SetUnloadImages(self, UnloadImages, Comments):
+ #
+ # It can be a list
+ #
+ ValueList = []
+ TokenList = GetSplitValueList(UnloadImages, DT.TAB_VALUE_SPLIT)
+ ValueList[0:len(TokenList)] = TokenList
+ InfDefineUnloadImageItemObj = InfDefineUnloadImageItem()
+ if not IsValidCVariableName(ValueList[0]):
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[0]),
+ LineInfo=self.CurrentLine)
+ InfDefineUnloadImageItemObj.SetCName(ValueList[0])
+ if len(ValueList) == 2:
+ if ValueList[1].strip() == '':
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[1]),
+ LineInfo=self.CurrentLine)
+ #
+ # Validate FFE
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(ValueList[1].strip())
+ if not FeatureFlagRtv[0]:
+ ErrorInInf(ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
+ LineInfo=self.CurrentLine)
+ InfDefineUnloadImageItemObj.SetFeatureFlagExp(ValueList[1])
+
+ if len(ValueList) > 2:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(UnloadImages),
+ LineInfo=self.CurrentLine)
+ InfDefineUnloadImageItemObj.Comments = Comments
+ self.UnloadImages.append(InfDefineUnloadImageItemObj)
+
+ def GetUnloadImages(self):
+ return self.UnloadImages
+
+ #
+ # SetConstructor
+ #
+ def SetConstructor(self, Constructor, Comments):
+ #
+ # It can be a list
+ #
+ ValueList = []
+ TokenList = GetSplitValueList(Constructor, DT.TAB_VALUE_SPLIT)
+ ValueList[0:len(TokenList)] = TokenList
+ InfDefineConstructorItemObj = InfDefineConstructorItem()
+ if not IsValidCVariableName(ValueList[0]):
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[0]),
+ LineInfo=self.CurrentLine)
+ InfDefineConstructorItemObj.SetCName(ValueList[0])
+ if len(ValueList) >= 2:
+ ModList = GetSplitValueList(ValueList[1], ' ')
+ if ValueList[1].strip() == '':
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[1]),
+ LineInfo=self.CurrentLine)
+ for ModItem in ModList:
+ if ModItem not in DT.MODULE_LIST:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_MODULETYPE_INVALID%(ModItem),
+ LineInfo=self.CurrentLine)
+ InfDefineConstructorItemObj.SetSupModList(ModList)
+ if len(ValueList) == 3:
+ if ValueList[2].strip() == '':
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[2]),
+ LineInfo=self.CurrentLine)
+ #
+ # Validate FFE
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(ValueList[2].strip())
+ if not FeatureFlagRtv[0]:
+ ErrorInInf(ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[2]),
+ LineInfo=self.CurrentLine)
+ InfDefineConstructorItemObj.SetFeatureFlagExp(ValueList[2])
+
+ if len(ValueList) > 3:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Constructor),
+ LineInfo=self.CurrentLine)
+ InfDefineConstructorItemObj.Comments = Comments
+ self.Constructor.append(InfDefineConstructorItemObj)
+
+ def GetConstructor(self):
+ return self.Constructor
+
+ #
+ # SetDestructor
+ #
+ def SetDestructor(self, Destructor, Comments):
+ #
+ # It can be a list and only 1 set to TRUE
+ #
+ ValueList = []
+ TokenList = GetSplitValueList(Destructor, DT.TAB_VALUE_SPLIT)
+ ValueList[0:len(TokenList)] = TokenList
+ InfDefineDestructorItemObj = InfDefineDestructorItem()
+ if not IsValidCVariableName(ValueList[0]):
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[0]),
+ LineInfo=self.CurrentLine)
+ InfDefineDestructorItemObj.SetCName(ValueList[0])
+ if len(ValueList) >= 2:
+ ModList = GetSplitValueList(ValueList[1].strip(), ' ')
+ if ValueList[1].strip() == '':
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[1]),
+ LineInfo=self.CurrentLine)
+ for ModItem in ModList:
+ if ModItem not in DT.MODULE_LIST:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_MODULETYPE_INVALID%(ModItem),
+ LineInfo=self.CurrentLine)
+ InfDefineDestructorItemObj.SetSupModList(ModList)
+ if len(ValueList) == 3:
+ if ValueList[2].strip() == '':
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(ValueList[2]),
+ LineInfo=self.CurrentLine)
+ #
+ # Validate FFE
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(ValueList[2].strip())
+ if not FeatureFlagRtv[0]:
+ ErrorInInf(ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
+ LineInfo=self.CurrentLine)
+ InfDefineDestructorItemObj.SetFeatureFlagExp(ValueList[2])
+
+ if len(ValueList) > 3:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Destructor),
+ LineInfo=self.CurrentLine)
+
+ InfDefineDestructorItemObj.Comments = Comments
+ self.Destructor.append(InfDefineDestructorItemObj)
+
+ def GetDestructor(self):
+ return self.Destructor
+
+ def SetShadow(self, Shadow, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.Shadow is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_SHADOW),
+ LineInfo=self.CurrentLine)
+ return False
+ if (IsValidBoolType(Shadow)):
+ self.Shadow = InfDefMember()
+ self.Shadow.SetValue(Shadow)
+ self.Shadow.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Shadow),
+ LineInfo=self.CurrentLine)
+ return False
+ def GetShadow(self):
+ return self.Shadow
+
+ #
+ # <Family> ::= {"MSFT"} {"GCC"}
+ # <CustomMake> ::= [<Family> "|"] <Filename>
+ #
+ def SetCustomMakefile(self, CustomMakefile, Comments):
+ if not (CustomMakefile == '' or CustomMakefile is None):
+ ValueList = GetSplitValueList(CustomMakefile)
+ if len(ValueList) == 1:
+ FileName = ValueList[0]
+ Family = ''
+ else:
+ Family = ValueList[0]
+ FileName = ValueList[1]
+ Family = Family.strip()
+ if Family != '':
+ if not IsValidFamily(Family):
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Family),
+ LineInfo=self.CurrentLine)
+ return False
+ #
+ # The MakefileName specified file should exist
+ #
+ IsValidFileFlag = False
+ ModulePath = os.path.split(self.CurrentLine[0])[0]
+ if IsValidPath(FileName, ModulePath):
+ IsValidFileFlag = True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(FileName),
+ LineInfo=self.CurrentLine)
+ return False
+ if IsValidFileFlag:
+ FileName = ConvPathFromAbsToRel(FileName, GlobalData.gINF_MODULE_DIR)
+ self.CustomMakefile.append((Family, FileName, Comments))
+ IsValidFileFlag = False
+ return True
+ else:
+ return False
+
+ def GetCustomMakefile(self):
+ return self.CustomMakefile
+
+ #
+ # ["SPEC" <Spec> <EOL>]*{0,}
+ # <Spec> ::= <Word> "=" <VersionVal>
+ # <VersionVal> ::= {<HexVersion>] {<DecVersion>}
+ # <HexNumber> ::= "0x" [<HexDigit>]{1,}
+ # <DecVersion> ::= (0-9){1,} ["." (0-9){1,2}]
+ #
+ def SetSpecification(self, Specification, Comments):
+ #
+ # Valid the value of Specification
+ #
+ __ValueList = []
+ TokenList = GetSplitValueList(Specification, DT.TAB_EQUAL_SPLIT, 1)
+ __ValueList[0:len(TokenList)] = TokenList
+ if len(__ValueList) != 2:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_NO_NAME + ' Or ' + ST.ERR_INF_PARSER_DEFINE_ITEM_NO_VALUE,
+ LineInfo=self.CurrentLine)
+ Name = __ValueList[0].strip()
+ Version = __ValueList[1].strip()
+ if IsValidIdentifier(Name):
+ if IsValidDecVersion(Version):
+ self.Specification.append((Name, Version, Comments))
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Version),
+ LineInfo=self.CurrentLine)
+ return False
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Name),
+ LineInfo=self.CurrentLine)
+ return False
+ return True
+
+ def GetSpecification(self):
+ return self.Specification
+
+ #
+ # [<UefiHiiResource> <EOL>]{0,1}
+ # <UefiHiiResource> ::= "UEFI_HII_RESOURCE_SECTION" "=" <BoolType>
+ #
+ def SetUefiHiiResourceSection(self, UefiHiiResourceSection, Comments):
+ #
+ # Value has been set before.
+ #
+ if self.UefiHiiResourceSection is not None:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND
+ %(DT.TAB_INF_DEFINES_UEFI_HII_RESOURCE_SECTION),
+ LineInfo=self.CurrentLine)
+ return False
+ if not (UefiHiiResourceSection == '' or UefiHiiResourceSection is None):
+ if (IsValidBoolType(UefiHiiResourceSection)):
+ self.UefiHiiResourceSection = InfDefMember()
+ self.UefiHiiResourceSection.SetValue(UefiHiiResourceSection)
+ self.UefiHiiResourceSection.Comments = Comments
+ return True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(UefiHiiResourceSection),
+ LineInfo=self.CurrentLine)
+ return False
+ else:
+ return False
+
+ def GetUefiHiiResourceSection(self):
+ return self.UefiHiiResourceSection
+
+ def SetDpxSource(self, DpxSource, Comments):
+ #
+ # The MakefileName specified file should exist
+ #
+ IsValidFileFlag = False
+ ModulePath = os.path.split(self.CurrentLine[0])[0]
+ if IsValidPath(DpxSource, ModulePath):
+ IsValidFileFlag = True
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(DpxSource),
+ LineInfo=self.CurrentLine)
+ return False
+ if IsValidFileFlag:
+ DpxSource = ConvPathFromAbsToRel(DpxSource,
+ GlobalData.gINF_MODULE_DIR)
+ self.DpxSource.append((DpxSource, Comments))
+ IsValidFileFlag = False
+ return True
+
+ def GetDpxSource(self):
+ return self.DpxSource
+
+gFUNCTION_MAPPING_FOR_DEFINE_SECTION = {
+ #
+ # Required Fields
+ #
+ DT.TAB_INF_DEFINES_BASE_NAME : InfDefSection.SetBaseName,
+ DT.TAB_INF_DEFINES_FILE_GUID : InfDefSection.SetFileGuid,
+ DT.TAB_INF_DEFINES_MODULE_TYPE : InfDefSection.SetModuleType,
+ #
+ # Required by EDKII style INF file
+ #
+ DT.TAB_INF_DEFINES_INF_VERSION : InfDefSection.SetInfVersion,
+ #
+ # Optional Fields
+ #
+ DT.TAB_INF_DEFINES_MODULE_UNI_FILE : InfDefSection.SetModuleUniFileName,
+ DT.TAB_INF_DEFINES_EDK_RELEASE_VERSION : InfDefSection.SetEdkReleaseVersion,
+ DT.TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION : InfDefSection.SetUefiSpecificationVersion,
+ DT.TAB_INF_DEFINES_PI_SPECIFICATION_VERSION : InfDefSection.SetPiSpecificationVersion,
+ DT.TAB_INF_DEFINES_LIBRARY_CLASS : InfDefSection.SetLibraryClass,
+ DT.TAB_INF_DEFINES_VERSION_STRING : InfDefSection.SetVersionString,
+ DT.TAB_INF_DEFINES_PCD_IS_DRIVER : InfDefSection.SetPcdIsDriver,
+ DT.TAB_INF_DEFINES_ENTRY_POINT : InfDefSection.SetEntryPoint,
+ DT.TAB_INF_DEFINES_UNLOAD_IMAGE : InfDefSection.SetUnloadImages,
+ DT.TAB_INF_DEFINES_CONSTRUCTOR : InfDefSection.SetConstructor,
+ DT.TAB_INF_DEFINES_DESTRUCTOR : InfDefSection.SetDestructor,
+ DT.TAB_INF_DEFINES_SHADOW : InfDefSection.SetShadow,
+ DT.TAB_INF_DEFINES_PCI_VENDOR_ID : InfDefSection.SetPciVendorId,
+ DT.TAB_INF_DEFINES_PCI_DEVICE_ID : InfDefSection.SetPciDeviceId,
+ DT.TAB_INF_DEFINES_PCI_CLASS_CODE : InfDefSection.SetPciClassCode,
+ DT.TAB_INF_DEFINES_PCI_REVISION : InfDefSection.SetPciRevision,
+ DT.TAB_INF_DEFINES_PCI_COMPRESS : InfDefSection.SetPciCompress,
+ DT.TAB_INF_DEFINES_CUSTOM_MAKEFILE : InfDefSection.SetCustomMakefile,
+ DT.TAB_INF_DEFINES_SPEC : InfDefSection.SetSpecification,
+ DT.TAB_INF_DEFINES_UEFI_HII_RESOURCE_SECTION : InfDefSection.SetUefiHiiResourceSection,
+ DT.TAB_INF_DEFINES_DPX_SOURCE : InfDefSection.SetDpxSource
+}
+
+## InfDefMember
+#
+#
+class InfDefMember():
+ def __init__(self, Name='', Value=''):
+ self.Comments = InfLineCommentObject()
+ self.Name = Name
+ self.Value = Value
+ self.CurrentLine = CurrentLine()
+ def GetName(self):
+ return self.Name
+ def SetName(self, Name):
+ self.Name = Name
+ def GetValue(self):
+ return self.Value
+ def SetValue(self, Value):
+ self.Value = Value
+
+## InfDefObject
+#
+#
+class InfDefObject(InfSectionCommonDef):
+ def __init__(self):
+ self.Defines = Sdict()
+ InfSectionCommonDef.__init__(self)
+ def SetDefines(self, DefineContent, Arch = None):
+ #
+ # Validate Arch
+ #
+ HasFoundInfVersionFalg = False
+ LineInfo = ['', -1, '']
+ ArchListString = ' '.join(Arch)
+ #
+ # Parse Define items.
+ #
+ for InfDefMemberObj in DefineContent:
+ ProcessFunc = None
+ Name = InfDefMemberObj.GetName()
+ Value = InfDefMemberObj.GetValue()
+ if Name == DT.TAB_INF_DEFINES_MODULE_UNI_FILE:
+ ValidateUNIFilePath(Value)
+ Value = os.path.join(os.path.dirname(InfDefMemberObj.CurrentLine.FileName), Value)
+ if not os.path.isfile(Value) or not os.path.exists(Value):
+ LineInfo[0] = InfDefMemberObj.CurrentLine.GetFileName()
+ LineInfo[1] = InfDefMemberObj.CurrentLine.GetLineNo()
+ LineInfo[2] = InfDefMemberObj.CurrentLine.GetLineString()
+ ErrorInInf(ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(Name),
+ LineInfo=LineInfo)
+ InfLineCommentObj = InfLineCommentObject()
+ InfLineCommentObj.SetHeaderComments(InfDefMemberObj.Comments.GetHeaderComments())
+ InfLineCommentObj.SetTailComments(InfDefMemberObj.Comments.GetTailComments())
+ if Name == 'COMPONENT_TYPE':
+ ErrorInInf(ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF,
+ ErrorCode=ToolError.EDK1_INF_ERROR,
+ RaiseError=True)
+ if Name == DT.TAB_INF_DEFINES_INF_VERSION:
+ HasFoundInfVersionFalg = True
+ if not (Name == '' or Name is None):
+ #
+ # Process "SPEC" Keyword definition.
+ #
+ ReName = re.compile(r"SPEC ", re.DOTALL)
+ if ReName.match(Name):
+ SpecValue = Name[Name.find("SPEC") + len("SPEC"):].strip()
+ Name = "SPEC"
+ Value = SpecValue + " = " + Value
+ if ArchListString in self.Defines:
+ DefineList = self.Defines[ArchListString]
+ LineInfo[0] = InfDefMemberObj.CurrentLine.GetFileName()
+ LineInfo[1] = InfDefMemberObj.CurrentLine.GetLineNo()
+ LineInfo[2] = InfDefMemberObj.CurrentLine.GetLineString()
+ DefineList.CurrentLine = LineInfo
+ #
+ # Found the process function from mapping table.
+ #
+ if Name not in gFUNCTION_MAPPING_FOR_DEFINE_SECTION.keys():
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_SECTION_KEYWORD_INVALID%(Name),
+ LineInfo=LineInfo)
+ else:
+ ProcessFunc = gFUNCTION_MAPPING_FOR_DEFINE_SECTION[Name]
+ if (ProcessFunc is not None):
+ ProcessFunc(DefineList, Value, InfLineCommentObj)
+ self.Defines[ArchListString] = DefineList
+ else:
+ DefineList = InfDefSection()
+ LineInfo[0] = InfDefMemberObj.CurrentLine.GetFileName()
+ LineInfo[1] = InfDefMemberObj.CurrentLine.GetLineNo()
+ LineInfo[2] = InfDefMemberObj.CurrentLine.GetLineString()
+ DefineList.CurrentLine = LineInfo
+ #
+ # Found the process function from mapping table.
+ #
+ if Name not in gFUNCTION_MAPPING_FOR_DEFINE_SECTION.keys():
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_SECTION_KEYWORD_INVALID%(Name),
+ LineInfo=LineInfo)
+ #
+ # Found the process function from mapping table.
+ #
+ else:
+ ProcessFunc = gFUNCTION_MAPPING_FOR_DEFINE_SECTION[Name]
+ if (ProcessFunc is not None):
+ ProcessFunc(DefineList, Value, InfLineCommentObj)
+ self.Defines[ArchListString] = DefineList
+ #
+ # After set, check whether INF_VERSION defined.
+ #
+ if not HasFoundInfVersionFalg:
+ ErrorInInf(ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF,
+ ErrorCode=ToolError.EDK1_INF_ERROR,
+ RaiseError=True)
+ return True
+
+ def GetDefines(self):
+ return self.Defines
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfDepexObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfDepexObject.py
new file mode 100644
index 000000000..0de663291
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfDepexObject.py
@@ -0,0 +1,160 @@
+## @file
+# This file is used to define class objects of INF file [Depex] section.
+# It will consumed by InfParser.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfDepexObject
+'''
+
+from Library import DataType as DT
+from Library import GlobalData
+import Logger.Log as Logger
+from Logger import ToolError
+from Logger import StringTable as ST
+
+from Object.Parser.InfCommonObject import InfSectionCommonDef
+from Library.ParserValidate import IsValidArch
+
+class InfDepexContentItem():
+ def __init__(self):
+ self.SectionType = ''
+ self.SectionString = ''
+
+ def SetSectionType(self, SectionType):
+ self.SectionType = SectionType
+ def GetSectionType(self):
+ return self.SectionType
+
+ def SetSectionString(self, SectionString):
+ self.SectionString = SectionString
+ def GetSectionString(self):
+ return self.SectionString
+
+
+class InfDepexItem():
+ def __init__(self):
+ self.DepexContent = ''
+ self.ModuleType = ''
+ self.SupArch = ''
+ self.HelpString = ''
+ self.FeatureFlagExp = ''
+ self.InfDepexContentItemList = []
+
+ def SetFeatureFlagExp(self, FeatureFlagExp):
+ self.FeatureFlagExp = FeatureFlagExp
+ def GetFeatureFlagExp(self):
+ return self.FeatureFlagExp
+
+ def SetSupArch(self, Arch):
+ self.SupArch = Arch
+ def GetSupArch(self):
+ return self.SupArch
+
+ def SetHelpString(self, HelpString):
+ self.HelpString = HelpString
+ def GetHelpString(self):
+ return self.HelpString
+
+ def SetModuleType(self, Type):
+ self.ModuleType = Type
+ def GetModuleType(self):
+ return self.ModuleType
+
+ def SetDepexConent(self, Content):
+ self.DepexContent = Content
+ def GetDepexContent(self):
+ return self.DepexContent
+
+ def SetInfDepexContentItemList(self, InfDepexContentItemList):
+ self.InfDepexContentItemList = InfDepexContentItemList
+ def GetInfDepexContentItemList(self):
+ return self.InfDepexContentItemList
+
+## InfDepexObject
+#
+#
+#
+class InfDepexObject(InfSectionCommonDef):
+ def __init__(self):
+ self.Depex = []
+ self.AllContent = ''
+ self.SectionContent = ''
+ InfSectionCommonDef.__init__(self)
+
+ def SetDepex(self, DepexContent, KeyList=None, CommentList=None):
+ for KeyItem in KeyList:
+ Arch = KeyItem[0]
+ ModuleType = KeyItem[1]
+ InfDepexItemIns = InfDepexItem()
+
+ #
+ # Validate Arch
+ #
+ if IsValidArch(Arch.strip().upper()):
+ InfDepexItemIns.SetSupArch(Arch)
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_NAME_INVALID % (Arch),
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=KeyItem[2])
+
+ #
+ # Validate Module Type
+ #
+ if ModuleType and ModuleType != 'COMMON':
+ if ModuleType in DT.VALID_DEPEX_MODULE_TYPE_LIST:
+ InfDepexItemIns.SetModuleType(ModuleType)
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEPEX_SECTION_MODULE_TYPE_ERROR % (ModuleType),
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=KeyItem[2])
+
+ #
+ # Parser content in [Depex] section.
+ #
+ DepexString = ''
+ HelpString = ''
+ #
+ # Get Depex Expression
+ #
+ for Line in DepexContent:
+ LineContent = Line[0].strip()
+ if LineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
+ LineContent = LineContent[:LineContent.find(DT.TAB_COMMENT_SPLIT)]
+ if LineContent:
+ DepexString = DepexString + LineContent + DT.END_OF_LINE
+ continue
+
+ if DepexString.endswith(DT.END_OF_LINE):
+ DepexString = DepexString[:-1]
+
+ if not DepexString.strip():
+ continue
+
+ #
+ # Get Help Text
+ #
+ for HelpLine in CommentList:
+ HelpString = HelpString + HelpLine + DT.END_OF_LINE
+ if HelpString.endswith(DT.END_OF_LINE):
+ HelpString = HelpString[:-1]
+
+ InfDepexItemIns.SetDepexConent(DepexString)
+ InfDepexItemIns.SetHelpString(HelpString)
+
+ self.Depex.append(InfDepexItemIns)
+
+ return True
+
+ def GetDepex(self):
+ return self.Depex
+
+ def GetAllContent(self):
+ return self.AllContent
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py
new file mode 100644
index 000000000..3e0bc8044
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py
@@ -0,0 +1,347 @@
+## @file
+# This file is used to define class objects of INF file [Guids] section.
+# It will consumed by InfParser.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfGuidObject
+'''
+
+from Library.ParserValidate import IsValidCVariableName
+from Library.CommentParsing import ParseComment
+from Library.ExpressionValidate import IsValidFeatureFlagExp
+
+from Library.Misc import Sdict
+from Library import DataType as DT
+import Logger.Log as Logger
+from Logger import ToolError
+from Logger import StringTable as ST
+
+class InfGuidItemCommentContent():
+ def __init__(self):
+ #
+ # ## SOMETIMES_CONSUMES ## Variable:L"MemoryTypeInformation"
+ # TailString.
+ #
+ #
+ # SOMETIMES_CONSUMES
+ #
+ self.UsageItem = ''
+ #
+ # Variable
+ #
+ self.GuidTypeItem = ''
+ #
+ # MemoryTypeInformation
+ #
+ self.VariableNameItem = ''
+ #
+ # TailString
+ #
+ self.HelpStringItem = ''
+
+ def SetUsageItem(self, UsageItem):
+ self.UsageItem = UsageItem
+ def GetUsageItem(self):
+ return self.UsageItem
+
+ def SetGuidTypeItem(self, GuidTypeItem):
+ self.GuidTypeItem = GuidTypeItem
+ def GetGuidTypeItem(self):
+ return self.GuidTypeItem
+
+ def SetVariableNameItem(self, VariableNameItem):
+ self.VariableNameItem = VariableNameItem
+ def GetVariableNameItem(self):
+ return self.VariableNameItem
+
+ def SetHelpStringItem(self, HelpStringItem):
+ self.HelpStringItem = HelpStringItem
+ def GetHelpStringItem(self):
+ return self.HelpStringItem
+
+class InfGuidItem():
+ def __init__(self):
+ self.Name = ''
+ self.FeatureFlagExp = ''
+ #
+ # A list contain instance of InfGuidItemCommentContent
+ #
+ self.CommentList = []
+ self.SupArchList = []
+
+ def SetName(self, Name):
+ self.Name = Name
+ def GetName(self):
+ return self.Name
+
+ def SetFeatureFlagExp(self, FeatureFlagExp):
+ self.FeatureFlagExp = FeatureFlagExp
+ def GetFeatureFlagExp(self):
+ return self.FeatureFlagExp
+
+ def SetCommentList(self, CommentList):
+ self.CommentList = CommentList
+ def GetCommentList(self):
+ return self.CommentList
+
+ def SetSupArchList(self, SupArchList):
+ self.SupArchList = SupArchList
+ def GetSupArchList(self):
+ return self.SupArchList
+
+## ParseComment
+#
+# ParseComment
+#
+def ParseGuidComment(CommentsList, InfGuidItemObj):
+ #
+ # Get/Set Usage and HelpString
+ #
+ if CommentsList is not None and len(CommentsList) != 0 :
+ CommentInsList = []
+ PreUsage = None
+ PreGuidType = None
+ PreHelpText = ''
+ BlockFlag = -1
+ Count = 0
+ for CommentItem in CommentsList:
+ Count = Count + 1
+ CommentItemUsage, \
+ CommentItemGuidType, \
+ CommentItemVarString, \
+ CommentItemHelpText = \
+ ParseComment(CommentItem,
+ DT.ALL_USAGE_TOKENS,
+ DT.GUID_TYPE_TOKENS,
+ [],
+ True)
+
+ if CommentItemHelpText is None:
+ CommentItemHelpText = ''
+ if Count == len(CommentsList) and CommentItemUsage == CommentItemGuidType == DT.ITEM_UNDEFINED:
+ CommentItemHelpText = DT.END_OF_LINE
+
+ if Count == len(CommentsList):
+ if BlockFlag == 1 or BlockFlag == 2:
+ if CommentItemUsage == CommentItemGuidType == DT.ITEM_UNDEFINED:
+ BlockFlag = 4
+ else:
+ BlockFlag = 3
+ if BlockFlag == -1:
+ BlockFlag = 4
+ if BlockFlag == -1 or BlockFlag == 1 or BlockFlag == 2:
+ if CommentItemUsage == CommentItemGuidType == DT.ITEM_UNDEFINED:
+ if BlockFlag == -1:
+ BlockFlag = 1
+ elif BlockFlag == 1:
+ BlockFlag = 2
+ else:
+ if BlockFlag == 1 or BlockFlag == 2:
+ BlockFlag = 3
+ elif BlockFlag == -1:
+ BlockFlag = 4
+
+ #
+ # Combine two comment line if they are generic comment
+ #
+ if CommentItemUsage == CommentItemGuidType == PreUsage == PreGuidType == DT.ITEM_UNDEFINED:
+ CommentItemHelpText = PreHelpText + DT.END_OF_LINE + CommentItemHelpText
+ PreHelpText = CommentItemHelpText
+
+ if BlockFlag == 4:
+ CommentItemIns = InfGuidItemCommentContent()
+ CommentItemIns.SetUsageItem(CommentItemUsage)
+ CommentItemIns.SetGuidTypeItem(CommentItemGuidType)
+ CommentItemIns.SetVariableNameItem(CommentItemVarString)
+ if CommentItemHelpText == '' or CommentItemHelpText.endswith(DT.END_OF_LINE):
+ CommentItemHelpText = CommentItemHelpText.strip(DT.END_OF_LINE)
+ CommentItemIns.SetHelpStringItem(CommentItemHelpText)
+ CommentInsList.append(CommentItemIns)
+
+ BlockFlag = -1
+ PreUsage = None
+ PreGuidType = None
+ PreHelpText = ''
+
+ elif BlockFlag == 3:
+ #
+ # Add previous help string
+ #
+ CommentItemIns = InfGuidItemCommentContent()
+ CommentItemIns.SetUsageItem(DT.ITEM_UNDEFINED)
+ CommentItemIns.SetGuidTypeItem(DT.ITEM_UNDEFINED)
+ if PreHelpText == '' or PreHelpText.endswith(DT.END_OF_LINE):
+ PreHelpText = PreHelpText.strip(DT.END_OF_LINE)
+ CommentItemIns.SetHelpStringItem(PreHelpText)
+ CommentInsList.append(CommentItemIns)
+ #
+ # Add Current help string
+ #
+ CommentItemIns = InfGuidItemCommentContent()
+ CommentItemIns.SetUsageItem(CommentItemUsage)
+ CommentItemIns.SetGuidTypeItem(CommentItemGuidType)
+ CommentItemIns.SetVariableNameItem(CommentItemVarString)
+ if CommentItemHelpText == '' or CommentItemHelpText.endswith(DT.END_OF_LINE):
+ CommentItemHelpText = CommentItemHelpText.strip(DT.END_OF_LINE)
+ CommentItemIns.SetHelpStringItem(CommentItemHelpText)
+ CommentInsList.append(CommentItemIns)
+
+ BlockFlag = -1
+ PreUsage = None
+ PreGuidType = None
+ PreHelpText = ''
+
+ else:
+ PreUsage = CommentItemUsage
+ PreGuidType = CommentItemGuidType
+ PreHelpText = CommentItemHelpText
+
+ InfGuidItemObj.SetCommentList(CommentInsList)
+ else:
+ #
+ # Still need to set the USAGE/GUIDTYPE to undefined.
+ #
+ CommentItemIns = InfGuidItemCommentContent()
+ CommentItemIns.SetUsageItem(DT.ITEM_UNDEFINED)
+ CommentItemIns.SetGuidTypeItem(DT.ITEM_UNDEFINED)
+ InfGuidItemObj.SetCommentList([CommentItemIns])
+
+ return InfGuidItemObj
+
+## InfGuidObject
+#
+# InfGuidObject
+#
+class InfGuidObject():
+ def __init__(self):
+ self.Guids = Sdict()
+ #
+ # Macro defined in this section should be only used in this section.
+ #
+ self.Macros = {}
+
+ def SetGuid(self, GuidList, Arch = None):
+ __SupportArchList = []
+ for ArchItem in Arch:
+ #
+ # Validate Arch
+ #
+ if (ArchItem == '' or ArchItem is None):
+ ArchItem = 'COMMON'
+
+ __SupportArchList.append(ArchItem)
+
+ for Item in GuidList:
+ #
+ # Get Comment content of this protocol
+ #
+ CommentsList = None
+ if len(Item) == 3:
+ CommentsList = Item[1]
+ CurrentLineOfItem = Item[2]
+ Item = Item[0]
+ InfGuidItemObj = InfGuidItem()
+ if len(Item) >= 1 and len(Item) <= 2:
+ #
+ # Only GuildName contained
+ #
+ if not IsValidCVariableName(Item[0]):
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_INVALID_CNAME%(Item[0]),
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ if (Item[0] != ''):
+ InfGuidItemObj.SetName(Item[0])
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_CNAME_MISSING,
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ if len(Item) == 2:
+ #
+ # Contained CName and Feature Flag Express
+ # <statements> ::= <CName> ["|" <FeatureFlagExpress>]
+ # For GUID entry.
+ #
+ if Item[1].strip() == '':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ #
+ # Validate Feature Flag Express
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(Item[1].strip())
+ if not FeatureFlagRtv[0]:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ InfGuidItemObj.SetFeatureFlagExp(Item[1])
+ if len(Item) != 1 and len(Item) != 2:
+ #
+ # Invalid format of GUID statement
+ #
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_GUID_PPI_PROTOCOL_SECTION_CONTENT_ERROR,
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+
+ InfGuidItemObj = ParseGuidComment(CommentsList, InfGuidItemObj)
+ InfGuidItemObj.SetSupArchList(__SupportArchList)
+
+ #
+ # Determine GUID name duplicate. Follow below rule:
+ #
+ # A GUID must not be duplicated within a [Guids] section.
+ # A GUID may appear in multiple architectural [Guids]
+ # sections. A GUID listed in an architectural [Guids]
+ # section must not be listed in the common architectural
+ # [Guids] section.
+ #
+ # NOTE: This check will not report error now.
+ #
+ for Item in self.Guids:
+ if Item.GetName() == InfGuidItemObj.GetName():
+ ItemSupArchList = Item.GetSupArchList()
+ for ItemArch in ItemSupArchList:
+ for GuidItemObjArch in __SupportArchList:
+ if ItemArch == GuidItemObjArch:
+ #
+ # ST.ERR_INF_PARSER_ITEM_DUPLICATE
+ #
+ pass
+
+ if ItemArch.upper() == 'COMMON' or GuidItemObjArch.upper() == 'COMMON':
+ #
+ # ST.ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
+ #
+ pass
+
+ if (InfGuidItemObj) in self.Guids:
+ GuidList = self.Guids[InfGuidItemObj]
+ GuidList.append(InfGuidItemObj)
+ self.Guids[InfGuidItemObj] = GuidList
+ else:
+ GuidList = []
+ GuidList.append(InfGuidItemObj)
+ self.Guids[InfGuidItemObj] = GuidList
+
+ return True
+
+ def GetGuid(self):
+ return self.Guids
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfHeaderObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfHeaderObject.py
new file mode 100644
index 000000000..087edca93
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfHeaderObject.py
@@ -0,0 +1,113 @@
+## @file
+# This file is used to define class objects of INF file header.
+# It will consumed by InfParser.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfHeaderObject
+'''
+
+## INF file header object
+#
+# A sample file header
+#
+# ## @file xxx.inf FileName
+# # Abstract
+# #
+# # Description
+# #
+# # Copyright
+# #
+# # License
+# #
+#
+class InfHeaderObject():
+ def __init__(self):
+ self.FileName = ''
+ self.Abstract = ''
+ self.Description = ''
+ self.Copyright = ''
+ self.License = ''
+
+ ## SetFileName
+ #
+ # @param FileName: File Name
+ #
+ def SetFileName(self, FileName):
+ if not (FileName == '' or FileName is None):
+ self.FileName = FileName
+ return True
+ else:
+ return False
+
+ ## GetFileName
+ #
+ def GetFileName(self):
+ return self.FileName
+
+ ## SetAbstract
+ #
+ # @param Abstract: Abstract
+ #
+ def SetAbstract(self, Abstract):
+ if not (Abstract == '' or Abstract is None):
+ self.Abstract = Abstract
+ return True
+ else:
+ return False
+
+ ## GetAbstract
+ #
+ def GetAbstract(self):
+ return self.Abstract
+
+ ## SetDescription
+ #
+ # @param Description: Description content
+ #
+ def SetDescription(self, Description):
+ if not (Description == '' or Description is None):
+ self.Description = Description
+ return True
+ else:
+ return False
+
+ ## GetAbstract
+ #
+ def GetDescription(self):
+ return self.Description
+
+ ## SetCopyright
+ #
+ # @param Copyright: Copyright content
+ #
+ def SetCopyright(self, Copyright):
+ if not (Copyright == '' or Copyright is None):
+ self.Copyright = Copyright
+ return True
+ else:
+ return False
+
+ ## GetCopyright
+ #
+ def GetCopyright(self):
+ return self.Copyright
+
+ ## SetCopyright
+ #
+ # @param License: License content
+ #
+ def SetLicense(self, License):
+ if not (License == '' or License is None):
+ self.License = License
+ return True
+ else:
+ return False
+
+ ## GetLicense
+ #
+ def GetLicense(self):
+ return self.License
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py
new file mode 100644
index 000000000..2e5602831
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py
@@ -0,0 +1,247 @@
+## @file
+# This file is used to define class objects of INF file [LibraryClasses] section.
+# It will consumed by InfParser.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfLibraryClassesObject
+'''
+
+from Logger import StringTable as ST
+from Logger import ToolError
+import Logger.Log as Logger
+from Library import GlobalData
+
+from Library.Misc import Sdict
+from Object.Parser.InfCommonObject import CurrentLine
+from Library.ExpressionValidate import IsValidFeatureFlagExp
+from Library.ParserValidate import IsValidLibName
+
+## GetArchModuleType
+#
+# Get Arch List and ModuleType List
+#
+def GetArchModuleType(KeyList):
+ __SupArchList = []
+ __SupModuleList = []
+
+ for (ArchItem, ModuleItem) in KeyList:
+ #
+ # Validate Arch
+ #
+ if (ArchItem == '' or ArchItem is None):
+ ArchItem = 'COMMON'
+
+ if (ModuleItem == '' or ModuleItem is None):
+ ModuleItem = 'COMMON'
+
+ if ArchItem not in __SupArchList:
+ __SupArchList.append(ArchItem)
+
+ List = ModuleItem.split('|')
+ for Entry in List:
+ if Entry not in __SupModuleList:
+ __SupModuleList.append(Entry)
+
+ return (__SupArchList, __SupModuleList)
+
+
+class InfLibraryClassItem():
+ def __init__(self, LibName='', FeatureFlagExp='', HelpString=None):
+ self.LibName = LibName
+ self.FeatureFlagExp = FeatureFlagExp
+ self.HelpString = HelpString
+ self.CurrentLine = CurrentLine()
+ self.SupArchList = []
+ self.SupModuleList = []
+ self.FileGuid = ''
+ self.Version = ''
+
+ def SetLibName(self, LibName):
+ self.LibName = LibName
+ def GetLibName(self):
+ return self.LibName
+
+ def SetHelpString(self, HelpString):
+ self.HelpString = HelpString
+ def GetHelpString(self):
+ return self.HelpString
+
+ def SetFeatureFlagExp(self, FeatureFlagExp):
+ self.FeatureFlagExp = FeatureFlagExp
+ def GetFeatureFlagExp(self):
+ return self.FeatureFlagExp
+
+ def SetSupArchList(self, SupArchList):
+ self.SupArchList = SupArchList
+ def GetSupArchList(self):
+ return self.SupArchList
+
+ def SetSupModuleList(self, SupModuleList):
+ self.SupModuleList = SupModuleList
+ def GetSupModuleList(self):
+ return self.SupModuleList
+
+ #
+ # As Build related information
+ #
+ def SetFileGuid(self, FileGuid):
+ self.FileGuid = FileGuid
+ def GetFileGuid(self):
+ return self.FileGuid
+
+ def SetVersion(self, Version):
+ self.Version = Version
+ def GetVersion(self):
+ return self.Version
+
+## INF LibraryClass Section
+#
+#
+#
+class InfLibraryClassObject():
+ def __init__(self):
+ self.LibraryClasses = Sdict()
+ #
+ # Macro defined in this section should be only used in this section.
+ #
+ self.Macros = {}
+
+ ##SetLibraryClasses
+ #
+ #
+ # @param HelpString: It can be a common comment or contain a recommend
+ # instance.
+ #
+ def SetLibraryClasses(self, LibContent, KeyList=None):
+ #
+ # Validate Arch
+ #
+ (__SupArchList, __SupModuleList) = GetArchModuleType(KeyList)
+
+ for LibItem in LibContent:
+ LibItemObj = InfLibraryClassItem()
+ if not GlobalData.gIS_BINARY_INF:
+ HelpStringObj = LibItem[1]
+ LibItemObj.CurrentLine.SetFileName(LibItem[2][2])
+ LibItemObj.CurrentLine.SetLineNo(LibItem[2][1])
+ LibItemObj.CurrentLine.SetLineString(LibItem[2][0])
+ LibItem = LibItem[0]
+ if HelpStringObj is not None:
+ LibItemObj.SetHelpString(HelpStringObj)
+ if len(LibItem) >= 1:
+ if LibItem[0].strip() != '':
+ if IsValidLibName(LibItem[0].strip()):
+ if LibItem[0].strip() != 'NULL':
+ LibItemObj.SetLibName(LibItem[0])
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_LIB_NAME_INVALID,
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=LibItemObj.CurrentLine.GetLineNo(),
+ ExtraData=LibItemObj.CurrentLine.GetLineString())
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID % (LibItem[0]),
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=LibItemObj.CurrentLine.GetLineNo(),
+ ExtraData=LibItemObj.CurrentLine.GetLineString())
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_LIBRARY_SECTION_LIBNAME_MISSING,
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=LibItemObj.CurrentLine.GetLineNo(),
+ ExtraData=LibItemObj.CurrentLine.GetLineString())
+ if len(LibItem) == 2:
+ if LibItem[1].strip() == '':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=LibItemObj.CurrentLine.GetLineNo(),
+ ExtraData=LibItemObj.CurrentLine.GetLineString())
+ #
+ # Validate FFE
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(LibItem[1].strip())
+ if not FeatureFlagRtv[0]:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID % (FeatureFlagRtv[1]),
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=LibItemObj.CurrentLine.GetLineNo(),
+ ExtraData=LibItemObj.CurrentLine.GetLineString())
+ LibItemObj.SetFeatureFlagExp(LibItem[1].strip())
+
+ #
+ # Invalid strings
+ #
+ if len(LibItem) < 1 or len(LibItem) > 2:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_LIBRARY_SECTION_CONTENT_ERROR,
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=LibItemObj.CurrentLine.GetLineNo(),
+ ExtraData=LibItemObj.CurrentLine.GetLineString())
+
+ LibItemObj.SetSupArchList(__SupArchList)
+ LibItemObj.SetSupModuleList(__SupModuleList)
+
+ #
+ # Determine Library class duplicate. Follow below rule:
+ #
+ # A library class keyword must not be duplicated within a
+ # [LibraryClasses] section. Library class keywords may appear in
+ # multiple architectural and module type [LibraryClasses] sections.
+ # A library class keyword listed in an architectural or module type
+ # [LibraryClasses] section must not be listed in the common
+ # architectural or module type [LibraryClasses] section.
+ #
+ # NOTE: This check will not report error now. But keep code for future enhancement.
+ #
+# for Item in self.LibraryClasses:
+# if Item.GetLibName() == LibItemObj.GetLibName():
+# ItemSupArchList = Item.GetSupArchList()
+# ItemSupModuleList = Item.GetSupModuleList()
+# for ItemArch in ItemSupArchList:
+# for ItemModule in ItemSupModuleList:
+# for LibItemObjArch in __SupArchList:
+# for LibItemObjModule in __SupModuleList:
+# if ItemArch == LibItemObjArch and LibItemObjModule == ItemModule:
+# #
+# # ERR_INF_PARSER_ITEM_DUPLICATE
+# #
+# pass
+# if (ItemArch.upper() == 'COMMON' or LibItemObjArch.upper() == 'COMMON') \
+# and LibItemObjModule == ItemModule:
+# #
+# # ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
+# #
+# pass
+ else:
+ #
+ # Assume the file GUID is well formatted.
+ #
+ LibItemObj.SetFileGuid(LibItem[0])
+ LibItemObj.SetVersion(LibItem[1])
+ LibItemObj.SetSupArchList(__SupArchList)
+
+ if (LibItemObj) in self.LibraryClasses:
+ LibraryList = self.LibraryClasses[LibItemObj]
+ LibraryList.append(LibItemObj)
+ self.LibraryClasses[LibItemObj] = LibraryList
+ else:
+ LibraryList = []
+ LibraryList.append(LibItemObj)
+ self.LibraryClasses[LibItemObj] = LibraryList
+
+ return True
+
+ def GetLibraryClasses(self):
+ return self.LibraryClasses
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py
new file mode 100644
index 000000000..469d6fbb1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py
@@ -0,0 +1,142 @@
+## @file
+# This file is used to define class objects of INF file miscellaneous.
+# Include BootMode/HOB/Event and others. It will consumed by InfParser.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfMisc
+'''
+
+import Logger.Log as Logger
+from Logger import ToolError
+
+from Library import DataType as DT
+from Object.Parser.InfCommonObject import InfSectionCommonDef
+from Library.Misc import Sdict
+
+##
+# BootModeObject
+#
+class InfBootModeObject():
+ def __init__(self):
+ self.SupportedBootModes = ''
+ self.HelpString = ''
+ self.Usage = ''
+
+ def SetSupportedBootModes(self, SupportedBootModes):
+ self.SupportedBootModes = SupportedBootModes
+ def GetSupportedBootModes(self):
+ return self.SupportedBootModes
+
+ def SetHelpString(self, HelpString):
+ self.HelpString = HelpString
+ def GetHelpString(self):
+ return self.HelpString
+
+ def SetUsage(self, Usage):
+ self.Usage = Usage
+ def GetUsage(self):
+ return self.Usage
+##
+# EventObject
+#
+class InfEventObject():
+ def __init__(self):
+ self.EventType = ''
+ self.HelpString = ''
+ self.Usage = ''
+
+ def SetEventType(self, EventType):
+ self.EventType = EventType
+
+ def GetEventType(self):
+ return self.EventType
+
+ def SetHelpString(self, HelpString):
+ self.HelpString = HelpString
+ def GetHelpString(self):
+ return self.HelpString
+
+ def SetUsage(self, Usage):
+ self.Usage = Usage
+ def GetUsage(self):
+ return self.Usage
+##
+# HobObject
+#
+class InfHobObject():
+ def __init__(self):
+ self.HobType = ''
+ self.Usage = ''
+ self.SupArchList = []
+ self.HelpString = ''
+
+ def SetHobType(self, HobType):
+ self.HobType = HobType
+
+ def GetHobType(self):
+ return self.HobType
+
+ def SetUsage(self, Usage):
+ self.Usage = Usage
+ def GetUsage(self):
+ return self.Usage
+
+ def SetSupArchList(self, ArchList):
+ self.SupArchList = ArchList
+ def GetSupArchList(self):
+ return self.SupArchList
+
+ def SetHelpString(self, HelpString):
+ self.HelpString = HelpString
+ def GetHelpString(self):
+ return self.HelpString
+
+##
+# InfSpecialCommentObject
+#
+class InfSpecialCommentObject(InfSectionCommonDef):
+ def __init__(self):
+ self.SpecialComments = Sdict()
+ InfSectionCommonDef.__init__(self)
+
+ def SetSpecialComments(self, SepcialSectionList = None, Type = ''):
+ if Type == DT.TYPE_HOB_SECTION or \
+ Type == DT.TYPE_EVENT_SECTION or \
+ Type == DT.TYPE_BOOTMODE_SECTION:
+ for Item in SepcialSectionList:
+ if Type in self.SpecialComments:
+ ObjList = self.SpecialComments[Type]
+ ObjList.append(Item)
+ self.SpecialComments[Type] = ObjList
+ else:
+ ObjList = []
+ ObjList.append(Item)
+ self.SpecialComments[Type] = ObjList
+
+ return True
+
+ def GetSpecialComments(self):
+ return self.SpecialComments
+
+
+
+## ErrorInInf
+#
+# An encapsulate of Error for INF parser.
+#
+def ErrorInInf(Message=None, ErrorCode=None, LineInfo=None, RaiseError=True):
+ if ErrorCode is None:
+ ErrorCode = ToolError.FORMAT_INVALID
+ if LineInfo is None:
+ LineInfo = ['', -1, '']
+ Logger.Error("InfParser",
+ ErrorCode,
+ Message=Message,
+ File=LineInfo[0],
+ Line=LineInfo[1],
+ ExtraData=LineInfo[2],
+ RaiseError=RaiseError)
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py
new file mode 100644
index 000000000..0e8fc7d98
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py
@@ -0,0 +1,181 @@
+## @file
+# This file is used to define class objects of INF file [Packages] section.
+# It will consumed by InfParser.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfPackageObject
+'''
+
+from Logger import StringTable as ST
+from Logger import ToolError
+import Logger.Log as Logger
+from Library import GlobalData
+
+from Library.Misc import Sdict
+from Library.ParserValidate import IsValidPath
+from Library.ExpressionValidate import IsValidFeatureFlagExp
+
+class InfPackageItem():
+ def __init__(self,
+ PackageName = '',
+ FeatureFlagExp = '',
+ HelpString = ''):
+ self.PackageName = PackageName
+ self.FeatureFlagExp = FeatureFlagExp
+ self.HelpString = HelpString
+ self.SupArchList = []
+
+ def SetPackageName(self, PackageName):
+ self.PackageName = PackageName
+ def GetPackageName(self):
+ return self.PackageName
+
+ def SetFeatureFlagExp(self, FeatureFlagExp):
+ self.FeatureFlagExp = FeatureFlagExp
+ def GetFeatureFlagExp(self):
+ return self.FeatureFlagExp
+
+ def SetHelpString(self, HelpString):
+ self.HelpString = HelpString
+ def GetHelpString(self):
+ return self.HelpString
+
+ def SetSupArchList(self, SupArchList):
+ self.SupArchList = SupArchList
+ def GetSupArchList(self):
+ return self.SupArchList
+
+
+## INF package section
+#
+#
+#
+class InfPackageObject():
+ def __init__(self):
+ self.Packages = Sdict()
+ #
+ # Macro defined in this section should be only used in this section.
+ #
+ self.Macros = {}
+
+ def SetPackages(self, PackageData, Arch = None):
+ IsValidFileFlag = False
+ SupArchList = []
+ for ArchItem in Arch:
+ #
+ # Validate Arch
+ #
+ if (ArchItem == '' or ArchItem is None):
+ ArchItem = 'COMMON'
+ SupArchList.append(ArchItem)
+
+ for PackageItem in PackageData:
+ PackageItemObj = InfPackageItem()
+ HelpStringObj = PackageItem[1]
+ CurrentLineOfPackItem = PackageItem[2]
+ PackageItem = PackageItem[0]
+ if HelpStringObj is not None:
+ HelpString = HelpStringObj.HeaderComments + HelpStringObj.TailComments
+ PackageItemObj.SetHelpString(HelpString)
+ if len(PackageItem) >= 1:
+ #
+ # Validate file exist/format.
+ #
+ if IsValidPath(PackageItem[0], ''):
+ IsValidFileFlag = True
+ elif IsValidPath(PackageItem[0], GlobalData.gINF_MODULE_DIR):
+ IsValidFileFlag = True
+ elif IsValidPath(PackageItem[0], GlobalData.gWORKSPACE):
+ IsValidFileFlag = True
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(PackageItem[0]),
+ File=CurrentLineOfPackItem[2],
+ Line=CurrentLineOfPackItem[1],
+ ExtraData=CurrentLineOfPackItem[0])
+ return False
+ if IsValidFileFlag:
+ PackageItemObj.SetPackageName(PackageItem[0])
+ if len(PackageItem) == 2:
+ #
+ # Validate Feature Flag Express
+ #
+ if PackageItem[1].strip() == '':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
+ File=CurrentLineOfPackItem[2],
+ Line=CurrentLineOfPackItem[1],
+ ExtraData=CurrentLineOfPackItem[0])
+ #
+ # Validate FFE
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(PackageItem[1].strip())
+ if not FeatureFlagRtv[0]:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
+ File=CurrentLineOfPackItem[2],
+ Line=CurrentLineOfPackItem[1],
+ ExtraData=CurrentLineOfPackItem[0])
+
+ PackageItemObj.SetFeatureFlagExp(PackageItem[1].strip())
+
+ if len(PackageItem) > 2:
+ #
+ # Invalid format of Package statement
+ #
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_PACKAGE_SECTION_CONTENT_ERROR,
+ File=CurrentLineOfPackItem[2],
+ Line=CurrentLineOfPackItem[1],
+ ExtraData=CurrentLineOfPackItem[0])
+ PackageItemObj.SetSupArchList(SupArchList)
+
+ #
+ # Determine package file name duplicate. Follow below rule:
+ #
+ # A package filename must not be duplicated within a [Packages]
+ # section. Package filenames may appear in multiple architectural
+ # [Packages] sections. A package filename listed in an
+ # architectural [Packages] section must not be listed in the common
+ # architectural [Packages] section.
+ #
+ # NOTE: This check will not report error now.
+ #
+ for Item in self.Packages:
+ if Item.GetPackageName() == PackageItemObj.GetPackageName():
+ ItemSupArchList = Item.GetSupArchList()
+ for ItemArch in ItemSupArchList:
+ for PackageItemObjArch in SupArchList:
+ if ItemArch == PackageItemObjArch:
+ #
+ # ST.ERR_INF_PARSER_ITEM_DUPLICATE
+ #
+ pass
+ if ItemArch.upper() == 'COMMON' or PackageItemObjArch.upper() == 'COMMON':
+ #
+ # ST.ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
+ #
+ pass
+
+ if (PackageItemObj) in self.Packages:
+ PackageList = self.Packages[PackageItemObj]
+ PackageList.append(PackageItemObj)
+ self.Packages[PackageItemObj] = PackageList
+ else:
+ PackageList = []
+ PackageList.append(PackageItemObj)
+ self.Packages[PackageItemObj] = PackageList
+
+ return True
+
+ def GetPackages(self, Arch = None):
+ if Arch is None:
+ return self.Packages
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py
new file mode 100644
index 000000000..fd8065fab
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py
@@ -0,0 +1,669 @@
+## @file
+# This file is used to define class objects of INF file [Pcds] section.
+# It will consumed by InfParser.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfPcdObject
+'''
+import os
+import re
+
+from Logger import StringTable as ST
+from Logger import ToolError
+import Logger.Log as Logger
+from Library import GlobalData
+from Library import DataType as DT
+
+from Library.Misc import Sdict
+from Library.Misc import GetHelpStringByRemoveHashKey
+from Library.ParserValidate import IsValidPcdType
+from Library.ParserValidate import IsValidCVariableName
+from Library.ParserValidate import IsValidPcdValue
+from Library.ParserValidate import IsValidArch
+from Library.CommentParsing import ParseComment
+from Library.StringUtils import GetSplitValueList
+from Library.StringUtils import IsHexDigitUINT32
+from Library.ExpressionValidate import IsValidFeatureFlagExp
+from Parser.InfAsBuiltProcess import GetPackageListInfo
+from Parser.DecParser import Dec
+
+from Object.Parser.InfPackagesObject import InfPackageItem
+
+def ValidateArch(ArchItem, PcdTypeItem1, LineNo, SupArchDict, SupArchList):
+ #
+ # Validate Arch
+ #
+ if (ArchItem == '' or ArchItem is None):
+ ArchItem = 'COMMON'
+
+ if PcdTypeItem1.upper != DT.TAB_INF_FEATURE_PCD.upper():
+ ArchList = GetSplitValueList(ArchItem, ' ')
+ for ArchItemNew in ArchList:
+ if not IsValidArch(ArchItemNew):
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID % (ArchItemNew),
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=LineNo,
+ ExtraData=ArchItemNew)
+ SupArchDict[PcdTypeItem1] = ArchList
+ else:
+ SupArchList.append(ArchItem)
+
+ return SupArchList, SupArchDict
+
+def ParsePcdComment(CommentList, PcdTypeItem, PcdItemObj):
+ CommentInsList = []
+ PreUsage = None
+ PreHelpText = ''
+ BlockFlag = -1
+ FFEHelpText = ''
+ CommentItemHelpText = ''
+ Count = 0
+ for CommentItem in CommentList:
+ Count = Count + 1
+ CommentItemUsage, CommentType, CommentString, CommentItemHelpText = ParseComment(CommentItem,
+ DT.ALL_USAGE_TOKENS,
+ {},
+ [],
+ False)
+ if CommentType and CommentString:
+ pass
+
+ if PcdTypeItem == 'FeaturePcd':
+ CommentItemUsage = DT.USAGE_ITEM_CONSUMES
+ if CommentItemHelpText is None:
+ CommentItemHelpText = ''
+
+ if Count == 1:
+ FFEHelpText = CommentItemHelpText
+ else:
+ FFEHelpText = FFEHelpText + DT.END_OF_LINE + CommentItemHelpText
+
+ if Count == len(CommentList):
+ CommentItemHelpText = FFEHelpText
+ BlockFlag = 4
+ else:
+ continue
+
+ if CommentItemHelpText is None:
+ CommentItemHelpText = ''
+ if Count == len(CommentList) and CommentItemUsage == DT.ITEM_UNDEFINED:
+ CommentItemHelpText = DT.END_OF_LINE
+
+ if Count == len(CommentList) and (BlockFlag == 1 or BlockFlag == 2):
+ if CommentItemUsage == DT.ITEM_UNDEFINED:
+ BlockFlag = 4
+ else:
+ BlockFlag = 3
+ elif BlockFlag == -1 and Count == len(CommentList):
+ BlockFlag = 4
+
+ if BlockFlag == -1 or BlockFlag == 1 or BlockFlag == 2:
+ if CommentItemUsage == DT.ITEM_UNDEFINED:
+ if BlockFlag == -1:
+ BlockFlag = 1
+ elif BlockFlag == 1:
+ BlockFlag = 2
+ else:
+ if BlockFlag == 1 or BlockFlag == 2:
+ BlockFlag = 3
+ elif BlockFlag == -1:
+ BlockFlag = 4
+ #
+ # Combine two comment line if they are generic comment
+ #
+ if CommentItemUsage == PreUsage == DT.ITEM_UNDEFINED:
+ CommentItemHelpText = PreHelpText + DT.END_OF_LINE + CommentItemHelpText
+
+ PreHelpText = CommentItemHelpText
+
+ if BlockFlag == 4:
+ CommentItemIns = InfPcdItemCommentContent()
+ CommentItemIns.SetUsageItem(CommentItemUsage)
+ CommentItemIns.SetHelpStringItem(CommentItemHelpText)
+ CommentInsList.append(CommentItemIns)
+
+ BlockFlag = -1
+ PreUsage = None
+ PreHelpText = ''
+
+ elif BlockFlag == 3:
+ #
+ # Add previous help string
+ #
+ CommentItemIns = InfPcdItemCommentContent()
+ CommentItemIns.SetUsageItem(DT.ITEM_UNDEFINED)
+ if PreHelpText == '' or PreHelpText.endswith(DT.END_OF_LINE):
+ PreHelpText += DT.END_OF_LINE
+ CommentItemIns.SetHelpStringItem(PreHelpText)
+ CommentInsList.append(CommentItemIns)
+ #
+ # Add Current help string
+ #
+ CommentItemIns = InfPcdItemCommentContent()
+ CommentItemIns.SetUsageItem(CommentItemUsage)
+ CommentItemIns.SetHelpStringItem(CommentItemHelpText)
+ CommentInsList.append(CommentItemIns)
+
+ BlockFlag = -1
+ PreUsage = None
+ PreHelpText = ''
+
+ else:
+ PreUsage = CommentItemUsage
+ PreHelpText = CommentItemHelpText
+
+ PcdItemObj.SetHelpStringList(CommentInsList)
+
+ return PcdItemObj
+
+class InfPcdItemCommentContent():
+ def __init__(self):
+ #
+ # ## SOMETIMES_CONSUMES ## HelpString
+ #
+ self.UsageItem = ''
+ #
+ # Help String
+ #
+ self.HelpStringItem = ''
+
+ def SetUsageItem(self, UsageItem):
+ self.UsageItem = UsageItem
+ def GetUsageItem(self):
+ return self.UsageItem
+
+ def SetHelpStringItem(self, HelpStringItem):
+ self.HelpStringItem = HelpStringItem
+ def GetHelpStringItem(self):
+ return self.HelpStringItem
+
+## InfPcdItem
+#
+# This class defined Pcd item used in Module files
+#
+# @param CName: Input value for CName, default is ''
+# @param Token: Input value for Token, default is ''
+# @param TokenSpaceGuidCName: Input value for TokenSpaceGuidCName, default
+# is ''
+# @param DatumType: Input value for DatumType, default is ''
+# @param MaxDatumSize: Input value for MaxDatumSize, default is ''
+# @param DefaultValue: Input value for DefaultValue, default is ''
+# @param ItemType: Input value for ItemType, default is ''
+# @param ValidUsage: Input value for ValidUsage, default is []
+# @param SkuInfoList: Input value for SkuInfoList, default is {}
+# @param SupModuleList: Input value for SupModuleList, default is []
+#
+class InfPcdItem():
+ def __init__(self):
+ self.CName = ''
+ self.Token = ''
+ self.TokenSpaceGuidCName = ''
+ self.TokenSpaceGuidValue = ''
+ self.DatumType = ''
+ self.MaxDatumSize = ''
+ self.DefaultValue = ''
+ self.Offset = ''
+ self.ValidUsage = ''
+ self.ItemType = ''
+ self.SupModuleList = []
+ self.HelpStringList = []
+ self.FeatureFlagExp = ''
+ self.SupArchList = []
+ self.PcdErrorsList = []
+
+ def SetCName(self, CName):
+ self.CName = CName
+ def GetCName(self):
+ return self.CName
+
+ def SetToken(self, Token):
+ self.Token = Token
+ def GetToken(self):
+ return self.Token
+
+ def SetTokenSpaceGuidCName(self, TokenSpaceGuidCName):
+ self.TokenSpaceGuidCName = TokenSpaceGuidCName
+ def GetTokenSpaceGuidCName(self):
+ return self.TokenSpaceGuidCName
+
+ def SetTokenSpaceGuidValue(self, TokenSpaceGuidValue):
+ self.TokenSpaceGuidValue = TokenSpaceGuidValue
+ def GetTokenSpaceGuidValue(self):
+ return self.TokenSpaceGuidValue
+
+ def SetDatumType(self, DatumType):
+ self.DatumType = DatumType
+ def GetDatumType(self):
+ return self.DatumType
+
+ def SetMaxDatumSize(self, MaxDatumSize):
+ self.MaxDatumSize = MaxDatumSize
+ def GetMaxDatumSize(self):
+ return self.MaxDatumSize
+
+ def SetDefaultValue(self, DefaultValue):
+ self.DefaultValue = DefaultValue
+ def GetDefaultValue(self):
+ return self.DefaultValue
+
+ def SetPcdErrorsList(self, PcdErrorsList):
+ self.PcdErrorsList = PcdErrorsList
+ def GetPcdErrorsList(self):
+ return self.PcdErrorsList
+
+ def SetItemType(self, ItemType):
+ self.ItemType = ItemType
+ def GetItemType(self):
+ return self.ItemType
+
+ def SetSupModuleList(self, SupModuleList):
+ self.SupModuleList = SupModuleList
+ def GetSupModuleList(self):
+ return self.SupModuleList
+
+ def SetHelpStringList(self, HelpStringList):
+ self.HelpStringList = HelpStringList
+ def GetHelpStringList(self):
+ return self.HelpStringList
+
+ def SetFeatureFlagExp(self, FeatureFlagExp):
+ self.FeatureFlagExp = FeatureFlagExp
+ def GetFeatureFlagExp(self):
+ return self.FeatureFlagExp
+
+ def SetSupportArchList(self, ArchList):
+ self.SupArchList = ArchList
+ def GetSupportArchList(self):
+ return self.SupArchList
+
+ def SetOffset(self, Offset):
+ self.Offset = Offset
+ def GetOffset(self):
+ return self.Offset
+
+ def SetValidUsage(self, ValidUsage):
+ self.ValidUsage = ValidUsage
+
+ def GetValidUsage(self):
+ return self.ValidUsage
+
+##
+#
+#
+#
+class InfPcdObject():
+ def __init__(self, FileName):
+ self.Pcds = Sdict()
+ self.FileName = FileName
+
+ def SetPcds(self, PcdContent, KeysList=None, PackageInfo=None):
+
+ if GlobalData.gIS_BINARY_INF:
+ self.SetAsBuildPcds(PcdContent, KeysList, PackageInfo)
+ return True
+
+ #
+ # Validate Arch
+ #
+ SupArchList = []
+ SupArchDict = {}
+ PcdTypeItem = ''
+ for (PcdTypeItem1, ArchItem, LineNo) in KeysList:
+ SupArchList, SupArchDict = ValidateArch(ArchItem, PcdTypeItem1, LineNo, SupArchDict, SupArchList)
+
+ #
+ # Validate PcdType
+ #
+ if (PcdTypeItem1 == '' or PcdTypeItem1 is None):
+ return False
+ else:
+ if not IsValidPcdType(PcdTypeItem1):
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_PCD_SECTION_TYPE_ERROR % (DT.PCD_USAGE_TYPE_LIST_OF_MODULE),
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=LineNo,
+ ExtraData=PcdTypeItem1)
+ return False
+
+ PcdTypeItem = PcdTypeItem1
+
+ for PcdItem in PcdContent:
+ PcdItemObj = InfPcdItem()
+ CommentList = PcdItem[1]
+ CurrentLineOfPcdItem = PcdItem[2]
+ PcdItem = PcdItem[0]
+
+ if CommentList is not None and len(CommentList) != 0:
+ PcdItemObj = ParsePcdComment(CommentList, PcdTypeItem, PcdItemObj)
+ else:
+ CommentItemIns = InfPcdItemCommentContent()
+ CommentItemIns.SetUsageItem(DT.ITEM_UNDEFINED)
+ PcdItemObj.SetHelpStringList([CommentItemIns])
+
+ if len(PcdItem) >= 1 and len(PcdItem) <= 3:
+ PcdItemObj = SetPcdName(PcdItem, CurrentLineOfPcdItem, PcdItemObj)
+
+ if len(PcdItem) >= 2 and len(PcdItem) <= 3:
+ #
+ # Contain PcdName and Value, validate value.
+ #
+ if IsValidPcdValue(PcdItem[1]) or PcdItem[1].strip() == "":
+ PcdItemObj.SetDefaultValue(PcdItem[1])
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_PCD_VALUE_INVALID,
+ File=CurrentLineOfPcdItem[2],
+ Line=CurrentLineOfPcdItem[1],
+ ExtraData=PcdItem[1])
+
+ if len(PcdItem) == 3:
+ #
+ # Contain PcdName, value, and FeatureFlag express
+ #
+ #
+ # Validate Feature Flag Express
+ #
+ if PcdItem[2].strip() == '':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
+ File=CurrentLineOfPcdItem[2],
+ Line=CurrentLineOfPcdItem[1],
+ ExtraData=CurrentLineOfPcdItem[0])
+ #
+ # Validate FFE
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(PcdItem[2].strip())
+ if not FeatureFlagRtv[0]:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID % (FeatureFlagRtv[1]),
+ File=CurrentLineOfPcdItem[2],
+ Line=CurrentLineOfPcdItem[1],
+ ExtraData=CurrentLineOfPcdItem[0])
+ PcdItemObj.SetFeatureFlagExp(PcdItem[2])
+
+ if len(PcdItem) < 1 or len(PcdItem) > 3:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_PCD_SECTION_CONTENT_ERROR,
+ File=CurrentLineOfPcdItem[2],
+ Line=CurrentLineOfPcdItem[1],
+ ExtraData=CurrentLineOfPcdItem[0])
+ return False
+
+ if PcdTypeItem.upper != DT.TAB_INF_FEATURE_PCD.upper():
+ PcdItemObj.SetSupportArchList(SupArchDict[PcdTypeItem])
+ else:
+ PcdItemObj.SetSupportArchList(SupArchList)
+
+ if (PcdTypeItem, PcdItemObj) in self.Pcds:
+ PcdsList = self.Pcds[PcdTypeItem, PcdItemObj]
+ PcdsList.append(PcdItemObj)
+ self.Pcds[PcdTypeItem, PcdItemObj] = PcdsList
+ else:
+ PcdsList = []
+ PcdsList.append(PcdItemObj)
+ self.Pcds[PcdTypeItem, PcdItemObj] = PcdsList
+
+ return True
+
+ def SetAsBuildPcds(self, PcdContent, KeysList=None, PackageInfo=None):
+ for PcdItem in PcdContent:
+ PcdItemObj = InfPcdItem()
+ CommentList = PcdItem[1]
+ CurrentLineOfPcdItem = PcdItem[2]
+ PcdItem = PcdItem[0]
+ CommentString = ''
+
+ for CommentLine in CommentList:
+ CommentString = GetHelpStringByRemoveHashKey(CommentLine)
+ CommentItemIns = InfPcdItemCommentContent()
+ CommentItemIns.SetHelpStringItem(CommentString)
+ CommentItemIns.SetUsageItem(CommentString)
+ PcdItemObj.SetHelpStringList(PcdItemObj.GetHelpStringList() + [CommentItemIns])
+ if PcdItemObj.GetValidUsage():
+ PcdItemObj.SetValidUsage(PcdItemObj.GetValidUsage() + DT.TAB_VALUE_SPLIT + CommentString)
+ else:
+ PcdItemObj.SetValidUsage(CommentString)
+
+ PcdItemObj.SetItemType(KeysList[0][0])
+ #
+ # Set PcdTokenSpaceCName and CName
+ #
+ PcdItemObj = SetPcdName(PcdItem, CurrentLineOfPcdItem, PcdItemObj)
+ #
+ # Set Value/DatumType/OffSet/Token
+ #
+ PcdItemObj = SetValueDatumTypeMaxSizeToken(PcdItem,
+ CurrentLineOfPcdItem,
+ PcdItemObj,
+ KeysList[0][1],
+ PackageInfo)
+
+ PcdTypeItem = KeysList[0][0]
+ if (PcdTypeItem, PcdItemObj) in self.Pcds:
+ PcdsList = self.Pcds[PcdTypeItem, PcdItemObj]
+ PcdsList.append(PcdItemObj)
+ self.Pcds[PcdTypeItem, PcdItemObj] = PcdsList
+ else:
+ PcdsList = []
+ PcdsList.append(PcdItemObj)
+ self.Pcds[PcdTypeItem, PcdItemObj] = PcdsList
+
+ def GetPcds(self):
+ return self.Pcds
+
+def ParserPcdInfoInDec(String):
+ ValueList = GetSplitValueList(String, DT.TAB_VALUE_SPLIT, 3)
+
+ #
+ # DatumType, Token
+ #
+ return ValueList[2], ValueList[3]
+
+def SetValueDatumTypeMaxSizeToken(PcdItem, CurrentLineOfPcdItem, PcdItemObj, Arch, PackageInfo=None):
+ #
+ # Package information not been generated currently, we need to parser INF file to get information.
+ #
+ if not PackageInfo:
+ PackageInfo = []
+ InfFileName = CurrentLineOfPcdItem[2]
+ PackageInfoList = GetPackageListInfo(InfFileName, GlobalData.gWORKSPACE, -1)
+ for PackageInfoListItem in PackageInfoList:
+ PackageInfoIns = InfPackageItem()
+ PackageInfoIns.SetPackageName(PackageInfoListItem)
+ PackageInfo.append(PackageInfoIns)
+
+ PcdInfoInDecHasFound = False
+ for PackageItem in PackageInfo:
+ if PcdInfoInDecHasFound:
+ break
+ PackageName = PackageItem.PackageName
+ #
+ # Open DEC file to get information
+ #
+ FullFileName = os.path.normpath(os.path.realpath(os.path.join(GlobalData.gWORKSPACE, PackageName)))
+
+ DecParser = None
+ if FullFileName not in GlobalData.gPackageDict:
+ DecParser = Dec(FullFileName)
+ GlobalData.gPackageDict[FullFileName] = DecParser
+ else:
+ DecParser = GlobalData.gPackageDict[FullFileName]
+
+ #
+ # Find PCD information.
+ #
+ DecPcdsDict = DecParser.GetPcdSectionObject().ValueDict
+ for Key in DecPcdsDict.keys():
+ if (Key[0] == 'PCDSDYNAMICEX' and PcdItemObj.GetItemType() == 'PcdEx') and \
+ (Key[1] == 'COMMON' or Key[1] == Arch):
+ for PcdInDec in DecPcdsDict[Key]:
+ if PcdInDec.TokenCName == PcdItemObj.CName and \
+ PcdInDec.TokenSpaceGuidCName == PcdItemObj.TokenSpaceGuidCName:
+ PcdItemObj.SetToken(PcdInDec.TokenValue)
+ PcdItemObj.SetDatumType(PcdInDec.DatumType)
+ PcdItemObj.SetSupportArchList([Arch])
+ PcdItemObj.SetDefaultValue(PcdInDec.DefaultValue)
+
+ if (Key[0] == 'PCDSPATCHABLEINMODULE' and PcdItemObj.GetItemType() == 'PatchPcd') and \
+ (Key[1] == 'COMMON' or Key[1] == Arch):
+ for PcdInDec in DecPcdsDict[Key]:
+ if PcdInDec.TokenCName == PcdItemObj.CName and \
+ PcdInDec.TokenSpaceGuidCName == PcdItemObj.TokenSpaceGuidCName:
+ PcdItemObj.SetToken(PcdInDec.TokenValue)
+ PcdItemObj.SetDatumType(PcdInDec.DatumType)
+ PcdItemObj.SetSupportArchList([Arch])
+
+ if PcdItemObj.GetDatumType() == 'VOID*':
+ if len(PcdItem) > 1:
+ PcdItemObj.SetMaxDatumSize('%s' % (len(GetSplitValueList(PcdItem[1], DT.TAB_COMMA_SPLIT))))
+
+ DecGuidsDict = DecParser.GetGuidSectionObject().ValueDict
+ for Key in DecGuidsDict.keys():
+ if Key == 'COMMON' or Key == Arch:
+ for GuidInDec in DecGuidsDict[Key]:
+ if GuidInDec.GuidCName == PcdItemObj.TokenSpaceGuidCName:
+ PcdItemObj.SetTokenSpaceGuidValue(GuidInDec.GuidString)
+
+ if PcdItemObj.GetItemType().upper() == DT.TAB_INF_PATCH_PCD.upper():
+ #
+ # Validate Value.
+ #
+ # convert the value from a decimal 0 to a formatted hex value.
+ if PcdItem[1] == "0":
+ DatumType = PcdItemObj.GetDatumType()
+ if DatumType == "UINT8":
+ PcdItem[1] = "0x00"
+ if DatumType == "UINT16":
+ PcdItem[1] = "0x0000"
+ if DatumType == "UINT32":
+ PcdItem[1] = "0x00000000"
+ if DatumType == "UINT64":
+ PcdItem[1] = "0x0000000000000000"
+
+ if ValidatePcdValueOnDatumType(PcdItem[1], PcdItemObj.GetDatumType()):
+ PcdItemObj.SetDefaultValue(PcdItem[1])
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_ASBUILD_PCD_VALUE_INVALID % ("\"" + PcdItem[1] + "\"", "\"" +
+ PcdItemObj.GetDatumType() + "\""),
+ File=CurrentLineOfPcdItem[2],
+ Line=CurrentLineOfPcdItem[1],
+ ExtraData=CurrentLineOfPcdItem[0])
+ #
+ # validate offset
+ #
+ if PcdItemObj.GetItemType().upper() == DT.TAB_INF_PATCH_PCD.upper():
+ if not IsHexDigitUINT32(PcdItem[2]):
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_ASBUILD_PCD_OFFSET_FORMAT_INVALID % ("\"" + PcdItem[2] + "\""),
+ File=CurrentLineOfPcdItem[2],
+ Line=CurrentLineOfPcdItem[1],
+ ExtraData=CurrentLineOfPcdItem[0])
+ PcdItemObj.SetOffset(PcdItem[2])
+
+ if PcdItemObj.GetToken() == '' or PcdItemObj.GetDatumType() == '':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_ASBUILD_PCD_DECLARITION_MISS % ("\"" + PcdItem[0] + "\""),
+ File=CurrentLineOfPcdItem[2],
+ Line=CurrentLineOfPcdItem[1],
+ ExtraData=CurrentLineOfPcdItem[0])
+
+ return PcdItemObj
+
+def ValidatePcdValueOnDatumType(Value, Type):
+
+ Value = Value.strip()
+ #
+ # Boolean type only allow 0x00 or 0x01 as value per INF spec
+ #
+ if Type == 'BOOLEAN':
+ if not (Value == '0x00' or Value == '0x01'):
+ return False
+ elif Type == 'VOID*':
+ if not Value.startswith("{"):
+ return False
+ if not Value.endswith("}"):
+ return False
+ #
+ # Strip "{" at head and "}" at tail.
+ #
+ Value = Value[1:-1]
+ ValueList = GetSplitValueList(Value, DT.TAB_COMMA_SPLIT)
+
+ ReIsValidHexByte = re.compile("^0x[0-9a-f]{1,2}$", re.IGNORECASE)
+ for ValueItem in ValueList:
+ if not ReIsValidHexByte.match(ValueItem):
+ return False
+
+ elif Type == 'UINT8' or Type == 'UINT16' or Type == 'UINT32' or Type == 'UINT64':
+
+ ReIsValidUint8z = re.compile('^0[x|X][a-fA-F0-9]{2}$')
+ ReIsValidUint16z = re.compile('^0[x|X][a-fA-F0-9]{4}$')
+ ReIsValidUint32z = re.compile('^0[x|X][a-fA-F0-9]{8}$')
+ ReIsValidUint64z = re.compile('^0[x|X][a-fA-F0-9]{16}$')
+
+ if not ReIsValidUint8z.match(Value) and Type == 'UINT8':
+ return False
+ elif not ReIsValidUint16z.match(Value) and Type == 'UINT16':
+ return False
+ elif not ReIsValidUint32z.match(Value) and Type == 'UINT32':
+ return False
+ elif not ReIsValidUint64z.match(Value) and Type == 'UINT64':
+ return False
+ else:
+ #
+ # Since we assume the DEC file always correct, should never go to here.
+ #
+ pass
+
+ return True
+
+def SetPcdName(PcdItem, CurrentLineOfPcdItem, PcdItemObj):
+ #
+ # Only PCD Name specified
+ # <PcdName> ::= <TokenSpaceGuidCName> "." <TokenCName>
+ #
+ PcdId = GetSplitValueList(PcdItem[0], DT.TAB_SPLIT)
+ if len(PcdId) != 2:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_PCD_NAME_FORMAT_ERROR,
+ File=CurrentLineOfPcdItem[2],
+ Line=CurrentLineOfPcdItem[1],
+ ExtraData=CurrentLineOfPcdItem[0])
+ else:
+ #
+ # Validate PcdTokenSpaceGuidCName
+ #
+ if not IsValidCVariableName(PcdId[0]):
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_PCD_CVAR_GUID,
+ File=CurrentLineOfPcdItem[2],
+ Line=CurrentLineOfPcdItem[1],
+ ExtraData=PcdId[0])
+ if not IsValidCVariableName(PcdId[1]):
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_PCD_CVAR_PCDCNAME,
+ File=CurrentLineOfPcdItem[2],
+ Line=CurrentLineOfPcdItem[1],
+ ExtraData=PcdId[1])
+ PcdItemObj.SetTokenSpaceGuidCName(PcdId[0])
+ PcdItemObj.SetCName(PcdId[1])
+
+ return PcdItemObj
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py
new file mode 100644
index 000000000..1968c3657
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py
@@ -0,0 +1,337 @@
+## @file
+# This file is used to define class objects of INF file [Ppis] section.
+# It will consumed by InfParser.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfPpiObject
+'''
+
+from Library.ParserValidate import IsValidCVariableName
+from Library.CommentParsing import ParseComment
+from Library.ExpressionValidate import IsValidFeatureFlagExp
+
+from Library.Misc import Sdict
+from Library import DataType as DT
+import Logger.Log as Logger
+from Logger import ToolError
+from Logger import StringTable as ST
+
+def ParsePpiComment(CommentsList, InfPpiItemObj):
+ PreNotify = None
+ PreUsage = None
+ PreHelpText = ''
+ BlockFlag = -1
+ CommentInsList = []
+ Count = 0
+ for CommentItem in CommentsList:
+ Count = Count + 1
+ CommentItemUsage, \
+ CommentItemNotify, \
+ CommentItemString, \
+ CommentItemHelpText = \
+ ParseComment(CommentItem,
+ DT.ALL_USAGE_TOKENS,
+ DT.PPI_NOTIFY_TOKENS,
+ ['PPI'],
+ False)
+
+ #
+ # To avoid PyLint error
+ #
+ if CommentItemString:
+ pass
+
+ if CommentItemHelpText is None:
+ CommentItemHelpText = ''
+ if Count == len(CommentsList) and CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:
+ CommentItemHelpText = DT.END_OF_LINE
+ #
+ # For the Last comment Item, set BlockFlag.
+ #
+ if Count == len(CommentsList):
+ if BlockFlag == 1 or BlockFlag == 2:
+ if CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:
+ BlockFlag = 4
+ else:
+ BlockFlag = 3
+ elif BlockFlag == -1:
+ BlockFlag = 4
+
+ #
+ # Comment USAGE and NOTIFY information are "UNDEFINED"
+ #
+ if BlockFlag == -1 or BlockFlag == 1 or BlockFlag == 2:
+ if CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:
+ if BlockFlag == -1:
+ BlockFlag = 1
+ elif BlockFlag == 1:
+ BlockFlag = 2
+ else:
+ if BlockFlag == 1 or BlockFlag == 2:
+ BlockFlag = 3
+ #
+ # An item have Usage or Notify information and the first time get this information
+ #
+ elif BlockFlag == -1:
+ BlockFlag = 4
+
+ #
+ # Combine two comment line if they are generic comment
+ #
+ if CommentItemUsage == CommentItemNotify == PreUsage == PreNotify == DT.ITEM_UNDEFINED:
+ CommentItemHelpText = PreHelpText + DT.END_OF_LINE + CommentItemHelpText
+ #
+ # Store this information for next line may still need combine operation.
+ #
+ PreHelpText = CommentItemHelpText
+
+ if BlockFlag == 4:
+ CommentItemIns = InfPpiItemCommentContent()
+ CommentItemIns.SetUsage(CommentItemUsage)
+ CommentItemIns.SetNotify(CommentItemNotify)
+ CommentItemIns.SetHelpStringItem(CommentItemHelpText)
+ CommentInsList.append(CommentItemIns)
+
+ BlockFlag = -1
+ PreUsage = None
+ PreNotify = None
+ PreHelpText = ''
+
+ elif BlockFlag == 3:
+ #
+ # Add previous help string
+ #
+ CommentItemIns = InfPpiItemCommentContent()
+ CommentItemIns.SetUsage(DT.ITEM_UNDEFINED)
+ CommentItemIns.SetNotify(DT.ITEM_UNDEFINED)
+ if PreHelpText == '' or PreHelpText.endswith(DT.END_OF_LINE):
+ PreHelpText += DT.END_OF_LINE
+ CommentItemIns.SetHelpStringItem(PreHelpText)
+ CommentInsList.append(CommentItemIns)
+ #
+ # Add Current help string
+ #
+ CommentItemIns = InfPpiItemCommentContent()
+ CommentItemIns.SetUsage(CommentItemUsage)
+ CommentItemIns.SetNotify(CommentItemNotify)
+ CommentItemIns.SetHelpStringItem(CommentItemHelpText)
+ CommentInsList.append(CommentItemIns)
+
+ BlockFlag = -1
+ PreUsage = None
+ PreNotify = None
+ PreHelpText = ''
+ else:
+ PreUsage = CommentItemUsage
+ PreNotify = CommentItemNotify
+ PreHelpText = CommentItemHelpText
+
+ InfPpiItemObj.SetCommentList(CommentInsList)
+
+ return InfPpiItemObj
+
+class InfPpiItemCommentContent():
+ def __init__(self):
+ #
+ # ## SOMETIMES_CONSUMES ## HelpString
+ #
+ self.UsageItem = ''
+ #
+ # Help String
+ #
+ self.HelpStringItem = ''
+ self.Notify = ''
+ self.CommentList = []
+
+ def SetUsage(self, UsageItem):
+ self.UsageItem = UsageItem
+ def GetUsage(self):
+ return self.UsageItem
+
+ def SetNotify(self, Notify):
+ if Notify != DT.ITEM_UNDEFINED:
+ self.Notify = 'true'
+ def GetNotify(self):
+ return self.Notify
+
+ def SetHelpStringItem(self, HelpStringItem):
+ self.HelpStringItem = HelpStringItem
+ def GetHelpStringItem(self):
+ return self.HelpStringItem
+
+class InfPpiItem():
+ def __init__(self):
+ self.Name = ''
+ self.FeatureFlagExp = ''
+ self.SupArchList = []
+ self.CommentList = []
+
+ def SetName(self, Name):
+ self.Name = Name
+ def GetName(self):
+ return self.Name
+
+ def SetSupArchList(self, SupArchList):
+ self.SupArchList = SupArchList
+ def GetSupArchList(self):
+ return self.SupArchList
+
+ def SetCommentList(self, CommentList):
+ self.CommentList = CommentList
+ def GetCommentList(self):
+ return self.CommentList
+
+ def SetFeatureFlagExp(self, FeatureFlagExp):
+ self.FeatureFlagExp = FeatureFlagExp
+ def GetFeatureFlagExp(self):
+ return self.FeatureFlagExp
+##
+#
+#
+#
+class InfPpiObject():
+ def __init__(self):
+ self.Ppis = Sdict()
+ #
+ # Macro defined in this section should be only used in this section.
+ #
+ self.Macros = {}
+
+ def SetPpi(self, PpiList, Arch = None):
+ __SupArchList = []
+ for ArchItem in Arch:
+ #
+ # Validate Arch
+ #
+ if (ArchItem == '' or ArchItem is None):
+ ArchItem = 'COMMON'
+ __SupArchList.append(ArchItem)
+
+ for Item in PpiList:
+ #
+ # Get Comment content of this protocol
+ #
+ CommentsList = None
+ if len(Item) == 3:
+ CommentsList = Item[1]
+ CurrentLineOfItem = Item[2]
+ Item = Item[0]
+ InfPpiItemObj = InfPpiItem()
+ if len(Item) >= 1 and len(Item) <= 2:
+ #
+ # Only CName contained
+ #
+ if not IsValidCVariableName(Item[0]):
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_INVALID_CNAME%(Item[0]),
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ if (Item[0] != ''):
+ InfPpiItemObj.SetName(Item[0])
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_CNAME_MISSING,
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ #
+ # Have FeatureFlag information
+ #
+ if len(Item) == 2:
+ #
+ # Contained CName and Feature Flag Express
+ # <statements> ::= <CName> ["|" <FeatureFlagExpress>]
+ # Item[1] should not be empty
+ #
+ if Item[1].strip() == '':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ #
+ # Validate Feature Flag Express for PPI entry
+ # Item[1] contain FFE information
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(Item[1].strip())
+ if not FeatureFlagRtv[0]:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ InfPpiItemObj.SetFeatureFlagExp(Item[1])
+ if len(Item) != 1 and len(Item) != 2:
+ #
+ # Invalid format of Ppi statement
+ #
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_GUID_PPI_PROTOCOL_SECTION_CONTENT_ERROR,
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+
+ #
+ # Get/Set Usage and HelpString for PPI entry
+ #
+ if CommentsList is not None and len(CommentsList) != 0:
+ InfPpiItemObj = ParsePpiComment(CommentsList, InfPpiItemObj)
+ else:
+ CommentItemIns = InfPpiItemCommentContent()
+ CommentItemIns.SetUsage(DT.ITEM_UNDEFINED)
+ CommentItemIns.SetNotify(DT.ITEM_UNDEFINED)
+ InfPpiItemObj.SetCommentList([CommentItemIns])
+
+ InfPpiItemObj.SetSupArchList(__SupArchList)
+
+ #
+ # Determine PPI name duplicate. Follow below rule:
+ #
+ # A PPI must not be duplicated within a [Ppis] section.
+ # A PPI may appear in multiple architectural [Ppis]
+ # sections. A PPI listed in an architectural [Ppis]
+ # section must not be listed in the common architectural
+ # [Ppis] section.
+ #
+ # NOTE: This check will not report error now.
+ #
+ for Item in self.Ppis:
+ if Item.GetName() == InfPpiItemObj.GetName():
+ ItemSupArchList = Item.GetSupArchList()
+ for ItemArch in ItemSupArchList:
+ for PpiItemObjArch in __SupArchList:
+ if ItemArch == PpiItemObjArch:
+ #
+ # ST.ERR_INF_PARSER_ITEM_DUPLICATE
+ #
+ pass
+ if ItemArch.upper() == 'COMMON' or PpiItemObjArch.upper() == 'COMMON':
+ #
+ # ST.ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
+ #
+ pass
+
+ if (InfPpiItemObj) in self.Ppis:
+ PpiList = self.Ppis[InfPpiItemObj]
+ PpiList.append(InfPpiItemObj)
+ self.Ppis[InfPpiItemObj] = PpiList
+ else:
+ PpiList = []
+ PpiList.append(InfPpiItemObj)
+ self.Ppis[InfPpiItemObj] = PpiList
+
+ return True
+
+
+ def GetPpi(self):
+ return self.Ppis
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py
new file mode 100644
index 000000000..80bfca607
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py
@@ -0,0 +1,305 @@
+## @file
+# This file is used to define class objects of INF file [Protocols] section.
+# It will consumed by InfParser.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfProtocolObject
+'''
+
+from Library.ParserValidate import IsValidCVariableName
+from Library.CommentParsing import ParseComment
+from Library.ExpressionValidate import IsValidFeatureFlagExp
+
+from Library.Misc import Sdict
+
+from Object.Parser.InfMisc import ErrorInInf
+
+from Library import DataType as DT
+from Logger import StringTable as ST
+
+def ParseProtocolComment(CommentsList, InfProtocolItemObj):
+ CommentInsList = []
+ PreUsage = None
+ PreNotify = None
+ PreHelpText = ''
+ BlockFlag = -1
+ Count = 0
+ for CommentItem in CommentsList:
+ Count = Count + 1
+ CommentItemUsage, \
+ CommentItemNotify, \
+ CommentItemString, \
+ CommentItemHelpText = \
+ ParseComment(CommentItem,
+ DT.PROTOCOL_USAGE_TOKENS,
+ DT.PROTOCOL_NOTIFY_TOKENS,
+ ['PROTOCOL'],
+ False)
+
+ if CommentItemString:
+ pass
+
+ if CommentItemHelpText is None:
+ CommentItemHelpText = ''
+ if Count == len(CommentsList) and CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:
+ CommentItemHelpText = DT.END_OF_LINE
+
+ if Count == len(CommentsList):
+ if BlockFlag == 1 or BlockFlag == 2:
+ if CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:
+ BlockFlag = 4
+ else:
+ BlockFlag = 3
+ elif BlockFlag == -1:
+ BlockFlag = 4
+
+ if BlockFlag == -1 or BlockFlag == 1 or BlockFlag == 2:
+ if CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:
+ if BlockFlag == -1:
+ BlockFlag = 1
+ elif BlockFlag == 1:
+ BlockFlag = 2
+ else:
+ if BlockFlag == 1 or BlockFlag == 2:
+ BlockFlag = 3
+ elif BlockFlag == -1:
+ BlockFlag = 4
+
+ #
+ # Combine two comment line if they are generic comment
+ #
+ if CommentItemUsage == CommentItemNotify == PreUsage == PreNotify == DT.ITEM_UNDEFINED:
+ CommentItemHelpText = PreHelpText + DT.END_OF_LINE + CommentItemHelpText
+
+ PreHelpText = CommentItemHelpText
+
+ if BlockFlag == 4:
+ CommentItemIns = InfProtocolItemCommentContent()
+ CommentItemIns.SetUsageItem(CommentItemUsage)
+ CommentItemIns.SetNotify(CommentItemNotify)
+ CommentItemIns.SetHelpStringItem(CommentItemHelpText)
+ CommentInsList.append(CommentItemIns)
+
+ BlockFlag = -1
+ PreUsage = None
+ PreNotify = None
+ PreHelpText = ''
+
+ elif BlockFlag == 3:
+ #
+ # Add previous help string
+ #
+ CommentItemIns = InfProtocolItemCommentContent()
+ CommentItemIns.SetUsageItem(DT.ITEM_UNDEFINED)
+ CommentItemIns.SetNotify(DT.ITEM_UNDEFINED)
+ if PreHelpText == '' or PreHelpText.endswith(DT.END_OF_LINE):
+ PreHelpText += DT.END_OF_LINE
+ CommentItemIns.SetHelpStringItem(PreHelpText)
+ CommentInsList.append(CommentItemIns)
+ #
+ # Add Current help string
+ #
+ CommentItemIns = InfProtocolItemCommentContent()
+ CommentItemIns.SetUsageItem(CommentItemUsage)
+ CommentItemIns.SetNotify(CommentItemNotify)
+ CommentItemIns.SetHelpStringItem(CommentItemHelpText)
+ CommentInsList.append(CommentItemIns)
+
+ BlockFlag = -1
+ PreUsage = None
+ PreNotify = None
+ PreHelpText = ''
+
+ else:
+ PreUsage = CommentItemUsage
+ PreNotify = CommentItemNotify
+ PreHelpText = CommentItemHelpText
+
+ InfProtocolItemObj.SetCommentList(CommentInsList)
+
+ return InfProtocolItemObj
+
+class InfProtocolItemCommentContent():
+ def __init__(self):
+ #
+ # ## SOMETIMES_CONSUMES ## HelpString
+ #
+ self.UsageItem = ''
+ #
+ # Help String
+ #
+ self.HelpStringItem = ''
+ self.Notify = ''
+ self.CommentList = []
+
+ def SetUsageItem(self, UsageItem):
+ self.UsageItem = UsageItem
+ def GetUsageItem(self):
+ return self.UsageItem
+
+ def SetNotify(self, Notify):
+ if Notify != DT.ITEM_UNDEFINED:
+ self.Notify = 'true'
+ def GetNotify(self):
+ return self.Notify
+
+ def SetHelpStringItem(self, HelpStringItem):
+ self.HelpStringItem = HelpStringItem
+ def GetHelpStringItem(self):
+ return self.HelpStringItem
+
+class InfProtocolItem():
+ def __init__(self):
+ self.Name = ''
+ self.FeatureFlagExp = ''
+ self.SupArchList = []
+ self.CommentList = []
+
+ def SetName(self, Name):
+ self.Name = Name
+ def GetName(self):
+ return self.Name
+
+ def SetFeatureFlagExp(self, FeatureFlagExp):
+ self.FeatureFlagExp = FeatureFlagExp
+ def GetFeatureFlagExp(self):
+ return self.FeatureFlagExp
+
+ def SetSupArchList(self, SupArchList):
+ self.SupArchList = SupArchList
+ def GetSupArchList(self):
+ return self.SupArchList
+
+ def SetCommentList(self, CommentList):
+ self.CommentList = CommentList
+ def GetCommentList(self):
+ return self.CommentList
+
+##
+#
+#
+#
+class InfProtocolObject():
+ def __init__(self):
+ self.Protocols = Sdict()
+ #
+ # Macro defined in this section should be only used in this section.
+ #
+ self.Macros = {}
+
+ def SetProtocol(self, ProtocolContent, Arch = None,):
+ __SupArchList = []
+ for ArchItem in Arch:
+ #
+ # Validate Arch
+ #
+ if (ArchItem == '' or ArchItem is None):
+ ArchItem = 'COMMON'
+ __SupArchList.append(ArchItem)
+
+ for Item in ProtocolContent:
+ #
+ # Get Comment content of this protocol
+ #
+ CommentsList = None
+ if len(Item) == 3:
+ CommentsList = Item[1]
+ CurrentLineOfItem = Item[2]
+ LineInfo = (CurrentLineOfItem[2], CurrentLineOfItem[1], CurrentLineOfItem[0])
+ Item = Item[0]
+ InfProtocolItemObj = InfProtocolItem()
+ if len(Item) >= 1 and len(Item) <= 2:
+ #
+ # Only CName contained
+ #
+ if not IsValidCVariableName(Item[0]):
+ ErrorInInf(ST.ERR_INF_PARSER_INVALID_CNAME%(Item[0]),
+ LineInfo=LineInfo)
+ if (Item[0] != ''):
+ InfProtocolItemObj.SetName(Item[0])
+ else:
+ ErrorInInf(ST.ERR_INF_PARSER_CNAME_MISSING,
+ LineInfo=LineInfo)
+ if len(Item) == 2:
+ #
+ # Contained CName and Feature Flag Express
+ # <statements> ::= <CName> ["|"
+ # <FeatureFlagExpress>]
+ # For Protocol Object
+ #
+ if Item[1].strip() == '':
+ ErrorInInf(ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
+ LineInfo=LineInfo)
+ #
+ # Validate Feature Flag Express for Item[1]
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(Item[1].strip())
+ if not FeatureFlagRtv[0]:
+ ErrorInInf(ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
+ LineInfo=LineInfo)
+ InfProtocolItemObj.SetFeatureFlagExp(Item[1])
+
+ if len(Item) < 1 or len(Item) > 2:
+ #
+ # Invalid format of Protocols statement
+ #
+ ErrorInInf(ST.ERR_INF_PARSER_GUID_PPI_PROTOCOL_SECTION_CONTENT_ERROR,
+ LineInfo=LineInfo)
+
+ #
+ # Get/Set Usage and HelpString for Protocol entry
+ #
+ if CommentsList is not None and len(CommentsList) != 0:
+ InfProtocolItemObj = ParseProtocolComment(CommentsList, InfProtocolItemObj)
+ else:
+ CommentItemIns = InfProtocolItemCommentContent()
+ CommentItemIns.SetUsageItem(DT.ITEM_UNDEFINED)
+ CommentItemIns.SetNotify(DT.ITEM_UNDEFINED)
+ InfProtocolItemObj.SetCommentList([CommentItemIns])
+
+ InfProtocolItemObj.SetSupArchList(__SupArchList)
+
+ #
+ # Determine protocol name duplicate. Follow below rule:
+ #
+ # A protocol must not be duplicated within a [Protocols] section.
+ # A protocol may appear in multiple architectural [Protocols]
+ # sections. A protocol listed in an architectural [Protocols]
+ # section must not be listed in the common architectural
+ # [Protocols] section.
+ #
+ # NOTE: This check will not report error now.
+ #
+ for Item in self.Protocols:
+ if Item.GetName() == InfProtocolItemObj.GetName():
+ ItemSupArchList = Item.GetSupArchList()
+ for ItemArch in ItemSupArchList:
+ for ProtocolItemObjArch in __SupArchList:
+ if ItemArch == ProtocolItemObjArch:
+ #
+ # ST.ERR_INF_PARSER_ITEM_DUPLICATE
+ #
+ pass
+ if ItemArch.upper() == 'COMMON' or ProtocolItemObjArch.upper() == 'COMMON':
+ #
+ # ST.ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
+ #
+ pass
+
+ if (InfProtocolItemObj) in self.Protocols:
+ ProcotolList = self.Protocols[InfProtocolItemObj]
+ ProcotolList.append(InfProtocolItemObj)
+ self.Protocols[InfProtocolItemObj] = ProcotolList
+ else:
+ ProcotolList = []
+ ProcotolList.append(InfProtocolItemObj)
+ self.Protocols[InfProtocolItemObj] = ProcotolList
+
+ return True
+
+ def GetProtocol(self):
+ return self.Protocols
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py
new file mode 100644
index 000000000..75ea209c4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py
@@ -0,0 +1,233 @@
+## @file
+# This file is used to define class objects of INF file [Sources] section.
+# It will consumed by InfParser.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfSourcesObject
+'''
+
+import os
+
+from Logger import StringTable as ST
+from Logger import ToolError
+import Logger.Log as Logger
+from Library import GlobalData
+
+from Library.Misc import Sdict
+from Library.ExpressionValidate import IsValidFeatureFlagExp
+from Object.Parser.InfCommonObject import InfSectionCommonDef
+from Library.Misc import ValidFile
+from Library.ParserValidate import IsValidFamily
+from Library.ParserValidate import IsValidPath
+
+## __GenSourceInstance
+#
+#
+def GenSourceInstance(Item, CurrentLineOfItem, ItemObj):
+
+ IsValidFileFlag = False
+
+ if len(Item) < 6 and len(Item) >= 1:
+ #
+ # File | Family | TagName | ToolCode | FeatureFlagExpr
+ #
+ if len(Item) == 5:
+ #
+ # Validate Feature Flag Express
+ #
+ if Item[4].strip() == '':
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_MISSING,
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ #
+ # Validate FFE
+ #
+ FeatureFlagRtv = IsValidFeatureFlagExp(Item[4].strip())
+ if not FeatureFlagRtv[0]:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FEATURE_FLAG_EXP_SYNTAX_INVLID%(FeatureFlagRtv[1]),
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ ItemObj.SetFeatureFlagExp(Item[4])
+ if len(Item) >= 4:
+ if Item[3].strip() == '':
+ ItemObj.SetToolCode(Item[3])
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_TOOLCODE_NOT_PERMITTED%(Item[2]),
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ if len(Item) >= 3:
+ if Item[2].strip() == '':
+ ItemObj.SetTagName(Item[2])
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_TAGNAME_NOT_PERMITTED%(Item[2]),
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ if len(Item) >= 2:
+ if IsValidFamily(Item[1].strip()):
+ #
+ # To align with UDP specification. "*" is not permitted in UDP specification
+ #
+ if Item[1].strip() == "*":
+ Item[1] = ""
+ ItemObj.SetFamily(Item[1])
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_SOURCE_SECTION_FAMILY_INVALID%(Item[1]),
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ if len(Item) >= 1:
+ #
+ # Validate file name exist.
+ #
+ FullFileName = os.path.normpath(os.path.realpath(os.path.join(GlobalData.gINF_MODULE_DIR, Item[0])))
+ if not (ValidFile(FullFileName) or ValidFile(Item[0])):
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_FILELIST_EXIST%(Item[0]),
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+
+ #
+ # Validate file exist/format.
+ #
+
+ if IsValidPath(Item[0], GlobalData.gINF_MODULE_DIR):
+ IsValidFileFlag = True
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(Item[0]),
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+ return False
+ if IsValidFileFlag:
+ ItemObj.SetSourceFileName(Item[0])
+ else:
+ Logger.Error("InfParser",
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_SOURCES_SECTION_CONTENT_ERROR,
+ File=CurrentLineOfItem[2],
+ Line=CurrentLineOfItem[1],
+ ExtraData=CurrentLineOfItem[0])
+
+ return ItemObj
+
+## InfSourcesItemObject()
+#
+#
+class InfSourcesItemObject():
+ def __init__(self, \
+ SourceFileName = '', \
+ Family = '', \
+ TagName = '', \
+ ToolCode = '', \
+ FeatureFlagExp = ''):
+ self.SourceFileName = SourceFileName
+ self.Family = Family
+ self.TagName = TagName
+ self.ToolCode = ToolCode
+ self.FeatureFlagExp = FeatureFlagExp
+ self.HeaderString = ''
+ self.TailString = ''
+ self.SupArchList = []
+
+ def SetSourceFileName(self, SourceFilename):
+ self.SourceFileName = SourceFilename
+ def GetSourceFileName(self):
+ return self.SourceFileName
+
+ def SetFamily(self, Family):
+ self.Family = Family
+ def GetFamily(self):
+ return self.Family
+
+ def SetTagName(self, TagName):
+ self.TagName = TagName
+ def GetTagName(self):
+ return self.TagName
+
+ def SetToolCode(self, ToolCode):
+ self.ToolCode = ToolCode
+ def GetToolCode(self):
+ return self.ToolCode
+
+ def SetFeatureFlagExp(self, FeatureFlagExp):
+ self.FeatureFlagExp = FeatureFlagExp
+ def GetFeatureFlagExp(self):
+ return self.FeatureFlagExp
+
+ def SetHeaderString(self, HeaderString):
+ self.HeaderString = HeaderString
+ def GetHeaderString(self):
+ return self.HeaderString
+
+ def SetTailString(self, TailString):
+ self.TailString = TailString
+ def GetTailString(self):
+ return self.TailString
+
+ def SetSupArchList(self, SupArchList):
+ self.SupArchList = SupArchList
+ def GetSupArchList(self):
+ return self.SupArchList
+##
+#
+#
+#
+class InfSourcesObject(InfSectionCommonDef):
+ def __init__(self):
+ self.Sources = Sdict()
+ InfSectionCommonDef.__init__(self)
+
+ def SetSources(self, SourceList, Arch = None):
+ __SupArchList = []
+ for ArchItem in Arch:
+ #
+ # Validate Arch
+ #
+ if (ArchItem == '' or ArchItem is None):
+ ArchItem = 'COMMON'
+ __SupArchList.append(ArchItem)
+
+ for Item in SourceList:
+ ItemObj = InfSourcesItemObject()
+ CurrentLineOfItem = Item[2]
+ Item = Item[0]
+
+ ItemObj = GenSourceInstance(Item, CurrentLineOfItem, ItemObj)
+
+ ItemObj.SetSupArchList(__SupArchList)
+
+ if (ItemObj) in self.Sources:
+ SourceContent = self.Sources[ItemObj]
+ SourceContent.append(ItemObj)
+ self.Sources[ItemObj] = SourceContent
+ else:
+ SourceContent = []
+ SourceContent.append(ItemObj)
+ self.Sources[ItemObj] = SourceContent
+
+ return True
+
+ def GetSources(self):
+ return self.Sources
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfUserExtensionObject.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfUserExtensionObject.py
new file mode 100644
index 000000000..ce017dbeb
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/InfUserExtensionObject.py
@@ -0,0 +1,127 @@
+## @file
+# This file is used to define class objects of INF file [UserExtension] section.
+# It will consumed by InfParser.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+InfUserExtensionsObject
+'''
+
+from Logger import StringTable as ST
+from Logger import ToolError
+import Logger.Log as Logger
+from Library import GlobalData
+
+from Library.Misc import Sdict
+
+class InfUserExtensionItem():
+ def __init__(self,
+ Content = '',
+ UserId = '',
+ IdString = ''):
+ self.Content = Content
+ self.UserId = UserId
+ self.IdString = IdString
+ self.SupArchList = []
+
+ def SetContent(self, Content):
+ self.Content = Content
+ def GetContent(self):
+ return self.Content
+
+ def SetUserId(self, UserId):
+ self.UserId = UserId
+ def GetUserId(self):
+ return self.UserId
+
+ def SetIdString(self, IdString):
+ self.IdString = IdString
+ def GetIdString(self):
+ return self.IdString
+
+ def SetSupArchList(self, SupArchList):
+ self.SupArchList = SupArchList
+ def GetSupArchList(self):
+ return self.SupArchList
+
+##
+#
+#
+#
+class InfUserExtensionObject():
+ def __init__(self):
+ self.UserExtension = Sdict()
+
+ def SetUserExtension(self, UserExtensionCont, IdContent=None, LineNo=None):
+ if not UserExtensionCont or UserExtensionCont == '':
+ return True
+ #
+ # IdContent is a list contain UserId and IdString
+ # For this call the general section header parser, if no definition of
+ # IdString/UserId, it will return 'COMMON'
+ #
+ for IdContentItem in IdContent:
+ InfUserExtensionItemObj = InfUserExtensionItem()
+ if IdContentItem[0] == 'COMMON':
+ UserId = ''
+ else:
+ UserId = IdContentItem[0]
+
+ if IdContentItem[1] == 'COMMON':
+ IdString = ''
+ else:
+ IdString = IdContentItem[1]
+
+ #
+ # Fill UserExtensionObj members.
+ #
+ InfUserExtensionItemObj.SetUserId(UserId)
+ InfUserExtensionItemObj.SetIdString(IdString)
+ InfUserExtensionItemObj.SetContent(UserExtensionCont)
+ InfUserExtensionItemObj.SetSupArchList(IdContentItem[2])
+
+# for CheckItem in self.UserExtension:
+# if IdContentItem[0] == CheckItem[0] and IdContentItem[1] == CheckItem[1]:
+# if IdContentItem[2].upper() == 'COMMON' or CheckItem[2].upper() == 'COMMON':
+# #
+# # For COMMON ARCH type, do special check.
+# #
+# Logger.Error('InfParser',
+# ToolError.FORMAT_INVALID,
+# ST.ERR_INF_PARSER_UE_SECTION_DUPLICATE_ERROR%\
+# (IdContentItem[0] + '.' + IdContentItem[1] + '.' + IdContentItem[2]),
+# File=GlobalData.gINF_MODULE_NAME,
+# Line=LineNo,
+# ExtraData=None)
+
+ if IdContentItem in self.UserExtension:
+ #
+ # Each UserExtensions section header must have a unique set
+ # of UserId, IdString and Arch values.
+ # This means that the same UserId can be used in more than one
+ # section header, provided the IdString or Arch values are
+ # different. The same IdString values can be used in more than
+ # one section header if the UserId or Arch values are
+ # different. The same UserId and the same IdString can be used
+ # in a section header if the Arch values are different in each
+ # of the section headers.
+ #
+ Logger.Error('InfParser',
+ ToolError.FORMAT_INVALID,
+ ST.ERR_INF_PARSER_UE_SECTION_DUPLICATE_ERROR%\
+ (IdContentItem[0] + '.' + IdContentItem[1] + '.' + IdContentItem[2]),
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=LineNo,
+ ExtraData=None)
+ else:
+ UserExtensionList = []
+ UserExtensionList.append(InfUserExtensionItemObj)
+ self.UserExtension[IdContentItem] = UserExtensionList
+
+ return True
+
+ def GetUserExtension(self):
+ return self.UserExtension
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/__init__.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/__init__.py
new file mode 100644
index 000000000..268ce7ca1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/Parser/__init__.py
@@ -0,0 +1,14 @@
+## @file
+# Python 'Object' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+PARSER
+'''
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Object/__init__.py b/roms/edk2/BaseTools/Source/Python/UPT/Object/__init__.py
new file mode 100644
index 000000000..53db4406d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Object/__init__.py
@@ -0,0 +1,14 @@
+## @file
+# Python 'Object' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Object
+'''
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/DecParser.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/DecParser.py
new file mode 100644
index 000000000..8dfa12d82
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/DecParser.py
@@ -0,0 +1,1091 @@
+## @file
+# This file is used to parse DEC file. It will consumed by DecParser
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+'''
+DecParser
+'''
+## Import modules
+#
+import Logger.Log as Logger
+from Logger.ToolError import FILE_PARSE_FAILURE
+from Logger.ToolError import FILE_OPEN_FAILURE
+from Logger import StringTable as ST
+from Logger.ToolError import FORMAT_INVALID
+
+import Library.DataType as DT
+from Library.ParserValidate import IsValidToken
+from Library.ParserValidate import IsValidPath
+from Library.ParserValidate import IsValidCFormatGuid
+from Library.ParserValidate import IsValidIdString
+from Library.ParserValidate import IsValidUserId
+from Library.ParserValidate import IsValidArch
+from Library.ParserValidate import IsValidWord
+from Library.ParserValidate import IsValidDecVersionVal
+from Parser.DecParserMisc import TOOL_NAME
+from Parser.DecParserMisc import CleanString
+from Parser.DecParserMisc import IsValidPcdDatum
+from Parser.DecParserMisc import ParserHelper
+from Parser.DecParserMisc import StripRoot
+from Parser.DecParserMisc import VERSION_PATTERN
+from Parser.DecParserMisc import CVAR_PATTERN
+from Parser.DecParserMisc import PCD_TOKEN_PATTERN
+from Parser.DecParserMisc import MACRO_PATTERN
+from Parser.DecParserMisc import FileContent
+from Object.Parser.DecObject import _DecComments
+from Object.Parser.DecObject import DecDefineObject
+from Object.Parser.DecObject import DecDefineItemObject
+from Object.Parser.DecObject import DecIncludeObject
+from Object.Parser.DecObject import DecIncludeItemObject
+from Object.Parser.DecObject import DecLibraryclassObject
+from Object.Parser.DecObject import DecLibraryclassItemObject
+from Object.Parser.DecObject import DecGuidObject
+from Object.Parser.DecObject import DecPpiObject
+from Object.Parser.DecObject import DecProtocolObject
+from Object.Parser.DecObject import DecGuidItemObject
+from Object.Parser.DecObject import DecUserExtensionObject
+from Object.Parser.DecObject import DecUserExtensionItemObject
+from Object.Parser.DecObject import DecPcdObject
+from Object.Parser.DecObject import DecPcdItemObject
+from Library.Misc import GuidStructureStringToGuidString
+from Library.Misc import CheckGuidRegFormat
+from Library.StringUtils import ReplaceMacro
+from Library.StringUtils import GetSplitValueList
+from Library.StringUtils import gMACRO_PATTERN
+from Library.StringUtils import ConvertSpecialChar
+from Library.CommentParsing import ParsePcdErrorCode
+
+##
+# _DecBase class for parsing
+#
+class _DecBase:
+ def __init__(self, RawData):
+ self._RawData = RawData
+ self._ItemDict = {}
+ self._LocalMacro = {}
+ #
+ # Data parsed by 'self' are saved to this object
+ #
+ self.ItemObject = None
+
+ def GetDataObject(self):
+ return self.ItemObject
+
+ def GetLocalMacro(self):
+ return self._LocalMacro
+
+ ## BlockStart
+ #
+ # Called if a new section starts
+ #
+ def BlockStart(self):
+ self._LocalMacro = {}
+
+ ## _CheckReDefine
+ #
+ # @param Key: to be checked if multi-defined
+ # @param Scope: Format: [[SectionName, Arch], ...].
+ # If scope is none, use global scope
+ #
+ def _CheckReDefine(self, Key, Scope = None):
+ if not Scope:
+ Scope = self._RawData.CurrentScope
+ return
+
+ SecArch = []
+ #
+ # Copy scope to SecArch, avoid Scope be changed outside
+ #
+ SecArch[0:1] = Scope[:]
+ if Key not in self._ItemDict:
+ self._ItemDict[Key] = [[SecArch, self._RawData.LineIndex]]
+ return
+
+ for Value in self._ItemDict[Key]:
+ for SubValue in Scope:
+ #
+ # If current is common section
+ #
+ if SubValue[-1] == 'COMMON':
+ for Other in Value[0]:
+ # Key in common cannot be redefined in other arches
+ # [:-1] means stripping arch info
+ if Other[:-1] == SubValue[:-1]:
+ self._LoggerError(ST.ERR_DECPARSE_REDEFINE % (Key, Value[1]))
+ return
+ continue
+ CommonScope = []
+ CommonScope[0:1] = SubValue
+ CommonScope[-1] = 'COMMON'
+ #
+ # Cannot be redefined if this key already defined in COMMON Or defined in same arch
+ #
+ if SubValue in Value[0] or CommonScope in Value[0]:
+ self._LoggerError(ST.ERR_DECPARSE_REDEFINE % (Key, Value[1]))
+ return
+ self._ItemDict[Key].append([SecArch, self._RawData.LineIndex])
+
+ ## CheckRequiredFields
+ # Some sections need to check if some fields exist, define section for example
+ # Derived class can re-implement, top parser will call this function after all parsing done
+ #
+ def CheckRequiredFields(self):
+ if self._RawData:
+ pass
+ return True
+
+ ## IsItemRequired
+ # In DEC spec, sections must have at least one statement except user
+ # extension.
+ # For example: "[guids" [<attribs>] "]" <EOL> <statements>+
+ # sub class can override this method to indicate if statement is a must.
+ #
+ def _IsStatementRequired(self):
+ if self._RawData:
+ pass
+ return False
+
+ def _LoggerError(self, ErrorString):
+ Logger.Error(TOOL_NAME, FILE_PARSE_FAILURE, File=self._RawData.Filename,
+ Line = self._RawData.LineIndex,
+ ExtraData=ErrorString + ST.ERR_DECPARSE_LINE % self._RawData.CurrentLine)
+
+ def _ReplaceMacro(self, String):
+ if gMACRO_PATTERN.findall(String):
+ String = ReplaceMacro(String, self._LocalMacro, False,
+ FileName = self._RawData.Filename,
+ Line = ['', self._RawData.LineIndex])
+ String = ReplaceMacro(String, self._RawData.Macros, False,
+ FileName = self._RawData.Filename,
+ Line = ['', self._RawData.LineIndex])
+ MacroUsed = gMACRO_PATTERN.findall(String)
+ if MacroUsed:
+ Logger.Error(TOOL_NAME, FILE_PARSE_FAILURE,
+ File=self._RawData.Filename,
+ Line = self._RawData.LineIndex,
+ ExtraData = ST.ERR_DECPARSE_MACRO_RESOLVE % (str(MacroUsed), String))
+ return String
+
+ def _MacroParser(self, String):
+ TokenList = GetSplitValueList(String, ' ', 1)
+ if len(TokenList) < 2 or TokenList[1] == '':
+ self._LoggerError(ST.ERR_DECPARSE_MACRO_PAIR)
+
+ TokenList = GetSplitValueList(TokenList[1], DT.TAB_EQUAL_SPLIT, 1)
+ if TokenList[0] == '':
+ self._LoggerError(ST.ERR_DECPARSE_MACRO_NAME)
+ elif not IsValidToken(MACRO_PATTERN, TokenList[0]):
+ self._LoggerError(ST.ERR_DECPARSE_MACRO_NAME_UPPER % TokenList[0])
+
+ if len(TokenList) == 1:
+ self._LocalMacro[TokenList[0]] = ''
+ else:
+ self._LocalMacro[TokenList[0]] = self._ReplaceMacro(TokenList[1])
+
+ ## _ParseItem
+ #
+ # Parse specified item, this function must be derived by subclass
+ #
+ def _ParseItem(self):
+ if self._RawData:
+ pass
+ #
+ # Should never be called
+ #
+ return None
+
+
+ ## _TailCommentStrategy
+ #
+ # This function can be derived to parse tail comment
+ # default is it will not consume any lines
+ #
+ # @param Comment: Comment of current line
+ #
+ def _TailCommentStrategy(self, Comment):
+ if Comment:
+ pass
+ if self._RawData:
+ pass
+ return False
+
+ ## _StopCurrentParsing
+ #
+ # Called in Parse if current parsing should be stopped when encounter some
+ # keyword
+ # Default is section start and end
+ #
+ # @param Line: Current line
+ #
+ def _StopCurrentParsing(self, Line):
+ if self._RawData:
+ pass
+ return Line[0] == DT.TAB_SECTION_START and Line[-1] == DT.TAB_SECTION_END
+
+ ## _TryBackSlash
+ #
+ # Split comment and DEC content, concatenate lines if end of char is '\'
+ #
+ # @param ProcessedLine: ProcessedLine line
+ # @param ProcessedComments: ProcessedComments line
+ #
+ def _TryBackSlash(self, ProcessedLine, ProcessedComments):
+ CatLine = ''
+ Comment = ''
+ Line = ProcessedLine
+ CommentList = ProcessedComments
+ while not self._RawData.IsEndOfFile():
+ if Line == '':
+ self._LoggerError(ST.ERR_DECPARSE_BACKSLASH_EMPTY)
+ break
+
+ if Comment:
+ CommentList.append((Comment, self._RawData.LineIndex))
+ if Line[-1] != DT.TAB_SLASH:
+ CatLine += Line
+ break
+ elif len(Line) < 2 or Line[-2] != ' ':
+ self._LoggerError(ST.ERR_DECPARSE_BACKSLASH)
+ else:
+ CatLine += Line[:-1]
+ Line, Comment = CleanString(self._RawData.GetNextLine())
+ #
+ # Reach end of content
+ #
+ if self._RawData.IsEndOfFile():
+ if not CatLine:
+ if ProcessedLine[-1] == DT.TAB_SLASH:
+ self._LoggerError(ST.ERR_DECPARSE_BACKSLASH_EMPTY)
+ CatLine = ProcessedLine
+ else:
+ if not Line or Line[-1] == DT.TAB_SLASH:
+ self._LoggerError(ST.ERR_DECPARSE_BACKSLASH_EMPTY)
+ CatLine += Line
+
+ #
+ # All MACRO values defined by the DEFINE statements in any section
+ # (except [Userextensions] sections for Intel) of the INF or DEC file
+ # must be expanded before processing of the file.
+ #
+ __IsReplaceMacro = True
+ Header = self._RawData.CurrentScope[0] if self._RawData.CurrentScope else None
+ if Header and len(Header) > 2:
+ if Header[0].upper() == 'USEREXTENSIONS' and not (Header[1] == 'TianoCore' and Header[2] == '"ExtraFiles"'):
+ __IsReplaceMacro = False
+ if __IsReplaceMacro:
+ self._RawData.CurrentLine = self._ReplaceMacro(CatLine)
+ else:
+ self._RawData.CurrentLine = CatLine
+
+ return CatLine, CommentList
+
+ ## Parse
+ # This is a template method in which other member functions which might
+ # override by sub class are called. It is responsible for reading file
+ # line by line, and call other member functions to parse. This function
+ # should not be re-implement by sub class.
+ #
+ def Parse(self):
+ HeadComments = []
+ TailComments = []
+
+ #======================================================================
+ # CurComments may pointer to HeadComments or TailComments
+ #======================================================================
+ CurComments = HeadComments
+ CurObj = None
+ ItemNum = 0
+ FromBuf = False
+
+ #======================================================================
+ # Used to report error information if empty section found
+ #======================================================================
+ Index = self._RawData.LineIndex
+ LineStr = self._RawData.CurrentLine
+ while not self._RawData.IsEndOfFile() or self._RawData.NextLine:
+ if self._RawData.NextLine:
+ #==============================================================
+ # Have processed line in buffer
+ #==============================================================
+ Line = self._RawData.NextLine
+ HeadComments.extend(self._RawData.HeadComment)
+ TailComments.extend(self._RawData.TailComment)
+ self._RawData.ResetNext()
+ Comment = ''
+ FromBuf = True
+ else:
+ #==============================================================
+ # No line in buffer, read next line
+ #==============================================================
+ Line, Comment = CleanString(self._RawData.GetNextLine())
+ FromBuf = False
+ if Line:
+ if not FromBuf and CurObj and TailComments:
+ #==========================================================
+ # Set tail comments to previous statement if not empty.
+ #==========================================================
+ CurObj.SetTailComment(CurObj.GetTailComment()+TailComments)
+
+ if not FromBuf:
+ del TailComments[:]
+ CurComments = TailComments
+ Comments = []
+ if Comment:
+ Comments = [(Comment, self._RawData.LineIndex)]
+
+ #==============================================================
+ # Try if last char of line has backslash
+ #==============================================================
+ Line, Comments = self._TryBackSlash(Line, Comments)
+ CurComments.extend(Comments)
+
+ #==============================================================
+ # Macro found
+ #==============================================================
+ if Line.startswith('DEFINE '):
+ self._MacroParser(Line)
+ del HeadComments[:]
+ del TailComments[:]
+ CurComments = HeadComments
+ continue
+
+ if self._StopCurrentParsing(Line):
+ #==========================================================
+ # This line does not belong to this parse,
+ # Save it, can be used by next parse
+ #==========================================================
+ self._RawData.SetNext(Line, HeadComments, TailComments)
+ break
+
+ Obj = self._ParseItem()
+ ItemNum += 1
+ if Obj:
+ Obj.SetHeadComment(Obj.GetHeadComment()+HeadComments)
+ Obj.SetTailComment(Obj.GetTailComment()+TailComments)
+ del HeadComments[:]
+ del TailComments[:]
+ CurObj = Obj
+ else:
+ CurObj = None
+ else:
+ if id(CurComments) == id(TailComments):
+ #==========================================================
+ # Check if this comment belongs to tail comment
+ #==========================================================
+ if not self._TailCommentStrategy(Comment):
+ CurComments = HeadComments
+
+ if Comment:
+ CurComments.append(((Comment, self._RawData.LineIndex)))
+ else:
+ del CurComments[:]
+
+ if self._IsStatementRequired() and ItemNum == 0:
+ Logger.Error(
+ TOOL_NAME, FILE_PARSE_FAILURE,
+ File=self._RawData.Filename,
+ Line=Index,
+ ExtraData=ST.ERR_DECPARSE_STATEMENT_EMPTY % LineStr
+ )
+
+## _DecDefine
+# Parse define section
+#
+class _DecDefine(_DecBase):
+ def __init__(self, RawData):
+ _DecBase.__init__(self, RawData)
+ self.ItemObject = DecDefineObject(RawData.Filename)
+ self._LocalMacro = self._RawData.Macros
+ self._DefSecNum = 0
+
+ #
+ # Each field has a function to validate
+ #
+ self.DefineValidation = {
+ DT.TAB_DEC_DEFINES_DEC_SPECIFICATION : self._SetDecSpecification,
+ DT.TAB_DEC_DEFINES_PACKAGE_NAME : self._SetPackageName,
+ DT.TAB_DEC_DEFINES_PACKAGE_GUID : self._SetPackageGuid,
+ DT.TAB_DEC_DEFINES_PACKAGE_VERSION : self._SetPackageVersion,
+ DT.TAB_DEC_DEFINES_PKG_UNI_FILE : self._SetPackageUni,
+ }
+
+ def BlockStart(self):
+ self._DefSecNum += 1
+ if self._DefSecNum > 1:
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_MULTISEC)
+
+ ## CheckRequiredFields
+ #
+ # Check required fields: DEC_SPECIFICATION, PACKAGE_NAME
+ # PACKAGE_GUID, PACKAGE_VERSION
+ #
+ def CheckRequiredFields(self):
+ Ret = False
+ if self.ItemObject.GetPackageSpecification() == '':
+ Logger.Error(TOOL_NAME, FILE_PARSE_FAILURE, File=self._RawData.Filename,
+ ExtraData=ST.ERR_DECPARSE_DEFINE_REQUIRED % DT.TAB_DEC_DEFINES_DEC_SPECIFICATION)
+ elif self.ItemObject.GetPackageName() == '':
+ Logger.Error(TOOL_NAME, FILE_PARSE_FAILURE, File=self._RawData.Filename,
+ ExtraData=ST.ERR_DECPARSE_DEFINE_REQUIRED % DT.TAB_DEC_DEFINES_PACKAGE_NAME)
+ elif self.ItemObject.GetPackageGuid() == '':
+ Logger.Error(TOOL_NAME, FILE_PARSE_FAILURE, File=self._RawData.Filename,
+ ExtraData=ST.ERR_DECPARSE_DEFINE_REQUIRED % DT.TAB_DEC_DEFINES_PACKAGE_GUID)
+ elif self.ItemObject.GetPackageVersion() == '':
+ Logger.Error(TOOL_NAME, FILE_PARSE_FAILURE, File=self._RawData.Filename,
+ ExtraData=ST.ERR_DECPARSE_DEFINE_REQUIRED % DT.TAB_DEC_DEFINES_PACKAGE_VERSION)
+ else:
+ Ret = True
+ return Ret
+
+ def _ParseItem(self):
+ Line = self._RawData.CurrentLine
+ TokenList = GetSplitValueList(Line, DT.TAB_EQUAL_SPLIT, 1)
+ if TokenList[0] == DT.TAB_DEC_DEFINES_PKG_UNI_FILE:
+ self.DefineValidation[TokenList[0]](TokenList[1])
+ elif len(TokenList) < 2:
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_FORMAT)
+ elif TokenList[0] not in self.DefineValidation:
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_UNKNOWKEY % TokenList[0])
+ else:
+ self.DefineValidation[TokenList[0]](TokenList[1])
+
+ DefineItem = DecDefineItemObject()
+ DefineItem.Key = TokenList[0]
+ DefineItem.Value = TokenList[1]
+ self.ItemObject.AddItem(DefineItem, self._RawData.CurrentScope)
+ return DefineItem
+
+ def _SetDecSpecification(self, Token):
+ if self.ItemObject.GetPackageSpecification():
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_DEFINED % DT.TAB_DEC_DEFINES_DEC_SPECIFICATION)
+ if not IsValidToken('0[xX][0-9a-fA-F]{8}', Token):
+ if not IsValidDecVersionVal(Token):
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_SPEC)
+ self.ItemObject.SetPackageSpecification(Token)
+
+ def _SetPackageName(self, Token):
+ if self.ItemObject.GetPackageName():
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_DEFINED % DT.TAB_DEC_DEFINES_PACKAGE_NAME)
+ if not IsValidWord(Token):
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_PKGNAME)
+ self.ItemObject.SetPackageName(Token)
+
+ def _SetPackageGuid(self, Token):
+ if self.ItemObject.GetPackageGuid():
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_DEFINED % DT.TAB_DEC_DEFINES_PACKAGE_GUID)
+ if not CheckGuidRegFormat(Token):
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_PKGGUID)
+ self.ItemObject.SetPackageGuid(Token)
+
+ def _SetPackageVersion(self, Token):
+ if self.ItemObject.GetPackageVersion():
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_DEFINED % DT.TAB_DEC_DEFINES_PACKAGE_VERSION)
+ if not IsValidToken(VERSION_PATTERN, Token):
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_PKGVERSION)
+ else:
+ if not DT.TAB_SPLIT in Token:
+ Token = Token + '.0'
+ self.ItemObject.SetPackageVersion(Token)
+
+ def _SetPackageUni(self, Token):
+ if self.ItemObject.GetPackageUniFile():
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_DEFINED % DT.TAB_DEC_DEFINES_PKG_UNI_FILE)
+ self.ItemObject.SetPackageUniFile(Token)
+
+## _DecInclude
+#
+# Parse include section
+#
+class _DecInclude(_DecBase):
+ def __init__(self, RawData):
+ _DecBase.__init__(self, RawData)
+ self.ItemObject = DecIncludeObject(RawData.Filename)
+
+ def _ParseItem(self):
+ Line = self._RawData.CurrentLine
+
+ if not IsValidPath(Line, self._RawData.PackagePath):
+ self._LoggerError(ST.ERR_DECPARSE_INCLUDE % Line)
+
+ Item = DecIncludeItemObject(StripRoot(self._RawData.PackagePath, Line), self._RawData.PackagePath)
+ self.ItemObject.AddItem(Item, self._RawData.CurrentScope)
+ return Item
+
+## _DecLibraryclass
+#
+# Parse library class section
+#
+class _DecLibraryclass(_DecBase):
+ def __init__(self, RawData):
+ _DecBase.__init__(self, RawData)
+ self.ItemObject = DecLibraryclassObject(RawData.Filename)
+
+ def _ParseItem(self):
+ Line = self._RawData.CurrentLine
+ TokenList = GetSplitValueList(Line, DT.TAB_VALUE_SPLIT)
+ if len(TokenList) != 2:
+ self._LoggerError(ST.ERR_DECPARSE_LIBCLASS_SPLIT)
+ if TokenList[0] == '' or TokenList[1] == '':
+ self._LoggerError(ST.ERR_DECPARSE_LIBCLASS_EMPTY)
+ if not IsValidToken('[A-Z][0-9A-Za-z]*', TokenList[0]):
+ self._LoggerError(ST.ERR_DECPARSE_LIBCLASS_LIB)
+
+ self._CheckReDefine(TokenList[0])
+
+ Value = TokenList[1]
+ #
+ # Must end with .h
+ #
+ if not Value.endswith('.h'):
+ self._LoggerError(ST.ERR_DECPARSE_LIBCLASS_PATH_EXT)
+
+ #
+ # Path must be existed
+ #
+ if not IsValidPath(Value, self._RawData.PackagePath):
+ self._LoggerError(ST.ERR_DECPARSE_INCLUDE % Value)
+
+ Item = DecLibraryclassItemObject(TokenList[0], StripRoot(self._RawData.PackagePath, Value),
+ self._RawData.PackagePath)
+ self.ItemObject.AddItem(Item, self._RawData.CurrentScope)
+ return Item
+
+## _DecPcd
+#
+# Parse PCD section
+#
+class _DecPcd(_DecBase):
+ def __init__(self, RawData):
+ _DecBase.__init__(self, RawData)
+ self.ItemObject = DecPcdObject(RawData.Filename)
+ #
+ # Used to check duplicate token
+ # Key is token space and token number (integer), value is C name
+ #
+ self.TokenMap = {}
+
+ def _ParseItem(self):
+ Line = self._RawData.CurrentLine
+ TokenList = Line.split(DT.TAB_VALUE_SPLIT)
+ if len(TokenList) < 4:
+ self._LoggerError(ST.ERR_DECPARSE_PCD_SPLIT)
+
+ #
+ # Token space guid C name
+ #
+ PcdName = GetSplitValueList(TokenList[0], DT.TAB_SPLIT)
+ if len(PcdName) != 2 or PcdName[0] == '' or PcdName[1] == '':
+ self._LoggerError(ST.ERR_DECPARSE_PCD_NAME)
+
+ Guid = PcdName[0]
+ if not IsValidToken(CVAR_PATTERN, Guid):
+ self._LoggerError(ST.ERR_DECPARSE_PCD_CVAR_GUID)
+
+ #
+ # PCD C name
+ #
+ CName = PcdName[1]
+ if not IsValidToken(CVAR_PATTERN, CName):
+ self._LoggerError(ST.ERR_DECPARSE_PCD_CVAR_PCDCNAME)
+
+ self._CheckReDefine(Guid + DT.TAB_SPLIT + CName)
+
+ #
+ # Default value, may be C array, string or number
+ #
+ Data = DT.TAB_VALUE_SPLIT.join(TokenList[1:-2]).strip()
+
+ #
+ # PCD data type
+ #
+ DataType = TokenList[-2].strip()
+ Valid, Cause = IsValidPcdDatum(DataType, Data)
+ if not Valid:
+ self._LoggerError(Cause)
+ PcdType = self._RawData.CurrentScope[0][0]
+ if PcdType == DT.TAB_PCDS_FEATURE_FLAG_NULL.upper() and DataType != 'BOOLEAN':
+ self._LoggerError(ST.ERR_DECPARSE_PCD_FEATUREFLAG)
+ #
+ # Token value is the last element in list.
+ #
+ Token = TokenList[-1].strip()
+ if not IsValidToken(PCD_TOKEN_PATTERN, Token):
+ self._LoggerError(ST.ERR_DECPARSE_PCD_TOKEN % Token)
+ elif not Token.startswith('0x') and not Token.startswith('0X'):
+ if int(Token) > 4294967295:
+ self._LoggerError(ST.ERR_DECPARSE_PCD_TOKEN_INT % Token)
+ Token = '0x%x' % int(Token)
+
+ IntToken = int(Token, 0)
+ if (Guid, IntToken) in self.TokenMap:
+ if self.TokenMap[Guid, IntToken] != CName:
+ self._LoggerError(ST.ERR_DECPARSE_PCD_TOKEN_UNIQUE%(Token))
+ else:
+ self.TokenMap[Guid, IntToken] = CName
+
+ Item = DecPcdItemObject(Guid, CName, Data, DataType, Token)
+ self.ItemObject.AddItem(Item, self._RawData.CurrentScope)
+ return Item
+
+## _DecGuid
+#
+# Parse GUID, PPI, Protocol section
+#
+class _DecGuid(_DecBase):
+ def __init__(self, RawData):
+ _DecBase.__init__(self, RawData)
+ self.GuidObj = DecGuidObject(RawData.Filename)
+ self.PpiObj = DecPpiObject(RawData.Filename)
+ self.ProtocolObj = DecProtocolObject(RawData.Filename)
+ self.ObjectDict = \
+ {
+ DT.TAB_GUIDS.upper() : self.GuidObj,
+ DT.TAB_PPIS.upper() : self.PpiObj,
+ DT.TAB_PROTOCOLS.upper() : self.ProtocolObj
+ }
+
+ def GetDataObject(self):
+ if self._RawData.CurrentScope:
+ return self.ObjectDict[self._RawData.CurrentScope[0][0]]
+ return None
+
+ def GetGuidObject(self):
+ return self.GuidObj
+
+ def GetPpiObject(self):
+ return self.PpiObj
+
+ def GetProtocolObject(self):
+ return self.ProtocolObj
+
+ def _ParseItem(self):
+ Line = self._RawData.CurrentLine
+ TokenList = GetSplitValueList(Line, DT.TAB_EQUAL_SPLIT, 1)
+ if len(TokenList) < 2:
+ self._LoggerError(ST.ERR_DECPARSE_CGUID)
+ if TokenList[0] == '':
+ self._LoggerError(ST.ERR_DECPARSE_CGUID_NAME)
+ if TokenList[1] == '':
+ self._LoggerError(ST.ERR_DECPARSE_CGUID_GUID)
+ if not IsValidToken(CVAR_PATTERN, TokenList[0]):
+ self._LoggerError(ST.ERR_DECPARSE_PCD_CVAR_GUID)
+
+ self._CheckReDefine(TokenList[0])
+
+ if TokenList[1][0] != '{':
+ if not CheckGuidRegFormat(TokenList[1]):
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_PKGGUID)
+ GuidString = TokenList[1]
+ else:
+ #
+ # Convert C format GUID to GUID string and Simple error check
+ #
+ GuidString = GuidStructureStringToGuidString(TokenList[1])
+ if TokenList[1][0] != '{' or TokenList[1][-1] != '}' or GuidString == '':
+ self._LoggerError(ST.ERR_DECPARSE_CGUID_GUIDFORMAT)
+
+ #
+ # Check C format GUID
+ #
+ if not IsValidCFormatGuid(TokenList[1]):
+ self._LoggerError(ST.ERR_DECPARSE_CGUID_GUIDFORMAT)
+
+ Item = DecGuidItemObject(TokenList[0], TokenList[1], GuidString)
+ ItemObject = self.ObjectDict[self._RawData.CurrentScope[0][0]]
+ ItemObject.AddItem(Item, self._RawData.CurrentScope)
+ return Item
+
+## _DecUserExtension
+#
+# Parse user extension section
+#
+class _DecUserExtension(_DecBase):
+ def __init__(self, RawData):
+ _DecBase.__init__(self, RawData)
+ self.ItemObject = DecUserExtensionObject(RawData.Filename)
+ self._Headers = []
+ self._CurItems = []
+
+ def BlockStart(self):
+ self._CurItems = []
+ for Header in self._RawData.CurrentScope:
+ if Header in self._Headers:
+ self._LoggerError(ST.ERR_DECPARSE_UE_DUPLICATE)
+ else:
+ self._Headers.append(Header)
+
+ for Item in self._CurItems:
+ if Item.UserId == Header[1] and Item.IdString == Header[2]:
+ Item.ArchAndModuleType.append(Header[3])
+ break
+ else:
+ Item = DecUserExtensionItemObject()
+ Item.UserId = Header[1]
+ Item.IdString = Header[2]
+ Item.ArchAndModuleType.append(Header[3])
+ self._CurItems.append(Item)
+ self.ItemObject.AddItem(Item, None)
+ self._LocalMacro = {}
+
+ def _ParseItem(self):
+ Line = self._RawData.CurrentLine
+ Item = None
+ for Item in self._CurItems:
+ if Item.UserString:
+ Item.UserString = '\n'.join([Item.UserString, Line])
+ else:
+ Item.UserString = Line
+ return Item
+
+## Dec
+#
+# Top dec parser
+#
+class Dec(_DecBase, _DecComments):
+ def __init__(self, DecFile, Parse = True):
+ try:
+ Content = ConvertSpecialChar(open(DecFile, 'r').readlines())
+ except BaseException:
+ Logger.Error(TOOL_NAME, FILE_OPEN_FAILURE, File=DecFile,
+ ExtraData=ST.ERR_DECPARSE_FILEOPEN % DecFile)
+
+ #
+ # Pre-parser for Private section
+ #
+ self._Private = ''
+ __IsFoundPrivate = False
+ NewContent = []
+ for Line in Content:
+ Line = Line.strip()
+ if Line.startswith(DT.TAB_SECTION_START) and Line.endswith(DT.TAB_PRIVATE + DT.TAB_SECTION_END):
+ __IsFoundPrivate = True
+ if Line.startswith(DT.TAB_SECTION_START) and Line.endswith(DT.TAB_SECTION_END)\
+ and not Line.endswith(DT.TAB_PRIVATE + DT.TAB_SECTION_END):
+ __IsFoundPrivate = False
+ if __IsFoundPrivate:
+ self._Private += Line + '\r'
+ if not __IsFoundPrivate:
+ NewContent.append(Line + '\r')
+
+ RawData = FileContent(DecFile, NewContent)
+
+ _DecComments.__init__(self)
+ _DecBase.__init__(self, RawData)
+
+ self.BinaryHeadComment = []
+ self.PcdErrorCommentDict = {}
+
+ self._Define = _DecDefine(RawData)
+ self._Include = _DecInclude(RawData)
+ self._Guid = _DecGuid(RawData)
+ self._LibClass = _DecLibraryclass(RawData)
+ self._Pcd = _DecPcd(RawData)
+ self._UserEx = _DecUserExtension(RawData)
+
+ #
+ # DEC file supported data types (one type per section)
+ #
+ self._SectionParser = {
+ DT.TAB_DEC_DEFINES.upper() : self._Define,
+ DT.TAB_INCLUDES.upper() : self._Include,
+ DT.TAB_LIBRARY_CLASSES.upper() : self._LibClass,
+ DT.TAB_GUIDS.upper() : self._Guid,
+ DT.TAB_PPIS.upper() : self._Guid,
+ DT.TAB_PROTOCOLS.upper() : self._Guid,
+ DT.TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : self._Pcd,
+ DT.TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : self._Pcd,
+ DT.TAB_PCDS_FEATURE_FLAG_NULL.upper() : self._Pcd,
+ DT.TAB_PCDS_DYNAMIC_NULL.upper() : self._Pcd,
+ DT.TAB_PCDS_DYNAMIC_EX_NULL.upper() : self._Pcd,
+ DT.TAB_USER_EXTENSIONS.upper() : self._UserEx
+ }
+
+ if Parse:
+ self.ParseDecComment()
+ self.Parse()
+ #
+ # Parsing done, check required fields
+ #
+ self.CheckRequiredFields()
+
+ def CheckRequiredFields(self):
+ for SectionParser in self._SectionParser.values():
+ if not SectionParser.CheckRequiredFields():
+ return False
+ return True
+
+ ##
+ # Parse DEC file
+ #
+ def ParseDecComment(self):
+ IsFileHeader = False
+ IsBinaryHeader = False
+ FileHeaderLineIndex = -1
+ BinaryHeaderLineIndex = -1
+ TokenSpaceGuidCName = ''
+
+ #
+ # Parse PCD error comment section
+ #
+ while not self._RawData.IsEndOfFile():
+ self._RawData.CurrentLine = self._RawData.GetNextLine()
+ if self._RawData.CurrentLine.startswith(DT.TAB_COMMENT_SPLIT) and \
+ DT.TAB_SECTION_START in self._RawData.CurrentLine and \
+ DT.TAB_SECTION_END in self._RawData.CurrentLine:
+ self._RawData.CurrentLine = self._RawData.CurrentLine.replace(DT.TAB_COMMENT_SPLIT, '').strip()
+
+ if self._RawData.CurrentLine[0] == DT.TAB_SECTION_START and \
+ self._RawData.CurrentLine[-1] == DT.TAB_SECTION_END:
+ RawSection = self._RawData.CurrentLine[1:-1].strip()
+ if RawSection.upper().startswith(DT.TAB_PCD_ERROR.upper()+'.'):
+ TokenSpaceGuidCName = RawSection.split(DT.TAB_PCD_ERROR+'.')[1].strip()
+ continue
+
+ if TokenSpaceGuidCName and self._RawData.CurrentLine.startswith(DT.TAB_COMMENT_SPLIT):
+ self._RawData.CurrentLine = self._RawData.CurrentLine.replace(DT.TAB_COMMENT_SPLIT, '').strip()
+ if self._RawData.CurrentLine != '':
+ if DT.TAB_VALUE_SPLIT not in self._RawData.CurrentLine:
+ self._LoggerError(ST.ERR_DECPARSE_PCDERRORMSG_MISS_VALUE_SPLIT)
+
+ PcdErrorNumber, PcdErrorMsg = GetSplitValueList(self._RawData.CurrentLine, DT.TAB_VALUE_SPLIT, 1)
+ PcdErrorNumber = ParsePcdErrorCode(PcdErrorNumber, self._RawData.Filename, self._RawData.LineIndex)
+ if not PcdErrorMsg.strip():
+ self._LoggerError(ST.ERR_DECPARSE_PCD_MISS_ERRORMSG)
+
+ self.PcdErrorCommentDict[(TokenSpaceGuidCName, PcdErrorNumber)] = PcdErrorMsg.strip()
+ else:
+ TokenSpaceGuidCName = ''
+
+ self._RawData.LineIndex = 0
+ self._RawData.CurrentLine = ''
+ self._RawData.NextLine = ''
+
+ while not self._RawData.IsEndOfFile():
+ Line, Comment = CleanString(self._RawData.GetNextLine())
+
+ #
+ # Header must be pure comment
+ #
+ if Line != '':
+ self._RawData.UndoNextLine()
+ break
+
+ if Comment and Comment.startswith(DT.TAB_SPECIAL_COMMENT) and Comment.find(DT.TAB_HEADER_COMMENT) > 0 \
+ and not Comment[2:Comment.find(DT.TAB_HEADER_COMMENT)].strip():
+ IsFileHeader = True
+ IsBinaryHeader = False
+ FileHeaderLineIndex = self._RawData.LineIndex
+
+ #
+ # Get license information before '@file'
+ #
+ if not IsFileHeader and not IsBinaryHeader and Comment and Comment.startswith(DT.TAB_COMMENT_SPLIT) and \
+ DT.TAB_BINARY_HEADER_COMMENT not in Comment:
+ self._HeadComment.append((Comment, self._RawData.LineIndex))
+
+ if Comment and IsFileHeader and \
+ not(Comment.startswith(DT.TAB_SPECIAL_COMMENT) \
+ and Comment.find(DT.TAB_BINARY_HEADER_COMMENT) > 0):
+ self._HeadComment.append((Comment, self._RawData.LineIndex))
+ #
+ # Double '#' indicates end of header comments
+ #
+ if (not Comment or Comment == DT.TAB_SPECIAL_COMMENT) and IsFileHeader:
+ IsFileHeader = False
+ continue
+
+ if Comment and Comment.startswith(DT.TAB_SPECIAL_COMMENT) \
+ and Comment.find(DT.TAB_BINARY_HEADER_COMMENT) > 0:
+ IsBinaryHeader = True
+ IsFileHeader = False
+ BinaryHeaderLineIndex = self._RawData.LineIndex
+
+ if Comment and IsBinaryHeader:
+ self.BinaryHeadComment.append((Comment, self._RawData.LineIndex))
+ #
+ # Double '#' indicates end of header comments
+ #
+ if (not Comment or Comment == DT.TAB_SPECIAL_COMMENT) and IsBinaryHeader:
+ IsBinaryHeader = False
+ break
+
+ if FileHeaderLineIndex > -1 and not IsFileHeader and not IsBinaryHeader:
+ break
+
+ if FileHeaderLineIndex > BinaryHeaderLineIndex and FileHeaderLineIndex > -1 and BinaryHeaderLineIndex > -1:
+ self._LoggerError(ST.ERR_BINARY_HEADER_ORDER)
+
+ if FileHeaderLineIndex == -1:
+# self._LoggerError(ST.ERR_NO_SOURCE_HEADER)
+ Logger.Error(TOOL_NAME, FORMAT_INVALID,
+ ST.ERR_NO_SOURCE_HEADER,
+ File=self._RawData.Filename)
+ return
+
+ def _StopCurrentParsing(self, Line):
+ return False
+
+ def _ParseItem(self):
+ self._SectionHeaderParser()
+ if len(self._RawData.CurrentScope) == 0:
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_EMPTY)
+ SectionObj = self._SectionParser[self._RawData.CurrentScope[0][0]]
+ SectionObj.BlockStart()
+ SectionObj.Parse()
+ return SectionObj.GetDataObject()
+
+ def _UserExtentionSectionParser(self):
+ self._RawData.CurrentScope = []
+ ArchList = set()
+ Section = self._RawData.CurrentLine[1:-1]
+ Par = ParserHelper(Section, self._RawData.Filename)
+ while not Par.End():
+ #
+ # User extention
+ #
+ Token = Par.GetToken()
+ if Token.upper() != DT.TAB_USER_EXTENSIONS.upper():
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_UE)
+ UserExtension = Token.upper()
+ Par.AssertChar(DT.TAB_SPLIT, ST.ERR_DECPARSE_SECTION_UE, self._RawData.LineIndex)
+
+ #
+ # UserID
+ #
+ Token = Par.GetToken()
+ if not IsValidUserId(Token):
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_UE_USERID)
+ UserId = Token
+ Par.AssertChar(DT.TAB_SPLIT, ST.ERR_DECPARSE_SECTION_UE, self._RawData.LineIndex)
+ #
+ # IdString
+ #
+ Token = Par.GetToken()
+ if not IsValidIdString(Token):
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_UE_IDSTRING)
+ IdString = Token
+ Arch = 'COMMON'
+ if Par.Expect(DT.TAB_SPLIT):
+ Token = Par.GetToken()
+ Arch = Token.upper()
+ if not IsValidArch(Arch):
+ self._LoggerError(ST.ERR_DECPARSE_ARCH)
+ ArchList.add(Arch)
+ if [UserExtension, UserId, IdString, Arch] not in \
+ self._RawData.CurrentScope:
+ self._RawData.CurrentScope.append(
+ [UserExtension, UserId, IdString, Arch]
+ )
+ if not Par.Expect(DT.TAB_COMMA_SPLIT):
+ break
+ elif Par.End():
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_COMMA)
+ Par.AssertEnd(ST.ERR_DECPARSE_SECTION_UE, self._RawData.LineIndex)
+ if 'COMMON' in ArchList and len(ArchList) > 1:
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_COMMON)
+
+ ## Section header parser
+ #
+ # The section header is always in following format:
+ #
+ # [section_name.arch<.platform|module_type>]
+ #
+ def _SectionHeaderParser(self):
+ if self._RawData.CurrentLine[0] != DT.TAB_SECTION_START or self._RawData.CurrentLine[-1] != DT.TAB_SECTION_END:
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_IDENTIFY)
+
+ RawSection = self._RawData.CurrentLine[1:-1].strip().upper()
+ #
+ # Check defines section which is only allowed to occur once and
+ # no arch can be followed
+ #
+ if RawSection.startswith(DT.TAB_DEC_DEFINES.upper()):
+ if RawSection != DT.TAB_DEC_DEFINES.upper():
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_SECNAME)
+ #
+ # Check user extension section
+ #
+ if RawSection.startswith(DT.TAB_USER_EXTENSIONS.upper()):
+ return self._UserExtentionSectionParser()
+ self._RawData.CurrentScope = []
+ SectionNames = []
+ ArchList = set()
+ for Item in GetSplitValueList(RawSection, DT.TAB_COMMA_SPLIT):
+ if Item == '':
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_SUBEMPTY % self._RawData.CurrentLine)
+
+ ItemList = GetSplitValueList(Item, DT.TAB_SPLIT)
+ #
+ # different types of PCD are permissible in one section
+ #
+ SectionName = ItemList[0]
+ if SectionName not in self._SectionParser:
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_UNKNOW % SectionName)
+ if SectionName not in SectionNames:
+ SectionNames.append(SectionName)
+ #
+ # In DEC specification, all section headers have at most two part:
+ # SectionName.Arch except UserExtension
+ #
+ if len(ItemList) > 2:
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_SUBTOOMANY % Item)
+
+ if DT.TAB_PCDS_FEATURE_FLAG_NULL.upper() in SectionNames and len(SectionNames) > 1:
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_FEATUREFLAG % DT.TAB_PCDS_FEATURE_FLAG_NULL)
+ #
+ # S1 is always Arch
+ #
+ if len(ItemList) > 1:
+ Str1 = ItemList[1]
+ if not IsValidArch(Str1):
+ self._LoggerError(ST.ERR_DECPARSE_ARCH)
+ else:
+ Str1 = 'COMMON'
+ ArchList.add(Str1)
+
+ if [SectionName, Str1] not in self._RawData.CurrentScope:
+ self._RawData.CurrentScope.append([SectionName, Str1])
+ #
+ # 'COMMON' must not be used with specific ARCHs at the same section
+ #
+ if 'COMMON' in ArchList and len(ArchList) > 1:
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_COMMON)
+ if len(SectionNames) == 0:
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_SUBEMPTY % self._RawData.CurrentLine)
+ if len(SectionNames) != 1:
+ for Sec in SectionNames:
+ if not Sec.startswith(DT.TAB_PCDS.upper()):
+ self._LoggerError(ST.ERR_DECPARSE_SECTION_NAME % str(SectionNames))
+
+ def GetDefineSectionMacro(self):
+ return self._Define.GetLocalMacro()
+ def GetDefineSectionObject(self):
+ return self._Define.GetDataObject()
+ def GetIncludeSectionObject(self):
+ return self._Include.GetDataObject()
+ def GetGuidSectionObject(self):
+ return self._Guid.GetGuidObject()
+ def GetProtocolSectionObject(self):
+ return self._Guid.GetProtocolObject()
+ def GetPpiSectionObject(self):
+ return self._Guid.GetPpiObject()
+ def GetLibraryClassSectionObject(self):
+ return self._LibClass.GetDataObject()
+ def GetPcdSectionObject(self):
+ return self._Pcd.GetDataObject()
+ def GetUserExtensionSectionObject(self):
+ return self._UserEx.GetDataObject()
+ def GetPackageSpecification(self):
+ return self._Define.GetDataObject().GetPackageSpecification()
+ def GetPackageName(self):
+ return self._Define.GetDataObject().GetPackageName()
+ def GetPackageGuid(self):
+ return self._Define.GetDataObject().GetPackageGuid()
+ def GetPackageVersion(self):
+ return self._Define.GetDataObject().GetPackageVersion()
+ def GetPackageUniFile(self):
+ return self._Define.GetDataObject().GetPackageUniFile()
+ def GetPrivateSections(self):
+ return self._Private
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/DecParserMisc.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/DecParserMisc.py
new file mode 100644
index 000000000..27990467d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/DecParserMisc.py
@@ -0,0 +1,364 @@
+## @file
+# This file is used to define helper class and function for DEC parser
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+'''
+DecParserMisc
+'''
+
+## Import modules
+#
+import os
+import Logger.Log as Logger
+from Logger.ToolError import FILE_PARSE_FAILURE
+from Logger import StringTable as ST
+from Library.DataType import TAB_COMMENT_SPLIT
+from Library.DataType import TAB_COMMENT_EDK1_SPLIT
+from Library.ExpressionValidate import IsValidBareCString
+from Library.ParserValidate import IsValidCFormatGuid
+from Library.ExpressionValidate import IsValidFeatureFlagExp
+from Library.ExpressionValidate import IsValidLogicalExpr
+from Library.ExpressionValidate import IsValidStringTest
+from Library.Misc import CheckGuidRegFormat
+
+TOOL_NAME = 'DecParser'
+VERSION_PATTERN = '[0-9]+(\.[0-9]+)?'
+CVAR_PATTERN = '[_a-zA-Z][a-zA-Z0-9_]*'
+PCD_TOKEN_PATTERN = '(0[xX]0*[a-fA-F0-9]{1,8})|([0-9]+)'
+MACRO_PATTERN = '[A-Z][_A-Z0-9]*'
+
+## FileContent
+# Class to hold DEC file information
+#
+class FileContent:
+ def __init__(self, Filename, FileContent2):
+ self.Filename = Filename
+ self.PackagePath, self.PackageFile = os.path.split(Filename)
+ self.LineIndex = 0
+ self.CurrentLine = ''
+ self.NextLine = ''
+ self.HeadComment = []
+ self.TailComment = []
+ self.CurrentScope = None
+ self.Content = FileContent2
+ self.Macros = {}
+ self.FileLines = len(FileContent2)
+
+ def GetNextLine(self):
+ if self.LineIndex >= self.FileLines:
+ return ''
+ Line = self.Content[self.LineIndex]
+ self.LineIndex += 1
+ return Line
+
+ def UndoNextLine(self):
+ if self.LineIndex > 0:
+ self.LineIndex -= 1
+
+ def ResetNext(self):
+ self.HeadComment = []
+ self.TailComment = []
+ self.NextLine = ''
+
+ def SetNext(self, Line, HeadComment, TailComment):
+ self.NextLine = Line
+ self.HeadComment = HeadComment
+ self.TailComment = TailComment
+
+ def IsEndOfFile(self):
+ return self.LineIndex >= self.FileLines
+
+
+## StripRoot
+#
+# Strip root path
+#
+# @param Root: Root must be absolute path
+# @param Path: Path to be stripped
+#
+def StripRoot(Root, Path):
+ OrigPath = Path
+ Root = os.path.normpath(Root)
+ Path = os.path.normpath(Path)
+ if not os.path.isabs(Root):
+ return OrigPath
+ if Path.startswith(Root):
+ Path = Path[len(Root):]
+ if Path and Path[0] == os.sep:
+ Path = Path[1:]
+ return Path
+ return OrigPath
+
+## CleanString
+#
+# Split comments in a string
+# Remove spaces
+#
+# @param Line: The string to be cleaned
+# @param CommentCharacter: Comment char, used to ignore comment content,
+# default is DataType.TAB_COMMENT_SPLIT
+#
+def CleanString(Line, CommentCharacter=TAB_COMMENT_SPLIT, \
+ AllowCppStyleComment=False):
+ #
+ # remove whitespace
+ #
+ Line = Line.strip()
+ #
+ # Replace EDK1's comment character
+ #
+ if AllowCppStyleComment:
+ Line = Line.replace(TAB_COMMENT_EDK1_SPLIT, CommentCharacter)
+ #
+ # separate comments and statements
+ #
+ Comment = ''
+ InQuote = False
+ for Index in range(0, len(Line)):
+ if Line[Index] == '"':
+ InQuote = not InQuote
+ continue
+ if Line[Index] == CommentCharacter and not InQuote:
+ Comment = Line[Index:].strip()
+ Line = Line[0:Index].strip()
+ break
+
+ return Line, Comment
+
+
+## IsValidNumValUint8
+#
+# Check if Token is NumValUint8: <NumValUint8> ::= {<ShortNum>} {<UINT8>} {<Expression>}
+#
+# @param Token: Token to be checked
+#
+def IsValidNumValUint8(Token):
+ Valid = True
+ Cause = ""
+ TokenValue = None
+ Token = Token.strip()
+ if Token.lower().startswith('0x'):
+ Base = 16
+ else:
+ Base = 10
+ try:
+ TokenValue = int(Token, Base)
+ except BaseException:
+ Valid, Cause = IsValidLogicalExpr(Token, True)
+ if Cause:
+ pass
+ if not Valid:
+ return False
+ if TokenValue and (TokenValue < 0 or TokenValue > 0xFF):
+ return False
+ else:
+ return True
+
+## IsValidNList
+#
+# Check if Value has the format of <NumValUint8> ["," <NumValUint8>]{0,}
+# <NumValUint8> ::= {<ShortNum>} {<UINT8>} {<Expression>}
+#
+# @param Value: Value to be checked
+#
+def IsValidNList(Value):
+ Par = ParserHelper(Value)
+ if Par.End():
+ return False
+ while not Par.End():
+ Token = Par.GetToken(',')
+ if not IsValidNumValUint8(Token):
+ return False
+ if Par.Expect(','):
+ if Par.End():
+ return False
+ continue
+ else:
+ break
+ return Par.End()
+
+## IsValidCArray
+#
+# check Array is valid
+#
+# @param Array: The input Array
+#
+def IsValidCArray(Array):
+ Par = ParserHelper(Array)
+ if not Par.Expect('{'):
+ return False
+ if Par.End():
+ return False
+ while not Par.End():
+ Token = Par.GetToken(',}')
+ #
+ # ShortNum, UINT8, Expression
+ #
+ if not IsValidNumValUint8(Token):
+ return False
+ if Par.Expect(','):
+ if Par.End():
+ return False
+ continue
+ elif Par.Expect('}'):
+ #
+ # End of C array
+ #
+ break
+ else:
+ return False
+ return Par.End()
+
+## IsValidPcdDatum
+#
+# check PcdDatum is valid
+#
+# @param Type: The pcd Type
+# @param Value: The pcd Value
+#
+def IsValidPcdDatum(Type, Value):
+ if not Value:
+ return False, ST.ERR_DECPARSE_PCD_VALUE_EMPTY
+ Valid = True
+ Cause = ""
+ if Type not in ["UINT8", "UINT16", "UINT32", "UINT64", "VOID*", "BOOLEAN"]:
+ return False, ST.ERR_DECPARSE_PCD_TYPE
+ if Type == "VOID*":
+ if not ((Value.startswith('L"') or Value.startswith('"') and \
+ Value.endswith('"'))
+ or (IsValidCArray(Value)) or (IsValidCFormatGuid(Value)) \
+ or (IsValidNList(Value)) or (CheckGuidRegFormat(Value))
+ ):
+ return False, ST.ERR_DECPARSE_PCD_VOID % (Value, Type)
+ RealString = Value[Value.find('"') + 1 :-1]
+ if RealString:
+ if not IsValidBareCString(RealString):
+ return False, ST.ERR_DECPARSE_PCD_VOID % (Value, Type)
+ elif Type == 'BOOLEAN':
+ if Value in ['TRUE', 'FALSE', 'true', 'false', 'True', 'False',
+ '0x1', '0x01', '1', '0x0', '0x00', '0']:
+ return True, ""
+ Valid, Cause = IsValidStringTest(Value, True)
+ if not Valid:
+ Valid, Cause = IsValidFeatureFlagExp(Value, True)
+ if not Valid:
+ return False, Cause
+ else:
+ if Value and (Value[0] == '-' or Value[0] == '+'):
+ return False, ST.ERR_DECPARSE_PCD_INT_NEGTIVE % (Value, Type)
+ try:
+ StrVal = Value
+ if Value and not Value.startswith('0x') \
+ and not Value.startswith('0X'):
+ Value = Value.lstrip('0')
+ if not Value:
+ return True, ""
+ Value = int(Value, 0)
+ MAX_VAL_TYPE = {"BOOLEAN": 0x01, 'UINT8': 0xFF, 'UINT16': 0xFFFF, 'UINT32': 0xFFFFFFFF,
+ 'UINT64': 0xFFFFFFFFFFFFFFFF}
+ if Value > MAX_VAL_TYPE[Type]:
+ return False, ST.ERR_DECPARSE_PCD_INT_EXCEED % (StrVal, Type)
+ except BaseException:
+ Valid, Cause = IsValidLogicalExpr(Value, True)
+ if not Valid:
+ return False, Cause
+
+ return True, ""
+
+## ParserHelper
+#
+class ParserHelper:
+ def __init__(self, String, File=''):
+ self._String = String
+ self._StrLen = len(String)
+ self._Index = 0
+ self._File = File
+
+ ## End
+ #
+ # End
+ #
+ def End(self):
+ self.__SkipWhitespace()
+ return self._Index >= self._StrLen
+
+ ## __SkipWhitespace
+ #
+ # Skip whitespace
+ #
+ def __SkipWhitespace(self):
+ for Char in self._String[self._Index:]:
+ if Char not in ' \t':
+ break
+ self._Index += 1
+
+ ## Expect
+ #
+ # Expect char in string
+ #
+ # @param ExpectChar: char expected in index of string
+ #
+ def Expect(self, ExpectChar):
+ self.__SkipWhitespace()
+ for Char in self._String[self._Index:]:
+ if Char != ExpectChar:
+ return False
+ else:
+ self._Index += 1
+ return True
+ #
+ # Index out of bound of String
+ #
+ return False
+
+ ## GetToken
+ #
+ # Get token until encounter StopChar, front whitespace is consumed
+ #
+ # @param StopChar: Get token until encounter char in StopChar
+ # @param StkipPair: Only can be ' or ", StopChar in SkipPair are skipped
+ #
+ def GetToken(self, StopChar='.,|\t ', SkipPair='"'):
+ self.__SkipWhitespace()
+ PreIndex = self._Index
+ InQuote = False
+ LastChar = ''
+ for Char in self._String[self._Index:]:
+ if Char == SkipPair and LastChar != '\\':
+ InQuote = not InQuote
+ if Char in StopChar and not InQuote:
+ break
+ self._Index += 1
+ if Char == '\\' and LastChar == '\\':
+ LastChar = ''
+ else:
+ LastChar = Char
+ return self._String[PreIndex:self._Index]
+
+ ## AssertChar
+ #
+ # Assert char at current index of string is AssertChar, or will report
+ # error message
+ #
+ # @param AssertChar: AssertChar
+ # @param ErrorString: ErrorString
+ # @param ErrorLineNum: ErrorLineNum
+ #
+ def AssertChar(self, AssertChar, ErrorString, ErrorLineNum):
+ if not self.Expect(AssertChar):
+ Logger.Error(TOOL_NAME, FILE_PARSE_FAILURE, File=self._File,
+ Line=ErrorLineNum, ExtraData=ErrorString)
+
+ ## AssertEnd
+ #
+ # @param ErrorString: ErrorString
+ # @param ErrorLineNum: ErrorLineNum
+ #
+ def AssertEnd(self, ErrorString, ErrorLineNum):
+ self.__SkipWhitespace()
+ if self._Index != self._StrLen:
+ Logger.Error(TOOL_NAME, FILE_PARSE_FAILURE, File=self._File,
+ Line=ErrorLineNum, ExtraData=ErrorString)
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py
new file mode 100644
index 000000000..992b60912
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py
@@ -0,0 +1,283 @@
+## @file
+# This file is used to provide method for process AsBuilt INF file. It will consumed by InfParser
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+'''
+InfAsBuiltProcess
+'''
+## Import modules
+#
+
+import os
+import re
+from Library import GlobalData
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger import ToolError
+
+from Library.StringUtils import GetSplitValueList
+from Library.Misc import GetHelpStringByRemoveHashKey
+from Library.Misc import ValidFile
+from Library.Misc import ProcessLineExtender
+from Library.ParserValidate import IsValidPath
+from Library.Parsing import MacroParser
+from Parser.InfParserMisc import InfExpandMacro
+
+from Library import DataType as DT
+
+## GetLibInstanceInfo
+#
+# Get the information from Library Instance INF file.
+#
+# @param string. A string start with # and followed by INF file path
+# @param WorkSpace. The WorkSpace directory used to combined with INF file path.
+#
+# @return GUID, Version
+def GetLibInstanceInfo(String, WorkSpace, LineNo, CurrentInfFileName):
+
+ FileGuidString = ""
+ VerString = ""
+
+ OriginalString = String
+ String = String.strip()
+ if not String:
+ return None, None
+ #
+ # Remove "#" characters at the beginning
+ #
+ String = GetHelpStringByRemoveHashKey(String)
+ String = String.strip()
+
+ #
+ # To deal with library instance specified by GUID and version
+ #
+ RegFormatGuidPattern = re.compile("\s*([0-9a-fA-F]){8}-"
+ "([0-9a-fA-F]){4}-"
+ "([0-9a-fA-F]){4}-"
+ "([0-9a-fA-F]){4}-"
+ "([0-9a-fA-F]){12}\s*")
+ VersionPattern = re.compile('[\t\s]*\d+(\.\d+)?[\t\s]*')
+ GuidMatchedObj = RegFormatGuidPattern.search(String)
+
+ if String.upper().startswith('GUID') and GuidMatchedObj and 'Version' in String:
+ VersionStr = String[String.upper().find('VERSION') + 8:]
+ VersionMatchedObj = VersionPattern.search(VersionStr)
+ if VersionMatchedObj:
+ Guid = GuidMatchedObj.group().strip()
+ Version = VersionMatchedObj.group().strip()
+ return Guid, Version
+
+ #
+ # To deal with library instance specified by file name
+ #
+ FileLinesList = GetFileLineContent(String, WorkSpace, LineNo, OriginalString)
+
+
+ ReFindFileGuidPattern = re.compile("^\s*FILE_GUID\s*=.*$")
+ ReFindVerStringPattern = re.compile("^\s*VERSION_STRING\s*=.*$")
+
+ for Line in FileLinesList:
+ if ReFindFileGuidPattern.match(Line):
+ FileGuidString = Line
+ if ReFindVerStringPattern.match(Line):
+ VerString = Line
+
+ if FileGuidString:
+ FileGuidString = GetSplitValueList(FileGuidString, '=', 1)[1]
+ if VerString:
+ VerString = GetSplitValueList(VerString, '=', 1)[1]
+
+ return FileGuidString, VerString
+
+## GetPackageListInfo
+#
+# Get the package information from INF file.
+#
+# @param string. A string start with # and followed by INF file path
+# @param WorkSpace. The WorkSpace directory used to combined with INF file path.
+#
+# @return GUID, Version
+def GetPackageListInfo(FileNameString, WorkSpace, LineNo):
+ PackageInfoList = []
+ DefineSectionMacros = {}
+ PackageSectionMacros = {}
+
+ FileLinesList = GetFileLineContent(FileNameString, WorkSpace, LineNo, '')
+
+ RePackageHeader = re.compile('^\s*\[Packages.*\].*$')
+ ReDefineHeader = re.compile('^\s*\[Defines].*$')
+
+ PackageHederFlag = False
+ DefineHeaderFlag = False
+ LineNo = -1
+ for Line in FileLinesList:
+ LineNo += 1
+ Line = Line.strip()
+
+ if Line.startswith('['):
+ PackageHederFlag = False
+ DefineHeaderFlag = False
+
+ if Line.startswith("#"):
+ continue
+
+ if not Line:
+ continue
+
+ #
+ # Found [Packages] section
+ #
+ if RePackageHeader.match(Line):
+ PackageHederFlag = True
+ continue
+
+ #
+ # Found [Define] section
+ #
+ if ReDefineHeader.match(Line):
+ DefineHeaderFlag = True
+ continue
+
+ if DefineHeaderFlag:
+ #
+ # Find Macro
+ #
+ Name, Value = MacroParser((Line, LineNo),
+ FileNameString,
+ DT.MODEL_META_DATA_HEADER,
+ DefineSectionMacros)
+
+ if Name is not None:
+ DefineSectionMacros[Name] = Value
+ continue
+
+ if PackageHederFlag:
+
+ #
+ # Find Macro
+ #
+ Name, Value = MacroParser((Line, LineNo),
+ FileNameString,
+ DT.MODEL_META_DATA_PACKAGE,
+ DefineSectionMacros)
+ if Name is not None:
+ PackageSectionMacros[Name] = Value
+ continue
+
+ #
+ # Replace with Local section Macro and [Defines] section Macro.
+ #
+ Line = InfExpandMacro(Line, (FileNameString, Line, LineNo), DefineSectionMacros, PackageSectionMacros, True)
+
+ Line = GetSplitValueList(Line, "#", 1)[0]
+ Line = GetSplitValueList(Line, "|", 1)[0]
+ PackageInfoList.append(Line)
+
+ return PackageInfoList
+
+def GetFileLineContent(FileName, WorkSpace, LineNo, OriginalString):
+
+ if not LineNo:
+ LineNo = -1
+
+ #
+ # Validate file name exist.
+ #
+ FullFileName = os.path.normpath(os.path.realpath(os.path.join(WorkSpace, FileName)))
+ if not (ValidFile(FullFileName)):
+ return []
+
+ #
+ # Validate file exist/format.
+ #
+ if not IsValidPath(FileName, WorkSpace):
+ return []
+
+ FileLinesList = []
+
+ try:
+ FullFileName = FullFileName.replace('\\', '/')
+ Inputfile = open(FullFileName, "r")
+ try:
+ FileLinesList = Inputfile.readlines()
+ except BaseException:
+ Logger.Error("InfParser", ToolError.FILE_READ_FAILURE, ST.ERR_FILE_OPEN_FAILURE, File=FullFileName)
+ finally:
+ Inputfile.close()
+ except BaseException:
+ Logger.Error("InfParser",
+ ToolError.FILE_READ_FAILURE,
+ ST.ERR_FILE_OPEN_FAILURE,
+ File=FullFileName)
+
+ FileLinesList = ProcessLineExtender(FileLinesList)
+
+ return FileLinesList
+
+##
+# Get all INF files from current workspace
+#
+#
+def GetInfsFromWorkSpace(WorkSpace):
+ InfFiles = []
+ for top, dirs, files in os.walk(WorkSpace):
+ dirs = dirs # just for pylint
+ for File in files:
+ if File.upper().endswith(".INF"):
+ InfFiles.append(os.path.join(top, File))
+
+ return InfFiles
+
+##
+# Get GUID and version from library instance file
+#
+#
+def GetGuidVerFormLibInstance(Guid, Version, WorkSpace, CurrentInfFileName):
+ for InfFile in GetInfsFromWorkSpace(WorkSpace):
+ try:
+ if InfFile.strip().upper() == CurrentInfFileName.strip().upper():
+ continue
+ InfFile = InfFile.replace('\\', '/')
+ if InfFile not in GlobalData.gLIBINSTANCEDICT:
+ InfFileObj = open(InfFile, "r")
+ GlobalData.gLIBINSTANCEDICT[InfFile] = InfFileObj
+ else:
+ InfFileObj = GlobalData.gLIBINSTANCEDICT[InfFile]
+
+ except BaseException:
+ Logger.Error("InfParser",
+ ToolError.FILE_READ_FAILURE,
+ ST.ERR_FILE_OPEN_FAILURE,
+ File=InfFile)
+ try:
+ FileLinesList = InfFileObj.readlines()
+ FileLinesList = ProcessLineExtender(FileLinesList)
+
+ ReFindFileGuidPattern = re.compile("^\s*FILE_GUID\s*=.*$")
+ ReFindVerStringPattern = re.compile("^\s*VERSION_STRING\s*=.*$")
+
+ for Line in FileLinesList:
+ if ReFindFileGuidPattern.match(Line):
+ FileGuidString = Line
+ if ReFindVerStringPattern.match(Line):
+ VerString = Line
+
+ if FileGuidString:
+ FileGuidString = GetSplitValueList(FileGuidString, '=', 1)[1]
+ if VerString:
+ VerString = GetSplitValueList(VerString, '=', 1)[1]
+
+ if FileGuidString.strip().upper() == Guid.upper() and \
+ VerString.strip().upper() == Version.upper():
+ return Guid, Version
+
+ except BaseException:
+ Logger.Error("InfParser", ToolError.FILE_READ_FAILURE, ST.ERR_FILE_OPEN_FAILURE, File=InfFile)
+ finally:
+ InfFileObj.close()
+
+ return '', ''
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py
new file mode 100644
index 000000000..58b53276e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py
@@ -0,0 +1,226 @@
+## @file
+# This file contained the parser for [Binaries] sections in INF file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+'''
+InfBinarySectionParser
+'''
+##
+# Import Modules
+#
+
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger.ToolError import FORMAT_INVALID
+from Parser.InfParserMisc import InfExpandMacro
+from Library import DataType as DT
+from Library.Parsing import MacroParser
+from Library.Misc import GetSplitValueList
+from Object.Parser.InfCommonObject import InfLineCommentObject
+from Object.Parser.InfCommonObject import CurrentLine
+from Parser.InfParserMisc import InfParserSectionRoot
+
+class InfBinarySectionParser(InfParserSectionRoot):
+ ## InfBinaryParser
+ #
+ #
+ def InfBinaryParser(self, SectionString, InfSectionObject, FileName):
+ #
+ # Macro defined in this section
+ #
+ SectionMacros = {}
+ ValueList = []
+ #
+ # For UI (UI, SEC_UI, UNI_UI) binaries
+ # One and only one UI section can be included
+ #
+ UiBinaryList = []
+ #
+ # For Version (VER, SEC_VER, UNI_VER).
+ # One and only one VER section on be included
+ #
+ VerBinaryList = []
+ #
+ # For other common type binaries
+ #
+ ComBinaryList = []
+
+ StillCommentFalg = False
+ HeaderComments = []
+ LineComment = None
+
+ AllSectionContent = ''
+ #
+ # Parse section content
+ #
+ for Line in SectionString:
+ BinLineContent = Line[0]
+ BinLineNo = Line[1]
+
+ if BinLineContent.strip() == '':
+ continue
+
+ CurrentLineObj = CurrentLine()
+ CurrentLineObj.FileName = FileName
+ CurrentLineObj.LineString = BinLineContent
+ CurrentLineObj.LineNo = BinLineNo
+ #
+ # Found Header Comments
+ #
+ if BinLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
+ #
+ # Last line is comments, and this line go on.
+ #
+ if StillCommentFalg:
+ HeaderComments.append(Line)
+ AllSectionContent += BinLineContent + DT.END_OF_LINE
+ continue
+ #
+ # First time encounter comment
+ #
+ else:
+ #
+ # Clear original data
+ #
+ HeaderComments = []
+ HeaderComments.append(Line)
+ AllSectionContent += BinLineContent + DT.END_OF_LINE
+ StillCommentFalg = True
+ continue
+ else:
+ StillCommentFalg = False
+
+ if len(HeaderComments) >= 1:
+ LineComment = InfLineCommentObject()
+ LineCommentContent = ''
+ for Item in HeaderComments:
+ LineCommentContent += Item[0] + DT.END_OF_LINE
+ LineComment.SetHeaderComments(LineCommentContent)
+
+ #
+ # Find Tail comment.
+ #
+ if BinLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
+ TailComments = BinLineContent[BinLineContent.find(DT.TAB_COMMENT_SPLIT):]
+ BinLineContent = BinLineContent[:BinLineContent.find(DT.TAB_COMMENT_SPLIT)]
+ if LineComment is None:
+ LineComment = InfLineCommentObject()
+ LineComment.SetTailComments(TailComments)
+
+ #
+ # Find Macro
+ #
+ MacroDef = MacroParser((BinLineContent, BinLineNo),
+ FileName,
+ DT.MODEL_EFI_BINARY_FILE,
+ self.FileLocalMacros)
+ if MacroDef[0] is not None:
+ SectionMacros[MacroDef[0]] = MacroDef[1]
+ LineComment = None
+ HeaderComments = []
+ continue
+
+ #
+ # Replace with Local section Macro and [Defines] section Macro.
+ #
+ LineContent = InfExpandMacro(BinLineContent,
+ (FileName, BinLineContent, BinLineNo),
+ self.FileLocalMacros,
+ SectionMacros, True)
+
+ AllSectionContent += LineContent + DT.END_OF_LINE
+ TokenList = GetSplitValueList(LineContent, DT.TAB_VALUE_SPLIT, 1)
+ ValueList[0:len(TokenList)] = TokenList
+
+ #
+ # Should equal to UI/SEC_UI/UNI_UI
+ #
+ ValueList[0] = ValueList[0].strip()
+ if ValueList[0] == DT.BINARY_FILE_TYPE_UNI_UI or \
+ ValueList[0] == DT.BINARY_FILE_TYPE_SEC_UI or \
+ ValueList[0] == DT.BINARY_FILE_TYPE_UI:
+ if len(ValueList) == 2:
+ TokenList = GetSplitValueList(ValueList[1],
+ DT.TAB_VALUE_SPLIT,
+ 2)
+ NewValueList = []
+ NewValueList.append(ValueList[0])
+ for Item in TokenList:
+ NewValueList.append(Item)
+ UiBinaryList.append((NewValueList,
+ LineComment,
+ CurrentLineObj))
+ #
+ # Should equal to VER/SEC_VER/UNI_VER
+ #
+ elif ValueList[0] == DT.BINARY_FILE_TYPE_UNI_VER or \
+ ValueList[0] == DT.BINARY_FILE_TYPE_SEC_VER or \
+ ValueList[0] == DT.BINARY_FILE_TYPE_VER:
+ if len(ValueList) == 2:
+ TokenList = GetSplitValueList(ValueList[1],
+ DT.TAB_VALUE_SPLIT,
+ 2)
+ NewValueList = []
+ NewValueList.append(ValueList[0])
+ for Item in TokenList:
+ NewValueList.append(Item)
+ VerBinaryList.append((NewValueList,
+ LineComment,
+ CurrentLineObj))
+ else:
+ if len(ValueList) == 2:
+ if ValueList[0].strip() == 'SUBTYPE_GUID':
+ TokenList = GetSplitValueList(ValueList[1],
+ DT.TAB_VALUE_SPLIT,
+ 5)
+ else:
+ TokenList = GetSplitValueList(ValueList[1],
+ DT.TAB_VALUE_SPLIT,
+ 4)
+
+ NewValueList = []
+ NewValueList.append(ValueList[0])
+ for Item in TokenList:
+ NewValueList.append(Item)
+ ComBinaryList.append((NewValueList,
+ LineComment,
+ CurrentLineObj))
+ elif len(ValueList) == 1:
+ NewValueList = []
+ NewValueList.append(ValueList[0])
+ ComBinaryList.append((NewValueList,
+ LineComment,
+ CurrentLineObj))
+
+
+
+
+ ValueList = []
+ LineComment = None
+ TailComments = ''
+ HeaderComments = []
+ continue
+
+ #
+ # Current section archs
+ #
+ ArchList = []
+ for Item in self.LastSectionHeaderContent:
+ if Item[1] not in ArchList:
+ ArchList.append(Item[1])
+ InfSectionObject.SetSupArchList(Item[1])
+
+ InfSectionObject.SetAllContent(AllSectionContent)
+ if not InfSectionObject.SetBinary(UiBinaryList,
+ VerBinaryList,
+ ComBinaryList,
+ ArchList):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR%("[Binaries]"),
+ File=FileName,
+ Line=Item[3])
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfBuildOptionSectionParser.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfBuildOptionSectionParser.py
new file mode 100644
index 000000000..e3b48e9f4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfBuildOptionSectionParser.py
@@ -0,0 +1,212 @@
+## @file
+# This file contained the parser for BuildOption sections in INF file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+InfBuildOptionSectionParser
+'''
+##
+# Import Modules
+#
+from Library import DataType as DT
+from Library import GlobalData
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger.ToolError import FORMAT_INVALID
+from Parser.InfParserMisc import InfExpandMacro
+from Library.Misc import GetSplitValueList
+from Parser.InfParserMisc import IsAsBuildOptionInfo
+from Library.Misc import GetHelpStringByRemoveHashKey
+from Library.ParserValidate import IsValidFamily
+from Library.ParserValidate import IsValidBuildOptionName
+from Parser.InfParserMisc import InfParserSectionRoot
+
+class InfBuildOptionSectionParser(InfParserSectionRoot):
+ ## InfBuildOptionParser
+ #
+ #
+ def InfBuildOptionParser(self, SectionString, InfSectionObject, FileName):
+
+ BuildOptionList = []
+ SectionContent = ''
+
+ if not GlobalData.gIS_BINARY_INF:
+ ValueList = []
+ LineNo = 0
+
+ for Line in SectionString:
+ LineContent = Line[0]
+ LineNo = Line[1]
+ TailComments = ''
+ ReplaceFlag = False
+
+ if LineContent.strip() == '':
+ SectionContent += LineContent + DT.END_OF_LINE
+ continue
+ #
+ # Found Comment
+ #
+ if LineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
+ SectionContent += LineContent + DT.END_OF_LINE
+ continue
+
+ #
+ # Find Tail comment.
+ #
+ if LineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
+ TailComments = LineContent[LineContent.find(DT.TAB_COMMENT_SPLIT):]
+ LineContent = LineContent[:LineContent.find(DT.TAB_COMMENT_SPLIT)]
+
+ TokenList = GetSplitValueList(LineContent, DT.TAB_DEQUAL_SPLIT, 1)
+ if len(TokenList) == 2:
+ #
+ # "Replace" type build option
+ #
+ TokenList.append('True')
+ ReplaceFlag = True
+ else:
+ TokenList = GetSplitValueList(LineContent, DT.TAB_EQUAL_SPLIT, 1)
+ #
+ # "Append" type build option
+ #
+ if len(TokenList) == 2:
+ TokenList.append('False')
+ else:
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BUILD_OPTION_FORMAT_INVALID,
+ ExtraData=LineContent,
+ File=FileName,
+ Line=LineNo)
+
+ ValueList[0:len(TokenList)] = TokenList
+
+ #
+ # Replace with [Defines] section Macro
+ #
+ ValueList[0] = InfExpandMacro(ValueList[0], (FileName, LineContent, LineNo),
+ self.FileLocalMacros, None)
+ ValueList[1] = InfExpandMacro(ValueList[1], (FileName, LineContent, LineNo),
+ self.FileLocalMacros, None, True)
+ EqualString = ''
+ if not ReplaceFlag:
+ EqualString = ' = '
+ else:
+ EqualString = ' == '
+
+ SectionContent += ValueList[0] + EqualString + ValueList[1] + TailComments + DT.END_OF_LINE
+
+ Family = GetSplitValueList(ValueList[0], DT.TAB_COLON_SPLIT, 1)
+ if len(Family) == 2:
+ if not IsValidFamily(Family[0]):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BUILD_OPTION_FORMAT_INVALID,
+ ExtraData=LineContent,
+ File=FileName,
+ Line=LineNo)
+ if not IsValidBuildOptionName(Family[1]):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BUILD_OPTION_FORMAT_INVALID,
+ ExtraData=LineContent,
+ File=FileName,
+ Line=LineNo)
+ if len(Family) == 1:
+ if not IsValidBuildOptionName(Family[0]):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_BUILD_OPTION_FORMAT_INVALID,
+ ExtraData=LineContent,
+ File=FileName,
+ Line=LineNo)
+
+ BuildOptionList.append(ValueList)
+ ValueList = []
+ continue
+ else:
+ BuildOptionList = InfAsBuiltBuildOptionParser(SectionString, FileName)
+
+ #
+ # Current section archs
+ #
+ ArchList = []
+ LastItem = ''
+ for Item in self.LastSectionHeaderContent:
+ LastItem = Item
+ if not (Item[1] == '' or Item[1] == '') and Item[1] not in ArchList:
+ ArchList.append(Item[1])
+ InfSectionObject.SetSupArchList(Item[1])
+
+ InfSectionObject.SetAllContent(SectionContent)
+ if not InfSectionObject.SetBuildOptions(BuildOptionList, ArchList, SectionContent):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR%("[BuilOptions]"),
+ File=FileName,
+ Line=LastItem[3])
+
+## InfBuildOptionParser
+#
+#
+def InfAsBuiltBuildOptionParser(SectionString, FileName):
+ BuildOptionList = []
+ #
+ # AsBuild Binary INF file.
+ #
+ AsBuildOptionFlag = False
+ BuildOptionItem = []
+ Count = 0
+ for Line in SectionString:
+ Count += 1
+ LineContent = Line[0]
+ LineNo = Line[1]
+
+ #
+ # The last line
+ #
+ if len(SectionString) == Count:
+ if LineContent.strip().startswith("##") and AsBuildOptionFlag:
+ BuildOptionList.append(BuildOptionItem)
+ BuildOptionList.append([GetHelpStringByRemoveHashKey(LineContent)])
+ elif LineContent.strip().startswith("#") and AsBuildOptionFlag:
+ BuildOptionInfo = GetHelpStringByRemoveHashKey(LineContent)
+ BuildOptionItem.append(BuildOptionInfo)
+ BuildOptionList.append(BuildOptionItem)
+ else:
+ if len(BuildOptionItem) > 0:
+ BuildOptionList.append(BuildOptionItem)
+
+ break
+
+ if LineContent.strip() == '':
+ AsBuildOptionFlag = False
+ continue
+
+ if LineContent.strip().startswith("##") and AsBuildOptionFlag:
+ if len(BuildOptionItem) > 0:
+ BuildOptionList.append(BuildOptionItem)
+
+ BuildOptionItem = []
+
+ if not LineContent.strip().startswith("#"):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_BO_CONTATIN_ASBUILD_AND_COMMON,
+ File=FileName,
+ Line=LineNo,
+ ExtraData=LineContent)
+
+ if IsAsBuildOptionInfo(LineContent):
+ AsBuildOptionFlag = True
+ continue
+
+ if AsBuildOptionFlag:
+ BuildOptionInfo = GetHelpStringByRemoveHashKey(LineContent)
+ BuildOptionItem.append(BuildOptionInfo)
+
+ return BuildOptionList
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfDefineSectionParser.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfDefineSectionParser.py
new file mode 100644
index 000000000..a63e40e61
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfDefineSectionParser.py
@@ -0,0 +1,191 @@
+## @file
+# This file contained the parser for define sections in INF file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+InfDefineSectionParser
+'''
+##
+# Import Modules
+#
+import re
+
+from Library import DataType as DT
+from Library import GlobalData
+from Library.Parsing import MacroParser
+from Library.Misc import GetSplitValueList
+from Library.ParserValidate import IsValidArch
+from Object.Parser.InfCommonObject import InfLineCommentObject
+from Object.Parser.InfDefineObject import InfDefMember
+from Parser.InfParserMisc import InfExpandMacro
+from Object.Parser.InfMisc import ErrorInInf
+from Logger import StringTable as ST
+from Parser.InfParserMisc import InfParserSectionRoot
+
+## __GetValidateArchList
+#
+#
+def GetValidateArchList(LineContent):
+
+ TempArch = ''
+ ArchList = []
+ ValidateAcrhPatten = re.compile(r"^\s*#\s*VALID_ARCHITECTURES\s*=\s*.*$", re.DOTALL)
+
+ if ValidateAcrhPatten.match(LineContent):
+ TempArch = GetSplitValueList(LineContent, DT.TAB_EQUAL_SPLIT, 1)[1]
+
+ TempArch = GetSplitValueList(TempArch, '(', 1)[0]
+
+ ArchList = re.split('\s+', TempArch)
+ NewArchList = []
+ for Arch in ArchList:
+ if IsValidArch(Arch):
+ NewArchList.append(Arch)
+
+ ArchList = NewArchList
+
+ return ArchList
+
+class InfDefinSectionParser(InfParserSectionRoot):
+ def InfDefineParser(self, SectionString, InfSectionObject, FileName, SectionComment):
+
+ if SectionComment:
+ pass
+ #
+ # Parser Defines section content and fill self._ContentList dict.
+ #
+ StillCommentFalg = False
+ HeaderComments = []
+ SectionContent = ''
+ ArchList = []
+ _ContentList = []
+ _ValueList = []
+ #
+ # Add WORKSPACE to global Marco dict.
+ #
+ self.FileLocalMacros['WORKSPACE'] = GlobalData.gWORKSPACE
+
+ for Line in SectionString:
+ LineContent = Line[0]
+ LineNo = Line[1]
+ TailComments = ''
+ LineComment = None
+
+ LineInfo = ['', -1, '']
+ LineInfo[0] = FileName
+ LineInfo[1] = LineNo
+ LineInfo[2] = LineContent
+
+ if LineContent.strip() == '':
+ continue
+ #
+ # The first time encountered VALIDATE_ARCHITECHERS will be considered as support arch list.
+ #
+ if not ArchList:
+ ArchList = GetValidateArchList(LineContent)
+
+ #
+ # Parser Comment
+ #
+ if LineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
+ #
+ # Last line is comments, and this line go on.
+ #
+ if StillCommentFalg:
+ HeaderComments.append(Line)
+ SectionContent += LineContent + DT.END_OF_LINE
+ continue
+ #
+ # First time encounter comment
+ #
+ else:
+ #
+ # Clear original data
+ #
+ HeaderComments = []
+ HeaderComments.append(Line)
+ StillCommentFalg = True
+ SectionContent += LineContent + DT.END_OF_LINE
+ continue
+ else:
+ StillCommentFalg = False
+
+ if len(HeaderComments) >= 1:
+ LineComment = InfLineCommentObject()
+ LineCommentContent = ''
+ for Item in HeaderComments:
+ LineCommentContent += Item[0] + DT.END_OF_LINE
+ LineComment.SetHeaderComments(LineCommentContent)
+
+ #
+ # Find Tail comment.
+ #
+ if LineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
+ TailComments = LineContent[LineContent.find(DT.TAB_COMMENT_SPLIT):]
+ LineContent = LineContent[:LineContent.find(DT.TAB_COMMENT_SPLIT)]
+ if LineComment is None:
+ LineComment = InfLineCommentObject()
+ LineComment.SetTailComments(TailComments)
+
+ #
+ # Find Macro
+ #
+ Name, Value = MacroParser((LineContent, LineNo),
+ FileName,
+ DT.MODEL_META_DATA_HEADER,
+ self.FileLocalMacros)
+ if Name is not None:
+ self.FileLocalMacros[Name] = Value
+ continue
+
+ #
+ # Replace with [Defines] section Macro
+ #
+ LineContent = InfExpandMacro(LineContent,
+ (FileName, LineContent, LineNo),
+ self.FileLocalMacros,
+ None, True)
+
+ SectionContent += LineContent + DT.END_OF_LINE
+
+ TokenList = GetSplitValueList(LineContent, DT.TAB_EQUAL_SPLIT, 1)
+ if len(TokenList) < 2:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_NO_VALUE,
+ LineInfo=LineInfo)
+ _ValueList[0:len(TokenList)] = TokenList
+ if not _ValueList[0]:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_NO_NAME,
+ LineInfo=LineInfo)
+ if not _ValueList[1]:
+ ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_NO_VALUE,
+ LineInfo=LineInfo)
+
+ Name, Value = _ValueList[0], _ValueList[1]
+
+ InfDefMemberObj = InfDefMember(Name, Value)
+ if (LineComment is not None):
+ InfDefMemberObj.Comments.SetHeaderComments(LineComment.GetHeaderComments())
+ InfDefMemberObj.Comments.SetTailComments(LineComment.GetTailComments())
+
+ InfDefMemberObj.CurrentLine.SetFileName(self.FullPath)
+ InfDefMemberObj.CurrentLine.SetLineString(LineContent)
+ InfDefMemberObj.CurrentLine.SetLineNo(LineNo)
+
+ _ContentList.append(InfDefMemberObj)
+ HeaderComments = []
+ TailComments = ''
+
+ #
+ # Current Define section archs
+ #
+ if not ArchList:
+ ArchList = ['COMMON']
+
+ InfSectionObject.SetAllContent(SectionContent)
+
+ InfSectionObject.SetDefines(_ContentList, Arch=ArchList)
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfDepexSectionParser.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfDepexSectionParser.py
new file mode 100644
index 000000000..a2e836e48
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfDepexSectionParser.py
@@ -0,0 +1,98 @@
+## @file
+# This file contained the parser for [Depex] sections in INF file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+'''
+InfDepexSectionParser
+'''
+##
+# Import Modules
+#
+import re
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger.ToolError import FORMAT_INVALID
+from Parser.InfParserMisc import InfExpandMacro
+from Library import DataType as DT
+from Library.Misc import GetSplitValueList
+from Parser.InfParserMisc import InfParserSectionRoot
+
+class InfDepexSectionParser(InfParserSectionRoot):
+ ## InfDepexParser
+ #
+ # For now, only separate Depex String and comments.
+ # Have two types of section header.
+ # 1. [Depex.Arch.ModuleType, ...]
+ # 2. [Depex.Arch|FFE, ...]
+ #
+ def InfDepexParser(self, SectionString, InfSectionObject, FileName):
+ DepexContent = []
+ DepexComment = []
+ ValueList = []
+ #
+ # Parse section content
+ #
+ for Line in SectionString:
+ LineContent = Line[0]
+ LineNo = Line[1]
+
+ #
+ # Found comment
+ #
+ if LineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
+ DepexComment.append((LineContent, LineNo))
+ continue
+ #
+ # Replace with [Defines] section Macro
+ #
+ LineContent = InfExpandMacro(LineContent,
+ (FileName, LineContent, Line[1]),
+ self.FileLocalMacros,
+ None, True)
+
+ CommentCount = LineContent.find(DT.TAB_COMMENT_SPLIT)
+
+ if CommentCount > -1:
+ DepexComment.append((LineContent[CommentCount:], LineNo))
+ LineContent = LineContent[:CommentCount-1]
+
+
+ CommentCount = -1
+ DepexContent.append((LineContent, LineNo))
+
+ TokenList = GetSplitValueList(LineContent, DT.TAB_COMMENT_SPLIT)
+ ValueList[0:len(TokenList)] = TokenList
+
+ #
+ # Current section archs
+ #
+ KeyList = []
+ LastItem = ''
+ for Item in self.LastSectionHeaderContent:
+ LastItem = Item
+ if (Item[1], Item[2], Item[3]) not in KeyList:
+ KeyList.append((Item[1], Item[2], Item[3]))
+
+ NewCommentList = []
+ FormatCommentLn = -1
+ ReFormatComment = re.compile(r"""#(?:\s*)\[(.*?)\](?:.*)""", re.DOTALL)
+ for CommentItem in DepexComment:
+ CommentContent = CommentItem[0]
+ if ReFormatComment.match(CommentContent) is not None:
+ FormatCommentLn = CommentItem[1] + 1
+ continue
+
+ if CommentItem[1] != FormatCommentLn:
+ NewCommentList.append(CommentContent)
+ else:
+ FormatCommentLn = CommentItem[1] + 1
+
+ if not InfSectionObject.SetDepex(DepexContent, KeyList = KeyList, CommentList = NewCommentList):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR%("[Depex]"),
+ File=FileName,
+ Line=LastItem[3])
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfGuidPpiProtocolSectionParser.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfGuidPpiProtocolSectionParser.py
new file mode 100644
index 000000000..9b83c0473
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfGuidPpiProtocolSectionParser.py
@@ -0,0 +1,368 @@
+## @file
+# This file contained the parser for [Guids], [Ppis], [Protocols] sections in INF file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+'''
+InfGuidPpiProtocolSectionParser
+'''
+##
+# Import Modules
+#
+
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger.ToolError import FORMAT_INVALID
+from Parser.InfParserMisc import InfExpandMacro
+from Library import DataType as DT
+from Library import GlobalData
+from Library.Parsing import MacroParser
+from Library.Misc import GetSplitValueList
+from Library.ParserValidate import IsValidIdString
+from Library.ParserValidate import IsValidUserId
+from Library.ParserValidate import IsValidArch
+from Parser.InfParserMisc import InfParserSectionRoot
+
+class InfGuidPpiProtocolSectionParser(InfParserSectionRoot):
+ ## InfGuidParser
+ #
+ #
+ def InfGuidParser(self, SectionString, InfSectionObject, FileName):
+ #
+ # Macro defined in this section
+ #
+ SectionMacros = {}
+ ValueList = []
+ GuidList = []
+ CommentsList = []
+ CurrentLineVar = None
+ #
+ # Parse section content
+ #
+ for Line in SectionString:
+ LineContent = Line[0]
+ LineNo = Line[1]
+
+ if LineContent.strip() == '':
+ CommentsList = []
+ continue
+
+ if LineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
+ CommentsList.append(Line)
+ continue
+ else:
+ #
+ # Encounter a GUID entry
+ #
+ if LineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
+ CommentsList.append((
+ LineContent[LineContent.find(DT.TAB_COMMENT_SPLIT):],
+ LineNo))
+ LineContent = \
+ LineContent[:LineContent.find(DT.TAB_COMMENT_SPLIT)]
+
+ if LineContent != '':
+ #
+ # Find Macro
+ #
+ Name, Value = MacroParser((LineContent, LineNo),
+ FileName,
+ DT.MODEL_EFI_GUID,
+ self.FileLocalMacros)
+ if Name is not None:
+ SectionMacros[Name] = Value
+ CommentsList = []
+ ValueList = []
+ continue
+
+ TokenList = GetSplitValueList(LineContent, DT.TAB_VALUE_SPLIT, 1)
+ ValueList[0:len(TokenList)] = TokenList
+
+ #
+ # Replace with Local section Macro and [Defines] section Macro.
+ #
+ ValueList = [InfExpandMacro(Value, (FileName, LineContent, LineNo),
+ self.FileLocalMacros, SectionMacros, True)
+ for Value in ValueList]
+
+ CurrentLineVar = (LineContent, LineNo, FileName)
+
+
+ if len(ValueList) >= 1:
+ GuidList.append((ValueList, CommentsList, CurrentLineVar))
+ CommentsList = []
+ ValueList = []
+ continue
+
+ #
+ # Current section archs
+ #
+ ArchList = []
+ LineIndex = -1
+ for Item in self.LastSectionHeaderContent:
+ LineIndex = Item[3]
+ if Item[1] not in ArchList:
+ ArchList.append(Item[1])
+
+ if not InfSectionObject.SetGuid(GuidList, Arch=ArchList):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % ("[Guid]"),
+ File=FileName,
+ Line=LineIndex)
+
+ ## InfPpiParser
+ #
+ #
+ def InfPpiParser(self, SectionString, InfSectionObject, FileName):
+ #
+ # Macro defined in this section
+ #
+ SectionMacros = {}
+ ValueList = []
+ PpiList = []
+ CommentsList = []
+ CurrentLineVar = None
+ #
+ # Parse section content
+ #
+ for Line in SectionString:
+ LineContent = Line[0]
+ LineNo = Line[1]
+
+ if LineContent.strip() == '':
+ CommentsList = []
+ continue
+
+ if LineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
+ CommentsList.append(Line)
+ continue
+ else:
+ #
+ # Encounter a PPI entry
+ #
+ if LineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
+ CommentsList.append((
+ LineContent[LineContent.find(DT.TAB_COMMENT_SPLIT):],
+ LineNo))
+ LineContent = \
+ LineContent[:LineContent.find(DT.TAB_COMMENT_SPLIT)]
+
+ if LineContent != '':
+ #
+ # Find Macro
+ #
+ Name, Value = MacroParser((LineContent, LineNo),
+ FileName,
+ DT.MODEL_EFI_PPI,
+ self.FileLocalMacros)
+ if Name is not None:
+ SectionMacros[Name] = Value
+ ValueList = []
+ CommentsList = []
+ continue
+
+ TokenList = GetSplitValueList(LineContent, DT.TAB_VALUE_SPLIT, 1)
+ ValueList[0:len(TokenList)] = TokenList
+
+ #
+ # Replace with Local section Macro and [Defines] section Macro.
+ #
+ ValueList = [InfExpandMacro(Value, (FileName, LineContent, LineNo), self.FileLocalMacros, SectionMacros)
+ for Value in ValueList]
+
+ CurrentLineVar = (LineContent, LineNo, FileName)
+
+ if len(ValueList) >= 1:
+ PpiList.append((ValueList, CommentsList, CurrentLineVar))
+ ValueList = []
+ CommentsList = []
+ continue
+
+ #
+ # Current section archs
+ #
+ ArchList = []
+ LineIndex = -1
+ for Item in self.LastSectionHeaderContent:
+ LineIndex = Item[3]
+ if Item[1] not in ArchList:
+ ArchList.append(Item[1])
+
+ if not InfSectionObject.SetPpi(PpiList, Arch=ArchList):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % ("[Ppis]"),
+ File=FileName,
+ Line=LineIndex)
+
+ ## InfUserExtensionParser
+ #
+ #
+ def InfUserExtensionParser(self, SectionString, InfSectionObject, FileName):
+
+ UserExtensionContent = ''
+
+ #
+ # Parse section content
+ #
+ for Line in SectionString:
+ LineContent = Line[0]
+
+# Comment the code to support user extension without any statement just the section header in []
+# if LineContent.strip() == '':
+# continue
+
+ UserExtensionContent += LineContent + DT.END_OF_LINE
+ continue
+
+ #
+ # Current section UserId, IdString
+ #
+ IdContentList = []
+ LastItem = ''
+ SectionLineNo = None
+ for Item in self.LastSectionHeaderContent:
+ UserId = Item[1]
+ IdString = Item[2]
+ Arch = Item[3]
+ SectionLineNo = Item[4]
+ if not IsValidArch(Arch):
+ Logger.Error(
+ 'InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID % (Arch),
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=SectionLineNo,
+ ExtraData=None)
+
+ if (UserId, IdString, Arch) not in IdContentList:
+ #
+ # To check the UserId and IdString valid or not.
+ #
+ if not IsValidUserId(UserId):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_UE_SECTION_USER_ID_ERROR % (Item[1]),
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=SectionLineNo,
+ ExtraData=None)
+
+ if not IsValidIdString(IdString):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_UE_SECTION_ID_STRING_ERROR % (IdString),
+ File=GlobalData.gINF_MODULE_NAME, Line=SectionLineNo,
+ ExtraData=None)
+ IdContentList.append((UserId, IdString, Arch))
+ else:
+ #
+ # Each UserExtensions section header must have a unique set
+ # of UserId, IdString and Arch values.
+ # This means that the same UserId can be used in more than one
+ # section header, provided the IdString or Arch values are
+ # different. The same IdString values can be used in more than
+ # one section header if the UserId or Arch values are
+ # different. The same UserId and the same IdString can be used
+ # in a section header if the Arch values are different in each
+ # of the section headers.
+ #
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_UE_SECTION_DUPLICATE_ERROR % (
+ IdString),
+ File=GlobalData.gINF_MODULE_NAME,
+ Line=SectionLineNo,
+ ExtraData=None)
+ LastItem = Item
+
+ if not InfSectionObject.SetUserExtension(UserExtensionContent,
+ IdContent=IdContentList,
+ LineNo=SectionLineNo):
+ Logger.Error\
+ ('InfParser', FORMAT_INVALID, \
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % ("[UserExtension]"), \
+ File=FileName, Line=LastItem[4])
+
+ def InfProtocolParser(self, SectionString, InfSectionObject, FileName):
+ #
+ # Macro defined in this section
+ #
+ SectionMacros = {}
+ ValueList = []
+ ProtocolList = []
+ CommentsList = []
+ CurrentLineVar = None
+ #
+ # Parse section content
+ #
+ for Line in SectionString:
+ LineContent = Line[0]
+ LineNo = Line[1]
+
+ if LineContent.strip() == '':
+ CommentsList = []
+ continue
+
+ if LineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
+ CommentsList.append(Line)
+ continue
+ else:
+ #
+ # Encounter a Protocol entry
+ #
+ if LineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
+ CommentsList.append((
+ LineContent[LineContent.find(DT.TAB_COMMENT_SPLIT):],
+ LineNo))
+ LineContent = \
+ LineContent[:LineContent.find(DT.TAB_COMMENT_SPLIT)]
+
+ if LineContent != '':
+ #
+ # Find Macro
+ #
+ Name, Value = MacroParser((LineContent, LineNo),
+ FileName,
+ DT.MODEL_EFI_PROTOCOL,
+ self.FileLocalMacros)
+ if Name is not None:
+ SectionMacros[Name] = Value
+ ValueList = []
+ CommentsList = []
+ continue
+
+ TokenList = GetSplitValueList(LineContent, DT.TAB_VALUE_SPLIT, 1)
+ ValueList[0:len(TokenList)] = TokenList
+
+ #
+ # Replace with Local section Macro and [Defines] section Macro.
+ #
+ ValueList = [InfExpandMacro(Value, (FileName, LineContent, LineNo), self.FileLocalMacros, SectionMacros)
+ for Value in ValueList]
+
+ CurrentLineVar = (LineContent, LineNo, FileName)
+
+ if len(ValueList) >= 1:
+ ProtocolList.append((ValueList, CommentsList, CurrentLineVar))
+ ValueList = []
+ CommentsList = []
+ continue
+
+ #
+ # Current section archs
+ #
+ ArchList = []
+ LineIndex = -1
+ for Item in self.LastSectionHeaderContent:
+ LineIndex = Item[3]
+ if Item[1] not in ArchList:
+ ArchList.append(Item[1])
+
+ if not InfSectionObject.SetProtocol(ProtocolList, Arch=ArchList):
+ Logger.Error\
+ ('InfParser', FORMAT_INVALID, \
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % ("[Protocol]"), \
+ File=FileName, Line=LineIndex)
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py
new file mode 100644
index 000000000..f2070b51a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py
@@ -0,0 +1,197 @@
+## @file
+# This file contained the parser for [Libraries] sections in INF file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+'''
+InfLibrarySectionParser
+'''
+##
+# Import Modules
+#
+
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger.ToolError import FORMAT_INVALID
+from Parser.InfParserMisc import InfExpandMacro
+from Library import DataType as DT
+from Library.Parsing import MacroParser
+from Library.Misc import GetSplitValueList
+from Object.Parser.InfCommonObject import InfLineCommentObject
+from Library import GlobalData
+from Parser.InfParserMisc import IsLibInstanceInfo
+from Parser.InfAsBuiltProcess import GetLibInstanceInfo
+from Parser.InfParserMisc import InfParserSectionRoot
+
+class InfLibrarySectionParser(InfParserSectionRoot):
+ ## InfLibraryParser
+ #
+ #
+ def InfLibraryParser(self, SectionString, InfSectionObject, FileName):
+ #
+ # For Common INF file
+ #
+ if not GlobalData.gIS_BINARY_INF:
+ #
+ # Macro defined in this section
+ #
+ SectionMacros = {}
+ ValueList = []
+ LibraryList = []
+ LibStillCommentFalg = False
+ LibHeaderComments = []
+ LibLineComment = None
+ #
+ # Parse section content
+ #
+ for Line in SectionString:
+ LibLineContent = Line[0]
+ LibLineNo = Line[1]
+
+ if LibLineContent.strip() == '':
+ continue
+
+ #
+ # Found Header Comments
+ #
+ if LibLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
+ #
+ # Last line is comments, and this line go on.
+ #
+ if LibStillCommentFalg:
+ LibHeaderComments.append(Line)
+ continue
+ #
+ # First time encounter comment
+ #
+ else:
+ #
+ # Clear original data
+ #
+ LibHeaderComments = []
+ LibHeaderComments.append(Line)
+ LibStillCommentFalg = True
+ continue
+ else:
+ LibStillCommentFalg = False
+
+ if len(LibHeaderComments) >= 1:
+ LibLineComment = InfLineCommentObject()
+ LineCommentContent = ''
+ for Item in LibHeaderComments:
+ LineCommentContent += Item[0] + DT.END_OF_LINE
+ LibLineComment.SetHeaderComments(LineCommentContent)
+
+ #
+ # Find Tail comment.
+ #
+ if LibLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
+ LibTailComments = LibLineContent[LibLineContent.find(DT.TAB_COMMENT_SPLIT):]
+ LibLineContent = LibLineContent[:LibLineContent.find(DT.TAB_COMMENT_SPLIT)]
+ if LibLineComment is None:
+ LibLineComment = InfLineCommentObject()
+ LibLineComment.SetTailComments(LibTailComments)
+
+ #
+ # Find Macro
+ #
+ Name, Value = MacroParser((LibLineContent, LibLineNo),
+ FileName,
+ DT.MODEL_EFI_LIBRARY_CLASS,
+ self.FileLocalMacros)
+ if Name is not None:
+ SectionMacros[Name] = Value
+ LibLineComment = None
+ LibHeaderComments = []
+ continue
+
+ TokenList = GetSplitValueList(LibLineContent, DT.TAB_VALUE_SPLIT, 1)
+ ValueList[0:len(TokenList)] = TokenList
+
+ #
+ # Replace with Local section Macro and [Defines] section Macro.
+ #
+ ValueList = [InfExpandMacro(Value, (FileName, LibLineContent, LibLineNo),
+ self.FileLocalMacros, SectionMacros, True)
+ for Value in ValueList]
+
+ LibraryList.append((ValueList, LibLineComment,
+ (LibLineContent, LibLineNo, FileName)))
+ ValueList = []
+ LibLineComment = None
+ LibTailComments = ''
+ LibHeaderComments = []
+
+ continue
+
+ #
+ # Current section archs
+ #
+ KeyList = []
+ for Item in self.LastSectionHeaderContent:
+ if (Item[1], Item[2]) not in KeyList:
+ KeyList.append((Item[1], Item[2]))
+
+ if not InfSectionObject.SetLibraryClasses(LibraryList, KeyList=KeyList):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % ("[Library]"),
+ File=FileName,
+ Line=Item[3])
+ #
+ # For Binary INF
+ #
+ else:
+ self.InfAsBuiltLibraryParser(SectionString, InfSectionObject, FileName)
+
+ def InfAsBuiltLibraryParser(self, SectionString, InfSectionObject, FileName):
+ LibraryList = []
+ LibInsFlag = False
+ for Line in SectionString:
+ LineContent = Line[0]
+ LineNo = Line[1]
+
+ if LineContent.strip() == '':
+ LibInsFlag = False
+ continue
+
+ if not LineContent.strip().startswith("#"):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_LIB_CONTATIN_ASBUILD_AND_COMMON,
+ File=FileName,
+ Line=LineNo,
+ ExtraData=LineContent)
+
+ if IsLibInstanceInfo(LineContent):
+ LibInsFlag = True
+ continue
+
+ if LibInsFlag:
+ LibGuid, LibVer = GetLibInstanceInfo(LineContent, GlobalData.gWORKSPACE, LineNo, FileName)
+ #
+ # If the VERSION_STRING is missing from the INF file, tool should default to "0".
+ #
+ if LibVer == '':
+ LibVer = '0'
+ if LibGuid != '':
+ if (LibGuid, LibVer) not in LibraryList:
+ LibraryList.append((LibGuid, LibVer))
+
+ #
+ # Current section archs
+ #
+ KeyList = []
+ Item = ['', '', '']
+ for Item in self.LastSectionHeaderContent:
+ if (Item[1], Item[2]) not in KeyList:
+ KeyList.append((Item[1], Item[2]))
+
+ if not InfSectionObject.SetLibraryClasses(LibraryList, KeyList=KeyList):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % ("[Library]"),
+ File=FileName,
+ Line=Item[3])
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfPackageSectionParser.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfPackageSectionParser.py
new file mode 100644
index 000000000..f43241034
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfPackageSectionParser.py
@@ -0,0 +1,134 @@
+## @file
+# This file contained the parser for [Packages] sections in INF file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+'''
+InfPackageSectionParser
+'''
+##
+# Import Modules
+#
+
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger.ToolError import FORMAT_INVALID
+from Parser.InfParserMisc import InfExpandMacro
+from Library import DataType as DT
+from Library.Parsing import MacroParser
+from Library.Misc import GetSplitValueList
+from Object.Parser.InfCommonObject import InfLineCommentObject
+from Parser.InfParserMisc import InfParserSectionRoot
+
+class InfPackageSectionParser(InfParserSectionRoot):
+ ## InfPackageParser
+ #
+ #
+ def InfPackageParser(self, SectionString, InfSectionObject, FileName):
+ #
+ # Macro defined in this section
+ #
+ SectionMacros = {}
+ ValueList = []
+ PackageList = []
+ StillCommentFalg = False
+ HeaderComments = []
+ LineComment = None
+ #
+ # Parse section content
+ #
+ for Line in SectionString:
+ PkgLineContent = Line[0]
+ PkgLineNo = Line[1]
+
+ if PkgLineContent.strip() == '':
+ continue
+
+ #
+ # Find Header Comments
+ #
+ if PkgLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
+ #
+ # Last line is comments, and this line go on.
+ #
+ if StillCommentFalg:
+ HeaderComments.append(Line)
+ continue
+ #
+ # First time encounter comment
+ #
+ else:
+ #
+ # Clear original data
+ #
+ HeaderComments = []
+ HeaderComments.append(Line)
+ StillCommentFalg = True
+ continue
+ else:
+ StillCommentFalg = False
+
+ if len(HeaderComments) >= 1:
+ LineComment = InfLineCommentObject()
+ LineCommentContent = ''
+ for Item in HeaderComments:
+ LineCommentContent += Item[0] + DT.END_OF_LINE
+ LineComment.SetHeaderComments(LineCommentContent)
+
+ #
+ # Find Tail comment.
+ #
+ if PkgLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
+ TailComments = PkgLineContent[PkgLineContent.find(DT.TAB_COMMENT_SPLIT):]
+ PkgLineContent = PkgLineContent[:PkgLineContent.find(DT.TAB_COMMENT_SPLIT)]
+ if LineComment is None:
+ LineComment = InfLineCommentObject()
+ LineComment.SetTailComments(TailComments)
+ #
+ # Find Macro
+ #
+ Name, Value = MacroParser((PkgLineContent, PkgLineNo),
+ FileName,
+ DT.MODEL_META_DATA_PACKAGE,
+ self.FileLocalMacros)
+ if Name is not None:
+ SectionMacros[Name] = Value
+ LineComment = None
+ HeaderComments = []
+ continue
+
+ TokenList = GetSplitValueList(PkgLineContent, DT.TAB_VALUE_SPLIT, 1)
+ ValueList[0:len(TokenList)] = TokenList
+
+ #
+ # Replace with Local section Macro and [Defines] section Macro.
+ #
+ ValueList = [InfExpandMacro(Value, (FileName, PkgLineContent, PkgLineNo),
+ self.FileLocalMacros, SectionMacros, True)
+ for Value in ValueList]
+
+ PackageList.append((ValueList, LineComment,
+ (PkgLineContent, PkgLineNo, FileName)))
+ ValueList = []
+ LineComment = None
+ TailComments = ''
+ HeaderComments = []
+ continue
+
+ #
+ # Current section archs
+ #
+ ArchList = []
+ for Item in self.LastSectionHeaderContent:
+ if Item[1] not in ArchList:
+ ArchList.append(Item[1])
+
+ if not InfSectionObject.SetPackages(PackageList, Arch = ArchList):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR\
+ %("[Packages]"),
+ File=FileName,
+ Line=Item[3])
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfParser.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfParser.py
new file mode 100644
index 000000000..2072be6e4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfParser.py
@@ -0,0 +1,680 @@
+## @file
+# This file contained the parser for INF file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+InfParser
+'''
+
+##
+# Import Modules
+#
+import re
+import os
+from copy import deepcopy
+
+from Library.StringUtils import GetSplitValueList
+from Library.StringUtils import ConvertSpecialChar
+from Library.Misc import ProcessLineExtender
+from Library.Misc import ProcessEdkComment
+from Library.Parsing import NormPath
+from Library.ParserValidate import IsValidInfMoudleTypeList
+from Library.ParserValidate import IsValidArch
+from Library import DataType as DT
+from Library import GlobalData
+
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger.ToolError import FORMAT_INVALID
+from Logger.ToolError import FILE_READ_FAILURE
+from Logger.ToolError import PARSER_ERROR
+
+from Object.Parser.InfCommonObject import InfSectionCommonDef
+from Parser.InfSectionParser import InfSectionParser
+from Parser.InfParserMisc import gINF_SECTION_DEF
+from Parser.InfParserMisc import IsBinaryInf
+
+## OpenInfFile
+#
+#
+def OpenInfFile(Filename):
+ FileLinesList = []
+
+ try:
+ FInputfile = open(Filename, "r")
+ try:
+ FileLinesList = FInputfile.readlines()
+ except BaseException:
+ Logger.Error("InfParser",
+ FILE_READ_FAILURE,
+ ST.ERR_FILE_OPEN_FAILURE,
+ File=Filename)
+ finally:
+ FInputfile.close()
+ except BaseException:
+ Logger.Error("InfParser",
+ FILE_READ_FAILURE,
+ ST.ERR_FILE_OPEN_FAILURE,
+ File=Filename)
+
+ return FileLinesList
+
+## InfParser
+#
+# This class defined the structure used in InfParser object
+#
+# @param InfObject: Inherited from InfSectionParser class
+# @param Filename: Input value for Filename of INF file, default is
+# None
+# @param WorkspaceDir: Input value for current workspace directory,
+# default is None
+#
+class InfParser(InfSectionParser):
+
+ def __init__(self, Filename = None, WorkspaceDir = None):
+
+ #
+ # Call parent class construct function
+ #
+ InfSectionParser.__init__()
+
+ self.WorkspaceDir = WorkspaceDir
+ self.SupArchList = DT.ARCH_LIST
+ self.EventList = []
+ self.HobList = []
+ self.BootModeList = []
+
+ #
+ # Load Inf file if filename is not None
+ #
+ if Filename is not None:
+ self.ParseInfFile(Filename)
+
+ ## Parse INF file
+ #
+ # Parse the file if it exists
+ #
+ # @param Filename: Input value for filename of INF file
+ #
+ def ParseInfFile(self, Filename):
+
+ Filename = NormPath(Filename)
+ (Path, Name) = os.path.split(Filename)
+ self.FullPath = Filename
+ self.RelaPath = Path
+ self.FileName = Name
+ GlobalData.gINF_MODULE_DIR = Path
+ GlobalData.gINF_MODULE_NAME = self.FullPath
+ GlobalData.gIS_BINARY_INF = False
+ #
+ # Initialize common data
+ #
+ LineNo = 0
+ CurrentSection = DT.MODEL_UNKNOWN
+ SectionLines = []
+
+ #
+ # Flags
+ #
+ HeaderCommentStart = False
+ HeaderCommentEnd = False
+ HeaderStarLineNo = -1
+ BinaryHeaderCommentStart = False
+ BinaryHeaderCommentEnd = False
+ BinaryHeaderStarLineNo = -1
+
+ #
+ # While Section ends. parse whole section contents.
+ #
+ NewSectionStartFlag = False
+ FirstSectionStartFlag = False
+
+ #
+ # Parse file content
+ #
+ CommentBlock = []
+
+ #
+ # Variables for Event/Hob/BootMode
+ #
+ self.EventList = []
+ self.HobList = []
+ self.BootModeList = []
+ SectionType = ''
+
+ FileLinesList = OpenInfFile (Filename)
+
+ #
+ # One INF file can only has one [Defines] section.
+ #
+ DefineSectionParsedFlag = False
+
+ #
+ # Convert special characters in lines to space character.
+ #
+ FileLinesList = ConvertSpecialChar(FileLinesList)
+
+ #
+ # Process Line Extender
+ #
+ FileLinesList = ProcessLineExtender(FileLinesList)
+
+ #
+ # Process EdkI INF style comment if found
+ #
+ OrigLines = [Line for Line in FileLinesList]
+ FileLinesList, EdkCommentStartPos = ProcessEdkComment(FileLinesList)
+
+ #
+ # Judge whether the INF file is Binary INF or not
+ #
+ if IsBinaryInf(FileLinesList):
+ GlobalData.gIS_BINARY_INF = True
+
+ InfSectionCommonDefObj = None
+
+ for Line in FileLinesList:
+ LineNo = LineNo + 1
+ Line = Line.strip()
+ if (LineNo < len(FileLinesList) - 1):
+ NextLine = FileLinesList[LineNo].strip()
+
+ #
+ # blank line
+ #
+ if (Line == '' or not Line) and LineNo == len(FileLinesList):
+ LastSectionFalg = True
+
+ #
+ # check whether file header comment section started
+ #
+ if Line.startswith(DT.TAB_SPECIAL_COMMENT) and \
+ (Line.find(DT.TAB_HEADER_COMMENT) > -1) and \
+ not HeaderCommentStart and not HeaderCommentEnd:
+
+ CurrentSection = DT.MODEL_META_DATA_FILE_HEADER
+ #
+ # Append the first line to section lines.
+ #
+ HeaderStarLineNo = LineNo
+ SectionLines.append((Line, LineNo))
+ HeaderCommentStart = True
+ continue
+
+ #
+ # Collect Header content.
+ #
+ if (Line.startswith(DT.TAB_COMMENT_SPLIT) and CurrentSection == DT.MODEL_META_DATA_FILE_HEADER) and\
+ HeaderCommentStart and not Line.startswith(DT.TAB_SPECIAL_COMMENT) and not\
+ HeaderCommentEnd and NextLine != '':
+ SectionLines.append((Line, LineNo))
+ continue
+ #
+ # Header content end
+ #
+ if (Line.startswith(DT.TAB_SPECIAL_COMMENT) or not Line.strip().startswith("#")) and HeaderCommentStart \
+ and not HeaderCommentEnd:
+ HeaderCommentEnd = True
+ BinaryHeaderCommentStart = False
+ BinaryHeaderCommentEnd = False
+ HeaderCommentStart = False
+ if Line.find(DT.TAB_BINARY_HEADER_COMMENT) > -1:
+ self.InfHeaderParser(SectionLines, self.InfHeader, self.FileName)
+ SectionLines = []
+ else:
+ SectionLines.append((Line, LineNo))
+ #
+ # Call Header comment parser.
+ #
+ self.InfHeaderParser(SectionLines, self.InfHeader, self.FileName)
+ SectionLines = []
+ continue
+
+ #
+ # check whether binary header comment section started
+ #
+ if Line.startswith(DT.TAB_SPECIAL_COMMENT) and \
+ (Line.find(DT.TAB_BINARY_HEADER_COMMENT) > -1) and \
+ not BinaryHeaderCommentStart:
+ SectionLines = []
+ CurrentSection = DT.MODEL_META_DATA_FILE_HEADER
+ #
+ # Append the first line to section lines.
+ #
+ BinaryHeaderStarLineNo = LineNo
+ SectionLines.append((Line, LineNo))
+ BinaryHeaderCommentStart = True
+ HeaderCommentEnd = True
+ continue
+
+ #
+ # check whether there are more than one binary header exist
+ #
+ if Line.startswith(DT.TAB_SPECIAL_COMMENT) and BinaryHeaderCommentStart and \
+ not BinaryHeaderCommentEnd and (Line.find(DT.TAB_BINARY_HEADER_COMMENT) > -1):
+ Logger.Error('Parser',
+ FORMAT_INVALID,
+ ST.ERR_MULTIPLE_BINARYHEADER_EXIST,
+ File=Filename)
+
+ #
+ # Collect Binary Header content.
+ #
+ if (Line.startswith(DT.TAB_COMMENT_SPLIT) and CurrentSection == DT.MODEL_META_DATA_FILE_HEADER) and\
+ BinaryHeaderCommentStart and not Line.startswith(DT.TAB_SPECIAL_COMMENT) and not\
+ BinaryHeaderCommentEnd and NextLine != '':
+ SectionLines.append((Line, LineNo))
+ continue
+ #
+ # Binary Header content end
+ #
+ if (Line.startswith(DT.TAB_SPECIAL_COMMENT) or not Line.strip().startswith(DT.TAB_COMMENT_SPLIT)) and \
+ BinaryHeaderCommentStart and not BinaryHeaderCommentEnd:
+ SectionLines.append((Line, LineNo))
+ BinaryHeaderCommentStart = False
+ #
+ # Call Binary Header comment parser.
+ #
+ self.InfHeaderParser(SectionLines, self.InfBinaryHeader, self.FileName, True)
+ SectionLines = []
+ BinaryHeaderCommentEnd = True
+ continue
+ #
+ # Find a new section tab
+ # Or at the last line of INF file,
+ # need to process the last section.
+ #
+ LastSectionFalg = False
+ if LineNo == len(FileLinesList):
+ LastSectionFalg = True
+
+ if Line.startswith(DT.TAB_COMMENT_SPLIT) and not Line.startswith(DT.TAB_SPECIAL_COMMENT):
+ SectionLines.append((Line, LineNo))
+ if not LastSectionFalg:
+ continue
+
+ #
+ # Encountered a section. start with '[' and end with ']'
+ #
+ if (Line.startswith(DT.TAB_SECTION_START) and \
+ Line.find(DT.TAB_SECTION_END) > -1) or LastSectionFalg:
+
+ HeaderCommentEnd = True
+ BinaryHeaderCommentEnd = True
+
+ if not LastSectionFalg:
+ #
+ # check to prevent '#' inside section header
+ #
+ HeaderContent = Line[1:Line.find(DT.TAB_SECTION_END)]
+ if HeaderContent.find(DT.TAB_COMMENT_SPLIT) != -1:
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_SECTION_HEADER_INVALID,
+ File=self.FullPath,
+ Line=LineNo,
+ ExtraData=Line)
+
+ #
+ # Keep last time section header content for section parser
+ # usage.
+ #
+ self.LastSectionHeaderContent = deepcopy(self.SectionHeaderContent)
+
+ #
+ # TailComments in section define.
+ #
+ TailComments = ''
+ CommentIndex = Line.find(DT.TAB_COMMENT_SPLIT)
+ if CommentIndex > -1:
+ TailComments = Line[CommentIndex:]
+ Line = Line[:CommentIndex]
+
+ InfSectionCommonDefObj = InfSectionCommonDef()
+ if TailComments != '':
+ InfSectionCommonDefObj.SetTailComments(TailComments)
+ if CommentBlock != '':
+ InfSectionCommonDefObj.SetHeaderComments(CommentBlock)
+ CommentBlock = []
+ #
+ # Call section parser before section header parer to avoid encounter EDKI INF file
+ #
+ if CurrentSection == DT.MODEL_META_DATA_DEFINE:
+ DefineSectionParsedFlag = self._CallSectionParsers(CurrentSection,
+ DefineSectionParsedFlag, SectionLines,
+ InfSectionCommonDefObj, LineNo)
+ #
+ # Compare the new section name with current
+ #
+ self.SectionHeaderParser(Line, self.FileName, LineNo)
+
+ self._CheckSectionHeaders(Line, LineNo)
+
+ SectionType = _ConvertSecNameToType(self.SectionHeaderContent[0][0])
+
+ if not FirstSectionStartFlag:
+ CurrentSection = SectionType
+ FirstSectionStartFlag = True
+ else:
+ NewSectionStartFlag = True
+ else:
+ SectionLines.append((Line, LineNo))
+ continue
+
+ if LastSectionFalg:
+ SectionLines, CurrentSection = self._ProcessLastSection(SectionLines, Line, LineNo, CurrentSection)
+
+ #
+ # End of section content collect.
+ # Parser the section content collected previously.
+ #
+ if NewSectionStartFlag or LastSectionFalg:
+ if CurrentSection != DT.MODEL_META_DATA_DEFINE or \
+ (LastSectionFalg and CurrentSection == DT.MODEL_META_DATA_DEFINE):
+ DefineSectionParsedFlag = self._CallSectionParsers(CurrentSection,
+ DefineSectionParsedFlag, SectionLines,
+ InfSectionCommonDefObj, LineNo)
+
+ CurrentSection = SectionType
+ #
+ # Clear section lines
+ #
+ SectionLines = []
+
+ if HeaderStarLineNo == -1:
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_NO_SOURCE_HEADER,
+ File=self.FullPath)
+ if BinaryHeaderStarLineNo > -1 and HeaderStarLineNo > -1 and HeaderStarLineNo > BinaryHeaderStarLineNo:
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_BINARY_HEADER_ORDER,
+ File=self.FullPath)
+ #
+ # EDKII INF should not have EDKI style comment
+ #
+ if EdkCommentStartPos != -1:
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_EDKI_COMMENT_IN_EDKII,
+ File=self.FullPath,
+ Line=EdkCommentStartPos + 1,
+ ExtraData=OrigLines[EdkCommentStartPos])
+
+ #
+ # extract [Event] [Hob] [BootMode] sections
+ #
+ self._ExtractEventHobBootMod(FileLinesList)
+
+ ## _CheckSectionHeaders
+ #
+ #
+ def _CheckSectionHeaders(self, Line, LineNo):
+ if len(self.SectionHeaderContent) == 0:
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_SECTION_HEADER_INVALID,
+ File=self.FullPath,
+ Line=LineNo, ExtraData=Line)
+ else:
+ for SectionItem in self.SectionHeaderContent:
+ ArchList = []
+ #
+ # Not cover Depex/UserExtension section header
+ # check.
+ #
+ if SectionItem[0].strip().upper() == DT.TAB_INF_FIXED_PCD.upper() or \
+ SectionItem[0].strip().upper() == DT.TAB_INF_PATCH_PCD.upper() or \
+ SectionItem[0].strip().upper() == DT.TAB_INF_PCD_EX.upper() or \
+ SectionItem[0].strip().upper() == DT.TAB_INF_PCD.upper() or \
+ SectionItem[0].strip().upper() == DT.TAB_INF_FEATURE_PCD.upper():
+ ArchList = GetSplitValueList(SectionItem[1].strip(), ' ')
+ else:
+ ArchList = [SectionItem[1].strip()]
+
+ for Arch in ArchList:
+ if (not IsValidArch(Arch)) and \
+ (SectionItem[0].strip().upper() != DT.TAB_DEPEX.upper()) and \
+ (SectionItem[0].strip().upper() != DT.TAB_USER_EXTENSIONS.upper()) and \
+ (SectionItem[0].strip().upper() != DT.TAB_COMMON_DEFINES.upper()):
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(SectionItem[1]),
+ File=self.FullPath,
+ Line=LineNo, ExtraData=Line)
+ #
+ # Check if the ModuleType is valid
+ #
+ ChkModSectionList = ['LIBRARYCLASSES']
+ if (self.SectionHeaderContent[0][0].upper() in ChkModSectionList):
+ if SectionItem[2].strip().upper():
+ MoudleTypeList = GetSplitValueList(
+ SectionItem[2].strip().upper())
+ if (not IsValidInfMoudleTypeList(MoudleTypeList)):
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(SectionItem[2]),
+ File=self.FullPath, Line=LineNo,
+ ExtraData=Line)
+
+ ## _CallSectionParsers
+ #
+ #
+ def _CallSectionParsers(self, CurrentSection, DefineSectionParsedFlag,
+ SectionLines, InfSectionCommonDefObj, LineNo):
+ if CurrentSection == DT.MODEL_META_DATA_DEFINE:
+ if not DefineSectionParsedFlag:
+ self.InfDefineParser(SectionLines,
+ self.InfDefSection,
+ self.FullPath,
+ InfSectionCommonDefObj)
+ DefineSectionParsedFlag = True
+ else:
+ Logger.Error("Parser",
+ PARSER_ERROR,
+ ST.ERR_INF_PARSER_MULTI_DEFINE_SECTION,
+ File=self.FullPath,
+ RaiseError = Logger.IS_RAISE_ERROR)
+
+ elif CurrentSection == DT.MODEL_META_DATA_BUILD_OPTION:
+ self.InfBuildOptionParser(SectionLines,
+ self.InfBuildOptionSection,
+ self.FullPath)
+
+ elif CurrentSection == DT.MODEL_EFI_LIBRARY_CLASS:
+ self.InfLibraryParser(SectionLines,
+ self.InfLibraryClassSection,
+ self.FullPath)
+
+ elif CurrentSection == DT.MODEL_META_DATA_PACKAGE:
+ self.InfPackageParser(SectionLines,
+ self.InfPackageSection,
+ self.FullPath)
+ #
+ # [Pcd] Sections, put it together
+ #
+ elif CurrentSection == DT.MODEL_PCD_FIXED_AT_BUILD or \
+ CurrentSection == DT.MODEL_PCD_PATCHABLE_IN_MODULE or \
+ CurrentSection == DT.MODEL_PCD_FEATURE_FLAG or \
+ CurrentSection == DT.MODEL_PCD_DYNAMIC_EX or \
+ CurrentSection == DT.MODEL_PCD_DYNAMIC:
+ self.InfPcdParser(SectionLines,
+ self.InfPcdSection,
+ self.FullPath)
+
+ elif CurrentSection == DT.MODEL_EFI_SOURCE_FILE:
+ self.InfSourceParser(SectionLines,
+ self.InfSourcesSection,
+ self.FullPath)
+
+ elif CurrentSection == DT.MODEL_META_DATA_USER_EXTENSION:
+ self.InfUserExtensionParser(SectionLines,
+ self.InfUserExtensionSection,
+ self.FullPath)
+
+ elif CurrentSection == DT.MODEL_EFI_PROTOCOL:
+ self.InfProtocolParser(SectionLines,
+ self.InfProtocolSection,
+ self.FullPath)
+
+ elif CurrentSection == DT.MODEL_EFI_PPI:
+ self.InfPpiParser(SectionLines,
+ self.InfPpiSection,
+ self.FullPath)
+
+ elif CurrentSection == DT.MODEL_EFI_GUID:
+ self.InfGuidParser(SectionLines,
+ self.InfGuidSection,
+ self.FullPath)
+
+ elif CurrentSection == DT.MODEL_EFI_DEPEX:
+ self.InfDepexParser(SectionLines,
+ self.InfDepexSection,
+ self.FullPath)
+
+ elif CurrentSection == DT.MODEL_EFI_BINARY_FILE:
+ self.InfBinaryParser(SectionLines,
+ self.InfBinariesSection,
+ self.FullPath)
+ #
+ # Unknown section type found, raise error.
+ #
+ else:
+ if len(self.SectionHeaderContent) >= 1:
+ Logger.Error("Parser",
+ PARSER_ERROR,
+ ST.ERR_INF_PARSER_UNKNOWN_SECTION,
+ File=self.FullPath, Line=LineNo,
+ RaiseError = Logger.IS_RAISE_ERROR)
+ else:
+ Logger.Error("Parser",
+ PARSER_ERROR,
+ ST.ERR_INF_PARSER_NO_SECTION_ERROR,
+ File=self.FullPath, Line=LineNo,
+ RaiseError = Logger.IS_RAISE_ERROR)
+
+ return DefineSectionParsedFlag
+
+ def _ExtractEventHobBootMod(self, FileLinesList):
+ SpecialSectionStart = False
+ CheckLocation = False
+ GFindSpecialCommentRe = \
+ re.compile(r"""#(?:\s*)\[(.*?)\](?:.*)""", re.DOTALL)
+ GFindNewSectionRe2 = \
+ re.compile(r"""#?(\s*)\[(.*?)\](.*)""", re.DOTALL)
+ LineNum = 0
+ Element = []
+ for Line in FileLinesList:
+ Line = Line.strip()
+ LineNum += 1
+ MatchObject = GFindSpecialCommentRe.search(Line)
+ if MatchObject:
+ SpecialSectionStart = True
+ Element = []
+ if MatchObject.group(1).upper().startswith("EVENT"):
+ List = self.EventList
+ elif MatchObject.group(1).upper().startswith("HOB"):
+ List = self.HobList
+ elif MatchObject.group(1).upper().startswith("BOOTMODE"):
+ List = self.BootModeList
+ else:
+ SpecialSectionStart = False
+ CheckLocation = False
+ if SpecialSectionStart:
+ Element.append([Line, LineNum])
+ List.append(Element)
+ else:
+ #
+ # if currently in special section, try to detect end of current section
+ #
+ MatchObject = GFindNewSectionRe2.search(Line)
+ if SpecialSectionStart:
+ if MatchObject:
+ SpecialSectionStart = False
+ CheckLocation = False
+ Element = []
+ elif not Line:
+ SpecialSectionStart = False
+ CheckLocation = True
+ Element = []
+ else:
+ if not Line.startswith(DT.TAB_COMMENT_SPLIT):
+ Logger.Warn("Parser",
+ ST.WARN_SPECIAL_SECTION_LOCATION_WRONG,
+ File=self.FullPath, Line=LineNum)
+ SpecialSectionStart = False
+ CheckLocation = False
+ Element = []
+ else:
+ Element.append([Line, LineNum])
+ else:
+ if CheckLocation:
+ if MatchObject:
+ CheckLocation = False
+ elif Line:
+ Logger.Warn("Parser",
+ ST.WARN_SPECIAL_SECTION_LOCATION_WRONG,
+ File=self.FullPath, Line=LineNum)
+ CheckLocation = False
+
+ if len(self.BootModeList) >= 1:
+ self.InfSpecialCommentParser(self.BootModeList,
+ self.InfSpecialCommentSection,
+ self.FileName,
+ DT.TYPE_BOOTMODE_SECTION)
+
+ if len(self.EventList) >= 1:
+ self.InfSpecialCommentParser(self.EventList,
+ self.InfSpecialCommentSection,
+ self.FileName,
+ DT.TYPE_EVENT_SECTION)
+
+ if len(self.HobList) >= 1:
+ self.InfSpecialCommentParser(self.HobList,
+ self.InfSpecialCommentSection,
+ self.FileName,
+ DT.TYPE_HOB_SECTION)
+ ## _ProcessLastSection
+ #
+ #
+ def _ProcessLastSection(self, SectionLines, Line, LineNo, CurrentSection):
+ #
+ # The last line is a section header. will discard it.
+ #
+ if not (Line.startswith(DT.TAB_SECTION_START) and Line.find(DT.TAB_SECTION_END) > -1):
+ SectionLines.append((Line, LineNo))
+
+ if len(self.SectionHeaderContent) >= 1:
+ TemSectionName = self.SectionHeaderContent[0][0].upper()
+ if TemSectionName.upper() not in gINF_SECTION_DEF.keys():
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_UNKNOWN_SECTION,
+ File=self.FullPath,
+ Line=LineNo,
+ ExtraData=Line,
+ RaiseError = Logger.IS_RAISE_ERROR
+ )
+ else:
+ CurrentSection = gINF_SECTION_DEF[TemSectionName]
+ self.LastSectionHeaderContent = self.SectionHeaderContent
+
+ return SectionLines, CurrentSection
+
+## _ConvertSecNameToType
+#
+#
+def _ConvertSecNameToType(SectionName):
+ SectionType = ''
+ if SectionName.upper() not in gINF_SECTION_DEF.keys():
+ SectionType = DT.MODEL_UNKNOWN
+ else:
+ SectionType = gINF_SECTION_DEF[SectionName.upper()]
+
+ return SectionType
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfParserMisc.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfParserMisc.py
new file mode 100644
index 000000000..d01ae9aa0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfParserMisc.py
@@ -0,0 +1,216 @@
+## @file
+# This file contained the miscellaneous functions for INF parser
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+InfParserMisc
+'''
+
+##
+# Import Modules
+#
+import re
+
+
+from Library import DataType as DT
+
+
+from Library.StringUtils import gMACRO_PATTERN
+from Library.StringUtils import ReplaceMacro
+from Object.Parser.InfMisc import ErrorInInf
+from Logger.StringTable import ERR_MARCO_DEFINITION_MISS_ERROR
+
+#
+# Global variable
+#
+
+#
+# Sections can exist in INF file
+#
+gINF_SECTION_DEF = {
+ DT.TAB_UNKNOWN.upper() : DT.MODEL_UNKNOWN,
+ DT.TAB_HEADER.upper() : DT.MODEL_META_DATA_FILE_HEADER,
+ DT.TAB_INF_DEFINES.upper() : DT.MODEL_META_DATA_DEFINE,
+ DT.TAB_BUILD_OPTIONS.upper() : DT.MODEL_META_DATA_BUILD_OPTION,
+ DT.TAB_LIBRARY_CLASSES.upper() : DT.MODEL_EFI_LIBRARY_CLASS,
+ DT.TAB_PACKAGES.upper() : DT.MODEL_META_DATA_PACKAGE,
+ DT.TAB_INF_FIXED_PCD.upper() : DT.MODEL_PCD_FIXED_AT_BUILD,
+ DT.TAB_INF_PATCH_PCD.upper() : DT.MODEL_PCD_PATCHABLE_IN_MODULE,
+ DT.TAB_INF_FEATURE_PCD.upper() : DT.MODEL_PCD_FEATURE_FLAG,
+ DT.TAB_INF_PCD_EX.upper() : DT.MODEL_PCD_DYNAMIC_EX,
+ DT.TAB_INF_PCD.upper() : DT.MODEL_PCD_DYNAMIC,
+ DT.TAB_SOURCES.upper() : DT.MODEL_EFI_SOURCE_FILE,
+ DT.TAB_GUIDS.upper() : DT.MODEL_EFI_GUID,
+ DT.TAB_PROTOCOLS.upper() : DT.MODEL_EFI_PROTOCOL,
+ DT.TAB_PPIS.upper() : DT.MODEL_EFI_PPI,
+ DT.TAB_DEPEX.upper() : DT.MODEL_EFI_DEPEX,
+ DT.TAB_BINARIES.upper() : DT.MODEL_EFI_BINARY_FILE,
+ DT.TAB_USER_EXTENSIONS.upper() : DT.MODEL_META_DATA_USER_EXTENSION
+ #
+ # EDK1 section
+ # TAB_NMAKE.upper() : MODEL_META_DATA_NMAKE
+ #
+ }
+
+## InfExpandMacro
+#
+# Expand MACRO definition with MACROs defined in [Defines] section and specific section.
+# The MACROs defined in specific section has high priority and will be expanded firstly.
+#
+# @param LineInfo Contain information of FileName, LineContent, LineNo
+# @param GlobalMacros MACROs defined in INF [Defines] section
+# @param SectionMacros MACROs defined in INF specific section
+# @param Flag If the flag set to True, need to skip macros in a quoted string
+#
+def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Flag=False):
+ if GlobalMacros is None:
+ GlobalMacros = {}
+ if SectionMacros is None:
+ SectionMacros = {}
+
+ FileName = LineInfo[0]
+ LineContent = LineInfo[1]
+ LineNo = LineInfo[2]
+
+ # Don't expand macros in comments
+ if LineContent.strip().startswith("#"):
+ return Content
+
+ NewLineInfo = (FileName, LineNo, LineContent)
+
+ #
+ # First, replace MARCOs with value defined in specific section
+ #
+ Content = ReplaceMacro (Content,
+ SectionMacros,
+ False,
+ (LineContent, LineNo),
+ FileName,
+ Flag)
+ #
+ # Then replace MARCOs with value defined in [Defines] section
+ #
+ Content = ReplaceMacro (Content,
+ GlobalMacros,
+ False,
+ (LineContent, LineNo),
+ FileName,
+ Flag)
+
+ MacroUsed = gMACRO_PATTERN.findall(Content)
+ #
+ # no macro found in String, stop replacing
+ #
+ if len(MacroUsed) == 0:
+ return Content
+ else:
+ for Macro in MacroUsed:
+ gQuotedMacro = re.compile(".*\".*\$\(%s\).*\".*"%(Macro))
+ if not gQuotedMacro.match(Content):
+ #
+ # Still have MACROs can't be expanded.
+ #
+ ErrorInInf (ERR_MARCO_DEFINITION_MISS_ERROR,
+ LineInfo=NewLineInfo)
+
+ return Content
+
+
+## IsBinaryInf
+#
+# Judge whether the INF file is Binary INF or Common INF
+#
+# @param FileLineList A list contain all INF file content.
+#
+def IsBinaryInf(FileLineList):
+ if not FileLineList:
+ return False
+
+ ReIsSourcesSection = re.compile("^\s*\[Sources.*\]\s.*$", re.IGNORECASE)
+ ReIsBinarySection = re.compile("^\s*\[Binaries.*\]\s.*$", re.IGNORECASE)
+ BinarySectionFoundFlag = False
+
+ for Line in FileLineList:
+ if ReIsSourcesSection.match(Line):
+ return False
+ if ReIsBinarySection.match(Line):
+ BinarySectionFoundFlag = True
+
+ if BinarySectionFoundFlag:
+ return True
+
+ return False
+
+
+## IsLibInstanceInfo
+#
+# Judge whether the string contain the information of ## @LIB_INSTANCES.
+#
+# @param String
+#
+# @return Flag
+#
+def IsLibInstanceInfo(String):
+ ReIsLibInstance = re.compile("^\s*##\s*@LIB_INSTANCES\s*$")
+ if ReIsLibInstance.match(String):
+ return True
+ else:
+ return False
+
+
+## IsAsBuildOptionInfo
+#
+# Judge whether the string contain the information of ## @ASBUILD.
+#
+# @param String
+#
+# @return Flag
+#
+def IsAsBuildOptionInfo(String):
+ ReIsAsBuildInstance = re.compile("^\s*##\s*@AsBuilt\s*$")
+ if ReIsAsBuildInstance.match(String):
+ return True
+ else:
+ return False
+
+
+class InfParserSectionRoot(object):
+ def __init__(self):
+ #
+ # Macros defined in [Define] section are file scope global
+ #
+ self.FileLocalMacros = {}
+
+ #
+ # Current Section Header content.
+ #
+ self.SectionHeaderContent = []
+
+ #
+ # Last time Section Header content.
+ #
+ self.LastSectionHeaderContent = []
+
+ self.FullPath = ''
+
+ self.InfDefSection = None
+ self.InfBuildOptionSection = None
+ self.InfLibraryClassSection = None
+ self.InfPackageSection = None
+ self.InfPcdSection = None
+ self.InfSourcesSection = None
+ self.InfUserExtensionSection = None
+ self.InfProtocolSection = None
+ self.InfPpiSection = None
+ self.InfGuidSection = None
+ self.InfDepexSection = None
+ self.InfPeiDepexSection = None
+ self.InfDxeDepexSection = None
+ self.InfSmmDepexSection = None
+ self.InfBinariesSection = None
+ self.InfHeader = None
+ self.InfSpecialCommentSection = None
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfPcdSectionParser.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfPcdSectionParser.py
new file mode 100644
index 000000000..6954742bf
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfPcdSectionParser.py
@@ -0,0 +1,178 @@
+## @file
+# This file contained the parser for [Pcds] sections in INF file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+'''
+InfPcdSectionParser
+'''
+##
+# Import Modules
+#
+
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger.ToolError import FORMAT_INVALID
+from Parser.InfParserMisc import InfExpandMacro
+from Library import DataType as DT
+from Library.Parsing import MacroParser
+from Library.Misc import GetSplitValueList
+from Library import GlobalData
+from Library.StringUtils import SplitPcdEntry
+from Parser.InfParserMisc import InfParserSectionRoot
+
+class InfPcdSectionParser(InfParserSectionRoot):
+ ## Section PCD related parser
+ #
+ # For 5 types of PCD list below, all use this function.
+ # 'FixedPcd', 'FeaturePcd', 'PatchPcd', 'Pcd', 'PcdEx'
+ #
+ # This is a INF independent parser, the validation in this parser only
+ # cover
+ # INF spec scope, will not cross DEC/DSC to check pcd value
+ #
+ def InfPcdParser(self, SectionString, InfSectionObject, FileName):
+ KeysList = []
+ PcdList = []
+ CommentsList = []
+ ValueList = []
+ #
+ # Current section archs
+ #
+ LineIndex = -1
+ for Item in self.LastSectionHeaderContent:
+ if (Item[0], Item[1], Item[3]) not in KeysList:
+ KeysList.append((Item[0], Item[1], Item[3]))
+ LineIndex = Item[3]
+
+ if (Item[0].upper() == DT.TAB_INF_FIXED_PCD.upper() or \
+ Item[0].upper() == DT.TAB_INF_FEATURE_PCD.upper() or \
+ Item[0].upper() == DT.TAB_INF_PCD.upper()) and GlobalData.gIS_BINARY_INF:
+ Logger.Error('InfParser', FORMAT_INVALID, ST.ERR_ASBUILD_PCD_SECTION_TYPE%("\"" + Item[0] + "\""),
+ File=FileName, Line=LineIndex)
+
+ #
+ # For Common INF file
+ #
+ if not GlobalData.gIS_BINARY_INF:
+ #
+ # Macro defined in this section
+ #
+ SectionMacros = {}
+ for Line in SectionString:
+ PcdLineContent = Line[0]
+ PcdLineNo = Line[1]
+ if PcdLineContent.strip() == '':
+ CommentsList = []
+ continue
+
+ if PcdLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
+ CommentsList.append(Line)
+ continue
+ else:
+ #
+ # Encounter a PCD entry
+ #
+ if PcdLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
+ CommentsList.append((
+ PcdLineContent[PcdLineContent.find(DT.TAB_COMMENT_SPLIT):],
+ PcdLineNo))
+ PcdLineContent = PcdLineContent[:PcdLineContent.find(DT.TAB_COMMENT_SPLIT)]
+
+ if PcdLineContent != '':
+ #
+ # Find Macro
+ #
+ Name, Value = MacroParser((PcdLineContent, PcdLineNo),
+ FileName,
+ DT.MODEL_EFI_PCD,
+ self.FileLocalMacros)
+ if Name is not None:
+ SectionMacros[Name] = Value
+ ValueList = []
+ CommentsList = []
+ continue
+
+ PcdEntryReturn = SplitPcdEntry(PcdLineContent)
+
+ if not PcdEntryReturn[1]:
+ TokenList = ['']
+ else:
+ TokenList = PcdEntryReturn[0]
+
+ ValueList[0:len(TokenList)] = TokenList
+
+ #
+ # Replace with Local section Macro and [Defines] section Macro.
+ #
+ ValueList = [InfExpandMacro(Value, (FileName, PcdLineContent, PcdLineNo),
+ self.FileLocalMacros, SectionMacros, True)
+ for Value in ValueList]
+
+ if len(ValueList) >= 1:
+ PcdList.append((ValueList, CommentsList, (PcdLineContent, PcdLineNo, FileName)))
+ ValueList = []
+ CommentsList = []
+ continue
+ #
+ # For Binary INF file
+ #
+ else:
+ for Line in SectionString:
+ LineContent = Line[0].strip()
+ LineNo = Line[1]
+
+ if LineContent == '':
+ CommentsList = []
+ continue
+
+ if LineContent.startswith(DT.TAB_COMMENT_SPLIT):
+ CommentsList.append(LineContent)
+ continue
+ #
+ # Have comments at tail.
+ #
+ CommentIndex = LineContent.find(DT.TAB_COMMENT_SPLIT)
+ if CommentIndex > -1:
+ CommentsList.append(LineContent[CommentIndex+1:])
+ LineContent = LineContent[:CommentIndex]
+
+ TokenList = GetSplitValueList(LineContent, DT.TAB_VALUE_SPLIT)
+ #
+ # PatchablePcd
+ # TokenSpace.CName | Value | Offset
+ #
+ if KeysList[0][0].upper() == DT.TAB_INF_PATCH_PCD.upper():
+ if len(TokenList) != 3:
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_ASBUILD_PATCHPCD_FORMAT_INVALID,
+ File=FileName,
+ Line=LineNo,
+ ExtraData=LineContent)
+ #
+ elif KeysList[0][0].upper() == DT.TAB_INF_PCD_EX.upper():
+ if len(TokenList) != 1:
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_ASBUILD_PCDEX_FORMAT_INVALID,
+ File=FileName,
+ Line=LineNo,
+ ExtraData=LineContent)
+ ValueList[0:len(TokenList)] = TokenList
+ if len(ValueList) >= 1:
+ PcdList.append((ValueList, CommentsList, (LineContent, LineNo, FileName)))
+ ValueList = []
+ CommentsList = []
+ continue
+
+ if not InfSectionObject.SetPcds(PcdList, KeysList = KeysList,
+ PackageInfo = self.InfPackageSection.GetPackages()):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR%("[PCD]"),
+ File=FileName,
+ Line=LineIndex)
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py
new file mode 100644
index 000000000..474d37379
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py
@@ -0,0 +1,493 @@
+## @file
+# This file contained the parser for sections in INF file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+InfSectionParser
+'''
+##
+# Import Modules
+#
+from copy import deepcopy
+import re
+
+from Library.StringUtils import GetSplitValueList
+from Library.CommentParsing import ParseHeaderCommentSection
+from Library.CommentParsing import ParseComment
+
+from Library import DataType as DT
+
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger.ToolError import FORMAT_INVALID
+
+from Object.Parser.InfDefineObject import InfDefObject
+from Object.Parser.InfBuildOptionObject import InfBuildOptionsObject
+from Object.Parser.InfLibraryClassesObject import InfLibraryClassObject
+from Object.Parser.InfPackagesObject import InfPackageObject
+from Object.Parser.InfPcdObject import InfPcdObject
+from Object.Parser.InfSoucesObject import InfSourcesObject
+from Object.Parser.InfUserExtensionObject import InfUserExtensionObject
+from Object.Parser.InfProtocolObject import InfProtocolObject
+from Object.Parser.InfPpiObject import InfPpiObject
+from Object.Parser.InfGuidObject import InfGuidObject
+from Object.Parser.InfDepexObject import InfDepexObject
+from Object.Parser.InfBinaryObject import InfBinariesObject
+from Object.Parser.InfHeaderObject import InfHeaderObject
+from Object.Parser.InfMisc import InfSpecialCommentObject
+from Object.Parser.InfMisc import InfHobObject
+from Object.Parser.InfMisc import InfBootModeObject
+from Object.Parser.InfMisc import InfEventObject
+from Parser.InfParserMisc import gINF_SECTION_DEF
+from Parser.InfDefineSectionParser import InfDefinSectionParser
+from Parser.InfBuildOptionSectionParser import InfBuildOptionSectionParser
+from Parser.InfSourceSectionParser import InfSourceSectionParser
+from Parser.InfLibrarySectionParser import InfLibrarySectionParser
+from Parser.InfPackageSectionParser import InfPackageSectionParser
+from Parser.InfGuidPpiProtocolSectionParser import InfGuidPpiProtocolSectionParser
+from Parser.InfBinarySectionParser import InfBinarySectionParser
+from Parser.InfPcdSectionParser import InfPcdSectionParser
+from Parser.InfDepexSectionParser import InfDepexSectionParser
+
+## GetSpecialStr2
+#
+# GetSpecialStr2
+#
+def GetSpecialStr2(ItemList, FileName, LineNo, SectionString):
+ Str2 = ''
+ #
+ # S2 may be Platform or ModuleType
+ #
+ if len(ItemList) == 3:
+ #
+ # Except [LibraryClass], [Depex]
+ # section can has more than 2 items in section header string,
+ # others should report error.
+ #
+ if not (ItemList[0].upper() == DT.TAB_LIBRARY_CLASSES.upper() or \
+ ItemList[0].upper() == DT.TAB_DEPEX.upper() or \
+ ItemList[0].upper() == DT.TAB_USER_EXTENSIONS.upper()):
+ if ItemList[2] != '':
+ Logger.Error('Parser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_SOURCE_SECTION_SECTIONNAME_INVALID % (SectionString),
+ File=FileName,
+ Line=LineNo,
+ ExtraData=SectionString)
+ Str2 = ItemList[2]
+ elif len(ItemList) == 4:
+ #
+ # Except [UserExtension]
+ # section can has 4 items in section header string,
+ # others should report error.
+ #
+ if not ItemList[0].upper() == DT.TAB_USER_EXTENSIONS.upper() or ItemList[0].upper() == DT.TAB_DEPEX.upper():
+ if ItemList[3] != '':
+ Logger.Error('Parser', FORMAT_INVALID, ST.ERR_INF_PARSER_SOURCE_SECTION_SECTIONNAME_INVALID \
+ % (SectionString), File=FileName, Line=LineNo, ExtraData=SectionString)
+
+ if not ItemList[0].upper() == DT.TAB_USER_EXTENSIONS.upper():
+ Str2 = ItemList[2] + ' | ' + ItemList[3]
+ else:
+ Str2 = ItemList[2]
+
+ elif len(ItemList) > 4:
+ Logger.Error('Parser', FORMAT_INVALID, ST.ERR_INF_PARSER_SOURCE_SECTION_SECTIONNAME_INVALID \
+ % (SectionString), File=FileName, Line=LineNo, ExtraData=SectionString)
+
+ return Str2
+
+## ProcessUseExtHeader
+#
+#
+def ProcessUseExtHeader(ItemList):
+ NewItemList = []
+ AppendContent = ''
+ CompleteFlag = False
+ for Item in ItemList:
+ if Item.startswith('\"') and not Item.endswith('\"'):
+ AppendContent = Item
+ CompleteFlag = True
+ elif Item.endswith('\"') and not Item.startswith('\"'):
+ #
+ # Should not have an userId or IdString not starts with " before but ends with ".
+ #
+ if not CompleteFlag:
+ return False, []
+ AppendContent = AppendContent + "." + Item
+ NewItemList.append(AppendContent)
+ CompleteFlag = False
+ AppendContent = ''
+ elif Item.endswith('\"') and Item.startswith('\"'):
+ #
+ # Common item, not need to combine the information
+ #
+ NewItemList.append(Item)
+ else:
+ if not CompleteFlag:
+ NewItemList.append(Item)
+ else:
+ AppendContent = AppendContent + "." + Item
+
+ if len(NewItemList) > 4:
+ return False, []
+
+ return True, NewItemList
+
+## GetArch
+#
+# GetArch
+#
+def GetArch(ItemList, ArchList, FileName, LineNo, SectionString):
+ #
+ # S1 is always Arch
+ #
+ if len(ItemList) > 1:
+ Arch = ItemList[1]
+ else:
+ Arch = 'COMMON'
+ ArchList.add(Arch)
+
+ #
+ # 'COMMON' must not be used with specific ARCHs at the same section
+ #
+ if 'COMMON' in ArchList and len(ArchList) > 1:
+ Logger.Error('Parser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_SECTION_ARCH_CONFLICT,
+ File=FileName,
+ Line=LineNo,
+ ExtraData=SectionString)
+
+ return Arch, ArchList
+
+## InfSectionParser
+#
+# Inherit from object
+#
+class InfSectionParser(InfDefinSectionParser,
+ InfBuildOptionSectionParser,
+ InfSourceSectionParser,
+ InfLibrarySectionParser,
+ InfPackageSectionParser,
+ InfGuidPpiProtocolSectionParser,
+ InfBinarySectionParser,
+ InfPcdSectionParser,
+ InfDepexSectionParser):
+ #
+ # Parser objects used to implement singleton
+ #
+ MetaFiles = {}
+
+ ## Factory method
+ #
+ # One file, one parser object. This factory method makes sure that there's
+ # only one object constructed for one meta file.
+ #
+ # @param Class class object of real AutoGen class
+ # (InfParser, DecParser or DscParser)
+ # @param FilePath The path of meta file
+ #
+ def __new__(cls, FilePath, *args, **kwargs):
+ if args:
+ pass
+ if kwargs:
+ pass
+ if FilePath in cls.MetaFiles:
+ return cls.MetaFiles[FilePath]
+ else:
+ ParserObject = super(InfSectionParser, cls).__new__(cls)
+ cls.MetaFiles[FilePath] = ParserObject
+ return ParserObject
+
+ def __init__(self):
+ InfDefinSectionParser.__init__(self)
+ InfBuildOptionSectionParser.__init__(self)
+ InfSourceSectionParser.__init__(self)
+ InfLibrarySectionParser.__init__(self)
+ InfPackageSectionParser.__init__(self)
+ InfGuidPpiProtocolSectionParser.__init__(self)
+ InfBinarySectionParser.__init__(self)
+ InfPcdSectionParser.__init__(self)
+ InfDepexSectionParser.__init__(self)
+ #
+ # Initialize all objects that an INF file will generated.
+ #
+ self.InfDefSection = InfDefObject()
+ self.InfBuildOptionSection = InfBuildOptionsObject()
+ self.InfLibraryClassSection = InfLibraryClassObject()
+ self.InfPackageSection = InfPackageObject()
+ self.InfPcdSection = InfPcdObject(list(self.MetaFiles.keys())[0])
+ self.InfSourcesSection = InfSourcesObject()
+ self.InfUserExtensionSection = InfUserExtensionObject()
+ self.InfProtocolSection = InfProtocolObject()
+ self.InfPpiSection = InfPpiObject()
+ self.InfGuidSection = InfGuidObject()
+ self.InfDepexSection = InfDepexObject()
+ self.InfPeiDepexSection = InfDepexObject()
+ self.InfDxeDepexSection = InfDepexObject()
+ self.InfSmmDepexSection = InfDepexObject()
+ self.InfBinariesSection = InfBinariesObject()
+ self.InfHeader = InfHeaderObject()
+ self.InfBinaryHeader = InfHeaderObject()
+ self.InfSpecialCommentSection = InfSpecialCommentObject()
+
+ #
+ # A List for store define section content.
+ #
+ self._PcdNameList = []
+ self._SectionName = ''
+ self._SectionType = 0
+ self.RelaPath = ''
+ self.FileName = ''
+
+ #
+ # File Header content parser
+ #
+ def InfHeaderParser(self, Content, InfHeaderObject2, FileName, IsBinaryHeader = False):
+ if IsBinaryHeader:
+ (Abstract, Description, Copyright, License) = ParseHeaderCommentSection(Content, FileName, True)
+ if not Abstract or not Description or not Copyright or not License:
+ Logger.Error('Parser',
+ FORMAT_INVALID,
+ ST.ERR_INVALID_BINARYHEADER_FORMAT,
+ File=FileName)
+ else:
+ (Abstract, Description, Copyright, License) = ParseHeaderCommentSection(Content, FileName)
+ #
+ # Not process file name now, for later usage.
+ #
+ if self.FileName:
+ pass
+
+ #
+ # Insert Abstract, Description, CopyRight, License into header object
+ #
+ InfHeaderObject2.SetAbstract(Abstract)
+ InfHeaderObject2.SetDescription(Description)
+ InfHeaderObject2.SetCopyright(Copyright)
+ InfHeaderObject2.SetLicense(License)
+
+
+
+
+ ## Section header parser
+ #
+ # The section header is always in following format:
+ #
+ # [section_name.arch<.platform|module_type>]
+ #
+ # @param String A string contained the content need to be parsed.
+ #
+ def SectionHeaderParser(self, SectionString, FileName, LineNo):
+ _Scope = []
+ _SectionName = ''
+ ArchList = set()
+ _ValueList = []
+ _PcdNameList = [DT.TAB_INF_FIXED_PCD.upper(),
+ DT.TAB_INF_FEATURE_PCD.upper(),
+ DT.TAB_INF_PATCH_PCD.upper(),
+ DT.TAB_INF_PCD.upper(),
+ DT.TAB_INF_PCD_EX.upper()
+ ]
+ SectionString = SectionString.strip()
+ for Item in GetSplitValueList(SectionString[1:-1], DT.TAB_COMMA_SPLIT):
+ if Item == '':
+ Logger.Error('Parser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % (""),
+ File=FileName,
+ Line=LineNo,
+ ExtraData=SectionString)
+ ItemList = GetSplitValueList(Item, DT.TAB_SPLIT)
+ #
+ # different section should not mix in one section
+ # Allow different PCD type sections mixed together
+ #
+ if _SectionName.upper() not in _PcdNameList:
+ if _SectionName != '' and _SectionName.upper() != ItemList[0].upper():
+ Logger.Error('Parser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_SECTION_NAME_DUPLICATE,
+ File=FileName,
+ Line=LineNo,
+ ExtraData=SectionString)
+ elif _PcdNameList[1] in [_SectionName.upper(), ItemList[0].upper()] and \
+ (_SectionName.upper()!= ItemList[0].upper()):
+ Logger.Error('Parser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % (""),
+ File=FileName,
+ Line=LineNo,
+ ExtraData=SectionString)
+
+ _SectionName = ItemList[0]
+ if _SectionName.upper() in gINF_SECTION_DEF:
+ self._SectionType = gINF_SECTION_DEF[_SectionName.upper()]
+ else:
+ self._SectionType = DT.MODEL_UNKNOWN
+ Logger.Error("Parser",
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_UNKNOWN_SECTION,
+ File=FileName,
+ Line=LineNo,
+ ExtraData=SectionString)
+
+ #
+ # Get Arch
+ #
+ Str1, ArchList = GetArch(ItemList, ArchList, FileName, LineNo, SectionString)
+
+ #
+ # For [Defines] section, do special check.
+ #
+ if ItemList[0].upper() == DT.TAB_COMMON_DEFINES.upper():
+ if len(ItemList) != 1:
+ Logger.Error('Parser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID % (SectionString),
+ File=FileName, Line=LineNo, ExtraData=SectionString)
+
+ #
+ # For [UserExtension] section, do special check.
+ #
+ if ItemList[0].upper() == DT.TAB_USER_EXTENSIONS.upper():
+
+ RetValue = ProcessUseExtHeader(ItemList)
+
+ if not RetValue[0]:
+ Logger.Error('Parser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID % (SectionString),
+ File=FileName, Line=LineNo, ExtraData=SectionString)
+ else:
+ ItemList = RetValue[1]
+
+ if len(ItemList) == 3:
+ ItemList.append('COMMON')
+
+ Str1 = ItemList[1]
+
+ #
+ # For Library classes, need to check module type.
+ #
+ if ItemList[0].upper() == DT.TAB_LIBRARY_CLASSES.upper() and len(ItemList) == 3:
+ if ItemList[2] != '':
+ ModuleTypeList = GetSplitValueList(ItemList[2], DT.TAB_VALUE_SPLIT)
+ for Item in ModuleTypeList:
+ if Item.strip() not in DT.MODULE_LIST:
+ Logger.Error('Parser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_MODULETYPE_INVALID % (Item),
+ File=FileName,
+ Line=LineNo,
+ ExtraData=SectionString)
+ #
+ # GetSpecialStr2
+ #
+ Str2 = GetSpecialStr2(ItemList, FileName, LineNo, SectionString)
+
+ _Scope.append([Str1, Str2])
+
+ _NewValueList = []
+ _AppendFlag = True
+ if _SectionName.upper() in _PcdNameList:
+ for ValueItem in _ValueList:
+ if _SectionName.upper() == ValueItem[0].upper() and Str1.upper() not in ValueItem[1].split():
+ ValueItem[1] = ValueItem[1] + " " + Str1
+ _AppendFlag = False
+ elif _SectionName.upper() == ValueItem[0].upper() and Str1.upper() in ValueItem[1].split():
+ _AppendFlag = False
+
+ _NewValueList.append(ValueItem)
+
+ _ValueList = _NewValueList
+
+ if _AppendFlag:
+ if not ItemList[0].upper() == DT.TAB_USER_EXTENSIONS.upper():
+ _ValueList.append([_SectionName, Str1, Str2, LineNo])
+ else:
+ if len(ItemList) == 4:
+ _ValueList.append([_SectionName, Str1, Str2, ItemList[3], LineNo])
+
+ self.SectionHeaderContent = deepcopy(_ValueList)
+
+ ## GenSpecialSectionList
+ #
+ # @param SpecialSectionList: a list of list, of which item's format
+ # (Comment, LineNum)
+ # @param ContainerFile: Input value for filename of Inf file
+ #
+ def InfSpecialCommentParser (self, SpecialSectionList, InfSectionObject, ContainerFile, SectionType):
+ ReFindSpecialCommentRe = re.compile(r"""#(?:\s*)\[(.*?)\](?:.*)""", re.DOTALL)
+ ReFindHobArchRe = re.compile(r"""[Hh][Oo][Bb]\.([^,]*)""", re.DOTALL)
+ if self.FileName:
+ pass
+ SpecialObjectList = []
+ ArchList = []
+ if SectionType == DT.TYPE_EVENT_SECTION:
+ TokenDict = DT.EVENT_TOKENS
+ elif SectionType == DT.TYPE_HOB_SECTION:
+ TokenDict = DT.HOB_TOKENS
+ else:
+ TokenDict = DT.BOOTMODE_TOKENS
+
+ for List in SpecialSectionList:
+ #
+ # Hob has Arch attribute, need to be handled specially here
+ #
+ if SectionType == DT.TYPE_HOB_SECTION:
+
+ MatchObject = ReFindSpecialCommentRe.search(List[0][0])
+ HobSectionStr = MatchObject.group(1)
+ ArchList = []
+ for Match in ReFindHobArchRe.finditer(HobSectionStr):
+ Arch = Match.groups(1)[0].upper()
+ ArchList.append(Arch)
+ CommentSoFar = ''
+ for Index in range(1, len(List)):
+ Result = ParseComment(List[Index], DT.ALL_USAGE_TOKENS, TokenDict, [], False)
+ Usage = Result[0]
+ Type = Result[1]
+ HelpText = Result[3]
+
+ if Usage == DT.ITEM_UNDEFINED and Type == DT.ITEM_UNDEFINED:
+ if HelpText is None:
+ HelpText = ''
+ if not HelpText.endswith('\n'):
+ HelpText += '\n'
+ CommentSoFar += HelpText
+ else:
+ if HelpText:
+ CommentSoFar += HelpText
+ if SectionType == DT.TYPE_EVENT_SECTION:
+ SpecialObject = InfEventObject()
+ SpecialObject.SetEventType(Type)
+ SpecialObject.SetUsage(Usage)
+ SpecialObject.SetHelpString(CommentSoFar)
+ elif SectionType == DT.TYPE_HOB_SECTION:
+ SpecialObject = InfHobObject()
+ SpecialObject.SetHobType(Type)
+ SpecialObject.SetUsage(Usage)
+ SpecialObject.SetHelpString(CommentSoFar)
+ if len(ArchList) >= 1:
+ SpecialObject.SetSupArchList(ArchList)
+ else:
+ SpecialObject = InfBootModeObject()
+ SpecialObject.SetSupportedBootModes(Type)
+ SpecialObject.SetUsage(Usage)
+ SpecialObject.SetHelpString(CommentSoFar)
+
+ SpecialObjectList.append(SpecialObject)
+ CommentSoFar = ''
+ if not InfSectionObject.SetSpecialComments(SpecialObjectList,
+ SectionType):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % (SectionType),
+ ContainerFile
+ )
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfSourceSectionParser.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfSourceSectionParser.py
new file mode 100644
index 000000000..916df7ee1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/InfSourceSectionParser.py
@@ -0,0 +1,139 @@
+## @file
+# This file contained the parser for [Sources] sections in INF file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+'''
+InfSourceSectionParser
+'''
+##
+# Import Modules
+#
+
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger.ToolError import FORMAT_INVALID
+from Parser.InfParserMisc import InfExpandMacro
+from Library import DataType as DT
+from Library.Parsing import MacroParser
+from Library.Misc import GetSplitValueList
+from Object.Parser.InfCommonObject import InfLineCommentObject
+from Parser.InfParserMisc import InfParserSectionRoot
+
+class InfSourceSectionParser(InfParserSectionRoot):
+ ## InfSourceParser
+ #
+ #
+ def InfSourceParser(self, SectionString, InfSectionObject, FileName):
+ SectionMacros = {}
+ ValueList = []
+ SourceList = []
+ StillCommentFalg = False
+ HeaderComments = []
+ LineComment = None
+ SectionContent = ''
+ for Line in SectionString:
+ SrcLineContent = Line[0]
+ SrcLineNo = Line[1]
+
+ if SrcLineContent.strip() == '':
+ continue
+
+ #
+ # Found Header Comments
+ #
+ if SrcLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
+ #
+ # Last line is comments, and this line go on.
+ #
+ if StillCommentFalg:
+ HeaderComments.append(Line)
+ SectionContent += SrcLineContent + DT.END_OF_LINE
+ continue
+ #
+ # First time encounter comment
+ #
+ else:
+ #
+ # Clear original data
+ #
+ HeaderComments = []
+ HeaderComments.append(Line)
+ StillCommentFalg = True
+ SectionContent += SrcLineContent + DT.END_OF_LINE
+ continue
+ else:
+ StillCommentFalg = False
+
+ if len(HeaderComments) >= 1:
+ LineComment = InfLineCommentObject()
+ LineCommentContent = ''
+ for Item in HeaderComments:
+ LineCommentContent += Item[0] + DT.END_OF_LINE
+ LineComment.SetHeaderComments(LineCommentContent)
+
+ #
+ # Find Tail comment.
+ #
+ if SrcLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
+ TailComments = SrcLineContent[SrcLineContent.find(DT.TAB_COMMENT_SPLIT):]
+ SrcLineContent = SrcLineContent[:SrcLineContent.find(DT.TAB_COMMENT_SPLIT)]
+ if LineComment is None:
+ LineComment = InfLineCommentObject()
+ LineComment.SetTailComments(TailComments)
+
+ #
+ # Find Macro
+ #
+ Name, Value = MacroParser((SrcLineContent, SrcLineNo),
+ FileName,
+ DT.MODEL_EFI_SOURCE_FILE,
+ self.FileLocalMacros)
+ if Name is not None:
+ SectionMacros[Name] = Value
+ LineComment = None
+ HeaderComments = []
+ continue
+
+ #
+ # Replace with Local section Macro and [Defines] section Macro.
+ #
+ SrcLineContent = InfExpandMacro(SrcLineContent,
+ (FileName, SrcLineContent, SrcLineNo),
+ self.FileLocalMacros,
+ SectionMacros)
+
+ TokenList = GetSplitValueList(SrcLineContent, DT.TAB_VALUE_SPLIT, 4)
+ ValueList[0:len(TokenList)] = TokenList
+
+ #
+ # Store section content string after MACRO replaced.
+ #
+ SectionContent += SrcLineContent + DT.END_OF_LINE
+
+ SourceList.append((ValueList, LineComment,
+ (SrcLineContent, SrcLineNo, FileName)))
+ ValueList = []
+ LineComment = None
+ TailComments = ''
+ HeaderComments = []
+ continue
+
+ #
+ # Current section archs
+ #
+ ArchList = []
+ for Item in self.LastSectionHeaderContent:
+ if Item[1] not in ArchList:
+ ArchList.append(Item[1])
+ InfSectionObject.SetSupArchList(Item[1])
+
+ InfSectionObject.SetAllContent(SectionContent)
+ if not InfSectionObject.SetSources(SourceList, Arch = ArchList):
+ Logger.Error('InfParser',
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % ("[Sources]"),
+ File=FileName,
+ Line=Item[3])
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Parser/__init__.py b/roms/edk2/BaseTools/Source/Python/UPT/Parser/__init__.py
new file mode 100644
index 000000000..785b56df6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Parser/__init__.py
@@ -0,0 +1,14 @@
+## @file
+# Python 'Parser' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Parser
+'''
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/DecPomAlignment.py b/roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/DecPomAlignment.py
new file mode 100644
index 000000000..da92fe5d3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/DecPomAlignment.py
@@ -0,0 +1,1000 @@
+## @file DecPomAlignment.py
+# This file contained the adapter for convert INF parser object to POM Object
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+DecPomAlignment
+'''
+from __future__ import print_function
+
+##
+# Import Modules
+#
+import os.path
+from os import sep
+import platform
+
+import re
+import Logger.Log as Logger
+from Logger import StringTable as ST
+from Logger.ToolError import UPT_MUL_DEC_ERROR
+from Logger.ToolError import FORMAT_INVALID
+
+from Library.Parsing import NormPath
+from Library.DataType import ARCH_LIST
+from Library.DataType import TAB_GUIDS
+from Library.DataType import TAB_PROTOCOLS
+from Library.DataType import TAB_PPIS
+from Library.DataType import TAB_DEC_DEFINES_PACKAGE_NAME
+from Library.DataType import TAB_DEC_DEFINES_PACKAGE_GUID
+from Library.DataType import TAB_DEC_DEFINES_PACKAGE_VERSION
+from Library.DataType import TAB_DEC_DEFINES_DEC_SPECIFICATION
+from Library.DataType import TAB_DEC_DEFINES_PKG_UNI_FILE
+from Library.DataType import TAB_ARCH_COMMON
+from Library.DataType import TAB_INCLUDES
+from Library.DataType import TAB_LIBRARY_CLASSES
+from Library.DataType import TAB_PCDS
+from Library.DataType import TAB_PCDS_FIXED_AT_BUILD_NULL
+from Library.DataType import TAB_PCDS_PATCHABLE_IN_MODULE_NULL
+from Library.DataType import TAB_PCDS_FEATURE_FLAG_NULL
+from Library.DataType import TAB_PCDS_DYNAMIC_EX_NULL
+from Library.DataType import TAB_PCDS_DYNAMIC_NULL
+from Library.DataType import TAB_PTR_TYPE_PCD
+from Library.DataType import ITEM_UNDEFINED
+from Library.DataType import TAB_DEC_BINARY_ABSTRACT
+from Library.DataType import TAB_DEC_BINARY_DESCRIPTION
+from Library.DataType import TAB_LANGUAGE_EN_US
+from Library.DataType import TAB_BINARY_HEADER_IDENTIFIER
+from Library.DataType import TAB_BINARY_HEADER_USERID
+from Library.DataType import TAB_LANGUAGE_EN_X
+from Library.DataType import TAB_LANGUAGE_EN
+from Library.DataType import TAB_STR_TOKENCNAME
+from Library.DataType import TAB_STR_TOKENPROMPT
+from Library.DataType import TAB_STR_TOKENHELP
+from Library.DataType import TAB_STR_TOKENERR
+from Library.DataType import TAB_HEX_START
+from Library.DataType import TAB_SPLIT
+import Library.DataType as DT
+from Library.CommentParsing import ParseHeaderCommentSection
+from Library.CommentParsing import ParseGenericComment
+from Library.CommentParsing import ParseDecPcdGenericComment
+from Library.CommentParsing import ParseDecPcdTailComment
+from Library.Misc import GetFiles
+from Library.Misc import Sdict
+from Library.Misc import GetRelativePath
+from Library.Misc import PathClass
+from Library.Misc import ValidateUNIFilePath
+from Library.UniClassObject import UniFileClassObject
+from Library.UniClassObject import ConvertSpecialUnicodes
+from Library.UniClassObject import GetLanguageCode1766
+from Library.ParserValidate import IsValidPath
+from Parser.DecParser import Dec
+from Object.POM.PackageObject import PackageObject
+from Object.POM.CommonObject import UserExtensionObject
+from Object.POM.CommonObject import IncludeObject
+from Object.POM.CommonObject import GuidObject
+from Object.POM.CommonObject import ProtocolObject
+from Object.POM.CommonObject import PpiObject
+from Object.POM.CommonObject import LibraryClassObject
+from Object.POM.CommonObject import PcdObject
+from Object.POM.CommonObject import TextObject
+from Object.POM.CommonObject import MiscFileObject
+from Object.POM.CommonObject import FileObject
+
+
+## DecPomAlignment
+#
+# Inherited from PackageObject
+#
+class DecPomAlignment(PackageObject):
+ def __init__(self, Filename, WorkspaceDir = None, CheckMulDec = False):
+ PackageObject.__init__(self)
+ self.UserExtensions = ''
+ self.WorkspaceDir = WorkspaceDir
+ self.SupArchList = ARCH_LIST
+ self.CheckMulDec = CheckMulDec
+ self.DecParser = None
+ self.UniFileClassObject = None
+ self.PcdDefaultValueDict = {}
+
+ #
+ # Load Dec file
+ #
+ self.LoadDecFile(Filename)
+
+ #
+ # Transfer to Package Object if IsToPackage is True
+ #
+ self.DecToPackage()
+
+ ## Load Dec file
+ #
+ # Load the file if it exists
+ #
+ # @param Filename: Input value for filename of Dec file
+ #
+ def LoadDecFile(self, Filename):
+ #
+ # Insert a record for file
+ #
+ Filename = NormPath(Filename)
+ (Path, Name) = os.path.split(Filename)
+ self.SetFullPath(Filename)
+ self.SetRelaPath(Path)
+ self.SetFileName(Name)
+ self.SetPackagePath(GetRelativePath(Path, self.WorkspaceDir))
+ self.SetCombinePath(GetRelativePath(Filename, self.WorkspaceDir))
+
+ self.DecParser = Dec(Filename)
+
+ ## Transfer to Package Object
+ #
+ # Transfer all contents of a Dec file to a standard Package Object
+ #
+ def DecToPackage(self):
+ #
+ # Init global information for the file
+ #
+ ContainerFile = self.GetFullPath()
+
+ #
+ # Generate Package Header
+ #
+ self.GenPackageHeader(ContainerFile)
+
+ #
+ # Generate Includes
+ #
+ self.GenIncludes(ContainerFile)
+
+ #
+ # Generate Guids
+ #
+ self.GenGuidProtocolPpis(TAB_GUIDS, ContainerFile)
+
+ #
+ # Generate Protocols
+ #
+ self.GenGuidProtocolPpis(TAB_PROTOCOLS, ContainerFile)
+
+ #
+ # Generate Ppis
+ #
+ self.GenGuidProtocolPpis(TAB_PPIS, ContainerFile)
+
+ #
+ # Generate LibraryClasses
+ #
+ self.GenLibraryClasses(ContainerFile)
+
+ #
+ # Generate Pcds
+ #
+ self.GenPcds(ContainerFile)
+
+ #
+ # Generate Module File list, will be used later on to generate
+ # distribution
+ #
+ self.GenModuleFileList(ContainerFile)
+
+ #
+ # Generate user extensions
+ #
+ self.GenUserExtensions()
+
+ ## Generate user extension
+ #
+ #
+ def GenUserExtensions(self):
+ UEObj = self.DecParser.GetUserExtensionSectionObject()
+ UEList = UEObj.GetAllUserExtensions()
+ for Item in UEList:
+ if not Item.UserString:
+ continue
+ UserExtension = UserExtensionObject()
+ UserId = Item.UserId
+ if UserId.startswith('"') and UserId.endswith('"'):
+ UserId = UserId[1:-1]
+ UserExtension.SetUserID(UserId)
+ Identifier = Item.IdString
+ if Identifier.startswith('"') and Identifier.endswith('"'):
+ Identifier = Identifier[1:-1]
+ #
+ # Generate miscellaneous files of DEC file
+ #
+ if UserId == 'TianoCore' and Identifier == 'ExtraFiles':
+ self.GenMiscFiles(Item.UserString)
+ UserExtension.SetIdentifier(Identifier)
+ UserExtension.SetStatement(Item.UserString)
+ UserExtension.SetSupArchList(
+ Item.ArchAndModuleType
+ )
+ self.SetUserExtensionList(
+ self.GetUserExtensionList() + [UserExtension]
+ )
+
+ # Add Private sections to UserExtension
+ if self.DecParser.GetPrivateSections():
+ PrivateUserExtension = UserExtensionObject()
+ PrivateUserExtension.SetStatement(self.DecParser.GetPrivateSections())
+ PrivateUserExtension.SetIdentifier(DT.TAB_PRIVATE)
+ PrivateUserExtension.SetUserID(DT.TAB_INTEL)
+ self.SetUserExtensionList(self.GetUserExtensionList() + [PrivateUserExtension])
+
+ ## Generate miscellaneous files on DEC file
+ #
+ #
+ def GenMiscFiles(self, Content):
+ MiscFileObj = MiscFileObject()
+ for Line in Content.splitlines():
+ FileName = ''
+ if '#' in Line:
+ FileName = Line[:Line.find('#')]
+ else:
+ FileName = Line
+ if FileName:
+ if IsValidPath(FileName, self.GetRelaPath()):
+ FileObj = FileObject()
+ FileObj.SetURI(FileName)
+ MiscFileObj.SetFileList(MiscFileObj.GetFileList()+[FileObj])
+ else:
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(Line),
+ File=self.GetFileName(),
+ ExtraData=Line)
+ self.SetMiscFileList(self.GetMiscFileList()+[MiscFileObj])
+
+ ## Generate Package Header
+ #
+ # Gen Package Header of Dec as <Key> = <Value>
+ #
+ # @param ContainerFile: The Dec file full path
+ #
+ def GenPackageHeader(self, ContainerFile):
+ Logger.Debug(2, "Generate PackageHeader ...")
+ DefinesDict = {}
+
+ #
+ # Update all defines item in database
+ #
+ DefObj = self.DecParser.GetDefineSectionObject()
+ for Item in DefObj.GetDefines():
+ #
+ # put items into Dict except for PackageName, Guid, Version, DEC_SPECIFICATION
+ #
+ SkipItemList = [TAB_DEC_DEFINES_PACKAGE_NAME, \
+ TAB_DEC_DEFINES_PACKAGE_GUID, TAB_DEC_DEFINES_PACKAGE_VERSION, \
+ TAB_DEC_DEFINES_DEC_SPECIFICATION, TAB_DEC_DEFINES_PKG_UNI_FILE]
+ if Item.Key in SkipItemList:
+ continue
+ DefinesDict['%s = %s' % (Item.Key, Item.Value)] = TAB_ARCH_COMMON
+
+ self.SetBaseName(DefObj.GetPackageName())
+ self.SetVersion(DefObj.GetPackageVersion())
+# self.SetName(DefObj.GetPackageName() + ' Version ' + \
+# DefObj.GetPackageVersion())
+ self.SetName(os.path.splitext(self.GetFileName())[0])
+ self.SetGuid(DefObj.GetPackageGuid())
+ if DefObj.GetPackageUniFile():
+ ValidateUNIFilePath(DefObj.GetPackageUniFile())
+ self.UniFileClassObject = \
+ UniFileClassObject([PathClass(os.path.join(DefObj.GetPackagePath(), DefObj.GetPackageUniFile()))])
+ else:
+ self.UniFileClassObject = None
+
+ if DefinesDict:
+ UserExtension = UserExtensionObject()
+ UserExtension.SetDefinesDict(DefinesDict)
+ UserExtension.SetIdentifier('DefineModifiers')
+ UserExtension.SetUserID('EDK2')
+ self.SetUserExtensionList(
+ self.GetUserExtensionList() + [UserExtension]
+ )
+
+ #
+ # Get File header information
+ #
+ if self.UniFileClassObject:
+ Lang = TAB_LANGUAGE_EN_X
+ else:
+ Lang = TAB_LANGUAGE_EN_US
+ Abstract, Description, Copyright, License = \
+ ParseHeaderCommentSection(self.DecParser.GetHeadComment(),
+ ContainerFile)
+ if Abstract:
+ self.SetAbstract((Lang, Abstract))
+ if Description:
+ self.SetDescription((Lang, Description))
+ if Copyright:
+ self.SetCopyright(('', Copyright))
+ if License:
+ self.SetLicense(('', License))
+
+ #
+ # Get Binary header information
+ #
+ if self.DecParser.BinaryHeadComment:
+ Abstract, Description, Copyright, License = \
+ ParseHeaderCommentSection(self.DecParser.BinaryHeadComment,
+ ContainerFile, True)
+
+ if not Abstract or not Description or not Copyright or not License:
+ Logger.Error('MkPkg',
+ FORMAT_INVALID,
+ ST.ERR_INVALID_BINARYHEADER_FORMAT,
+ ContainerFile)
+ else:
+ self.SetBinaryHeaderAbstract((Lang, Abstract))
+ self.SetBinaryHeaderDescription((Lang, Description))
+ self.SetBinaryHeaderCopyright(('', Copyright))
+ self.SetBinaryHeaderLicense(('', License))
+
+ BinaryAbstractList = []
+ BinaryDescriptionList = []
+
+ #Get Binary header from UNI file
+ # Initialize the UniStrDict dictionary, top keys are language codes
+ UniStrDict = {}
+ if self.UniFileClassObject:
+ UniStrDict = self.UniFileClassObject.OrderedStringList
+ for Lang in UniStrDict:
+ for StringDefClassObject in UniStrDict[Lang]:
+ Lang = GetLanguageCode1766(Lang)
+ if StringDefClassObject.StringName == TAB_DEC_BINARY_ABSTRACT:
+ if (Lang, ConvertSpecialUnicodes(StringDefClassObject.StringValue)) \
+ not in self.GetBinaryHeaderAbstract():
+ BinaryAbstractList.append((Lang, ConvertSpecialUnicodes(StringDefClassObject.StringValue)))
+ if StringDefClassObject.StringName == TAB_DEC_BINARY_DESCRIPTION:
+ if (Lang, ConvertSpecialUnicodes(StringDefClassObject.StringValue)) \
+ not in self.GetBinaryHeaderDescription():
+ BinaryDescriptionList.append((Lang,
+ ConvertSpecialUnicodes(StringDefClassObject.StringValue)))
+ #Combine Binary header from DEC file and UNI file
+ BinaryAbstractList = self.GetBinaryHeaderAbstract() + BinaryAbstractList
+ BinaryDescriptionList = self.GetBinaryHeaderDescription() + BinaryDescriptionList
+ BinaryCopyrightList = self.GetBinaryHeaderCopyright()
+ BinaryLicenseList = self.GetBinaryHeaderLicense()
+ #Generate the UserExtensionObject for TianoCore."BinaryHeader"
+ if BinaryAbstractList or BinaryDescriptionList or BinaryCopyrightList or BinaryLicenseList:
+ BinaryUserExtension = UserExtensionObject()
+ BinaryUserExtension.SetBinaryAbstract(BinaryAbstractList)
+ BinaryUserExtension.SetBinaryDescription(BinaryDescriptionList)
+ BinaryUserExtension.SetBinaryCopyright(BinaryCopyrightList)
+ BinaryUserExtension.SetBinaryLicense(BinaryLicenseList)
+ BinaryUserExtension.SetIdentifier(TAB_BINARY_HEADER_IDENTIFIER)
+ BinaryUserExtension.SetUserID(TAB_BINARY_HEADER_USERID)
+ self.SetUserExtensionList(self.GetUserExtensionList() + [BinaryUserExtension])
+
+
+ ## GenIncludes
+ #
+ # Gen Includes of Dec
+ #
+ # @param ContainerFile: The Dec file full path
+ #
+ def GenIncludes(self, ContainerFile):
+ if ContainerFile:
+ pass
+ Logger.Debug(2, "Generate %s ..." % TAB_INCLUDES)
+ IncludesDict = Sdict()
+
+ IncObj = self.DecParser.GetIncludeSectionObject()
+ for Item in IncObj.GetAllIncludes():
+ IncludePath = os.path.normpath(Item.File)
+ if platform.system() != 'Windows' and platform.system() != 'Microsoft':
+ IncludePath = IncludePath.replace('\\', '/')
+ if IncludePath in IncludesDict:
+ if Item.GetArchList() == [TAB_ARCH_COMMON] or IncludesDict[IncludePath] == [TAB_ARCH_COMMON]:
+ IncludesDict[IncludePath] = [TAB_ARCH_COMMON]
+ else:
+ IncludesDict[IncludePath] = IncludesDict[IncludePath] + Item.GetArchList()
+ else:
+ IncludesDict[IncludePath] = Item.GetArchList()
+
+ #
+ # get the standardIncludeFileList(industry), packageIncludeFileList
+ # (others) for PackageObject
+ #
+ PackagePath = os.path.split(self.GetFullPath())[0]
+ IncludePathList = \
+ sorted([os.path.normpath(Path) + sep for Path in IncludesDict.keys()])
+
+ #
+ # get a non-overlap set of include path, IncludePathList should be
+ # sorted, and path should be end with path separator '\'
+ #
+ NonOverLapList = []
+ for Path1 in IncludePathList:
+ for Path2 in NonOverLapList:
+ if Path1.startswith(Path2):
+ break
+ else:
+ NonOverLapList.append(Path1)
+ #
+ # revert the list so the longest path shown first in list, also need
+ # to remove the extra path separator '\'
+ # as this list is used to search the supported Arch info
+ #
+ for IndexN in range (0, len(IncludePathList)):
+ IncludePathList[IndexN] = os.path.normpath(IncludePathList[IndexN])
+ IncludePathList.sort()
+ IncludePathList.reverse()
+ #
+ # save the include path list for later usage
+ #
+ self.SetIncludePathList(IncludePathList)
+ StandardIncludeFileList = []
+ PackageIncludeFileList = []
+
+ IncludeFileList = []
+ for Path in NonOverLapList:
+ FileList = GetFiles(os.path.join(PackagePath, Path), ['CVS', '.svn'], False)
+ IncludeFileList += [os.path.normpath(os.path.join(Path, File)) for File in FileList]
+ for Includefile in IncludeFileList:
+ ExtName = os.path.splitext(Includefile)[1]
+ if ExtName.upper() == '.DEC' and self.CheckMulDec:
+ Logger.Error('MkPkg',
+ UPT_MUL_DEC_ERROR,
+ ST.ERR_MUL_DEC_ERROR%(os.path.dirname(ContainerFile),
+ os.path.basename(ContainerFile),
+ Includefile))
+
+ FileCombinePath = os.path.dirname(Includefile)
+ Include = IncludeObject()
+ for Path in IncludePathList:
+ if FileCombinePath.startswith(Path):
+ SupArchList = IncludesDict[Path]
+ break
+ Include.SetFilePath(Includefile)
+ Include.SetSupArchList(SupArchList)
+ if Includefile.find('IndustryStandard') != -1:
+ StandardIncludeFileList.append(Include)
+ else:
+ PackageIncludeFileList.append(Include)
+
+ self.SetStandardIncludeFileList(StandardIncludeFileList)
+
+ #
+ # put include path into the PackageIncludeFileList
+ #
+ PackagePathList = []
+ IncObj = self.DecParser.GetIncludeSectionObject()
+ for Item in IncObj.GetAllIncludes():
+ IncludePath = Item.File
+ Include = IncludeObject()
+ Include.SetFilePath(IncludePath)
+ Include.SetSupArchList(Item.GetArchList())
+ PackagePathList.append(Include)
+ self.SetPackageIncludeFileList(PackagePathList + PackageIncludeFileList)
+
+ ## GenPpis
+ #
+ # Gen Ppis of Dec
+ # <CName>=<GuidValue>
+ #
+ # @param ContainerFile: The Dec file full path
+ #
+ def GenGuidProtocolPpis(self, Type, ContainerFile):
+ if ContainerFile:
+ pass
+ Logger.Debug(2, "Generate %s ..." % Type)
+
+ Obj = None
+ Factory = None
+ if Type == TAB_GUIDS:
+ Obj = self.DecParser.GetGuidSectionObject()
+ def CreateGuidObject():
+ Object = GuidObject()
+ Object.SetGuidTypeList([])
+ Object.SetUsage(None)
+ Object.SetName(None)
+ return Object
+ Factory = CreateGuidObject
+ elif Type == TAB_PROTOCOLS:
+ Obj = self.DecParser.GetProtocolSectionObject()
+
+ def CreateProtocolObject():
+ return ProtocolObject()
+ Factory = CreateProtocolObject
+ elif Type == TAB_PPIS:
+ Obj = self.DecParser.GetPpiSectionObject()
+
+ def CreatePpiObject():
+ return PpiObject()
+ Factory = CreatePpiObject
+ else:
+ #
+ # Should not be here
+ #
+ return
+
+ DeclarationsList = []
+
+ #
+ # Go through each arch
+ #
+ for Item in Obj.GetGuidStyleAllItems():
+ Name = Item.GuidCName
+ Value = Item.GuidString
+ HelpTxt = ParseGenericComment(Item.GetHeadComment() + \
+ Item.GetTailComment())
+
+ ListObject = Factory()
+ ListObject.SetCName(Name)
+ ListObject.SetGuid(Value)
+ ListObject.SetSupArchList(Item.GetArchList())
+ if HelpTxt:
+ if self.UniFileClassObject:
+ HelpTxt.SetLang(TAB_LANGUAGE_EN_X)
+ ListObject.SetHelpTextList([HelpTxt])
+
+ DeclarationsList.append(ListObject)
+
+ #
+ #GuidTypeList is abstracted from help
+ #
+ if Type == TAB_GUIDS:
+ self.SetGuidList(self.GetGuidList() + DeclarationsList)
+ elif Type == TAB_PROTOCOLS:
+ self.SetProtocolList(self.GetProtocolList() + DeclarationsList)
+ elif Type == TAB_PPIS:
+ self.SetPpiList(self.GetPpiList() + DeclarationsList)
+
+ ## GenLibraryClasses
+ #
+ # Gen LibraryClasses of Dec
+ # <CName>=<GuidValue>
+ #
+ # @param ContainerFile: The Dec file full path
+ #
+ def GenLibraryClasses(self, ContainerFile):
+ if ContainerFile:
+ pass
+ Logger.Debug(2, "Generate %s ..." % TAB_LIBRARY_CLASSES)
+ LibraryClassDeclarations = []
+
+ LibObj = self.DecParser.GetLibraryClassSectionObject()
+ for Item in LibObj.GetAllLibraryclasses():
+ LibraryClass = LibraryClassObject()
+ LibraryClass.SetLibraryClass(Item.Libraryclass)
+ LibraryClass.SetSupArchList(Item.GetArchList())
+ LibraryClass.SetIncludeHeader(Item.File)
+ HelpTxt = ParseGenericComment(Item.GetHeadComment() + \
+ Item.GetTailComment(), None, '@libraryclass')
+ if HelpTxt:
+ if self.UniFileClassObject:
+ HelpTxt.SetLang(TAB_LANGUAGE_EN_X)
+ LibraryClass.SetHelpTextList([HelpTxt])
+ LibraryClassDeclarations.append(LibraryClass)
+
+ self.SetLibraryClassList(self.GetLibraryClassList() + \
+ LibraryClassDeclarations)
+
+ ## GenPcds
+ #
+ # Gen Pcds of Dec
+ # <TokenSpcCName>.<TokenCName>|<Value>|<DatumType>|<Token>
+ #
+ # @param ContainerFile: The Dec file full path
+ #
+ def GenPcds(self, ContainerFile):
+ Logger.Debug(2, "Generate %s ..." % TAB_PCDS)
+ PcdObj = self.DecParser.GetPcdSectionObject()
+ #
+ # Get all Pcds
+ #
+ PcdDeclarations = []
+ IterList = [
+ (TAB_PCDS_FIXED_AT_BUILD_NULL, 'FixedPcd'),
+ (TAB_PCDS_PATCHABLE_IN_MODULE_NULL, 'PatchPcd'),
+ (TAB_PCDS_FEATURE_FLAG_NULL, 'FeaturePcd'),
+ (TAB_PCDS_DYNAMIC_EX_NULL, 'PcdEx'),
+ (TAB_PCDS_DYNAMIC_NULL, 'Pcd')]
+
+ PromptStrList = []
+ HelpStrList = []
+ PcdErrStrList = []
+ # Initialize UniStrDict dictionary, top keys are language codes
+ UniStrDict = {}
+ StrList = []
+
+ Language = ''
+ if self.UniFileClassObject:
+ Language = TAB_LANGUAGE_EN_X
+ else:
+ Language = TAB_LANGUAGE_EN_US
+
+ if self.UniFileClassObject:
+ UniStrDict = self.UniFileClassObject.OrderedStringList
+ for Lang in UniStrDict:
+ for StringDefClassObject in UniStrDict[Lang]:
+ StrList = StringDefClassObject.StringName.split('_')
+ # StringName format is STR_<TOKENSPACECNAME>_<PCDCNAME>_PROMPT
+ if len(StrList) == 4 and StrList[0] == TAB_STR_TOKENCNAME and StrList[3] == TAB_STR_TOKENPROMPT:
+ PromptStrList.append((GetLanguageCode1766(Lang), StringDefClassObject.StringName, \
+ StringDefClassObject.StringValue))
+ # StringName format is STR_<TOKENSPACECNAME>_<PCDCNAME>_HELP
+ if len(StrList) == 4 and StrList[0] == TAB_STR_TOKENCNAME and StrList[3] == TAB_STR_TOKENHELP:
+ HelpStrList.append((GetLanguageCode1766(Lang), StringDefClassObject.StringName, \
+ StringDefClassObject.StringValue))
+ # StringName format is STR_<TOKENSPACECNAME>_ERR_##
+ if len(StrList) == 4 and StrList[0] == TAB_STR_TOKENCNAME and StrList[2] == TAB_STR_TOKENERR:
+ PcdErrStrList.append((GetLanguageCode1766(Lang), StringDefClassObject.StringName, \
+ StringDefClassObject.StringValue))
+ #
+ # For each PCD type
+ #
+ for PcdType, Type in IterList:
+ #
+ # Go through all archs
+ #
+ # for Arch in self.SupArchList + [TAB_ARCH_COMMON]:
+ #
+ for Item in PcdObj.GetPcdsByType(PcdType.upper()):
+ PcdDeclaration = GenPcdDeclaration(
+ ContainerFile,
+ (Item.TokenSpaceGuidCName, Item.TokenCName,
+ Item.DefaultValue, Item.DatumType, Item.TokenValue,
+ Type, Item.GetHeadComment(), Item.GetTailComment(), ''),
+ Language,
+ self.DecParser.GetDefineSectionMacro()
+ )
+ PcdDeclaration.SetSupArchList(Item.GetArchListOfType(PcdType))
+
+ #
+ # Get PCD error message from PCD error comment section in DEC file
+ #
+ for PcdErr in PcdDeclaration.GetPcdErrorsList():
+ if (PcdDeclaration.GetTokenSpaceGuidCName(), PcdErr.GetErrorNumber()) \
+ in self.DecParser.PcdErrorCommentDict:
+ Key = (PcdDeclaration.GetTokenSpaceGuidCName(), PcdErr.GetErrorNumber())
+ PcdErr.SetErrorMessageList(PcdErr.GetErrorMessageList() + \
+ [(Language, self.DecParser.PcdErrorCommentDict[Key])])
+
+ for Index in range(0, len(PromptStrList)):
+ StrNameList = PromptStrList[Index][1].split('_')
+ if StrNameList[1].lower() == Item.TokenSpaceGuidCName.lower() and \
+ StrNameList[2].lower() == Item.TokenCName.lower():
+ TxtObj = TextObject()
+ TxtObj.SetLang(PromptStrList[Index][0])
+ TxtObj.SetString(PromptStrList[Index][2])
+ for Prompt in PcdDeclaration.GetPromptList():
+ if Prompt.GetLang() == TxtObj.GetLang() and \
+ Prompt.GetString() == TxtObj.GetString():
+ break
+ else:
+ PcdDeclaration.SetPromptList(PcdDeclaration.GetPromptList() + [TxtObj])
+
+ for Index in range(0, len(HelpStrList)):
+ StrNameList = HelpStrList[Index][1].split('_')
+ if StrNameList[1].lower() == Item.TokenSpaceGuidCName.lower() and \
+ StrNameList[2].lower() == Item.TokenCName.lower():
+ TxtObj = TextObject()
+ TxtObj.SetLang(HelpStrList[Index][0])
+ TxtObj.SetString(HelpStrList[Index][2])
+ for HelpStrObj in PcdDeclaration.GetHelpTextList():
+ if HelpStrObj.GetLang() == TxtObj.GetLang() and \
+ HelpStrObj.GetString() == TxtObj.GetString():
+ break
+ else:
+ PcdDeclaration.SetHelpTextList(PcdDeclaration.GetHelpTextList() + [TxtObj])
+
+ #
+ # Get PCD error message from UNI file
+ #
+ for Index in range(0, len(PcdErrStrList)):
+ StrNameList = PcdErrStrList[Index][1].split('_')
+ if StrNameList[1].lower() == Item.TokenSpaceGuidCName.lower() and \
+ StrNameList[2].lower() == TAB_STR_TOKENERR.lower():
+ for PcdErr in PcdDeclaration.GetPcdErrorsList():
+ if PcdErr.GetErrorNumber().lower() == (TAB_HEX_START + StrNameList[3]).lower() and \
+ (PcdErrStrList[Index][0], PcdErrStrList[Index][2]) not in PcdErr.GetErrorMessageList():
+ PcdErr.SetErrorMessageList(PcdErr.GetErrorMessageList() + \
+ [(PcdErrStrList[Index][0], PcdErrStrList[Index][2])])
+
+ #
+ # Check to prevent missing error message if a Pcd has the error code.
+ #
+ for PcdErr in PcdDeclaration.GetPcdErrorsList():
+ if PcdErr.GetErrorNumber().strip():
+ if not PcdErr.GetErrorMessageList():
+ Logger.Error('UPT',
+ FORMAT_INVALID,
+ ST.ERR_DECPARSE_PCD_UNMATCHED_ERRORCODE % PcdErr.GetErrorNumber(),
+ ContainerFile,
+ PcdErr.GetLineNum(),
+ PcdErr.GetFileLine())
+
+ PcdDeclarations.append(PcdDeclaration)
+ self.SetPcdList(self.GetPcdList() + PcdDeclarations)
+ self.CheckPcdValue()
+
+ ##
+ # Get error message via language
+ # @param ErrorMessageList: Error message tuple list the language and its message
+ # @param Lang: the language of setting
+ # @return: the error message described in the related UNI file
+ def GetEnErrorMessage(self, ErrorMessageList):
+ if self.FullPath:
+ pass
+ Lang = TAB_LANGUAGE_EN_US
+ for (Language, Message) in ErrorMessageList:
+ if Language == Lang:
+ return Message
+ for (Language, Message) in ErrorMessageList:
+ if Language.find(TAB_LANGUAGE_EN) >= 0:
+ return Message
+ else:
+ try:
+ return ErrorMessageList[0][1]
+ except IndexError:
+ return ''
+ return ''
+
+ ##
+ # Replace the strings for Python eval function.
+ # @param ReplaceValue: The string that needs to be replaced.
+ # @return: The string was replaced, then eval function is always making out it.
+ def ReplaceForEval(self, ReplaceValue, IsRange=False, IsExpr=False):
+ if self.FullPath:
+ pass
+ #
+ # deal with "NOT EQ", "NOT LT", "NOT GT", "NOT LE", "NOT GE", "NOT NOT"
+ #
+ NOTNOT_Pattern = '[\t\s]*NOT[\t\s]+NOT[\t\s]*'
+ NOTGE_Pattern = '[\t\s]*NOT[\t\s]+GE[\t\s]*'
+ NOTLE_Pattern = '[\t\s]*NOT[\t\s]+LE[\t\s]*'
+ NOTGT_Pattern = '[\t\s]*NOT[\t\s]+GT[\t\s]*'
+ NOTLT_Pattern = '[\t\s]*NOT[\t\s]+LT[\t\s]*'
+ NOTEQ_Pattern = '[\t\s]*NOT[\t\s]+EQ[\t\s]*'
+ ReplaceValue = re.compile(NOTNOT_Pattern).sub('', ReplaceValue)
+ ReplaceValue = re.compile(NOTLT_Pattern).sub('x >= ', ReplaceValue)
+ ReplaceValue = re.compile(NOTGT_Pattern).sub('x <= ', ReplaceValue)
+ ReplaceValue = re.compile(NOTLE_Pattern).sub('x > ', ReplaceValue)
+ ReplaceValue = re.compile(NOTGE_Pattern).sub('x < ', ReplaceValue)
+ ReplaceValue = re.compile(NOTEQ_Pattern).sub('x != ', ReplaceValue)
+
+ if IsRange:
+ ReplaceValue = ReplaceValue.replace('EQ', 'x ==')
+ ReplaceValue = ReplaceValue.replace('LT', 'x <')
+ ReplaceValue = ReplaceValue.replace('LE', 'x <=')
+ ReplaceValue = ReplaceValue.replace('GT', 'x >')
+ ReplaceValue = ReplaceValue.replace('GE', 'x >=')
+ ReplaceValue = ReplaceValue.replace('XOR', 'x ^')
+ elif IsExpr:
+ ReplaceValue = ReplaceValue.replace('EQ', '==')
+ ReplaceValue = ReplaceValue.replace('NE', '!=')
+ ReplaceValue = ReplaceValue.replace('LT', '<')
+ ReplaceValue = ReplaceValue.replace('LE', '<=')
+ ReplaceValue = ReplaceValue.replace('GT', '>')
+ ReplaceValue = ReplaceValue.replace('GE', '>=')
+ ReplaceValue = ReplaceValue.replace('XOR', '^')
+
+ ReplaceValue = ReplaceValue.replace('AND', 'and')
+ ReplaceValue = ReplaceValue.replace('&&', ' and ')
+ ReplaceValue = ReplaceValue.replace('xor', '^')
+ ReplaceValue = ReplaceValue.replace('OR', 'or')
+ ReplaceValue = ReplaceValue.replace('||', ' or ')
+ ReplaceValue = ReplaceValue.replace('NOT', 'not')
+ if ReplaceValue.find('!') >= 0 and ReplaceValue[ReplaceValue.index('!') + 1] != '=':
+ ReplaceValue = ReplaceValue.replace('!', ' not ')
+ if '.' in ReplaceValue:
+ Pattern = '[a-zA-Z0-9]{1,}\.[a-zA-Z0-9]{1,}'
+ MatchedList = re.findall(Pattern, ReplaceValue)
+ for MatchedItem in MatchedList:
+ if MatchedItem not in self.PcdDefaultValueDict:
+ Logger.Error("Dec File Parser", FORMAT_INVALID, Message=ST.ERR_DECPARSE_PCD_NODEFINED % MatchedItem,
+ File=self.FullPath)
+
+ ReplaceValue = ReplaceValue.replace(MatchedItem, self.PcdDefaultValueDict[MatchedItem])
+
+ return ReplaceValue
+
+ ##
+ # Check pcd's default value according to the pcd's description
+ #
+ def CheckPcdValue(self):
+ for Pcd in self.GetPcdList():
+ self.PcdDefaultValueDict[TAB_SPLIT.join((Pcd.GetTokenSpaceGuidCName(), Pcd.GetCName())).strip()] = \
+ Pcd.GetDefaultValue()
+
+ for Pcd in self.GetPcdList():
+ ValidationExpressions = []
+ PcdGuidName = TAB_SPLIT.join((Pcd.GetTokenSpaceGuidCName(), Pcd.GetCName()))
+ Valids = Pcd.GetPcdErrorsList()
+ for Valid in Valids:
+ Expression = Valid.GetExpression()
+ if Expression:
+ #
+ # Delete the 'L' prefix of a quoted string, this operation is for eval()
+ #
+ QUOTED_PATTERN = '[\t\s]*L?"[^"]*"'
+ QuotedMatchedObj = re.search(QUOTED_PATTERN, Expression)
+ if QuotedMatchedObj:
+ MatchedStr = QuotedMatchedObj.group().strip()
+ if MatchedStr.startswith('L'):
+ Expression = Expression.replace(MatchedStr, MatchedStr[1:].strip())
+
+ Expression = self.ReplaceForEval(Expression, IsExpr=True)
+ Expression = Expression.replace(PcdGuidName, 'x')
+ Message = self.GetEnErrorMessage(Valid.GetErrorMessageList())
+ ValidationExpressions.append((Expression, Message))
+
+ ValidList = Valid.GetValidValue()
+ if ValidList:
+ ValidValue = 'x in %s' % [eval(v) for v in ValidList.split(' ') if v]
+ Message = self.GetEnErrorMessage(Valid.GetErrorMessageList())
+ ValidationExpressions.append((ValidValue, Message))
+
+ ValidValueRange = Valid.GetValidValueRange()
+ if ValidValueRange:
+ ValidValueRange = self.ReplaceForEval(ValidValueRange, IsRange=True)
+ if ValidValueRange.find('-') >= 0:
+ ValidValueRange = ValidValueRange.replace('-', '<= x <=')
+ elif not ValidValueRange.startswith('x ') and not ValidValueRange.startswith('not ') \
+ and not ValidValueRange.startswith('not(') and not ValidValueRange.startswith('('):
+ ValidValueRange = 'x %s' % ValidValueRange
+ Message = self.GetEnErrorMessage(Valid.GetErrorMessageList())
+ ValidationExpressions.append((ValidValueRange, Message))
+
+ DefaultValue = self.PcdDefaultValueDict[PcdGuidName.strip()]
+ #
+ # Delete the 'L' prefix of a quoted string, this operation is for eval()
+ #
+ QUOTED_PATTERN = '[\t\s]*L?"[^"]*"'
+ QuotedMatchedObj = re.search(QUOTED_PATTERN, DefaultValue)
+ if QuotedMatchedObj:
+ MatchedStr = QuotedMatchedObj.group().strip()
+ if MatchedStr.startswith('L'):
+ DefaultValue = DefaultValue.replace(MatchedStr, MatchedStr[1:].strip())
+
+ try:
+ DefaultValue = eval(DefaultValue.replace('TRUE', 'True').replace('true', 'True')
+ .replace('FALSE', 'False').replace('false', 'False'))
+ except BaseException:
+ pass
+
+ for (Expression, Msg) in ValidationExpressions:
+ try:
+ if not eval(Expression, {'x':DefaultValue}):
+ Logger.Error("Dec File Parser", FORMAT_INVALID, ExtraData='%s, value = %s' %\
+ (PcdGuidName, DefaultValue), Message=Msg, File=self.FullPath)
+ except TypeError:
+ Logger.Error("Dec File Parser", FORMAT_INVALID, ExtraData=PcdGuidName, \
+ Message=Msg, File=self.FullPath)
+
+ ## GenModuleFileList
+ #
+ def GenModuleFileList(self, ContainerFile):
+ ModuleFileList = []
+ ContainerFileName = os.path.basename(ContainerFile)
+ ContainerFilePath = os.path.dirname(ContainerFile)
+ for Item in GetFiles(ContainerFilePath,
+ ['CVS', '.svn'] + self.GetIncludePathList(), False):
+ ExtName = os.path.splitext(Item)[1]
+ if ExtName.lower() == '.inf':
+ ModuleFileList.append(Item)
+ elif ExtName.upper() == '.DEC' and self.CheckMulDec:
+ if Item == ContainerFileName:
+ continue
+ Logger.Error('MkPkg',
+ UPT_MUL_DEC_ERROR,
+ ST.ERR_MUL_DEC_ERROR%(ContainerFilePath,
+ ContainerFileName,
+ Item))
+
+ self.SetModuleFileList(ModuleFileList)
+
+ ## Show detailed information of Package
+ #
+ # Print all members and their values of Package class
+ #
+ def ShowPackage(self):
+ print('\nName =', self.GetName())
+ print('\nBaseName =', self.GetBaseName())
+ print('\nVersion =', self.GetVersion())
+ print('\nGuid =', self.GetGuid())
+
+ print('\nStandardIncludes = %d ' \
+ % len(self.GetStandardIncludeFileList()), end=' ')
+ for Item in self.GetStandardIncludeFileList():
+ print(Item.GetFilePath(), ' ', Item.GetSupArchList())
+ print('\nPackageIncludes = %d \n' \
+ % len(self.GetPackageIncludeFileList()), end=' ')
+ for Item in self.GetPackageIncludeFileList():
+ print(Item.GetFilePath(), ' ', Item.GetSupArchList())
+
+ print('\nGuids =', self.GetGuidList())
+ for Item in self.GetGuidList():
+ print(Item.GetCName(), Item.GetGuid(), Item.GetSupArchList())
+ print('\nProtocols =', self.GetProtocolList())
+ for Item in self.GetProtocolList():
+ print(Item.GetCName(), Item.GetGuid(), Item.GetSupArchList())
+ print('\nPpis =', self.GetPpiList())
+ for Item in self.GetPpiList():
+ print(Item.GetCName(), Item.GetGuid(), Item.GetSupArchList())
+ print('\nLibraryClasses =', self.GetLibraryClassList())
+ for Item in self.GetLibraryClassList():
+ print(Item.GetLibraryClass(), Item.GetRecommendedInstance(), \
+ Item.GetSupArchList())
+ print('\nPcds =', self.GetPcdList())
+ for Item in self.GetPcdList():
+ print('CName=', Item.GetCName(), 'TokenSpaceGuidCName=', \
+ Item.GetTokenSpaceGuidCName(), \
+ 'DefaultValue=', Item.GetDefaultValue(), \
+ 'ValidUsage=', Item.GetValidUsage(), \
+ 'SupArchList', Item.GetSupArchList(), \
+ 'Token=', Item.GetToken(), 'DatumType=', Item.GetDatumType())
+
+ for Item in self.GetMiscFileList():
+ print(Item.GetName())
+ for FileObjectItem in Item.GetFileList():
+ print(FileObjectItem.GetURI())
+ print('****************\n')
+
+## GenPcdDeclaration
+#
+# @param ContainerFile: File name of the DEC file
+# @param PcdInfo: Pcd information, of format (TokenGuidCName,
+# TokenName, Value, DatumType, Token, Type,
+# GenericComment, TailComment, Arch)
+# @param Language: The language of HelpText, Prompt
+#
+def GenPcdDeclaration(ContainerFile, PcdInfo, Language, MacroReplaceDict):
+ HelpStr = ''
+ PromptStr = ''
+ TailHelpStr = ''
+ TokenGuidCName, TokenName, Value, DatumType, Token, Type, \
+ GenericComment, TailComment, Arch = PcdInfo
+ Pcd = PcdObject()
+ Pcd.SetCName(TokenName)
+ Pcd.SetToken(Token)
+ Pcd.SetTokenSpaceGuidCName(TokenGuidCName)
+ Pcd.SetDatumType(DatumType)
+ Pcd.SetDefaultValue(Value)
+ Pcd.SetValidUsage(Type)
+ #
+ # MaxDatumSize is required field for 'VOID*' PCD
+ #
+ if DatumType == TAB_PTR_TYPE_PCD:
+ Pcd.SetMaxDatumSize(ITEM_UNDEFINED)
+
+ SupArchList = [Arch]
+ Pcd.SetSupArchList(SupArchList)
+
+ if GenericComment:
+ HelpStr, PcdErrList, PromptStr = ParseDecPcdGenericComment(GenericComment,
+ ContainerFile,
+ TokenGuidCName,
+ TokenName,
+ MacroReplaceDict)
+ if PcdErrList:
+ Pcd.SetPcdErrorsList(PcdErrList)
+
+ if TailComment:
+ SupModuleList, TailHelpStr = ParseDecPcdTailComment(TailComment,
+ ContainerFile)
+ if SupModuleList:
+ Pcd.SetSupModuleList(SupModuleList)
+
+ if HelpStr and (not HelpStr.endswith('\n')) and TailHelpStr:
+ HelpStr += '\n'
+ HelpStr += TailHelpStr
+ if HelpStr:
+ HelpTxtObj = TextObject()
+ HelpTxtObj.SetLang(Language)
+ HelpTxtObj.SetString(HelpStr)
+ Pcd.SetHelpTextList([HelpTxtObj])
+ if PromptStr:
+ TxtObj = TextObject()
+ TxtObj.SetLang(Language)
+ TxtObj.SetString(PromptStr)
+ Pcd.SetPromptList([TxtObj])
+
+ return Pcd
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py b/roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py
new file mode 100644
index 000000000..9c406e5f4
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py
@@ -0,0 +1,1071 @@
+## @file InfPomAlignment.py
+# This file contained the adapter for convert INF parser object to POM Object
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+'''
+InfPomAlignment
+'''
+##
+# Import modules
+#
+import os.path
+from Logger import StringTable as ST
+import Logger.Log as Logger
+from Library.StringUtils import FORMAT_INVALID
+from Library.StringUtils import PARSER_ERROR
+from Library.StringUtils import NormPath
+from Library.StringUtils import GetSplitValueList
+from Library.Misc import ConvertVersionToDecimal
+from Library.Misc import GetHelpStringByRemoveHashKey
+from Library.Misc import ConvertArchList
+from Library.Misc import GetRelativePath
+from Library.Misc import PathClass
+from Library.Parsing import GetPkgInfoFromDec
+from Library.UniClassObject import UniFileClassObject
+from Library.UniClassObject import ConvertSpecialUnicodes
+from Library.UniClassObject import GetLanguageCode1766
+from Library import DataType as DT
+from Library import GlobalData
+from Library.ParserValidate import IsValidPath
+from Object.POM import CommonObject
+from Object.POM.ModuleObject import ModuleObject
+from Object.POM.ModuleObject import ExternObject
+from Object.POM.ModuleObject import HobObject
+from Object.POM.ModuleObject import EventObject
+from Object.POM.ModuleObject import BootModeObject
+from Object.POM.ModuleObject import PackageDependencyObject
+from Object.POM.ModuleObject import SourceFileObject
+from Object.POM.ModuleObject import DepexObject
+from Object.POM.ModuleObject import AsBuildLibraryClassObject
+from Object.POM.ModuleObject import AsBuiltObject
+from PomAdapter.InfPomAlignmentMisc import GenModuleHeaderUserExt
+from PomAdapter.InfPomAlignmentMisc import GenBinaryData
+from Parser import InfParser
+from PomAdapter.DecPomAlignment import DecPomAlignment
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+
+## InfPomAlignment
+#
+# Inherit from ModuleObject
+#
+class InfPomAlignment(ModuleObject):
+ ## Construct of InfPomAlignment
+ # Skip means that UPT don't care the syntax of INF, this may be the not
+ # distributed INF files during creation or the INF files checked for
+ # dependency rule during remove.
+ #
+ def __init__(self, FileName, WorkSpace=None, PackagePath='', Skip=False):
+ ModuleObject.__init__(self)
+ self.Parser = None
+ self.FileName = FileName
+ self.WorkSpace = WorkSpace
+ self.CombinePath = ''
+ self.LibModuleTypeList = []
+ self.FullPath = ''
+ self.ModulePath = ''
+ self.WorkspaceDir = " "
+ self.CustomMakefile = []
+ self.UniFileClassObject = None
+ self.SetPackagePath(PackagePath)
+ #
+ # Call GenInfPomObjects function to fill POM object.
+ #
+ if Skip:
+ OrigConfig = Logger.SUPRESS_ERROR
+ Logger.SUPRESS_ERROR = True
+ try:
+ self._GenInfPomObjects(Skip)
+ finally:
+ Logger.SUPRESS_ERROR = OrigConfig
+ else:
+ self._GenInfPomObjects(Skip)
+
+ ##
+ # Generate all POM objects, the original input comes
+ # from INF parser's output
+ #
+ def _GenInfPomObjects(self, Skip):
+ #
+ # Call INF Parser to get information from INF file
+ #
+ self.Parser = InfParser.InfParser(self.FileName, self.WorkSpace)
+ self.FullPath = self.Parser.FullPath
+ self.GetFullPath()
+ self._GenModuleHeader()
+ #
+ # Call GenBinaries after Module Header for Binary INF consideration.
+ #
+ self._GenBinaries()
+ self._GenBuildOptions()
+ self._GenLibraryClasses()
+ self._GenPackages(Skip)
+ self._GenPcds()
+ self._GenSources()
+ self._GenUserExtensions()
+ self._GenGuidProtocolPpis(DT.TAB_GUIDS)
+ self._GenGuidProtocolPpis(DT.TAB_PROTOCOLS)
+ self._GenGuidProtocolPpis(DT.TAB_PPIS)
+ self._GenDepexes()
+
+ ## Convert [Defines] section content to InfDefObject
+ #
+ # Convert [Defines] section content to InfDefObject
+ #
+ # @param Defines The content under [Defines] section
+ # @param ModuleHeader An object of ModuleHeaderClass
+ # @param Arch The supported ARCH
+ #
+ def _GenModuleHeader(self):
+ Logger.Debug(2, "Generate ModuleHeader ...")
+ #
+ # Get all defines information form InfParser Object
+ #
+ RecordSet = self.Parser.InfDefSection.Defines
+ #
+ # Should only have one ArchString Item.
+ #
+ ArchString = list(RecordSet.keys())[0]
+ ArchList = GetSplitValueList(ArchString, ' ')
+ ArchList = ConvertArchList(ArchList)
+ HasCalledFlag = False
+ #
+ # Get data from Sdict()
+ #
+ ValueList = RecordSet[ArchString]
+ self.SetFileName(self.FileName)
+ self.SetFullPath(self.FullPath)
+ #
+ # The INF's filename (without the directory path or the extension)
+ # must be used for the value of the
+ # ModuleSurfaceArea.Header.Name element
+ #
+ self.SetName(os.path.splitext(os.path.basename(self.FileName))[0])
+ self.WorkspaceDir = " "
+ #
+ # CombinePath and ModulePath
+ #
+ CombinePath = GetRelativePath(self.FullPath, self.WorkSpace)
+ self.SetCombinePath(CombinePath)
+ ModulePath = os.path.split(CombinePath)[0]
+ ModuleRelativePath = ModulePath
+ if self.GetPackagePath() != '':
+ ModuleRelativePath = GetRelativePath(ModulePath, self.GetPackagePath())
+ self.SetModulePath(ModuleRelativePath)
+ #
+ # For Define Seciton Items.
+ #
+ DefineObj = ValueList
+ #
+ # Convert UEFI/PI version to decimal number
+ #
+ if DefineObj.GetUefiSpecificationVersion() is not None:
+ __UefiVersion = DefineObj.GetUefiSpecificationVersion().GetValue()
+ __UefiVersion = ConvertVersionToDecimal(__UefiVersion)
+ self.SetUefiSpecificationVersion(str(__UefiVersion))
+ if DefineObj.GetPiSpecificationVersion() is not None:
+ __PiVersion = DefineObj.GetPiSpecificationVersion().GetValue()
+ __PiVersion = ConvertVersionToDecimal(__PiVersion)
+
+ self.SetPiSpecificationVersion(str(__PiVersion))
+ SpecList = DefineObj.GetSpecification()
+ NewSpecList = []
+ for SpecItem in SpecList:
+ NewSpecList.append((SpecItem[0], ConvertVersionToDecimal(SpecItem[1])))
+ self.SetSpecList(NewSpecList)
+
+ #
+ # must exist items in INF define section
+ # MODULE_TYPE/BASE_NAME/INF_VERSION/FILE_GUID/VERSION_STRING
+ #
+ if DefineObj.GetModuleType() is None:
+ Logger.Error("InfParser", FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("MODULE_TYPE"), File=self.FullPath)
+ else:
+ self.SetModuleType(DefineObj.GetModuleType().GetValue())
+ ModuleType = DefineObj.GetModuleType().GetValue()
+ if ModuleType:
+ #
+ # Drivers and applications are not allowed to have a MODULE_TYPE of "BASE". Only
+ # libraries are permitted to a have a MODULE_TYPE of "BASE".
+ #
+ if len(DefineObj.LibraryClass) == 0 and ModuleType == 'BASE':
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_MODULETYPE_INVALID,
+ File=self.FullPath,
+ Line=DefineObj.ModuleType.CurrentLine.LineNo,
+ ExtraData=DefineObj.ModuleType.CurrentLine.LineString)
+ self.LibModuleTypeList.append(ModuleType)
+ if DefineObj.GetBaseName() is None:
+ Logger.Error("InfParser", FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("BASE_NAME"), File=self.FullPath)
+ else:
+ self.SetBaseName(DefineObj.GetBaseName().GetValue())
+ if DefineObj.GetModuleUniFileName():
+ self.UniFileClassObject = UniFileClassObject([PathClass(DefineObj.GetModuleUniFileName())])
+ else:
+ self.UniFileClassObject = None
+ if DefineObj.GetInfVersion() is None:
+ Logger.Error("InfParser", FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("INF_VERSION"), File=self.FullPath)
+ else:
+ self.SetVersion(DefineObj.GetInfVersion().GetValue())
+ if DefineObj.GetFileGuid() is None:
+ Logger.Error("InfParser", FORMAT_INVALID,
+ ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("FILE_GUID"), File=self.FullPath)
+ else:
+ self.SetGuid(DefineObj.GetFileGuid().GetValue())
+ if DefineObj.GetVersionString() is None:
+ #
+ # VERSION_STRING is missing from the [Defines] section, tools must assume that the module's version is 0.
+ #
+ self.SetVersion('0')
+ else:
+ #
+ # Get version of INF
+ #
+ if DefineObj.GetVersionString().GetValue() != "":
+ #
+ # EDK2 inf
+ #
+ VersionString = DefineObj.GetVersionString().GetValue()
+ if len(VersionString) > 0:
+ VersionString = ConvertVersionToDecimal(VersionString)
+ self.SetVersion(VersionString)
+ else:
+ #
+ # EDK1 inf
+ #
+ Logger.Error("Parser", PARSER_ERROR, ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF, ExtraData=self.FullPath,
+ RaiseError=Logger.IS_RAISE_ERROR)
+ #
+ # if there is Shadow, Should judge the MODULE_TYPE in
+ # SEC, PEI_CORE and PEIM
+ #
+ if DefineObj.GetShadow():
+ ModuleTypeValue = DefineObj.GetModuleType().GetValue()
+ if not (ModuleTypeValue == 'SEC' or ModuleTypeValue == 'PEI_CORE' or ModuleTypeValue == 'PEIM'):
+ Logger.Error("InfParser", FORMAT_INVALID, ST.ERR_INF_PARSER_DEFINE_SHADOW_INVALID, File=self.FullPath)
+
+ if DefineObj.GetPcdIsDriver() is not None:
+ self.SetPcdIsDriver(DefineObj.GetPcdIsDriver().GetValue())
+ #
+ # LIBRARY_CLASS
+ #
+ self._GenModuleHeaderLibClass(DefineObj, ArchList)
+ #
+ # CUSTOM_MAKEFILE
+ #
+ self.CustomMakefile = DefineObj.GetCustomMakefile()
+ #
+ # Externs in Defines section
+ # Only one define section, so just call once.
+ #
+ if not HasCalledFlag:
+ self._GenModuleHeaderExterns(DefineObj)
+ HasCalledFlag = True
+ #
+ # each module has only one module header
+ #
+ self.SetSupArchList(ArchList)
+ #
+ # Get Hob/BootMode/EventList information
+ #
+ self._GenSpecialComments()
+ #
+ # put all define statement into user-extension sections
+ #
+ DefinesDictNew = GenModuleHeaderUserExt(DefineObj, ArchString)
+ if DefinesDictNew:
+ UserExtension = CommonObject.UserExtensionObject()
+ UserExtension.SetDefinesDict(DefinesDictNew)
+ UserExtension.SetIdentifier('DefineModifiers')
+ UserExtension.SetUserID('EDK2')
+ self.SetUserExtensionList(self.GetUserExtensionList() + [UserExtension])
+ #
+ # Get all meta-file header information
+ # the record is list of items formatted:
+ # [LineValue, Arch, StartLine, ID, Third]
+ #
+ InfHeaderObj = self.Parser.InfHeader
+ #
+ # Put header information into POM object
+ #
+ if self.UniFileClassObject:
+ Lang = DT.TAB_LANGUAGE_EN_X
+ else:
+ Lang = DT.TAB_LANGUAGE_EN_US
+ if InfHeaderObj.GetAbstract():
+ self.SetAbstract((Lang, InfHeaderObj.GetAbstract()))
+ if InfHeaderObj.GetDescription():
+ self.SetDescription((Lang, InfHeaderObj.GetDescription()))
+ if InfHeaderObj.GetCopyright():
+ self.SetCopyright(('', InfHeaderObj.GetCopyright()))
+ if InfHeaderObj.GetLicense():
+ self.SetLicense(('', InfHeaderObj.GetLicense()))
+ #
+ # Put Binary header information into POM object
+ #
+ InfBinaryHeaderObj = self.Parser.InfBinaryHeader
+ if InfBinaryHeaderObj.GetAbstract():
+ self.SetBinaryHeaderAbstract((Lang, InfBinaryHeaderObj.GetAbstract()))
+ if InfBinaryHeaderObj.GetDescription():
+ self.SetBinaryHeaderDescription((Lang, InfBinaryHeaderObj.GetDescription()))
+ if InfBinaryHeaderObj.GetCopyright():
+ self.SetBinaryHeaderCopyright(('', InfBinaryHeaderObj.GetCopyright()))
+ if InfBinaryHeaderObj.GetLicense():
+ self.SetBinaryHeaderLicense(('', InfBinaryHeaderObj.GetLicense()))
+
+ ## GenModuleHeaderLibClass
+ #
+ #
+ def _GenModuleHeaderLibClass(self, DefineObj, ArchList):
+ LibraryList = DefineObj.GetLibraryClass()
+ for LibraryItem in LibraryList:
+ Lib = CommonObject.LibraryClassObject()
+ Lib.SetLibraryClass(LibraryItem.GetLibraryName())
+ Lib.SetUsage(DT.USAGE_ITEM_PRODUCES)
+ SupModuleList = LibraryItem.GetTypes()
+ self.LibModuleTypeList += SupModuleList
+ Lib.SetSupModuleList(SupModuleList)
+ Lib.SetSupArchList(ArchList)
+ self.SetLibraryClassList(self.GetLibraryClassList() + [Lib])
+ self.SetIsLibrary(True)
+ self.SetIsLibraryModList(self.GetIsLibraryModList() + SupModuleList)
+
+ ## GenModuleHeaderExterns
+ #
+ #
+ def _GenModuleHeaderExterns(self, DefineObj):
+ EntryPointList = DefineObj.GetEntryPoint()
+ for EntryPoint in EntryPointList:
+ Image = ExternObject()
+ Image.SetEntryPoint(EntryPoint.GetCName())
+ #
+ # Future enhancement
+ #
+ self.SetExternList(self.GetExternList() + [Image])
+ #
+ # UNLOAD_IMAGE
+ #
+ UnloadImageList = DefineObj.GetUnloadImages()
+ for UnloadImage in UnloadImageList:
+ Image = ExternObject()
+ #
+ # Future enhancement
+ #
+ Image.SetUnloadImage(UnloadImage.GetCName())
+ self.SetExternList(self.GetExternList() + [Image])
+ #
+ # CONSTRUCTOR
+ #
+ ConstructorList = DefineObj.GetConstructor()
+ for ConstructorItem in ConstructorList:
+ Image = ExternObject()
+ #
+ # Future enhancement
+ #
+ Image.SetConstructor(ConstructorItem.GetCName())
+ self.SetExternList(self.GetExternList() + [Image])
+ #
+ # DESTRUCTOR
+ #
+ DestructorList = DefineObj.GetDestructor()
+ for DestructorItem in DestructorList:
+ Image = ExternObject()
+ #
+ # Future enhancement
+ #
+ Image.SetDestructor(DestructorItem.GetCName())
+ self.SetExternList(self.GetExternList() + [Image])
+
+ ## GenModuleHeaderExterns
+ # BootMode/HOB/Event
+ #
+ def _GenSpecialComments(self):
+ SpecialCommentsList = self.Parser.InfSpecialCommentSection.GetSpecialComments()
+ for Key in SpecialCommentsList:
+ if Key == DT.TYPE_HOB_SECTION:
+ HobList = []
+ for Item in SpecialCommentsList[Key]:
+ Hob = HobObject()
+ Hob.SetHobType(Item.GetHobType())
+ Hob.SetUsage(Item.GetUsage())
+ Hob.SetSupArchList(Item.GetSupArchList())
+ if Item.GetHelpString():
+ HelpTextObj = CommonObject.TextObject()
+ if self.UniFileClassObject:
+ HelpTextObj.SetLang(DT.TAB_LANGUAGE_EN_X)
+ HelpTextObj.SetString(Item.GetHelpString())
+ Hob.SetHelpTextList([HelpTextObj])
+ HobList.append(Hob)
+ self.SetHobList(HobList)
+ elif Key == DT.TYPE_EVENT_SECTION:
+ EventList = []
+ for Item in SpecialCommentsList[Key]:
+ Event = EventObject()
+ Event.SetEventType(Item.GetEventType())
+ Event.SetUsage(Item.GetUsage())
+ if Item.GetHelpString():
+ HelpTextObj = CommonObject.TextObject()
+ if self.UniFileClassObject:
+ HelpTextObj.SetLang(DT.TAB_LANGUAGE_EN_X)
+ HelpTextObj.SetString(Item.GetHelpString())
+ Event.SetHelpTextList([HelpTextObj])
+ EventList.append(Event)
+ self.SetEventList(EventList)
+ elif Key == DT.TYPE_BOOTMODE_SECTION:
+ BootModeList = []
+ for Item in SpecialCommentsList[Key]:
+ BootMode = BootModeObject()
+ BootMode.SetSupportedBootModes(Item.GetSupportedBootModes())
+ BootMode.SetUsage(Item.GetUsage())
+ if Item.GetHelpString():
+ HelpTextObj = CommonObject.TextObject()
+ if self.UniFileClassObject:
+ HelpTextObj.SetLang(DT.TAB_LANGUAGE_EN_X)
+ HelpTextObj.SetString(Item.GetHelpString())
+ BootMode.SetHelpTextList([HelpTextObj])
+ BootModeList.append(BootMode)
+ self.SetBootModeList(BootModeList)
+
+ ## GenBuildOptions
+ #
+ # Gen BuildOptions of Inf
+ # [<Family>:]<ToolFlag>=Flag
+ #
+ #
+ def _GenBuildOptions(self):
+ Logger.Debug(2, "Generate %s ..." % DT.TAB_BUILD_OPTIONS)
+ #
+ # Get all BuildOptions
+ #
+ BuildOptionsList = self.Parser.InfBuildOptionSection.GetBuildOptions()
+ if not GlobalData.gIS_BINARY_INF:
+ BuildOptionDict = {}
+ for BuildOptionObj in BuildOptionsList:
+ ArchList = BuildOptionObj.GetSupArchList()
+ ArchList = ConvertArchList(ArchList)
+ BuildOptionsContent = BuildOptionObj.GetContent()
+ ArchString = ' '.join(ArchList)
+ if not BuildOptionsContent:
+ continue
+ BuildOptionDict[ArchString] = BuildOptionsContent
+ if not BuildOptionDict:
+ return
+ UserExtension = CommonObject.UserExtensionObject()
+ UserExtension.SetBuildOptionDict(BuildOptionDict)
+ UserExtension.SetIdentifier('BuildOptionModifiers')
+ UserExtension.SetUserID('EDK2')
+ self.SetUserExtensionList(self.GetUserExtensionList() + [UserExtension])
+ else:
+ #
+ # Not process this information, will be processed in GenBinaries()
+ #
+ pass
+
+ ## GenLibraryClasses
+ #
+ # Get LibraryClass of Inf
+ # <LibraryClassKeyWord>|<LibraryInstance>
+ #
+ # @param ContainerFile: The Inf file full path
+ #
+ def _GenLibraryClasses(self):
+ Logger.Debug(2, "Generate %s ..." % DT.TAB_LIBRARY_CLASSES)
+ if not GlobalData.gIS_BINARY_INF:
+ #
+ # Get all LibraryClasses
+ #
+ for LibraryClassData in self.Parser.InfLibraryClassSection.LibraryClasses.values():
+ for Item in LibraryClassData:
+ LibraryClass = CommonObject.LibraryClassObject()
+ LibraryClass.SetUsage(DT.USAGE_ITEM_CONSUMES)
+ LibraryClass.SetLibraryClass(Item.GetLibName())
+ LibraryClass.SetRecommendedInstance(None)
+ LibraryClass.SetFeatureFlag(Item.GetFeatureFlagExp())
+ LibraryClass.SetSupArchList(ConvertArchList(Item.GetSupArchList()))
+ LibraryClass.SetSupModuleList(Item.GetSupModuleList())
+ HelpStringObj = Item.GetHelpString()
+ if HelpStringObj is not None:
+ CommentString = GetHelpStringByRemoveHashKey(HelpStringObj.HeaderComments +
+ HelpStringObj.TailComments)
+ HelpTextHeaderObj = CommonObject.TextObject()
+ if self.UniFileClassObject:
+ HelpTextHeaderObj.SetLang(DT.TAB_LANGUAGE_EN_X)
+ HelpTextHeaderObj.SetString(CommentString)
+ LibraryClass.SetHelpTextList([HelpTextHeaderObj])
+ self.SetLibraryClassList(self.GetLibraryClassList() + [LibraryClass])
+
+ ## GenPackages
+ #
+ # Gen Packages of Inf
+ #
+ #
+ # @param ContainerFile: The Inf file full path
+ #
+ def _GenPackages(self, Skip):
+ Logger.Debug(2, "Generate %s ..." % DT.TAB_PACKAGES)
+ #
+ # Get all Packages
+ #
+ PackageObj = self.Parser.InfPackageSection.Packages
+ #
+ # Go through each arch
+ #
+ for PackageItemObj in PackageObj:
+ #
+ # Need package information for dependency check usage
+ #
+ PackageDependency = PackageDependencyObject()
+ PackageDependency.SetPackageFilePath(NormPath(PackageItemObj.GetPackageName()))
+ PackageDependency.SetSupArchList(ConvertArchList(PackageItemObj.GetSupArchList()))
+ PackageDependency.SetFeatureFlag(PackageItemObj.GetFeatureFlagExp())
+
+ PkgInfo = GetPkgInfoFromDec(mws.join(self.WorkSpace, NormPath(PackageItemObj.GetPackageName())))
+ if PkgInfo[1] and PkgInfo[2]:
+ PackageDependency.SetGuid(PkgInfo[1])
+ PackageDependency.SetVersion(PkgInfo[2])
+ elif Skip:
+ continue
+ else:
+ Logger.Error("\nUPT", PARSER_ERROR,
+ ST.ERR_INF_GET_PKG_DEPENDENCY_FAIL % PackageItemObj.GetPackageName(), File=self.FullPath)
+
+ PackageDependencyList = self.GetPackageDependencyList()
+ PackageDependencyList.append(PackageDependency)
+ self.SetPackageDependencyList(PackageDependencyList)
+
+ ## GenPcds
+ #
+ # Gen Pcds of Inf
+ # <TokenSpaceGuidCName>.<PcdCName>[|<Value> [|<FFE>]]
+ #
+ # @param ContainerFile: The Inf file full path
+ #
+ def _GenPcds(self):
+ if not GlobalData.gIS_BINARY_INF:
+ Logger.Debug(2, "Generate %s ..." % DT.TAB_PCDS)
+ #
+ # Get all Pcds
+ #
+ PcdObj = self.Parser.InfPcdSection.Pcds
+ KeysList = PcdObj.keys()
+ #
+ # Go through each arch
+ #
+ for (PcdType, PcdKey) in KeysList:
+ PcdData = PcdObj[PcdType, PcdKey]
+ for PcdItemObj in PcdData:
+ CommentList = PcdItemObj.GetHelpStringList()
+ if CommentList:
+ for CommentItem in CommentList:
+ Pcd = CommonObject.PcdObject()
+ Pcd.SetCName(PcdItemObj.GetCName())
+ Pcd.SetTokenSpaceGuidCName(PcdItemObj.GetTokenSpaceGuidCName())
+ Pcd.SetDefaultValue(PcdItemObj.GetDefaultValue())
+ Pcd.SetItemType(PcdType)
+ Pcd.SetValidUsage(CommentItem.GetUsageItem())
+ Pcd.SetFeatureFlag(PcdItemObj.GetFeatureFlagExp())
+ Pcd.SetSupArchList(ConvertArchList(PcdItemObj.GetSupportArchList()))
+ HelpTextObj = CommonObject.TextObject()
+ if self.UniFileClassObject:
+ HelpTextObj.SetLang(DT.TAB_LANGUAGE_EN_X)
+ HelpTextObj.SetString(CommentItem.GetHelpStringItem())
+ Pcd.SetHelpTextList([HelpTextObj])
+ PcdList = self.GetPcdList()
+ PcdList.append(Pcd)
+ self.SetPcdList(PcdList)
+
+ ## GenSources
+ #
+ # Gen Sources of Inf
+ # <Filename>[|<Family>[|<TagName>[|<ToolCode>[|<PcdFeatureFlag>]]]]
+ #
+ # @param ContainerFile: The Inf file full path
+ #
+ def _GenSources(self):
+ Logger.Debug(2, "Generate %s ..." % DT.TAB_SOURCES)
+
+ #
+ # Get all SourceFiles
+ #
+ SourceObj = self.Parser.InfSourcesSection.Sources
+ DataList = SourceObj.keys()
+ #
+ # Go through each arch
+ #
+ SourceList = []
+ for Key in DataList:
+ SourceData = SourceObj[Key]
+ for Item in SourceData:
+ SourceFile = Item.GetSourceFileName()
+ Family = Item.GetFamily()
+ FeatureFlag = Item.GetFeatureFlagExp()
+ SupArchList = sorted(ConvertArchList(Item.GetSupArchList()))
+ Source = SourceFileObject()
+ Source.SetSourceFile(SourceFile)
+ Source.SetFamily(Family)
+ Source.SetFeatureFlag(FeatureFlag)
+ Source.SetSupArchList(SupArchList)
+ SourceList.append(Source)
+
+ self.SetSourceFileList(self.GetSourceFileList() + SourceList)
+
+
+ ## GenUserExtensions
+ #
+ # Gen UserExtensions of Inf
+ #
+ def _GenUserExtensions(self):
+ #
+ # UserExtensions
+ #
+ UserExtensionObj = self.Parser.InfUserExtensionSection.UserExtension
+ Keys = UserExtensionObj.keys()
+
+ for Key in Keys:
+ UserExtensionData = UserExtensionObj[Key]
+ for UserExtensionDataObj in UserExtensionData:
+ UserExtension = CommonObject.UserExtensionObject()
+ UserId = UserExtensionDataObj.GetUserId()
+ if UserId.startswith('"') and UserId.endswith('"'):
+ UserId = UserId[1:-1]
+ UserExtension.SetUserID(UserId)
+ Identifier = UserExtensionDataObj.GetIdString()
+ if Identifier.startswith('"') and Identifier.endswith('"'):
+ Identifier = Identifier[1:-1]
+ #
+ # Generate miscellaneous files on INF file
+ #
+ if UserId == 'TianoCore' and Identifier == 'ExtraFiles':
+ self._GenMiscFiles(UserExtensionDataObj.GetContent())
+ UserExtension.SetIdentifier(Identifier)
+ UserExtension.SetStatement(UserExtensionDataObj.GetContent())
+ UserExtension.SetSupArchList(ConvertArchList(UserExtensionDataObj.GetSupArchList()))
+ self.SetUserExtensionList(self.GetUserExtensionList() + [UserExtension])
+
+ #
+ # Gen UserExtensions of TianoCore."BinaryHeader"
+ #
+
+ #Get Binary header from INF file
+ BinaryAbstractList = self.BinaryHeaderAbstractList
+ BinaryDescriptionList = self.BinaryHeaderDescriptionList
+ BinaryCopyrightList = self.BinaryHeaderCopyrightList
+ BinaryLicenseList = self.BinaryHeaderLicenseList
+ #Get Binary header from UNI file
+ # Initialize UniStrDict, the top keys are language codes
+ UniStrDict = {}
+ if self.UniFileClassObject:
+ UniStrDict = self.UniFileClassObject.OrderedStringList
+ for Lang in UniStrDict:
+ for StringDefClassObject in UniStrDict[Lang]:
+ Lang = GetLanguageCode1766(Lang)
+ if StringDefClassObject.StringName == DT.TAB_INF_BINARY_ABSTRACT:
+ BinaryAbstractList.append((Lang, ConvertSpecialUnicodes(StringDefClassObject.StringValue)))
+ if StringDefClassObject.StringName == DT.TAB_INF_BINARY_DESCRIPTION:
+ BinaryDescriptionList.append((Lang, ConvertSpecialUnicodes(StringDefClassObject.StringValue)))
+ if BinaryAbstractList or BinaryDescriptionList or BinaryCopyrightList or BinaryLicenseList:
+ BinaryUserExtension = CommonObject.UserExtensionObject()
+ BinaryUserExtension.SetBinaryAbstract(BinaryAbstractList)
+ BinaryUserExtension.SetBinaryDescription(BinaryDescriptionList)
+ BinaryUserExtension.SetBinaryCopyright(BinaryCopyrightList)
+ BinaryUserExtension.SetBinaryLicense(BinaryLicenseList)
+ BinaryUserExtension.SetIdentifier(DT.TAB_BINARY_HEADER_IDENTIFIER)
+ BinaryUserExtension.SetUserID(DT.TAB_BINARY_HEADER_USERID)
+ self.SetUserExtensionList(self.GetUserExtensionList() + [BinaryUserExtension])
+
+ def _GenDepexesList(self, SmmDepexList, DxeDepexList, PeiDepexList):
+ if SmmDepexList:
+ self.SetSmmDepex(SmmDepexList)
+ if DxeDepexList:
+ self.SetDxeDepex(DxeDepexList)
+ if PeiDepexList:
+ self.SetPeiDepex(PeiDepexList)
+
+ ## GenDepexes
+ #
+ # Gen Depex of Inf
+ #
+ # @param ContainerFile: The Inf file full path
+ #
+ def _GenDepexes(self):
+ Logger.Debug(2, "Generate %s ..." % DT.TAB_DEPEX)
+
+ PEI_LIST = [DT.SUP_MODULE_PEIM]
+ SMM_LIST = [DT.SUP_MODULE_DXE_SMM_DRIVER]
+ DXE_LIST = [DT.SUP_MODULE_DXE_DRIVER, DT.SUP_MODULE_DXE_SAL_DRIVER,
+ DT.SUP_MODULE_DXE_RUNTIME_DRIVER]
+
+ IsLibraryClass = self.GetIsLibrary()
+ #
+ # Get all Depexes
+ #
+ DepexData = self.Parser.InfDepexSection.GetDepex()
+ SmmDepexList = []
+ DxeDepexList = []
+ PeiDepexList = []
+ for Depex in DepexData:
+ ModuleType = Depex.GetModuleType()
+ ModuleTypeList = []
+ if IsLibraryClass:
+ if self.GetModuleType() == 'BASE' and not ModuleType:
+ Logger.Error("\nMkPkg", PARSER_ERROR,
+ ST.ERR_INF_PARSER_DEPEX_SECTION_INVALID_FOR_BASE_LIBRARY_CLASS,
+ self.GetFullPath(), RaiseError=True)
+ if self.GetModuleType() != 'BASE' and not self.GetIsLibraryModList():
+ Logger.Error("\nMkPkg", PARSER_ERROR, ST.ERR_INF_PARSER_DEPEX_SECTION_INVALID_FOR_LIBRARY_CLASS,
+ self.GetFullPath(), RaiseError=True)
+ if self.GetModuleType() != 'BASE' and ModuleType and ModuleType not in self.GetIsLibraryModList():
+ Logger.Error("\nMkPkg", PARSER_ERROR, ST.ERR_INF_PARSER_DEPEX_SECTION_NOT_DETERMINED,
+ self.GetFullPath(), RaiseError=True)
+ if ModuleType:
+ ModuleTypeList = [ModuleType]
+ else:
+ for ModuleTypeInList in self.GetIsLibraryModList():
+ if ModuleTypeInList in DT.VALID_DEPEX_MODULE_TYPE_LIST:
+ ModuleTypeList.append(ModuleTypeInList)
+ if not ModuleTypeList:
+ Logger.Error("\nMkPkg", PARSER_ERROR, ST.ERR_INF_PARSER_DEPEX_SECTION_NOT_DETERMINED,
+ self.GetFullPath(), RaiseError=True)
+ else:
+ if not ModuleType:
+ ModuleType = self.ModuleType
+ if ModuleType not in DT.VALID_DEPEX_MODULE_TYPE_LIST:
+ Logger.Error("\nMkPkg", PARSER_ERROR,
+ ST.ERR_INF_PARSER_DEPEX_SECTION_MODULE_TYPE_ERROR % (ModuleType),
+ self.GetFullPath(), RaiseError=True)
+ if ModuleType != self.ModuleType:
+ Logger.Error("\nMkPkg", PARSER_ERROR, ST.ERR_INF_PARSER_DEPEX_SECTION_NOT_DETERMINED,
+ self.GetFullPath(), RaiseError=True)
+ ModuleTypeList = [ModuleType]
+ for ModuleType in ModuleTypeList:
+ DepexIns = DepexObject()
+ DepexIns.SetDepex(Depex.GetDepexContent())
+ if IsLibraryClass:
+ DepexIns.SetModuleType(ModuleType)
+ else:
+ if Depex.GetModuleType():
+ DepexIns.SetModuleType(Depex.GetModuleType())
+ DepexIns.SetSupArchList(ConvertArchList([Depex.GetSupArch()]))
+ DepexIns.SetFeatureFlag(Depex.GetFeatureFlagExp())
+ if Depex.HelpString:
+ HelpIns = CommonObject.TextObject()
+ if self.UniFileClassObject:
+ HelpIns.SetLang(DT.TAB_LANGUAGE_EN_X)
+ HelpIns.SetString(GetHelpStringByRemoveHashKey(Depex.HelpString))
+ DepexIns.SetHelpText(HelpIns)
+
+ if ModuleType in SMM_LIST:
+ SmmDepexList.append(DepexIns)
+ if ModuleType in DXE_LIST:
+ DxeDepexList.append(DepexIns)
+ if ModuleType in PEI_LIST:
+ PeiDepexList.append(DepexIns)
+ if ModuleType == DT.SUP_MODULE_UEFI_DRIVER:
+ if IsLibraryClass:
+ DxeDepexList.append(DepexIns)
+ else:
+ Logger.Error("\nMkPkg", PARSER_ERROR, ST.ERR_INF_PARSER_DEPEX_SECTION_INVALID_FOR_DRIVER,
+ self.GetFullPath(), RaiseError=True)
+
+ #End of for ModuleType in ModuleTypeList
+ self._GenDepexesList(SmmDepexList, DxeDepexList, PeiDepexList)
+ #End of for Depex in DepexData
+
+ ## GenBinaries
+ #
+ # Gen Binary of Inf, must be called after Pcd/Library is generated
+ # <FileType>|<Filename>|<Target>[|<TokenSpaceGuidCName>.<PcdCName>]
+ #
+ # @param ContainerFile: The Inf file full path
+ #
+ def _GenBinaries(self):
+ Logger.Debug(2, "Generate %s ..." % DT.TAB_BINARIES)
+ BinariesDict = {}
+
+ #
+ # Get all Binary data
+ #
+ BinaryObj = self.Parser.InfBinariesSection.GetBinary()
+
+ BinaryData = BinaryObj.keys()
+
+ #
+ # If the INF file does not contain a [Sources] section, and the INF file does contain a [Binaries] section,
+ # then the ModuleSurfaceArea.BinaryModule attribute must be set to true. Otherwise, do not use the attribute
+ #
+ if BinaryObj and not self.Parser.InfSourcesSection.GetSources():
+ self.BinaryModule = True
+ else:
+ self.BinaryModule = False
+
+ BinaryFileObjectList = []
+ AsBuildLibraryClassList = []
+ AsBuildBuildOptionList = []
+ AsBuildIns = AsBuiltObject()
+ #
+ # Library AsBuild Info
+ #
+ for LibItem in self.Parser.InfLibraryClassSection.GetLibraryClasses():
+ AsBuildLibIns = AsBuildLibraryClassObject()
+ AsBuildLibIns.SetLibGuid(LibItem.GetFileGuid())
+ AsBuildLibIns.SetLibVersion(LibItem.GetVersion())
+ AsBuildLibIns.SetSupArchList(LibItem.GetSupArchList())
+ AsBuildLibraryClassList.append(AsBuildLibIns)
+ AsBuildIns.SetLibraryInstancesList(AsBuildLibraryClassList)
+
+ #
+ # BuildOption AsBuild Info
+ #
+ for BuildOptionItem in self.Parser.InfBuildOptionSection.GetBuildOptions():
+ AsBuildBuildOptionList.append(BuildOptionItem)
+ AsBuildIns.SetBuildFlagsList(AsBuildBuildOptionList)
+
+ #
+ # PatchPcd and PcdEx
+ #
+ AsBuildIns = self._GenAsBuiltPcds(self.Parser.InfPcdSection.GetPcds(), AsBuildIns)
+
+ #
+ # Parse the DEC file that contains the GUID value of the GUID CName which is used by
+ # SUBTYPE_GUID type binary file in the Binaries section in the INF file
+ #
+ DecObjList = []
+ if not self.PackagePath:
+ WorkSpace = os.path.normpath(self.WorkSpace)
+ TempPath = ModulePath = os.path.normpath(self.ModulePath)
+ while ModulePath:
+ TempPath = ModulePath
+ ModulePath = os.path.dirname(ModulePath)
+ PackageName = TempPath
+ DecFilePath = os.path.normpath(os.path.join(WorkSpace, PackageName))
+ if DecFilePath:
+ for File in os.listdir(DecFilePath):
+ if File.upper().endswith('.DEC'):
+ DecFileFullPath = os.path.normpath(os.path.join(DecFilePath, File))
+ DecObjList.append(DecPomAlignment(DecFileFullPath, self.WorkSpace))
+
+
+ BinariesDict, AsBuildIns, BinaryFileObjectList = GenBinaryData(BinaryData, BinaryObj,
+ BinariesDict,
+ AsBuildIns,
+ BinaryFileObjectList,
+ self.GetSupArchList(),
+ self.BinaryModule,
+ DecObjList)
+
+ BinariesDict2 = {}
+ for Key in BinariesDict:
+ ValueList = BinariesDict[Key]
+ if len(ValueList) > 1:
+ BinariesDict2[Key] = ValueList
+ else:
+ #
+ # if there is no TagName, ToolCode, HelpStr,
+ # then do not need to put them into userextension
+ #
+ (Target, Family, TagName, HelpStr) = ValueList[0]
+ if not (Target or Family or TagName or HelpStr):
+ continue
+ else:
+ BinariesDict2[Key] = ValueList
+
+ self.SetBinaryFileList(self.GetBinaryFileList() + BinaryFileObjectList)
+
+ if BinariesDict2:
+ UserExtension = CommonObject.UserExtensionObject()
+ UserExtension.SetBinariesDict(BinariesDict2)
+ UserExtension.SetIdentifier('BinaryFileModifiers')
+ UserExtension.SetUserID('EDK2')
+ self.SetUserExtensionList(self.GetUserExtensionList() + [UserExtension])
+
+ ## GenAsBuiltPcds
+ #
+ #
+ def _GenAsBuiltPcds(self, PcdList, AsBuildIns):
+ AsBuildPatchPcdList = []
+ AsBuildPcdExList = []
+ #
+ # Pcd AsBuild Info
+ #
+ for PcdItem in PcdList:
+ if PcdItem[0].upper() == DT.TAB_INF_PATCH_PCD.upper():
+ PcdItemObj = PcdItem[1]
+ Pcd = CommonObject.PcdObject()
+ Pcd.SetCName(PcdItemObj.GetCName())
+ Pcd.SetTokenSpaceGuidCName(PcdItemObj.GetTokenSpaceGuidCName())
+ if PcdItemObj.GetTokenSpaceGuidValue() == '' and self.BinaryModule:
+ Logger.Error("\nMkPkg",
+ PARSER_ERROR,
+ ST.ERR_ASBUILD_PCD_TOKENSPACE_GUID_VALUE_MISS % \
+ (PcdItemObj.GetTokenSpaceGuidCName()),
+ self.GetFullPath(), RaiseError=True)
+ else:
+ Pcd.SetTokenSpaceGuidValue(PcdItemObj.GetTokenSpaceGuidValue())
+ if (PcdItemObj.GetToken() == '' or PcdItemObj.GetDatumType() == '') and self.BinaryModule:
+ Logger.Error("\nMkPkg",
+ PARSER_ERROR,
+ ST.ERR_ASBUILD_PCD_DECLARITION_MISS % \
+ (PcdItemObj.GetTokenSpaceGuidCName() + '.' + PcdItemObj.GetCName()),
+ self.GetFullPath(), RaiseError=True)
+ Pcd.SetToken(PcdItemObj.GetToken())
+ Pcd.SetDatumType(PcdItemObj.GetDatumType())
+ Pcd.SetMaxDatumSize(PcdItemObj.GetMaxDatumSize())
+ Pcd.SetDefaultValue(PcdItemObj.GetDefaultValue())
+ Pcd.SetOffset(PcdItemObj.GetOffset())
+ Pcd.SetItemType(PcdItem[0])
+ Pcd.SetFeatureFlag(PcdItemObj.GetFeatureFlagExp())
+ Pcd.SetSupArchList(ConvertArchList(PcdItemObj.GetSupportArchList()))
+ Pcd.SetValidUsage(PcdItemObj.GetValidUsage())
+ for CommentItem in PcdItemObj.GetHelpStringList():
+ HelpTextObj = CommonObject.TextObject()
+ if self.UniFileClassObject:
+ HelpTextObj.SetLang(DT.TAB_LANGUAGE_EN_X)
+ HelpTextObj.SetString(CommentItem.GetHelpStringItem())
+ Pcd.SetHelpTextList(Pcd.GetHelpTextList() + [HelpTextObj])
+ AsBuildPatchPcdList.append(Pcd)
+ elif PcdItem[0].upper() == DT.TAB_INF_PCD_EX.upper():
+ PcdItemObj = PcdItem[1]
+ Pcd = CommonObject.PcdObject()
+ Pcd.SetTokenSpaceGuidValue(PcdItemObj.GetTokenSpaceGuidValue())
+ Pcd.SetToken(PcdItemObj.GetToken())
+ Pcd.SetDatumType(PcdItemObj.GetDatumType())
+ Pcd.SetMaxDatumSize(PcdItemObj.GetMaxDatumSize())
+ Pcd.SetDefaultValue(PcdItemObj.GetDefaultValue())
+ Pcd.SetItemType(PcdItem[0])
+ Pcd.SetFeatureFlag(PcdItemObj.GetFeatureFlagExp())
+ Pcd.SetSupArchList(ConvertArchList(PcdItemObj.GetSupportArchList()))
+ Pcd.SetValidUsage(PcdItemObj.GetValidUsage())
+ for CommentItem in PcdItemObj.GetHelpStringList():
+ HelpTextObj = CommonObject.TextObject()
+ if self.UniFileClassObject:
+ HelpTextObj.SetLang(DT.TAB_LANGUAGE_EN_X)
+ HelpTextObj.SetString(CommentItem.GetHelpStringItem())
+ Pcd.SetHelpTextList(Pcd.GetHelpTextList() + [HelpTextObj])
+ AsBuildPcdExList.append(Pcd)
+ AsBuildIns.SetPatchPcdList(AsBuildPatchPcdList)
+ AsBuildIns.SetPcdExList(AsBuildPcdExList)
+
+ return AsBuildIns
+
+ ## GenGuidProtocolPpis
+ #
+ # Gen Guids/Protocol/Ppis of INF
+ # <CName>=<GuidValue>
+ #
+ def _GenGuidProtocolPpis(self, Type):
+ Logger.Debug(2, "Generate %s ..." % Type)
+ #
+ # Get all Guid/Protocol/Ppis data
+ #
+ GuidObj = self.Parser.InfGuidSection.GetGuid()
+ ProtocolObj = self.Parser.InfProtocolSection.GetProtocol()
+ PpisObj = self.Parser.InfPpiSection.GetPpi()
+
+ GuidProtocolPpiList = []
+
+ if Type == DT.TAB_GUIDS:
+ GuidData = GuidObj.keys()
+ for Item in GuidData:
+ CommentList = Item.GetCommentList()
+ #
+ # Depend on CommentList content
+ # generate muti-guid-obj
+ #
+ if CommentList:
+ for GuidComentItem in CommentList:
+ ListObject = CommonObject.GuidObject()
+ ListObject.SetGuidTypeList([GuidComentItem.GetGuidTypeItem()])
+ ListObject.SetVariableName(GuidComentItem.GetVariableNameItem())
+ ListObject.SetUsage(GuidComentItem.GetUsageItem())
+ ListObject.SetName(Item.GetName())
+ ListObject.SetCName(Item.GetName())
+ ListObject.SetSupArchList(ConvertArchList(Item.GetSupArchList()))
+ ListObject.SetFeatureFlag(Item.GetFeatureFlagExp())
+ HelpString = GuidComentItem.GetHelpStringItem()
+ if HelpString.strip():
+ HelpTxtTailObj = CommonObject.TextObject()
+ if self.UniFileClassObject:
+ HelpTxtTailObj.SetLang(DT.TAB_LANGUAGE_EN_X)
+ HelpTxtTailObj.SetString(HelpString)
+ ListObject.SetHelpTextList([HelpTxtTailObj])
+
+ GuidProtocolPpiList.append(ListObject)
+ elif Type == DT.TAB_PROTOCOLS:
+ ProtocolData = ProtocolObj.keys()
+ for Item in ProtocolData:
+ CommentList = Item.GetCommentList()
+ for CommentItem in CommentList:
+ ListObject = CommonObject.ProtocolObject()
+ ListObject.SetCName(Item.GetName())
+ ListObject.SetSupArchList(ConvertArchList(Item.GetSupArchList()))
+ ListObject.SetFeatureFlag(Item.GetFeatureFlagExp())
+ ListObject.SetNotify(CommentItem.GetNotify())
+ ListObject.SetUsage(CommentItem.GetUsageItem())
+ HelpString = CommentItem.GetHelpStringItem()
+ if HelpString.strip():
+ HelpTxtObj = CommonObject.TextObject()
+ if self.UniFileClassObject:
+ HelpTxtObj.SetLang(DT.TAB_LANGUAGE_EN_X)
+ HelpTxtObj.SetString(HelpString)
+ ListObject.SetHelpTextList([HelpTxtObj])
+ GuidProtocolPpiList.append(ListObject)
+ elif Type == DT.TAB_PPIS:
+ PpiData = PpisObj.keys()
+ for Item in PpiData:
+ CommentList = Item.GetCommentList()
+ for CommentItem in CommentList:
+ ListObject = CommonObject.PpiObject()
+ ListObject.SetCName(Item.GetName())
+ ListObject.SetSupArchList(ConvertArchList(Item.GetSupArchList()))
+ ListObject.SetFeatureFlag(Item.GetFeatureFlagExp())
+ ListObject.SetNotify(CommentItem.GetNotify())
+ ListObject.SetUsage(CommentItem.GetUsage())
+ HelpString = CommentItem.GetHelpStringItem()
+ if HelpString.strip():
+ HelpTextObj = CommonObject.TextObject()
+ if self.UniFileClassObject:
+ HelpTextObj.SetLang(DT.TAB_LANGUAGE_EN_X)
+ HelpTextObj.SetString(HelpString)
+ ListObject.SetHelpTextList([HelpTextObj])
+ GuidProtocolPpiList.append(ListObject)
+
+ if Type == DT.TAB_GUIDS:
+ self.SetGuidList(self.GetGuidList() + GuidProtocolPpiList)
+ elif Type == DT.TAB_PROTOCOLS:
+ self.SetProtocolList(self.GetProtocolList() + GuidProtocolPpiList)
+ elif Type == DT.TAB_PPIS:
+ self.SetPpiList(self.GetPpiList() + GuidProtocolPpiList)
+
+ ## GenMiscFiles
+ #
+ # Gen MiscellaneousFiles of Inf
+ #
+ # @param ContainerFile: The Inf file full path
+ #
+ def _GenMiscFiles(self, Content):
+ MiscFileObj = CommonObject.MiscFileObject()
+ for Line in Content.splitlines():
+ FileName = ''
+ if '#' in Line:
+ FileName = Line[:Line.find('#')]
+ else:
+ FileName = Line
+ if FileName:
+ if IsValidPath(FileName, GlobalData.gINF_MODULE_DIR):
+ FileObj = CommonObject.FileObject()
+ FileObj.SetURI(FileName)
+ MiscFileObj.SetFileList(MiscFileObj.GetFileList()+[FileObj])
+ else:
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(Line),
+ File=GlobalData.gINF_MODULE_NAME,
+ ExtraData=Line)
+ self.SetMiscFileList(self.GetMiscFileList()+[MiscFileObj])
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignmentMisc.py b/roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignmentMisc.py
new file mode 100644
index 000000000..08a6b257d
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignmentMisc.py
@@ -0,0 +1,255 @@
+## @file InfPomAlignmentMisc.py
+# This file contained the routines for InfPomAlignment
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+InfPomAlignmentMisc
+'''
+
+##
+# Import modules
+#
+import Logger.Log as Logger
+from Library import DataType as DT
+from Library.Misc import ConvertArchList
+from Object.POM.ModuleObject import BinaryFileObject
+from Object.POM import CommonObject
+from Library.StringUtils import FORMAT_INVALID
+from Library.Misc import CheckGuidRegFormat
+from Logger import StringTable as ST
+
+
+## GenModuleHeaderUserExt
+#
+#
+def GenModuleHeaderUserExt(DefineObj, ArchString):
+ DefinesDictNew = {}
+ EdkReleaseVersion = DefineObj.GetEdkReleaseVersion()
+ Shadow = DefineObj.GetShadow()
+ DpxSource = DefineObj.GetDpxSource()
+ PciVendorId = DefineObj.GetPciVendorId()
+ PciDeviceId = DefineObj.GetPciDeviceId()
+ PciClassCode = DefineObj.GetPciClassCode()
+ PciRevision = DefineObj.GetPciRevision()
+ PciCompress = DefineObj.GetPciCompress()
+ CustomMakefile = DefineObj.GetCustomMakefile()
+ UefiHiiResourceSection = DefineObj.GetUefiHiiResourceSection()
+
+ if EdkReleaseVersion is not None:
+ Name = DT.TAB_INF_DEFINES_EDK_RELEASE_VERSION
+ Value = EdkReleaseVersion.GetValue()
+ Statement = _GenInfDefineStateMent(EdkReleaseVersion.Comments.GetHeaderComments(),
+ Name,
+ Value,
+ EdkReleaseVersion.Comments.GetTailComments())
+ DefinesDictNew[Statement] = ArchString
+
+ if Shadow is not None:
+ Name = DT.TAB_INF_DEFINES_SHADOW
+ Value = Shadow.GetValue()
+ Statement = _GenInfDefineStateMent(Shadow.Comments.GetHeaderComments(),
+ Name,
+ Value,
+ Shadow.Comments.GetTailComments())
+ DefinesDictNew[Statement] = ArchString
+
+ if DpxSource is not None:
+ Name = DT.TAB_INF_DEFINES_DPX_SOURCE
+ for DpxSourceItem in DpxSource:
+ Value = DpxSourceItem[0]
+ Statement = _GenInfDefineStateMent(DpxSourceItem[1].GetHeaderComments(),
+ Name,
+ Value,
+ DpxSourceItem[1].GetTailComments())
+ DefinesDictNew[Statement] = ArchString
+
+ if PciVendorId is not None:
+ Name = DT.TAB_INF_DEFINES_PCI_VENDOR_ID
+ Value = PciVendorId.GetValue()
+ Statement = _GenInfDefineStateMent(PciVendorId.Comments.GetHeaderComments(),
+ Name,
+ Value,
+ PciVendorId.Comments.GetTailComments())
+ DefinesDictNew[Statement] = ArchString
+
+ if PciDeviceId is not None:
+ Name = DT.TAB_INF_DEFINES_PCI_DEVICE_ID
+ Value = PciDeviceId.GetValue()
+ Statement = _GenInfDefineStateMent(PciDeviceId.Comments.GetHeaderComments(),
+ Name,
+ Value,
+ PciDeviceId.Comments.GetTailComments())
+ DefinesDictNew[Statement] = ArchString
+
+ if PciClassCode is not None:
+ Name = DT.TAB_INF_DEFINES_PCI_CLASS_CODE
+ Value = PciClassCode.GetValue()
+ Statement = _GenInfDefineStateMent(PciClassCode.Comments.GetHeaderComments(),
+ Name,
+ Value,
+ PciClassCode.Comments.GetTailComments())
+ DefinesDictNew[Statement] = ArchString
+
+ if PciRevision is not None:
+ Name = DT.TAB_INF_DEFINES_PCI_REVISION
+ Value = PciRevision.GetValue()
+ Statement = _GenInfDefineStateMent(PciRevision.Comments.GetHeaderComments(),
+ Name,
+ Value,
+ PciRevision.Comments.GetTailComments())
+ DefinesDictNew[Statement] = ArchString
+
+ if PciCompress is not None:
+ Name = DT.TAB_INF_DEFINES_PCI_COMPRESS
+ Value = PciCompress.GetValue()
+ Statement = _GenInfDefineStateMent(PciCompress.Comments.GetHeaderComments(),
+ Name,
+ Value,
+ PciCompress.Comments.GetTailComments())
+ DefinesDictNew[Statement] = ArchString
+
+ if len(CustomMakefile) >= 1:
+ for CustomMakefileItem in CustomMakefile:
+ Name = DT.TAB_INF_DEFINES_CUSTOM_MAKEFILE
+ #
+ # Not with Feature Flag Expression
+ #
+ if len(CustomMakefileItem) == 3:
+ if CustomMakefileItem[0] != '':
+ Value = CustomMakefileItem[0] + ' | ' + CustomMakefileItem[1]
+ else:
+ Value = CustomMakefileItem[1]
+
+ Comments = CustomMakefileItem[2]
+ Statement = _GenInfDefineStateMent(Comments.GetHeaderComments(),
+ Name,
+ Value,
+ Comments.GetTailComments())
+
+ DefinesDictNew[Statement] = ArchString
+
+ if UefiHiiResourceSection is not None:
+ Name = DT.TAB_INF_DEFINES_UEFI_HII_RESOURCE_SECTION
+ Value = UefiHiiResourceSection.GetValue()
+ HeaderComment = UefiHiiResourceSection.Comments.GetHeaderComments()
+ TailComment = UefiHiiResourceSection.Comments.GetTailComments()
+ Statement = _GenInfDefineStateMent(HeaderComment,
+ Name,
+ Value,
+ TailComment)
+ DefinesDictNew[Statement] = ""
+
+ return DefinesDictNew
+
+
+## Generate the define statement that will be put into userextension
+# Not support comments.
+#
+# @param HeaderComment: the original header comment (# not removed)
+# @param Name: the definition keyword, should not be empty or none
+# @param Value: the definition keyword value
+# @param TailComment: the original Tail comment (# not removed)
+#
+# @return: the regenerated define statement
+#
+def _GenInfDefineStateMent(HeaderComment, Name, Value, TailComment):
+ Logger.Debug(5, HeaderComment + TailComment)
+ Statement = '%s = %s' % (Name, Value)
+
+ return Statement
+
+## GenBinaryData
+#
+#
+def GenBinaryData(BinaryData, BinaryObj, BinariesDict, AsBuildIns, BinaryFileObjectList, \
+ SupArchList, BinaryModule, DecObjList=None):
+ if BinaryModule:
+ pass
+ OriSupArchList = SupArchList
+ for Item in BinaryData:
+ ItemObj = BinaryObj[Item][0][0]
+ if ItemObj.GetType() not in DT.BINARY_FILE_TYPE_UI_LIST + DT.BINARY_FILE_TYPE_VER_LIST:
+ TagName = ItemObj.GetTagName()
+ Family = ItemObj.GetFamily()
+ else:
+ TagName = ''
+ Family = ''
+
+ FFE = ItemObj.GetFeatureFlagExp()
+
+ #
+ # If have architecturie specified, then use the specified architecturie;
+ # If the section tag does not have an architecture modifier or the modifier is "common" (case in-sensitive),
+ # and the VALID_ARCHITECTURES comment exists, the list from the VALID_ARCHITECTURES comment
+ # can be used for the attribute.
+ # If both not have VALID_ARCHITECTURE comment and no architecturie specified, then keep it empty.
+ #
+ SupArchList = sorted(ConvertArchList(ItemObj.GetSupArchList()))
+ if len(SupArchList) == 1 and SupArchList[0] == 'COMMON':
+ if not (len(OriSupArchList) == 1 or OriSupArchList[0] == 'COMMON'):
+ SupArchList = OriSupArchList
+ else:
+ SupArchList = ['COMMON']
+
+ FileNameObj = CommonObject.FileNameObject()
+ FileNameObj.SetFileType(ItemObj.GetType())
+ FileNameObj.SetFilename(ItemObj.GetFileName())
+ FileNameObj.SetFeatureFlag(FFE)
+ #
+ # Get GUID value of the GUID CName in the DEC file
+ #
+ if ItemObj.GetType() == DT.SUBTYPE_GUID_BINARY_FILE_TYPE:
+ if not CheckGuidRegFormat(ItemObj.GetGuidValue()):
+ if not DecObjList:
+ if DT.TAB_HORIZON_LINE_SPLIT in ItemObj.GetGuidValue() or \
+ DT.TAB_COMMA_SPLIT in ItemObj.GetGuidValue():
+ Logger.Error("\nMkPkg",
+ FORMAT_INVALID,
+ ST.ERR_DECPARSE_DEFINE_PKGGUID,
+ ExtraData=ItemObj.GetGuidValue(),
+ RaiseError=True)
+ else:
+ Logger.Error("\nMkPkg",
+ FORMAT_INVALID,
+ ST.ERR_UNI_SUBGUID_VALUE_DEFINE_DEC_NOT_FOUND % \
+ (ItemObj.GetGuidValue()),
+ RaiseError=True)
+ else:
+ for DecObj in DecObjList:
+ for GuidObj in DecObj.GetGuidList():
+ if GuidObj.GetCName() == ItemObj.GetGuidValue():
+ FileNameObj.SetGuidValue(GuidObj.GetGuid())
+ break
+
+ if not FileNameObj.GetGuidValue():
+ Logger.Error("\nMkPkg",
+ FORMAT_INVALID,
+ ST.ERR_DECPARSE_CGUID_NOT_FOUND % \
+ (ItemObj.GetGuidValue()),
+ RaiseError=True)
+ else:
+ FileNameObj.SetGuidValue(ItemObj.GetGuidValue().strip())
+
+ FileNameObj.SetSupArchList(SupArchList)
+ FileNameList = [FileNameObj]
+
+ BinaryFile = BinaryFileObject()
+ BinaryFile.SetFileNameList(FileNameList)
+ BinaryFile.SetAsBuiltList(AsBuildIns)
+ BinaryFileObjectList.append(BinaryFile)
+
+ SupArchStr = ' '.join(SupArchList)
+ Key = (ItemObj.GetFileName(), ItemObj.GetType(), FFE, SupArchStr)
+ ValueItem = (ItemObj.GetTarget(), Family, TagName, '')
+ if Key in BinariesDict:
+ ValueList = BinariesDict[Key]
+ ValueList.append(ValueItem)
+ BinariesDict[Key] = ValueList
+ else:
+ BinariesDict[Key] = [ValueItem]
+
+ return BinariesDict, AsBuildIns, BinaryFileObjectList
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/__init__.py b/roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/__init__.py
new file mode 100644
index 000000000..a7c7e9dbf
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/PomAdapter/__init__.py
@@ -0,0 +1,14 @@
+## @file
+# Python 'Parser' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+PomAdapter
+'''
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/ReplacePkg.py b/roms/edk2/BaseTools/Source/Python/UPT/ReplacePkg.py
new file mode 100644
index 000000000..03b91dab8
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/ReplacePkg.py
@@ -0,0 +1,142 @@
+## @file
+# Replace distribution package.
+#
+# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+"""
+Replace a distribution package
+"""
+##
+# Import Modules
+#
+from shutil import rmtree
+from traceback import format_exc
+from platform import python_version
+from sys import platform
+from Logger import StringTable as ST
+from Logger.ToolError import UNKNOWN_ERROR
+from Logger.ToolError import FatalError
+from Logger.ToolError import ABORT_ERROR
+from Logger.ToolError import CODE_ERROR
+from Logger.ToolError import UPT_ALREADY_INSTALLED_ERROR
+import Logger.Log as Logger
+
+from Core.DependencyRules import DependencyRules
+from Library import GlobalData
+from InstallPkg import UnZipDp
+from InstallPkg import InstallDp
+from RmPkg import GetInstalledDpInfo
+from RmPkg import RemoveDist
+
+## Tool entrance method
+#
+# This method mainly dispatch specific methods per the command line options.
+# If no error found, return zero value so the caller of this tool can know
+# if it's executed successfully or not.
+#
+# @param Options: command Options
+#
+def Main(Options = None):
+ ContentZipFile, DistFile = None, None
+ try:
+ DataBase = GlobalData.gDB
+ WorkspaceDir = GlobalData.gWORKSPACE
+ Dep = DependencyRules(DataBase)
+ DistPkg, ContentZipFile, DpPkgFileName, DistFile = UnZipDp(WorkspaceDir, Options.PackFileToReplace)
+
+ StoredDistFile, OrigDpGuid, OrigDpVersion = GetInstalledDpInfo(Options.PackFileToBeReplaced, \
+ Dep, DataBase, WorkspaceDir)
+
+ #
+ # check dependency
+ #
+ CheckReplaceDpx(Dep, DistPkg, OrigDpGuid, OrigDpVersion)
+
+ #
+ # Remove the old distribution
+ #
+ RemoveDist(OrigDpGuid, OrigDpVersion, StoredDistFile, DataBase, WorkspaceDir, Options.Yes)
+
+ #
+ # Install the new distribution
+ #
+ InstallDp(DistPkg, DpPkgFileName, ContentZipFile, Options, Dep, WorkspaceDir, DataBase)
+ ReturnCode = 0
+
+ except FatalError as XExcept:
+ ReturnCode = XExcept.args[0]
+ if Logger.GetLevel() <= Logger.DEBUG_9:
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(),
+ platform) + format_exc())
+ except KeyboardInterrupt:
+ ReturnCode = ABORT_ERROR
+ if Logger.GetLevel() <= Logger.DEBUG_9:
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(),
+ platform) + format_exc())
+ except:
+ ReturnCode = CODE_ERROR
+ Logger.Error(
+ "\nReplacePkg",
+ CODE_ERROR,
+ ST.ERR_UNKNOWN_FATAL_REPLACE_ERR % (Options.PackFileToReplace, Options.PackFileToBeReplaced),
+ ExtraData=ST.MSG_SEARCH_FOR_HELP % ST.MSG_EDKII_MAIL_ADDR,
+ RaiseError=False
+ )
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(),
+ platform) + format_exc())
+
+ finally:
+ Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_STARTED)
+ if DistFile:
+ DistFile.Close()
+ if ContentZipFile:
+ ContentZipFile.Close()
+ for TempDir in GlobalData.gUNPACK_DIR:
+ rmtree(TempDir)
+ GlobalData.gUNPACK_DIR = []
+ Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_DONE)
+
+ if ReturnCode == 0:
+ Logger.Quiet(ST.MSG_FINISH)
+
+ return ReturnCode
+
+def CheckReplaceDpx(Dep, DistPkg, OrigDpGuid, OrigDpVersion):
+ NewDpPkgList = []
+ for PkgInfo in DistPkg.PackageSurfaceArea:
+ Guid, Version = PkgInfo[0], PkgInfo[1]
+ NewDpPkgList.append((Guid, Version))
+
+ NewDpInfo = "%s %s" % (DistPkg.Header.GetGuid(), DistPkg.Header.GetVersion())
+ OrigDpInfo = "%s %s" % (OrigDpGuid, OrigDpVersion)
+
+ #
+ # check whether new distribution is already installed and not replacing itself
+ #
+ if (NewDpInfo != OrigDpInfo):
+ if Dep.CheckDpExists(DistPkg.Header.GetGuid(), DistPkg.Header.GetVersion()):
+ Logger.Error("\nReplacePkg", UPT_ALREADY_INSTALLED_ERROR,
+ ST.WRN_DIST_PKG_INSTALLED,
+ ExtraData=ST.MSG_REPLACE_ALREADY_INSTALLED_DP)
+
+ #
+ # check whether the original distribution could be replaced by new distribution
+ #
+ Logger.Verbose(ST.MSG_CHECK_DP_FOR_REPLACE%(NewDpInfo, OrigDpInfo))
+ DepInfoResult = Dep.CheckDpDepexForReplace(OrigDpGuid, OrigDpVersion, NewDpPkgList)
+ Replaceable = DepInfoResult[0]
+ if not Replaceable:
+ Logger.Error("\nReplacePkg", UNKNOWN_ERROR,
+ ST.ERR_PACKAGE_NOT_MATCH_DEPENDENCY)
+
+ #
+ # check whether new distribution could be installed by dependency rule
+ #
+ Logger.Verbose(ST.MSG_CHECK_DP_FOR_INSTALL%str(NewDpInfo))
+ if not Dep.ReplaceCheckNewDpDepex(DistPkg, OrigDpGuid, OrigDpVersion):
+ Logger.Error("\nReplacePkg", UNKNOWN_ERROR,
+ ST.ERR_PACKAGE_NOT_MATCH_DEPENDENCY,
+ ExtraData=DistPkg.Header.Name)
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/RmPkg.py b/roms/edk2/BaseTools/Source/Python/UPT/RmPkg.py
new file mode 100644
index 000000000..cf37e2bdc
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/RmPkg.py
@@ -0,0 +1,270 @@
+## @file
+# Install distribution package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+RmPkg
+'''
+
+##
+# Import Modules
+#
+import os.path
+from stat import S_IWUSR
+from traceback import format_exc
+from platform import python_version
+from hashlib import md5
+from sys import stdin
+from sys import platform
+
+from Core.DependencyRules import DependencyRules
+from Library import GlobalData
+from Logger import StringTable as ST
+import Logger.Log as Logger
+from Logger.ToolError import OPTION_MISSING
+from Logger.ToolError import UNKNOWN_ERROR
+from Logger.ToolError import ABORT_ERROR
+from Logger.ToolError import CODE_ERROR
+from Logger.ToolError import FatalError
+
+
+## CheckDpDepex
+#
+# Check if the Depex is satisfied
+# @param Dep: Dep
+# @param Guid: Guid of Dp
+# @param Version: Version of Dp
+# @param WorkspaceDir: Workspace Dir
+#
+def CheckDpDepex(Dep, Guid, Version, WorkspaceDir):
+ (Removable, DependModuleList) = Dep.CheckDpDepexForRemove(Guid, Version)
+ if not Removable:
+ Logger.Info(ST.MSG_CONFIRM_REMOVE)
+ Logger.Info(ST.MSG_USER_DELETE_OP)
+ Input = stdin.readline()
+ Input = Input.replace('\r', '').replace('\n', '')
+ if Input.upper() != 'Y':
+ Logger.Error("RmPkg", UNKNOWN_ERROR, ST.ERR_USER_INTERRUPT)
+ return 1
+ else:
+ #
+ # report list of modules that are not valid due to force
+ # remove,
+ # also generate a log file for reference
+ #
+ Logger.Info(ST.MSG_INVALID_MODULE_INTRODUCED)
+ LogFilePath = os.path.normpath(os.path.join(WorkspaceDir, GlobalData.gINVALID_MODULE_FILE))
+ Logger.Info(ST.MSG_CHECK_LOG_FILE % LogFilePath)
+ try:
+ LogFile = open(LogFilePath, 'w')
+ try:
+ for ModulePath in DependModuleList:
+ LogFile.write("%s\n"%ModulePath)
+ Logger.Info(ModulePath)
+ except IOError:
+ Logger.Warn("\nRmPkg", ST.ERR_FILE_WRITE_FAILURE,
+ File=LogFilePath)
+ except IOError:
+ Logger.Warn("\nRmPkg", ST.ERR_FILE_OPEN_FAILURE,
+ File=LogFilePath)
+ finally:
+ LogFile.close()
+
+## Remove Path
+#
+# removing readonly file on windows will get "Access is denied"
+# error, so before removing, change the mode to be writeable
+#
+# @param Path: The Path to be removed
+#
+def RemovePath(Path):
+ Logger.Info(ST.MSG_REMOVE_FILE % Path)
+ if not os.access(Path, os.W_OK):
+ os.chmod(Path, S_IWUSR)
+ os.remove(Path)
+ try:
+ os.removedirs(os.path.split(Path)[0])
+ except OSError:
+ pass
+## GetCurrentFileList
+#
+# @param DataBase: DataBase of UPT
+# @param Guid: Guid of Dp
+# @param Version: Version of Dp
+# @param WorkspaceDir: Workspace Dir
+#
+def GetCurrentFileList(DataBase, Guid, Version, WorkspaceDir):
+ NewFileList = []
+ for Dir in DataBase.GetDpInstallDirList(Guid, Version):
+ RootDir = os.path.normpath(os.path.join(WorkspaceDir, Dir))
+ for Root, Dirs, Files in os.walk(RootDir):
+ Logger.Debug(0, Dirs)
+ for File in Files:
+ FilePath = os.path.join(Root, File)
+ if FilePath not in NewFileList:
+ NewFileList.append(FilePath)
+ return NewFileList
+
+
+## Tool entrance method
+#
+# This method mainly dispatch specific methods per the command line options.
+# If no error found, return zero value so the caller of this tool can know
+# if it's executed successfully or not.
+#
+# @param Options: command option
+#
+def Main(Options = None):
+
+ try:
+ DataBase = GlobalData.gDB
+ if not Options.DistributionFile:
+ Logger.Error("RmPkg",
+ OPTION_MISSING,
+ ExtraData=ST.ERR_SPECIFY_PACKAGE)
+ WorkspaceDir = GlobalData.gWORKSPACE
+ #
+ # Prepare check dependency
+ #
+ Dep = DependencyRules(DataBase)
+
+ #
+ # Get the Dp information
+ #
+ StoredDistFile, Guid, Version = GetInstalledDpInfo(Options.DistributionFile, Dep, DataBase, WorkspaceDir)
+
+ #
+ # Check Dp depex
+ #
+ CheckDpDepex(Dep, Guid, Version, WorkspaceDir)
+
+ #
+ # remove distribution
+ #
+ RemoveDist(Guid, Version, StoredDistFile, DataBase, WorkspaceDir, Options.Yes)
+
+ Logger.Quiet(ST.MSG_FINISH)
+
+ ReturnCode = 0
+
+ except FatalError as XExcept:
+ ReturnCode = XExcept.args[0]
+ if Logger.GetLevel() <= Logger.DEBUG_9:
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + \
+ format_exc())
+ except KeyboardInterrupt:
+ ReturnCode = ABORT_ERROR
+ if Logger.GetLevel() <= Logger.DEBUG_9:
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + \
+ format_exc())
+ except:
+ Logger.Error(
+ "\nRmPkg",
+ CODE_ERROR,
+ ST.ERR_UNKNOWN_FATAL_REMOVING_ERR,
+ ExtraData=ST.MSG_SEARCH_FOR_HELP % ST.MSG_EDKII_MAIL_ADDR,
+ RaiseError=False
+ )
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + \
+ format_exc())
+ ReturnCode = CODE_ERROR
+ return ReturnCode
+
+## GetInstalledDpInfo method
+#
+# Get the installed distribution information
+#
+# @param DistributionFile: the name of the distribution
+# @param Dep: the instance of DependencyRules
+# @param DataBase: the internal database
+# @param WorkspaceDir: work space directory
+# @retval StoredDistFile: the distribution file that backed up
+# @retval Guid: the Guid of the distribution
+# @retval Version: the Version of distribution
+#
+def GetInstalledDpInfo(DistributionFile, Dep, DataBase, WorkspaceDir):
+ (Guid, Version, NewDpFileName) = DataBase.GetDpByName(os.path.split(DistributionFile)[1])
+ if not Guid:
+ Logger.Error("RmPkg", UNKNOWN_ERROR, ST.ERR_PACKAGE_NOT_INSTALLED % DistributionFile)
+
+ #
+ # Check Dp existing
+ #
+ if not Dep.CheckDpExists(Guid, Version):
+ Logger.Error("RmPkg", UNKNOWN_ERROR, ST.ERR_DISTRIBUTION_NOT_INSTALLED)
+ #
+ # Check for Distribution files existence in /conf/upt, if not exist,
+ # Warn user and go on.
+ #
+ StoredDistFile = os.path.normpath(os.path.join(WorkspaceDir, GlobalData.gUPT_DIR, NewDpFileName))
+ if not os.path.isfile(StoredDistFile):
+ Logger.Warn("RmPkg", ST.WRN_DIST_NOT_FOUND%StoredDistFile)
+ StoredDistFile = None
+
+ return StoredDistFile, Guid, Version
+
+## RemoveDist method
+#
+# remove a distribution
+#
+# @param Guid: the Guid of the distribution
+# @param Version: the Version of distribution
+# @param StoredDistFile: the distribution file that backed up
+# @param DataBase: the internal database
+# @param WorkspaceDir: work space directory
+# @param ForceRemove: whether user want to remove file even it is modified
+#
+def RemoveDist(Guid, Version, StoredDistFile, DataBase, WorkspaceDir, ForceRemove):
+ #
+ # Get Current File List
+ #
+ NewFileList = GetCurrentFileList(DataBase, Guid, Version, WorkspaceDir)
+
+ #
+ # Remove all files
+ #
+ MissingFileList = []
+ for (Path, Md5Sum) in DataBase.GetDpFileList(Guid, Version):
+ if os.path.isfile(Path):
+ if Path in NewFileList:
+ NewFileList.remove(Path)
+ if not ForceRemove:
+ #
+ # check whether modified by users
+ #
+ Md5Signature = md5(open(str(Path), 'rb').read())
+ if Md5Sum != Md5Signature.hexdigest():
+ Logger.Info(ST.MSG_CONFIRM_REMOVE2 % Path)
+ Input = stdin.readline()
+ Input = Input.replace('\r', '').replace('\n', '')
+ if Input.upper() != 'Y':
+ continue
+ RemovePath(Path)
+ else:
+ MissingFileList.append(Path)
+
+ for Path in NewFileList:
+ if os.path.isfile(Path):
+ if (not ForceRemove) and (not os.path.split(Path)[1].startswith('.')):
+ Logger.Info(ST.MSG_CONFIRM_REMOVE3 % Path)
+ Input = stdin.readline()
+ Input = Input.replace('\r', '').replace('\n', '')
+ if Input.upper() != 'Y':
+ continue
+ RemovePath(Path)
+
+ #
+ # Remove distribution files in /Conf/.upt
+ #
+ if StoredDistFile is not None:
+ os.remove(StoredDistFile)
+
+ #
+ # update database
+ #
+ Logger.Quiet(ST.MSG_UPDATE_PACKAGE_DATABASE)
+ DataBase.RemoveDpObj(Guid, Version)
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/TestInstall.py b/roms/edk2/BaseTools/Source/Python/UPT/TestInstall.py
new file mode 100644
index 000000000..1adc19260
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/TestInstall.py
@@ -0,0 +1,94 @@
+# # @file
+# Test Install distribution package
+#
+# Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+"""
+Test Install multiple distribution package
+"""
+# #
+# Import Modules
+#
+from Library import GlobalData
+import Logger.Log as Logger
+from Logger import StringTable as ST
+import Logger.ToolError as TE
+from Core.DependencyRules import DependencyRules
+from InstallPkg import UnZipDp
+
+import shutil
+from traceback import format_exc
+from platform import python_version
+from sys import platform
+
+# # Tool entrance method
+#
+# This method mainly dispatch specific methods per the command line options.
+# If no error found, return zero value so the caller of this tool can know
+# if it's executed successfully or not.
+#
+# @param Options: command Options
+#
+def Main(Options=None):
+ ContentZipFile, DistFile = None, None
+ ReturnCode = 0
+
+ try:
+ DataBase = GlobalData.gDB
+ WorkspaceDir = GlobalData.gWORKSPACE
+ if not Options.DistFiles:
+ Logger.Error("TestInstallPkg", TE.OPTION_MISSING, ExtraData=ST.ERR_SPECIFY_PACKAGE)
+
+ DistPkgList = []
+ for DistFile in Options.DistFiles:
+ DistPkg, ContentZipFile, __, DistFile = UnZipDp(WorkspaceDir, DistFile)
+ DistPkgList.append(DistPkg)
+
+ #
+ # check dependency
+ #
+ Dep = DependencyRules(DataBase)
+ Result = True
+ DpObj = None
+ try:
+ Result, DpObj = Dep.CheckTestInstallPdDepexSatisfied(DistPkgList)
+ except:
+ Result = False
+
+ if Result:
+ Logger.Quiet(ST.MSG_TEST_INSTALL_PASS)
+ else:
+ Logger.Quiet(ST.MSG_TEST_INSTALL_FAIL)
+
+ except TE.FatalError as XExcept:
+ ReturnCode = XExcept.args[0]
+ if Logger.GetLevel() <= Logger.DEBUG_9:
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + format_exc())
+
+ except Exception as x:
+ ReturnCode = TE.CODE_ERROR
+ Logger.Error(
+ "\nTestInstallPkg",
+ TE.CODE_ERROR,
+ ST.ERR_UNKNOWN_FATAL_INSTALL_ERR % Options.DistFiles,
+ ExtraData=ST.MSG_SEARCH_FOR_HELP % ST.MSG_EDKII_MAIL_ADDR,
+ RaiseError=False
+ )
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + format_exc())
+
+ finally:
+ Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_STARTED)
+ if DistFile:
+ DistFile.Close()
+ if ContentZipFile:
+ ContentZipFile.Close()
+ for TempDir in GlobalData.gUNPACK_DIR:
+ shutil.rmtree(TempDir)
+ GlobalData.gUNPACK_DIR = []
+ Logger.Quiet(ST.MSG_REMOVE_TEMP_FILE_DONE)
+ if ReturnCode == 0:
+ Logger.Quiet(ST.MSG_FINISH)
+ return ReturnCode
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/UPT.py b/roms/edk2/BaseTools/Source/Python/UPT/UPT.py
new file mode 100644
index 000000000..480f389d7
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/UPT.py
@@ -0,0 +1,347 @@
+## @file
+#
+# This file is the main entry for UPT
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+UPT
+'''
+
+## import modules
+#
+import locale
+import sys
+from imp import reload
+encoding = locale.getdefaultlocale()[1]
+if encoding:
+ reload(sys)
+ sys.setdefaultencoding(encoding)
+from Core import FileHook
+import os.path
+from sys import platform
+import platform as pf
+from optparse import OptionParser
+from traceback import format_exc
+from platform import python_version
+
+from Logger import StringTable as ST
+import Logger.Log as Logger
+from Logger.StringTable import MSG_VERSION
+from Logger.StringTable import MSG_DESCRIPTION
+from Logger.StringTable import MSG_USAGE
+from Logger.ToolError import FILE_NOT_FOUND
+from Logger.ToolError import OPTION_MISSING
+from Logger.ToolError import FILE_TYPE_MISMATCH
+from Logger.ToolError import OPTION_CONFLICT
+from Logger.ToolError import FatalError
+from Logger.ToolError import UPT_ALREADY_INSTALLED_ERROR
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+
+import MkPkg
+import InstallPkg
+import RmPkg
+import InventoryWs
+import ReplacePkg
+import TestInstall
+from Library.Misc import GetWorkspace
+from Library import GlobalData
+from Core.IpiDb import IpiDatabase
+from BuildVersion import gBUILD_VERSION
+
+## CheckConflictOption
+#
+# CheckConflictOption
+#
+def CheckConflictOption(Opt):
+ if (Opt.PackFileToCreate or Opt.PackFileToInstall or Opt.PackFileToRemove or Opt.PackFileToReplace) \
+ and Opt.InventoryWs:
+ Logger.Error("UPT", OPTION_CONFLICT, ExtraData=ST.ERR_L_OA_EXCLUSIVE)
+ elif Opt.PackFileToReplace and (Opt.PackFileToCreate or Opt.PackFileToInstall or Opt.PackFileToRemove):
+ Logger.Error("UPT", OPTION_CONFLICT, ExtraData=ST.ERR_U_ICR_EXCLUSIVE)
+ elif (Opt.PackFileToCreate and Opt.PackFileToInstall and Opt.PackFileToRemove):
+ Logger.Error("UPT", OPTION_CONFLICT, ExtraData=ST.ERR_REQUIRE_I_C_R_OPTION)
+ elif Opt.PackFileToCreate and Opt.PackFileToInstall:
+ Logger.Error("UPT", OPTION_CONFLICT, ExtraData=ST.ERR_I_C_EXCLUSIVE)
+ elif Opt.PackFileToInstall and Opt.PackFileToRemove:
+ Logger.Error("UPT", OPTION_CONFLICT, ExtraData=ST.ERR_I_R_EXCLUSIVE)
+ elif Opt.PackFileToCreate and Opt.PackFileToRemove:
+ Logger.Error("UPT", OPTION_CONFLICT, ExtraData=ST.ERR_C_R_EXCLUSIVE)
+ elif Opt.TestDistFiles and (Opt.PackFileToCreate or Opt.PackFileToInstall \
+ or Opt.PackFileToRemove or Opt.PackFileToReplace):
+ Logger.Error("UPT", OPTION_CONFLICT, ExtraData=ST.ERR_C_R_EXCLUSIVE)
+
+ if Opt.CustomPath and Opt.UseGuidedPkgPath:
+ Logger.Warn("UPT", ST.WARN_CUSTOMPATH_OVERRIDE_USEGUIDEDPATH)
+ Opt.UseGuidedPkgPath = False
+
+## SetLogLevel
+#
+def SetLogLevel(Opt):
+ if Opt.opt_verbose:
+ Logger.SetLevel(Logger.VERBOSE)
+ elif Opt.opt_quiet:
+ Logger.SetLevel(Logger.QUIET + 1)
+ elif Opt.debug_level is not None:
+ if Opt.debug_level < 0 or Opt.debug_level > 9:
+ Logger.Warn("UPT", ST.ERR_DEBUG_LEVEL)
+ Logger.SetLevel(Logger.INFO)
+ else:
+ Logger.SetLevel(Opt.debug_level + 1)
+ elif Opt.opt_slient:
+ Logger.SetLevel(Logger.SILENT)
+ else:
+ Logger.SetLevel(Logger.INFO)
+
+## Main
+#
+# Main
+#
+def Main():
+ Logger.Initialize()
+
+ Parser = OptionParser(version=(MSG_VERSION + ' Build ' + gBUILD_VERSION), description=MSG_DESCRIPTION,
+ prog="UPT.exe", usage=MSG_USAGE)
+
+ Parser.add_option("-d", "--debug", action="store", type="int", dest="debug_level", help=ST.HLP_PRINT_DEBUG_INFO)
+
+ Parser.add_option("-v", "--verbose", action="store_true", dest="opt_verbose",
+ help=ST.HLP_PRINT_INFORMATIONAL_STATEMENT)
+
+ Parser.add_option("-s", "--silent", action="store_true", dest="opt_slient", help=ST.HLP_RETURN_NO_DISPLAY)
+
+ Parser.add_option("-q", "--quiet", action="store_true", dest="opt_quiet", help=ST.HLP_RETURN_AND_DISPLAY)
+
+ Parser.add_option("-i", "--install", action="append", type="string", dest="Install_Distribution_Package_File",
+ help=ST.HLP_SPECIFY_PACKAGE_NAME_INSTALL)
+
+ Parser.add_option("-c", "--create", action="store", type="string", dest="Create_Distribution_Package_File",
+ help=ST.HLP_SPECIFY_PACKAGE_NAME_CREATE)
+
+ Parser.add_option("-r", "--remove", action="store", type="string", dest="Remove_Distribution_Package_File",
+ help=ST.HLP_SPECIFY_PACKAGE_NAME_REMOVE)
+
+ Parser.add_option("-t", "--template", action="store", type="string", dest="Package_Information_Data_File",
+ help=ST.HLP_SPECIFY_TEMPLATE_NAME_CREATE)
+
+ Parser.add_option("-p", "--dec-filename", action="append", type="string", dest="EDK2_DEC_Filename",
+ help=ST.HLP_SPECIFY_DEC_NAME_CREATE)
+
+ Parser.add_option("-m", "--inf-filename", action="append", type="string", dest="EDK2_INF_Filename",
+ help=ST.HLP_SPECIFY_INF_NAME_CREATE)
+
+ Parser.add_option("-l", "--list", action="store_true", dest="List_Dist_Installed",
+ help=ST.HLP_LIST_DIST_INSTALLED)
+
+ Parser.add_option("-f", "--force", action="store_true", dest="Yes", help=ST.HLP_DISABLE_PROMPT)
+
+ Parser.add_option("-n", "--custom-path", action="store_true", dest="CustomPath", help=ST.HLP_CUSTOM_PATH_PROMPT)
+
+ Parser.add_option("-x", "--free-lock", action="store_true", dest="SkipLock", help=ST.HLP_SKIP_LOCK_CHECK)
+
+ Parser.add_option("-u", "--replace", action="store", type="string", dest="Replace_Distribution_Package_File",
+ help=ST.HLP_SPECIFY_PACKAGE_NAME_REPLACE)
+
+ Parser.add_option("-o", "--original", action="store", type="string", dest="Original_Distribution_Package_File",
+ help=ST.HLP_SPECIFY_PACKAGE_NAME_TO_BE_REPLACED)
+
+ Parser.add_option("--use-guided-paths", action="store_true", dest="Use_Guided_Paths", help=ST.HLP_USE_GUIDED_PATHS)
+
+ Parser.add_option("-j", "--test-install", action="append", type="string",
+ dest="Test_Install_Distribution_Package_Files", help=ST.HLP_TEST_INSTALL)
+
+ Opt = Parser.parse_args()[0]
+
+ Var2Var = [
+ ("PackageInformationDataFile", Opt.Package_Information_Data_File),
+ ("PackFileToInstall", Opt.Install_Distribution_Package_File),
+ ("PackFileToCreate", Opt.Create_Distribution_Package_File),
+ ("PackFileToRemove", Opt.Remove_Distribution_Package_File),
+ ("PackageFileList", Opt.EDK2_DEC_Filename),
+ ("ModuleFileList", Opt.EDK2_INF_Filename),
+ ("InventoryWs", Opt.List_Dist_Installed),
+ ("PackFileToReplace", Opt.Replace_Distribution_Package_File),
+ ("PackFileToBeReplaced", Opt.Original_Distribution_Package_File),
+ ("UseGuidedPkgPath", Opt.Use_Guided_Paths),
+ ("TestDistFiles", Opt.Test_Install_Distribution_Package_Files)
+ ]
+
+ for Var in Var2Var:
+ setattr(Opt, Var[0], Var[1])
+
+ try:
+ GlobalData.gWORKSPACE, GlobalData.gPACKAGE_PATH = GetWorkspace()
+ except FatalError as XExcept:
+ if Logger.GetLevel() <= Logger.DEBUG_9:
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + format_exc())
+ return XExcept.args[0]
+
+ # Support WORKSPACE is a long path
+ # Only works for windows system
+ if pf.system() == 'Windows':
+ Vol = 'B:'
+ for Index in range(90, 65, -1):
+ Vol = chr(Index) + ':'
+ if not os.path.isdir(Vol):
+ os.system('subst %s "%s"' % (Vol, GlobalData.gWORKSPACE))
+ break
+ GlobalData.gWORKSPACE = '%s\\' % Vol
+
+ WorkspaceDir = GlobalData.gWORKSPACE
+
+ SetLogLevel(Opt)
+
+ Mgr = FileHook.RecoverMgr(WorkspaceDir)
+ FileHook.SetRecoverMgr(Mgr)
+
+ GlobalData.gDB = IpiDatabase(os.path.normpath(os.path.join(WorkspaceDir, \
+ "Conf/DistributionPackageDatabase.db")), WorkspaceDir)
+ GlobalData.gDB.InitDatabase(Opt.SkipLock)
+
+ #
+ # Make sure the Db will get closed correctly
+ #
+ try:
+ ReturnCode = 0
+ CheckConflictOption(Opt)
+
+ RunModule = None
+ if Opt.PackFileToCreate:
+ if Opt.PackageInformationDataFile:
+ if not os.path.exists(Opt.PackageInformationDataFile):
+ if not os.path.exists(os.path.join(WorkspaceDir, Opt.PackageInformationDataFile)):
+ Logger.Error("\nUPT", FILE_NOT_FOUND, ST.ERR_NO_TEMPLATE_FILE % Opt.PackageInformationDataFile)
+ else:
+ Opt.PackageInformationDataFile = os.path.join(WorkspaceDir, Opt.PackageInformationDataFile)
+ else:
+ Logger.Error("UPT", OPTION_MISSING, ExtraData=ST.ERR_REQUIRE_T_OPTION)
+ if not Opt.PackFileToCreate.endswith('.dist'):
+ Logger.Error("CreatePkg", FILE_TYPE_MISMATCH, ExtraData=ST.ERR_DIST_EXT_ERROR % Opt.PackFileToCreate)
+ RunModule = MkPkg.Main
+
+ elif Opt.PackFileToInstall:
+ AbsPath = []
+ for Item in Opt.PackFileToInstall:
+ if not Item.endswith('.dist'):
+ Logger.Error("InstallPkg", FILE_TYPE_MISMATCH, ExtraData=ST.ERR_DIST_EXT_ERROR % Item)
+
+ AbsPath.append(GetFullPathDist(Item, WorkspaceDir))
+ if not AbsPath:
+ Logger.Error("InstallPkg", FILE_NOT_FOUND, ST.ERR_INSTALL_DIST_NOT_FOUND % Item)
+
+ Opt.PackFileToInstall = AbsPath
+ setattr(Opt, 'PackageFile', Opt.PackFileToInstall)
+ RunModule = InstallPkg.Main
+
+ elif Opt.PackFileToRemove:
+ if not Opt.PackFileToRemove.endswith('.dist'):
+ Logger.Error("RemovePkg", FILE_TYPE_MISMATCH, ExtraData=ST.ERR_DIST_EXT_ERROR % Opt.PackFileToRemove)
+ head, tail = os.path.split(Opt.PackFileToRemove)
+ if head or not tail:
+ Logger.Error("RemovePkg",
+ FILE_TYPE_MISMATCH,
+ ExtraData=ST.ERR_DIST_FILENAME_ONLY_FOR_REMOVE % Opt.PackFileToRemove)
+
+ setattr(Opt, 'DistributionFile', Opt.PackFileToRemove)
+ RunModule = RmPkg.Main
+ elif Opt.InventoryWs:
+ RunModule = InventoryWs.Main
+
+ elif Opt.PackFileToBeReplaced and not Opt.PackFileToReplace:
+ Logger.Error("ReplacePkg", OPTION_MISSING, ExtraData=ST.ERR_REQUIRE_U_OPTION)
+
+ elif Opt.PackFileToReplace:
+ if not Opt.PackFileToReplace.endswith('.dist'):
+ Logger.Error("ReplacePkg", FILE_TYPE_MISMATCH, ExtraData=ST.ERR_DIST_EXT_ERROR % Opt.PackFileToReplace)
+ if not Opt.PackFileToBeReplaced:
+ Logger.Error("ReplacePkg", OPTION_MISSING, ExtraData=ST.ERR_REQUIRE_O_OPTION)
+ if not Opt.PackFileToBeReplaced.endswith('.dist'):
+ Logger.Error("ReplacePkg",
+ FILE_TYPE_MISMATCH,
+ ExtraData=ST.ERR_DIST_EXT_ERROR % Opt.PackFileToBeReplaced)
+
+ head, tail = os.path.split(Opt.PackFileToBeReplaced)
+ if head or not tail:
+ Logger.Error("ReplacePkg",
+ FILE_TYPE_MISMATCH,
+ ExtraData=ST.ERR_DIST_FILENAME_ONLY_FOR_REPLACE_ORIG % Opt.PackFileToBeReplaced)
+
+ AbsPath = GetFullPathDist(Opt.PackFileToReplace, WorkspaceDir)
+ if not AbsPath:
+ Logger.Error("ReplacePkg", FILE_NOT_FOUND, ST.ERR_REPLACE_DIST_NOT_FOUND % Opt.PackFileToReplace)
+
+ Opt.PackFileToReplace = AbsPath
+ RunModule = ReplacePkg.Main
+
+ elif Opt.Test_Install_Distribution_Package_Files:
+ for Dist in Opt.Test_Install_Distribution_Package_Files:
+ if not Dist.endswith('.dist'):
+ Logger.Error("TestInstall", FILE_TYPE_MISMATCH, ExtraData=ST.ERR_DIST_EXT_ERROR % Dist)
+
+ setattr(Opt, 'DistFiles', Opt.Test_Install_Distribution_Package_Files)
+ RunModule = TestInstall.Main
+
+ else:
+ Parser.print_usage()
+ return OPTION_MISSING
+
+ ReturnCode = RunModule(Opt)
+ except FatalError as XExcept:
+ ReturnCode = XExcept.args[0]
+ if Logger.GetLevel() <= Logger.DEBUG_9:
+ Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + \
+ format_exc())
+ finally:
+ try:
+ if ReturnCode != 0 and ReturnCode != UPT_ALREADY_INSTALLED_ERROR:
+ Logger.Quiet(ST.MSG_RECOVER_START)
+ GlobalData.gDB.RollBack()
+ Mgr.rollback()
+ Logger.Quiet(ST.MSG_RECOVER_DONE)
+ else:
+ GlobalData.gDB.Commit()
+ Mgr.commit()
+ except Exception:
+ Logger.Quiet(ST.MSG_RECOVER_FAIL)
+ GlobalData.gDB.CloseDb()
+
+ if pf.system() == 'Windows':
+ os.system('subst %s /D' % GlobalData.gWORKSPACE.replace('\\', ''))
+
+ return ReturnCode
+
+## GetFullPathDist
+#
+# This function will check DistFile existence, if not absolute path, then try current working directory,
+# then $(WORKSPACE),and return the AbsPath. If file doesn't find, then return None
+#
+# @param DistFile: The distribution file in either relative path or absolute path
+# @param WorkspaceDir: Workspace Directory
+# @return AbsPath: The Absolute path of the distribution file if existed, None else
+#
+def GetFullPathDist(DistFile, WorkspaceDir):
+ if os.path.isabs(DistFile):
+ if not (os.path.exists(DistFile) and os.path.isfile(DistFile)):
+ return None
+ else:
+ return DistFile
+ else:
+ AbsPath = os.path.normpath(os.path.join(os.getcwd(), DistFile))
+ if not (os.path.exists(AbsPath) and os.path.isfile(AbsPath)):
+ AbsPath = os.path.normpath(os.path.join(WorkspaceDir, DistFile))
+ if not (os.path.exists(AbsPath) and os.path.isfile(AbsPath)):
+ return None
+
+ return AbsPath
+
+if __name__ == '__main__':
+ RETVAL = Main()
+ #
+ # 0-127 is a safe return range, and 1 is a standard default error
+ #
+ if RETVAL < 0 or RETVAL > 127:
+ RETVAL = 1
+ sys.exit(RETVAL)
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/CommentGeneratingUnitTest.py b/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/CommentGeneratingUnitTest.py
new file mode 100644
index 000000000..dc67dc615
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/CommentGeneratingUnitTest.py
@@ -0,0 +1,1414 @@
+## @file
+# This file contain unit test for CommentParsing
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+import os
+import unittest
+
+import Logger.Log as Logger
+from GenMetaFile.GenInfFile import GenGuidSections
+from GenMetaFile.GenInfFile import GenProtocolPPiSections
+from GenMetaFile.GenInfFile import GenPcdSections
+from GenMetaFile.GenInfFile import GenSpecialSections
+from Library.CommentGenerating import GenGenericCommentF
+from Library.CommentGenerating import _GetHelpStr
+from Object.POM.CommonObject import TextObject
+from Object.POM.CommonObject import GuidObject
+from Object.POM.CommonObject import ProtocolObject
+from Object.POM.CommonObject import PpiObject
+from Object.POM.CommonObject import PcdObject
+from Object.POM.ModuleObject import HobObject
+
+from Library.StringUtils import GetSplitValueList
+from Library.DataType import TAB_SPACE_SPLIT
+from Library.DataType import TAB_LANGUAGE_EN_US
+from Library.DataType import TAB_LANGUAGE_ENG
+from Library.DataType import ITEM_UNDEFINED
+from Library.DataType import TAB_INF_FEATURE_PCD
+from Library import GlobalData
+from Library.Misc import CreateDirectory
+
+#
+# Test _GetHelpStr
+#
+class _GetHelpStrTest(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ #
+ # Normal case1: have one help text object with Lang = 'en-US'
+ #
+ def testNormalCase1(self):
+ HelpStr = 'Hello world'
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang(TAB_LANGUAGE_EN_US)
+ HelpTextObj.SetString(HelpStr)
+
+ HelpTextList = [HelpTextObj]
+ Result = _GetHelpStr(HelpTextList)
+ self.assertEqual(Result, HelpStr)
+
+ #
+ # Normal case2: have two help text object with Lang = 'en-US' and other
+ #
+ def testNormalCase2(self):
+ HelpStr = 'Hello world'
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang(TAB_LANGUAGE_ENG)
+ HelpTextObj.SetString(HelpStr)
+
+ HelpTextList = [HelpTextObj]
+
+ ExpectedStr = 'Hello world1'
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang(TAB_LANGUAGE_EN_US)
+ HelpTextObj.SetString(ExpectedStr)
+
+ HelpTextList.append(HelpTextObj)
+
+ Result = _GetHelpStr(HelpTextList)
+ self.assertEqual(Result, ExpectedStr)
+
+ #
+ # Normal case3: have two help text object with Lang = '' and 'eng'
+ #
+ def testNormalCase3(self):
+ HelpStr = 'Hello world'
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang('')
+ HelpTextObj.SetString(HelpStr)
+
+ HelpTextList = [HelpTextObj]
+
+ ExpectedStr = 'Hello world1'
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang(TAB_LANGUAGE_ENG)
+ HelpTextObj.SetString(ExpectedStr)
+
+ HelpTextList.append(HelpTextObj)
+
+ Result = _GetHelpStr(HelpTextList)
+ self.assertEqual(Result, ExpectedStr)
+
+ #
+ # Normal case4: have two help text object with Lang = '' and ''
+ #
+ def testNormalCase4(self):
+
+ ExpectedStr = 'Hello world1'
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang(TAB_LANGUAGE_ENG)
+ HelpTextObj.SetString(ExpectedStr)
+ HelpTextList = [HelpTextObj]
+
+ HelpStr = 'Hello world'
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang('')
+ HelpTextObj.SetString(HelpStr)
+ HelpTextList.append(HelpTextObj)
+
+ Result = _GetHelpStr(HelpTextList)
+ self.assertEqual(Result, ExpectedStr)
+
+ #
+ # Normal case: have three help text object with Lang = '','en', 'en-US'
+ #
+ def testNormalCase5(self):
+
+ ExpectedStr = 'Hello world1'
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang(TAB_LANGUAGE_EN_US)
+ HelpTextObj.SetString(ExpectedStr)
+ HelpTextList = [HelpTextObj]
+
+ HelpStr = 'Hello unknown world'
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang('')
+ HelpTextObj.SetString(HelpStr)
+ HelpTextList.append(HelpTextObj)
+
+ HelpStr = 'Hello mysterious world'
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang('')
+ HelpTextObj.SetString(HelpStr)
+ HelpTextList.append(HelpTextObj)
+
+ Result = _GetHelpStr(HelpTextList)
+ self.assertEqual(Result, ExpectedStr)
+
+ HelpTextList.sort()
+ self.assertEqual(Result, ExpectedStr)
+
+ HelpTextList.sort(reverse=True)
+ self.assertEqual(Result, ExpectedStr)
+
+
+#
+# Test GenGuidSections
+#
+class GenGuidSectionsTest(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ #
+ # This is the API to generate Guid Object to help UnitTest
+ #
+ def GuidFactory(self, CName, FFE, Usage, GuidType, VariableName, HelpStr):
+ Guid = GuidObject()
+ Guid.SetCName(CName)
+ Guid.SetFeatureFlag(FFE)
+ Guid.SetGuidTypeList([GuidType])
+ Guid.SetUsage(Usage)
+ Guid.SetVariableName(VariableName)
+
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang('')
+ HelpTextObj.SetString(HelpStr)
+ Guid.SetHelpTextList([HelpTextObj])
+
+ return Guid
+
+ #
+ # Normal case: have two GuidObject
+ #
+ def testNormalCase1(self):
+ GuidList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'PRODUCES'
+ GuidType = 'Event'
+ VariableName = ''
+ HelpStr = 'Usage comment line 1'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'CONSUMES'
+ GuidType = 'Variable'
+ VariableName = ''
+ HelpStr = 'Usage comment line 2'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ Result = GenGuidSections(GuidList)
+ Expected = '''[Guids]
+## PRODUCES ## Event # Usage comment line 1
+## CONSUMES ## Variable: # Usage comment line 2
+Guid1|FFE1'''
+ self.assertEqual(Result.strip(), Expected)
+
+ #
+ # Normal case: have two GuidObject
+ #
+ def testNormalCase2(self):
+ GuidList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'PRODUCES'
+ GuidType = 'Event'
+ VariableName = ''
+ HelpStr = 'Usage comment line 1'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'UNDEFINED'
+ GuidType = 'UNDEFINED'
+ VariableName = ''
+ HelpStr = 'Generic comment line 1\n Generic comment line 2'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ Result = GenGuidSections(GuidList)
+ Expected = '''[Guids]
+## PRODUCES ## Event # Usage comment line 1
+# Generic comment line 1
+# Generic comment line 2
+Guid1|FFE1'''
+
+ self.assertEqual(Result.strip(), Expected)
+
+ #
+ # Normal case: have two GuidObject, one help goes to generic help,
+ # the other go into usage comment
+ #
+ def testNormalCase3(self):
+ GuidList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'UNDEFINED'
+ GuidType = 'UNDEFINED'
+ VariableName = ''
+ HelpStr = 'Generic comment'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'PRODUCES'
+ GuidType = 'Event'
+ VariableName = ''
+ HelpStr = 'Usage comment line 1'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ Result = GenGuidSections(GuidList)
+ Expected = '''[Guids]
+# Generic comment
+## PRODUCES ## Event # Usage comment line 1
+Guid1|FFE1'''
+
+ self.assertEqual(Result.strip(), Expected)
+
+ #
+ # Normal case: have one GuidObject, generic comment multiple lines
+ #
+ def testNormalCase5(self):
+ GuidList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'UNDEFINED'
+ GuidType = 'UNDEFINED'
+ VariableName = ''
+ HelpStr = 'Generic comment line1 \n generic comment line 2'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ Result = GenGuidSections(GuidList)
+ Expected = '''[Guids]
+# Generic comment line1
+# generic comment line 2
+Guid1|FFE1'''
+
+ self.assertEqual(Result.strip(), Expected)
+
+ #
+ # Normal case: have one GuidObject, usage comment multiple lines
+ #
+ def testNormalCase6(self):
+ GuidList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'PRODUCES'
+ GuidType = 'Event'
+ VariableName = ''
+ HelpStr = 'Usage comment line 1\n Usage comment line 2'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ Result = GenGuidSections(GuidList)
+ Expected = '''[Guids]
+Guid1|FFE1 ## PRODUCES ## Event # Usage comment line 1 Usage comment line 2
+'''
+ self.assertEqual(Result.strip(), Expected.strip())
+
+ #
+ # Normal case: have one GuidObject, usage comment one line
+ #
+ def testNormalCase7(self):
+ GuidList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'UNDEFINED'
+ GuidType = 'UNDEFINED'
+ VariableName = ''
+ HelpStr = 'Usage comment line 1'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ Result = GenGuidSections(GuidList)
+ Expected = '''[Guids]
+Guid1|FFE1 # Usage comment line 1
+'''
+ self.assertEqual(Result.strip(), Expected.strip())
+
+ #
+ # Normal case: have two GuidObject
+ #
+ def testNormalCase8(self):
+ GuidList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'PRODUCES'
+ GuidType = 'Event'
+ VariableName = ''
+ HelpStr = 'Usage comment line 1\n Usage comment line 2'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'PRODUCES'
+ GuidType = 'Event'
+ VariableName = ''
+ HelpStr = 'Usage comment line 3'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ Result = GenGuidSections(GuidList)
+ Expected = '''[Guids]
+## PRODUCES ## Event # Usage comment line 1 Usage comment line 2
+## PRODUCES ## Event # Usage comment line 3
+Guid1|FFE1
+'''
+ self.assertEqual(Result.strip(), Expected.strip())
+
+ #
+ # Normal case: have no GuidObject
+ #
+ def testNormalCase9(self):
+ GuidList = []
+
+ Result = GenGuidSections(GuidList)
+ Expected = ''
+ self.assertEqual(Result.strip(), Expected.strip())
+
+ #
+ # Normal case: have one GuidObject with no comment generated
+ #
+ def testNormalCase10(self):
+ GuidList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'UNDEFINED'
+ GuidType = 'UNDEFINED'
+ VariableName = ''
+ HelpStr = ''
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ Result = GenGuidSections(GuidList)
+ Expected = '''[Guids]
+Guid1|FFE1
+'''
+ self.assertEqual(Result.strip(), Expected.strip())
+
+ #
+ # Normal case: have three GuidObject
+ #
+ def testNormalCase11(self):
+ GuidList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'UNDEFINED'
+ GuidType = 'UNDEFINED'
+ VariableName = ''
+ HelpStr = 'general comment line 1'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'PRODUCES'
+ GuidType = 'Event'
+ VariableName = ''
+ HelpStr = 'Usage comment line 3'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'UNDEFINED'
+ GuidType = 'UNDEFINED'
+ VariableName = ''
+ HelpStr = 'general comment line 2'
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ Result = GenGuidSections(GuidList)
+ Expected = '''[Guids]
+# general comment line 1
+## PRODUCES ## Event # Usage comment line 3
+# general comment line 2
+Guid1|FFE1
+'''
+ self.assertEqual(Result.strip(), Expected.strip())
+
+ #
+ # Normal case: have three GuidObject, with Usage/Type and no help
+ #
+ def testNormalCase12(self):
+ GuidList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'PRODUCES'
+ GuidType = 'GUID'
+ VariableName = ''
+ HelpStr = ''
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'PRODUCES'
+ GuidType = 'Event'
+ VariableName = ''
+ HelpStr = ''
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+ Usage = 'CONSUMES'
+ GuidType = 'Event'
+ VariableName = ''
+ HelpStr = ''
+ Guid1 = self.GuidFactory(CName, FFE, Usage, GuidType,
+ VariableName, HelpStr)
+ GuidList.append(Guid1)
+
+ Result = GenGuidSections(GuidList)
+ Expected = '''[Guids]
+## PRODUCES ## GUID
+## PRODUCES ## Event
+## CONSUMES ## Event
+Guid1|FFE1
+'''
+ self.assertEqual(Result.strip(), Expected.strip())
+
+#
+# Test GenProtocolPPiSections
+#
+class GenProtocolPPiSectionsTest(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ #
+ # This is the API to generate Protocol/Ppi Object to help UnitTest
+ #
+ def ObjectFactory(self, CName, FFE, Usage, Notify, HelpStr, IsProtocol):
+ if IsProtocol:
+ Object = ProtocolObject()
+ else:
+ Object = PpiObject()
+
+ Object.SetCName(CName)
+ Object.SetFeatureFlag(FFE)
+ Object.SetUsage(Usage)
+ Object.SetNotify(Notify)
+
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang('')
+ HelpTextObj.SetString(HelpStr)
+ Object.SetHelpTextList([HelpTextObj])
+
+ return Object
+
+ # Usage Notify Help INF Comment
+ #1 UNDEFINED true Present ## UNDEFINED ## NOTIFY # Help
+ #2 UNDEFINED true Not Present ## UNDEFINED ## NOTIFY
+ #3 UNDEFINED false Present ## UNDEFINED # Help
+ #4 UNDEFINED false Not Present ## UNDEFINED
+ #5 UNDEFINED Not Present Present # Help
+ #6 UNDEFINED Not Present Not Present <empty>
+ #7 Other true Present ## Other ## NOTIFY # Help
+ #8 Other true Not Present ## Other ## NOTIFY
+ #9 Other false Present ## Other # Help
+ #A Other false Not Present ## Other
+ #B Other Not Present Present ## Other # Help
+ #C Other Not Present Not Present ## Other
+
+ def testNormalCase1(self):
+ ObjectList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+
+ Usage = 'UNDEFINED'
+ Notify = True
+ HelpStr = 'Help'
+ IsProtocol = True
+ Object = self.ObjectFactory(CName, FFE, Usage, Notify,
+ HelpStr, IsProtocol)
+ ObjectList.append(Object)
+
+
+ Result = GenProtocolPPiSections(ObjectList, IsProtocol)
+ Expected = '''[Protocols]
+Guid1|FFE1 ## UNDEFINED ## NOTIFY # Help'''
+ self.assertEqual(Result.strip(), Expected)
+
+ IsProtocol = False
+ ObjectList = []
+ Object = self.ObjectFactory(CName, FFE, Usage, Notify,
+ HelpStr, IsProtocol)
+ ObjectList.append(Object)
+
+
+ Result = GenProtocolPPiSections(ObjectList, IsProtocol)
+ Expected = '''[Ppis]
+Guid1|FFE1 ## UNDEFINED ## NOTIFY # Help'''
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCase2(self):
+ ObjectList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+
+ Usage = 'UNDEFINED'
+ Notify = True
+ HelpStr = ''
+ IsProtocol = True
+ Object = self.ObjectFactory(CName, FFE, Usage, Notify,
+ HelpStr, IsProtocol)
+ ObjectList.append(Object)
+
+
+ Result = GenProtocolPPiSections(ObjectList, IsProtocol)
+ Expected = '''[Protocols]
+Guid1|FFE1 ## UNDEFINED ## NOTIFY'''
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCase3(self):
+ ObjectList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+
+ Usage = 'UNDEFINED'
+ Notify = False
+ HelpStr = 'Help'
+ IsProtocol = True
+ Object = self.ObjectFactory(CName, FFE, Usage, Notify,
+ HelpStr, IsProtocol)
+ ObjectList.append(Object)
+
+
+ Result = GenProtocolPPiSections(ObjectList, IsProtocol)
+ Expected = '''[Protocols]
+Guid1|FFE1 ## UNDEFINED # Help'''
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCase4(self):
+ ObjectList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+
+ Usage = 'UNDEFINED'
+ Notify = False
+ HelpStr = ''
+ IsProtocol = True
+ Object = self.ObjectFactory(CName, FFE, Usage, Notify,
+ HelpStr, IsProtocol)
+ ObjectList.append(Object)
+
+
+ Result = GenProtocolPPiSections(ObjectList, IsProtocol)
+ Expected = '''[Protocols]
+Guid1|FFE1 ## UNDEFINED'''
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCase5(self):
+ ObjectList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+
+ Usage = 'UNDEFINED'
+ Notify = ''
+ HelpStr = 'Help'
+ IsProtocol = True
+ Object = self.ObjectFactory(CName, FFE, Usage, Notify,
+ HelpStr, IsProtocol)
+ ObjectList.append(Object)
+
+
+ Result = GenProtocolPPiSections(ObjectList, IsProtocol)
+ Expected = '''[Protocols]
+Guid1|FFE1 # Help'''
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCase6(self):
+ ObjectList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+
+ Usage = 'UNDEFINED'
+ Notify = ''
+ HelpStr = ''
+ IsProtocol = True
+ Object = self.ObjectFactory(CName, FFE, Usage, Notify,
+ HelpStr, IsProtocol)
+ ObjectList.append(Object)
+
+
+ Result = GenProtocolPPiSections(ObjectList, IsProtocol)
+ Expected = '''[Protocols]
+Guid1|FFE1'''
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCase7(self):
+ ObjectList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+
+ Usage = 'PRODUCES'
+ Notify = True
+ HelpStr = 'Help'
+ IsProtocol = True
+ Object = self.ObjectFactory(CName, FFE, Usage, Notify,
+ HelpStr, IsProtocol)
+ ObjectList.append(Object)
+
+
+ Result = GenProtocolPPiSections(ObjectList, IsProtocol)
+ Expected = '''[Protocols]
+Guid1|FFE1 ## PRODUCES ## NOTIFY # Help'''
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCase8(self):
+ ObjectList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+
+ Usage = 'PRODUCES'
+ Notify = True
+ HelpStr = ''
+ IsProtocol = True
+ Object = self.ObjectFactory(CName, FFE, Usage, Notify,
+ HelpStr, IsProtocol)
+ ObjectList.append(Object)
+
+
+ Result = GenProtocolPPiSections(ObjectList, IsProtocol)
+ Expected = '''[Protocols]
+Guid1|FFE1 ## PRODUCES ## NOTIFY'''
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCase9(self):
+ ObjectList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+
+ Usage = 'PRODUCES'
+ Notify = False
+ HelpStr = 'Help'
+ IsProtocol = True
+ Object = self.ObjectFactory(CName, FFE, Usage, Notify,
+ HelpStr, IsProtocol)
+ ObjectList.append(Object)
+
+
+ Result = GenProtocolPPiSections(ObjectList, IsProtocol)
+ Expected = '''[Protocols]
+Guid1|FFE1 ## PRODUCES # Help'''
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCaseA(self):
+ ObjectList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+
+ Usage = 'PRODUCES'
+ Notify = False
+ HelpStr = ''
+ IsProtocol = True
+ Object = self.ObjectFactory(CName, FFE, Usage, Notify,
+ HelpStr, IsProtocol)
+ ObjectList.append(Object)
+
+
+ Result = GenProtocolPPiSections(ObjectList, IsProtocol)
+ Expected = '''[Protocols]
+Guid1|FFE1 ## PRODUCES'''
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCaseB(self):
+ ObjectList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+
+ Usage = 'PRODUCES'
+ Notify = ''
+ HelpStr = 'Help'
+ IsProtocol = True
+ Object = self.ObjectFactory(CName, FFE, Usage, Notify,
+ HelpStr, IsProtocol)
+ ObjectList.append(Object)
+
+
+ Result = GenProtocolPPiSections(ObjectList, IsProtocol)
+ Expected = '''[Protocols]
+Guid1|FFE1 ## PRODUCES # Help'''
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCaseC(self):
+ ObjectList = []
+
+ CName = 'Guid1'
+ FFE = 'FFE1'
+
+ Usage = 'PRODUCES'
+ Notify = ''
+ HelpStr = ''
+ IsProtocol = True
+ Object = self.ObjectFactory(CName, FFE, Usage, Notify,
+ HelpStr, IsProtocol)
+ ObjectList.append(Object)
+
+
+ Result = GenProtocolPPiSections(ObjectList, IsProtocol)
+ Expected = '''[Protocols]
+Guid1|FFE1 ## PRODUCES'''
+ self.assertEqual(Result.strip(), Expected)
+
+#
+# Test GenPcdSections
+#
+class GenPcdSectionsTest(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ #
+ # This is the API to generate Pcd Object to help UnitTest
+ #
+ def ObjectFactory(self, ItemType, TSCName, CName, DValue, FFE, Usage, Str):
+ Object = PcdObject()
+ HelpStr = Str
+
+ Object.SetItemType(ItemType)
+ Object.SetTokenSpaceGuidCName(TSCName)
+ Object.SetCName(CName)
+ Object.SetDefaultValue(DValue)
+ Object.SetFeatureFlag(FFE)
+ Object.SetValidUsage(Usage)
+
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang('')
+ HelpTextObj.SetString(HelpStr)
+ Object.SetHelpTextList([HelpTextObj])
+
+ return Object
+
+
+ # Usage Help INF Comment
+ #1 UNDEFINED Present # Help
+ #2 UNDEFINED Not Present <empty>
+ #3 Other Present ## Other # Help
+ #4 Other Not Present ## Other
+
+ def testNormalCase1(self):
+ ObjectList = []
+ ItemType = 'Pcd'
+ TSCName = 'TSCName'
+ CName = 'CName'
+ DValue = 'DValue'
+ FFE = 'FFE'
+
+ Usage = 'UNDEFINED'
+ Str = 'Help'
+
+ Object = self.ObjectFactory(ItemType, TSCName, CName, DValue, FFE,
+ Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenPcdSections(ObjectList)
+ Expected = \
+ '[Pcd]\n' + \
+ 'TSCName.CName|DValue|FFE # Help'
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCase2(self):
+ ObjectList = []
+ ItemType = 'Pcd'
+ TSCName = 'TSCName'
+ CName = 'CName'
+ DValue = 'DValue'
+ FFE = 'FFE'
+
+ Usage = 'UNDEFINED'
+ Str = ''
+
+ Object = self.ObjectFactory(ItemType, TSCName, CName, DValue, FFE,
+ Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenPcdSections(ObjectList)
+ Expected = '[Pcd]\nTSCName.CName|DValue|FFE'
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCase3(self):
+ ObjectList = []
+ ItemType = 'Pcd'
+ TSCName = 'TSCName'
+ CName = 'CName'
+ DValue = 'DValue'
+ FFE = 'FFE'
+
+ Usage = 'CONSUMES'
+ Str = 'Help'
+
+ Object = self.ObjectFactory(ItemType, TSCName, CName, DValue, FFE,
+ Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenPcdSections(ObjectList)
+ Expected = '[Pcd]\nTSCName.CName|DValue|FFE ## CONSUMES # Help'
+ self.assertEqual(Result.strip(), Expected)
+
+ def testNormalCase4(self):
+ ObjectList = []
+ ItemType = 'Pcd'
+ TSCName = 'TSCName'
+ CName = 'CName'
+ DValue = 'DValue'
+ FFE = 'FFE'
+
+ Usage = 'CONSUMES'
+ Str = ''
+
+ Object = self.ObjectFactory(ItemType, TSCName, CName, DValue, FFE,
+ Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenPcdSections(ObjectList)
+ Expected = '[Pcd]\nTSCName.CName|DValue|FFE ## CONSUMES'
+ self.assertEqual(Result.strip(), Expected)
+
+ #
+ # multiple lines for normal usage
+ #
+ def testNormalCase5(self):
+ ObjectList = []
+ ItemType = 'Pcd'
+ TSCName = 'TSCName'
+ CName = 'CName'
+ DValue = 'DValue'
+ FFE = 'FFE'
+
+ Usage = 'CONSUMES'
+ Str = 'commment line 1\ncomment line 2'
+ Object = self.ObjectFactory(ItemType, TSCName, CName, DValue, FFE,
+ Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenPcdSections(ObjectList)
+ Expected = '''[Pcd]
+TSCName.CName|DValue|FFE ## CONSUMES # commment line 1 comment line 2'''
+ self.assertEqual(Result.strip(), Expected)
+
+ #
+ # multiple lines for UNDEFINED usage
+ #
+ def testNormalCase6(self):
+ ObjectList = []
+ ItemType = 'Pcd'
+ TSCName = 'TSCName'
+ CName = 'CName'
+ DValue = 'DValue'
+ FFE = 'FFE'
+
+ Usage = 'UNDEFINED'
+ Str = 'commment line 1\ncomment line 2'
+ Object = self.ObjectFactory(ItemType, TSCName, CName, DValue, FFE,
+ Usage, Str)
+ ObjectList.append(Object)
+
+ Usage = 'UNDEFINED'
+ Str = 'commment line 3'
+ Object = self.ObjectFactory(ItemType, TSCName, CName, DValue, FFE,
+ Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenPcdSections(ObjectList)
+ Expected = '''[Pcd]
+# commment line 1
+# comment line 2
+# commment line 3
+TSCName.CName|DValue|FFE'''
+ self.assertEqual(Result.strip(), Expected)
+
+ #
+ # multiple lines for UNDEFINED and normal usage
+ #
+ def testNormalCase7(self):
+ ObjectList = []
+ ItemType = 'Pcd'
+ TSCName = 'TSCName'
+ CName = 'CName'
+ DValue = 'DValue'
+ FFE = 'FFE'
+
+ Usage = 'UNDEFINED'
+ Str = 'commment line 1\ncomment line 2'
+ Object = self.ObjectFactory(ItemType, TSCName, CName, DValue, FFE,
+ Usage, Str)
+ ObjectList.append(Object)
+
+ Usage = 'CONSUMES'
+ Str = 'Foo'
+ Object = self.ObjectFactory(ItemType, TSCName, CName, DValue, FFE,
+ Usage, Str)
+ ObjectList.append(Object)
+
+ Usage = 'UNDEFINED'
+ Str = 'commment line 3'
+ Object = self.ObjectFactory(ItemType, TSCName, CName, DValue, FFE,
+ Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenPcdSections(ObjectList)
+ Expected = '''[Pcd]
+# commment line 1
+# comment line 2
+## CONSUMES # Foo
+# commment line 3
+TSCName.CName|DValue|FFE'''
+ self.assertEqual(Result.strip(), Expected)
+
+ # Usage Help INF Comment
+ # CONSUMES Present # Help (keep <EOL> and insert '#' at beginning of each new line)
+ # CONSUMES Not Present <empty>
+
+ #
+ # TAB_INF_FEATURE_PCD
+ #
+ def testNormalCase8(self):
+ ObjectList = []
+ ItemType = TAB_INF_FEATURE_PCD
+ TSCName = 'TSCName'
+ CName = 'CName'
+ DValue = 'DValue'
+ FFE = 'FFE'
+
+ Usage = 'CONSUMES'
+ Str = 'commment line 1\ncomment line 2'
+ Object = self.ObjectFactory(ItemType, TSCName, CName, DValue, FFE,
+ Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenPcdSections(ObjectList)
+ Expected = '''[FeaturePcd]
+# commment line 1
+# comment line 2
+TSCName.CName|DValue|FFE'''
+ self.assertEqual(Result.strip(), Expected)
+
+ #
+ # TAB_INF_FEATURE_PCD
+ #
+ def testNormalCase9(self):
+ ObjectList = []
+ ItemType = TAB_INF_FEATURE_PCD
+ TSCName = 'TSCName'
+ CName = 'CName'
+ DValue = 'DValue'
+ FFE = 'FFE'
+
+ Usage = 'CONSUMES'
+ Str = ''
+ Object = self.ObjectFactory(ItemType, TSCName, CName, DValue, FFE,
+ Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenPcdSections(ObjectList)
+ Expected = '''[FeaturePcd]
+TSCName.CName|DValue|FFE'''
+ self.assertEqual(Result.strip(), Expected)
+
+ #
+ # TAB_INF_FEATURE_PCD
+ #
+ def testNormalCase10(self):
+ ObjectList = []
+ ItemType = TAB_INF_FEATURE_PCD
+ TSCName = 'TSCName'
+ CName = 'CName'
+ DValue = 'DValue'
+ FFE = 'FFE'
+
+ Usage = 'PRODUCES'
+ Str = 'commment line 1\ncomment line 2'
+ Object = self.ObjectFactory(ItemType, TSCName, CName, DValue, FFE,
+ Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenPcdSections(ObjectList)
+ Expected = '''
+
+[FeaturePcd]
+# commment line 1
+# comment line 2
+TSCName.CName|DValue|FFE
+'''
+ self.assertEqual(Result, Expected)
+
+
+#
+# Test GenSpecialSections of Hob
+#
+class GenHobSectionsTest(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ #
+ # This is the API to generate Event Object to help UnitTest
+ #
+ def ObjectFactory(self, SupArchList, Type, Usage, Str):
+ Object = HobObject()
+ HelpStr = Str
+
+ Object.SetHobType(Type)
+ Object.SetUsage(Usage)
+ Object.SetSupArchList(SupArchList)
+
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang('')
+ HelpTextObj.SetString(HelpStr)
+ Object.SetHelpTextList([HelpTextObj])
+
+ return Object
+
+ def testNormalCase1(self):
+ ObjectList = []
+ SupArchList = ['X64']
+ Type = 'Foo'
+ Usage = 'UNDEFINED'
+ Str = 'Help'
+
+ Object = self.ObjectFactory(SupArchList, Type, Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenSpecialSections(ObjectList, 'Hob')
+ Expected = '''# [Hob.X64]
+# ##
+# # Help
+# #
+# Foo ## UNDEFINED
+#
+#
+'''
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase2(self):
+ ObjectList = []
+ SupArchList = []
+ Type = 'Foo'
+ Usage = 'UNDEFINED'
+ Str = 'Help'
+
+ Object = self.ObjectFactory(SupArchList, Type, Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenSpecialSections(ObjectList, 'Hob')
+ Expected = '''# [Hob]
+# ##
+# # Help
+# #
+# Foo ## UNDEFINED
+#
+#
+'''
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase3(self):
+ ObjectList = []
+ SupArchList = ['X64']
+ Type = 'Foo'
+ Usage = 'UNDEFINED'
+ Str = '\nComment Line 1\n\n'
+
+ Object = self.ObjectFactory(SupArchList, Type, Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenSpecialSections(ObjectList, 'Hob')
+ Expected = '''# [Hob.X64]
+# ##
+# # Comment Line 1
+# #
+# Foo ## UNDEFINED
+#
+#
+'''
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase4(self):
+ ObjectList = []
+ SupArchList = ['X64']
+ Type = 'Foo'
+ Usage = 'UNDEFINED'
+ Str = '\nComment Line 1\n'
+
+ Object = self.ObjectFactory(SupArchList, Type, Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenSpecialSections(ObjectList, 'Hob')
+ Expected = '''# [Hob.X64]
+# ##
+# # Comment Line 1
+# #
+# Foo ## UNDEFINED
+#
+#
+'''
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase5(self):
+ ObjectList = []
+ SupArchList = ['X64']
+ Type = 'Foo'
+ Usage = 'UNDEFINED'
+ Str = 'Comment Line 1\n\n'
+
+ Object = self.ObjectFactory(SupArchList, Type, Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenSpecialSections(ObjectList, 'Hob')
+ Expected = '''# [Hob.X64]
+# ##
+# # Comment Line 1
+# #
+# Foo ## UNDEFINED
+#
+#
+'''
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase6(self):
+ ObjectList = []
+ SupArchList = ['X64']
+ Type = 'Foo'
+ Usage = 'UNDEFINED'
+ Str = ''
+
+ Object = self.ObjectFactory(SupArchList, Type, Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenSpecialSections(ObjectList, 'Hob')
+ Expected = '''# [Hob.X64]
+# Foo ## UNDEFINED
+#
+#
+'''
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase7(self):
+ ObjectList = []
+ SupArchList = ['X64']
+ Type = 'Foo'
+ Usage = 'UNDEFINED'
+ Str = '\nNew Stack HoB'
+
+
+ Object = self.ObjectFactory(SupArchList, Type, Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenSpecialSections(ObjectList, 'Hob')
+ Expected = '''# [Hob.X64]
+# ##
+# # New Stack HoB
+# #
+# Foo ## UNDEFINED
+#
+#
+'''
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase8(self):
+ ObjectList = []
+ SupArchList = ['X64']
+ Type = 'Foo'
+ Usage = 'UNDEFINED'
+ Str = '\nNew Stack HoB\n\nTail Comment'
+
+
+ Object = self.ObjectFactory(SupArchList, Type, Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenSpecialSections(ObjectList, 'Hob')
+ Expected = '''# [Hob.X64]
+# ##
+# # New Stack HoB
+# #
+# # Tail Comment
+# #
+# Foo ## UNDEFINED
+#
+#
+'''
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase9(self):
+ ObjectList = []
+ SupArchList = ['X64']
+ Type = 'Foo'
+ Usage = 'UNDEFINED'
+ Str = '\n\n'
+
+
+ Object = self.ObjectFactory(SupArchList, Type, Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenSpecialSections(ObjectList, 'Hob')
+ Expected = '''# [Hob.X64]
+# ##
+# #
+# #
+# Foo ## UNDEFINED
+#
+#
+'''
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase10(self):
+ ObjectList = []
+ SupArchList = ['X64']
+ Type = 'Foo'
+ Usage = 'UNDEFINED'
+ Str = '\n'
+
+ Object = self.ObjectFactory(SupArchList, Type, Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenSpecialSections(ObjectList, 'Hob')
+ Expected = '''# [Hob.X64]
+# ##
+# #
+# #
+# Foo ## UNDEFINED
+#
+#
+'''
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase11(self):
+ ObjectList = []
+ SupArchList = ['X64']
+ Type = 'Foo'
+ Usage = 'UNDEFINED'
+ Str = '\n\n\n'
+
+ Object = self.ObjectFactory(SupArchList, Type, Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenSpecialSections(ObjectList, 'Hob')
+ Expected = '''# [Hob.X64]
+# ##
+# #
+# #
+# Foo ## UNDEFINED
+#
+#
+'''
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase12(self):
+ ObjectList = []
+ SupArchList = ['X64']
+ Type = 'Foo'
+ Usage = 'UNDEFINED'
+ Str = '\n\n\n\n'
+
+ Object = self.ObjectFactory(SupArchList, Type, Usage, Str)
+ ObjectList.append(Object)
+
+ Result = GenSpecialSections(ObjectList, 'Hob')
+ Expected = '''# [Hob.X64]
+# ##
+# #
+# #
+# #
+# Foo ## UNDEFINED
+#
+#
+'''
+ self.assertEqual(Result, Expected)
+
+#
+# Test GenGenericCommentF
+#
+class GenGenericCommentFTest(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testNormalCase1(self):
+ CommentLines = 'Comment Line 1'
+ Result = GenGenericCommentF(CommentLines)
+ Expected = '# Comment Line 1\n'
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase2(self):
+ CommentLines = '\n'
+ Result = GenGenericCommentF(CommentLines)
+ Expected = '#\n'
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase3(self):
+ CommentLines = '\n\n\n'
+ Result = GenGenericCommentF(CommentLines)
+ Expected = '#\n#\n#\n'
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase4(self):
+ CommentLines = 'coment line 1\n'
+ Result = GenGenericCommentF(CommentLines)
+ Expected = '# coment line 1\n'
+ self.assertEqual(Result, Expected)
+
+ def testNormalCase5(self):
+ CommentLines = 'coment line 1\n coment line 2\n'
+ Result = GenGenericCommentF(CommentLines)
+ Expected = '# coment line 1\n# coment line 2\n'
+ self.assertEqual(Result, Expected)
+
+if __name__ == '__main__':
+ Logger.Initialize()
+ unittest.main()
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/CommentParsingUnitTest.py b/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/CommentParsingUnitTest.py
new file mode 100644
index 000000000..4a3f6db5e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/CommentParsingUnitTest.py
@@ -0,0 +1,917 @@
+## @file
+# This file contain unit test for CommentParsing
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+import unittest
+
+import Logger.Log as Logger
+from Library.CommentParsing import ParseHeaderCommentSection, \
+ ParseGenericComment, \
+ ParseDecPcdGenericComment, \
+ ParseDecPcdTailComment
+from Library.CommentParsing import _IsCopyrightLine
+from Library.StringUtils import GetSplitValueList
+from Library.DataType import TAB_SPACE_SPLIT
+from Library.DataType import TAB_LANGUAGE_EN_US
+
+#
+# Test ParseHeaderCommentSection
+#
+class ParseHeaderCommentSectionTest(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ #
+ # Normal case1: have license/copyright/license above @file
+ #
+ def testNormalCase1(self):
+ TestCommentLines1 = \
+ '''# License1
+ # License2
+ #
+ ## @file
+ # example abstract
+ #
+ # example description
+ #
+ # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+ #
+ # License3
+ #'''
+
+ CommentList = GetSplitValueList(TestCommentLines1, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ Abstract, Description, Copyright, License = \
+ ParseHeaderCommentSection(TestCommentLinesList, "PhonyFile")
+
+ ExpectedAbstract = 'example abstract'
+ self.assertEqual(Abstract, ExpectedAbstract)
+
+ ExpectedDescription = 'example description'
+ self.assertEqual(Description, ExpectedDescription)
+
+ ExpectedCopyright = \
+ 'Copyright (c) 2007 - 2010,'\
+ ' Intel Corporation. All rights reserved.<BR>'
+ self.assertEqual(Copyright, ExpectedCopyright)
+
+ ExpectedLicense = 'License1\nLicense2\n\nLicense3'
+ self.assertEqual(License, ExpectedLicense)
+
+ #
+ # Normal case2: have license/copyright above @file, but no copyright after
+ #
+ def testNormalCase2(self):
+ TestCommentLines2 = \
+ ''' # License1
+ # License2
+ #
+ ## @file
+ # example abstract
+ #
+ # example description
+ #
+ #Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+ #
+ ##'''
+
+ CommentList = GetSplitValueList(TestCommentLines2, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ Abstract, Description, Copyright, License = \
+ ParseHeaderCommentSection(TestCommentLinesList, "PhonyFile")
+
+ ExpectedAbstract = 'example abstract'
+ self.assertEqual(Abstract, ExpectedAbstract)
+
+ ExpectedDescription = 'example description'
+ self.assertEqual(Description, ExpectedDescription)
+
+ ExpectedCopyright = \
+ 'Copyright (c) 2007 - 2018, Intel Corporation.'\
+ ' All rights reserved.<BR>'
+ self.assertEqual(Copyright, ExpectedCopyright)
+
+ ExpectedLicense = 'License1\nLicense2'
+ self.assertEqual(License, ExpectedLicense)
+
+
+ #
+ # Normal case2: have license/copyright/license above @file,
+ # but no abstract/description
+ #
+ def testNormalCase3(self):
+ TestCommentLines3 = \
+ ''' # License1
+ # License2
+ #
+ ## @file
+ # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+ #
+ # License3 Line1
+ # License3 Line2
+ ##'''
+
+ CommentList = GetSplitValueList(TestCommentLines3, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ Abstract, Description, Copyright, License = \
+ ParseHeaderCommentSection(TestCommentLinesList, "PhonyFile")
+
+ ExpectedAbstract = ''
+ self.assertEqual(Abstract, ExpectedAbstract)
+
+ ExpectedDescription = ''
+ self.assertEqual(Description, ExpectedDescription)
+
+ ExpectedCopyright = \
+ 'Copyright (c) 2007 - 2010,'\
+ ' Intel Corporation. All rights reserved.<BR>'
+ self.assertEqual(Copyright, ExpectedCopyright)
+
+ ExpectedLicense = \
+ 'License1\n' \
+ 'License2\n\n' \
+ 'License3 Line1\n' \
+ 'License3 Line2'
+ self.assertEqual(License, ExpectedLicense)
+
+ #
+ # Normal case4: format example in spec
+ #
+ def testNormalCase4(self):
+ TestCommentLines = \
+ '''
+ ## @file
+ # Abstract
+ #
+ # Description
+ #
+ # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+ #
+ # License
+ #
+ ##'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ Abstract, Description, Copyright, License = \
+ ParseHeaderCommentSection(TestCommentLinesList, "PhonyFile")
+
+ ExpectedAbstract = 'Abstract'
+ self.assertEqual(Abstract, ExpectedAbstract)
+
+ ExpectedDescription = 'Description'
+ self.assertEqual(Description, ExpectedDescription)
+
+ ExpectedCopyright = \
+ 'Copyright (c) 2007 - 2018, Intel Corporation.'\
+ ' All rights reserved.<BR>'
+ self.assertEqual(Copyright, ExpectedCopyright)
+
+ ExpectedLicense = \
+ 'License'
+ self.assertEqual(License, ExpectedLicense)
+
+ #
+ # Normal case5: other line between copyright
+ #
+ def testNormalCase5(self):
+ TestCommentLines = \
+ '''
+ ## @file
+ # Abstract
+ #
+ # Description
+ #
+ # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+ # other line
+ # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+ #
+ # License
+ #
+ ##'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ Abstract, Description, Copyright, License = \
+ ParseHeaderCommentSection(TestCommentLinesList, "PhonyFile")
+
+ ExpectedAbstract = 'Abstract'
+ self.assertEqual(Abstract, ExpectedAbstract)
+
+ ExpectedDescription = 'Description'
+ self.assertEqual(Description, ExpectedDescription)
+
+ ExpectedCopyright = \
+ 'Copyright (c) 2007 - 2018, Intel Corporation.'\
+ ' All rights reserved.<BR>\n'\
+ 'Copyright (c) 2007 - 2018, Intel Corporation.'\
+ ' All rights reserved.<BR>'
+ self.assertEqual(Copyright, ExpectedCopyright)
+
+ ExpectedLicense = \
+ 'License'
+ self.assertEqual(License, ExpectedLicense)
+
+ #
+ # Normal case6: multiple lines of copyright
+ #
+ def testNormalCase6(self):
+ TestCommentLines = \
+ '''
+ ## @file
+ # Abstract
+ #
+ # Description
+ #
+ # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+ # Copyright (c) 2007 - 2010, FOO1 Corporation. All rights reserved.<BR>
+ # Copyright (c) 2007 - 2010, FOO2 Corporation. All rights reserved.<BR>
+ #
+ # License
+ #
+ ##'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ Abstract, Description, Copyright, License = \
+ ParseHeaderCommentSection(TestCommentLinesList, "PhonyFile")
+
+ ExpectedAbstract = 'Abstract'
+ self.assertEqual(Abstract, ExpectedAbstract)
+
+ ExpectedDescription = 'Description'
+ self.assertEqual(Description, ExpectedDescription)
+
+ ExpectedCopyright = \
+ 'Copyright (c) 2007 - 2018, Intel Corporation.'\
+ ' All rights reserved.<BR>\n'\
+ 'Copyright (c) 2007 - 2010, FOO1 Corporation.'\
+ ' All rights reserved.<BR>\n'\
+ 'Copyright (c) 2007 - 2010, FOO2 Corporation.'\
+ ' All rights reserved.<BR>'
+ self.assertEqual(Copyright, ExpectedCopyright)
+
+ ExpectedLicense = \
+ 'License'
+ self.assertEqual(License, ExpectedLicense)
+
+ #
+ # Normal case7: Abstract not present
+ #
+ def testNormalCase7(self):
+ TestCommentLines = \
+ '''
+ ## @file
+ #
+ # Description
+ #
+ # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+ # Copyright (c) 2007 - 2010, FOO1 Corporation. All rights reserved.<BR>
+ # Copyright (c) 2007 - 2010, FOO2 Corporation. All rights reserved.<BR>
+ #
+ # License
+ #
+ ##'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ Abstract, Description, Copyright, License = \
+ ParseHeaderCommentSection(TestCommentLinesList, "PhonyFile")
+
+ ExpectedAbstract = ''
+ self.assertEqual(Abstract, ExpectedAbstract)
+
+ ExpectedDescription = 'Description'
+ self.assertEqual(Description, ExpectedDescription)
+
+ ExpectedCopyright = \
+ 'Copyright (c) 2007 - 2018, Intel Corporation.'\
+ ' All rights reserved.<BR>\n'\
+ 'Copyright (c) 2007 - 2010, FOO1 Corporation.'\
+ ' All rights reserved.<BR>\n'\
+ 'Copyright (c) 2007 - 2010, FOO2 Corporation.'\
+ ' All rights reserved.<BR>'
+ self.assertEqual(Copyright, ExpectedCopyright)
+
+ ExpectedLicense = \
+ 'License'
+ self.assertEqual(License, ExpectedLicense)
+
+ #
+ # Normal case8: Description not present
+ #
+ def testNormalCase8(self):
+ TestCommentLines = \
+ '''
+ ## @file
+ # Abstact
+ #
+ # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+ #
+ # License
+ #
+ ##'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ Abstract, Description, Copyright, License = \
+ ParseHeaderCommentSection(TestCommentLinesList, "PhonyFile")
+
+ ExpectedAbstract = 'Abstact'
+ self.assertEqual(Abstract, ExpectedAbstract)
+
+ ExpectedDescription = ''
+ self.assertEqual(Description, ExpectedDescription)
+
+ ExpectedCopyright = \
+ 'Copyright (c) 2007 - 2018, Intel Corporation.'\
+ ' All rights reserved.<BR>'
+ self.assertEqual(Copyright, ExpectedCopyright)
+
+ ExpectedLicense = \
+ 'License'
+ self.assertEqual(License, ExpectedLicense)
+
+ #
+ # Error case1: No copyright found
+ #
+ def testErrorCase1(self):
+ TestCommentLines = \
+ '''
+ ## @file
+ # Abstract
+ #
+ # Description
+ #
+ # License
+ #
+ ##'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ self.assertRaises(Logger.FatalError,
+ ParseHeaderCommentSection,
+ TestCommentLinesList,
+ "PhonyFile")
+
+ #
+ # Error case2: non-empty non-comment lines passed in
+ #
+ def testErrorCase2(self):
+ TestCommentLines = \
+ '''
+ ## @file
+ # Abstract
+ #
+ this is invalid line
+ # Description
+ #
+ # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+ # License
+ #
+ ##'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ self.assertRaises(Logger.FatalError,
+ ParseHeaderCommentSection,
+ TestCommentLinesList,
+ "PhonyFile")
+
+#
+# Test ParseGenericComment
+#
+class ParseGenericCommentTest(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ #
+ # Normal case1: one line of comment
+ #
+ def testNormalCase1(self):
+ TestCommentLines = \
+ '''# hello world'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ HelptxtObj = ParseGenericComment(TestCommentLinesList, 'testNormalCase1')
+ self.failIf(not HelptxtObj)
+ self.assertEqual(HelptxtObj.GetString(), 'hello world')
+ self.assertEqual(HelptxtObj.GetLang(), TAB_LANGUAGE_EN_US)
+
+ #
+ # Normal case2: multiple lines of comment
+ #
+ def testNormalCase2(self):
+ TestCommentLines = \
+ '''## hello world
+ # second line'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ HelptxtObj = ParseGenericComment(TestCommentLinesList, 'testNormalCase2')
+ self.failIf(not HelptxtObj)
+ self.assertEqual(HelptxtObj.GetString(),
+ 'hello world\n' + 'second line')
+ self.assertEqual(HelptxtObj.GetLang(), TAB_LANGUAGE_EN_US)
+
+ #
+ # Normal case3: multiple lines of comment, non comment lines will be skipped
+ #
+ def testNormalCase3(self):
+ TestCommentLines = \
+ '''## hello world
+ This is not comment line'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ HelptxtObj = ParseGenericComment(TestCommentLinesList, 'testNormalCase3')
+ self.failIf(not HelptxtObj)
+ self.assertEqual(HelptxtObj.GetString(),
+ 'hello world\n\n')
+ self.assertEqual(HelptxtObj.GetLang(), TAB_LANGUAGE_EN_US)
+
+#
+# Test ParseDecPcdGenericComment
+#
+class ParseDecPcdGenericCommentTest(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ #
+ # Normal case1: comments with no special comment
+ #
+ def testNormalCase1(self):
+ TestCommentLines = \
+ '''## hello world
+ # second line'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ (HelpTxt, PcdErr) = \
+ ParseDecPcdGenericComment(TestCommentLinesList, 'testNormalCase1')
+ self.failIf(not HelpTxt)
+ self.failIf(PcdErr)
+ self.assertEqual(HelpTxt,
+ 'hello world\n' + 'second line')
+
+
+ #
+ # Normal case2: comments with valid list
+ #
+ def testNormalCase2(self):
+ TestCommentLines = \
+ '''## hello world
+ # second line
+ # @ValidList 1, 2, 3
+ # other line'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ (HelpTxt, PcdErr) = \
+ ParseDecPcdGenericComment(TestCommentLinesList, 'UnitTest')
+ self.failIf(not HelpTxt)
+ self.failIf(not PcdErr)
+ self.assertEqual(HelpTxt,
+ 'hello world\n' + 'second line\n' + 'other line')
+ ExpectedList = GetSplitValueList('1 2 3', TAB_SPACE_SPLIT)
+ ActualList = [item for item in \
+ GetSplitValueList(PcdErr.GetValidValue(), TAB_SPACE_SPLIT) if item]
+ self.assertEqual(ExpectedList, ActualList)
+ self.failIf(PcdErr.GetExpression())
+ self.failIf(PcdErr.GetValidValueRange())
+
+ #
+ # Normal case3: comments with valid range
+ #
+ def testNormalCase3(self):
+ TestCommentLines = \
+ '''## hello world
+ # second line
+ # @ValidRange LT 1 AND GT 2
+ # other line'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ (HelpTxt, PcdErr) = \
+ ParseDecPcdGenericComment(TestCommentLinesList, 'UnitTest')
+ self.failIf(not HelpTxt)
+ self.failIf(not PcdErr)
+ self.assertEqual(HelpTxt,
+ 'hello world\n' + 'second line\n' + 'other line')
+ self.assertEqual(PcdErr.GetValidValueRange().strip(), 'LT 1 AND GT 2')
+ self.failIf(PcdErr.GetExpression())
+ self.failIf(PcdErr.GetValidValue())
+
+ #
+ # Normal case4: comments with valid expression
+ #
+ def testNormalCase4(self):
+ TestCommentLines = \
+ '''## hello world
+ # second line
+ # @Expression LT 1 AND GT 2
+ # other line'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ (HelpTxt, PcdErr) = \
+ ParseDecPcdGenericComment(TestCommentLinesList, 'UnitTest')
+ self.failIf(not HelpTxt)
+ self.failIf(not PcdErr)
+ self.assertEqual(HelpTxt,
+ 'hello world\n' + 'second line\n' + 'other line')
+ self.assertEqual(PcdErr.GetExpression().strip(), 'LT 1 AND GT 2')
+ self.failIf(PcdErr.GetValidValueRange())
+ self.failIf(PcdErr.GetValidValue())
+
+ #
+ # Normal case5: comments with valid expression and no generic comment
+ #
+ def testNormalCase5(self):
+ TestCommentLines = \
+ '''# @Expression LT 1 AND GT 2'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ (HelpTxt, PcdErr) = \
+ ParseDecPcdGenericComment(TestCommentLinesList, 'UnitTest')
+ self.failIf(HelpTxt)
+ self.failIf(not PcdErr)
+ self.assertEqual(PcdErr.GetExpression().strip(), 'LT 1 AND GT 2')
+ self.failIf(PcdErr.GetValidValueRange())
+ self.failIf(PcdErr.GetValidValue())
+
+ #
+ # Normal case6: comments with only generic help text
+ #
+ def testNormalCase6(self):
+ TestCommentLines = \
+ '''#'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ (HelpTxt, PcdErr) = \
+ ParseDecPcdGenericComment(TestCommentLinesList, 'UnitTest')
+ self.assertEqual(HelpTxt, '\n')
+ self.failIf(PcdErr)
+
+
+
+ #
+ # Error case1: comments with both expression and valid list, use later
+ # ignore the former and with a warning message
+ #
+ def testErrorCase1(self):
+ TestCommentLines = \
+ '''## hello world
+ # second line
+ # @ValidList 1, 2, 3
+ # @Expression LT 1 AND GT 2
+ # other line'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ try:
+ ParseDecPcdGenericComment(TestCommentLinesList, 'UnitTest')
+ except Logger.FatalError:
+ pass
+
+#
+# Test ParseDecPcdTailComment
+#
+class ParseDecPcdTailCommentTest(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ #
+ # Normal case1: comments with no SupModeList
+ #
+ def testNormalCase1(self):
+ TestCommentLines = \
+ '''## #hello world'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ (SupModeList, HelpStr) = \
+ ParseDecPcdTailComment(TestCommentLinesList, 'UnitTest')
+ self.failIf(not HelpStr)
+ self.failIf(SupModeList)
+ self.assertEqual(HelpStr,
+ 'hello world')
+
+ #
+ # Normal case2: comments with one SupMode
+ #
+ def testNormalCase2(self):
+ TestCommentLines = \
+ '''## BASE #hello world'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ (SupModeList, HelpStr) = \
+ ParseDecPcdTailComment(TestCommentLinesList, 'UnitTest')
+ self.failIf(not HelpStr)
+ self.failIf(not SupModeList)
+ self.assertEqual(HelpStr,
+ 'hello world')
+ self.assertEqual(SupModeList,
+ ['BASE'])
+
+ #
+ # Normal case3: comments with more than one SupMode
+ #
+ def testNormalCase3(self):
+ TestCommentLines = \
+ '''## BASE UEFI_APPLICATION #hello world'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ (SupModeList, HelpStr) = \
+ ParseDecPcdTailComment(TestCommentLinesList, 'UnitTest')
+ self.failIf(not HelpStr)
+ self.failIf(not SupModeList)
+ self.assertEqual(HelpStr,
+ 'hello world')
+ self.assertEqual(SupModeList,
+ ['BASE', 'UEFI_APPLICATION'])
+
+ #
+ # Normal case4: comments with more than one SupMode, no help text
+ #
+ def testNormalCase4(self):
+ TestCommentLines = \
+ '''## BASE UEFI_APPLICATION'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ (SupModeList, HelpStr) = \
+ ParseDecPcdTailComment(TestCommentLinesList, 'UnitTest')
+ self.failIf(HelpStr)
+ self.failIf(not SupModeList)
+ self.assertEqual(SupModeList,
+ ['BASE', 'UEFI_APPLICATION'])
+
+ #
+ # Normal case5: general comments with no supModList, extract from real case
+ #
+ def testNormalCase5(self):
+ TestCommentLines = \
+ ''' # 1 = 128MB, 2 = 256MB, 3 = MAX'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ (SupModeList, HelpStr) = \
+ ParseDecPcdTailComment(TestCommentLinesList, 'UnitTest')
+ self.failIf(not HelpStr)
+ self.assertEqual(HelpStr,
+ '1 = 128MB, 2 = 256MB, 3 = MAX')
+ self.failIf(SupModeList)
+
+
+ #
+ # Error case2: comments with supModList contains valid and invalid
+ # module type
+ #
+ def testErrorCase2(self):
+ TestCommentLines = \
+ '''## BASE INVALID_MODULE_TYPE #hello world'''
+
+ CommentList = GetSplitValueList(TestCommentLines, "\n")
+ LineNum = 0
+ TestCommentLinesList = []
+ for Comment in CommentList:
+ LineNum += 1
+ TestCommentLinesList.append((Comment, LineNum))
+
+ try:
+ ParseDecPcdTailComment(TestCommentLinesList, 'UnitTest')
+ except Logger.FatalError:
+ pass
+
+
+#
+# Test _IsCopyrightLine
+#
+class _IsCopyrightLineTest(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ #
+ # Normal case
+ #
+ def testCase1(self):
+ Line = 'this is a copyright ( line'
+ Result = _IsCopyrightLine(Line)
+ self.failIf(not Result)
+
+ #
+ # Normal case
+ #
+ def testCase2(self):
+ Line = 'this is a Copyright ( line'
+ Result = _IsCopyrightLine(Line)
+ self.failIf(not Result)
+
+ #
+ # Normal case
+ #
+ def testCase3(self):
+ Line = 'this is not aCopyright ( line'
+ Result = _IsCopyrightLine(Line)
+ self.failIf(Result)
+
+ #
+ # Normal case
+ #
+ def testCase4(self):
+ Line = 'this is Copyright( line'
+ Result = _IsCopyrightLine(Line)
+ self.failIf(not Result)
+
+ #
+ # Normal case
+ #
+ def testCase5(self):
+ Line = 'this is Copyright (line'
+ Result = _IsCopyrightLine(Line)
+ self.failIf(not Result)
+
+ #
+ # Normal case
+ #
+ def testCase6(self):
+ Line = 'this is not Copyright line'
+ Result = _IsCopyrightLine(Line)
+ self.failIf(Result)
+
+ #
+ # Normal case
+ #
+ def testCase7(self):
+ Line = 'Copyright (c) line'
+ Result = _IsCopyrightLine(Line)
+ self.failIf(not Result)
+
+ #
+ # Normal case
+ #
+ def testCase8(self):
+ Line = ' Copyright (c) line'
+ Result = _IsCopyrightLine(Line)
+ self.failIf(not Result)
+
+ #
+ # Normal case
+ #
+ def testCase9(self):
+ Line = 'not a Copyright '
+ Result = _IsCopyrightLine(Line)
+ self.failIf(Result)
+
+if __name__ == '__main__':
+ Logger.Initialize()
+ unittest.main()
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/DecParserTest.py b/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/DecParserTest.py
new file mode 100644
index 000000000..b9f7dfe52
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/DecParserTest.py
@@ -0,0 +1,279 @@
+## @file
+# This file contain unit test for DecParser
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+from __future__ import print_function
+import os
+import unittest
+
+from Parser.DecParserMisc import \
+ IsValidCArray, \
+ IsValidPcdDatum
+
+from Parser.DecParser import Dec
+
+from Library.ParserValidate import IsValidCFormatGuid
+
+#
+# Test tool function
+#
+def TestToolFuncs():
+ assert IsValidCArray('{0x1, 0x23}')
+
+ # Empty after comma
+ assert not IsValidCArray('{0x1, 0x23, }')
+
+ # 0x2345 too long
+ assert not IsValidCArray('{0x1, 0x2345}')
+
+ # Must end with '}'
+ assert not IsValidCArray('{0x1, 0x23, ')
+
+ # Whitespace between numbers
+ assert not IsValidCArray('{0x1, 0x2 3, }')
+
+ assert IsValidPcdDatum('VOID*', '"test"')[0]
+ assert IsValidPcdDatum('VOID*', 'L"test"')[0]
+ assert IsValidPcdDatum('BOOLEAN', 'TRUE')[0]
+ assert IsValidPcdDatum('BOOLEAN', 'FALSE')[0]
+ assert IsValidPcdDatum('BOOLEAN', '0')[0]
+ assert IsValidPcdDatum('BOOLEAN', '1')[0]
+ assert IsValidPcdDatum('UINT8', '0xab')[0]
+
+ assert not IsValidPcdDatum('UNKNOWNTYPE', '0xabc')[0]
+ assert not IsValidPcdDatum('UINT8', 'not number')[0]
+
+ assert( IsValidCFormatGuid('{ 0xfa0b1735 , 0x87a0, 0x4193, {0xb2, 0x66 , 0x53, 0x8c , 0x38, 0xaf, 0x48, 0xce }}'))
+ assert( not IsValidCFormatGuid('{ 0xfa0b1735 , 0x87a0, 0x4193, {0xb2, 0x66 , 0x53, 0x8c , 0x38, 0xaf, 0x48, 0xce }} 0xaa'))
+
+def TestTemplate(TestString, TestFunc):
+ Path = os.path.join(os.getcwd(), 'test.dec')
+ Path = os.path.normpath(Path)
+ try:
+ f = open(Path, 'w')
+
+ # Write test string to file
+ f.write(TestString)
+
+ # Close file
+ f.close()
+ except:
+ print('Can not create temporary file [%s]!' % Path)
+ exit(-1)
+
+ # Call test function to test
+ Ret = TestFunc(Path, TestString)
+
+ # Test done, remove temporary file
+ os.remove(Path)
+ return Ret
+
+# To make test unit works OK, must set IsRaiseError to True
+# This function test right syntax DEC file
+# @retval: parser object
+#
+def TestOK(Path, TestString):
+ try:
+ Parser = Dec(Path)
+ except:
+ raise 'Bug!!! Correct syntax in DEC file, but exception raised!\n' + TestString
+ return Parser
+
+# This function test wrong syntax DEC file
+# if parser checked wrong syntax, exception thrown and it's expected result
+def TestError(Path, TestString):
+ try:
+ Dec(Path)
+ except:
+ # Raise error, get expected result
+ return True
+ raise 'Bug!!! Wrong syntax in DEC file, but passed by DEC parser!!\n' + TestString
+
+def TestDecDefine():
+ TestString = '''
+ [Defines]
+ DEC_SPECIFICATION = 0x00010005
+ PACKAGE_NAME = MdePkg
+ PACKAGE_GUID = 1E73767F-8F52-4603-AEB4-F29B510B6766
+ PACKAGE_VERSION = 1.02
+ '''
+ Parser = TestTemplate(TestString, TestOK)
+ DefObj = Parser.GetDefineSectionObject()
+ assert DefObj.GetPackageSpecification() == '0x00010005'
+ assert DefObj.GetPackageName() == 'MdePkg'
+ assert DefObj.GetPackageGuid() == '1E73767F-8F52-4603-AEB4-F29B510B6766'
+ assert DefObj.GetPackageVersion() == '1.02'
+
+ TestString = '''
+ [Defines]
+ UNKNOW_KEY = 0x00010005 # A unknown key
+ '''
+ assert TestTemplate(TestString, TestError)
+
+ TestString = '''
+ [Defines]
+ PACKAGE_GUID = F-8F52-4603-AEB4-F29B510B6766 # Error GUID
+ '''
+ assert TestTemplate(TestString, TestError)
+
+def TestDecInclude():
+ TestString = '''
+ [Defines]
+ DEC_SPECIFICATION = 0x00010005
+ PACKAGE_NAME = MdePkg
+ PACKAGE_GUID = 1E73767F-8F52-4603-AEB4-F29B510B6766
+ PACKAGE_VERSION = 1.02
+ [ \\
+ Includes]
+ Include
+ [Includes.IA32]
+ Include/Ia32
+ '''
+
+ # Create directory in current directory
+ try:
+ os.makedirs('Include/Ia32')
+ except:
+ pass
+ Parser = TestTemplate(TestString, TestOK)
+
+ IncObj = Parser.GetIncludeSectionObject()
+ Items = IncObj.GetIncludes()
+ assert len(Items) == 1
+ assert Items[0].File == 'Include'
+
+ Items = IncObj.GetIncludes('IA32')
+ assert len(Items) == 1
+ # normpath is called in DEC parser so '/' is converted to '\'
+ assert Items[0].File == 'Include\\Ia32'
+
+ TestString = '''
+ [Defines]
+ DEC_SPECIFICATION = 0x00010005
+ PACKAGE_NAME = MdePkg
+ PACKAGE_GUID = 1E73767F-8F52-4603-AEB4-F29B510B6766
+ PACKAGE_VERSION = 1.02
+ [Includes]
+ Include_not_exist # directory does not exist
+ '''
+ assert TestTemplate(TestString, TestError)
+
+ os.removedirs('Include/Ia32')
+
+def TestDecGuidPpiProtocol():
+ TestString = '''
+ [Defines]
+ DEC_SPECIFICATION = 0x00010005
+ PACKAGE_NAME = MdePkg
+ PACKAGE_GUID = 1E73767F-8F52-4603-AEB4-F29B510B6766
+ PACKAGE_VERSION = 1.02
+ [Guids]
+ #
+ # GUID defined in UEFI2.1/UEFI2.0/EFI1.1
+ #
+ ## Include/Guid/GlobalVariable.h
+ gEfiGlobalVariableGuid = { 0x8BE4DF61, 0x93CA, 0x11D2, { 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }}
+ [Protocols]
+ ## Include/Protocol/Bds.h
+ gEfiBdsArchProtocolGuid = { 0x665E3FF6, 0x46CC, 0x11D4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }}
+ [Ppis]
+ ## Include/Ppi/MasterBootMode.h
+ gEfiPeiMasterBootModePpiGuid = { 0x7408d748, 0xfc8c, 0x4ee6, {0x92, 0x88, 0xc4, 0xbe, 0xc0, 0x92, 0xa4, 0x10 } }
+ '''
+ Parser = TestTemplate(TestString, TestOK)
+ Obj = Parser.GetGuidSectionObject()
+ Items = Obj.GetGuids()
+ assert Obj.GetSectionName() == 'Guids'.upper()
+ assert len(Items) == 1
+ assert Items[0].GuidCName == 'gEfiGlobalVariableGuid'
+ assert Items[0].GuidCValue == '{ 0x8BE4DF61, 0x93CA, 0x11D2, { 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }}'
+
+ Obj = Parser.GetProtocolSectionObject()
+ Items = Obj.GetProtocols()
+ assert Obj.GetSectionName() == 'Protocols'.upper()
+ assert len(Items) == 1
+ assert Items[0].GuidCName == 'gEfiBdsArchProtocolGuid'
+ assert Items[0].GuidCValue == '{ 0x665E3FF6, 0x46CC, 0x11D4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }}'
+
+ Obj = Parser.GetPpiSectionObject()
+ Items = Obj.GetPpis()
+ assert Obj.GetSectionName() == 'Ppis'.upper()
+ assert len(Items) == 1
+ assert Items[0].GuidCName == 'gEfiPeiMasterBootModePpiGuid'
+ assert Items[0].GuidCValue == '{ 0x7408d748, 0xfc8c, 0x4ee6, {0x92, 0x88, 0xc4, 0xbe, 0xc0, 0x92, 0xa4, 0x10 } }'
+
+def TestDecPcd():
+ TestString = '''
+ [Defines]
+ DEC_SPECIFICATION = 0x00010005
+ PACKAGE_NAME = MdePkg
+ PACKAGE_GUID = 1E73767F-8F52-4603-AEB4-F29B510B6766
+ PACKAGE_VERSION = 1.02
+ [PcdsFeatureFlag]
+ ## If TRUE, the component name protocol will not be installed.
+ gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|FALSE|BOOLEAN|0x0000000d
+
+ [PcdsFixedAtBuild]
+ ## Indicates the maximum length of unicode string
+ gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000|UINT32|0x00000001
+
+ [PcdsFixedAtBuild.IPF]
+ ## The base address of IO port space for IA64 arch
+ gEfiMdePkgTokenSpaceGuid.PcdIoBlockBaseAddressForIpf|0x0ffffc000000|UINT64|0x0000000f
+
+ [PcdsFixedAtBuild,PcdsPatchableInModule]
+ ## This flag is used to control the printout of DebugLib
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000|UINT32|0x00000006
+
+ [PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic]
+ ## This value is used to set the base address of pci express hierarchy
+ gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xE0000000|UINT64|0x0000000a
+ '''
+ Parser = TestTemplate(TestString, TestOK)
+ Obj = Parser.GetPcdSectionObject()
+ Items = Obj.GetPcds('PcdsFeatureFlag', 'COMMON')
+ assert len(Items) == 1
+ assert Items[0].TokenSpaceGuidCName == 'gEfiMdePkgTokenSpaceGuid'
+ assert Items[0].TokenCName == 'PcdComponentNameDisable'
+ assert Items[0].DefaultValue == 'FALSE'
+ assert Items[0].DatumType == 'BOOLEAN'
+ assert Items[0].TokenValue == '0x0000000d'
+
+ Items = Obj.GetPcdsByType('PcdsFixedAtBuild')
+ assert len(Items) == 4
+ assert len(Obj.GetPcdsByType('PcdsPatchableInModule')) == 2
+
+def TestDecUserExtension():
+ TestString = '''
+ [Defines]
+ DEC_SPECIFICATION = 0x00010005
+ PACKAGE_NAME = MdePkg
+ PACKAGE_GUID = 1E73767F-8F52-4603-AEB4-F29B510B6766
+ PACKAGE_VERSION = 1.02
+ [UserExtensions.MyID."TestString".IA32]
+ Some Strings...
+ '''
+ Parser = TestTemplate(TestString, TestOK)
+ Obj = Parser.GetUserExtensionSectionObject()
+ Items = Obj.GetAllUserExtensions()
+ assert len(Items) == 1
+ assert Items[0].UserString == 'Some Strings...'
+ assert len(Items[0].ArchAndModuleType) == 1
+ assert ['MyID', '"TestString"', 'IA32'] in Items[0].ArchAndModuleType
+
+if __name__ == '__main__':
+ import Logger.Logger
+ Logger.Logger.Initialize()
+ unittest.FunctionTestCase(TestToolFuncs).runTest()
+ unittest.FunctionTestCase(TestDecDefine).runTest()
+ unittest.FunctionTestCase(TestDecInclude).runTest()
+ unittest.FunctionTestCase(TestDecGuidPpiProtocol).runTest()
+ unittest.FunctionTestCase(TestDecPcd).runTest()
+ unittest.FunctionTestCase(TestDecUserExtension).runTest()
+
+ print('All tests passed...')
+
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py b/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py
new file mode 100644
index 000000000..bac127f8e
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py
@@ -0,0 +1,528 @@
+## @file
+# This file contain unit test for DecParser
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+import os
+import unittest
+from Logger.Log import FatalError
+
+from Parser.DecParser import \
+ Dec, \
+ _DecDefine, \
+ _DecLibraryclass, \
+ _DecPcd, \
+ _DecGuid, \
+ FileContent, \
+ _DecBase, \
+ CleanString
+
+from Object.Parser.DecObject import _DecComments
+
+#
+# Test CleanString
+#
+class CleanStringTestCase(unittest.TestCase):
+ def testCleanString(self):
+ Line, Comment = CleanString('')
+ self.assertEqual(Line, '')
+ self.assertEqual(Comment, '')
+
+ Line, Comment = CleanString('line without comment')
+ self.assertEqual(Line, 'line without comment')
+ self.assertEqual(Comment, '')
+
+ Line, Comment = CleanString('# pure comment')
+ self.assertEqual(Line, '')
+ self.assertEqual(Comment, '# pure comment')
+
+ Line, Comment = CleanString('line # and comment')
+ self.assertEqual(Line, 'line')
+ self.assertEqual(Comment, '# and comment')
+
+ def testCleanStringCpp(self):
+ Line, Comment = CleanString('line // and comment', AllowCppStyleComment = True)
+ self.assertEqual(Line, 'line')
+ self.assertEqual(Comment, '# and comment')
+
+#
+# Test _DecBase._MacroParser function
+#
+class MacroParserTestCase(unittest.TestCase):
+ def setUp(self):
+ self.dec = _DecBase(FileContent('dummy', []))
+
+ def testCorrectMacro(self):
+ self.dec._MacroParser('DEFINE MACRO1 = test1')
+ self.failIf('MACRO1' not in self.dec._LocalMacro)
+ self.assertEqual(self.dec._LocalMacro['MACRO1'], 'test1')
+
+ def testErrorMacro1(self):
+ # Raise fatal error, macro name must be upper case letter
+ self.assertRaises(FatalError, self.dec._MacroParser, 'DEFINE not_upper_case = test2')
+
+ def testErrorMacro2(self):
+ # No macro name given
+ self.assertRaises(FatalError, self.dec._MacroParser, 'DEFINE ')
+
+#
+# Test _DecBase._TryBackSlash function
+#
+class TryBackSlashTestCase(unittest.TestCase):
+ def setUp(self):
+ Content = [
+ # Right case
+ 'test no backslash',
+
+ 'test with backslash \\',
+ 'continue second line',
+
+ # Do not precede with whitespace
+ '\\',
+
+ # Empty line after backlash is not allowed
+ 'line with backslash \\',
+ ''
+ ]
+ self.dec = _DecBase(FileContent('dummy', Content))
+
+ def testBackSlash(self):
+ #
+ # Right case, assert return values
+ #
+ ConcatLine, CommentList = self.dec._TryBackSlash(self.dec._RawData.GetNextLine(), [])
+ self.assertEqual(ConcatLine, 'test no backslash')
+ self.assertEqual(CommentList, [])
+
+ ConcatLine, CommentList = self.dec._TryBackSlash(self.dec._RawData.GetNextLine(), [])
+ self.assertEqual(CommentList, [])
+ self.assertEqual(ConcatLine, 'test with backslash continue second line')
+
+ #
+ # Error cases, assert raise exception
+ #
+ self.assertRaises(FatalError, self.dec._TryBackSlash, self.dec._RawData.GetNextLine(), [])
+ self.assertRaises(FatalError, self.dec._TryBackSlash, self.dec._RawData.GetNextLine(), [])
+
+#
+# Test _DecBase.Parse function
+#
+class DataItem(_DecComments):
+ def __init__(self):
+ _DecComments.__init__(self)
+ self.String = ''
+
+class Data(_DecComments):
+ def __init__(self):
+ _DecComments.__init__(self)
+ # List of DataItem
+ self.ItemList = []
+
+class TestInner(_DecBase):
+ def __init__(self, RawData):
+ _DecBase.__init__(self, RawData)
+ self.ItemObject = Data()
+
+ def _StopCurrentParsing(self, Line):
+ return Line == '[TOP]'
+
+ def _ParseItem(self):
+ Item = DataItem()
+ Item.String = self._RawData.CurrentLine
+ self.ItemObject.ItemList.append(Item)
+ return Item
+
+ def _TailCommentStrategy(self, Comment):
+ return Comment.find('@comment') != -1
+
+class TestTop(_DecBase):
+ def __init__(self, RawData):
+ _DecBase.__init__(self, RawData)
+ # List of Data
+ self.ItemObject = []
+
+ # Top parser
+ def _StopCurrentParsing(self, Line):
+ return False
+
+ def _ParseItem(self):
+ TestParser = TestInner(self._RawData)
+ TestParser.Parse()
+ self.ItemObject.append(TestParser.ItemObject)
+ return TestParser.ItemObject
+
+class ParseTestCase(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def testParse(self):
+ Content = \
+ '''# Top comment
+ [TOP]
+ # sub1 head comment
+ (test item has both head and tail comment) # sub1 tail comment
+ # sub2 head comment
+ (test item has head and special tail comment)
+ # @comment test TailCommentStrategy branch
+
+ (test item has no comment)
+
+ # test NextLine branch
+ [TOP]
+ sub-item
+ '''
+ dec = TestTop(FileContent('dummy', Content.splitlines()))
+ dec.Parse()
+
+ # Two sections
+ self.assertEqual(len(dec.ItemObject), 2)
+
+ data = dec.ItemObject[0]
+ self.assertEqual(data._HeadComment[0][0], '# Top comment')
+ self.assertEqual(data._HeadComment[0][1], 1)
+
+ # 3 subitems
+ self.assertEqual(len(data.ItemList), 3)
+
+ dataitem = data.ItemList[0]
+ self.assertEqual(dataitem.String, '(test item has both head and tail comment)')
+ # Comment content
+ self.assertEqual(dataitem._HeadComment[0][0], '# sub1 head comment')
+ self.assertEqual(dataitem._TailComment[0][0], '# sub1 tail comment')
+ # Comment line number
+ self.assertEqual(dataitem._HeadComment[0][1], 3)
+ self.assertEqual(dataitem._TailComment[0][1], 4)
+
+ dataitem = data.ItemList[1]
+ self.assertEqual(dataitem.String, '(test item has head and special tail comment)')
+ # Comment content
+ self.assertEqual(dataitem._HeadComment[0][0], '# sub2 head comment')
+ self.assertEqual(dataitem._TailComment[0][0], '# @comment test TailCommentStrategy branch')
+ # Comment line number
+ self.assertEqual(dataitem._HeadComment[0][1], 5)
+ self.assertEqual(dataitem._TailComment[0][1], 7)
+
+ dataitem = data.ItemList[2]
+ self.assertEqual(dataitem.String, '(test item has no comment)')
+ # Comment content
+ self.assertEqual(dataitem._HeadComment, [])
+ self.assertEqual(dataitem._TailComment, [])
+
+ data = dec.ItemObject[1]
+ self.assertEqual(data._HeadComment[0][0], '# test NextLine branch')
+ self.assertEqual(data._HeadComment[0][1], 11)
+
+ # 1 subitems
+ self.assertEqual(len(data.ItemList), 1)
+
+ dataitem = data.ItemList[0]
+ self.assertEqual(dataitem.String, 'sub-item')
+ self.assertEqual(dataitem._HeadComment, [])
+ self.assertEqual(dataitem._TailComment, [])
+
+#
+# Test _DecDefine._ParseItem
+#
+class DecDefineTestCase(unittest.TestCase):
+ def GetObj(self, Content):
+ Obj = _DecDefine(FileContent('dummy', Content.splitlines()))
+ Obj._RawData.CurrentLine = Obj._RawData.GetNextLine()
+ return Obj
+
+ def testDecDefine(self):
+ item = self.GetObj('PACKAGE_NAME = MdePkg')._ParseItem()
+ self.assertEqual(item.Key, 'PACKAGE_NAME')
+ self.assertEqual(item.Value, 'MdePkg')
+
+ def testDecDefine1(self):
+ obj = self.GetObj('PACKAGE_NAME')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+ def testDecDefine2(self):
+ obj = self.GetObj('unknown_key = ')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+ def testDecDefine3(self):
+ obj = self.GetObj('PACKAGE_NAME = ')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+#
+# Test _DecLibraryclass._ParseItem
+#
+class DecLibraryTestCase(unittest.TestCase):
+ def GetObj(self, Content):
+ Obj = _DecLibraryclass(FileContent('dummy', Content.splitlines()))
+ Obj._RawData.CurrentLine = Obj._RawData.GetNextLine()
+ return Obj
+
+ def testNoInc(self):
+ obj = self.GetObj('UefiRuntimeLib')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+ def testEmpty(self):
+ obj = self.GetObj(' | ')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+ def testLibclassNaming(self):
+ obj = self.GetObj('lowercase_efiRuntimeLib|Include/Library/UefiRuntimeLib.h')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+ def testLibclassExt(self):
+ obj = self.GetObj('RuntimeLib|Include/Library/UefiRuntimeLib.no_h')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+ def testLibclassRelative(self):
+ obj = self.GetObj('RuntimeLib|Include/../UefiRuntimeLib.h')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+#
+# Test _DecPcd._ParseItem
+#
+class DecPcdTestCase(unittest.TestCase):
+ def GetObj(self, Content):
+ Obj = _DecPcd(FileContent('dummy', Content.splitlines()))
+ Obj._RawData.CurrentLine = Obj._RawData.GetNextLine()
+ Obj._RawData.CurrentScope = [('PcdsFeatureFlag'.upper(), 'COMMON')]
+ return Obj
+
+ def testOK(self):
+ item = self.GetObj('gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|FALSE|BOOLEAN|0x0000000d')._ParseItem()
+ self.assertEqual(item.TokenSpaceGuidCName, 'gEfiMdePkgTokenSpaceGuid')
+ self.assertEqual(item.TokenCName, 'PcdComponentNameDisable')
+ self.assertEqual(item.DefaultValue, 'FALSE')
+ self.assertEqual(item.DatumType, 'BOOLEAN')
+ self.assertEqual(item.TokenValue, '0x0000000d')
+
+ def testNoCvar(self):
+ obj = self.GetObj('123ai.PcdComponentNameDisable|FALSE|BOOLEAN|0x0000000d')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+ def testSplit(self):
+ obj = self.GetObj('gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable FALSE|BOOLEAN|0x0000000d')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+ obj = self.GetObj('gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|FALSE|BOOLEAN|0x0000000d | abc')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+ def testUnknownType(self):
+ obj = self.GetObj('gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|FALSE|unknown|0x0000000d')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+ def testVoid(self):
+ obj = self.GetObj('gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|abc|VOID*|0x0000000d')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+ def testUINT(self):
+ obj = self.GetObj('gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|0xabc|UINT8|0x0000000d')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+#
+# Test _DecInclude._ParseItem
+#
+class DecIncludeTestCase(unittest.TestCase):
+ #
+ # Test code to be added
+ #
+ pass
+
+#
+# Test _DecGuid._ParseItem
+#
+class DecGuidTestCase(unittest.TestCase):
+ def GetObj(self, Content):
+ Obj = _DecGuid(FileContent('dummy', Content.splitlines()))
+ Obj._RawData.CurrentLine = Obj._RawData.GetNextLine()
+ Obj._RawData.CurrentScope = [('guids'.upper(), 'COMMON')]
+ return Obj
+
+ def testCValue(self):
+ item = self.GetObj('gEfiIpSecProtocolGuid={ 0xdfb386f7, 0xe100, 0x43ad,'
+ ' {0x9c, 0x9a, 0xed, 0x90, 0xd0, 0x8a, 0x5e, 0x12 }}')._ParseItem()
+ self.assertEqual(item.GuidCName, 'gEfiIpSecProtocolGuid')
+ self.assertEqual(item.GuidCValue, '{ 0xdfb386f7, 0xe100, 0x43ad, {0x9c, 0x9a, 0xed, 0x90, 0xd0, 0x8a, 0x5e, 0x12 }}')
+
+ def testGuidString(self):
+ item = self.GetObj('gEfiIpSecProtocolGuid=1E73767F-8F52-4603-AEB4-F29B510B6766')._ParseItem()
+ self.assertEqual(item.GuidCName, 'gEfiIpSecProtocolGuid')
+ self.assertEqual(item.GuidCValue, '1E73767F-8F52-4603-AEB4-F29B510B6766')
+
+ def testNoValue1(self):
+ obj = self.GetObj('gEfiIpSecProtocolGuid')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+ def testNoValue2(self):
+ obj = self.GetObj('gEfiIpSecProtocolGuid=')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+ def testNoName(self):
+ obj = self.GetObj('=')
+ self.assertRaises(FatalError, obj._ParseItem)
+
+#
+# Test Dec.__init__
+#
+class DecDecInitTestCase(unittest.TestCase):
+ def testNoDecFile(self):
+ self.assertRaises(FatalError, Dec, 'No_Such_File')
+
+class TmpFile:
+ def __init__(self, File):
+ self.File = File
+
+ def Write(self, Content):
+ try:
+ FileObj = open(self.File, 'w')
+ FileObj.write(Content)
+ FileObj.close()
+ except:
+ pass
+
+ def Remove(self):
+ try:
+ os.remove(self.File)
+ except:
+ pass
+
+#
+# Test Dec._UserExtentionSectionParser
+#
+class DecUESectionTestCase(unittest.TestCase):
+ def setUp(self):
+ self.File = TmpFile('test.dec')
+ self.File.Write(
+'''[userextensions.intel."myid"]
+[userextensions.intel."myid".IA32]
+[userextensions.intel."myid".IA32,]
+[userextensions.intel."myid]
+'''
+ )
+
+ def tearDown(self):
+ self.File.Remove()
+
+ def testUserExtentionHeader(self):
+ dec = Dec('test.dec', False)
+
+ # OK: [userextensions.intel."myid"]
+ dec._RawData.CurrentLine = CleanString(dec._RawData.GetNextLine())[0]
+ dec._UserExtentionSectionParser()
+ self.assertEqual(len(dec._RawData.CurrentScope), 1)
+ self.assertEqual(dec._RawData.CurrentScope[0][0], 'userextensions'.upper())
+ self.assertEqual(dec._RawData.CurrentScope[0][1], 'intel')
+ self.assertEqual(dec._RawData.CurrentScope[0][2], '"myid"')
+ self.assertEqual(dec._RawData.CurrentScope[0][3], 'COMMON')
+
+ # OK: [userextensions.intel."myid".IA32]
+ dec._RawData.CurrentLine = CleanString(dec._RawData.GetNextLine())[0]
+ dec._UserExtentionSectionParser()
+ self.assertEqual(len(dec._RawData.CurrentScope), 1)
+ self.assertEqual(dec._RawData.CurrentScope[0][0], 'userextensions'.upper())
+ self.assertEqual(dec._RawData.CurrentScope[0][1], 'intel')
+ self.assertEqual(dec._RawData.CurrentScope[0][2], '"myid"')
+ self.assertEqual(dec._RawData.CurrentScope[0][3], 'IA32')
+
+ # Fail: [userextensions.intel."myid".IA32,]
+ dec._RawData.CurrentLine = CleanString(dec._RawData.GetNextLine())[0]
+ self.assertRaises(FatalError, dec._UserExtentionSectionParser)
+
+ # Fail: [userextensions.intel."myid]
+ dec._RawData.CurrentLine = CleanString(dec._RawData.GetNextLine())[0]
+ self.assertRaises(FatalError, dec._UserExtentionSectionParser)
+
+#
+# Test Dec._SectionHeaderParser
+#
+class DecSectionTestCase(unittest.TestCase):
+ def setUp(self):
+ self.File = TmpFile('test.dec')
+ self.File.Write(
+'''[no section start or end
+[,] # empty sub-section
+[unknow_section_name]
+[Includes.IA32.other] # no third one
+[PcdsFeatureFlag, PcdsFixedAtBuild] # feature flag PCD must not be in the same section of other types of PCD
+[Includes.IA32, Includes.IA32]
+[Includes, Includes.IA32] # common cannot be with other arch
+[Includes.IA32, PcdsFeatureFlag] # different section name
+''' )
+
+ def tearDown(self):
+ self.File.Remove()
+
+ def testSectionHeader(self):
+ dec = Dec('test.dec', False)
+ # [no section start or end
+ dec._RawData.CurrentLine = CleanString(dec._RawData.GetNextLine())[0]
+ self.assertRaises(FatalError, dec._SectionHeaderParser)
+
+ #[,] # empty sub-section
+ dec._RawData.CurrentLine = CleanString(dec._RawData.GetNextLine())[0]
+ self.assertRaises(FatalError, dec._SectionHeaderParser)
+
+ # [unknow_section_name]
+ dec._RawData.CurrentLine = CleanString(dec._RawData.GetNextLine())[0]
+ self.assertRaises(FatalError, dec._SectionHeaderParser)
+
+ # [Includes.IA32.other] # no third one
+ dec._RawData.CurrentLine = CleanString(dec._RawData.GetNextLine())[0]
+ self.assertRaises(FatalError, dec._SectionHeaderParser)
+
+ # [PcdsFeatureFlag, PcdsFixedAtBuild]
+ dec._RawData.CurrentLine = CleanString(dec._RawData.GetNextLine())[0]
+ self.assertRaises(FatalError, dec._SectionHeaderParser)
+
+ # [Includes.IA32, Includes.IA32]
+ dec._RawData.CurrentLine = CleanString(dec._RawData.GetNextLine())[0]
+ dec._SectionHeaderParser()
+ self.assertEqual(len(dec._RawData.CurrentScope), 1)
+ self.assertEqual(dec._RawData.CurrentScope[0][0], 'Includes'.upper())
+ self.assertEqual(dec._RawData.CurrentScope[0][1], 'IA32')
+
+ # [Includes, Includes.IA32] # common cannot be with other arch
+ dec._RawData.CurrentLine = CleanString(dec._RawData.GetNextLine())[0]
+ self.assertRaises(FatalError, dec._SectionHeaderParser)
+
+ # [Includes.IA32, PcdsFeatureFlag] # different section name not allowed
+ dec._RawData.CurrentLine = CleanString(dec._RawData.GetNextLine())[0]
+ self.assertRaises(FatalError, dec._SectionHeaderParser)
+
+#
+# Test Dec._ParseDecComment
+#
+class DecDecCommentTestCase(unittest.TestCase):
+ def testDecHeadComment(self):
+ File = TmpFile('test.dec')
+ File.Write(
+ '''# abc
+ ##''')
+ dec = Dec('test.dec', False)
+ dec.ParseDecComment()
+ self.assertEqual(len(dec._HeadComment), 2)
+ self.assertEqual(dec._HeadComment[0][0], '# abc')
+ self.assertEqual(dec._HeadComment[0][1], 1)
+ self.assertEqual(dec._HeadComment[1][0], '##')
+ self.assertEqual(dec._HeadComment[1][1], 2)
+ File.Remove()
+
+ def testNoDoubleComment(self):
+ File = TmpFile('test.dec')
+ File.Write(
+ '''# abc
+ #
+ [section_start]''')
+ dec = Dec('test.dec', False)
+ dec.ParseDecComment()
+ self.assertEqual(len(dec._HeadComment), 2)
+ self.assertEqual(dec._HeadComment[0][0], '# abc')
+ self.assertEqual(dec._HeadComment[0][1], 1)
+ self.assertEqual(dec._HeadComment[1][0], '#')
+ self.assertEqual(dec._HeadComment[1][1], 2)
+ File.Remove()
+
+if __name__ == '__main__':
+ import Logger.Logger
+ Logger.Logger.Initialize()
+ unittest.main()
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.py b/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.py
new file mode 100644
index 000000000..12e3045f3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.py
@@ -0,0 +1,381 @@
+## @file
+# This file contain unit test for Test [Binary] section part of InfParser
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+from __future__ import print_function
+import os
+#import Object.Parser.InfObject as InfObject
+from Object.Parser.InfCommonObject import CurrentLine
+from Object.Parser.InfCommonObject import InfLineCommentObject
+from Object.Parser.InfBinaryObject import InfBinariesObject
+import Logger.Log as Logger
+import Library.GlobalData as Global
+##
+# Test Common binary item
+#
+
+#-------------start of common binary item test input--------------------------#
+
+#
+# Only has 1 element, binary item Type
+#
+SectionStringsCommonItem1 = \
+"""
+GUID
+"""
+#
+# Have 2 elements, binary item Type and FileName
+#
+SectionStringsCommonItem2 = \
+"""
+GUID | Test/Test.guid
+"""
+
+#
+# Have 3 elements, Type | FileName | Target | Family | TagName | FeatureFlagExp
+#
+SectionStringsCommonItem3 = \
+"""
+GUID | Test/Test.guid | DEBUG
+"""
+
+#
+# Have 3 elements, Type | FileName | Target
+# Target with MACRO defined in [Define] section
+#
+SectionStringsCommonItem4 = \
+"""
+GUID | Test/Test.guid | $(TARGET)
+"""
+
+#
+# Have 3 elements, Type | FileName | Target
+# FileName with MACRO defined in [Binary] section
+#
+SectionStringsCommonItem5 = \
+"""
+DEFINE BINARY_FILE_PATH = Test
+GUID | $(BINARY_FILE_PATH)/Test.guid | $(TARGET)
+"""
+
+#
+# Have 4 elements, Type | FileName | Target | Family
+#
+SectionStringsCommonItem6 = \
+"""
+GUID | Test/Test.guid | DEBUG | *
+"""
+
+#
+# Have 4 elements, Type | FileName | Target | Family
+#
+SectionStringsCommonItem7 = \
+"""
+GUID | Test/Test.guid | DEBUG | MSFT
+"""
+
+#
+# Have 5 elements, Type | FileName | Target | Family | TagName
+#
+SectionStringsCommonItem8 = \
+"""
+GUID | Test/Test.guid | DEBUG | MSFT | TEST
+"""
+
+#
+# Have 6 elements, Type | FileName | Target | Family | TagName | FFE
+#
+SectionStringsCommonItem9 = \
+"""
+GUID | Test/Test.guid | DEBUG | MSFT | TEST | TRUE
+"""
+
+#
+# Have 7 elements, Type | FileName | Target | Family | TagName | FFE | Overflow
+# Test wrong format
+#
+SectionStringsCommonItem10 = \
+"""
+GUID | Test/Test.guid | DEBUG | MSFT | TEST | TRUE | OVERFLOW
+"""
+
+#-------------end of common binary item test input----------------------------#
+
+
+
+#-------------start of VER type binary item test input------------------------#
+
+#
+# Has 1 element, error format
+#
+SectionStringsVerItem1 = \
+"""
+VER
+"""
+#
+# Have 5 elements, error format(Maximum elements amount is 4)
+#
+SectionStringsVerItem2 = \
+"""
+VER | Test/Test.ver | * | TRUE | OverFlow
+"""
+
+#
+# Have 2 elements, Type | FileName
+#
+SectionStringsVerItem3 = \
+"""
+VER | Test/Test.ver
+"""
+
+#
+# Have 3 elements, Type | FileName | Target
+#
+SectionStringsVerItem4 = \
+"""
+VER | Test/Test.ver | DEBUG
+"""
+
+#
+# Have 4 elements, Type | FileName | Target | FeatureFlagExp
+#
+SectionStringsVerItem5 = \
+"""
+VER | Test/Test.ver | DEBUG | TRUE
+"""
+
+#
+# Exist 2 VER items, both opened.
+#
+SectionStringsVerItem6 = \
+"""
+VER | Test/Test.ver | * | TRUE
+VER | Test/Test2.ver | * | TRUE
+"""
+
+
+#
+# Exist 2 VER items, only 1 opened.
+#
+SectionStringsVerItem7 = \
+"""
+VER | Test/Test.ver | * | TRUE
+VER | Test/Test2.ver | * | FALSE
+"""
+
+#-------------end of VER type binary item test input--------------------------#
+
+
+#-------------start of UI type binary item test input-------------------------#
+
+#
+# Test only one UI section can exist
+#
+SectionStringsUiItem1 = \
+"""
+UI | Test/Test.ui | * | TRUE
+UI | Test/Test2.ui | * | TRUE
+"""
+
+SectionStringsUiItem2 = \
+"""
+UI | Test/Test.ui | * | TRUE
+SEC_UI | Test/Test2.ui | * | TRUE
+"""
+
+SectionStringsUiItem3 = \
+"""
+UI | Test/Test.ui | * | TRUE
+UI | Test/Test2.ui | * | FALSE
+"""
+
+#
+# Has 1 element, error format
+#
+SectionStringsUiItem4 = \
+"""
+UI
+"""
+#
+# Have 5 elements, error format(Maximum elements amount is 4)
+#
+SectionStringsUiItem5 = \
+"""
+UI | Test/Test.ui | * | TRUE | OverFlow
+"""
+
+#
+# Have 2 elements, Type | FileName
+#
+SectionStringsUiItem6 = \
+"""
+UI | Test/Test.ui
+"""
+
+#
+# Have 3 elements, Type | FileName | Target
+#
+SectionStringsUiItem7 = \
+"""
+UI | Test/Test.ui | DEBUG
+"""
+
+#
+# Have 4 elements, Type | FileName | Target | FeatureFlagExp
+#
+SectionStringsUiItem8 = \
+"""
+UI | Test/Test.ui | DEBUG | TRUE
+"""
+#---------------end of UI type binary item test input-------------------------#
+
+
+gFileName = "BinarySectionTest.inf"
+
+##
+# Construct SectionString for call section parser usage.
+#
+def StringToSectionString(String):
+ Lines = String.split('\n')
+ LineNo = 0
+ SectionString = []
+ for Line in Lines:
+ if Line.strip() == '':
+ continue
+ SectionString.append((Line, LineNo, ''))
+ LineNo = LineNo + 1
+
+ return SectionString
+
+def PrepareTest(String):
+ SectionString = StringToSectionString(String)
+ ItemList = []
+ for Item in SectionString:
+ ValueList = Item[0].split('|')
+ for count in range(len(ValueList)):
+ ValueList[count] = ValueList[count].strip()
+ if len(ValueList) >= 2:
+ #
+ # Create a temp file for test.
+ #
+ FileName = os.path.normpath(os.path.realpath(ValueList[1].strip()))
+ try:
+ TempFile = open (FileName, "w")
+ TempFile.close()
+ except:
+ print("File Create Error")
+ CurrentLine = CurrentLine()
+ CurrentLine.SetFileName("Test")
+ CurrentLine.SetLineString(Item[0])
+ CurrentLine.SetLineNo(Item[1])
+ InfLineCommentObject = InfLineCommentObject()
+
+ ItemList.append((ValueList, InfLineCommentObject, CurrentLine))
+
+ return ItemList
+
+if __name__ == '__main__':
+ Logger.Initialize()
+
+ InfBinariesInstance = InfBinariesObject()
+ ArchList = ['COMMON']
+ Global.gINF_MODULE_DIR = os.getcwd()
+
+ AllPassedFlag = True
+
+ #
+ # For All Ui test
+ #
+ UiStringList = [
+ SectionStringsUiItem1,
+ SectionStringsUiItem2,
+ SectionStringsUiItem3,
+ SectionStringsUiItem4,
+ SectionStringsUiItem5,
+ SectionStringsUiItem6,
+ SectionStringsUiItem7,
+ SectionStringsUiItem8
+ ]
+
+ for Item in UiStringList:
+ Ui = PrepareTest(Item)
+ if Item == SectionStringsUiItem4 or Item == SectionStringsUiItem5:
+ try:
+ InfBinariesInstance.SetBinary(Ui = Ui, ArchList = ArchList)
+ except Logger.FatalError:
+ pass
+ else:
+ try:
+ InfBinariesInstance.SetBinary(Ui = Ui, ArchList = ArchList)
+ except:
+ AllPassedFlag = False
+
+ #
+ # For All Ver Test
+ #
+ VerStringList = [
+ SectionStringsVerItem1,
+ SectionStringsVerItem2,
+ SectionStringsVerItem3,
+ SectionStringsVerItem4,
+ SectionStringsVerItem5,
+ SectionStringsVerItem6,
+ SectionStringsVerItem7
+ ]
+ for Item in VerStringList:
+ Ver = PrepareTest(Item)
+ if Item == SectionStringsVerItem1 or \
+ Item == SectionStringsVerItem2:
+
+ try:
+ InfBinariesInstance.SetBinary(Ver = Ver, ArchList = ArchList)
+ except:
+ pass
+
+ else:
+ try:
+ InfBinariesInstance.SetBinary(Ver = Ver, ArchList = ArchList)
+ except:
+ AllPassedFlag = False
+
+ #
+ # For All Common Test
+ #
+ CommonStringList = [
+ SectionStringsCommonItem1,
+ SectionStringsCommonItem2,
+ SectionStringsCommonItem3,
+ SectionStringsCommonItem4,
+ SectionStringsCommonItem5,
+ SectionStringsCommonItem6,
+ SectionStringsCommonItem7,
+ SectionStringsCommonItem8,
+ SectionStringsCommonItem9,
+ SectionStringsCommonItem10
+ ]
+
+ for Item in CommonStringList:
+ CommonBin = PrepareTest(Item)
+ if Item == SectionStringsCommonItem10 or \
+ Item == SectionStringsCommonItem1:
+
+ try:
+ InfBinariesInstance.SetBinary(CommonBinary = CommonBin, ArchList = ArchList)
+ except:
+ pass
+
+ else:
+ try:
+ InfBinariesInstance.SetBinary(Ver = Ver, ArchList = ArchList)
+ except:
+ print("Test Failed!")
+ AllPassedFlag = False
+
+ if AllPassedFlag :
+ print('All tests passed...')
+ else:
+ print('Some unit test failed!')
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Xml/CommonXml.py b/roms/edk2/BaseTools/Source/Python/UPT/Xml/CommonXml.py
new file mode 100644
index 000000000..cfadacf4a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Xml/CommonXml.py
@@ -0,0 +1,997 @@
+## @file
+# This file is used to parse a PCD file of .PKG file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+CommonXml
+'''
+
+##
+# Import Modules
+#
+
+from Core.DistributionPackageClass import DistributionPackageHeaderObject
+from Library.StringUtils import ConvertNEToNOTEQ
+from Library.StringUtils import ConvertNOTEQToNE
+from Library.StringUtils import GetSplitValueList
+from Library.StringUtils import GetStringOfList
+from Library.Xml.XmlRoutines import XmlElement
+from Library.Xml.XmlRoutines import XmlElement2
+from Library.Xml.XmlRoutines import XmlAttribute
+from Library.Xml.XmlRoutines import XmlNode
+from Library.Xml.XmlRoutines import XmlList
+from Library.Xml.XmlRoutines import CreateXmlElement
+from Library.UniClassObject import ConvertSpecialUnicodes
+from Library.UniClassObject import GetLanguageCode1766
+from Object.POM.CommonObject import FileObject
+from Object.POM.CommonObject import MiscFileObject
+from Object.POM.CommonObject import UserExtensionObject
+from Object.POM.CommonObject import ClonedRecordObject
+from Object.POM.CommonObject import LibraryClassObject
+from Object.POM.CommonObject import FileNameObject
+from Object.POM.ModuleObject import ModuleObject
+from Xml.XmlParserMisc import IsRequiredItemListNull
+from Xml.XmlParserMisc import GetHelpTextList
+import Library.DataType as DataType
+
+##
+# ClonedFromXml
+#
+class ClonedFromXml(object):
+ def __init__(self):
+ self.GUID = ''
+ self.Version = ''
+
+ def FromXml(self, Item, Key):
+ self.GUID = XmlElement(Item, '%s/GUID' % Key)
+ self.Version = XmlAttribute(XmlNode(Item, '%s/GUID' % Key), 'Version')
+ if self.GUID == '' and self.Version == '':
+ return None
+ ClonedFrom = ClonedRecordObject()
+ ClonedFrom.SetPackageGuid(self.GUID)
+ ClonedFrom.SetPackageVersion(self.Version)
+ return ClonedFrom
+
+ def ToXml(self, ClonedFrom, Key):
+ if self.GUID:
+ pass
+ Element1 = CreateXmlElement('GUID', ClonedFrom.GetPackageGuid(), [],
+ [['Version', ClonedFrom.GetPackageVersion()]])
+ AttributeList = []
+ NodeList = [Element1]
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+ return Root
+
+ def __str__(self):
+ return "GUID = %s Version = %s" % (self.GUID, self.Version)
+
+
+##
+# CommonDefinesXml
+#
+class CommonDefinesXml(object):
+ def __init__(self):
+ self.Usage = ''
+ self.SupArchList = []
+ self.SupModList = []
+ self.FeatureFlag = ''
+
+ def FromXml(self, Item, Key):
+ if Key:
+ pass
+ self.Usage = XmlAttribute(Item, 'Usage')
+ self.SupArchList = \
+ [Arch for Arch in GetSplitValueList(XmlAttribute(Item, 'SupArchList'), DataType.TAB_SPACE_SPLIT) if Arch]
+ self.SupModList = \
+ [Mod for Mod in GetSplitValueList(XmlAttribute(Item, 'SupModList'), DataType.TAB_SPACE_SPLIT) if Mod]
+ self.FeatureFlag = ConvertNOTEQToNE(XmlAttribute(Item, 'FeatureFlag'))
+
+ def ToXml(self):
+ pass
+
+ def __str__(self):
+ return "Usage = %s SupArchList = %s SupModList = %s FeatureFlag = %s" \
+ % (self.Usage, self.SupArchList, self.SupModList, self.FeatureFlag)
+
+##
+# PromptXml
+#
+class PromptXml(object):
+ def __init__(self):
+ self.Prompt = ''
+ self.Lang = ''
+
+ def FromXml(self, Item, Key):
+ if Key:
+ pass
+ self.Prompt = XmlElement2(Item, 'Prompt')
+ self.Lang = XmlAttribute(Item, 'Lang')
+
+ def ToXml(self, Prompt, Key='Prompt'):
+ if self.Prompt:
+ pass
+ return CreateXmlElement('%s' % Key, Prompt.GetString(), [], [['Lang', Prompt.GetLang()]])
+ def __str__(self):
+ return "Prompt = %s Lang = %s" % (self.Prompt, self.Lang)
+
+##
+# HelpTextXml
+#
+class HelpTextXml(object):
+ def __init__(self):
+ self.HelpText = ''
+ self.Lang = ''
+
+ def FromXml(self, Item, Key):
+ if Key:
+ pass
+ self.HelpText = XmlElement2(Item, 'HelpText')
+ self.Lang = XmlAttribute(Item, 'Lang')
+
+ def ToXml(self, HelpText, Key='HelpText'):
+ if self.HelpText:
+ pass
+ return CreateXmlElement('%s' % Key, HelpText.GetString(), [], [['Lang', HelpText.GetLang()]])
+ def __str__(self):
+ return "HelpText = %s Lang = %s" % (self.HelpText, self.Lang)
+
+##
+# HeaderXml
+#
+class HeaderXml(object):
+ def __init__(self):
+ self.Name = ''
+ self.BaseName = ''
+ self.GUID = ''
+ self.Version = ''
+ self.CopyrightList = []
+ self.LicenseList = []
+ self.AbstractList = []
+ self.DescriptionList = []
+
+ def FromXml(self, Item, Key, IsRequiredCheck=False, IsStandAlongModule=False):
+ if not Item and IsRequiredCheck:
+ XmlTreeLevel = []
+ if IsStandAlongModule:
+ XmlTreeLevel = ['DistributionPackage', 'ModuleSurfaceArea']
+ else:
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'ModuleSurfaceArea']
+ CheckDict = {'Header':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ self.Name = XmlElement(Item, '%s/Name' % Key)
+ self.BaseName = XmlAttribute(XmlNode(Item, '%s/Name' % Key), 'BaseName')
+ self.GUID = XmlElement(Item, '%s/GUID' % Key)
+ self.Version = XmlAttribute(XmlNode(Item, '%s/GUID' % Key), 'Version')
+
+ for SubItem in XmlList(Item, '%s/Abstract' % Key):
+ HeaderAbstractLang = XmlAttribute(SubItem, 'Lang')
+ self.AbstractList.append((HeaderAbstractLang, XmlElement(SubItem, '%s/Abstract' % Key)))
+ for SubItem in XmlList(Item, '%s/Description' % Key):
+ HeaderDescriptionLang = XmlAttribute(SubItem, 'Lang')
+ self.DescriptionList.append((HeaderDescriptionLang, XmlElement(SubItem, '%s/Description' % Key)))
+ for SubItem in XmlList(Item, '%s/Copyright' % Key):
+ HeaderCopyrightLang = XmlAttribute(SubItem, 'Lang')
+ self.CopyrightList.append((HeaderCopyrightLang, XmlElement(SubItem, '%s/Copyright' % Key)))
+ for SubItem in XmlList(Item, '%s/License' % Key):
+ HeaderLicenseLang = XmlAttribute(SubItem, 'Lang')
+ self.LicenseList.append((HeaderLicenseLang, XmlElement(SubItem, '%s/License' % Key)))
+ ModuleHeader = ModuleObject()
+ ModuleHeader.SetName(self.Name)
+ ModuleHeader.SetBaseName(self.BaseName)
+ ModuleHeader.SetGuid(self.GUID)
+ ModuleHeader.SetVersion(self.Version)
+ ModuleHeader.SetCopyright(self.CopyrightList)
+ ModuleHeader.SetLicense(self.LicenseList)
+ ModuleHeader.SetAbstract(self.AbstractList)
+ ModuleHeader.SetDescription(self.DescriptionList)
+ return ModuleHeader
+
+ def ToXml(self, Header, Key):
+ if self.GUID:
+ pass
+ Element1 = CreateXmlElement('Name', Header.GetName(), [], [['BaseName', Header.GetBaseName()]])
+ Element2 = CreateXmlElement('GUID', Header.GetGuid(), [], [['Version', Header.GetVersion()]])
+ NodeList = [Element1,
+ Element2,
+ ]
+
+ UNIInfAbstractList = []
+ UNIInfDescriptionList = []
+ # Get Abstract and Description from Uni File
+ # if the Uni File exists
+ if Header.UniFileClassObject is not None:
+ UniStrDict = Header.UniFileClassObject.OrderedStringList
+ for Lang in UniStrDict:
+ for StringDefClassObject in UniStrDict[Lang]:
+ if not StringDefClassObject.StringValue:
+ continue
+ if StringDefClassObject.StringName == DataType.TAB_INF_ABSTRACT:
+ UNIInfAbstractList.append((GetLanguageCode1766(Lang),
+ ConvertSpecialUnicodes(StringDefClassObject.StringValue)))
+
+ if StringDefClassObject.StringName == DataType.TAB_INF_DESCRIPTION:
+ UNIInfDescriptionList.append((GetLanguageCode1766(Lang),
+ ConvertSpecialUnicodes(StringDefClassObject.StringValue)))
+
+ # Get Abstract and Description from INF File Header
+ for (Lang, Value) in Header.GetCopyright():
+ if Value:
+ NodeList.append(CreateXmlElement('Copyright', Value, [], []))
+ for (Lang, Value) in Header.GetLicense():
+ if Value:
+ NodeList.append(CreateXmlElement('License', Value, [], []))
+ for (Lang, Value) in Header.GetAbstract() + UNIInfAbstractList:
+ if Value:
+ NodeList.append(CreateXmlElement('Abstract', Value, [], [['Lang', Lang]]))
+ for (Lang, Value) in Header.GetDescription() + UNIInfDescriptionList:
+ if Value:
+ NodeList.append(CreateXmlElement('Description', Value, [], [['Lang', Lang]]))
+
+ AttributeList = []
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+ return Root
+
+ def __str__(self):
+ return "Name = %s BaseName = %s GUID = %s Version = %s Copyright = %s \
+ License = %s Abstract = %s Description = %s" % \
+ (self.Name, self.BaseName, self.GUID, self.Version, self.CopyrightList, \
+ self.LicenseList, self.AbstractList, self.DescriptionList)
+##
+# DistributionPackageHeaderXml
+#
+class DistributionPackageHeaderXml(object):
+ def __init__(self):
+ self.Header = HeaderXml()
+ self.ReadOnly = ''
+ self.RePackage = ''
+ self.Vendor = ''
+ self.Date = ''
+ self.Signature = ''
+ self.XmlSpecification = ''
+
+ def FromXml(self, Item, Key):
+ if not Item:
+ return None
+ self.ReadOnly = XmlAttribute(XmlNode(Item, '%s' % Key), 'ReadOnly')
+ self.RePackage = XmlAttribute(XmlNode(Item, '%s' % Key), 'RePackage')
+ self.Vendor = XmlElement(Item, '%s/Vendor' % Key)
+ self.Date = XmlElement(Item, '%s/Date' % Key)
+ self.Signature = XmlElement(Item, '%s/Signature' % Key)
+ self.XmlSpecification = XmlElement(Item, '%s/XmlSpecification' % Key)
+ self.Header.FromXml(Item, Key)
+ DistributionPackageHeader = DistributionPackageHeaderObject()
+ if self.ReadOnly.upper() == 'TRUE':
+ DistributionPackageHeader.ReadOnly = True
+ elif self.ReadOnly.upper() == 'FALSE':
+ DistributionPackageHeader.ReadOnly = False
+ if self.RePackage.upper() == 'TRUE':
+ DistributionPackageHeader.RePackage = True
+ elif self.RePackage.upper() == 'FALSE':
+ DistributionPackageHeader.RePackage = False
+ DistributionPackageHeader.Vendor = self.Vendor
+ DistributionPackageHeader.Date = self.Date
+ DistributionPackageHeader.Signature = self.Signature
+ DistributionPackageHeader.XmlSpecification = self.XmlSpecification
+ DistributionPackageHeader.SetName(self.Header.Name)
+ DistributionPackageHeader.SetBaseName(self.Header.BaseName)
+ DistributionPackageHeader.SetGuid(self.Header.GUID)
+ DistributionPackageHeader.SetVersion(self.Header.Version)
+ DistributionPackageHeader.SetCopyright(self.Header.CopyrightList)
+ DistributionPackageHeader.SetLicense(self.Header.LicenseList)
+ DistributionPackageHeader.SetAbstract(self.Header.AbstractList)
+ DistributionPackageHeader.SetDescription(self.Header.DescriptionList)
+ return DistributionPackageHeader
+
+ def ToXml(self, DistributionPackageHeader, Key):
+ if self.Header:
+ pass
+ Element1 = CreateXmlElement('Name', \
+ DistributionPackageHeader.GetName(), [], \
+ [['BaseName', \
+ DistributionPackageHeader.GetBaseName()]])
+ Element2 = CreateXmlElement('GUID', \
+ DistributionPackageHeader.GetGuid(), [], \
+ [['Version', \
+ DistributionPackageHeader.GetVersion()]])
+ AttributeList = []
+ if DistributionPackageHeader.ReadOnly != '':
+ AttributeList.append(['ReadOnly', str(DistributionPackageHeader.ReadOnly).lower()])
+ if DistributionPackageHeader.RePackage != '':
+ AttributeList.append(['RePackage', str(DistributionPackageHeader.RePackage).lower()])
+ if DistributionPackageHeader.GetAbstract():
+ DPAbstract = DistributionPackageHeader.GetAbstract()[0][1]
+ else:
+ DPAbstract = ''
+ if DistributionPackageHeader.GetDescription():
+ DPDescription = DistributionPackageHeader.GetDescription()[0][1]
+ else:
+ DPDescription = ''
+ if DistributionPackageHeader.GetCopyright():
+ DPCopyright = DistributionPackageHeader.GetCopyright()[0][1]
+ else:
+ DPCopyright = ''
+ if DistributionPackageHeader.GetLicense():
+ DPLicense = DistributionPackageHeader.GetLicense()[0][1]
+ else:
+ DPLicense = ''
+ NodeList = [Element1,
+ Element2,
+ ['Vendor', DistributionPackageHeader.Vendor],
+ ['Date', DistributionPackageHeader.Date],
+ ['Copyright', DPCopyright],
+ ['License', DPLicense],
+ ['Abstract', DPAbstract],
+ ['Description', DPDescription],
+ ['Signature', DistributionPackageHeader.Signature],
+ ['XmlSpecification', \
+ DistributionPackageHeader.XmlSpecification],
+ ]
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+ return Root
+
+ def __str__(self):
+ return "ReadOnly = %s RePackage = %s Vendor = %s Date = %s \
+ Signature = %s XmlSpecification = %s %s" % \
+ (self.ReadOnly, self.RePackage, self.Vendor, self.Date, \
+ self.Signature, self.XmlSpecification, self.Header)
+##
+# PackageHeaderXml
+#
+class PackageHeaderXml(object):
+ def __init__(self):
+ self.Header = HeaderXml()
+ self.PackagePath = ''
+
+ def FromXml(self, Item, Key, PackageObject2):
+ if not Item:
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea']
+ CheckDict = {'PackageHeader': None, }
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ self.PackagePath = XmlElement(Item, '%s/PackagePath' % Key)
+ self.Header.FromXml(Item, Key)
+ PackageObject2.SetName(self.Header.Name)
+ PackageObject2.SetBaseName(self.Header.BaseName)
+ PackageObject2.SetGuid(self.Header.GUID)
+ PackageObject2.SetVersion(self.Header.Version)
+ PackageObject2.SetCopyright(self.Header.CopyrightList)
+ PackageObject2.SetLicense(self.Header.LicenseList)
+ PackageObject2.SetAbstract(self.Header.AbstractList)
+ PackageObject2.SetDescription(self.Header.DescriptionList)
+ PackageObject2.SetPackagePath(self.PackagePath)
+
+ def ToXml(self, PackageObject2, Key):
+ if self.PackagePath:
+ pass
+ Element1 = CreateXmlElement('Name', PackageObject2.GetName(), [], \
+ [['BaseName', PackageObject2.GetBaseName()]])
+ Element2 = CreateXmlElement('GUID', PackageObject2.GetGuid(), [], \
+ [['Version', PackageObject2.GetVersion()]])
+ NodeList = [Element1,
+ Element2
+ ]
+
+ UNIPackageAbrstractList = []
+ UNIPackageDescriptionList = []
+ # Get Abstract and Description from Uni File
+ # if the Uni File exists
+ if PackageObject2.UniFileClassObject is not None:
+ UniStrDict = PackageObject2.UniFileClassObject.OrderedStringList
+ for Lang in UniStrDict:
+ for StringDefClassObject in UniStrDict[Lang]:
+ if not StringDefClassObject.StringValue:
+ continue
+ if StringDefClassObject.StringName == DataType.TAB_DEC_PACKAGE_ABSTRACT:
+ UNIPackageAbrstractList.append((GetLanguageCode1766(Lang),
+ ConvertSpecialUnicodes(StringDefClassObject.StringValue)))
+
+ if StringDefClassObject.StringName == DataType.TAB_DEC_PACKAGE_DESCRIPTION:
+ UNIPackageDescriptionList.append((GetLanguageCode1766(Lang),
+ ConvertSpecialUnicodes(StringDefClassObject.StringValue)))
+
+ # Get Abstract and Description from DEC File Header
+ for (Lang, Value) in PackageObject2.GetCopyright():
+ if Value:
+ NodeList.append(CreateXmlElement(DataType.TAB_HEADER_COPYRIGHT, Value, [], []))
+ for (Lang, Value) in PackageObject2.GetLicense():
+ if Value:
+ NodeList.append(CreateXmlElement(DataType.TAB_HEADER_LICENSE, Value, [], []))
+ for (Lang, Value) in PackageObject2.GetAbstract() + UNIPackageAbrstractList:
+ if Value:
+ NodeList.append(CreateXmlElement(DataType.TAB_HEADER_ABSTRACT, Value, [], [['Lang', Lang]]))
+ for (Lang, Value) in PackageObject2.GetDescription() + UNIPackageDescriptionList:
+ if Value:
+ NodeList.append(CreateXmlElement(DataType.TAB_HEADER_DESCRIPTION, Value, [], [['Lang', Lang]]))
+
+
+ NodeList.append(['PackagePath', PackageObject2.GetPackagePath()])
+ AttributeList = []
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+ return Root
+
+ def __str__(self):
+ return "PackagePath = %s %s" \
+ % (self.PackagePath, self.Header)
+
+##
+# MiscellaneousFileXml
+#
+class MiscellaneousFileXml(object):
+ def __init__(self):
+ self.Header = HeaderXml()
+ self.Files = []
+ ##
+ # This API is used for Package or Module's MiscellaneousFile section
+ #
+ def FromXml(self, Item, Key):
+ if not Item:
+ return None
+ self.Header.FromXml(Item, Key)
+ NewItem = XmlNode(Item, '%s/Header' % Key)
+ self.Header.FromXml(NewItem, 'Header')
+ for SubItem in XmlList(Item, '%s/Filename' % Key):
+ Filename = XmlElement(SubItem, '%s/Filename' % Key)
+ Executable = XmlAttribute(XmlNode(SubItem, '%s/Filename' % Key), 'Executable')
+ if Executable.upper() == "TRUE":
+ Executable = True
+ elif Executable.upper() == "FALSE":
+ Executable = False
+ else:
+ Executable = ''
+ self.Files.append([Filename, Executable])
+ MiscFile = MiscFileObject()
+ MiscFile.SetCopyright(self.Header.CopyrightList)
+ MiscFile.SetLicense(self.Header.LicenseList)
+ MiscFile.SetAbstract(self.Header.AbstractList)
+ MiscFile.SetDescription(self.Header.DescriptionList)
+ MiscFileList = []
+ for File in self.Files:
+ FileObj = FileObject()
+ FileObj.SetURI(File[0])
+ FileObj.SetExecutable(File[1])
+ MiscFileList.append(FileObj)
+ MiscFile.SetFileList(MiscFileList)
+ return MiscFile
+ ##
+ # This API is used for DistP's tool section
+ #
+ def FromXml2(self, Item, Key):
+ if Item is None:
+ return None
+ NewItem = XmlNode(Item, '%s/Header' % Key)
+ self.Header.FromXml(NewItem, 'Header')
+ for SubItem in XmlList(Item, '%s/Filename' % Key):
+ Filename = XmlElement(SubItem, '%s/Filename' % Key)
+ Executable = \
+ XmlAttribute(XmlNode(SubItem, '%s/Filename' % Key), 'Executable')
+ OsType = XmlAttribute(XmlNode(SubItem, '%s/Filename' % Key), 'OS')
+ if Executable.upper() == "TRUE":
+ Executable = True
+ elif Executable.upper() == "FALSE":
+ Executable = False
+ else:
+ Executable = ''
+ self.Files.append([Filename, Executable, OsType])
+ MiscFile = MiscFileObject()
+ MiscFile.SetName(self.Header.Name)
+ MiscFile.SetCopyright(self.Header.CopyrightList)
+ MiscFile.SetLicense(self.Header.LicenseList)
+ MiscFile.SetAbstract(self.Header.AbstractList)
+ MiscFile.SetDescription(self.Header.DescriptionList)
+ MiscFileList = []
+ for File in self.Files:
+ FileObj = FileObject()
+ FileObj.SetURI(File[0])
+ FileObj.SetExecutable(File[1])
+ FileObj.SetOS(File[2])
+ MiscFileList.append(FileObj)
+ MiscFile.SetFileList(MiscFileList)
+ return MiscFile
+
+ ##
+ # This API is used for Package or Module's MiscellaneousFile section
+ #
+ def ToXml(self, MiscFile, Key):
+ if self.Header:
+ pass
+ if MiscFile:
+ if MiscFile.GetAbstract():
+ DPAbstract = MiscFile.GetAbstract()[0][1]
+ else:
+ DPAbstract = ''
+ if MiscFile.GetDescription():
+ DPDescription = MiscFile.GetDescription()[0][1]
+ else:
+ DPDescription = ''
+ if MiscFile.GetCopyright():
+ DPCopyright = MiscFile.GetCopyright()[0][1]
+ else:
+ DPCopyright = ''
+ if MiscFile.GetLicense():
+ DPLicense = MiscFile.GetLicense()[0][1]
+ else:
+ DPLicense = ''
+ NodeList = [['Copyright', DPCopyright],
+ ['License', DPLicense],
+ ['Abstract', DPAbstract],
+ ['Description', DPDescription],
+ ]
+ for File in MiscFile.GetFileList():
+ NodeList.append\
+ (CreateXmlElement\
+ ('Filename', File.GetURI(), [], \
+ [['Executable', str(File.GetExecutable()).lower()]]))
+ Root = CreateXmlElement('%s' % Key, '', NodeList, [])
+ return Root
+ ##
+ # This API is used for DistP's tool section
+ #
+ def ToXml2(self, MiscFile, Key):
+ if self.Header:
+ pass
+ if MiscFile:
+ if MiscFile.GetAbstract():
+ DPAbstract = MiscFile.GetAbstract()[0][1]
+ else:
+ DPAbstract = ''
+ if MiscFile.GetDescription():
+ DPDescription = MiscFile.GetDescription()[0][1]
+ else:
+ DPDescription = ''
+ if MiscFile.GetCopyright():
+ DPCopyright = MiscFile.GetCopyright()[0][1]
+ else:
+ DPCopyright = ''
+ if MiscFile.GetLicense():
+ DPLicense = MiscFile.GetLicense()[0][1]
+ else:
+ DPLicense = ''
+ NodeList = [['Name', MiscFile.GetName()],
+ ['Copyright', DPCopyright],
+ ['License', DPLicense],
+ ['Abstract', DPAbstract],
+ ['Description', DPDescription],
+ ]
+ HeaderNode = CreateXmlElement('Header', '', NodeList, [])
+ NodeList = [HeaderNode]
+ for File in MiscFile.GetFileList():
+ NodeList.append\
+ (CreateXmlElement\
+ ('Filename', File.GetURI(), [], \
+ [['Executable', str(File.GetExecutable()).lower()], \
+ ['OS', File.GetOS()]]))
+ Root = CreateXmlElement('%s' % Key, '', NodeList, [])
+ return Root
+
+ def __str__(self):
+ Str = str(self.Header)
+ for Item in self.Files:
+ Str = Str + '\n\tFilename:' + str(Item)
+ return Str
+##
+# UserExtensionsXml
+#
+class UserExtensionsXml(object):
+ def __init__(self):
+ self.UserId = ''
+ self.Identifier = ''
+ self.BinaryAbstractList = []
+ self.BinaryDescriptionList = []
+ self.BinaryCopyrightList = []
+ self.BinaryLicenseList = []
+ self.LangDefsList = []
+ self.DefineDict = {}
+ self.BuildOptionDict = {}
+ self.IncludesDict = {}
+ self.SourcesDict = {}
+ self.BinariesDict = {}
+ self.SupArchList = []
+ self.Statement = ''
+ self.Defines = ''
+ self.BuildOptions = ''
+
+ def FromXml2(self, Item, Key):
+ self.UserId = XmlAttribute(XmlNode(Item, '%s' % Key), 'UserId')
+ self.Identifier = XmlAttribute(XmlNode(Item, '%s' % Key), 'Identifier')
+ UserExtension = UserExtensionObject()
+ UserExtension.SetUserID(self.UserId)
+ UserExtension.SetIdentifier(self.Identifier)
+ return UserExtension
+
+ def FromXml(self, Item, Key):
+ self.UserId = XmlAttribute(XmlNode(Item, '%s' % Key), 'UserId')
+ self.Identifier = XmlAttribute(XmlNode(Item, '%s' % Key), 'Identifier')
+ if self.UserId == DataType.TAB_BINARY_HEADER_USERID \
+ and self.Identifier == DataType.TAB_BINARY_HEADER_IDENTIFIER:
+ for SubItem in XmlList(Item, '%s/BinaryAbstract' % Key):
+ BinaryAbstractLang = XmlAttribute(SubItem, 'Lang')
+ self.BinaryAbstractList.append((BinaryAbstractLang, XmlElement(SubItem, '%s/BinaryAbstract' % Key)))
+ for SubItem in XmlList(Item, '%s/BinaryDescription' % Key):
+ BinaryDescriptionLang = XmlAttribute(SubItem, 'Lang')
+ self.BinaryDescriptionList.append((BinaryDescriptionLang,
+ XmlElement(SubItem, '%s/BinaryDescription' % Key)))
+ for SubItem in XmlList(Item, '%s/BinaryCopyright' % Key):
+ BinaryCopyrightLang = XmlAttribute(SubItem, 'Lang')
+ self.BinaryCopyrightList.append((BinaryCopyrightLang,
+ XmlElement(SubItem, '%s/BinaryCopyright' % Key)))
+ for SubItem in XmlList(Item, '%s/BinaryLicense' % Key):
+ BinaryLicenseLang = XmlAttribute(SubItem, 'Lang')
+ self.BinaryLicenseList.append((BinaryLicenseLang,
+ XmlElement(SubItem, '%s/BinaryLicense' % Key)))
+
+ DefineItem = XmlNode(Item, '%s/Define' % Key)
+ for SubItem in XmlList(DefineItem, 'Define/Statement'):
+ Statement = XmlElement(SubItem, '%s/Statement' % Key)
+ self.DefineDict[Statement] = ""
+ BuildOptionItem = XmlNode(Item, '%s/BuildOption' % Key)
+ for SubItem in XmlList(BuildOptionItem, 'BuildOption/Statement'):
+ Statement = XmlElement(SubItem, '%s/Statement' % Key)
+ Arch = XmlAttribute(XmlNode(SubItem, '%s/Statement' % Key), 'SupArchList')
+ self.BuildOptionDict[Arch] = Statement
+ IncludesItem = XmlNode(Item, '%s/Includes' % Key)
+ for SubItem in XmlList(IncludesItem, 'Includes/Statement'):
+ Statement = XmlElement(SubItem, '%s/Statement' % Key)
+ Arch = XmlAttribute(XmlNode(SubItem, '%s/Statement' % Key), 'SupArchList')
+ self.IncludesDict[Statement] = Arch
+ SourcesItem = XmlNode(Item, '%s/Sources' % Key)
+ Tmp = UserExtensionSourceXml()
+ SourceDict = Tmp.FromXml(SourcesItem, 'Sources')
+ self.SourcesDict = SourceDict
+ BinariesItem = XmlNode(Item, '%s/Binaries' % Key)
+ Tmp = UserExtensionBinaryXml()
+ BinariesDict = Tmp.FromXml(BinariesItem, 'Binaries')
+ self.BinariesDict = BinariesDict
+ self.Statement = XmlElement(Item, 'UserExtensions')
+ SupArch = XmlAttribute(XmlNode(Item, '%s' % Key), 'SupArchList')
+ self.SupArchList = [Arch for Arch in GetSplitValueList(SupArch, DataType.TAB_SPACE_SPLIT) if Arch]
+ UserExtension = UserExtensionObject()
+ UserExtension.SetUserID(self.UserId)
+ UserExtension.SetIdentifier(self.Identifier)
+ UserExtension.SetBinaryAbstract(self.BinaryAbstractList)
+ UserExtension.SetBinaryDescription(self.BinaryDescriptionList)
+ UserExtension.SetBinaryCopyright(self.BinaryCopyrightList)
+ UserExtension.SetBinaryLicense(self.BinaryLicenseList)
+ UserExtension.SetStatement(self.Statement)
+ UserExtension.SetSupArchList(self.SupArchList)
+ UserExtension.SetDefinesDict(self.DefineDict)
+ UserExtension.SetBuildOptionDict(self.BuildOptionDict)
+ UserExtension.SetIncludesDict(self.IncludesDict)
+ UserExtension.SetSourcesDict(self.SourcesDict)
+ UserExtension.SetBinariesDict(self.BinariesDict)
+ return UserExtension
+
+ def ToXml(self, UserExtension, Key):
+ if self.UserId:
+ pass
+ AttributeList = [['UserId', str(UserExtension.GetUserID())],
+ ['Identifier', str(UserExtension.GetIdentifier())],
+ ['SupArchList', \
+ GetStringOfList(UserExtension.GetSupArchList())],
+ ]
+ Root = CreateXmlElement('%s' % Key, UserExtension.GetStatement(), [], \
+ AttributeList)
+ if UserExtension.GetIdentifier() == DataType.TAB_BINARY_HEADER_IDENTIFIER and \
+ UserExtension.GetUserID() == DataType.TAB_BINARY_HEADER_USERID:
+ for (Lang, Value) in UserExtension.GetBinaryAbstract():
+ if Value:
+ ChildElement = CreateXmlElement('BinaryAbstract', Value, [], [['Lang', Lang]])
+ Root.appendChild(ChildElement)
+ for (Lang, Value) in UserExtension.GetBinaryDescription():
+ if Value:
+ ChildElement = CreateXmlElement('BinaryDescription', Value, [], [['Lang', Lang]])
+ Root.appendChild(ChildElement)
+ for (Lang, Value) in UserExtension.GetBinaryCopyright():
+ if Value:
+ ChildElement = CreateXmlElement('BinaryCopyright', Value, [], [])
+ Root.appendChild(ChildElement)
+ for (Lang, Value) in UserExtension.GetBinaryLicense():
+ if Value:
+ ChildElement = CreateXmlElement('BinaryLicense', Value, [], [])
+ Root.appendChild(ChildElement)
+
+ NodeList = []
+ DefineDict = UserExtension.GetDefinesDict()
+ if DefineDict:
+ for Item in DefineDict.keys():
+ NodeList.append(CreateXmlElement\
+ ('Statement', Item, [], []))
+ DefineElement = CreateXmlElement('Define', '', NodeList, [])
+ Root.appendChild(DefineElement)
+ NodeList = []
+ BuildOptionDict = UserExtension.GetBuildOptionDict()
+ if BuildOptionDict:
+ for Item in BuildOptionDict.keys():
+ NodeList.append(CreateXmlElement\
+ ('Statement', BuildOptionDict[Item], [], \
+ [['SupArchList', Item]]))
+ BuildOptionElement = \
+ CreateXmlElement('BuildOption', '', NodeList, [])
+ Root.appendChild(BuildOptionElement)
+ NodeList = []
+ IncludesDict = UserExtension.GetIncludesDict()
+ if IncludesDict:
+ for Item in IncludesDict.keys():
+ NodeList.append(CreateXmlElement\
+ ('Statement', Item, [], \
+ [['SupArchList', IncludesDict[Item]]]))
+ IncludesElement = CreateXmlElement('Includes', '', NodeList, [])
+ Root.appendChild(IncludesElement)
+ NodeList = []
+ SourcesDict = UserExtension.GetSourcesDict()
+ if SourcesDict:
+ Tmp = UserExtensionSourceXml()
+ Root.appendChild(Tmp.ToXml(SourcesDict, 'Sources'))
+ NodeList = []
+ BinariesDict = UserExtension.GetBinariesDict()
+ if BinariesDict:
+ Tmp = UserExtensionBinaryXml()
+ Root.appendChild(Tmp.ToXml(BinariesDict, 'Binaries'))
+ return Root
+
+ def __str__(self):
+ Str = "UserId = %s Identifier = %s" % (self.UserId, self.Identifier)
+ Str = Str + '\n\tDefines:' + str(self.Defines)
+ Str = Str + '\n\tBuildOptions:' + str(self.BuildOptions)
+ return Str
+
+##
+# UserExtensionSourceXml
+#
+class UserExtensionSourceXml(object):
+ def __init__(self):
+ self.UserExtensionSource = ''
+
+ def FromXml(self, Item, Key):
+ if Key:
+ pass
+ if self.UserExtensionSource:
+ pass
+ Dict = {}
+ #SourcesItem = XmlNode(Item, '%s/Sources' % Key)
+ for SubItem in XmlList(Item, 'Sources/SourceFile'):
+ FileName = XmlElement(SubItem, 'SourceFile/FileName')
+ Family = XmlElement(SubItem, 'SourceFile/Family')
+ FeatureFlag = XmlElement(SubItem, 'SourceFile/FeatureFlag')
+ SupArchStr = XmlElement(SubItem, 'SourceFile/SupArchList')
+ DictKey = (FileName, Family, FeatureFlag, SupArchStr)
+ ValueList = []
+ for ValueNodeItem in XmlList(SubItem, \
+ 'SourceFile/SourceFileOtherAttr'):
+ TagName = XmlElement(ValueNodeItem, \
+ 'SourceFileOtherAttr/TagName')
+ ToolCode = XmlElement(ValueNodeItem, \
+ 'SourceFileOtherAttr/ToolCode')
+ Comment = XmlElement(ValueNodeItem, \
+ 'SourceFileOtherAttr/Comment')
+ if (TagName == ' ') and (ToolCode == ' ') and (Comment == ' '):
+ TagName = ''
+ ToolCode = ''
+ Comment = ''
+ ValueList.append((TagName, ToolCode, Comment))
+ Dict[DictKey] = ValueList
+ return Dict
+
+ def ToXml(self, Dict, Key):
+ if self.UserExtensionSource:
+ pass
+ SourcesNodeList = []
+ for Item in Dict:
+ ValueList = Dict[Item]
+ (FileName, Family, FeatureFlag, SupArchStr) = Item
+ SourceFileNodeList = []
+ SourceFileNodeList.append(["FileName", FileName])
+ SourceFileNodeList.append(["Family", Family])
+ SourceFileNodeList.append(["FeatureFlag", FeatureFlag])
+ SourceFileNodeList.append(["SupArchList", SupArchStr])
+ for (TagName, ToolCode, Comment) in ValueList:
+ ValueNodeList = []
+ if not (TagName or ToolCode or Comment):
+ TagName = ' '
+ ToolCode = ' '
+ Comment = ' '
+ ValueNodeList.append(["TagName", TagName])
+ ValueNodeList.append(["ToolCode", ToolCode])
+ ValueNodeList.append(["Comment", Comment])
+ ValueNodeXml = CreateXmlElement('SourceFileOtherAttr', '', \
+ ValueNodeList, [])
+ SourceFileNodeList.append(ValueNodeXml)
+ SourceFileNodeXml = CreateXmlElement('SourceFile', '', \
+ SourceFileNodeList, [])
+ SourcesNodeList.append(SourceFileNodeXml)
+ Root = CreateXmlElement('%s' % Key, '', SourcesNodeList, [])
+ return Root
+
+##
+# UserExtensionBinaryXml
+#
+class UserExtensionBinaryXml(object):
+ def __init__(self):
+ self.UserExtensionBinary = ''
+
+ def FromXml(self, Item, Key):
+ if Key:
+ pass
+ if self.UserExtensionBinary:
+ pass
+ Dict = {}
+ for SubItem in XmlList(Item, 'Binaries/Binary'):
+ FileName = XmlElement(SubItem, 'Binary/FileName')
+ FileType = XmlElement(SubItem, 'Binary/FileType')
+ FFE = XmlElement(SubItem, 'Binary/FeatureFlag')
+ SupArch = XmlElement(SubItem, 'Binary/SupArchList')
+ DictKey = (FileName, FileType, ConvertNOTEQToNE(FFE), SupArch)
+ ValueList = []
+ for ValueNodeItem in XmlList(SubItem, \
+ 'Binary/BinaryFileOtherAttr'):
+ Target = XmlElement(ValueNodeItem, \
+ 'BinaryFileOtherAttr/Target')
+ Family = XmlElement(ValueNodeItem, \
+ 'BinaryFileOtherAttr/Family')
+ TagName = XmlElement(ValueNodeItem, \
+ 'BinaryFileOtherAttr/TagName')
+ Comment = XmlElement(ValueNodeItem, \
+ 'BinaryFileOtherAttr/Comment')
+ if (Target == ' ') and (Family == ' ') and \
+ (TagName == ' ') and (Comment == ' '):
+ Target = ''
+ Family = ''
+ TagName = ''
+ Comment = ''
+
+ ValueList.append((Target, Family, TagName, Comment))
+ Dict[DictKey] = ValueList
+ return Dict
+
+ def ToXml(self, Dict, Key):
+ if self.UserExtensionBinary:
+ pass
+ BinariesNodeList = []
+ for Item in Dict:
+ ValueList = Dict[Item]
+ (FileName, FileType, FeatureFlag, SupArch) = Item
+ FileNodeList = []
+ FileNodeList.append(["FileName", FileName])
+ FileNodeList.append(["FileType", FileType])
+ FileNodeList.append(["FeatureFlag", ConvertNEToNOTEQ(FeatureFlag)])
+ FileNodeList.append(["SupArchList", SupArch])
+ for (Target, Family, TagName, Comment) in ValueList:
+ ValueNodeList = []
+ if not (Target or Family or TagName or Comment):
+ Target = ' '
+ Family = ' '
+ TagName = ' '
+ Comment = ' '
+ ValueNodeList.append(["Target", Target])
+ ValueNodeList.append(["Family", Family])
+ ValueNodeList.append(["TagName", TagName])
+ ValueNodeList.append(["Comment", Comment])
+ ValueNodeXml = CreateXmlElement('BinaryFileOtherAttr', '', \
+ ValueNodeList, [])
+ FileNodeList.append(ValueNodeXml)
+ FileNodeXml = CreateXmlElement('Binary', '', FileNodeList, [])
+ BinariesNodeList.append(FileNodeXml)
+ Root = CreateXmlElement('%s' % Key, '', BinariesNodeList, [])
+ return Root
+
+##
+# LibraryClassXml
+#
+class LibraryClassXml(object):
+ def __init__(self):
+ self.Keyword = ''
+ self.HeaderFile = ''
+ self.RecommendedInstanceGuid = ''
+ self.RecommendedInstanceVersion = ''
+ self.CommonDefines = CommonDefinesXml()
+ self.HelpText = []
+
+ def FromXml(self, Item, Key):
+ self.Keyword = XmlAttribute(XmlNode(Item, '%s' % Key), 'Keyword')
+ if self.Keyword == '':
+ self.Keyword = XmlElement(Item, '%s/Keyword' % Key)
+ self.HeaderFile = XmlElement(Item, '%s/HeaderFile' % Key)
+ self.CommonDefines.FromXml(XmlNode(Item, '%s' % Key), Key)
+ for HelpTextItem in XmlList(Item, '%s/HelpText' % Key):
+ HelpTextObj = HelpTextXml()
+ HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key)
+ self.HelpText.append(HelpTextObj)
+ LibraryClass = LibraryClassObject()
+ LibraryClass.SetLibraryClass(self.Keyword)
+ LibraryClass.SetIncludeHeader(self.HeaderFile)
+ if self.CommonDefines.Usage:
+ LibraryClass.SetUsage(self.CommonDefines.Usage)
+ LibraryClass.SetSupArchList(self.CommonDefines.SupArchList)
+ LibraryClass.SetSupModuleList(self.CommonDefines.SupModList)
+ LibraryClass.SetFeatureFlag(ConvertNOTEQToNE(self.CommonDefines.FeatureFlag))
+ LibraryClass.SetHelpTextList(GetHelpTextList(self.HelpText))
+ return LibraryClass
+
+ def ToXml(self, LibraryClass, Key):
+ if self.HeaderFile:
+ pass
+ AttributeList = \
+ [['Keyword', LibraryClass.GetLibraryClass()],
+ ['SupArchList', GetStringOfList(LibraryClass.GetSupArchList())],
+ ['SupModList', GetStringOfList(LibraryClass.GetSupModuleList())]
+ ]
+ NodeList = [['HeaderFile', LibraryClass.GetIncludeHeader()]]
+ for Item in LibraryClass.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item))
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+ return Root
+
+ def ToXml2(self, LibraryClass, Key):
+ if self.HeaderFile:
+ pass
+ FeatureFlag = ConvertNEToNOTEQ(LibraryClass.GetFeatureFlag())
+ AttributeList = \
+ [['Usage', LibraryClass.GetUsage()], \
+ ['SupArchList', GetStringOfList(LibraryClass.GetSupArchList())], \
+ ['SupModList', GetStringOfList(LibraryClass.GetSupModuleList())], \
+ ['FeatureFlag', FeatureFlag]
+ ]
+ NodeList = [['Keyword', LibraryClass.GetLibraryClass()], ]
+ for Item in LibraryClass.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item))
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+ return Root
+
+ def __str__(self):
+ Str = "Keyword = %s HeaderFile = %s RecommendedInstanceGuid = %s RecommendedInstanceVersion = %s %s" % \
+ (self.Keyword, self.HeaderFile, self.RecommendedInstanceGuid, self.RecommendedInstanceVersion, \
+ self.CommonDefines)
+ for Item in self.HelpText:
+ Str = Str + "\n\t" + str(Item)
+ return Str
+
+##
+# FilenameXml
+#
+class FilenameXml(object):
+ def __init__(self):
+ self.FileType = ''
+ self.Filename = ''
+ self.CommonDefines = CommonDefinesXml()
+
+ def FromXml(self, Item, Key):
+ self.FileType = XmlAttribute(Item, 'FileType')
+ Guid = XmlAttribute(Item, 'GUID')
+ self.Filename = XmlElement(Item, 'Filename')
+ self.CommonDefines.FromXml(Item, Key)
+ FeatureFlag = ConvertNOTEQToNE(self.CommonDefines.FeatureFlag)
+ Filename = FileNameObject()
+ #
+ # Convert File Type
+ #
+ if self.FileType == 'UEFI_IMAGE':
+ self.FileType = 'PE32'
+
+ Filename.SetGuidValue(Guid)
+ Filename.SetFileType(self.FileType)
+ Filename.SetFilename(self.Filename)
+ Filename.SetSupArchList(self.CommonDefines.SupArchList)
+ Filename.SetFeatureFlag(FeatureFlag)
+
+ return Filename
+
+ def ToXml(self, Filename, Key):
+ if self.Filename:
+ pass
+ AttributeList = [['SupArchList', \
+ GetStringOfList(Filename.GetSupArchList())],
+ ['FileType', Filename.GetFileType()],
+ ['FeatureFlag', ConvertNEToNOTEQ(Filename.GetFeatureFlag())],
+ ['GUID', Filename.GetGuidValue()]
+ ]
+ Root = CreateXmlElement('%s' % Key, Filename.GetFilename(), [], AttributeList)
+
+ return Root
+
+ def __str__(self):
+ return "FileType = %s Filename = %s %s" \
+ % (self.FileType, self.Filename, self.CommonDefines)
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Xml/GuidProtocolPpiXml.py b/roms/edk2/BaseTools/Source/Python/UPT/Xml/GuidProtocolPpiXml.py
new file mode 100644
index 000000000..d6645fc23
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Xml/GuidProtocolPpiXml.py
@@ -0,0 +1,278 @@
+## @file
+# This file is used to parse a xml file of .PKG file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+GuidProtocolPpiXml
+'''
+from Library.StringUtils import ConvertNEToNOTEQ
+from Library.StringUtils import ConvertNOTEQToNE
+from Library.StringUtils import GetStringOfList
+from Library.Xml.XmlRoutines import XmlElement
+from Library.Xml.XmlRoutines import XmlAttribute
+from Library.Xml.XmlRoutines import XmlNode
+from Library.Xml.XmlRoutines import XmlList
+from Library.Xml.XmlRoutines import CreateXmlElement
+
+from Object.POM.CommonObject import GuidObject
+from Object.POM.CommonObject import ProtocolObject
+from Object.POM.CommonObject import PpiObject
+
+from Xml.CommonXml import CommonDefinesXml
+from Xml.CommonXml import HelpTextXml
+
+from Xml.XmlParserMisc import GetHelpTextList
+
+##
+#GUID/Protocol/Ppi Common
+#
+class GuidProtocolPpiXml(object):
+ def __init__(self, Mode):
+ self.UiName = ''
+ self.GuidTypes = ''
+ self.Notify = ''
+ self.CName = ''
+ self.GuidValue = ''
+ self.CommonDefines = CommonDefinesXml()
+ self.HelpText = []
+ #
+ # Guid/Ppi/Library, internal used for indicate return object for
+ # FromXml
+ #
+ self.Type = ''
+ #
+ # there are slightly different field between package and module
+ #
+ self.Mode = Mode
+ self.GuidType = ''
+ self.VariableName = ''
+
+ def FromXml(self, Item, Key):
+ self.UiName = XmlAttribute(XmlNode(Item, '%s' % Key), 'UiName')
+ self.GuidType = XmlAttribute(XmlNode(Item, '%s' % Key), 'GuidType')
+ self.Notify = XmlAttribute(XmlNode(Item, '%s' % Key), 'Notify')
+ self.CName = XmlElement(Item, '%s/CName' % Key)
+ self.GuidValue = XmlElement(Item, '%s/GuidValue' % Key)
+ self.VariableName = XmlElement(Item, '%s/VariableName' % Key)
+ self.CommonDefines.FromXml(XmlNode(Item, '%s' % Key), Key)
+ for HelpTextItem in XmlList(Item, '%s/HelpText' % Key):
+ HelpTextObj = HelpTextXml()
+ HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key)
+ self.HelpText.append(HelpTextObj)
+
+ if self.Type == 'Guid':
+ GuidProtocolPpi = GuidObject()
+ elif self.Type == 'Protocol':
+ GuidProtocolPpi = ProtocolObject()
+ else:
+ GuidProtocolPpi = PpiObject()
+ GuidProtocolPpi.SetHelpTextList(GetHelpTextList(self.HelpText))
+
+ return GuidProtocolPpi
+
+ def ToXml(self, GuidProtocolPpi, Key):
+ if self.GuidValue:
+ pass
+ AttributeList = \
+ [['Usage', GetStringOfList(GuidProtocolPpi.GetUsage())], \
+ ['UiName', GuidProtocolPpi.GetName()], \
+ ['GuidType', GetStringOfList(GuidProtocolPpi.GetGuidTypeList())], \
+ ['Notify', str(GuidProtocolPpi.GetNotify()).lower()], \
+ ['SupArchList', GetStringOfList(GuidProtocolPpi.GetSupArchList())], \
+ ['SupModList', GetStringOfList(GuidProtocolPpi.GetSupModuleList())], \
+ ['FeatureFlag', ConvertNEToNOTEQ(GuidProtocolPpi.GetFeatureFlag())]
+ ]
+ NodeList = [['CName', GuidProtocolPpi.GetCName()],
+ ['GuidValue', GuidProtocolPpi.GetGuid()],
+ ['VariableName', GuidProtocolPpi.VariableName]
+ ]
+ for Item in GuidProtocolPpi.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item))
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+
+ def __str__(self):
+ Str = \
+ "UiName = %s Notify = %s GuidTypes = %s CName = %s GuidValue = %s %s" \
+ % (self.UiName, self.Notify, self.GuidTypes, self.CName, \
+ self.GuidValue, self.CommonDefines)
+ for Item in self.HelpText:
+ Str = Str + "\n\t" + str(Item)
+ return Str
+##
+#GUID Xml
+#
+class GuidXml(GuidProtocolPpiXml):
+ def __init__(self, Mode):
+ GuidProtocolPpiXml.__init__(self, Mode)
+ self.Type = 'Guid'
+
+ def FromXml(self, Item, Key):
+ GuidProtocolPpi = GuidProtocolPpiXml.FromXml(self, Item, Key)
+
+ if self.Mode == 'Package':
+
+ GuidProtocolPpi.SetSupArchList(self.CommonDefines.SupArchList)
+ GuidProtocolPpi.SetSupModuleList(self.CommonDefines.SupModList)
+ GuidProtocolPpi.SetCName(self.CName)
+ GuidProtocolPpi.SetGuid(self.GuidValue)
+ else:
+ GuidProtocolPpi.SetUsage(self.CommonDefines.Usage)
+ if self.GuidType:
+ GuidProtocolPpi.SetGuidTypeList([self.GuidType])
+ GuidProtocolPpi.SetSupArchList(self.CommonDefines.SupArchList)
+ GuidProtocolPpi.SetFeatureFlag(ConvertNOTEQToNE(self.CommonDefines.FeatureFlag))
+ GuidProtocolPpi.SetCName(self.CName)
+ GuidProtocolPpi.SetVariableName(self.VariableName)
+ return GuidProtocolPpi
+
+ def ToXml(self, GuidProtocolPpi, Key):
+ if self.Mode == 'Package':
+ AttributeList = \
+ [['GuidType', \
+ GetStringOfList(GuidProtocolPpi.GetGuidTypeList())], \
+ ['SupArchList', \
+ GetStringOfList(GuidProtocolPpi.GetSupArchList())], \
+ ['SupModList', \
+ GetStringOfList(GuidProtocolPpi.GetSupModuleList())],
+ ]
+ NodeList = [['CName', GuidProtocolPpi.GetCName()],
+ ['GuidValue', GuidProtocolPpi.GetGuid()],
+ ]
+ else:
+ AttributeList = \
+ [['Usage', GetStringOfList(GuidProtocolPpi.GetUsage())], \
+ ['GuidType', GetStringOfList(GuidProtocolPpi.GetGuidTypeList())],\
+ ['SupArchList', \
+ GetStringOfList(GuidProtocolPpi.GetSupArchList())], \
+ ['FeatureFlag', ConvertNEToNOTEQ(GuidProtocolPpi.GetFeatureFlag())]
+ ]
+ NodeList = [['CName', GuidProtocolPpi.GetCName()],
+ ['VariableName', GuidProtocolPpi.GetVariableName()]
+ ]
+
+ for Item in GuidProtocolPpi.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item))
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+##
+#Protocol Xml
+#
+class ProtocolXml(GuidProtocolPpiXml):
+ def __init__(self, Mode):
+ GuidProtocolPpiXml.__init__(self, Mode)
+ self.Type = 'Protocol'
+
+ def FromXml(self, Item, Key):
+ GuidProtocolPpi = GuidProtocolPpiXml.FromXml(self, Item, Key)
+ if self.Mode == 'Package':
+ GuidProtocolPpi.SetFeatureFlag(self.CommonDefines.FeatureFlag)
+ GuidProtocolPpi.SetSupArchList(self.CommonDefines.SupArchList)
+ GuidProtocolPpi.SetSupModuleList(self.CommonDefines.SupModList)
+ GuidProtocolPpi.SetCName(self.CName)
+ GuidProtocolPpi.SetGuid(self.GuidValue)
+ else:
+ GuidProtocolPpi.SetUsage(self.CommonDefines.Usage)
+ if self.Notify.upper() == "TRUE":
+ GuidProtocolPpi.SetNotify(True)
+ elif self.Notify.upper() == "FALSE":
+ GuidProtocolPpi.SetNotify(False)
+ else:
+ GuidProtocolPpi.SetNotify('')
+ GuidProtocolPpi.SetSupArchList(self.CommonDefines.SupArchList)
+ GuidProtocolPpi.SetFeatureFlag(ConvertNOTEQToNE(self.CommonDefines.FeatureFlag))
+ GuidProtocolPpi.SetCName(self.CName)
+
+ return GuidProtocolPpi
+
+ def ToXml(self, GuidProtocolPpi, Key):
+ if self.Mode == 'Package':
+ AttributeList = \
+ [['SupArchList', \
+ GetStringOfList(GuidProtocolPpi.GetSupArchList())], \
+ ['SupModList', \
+ GetStringOfList(GuidProtocolPpi.GetSupModuleList())], \
+ ['FeatureFlag', GuidProtocolPpi.GetFeatureFlag()]
+ ]
+ NodeList = [['CName', GuidProtocolPpi.GetCName()],
+ ['GuidValue', GuidProtocolPpi.GetGuid()],
+ ]
+ else:
+ AttributeList = \
+ [['Usage', GetStringOfList(GuidProtocolPpi.GetUsage())], \
+ ['Notify', str(GuidProtocolPpi.GetNotify()).lower()], \
+ ['SupArchList', \
+ GetStringOfList(GuidProtocolPpi.GetSupArchList())], \
+ ['FeatureFlag', ConvertNEToNOTEQ(GuidProtocolPpi.GetFeatureFlag())]
+ ]
+ NodeList = [['CName', GuidProtocolPpi.GetCName()],
+ ]
+
+ for Item in GuidProtocolPpi.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item))
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+##
+#Ppi Xml
+#
+class PpiXml(GuidProtocolPpiXml):
+ def __init__(self, Mode):
+ GuidProtocolPpiXml.__init__(self, Mode)
+ self.Type = 'Ppi'
+
+ def FromXml(self, Item, Key):
+ GuidProtocolPpi = GuidProtocolPpiXml.FromXml(self, Item, Key)
+ if self.Mode == 'Package':
+ GuidProtocolPpi.SetSupArchList(self.CommonDefines.SupArchList)
+ GuidProtocolPpi.SetSupModuleList(self.CommonDefines.SupModList)
+ GuidProtocolPpi.SetCName(self.CName)
+ GuidProtocolPpi.SetGuid(self.GuidValue)
+ else:
+ GuidProtocolPpi.SetUsage(self.CommonDefines.Usage)
+ if self.Notify.upper() == "TRUE":
+ GuidProtocolPpi.SetNotify(True)
+ elif self.Notify.upper() == "FALSE":
+ GuidProtocolPpi.SetNotify(False)
+ else:
+ GuidProtocolPpi.SetNotify('')
+ GuidProtocolPpi.SetSupArchList(self.CommonDefines.SupArchList)
+ GuidProtocolPpi.SetFeatureFlag(ConvertNOTEQToNE(self.CommonDefines.FeatureFlag))
+ GuidProtocolPpi.SetCName(self.CName)
+
+ return GuidProtocolPpi
+
+ def ToXml(self, GuidProtocolPpi, Key):
+ if self.Mode == 'Package':
+ AttributeList = \
+ [['SupArchList', \
+ GetStringOfList(GuidProtocolPpi.GetSupArchList())],
+ ]
+ NodeList = [['CName', GuidProtocolPpi.GetCName()],
+ ['GuidValue', GuidProtocolPpi.GetGuid()],
+ ]
+ else:
+ AttributeList = \
+ [['Usage', GetStringOfList(GuidProtocolPpi.GetUsage())], \
+ ['Notify', str(GuidProtocolPpi.GetNotify()).lower()], \
+ ['SupArchList', \
+ GetStringOfList(GuidProtocolPpi.GetSupArchList())], \
+ ['FeatureFlag', ConvertNEToNOTEQ(GuidProtocolPpi.GetFeatureFlag())]
+ ]
+ NodeList = [['CName', GuidProtocolPpi.GetCName()],
+ ]
+
+ for Item in GuidProtocolPpi.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item))
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+ return Root
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Xml/IniToXml.py b/roms/edk2/BaseTools/Source/Python/UPT/Xml/IniToXml.py
new file mode 100644
index 000000000..3dc400131
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Xml/IniToXml.py
@@ -0,0 +1,496 @@
+## @file
+# This file is for converting package information data file to xml file.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+IniToXml
+'''
+
+import os.path
+import re
+from time import strftime
+from time import localtime
+
+import Logger.Log as Logger
+from Logger.ToolError import UPT_INI_PARSE_ERROR
+from Logger.ToolError import FILE_NOT_FOUND
+from Library.Xml.XmlRoutines import CreateXmlElement
+from Library.DataType import TAB_VALUE_SPLIT
+from Library.DataType import TAB_EQUAL_SPLIT
+from Library.DataType import TAB_SECTION_START
+from Library.DataType import TAB_SECTION_END
+from Logger import StringTable as ST
+from Library.StringUtils import ConvertSpecialChar
+from Library.ParserValidate import IsValidPath
+from Library import GlobalData
+
+## log error:
+#
+# @param error: error
+# @param File: File
+# @param Line: Line
+#
+def IniParseError(Error, File, Line):
+ Logger.Error("UPT", UPT_INI_PARSE_ERROR, File=File,
+ Line=Line, ExtraData=Error)
+
+## __ValidatePath
+#
+# @param Path: Path to be checked
+#
+def __ValidatePath(Path, Root):
+ Path = Path.strip()
+ if os.path.isabs(Path) or not IsValidPath(Path, Root):
+ return False, ST.ERR_FILELIST_LOCATION % (Root, Path)
+ return True, ''
+
+## ValidateMiscFile
+#
+# @param Filename: File to be checked
+#
+def ValidateMiscFile(Filename):
+ Root = GlobalData.gWORKSPACE
+ return __ValidatePath(Filename, Root)
+
+## ValidateToolsFile
+#
+# @param Filename: File to be checked
+#
+def ValidateToolsFile(Filename):
+ Valid, Cause = False, ''
+ if not Valid and 'EDK_TOOLS_PATH' in os.environ:
+ Valid, Cause = __ValidatePath(Filename, os.environ['EDK_TOOLS_PATH'])
+ if not Valid:
+ Valid, Cause = __ValidatePath(Filename, GlobalData.gWORKSPACE)
+ return Valid, Cause
+
+## ParseFileList
+#
+# @param Line: Line
+# @param Map: Map
+# @param CurrentKey: CurrentKey
+# @param PathFunc: Path validate function
+#
+def ParseFileList(Line, Map, CurrentKey, PathFunc):
+ FileList = ["", {}]
+ TokenList = Line.split(TAB_VALUE_SPLIT)
+ if len(TokenList) > 0:
+ Path = TokenList[0].strip().replace('\\', '/')
+ if not Path:
+ return False, ST.ERR_WRONG_FILELIST_FORMAT
+ Valid, Cause = PathFunc(Path)
+ if not Valid:
+ return Valid, Cause
+ FileList[0] = TokenList[0].strip()
+ for Token in TokenList[1:]:
+ Attr = Token.split(TAB_EQUAL_SPLIT)
+ if len(Attr) != 2 or not Attr[0].strip() or not Attr[1].strip():
+ return False, ST.ERR_WRONG_FILELIST_FORMAT
+
+ Key = Attr[0].strip()
+ Val = Attr[1].strip()
+ if Key not in ['OS', 'Executable']:
+ return False, ST.ERR_UNKNOWN_FILELIST_ATTR % Key
+
+ if Key == 'OS' and Val not in ["Win32", "Win64", "Linux32",
+ "Linux64", "OS/X32", "OS/X64",
+ "GenericWin", "GenericNix"]:
+ return False, ST.ERR_FILELIST_ATTR % 'OS'
+ elif Key == 'Executable' and Val not in ['true', 'false']:
+ return False, ST.ERR_FILELIST_ATTR % 'Executable'
+ FileList[1][Key] = Val
+
+ Map[CurrentKey].append(FileList)
+ return True, ''
+
+## Create header XML file
+#
+# @param DistMap: DistMap
+# @param Root: Root
+#
+def CreateHeaderXml(DistMap, Root):
+ Element1 = CreateXmlElement('Name', DistMap['Name'],
+ [], [['BaseName', DistMap['BaseName']]])
+ Element2 = CreateXmlElement('GUID', DistMap['GUID'],
+ [], [['Version', DistMap['Version']]])
+ AttributeList = [['ReadOnly', DistMap['ReadOnly']],
+ ['RePackage', DistMap['RePackage']]]
+ NodeList = [Element1,
+ Element2,
+ ['Vendor', DistMap['Vendor']],
+ ['Date', DistMap['Date']],
+ ['Copyright', DistMap['Copyright']],
+ ['License', DistMap['License']],
+ ['Abstract', DistMap['Abstract']],
+ ['Description', DistMap['Description']],
+ ['Signature', DistMap['Signature']],
+ ['XmlSpecification', DistMap['XmlSpecification']],
+ ]
+ Root.appendChild(CreateXmlElement('DistributionHeader', '',
+ NodeList, AttributeList))
+
+## Create tools XML file
+#
+# @param Map: Map
+# @param Root: Root
+# @param Tag: Tag
+#
+def CreateToolsXml(Map, Root, Tag):
+ #
+ # Check if all elements in this section are empty
+ #
+ for Key in Map:
+ if len(Map[Key]) > 0:
+ break
+ else:
+ return
+
+ NodeList = [['Name', Map['Name']],
+ ['Copyright', Map['Copyright']],
+ ['License', Map['License']],
+ ['Abstract', Map['Abstract']],
+ ['Description', Map['Description']],
+ ]
+ HeaderNode = CreateXmlElement('Header', '', NodeList, [])
+ NodeList = [HeaderNode]
+
+ for File in Map['FileList']:
+ AttrList = []
+ for Key in File[1]:
+ AttrList.append([Key, File[1][Key]])
+ NodeList.append(CreateXmlElement('Filename', File[0], [], AttrList))
+ Root.appendChild(CreateXmlElement(Tag, '', NodeList, []))
+
+## ValidateValues
+#
+# @param Key: Key
+# @param Value: Value
+# @param SectionName: SectionName
+#
+def ValidateValues(Key, Value, SectionName):
+ if SectionName == 'DistributionHeader':
+ Valid, Cause = ValidateRegValues(Key, Value)
+ if not Valid:
+ return Valid, Cause
+ Valid = __ValidateDistHeader(Key, Value)
+ if not Valid:
+ return Valid, ST.ERR_VALUE_INVALID % (Key, SectionName)
+ else:
+ Valid = __ValidateOtherHeader(Key, Value)
+ if not Valid:
+ return Valid, ST.ERR_VALUE_INVALID % (Key, SectionName)
+ return True, ''
+
+## ValidateRegValues
+#
+# @param Key: Key
+# @param Value: Value
+#
+def ValidateRegValues(Key, Value):
+ ValidateMap = {
+ 'ReadOnly' :
+ ('true|false', ST.ERR_BOOLEAN_VALUE % (Key, Value)),
+ 'RePackage' :
+ ('true|false', ST.ERR_BOOLEAN_VALUE % (Key, Value)),
+ 'GUID' :
+ ('[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}'
+ '-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}',
+ ST.ERR_GUID_VALUE % Value),
+ 'Version' : ('[0-9]+(\.[0-9]+)?', ST.ERR_VERSION_VALUE % \
+ (Key, Value)),
+ 'XmlSpecification' : ('1\.1', ST.ERR_VERSION_XMLSPEC % Value)
+ }
+ if Key not in ValidateMap:
+ return True, ''
+ Elem = ValidateMap[Key]
+ Match = re.compile(Elem[0]).match(Value)
+ if Match and Match.start() == 0 and Match.end() == len(Value):
+ return True, ''
+ return False, Elem[1]
+
+## __ValidateDistHeaderName
+#
+# @param Name: Name
+#
+def __ValidateDistHeaderName(Name):
+ if len(Name) < 1:
+ return False
+
+ for Char in Name:
+ if ord(Char) < 0x20 or ord(Char) >= 0x7f:
+ return False
+ return True
+
+## __ValidateDistHeaderBaseName
+#
+# @param BaseName: BaseName
+#
+def __ValidateDistHeaderBaseName(BaseName):
+ if not BaseName:
+ return False
+# if CheckLen and len(BaseName) < 2:
+# return False
+ if not BaseName[0].isalnum() and BaseName[0] != '_':
+ return False
+ for Char in BaseName[1:]:
+ if not Char.isalnum() and Char not in '-_':
+ return False
+ return True
+
+## __ValidateDistHeaderAbstract
+#
+# @param Abstract: Abstract
+#
+def __ValidateDistHeaderAbstract(Abstract):
+ return '\t' not in Abstract and len(Abstract.splitlines()) == 1
+
+## __ValidateOtherHeaderAbstract
+#
+# @param Abstract: Abstract
+#
+def __ValidateOtherHeaderAbstract(Abstract):
+ return __ValidateDistHeaderAbstract(Abstract)
+
+## __ValidateDistHeader
+#
+# @param Key: Key
+# @param Value: Value
+#
+def __ValidateDistHeader(Key, Value):
+ ValidateMap = {
+ 'Name' : __ValidateDistHeaderName,
+ 'BaseName' : __ValidateDistHeaderBaseName,
+ 'Abstract' : __ValidateDistHeaderAbstract,
+ 'Vendor' : __ValidateDistHeaderAbstract
+ }
+ return not (Value and Key in ValidateMap and not ValidateMap[Key](Value))
+
+## __ValidateOtherHeader
+#
+# @param Key: Key
+# @param Value: Value
+#
+def __ValidateOtherHeader(Key, Value):
+ ValidateMap = {
+ 'Name' : __ValidateDistHeaderName,
+ 'Abstract' : __ValidateOtherHeaderAbstract
+ }
+ return not (Value and Key in ValidateMap and not ValidateMap[Key](Value))
+
+## Convert ini file to xml file
+#
+# @param IniFile
+#
+def IniToXml(IniFile):
+ if not os.path.exists(IniFile):
+ Logger.Error("UPT", FILE_NOT_FOUND, ST.ERR_TEMPLATE_NOTFOUND % IniFile)
+
+ DistMap = {'ReadOnly' : '', 'RePackage' : '', 'Name' : '',
+ 'BaseName' : '', 'GUID' : '', 'Version' : '', 'Vendor' : '',
+ 'Date' : '', 'Copyright' : '', 'License' : '', 'Abstract' : '',
+ 'Description' : '', 'Signature' : '', 'XmlSpecification' : ''
+ }
+
+ ToolsMap = {'Name' : '', 'Copyright' : '', 'License' : '',
+ 'Abstract' : '', 'Description' : '', 'FileList' : []}
+ #
+ # Only FileList is a list: [['file1', {}], ['file2', {}], ...]
+ #
+ MiscMap = {'Name' : '', 'Copyright' : '', 'License' : '',
+ 'Abstract' : '', 'Description' : '', 'FileList' : []}
+
+ SectionMap = {
+ 'DistributionHeader' : DistMap,
+ 'ToolsHeader' : ToolsMap,
+ 'MiscellaneousFilesHeader' : MiscMap
+ }
+
+ PathValidator = {
+ 'ToolsHeader' : ValidateToolsFile,
+ 'MiscellaneousFilesHeader' : ValidateMiscFile
+ }
+
+ ParsedSection = []
+
+ SectionName = ''
+ CurrentKey = ''
+ PreMap = None
+ Map = None
+ FileContent = ConvertSpecialChar(open(IniFile, 'r').readlines())
+ LastIndex = 0
+ for Index in range(0, len(FileContent)):
+ LastIndex = Index
+ Line = FileContent[Index].strip()
+ if Line == '' or Line.startswith(';'):
+ continue
+ if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END:
+ CurrentKey = ''
+ SectionName = Line[1:-1].strip()
+ if SectionName not in SectionMap:
+ IniParseError(ST.ERR_SECTION_NAME_INVALID % SectionName,
+ IniFile, Index+1)
+
+ if SectionName in ParsedSection:
+ IniParseError(ST.ERR_SECTION_REDEFINE % SectionName,
+ IniFile, Index+1)
+ else:
+ ParsedSection.append(SectionName)
+
+ Map = SectionMap[SectionName]
+ continue
+ if not Map:
+ IniParseError(ST.ERR_SECTION_NAME_NONE, IniFile, Index+1)
+ TokenList = Line.split(TAB_EQUAL_SPLIT, 1)
+ TempKey = TokenList[0].strip()
+ #
+ # Value spanned multiple or same keyword appears more than one time
+ #
+ if len(TokenList) < 2 or TempKey not in Map:
+ if CurrentKey == '':
+ IniParseError(ST.ERR_KEYWORD_INVALID % TempKey,
+ IniFile, Index+1)
+ elif CurrentKey == 'FileList':
+ #
+ # Special for FileList
+ #
+ Valid, Cause = ParseFileList(Line, Map, CurrentKey,
+ PathValidator[SectionName])
+ if not Valid:
+ IniParseError(Cause, IniFile, Index+1)
+
+ else:
+ #
+ # Multiple lines for one key such as license
+ # Or if string on the left side of '=' is not a keyword
+ #
+ Map[CurrentKey] = ''.join([Map[CurrentKey], '\n', Line])
+ Valid, Cause = ValidateValues(CurrentKey,
+ Map[CurrentKey], SectionName)
+ if not Valid:
+ IniParseError(Cause, IniFile, Index+1)
+ continue
+
+ if (TokenList[1].strip() == ''):
+ IniParseError(ST.ERR_EMPTY_VALUE, IniFile, Index+1)
+
+ #
+ # A keyword found
+ #
+ CurrentKey = TempKey
+ if Map[CurrentKey]:
+ IniParseError(ST.ERR_KEYWORD_REDEFINE % CurrentKey,
+ IniFile, Index+1)
+
+ if id(Map) != id(PreMap) and Map['Copyright']:
+ PreMap = Map
+ Copyright = Map['Copyright'].lower()
+ Pos = Copyright.find('copyright')
+ if Pos == -1:
+ IniParseError(ST.ERR_COPYRIGHT_CONTENT, IniFile, Index)
+ if not Copyright[Pos + len('copyright'):].lstrip(' ').startswith('('):
+ IniParseError(ST.ERR_COPYRIGHT_CONTENT, IniFile, Index)
+
+ if CurrentKey == 'FileList':
+ Valid, Cause = ParseFileList(TokenList[1], Map, CurrentKey,
+ PathValidator[SectionName])
+ if not Valid:
+ IniParseError(Cause, IniFile, Index+1)
+ else:
+ Map[CurrentKey] = TokenList[1].strip()
+ Valid, Cause = ValidateValues(CurrentKey,
+ Map[CurrentKey], SectionName)
+ if not Valid:
+ IniParseError(Cause, IniFile, Index+1)
+
+ if id(Map) != id(PreMap) and Map['Copyright'] and 'copyright' not in Map['Copyright'].lower():
+ IniParseError(ST.ERR_COPYRIGHT_CONTENT, IniFile, LastIndex)
+
+ #
+ # Check mandatory keys
+ #
+ CheckMdtKeys(DistMap, IniFile, LastIndex,
+ (('ToolsHeader', ToolsMap), ('MiscellaneousFilesHeader', MiscMap))
+ )
+
+ return CreateXml(DistMap, ToolsMap, MiscMap, IniFile)
+
+
+## CheckMdtKeys
+#
+# @param MdtDistKeys: All mandatory keys
+# @param DistMap: Dist content
+# @param IniFile: Ini file
+# @param LastIndex: Last index of Ini file
+# @param Maps: Tools and Misc section name and map. (('section_name', map),*)
+#
+def CheckMdtKeys(DistMap, IniFile, LastIndex, Maps):
+ MdtDistKeys = ['Name', 'GUID', 'Version', 'Vendor', 'Copyright', 'License', 'Abstract', 'XmlSpecification']
+ for Key in MdtDistKeys:
+ if Key not in DistMap or DistMap[Key] == '':
+ IniParseError(ST.ERR_KEYWORD_MANDATORY % Key, IniFile, LastIndex+1)
+
+ if '.' not in DistMap['Version']:
+ DistMap['Version'] = DistMap['Version'] + '.0'
+
+ DistMap['Date'] = str(strftime("%Y-%m-%dT%H:%M:%S", localtime()))
+
+ #
+ # Check Tools Surface Area according to UPT Spec
+ # <Tools> {0,}
+ # <Header> ... </Header> {0,1}
+ # <Filename> ... </Filename> {1,}
+ # </Tools>
+ # <Header>
+ # <Name> xs:normalizedString </Name> {1}
+ # <Copyright> xs:string </Copyright> {0,1}
+ # <License> xs:string </License> {0,1}
+ # <Abstract> xs:normalizedString </Abstract> {0,1}
+ # <Description> xs:string </Description> {0,1}
+ # </Header>
+ #
+ for Item in Maps:
+ Map = Item[1]
+ NonEmptyKey = 0
+ for Key in Map:
+ if Map[Key]:
+ NonEmptyKey += 1
+
+ if NonEmptyKey > 0 and not Map['FileList']:
+ IniParseError(ST.ERR_KEYWORD_MANDATORY % (Item[0] + '.FileList'), IniFile, LastIndex+1)
+
+ if NonEmptyKey > 0 and not Map['Name']:
+ IniParseError(ST.ERR_KEYWORD_MANDATORY % (Item[0] + '.Name'), IniFile, LastIndex+1)
+
+## CreateXml
+#
+# @param DistMap: Dist Content
+# @param ToolsMap: Tools Content
+# @param MiscMap: Misc Content
+# @param IniFile: Ini File
+#
+def CreateXml(DistMap, ToolsMap, MiscMap, IniFile):
+ Attrs = [['xmlns', 'http://www.uefi.org/2011/1.1'],
+ ['xmlns:xsi', 'http:/www.w3.org/2001/XMLSchema-instance'],
+ ]
+ Root = CreateXmlElement('DistributionPackage', '', [], Attrs)
+ CreateHeaderXml(DistMap, Root)
+ CreateToolsXml(ToolsMap, Root, 'Tools')
+ CreateToolsXml(MiscMap, Root, 'MiscellaneousFiles')
+
+ FileAndExt = IniFile.rsplit('.', 1)
+ if len(FileAndExt) > 1:
+ FileName = FileAndExt[0] + '.xml'
+ else:
+ FileName = IniFile + '.xml'
+ File = open(FileName, 'w')
+
+ try:
+ File.write(Root.toprettyxml(indent = ' '))
+ finally:
+ File.close()
+ return FileName
+
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py b/roms/edk2/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
new file mode 100644
index 000000000..741da9080
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
@@ -0,0 +1,1003 @@
+## @file
+# This file is used to parse a Module file of .PKG file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+ModuleSurfaceAreaXml
+'''
+from xml.dom import minidom
+
+from Library.StringUtils import ConvertNEToNOTEQ
+from Library.StringUtils import ConvertNOTEQToNE
+from Library.StringUtils import GetStringOfList
+from Library.StringUtils import IsMatchArch
+from Library.Xml.XmlRoutines import XmlElement
+from Library.Xml.XmlRoutines import XmlAttribute
+from Library.Xml.XmlRoutines import XmlNode
+from Library.Xml.XmlRoutines import XmlList
+from Library.Xml.XmlRoutines import CreateXmlElement
+from Object.POM.CommonObject import GuidVersionObject
+from Object.POM.ModuleObject import BootModeObject
+from Object.POM.ModuleObject import DepexObject
+from Object.POM.ModuleObject import ModuleObject
+from Object.POM.ModuleObject import EventObject
+from Object.POM.ModuleObject import HobObject
+from Object.POM.ModuleObject import SourceFileObject
+from Object.POM.ModuleObject import PackageDependencyObject
+from Object.POM.ModuleObject import ExternObject
+from Object.POM.ModuleObject import BinaryFileObject
+from Object.POM.ModuleObject import AsBuiltObject
+from Object.POM.ModuleObject import BinaryBuildFlagObject
+from Xml.CommonXml import ClonedFromXml
+from Xml.CommonXml import HeaderXml
+from Xml.CommonXml import HelpTextXml
+from Xml.CommonXml import CommonDefinesXml
+from Xml.CommonXml import LibraryClassXml
+from Xml.CommonXml import UserExtensionsXml
+from Xml.CommonXml import MiscellaneousFileXml
+from Xml.CommonXml import FilenameXml
+from Xml.GuidProtocolPpiXml import GuidXml
+from Xml.GuidProtocolPpiXml import ProtocolXml
+from Xml.GuidProtocolPpiXml import PpiXml
+from Xml.PcdXml import PcdEntryXml
+from Xml.XmlParserMisc import GetHelpTextList
+from Library import GlobalData
+from Library.Misc import GetSplitValueList
+
+## BinaryFileXml
+#
+# represent the following XML item
+#
+# <BinaryFile>
+# <Filename
+# FileType=" FileType " {1}
+# SupArchList=" ArchListType " {0,1}
+# FeatureFlag=" FeatureFlagExpression " {0,1} >
+# xs:anyURI
+# </Filename> {1,}
+# <AsBuilt> ... </AsBuilt> {0,}
+# </BinaryFile> {1,}
+#
+class BinaryFileXml(object):
+ def __init__(self):
+ self.FileNames = []
+ self.AsBuiltList = []
+ self.PatchPcdValues = ''
+ self.PcdExValues = ''
+ self.LibraryInstances = ''
+ self.BuildFlags = ''
+
+ def FromXml(self, Item, Key):
+ if self.FileNames:
+ pass
+ BinaryFile = BinaryFileObject()
+ FilenameList = []
+ SupArchList = ['COMMON']
+ for SubItem in XmlList(Item, '%s/Filename' % Key):
+ Axml = FilenameXml()
+ Bxml = Axml.FromXml(SubItem, 'Filename')
+ FilenameList.append(Bxml)
+ BinaryFile.SetFileNameList(FilenameList)
+ for FileName in FilenameList:
+ if FileName.GetSupArchList():
+ SupArchList = FileName.GetSupArchList()
+ BinaryFile.SetSupArchList(SupArchList)
+ if GlobalData.gIS_BINARY_INF:
+ AsBuiltList = []
+ for AsBuiltItem in XmlList(Item, '%s/AsBuilt' % Key):
+ AsBuilt = AsBuiltObject()
+
+ PatchPcdValueList = []
+ for SubItem in XmlList(AsBuiltItem, 'AsBuilt/PatchPcdValue'):
+ Axml = PcdEntryXml()
+ Bxml = Axml.FromXml(SubItem, 'PatchPcdValue')
+ PatchPcdValueList.append(Bxml)
+ AsBuilt.SetPatchPcdList(PatchPcdValueList)
+ PcdExValueList = []
+ for SubItem in XmlList(AsBuiltItem, 'AsBuilt/PcdExValue'):
+ Axml = PcdEntryXml()
+ Bxml = Axml.FromXml(SubItem, 'PcdExValue')
+ PcdExValueList.append(Bxml)
+ AsBuilt.SetPcdExList(PcdExValueList)
+ LibraryList = []
+ for SubItem in XmlList(Item, '%s/AsBuilt/LibraryInstances/GUID' % Key):
+ GuidVerObj = GuidVersionObject()
+ GUID = XmlElement(SubItem, 'GUID')
+ Version = XmlAttribute(XmlNode(SubItem, 'GUID'), 'Version')
+ GuidVerObj.SetGuid(GUID)
+ GuidVerObj.SetVersion(Version)
+ LibraryList.append(GuidVerObj)
+ if XmlList(Item, '%s/AsBuilt/LibraryInstances' % Key) and not LibraryList:
+ LibraryList = [None]
+ AsBuilt.SetLibraryInstancesList(LibraryList)
+ BuildFlagList = []
+ for SubItem in XmlList(Item, '%s/AsBuilt/BuildFlags' % Key):
+ BuildFlag = BuildFlagXml()
+ BuildFlagList.append(BuildFlag.FromXml2(SubItem, 'BuildFlags'))
+ AsBuilt.SetBuildFlagsList(BuildFlagList)
+ AsBuiltList.append(AsBuilt)
+ BinaryFile.SetAsBuiltList(AsBuiltList)
+ return BinaryFile
+
+ def ToXml(self, BinaryFile, Key):
+ if self.FileNames:
+ pass
+ NodeList = []
+ FilenameList = BinaryFile.GetFileNameList()
+ SupportArch = None
+ for Filename in FilenameList:
+ Tmp = FilenameXml()
+ NodeList.append(Tmp.ToXml(Filename, 'Filename'))
+ SupportArch = Filename.SupArchList
+
+ AsBuildList = BinaryFile.GetAsBuiltList()
+ PatchPcdValueList = AsBuildList.GetPatchPcdList()
+ PcdExList = AsBuildList.GetPcdExList()
+ LibGuidVerList = AsBuildList.GetLibraryInstancesList()
+ BuildFlagList = AsBuildList.GetBuildFlagsList()
+
+ AsBuiltNodeList = []
+
+ for Pcd in PatchPcdValueList:
+ if IsMatchArch(Pcd.SupArchList, SupportArch):
+ Tmp = PcdEntryXml()
+ AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PatchPcdValue'))
+
+ for Pcd in PcdExList:
+ if IsMatchArch(Pcd.SupArchList, SupportArch):
+ Tmp = PcdEntryXml()
+ AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PcdExValue'))
+
+ GuiVerElemList = []
+ for LibGuidVer in LibGuidVerList:
+ if LibGuidVer.GetLibGuid() and IsMatchArch(LibGuidVer.GetSupArchList(), SupportArch):
+ GuiVerElem = \
+ CreateXmlElement('GUID', LibGuidVer.GetLibGuid(), [], [['Version', LibGuidVer.GetLibVersion()]])
+ GuiVerElemList.append(GuiVerElem)
+ if len(GuiVerElemList) > 0:
+ LibGuidVerElem = CreateXmlElement('LibraryInstances', '', GuiVerElemList, [])
+ AsBuiltNodeList.append(LibGuidVerElem)
+
+ for BuildFlag in BuildFlagList:
+ if IsMatchArch(BuildFlag.GetSupArchList(), SupportArch):
+ for Item in BuildFlag.GetAsBuildList():
+ Tmp = BuildFlagXml()
+ Elem = CreateXmlElement('BuildFlags', ''.join(Item), [], [])
+ AsBuiltNodeList.append(Elem)
+
+ if len(AsBuiltNodeList) > 0:
+ Element = CreateXmlElement('AsBuilt', '', AsBuiltNodeList, [])
+ NodeList.append(Element)
+
+ Root = CreateXmlElement('%s' % Key, '', NodeList, [])
+
+ return Root
+
+ def __str__(self):
+ Str = "BinaryFiles:"
+ for Item in self.FileNames:
+ Str = Str + '\n\t' + str(Item)
+ for Item in self.PatchPcdValues:
+ Str = Str + '\n\t' + str(Item)
+ for Item in self.PcdExValues:
+ Str = Str + '\n\t' + str(Item)
+ for Item in self.LibraryInstances:
+ Str = Str + '\n\t' + str(Item)
+ for Item in self.BuildFlags:
+ Str = Str + '\n\t' + str(Item)
+ return Str
+
+##
+# PackageXml
+#
+class PackageXml(object):
+ def __init__(self):
+ self.Description = ''
+ self.Guid = ''
+ self.Version = ''
+ self.CommonDefines = CommonDefinesXml()
+
+ def FromXml(self, Item, Key):
+ self.Description = XmlElement(Item, '%s/Description' % Key)
+ self.Guid = XmlElement(Item, '%s/GUID' % Key)
+ self.Version = XmlAttribute(XmlNode(Item, '%s/GUID' % Key), 'Version')
+ self.CommonDefines.FromXml(XmlNode(Item, '%s' % Key), Key)
+
+ PackageDependency = PackageDependencyObject()
+ PackageDependency.SetPackage(self.Description)
+ PackageDependency.SetGuid(self.Guid)
+ PackageDependency.SetVersion(self.Version)
+ PackageDependency.SetFeatureFlag(ConvertNOTEQToNE(self.CommonDefines.FeatureFlag))
+ PackageDependency.SetSupArchList(self.CommonDefines.SupArchList)
+
+ return PackageDependency
+
+ def ToXml(self, PackageDependency, Key):
+ if self.Guid:
+ pass
+ AttributeList = [['SupArchList', GetStringOfList(PackageDependency.GetSupArchList())],
+ ['FeatureFlag', ConvertNEToNOTEQ(PackageDependency.GetFeatureFlag())], ]
+ Element1 = CreateXmlElement('GUID', PackageDependency.GetGuid(), [],
+ [['Version', PackageDependency.GetVersion()]])
+ NodeList = [['Description', PackageDependency.GetPackage()], Element1, ]
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+
+ def __str__(self):
+ Str = "Description = %s Guid = %s Version = %s %s" \
+ % (self.Description, self.Guid, self.Version, self.CommonDefines)
+ return Str
+##
+# ExternXml
+#
+class ExternXml(object):
+ def __init__(self):
+ self.CommonDefines = CommonDefinesXml()
+ self.EntryPoint = ''
+ self.UnloadImage = ''
+ self.Constructor = ''
+ self.Destructor = ''
+ self.SupModList = ''
+ self.SupArchList = ''
+ self.HelpText = []
+
+ def FromXml(self, Item, Key):
+ self.CommonDefines.FromXml(Item, Key)
+ self.EntryPoint = XmlElement(Item, '%s/EntryPoint' % Key)
+ self.UnloadImage = XmlElement(Item, '%s/UnloadImage' % Key)
+ self.Constructor = XmlElement(Item, '%s/Constructor' % Key)
+ self.Destructor = XmlElement(Item, '%s/Destructor' % Key)
+
+ Extern = ExternObject()
+ Extern.SetEntryPoint(self.EntryPoint)
+ Extern.SetUnloadImage(self.UnloadImage)
+ Extern.SetConstructor(self.Constructor)
+ Extern.SetDestructor(self.Destructor)
+ if self.CommonDefines.SupModList:
+ Extern.SetSupModList(self.CommonDefines.SupModList)
+ if self.CommonDefines.SupArchList:
+ Extern.SetSupArchList(self.CommonDefines.SupArchList)
+ return Extern
+
+ def ToXml(self, Extern, Key):
+ if self.HelpText:
+ pass
+
+ NodeList = []
+ if Extern.GetEntryPoint():
+ NodeList.append(['EntryPoint', Extern.GetEntryPoint()])
+ if Extern.GetUnloadImage():
+ NodeList.append(['UnloadImage', Extern.GetUnloadImage()])
+ if Extern.GetConstructor():
+ NodeList.append(['Constructor', Extern.GetConstructor()])
+ if Extern.GetDestructor():
+ NodeList.append(['Destructor', Extern.GetDestructor()])
+ Root = CreateXmlElement('%s' % Key, '', NodeList, [])
+
+ return Root
+
+ def __str__(self):
+ Str = "EntryPoint = %s UnloadImage = %s Constructor = %s Destructor = %s %s" \
+ % (self.EntryPoint, self.UnloadImage, self.Constructor, self.Destructor, self.CommonDefines)
+ for Item in self.HelpText:
+ Str = Str + '\n\t' + str(Item)
+ return Str
+##
+# DepexXml
+#
+class DepexXml(object):
+ def __init__(self):
+ self.CommonDefines = CommonDefinesXml()
+ self.Expression = None
+ self.HelpText = []
+
+ def FromXml(self, Item, Key):
+ if not Item:
+ return None
+ self.CommonDefines.FromXml(Item, Key)
+ self.Expression = XmlElement(Item, '%s/Expression' % Key)
+ for HelpTextItem in XmlList(Item, '%s/HelpText' % Key):
+ HelpTextObj = HelpTextXml()
+ HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key)
+ self.HelpText.append(HelpTextObj)
+
+ Depex = DepexObject()
+ Depex.SetDepex(self.Expression)
+ Depex.SetModuleType(self.CommonDefines.SupModList)
+ Depex.SetSupArchList(self.CommonDefines.SupArchList)
+ Depex.SetFeatureFlag(self.CommonDefines.FeatureFlag)
+ Depex.SetHelpTextList(GetHelpTextList(self.HelpText))
+
+ return Depex
+
+ def ToXml(self, Depex, Key):
+ if self.HelpText:
+ pass
+ AttributeList = [['SupArchList', GetStringOfList(Depex.GetSupArchList())],
+ ['SupModList', Depex.GetModuleType()]]
+ NodeList = [['Expression', Depex.GetDepex()]]
+ if Depex.GetHelpText():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Depex.GetHelpText(), 'HelpText'))
+
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+ return Root
+
+ def __str__(self):
+ Str = "Expression = %s" % (self.Expression)
+ for Item in self.HelpText:
+ Str = Str + '\n\t' + str(Item)
+ return Str
+
+##
+# BootModeXml
+#
+class BootModeXml(object):
+ def __init__(self):
+ self.SupportedBootModes = ''
+ self.CommonDefines = CommonDefinesXml()
+ self.HelpText = []
+
+ def FromXml(self, Item, Key):
+ self.SupportedBootModes = \
+ XmlElement(Item, '%s/SupportedBootModes' % Key)
+ self.CommonDefines.FromXml(Item, Key)
+ for HelpTextItem in XmlList(Item, '%s/HelpText' % Key):
+ HelpTextObj = HelpTextXml()
+ HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key)
+ self.HelpText.append(HelpTextObj)
+
+ BootMode = BootModeObject()
+ BootMode.SetSupportedBootModes(self.SupportedBootModes)
+ BootMode.SetUsage(self.CommonDefines.Usage)
+ BootMode.SetHelpTextList(GetHelpTextList(self.HelpText))
+
+ return BootMode
+
+ def ToXml(self, BootMode, Key):
+ if self.HelpText:
+ pass
+ AttributeList = [['Usage', BootMode.GetUsage()], ]
+ NodeList = [['SupportedBootModes', BootMode.GetSupportedBootModes()]]
+ for Item in BootMode.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item, 'HelpText'))
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+
+ def __str__(self):
+ Str = "SupportedBootModes = %s %s" % (self.SupportedBootModes, self.CommonDefines)
+ for Item in self.HelpText:
+ Str = Str + '\n\t' + str(Item)
+ return Str
+##
+# EventXml
+#
+class EventXml(object):
+ def __init__(self):
+ self.EventType = ''
+ self.Name = ''
+ self.CommonDefines = CommonDefinesXml()
+ self.HelpText = []
+
+ def FromXml(self, Item, Key):
+ self.EventType = XmlAttribute(XmlNode(Item, '%s' % Key), 'EventType')
+ self.Name = XmlElement(Item, '%s' % Key)
+ self.CommonDefines.FromXml(Item, Key)
+ for HelpTextItem in XmlList(Item, '%s/HelpText' % Key):
+ HelpTextObj = HelpTextXml()
+ HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key)
+ self.HelpText.append(HelpTextObj)
+
+ Event = EventObject()
+ Event.SetEventType(self.EventType)
+ Event.SetUsage(self.CommonDefines.Usage)
+ Event.SetHelpTextList(GetHelpTextList(self.HelpText))
+
+ return Event
+
+ def ToXml(self, Event, Key):
+ if self.HelpText:
+ pass
+ AttributeList = [['EventType', Event.GetEventType()],
+ ['Usage', Event.GetUsage()],
+ ]
+ NodeList = []
+ for Item in Event.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item, 'HelpText'))
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+
+ def __str__(self):
+ Str = "EventType = %s %s" % (self.EventType, self.CommonDefines)
+ for Item in self.HelpText:
+ Str = Str + '\n\t' + str(Item)
+ return Str
+##
+# HobXml
+#
+class HobXml(object):
+ def __init__(self):
+ self.HobType = ''
+ self.Name = ''
+ self.CommonDefines = CommonDefinesXml()
+ self.HelpText = []
+
+ def FromXml(self, Item, Key):
+ self.HobType = XmlAttribute(XmlNode(Item, '%s' % Key), 'HobType')
+ self.Name = XmlElement(Item, '%s' % Key)
+ self.CommonDefines.FromXml(Item, Key)
+ for HelpTextItem in XmlList(Item, '%s/HelpText' % Key):
+ HelpTextObj = HelpTextXml()
+ HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key)
+ self.HelpText.append(HelpTextObj)
+
+ Hob = HobObject()
+ Hob.SetHobType(self.HobType)
+ Hob.SetSupArchList(self.CommonDefines.SupArchList)
+ Hob.SetUsage(self.CommonDefines.Usage)
+ Hob.SetHelpTextList(GetHelpTextList(self.HelpText))
+
+ return Hob
+
+ def ToXml(self, Hob, Key):
+ if self.Name:
+ pass
+ AttributeList = [['HobType', Hob.GetHobType()],
+ ['Usage', Hob.GetUsage()],
+ ['SupArchList', GetStringOfList(Hob.GetSupArchList())], ]
+ NodeList = []
+ for Item in Hob.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item, 'HelpText'))
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+
+ def __str__(self):
+ Str = "HobType = %s %s" % (self.HobType, self.CommonDefines)
+ for Item in self.HelpText:
+ Str = Str + '\n\t' + str(Item)
+ return Str
+
+##
+# SourceFileXml
+#
+class SourceFileXml(object):
+ def __init__(self):
+ self.SourceFile = ''
+ self.ToolChainFamily = ''
+ self.FileType = ''
+ self.CommonDefines = CommonDefinesXml()
+
+ def FromXml(self, Item, Key):
+ self.ToolChainFamily = XmlAttribute(Item, 'Family')
+ self.SourceFile = XmlElement(Item, 'Filename')
+ self.CommonDefines.FromXml(Item, Key)
+
+ self.CommonDefines.FeatureFlag = ConvertNOTEQToNE(self.CommonDefines.FeatureFlag)
+
+ SourceFile = SourceFileObject()
+ SourceFile.SetSourceFile(self.SourceFile)
+ SourceFile.SetFamily(self.ToolChainFamily)
+ SourceFile.SetSupArchList(self.CommonDefines.SupArchList)
+ SourceFile.SetFeatureFlag(self.CommonDefines.FeatureFlag)
+
+ return SourceFile
+
+ def ToXml(self, SourceFile, Key):
+ if self.SourceFile:
+ pass
+ FeatureFlag = ConvertNEToNOTEQ(SourceFile.GetFeatureFlag())
+ AttributeList = [['SupArchList', GetStringOfList(SourceFile.GetSupArchList())],
+ ['Family', SourceFile.GetFamily()],
+ ['FeatureFlag', FeatureFlag], ]
+ Root = CreateXmlElement('%s' % Key, SourceFile.GetSourceFile(), [], AttributeList)
+ return Root
+
+##
+# ModulePropertyXml
+#
+class ModulePropertyXml(object):
+ def __init__(self):
+ self.CommonDefines = CommonDefinesXml()
+ self.ModuleType = ''
+ self.Path = ''
+ self.PcdIsDriver = ''
+ self.UefiSpecificationVersion = ''
+ self.PiSpecificationVersion = ''
+ self.SpecificationList = []
+ self.SpecificationVersion = ''
+ self.BootModes = []
+ self.Events = []
+ self.HOBs = []
+
+ def FromXml(self, Item, Key, Header=None):
+ self.CommonDefines.FromXml(Item, Key)
+ self.ModuleType = XmlElement(Item, '%s/ModuleType' % Key)
+ self.Path = XmlElement(Item, '%s/Path' % Key)
+ self.PcdIsDriver = XmlElement(Item, '%s/PcdIsDriver' % Key)
+ self.UefiSpecificationVersion = XmlElement(Item, '%s/UefiSpecificationVersion' % Key)
+ self.PiSpecificationVersion = XmlElement(Item, '%s/PiSpecificationVersion' % Key)
+ for SubItem in XmlList(Item, '%s/Specification' % Key):
+ Specification = XmlElement(SubItem, '/Specification')
+ Version = XmlAttribute(XmlNode(SubItem, '/Specification'), 'Version')
+ self.SpecificationList.append((Specification, Version))
+ for SubItem in XmlList(Item, '%s/BootMode' % Key):
+ Axml = BootModeXml()
+ BootMode = Axml.FromXml(SubItem, 'BootMode')
+ self.BootModes.append(BootMode)
+ for SubItem in XmlList(Item, '%s/Event' % Key):
+ Axml = EventXml()
+ Event = Axml.FromXml(SubItem, 'Event')
+ self.Events.append(Event)
+ for SubItem in XmlList(Item, '%s/HOB' % Key):
+ Axml = HobXml()
+ Hob = Axml.FromXml(SubItem, 'HOB')
+ self.HOBs.append(Hob)
+
+ if Header is None:
+ Header = ModuleObject()
+
+ Header.SetModuleType(self.ModuleType)
+ Header.SetSupArchList(self.CommonDefines.SupArchList)
+ Header.SetModulePath(self.Path)
+
+ Header.SetPcdIsDriver(self.PcdIsDriver)
+ Header.SetUefiSpecificationVersion(self.UefiSpecificationVersion)
+ Header.SetPiSpecificationVersion(self.PiSpecificationVersion)
+ Header.SetSpecList(self.SpecificationList)
+
+ return Header, self.BootModes, self.Events, self.HOBs
+
+
+ def ToXml(self, Header, BootModes, Events, Hobs, Key):
+ if self.ModuleType:
+ pass
+ AttributeList = [['SupArchList', GetStringOfList(Header.GetSupArchList())], ]
+
+ NodeList = [['ModuleType', Header.GetModuleType()],
+ ['Path', Header.GetModulePath()],
+ ['PcdIsDriver', Header.GetPcdIsDriver()],
+ ['UefiSpecificationVersion', Header.GetUefiSpecificationVersion()],
+ ['PiSpecificationVersion', Header.GetPiSpecificationVersion()],
+ ]
+ for Item in Header.GetSpecList():
+ Spec, Version = Item
+ SpecElem = CreateXmlElement('Specification', Spec, [], [['Version', Version]])
+ NodeList.append(SpecElem)
+
+ for Item in BootModes:
+ Tmp = BootModeXml()
+ NodeList.append(Tmp.ToXml(Item, 'BootMode'))
+ for Item in Events:
+ Tmp = EventXml()
+ NodeList.append(Tmp.ToXml(Item, 'Event'))
+ for Item in Hobs:
+ Tmp = HobXml()
+ NodeList.append(Tmp.ToXml(Item, 'HOB'))
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+
+ def __str__(self):
+ Str = "ModuleType = %s Path = %s PcdIsDriver = %s UefiSpecificationVersion = %s PiSpecificationVersion = %s \
+ Specification = %s SpecificationVersion = %s %s" % \
+ (self.ModuleType, self.Path, self.PcdIsDriver, \
+ self.UefiSpecificationVersion, self.PiSpecificationVersion, \
+ self.SpecificationList, self.SpecificationVersion, self.CommonDefines)
+ for Item in self.BootModes:
+ Str = Str + '\n\t' + str(Item)
+ for Item in self.Events:
+ Str = Str + '\n\t' + str(Item)
+ for Item in self.HOBs:
+ Str = Str + '\n\t' + str(Item)
+ return Str
+
+##
+# ModuleXml
+#
+class ModuleSurfaceAreaXml(object):
+ def __init__(self, Package=''):
+ self.Module = None
+ #
+ # indicate the package that this module resides in
+ #
+ self.Package = Package
+
+ def FromXml2(self, Item, Module):
+ if self.Module:
+ pass
+ #
+ # PeiDepex
+ #
+ PeiDepexList = []
+ for SubItem in XmlList(Item, '/ModuleSurfaceArea/PeiDepex'):
+ Tmp = DepexXml()
+ Depex = Tmp.FromXml(XmlNode(SubItem, 'PeiDepex'), 'PeiDepex')
+ PeiDepexList.append(Depex)
+ Module.SetPeiDepex(PeiDepexList)
+
+ #
+ # DxeDepex
+ #
+ DxeDepexList = []
+ for SubItem in XmlList(Item, '/ModuleSurfaceArea/DxeDepex'):
+ Tmp = DepexXml()
+ Depex = Tmp.FromXml(XmlNode(SubItem, 'DxeDepex'), 'DxeDepex')
+ DxeDepexList.append(Depex)
+ Module.SetDxeDepex(DxeDepexList)
+
+ #
+ # SmmDepex
+ #
+ SmmDepexList = []
+ for SubItem in XmlList(Item, '/ModuleSurfaceArea/SmmDepex'):
+ Tmp = DepexXml()
+ Depex = Tmp.FromXml(XmlNode(SubItem, 'SmmDepex'), 'SmmDepex')
+ SmmDepexList.append(Depex)
+ Module.SetSmmDepex(SmmDepexList)
+
+ #
+ # MiscellaneousFile
+ Tmp = MiscellaneousFileXml()
+ MiscFileList = Tmp.FromXml(XmlNode(Item, '/ModuleSurfaceArea/MiscellaneousFiles'), 'MiscellaneousFiles')
+ if MiscFileList:
+ Module.SetMiscFileList([MiscFileList])
+ else:
+ Module.SetMiscFileList([])
+
+ #
+ # UserExtensions
+ #
+ for Item in XmlList(Item, '/ModuleSurfaceArea/UserExtensions'):
+ Tmp = UserExtensionsXml()
+ UserExtension = Tmp.FromXml(Item, 'UserExtensions')
+ Module.SetUserExtensionList(Module.GetUserExtensionList() + [UserExtension])
+
+ return Module
+
+ def FromXml(self, Item, Key, IsStandAlongModule=False):
+ IsBinaryModule = XmlAttribute(Item, 'BinaryModule')
+ #
+ # Header
+ #
+ Tmp = HeaderXml()
+ Module = Tmp.FromXml(XmlNode(Item, '/%s/Header' % Key), 'Header', True, IsStandAlongModule)
+ Module.SetBinaryModule(IsBinaryModule)
+
+ if IsBinaryModule:
+ GlobalData.gIS_BINARY_INF = True
+
+ #
+ # ModuleProperties
+ #
+ Tmp = ModulePropertyXml()
+ (Module, BootModes, Events, HOBs) = \
+ Tmp.FromXml(XmlNode(Item, '/ModuleSurfaceArea/ModuleProperties'), 'ModuleProperties', Module)
+ Module.SetBootModeList(BootModes)
+ Module.SetEventList(Events)
+ Module.SetHobList(HOBs)
+ #
+ # ClonedFrom
+ #
+ Tmp = ClonedFromXml()
+ ClonedFrom = Tmp.FromXml(XmlNode(Item, '/ModuleSurfaceArea/ClonedFrom'), 'ClonedFrom')
+ if ClonedFrom:
+ Module.SetClonedFrom(ClonedFrom)
+
+ #
+ # LibraryClass
+ #
+ for SubItem in XmlList(Item, '/ModuleSurfaceArea/LibraryClassDefinitions/LibraryClass'):
+ Tmp = LibraryClassXml()
+ LibraryClass = Tmp.FromXml(SubItem, 'LibraryClass')
+ Module.SetLibraryClassList(Module.GetLibraryClassList() + [LibraryClass])
+
+ if XmlList(Item, '/ModuleSurfaceArea/LibraryClassDefinitions') and \
+ not XmlList(Item, '/ModuleSurfaceArea/LibraryClassDefinitions/LibraryClass'):
+ Module.SetLibraryClassList([None])
+
+ #
+ # SourceFiles
+ #
+ for SubItem in XmlList(Item, '/ModuleSurfaceArea/SourceFiles/Filename'):
+ Tmp = SourceFileXml()
+ SourceFile = Tmp.FromXml(SubItem, 'Filename')
+ Module.SetSourceFileList(Module.GetSourceFileList() + [SourceFile])
+
+ if XmlList(Item, '/ModuleSurfaceArea/SourceFiles') and \
+ not XmlList(Item, '/ModuleSurfaceArea/SourceFiles/Filename') :
+ Module.SetSourceFileList([None])
+
+ #
+ # BinaryFile
+ #
+ for SubItem in XmlList(Item, '/ModuleSurfaceArea/BinaryFiles/BinaryFile'):
+ Tmp = BinaryFileXml()
+ BinaryFile = Tmp.FromXml(SubItem, 'BinaryFile')
+ Module.SetBinaryFileList(Module.GetBinaryFileList() + [BinaryFile])
+
+ if XmlList(Item, '/ModuleSurfaceArea/BinaryFiles') and \
+ not XmlList(Item, '/ModuleSurfaceArea/BinaryFiles/BinaryFile') :
+ Module.SetBinaryFileList([None])
+ #
+ # PackageDependencies
+ #
+ for SubItem in XmlList(Item, '/ModuleSurfaceArea/PackageDependencies/Package'):
+ Tmp = PackageXml()
+ PackageDependency = Tmp.FromXml(SubItem, 'Package')
+ Module.SetPackageDependencyList(Module.GetPackageDependencyList() + [PackageDependency])
+
+ if XmlList(Item, '/ModuleSurfaceArea/PackageDependencies') and \
+ not XmlList(Item, '/ModuleSurfaceArea/PackageDependencies/Package'):
+ Module.SetPackageDependencyList([None])
+
+ #
+ # Guid
+ #
+ for SubItem in XmlList(Item, '/ModuleSurfaceArea/Guids/GuidCName'):
+ Tmp = GuidXml('Module')
+ GuidProtocolPpi = Tmp.FromXml(SubItem, 'GuidCName')
+ Module.SetGuidList(Module.GetGuidList() + [GuidProtocolPpi])
+
+ if XmlList(Item, '/ModuleSurfaceArea/Guids') and not XmlList(Item, '/ModuleSurfaceArea/Guids/GuidCName'):
+ Module.SetGuidList([None])
+
+ #
+ # Protocol
+ #
+ for SubItem in XmlList(Item, '/ModuleSurfaceArea/Protocols/Protocol'):
+ Tmp = ProtocolXml('Module')
+ GuidProtocolPpi = Tmp.FromXml(SubItem, 'Protocol')
+ Module.SetProtocolList(Module.GetProtocolList() + [GuidProtocolPpi])
+
+ if XmlList(Item, '/ModuleSurfaceArea/Protocols') and not XmlList(Item, '/ModuleSurfaceArea/Protocols/Protocol'):
+ Module.SetProtocolList([None])
+
+ #
+ # Ppi
+ #
+ for SubItem in XmlList(Item, '/ModuleSurfaceArea/PPIs/Ppi'):
+ Tmp = PpiXml('Module')
+ GuidProtocolPpi = Tmp.FromXml(SubItem, 'Ppi')
+ Module.SetPpiList(Module.GetPpiList() + [GuidProtocolPpi])
+
+ if XmlList(Item, '/ModuleSurfaceArea/PPIs') and not XmlList(Item, '/ModuleSurfaceArea/PPIs/Ppi'):
+ Module.SetPpiList([None])
+
+ #
+ # Extern
+ #
+ for SubItem in XmlList(Item, '/ModuleSurfaceArea/Externs/Extern'):
+ Tmp = ExternXml()
+ Extern = Tmp.FromXml(SubItem, 'Extern')
+ Module.SetExternList(Module.GetExternList() + [Extern])
+
+ if XmlList(Item, '/ModuleSurfaceArea/Externs') and not XmlList(Item, '/ModuleSurfaceArea/Externs/Extern'):
+ Module.SetExternList([None])
+
+ if not Module.GetBinaryModule():
+ #
+ # PcdCoded
+ #
+ for SubItem in XmlList(Item, '/ModuleSurfaceArea/PcdCoded/PcdEntry'):
+ Tmp = PcdEntryXml()
+ PcdEntry = Tmp.FromXml3(SubItem, 'PcdEntry')
+ Module.SetPcdList(Module.GetPcdList() + [PcdEntry])
+
+ if XmlList(Item, '/ModuleSurfaceArea/PcdCoded') and \
+ not XmlList(Item, '/ModuleSurfaceArea/PcdCoded/PcdEntry'):
+ Module.SetPcdList([None])
+
+ Module = self.FromXml2(Item, Module)
+ #
+ # return the module object
+ #
+ self.Module = Module
+ return self.Module
+
+ def ToXml(self, Module):
+ if self.Package:
+ pass
+ #
+ # Create root node of module surface area
+ #
+ DomModule = minidom.Document().createElement('ModuleSurfaceArea')
+ if Module.GetBinaryModule():
+ DomModule.setAttribute('BinaryModule', 'true')
+
+ #
+ # Header
+ #
+ Tmp = HeaderXml()
+ DomModule.appendChild(Tmp.ToXml(Module, 'Header'))
+ #
+ # ModuleProperties
+ #
+ Tmp = ModulePropertyXml()
+ DomModule.appendChild(Tmp.ToXml(Module, Module.GetBootModeList(), Module.GetEventList(), Module.GetHobList(), \
+ 'ModuleProperties'))
+ #
+ # ClonedFrom
+ #
+ Tmp = ClonedFromXml()
+ if Module.GetClonedFrom():
+ DomModule.appendChild(Tmp.ToXml(Module.GetClonedFrom(), 'ClonedFrom'))
+ #
+ # LibraryClass
+ #
+ LibraryClassNode = CreateXmlElement('LibraryClassDefinitions', '', [], [])
+ for LibraryClass in Module.GetLibraryClassList():
+ Tmp = LibraryClassXml()
+ LibraryClassNode.appendChild(Tmp.ToXml2(LibraryClass, 'LibraryClass'))
+ DomModule.appendChild(LibraryClassNode)
+ #
+ # SourceFile
+ #
+ SourceFileNode = CreateXmlElement('SourceFiles', '', [], [])
+ for SourceFile in Module.GetSourceFileList():
+ Tmp = SourceFileXml()
+ SourceFileNode.appendChild(Tmp.ToXml(SourceFile, 'Filename'))
+ DomModule.appendChild(SourceFileNode)
+ #
+ # BinaryFile
+ #
+ BinaryFileNode = CreateXmlElement('BinaryFiles', '', [], [])
+ for BinaryFile in Module.GetBinaryFileList():
+ Tmp = BinaryFileXml()
+ BinaryFileNode.appendChild(Tmp.ToXml(BinaryFile, 'BinaryFile'))
+ DomModule.appendChild(BinaryFileNode)
+ #
+ # PackageDependencies
+ #
+ PackageDependencyNode = CreateXmlElement('PackageDependencies', '', [], [])
+ for PackageDependency in Module.GetPackageDependencyList():
+ Tmp = PackageXml()
+ PackageDependencyNode.appendChild(Tmp.ToXml(PackageDependency, 'Package'))
+ DomModule.appendChild(PackageDependencyNode)
+
+ #
+ # Guid
+ #
+ GuidProtocolPpiNode = CreateXmlElement('Guids', '', [], [])
+ for GuidProtocolPpi in Module.GetGuidList():
+ Tmp = GuidXml('Module')
+ GuidProtocolPpiNode.appendChild(Tmp.ToXml(GuidProtocolPpi, 'GuidCName'))
+ DomModule.appendChild(GuidProtocolPpiNode)
+
+ #
+ # Protocol
+ #
+ GuidProtocolPpiNode = CreateXmlElement('Protocols', '', [], [])
+ for GuidProtocolPpi in Module.GetProtocolList():
+ Tmp = ProtocolXml('Module')
+ GuidProtocolPpiNode.appendChild(Tmp.ToXml(GuidProtocolPpi, 'Protocol'))
+ DomModule.appendChild(GuidProtocolPpiNode)
+
+ #
+ # Ppi
+ #
+ GuidProtocolPpiNode = CreateXmlElement('PPIs', '', [], [])
+ for GuidProtocolPpi in Module.GetPpiList():
+ Tmp = PpiXml('Module')
+ GuidProtocolPpiNode.appendChild(Tmp.ToXml(GuidProtocolPpi, 'Ppi'))
+ DomModule.appendChild(GuidProtocolPpiNode)
+ #
+ # Extern
+ #
+ ExternNode = CreateXmlElement('Externs', '', [], [])
+ for Extern in Module.GetExternList():
+ Tmp = ExternXml()
+ ExternNode.appendChild(Tmp.ToXml(Extern, 'Extern'))
+ DomModule.appendChild(ExternNode)
+ #
+ # PcdCoded
+ #
+ PcdEntryNode = CreateXmlElement('PcdCoded', '', [], [])
+ for PcdEntry in Module.GetPcdList():
+ Tmp = PcdEntryXml()
+ PcdEntryNode.appendChild(Tmp.ToXml3(PcdEntry, 'PcdEntry'))
+ DomModule.appendChild(PcdEntryNode)
+
+ #
+ # PeiDepex
+ #
+ if Module.GetPeiDepex():
+ for Item in Module.GetPeiDepex():
+ Tmp = DepexXml()
+ DomModule.appendChild(Tmp.ToXml(Item, 'PeiDepex'))
+
+ #
+ # DxeDepex
+ #
+ if Module.GetDxeDepex():
+ for Item in Module.GetDxeDepex():
+ Tmp = DepexXml()
+ DomModule.appendChild(Tmp.ToXml(Item, 'DxeDepex'))
+
+ #
+ # SmmDepex
+ #
+ if Module.GetSmmDepex():
+ for Item in Module.GetSmmDepex():
+ Tmp = DepexXml()
+ DomModule.appendChild(Tmp.ToXml(Item, 'SmmDepex'))
+
+ #
+ # MiscellaneousFile
+ #
+ if Module.GetMiscFileList():
+ Tmp = MiscellaneousFileXml()
+ DomModule.appendChild(Tmp.ToXml(Module.GetMiscFileList()[0], 'MiscellaneousFiles'))
+ #
+ # UserExtensions
+ #
+ if Module.GetUserExtensionList():
+ for UserExtension in Module.GetUserExtensionList():
+ Tmp = UserExtensionsXml()
+ DomModule.appendChild(Tmp.ToXml(UserExtension, 'UserExtensions'))
+
+ return DomModule
+
+##
+# BuildFlagXml used to generate BuildFlag for <AsBuilt>
+#
+class BuildFlagXml(object):
+ def __init__(self):
+ self.Target = ''
+ self.TagName = ''
+ self.Family = ''
+ self.AsBuiltFlags = ''
+
+ def FromXml(self, Item, Key):
+ self.Target = XmlElement(Item, '%s/Target' % Key)
+ self.TagName = XmlElement(Item, '%s/TagName' % Key)
+ self.Family = XmlElement(Item, '%s/Family' % Key)
+
+ BuildFlag = BinaryBuildFlagObject()
+
+ BuildFlag.SetTarget(self.Target)
+ BuildFlag.SetTagName(self.TagName)
+ BuildFlag.SetFamily(self.Family)
+
+ return BuildFlag
+
+ #
+ # For AsBuild INF usage
+ #
+ def FromXml2(self, Item, Key):
+ self.AsBuiltFlags = XmlElement(Item, '%s' % Key)
+
+ LineList = GetSplitValueList(self.AsBuiltFlags, '\n')
+ ReturnLine = ''
+ Count = 0
+ for Line in LineList:
+ if Count == 0:
+ ReturnLine = "# " + Line
+ else:
+ ReturnLine = ReturnLine + '\n' + '# ' + Line
+ Count += 1
+
+ BuildFlag = BinaryBuildFlagObject()
+ BuildFlag.SetAsBuiltOptionFlags(ReturnLine)
+
+ return BuildFlag
+
+ def ToXml(self, BuildFlag, Key):
+ if self.Target:
+ pass
+ AttributeList = []
+ NodeList = []
+ NodeList.append(['BuildFlags', BuildFlag])
+
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+ return Root
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Xml/PackageSurfaceAreaXml.py b/roms/edk2/BaseTools/Source/Python/UPT/Xml/PackageSurfaceAreaXml.py
new file mode 100644
index 000000000..103939023
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Xml/PackageSurfaceAreaXml.py
@@ -0,0 +1,402 @@
+## @file
+# This file is used to parse a Package file of .PKG file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+PackageSurfaceAreaXml
+'''
+from xml.dom import minidom
+
+from Library.StringUtils import GetStringOfList
+from Library.Xml.XmlRoutines import XmlElement
+from Library.Xml.XmlRoutines import XmlNode
+from Library.Xml.XmlRoutines import XmlList
+from Library.Xml.XmlRoutines import CreateXmlElement
+from Object.POM.CommonObject import IncludeObject
+from Object.POM.CommonObject import TextObject
+from Object.POM.PackageObject import PackageObject
+from Xml.CommonXml import ClonedFromXml
+from Xml.CommonXml import PackageHeaderXml
+from Xml.CommonXml import HelpTextXml
+from Xml.CommonXml import CommonDefinesXml
+from Xml.CommonXml import LibraryClassXml
+from Xml.CommonXml import UserExtensionsXml
+from Xml.CommonXml import MiscellaneousFileXml
+from Xml.GuidProtocolPpiXml import GuidXml
+from Xml.GuidProtocolPpiXml import ProtocolXml
+from Xml.GuidProtocolPpiXml import PpiXml
+from Xml.ModuleSurfaceAreaXml import ModuleSurfaceAreaXml
+from Xml.PcdXml import PcdEntryXml
+
+##
+# IndustryStandardHeaderXml
+#
+class IndustryStandardHeaderXml(object):
+ def __init__(self):
+ self.HeaderFile = ''
+ self.HelpText = []
+
+ def FromXml(self, Item, Key):
+ self.HeaderFile = XmlElement(Item, '%s/HeaderFile' % Key)
+ for HelpTextItem in XmlList(Item, '%s/HelpText' % Key):
+ HelpTextObj = HelpTextXml()
+ HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key)
+ self.HelpText.append(HelpTextObj)
+
+ Include = IncludeObject()
+ Include.SetFilePath(self.HeaderFile)
+ HelpTxt = TextObject()
+ HelpTxt.SetString(self.HelpText)
+ Include.SetHelpText(HelpTxt)
+
+ return Include
+
+ def ToXml(self, IndustryStandardHeader, Key):
+ if self.HeaderFile:
+ pass
+ AttributeList = []
+ NodeList = [['HeaderFile', IndustryStandardHeader.GetFilePath()]]
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+
+ def __str__(self):
+ Str = "HeaderFile = %s" % (self.HeaderFile)
+ for Item in self.HelpText:
+ Str = Str + "\n\t" + str(Item)
+ return Str
+##
+# PackageIncludeHeaderXml
+#
+class PackageIncludeHeaderXml(object):
+ def __init__(self):
+ self.HeaderFile = ''
+ self.CommonDefines = CommonDefinesXml()
+ self.HelpText = []
+
+ def FromXml(self, Item, Key):
+ self.HeaderFile = XmlElement(Item, '%s/HeaderFile' % Key)
+ self.CommonDefines.FromXml(XmlNode(Item, '%s/HeaderFile' % Key), 'HeaderFile')
+ for HelpTextItem in XmlList(Item, '%s/HelpText' % Key):
+ HelpTextObj = HelpTextXml()
+ HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key)
+ self.HelpText.append(HelpTextObj)
+
+ Include = IncludeObject()
+ Include.SetFilePath(self.HeaderFile)
+ Include.SetSupArchList(self.CommonDefines.SupArchList)
+ HelpTxt = TextObject()
+ HelpTxt.SetString(self.HelpText)
+ Include.SetHelpText(HelpTxt)
+
+ return Include
+
+ def ToXml(self, PackageIncludeHeader, Key):
+ if self.HeaderFile:
+ pass
+ AttributeList = [['SupArchList', GetStringOfList(PackageIncludeHeader.GetSupArchList())], \
+ ['SupModList', GetStringOfList(PackageIncludeHeader.GetSupModuleList())], ]
+
+ HeaderFileNode = CreateXmlElement('HeaderFile', PackageIncludeHeader.FilePath, [], AttributeList)
+
+ NodeList = [HeaderFileNode]
+ for Item in PackageIncludeHeader.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item))
+
+ Root = CreateXmlElement('%s' % Key, '', NodeList, [])
+
+ return Root
+
+ def __str__(self):
+ Str = "HeaderFile = %s\n\t%s" % (self.HeaderFile, self.CommonDefines)
+ for Item in self.HelpText:
+ Str = Str + "\n\t" + str(Item)
+ return Str
+
+##
+# PcdCheckXml
+#
+class PcdCheckXml(object):
+ def __init__(self):
+ self.PcdCheck = ''
+
+ def FromXml(self, Item, Key):
+ if Key:
+ pass
+ self.PcdCheck = XmlElement(Item, 'PcdCheck')
+
+ return self.PcdCheck
+
+ def ToXml(self, PcdCheck, Key):
+ if self.PcdCheck:
+ pass
+ Root = CreateXmlElement('%s' % Key, PcdCheck, [], [])
+ return Root
+
+ def __str__(self):
+ return "PcdCheck = %s" % (self.PcdCheck)
+
+##
+# PackageSurfaceAreaXml
+#
+class PackageSurfaceAreaXml(object):
+ def __init__(self):
+ self.Package = None
+
+ def FromXml(self, Item, Key):
+ if Key:
+ pass
+ #
+ # Create a package object
+ #
+ Package = PackageObject()
+ #
+ # Header
+ #
+ Tmp = PackageHeaderXml()
+ Tmp.FromXml(XmlNode(Item, '/PackageSurfaceArea/Header'), 'Header', Package)
+ #
+ # ClonedFrom
+ #
+ Tmp = ClonedFromXml()
+ if XmlNode(Item, '/PackageSurfaceArea/ClonedFrom'):
+ ClonedFrom = Tmp.FromXml(XmlNode(Item, '/PackageSurfaceArea/ClonedFrom'), 'ClonedFrom')
+ Package.SetClonedFromList([ClonedFrom])
+ #
+ # LibraryClass
+ #
+
+ for SubItem in XmlList(Item, '/PackageSurfaceArea/LibraryClassDeclarations/LibraryClass'):
+ Tmp = LibraryClassXml()
+ LibraryClass = Tmp.FromXml(SubItem, 'LibraryClass')
+ Package.SetLibraryClassList(Package.GetLibraryClassList() + [LibraryClass])
+
+ if XmlList(Item, '/PackageSurfaceArea/LibraryClassDeclarations') and \
+ not XmlList(Item, '/PackageSurfaceArea/LibraryClassDeclarations/LibraryClass'):
+ Package.SetLibraryClassList([None])
+
+ #
+ # IndustryStandardHeader
+ #
+ for SubItem in XmlList(Item, '/PackageSurfaceArea/IndustryStandardIncludes/IndustryStandardHeader'):
+ Tmp = IndustryStandardHeaderXml()
+ Include = Tmp.FromXml(SubItem, 'IndustryStandardHeader')
+ Package.SetStandardIncludeFileList(Package.GetStandardIncludeFileList() + [Include])
+
+ if XmlList(Item, '/PackageSurfaceArea/IndustryStandardIncludes') and \
+ not XmlList(Item, '/PackageSurfaceArea/IndustryStandardIncludes/IndustryStandardHeader'):
+ Package.SetStandardIncludeFileList([None])
+
+
+ #
+ # PackageHeader
+ #
+ for SubItem in XmlList(Item, '/PackageSurfaceArea/PackageIncludes/PackageHeader'):
+ Tmp = PackageIncludeHeaderXml()
+ Include = Tmp.FromXml(SubItem, 'PackageHeader')
+ Package.SetPackageIncludeFileList(Package.GetPackageIncludeFileList() + [Include])
+
+ if XmlList(Item, '/PackageSurfaceArea/PackageIncludes') and not \
+ XmlList(Item, '/PackageSurfaceArea/PackageIncludes/PackageHeader'):
+ Package.SetPackageIncludeFileList([None])
+
+ #
+ # Guid
+ #
+ for SubItem in XmlList(Item, '/PackageSurfaceArea/GuidDeclarations/Entry'):
+ Tmp = GuidXml('Package')
+ GuidProtocolPpi = Tmp.FromXml(SubItem, 'Entry')
+ Package.SetGuidList(Package.GetGuidList() + [GuidProtocolPpi])
+
+ if XmlList(Item, '/PackageSurfaceArea/GuidDeclarations') and not \
+ XmlList(Item, '/PackageSurfaceArea/GuidDeclarations/Entry'):
+ Package.SetGuidList([None])
+
+ #
+ # Protocol
+ #
+ for SubItem in XmlList(Item, '/PackageSurfaceArea/ProtocolDeclarations/Entry'):
+ Tmp = ProtocolXml('Package')
+ GuidProtocolPpi = Tmp.FromXml(SubItem, 'Entry')
+ Package.SetProtocolList(Package.GetProtocolList() + [GuidProtocolPpi])
+
+ if XmlList(Item, '/PackageSurfaceArea/ProtocolDeclarations') and not \
+ XmlList(Item, '/PackageSurfaceArea/ProtocolDeclarations/Entry'):
+ Package.SetProtocolList([None])
+
+ #
+ # Ppi
+ #
+ for SubItem in XmlList(Item, '/PackageSurfaceArea/PpiDeclarations/Entry'):
+ Tmp = PpiXml('Package')
+ GuidProtocolPpi = Tmp.FromXml(SubItem, 'Entry')
+ Package.SetPpiList(Package.GetPpiList() + [GuidProtocolPpi])
+
+ if XmlList(Item, '/PackageSurfaceArea/PpiDeclarations') and not \
+ XmlList(Item, '/PackageSurfaceArea/PpiDeclarations/Entry'):
+ Package.SetPpiList([None])
+
+ #
+ # PcdEntry
+ #
+ for SubItem in XmlList(Item, '/PackageSurfaceArea/PcdDeclarations/PcdEntry'):
+ Tmp = PcdEntryXml()
+ PcdEntry = Tmp.FromXml2(SubItem, 'PcdEntry')
+ Package.SetPcdList(Package.GetPcdList() + [PcdEntry])
+
+ #
+ # Get PcdErrorCommentDict from PcdError in PcdEntry Node
+ #
+ for PcdErrorObj in PcdEntry.GetPcdErrorsList():
+ PcdErrorMessageList = PcdErrorObj.GetErrorMessageList()
+ if PcdErrorMessageList:
+ Package.PcdErrorCommentDict[(PcdEntry.GetTokenSpaceGuidCName(), PcdErrorObj.GetErrorNumber())] = \
+ PcdErrorMessageList
+
+
+ if XmlList(Item, '/PackageSurfaceArea/PcdDeclarations') and not \
+ XmlList(Item, '/PackageSurfaceArea/PcdDeclarations/PcdEntry'):
+ Package.SetPcdList([None])
+
+ #
+ # PcdCheck
+ #
+ for SubItem in XmlList(Item, '/PackageSurfaceArea/PcdRelationshipChecks/PcdCheck'):
+ Tmp = PcdCheckXml()
+ PcdCheck = Tmp.FromXml(SubItem, 'PcdCheck')
+ Package.PcdChecks.append(PcdCheck)
+
+ #
+ # Modules
+ #
+ for SubItem in XmlList(Item, '/PackageSurfaceArea/Modules/ModuleSurfaceArea'):
+ Tmp = ModuleSurfaceAreaXml()
+ Module = Tmp.FromXml(SubItem, 'ModuleSurfaceArea')
+ ModuleDictKey = (Module.GetGuid(), Module.GetVersion(), Module.GetName(), Module.GetModulePath())
+ Package.ModuleDict[ModuleDictKey] = Module
+ #
+ # MiscellaneousFile
+ #
+ Tmp = MiscellaneousFileXml()
+ MiscFileList = Tmp.FromXml(XmlNode(Item, '/PackageSurfaceArea/MiscellaneousFiles'), 'MiscellaneousFiles')
+ if MiscFileList:
+ Package.SetMiscFileList([MiscFileList])
+ else:
+ Package.SetMiscFileList([])
+
+ #
+ # UserExtensions
+ #
+ for Item in XmlList(Item, '/PackageSurfaceArea/UserExtensions'):
+ Tmp = UserExtensionsXml()
+ UserExtension = Tmp.FromXml(Item, 'UserExtensions')
+ Package.UserExtensionList.append(UserExtension)
+
+ self.Package = Package
+ return self.Package
+
+ def ToXml(self, Package):
+ if self.Package:
+ pass
+ #
+ # Create PackageSurfaceArea node
+ #
+ DomPackage = minidom.Document().createElement('PackageSurfaceArea')
+ #
+ # Header
+ #
+ Tmp = PackageHeaderXml()
+ DomPackage.appendChild(Tmp.ToXml(Package, 'Header'))
+ #
+ # ClonedFrom
+ #
+ Tmp = ClonedFromXml()
+ if Package.GetClonedFromList() != []:
+ DomPackage.appendChild(Tmp.ToXml(Package.GetClonedFromList[0], 'ClonedFrom'))
+ #
+ # LibraryClass
+ #
+ LibraryClassNode = CreateXmlElement('LibraryClassDeclarations', '', [], [])
+ for LibraryClass in Package.GetLibraryClassList():
+ Tmp = LibraryClassXml()
+ LibraryClassNode.appendChild(Tmp.ToXml(LibraryClass, 'LibraryClass'))
+ DomPackage.appendChild(LibraryClassNode)
+ #
+ # IndustryStandardHeader
+ #
+ IndustryStandardHeaderNode = CreateXmlElement('IndustryStandardIncludes', '', [], [])
+ for Include in Package.GetStandardIncludeFileList():
+ Tmp = IndustryStandardHeaderXml()
+ IndustryStandardHeaderNode.appendChild(Tmp.ToXml(Include, 'IndustryStandardHeader'))
+ DomPackage.appendChild(IndustryStandardHeaderNode)
+ #
+ # PackageHeader
+ #
+ PackageIncludeHeaderNode = CreateXmlElement('PackageIncludes', '', [], [])
+ for Include in Package.GetPackageIncludeFileList():
+ Tmp = PackageIncludeHeaderXml()
+ PackageIncludeHeaderNode.appendChild(Tmp.ToXml(Include, 'PackageHeader'))
+ DomPackage.appendChild(PackageIncludeHeaderNode)
+ ModuleNode = CreateXmlElement('Modules', '', [], [])
+ for Module in Package.GetModuleDict().values():
+ Tmp = ModuleSurfaceAreaXml()
+ ModuleNode.appendChild(Tmp.ToXml(Module))
+ DomPackage.appendChild(ModuleNode)
+ #
+ # Guid
+ #
+ GuidProtocolPpiNode = CreateXmlElement('GuidDeclarations', '', [], [])
+ for GuidProtocolPpi in Package.GetGuidList():
+ Tmp = GuidXml('Package')
+ GuidProtocolPpiNode.appendChild(Tmp.ToXml\
+ (GuidProtocolPpi, 'Entry'))
+ DomPackage.appendChild(GuidProtocolPpiNode)
+ #
+ # Protocol
+ #
+ GuidProtocolPpiNode = \
+ CreateXmlElement('ProtocolDeclarations', '', [], [])
+ for GuidProtocolPpi in Package.GetProtocolList():
+ Tmp = ProtocolXml('Package')
+ GuidProtocolPpiNode.appendChild\
+ (Tmp.ToXml(GuidProtocolPpi, 'Entry'))
+ DomPackage.appendChild(GuidProtocolPpiNode)
+ #
+ # Ppi
+ #
+ GuidProtocolPpiNode = CreateXmlElement('PpiDeclarations', '', [], [])
+ for GuidProtocolPpi in Package.GetPpiList():
+ Tmp = PpiXml('Package')
+ GuidProtocolPpiNode.appendChild\
+ (Tmp.ToXml(GuidProtocolPpi, 'Entry'))
+ DomPackage.appendChild(GuidProtocolPpiNode)
+ #
+ # PcdEntry
+ #
+ PcdEntryNode = CreateXmlElement('PcdDeclarations', '', [], [])
+ for PcdEntry in Package.GetPcdList():
+ Tmp = PcdEntryXml()
+ PcdEntryNode.appendChild(Tmp.ToXml2(PcdEntry, 'PcdEntry'))
+ DomPackage.appendChild(PcdEntryNode)
+
+ #
+ # MiscellaneousFile
+ #
+ Tmp = MiscellaneousFileXml()
+ if Package.GetMiscFileList():
+ DomPackage.appendChild(Tmp.ToXml(Package.GetMiscFileList()[0], 'MiscellaneousFiles'))
+
+ #
+ # UserExtensions
+ #
+ if Package.GetUserExtensionList():
+ for UserExtension in Package.GetUserExtensionList():
+ Tmp = UserExtensionsXml()
+ DomPackage.appendChild(Tmp.ToXml(UserExtension, 'UserExtensions'))
+
+ return DomPackage
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Xml/PcdXml.py b/roms/edk2/BaseTools/Source/Python/UPT/Xml/PcdXml.py
new file mode 100644
index 000000000..bbcee45a0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Xml/PcdXml.py
@@ -0,0 +1,555 @@
+## @file
+# This file is used to parse a PCD file of .PKG file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+PcdXml
+'''
+
+##
+# Import Modules
+#
+
+from Library.Xml.XmlRoutines import XmlElement
+from Library.Xml.XmlRoutines import XmlAttribute
+from Library.Xml.XmlRoutines import XmlNode
+from Library.Xml.XmlRoutines import CreateXmlElement
+from Library.Xml.XmlRoutines import XmlList
+from Library.StringUtils import GetStringOfList
+from Library.StringUtils import ConvertNEToNOTEQ
+from Library.StringUtils import ConvertNOTEQToNE
+from Library import GlobalData
+from Object.POM.CommonObject import PcdObject
+from Object.POM.CommonObject import PcdErrorObject
+from Xml.CommonXml import HelpTextXml
+from Xml.CommonXml import PromptXml
+from Xml.CommonXml import CommonDefinesXml
+from Xml.XmlParserMisc import GetHelpTextList
+from Xml.XmlParserMisc import GetPromptList
+import re
+
+##
+# PcdErrorXml
+#
+class PcdErrorXml(object):
+ def __init__(self):
+ self.ValidValueList = ''
+ self.ValidValueListLang = ''
+ self.ValidValueRange = ''
+ self.Expression = ''
+ self.ErrorNumber = ''
+ self.ErrorMessage = []
+
+ def FromXml(self, Item, Key):
+ self.ValidValueList = XmlElement(Item, '%s/ValidValueList' % Key)
+ self.ValidValueListLang = \
+ XmlAttribute(XmlNode(Item, '%s/ValidValueList' % Key), 'Lang')
+ self.ValidValueRange = self.TransferValidEpxr2ValidRange(XmlElement(Item, '%s/ValidValueRange' % Key))
+ self.Expression = XmlElement(Item, '%s/Expression' % Key)
+ self.ErrorNumber = XmlElement(Item, '%s/ErrorNumber' % Key)
+ for ErrMsg in XmlList(Item, '%s/ErrorMessage' % Key):
+ ErrorMessageString = XmlElement(ErrMsg, 'ErrorMessage')
+ ErrorMessageLang = \
+ XmlAttribute(XmlNode(ErrMsg, 'ErrorMessage'), 'Lang')
+ self.ErrorMessage.append((ErrorMessageLang, ErrorMessageString))
+
+ Error = PcdErrorObject()
+ Error.SetValidValue(self.ValidValueList)
+ Error.SetValidValueLang(self.ValidValueListLang)
+ Error.SetValidValueRange(self.ValidValueRange)
+ Error.SetExpression(self.Expression)
+ Error.SetErrorNumber(self.ErrorNumber)
+ Error.SetErrorMessageList(self.ErrorMessage)
+
+ return Error
+
+ def ToXml(self, PcdError, Key):
+ if self.Expression:
+ pass
+ AttributeList = []
+ NodeList = []
+ if PcdError.GetValidValue():
+ Element1 = \
+ CreateXmlElement('ValidValueList', PcdError.GetValidValue(), [], \
+ [['Lang', PcdError.GetValidValueLang()]])
+ NodeList.append(Element1)
+ if PcdError.GetValidValueRange():
+ TansferedRangeStr = self.TransferValidRange2Expr(PcdError.GetTokenSpaceGuidCName(),
+ PcdError.GetCName(),
+ PcdError.GetValidValueRange())
+ Element1 = \
+ CreateXmlElement('ValidValueRange', \
+ TansferedRangeStr, [], [])
+ NodeList.append(Element1)
+ if PcdError.GetExpression():
+ NodeList.append(['Expression', PcdError.GetExpression()])
+ if PcdError.GetErrorNumber():
+ NodeList.append(['ErrorNumber', PcdError.GetErrorNumber()])
+ for Item in PcdError.GetErrorMessageList():
+ Element = \
+ CreateXmlElement('ErrorMessage', Item[1], [], [['Lang', Item[0]]])
+ NodeList.append(Element)
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+
+ def TransferValidRange2Expr(self, TokenSpaceGuidCName, CName, ValidRange):
+ if self.Expression:
+ pass
+ INT_RANGE_PATTERN1 = '[\t\s]*[0-9]+[\t\s]*-[\t\s]*[0-9]+'
+ INT_RANGE_PATTERN2 = '[\t\s]*(LT|GT|LE|GE|XOR|EQ)[\t\s]+\d+[\t\s]*'
+ HEX_RANGE_PATTERN1 = \
+ '[\t\s]*0[xX][a-fA-F0-9]+[\t\s]*-[\t\s]*0[xX][a-fA-F0-9]+'
+ HEX_RANGE_PATTERN2 = '[\t\s]*(LT|GT|LE|GE|XOR|EQ)[\t\s]+0[xX][a-fA-F0-9]+[\t\s]*'
+ IntMatch1 = re.compile(INT_RANGE_PATTERN1)
+ IntMatch2 = re.compile(INT_RANGE_PATTERN2)
+ HexMatch1 = re.compile(HEX_RANGE_PATTERN1)
+ HexMatch2 = re.compile(HEX_RANGE_PATTERN2)
+ PcdName = '.'.join([TokenSpaceGuidCName, CName])
+ HexMatchedList = []
+ IntMatchedList = []
+ #
+ # Convert HEX2 format range
+ #
+ if HexMatch2:
+ for MatchObj in HexMatch2.finditer(ValidRange):
+ MatchStr = MatchObj.group()
+ TransferedRangeStr = ' '.join(['', PcdName, MatchStr.strip()])
+ ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
+ #
+ # Convert INT2 format range
+ #
+ if IntMatch2:
+ for MatchObj in IntMatch2.finditer(ValidRange):
+ MatchStr = MatchObj.group()
+ TransferedRangeStr = ' '.join(['', PcdName, MatchStr.strip()])
+ ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
+ #
+ # Convert HEX1 format range
+ #
+ if HexMatch1:
+ HexMatchedList += HexMatch1.findall(ValidRange)
+
+ for MatchStr in HexMatchedList:
+ RangeItemList = MatchStr.strip().split('-')
+ TransferedRangeStr = '(%s GE %s) AND (%s LE %s)' % \
+ (PcdName, RangeItemList[0].strip(), PcdName, RangeItemList[1].strip())
+ ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
+ #
+ # Convert INT1 format range
+ #
+ if IntMatch1:
+ IntMatchedList += IntMatch1.findall(ValidRange)
+
+ for MatchStr in IntMatchedList:
+ RangeItemList = MatchStr.strip().split('-')
+ TransferedRangeStr = '(%s GE %s) AND (%s LE %s)' % \
+ (PcdName, RangeItemList[0].strip(), PcdName, RangeItemList[1].strip())
+ ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
+
+ return ValidRange
+
+ def TransferValidEpxr2ValidRange(self, ValidRangeExpr):
+ if self.Expression:
+ pass
+
+ PCD_PATTERN = \
+ '[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*\.[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*'
+ IntPattern1 = \
+ '[\t\s]*\([\t\s]*'+PCD_PATTERN+'[\t\s]+GE[\t\s]+\d+[\t\s]*\)[\t\s]+AND[\t\s]+\([\t\s]*'+\
+ PCD_PATTERN+'[\t\s]+LE[\t\s]+\d+[\t\s]*\)'
+ IntPattern1 = IntPattern1.replace(' ', '')
+ IntPattern2 = '[\t\s]*'+PCD_PATTERN+'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+\d+[\t\s]*'
+
+ HexPattern1 = \
+ '[\t\s]*\([\t\s]*'+PCD_PATTERN+'[\t\s]+GE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)[\t\s]+AND[\t\s]+\([\t\s]*'+\
+ PCD_PATTERN+'[\t\s]+LE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)'
+ HexPattern1 = HexPattern1.replace(' ', '')
+ HexPattern2 = '[\t\s]*'+PCD_PATTERN+'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+0[xX][0-9a-zA-Z]+[\t\s]*'
+
+ #
+ # Do the Hex1 conversion
+ #
+ HexMatchedList = re.compile(HexPattern1).findall(ValidRangeExpr)
+ HexRangeDict = {}
+ for HexMatchedItem in HexMatchedList:
+ #
+ # To match items on both sides of '-'
+ #
+ RangeItemList = re.compile('[\t\s]*0[xX][0-9a-fA-F]+[\t\s]*').findall(HexMatchedItem)
+ if RangeItemList and len(RangeItemList) == 2:
+ HexRangeDict[HexMatchedItem] = RangeItemList
+
+ for Key in HexRangeDict.keys():
+ MaxItem = MixItem = ''
+ if int(HexRangeDict[Key][0], 16) > int(HexRangeDict[Key][1], 16):
+ MaxItem = HexRangeDict[Key][0]
+ MixItem = HexRangeDict[Key][1]
+ else:
+ MaxItem = HexRangeDict[Key][1]
+ MixItem = HexRangeDict[Key][0]
+
+ Range = ' %s - %s' % (MixItem.strip(), MaxItem.strip())
+ ValidRangeExpr = ValidRangeExpr.replace(Key, Range)
+ #
+ # Do the INT1 conversion
+ #
+ IntRangeDict = {}
+ IntMatchList = re.compile(IntPattern1).findall(ValidRangeExpr)
+ for MatchedItem in IntMatchList:
+ #
+ # To match items on both sides of '-'
+ #
+ RangeItemList = re.compile('[\t\s]*\d+[\t\s]*').findall(MatchedItem)
+ if RangeItemList and len(RangeItemList) == 2:
+ IntRangeDict[MatchedItem] = RangeItemList
+
+ for Key in IntRangeDict.keys():
+ MaxItem = MixItem = ''
+ if int(IntRangeDict[Key][0]) > int(IntRangeDict[Key][1]):
+ MaxItem = IntRangeDict[Key][0]
+ MixItem = IntRangeDict[Key][1]
+ else:
+ MaxItem = IntRangeDict[Key][1]
+ MixItem = IntRangeDict[Key][0]
+
+ Range = ' %s - %s' % (MixItem.strip(), MaxItem.strip())
+ ValidRangeExpr = ValidRangeExpr.replace(Key, Range)
+ #
+ # Do the HEX2 conversion
+ #
+ for MatchObj in re.compile(HexPattern2).finditer(ValidRangeExpr):
+ MatchStr = MatchObj.group()
+ Range = re.compile(PCD_PATTERN).sub(' ', MatchStr)
+ ValidRangeExpr = ValidRangeExpr.replace(MatchStr, Range)
+ #
+ # Do the INT2 conversion
+ #
+ for MatchObj in re.compile(IntPattern2).finditer(ValidRangeExpr):
+ MatchStr = MatchObj.group()
+ Range = re.compile(PCD_PATTERN).sub(' ', MatchStr)
+ ValidRangeExpr = ValidRangeExpr.replace(MatchStr, Range)
+
+ return ValidRangeExpr
+
+
+
+ def __str__(self):
+ return "ValidValueList = %s ValidValueListLang = %s ValidValueRange \
+ = %s Expression = %s ErrorNumber = %s %s" % \
+ (self.ValidValueList, self.ValidValueListLang, self.ValidValueRange, \
+ self.Expression, self.ErrorNumber, self.ErrorMessage)
+
+##
+# PcdEntryXml
+#
+class PcdEntryXml(object):
+ def __init__(self):
+ self.PcdItemType = ''
+ self.PcdUsage = ''
+ self.TokenSpaceGuidCName = ''
+ self.TokenSpaceGuidValue = ''
+ self.Token = ''
+ self.CName = ''
+ self.PcdCName = ''
+ self.DatumType = ''
+ self.ValidUsage = ''
+ self.DefaultValue = ''
+ self.MaxDatumSize = ''
+ self.Value = ''
+ self.Offset = ''
+ self.CommonDefines = CommonDefinesXml()
+ self.Prompt = []
+ self.HelpText = []
+ self.PcdError = []
+
+ ##
+ # AsBuilt will use FromXml
+ #
+ def FromXml(self, Item, Key):
+ self.PcdItemType = \
+ XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdItemType')
+ self.PcdUsage = XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdUsage')
+ self.TokenSpaceGuidCName = \
+ XmlElement(Item, '%s/TokenSpaceGuidCname' % Key)
+ self.TokenSpaceGuidValue = \
+ XmlElement(Item, '%s/TokenSpaceGuidValue' % Key)
+ self.Token = XmlElement(Item, '%s/Token' % Key)
+ self.CName = XmlElement(Item, '%s/CName' % Key)
+ self.PcdCName = XmlElement(Item, '%s/PcdCName' % Key)
+ self.DatumType = XmlElement(Item, '%s/DatumType' % Key)
+ self.ValidUsage = XmlElement(Item, '%s/ValidUsage' % Key)
+ if not GlobalData.gIS_BINARY_INF:
+ self.DefaultValue = XmlElement(Item, '%s/DefaultValue' % Key)
+ else:
+ self.DefaultValue = XmlElement(Item, '%s/Value' % Key)
+ self.MaxDatumSize = XmlElement(Item, '%s/MaxDatumSize' % Key)
+ self.Value = XmlElement(Item, '%s/Value' % Key)
+ self.Offset = XmlElement(Item, '%s/Offset' % Key)
+ self.CommonDefines.FromXml(XmlNode(Item, '%s' % Key), Key)
+
+ for HelpTextItem in XmlList(Item, '%s/HelpText' % Key):
+ HelpTextObj = HelpTextXml()
+ HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key)
+ self.HelpText.append(HelpTextObj)
+ for PcdErrorItem in XmlList(Item, '%s/PcdError' % Key):
+ PcdErrorObjXml = PcdErrorXml()
+ PcdErrorObj = PcdErrorObjXml.FromXml(PcdErrorItem, 'PcdError')
+ self.PcdError.append(PcdErrorObj)
+
+ self.DefaultValue = ConvertNOTEQToNE(self.DefaultValue)
+
+ PcdEntry = PcdObject()
+ PcdEntry.SetSupArchList(self.CommonDefines.SupArchList)
+ PcdEntry.SetTokenSpaceGuidCName(self.TokenSpaceGuidCName)
+ PcdEntry.SetTokenSpaceGuidValue(self.TokenSpaceGuidValue)
+ PcdEntry.SetToken(self.Token)
+ PcdEntry.SetOffset(self.Offset)
+ PcdEntry.SetCName(self.CName)
+ PcdEntry.SetPcdCName(self.PcdCName)
+ PcdEntry.SetDatumType(self.DatumType)
+ PcdEntry.SetValidUsage(self.ValidUsage)
+ PcdEntry.SetDefaultValue(self.DefaultValue)
+ PcdEntry.SetMaxDatumSize(self.MaxDatumSize)
+ PcdEntry.SetFeatureFlag(ConvertNOTEQToNE(self.CommonDefines.FeatureFlag))
+ PcdEntry.SetItemType(self.PcdItemType)
+
+ PcdEntry.SetHelpTextList(GetHelpTextList(self.HelpText))
+ PcdEntry.SetPcdErrorsList(self.PcdError)
+
+ return PcdEntry
+ ##
+ # Package will use FromXml2
+ #
+ def FromXml2(self, Item, Key):
+ self.TokenSpaceGuidCName = \
+ XmlElement(Item, '%s/TokenSpaceGuidCname' % Key)
+ self.Token = XmlElement(Item, '%s/Token' % Key)
+ self.CName = XmlElement(Item, '%s/CName' % Key)
+ self.DatumType = XmlElement(Item, '%s/DatumType' % Key)
+ self.ValidUsage = XmlElement(Item, '%s/ValidUsage' % Key)
+ self.DefaultValue = XmlElement(Item, '%s/DefaultValue' % Key)
+ self.MaxDatumSize = XmlElement(Item, '%s/MaxDatumSize' % Key)
+ self.CommonDefines.FromXml(XmlNode(Item, '%s' % Key), Key)
+ for PromptItem in XmlList(Item, '%s/Prompt' % Key):
+ PromptObj = PromptXml()
+ PromptObj.FromXml(PromptItem, '%s/Prompt' % Key)
+ self.Prompt.append(PromptObj)
+ for HelpTextItem in XmlList(Item, '%s/HelpText' % Key):
+ HelpTextObj = HelpTextXml()
+ HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key)
+ self.HelpText.append(HelpTextObj)
+ for PcdErrorItem in XmlList(Item, '%s/PcdError' % Key):
+ PcdErrorObjXml = PcdErrorXml()
+ PcdErrorObj = PcdErrorObjXml.FromXml(PcdErrorItem, 'PcdError')
+ self.PcdError.append(PcdErrorObj)
+
+ self.DefaultValue = ConvertNOTEQToNE(self.DefaultValue)
+
+ PcdEntry = PcdObject()
+ PcdEntry.SetSupArchList(self.CommonDefines.SupArchList)
+ PcdEntry.SetSupModuleList(self.CommonDefines.SupModList)
+ PcdEntry.SetTokenSpaceGuidCName(self.TokenSpaceGuidCName)
+ PcdEntry.SetToken(self.Token)
+ PcdEntry.SetCName(self.CName)
+ PcdEntry.SetDatumType(self.DatumType)
+ PcdEntry.SetValidUsage(self.ValidUsage)
+ PcdEntry.SetDefaultValue(self.DefaultValue)
+ PcdEntry.SetMaxDatumSize(self.MaxDatumSize)
+ PcdEntry.SetFeatureFlag(ConvertNOTEQToNE(self.CommonDefines.FeatureFlag))
+
+ PcdEntry.SetPromptList(GetPromptList(self.Prompt))
+ PcdEntry.SetHelpTextList(GetHelpTextList(self.HelpText))
+ PcdEntry.SetPcdErrorsList(self.PcdError)
+
+ return PcdEntry
+
+ ##
+ # Module will use FromXml3
+ #
+ def FromXml3(self, Item, Key):
+ self.PcdItemType = \
+ XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdItemType')
+ self.PcdUsage = XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdUsage')
+ self.TokenSpaceGuidCName = \
+ XmlElement(Item, '%s/TokenSpaceGuidCName' % Key)
+ self.CName = XmlElement(Item, '%s/CName' % Key)
+ self.DefaultValue = XmlElement(Item, '%s/DefaultValue' % Key)
+ self.CommonDefines.FromXml(XmlNode(Item, '%s' % Key), Key)
+ for HelpTextItem in XmlList(Item, '%s/HelpText' % Key):
+ HelpTextObj = HelpTextXml()
+ HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key)
+ self.HelpText.append(HelpTextObj)
+ for PcdErrorItem in XmlList(Item, '%s/PcdError' % Key):
+ PcdErrorObj = PcdErrorXml()
+ PcdErrorObj.FromXml(PcdErrorItem, 'PcdError')
+ self.PcdError.append(PcdErrorObj)
+
+ self.DefaultValue = ConvertNOTEQToNE(self.DefaultValue)
+
+ PcdEntry = PcdObject()
+ PcdEntry.SetSupArchList(self.CommonDefines.SupArchList)
+ PcdEntry.SetTokenSpaceGuidCName(self.TokenSpaceGuidCName)
+ PcdEntry.SetCName(self.CName)
+ PcdEntry.SetValidUsage(self.PcdUsage)
+ PcdEntry.SetDefaultValue(self.DefaultValue)
+ PcdEntry.SetFeatureFlag(ConvertNOTEQToNE(self.CommonDefines.FeatureFlag))
+ PcdEntry.SetItemType(self.PcdItemType)
+
+ PcdEntry.SetHelpTextList(GetHelpTextList(self.HelpText))
+ PcdEntry.SetPcdErrorsList(self.PcdError)
+
+ return PcdEntry
+
+ def ToXml(self, PcdEntry, Key):
+ if self.PcdCName:
+ pass
+
+ DefaultValue = ConvertNEToNOTEQ(PcdEntry.GetDefaultValue())
+
+ AttributeList = \
+ [['SupArchList', GetStringOfList(PcdEntry.GetSupArchList())], \
+ ['PcdUsage', PcdEntry.GetValidUsage()], \
+ ['PcdItemType', PcdEntry.GetItemType()], \
+ ['FeatureFlag', PcdEntry.GetFeatureFlag()],
+ ]
+ NodeList = [['TokenSpaceGuidCname', PcdEntry.GetTokenSpaceGuidCName()],
+ ['TokenSpaceGuidValue', PcdEntry.GetTokenSpaceGuidValue()],
+ ['Token', PcdEntry.GetToken()],
+ ['CName', PcdEntry.GetCName()],
+ ['DatumType', PcdEntry.GetDatumType()],
+ ['ValidUsage', GetStringOfList(PcdEntry.GetValidUsage())],
+ ['DefaultValue', DefaultValue],
+ ['MaxDatumSize', PcdEntry.GetMaxDatumSize()],
+ ['Offset', PcdEntry.GetOffset()],
+ ]
+
+ for Item in PcdEntry.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item))
+ for Item in PcdEntry.GetPcdErrorsList():
+ Tmp = PcdErrorXml()
+ NodeList.append(Tmp.ToXml(Item, 'PcdError'))
+
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+ ##
+ # Package will use ToXml2
+ #
+ def ToXml2(self, PcdEntry, Key):
+ if self.PcdCName:
+ pass
+
+ DefaultValue = ConvertNEToNOTEQ(PcdEntry.GetDefaultValue())
+
+ AttributeList = \
+ [['SupArchList', GetStringOfList(PcdEntry.GetSupArchList())], \
+ ['SupModList', GetStringOfList(PcdEntry.GetSupModuleList())]
+ ]
+ NodeList = [['TokenSpaceGuidCname', PcdEntry.GetTokenSpaceGuidCName()],
+ ['Token', PcdEntry.GetToken()],
+ ['CName', PcdEntry.GetCName()],
+ ['DatumType', PcdEntry.GetDatumType()],
+ ['ValidUsage', GetStringOfList(PcdEntry.GetValidUsage())],
+ ['DefaultValue', DefaultValue],
+ ['MaxDatumSize', PcdEntry.GetMaxDatumSize()],
+ ]
+ for Item in PcdEntry.GetPromptList():
+ Tmp = PromptXml()
+ NodeList.append(Tmp.ToXml(Item))
+
+ for Item in PcdEntry.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item))
+
+ for Item in PcdEntry.GetPcdErrorsList():
+ Tmp = PcdErrorXml()
+ NodeList.append(Tmp.ToXml(Item, 'PcdError'))
+
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+ ##
+ # Module will use ToXml3
+ #
+ def ToXml3(self, PcdEntry, Key):
+ if self.PcdCName:
+ pass
+
+ DefaultValue = ConvertNEToNOTEQ(PcdEntry.GetDefaultValue())
+
+ AttributeList = \
+ [['SupArchList', GetStringOfList(PcdEntry.GetSupArchList())], \
+ ['PcdUsage', PcdEntry.GetValidUsage()], \
+ ['PcdItemType', PcdEntry.GetItemType()], \
+ ['FeatureFlag', ConvertNEToNOTEQ(PcdEntry.GetFeatureFlag())],
+ ]
+ NodeList = [['CName', PcdEntry.GetCName()],
+ ['TokenSpaceGuidCName', PcdEntry.GetTokenSpaceGuidCName()],
+ ['DefaultValue', DefaultValue],
+ ]
+
+ for Item in PcdEntry.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item))
+ for Item in PcdEntry.GetPcdErrorsList():
+ Tmp = PcdErrorXml()
+ NodeList.append(Tmp.ToXml(Item, 'PcdError'))
+
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+
+ ##
+ # AsBuild Module will use ToXml4
+ #
+ def ToXml4(self, PcdEntry, Key):
+ if self.PcdCName:
+ pass
+
+ DefaultValue = ConvertNEToNOTEQ(PcdEntry.GetDefaultValue())
+
+ AttributeList = []
+
+ NodeList = [
+ ['TokenSpaceGuidValue', PcdEntry.GetTokenSpaceGuidValue()],
+ ['PcdCName', PcdEntry.GetCName()],
+ ['Token', PcdEntry.GetToken()],
+ ['DatumType', PcdEntry.GetDatumType()],
+ ['MaxDatumSize', PcdEntry.GetMaxDatumSize()],
+ ['Value', DefaultValue],
+ ['Offset', PcdEntry.GetOffset()]
+ ]
+
+ for Item in PcdEntry.GetHelpTextList():
+ Tmp = HelpTextXml()
+ NodeList.append(Tmp.ToXml(Item))
+ for Item in PcdEntry.GetPcdErrorsList():
+ Tmp = PcdErrorXml()
+ NodeList.append(Tmp.ToXml(Item, 'PcdError'))
+
+ Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
+
+ return Root
+
+
+ def __str__(self):
+ Str = \
+ ('PcdItemType = %s PcdUsage = %s TokenSpaceGuidCName = %s \
+ TokenSpaceGuidValue = %s Token = %s CName = %s PcdCName = %s \
+ DatumType = %s ValidUsage = %s DefaultValue = %s MaxDatumSize = %s \
+ Value = %s Offset = %s %s') % \
+ (self.PcdItemType, self.PcdUsage, self.TokenSpaceGuidCName, \
+ self.TokenSpaceGuidValue, self.Token, self.CName, self.PcdCName, \
+ self.DatumType, self.ValidUsage, self.DefaultValue, \
+ self.MaxDatumSize, self.Value, self.Offset, self.CommonDefines)
+ for Item in self.HelpText:
+ Str = Str + "\n\t" + str(Item)
+ for Item in self.PcdError:
+ Str = Str + "\n\tPcdError:" + str(Item)
+ return Str
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Xml/XmlParser.py b/roms/edk2/BaseTools/Source/Python/UPT/Xml/XmlParser.py
new file mode 100644
index 000000000..8e22a280f
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Xml/XmlParser.py
@@ -0,0 +1,926 @@
+## @file
+# This file is used to parse a xml file of .PKG file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+XmlParser
+'''
+
+##
+# Import Modules
+#
+import re
+
+from Library.Xml.XmlRoutines import XmlNode
+from Library.Xml.XmlRoutines import CreateXmlElement
+from Library.Xml.XmlRoutines import XmlList
+from Library.Xml.XmlRoutines import XmlParseFile
+from Core.DistributionPackageClass import DistributionPackageClass
+from Object.POM.ModuleObject import DepexObject
+from Library.ParserValidate import IsValidInfMoudleType
+from Library.ParserValidate import IsValidInstallPath
+from Library.Misc import IsEqualList
+from Library.Misc import Sdict
+
+from Logger.StringTable import ERR_XML_INVALID_VARIABLENAME
+from Logger.StringTable import ERR_XML_INVALID_LIB_SUPMODLIST
+from Logger.StringTable import ERR_XML_INVALID_EXTERN_SUPARCHLIST
+from Logger.StringTable import ERR_XML_INVALID_EXTERN_SUPMODLIST
+from Logger.StringTable import ERR_XML_INVALID_EXTERN_SUPMODLIST_NOT_LIB
+from Logger.StringTable import ERR_FILE_NAME_INVALIDE
+from Logger.ToolError import PARSER_ERROR
+from Logger.ToolError import FORMAT_INVALID
+
+from Xml.CommonXml import DistributionPackageHeaderXml
+from Xml.CommonXml import MiscellaneousFileXml
+from Xml.CommonXml import UserExtensionsXml
+from Xml.XmlParserMisc import ConvertVariableName
+from Xml.XmlParserMisc import IsRequiredItemListNull
+from Xml.ModuleSurfaceAreaXml import ModuleSurfaceAreaXml
+from Xml.PackageSurfaceAreaXml import PackageSurfaceAreaXml
+
+import Logger.Log as Logger
+
+##
+# DistributionPackageXml
+#
+class DistributionPackageXml(object):
+ def __init__(self):
+ self.DistP = DistributionPackageClass()
+ self.Pkg = ''
+
+ ## ValidateDistributionPackage
+ #
+ # Check if any required item is missing in DistributionPackage
+ #
+ def ValidateDistributionPackage(self):
+ XmlTreeLevel = ['DistributionPackage']
+ if self.DistP:
+ #
+ # Check DistributionPackage -> DistributionHeader
+ #
+ XmlTreeLevel = ['DistributionPackage', '']
+ CheckDict = {'DistributionHeader':self.DistP.Header }
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ if self.DistP.Header:
+ DpHeader = self.DistP.Header
+ XmlTreeLevel = ['DistributionPackage', 'DistributionHeader']
+ CheckDict = Sdict()
+ if DpHeader.GetAbstract():
+ DPAbstract = DpHeader.GetAbstract()[0][1]
+ else:
+ DPAbstract = ''
+ if DpHeader.GetCopyright():
+ DPCopyright = DpHeader.GetCopyright()[0][1]
+ else:
+ DPCopyright = ''
+ if DpHeader.GetLicense():
+ DPLicense = DpHeader.GetLicense()[0][1]
+ else:
+ DPLicense = ''
+
+ CheckDict['Name'] = DpHeader.GetName()
+ CheckDict['GUID'] = DpHeader.GetGuid()
+ CheckDict['Version'] = DpHeader.GetVersion()
+ CheckDict['Copyright'] = DPCopyright
+ CheckDict['License'] = DPLicense
+ CheckDict['Abstract'] = DPAbstract
+ CheckDict['Vendor'] = DpHeader.GetVendor()
+ CheckDict['Date'] = DpHeader.GetDate()
+ CheckDict['XmlSpecification'] = DpHeader.GetXmlSpecification()
+
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ else:
+ XmlTreeLevel = ['DistributionPackage', 'DistributionHeader']
+ CheckDict = CheckDict = {'DistributionHeader': '', }
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check Each Package
+ #
+ for Key in self.DistP.PackageSurfaceArea:
+ ValidatePackageSurfaceArea(self.DistP.PackageSurfaceArea[Key])
+
+ #
+ # Check Each Module
+ #
+ for Key in self.DistP.ModuleSurfaceArea:
+ ValidateMS(self.DistP.ModuleSurfaceArea[Key], ['DistributionPackage', 'ModuleSurfaceArea'])
+
+ #
+ # Check Each Tool
+ #
+ if self.DistP.Tools:
+ XmlTreeLevel = ['DistributionPackage', 'Tools', 'Header']
+ CheckDict = {'Name': self.DistP.Tools.GetName(), }
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ if not self.DistP.Tools.GetFileList():
+ XmlTreeLevel = ['DistributionPackage', 'Tools']
+ CheckDict = {'FileName': None, }
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ for Item in self.DistP.Tools.GetFileList():
+ XmlTreeLevel = ['DistributionPackage', 'Tools']
+ CheckDict = {'FileName': Item.GetURI(), }
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check Each Misc File
+ #
+ if self.DistP.MiscellaneousFiles:
+ XmlTreeLevel = ['DistributionPackage', 'MiscellaneousFiles', 'Header']
+ CheckDict = {'Name': self.DistP.MiscellaneousFiles.GetName(), }
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ if not self.DistP.MiscellaneousFiles.GetFileList():
+ XmlTreeLevel = ['DistributionPackage', 'MiscellaneousFiles']
+ CheckDict = {'FileName': None, }
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ for Item in self.DistP.MiscellaneousFiles.GetFileList():
+ XmlTreeLevel = ['DistributionPackage', 'MiscellaneousFiles']
+ CheckDict = {'FileName': Item.GetURI(), }
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check Each Distribution Level User Extension
+ #
+ for Item in self.DistP.UserExtensions:
+ XmlTreeLevel = ['DistributionPackage', 'UserExtensions']
+ CheckDict = {'UserId': Item.GetUserID(), }
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+
+ def FromXml(self, Filename=None):
+ if Filename is not None:
+ self.DistP = DistributionPackageClass()
+ #
+ # Load to XML
+ #
+ self.Pkg = XmlParseFile(Filename)
+
+ #
+ # Parse Header information
+ #
+ Tmp = DistributionPackageHeaderXml()
+ DistributionPackageHeader = \
+ Tmp.FromXml(XmlNode(self.Pkg, '/DistributionPackage/DistributionHeader'), 'DistributionHeader')
+ self.DistP.Header = DistributionPackageHeader
+ #
+ # Parse each PackageSurfaceArea
+ #
+ for Item in XmlList(self.Pkg, '/DistributionPackage/PackageSurfaceArea'):
+ Psa = PackageSurfaceAreaXml()
+ Package = Psa.FromXml(Item, 'PackageSurfaceArea')
+ self.DistP.PackageSurfaceArea[(Package.GetGuid(), \
+ Package.GetVersion(), \
+ Package.GetPackagePath())] = \
+ Package
+ #
+ # Parse each ModuleSurfaceArea
+ #
+ for Item in XmlList(self.Pkg, '/DistributionPackage/ModuleSurfaceArea'):
+ Msa = ModuleSurfaceAreaXml()
+ Module = Msa.FromXml(Item, 'ModuleSurfaceArea', True)
+ ModuleKey = (Module.GetGuid(), Module.GetVersion(), Module.GetName(), Module.GetModulePath())
+ self.DistP.ModuleSurfaceArea[ModuleKey] = Module
+
+ #
+ # Parse Tools
+ #
+ Tmp = MiscellaneousFileXml()
+ self.DistP.Tools = Tmp.FromXml2(XmlNode(self.Pkg, '/DistributionPackage/Tools'), 'Tools')
+
+ #
+ # Parse MiscFiles
+ #
+ Tmp = MiscellaneousFileXml()
+ self.DistP.MiscellaneousFiles = \
+ Tmp.FromXml2(XmlNode(self.Pkg, \
+ '/DistributionPackage/MiscellaneousFiles'), \
+ 'MiscellaneousFiles')
+
+ #
+ # Parse UserExtensions
+ #
+ for Item in XmlList(self.Pkg, '/DistributionPackage/UserExtensions'):
+ Tmp = UserExtensionsXml()
+ self.DistP.UserExtensions.append(Tmp.FromXml2(Item, 'UserExtensions'))
+
+ #
+ # Check Required Items for XML
+ #
+ self.ValidateDistributionPackage()
+
+ return self.DistP
+
+ def ToXml(self, DistP):
+ if self.DistP:
+ pass
+ if DistP is not None:
+ #
+ # Parse DistributionPackageHeader
+ #
+ Attrs = [['xmlns', 'http://www.uefi.org/2011/1.1'],
+ ['xmlns:xsi', 'http:/www.w3.org/2001/XMLSchema-instance'],
+ ]
+ Root = CreateXmlElement('DistributionPackage', '', [], Attrs)
+
+ Tmp = DistributionPackageHeaderXml()
+ Root.appendChild(Tmp.ToXml(DistP.Header, 'DistributionHeader'))
+ #
+ # Parse each PackageSurfaceArea
+ #
+ for Package in DistP.PackageSurfaceArea.values():
+ Psa = PackageSurfaceAreaXml()
+ DomPackage = Psa.ToXml(Package)
+ Root.appendChild(DomPackage)
+ #
+ # Parse each ModuleSurfaceArea
+ #
+ for Module in DistP.ModuleSurfaceArea.values():
+ Msa = ModuleSurfaceAreaXml()
+ DomModule = Msa.ToXml(Module)
+ Root.appendChild(DomModule)
+ #
+ # Parse Tools
+ #
+ Tmp = MiscellaneousFileXml()
+ ToolNode = Tmp.ToXml2(DistP.Tools, 'Tools')
+ if ToolNode is not None:
+ Root.appendChild(ToolNode)
+ #
+ # Parse MiscFiles
+ #
+ Tmp = MiscellaneousFileXml()
+ MiscFileNode = Tmp.ToXml2(DistP.MiscellaneousFiles,
+ 'MiscellaneousFiles')
+ if MiscFileNode is not None:
+ Root.appendChild(MiscFileNode)
+
+ XmlContent = Root.toprettyxml(indent=' ')
+
+
+ #
+ # Remove empty element
+ #
+ XmlContent = re.sub(r'[\s\r\n]*<[^<>=]*/>', '', XmlContent)
+
+ #
+ # Remove empty help text element
+ #
+ XmlContent = re.sub(r'[\s\r\n]*<HelpText Lang="en-US"/>', '',
+ XmlContent)
+
+ #
+ # Remove SupArchList="COMMON" or "common"
+ #
+ XmlContent = \
+ re.sub(r'[\s\r\n]*SupArchList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*COMMON'
+ '[\s\r\n]*"', '', XmlContent)
+ XmlContent = \
+ re.sub(r'[\s\r\n]*SupArchList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*common'
+ '[\s\r\n]*"', '', XmlContent)
+ #
+ # Remove <SupArchList> COMMON </SupArchList>
+ #
+ XmlContent = \
+ re.sub(r'[\s\r\n]*<SupArchList>[\s\r\n]*COMMON[\s\r\n]*'
+ '</SupArchList>[\s\r\n]*', '', XmlContent)
+
+ #
+ # Remove <SupArchList> common </SupArchList>
+ #
+ XmlContent = \
+ re.sub(r'[\s\r\n]*<SupArchList>[\s\r\n]*'
+ 'common[\s\r\n]*</SupArchList>[\s\r\n]*', '', XmlContent)
+
+ #
+ # Remove SupModList="COMMON" or "common"
+ #
+ XmlContent = \
+ re.sub(r'[\s\r\n]*SupModList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*COMMON'
+ '[\s\r\n]*"', '', XmlContent)
+ XmlContent = \
+ re.sub(r'[\s\r\n]*SupModList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*common'
+ '[\s\r\n]*"', '', XmlContent)
+
+ return XmlContent
+
+ return ''
+
+## ValidateMS
+#
+# Check if any required item is missing in ModuleSurfaceArea
+#
+# @param Module: The ModuleSurfaceArea to be checked
+# @param XmlTreeLevel: The top level of Module
+#
+def ValidateMS(Module, TopXmlTreeLevel):
+ ValidateMS1(Module, TopXmlTreeLevel)
+ ValidateMS2(Module, TopXmlTreeLevel)
+ ValidateMS3(Module, TopXmlTreeLevel)
+
+## ValidateMS1
+#
+# Check if any required item is missing in ModuleSurfaceArea
+#
+# @param Module: The ModuleSurfaceArea to be checked
+# @param XmlTreeLevel: The top level of Module
+#
+def ValidateMS1(Module, TopXmlTreeLevel):
+ #
+ # Check Guids -> GuidCName
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['Guids']
+ for Item in Module.GetGuidList():
+ if Item is None:
+ CheckDict = {'GuidCName':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = TopXmlTreeLevel + ['Guids', 'GuidCName']
+ for Item in Module.GetGuidList():
+ CheckDict = {'CName':Item.GetCName(),
+ 'GuidType':Item.GetGuidTypeList(),
+ 'Usage':Item.GetUsage()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ if Item.GetVariableName():
+ Result = ConvertVariableName(Item.GetVariableName())
+ if Result is None:
+ Msg = "->".join(Node for Node in XmlTreeLevel)
+ ErrorMsg = ERR_XML_INVALID_VARIABLENAME % (Item.GetVariableName(), Item.GetCName(), Msg)
+ Logger.Error('\nUPT', PARSER_ERROR, ErrorMsg, RaiseError=True)
+ else:
+ Item.SetVariableName(Result)
+
+ #
+ # Check Protocols -> Protocol
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['Protocols']
+ for Item in Module.GetProtocolList():
+ if Item is None:
+ CheckDict = {'Protocol':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = TopXmlTreeLevel + ['Protocols', 'Protocol']
+ for Item in Module.GetProtocolList():
+ CheckDict = {'CName':Item.GetCName(),
+ 'Usage':Item.GetUsage()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check PPIs -> Ppi
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['PPIs']
+ for Item in Module.GetPpiList():
+ if Item is None:
+ CheckDict = {'Ppi':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = TopXmlTreeLevel + ['PPIs', 'Ppi']
+ for Item in Module.GetPpiList():
+ CheckDict = {'CName':Item.GetCName(),
+ 'Usage':Item.GetUsage()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check PcdCoded -> Entry
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['PcdCoded']
+ for Item in Module.GetPcdList():
+ if Item is None:
+ CheckDict = {'PcdEntry':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = TopXmlTreeLevel + ['PcdCoded', 'PcdEntry']
+ for Item in Module.GetPcdList():
+ CheckDict = {'TokenSpaceGuidCname':Item.GetTokenSpaceGuidCName(),
+ 'CName':Item.GetCName(),
+ 'PcdUsage':Item.GetValidUsage(),
+ 'PcdItemType':Item.GetItemType()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check Externs -> Extern
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['Externs']
+ for Item in Module.GetExternList():
+ if Item is None:
+ CheckDict = {'Extern':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # If SupArchList is used to identify different EntryPoint, UnloadImage, Constructor/Destructor elements and
+ # that SupArchList does not match ModuleSurfaceArea.ModuleProperties:SupArchList, the tool must exit gracefully,
+ # informing the user that the EDK II Build system does not support different EntryPoint, UnloadImage,
+ # Constructor or Destructor elements based on Architecture type. Two SupArchList attributes are considered
+ # identical if it lists the same CPU architectures in any order.
+ #
+ for Item in Module.GetExternList():
+ if len(Item.SupArchList) > 0:
+ if not IsEqualList(Item.SupArchList, Module.SupArchList):
+ Logger.Error('\nUPT',
+ PARSER_ERROR,
+ ERR_XML_INVALID_EXTERN_SUPARCHLIST % (str(Item.SupArchList), str(Module.SupArchList)),
+ RaiseError=True)
+
+ #
+ # Check DistributionPackage -> ModuleSurfaceArea -> UserExtensions
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['UserExtensions']
+ for Item in Module.GetUserExtensionList():
+ CheckDict = {'UserId':Item.GetUserID(), 'Identifier':Item.GetIdentifier()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check DistributionPackage -> PackageSurfaceArea -> MiscellaneousFiles -> Filename
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['MiscellaneousFiles']
+ for Item in Module.GetMiscFileList():
+ if not Item.GetFileList():
+ CheckDict = {'Filename': '', }
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ for File in Item.GetFileList():
+ CheckDict = {'Filename': File.GetURI(), }
+
+## ValidateMS2
+#
+# Check if any required item is missing in ModuleSurfaceArea
+#
+# @param Module: The ModuleSurfaceArea to be checked
+# @param XmlTreeLevel: The top level of Module
+#
+def ValidateMS2(Module, TopXmlTreeLevel):
+ #
+ # Check Header
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['Header']
+ CheckDict = Sdict()
+ CheckDict['Name'] = Module.GetName()
+ CheckDict['BaseName'] = Module.GetBaseName()
+ CheckDict['GUID'] = Module.GetGuid()
+ CheckDict['Version'] = Module.GetVersion()
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check ModuleProperties
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['ModuleProperties']
+ CheckDict = {'ModuleType':Module.GetModuleType(),
+ 'Path':Module.GetModulePath()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ if not IsValidInstallPath(Module.GetModulePath()):
+ Logger.Error("UPT", FORMAT_INVALID, ERR_FILE_NAME_INVALIDE % Module.GetModulePath())
+
+ #
+ # Check ModuleProperties->BootMode
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['ModuleProperties'] + ['BootMode']
+ for Item in Module.GetBootModeList():
+ CheckDict = {'Usage':Item.GetUsage(),
+ 'SupportedBootModes':Item.GetSupportedBootModes()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check ModuleProperties->Event
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['ModuleProperties'] + ['Event']
+ for Item in Module.GetEventList():
+ CheckDict = {'Usage':Item.GetUsage(),
+ 'EventType':Item.GetEventType()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check ModuleProperties->Hob
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['ModuleProperties'] + ['HOB']
+ for Item in Module.GetHobList():
+ CheckDict = {'Usage':Item.GetUsage(),
+ 'HobType':Item.GetHobType()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # The UDP Specification supports the module type of UEFI_RUNTIME_DRIVER, which is not present in the EDK II INF
+ # File Specification v. 1.23, so UPT must perform the following translation that include the generation of a
+ # [Depex] section.
+ #
+ if Module.ModuleType == "UEFI_RUNTIME_DRIVER":
+ Module.ModuleType = "DXE_RUNTIME_DRIVER"
+ DxeObj = DepexObject()
+ DxeObj.SetDepex("gEfiBdsArchProtocolGuid AND \ngEfiCpuArchProtocolGuid AND\n" + \
+ "gEfiMetronomeArchProtocolGuid AND \ngEfiMonotonicCounterArchProtocolGuid AND\n" + \
+ "gEfiRealTimeClockArchProtocolGuid AND \ngEfiResetArchProtocolGuid AND\n" + \
+ "gEfiRuntimeArchProtocolGuid AND \ngEfiSecurityArchProtocolGuid AND\n" + \
+ "gEfiTimerArchProtocolGuid AND \ngEfiVariableWriteArchProtocolGuid AND\n" + \
+ "gEfiVariableArchProtocolGuid AND \ngEfiWatchdogTimerArchProtocolGuid")
+ DxeObj.SetModuleType(['DXE_RUNTIME_DRIVER'])
+ Module.PeiDepex = []
+ Module.DxeDepex = []
+ Module.SmmDepex = []
+ Module.DxeDepex.append(DxeObj)
+
+ #
+ # Check LibraryClassDefinitions -> LibraryClass
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['LibraryClassDefinitions']
+ for Item in Module.GetLibraryClassList():
+ if Item is None:
+ CheckDict = {'LibraryClass':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = TopXmlTreeLevel + ['LibraryClassDefinitions', 'LibraryClass']
+
+ IsLibraryModule = False
+ LibrarySupModList = []
+ for Item in Module.GetLibraryClassList():
+ CheckDict = {'Keyword':Item.GetLibraryClass(),
+ 'Usage':Item.GetUsage()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ #
+ # If the LibraryClass:SupModList is not "UNDEFINED" the LIBRARY_CLASS entry must have the list
+ # appended using the format:
+ # LIBRARY_CLASS = <ClassName> ["|" <Edk2ModuleTypeList>]
+ #
+ # Edk2ModuleTypeList ::= <ModuleType> [" " <ModuleType>]{0,}
+ # <ModuleTypes> ::= {"BASE"} {"SEC"} {"PEI_CORE"} {"PEIM"}
+ # {"DXE_CORE"} {"DXE_DRIVER"} {"SMM_CORE"}
+ # {"DXE_SMM_DRIVER"} {"DXE_RUNTIME_DRIVER"}
+ # {"DXE_SAL_DRIVER"} {"UEFI_DRIVER"}
+ # {"UEFI_APPLICATION"} {"USER_DEFINED"}
+ #
+ if len(Item.SupModuleList) > 0:
+ for SupModule in Item.SupModuleList:
+ if not IsValidInfMoudleType(SupModule):
+ Logger.Error('\nUPT',
+ PARSER_ERROR,
+ ERR_XML_INVALID_LIB_SUPMODLIST % (Item.LibraryClass, str(SupModule)),
+ RaiseError=True)
+
+ if Item.Usage == 'PRODUCES' or Item.Usage == 'SOMETIMES_PRODUCES':
+ IsLibraryModule = True
+ LibrarySupModList = Item.SupModuleList
+
+
+ #
+ # For Library modules (indicated by a LIBRARY_CLASS statement in the [Defines] section)
+ # If the SupModList attribute of the CONSTRUCTOR or DESTRUCTOR element does not match the Supported Module
+ # Types listed after "LIBRARY_CLASS = <Keyword> |", the tool should gracefully exit with an error message
+ # stating that there is a conflict in the module types the CONSTRUCTOR/DESTRUCTOR is to be used with and
+ # the Module types this Library supports.
+ #
+ if IsLibraryModule:
+ for Item in Module.GetExternList():
+ if Item.Constructor or Item.Destructor:
+ if hasattr(Item, 'SupModList') and len(Item.SupModList) > 0 and \
+ not IsEqualList(Item.SupModList, LibrarySupModList):
+ Logger.Error('\nUPT',
+ PARSER_ERROR,
+ ERR_XML_INVALID_EXTERN_SUPMODLIST % (str(Item.SupModList), str(LibrarySupModList)),
+ RaiseError=True)
+
+ #
+ # If the module is not a library module, the MODULE_TYPE listed in the ModuleSurfaceArea.Header must match the
+ # SupModList attribute. If these conditions cannot be met, the tool must exit gracefully, informing the user
+ # that the EDK II Build system does not currently support the features required by this Module.
+ #
+ if not IsLibraryModule:
+ for Item in Module.GetExternList():
+ if hasattr(Item, 'SupModList') and len(Item.SupModList) > 0 and \
+ not IsEqualList(Item.SupModList, [Module.ModuleType]):
+ Logger.Error('\nUPT',
+ PARSER_ERROR,
+ ERR_XML_INVALID_EXTERN_SUPMODLIST_NOT_LIB % (str(Module.ModuleType), str(Item.SupModList)),
+ RaiseError=True)
+ #
+ # Check SourceFiles
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['SourceFiles']
+ for Item in Module.GetSourceFileList():
+ if Item is None:
+ CheckDict = {'Filename':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = TopXmlTreeLevel + ['SourceFiles']
+ for Item in Module.GetSourceFileList():
+ CheckDict = {'Filename':Item.GetSourceFile()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ for ItemCount in range(len(Module.GetBinaryFileList())):
+ Item = Module.GetBinaryFileList()[ItemCount]
+ if Item and len(Item.FileNamList) > 0 and Item.FileNamList[0].FileType == 'FREEFORM':
+ Item.FileNamList[0].FileType = 'SUBTYPE_GUID'
+ Module.GetBinaryFileList()[ItemCount] = Item
+
+## ValidateMS3
+#
+# Check if any required item is missing in ModuleSurfaceArea
+#
+# @param Module: The ModuleSurfaceArea to be checked
+# @param XmlTreeLevel: The top level of Module
+#
+def ValidateMS3(Module, TopXmlTreeLevel):
+ #
+ # Check PackageDependencies -> Package
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['PackageDependencies']
+ for Item in Module.GetPackageDependencyList():
+ if Item is None:
+ CheckDict = {'Package':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = TopXmlTreeLevel + ['PackageDependencies', 'Package']
+ for Item in Module.GetPackageDependencyList():
+ CheckDict = {'GUID':Item.GetGuid()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check BinaryFiles -> BinaryFile
+ #
+ for Item in Module.GetBinaryFileList():
+ if Item is None:
+ XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles']
+ CheckDict = {'BinaryFile':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ if not Item.GetFileNameList():
+ XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles', 'BinaryFile']
+ CheckDict = {'Filename':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles', 'BinaryFile']
+ for File in Item.GetFileNameList():
+ CheckDict = {'Filename':File.GetFilename(),
+ 'FileType':File.GetFileType()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ for AsBuilt in Item.GetAsBuiltList():
+ #
+ # Check LibInstance
+ #
+ if len(AsBuilt.LibraryInstancesList) == 1 and not AsBuilt.LibraryInstancesList[0]:
+ CheckDict = {'GUID':''}
+ XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles', 'BinaryFile', 'AsBuilt', 'LibraryInstances']
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ for LibItem in AsBuilt.LibraryInstancesList:
+ CheckDict = {'Guid':LibItem.Guid,
+ 'Version':LibItem.Version}
+ XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles', 'BinaryFile', 'AsBuilt', 'LibraryInstances']
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check PatchPcd
+ #
+ for PatchPcdItem in AsBuilt.PatchPcdList:
+ CheckDict = {'TokenSpaceGuidValue':PatchPcdItem.TokenSpaceGuidValue,
+ 'PcdCName':PatchPcdItem.PcdCName,
+ 'Token':PatchPcdItem.Token,
+ 'DatumType':PatchPcdItem.DatumType,
+ 'Value':PatchPcdItem.DefaultValue,
+ 'Offset':PatchPcdItem.Offset}
+ XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles', 'BinaryFile', 'AsBuilt', 'PatchPcdValue']
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ #
+ # Check PcdError
+ #
+ for PcdErrorItem in PatchPcdItem.PcdErrorsList:
+ CheckDict = {'ErrorNumber':PcdErrorItem.ErrorNumber}
+ XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles', 'BinaryFile', 'AsBuilt',
+ 'PatchPcdValue', 'PcdError']
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ #
+ # Check PcdEx
+ #
+ for PcdExItem in AsBuilt.PcdExValueList:
+ CheckDict = {'TokenSpaceGuidValue':PcdExItem.TokenSpaceGuidValue,
+ 'Token':PcdExItem.Token,
+ 'DatumType':PcdExItem.DatumType}
+ XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles', 'BinaryFile', 'AsBuilt', 'PcdExValue']
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ #
+ # Check PcdError
+ #
+ for PcdErrorItem in PcdExItem.PcdErrorsList:
+ CheckDict = {'ErrorNumber':PcdErrorItem.ErrorNumber}
+ XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles', 'BinaryFile', 'AsBuilt',
+ 'PcdExValue', 'PcdError']
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ #
+ # Check SmmDepex
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['SmmDepex']
+ for Item in Module.GetSmmDepex():
+ CheckDict = {'Expression':Item.GetDepex()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check PeiDepex
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['PeiDepex']
+ for Item in Module.GetPeiDepex():
+ CheckDict = {'Expression':Item.GetDepex()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check DxeDepex
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['DxeDepex']
+ for Item in Module.GetDxeDepex():
+ CheckDict = {'Expression':Item.GetDepex()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check <UserExtensions>
+ #
+ XmlTreeLevel = TopXmlTreeLevel + ['UserExtensions']
+ for Item in Module.GetUserExtensionList():
+ CheckDict = {'UserId':Item.GetUserID(), 'Identifier':Item.GetIdentifier()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+## ValidatePS1
+#
+# ValidatePS1
+#
+def ValidatePS1(Package):
+ #
+ # Check DistributionPackage -> PackageSurfaceArea -> Header
+ #
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'Header']
+ CheckDict = Sdict()
+ CheckDict['Name'] = Package.GetName()
+ CheckDict['BaseName'] = Package.GetBaseName()
+ CheckDict['GUID'] = Package.GetGuid()
+ CheckDict['Version'] = Package.GetVersion()
+ CheckDict['PackagePath'] = Package.GetPackagePath()
+
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ if not IsValidInstallPath(Package.GetPackagePath()):
+ Logger.Error("UPT", FORMAT_INVALID, ERR_FILE_NAME_INVALIDE % Package.GetPackagePath())
+
+ #
+ # Check DistributionPackage -> PackageSurfaceArea -> ClonedFrom
+ #
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'ClonedFrom']
+ for Item in Package.GetClonedFromList():
+ if Item is None:
+ CheckDict = Sdict()
+ CheckDict['GUID'] = ''
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ CheckDict = Sdict()
+ CheckDict['GUID'] = Item.GetPackageGuid()
+ CheckDict['Version'] = Item.GetPackageVersion()
+
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check DistributionPackage -> PackageSurfaceArea -> LibraryClassDeclarations -> LibraryClass
+ #
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'LibraryClassDeclarations']
+ for Item in Package.GetLibraryClassList():
+ if Item is None:
+ CheckDict = {'LibraryClass':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'LibraryClassDeclarations', 'LibraryClass']
+ for Item in Package.GetLibraryClassList():
+ CheckDict = {'Keyword':Item.GetLibraryClass(),
+ 'HeaderFile':Item.GetIncludeHeader()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check DistributionPackage -> PackageSurfaceArea -> IndustryStandardIncludes -> IndustryStandardHeader
+ #
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'IndustryStandardIncludes']
+ for Item in Package.GetStandardIncludeFileList():
+ if Item is None:
+ CheckDict = {'IndustryStandardHeader':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'IndustryStandardIncludes', 'IndustryStandardHeader']
+ for Item in Package.GetStandardIncludeFileList():
+ CheckDict = {'HeaderFile':Item.GetFilePath()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check DistributionPackage -> PackageSurfaceArea -> PackageIncludes -> PackageHeader
+ #
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PackageIncludes']
+ for Item in Package.GetPackageIncludeFileList():
+ if Item is None:
+ CheckDict = {'PackageHeader':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PackageIncludes', 'PackageHeader']
+ for Item in Package.GetPackageIncludeFileList():
+ CheckDict = {'HeaderFile':Item.GetFilePath()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+## ValidatePS2
+#
+# ValidatePS2
+#
+def ValidatePS2(Package):
+ #
+ # Check DistributionPackage -> PackageSurfaceArea -> Modules -> ModuleSurfaceArea
+ #
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'Modules', 'ModuleSurfaceArea']
+ for Item in Package.GetModuleDict().values():
+ ValidateMS(Item, XmlTreeLevel)
+
+ #
+ # Check DistributionPackage -> PackageSurfaceArea -> GuidDeclarations Entry
+ #
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'GuidDeclarations']
+ for Item in Package.GetGuidList():
+ if Item is None:
+ CheckDict = {'Entry':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'GuidDeclarations', 'Entry']
+ for Item in Package.GetGuidList():
+ CheckDict = {'CName':Item.GetCName(),
+ 'GuidValue':Item.GetGuid()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check DistributionPackage -> PackageSurfaceArea -> ProtocolDeclarations -> Entry
+ #
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'ProtocolDeclarations']
+ for Item in Package.GetProtocolList():
+ if Item is None:
+ CheckDict = {'Entry':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'ProtocolDeclarations', 'Entry']
+ for Item in Package.GetProtocolList():
+ CheckDict = {'CName':Item.GetCName(),
+ 'GuidValue':Item.GetGuid()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check DistributionPackage -> PackageSurfaceArea -> PpiDeclarations -> Entry
+ #
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PpiDeclarations']
+ for Item in Package.GetPpiList():
+ if Item is None:
+ CheckDict = {'Entry':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PpiDeclarations', 'Entry']
+ for Item in Package.GetPpiList():
+ CheckDict = {'CName':Item.GetCName(),
+ 'GuidValue':Item.GetGuid()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check DistributionPackage -> PackageSurfaceArea -> PcdDeclarations -> Entry
+ #
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PcdDeclarations']
+ for Item in Package.GetPcdList():
+ if Item is None:
+ CheckDict = {'PcdEntry':''}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PcdDeclarations', 'PcdEntry']
+ for Item in Package.GetPcdList():
+ CheckDict = {'TokenSpaceGuidCname':Item.GetTokenSpaceGuidCName(),
+ 'Token':Item.GetToken(),
+ 'CName':Item.GetCName(),
+ 'DatumType':Item.GetDatumType(),
+ 'ValidUsage':Item.GetValidUsage(),
+ 'DefaultValue':Item.GetDefaultValue()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check DistributionPackage -> PackageSurfaceArea -> UserExtensions
+ #
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'UserExtensions']
+ for Item in Package.GetUserExtensionList():
+ CheckDict = {'UserId':Item.GetUserID(), 'Identifier':Item.GetIdentifier()}
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+ #
+ # Check DistributionPackage -> PackageSurfaceArea -> MiscellaneousFiles -> Filename
+ #
+ XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'MiscellaneousFiles']
+ for Item in Package.GetMiscFileList():
+ if not Item.GetFileList():
+ CheckDict = {'Filename': '', }
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+ for File in Item.GetFileList():
+ CheckDict = {'Filename': File.GetURI(), }
+ IsRequiredItemListNull(CheckDict, XmlTreeLevel)
+
+## ValidatePackageSurfaceArea
+#
+# Check if any required item is missing in PackageSurfaceArea
+#
+# @param Package: The PackageSurfaceArea to be checked
+#
+def ValidatePackageSurfaceArea(Package):
+ ValidatePS1(Package)
+ ValidatePS2(Package)
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Xml/XmlParserMisc.py b/roms/edk2/BaseTools/Source/Python/UPT/Xml/XmlParserMisc.py
new file mode 100644
index 000000000..48381ee8c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Xml/XmlParserMisc.py
@@ -0,0 +1,95 @@
+## @file
+# This file is used to parse a xml file of .PKG file
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+XmlParserMisc
+'''
+from Object.POM.CommonObject import TextObject
+from Logger.StringTable import ERR_XML_PARSER_REQUIRED_ITEM_MISSING
+from Logger.ToolError import PARSER_ERROR
+import Logger.Log as Logger
+
+## ConvertVariableName()
+# Convert VariableName to be L"string",
+# input of UCS-2 format Hex Array or L"string" (C style.) could be converted successfully,
+# others will not.
+#
+# @param VariableName: string need to be converted
+# @retval: the L quoted string converted if success, else None will be returned
+#
+def ConvertVariableName(VariableName):
+ VariableName = VariableName.strip()
+ #
+ # check for L quoted string
+ #
+ if VariableName.startswith('L"') and VariableName.endswith('"'):
+ return VariableName
+
+ #
+ # check for Hex Array, it should be little endian even number of hex numbers
+ #
+ ValueList = VariableName.split(' ')
+ if len(ValueList)%2 == 1:
+ return None
+
+ TransferedStr = ''
+
+ Index = 0
+
+ while Index < len(ValueList):
+ FirstByte = int(ValueList[Index], 16)
+ SecondByte = int(ValueList[Index + 1], 16)
+ if SecondByte != 0:
+ return None
+
+ if FirstByte not in range(0x20, 0x7F):
+ return None
+ TransferedStr += ('%c')%FirstByte
+ Index = Index + 2
+
+ return 'L"' + TransferedStr + '"'
+
+## IsRequiredItemListNull
+#
+# Check if a required XML section item/attribue is NULL
+#
+# @param ItemList: The list of items to be checked
+# @param XmlTreeLevel: The error message tree level
+#
+def IsRequiredItemListNull(ItemDict, XmlTreeLevel):
+ for Key in ItemDict:
+ if not ItemDict[Key]:
+ Msg = "->".join(Node for Node in XmlTreeLevel)
+ ErrorMsg = ERR_XML_PARSER_REQUIRED_ITEM_MISSING % (Key, Msg)
+ Logger.Error('\nUPT', PARSER_ERROR, ErrorMsg, RaiseError=True)
+
+## Get help text
+#
+# @param HelpText
+#
+def GetHelpTextList(HelpText):
+ HelpTextList = []
+ for HelT in HelpText:
+ HelpTextObj = TextObject()
+ HelpTextObj.SetLang(HelT.Lang)
+ HelpTextObj.SetString(HelT.HelpText)
+ HelpTextList.append(HelpTextObj)
+ return HelpTextList
+
+## Get Prompt text
+#
+# @param Prompt
+#
+def GetPromptList(Prompt):
+ PromptList = []
+ for SubPrompt in Prompt:
+ PromptObj = TextObject()
+ PromptObj.SetLang(SubPrompt.Lang)
+ PromptObj.SetString(SubPrompt.Prompt)
+ PromptList.append(PromptObj)
+ return PromptList
diff --git a/roms/edk2/BaseTools/Source/Python/UPT/Xml/__init__.py b/roms/edk2/BaseTools/Source/Python/UPT/Xml/__init__.py
new file mode 100644
index 000000000..172e49845
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/UPT/Xml/__init__.py
@@ -0,0 +1,14 @@
+## @file
+# Python 'Library' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+Xml
+'''
diff --git a/roms/edk2/BaseTools/Source/Python/Workspace/BuildClassObject.py b/roms/edk2/BaseTools/Source/Python/Workspace/BuildClassObject.py
new file mode 100644
index 000000000..db40e3b10
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -0,0 +1,634 @@
+## @file
+# This file is used to define each component of the build database
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from collections import OrderedDict, namedtuple
+from Common.DataType import *
+import collections
+import re
+from collections import OrderedDict
+from Common.Misc import CopyDict,ArrayIndex
+import copy
+import Common.EdkLogger as EdkLogger
+from Common.BuildToolError import OPTION_VALUE_INVALID
+from Common.caching import cached_property
+StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_\[\]]*$')
+
+## PcdClassObject
+#
+# This Class is used for PcdObject
+#
+# @param object: Inherited from object class
+# @param Name: Input value for Name of Pcd, default is None
+# @param Guid: Input value for Guid of Pcd, default is None
+# @param Type: Input value for Type of Pcd, default is None
+# @param DatumType: Input value for DatumType of Pcd, default is None
+# @param Value: Input value for Value of Pcd, default is None
+# @param Token: Input value for Token of Pcd, default is None
+# @param MaxDatumSize: Input value for MaxDatumSize of Pcd, default is None
+# @param SkuInfoList: Input value for SkuInfoList of Pcd, default is {}
+# @param IsOverrided: Input value for IsOverrided of Pcd, default is False
+# @param GuidValue: Input value for TokenSpaceGuidValue of Pcd, default is None
+#
+# @var TokenCName: To store value for TokenCName
+# @var TokenSpaceGuidCName: To store value for TokenSpaceGuidCName
+# @var Type: To store value for Type
+# @var DatumType: To store value for DatumType
+# @var TokenValue: To store value for TokenValue
+# @var MaxDatumSize: To store value for MaxDatumSize
+# @var SkuInfoList: To store value for SkuInfoList
+# @var IsOverrided: To store value for IsOverrided
+# @var Phase: To store value for Phase, default is "DXE"
+#
+class PcdClassObject(object):
+ def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = None, IsOverrided = False, GuidValue = None, validateranges = None, validlists = None, expressions = None, IsDsc = False, UserDefinedDefaultStoresFlag = False):
+ self.TokenCName = Name
+ self.TokenSpaceGuidCName = Guid
+ self.TokenSpaceGuidValue = GuidValue
+ self.Type = Type
+ self._DatumType = DatumType
+ self.DefaultValue = Value
+ self.TokenValue = Token
+ self.MaxDatumSize = MaxDatumSize
+ self.MaxSizeUserSet = None
+ self.SkuInfoList = SkuInfoList if SkuInfoList is not None else OrderedDict()
+ self.Phase = "DXE"
+ self.Pending = False
+ self.IsOverrided = IsOverrided
+ self.IsFromBinaryInf = False
+ self.IsFromDsc = False
+ self.validateranges = validateranges if validateranges is not None else []
+ self.validlists = validlists if validlists is not None else []
+ self.expressions = expressions if expressions is not None else []
+ self.DscDefaultValue = None
+ self.DscRawValue = {}
+ self.DscRawValueInfo = {}
+ if IsDsc:
+ self.DscDefaultValue = Value
+ self.PcdValueFromComm = ""
+ self.PcdValueFromFdf = ""
+ self.CustomAttribute = {}
+ self.UserDefinedDefaultStoresFlag = UserDefinedDefaultStoresFlag
+ self._Capacity = None
+
+ @property
+ def Capacity(self):
+ if self._Capacity is None:
+ self._Capacity = []
+ dimension = ArrayIndex.findall(self._DatumType)
+ for item in dimension:
+ maxsize = item.lstrip("[").rstrip("]").strip()
+ if not maxsize:
+ maxsize = "-1"
+ maxsize = str(int(maxsize,16)) if maxsize.startswith(("0x","0X")) else maxsize
+ self._Capacity.append(maxsize)
+ if hasattr(self, "SkuOverrideValues"):
+ for sku in self.SkuOverrideValues:
+ for defaultstore in self.SkuOverrideValues[sku]:
+ fields = self.SkuOverrideValues[sku][defaultstore]
+ for demesionattr in fields:
+ fieldinfo = fields[demesionattr]
+ deme = ArrayIndex.findall(demesionattr)
+ for i in range(len(deme)):
+ if int(deme[i].lstrip("[").rstrip("]").strip()) >= int(self._Capacity[i]):
+ if self._Capacity[i] != "-1":
+ firstfieldinfo = list(fieldinfo.values())[0]
+ EdkLogger.error('Build', OPTION_VALUE_INVALID, "For Pcd %s, Array Index exceed the Array size. From %s Line %s \n " %
+ (".".join((self.TokenSpaceGuidCName, self.TokenCName)), firstfieldinfo[1],firstfieldinfo[2] ))
+ if hasattr(self,"DefaultValues"):
+ for demesionattr in self.DefaultValues:
+ fieldinfo = self.DefaultValues[demesionattr]
+ deme = ArrayIndex.findall(demesionattr)
+ for i in range(len(deme)):
+ if int(deme[i].lstrip("[").rstrip("]").strip()) >= int(self._Capacity[i]):
+ if self._Capacity[i] != "-1":
+ firstfieldinfo = list(fieldinfo.values())[0]
+ EdkLogger.error('Build', OPTION_VALUE_INVALID, "For Pcd %s, Array Index exceed the Array size. From %s Line %s \n " %
+ (".".join((self.TokenSpaceGuidCName, self.TokenCName)), firstfieldinfo[1],firstfieldinfo[2] ))
+ return self._Capacity
+
+ def PcdArraySize(self):
+ if self.Capacity[-1] == "-1":
+ return -1
+ size = 1
+ for de in self.Capacity:
+ size = size * int(de)
+ return size
+ @property
+ def DatumType(self):
+ return self._DatumType
+
+ @DatumType.setter
+ def DatumType(self,DataType):
+ self._DatumType = DataType
+ self._Capacity = None
+
+ @property
+ def BaseDatumType(self):
+ if self.IsArray():
+ return self._DatumType[:self._DatumType.index("[")]
+ else:
+ return self._DatumType
+ def IsArray(self):
+ return True if len(self.Capacity) else False
+
+ def IsAggregateDatumType(self):
+ if self.DatumType in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
+ return False
+ if self.IsArray() or StructPattern.match(self.DatumType):
+ return True
+ return False
+
+ def IsSimpleTypeArray(self):
+ if self.IsArray() and self.BaseDatumType in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, "BOOLEAN"]:
+ return True
+ return False
+
+ @staticmethod
+ def GetPcdMaxSizeWorker(PcdString, MaxSize):
+ if PcdString.startswith("{") and PcdString.endswith("}"):
+ return max([len(PcdString.split(",")),MaxSize])
+
+ if PcdString.startswith("\"") or PcdString.startswith("\'"):
+ return max([len(PcdString)-2+1,MaxSize])
+
+ if PcdString.startswith("L\""):
+ return max([2*(len(PcdString)-3+1),MaxSize])
+
+ return max([len(PcdString),MaxSize])
+
+ ## Get the maximum number of bytes
+ def GetPcdMaxSize(self):
+ if self.DatumType in TAB_PCD_NUMERIC_TYPES:
+ return MAX_SIZE_TYPE[self.DatumType]
+
+ MaxSize = int(self.MaxDatumSize, 10) if self.MaxDatumSize else 0
+ if self.PcdValueFromFdf:
+ MaxSize = self.GetPcdMaxSizeWorker(self.PcdValueFromFdf,MaxSize)
+ if self.PcdValueFromComm:
+ MaxSize = self.GetPcdMaxSizeWorker(self.PcdValueFromComm,MaxSize)
+ if hasattr(self, "DefaultValueFromDec"):
+ MaxSize = self.GetPcdMaxSizeWorker(self.DefaultValueFromDec,MaxSize)
+ return MaxSize
+
+ ## Get the number of bytes
+ def GetPcdSize(self):
+ if self.DatumType in TAB_PCD_NUMERIC_TYPES:
+ return MAX_SIZE_TYPE[self.DatumType]
+ if not self.DefaultValue:
+ return 1
+ elif self.DefaultValue[0] == 'L':
+ return (len(self.DefaultValue) - 2) * 2
+ elif self.DefaultValue[0] == '{':
+ return len(self.DefaultValue.split(','))
+ else:
+ return len(self.DefaultValue) - 1
+
+
+ ## Convert the class to a string
+ #
+ # Convert each member of the class to string
+ # Organize to a single line format string
+ #
+ # @retval Rtn Formatted String
+ #
+ def __str__(self):
+ Rtn = '\tTokenCName=' + str(self.TokenCName) + ', ' + \
+ 'TokenSpaceGuidCName=' + str(self.TokenSpaceGuidCName) + ', ' + \
+ 'Type=' + str(self.Type) + ', ' + \
+ 'DatumType=' + str(self.DatumType) + ', ' + \
+ 'DefaultValue=' + str(self.DefaultValue) + ', ' + \
+ 'TokenValue=' + str(self.TokenValue) + ', ' + \
+ 'MaxDatumSize=' + str(self.MaxDatumSize) + ', '
+ for Item in self.SkuInfoList.values():
+ Rtn = Rtn + 'SkuId=' + Item.SkuId + ', ' + 'SkuIdName=' + Item.SkuIdName
+ Rtn = Rtn + ', IsOverrided=' + str(self.IsOverrided)
+
+ return Rtn
+
+ ## Override __eq__ function
+ #
+ # Check whether pcds are the same
+ #
+ # @retval False The two pcds are different
+ # @retval True The two pcds are the same
+ #
+ def __eq__(self, Other):
+ return Other and self.TokenCName == Other.TokenCName and self.TokenSpaceGuidCName == Other.TokenSpaceGuidCName
+
+ ## Override __hash__ function
+ #
+ # Use (TokenCName, TokenSpaceGuidCName) as key in hash table
+ #
+ # @retval truple() Key for hash table
+ #
+ def __hash__(self):
+ return hash((self.TokenCName, self.TokenSpaceGuidCName))
+
+ @cached_property
+ def _fullname(self):
+ return ".".join((self.TokenSpaceGuidCName,self.TokenCName))
+
+ def __lt__(self,pcd):
+ return self._fullname < pcd._fullname
+ def __gt__(self,pcd):
+ return self._fullname > pcd._fullname
+
+ def sharedcopy(self,new_pcd):
+ new_pcd.TokenCName = self.TokenCName
+ new_pcd.TokenSpaceGuidCName = self.TokenSpaceGuidCName
+ new_pcd.TokenSpaceGuidValue = self.TokenSpaceGuidValue
+ new_pcd.Type = self.Type
+ new_pcd.DatumType = self.DatumType
+ new_pcd.DefaultValue = self.DefaultValue
+ new_pcd.TokenValue = self.TokenValue
+ new_pcd.MaxDatumSize = self.MaxDatumSize
+ new_pcd.MaxSizeUserSet = self.MaxSizeUserSet
+
+ new_pcd.Phase = self.Phase
+ new_pcd.Pending = self.Pending
+ new_pcd.IsOverrided = self.IsOverrided
+ new_pcd.IsFromBinaryInf = self.IsFromBinaryInf
+ new_pcd.IsFromDsc = self.IsFromDsc
+ new_pcd.PcdValueFromComm = self.PcdValueFromComm
+ new_pcd.PcdValueFromFdf = self.PcdValueFromFdf
+ new_pcd.UserDefinedDefaultStoresFlag = self.UserDefinedDefaultStoresFlag
+ new_pcd.DscRawValue = self.DscRawValue
+ new_pcd.DscRawValueInfo = self.DscRawValueInfo
+ new_pcd.CustomAttribute = self.CustomAttribute
+ new_pcd.validateranges = [item for item in self.validateranges]
+ new_pcd.validlists = [item for item in self.validlists]
+ new_pcd.expressions = [item for item in self.expressions]
+ new_pcd.SkuInfoList = {key: copy.deepcopy(skuobj) for key,skuobj in self.SkuInfoList.items()}
+ return new_pcd
+
+ def __deepcopy__(self,memo):
+ new_pcd = PcdClassObject()
+ self.sharedcopy(new_pcd)
+ return new_pcd
+
+class StructurePcd(PcdClassObject):
+ def __init__(self, StructuredPcdIncludeFile=None, Packages=None, Name=None, Guid=None, Type=None, DatumType=None, Value=None, Token=None, MaxDatumSize=None, SkuInfoList=None, IsOverrided=False, GuidValue=None, validateranges=None, validlists=None, expressions=None,default_store = TAB_DEFAULT_STORES_DEFAULT):
+ if SkuInfoList is None:
+ SkuInfoList = {}
+ if validateranges is None:
+ validateranges = []
+ if validlists is None:
+ validlists = []
+ if expressions is None:
+ expressions = []
+ if Packages is None:
+ Packages = []
+ super(StructurePcd, self).__init__(Name, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList, IsOverrided, GuidValue, validateranges, validlists, expressions)
+ self.StructuredPcdIncludeFile = [] if StructuredPcdIncludeFile is None else StructuredPcdIncludeFile
+ self.PackageDecs = Packages
+ self.DefaultStoreName = [default_store]
+ self.DefaultValues = OrderedDict()
+ self.PcdMode = None
+ self.SkuOverrideValues = OrderedDict()
+ self.StructName = None
+ self.PcdDefineLineNo = 0
+ self.PkgPath = ""
+ self.DefaultValueFromDec = ""
+ self.DefaultValueFromDecInfo = None
+ self.ValueChain = set()
+ self.PcdFieldValueFromComm = OrderedDict()
+ self.PcdFieldValueFromFdf = OrderedDict()
+ self.DefaultFromDSC=None
+ def __repr__(self):
+ return self.TypeName
+
+ def AddDefaultValue (self, FieldName, Value, FileName="", LineNo=0,DimensionAttr ="-1"):
+ if DimensionAttr not in self.DefaultValues:
+ self.DefaultValues[DimensionAttr] = collections.OrderedDict()
+ if FieldName in self.DefaultValues[DimensionAttr]:
+ del self.DefaultValues[DimensionAttr][FieldName]
+ self.DefaultValues[DimensionAttr][FieldName] = [Value.strip(), FileName, LineNo]
+ return self.DefaultValues[DimensionAttr][FieldName]
+
+ def SetDecDefaultValue(self, DefaultValue,decpath=None,lineno=None):
+ self.DefaultValueFromDec = DefaultValue
+ self.DefaultValueFromDecInfo = (decpath,lineno)
+ def AddOverrideValue (self, FieldName, Value, SkuName, DefaultStoreName, FileName="", LineNo=0, DimensionAttr = '-1'):
+ if SkuName not in self.SkuOverrideValues:
+ self.SkuOverrideValues[SkuName] = OrderedDict()
+ if DefaultStoreName not in self.SkuOverrideValues[SkuName]:
+ self.SkuOverrideValues[SkuName][DefaultStoreName] = OrderedDict()
+ if DimensionAttr not in self.SkuOverrideValues[SkuName][DefaultStoreName]:
+ self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr] = collections.OrderedDict()
+ if FieldName in self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr]:
+ del self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName]
+ self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName] = [Value.strip(), FileName, LineNo]
+ return self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldName]
+
+ def SetPcdMode (self, PcdMode):
+ self.PcdMode = PcdMode
+
+ def copy(self, PcdObject):
+ self.TokenCName = PcdObject.TokenCName if PcdObject.TokenCName else self.TokenCName
+ self.TokenSpaceGuidCName = PcdObject.TokenSpaceGuidCName if PcdObject.TokenSpaceGuidCName else PcdObject.TokenSpaceGuidCName
+ self.TokenSpaceGuidValue = PcdObject.TokenSpaceGuidValue if PcdObject.TokenSpaceGuidValue else self.TokenSpaceGuidValue
+ self.Type = PcdObject.Type if PcdObject.Type else self.Type
+ self._DatumType = PcdObject.DatumType if PcdObject.DatumType else self.DatumType
+ self.DefaultValue = PcdObject.DefaultValue if PcdObject.DefaultValue else self.DefaultValue
+ self.TokenValue = PcdObject.TokenValue if PcdObject.TokenValue else self.TokenValue
+ self.MaxDatumSize = PcdObject.MaxDatumSize if PcdObject.MaxDatumSize else self.MaxDatumSize
+ self.SkuInfoList = PcdObject.SkuInfoList if PcdObject.SkuInfoList else self.SkuInfoList
+ self.Phase = PcdObject.Phase if PcdObject.Phase else self.Phase
+ self.Pending = PcdObject.Pending if PcdObject.Pending else self.Pending
+ self.IsOverrided = PcdObject.IsOverrided if PcdObject.IsOverrided else self.IsOverrided
+ self.IsFromBinaryInf = PcdObject.IsFromBinaryInf if PcdObject.IsFromBinaryInf else self.IsFromBinaryInf
+ self.IsFromDsc = PcdObject.IsFromDsc if PcdObject.IsFromDsc else self.IsFromDsc
+ self.validateranges = PcdObject.validateranges if PcdObject.validateranges else self.validateranges
+ self.validlists = PcdObject.validlists if PcdObject.validlists else self.validlists
+ self.expressions = PcdObject.expressions if PcdObject.expressions else self.expressions
+ self.DscRawValue = PcdObject.DscRawValue if PcdObject.DscRawValue else self.DscRawValue
+ self.DscRawValueInfo = PcdObject.DscRawValueInfo if PcdObject.DscRawValueInfo else self.DscRawValueInfo
+ self.PcdValueFromComm = PcdObject.PcdValueFromComm if PcdObject.PcdValueFromComm else self.PcdValueFromComm
+ self.PcdValueFromFdf = PcdObject.PcdValueFromFdf if PcdObject.PcdValueFromFdf else self.PcdValueFromFdf
+ self.CustomAttribute = PcdObject.CustomAttribute if PcdObject.CustomAttribute else self.CustomAttribute
+ self.UserDefinedDefaultStoresFlag = PcdObject.UserDefinedDefaultStoresFlag if PcdObject.UserDefinedDefaultStoresFlag else self.UserDefinedDefaultStoresFlag
+ if isinstance(PcdObject, StructurePcd):
+ self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile
+ self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs else self.PackageDecs
+ self.DefaultValues = PcdObject.DefaultValues if PcdObject.DefaultValues else self.DefaultValues
+ self.PcdMode = PcdObject.PcdMode if PcdObject.PcdMode else self.PcdMode
+ self.DefaultValueFromDec = PcdObject.DefaultValueFromDec if PcdObject.DefaultValueFromDec else self.DefaultValueFromDec
+ self.DefaultValueFromDecInfo = PcdObject.DefaultValueFromDecInfo if PcdObject.DefaultValueFromDecInfo else self.DefaultValueFromDecInfo
+ self.SkuOverrideValues = PcdObject.SkuOverrideValues if PcdObject.SkuOverrideValues else self.SkuOverrideValues
+ self.StructName = PcdObject.DatumType if PcdObject.DatumType else self.StructName
+ self.PcdDefineLineNo = PcdObject.PcdDefineLineNo if PcdObject.PcdDefineLineNo else self.PcdDefineLineNo
+ self.PkgPath = PcdObject.PkgPath if PcdObject.PkgPath else self.PkgPath
+ self.ValueChain = PcdObject.ValueChain if PcdObject.ValueChain else self.ValueChain
+ self.PcdFieldValueFromComm = PcdObject.PcdFieldValueFromComm if PcdObject.PcdFieldValueFromComm else self.PcdFieldValueFromComm
+ self.PcdFieldValueFromFdf = PcdObject.PcdFieldValueFromFdf if PcdObject.PcdFieldValueFromFdf else self.PcdFieldValueFromFdf
+
+ def __deepcopy__(self,memo):
+ new_pcd = StructurePcd()
+ self.sharedcopy(new_pcd)
+
+ new_pcd.DefaultValueFromDec = self.DefaultValueFromDec
+ new_pcd.DefaultValueFromDecInfo = self.DefaultValueFromDecInfo
+ new_pcd.PcdMode = self.PcdMode
+ new_pcd.StructName = self.DatumType
+ new_pcd.PcdDefineLineNo = self.PcdDefineLineNo
+ new_pcd.PkgPath = self.PkgPath
+ new_pcd.StructuredPcdIncludeFile = [item for item in self.StructuredPcdIncludeFile]
+ new_pcd.PackageDecs = [item for item in self.PackageDecs]
+ new_pcd.DefaultValues = CopyDict(self.DefaultValues)
+ new_pcd.DefaultFromDSC=CopyDict(self.DefaultFromDSC)
+ new_pcd.SkuOverrideValues = CopyDict(self.SkuOverrideValues)
+ new_pcd.PcdFieldValueFromComm = CopyDict(self.PcdFieldValueFromComm)
+ new_pcd.PcdFieldValueFromFdf = CopyDict(self.PcdFieldValueFromFdf)
+ new_pcd.ValueChain = {item for item in self.ValueChain}
+ return new_pcd
+
+LibraryClassObject = namedtuple('LibraryClassObject', ['LibraryClass','SupModList'])
+
+## ModuleBuildClassObject
+#
+# This Class defines ModuleBuildClass
+#
+# @param object: Inherited from object class
+#
+# @var MetaFile: To store value for module meta file path
+# @var BaseName: To store value for BaseName
+# @var ModuleType: To store value for ModuleType
+# @var Guid: To store value for Guid
+# @var Version: To store value for Version
+# @var PcdIsDriver: To store value for PcdIsDriver
+# @var BinaryModule: To store value for BinaryModule
+# @var CustomMakefile: To store value for CustomMakefile
+# @var Specification: To store value for Specification
+# @var Shadow To store value for Shadow
+# @var LibraryClass: To store value for LibraryClass, it is a list structure as
+# [ LibraryClassObject, ...]
+# @var ModuleEntryPointList: To store value for ModuleEntryPointList
+# @var ModuleUnloadImageList: To store value for ModuleUnloadImageList
+# @var ConstructorList: To store value for ConstructorList
+# @var DestructorList: To store value for DestructorList
+# @var Binaries: To store value for Binaries, it is a list structure as
+# [ ModuleBinaryClassObject, ...]
+# @var Sources: To store value for Sources, it is a list structure as
+# [ ModuleSourceFilesClassObject, ... ]
+# @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
+# { [LibraryClassName, ModuleType] : LibraryClassInfFile }
+# @var Protocols: To store value for Protocols, it is a list structure as
+# [ ProtocolName, ... ]
+# @var Ppis: To store value for Ppis, it is a list structure as
+# [ PpiName, ... ]
+# @var Guids: To store value for Guids, it is a list structure as
+# [ GuidName, ... ]
+# @var Includes: To store value for Includes, it is a list structure as
+# [ IncludePath, ... ]
+# @var Packages: To store value for Packages, it is a list structure as
+# [ DecFileName, ... ]
+# @var Pcds: To store value for Pcds, it is a set structure as
+# { [(PcdCName, PcdGuidCName)] : PcdClassObject}
+# @var BuildOptions: To store value for BuildOptions, it is a set structure as
+# { [BuildOptionKey] : BuildOptionValue}
+# @var Depex: To store value for Depex
+#
+class ModuleBuildClassObject(object):
+ def __init__(self):
+ self.AutoGenVersion = 0
+ self.MetaFile = ''
+ self.BaseName = ''
+ self.ModuleType = ''
+ self.Guid = ''
+ self.Version = ''
+ self.PcdIsDriver = ''
+ self.BinaryModule = ''
+ self.Shadow = ''
+ self.CustomMakefile = {}
+ self.Specification = {}
+ self.LibraryClass = []
+ self.ModuleEntryPointList = []
+ self.ModuleUnloadImageList = []
+ self.ConstructorList = []
+ self.DestructorList = []
+
+ self.Binaries = []
+ self.Sources = []
+ self.LibraryClasses = OrderedDict()
+ self.Libraries = []
+ self.Protocols = []
+ self.Ppis = []
+ self.Guids = []
+ self.Includes = []
+ self.Packages = []
+ self.Pcds = {}
+ self.BuildOptions = {}
+ self.Depex = {}
+
+ ## Convert the class to a string
+ #
+ # Convert member MetaFile of the class to a string
+ #
+ # @retval string Formatted String
+ #
+ def __str__(self):
+ return str(self.MetaFile)
+
+ ## Override __eq__ function
+ #
+ # Check whether ModuleBuildClassObjects are the same
+ #
+ # @retval False The two ModuleBuildClassObjects are different
+ # @retval True The two ModuleBuildClassObjects are the same
+ #
+ def __eq__(self, Other):
+ return self.MetaFile == Other
+
+ ## Override __hash__ function
+ #
+ # Use MetaFile as key in hash table
+ #
+ # @retval string Key for hash table
+ #
+ def __hash__(self):
+ return hash(self.MetaFile)
+
+## PackageBuildClassObject
+#
+# This Class defines PackageBuildClass
+#
+# @param object: Inherited from object class
+#
+# @var MetaFile: To store value for package meta file path
+# @var PackageName: To store value for PackageName
+# @var Guid: To store value for Guid
+# @var Version: To store value for Version
+# @var Protocols: To store value for Protocols, it is a set structure as
+# { [ProtocolName] : Protocol Guid, ... }
+# @var Ppis: To store value for Ppis, it is a set structure as
+# { [PpiName] : Ppi Guid, ... }
+# @var Guids: To store value for Guids, it is a set structure as
+# { [GuidName] : Guid, ... }
+# @var Includes: To store value for Includes, it is a list structure as
+# [ IncludePath, ... ]
+# @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
+# { [LibraryClassName] : LibraryClassInfFile }
+# @var Pcds: To store value for Pcds, it is a set structure as
+# { [(PcdCName, PcdGuidCName)] : PcdClassObject}
+#
+class PackageBuildClassObject(object):
+ def __init__(self):
+ self.MetaFile = ''
+ self.PackageName = ''
+ self.Guid = ''
+ self.Version = ''
+
+ self.Protocols = {}
+ self.Ppis = {}
+ self.Guids = {}
+ self.Includes = []
+ self.LibraryClasses = {}
+ self.Pcds = {}
+
+ ## Convert the class to a string
+ #
+ # Convert member MetaFile of the class to a string
+ #
+ # @retval string Formatted String
+ #
+ def __str__(self):
+ return str(self.MetaFile)
+
+ ## Override __eq__ function
+ #
+ # Check whether PackageBuildClassObjects are the same
+ #
+ # @retval False The two PackageBuildClassObjects are different
+ # @retval True The two PackageBuildClassObjects are the same
+ #
+ def __eq__(self, Other):
+ return self.MetaFile == Other
+
+ ## Override __hash__ function
+ #
+ # Use MetaFile as key in hash table
+ #
+ # @retval string Key for hash table
+ #
+ def __hash__(self):
+ return hash(self.MetaFile)
+
+## PlatformBuildClassObject
+#
+# This Class defines PlatformBuildClass
+#
+# @param object: Inherited from object class
+#
+# @var MetaFile: To store value for platform meta-file path
+# @var PlatformName: To store value for PlatformName
+# @var Guid: To store value for Guid
+# @var Version: To store value for Version
+# @var DscSpecification: To store value for DscSpecification
+# @var OutputDirectory: To store value for OutputDirectory
+# @var FlashDefinition: To store value for FlashDefinition
+# @var BuildNumber: To store value for BuildNumber
+# @var MakefileName: To store value for MakefileName
+# @var SkuIds: To store value for SkuIds, it is a set structure as
+# { 'SkuName' : SkuId, '!include' : includefilename, ...}
+# @var Modules: To store value for Modules, it is a list structure as
+# [ InfFileName, ... ]
+# @var Libraries: To store value for Libraries, it is a list structure as
+# [ InfFileName, ... ]
+# @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
+# { (LibraryClassName, ModuleType) : LibraryClassInfFile }
+# @var Pcds: To store value for Pcds, it is a set structure as
+# { [(PcdCName, PcdGuidCName)] : PcdClassObject }
+# @var BuildOptions: To store value for BuildOptions, it is a set structure as
+# { [BuildOptionKey] : BuildOptionValue }
+#
+class PlatformBuildClassObject(object):
+ def __init__(self):
+ self.MetaFile = ''
+ self.PlatformName = ''
+ self.Guid = ''
+ self.Version = ''
+ self.DscSpecification = ''
+ self.OutputDirectory = ''
+ self.FlashDefinition = ''
+ self.BuildNumber = ''
+ self.MakefileName = ''
+
+ self.SkuIds = {}
+ self.Modules = []
+ self.LibraryInstances = []
+ self.LibraryClasses = {}
+ self.Libraries = {}
+ self.Pcds = {}
+ self.BuildOptions = {}
+
+ ## Convert the class to a string
+ #
+ # Convert member MetaFile of the class to a string
+ #
+ # @retval string Formatted String
+ #
+ def __str__(self):
+ return str(self.MetaFile)
+
+ ## Override __eq__ function
+ #
+ # Check whether PlatformBuildClassObjects are the same
+ #
+ # @retval False The two PlatformBuildClassObjects are different
+ # @retval True The two PlatformBuildClassObjects are the same
+ #
+ def __eq__(self, Other):
+ return self.MetaFile == Other
+
+ ## Override __hash__ function
+ #
+ # Use MetaFile as key in hash table
+ #
+ # @retval string Key for hash table
+ #
+ def __hash__(self):
+ return hash(self.MetaFile)
diff --git a/roms/edk2/BaseTools/Source/Python/Workspace/DecBuildData.py b/roms/edk2/BaseTools/Source/Python/Workspace/DecBuildData.py
new file mode 100644
index 000000000..30826a3ce
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Workspace/DecBuildData.py
@@ -0,0 +1,475 @@
+## @file
+# This file is used to create a database used by build tool
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+from Common.StringUtils import *
+from Common.DataType import *
+from Common.Misc import *
+from types import *
+from collections import OrderedDict
+from CommonDataClass.DataClass import *
+from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, PcdClassObject
+from Common.GlobalData import gGlobalDefines
+from re import compile
+
+## Platform build information from DEC file
+#
+# This class is used to retrieve information stored in database and convert them
+# into PackageBuildClassObject form for easier use for AutoGen.
+#
+class DecBuildData(PackageBuildClassObject):
+ # dict used to convert PCD type in database to string used by build tool
+ _PCD_TYPE_STRING_ = {
+ MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
+ MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
+ MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
+ }
+
+ # dict used to convert part of [Defines] to members of DecBuildData directly
+ _PROPERTY_ = {
+ #
+ # Required Fields
+ #
+ TAB_DEC_DEFINES_PACKAGE_NAME : "_PackageName",
+ TAB_DEC_DEFINES_PACKAGE_GUID : "_Guid",
+ TAB_DEC_DEFINES_PACKAGE_VERSION : "_Version",
+ TAB_DEC_DEFINES_PKG_UNI_FILE : "_PkgUniFile",
+ }
+
+
+ ## Constructor of DecBuildData
+ #
+ # Initialize object of DecBuildData
+ #
+ # @param FilePath The path of package description file
+ # @param RawData The raw data of DEC file
+ # @param BuildDataBase Database used to retrieve module information
+ # @param Arch The target architecture
+ # @param Platform (not used for DecBuildData)
+ # @param Macros Macros used for replacement in DSC file
+ #
+ def __init__(self, File, RawData, BuildDataBase, Arch=TAB_ARCH_COMMON, Target=None, Toolchain=None):
+ self.MetaFile = File
+ self._PackageDir = File.Dir
+ self._RawData = RawData
+ self._Bdb = BuildDataBase
+ self._Arch = Arch
+ self._Target = Target
+ self._Toolchain = Toolchain
+ self._Clear()
+
+ ## XXX[key] = value
+ def __setitem__(self, key, value):
+ self.__dict__[self._PROPERTY_[key]] = value
+
+ ## value = XXX[key]
+ def __getitem__(self, key):
+ return self.__dict__[self._PROPERTY_[key]]
+
+ ## "in" test support
+ def __contains__(self, key):
+ return key in self._PROPERTY_
+
+ ## Set all internal used members of DecBuildData to None
+ def _Clear(self):
+ self._Header = None
+ self._PackageName = None
+ self._Guid = None
+ self._Version = None
+ self._PkgUniFile = None
+ self._Protocols = None
+ self._Ppis = None
+ self._Guids = None
+ self._Includes = None
+ self._CommonIncludes = None
+ self._LibraryClasses = None
+ self._Pcds = None
+ self._MacroDict = None
+ self._PrivateProtocols = None
+ self._PrivatePpis = None
+ self._PrivateGuids = None
+ self._PrivateIncludes = None
+
+ ## Get current effective macros
+ @property
+ def _Macros(self):
+ if self._MacroDict is None:
+ self._MacroDict = dict(gGlobalDefines)
+ return self._MacroDict
+
+ ## Get architecture
+ @property
+ def Arch(self):
+ return self._Arch
+
+ ## Retrieve all information in [Defines] section
+ #
+ # (Retrieving all [Defines] information in one-shot is just to save time.)
+ #
+ def _GetHeaderInfo(self):
+ RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch]
+ for Record in RecordList:
+ Name = Record[1]
+ if Name in self:
+ self[Name] = Record[2]
+ self._Header = 'DUMMY'
+
+ ## Retrieve package name
+ @property
+ def PackageName(self):
+ if self._PackageName is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._PackageName is None:
+ EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "No PACKAGE_NAME", File=self.MetaFile)
+ return self._PackageName
+
+ ## Retrieve file guid
+ @property
+ def PackageName(self):
+ if self._Guid is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._Guid is None:
+ EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "No PACKAGE_GUID", File=self.MetaFile)
+ return self._Guid
+
+ ## Retrieve package version
+ @property
+ def Version(self):
+ if self._Version is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._Version is None:
+ self._Version = ''
+ return self._Version
+
+ ## Retrieve protocol definitions (name/value pairs)
+ @property
+ def Protocols(self):
+ if self._Protocols is None:
+ #
+ # tdict is a special kind of dict, used for selecting correct
+ # protocol definition for given ARCH
+ #
+ ProtocolDict = tdict(True)
+ PrivateProtocolDict = tdict(True)
+ NameList = []
+ PrivateNameList = []
+ PublicNameList = []
+ # find out all protocol definitions for specific and 'common' arch
+ RecordList = self._RawData[MODEL_EFI_PROTOCOL, self._Arch]
+ for Name, Guid, Dummy, Arch, PrivateFlag, ID, LineNo in RecordList:
+ if PrivateFlag == 'PRIVATE':
+ if Name not in PrivateNameList:
+ PrivateNameList.append(Name)
+ PrivateProtocolDict[Arch, Name] = Guid
+ if Name in PublicNameList:
+ EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)
+ else:
+ if Name not in PublicNameList:
+ PublicNameList.append(Name)
+ if Name in PrivateNameList:
+ EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)
+ if Name not in NameList:
+ NameList.append(Name)
+ ProtocolDict[Arch, Name] = Guid
+ # use OrderedDict to keep the order
+ self._Protocols = OrderedDict()
+ self._PrivateProtocols = OrderedDict()
+ for Name in NameList:
+ #
+ # limit the ARCH to self._Arch, if no self._Arch found, tdict
+ # will automatically turn to 'common' ARCH for trying
+ #
+ self._Protocols[Name] = ProtocolDict[self._Arch, Name]
+ for Name in PrivateNameList:
+ self._PrivateProtocols[Name] = PrivateProtocolDict[self._Arch, Name]
+ return self._Protocols
+
+ ## Retrieve PPI definitions (name/value pairs)
+ @property
+ def Ppis(self):
+ if self._Ppis is None:
+ #
+ # tdict is a special kind of dict, used for selecting correct
+ # PPI definition for given ARCH
+ #
+ PpiDict = tdict(True)
+ PrivatePpiDict = tdict(True)
+ NameList = []
+ PrivateNameList = []
+ PublicNameList = []
+ # find out all PPI definitions for specific arch and 'common' arch
+ RecordList = self._RawData[MODEL_EFI_PPI, self._Arch]
+ for Name, Guid, Dummy, Arch, PrivateFlag, ID, LineNo in RecordList:
+ if PrivateFlag == 'PRIVATE':
+ if Name not in PrivateNameList:
+ PrivateNameList.append(Name)
+ PrivatePpiDict[Arch, Name] = Guid
+ if Name in PublicNameList:
+ EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)
+ else:
+ if Name not in PublicNameList:
+ PublicNameList.append(Name)
+ if Name in PrivateNameList:
+ EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)
+ if Name not in NameList:
+ NameList.append(Name)
+ PpiDict[Arch, Name] = Guid
+ # use OrderedDict to keep the order
+ self._Ppis = OrderedDict()
+ self._PrivatePpis = OrderedDict()
+ for Name in NameList:
+ #
+ # limit the ARCH to self._Arch, if no self._Arch found, tdict
+ # will automatically turn to 'common' ARCH for trying
+ #
+ self._Ppis[Name] = PpiDict[self._Arch, Name]
+ for Name in PrivateNameList:
+ self._PrivatePpis[Name] = PrivatePpiDict[self._Arch, Name]
+ return self._Ppis
+
+ ## Retrieve GUID definitions (name/value pairs)
+ @property
+ def Guids(self):
+ if self._Guids is None:
+ #
+ # tdict is a special kind of dict, used for selecting correct
+ # GUID definition for given ARCH
+ #
+ GuidDict = tdict(True)
+ PrivateGuidDict = tdict(True)
+ NameList = []
+ PrivateNameList = []
+ PublicNameList = []
+ # find out all protocol definitions for specific and 'common' arch
+ RecordList = self._RawData[MODEL_EFI_GUID, self._Arch]
+ for Name, Guid, Dummy, Arch, PrivateFlag, ID, LineNo in RecordList:
+ if PrivateFlag == 'PRIVATE':
+ if Name not in PrivateNameList:
+ PrivateNameList.append(Name)
+ PrivateGuidDict[Arch, Name] = Guid
+ if Name in PublicNameList:
+ EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)
+ else:
+ if Name not in PublicNameList:
+ PublicNameList.append(Name)
+ if Name in PrivateNameList:
+ EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)
+ if Name not in NameList:
+ NameList.append(Name)
+ GuidDict[Arch, Name] = Guid
+ # use OrderedDict to keep the order
+ self._Guids = OrderedDict()
+ self._PrivateGuids = OrderedDict()
+ for Name in NameList:
+ #
+ # limit the ARCH to self._Arch, if no self._Arch found, tdict
+ # will automatically turn to 'common' ARCH for trying
+ #
+ self._Guids[Name] = GuidDict[self._Arch, Name]
+ for Name in PrivateNameList:
+ self._PrivateGuids[Name] = PrivateGuidDict[self._Arch, Name]
+ return self._Guids
+
+ ## Retrieve public include paths declared in this package
+ @property
+ def Includes(self):
+ if self._Includes is None or self._CommonIncludes is None:
+ self._CommonIncludes = []
+ self._Includes = []
+ self._PrivateIncludes = []
+ PublicInclues = []
+ RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch]
+ Macros = self._Macros
+ for Record in RecordList:
+ File = PathClass(NormPath(Record[0], Macros), self._PackageDir, Arch=self._Arch)
+ LineNo = Record[-1]
+ # validate the path
+ ErrorCode, ErrorInfo = File.Validate()
+ if ErrorCode != 0:
+ EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)
+
+ # avoid duplicate include path
+ if File not in self._Includes:
+ self._Includes.append(File)
+ if Record[4] == 'PRIVATE':
+ if File not in self._PrivateIncludes:
+ self._PrivateIncludes.append(File)
+ if File in PublicInclues:
+ EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % File, File=self.MetaFile, Line=LineNo)
+ else:
+ if File not in PublicInclues:
+ PublicInclues.append(File)
+ if File in self._PrivateIncludes:
+ EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % File, File=self.MetaFile, Line=LineNo)
+ if Record[3] == TAB_COMMON:
+ self._CommonIncludes.append(File)
+ return self._Includes
+
+ ## Retrieve library class declarations (not used in build at present)
+ @property
+ def LibraryClasses(self):
+ if self._LibraryClasses is None:
+ #
+ # tdict is a special kind of dict, used for selecting correct
+ # library class declaration for given ARCH
+ #
+ LibraryClassDict = tdict(True)
+ LibraryClassSet = set()
+ RecordList = self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Arch]
+ Macros = self._Macros
+ for LibraryClass, File, Dummy, Arch, PrivateFlag, ID, LineNo in RecordList:
+ File = PathClass(NormPath(File, Macros), self._PackageDir, Arch=self._Arch)
+ # check the file validation
+ ErrorCode, ErrorInfo = File.Validate()
+ if ErrorCode != 0:
+ EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)
+ LibraryClassSet.add(LibraryClass)
+ LibraryClassDict[Arch, LibraryClass] = File
+ self._LibraryClasses = OrderedDict()
+ for LibraryClass in LibraryClassSet:
+ self._LibraryClasses[LibraryClass] = LibraryClassDict[self._Arch, LibraryClass]
+ return self._LibraryClasses
+
+ ## Retrieve PCD declarations
+ @property
+ def Pcds(self):
+ if self._Pcds is None:
+ self._Pcds = OrderedDict()
+ self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))
+ self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE))
+ self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG))
+ self._Pcds.update(self._GetPcd(MODEL_PCD_DYNAMIC))
+ self._Pcds.update(self._GetPcd(MODEL_PCD_DYNAMIC_EX))
+ return self._Pcds
+
+ def ParsePcdName(self,TokenCName):
+ TokenCName = TokenCName.strip()
+ if TokenCName.startswith("["):
+ if "." in TokenCName:
+ Demesionattr = TokenCName[:TokenCName.index(".")]
+ Fields = TokenCName[TokenCName.index(".")+1:]
+ else:
+ Demesionattr = TokenCName
+ Fields = ""
+ else:
+ Demesionattr = ""
+ Fields = TokenCName
+
+ return Demesionattr,Fields
+
+ def ProcessStructurePcd(self, StructurePcdRawDataSet):
+ s_pcd_set = OrderedDict()
+ for s_pcd, LineNo in StructurePcdRawDataSet:
+ if s_pcd.TokenSpaceGuidCName not in s_pcd_set:
+ s_pcd_set[s_pcd.TokenSpaceGuidCName] = []
+ s_pcd_set[s_pcd.TokenSpaceGuidCName].append((s_pcd, LineNo))
+
+ str_pcd_set = []
+ for pcdname in s_pcd_set:
+ dep_pkgs = []
+ struct_pcd = StructurePcd()
+ for item, LineNo in s_pcd_set[pcdname]:
+ if not item.TokenCName:
+ continue
+ if "<HeaderFiles>" in item.TokenCName:
+ struct_pcd.StructuredPcdIncludeFile.append(item.DefaultValue)
+ elif "<Packages>" in item.TokenCName:
+ dep_pkgs.append(item.DefaultValue)
+ elif item.DatumType == item.TokenCName:
+ struct_pcd.copy(item)
+ struct_pcd.TokenValue = struct_pcd.TokenValue.strip("{").strip()
+ struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName = pcdname.split(".")
+ struct_pcd.PcdDefineLineNo = LineNo
+ struct_pcd.PkgPath = self.MetaFile.File
+ struct_pcd.SetDecDefaultValue(item.DefaultValue,self.MetaFile.File,LineNo)
+ else:
+ DemesionAttr, Fields = self.ParsePcdName(item.TokenCName)
+ struct_pcd.AddDefaultValue(Fields, item.DefaultValue, self.MetaFile.File, LineNo,DemesionAttr)
+
+ struct_pcd.PackageDecs = dep_pkgs
+ str_pcd_set.append(struct_pcd)
+ return str_pcd_set
+
+ ## Retrieve PCD declarations for given type
+ def _GetPcd(self, Type):
+ Pcds = OrderedDict()
+ #
+ # tdict is a special kind of dict, used for selecting correct
+ # PCD declaration for given ARCH
+ #
+ PcdDict = tdict(True, 3)
+ # for summarizing PCD
+ PcdSet = []
+ # find out all PCDs of the 'type'
+
+ StrPcdSet = []
+ RecordList = self._RawData[Type, self._Arch]
+ for TokenSpaceGuid, PcdCName, Setting, Arch, PrivateFlag, Dummy1, Dummy2 in RecordList:
+ PcdDict[Arch, PcdCName, TokenSpaceGuid] = (Setting, Dummy2)
+ if not (PcdCName, TokenSpaceGuid) in PcdSet:
+ PcdSet.append((PcdCName, TokenSpaceGuid))
+
+ DefinitionPosition = {}
+ for PcdCName, TokenSpaceGuid in PcdSet:
+ #
+ # limit the ARCH to self._Arch, if no self._Arch found, tdict
+ # will automatically turn to 'common' ARCH and try again
+ #
+ Setting, LineNo = PcdDict[self._Arch, PcdCName, TokenSpaceGuid]
+ if Setting is None:
+ continue
+
+ DefaultValue, DatumType, TokenNumber = AnalyzePcdData(Setting)
+ validateranges, validlists, expressions = self._RawData.GetValidExpression(TokenSpaceGuid, PcdCName)
+ PcdObj = PcdClassObject(
+ PcdCName,
+ TokenSpaceGuid,
+ self._PCD_TYPE_STRING_[Type],
+ DatumType,
+ DefaultValue,
+ TokenNumber,
+ '',
+ {},
+ False,
+ None,
+ list(validateranges),
+ list(validlists),
+ list(expressions)
+ )
+ DefinitionPosition[PcdObj] = (self.MetaFile.File, LineNo)
+ if "." in TokenSpaceGuid:
+ StrPcdSet.append((PcdObj, LineNo))
+ else:
+ Pcds[PcdCName, TokenSpaceGuid, self._PCD_TYPE_STRING_[Type]] = PcdObj
+
+ StructurePcds = self.ProcessStructurePcd(StrPcdSet)
+ for pcd in StructurePcds:
+ Pcds[pcd.TokenCName, pcd.TokenSpaceGuidCName, self._PCD_TYPE_STRING_[Type]] = pcd
+ StructPattern = compile(r'[_a-zA-Z][0-9A-Za-z_]*$')
+ for pcd in Pcds.values():
+ if pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
+ if not pcd.IsAggregateDatumType():
+ EdkLogger.error('build', FORMAT_INVALID, "DatumType only support BOOLEAN, UINT8, UINT16, UINT32, UINT64, VOID* or a valid struct name.", DefinitionPosition[pcd][0], DefinitionPosition[pcd][1])
+ elif not pcd.IsArray() and not pcd.StructuredPcdIncludeFile:
+ EdkLogger.error("build", PCD_STRUCTURE_PCD_ERROR, "The structure Pcd %s.%s header file is not found in %s line %s \n" % (pcd.TokenSpaceGuidCName, pcd.TokenCName, pcd.DefinitionPosition[0], pcd.DefinitionPosition[1] ))
+ return Pcds
+
+ @property
+ def CommonIncludes(self):
+ if self._CommonIncludes is None:
+ self.Includes
+ return self._CommonIncludes
diff --git a/roms/edk2/BaseTools/Source/Python/Workspace/DscBuildData.py b/roms/edk2/BaseTools/Source/Python/Workspace/DscBuildData.py
new file mode 100644
index 000000000..1afbd3eef
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -0,0 +1,3378 @@
+## @file
+# This file is used to create a database used by build tool
+#
+# Copyright (c) 2008 - 2020, Intel Corporation. All rights reserved.<BR>
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+## Platform build information from DSC file
+#
+# This class is used to retrieve information stored in database and convert them
+# into PlatformBuildClassObject form for easier use for AutoGen.
+#
+from __future__ import print_function
+from __future__ import absolute_import
+from Common.StringUtils import *
+from Common.DataType import *
+from Common.Misc import *
+from types import *
+from Common.Expression import *
+from CommonDataClass.CommonClass import SkuInfoClass
+from Common.TargetTxtClassObject import TargetTxtDict
+from Common.ToolDefClassObject import ToolDefDict
+from .MetaDataTable import *
+from .MetaFileTable import *
+from .MetaFileParser import *
+
+from .WorkspaceCommon import GetDeclaredPcd
+from Common.Misc import AnalyzeDscPcd
+from Common.Misc import ProcessDuplicatedInf,RemoveCComments,ArrayIndex
+import re
+from Common.Parsing import IsValidWord
+from Common.VariableAttributes import VariableAttributes
+import Common.GlobalData as GlobalData
+import subprocess
+from functools import reduce
+from Common.Misc import SaveFileOnChange
+from Workspace.BuildClassObject import PlatformBuildClassObject, StructurePcd, PcdClassObject, ModuleBuildClassObject
+from collections import OrderedDict, defaultdict
+
+def _IsFieldValueAnArray (Value):
+ Value = Value.strip()
+ if Value.startswith(TAB_GUID) and Value.endswith(')'):
+ return True
+ if Value.startswith('L"') and Value.endswith('"') and len(list(Value[2:-1])) > 1:
+ return True
+ if Value[0] == '"' and Value[-1] == '"' and len(list(Value[1:-1])) > 1:
+ return True
+ if Value[0] == '{' and Value[-1] == '}':
+ return True
+ if Value.startswith("L'") and Value.endswith("'") and len(list(Value[2:-1])) > 1:
+ return True
+ if Value[0] == "'" and Value[-1] == "'" and len(list(Value[1:-1])) > 1:
+ return True
+ return False
+
+PcdValueInitName = 'PcdValueInit'
+PcdValueCommonName = 'PcdValueCommon'
+
+PcdMainCHeader = '''
+/**
+ DO NOT EDIT
+ FILE auto-generated
+**/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <PcdValueCommon.h>
+'''
+
+PcdMainCEntry = '''
+int
+main (
+ int argc,
+ char *argv[]
+ )
+{
+ return PcdValueMain (argc, argv);
+}
+'''
+
+PcdMakefileHeader = '''
+#
+# DO NOT EDIT
+# This file is auto-generated by build utility
+#
+
+'''
+
+WindowsCFLAGS = 'CFLAGS = $(CFLAGS) /wd4200 /wd4034 /wd4101 '
+LinuxCFLAGS = 'BUILD_CFLAGS += -Wno-pointer-to-int-cast -Wno-unused-variable '
+PcdMakefileEnd = '''
+!INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.common
+!INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app
+'''
+
+AppTarget = '''
+all: $(APPFILE)
+$(APPFILE): $(OBJECTS)
+%s
+'''
+
+PcdGccMakefile = '''
+MAKEROOT ?= $(EDK_TOOLS_PATH)/Source/C
+LIBS = -lCommon
+'''
+
+variablePattern = re.compile(r'[\t\s]*0[xX][a-fA-F0-9]+$')
+SkuIdPattern = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*$')
+## regular expressions for finding decimal and hex numbers
+Pattern = re.compile('^[1-9]\d*|0$')
+HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$')
+## Regular expression for finding header file inclusions
+from AutoGen.GenMake import gIncludePattern
+
+## Find dependencies for one source file
+#
+# By searching recursively "#include" directive in file, find out all the
+# files needed by given source file. The dependecies will be only searched
+# in given search path list.
+#
+# @param SearchPathList The list of search path
+#
+# @retval list The list of files the given source file depends on
+#
+def GetDependencyList(FileStack, SearchPathList):
+ DepDb = dict()
+ DependencySet = set(FileStack)
+ while len(FileStack) > 0:
+ F = FileStack.pop()
+ FullPathDependList = []
+ CurrentFileDependencyList = []
+ if F in DepDb:
+ CurrentFileDependencyList = DepDb[F]
+ else:
+ try:
+ Fd = open(F, 'r')
+ FileContent = Fd.read()
+ except BaseException as X:
+ EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=F + "\n\t" + str(X))
+ finally:
+ if "Fd" in dir(locals()):
+ Fd.close()
+
+ if len(FileContent) == 0:
+ continue
+
+ try:
+ if FileContent[0] == 0xff or FileContent[0] == 0xfe:
+ FileContent = FileContent.decode('utf-16')
+ else:
+ FileContent = FileContent.decode()
+ except:
+ # The file is not txt file. for example .mcb file
+ continue
+ IncludedFileList = gIncludePattern.findall(FileContent)
+
+ for Inc in IncludedFileList:
+ Inc = Inc.strip()
+ Inc = os.path.normpath(Inc)
+ CurrentFileDependencyList.append(Inc)
+ DepDb[F] = CurrentFileDependencyList
+
+ CurrentFilePath = os.path.dirname(F)
+ PathList = [CurrentFilePath] + SearchPathList
+ for Inc in CurrentFileDependencyList:
+ for SearchPath in PathList:
+ FilePath = os.path.join(SearchPath, Inc)
+ if not os.path.exists(FilePath):
+ continue
+ if FilePath not in DependencySet:
+ FileStack.append(FilePath)
+ FullPathDependList.append(FilePath)
+ break
+ DependencySet.update(FullPathDependList)
+ DependencyList = list(DependencySet) # remove duplicate ones
+
+ return DependencyList
+
+class DscBuildData(PlatformBuildClassObject):
+ # dict used to convert PCD type in database to string used by build tool
+ _PCD_TYPE_STRING_ = {
+ MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
+ MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
+ MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
+ }
+
+ # dict used to convert part of [Defines] to members of DscBuildData directly
+ _PROPERTY_ = {
+ #
+ # Required Fields
+ #
+ TAB_DSC_DEFINES_PLATFORM_NAME : "_PlatformName",
+ TAB_DSC_DEFINES_PLATFORM_GUID : "_Guid",
+ TAB_DSC_DEFINES_PLATFORM_VERSION : "_Version",
+ TAB_DSC_DEFINES_DSC_SPECIFICATION : "_DscSpecification",
+ # TAB_DSC_DEFINES_OUTPUT_DIRECTORY : "_OutputDirectory",
+ # TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES : "_SupArchList",
+ # TAB_DSC_DEFINES_BUILD_TARGETS : "_BuildTargets",
+ TAB_DSC_DEFINES_SKUID_IDENTIFIER : "_SkuName",
+ # TAB_DSC_DEFINES_FLASH_DEFINITION : "_FlashDefinition",
+ TAB_DSC_DEFINES_BUILD_NUMBER : "_BuildNumber",
+ TAB_DSC_DEFINES_MAKEFILE_NAME : "_MakefileName",
+ TAB_DSC_DEFINES_BS_BASE_ADDRESS : "_BsBaseAddress",
+ TAB_DSC_DEFINES_RT_BASE_ADDRESS : "_RtBaseAddress",
+ # TAB_DSC_DEFINES_RFC_LANGUAGES : "_RFCLanguages",
+ # TAB_DSC_DEFINES_ISO_LANGUAGES : "_ISOLanguages",
+ }
+
+ # used to compose dummy library class name for those forced library instances
+ _NullLibraryNumber = 0
+
+ ## Constructor of DscBuildData
+ #
+ # Initialize object of DscBuildData
+ #
+ # @param FilePath The path of platform description file
+ # @param RawData The raw data of DSC file
+ # @param BuildDataBase Database used to retrieve module/package information
+ # @param Arch The target architecture
+ # @param Platform (not used for DscBuildData)
+ # @param Macros Macros used for replacement in DSC file
+ #
+ def __init__(self, FilePath, RawData, BuildDataBase, Arch=TAB_ARCH_COMMON, Target=None, Toolchain=None):
+ self.MetaFile = FilePath
+ self._RawData = RawData
+ self._Bdb = BuildDataBase
+ self._Arch = Arch
+ self._Target = Target
+ self._Toolchain = Toolchain
+ self._ToolChainFamily = None
+ self._Clear()
+ self.WorkspaceDir = os.getenv("WORKSPACE") if os.getenv("WORKSPACE") else ""
+ self.DefaultStores = None
+ self.SkuIdMgr = SkuClass(self.SkuName, self.SkuIds)
+
+ @property
+ def OutputPath(self):
+ if os.getenv("WORKSPACE"):
+ return os.path.join(os.getenv("WORKSPACE"), self.OutputDirectory, self._Target + "_" + self._Toolchain, PcdValueInitName)
+ else:
+ return os.path.dirname(self.DscFile)
+
+ ## XXX[key] = value
+ def __setitem__(self, key, value):
+ self.__dict__[self._PROPERTY_[key]] = value
+
+ ## value = XXX[key]
+ def __getitem__(self, key):
+ return self.__dict__[self._PROPERTY_[key]]
+
+ ## "in" test support
+ def __contains__(self, key):
+ return key in self._PROPERTY_
+
+ ## Set all internal used members of DscBuildData to None
+ def _Clear(self):
+ self._Header = None
+ self._PlatformName = None
+ self._Guid = None
+ self._Version = None
+ self._DscSpecification = None
+ self._OutputDirectory = None
+ self._SupArchList = None
+ self._BuildTargets = None
+ self._SkuName = None
+ self._PcdInfoFlag = None
+ self._VarCheckFlag = None
+ self._FlashDefinition = None
+ self._Prebuild = None
+ self._Postbuild = None
+ self._BuildNumber = None
+ self._MakefileName = None
+ self._BsBaseAddress = None
+ self._RtBaseAddress = None
+ self._SkuIds = None
+ self._Modules = None
+ self._LibraryInstances = None
+ self._LibraryClasses = None
+ self._Pcds = None
+ self._DecPcds = None
+ self._BuildOptions = None
+ self._ModuleTypeOptions = None
+ self._LoadFixAddress = None
+ self._RFCLanguages = None
+ self._ISOLanguages = None
+ self._VpdToolGuid = None
+ self._MacroDict = None
+ self.DefaultStores = None
+
+ ## Get current effective macros
+ @property
+ def _Macros(self):
+ if self._MacroDict is None:
+ self._MacroDict = {}
+ self._MacroDict.update(GlobalData.gPlatformDefines)
+ self._MacroDict.update(GlobalData.gGlobalDefines)
+ self._MacroDict.update(GlobalData.gCommandLineDefines)
+ return self._MacroDict
+
+ ## Get architecture
+ @property
+ def Arch(self):
+ return self._Arch
+ @property
+ def Dir(self):
+ return self.MetaFile.Dir
+
+ ## Retrieve all information in [Defines] section
+ #
+ # (Retrieving all [Defines] information in one-shot is just to save time.)
+ #
+ def _GetHeaderInfo(self):
+ RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch]
+ for Record in RecordList:
+ Name = Record[1]
+ # items defined _PROPERTY_ don't need additional processing
+
+ # some special items in [Defines] section need special treatment
+ if Name == TAB_DSC_DEFINES_OUTPUT_DIRECTORY:
+ self._OutputDirectory = NormPath(Record[2], self._Macros)
+ if ' ' in self._OutputDirectory:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in OUTPUT_DIRECTORY",
+ File=self.MetaFile, Line=Record[-1],
+ ExtraData=self._OutputDirectory)
+ elif Name == TAB_DSC_DEFINES_FLASH_DEFINITION:
+ self._FlashDefinition = PathClass(NormPath(Record[2], self._Macros), GlobalData.gWorkspace)
+ ErrorCode, ErrorInfo = self._FlashDefinition.Validate('.fdf')
+ if ErrorCode != 0:
+ EdkLogger.error('build', ErrorCode, File=self.MetaFile, Line=Record[-1],
+ ExtraData=ErrorInfo)
+ elif Name == TAB_DSC_PREBUILD:
+ PrebuildValue = Record[2]
+ if Record[2][0] == '"':
+ if Record[2][-1] != '"':
+ EdkLogger.error('build', FORMAT_INVALID, 'Missing double quotes in the end of %s statement.' % TAB_DSC_PREBUILD,
+ File=self.MetaFile, Line=Record[-1])
+ PrebuildValue = Record[2][1:-1]
+ self._Prebuild = PrebuildValue
+ elif Name == TAB_DSC_POSTBUILD:
+ PostbuildValue = Record[2]
+ if Record[2][0] == '"':
+ if Record[2][-1] != '"':
+ EdkLogger.error('build', FORMAT_INVALID, 'Missing double quotes in the end of %s statement.' % TAB_DSC_POSTBUILD,
+ File=self.MetaFile, Line=Record[-1])
+ PostbuildValue = Record[2][1:-1]
+ self._Postbuild = PostbuildValue
+ elif Name == TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES:
+ self._SupArchList = GetSplitValueList(Record[2], TAB_VALUE_SPLIT)
+ elif Name == TAB_DSC_DEFINES_BUILD_TARGETS:
+ self._BuildTargets = GetSplitValueList(Record[2])
+ elif Name == TAB_DSC_DEFINES_SKUID_IDENTIFIER:
+ if self._SkuName is None:
+ self._SkuName = Record[2]
+ if GlobalData.gSKUID_CMD:
+ self._SkuName = GlobalData.gSKUID_CMD
+ elif Name == TAB_DSC_DEFINES_PCD_INFO_GENERATION:
+ self._PcdInfoFlag = Record[2]
+ elif Name == TAB_DSC_DEFINES_PCD_VAR_CHECK_GENERATION:
+ self._VarCheckFlag = Record[2]
+ elif Name == TAB_FIX_LOAD_TOP_MEMORY_ADDRESS:
+ try:
+ self._LoadFixAddress = int (Record[2], 0)
+ except:
+ EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS %s is not valid dec or hex string" % (Record[2]))
+ elif Name == TAB_DSC_DEFINES_RFC_LANGUAGES:
+ if not Record[2] or Record[2][0] != '"' or Record[2][-1] != '"' or len(Record[2]) == 1:
+ EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'language code for RFC_LANGUAGES must have double quotes around it, for example: RFC_LANGUAGES = "en-us;zh-hans"',
+ File=self.MetaFile, Line=Record[-1])
+ LanguageCodes = Record[2][1:-1]
+ if not LanguageCodes:
+ EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'one or more RFC4646 format language code must be provided for RFC_LANGUAGES statement',
+ File=self.MetaFile, Line=Record[-1])
+ LanguageList = GetSplitValueList(LanguageCodes, TAB_SEMI_COLON_SPLIT)
+ # check whether there is empty entries in the list
+ if None in LanguageList:
+ EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'one or more empty language code is in RFC_LANGUAGES statement',
+ File=self.MetaFile, Line=Record[-1])
+ self._RFCLanguages = LanguageList
+ elif Name == TAB_DSC_DEFINES_ISO_LANGUAGES:
+ if not Record[2] or Record[2][0] != '"' or Record[2][-1] != '"' or len(Record[2]) == 1:
+ EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'language code for ISO_LANGUAGES must have double quotes around it, for example: ISO_LANGUAGES = "engchn"',
+ File=self.MetaFile, Line=Record[-1])
+ LanguageCodes = Record[2][1:-1]
+ if not LanguageCodes:
+ EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'one or more ISO639-2 format language code must be provided for ISO_LANGUAGES statement',
+ File=self.MetaFile, Line=Record[-1])
+ if len(LanguageCodes) % 3:
+ EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'bad ISO639-2 format for ISO_LANGUAGES',
+ File=self.MetaFile, Line=Record[-1])
+ LanguageList = []
+ for i in range(0, len(LanguageCodes), 3):
+ LanguageList.append(LanguageCodes[i:i + 3])
+ self._ISOLanguages = LanguageList
+ elif Name == TAB_DSC_DEFINES_VPD_TOOL_GUID:
+ #
+ # try to convert GUID to a real UUID value to see whether the GUID is format
+ # for VPD_TOOL_GUID is correct.
+ #
+ try:
+ uuid.UUID(Record[2])
+ except:
+ EdkLogger.error("build", FORMAT_INVALID, "Invalid GUID format for VPD_TOOL_GUID", File=self.MetaFile)
+ self._VpdToolGuid = Record[2]
+ elif Name in self:
+ self[Name] = Record[2]
+ # set _Header to non-None in order to avoid database re-querying
+ self._Header = 'DUMMY'
+
+ ## Retrieve platform name
+ @property
+ def PlatformName(self):
+ if self._PlatformName is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._PlatformName is None:
+ EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No PLATFORM_NAME", File=self.MetaFile)
+ return self._PlatformName
+
+ @property
+ def Platform(self):
+ return self.PlatformName
+
+ ## Retrieve file guid
+ @property
+ def Guid(self):
+ if self._Guid is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._Guid is None:
+ EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No PLATFORM_GUID", File=self.MetaFile)
+ return self._Guid
+
+ ## Retrieve platform version
+ @property
+ def Version(self):
+ if self._Version is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._Version is None:
+ EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No PLATFORM_VERSION", File=self.MetaFile)
+ return self._Version
+
+ ## Retrieve platform description file version
+ @property
+ def DscSpecification(self):
+ if self._DscSpecification is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._DscSpecification is None:
+ EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No DSC_SPECIFICATION", File=self.MetaFile)
+ return self._DscSpecification
+
+ ## Retrieve OUTPUT_DIRECTORY
+ @property
+ def OutputDirectory(self):
+ if self._OutputDirectory is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._OutputDirectory is None:
+ self._OutputDirectory = os.path.join("Build", self._PlatformName)
+ return self._OutputDirectory
+
+ ## Retrieve SUPPORTED_ARCHITECTURES
+ @property
+ def SupArchList(self):
+ if self._SupArchList is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._SupArchList is None:
+ EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No SUPPORTED_ARCHITECTURES", File=self.MetaFile)
+ return self._SupArchList
+
+ ## Retrieve BUILD_TARGETS
+ @property
+ def BuildTargets(self):
+ if self._BuildTargets is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._BuildTargets is None:
+ EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No BUILD_TARGETS", File=self.MetaFile)
+ return self._BuildTargets
+
+ @property
+ def PcdInfoFlag(self):
+ if self._PcdInfoFlag is None or self._PcdInfoFlag.upper() == 'FALSE':
+ return False
+ elif self._PcdInfoFlag.upper() == 'TRUE':
+ return True
+ else:
+ return False
+
+ @property
+ def VarCheckFlag(self):
+ if self._VarCheckFlag is None or self._VarCheckFlag.upper() == 'FALSE':
+ return False
+ elif self._VarCheckFlag.upper() == 'TRUE':
+ return True
+ else:
+ return False
+
+ # # Retrieve SKUID_IDENTIFIER
+ @property
+ def SkuName(self):
+ if self._SkuName is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._SkuName is None:
+ self._SkuName = TAB_DEFAULT
+ return self._SkuName
+
+ ## Override SKUID_IDENTIFIER
+ @SkuName.setter
+ def SkuName(self, Value):
+ self._SkuName = Value
+
+ @property
+ def FlashDefinition(self):
+ if self._FlashDefinition is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._FlashDefinition is None:
+ self._FlashDefinition = ''
+ return self._FlashDefinition
+
+ @property
+ def Prebuild(self):
+ if self._Prebuild is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._Prebuild is None:
+ self._Prebuild = ''
+ return self._Prebuild
+
+ @property
+ def Postbuild(self):
+ if self._Postbuild is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._Postbuild is None:
+ self._Postbuild = ''
+ return self._Postbuild
+
+ ## Retrieve FLASH_DEFINITION
+ @property
+ def BuildNumber(self):
+ if self._BuildNumber is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._BuildNumber is None:
+ self._BuildNumber = ''
+ return self._BuildNumber
+
+ ## Retrieve MAKEFILE_NAME
+ @property
+ def MakefileName(self):
+ if self._MakefileName is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._MakefileName is None:
+ self._MakefileName = ''
+ return self._MakefileName
+
+ ## Retrieve BsBaseAddress
+ @property
+ def BsBaseAddress(self):
+ if self._BsBaseAddress is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._BsBaseAddress is None:
+ self._BsBaseAddress = ''
+ return self._BsBaseAddress
+
+ ## Retrieve RtBaseAddress
+ @property
+ def RtBaseAddress(self):
+ if self._RtBaseAddress is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._RtBaseAddress is None:
+ self._RtBaseAddress = ''
+ return self._RtBaseAddress
+
+ ## Retrieve the top address for the load fix address
+ @property
+ def LoadFixAddress(self):
+ if self._LoadFixAddress is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+
+ if self._LoadFixAddress is None:
+ self._LoadFixAddress = self._Macros.get(TAB_FIX_LOAD_TOP_MEMORY_ADDRESS, '0')
+
+ try:
+ self._LoadFixAddress = int (self._LoadFixAddress, 0)
+ except:
+ EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS %s is not valid dec or hex string" % (self._LoadFixAddress))
+
+ #
+ # If command line defined, should override the value in DSC file.
+ #
+ if 'FIX_LOAD_TOP_MEMORY_ADDRESS' in GlobalData.gCommandLineDefines:
+ try:
+ self._LoadFixAddress = int(GlobalData.gCommandLineDefines['FIX_LOAD_TOP_MEMORY_ADDRESS'], 0)
+ except:
+ EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS %s is not valid dec or hex string" % (GlobalData.gCommandLineDefines['FIX_LOAD_TOP_MEMORY_ADDRESS']))
+
+ if self._LoadFixAddress < 0:
+ EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS is set to the invalid negative value 0x%x" % (self._LoadFixAddress))
+ if self._LoadFixAddress != 0xFFFFFFFFFFFFFFFF and self._LoadFixAddress % 0x1000 != 0:
+ EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS is set to the invalid unaligned 4K value 0x%x" % (self._LoadFixAddress))
+
+ return self._LoadFixAddress
+
+ ## Retrieve RFCLanguage filter
+ @property
+ def RFCLanguages(self):
+ if self._RFCLanguages is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._RFCLanguages is None:
+ self._RFCLanguages = []
+ return self._RFCLanguages
+
+ ## Retrieve ISOLanguage filter
+ @property
+ def ISOLanguages(self):
+ if self._ISOLanguages is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._ISOLanguages is None:
+ self._ISOLanguages = []
+ return self._ISOLanguages
+
+ ## Retrieve the GUID string for VPD tool
+ @property
+ def VpdToolGuid(self):
+ if self._VpdToolGuid is None:
+ if self._Header is None:
+ self._GetHeaderInfo()
+ if self._VpdToolGuid is None:
+ self._VpdToolGuid = ''
+ return self._VpdToolGuid
+
+ ## Retrieve [SkuIds] section information
+ @property
+ def SkuIds(self):
+ if self._SkuIds is None:
+ self._SkuIds = OrderedDict()
+ RecordList = self._RawData[MODEL_EFI_SKU_ID, self._Arch]
+ for Record in RecordList:
+ if not Record[0]:
+ EdkLogger.error('build', FORMAT_INVALID, 'No Sku ID number',
+ File=self.MetaFile, Line=Record[-1])
+ if not Record[1]:
+ EdkLogger.error('build', FORMAT_INVALID, 'No Sku ID name',
+ File=self.MetaFile, Line=Record[-1])
+ if not Pattern.match(Record[0]) and not HexPattern.match(Record[0]):
+ EdkLogger.error('build', FORMAT_INVALID, "The format of the Sku ID number is invalid. It only support Integer and HexNumber",
+ File=self.MetaFile, Line=Record[-1])
+ if not SkuIdPattern.match(Record[1]) or (Record[2] and not SkuIdPattern.match(Record[2])):
+ EdkLogger.error('build', FORMAT_INVALID, "The format of the Sku ID name is invalid. The correct format is '(a-zA-Z_)(a-zA-Z0-9_)*'",
+ File=self.MetaFile, Line=Record[-1])
+ self._SkuIds[Record[1].upper()] = (str(DscBuildData.ToInt(Record[0])), Record[1].upper(), Record[2].upper())
+ if TAB_DEFAULT not in self._SkuIds:
+ self._SkuIds[TAB_DEFAULT] = ("0", TAB_DEFAULT, TAB_DEFAULT)
+ if TAB_COMMON not in self._SkuIds:
+ self._SkuIds[TAB_COMMON] = ("0", TAB_DEFAULT, TAB_DEFAULT)
+ return self._SkuIds
+
+ @staticmethod
+ def ToInt(intstr):
+ return int(intstr, 16) if intstr.upper().startswith("0X") else int(intstr)
+
+ def _GetDefaultStores(self):
+ if self.DefaultStores is None:
+ self.DefaultStores = OrderedDict()
+ RecordList = self._RawData[MODEL_EFI_DEFAULT_STORES, self._Arch]
+ for Record in RecordList:
+ if not Record[0]:
+ EdkLogger.error('build', FORMAT_INVALID, 'No DefaultStores ID number',
+ File=self.MetaFile, Line=Record[-1])
+ if not Record[1]:
+ EdkLogger.error('build', FORMAT_INVALID, 'No DefaultStores ID name',
+ File=self.MetaFile, Line=Record[-1])
+ if not Pattern.match(Record[0]) and not HexPattern.match(Record[0]):
+ EdkLogger.error('build', FORMAT_INVALID, "The format of the DefaultStores ID number is invalid. It only support Integer and HexNumber",
+ File=self.MetaFile, Line=Record[-1])
+ if not IsValidWord(Record[1]):
+ EdkLogger.error('build', FORMAT_INVALID, "The format of the DefaultStores ID name is invalid. The correct format is '(a-zA-Z0-9_)(a-zA-Z0-9_-.)*'",
+ File=self.MetaFile, Line=Record[-1])
+ self.DefaultStores[Record[1].upper()] = (DscBuildData.ToInt(Record[0]), Record[1].upper())
+ if TAB_DEFAULT_STORES_DEFAULT not in self.DefaultStores:
+ self.DefaultStores[TAB_DEFAULT_STORES_DEFAULT] = (0, TAB_DEFAULT_STORES_DEFAULT)
+ GlobalData.gDefaultStores = sorted(self.DefaultStores.keys())
+ return self.DefaultStores
+
+ def OverrideDuplicateModule(self):
+ RecordList = self._RawData[MODEL_META_DATA_COMPONENT, self._Arch]
+ Macros = self._Macros
+ Components = {}
+ for Record in RecordList:
+ ModuleId = Record[6]
+ file_guid = self._RawData[MODEL_META_DATA_HEADER, self._Arch, None, ModuleId]
+ file_guid_str = file_guid[0][2] if file_guid else "NULL"
+ ModuleFile = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)
+ if self._Arch != TAB_ARCH_COMMON and (file_guid_str,str(ModuleFile)) in Components:
+ self._RawData.DisableOverrideComponent(Components[(file_guid_str,str(ModuleFile))])
+ Components[(file_guid_str,str(ModuleFile))] = ModuleId
+ self._RawData._PostProcessed = False
+
+ ## Retrieve packages this Platform depends on
+ @cached_property
+ def Packages(self):
+ RetVal = set()
+ RecordList = self._RawData[MODEL_META_DATA_PACKAGE, self._Arch]
+ Macros = self._Macros
+ for Record in RecordList:
+ File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)
+ # check the file validation
+ ErrorCode, ErrorInfo = File.Validate('.dec')
+ if ErrorCode != 0:
+ LineNo = Record[-1]
+ EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)
+ # parse this package now. we need it to get protocol/ppi/guid value
+ RetVal.add(self._Bdb[File, self._Arch, self._Target, self._Toolchain])
+ return RetVal
+
+ ## Retrieve [Components] section information
+ @property
+ def Modules(self):
+ if self._Modules is not None:
+ return self._Modules
+ self.OverrideDuplicateModule()
+ self._Modules = OrderedDict()
+ RecordList = self._RawData[MODEL_META_DATA_COMPONENT, self._Arch]
+ Macros = self._Macros
+ for Record in RecordList:
+ ModuleFile = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)
+ ModuleId = Record[6]
+ LineNo = Record[7]
+
+ # check the file validation
+ ErrorCode, ErrorInfo = ModuleFile.Validate('.inf')
+ if ErrorCode != 0:
+ EdkLogger.error('build', ErrorCode, File=self.MetaFile, Line=LineNo,
+ ExtraData=ErrorInfo)
+
+ Module = ModuleBuildClassObject()
+ Module.MetaFile = ModuleFile
+
+ # get module private library instance
+ RecordList = self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Arch, None, ModuleId]
+ for Record in RecordList:
+ LibraryClass = Record[0]
+ LibraryPath = PathClass(NormPath(Record[1], Macros), GlobalData.gWorkspace, Arch=self._Arch)
+ LineNo = Record[-1]
+
+ # check the file validation
+ ErrorCode, ErrorInfo = LibraryPath.Validate('.inf')
+ if ErrorCode != 0:
+ EdkLogger.error('build', ErrorCode, File=self.MetaFile, Line=LineNo,
+ ExtraData=ErrorInfo)
+
+ if LibraryClass == '' or LibraryClass == 'NULL':
+ self._NullLibraryNumber += 1
+ LibraryClass = 'NULL%d' % self._NullLibraryNumber
+ EdkLogger.verbose("Found forced library for %s\n\t%s [%s]" % (ModuleFile, LibraryPath, LibraryClass))
+ Module.LibraryClasses[LibraryClass] = LibraryPath
+ if LibraryPath not in self.LibraryInstances:
+ self.LibraryInstances.append(LibraryPath)
+
+ # get module private PCD setting
+ for Type in [MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE, \
+ MODEL_PCD_FEATURE_FLAG, MODEL_PCD_DYNAMIC, MODEL_PCD_DYNAMIC_EX]:
+ RecordList = self._RawData[Type, self._Arch, None, ModuleId]
+ for TokenSpaceGuid, PcdCName, Setting, Dummy1, Dummy2, Dummy3, Dummy4, Dummy5 in RecordList:
+ TokenList = GetSplitValueList(Setting)
+ DefaultValue = TokenList[0]
+ # the format is PcdName| Value | VOID* | MaxDatumSize
+ if len(TokenList) > 2:
+ MaxDatumSize = TokenList[2]
+ else:
+ MaxDatumSize = ''
+ TypeString = self._PCD_TYPE_STRING_[Type]
+ Pcd = PcdClassObject(
+ PcdCName,
+ TokenSpaceGuid,
+ TypeString,
+ '',
+ DefaultValue,
+ '',
+ MaxDatumSize,
+ {},
+ False,
+ None
+ )
+ Module.Pcds[PcdCName, TokenSpaceGuid] = Pcd
+
+ # get module private build options
+ RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, None, ModuleId]
+ for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4, Dummy5 in RecordList:
+ if (ToolChainFamily, ToolChain) not in Module.BuildOptions:
+ Module.BuildOptions[ToolChainFamily, ToolChain] = Option
+ else:
+ OptionString = Module.BuildOptions[ToolChainFamily, ToolChain]
+ Module.BuildOptions[ToolChainFamily, ToolChain] = OptionString + " " + Option
+
+ RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, None, ModuleId]
+ if RecordList:
+ if len(RecordList) != 1:
+ EdkLogger.error('build', OPTION_UNKNOWN, 'Only FILE_GUID can be listed in <Defines> section.',
+ File=self.MetaFile, ExtraData=str(ModuleFile), Line=LineNo)
+ ModuleFile = ProcessDuplicatedInf(ModuleFile, RecordList[0][2], GlobalData.gWorkspace)
+ ModuleFile.Arch = self._Arch
+
+ self._Modules[ModuleFile] = Module
+ return self._Modules
+
+ ## Retrieve all possible library instances used in this platform
+ @property
+ def LibraryInstances(self):
+ if self._LibraryInstances is None:
+ self.LibraryClasses
+ return self._LibraryInstances
+
+ ## Retrieve [LibraryClasses] information
+ @property
+ def LibraryClasses(self):
+ if self._LibraryClasses is None:
+ self._LibraryInstances = []
+ #
+ # tdict is a special dict kind of type, used for selecting correct
+ # library instance for given library class and module type
+ #
+ LibraryClassDict = tdict(True, 3)
+ # track all library class names
+ LibraryClassSet = set()
+ RecordList = self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Arch, None, -1]
+ Macros = self._Macros
+ for Record in RecordList:
+ LibraryClass, LibraryInstance, Dummy, Arch, ModuleType, Dummy, Dummy, LineNo = Record
+ if LibraryClass == '' or LibraryClass == 'NULL':
+ self._NullLibraryNumber += 1
+ LibraryClass = 'NULL%d' % self._NullLibraryNumber
+ EdkLogger.verbose("Found forced library for arch=%s\n\t%s [%s]" % (Arch, LibraryInstance, LibraryClass))
+ LibraryClassSet.add(LibraryClass)
+ LibraryInstance = PathClass(NormPath(LibraryInstance, Macros), GlobalData.gWorkspace, Arch=self._Arch)
+ # check the file validation
+ ErrorCode, ErrorInfo = LibraryInstance.Validate('.inf')
+ if ErrorCode != 0:
+ EdkLogger.error('build', ErrorCode, File=self.MetaFile, Line=LineNo,
+ ExtraData=ErrorInfo)
+
+ if ModuleType != TAB_COMMON and ModuleType not in SUP_MODULE_LIST:
+ EdkLogger.error('build', OPTION_UNKNOWN, "Unknown module type [%s]" % ModuleType,
+ File=self.MetaFile, ExtraData=LibraryInstance, Line=LineNo)
+ LibraryClassDict[Arch, ModuleType, LibraryClass] = LibraryInstance
+ if LibraryInstance not in self._LibraryInstances:
+ self._LibraryInstances.append(LibraryInstance)
+
+ # resolve the specific library instance for each class and each module type
+ self._LibraryClasses = tdict(True)
+ for LibraryClass in LibraryClassSet:
+ # try all possible module types
+ for ModuleType in SUP_MODULE_LIST:
+ LibraryInstance = LibraryClassDict[self._Arch, ModuleType, LibraryClass]
+ if LibraryInstance is None:
+ continue
+ self._LibraryClasses[LibraryClass, ModuleType] = LibraryInstance
+
+ RecordList = self._RawData[MODEL_EFI_LIBRARY_INSTANCE, self._Arch]
+ for Record in RecordList:
+ File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)
+ LineNo = Record[-1]
+ # check the file validation
+ ErrorCode, ErrorInfo = File.Validate('.inf')
+ if ErrorCode != 0:
+ EdkLogger.error('build', ErrorCode, File=self.MetaFile, Line=LineNo,
+ ExtraData=ErrorInfo)
+ if File not in self._LibraryInstances:
+ self._LibraryInstances.append(File)
+ #
+ # we need the module name as the library class name, so we have
+ # to parse it here. (self._Bdb[] will trigger a file parse if it
+ # hasn't been parsed)
+ #
+ Library = self._Bdb[File, self._Arch, self._Target, self._Toolchain]
+ self._LibraryClasses[Library.BaseName, ':dummy:'] = Library
+ return self._LibraryClasses
+
+ def _ValidatePcd(self, PcdCName, TokenSpaceGuid, Setting, PcdType, LineNo):
+ if not self._DecPcds:
+
+ FdfInfList = []
+ if GlobalData.gFdfParser:
+ FdfInfList = GlobalData.gFdfParser.Profile.InfList
+
+ PkgSet = set()
+ for Inf in FdfInfList:
+ ModuleFile = PathClass(NormPath(Inf), GlobalData.gWorkspace, Arch=self._Arch)
+ if ModuleFile in self._Modules:
+ continue
+ ModuleData = self._Bdb[ModuleFile, self._Arch, self._Target, self._Toolchain]
+ PkgSet.update(ModuleData.Packages)
+ if self.Packages:
+ PkgSet.update(self.Packages)
+ self._DecPcds, self._GuidDict = GetDeclaredPcd(self, self._Bdb, self._Arch, self._Target, self._Toolchain, PkgSet)
+ self._GuidDict.update(GlobalData.gPlatformPcds)
+
+ if (PcdCName, TokenSpaceGuid) not in self._DecPcds:
+ EdkLogger.error('build', PARSER_ERROR,
+ "Pcd (%s.%s) defined in DSC is not declared in DEC files referenced in INF files in FDF. Arch: ['%s']" % (TokenSpaceGuid, PcdCName, self._Arch),
+ File=self.MetaFile, Line=LineNo)
+ ValueList, IsValid, Index = AnalyzeDscPcd(Setting, PcdType, self._DecPcds[PcdCName, TokenSpaceGuid].DatumType)
+ if not IsValid:
+ if PcdType not in [MODEL_PCD_FEATURE_FLAG, MODEL_PCD_FIXED_AT_BUILD]:
+ EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect.", File=self.MetaFile, Line=LineNo,
+ ExtraData="%s.%s|%s" % (TokenSpaceGuid, PcdCName, Setting))
+ else:
+ if ValueList[2] == '-1':
+ EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect.", File=self.MetaFile, Line=LineNo,
+ ExtraData="%s.%s|%s" % (TokenSpaceGuid, PcdCName, Setting))
+ if ValueList[Index]:
+ DatumType = self._DecPcds[PcdCName, TokenSpaceGuid].DatumType
+ if "{CODE(" not in ValueList[Index]:
+ try:
+ ValueList[Index] = ValueExpressionEx(ValueList[Index], DatumType, self._GuidDict)(True)
+ except BadExpression as Value:
+ EdkLogger.error('Parser', FORMAT_INVALID, Value, File=self.MetaFile, Line=LineNo,
+ ExtraData="PCD [%s.%s] Value \"%s\" " % (
+ TokenSpaceGuid, PcdCName, ValueList[Index]))
+ except EvaluationException as Excpt:
+ if hasattr(Excpt, 'Pcd'):
+ if Excpt.Pcd in GlobalData.gPlatformOtherPcds:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Cannot use this PCD (%s) in an expression as"
+ " it must be defined in a [PcdsFixedAtBuild] or [PcdsFeatureFlag] section"
+ " of the DSC file" % Excpt.Pcd,
+ File=self.MetaFile, Line=LineNo)
+ else:
+ EdkLogger.error('Parser', FORMAT_INVALID, "PCD (%s) is not defined in DSC file" % Excpt.Pcd,
+ File=self.MetaFile, Line=LineNo)
+ else:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt),
+ File=self.MetaFile, Line=LineNo)
+
+ if ValueList[Index]:
+ Valid, ErrStr = CheckPcdDatum(self._DecPcds[PcdCName, TokenSpaceGuid].DatumType, ValueList[Index])
+ if not Valid:
+ EdkLogger.error('build', FORMAT_INVALID, ErrStr, File=self.MetaFile, Line=LineNo,
+ ExtraData="%s.%s" % (TokenSpaceGuid, PcdCName))
+ if PcdType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT, MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE):
+ if self._DecPcds[PcdCName, TokenSpaceGuid].DatumType.strip() != ValueList[1].strip():
+ DecPcd = self._DecPcds[PcdCName, TokenSpaceGuid]
+ EdkLogger.error('build', FORMAT_INVALID,
+ "Pcd datumtype used in DSC file is not the same as its declaration. DatumType:%s"%DecPcd.DatumType,
+ File=self.MetaFile, Line=LineNo,
+ ExtraData="Dsc:%s.%s|%s\n Dec:%s.%s|%s|%s|%s" % (TokenSpaceGuid, PcdCName, Setting, TokenSpaceGuid, \
+ PcdCName, DecPcd.DefaultValue, DecPcd.DatumType, DecPcd.TokenValue))
+ if (TokenSpaceGuid + '.' + PcdCName) in GlobalData.gPlatformPcds:
+ if GlobalData.gPlatformPcds[TokenSpaceGuid + '.' + PcdCName] != ValueList[Index]:
+ GlobalData.gPlatformPcds[TokenSpaceGuid + '.' + PcdCName] = ValueList[Index]
+ return ValueList
+
+ def _FilterPcdBySkuUsage(self, Pcds):
+ available_sku = self.SkuIdMgr.AvailableSkuIdSet
+ sku_usage = self.SkuIdMgr.SkuUsageType
+ if sku_usage == SkuClass.SINGLE:
+ for pcdname in Pcds:
+ pcd = Pcds[pcdname]
+ Pcds[pcdname].SkuInfoList = {TAB_DEFAULT:pcd.SkuInfoList[skuid] for skuid in pcd.SkuInfoList if skuid in available_sku}
+ if isinstance(pcd, StructurePcd) and pcd.SkuOverrideValues:
+ Pcds[pcdname].SkuOverrideValues = {TAB_DEFAULT:pcd.SkuOverrideValues[skuid] for skuid in pcd.SkuOverrideValues if skuid in available_sku}
+ else:
+ for pcdname in Pcds:
+ pcd = Pcds[pcdname]
+ Pcds[pcdname].SkuInfoList = {skuid:pcd.SkuInfoList[skuid] for skuid in pcd.SkuInfoList if skuid in available_sku}
+ if isinstance(pcd, StructurePcd) and pcd.SkuOverrideValues:
+ Pcds[pcdname].SkuOverrideValues = {skuid:pcd.SkuOverrideValues[skuid] for skuid in pcd.SkuOverrideValues if skuid in available_sku}
+ return Pcds
+
+ def CompleteHiiPcdsDefaultStores(self, Pcds):
+ HiiPcd = [Pcds[pcd] for pcd in Pcds if Pcds[pcd].Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]]
+ DefaultStoreMgr = DefaultStore(self.DefaultStores)
+ for pcd in HiiPcd:
+ for skuid in pcd.SkuInfoList:
+ skuobj = pcd.SkuInfoList.get(skuid)
+ if TAB_DEFAULT_STORES_DEFAULT not in skuobj.DefaultStoreDict:
+ PcdDefaultStoreSet = set(defaultstorename for defaultstorename in skuobj.DefaultStoreDict)
+ mindefaultstorename = DefaultStoreMgr.GetMin(PcdDefaultStoreSet)
+ skuobj.DefaultStoreDict[TAB_DEFAULT_STORES_DEFAULT] = skuobj.DefaultStoreDict[mindefaultstorename]
+ return Pcds
+
+ def RecoverCommandLinePcd(self):
+ def UpdateCommandLineValue(pcd):
+ if pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
+ self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]:
+ pcd.PcdValueFromComm = pcd.DefaultValue
+ elif pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
+ pcd.PcdValueFromComm = pcd.SkuInfoList.get(TAB_DEFAULT).HiiDefaultValue
+ else:
+ pcd.PcdValueFromComm = pcd.SkuInfoList.get(TAB_DEFAULT).DefaultValue
+ for pcd in self._Pcds:
+ if isinstance(self._Pcds[pcd], StructurePcd) and (self._Pcds[pcd].PcdValueFromComm or self._Pcds[pcd].PcdFieldValueFromComm):
+ UpdateCommandLineValue(self._Pcds[pcd])
+
+ def __ParsePcdFromCommandLine(self):
+ if GlobalData.BuildOptionPcd:
+ for i, pcd in enumerate(GlobalData.BuildOptionPcd):
+ if isinstance(pcd, tuple):
+ continue
+ (pcdname, pcdvalue) = pcd.split('=')
+ if not pcdvalue:
+ EdkLogger.error('build', AUTOGEN_ERROR, "No Value specified for the PCD %s." % (pcdname))
+ if '.' in pcdname:
+ (Name1, Name2) = pcdname.split('.', 1)
+ if "." in Name2:
+ (Name3, FieldName) = Name2.split(".", 1)
+ if ((Name3, Name1)) in self.DecPcds:
+ HasTokenSpace = True
+ TokenCName = Name3
+ TokenSpaceGuidCName = Name1
+ else:
+ FieldName = Name2
+ TokenCName = Name1
+ TokenSpaceGuidCName = ''
+ HasTokenSpace = False
+ else:
+ if ((Name2, Name1)) in self.DecPcds:
+ HasTokenSpace = True
+ TokenCName = Name2
+ TokenSpaceGuidCName = Name1
+ FieldName =""
+ else:
+ FieldName = Name2
+ TokenCName = Name1
+ TokenSpaceGuidCName = ''
+ HasTokenSpace = False
+ else:
+ FieldName = ""
+ TokenCName = pcdname
+ TokenSpaceGuidCName = ''
+ HasTokenSpace = False
+ TokenSpaceGuidCNameList = []
+ FoundFlag = False
+ PcdDatumType = ''
+ DisplayName = TokenCName
+ if FieldName:
+ DisplayName = TokenCName + '.' + FieldName
+ if not HasTokenSpace:
+ for key in self.DecPcds:
+ PcdItem = self.DecPcds[key]
+ if TokenCName == PcdItem.TokenCName:
+ if not PcdItem.TokenSpaceGuidCName in TokenSpaceGuidCNameList:
+ if len (TokenSpaceGuidCNameList) < 1:
+ TokenSpaceGuidCNameList.append(PcdItem.TokenSpaceGuidCName)
+ TokenSpaceGuidCName = PcdItem.TokenSpaceGuidCName
+ PcdDatumType = PcdItem.DatumType
+ FoundFlag = True
+ else:
+ EdkLogger.error(
+ 'build',
+ AUTOGEN_ERROR,
+ "The Pcd %s is found under multiple different TokenSpaceGuid: %s and %s." % (DisplayName, PcdItem.TokenSpaceGuidCName, TokenSpaceGuidCNameList[0])
+ )
+ else:
+ if (TokenCName, TokenSpaceGuidCName) in self.DecPcds:
+ PcdDatumType = self.DecPcds[(TokenCName, TokenSpaceGuidCName)].DatumType
+ FoundFlag = True
+ if not FoundFlag:
+ if HasTokenSpace:
+ EdkLogger.error('build', AUTOGEN_ERROR, "The Pcd %s.%s is not found in the DEC file." % (TokenSpaceGuidCName, DisplayName))
+ else:
+ EdkLogger.error('build', AUTOGEN_ERROR, "The Pcd %s is not found in the DEC file." % (DisplayName))
+ pcdvalue = pcdvalue.replace("\\\\\\'", '\\\\\\"').replace('\\\'', '\'').replace('\\\\\\"', "\\'")
+ if FieldName:
+ pcdvalue = DscBuildData.HandleFlexiblePcd(TokenSpaceGuidCName, TokenCName, pcdvalue, PcdDatumType, self._GuidDict, FieldName)
+ else:
+ pcdvalue = DscBuildData.HandleFlexiblePcd(TokenSpaceGuidCName, TokenCName, pcdvalue, PcdDatumType, self._GuidDict)
+ IsValid, Cause = CheckPcdDatum(PcdDatumType, pcdvalue)
+ if not IsValid:
+ EdkLogger.error("build", FORMAT_INVALID, Cause, ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName))
+ GlobalData.BuildOptionPcd[i] = (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, ("build command options", 1))
+
+ if GlobalData.BuildOptionPcd:
+ inf_objs = [item for item in self._Bdb._CACHE_.values() if item.Arch == self.Arch and item.MetaFile.Ext.lower() == '.inf']
+ for pcd in GlobalData.BuildOptionPcd:
+ (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd
+ for BuildData in inf_objs:
+ for key in BuildData.Pcds:
+ PcdItem = BuildData.Pcds[key]
+ if (TokenSpaceGuidCName, TokenCName) == (PcdItem.TokenSpaceGuidCName, PcdItem.TokenCName) and FieldName =="":
+ PcdItem.DefaultValue = pcdvalue
+ PcdItem.PcdValueFromComm = pcdvalue
+ #In command line, the latter full assign value in commandLine should override the former field assign value.
+ #For example, --pcd Token.pcd.field="" --pcd Token.pcd=H"{}"
+ delete_assign = []
+ field_assign = {}
+ if GlobalData.BuildOptionPcd:
+ for pcdTuple in GlobalData.BuildOptionPcd:
+ TokenSpaceGuid, Token, Field = pcdTuple[0], pcdTuple[1], pcdTuple[2]
+ if Field:
+ if (TokenSpaceGuid, Token) not in field_assign:
+ field_assign[TokenSpaceGuid, Token] = []
+ field_assign[TokenSpaceGuid, Token].append(pcdTuple)
+ else:
+ if (TokenSpaceGuid, Token) in field_assign:
+ delete_assign.extend(field_assign[TokenSpaceGuid, Token])
+ field_assign[TokenSpaceGuid, Token] = []
+ for item in delete_assign:
+ GlobalData.BuildOptionPcd.remove(item)
+
+ @staticmethod
+ def HandleFlexiblePcd(TokenSpaceGuidCName, TokenCName, PcdValue, PcdDatumType, GuidDict, FieldName=''):
+ if FieldName:
+ IsArray = False
+ TokenCName += '.' + FieldName
+ if PcdValue.startswith('H'):
+ if FieldName and _IsFieldValueAnArray(PcdValue[1:]):
+ PcdDatumType = TAB_VOID
+ IsArray = True
+ if FieldName and not IsArray:
+ return PcdValue
+ try:
+ PcdValue = ValueExpressionEx(PcdValue[1:], PcdDatumType, GuidDict)(True)
+ except BadExpression as Value:
+ EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %
+ (TokenSpaceGuidCName, TokenCName, PcdValue, Value))
+ elif PcdValue.startswith("L'") or PcdValue.startswith("'"):
+ if FieldName and _IsFieldValueAnArray(PcdValue):
+ PcdDatumType = TAB_VOID
+ IsArray = True
+ if FieldName and not IsArray:
+ return PcdValue
+ try:
+ PcdValue = ValueExpressionEx(PcdValue, PcdDatumType, GuidDict)(True)
+ except BadExpression as Value:
+ EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %
+ (TokenSpaceGuidCName, TokenCName, PcdValue, Value))
+ elif PcdValue.startswith('L'):
+ PcdValue = 'L"' + PcdValue[1:] + '"'
+ if FieldName and _IsFieldValueAnArray(PcdValue):
+ PcdDatumType = TAB_VOID
+ IsArray = True
+ if FieldName and not IsArray:
+ return PcdValue
+ try:
+ PcdValue = ValueExpressionEx(PcdValue, PcdDatumType, GuidDict)(True)
+ except BadExpression as Value:
+ EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %
+ (TokenSpaceGuidCName, TokenCName, PcdValue, Value))
+ else:
+ if PcdValue.upper() == 'FALSE':
+ PcdValue = str(0)
+ if PcdValue.upper() == 'TRUE':
+ PcdValue = str(1)
+ if not FieldName:
+ if PcdDatumType not in TAB_PCD_NUMERIC_TYPES:
+ PcdValue = '"' + PcdValue + '"'
+ elif not PcdValue.isdigit() and not PcdValue.upper().startswith('0X'):
+ PcdValue = '"' + PcdValue + '"'
+ else:
+ IsArray = False
+ Base = 10
+ if PcdValue.upper().startswith('0X'):
+ Base = 16
+ try:
+ Num = int(PcdValue, Base)
+ except:
+ PcdValue = '"' + PcdValue + '"'
+ if _IsFieldValueAnArray(PcdValue):
+ PcdDatumType = TAB_VOID
+ IsArray = True
+ if not IsArray:
+ return PcdValue
+ try:
+ PcdValue = ValueExpressionEx(PcdValue, PcdDatumType, GuidDict)(True)
+ except BadExpression as Value:
+ EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %
+ (TokenSpaceGuidCName, TokenCName, PcdValue, Value))
+ return PcdValue
+
+ ## Retrieve all PCD settings in platform
+ @property
+ def Pcds(self):
+ if self._Pcds is None:
+ self._Pcds = OrderedDict()
+ self.__ParsePcdFromCommandLine()
+ self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))
+ self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE))
+ self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG))
+ self._Pcds.update(self._GetDynamicPcd(MODEL_PCD_DYNAMIC_DEFAULT))
+ self._Pcds.update(self._GetDynamicHiiPcd(MODEL_PCD_DYNAMIC_HII))
+ self._Pcds.update(self._GetDynamicVpdPcd(MODEL_PCD_DYNAMIC_VPD))
+ self._Pcds.update(self._GetDynamicPcd(MODEL_PCD_DYNAMIC_EX_DEFAULT))
+ self._Pcds.update(self._GetDynamicHiiPcd(MODEL_PCD_DYNAMIC_EX_HII))
+ self._Pcds.update(self._GetDynamicVpdPcd(MODEL_PCD_DYNAMIC_EX_VPD))
+
+ self._Pcds = self.CompletePcdValues(self._Pcds)
+ self._Pcds = self.OverrideByFdfOverAll(self._Pcds)
+ self._Pcds = self.OverrideByCommOverAll(self._Pcds)
+ self._Pcds = self.UpdateStructuredPcds(MODEL_PCD_TYPE_LIST, self._Pcds)
+ self._Pcds = self.CompleteHiiPcdsDefaultStores(self._Pcds)
+ self._Pcds = self._FilterPcdBySkuUsage(self._Pcds)
+
+ self.RecoverCommandLinePcd()
+ return self._Pcds
+
+ ## Retrieve [BuildOptions]
+ @property
+ def BuildOptions(self):
+ if self._BuildOptions is None:
+ self._BuildOptions = OrderedDict()
+ #
+ # Retrieve build option for EDKII and EDK style module
+ #
+ for CodeBase in (EDKII_NAME, EDK_NAME):
+ RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, CodeBase]
+ for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4, Dummy5 in RecordList:
+ if Dummy3.upper() != TAB_COMMON:
+ continue
+ CurKey = (ToolChainFamily, ToolChain, CodeBase)
+ #
+ # Only flags can be appended
+ #
+ if CurKey not in self._BuildOptions or not ToolChain.endswith('_FLAGS') or Option.startswith('='):
+ self._BuildOptions[CurKey] = Option
+ else:
+ if ' ' + Option not in self._BuildOptions[CurKey]:
+ self._BuildOptions[CurKey] += ' ' + Option
+ return self._BuildOptions
+ def GetBuildOptionsByPkg(self, Module, ModuleType):
+
+ local_pkg = os.path.split(Module.LocalPkg())[0]
+ if self._ModuleTypeOptions is None:
+ self._ModuleTypeOptions = OrderedDict()
+ if ModuleType not in self._ModuleTypeOptions:
+ options = OrderedDict()
+ self._ModuleTypeOptions[ ModuleType] = options
+ RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch]
+ for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4, Dummy5 in RecordList:
+ if Dummy2 not in (TAB_COMMON,local_pkg.upper(),"EDKII"):
+ continue
+ Type = Dummy3
+ if Type.upper() == ModuleType.upper():
+ Key = (ToolChainFamily, ToolChain)
+ if Key not in options or not ToolChain.endswith('_FLAGS') or Option.startswith('='):
+ options[Key] = Option
+ else:
+ if ' ' + Option not in options[Key]:
+ options[Key] += ' ' + Option
+ return self._ModuleTypeOptions[ModuleType]
+ def GetBuildOptionsByModuleType(self, Edk, ModuleType):
+ if self._ModuleTypeOptions is None:
+ self._ModuleTypeOptions = OrderedDict()
+ if (Edk, ModuleType) not in self._ModuleTypeOptions:
+ options = OrderedDict()
+ self._ModuleTypeOptions[Edk, ModuleType] = options
+ DriverType = '%s.%s' % (Edk, ModuleType)
+ CommonDriverType = '%s.%s' % (TAB_COMMON, ModuleType)
+ RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch]
+ for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4, Dummy5 in RecordList:
+ Type = Dummy2 + '.' + Dummy3
+ if Type.upper() == DriverType.upper() or Type.upper() == CommonDriverType.upper():
+ Key = (ToolChainFamily, ToolChain, Edk)
+ if Key not in options or not ToolChain.endswith('_FLAGS') or Option.startswith('='):
+ options[Key] = Option
+ else:
+ if ' ' + Option not in options[Key]:
+ options[Key] += ' ' + Option
+ return self._ModuleTypeOptions[Edk, ModuleType]
+
+ @staticmethod
+ def GetStructurePcdInfo(PcdSet):
+ structure_pcd_data = defaultdict(list)
+ for item in PcdSet:
+ structure_pcd_data[(item[0], item[1])].append(item)
+
+ return structure_pcd_data
+
+ @staticmethod
+ def OverrideByFdf(StruPcds,workspace):
+ if GlobalData.gFdfParser is None:
+ return StruPcds
+ StructurePcdInFdf = OrderedDict()
+ fdfpcd = GlobalData.gFdfParser.Profile.PcdDict
+ fdfpcdlocation = GlobalData.gFdfParser.Profile.PcdLocalDict
+ for item in fdfpcd :
+ if len(item[2]) and (item[0],item[1]) in StruPcds:
+ StructurePcdInFdf[(item[1],item[0],item[2] )] = fdfpcd[item]
+ GlobalPcds = {(item[0],item[1]) for item in StructurePcdInFdf}
+ for Pcd in StruPcds.values():
+ if (Pcd.TokenSpaceGuidCName,Pcd.TokenCName) not in GlobalPcds:
+ continue
+ FieldValues = OrderedDict()
+ for item in StructurePcdInFdf:
+ if (Pcd.TokenSpaceGuidCName,Pcd.TokenCName) == (item[0],item[1]) and item[2]:
+ FieldValues[item[2]] = StructurePcdInFdf[item]
+ for field in FieldValues:
+ if field not in Pcd.PcdFieldValueFromFdf:
+ Pcd.PcdFieldValueFromFdf[field] = ["","",""]
+ Pcd.PcdFieldValueFromFdf[field][0] = FieldValues[field]
+ Pcd.PcdFieldValueFromFdf[field][1] = os.path.relpath(fdfpcdlocation[(Pcd.TokenCName,Pcd.TokenSpaceGuidCName,field)][0],workspace)
+ Pcd.PcdFieldValueFromFdf[field][2] = fdfpcdlocation[(Pcd.TokenCName,Pcd.TokenSpaceGuidCName,field)][1]
+
+ return StruPcds
+
+ @staticmethod
+ def OverrideByComm(StruPcds):
+ StructurePcdInCom = OrderedDict()
+ for item in GlobalData.BuildOptionPcd:
+ if len(item) == 5 and (item[1], item[0]) in StruPcds:
+ StructurePcdInCom[(item[0], item[1], item[2] )] = (item[3], item[4])
+ GlobalPcds = {(item[0], item[1]) for item in StructurePcdInCom}
+ for Pcd in StruPcds.values():
+ if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) not in GlobalPcds:
+ continue
+ FieldValues = OrderedDict()
+ for item in StructurePcdInCom:
+ if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) == (item[0], item[1]) and item[2]:
+ FieldValues[item[2]] = StructurePcdInCom[item]
+ for field in FieldValues:
+ if field not in Pcd.PcdFieldValueFromComm:
+ Pcd.PcdFieldValueFromComm[field] = ["", "", ""]
+ Pcd.PcdFieldValueFromComm[field][0] = FieldValues[field][0]
+ Pcd.PcdFieldValueFromComm[field][1] = FieldValues[field][1][0]
+ Pcd.PcdFieldValueFromComm[field][2] = FieldValues[field][1][1]
+ return StruPcds
+
+ def OverrideByCommOverAll(self,AllPcds):
+ def CheckStructureInComm(commpcds):
+ if not commpcds:
+ return False
+ if len(commpcds[0]) == 5:
+ return True
+ return False
+ NoFiledValues = OrderedDict()
+ if CheckStructureInComm(GlobalData.BuildOptionPcd):
+ StructurePcdInCom = OrderedDict()
+ for item in GlobalData.BuildOptionPcd:
+ StructurePcdInCom[(item[0], item[1], item[2] )] = (item[3], item[4])
+ for item in StructurePcdInCom:
+ if not item[2]:
+ NoFiledValues[(item[0], item[1])] = StructurePcdInCom[item]
+ else:
+ for item in GlobalData.BuildOptionPcd:
+ NoFiledValues[(item[0], item[1])] = [item[2]]
+ for Guid, Name in NoFiledValues:
+ if (Name, Guid) in AllPcds:
+ Pcd = AllPcds.get((Name, Guid))
+ if isinstance(self._DecPcds.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName), None), StructurePcd):
+ self._DecPcds.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName)).PcdValueFromComm = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0]
+ else:
+ Pcd.PcdValueFromComm = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0]
+ Pcd.DefaultValue = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0]
+ for sku in Pcd.SkuInfoList:
+ SkuInfo = Pcd.SkuInfoList[sku]
+ if SkuInfo.DefaultValue:
+ SkuInfo.DefaultValue = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0]
+ else:
+ SkuInfo.HiiDefaultValue = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0]
+ for defaultstore in SkuInfo.DefaultStoreDict:
+ SkuInfo.DefaultStoreDict[defaultstore] = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0]
+ if Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII]]:
+ if Pcd.DatumType == TAB_VOID:
+ if not Pcd.MaxDatumSize:
+ Pcd.MaxDatumSize = '0'
+ CurrentSize = int(Pcd.MaxDatumSize, 16) if Pcd.MaxDatumSize.upper().startswith("0X") else int(Pcd.MaxDatumSize)
+ OptionSize = len((StringToArray(Pcd.PcdValueFromComm)).split(","))
+ MaxSize = max(CurrentSize, OptionSize)
+ Pcd.MaxDatumSize = str(MaxSize)
+ else:
+ PcdInDec = self.DecPcds.get((Name, Guid))
+ if PcdInDec:
+ PcdInDec.PcdValueFromComm = NoFiledValues[(Guid, Name)][0]
+ if PcdInDec.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
+ self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE],
+ self._PCD_TYPE_STRING_[MODEL_PCD_FEATURE_FLAG],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX]]:
+ self._Pcds[Name, Guid] = copy.deepcopy(PcdInDec)
+ self._Pcds[Name, Guid].DefaultValue = NoFiledValues[( Guid, Name)][0]
+ if PcdInDec.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX]]:
+ self._Pcds[Name, Guid].SkuInfoList = {TAB_DEFAULT:SkuInfoClass(TAB_DEFAULT, self.SkuIds[TAB_DEFAULT][0], '', '', '', '', '', NoFiledValues[( Guid, Name)][0])}
+ return AllPcds
+
+ def OverrideByFdfOverAll(self,AllPcds):
+
+ if GlobalData.gFdfParser is None:
+ return AllPcds
+ NoFiledValues = GlobalData.gFdfParser.Profile.PcdDict
+ for Name,Guid,Field in NoFiledValues:
+ if len(Field):
+ continue
+ Value = NoFiledValues[(Name,Guid,Field)]
+ if (Name,Guid) in AllPcds:
+ Pcd = AllPcds.get((Name,Guid))
+ if isinstance(self._DecPcds.get((Pcd.TokenCName,Pcd.TokenSpaceGuidCName), None),StructurePcd):
+ self._DecPcds.get((Pcd.TokenCName,Pcd.TokenSpaceGuidCName)).PcdValueFromComm = Value
+ else:
+ Pcd.PcdValueFromComm = Value
+ Pcd.DefaultValue = Value
+ for sku in Pcd.SkuInfoList:
+ SkuInfo = Pcd.SkuInfoList[sku]
+ if SkuInfo.DefaultValue:
+ SkuInfo.DefaultValue = Value
+ else:
+ SkuInfo.HiiDefaultValue = Value
+ for defaultstore in SkuInfo.DefaultStoreDict:
+ SkuInfo.DefaultStoreDict[defaultstore] = Value
+ if Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII]]:
+ if Pcd.DatumType == TAB_VOID:
+ if not Pcd.MaxDatumSize:
+ Pcd.MaxDatumSize = '0'
+ CurrentSize = int(Pcd.MaxDatumSize,16) if Pcd.MaxDatumSize.upper().startswith("0X") else int(Pcd.MaxDatumSize)
+ OptionSize = len((StringToArray(Pcd.PcdValueFromComm)).split(","))
+ MaxSize = max(CurrentSize, OptionSize)
+ Pcd.MaxDatumSize = str(MaxSize)
+ else:
+ PcdInDec = self.DecPcds.get((Name,Guid))
+ if PcdInDec:
+ PcdInDec.PcdValueFromFdf = Value
+ if PcdInDec.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
+ self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE],
+ self._PCD_TYPE_STRING_[MODEL_PCD_FEATURE_FLAG]]:
+ self._Pcds[Name, Guid] = copy.deepcopy(PcdInDec)
+ self._Pcds[Name, Guid].DefaultValue = Value
+ return AllPcds
+
+ def ParsePcdNameStruct(self,NamePart1,NamePart2):
+ TokenSpaceCName = PcdCName = DimensionAttr = Field = ""
+ if "." in NamePart1:
+ TokenSpaceCName, TempPcdCName = NamePart1.split(".")
+ if "[" in TempPcdCName:
+ PcdCName = TempPcdCName[:TempPcdCName.index("[")]
+ DimensionAttr = TempPcdCName[TempPcdCName.index("["):]
+ else:
+ PcdCName = TempPcdCName
+ Field = NamePart2
+ else:
+ TokenSpaceCName = NamePart1
+ if "[" in NamePart2:
+ PcdCName = NamePart2[:NamePart2.index("[")]
+ DimensionAttr = NamePart2[NamePart2.index("["):]
+ else:
+ PcdCName = NamePart2
+
+ return TokenSpaceCName,PcdCName,DimensionAttr,Field
+
+ def UpdateStructuredPcds(self, TypeList, AllPcds):
+
+ DynamicPcdType = [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_DEFAULT],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_VPD],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_DEFAULT],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_VPD]]
+
+ Pcds = AllPcds
+ DefaultStoreMgr = DefaultStore(self.DefaultStores)
+ SkuIds = self.SkuIds
+ self.SkuIdMgr.AvailableSkuIdSet.update({TAB_DEFAULT:0})
+ DefaultStores = {storename for pcdobj in AllPcds.values() for skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStoreDict}
+ DefaultStores.add(TAB_DEFAULT_STORES_DEFAULT)
+
+ S_PcdSet = []
+ # Find out all possible PCD candidates for self._Arch
+ RecordList = []
+
+ for Type in TypeList:
+ RecordList.extend(self._RawData[Type, self._Arch])
+
+ for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, default_store, Dummy4, Dummy5 in RecordList:
+ SkuName = SkuName.upper()
+ default_store = default_store.upper()
+ SkuName = TAB_DEFAULT if SkuName == TAB_COMMON else SkuName
+ if SkuName not in SkuIds:
+ continue
+ TCName,PCName,DimensionAttr,Field = self.ParsePcdNameStruct(TokenSpaceGuid, PcdCName)
+ pcd_in_dec = self._DecPcds.get((PCName,TCName), None)
+ if pcd_in_dec is None:
+ EdkLogger.error('build', PARSER_ERROR,
+ "Pcd (%s.%s) defined in DSC is not declared in DEC files. Arch: ['%s']" % (TCName, PCName, self._Arch),
+ File=self.MetaFile, Line = Dummy5)
+ if SkuName in SkuIds and ("." in TokenSpaceGuid or "[" in PcdCName):
+ if not isinstance (pcd_in_dec, StructurePcd):
+ EdkLogger.error('build', PARSER_ERROR,
+ "Pcd (%s.%s) is not declared as Structure PCD in DEC files. Arch: ['%s']" % (TCName, PCName, self._Arch),
+ File=self.MetaFile, Line = Dummy5)
+
+ S_PcdSet.append([ TCName,PCName,DimensionAttr,Field, SkuName, default_store, Dummy5, AnalyzePcdExpression(Setting)[0]])
+
+ # handle pcd value override
+ StrPcdSet = DscBuildData.GetStructurePcdInfo(S_PcdSet)
+ S_pcd_set = OrderedDict()
+ for str_pcd in StrPcdSet:
+ str_pcd_obj = Pcds.get((str_pcd[1], str_pcd[0]), None)
+ str_pcd_dec = self._DecPcds.get((str_pcd[1], str_pcd[0]), None)
+ str_pcd_obj_str = StructurePcd()
+ str_pcd_obj_str.copy(str_pcd_dec)
+ if str_pcd_obj:
+ str_pcd_obj_str.copy(str_pcd_obj)
+ if str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
+ str_pcd_obj_str.DefaultFromDSC = {skuname:{defaultstore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, str_pcd_obj.SkuInfoList[skuname].HiiDefaultValue) for defaultstore in DefaultStores} for skuname in str_pcd_obj.SkuInfoList}
+ else:
+ str_pcd_obj_str.DefaultFromDSC = {skuname:{defaultstore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, str_pcd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in DefaultStores} for skuname in str_pcd_obj.SkuInfoList}
+ for str_pcd_data in StrPcdSet[str_pcd]:
+ if str_pcd_data[4] in SkuIds:
+ str_pcd_obj_str.AddOverrideValue(str_pcd_data[3], str(str_pcd_data[7]), TAB_DEFAULT if str_pcd_data[4] == TAB_COMMON else str_pcd_data[4], TAB_DEFAULT_STORES_DEFAULT if str_pcd_data[5] == TAB_COMMON else str_pcd_data[5], self.MetaFile.File if self.WorkspaceDir not in self.MetaFile.File else self.MetaFile.File[len(self.WorkspaceDir) if self.WorkspaceDir.endswith(os.path.sep) else len(self.WorkspaceDir)+1:], LineNo=str_pcd_data[6],DimensionAttr = str_pcd_data[2])
+ S_pcd_set[str_pcd[1], str_pcd[0]] = str_pcd_obj_str
+
+ # Add the Structure PCD that only defined in DEC, don't have override in DSC file
+ for Pcd in self.DecPcds:
+ if isinstance(self._DecPcds[Pcd], StructurePcd):
+ if Pcd not in S_pcd_set:
+ str_pcd_obj_str = StructurePcd()
+ str_pcd_obj_str.copy(self._DecPcds[Pcd])
+ str_pcd_obj = Pcds.get(Pcd, None)
+ if str_pcd_obj:
+ str_pcd_obj_str.copy(str_pcd_obj)
+ if str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
+ str_pcd_obj_str.DefaultFromDSC = {skuname:{defaultstore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, str_pcd_obj.SkuInfoList[skuname].HiiDefaultValue) for defaultstore in DefaultStores} for skuname in str_pcd_obj.SkuInfoList}
+ else:
+ str_pcd_obj_str.DefaultFromDSC = {skuname:{defaultstore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, str_pcd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in DefaultStores} for skuname in str_pcd_obj.SkuInfoList}
+ S_pcd_set[Pcd] = str_pcd_obj_str
+ if S_pcd_set:
+ GlobalData.gStructurePcd[self.Arch] = S_pcd_set.copy()
+ self.FilterStrcturePcd(S_pcd_set)
+ for stru_pcd in S_pcd_set.values():
+ for skuid in SkuIds:
+ if skuid in stru_pcd.SkuOverrideValues:
+ continue
+ nextskuid = self.SkuIdMgr.GetNextSkuId(skuid)
+ NoDefault = False
+ if skuid not in stru_pcd.SkuOverrideValues:
+ while nextskuid not in stru_pcd.SkuOverrideValues:
+ if nextskuid == TAB_DEFAULT:
+ NoDefault = True
+ break
+ nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
+ stru_pcd.SkuOverrideValues[skuid] = copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for defaultstorename in DefaultStores} if DefaultStores else {}) #{TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValues})
+ if not NoDefault:
+ stru_pcd.ValueChain.add((skuid, ''))
+ if 'DEFAULT' in stru_pcd.SkuOverrideValues and not GlobalData.gPcdSkuOverrides.get((stru_pcd.TokenCName, stru_pcd.TokenSpaceGuidCName)):
+ GlobalData.gPcdSkuOverrides.update(
+ {(stru_pcd.TokenCName, stru_pcd.TokenSpaceGuidCName): {'DEFAULT':stru_pcd.SkuOverrideValues['DEFAULT']}})
+ if stru_pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
+ for skuid in SkuIds:
+ nextskuid = skuid
+ NoDefault = False
+ if skuid not in stru_pcd.SkuOverrideValues:
+ while nextskuid not in stru_pcd.SkuOverrideValues:
+ if nextskuid == TAB_DEFAULT:
+ NoDefault = True
+ break
+ nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
+ if NoDefault:
+ continue
+ PcdDefaultStoreSet = set(defaultstorename for defaultstorename in stru_pcd.SkuOverrideValues[nextskuid])
+ mindefaultstorename = DefaultStoreMgr.GetMin(PcdDefaultStoreSet)
+
+ for defaultstoreid in DefaultStores:
+ if defaultstoreid not in stru_pcd.SkuOverrideValues[skuid]:
+ stru_pcd.SkuOverrideValues[skuid][defaultstoreid] = CopyDict(stru_pcd.SkuOverrideValues[nextskuid][mindefaultstorename])
+ stru_pcd.ValueChain.add((skuid, defaultstoreid))
+ S_pcd_set = DscBuildData.OverrideByFdf(S_pcd_set,self.WorkspaceDir)
+ S_pcd_set = DscBuildData.OverrideByComm(S_pcd_set)
+ Str_Pcd_Values = self.GenerateByteArrayValue(S_pcd_set)
+ if Str_Pcd_Values:
+ for (skuname, StoreName, PcdGuid, PcdName, PcdValue) in Str_Pcd_Values:
+ str_pcd_obj = S_pcd_set.get((PcdName, PcdGuid))
+ if str_pcd_obj is None:
+ print(PcdName, PcdGuid)
+ raise
+ if str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
+ if skuname not in str_pcd_obj.SkuInfoList:
+ str_pcd_obj.SkuInfoList[skuname] = SkuInfoClass(SkuIdName=skuname, SkuId=self.SkuIds[skuname][0], HiiDefaultValue=PcdValue, DefaultStore = {StoreName:PcdValue})
+ else:
+ str_pcd_obj.SkuInfoList[skuname].HiiDefaultValue = PcdValue
+ str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.update({StoreName:PcdValue})
+ elif str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
+ self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]:
+ if skuname in (self.SkuIdMgr.SystemSkuId, TAB_DEFAULT, TAB_COMMON):
+ str_pcd_obj.DefaultValue = PcdValue
+ else:
+ if skuname not in str_pcd_obj.SkuInfoList:
+ nextskuid = self.SkuIdMgr.GetNextSkuId(skuname)
+ NoDefault = False
+ while nextskuid not in str_pcd_obj.SkuInfoList:
+ if nextskuid == TAB_DEFAULT:
+ NoDefault = True
+ break
+ nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
+ str_pcd_obj.SkuInfoList[skuname] = copy.deepcopy(str_pcd_obj.SkuInfoList[nextskuid]) if not NoDefault else SkuInfoClass(SkuIdName=skuname, SkuId=self.SkuIds[skuname][0], DefaultValue=PcdValue)
+ str_pcd_obj.SkuInfoList[skuname].SkuId = self.SkuIds[skuname][0]
+ str_pcd_obj.SkuInfoList[skuname].SkuIdName = skuname
+ else:
+ str_pcd_obj.SkuInfoList[skuname].DefaultValue = PcdValue
+ for str_pcd_obj in S_pcd_set.values():
+ if str_pcd_obj.Type not in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
+ continue
+ PcdDefaultStoreSet = set(defaultstorename for skuobj in str_pcd_obj.SkuInfoList.values() for defaultstorename in skuobj.DefaultStoreDict)
+ DefaultStoreObj = DefaultStore(self._GetDefaultStores())
+ mindefaultstorename = DefaultStoreObj.GetMin(PcdDefaultStoreSet)
+ str_pcd_obj.SkuInfoList[self.SkuIdMgr.SystemSkuId].HiiDefaultValue = str_pcd_obj.SkuInfoList[self.SkuIdMgr.SystemSkuId].DefaultStoreDict[mindefaultstorename]
+
+ for str_pcd_obj in S_pcd_set.values():
+
+ str_pcd_obj.MaxDatumSize = DscBuildData.GetStructurePcdMaxSize(str_pcd_obj)
+ Pcds[str_pcd_obj.TokenCName, str_pcd_obj.TokenSpaceGuidCName] = str_pcd_obj
+ Pcds[str_pcd_obj.TokenCName, str_pcd_obj.TokenSpaceGuidCName].CustomAttribute['IsStru']=True
+
+ for pcdkey in Pcds:
+ pcd = Pcds[pcdkey]
+ if TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList:
+ pcd.SkuInfoList[TAB_DEFAULT] = pcd.SkuInfoList[TAB_COMMON]
+ del pcd.SkuInfoList[TAB_COMMON]
+ elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList:
+ del pcd.SkuInfoList[TAB_COMMON]
+
+ list(map(self.FilterSkuSettings, [Pcds[pcdkey] for pcdkey in Pcds if Pcds[pcdkey].Type in DynamicPcdType]))
+ return Pcds
+ @cached_property
+ def PlatformUsedPcds(self):
+ FdfInfList = []
+ if GlobalData.gFdfParser:
+ FdfInfList = GlobalData.gFdfParser.Profile.InfList
+ FdfModuleList = [PathClass(NormPath(Inf), GlobalData.gWorkspace, Arch=self._Arch) for Inf in FdfInfList]
+ AllModulePcds = set()
+ ModuleSet = set(list(self._Modules.keys()) + FdfModuleList)
+ for ModuleFile in ModuleSet:
+ ModuleData = self._Bdb[ModuleFile, self._Arch, self._Target, self._Toolchain]
+ AllModulePcds = AllModulePcds | ModuleData.PcdsName
+ for ModuleFile in self.LibraryInstances:
+ ModuleData = self._Bdb.CreateBuildObject(ModuleFile, self._Arch, self._Target, self._Toolchain)
+ AllModulePcds = AllModulePcds | ModuleData.PcdsName
+ return AllModulePcds
+
+ #Filter the StrucutrePcd that is not used by any module in dsc file and fdf file.
+ def FilterStrcturePcd(self, S_pcd_set):
+ UnusedStruPcds = set(S_pcd_set.keys()) - self.PlatformUsedPcds
+ for (Token, TokenSpaceGuid) in UnusedStruPcds:
+ del S_pcd_set[(Token, TokenSpaceGuid)]
+
+ ## Retrieve non-dynamic PCD settings
+ #
+ # @param Type PCD type
+ #
+ # @retval a dict object contains settings of given PCD type
+ #
+ def _GetPcd(self, Type):
+ Pcds = OrderedDict()
+ #
+ # tdict is a special dict kind of type, used for selecting correct
+ # PCD settings for certain ARCH
+ #
+ AvailableSkuIdSet = copy.copy(self.SkuIds)
+
+ PcdDict = tdict(True, 4)
+ PcdList = []
+ # Find out all possible PCD candidates for self._Arch
+ RecordList = self._RawData[Type, self._Arch]
+ PcdValueDict = OrderedDict()
+ for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dummy4, Dummy5 in RecordList:
+ SkuName = SkuName.upper()
+ SkuName = TAB_DEFAULT if SkuName == TAB_COMMON else SkuName
+ if SkuName not in AvailableSkuIdSet:
+ EdkLogger.error('build ', PARAMETER_INVALID, 'Sku %s is not defined in [SkuIds] section' % SkuName,
+ File=self.MetaFile, Line=Dummy5)
+ if SkuName in (self.SkuIdMgr.SystemSkuId, TAB_DEFAULT, TAB_COMMON):
+ if "." not in TokenSpaceGuid and "[" not in PcdCName and (PcdCName, TokenSpaceGuid, SkuName, Dummy5) not in PcdList:
+ PcdList.append((PcdCName, TokenSpaceGuid, SkuName, Dummy5))
+ PcdDict[Arch, PcdCName, TokenSpaceGuid, SkuName] = Setting
+
+ for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdList:
+ Setting = PcdDict[self._Arch, PcdCName, TokenSpaceGuid, SkuName]
+ if Setting is None:
+ continue
+ PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
+ if MaxDatumSize:
+ if int(MaxDatumSize, 0) > 0xFFFF:
+ EdkLogger.error('build', FORMAT_INVALID, "The size value must not exceed the maximum value of 0xFFFF (UINT16) for %s." % ".".join((TokenSpaceGuid, PcdCName)),
+ File=self.MetaFile, Line=Dummy4)
+ if int(MaxDatumSize, 0) < 0:
+ EdkLogger.error('build', FORMAT_INVALID, "The size value can't be set to negative value for %s." % ".".join((TokenSpaceGuid, PcdCName)),
+ File=self.MetaFile, Line=Dummy4)
+ if (PcdCName, TokenSpaceGuid) in PcdValueDict:
+ PcdValueDict[PcdCName, TokenSpaceGuid][SkuName] = (PcdValue, DatumType, MaxDatumSize,Dummy4)
+ else:
+ PcdValueDict[PcdCName, TokenSpaceGuid] = {SkuName:(PcdValue, DatumType, MaxDatumSize,Dummy4)}
+
+ for ((PcdCName, TokenSpaceGuid), PcdSetting) in PcdValueDict.items():
+ if self.SkuIdMgr.SystemSkuId in PcdSetting:
+ PcdValue, DatumType, MaxDatumSize,_ = PcdSetting[self.SkuIdMgr.SystemSkuId]
+ elif TAB_DEFAULT in PcdSetting:
+ PcdValue, DatumType, MaxDatumSize,_ = PcdSetting[TAB_DEFAULT]
+ elif TAB_COMMON in PcdSetting:
+ PcdValue, DatumType, MaxDatumSize,_ = PcdSetting[TAB_COMMON]
+ else:
+ PcdValue = None
+ DatumType = None
+ MaxDatumSize = None
+
+ Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
+ PcdCName,
+ TokenSpaceGuid,
+ self._PCD_TYPE_STRING_[Type],
+ DatumType,
+ PcdValue,
+ '',
+ MaxDatumSize,
+ {},
+ False,
+ None,
+ IsDsc=True)
+ for SkuName in PcdValueDict[PcdCName, TokenSpaceGuid]:
+ Settings = PcdValueDict[PcdCName, TokenSpaceGuid][SkuName]
+ if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue:
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName] = {}
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][TAB_DEFAULT_STORES_DEFAULT] = Settings[0]
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName][TAB_DEFAULT_STORES_DEFAULT] = (self.MetaFile.File,Settings[3])
+ return Pcds
+
+ @staticmethod
+ def GetStructurePcdMaxSize(str_pcd):
+ pcd_default_value = str_pcd.DefaultValue
+ sku_values = [skuobj.HiiDefaultValue if str_pcd.Type in [DscBuildData._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], DscBuildData._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]] else skuobj.DefaultValue for skuobj in str_pcd.SkuInfoList.values()]
+ sku_values.append(pcd_default_value)
+
+ def get_length(value):
+ Value = value.strip()
+ if len(value) > 1:
+ if Value.startswith(TAB_GUID) and Value.endswith(')'):
+ return 16
+ if Value.startswith('L"') and Value.endswith('"'):
+ return len(Value[2:-1])
+ if Value[0] == '"' and Value[-1] == '"':
+ return len(Value) - 2
+ if Value.strip().startswith("{CODE("):
+ tmpValue = RemoveCComments(Value)
+ return len(tmpValue.split(","))
+ if (Value[0] == '{' and Value[-1] == '}'):
+ return len(Value.split(","))
+ if Value.startswith("L'") and Value.endswith("'") and len(list(Value[2:-1])) > 1:
+ return len(list(Value[2:-1]))
+ if Value[0] == "'" and Value[-1] == "'" and len(list(Value[1:-1])) > 1:
+ return len(Value) - 2
+ return len(Value)
+
+ return str(max(get_length(item) for item in sku_values))
+
+ @staticmethod
+ def ExecuteCommand (Command):
+ try:
+ Process = subprocess.Popen(Command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ except:
+ EdkLogger.error('Build', COMMAND_FAILURE, 'Can not execute command: %s' % Command)
+ Result = Process.communicate()
+ return Process.returncode, Result[0].decode(errors='ignore'), Result[1].decode(errors='ignore')
+
+ @staticmethod
+ def IntToCString(Value, ValueSize):
+ Result = '"'
+ if not isinstance (Value, str):
+ for Index in range(0, ValueSize):
+ Result = Result + '\\x%02x' % (Value & 0xff)
+ Value = Value >> 8
+ Result = Result + '"'
+ return Result
+
+ def GenerateSizeFunction(self, Pcd):
+ CApp = "// Default Value in Dec \n"
+ CApp = CApp + "void Cal_%s_%s_Size(UINT32 *Size){\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+
+ if Pcd.IsArray() and Pcd.Capacity[-1] != "-1":
+ CApp += " *Size = (sizeof (%s) > *Size ? sizeof (%s) : *Size);\n" % (Pcd.DatumType,Pcd.DatumType)
+ else:
+ if "{CODE(" in Pcd.DefaultValueFromDec:
+ CApp += " *Size = (sizeof (%s_%s_INIT_Value) > *Size ? sizeof (%s_%s_INIT_Value) : *Size);\n" % (Pcd.TokenSpaceGuidCName,Pcd.TokenCName,Pcd.TokenSpaceGuidCName,Pcd.TokenCName)
+ if Pcd.Type in PCD_DYNAMIC_TYPE_SET | PCD_DYNAMIC_EX_TYPE_SET:
+ for skuname in Pcd.SkuInfoList:
+ skuobj = Pcd.SkuInfoList[skuname]
+ if skuobj.VariableName:
+ for defaultstore in skuobj.DefaultStoreDict:
+ pcddef = self.GetPcdDscRawDefaultValue(Pcd,skuname,defaultstore)
+ if pcddef:
+ if "{CODE(" in pcddef:
+ CApp += " *Size = (sizeof (%s_%s_%s_%s_Value) > *Size ? sizeof (%s_%s_%s_%s_Value) : *Size);\n" % (Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,defaultstore,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,defaultstore)
+ else:
+ CApp += " *Size = %s > *Size ? %s : *Size;\n" % (self.GetStructurePcdMaxSize(Pcd),self.GetStructurePcdMaxSize(Pcd))
+ else:
+ pcddef = self.GetPcdDscRawDefaultValue(Pcd,skuname,TAB_DEFAULT_STORES_DEFAULT)
+ if pcddef:
+ if "{CODE(" in pcddef:
+ CApp += " *Size = (sizeof (%s_%s_%s_%s_Value) > *Size ? sizeof (%s_%s_%s_%s_Value) : *Size);\n" % (Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,TAB_DEFAULT_STORES_DEFAULT,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,TAB_DEFAULT_STORES_DEFAULT)
+ else:
+ CApp += " *Size = %s > *Size ? %s : *Size;\n" % (self.GetStructurePcdMaxSize(Pcd),self.GetStructurePcdMaxSize(Pcd))
+ else:
+ pcddef = self.GetPcdDscRawDefaultValue(Pcd,TAB_DEFAULT,TAB_DEFAULT_STORES_DEFAULT)
+ if pcddef:
+ if "{CODE(" in pcddef:
+ CApp += " *Size = (sizeof (%s_%s_%s_%s_Value) > *Size ? sizeof (%s_%s_%s_%s_Value) : *Size);\n" % (Pcd.TokenSpaceGuidCName,Pcd.TokenCName,TAB_DEFAULT,TAB_DEFAULT_STORES_DEFAULT,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,TAB_DEFAULT,TAB_DEFAULT_STORES_DEFAULT)
+ else:
+ CApp += " *Size = %s > *Size ? %s : *Size;\n" % (self.GetStructurePcdMaxSize(Pcd),self.GetStructurePcdMaxSize(Pcd))
+ ActualCap = []
+ for index in Pcd.DefaultValues:
+ if index:
+ ActualCap.append(index)
+ FieldList = Pcd.DefaultValues[index]
+ if not FieldList:
+ continue
+ for FieldName in FieldList:
+ FieldName = "." + FieldName
+ IsArray = _IsFieldValueAnArray(FieldList[FieldName.strip(".")][0])
+ if IsArray and not (FieldList[FieldName.strip(".")][0].startswith('{GUID') and FieldList[FieldName.strip(".")][0].endswith('}')):
+ try:
+ Value = ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2]))
+ Value, ValueSize = ParseFieldValue(Value)
+ if not Pcd.IsArray():
+ CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]);
+ else:
+ NewFieldName = ''
+ FieldName_ori = FieldName.strip('.')
+ while '[' in FieldName:
+ NewFieldName = NewFieldName + FieldName.split('[', 1)[0] + '[0]'
+ Array_Index = int(FieldName.split('[', 1)[1].split(']', 1)[0])
+ FieldName = FieldName.split(']', 1)[1]
+ FieldName = NewFieldName + FieldName
+ while '[' in FieldName and not Pcd.IsArray():
+ FieldName = FieldName.rsplit('[', 1)[0]
+ CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), Array_Index + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], FieldList[FieldName_ori][0])
+ for skuname in Pcd.SkuOverrideValues:
+ if skuname == TAB_COMMON:
+ continue
+ for defaultstorenameitem in Pcd.SkuOverrideValues[skuname]:
+ CApp = CApp + "// SkuName: %s, DefaultStoreName: %s \n" % (skuname, defaultstorenameitem)
+ for index in Pcd.SkuOverrideValues[skuname][defaultstorenameitem]:
+ if index:
+ ActualCap.append(index)
+ for FieldList in [Pcd.SkuOverrideValues[skuname][defaultstorenameitem][index]]:
+ if not FieldList:
+ continue
+ for FieldName in FieldList:
+ FieldName = "." + FieldName
+ IsArray = _IsFieldValueAnArray(FieldList[FieldName.strip(".")][0])
+ if IsArray and not (FieldList[FieldName.strip(".")][0].startswith('{GUID') and FieldList[FieldName.strip(".")][0].endswith('}')):
+ try:
+ Value = ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2]))
+ Value, ValueSize = ParseFieldValue(Value)
+ if not Pcd.IsArray():
+ CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]);
+ else:
+ NewFieldName = ''
+ FieldName_ori = FieldName.strip('.')
+ while '[' in FieldName:
+ NewFieldName = NewFieldName + FieldName.split('[', 1)[0] + '[0]'
+ Array_Index = int(FieldName.split('[', 1)[1].split(']', 1)[0])
+ FieldName = FieldName.split(']', 1)[1]
+ FieldName = NewFieldName + FieldName
+ while '[' in FieldName and not Pcd.IsArray():
+ FieldName = FieldName.rsplit('[', 1)[0]
+ CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), Array_Index + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], FieldList[FieldName_ori][0])
+ if Pcd.PcdFieldValueFromFdf:
+ CApp = CApp + "// From fdf \n"
+ for FieldName in Pcd.PcdFieldValueFromFdf:
+ FieldName = "." + FieldName
+ IsArray = _IsFieldValueAnArray(Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][0])
+ if IsArray and not (Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][0].startswith('{GUID') and Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][0].endswith('}')):
+ try:
+ Value = ValueExpressionEx(Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][1], Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][2]))
+ Value, ValueSize = ParseFieldValue(Value)
+ if not Pcd.IsArray():
+ CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][1], Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][2], Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][0]);
+ else:
+ NewFieldName = ''
+ FieldName_ori = FieldName.strip('.')
+ while '[' in FieldName:
+ NewFieldName = NewFieldName + FieldName.split('[', 1)[0] + '[0]'
+ Array_Index = int(FieldName.split('[', 1)[1].split(']', 1)[0])
+ FieldName = FieldName.split(']', 1)[1]
+ FieldName = NewFieldName + FieldName
+ while '[' in FieldName:
+ FieldName = FieldName.rsplit('[', 1)[0]
+ CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %s Value %s \n' % (Pcd.DatumType, FieldName.strip("."), Array_Index + 1, Pcd.PcdFieldValueFromFdf[FieldName_ori][1], Pcd.PcdFieldValueFromFdf[FieldName_ori][2], Pcd.PcdFieldValueFromFdf[FieldName_ori][0])
+ if Pcd.PcdFieldValueFromComm:
+ CApp = CApp + "// From Command Line \n"
+ for FieldName in Pcd.PcdFieldValueFromComm:
+ FieldName = "." + FieldName
+ IsArray = _IsFieldValueAnArray(Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0])
+ if IsArray and not (Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0].startswith('{GUID') and Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0].endswith('}')):
+ try:
+ Value = ValueExpressionEx(Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), Pcd.PcdFieldValueFromComm[FieldName.strip(".")][1], Pcd.PcdFieldValueFromComm[FieldName.strip(".")][2]))
+ Value, ValueSize = ParseFieldValue(Value)
+ if not Pcd.IsArray():
+ CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), Pcd.PcdFieldValueFromComm[FieldName.strip(".")][1], Pcd.PcdFieldValueFromComm[FieldName.strip(".")][2], Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0]);
+ else:
+ NewFieldName = ''
+ FieldName_ori = FieldName.strip('.')
+ while '[' in FieldName:
+ NewFieldName = NewFieldName + FieldName.split('[', 1)[0] + '[0]'
+ Array_Index = int(FieldName.split('[', 1)[1].split(']', 1)[0])
+ FieldName = FieldName.split(']', 1)[1]
+ FieldName = NewFieldName + FieldName
+ while '[' in FieldName and not Pcd.IsArray():
+ FieldName = FieldName.rsplit('[', 1)[0]
+ CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), Array_Index + 1, Pcd.PcdFieldValueFromComm[FieldName_ori][1], Pcd.PcdFieldValueFromComm[FieldName_ori][2], Pcd.PcdFieldValueFromComm[FieldName_ori][0])
+ if Pcd.GetPcdMaxSize():
+ CApp = CApp + " *Size = (%d > *Size ? %d : *Size); // The Pcd maxsize is %d \n" % (Pcd.GetPcdMaxSize(), Pcd.GetPcdMaxSize(), Pcd.GetPcdMaxSize())
+ ArraySizeByAssign = self.CalculateActualCap(ActualCap)
+ if ArraySizeByAssign > 1:
+ CApp = CApp + " *Size = (%d > *Size ? %d : *Size); \n" % (ArraySizeByAssign, ArraySizeByAssign)
+ CApp = CApp + "}\n"
+ return CApp
+ def CalculateActualCap(self,ActualCap):
+ if not ActualCap:
+ return 1
+ maxsize = 1
+ for item in ActualCap:
+ index_elements = ArrayIndex.findall(item)
+ rt = 1
+ for index_e in index_elements:
+ index_num = index_e.lstrip("[").rstrip("]").strip()
+ if not index_num:
+ # Not support flexiable pcd array assignment
+ return 1
+ index_num = int(index_num,16) if index_num.startswith(("0x","0X")) else int(index_num)
+ rt = rt * (index_num+1)
+ if rt >maxsize:
+ maxsize = rt
+
+ return maxsize
+
+ @staticmethod
+ def GenerateSizeStatments(Pcd,skuname,defaultstorename):
+ if Pcd.IsArray():
+ r_datatype = [Pcd.BaseDatumType]
+ lastoneisEmpty = False
+ for dem in Pcd.Capacity:
+ if lastoneisEmpty:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))))
+ if dem == '0' or dem == "-1":
+ r_datatype.append("[1]")
+ lastoneisEmpty = True
+ else:
+ r_datatype.append("[" + dem + "]")
+
+ if Pcd.Type in [MODEL_PCD_DYNAMIC_EX_HII, MODEL_PCD_DYNAMIC_HII]:
+ PcdDefValue = Pcd.SkuInfoList.get(skuname).DefaultStoreDict.get(defaultstorename)
+ elif Pcd.Type in [MODEL_PCD_DYNAMIC_EX_DEFAULT,MODEL_PCD_DYNAMIC_VPD,MODEL_PCD_DYNAMIC_DEFAULT,MODEL_PCD_DYNAMIC_EX_VPD]:
+ PcdDefValue = Pcd.SkuInfoList.get(skuname).DefaultValue
+ else:
+ PcdDefValue = Pcd.DefaultValue
+ if lastoneisEmpty:
+ if "{CODE(" not in PcdDefValue:
+ sizebasevalue_plus = "(%s / sizeof(%s) + 1)" % ((DscBuildData.GetStructurePcdMaxSize(Pcd), Pcd.BaseDatumType))
+ sizebasevalue = "(%s / sizeof(%s))" % ((DscBuildData.GetStructurePcdMaxSize(Pcd), Pcd.BaseDatumType))
+ sizeof = "sizeof(%s)" % Pcd.BaseDatumType
+ CApp = ' int ArraySize = %s %% %s ? %s : %s ;\n' % ( (DscBuildData.GetStructurePcdMaxSize(Pcd), sizeof, sizebasevalue_plus, sizebasevalue))
+ CApp += ' Size = ArraySize * sizeof(%s); \n' % Pcd.BaseDatumType
+ else:
+ CApp = " Size = 0;\n"
+ else:
+ CApp = ' Size = sizeof(%s);\n' % ("".join(r_datatype) )
+ else:
+ CApp = ' Size = sizeof(%s);\n' % (Pcd.DatumType)
+ CApp = CApp + ' Cal_%s_%s_Size(&Size);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+ return CApp
+
+ def GetIndicator(self,index,FieldName,Pcd):
+ def cleanupindex(indexstr):
+ return indexstr.strip("[").strip("]").strip()
+ index_elements = ArrayIndex.findall(index)
+ pcd_capacity = Pcd.Capacity
+ if index:
+ indicator = "(Pcd"
+ if len(pcd_capacity)>2:
+ for i in range(0,len(index_elements)):
+ index_ele = index_elements[i]
+ index_num = index_ele.strip("[").strip("]").strip()
+ if i == len(index_elements) -2:
+ indicator += "+ %d*Size/sizeof(%s)/%d + %s)" %(int(cleanupindex(index_elements[i+1])),Pcd.BaseDatumType,reduce(lambda x,y: int(x)*int(y),pcd_capacity[:-1]), cleanupindex(index_elements[i]))
+ break
+ else:
+ indicator += " + %d*%s*Size/sizeof(%s)/%d" %(int(cleanupindex(index_elements[i])),reduce(lambda x,y: int(x)*int(y),pcd_capacity[i+1:-1]),Pcd.BaseDatumType,reduce(lambda x,y: int(x)*int(y),pcd_capacity[:-1]))
+ elif len(pcd_capacity) == 2:
+ indicator += "+ %d*Size/sizeof(%s)/%d + %s)" %(int(cleanupindex(index_elements[0])),Pcd.BaseDatumType,int(pcd_capacity[0]), index_elements[1].strip("[").strip("]").strip())
+ elif len(pcd_capacity) == 1:
+ index_ele = index_elements[0]
+ index_num = index_ele.strip("[").strip("]").strip()
+ indicator += " + %s)" % (index_num)
+ else:
+ indicator = "Pcd"
+ if FieldName:
+ indicator += "->" + FieldName
+ return indicator
+
+ def GetStarNum(self,Pcd):
+ if not Pcd.IsArray():
+ return 1
+ elif Pcd.IsSimpleTypeArray():
+ return len(Pcd.Capacity)
+ else:
+ return len(Pcd.Capacity) + 1
+ def GenerateDefaultValueAssignFunction(self, Pcd):
+ CApp = "// Default value in Dec \n"
+ CApp = CApp + "void Assign_%s_%s_Default_Value(%s *Pcd){\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.BaseDatumType)
+ CApp = CApp + ' UINT32 FieldSize;\n'
+ CApp = CApp + ' CHAR8 *Value;\n'
+ CApp = CApp + ' UINT32 PcdArraySize;\n'
+ DefaultValueFromDec = Pcd.DefaultValueFromDec
+ IsArray = _IsFieldValueAnArray(Pcd.DefaultValueFromDec)
+ if IsArray:
+ try:
+ DefaultValueFromDec = ValueExpressionEx(Pcd.DefaultValueFromDec, TAB_VOID)(True)
+ except BadExpression:
+ EdkLogger.error("Build", FORMAT_INVALID, "Invalid value format for %s.%s, from DEC: %s" %
+ (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, DefaultValueFromDec))
+ DefaultValueFromDec = StringToArray(DefaultValueFromDec)
+ Value, ValueSize = ParseFieldValue (DefaultValueFromDec)
+ if IsArray:
+ #
+ # Use memcpy() to copy value into field
+ #
+ if Pcd.IsArray():
+ pcdarraysize = Pcd.PcdArraySize()
+ if "{CODE(" in Pcd.DefaultValueFromDec:
+ if Pcd.Capacity[-1] != "-1":
+ CApp = CApp + '__STATIC_ASSERT(sizeof(%s_%s_INIT_Value) < %d * sizeof(%s), "Pcd %s.%s Value in Dec exceed the array capability %s"); // From %s Line %s \n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,Pcd.DefaultValueFromDecInfo[0],Pcd.DefaultValueFromDecInfo[1])
+ CApp = CApp + ' PcdArraySize = sizeof(%s_%s_INIT_Value);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+ CApp = CApp + ' memcpy (Pcd, %s_%s_INIT_Value,PcdArraySize);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+ else:
+ if Pcd.Capacity[-1] != "-1":
+ CApp = CApp + '__STATIC_ASSERT(%d < %d * sizeof(%s), "Pcd %s.%s Value in Dec exceed the array capability %s"); // From %s Line %s \n' % (ValueSize,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,Pcd.DefaultValueFromDecInfo[0],Pcd.DefaultValueFromDecInfo[1])
+ CApp = CApp + ' PcdArraySize = %d;\n' % ValueSize
+ CApp = CApp + ' Value = %s; // From DEC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DefaultValueFromDec)
+ CApp = CApp + ' memcpy (Pcd, Value, PcdArraySize);\n'
+ else:
+ if "{CODE(" in Pcd.DefaultValueFromDec:
+ CApp = CApp + ' PcdArraySize = sizeof(%s_%s_INIT_Value);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+ CApp = CApp + ' memcpy (Pcd, &%s_%s_INIT_Value,PcdArraySize);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+ else:
+ CApp = CApp + ' Value = %s; // From DEC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DefaultValueFromDec)
+ CApp = CApp + ' memcpy (Pcd, Value, %d);\n' % (ValueSize)
+ elif isinstance(Value, str):
+ CApp = CApp + ' Pcd = %s; // From DEC Default Value %s\n' % (Value, Pcd.DefaultValueFromDec)
+ for index in Pcd.DefaultValues:
+ FieldList = Pcd.DefaultValues[index]
+ if not FieldList:
+ continue
+ for FieldName in FieldList:
+ IsArray = _IsFieldValueAnArray(FieldList[FieldName][0])
+ if IsArray:
+ try:
+ FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], TAB_VOID, self._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
+
+ try:
+ Value, ValueSize = ParseFieldValue (FieldList[FieldName][0])
+ except Exception:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
+
+ indicator = self.GetIndicator(index, FieldName,Pcd)
+ if IsArray:
+ #
+ # Use memcpy() to copy value into field
+ #
+ CApp = CApp + ' FieldSize = __FIELD_SIZE(%s, %s);\n' % (Pcd.BaseDatumType, FieldName)
+ CApp = CApp + ' Value = %s; // From %s Line %d Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + ' __STATIC_ASSERT((__FIELD_SIZE(%s, %s) >= %d) || (__FIELD_SIZE(%s, %s) == 0), "Input buffer exceeds the buffer array"); // From %s Line %d Value %s\n' % (Pcd.BaseDatumType, FieldName, ValueSize, Pcd.BaseDatumType, FieldName, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + ' memcpy (&%s, Value, (FieldSize > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (indicator, ValueSize, ValueSize)
+ elif isinstance(Value, str):
+ CApp = CApp + ' %s = %s; // From %s Line %d Value %s\n' % (indicator, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ else:
+ if '[' in FieldName and ']' in FieldName:
+ Index = int(FieldName.split('[')[1].split(']')[0])
+ CApp = CApp + ' __STATIC_ASSERT((%d < __ARRAY_SIZE(Pcd->%s)) || (__ARRAY_SIZE(Pcd->%s) == 0), "array index exceeds the array number"); // From %s Line %d Index of %s\n' % (Index, FieldName.split('[')[0], FieldName.split('[')[0], FieldList[FieldName][1], FieldList[FieldName][2], FieldName)
+ if ValueSize > 4:
+ CApp = CApp + ' %s = %dULL; // From %s Line %d Value %s\n' % (indicator, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ else:
+ CApp = CApp + ' %s = %d; // From %s Line %d Value %s\n' % (indicator, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + "}\n"
+ return CApp
+
+ @staticmethod
+ def GenerateDefaultValueAssignStatement(Pcd):
+ CApp = ' Assign_%s_%s_Default_Value(Pcd);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+ return CApp
+
+ def GetPcdDscRawDefaultValue(self,Pcd, SkuName,DefaultStoreName):
+ if Pcd.Type in PCD_DYNAMIC_TYPE_SET or Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
+ if (SkuName, DefaultStoreName) == (TAB_DEFAULT, TAB_DEFAULT_STORES_DEFAULT):
+ pcddefaultvalue = Pcd.DefaultFromDSC.get(TAB_DEFAULT, {}).get(TAB_DEFAULT_STORES_DEFAULT) if Pcd.DefaultFromDSC else None
+ else:
+ pcddefaultvalue = Pcd.DscRawValue.get(SkuName, {}).get(DefaultStoreName)
+ else:
+ pcddefaultvalue = Pcd.DscRawValue.get(SkuName, {}).get(TAB_DEFAULT_STORES_DEFAULT)
+
+ return pcddefaultvalue
+ def GetPcdDscRawValueInfo(self,Pcd, SkuName,DefaultStoreName):
+ DscValueInfo = Pcd.DscRawValueInfo.get(SkuName, {}).get(DefaultStoreName)
+ if DscValueInfo:
+ dscfilepath,lineno = DscValueInfo
+ else:
+ dscfilepath = self.MetaFile.File
+ lineno = ""
+ return dscfilepath,lineno
+
+ def GenerateInitValueFunction(self, Pcd, SkuName, DefaultStoreName):
+ CApp = "// Value in Dsc for Sku: %s, DefaultStore %s\n" % (SkuName, DefaultStoreName)
+ CApp = CApp + "void Assign_%s_%s_%s_%s_Value(%s *Pcd){\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, SkuName, DefaultStoreName, Pcd.BaseDatumType)
+ CApp = CApp + ' UINT32 FieldSize;\n'
+ CApp = CApp + ' CHAR8 *Value;\n'
+ CApp = CApp + ' UINT32 PcdArraySize;\n'
+
+ CApp = CApp + "// SkuName: %s, DefaultStoreName: %s \n" % (TAB_DEFAULT, TAB_DEFAULT_STORES_DEFAULT)
+ inherit_OverrideValues = Pcd.SkuOverrideValues[SkuName]
+ dscfilepath,lineno = self.GetPcdDscRawValueInfo(Pcd, SkuName, DefaultStoreName)
+ if lineno:
+ valuefrom = "%s Line %s" % (dscfilepath,str(lineno))
+ else:
+ valuefrom = dscfilepath
+
+ pcddefaultvalue = self.GetPcdDscRawDefaultValue(Pcd, SkuName, DefaultStoreName)
+ if pcddefaultvalue:
+ FieldList = pcddefaultvalue
+ IsArray = _IsFieldValueAnArray(FieldList)
+ if IsArray:
+ if "{CODE(" not in FieldList:
+ try:
+ FieldList = ValueExpressionEx(FieldList, TAB_VOID)(True)
+ except BadExpression:
+ EdkLogger.error("Build", FORMAT_INVALID, "Invalid value format for %s.%s, from DSC: %s" %
+ (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldList))
+ Value, ValueSize = ParseFieldValue (FieldList)
+
+ if (SkuName, DefaultStoreName) == (TAB_DEFAULT, TAB_DEFAULT_STORES_DEFAULT):
+ if isinstance(Value, str):
+ if "{CODE(" in Value:
+ if Pcd.IsArray() and Pcd.Capacity[-1] != "-1":
+ pcdarraysize = Pcd.PcdArraySize()
+ CApp = CApp + '__STATIC_ASSERT(sizeof(%s_%s_%s_%s_Value) < %d * sizeof(%s), "Pcd %s.%s Value in Dsc exceed the array capability %s"); // From %s \n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType, valuefrom)
+ CApp = CApp+ ' PcdArraySize = sizeof(%s_%s_%s_%s_Value);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+ CApp = CApp + ' memcpy (Pcd, &%s_%s_%s_%s_Value,PcdArraySize);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+ else:
+ CApp = CApp + ' Pcd = %s; // From DSC Default Value %s\n' % (Value, Pcd.DefaultFromDSC.get(TAB_DEFAULT, {}).get(TAB_DEFAULT_STORES_DEFAULT, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
+ elif IsArray:
+ #
+ # Use memcpy() to copy value into field
+ #
+ if Pcd.IsArray():
+ pcdarraysize = Pcd.PcdArraySize()
+ if "{CODE(" in pcddefaultvalue:
+ if Pcd.Capacity[-1] != "-1":
+ CApp = CApp + '__STATIC_ASSERT(sizeof(%s_%s_%s_%s_Value) < %d * sizeof(%s), "Pcd %s.%s Value in Dsc exceed the array capability %s"); // From %s \n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,valuefrom)
+ CApp = CApp + ' PcdArraySize = sizeof(%s_%s_%s_%s_Value);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+ CApp = CApp + ' memcpy (Pcd, %s_%s_%s_%s_Value, PcdArraySize);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+ else:
+ if Pcd.Capacity[-1] != "-1":
+ CApp = CApp + '__STATIC_ASSERT(%d < %d * sizeof(%s), "Pcd %s.%s Value in Dsc exceed the array capability %s"); // From %s \n' % (ValueSize,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,valuefrom)
+ CApp = CApp + ' PcdArraySize = %d;\n' % ValueSize
+ CApp = CApp + ' Value = %s; // From DSC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DefaultFromDSC.get(TAB_DEFAULT, {}).get(TAB_DEFAULT_STORES_DEFAULT, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
+ CApp = CApp + ' memcpy (Pcd, Value, PcdArraySize);\n'
+ else:
+ if "{CODE(" in pcddefaultvalue:
+ CApp = CApp + ' PcdArraySize = %d < sizeof(%s) * %d ? %d: sizeof(%s) * %d;\n ' % (ValueSize,Pcd.BaseDatumType,pcdarraysize,ValueSize,Pcd.BaseDatumType,pcdarraysize)
+ CApp = CApp + ' memcpy (Pcd, &%s_%s_%s_%s_Value, PcdArraySize);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+ else:
+ CApp = CApp + ' Value = %s; // From DSC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DefaultFromDSC.get(TAB_DEFAULT, {}).get(TAB_DEFAULT_STORES_DEFAULT, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
+ CApp = CApp + ' memcpy (Pcd, Value, %d);\n' % (ValueSize)
+ else:
+ if isinstance(Value, str):
+ if "{CODE(" in Value:
+ if Pcd.IsArray() and Pcd.Capacity[-1] != "-1":
+ pcdarraysize = Pcd.PcdArraySize()
+ CApp = CApp + '__STATIC_ASSERT(sizeof(%s_%s_%s_%s_Value) < %d * sizeof(%s), "Pcd %s.%s Value in Dsc exceed the array capability %s"); // From %s \n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,valuefrom)
+ CApp = CApp + ' PcdArraySize = sizeof(%s_%s_%s_%s_Value);\n '% (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+ CApp = CApp + ' memcpy (Pcd, &%s_%s_%s_%s_Value, PcdArraySize);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+ else:
+ CApp = CApp + ' Pcd = %s; // From DSC Default Value %s\n' % (Value, Pcd.DscRawValue.get(SkuName, {}).get(DefaultStoreName))
+ elif IsArray:
+ #
+ # Use memcpy() to copy value into field
+ #
+ if Pcd.IsArray():
+ pcdarraysize = Pcd.PcdArraySize()
+ if "{CODE(" in pcddefaultvalue:
+ if Pcd.Capacity[-1] != "-1":
+ CApp = CApp + '__STATIC_ASSERT(sizeof(%s_%s_%s_%s_Value) < %d * sizeof(%s), "Pcd %s.%s Value in Dsc exceed the array capability %s"); // From %s \n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,valuefrom)
+ CApp + ' PcdArraySize = sizeof(%s_%s_%s_%s_Value);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+ CApp = CApp + ' memcpy (Pcd, %s_%s_%s_%s_Value, PcdArraySize);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+ else:
+ if Pcd.Capacity[-1] != "-1":
+ CApp = CApp + '__STATIC_ASSERT(%d < %d * sizeof(%s), "Pcd %s.%s Value in Dsc exceed the array capability %s"); // From %s \n' % (ValueSize,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,valuefrom)
+ CApp = CApp + ' PcdArraySize = %d;\n' % ValueSize
+ CApp = CApp + ' Value = %s; // From DSC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DscRawValue.get(TAB_DEFAULT, {}).get(TAB_DEFAULT_STORES_DEFAULT, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
+ CApp = CApp + ' memcpy (Pcd, Value, PcdArraySize);\n'
+ else:
+ if "{CODE(" in pcddefaultvalue:
+ CApp = CApp + ' PcdArraySize = %d < sizeof(%s) * %d ? %d: sizeof(%s) * %d;\n ' % (ValueSize,Pcd.BaseDatumType,pcdarraysize,ValueSize,Pcd.BaseDatumType,pcdarraysize)
+ CApp = CApp + ' memcpy (Pcd, &%s_%s_%s_%s_Value, PcdArraySize);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+ else:
+ CApp = CApp + ' Value = %s; // From DSC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DscRawValue.get(SkuName, {}).get(DefaultStoreName))
+ CApp = CApp + ' memcpy (Pcd, Value, %d);\n' % (ValueSize)
+
+ inheritvalue = inherit_OverrideValues.get(DefaultStoreName)
+ if not inheritvalue:
+ inheritvalue = []
+ for index in inheritvalue:
+ FieldList = inheritvalue[index]
+ if not FieldList:
+ continue
+ if (SkuName, DefaultStoreName) == (TAB_DEFAULT, TAB_DEFAULT_STORES_DEFAULT) or (( (SkuName, '') not in Pcd.ValueChain) and ( (SkuName, DefaultStoreName) not in Pcd.ValueChain )):
+ for FieldName in FieldList:
+ indicator = self.GetIndicator(index, FieldName,Pcd)
+ IsArray = _IsFieldValueAnArray(FieldList[FieldName][0])
+ if IsArray:
+ try:
+ FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], TAB_VOID, self._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
+ try:
+ Value, ValueSize = ParseFieldValue (FieldList[FieldName][0])
+ except Exception:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
+ if isinstance(Value, str):
+ CApp = CApp + ' Pcd->%s = %s; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ elif IsArray:
+ #
+ # Use memcpy() to copy value into field
+ #
+ CApp = CApp + ' FieldSize = __FIELD_SIZE(%s, %s);\n' % (Pcd.BaseDatumType, FieldName)
+ CApp = CApp + ' Value = %s; // From %s Line %d Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + ' __STATIC_ASSERT((__FIELD_SIZE(%s, %s) >= %d) || (__FIELD_SIZE(%s, %s) == 0), "Input buffer exceeds the buffer array"); // From %s Line %d Value %s\n' % (Pcd.BaseDatumType, FieldName, ValueSize, Pcd.BaseDatumType, FieldName, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + ' memcpy (&%s, Value, (FieldSize > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (indicator, ValueSize, ValueSize)
+ else:
+ if '[' in FieldName and ']' in FieldName:
+ Index = int(FieldName.split('[')[1].split(']')[0])
+ CApp = CApp + ' __STATIC_ASSERT((%d < __ARRAY_SIZE(Pcd->%s)) || (__ARRAY_SIZE(Pcd->%s) == 0), "array index exceeds the array number"); // From %s Line %d Index of %s\n' % (Index, FieldName.split('[')[0], FieldName.split('[')[0], FieldList[FieldName][1], FieldList[FieldName][2], FieldName)
+ if ValueSize > 4:
+ CApp = CApp + ' %s = %dULL; // From %s Line %d Value %s\n' % (indicator, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ else:
+ CApp = CApp + ' %s = %d; // From %s Line %d Value %s\n' % (indicator, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + "}\n"
+ return CApp
+
+ @staticmethod
+ def GenerateInitValueStatement(Pcd, SkuName, DefaultStoreName):
+ CApp = ' Assign_%s_%s_%s_%s_Value(Pcd);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, SkuName, DefaultStoreName)
+ return CApp
+
+ def GenerateCommandLineValue(self, Pcd):
+ CApp = "// Value in CommandLine\n"
+ CApp = CApp + "void Assign_%s_%s_CommandLine_Value(%s *Pcd){\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.BaseDatumType)
+ CApp = CApp + ' UINT32 FieldSize;\n'
+ CApp = CApp + ' CHAR8 *Value;\n'
+
+ pcddefaultvalue = Pcd.PcdValueFromComm
+ for FieldList in [pcddefaultvalue, Pcd.PcdFieldValueFromComm]:
+ if not FieldList:
+ continue
+ if pcddefaultvalue and FieldList == pcddefaultvalue:
+ IsArray = _IsFieldValueAnArray(FieldList)
+ if IsArray:
+ try:
+ FieldList = ValueExpressionEx(FieldList, TAB_VOID)(True)
+ except BadExpression:
+ EdkLogger.error("Build", FORMAT_INVALID, "Invalid value format for %s.%s, from Command: %s" %
+ (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldList))
+ Value, ValueSize = ParseFieldValue (FieldList)
+
+ if isinstance(Value, str):
+ CApp = CApp + ' Pcd = %s; // From Command Line \n' % (Value)
+ elif IsArray:
+ #
+ # Use memcpy() to copy value into field
+ #
+ CApp = CApp + ' Value = %s; // From Command Line.\n' % (DscBuildData.IntToCString(Value, ValueSize))
+ CApp = CApp + ' memcpy (Pcd, Value, %d);\n' % (ValueSize)
+ continue
+ for FieldName in FieldList:
+ IsArray = _IsFieldValueAnArray(FieldList[FieldName][0])
+ if IsArray:
+ try:
+ FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], TAB_VOID, self._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
+ except:
+ print("error")
+ try:
+ Value, ValueSize = ParseFieldValue (FieldList[FieldName][0])
+ except Exception:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
+ if isinstance(Value, str):
+ CApp = CApp + ' Pcd->%s = %s; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ elif IsArray:
+ #
+ # Use memcpy() to copy value into field
+ #
+ CApp = CApp + ' FieldSize = __FIELD_SIZE(%s, %s);\n' % (Pcd.BaseDatumType, FieldName)
+ CApp = CApp + ' Value = %s; // From %s Line %d Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + ' __STATIC_ASSERT((__FIELD_SIZE(%s, %s) >= %d) || (__FIELD_SIZE(%s, %s) == 0), "Input buffer exceeds the buffer array"); // From %s Line %d Value %s\n' % (Pcd.BaseDatumType, FieldName, ValueSize, Pcd.BaseDatumType, FieldName, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + ' memcpy (&Pcd->%s, Value, (FieldSize > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, ValueSize, ValueSize)
+ else:
+ if '[' in FieldName and ']' in FieldName:
+ Index = int(FieldName.split('[')[1].split(']')[0])
+ CApp = CApp + ' __STATIC_ASSERT((%d < __ARRAY_SIZE(Pcd->%s)) || (__ARRAY_SIZE(Pcd->%s) == 0), "array index exceeds the array number"); // From %s Line %d Index of %s\n' % (Index, FieldName.split('[')[0], FieldName.split('[')[0], FieldList[FieldName][1], FieldList[FieldName][2], FieldName)
+ if ValueSize > 4:
+ CApp = CApp + ' Pcd->%s = %dULL; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ else:
+ CApp = CApp + ' Pcd->%s = %d; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + "}\n"
+ return CApp
+
+ @staticmethod
+ def GenerateCommandLineValueStatement(Pcd):
+ CApp = ' Assign_%s_%s_CommandLine_Value(Pcd);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+ return CApp
+ def GenerateFdfValue(self,Pcd):
+ CApp = "// Value in Fdf\n"
+ CApp = CApp + "void Assign_%s_%s_Fdf_Value(%s *Pcd){\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.BaseDatumType)
+ CApp = CApp + ' UINT32 FieldSize;\n'
+ CApp = CApp + ' CHAR8 *Value;\n'
+
+ pcddefaultvalue = Pcd.PcdValueFromFdf
+ for FieldList in [pcddefaultvalue,Pcd.PcdFieldValueFromFdf]:
+ if not FieldList:
+ continue
+ if pcddefaultvalue and FieldList == pcddefaultvalue:
+ IsArray = _IsFieldValueAnArray(FieldList)
+ if IsArray:
+ try:
+ FieldList = ValueExpressionEx(FieldList, TAB_VOID)(True)
+ except BadExpression:
+ EdkLogger.error("Build", FORMAT_INVALID, "Invalid value format for %s.%s, from Fdf: %s" %
+ (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldList))
+ Value, ValueSize = ParseFieldValue (FieldList)
+
+ if isinstance(Value, str):
+ CApp = CApp + ' Pcd = %s; // From Fdf \n' % (Value)
+ elif IsArray:
+ #
+ # Use memcpy() to copy value into field
+ #
+ CApp = CApp + ' Value = %s; // From Fdf .\n' % (DscBuildData.IntToCString(Value, ValueSize))
+ CApp = CApp + ' memcpy (Pcd, Value, %d);\n' % (ValueSize)
+ continue
+ for FieldName in FieldList:
+ IsArray = _IsFieldValueAnArray(FieldList[FieldName][0])
+ if IsArray:
+ try:
+ FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], TAB_VOID, self._GuidDict)(True)
+ except BadExpression:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
+ (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
+ except:
+ print("error")
+ try:
+ Value, ValueSize = ParseFieldValue (FieldList[FieldName][0])
+ except Exception:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName,FieldName)),FieldList[FieldName][1], FieldList[FieldName][2]))
+ if isinstance(Value, str):
+ CApp = CApp + ' Pcd->%s = %s; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ elif IsArray:
+ #
+ # Use memcpy() to copy value into field
+ #
+ CApp = CApp + ' FieldSize = __FIELD_SIZE(%s, %s);\n' % (Pcd.BaseDatumType, FieldName)
+ CApp = CApp + ' Value = %s; // From %s Line %d Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + ' __STATIC_ASSERT((__FIELD_SIZE(%s, %s) >= %d) || (__FIELD_SIZE(%s, %s) == 0), "Input buffer exceeds the buffer array"); // From %s Line %d Value %s\n' % (Pcd.BaseDatumType, FieldName, ValueSize, Pcd.BaseDatumType, FieldName, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + ' memcpy (&Pcd->%s, Value, (FieldSize > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, ValueSize, ValueSize)
+ else:
+ if '[' in FieldName and ']' in FieldName:
+ Index = int(FieldName.split('[')[1].split(']')[0])
+ CApp = CApp + ' __STATIC_ASSERT((%d < __ARRAY_SIZE(Pcd->%s)) || (__ARRAY_SIZE(Pcd->%s) == 0), "array index exceeds the array number"); // From %s Line %d Index of %s\n' % (Index, FieldName.split('[')[0], FieldName.split('[')[0], FieldList[FieldName][1], FieldList[FieldName][2], FieldName)
+ if ValueSize > 4:
+ CApp = CApp + ' Pcd->%s = %dULL; // From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ else:
+ CApp = CApp + ' Pcd->%s = %d; // From %s Line %s Value %s\n' % (FieldName, Value, FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+ CApp = CApp + "}\n"
+ return CApp
+
+ @staticmethod
+ def GenerateFdfValueStatement(Pcd):
+ CApp = ' Assign_%s_%s_Fdf_Value(Pcd);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+ return CApp
+
+ def GenerateInitializeFunc(self, SkuName, DefaultStore, Pcd, InitByteValue, CApp):
+ OverrideValues = {DefaultStore:{}}
+ if Pcd.SkuOverrideValues:
+ OverrideValues = Pcd.SkuOverrideValues[SkuName]
+ if not OverrideValues:
+ OverrideValues = {TAB_DEFAULT_STORES_DEFAULT:Pcd.DefaultValues}
+ for DefaultStoreName in OverrideValues:
+ CApp = CApp + 'void\n'
+ CApp = CApp + 'Initialize_%s_%s_%s_%s(\n' % (SkuName, DefaultStoreName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+ CApp = CApp + ' void\n'
+ CApp = CApp + ' )\n'
+ CApp = CApp + '{\n'
+ CApp = CApp + ' UINT32 Size;\n'
+ CApp = CApp + ' UINT32 FieldSize;\n'
+ CApp = CApp + ' CHAR8 *Value;\n'
+ CApp = CApp + ' UINT32 OriginalSize;\n'
+ CApp = CApp + ' VOID *OriginalPcd;\n'
+
+ CApp = CApp + ' %s *Pcd; // From %s Line %d \n' % (Pcd.BaseDatumType,Pcd.PkgPath, Pcd.PcdDefineLineNo)
+
+ CApp = CApp + '\n'
+
+ PcdDefaultValue = StringToArray(Pcd.DefaultValueFromDec.strip())
+
+ InitByteValue += '%s.%s.%s.%s|%s|%s\n' % (SkuName, DefaultStoreName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.DatumType, PcdDefaultValue)
+
+ #
+ # Get current PCD value and size
+ #
+ CApp = CApp + ' OriginalPcd = PcdGetPtr (%s, %s, %s, %s, &OriginalSize);\n' % (SkuName, DefaultStoreName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+
+ #
+ # Determine the size of the PCD. For simple structures, sizeof(TYPE) provides
+ # the correct value. For structures with a flexible array member, the flexible
+ # array member is detected, and the size is based on the highest index used with
+ # the flexible array member. The flexible array member must be the last field
+ # in a structure. The size formula for this case is:
+ # OFFSET_OF(FlexbleArrayField) + sizeof(FlexibleArray[0]) * (HighestIndex + 1)
+ #
+ CApp = CApp + DscBuildData.GenerateSizeStatments(Pcd,SkuName,DefaultStoreName)
+ if Pcd.IsArray() and Pcd.Capacity[-1] != "-1":
+ CApp = CApp + ' OriginalSize = OriginalSize < sizeof(%s) * %d? OriginalSize:sizeof(%s) * %d; \n' % (Pcd.BaseDatumType,Pcd.PcdArraySize(),Pcd.BaseDatumType,Pcd.PcdArraySize())
+ CApp = CApp + ' Size = sizeof(%s) * %d; \n' % (Pcd.BaseDatumType,Pcd.PcdArraySize())
+
+ #
+ # Allocate and zero buffer for the PCD
+ # Must handle cases where current value is smaller, larger, or same size
+ # Always keep that larger one as the current size
+ #
+ CApp = CApp + ' Size = (OriginalSize > Size ? OriginalSize : Size);\n'
+ CApp = CApp + ' Pcd = (%s *)malloc (Size);\n' % (Pcd.BaseDatumType,)
+ CApp = CApp + ' memset (Pcd, 0, Size);\n'
+
+ #
+ # Copy current PCD value into allocated buffer.
+ #
+ CApp = CApp + ' memcpy (Pcd, OriginalPcd, OriginalSize);\n'
+
+ #
+ # Assign field values in PCD
+ #
+ CApp = CApp + DscBuildData.GenerateDefaultValueAssignStatement(Pcd)
+ if Pcd.Type not in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
+ self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]:
+ for skuname in self.SkuIdMgr.GetSkuChain(SkuName):
+ storeset = [DefaultStoreName] if DefaultStoreName == TAB_DEFAULT_STORES_DEFAULT else [TAB_DEFAULT_STORES_DEFAULT, DefaultStoreName]
+ for defaultstorenameitem in storeset:
+ CApp = CApp + "// SkuName: %s, DefaultStoreName: %s \n" % (skuname, defaultstorenameitem)
+ CApp = CApp + DscBuildData.GenerateInitValueStatement(Pcd, skuname, defaultstorenameitem)
+ if skuname == SkuName:
+ break
+ else:
+ CApp = CApp + "// SkuName: %s, DefaultStoreName: STANDARD \n" % self.SkuIdMgr.SystemSkuId
+ CApp = CApp + DscBuildData.GenerateInitValueStatement(Pcd, self.SkuIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT)
+ CApp = CApp + DscBuildData.GenerateFdfValueStatement(Pcd)
+ CApp = CApp + DscBuildData.GenerateCommandLineValueStatement(Pcd)
+ #
+ # Set new PCD value and size
+ #
+ CApp = CApp + ' PcdSetPtr (%s, %s, %s, %s, Size, (void *)Pcd);\n' % (SkuName, DefaultStoreName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+
+ #
+ # Free PCD
+ #
+ CApp = CApp + ' free (Pcd);\n'
+ CApp = CApp + '}\n'
+ CApp = CApp + '\n'
+ return InitByteValue, CApp
+
+ def GenerateArrayAssignment(self, Pcd):
+ CApp = ""
+ if not Pcd:
+ return CApp
+ Demesion = ""
+ for d in Pcd.Capacity:
+ Demesion += "[]"
+
+ Value = Pcd.DefaultValueFromDec
+ if "{CODE(" in Pcd.DefaultValueFromDec:
+ realvalue = Pcd.DefaultValueFromDec.strip()[6:-2] # "{CODE(").rstrip(")}"
+ CApp += "static %s %s_%s_INIT_Value%s = %s;\n" % (Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,Demesion,realvalue)
+
+ if Pcd.Type in PCD_DYNAMIC_TYPE_SET | PCD_DYNAMIC_EX_TYPE_SET:
+ for skuname in Pcd.SkuInfoList:
+ skuinfo = Pcd.SkuInfoList[skuname]
+ if skuinfo.VariableName:
+ for defaultstore in skuinfo.DefaultStoreDict:
+ pcddscrawdefaultvalue = self.GetPcdDscRawDefaultValue(Pcd, skuname, defaultstore)
+ if pcddscrawdefaultvalue:
+ Value = skuinfo.DefaultStoreDict[defaultstore]
+ if "{CODE(" in Value:
+ realvalue = Value.strip()[6:-2] # "{CODE(").rstrip(")}"
+ CApp += "static %s %s_%s_%s_%s_Value%s = %s;\n" % (Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,defaultstore,Demesion,realvalue)
+ else:
+ pcddscrawdefaultvalue = self.GetPcdDscRawDefaultValue(Pcd, skuname, TAB_DEFAULT_STORES_DEFAULT)
+ if pcddscrawdefaultvalue:
+ Value = skuinfo.DefaultValue
+ if "{CODE(" in Value:
+ realvalue = Value.strip()[6:-2] # "{CODE(").rstrip(")}"
+ CApp += "static %s %s_%s_%s_%s_Value%s = %s;\n" % (Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,TAB_DEFAULT_STORES_DEFAULT,Demesion,realvalue)
+ else:
+ pcddscrawdefaultvalue = self.GetPcdDscRawDefaultValue(Pcd, TAB_DEFAULT, TAB_DEFAULT_STORES_DEFAULT)
+ if pcddscrawdefaultvalue:
+ if "{CODE(" in Pcd.DefaultValue:
+ realvalue = Pcd.DefaultValue.strip()[6:-2] # "{CODE(").rstrip(")}"
+ CApp += "static %s %s_%s_DEFAULT_STANDARD_Value%s = %s;\n" % (Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,Demesion,realvalue)
+
+ return CApp
+
+ def SkuOverrideValuesEmpty(self,OverrideValues):
+ if not OverrideValues:
+ return True
+ for key in OverrideValues:
+ if OverrideValues[key]:
+ return False
+ return True
+
+ def ParseCCFlags(self, ccflag):
+ ccflags = set()
+ ccflaglist = ccflag.split(" ")
+ i = 0
+ while i < len(ccflaglist):
+ item = ccflaglist[i].strip()
+ if item in (r"/D", r"/U","-D","-U"):
+ ccflags.add(" ".join((ccflaglist[i],ccflaglist[i+1])))
+ i = i+1
+ elif item.startswith((r"/D", r"/U","-D","-U")):
+ ccflags.add(item)
+ i +=1
+ return ccflags
+ def GenerateByteArrayValue (self, StructuredPcds):
+ #
+ # Generate/Compile/Run C application to determine if there are any flexible array members
+ #
+ if not StructuredPcds:
+ return
+
+ InitByteValue = ""
+ CApp = PcdMainCHeader
+
+ IncludeFiles = set()
+ for PcdName in StructuredPcds:
+ Pcd = StructuredPcds[PcdName]
+ for IncludeFile in Pcd.StructuredPcdIncludeFile:
+ if IncludeFile not in IncludeFiles:
+ IncludeFiles.add(IncludeFile)
+ CApp = CApp + '#include <%s>\n' % (IncludeFile)
+ CApp = CApp + '\n'
+ for Pcd in StructuredPcds.values():
+ CApp = CApp + self.GenerateArrayAssignment(Pcd)
+ for PcdName in StructuredPcds:
+ Pcd = StructuredPcds[PcdName]
+ CApp = CApp + self.GenerateSizeFunction(Pcd)
+ CApp = CApp + self.GenerateDefaultValueAssignFunction(Pcd)
+ CApp = CApp + self.GenerateFdfValue(Pcd)
+ CApp = CApp + self.GenerateCommandLineValue(Pcd)
+ if self.SkuOverrideValuesEmpty(Pcd.SkuOverrideValues) or Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
+ self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]:
+ CApp = CApp + self.GenerateInitValueFunction(Pcd, self.SkuIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT)
+ else:
+ for SkuName in self.SkuIdMgr.SkuOverrideOrder():
+ if SkuName not in Pcd.SkuOverrideValues:
+ continue
+ for DefaultStoreName in Pcd.SkuOverrideValues[SkuName]:
+ CApp = CApp + self.GenerateInitValueFunction(Pcd, SkuName, DefaultStoreName)
+ if self.SkuOverrideValuesEmpty(Pcd.SkuOverrideValues) or Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
+ self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]:
+ InitByteValue, CApp = self.GenerateInitializeFunc(self.SkuIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT, Pcd, InitByteValue, CApp)
+ else:
+ for SkuName in self.SkuIdMgr.SkuOverrideOrder():
+ if SkuName not in Pcd.SkuOverrideValues:
+ continue
+ for DefaultStoreName in Pcd.DefaultStoreName:
+ Pcd = StructuredPcds[PcdName]
+ InitByteValue, CApp = self.GenerateInitializeFunc(SkuName, DefaultStoreName, Pcd, InitByteValue, CApp)
+
+ CApp = CApp + 'VOID\n'
+ CApp = CApp + 'PcdEntryPoint(\n'
+ CApp = CApp + ' VOID\n'
+ CApp = CApp + ' )\n'
+ CApp = CApp + '{\n'
+ for Pcd in StructuredPcds.values():
+ if self.SkuOverrideValuesEmpty(Pcd.SkuOverrideValues) or Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD], self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]:
+ CApp = CApp + ' Initialize_%s_%s_%s_%s();\n' % (self.SkuIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+ else:
+ for SkuName in self.SkuIdMgr.SkuOverrideOrder():
+ if SkuName not in self.SkuIdMgr.AvailableSkuIdSet:
+ continue
+ for DefaultStoreName in Pcd.SkuOverrideValues[SkuName]:
+ CApp = CApp + ' Initialize_%s_%s_%s_%s();\n' % (SkuName, DefaultStoreName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+ CApp = CApp + '}\n'
+
+ CApp = CApp + PcdMainCEntry + '\n'
+
+ if not os.path.exists(self.OutputPath):
+ os.makedirs(self.OutputPath)
+ CAppBaseFileName = os.path.join(self.OutputPath, PcdValueInitName)
+ SaveFileOnChange(CAppBaseFileName + '.c', CApp, False)
+
+ MakeApp = PcdMakefileHeader
+ if sys.platform == "win32":
+ MakeApp = MakeApp + 'APPFILE = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s\%s.obj %s.obj\n' % (self.OutputPath, PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) + 'INC = '
+ else:
+ MakeApp = MakeApp + PcdGccMakefile
+ MakeApp = MakeApp + 'APPFILE = %s/%s\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s/%s.o %s.o\n' % (self.OutputPath, PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) + \
+ 'include $(MAKEROOT)/Makefiles/app.makefile\n' + 'INCLUDE +='
+
+ IncSearchList = []
+ PlatformInc = OrderedDict()
+ for Cache in self._Bdb._CACHE_.values():
+ if Cache.MetaFile.Ext.lower() != '.dec':
+ continue
+ if Cache.Includes:
+ if str(Cache.MetaFile.Path) not in PlatformInc:
+ PlatformInc[str(Cache.MetaFile.Path)] = []
+ PlatformInc[str(Cache.MetaFile.Path)].append (os.path.dirname(Cache.MetaFile.Path))
+ PlatformInc[str(Cache.MetaFile.Path)].extend (Cache.CommonIncludes)
+
+ PcdDependDEC = []
+ for Pcd in StructuredPcds.values():
+ for PackageDec in Pcd.PackageDecs:
+ Package = os.path.normpath(mws.join(GlobalData.gWorkspace, PackageDec))
+ if not os.path.exists(Package):
+ EdkLogger.error('Build', RESOURCE_NOT_AVAILABLE, "The dependent Package %s of PCD %s.%s is not exist." % (PackageDec, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
+ if Package not in PcdDependDEC:
+ PcdDependDEC.append(Package)
+
+ if PlatformInc and PcdDependDEC:
+ for pkg in PcdDependDEC:
+ if pkg in PlatformInc:
+ for inc in PlatformInc[pkg]:
+ #
+ # Get list of files in potential -I include path
+ #
+ FileList = os.listdir (str(inc))
+ #
+ # Skip -I include path if one of the include files required
+ # by PcdValueInit.c are present in the include paths from
+ # the DEC file. PcdValueInit.c must use the standard include
+ # files from the host compiler.
+ #
+ if 'stdio.h' in FileList:
+ continue
+ if 'stdlib.h' in FileList:
+ continue
+ if 'string.h' in FileList:
+ continue
+ MakeApp += '-I' + str(inc) + ' '
+ IncSearchList.append(inc)
+ MakeApp = MakeApp + '\n'
+
+ CC_FLAGS = LinuxCFLAGS
+ if sys.platform == "win32":
+ CC_FLAGS = WindowsCFLAGS
+ BuildOptions = OrderedDict()
+ for Options in self.BuildOptions:
+ if Options[2] != EDKII_NAME:
+ continue
+ Family = Options[0]
+ if Family and Family != self.ToolChainFamily:
+ continue
+ Target, Tag, Arch, Tool, Attr = Options[1].split("_")
+ if Tool != 'CC':
+ continue
+ if Attr != "FLAGS":
+ continue
+ if Target == TAB_STAR or Target == self._Target:
+ if Tag == TAB_STAR or Tag == self._Toolchain:
+ if 'COMMON' not in BuildOptions:
+ BuildOptions['COMMON'] = set()
+ if Arch == TAB_STAR:
+ BuildOptions['COMMON']|= self.ParseCCFlags(self.BuildOptions[Options])
+ if Arch in self.SupArchList:
+ if Arch not in BuildOptions:
+ BuildOptions[Arch] = set()
+ BuildOptions[Arch] |= self.ParseCCFlags(self.BuildOptions[Options])
+
+ if BuildOptions:
+ ArchBuildOptions = {arch:flags for arch,flags in BuildOptions.items() if arch != 'COMMON'}
+ if len(ArchBuildOptions.keys()) == 1:
+ BuildOptions['COMMON'] |= (list(ArchBuildOptions.values())[0])
+ elif len(ArchBuildOptions.keys()) > 1:
+ CommonBuildOptions = reduce(lambda x,y: x&y, ArchBuildOptions.values())
+ BuildOptions['COMMON'] |= CommonBuildOptions
+ ValueList = [item for item in BuildOptions['COMMON'] if item.startswith((r"/U","-U"))]
+ ValueList.extend([item for item in BuildOptions['COMMON'] if item.startswith((r"/D", "-D"))])
+ CC_FLAGS += " ".join(ValueList)
+ MakeApp += CC_FLAGS
+
+ if sys.platform == "win32":
+ MakeApp = MakeApp + PcdMakefileEnd
+ MakeApp = MakeApp + AppTarget % ("""\tcopy $(APPLICATION) $(APPFILE) /y """)
+ else:
+ MakeApp = MakeApp + AppTarget % ("""\tcp $(APPLICATION) $(APPFILE) """)
+ MakeApp = MakeApp + '\n'
+ IncludeFileFullPaths = []
+ for includefile in IncludeFiles:
+ for includepath in IncSearchList:
+ includefullpath = os.path.join(str(includepath), includefile)
+ if os.path.exists(includefullpath):
+ IncludeFileFullPaths.append(os.path.normpath(includefullpath))
+ break
+ SearchPathList = []
+ SearchPathList.append(os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "BaseTools/Source/C/Include")))
+ SearchPathList.append(os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "BaseTools/Source/C/Common")))
+ SearchPathList.extend(str(item) for item in IncSearchList)
+ IncFileList = GetDependencyList(IncludeFileFullPaths, SearchPathList)
+ for include_file in IncFileList:
+ MakeApp += "$(OBJECTS) : %s\n" % include_file
+ if sys.platform == "win32":
+ PcdValueCommonPath = os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source\C\Common\PcdValueCommon.c"))
+ MakeApp = MakeApp + '%s\PcdValueCommon.c : %s\n' % (self.OutputPath, PcdValueCommonPath)
+ MakeApp = MakeApp + '\tcopy /y %s $@\n' % (PcdValueCommonPath)
+ else:
+ PcdValueCommonPath = os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source/C/Common/PcdValueCommon.c"))
+ MakeApp = MakeApp + '%s/PcdValueCommon.c : %s\n' % (self.OutputPath, PcdValueCommonPath)
+ MakeApp = MakeApp + '\tcp -f %s %s/PcdValueCommon.c\n' % (PcdValueCommonPath, self.OutputPath)
+ MakeFileName = os.path.join(self.OutputPath, 'Makefile')
+ MakeApp += "$(OBJECTS) : %s\n" % MakeFileName
+ SaveFileOnChange(MakeFileName, MakeApp, False)
+
+ InputValueFile = os.path.join(self.OutputPath, 'Input.txt')
+ OutputValueFile = os.path.join(self.OutputPath, 'Output.txt')
+ SaveFileOnChange(InputValueFile, InitByteValue, False)
+
+ Dest_PcdValueInitExe = PcdValueInitName
+ if not sys.platform == "win32":
+ Dest_PcdValueInitExe = os.path.join(self.OutputPath, PcdValueInitName)
+ else:
+ Dest_PcdValueInitExe = os.path.join(self.OutputPath, PcdValueInitName) +".exe"
+ Messages = ''
+ if sys.platform == "win32":
+ MakeCommand = 'nmake -f %s' % (MakeFileName)
+ returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (MakeCommand)
+ Messages = StdOut
+ else:
+ MakeCommand = 'make -f %s' % (MakeFileName)
+ returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (MakeCommand)
+ Messages = StdErr
+
+ EdkLogger.verbose ('%s\n%s\n%s' % (MakeCommand, StdOut, StdErr))
+ Messages = Messages.split('\n')
+ MessageGroup = []
+ if returncode != 0:
+ CAppBaseFileName = os.path.join(self.OutputPath, PcdValueInitName)
+ File = open (CAppBaseFileName + '.c', 'r')
+ FileData = File.readlines()
+ File.close()
+ for Message in Messages:
+ if " error" in Message or "warning" in Message:
+ try:
+ FileInfo = Message.strip().split('(')
+ if len (FileInfo) > 1:
+ FileName = FileInfo [0]
+ FileLine = FileInfo [1].split (')')[0]
+ else:
+ FileInfo = Message.strip().split(':')
+ if len(FileInfo) < 2:
+ continue
+ FileName = FileInfo [0]
+ FileLine = FileInfo [1]
+ except:
+ continue
+ if "PcdValueInit.c" not in FileName:
+ continue
+ if FileLine.isdigit():
+ error_line = FileData[int (FileLine) - 1]
+ if r"//" in error_line:
+ c_line, dsc_line = error_line.split(r"//")
+ else:
+ dsc_line = error_line
+ message_itmes = Message.split(":")
+ Index = 0
+ if "PcdValueInit.c" not in Message:
+ if not MessageGroup:
+ MessageGroup.append(Message)
+ break
+ else:
+ for item in message_itmes:
+ if "PcdValueInit.c" in item:
+ Index = message_itmes.index(item)
+ message_itmes[Index] = dsc_line.strip()
+ break
+ MessageGroup.append(":".join(message_itmes[Index:]).strip())
+ continue
+ else:
+ MessageGroup.append(Message)
+ if MessageGroup:
+ EdkLogger.error("build", PCD_STRUCTURE_PCD_ERROR, "\n".join(MessageGroup) )
+ else:
+ EdkLogger.error('Build', COMMAND_FAILURE, 'Can not execute command: %s\n%s\n%s' % (MakeCommand, StdOut, StdErr))
+
+ if DscBuildData.NeedUpdateOutput(OutputValueFile, Dest_PcdValueInitExe, InputValueFile):
+ Command = Dest_PcdValueInitExe + ' -i %s -o %s' % (InputValueFile, OutputValueFile)
+ returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (Command)
+ EdkLogger.verbose ('%s\n%s\n%s' % (Command, StdOut, StdErr))
+ if returncode != 0:
+ EdkLogger.warn('Build', COMMAND_FAILURE, 'Can not collect output from command: %s\n%s\n' % (Command, StdOut, StdErr))
+
+ File = open (OutputValueFile, 'r')
+ FileBuffer = File.readlines()
+ File.close()
+
+ StructurePcdSet = []
+ for Pcd in FileBuffer:
+ PcdValue = Pcd.split ('|')
+ PcdInfo = PcdValue[0].split ('.')
+ StructurePcdSet.append((PcdInfo[0], PcdInfo[1], PcdInfo[2], PcdInfo[3], PcdValue[2].strip()))
+ return StructurePcdSet
+
+ @staticmethod
+ def NeedUpdateOutput(OutputFile, ValueCFile, StructureInput):
+ if not os.path.exists(OutputFile):
+ return True
+ if os.stat(OutputFile).st_mtime <= os.stat(ValueCFile).st_mtime:
+ return True
+ if os.stat(OutputFile).st_mtime <= os.stat(StructureInput).st_mtime:
+ return True
+ return False
+
+ ## Retrieve dynamic PCD settings
+ #
+ # @param Type PCD type
+ #
+ # @retval a dict object contains settings of given PCD type
+ #
+ def _GetDynamicPcd(self, Type):
+
+
+ Pcds = OrderedDict()
+ #
+ # tdict is a special dict kind of type, used for selecting correct
+ # PCD settings for certain ARCH and SKU
+ #
+ PcdDict = tdict(True, 4)
+ PcdList = []
+ # Find out all possible PCD candidates for self._Arch
+ RecordList = self._RawData[Type, self._Arch]
+ AvailableSkuIdSet = copy.copy(self.SkuIds)
+
+
+ for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dummy4, Dummy5 in RecordList:
+ SkuName = SkuName.upper()
+ SkuName = TAB_DEFAULT if SkuName == TAB_COMMON else SkuName
+ if SkuName not in AvailableSkuIdSet:
+ EdkLogger.error('build', PARAMETER_INVALID, 'Sku %s is not defined in [SkuIds] section' % SkuName,
+ File=self.MetaFile, Line=Dummy5)
+ if "." not in TokenSpaceGuid and "[" not in PcdCName and (PcdCName, TokenSpaceGuid, SkuName, Dummy5) not in PcdList:
+ PcdList.append((PcdCName, TokenSpaceGuid, SkuName, Dummy5))
+ PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid] = Setting
+
+ # Remove redundant PCD candidates, per the ARCH and SKU
+ for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdList:
+
+ Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid]
+ if Setting is None:
+ continue
+
+ PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
+ if MaxDatumSize:
+ if int(MaxDatumSize, 0) > 0xFFFF:
+ EdkLogger.error('build', FORMAT_INVALID, "The size value must not exceed the maximum value of 0xFFFF (UINT16) for %s." % ".".join((TokenSpaceGuid, PcdCName)),
+ File=self.MetaFile, Line=Dummy4)
+ if int(MaxDatumSize, 0) < 0:
+ EdkLogger.error('build', FORMAT_INVALID, "The size value can't be set to negative value for %s." % ".".join((TokenSpaceGuid, PcdCName)),
+ File=self.MetaFile, Line=Dummy4)
+ SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName][0], '', '', '', '', '', PcdValue)
+ if (PcdCName, TokenSpaceGuid) in Pcds:
+ pcdObject = Pcds[PcdCName, TokenSpaceGuid]
+ pcdObject.SkuInfoList[SkuName] = SkuInfo
+ if MaxDatumSize.strip():
+ CurrentMaxSize = int(MaxDatumSize.strip(), 0)
+ else:
+ CurrentMaxSize = 0
+ if pcdObject.MaxDatumSize:
+ PcdMaxSize = int(pcdObject.MaxDatumSize, 0)
+ else:
+ PcdMaxSize = 0
+ if CurrentMaxSize > PcdMaxSize:
+ pcdObject.MaxDatumSize = str(CurrentMaxSize)
+ else:
+ Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
+ PcdCName,
+ TokenSpaceGuid,
+ self._PCD_TYPE_STRING_[Type],
+ DatumType,
+ PcdValue,
+ '',
+ MaxDatumSize,
+ OrderedDict({SkuName : SkuInfo}),
+ False,
+ None,
+ IsDsc=True)
+
+ if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue:
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName] = {}
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][TAB_DEFAULT_STORES_DEFAULT] = PcdValue
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName][TAB_DEFAULT_STORES_DEFAULT] = (self.MetaFile.File,Dummy4)
+
+ for pcd in Pcds.values():
+ pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
+ # Only fix the value while no value provided in DSC file.
+ for sku in pcd.SkuInfoList.values():
+ if not sku.DefaultValue:
+ sku.DefaultValue = pcdDecObject.DefaultValue
+ if TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON not in pcd.SkuInfoList:
+ valuefromDec = pcdDecObject.DefaultValue
+ SkuInfo = SkuInfoClass(TAB_DEFAULT, '0', '', '', '', '', '', valuefromDec)
+ pcd.SkuInfoList[TAB_DEFAULT] = SkuInfo
+ elif TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList:
+ pcd.SkuInfoList[TAB_DEFAULT] = pcd.SkuInfoList[TAB_COMMON]
+ del pcd.SkuInfoList[TAB_COMMON]
+ elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList:
+ del pcd.SkuInfoList[TAB_COMMON]
+
+ list(map(self.FilterSkuSettings, Pcds.values()))
+
+ return Pcds
+
+ def FilterSkuSettings(self, PcdObj):
+
+ if self.SkuIdMgr.SkuUsageType == self.SkuIdMgr.SINGLE:
+ if TAB_DEFAULT in PcdObj.SkuInfoList and self.SkuIdMgr.SystemSkuId not in PcdObj.SkuInfoList:
+ PcdObj.SkuInfoList[self.SkuIdMgr.SystemSkuId] = PcdObj.SkuInfoList[TAB_DEFAULT]
+ PcdObj.SkuInfoList = {TAB_DEFAULT:PcdObj.SkuInfoList[self.SkuIdMgr.SystemSkuId]}
+ PcdObj.SkuInfoList[TAB_DEFAULT].SkuIdName = TAB_DEFAULT
+ PcdObj.SkuInfoList[TAB_DEFAULT].SkuId = '0'
+
+ elif self.SkuIdMgr.SkuUsageType == self.SkuIdMgr.DEFAULT:
+ PcdObj.SkuInfoList = {TAB_DEFAULT:PcdObj.SkuInfoList[TAB_DEFAULT]}
+
+ return PcdObj
+
+ @staticmethod
+ def CompareVarAttr(Attr1, Attr2):
+ if not Attr1 or not Attr2: # for empty string
+ return True
+ Attr1s = [attr.strip() for attr in Attr1.split(",")]
+ Attr1Set = set(Attr1s)
+ Attr2s = [attr.strip() for attr in Attr2.split(",")]
+ Attr2Set = set(Attr2s)
+ if Attr2Set == Attr1Set:
+ return True
+ else:
+ return False
+
+ def CompletePcdValues(self, PcdSet):
+ Pcds = OrderedDict()
+ DefaultStoreObj = DefaultStore(self._GetDefaultStores())
+ SkuIds = {skuname:skuid for skuname, skuid in self.SkuIdMgr.AvailableSkuIdSet.items() if skuname != TAB_COMMON}
+ DefaultStores = set(storename for pcdobj in PcdSet.values() for skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStoreDict)
+ for PcdCName, TokenSpaceGuid in PcdSet:
+ PcdObj = PcdSet[(PcdCName, TokenSpaceGuid)]
+
+ if PcdObj.Type not in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_DEFAULT],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_VPD],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_DEFAULT],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII],
+ self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_VPD]]:
+ Pcds[PcdCName, TokenSpaceGuid]= PcdObj
+ continue
+ PcdType = PcdObj.Type
+ if PcdType in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
+ for skuid in PcdObj.SkuInfoList:
+ skuobj = PcdObj.SkuInfoList[skuid]
+ mindefaultstorename = DefaultStoreObj.GetMin(set(defaultstorename for defaultstorename in skuobj.DefaultStoreDict))
+ for defaultstorename in DefaultStores:
+ if defaultstorename not in skuobj.DefaultStoreDict:
+ skuobj.DefaultStoreDict[defaultstorename] = skuobj.DefaultStoreDict[mindefaultstorename]
+ skuobj.HiiDefaultValue = skuobj.DefaultStoreDict[mindefaultstorename]
+ for skuname, skuid in SkuIds.items():
+ if skuname not in PcdObj.SkuInfoList:
+ nextskuid = self.SkuIdMgr.GetNextSkuId(skuname)
+ while nextskuid not in PcdObj.SkuInfoList:
+ nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
+ PcdObj.SkuInfoList[skuname] = copy.deepcopy(PcdObj.SkuInfoList[nextskuid])
+ PcdObj.SkuInfoList[skuname].SkuId = skuid
+ PcdObj.SkuInfoList[skuname].SkuIdName = skuname
+ if PcdType in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
+ PcdObj.DefaultValue = list(PcdObj.SkuInfoList.values())[0].HiiDefaultValue if self.SkuIdMgr.SkuUsageType == self.SkuIdMgr.SINGLE else PcdObj.SkuInfoList[TAB_DEFAULT].HiiDefaultValue
+ Pcds[PcdCName, TokenSpaceGuid]= PcdObj
+ return Pcds
+ ## Retrieve dynamic HII PCD settings
+ #
+ # @param Type PCD type
+ #
+ # @retval a dict object contains settings of given PCD type
+ #
+ def _GetDynamicHiiPcd(self, Type):
+
+ VariableAttrs = {}
+
+ Pcds = OrderedDict()
+ UserDefinedDefaultStores = []
+ #
+ # tdict is a special dict kind of type, used for selecting correct
+ # PCD settings for certain ARCH and SKU
+ #
+ PcdDict = tdict(True, 5)
+ PcdList = []
+ RecordList = self._RawData[Type, self._Arch]
+ # Find out all possible PCD candidates for self._Arch
+ AvailableSkuIdSet = copy.copy(self.SkuIds)
+ DefaultStoresDefine = self._GetDefaultStores()
+
+ for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, DefaultStore, Dummy4, Dummy5 in RecordList:
+ SkuName = SkuName.upper()
+ SkuName = TAB_DEFAULT if SkuName == TAB_COMMON else SkuName
+ DefaultStore = DefaultStore.upper()
+ if DefaultStore == TAB_COMMON:
+ DefaultStore = TAB_DEFAULT_STORES_DEFAULT
+ else:
+ #The end user define [DefaultStores] and [SKUID_IDENTIFIER.Menufacturing] in DSC
+ UserDefinedDefaultStores.append((PcdCName, TokenSpaceGuid))
+ if SkuName not in AvailableSkuIdSet:
+ EdkLogger.error('build', PARAMETER_INVALID, 'Sku %s is not defined in [SkuIds] section' % SkuName,
+ File=self.MetaFile, Line=Dummy5)
+ if DefaultStore not in DefaultStoresDefine:
+ EdkLogger.error('build', PARAMETER_INVALID, 'DefaultStores %s is not defined in [DefaultStores] section' % DefaultStore,
+ File=self.MetaFile, Line=Dummy5)
+ if "." not in TokenSpaceGuid and "[" not in PcdCName and (PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy5) not in PcdList:
+ PcdList.append((PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy5))
+ PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid, DefaultStore] = Setting
+
+
+ # Remove redundant PCD candidates, per the ARCH and SKU
+ for index,(PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy4) in enumerate(PcdList):
+
+ Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid, DefaultStore]
+ if Setting is None:
+ continue
+ VariableName, VariableGuid, VariableOffset, DefaultValue, VarAttribute = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
+
+ rt, Msg = VariableAttributes.ValidateVarAttributes(VarAttribute)
+ if not rt:
+ EdkLogger.error("build", PCD_VARIABLE_ATTRIBUTES_ERROR, "Variable attributes settings for %s is incorrect.\n %s" % (".".join((TokenSpaceGuid, PcdCName)), Msg),
+ ExtraData="[%s]" % VarAttribute)
+ ExceedMax = False
+ FormatCorrect = True
+ if VariableOffset.isdigit():
+ if int(VariableOffset, 10) > 0xFFFF:
+ ExceedMax = True
+ elif variablePattern.match(VariableOffset):
+ if int(VariableOffset, 16) > 0xFFFF:
+ ExceedMax = True
+ # For Offset written in "A.B"
+ elif VariableOffset.find('.') > -1:
+ VariableOffsetList = VariableOffset.split(".")
+ if not (len(VariableOffsetList) == 2
+ and IsValidWord(VariableOffsetList[0])
+ and IsValidWord(VariableOffsetList[1])):
+ FormatCorrect = False
+ else:
+ FormatCorrect = False
+ if not FormatCorrect:
+ EdkLogger.error('Build', FORMAT_INVALID, "Invalid syntax or format of the variable offset value is incorrect for %s." % ".".join((TokenSpaceGuid, PcdCName)))
+
+ if ExceedMax:
+ EdkLogger.error('Build', OPTION_VALUE_INVALID, "The variable offset value must not exceed the maximum value of 0xFFFF (UINT16) for %s." % ".".join((TokenSpaceGuid, PcdCName)))
+ if (VariableName, VariableGuid) not in VariableAttrs:
+ VariableAttrs[(VariableName, VariableGuid)] = VarAttribute
+ else:
+ if not DscBuildData.CompareVarAttr(VariableAttrs[(VariableName, VariableGuid)], VarAttribute):
+ EdkLogger.error('Build', PCD_VARIABLE_ATTRIBUTES_CONFLICT_ERROR, "The variable %s.%s for DynamicHii PCDs has conflicting attributes [%s] and [%s] " % (VariableGuid, VariableName, VarAttribute, VariableAttrs[(VariableName, VariableGuid)]))
+
+ pcdDecObject = self._DecPcds[PcdCName, TokenSpaceGuid]
+ if (PcdCName, TokenSpaceGuid) in Pcds:
+ pcdObject = Pcds[PcdCName, TokenSpaceGuid]
+ if SkuName in pcdObject.SkuInfoList:
+ Skuitem = pcdObject.SkuInfoList[SkuName]
+ Skuitem.DefaultStoreDict.update({DefaultStore:DefaultValue})
+ else:
+ SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName][0], VariableName, VariableGuid, VariableOffset, DefaultValue, VariableAttribute=VarAttribute, DefaultStore={DefaultStore:DefaultValue})
+ pcdObject.SkuInfoList[SkuName] = SkuInfo
+ else:
+ SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName][0], VariableName, VariableGuid, VariableOffset, DefaultValue, VariableAttribute=VarAttribute, DefaultStore={DefaultStore:DefaultValue})
+ PcdClassObj = PcdClassObject(
+ PcdCName,
+ TokenSpaceGuid,
+ self._PCD_TYPE_STRING_[Type],
+ '',
+ DefaultValue,
+ '',
+ '',
+ OrderedDict({SkuName : SkuInfo}),
+ False,
+ None,
+ pcdDecObject.validateranges,
+ pcdDecObject.validlists,
+ pcdDecObject.expressions,
+ IsDsc=True)
+ if (PcdCName, TokenSpaceGuid) in UserDefinedDefaultStores:
+ PcdClassObj.UserDefinedDefaultStoresFlag = True
+ Pcds[PcdCName, TokenSpaceGuid] = PcdClassObj
+
+ Pcds[PcdCName, TokenSpaceGuid].CustomAttribute['DscPosition'] = index
+ if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue:
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName] = {}
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][DefaultStore] = DefaultValue
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName][DefaultStore] = (self.MetaFile.File,Dummy4)
+ for pcd in Pcds.values():
+ pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
+ pcd.DatumType = pcdDecObject.DatumType
+ # Only fix the value while no value provided in DSC file.
+ for sku in pcd.SkuInfoList.values():
+ if (sku.HiiDefaultValue == "" or sku.HiiDefaultValue is None):
+ sku.HiiDefaultValue = pcdDecObject.DefaultValue
+ for default_store in sku.DefaultStoreDict:
+ sku.DefaultStoreDict[default_store]=pcdDecObject.DefaultValue
+ pcd.DefaultValue = pcdDecObject.DefaultValue
+ if TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON not in pcd.SkuInfoList:
+ SkuInfoObj = list(pcd.SkuInfoList.values())[0]
+ valuefromDec = pcdDecObject.DefaultValue
+ SkuInfo = SkuInfoClass(TAB_DEFAULT, '0', SkuInfoObj.VariableName, SkuInfoObj.VariableGuid, SkuInfoObj.VariableOffset, valuefromDec, VariableAttribute=SkuInfoObj.VariableAttribute, DefaultStore={DefaultStore:valuefromDec})
+ pcd.SkuInfoList[TAB_DEFAULT] = SkuInfo
+ elif TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList:
+ pcd.SkuInfoList[TAB_DEFAULT] = pcd.SkuInfoList[TAB_COMMON]
+ del pcd.SkuInfoList[TAB_COMMON]
+ elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList:
+ del pcd.SkuInfoList[TAB_COMMON]
+
+ if pcd.MaxDatumSize.strip():
+ MaxSize = int(pcd.MaxDatumSize, 0)
+ else:
+ MaxSize = 0
+ if pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
+ for (_, skuobj) in pcd.SkuInfoList.items():
+ datalen = 0
+ skuobj.HiiDefaultValue = StringToArray(skuobj.HiiDefaultValue)
+ datalen = len(skuobj.HiiDefaultValue.split(","))
+ if datalen > MaxSize:
+ MaxSize = datalen
+ for defaultst in skuobj.DefaultStoreDict:
+ skuobj.DefaultStoreDict[defaultst] = StringToArray(skuobj.DefaultStoreDict[defaultst])
+ pcd.DefaultValue = StringToArray(pcd.DefaultValue)
+ pcd.MaxDatumSize = str(MaxSize)
+ rt, invalidhii = DscBuildData.CheckVariableNameAssignment(Pcds)
+ if not rt:
+ invalidpcd = ",".join(invalidhii)
+ EdkLogger.error('build', PCD_VARIABLE_INFO_ERROR, Message='The same HII PCD must map to the same EFI variable for all SKUs', File=self.MetaFile, ExtraData=invalidpcd)
+
+ list(map(self.FilterSkuSettings, Pcds.values()))
+
+ return Pcds
+
+ @staticmethod
+ def CheckVariableNameAssignment(Pcds):
+ invalidhii = []
+ for pcdname in Pcds:
+ pcd = Pcds[pcdname]
+ varnameset = set(sku.VariableName for (skuid, sku) in pcd.SkuInfoList.items())
+ if len(varnameset) > 1:
+ invalidhii.append(".".join((pcdname[1], pcdname[0])))
+ if len(invalidhii):
+ return False, invalidhii
+ else:
+ return True, []
+ ## Retrieve dynamic VPD PCD settings
+ #
+ # @param Type PCD type
+ #
+ # @retval a dict object contains settings of given PCD type
+ #
+ def _GetDynamicVpdPcd(self, Type):
+
+
+ Pcds = OrderedDict()
+ #
+ # tdict is a special dict kind of type, used for selecting correct
+ # PCD settings for certain ARCH and SKU
+ #
+ PcdDict = tdict(True, 4)
+ PcdList = []
+
+ # Find out all possible PCD candidates for self._Arch
+ RecordList = self._RawData[Type, self._Arch]
+ AvailableSkuIdSet = copy.copy(self.SkuIds)
+
+ for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dummy4, Dummy5 in RecordList:
+ SkuName = SkuName.upper()
+ SkuName = TAB_DEFAULT if SkuName == TAB_COMMON else SkuName
+ if SkuName not in AvailableSkuIdSet:
+ EdkLogger.error('build', PARAMETER_INVALID, 'Sku %s is not defined in [SkuIds] section' % SkuName,
+ File=self.MetaFile, Line=Dummy5)
+ if "." not in TokenSpaceGuid and "[" not in PcdCName and (PcdCName, TokenSpaceGuid, SkuName, Dummy5) not in PcdList:
+ PcdList.append((PcdCName, TokenSpaceGuid, SkuName, Dummy5))
+ PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid] = Setting
+
+ # Remove redundant PCD candidates, per the ARCH and SKU
+ for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdList:
+ Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid]
+ if Setting is None:
+ continue
+ #
+ # For the VOID* type, it can have optional data of MaxDatumSize and InitialValue
+ # For the Integer & Boolean type, the optional data can only be InitialValue.
+ # At this point, we put all the data into the PcdClssObject for we don't know the PCD's datumtype
+ # until the DEC parser has been called.
+ #
+ VpdOffset, MaxDatumSize, InitialValue = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
+ if MaxDatumSize:
+ if int(MaxDatumSize, 0) > 0xFFFF:
+ EdkLogger.error('build', FORMAT_INVALID, "The size value must not exceed the maximum value of 0xFFFF (UINT16) for %s." % ".".join((TokenSpaceGuid, PcdCName)),
+ File=self.MetaFile, Line=Dummy4)
+ if int(MaxDatumSize, 0) < 0:
+ EdkLogger.error('build', FORMAT_INVALID, "The size value can't be set to negative value for %s." % ".".join((TokenSpaceGuid, PcdCName)),
+ File=self.MetaFile, Line=Dummy4)
+ SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName][0], '', '', '', '', VpdOffset, InitialValue)
+ if (PcdCName, TokenSpaceGuid) in Pcds:
+ pcdObject = Pcds[PcdCName, TokenSpaceGuid]
+ pcdObject.SkuInfoList[SkuName] = SkuInfo
+ if MaxDatumSize.strip():
+ CurrentMaxSize = int(MaxDatumSize.strip(), 0)
+ else:
+ CurrentMaxSize = 0
+ if pcdObject.MaxDatumSize:
+ PcdMaxSize = int(pcdObject.MaxDatumSize, 0)
+ else:
+ PcdMaxSize = 0
+ if CurrentMaxSize > PcdMaxSize:
+ pcdObject.MaxDatumSize = str(CurrentMaxSize)
+ else:
+ Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
+ PcdCName,
+ TokenSpaceGuid,
+ self._PCD_TYPE_STRING_[Type],
+ '',
+ InitialValue,
+ '',
+ MaxDatumSize,
+ OrderedDict({SkuName : SkuInfo}),
+ False,
+ None,
+ IsDsc=True)
+
+ if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue:
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName] = {}
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][TAB_DEFAULT_STORES_DEFAULT] = InitialValue
+ Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName][TAB_DEFAULT_STORES_DEFAULT] = (self.MetaFile.File,Dummy4)
+ for pcd in Pcds.values():
+ pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
+ pcd.DatumType = pcdDecObject.DatumType
+ # Only fix the value while no value provided in DSC file.
+ for sku in pcd.SkuInfoList.values():
+ if not sku.DefaultValue:
+ sku.DefaultValue = pcdDecObject.DefaultValue
+ if TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON not in pcd.SkuInfoList:
+ SkuInfoObj = list(pcd.SkuInfoList.values())[0]
+ valuefromDec = pcdDecObject.DefaultValue
+ SkuInfo = SkuInfoClass(TAB_DEFAULT, '0', '', '', '', '', SkuInfoObj.VpdOffset, valuefromDec)
+ pcd.SkuInfoList[TAB_DEFAULT] = SkuInfo
+ elif TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList:
+ pcd.SkuInfoList[TAB_DEFAULT] = pcd.SkuInfoList[TAB_COMMON]
+ del pcd.SkuInfoList[TAB_COMMON]
+ elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList:
+ del pcd.SkuInfoList[TAB_COMMON]
+
+ #For the same one VOID* pcd, if the default value type of one SKU is "Unicode string",
+ #the other SKUs are "OtherVOID*"(ASCII string or byte array),Then convert "Unicode string" to "byte array".
+ for pcd in Pcds.values():
+ PcdValueTypeSet = set()
+ for sku in pcd.SkuInfoList.values():
+ PcdValueTypeSet.add("UnicodeString" if sku.DefaultValue.startswith(('L"',"L'")) else "OtherVOID*")
+ if len(PcdValueTypeSet) > 1:
+ for sku in pcd.SkuInfoList.values():
+ sku.DefaultValue = StringToArray(sku.DefaultValue) if sku.DefaultValue.startswith(('L"',"L'")) else sku.DefaultValue
+
+ list(map(self.FilterSkuSettings, Pcds.values()))
+ return Pcds
+
+ ## Add external modules
+ #
+ # The external modules are mostly those listed in FDF file, which don't
+ # need "build".
+ #
+ # @param FilePath The path of module description file
+ #
+ def AddModule(self, FilePath):
+ FilePath = NormPath(FilePath)
+ if FilePath not in self.Modules:
+ Module = ModuleBuildClassObject()
+ Module.MetaFile = FilePath
+ self.Modules.append(Module)
+
+ @property
+ def ToolChainFamily(self):
+ self._ToolChainFamily = TAB_COMPILER_MSFT
+ TargetObj = TargetTxtDict()
+ TargetTxt = TargetObj.Target
+ BuildConfigurationFile = os.path.normpath(os.path.join(GlobalData.gConfDirectory, "target.txt"))
+ if os.path.isfile(BuildConfigurationFile) == True:
+ ToolDefinitionFile = TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
+ if ToolDefinitionFile == '':
+ ToolDefinitionFile = "tools_def.txt"
+ ToolDefinitionFile = os.path.normpath(mws.join(self.WorkspaceDir, 'Conf', ToolDefinitionFile))
+ if os.path.isfile(ToolDefinitionFile) == True:
+ ToolDefObj = ToolDefDict((os.path.join(os.getenv("WORKSPACE"), "Conf")))
+ ToolDefinition = ToolDefObj.ToolDef.ToolsDefTxtDatabase
+ if TAB_TOD_DEFINES_FAMILY not in ToolDefinition \
+ or self._Toolchain not in ToolDefinition[TAB_TOD_DEFINES_FAMILY] \
+ or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][self._Toolchain]:
+ self._ToolChainFamily = TAB_COMPILER_MSFT
+ else:
+ self._ToolChainFamily = ToolDefinition[TAB_TOD_DEFINES_FAMILY][self._Toolchain]
+ return self._ToolChainFamily
+
+ ## Add external PCDs
+ #
+ # The external PCDs are mostly those listed in FDF file to specify address
+ # or offset information.
+ #
+ # @param Name Name of the PCD
+ # @param Guid Token space guid of the PCD
+ # @param Value Value of the PCD
+ #
+ def AddPcd(self, Name, Guid, Value):
+ if (Name, Guid) not in self.Pcds:
+ self.Pcds[Name, Guid] = PcdClassObject(Name, Guid, '', '', '', '', '', {}, False, None)
+ self.Pcds[Name, Guid].DefaultValue = Value
+
+ @property
+ def DecPcds(self):
+ if self._DecPcds is None:
+ FdfInfList = []
+ if GlobalData.gFdfParser:
+ FdfInfList = GlobalData.gFdfParser.Profile.InfList
+ PkgSet = set()
+ for Inf in FdfInfList:
+ ModuleFile = PathClass(NormPath(Inf), GlobalData.gWorkspace, Arch=self._Arch)
+ if ModuleFile in self._Modules:
+ continue
+ ModuleData = self._Bdb[ModuleFile, self._Arch, self._Target, self._Toolchain]
+ PkgSet.update(ModuleData.Packages)
+ if self.Packages:
+ PkgSet.update(self.Packages)
+ self._DecPcds, self._GuidDict = GetDeclaredPcd(self, self._Bdb, self._Arch, self._Target, self._Toolchain, PkgSet)
+ self._GuidDict.update(GlobalData.gPlatformPcds)
+ return self._DecPcds
diff --git a/roms/edk2/BaseTools/Source/Python/Workspace/InfBuildData.py b/roms/edk2/BaseTools/Source/Python/Workspace/InfBuildData.py
new file mode 100644
index 000000000..7675b0ea0
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -0,0 +1,1064 @@
+## @file
+# This file is used to create a database used by build tool
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import absolute_import
+from Common.DataType import *
+from Common.Misc import *
+from Common.caching import cached_property, cached_class_function
+from types import *
+from .MetaFileParser import *
+from collections import OrderedDict
+from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClassObject, PcdClassObject
+
+## Get Protocol value from given packages
+#
+# @param CName The CName of the GUID
+# @param PackageList List of packages looking-up in
+# @param Inffile The driver file
+#
+# @retval GuidValue if the CName is found in any given package
+# @retval None if the CName is not found in all given packages
+#
+def _ProtocolValue(CName, PackageList, Inffile = None):
+ for P in PackageList:
+ ProtocolKeys = list(P.Protocols.keys())
+ if Inffile and P._PrivateProtocols:
+ if not Inffile.startswith(P.MetaFile.Dir):
+ ProtocolKeys = [x for x in P.Protocols if x not in P._PrivateProtocols]
+ if CName in ProtocolKeys:
+ return P.Protocols[CName]
+ return None
+
+## Get PPI value from given packages
+#
+# @param CName The CName of the GUID
+# @param PackageList List of packages looking-up in
+# @param Inffile The driver file
+#
+# @retval GuidValue if the CName is found in any given package
+# @retval None if the CName is not found in all given packages
+#
+def _PpiValue(CName, PackageList, Inffile = None):
+ for P in PackageList:
+ PpiKeys = list(P.Ppis.keys())
+ if Inffile and P._PrivatePpis:
+ if not Inffile.startswith(P.MetaFile.Dir):
+ PpiKeys = [x for x in P.Ppis if x not in P._PrivatePpis]
+ if CName in PpiKeys:
+ return P.Ppis[CName]
+ return None
+
+## Module build information from INF file
+#
+# This class is used to retrieve information stored in database and convert them
+# into ModuleBuildClassObject form for easier use for AutoGen.
+#
+class InfBuildData(ModuleBuildClassObject):
+ # dict used to convert PCD type in database to string used by build tool
+ _PCD_TYPE_STRING_ = {
+ MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
+ MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
+ MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
+ }
+
+ # dict used to convert part of [Defines] to members of InfBuildData directly
+ _PROPERTY_ = {
+ #
+ # Required Fields
+ #
+ TAB_INF_DEFINES_BASE_NAME : "_BaseName",
+ TAB_INF_DEFINES_FILE_GUID : "_Guid",
+ TAB_INF_DEFINES_MODULE_TYPE : "_ModuleType",
+ #
+ # Optional Fields
+ #
+ # TAB_INF_DEFINES_INF_VERSION : "_AutoGenVersion",
+ TAB_INF_DEFINES_COMPONENT_TYPE : "_ComponentType",
+ TAB_INF_DEFINES_MAKEFILE_NAME : "_MakefileName",
+ # TAB_INF_DEFINES_CUSTOM_MAKEFILE : "_CustomMakefile",
+ TAB_INF_DEFINES_DPX_SOURCE :"_DxsFile",
+ TAB_INF_DEFINES_VERSION_NUMBER : "_Version",
+ TAB_INF_DEFINES_VERSION_STRING : "_Version",
+ TAB_INF_DEFINES_VERSION : "_Version",
+ TAB_INF_DEFINES_PCD_IS_DRIVER : "_PcdIsDriver",
+ TAB_INF_DEFINES_SHADOW : "_Shadow"
+ }
+
+ # regular expression for converting XXX_FLAGS in [nmake] section to new type
+ _NMAKE_FLAG_PATTERN_ = re.compile("(?:EBC_)?([A-Z]+)_(?:STD_|PROJ_|ARCH_)?FLAGS(?:_DLL|_ASL|_EXE)?", re.UNICODE)
+ # dict used to convert old tool name used in [nmake] section to new ones
+ _TOOL_CODE_ = {
+ "C" : "CC",
+ BINARY_FILE_TYPE_LIB : "SLINK",
+ "LINK" : "DLINK",
+ }
+
+
+ ## Constructor of InfBuildData
+ #
+ # Initialize object of InfBuildData
+ #
+ # @param FilePath The path of platform description file
+ # @param RawData The raw data of DSC file
+ # @param BuildDataBase Database used to retrieve module/package information
+ # @param Arch The target architecture
+ # @param Platform The name of platform employing this module
+ # @param Macros Macros used for replacement in DSC file
+ #
+ def __init__(self, FilePath, RawData, BuildDatabase, Arch=TAB_ARCH_COMMON, Target=None, Toolchain=None):
+ self.MetaFile = FilePath
+ self._ModuleDir = FilePath.Dir
+ self._RawData = RawData
+ self._Bdb = BuildDatabase
+ self._Arch = Arch
+ self._Target = Target
+ self._Toolchain = Toolchain
+ self._Platform = TAB_COMMON
+ self._TailComments = None
+ self._BaseName = None
+ self._DxsFile = None
+ self._ModuleType = None
+ self._ComponentType = None
+ self._BuildType = None
+ self._Guid = None
+ self._Version = None
+ self._PcdIsDriver = None
+ self._BinaryModule = None
+ self._Shadow = None
+ self._MakefileName = None
+ self._CustomMakefile = None
+ self._Specification = None
+ self._LibraryClass = None
+ self._ModuleEntryPointList = None
+ self._ModuleUnloadImageList = None
+ self._ConstructorList = None
+ self._DestructorList = None
+ self._Defs = OrderedDict()
+ self._ProtocolComments = None
+ self._PpiComments = None
+ self._GuidsUsedByPcd = OrderedDict()
+ self._GuidComments = None
+ self._PcdComments = None
+ self._BuildOptions = None
+ self._DependencyFileList = None
+ self.LibInstances = []
+ self.ReferenceModules = set()
+
+ def SetReferenceModule(self,Module):
+ self.ReferenceModules.add(Module)
+ return self
+
+ ## XXX[key] = value
+ def __setitem__(self, key, value):
+ self.__dict__[self._PROPERTY_[key]] = value
+
+ ## value = XXX[key]
+ def __getitem__(self, key):
+ return self.__dict__[self._PROPERTY_[key]]
+
+ ## "in" test support
+ def __contains__(self, key):
+ return key in self._PROPERTY_
+
+ ## Get current effective macros
+ @cached_property
+ def _Macros(self):
+ RetVal = {}
+ return RetVal
+
+ ## Get architecture
+ @cached_property
+ def Arch(self):
+ return self._Arch
+
+ ## Return the name of platform employing this module
+ @cached_property
+ def Platform(self):
+ return self._Platform
+
+ @cached_property
+ def HeaderComments(self):
+ return [a[0] for a in self._RawData[MODEL_META_DATA_HEADER_COMMENT]]
+
+ @cached_property
+ def TailComments(self):
+ return [a[0] for a in self._RawData[MODEL_META_DATA_TAIL_COMMENT]]
+
+ ## Retrieve all information in [Defines] section
+ #
+ # (Retrieving all [Defines] information in one-shot is just to save time.)
+ #
+ @cached_class_function
+ def _GetHeaderInfo(self):
+ RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]
+ for Record in RecordList:
+ Name, Value = Record[1], ReplaceMacro(Record[2], self._Macros, False)
+ # items defined _PROPERTY_ don't need additional processing
+ if Name in self:
+ self[Name] = Value
+ self._Defs[Name] = Value
+ self._Macros[Name] = Value
+ # some special items in [Defines] section need special treatment
+ elif Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION', 'EDK_RELEASE_VERSION', 'PI_SPECIFICATION_VERSION'):
+ if Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):
+ Name = 'UEFI_SPECIFICATION_VERSION'
+ if self._Specification is None:
+ self._Specification = OrderedDict()
+ self._Specification[Name] = GetHexVerValue(Value)
+ if self._Specification[Name] is None:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED,
+ "'%s' format is not supported for %s" % (Value, Name),
+ File=self.MetaFile, Line=Record[-1])
+ elif Name == 'LIBRARY_CLASS':
+ if self._LibraryClass is None:
+ self._LibraryClass = []
+ ValueList = GetSplitValueList(Value)
+ LibraryClass = ValueList[0]
+ if len(ValueList) > 1:
+ SupModuleList = GetSplitValueList(ValueList[1], ' ')
+ else:
+ SupModuleList = SUP_MODULE_LIST
+ self._LibraryClass.append(LibraryClassObject(LibraryClass, SupModuleList))
+ elif Name == 'ENTRY_POINT':
+ if self._ModuleEntryPointList is None:
+ self._ModuleEntryPointList = []
+ self._ModuleEntryPointList.append(Value)
+ elif Name == 'UNLOAD_IMAGE':
+ if self._ModuleUnloadImageList is None:
+ self._ModuleUnloadImageList = []
+ if not Value:
+ continue
+ self._ModuleUnloadImageList.append(Value)
+ elif Name == 'CONSTRUCTOR':
+ if self._ConstructorList is None:
+ self._ConstructorList = []
+ if not Value:
+ continue
+ self._ConstructorList.append(Value)
+ elif Name == 'DESTRUCTOR':
+ if self._DestructorList is None:
+ self._DestructorList = []
+ if not Value:
+ continue
+ self._DestructorList.append(Value)
+ elif Name == TAB_INF_DEFINES_CUSTOM_MAKEFILE:
+ TokenList = GetSplitValueList(Value)
+ if self._CustomMakefile is None:
+ self._CustomMakefile = {}
+ if len(TokenList) < 2:
+ self._CustomMakefile[TAB_COMPILER_MSFT] = TokenList[0]
+ self._CustomMakefile['GCC'] = TokenList[0]
+ else:
+ if TokenList[0] not in [TAB_COMPILER_MSFT, 'GCC']:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED,
+ "No supported family [%s]" % TokenList[0],
+ File=self.MetaFile, Line=Record[-1])
+ self._CustomMakefile[TokenList[0]] = TokenList[1]
+ else:
+ self._Defs[Name] = Value
+ self._Macros[Name] = Value
+
+ #
+ # Retrieve information in sections specific to Edk.x modules
+ #
+ if not self._ModuleType:
+ EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
+ "MODULE_TYPE is not given", File=self.MetaFile)
+ if self._ModuleType not in SUP_MODULE_LIST:
+ RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]
+ for Record in RecordList:
+ Name = Record[1]
+ if Name == "MODULE_TYPE":
+ LineNo = Record[6]
+ break
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED,
+ "MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self._ModuleType, ' '.join(l for l in SUP_MODULE_LIST)),
+ File=self.MetaFile, Line=LineNo)
+ if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
+ if self._ModuleType == SUP_MODULE_SMM_CORE:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.MetaFile)
+ if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):
+ if self._ModuleType == SUP_MODULE_MM_CORE_STANDALONE:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)
+ if self._ModuleType == SUP_MODULE_MM_STANDALONE:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)
+ if 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \
+ and 'PCI_CLASS_CODE' in self._Defs and 'PCI_REVISION' in self._Defs:
+ self._BuildType = 'UEFI_OPTIONROM'
+ if 'PCI_COMPRESS' in self._Defs:
+ if self._Defs['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):
+ EdkLogger.error("build", FORMAT_INVALID, "Expected TRUE/FALSE for PCI_COMPRESS: %s" % self.MetaFile)
+
+ elif 'UEFI_HII_RESOURCE_SECTION' in self._Defs \
+ and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':
+ self._BuildType = 'UEFI_HII'
+ else:
+ self._BuildType = self._ModuleType.upper()
+
+ if self._DxsFile:
+ File = PathClass(NormPath(self._DxsFile), self._ModuleDir, Arch=self._Arch)
+ # check the file validation
+ ErrorCode, ErrorInfo = File.Validate(".dxs", CaseSensitive=False)
+ if ErrorCode != 0:
+ EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,
+ File=self.MetaFile, Line=LineNo)
+ if not self._DependencyFileList:
+ self._DependencyFileList = []
+ self._DependencyFileList.append(File)
+
+ ## Retrieve file version
+ @cached_property
+ def AutoGenVersion(self):
+ RetVal = 0x00010000
+ RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]
+ for Record in RecordList:
+ if Record[1] == TAB_INF_DEFINES_INF_VERSION:
+ if '.' in Record[2]:
+ ValueList = Record[2].split('.')
+ Major = '%04o' % int(ValueList[0], 0)
+ Minor = '%04o' % int(ValueList[1], 0)
+ RetVal = int('0x' + Major + Minor, 0)
+ else:
+ RetVal = int(Record[2], 0)
+ break
+ return RetVal
+
+ ## Retrieve BASE_NAME
+ @cached_property
+ def BaseName(self):
+ if self._BaseName is None:
+ self._GetHeaderInfo()
+ if self._BaseName is None:
+ EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No BASE_NAME name", File=self.MetaFile)
+ return self._BaseName
+
+ ## Retrieve DxsFile
+ @cached_property
+ def DxsFile(self):
+ if self._DxsFile is None:
+ self._GetHeaderInfo()
+ if self._DxsFile is None:
+ self._DxsFile = ''
+ return self._DxsFile
+
+ ## Retrieve MODULE_TYPE
+ @cached_property
+ def ModuleType(self):
+ if self._ModuleType is None:
+ self._GetHeaderInfo()
+ if self._ModuleType is None:
+ self._ModuleType = SUP_MODULE_BASE
+ if self._ModuleType not in SUP_MODULE_LIST:
+ self._ModuleType = SUP_MODULE_USER_DEFINED
+ return self._ModuleType
+
+ ## Retrieve COMPONENT_TYPE
+ @cached_property
+ def ComponentType(self):
+ if self._ComponentType is None:
+ self._GetHeaderInfo()
+ if self._ComponentType is None:
+ self._ComponentType = SUP_MODULE_USER_DEFINED
+ return self._ComponentType
+
+ ## Retrieve "BUILD_TYPE"
+ @cached_property
+ def BuildType(self):
+ if self._BuildType is None:
+ self._GetHeaderInfo()
+ if not self._BuildType:
+ self._BuildType = SUP_MODULE_BASE
+ return self._BuildType
+
+ ## Retrieve file guid
+ @cached_property
+ def Guid(self):
+ if self._Guid is None:
+ self._GetHeaderInfo()
+ if self._Guid is None:
+ self._Guid = '00000000-0000-0000-0000-000000000000'
+ return self._Guid
+
+ ## Retrieve module version
+ @cached_property
+ def Version(self):
+ if self._Version is None:
+ self._GetHeaderInfo()
+ if self._Version is None:
+ self._Version = '0.0'
+ return self._Version
+
+ ## Retrieve PCD_IS_DRIVER
+ @cached_property
+ def PcdIsDriver(self):
+ if self._PcdIsDriver is None:
+ self._GetHeaderInfo()
+ if self._PcdIsDriver is None:
+ self._PcdIsDriver = ''
+ return self._PcdIsDriver
+
+ ## Retrieve SHADOW
+ @cached_property
+ def Shadow(self):
+ if self._Shadow is None:
+ self._GetHeaderInfo()
+ if self._Shadow and self._Shadow.upper() == 'TRUE':
+ self._Shadow = True
+ else:
+ self._Shadow = False
+ return self._Shadow
+
+ ## Retrieve CUSTOM_MAKEFILE
+ @cached_property
+ def CustomMakefile(self):
+ if self._CustomMakefile is None:
+ self._GetHeaderInfo()
+ if self._CustomMakefile is None:
+ self._CustomMakefile = {}
+ return self._CustomMakefile
+
+ ## Retrieve EFI_SPECIFICATION_VERSION
+ @cached_property
+ def Specification(self):
+ if self._Specification is None:
+ self._GetHeaderInfo()
+ if self._Specification is None:
+ self._Specification = {}
+ return self._Specification
+
+ ## Retrieve LIBRARY_CLASS
+ @cached_property
+ def LibraryClass(self):
+ if self._LibraryClass is None:
+ self._GetHeaderInfo()
+ if self._LibraryClass is None:
+ self._LibraryClass = []
+ return self._LibraryClass
+
+ ## Retrieve ENTRY_POINT
+ @cached_property
+ def ModuleEntryPointList(self):
+ if self._ModuleEntryPointList is None:
+ self._GetHeaderInfo()
+ if self._ModuleEntryPointList is None:
+ self._ModuleEntryPointList = []
+ return self._ModuleEntryPointList
+
+ ## Retrieve UNLOAD_IMAGE
+ @cached_property
+ def ModuleUnloadImageList(self):
+ if self._ModuleUnloadImageList is None:
+ self._GetHeaderInfo()
+ if self._ModuleUnloadImageList is None:
+ self._ModuleUnloadImageList = []
+ return self._ModuleUnloadImageList
+
+ ## Retrieve CONSTRUCTOR
+ @cached_property
+ def ConstructorList(self):
+ if self._ConstructorList is None:
+ self._GetHeaderInfo()
+ if self._ConstructorList is None:
+ self._ConstructorList = []
+ return self._ConstructorList
+
+ ## Retrieve DESTRUCTOR
+ @cached_property
+ def DestructorList(self):
+ if self._DestructorList is None:
+ self._GetHeaderInfo()
+ if self._DestructorList is None:
+ self._DestructorList = []
+ return self._DestructorList
+
+ ## Retrieve definies other than above ones
+ @cached_property
+ def Defines(self):
+ self._GetHeaderInfo()
+ return self._Defs
+
+ ## Retrieve binary files
+ @cached_class_function
+ def _GetBinaries(self):
+ RetVal = []
+ RecordList = self._RawData[MODEL_EFI_BINARY_FILE, self._Arch, self._Platform]
+ Macros = self._Macros
+ Macros['PROCESSOR'] = self._Arch
+ for Record in RecordList:
+ FileType = Record[0]
+ LineNo = Record[-1]
+ Target = TAB_COMMON
+ FeatureFlag = []
+ if Record[2]:
+ TokenList = GetSplitValueList(Record[2], TAB_VALUE_SPLIT)
+ if TokenList:
+ Target = TokenList[0]
+ if len(TokenList) > 1:
+ FeatureFlag = Record[1:]
+
+ File = PathClass(NormPath(Record[1], Macros), self._ModuleDir, '', FileType, True, self._Arch, '', Target)
+ # check the file validation
+ ErrorCode, ErrorInfo = File.Validate()
+ if ErrorCode != 0:
+ EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)
+ RetVal.append(File)
+ return RetVal
+
+ ## Retrieve binary files with error check.
+ @cached_property
+ def Binaries(self):
+ RetVal = self._GetBinaries()
+ if GlobalData.gIgnoreSource and not RetVal:
+ ErrorInfo = "The INF file does not contain any RetVal to use in creating the image\n"
+ EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, ExtraData=ErrorInfo, File=self.MetaFile)
+
+ return RetVal
+
+ ## Retrieve source files
+ @cached_property
+ def Sources(self):
+ self._GetHeaderInfo()
+ # Ignore all source files in a binary build mode
+ if GlobalData.gIgnoreSource:
+ return []
+
+ RetVal = []
+ RecordList = self._RawData[MODEL_EFI_SOURCE_FILE, self._Arch, self._Platform]
+ Macros = self._Macros
+ for Record in RecordList:
+ LineNo = Record[-1]
+ ToolChainFamily = Record[1]
+ TagName = Record[2]
+ ToolCode = Record[3]
+
+ File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, '',
+ '', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)
+ # check the file validation
+ ErrorCode, ErrorInfo = File.Validate()
+ if ErrorCode != 0:
+ EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)
+
+ RetVal.append(File)
+ # add any previously found dependency files to the source list
+ if self._DependencyFileList:
+ RetVal.extend(self._DependencyFileList)
+ return RetVal
+
+ ## Retrieve library classes employed by this module
+ @cached_property
+ def LibraryClasses(self):
+ RetVal = OrderedDict()
+ RecordList = self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Arch, self._Platform]
+ for Record in RecordList:
+ Lib = Record[0]
+ Instance = Record[1]
+ if Instance:
+ Instance = NormPath(Instance, self._Macros)
+ RetVal[Lib] = Instance
+ else:
+ RetVal[Lib] = None
+ return RetVal
+
+ ## Retrieve library names (for Edk.x style of modules)
+ @cached_property
+ def Libraries(self):
+ RetVal = []
+ RecordList = self._RawData[MODEL_EFI_LIBRARY_INSTANCE, self._Arch, self._Platform]
+ for Record in RecordList:
+ LibraryName = ReplaceMacro(Record[0], self._Macros, False)
+ # in case of name with '.lib' extension, which is unusual in Edk.x inf
+ LibraryName = os.path.splitext(LibraryName)[0]
+ if LibraryName not in RetVal:
+ RetVal.append(LibraryName)
+ return RetVal
+
+ @cached_property
+ def ProtocolComments(self):
+ self.Protocols
+ return self._ProtocolComments
+
+ ## Retrieve protocols consumed/produced by this module
+ @cached_property
+ def Protocols(self):
+ RetVal = OrderedDict()
+ self._ProtocolComments = OrderedDict()
+ RecordList = self._RawData[MODEL_EFI_PROTOCOL, self._Arch, self._Platform]
+ for Record in RecordList:
+ CName = Record[0]
+ Value = _ProtocolValue(CName, self.Packages, self.MetaFile.Path)
+ if Value is None:
+ PackageList = "\n\t".join(str(P) for P in self.Packages)
+ EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,
+ "Value of Protocol [%s] is not found under [Protocols] section in" % CName,
+ ExtraData=PackageList, File=self.MetaFile, Line=Record[-1])
+ RetVal[CName] = Value
+ CommentRecords = self._RawData[MODEL_META_DATA_COMMENT, self._Arch, self._Platform, Record[5]]
+ self._ProtocolComments[CName] = [a[0] for a in CommentRecords]
+ return RetVal
+
+ @cached_property
+ def PpiComments(self):
+ self.Ppis
+ return self._PpiComments
+
+ ## Retrieve PPIs consumed/produced by this module
+ @cached_property
+ def Ppis(self):
+ RetVal = OrderedDict()
+ self._PpiComments = OrderedDict()
+ RecordList = self._RawData[MODEL_EFI_PPI, self._Arch, self._Platform]
+ for Record in RecordList:
+ CName = Record[0]
+ Value = _PpiValue(CName, self.Packages, self.MetaFile.Path)
+ if Value is None:
+ PackageList = "\n\t".join(str(P) for P in self.Packages)
+ EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,
+ "Value of PPI [%s] is not found under [Ppis] section in " % CName,
+ ExtraData=PackageList, File=self.MetaFile, Line=Record[-1])
+ RetVal[CName] = Value
+ CommentRecords = self._RawData[MODEL_META_DATA_COMMENT, self._Arch, self._Platform, Record[5]]
+ self._PpiComments[CName] = [a[0] for a in CommentRecords]
+ return RetVal
+
+ @cached_property
+ def GuidComments(self):
+ self.Guids
+ return self._GuidComments
+
+ ## Retrieve GUIDs consumed/produced by this module
+ @cached_property
+ def Guids(self):
+ RetVal = OrderedDict()
+ self._GuidComments = OrderedDict()
+ RecordList = self._RawData[MODEL_EFI_GUID, self._Arch, self._Platform]
+ for Record in RecordList:
+ CName = Record[0]
+ Value = GuidValue(CName, self.Packages, self.MetaFile.Path)
+ if Value is None:
+ PackageList = "\n\t".join(str(P) for P in self.Packages)
+ EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,
+ "Value of Guid [%s] is not found under [Guids] section in" % CName,
+ ExtraData=PackageList, File=self.MetaFile, Line=Record[-1])
+ RetVal[CName] = Value
+ CommentRecords = self._RawData[MODEL_META_DATA_COMMENT, self._Arch, self._Platform, Record[5]]
+ self._GuidComments[CName] = [a[0] for a in CommentRecords]
+
+ for Type in [MODEL_PCD_FIXED_AT_BUILD,MODEL_PCD_PATCHABLE_IN_MODULE,MODEL_PCD_FEATURE_FLAG,MODEL_PCD_DYNAMIC,MODEL_PCD_DYNAMIC_EX]:
+ RecordList = self._RawData[Type, self._Arch, self._Platform]
+ for TokenSpaceGuid, _, _, _, _, _, LineNo in RecordList:
+ # get the guid value
+ if TokenSpaceGuid not in RetVal:
+ Value = GuidValue(TokenSpaceGuid, self.Packages, self.MetaFile.Path)
+ if Value is None:
+ PackageList = "\n\t".join(str(P) for P in self.Packages)
+ EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,
+ "Value of Guid [%s] is not found under [Guids] section in" % TokenSpaceGuid,
+ ExtraData=PackageList, File=self.MetaFile, Line=LineNo)
+ RetVal[TokenSpaceGuid] = Value
+ self._GuidsUsedByPcd[TokenSpaceGuid] = Value
+ return RetVal
+
+ ## Retrieve include paths necessary for this module (for Edk.x style of modules)
+ @cached_property
+ def Includes(self):
+ RetVal = []
+ Macros = self._Macros
+ Macros['PROCESSOR'] = GlobalData.gEdkGlobal.get('PROCESSOR', self._Arch)
+ RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch, self._Platform]
+ for Record in RecordList:
+ File = NormPath(Record[0], Macros)
+ if File[0] == '.':
+ File = os.path.join(self._ModuleDir, File)
+ else:
+ File = mws.join(GlobalData.gWorkspace, File)
+ File = RealPath(os.path.normpath(File))
+ if File:
+ RetVal.append(File)
+ return RetVal
+
+ ## Retrieve packages this module depends on
+ @cached_property
+ def Packages(self):
+ RetVal = []
+ RecordList = self._RawData[MODEL_META_DATA_PACKAGE, self._Arch, self._Platform]
+ Macros = self._Macros
+ for Record in RecordList:
+ File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)
+ # check the file validation
+ ErrorCode, ErrorInfo = File.Validate('.dec')
+ if ErrorCode != 0:
+ LineNo = Record[-1]
+ EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)
+ # parse this package now. we need it to get protocol/ppi/guid value
+ RetVal.append(self._Bdb[File, self._Arch, self._Target, self._Toolchain])
+ return RetVal
+
+ ## Retrieve PCD comments
+ @cached_property
+ def PcdComments(self):
+ self.Pcds
+ return self._PcdComments
+
+ ## Retrieve PCDs used in this module
+ @cached_property
+ def Pcds(self):
+ self._PcdComments = OrderedDict()
+ RetVal = OrderedDict()
+ RetVal.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))
+ RetVal.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE))
+ RetVal.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG))
+ RetVal.update(self._GetPcd(MODEL_PCD_DYNAMIC))
+ RetVal.update(self._GetPcd(MODEL_PCD_DYNAMIC_EX))
+ return RetVal
+
+ @cached_property
+ def ModulePcdList(self):
+ RetVal = self.Pcds
+ return RetVal
+ @cached_property
+ def LibraryPcdList(self):
+ if bool(self.LibraryClass):
+ return []
+ RetVal = {}
+ Pcds = set()
+ for Library in self.LibInstances:
+ PcdsInLibrary = OrderedDict()
+ for Key in Library.Pcds:
+ if Key in self.Pcds or Key in Pcds:
+ continue
+ Pcds.add(Key)
+ PcdsInLibrary[Key] = copy.copy(Library.Pcds[Key])
+ RetVal[Library] = PcdsInLibrary
+ return RetVal
+ @cached_property
+ def PcdsName(self):
+ PcdsName = set()
+ for Type in (MODEL_PCD_FIXED_AT_BUILD,MODEL_PCD_PATCHABLE_IN_MODULE,MODEL_PCD_FEATURE_FLAG,MODEL_PCD_DYNAMIC,MODEL_PCD_DYNAMIC_EX):
+ RecordList = self._RawData[Type, self._Arch, self._Platform]
+ for TokenSpaceGuid, PcdCName, _, _, _, _, _ in RecordList:
+ PcdsName.add((PcdCName, TokenSpaceGuid))
+ return PcdsName
+
+ ## Retrieve build options specific to this module
+ @cached_property
+ def BuildOptions(self):
+ if self._BuildOptions is None:
+ self._BuildOptions = OrderedDict()
+ RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, self._Platform]
+ for Record in RecordList:
+ ToolChainFamily = Record[0]
+ ToolChain = Record[1]
+ Option = Record[2]
+ if (ToolChainFamily, ToolChain) not in self._BuildOptions or Option.startswith('='):
+ self._BuildOptions[ToolChainFamily, ToolChain] = Option
+ else:
+ # concatenate the option string if they're for the same tool
+ OptionString = self._BuildOptions[ToolChainFamily, ToolChain]
+ self._BuildOptions[ToolChainFamily, ToolChain] = OptionString + " " + Option
+ return self._BuildOptions
+
+ ## Retrieve dependency expression
+ @cached_property
+ def Depex(self):
+ RetVal = tdict(False, 2)
+
+ # If the module has only Binaries and no Sources, then ignore [Depex]
+ if not self.Sources and self.Binaries:
+ return RetVal
+
+ RecordList = self._RawData[MODEL_EFI_DEPEX, self._Arch]
+ # PEIM and DXE drivers must have a valid [Depex] section
+ if len(self.LibraryClass) == 0 and len(RecordList) == 0:
+ if self.ModuleType == SUP_MODULE_DXE_DRIVER or self.ModuleType == SUP_MODULE_PEIM or self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER or \
+ self.ModuleType == SUP_MODULE_DXE_SAL_DRIVER or self.ModuleType == SUP_MODULE_DXE_RUNTIME_DRIVER:
+ EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No [Depex] section or no valid expression in [Depex] section for [%s] module" \
+ % self.ModuleType, File=self.MetaFile)
+
+ if len(RecordList) != 0 and (self.ModuleType == SUP_MODULE_USER_DEFINED or self.ModuleType == SUP_MODULE_HOST_APPLICATION):
+ for Record in RecordList:
+ if Record[4] not in [SUP_MODULE_PEIM, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SMM_DRIVER]:
+ EdkLogger.error('build', FORMAT_INVALID,
+ "'%s' module must specify the type of [Depex] section" % self.ModuleType,
+ File=self.MetaFile)
+
+ TemporaryDictionary = OrderedDict()
+ for Record in RecordList:
+ DepexStr = ReplaceMacro(Record[0], self._Macros, False)
+ Arch = Record[3]
+ ModuleType = Record[4]
+ TokenList = DepexStr.split()
+ if (Arch, ModuleType) not in TemporaryDictionary:
+ TemporaryDictionary[Arch, ModuleType] = []
+ DepexList = TemporaryDictionary[Arch, ModuleType]
+ for Token in TokenList:
+ if Token in DEPEX_SUPPORTED_OPCODE_SET:
+ DepexList.append(Token)
+ elif Token.endswith(".inf"): # module file name
+ ModuleFile = os.path.normpath(Token)
+ Module = self.BuildDatabase[ModuleFile]
+ if Module is None:
+ EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Module is not found in active platform",
+ ExtraData=Token, File=self.MetaFile, Line=Record[-1])
+ DepexList.append(Module.Guid)
+ else:
+ # it use the Fixed PCD format
+ if '.' in Token:
+ if tuple(Token.split('.')[::-1]) not in self.Pcds:
+ EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "PCD [{}] used in [Depex] section should be listed in module PCD section".format(Token), File=self.MetaFile, Line=Record[-1])
+ else:
+ if self.Pcds[tuple(Token.split('.')[::-1])].DatumType != TAB_VOID:
+ EdkLogger.error('build', FORMAT_INVALID, "PCD [{}] used in [Depex] section should be VOID* datum type".format(Token), File=self.MetaFile, Line=Record[-1])
+ Value = Token
+ else:
+ # get the GUID value now
+ Value = _ProtocolValue(Token, self.Packages, self.MetaFile.Path)
+ if Value is None:
+ Value = _PpiValue(Token, self.Packages, self.MetaFile.Path)
+ if Value is None:
+ Value = GuidValue(Token, self.Packages, self.MetaFile.Path)
+
+ if Value is None:
+ PackageList = "\n\t".join(str(P) for P in self.Packages)
+ EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,
+ "Value of [%s] is not found in" % Token,
+ ExtraData=PackageList, File=self.MetaFile, Line=Record[-1])
+ DepexList.append(Value)
+ for Arch, ModuleType in TemporaryDictionary:
+ RetVal[Arch, ModuleType] = TemporaryDictionary[Arch, ModuleType]
+ return RetVal
+
+ ## Retrieve dependency expression
+ @cached_property
+ def DepexExpression(self):
+ RetVal = tdict(False, 2)
+ RecordList = self._RawData[MODEL_EFI_DEPEX, self._Arch]
+ TemporaryDictionary = OrderedDict()
+ for Record in RecordList:
+ DepexStr = ReplaceMacro(Record[0], self._Macros, False)
+ Arch = Record[3]
+ ModuleType = Record[4]
+ TokenList = DepexStr.split()
+ if (Arch, ModuleType) not in TemporaryDictionary:
+ TemporaryDictionary[Arch, ModuleType] = ''
+ for Token in TokenList:
+ TemporaryDictionary[Arch, ModuleType] = TemporaryDictionary[Arch, ModuleType] + Token.strip() + ' '
+ for Arch, ModuleType in TemporaryDictionary:
+ RetVal[Arch, ModuleType] = TemporaryDictionary[Arch, ModuleType]
+ return RetVal
+ def LocalPkg(self):
+ module_path = self.MetaFile.File
+ subdir = os.path.split(module_path)[0]
+ TopDir = ""
+ while subdir:
+ subdir,TopDir = os.path.split(subdir)
+
+ for file_name in os.listdir(os.path.join(self.MetaFile.Root,TopDir)):
+ if file_name.upper().endswith("DEC"):
+ pkg = os.path.join(TopDir,file_name)
+ return pkg
+ @cached_class_function
+ def GetGuidsUsedByPcd(self):
+ self.Guid
+ return self._GuidsUsedByPcd
+
+ ## Retrieve PCD for given type
+ def _GetPcd(self, Type):
+ Pcds = OrderedDict()
+ PcdDict = tdict(True, 4)
+ PcdList = []
+ RecordList = self._RawData[Type, self._Arch, self._Platform]
+ for TokenSpaceGuid, PcdCName, Setting, Arch, Platform, Id, LineNo in RecordList:
+ PcdDict[Arch, Platform, PcdCName, TokenSpaceGuid] = (Setting, LineNo)
+ PcdList.append((PcdCName, TokenSpaceGuid))
+ CommentRecords = self._RawData[MODEL_META_DATA_COMMENT, self._Arch, self._Platform, Id]
+ Comments = []
+ for CmtRec in CommentRecords:
+ Comments.append(CmtRec[0])
+ self._PcdComments[TokenSpaceGuid, PcdCName] = Comments
+
+ # resolve PCD type, value, datum info, etc. by getting its definition from package
+ _GuidDict = self.Guids.copy()
+ for PcdCName, TokenSpaceGuid in PcdList:
+ PcdRealName = PcdCName
+ Setting, LineNo = PcdDict[self._Arch, self.Platform, PcdCName, TokenSpaceGuid]
+ if Setting is None:
+ continue
+ ValueList = AnalyzePcdData(Setting)
+ DefaultValue = ValueList[0]
+ Pcd = PcdClassObject(
+ PcdCName,
+ TokenSpaceGuid,
+ '',
+ '',
+ DefaultValue,
+ '',
+ '',
+ {},
+ False,
+ self.Guids[TokenSpaceGuid]
+ )
+ if Type == MODEL_PCD_PATCHABLE_IN_MODULE and ValueList[1]:
+ # Patch PCD: TokenSpace.PcdCName|Value|Offset
+ Pcd.Offset = ValueList[1]
+
+ if (PcdRealName, TokenSpaceGuid) in GlobalData.MixedPcd:
+ for Package in self.Packages:
+ for key in Package.Pcds:
+ if (Package.Pcds[key].TokenCName, Package.Pcds[key].TokenSpaceGuidCName) == (PcdRealName, TokenSpaceGuid):
+ for item in GlobalData.MixedPcd[(PcdRealName, TokenSpaceGuid)]:
+ Pcd_Type = item[0].split('_')[-1]
+ if Pcd_Type == Package.Pcds[key].Type:
+ Value = Package.Pcds[key]
+ Value.TokenCName = Package.Pcds[key].TokenCName + '_' + Pcd_Type
+ if len(key) == 2:
+ newkey = (Value.TokenCName, key[1])
+ elif len(key) == 3:
+ newkey = (Value.TokenCName, key[1], key[2])
+ del Package.Pcds[key]
+ Package.Pcds[newkey] = Value
+ break
+ else:
+ pass
+ else:
+ pass
+
+ # get necessary info from package declaring this PCD
+ for Package in self.Packages:
+ #
+ # 'dynamic' in INF means its type is determined by platform;
+ # if platform doesn't give its type, use 'lowest' one in the
+ # following order, if any
+ #
+ # TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG, TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_EX
+ #
+ _GuidDict.update(Package.Guids)
+ PcdType = self._PCD_TYPE_STRING_[Type]
+ if Type == MODEL_PCD_DYNAMIC:
+ Pcd.Pending = True
+ for T in PCD_TYPE_LIST:
+ if (PcdRealName, TokenSpaceGuid) in GlobalData.MixedPcd:
+ for item in GlobalData.MixedPcd[(PcdRealName, TokenSpaceGuid)]:
+ if str(item[0]).endswith(T) and (item[0], item[1], T) in Package.Pcds:
+ PcdType = T
+ PcdCName = item[0]
+ break
+ else:
+ pass
+ break
+ else:
+ if (PcdRealName, TokenSpaceGuid, T) in Package.Pcds:
+ PcdType = T
+ break
+
+ else:
+ Pcd.Pending = False
+ if (PcdRealName, TokenSpaceGuid) in GlobalData.MixedPcd:
+ for item in GlobalData.MixedPcd[(PcdRealName, TokenSpaceGuid)]:
+ Pcd_Type = item[0].split('_')[-1]
+ if Pcd_Type == PcdType:
+ PcdCName = item[0]
+ break
+ else:
+ pass
+ else:
+ pass
+
+ if (PcdCName, TokenSpaceGuid, PcdType) in Package.Pcds:
+ PcdInPackage = Package.Pcds[PcdCName, TokenSpaceGuid, PcdType]
+ Pcd.Type = PcdType
+ Pcd.TokenValue = PcdInPackage.TokenValue
+
+ #
+ # Check whether the token value exist or not.
+ #
+ if Pcd.TokenValue is None or Pcd.TokenValue == "":
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "No TokenValue for PCD [%s.%s] in [%s]!" % (TokenSpaceGuid, PcdRealName, str(Package)),
+ File=self.MetaFile, Line=LineNo,
+ ExtraData=None
+ )
+ #
+ # Check hexadecimal token value length and format.
+ #
+ ReIsValidPcdTokenValue = re.compile(r"^[0][x|X][0]*[0-9a-fA-F]{1,8}$", re.DOTALL)
+ if Pcd.TokenValue.startswith("0x") or Pcd.TokenValue.startswith("0X"):
+ if ReIsValidPcdTokenValue.match(Pcd.TokenValue) is None:
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid:" % (Pcd.TokenValue, TokenSpaceGuid, PcdRealName, str(Package)),
+ File=self.MetaFile, Line=LineNo,
+ ExtraData=None
+ )
+
+ #
+ # Check decimal token value length and format.
+ #
+ else:
+ try:
+ TokenValueInt = int (Pcd.TokenValue, 10)
+ if (TokenValueInt < 0 or TokenValueInt > 4294967295):
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid, as a decimal it should between: 0 - 4294967295!" % (Pcd.TokenValue, TokenSpaceGuid, PcdRealName, str(Package)),
+ File=self.MetaFile, Line=LineNo,
+ ExtraData=None
+ )
+ except:
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid, it should be hexadecimal or decimal!" % (Pcd.TokenValue, TokenSpaceGuid, PcdRealName, str(Package)),
+ File=self.MetaFile, Line=LineNo,
+ ExtraData=None
+ )
+
+ Pcd.DatumType = PcdInPackage.DatumType
+ Pcd.MaxDatumSize = PcdInPackage.MaxDatumSize
+ Pcd.InfDefaultValue = Pcd.DefaultValue
+ if not Pcd.DefaultValue:
+ Pcd.DefaultValue = PcdInPackage.DefaultValue
+ else:
+ try:
+ Pcd.DefaultValue = ValueExpressionEx(Pcd.DefaultValue, Pcd.DatumType, _GuidDict)(True)
+ except BadExpression as Value:
+ EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %(TokenSpaceGuid, PcdRealName, Pcd.DefaultValue, Value),
+ File=self.MetaFile, Line=LineNo)
+ break
+ else:
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "PCD [%s.%s] in [%s] is not found in dependent packages:" % (TokenSpaceGuid, PcdRealName, self.MetaFile),
+ File=self.MetaFile, Line=LineNo,
+ ExtraData="\t%s" % '\n\t'.join(str(P) for P in self.Packages)
+ )
+ Pcds[PcdCName, TokenSpaceGuid] = Pcd
+
+ return Pcds
+
+ ## check whether current module is binary module
+ @property
+ def IsBinaryModule(self):
+ if (self.Binaries and not self.Sources) or GlobalData.gIgnoreSource:
+ return True
+ return False
+def ExtendCopyDictionaryLists(CopyToDict, CopyFromDict):
+ for Key in CopyFromDict:
+ CopyToDict[Key].extend(CopyFromDict[Key])
diff --git a/roms/edk2/BaseTools/Source/Python/Workspace/MetaDataTable.py b/roms/edk2/BaseTools/Source/Python/Workspace/MetaDataTable.py
new file mode 100644
index 000000000..a20bd1478
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Workspace/MetaDataTable.py
@@ -0,0 +1,306 @@
+## @file
+# This file is used to create/update/query/erase table for files
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+import Common.LongFilePathOs as os
+
+import Common.EdkLogger as EdkLogger
+from CommonDataClass import DataClass
+from CommonDataClass.DataClass import FileClass
+
+## Convert to SQL required string format
+def ConvertToSqlString(StringList):
+ return list(map(lambda s: "'" + s.replace("'", "''") + "'", StringList))
+
+## TableFile
+#
+# This class defined a common table
+#
+# @param object: Inherited from object class
+#
+# @param Cursor: Cursor of the database
+# @param TableName: Name of the table
+#
+class Table(object):
+ _COLUMN_ = ''
+ _ID_STEP_ = 1
+ _ID_MAX_ = 0x80000000
+ _DUMMY_ = 0
+
+ def __init__(self, Db, Name='', IdBase=0, Temporary=False):
+ self.Db = Db
+ self.Table = Name
+ self.IdBase = int(IdBase)
+ self.ID = int(IdBase)
+ self.Temporary = Temporary
+ self.Contents = []
+
+ def __str__(self):
+ return self.Table
+
+ ## Create table
+ #
+ # Create a table
+ #
+ def Create(self, NewTable=True):
+ self.Db.CreateEmptyTable(self.Table)
+ self.ID = self.GetId()
+
+ ## Insert table
+ #
+ # Insert a record into a table
+ #
+ def Insert(self, *Args):
+ self.ID = self.ID + self._ID_STEP_
+ if self.ID >= (self.IdBase + self._ID_MAX_):
+ self.ID = self.IdBase + self._ID_STEP_
+ row = [self.ID]
+ row.extend(Args)
+ self.Contents.append(row)
+
+ return self.ID
+
+
+ ## Get count
+ #
+ # Get a count of all records of the table
+ #
+ # @retval Count: Total count of all records
+ #
+ def GetCount(self):
+ tab = self.Db.GetTable(self.Table)
+ return len(tab)
+
+
+ def GetId(self):
+ tab = self.Db.GetTable(self.Table)
+ Id = max([int(item[0]) for item in tab])
+ if Id is None:
+ Id = self.IdBase
+ return Id
+
+ ## Init the ID of the table
+ #
+ # Init the ID of the table
+ #
+ def InitID(self):
+ self.ID = self.GetId()
+
+ ## Exec
+ #
+ # Exec Sql Command, return result
+ #
+ # @param SqlCommand: The SqlCommand to be executed
+ #
+ # @retval RecordSet: The result after executed
+ #
+ def Exec(self, SqlCommand):
+ EdkLogger.debug(EdkLogger.DEBUG_5, SqlCommand)
+ self.Db.execute(SqlCommand)
+ RecordSet = self.Db.fetchall()
+ return RecordSet
+
+ def SetEndFlag(self):
+ Tab = self.Db.GetTable(self.Table)
+ Tab.append(self._DUMMY_)
+
+
+ def IsIntegral(self):
+ tab = self.Db.GetTable(self.Table)
+ Id = min([int(item[0]) for item in tab])
+ if Id != -1:
+ return False
+ return True
+
+ def GetAll(self):
+ tab = self.Db.GetTable(self.Table)
+ return tab
+
+
+## TableFile
+#
+# This class defined a table used for file
+#
+# @param object: Inherited from object class
+#
+class TableFile(Table):
+ _COLUMN_ = '''
+ ID INTEGER PRIMARY KEY,
+ Name VARCHAR NOT NULL,
+ ExtName VARCHAR,
+ Path VARCHAR,
+ FullPath VARCHAR NOT NULL,
+ Model INTEGER DEFAULT 0,
+ TimeStamp SINGLE NOT NULL,
+ FromItem REAL NOT NULL
+ '''
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor, 'File')
+
+ ## Insert table
+ #
+ # Insert a record into table File
+ #
+ # @param Name: Name of a File
+ # @param ExtName: ExtName of a File
+ # @param Path: Path of a File
+ # @param FullPath: FullPath of a File
+ # @param Model: Model of a File
+ # @param TimeStamp: TimeStamp of a File
+ #
+ def Insert(self, Name, ExtName, Path, FullPath, Model, TimeStamp, FromItem=0):
+ (Name, ExtName, Path, FullPath) = ConvertToSqlString((Name, ExtName, Path, FullPath))
+ return Table.Insert(
+ self,
+ Name,
+ ExtName,
+ Path,
+ FullPath,
+ Model,
+ TimeStamp,
+ FromItem
+ )
+
+ ## InsertFile
+ #
+ # Insert one file to table
+ #
+ # @param FileFullPath: The full path of the file
+ # @param Model: The model of the file
+ #
+ # @retval FileID: The ID after record is inserted
+ #
+ def InsertFile(self, File, Model, FromItem=''):
+ if FromItem:
+ return self.Insert(
+ File.Name,
+ File.Ext,
+ File.Dir,
+ File.Path,
+ Model,
+ File.TimeStamp,
+ FromItem
+ )
+ return self.Insert(
+ File.Name,
+ File.Ext,
+ File.Dir,
+ File.Path,
+ Model,
+ File.TimeStamp
+ )
+
+ ## Get type of a given file
+ #
+ # @param FileId ID of a file
+ #
+ # @retval file_type Model value of given file in the table
+ #
+ def GetFileType(self, FileId):
+ QueryScript = "select Model from %s where ID = '%s'" % (self.Table, FileId)
+ RecordList = self.Exec(QueryScript)
+ if len(RecordList) == 0:
+ return None
+ return RecordList[0][0]
+
+ ## Get file timestamp of a given file
+ #
+ # @param FileId ID of file
+ #
+ # @retval timestamp TimeStamp value of given file in the table
+ #
+ def GetFileTimeStamp(self, FileId):
+ QueryScript = "select TimeStamp from %s where ID = '%s'" % (self.Table, FileId)
+ RecordList = self.Exec(QueryScript)
+ if len(RecordList) == 0:
+ return None
+ return RecordList[0][0]
+
+ ## Update the timestamp of a given file
+ #
+ # @param FileId ID of file
+ # @param TimeStamp Time stamp of file
+ #
+ def SetFileTimeStamp(self, FileId, TimeStamp):
+ self.Exec("update %s set TimeStamp=%s where ID='%s'" % (self.Table, TimeStamp, FileId))
+
+ ## Get list of file with given type
+ #
+ # @param FileType Type value of file
+ #
+ # @retval file_list List of files with the given type
+ #
+ def GetFileList(self, FileType):
+ RecordList = self.Exec("select FullPath from %s where Model=%s" % (self.Table, FileType))
+ if len(RecordList) == 0:
+ return []
+ return [R[0] for R in RecordList]
+
+## TableDataModel
+#
+# This class defined a table used for data model
+#
+# @param object: Inherited from object class
+#
+#
+class TableDataModel(Table):
+ _COLUMN_ = """
+ ID INTEGER PRIMARY KEY,
+ CrossIndex INTEGER NOT NULL,
+ Name VARCHAR NOT NULL,
+ Description VARCHAR
+ """
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor, 'DataModel')
+
+ ## Insert table
+ #
+ # Insert a record into table DataModel
+ #
+ # @param ID: ID of a ModelType
+ # @param CrossIndex: CrossIndex of a ModelType
+ # @param Name: Name of a ModelType
+ # @param Description: Description of a ModelType
+ #
+ def Insert(self, CrossIndex, Name, Description):
+ (Name, Description) = ConvertToSqlString((Name, Description))
+ return Table.Insert(self, CrossIndex, Name, Description)
+
+ ## Init table
+ #
+ # Create all default records of table DataModel
+ #
+ def InitTable(self):
+ EdkLogger.verbose("\nInitialize table DataModel started ...")
+ Count = self.GetCount()
+ if Count is not None and Count != 0:
+ return
+ for Item in DataClass.MODEL_LIST:
+ CrossIndex = Item[1]
+ Name = Item[0]
+ Description = Item[0]
+ self.Insert(CrossIndex, Name, Description)
+ EdkLogger.verbose("Initialize table DataModel ... DONE!")
+
+ ## Get CrossIndex
+ #
+ # Get a model's cross index from its name
+ #
+ # @param ModelName: Name of the model
+ # @retval CrossIndex: CrossIndex of the model
+ #
+ def GetCrossIndex(self, ModelName):
+ CrossIndex = -1
+ SqlCommand = """select CrossIndex from DataModel where name = '""" + ModelName + """'"""
+ self.Db.execute(SqlCommand)
+ for Item in self.Db:
+ CrossIndex = Item[0]
+
+ return CrossIndex
+
diff --git a/roms/edk2/BaseTools/Source/Python/Workspace/MetaFileCommentParser.py b/roms/edk2/BaseTools/Source/Python/Workspace/MetaFileCommentParser.py
new file mode 100644
index 000000000..3737ae351
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Workspace/MetaFileCommentParser.py
@@ -0,0 +1,45 @@
+## @file
+# This file is used to check format of comments
+#
+# Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from CommonDataClass.DataClass import (
+ MODEL_PCD_PATCHABLE_IN_MODULE,
+ MODEL_PCD_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC,
+ MODEL_EFI_GUID,
+ MODEL_EFI_PPI,
+ MODEL_EFI_PROTOCOL
+)
+from Common.BuildToolError import FORMAT_INVALID
+import Common.EdkLogger as EdkLogger
+
+UsageList = ("PRODUCES", "PRODUCED", "ALWAYS_PRODUCES", "ALWAYS_PRODUCED", "SOMETIMES_PRODUCES",
+ "SOMETIMES_PRODUCED", "CONSUMES", "CONSUMED", "ALWAYS_CONSUMES", "ALWAYS_CONSUMED",
+ "SOMETIMES_CONSUMES", "SOMETIMES_CONSUMED", "SOMETIME_CONSUMES")
+ErrorMsgMap = {
+ MODEL_EFI_GUID : "The usage for this GUID is not listed in this INF: %s[%d]:%s",
+ MODEL_EFI_PPI : "The usage for this PPI is not listed in this INF: %s[%d]:%s.",
+ MODEL_EFI_PROTOCOL : "The usage for this Protocol is not listed in this INF: %s[%d]:%s.",
+ MODEL_PCD_DYNAMIC : "The usage for this PCD is not listed in this INF: %s[%d]:%s."
+}
+
+def CheckInfComment(SectionType, Comments, InfFile, LineNo, ValueList):
+ if SectionType in [MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_EX, MODEL_PCD_DYNAMIC]:
+ CheckUsage(Comments, UsageList, InfFile, LineNo, ValueList[0]+'.'+ValueList[1], ErrorMsgMap[MODEL_PCD_DYNAMIC])
+ elif SectionType in [MODEL_EFI_GUID, MODEL_EFI_PPI]:
+ CheckUsage(Comments, UsageList, InfFile, LineNo, ValueList[0], ErrorMsgMap[SectionType])
+ elif SectionType == MODEL_EFI_PROTOCOL:
+ CheckUsage(Comments, UsageList + ("TO_START", "BY_START"), InfFile, LineNo, ValueList[0], ErrorMsgMap[SectionType])
+
+def CheckUsage(Comments, Usages, InfFile, LineNo, Value, ErrorMsg):
+ for Comment in Comments:
+ for Word in Comment[0].replace('#', ' ').split():
+ if Word in Usages:
+ return
+ EdkLogger.error(
+ "Parser", FORMAT_INVALID,
+ ErrorMsg % (InfFile, LineNo, Value)
+ )
diff --git a/roms/edk2/BaseTools/Source/Python/Workspace/MetaFileParser.py b/roms/edk2/BaseTools/Source/Python/Workspace/MetaFileParser.py
new file mode 100644
index 000000000..a3b6edbd1
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -0,0 +1,2193 @@
+## @file
+# This file is used to parse meta files
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# (C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+import Common.LongFilePathOs as os
+import re
+import time
+import copy
+from hashlib import md5
+
+import Common.EdkLogger as EdkLogger
+import Common.GlobalData as GlobalData
+
+from CommonDataClass.DataClass import *
+from Common.DataType import *
+from Common.StringUtils import *
+from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, PathClass, AnalyzePcdData, AnalyzeDscPcd, AnalyzePcdExpression, ParseFieldValue, StructPattern
+from Common.Expression import *
+from CommonDataClass.Exceptions import *
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from collections import defaultdict
+from .MetaFileTable import MetaFileStorage
+from .MetaFileCommentParser import CheckInfComment
+from Common.DataType import TAB_COMMENT_EDK_START, TAB_COMMENT_EDK_END
+
+## RegEx for finding file versions
+hexVersionPattern = re.compile(r'0[xX][\da-f-A-F]{5,8}')
+decVersionPattern = re.compile(r'\d+\.\d+')
+CODEPattern = re.compile(r"{CODE\([a-fA-F0-9Xx\{\},\s]*\)}")
+
+## A decorator used to parse macro definition
+def ParseMacro(Parser):
+ def MacroParser(self):
+ Match = GlobalData.gMacroDefPattern.match(self._CurrentLine)
+ if not Match:
+ # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method
+ Parser(self)
+ return
+
+ TokenList = GetSplitValueList(self._CurrentLine[Match.end(1):], TAB_EQUAL_SPLIT, 1)
+ # Syntax check
+ if not TokenList[0]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No macro name given",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ if len(TokenList) < 2:
+ TokenList.append('')
+
+ Type = Match.group(1)
+ Name, Value = TokenList
+ # Global macros can be only defined via environment variable
+ if Name in GlobalData.gGlobalDefines:
+ EdkLogger.error('Parser', FORMAT_INVALID, "%s can only be defined via environment variable" % Name,
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ # Only upper case letters, digit and '_' are allowed
+ if not GlobalData.gMacroNamePattern.match(Name):
+ EdkLogger.error('Parser', FORMAT_INVALID, "The macro name must be in the pattern [A-Z][A-Z0-9_]*",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+
+ Value = ReplaceMacro(Value, self._Macros)
+ if Type in self.DataType:
+ self._ItemType = self.DataType[Type]
+ else:
+ self._ItemType = MODEL_META_DATA_DEFINE
+ # DEFINE defined macros
+ if Type == TAB_DSC_DEFINES_DEFINE:
+ #
+ # First judge whether this DEFINE is in conditional directive statements or not.
+ #
+ if isinstance(self, DscParser) and self._InDirective > -1:
+ pass
+ else:
+ if isinstance(self, DecParser):
+ if MODEL_META_DATA_HEADER in self._SectionType:
+ self._FileLocalMacros[Name] = Value
+ else:
+ self._ConstructSectionMacroDict(Name, Value)
+ elif self._SectionType == MODEL_META_DATA_HEADER:
+ self._FileLocalMacros[Name] = Value
+ else:
+ self._ConstructSectionMacroDict(Name, Value)
+
+ # EDK_GLOBAL defined macros
+ elif not isinstance(self, DscParser):
+ EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used in .dsc file",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ elif self._SectionType != MODEL_META_DATA_HEADER:
+ EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used under [Defines] section",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ elif (Name in self._FileLocalMacros) and (self._FileLocalMacros[Name] != Value):
+ EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL defined a macro with the same name and different value as one defined by 'DEFINE'",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+
+ self._ValueList = [Type, Name, Value]
+
+ return MacroParser
+
+## Base class of parser
+#
+# This class is used for derivation purpose. The specific parser for one kind
+# type file must derive this class and implement some public interfaces.
+#
+# @param FilePath The path of platform description file
+# @param FileType The raw data of DSC file
+# @param Table Database used to retrieve module/package information
+# @param Macros Macros used for replacement in file
+# @param Owner Owner ID (for sub-section parsing)
+# @param From ID from which the data comes (for !INCLUDE directive)
+#
+class MetaFileParser(object):
+ # data type (file content) for specific file type
+ DataType = {}
+
+ # Parser objects used to implement singleton
+ MetaFiles = {}
+
+ ## Factory method
+ #
+ # One file, one parser object. This factory method makes sure that there's
+ # only one object constructed for one meta file.
+ #
+ # @param Class class object of real AutoGen class
+ # (InfParser, DecParser or DscParser)
+ # @param FilePath The path of meta file
+ # @param *args The specific class related parameters
+ # @param **kwargs The specific class related dict parameters
+ #
+ def __new__(Class, FilePath, *args, **kwargs):
+ if FilePath in Class.MetaFiles:
+ return Class.MetaFiles[FilePath]
+ else:
+ ParserObject = super(MetaFileParser, Class).__new__(Class)
+ Class.MetaFiles[FilePath] = ParserObject
+ return ParserObject
+
+ ## Constructor of MetaFileParser
+ #
+ # Initialize object of MetaFileParser
+ #
+ # @param FilePath The path of platform description file
+ # @param FileType The raw data of DSC file
+ # @param Arch Default Arch value for filtering sections
+ # @param Table Database used to retrieve module/package information
+ # @param Owner Owner ID (for sub-section parsing)
+ # @param From ID from which the data comes (for !INCLUDE directive)
+ #
+ def __init__(self, FilePath, FileType, Arch, Table, Owner= -1, From= -1):
+ self._Table = Table
+ self._RawTable = Table
+ self._Arch = Arch
+ self._FileType = FileType
+ self.MetaFile = FilePath
+ self._FileDir = self.MetaFile.Dir
+ self._Defines = {}
+ self._Packages = []
+ self._FileLocalMacros = {}
+ self._SectionsMacroDict = defaultdict(dict)
+
+ # for recursive parsing
+ self._Owner = [Owner]
+ self._From = From
+
+ # parsr status for parsing
+ self._ValueList = ['', '', '', '', '']
+ self._Scope = []
+ self._LineIndex = 0
+ self._CurrentLine = ''
+ self._SectionType = MODEL_UNKNOWN
+ self._SectionName = ''
+ self._InSubsection = False
+ self._SubsectionType = MODEL_UNKNOWN
+ self._SubsectionName = ''
+ self._ItemType = MODEL_UNKNOWN
+ self._LastItem = -1
+ self._Enabled = 0
+ self._Finished = False
+ self._PostProcessed = False
+ # Different version of meta-file has different way to parse.
+ self._Version = 0
+ self._GuidDict = {} # for Parser PCD value {GUID(gTokeSpaceGuidName)}
+
+ self._PcdCodeValue = ""
+ self._PcdDataTypeCODE = False
+ self._CurrentPcdName = ""
+
+ ## Store the parsed data in table
+ def _Store(self, *Args):
+ return self._Table.Insert(*Args)
+
+ ## Virtual method for starting parse
+ def Start(self):
+ raise NotImplementedError
+
+ ## Notify a post-process is needed
+ def DoPostProcess(self):
+ self._PostProcessed = False
+
+ ## Set parsing complete flag in both class and table
+ def _Done(self):
+ self._Finished = True
+ self._Table.SetEndFlag()
+
+ def _PostProcess(self):
+ self._PostProcessed = True
+
+ ## Get the parse complete flag
+ @property
+ def Finished(self):
+ return self._Finished
+
+ ## Set the complete flag
+ @Finished.setter
+ def Finished(self, Value):
+ self._Finished = Value
+
+ ## Remove records that do not match given Filter Arch
+ def _FilterRecordList(self, RecordList, FilterArch):
+ NewRecordList = []
+ for Record in RecordList:
+ Arch = Record[3]
+ if Arch == TAB_ARCH_COMMON or Arch == FilterArch:
+ NewRecordList.append(Record)
+ return NewRecordList
+
+ ## Use [] style to query data in table, just for readability
+ #
+ # DataInfo = [data_type, scope1(arch), scope2(platform/moduletype)]
+ #
+ def __getitem__(self, DataInfo):
+ if not isinstance(DataInfo, type(())):
+ DataInfo = (DataInfo,)
+
+ # Parse the file first, if necessary
+ self.StartParse()
+
+ # No specific ARCH or Platform given, use raw data
+ if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] is None):
+ return self._FilterRecordList(self._RawTable.Query(*DataInfo), self._Arch)
+
+ # Do post-process if necessary
+ if not self._PostProcessed:
+ self._PostProcess()
+
+ return self._FilterRecordList(self._Table.Query(*DataInfo), DataInfo[1])
+
+ def StartParse(self):
+ if not self._Finished:
+ if self._RawTable.IsIntegrity():
+ self._Finished = True
+ else:
+ self._Table = self._RawTable
+ self._PostProcessed = False
+ self.Start()
+ ## Data parser for the common format in different type of file
+ #
+ # The common format in the meatfile is like
+ #
+ # xxx1 | xxx2 | xxx3
+ #
+ @ParseMacro
+ def _CommonParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ self._ValueList[0:len(TokenList)] = TokenList
+
+ ## Data parser for the format in which there's path
+ #
+ # Only path can have macro used. So we need to replace them before use.
+ #
+ @ParseMacro
+ def _PathParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ self._ValueList[0:len(TokenList)] = TokenList
+ # Don't do macro replacement for dsc file at this point
+ if not isinstance(self, DscParser):
+ Macros = self._Macros
+ self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList]
+
+ ## Skip unsupported data
+ def _Skip(self):
+ EdkLogger.warn("Parser", "Unrecognized content", File=self.MetaFile,
+ Line=self._LineIndex + 1, ExtraData=self._CurrentLine);
+ self._ValueList[0:1] = [self._CurrentLine]
+
+ ## Skip unsupported data for UserExtension Section
+ def _SkipUserExtension(self):
+ self._ValueList[0:1] = [self._CurrentLine]
+
+ ## Section header parser
+ #
+ # The section header is always in following format:
+ #
+ # [section_name.arch<.platform|module_type>]
+ #
+ def _SectionHeaderParser(self):
+ self._Scope = []
+ self._SectionName = ''
+ ArchList = set()
+ for Item in GetSplitValueList(self._CurrentLine[1:-1], TAB_COMMA_SPLIT):
+ if Item == '':
+ continue
+ ItemList = GetSplitValueList(Item, TAB_SPLIT, 3)
+ # different section should not mix in one section
+ if self._SectionName != '' and self._SectionName != ItemList[0].upper():
+ EdkLogger.error('Parser', FORMAT_INVALID, "Different section names in the same section",
+ File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
+ self._SectionName = ItemList[0].upper()
+ if self._SectionName in self.DataType:
+ self._SectionType = self.DataType[self._SectionName]
+ # Check if the section name is valid
+ if self._SectionName not in SECTIONS_HAVE_ITEM_AFTER_ARCH_SET and len(ItemList) > 3:
+ EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item,
+ self.MetaFile, self._LineIndex + 1, self._CurrentLine)
+ elif self._Version >= 0x00010005:
+ EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item,
+ self.MetaFile, self._LineIndex + 1, self._CurrentLine)
+ else:
+ self._SectionType = MODEL_UNKNOWN
+
+ # S1 is always Arch
+ if len(ItemList) > 1:
+ S1 = ItemList[1].upper()
+ else:
+ S1 = TAB_ARCH_COMMON
+ S1 = ReplaceMacro(S1, self._Macros)
+ ArchList.add(S1)
+
+ # S2 may be Platform or ModuleType
+ if len(ItemList) > 2:
+ if self._SectionName.upper() in SECTIONS_HAVE_ITEM_PCD_SET:
+ S2 = ItemList[2]
+ else:
+ S2 = ItemList[2].upper()
+ else:
+ S2 = TAB_COMMON
+ if len(ItemList) > 3:
+ S3 = ItemList[3]
+ else:
+ S3 = TAB_COMMON
+ self._Scope.append([S1, S2, S3])
+
+ # 'COMMON' must not be used with specific ARCHs at the same section
+ if TAB_ARCH_COMMON in ArchList and len(ArchList) > 1:
+ EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs",
+ File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
+ # If the section information is needed later, it should be stored in database
+ self._ValueList[0] = self._SectionName
+
+ ## [packages] section parser
+ @ParseMacro
+ def _PackageParser(self):
+ self._CurrentLine = CleanString(self._CurrentLine)
+ self._Packages.append(self._CurrentLine)
+ self._ValueList[0] = self._CurrentLine
+
+ ## [defines] section parser
+ @ParseMacro
+ def _DefineParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+ self._ValueList[1:len(TokenList)] = TokenList
+ if not self._ValueList[1]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No name specified",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ if not self._ValueList[2]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+
+ self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList]
+ Name, Value = self._ValueList[1], self._ValueList[2]
+ MacroUsed = GlobalData.gMacroRefPattern.findall(Value)
+ if len(MacroUsed) != 0:
+ for Macro in MacroUsed:
+ if Macro in GlobalData.gGlobalDefines:
+ EdkLogger.error("Parser", FORMAT_INVALID, "Global macro %s is not permitted." % (Macro), ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ else:
+ EdkLogger.error("Parser", FORMAT_INVALID, "%s not defined" % (Macro), ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ # Sometimes, we need to make differences between EDK and EDK2 modules
+ if Name == 'INF_VERSION':
+ if hexVersionPattern.match(Value):
+ self._Version = int(Value, 0)
+ elif decVersionPattern.match(Value):
+ ValueList = Value.split('.')
+ Major = int(ValueList[0], 0)
+ Minor = int(ValueList[1], 0)
+ if Major > 0xffff or Minor > 0xffff:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ self._Version = int('0x{0:04x}{1:04x}'.format(Major, Minor), 0)
+ else:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+
+ if isinstance(self, InfParser) and self._Version < 0x00010005:
+ # EDK module allows using defines as macros
+ self._FileLocalMacros[Name] = Value
+ self._Defines[Name] = Value
+
+ ## [BuildOptions] section parser
+ @ParseMacro
+ def _BuildOptionParser(self):
+ self._CurrentLine = CleanString(self._CurrentLine, BuildOption=True)
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+ TokenList2 = GetSplitValueList(TokenList[0], ':', 1)
+ if len(TokenList2) == 2:
+ self._ValueList[0] = TokenList2[0] # toolchain family
+ self._ValueList[1] = TokenList2[1] # keys
+ else:
+ self._ValueList[1] = TokenList[0]
+ if len(TokenList) == 2 and not isinstance(self, DscParser): # value
+ self._ValueList[2] = ReplaceMacro(TokenList[1], self._Macros)
+
+ if self._ValueList[1].count('_') != 4:
+ EdkLogger.error(
+ 'Parser',
+ FORMAT_INVALID,
+ "'%s' must be in format of <TARGET>_<TOOLCHAIN>_<ARCH>_<TOOL>_FLAGS" % self._ValueList[1],
+ ExtraData=self._CurrentLine,
+ File=self.MetaFile,
+ Line=self._LineIndex + 1
+ )
+ def GetValidExpression(self, TokenSpaceGuid, PcdCName):
+ return self._Table.GetValidExpression(TokenSpaceGuid, PcdCName)
+
+ @property
+ def _Macros(self):
+ Macros = {}
+ Macros.update(self._FileLocalMacros)
+ Macros.update(self._GetApplicableSectionMacro())
+ return Macros
+
+ ## Construct section Macro dict
+ def _ConstructSectionMacroDict(self, Name, Value):
+ ScopeKey = [(Scope[0], Scope[1], Scope[2]) for Scope in self._Scope]
+ ScopeKey = tuple(ScopeKey)
+ #
+ # DecParser SectionType is a list, will contain more than one item only in Pcd Section
+ # As Pcd section macro usage is not allowed, so here it is safe
+ #
+ if isinstance(self, DecParser):
+ SectionDictKey = self._SectionType[0], ScopeKey
+ else:
+ SectionDictKey = self._SectionType, ScopeKey
+
+ self._SectionsMacroDict[SectionDictKey][Name] = Value
+
+ ## Get section Macros that are applicable to current line, which may come from other sections
+ ## that share the same name while scope is wider
+ def _GetApplicableSectionMacro(self):
+ Macros = {}
+
+ ComComMacroDict = {}
+ ComSpeMacroDict = {}
+ SpeSpeMacroDict = {}
+
+ ActiveSectionType = self._SectionType
+ if isinstance(self, DecParser):
+ ActiveSectionType = self._SectionType[0]
+
+ for (SectionType, Scope) in self._SectionsMacroDict:
+ if SectionType != ActiveSectionType:
+ continue
+
+ for ActiveScope in self._Scope:
+ Scope0, Scope1, Scope2= ActiveScope[0], ActiveScope[1], ActiveScope[2]
+ if(Scope0, Scope1, Scope2) not in Scope:
+ break
+ else:
+ SpeSpeMacroDict.update(self._SectionsMacroDict[(SectionType, Scope)])
+
+ for ActiveScope in self._Scope:
+ Scope0, Scope1, Scope2 = ActiveScope[0], ActiveScope[1], ActiveScope[2]
+ if(Scope0, Scope1, Scope2) not in Scope and (Scope0, TAB_COMMON, TAB_COMMON) not in Scope and (TAB_COMMON, Scope1, TAB_COMMON) not in Scope:
+ break
+ else:
+ ComSpeMacroDict.update(self._SectionsMacroDict[(SectionType, Scope)])
+
+ if (TAB_COMMON, TAB_COMMON, TAB_COMMON) in Scope:
+ ComComMacroDict.update(self._SectionsMacroDict[(SectionType, Scope)])
+
+ Macros.update(ComComMacroDict)
+ Macros.update(ComSpeMacroDict)
+ Macros.update(SpeSpeMacroDict)
+
+ return Macros
+
+ def ProcessMultipleLineCODEValue(self,Content):
+ CODEBegin = False
+ CODELine = ""
+ continuelinecount = 0
+ newContent = []
+ for Index in range(0, len(Content)):
+ Line = Content[Index]
+ if CODEBegin:
+ CODELine = CODELine + Line
+ continuelinecount +=1
+ if ")}" in Line:
+ newContent.append(CODELine)
+ for _ in range(continuelinecount):
+ newContent.append("")
+ CODEBegin = False
+ CODELine = ""
+ continuelinecount = 0
+ else:
+ if not Line:
+ newContent.append(Line)
+ continue
+ if "{CODE(" not in Line:
+ newContent.append(Line)
+ continue
+ elif CODEPattern.findall(Line):
+ newContent.append(Line)
+ continue
+ else:
+ CODEBegin = True
+ CODELine = Line
+
+ return newContent
+
+ _SectionParser = {}
+
+## INF file parser class
+#
+# @param FilePath The path of platform description file
+# @param FileType The raw data of DSC file
+# @param Table Database used to retrieve module/package information
+# @param Macros Macros used for replacement in file
+#
+class InfParser(MetaFileParser):
+ # INF file supported data types (one type per section)
+ DataType = {
+ TAB_UNKNOWN.upper() : MODEL_UNKNOWN,
+ TAB_INF_DEFINES.upper() : MODEL_META_DATA_HEADER,
+ TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE,
+ TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION,
+ TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE,
+ TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE,
+ TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS,
+ TAB_PACKAGES.upper() : MODEL_META_DATA_PACKAGE,
+ TAB_NMAKE.upper() : MODEL_META_DATA_NMAKE,
+ TAB_INF_FIXED_PCD.upper() : MODEL_PCD_FIXED_AT_BUILD,
+ TAB_INF_PATCH_PCD.upper() : MODEL_PCD_PATCHABLE_IN_MODULE,
+ TAB_INF_FEATURE_PCD.upper() : MODEL_PCD_FEATURE_FLAG,
+ TAB_INF_PCD_EX.upper() : MODEL_PCD_DYNAMIC_EX,
+ TAB_INF_PCD.upper() : MODEL_PCD_DYNAMIC,
+ TAB_SOURCES.upper() : MODEL_EFI_SOURCE_FILE,
+ TAB_GUIDS.upper() : MODEL_EFI_GUID,
+ TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL,
+ TAB_PPIS.upper() : MODEL_EFI_PPI,
+ TAB_DEPEX.upper() : MODEL_EFI_DEPEX,
+ TAB_BINARIES.upper() : MODEL_EFI_BINARY_FILE,
+ TAB_USER_EXTENSIONS.upper() : MODEL_META_DATA_USER_EXTENSION
+ }
+
+ ## Constructor of InfParser
+ #
+ # Initialize object of InfParser
+ #
+ # @param FilePath The path of module description file
+ # @param FileType The raw data of DSC file
+ # @param Arch Default Arch value for filtering sections
+ # @param Table Database used to retrieve module/package information
+ #
+ def __init__(self, FilePath, FileType, Arch, Table):
+ # prevent re-initialization
+ if hasattr(self, "_Table"):
+ return
+ MetaFileParser.__init__(self, FilePath, FileType, Arch, Table)
+ self.PcdsDict = {}
+
+ ## Parser starter
+ def Start(self):
+ NmakeLine = ''
+ Content = ''
+ try:
+ with open(str(self.MetaFile), 'r') as File:
+ Content = File.readlines()
+ except:
+ EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile)
+
+ # parse the file line by line
+ IsFindBlockComment = False
+ GetHeaderComment = False
+ TailComments = []
+ SectionComments = []
+ Comments = []
+
+ for Index in range(0, len(Content)):
+ # skip empty, commented, block commented lines
+ Line, Comment = CleanString2(Content[Index], AllowCppStyleComment=True)
+ NextLine = ''
+ if Index + 1 < len(Content):
+ NextLine, NextComment = CleanString2(Content[Index + 1])
+ if Line == '':
+ if Comment:
+ Comments.append((Comment, Index + 1))
+ elif GetHeaderComment:
+ SectionComments.extend(Comments)
+ Comments = []
+ continue
+ if Line.find(TAB_COMMENT_EDK_START) > -1:
+ IsFindBlockComment = True
+ continue
+ if Line.find(TAB_COMMENT_EDK_END) > -1:
+ IsFindBlockComment = False
+ continue
+ if IsFindBlockComment:
+ continue
+
+ self._LineIndex = Index
+ self._CurrentLine = Line
+
+ # section header
+ if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END:
+ if not GetHeaderComment:
+ for Cmt, LNo in Comments:
+ self._Store(MODEL_META_DATA_HEADER_COMMENT, Cmt, '', '', TAB_COMMON,
+ TAB_COMMON, self._Owner[-1], LNo, -1, LNo, -1, 0)
+ GetHeaderComment = True
+ else:
+ TailComments.extend(SectionComments + Comments)
+ Comments = []
+ self._SectionHeaderParser()
+ # Check invalid sections
+ if self._Version < 0x00010005:
+ if self._SectionType in [MODEL_META_DATA_BUILD_OPTION,
+ MODEL_EFI_LIBRARY_CLASS,
+ MODEL_META_DATA_PACKAGE,
+ MODEL_PCD_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC,
+ MODEL_EFI_GUID,
+ MODEL_EFI_PROTOCOL,
+ MODEL_EFI_PPI,
+ MODEL_META_DATA_USER_EXTENSION]:
+ EdkLogger.error('Parser', FORMAT_INVALID,
+ "Section [%s] is not allowed in inf file without version" % (self._SectionName),
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ elif self._SectionType in [MODEL_EFI_INCLUDE,
+ MODEL_EFI_LIBRARY_INSTANCE,
+ MODEL_META_DATA_NMAKE]:
+ EdkLogger.error('Parser', FORMAT_INVALID,
+ "Section [%s] is not allowed in inf file with version 0x%08x" % (self._SectionName, self._Version),
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ continue
+ # merge two lines specified by '\' in section NMAKE
+ elif self._SectionType == MODEL_META_DATA_NMAKE:
+ if Line[-1] == '\\':
+ if NextLine == '':
+ self._CurrentLine = NmakeLine + Line[0:-1]
+ NmakeLine = ''
+ else:
+ if NextLine[0] == TAB_SECTION_START and NextLine[-1] == TAB_SECTION_END:
+ self._CurrentLine = NmakeLine + Line[0:-1]
+ NmakeLine = ''
+ else:
+ NmakeLine = NmakeLine + ' ' + Line[0:-1]
+ continue
+ else:
+ self._CurrentLine = NmakeLine + Line
+ NmakeLine = ''
+
+ # section content
+ self._ValueList = ['', '', '']
+ # parse current line, result will be put in self._ValueList
+ self._SectionParser[self._SectionType](self)
+ if self._ValueList is None or self._ItemType == MODEL_META_DATA_DEFINE:
+ self._ItemType = -1
+ Comments = []
+ continue
+ if Comment:
+ Comments.append((Comment, Index + 1))
+ if GlobalData.gOptions and GlobalData.gOptions.CheckUsage:
+ CheckInfComment(self._SectionType, Comments, str(self.MetaFile), Index + 1, self._ValueList)
+ #
+ # Model, Value1, Value2, Value3, Arch, Platform, BelongsToItem=-1,
+ # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1
+ #
+ for Arch, Platform, _ in self._Scope:
+ LastItem = self._Store(self._SectionType,
+ self._ValueList[0],
+ self._ValueList[1],
+ self._ValueList[2],
+ Arch,
+ Platform,
+ self._Owner[-1],
+ self._LineIndex + 1,
+ - 1,
+ self._LineIndex + 1,
+ - 1,
+ 0
+ )
+ for Comment, LineNo in Comments:
+ self._Store(MODEL_META_DATA_COMMENT, Comment, '', '', Arch, Platform,
+ LastItem, LineNo, -1, LineNo, -1, 0)
+ Comments = []
+ SectionComments = []
+ TailComments.extend(SectionComments + Comments)
+ if IsFindBlockComment:
+ EdkLogger.error("Parser", FORMAT_INVALID, "Open block comments (starting with /*) are expected to end with */",
+ File=self.MetaFile)
+
+ # If there are tail comments in INF file, save to database whatever the comments are
+ for Comment in TailComments:
+ self._Store(MODEL_META_DATA_TAIL_COMMENT, Comment[0], '', '', TAB_COMMON,
+ TAB_COMMON, self._Owner[-1], -1, -1, -1, -1, 0)
+ self._Done()
+
+ ## Data parser for the format in which there's path
+ #
+ # Only path can have macro used. So we need to replace them before use.
+ #
+ def _IncludeParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ self._ValueList[0:len(TokenList)] = TokenList
+ Macros = self._Macros
+ if Macros:
+ for Index in range(0, len(self._ValueList)):
+ Value = self._ValueList[Index]
+ if not Value:
+ continue
+ self._ValueList[Index] = ReplaceMacro(Value, Macros)
+
+ ## Parse [Sources] section
+ #
+ # Only path can have macro used. So we need to replace them before use.
+ #
+ @ParseMacro
+ def _SourceFileParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ self._ValueList[0:len(TokenList)] = TokenList
+ Macros = self._Macros
+ # For Acpi tables, remove macro like ' TABLE_NAME=Sata1'
+ if 'COMPONENT_TYPE' in Macros:
+ if self._Defines['COMPONENT_TYPE'].upper() == 'ACPITABLE':
+ self._ValueList[0] = GetSplitValueList(self._ValueList[0], ' ', 1)[0]
+ if self._Defines['BASE_NAME'] == 'Microcode':
+ pass
+ self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList]
+
+ ## Parse [Binaries] section
+ #
+ # Only path can have macro used. So we need to replace them before use.
+ #
+ @ParseMacro
+ def _BinaryFileParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 2)
+ if len(TokenList) < 2:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No file type or path specified",
+ ExtraData=self._CurrentLine + " (<FileType> | <FilePath> [| <Target>])",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ if not TokenList[0]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No file type specified",
+ ExtraData=self._CurrentLine + " (<FileType> | <FilePath> [| <Target>])",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ if not TokenList[1]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No file path specified",
+ ExtraData=self._CurrentLine + " (<FileType> | <FilePath> [| <Target>])",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ self._ValueList[0:len(TokenList)] = TokenList
+ self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros)
+
+ ## [nmake] section parser (Edk.x style only)
+ def _NmakeParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+ self._ValueList[0:len(TokenList)] = TokenList
+ # remove macros
+ self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros)
+ # remove self-reference in macro setting
+ #self._ValueList[1] = ReplaceMacro(self._ValueList[1], {self._ValueList[0]:''})
+
+ ## [FixedPcd], [FeaturePcd], [PatchPcd], [Pcd] and [PcdEx] sections parser
+ @ParseMacro
+ def _PcdParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
+ ValueList = GetSplitValueList(TokenList[0], TAB_SPLIT)
+ if len(ValueList) != 2:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Illegal token space GUID and PCD name format",
+ ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<PcdCName>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ self._ValueList[0:1] = ValueList
+ if len(TokenList) > 1:
+ self._ValueList[2] = TokenList[1]
+ if self._ValueList[0] == '' or self._ValueList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",
+ ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<PcdCName>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+
+ # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0.
+ if self._ValueList[2] != '':
+ InfPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
+ if InfPcdValueList[0] in ['True', 'true', 'TRUE']:
+ self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '1', 1)
+ elif InfPcdValueList[0] in ['False', 'false', 'FALSE']:
+ self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1)
+ elif isinstance(InfPcdValueList[0], str) and InfPcdValueList[0].find('$(') >= 0:
+ Value = ReplaceExprMacro(InfPcdValueList[0],self._Macros)
+ if Value != '0':
+ self._ValueList[2] = Value
+ if (self._ValueList[0], self._ValueList[1]) not in self.PcdsDict:
+ self.PcdsDict[self._ValueList[0], self._ValueList[1]] = self._SectionType
+ elif self.PcdsDict[self._ValueList[0], self._ValueList[1]] != self._SectionType:
+ EdkLogger.error('Parser', FORMAT_INVALID, "It is not permissible to list a specified PCD in different PCD type sections.",
+ ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<PcdCName>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+
+ ## [depex] section parser
+ @ParseMacro
+ def _DepexParser(self):
+ self._ValueList[0:1] = [self._CurrentLine]
+
+ _SectionParser = {
+ MODEL_UNKNOWN : MetaFileParser._Skip,
+ MODEL_META_DATA_HEADER : MetaFileParser._DefineParser,
+ MODEL_META_DATA_BUILD_OPTION : MetaFileParser._BuildOptionParser,
+ MODEL_EFI_INCLUDE : _IncludeParser, # for Edk.x modules
+ MODEL_EFI_LIBRARY_INSTANCE : MetaFileParser._CommonParser, # for Edk.x modules
+ MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser,
+ MODEL_META_DATA_PACKAGE : MetaFileParser._PathParser,
+ MODEL_META_DATA_NMAKE : _NmakeParser, # for Edk.x modules
+ MODEL_PCD_FIXED_AT_BUILD : _PcdParser,
+ MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser,
+ MODEL_PCD_FEATURE_FLAG : _PcdParser,
+ MODEL_PCD_DYNAMIC_EX : _PcdParser,
+ MODEL_PCD_DYNAMIC : _PcdParser,
+ MODEL_EFI_SOURCE_FILE : _SourceFileParser,
+ MODEL_EFI_GUID : MetaFileParser._CommonParser,
+ MODEL_EFI_PROTOCOL : MetaFileParser._CommonParser,
+ MODEL_EFI_PPI : MetaFileParser._CommonParser,
+ MODEL_EFI_DEPEX : _DepexParser,
+ MODEL_EFI_BINARY_FILE : _BinaryFileParser,
+ MODEL_META_DATA_USER_EXTENSION : MetaFileParser._SkipUserExtension,
+ }
+
+## DSC file parser class
+#
+# @param FilePath The path of platform description file
+# @param FileType The raw data of DSC file
+# @param Table Database used to retrieve module/package information
+# @param Macros Macros used for replacement in file
+# @param Owner Owner ID (for sub-section parsing)
+# @param From ID from which the data comes (for !INCLUDE directive)
+#
+class DscParser(MetaFileParser):
+ # DSC file supported data types (one type per section)
+ DataType = {
+ TAB_SKUIDS.upper() : MODEL_EFI_SKU_ID,
+ TAB_DEFAULT_STORES.upper() : MODEL_EFI_DEFAULT_STORES,
+ TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE,
+ TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS,
+ TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION,
+ TAB_PACKAGES.upper() : MODEL_META_DATA_PACKAGE,
+ TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : MODEL_PCD_FIXED_AT_BUILD,
+ TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : MODEL_PCD_PATCHABLE_IN_MODULE,
+ TAB_PCDS_FEATURE_FLAG_NULL.upper() : MODEL_PCD_FEATURE_FLAG,
+ TAB_PCDS_DYNAMIC_DEFAULT_NULL.upper() : MODEL_PCD_DYNAMIC_DEFAULT,
+ TAB_PCDS_DYNAMIC_HII_NULL.upper() : MODEL_PCD_DYNAMIC_HII,
+ TAB_PCDS_DYNAMIC_VPD_NULL.upper() : MODEL_PCD_DYNAMIC_VPD,
+ TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL.upper() : MODEL_PCD_DYNAMIC_EX_DEFAULT,
+ TAB_PCDS_DYNAMIC_EX_HII_NULL.upper() : MODEL_PCD_DYNAMIC_EX_HII,
+ TAB_PCDS_DYNAMIC_EX_VPD_NULL.upper() : MODEL_PCD_DYNAMIC_EX_VPD,
+ TAB_COMPONENTS.upper() : MODEL_META_DATA_COMPONENT,
+ TAB_DSC_DEFINES.upper() : MODEL_META_DATA_HEADER,
+ TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE,
+ TAB_DSC_DEFINES_EDKGLOBAL : MODEL_META_DATA_GLOBAL_DEFINE,
+ TAB_INCLUDE.upper() : MODEL_META_DATA_INCLUDE,
+ TAB_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+ TAB_IF_DEF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
+ TAB_IF_N_DEF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF,
+ TAB_ELSE_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF,
+ TAB_ELSE.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE,
+ TAB_END_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF,
+ TAB_USER_EXTENSIONS.upper() : MODEL_META_DATA_USER_EXTENSION,
+ TAB_ERROR.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR,
+ }
+
+ # Valid names in define section
+ DefineKeywords = [
+ "DSC_SPECIFICATION",
+ "PLATFORM_NAME",
+ "PLATFORM_GUID",
+ "PLATFORM_VERSION",
+ "SKUID_IDENTIFIER",
+ "PCD_INFO_GENERATION",
+ "PCD_VAR_CHECK_GENERATION",
+ "SUPPORTED_ARCHITECTURES",
+ "BUILD_TARGETS",
+ "OUTPUT_DIRECTORY",
+ "FLASH_DEFINITION",
+ "BUILD_NUMBER",
+ "RFC_LANGUAGES",
+ "ISO_LANGUAGES",
+ "TIME_STAMP_FILE",
+ "VPD_TOOL_GUID",
+ "FIX_LOAD_TOP_MEMORY_ADDRESS",
+ "PREBUILD",
+ "POSTBUILD"
+ ]
+
+ SubSectionDefineKeywords = [
+ "FILE_GUID"
+ ]
+
+ SymbolPattern = ValueExpression.SymbolPattern
+
+ IncludedFiles = set()
+
+ ## Constructor of DscParser
+ #
+ # Initialize object of DscParser
+ #
+ # @param FilePath The path of platform description file
+ # @param FileType The raw data of DSC file
+ # @param Arch Default Arch value for filtering sections
+ # @param Table Database used to retrieve module/package information
+ # @param Owner Owner ID (for sub-section parsing)
+ # @param From ID from which the data comes (for !INCLUDE directive)
+ #
+ def __init__(self, FilePath, FileType, Arch, Table, Owner= -1, From= -1):
+ # prevent re-initialization
+ if hasattr(self, "_Table") and self._Table is Table:
+ return
+ MetaFileParser.__init__(self, FilePath, FileType, Arch, Table, Owner, From)
+ self._Version = 0x00010005 # Only EDK2 dsc file is supported
+ # to store conditional directive evaluation result
+ self._DirectiveStack = []
+ self._DirectiveEvalStack = []
+ self._Enabled = 1
+
+ #
+ # Specify whether current line is in uncertain condition
+ #
+ self._InDirective = -1
+
+ # Final valid replacable symbols
+ self._Symbols = {}
+ #
+ # Map the ID between the original table and new table to track
+ # the owner item
+ #
+ self._IdMapping = {-1:-1}
+
+ self._Content = None
+
+ ## Parser starter
+ def Start(self):
+ Content = ''
+ try:
+ with open(str(self.MetaFile), 'r') as File:
+ Content = File.readlines()
+ except:
+ EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile)
+
+ OwnerId = {}
+
+ Content = self.ProcessMultipleLineCODEValue(Content)
+
+ for Index in range(0, len(Content)):
+ Line = CleanString(Content[Index])
+ # skip empty line
+ if Line == '':
+ continue
+
+ self._CurrentLine = Line
+ self._LineIndex = Index
+ if self._InSubsection and self._Owner[-1] == -1:
+ self._Owner.append(self._LastItem)
+
+ # section header
+ if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END:
+ self._SectionType = MODEL_META_DATA_SECTION_HEADER
+ # subsection ending
+ elif Line[0] == '}' and self._InSubsection:
+ self._InSubsection = False
+ self._SubsectionType = MODEL_UNKNOWN
+ self._SubsectionName = ''
+ self._Owner[-1] = -1
+ OwnerId.clear()
+ continue
+ # subsection header
+ elif Line[0] == TAB_OPTION_START and Line[-1] == TAB_OPTION_END:
+ self._SubsectionType = MODEL_META_DATA_SUBSECTION_HEADER
+ # directive line
+ elif Line[0] == '!':
+ TokenList = GetSplitValueList(Line, ' ', 1)
+ if TokenList[0] == TAB_INCLUDE:
+ for Arch, ModuleType, DefaultStore in self._Scope:
+ if self._SubsectionType != MODEL_UNKNOWN and Arch in OwnerId:
+ self._Owner[-1] = OwnerId[Arch]
+ self._DirectiveParser()
+ else:
+ self._DirectiveParser()
+ continue
+ if Line[0] == TAB_OPTION_START and not self._InSubsection:
+ EdkLogger.error("Parser", FILE_READ_FAILURE, "Missing the '{' before %s in Line %s" % (Line, Index+1), ExtraData=self.MetaFile)
+
+ if self._InSubsection:
+ SectionType = self._SubsectionType
+ else:
+ SectionType = self._SectionType
+ self._ItemType = SectionType
+
+ self._ValueList = ['', '', '']
+ # "SET pcd = pcd_expression" syntax is not supported in Dsc file.
+ if self._CurrentLine.upper().strip().startswith("SET "):
+ EdkLogger.error('Parser', FORMAT_INVALID, '''"SET pcd = pcd_expression" syntax is not support in Dsc file''',
+ ExtraData=self._CurrentLine,
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ self._SectionParser[SectionType](self)
+ if self._ValueList is None:
+ continue
+ #
+ # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,
+ # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1
+ #
+ for Arch, ModuleType, DefaultStore in self._Scope:
+ Owner = self._Owner[-1]
+ if self._SubsectionType != MODEL_UNKNOWN and Arch in OwnerId:
+ Owner = OwnerId[Arch]
+ self._LastItem = self._Store(
+ self._ItemType,
+ self._ValueList[0],
+ self._ValueList[1],
+ self._ValueList[2],
+ Arch,
+ ModuleType,
+ DefaultStore,
+ Owner,
+ self._From,
+ self._LineIndex + 1,
+ - 1,
+ self._LineIndex + 1,
+ - 1,
+ self._Enabled
+ )
+ if self._SubsectionType == MODEL_UNKNOWN and self._InSubsection:
+ OwnerId[Arch] = self._LastItem
+
+ if self._DirectiveStack:
+ Type, Line, Text = self._DirectiveStack[-1]
+ EdkLogger.error('Parser', FORMAT_INVALID, "No matching '!endif' found",
+ ExtraData=Text, File=self.MetaFile, Line=Line)
+ self._Done()
+
+ ## <subsection_header> parser
+ def _SubsectionHeaderParser(self):
+ self._SubsectionName = self._CurrentLine[1:-1].upper()
+ if self._SubsectionName in self.DataType:
+ self._SubsectionType = self.DataType[self._SubsectionName]
+ else:
+ self._SubsectionType = MODEL_UNKNOWN
+ EdkLogger.warn("Parser", "Unrecognized sub-section", File=self.MetaFile,
+ Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
+ self._ValueList[0] = self._SubsectionName
+
+ ## Directive statement parser
+ def _DirectiveParser(self):
+ self._ValueList = ['', '', '']
+ TokenList = GetSplitValueList(self._CurrentLine, ' ', 1)
+ self._ValueList[0:len(TokenList)] = TokenList
+
+ # Syntax check
+ DirectiveName = self._ValueList[0].upper()
+ if DirectiveName not in self.DataType:
+ EdkLogger.error("Parser", FORMAT_INVALID, "Unknown directive [%s]" % DirectiveName,
+ File=self.MetaFile, Line=self._LineIndex + 1)
+
+ if DirectiveName in ['!IF', '!IFDEF', '!IFNDEF']:
+ self._InDirective += 1
+
+ if DirectiveName in ['!ENDIF']:
+ self._InDirective -= 1
+
+ if DirectiveName in ['!IF', '!IFDEF', '!INCLUDE', '!IFNDEF', '!ELSEIF'] and self._ValueList[1] == '':
+ EdkLogger.error("Parser", FORMAT_INVALID, "Missing expression",
+ File=self.MetaFile, Line=self._LineIndex + 1,
+ ExtraData=self._CurrentLine)
+
+ ItemType = self.DataType[DirectiveName]
+ Scope = [[TAB_COMMON, TAB_COMMON, TAB_COMMON]]
+ if ItemType == MODEL_META_DATA_INCLUDE:
+ Scope = self._Scope
+ elif ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR:
+ Scope = self._Scope
+ if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF:
+ # Remove all directives between !if and !endif, including themselves
+ while self._DirectiveStack:
+ # Remove any !else or !elseif
+ DirectiveInfo = self._DirectiveStack.pop()
+ if DirectiveInfo[0] in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]:
+ break
+ else:
+ EdkLogger.error("Parser", FORMAT_INVALID, "Redundant '!endif'",
+ File=self.MetaFile, Line=self._LineIndex + 1,
+ ExtraData=self._CurrentLine)
+ elif ItemType not in {MODEL_META_DATA_INCLUDE, MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR}:
+ # Break if there's a !else is followed by a !elseif
+ if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF and \
+ self._DirectiveStack and \
+ self._DirectiveStack[-1][0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE:
+ EdkLogger.error("Parser", FORMAT_INVALID, "'!elseif' after '!else'",
+ File=self.MetaFile, Line=self._LineIndex + 1,
+ ExtraData=self._CurrentLine)
+ self._DirectiveStack.append((ItemType, self._LineIndex + 1, self._CurrentLine))
+
+ #
+ # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,
+ # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1
+ #
+ for Arch, ModuleType, DefaultStore in Scope:
+ self._LastItem = self._Store(
+ ItemType,
+ self._ValueList[0],
+ self._ValueList[1],
+ self._ValueList[2],
+ Arch,
+ ModuleType,
+ DefaultStore,
+ self._Owner[-1],
+ self._From,
+ self._LineIndex + 1,
+ - 1,
+ self._LineIndex + 1,
+ - 1,
+ 0
+ )
+
+ ## [defines] section parser
+ @ParseMacro
+ def _DefineParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+ self._ValueList[1:len(TokenList)] = TokenList
+
+ # Syntax check
+ if not self._ValueList[1]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No name specified",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ if not self._ValueList[2]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ if (not self._ValueList[1] in self.DefineKeywords and
+ (self._InSubsection and self._ValueList[1] not in self.SubSectionDefineKeywords)):
+ EdkLogger.error('Parser', FORMAT_INVALID,
+ "Unknown keyword found: %s. "
+ "If this is a macro you must "
+ "add it as a DEFINE in the DSC" % self._ValueList[1],
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ if not self._InSubsection:
+ self._Defines[self._ValueList[1]] = self._ValueList[2]
+ self._ItemType = self.DataType[TAB_DSC_DEFINES.upper()]
+
+ @ParseMacro
+ def _SkuIdParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ if len(TokenList) not in (2, 3):
+ EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '<Number>|<UiName>[|<UiName>]'",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ self._ValueList[0:len(TokenList)] = TokenList
+ @ParseMacro
+ def _DefaultStoresParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ if len(TokenList) != 2:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '<Number>|<UiName>'",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ self._ValueList[0:len(TokenList)] = TokenList
+
+ ## Parse Edk style of library modules
+ @ParseMacro
+ def _LibraryInstanceParser(self):
+ self._ValueList[0] = self._CurrentLine
+
+
+ def _DecodeCODEData(self):
+ pass
+ ## PCD sections parser
+ #
+ # [PcdsFixedAtBuild]
+ # [PcdsPatchableInModule]
+ # [PcdsFeatureFlag]
+ # [PcdsDynamicEx
+ # [PcdsDynamicExDefault]
+ # [PcdsDynamicExVpd]
+ # [PcdsDynamicExHii]
+ # [PcdsDynamic]
+ # [PcdsDynamicDefault]
+ # [PcdsDynamicVpd]
+ # [PcdsDynamicHii]
+ #
+ @ParseMacro
+ def _PcdParser(self):
+ if self._PcdDataTypeCODE:
+ self._PcdCodeValue = self._PcdCodeValue + "\n " + self._CurrentLine
+ if self._CurrentLine.endswith(")}"):
+ self._CurrentLine = "|".join((self._CurrentPcdName, self._PcdCodeValue))
+ self._PcdDataTypeCODE = False
+ self._PcdCodeValue = ""
+ else:
+ self._ValueList = None
+ return
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
+ self._CurrentPcdName = TokenList[0]
+ if len(TokenList) == 2 and TokenList[1].strip().startswith("{CODE"):
+ self._PcdDataTypeCODE = True
+ self._PcdCodeValue = TokenList[1].strip()
+
+ if self._PcdDataTypeCODE:
+ if self._CurrentLine.endswith(")}"):
+ self._PcdDataTypeCODE = False
+ self._PcdCodeValue = ""
+ else:
+ self._ValueList = None
+ return
+ self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT)
+ PcdNameTockens = GetSplitValueList(TokenList[0], TAB_SPLIT)
+ if len(PcdNameTockens) == 2:
+ self._ValueList[0], self._ValueList[1] = PcdNameTockens[0], PcdNameTockens[1]
+ elif len(PcdNameTockens) == 3:
+ self._ValueList[0], self._ValueList[1] = ".".join((PcdNameTockens[0], PcdNameTockens[1])), PcdNameTockens[2]
+ elif len(PcdNameTockens) > 3:
+ self._ValueList[0], self._ValueList[1] = ".".join((PcdNameTockens[0], PcdNameTockens[1])), ".".join(PcdNameTockens[2:])
+ if len(TokenList) == 2:
+ self._ValueList[2] = TokenList[1]
+ if self._ValueList[0] == '' or self._ValueList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",
+ ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<TokenCName>|<PcdValue>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ if self._ValueList[2] == '':
+ #
+ # The PCD values are optional for FIXEDATBUILD, PATCHABLEINMODULE, Dynamic/DynamicEx default
+ #
+ if self._SectionType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT):
+ return
+ EdkLogger.error('Parser', FORMAT_INVALID, "No PCD value given",
+ ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<TokenCName>|<PcdValue>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+
+ # Validate the datum type of Dynamic Defaul PCD and DynamicEx Default PCD
+ ValueList = GetSplitValueList(self._ValueList[2])
+ if len(ValueList) > 1 and ValueList[1] in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64] \
+ and self._ItemType in [MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT]:
+ EdkLogger.error('Parser', FORMAT_INVALID, "The datum type '%s' of PCD is wrong" % ValueList[1],
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+
+ # Validate the VariableName of DynamicHii and DynamicExHii for PCD Entry must not be an empty string
+ if self._ItemType in [MODEL_PCD_DYNAMIC_HII, MODEL_PCD_DYNAMIC_EX_HII]:
+ DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
+ if len(DscPcdValueList[0].replace('L', '').replace('"', '').strip()) == 0:
+ EdkLogger.error('Parser', FORMAT_INVALID, "The VariableName field in the HII format PCD entry must not be an empty string",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+
+ # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0.
+ DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
+ if DscPcdValueList[0] in ['True', 'true', 'TRUE']:
+ self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '1', 1);
+ elif DscPcdValueList[0] in ['False', 'false', 'FALSE']:
+ self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '0', 1);
+
+
+ ## [components] section parser
+ @ParseMacro
+ def _ComponentParser(self):
+ if self._CurrentLine[-1] == '{':
+ self._ValueList[0] = self._CurrentLine[0:-1].strip()
+ self._InSubsection = True
+ self._SubsectionType = MODEL_UNKNOWN
+ else:
+ self._ValueList[0] = self._CurrentLine
+
+ ## [LibraryClasses] section
+ @ParseMacro
+ def _LibraryClassParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+ if len(TokenList) < 2:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No library class or instance specified",
+ ExtraData=self._CurrentLine + " (<LibraryClassName>|<LibraryInstancePath>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ if TokenList[0] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No library class specified",
+ ExtraData=self._CurrentLine + " (<LibraryClassName>|<LibraryInstancePath>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ if TokenList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No library instance specified",
+ ExtraData=self._CurrentLine + " (<LibraryClassName>|<LibraryInstancePath>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+
+ self._ValueList[0:len(TokenList)] = TokenList
+
+
+ ## [BuildOptions] section parser
+ @ParseMacro
+ def _BuildOptionParser(self):
+ self._CurrentLine = CleanString(self._CurrentLine, BuildOption=True)
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+ TokenList2 = GetSplitValueList(TokenList[0], ':', 1)
+ if len(TokenList2) == 2:
+ self._ValueList[0] = TokenList2[0] # toolchain family
+ self._ValueList[1] = TokenList2[1] # keys
+ else:
+ self._ValueList[1] = TokenList[0]
+ if len(TokenList) == 2: # value
+ self._ValueList[2] = TokenList[1]
+
+ if self._ValueList[1].count('_') != 4:
+ EdkLogger.error(
+ 'Parser',
+ FORMAT_INVALID,
+ "'%s' must be in format of <TARGET>_<TOOLCHAIN>_<ARCH>_<TOOL>_FLAGS" % self._ValueList[1],
+ ExtraData=self._CurrentLine,
+ File=self.MetaFile,
+ Line=self._LineIndex + 1
+ )
+
+ ## Override parent's method since we'll do all macro replacements in parser
+ @property
+ def _Macros(self):
+ Macros = {}
+ Macros.update(self._FileLocalMacros)
+ Macros.update(self._GetApplicableSectionMacro())
+ Macros.update(GlobalData.gEdkGlobal)
+ Macros.update(GlobalData.gPlatformDefines)
+ Macros.update(GlobalData.gCommandLineDefines)
+ # PCD cannot be referenced in macro definition
+ if self._ItemType not in [MODEL_META_DATA_DEFINE, MODEL_META_DATA_GLOBAL_DEFINE]:
+ Macros.update(self._Symbols)
+ if GlobalData.BuildOptionPcd:
+ for Item in GlobalData.BuildOptionPcd:
+ if isinstance(Item, tuple):
+ continue
+ PcdName, TmpValue = Item.split("=")
+ TmpValue = BuildOptionValue(TmpValue, self._GuidDict)
+ Macros[PcdName.strip()] = TmpValue
+ return Macros
+
+ def _PostProcess(self):
+ Processer = {
+ MODEL_META_DATA_SECTION_HEADER : self.__ProcessSectionHeader,
+ MODEL_META_DATA_SUBSECTION_HEADER : self.__ProcessSubsectionHeader,
+ MODEL_META_DATA_HEADER : self.__ProcessDefine,
+ MODEL_META_DATA_DEFINE : self.__ProcessDefine,
+ MODEL_META_DATA_GLOBAL_DEFINE : self.__ProcessDefine,
+ MODEL_META_DATA_INCLUDE : self.__ProcessDirective,
+ MODEL_META_DATA_PACKAGE : self.__ProcessPackages,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IF : self.__ProcessDirective,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE : self.__ProcessDirective,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF : self.__ProcessDirective,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF : self.__ProcessDirective,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF : self.__ProcessDirective,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF : self.__ProcessDirective,
+ MODEL_EFI_SKU_ID : self.__ProcessSkuId,
+ MODEL_EFI_DEFAULT_STORES : self.__ProcessDefaultStores,
+ MODEL_EFI_LIBRARY_INSTANCE : self.__ProcessLibraryInstance,
+ MODEL_EFI_LIBRARY_CLASS : self.__ProcessLibraryClass,
+ MODEL_PCD_FIXED_AT_BUILD : self.__ProcessPcd,
+ MODEL_PCD_PATCHABLE_IN_MODULE : self.__ProcessPcd,
+ MODEL_PCD_FEATURE_FLAG : self.__ProcessPcd,
+ MODEL_PCD_DYNAMIC_DEFAULT : self.__ProcessPcd,
+ MODEL_PCD_DYNAMIC_HII : self.__ProcessPcd,
+ MODEL_PCD_DYNAMIC_VPD : self.__ProcessPcd,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : self.__ProcessPcd,
+ MODEL_PCD_DYNAMIC_EX_HII : self.__ProcessPcd,
+ MODEL_PCD_DYNAMIC_EX_VPD : self.__ProcessPcd,
+ MODEL_META_DATA_COMPONENT : self.__ProcessComponent,
+ MODEL_META_DATA_BUILD_OPTION : self.__ProcessBuildOption,
+ MODEL_UNKNOWN : self._Skip,
+ MODEL_META_DATA_USER_EXTENSION : self._SkipUserExtension,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR : self._ProcessError,
+ }
+
+ self._Table = MetaFileStorage(self._RawTable.DB, self.MetaFile, MODEL_FILE_DSC, True)
+ self._DirectiveStack = []
+ self._DirectiveEvalStack = []
+ self._FileWithError = self.MetaFile
+ self._FileLocalMacros = {}
+ self._SectionsMacroDict.clear()
+ GlobalData.gPlatformDefines = {}
+
+ # Get all macro and PCD which has straitforward value
+ self.__RetrievePcdValue()
+ self._Content = self._RawTable.GetAll()
+ self._ContentIndex = 0
+ self._InSubsection = False
+ while self._ContentIndex < len(self._Content) :
+ Id, self._ItemType, V1, V2, V3, S1, S2, S3, Owner, self._From, \
+ LineStart, ColStart, LineEnd, ColEnd, Enabled = self._Content[self._ContentIndex]
+
+ if self._From < 0:
+ self._FileWithError = self.MetaFile
+
+ self._ContentIndex += 1
+
+ self._Scope = [[S1, S2, S3]]
+ #
+ # For !include directive, handle it specially,
+ # merge arch and module type in case of duplicate items
+ #
+ while self._ItemType == MODEL_META_DATA_INCLUDE:
+ if self._ContentIndex >= len(self._Content):
+ break
+ Record = self._Content[self._ContentIndex]
+ if LineStart == Record[10] and LineEnd == Record[12]:
+ if [Record[5], Record[6], Record[7]] not in self._Scope:
+ self._Scope.append([Record[5], Record[6], Record[7]])
+ self._ContentIndex += 1
+ else:
+ break
+
+ self._LineIndex = LineStart - 1
+ self._ValueList = [V1, V2, V3]
+
+ if Owner > 0 and Owner in self._IdMapping:
+ self._InSubsection = True
+ else:
+ self._InSubsection = False
+ try:
+ Processer[self._ItemType]()
+ except EvaluationException as Excpt:
+ #
+ # Only catch expression evaluation error here. We need to report
+ # the precise number of line on which the error occurred
+ #
+ if hasattr(Excpt, 'Pcd'):
+ if Excpt.Pcd in GlobalData.gPlatformOtherPcds:
+ Info = GlobalData.gPlatformOtherPcds[Excpt.Pcd]
+ EdkLogger.error('Parser', FORMAT_INVALID, "Cannot use this PCD (%s) in an expression as"
+ " it must be defined in a [PcdsFixedAtBuild] or [PcdsFeatureFlag] section"
+ " of the DSC file, and it is currently defined in this section:"
+ " %s, line #: %d." % (Excpt.Pcd, Info[0], Info[1]),
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex + 1)
+ else:
+ EdkLogger.error('Parser', FORMAT_INVALID, "PCD (%s) is not defined in DSC file" % Excpt.Pcd,
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex + 1)
+ else:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt),
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex + 1)
+ except MacroException as Excpt:
+ EdkLogger.error('Parser', FORMAT_INVALID, str(Excpt),
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex + 1)
+
+ if self._ValueList is None:
+ continue
+
+ NewOwner = self._IdMapping.get(Owner, -1)
+ self._Enabled = int((not self._DirectiveEvalStack) or (False not in self._DirectiveEvalStack))
+ self._LastItem = self._Store(
+ self._ItemType,
+ self._ValueList[0],
+ self._ValueList[1],
+ self._ValueList[2],
+ S1,
+ S2,
+ S3,
+ NewOwner,
+ self._From,
+ self._LineIndex + 1,
+ - 1,
+ self._LineIndex + 1,
+ - 1,
+ self._Enabled
+ )
+ self._IdMapping[Id] = self._LastItem
+
+ GlobalData.gPlatformDefines.update(self._FileLocalMacros)
+ self._PostProcessed = True
+ self._Content = None
+ def _ProcessError(self):
+ if not self._Enabled:
+ return
+ EdkLogger.error('Parser', ERROR_STATEMENT, self._ValueList[1], File=self.MetaFile, Line=self._LineIndex + 1)
+
+ def __ProcessSectionHeader(self):
+ self._SectionName = self._ValueList[0]
+ if self._SectionName in self.DataType:
+ self._SectionType = self.DataType[self._SectionName]
+ else:
+ self._SectionType = MODEL_UNKNOWN
+
+ def __ProcessSubsectionHeader(self):
+ self._SubsectionName = self._ValueList[0]
+ if self._SubsectionName in self.DataType:
+ self._SubsectionType = self.DataType[self._SubsectionName]
+ else:
+ self._SubsectionType = MODEL_UNKNOWN
+
+ def __RetrievePcdValue(self):
+ try:
+ with open(str(self.MetaFile), 'r') as File:
+ Content = File.readlines()
+ except:
+ EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile)
+
+ GlobalData.gPlatformOtherPcds['DSCFILE'] = str(self.MetaFile)
+ for PcdType in (MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_HII,
+ MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_DEFAULT, MODEL_PCD_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD):
+ Records = self._RawTable.Query(PcdType, BelongsToItem= -1.0)
+ for TokenSpaceGuid, PcdName, Value, Dummy2, Dummy3, Dummy4, ID, Line in Records:
+ Name = TokenSpaceGuid + '.' + PcdName
+ if Name not in GlobalData.gPlatformOtherPcds:
+ PcdLine = Line
+ while not Content[Line - 1].lstrip().startswith(TAB_SECTION_START):
+ Line -= 1
+ GlobalData.gPlatformOtherPcds[Name] = (CleanString(Content[Line - 1]), PcdLine, PcdType)
+
+ def __ProcessDefine(self):
+ if not self._Enabled:
+ return
+
+ Type, Name, Value = self._ValueList
+ Value = ReplaceMacro(Value, self._Macros, False)
+ #
+ # If it is <Defines>, return
+ #
+ if self._InSubsection:
+ self._ValueList = [Type, Name, Value]
+ return
+
+ if self._ItemType == MODEL_META_DATA_DEFINE:
+ if self._SectionType == MODEL_META_DATA_HEADER:
+ self._FileLocalMacros[Name] = Value
+ else:
+ self._ConstructSectionMacroDict(Name, Value)
+ elif self._ItemType == MODEL_META_DATA_GLOBAL_DEFINE:
+ GlobalData.gEdkGlobal[Name] = Value
+
+ #
+ # Keyword in [Defines] section can be used as Macros
+ #
+ if (self._ItemType == MODEL_META_DATA_HEADER) and (self._SectionType == MODEL_META_DATA_HEADER):
+ self._FileLocalMacros[Name] = Value
+
+ self._ValueList = [Type, Name, Value]
+
+ def __ProcessDirective(self):
+ Result = None
+ if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF]:
+ Macros = self._Macros
+ Macros.update(GlobalData.gGlobalDefines)
+ try:
+ Result = ValueExpression(self._ValueList[1], Macros)()
+ except SymbolNotFound as Exc:
+ EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1])
+ Result = False
+ except WrnExpression as Excpt:
+ #
+ # Catch expression evaluation warning here. We need to report
+ # the precise number of line and return the evaluation result
+ #
+ EdkLogger.warn('Parser', "Suspicious expression: %s" % str(Excpt),
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex + 1)
+ Result = Excpt.result
+
+ if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]:
+ self._DirectiveStack.append(self._ItemType)
+ if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IF:
+ Result = bool(Result)
+ else:
+ Macro = self._ValueList[1]
+ Macro = Macro[2:-1] if (Macro.startswith("$(") and Macro.endswith(")")) else Macro
+ Result = Macro in self._Macros
+ if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF:
+ Result = not Result
+ self._DirectiveEvalStack.append(Result)
+ elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF:
+ self._DirectiveStack.append(self._ItemType)
+ self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1]
+ self._DirectiveEvalStack.append(bool(Result))
+ elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE:
+ self._DirectiveStack.append(self._ItemType)
+ self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1]
+ self._DirectiveEvalStack.append(True)
+ elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF:
+ # Back to the nearest !if/!ifdef/!ifndef
+ while self._DirectiveStack:
+ self._DirectiveEvalStack.pop()
+ Directive = self._DirectiveStack.pop()
+ if Directive in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]:
+ break
+ elif self._ItemType == MODEL_META_DATA_INCLUDE:
+ # The included file must be relative to workspace or same directory as DSC file
+ __IncludeMacros = {}
+ #
+ # Allow using system environment variables in path after !include
+ #
+ __IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE']
+ #
+ # Allow using MACROs comes from [Defines] section to keep compatible.
+ #
+ __IncludeMacros.update(self._Macros)
+
+ IncludedFile = NormPath(ReplaceMacro(self._ValueList[1], __IncludeMacros, RaiseError=True))
+ #
+ # First search the include file under the same directory as DSC file
+ #
+ IncludedFile1 = PathClass(IncludedFile, self.MetaFile.Dir)
+ if self._Enabled:
+ ErrorCode, ErrorInfo1 = IncludedFile1.Validate()
+ if ErrorCode != 0:
+ #
+ # Also search file under the WORKSPACE directory
+ #
+ IncludedFile1 = PathClass(IncludedFile, GlobalData.gWorkspace)
+ ErrorCode, ErrorInfo2 = IncludedFile1.Validate()
+ if ErrorCode != 0:
+ EdkLogger.error('parser', ErrorCode, File=self._FileWithError,
+ Line=self._LineIndex + 1, ExtraData=ErrorInfo1 + "\n" + ErrorInfo2)
+
+ self._FileWithError = IncludedFile1
+
+ FromItem = self._Content[self._ContentIndex - 1][0]
+ if self._InSubsection:
+ Owner = self._Content[self._ContentIndex - 1][8]
+ else:
+ Owner = self._Content[self._ContentIndex - 1][0]
+ IncludedFileTable = MetaFileStorage(self._RawTable.DB, IncludedFile1, MODEL_FILE_DSC, False, FromItem=FromItem)
+ Parser = DscParser(IncludedFile1, self._FileType, self._Arch, IncludedFileTable,
+ Owner=Owner, From=FromItem)
+
+ self.IncludedFiles.add (IncludedFile1)
+
+ # set the parser status with current status
+ Parser._SectionName = self._SectionName
+ Parser._SubsectionType = self._SubsectionType
+ Parser._InSubsection = self._InSubsection
+ Parser._SectionType = self._SectionType
+ Parser._Scope = self._Scope
+ Parser._Enabled = self._Enabled
+ # Parse the included file
+ Parser.StartParse()
+ # Insert all records in the table for the included file into dsc file table
+ Records = IncludedFileTable.GetAll()
+ if Records:
+ self._Content[self._ContentIndex:self._ContentIndex] = Records
+ self._Content.pop(self._ContentIndex - 1)
+ self._ValueList = None
+ self._ContentIndex -= 1
+
+ def __ProcessPackages(self):
+ self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros)
+
+ def __ProcessSkuId(self):
+ self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=True)
+ for Value in self._ValueList]
+ def __ProcessDefaultStores(self):
+ self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=True)
+ for Value in self._ValueList]
+
+ def __ProcessLibraryInstance(self):
+ self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList]
+
+ def __ProcessLibraryClass(self):
+ self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros, RaiseError=True)
+
+ def __ProcessPcd(self):
+ if self._ItemType not in [MODEL_PCD_FEATURE_FLAG, MODEL_PCD_FIXED_AT_BUILD]:
+ self._ValueList[2] = ReplaceMacro(self._ValueList[2], self._Macros, RaiseError=True)
+ return
+
+ ValList, Valid, Index = AnalyzeDscPcd(self._ValueList[2], self._ItemType)
+ if not Valid:
+ if self._ItemType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT, MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE):
+ if ValList[1] != TAB_VOID and StructPattern.match(ValList[1]) is None and ValList[2]:
+ EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect. The datum type info should be VOID* or a valid struct name.", File=self._FileWithError,
+ Line=self._LineIndex + 1, ExtraData="%s.%s|%s" % (self._ValueList[0], self._ValueList[1], self._ValueList[2]))
+ EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect.", File=self._FileWithError, Line=self._LineIndex + 1,
+ ExtraData="%s.%s|%s" % (self._ValueList[0], self._ValueList[1], self._ValueList[2]))
+ PcdValue = ValList[Index]
+ if PcdValue and "." not in self._ValueList[0]:
+ try:
+ ValList[Index] = ValueExpression(PcdValue, self._Macros)(True)
+ except WrnExpression as Value:
+ ValList[Index] = Value.result
+ except:
+ pass
+
+ if ValList[Index] == 'True':
+ ValList[Index] = '1'
+ if ValList[Index] == 'False':
+ ValList[Index] = '0'
+
+ if (not self._DirectiveEvalStack) or (False not in self._DirectiveEvalStack):
+ GlobalData.gPlatformPcds[TAB_SPLIT.join(self._ValueList[0:2])] = PcdValue
+ self._Symbols[TAB_SPLIT.join(self._ValueList[0:2])] = PcdValue
+ try:
+ self._ValueList[2] = '|'.join(ValList)
+ except Exception:
+ print(ValList)
+
+ def __ProcessComponent(self):
+ self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros)
+
+ def __ProcessBuildOption(self):
+ self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=False)
+ for Value in self._ValueList]
+
+ def DisableOverrideComponent(self,module_id):
+ for ori_id in self._IdMapping:
+ if self._IdMapping[ori_id] == module_id:
+ self._RawTable.DisableComponent(ori_id)
+
+ _SectionParser = {
+ MODEL_META_DATA_HEADER : _DefineParser,
+ MODEL_EFI_SKU_ID : _SkuIdParser,
+ MODEL_EFI_DEFAULT_STORES : _DefaultStoresParser,
+ MODEL_EFI_LIBRARY_INSTANCE : _LibraryInstanceParser,
+ MODEL_EFI_LIBRARY_CLASS : _LibraryClassParser,
+ MODEL_PCD_FIXED_AT_BUILD : _PcdParser,
+ MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser,
+ MODEL_PCD_FEATURE_FLAG : _PcdParser,
+ MODEL_PCD_DYNAMIC_DEFAULT : _PcdParser,
+ MODEL_PCD_DYNAMIC_HII : _PcdParser,
+ MODEL_PCD_DYNAMIC_VPD : _PcdParser,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : _PcdParser,
+ MODEL_PCD_DYNAMIC_EX_HII : _PcdParser,
+ MODEL_PCD_DYNAMIC_EX_VPD : _PcdParser,
+ MODEL_META_DATA_COMPONENT : _ComponentParser,
+ MODEL_META_DATA_BUILD_OPTION : _BuildOptionParser,
+ MODEL_UNKNOWN : MetaFileParser._Skip,
+ MODEL_META_DATA_PACKAGE : MetaFileParser._PackageParser,
+ MODEL_META_DATA_USER_EXTENSION : MetaFileParser._SkipUserExtension,
+ MODEL_META_DATA_SECTION_HEADER : MetaFileParser._SectionHeaderParser,
+ MODEL_META_DATA_SUBSECTION_HEADER : _SubsectionHeaderParser,
+ }
+
+## DEC file parser class
+#
+# @param FilePath The path of platform description file
+# @param FileType The raw data of DSC file
+# @param Table Database used to retrieve module/package information
+# @param Macros Macros used for replacement in file
+#
+class DecParser(MetaFileParser):
+ # DEC file supported data types (one type per section)
+ DataType = {
+ TAB_DEC_DEFINES.upper() : MODEL_META_DATA_HEADER,
+ TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE,
+ TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE,
+ TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS,
+ TAB_GUIDS.upper() : MODEL_EFI_GUID,
+ TAB_PPIS.upper() : MODEL_EFI_PPI,
+ TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL,
+ TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : MODEL_PCD_FIXED_AT_BUILD,
+ TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : MODEL_PCD_PATCHABLE_IN_MODULE,
+ TAB_PCDS_FEATURE_FLAG_NULL.upper() : MODEL_PCD_FEATURE_FLAG,
+ TAB_PCDS_DYNAMIC_NULL.upper() : MODEL_PCD_DYNAMIC,
+ TAB_PCDS_DYNAMIC_EX_NULL.upper() : MODEL_PCD_DYNAMIC_EX,
+ TAB_USER_EXTENSIONS.upper() : MODEL_META_DATA_USER_EXTENSION,
+ }
+
+ ## Constructor of DecParser
+ #
+ # Initialize object of DecParser
+ #
+ # @param FilePath The path of platform description file
+ # @param FileType The raw data of DSC file
+ # @param Arch Default Arch value for filtering sections
+ # @param Table Database used to retrieve module/package information
+ #
+ def __init__(self, FilePath, FileType, Arch, Table):
+ # prevent re-initialization
+ if hasattr(self, "_Table"):
+ return
+ MetaFileParser.__init__(self, FilePath, FileType, Arch, Table, -1)
+ self._Comments = []
+ self._Version = 0x00010005 # Only EDK2 dec file is supported
+ self._AllPCDs = [] # Only for check duplicate PCD
+ self._AllPcdDict = {}
+
+ self._CurrentStructurePcdName = ""
+ self._include_flag = False
+ self._package_flag = False
+
+ self._RestofValue = ""
+
+ ## Parser starter
+ def Start(self):
+ Content = ''
+ try:
+ with open(str(self.MetaFile), 'r') as File:
+ Content = File.readlines()
+ except:
+ EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile)
+
+ Content = self.ProcessMultipleLineCODEValue(Content)
+
+ self._DefinesCount = 0
+ for Index in range(0, len(Content)):
+ Line, Comment = CleanString2(Content[Index])
+ self._CurrentLine = Line
+ self._LineIndex = Index
+
+ # save comment for later use
+ if Comment:
+ self._Comments.append((Comment, self._LineIndex + 1))
+ # skip empty line
+ if Line == '':
+ continue
+
+ # section header
+ if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END:
+ self._SectionHeaderParser()
+ if self._SectionName == TAB_DEC_DEFINES.upper():
+ self._DefinesCount += 1
+ self._Comments = []
+ continue
+ if self._SectionType == MODEL_UNKNOWN:
+ EdkLogger.error("Parser", FORMAT_INVALID,
+ ""
+ "Not able to determine \"%s\" in which section."%self._CurrentLine,
+ self.MetaFile, self._LineIndex + 1)
+ elif len(self._SectionType) == 0:
+ self._Comments = []
+ continue
+
+ # section content
+ self._ValueList = ['', '', '']
+ self._SectionParser[self._SectionType[0]](self)
+ if self._ValueList is None or self._ItemType == MODEL_META_DATA_DEFINE:
+ self._ItemType = -1
+ self._Comments = []
+ continue
+
+ #
+ # Model, Value1, Value2, Value3, Arch, BelongsToItem=-1, LineBegin=-1,
+ # ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, FeatureFlag='', Enabled=-1
+ #
+ for Arch, ModuleType, Type in self._Scope:
+ self._LastItem = self._Store(
+ Type,
+ self._ValueList[0],
+ self._ValueList[1],
+ self._ValueList[2],
+ Arch,
+ ModuleType,
+ self._Owner[-1],
+ self._LineIndex + 1,
+ - 1,
+ self._LineIndex + 1,
+ - 1,
+ 0
+ )
+ for Comment, LineNo in self._Comments:
+ self._Store(
+ MODEL_META_DATA_COMMENT,
+ Comment,
+ self._ValueList[0],
+ self._ValueList[1],
+ Arch,
+ ModuleType,
+ self._LastItem,
+ LineNo,
+ - 1,
+ LineNo,
+ - 1,
+ 0
+ )
+ self._Comments = []
+ if self._DefinesCount > 1:
+ EdkLogger.error('Parser', FORMAT_INVALID, 'Multiple [Defines] section is exist.', self.MetaFile )
+ if self._DefinesCount == 0:
+ EdkLogger.error('Parser', FORMAT_INVALID, 'No [Defines] section exist.', self.MetaFile)
+ self._Done()
+
+
+ ## Section header parser
+ #
+ # The section header is always in following format:
+ #
+ # [section_name.arch<.platform|module_type>]
+ #
+ def _SectionHeaderParser(self):
+ self._Scope = []
+ self._SectionName = ''
+ self._SectionType = []
+ ArchList = set()
+ PrivateList = set()
+ Line = re.sub(',[\s]*', TAB_COMMA_SPLIT, self._CurrentLine)
+ for Item in Line[1:-1].split(TAB_COMMA_SPLIT):
+ if Item == '':
+ EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR,
+ "section name can NOT be empty or incorrectly use separator comma",
+ self.MetaFile, self._LineIndex + 1, self._CurrentLine)
+ ItemList = Item.split(TAB_SPLIT)
+
+ # different types of PCD are permissible in one section
+ self._SectionName = ItemList[0].upper()
+ if self._SectionName == TAB_DEC_DEFINES.upper() and (len(ItemList) > 1 or len(Line.split(TAB_COMMA_SPLIT)) > 1):
+ EdkLogger.error("Parser", FORMAT_INVALID, "Defines section format is invalid",
+ self.MetaFile, self._LineIndex + 1, self._CurrentLine)
+ if self._SectionName in self.DataType:
+ if self.DataType[self._SectionName] not in self._SectionType:
+ self._SectionType.append(self.DataType[self._SectionName])
+ else:
+ EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item,
+ self.MetaFile, self._LineIndex + 1, self._CurrentLine)
+
+ if MODEL_PCD_FEATURE_FLAG in self._SectionType and len(self._SectionType) > 1:
+ EdkLogger.error(
+ 'Parser',
+ FORMAT_INVALID,
+ "%s must not be in the same section of other types of PCD" % TAB_PCDS_FEATURE_FLAG_NULL,
+ File=self.MetaFile,
+ Line=self._LineIndex + 1,
+ ExtraData=self._CurrentLine
+ )
+ # S1 is always Arch
+ if len(ItemList) > 1:
+ S1 = ItemList[1].upper()
+ else:
+ S1 = TAB_ARCH_COMMON
+ ArchList.add(S1)
+ # S2 may be Platform or ModuleType
+ if len(ItemList) > 2:
+ S2 = ItemList[2].upper()
+ # only Includes, GUIDs, PPIs, Protocols section have Private tag
+ if self._SectionName in [TAB_INCLUDES.upper(), TAB_GUIDS.upper(), TAB_PROTOCOLS.upper(), TAB_PPIS.upper()]:
+ if S2 != 'PRIVATE':
+ EdkLogger.error("Parser", FORMAT_INVALID, 'Please use keyword "Private" as section tag modifier.',
+ File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
+ else:
+ S2 = TAB_COMMON
+ PrivateList.add(S2)
+ if [S1, S2, self.DataType[self._SectionName]] not in self._Scope:
+ self._Scope.append([S1, S2, self.DataType[self._SectionName]])
+
+ # 'COMMON' must not be used with specific ARCHs at the same section
+ if TAB_ARCH_COMMON in ArchList and len(ArchList) > 1:
+ EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs",
+ File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
+
+ # It is not permissible to mix section tags without the Private attribute with section tags with the Private attribute
+ if TAB_COMMON in PrivateList and len(PrivateList) > 1:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Can't mix section tags without the Private attribute with section tags with the Private attribute",
+ File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
+
+ ## [guids], [ppis] and [protocols] section parser
+ @ParseMacro
+ def _GuidParser(self):
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+ if len(TokenList) < 2:
+ EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name or value specified",
+ ExtraData=self._CurrentLine + " (<CName> = <GuidValueInCFormat>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ if TokenList[0] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name specified",
+ ExtraData=self._CurrentLine + " (<CName> = <GuidValueInCFormat>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ if TokenList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No GUID value specified",
+ ExtraData=self._CurrentLine + " (<CName> = <GuidValueInCFormat>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ if TokenList[1][0] != '{' or TokenList[1][-1] != '}' or GuidStructureStringToGuidString(TokenList[1]) == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid GUID value format",
+ ExtraData=self._CurrentLine + \
+ " (<CName> = <GuidValueInCFormat:{8,4,4,{2,2,2,2,2,2,2,2}}>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ self._ValueList[0] = TokenList[0]
+ self._ValueList[1] = TokenList[1]
+ if self._ValueList[0] not in self._GuidDict:
+ self._GuidDict[self._ValueList[0]] = self._ValueList[1]
+
+ def ParsePcdName(self,namelist):
+ if "[" in namelist[1]:
+ pcdname = namelist[1][:namelist[1].index("[")]
+ arrayindex = namelist[1][namelist[1].index("["):]
+ namelist[1] = pcdname
+ if len(namelist) == 2:
+ namelist.append(arrayindex)
+ else:
+ namelist[2] = ".".join((arrayindex,namelist[2]))
+ return namelist
+
+ ## PCD sections parser
+ #
+ # [PcdsFixedAtBuild]
+ # [PcdsPatchableInModule]
+ # [PcdsFeatureFlag]
+ # [PcdsDynamicEx
+ # [PcdsDynamic]
+ #
+ @ParseMacro
+ def _PcdParser(self):
+
+ if self._CurrentStructurePcdName:
+ self._ValueList[0] = self._CurrentStructurePcdName
+
+ if "|" not in self._CurrentLine:
+ if "<HeaderFiles>" == self._CurrentLine:
+ self._include_flag = True
+ self._package_flag = False
+ self._ValueList = None
+ return
+ if "<Packages>" == self._CurrentLine:
+ self._package_flag = True
+ self._ValueList = None
+ self._include_flag = False
+ return
+
+ if self._include_flag:
+ self._ValueList[1] = "<HeaderFiles>_" + md5(self._CurrentLine.encode('utf-8')).hexdigest()
+ self._ValueList[2] = self._CurrentLine
+ if self._package_flag and "}" != self._CurrentLine:
+ self._ValueList[1] = "<Packages>_" + md5(self._CurrentLine.encode('utf-8')).hexdigest()
+ self._ValueList[2] = self._CurrentLine
+ if self._CurrentLine == "}":
+ self._package_flag = False
+ self._include_flag = False
+ self._ValueList = None
+ return
+ else:
+ PcdTockens = self._CurrentLine.split(TAB_VALUE_SPLIT)
+ PcdNames = self.ParsePcdName(PcdTockens[0].split(TAB_SPLIT))
+ if len(PcdNames) == 2:
+ if PcdNames[1].strip().endswith("]"):
+ PcdName = PcdNames[1][:PcdNames[1].index('[')]
+ Index = PcdNames[1][PcdNames[1].index('['):]
+ self._ValueList[0] = TAB_SPLIT.join((PcdNames[0],PcdName))
+ self._ValueList[1] = Index
+ self._ValueList[2] = PcdTockens[1]
+ else:
+ self._CurrentStructurePcdName = ""
+ else:
+ if self._CurrentStructurePcdName != TAB_SPLIT.join(PcdNames[:2]):
+ EdkLogger.error('Parser', FORMAT_INVALID, "Pcd Name does not match: %s and %s " % (self._CurrentStructurePcdName, TAB_SPLIT.join(PcdNames[:2])),
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ self._ValueList[1] = TAB_SPLIT.join(PcdNames[2:])
+ self._ValueList[2] = PcdTockens[1]
+ if not self._CurrentStructurePcdName:
+ if self._PcdDataTypeCODE:
+ if ")}" in self._CurrentLine:
+ ValuePart,RestofValue = self._CurrentLine.split(")}")
+ self._PcdCodeValue = self._PcdCodeValue + "\n " + ValuePart
+ self._CurrentLine = "|".join((self._CurrentPcdName, self._PcdCodeValue,RestofValue))
+ self._PcdDataTypeCODE = False
+ self._PcdCodeValue = ""
+ else:
+ self._PcdCodeValue = self._PcdCodeValue + "\n " + self._CurrentLine
+ self._ValueList = None
+ return
+ TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
+ self._CurrentPcdName = TokenList[0]
+ if len(TokenList) == 2 and TokenList[1].strip().startswith("{CODE"):
+ if ")}" in self._CurrentLine:
+ self._PcdDataTypeCODE = False
+ self._PcdCodeValue = ""
+ else:
+ self._PcdDataTypeCODE = True
+ self._PcdCodeValue = TokenList[1].strip()
+ self._ValueList = None
+ return
+
+ self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT)
+ ValueRe = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*')
+ # check PCD information
+ if self._ValueList[0] == '' or self._ValueList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ # check format of token space GUID CName
+ if not ValueRe.match(self._ValueList[0]):
+ EdkLogger.error('Parser', FORMAT_INVALID, "The format of the token space GUID CName is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ # check format of PCD CName
+ if not ValueRe.match(self._ValueList[1]):
+ EdkLogger.error('Parser', FORMAT_INVALID, "The format of the PCD CName is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ # check PCD datum information
+ if len(TokenList) < 2 or TokenList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Datum information given",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+
+
+ ValueRe = re.compile(r'^\s*L?\".*\|.*\"')
+ PtrValue = ValueRe.findall(TokenList[1])
+
+ # Has VOID* type string, may contain "|" character in the string.
+ if len(PtrValue) != 0:
+ ptrValueList = re.sub(ValueRe, '', TokenList[1])
+ ValueList = AnalyzePcdExpression(ptrValueList)
+ ValueList[0] = PtrValue[0]
+ else:
+ ValueList = AnalyzePcdExpression(TokenList[1])
+
+
+ # check if there's enough datum information given
+ if len(ValueList) != 3:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum information given",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ # check default value
+ if ValueList[0] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "Missing DefaultValue in PCD Datum information",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ # check datum type
+ if ValueList[1] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "Missing DatumType in PCD Datum information",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+ # check token of the PCD
+ if ValueList[2] == '':
+ EdkLogger.error('Parser', FORMAT_INVALID, "Missing Token in PCD Datum information",
+ ExtraData=self._CurrentLine + \
+ " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
+ File=self.MetaFile, Line=self._LineIndex + 1)
+
+ PcdValue = ValueList[0]
+ if PcdValue:
+ try:
+ self._GuidDict.update(self._AllPcdDict)
+ ValueList[0] = ValueExpressionEx(ValueList[0], ValueList[1], self._GuidDict)(True)
+ except BadExpression as Value:
+ EdkLogger.error('Parser', FORMAT_INVALID, Value, ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ # check format of default value against the datum type
+ IsValid, Cause = CheckPcdDatum(ValueList[1], ValueList[0])
+ if not IsValid:
+ EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=self._CurrentLine,
+ File=self.MetaFile, Line=self._LineIndex + 1)
+
+ if Cause == "StructurePcd":
+ self._CurrentStructurePcdName = TAB_SPLIT.join(self._ValueList[0:2])
+ self._ValueList[0] = self._CurrentStructurePcdName
+ self._ValueList[1] = ValueList[1].strip()
+
+ if ValueList[0] in ['True', 'true', 'TRUE']:
+ ValueList[0] = '1'
+ elif ValueList[0] in ['False', 'false', 'FALSE']:
+ ValueList[0] = '0'
+
+ # check for duplicate PCD definition
+ if (self._Scope[0], self._ValueList[0], self._ValueList[1]) in self._AllPCDs:
+ EdkLogger.error('Parser', FORMAT_INVALID,
+ "The same PCD name and GUID have been already defined",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ else:
+ self._AllPCDs.append((self._Scope[0], self._ValueList[0], self._ValueList[1]))
+ self._AllPcdDict[TAB_SPLIT.join(self._ValueList[0:2])] = ValueList[0]
+
+ self._ValueList[2] = ValueList[0].strip() + '|' + ValueList[1].strip() + '|' + ValueList[2].strip()
+
+ _SectionParser = {
+ MODEL_META_DATA_HEADER : MetaFileParser._DefineParser,
+ MODEL_EFI_INCLUDE : MetaFileParser._PathParser,
+ MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser,
+ MODEL_EFI_GUID : _GuidParser,
+ MODEL_EFI_PPI : _GuidParser,
+ MODEL_EFI_PROTOCOL : _GuidParser,
+ MODEL_PCD_FIXED_AT_BUILD : _PcdParser,
+ MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser,
+ MODEL_PCD_FEATURE_FLAG : _PcdParser,
+ MODEL_PCD_DYNAMIC : _PcdParser,
+ MODEL_PCD_DYNAMIC_EX : _PcdParser,
+ MODEL_UNKNOWN : MetaFileParser._Skip,
+ MODEL_META_DATA_USER_EXTENSION : MetaFileParser._SkipUserExtension,
+ }
+
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ pass
+
diff --git a/roms/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py b/roms/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py
new file mode 100644
index 000000000..20cb80e36
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py
@@ -0,0 +1,430 @@
+## @file
+# This file is used to create/update/query/erase a meta file table
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+import uuid
+
+import Common.EdkLogger as EdkLogger
+from Common.BuildToolError import FORMAT_INVALID
+
+from CommonDataClass.DataClass import MODEL_FILE_DSC, MODEL_FILE_DEC, MODEL_FILE_INF, \
+ MODEL_FILE_OTHERS
+from Common.DataType import *
+
+class MetaFileTable():
+ # TRICK: use file ID as the part before '.'
+ _ID_STEP_ = 1
+ _ID_MAX_ = 99999999
+
+ ## Constructor
+ def __init__(self, DB, MetaFile, FileType, Temporary, FromItem=None):
+ self.MetaFile = MetaFile
+ self.TableName = ""
+ self.DB = DB
+ self._NumpyTab = None
+
+ self.CurrentContent = []
+ DB.TblFile.append([MetaFile.Name,
+ MetaFile.Ext,
+ MetaFile.Dir,
+ MetaFile.Path,
+ FileType,
+ MetaFile.TimeStamp,
+ FromItem])
+ self.FileId = len(DB.TblFile)
+ self.ID = self.FileId * 10**8
+ if Temporary:
+ self.TableName = "_%s_%s_%s" % (FileType, len(DB.TblFile), uuid.uuid4().hex)
+ else:
+ self.TableName = "_%s_%s" % (FileType, len(DB.TblFile))
+
+ def IsIntegrity(self):
+ Result = False
+ try:
+ TimeStamp = self.MetaFile.TimeStamp
+ if not self.CurrentContent:
+ Result = False
+ else:
+ Result = self.CurrentContent[-1][0] < 0
+ except Exception as Exc:
+ EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc))
+ return False
+ return Result
+
+ def SetEndFlag(self):
+ self.CurrentContent.append(self._DUMMY_)
+
+ def GetAll(self):
+ return [item for item in self.CurrentContent if item[0] >= 0 and item[-1]>=0]
+
+## Python class representation of table storing module data
+class ModuleTable(MetaFileTable):
+ _COLUMN_ = '''
+ ID REAL PRIMARY KEY,
+ Model INTEGER NOT NULL,
+ Value1 TEXT NOT NULL,
+ Value2 TEXT,
+ Value3 TEXT,
+ Scope1 TEXT,
+ Scope2 TEXT,
+ BelongsToItem REAL NOT NULL,
+ StartLine INTEGER NOT NULL,
+ StartColumn INTEGER NOT NULL,
+ EndLine INTEGER NOT NULL,
+ EndColumn INTEGER NOT NULL,
+ Enabled INTEGER DEFAULT 0
+ '''
+ # used as table end flag, in case the changes to database is not committed to db file
+ _DUMMY_ = [-1, -1, '====', '====', '====', '====', '====', -1, -1, -1, -1, -1, -1]
+
+ ## Constructor
+ def __init__(self, Db, MetaFile, Temporary):
+ MetaFileTable.__init__(self, Db, MetaFile, MODEL_FILE_INF, Temporary)
+
+ ## Insert a record into table Inf
+ #
+ # @param Model: Model of a Inf item
+ # @param Value1: Value1 of a Inf item
+ # @param Value2: Value2 of a Inf item
+ # @param Value3: Value3 of a Inf item
+ # @param Scope1: Arch of a Inf item
+ # @param Scope2 Platform os a Inf item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param StartLine: StartLine of a Inf item
+ # @param StartColumn: StartColumn of a Inf item
+ # @param EndLine: EndLine of a Inf item
+ # @param EndColumn: EndColumn of a Inf item
+ # @param Enabled: If this item enabled
+ #
+ def Insert(self, Model, Value1, Value2, Value3, Scope1=TAB_ARCH_COMMON, Scope2=TAB_COMMON,
+ BelongsToItem=-1, StartLine=-1, StartColumn=-1, EndLine=-1, EndColumn=-1, Enabled=0):
+
+ (Value1, Value2, Value3, Scope1, Scope2) = (Value1.strip(), Value2.strip(), Value3.strip(), Scope1.strip(), Scope2.strip())
+ self.ID = self.ID + self._ID_STEP_
+ if self.ID >= (MODEL_FILE_INF + self._ID_MAX_):
+ self.ID = MODEL_FILE_INF + self._ID_STEP_
+
+ row = [ self.ID,
+ Model,
+ Value1,
+ Value2,
+ Value3,
+ Scope1,
+ Scope2,
+ BelongsToItem,
+ StartLine,
+ StartColumn,
+ EndLine,
+ EndColumn,
+ Enabled
+ ]
+ self.CurrentContent.append(row)
+ return self.ID
+
+ ## Query table
+ #
+ # @param Model: The Model of Record
+ # @param Arch: The Arch attribute of Record
+ # @param Platform The Platform attribute of Record
+ #
+ # @retval: A recordSet of all found records
+ #
+ def Query(self, Model, Arch=None, Platform=None, BelongsToItem=None):
+
+ QueryTab = self.CurrentContent
+ result = [item for item in QueryTab if item[1] == Model and item[-1]>=0 ]
+
+ if Arch is not None and Arch != TAB_ARCH_COMMON:
+ ArchList = set(['COMMON'])
+ ArchList.add(Arch)
+ result = [item for item in result if item[5] in ArchList]
+
+ if Platform is not None and Platform != TAB_COMMON:
+ Platformlist = set( ['COMMON','DEFAULT'])
+ Platformlist.add(Platform)
+ result = [item for item in result if item[6] in Platformlist]
+
+ if BelongsToItem is not None:
+ result = [item for item in result if item[7] == BelongsToItem]
+
+ result = [ [r[2],r[3],r[4],r[5],r[6],r[0],r[9]] for r in result ]
+ return result
+
+## Python class representation of table storing package data
+class PackageTable(MetaFileTable):
+ _COLUMN_ = '''
+ ID REAL PRIMARY KEY,
+ Model INTEGER NOT NULL,
+ Value1 TEXT NOT NULL,
+ Value2 TEXT,
+ Value3 TEXT,
+ Scope1 TEXT,
+ Scope2 TEXT,
+ BelongsToItem REAL NOT NULL,
+ StartLine INTEGER NOT NULL,
+ StartColumn INTEGER NOT NULL,
+ EndLine INTEGER NOT NULL,
+ EndColumn INTEGER NOT NULL,
+ Enabled INTEGER DEFAULT 0
+ '''
+ # used as table end flag, in case the changes to database is not committed to db file
+ _DUMMY_ = [-1, -1, '====', '====', '====', '====', '====', -1, -1, -1, -1, -1, -1]
+
+ ## Constructor
+ def __init__(self, Cursor, MetaFile, Temporary):
+ MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DEC, Temporary)
+
+ ## Insert table
+ #
+ # Insert a record into table Dec
+ #
+ # @param Model: Model of a Dec item
+ # @param Value1: Value1 of a Dec item
+ # @param Value2: Value2 of a Dec item
+ # @param Value3: Value3 of a Dec item
+ # @param Scope1: Arch of a Dec item
+ # @param Scope2: Module type of a Dec item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param StartLine: StartLine of a Dec item
+ # @param StartColumn: StartColumn of a Dec item
+ # @param EndLine: EndLine of a Dec item
+ # @param EndColumn: EndColumn of a Dec item
+ # @param Enabled: If this item enabled
+ #
+ def Insert(self, Model, Value1, Value2, Value3, Scope1=TAB_ARCH_COMMON, Scope2=TAB_COMMON,
+ BelongsToItem=-1, StartLine=-1, StartColumn=-1, EndLine=-1, EndColumn=-1, Enabled=0):
+ (Value1, Value2, Value3, Scope1, Scope2) = (Value1.strip(), Value2.strip(), Value3.strip(), Scope1.strip(), Scope2.strip())
+ self.ID = self.ID + self._ID_STEP_
+
+ row = [ self.ID,
+ Model,
+ Value1,
+ Value2,
+ Value3,
+ Scope1,
+ Scope2,
+ BelongsToItem,
+ StartLine,
+ StartColumn,
+ EndLine,
+ EndColumn,
+ Enabled
+ ]
+ self.CurrentContent.append(row)
+ return self.ID
+
+ ## Query table
+ #
+ # @param Model: The Model of Record
+ # @param Arch: The Arch attribute of Record
+ #
+ # @retval: A recordSet of all found records
+ #
+ def Query(self, Model, Arch=None):
+
+ QueryTab = self.CurrentContent
+ result = [item for item in QueryTab if item[1] == Model and item[-1]>=0 ]
+
+ if Arch is not None and Arch != TAB_ARCH_COMMON:
+ ArchList = set(['COMMON'])
+ ArchList.add(Arch)
+ result = [item for item in result if item[5] in ArchList]
+
+ return [[r[2], r[3], r[4], r[5], r[6], r[0], r[8]] for r in result]
+
+ def GetValidExpression(self, TokenSpaceGuid, PcdCName):
+
+ QueryTab = self.CurrentContent
+ result = [[item[2], item[8]] for item in QueryTab if item[3] == TokenSpaceGuid and item[4] == PcdCName]
+ validateranges = []
+ validlists = []
+ expressions = []
+ try:
+ for row in result:
+ comment = row[0]
+
+ LineNum = row[1]
+ comment = comment.strip("#")
+ comment = comment.strip()
+ oricomment = comment
+ if comment.startswith("@ValidRange"):
+ comment = comment.replace("@ValidRange", "", 1)
+ validateranges.append(comment.split("|")[1].strip())
+ if comment.startswith("@ValidList"):
+ comment = comment.replace("@ValidList", "", 1)
+ validlists.append(comment.split("|")[1].strip())
+ if comment.startswith("@Expression"):
+ comment = comment.replace("@Expression", "", 1)
+ expressions.append(comment.split("|")[1].strip())
+ except Exception as Exc:
+ ValidType = ""
+ if oricomment.startswith("@ValidRange"):
+ ValidType = "@ValidRange"
+ if oricomment.startswith("@ValidList"):
+ ValidType = "@ValidList"
+ if oricomment.startswith("@Expression"):
+ ValidType = "@Expression"
+ EdkLogger.error('Parser', FORMAT_INVALID, "The syntax for %s of PCD %s.%s is incorrect" % (ValidType, TokenSpaceGuid, PcdCName),
+ ExtraData=oricomment, File=self.MetaFile, Line=LineNum)
+ return set(), set(), set()
+ return set(validateranges), set(validlists), set(expressions)
+
+## Python class representation of table storing platform data
+class PlatformTable(MetaFileTable):
+ _COLUMN_ = '''
+ ID REAL PRIMARY KEY,
+ Model INTEGER NOT NULL,
+ Value1 TEXT NOT NULL,
+ Value2 TEXT,
+ Value3 TEXT,
+ Scope1 TEXT,
+ Scope2 TEXT,
+ Scope3 TEXT,
+ BelongsToItem REAL NOT NULL,
+ FromItem REAL NOT NULL,
+ StartLine INTEGER NOT NULL,
+ StartColumn INTEGER NOT NULL,
+ EndLine INTEGER NOT NULL,
+ EndColumn INTEGER NOT NULL,
+ Enabled INTEGER DEFAULT 0
+ '''
+ # used as table end flag, in case the changes to database is not committed to db file
+ _DUMMY_ = [-1, -1, '====', '====', '====', '====', '====','====', -1, -1, -1, -1, -1, -1, -1]
+
+ ## Constructor
+ def __init__(self, Cursor, MetaFile, Temporary, FromItem=0):
+ MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC, Temporary, FromItem)
+
+ ## Insert table
+ #
+ # Insert a record into table Dsc
+ #
+ # @param Model: Model of a Dsc item
+ # @param Value1: Value1 of a Dsc item
+ # @param Value2: Value2 of a Dsc item
+ # @param Value3: Value3 of a Dsc item
+ # @param Scope1: Arch of a Dsc item
+ # @param Scope2: Module type of a Dsc item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param FromItem: The item belongs to which dsc file
+ # @param StartLine: StartLine of a Dsc item
+ # @param StartColumn: StartColumn of a Dsc item
+ # @param EndLine: EndLine of a Dsc item
+ # @param EndColumn: EndColumn of a Dsc item
+ # @param Enabled: If this item enabled
+ #
+ def Insert(self, Model, Value1, Value2, Value3, Scope1=TAB_ARCH_COMMON, Scope2=TAB_COMMON, Scope3=TAB_DEFAULT_STORES_DEFAULT,BelongsToItem=-1,
+ FromItem=-1, StartLine=-1, StartColumn=-1, EndLine=-1, EndColumn=-1, Enabled=1):
+ (Value1, Value2, Value3, Scope1, Scope2, Scope3) = (Value1.strip(), Value2.strip(), Value3.strip(), Scope1.strip(), Scope2.strip(), Scope3.strip())
+ self.ID = self.ID + self._ID_STEP_
+
+ row = [ self.ID,
+ Model,
+ Value1,
+ Value2,
+ Value3,
+ Scope1,
+ Scope2,
+ Scope3,
+ BelongsToItem,
+ FromItem,
+ StartLine,
+ StartColumn,
+ EndLine,
+ EndColumn,
+ Enabled
+ ]
+ self.CurrentContent.append(row)
+ return self.ID
+
+
+ ## Query table
+ #
+ # @param Model: The Model of Record
+ # @param Scope1: Arch of a Dsc item
+ # @param Scope2: Module type of a Dsc item
+ # @param BelongsToItem: The item belongs to which another item
+ # @param FromItem: The item belongs to which dsc file
+ #
+ # @retval: A recordSet of all found records
+ #
+ def Query(self, Model, Scope1=None, Scope2=None, BelongsToItem=None, FromItem=None):
+
+ QueryTab = self.CurrentContent
+ result = [item for item in QueryTab if item[1] == Model and item[-1]>0 ]
+ if Scope1 is not None and Scope1 != TAB_ARCH_COMMON:
+ Sc1 = set(['COMMON'])
+ Sc1.add(Scope1)
+ result = [item for item in result if item[5] in Sc1]
+ Sc2 = set( ['COMMON','DEFAULT'])
+ if Scope2 and Scope2 != TAB_COMMON:
+ if '.' in Scope2:
+ Index = Scope2.index('.')
+ NewScope = TAB_COMMON + Scope2[Index:]
+ Sc2.add(NewScope)
+ Sc2.add(Scope2)
+ result = [item for item in result if item[6] in Sc2]
+
+ if BelongsToItem is not None:
+ result = [item for item in result if item[8] == BelongsToItem]
+ else:
+ result = [item for item in result if item[8] < 0]
+ if FromItem is not None:
+ result = [item for item in result if item[9] == FromItem]
+
+ result = [ [r[2],r[3],r[4],r[5],r[6],r[7],r[0],r[10]] for r in result ]
+ return result
+
+ def DisableComponent(self,comp_id):
+ for item in self.CurrentContent:
+ if item[0] == comp_id or item[8] == comp_id:
+ item[-1] = -1
+
+## Factory class to produce different storage for different type of meta-file
+class MetaFileStorage(object):
+ _FILE_TABLE_ = {
+ MODEL_FILE_INF : ModuleTable,
+ MODEL_FILE_DEC : PackageTable,
+ MODEL_FILE_DSC : PlatformTable,
+ MODEL_FILE_OTHERS : MetaFileTable,
+ }
+
+ _FILE_TYPE_ = {
+ ".inf" : MODEL_FILE_INF,
+ ".dec" : MODEL_FILE_DEC,
+ ".dsc" : MODEL_FILE_DSC,
+ }
+ _ObjectCache = {}
+ ## Constructor
+ def __new__(Class, Cursor, MetaFile, FileType=None, Temporary=False, FromItem=None):
+ # no type given, try to find one
+ key = (MetaFile.Path, FileType,Temporary,FromItem)
+ if key in Class._ObjectCache:
+ return Class._ObjectCache[key]
+ if not FileType:
+ if MetaFile.Type in self._FILE_TYPE_:
+ FileType = Class._FILE_TYPE_[MetaFile.Type]
+ else:
+ FileType = MODEL_FILE_OTHERS
+
+ # don't pass the type around if it's well known
+ if FileType == MODEL_FILE_OTHERS:
+ Args = (Cursor, MetaFile, FileType, Temporary)
+ else:
+ Args = (Cursor, MetaFile, Temporary)
+ if FromItem:
+ Args = Args + (FromItem,)
+
+ # create the storage object and return it to caller
+ reval = Class._FILE_TABLE_[FileType](*Args)
+ if not Temporary:
+ Class._ObjectCache[key] = reval
+ return reval
+
diff --git a/roms/edk2/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/roms/edk2/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
new file mode 100644
index 000000000..53027a0e3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
@@ -0,0 +1,256 @@
+## @file
+# Common routines used by workspace
+#
+# Copyright (c) 2012 - 2020, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+from __future__ import absolute_import
+from collections import OrderedDict, defaultdict
+from Common.DataType import SUP_MODULE_USER_DEFINED
+from Common.DataType import SUP_MODULE_HOST_APPLICATION
+from .BuildClassObject import LibraryClassObject
+import Common.GlobalData as GlobalData
+from Workspace.BuildClassObject import StructurePcd
+from Common.BuildToolError import RESOURCE_NOT_AVAILABLE
+from Common.BuildToolError import OPTION_MISSING
+from Common.BuildToolError import BUILD_ERROR
+import Common.EdkLogger as EdkLogger
+
+class OrderedListDict(OrderedDict):
+ def __init__(self, *args, **kwargs):
+ super(OrderedListDict, self).__init__(*args, **kwargs)
+ self.default_factory = list
+
+ def __missing__(self, key):
+ self[key] = Value = self.default_factory()
+ return Value
+
+## Get all packages from platform for specified arch, target and toolchain
+#
+# @param Platform: DscBuildData instance
+# @param BuildDatabase: The database saves all data for all metafiles
+# @param Arch: Current arch
+# @param Target: Current target
+# @param Toolchain: Current toolchain
+# @retval: List of packages which are DecBuildData instances
+#
+def GetPackageList(Platform, BuildDatabase, Arch, Target, Toolchain):
+ PkgSet = set()
+ if Platform.Packages:
+ PkgSet.update(Platform.Packages)
+ for ModuleFile in Platform.Modules:
+ Data = BuildDatabase[ModuleFile, Arch, Target, Toolchain]
+ PkgSet.update(Data.Packages)
+ for Lib in GetLiabraryInstances(Data, Platform, BuildDatabase, Arch, Target, Toolchain):
+ PkgSet.update(Lib.Packages)
+ return list(PkgSet)
+
+## Get all declared PCD from platform for specified arch, target and toolchain
+#
+# @param Platform: DscBuildData instance
+# @param BuildDatabase: The database saves all data for all metafiles
+# @param Arch: Current arch
+# @param Target: Current target
+# @param Toolchain: Current toolchain
+# @retval: A dictionary contains instances of PcdClassObject with key (PcdCName, TokenSpaceGuid)
+# @retval: A dictionary contains real GUIDs of TokenSpaceGuid
+#
+def GetDeclaredPcd(Platform, BuildDatabase, Arch, Target, Toolchain, additionalPkgs):
+ PkgList = GetPackageList(Platform, BuildDatabase, Arch, Target, Toolchain)
+ PkgList = set(PkgList)
+ PkgList |= additionalPkgs
+ DecPcds = {}
+ GuidDict = {}
+ for Pkg in PkgList:
+ Guids = Pkg.Guids
+ GuidDict.update(Guids)
+ for Pcd in Pkg.Pcds:
+ PcdCName = Pcd[0]
+ PcdTokenName = Pcd[1]
+ if GlobalData.MixedPcd:
+ for PcdItem in GlobalData.MixedPcd:
+ if (PcdCName, PcdTokenName) in GlobalData.MixedPcd[PcdItem]:
+ PcdCName = PcdItem[0]
+ break
+ if (PcdCName, PcdTokenName) not in DecPcds:
+ DecPcds[PcdCName, PcdTokenName] = Pkg.Pcds[Pcd]
+ return DecPcds, GuidDict
+
+## Get all dependent libraries for a module
+#
+# @param Module: InfBuildData instance
+# @param Platform: DscBuildData instance
+# @param BuildDatabase: The database saves all data for all metafiles
+# @param Arch: Current arch
+# @param Target: Current target
+# @param Toolchain: Current toolchain
+# @retval: List of dependent libraries which are InfBuildData instances
+#
+def GetLiabraryInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain):
+ return GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain,Platform.MetaFile,EdkLogger)
+
+def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain, FileName = '', EdkLogger = None):
+ if Module.LibInstances:
+ return Module.LibInstances
+ ModuleType = Module.ModuleType
+
+ # add forced library instances (specified under LibraryClasses sections)
+ #
+ # If a module has a MODULE_TYPE of USER_DEFINED,
+ # do not link in NULL library class instances from the global [LibraryClasses.*] sections.
+ #
+ if Module.ModuleType != SUP_MODULE_USER_DEFINED:
+ for LibraryClass in Platform.LibraryClasses.GetKeys():
+ if LibraryClass.startswith("NULL") and Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
+ Module.LibraryClasses[LibraryClass] = Platform.LibraryClasses[LibraryClass, Module.ModuleType]
+
+ # add forced library instances (specified in module overrides)
+ for LibraryClass in Platform.Modules[str(Module)].LibraryClasses:
+ if LibraryClass.startswith("NULL"):
+ Module.LibraryClasses[LibraryClass] = Platform.Modules[str(Module)].LibraryClasses[LibraryClass]
+
+ # EdkII module
+ LibraryConsumerList = [Module]
+ Constructor = []
+ ConsumedByList = OrderedListDict()
+ LibraryInstance = OrderedDict()
+
+ if not Module.LibraryClass:
+ EdkLogger.verbose("")
+ EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(Module), Arch))
+
+ while len(LibraryConsumerList) > 0:
+ M = LibraryConsumerList.pop()
+ for LibraryClassName in M.LibraryClasses:
+ if LibraryClassName not in LibraryInstance:
+ # override library instance for this module
+ LibraryPath = Platform.Modules[str(Module)].LibraryClasses.get(LibraryClassName,Platform.LibraryClasses[LibraryClassName, ModuleType])
+ if LibraryPath is None:
+ LibraryPath = M.LibraryClasses.get(LibraryClassName)
+ if LibraryPath is None:
+ if not Module.LibraryClass:
+ EdkLogger.error("build", RESOURCE_NOT_AVAILABLE,
+ "Instance of library class [%s] is not found" % LibraryClassName,
+ File=FileName,
+ ExtraData="in [%s] [%s]\n\tconsumed by module [%s]" % (str(M), Arch, str(Module)))
+ else:
+ return []
+
+ LibraryModule = BuildDatabase[LibraryPath, Arch, Target, Toolchain]
+ # for those forced library instance (NULL library), add a fake library class
+ if LibraryClassName.startswith("NULL"):
+ LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
+ elif LibraryModule.LibraryClass is None \
+ or len(LibraryModule.LibraryClass) == 0 \
+ or (ModuleType != SUP_MODULE_USER_DEFINED and ModuleType != SUP_MODULE_HOST_APPLICATION
+ and ModuleType not in LibraryModule.LibraryClass[0].SupModList):
+ # only USER_DEFINED can link against any library instance despite of its SupModList
+ if not Module.LibraryClass:
+ EdkLogger.error("build", OPTION_MISSING,
+ "Module type [%s] is not supported by library instance [%s]" \
+ % (ModuleType, LibraryPath), File=FileName,
+ ExtraData="consumed by [%s]" % str(Module))
+ else:
+ return []
+
+ LibraryInstance[LibraryClassName] = LibraryModule
+ LibraryConsumerList.append(LibraryModule)
+ if not Module.LibraryClass:
+ EdkLogger.verbose("\t" + str(LibraryClassName) + " : " + str(LibraryModule))
+ else:
+ LibraryModule = LibraryInstance[LibraryClassName]
+
+ if LibraryModule is None:
+ continue
+
+ if LibraryModule.ConstructorList != [] and LibraryModule not in Constructor:
+ Constructor.append(LibraryModule)
+
+ # don't add current module itself to consumer list
+ if M != Module:
+ if M in ConsumedByList[LibraryModule]:
+ continue
+ ConsumedByList[LibraryModule].append(M)
+ #
+ # Initialize the sorted output list to the empty set
+ #
+ SortedLibraryList = []
+ #
+ # Q <- Set of all nodes with no incoming edges
+ #
+ LibraryList = [] #LibraryInstance.values()
+ Q = []
+ for LibraryClassName in LibraryInstance:
+ M = LibraryInstance[LibraryClassName]
+ LibraryList.append(M)
+ if not ConsumedByList[M]:
+ Q.append(M)
+
+ #
+ # start the DAG algorithm
+ #
+ while True:
+ EdgeRemoved = True
+ while Q == [] and EdgeRemoved:
+ EdgeRemoved = False
+ # for each node Item with a Constructor
+ for Item in LibraryList:
+ if Item not in Constructor:
+ continue
+ # for each Node without a constructor with an edge e from Item to Node
+ for Node in ConsumedByList[Item]:
+ if Node in Constructor:
+ continue
+ # remove edge e from the graph if Node has no constructor
+ ConsumedByList[Item].remove(Node)
+ EdgeRemoved = True
+ if not ConsumedByList[Item]:
+ # insert Item into Q
+ Q.insert(0, Item)
+ break
+ if Q != []:
+ break
+ # DAG is done if there's no more incoming edge for all nodes
+ if Q == []:
+ break
+
+ # remove node from Q
+ Node = Q.pop()
+ # output Node
+ SortedLibraryList.append(Node)
+
+ # for each node Item with an edge e from Node to Item do
+ for Item in LibraryList:
+ if Node not in ConsumedByList[Item]:
+ continue
+ # remove edge e from the graph
+ ConsumedByList[Item].remove(Node)
+
+ if ConsumedByList[Item]:
+ continue
+ # insert Item into Q, if Item has no other incoming edges
+ Q.insert(0, Item)
+
+ #
+ # if any remaining node Item in the graph has a constructor and an incoming edge, then the graph has a cycle
+ #
+ for Item in LibraryList:
+ if ConsumedByList[Item] and Item in Constructor and len(Constructor) > 1:
+ if not Module.LibraryClass:
+ ErrorMessage = "\tconsumed by " + "\n\tconsumed by ".join(str(L) for L in ConsumedByList[Item])
+ EdkLogger.error("build", BUILD_ERROR, 'Library [%s] with constructors has a cycle' % str(Item),
+ ExtraData=ErrorMessage, File=FileName)
+ else:
+ return []
+ if Item not in SortedLibraryList:
+ SortedLibraryList.append(Item)
+
+ #
+ # Build the list of constructor and destructor names
+ # The DAG Topo sort produces the destructor order, so the list of constructors must generated in the reverse order
+ #
+ SortedLibraryList.reverse()
+ Module.LibInstances = SortedLibraryList
+ SortedLibraryList = [lib.SetReferenceModule(Module) for lib in SortedLibraryList]
+ return SortedLibraryList
diff --git a/roms/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/roms/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
new file mode 100644
index 000000000..d955c78b2
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -0,0 +1,204 @@
+## @file
+# This file is used to create a database used by build tool
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import absolute_import
+from Common.StringUtils import *
+from Common.DataType import *
+from Common.Misc import *
+from types import *
+
+from .MetaDataTable import *
+from .MetaFileTable import *
+from .MetaFileParser import *
+
+from Workspace.DecBuildData import DecBuildData
+from Workspace.DscBuildData import DscBuildData
+from Workspace.InfBuildData import InfBuildData
+
+## Database
+#
+# This class defined the build database for all modules, packages and platform.
+# It will call corresponding parser for the given file if it cannot find it in
+# the database.
+#
+# @param DbPath Path of database file
+# @param GlobalMacros Global macros used for replacement during file parsing
+# @param RenewDb=False Create new database file if it's already there
+#
+class WorkspaceDatabase(object):
+
+ #
+ # internal class used for call corresponding file parser and caching the result
+ # to avoid unnecessary re-parsing
+ #
+ class BuildObjectFactory(object):
+
+ _FILE_TYPE_ = {
+ ".inf" : MODEL_FILE_INF,
+ ".dec" : MODEL_FILE_DEC,
+ ".dsc" : MODEL_FILE_DSC,
+ }
+
+ # file parser
+ _FILE_PARSER_ = {
+ MODEL_FILE_INF : InfParser,
+ MODEL_FILE_DEC : DecParser,
+ MODEL_FILE_DSC : DscParser,
+ }
+
+ # convert to xxxBuildData object
+ _GENERATOR_ = {
+ MODEL_FILE_INF : InfBuildData,
+ MODEL_FILE_DEC : DecBuildData,
+ MODEL_FILE_DSC : DscBuildData,
+ }
+
+ _CACHE_ = {} # (FilePath, Arch) : <object>
+ def GetCache(self):
+ return self._CACHE_
+
+ # constructor
+ def __init__(self, WorkspaceDb):
+ self.WorkspaceDb = WorkspaceDb
+
+ # key = (FilePath, Arch=None)
+ def __contains__(self, Key):
+ FilePath = Key[0]
+ if len(Key) > 1:
+ Arch = Key[1]
+ else:
+ Arch = None
+ return (FilePath, Arch) in self._CACHE_
+
+ # key = (FilePath, Arch=None, Target=None, Toolchain=None)
+ def __getitem__(self, Key):
+ FilePath = Key[0]
+ KeyLength = len(Key)
+ if KeyLength > 1:
+ Arch = Key[1]
+ else:
+ Arch = None
+ if KeyLength > 2:
+ Target = Key[2]
+ else:
+ Target = None
+ if KeyLength > 3:
+ Toolchain = Key[3]
+ else:
+ Toolchain = None
+
+ # if it's generated before, just return the cached one
+ Key = (FilePath, Arch, Target, Toolchain)
+ if Key in self._CACHE_:
+ return self._CACHE_[Key]
+
+ # check file type
+ BuildObject = self.CreateBuildObject(FilePath, Arch, Target, Toolchain)
+ self._CACHE_[Key] = BuildObject
+ return BuildObject
+ def CreateBuildObject(self,FilePath, Arch, Target, Toolchain):
+ Ext = FilePath.Type
+ if Ext not in self._FILE_TYPE_:
+ return None
+ FileType = self._FILE_TYPE_[Ext]
+ if FileType not in self._GENERATOR_:
+ return None
+
+ # get the parser ready for this file
+ MetaFile = self._FILE_PARSER_[FileType](
+ FilePath,
+ FileType,
+ Arch,
+ MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
+ )
+ # always do post-process, in case of macros change
+ MetaFile.DoPostProcess()
+ # object the build is based on
+ BuildObject = self._GENERATOR_[FileType](
+ FilePath,
+ MetaFile,
+ self,
+ Arch,
+ Target,
+ Toolchain
+ )
+ return BuildObject
+
+ # placeholder for file format conversion
+ class TransformObjectFactory:
+ def __init__(self, WorkspaceDb):
+ self.WorkspaceDb = WorkspaceDb
+
+ # key = FilePath, Arch
+ def __getitem__(self, Key):
+ pass
+
+ ## Constructor of WorkspaceDatabase
+ #
+ # @param DbPath Path of database file
+ # @param GlobalMacros Global macros used for replacement during file parsing
+ # @param RenewDb=False Create new database file if it's already there
+ #
+ def __init__(self):
+ self.DB = dict()
+ # create table for internal uses
+ self.TblDataModel = DataClass.MODEL_LIST
+ self.TblFile = []
+ self.Platform = None
+
+ # conversion object for build or file format conversion purpose
+ self.BuildObject = WorkspaceDatabase.BuildObjectFactory(self)
+ self.TransformObject = WorkspaceDatabase.TransformObjectFactory(self)
+
+
+ ## Summarize all packages in the database
+ def GetPackageList(self, Platform, Arch, TargetName, ToolChainTag):
+ self.Platform = Platform
+ PackageList = []
+ Pa = self.BuildObject[self.Platform, Arch, TargetName, ToolChainTag]
+ #
+ # Get Package related to Modules
+ #
+ for Module in Pa.Modules:
+ ModuleObj = self.BuildObject[Module, Arch, TargetName, ToolChainTag]
+ for Package in ModuleObj.Packages:
+ if Package not in PackageList:
+ PackageList.append(Package)
+ #
+ # Get Packages related to Libraries
+ #
+ for Lib in Pa.LibraryInstances:
+ LibObj = self.BuildObject[Lib, Arch, TargetName, ToolChainTag]
+ for Package in LibObj.Packages:
+ if Package not in PackageList:
+ PackageList.append(Package)
+ for Package in Pa.Packages:
+ if Package in PackageList:
+ continue
+ PackageList.append(Package)
+
+ return PackageList
+
+ def MapPlatform(self, Dscfile):
+ Platform = self.BuildObject[PathClass(Dscfile), TAB_COMMON]
+ if Platform is None:
+ EdkLogger.error('build', PARSER_ERROR, "Failed to parser DSC file: %s" % Dscfile)
+ return Platform
+
+BuildDB = WorkspaceDatabase()
+##
+#
+# This acts like the main() function for the script, unless it is 'import'ed into another
+# script.
+#
+if __name__ == '__main__':
+ pass
+
diff --git a/roms/edk2/BaseTools/Source/Python/Workspace/__init__.py b/roms/edk2/BaseTools/Source/Python/Workspace/__init__.py
new file mode 100644
index 000000000..85ae9937c
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/Workspace/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'Workspace' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/basetool_tiano_python_path_env.yaml b/roms/edk2/BaseTools/Source/Python/basetool_tiano_python_path_env.yaml
new file mode 100644
index 000000000..59369ccc6
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/basetool_tiano_python_path_env.yaml
@@ -0,0 +1,11 @@
+## @file
+# Add this folder to the pypath so modules can be easily
+# loaded
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "global",
+ "flags": ["set_pypath"]
+}
diff --git a/roms/edk2/BaseTools/Source/Python/build/BuildReport.py b/roms/edk2/BaseTools/Source/Python/build/BuildReport.py
new file mode 100644
index 000000000..8efa86916
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/build/BuildReport.py
@@ -0,0 +1,2295 @@
+## @file
+# Routines for generating build report.
+#
+# This module contains the functionality to generate build report after
+# build all target completes successfully.
+#
+# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+## Import Modules
+#
+import Common.LongFilePathOs as os
+import re
+import platform
+import textwrap
+import traceback
+import sys
+import time
+import struct
+import hashlib
+import subprocess
+import threading
+from datetime import datetime
+from io import BytesIO
+from Common import EdkLogger
+from Common.Misc import SaveFileOnChange
+from Common.Misc import GuidStructureByteArrayToGuidString
+from Common.Misc import GuidStructureStringToGuidString
+from Common.BuildToolError import FILE_WRITE_FAILURE
+from Common.BuildToolError import CODE_ERROR
+from Common.BuildToolError import COMMAND_FAILURE
+from Common.BuildToolError import FORMAT_INVALID
+from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+import Common.GlobalData as GlobalData
+from AutoGen.ModuleAutoGen import ModuleAutoGen
+from Common.Misc import PathClass
+from Common.StringUtils import NormPath
+from Common.DataType import *
+import collections
+from Common.Expression import *
+from GenFds.AprioriSection import DXE_APRIORI_GUID, PEI_APRIORI_GUID
+
+## Pattern to extract contents in EDK DXS files
+gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL)
+
+## Pattern to find total FV total size, occupied size in flash report intermediate file
+gFvTotalSizePattern = re.compile(r"EFI_FV_TOTAL_SIZE = (0x[0-9a-fA-F]+)")
+gFvTakenSizePattern = re.compile(r"EFI_FV_TAKEN_SIZE = (0x[0-9a-fA-F]+)")
+
+## Pattern to find module size and time stamp in module summary report intermediate file
+gModuleSizePattern = re.compile(r"MODULE_SIZE = (\d+)")
+gTimeStampPattern = re.compile(r"TIME_STAMP = (\d+)")
+
+## Pattern to find GUID value in flash description files
+gPcdGuidPattern = re.compile(r"PCD\((\w+)[.](\w+)\)")
+
+## Pattern to collect offset, GUID value pair in the flash report intermediate file
+gOffsetGuidPattern = re.compile(r"(0x[0-9A-Fa-f]+) ([-A-Fa-f0-9]+)")
+
+## Pattern to find module base address and entry point in fixed flash map file
+gModulePattern = r"\n[-\w]+\s*\(([^,]+),\s*BaseAddress=%(Address)s,\s*EntryPoint=%(Address)s\)\s*\(GUID=([-0-9A-Fa-f]+)[^)]*\)"
+gMapFileItemPattern = re.compile(gModulePattern % {"Address" : "(-?0[xX][0-9A-Fa-f]+)"})
+
+## Pattern to find all module referenced header files in source files
+gIncludePattern = re.compile(r'#include\s*["<]([^">]+)[">]')
+gIncludePattern2 = re.compile(r"#include\s+EFI_([A-Z_]+)\s*[(]\s*(\w+)\s*[)]")
+
+## Pattern to find the entry point for EDK module using EDKII Glue library
+gGlueLibEntryPoint = re.compile(r"__EDKII_GLUE_MODULE_ENTRY_POINT__\s*=\s*(\w+)")
+
+## Tags for MaxLength of line in report
+gLineMaxLength = 120
+
+## Tags for end of line in report
+gEndOfLine = "\r\n"
+
+## Tags for section start, end and separator
+gSectionStart = ">" + "=" * (gLineMaxLength - 2) + "<"
+gSectionEnd = "<" + "=" * (gLineMaxLength - 2) + ">" + "\n"
+gSectionSep = "=" * gLineMaxLength
+
+## Tags for subsection start, end and separator
+gSubSectionStart = ">" + "-" * (gLineMaxLength - 2) + "<"
+gSubSectionEnd = "<" + "-" * (gLineMaxLength - 2) + ">"
+gSubSectionSep = "-" * gLineMaxLength
+
+
+## The look up table to map PCD type to pair of report display type and DEC type
+gPcdTypeMap = {
+ TAB_PCDS_FIXED_AT_BUILD : ('FIXED', TAB_PCDS_FIXED_AT_BUILD),
+ TAB_PCDS_PATCHABLE_IN_MODULE: ('PATCH', TAB_PCDS_PATCHABLE_IN_MODULE),
+ TAB_PCDS_FEATURE_FLAG : ('FLAG', TAB_PCDS_FEATURE_FLAG),
+ TAB_PCDS_DYNAMIC : ('DYN', TAB_PCDS_DYNAMIC),
+ TAB_PCDS_DYNAMIC_HII : ('DYNHII', TAB_PCDS_DYNAMIC),
+ TAB_PCDS_DYNAMIC_VPD : ('DYNVPD', TAB_PCDS_DYNAMIC),
+ TAB_PCDS_DYNAMIC_EX : ('DEX', TAB_PCDS_DYNAMIC_EX),
+ TAB_PCDS_DYNAMIC_EX_HII : ('DEXHII', TAB_PCDS_DYNAMIC_EX),
+ TAB_PCDS_DYNAMIC_EX_VPD : ('DEXVPD', TAB_PCDS_DYNAMIC_EX),
+ }
+
+## The look up table to map module type to driver type
+gDriverTypeMap = {
+ SUP_MODULE_SEC : '0x3 (SECURITY_CORE)',
+ SUP_MODULE_PEI_CORE : '0x4 (PEI_CORE)',
+ SUP_MODULE_PEIM : '0x6 (PEIM)',
+ SUP_MODULE_DXE_CORE : '0x5 (DXE_CORE)',
+ SUP_MODULE_DXE_DRIVER : '0x7 (DRIVER)',
+ SUP_MODULE_DXE_SAL_DRIVER : '0x7 (DRIVER)',
+ SUP_MODULE_DXE_SMM_DRIVER : '0x7 (DRIVER)',
+ SUP_MODULE_DXE_RUNTIME_DRIVER: '0x7 (DRIVER)',
+ SUP_MODULE_UEFI_DRIVER : '0x7 (DRIVER)',
+ SUP_MODULE_UEFI_APPLICATION : '0x9 (APPLICATION)',
+ SUP_MODULE_SMM_CORE : '0xD (SMM_CORE)',
+ 'SMM_DRIVER' : '0xA (SMM)', # Extension of module type to support PI 1.1 SMM drivers
+ SUP_MODULE_MM_STANDALONE : '0xE (MM_STANDALONE)',
+ SUP_MODULE_MM_CORE_STANDALONE : '0xF (MM_CORE_STANDALONE)'
+ }
+
+## The look up table of the supported opcode in the dependency expression binaries
+gOpCodeList = ["BEFORE", "AFTER", "PUSH", "AND", "OR", "NOT", "TRUE", "FALSE", "END", "SOR"]
+
+## Save VPD Pcd
+VPDPcdList = []
+
+##
+# Writes a string to the file object.
+#
+# This function writes a string to the file object and a new line is appended
+# afterwards. It may optionally wraps the string for better readability.
+#
+# @File The file object to write
+# @String The string to be written to the file
+# @Wrapper Indicates whether to wrap the string
+#
+def FileWrite(File, String, Wrapper=False):
+ if Wrapper:
+ String = textwrap.fill(String, 120)
+ File.append(String + gEndOfLine)
+
+def ByteArrayForamt(Value):
+ IsByteArray = False
+ SplitNum = 16
+ ArrayList = []
+ if Value.startswith('{') and Value.endswith('}') and not Value.startswith("{CODE("):
+ Value = Value[1:-1]
+ ValueList = Value.split(',')
+ if len(ValueList) >= SplitNum:
+ IsByteArray = True
+ if IsByteArray:
+ if ValueList:
+ Len = len(ValueList)/SplitNum
+ for i, element in enumerate(ValueList):
+ ValueList[i] = '0x%02X' % int(element.strip(), 16)
+ if Len:
+ Id = 0
+ while (Id <= Len):
+ End = min(SplitNum*(Id+1), len(ValueList))
+ Str = ','.join(ValueList[SplitNum*Id : End])
+ if End == len(ValueList):
+ Str += '}'
+ ArrayList.append(Str)
+ break
+ else:
+ Str += ','
+ ArrayList.append(Str)
+ Id += 1
+ else:
+ ArrayList = [Value + '}']
+ return IsByteArray, ArrayList
+
+##
+# Find all the header file that the module source directly includes.
+#
+# This function scans source code to find all header files the module may
+# include. This is not accurate but very effective to find all the header
+# file the module might include with #include statement.
+#
+# @Source The source file name
+# @IncludePathList The list of include path to find the source file.
+# @IncludeFiles The dictionary of current found include files.
+#
+def FindIncludeFiles(Source, IncludePathList, IncludeFiles):
+ FileContents = open(Source).read()
+ #
+ # Find header files with pattern #include "XXX.h" or #include <XXX.h>
+ #
+ for Match in gIncludePattern.finditer(FileContents):
+ FileName = Match.group(1).strip()
+ for Dir in [os.path.dirname(Source)] + IncludePathList:
+ FullFileName = os.path.normpath(os.path.join(Dir, FileName))
+ if os.path.exists(FullFileName):
+ IncludeFiles[FullFileName.lower().replace("\\", "/")] = FullFileName
+ break
+
+ #
+ # Find header files with pattern like #include EFI_PPI_CONSUMER(XXX)
+ #
+ for Match in gIncludePattern2.finditer(FileContents):
+ Key = Match.group(2)
+ Type = Match.group(1)
+ if "ARCH_PROTOCOL" in Type:
+ FileName = "ArchProtocol/%(Key)s/%(Key)s.h" % {"Key" : Key}
+ elif "PROTOCOL" in Type:
+ FileName = "Protocol/%(Key)s/%(Key)s.h" % {"Key" : Key}
+ elif "PPI" in Type:
+ FileName = "Ppi/%(Key)s/%(Key)s.h" % {"Key" : Key}
+ elif TAB_GUID in Type:
+ FileName = "Guid/%(Key)s/%(Key)s.h" % {"Key" : Key}
+ else:
+ continue
+ for Dir in IncludePathList:
+ FullFileName = os.path.normpath(os.path.join(Dir, FileName))
+ if os.path.exists(FullFileName):
+ IncludeFiles[FullFileName.lower().replace("\\", "/")] = FullFileName
+ break
+
+## Split each lines in file
+#
+# This method is used to split the lines in file to make the length of each line
+# less than MaxLength.
+#
+# @param Content The content of file
+# @param MaxLength The Max Length of the line
+#
+def FileLinesSplit(Content=None, MaxLength=None):
+ ContentList = Content.split(TAB_LINE_BREAK)
+ NewContent = ''
+ NewContentList = []
+ for Line in ContentList:
+ while len(Line.rstrip()) > MaxLength:
+ LineSpaceIndex = Line.rfind(TAB_SPACE_SPLIT, 0, MaxLength)
+ LineSlashIndex = Line.rfind(TAB_SLASH, 0, MaxLength)
+ LineBackSlashIndex = Line.rfind(TAB_BACK_SLASH, 0, MaxLength)
+ if max(LineSpaceIndex, LineSlashIndex, LineBackSlashIndex) > 0:
+ LineBreakIndex = max(LineSpaceIndex, LineSlashIndex, LineBackSlashIndex)
+ else:
+ LineBreakIndex = MaxLength
+ NewContentList.append(Line[:LineBreakIndex])
+ Line = Line[LineBreakIndex:]
+ if Line:
+ NewContentList.append(Line)
+ for NewLine in NewContentList:
+ NewContent += NewLine + TAB_LINE_BREAK
+
+ NewContent = NewContent.replace(gEndOfLine, TAB_LINE_BREAK).replace('\r\r\n', gEndOfLine)
+ return NewContent
+
+
+
+##
+# Parse binary dependency expression section
+#
+# This utility class parses the dependency expression section and translate the readable
+# GUID name and value.
+#
+class DepexParser(object):
+ ##
+ # Constructor function for class DepexParser
+ #
+ # This constructor function collect GUID values so that the readable
+ # GUID name can be translated.
+ #
+ # @param self The object pointer
+ # @param Wa Workspace context information
+ #
+ def __init__(self, Wa):
+ self._GuidDb = {}
+ for Pa in Wa.AutoGenObjectList:
+ for Package in Pa.PackageList:
+ for Protocol in Package.Protocols:
+ GuidValue = GuidStructureStringToGuidString(Package.Protocols[Protocol])
+ self._GuidDb[GuidValue.upper()] = Protocol
+ for Ppi in Package.Ppis:
+ GuidValue = GuidStructureStringToGuidString(Package.Ppis[Ppi])
+ self._GuidDb[GuidValue.upper()] = Ppi
+ for Guid in Package.Guids:
+ GuidValue = GuidStructureStringToGuidString(Package.Guids[Guid])
+ self._GuidDb[GuidValue.upper()] = Guid
+ for Ma in Pa.ModuleAutoGenList:
+ for Pcd in Ma.FixedVoidTypePcds:
+ PcdValue = Ma.FixedVoidTypePcds[Pcd]
+ if len(PcdValue.split(',')) == 16:
+ GuidValue = GuidStructureByteArrayToGuidString(PcdValue)
+ self._GuidDb[GuidValue.upper()] = Pcd
+ ##
+ # Parse the binary dependency expression files.
+ #
+ # This function parses the binary dependency expression file and translate it
+ # to the instruction list.
+ #
+ # @param self The object pointer
+ # @param DepexFileName The file name of binary dependency expression file.
+ #
+ def ParseDepexFile(self, DepexFileName):
+ DepexFile = open(DepexFileName, "rb")
+ DepexStatement = []
+ OpCode = DepexFile.read(1)
+ while OpCode:
+ Statement = gOpCodeList[struct.unpack("B", OpCode)[0]]
+ if Statement in ["BEFORE", "AFTER", "PUSH"]:
+ GuidValue = "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X" % \
+ struct.unpack(PACK_PATTERN_GUID, DepexFile.read(16))
+ GuidString = self._GuidDb.get(GuidValue, GuidValue)
+ Statement = "%s %s" % (Statement, GuidString)
+ DepexStatement.append(Statement)
+ OpCode = DepexFile.read(1)
+
+ return DepexStatement
+
+##
+# Reports library information
+#
+# This class reports the module library subsection in the build report file.
+#
+class LibraryReport(object):
+ ##
+ # Constructor function for class LibraryReport
+ #
+ # This constructor function generates LibraryReport object for
+ # a module.
+ #
+ # @param self The object pointer
+ # @param M Module context information
+ #
+ def __init__(self, M):
+ self.LibraryList = []
+
+ for Lib in M.DependentLibraryList:
+ LibInfPath = str(Lib)
+ LibClassList = Lib.LibraryClass[0].LibraryClass
+ LibConstructorList = Lib.ConstructorList
+ LibDesstructorList = Lib.DestructorList
+ LibDepexList = Lib.DepexExpression[M.Arch, M.ModuleType]
+ for LibAutoGen in M.LibraryAutoGenList:
+ if LibInfPath == LibAutoGen.MetaFile.Path:
+ LibTime = LibAutoGen.BuildTime
+ break
+ self.LibraryList.append((LibInfPath, LibClassList, LibConstructorList, LibDesstructorList, LibDepexList, LibTime))
+
+ ##
+ # Generate report for module library information
+ #
+ # This function generates report for the module library.
+ # If the module is EDKII style one, the additional library class, library
+ # constructor/destructor and dependency expression may also be reported.
+ #
+ # @param self The object pointer
+ # @param File The file object for report
+ #
+ def GenerateReport(self, File):
+ if len(self.LibraryList) > 0:
+ FileWrite(File, gSubSectionStart)
+ FileWrite(File, TAB_BRG_LIBRARY)
+ FileWrite(File, gSubSectionSep)
+ for LibraryItem in self.LibraryList:
+ LibInfPath = LibraryItem[0]
+ FileWrite(File, LibInfPath)
+
+ LibClass = LibraryItem[1]
+ EdkIILibInfo = ""
+ LibConstructor = " ".join(LibraryItem[2])
+ if LibConstructor:
+ EdkIILibInfo += " C = " + LibConstructor
+ LibDestructor = " ".join(LibraryItem[3])
+ if LibDestructor:
+ EdkIILibInfo += " D = " + LibDestructor
+ LibDepex = " ".join(LibraryItem[4])
+ if LibDepex:
+ EdkIILibInfo += " Depex = " + LibDepex
+ if LibraryItem[5]:
+ EdkIILibInfo += " Time = " + LibraryItem[5]
+ if EdkIILibInfo:
+ FileWrite(File, "{%s: %s}" % (LibClass, EdkIILibInfo))
+ else:
+ FileWrite(File, "{%s}" % LibClass)
+
+ FileWrite(File, gSubSectionEnd)
+
+##
+# Reports dependency expression information
+#
+# This class reports the module dependency expression subsection in the build report file.
+#
+class DepexReport(object):
+ ##
+ # Constructor function for class DepexReport
+ #
+ # This constructor function generates DepexReport object for
+ # a module. If the module source contains the DXS file (usually EDK
+ # style module), it uses the dependency in DXS file; otherwise,
+ # it uses the dependency expression from its own INF [Depex] section
+ # and then merges with the ones from its dependent library INF.
+ #
+ # @param self The object pointer
+ # @param M Module context information
+ #
+ def __init__(self, M):
+ self.Depex = ""
+ self._DepexFileName = os.path.join(M.BuildDir, "OUTPUT", M.Module.BaseName + ".depex")
+ ModuleType = M.ModuleType
+ if not ModuleType:
+ ModuleType = COMPONENT_TO_MODULE_MAP_DICT.get(M.ComponentType, "")
+
+ if ModuleType in [SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_DXE_CORE, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE, SUP_MODULE_UEFI_APPLICATION]:
+ return
+
+ for Source in M.SourceFileList:
+ if os.path.splitext(Source.Path)[1].lower() == ".dxs":
+ Match = gDxsDependencyPattern.search(open(Source.Path).read())
+ if Match:
+ self.Depex = Match.group(1).strip()
+ self.Source = "DXS"
+ break
+ else:
+ self.Depex = M.DepexExpressionDict.get(M.ModuleType, "")
+ self.ModuleDepex = " ".join(M.Module.DepexExpression[M.Arch, M.ModuleType])
+ if not self.ModuleDepex:
+ self.ModuleDepex = "(None)"
+
+ LibDepexList = []
+ for Lib in M.DependentLibraryList:
+ LibDepex = " ".join(Lib.DepexExpression[M.Arch, M.ModuleType]).strip()
+ if LibDepex != "":
+ LibDepexList.append("(" + LibDepex + ")")
+ self.LibraryDepex = " AND ".join(LibDepexList)
+ if not self.LibraryDepex:
+ self.LibraryDepex = "(None)"
+ self.Source = "INF"
+
+ ##
+ # Generate report for module dependency expression information
+ #
+ # This function generates report for the module dependency expression.
+ #
+ # @param self The object pointer
+ # @param File The file object for report
+ # @param GlobalDepexParser The platform global Dependency expression parser object
+ #
+ def GenerateReport(self, File, GlobalDepexParser):
+ if not self.Depex:
+ return
+ FileWrite(File, gSubSectionStart)
+ if os.path.isfile(self._DepexFileName):
+ try:
+ DepexStatements = GlobalDepexParser.ParseDepexFile(self._DepexFileName)
+ FileWrite(File, "Final Dependency Expression (DEPEX) Instructions")
+ for DepexStatement in DepexStatements:
+ FileWrite(File, " %s" % DepexStatement)
+ FileWrite(File, gSubSectionSep)
+ except:
+ EdkLogger.warn(None, "Dependency expression file is corrupted", self._DepexFileName)
+
+ FileWrite(File, "Dependency Expression (DEPEX) from %s" % self.Source)
+
+ if self.Source == "INF":
+ FileWrite(File, self.Depex, True)
+ FileWrite(File, gSubSectionSep)
+ FileWrite(File, "From Module INF: %s" % self.ModuleDepex, True)
+ FileWrite(File, "From Library INF: %s" % self.LibraryDepex, True)
+ else:
+ FileWrite(File, self.Depex)
+ FileWrite(File, gSubSectionEnd)
+
+##
+# Reports dependency expression information
+#
+# This class reports the module build flags subsection in the build report file.
+#
+class BuildFlagsReport(object):
+ ##
+ # Constructor function for class BuildFlagsReport
+ #
+ # This constructor function generates BuildFlagsReport object for
+ # a module. It reports the build tool chain tag and all relevant
+ # build flags to build the module.
+ #
+ # @param self The object pointer
+ # @param M Module context information
+ #
+ def __init__(self, M):
+ BuildOptions = {}
+ #
+ # Add build flags according to source file extension so that
+ # irrelevant ones can be filtered out.
+ #
+ for Source in M.SourceFileList:
+ Ext = os.path.splitext(Source.File)[1].lower()
+ if Ext in [".c", ".cc", ".cpp"]:
+ BuildOptions["CC"] = 1
+ elif Ext in [".s", ".asm"]:
+ BuildOptions["PP"] = 1
+ BuildOptions["ASM"] = 1
+ elif Ext in [".vfr"]:
+ BuildOptions["VFRPP"] = 1
+ BuildOptions["VFR"] = 1
+ elif Ext in [".dxs"]:
+ BuildOptions["APP"] = 1
+ BuildOptions["CC"] = 1
+ elif Ext in [".asl"]:
+ BuildOptions["ASLPP"] = 1
+ BuildOptions["ASL"] = 1
+ elif Ext in [".aslc"]:
+ BuildOptions["ASLCC"] = 1
+ BuildOptions["ASLDLINK"] = 1
+ BuildOptions["CC"] = 1
+ elif Ext in [".asm16"]:
+ BuildOptions["ASMLINK"] = 1
+ BuildOptions["SLINK"] = 1
+ BuildOptions["DLINK"] = 1
+
+ #
+ # Save module build flags.
+ #
+ self.ToolChainTag = M.ToolChain
+ self.BuildFlags = {}
+ for Tool in BuildOptions:
+ self.BuildFlags[Tool + "_FLAGS"] = M.BuildOption.get(Tool, {}).get("FLAGS", "")
+
+ ##
+ # Generate report for module build flags information
+ #
+ # This function generates report for the module build flags expression.
+ #
+ # @param self The object pointer
+ # @param File The file object for report
+ #
+ def GenerateReport(self, File):
+ FileWrite(File, gSubSectionStart)
+ FileWrite(File, "Build Flags")
+ FileWrite(File, "Tool Chain Tag: %s" % self.ToolChainTag)
+ for Tool in self.BuildFlags:
+ FileWrite(File, gSubSectionSep)
+ FileWrite(File, "%s = %s" % (Tool, self.BuildFlags[Tool]), True)
+
+ FileWrite(File, gSubSectionEnd)
+
+
+##
+# Reports individual module information
+#
+# This class reports the module section in the build report file.
+# It comprises of module summary, module PCD, library, dependency expression,
+# build flags sections.
+#
+class ModuleReport(object):
+ ##
+ # Constructor function for class ModuleReport
+ #
+ # This constructor function generates ModuleReport object for
+ # a separate module in a platform build.
+ #
+ # @param self The object pointer
+ # @param M Module context information
+ # @param ReportType The kind of report items in the final report file
+ #
+ def __init__(self, M, ReportType):
+ self.ModuleName = M.Module.BaseName
+ self.ModuleInfPath = M.MetaFile.File
+ self.ModuleArch = M.Arch
+ self.FileGuid = M.Guid
+ self.Size = 0
+ self.BuildTimeStamp = None
+ self.Hash = 0
+ self.DriverType = ""
+ if not M.IsLibrary:
+ ModuleType = M.ModuleType
+ if not ModuleType:
+ ModuleType = COMPONENT_TO_MODULE_MAP_DICT.get(M.ComponentType, "")
+ #
+ # If a module complies to PI 1.1, promote Module type to "SMM_DRIVER"
+ #
+ if ModuleType == SUP_MODULE_DXE_SMM_DRIVER:
+ PiSpec = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "0x00010000")
+ if int(PiSpec, 0) >= 0x0001000A:
+ ModuleType = "SMM_DRIVER"
+ self.DriverType = gDriverTypeMap.get(ModuleType, "0x2 (FREE_FORM)")
+ self.UefiSpecVersion = M.Module.Specification.get("UEFI_SPECIFICATION_VERSION", "")
+ self.PiSpecVersion = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "")
+ self.PciDeviceId = M.Module.Defines.get("PCI_DEVICE_ID", "")
+ self.PciVendorId = M.Module.Defines.get("PCI_VENDOR_ID", "")
+ self.PciClassCode = M.Module.Defines.get("PCI_CLASS_CODE", "")
+ self.BuildTime = M.BuildTime
+
+ self._BuildDir = M.BuildDir
+ self.ModulePcdSet = {}
+ if "PCD" in ReportType:
+ #
+ # Collect all module used PCD set: module INF referenced directly or indirectly.
+ # It also saves module INF default values of them in case they exist.
+ #
+ for Pcd in M.ModulePcdList + M.LibraryPcdList:
+ self.ModulePcdSet.setdefault((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Type), (Pcd.InfDefaultValue, Pcd.DefaultValue))
+
+ self.LibraryReport = None
+ if "LIBRARY" in ReportType:
+ self.LibraryReport = LibraryReport(M)
+
+ self.DepexReport = None
+ if "DEPEX" in ReportType:
+ self.DepexReport = DepexReport(M)
+
+ if "BUILD_FLAGS" in ReportType:
+ self.BuildFlagsReport = BuildFlagsReport(M)
+
+
+ ##
+ # Generate report for module information
+ #
+ # This function generates report for separate module expression
+ # in a platform build.
+ #
+ # @param self The object pointer
+ # @param File The file object for report
+ # @param GlobalPcdReport The platform global PCD report object
+ # @param GlobalPredictionReport The platform global Prediction report object
+ # @param GlobalDepexParser The platform global Dependency expression parser object
+ # @param ReportType The kind of report items in the final report file
+ #
+ def GenerateReport(self, File, GlobalPcdReport, GlobalPredictionReport, GlobalDepexParser, ReportType):
+ FileWrite(File, gSectionStart)
+
+ FwReportFileName = os.path.join(self._BuildDir, "OUTPUT", self.ModuleName + ".txt")
+ if os.path.isfile(FwReportFileName):
+ try:
+ FileContents = open(FwReportFileName).read()
+ Match = gModuleSizePattern.search(FileContents)
+ if Match:
+ self.Size = int(Match.group(1))
+
+ Match = gTimeStampPattern.search(FileContents)
+ if Match:
+ self.BuildTimeStamp = datetime.utcfromtimestamp(int(Match.group(1)))
+ except IOError:
+ EdkLogger.warn(None, "Fail to read report file", FwReportFileName)
+
+ if "HASH" in ReportType:
+ OutputDir = os.path.join(self._BuildDir, "OUTPUT")
+ DefaultEFIfile = os.path.join(OutputDir, self.ModuleName + ".efi")
+ if os.path.isfile(DefaultEFIfile):
+ Tempfile = os.path.join(OutputDir, self.ModuleName + "_hash.tmp")
+ # rebase the efi image since its base address may not zero
+ cmd = ["GenFw", "--rebase", str(0), "-o", Tempfile, DefaultEFIfile]
+ try:
+ PopenObject = subprocess.Popen(' '.join(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ except Exception as X:
+ EdkLogger.error("GenFw", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))
+ EndOfProcedure = threading.Event()
+ EndOfProcedure.clear()
+ if PopenObject.stderr:
+ StdErrThread = threading.Thread(target=ReadMessage, args=(PopenObject.stderr, EdkLogger.quiet, EndOfProcedure))
+ StdErrThread.setName("STDERR-Redirector")
+ StdErrThread.setDaemon(False)
+ StdErrThread.start()
+ # waiting for program exit
+ PopenObject.wait()
+ if PopenObject.stderr:
+ StdErrThread.join()
+ if PopenObject.returncode != 0:
+ EdkLogger.error("GenFw", COMMAND_FAILURE, "Failed to generate firmware hash image for %s" % (DefaultEFIfile))
+ if os.path.isfile(Tempfile):
+ self.Hash = hashlib.sha1()
+ buf = open(Tempfile, 'rb').read()
+ if self.Hash.update(buf):
+ self.Hash = self.Hash.update(buf)
+ self.Hash = self.Hash.hexdigest()
+ os.remove(Tempfile)
+
+ FileWrite(File, "Module Summary")
+ FileWrite(File, "Module Name: %s" % self.ModuleName)
+ FileWrite(File, "Module Arch: %s" % self.ModuleArch)
+ FileWrite(File, "Module INF Path: %s" % self.ModuleInfPath)
+ FileWrite(File, "File GUID: %s" % self.FileGuid)
+ if self.Size:
+ FileWrite(File, "Size: 0x%X (%.2fK)" % (self.Size, self.Size / 1024.0))
+ if self.Hash:
+ FileWrite(File, "SHA1 HASH: %s *%s" % (self.Hash, self.ModuleName + ".efi"))
+ if self.BuildTimeStamp:
+ FileWrite(File, "Build Time Stamp: %s" % self.BuildTimeStamp)
+ if self.BuildTime:
+ FileWrite(File, "Module Build Time: %s" % self.BuildTime)
+ if self.DriverType:
+ FileWrite(File, "Driver Type: %s" % self.DriverType)
+ if self.UefiSpecVersion:
+ FileWrite(File, "UEFI Spec Version: %s" % self.UefiSpecVersion)
+ if self.PiSpecVersion:
+ FileWrite(File, "PI Spec Version: %s" % self.PiSpecVersion)
+ if self.PciDeviceId:
+ FileWrite(File, "PCI Device ID: %s" % self.PciDeviceId)
+ if self.PciVendorId:
+ FileWrite(File, "PCI Vendor ID: %s" % self.PciVendorId)
+ if self.PciClassCode:
+ FileWrite(File, "PCI Class Code: %s" % self.PciClassCode)
+
+ FileWrite(File, gSectionSep)
+
+ if "PCD" in ReportType:
+ GlobalPcdReport.GenerateReport(File, self.ModulePcdSet)
+
+ if "LIBRARY" in ReportType:
+ self.LibraryReport.GenerateReport(File)
+
+ if "DEPEX" in ReportType:
+ self.DepexReport.GenerateReport(File, GlobalDepexParser)
+
+ if "BUILD_FLAGS" in ReportType:
+ self.BuildFlagsReport.GenerateReport(File)
+
+ if "FIXED_ADDRESS" in ReportType and self.FileGuid:
+ GlobalPredictionReport.GenerateReport(File, self.FileGuid)
+
+ FileWrite(File, gSectionEnd)
+
+def ReadMessage(From, To, ExitFlag):
+ while True:
+ # read one line a time
+ Line = From.readline()
+ # empty string means "end"
+ if Line is not None and Line != b"":
+ To(Line.rstrip().decode(encoding='utf-8', errors='ignore'))
+ else:
+ break
+ if ExitFlag.isSet():
+ break
+
+##
+# Reports platform and module PCD information
+#
+# This class reports the platform PCD section and module PCD subsection
+# in the build report file.
+#
+class PcdReport(object):
+ ##
+ # Constructor function for class PcdReport
+ #
+ # This constructor function generates PcdReport object a platform build.
+ # It collects the whole PCD database from platform DSC files, platform
+ # flash description file and package DEC files.
+ #
+ # @param self The object pointer
+ # @param Wa Workspace context information
+ #
+ def __init__(self, Wa):
+ self.AllPcds = {}
+ self.UnusedPcds = {}
+ self.ConditionalPcds = {}
+ self.MaxLen = 0
+ self.Arch = None
+ if Wa.FdfProfile:
+ self.FdfPcdSet = Wa.FdfProfile.PcdDict
+ else:
+ self.FdfPcdSet = {}
+
+ self.DefaultStoreSingle = True
+ self.SkuSingle = True
+ if GlobalData.gDefaultStores and len(GlobalData.gDefaultStores) > 1:
+ self.DefaultStoreSingle = False
+ if GlobalData.gSkuids and len(GlobalData.gSkuids) > 1:
+ self.SkuSingle = False
+
+ self.ModulePcdOverride = {}
+ for Pa in Wa.AutoGenObjectList:
+ self.Arch = Pa.Arch
+ #
+ # Collect all platform referenced PCDs and grouped them by PCD token space
+ # GUID C Names
+ #
+ for Pcd in Pa.AllPcdList:
+ PcdList = self.AllPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(Pcd.Type, [])
+ if Pcd not in PcdList:
+ PcdList.append(Pcd)
+ if len(Pcd.TokenCName) > self.MaxLen:
+ self.MaxLen = len(Pcd.TokenCName)
+ #
+ # Collect the PCD defined in DSC/FDF file, but not used in module
+ #
+ UnusedPcdFullList = []
+ StructPcdDict = GlobalData.gStructurePcd.get(self.Arch, collections.OrderedDict())
+ for Name, Guid in StructPcdDict:
+ if (Name, Guid) not in Pa.Platform.Pcds:
+ Pcd = StructPcdDict[(Name, Guid)]
+ PcdList = self.AllPcds.setdefault(Guid, {}).setdefault(Pcd.Type, [])
+ if Pcd not in PcdList and Pcd not in UnusedPcdFullList:
+ UnusedPcdFullList.append(Pcd)
+ for item in Pa.Platform.Pcds:
+ Pcd = Pa.Platform.Pcds[item]
+ if not Pcd.Type:
+ # check the Pcd in FDF file, whether it is used in module first
+ for T in PCD_TYPE_LIST:
+ PcdList = self.AllPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(T, [])
+ if Pcd in PcdList:
+ Pcd.Type = T
+ break
+ if not Pcd.Type:
+ PcdTypeFlag = False
+ for package in Pa.PackageList:
+ for T in PCD_TYPE_LIST:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, T) in package.Pcds:
+ Pcd.Type = T
+ PcdTypeFlag = True
+ if not Pcd.DatumType:
+ Pcd.DatumType = package.Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName, T)].DatumType
+ break
+ if PcdTypeFlag:
+ break
+ if not Pcd.DatumType:
+ PcdType = Pcd.Type
+ # Try to remove Hii and Vpd suffix
+ if PcdType.startswith(TAB_PCDS_DYNAMIC_EX):
+ PcdType = TAB_PCDS_DYNAMIC_EX
+ elif PcdType.startswith(TAB_PCDS_DYNAMIC):
+ PcdType = TAB_PCDS_DYNAMIC
+ for package in Pa.PackageList:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, PcdType) in package.Pcds:
+ Pcd.DatumType = package.Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName, PcdType)].DatumType
+ break
+
+ PcdList = self.AllPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(Pcd.Type, [])
+ UnusedPcdList = self.UnusedPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(Pcd.Type, [])
+ if Pcd in UnusedPcdList:
+ UnusedPcdList.remove(Pcd)
+ if Pcd not in PcdList and Pcd not in UnusedPcdFullList:
+ UnusedPcdFullList.append(Pcd)
+ if len(Pcd.TokenCName) > self.MaxLen:
+ self.MaxLen = len(Pcd.TokenCName)
+
+ if GlobalData.gConditionalPcds:
+ for PcdItem in GlobalData.gConditionalPcds:
+ if '.' in PcdItem:
+ (TokenSpaceGuidCName, TokenCName) = PcdItem.split('.')
+ if (TokenCName, TokenSpaceGuidCName) in Pa.Platform.Pcds:
+ Pcd = Pa.Platform.Pcds[(TokenCName, TokenSpaceGuidCName)]
+ PcdList = self.ConditionalPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(Pcd.Type, [])
+ if Pcd not in PcdList:
+ PcdList.append(Pcd)
+
+ UnusedPcdList = []
+ if UnusedPcdFullList:
+ for Pcd in UnusedPcdFullList:
+ if Pcd.TokenSpaceGuidCName + '.' + Pcd.TokenCName in GlobalData.gConditionalPcds:
+ continue
+ UnusedPcdList.append(Pcd)
+
+ for Pcd in UnusedPcdList:
+ PcdList = self.UnusedPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(Pcd.Type, [])
+ if Pcd not in PcdList:
+ PcdList.append(Pcd)
+
+ for Module in Pa.Platform.Modules.values():
+ #
+ # Collect module override PCDs
+ #
+ for ModulePcd in Module.M.ModulePcdList + Module.M.LibraryPcdList:
+ TokenCName = ModulePcd.TokenCName
+ TokenSpaceGuid = ModulePcd.TokenSpaceGuidCName
+ ModuleDefault = ModulePcd.DefaultValue
+ ModulePath = os.path.basename(Module.M.MetaFile.File)
+ self.ModulePcdOverride.setdefault((TokenCName, TokenSpaceGuid), {})[ModulePath] = ModuleDefault
+
+
+ #
+ # Collect PCD DEC default value.
+ #
+ self.DecPcdDefault = {}
+ self._GuidDict = {}
+ for Pa in Wa.AutoGenObjectList:
+ for Package in Pa.PackageList:
+ Guids = Package.Guids
+ self._GuidDict.update(Guids)
+ for (TokenCName, TokenSpaceGuidCName, DecType) in Package.Pcds:
+ DecDefaultValue = Package.Pcds[TokenCName, TokenSpaceGuidCName, DecType].DefaultValue
+ self.DecPcdDefault.setdefault((TokenCName, TokenSpaceGuidCName, DecType), DecDefaultValue)
+ #
+ # Collect PCDs defined in DSC common section
+ #
+ self.DscPcdDefault = {}
+ for Pa in Wa.AutoGenObjectList:
+ for (TokenCName, TokenSpaceGuidCName) in Pa.Platform.Pcds:
+ DscDefaultValue = Pa.Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DscDefaultValue
+ if DscDefaultValue:
+ self.DscPcdDefault[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue
+
+ def GenerateReport(self, File, ModulePcdSet):
+ if not ModulePcdSet:
+ if self.ConditionalPcds:
+ self.GenerateReportDetail(File, ModulePcdSet, 1)
+ if self.UnusedPcds:
+ IsEmpty = True
+ for Token in self.UnusedPcds:
+ TokenDict = self.UnusedPcds[Token]
+ for Type in TokenDict:
+ if TokenDict[Type]:
+ IsEmpty = False
+ break
+ if not IsEmpty:
+ break
+ if not IsEmpty:
+ self.GenerateReportDetail(File, ModulePcdSet, 2)
+ self.GenerateReportDetail(File, ModulePcdSet)
+
+ ##
+ # Generate report for PCD information
+ #
+ # This function generates report for separate module expression
+ # in a platform build.
+ #
+ # @param self The object pointer
+ # @param File The file object for report
+ # @param ModulePcdSet Set of all PCDs referenced by module or None for
+ # platform PCD report
+ # @param ReportySubType 0 means platform/module PCD report, 1 means Conditional
+ # directives section report, 2 means Unused Pcds section report
+ # @param DscOverridePcds Module DSC override PCDs set
+ #
+ def GenerateReportDetail(self, File, ModulePcdSet, ReportSubType = 0):
+ PcdDict = self.AllPcds
+ if ReportSubType == 1:
+ PcdDict = self.ConditionalPcds
+ elif ReportSubType == 2:
+ PcdDict = self.UnusedPcds
+
+ if not ModulePcdSet:
+ FileWrite(File, gSectionStart)
+ if ReportSubType == 1:
+ FileWrite(File, "Conditional Directives used by the build system")
+ elif ReportSubType == 2:
+ FileWrite(File, "PCDs not used by modules or in conditional directives")
+ else:
+ FileWrite(File, "Platform Configuration Database Report")
+
+ FileWrite(File, " *B - PCD override in the build option")
+ FileWrite(File, " *P - Platform scoped PCD override in DSC file")
+ FileWrite(File, " *F - Platform scoped PCD override in FDF file")
+ if not ReportSubType:
+ FileWrite(File, " *M - Module scoped PCD override")
+ FileWrite(File, gSectionSep)
+ else:
+ if not ReportSubType and ModulePcdSet:
+ #
+ # For module PCD sub-section
+ #
+ FileWrite(File, gSubSectionStart)
+ FileWrite(File, TAB_BRG_PCD)
+ FileWrite(File, gSubSectionSep)
+ AllPcdDict = {}
+ for Key in PcdDict:
+ AllPcdDict[Key] = {}
+ for Type in PcdDict[Key]:
+ for Pcd in PcdDict[Key][Type]:
+ AllPcdDict[Key][(Pcd.TokenCName, Type)] = Pcd
+ for Key in sorted(AllPcdDict):
+ #
+ # Group PCD by their token space GUID C Name
+ #
+ First = True
+ for PcdTokenCName, Type in sorted(AllPcdDict[Key]):
+ #
+ # Group PCD by their usage type
+ #
+ Pcd = AllPcdDict[Key][(PcdTokenCName, Type)]
+ TypeName, DecType = gPcdTypeMap.get(Type, ("", Type))
+ MixedPcdFlag = False
+ if GlobalData.MixedPcd:
+ for PcdKey in GlobalData.MixedPcd:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdKey]:
+ PcdTokenCName = PcdKey[0]
+ MixedPcdFlag = True
+ if MixedPcdFlag and not ModulePcdSet:
+ continue
+ #
+ # Get PCD default value and their override relationship
+ #
+ DecDefaultValue = self.DecPcdDefault.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType))
+ DscDefaultValue = self.DscPcdDefault.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName))
+ DscDefaultValBak = DscDefaultValue
+ Field = ''
+ for (CName, Guid, Field) in self.FdfPcdSet:
+ if CName == PcdTokenCName and Guid == Key:
+ DscDefaultValue = self.FdfPcdSet[(CName, Guid, Field)]
+ break
+ if DscDefaultValue != DscDefaultValBak:
+ try:
+ DscDefaultValue = ValueExpressionEx(DscDefaultValue, Pcd.DatumType, self._GuidDict)(True)
+ except BadExpression as DscDefaultValue:
+ EdkLogger.error('BuildReport', FORMAT_INVALID, "PCD Value: %s, Type: %s" %(DscDefaultValue, Pcd.DatumType))
+
+ InfDefaultValue = None
+
+ PcdValue = DecDefaultValue
+ if DscDefaultValue:
+ PcdValue = DscDefaultValue
+ #The DefaultValue of StructurePcd already be the latest, no need to update.
+ if not self.IsStructurePcd(Pcd.TokenCName, Pcd.TokenSpaceGuidCName):
+ Pcd.DefaultValue = PcdValue
+ if ModulePcdSet is not None:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type) not in ModulePcdSet:
+ continue
+ InfDefaultValue, PcdValue = ModulePcdSet[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type]
+ #The DefaultValue of StructurePcd already be the latest, no need to update.
+ if not self.IsStructurePcd(Pcd.TokenCName, Pcd.TokenSpaceGuidCName):
+ Pcd.DefaultValue = PcdValue
+ if InfDefaultValue:
+ try:
+ InfDefaultValue = ValueExpressionEx(InfDefaultValue, Pcd.DatumType, self._GuidDict)(True)
+ except BadExpression as InfDefaultValue:
+ EdkLogger.error('BuildReport', FORMAT_INVALID, "PCD Value: %s, Type: %s" % (InfDefaultValue, Pcd.DatumType))
+ if InfDefaultValue == "":
+ InfDefaultValue = None
+
+ BuildOptionMatch = False
+ if GlobalData.BuildOptionPcd:
+ for pcd in GlobalData.BuildOptionPcd:
+ if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) == (pcd[0], pcd[1]):
+ if pcd[2]:
+ continue
+ PcdValue = pcd[3]
+ #The DefaultValue of StructurePcd already be the latest, no need to update.
+ if not self.IsStructurePcd(Pcd.TokenCName, Pcd.TokenSpaceGuidCName):
+ Pcd.DefaultValue = PcdValue
+ BuildOptionMatch = True
+ break
+
+ if First:
+ if ModulePcdSet is None:
+ FileWrite(File, "")
+ FileWrite(File, Key)
+ First = False
+
+
+ if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES:
+ if PcdValue.startswith('0') and not PcdValue.lower().startswith('0x') and \
+ len(PcdValue) > 1 and PcdValue.lstrip('0'):
+ PcdValue = PcdValue.lstrip('0')
+ PcdValueNumber = int(PcdValue.strip(), 0)
+ if DecDefaultValue is None:
+ DecMatch = True
+ else:
+ if DecDefaultValue.startswith('0') and not DecDefaultValue.lower().startswith('0x') and \
+ len(DecDefaultValue) > 1 and DecDefaultValue.lstrip('0'):
+ DecDefaultValue = DecDefaultValue.lstrip('0')
+ DecDefaultValueNumber = int(DecDefaultValue.strip(), 0)
+ DecMatch = (DecDefaultValueNumber == PcdValueNumber)
+
+ if InfDefaultValue is None:
+ InfMatch = True
+ else:
+ if InfDefaultValue.startswith('0') and not InfDefaultValue.lower().startswith('0x') and \
+ len(InfDefaultValue) > 1 and InfDefaultValue.lstrip('0'):
+ InfDefaultValue = InfDefaultValue.lstrip('0')
+ InfDefaultValueNumber = int(InfDefaultValue.strip(), 0)
+ InfMatch = (InfDefaultValueNumber == PcdValueNumber)
+
+ if DscDefaultValue is None:
+ DscMatch = True
+ else:
+ if DscDefaultValue.startswith('0') and not DscDefaultValue.lower().startswith('0x') and \
+ len(DscDefaultValue) > 1 and DscDefaultValue.lstrip('0'):
+ DscDefaultValue = DscDefaultValue.lstrip('0')
+ DscDefaultValueNumber = int(DscDefaultValue.strip(), 0)
+ DscMatch = (DscDefaultValueNumber == PcdValueNumber)
+ else:
+ if DecDefaultValue is None:
+ DecMatch = True
+ else:
+ DecMatch = (DecDefaultValue.strip() == PcdValue.strip())
+
+ if InfDefaultValue is None:
+ InfMatch = True
+ else:
+ InfMatch = (InfDefaultValue.strip() == PcdValue.strip())
+
+ if DscDefaultValue is None:
+ DscMatch = True
+ else:
+ DscMatch = (DscDefaultValue.strip() == PcdValue.strip())
+
+ IsStructure = False
+ if self.IsStructurePcd(Pcd.TokenCName, Pcd.TokenSpaceGuidCName):
+ IsStructure = True
+ if TypeName in ('DYNVPD', 'DEXVPD'):
+ SkuInfoList = Pcd.SkuInfoList
+ Pcd = GlobalData.gStructurePcd[self.Arch][(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)]
+ Pcd.DatumType = Pcd.StructName
+ if TypeName in ('DYNVPD', 'DEXVPD'):
+ Pcd.SkuInfoList = SkuInfoList
+ if Pcd.PcdValueFromComm or Pcd.PcdFieldValueFromComm:
+ BuildOptionMatch = True
+ DecMatch = False
+ elif Pcd.PcdValueFromFdf or Pcd.PcdFieldValueFromFdf:
+ DscDefaultValue = True
+ DscMatch = True
+ DecMatch = False
+ elif Pcd.SkuOverrideValues:
+ DscOverride = False
+ if Pcd.DefaultFromDSC:
+ DscOverride = True
+ else:
+ DictLen = 0
+ for item in Pcd.SkuOverrideValues:
+ DictLen += len(Pcd.SkuOverrideValues[item])
+ if not DictLen:
+ DscOverride = False
+ else:
+ if not Pcd.SkuInfoList:
+ OverrideValues = Pcd.SkuOverrideValues
+ if OverrideValues:
+ for Data in OverrideValues.values():
+ Struct = list(Data.values())
+ if Struct:
+ DscOverride = self.ParseStruct(Struct[0])
+ break
+ else:
+ SkuList = sorted(Pcd.SkuInfoList.keys())
+ for Sku in SkuList:
+ SkuInfo = Pcd.SkuInfoList[Sku]
+ if SkuInfo.DefaultStoreDict:
+ DefaultStoreList = sorted(SkuInfo.DefaultStoreDict.keys())
+ for DefaultStore in DefaultStoreList:
+ OverrideValues = Pcd.SkuOverrideValues[Sku]
+ DscOverride = self.ParseStruct(OverrideValues[DefaultStore])
+ if DscOverride:
+ break
+ if DscOverride:
+ break
+ if DscOverride:
+ DscDefaultValue = True
+ DscMatch = True
+ DecMatch = False
+ else:
+ DecMatch = True
+ else:
+ DscDefaultValue = True
+ DscMatch = True
+ DecMatch = False
+
+ #
+ # Report PCD item according to their override relationship
+ #
+ if Pcd.DatumType == 'BOOLEAN':
+ if DscDefaultValue:
+ DscDefaultValue = str(int(DscDefaultValue, 0))
+ if DecDefaultValue:
+ DecDefaultValue = str(int(DecDefaultValue, 0))
+ if InfDefaultValue:
+ InfDefaultValue = str(int(InfDefaultValue, 0))
+ if Pcd.DefaultValue:
+ Pcd.DefaultValue = str(int(Pcd.DefaultValue, 0))
+ if DecMatch:
+ self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, ' ')
+ elif InfDefaultValue and InfMatch:
+ self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*M')
+ elif BuildOptionMatch:
+ self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*B')
+ else:
+ if DscDefaultValue and DscMatch:
+ if (Pcd.TokenCName, Key, Field) in self.FdfPcdSet:
+ self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*F')
+ else:
+ self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*P')
+ else:
+ self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*M')
+
+ if ModulePcdSet is None:
+ if IsStructure:
+ continue
+ if not TypeName in ('PATCH', 'FLAG', 'FIXED'):
+ continue
+ if not BuildOptionMatch:
+ ModuleOverride = self.ModulePcdOverride.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName), {})
+ for ModulePath in ModuleOverride:
+ ModuleDefault = ModuleOverride[ModulePath]
+ if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES:
+ if ModuleDefault.startswith('0') and not ModuleDefault.lower().startswith('0x') and \
+ len(ModuleDefault) > 1 and ModuleDefault.lstrip('0'):
+ ModuleDefault = ModuleDefault.lstrip('0')
+ ModulePcdDefaultValueNumber = int(ModuleDefault.strip(), 0)
+ Match = (ModulePcdDefaultValueNumber == PcdValueNumber)
+ if Pcd.DatumType == 'BOOLEAN':
+ ModuleDefault = str(ModulePcdDefaultValueNumber)
+ else:
+ Match = (ModuleDefault.strip() == PcdValue.strip())
+ if Match:
+ continue
+ IsByteArray, ArrayList = ByteArrayForamt(ModuleDefault.strip())
+ if IsByteArray:
+ FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 15, ModulePath, '{'))
+ for Array in ArrayList:
+ FileWrite(File, Array)
+ else:
+ Value = ModuleDefault.strip()
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
+ FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 15, ModulePath, Value))
+
+ if ModulePcdSet is None:
+ FileWrite(File, gSectionEnd)
+ else:
+ if not ReportSubType and ModulePcdSet:
+ FileWrite(File, gSubSectionEnd)
+
+ def ParseStruct(self, struct):
+ HasDscOverride = False
+ if struct:
+ for _, Values in list(struct.items()):
+ for Key, value in Values.items():
+ if value[1] and value[1].endswith('.dsc'):
+ HasDscOverride = True
+ break
+ if HasDscOverride == True:
+ break
+ return HasDscOverride
+
+ def PrintPcdDefault(self, File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue):
+ if not DscMatch and DscDefaultValue is not None:
+ Value = DscDefaultValue.strip()
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if IsByteArray:
+ FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', "{"))
+ for Array in ArrayList:
+ FileWrite(File, Array)
+ else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
+ FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', Value))
+ if not InfMatch and InfDefaultValue is not None:
+ Value = InfDefaultValue.strip()
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if IsByteArray:
+ FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', "{"))
+ for Array in ArrayList:
+ FileWrite(File, Array)
+ else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
+ FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', Value))
+
+ if not DecMatch and DecDefaultValue is not None:
+ Value = DecDefaultValue.strip()
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if IsByteArray:
+ FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DEC DEFAULT', "{"))
+ for Array in ArrayList:
+ FileWrite(File, Array)
+ else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
+ FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DEC DEFAULT', Value))
+ if IsStructure:
+ for filedvalues in Pcd.DefaultValues.values():
+ self.PrintStructureInfo(File, filedvalues)
+ if DecMatch and IsStructure:
+ for filedvalues in Pcd.DefaultValues.values():
+ self.PrintStructureInfo(File, filedvalues)
+
+ def PrintPcdValue(self, File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, Flag = ' '):
+ if not Pcd.SkuInfoList:
+ Value = Pcd.DefaultValue
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if IsByteArray:
+ FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '{'))
+ for Array in ArrayList:
+ FileWrite(File, Array)
+ else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith('0') and not Value.lower().startswith('0x') and len(Value) > 1 and Value.lstrip('0'):
+ Value = Value.lstrip('0')
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
+ FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value))
+ if IsStructure:
+ FiledOverrideFlag = False
+ if (Pcd.TokenCName,Pcd.TokenSpaceGuidCName) in GlobalData.gPcdSkuOverrides:
+ OverrideValues = GlobalData.gPcdSkuOverrides[(Pcd.TokenCName,Pcd.TokenSpaceGuidCName)]
+ else:
+ OverrideValues = Pcd.SkuOverrideValues
+ if OverrideValues:
+ for Data in OverrideValues.values():
+ Struct = list(Data.values())
+ if Struct:
+ OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct[0])
+ self.PrintStructureInfo(File, OverrideFieldStruct)
+ FiledOverrideFlag = True
+ break
+ if not FiledOverrideFlag and (Pcd.PcdFieldValueFromComm or Pcd.PcdFieldValueFromFdf):
+ OverrideFieldStruct = self.OverrideFieldValue(Pcd, {})
+ self.PrintStructureInfo(File, OverrideFieldStruct)
+ self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)
+ else:
+ FirstPrint = True
+ SkuList = sorted(Pcd.SkuInfoList.keys())
+ for Sku in SkuList:
+ SkuInfo = Pcd.SkuInfoList[Sku]
+ SkuIdName = SkuInfo.SkuIdName
+ if TypeName in ('DYNHII', 'DEXHII'):
+ if SkuInfo.DefaultStoreDict:
+ DefaultStoreList = sorted(SkuInfo.DefaultStoreDict.keys())
+ for DefaultStore in DefaultStoreList:
+ Value = SkuInfo.DefaultStoreDict[DefaultStore]
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if Pcd.DatumType == 'BOOLEAN':
+ Value = str(int(Value, 0))
+ if FirstPrint:
+ FirstPrint = False
+ if IsByteArray:
+ if self.DefaultStoreSingle and self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '{'))
+ elif self.DefaultStoreSingle and not self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', '{'))
+ elif not self.DefaultStoreSingle and self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + DefaultStore + ')', '{'))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', '(' + DefaultStore + ')', '{'))
+ for Array in ArrayList:
+ FileWrite(File, Array)
+ else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
+ if self.DefaultStoreSingle and self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value))
+ elif self.DefaultStoreSingle and not self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', Value))
+ elif not self.DefaultStoreSingle and self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + DefaultStore + ')', Value))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', '(' + DefaultStore + ')', Value))
+ else:
+ if IsByteArray:
+ if self.DefaultStoreSingle and self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '{'))
+ elif self.DefaultStoreSingle and not self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', '{'))
+ elif not self.DefaultStoreSingle and self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + DefaultStore + ')', '{'))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', '(' + DefaultStore + ')', '{'))
+ for Array in ArrayList:
+ FileWrite(File, Array)
+ else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
+ if self.DefaultStoreSingle and self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', Value))
+ elif self.DefaultStoreSingle and not self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', Value))
+ elif not self.DefaultStoreSingle and self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + DefaultStore + ')', Value))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', '(' + DefaultStore + ')', Value))
+ FileWrite(File, '%*s: %s: %s' % (self.MaxLen + 4, SkuInfo.VariableGuid, SkuInfo.VariableName, SkuInfo.VariableOffset))
+ if IsStructure:
+ OverrideValues = Pcd.SkuOverrideValues[Sku]
+ OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[DefaultStore])
+ self.PrintStructureInfo(File, OverrideFieldStruct)
+ self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)
+ else:
+ Value = SkuInfo.DefaultValue
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if Pcd.DatumType == 'BOOLEAN':
+ Value = str(int(Value, 0))
+ if FirstPrint:
+ FirstPrint = False
+ if IsByteArray:
+ if self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', "{"))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', "{"))
+ for Array in ArrayList:
+ FileWrite(File, Array)
+ else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
+ if self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', Value))
+ else:
+ if IsByteArray:
+ if self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', "{"))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', "{"))
+ for Array in ArrayList:
+ FileWrite(File, Array)
+ else:
+ if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+ if Value.startswith(('0x', '0X')):
+ Value = '{} ({:d})'.format(Value, int(Value, 0))
+ else:
+ Value = "0x{:X} ({})".format(int(Value, 0), Value)
+ if self.SkuSingle:
+ FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', Value))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', Value))
+ if TypeName in ('DYNVPD', 'DEXVPD'):
+ FileWrite(File, '%*s' % (self.MaxLen + 4, SkuInfo.VpdOffset))
+ VPDPcdItem = (Pcd.TokenSpaceGuidCName + '.' + PcdTokenCName, SkuIdName, SkuInfo.VpdOffset, Pcd.MaxDatumSize, SkuInfo.DefaultValue)
+ if VPDPcdItem not in VPDPcdList:
+ PcdGuidList = self.UnusedPcds.get(Pcd.TokenSpaceGuidCName)
+ if PcdGuidList:
+ PcdList = PcdGuidList.get(Pcd.Type)
+ if not PcdList:
+ VPDPcdList.append(VPDPcdItem)
+ for VpdPcd in PcdList:
+ if PcdTokenCName == VpdPcd.TokenCName:
+ break
+ else:
+ VPDPcdList.append(VPDPcdItem)
+ if IsStructure:
+ FiledOverrideFlag = False
+ OverrideValues = Pcd.SkuOverrideValues.get(Sku)
+ if OverrideValues:
+ Keys = list(OverrideValues.keys())
+ OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]])
+ self.PrintStructureInfo(File, OverrideFieldStruct)
+ FiledOverrideFlag = True
+ if not FiledOverrideFlag and (Pcd.PcdFieldValueFromComm or Pcd.PcdFieldValueFromFdf):
+ OverrideFieldStruct = self.OverrideFieldValue(Pcd, {})
+ self.PrintStructureInfo(File, OverrideFieldStruct)
+ self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)
+
+ def OverrideFieldValue(self, Pcd, OverrideStruct):
+ OverrideFieldStruct = collections.OrderedDict()
+ if OverrideStruct:
+ for _, Values in OverrideStruct.items():
+ for Key,value in Values.items():
+ if value[1] and value[1].endswith('.dsc'):
+ OverrideFieldStruct[Key] = value
+ if Pcd.PcdFieldValueFromFdf:
+ for Key, Values in Pcd.PcdFieldValueFromFdf.items():
+ if Key in OverrideFieldStruct and Values[0] == OverrideFieldStruct[Key][0]:
+ continue
+ OverrideFieldStruct[Key] = Values
+ if Pcd.PcdFieldValueFromComm:
+ for Key, Values in Pcd.PcdFieldValueFromComm.items():
+ if Key in OverrideFieldStruct and Values[0] == OverrideFieldStruct[Key][0]:
+ continue
+ OverrideFieldStruct[Key] = Values
+ return OverrideFieldStruct
+
+ def PrintStructureInfo(self, File, Struct):
+ for Key, Value in sorted(Struct.items(), key=lambda x: x[0]):
+ if Value[1] and 'build command options' in Value[1]:
+ FileWrite(File, ' *B %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0]))
+ elif Value[1] and Value[1].endswith('.fdf'):
+ FileWrite(File, ' *F %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0]))
+ else:
+ FileWrite(File, ' %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0]))
+
+ def StrtoHex(self, value):
+ try:
+ value = hex(int(value))
+ return value
+ except:
+ if value.startswith("L\"") and value.endswith("\""):
+ valuelist = []
+ for ch in value[2:-1]:
+ valuelist.append(hex(ord(ch)))
+ valuelist.append('0x00')
+ return valuelist
+ elif value.startswith("\"") and value.endswith("\""):
+ return hex(ord(value[1:-1]))
+ elif value.startswith("{") and value.endswith("}"):
+ valuelist = []
+ if ',' not in value:
+ return value[1:-1]
+ for ch in value[1:-1].split(','):
+ ch = ch.strip()
+ if ch.startswith('0x') or ch.startswith('0X'):
+ valuelist.append(ch)
+ continue
+ try:
+ valuelist.append(hex(int(ch.strip())))
+ except:
+ pass
+ return valuelist
+ else:
+ return value
+
+ def IsStructurePcd(self, PcdToken, PcdTokenSpaceGuid):
+ if GlobalData.gStructurePcd and (self.Arch in GlobalData.gStructurePcd) and ((PcdToken, PcdTokenSpaceGuid) in GlobalData.gStructurePcd[self.Arch]):
+ return True
+ else:
+ return False
+
+##
+# Reports platform and module Prediction information
+#
+# This class reports the platform execution order prediction section and
+# module load fixed address prediction subsection in the build report file.
+#
+class PredictionReport(object):
+ ##
+ # Constructor function for class PredictionReport
+ #
+ # This constructor function generates PredictionReport object for the platform.
+ #
+ # @param self: The object pointer
+ # @param Wa Workspace context information
+ #
+ def __init__(self, Wa):
+ self._MapFileName = os.path.join(Wa.BuildDir, Wa.Name + ".map")
+ self._MapFileParsed = False
+ self._EotToolInvoked = False
+ self._FvDir = Wa.FvDir
+ self._EotDir = Wa.BuildDir
+ self._FfsEntryPoint = {}
+ self._GuidMap = {}
+ self._SourceList = []
+ self.FixedMapDict = {}
+ self.ItemList = []
+ self.MaxLen = 0
+
+ #
+ # Collect all platform reference source files and GUID C Name
+ #
+ for Pa in Wa.AutoGenObjectList:
+ for Module in Pa.LibraryAutoGenList + Pa.ModuleAutoGenList:
+ #
+ # BASE typed modules are EFI agnostic, so we need not scan
+ # their source code to find PPI/Protocol produce or consume
+ # information.
+ #
+ if Module.ModuleType == SUP_MODULE_BASE:
+ continue
+ #
+ # Add module referenced source files
+ #
+ self._SourceList.append(str(Module))
+ IncludeList = {}
+ for Source in Module.SourceFileList:
+ if os.path.splitext(str(Source))[1].lower() == ".c":
+ self._SourceList.append(" " + str(Source))
+ FindIncludeFiles(Source.Path, Module.IncludePathList, IncludeList)
+ for IncludeFile in IncludeList.values():
+ self._SourceList.append(" " + IncludeFile)
+
+ for Guid in Module.PpiList:
+ self._GuidMap[Guid] = GuidStructureStringToGuidString(Module.PpiList[Guid])
+ for Guid in Module.ProtocolList:
+ self._GuidMap[Guid] = GuidStructureStringToGuidString(Module.ProtocolList[Guid])
+ for Guid in Module.GuidList:
+ self._GuidMap[Guid] = GuidStructureStringToGuidString(Module.GuidList[Guid])
+
+ if Module.Guid and not Module.IsLibrary:
+ EntryPoint = " ".join(Module.Module.ModuleEntryPointList)
+
+ RealEntryPoint = "_ModuleEntryPoint"
+
+ self._FfsEntryPoint[Module.Guid.upper()] = (EntryPoint, RealEntryPoint)
+
+
+ #
+ # Collect platform firmware volume list as the input of EOT.
+ #
+ self._FvList = []
+ if Wa.FdfProfile:
+ for Fd in Wa.FdfProfile.FdDict:
+ for FdRegion in Wa.FdfProfile.FdDict[Fd].RegionList:
+ if FdRegion.RegionType != BINARY_FILE_TYPE_FV:
+ continue
+ for FvName in FdRegion.RegionDataList:
+ if FvName in self._FvList:
+ continue
+ self._FvList.append(FvName)
+ for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:
+ for Section in Ffs.SectionList:
+ try:
+ for FvSection in Section.SectionList:
+ if FvSection.FvName in self._FvList:
+ continue
+ self._FvList.append(FvSection.FvName)
+ except AttributeError:
+ pass
+
+
+ ##
+ # Parse platform fixed address map files
+ #
+ # This function parses the platform final fixed address map file to get
+ # the database of predicted fixed address for module image base, entry point
+ # etc.
+ #
+ # @param self: The object pointer
+ #
+ def _ParseMapFile(self):
+ if self._MapFileParsed:
+ return
+ self._MapFileParsed = True
+ if os.path.isfile(self._MapFileName):
+ try:
+ FileContents = open(self._MapFileName).read()
+ for Match in gMapFileItemPattern.finditer(FileContents):
+ AddressType = Match.group(1)
+ BaseAddress = Match.group(2)
+ EntryPoint = Match.group(3)
+ Guid = Match.group(4).upper()
+ List = self.FixedMapDict.setdefault(Guid, [])
+ List.append((AddressType, BaseAddress, "*I"))
+ List.append((AddressType, EntryPoint, "*E"))
+ except:
+ EdkLogger.warn(None, "Cannot open file to read", self._MapFileName)
+
+ ##
+ # Invokes EOT tool to get the predicted the execution order.
+ #
+ # This function invokes EOT tool to calculate the predicted dispatch order
+ #
+ # @param self: The object pointer
+ #
+ def _InvokeEotTool(self):
+ if self._EotToolInvoked:
+ return
+
+ self._EotToolInvoked = True
+ FvFileList = []
+ for FvName in self._FvList:
+ FvFile = os.path.join(self._FvDir, FvName + ".Fv")
+ if os.path.isfile(FvFile):
+ FvFileList.append(FvFile)
+
+ if len(FvFileList) == 0:
+ return
+ #
+ # Write source file list and GUID file list to an intermediate file
+ # as the input for EOT tool and dispatch List as the output file
+ # from EOT tool.
+ #
+ SourceList = os.path.join(self._EotDir, "SourceFile.txt")
+ GuidList = os.path.join(self._EotDir, "GuidList.txt")
+ DispatchList = os.path.join(self._EotDir, "Dispatch.txt")
+
+ TempFile = []
+ for Item in self._SourceList:
+ FileWrite(TempFile, Item)
+ SaveFileOnChange(SourceList, "".join(TempFile), False)
+ TempFile = []
+ for Key in self._GuidMap:
+ FileWrite(TempFile, "%s %s" % (Key, self._GuidMap[Key]))
+ SaveFileOnChange(GuidList, "".join(TempFile), False)
+
+ try:
+ from Eot.EotMain import Eot
+
+ #
+ # Invoke EOT tool and echo its runtime performance
+ #
+ EotStartTime = time.time()
+ Eot(CommandLineOption=False, SourceFileList=SourceList, GuidList=GuidList,
+ FvFileList=' '.join(FvFileList), Dispatch=DispatchList, IsInit=True)
+ EotEndTime = time.time()
+ EotDuration = time.strftime("%H:%M:%S", time.gmtime(int(round(EotEndTime - EotStartTime))))
+ EdkLogger.quiet("EOT run time: %s\n" % EotDuration)
+
+ #
+ # Parse the output of EOT tool
+ #
+ for Line in open(DispatchList):
+ if len(Line.split()) < 4:
+ continue
+ (Guid, Phase, FfsName, FilePath) = Line.split()
+ Symbol = self._FfsEntryPoint.get(Guid, [FfsName, ""])[0]
+ if len(Symbol) > self.MaxLen:
+ self.MaxLen = len(Symbol)
+ self.ItemList.append((Phase, Symbol, FilePath))
+ except:
+ EdkLogger.quiet("(Python %s on %s\n%s)" % (platform.python_version(), sys.platform, traceback.format_exc()))
+ EdkLogger.warn(None, "Failed to generate execution order prediction report, for some error occurred in executing EOT.")
+
+
+ ##
+ # Generate platform execution order report
+ #
+ # This function generates the predicted module execution order.
+ #
+ # @param self The object pointer
+ # @param File The file object for report
+ #
+ def _GenerateExecutionOrderReport(self, File):
+ self._InvokeEotTool()
+ if len(self.ItemList) == 0:
+ return
+ FileWrite(File, gSectionStart)
+ FileWrite(File, "Execution Order Prediction")
+ FileWrite(File, "*P PEI phase")
+ FileWrite(File, "*D DXE phase")
+ FileWrite(File, "*E Module INF entry point name")
+ FileWrite(File, "*N Module notification function name")
+
+ FileWrite(File, "Type %-*s %s" % (self.MaxLen, "Symbol", "Module INF Path"))
+ FileWrite(File, gSectionSep)
+ for Item in self.ItemList:
+ FileWrite(File, "*%sE %-*s %s" % (Item[0], self.MaxLen, Item[1], Item[2]))
+
+ FileWrite(File, gSectionStart)
+
+ ##
+ # Generate Fixed Address report.
+ #
+ # This function generate the predicted fixed address report for a module
+ # specified by Guid.
+ #
+ # @param self The object pointer
+ # @param File The file object for report
+ # @param Guid The module Guid value.
+ # @param NotifyList The list of all notify function in a module
+ #
+ def _GenerateFixedAddressReport(self, File, Guid, NotifyList):
+ self._ParseMapFile()
+ FixedAddressList = self.FixedMapDict.get(Guid)
+ if not FixedAddressList:
+ return
+
+ FileWrite(File, gSubSectionStart)
+ FileWrite(File, "Fixed Address Prediction")
+ FileWrite(File, "*I Image Loading Address")
+ FileWrite(File, "*E Entry Point Address")
+ FileWrite(File, "*N Notification Function Address")
+ FileWrite(File, "*F Flash Address")
+ FileWrite(File, "*M Memory Address")
+ FileWrite(File, "*S SMM RAM Offset")
+ FileWrite(File, "TOM Top of Memory")
+
+ FileWrite(File, "Type Address Name")
+ FileWrite(File, gSubSectionSep)
+ for Item in FixedAddressList:
+ Type = Item[0]
+ Value = Item[1]
+ Symbol = Item[2]
+ if Symbol == "*I":
+ Name = "(Image Base)"
+ elif Symbol == "*E":
+ Name = self._FfsEntryPoint.get(Guid, ["", "_ModuleEntryPoint"])[1]
+ elif Symbol in NotifyList:
+ Name = Symbol
+ Symbol = "*N"
+ else:
+ continue
+
+ if "Flash" in Type:
+ Symbol += "F"
+ elif "Memory" in Type:
+ Symbol += "M"
+ else:
+ Symbol += "S"
+
+ if Value[0] == "-":
+ Value = "TOM" + Value
+
+ FileWrite(File, "%s %-16s %s" % (Symbol, Value, Name))
+
+ ##
+ # Generate report for the prediction part
+ #
+ # This function generate the predicted fixed address report for a module or
+ # predicted module execution order for a platform.
+ # If the input Guid is None, then, it generates the predicted module execution order;
+ # otherwise it generated the module fixed loading address for the module specified by
+ # Guid.
+ #
+ # @param self The object pointer
+ # @param File The file object for report
+ # @param Guid The module Guid value.
+ #
+ def GenerateReport(self, File, Guid):
+ if Guid:
+ self._GenerateFixedAddressReport(File, Guid.upper(), [])
+ else:
+ self._GenerateExecutionOrderReport(File)
+
+##
+# Reports FD region information
+#
+# This class reports the FD subsection in the build report file.
+# It collects region information of platform flash device.
+# If the region is a firmware volume, it lists the set of modules
+# and its space information; otherwise, it only lists its region name,
+# base address and size in its sub-section header.
+# If there are nesting FVs, the nested FVs will list immediate after
+# this FD region subsection
+#
+class FdRegionReport(object):
+ ##
+ # Discover all the nested FV name list.
+ #
+ # This is an internal worker function to discover the all the nested FV information
+ # in the parent firmware volume. It uses deep first search algorithm recursively to
+ # find all the FV list name and append them to the list.
+ #
+ # @param self The object pointer
+ # @param FvName The name of current firmware file system
+ # @param Wa Workspace context information
+ #
+ def _DiscoverNestedFvList(self, FvName, Wa):
+ FvDictKey=FvName.upper()
+ if FvDictKey in Wa.FdfProfile.FvDict:
+ for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:
+ for Section in Ffs.SectionList:
+ try:
+ for FvSection in Section.SectionList:
+ if FvSection.FvName in self.FvList:
+ continue
+ self._GuidsDb[Ffs.NameGuid.upper()] = FvSection.FvName
+ self.FvList.append(FvSection.FvName)
+ self.FvInfo[FvSection.FvName] = ("Nested FV", 0, 0)
+ self._DiscoverNestedFvList(FvSection.FvName, Wa)
+ except AttributeError:
+ pass
+
+ ##
+ # Constructor function for class FdRegionReport
+ #
+ # This constructor function generates FdRegionReport object for a specified FdRegion.
+ # If the FdRegion is a firmware volume, it will recursively find all its nested Firmware
+ # volume list. This function also collects GUID map in order to dump module identification
+ # in the final report.
+ #
+ # @param self: The object pointer
+ # @param FdRegion The current FdRegion object
+ # @param Wa Workspace context information
+ #
+ def __init__(self, FdRegion, Wa):
+ self.Type = FdRegion.RegionType
+ self.BaseAddress = FdRegion.Offset
+ self.Size = FdRegion.Size
+ self.FvList = []
+ self.FvInfo = {}
+ self._GuidsDb = {}
+ self._FvDir = Wa.FvDir
+ self._WorkspaceDir = Wa.WorkspaceDir
+
+ #
+ # If the input FdRegion is not a firmware volume,
+ # we are done.
+ #
+ if self.Type != BINARY_FILE_TYPE_FV:
+ return
+
+ #
+ # Find all nested FVs in the FdRegion
+ #
+ for FvName in FdRegion.RegionDataList:
+ if FvName in self.FvList:
+ continue
+ self.FvList.append(FvName)
+ self.FvInfo[FvName] = ("Fd Region", self.BaseAddress, self.Size)
+ self._DiscoverNestedFvList(FvName, Wa)
+
+ PlatformPcds = {}
+ #
+ # Collect PCDs declared in DEC files.
+ #
+ for Pa in Wa.AutoGenObjectList:
+ for Package in Pa.PackageList:
+ for (TokenCName, TokenSpaceGuidCName, DecType) in Package.Pcds:
+ DecDefaultValue = Package.Pcds[TokenCName, TokenSpaceGuidCName, DecType].DefaultValue
+ PlatformPcds[(TokenCName, TokenSpaceGuidCName)] = DecDefaultValue
+ #
+ # Collect PCDs defined in DSC file
+ #
+ for Pa in Wa.AutoGenObjectList:
+ for (TokenCName, TokenSpaceGuidCName) in Pa.Platform.Pcds:
+ DscDefaultValue = Pa.Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DefaultValue
+ PlatformPcds[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue
+
+ #
+ # Add PEI and DXE a priori files GUIDs defined in PI specification.
+ #
+ self._GuidsDb[PEI_APRIORI_GUID] = "PEI Apriori"
+ self._GuidsDb[DXE_APRIORI_GUID] = "DXE Apriori"
+ #
+ # Add ACPI table storage file
+ #
+ self._GuidsDb["7E374E25-8E01-4FEE-87F2-390C23C606CD"] = "ACPI table storage"
+
+ for Pa in Wa.AutoGenObjectList:
+ for ModuleKey in Pa.Platform.Modules:
+ M = Pa.Platform.Modules[ModuleKey].M
+ InfPath = mws.join(Wa.WorkspaceDir, M.MetaFile.File)
+ self._GuidsDb[M.Guid.upper()] = "%s (%s)" % (M.Module.BaseName, InfPath)
+
+ #
+ # Collect the GUID map in the FV firmware volume
+ #
+ for FvName in self.FvList:
+ FvDictKey=FvName.upper()
+ if FvDictKey in Wa.FdfProfile.FvDict:
+ for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:
+ try:
+ #
+ # collect GUID map for binary EFI file in FDF file.
+ #
+ Guid = Ffs.NameGuid.upper()
+ Match = gPcdGuidPattern.match(Ffs.NameGuid)
+ if Match:
+ PcdTokenspace = Match.group(1)
+ PcdToken = Match.group(2)
+ if (PcdToken, PcdTokenspace) in PlatformPcds:
+ GuidValue = PlatformPcds[(PcdToken, PcdTokenspace)]
+ Guid = GuidStructureByteArrayToGuidString(GuidValue).upper()
+ for Section in Ffs.SectionList:
+ try:
+ ModuleSectFile = mws.join(Wa.WorkspaceDir, Section.SectFileName)
+ self._GuidsDb[Guid] = ModuleSectFile
+ except AttributeError:
+ pass
+ except AttributeError:
+ pass
+
+
+ ##
+ # Internal worker function to generate report for the FD region
+ #
+ # This internal worker function to generate report for the FD region.
+ # It the type is firmware volume, it lists offset and module identification.
+ #
+ # @param self The object pointer
+ # @param File The file object for report
+ # @param Title The title for the FD subsection
+ # @param BaseAddress The base address for the FD region
+ # @param Size The size of the FD region
+ # @param FvName The FV name if the FD region is a firmware volume
+ #
+ def _GenerateReport(self, File, Title, Type, BaseAddress, Size=0, FvName=None):
+ FileWrite(File, gSubSectionStart)
+ FileWrite(File, Title)
+ FileWrite(File, "Type: %s" % Type)
+ FileWrite(File, "Base Address: 0x%X" % BaseAddress)
+
+ if self.Type == BINARY_FILE_TYPE_FV:
+ FvTotalSize = 0
+ FvTakenSize = 0
+ FvFreeSize = 0
+ if FvName.upper().endswith('.FV'):
+ FileExt = FvName + ".txt"
+ else:
+ FileExt = FvName + ".Fv.txt"
+
+ if not os.path.isfile(FileExt):
+ FvReportFileName = mws.join(self._WorkspaceDir, FileExt)
+ if not os.path.isfile(FvReportFileName):
+ FvReportFileName = os.path.join(self._FvDir, FileExt)
+ try:
+ #
+ # Collect size info in the firmware volume.
+ #
+ FvReport = open(FvReportFileName).read()
+ Match = gFvTotalSizePattern.search(FvReport)
+ if Match:
+ FvTotalSize = int(Match.group(1), 16)
+ Match = gFvTakenSizePattern.search(FvReport)
+ if Match:
+ FvTakenSize = int(Match.group(1), 16)
+ FvFreeSize = FvTotalSize - FvTakenSize
+ #
+ # Write size information to the report file.
+ #
+ FileWrite(File, "Size: 0x%X (%.0fK)" % (FvTotalSize, FvTotalSize / 1024.0))
+ FileWrite(File, "Fv Name: %s (%.1f%% Full)" % (FvName, FvTakenSize * 100.0 / FvTotalSize))
+ FileWrite(File, "Occupied Size: 0x%X (%.0fK)" % (FvTakenSize, FvTakenSize / 1024.0))
+ FileWrite(File, "Free Size: 0x%X (%.0fK)" % (FvFreeSize, FvFreeSize / 1024.0))
+ FileWrite(File, "Offset Module")
+ FileWrite(File, gSubSectionSep)
+ #
+ # Write module offset and module identification to the report file.
+ #
+ OffsetInfo = {}
+ for Match in gOffsetGuidPattern.finditer(FvReport):
+ Guid = Match.group(2).upper()
+ OffsetInfo[Match.group(1)] = self._GuidsDb.get(Guid, Guid)
+ OffsetList = sorted(OffsetInfo.keys())
+ for Offset in OffsetList:
+ FileWrite (File, "%s %s" % (Offset, OffsetInfo[Offset]))
+ except IOError:
+ EdkLogger.warn(None, "Fail to read report file", FvReportFileName)
+ else:
+ FileWrite(File, "Size: 0x%X (%.0fK)" % (Size, Size / 1024.0))
+ FileWrite(File, gSubSectionEnd)
+
+ ##
+ # Generate report for the FD region
+ #
+ # This function generates report for the FD region.
+ #
+ # @param self The object pointer
+ # @param File The file object for report
+ #
+ def GenerateReport(self, File):
+ if (len(self.FvList) > 0):
+ for FvItem in self.FvList:
+ Info = self.FvInfo[FvItem]
+ self._GenerateReport(File, Info[0], TAB_FV_DIRECTORY, Info[1], Info[2], FvItem)
+ else:
+ self._GenerateReport(File, "FD Region", self.Type, self.BaseAddress, self.Size)
+
+##
+# Reports FD information
+#
+# This class reports the FD section in the build report file.
+# It collects flash device information for a platform.
+#
+class FdReport(object):
+ ##
+ # Constructor function for class FdReport
+ #
+ # This constructor function generates FdReport object for a specified
+ # firmware device.
+ #
+ # @param self The object pointer
+ # @param Fd The current Firmware device object
+ # @param Wa Workspace context information
+ #
+ def __init__(self, Fd, Wa):
+ self.FdName = Fd.FdUiName
+ self.BaseAddress = Fd.BaseAddress
+ self.Size = Fd.Size
+ self.FdRegionList = [FdRegionReport(FdRegion, Wa) for FdRegion in Fd.RegionList]
+ self.FvPath = os.path.join(Wa.BuildDir, TAB_FV_DIRECTORY)
+ self.VPDBaseAddress = 0
+ self.VPDSize = 0
+ for index, FdRegion in enumerate(Fd.RegionList):
+ if str(FdRegion.RegionType) == 'FILE' and Wa.Platform.VpdToolGuid in str(FdRegion.RegionDataList):
+ self.VPDBaseAddress = self.FdRegionList[index].BaseAddress
+ self.VPDSize = self.FdRegionList[index].Size
+ break
+
+ ##
+ # Generate report for the firmware device.
+ #
+ # This function generates report for the firmware device.
+ #
+ # @param self The object pointer
+ # @param File The file object for report
+ #
+ def GenerateReport(self, File):
+ FileWrite(File, gSectionStart)
+ FileWrite(File, "Firmware Device (FD)")
+ FileWrite(File, "FD Name: %s" % self.FdName)
+ FileWrite(File, "Base Address: %s" % self.BaseAddress)
+ FileWrite(File, "Size: 0x%X (%.0fK)" % (self.Size, self.Size / 1024.0))
+ if len(self.FdRegionList) > 0:
+ FileWrite(File, gSectionSep)
+ for FdRegionItem in self.FdRegionList:
+ FdRegionItem.GenerateReport(File)
+
+ if VPDPcdList:
+ VPDPcdList.sort(key=lambda x: int(x[2], 0))
+ FileWrite(File, gSubSectionStart)
+ FileWrite(File, "FD VPD Region")
+ FileWrite(File, "Base Address: 0x%X" % self.VPDBaseAddress)
+ FileWrite(File, "Size: 0x%X (%.0fK)" % (self.VPDSize, self.VPDSize / 1024.0))
+ FileWrite(File, gSubSectionSep)
+ for item in VPDPcdList:
+ # Add BaseAddress for offset
+ Offset = '0x%08X' % (int(item[2], 16) + self.VPDBaseAddress)
+ IsByteArray, ArrayList = ByteArrayForamt(item[-1])
+ Skuinfo = item[1]
+ if len(GlobalData.gSkuids) == 1 :
+ Skuinfo = GlobalData.gSkuids[0]
+ if IsByteArray:
+ FileWrite(File, "%s | %s | %s | %s | %s" % (item[0], Skuinfo, Offset, item[3], '{'))
+ for Array in ArrayList:
+ FileWrite(File, Array)
+ else:
+ FileWrite(File, "%s | %s | %s | %s | %s" % (item[0], Skuinfo, Offset, item[3], item[-1]))
+ FileWrite(File, gSubSectionEnd)
+ FileWrite(File, gSectionEnd)
+
+
+
+##
+# Reports platform information
+#
+# This class reports the whole platform information
+#
+class PlatformReport(object):
+ ##
+ # Constructor function for class PlatformReport
+ #
+ # This constructor function generates PlatformReport object a platform build.
+ # It generates report for platform summary, flash, global PCDs and detailed
+ # module information for modules involved in platform build.
+ #
+ # @param self The object pointer
+ # @param Wa Workspace context information
+ # @param MaList The list of modules in the platform build
+ #
+ def __init__(self, Wa, MaList, ReportType):
+ self._WorkspaceDir = Wa.WorkspaceDir
+ self.PlatformName = Wa.Name
+ self.PlatformDscPath = Wa.Platform
+ self.Architectures = " ".join(Wa.ArchList)
+ self.ToolChain = Wa.ToolChain
+ self.Target = Wa.BuildTarget
+ self.OutputPath = os.path.join(Wa.WorkspaceDir, Wa.OutputDir)
+ self.BuildEnvironment = platform.platform()
+
+ self.PcdReport = None
+ if "PCD" in ReportType:
+ self.PcdReport = PcdReport(Wa)
+
+ self.FdReportList = []
+ if "FLASH" in ReportType and Wa.FdfProfile and MaList is None:
+ for Fd in Wa.FdfProfile.FdDict:
+ self.FdReportList.append(FdReport(Wa.FdfProfile.FdDict[Fd], Wa))
+
+ self.PredictionReport = None
+ if "FIXED_ADDRESS" in ReportType or "EXECUTION_ORDER" in ReportType:
+ self.PredictionReport = PredictionReport(Wa)
+
+ self.DepexParser = None
+ if "DEPEX" in ReportType:
+ self.DepexParser = DepexParser(Wa)
+
+ self.ModuleReportList = []
+ if MaList is not None:
+ self._IsModuleBuild = True
+ for Ma in MaList:
+ self.ModuleReportList.append(ModuleReport(Ma, ReportType))
+ else:
+ self._IsModuleBuild = False
+ for Pa in Wa.AutoGenObjectList:
+ ModuleAutoGenList = []
+ for ModuleKey in Pa.Platform.Modules:
+ ModuleAutoGenList.append(Pa.Platform.Modules[ModuleKey].M)
+ if GlobalData.gFdfParser is not None:
+ if Pa.Arch in GlobalData.gFdfParser.Profile.InfDict:
+ INFList = GlobalData.gFdfParser.Profile.InfDict[Pa.Arch]
+ for InfName in INFList:
+ InfClass = PathClass(NormPath(InfName), Wa.WorkspaceDir, Pa.Arch)
+ Ma = ModuleAutoGen(Wa, InfClass, Pa.BuildTarget, Pa.ToolChain, Pa.Arch, Wa.MetaFile, Pa.DataPipe)
+ if Ma is None:
+ continue
+ if Ma not in ModuleAutoGenList:
+ ModuleAutoGenList.append(Ma)
+ for MGen in ModuleAutoGenList:
+ self.ModuleReportList.append(ModuleReport(MGen, ReportType))
+
+
+
+ ##
+ # Generate report for the whole platform.
+ #
+ # This function generates report for platform information.
+ # It comprises of platform summary, global PCD, flash and
+ # module list sections.
+ #
+ # @param self The object pointer
+ # @param File The file object for report
+ # @param BuildDuration The total time to build the modules
+ # @param AutoGenTime The total time of AutoGen Phase
+ # @param MakeTime The total time of Make Phase
+ # @param GenFdsTime The total time of GenFds Phase
+ # @param ReportType The kind of report items in the final report file
+ #
+ def GenerateReport(self, File, BuildDuration, AutoGenTime, MakeTime, GenFdsTime, ReportType):
+ FileWrite(File, "Platform Summary")
+ FileWrite(File, "Platform Name: %s" % self.PlatformName)
+ FileWrite(File, "Platform DSC Path: %s" % self.PlatformDscPath)
+ FileWrite(File, "Architectures: %s" % self.Architectures)
+ FileWrite(File, "Tool Chain: %s" % self.ToolChain)
+ FileWrite(File, "Target: %s" % self.Target)
+ if GlobalData.gSkuids:
+ FileWrite(File, "SKUID: %s" % " ".join(GlobalData.gSkuids))
+ if GlobalData.gDefaultStores:
+ FileWrite(File, "DefaultStore: %s" % " ".join(GlobalData.gDefaultStores))
+ FileWrite(File, "Output Path: %s" % self.OutputPath)
+ FileWrite(File, "Build Environment: %s" % self.BuildEnvironment)
+ FileWrite(File, "Build Duration: %s" % BuildDuration)
+ if AutoGenTime:
+ FileWrite(File, "AutoGen Duration: %s" % AutoGenTime)
+ if MakeTime:
+ FileWrite(File, "Make Duration: %s" % MakeTime)
+ if GenFdsTime:
+ FileWrite(File, "GenFds Duration: %s" % GenFdsTime)
+ FileWrite(File, "Report Content: %s" % ", ".join(ReportType))
+
+ if GlobalData.MixedPcd:
+ FileWrite(File, gSectionStart)
+ FileWrite(File, "The following PCDs use different access methods:")
+ FileWrite(File, gSectionSep)
+ for PcdItem in GlobalData.MixedPcd:
+ FileWrite(File, "%s.%s" % (str(PcdItem[1]), str(PcdItem[0])))
+ FileWrite(File, gSectionEnd)
+
+ if not self._IsModuleBuild:
+ if "PCD" in ReportType:
+ self.PcdReport.GenerateReport(File, None)
+
+ if "FLASH" in ReportType:
+ for FdReportListItem in self.FdReportList:
+ FdReportListItem.GenerateReport(File)
+
+ for ModuleReportItem in self.ModuleReportList:
+ ModuleReportItem.GenerateReport(File, self.PcdReport, self.PredictionReport, self.DepexParser, ReportType)
+
+ if not self._IsModuleBuild:
+ if "EXECUTION_ORDER" in ReportType:
+ self.PredictionReport.GenerateReport(File, None)
+
+## BuildReport class
+#
+# This base class contain the routines to collect data and then
+# applies certain format to the output report
+#
+class BuildReport(object):
+ ##
+ # Constructor function for class BuildReport
+ #
+ # This constructor function generates BuildReport object a platform build.
+ # It generates report for platform summary, flash, global PCDs and detailed
+ # module information for modules involved in platform build.
+ #
+ # @param self The object pointer
+ # @param ReportFile The file name to save report file
+ # @param ReportType The kind of report items in the final report file
+ #
+ def __init__(self, ReportFile, ReportType):
+ self.ReportFile = ReportFile
+ if ReportFile:
+ self.ReportList = []
+ self.ReportType = []
+ if ReportType:
+ for ReportTypeItem in ReportType:
+ if ReportTypeItem not in self.ReportType:
+ self.ReportType.append(ReportTypeItem)
+ else:
+ self.ReportType = ["PCD", "LIBRARY", "BUILD_FLAGS", "DEPEX", "HASH", "FLASH", "FIXED_ADDRESS"]
+ ##
+ # Adds platform report to the list
+ #
+ # This function adds a platform report to the final report list.
+ #
+ # @param self The object pointer
+ # @param Wa Workspace context information
+ # @param MaList The list of modules in the platform build
+ #
+ def AddPlatformReport(self, Wa, MaList=None):
+ if self.ReportFile:
+ self.ReportList.append((Wa, MaList))
+
+ ##
+ # Generates the final report.
+ #
+ # This function generates platform build report. It invokes GenerateReport()
+ # method for every platform report in the list.
+ #
+ # @param self The object pointer
+ # @param BuildDuration The total time to build the modules
+ # @param AutoGenTime The total time of AutoGen phase
+ # @param MakeTime The total time of Make phase
+ # @param GenFdsTime The total time of GenFds phase
+ #
+ def GenerateReport(self, BuildDuration, AutoGenTime, MakeTime, GenFdsTime):
+ if self.ReportFile:
+ try:
+ File = []
+ for (Wa, MaList) in self.ReportList:
+ PlatformReport(Wa, MaList, self.ReportType).GenerateReport(File, BuildDuration, AutoGenTime, MakeTime, GenFdsTime, self.ReportType)
+ Content = FileLinesSplit(''.join(File), gLineMaxLength)
+ SaveFileOnChange(self.ReportFile, Content, False)
+ EdkLogger.quiet("Build report can be found at %s" % os.path.abspath(self.ReportFile))
+ except IOError:
+ EdkLogger.error(None, FILE_WRITE_FAILURE, ExtraData=self.ReportFile)
+ except:
+ EdkLogger.error("BuildReport", CODE_ERROR, "Unknown fatal error when generating build report", ExtraData=self.ReportFile, RaiseError=False)
+ EdkLogger.quiet("(Python %s on %s\n%s)" % (platform.python_version(), sys.platform, traceback.format_exc()))
+
+# This acts like the main() function for the script, unless it is 'import'ed into another script.
+if __name__ == '__main__':
+ pass
+
diff --git a/roms/edk2/BaseTools/Source/Python/build/__init__.py b/roms/edk2/BaseTools/Source/Python/build/__init__.py
new file mode 100644
index 000000000..41a3808ae
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/build/__init__.py
@@ -0,0 +1,9 @@
+## @file
+# Python 'build' package initialization file.
+#
+# This file is required to make Python interpreter treat the directory
+# as containing package.
+#
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
diff --git a/roms/edk2/BaseTools/Source/Python/build/build.py b/roms/edk2/BaseTools/Source/Python/build/build.py
new file mode 100755
index 000000000..c4cfe38ad
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/build/build.py
@@ -0,0 +1,2728 @@
+## @file
+# build a platform or a module
+#
+# Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
+# Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.<BR>
+# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+from __future__ import absolute_import
+import os.path as path
+import sys
+import os
+import re
+import glob
+import time
+import platform
+import traceback
+import multiprocessing
+from threading import Thread,Event,BoundedSemaphore
+import threading
+from linecache import getlines
+from subprocess import Popen,PIPE, STDOUT
+from collections import OrderedDict, defaultdict
+
+from AutoGen.PlatformAutoGen import PlatformAutoGen
+from AutoGen.ModuleAutoGen import ModuleAutoGen
+from AutoGen.WorkspaceAutoGen import WorkspaceAutoGen
+from AutoGen.AutoGenWorker import AutoGenWorkerInProcess,AutoGenManager,\
+ LogAgent
+from AutoGen import GenMake
+from Common import Misc as Utils
+
+from Common.TargetTxtClassObject import TargetTxtDict
+from Common.ToolDefClassObject import ToolDefDict
+from buildoptions import MyOptionParser
+from Common.Misc import PathClass,SaveFileOnChange,RemoveDirectory
+from Common.StringUtils import NormPath
+from Common.MultipleWorkspace import MultipleWorkspace as mws
+from Common.BuildToolError import *
+from Common.DataType import *
+import Common.EdkLogger as EdkLogger
+
+from Workspace.WorkspaceDatabase import BuildDB
+
+from BuildReport import BuildReport
+from GenPatchPcdTable.GenPatchPcdTable import PeImageClass,parsePcdInfoFromMapFile
+from PatchPcdValue.PatchPcdValue import PatchBinaryFile
+
+import Common.GlobalData as GlobalData
+from GenFds.GenFds import GenFds, GenFdsApi
+import multiprocessing as mp
+from multiprocessing import Manager
+from AutoGen.DataPipe import MemoryDataPipe
+from AutoGen.ModuleAutoGenHelper import WorkSpaceInfo, PlatformInfo
+from GenFds.FdfParser import FdfParser
+from AutoGen.IncludesAutoGen import IncludesAutoGen
+from GenFds.GenFds import resetFdsGlobalVariable
+
+## standard targets of build command
+gSupportedTarget = ['all', 'genc', 'genmake', 'modules', 'libraries', 'fds', 'clean', 'cleanall', 'cleanlib', 'run']
+
+## build configuration file
+gBuildConfiguration = "target.txt"
+gToolsDefinition = "tools_def.txt"
+
+TemporaryTablePattern = re.compile(r'^_\d+_\d+_[a-fA-F0-9]+$')
+TmpTableDict = {}
+
+## Check environment PATH variable to make sure the specified tool is found
+#
+# If the tool is found in the PATH, then True is returned
+# Otherwise, False is returned
+#
+def IsToolInPath(tool):
+ if 'PATHEXT' in os.environ:
+ extns = os.environ['PATHEXT'].split(os.path.pathsep)
+ else:
+ extns = ('',)
+ for pathDir in os.environ['PATH'].split(os.path.pathsep):
+ for ext in extns:
+ if os.path.exists(os.path.join(pathDir, tool + ext)):
+ return True
+ return False
+
+## Check environment variables
+#
+# Check environment variables that must be set for build. Currently they are
+#
+# WORKSPACE The directory all packages/platforms start from
+# EDK_TOOLS_PATH The directory contains all tools needed by the build
+# PATH $(EDK_TOOLS_PATH)/Bin/<sys> must be set in PATH
+#
+# If any of above environment variable is not set or has error, the build
+# will be broken.
+#
+def CheckEnvVariable():
+ # check WORKSPACE
+ if "WORKSPACE" not in os.environ:
+ EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",
+ ExtraData="WORKSPACE")
+
+ WorkspaceDir = os.path.normcase(os.path.normpath(os.environ["WORKSPACE"]))
+ if not os.path.exists(WorkspaceDir):
+ EdkLogger.error("build", FILE_NOT_FOUND, "WORKSPACE doesn't exist", ExtraData=WorkspaceDir)
+ elif ' ' in WorkspaceDir:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in WORKSPACE path",
+ ExtraData=WorkspaceDir)
+ os.environ["WORKSPACE"] = WorkspaceDir
+
+ # set multiple workspace
+ PackagesPath = os.getenv("PACKAGES_PATH")
+ mws.setWs(WorkspaceDir, PackagesPath)
+ if mws.PACKAGES_PATH:
+ for Path in mws.PACKAGES_PATH:
+ if not os.path.exists(Path):
+ EdkLogger.error("build", FILE_NOT_FOUND, "One Path in PACKAGES_PATH doesn't exist", ExtraData=Path)
+ elif ' ' in Path:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in PACKAGES_PATH", ExtraData=Path)
+
+
+ os.environ["EDK_TOOLS_PATH"] = os.path.normcase(os.environ["EDK_TOOLS_PATH"])
+
+ # check EDK_TOOLS_PATH
+ if "EDK_TOOLS_PATH" not in os.environ:
+ EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",
+ ExtraData="EDK_TOOLS_PATH")
+
+ # check PATH
+ if "PATH" not in os.environ:
+ EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",
+ ExtraData="PATH")
+
+ GlobalData.gWorkspace = WorkspaceDir
+
+ GlobalData.gGlobalDefines["WORKSPACE"] = WorkspaceDir
+ GlobalData.gGlobalDefines["EDK_TOOLS_PATH"] = os.environ["EDK_TOOLS_PATH"]
+
+## Get normalized file path
+#
+# Convert the path to be local format, and remove the WORKSPACE path at the
+# beginning if the file path is given in full path.
+#
+# @param FilePath File path to be normalized
+# @param Workspace Workspace path which the FilePath will be checked against
+#
+# @retval string The normalized file path
+#
+def NormFile(FilePath, Workspace):
+ # check if the path is absolute or relative
+ if os.path.isabs(FilePath):
+ FileFullPath = os.path.normpath(FilePath)
+ else:
+ FileFullPath = os.path.normpath(mws.join(Workspace, FilePath))
+ Workspace = mws.getWs(Workspace, FilePath)
+
+ # check if the file path exists or not
+ if not os.path.isfile(FileFullPath):
+ EdkLogger.error("build", FILE_NOT_FOUND, ExtraData="\t%s (Please give file in absolute path or relative to WORKSPACE)" % FileFullPath)
+
+ # remove workspace directory from the beginning part of the file path
+ if Workspace[-1] in ["\\", "/"]:
+ return FileFullPath[len(Workspace):]
+ else:
+ return FileFullPath[(len(Workspace) + 1):]
+
+## Get the output of an external program
+#
+# This is the entrance method of thread reading output of an external program and
+# putting them in STDOUT/STDERR of current program.
+#
+# @param From The stream message read from
+# @param To The stream message put on
+# @param ExitFlag The flag used to indicate stopping reading
+#
+def ReadMessage(From, To, ExitFlag,MemTo=None):
+ while True:
+ # read one line a time
+ Line = From.readline()
+ # empty string means "end"
+ if Line is not None and Line != b"":
+ LineStr = Line.rstrip().decode(encoding='utf-8', errors='ignore')
+ if MemTo is not None:
+ if "Note: including file:" == LineStr.lstrip()[:21]:
+ MemTo.append(LineStr)
+ else:
+ To(LineStr)
+ MemTo.append(LineStr)
+ else:
+ To(LineStr)
+ else:
+ break
+ if ExitFlag.isSet():
+ break
+
+class MakeSubProc(Popen):
+ def __init__(self,*args, **argv):
+ super(MakeSubProc,self).__init__(*args, **argv)
+ self.ProcOut = []
+
+## Launch an external program
+#
+# This method will call subprocess.Popen to execute an external program with
+# given options in specified directory. Because of the dead-lock issue during
+# redirecting output of the external program, threads are used to to do the
+# redirection work.
+#
+# @param Command A list or string containing the call of the program
+# @param WorkingDir The directory in which the program will be running
+#
+def LaunchCommand(Command, WorkingDir,ModuleAuto = None):
+ BeginTime = time.time()
+ # if working directory doesn't exist, Popen() will raise an exception
+ if not os.path.isdir(WorkingDir):
+ EdkLogger.error("build", FILE_NOT_FOUND, ExtraData=WorkingDir)
+
+ # Command is used as the first Argument in following Popen().
+ # It could be a string or sequence. We find that if command is a string in following Popen(),
+ # ubuntu may fail with an error message that the command is not found.
+ # So here we may need convert command from string to list instance.
+ if platform.system() != 'Windows':
+ if not isinstance(Command, list):
+ Command = Command.split()
+ Command = ' '.join(Command)
+
+ Proc = None
+ EndOfProcedure = None
+ try:
+ # launch the command
+ Proc = MakeSubProc(Command, stdout=PIPE, stderr=STDOUT, env=os.environ, cwd=WorkingDir, bufsize=-1, shell=True)
+
+ # launch two threads to read the STDOUT and STDERR
+ EndOfProcedure = Event()
+ EndOfProcedure.clear()
+ if Proc.stdout:
+ StdOutThread = Thread(target=ReadMessage, args=(Proc.stdout, EdkLogger.info, EndOfProcedure,Proc.ProcOut))
+ StdOutThread.setName("STDOUT-Redirector")
+ StdOutThread.setDaemon(False)
+ StdOutThread.start()
+
+
+ # waiting for program exit
+ Proc.wait()
+ except: # in case of aborting
+ # terminate the threads redirecting the program output
+ EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
+ if EndOfProcedure is not None:
+ EndOfProcedure.set()
+ if Proc is None:
+ if not isinstance(Command, type("")):
+ Command = " ".join(Command)
+ EdkLogger.error("build", COMMAND_FAILURE, "Failed to start command", ExtraData="%s [%s]" % (Command, WorkingDir))
+
+ if Proc.stdout:
+ StdOutThread.join()
+
+ # check the return code of the program
+ if Proc.returncode != 0:
+ if not isinstance(Command, type("")):
+ Command = " ".join(Command)
+ # print out the Response file and its content when make failure
+ RespFile = os.path.join(WorkingDir, 'OUTPUT', 'respfilelist.txt')
+ if os.path.isfile(RespFile):
+ f = open(RespFile)
+ RespContent = f.read()
+ f.close()
+ EdkLogger.info(RespContent)
+
+ EdkLogger.error("build", COMMAND_FAILURE, ExtraData="%s [%s]" % (Command, WorkingDir))
+ if ModuleAuto:
+ iau = IncludesAutoGen(WorkingDir,ModuleAuto)
+ if ModuleAuto.ToolChainFamily == TAB_COMPILER_MSFT:
+ iau.CreateDepsFileForMsvc(Proc.ProcOut)
+ else:
+ iau.UpdateDepsFileforNonMsvc()
+ iau.UpdateDepsFileforTrim()
+ iau.CreateModuleDeps()
+ iau.CreateDepsInclude()
+ iau.CreateDepsTarget()
+ return "%dms" % (int(round((time.time() - BeginTime) * 1000)))
+
+## The smallest unit that can be built in multi-thread build mode
+#
+# This is the base class of build unit. The "Obj" parameter must provide
+# __str__(), __eq__() and __hash__() methods. Otherwise there could be build units
+# missing build.
+#
+# Currently the "Obj" should be only ModuleAutoGen or PlatformAutoGen objects.
+#
+class BuildUnit:
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Obj The object the build is working on
+ # @param Target The build target name, one of gSupportedTarget
+ # @param Dependency The BuildUnit(s) which must be completed in advance
+ # @param WorkingDir The directory build command starts in
+ #
+ def __init__(self, Obj, BuildCommand, Target, Dependency, WorkingDir="."):
+ self.BuildObject = Obj
+ self.Dependency = Dependency
+ self.WorkingDir = WorkingDir
+ self.Target = Target
+ self.BuildCommand = BuildCommand
+ if not BuildCommand:
+ EdkLogger.error("build", OPTION_MISSING,
+ "No build command found for this module. "
+ "Please check your setting of %s_%s_%s_MAKE_PATH in Conf/tools_def.txt file." %
+ (Obj.BuildTarget, Obj.ToolChain, Obj.Arch),
+ ExtraData=str(Obj))
+
+
+ ## str() method
+ #
+ # It just returns the string representation of self.BuildObject
+ #
+ # @param self The object pointer
+ #
+ def __str__(self):
+ return str(self.BuildObject)
+
+ ## "==" operator method
+ #
+ # It just compares self.BuildObject with "Other". So self.BuildObject must
+ # provide its own __eq__() method.
+ #
+ # @param self The object pointer
+ # @param Other The other BuildUnit object compared to
+ #
+ def __eq__(self, Other):
+ return Other and self.BuildObject == Other.BuildObject \
+ and Other.BuildObject \
+ and self.BuildObject.Arch == Other.BuildObject.Arch
+
+ ## hash() method
+ #
+ # It just returns the hash value of self.BuildObject which must be hashable.
+ #
+ # @param self The object pointer
+ #
+ def __hash__(self):
+ return hash(self.BuildObject) + hash(self.BuildObject.Arch)
+
+ def __repr__(self):
+ return repr(self.BuildObject)
+
+## The smallest module unit that can be built by nmake/make command in multi-thread build mode
+#
+# This class is for module build by nmake/make build system. The "Obj" parameter
+# must provide __str__(), __eq__() and __hash__() methods. Otherwise there could
+# be make units missing build.
+#
+# Currently the "Obj" should be only ModuleAutoGen object.
+#
+class ModuleMakeUnit(BuildUnit):
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Obj The ModuleAutoGen object the build is working on
+ # @param Target The build target name, one of gSupportedTarget
+ #
+ def __init__(self, Obj, BuildCommand,Target):
+ Dependency = [ModuleMakeUnit(La, BuildCommand,Target) for La in Obj.LibraryAutoGenList]
+ BuildUnit.__init__(self, Obj, BuildCommand, Target, Dependency, Obj.MakeFileDir)
+ if Target in [None, "", "all"]:
+ self.Target = "tbuild"
+
+## The smallest platform unit that can be built by nmake/make command in multi-thread build mode
+#
+# This class is for platform build by nmake/make build system. The "Obj" parameter
+# must provide __str__(), __eq__() and __hash__() methods. Otherwise there could
+# be make units missing build.
+#
+# Currently the "Obj" should be only PlatformAutoGen object.
+#
+class PlatformMakeUnit(BuildUnit):
+ ## The constructor
+ #
+ # @param self The object pointer
+ # @param Obj The PlatformAutoGen object the build is working on
+ # @param Target The build target name, one of gSupportedTarget
+ #
+ def __init__(self, Obj, BuildCommand, Target):
+ Dependency = [ModuleMakeUnit(Lib, BuildCommand, Target) for Lib in self.BuildObject.LibraryAutoGenList]
+ Dependency.extend([ModuleMakeUnit(Mod, BuildCommand,Target) for Mod in self.BuildObject.ModuleAutoGenList])
+ BuildUnit.__init__(self, Obj, BuildCommand, Target, Dependency, Obj.MakeFileDir)
+
+## The class representing the task of a module build or platform build
+#
+# This class manages the build tasks in multi-thread build mode. Its jobs include
+# scheduling thread running, catching thread error, monitor the thread status, etc.
+#
+class BuildTask:
+ # queue for tasks waiting for schedule
+ _PendingQueue = OrderedDict()
+ _PendingQueueLock = threading.Lock()
+
+ # queue for tasks ready for running
+ _ReadyQueue = OrderedDict()
+ _ReadyQueueLock = threading.Lock()
+
+ # queue for run tasks
+ _RunningQueue = OrderedDict()
+ _RunningQueueLock = threading.Lock()
+
+ # queue containing all build tasks, in case duplicate build
+ _TaskQueue = OrderedDict()
+
+ # flag indicating error occurs in a running thread
+ _ErrorFlag = threading.Event()
+ _ErrorFlag.clear()
+ _ErrorMessage = ""
+
+ # BoundedSemaphore object used to control the number of running threads
+ _Thread = None
+
+ # flag indicating if the scheduler is started or not
+ _SchedulerStopped = threading.Event()
+ _SchedulerStopped.set()
+
+ ## Start the task scheduler thread
+ #
+ # @param MaxThreadNumber The maximum thread number
+ # @param ExitFlag Flag used to end the scheduler
+ #
+ @staticmethod
+ def StartScheduler(MaxThreadNumber, ExitFlag):
+ SchedulerThread = Thread(target=BuildTask.Scheduler, args=(MaxThreadNumber, ExitFlag))
+ SchedulerThread.setName("Build-Task-Scheduler")
+ SchedulerThread.setDaemon(False)
+ SchedulerThread.start()
+ # wait for the scheduler to be started, especially useful in Linux
+ while not BuildTask.IsOnGoing():
+ time.sleep(0.01)
+
+ ## Scheduler method
+ #
+ # @param MaxThreadNumber The maximum thread number
+ # @param ExitFlag Flag used to end the scheduler
+ #
+ @staticmethod
+ def Scheduler(MaxThreadNumber, ExitFlag):
+ BuildTask._SchedulerStopped.clear()
+ try:
+ # use BoundedSemaphore to control the maximum running threads
+ BuildTask._Thread = BoundedSemaphore(MaxThreadNumber)
+ #
+ # scheduling loop, which will exits when no pending/ready task and
+ # indicated to do so, or there's error in running thread
+ #
+ while (len(BuildTask._PendingQueue) > 0 or len(BuildTask._ReadyQueue) > 0 \
+ or not ExitFlag.isSet()) and not BuildTask._ErrorFlag.isSet():
+ EdkLogger.debug(EdkLogger.DEBUG_8, "Pending Queue (%d), Ready Queue (%d)"
+ % (len(BuildTask._PendingQueue), len(BuildTask._ReadyQueue)))
+
+ # get all pending tasks
+ BuildTask._PendingQueueLock.acquire()
+ BuildObjectList = list(BuildTask._PendingQueue.keys())
+ #
+ # check if their dependency is resolved, and if true, move them
+ # into ready queue
+ #
+ for BuildObject in BuildObjectList:
+ Bt = BuildTask._PendingQueue[BuildObject]
+ if Bt.IsReady():
+ BuildTask._ReadyQueue[BuildObject] = BuildTask._PendingQueue.pop(BuildObject)
+ BuildTask._PendingQueueLock.release()
+
+ # launch build thread until the maximum number of threads is reached
+ while not BuildTask._ErrorFlag.isSet():
+ # empty ready queue, do nothing further
+ if len(BuildTask._ReadyQueue) == 0:
+ break
+
+ # wait for active thread(s) exit
+ BuildTask._Thread.acquire(True)
+
+ # start a new build thread
+ Bo, Bt = BuildTask._ReadyQueue.popitem()
+
+ # move into running queue
+ BuildTask._RunningQueueLock.acquire()
+ BuildTask._RunningQueue[Bo] = Bt
+ BuildTask._RunningQueueLock.release()
+
+ Bt.Start()
+ # avoid tense loop
+ time.sleep(0.01)
+
+ # avoid tense loop
+ time.sleep(0.01)
+
+ # wait for all running threads exit
+ if BuildTask._ErrorFlag.isSet():
+ EdkLogger.quiet("\nWaiting for all build threads exit...")
+ # while not BuildTask._ErrorFlag.isSet() and \
+ while len(BuildTask._RunningQueue) > 0:
+ EdkLogger.verbose("Waiting for thread ending...(%d)" % len(BuildTask._RunningQueue))
+ EdkLogger.debug(EdkLogger.DEBUG_8, "Threads [%s]" % ", ".join(Th.getName() for Th in threading.enumerate()))
+ # avoid tense loop
+ time.sleep(0.1)
+ except BaseException as X:
+ #
+ # TRICK: hide the output of threads left running, so that the user can
+ # catch the error message easily
+ #
+ EdkLogger.SetLevel(EdkLogger.ERROR)
+ BuildTask._ErrorFlag.set()
+ BuildTask._ErrorMessage = "build thread scheduler error\n\t%s" % str(X)
+
+ BuildTask._PendingQueue.clear()
+ BuildTask._ReadyQueue.clear()
+ BuildTask._RunningQueue.clear()
+ BuildTask._TaskQueue.clear()
+ BuildTask._SchedulerStopped.set()
+
+ ## Wait for all running method exit
+ #
+ @staticmethod
+ def WaitForComplete():
+ BuildTask._SchedulerStopped.wait()
+
+ ## Check if the scheduler is running or not
+ #
+ @staticmethod
+ def IsOnGoing():
+ return not BuildTask._SchedulerStopped.isSet()
+
+ ## Abort the build
+ @staticmethod
+ def Abort():
+ if BuildTask.IsOnGoing():
+ BuildTask._ErrorFlag.set()
+ BuildTask.WaitForComplete()
+
+ ## Check if there's error in running thread
+ #
+ # Since the main thread cannot catch exceptions in other thread, we have to
+ # use threading.Event to communicate this formation to main thread.
+ #
+ @staticmethod
+ def HasError():
+ return BuildTask._ErrorFlag.isSet()
+
+ ## Get error message in running thread
+ #
+ # Since the main thread cannot catch exceptions in other thread, we have to
+ # use a static variable to communicate this message to main thread.
+ #
+ @staticmethod
+ def GetErrorMessage():
+ return BuildTask._ErrorMessage
+
+ ## Factory method to create a BuildTask object
+ #
+ # This method will check if a module is building or has been built. And if
+ # true, just return the associated BuildTask object in the _TaskQueue. If
+ # not, create and return a new BuildTask object. The new BuildTask object
+ # will be appended to the _PendingQueue for scheduling later.
+ #
+ # @param BuildItem A BuildUnit object representing a build object
+ # @param Dependency The dependent build object of BuildItem
+ #
+ @staticmethod
+ def New(BuildItem, Dependency=None):
+ if BuildItem in BuildTask._TaskQueue:
+ Bt = BuildTask._TaskQueue[BuildItem]
+ return Bt
+
+ Bt = BuildTask()
+ Bt._Init(BuildItem, Dependency)
+ BuildTask._TaskQueue[BuildItem] = Bt
+
+ BuildTask._PendingQueueLock.acquire()
+ BuildTask._PendingQueue[BuildItem] = Bt
+ BuildTask._PendingQueueLock.release()
+
+ return Bt
+
+ ## The real constructor of BuildTask
+ #
+ # @param BuildItem A BuildUnit object representing a build object
+ # @param Dependency The dependent build object of BuildItem
+ #
+ def _Init(self, BuildItem, Dependency=None):
+ self.BuildItem = BuildItem
+
+ self.DependencyList = []
+ if Dependency is None:
+ Dependency = BuildItem.Dependency
+ else:
+ Dependency.extend(BuildItem.Dependency)
+ self.AddDependency(Dependency)
+ # flag indicating build completes, used to avoid unnecessary re-build
+ self.CompleteFlag = False
+
+ ## Check if all dependent build tasks are completed or not
+ #
+ def IsReady(self):
+ ReadyFlag = True
+ for Dep in self.DependencyList:
+ if Dep.CompleteFlag == True:
+ continue
+ ReadyFlag = False
+ break
+
+ return ReadyFlag
+
+ ## Add dependent build task
+ #
+ # @param Dependency The list of dependent build objects
+ #
+ def AddDependency(self, Dependency):
+ for Dep in Dependency:
+ if not Dep.BuildObject.IsBinaryModule and not Dep.BuildObject.CanSkipbyCache(GlobalData.gModuleCacheHit):
+ self.DependencyList.append(BuildTask.New(Dep)) # BuildTask list
+
+ ## The thread wrapper of LaunchCommand function
+ #
+ # @param Command A list or string contains the call of the command
+ # @param WorkingDir The directory in which the program will be running
+ #
+ def _CommandThread(self, Command, WorkingDir):
+ try:
+ self.BuildItem.BuildObject.BuildTime = LaunchCommand(Command, WorkingDir,self.BuildItem.BuildObject)
+ self.CompleteFlag = True
+
+ # Run hash operation post dependency to account for libs
+ # Run if --hash or --binary-destination
+ if GlobalData.gUseHashCache and not GlobalData.gBinCacheSource:
+ self.BuildItem.BuildObject.GenModuleHash()
+ if GlobalData.gBinCacheDest:
+ self.BuildItem.BuildObject.GenCMakeHash()
+
+ except:
+ #
+ # TRICK: hide the output of threads left running, so that the user can
+ # catch the error message easily
+ #
+ if not BuildTask._ErrorFlag.isSet():
+ GlobalData.gBuildingModule = "%s [%s, %s, %s]" % (str(self.BuildItem.BuildObject),
+ self.BuildItem.BuildObject.Arch,
+ self.BuildItem.BuildObject.ToolChain,
+ self.BuildItem.BuildObject.BuildTarget
+ )
+ EdkLogger.SetLevel(EdkLogger.ERROR)
+ BuildTask._ErrorFlag.set()
+ BuildTask._ErrorMessage = "%s broken\n %s [%s]" % \
+ (threading.currentThread().getName(), Command, WorkingDir)
+
+ # indicate there's a thread is available for another build task
+ BuildTask._RunningQueueLock.acquire()
+ BuildTask._RunningQueue.pop(self.BuildItem)
+ BuildTask._RunningQueueLock.release()
+ BuildTask._Thread.release()
+
+ ## Start build task thread
+ #
+ def Start(self):
+ EdkLogger.quiet("Building ... %s" % repr(self.BuildItem))
+ Command = self.BuildItem.BuildCommand + [self.BuildItem.Target]
+ self.BuildTread = Thread(target=self._CommandThread, args=(Command, self.BuildItem.WorkingDir))
+ self.BuildTread.setName("build thread")
+ self.BuildTread.setDaemon(False)
+ self.BuildTread.start()
+
+## The class contains the information related to EFI image
+#
+class PeImageInfo():
+ ## Constructor
+ #
+ # Constructor will load all required image information.
+ #
+ # @param BaseName The full file path of image.
+ # @param Guid The GUID for image.
+ # @param Arch Arch of this image.
+ # @param OutputDir The output directory for image.
+ # @param DebugDir The debug directory for image.
+ # @param ImageClass PeImage Information
+ #
+ def __init__(self, BaseName, Guid, Arch, OutputDir, DebugDir, ImageClass):
+ self.BaseName = BaseName
+ self.Guid = Guid
+ self.Arch = Arch
+ self.OutputDir = OutputDir
+ self.DebugDir = DebugDir
+ self.Image = ImageClass
+ self.Image.Size = (self.Image.Size // 0x1000 + 1) * 0x1000
+
+## The class implementing the EDK2 build process
+#
+# The build process includes:
+# 1. Load configuration from target.txt and tools_def.txt in $(WORKSPACE)/Conf
+# 2. Parse DSC file of active platform
+# 3. Parse FDF file if any
+# 4. Establish build database, including parse all other files (module, package)
+# 5. Create AutoGen files (C code file, depex file, makefile) if necessary
+# 6. Call build command
+#
+class Build():
+ ## Constructor
+ #
+ # Constructor will load all necessary configurations, parse platform, modules
+ # and packages and the establish a database for AutoGen.
+ #
+ # @param Target The build command target, one of gSupportedTarget
+ # @param WorkspaceDir The directory of workspace
+ # @param BuildOptions Build options passed from command line
+ #
+ def __init__(self, Target, WorkspaceDir, BuildOptions,log_q):
+ self.WorkspaceDir = WorkspaceDir
+ self.Target = Target
+ self.PlatformFile = BuildOptions.PlatformFile
+ self.ModuleFile = BuildOptions.ModuleFile
+ self.ArchList = BuildOptions.TargetArch
+ self.ToolChainList = BuildOptions.ToolChain
+ self.BuildTargetList= BuildOptions.BuildTarget
+ self.Fdf = BuildOptions.FdfFile
+ self.FdList = BuildOptions.RomImage
+ self.FvList = BuildOptions.FvImage
+ self.CapList = BuildOptions.CapName
+ self.SilentMode = BuildOptions.SilentMode
+ self.ThreadNumber = 1
+ self.SkipAutoGen = BuildOptions.SkipAutoGen
+ self.Reparse = BuildOptions.Reparse
+ self.SkuId = BuildOptions.SkuId
+ if self.SkuId:
+ GlobalData.gSKUID_CMD = self.SkuId
+ self.ConfDirectory = BuildOptions.ConfDirectory
+ self.SpawnMode = True
+ self.BuildReport = BuildReport(BuildOptions.ReportFile, BuildOptions.ReportType)
+ self.AutoGenTime = 0
+ self.MakeTime = 0
+ self.GenFdsTime = 0
+ self.MakeFileName = ""
+ TargetObj = TargetTxtDict()
+ ToolDefObj = ToolDefDict((os.path.join(os.getenv("WORKSPACE"),"Conf")))
+ self.TargetTxt = TargetObj.Target
+ self.ToolDef = ToolDefObj.ToolDef
+ GlobalData.BuildOptionPcd = BuildOptions.OptionPcd if BuildOptions.OptionPcd else []
+ #Set global flag for build mode
+ GlobalData.gIgnoreSource = BuildOptions.IgnoreSources
+ GlobalData.gUseHashCache = BuildOptions.UseHashCache
+ GlobalData.gBinCacheDest = BuildOptions.BinCacheDest
+ GlobalData.gBinCacheSource = BuildOptions.BinCacheSource
+ GlobalData.gEnableGenfdsMultiThread = not BuildOptions.NoGenfdsMultiThread
+ GlobalData.gDisableIncludePathCheck = BuildOptions.DisableIncludePathCheck
+
+ if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache:
+ EdkLogger.error("build", OPTION_NOT_SUPPORTED, ExtraData="--binary-destination must be used together with --hash.")
+
+ if GlobalData.gBinCacheSource and not GlobalData.gUseHashCache:
+ EdkLogger.error("build", OPTION_NOT_SUPPORTED, ExtraData="--binary-source must be used together with --hash.")
+
+ if GlobalData.gBinCacheDest and GlobalData.gBinCacheSource:
+ EdkLogger.error("build", OPTION_NOT_SUPPORTED, ExtraData="--binary-destination can not be used together with --binary-source.")
+
+ if GlobalData.gBinCacheSource:
+ BinCacheSource = os.path.normpath(GlobalData.gBinCacheSource)
+ if not os.path.isabs(BinCacheSource):
+ BinCacheSource = mws.join(self.WorkspaceDir, BinCacheSource)
+ GlobalData.gBinCacheSource = BinCacheSource
+ else:
+ if GlobalData.gBinCacheSource is not None:
+ EdkLogger.error("build", OPTION_VALUE_INVALID, ExtraData="Invalid value of option --binary-source.")
+
+ if GlobalData.gBinCacheDest:
+ BinCacheDest = os.path.normpath(GlobalData.gBinCacheDest)
+ if not os.path.isabs(BinCacheDest):
+ BinCacheDest = mws.join(self.WorkspaceDir, BinCacheDest)
+ GlobalData.gBinCacheDest = BinCacheDest
+ else:
+ if GlobalData.gBinCacheDest is not None:
+ EdkLogger.error("build", OPTION_VALUE_INVALID, ExtraData="Invalid value of option --binary-destination.")
+
+ GlobalData.gDatabasePath = os.path.normpath(os.path.join(GlobalData.gConfDirectory, GlobalData.gDatabasePath))
+ if not os.path.exists(os.path.join(GlobalData.gConfDirectory, '.cache')):
+ os.makedirs(os.path.join(GlobalData.gConfDirectory, '.cache'))
+ self.Db = BuildDB
+ self.BuildDatabase = self.Db.BuildObject
+ self.Platform = None
+ self.ToolChainFamily = None
+ self.LoadFixAddress = 0
+ self.UniFlag = BuildOptions.Flag
+ self.BuildModules = []
+ self.HashSkipModules = []
+ self.Db_Flag = False
+ self.LaunchPrebuildFlag = False
+ self.PlatformBuildPath = os.path.join(GlobalData.gConfDirectory, '.cache', '.PlatformBuild')
+ if BuildOptions.CommandLength:
+ GlobalData.gCommandMaxLength = BuildOptions.CommandLength
+
+ # print dot character during doing some time-consuming work
+ self.Progress = Utils.Progressor()
+ # print current build environment and configuration
+ EdkLogger.quiet("%-16s = %s" % ("WORKSPACE", os.environ["WORKSPACE"]))
+ if "PACKAGES_PATH" in os.environ:
+ # WORKSPACE env has been converted before. Print the same path style with WORKSPACE env.
+ EdkLogger.quiet("%-16s = %s" % ("PACKAGES_PATH", os.path.normcase(os.path.normpath(os.environ["PACKAGES_PATH"]))))
+ EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_PATH", os.environ["EDK_TOOLS_PATH"]))
+ if "EDK_TOOLS_BIN" in os.environ:
+ # Print the same path style with WORKSPACE env.
+ EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_BIN", os.path.normcase(os.path.normpath(os.environ["EDK_TOOLS_BIN"]))))
+ EdkLogger.quiet("%-16s = %s" % ("CONF_PATH", GlobalData.gConfDirectory))
+ if "PYTHON3_ENABLE" in os.environ:
+ PYTHON3_ENABLE = os.environ["PYTHON3_ENABLE"]
+ if PYTHON3_ENABLE != "TRUE":
+ PYTHON3_ENABLE = "FALSE"
+ EdkLogger.quiet("%-16s = %s" % ("PYTHON3_ENABLE", PYTHON3_ENABLE))
+ if "PYTHON_COMMAND" in os.environ:
+ EdkLogger.quiet("%-16s = %s" % ("PYTHON_COMMAND", os.environ["PYTHON_COMMAND"]))
+ self.InitPreBuild()
+ self.InitPostBuild()
+ if self.Prebuild:
+ EdkLogger.quiet("%-16s = %s" % ("PREBUILD", self.Prebuild))
+ if self.Postbuild:
+ EdkLogger.quiet("%-16s = %s" % ("POSTBUILD", self.Postbuild))
+ if self.Prebuild:
+ self.LaunchPrebuild()
+ TargetObj = TargetTxtDict()
+ ToolDefObj = ToolDefDict((os.path.join(os.getenv("WORKSPACE"), "Conf")))
+ self.TargetTxt = TargetObj.Target
+ self.ToolDef = ToolDefObj.ToolDef
+ if not (self.LaunchPrebuildFlag and os.path.exists(self.PlatformBuildPath)):
+ self.InitBuild()
+
+ self.AutoGenMgr = None
+ EdkLogger.info("")
+ os.chdir(self.WorkspaceDir)
+ self.log_q = log_q
+ GlobalData.file_lock = mp.Lock()
+ # Init cache data for local only
+ GlobalData.gPackageHashFile = dict()
+ GlobalData.gModulePreMakeCacheStatus = dict()
+ GlobalData.gModuleMakeCacheStatus = dict()
+ GlobalData.gHashChainStatus = dict()
+ GlobalData.gCMakeHashFile = dict()
+ GlobalData.gModuleHashFile = dict()
+ GlobalData.gFileHashDict = dict()
+ GlobalData.gModuleAllCacheStatus = set()
+ GlobalData.gModuleCacheHit = set()
+
+ def StartAutoGen(self,mqueue, DataPipe,SkipAutoGen,PcdMaList,cqueue):
+ try:
+ if SkipAutoGen:
+ return True,0
+ feedback_q = mp.Queue()
+ error_event = mp.Event()
+ FfsCmd = DataPipe.Get("FfsCommand")
+ if FfsCmd is None:
+ FfsCmd = {}
+ GlobalData.FfsCmd = FfsCmd
+ auto_workers = [AutoGenWorkerInProcess(mqueue,DataPipe.dump_file,feedback_q,GlobalData.file_lock,cqueue,self.log_q,error_event) for _ in range(self.ThreadNumber)]
+ self.AutoGenMgr = AutoGenManager(auto_workers,feedback_q,error_event)
+ self.AutoGenMgr.start()
+ for w in auto_workers:
+ w.start()
+ if PcdMaList is not None:
+ for PcdMa in PcdMaList:
+ # SourceFileList calling sequence impact the makefile string sequence.
+ # Create cached SourceFileList here to unify its calling sequence for both
+ # CanSkipbyPreMakeCache and CreateCodeFile/CreateMakeFile.
+ RetVal = PcdMa.SourceFileList
+ # Force cache miss for PCD driver
+ if GlobalData.gUseHashCache and not GlobalData.gBinCacheDest and self.Target in [None, "", "all"]:
+ cqueue.put((PcdMa.MetaFile.Path, PcdMa.Arch, "PreMakeCache", False))
+
+ PcdMa.CreateCodeFile(False)
+ PcdMa.CreateMakeFile(False,GenFfsList = DataPipe.Get("FfsCommand").get((PcdMa.MetaFile.Path, PcdMa.Arch),[]))
+ PcdMa.CreateAsBuiltInf()
+ # Force cache miss for PCD driver
+ if GlobalData.gBinCacheSource and self.Target in [None, "", "all"]:
+ cqueue.put((PcdMa.MetaFile.Path, PcdMa.Arch, "MakeCache", False))
+
+ self.AutoGenMgr.join()
+ rt = self.AutoGenMgr.Status
+ err = 0
+ if not rt:
+ err = UNKNOWN_ERROR
+ return rt, err
+ except FatalError as e:
+ return False, e.args[0]
+ except:
+ return False, UNKNOWN_ERROR
+
+ ## Load configuration
+ #
+ # This method will parse target.txt and get the build configurations.
+ #
+ def LoadConfiguration(self):
+
+ # if no ARCH given in command line, get it from target.txt
+ if not self.ArchList:
+ self.ArchList = self.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_TARGET_ARCH]
+ self.ArchList = tuple(self.ArchList)
+
+ # if no build target given in command line, get it from target.txt
+ if not self.BuildTargetList:
+ self.BuildTargetList = self.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_TARGET]
+
+ # if no tool chain given in command line, get it from target.txt
+ if not self.ToolChainList:
+ self.ToolChainList = self.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_TAG]
+ if self.ToolChainList is None or len(self.ToolChainList) == 0:
+ EdkLogger.error("build", RESOURCE_NOT_AVAILABLE, ExtraData="No toolchain given. Don't know how to build.\n")
+
+ # check if the tool chains are defined or not
+ NewToolChainList = []
+ for ToolChain in self.ToolChainList:
+ if ToolChain not in self.ToolDef.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG]:
+ EdkLogger.warn("build", "Tool chain [%s] is not defined" % ToolChain)
+ else:
+ NewToolChainList.append(ToolChain)
+ # if no tool chain available, break the build
+ if len(NewToolChainList) == 0:
+ EdkLogger.error("build", RESOURCE_NOT_AVAILABLE,
+ ExtraData="[%s] not defined. No toolchain available for build!\n" % ", ".join(self.ToolChainList))
+ else:
+ self.ToolChainList = NewToolChainList
+
+ ToolChainFamily = []
+ ToolDefinition = self.ToolDef.ToolsDefTxtDatabase
+ for Tool in self.ToolChainList:
+ if TAB_TOD_DEFINES_FAMILY not in ToolDefinition or Tool not in ToolDefinition[TAB_TOD_DEFINES_FAMILY] \
+ or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][Tool]:
+ EdkLogger.warn("build", "No tool chain family found in configuration for %s. Default to MSFT." % Tool)
+ ToolChainFamily.append(TAB_COMPILER_MSFT)
+ else:
+ ToolChainFamily.append(ToolDefinition[TAB_TOD_DEFINES_FAMILY][Tool])
+ self.ToolChainFamily = ToolChainFamily
+
+ if not self.PlatformFile:
+ PlatformFile = self.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_ACTIVE_PLATFORM]
+ if not PlatformFile:
+ # Try to find one in current directory
+ WorkingDirectory = os.getcwd()
+ FileList = glob.glob(os.path.normpath(os.path.join(WorkingDirectory, '*.dsc')))
+ FileNum = len(FileList)
+ if FileNum >= 2:
+ EdkLogger.error("build", OPTION_MISSING,
+ ExtraData="There are %d DSC files in %s. Use '-p' to specify one.\n" % (FileNum, WorkingDirectory))
+ elif FileNum == 1:
+ PlatformFile = FileList[0]
+ else:
+ EdkLogger.error("build", RESOURCE_NOT_AVAILABLE,
+ ExtraData="No active platform specified in target.txt or command line! Nothing can be built.\n")
+
+ self.PlatformFile = PathClass(NormFile(PlatformFile, self.WorkspaceDir), self.WorkspaceDir)
+ self.ThreadNumber = ThreadNum()
+ ## Initialize build configuration
+ #
+ # This method will parse DSC file and merge the configurations from
+ # command line and target.txt, then get the final build configurations.
+ #
+ def InitBuild(self):
+ # parse target.txt, tools_def.txt, and platform file
+ self.LoadConfiguration()
+
+ # Allow case-insensitive for those from command line or configuration file
+ ErrorCode, ErrorInfo = self.PlatformFile.Validate(".dsc", False)
+ if ErrorCode != 0:
+ EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)
+
+
+ def InitPreBuild(self):
+ self.LoadConfiguration()
+ ErrorCode, ErrorInfo = self.PlatformFile.Validate(".dsc", False)
+ if ErrorCode != 0:
+ EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)
+ if self.BuildTargetList:
+ GlobalData.gGlobalDefines['TARGET'] = self.BuildTargetList[0]
+ if self.ArchList:
+ GlobalData.gGlobalDefines['ARCH'] = self.ArchList[0]
+ if self.ToolChainList:
+ GlobalData.gGlobalDefines['TOOLCHAIN'] = self.ToolChainList[0]
+ GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = self.ToolChainList[0]
+ if self.ToolChainFamily:
+ GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[0]
+ if 'PREBUILD' in GlobalData.gCommandLineDefines:
+ self.Prebuild = GlobalData.gCommandLineDefines.get('PREBUILD')
+ else:
+ self.Db_Flag = True
+ Platform = self.Db.MapPlatform(str(self.PlatformFile))
+ self.Prebuild = str(Platform.Prebuild)
+ if self.Prebuild:
+ PrebuildList = []
+ #
+ # Evaluate all arguments and convert arguments that are WORKSPACE
+ # relative paths to absolute paths. Filter arguments that look like
+ # flags or do not follow the file/dir naming rules to avoid false
+ # positives on this conversion.
+ #
+ for Arg in self.Prebuild.split():
+ #
+ # Do not modify Arg if it looks like a flag or an absolute file path
+ #
+ if Arg.startswith('-') or os.path.isabs(Arg):
+ PrebuildList.append(Arg)
+ continue
+ #
+ # Do not modify Arg if it does not look like a Workspace relative
+ # path that starts with a valid package directory name
+ #
+ if not Arg[0].isalpha() or os.path.dirname(Arg) == '':
+ PrebuildList.append(Arg)
+ continue
+ #
+ # If Arg looks like a WORKSPACE relative path, then convert to an
+ # absolute path and check to see if the file exists.
+ #
+ Temp = mws.join(self.WorkspaceDir, Arg)
+ if os.path.isfile(Temp):
+ Arg = Temp
+ PrebuildList.append(Arg)
+ self.Prebuild = ' '.join(PrebuildList)
+ self.Prebuild += self.PassCommandOption(self.BuildTargetList, self.ArchList, self.ToolChainList, self.PlatformFile, self.Target)
+
+ def InitPostBuild(self):
+ if 'POSTBUILD' in GlobalData.gCommandLineDefines:
+ self.Postbuild = GlobalData.gCommandLineDefines.get('POSTBUILD')
+ else:
+ Platform = self.Db.MapPlatform(str(self.PlatformFile))
+ self.Postbuild = str(Platform.Postbuild)
+ if self.Postbuild:
+ PostbuildList = []
+ #
+ # Evaluate all arguments and convert arguments that are WORKSPACE
+ # relative paths to absolute paths. Filter arguments that look like
+ # flags or do not follow the file/dir naming rules to avoid false
+ # positives on this conversion.
+ #
+ for Arg in self.Postbuild.split():
+ #
+ # Do not modify Arg if it looks like a flag or an absolute file path
+ #
+ if Arg.startswith('-') or os.path.isabs(Arg):
+ PostbuildList.append(Arg)
+ continue
+ #
+ # Do not modify Arg if it does not look like a Workspace relative
+ # path that starts with a valid package directory name
+ #
+ if not Arg[0].isalpha() or os.path.dirname(Arg) == '':
+ PostbuildList.append(Arg)
+ continue
+ #
+ # If Arg looks like a WORKSPACE relative path, then convert to an
+ # absolute path and check to see if the file exists.
+ #
+ Temp = mws.join(self.WorkspaceDir, Arg)
+ if os.path.isfile(Temp):
+ Arg = Temp
+ PostbuildList.append(Arg)
+ self.Postbuild = ' '.join(PostbuildList)
+ self.Postbuild += self.PassCommandOption(self.BuildTargetList, self.ArchList, self.ToolChainList, self.PlatformFile, self.Target)
+
+ def PassCommandOption(self, BuildTarget, TargetArch, ToolChain, PlatformFile, Target):
+ BuildStr = ''
+ if GlobalData.gCommand and isinstance(GlobalData.gCommand, list):
+ BuildStr += ' ' + ' '.join(GlobalData.gCommand)
+ TargetFlag = False
+ ArchFlag = False
+ ToolChainFlag = False
+ PlatformFileFlag = False
+
+ if GlobalData.gOptions and not GlobalData.gOptions.BuildTarget:
+ TargetFlag = True
+ if GlobalData.gOptions and not GlobalData.gOptions.TargetArch:
+ ArchFlag = True
+ if GlobalData.gOptions and not GlobalData.gOptions.ToolChain:
+ ToolChainFlag = True
+ if GlobalData.gOptions and not GlobalData.gOptions.PlatformFile:
+ PlatformFileFlag = True
+
+ if TargetFlag and BuildTarget:
+ if isinstance(BuildTarget, list) or isinstance(BuildTarget, tuple):
+ BuildStr += ' -b ' + ' -b '.join(BuildTarget)
+ elif isinstance(BuildTarget, str):
+ BuildStr += ' -b ' + BuildTarget
+ if ArchFlag and TargetArch:
+ if isinstance(TargetArch, list) or isinstance(TargetArch, tuple):
+ BuildStr += ' -a ' + ' -a '.join(TargetArch)
+ elif isinstance(TargetArch, str):
+ BuildStr += ' -a ' + TargetArch
+ if ToolChainFlag and ToolChain:
+ if isinstance(ToolChain, list) or isinstance(ToolChain, tuple):
+ BuildStr += ' -t ' + ' -t '.join(ToolChain)
+ elif isinstance(ToolChain, str):
+ BuildStr += ' -t ' + ToolChain
+ if PlatformFileFlag and PlatformFile:
+ if isinstance(PlatformFile, list) or isinstance(PlatformFile, tuple):
+ BuildStr += ' -p ' + ' -p '.join(PlatformFile)
+ elif isinstance(PlatformFile, str):
+ BuildStr += ' -p' + PlatformFile
+ BuildStr += ' --conf=' + GlobalData.gConfDirectory
+ if Target:
+ BuildStr += ' ' + Target
+
+ return BuildStr
+
+ def LaunchPrebuild(self):
+ if self.Prebuild:
+ EdkLogger.info("\n- Prebuild Start -\n")
+ self.LaunchPrebuildFlag = True
+ #
+ # The purpose of .PrebuildEnv file is capture environment variable settings set by the prebuild script
+ # and preserve them for the rest of the main build step, because the child process environment will
+ # evaporate as soon as it exits, we cannot get it in build step.
+ #
+ PrebuildEnvFile = os.path.join(GlobalData.gConfDirectory, '.cache', '.PrebuildEnv')
+ if os.path.isfile(PrebuildEnvFile):
+ os.remove(PrebuildEnvFile)
+ if os.path.isfile(self.PlatformBuildPath):
+ os.remove(self.PlatformBuildPath)
+ if sys.platform == "win32":
+ args = ' && '.join((self.Prebuild, 'set > ' + PrebuildEnvFile))
+ Process = Popen(args, stdout=PIPE, stderr=PIPE, shell=True)
+ else:
+ args = ' && '.join((self.Prebuild, 'env > ' + PrebuildEnvFile))
+ Process = Popen(args, stdout=PIPE, stderr=PIPE, shell=True)
+
+ # launch two threads to read the STDOUT and STDERR
+ EndOfProcedure = Event()
+ EndOfProcedure.clear()
+ if Process.stdout:
+ StdOutThread = Thread(target=ReadMessage, args=(Process.stdout, EdkLogger.info, EndOfProcedure))
+ StdOutThread.setName("STDOUT-Redirector")
+ StdOutThread.setDaemon(False)
+ StdOutThread.start()
+
+ if Process.stderr:
+ StdErrThread = Thread(target=ReadMessage, args=(Process.stderr, EdkLogger.quiet, EndOfProcedure))
+ StdErrThread.setName("STDERR-Redirector")
+ StdErrThread.setDaemon(False)
+ StdErrThread.start()
+ # waiting for program exit
+ Process.wait()
+
+ if Process.stdout:
+ StdOutThread.join()
+ if Process.stderr:
+ StdErrThread.join()
+ if Process.returncode != 0 :
+ EdkLogger.error("Prebuild", PREBUILD_ERROR, 'Prebuild process is not success!')
+
+ if os.path.exists(PrebuildEnvFile):
+ f = open(PrebuildEnvFile)
+ envs = f.readlines()
+ f.close()
+ envs = [l.split("=", 1) for l in envs ]
+ envs = [[I.strip() for I in item] for item in envs if len(item) == 2]
+ os.environ.update(dict(envs))
+ EdkLogger.info("\n- Prebuild Done -\n")
+
+ def LaunchPostbuild(self):
+ if self.Postbuild:
+ EdkLogger.info("\n- Postbuild Start -\n")
+ if sys.platform == "win32":
+ Process = Popen(self.Postbuild, stdout=PIPE, stderr=PIPE, shell=True)
+ else:
+ Process = Popen(self.Postbuild, stdout=PIPE, stderr=PIPE, shell=True)
+ # launch two threads to read the STDOUT and STDERR
+ EndOfProcedure = Event()
+ EndOfProcedure.clear()
+ if Process.stdout:
+ StdOutThread = Thread(target=ReadMessage, args=(Process.stdout, EdkLogger.info, EndOfProcedure))
+ StdOutThread.setName("STDOUT-Redirector")
+ StdOutThread.setDaemon(False)
+ StdOutThread.start()
+
+ if Process.stderr:
+ StdErrThread = Thread(target=ReadMessage, args=(Process.stderr, EdkLogger.quiet, EndOfProcedure))
+ StdErrThread.setName("STDERR-Redirector")
+ StdErrThread.setDaemon(False)
+ StdErrThread.start()
+ # waiting for program exit
+ Process.wait()
+
+ if Process.stdout:
+ StdOutThread.join()
+ if Process.stderr:
+ StdErrThread.join()
+ if Process.returncode != 0 :
+ EdkLogger.error("Postbuild", POSTBUILD_ERROR, 'Postbuild process is not success!')
+ EdkLogger.info("\n- Postbuild Done -\n")
+
+ ## Build a module or platform
+ #
+ # Create autogen code and makefile for a module or platform, and the launch
+ # "make" command to build it
+ #
+ # @param Target The target of build command
+ # @param Platform The platform file
+ # @param Module The module file
+ # @param BuildTarget The name of build target, one of "DEBUG", "RELEASE"
+ # @param ToolChain The name of toolchain to build
+ # @param Arch The arch of the module/platform
+ # @param CreateDepModuleCodeFile Flag used to indicate creating code
+ # for dependent modules/Libraries
+ # @param CreateDepModuleMakeFile Flag used to indicate creating makefile
+ # for dependent modules/Libraries
+ #
+ def _BuildPa(self, Target, AutoGenObject, CreateDepsCodeFile=True, CreateDepsMakeFile=True, BuildModule=False, FfsCommand=None, PcdMaList=None):
+ if AutoGenObject is None:
+ return False
+ if FfsCommand is None:
+ FfsCommand = {}
+ # skip file generation for cleanxxx targets, run and fds target
+ if Target not in ['clean', 'cleanlib', 'cleanall', 'run', 'fds']:
+ # for target which must generate AutoGen code and makefile
+ mqueue = mp.Queue()
+ for m in AutoGenObject.GetAllModuleInfo:
+ mqueue.put(m)
+ mqueue.put((None,None,None,None,None,None,None))
+ AutoGenObject.DataPipe.DataContainer = {"CommandTarget": self.Target}
+ AutoGenObject.DataPipe.DataContainer = {"Workspace_timestamp": AutoGenObject.Workspace._SrcTimeStamp}
+ AutoGenObject.CreateLibModuelDirs()
+ AutoGenObject.DataPipe.DataContainer = {"LibraryBuildDirectoryList":AutoGenObject.LibraryBuildDirectoryList}
+ AutoGenObject.DataPipe.DataContainer = {"ModuleBuildDirectoryList":AutoGenObject.ModuleBuildDirectoryList}
+ AutoGenObject.DataPipe.DataContainer = {"FdsCommandDict": AutoGenObject.Workspace.GenFdsCommandDict}
+ self.Progress.Start("Generating makefile and code")
+ data_pipe_file = os.path.join(AutoGenObject.BuildDir, "GlobalVar_%s_%s.bin" % (str(AutoGenObject.Guid),AutoGenObject.Arch))
+ AutoGenObject.DataPipe.dump(data_pipe_file)
+ cqueue = mp.Queue()
+ autogen_rt,errorcode = self.StartAutoGen(mqueue, AutoGenObject.DataPipe, self.SkipAutoGen, PcdMaList, cqueue)
+ AutoGenIdFile = os.path.join(GlobalData.gConfDirectory,".AutoGenIdFile.txt")
+ with open(AutoGenIdFile,"w") as fw:
+ fw.write("Arch=%s\n" % "|".join((AutoGenObject.Workspace.ArchList)))
+ fw.write("BuildDir=%s\n" % AutoGenObject.Workspace.BuildDir)
+ fw.write("PlatformGuid=%s\n" % str(AutoGenObject.Guid))
+ self.Progress.Stop("done!")
+ if not autogen_rt:
+ self.AutoGenMgr.TerminateWorkers()
+ self.AutoGenMgr.join(1)
+ raise FatalError(errorcode)
+ AutoGenObject.CreateCodeFile(False)
+ AutoGenObject.CreateMakeFile(False)
+ else:
+ # always recreate top/platform makefile when clean, just in case of inconsistency
+ AutoGenObject.CreateCodeFile(True)
+ AutoGenObject.CreateMakeFile(True)
+
+ if EdkLogger.GetLevel() == EdkLogger.QUIET:
+ EdkLogger.quiet("Building ... %s" % repr(AutoGenObject))
+
+ BuildCommand = AutoGenObject.BuildCommand
+ if BuildCommand is None or len(BuildCommand) == 0:
+ EdkLogger.error("build", OPTION_MISSING,
+ "No build command found for this module. "
+ "Please check your setting of %s_%s_%s_MAKE_PATH in Conf/tools_def.txt file." %
+ (AutoGenObject.BuildTarget, AutoGenObject.ToolChain, AutoGenObject.Arch),
+ ExtraData=str(AutoGenObject))
+
+ # run
+ if Target == 'run':
+ return True
+
+ # build modules
+ if BuildModule:
+ BuildCommand = BuildCommand + [Target]
+ LaunchCommand(BuildCommand, AutoGenObject.MakeFileDir)
+ if GlobalData.gBinCacheDest:
+ self.GenDestCache()
+ elif GlobalData.gUseHashCache and not GlobalData.gBinCacheSource:
+ # Only for --hash
+ # Update PreMakeCacheChain files
+ self.GenLocalPreMakeCache()
+ self.BuildModules = []
+ return True
+
+ # build library
+ if Target == 'libraries':
+ DirList = []
+ for Lib in AutoGenObject.LibraryAutoGenList:
+ if not Lib.IsBinaryModule:
+ DirList.append((os.path.join(AutoGenObject.BuildDir, Lib.BuildDir),Lib))
+ for Lib, LibAutoGen in DirList:
+ NewBuildCommand = BuildCommand + ['-f', os.path.normpath(os.path.join(Lib, self.MakeFileName)), 'pbuild']
+ LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir,LibAutoGen)
+ return True
+
+ # build module
+ if Target == 'modules':
+ DirList = []
+ for Lib in AutoGenObject.LibraryAutoGenList:
+ if not Lib.IsBinaryModule:
+ DirList.append((os.path.join(AutoGenObject.BuildDir, Lib.BuildDir),Lib))
+ for Lib, LibAutoGen in DirList:
+ NewBuildCommand = BuildCommand + ['-f', os.path.normpath(os.path.join(Lib, self.MakeFileName)), 'pbuild']
+ LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir,LibAutoGen)
+
+ DirList = []
+ for ModuleAutoGen in AutoGenObject.ModuleAutoGenList:
+ if not ModuleAutoGen.IsBinaryModule:
+ DirList.append((os.path.join(AutoGenObject.BuildDir, ModuleAutoGen.BuildDir),ModuleAutoGen))
+ for Mod,ModAutoGen in DirList:
+ NewBuildCommand = BuildCommand + ['-f', os.path.normpath(os.path.join(Mod, self.MakeFileName)), 'pbuild']
+ LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir,ModAutoGen)
+ self.CreateAsBuiltInf()
+ if GlobalData.gBinCacheDest:
+ self.GenDestCache()
+ elif GlobalData.gUseHashCache and not GlobalData.gBinCacheSource:
+ # Only for --hash
+ # Update PreMakeCacheChain files
+ self.GenLocalPreMakeCache()
+ self.BuildModules = []
+ return True
+
+ # cleanlib
+ if Target == 'cleanlib':
+ for Lib in AutoGenObject.LibraryBuildDirectoryList:
+ LibMakefile = os.path.normpath(os.path.join(Lib, self.MakeFileName))
+ if os.path.exists(LibMakefile):
+ NewBuildCommand = BuildCommand + ['-f', LibMakefile, 'cleanall']
+ LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir)
+ return True
+
+ # clean
+ if Target == 'clean':
+ for Mod in AutoGenObject.ModuleBuildDirectoryList:
+ ModMakefile = os.path.normpath(os.path.join(Mod, self.MakeFileName))
+ if os.path.exists(ModMakefile):
+ NewBuildCommand = BuildCommand + ['-f', ModMakefile, 'cleanall']
+ LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir)
+ for Lib in AutoGenObject.LibraryBuildDirectoryList:
+ LibMakefile = os.path.normpath(os.path.join(Lib, self.MakeFileName))
+ if os.path.exists(LibMakefile):
+ NewBuildCommand = BuildCommand + ['-f', LibMakefile, 'cleanall']
+ LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir)
+ return True
+
+ # cleanall
+ if Target == 'cleanall':
+ try:
+ #os.rmdir(AutoGenObject.BuildDir)
+ RemoveDirectory(AutoGenObject.BuildDir, True)
+ except WindowsError as X:
+ EdkLogger.error("build", FILE_DELETE_FAILURE, ExtraData=str(X))
+ return True
+
+ ## Build a module or platform
+ #
+ # Create autogen code and makefile for a module or platform, and the launch
+ # "make" command to build it
+ #
+ # @param Target The target of build command
+ # @param Platform The platform file
+ # @param Module The module file
+ # @param BuildTarget The name of build target, one of "DEBUG", "RELEASE"
+ # @param ToolChain The name of toolchain to build
+ # @param Arch The arch of the module/platform
+ # @param CreateDepModuleCodeFile Flag used to indicate creating code
+ # for dependent modules/Libraries
+ # @param CreateDepModuleMakeFile Flag used to indicate creating makefile
+ # for dependent modules/Libraries
+ #
+ def _Build(self, Target, AutoGenObject, CreateDepsCodeFile=True, CreateDepsMakeFile=True, BuildModule=False):
+ if AutoGenObject is None:
+ return False
+
+ # skip file generation for cleanxxx targets, run and fds target
+ if Target not in ['clean', 'cleanlib', 'cleanall', 'run', 'fds']:
+ # for target which must generate AutoGen code and makefile
+ if not self.SkipAutoGen or Target == 'genc':
+ self.Progress.Start("Generating code")
+ AutoGenObject.CreateCodeFile(CreateDepsCodeFile)
+ self.Progress.Stop("done!")
+ if Target == "genc":
+ return True
+
+ if not self.SkipAutoGen or Target == 'genmake':
+ self.Progress.Start("Generating makefile")
+ AutoGenObject.CreateMakeFile(CreateDepsMakeFile)
+ #AutoGenObject.CreateAsBuiltInf()
+ self.Progress.Stop("done!")
+ if Target == "genmake":
+ return True
+ else:
+ # always recreate top/platform makefile when clean, just in case of inconsistency
+ AutoGenObject.CreateCodeFile(True)
+ AutoGenObject.CreateMakeFile(True)
+
+ if EdkLogger.GetLevel() == EdkLogger.QUIET:
+ EdkLogger.quiet("Building ... %s" % repr(AutoGenObject))
+
+ BuildCommand = AutoGenObject.BuildCommand
+ if BuildCommand is None or len(BuildCommand) == 0:
+ EdkLogger.error("build", OPTION_MISSING,
+ "No build command found for this module. "
+ "Please check your setting of %s_%s_%s_MAKE_PATH in Conf/tools_def.txt file." %
+ (AutoGenObject.BuildTarget, AutoGenObject.ToolChain, AutoGenObject.Arch),
+ ExtraData=str(AutoGenObject))
+
+ # build modules
+ if BuildModule:
+ if Target != 'fds':
+ BuildCommand = BuildCommand + [Target]
+ AutoGenObject.BuildTime = LaunchCommand(BuildCommand, AutoGenObject.MakeFileDir)
+ self.CreateAsBuiltInf()
+ if GlobalData.gBinCacheDest:
+ self.GenDestCache()
+ elif GlobalData.gUseHashCache and not GlobalData.gBinCacheSource:
+ # Only for --hash
+ # Update PreMakeCacheChain files
+ self.GenLocalPreMakeCache()
+ self.BuildModules = []
+ return True
+
+ # genfds
+ if Target == 'fds':
+ if GenFdsApi(AutoGenObject.GenFdsCommandDict, self.Db):
+ EdkLogger.error("build", COMMAND_FAILURE)
+ Threshold = self.GetFreeSizeThreshold()
+ if Threshold:
+ self.CheckFreeSizeThreshold(Threshold, AutoGenObject.FvDir)
+ return True
+
+ # run
+ if Target == 'run':
+ return True
+
+ # build library
+ if Target == 'libraries':
+ pass
+
+ # not build modules
+
+
+ # cleanall
+ if Target == 'cleanall':
+ try:
+ #os.rmdir(AutoGenObject.BuildDir)
+ RemoveDirectory(AutoGenObject.BuildDir, True)
+ except WindowsError as X:
+ EdkLogger.error("build", FILE_DELETE_FAILURE, ExtraData=str(X))
+ return True
+
+ ## Rebase module image and Get function address for the input module list.
+ #
+ def _RebaseModule (self, MapBuffer, BaseAddress, ModuleList, AddrIsOffset = True, ModeIsSmm = False):
+ if ModeIsSmm:
+ AddrIsOffset = False
+ for InfFile in ModuleList:
+ sys.stdout.write (".")
+ sys.stdout.flush()
+ ModuleInfo = ModuleList[InfFile]
+ ModuleName = ModuleInfo.BaseName
+ ModuleOutputImage = ModuleInfo.Image.FileName
+ ModuleDebugImage = os.path.join(ModuleInfo.DebugDir, ModuleInfo.BaseName + '.efi')
+ ## for SMM module in SMRAM, the SMRAM will be allocated from base to top.
+ if not ModeIsSmm:
+ BaseAddress = BaseAddress - ModuleInfo.Image.Size
+ #
+ # Update Image to new BaseAddress by GenFw tool
+ #
+ LaunchCommand(["GenFw", "--rebase", str(BaseAddress), "-r", ModuleOutputImage], ModuleInfo.OutputDir)
+ LaunchCommand(["GenFw", "--rebase", str(BaseAddress), "-r", ModuleDebugImage], ModuleInfo.DebugDir)
+ else:
+ #
+ # Set new address to the section header only for SMM driver.
+ #
+ LaunchCommand(["GenFw", "--address", str(BaseAddress), "-r", ModuleOutputImage], ModuleInfo.OutputDir)
+ LaunchCommand(["GenFw", "--address", str(BaseAddress), "-r", ModuleDebugImage], ModuleInfo.DebugDir)
+ #
+ # Collect function address from Map file
+ #
+ ImageMapTable = ModuleOutputImage.replace('.efi', '.map')
+ FunctionList = []
+ if os.path.exists(ImageMapTable):
+ OrigImageBaseAddress = 0
+ ImageMap = open(ImageMapTable, 'r')
+ for LinStr in ImageMap:
+ if len (LinStr.strip()) == 0:
+ continue
+ #
+ # Get the preferred address set on link time.
+ #
+ if LinStr.find ('Preferred load address is') != -1:
+ StrList = LinStr.split()
+ OrigImageBaseAddress = int (StrList[len(StrList) - 1], 16)
+
+ StrList = LinStr.split()
+ if len (StrList) > 4:
+ if StrList[3] == 'f' or StrList[3] == 'F':
+ Name = StrList[1]
+ RelativeAddress = int (StrList[2], 16) - OrigImageBaseAddress
+ FunctionList.append ((Name, RelativeAddress))
+
+ ImageMap.close()
+ #
+ # Add general information.
+ #
+ if ModeIsSmm:
+ MapBuffer.append('\n\n%s (Fixed SMRAM Offset, BaseAddress=0x%010X, EntryPoint=0x%010X)\n' % (ModuleName, BaseAddress, BaseAddress + ModuleInfo.Image.EntryPoint))
+ elif AddrIsOffset:
+ MapBuffer.append('\n\n%s (Fixed Memory Offset, BaseAddress=-0x%010X, EntryPoint=-0x%010X)\n' % (ModuleName, 0 - BaseAddress, 0 - (BaseAddress + ModuleInfo.Image.EntryPoint)))
+ else:
+ MapBuffer.append('\n\n%s (Fixed Memory Address, BaseAddress=0x%010X, EntryPoint=0x%010X)\n' % (ModuleName, BaseAddress, BaseAddress + ModuleInfo.Image.EntryPoint))
+ #
+ # Add guid and general seciton section.
+ #
+ TextSectionAddress = 0
+ DataSectionAddress = 0
+ for SectionHeader in ModuleInfo.Image.SectionHeaderList:
+ if SectionHeader[0] == '.text':
+ TextSectionAddress = SectionHeader[1]
+ elif SectionHeader[0] in ['.data', '.sdata']:
+ DataSectionAddress = SectionHeader[1]
+ if AddrIsOffset:
+ MapBuffer.append('(GUID=%s, .textbaseaddress=-0x%010X, .databaseaddress=-0x%010X)\n' % (ModuleInfo.Guid, 0 - (BaseAddress + TextSectionAddress), 0 - (BaseAddress + DataSectionAddress)))
+ else:
+ MapBuffer.append('(GUID=%s, .textbaseaddress=0x%010X, .databaseaddress=0x%010X)\n' % (ModuleInfo.Guid, BaseAddress + TextSectionAddress, BaseAddress + DataSectionAddress))
+ #
+ # Add debug image full path.
+ #
+ MapBuffer.append('(IMAGE=%s)\n\n' % (ModuleDebugImage))
+ #
+ # Add function address
+ #
+ for Function in FunctionList:
+ if AddrIsOffset:
+ MapBuffer.append(' -0x%010X %s\n' % (0 - (BaseAddress + Function[1]), Function[0]))
+ else:
+ MapBuffer.append(' 0x%010X %s\n' % (BaseAddress + Function[1], Function[0]))
+ ImageMap.close()
+
+ #
+ # for SMM module in SMRAM, the SMRAM will be allocated from base to top.
+ #
+ if ModeIsSmm:
+ BaseAddress = BaseAddress + ModuleInfo.Image.Size
+
+ ## Collect MAP information of all FVs
+ #
+ def _CollectFvMapBuffer (self, MapBuffer, Wa, ModuleList):
+ if self.Fdf:
+ # First get the XIP base address for FV map file.
+ GuidPattern = re.compile("[-a-fA-F0-9]+")
+ GuidName = re.compile(r"\(GUID=[-a-fA-F0-9]+")
+ for FvName in Wa.FdfProfile.FvDict:
+ FvMapBuffer = os.path.join(Wa.FvDir, FvName + '.Fv.map')
+ if not os.path.exists(FvMapBuffer):
+ continue
+ FvMap = open(FvMapBuffer, 'r')
+ #skip FV size information
+ FvMap.readline()
+ FvMap.readline()
+ FvMap.readline()
+ FvMap.readline()
+ for Line in FvMap:
+ MatchGuid = GuidPattern.match(Line)
+ if MatchGuid is not None:
+ #
+ # Replace GUID with module name
+ #
+ GuidString = MatchGuid.group()
+ if GuidString.upper() in ModuleList:
+ Line = Line.replace(GuidString, ModuleList[GuidString.upper()].Name)
+ MapBuffer.append(Line)
+ #
+ # Add the debug image full path.
+ #
+ MatchGuid = GuidName.match(Line)
+ if MatchGuid is not None:
+ GuidString = MatchGuid.group().split("=")[1]
+ if GuidString.upper() in ModuleList:
+ MapBuffer.append('(IMAGE=%s)\n' % (os.path.join(ModuleList[GuidString.upper()].DebugDir, ModuleList[GuidString.upper()].Name + '.efi')))
+
+ FvMap.close()
+
+ ## Collect MAP information of all modules
+ #
+ def _CollectModuleMapBuffer (self, MapBuffer, ModuleList):
+ sys.stdout.write ("Generate Load Module At Fix Address Map")
+ sys.stdout.flush()
+ PatchEfiImageList = []
+ PeiModuleList = {}
+ BtModuleList = {}
+ RtModuleList = {}
+ SmmModuleList = {}
+ PeiSize = 0
+ BtSize = 0
+ RtSize = 0
+ # reserve 4K size in SMRAM to make SMM module address not from 0.
+ SmmSize = 0x1000
+ for ModuleGuid in ModuleList:
+ Module = ModuleList[ModuleGuid]
+ GlobalData.gProcessingFile = "%s [%s, %s, %s]" % (Module.MetaFile, Module.Arch, Module.ToolChain, Module.BuildTarget)
+
+ OutputImageFile = ''
+ for ResultFile in Module.CodaTargetList:
+ if str(ResultFile.Target).endswith('.efi'):
+ #
+ # module list for PEI, DXE, RUNTIME and SMM
+ #
+ OutputImageFile = os.path.join(Module.OutputDir, Module.Name + '.efi')
+ ImageClass = PeImageClass (OutputImageFile)
+ if not ImageClass.IsValid:
+ EdkLogger.error("build", FILE_PARSE_FAILURE, ExtraData=ImageClass.ErrorInfo)
+ ImageInfo = PeImageInfo(Module.Name, Module.Guid, Module.Arch, Module.OutputDir, Module.DebugDir, ImageClass)
+ if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER, EDK_COMPONENT_TYPE_PIC_PEIM, EDK_COMPONENT_TYPE_RELOCATABLE_PEIM, SUP_MODULE_DXE_CORE]:
+ PeiModuleList[Module.MetaFile] = ImageInfo
+ PeiSize += ImageInfo.Image.Size
+ elif Module.ModuleType in [EDK_COMPONENT_TYPE_BS_DRIVER, SUP_MODULE_DXE_DRIVER, SUP_MODULE_UEFI_DRIVER]:
+ BtModuleList[Module.MetaFile] = ImageInfo
+ BtSize += ImageInfo.Image.Size
+ elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER, EDK_COMPONENT_TYPE_RT_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, EDK_COMPONENT_TYPE_SAL_RT_DRIVER]:
+ RtModuleList[Module.MetaFile] = ImageInfo
+ RtSize += ImageInfo.Image.Size
+ elif Module.ModuleType in [SUP_MODULE_SMM_CORE, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE]:
+ SmmModuleList[Module.MetaFile] = ImageInfo
+ SmmSize += ImageInfo.Image.Size
+ if Module.ModuleType == SUP_MODULE_DXE_SMM_DRIVER:
+ PiSpecVersion = Module.Module.Specification.get('PI_SPECIFICATION_VERSION', '0x00000000')
+ # for PI specification < PI1.1, DXE_SMM_DRIVER also runs as BOOT time driver.
+ if int(PiSpecVersion, 16) < 0x0001000A:
+ BtModuleList[Module.MetaFile] = ImageInfo
+ BtSize += ImageInfo.Image.Size
+ break
+ #
+ # EFI image is final target.
+ # Check EFI image contains patchable FixAddress related PCDs.
+ #
+ if OutputImageFile != '':
+ ModuleIsPatch = False
+ for Pcd in Module.ModulePcdList:
+ if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE and Pcd.TokenCName in TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SET:
+ ModuleIsPatch = True
+ break
+ if not ModuleIsPatch:
+ for Pcd in Module.LibraryPcdList:
+ if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE and Pcd.TokenCName in TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SET:
+ ModuleIsPatch = True
+ break
+
+ if not ModuleIsPatch:
+ continue
+ #
+ # Module includes the patchable load fix address PCDs.
+ # It will be fixed up later.
+ #
+ PatchEfiImageList.append (OutputImageFile)
+
+ #
+ # Get Top Memory address
+ #
+ ReservedRuntimeMemorySize = 0
+ TopMemoryAddress = 0
+ if self.LoadFixAddress == 0xFFFFFFFFFFFFFFFF:
+ TopMemoryAddress = 0
+ else:
+ TopMemoryAddress = self.LoadFixAddress
+ if TopMemoryAddress < RtSize + BtSize + PeiSize:
+ EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS is too low to load driver")
+
+ #
+ # Patch FixAddress related PCDs into EFI image
+ #
+ for EfiImage in PatchEfiImageList:
+ EfiImageMap = EfiImage.replace('.efi', '.map')
+ if not os.path.exists(EfiImageMap):
+ continue
+ #
+ # Get PCD offset in EFI image by GenPatchPcdTable function
+ #
+ PcdTable = parsePcdInfoFromMapFile(EfiImageMap, EfiImage)
+ #
+ # Patch real PCD value by PatchPcdValue tool
+ #
+ for PcdInfo in PcdTable:
+ ReturnValue = 0
+ if PcdInfo[0] == TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE:
+ ReturnValue, ErrorInfo = PatchBinaryFile (EfiImage, PcdInfo[1], TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE_DATA_TYPE, str (PeiSize // 0x1000))
+ elif PcdInfo[0] == TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE:
+ ReturnValue, ErrorInfo = PatchBinaryFile (EfiImage, PcdInfo[1], TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE_DATA_TYPE, str (BtSize // 0x1000))
+ elif PcdInfo[0] == TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE:
+ ReturnValue, ErrorInfo = PatchBinaryFile (EfiImage, PcdInfo[1], TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE_DATA_TYPE, str (RtSize // 0x1000))
+ elif PcdInfo[0] == TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE and len (SmmModuleList) > 0:
+ ReturnValue, ErrorInfo = PatchBinaryFile (EfiImage, PcdInfo[1], TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE_DATA_TYPE, str (SmmSize // 0x1000))
+ if ReturnValue != 0:
+ EdkLogger.error("build", PARAMETER_INVALID, "Patch PCD value failed", ExtraData=ErrorInfo)
+
+ MapBuffer.append('PEI_CODE_PAGE_NUMBER = 0x%x\n' % (PeiSize // 0x1000))
+ MapBuffer.append('BOOT_CODE_PAGE_NUMBER = 0x%x\n' % (BtSize // 0x1000))
+ MapBuffer.append('RUNTIME_CODE_PAGE_NUMBER = 0x%x\n' % (RtSize // 0x1000))
+ if len (SmmModuleList) > 0:
+ MapBuffer.append('SMM_CODE_PAGE_NUMBER = 0x%x\n' % (SmmSize // 0x1000))
+
+ PeiBaseAddr = TopMemoryAddress - RtSize - BtSize
+ BtBaseAddr = TopMemoryAddress - RtSize
+ RtBaseAddr = TopMemoryAddress - ReservedRuntimeMemorySize
+
+ self._RebaseModule (MapBuffer, PeiBaseAddr, PeiModuleList, TopMemoryAddress == 0)
+ self._RebaseModule (MapBuffer, BtBaseAddr, BtModuleList, TopMemoryAddress == 0)
+ self._RebaseModule (MapBuffer, RtBaseAddr, RtModuleList, TopMemoryAddress == 0)
+ self._RebaseModule (MapBuffer, 0x1000, SmmModuleList, AddrIsOffset=False, ModeIsSmm=True)
+ MapBuffer.append('\n\n')
+ sys.stdout.write ("\n")
+ sys.stdout.flush()
+
+ ## Save platform Map file
+ #
+ def _SaveMapFile (self, MapBuffer, Wa):
+ #
+ # Map file path is got.
+ #
+ MapFilePath = os.path.join(Wa.BuildDir, Wa.Name + '.map')
+ #
+ # Save address map into MAP file.
+ #
+ SaveFileOnChange(MapFilePath, ''.join(MapBuffer), False)
+ if self.LoadFixAddress != 0:
+ sys.stdout.write ("\nLoad Module At Fix Address Map file can be found at %s\n" % (MapFilePath))
+ sys.stdout.flush()
+
+ ## Build active platform for different build targets and different tool chains
+ #
+ def _BuildPlatform(self):
+ SaveFileOnChange(self.PlatformBuildPath, '# DO NOT EDIT \n# FILE auto-generated\n', False)
+ for BuildTarget in self.BuildTargetList:
+ GlobalData.gGlobalDefines['TARGET'] = BuildTarget
+ index = 0
+ for ToolChain in self.ToolChainList:
+ GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain
+ GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain
+ GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[index]
+ index += 1
+ Wa = WorkspaceAutoGen(
+ self.WorkspaceDir,
+ self.PlatformFile,
+ BuildTarget,
+ ToolChain,
+ self.ArchList,
+ self.BuildDatabase,
+ self.TargetTxt,
+ self.ToolDef,
+ self.Fdf,
+ self.FdList,
+ self.FvList,
+ self.CapList,
+ self.SkuId,
+ self.UniFlag,
+ self.Progress
+ )
+ self.Fdf = Wa.FdfFile
+ self.LoadFixAddress = Wa.Platform.LoadFixAddress
+ self.BuildReport.AddPlatformReport(Wa)
+ self.Progress.Stop("done!")
+
+ # Add ffs build to makefile
+ CmdListDict = {}
+ if GlobalData.gEnableGenfdsMultiThread and self.Fdf:
+ CmdListDict = self._GenFfsCmd(Wa.ArchList)
+
+ for Arch in Wa.ArchList:
+ PcdMaList = []
+ GlobalData.gGlobalDefines['ARCH'] = Arch
+ Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)
+ for Module in Pa.Platform.Modules:
+ # Get ModuleAutoGen object to generate C code file and makefile
+ Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile,Pa.DataPipe)
+ if Ma is None:
+ continue
+ if Ma.PcdIsDriver:
+ Ma.PlatformInfo = Pa
+ Ma.Workspace = Wa
+ PcdMaList.append(Ma)
+ self.BuildModules.append(Ma)
+ Pa.DataPipe.DataContainer = {"FfsCommand":CmdListDict}
+ Pa.DataPipe.DataContainer = {"Workspace_timestamp": Wa._SrcTimeStamp}
+ self._BuildPa(self.Target, Pa, FfsCommand=CmdListDict,PcdMaList=PcdMaList)
+
+ # Create MAP file when Load Fix Address is enabled.
+ if self.Target in ["", "all", "fds"]:
+ for Arch in Wa.ArchList:
+ GlobalData.gGlobalDefines['ARCH'] = Arch
+ #
+ # Check whether the set fix address is above 4G for 32bit image.
+ #
+ if (Arch == 'IA32' or Arch == 'ARM') and self.LoadFixAddress != 0xFFFFFFFFFFFFFFFF and self.LoadFixAddress >= 0x100000000:
+ EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS can't be set to larger than or equal to 4G for the platform with IA32 or ARM arch modules")
+ #
+ # Get Module List
+ #
+ ModuleList = {}
+ for Pa in Wa.AutoGenObjectList:
+ for Ma in Pa.ModuleAutoGenList:
+ if Ma is None:
+ continue
+ if not Ma.IsLibrary:
+ ModuleList[Ma.Guid.upper()] = Ma
+
+ MapBuffer = []
+ if self.LoadFixAddress != 0:
+ #
+ # Rebase module to the preferred memory address before GenFds
+ #
+ self._CollectModuleMapBuffer(MapBuffer, ModuleList)
+ if self.Fdf:
+ #
+ # create FDS again for the updated EFI image
+ #
+ self._Build("fds", Wa)
+ #
+ # Create MAP file for all platform FVs after GenFds.
+ #
+ self._CollectFvMapBuffer(MapBuffer, Wa, ModuleList)
+ #
+ # Save MAP buffer into MAP file.
+ #
+ self._SaveMapFile (MapBuffer, Wa)
+ self.CreateGuidedSectionToolsFile(Wa)
+
+ ## Build active module for different build targets, different tool chains and different archs
+ #
+ def _BuildModule(self):
+ for BuildTarget in self.BuildTargetList:
+ GlobalData.gGlobalDefines['TARGET'] = BuildTarget
+ index = 0
+ for ToolChain in self.ToolChainList:
+ WorkspaceAutoGenTime = time.time()
+ GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain
+ GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain
+ GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[index]
+ index += 1
+ #
+ # module build needs platform build information, so get platform
+ # AutoGen first
+ #
+ Wa = WorkspaceAutoGen(
+ self.WorkspaceDir,
+ self.PlatformFile,
+ BuildTarget,
+ ToolChain,
+ self.ArchList,
+ self.BuildDatabase,
+ self.TargetTxt,
+ self.ToolDef,
+ self.Fdf,
+ self.FdList,
+ self.FvList,
+ self.CapList,
+ self.SkuId,
+ self.UniFlag,
+ self.Progress,
+ self.ModuleFile
+ )
+ self.Fdf = Wa.FdfFile
+ self.LoadFixAddress = Wa.Platform.LoadFixAddress
+ Wa.CreateMakeFile(False)
+ # Add ffs build to makefile
+ CmdListDict = None
+ if GlobalData.gEnableGenfdsMultiThread and self.Fdf:
+ CmdListDict = self._GenFfsCmd(Wa.ArchList)
+
+ GlobalData.file_lock = mp.Lock()
+ GlobalData.FfsCmd = CmdListDict
+
+ self.Progress.Stop("done!")
+ MaList = []
+ ExitFlag = threading.Event()
+ ExitFlag.clear()
+ self.AutoGenTime += int(round((time.time() - WorkspaceAutoGenTime)))
+ for Arch in Wa.ArchList:
+ AutoGenStart = time.time()
+ GlobalData.gGlobalDefines['ARCH'] = Arch
+ Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)
+ for Module in Pa.Platform.Modules:
+ if self.ModuleFile.Dir == Module.Dir and self.ModuleFile.Name == Module.Name:
+ Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile,Pa.DataPipe)
+ if Ma is None:
+ continue
+ if Ma.PcdIsDriver:
+ Ma.PlatformInfo = Pa
+ Ma.Workspace = Wa
+ MaList.append(Ma)
+
+ if GlobalData.gUseHashCache and not GlobalData.gBinCacheDest and self.Target in [None, "", "all"]:
+ if Ma.CanSkipbyPreMakeCache():
+ continue
+ else:
+ self.PreMakeCacheMiss.add(Ma)
+
+ # Not to auto-gen for targets 'clean', 'cleanlib', 'cleanall', 'run', 'fds'
+ if self.Target not in ['clean', 'cleanlib', 'cleanall', 'run', 'fds']:
+ # for target which must generate AutoGen code and makefile
+ if not self.SkipAutoGen or self.Target == 'genc':
+ self.Progress.Start("Generating code")
+ Ma.CreateCodeFile(True)
+ self.Progress.Stop("done!")
+ if self.Target == "genc":
+ return True
+ if not self.SkipAutoGen or self.Target == 'genmake':
+ self.Progress.Start("Generating makefile")
+ if CmdListDict and self.Fdf and (Module.Path, Arch) in CmdListDict:
+ Ma.CreateMakeFile(True, CmdListDict[Module.Path, Arch])
+ del CmdListDict[Module.Path, Arch]
+ else:
+ Ma.CreateMakeFile(True)
+ self.Progress.Stop("done!")
+ if self.Target == "genmake":
+ return True
+
+ if GlobalData.gBinCacheSource and self.Target in [None, "", "all"]:
+ if Ma.CanSkipbyMakeCache():
+ continue
+ else:
+ self.MakeCacheMiss.add(Ma)
+
+ self.BuildModules.append(Ma)
+ self.AutoGenTime += int(round((time.time() - AutoGenStart)))
+ MakeStart = time.time()
+ for Ma in self.BuildModules:
+ if not Ma.IsBinaryModule:
+ Bt = BuildTask.New(ModuleMakeUnit(Ma, Pa.BuildCommand,self.Target))
+ # Break build if any build thread has error
+ if BuildTask.HasError():
+ # we need a full version of makefile for platform
+ ExitFlag.set()
+ BuildTask.WaitForComplete()
+ Pa.CreateMakeFile(False)
+ EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)
+ # Start task scheduler
+ if not BuildTask.IsOnGoing():
+ BuildTask.StartScheduler(self.ThreadNumber, ExitFlag)
+
+ # in case there's an interruption. we need a full version of makefile for platform
+ Pa.CreateMakeFile(False)
+ if BuildTask.HasError():
+ EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)
+ self.MakeTime += int(round((time.time() - MakeStart)))
+
+ MakeContiue = time.time()
+ ExitFlag.set()
+ BuildTask.WaitForComplete()
+ self.CreateAsBuiltInf()
+ if GlobalData.gBinCacheDest:
+ self.GenDestCache()
+ elif GlobalData.gUseHashCache and not GlobalData.gBinCacheSource:
+ # Only for --hash
+ # Update PreMakeCacheChain files
+ self.GenLocalPreMakeCache()
+ self.BuildModules = []
+ self.MakeTime += int(round((time.time() - MakeContiue)))
+ if BuildTask.HasError():
+ EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)
+
+ self.BuildReport.AddPlatformReport(Wa, MaList)
+ if MaList == []:
+ EdkLogger.error(
+ 'build',
+ BUILD_ERROR,
+ "Module for [%s] is not a component of active platform."\
+ " Please make sure that the ARCH and inf file path are"\
+ " given in the same as in [%s]" % \
+ (', '.join(Wa.ArchList), self.PlatformFile),
+ ExtraData=self.ModuleFile
+ )
+ # Create MAP file when Load Fix Address is enabled.
+ if self.Target == "fds" and self.Fdf:
+ for Arch in Wa.ArchList:
+ #
+ # Check whether the set fix address is above 4G for 32bit image.
+ #
+ if (Arch == 'IA32' or Arch == 'ARM') and self.LoadFixAddress != 0xFFFFFFFFFFFFFFFF and self.LoadFixAddress >= 0x100000000:
+ EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS can't be set to larger than or equal to 4G for the platorm with IA32 or ARM arch modules")
+ #
+ # Get Module List
+ #
+ ModuleList = {}
+ for Pa in Wa.AutoGenObjectList:
+ for Ma in Pa.ModuleAutoGenList:
+ if Ma is None:
+ continue
+ if not Ma.IsLibrary:
+ ModuleList[Ma.Guid.upper()] = Ma
+
+ MapBuffer = []
+ if self.LoadFixAddress != 0:
+ #
+ # Rebase module to the preferred memory address before GenFds
+ #
+ self._CollectModuleMapBuffer(MapBuffer, ModuleList)
+ #
+ # create FDS again for the updated EFI image
+ #
+ GenFdsStart = time.time()
+ self._Build("fds", Wa)
+ self.GenFdsTime += int(round((time.time() - GenFdsStart)))
+ #
+ # Create MAP file for all platform FVs after GenFds.
+ #
+ self._CollectFvMapBuffer(MapBuffer, Wa, ModuleList)
+ #
+ # Save MAP buffer into MAP file.
+ #
+ self._SaveMapFile (MapBuffer, Wa)
+
+ def _GenFfsCmd(self,ArchList):
+ # convert dictionary of Cmd:(Inf,Arch)
+ # to a new dictionary of (Inf,Arch):Cmd,Cmd,Cmd...
+ CmdSetDict = defaultdict(set)
+ GenFfsDict = GenFds.GenFfsMakefile('', GlobalData.gFdfParser, self, ArchList, GlobalData)
+ for Cmd in GenFfsDict:
+ tmpInf, tmpArch = GenFfsDict[Cmd]
+ CmdSetDict[tmpInf, tmpArch].add(Cmd)
+ return CmdSetDict
+ def VerifyAutoGenFiles(self):
+ AutoGenIdFile = os.path.join(GlobalData.gConfDirectory,".AutoGenIdFile.txt")
+ try:
+ with open(AutoGenIdFile) as fd:
+ lines = fd.readlines()
+ except:
+ return None
+ for line in lines:
+ if "Arch" in line:
+ ArchList = line.strip().split("=")[1].split("|")
+ if "BuildDir" in line:
+ BuildDir = line.split("=")[1].strip()
+ if "PlatformGuid" in line:
+ PlatformGuid = line.split("=")[1].strip()
+ GlobalVarList = []
+ for arch in ArchList:
+ global_var = os.path.join(BuildDir, "GlobalVar_%s_%s.bin" % (str(PlatformGuid),arch))
+ if not os.path.exists(global_var):
+ return None
+ GlobalVarList.append(global_var)
+ for global_var in GlobalVarList:
+ data_pipe = MemoryDataPipe()
+ data_pipe.load(global_var)
+ target = data_pipe.Get("P_Info").get("Target")
+ toolchain = data_pipe.Get("P_Info").get("ToolChain")
+ archlist = data_pipe.Get("P_Info").get("ArchList")
+ Arch = data_pipe.Get("P_Info").get("Arch")
+ active_p = data_pipe.Get("P_Info").get("ActivePlatform")
+ workspacedir = data_pipe.Get("P_Info").get("WorkspaceDir")
+ PackagesPath = os.getenv("PACKAGES_PATH")
+ mws.setWs(workspacedir, PackagesPath)
+ LibraryBuildDirectoryList = data_pipe.Get("LibraryBuildDirectoryList")
+ ModuleBuildDirectoryList = data_pipe.Get("ModuleBuildDirectoryList")
+
+ for m_build_dir in LibraryBuildDirectoryList:
+ if not os.path.exists(os.path.join(m_build_dir,self.MakeFileName)):
+ return None
+ for m_build_dir in ModuleBuildDirectoryList:
+ if not os.path.exists(os.path.join(m_build_dir,self.MakeFileName)):
+ return None
+ Wa = WorkSpaceInfo(
+ workspacedir,active_p,target,toolchain,archlist
+ )
+ Pa = PlatformInfo(Wa, active_p, target, toolchain, Arch,data_pipe)
+ Wa.AutoGenObjectList.append(Pa)
+ return Wa
+ def SetupMakeSetting(self,Wa):
+ BuildModules = []
+ for Pa in Wa.AutoGenObjectList:
+ for m in Pa._MbList:
+ ma = ModuleAutoGen(Wa,m.MetaFile, Pa.BuildTarget, Wa.ToolChain, Pa.Arch, Pa.MetaFile,Pa.DataPipe)
+ BuildModules.append(ma)
+ fdf_file = Wa.FlashDefinition
+ if fdf_file:
+ Fdf = FdfParser(fdf_file.Path)
+ Fdf.ParseFile()
+ GlobalData.gFdfParser = Fdf
+ if Fdf.CurrentFdName and Fdf.CurrentFdName in Fdf.Profile.FdDict:
+ FdDict = Fdf.Profile.FdDict[Fdf.CurrentFdName]
+ for FdRegion in FdDict.RegionList:
+ if str(FdRegion.RegionType) == 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):
+ if int(FdRegion.Offset) % 8 != 0:
+ EdkLogger.error("build", FORMAT_INVALID, 'The VPD Base Address %s must be 8-byte aligned.' % (FdRegion.Offset))
+ Wa.FdfProfile = Fdf.Profile
+ self.Fdf = Fdf
+ else:
+ self.Fdf = None
+ return BuildModules
+
+ ## Build a platform in multi-thread mode
+ #
+ def PerformAutoGen(self,BuildTarget,ToolChain):
+ WorkspaceAutoGenTime = time.time()
+ Wa = WorkspaceAutoGen(
+ self.WorkspaceDir,
+ self.PlatformFile,
+ BuildTarget,
+ ToolChain,
+ self.ArchList,
+ self.BuildDatabase,
+ self.TargetTxt,
+ self.ToolDef,
+ self.Fdf,
+ self.FdList,
+ self.FvList,
+ self.CapList,
+ self.SkuId,
+ self.UniFlag,
+ self.Progress
+ )
+ self.Fdf = Wa.FdfFile
+ self.LoadFixAddress = Wa.Platform.LoadFixAddress
+ self.BuildReport.AddPlatformReport(Wa)
+ Wa.CreateMakeFile(False)
+
+ # Add ffs build to makefile
+ CmdListDict = {}
+ if GlobalData.gEnableGenfdsMultiThread and self.Fdf:
+ CmdListDict = self._GenFfsCmd(Wa.ArchList)
+
+ self.AutoGenTime += int(round((time.time() - WorkspaceAutoGenTime)))
+ BuildModules = []
+ for Arch in Wa.ArchList:
+ PcdMaList = []
+ AutoGenStart = time.time()
+ GlobalData.gGlobalDefines['ARCH'] = Arch
+ Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)
+ if Pa is None:
+ continue
+ ModuleList = []
+ for Inf in Pa.Platform.Modules:
+ ModuleList.append(Inf)
+ # Add the INF only list in FDF
+ if GlobalData.gFdfParser is not None:
+ for InfName in GlobalData.gFdfParser.Profile.InfList:
+ Inf = PathClass(NormPath(InfName), self.WorkspaceDir, Arch)
+ if Inf in Pa.Platform.Modules:
+ continue
+ ModuleList.append(Inf)
+ Pa.DataPipe.DataContainer = {"FfsCommand":CmdListDict}
+ Pa.DataPipe.DataContainer = {"Workspace_timestamp": Wa._SrcTimeStamp}
+ Pa.DataPipe.DataContainer = {"CommandTarget": self.Target}
+ Pa.CreateLibModuelDirs()
+ # Fetch the MakeFileName.
+ self.MakeFileName = Pa.MakeFileName
+ if not self.MakeFileName:
+ self.MakeFileName = Pa.MakeFile
+
+ Pa.DataPipe.DataContainer = {"LibraryBuildDirectoryList":Pa.LibraryBuildDirectoryList}
+ Pa.DataPipe.DataContainer = {"ModuleBuildDirectoryList":Pa.ModuleBuildDirectoryList}
+ Pa.DataPipe.DataContainer = {"FdsCommandDict": Wa.GenFdsCommandDict}
+ # Prepare the cache share data for multiprocessing
+ Pa.DataPipe.DataContainer = {"gPlatformHashFile":GlobalData.gPlatformHashFile}
+ ModuleCodaFile = {}
+ for ma in Pa.ModuleAutoGenList:
+ ModuleCodaFile[(ma.MetaFile.File,ma.MetaFile.Root,ma.Arch,ma.MetaFile.Path)] = [item.Target for item in ma.CodaTargetList]
+ Pa.DataPipe.DataContainer = {"ModuleCodaFile":ModuleCodaFile}
+ # ModuleList contains all driver modules only
+ for Module in ModuleList:
+ # Get ModuleAutoGen object to generate C code file and makefile
+ Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile,Pa.DataPipe)
+ if Ma is None:
+ continue
+ if Ma.PcdIsDriver:
+ Ma.PlatformInfo = Pa
+ Ma.Workspace = Wa
+ PcdMaList.append(Ma)
+ self.AllDrivers.add(Ma)
+ self.AllModules.add(Ma)
+
+ mqueue = mp.Queue()
+ cqueue = mp.Queue()
+ for m in Pa.GetAllModuleInfo:
+ mqueue.put(m)
+ module_file,module_root,module_path,module_basename,\
+ module_originalpath,module_arch,IsLib = m
+ Ma = ModuleAutoGen(Wa, PathClass(module_path, Wa), BuildTarget,\
+ ToolChain, Arch, self.PlatformFile,Pa.DataPipe)
+ self.AllModules.add(Ma)
+ data_pipe_file = os.path.join(Pa.BuildDir, "GlobalVar_%s_%s.bin" % (str(Pa.Guid),Pa.Arch))
+ Pa.DataPipe.dump(data_pipe_file)
+
+ mqueue.put((None,None,None,None,None,None,None))
+ autogen_rt, errorcode = self.StartAutoGen(mqueue, Pa.DataPipe, self.SkipAutoGen, PcdMaList, cqueue)
+
+ if not autogen_rt:
+ self.AutoGenMgr.TerminateWorkers()
+ self.AutoGenMgr.join(1)
+ raise FatalError(errorcode)
+
+ if GlobalData.gUseHashCache:
+ for item in GlobalData.gModuleAllCacheStatus:
+ (MetaFilePath, Arch, CacheStr, Status) = item
+ Ma = ModuleAutoGen(Wa, PathClass(MetaFilePath, Wa), BuildTarget,\
+ ToolChain, Arch, self.PlatformFile,Pa.DataPipe)
+ if CacheStr == "PreMakeCache" and Status == False:
+ self.PreMakeCacheMiss.add(Ma)
+ if CacheStr == "PreMakeCache" and Status == True:
+ self.PreMakeCacheHit.add(Ma)
+ GlobalData.gModuleCacheHit.add(Ma)
+ if CacheStr == "MakeCache" and Status == False:
+ self.MakeCacheMiss.add(Ma)
+ if CacheStr == "MakeCache" and Status == True:
+ self.MakeCacheHit.add(Ma)
+ GlobalData.gModuleCacheHit.add(Ma)
+ self.AutoGenTime += int(round((time.time() - AutoGenStart)))
+ AutoGenIdFile = os.path.join(GlobalData.gConfDirectory,".AutoGenIdFile.txt")
+ with open(AutoGenIdFile,"w") as fw:
+ fw.write("Arch=%s\n" % "|".join((Wa.ArchList)))
+ fw.write("BuildDir=%s\n" % Wa.BuildDir)
+ fw.write("PlatformGuid=%s\n" % str(Wa.AutoGenObjectList[0].Guid))
+
+ if GlobalData.gBinCacheSource:
+ BuildModules.extend(self.MakeCacheMiss)
+ elif GlobalData.gUseHashCache and not GlobalData.gBinCacheDest:
+ BuildModules.extend(self.PreMakeCacheMiss)
+ else:
+ BuildModules.extend(self.AllDrivers)
+
+ self.Progress.Stop("done!")
+ return Wa, BuildModules
+
+ def _MultiThreadBuildPlatform(self):
+ SaveFileOnChange(self.PlatformBuildPath, '# DO NOT EDIT \n# FILE auto-generated\n', False)
+ for BuildTarget in self.BuildTargetList:
+ GlobalData.gGlobalDefines['TARGET'] = BuildTarget
+ index = 0
+ for ToolChain in self.ToolChainList:
+ resetFdsGlobalVariable()
+ GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain
+ GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain
+ GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[index]
+ index += 1
+ ExitFlag = threading.Event()
+ ExitFlag.clear()
+ if self.SkipAutoGen:
+ Wa = self.VerifyAutoGenFiles()
+ if Wa is None:
+ self.SkipAutoGen = False
+ Wa, self.BuildModules = self.PerformAutoGen(BuildTarget,ToolChain)
+ else:
+ GlobalData.gAutoGenPhase = True
+ self.BuildModules = self.SetupMakeSetting(Wa)
+ else:
+ Wa, self.BuildModules = self.PerformAutoGen(BuildTarget,ToolChain)
+ Pa = Wa.AutoGenObjectList[0]
+ GlobalData.gAutoGenPhase = False
+
+ if GlobalData.gBinCacheSource:
+ EdkLogger.quiet("[cache Summary]: Total module num: %s" % len(self.AllModules))
+ EdkLogger.quiet("[cache Summary]: PreMakecache miss num: %s " % len(self.PreMakeCacheMiss))
+ EdkLogger.quiet("[cache Summary]: Makecache miss num: %s " % len(self.MakeCacheMiss))
+
+ for Arch in Wa.ArchList:
+ MakeStart = time.time()
+ for Ma in set(self.BuildModules):
+ # Generate build task for the module
+ if not Ma.IsBinaryModule:
+ Bt = BuildTask.New(ModuleMakeUnit(Ma, Pa.BuildCommand,self.Target))
+ # Break build if any build thread has error
+ if BuildTask.HasError():
+ # we need a full version of makefile for platform
+ ExitFlag.set()
+ BuildTask.WaitForComplete()
+ Pa.CreateMakeFile(False)
+ EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)
+ # Start task scheduler
+ if not BuildTask.IsOnGoing():
+ BuildTask.StartScheduler(self.ThreadNumber, ExitFlag)
+
+ # in case there's an interruption. we need a full version of makefile for platform
+
+ if BuildTask.HasError():
+ EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)
+ self.MakeTime += int(round((time.time() - MakeStart)))
+
+ MakeContiue = time.time()
+ #
+ #
+ # All modules have been put in build tasks queue. Tell task scheduler
+ # to exit if all tasks are completed
+ #
+ ExitFlag.set()
+ BuildTask.WaitForComplete()
+ if GlobalData.gBinCacheDest:
+ self.GenDestCache()
+ elif GlobalData.gUseHashCache and not GlobalData.gBinCacheSource:
+ # Only for --hash
+ # Update PreMakeCacheChain files
+ self.GenLocalPreMakeCache()
+ #
+ # Get Module List
+ #
+ ModuleList = {ma.Guid.upper(): ma for ma in self.BuildModules}
+ self.BuildModules = []
+ self.MakeTime += int(round((time.time() - MakeContiue)))
+ #
+ # Check for build error, and raise exception if one
+ # has been signaled.
+ #
+ if BuildTask.HasError():
+ EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)
+
+ # Create MAP file when Load Fix Address is enabled.
+ if self.Target in ["", "all", "fds"]:
+ for Arch in Wa.ArchList:
+ #
+ # Check whether the set fix address is above 4G for 32bit image.
+ #
+ if (Arch == 'IA32' or Arch == 'ARM') and self.LoadFixAddress != 0xFFFFFFFFFFFFFFFF and self.LoadFixAddress >= 0x100000000:
+ EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS can't be set to larger than or equal to 4G for the platorm with IA32 or ARM arch modules")
+
+ #
+ # Rebase module to the preferred memory address before GenFds
+ #
+ MapBuffer = []
+ if self.LoadFixAddress != 0:
+ self._CollectModuleMapBuffer(MapBuffer, ModuleList)
+
+ if self.Fdf:
+ #
+ # Generate FD image if there's a FDF file found
+ #
+ GenFdsStart = time.time()
+ if GenFdsApi(Wa.GenFdsCommandDict, self.Db):
+ EdkLogger.error("build", COMMAND_FAILURE)
+ Threshold = self.GetFreeSizeThreshold()
+ if Threshold:
+ self.CheckFreeSizeThreshold(Threshold, Wa.FvDir)
+
+ #
+ # Create MAP file for all platform FVs after GenFds.
+ #
+ self._CollectFvMapBuffer(MapBuffer, Wa, ModuleList)
+ self.GenFdsTime += int(round((time.time() - GenFdsStart)))
+ #
+ # Save MAP buffer into MAP file.
+ #
+ self._SaveMapFile(MapBuffer, Wa)
+ self.CreateGuidedSectionToolsFile(Wa)
+
+ ## GetFreeSizeThreshold()
+ #
+ # @retval int Threshold value
+ #
+ def GetFreeSizeThreshold(self):
+ Threshold = None
+ Threshold_Str = GlobalData.gCommandLineDefines.get('FV_SPARE_SPACE_THRESHOLD')
+ if Threshold_Str:
+ try:
+ if Threshold_Str.lower().startswith('0x'):
+ Threshold = int(Threshold_Str, 16)
+ else:
+ Threshold = int(Threshold_Str)
+ except:
+ EdkLogger.warn("build", 'incorrect value for FV_SPARE_SPACE_THRESHOLD %s.Only decimal or hex format is allowed.' % Threshold_Str)
+ return Threshold
+
+ def CheckFreeSizeThreshold(self, Threshold=None, FvDir=None):
+ if not isinstance(Threshold, int):
+ return
+ if not isinstance(FvDir, str) or not FvDir:
+ return
+ FdfParserObject = GlobalData.gFdfParser
+ FvRegionNameList = [FvName for FvName in FdfParserObject.Profile.FvDict if FdfParserObject.Profile.FvDict[FvName].FvRegionInFD]
+ for FvName in FdfParserObject.Profile.FvDict:
+ if FvName in FvRegionNameList:
+ FvSpaceInfoFileName = os.path.join(FvDir, FvName.upper() + '.Fv.map')
+ if os.path.exists(FvSpaceInfoFileName):
+ FileLinesList = getlines(FvSpaceInfoFileName)
+ for Line in FileLinesList:
+ NameValue = Line.split('=')
+ if len(NameValue) == 2 and NameValue[0].strip() == 'EFI_FV_SPACE_SIZE':
+ FreeSizeValue = int(NameValue[1].strip(), 0)
+ if FreeSizeValue < Threshold:
+ EdkLogger.error("build", FV_FREESIZE_ERROR,
+ '%s FV free space %d is not enough to meet with the required spare space %d set by -D FV_SPARE_SPACE_THRESHOLD option.' % (
+ FvName, FreeSizeValue, Threshold))
+ break
+
+ ## Generate GuidedSectionTools.txt in the FV directories.
+ #
+ def CreateGuidedSectionToolsFile(self,Wa):
+ for BuildTarget in self.BuildTargetList:
+ for ToolChain in self.ToolChainList:
+ FvDir = Wa.FvDir
+ if not os.path.exists(FvDir):
+ continue
+
+ for Arch in self.ArchList:
+ # Build up the list of supported architectures for this build
+ prefix = '%s_%s_%s_' % (BuildTarget, ToolChain, Arch)
+
+ # Look through the tool definitions for GUIDed tools
+ guidAttribs = []
+ for (attrib, value) in self.ToolDef.ToolsDefTxtDictionary.items():
+ if attrib.upper().endswith('_GUID'):
+ split = attrib.split('_')
+ thisPrefix = '_'.join(split[0:3]) + '_'
+ if thisPrefix == prefix:
+ guid = self.ToolDef.ToolsDefTxtDictionary[attrib]
+ guid = guid.lower()
+ toolName = split[3]
+ path = '_'.join(split[0:4]) + '_PATH'
+ path = self.ToolDef.ToolsDefTxtDictionary[path]
+ path = self.GetRealPathOfTool(path)
+ guidAttribs.append((guid, toolName, path))
+
+ # Write out GuidedSecTools.txt
+ toolsFile = os.path.join(FvDir, 'GuidedSectionTools.txt')
+ toolsFile = open(toolsFile, 'wt')
+ for guidedSectionTool in guidAttribs:
+ print(' '.join(guidedSectionTool), file=toolsFile)
+ toolsFile.close()
+
+ ## Returns the real path of the tool.
+ #
+ def GetRealPathOfTool (self, tool):
+ if os.path.exists(tool):
+ return os.path.realpath(tool)
+ return tool
+
+ ## Launch the module or platform build
+ #
+ def Launch(self):
+ self.AllDrivers = set()
+ self.AllModules = set()
+ self.PreMakeCacheMiss = set()
+ self.PreMakeCacheHit = set()
+ self.MakeCacheMiss = set()
+ self.MakeCacheHit = set()
+ if not self.ModuleFile:
+ if not self.SpawnMode or self.Target not in ["", "all"]:
+ self.SpawnMode = False
+ self._BuildPlatform()
+ else:
+ self._MultiThreadBuildPlatform()
+ else:
+ self.SpawnMode = False
+ self._BuildModule()
+
+ if self.Target == 'cleanall':
+ RemoveDirectory(os.path.dirname(GlobalData.gDatabasePath), True)
+
+ def CreateAsBuiltInf(self):
+ for Module in self.BuildModules:
+ Module.CreateAsBuiltInf()
+
+ def GenDestCache(self):
+ for Module in self.AllModules:
+ Module.GenPreMakefileHashList()
+ Module.GenMakefileHashList()
+ Module.CopyModuleToCache()
+
+ def GenLocalPreMakeCache(self):
+ for Module in self.PreMakeCacheMiss:
+ Module.GenPreMakefileHashList()
+
+ ## Do some clean-up works when error occurred
+ def Relinquish(self):
+ OldLogLevel = EdkLogger.GetLevel()
+ EdkLogger.SetLevel(EdkLogger.ERROR)
+ Utils.Progressor.Abort()
+ if self.SpawnMode == True:
+ BuildTask.Abort()
+ EdkLogger.SetLevel(OldLogLevel)
+
+def ParseDefines(DefineList=[]):
+ DefineDict = {}
+ if DefineList is not None:
+ for Define in DefineList:
+ DefineTokenList = Define.split("=", 1)
+ if not GlobalData.gMacroNamePattern.match(DefineTokenList[0]):
+ EdkLogger.error('build', FORMAT_INVALID,
+ "The macro name must be in the pattern [A-Z][A-Z0-9_]*",
+ ExtraData=DefineTokenList[0])
+
+ if len(DefineTokenList) == 1:
+ DefineDict[DefineTokenList[0]] = "TRUE"
+ else:
+ DefineDict[DefineTokenList[0]] = DefineTokenList[1].strip()
+ return DefineDict
+
+
+
+def LogBuildTime(Time):
+ if Time:
+ TimeDurStr = ''
+ TimeDur = time.gmtime(Time)
+ if TimeDur.tm_yday > 1:
+ TimeDurStr = time.strftime("%H:%M:%S", TimeDur) + ", %d day(s)" % (TimeDur.tm_yday - 1)
+ else:
+ TimeDurStr = time.strftime("%H:%M:%S", TimeDur)
+ return TimeDurStr
+ else:
+ return None
+def ThreadNum():
+ OptionParser = MyOptionParser()
+ if not OptionParser.BuildOption and not OptionParser.BuildTarget:
+ OptionParser.GetOption()
+ BuildOption, BuildTarget = OptionParser.BuildOption, OptionParser.BuildTarget
+ ThreadNumber = BuildOption.ThreadNumber
+ GlobalData.gCmdConfDir = BuildOption.ConfDirectory
+ if ThreadNumber is None:
+ TargetObj = TargetTxtDict()
+ ThreadNumber = TargetObj.Target.TargetTxtDictionary[TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER]
+ if ThreadNumber == '':
+ ThreadNumber = 0
+ else:
+ ThreadNumber = int(ThreadNumber, 0)
+
+ if ThreadNumber == 0:
+ try:
+ ThreadNumber = multiprocessing.cpu_count()
+ except (ImportError, NotImplementedError):
+ ThreadNumber = 1
+ return ThreadNumber
+## Tool entrance method
+#
+# This method mainly dispatch specific methods per the command line options.
+# If no error found, return zero value so the caller of this tool can know
+# if it's executed successfully or not.
+#
+# @retval 0 Tool was successful
+# @retval 1 Tool failed
+#
+LogQMaxSize = ThreadNum() * 10
+def Main():
+ StartTime = time.time()
+
+ #
+ # Create a log Queue
+ #
+ LogQ = mp.Queue(LogQMaxSize)
+ # Initialize log system
+ EdkLogger.LogClientInitialize(LogQ)
+ GlobalData.gCommand = sys.argv[1:]
+ #
+ # Parse the options and args
+ #
+ OptionParser = MyOptionParser()
+ if not OptionParser.BuildOption and not OptionParser.BuildTarget:
+ OptionParser.GetOption()
+ Option, Target = OptionParser.BuildOption, OptionParser.BuildTarget
+ GlobalData.gOptions = Option
+ GlobalData.gCaseInsensitive = Option.CaseInsensitive
+
+ # Set log level
+ LogLevel = EdkLogger.INFO
+ if Option.verbose is not None:
+ EdkLogger.SetLevel(EdkLogger.VERBOSE)
+ LogLevel = EdkLogger.VERBOSE
+ elif Option.quiet is not None:
+ EdkLogger.SetLevel(EdkLogger.QUIET)
+ LogLevel = EdkLogger.QUIET
+ elif Option.debug is not None:
+ EdkLogger.SetLevel(Option.debug + 1)
+ LogLevel = Option.debug + 1
+ else:
+ EdkLogger.SetLevel(EdkLogger.INFO)
+
+ if Option.WarningAsError == True:
+ EdkLogger.SetWarningAsError()
+ Log_Agent = LogAgent(LogQ,LogLevel,Option.LogFile)
+ Log_Agent.start()
+
+ if platform.platform().find("Windows") >= 0:
+ GlobalData.gIsWindows = True
+ else:
+ GlobalData.gIsWindows = False
+
+ EdkLogger.quiet("Build environment: %s" % platform.platform())
+ EdkLogger.quiet(time.strftime("Build start time: %H:%M:%S, %b.%d %Y\n", time.localtime()));
+ ReturnCode = 0
+ MyBuild = None
+ BuildError = True
+ try:
+ if len(Target) == 0:
+ Target = "all"
+ elif len(Target) >= 2:
+ EdkLogger.error("build", OPTION_NOT_SUPPORTED, "More than one targets are not supported.",
+ ExtraData="Please select one of: %s" % (' '.join(gSupportedTarget)))
+ else:
+ Target = Target[0].lower()
+
+ if Target not in gSupportedTarget:
+ EdkLogger.error("build", OPTION_NOT_SUPPORTED, "Not supported target [%s]." % Target,
+ ExtraData="Please select one of: %s" % (' '.join(gSupportedTarget)))
+
+ #
+ # Check environment variable: EDK_TOOLS_PATH, WORKSPACE, PATH
+ #
+ CheckEnvVariable()
+ GlobalData.gCommandLineDefines.update(ParseDefines(Option.Macros))
+
+ Workspace = os.getenv("WORKSPACE")
+ #
+ # Get files real name in workspace dir
+ #
+ GlobalData.gAllFiles = Utils.DirCache(Workspace)
+
+ WorkingDirectory = os.getcwd()
+ if not Option.ModuleFile:
+ FileList = glob.glob(os.path.normpath(os.path.join(WorkingDirectory, '*.inf')))
+ FileNum = len(FileList)
+ if FileNum >= 2:
+ EdkLogger.error("build", OPTION_NOT_SUPPORTED, "There are %d INF files in %s." % (FileNum, WorkingDirectory),
+ ExtraData="Please use '-m <INF_FILE_PATH>' switch to choose one.")
+ elif FileNum == 1:
+ Option.ModuleFile = NormFile(FileList[0], Workspace)
+
+ if Option.ModuleFile:
+ if os.path.isabs (Option.ModuleFile):
+ if os.path.normcase (os.path.normpath(Option.ModuleFile)).find (Workspace) == 0:
+ Option.ModuleFile = NormFile(os.path.normpath(Option.ModuleFile), Workspace)
+ Option.ModuleFile = PathClass(Option.ModuleFile, Workspace)
+ ErrorCode, ErrorInfo = Option.ModuleFile.Validate(".inf", False)
+ if ErrorCode != 0:
+ EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)
+
+ if Option.PlatformFile is not None:
+ if os.path.isabs (Option.PlatformFile):
+ if os.path.normcase (os.path.normpath(Option.PlatformFile)).find (Workspace) == 0:
+ Option.PlatformFile = NormFile(os.path.normpath(Option.PlatformFile), Workspace)
+ Option.PlatformFile = PathClass(Option.PlatformFile, Workspace)
+
+ if Option.FdfFile is not None:
+ if os.path.isabs (Option.FdfFile):
+ if os.path.normcase (os.path.normpath(Option.FdfFile)).find (Workspace) == 0:
+ Option.FdfFile = NormFile(os.path.normpath(Option.FdfFile), Workspace)
+ Option.FdfFile = PathClass(Option.FdfFile, Workspace)
+ ErrorCode, ErrorInfo = Option.FdfFile.Validate(".fdf", False)
+ if ErrorCode != 0:
+ EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)
+
+ if Option.Flag is not None and Option.Flag not in ['-c', '-s']:
+ EdkLogger.error("build", OPTION_VALUE_INVALID, "UNI flag must be one of -c or -s")
+
+ MyBuild = Build(Target, Workspace, Option,LogQ)
+ GlobalData.gCommandLineDefines['ARCH'] = ' '.join(MyBuild.ArchList)
+ if not (MyBuild.LaunchPrebuildFlag and os.path.exists(MyBuild.PlatformBuildPath)):
+ MyBuild.Launch()
+
+ #
+ # All job done, no error found and no exception raised
+ #
+ BuildError = False
+ except FatalError as X:
+ if MyBuild is not None:
+ # for multi-thread build exits safely
+ MyBuild.Relinquish()
+ if Option is not None and Option.debug is not None:
+ EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
+ ReturnCode = X.args[0]
+ except Warning as X:
+ # error from Fdf parser
+ if MyBuild is not None:
+ # for multi-thread build exits safely
+ MyBuild.Relinquish()
+ if Option is not None and Option.debug is not None:
+ EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
+ else:
+ EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError=False)
+ ReturnCode = FORMAT_INVALID
+ except KeyboardInterrupt:
+ if MyBuild is not None:
+
+ # for multi-thread build exits safely
+ MyBuild.Relinquish()
+ ReturnCode = ABORT_ERROR
+ if Option is not None and Option.debug is not None:
+ EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
+ except:
+ if MyBuild is not None:
+ # for multi-thread build exits safely
+ MyBuild.Relinquish()
+
+ # try to get the meta-file from the object causing exception
+ Tb = sys.exc_info()[-1]
+ MetaFile = GlobalData.gProcessingFile
+ while Tb is not None:
+ if 'self' in Tb.tb_frame.f_locals and hasattr(Tb.tb_frame.f_locals['self'], 'MetaFile'):
+ MetaFile = Tb.tb_frame.f_locals['self'].MetaFile
+ Tb = Tb.tb_next
+ EdkLogger.error(
+ "\nbuild",
+ CODE_ERROR,
+ "Unknown fatal error when processing [%s]" % MetaFile,
+ ExtraData="\n(Please send email to %s for help, attaching following call stack trace!)\n" % MSG_EDKII_MAIL_ADDR,
+ RaiseError=False
+ )
+ EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
+ ReturnCode = CODE_ERROR
+ finally:
+ Utils.Progressor.Abort()
+ Utils.ClearDuplicatedInf()
+
+ if ReturnCode == 0:
+ try:
+ MyBuild.LaunchPostbuild()
+ Conclusion = "Done"
+ except:
+ Conclusion = "Failed"
+ elif ReturnCode == ABORT_ERROR:
+ Conclusion = "Aborted"
+ else:
+ Conclusion = "Failed"
+ FinishTime = time.time()
+ BuildDuration = time.gmtime(int(round(FinishTime - StartTime)))
+ BuildDurationStr = ""
+ if BuildDuration.tm_yday > 1:
+ BuildDurationStr = time.strftime("%H:%M:%S", BuildDuration) + ", %d day(s)" % (BuildDuration.tm_yday - 1)
+ else:
+ BuildDurationStr = time.strftime("%H:%M:%S", BuildDuration)
+ if MyBuild is not None:
+ if not BuildError:
+ MyBuild.BuildReport.GenerateReport(BuildDurationStr, LogBuildTime(MyBuild.AutoGenTime), LogBuildTime(MyBuild.MakeTime), LogBuildTime(MyBuild.GenFdsTime))
+
+ EdkLogger.SetLevel(EdkLogger.QUIET)
+ EdkLogger.quiet("\n- %s -" % Conclusion)
+ EdkLogger.quiet(time.strftime("Build end time: %H:%M:%S, %b.%d %Y", time.localtime()))
+ EdkLogger.quiet("Build total time: %s\n" % BuildDurationStr)
+ Log_Agent.kill()
+ Log_Agent.join()
+ return ReturnCode
+
+if __name__ == '__main__':
+ try:
+ mp.set_start_method('spawn')
+ except:
+ pass
+ r = Main()
+ ## 0-127 is a safe return range, and 1 is a standard default error
+ if r < 0 or r > 127: r = 1
+ sys.exit(r)
diff --git a/roms/edk2/BaseTools/Source/Python/build/buildoptions.py b/roms/edk2/BaseTools/Source/Python/build/buildoptions.py
new file mode 100644
index 000000000..094af4e2a
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/build/buildoptions.py
@@ -0,0 +1,105 @@
+## @file
+# build a platform or a module
+#
+# Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
+# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2018 - 2020, Hewlett Packard Enterprise Development, L.P.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+# Version and Copyright
+from Common.BuildVersion import gBUILD_VERSION
+from optparse import OptionParser
+VersionNumber = "0.60" + ' ' + gBUILD_VERSION
+__version__ = "%prog Version " + VersionNumber
+__copyright__ = "Copyright (c) 2007 - 2018, Intel Corporation All rights reserved."
+
+gParamCheck = []
+def SingleCheckCallback(option, opt_str, value, parser):
+ if option not in gParamCheck:
+ setattr(parser.values, option.dest, value)
+ gParamCheck.append(option)
+ else:
+ parser.error("Option %s only allows one instance in command line!" % option)
+
+
+class MyOptionParser():
+
+ def __new__(cls, *args, **kw):
+ if not hasattr(cls, '_instance'):
+ orig = super(MyOptionParser, cls)
+ cls._instance = orig.__new__(cls, *args, **kw)
+ return cls._instance
+
+ def __init__(self):
+ if not hasattr(self, 'BuildOption'):
+ self.BuildOption = None
+ if not hasattr(self, 'BuildTarget'):
+ self.BuildTarget = None
+
+ def GetOption(self):
+ Parser = OptionParser(description=__copyright__, version=__version__, prog="build.exe", usage="%prog [options] [all|fds|genc|genmake|clean|cleanall|cleanlib|modules|libraries|run]")
+ Parser.add_option("-a", "--arch", action="append", type="choice", choices=['IA32', 'X64', 'EBC', 'ARM', 'AARCH64', 'RISCV64'], dest="TargetArch",
+ help="ARCHS is one of list: IA32, X64, ARM, AARCH64, RISCV64 or EBC, which overrides target.txt's TARGET_ARCH definition. To specify more archs, please repeat this option.")
+ Parser.add_option("-p", "--platform", action="callback", type="string", dest="PlatformFile", callback=SingleCheckCallback,
+ help="Build the platform specified by the DSC file name argument, overriding target.txt's ACTIVE_PLATFORM definition.")
+ Parser.add_option("-m", "--module", action="callback", type="string", dest="ModuleFile", callback=SingleCheckCallback,
+ help="Build the module specified by the INF file name argument.")
+ Parser.add_option("-b", "--buildtarget", type="string", dest="BuildTarget", help="Using the TARGET to build the platform, overriding target.txt's TARGET definition.",
+ action="append")
+ Parser.add_option("-t", "--tagname", action="append", type="string", dest="ToolChain",
+ help="Using the Tool Chain Tagname to build the platform, overriding target.txt's TOOL_CHAIN_TAG definition.")
+ Parser.add_option("-x", "--sku-id", action="callback", type="string", dest="SkuId", callback=SingleCheckCallback,
+ help="Using this name of SKU ID to build the platform, overriding SKUID_IDENTIFIER in DSC file.")
+
+ Parser.add_option("-n", action="callback", type="int", dest="ThreadNumber", callback=SingleCheckCallback,
+ help="Build the platform using multi-threaded compiler. The value overrides target.txt's MAX_CONCURRENT_THREAD_NUMBER. When value is set to 0, tool automatically detect number of "\
+ "processor threads, set value to 1 means disable multi-thread build, and set value to more than 1 means user specify the threads number to build.")
+
+ Parser.add_option("-f", "--fdf", action="callback", type="string", dest="FdfFile", callback=SingleCheckCallback,
+ help="The name of the FDF file to use, which overrides the setting in the DSC file.")
+ Parser.add_option("-r", "--rom-image", action="append", type="string", dest="RomImage", default=[],
+ help="The name of FD to be generated. The name must be from [FD] section in FDF file.")
+ Parser.add_option("-i", "--fv-image", action="append", type="string", dest="FvImage", default=[],
+ help="The name of FV to be generated. The name must be from [FV] section in FDF file.")
+ Parser.add_option("-C", "--capsule-image", action="append", type="string", dest="CapName", default=[],
+ help="The name of Capsule to be generated. The name must be from [Capsule] section in FDF file.")
+ Parser.add_option("-u", "--skip-autogen", action="store_true", dest="SkipAutoGen", help="Skip AutoGen step.")
+ Parser.add_option("-e", "--re-parse", action="store_true", dest="Reparse", help="Re-parse all meta-data files.")
+
+ Parser.add_option("-c", "--case-insensitive", action="store_true", dest="CaseInsensitive", default=False, help="Don't check case of file name.")
+
+ Parser.add_option("-w", "--warning-as-error", action="store_true", dest="WarningAsError", help="Treat warning in tools as error.")
+ Parser.add_option("-j", "--log", action="store", dest="LogFile", help="Put log in specified file as well as on console.")
+
+ Parser.add_option("-s", "--silent", action="store_true", type=None, dest="SilentMode",
+ help="Make use of silent mode of (n)make.")
+ Parser.add_option("-q", "--quiet", action="store_true", type=None, help="Disable all messages except FATAL ERRORS.")
+ Parser.add_option("-v", "--verbose", action="store_true", type=None, help="Turn on verbose output with informational messages printed, "\
+ "including library instances selected, final dependency expression, "\
+ "and warning messages, etc.")
+ Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
+ Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".")
+
+ Parser.add_option("-y", "--report-file", action="store", dest="ReportFile", help="Create/overwrite the report to the specified filename.")
+ Parser.add_option("-Y", "--report-type", action="append", type="choice", choices=['PCD', 'LIBRARY', 'FLASH', 'DEPEX', 'BUILD_FLAGS', 'FIXED_ADDRESS', 'HASH', 'EXECUTION_ORDER'], dest="ReportType", default=[],
+ help="Flags that control the type of build report to generate. Must be one of: [PCD, LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS, HASH, EXECUTION_ORDER]. "\
+ "To specify more than one flag, repeat this option on the command line and the default flag set is [PCD, LIBRARY, FLASH, DEPEX, HASH, BUILD_FLAGS, FIXED_ADDRESS]")
+ Parser.add_option("-F", "--flag", action="store", type="string", dest="Flag",
+ help="Specify the specific option to parse EDK UNI file. Must be one of: [-c, -s]. -c is for EDK framework UNI file, and -s is for EDK UEFI UNI file. "\
+ "This option can also be specified by setting *_*_*_BUILD_FLAGS in [BuildOptions] section of platform DSC. If they are both specified, this value "\
+ "will override the setting in [BuildOptions] section of platform DSC.")
+ Parser.add_option("-N", "--no-cache", action="store_true", dest="DisableCache", default=False, help="Disable build cache mechanism")
+ Parser.add_option("--conf", action="store", type="string", dest="ConfDirectory", help="Specify the customized Conf directory.")
+ Parser.add_option("--check-usage", action="store_true", dest="CheckUsage", default=False, help="Check usage content of entries listed in INF file.")
+ Parser.add_option("--ignore-sources", action="store_true", dest="IgnoreSources", default=False, help="Focus to a binary build and ignore all source files")
+ Parser.add_option("--pcd", action="append", dest="OptionPcd", help="Set PCD value by command line. Format: \"PcdName=Value\" ")
+ Parser.add_option("-l", "--cmd-len", action="store", type="int", dest="CommandLength", help="Specify the maximum line length of build command. Default is 4096.")
+ Parser.add_option("--hash", action="store_true", dest="UseHashCache", default=False, help="Enable hash-based caching during build process.")
+ Parser.add_option("--binary-destination", action="store", type="string", dest="BinCacheDest", help="Generate a cache of binary files in the specified directory.")
+ Parser.add_option("--binary-source", action="store", type="string", dest="BinCacheSource", help="Consume a cache of binary files from the specified directory.")
+ Parser.add_option("--genfds-multi-thread", action="store_true", dest="GenfdsMultiThread", default=True, help="Enable GenFds multi thread to generate ffs file.")
+ Parser.add_option("--no-genfds-multi-thread", action="store_true", dest="NoGenfdsMultiThread", default=False, help="Disable GenFds multi thread to generate ffs file.")
+ Parser.add_option("--disable-include-path-check", action="store_true", dest="DisableIncludePathCheck", default=False, help="Disable the include path check for outside of package.")
+ self.BuildOption, self.BuildTarget = Parser.parse_args()
diff --git a/roms/edk2/BaseTools/Source/Python/sitecustomize.py b/roms/edk2/BaseTools/Source/Python/sitecustomize.py
new file mode 100644
index 000000000..50783e1b3
--- /dev/null
+++ b/roms/edk2/BaseTools/Source/Python/sitecustomize.py
@@ -0,0 +1,15 @@
+## @file
+#
+#
+# Copyright (c) 2009 - 2014, Apple Inc. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+import sys
+import locale
+
+if sys.platform == "darwin" and sys.version_info[0] < 3:
+ DefaultLocal = locale.getdefaultlocale()[1]
+ if DefaultLocal is None:
+ DefaultLocal = 'UTF8'
+ sys.setdefaultencoding(DefaultLocal)
+
diff --git a/roms/edk2/BaseTools/Tests/CToolsTests.py b/roms/edk2/BaseTools/Tests/CToolsTests.py
new file mode 100644
index 000000000..2bc1b62d4
--- /dev/null
+++ b/roms/edk2/BaseTools/Tests/CToolsTests.py
@@ -0,0 +1,29 @@
+## @file
+# Unit tests for C based BaseTools
+#
+# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+import os
+import sys
+import unittest
+
+import TianoCompress
+modules = (
+ TianoCompress,
+ )
+
+
+def TheTestSuite():
+ suites = list(map(lambda module: module.TheTestSuite(), modules))
+ return unittest.TestSuite(suites)
+
+if __name__ == '__main__':
+ allTests = TheTestSuite()
+ unittest.TextTestRunner().run(allTests)
+
diff --git a/roms/edk2/BaseTools/Tests/CheckPythonSyntax.py b/roms/edk2/BaseTools/Tests/CheckPythonSyntax.py
new file mode 100644
index 000000000..099920721
--- /dev/null
+++ b/roms/edk2/BaseTools/Tests/CheckPythonSyntax.py
@@ -0,0 +1,68 @@
+## @file
+# Unit tests for checking syntax of Python source code
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+import os
+import unittest
+import py_compile
+
+import TestTools
+
+class Tests(TestTools.BaseToolsTest):
+
+ def setUp(self):
+ TestTools.BaseToolsTest.setUp(self)
+
+ def SingleFileTest(self, filename):
+ try:
+ py_compile.compile(filename, doraise=True)
+ except Exception as e:
+ self.fail('syntax error: %s, Error is %s' % (filename, str(e)))
+
+def MakePythonSyntaxCheckTests():
+ def GetAllPythonSourceFiles():
+ pythonSourceFiles = []
+ for (root, dirs, files) in os.walk(TestTools.PythonSourceDir):
+ for filename in files:
+ if filename.lower().endswith('.py'):
+ pythonSourceFiles.append(
+ os.path.join(root, filename)
+ )
+ return pythonSourceFiles
+
+ def MakeTestName(filename):
+ assert filename.lower().endswith('.py')
+ name = filename[:-3]
+ name = name.replace(TestTools.PythonSourceDir, '')
+ name = name.replace(os.path.sep, '_')
+ return 'test' + name
+
+ def MakeNewTest(filename):
+ test = MakeTestName(filename)
+ newmethod = lambda self: self.SingleFileTest(filename)
+ setattr(
+ Tests,
+ test,
+ newmethod
+ )
+
+ for filename in GetAllPythonSourceFiles():
+ MakeNewTest(filename)
+
+MakePythonSyntaxCheckTests()
+del MakePythonSyntaxCheckTests
+
+TheTestSuite = TestTools.MakeTheTestSuite(locals())
+
+if __name__ == '__main__':
+ allTests = TheTestSuite()
+ unittest.TextTestRunner().run(allTests)
+
+
diff --git a/roms/edk2/BaseTools/Tests/CheckUnicodeSourceFiles.py b/roms/edk2/BaseTools/Tests/CheckUnicodeSourceFiles.py
new file mode 100644
index 000000000..150240261
--- /dev/null
+++ b/roms/edk2/BaseTools/Tests/CheckUnicodeSourceFiles.py
@@ -0,0 +1,175 @@
+## @file
+# Unit tests for AutoGen.UniClassObject
+#
+# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+import os
+import unittest
+
+import codecs
+
+import TestTools
+
+from Common.Misc import PathClass
+import AutoGen.UniClassObject as BtUni
+
+from Common import EdkLogger
+EdkLogger.InitializeForUnitTest()
+
+class Tests(TestTools.BaseToolsTest):
+
+ SampleData = u'''
+ #langdef en-US "English"
+ #string STR_A #language en-US "STR_A for en-US"
+ '''
+
+ def EncodeToFile(self, encoding, string=None):
+ if string is None:
+ string = self.SampleData
+ if encoding is not None:
+ data = codecs.encode(string, encoding)
+ else:
+ data = string
+ path = 'input.uni'
+ self.WriteTmpFile(path, data)
+ return PathClass(self.GetTmpFilePath(path))
+
+ def ErrorFailure(self, error, encoding, shouldPass):
+ msg = error + ' should '
+ if shouldPass:
+ msg += 'not '
+ msg += 'be generated for '
+ msg += '%s data in a .uni file' % encoding
+ self.fail(msg)
+
+ def UnicodeErrorFailure(self, encoding, shouldPass):
+ self.ErrorFailure('UnicodeError', encoding, shouldPass)
+
+ def EdkErrorFailure(self, encoding, shouldPass):
+ self.ErrorFailure('EdkLogger.FatalError', encoding, shouldPass)
+
+ def CheckFile(self, encoding, shouldPass, string=None):
+ path = self.EncodeToFile(encoding, string)
+ try:
+ BtUni.UniFileClassObject([path])
+ if shouldPass:
+ return
+ except UnicodeError:
+ if not shouldPass:
+ return
+ else:
+ self.UnicodeErrorFailure(encoding, shouldPass)
+ except EdkLogger.FatalError:
+ if not shouldPass:
+ return
+ else:
+ self.EdkErrorFailure(encoding, shouldPass)
+ except Exception:
+ pass
+
+ self.EdkErrorFailure(encoding, shouldPass)
+
+ def testUtf16InUniFile(self):
+ self.CheckFile('utf_16', shouldPass=True)
+
+ def testSupplementaryPlaneUnicodeCharInUtf16File(self):
+ #
+ # Supplementary Plane characters can exist in UTF-16 files,
+ # but they are not valid UCS-2 characters.
+ #
+ # This test makes sure that BaseTools rejects these characters
+ # if seen in a .uni file.
+ #
+ data = u'''
+ #langdef en-US "English"
+ #string STR_A #language en-US "CodePoint (\U00010300) > 0xFFFF"
+ '''
+
+ self.CheckFile('utf_16', shouldPass=False, string=data)
+
+ def testSurrogatePairUnicodeCharInUtf16File(self):
+ #
+ # Surrogate Pair code points are used in UTF-16 files to
+ # encode the Supplementary Plane characters. But, a Surrogate
+ # Pair code point which is not followed by another Surrogate
+ # Pair code point might be interpreted as a single code point
+ # with the Surrogate Pair code point.
+ #
+ # This test makes sure that BaseTools rejects these characters
+ # if seen in a .uni file.
+ #
+ data = codecs.BOM_UTF16_LE + b'//\x01\xd8 '
+
+ self.CheckFile(encoding=None, shouldPass=False, string=data)
+
+ def testValidUtf8File(self):
+ self.CheckFile(encoding='utf_8', shouldPass=True)
+
+ def testValidUtf8FileWithBom(self):
+ #
+ # Same test as testValidUtf8File, but add the UTF-8 BOM
+ #
+ data = codecs.BOM_UTF8 + codecs.encode(self.SampleData, 'utf_8')
+
+ self.CheckFile(encoding=None, shouldPass=True, string=data)
+
+ def test32bitUnicodeCharInUtf8File(self):
+ data = u'''
+ #langdef en-US "English"
+ #string STR_A #language en-US "CodePoint (\U00010300) > 0xFFFF"
+ '''
+
+ self.CheckFile('utf_16', shouldPass=False, string=data)
+
+ def test32bitUnicodeCharInUtf8File(self):
+ data = u'''
+ #langdef en-US "English"
+ #string STR_A #language en-US "CodePoint (\U00010300) > 0xFFFF"
+ '''
+
+ self.CheckFile('utf_8', shouldPass=False, string=data)
+
+ def test32bitUnicodeCharInUtf8Comment(self):
+ data = u'''
+ // Even in comments, we reject non-UCS-2 chars: \U00010300
+ #langdef en-US "English"
+ #string STR_A #language en-US "A"
+ '''
+
+ self.CheckFile('utf_8', shouldPass=False, string=data)
+
+ def testSurrogatePairUnicodeCharInUtf8File(self):
+ #
+ # Surrogate Pair code points are used in UTF-16 files to
+ # encode the Supplementary Plane characters. In UTF-8, it is
+ # trivial to encode these code points, but they are not valid
+ # code points for characters, since they are reserved for the
+ # UTF-16 Surrogate Pairs.
+ #
+ # This test makes sure that BaseTools rejects these characters
+ # if seen in a .uni file.
+ #
+ data = b'\xed\xa0\x81'
+
+ self.CheckFile(encoding=None, shouldPass=False, string=data)
+
+ def testSurrogatePairUnicodeCharInUtf8FileWithBom(self):
+ #
+ # Same test as testSurrogatePairUnicodeCharInUtf8File, but add
+ # the UTF-8 BOM
+ #
+ data = codecs.BOM_UTF8 + b'\xed\xa0\x81'
+
+ self.CheckFile(encoding=None, shouldPass=False, string=data)
+
+TheTestSuite = TestTools.MakeTheTestSuite(locals())
+
+if __name__ == '__main__':
+ allTests = TheTestSuite()
+ unittest.TextTestRunner().run(allTests)
diff --git a/roms/edk2/BaseTools/Tests/GNUmakefile b/roms/edk2/BaseTools/Tests/GNUmakefile
new file mode 100644
index 000000000..1cb77f84b
--- /dev/null
+++ b/roms/edk2/BaseTools/Tests/GNUmakefile
@@ -0,0 +1,15 @@
+## @file
+# GNU/Linux makefile for 'Tests' module build.
+#
+# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+all: test
+
+test:
+ @if command -v $(PYTHON_COMMAND) >/dev/null 1; then $(PYTHON_COMMAND) RunTests.py; else python RunTests.py; fi
+
+clean:
+ find . -name '*.pyc' -exec rm '{}' ';'
+
diff --git a/roms/edk2/BaseTools/Tests/PythonTest.py b/roms/edk2/BaseTools/Tests/PythonTest.py
new file mode 100644
index 000000000..ec44c7947
--- /dev/null
+++ b/roms/edk2/BaseTools/Tests/PythonTest.py
@@ -0,0 +1,9 @@
+## @file
+# Test whether PYTHON_COMMAND is available
+#
+# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+if __name__ == '__main__':
+ print('TRUE')
diff --git a/roms/edk2/BaseTools/Tests/PythonToolsTests.py b/roms/edk2/BaseTools/Tests/PythonToolsTests.py
new file mode 100644
index 000000000..05b27ab03
--- /dev/null
+++ b/roms/edk2/BaseTools/Tests/PythonToolsTests.py
@@ -0,0 +1,28 @@
+## @file
+# Unit tests for Python based BaseTools
+#
+# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+import os
+import sys
+import unittest
+
+
+def TheTestSuite():
+ suites = []
+ import CheckPythonSyntax
+ suites.append(CheckPythonSyntax.TheTestSuite())
+ import CheckUnicodeSourceFiles
+ suites.append(CheckUnicodeSourceFiles.TheTestSuite())
+ return unittest.TestSuite(suites)
+
+if __name__ == '__main__':
+ allTests = TheTestSuite()
+ unittest.TextTestRunner().run(allTests)
+
diff --git a/roms/edk2/BaseTools/Tests/RunTests.py b/roms/edk2/BaseTools/Tests/RunTests.py
new file mode 100644
index 000000000..81af736cd
--- /dev/null
+++ b/roms/edk2/BaseTools/Tests/RunTests.py
@@ -0,0 +1,39 @@
+## @file
+# Unit tests for BaseTools utilities
+#
+# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+import os
+import sys
+import unittest
+
+try:
+ import distutils.util
+except ModuleNotFoundError:
+ sys.exit('''
+Python reported: "No module named 'distutils.util"
+''')
+
+import TestTools
+
+def GetCTestSuite():
+ import CToolsTests
+ return CToolsTests.TheTestSuite()
+
+def GetPythonTestSuite():
+ import PythonToolsTests
+ return PythonToolsTests.TheTestSuite()
+
+def GetAllTestsSuite():
+ return unittest.TestSuite([GetCTestSuite(), GetPythonTestSuite()])
+
+if __name__ == '__main__':
+ allTests = GetAllTestsSuite()
+ unittest.TextTestRunner(verbosity=2).run(allTests)
+
diff --git a/roms/edk2/BaseTools/Tests/TestRegularExpression.py b/roms/edk2/BaseTools/Tests/TestRegularExpression.py
new file mode 100644
index 000000000..3e6c5f446
--- /dev/null
+++ b/roms/edk2/BaseTools/Tests/TestRegularExpression.py
@@ -0,0 +1,48 @@
+## @file
+# Routines for generating Pcd Database
+#
+# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+
+import unittest
+from Common.Misc import RemoveCComments
+from Workspace.BuildClassObject import ArrayIndex
+
+class TestRe(unittest.TestCase):
+ def test_ccomments(self):
+ TestStr1 = """ {0x01,0x02} """
+ self.assertEquals(TestStr1, RemoveCComments(TestStr1))
+
+ TestStr2 = """ L'TestString' """
+ self.assertEquals(TestStr2, RemoveCComments(TestStr2))
+
+ TestStr3 = """ 'TestString' """
+ self.assertEquals(TestStr3, RemoveCComments(TestStr3))
+
+ TestStr4 = """
+ {CODE({
+ {0x01, {0x02, 0x03, 0x04 }},// Data comment
+ {0x01, {0x02, 0x03, 0x04 }},// Data comment
+ })
+ } /*
+ This is multiple line comments
+ The seconde line comment
+ */
+ // This is a comment
+ """
+ Expect_TestStr4 = """{CODE({
+ {0x01, {0x02, 0x03, 0x04 }},
+ {0x01, {0x02, 0x03, 0x04 }},
+ })
+ }"""
+ self.assertEquals(Expect_TestStr4, RemoveCComments(TestStr4).strip())
+
+ def Test_ArrayIndex(self):
+ TestStr1 = """[1]"""
+ self.assertEquals(['[1]'], ArrayIndex.findall(TestStr1))
+
+ TestStr2 = """[1][2][0x1][0x01][]"""
+ self.assertEquals(['[1]','[2]','[0x1]','[0x01]','[]'], ArrayIndex.findall(TestStr2))
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/roms/edk2/BaseTools/Tests/TestTools.py b/roms/edk2/BaseTools/Tests/TestTools.py
new file mode 100644
index 000000000..1099fd4ee
--- /dev/null
+++ b/roms/edk2/BaseTools/Tests/TestTools.py
@@ -0,0 +1,184 @@
+from __future__ import print_function
+## @file
+# Utility functions and classes for BaseTools unit tests
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+import base64
+import os
+import os.path
+import random
+import shutil
+import subprocess
+import sys
+import unittest
+import codecs
+
+TestsDir = os.path.realpath(os.path.split(sys.argv[0])[0])
+BaseToolsDir = os.path.realpath(os.path.join(TestsDir, '..'))
+CSourceDir = os.path.join(BaseToolsDir, 'Source', 'C')
+PythonSourceDir = os.path.join(BaseToolsDir, 'Source', 'Python')
+TestTempDir = os.path.join(TestsDir, 'TestTempDir')
+
+if PythonSourceDir not in sys.path:
+ #
+ # Allow unit tests to import BaseTools python modules. This is very useful
+ # for writing unit tests.
+ #
+ sys.path.append(PythonSourceDir)
+
+def MakeTheTestSuite(localItems):
+ tests = []
+ for name, item in localItems.items():
+ if isinstance(item, type):
+ if issubclass(item, unittest.TestCase):
+ tests.append(unittest.TestLoader().loadTestsFromTestCase(item))
+ elif issubclass(item, unittest.TestSuite):
+ tests.append(item())
+ return lambda: unittest.TestSuite(tests)
+
+def GetBaseToolsPaths():
+ if sys.platform in ('win32', 'win64'):
+ return [ os.path.join(BaseToolsDir, 'Bin', sys.platform.title()) ]
+ else:
+ uname = os.popen('uname -sm').read().strip()
+ for char in (' ', '/'):
+ uname = uname.replace(char, '-')
+ return [
+ os.path.join(BaseToolsDir, 'Bin', uname),
+ os.path.join(BaseToolsDir, 'BinWrappers', uname),
+ os.path.join(BaseToolsDir, 'BinWrappers', 'PosixLike')
+ ]
+
+BaseToolsBinPaths = GetBaseToolsPaths()
+
+class BaseToolsTest(unittest.TestCase):
+
+ def cleanOutDir(self, dir):
+ for dirItem in os.listdir(dir):
+ if dirItem in ('.', '..'): continue
+ dirItem = os.path.join(dir, dirItem)
+ self.RemoveFileOrDir(dirItem)
+
+ def CleanUpTmpDir(self):
+ if os.path.exists(self.testDir):
+ self.cleanOutDir(self.testDir)
+
+ def HandleTreeDeleteError(self, function, path, excinfo):
+ os.chmod(path, stat.S_IWRITE)
+ function(path)
+
+ def RemoveDir(self, dir):
+ shutil.rmtree(dir, False, self.HandleTreeDeleteError)
+
+ def RemoveFileOrDir(self, path):
+ if not os.path.exists(path):
+ return
+ elif os.path.isdir(path):
+ self.RemoveDir(path)
+ else:
+ os.remove(path)
+
+ def DisplayBinaryData(self, description, data):
+ print(description, '(base64 encoded):')
+ b64data = base64.b64encode(data)
+ print(b64data)
+
+ def DisplayFile(self, fileName):
+ sys.stdout.write(self.ReadTmpFile(fileName))
+ sys.stdout.flush()
+
+ def FindToolBin(self, toolName):
+ for binPath in BaseToolsBinPaths:
+ bin = os.path.join(binPath, toolName)
+ if os.path.exists(bin):
+ break
+ assert os.path.exists(bin)
+ return bin
+
+ def RunTool(self, *args, **kwd):
+ if 'toolName' in kwd: toolName = kwd['toolName']
+ else: toolName = None
+ if 'logFile' in kwd: logFile = kwd['logFile']
+ else: logFile = None
+
+ if toolName is None: toolName = self.toolName
+ bin = self.FindToolBin(toolName)
+ if logFile is not None:
+ logFile = open(os.path.join(self.testDir, logFile), 'w')
+ popenOut = logFile
+ else:
+ popenOut = subprocess.PIPE
+
+ args = [toolName] + list(args)
+
+ Proc = subprocess.Popen(
+ args, executable=bin,
+ stdout=popenOut, stderr=subprocess.STDOUT
+ )
+
+ if logFile is None:
+ Proc.stdout.read()
+
+ return Proc.wait()
+
+ def GetTmpFilePath(self, fileName):
+ return os.path.join(self.testDir, fileName)
+
+ def OpenTmpFile(self, fileName, mode = 'r'):
+ return open(os.path.join(self.testDir, fileName), mode)
+
+ def ReadTmpFile(self, fileName):
+ f = open(self.GetTmpFilePath(fileName), 'r')
+ data = f.read()
+ f.close()
+ return data
+
+ def WriteTmpFile(self, fileName, data):
+ if isinstance(data, bytes):
+ with open(self.GetTmpFilePath(fileName), 'wb') as f:
+ f.write(data)
+ else:
+ with codecs.open(self.GetTmpFilePath(fileName), 'w', encoding='utf-8') as f:
+ f.write(data)
+
+ def GenRandomFileData(self, fileName, minlen = None, maxlen = None):
+ if maxlen is None: maxlen = minlen
+ f = self.OpenTmpFile(fileName, 'w')
+ f.write(self.GetRandomString(minlen, maxlen))
+ f.close()
+
+ def GetRandomString(self, minlen = None, maxlen = None):
+ if minlen is None: minlen = 1024
+ if maxlen is None: maxlen = minlen
+ return ''.join(
+ [chr(random.randint(0, 255))
+ for x in range(random.randint(minlen, maxlen))
+ ])
+
+ def setUp(self):
+ self.savedEnvPath = os.environ['PATH']
+ self.savedSysPath = sys.path[:]
+
+ for binPath in BaseToolsBinPaths:
+ os.environ['PATH'] = \
+ os.path.pathsep.join((os.environ['PATH'], binPath))
+
+ self.testDir = TestTempDir
+ if not os.path.exists(self.testDir):
+ os.mkdir(self.testDir)
+ else:
+ self.cleanOutDir(self.testDir)
+
+ def tearDown(self):
+ self.RemoveFileOrDir(self.testDir)
+
+ os.environ['PATH'] = self.savedEnvPath
+ sys.path = self.savedSysPath
+
diff --git a/roms/edk2/BaseTools/Tests/TianoCompress.py b/roms/edk2/BaseTools/Tests/TianoCompress.py
new file mode 100644
index 000000000..685968b18
--- /dev/null
+++ b/roms/edk2/BaseTools/Tests/TianoCompress.py
@@ -0,0 +1,69 @@
+## @file
+# Unit tests for TianoCompress utility
+#
+# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+##
+# Import Modules
+#
+from __future__ import print_function
+import os
+import random
+import sys
+import unittest
+
+import TestTools
+
+class Tests(TestTools.BaseToolsTest):
+
+ def setUp(self):
+ TestTools.BaseToolsTest.setUp(self)
+ self.toolName = 'TianoCompress'
+
+ def testHelp(self):
+ result = self.RunTool('--help', logFile='help')
+ #self.DisplayFile('help')
+ self.assertTrue(result == 0)
+
+ def compressionTestCycle(self, data):
+ path = self.GetTmpFilePath('input')
+ self.WriteTmpFile('input', data)
+ result = self.RunTool(
+ '-e',
+ '-o', self.GetTmpFilePath('output1'),
+ self.GetTmpFilePath('input')
+ )
+ self.assertTrue(result == 0)
+ result = self.RunTool(
+ '-d',
+ '-o', self.GetTmpFilePath('output2'),
+ self.GetTmpFilePath('output1')
+ )
+ self.assertTrue(result == 0)
+ start = self.ReadTmpFile('input')
+ finish = self.ReadTmpFile('output2')
+ startEqualsFinish = start == finish
+ if not startEqualsFinish:
+ print()
+ print('Original data did not match decompress(compress(data))')
+ self.DisplayBinaryData('original data', start)
+ self.DisplayBinaryData('after compression', self.ReadTmpFile('output1'))
+ self.DisplayBinaryData('after decompression', finish)
+ self.assertTrue(startEqualsFinish)
+
+ def testRandomDataCycles(self):
+ for i in range(8):
+ data = self.GetRandomString(1024, 2048)
+ self.compressionTestCycle(data)
+ self.CleanUpTmpDir()
+
+TheTestSuite = TestTools.MakeTheTestSuite(locals())
+
+if __name__ == '__main__':
+ allTests = TheTestSuite()
+ unittest.TextTestRunner().run(allTests)
+
+
diff --git a/roms/edk2/BaseTools/UserManuals/Build_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/Build_Utility_Man_Page.rtf
new file mode 100644
index 000000000..4b8f78abd
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/Build_Utility_Man_Page.rtf
@@ -0,0 +1,495 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch13\stshfloch37\stshfhich37\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}{\f40\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}
+{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}
+{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f257\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\f258\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f260\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\f261\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\f262\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f263\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\f264\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\f265\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f277\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}
+{\f278\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}{\f280\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f281\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}
+{\f282\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}{\f283\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f284\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}
+{\f285\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}{\f389\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f597\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}
+{\f598\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f600\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f601\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f604\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}
+{\f605\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f627\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\f628\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\f630\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\f631\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}{\f634\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}
+{\f635\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}{\f647\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f648\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}
+{\f650\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}{\f651\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f652\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}
+{\f653\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}{\f654\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f655\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}
+{\f656\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}{\f657\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\f658\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\f660\fbidi \froman\fcharset161\fprq2 Cambria Greek;}
+{\f661\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\f664\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\f665\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\f667\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}
+{\f668\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f670\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}{\f671\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}{\f674\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}
+{\f675\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f687\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}{\f688\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}
+{\f690\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}{\f694\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}
+{\f695\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1389\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}
+{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}
+{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}
+{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}
+{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}
+{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}
+{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;\red201\green128\blue43;}{\*\defchp \fs21\kerning2\loch\af37\hich\af37\dbch\af13 }{\*\defpap
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\f37\hich\af37\dbch\af13\cgrid\langnp1033\langfenp2052
+\snext11 \ssemihidden \sunhideused Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f40\hich\af40\dbch\af13 \sbasedon10 \slink1 \slocked Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\ai\af0\afs28
+\ltrch\fcs0 \b\i\fs28\loch\f40\hich\af40\dbch\af13 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\*\cs17 \additive \rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \fs16 \sbasedon10 \ssemihidden \styrsid16534634 annotation reference;}{
+\s18\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext18 \slink19 \ssemihidden \styrsid16534634
+annotation text;}{\*\cs19 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \f43 \sbasedon10 \slink18 \slocked \ssemihidden \styrsid16534634 Comment Text Char;}{\s20\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs20\alang1025
+\ltrch\fcs0 \b\fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon18 \snext18 \slink21 \ssemihidden \styrsid16534634 annotation subject;}{\*\cs21 \additive \rtlch\fcs1 \ab\af0 \ltrch\fcs0 \b\f43
+\sbasedon19 \slink20 \slocked \ssemihidden \styrsid16534634 Comment Subject Char;}{\s22\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0
+\fs16\lang1033\langfe1033\loch\f39\hich\af39\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext22 \slink23 \ssemihidden \styrsid16534634 Balloon Text;}{\*\cs23 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \f39\fs16
+\sbasedon10 \slink22 \slocked \ssemihidden \styrsid16534634 Balloon Text Char;}{\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0
+\fs16\cf1\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext24 \styrsid14971029 CellBodyLeft;}{\*\cs25 \additive \b\f2\cf13 \styrsid14971029 CodeCharacter;}{\*\ts26\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl
+\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f37\hich\af37\dbch\af13\cgrid\langnp1033\langfenp2052 \sbasedon11 \snext26 \styrsid14971029
+Table Grid;}}{\*\revtbl {Unknown;}{Zhu, Yonghong;}{yzeng15;}}{\*\rsidtbl \rsid1063253\rsid1211840\rsid1381256\rsid1839752\rsid2178333\rsid2442797\rsid2694053\rsid2974720\rsid3478286\rsid4338091\rsid4590013\rsid4999604\rsid5116989\rsid5911148\rsid6164334\rsid6375506\rsid6492146\rsid6561745
+\rsid6579891\rsid6637302\rsid6827362\rsid7278947\rsid7479872\rsid7820891\rsid8023663\rsid8081890\rsid8600807\rsid8996461\rsid9010967\rsid10121491\rsid10756011\rsid10894100\rsid10897639\rsid11224689\rsid11413092\rsid11427337\rsid11689747\rsid12155946
+\rsid12210198\rsid13245303\rsid13716787\rsid14971029\rsid15538292\rsid15612145\rsid16533044\rsid16534634}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info
+{\operator Zhu, Yonghong}{\creatim\yr2010\mo10\dy6\hr13\min22}{\revtim\yr2016\mo8\dy9\hr10\min21}{\version34}{\edmins162}{\nofpages5}{\nofwords1256}{\nofchars7164}{\nofcharsws8404}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word
+/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot1211840 \donotshowmarkup1\fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1
+\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang
+{\pntxta \hich )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}
+{\pntxta \hich )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0
+\keep\keepn\nowidctlpar\tx360\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Build.exe \hich\f43 \endash \loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1063253 \hich\af43\dbch\af13\loch\f43 is }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 the master command that provides }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1063253 \hich\af43\dbch\af13\loch\f43 developers}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 with a single command for selecting various options of a build
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Build.exe }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2442797 \hich\af43\dbch\af13\loch\f43
+[-v | -q | -d] [-a <Arch>] [-p <DscFile>] [-m <InfFile>] [-b <Target>] [-t <TagName>] [-f FdfFile] [-r <RomImageName>] [-i <FvImageName>] }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid15612145
+\hich\af43\dbch\af13\loch\f43 [-C <Cap}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8023663 \hich\af43\dbch\af13\loch\f43 sule}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid15612145 \hich\af43\dbch\af13\loch\f43 ImageName>] }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2442797 \hich\af43\dbch\af13\loch\f43
+[-n ThreadNum] [-x <SkuId>] [-u] [-e] [-w] [-j <LogFile>] [-s] [-D <MACROS>] [-y <ReportFile>]\hich\af43\dbch\af13\loch\f43 [-Y <ReportType>] [-F <Flags>]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1731990500\langfenp2052\insrsid11413092 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1731990499\langfenp2052\insrsid10756011 \hich\af43\dbch\af13\loch\f43 [}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1731990499\langfenp2052\insrsid10756011\charrsid11689747 \hich\af43\dbch\af13\loch\f43 --ignore-sources}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1731990499\langfenp2052\insrsid10756011 \hich\af43\dbch\af13\loch\f43 ] [}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1731990499\langfenp2052\insrsid10756011\charrsid10894100 \hich\af43\dbch\af13\loch\f43 --check-usage}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1731990499\langfenp2052\insrsid10756011 \hich\af43\dbch\af13\loch\f43 ]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\deleted\fs18\cf1\lang1033\langfe2052\revauthdel1\revdttmdel1731990499\langfenp2052\insrsid2442797\delrsid10756011 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 [}{
+\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2442797 \hich\af43\dbch\af13\loch\f43 All | GenC | GenMake | Fds | Libraries | Modules | Clean | CleanAll | CleanLib | run}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 ]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11224689
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid13716787 \hich\af43\dbch\af13\loch\f43 Build.exe}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13716787 \hich\af43\dbch\af13\loch\f43 \hich\f43
+\endash \loch\f43 h
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid13716787 \hich\af43\dbch\af13\loch\f43 Build.exe}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13716787 \hich\af43\dbch\af13\loch\f43 --version}{
+\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13716787\charrsid13716787
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Build.exe is the master command line (CLI) tool that provides a single command for selecting various }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9010967
+\hich\af43\dbch\af13\loch\f43 build options}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 . In general, it checks the environment variables, gets the user\hich\f43 \rquote \loch\f43
+s configuration from either the CLI or target.txt, parses the dsc, dec, inf, \hich\af43\dbch\af13\loch\f43
+target.txt, tools_def.txt, generates .C, .H files and the Makefiles for one or more modules and/or the active platform, calls a make (NMake or make) program to process these Makefiles, then optionally calls GenFds to generate an fd file.
+\par \hich\af43\dbch\af13\loch\f43 The build tool sup\hich\af43\dbch\af13\loch\f43 ports two kinds of path specifications on command line - an absolutely path or a relative (to the WORKSPACE environment variable) path \hich\f43 \endash \loch\f43
+ in command line.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Options
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 There are no required options. }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11427337 \hich\af43\dbch\af13\loch\f43
+If no options are specified, it uses options specified in targe\hich\af43\dbch\af13\loch\f43 t.txt.}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11224689
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -a, --arch <ARCH>
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 ARCH is one of }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2974720
+\hich\af43\dbch\af13\loch\f43 a }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 list: IA32, X64, IPF or EBC, which overrides }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2974720
+\hich\af43\dbch\af13\loch\f43 the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 target.txt's TARGET_ARCH definition. To specify }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1063253
+\hich\af43\dbch\af13\loch\f43 another }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 ARCH, repeat this option.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -p, --platform PlatformName.dsc
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Build}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6164334
+\hich\af43\dbch\af13\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 the platform specified by the DSC file}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9010967
+\hich\af43\dbch\af13\loch\f43 . }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1063253 \hich\af43\dbch\af13\loch\f43 The}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 name argument, overrides }{
+\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1063253 \hich\af43\dbch\af13\loch\f43 the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 target.txt's ACTIVE_PLATFORM definition.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -m, --module ModuleName.inf
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Build}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6164334
+\hich\af43\dbch\af13\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 the module specified by the INF file name argument.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -b, --buildtarget <TARGET>
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 TARGET is one of}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid1063253 \hich\af43\dbch\af13\loch\f43 a}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 list: DEBUG, RELEASE,}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth2\revdttm1727593357\langfenp2052\insrsid15538292 \hich\af43\dbch\af13\loch\f43 NOOPT}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth2\revdttm1727593357\langfenp2052\insrsid15538292 \loch\af43\hich\af43\dbch\f13 \u-244\'a3\'ac}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 which overrides }{
+\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1063253 \hich\af43\dbch\af13\loch\f43 the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 target.txt's TARGET definition. To specify }{\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1063253 \hich\af43\dbch\af13\loch\f43 another }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 TARGET, please repeat this option.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -t, --tagname Tagname
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Us}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1063253
+\hich\af43\dbch\af13\loch\f43 e}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6164334 \hich\af43\dbch\af13\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43
+ the Tool Chain Tagname to build the platform}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1063253 .}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9010967 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid1063253 \hich\af43\dbch\af13\loch\f43 It }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 overrides target.txt's TOOL_CHAIN_TAG definition.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -f --fdf Filename.fdf
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 The name of the FDF file }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid6164334 \hich\af43\dbch\af13\loch\f43 to use to}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 override the setting in the DSC file.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -r --rom-image ROM_IMAGE_NAME
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43
+The name of FD to be generated. The name must be from [FD] section in FDF file.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -i --fv-image FV_IMAGE_NAME
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 The name of FV to be generated. The name must\hich\af43\dbch\af13\loch\f43
+ be from [FV] section in FDF file.}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11224689
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0\pararsid10121491 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10121491 -}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid10121491 \hich\af43\dbch\af13\loch\f43 C}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10121491 \hich\af43\dbch\af13\loch\f43 --}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid6637302\charrsid6637302 \hich\af43\dbch\af13\loch\f43 capsule-image}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid10121491 \hich\af43\dbch\af13\loch\f43 CAPSULE}{\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid10121491 \hich\af43\dbch\af13\loch\f43 _IMAGE_NAME
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0\pararsid6375506 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10121491\charrsid6375506 \hich\af43\dbch\af13\loch\f43
+The name of Capsule to be generated. The name must be from [Capsule] section in FDF file.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\pnrdate1190691435\pnrnot1\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -n NUM
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Build}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6164334
+\hich\af43\dbch\af13\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 the platform using multi-threaded compiler. The value overrides }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7820891
+\hich\af43\dbch\af13\loch\f43 the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 target.txt's MULTIPLE_THREAD and MAX_CONCURRENT_THREAD_NUMBER. }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7820891
+\hich\af43\dbch\af13\loch\f43 Using l}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 ess than 2 will disable multi-thread builds.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -x --sku-id SKU_ID}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid11224689
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7820891 \hich\af43\dbch\af13\loch\f43 Use}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\hich\af43\dbch\af13\loch\f43 SKU ID to build the platform}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7820891 \hich\af43\dbch\af13\loch\f43 and override the}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\hich\af43\dbch\af13\loch\f43 SKUID_IDENTIFIER in DSC file.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -u --skip-autogen}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid11224689
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7820891 \hich\af43\dbch\af13\loch\f43 Use to s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\hich\af43\dbch\af13\loch\f43 kip }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7820891 \hich\af43\dbch\af13\loch\f43 the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 AutoGen
+\hich\af43\dbch\af13\loch\f43 step. Note the build may fail if there\hich\f43 \rquote \loch\f43 s no AutoGen-ed files before.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -e --re-parse}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid11224689
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7820891 \hich\af43\dbch\af13\loch\f43 Use to r}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\hich\af43\dbch\af13\loch\f43 e-parse all meta-data files. Use this option if you encounter }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7820891 \hich\af43\dbch\af13\loch\f43 an }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\hich\af43\dbch\af13\loch\f43 inconsistency issue.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid11224689
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -w --warning-as-error}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid11224689
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7820891 \hich\af43\dbch\af13\loch\f43 Use to t}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\hich\af43\dbch\af13\loch\f43 reat warning in }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7820891 \hich\af43\dbch\af13\loch\f43 the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 tool as }{
+\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7820891 \hich\af43\dbch\af13\loch\f43 an }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 error.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -j --log LOGFILE}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid11224689
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7820891 \hich\af43\dbch\af13\loch\f43 Use to p}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\hich\af43\dbch\af13\loch\f43 ut screen output in specified file.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -s \hich\f43 \endash \loch\f43 silent
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2974720 \hich\af43\dbch\af13\loch\f43 Enable }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\loch\af43\dbch\af13\hich\f43 \'93\loch\f43 \hich\f43 make\'94\loch\f43 \hich\f43 tool to run \'93\loch\f43 \hich\f43 silently\'94\loch\f43 . Internally, a \hich\f43 \lquote \loch\f43 -s\hich\f43 \rquote \loch\f43 \hich\f43 switch will be passed to \'93
+\loch\f43 \hich\f43 make\'94\loch\f43 tool. Don\hich\f43 \rquote \loch\f43 \hich\f43 t use this option if your \'93\loch\f43 \hich\f43 make\'94\loch\f43 tool doesn\hich\f43 \rquote \loch\f43 t support \hich\f43 \lquote \loch\f43 -s\hich\f43 \rquote
+\loch\f43 \hich\f43 . Instead, if your \'93\loch\f43 \hich\f43 make\'94\loch\f43 \hich\af43\dbch\af13\loch\f43 tool uses other option}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2974720 \hich\af43\dbch\af13\loch\f43 s}{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 you could add it to the XX_XX_XX_MAKE_FLAGS in tools_def.txt.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -d, --debug [#]
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Enable debug messages at specified level. It is used by Tool itself.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -q, --quiet
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Disable all messages except FATAL ERRORS.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -v, --verbose
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2974720 \hich\af43\dbch\af13\loch\f43 Enable}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\hich\af43\dbch\af13\loch\f43 verbose ou\hich\af43\dbch\af13\loch\f43 tput with informational messages printed.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -D, --define MACROS
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Macro: "Name [= Value]".
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -y, --report-file REPORTFILE}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid11224689
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Create/overwrite the report to the specified filename.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -Y, --report-type REPORTTYPE
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Flags that control the type of build report to generate.
+\hich\af43\dbch\af13\loch\f43
+ Must be one of: [PCD, LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS, EXECUTION_ORDER]. To specify more than one flag, repeat this option on the command line and the default flag set is [PCD, LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS]}{
+\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid11224689
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -F FLAG\hich\af43\dbch\af13\loch\f43 , --flag=FLAG}{\rtlch\fcs1
+\ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid11224689
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43
+Specify the specific option to parse EDK UNI file. Must be one of: [-c, -s]. -c is for EDK framework UNI file, and -s is for EDK UEFI UNI file. This option can also be specified by setting *_*_*_BUILD_FLAGS in [BuildOptions] section of platfo
+\hich\af43\dbch\af13\loch\f43 rm DSC. If they are both specified, this value will override the setting in [BuildOptions] section of platform DSC.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0\pararsid10756011 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1731990499\langfenp2052\insrsid10756011\charrsid10894100
+\hich\af43\dbch\af13\loch\f43 --check-usage}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1731990499\langfenp2052\insrsid10756011
+\par \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1731990499\insrsid10756011\charrsid10894100 \hich\af43\dbch\af13\loch\f43 Check usage content of entries listed in INF file.}{\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1731990499\langfenp2052\insrsid10756011\charrsid12155946
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\revauth1\revdttm1731990499\insrsid10756011\charrsid2178333 \hich\af43\dbch\af13\loch\f43 --ignore-sources
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid10756011 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1731990499\insrsid10756011 \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\revauth1\revdttm1731990499\insrsid10756011\charrsid11689747 \hich\af43\dbch\af13\loch\f43 Focus to a binary build and ignore all source files}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\revauth1\revdttm1731990499\insrsid10756011 .
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0\pararsid10756011 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1731990499\insrsid10756011\charrsid11689747 \hich\af43\dbch\af13\loch\f43
+If an INF file listed in the DSC or FDF file contains a [Sources] section and it also contains a [Binaries] section, do not generate a Makefile, ignoring the sources, and just use the binaries listed in the [Binaries] section
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\prauth1\prdate1731990500\rin0\lin720\itap0\pararsid10756011 {\*\oldpprops \pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0\pararsid10756011 }{\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1731990499\insrsid10756011\charrsid11689747 \hich\af43\dbch\af13\loch\f43 If an INF file listed in the D\hich\af43\dbch\af13\loch\f43
+SC or FDF file contains a [Sources] section and it does not contain a [Binaries] section, break the build with an error message}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1731990499\insrsid10756011 .}{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1731990499\crauth1\crdate1731990500\insrsid10756011\charrsid10756011 {\*\oldcprops \b\crauth1\crdate1731990500\insrsid10756011\charrsid10756011 }
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 --version
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Show program copyright and version number then exit.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 -h, --help
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Print the copyright, version and usage of this progra
+\hich\af43\dbch\af13\loch\f43 m then exit.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11224689 {\*\bkmkstart _Ref299349210}\hich\af43\dbch\af13\loch\f43 Target{\*\bkmkend _Ref299349210}
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 If no target is given, then default target is ALL.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 ALL}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43
+ Build everything for either the platform or module.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 GenC}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43
+ Auto-generate all C files for either the platform or module.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 GenMake}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Generat\hich\af43\dbch\af13\loch\f43
+e the Makefiles \hich\f43 \endash \loch\f43 if auto-generated files are missing,
+\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43
+ then auto-generate all C files first for either the platform or module.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Fds}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\hich\af43\dbch\af13\loch\f43 Create the FD Image files.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Libraries}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Build all EDK Libraries and EDK II Libra
+\hich\af43\dbch\af13\loch\f43 ry Instances which are specified.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Modules}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43
+ Build all EDK components and EDK II modules which are specified.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Clean}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43
+ Remove intermediate files generated by the NMAKE command (leaving
+\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 the auto-generated C format, FD image files
+\hich\af43\dbch\af13\loch\f43 , PE32 output files, PCH
+\par \hich\af43\dbch\af13\loch\f43 files and LIB files).
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 CleanAll}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\hich\af43\dbch\af13\loch\f43 Remove all }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6164334 \hich\af43\dbch\af13\loch\f43 intermediate}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43
+, auto-generated, FV and FD image files \hich\f43 \endash \loch\f43
+\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43
+ state of the tree should be exactly as if a fresh checkout or install has
+\par \hich\af43\dbch\af13\loch\f43 \hich\af43\dbch\af13\loch\f43 occurred.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 CleanLib}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\hich\af43\dbch\af13\loch\f43 Remove intermediate files generated by the NMAKE command AND LIB
+\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43
+ files (leaving the auto-generated, FV and FD image files, PE32 output
+\par \hich\af43\dbch\af13\loch\f43 files and PCH files)
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 run}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\hich\af43\dbch\af13\loch\f43 Run platform (for \hich\af43\dbch\af13\loch\f43 emulator platform only)
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid14971029 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid14971029 {\*\bkmkstart OLE_LINK3}{\*\bkmkstart OLE_LINK4}
+{\*\bkmkstart OLE_LINK5}{\*\bkmkstart OLE_LINK6}\hich\af43\dbch\af13\loch\f43 Status codes returned}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid14971029\charrsid4999604
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb
+\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil \cellx8712
+\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0
+\fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid14971029 0}{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs25\b\f2\fs18\lang1033\langfe2052\kerning2\langfenp2052\insrsid14971029 \cell }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid14971029 \hich\af43\dbch\af13\loch\f43 The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \kerning2\insrsid14971029
+\cell }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {
+\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid14971029 \trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb
+\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil \cellx8712
+\row \ltrrow}\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0
+\fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid4338091 \hich\af2\dbch\af13\loch\f2 Nonzero}{
+\rtlch\fcs1 \af41\afs19 \ltrch\fcs0 \cs25\f41\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid14971029\charrsid8600807 \cell }\pard \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid13245303\yts26 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid14971029 \hich\af43\dbch\af13\loch\f43 The action failed.\cell
+}\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1
+\af37\afs20 \ltrch\fcs0 \fs20\insrsid14971029 \trowd \irow1\irowband1\lastrow \ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb
+\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil \cellx8712
+\row }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16534634 {\*\bkmkend OLE_LINK3}{\*\bkmkend OLE_LINK4}{\*\bkmkend OLE_LINK5}
+{\*\bkmkend OLE_LINK6}
+\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid11224689
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11224689
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Examples
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Assume that $(WORKSPACE) is C:\\MyWorkspace
+\par }\pard \ltrpar\ql \li180\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin180\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Build platform: Nt32Pkg.dsc
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Specify the platform description file on the command line.
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 C:\\MyWorkspace>build -p Nt32Pkg\\Nt32Pkg.dsc \hich\f43 \endash
+\loch\f43 a IA32
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43
+Build the platform in the current working directory if it contains a platform description file.
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 C:\\MyWorkspace\\Nt32Pk\hich\af43\dbch\af13\loch\f43 g>build \hich\f43
+\endash \loch\f43 a IA32
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Build the active platform specified in the target.txt file.
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 C:\\ MyWorkspace>build \hich\f43 \endash \loch\f43 a Ia32
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid11224689
+\par }\pard \ltrpar\ql \li180\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin180\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Build Module: HelloWorld.inf
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Specify the platform and Module on the command line.
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 C:\\MyWorkspace>build -p Nt32Pkg\\Nt32Pkg.dsc \hich\f43 \endash
+\loch\f43 a IA32 \\
+\par }\pard \ltrpar\ql \li720\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 \hich\f43 \endash \loch\f43 m MdeModule\hich\af43\dbch\af13\loch\f43
+Pkg/Application/HelloWorld/HelloWorld.inf
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43
+Specify the Module on the command line and use the active platform specified in the target.txt file.
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 C:\\MyWorkspace>build \hich\f43 \endash \loch\f43 a IA32 \\
+\par }\pard \ltrpar\ql \li720\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \loch\af43\dbch\af13\hich\f43 \endash \loch\f43 m MdeModulePkg/Application/HelloWorld/HelloWorld.inf
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Build the module in the curr\hich\af43\dbch\af13\loch\f43
+ent working directory if it contains a module description file and specify the platform on the command line.
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 C:\\ MyWorkspace\\MdeModulePkg\\Application\\HelloWorld>build \hich\f43
+\endash \loch\f43 a Ia32 \\
+\par }\pard \ltrpar\ql \li720\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \loch\af43\dbch\af13\hich\f43 \endash \loch\f43 p Nt32Pkg\\Nt32Pkg.dsc
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Build the module in the current working directory and us
+\hich\af43\dbch\af13\loch\f43 e the active platform specified in the target.txt file.
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 C:\\ MyWorkspace\\MdeModulePkg\\Application\\HelloWorld>build \hich\f43
+\endash \loch\f43 a Ia32
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 No known }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9010967 \hich\af43\dbch\af13\loch\f43 issues.}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11224689
+\par \hich\af43\dbch\af13\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1195920020\crauth1\crdate1195920021\insrsid3478286\charrsid3478286 {\*\oldcprops
+\i\f41\fs20\cf18\lang1033\langfe2052\highlight2\crauth1\crdate1195920021\langfenp2052\insrsid3478286\charrsid3478286 }\hich\af43\dbch\af13\loch\f43 edk2-\hich\af43\dbch\af13\loch\f43 devel\hich\af43\dbch\af13\loch\f43 @lists.01.
+\hich\af43\dbch\af13\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel1\revdttmdel1195920020\insrsid11224689\delrsid3478286 \hich\af43\dbch\af13\loch\f43 edk2-buildtools-devel@lists.sourceforge.net}{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\crauth1\crdate1195920021\insrsid11224689\charrsid3478286 {\*\oldcprops \f0\crauth1\crdate1195920021\insrsid11224689\charrsid3478286 }
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 target.txt, tools_def.txt, platfo\hich\af43\dbch\af13\loch\f43 rm.dsc, flashmap.fdf, package.dec and module.inf.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11224689 \hich\af43\dbch\af13\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 GenFds.exe
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11224689 \hich\af43\dbch\af13\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 Copyright (c) 1999 - 201}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid1381256 \hich\af43\dbch\af13\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid11224689 \hich\af43\dbch\af13\loch\f43 , Intel Corporation. All rights reserved.
+\par
+\par \hich\af43\dbch\af13\loch\f43 This program and the accompanying materials are licensed and made available under the terms and
+\par \hich\af43\dbch\af13\loch\f43 conditions of the BSD License which accompanies this distribution. The full text of the license may be
+\par \hich\af43\dbch\af13\loch\f43 found at:
+\par \hich\af43\dbch\af13\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af13\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES
+\par \hich\af43\dbch\af13\loch\f43 OR RE\hich\af43\dbch\af13\loch\f43 PRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb
+44f95d843b5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a
+6409fb44d08741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c
+3d9058edf2c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db0256
+5e85f3b9660d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276
+b9f7dec44b7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8
+c33585b5fb9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e
+51440ca2e0088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95
+b21be5ceaf8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff
+6dce591a26ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec6
+9ffb9e65d028d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239
+b75a5bb1e6345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a449
+59d366ad93b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e8
+2db8df9f30254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468
+656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4
+350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d2624
+52282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe5141
+73d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c020000130000000000000000
+0000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000
+000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c0000000000000000000000000019
+0200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b00001600000000
+000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b01000027
+00000000000000000000000000a00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009b0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 Normal;\lsdqformat1 \lsdpriority0 heading 1;\lsdqformat1 \lsdpriority0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority0 heading 9;\lsdpriority0 toc 1;\lsdpriority0 toc 2;\lsdpriority0 toc 3;\lsdpriority0 toc 4;\lsdpriority0 toc 5;\lsdpriority0 toc 6;\lsdpriority0 toc 7;\lsdpriority0 toc 8;\lsdpriority0 toc 9;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;
+\lsdqformat1 \lsdpriority0 Title;\lsdpriority0 Default Paragraph Font;\lsdqformat1 \lsdpriority0 Subtitle;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority0 Strong;\lsdqformat1 \lsdpriority0 Emphasis;\lsdpriority0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;
+\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;
+\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;
+\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;
+\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;
+\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;
+\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;
+\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;
+\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;
+\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;
+\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;
+\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e30000000000000000000000e0000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff0900060000000000000000000000010000000100000000000000001000000200000001000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdffffff04000000feffffff05000000fefffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffff010000000c6ad98892f1d411a65f0040963251e50000000000000000000000008063
+06c6e4f1d1010300000080020000000000004d0073006f004400610074006100530074006f0072006500000000000000000000000000000000000000000000000000000000000000000000000000000000001a000101ffffffffffffffff020000000000000000000000000000000000000000000000806306c6e4f1d101
+806306c6e4f1d101000000000000000000000000d100460056004400d800d2003300da004c0055003000d300d6004400d900320059005a00c4004600d80051003d003d000000000000000000000000000000000032000101ffffffffffffffff030000000000000000000000000000000000000000000000806306c6e4f1
+d101806306c6e4f1d1010000000000000000000000004900740065006d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000201ffffffff04000000ffffffff000000000000000000000000000000000000000000000000
+00000000000000000000000000000000f100000000000000010000000200000003000000feffffff0500000006000000070000000800000009000000feffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3c623a536f757263657320786d6c6e733a623d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f6269626c696f6772617068792220786d6c6e733d
+22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f6269626c696f677261706879222053656c65637465645374796c653d225c415041536978746845646974696f6e4f66666963654f6e6c696e652e78736c22205374796c654e616d
+653d22415041222056657273696f6e3d2236222f3e0000000000000000000000000000003c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d226e6f223f3e0d0a3c64733a6461746173746f72654974656d2064733a6974656d49443d227b45333433
+353543342d374132372d343632442d423344382d3345354336313939303545317d2220786d6c6e733a64733d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f637573746f6d586d6c223e3c64733a736368656d61526566733e3c
+64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6f70656e500072006f007000650072007400690065007300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000200ffffffffffffffffffffffff000000000000
+0000000000000000000000000000000000000000000000000000000000000400000055010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f6269626c696f677261706879222f3e3c2f64733a736368656d61526566733e3c2f64733a6461746173746f
+72654974656d3e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/EfiRom_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/EfiRom_Utility_Man_Page.rtf
new file mode 100644
index 000000000..adc3695f4
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/EfiRom_Utility_Man_Page.rtf
@@ -0,0 +1,294 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
+{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}
+{\f114\fbidi \fmodern\fcharset134\fprq1{\*\panose 02010609030101010101}\'d0\'c2\'cb\'ce\'cc\'e5;}{\f115\fbidi \fmodern\fcharset134\fprq1{\*\panose 02010609030101010101}@\'d0\'c2\'cb\'ce\'cc\'e5;}
+{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f258\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\f259\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f261\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\f262\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\f263\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f264\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\f265\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\f266\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f390\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}
+{\f598\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f599\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f601\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f602\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}
+{\f605\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f606\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f688\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f689\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f695\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f696\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1390\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\f1400\fbidi \fmodern\fcharset0\fprq1 NSimSun Western;}{\f1410\fbidi \fmodern\fcharset0\fprq1 @\'d0\'c2\'cb\'ce\'cc\'e5 Western;}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}
+{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}
+{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}
+{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}
+{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}
+{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}
+{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;\red163\green21\blue21;}{\*\defchp \fs21\kerning2\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\snext11 \ssemihidden \sunhideused Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs44 \ltrch\fcs0 \b\f43\fs44\kerning44 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0
+\b\fs32\kerning0\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked \ssemihidden \spriority9 Heading 2 Char;}}{\*\rsidtbl \rsid143575\rsid541891\rsid1143002\rsid3304138\rsid6835746\rsid7482167\rsid8667972\rsid10503224\rsid10945130
+\rsid11033084\rsid12077502\rsid12146371\rsid12734514\rsid14640521}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}
+{\creatim\yr2011\mo11\dy24\hr21\min26}{\revtim\yr2016\mo8\dy9\hr10\min22}{\version14}{\edmins4}{\nofpages3}{\nofwords653}{\nofchars3728}{\nofcharsws4373}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
+\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot12077502 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \hich )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar
+\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 EfiRom.exe - build an Option ROM image
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 EfiRom.exe }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \fs18\cf18\lang1024\langfe1024\loch\af114\hich\af0\dbch\af114\noproof\insrsid14640521 \hich\af0\dbch\af114\loch\f114
+-f VendorId -i DeviceId}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14640521 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 \hich\f43
+[options] Filename [Filename]\'85
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43
+EfiRom is used to build an Option ROM image from UEFI PE32 file(s) and/or legacy option ROM images that conform to PCI 2.3 or PCI 3.0 specifications for Option ROM layout. The EfiRom utility performs some rudimentary checking on the input Portable Executa
+\hich\af43\dbch\af31505\loch\f43 b\hich\af43\dbch\af31505\loch\f43 le (PE) PE32 files to verify they are indeed PE32 images. These checks include:
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Verification that the DOS stub magic value is 0x5A4D
+\par \hich\af43\dbch\af31505\loch\f43 \hich\f43 Verification that the PE signature is \'93\loch\f43 PE\\0\\\hich\f43 0\'94
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 If either of these checks fails then the utility will abort without creating
+\hich\af43\dbch\af31505\loch\f43 the output ROM image file.
+\par \hich\af43\dbch\af31505\loch\f43 This utility performs some rudimentary checking of the input binary files to verify they are indeed valid option ROM images. These checks include:
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Verification that the signature of the option ROM header is 0xAA55
+\par \hich\af43\dbch\af31505\loch\f43 Verification t\hich\af43\dbch\af31505\loch\f43 hat the offset to the PCI data structure is within the range of the file size.
+\par \hich\af43\dbch\af31505\loch\f43 \hich\f43 Verification that the signature of the PCI data structure is \'93\loch\f43 \hich\f43 PCIR\'94.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Options
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Filename1 [FilenameN]
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Input PE/PE32+/COFF or legacy option ROM image file(s).
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -o, --output RomFilena\hich\af43\dbch\af31505\loch\f43 me
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43
+The ROM filename being created. If not specified, use the first input filename as name and *.rom as the output filename extension.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -e, --efi
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Input PE/PE32+/COFF file(s)
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -b, --binary
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Input legacy option ROM image files.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -ec, --compress
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Compress input PE/\hich\af43\dbch\af31505\loch\f43 PE32+/COFF file.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -n, --no-last-bit
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Do not set the LAST bit on the last file.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -l ClassCode, --class-code=ClassCode
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Use ClassCode in the PCI data structure header in the input file.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -r Rev, --Revision=Rev
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Use Rev in the PCI data structure header in the input file.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -p, --pci23
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43
+Default layout meets PCI 3.0 specifications, specifying this flag will for a PCI 2.3 layout.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -d, --dump
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Dump the header of input option ROM image
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -i, --device-id
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Device ID}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3304138
+\hich\af43\dbch\af31505\loch\f43 , m}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid12077502 \hich\af43\dbch\af31505\loch\f43 ust be spe\hich\af43\dbch\af31505\loch\f43 cified.}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -f, --vendor-id
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Vendor ID}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3304138
+\hich\af43\dbch\af31505\loch\f43 , m}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid12734514 \hich\af43\dbch\af31505\loch\f43 ust be specified.}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 --version
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Print version and copyright of this program then exit.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -v, --verbose
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43
+Turn on verbose output with informational messages printed. This is a count value, so specifying \hich\f43 \endash \loch\f43 v\hich\af43\dbch\af31505\loch\f43 can be used to increase the verbosity level.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -q, --quiet
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Disable all messages except FATAL ERRORS.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -d, --debug [#]
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Enable debug messages, at level #.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 -h, --help
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Print the copyright, version and usage of this program then exit.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Examples
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Generate the Option\hich\af43\dbch\af31505\loch\f43 ROM with two efi binary files and one legacy binary file. }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10503224
+\hich\af43\dbch\af31505\loch\f43 Vendor ID and Device ID are both specified in command line. }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 \hich\f43
+The output filename is not specified in command line, so the output filename will be \'93\loch\f43 \hich\f43 File1.rom\'94\loch\f43 . The output filename is the same as the \hich\af43\dbch\af31505\loch\f43 \hich\f43
+first input filename with the extension \'93\loch\f43 \hich\f43 .rom\'94
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 EfiRom }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11033084 \loch\af43\dbch\af31505\hich\f43 \endash \loch\f43 i 0xABCD \hich\f43
+\endash \loch\f43 f 0x1234 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \loch\af43\dbch\af31505\hich\f43 \endash \loch\f43 e File1.efi File2.efi \hich\f43 \endash \loch\f43 b Legacy.bin
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Generate the Option ROM with two efi binary files and one legacy binary file with the output filename specified on the command line.}{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid541891 \hich\af43\dbch\af31505\loch\f43 Vendor ID and Device ID are both specified in command line}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1143002 .}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid10945130
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 EfiRom }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8667972 \loch\af43\dbch\af31505\hich\f43 \endash \loch\f43 i 0xABCD \hich\f43 \endash
+\loch\f43 f 0x1234 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \loch\af43\dbch\af31505\hich\f43 \endash \loch\f43 o file.rom \hich\f43 \endash \loch\f43 e File1.efi File2.efi \hich\f43 \endash \loch\f43 b Legacy.bin
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Generate the Option ROM with two efi binary files and one legacy binary file. The output filename is not specified in c\hich\af43\dbch\af31505\loch\f43
+\hich\f43 ommand line, so the output filename will be \'93\loch\f43 \hich\f43 File1.rom\'94\loch\f43 \hich\f43 . The output filename is the same as the first input filename with the extension \'93\loch\f43 \hich\f43 .rom\'94\loch\f43
+. Vendor ID and Device ID are both specified in command line and the efi binary files will be compressed using th\hich\af43\dbch\af31505\loch\f43 e\hich\af43\dbch\af31505\loch\f43 Tiano Compression algorithm.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 EfiRom \hich\f43 \endash \loch\f43 i 0xABCD \hich\f43 \endash \loch\f43 f 0x1234 \hich\f43 \endash \loch\f43 ec File1.efi File2.efi \hich\f43 \endash
+\loch\f43 b Legacy.bin
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43
+Generate the Option ROM with two efi binary files and one legacy binary file with the output filename is specified in command line. Vendor ID and Device ID are b\hich\af43\dbch\af31505\loch\f43
+oth specified in command line and the efi binary files will be compressed using the Tiano Compression algorithm.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 EfiRom \hich\f43 \endash \loch\f43 o file.rom \hich\f43 \endash \loch\f43 i 0xABCD \hich\f43 \endash \loch\f43 f 0x1234 \hich\f43 \endash \loch\f43
+ec File1.efi File2.efi \hich\f43 \endash \loch\f43 b Legacy.bin
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 No known bugs.
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe1033\langfenp1033\insrsid6835746\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-\hich\af43\dbch\af31505\loch\f43 devel
+\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid10945130
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid10945130 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 1999 - 20}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid143575 \hich\af43\dbch\af31505\loch\f43 11}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10945130
+\hich\af43\dbch\af31505\loch\f43 , Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licensed and made available
+\par \hich\af43\dbch\af31505\loch\f43 under the term\hich\af43\dbch\af31505\loch\f43 s and conditions of the BSD License which accompanies this
+\par \hich\af43\dbch\af31505\loch\f43 distribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+\par \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES\hich\af43\dbch\af31505\loch\f43 OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210030dd4329a8060000a41b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d331115bebc4eb813bf83291b63624a0d1475a756c734f9bbc2cd28546ecbe1e20a3794ca175f3fae90
+fb6d2dd99bb07b55e5ccf68942bd0877b23c77b908e8db5f9db7f024d9239010f35bd4bbe2fcae387bfff9e2bc289f2fbe24cfaa301468dd8bd846dbb4ddf1c2
+ae7b4c191ba8292337a469bc25ec3d411f06f53a73e224c5292c8de0516732307070a1c0660d125c7d44553488700a4d7bddd3444299910e254ab984c3a219ae
+a4adf1d0f82b7bd46cea4388ad1c12ab5d1ed8e1153d9c9f350a3246aad01c6873462b9ac05999ad5cc988826eafc3acae853a33b7ba11cd1445875ba1b236b1
+399483c90bd560b0b0263435085a21b0f22a9cf9356b38ec6046026d77eba3dc2dc60b17e92219e180643ed27acffba86e9c94c7ca9c225a0f1b0cfae0788ad5
+4adc5a9aec1b703b8b93caec1a0bd8e5de7b132fe5113cf312503b998e2c2927274bd051db6b35979b1ef271daf6c6704e86c73805af4bdd476216c26593af84
+0dfb5393d964f9cc9bad5c313709ea70f561ed3ea7b053075221d51696910d0d339585004b34272bff7213cc7a510a5454a3b349b1b206c1f0af490176745d4b
+c663e2abb2b34b23da76f6352ba57ca2881844c1111ab189d8c7e07e1daaa04f40255c77988aa05fe06e4e5bdb4cb9c5394bbaf28d98c1d971ccd20867e556a7
+689ec9166e0a522183792b8907ba55ca6e943bbf2a26e52f48957218ffcf54d1fb09dc3eac04da033e5c0d0b8c74a6b43d2e54c4a10aa511f5fb021a07533b20
+5ae07e17a621a8e082dafc17e450ffb739676998b48643a4daa7211214f623150942f6a02c99e83b85583ddbbb2c4996113211551257a656ec1139246ca86be0
+aadedb3d1441a89b6a929501833b197fee7b9641a3503739e57c732a59b1f7da1cf8a73b1f9bcca0945b874d4393dbbf10b1680f66bbaa5d6f96e77b6f59113d
+316bb31a795600b3d256d0cad2fe354538e7566b2bd69cc6cbcd5c38f0e2bcc63058344429dc2121fd07f63f2a7c66bf76e80d75c8f7a1b622f878a18941d840
+545fb28d07d205d20e8ea071b283369834296bdaac75d256cb37eb0bee740bbe278cad253b8bbfcf69eca23973d939b97891c6ce2cecd8da8e2d343578f6648a
+c2d0383fc818c798cf64e52f597c740f1cbd05df0c264c49134cf09d4a60e8a107260f20f92d47b374e32f000000ffff0300504b030414000600080000002100
+0dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f7
+8277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89
+d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd500
+1996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0f
+bfff0000001c0200001300000000000000000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6
+a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a
+0000001c00000000000000000000000000190200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d00140006000800000021
+0030dd4329a8060000a41b00001600000000000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d001400060008
+00000021000dd1909fb60000001b0100002700000000000000000000000000b20900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000ad0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e5000000000000000000000000802c
+b7ece4f1d101feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/GenCrc32_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/GenCrc32_Utility_Man_Page.rtf
new file mode 100644
index 000000000..e111894b0
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/GenCrc32_Utility_Man_Page.rtf
@@ -0,0 +1,321 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}
+{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
+{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}
+{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}
+{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
+{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\f258\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\f259\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f261\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\f262\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\f263\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f264\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\f265\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\f266\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f268\fbidi \fswiss\fcharset238\fprq2 Arial CE;}{\f269\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;}{\f271\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}
+{\f272\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f273\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f274\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);}{\f275\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}
+{\f276\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f278\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}{\f279\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}
+{\f281\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f282\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}{\f283\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}
+{\f284\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f285\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}{\f286\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}
+{\f390\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f598\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f599\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f601\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}
+{\f602\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f605\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f606\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}
+{\f628\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\f629\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}{\f631\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}
+{\f632\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}{\f635\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\f636\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\f648\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f649\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}{\f651\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}
+{\f652\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f653\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}{\f654\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}
+{\f655\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f656\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}{\f657\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}
+{\f668\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f669\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f671\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}{\f672\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}
+{\f675\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f676\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f688\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f689\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f695\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f696\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1390\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
+{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
+{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red0\green127\blue127;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext11 \ssemihidden \sunhideused
+Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\ai\af0\afs28 \ltrch\fcs0
+\b\i\fs28\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\s17\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0
+\fs16\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext17 \slink18 \ssemihidden \sunhideused \styrsid12206721 Balloon Text;}{\*\cs18 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \f39\fs16
+\sbasedon10 \slink17 \slocked \ssemihidden \styrsid12206721 Balloon Text Char;}{\*\cs19 \additive \rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \fs16 \sbasedon10 \ssemihidden \sunhideused \styrsid2759676 annotation reference;}{
+\s20\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext20 \slink21 \ssemihidden \sunhideused \styrsid2759676 annotation text;}{\*\cs21 \additive \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f43\fs20 \sbasedon10 \slink20 \slocked \ssemihidden \styrsid2759676 Comment Text Char;}{
+\s22\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0 \b\fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon20 \snext20 \slink23 \ssemihidden \sunhideused \styrsid2759676 annotation subject;}{\*\cs23 \additive \rtlch\fcs1 \ab\af0\afs20 \ltrch\fcs0 \b\f43\fs20 \sbasedon21 \slink22 \slocked \ssemihidden \styrsid2759676 Comment Subject Char;}{
+\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext24 \spriority0 \styrsid6184429 CellBodyLeft;}{\*\cs25 \additive \b\f2\cf13 \spriority0 \styrsid6184429 CodeCharacter;}{\*\ts26\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh
+\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon11 \snext26 \spriority59 \styrsid6184429 Table Grid;}}{\*\revtbl {Unknown;}{Zhu, Yonghong;}}{\*\rsidtbl \rsid1192848\rsid1966294\rsid2759676\rsid3353825\rsid4348399\rsid4467160\rsid4922786\rsid4999604\rsid5911148\rsid6184429\rsid6386813\rsid8600807\rsid9250385\rsid9781783
+\rsid11208985\rsid11760870\rsid12198464\rsid12206721\rsid14620079\rsid15543797}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}
+{\creatim\yr2010\mo10\dy6\hr16\min42}{\revtim\yr2016\mo8\dy9\hr10\min24}{\version14}{\edmins289}{\nofpages2}{\nofwords379}{\nofchars2163}{\nofcharsws2537}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
+\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot11760870 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \hich )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \fi-1300\li-140\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar
+\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-140\itap0\pararsid6184429 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 GenCrc32.exe
+\par }\pard\plain \ltrpar\s2\ql \fi-1440\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid6184429 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 GenCrc32 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid6184429 \hich\af43\dbch\af31505\loch\f43 [-v | -q | -}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid1966294 -}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid6184429 \hich\af43\dbch\af31505\loch\f43 d}{\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid1966294 \hich\af43\dbch\af31505\loch\f43 ebug <Level>}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid6184429 \hich\af43\dbch\af31505\loch\f43 ]
+\hich\f43 \endash \loch\f43 e|-d -o }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid4467160 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid6184429 \hich\af43\dbch\af31505\loch\f43 Output}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid4467160 \hich\af43\dbch\af31505\loch\f43 F}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid6184429 \hich\af43\dbch\af31505\loch\f43 ile}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid4467160
+\hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid6184429 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid4467160 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid6184429 \hich\af43\dbch\af31505\loch\f43 Input}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid4467160 \hich\af43\dbch\af31505\loch\f43 F}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid6184429 \hich\af43\dbch\af31505\loch\f43
+ile}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid4467160 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid6184429
+\par \hich\af43\dbch\af31505\loch\f43 GenCrc32 \hich\f43 \endash \loch\f43 h
+\par \hich\af43\dbch\af31505\loch\f43 GenCrc32 --version}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11760870
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid6184429 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 The GenCrc32 tool generate}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9781783 \hich\af43\dbch\af31505\loch\f43 s}{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43
+ the CRC32 value when encoding the input file, put the calculated CRC32 value into the output file header, and then put the input file into the output file tail. When decoding the input file, GenCrc32 is used to verify the CRC32 value. If the CRC32 value
+\hich\af43\dbch\af31505\loch\f43 i\hich\af43\dbch\af31505\loch\f43
+s valid, the input file, except for CRC32 value, will be written to the output file. If the CRC32 value is not valid, the error message will be displayed and the output file will not be created.
+\par }\pard\plain \ltrpar\s2\ql \fi-1440\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid6184429 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 Options}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid11760870
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid14620079 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14620079\charrsid12198464 {\*\bkmkstart OLE_LINK12}{\*\bkmkstart OLE_LINK13}\hich\af43\dbch\af31505\loch\f43 If no options ar}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14620079
+\hich\af43\dbch\af31505\loch\f43 e specified, tool\hich\af43\dbch\af31505\loch\f43 prints usage.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\langfenp2052\insrsid14620079\charrsid14620079 {\*\bkmkend OLE_LINK12}{\*\bkmkend OLE_LINK13}
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 -e }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11760870
+\hich\af43\dbch\af31505\loch\f43 Calculate CRC32 value for the input file.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 -d}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 Verify CRC32 value for the input file.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 -o, --output Filename}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid11760870
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 File will be created to store the output content.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 --version
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid11760870 \hich\af0\dbch\af31505\loch\f0 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 Print version and copyright of this
+\hich\af43\dbch\af31505\loch\f43 program and exit
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 -v, --verbose
+\par \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 Turn on verbose output with informational messages printed. This is a count value, so specifying \hich\f43 \endash
+\loch\f43 v can be used to increase the verbosity level.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 -q, --quiet}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid11760870
+\par \tab \hich\af0\dbch\af31505\loch\f0 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 Disable all messages except FATAL ERRORS
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 --debug [0-9]
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid11760870 \tab \hich\af0\dbch\af31505\loch\f0 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 Enable debug messages. Only 0-9 Level is supported.
+
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 -h, --help
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid11760870 \tab \hich\af0\dbch\af31505\loch\f0 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43
+Print copyright, version and usage of this program and exit
+\par }\pard\plain \ltrpar\s2\ql \fi-1440\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid6184429 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6184429\charrsid6184429 {\*\bkmkstart OLE_LINK7}{\*\bkmkstart OLE_LINK8}\hich\af43\dbch\af31505\loch\f43
+Status codes returned}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid6184429
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid6184429\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6184429\charrsid8600807 \hich\af2\dbch\af13\loch\f2 STATUS_SUCCESS}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6184429 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6184429\charrsid4999604 \tab }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6184429 0}{\rtlch\fcs1 \ab\af2\afs18
+\ltrch\fcs0 \cs25\b\f2\fs18\lang1033\langfe2052\kerning2\langfenp2052\insrsid6184429 \cell }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6184429 \hich\af43\dbch\af13\loch\f43 The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0
+\kerning2\insrsid6184429 \cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid6184429 \trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb
+\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid6184429\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row \ltrrow}\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\kerning2\insrsid6184429\charrsid8600807 \hich\af2\dbch\af13\loch\f2
+STATUS_ERROR}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6184429 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6184429\charrsid4999604 \tab \tab }{\rtlch\fcs1
+\ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6184429 \hich\af2\dbch\af13\loch\f2 2}{\rtlch\fcs1 \af41\afs19 \ltrch\fcs0 \cs25\f41\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid6184429\charrsid8600807
+\cell }\pard \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid4348399\yts26 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid6184429
+\hich\af43\dbch\af13\loch\f43 The action \hich\af43\dbch\af13\loch\f43 failed.\cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid6184429 \trowd \irow1\irowband1\lastrow \ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10
+\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid6184429\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid6184429 \rtlch\fcs1
+\af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11760870 {\*\bkmkend OLE_LINK7}{\*\bkmkend OLE_LINK8}
+\hich\af43\dbch\af31505\loch\f43 Example
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 \hich\f43 1. Calculate CRC32 value for the input file \'93\loch\f43 \hich\f43 file.sec\'94\loch\f43 and write the CRC32 value and input file into the output file "file.crc32".
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 GenCrc32 \hich\f43 \endash \loch\f43 e \hich\f43 \endash \loch\f43 o file.crc32 file.sec
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 2. Verify CRC32 value o\hich\af43\dbch\af31505\loch\f43
+f the input file "file.crc32" and write the input file (not including CRC32 value) to the output file "file.orig"
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 GenCrc32 \hich\f43 \endash \loch\f43 d \hich\f43 \endash \loch\f43 o file.orig file.crc32
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 3. Verify CRC32 value of the input file "file.crc32" in the quiet mode and write the input file (not inclu\hich\af43\dbch\af31505\loch\f43
+ding CRC32 value) to the output file "file.orig"
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 GenCrc32 \hich\f43 \endash \loch\f43 d -q \hich\f43 \endash \loch\f43 o file.orig file.crc32
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid6184429 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 No known bugs.
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1195920024\insrsid11208985\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-\hich\af43\dbch\af31505\loch\f43 devel
+\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel1\revdttmdel1195920024\insrsid11760870\delrsid11208985 \hich\af43\dbch\af31505\loch\f43
+edk2-buildtools-devel@lists.sourceforge.net}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid11760870
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid6184429 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid6184429 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af2\afs20 \ltrch\fcs0
+\f2\fs20\insrsid11760870 \hich\af2\dbch\af31505\loch\f2 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid6184429 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid11760870 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 2006 - }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6386813 \hich\af43\dbch\af31505\loch\f43 20}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid1192848 \hich\af43\dbch\af31505\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6386813 \hich\af43\dbch\af31505\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11760870
+\hich\af43\dbch\af31505\loch\f43 , Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials
+\par \hich\af43\dbch\af31505\loch\f43 are licensed and made available under the terms and conditions of the BSD License
+\par \hich\af43\dbch\af31505\loch\f43 which accompanies this distribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http:\hich\af43\dbch\af31505\loch\f43 //opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+\par \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid11760870
+\par
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb
+44f95d843b5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a
+6409fb44d08741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c
+3d9058edf2c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db0256
+5e85f3b9660d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276
+b9f7dec44b7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8
+c33585b5fb9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e
+51440ca2e0088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95
+b21be5ceaf8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff
+6dce591a26ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec6
+9ffb9e65d028d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239
+b75a5bb1e6345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a449
+59d366ad93b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e8
+2db8df9f30254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468
+656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4
+350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d2624
+52282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe5141
+73d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c020000130000000000000000
+0000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000
+000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c0000000000000000000000000019
+0200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b00001600000000
+000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b01000027
+00000000000000000000000000a00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009b0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e500000000000000000000000070ee
+081be5f1d101feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/GenDepex_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/GenDepex_Utility_Man_Page.rtf
new file mode 100644
index 000000000..2cce9d5d4
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/GenDepex_Utility_Man_Page.rtf
@@ -0,0 +1,352 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}
+{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
+{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}
+{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}
+{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
+{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\f258\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\f259\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f261\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\f262\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\f263\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f264\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\f265\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\f266\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f268\fbidi \fswiss\fcharset238\fprq2 Arial CE;}{\f269\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;}{\f271\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}
+{\f272\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f273\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f274\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);}{\f275\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}
+{\f276\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f278\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}{\f279\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}
+{\f281\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f282\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}{\f283\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}
+{\f284\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f285\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}{\f286\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}
+{\f390\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f598\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f599\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f601\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}
+{\f602\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f605\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f606\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}
+{\f628\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\f629\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}{\f631\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}
+{\f632\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}{\f635\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\f636\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\f648\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f649\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}{\f651\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}
+{\f652\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f653\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}{\f654\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}
+{\f655\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f656\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}{\f657\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}
+{\f668\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f669\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f671\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}{\f672\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}
+{\f675\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f676\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f688\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f689\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f695\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f696\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1390\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
+{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
+{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;}{\*\defchp \fs21\kerning2\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\snext11 \ssemihidden \sunhideused Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs44 \ltrch\fcs0 \b\f43\fs44\kerning44 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0
+\b\fs32\kerning0\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\*\cs17 \additive \rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \fs16 \sbasedon10 \ssemihidden \sunhideused \styrsid15757365 annotation reference;}{
+\s18\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon0 \snext18 \slink19 \ssemihidden \sunhideused \styrsid15757365 annotation text;}{\*\cs19 \additive \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f43\fs20\lang0\langfe2052\kerning0\langnp0\langfenp2052
+\sbasedon10 \slink18 \slocked \ssemihidden \styrsid15757365 Comment Text Char;}{\s20\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0
+\b\fs20\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon18 \snext18 \slink21 \ssemihidden \sunhideused \styrsid15757365 annotation subject;}{\*\cs21 \additive \rtlch\fcs1 \ab\af0\afs20 \ltrch\fcs0
+\b\f43\fs20\lang0\langfe2052\kerning0\langnp0\langfenp2052 \sbasedon19 \slink20 \slocked \ssemihidden \styrsid15757365 Comment Subject Char;}{\s22\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0
+\fs16\lang1033\langfe2052\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext22 \slink23 \ssemihidden \sunhideused \styrsid15757365 Balloon Text;}{\*\cs23 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0
+\f39\fs16\lang0\langfe2052\kerning0\langnp0\langfenp2052 \sbasedon10 \slink22 \slocked \ssemihidden \styrsid15757365 Balloon Text Char;}{\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0
+\rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext24 \spriority0 \styrsid9260867 CellBodyLeft;}{\*\cs25 \additive \b\f2\cf13 \spriority0 \styrsid9260867
+CodeCharacter;}{\*\ts26\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon11 \snext26 \spriority59 \styrsid9260867 Table Grid;}}{\*\revtbl {Unknown;}{Zhu, Yonghong;}}{\*\rsidtbl \rsid540413\rsid622540\rsid746529\rsid1516182\rsid1837945\rsid2960814\rsid3044027\rsid3803771\rsid3881082\rsid4939999\rsid4999604\rsid5911148\rsid8600807\rsid9260867
+\rsid10040013\rsid11362432\rsid11799969\rsid12198464\rsid15757365}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}
+{\creatim\yr2011\mo7\dy18\hr16\min10}{\revtim\yr2016\mo8\dy9\hr10\min24}{\version14}{\edmins119}{\nofpages3}{\nofwords642}{\nofchars3665}{\nofcharsws4299}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
+\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot11362432 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \hich )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0
+\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 GenDepex.exe or GenDepex.py \hich\f43 \endash \loch\f43 Convert the dependency string of file to the binary PI dependency expression. }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid1516182
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 GenDepex.exe }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10040013 \hich\af43\dbch\af31505\loch\f43 [-q | -v | -d]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid3044027 \hich\af43\dbch\af31505\loch\f43 [-m]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9260867 \hich\af43\dbch\af31505\loch\f43 [-o }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1837945
+\hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9260867 \hich\af43\dbch\af31505\loch\f43 Output}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1837945 \hich\af43\dbch\af31505\loch\f43 F}{
+\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9260867 \hich\af43\dbch\af31505\loch\f43 ile}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1837945 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid9260867 \hich\af43\dbch\af31505\loch\f43 ]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10040013 \hich\af43\dbch\af31505\loch\f43 \hich\f43 \endash \loch\f43 t }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid1837945 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10040013 \hich\af43\dbch\af31505\loch\f43 ModuleType}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1837945
+\hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid10040013 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid3044027 \loch\af43\dbch\af31505\hich\f43 \endash
+\loch\f43 e }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2960814 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid3044027 \hich\af43\dbch\af31505\loch\f43 Expression}{\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid2960814 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid3044027 \hich\af43\dbch\af31505\loch\f43 |}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182
+\hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2960814 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43
+dependency_expression_file}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1837945 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9260867 \hich\af43\dbch\af31505\loch\f43 GenDepex.exe \hich\f43 \endash \loch\f43 h
+\par \hich\af43\dbch\af31505\loch\f43 GenDepex.exe --version}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid9260867
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 GenDepex generate}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3881082 \hich\af43\dbch\af31505\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182
+\hich\af43\dbch\af31505\loch\f43 the binary PI dependency expression according to module type}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3881082 \hich\af43\dbch\af31505\loch\f43
+ by parsing the input dependency expression string or the preprocessed dxs file}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43
+. For PEIM module type, the PEI dependency expression will be generated. For DXE_DRIVER, UEFI_DRIVER, DXE_RUNTIME_DRIVER, DXE_SAL_DRIVER and DXE_SMM_DRIVER, the DXE dependency e\hich\af43\dbch\af31505\loch\f43 xpression will be generated.}{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1516182
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 GenDepex tool is not a standalone tool. When [depex] section is specified in module INF, it will be used by }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid15757365 \hich\af43\dbch\af31505\loch\f43 the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Build tool. }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15757365
+\hich\af43\dbch\af31505\loch\f43 The }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Build tool first parses the content in [depex] section to create the dependency expression string,
+\hich\af43\dbch\af31505\loch\f43 then GenDepex will parse the generated string. When}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15757365 \hich\af43\dbch\af31505\loch\f43 a}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182
+\hich\af43\dbch\af31505\loch\f43 [depex] section is not specified, but File.dxs file exist, GenDepex tool will be used together with }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15757365 \hich\af43\dbch\af31505\loch\f43 the }{\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Compiler and }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15757365 \hich\af43\dbch\af31505\loch\f43 the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 EDKII trim too}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15757365 \hich\af43\dbch\af31505\loch\f43 l}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182
+\hich\af43\dbch\af31505\loch\f43 . The File.dxs first is preprocessed by Compiler, }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15757365 \hich\af43\dbch\af31505\loch\f43 and then}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182
+\hich\af43\dbch\af31505\loch\f43 process\hich\af43\dbch\af31505\loch\f43 ed by }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15757365 \hich\af43\dbch\af31505\loch\f43 the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182
+\hich\af43\dbch\af31505\loch\f43 trim tool to remove all other code except for }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15757365 \hich\af43\dbch\af31505\loch\f43 the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182
+\hich\af43\dbch\af31505\loch\f43 dependency content, last}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15757365 \hich\af43\dbch\af31505\loch\f43 ly the}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182
+\hich\af43\dbch\af31505\loch\f43 GenPepex will process the preprocessed dependency file.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Options
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11799969\charrsid12198464 \hich\af43\dbch\af31505\loch\f43 If no options ar}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11799969 \hich\af43\dbch\af31505\loch\f43 e specified, tool prints error message.}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4939999
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 dependency_expression_file}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid1516182
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Specify the name o\hich\af43\dbch\af31505\loch\f43
+f the preprocessed dxs file to be parsed into the binary PI dependency expression.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1516182
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 -o FILE, --output=FILE
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43
+Specify the name of depex file that contains the generated binary PI dependency expression.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1516182
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 -t MODULETYPE, --module-type=MODULETYPE
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43
+The type of module is for which the dependency expression serves. Only EDKII module type is supported.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1516182
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 -e EXPRESSION, --dependency-expression=EXPRESSION
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43
+The option value is the string of dependency expression. If this option presents, the input file will b\hich\af43\dbch\af31505\loch\f43 e ignored.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 -m, --optimize}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid1516182
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43
+Do some simple optimization on the expression to remove the duplicated guid.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1516182
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 -v, --verbose}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid1516182
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 \tab Run with verbose information.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1516182
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 -d DEBUG, --debug=DEBUG [0-9]}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid1516182
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Enable debug messages at specified level.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 -q, --quiet}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid1516182
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Run with little information in quiet mode.}{\rtlch\fcs1 \af0\afs18
+\ltrch\fcs0 \f0\fs18\cf1\insrsid1516182
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 --version}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid1516182
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Show program's version number and exit
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 -h, --help
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Show this help message and exit
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid9260867 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9260867 {\*\bkmkstart OLE_LINK3}{\*\bkmkstart OLE_LINK4}\hich\af43\dbch\af31505\loch\f43
+Status codes returned}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9260867\charrsid4999604
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid9260867 0}{\rtlch\fcs1
+\ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\lang1033\langfe2052\kerning2\langfenp2052\insrsid9260867 \cell }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid9260867 \hich\af43\dbch\af13\loch\f43 The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0
+\kerning2\insrsid9260867 \cell }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid9260867 \trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb
+\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row \ltrrow}\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid9260867
+\hich\af2\dbch\af13\loch\f2 1}{\rtlch\fcs1 \af41\afs19 \ltrch\fcs0 \cs25\f41\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid9260867\charrsid8600807 \cell }\pard \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid746529\yts26 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid9260867 \hich\af43\dbch\af13\loch\f43 The action failed.\cell
+}\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1
+\af37\afs20 \ltrch\fcs0 \fs20\insrsid9260867 \trowd \irow1\irowband1\lastrow \ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1516182 {\*\bkmkend OLE_LINK3}{\*\bkmkend OLE_LINK4}\hich\af43\dbch\af31505\loch\f43 Example
+
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 1. Parse the input dependency string based on DXE_DRIVER module type to generate the binary PI dependency expression into the output test.depex file.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 GenDepex.exe -o test.depex -t DXE_DRIVER -e "\{ 0x26baccb2, 0x6f42, 0x11d4, \{\hich\af43\dbch\af31505\loch\f43
+0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81\} }{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid1516182 \}}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 AND \{
+ 0xf617b358, 0x12cf, 0x414a, 0xa0, 0x69, 0x60, 0x67, 0x7b, 0xda, 0x13, 0xb3 \} END"
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 2. Parse the input dependency string based on DXE_DRIVER module type to generate the binary PI dependency expression in\hich\af43\dbch\af31505\loch\f43
+to the output test.depex file in the optimization mode.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1516182
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 GenDepex -o test.depex -t DXE_DRIVER -e "\{ 0x26baccb2, 0x6f42, 0x11d4, \{0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81\} \} AND \{
+ 0x26baccb2, 0x6f42, 0x11d4, \{0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x8\hich\af43\dbch\af31505\loch\f43 1\} \} END" -m}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid1516182
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Same to
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 GenDepex -o test.depex -t DXE_DRIVER -e "\{ 0x26baccb2, 0x6f42, 0x11d4, \{0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81\} \} END"
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 3. Parse the input preprocessed dependency file (test.iii) based on DXE_DRIVER module type to generate the b\hich\af43\dbch\af31505\loch\f43
+inary PI dependency expression into the output test.depex.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1516182
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 GenDepex \hich\f43 \endash \loch\f43 o test.depex \hich\f43 \endash \loch\f43 t DXE_DRIVER test.iii
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Test.iii file is the preprocessed dxs file like:
+\par \hich\af43\dbch\af31505\loch\f43 DEPENDENCY_START
+\par \hich\af43\dbch\af31505\loch\f43 \{ 0x26baccb2, 0x6f42, 0x11d4, \{0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81\} \} AND
+\par \hich\af43\dbch\af31505\loch\f43 \{ 0xf617b358, 0x12cf, 0x414a, 0xa0, 0x69, 0x60, 0x67, 0x7b, 0xda, 0x13, 0xb3 \}
+\par \hich\af43\dbch\af31505\loch\f43 DEPENDENCY_END
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 No known bugs.
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe1033\revauth1\revdttm1195920024\langfenp1033\insrsid622540\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-
+\hich\af43\dbch\af31505\loch\f43 devel\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel1\revdttmdel1195920024\insrsid1516182\delrsid622540
+\hich\af43\dbch\af31505\loch\f43 edk2-buildtools-devel@lists.sourceforge.net}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1516182
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid11362432 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 2007 - 2011}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 , Intel Corporation. A\hich\af43\dbch\af31505\loch\f43 ll rights reserved.
+
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licensed and made available
+\par \hich\af43\dbch\af31505\loch\f43 under the terms and conditions of the BSD License which accompanies this
+\par \hich\af43\dbch\af31505\loch\f43 distribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http://opensource.org/lic\hich\af43\dbch\af31505\loch\f43 enses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1516182 \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\insrsid1516182
+\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid1516182
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210030dd4329a8060000a41b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d331115bebc4eb813bf83291b63624a0d1475a756c734f9bbc2cd28546ecbe1e20a3794ca175f3fae90
+fb6d2dd99bb07b55e5ccf68942bd0877b23c77b908e8db5f9db7f024d9239010f35bd4bbe2fcae387bfff9e2bc289f2fbe24cfaa301468dd8bd846dbb4ddf1c2
+ae7b4c191ba8292337a469bc25ec3d411f06f53a73e224c5292c8de0516732307070a1c0660d125c7d44553488700a4d7bddd3444299910e254ab984c3a219ae
+a4adf1d0f82b7bd46cea4388ad1c12ab5d1ed8e1153d9c9f350a3246aad01c6873462b9ac05999ad5cc988826eafc3acae853a33b7ba11cd1445875ba1b236b1
+399483c90bd560b0b0263435085a21b0f22a9cf9356b38ec6046026d77eba3dc2dc60b17e92219e180643ed27acffba86e9c94c7ca9c225a0f1b0cfae0788ad5
+4adc5a9aec1b703b8b93caec1a0bd8e5de7b132fe5113cf312503b998e2c2927274bd051db6b35979b1ef271daf6c6704e86c73805af4bdd476216c26593af84
+0dfb5393d964f9cc9bad5c313709ea70f561ed3ea7b053075221d51696910d0d339585004b34272bff7213cc7a510a5454a3b349b1b206c1f0af490176745d4b
+c663e2abb2b34b23da76f6352ba57ca2881844c1111ab189d8c7e07e1daaa04f40255c77988aa05fe06e4e5bdb4cb9c5394bbaf28d98c1d971ccd20867e556a7
+689ec9166e0a522183792b8907ba55ca6e943bbf2a26e52f48957218ffcf54d1fb09dc3eac04da033e5c0d0b8c74a6b43d2e54c4a10aa511f5fb021a07533b20
+5ae07e17a621a8e082dafc17e450ffb739676998b48643a4daa7211214f623150942f6a02c99e83b85583ddbbb2c4996113211551257a656ec1139246ca86be0
+aadedb3d1441a89b6a929501833b197fee7b9641a3503739e57c732a59b1f7da1cf8a73b1f9bcca0945b874d4393dbbf10b1680f66bbaa5d6f96e77b6f59113d
+316bb31a795600b3d256d0cad2fe354538e7566b2bd69cc6cbcd5c38f0e2bcc63058344429dc2121fd07f63f2a7c66bf76e80d75c8f7a1b622f878a18941d840
+545fb28d07d205d20e8ea071b283369834296bdaac75d256cb37eb0bee740bbe278cad253b8bbfcf69eca23973d939b97891c6ce2cecd8da8e2d343578f6648a
+c2d0383fc818c798cf64e52f597c740f1cbd05df0c264c49134cf09d4a60e8a107260f20f92d47b374e32f000000ffff0300504b030414000600080000002100
+0dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f7
+8277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89
+d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd500
+1996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0f
+bfff0000001c0200001300000000000000000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6
+a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a
+0000001c00000000000000000000000000190200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d00140006000800000021
+0030dd4329a8060000a41b00001600000000000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d001400060008
+00000021000dd1909fb60000001b0100002700000000000000000000000000b20900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000ad0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e5000000000000000000000000b03c
+b02be5f1d101feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/GenFds_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/GenFds_Utility_Man_Page.rtf
new file mode 100644
index 000000000..9192bb699
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/GenFds_Utility_Man_Page.rtf
@@ -0,0 +1,413 @@
+{\rtf1\adeflang1025\ansi\ansicpg936\uc2\adeff0\deff0\stshfdbch13\stshfloch37\stshfhich37\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\f34\fbidi \froman\fcharset1\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f36\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
+{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\f38\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}
+{\f40\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\f41\fbidi \fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Verdana{\*\falt Verdana};}
+{\f42\fbidi \fmodern\fcharset0\fprq1{\*\panose 00000000000000000000}Consolas;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
+{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\f44\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\f45\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f47\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\f48\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\f49\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f50\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\f51\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\f52\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f64\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}{\f65\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}
+{\f67\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f68\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}{\f69\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}
+{\f70\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f71\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}{\f72\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}
+{\f176\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f404\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\f405\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\f407\fbidi \froman\fcharset161\fprq2 Cambria Greek;}
+{\f408\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\f411\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\f412\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\f414\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}
+{\f415\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}{\f417\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\f418\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\f421\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\f422\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}{\f424\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}
+{\f425\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}{\f427\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}{\f428\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}
+{\f429\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}{\f430\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}{\f431\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}
+{\f432\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}{\f433\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}{\f446\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\f454\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}{\f455\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f457\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}
+{\f458\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}{\f461\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f462\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}
+{\f464\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f465\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f467\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}{\f468\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}
+{\f471\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f472\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}
+{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}
+{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}
+{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}
+{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}
+{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}
+{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;}{\*\defchp \fs21\kerning2\loch\af37\hich\af37\dbch\af13 }{\*\defpap \ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }
+\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{
+\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat
+heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\f37\hich\af37\dbch\af13\cgrid\langnp1033\langfenp2052
+\snext11 \ssemihidden \sunhideused \sqformat Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f36\hich\af36\dbch\af13 \sbasedon10 \slink1 \slocked Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1
+\ab\ai\af0\afs28 \ltrch\fcs0 \b\i\fs28\loch\f36\hich\af36\dbch\af13 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\s17\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af38\afs16\alang1025 \ltrch\fcs0
+\fs16\lang1033\langfe1033\loch\f38\hich\af38\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext17 \slink18 \ssemihidden \styrsid9045387 Balloon Text;}{\*\cs18 \additive \rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16
+\sbasedon10 \slink17 \slocked \ssemihidden \styrsid9045387 Balloon Text Char;}{\*\cs19 \additive \rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \fs16 \sbasedon10 \ssemihidden \styrsid6561787 annotation reference;}{
+\s20\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe1033\loch\f41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext20 \slink21 \ssemihidden \styrsid6561787
+annotation text;}{\*\cs21 \additive \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f41\fs20 \sbasedon10 \slink20 \slocked \ssemihidden \styrsid6561787 Comment Text Char;}{\s22\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1
+\ab\af0\afs20\alang1025 \ltrch\fcs0 \b\fs20\lang1033\langfe1033\loch\f41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon20 \snext20 \slink23 \ssemihidden \styrsid6561787 annotation subject;}{\*\cs23 \additive \rtlch\fcs1 \ab\af0\afs20
+\ltrch\fcs0 \b\f41\fs20 \sbasedon21 \slink22 \slocked \ssemihidden \styrsid6561787 Comment Subject Char;}{\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\f41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext24 \styrsid10972537 CellBodyLeft;}{\*\cs25 \additive \b\f2\cf13 \styrsid10972537 CodeCharacter;}{\*\ts26\tsrowd
+\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f37\hich\af37\dbch\af13\cgrid\langnp1033\langfenp2052 \sbasedon11 \snext26 \styrsid10972537
+Table Grid;}{\s27\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af38\afs16\alang1025 \ltrch\fcs0 \fs16\lang1033\langfe1033\loch\f38\hich\af38\dbch\af13\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext27 \slink28 \ssemihidden \sunhideused \styrsid4485839 Document Map;}{\*\cs28 \additive \rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\lang0\langfe1033\kerning0\langfenp1033 \sbasedon10 \slink27 \slocked \ssemihidden \styrsid4485839
+Document Map Char;}}{\*\rsidtbl \rsid2295390\rsid2305826\rsid3830244\rsid4485839\rsid4999604\rsid5316845\rsid5513321\rsid5911148\rsid6561787\rsid8089322\rsid8600807\rsid8933181\rsid9045387\rsid9519395\rsid9709990\rsid9780763\rsid10972537\rsid11487336
+\rsid11805687\rsid12198464\rsid12201627\rsid12915296\rsid12991318\rsid13252123\rsid13254357\rsid13310497\rsid13923130\rsid14303388\rsid16126217}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440
+\mintLim0\mnaryLim1}{\info{\operator yzeng15}{\creatim\yr2010\mo10\dy6\hr16\min46}{\revtim\yr2011\mo8\dy31\hr14\min14}{\version22}{\edmins57}{\nofpages2}{\nofwords932}{\nofchars5416}{\nofcharsws6336}{\vern32771}}{\*\xmlnstbl {\xmlns1 http://schemas.micros
+oft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab360\ftnbj\aenddoc\trackmoves1\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120\dghorigin1701
+\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind5\viewscale120\rsidroot9045387 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}
+{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang
+{\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang
+{\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar
+\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af41\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid5513321\charrsid13310497 \hich\af41\dbch\af13\loch\f41 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid5513321\charrsid13310497 \hich\af41\dbch\af13\loch\f41 GenFds.exe
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af41\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9045387\charrsid13310497 \hich\af41\dbch\af13\loch\f41 Synopsis}{\rtlch\fcs1 \ab\af41\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid9045387\charrsid16126217
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid9780763 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af41\afs18
+\ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9780763 \hich\af41\dbch\af13\loch\f41 GenFds}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9780763\charrsid8089322 \hich\af41\dbch\af13\loch\f41 .exe }{\rtlch\fcs1
+\ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9780763 \hich\af41\dbch\af13\loch\f41 [}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 -v | -q | -d}{\rtlch\fcs1
+\ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9780763 \hich\af41\dbch\af13\loch\f41 ]}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 [-w }{\rtlch\fcs1 \ab\af41\afs18
+\ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 <}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 Workspace}{
+\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 >}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130
+\hich\af41\dbch\af13\loch\f41 ] [-D }{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 <}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 Macro=Value}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 >}{\rtlch\fcs1
+\ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 ]}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \loch\af41\dbch\af13\hich\f41 \'85}
+{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 [-a }{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990
+\hich\af41\dbch\af13\loch\f41 <}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 Arch}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 L}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 ist}{\rtlch\fcs1 \ab\af41\afs18
+\ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 >}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 ] [-o }{\rtlch\fcs1
+\ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 <}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41
+Output}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 D}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130
+\hich\af41\dbch\af13\loch\f41 ir}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 >}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 ]}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2305826 \hich\af41\dbch\af13\loch\f41 [-r }{\rtlch\fcs1
+\ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 <}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2305826 \hich\af41\dbch\af13\loch\f41 Fd}{
+\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 N}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2305826
+\hich\af41\dbch\af13\loch\f41 ame}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 >}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2305826 \hich\af41\dbch\af13\loch\f41 ] [-i }{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 <}{\rtlch\fcs1
+\ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2305826 \hich\af41\dbch\af13\loch\f41 Fv}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 N}{
+\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2305826 \hich\af41\dbch\af13\loch\f41 ame}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990
+\hich\af41\dbch\af13\loch\f41 >}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2305826 \hich\af41\dbch\af13\loch\f41 ]}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 }{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid12991318 \hich\af41\dbch\af13\loch\f41 [-C <CapsuleImage>] }{
+\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \loch\af41\dbch\af13\hich\f41 \endash \loch\f41 f }{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990
+\hich\af41\dbch\af13\loch\f41 <}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 Fdf}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 F}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 ile}{\rtlch\fcs1 \ab\af41\afs18
+\ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 >}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 \hich\f41 \endash
+\loch\f41 b }{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 <}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130
+\hich\af41\dbch\af13\loch\f41 Build}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 T}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 arget}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 >}{\rtlch\fcs1
+\ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 \hich\f41 \endash \loch\f41 t }{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990
+\hich\af41\dbch\af13\loch\f41 <}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 Tag}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 N}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 ame}{\rtlch\fcs1 \ab\af41\afs18
+\ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 >}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 \hich\f41 \endash
+\loch\f41 p }{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 <}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130
+\hich\af41\dbch\af13\loch\f41 Platform}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 F}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13923130 \hich\af41\dbch\af13\loch\f41 ile}{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9709990 \hich\af41\dbch\af13\loch\f41 >}{\rtlch\fcs1 \ab\af41\afs18
+\ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9780763
+\par }{\rtlch\fcs1 \ab\af41\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2305826 \hich\af41\dbch\af13\loch\f41 GenFds.exe \hich\f41 \endash \loch\f41 h
+\par \hich\af41\dbch\af13\loch\f41 GenFds.exe --version}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\langfenp2052\insrsid2305826\charrsid8089322
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af41\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5513321\charrsid13310497 \hich\af41\dbch\af13\loch\f41 Description
+\par }\pard\plain \ltrpar\ql \li60\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin60\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af41\afs18
+\ltrch\fcs0 \fs18\lang1033\langfe2052\langfenp2052\insrsid16126217 \hich\af41\dbch\af13\loch\f41 GenFds}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\insrsid16126217 \hich\af41\dbch\af13\loch\f41
+ generates the Ffs, Fv, FD and Section data depending on the selected command line options.}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\lang1033\langfe2052\langfenp2052\insrsid16126217 \hich\af41\dbch\af13\loch\f41 It}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\insrsid16126217 \hich\af41\dbch\af13\loch\f41 }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\insrsid13310497 \hich\af41\dbch\af13\loch\f41 gets the}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\insrsid5513321 \hich\af41\dbch\af13\loch\f41
+ platform, flash and module information from }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\insrsid13310497 \hich\af41\dbch\af13\loch\f41 the }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\insrsid5513321 \hich\af41\dbch\af13\loch\f41 target.txt,}{\rtlch\fcs1
+\af41\afs18 \ltrch\fcs0 \fs18\lang1033\langfe2052\langfenp2052\insrsid12201627 \hich\af41\dbch\af13\loch\f41 }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\insrsid5513321 \hich\af41\dbch\af13\loch\f41
+platform.dsc, flashmap.fdf, package.dec and module.inf. The FDF file must be }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\insrsid9045387 \hich\af41\dbch\af13\loch\f41 specified}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\lang1033\langfe2052\langfenp2052\insrsid12201627 \hich\af41\dbch\af13\loch\f41 }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\insrsid13310497 \hich\af41\dbch\af13\loch\f41 and }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\insrsid5513321
+\hich\af41\dbch\af13\loch\f41 follow the }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\insrsid13310497 \hich\af41\dbch\af13\loch\f41 correct FDF specification or the build will stop with an exception}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\insrsid5513321
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 The FDF file describes inf\hich\af41\dbch\af13\loch\f41 ormation about flash parts}
+{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9045387 ,}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 as well as rules for combining binaries}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid9045387 ,}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41
+ (Firmware Image) built from a DSC file. The output of the first phase of an EDK II build (as defined in the EDK II Build Specification) generates valid PE32/PE32+/Coff image files. GenFds\hich\af41\dbch\af13\loch\f41
+ performs the second phase of the build process during which consumes the images generated during the first phase, using statements and rules defined in the FDF file to place the PE32/PE32+/Coff images files into one or more EFI sections}{\rtlch\fcs1
+\af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13310497 \hich\af41\dbch\af13\loch\f41 . The}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid12201627 \hich\af41\dbch\af13\loch\f41 }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 EFI sections \hich\af41\dbch\af13\loch\f41 may }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9045387 \hich\af41\dbch\af13\loch\f41 be }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41
+combined with other optional sections (version, depex, user interface) sections, into EFI Firmware File system (FFS) Sections. FFS images are put into Firmware Volumes (FVs,) and finally, the FV sections are combined into one or more Flash Device bi
+\hich\af41\dbch\af13\loch\f41 nary image (FD.)
+\par \hich\af41\dbch\af13\loch\f41 The outputDir must be }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9045387 \hich\af41\dbch\af13\loch\f41 specified}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 . T}{
+\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9045387 \hich\af41\dbch\af13\loch\f41 he t}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41
+ool will generate a FV directory which includes a FFS directory, Fv file, Fv INf file and Fd file. The FFS directory }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9045387 \hich\af41\dbch\af13\loch\f41 contains }{\rtlch\fcs1 \af41\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 all modules directory which }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9045387 \hich\af41\dbch\af13\loch\f41 contains }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Ffs files and section files. All outpu\hich\af41\dbch\af13\loch\f41 t of GenFds tool will be in }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9045387 \hich\af41\dbch\af13\loch\f41 the }{
+\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 FV directory. The FV directory structure is }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9045387 \hich\af41\dbch\af13\loch\f41 as }{\rtlch\fcs1
+\af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 follow}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9045387 \hich\af41\dbch\af13\loch\f41 s.}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321
+\hich\af41\dbch\af13\loch\f41 The outputDir should be part of Efi file path. }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 For}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321
+\hich\af41\dbch\af13\loch\f41 each of }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 the }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 module }{\rtlch\fcs1
+\af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 described }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 in the FDF file }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 such as }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 the \hich\f41 \lquote \loch\f41 InfFIle\hich\f41 \rquote \loch\f41
+ statement format the GenFds tool }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 will determing the }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 \hich\f41
+ input files from the path of \'93\loch\f41 $(outputDir)\\ $(Arch) \\ $(ActivePlatformName) \\$(ModuleName) \\$(ModuleName) \\DEBUG
+\par }\pard \ltrpar\ql \fi-360\li420\ri0\sb200\nowidctlpar\tx420\wrapdefault\faauto\rin0\lin420\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 1.\tab If Arch list was }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 specified}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 , }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41
+the }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 GenFds tool will use this Arch instead of Arch List in Target.txt file
+\par }\pard \ltrpar\ql \fi-360\li420\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin420\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 2.\tab If Workspace\hich\af41\dbch\af13\loch\f41 was not }{\rtlch\fcs1
+\af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 specified}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 , }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123
+\hich\af41\dbch\af13\loch\f41 the }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 GenFds tool will use the Workspace path set in OS environment.
+\par \hich\af41\dbch\af13\loch\f41 3.\tab If ActivePlatform was }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 specified}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41
+, GenFds tool will use th}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 e}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41
+ active platform as the current platform instead of active platform in Target.txt file.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 GenFds tool support}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123
+\hich\af41\dbch\af13\loch\f41 s}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 2 kinds of path in command line}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8933181
+\hich\af41\dbch\af13\loch\f41 :}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Absolute path and relative workspace path. The GenFds tool also support}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 s}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 $(WORKSPACE) marco in path. For example, if the input Fdf }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 is }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 $(WORKSPACE)\\NT32PKg\\Nt32.fdf, the tool will expand the $(WORKSPACE) macro with real pat
+\hich\af41\dbch\af13\loch\f41 h.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af41\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Options}{\rtlch\fcs1 \ab\af41\afs28 \ltrch\fcs0
+\b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid5513321
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid11487336 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af41\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid3830244\charrsid12198464 \hich\af41\dbch\af13\loch\f41 If no options ar}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3830244 \hich\af41\dbch\af13\loch\f41 e specified, tool prints }{\rtlch\fcs1 \af41\afs18
+\ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid3830244 \hich\af41\dbch\af13\loch\f41 error message}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3830244 .}{\rtlch\fcs1 \af0 \ltrch\fcs0
+\lang1033\langfe2052\langfenp2052\insrsid3830244\charrsid11487336
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 -a, --arch <ARCHS>
+\par }\pard \ltrpar\ql \fi1\li425\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin425\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41
+ARCHS is a comma separated (no space) list containing one or more of: IA32, X64, IPF or EBC }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 when}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321
+\hich\af41\dbch\af13\loch\f41 built, overrides target.txt\hich\f41 \rquote \loch\f41 s TARGET_ARCH
+\par }\pard \ltrpar\ql \fi-425\li425\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin425\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 -p, --platform PlatformName.ds\hich\af41\dbch\af13\loch\f41 c
+\par }\pard \ltrpar\ql \li426\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin426\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Build}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123
+\hich\af41\dbch\af13\loch\f41 s}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 the platform specified by the DSC file name argument, over rides the ACTIVE_PLATFORM
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 -f, --filename Filename\tab \tab \tab
+\par }\pard \ltrpar\ql \fi426\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Input FDF file and its format must follow FDF specification.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 -r, --rom_image FdUiName\tab \tab \tab \tab
+\par }\pard \ltrpar\ql \fi425\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Build}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123
+\hich\af41\dbch\af13\loch\f41 s}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 the image using the [FD] section named by FdUiName.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 -i, --FvImage UiFvName
+\par \tab }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 Builds}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 the FV image using the [FV] section named by UiFvName}{
+\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5513321
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid11805687 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11805687 -}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11805687 \hich\af41\dbch\af13\loch\f41 C}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11805687 \hich\af41\dbch\af13\loch\f41 , --}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid11805687\charrsid11805687 \hich\af41\dbch\af13\loch\f41 CapsuleImage}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11805687 \hich\af41\dbch\af13\loch\f41 Ui}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11805687 \hich\af41\dbch\af13\loch\f41 Cap}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11805687 \hich\af41\dbch\af13\loch\f41 Name
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\pnrdate1190691426\pnrnot1\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11805687 \tab }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11805687\charrsid11805687
+\hich\af41\dbch\af13\loch\f41 Build the Capsule image using the [Capsu}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11805687 \hich\af41\dbch\af13\loch\f41 le] section named by UiCapName}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11805687\charrsid11805687
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 -o, --output Dir
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 The output directory of Genfds tool. }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 This}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 directory also should be the directory of the EFI file.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 -w \hich\f41 \endash \loch\f41 -workspace
+\par \tab \hich\af41\dbch\af13\loch\f41 The }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 current }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 workspace path }{
+\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid5513321
+\par }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 -b --buildtarget DEBUG|RELEASE
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Build target is one of: DEBUG, RELEASE}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid4485839 ,\hich\af41\dbch\af13\loch\f41 NOOPT}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 .}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid5513321
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 -t --tagname TOOLCHAIN_TAG
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Specif}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123
+\hich\af41\dbch\af13\loch\f41 ies}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 the tool chain to build the platform.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid5513321
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 -D --define MACRO=VALUE
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Pass macro to this tool.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid5513321
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 -s --specifyaddress ADDRESS
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Specif}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123
+\hich\af41\dbch\af13\loch\f41 ies}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 driver load address.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid5513321
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 [--version]
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid5513321 \tab }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Print version and copyright of this program and exit
+\par \hich\af41\dbch\af13\loch\f41 [-v, --verbose]
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13310497 \hich\af41\dbch\af13\loch\f41 Enable}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321
+\hich\af41\dbch\af13\loch\f41 verbose output with \hich\af41\dbch\af13\loch\f41 informational messages printed. This is a count value, so specifying \hich\f41 \endash \loch\f41 vv can be used to increase the verbosity level.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 [-q, --quiet]
+\par \tab }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13252123 \hich\af41\dbch\af13\loch\f41 Disable}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 all messages except FATAL ERRORS
+\par \hich\af41\dbch\af13\loch\f41 [-d, --debug [#]]
+\par \tab \hich\af41\dbch\af13\loch\f41 Enable debug messages, at level #
+\par \hich\af41\dbch\af13\loch\f41 [-h, --help]
+\par \tab \hich\af41\dbch\af13\loch\f41 Print copyright\hich\af41\dbch\af13\loch\f41 , version and usage of this program and exit
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid10972537 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af41\afs28 \ltrch\fcs0 \b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid10972537 {\*\bkmkstart OLE_LINK3}{\*\bkmkstart OLE_LINK4}
+{\*\bkmkstart OLE_LINK5}\hich\af41\dbch\af13\loch\f41 Status codes returned}{\rtlch\fcs1 \ab\af41\afs28 \ltrch\fcs0 \b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid10972537\charrsid4999604
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb
+\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil \cellx8712
+\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0
+\fs16\cf1\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid10972537 0}{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs25\b\f2\fs18\lang1033\langfe2052\kerning2\langfenp2052\insrsid10972537 \cell }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid10972537 \hich\af41\dbch\af13\loch\f41 The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \kerning2\insrsid10972537
+\cell }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {
+\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid10972537 \trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb
+\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil \cellx8712
+\row \ltrrow}\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0
+\fs16\cf1\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid14303388 \hich\af2\dbch\af13\loch\f2 Nonzero}{
+\rtlch\fcs1 \af42\afs19 \ltrch\fcs0 \cs25\f42\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid10972537\charrsid8600807 \cell }\pard \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5316845\yts26 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid10972537 \hich\af41\dbch\af13\loch\f41 The action failed.\cell
+}\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1
+\af37\afs20 \ltrch\fcs0 \fs20\insrsid10972537 \trowd \irow1\irowband1\lastrow \ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb
+\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil \cellx8712
+\row }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af41\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5513321 {\*\bkmkend OLE_LINK3}{\*\bkmkend OLE_LINK4}{\*\bkmkend OLE_LINK5}\hich\af41\dbch\af13\loch\f41
+Example
+\par }\pard\plain \ltrpar\ql \li60\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin60\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af41\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 1. WORKSPACE has already set. $(WORKSPACE) = c:\\work\\\hich\af41\dbch\af13\loch\f41 EdkII. The Fdf file is in c:\\work\\EdkII\\Nt32pkg\\Nt32pkg.fdf. Output directory is c:\\work\\EdkII\\
+Build\\Nt32\\Debug_MyTools. ActivePlatform is C:\\work\\EdkII\\Nt32Pkg\\Nt32Pkg.dsc
+\par \hich\af41\dbch\af13\loch\f41 GenFds \hich\f41 \endash \loch\f41 f c:\\work\\EdkII\\Nt32pkg\\Nt32pkg.fdf \hich\f41 \endash \loch\f41 o c:\\work\\EdkII\\Build\\Nt32\\Debug_MyTo\hich\af41\dbch\af13\loch\f41 ols \hich\f41 \endash \loch\f41 p c:\\work\\EdkII
+\\Nt32pkg\\Nt32Pkg.dsc
+\par \hich\af41\dbch\af13\loch\f41 GenFds \hich\f41 \endash \loch\f41 f $(WORKSPACE)\\Nt32Pkg\\Nt32Pkg.fdf \hich\f41 \endash \loch\f41 o $(WORSPACE)\\Build\\Nt32\\Debug_MyTools \hich\f41 \endash \loch\f41 p $(WORKSPACE)\\Nt32Pkg\\Nt32Pkg.dsc
+\par
+\par \hich\af41\dbch\af13\loch\f41 GenFds \hich\f41 \endash \loch\f41 f Nt32Pkg\\Nt32Pkg.fdf \hich\f41 \endash \loch\f41 o Build\\Nt32\\Debug_MyTools \hich\f41 \endash \loch\f41 p Nt32Pkg\\Nt32Pkg.dsc
+\par \hich\af41\dbch\af13\loch\f41 2. Generate on\hich\af41\dbch\af13\loch\f41 e FD which is defined in FDF file. Use \hich\f41 \lquote \loch\f41 -r\hich\f41 \rquote \loch\f41
+ and Fd UIName. The Fd UIName is the name which is defined in the FDf file, for detail information refer to FDF specification
+\par \hich\af41\dbch\af13\loch\f41 GenFds \hich\f41 \endash \loch\f41 f GenFds \hich\f41 \endash \loch\f41 f c:\\work\\EdkII\\Nt32pkg\\Nt32pkg.fdf \hich\f41 \endash \loch\f41 o c:\\work\\EdkII\\Build\\Nt32\\Debu\hich\af41\dbch\af13\loch\f41 g_MyTools
+\hich\f41 \endash \loch\f41 p c:\\work\\EdkII\\Nt32pkg\\Nt32Pkg.dsc \hich\f41 \endash \loch\f41 r Fv_Recovery
+\par \hich\af41\dbch\af13\loch\f41 3. Generate one FV which is defined in FDF file. Use \hich\f41 \lquote \loch\f41 -i\hich\f41 \rquote \loch\f41
+ and FV UiName. The FV UIName is the name which is defined in the FDF file, for detail information refers to FDF specification.
+\par \hich\af41\dbch\af13\loch\f41 GenFds \hich\f41 \endash \loch\f41 f\hich\af41\dbch\af13\loch\f41 c:\\work\\EdkII\\Nt32pkg\\Nt32pkg.fdf \hich\f41 \endash \loch\f41 o c:\\work\\EdkII\\Build\\Nt32\\Debug_MyTools \hich\f41 \endash \loch\f41 p c:\\work\\EdkII
+\\Nt32pkg\\Nt32Pkg.dsc \hich\f41 \endash \loch\f41 I FVRecovery
+\par
+\par \hich\af41\dbch\af13\loch\f41 4. Use command line option to replace the Arch List in Target.txt.
+\par \hich\af41\dbch\af13\loch\f41 GenFds \hich\f41 \endash \loch\f41 f c:\\work\\EdkII\\Nt32pkg\\Nt32pkg.fdf \hich\f41 \endash \loch\f41 o c:\\work\\EdkI\hich\af41\dbch\af13\loch\f41 I\\Build\\Nt32\\Debug_MyTools \hich\f41 \endash \loch\f41 p c:\\work\\EdkII
+\\Nt32pkg\\Nt32Pkg.dsc
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 -a IA32, X64
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af41\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 No know issues
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af41\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 target.txt, platform.dsc, flashmap.fdf, package.dec and module.inf.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af41\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5513321 \hich\af41\dbch\af13\loch\f41 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 GenFv, GenFfs, GenSection, GenFw.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af41\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5513321 \hich\af41\dbch\af13\loch\f41 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af41\hich\af41\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 Copyright (c) 1999 - }{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13310497 \hich\af41\dbch\af13\loch\f41 201}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9519395 \hich\af41\dbch\af13\loch\f41 1}{\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 , Intel Corporation. All rights reserved.
+\par \hich\af41\dbch\af13\loch\f41 This program and the accompanying materials are licensed and made available
+\par \hich\af41\dbch\af13\loch\f41 under the terms and conditions of the BSD License which accompanies this
+\par \hich\af41\dbch\af13\loch\f41 distribution. The full text of the license may be found at
+\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs18 \ltrch\fcs0 \fs18\insrsid5513321 \hich\af41\dbch\af13\loch\f41 htt\hich\af41\dbch\af13\loch\f41 p://opensource.org/licenses/bsd-license.php}{\rtlch\fcs1
+\af41\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5513321 \hich\af41\dbch\af13\loch\f41 . THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+\par }\pard \ltrpar\ql \li60\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin60\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid5513321
+\par }{\*\themedata 504b030414000600080000002100828abc13fa0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb6ac3301045f785fe83d0b6d8
+72ba28a5d8cea249777d2cd20f18e4b12d6a8f843409c9df77ecb850ba082d74231062ce997b55ae8fe3a00e1893f354e9555e6885647de3a8abf4fbee29bbd7
+2a3150038327acf409935ed7d757e5ee14302999a654e99e393c18936c8f23a4dc072479697d1c81e51a3b13c07e4087e6b628ee8cf5c4489cf1c4d075f92a0b
+44d7a07a83c82f308ac7b0a0f0fbf90c2480980b58abc733615aa2d210c2e02cb04430076a7ee833dfb6ce62e3ed7e14693e8317d8cd0433bf5c60f53fea2fe7
+065bd80facb647e9e25c7fc421fd2ddb526b2e9373fed4bb902e182e97b7b461e6bfad3f010000ffff0300504b030414000600080000002100a5d6a7e7c00000
+00360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4fc7060abb08
+84a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b63095120f88d94fbc
+52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462a1a82fe353
+bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f7468656d652f7468
+656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b4b0d592c9c
+070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b4757e8d3f7
+29e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f7468656d65
+312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87615b8116d8
+a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad79482a9c04
+98f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b5d8a314d3c
+94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab999fb7b471
+7509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9699640f671
+9e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd5868b37a088d1
+e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d60cf03ac1a5
+193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f9e7ef3f2d1
+17d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be15c308d3f2
+8acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a99793849c26ae6
+6252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d32a423279a
+668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2af074481847
+bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86e877f0034e
+16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb44f95d843b
+5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a6409fb44d0
+8741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c3d9058edf2
+c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db02565e85f3b966
+0d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276b9f7dec44b
+7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8c33585b5fb
+9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e51440ca2e0
+088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95b21be5ceaf
+8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff6dce591a26
+ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec69ffb9e65d0
+28d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239b75a5bb1e6
+345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a44959d366ad93
+b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e82db8df9f30
+254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468656d652f74
+68656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4350d363f24
+51eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d262452282e3198
+720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe514173d9850528
+a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100828abc13fa0000001c0200001300000000000000000000000000
+000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b000000000000000000000000
+002b0100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000140200007468
+656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b000016000000000000000000
+00000000d10200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b010000270000000000
+00000000000000009b0900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000960a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 Normal;
+\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 heading 1;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 heading 2;\lsdqformat1 \lsdpriority0 heading 3;\lsdqformat1 \lsdpriority0 heading 4;\lsdqformat1 \lsdpriority0 heading 5;
+\lsdqformat1 \lsdpriority0 heading 6;\lsdqformat1 \lsdpriority0 heading 7;\lsdqformat1 \lsdpriority0 heading 8;\lsdqformat1 \lsdpriority0 heading 9;\lsdsemihidden0 \lsdunhideused0 \lsdpriority0 toc 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority0 toc 2;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority0 toc 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority0 toc 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority0 toc 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority0 toc 6;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority0 toc 7;\lsdsemihidden0 \lsdunhideused0 \lsdpriority0 toc 8;\lsdsemihidden0 \lsdunhideused0 \lsdpriority0 toc 9;\lsdqformat1 \lsdpriority0 caption;
+\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 Title;\lsdsemihidden0 \lsdunhideused0 \lsdpriority0 Default Paragraph Font;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 Subtitle;
+\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdpriority0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;
+\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;
+\lsdunhideused0 \lsdlocked0 Revision;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;
+\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;
+\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;
+\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 0105000002000000180000004d73786d6c322e534158584d4c5265616465722e352e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffffec69d9888b8b3d4c859eaf6cd158be0f000000000000000000000000b0c9
+9231a567cc01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/GenFfs_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/GenFfs_Utility_Man_Page.rtf
new file mode 100644
index 000000000..7f0c34043
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/GenFfs_Utility_Man_Page.rtf
@@ -0,0 +1,339 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}
+{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}
+{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f258\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\f259\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f261\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\f262\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\f263\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f264\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\f265\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\f266\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f278\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}
+{\f279\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}{\f281\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f282\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}
+{\f283\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}{\f284\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f285\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}
+{\f286\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}{\f390\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f598\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}
+{\f599\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f601\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f602\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f605\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}
+{\f606\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f628\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\f629\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\f631\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\f632\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}{\f635\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}
+{\f636\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}{\f648\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f649\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}
+{\f651\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}{\f652\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f653\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}
+{\f654\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}{\f655\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f656\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}
+{\f657\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}{\f668\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f669\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f671\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}
+{\f672\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}{\f675\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f676\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f688\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f689\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f695\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f696\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1390\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
+{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
+{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext11 \ssemihidden \sunhideused
+Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\ai\af0\afs28 \ltrch\fcs0
+\b\i\fs28\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\*\cs17 \additive \rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \fs16 \sbasedon10 \ssemihidden \sunhideused \styrsid9311749 annotation reference;}{
+\s18\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext18 \slink19 \ssemihidden \sunhideused \styrsid9311749 annotation text;}{\*\cs19 \additive \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f43\fs20 \sbasedon10 \slink18 \slocked \ssemihidden \styrsid9311749 Comment Text Char;}{
+\s20\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0 \b\fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon18 \snext18 \slink21 \ssemihidden \sunhideused \styrsid9311749 annotation subject;}{\*\cs21 \additive \rtlch\fcs1 \ab\af0\afs20 \ltrch\fcs0 \b\f43\fs20 \sbasedon19 \slink20 \slocked \ssemihidden \styrsid9311749 Comment Subject Char;}{
+\s22\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0 \fs16\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext22 \slink23 \ssemihidden \sunhideused \styrsid9311749 Balloon Text;}{\*\cs23 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \f39\fs16 \sbasedon10 \slink22 \slocked \ssemihidden \styrsid9311749 Balloon Text Char;}{
+\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext24 \spriority0 \styrsid1326121 CellBodyLeft;}{\*\cs25 \additive \b\f2\cf13 \spriority0 \styrsid1326121 CodeCharacter;}{\*\ts26\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh
+\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon11 \snext26 \spriority59 \styrsid1326121 Table Grid;}}{\*\revtbl {Unknown;}{Zhu, Yonghong;}}{\*\rsidtbl \rsid1326121\rsid2566036\rsid2585461\rsid4000798\rsid4999604\rsid5911148\rsid7865390\rsid7959743\rsid8549383\rsid8600807\rsid9311749\rsid10970735\rsid11368657\rsid12198464
+\rsid16535783\rsid16590019}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}{\creatim\yr2010\mo10\dy6\hr15\min17}
+{\revtim\yr2016\mo8\dy9\hr10\min25}{\version12}{\edmins21}{\nofpages3}{\nofwords593}{\nofchars3381}{\nofcharsws3967}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
+\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot2566036 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \hich )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0
+\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 GenFfs.exe \hich\f43 \endash \loch\f43 build one PI firmware file.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 GenFfs.exe}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16590019 \hich\af43\dbch\af31505\loch\f43 [-v] [-x] [-s] [-a }{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2585461 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16590019
+\hich\af43\dbch\af31505\loch\f43 FileAlign}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2585461 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16590019 \hich\af43\dbch\af31505\loch\f43 ] \hich\f43 \endash \loch\f43 t }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2585461
+\hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16590019 \hich\af43\dbch\af31505\loch\f43 Type}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2585461 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16590019 \hich\af43\dbch\af31505\loch\f43 \hich\f43 \endash
+\loch\f43 g }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2585461 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16590019
+\hich\af43\dbch\af31505\loch\f43 FileGuid}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2585461 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16590019 \hich\af43\dbch\af31505\loch\f43 \hich\f43 \endash \loch\f43 i }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2585461
+\hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16590019 \hich\af43\dbch\af31505\loch\f43 InputFile[ -n SectionAlign]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2585461 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16590019 \hich\af43\dbch\af31505\loch\f43 \hich\f43 \endash
+\loch\f43 o }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2585461 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16590019
+\hich\af43\dbch\af31505\loch\f43 OutputFile}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2585461 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2566036
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16590019 \hich\af43\dbch\af31505\loch\f43 GenFfs.exe \hich\f43 \endash \loch\f43 h
+\par \hich\af43\dbch\af31505\loch\f43 GenFfs.exe --version}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16590019
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 GenFfs }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7959743 \hich\af43\dbch\af31505\loch\f43 generates}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036
+\hich\af43\dbch\af31505\loch\f43 FFS files for inclusion in a firmware volume. FFS file is the file system file for the firmware storage defined in the Volume 3 of the PI 1.0 specification. This utility }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid7959743 \hich\af43\dbch\af31505\loch\f43 aggregates}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 all of the \hich\af43\dbch\af31505\loch\f43
+file components into a single, correctly formed FFS file
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 Options}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid2566036
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid7865390 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid7865390\charrsid12198464 \hich\af43\dbch\af31505\loch\f43 If no options ar}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7865390 \hich\af43\dbch\af31505\loch\f43 e specified, tool prints usage.}{\rtlch\fcs1 \af0
+\ltrch\fcs0 \lang1033\langfe2052\langfenp2052\insrsid7865390\charrsid7865390
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 -o FileName, --outputfile FileName
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7959743 \hich\af43\dbch\af31505\loch\f43 Creates }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036
+\hich\af43\dbch\af31505\loch\f43 PI firmware file. This option is required.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 -t Type, --filetype Type
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43
+Type is one FV file type defined in PI spec, which is one type of EFI_FV_FILETYPE_RAW, EFI_FV_FILETYPE_FREEFORM, EFI_FV_FILETYPE_SECURITY_CORE, EFI_FV_FILETYPE_PEIM, EFI_FV_FILETYPE_PEI_CORE, EFI_FV_FILETYPE_DXE_CORE, EFI_FV_FILETYPE_DRIVER, EFI_FV_FILETY
+\hich\af43\dbch\af31505\loch\f43 P\hich\af43\dbch\af31505\loch\f43 E_APPLICATION, EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER, EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE. This option is required.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 -g FileGuid, --fileguid FileGuid
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43
+FileGuid is the unique identifier for this FFS file. Its format is 00000000-0000-0000-0000-000000000000. T\hich\af43\dbch\af31505\loch\f43 his option is required.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 -x, --fixed
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43
+Set fixed attribute in FFS file header to indicate that the file may not be moved from its present location.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 -s, --checksum
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43
+Set checksum attribute in FFS file header to calculate the whole file checksum.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 -a FileAlign, --\hich\af43\dbch\af31505\loch\f43 align FileAlign
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43
+FileAlign specifies FFS file alignment, which only support the following alignment: 8,16,128,512,1K,4K,32K,64K.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 -i SectionFile, --sectionfile SectionFile
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 Section file will be read into this FFS file. This option is required.
+
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 -n Sec\hich\af43\dbch\af31505\loch\f43
+tionAlign, --sectionalign SectionAlign
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43
+SectionAlign specifies this section file alignment in the FFS file, which support the alignment scope 1~64K. It is specified together with section}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7959743 \hich\af43\dbch\af31505\loch\f43 }{
+\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 file parameter.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 -v, --verbose
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 Turn on verbose output with information\hich\af43\dbch\af31505\loch\f43
+al messages.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 --version
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 Show program version number and exit
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 -h, --help
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 Show this help message and exit
+\par }\pard\plain \ltrpar\s2\ql \fi-1440\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid1326121 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1326121\charrsid16535783 \hich\af43\dbch\af31505\loch\f43 Status codes returned
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid1326121\charrsid8600807 \hich\af2\dbch\af13\loch\f2 STATUS_SUCCESS}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid1326121 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid1326121\charrsid4999604 \tab }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid1326121 0}{\rtlch\fcs1 \ab\af2\afs18
+\ltrch\fcs0 \cs25\b\f2\fs18\lang1033\langfe2052\kerning2\langfenp2052\insrsid1326121 \cell }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid1326121 \hich\af43\dbch\af13\loch\f43 The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0
+\kerning2\insrsid1326121 \cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid1326121 \trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb
+\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row \ltrrow}\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\kerning2\insrsid1326121\charrsid8600807 \hich\af2\dbch\af13\loch\f2
+STATUS_ERROR}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid1326121 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid1326121\charrsid4999604 \tab \tab }{\rtlch\fcs1
+\ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid1326121 \hich\af2\dbch\af13\loch\f2 2}{\rtlch\fcs1 \af41\afs19 \ltrch\fcs0 \cs25\f41\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid1326121\charrsid8600807
+\cell }\pard \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid4000798\yts26 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid1326121
+\hich\af43\dbch\af13\loch\f43 The action failed.\cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid1326121 \trowd \irow1\irowband1\lastrow \ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10
+\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 Example
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 1. Generate PeiCore FFS file with the input sections, fileguid, and the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43
+GenFfs -t EFI_FV_FILETYPE_PEI_CORE -g 52C05B14-0B98-496c-BC3B-04B50211D680 -i PeiMain.pe32 -i PeiMain.ui -i PeiMain.ver -o 52C05B14-0B98-496c-BC3B-04B50211D680-PeiMai\hich\af43\dbch\af31505\loch\f43 n.ffs
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 2. Generate PeiCore FFS file with the fixed, checksum attributes, the input sections with 16 byte alignment, the fileguid, and the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 GenFfs -t EFI_FV_FILETYPE_PEI_CORE -g 52C05B14-0B98-496c-BC3B-04B50211D680 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf6\insrsid2566036
+\loch\af43\dbch\af31505\hich\f43 \endash \loch\f43 x \hich\f43 \endash \loch\f43 s}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 -i PeiMain.pe32 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf6\insrsid2566036 \loch\af43\dbch\af31505\hich\f43 \endash \hich\af43\dbch\af31505\loch\f43 n 16}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43
+ -i PeiMain.ui -i PeiMain.ver -o 52C05B14-0B98-496c-BC3B-04B50211D680-PeiMain.ffs
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 3. Generate RAW type FFS file with the input raw files, checksum attribute, fileguid, and the output file name. The RAW type FFS file doesn\hich\f43 \rquote
+\loch\f43 t care whether the input files\hich\af43\dbch\af31505\loch\f43 are the formed section files or not.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 GenFfs \hich\f43 \endash \loch\f43 t EFI_FV_FILETYPE_RAW \hich\f43 \endash \loch\f43 g E8B33A4F-4C07-4e3f-A746-4A1E4036C5EC \hich\f43 \endash \loch\f43 s
+\hich\f43 \endash \loch\f43 i vendor.raw \hich\f43 \endash \loch\f43 o E8B33A4F-4C07-4e3f-A746-4A1E4036C5EC-vendor.raw
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 4. Generate FV type FFS file with the input FV section file, checksum attribute,\hich\af43\dbch\af31505\loch\f43 fileguid, and the output filename.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 GenFfs \hich\f43 \endash \loch\f43 t EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE \hich\f43 \endash \loch\f43 g 47C70572-CA18-455d-ABB9-B37FBA402AB2 \hich\f43
+\endash \loch\f43 s \hich\f43 \endash \loch\f43 i fvmain.fvsec \hich\f43 \endash \loch\f43 o 47C70572-CA18-455d-ABB9-B37FBA402AB2-fvmain.ffs
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 No known bugs.
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1195920025\insrsid10970735\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-\hich\af43\dbch\af31505\loch\f43 devel
+\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel1\revdttmdel1195920025\insrsid2566036\delrsid10970735 \hich\af43\dbch\af31505\loch\f43
+edk2-buildtools-devel@lists\hich\af43\dbch\af31505\loch\f43 .sourceforge.net}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid2566036
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 2007 - }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid7959743 \hich\af43\dbch\af31505\loch\f43 201}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11368657 \hich\af43\dbch\af31505\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 , Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licensed and made available
+\par \hich\af43\dbch\af31505\loch\f43 under the terms and conditions of the BSD License which accomp\hich\af43\dbch\af31505\loch\f43 anies this
+\par \hich\af43\dbch\af31505\loch\f43 distribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2566036 \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS
+\hich\af43\dbch\af31505\loch\f43 OR IMPLIED.
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb
+44f95d843b5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a
+6409fb44d08741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c
+3d9058edf2c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db0256
+5e85f3b9660d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276
+b9f7dec44b7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8
+c33585b5fb9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e
+51440ca2e0088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95
+b21be5ceaf8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff
+6dce591a26ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec6
+9ffb9e65d028d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239
+b75a5bb1e6345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a449
+59d366ad93b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e8
+2db8df9f30254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468
+656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4
+350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d2624
+52282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe5141
+73d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c020000130000000000000000
+0000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000
+000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c0000000000000000000000000019
+0200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b00001600000000
+000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b01000027
+00000000000000000000000000a00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009b0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e50000000000000000000000006098
+c94ce5f1d101feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/GenFv_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/GenFv_Utility_Man_Page.rtf
new file mode 100644
index 000000000..aed26c05a
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/GenFv_Utility_Man_Page.rtf
@@ -0,0 +1,430 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}
+{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}
+{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f258\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\f259\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f261\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\f262\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\f263\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f264\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\f265\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\f266\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f278\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}
+{\f279\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}{\f281\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f282\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}
+{\f283\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}{\f284\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f285\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}
+{\f286\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}{\f390\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f598\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}
+{\f599\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f601\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f602\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f605\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}
+{\f606\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f628\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\f629\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\f631\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\f632\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}{\f635\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}
+{\f636\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}{\f648\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f649\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}
+{\f651\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}{\f652\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f653\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}
+{\f654\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}{\f655\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f656\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}
+{\f657\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}{\f668\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f669\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f671\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}
+{\f672\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}{\f675\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f676\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f688\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f689\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f695\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f696\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1390\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
+{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
+{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext11 \ssemihidden \sunhideused
+Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\ai\af0\afs28 \ltrch\fcs0
+\b\i\fs28\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\*\cs17 \additive \rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \fs16 \sbasedon10 \ssemihidden \sunhideused \styrsid3301406 annotation reference;}{
+\s18\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext18 \slink19 \ssemihidden \sunhideused \styrsid3301406 annotation text;}{\*\cs19 \additive \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f43\fs20 \sbasedon10 \slink18 \slocked \ssemihidden \styrsid3301406 Comment Text Char;}{
+\s20\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0 \b\fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon18 \snext18 \slink21 \ssemihidden \sunhideused \styrsid3301406 annotation subject;}{\*\cs21 \additive \rtlch\fcs1 \ab\af0\afs20 \ltrch\fcs0 \b\f43\fs20 \sbasedon19 \slink20 \slocked \ssemihidden \styrsid3301406 Comment Subject Char;}{
+\s22\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0 \fs16\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext22 \slink23 \ssemihidden \sunhideused \styrsid3301406 Balloon Text;}{\*\cs23 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \f39\fs16 \sbasedon10 \slink22 \slocked \ssemihidden \styrsid3301406 Balloon Text Char;}{
+\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext24 \spriority0 \styrsid12207580 CellBodyLeft;}{\*\cs25 \additive \b\f2\cf13 \spriority0 \styrsid12207580 CodeCharacter;}{\*\ts26\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh
+\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon11 \snext26 \spriority59 \styrsid12207580 Table Grid;}}{\*\revtbl {Unknown;}{Zhu, Yonghong;}}{\*\rsidtbl \rsid209071\rsid1076770\rsid3171843\rsid3301406\rsid3608683\rsid3626962\rsid4195908\rsid4999604\rsid5861171\rsid5911148\rsid7107506\rsid7807742\rsid8600807\rsid12198464
+\rsid12207580\rsid14224643\rsid15426231\rsid15684614\rsid16349543}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}
+{\creatim\yr2010\mo11\dy8\hr12\min28}{\revtim\yr2016\mo8\dy9\hr10\min25}{\version13}{\edmins50}{\nofpages5}{\nofwords1073}{\nofchars6120}{\nofcharsws7179}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
+\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot3608683 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \hich )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0
+\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 GenFv.exe \hich\f43 \endash \loch\f43 build one PI firmware volume image or one UEFI capsule image.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 GenFv.exe}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5861171 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid209071 \loch\af43\dbch\af31505\hich\f43 \endash \loch\f43 p }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5861171
+\loch\af43\dbch\af31505\hich\f43 \endash \loch\f43 i }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid15684614 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5861171 \hich\af43\dbch\af31505\loch\f43 InputFile}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid15684614 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5861171 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid209071 \hich\af43\dbch\af31505\loch\f43 [
+}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5861171 \loch\af43\dbch\af31505\hich\f43 \endash \loch\f43 o }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid15684614 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5861171 \hich\af43\dbch\af31505\loch\f43 OutputFile}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid15684614 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid209071 \hich\af43\dbch\af31505\loch\f43
+]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid12207580
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid209071 \hich\af43\dbch\af31505\loch\f43 GenFv.exe}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14224643
+\hich\af43\dbch\af31505\loch\f43 [-v | -q | -d]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid209071 \hich\af43\dbch\af31505\loch\f43
+ [-b <BlockSize>] [-n <NumBlock>] [-f <FfsFile>] [-s <FileTakeSize>] [-r <Address>] [-a <AddressFile>] [-m <LogFile>] [-g }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14224643
+\hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid209071 \hich\af43\dbch\af31505\loch\f43 Guid}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14224643 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid209071 \hich\af43\dbch\af31505\loch\f43 ] [}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14224643 \hich\af43\dbch\af31505\loch\f43 --FvNameGuid }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14224643 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14224643 \hich\af43\dbch\af31505\loch\f43 Guid}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14224643 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid209071 \hich\af43\dbch\af31505\loch\f43 ]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14224643 \hich\af43\dbch\af31505\loch\f43
+ [}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14224643 \hich\af43\dbch\af31505\loch\f43 --capflag }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14224643 \hich\af43\dbch\af31505\loch\f43 <}{
+\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14224643 \hich\af43\dbch\af31505\loch\f43 CapFlag}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14224643 \hich\af43\dbch\af31505\loch\f43 >] [}{
+\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14224643 \hich\af43\dbch\af31505\loch\f43 --capheadsize }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14224643 \hich\af43\dbch\af31505\loch\f43 <}{
+\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14224643 \hich\af43\dbch\af31505\loch\f43 HeadSize}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14224643 \hich\af43\dbch\af31505\loch\f43 >] [-c]}{
+\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid209071 \hich\af43\dbch\af31505\loch\f43 \hich\f43 \endash \loch\f43 i <InputFile> \hich\f43 \endash \loch\f43 o <OutputFile>}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid209071\charrsid14224643
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid12207580 \hich\af43\dbch\af31505\loch\f43 GenFv.exe \hich\f43 \endash \loch\f43 h
+\par \hich\af43\dbch\af31505\loch\f43 GenFv.exe --version}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid4195908
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 GenFv }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3608683 \hich\af43\dbch\af31505\loch\f43 generates}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\insrsid4195908
+\hich\af43\dbch\af31505\loch\f43 a PI firmware volume image or a UEFI capsule image from the PI firmware files or the binary files, which conforms to the firmware volume image format defined in PI specification or uefi capsule image format d
+\hich\af43\dbch\af31505\loch\f43 efined in UEFI specification.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 This utility }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3608683 \hich\af43\dbch\af31505\loch\f43 aggregates the}{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43
+ Firmware File System (FFS2) files into a single FV image with FFS2 file system guid. The input files must be compliant with the PI 1.0 specification. The utility will create a FV header, append all \hich\af43\dbch\af31505\loch\f43
+of the FFS input files, and optionally}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3608683 ,}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43
+ add the FFS pad file for those FFS files that require the specific file alignment. When adding PEI files or dxe drivers, it will relocate them to the fixed flash address or the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3608683
+\hich\af43\dbch\af31505\loch\f43 preferred}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43
+ loaded memory address if necessary. Also, one symbol map file that contains the symbol information (Function and Variable) for each driver in the FV will be produced. This utility also responsible }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid3608683 \hich\af43\dbch\af31505\loch\f43 aggregates}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 the binary files into a single UEFI capsule ima\hich\af43\dbch\af31505\loch\f43
+ge with the UEFI capsule header.
+\par \hich\af43\dbch\af31505\loch\f43 GenFv takes as input the path/filename of the Fv.inf or Cap.inf file, the output file name, the starting physical address of the FV, the boot driver base address and the runtime driver base address of the address.inf file
+\hich\af43\dbch\af31505\loch\f43 to create the final Fv or Capsule image. This utility is usually called by GenFds tool, which parses platform.fdf file to create the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3608683
+\hich\af43\dbch\af31505\loch\f43 internal}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Fv.inf or Cap.inf. }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3608683 \hich\af43\dbch\af31505\loch\f43
+The internal Fv.inf and Cap.inf information is generally not used by end users. }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid4195908
+\hich\af43\dbch\af31505\loch\f43 Options}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid4195908
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid1076770 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid1076770\charrsid12198464 \hich\af43\dbch\af31505\loch\f43 If no\hich\af43\dbch\af31505\loch\f43 options ar}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1076770 \hich\af43\dbch\af31505\loch\f43
+e specified, tool prints usage.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\langfenp2052\insrsid1076770\charrsid1076770
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -o FileName, --outputfile FileName
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43
+The PI firmware volume image or Uefi Capsule image is created. This option is required.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -i FileName, --inputfile FileName}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid4195908
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 File is the input FV.inf or Cap.inf to specify how to co
+\hich\af43\dbch\af31505\loch\f43 nstruct FvImage or CapImage. }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3608683 \hich\af43\dbch\af31505\loch\f43 See examples for details.}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908
+\hich\af43\dbch\af31505\loch\f43 File may be one capsule image when its header is dumped. This option is required.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -b BlockSize, --blocksize BlockSize}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid4195908
+\par \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 BlockSize is one HEX or DEC format value required by FV image.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -n NumberBlock, --n\hich\af43\dbch\af31505\loch\f43 umberblock NumberBlock
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 NumberBlock is one HEX or DEC format value. NumberBlock is one optional parameter.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -f FfsFile, --ffsfile FfsFile}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 FfsFile is placed into FV image. Multiple files can be input one by one.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -s FileTakeSize, --filetakesize FileTakenS\hich\af43\dbch\af31505\loch\f43 ize}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Specify the size of the required space that the input file is placed in FV image. It should be specified together with the input file.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -r Address, --baseaddr Address}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Address is the rebase start address for drivers that run i\hich\af43\dbch\af31505\loch\f43 n Flash. It supports DEC or HEX digital format.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -a AddressFile, --addrfile AddressFile
+\par \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43
+AddressFile is a file used to log boot driver base address and runtime driver base address. this tool will updates these two addresses afterrelocating all boot drivers \hich\af43\dbch\af31505\loch\f43
+and runtime drivers in this fv image to the preferred loaded memory address.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -m logfile, --map logfile}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Logfile is the output Fv map file. If this option is not given, the FvName.map will be the default fv map file name.}{\rtlch\fcs1 \ab\af0\afs18
+\ltrch\fcs0 \b\f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -g Guid, --guid Guid}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Guid is one specific capsule guid value or fv file system guid value.
+\par \hich\af43\dbch\af31505\loch\f43 Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 --FvNameGuid Guid}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Guid is used to specify Fv Name. }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 --capflag CapFlag}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Spec\hich\af43\dbch\af31505\loch\f43 ify capsule reset flag (PersistAcrossReset, PopulateSystemTable or InitiateReset or none).
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 --capheadsize HeadSize}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Specify head size for capsule image in the format of HEX or DEC.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -c, --capsule}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Create Uefi capsule image.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -p, --dump}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Dump a capsule image h\hich\af43\dbch\af31505\loch\f43 eader.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -v, --verbose
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908 \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Enable verbose output with informational messages.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -q, --quiet }{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43
+Disable all messages except key message and fatal error.}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -d, --debug level
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908 \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Enable debug message with specified level.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 --version
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Show program's version numb\hich\af43\dbch\af31505\loch\f43 er and exit
+
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 -h, --help
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Show this help message and exit
+\par }\pard\plain \ltrpar\s2\ql \fi-1440\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid12207580 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid12207580\charrsid12207580 {\*\bkmkstart OLE_LINK7}{\*\bkmkstart OLE_LINK8}
+\hich\af43\dbch\af31505\loch\f43 Status codes returned
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid12207580\charrsid8600807 \hich\af2\dbch\af13\loch\f2 STATUS_SUCCESS}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid12207580 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18
+\ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid12207580\charrsid4999604 \tab }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid12207580 0}{\rtlch\fcs1
+\ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\lang1033\langfe2052\kerning2\langfenp2052\insrsid12207580 \cell }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid12207580 \hich\af43\dbch\af13\loch\f43 The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0
+\kerning2\insrsid12207580 \cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid12207580 \trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb
+\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row \ltrrow}\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\kerning2\insrsid12207580\charrsid8600807 \hich\af2\dbch\af13\loch\f2
+STATUS_ERROR}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid12207580 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid12207580\charrsid4999604 \tab \tab }{\rtlch\fcs1
+\ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid12207580 \hich\af2\dbch\af13\loch\f2 2}{\rtlch\fcs1 \af41\afs19 \ltrch\fcs0
+\cs25\f41\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid12207580\charrsid8600807 \cell }\pard \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid15426231\yts26 {
+\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid12207580 \hich\af43\dbch\af13\loch\f43 The action failed.\cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0
+\fs20\insrsid12207580 \trowd \irow1\irowband1\lastrow \ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid4195908 {\*\bkmkend OLE_LINK7}{\*\bkmkend OLE_LINK8}\hich\af43\dbch\af31505\loch\f43 Example
+
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 1. Generate BFV that contains PEI drivers in Flash with the input FV.inf, base address, and the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 GenFv -i FvRecovery.inf -o FvRecovery.fv -r 0xFFFD0000
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 FvRecovery.inf
+\par \hich\af43\dbch\af31505\loch\f43 [options]
+\par \hich\af43\dbch\af31505\loch\f43 EFI_BLOCK_SIZE = 0x10000 #required option
+\par \hich\af43\dbch\af31505\loch\f43 EFI_NUM_BLOCKS = 0x3
+\par \hich\af43\dbch\af31505\loch\f43 EFI_BASE_ADDRESS = 0xFFFD0000 #optional, if command line -r is not specified, this option will be used.
+\par \hich\af43\dbch\af31505\loch\f43 [attributes]
+\par \hich\af43\dbch\af31505\loch\f43 EFI_ERASE_POLARITY = 1
+\par \hich\af43\dbch\af31505\loch\f43 EFI_WRITE_ENABLED_CAP = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_READ_ENABLED_CAP = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_READ_LOCK_STATUS = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_\hich\af43\dbch\af31505\loch\f43 WRITE_STATUS = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_READ_DISABLED_CAP = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_WRITE_LOCK_STATUS = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_LOCK_CAP = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_LOCK_STATUS = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_ERASE_POLARITY = 1
+\par \hich\af43\dbch\af31505\loch\f43 EFI_MEMORY_MAPPED = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_READ_LOCK_CAP = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_WRITE_DISABLED_CAP = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_READ_STATUS = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_WRITE\hich\af43\dbch\af31505\loch\f43 _LOCK_CAP = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_STICKY_WRITE = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 EFI_FVB2_ALIGNMENT_16 = TRUE
+\par \hich\af43\dbch\af31505\loch\f43 [files]
+\par \hich\af43\dbch\af31505\loch\f43 EFI_FILE_NAME = K:\\Build\\NT32\\DEBUG_MYTOOLS\\Fv\\Ffs\\52C05B14-0B98-496c-BC3B-04B50211D680PeiMain\\52C05B14-0B98-496c-BC3B-04B50211D680.ffs
+\par \hich\af43\dbch\af31505\loch\f43 EFI_FILE_NAME = K:\\Build\\NT32\\DEBUG_MYTOOL\hich\af43\dbch\af31505\loch\f43 S\\Fv\\Ffs\\9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50PcdPeim\\9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50.ffs
+\par ......}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 2. Generate FvMain that contains Dxe drivers loaded in the preferred loaded memory address with the input FV.inf, address file, the output file name, its f
+\hich\af43\dbch\af31505\loch\f43 irmware file system guid (FFS2) and its guid name.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 GenFv -i FvMain.inf -o FvMain.fv -a Addr.inf \hich\f43 \endash \loch\f43 g 8c8ce578-8a3d-4f1c-9935-896185c32dd3 \hich\f43 \endash \loch\f43
+FvNameGuid 6D99E806-3D38-42c2-A095-5F4300BFD7DC}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Addr.inf}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 [options]
+\par \hich\af43\dbch\af31505\loch\f43 EFI_BOOT_DRIVER_BASE_ADDRESS = 0x1f300000
+\par \hich\af43\dbch\af31505\loch\f43 EFI_R\hich\af43\dbch\af31505\loch\f43 UNTIME_DRIVER_BASE_ADDRESS = 0x1f600000}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 3. Generate the capsule image with the input cap.inf, and the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 GenFv -i BiosUpdate.inf -o BiosUpdate.cap
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 BiosUpdate.inf}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid4195908
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 [options]
+\par \hich\af43\dbch\af31505\loch\f43 EFI_CAPSULE_GUID = 25A5CD7D-A5EB-4d74-9C28-D6EF04E03B16 (Re\hich\af43\dbch\af31505\loch\f43 quired)
+\par \hich\af43\dbch\af31505\loch\f43 EFI_CAPSULE_HEADER_SIZE = 0x20 (Optional)
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1036\langfe1033\langnp1036\insrsid4195908\charrsid3608683 \hich\af43\dbch\af31505\loch\f43 EFI_CAPSULE_FLAGS = PopulateSystemTable (Optional)
+\par \hich\af43\dbch\af31505\loch\f43 [attributes]
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 [files]
+\par \hich\af43\dbch\af31505\loch\f43 EFI_FILE_NAME = K:\\B\hich\af43\dbch\af31505\loch\f43 uild\\NT32\\DEBUG_MYTOOLS\\Fv\\Ffs\\EDBEDF47-6EA3-4512-83C1-70F4769D4BDE-Capsule_A.fvi
+\par \hich\af43\dbch\af31505\loch\f43 4. Dump capsule image header information for the input capsule image.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 GenFv -p -i BiosUpdate.cap -o Cap.info}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 No known issues.
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1195920025\insrsid3626962\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-\hich\af43\dbch\af31505\loch\f43 devel
+\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel1\revdttmdel1195920025\insrsid4195908\delrsid3626962 \hich\af43\dbch\af31505\loch\f43
+edk2-buildtools-devel@lists.\hich\af43\dbch\af31505\loch\f43 sourceforge.net}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid4195908
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 2007 - 201}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid16349543 \hich\af43\dbch\af31505\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 , Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licensed and made available
+\par \hich\af43\dbch\af31505\loch\f43 under the terms and conditions of the BSD License which accompa\hich\af43\dbch\af31505\loch\f43 nies this
+\par \hich\af43\dbch\af31505\loch\f43 distribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4195908 \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb
+44f95d843b5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a
+6409fb44d08741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c
+3d9058edf2c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db0256
+5e85f3b9660d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276
+b9f7dec44b7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8
+c33585b5fb9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e
+51440ca2e0088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95
+b21be5ceaf8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff
+6dce591a26ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec6
+9ffb9e65d028d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239
+b75a5bb1e6345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a449
+59d366ad93b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e8
+2db8df9f30254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468
+656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4
+350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d2624
+52282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe5141
+73d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c020000130000000000000000
+0000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000
+000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c0000000000000000000000000019
+0200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b00001600000000
+000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b01000027
+00000000000000000000000000a00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009b0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e30000000000000000000000e0000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff0900060000000000000000000000010000000100000000000000001000000200000001000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdffffff04000000feffffff05000000fefffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffff010000000c6ad98892f1d411a65f0040963251e5000000000000000000000000a009
+2158e5f1d1010300000080020000000000004d0073006f004400610074006100530074006f0072006500000000000000000000000000000000000000000000000000000000000000000000000000000000001a000101ffffffffffffffff020000000000000000000000000000000000000000000000a0092158e5f1d101
+a0092158e5f1d101000000000000000000000000dc00d100c100470047005700d400c900510055004700d900d0005500ca00550053005900c90045004b00c0003d003d000000000000000000000000000000000032000101ffffffffffffffff030000000000000000000000000000000000000000000000a0092158e5f1
+d101a0092158e5f1d1010000000000000000000000004900740065006d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000201ffffffff04000000ffffffff000000000000000000000000000000000000000000000000
+00000000000000000000000000000000d800000000000000010000000200000003000000feffffff0500000006000000070000000800000009000000feffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3c623a536f75726365732053656c65637465645374796c653d225c4150412e58534c22205374796c654e616d653d224150412220786d6c6e733a623d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f7267
+2f6f6666696365446f63756d656e742f323030362f6269626c696f6772617068792220786d6c6e733d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f6269626c696f677261706879223e3c2f623a536f75726365733e00000000
+0000000000000000000000000000000000000000000000000000000000000000000000003c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d226e6f223f3e0d0a3c64733a6461746173746f72654974656d2064733a6974656d49443d227b31393436
+313846332d323936442d343134312d423943312d3441393434393841343432417d2220786d6c6e733a64733d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f637573746f6d586d6c223e3c64733a736368656d61526566733e3c
+64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6f70656e500072006f007000650072007400690065007300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000200ffffffffffffffffffffffff000000000000
+0000000000000000000000000000000000000000000000000000000000000400000055010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f6269626c696f677261706879222f3e3c2f64733a736368656d61526566733e3c2f64733a6461746173746f
+72654974656d3e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/GenFw_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/GenFw_Utility_Man_Page.rtf
new file mode 100644
index 000000000..f4235b77f
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/GenFw_Utility_Man_Page.rtf
@@ -0,0 +1,381 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}
+{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}
+{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f258\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\f259\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f261\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\f262\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\f263\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f264\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\f265\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\f266\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f278\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}
+{\f279\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}{\f281\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f282\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}
+{\f283\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}{\f284\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f285\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}
+{\f286\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}{\f390\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f598\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}
+{\f599\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f601\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f602\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f605\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}
+{\f606\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f628\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\f629\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\f631\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\f632\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}{\f635\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}
+{\f636\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}{\f648\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f649\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}
+{\f651\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}{\f652\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f653\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}
+{\f654\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}{\f655\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f656\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}
+{\f657\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}{\f668\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f669\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f671\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}
+{\f672\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}{\f675\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f676\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f688\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f689\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f695\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f696\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1390\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
+{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
+{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;\red0\green127\blue127;}{\*\defchp \fs21\kerning2\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\snext11 \ssemihidden \sunhideused Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs44 \ltrch\fcs0 \b\f43\fs44\kerning44 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0
+\b\fs32\kerning0\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\*\cs17 \additive \rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \fs16 \sbasedon10 \ssemihidden \sunhideused \styrsid4815795 annotation reference;}{
+\s18\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon0 \snext18 \slink19 \ssemihidden \sunhideused \styrsid4815795 annotation text;}{\*\cs19 \additive \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f43\fs20\lang0\langfe2052\kerning0\langnp0\langfenp2052
+\sbasedon10 \slink18 \slocked \ssemihidden \styrsid4815795 Comment Text Char;}{\s20\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0
+\b\fs20\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon18 \snext18 \slink21 \ssemihidden \sunhideused \styrsid4815795 annotation subject;}{\*\cs21 \additive \rtlch\fcs1 \ab\af0\afs20 \ltrch\fcs0
+\b\f43\fs20\lang0\langfe2052\kerning0\langnp0\langfenp2052 \sbasedon19 \slink20 \slocked \ssemihidden \styrsid4815795 Comment Subject Char;}{\s22\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0
+\fs16\lang1033\langfe2052\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext22 \slink23 \ssemihidden \sunhideused \styrsid4815795 Balloon Text;}{\*\cs23 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0
+\f39\fs16\lang0\langfe2052\kerning0\langnp0\langfenp2052 \sbasedon10 \slink22 \slocked \ssemihidden \styrsid4815795 Balloon Text Char;}{\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0
+\rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext24 \spriority0 \styrsid6636700 CellBodyLeft;}{\*\cs25 \additive \b\f2\cf13 \spriority0 \styrsid6636700
+CodeCharacter;}{\*\ts26\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon11 \snext26 \spriority59 \styrsid6636700 Table Grid;}}{\*\revtbl {Unknown;}{Zhu, Yonghong;}}{\*\rsidtbl \rsid1120999\rsid3954098\rsid4815795\rsid4999604\rsid5318420\rsid5911148\rsid6184429\rsid6636700\rsid8089322\rsid8459339\rsid8600807\rsid12198464\rsid12521351\rsid14966438
+\rsid15026228\rsid15604690\rsid16255639\rsid16399512}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}{\creatim\yr2011\mo7\dy18\hr16\min14}
+{\revtim\yr2016\mo8\dy9\hr10\min26}{\version11}{\edmins23}{\nofpages4}{\nofwords842}{\nofchars4801}{\nofcharsws5632}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
+\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot15604690 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \hich )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0
+\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 GenFw.exe \hich\f43 \endash \loch\f43 build a UEFI image or other image.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 GenFw.exe }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid12521351 \hich\af43\dbch\af31505\loch\f43 -r | }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid3954098 \hich\af43\dbch\af31505\loch\f43 -o <OutputFile> [-e }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5318420 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid3954098
+\hich\af43\dbch\af31505\loch\f43 EfiType}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5318420 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid3954098 \hich\af43\dbch\af31505\loch\f43
+] [-c | -t | -l | -u | -b | -z | -s }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5318420 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid3954098 \hich\af43\dbch\af31505\loch\f43 TimeDate}{
+\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5318420 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid3954098 \hich\af43\dbch\af31505\loch\f43 | -m | -j | }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid3954098\charrsid3954098 \hich\af43\dbch\af31505\loch\f43 --hiipackage}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid3954098 \hich\af43\dbch\af31505\loch\f43 | --}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid3954098\charrsid3954098 \hich\af43\dbch\af31505\loch\f43 hiibinpackage}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid3954098 \hich\af43\dbch\af31505\loch\f43 ]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid12521351 \hich\af43\dbch\af31505\loch\f43 [-a] [-p]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid3954098
+\hich\af43\dbch\af31505\loch\f43 <Input}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 File}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid3954098 \hich\af43\dbch\af31505\loch\f43 >}{
+\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339
+\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid16399512 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid16399512 \hich\af43\dbch\af31505\loch\f43 GenFw.exe \hich\f43 \endash \loch\f43 h
+\par \hich\af43\dbch\af31505\loch\f43 GenFw.exe --version}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid16399512\charrsid8089322
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid16399512
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Genfw is mainly used to process PE32 image to get the expected image data or image file. PE32 is a general-purpose image format that contains, among other information, data
+\hich\af43\dbch\af31505\loch\f43
+identifying the target environment for execution of the image. This utility can modify the standard PE32 image to create UEFI image with EFI subsystem type, PI Terse Executable image with the compact TE image header, zero its dubug data or reset its time
+\hich\af43\dbch\af31505\loch\f43 s\hich\af43\dbch\af31505\loch\f43
+tamp. It can also extract PE32 image data to create bin file, extract PE32 image data section to create Acpi table image, or dump PI TE image header information. It can also parse the text MicroCode definition file to create the MicroCode binary image, me
+\hich\af43\dbch\af31505\loch\f43 r\hich\af43\dbch\af31505\loch\f43 ge (concatenate) several MicroCode binary images into a single file by pad value and alignment requirement. This tool also supports the override the input file with the output contents.
+
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Options
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid15026228\charrsid12198464 \hich\af43\dbch\af31505\loch\f43 If no options ar}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15026228 \hich\af43\dbch\af31505\loch\f43 e specified, tool prints usage.}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid4815795
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Filename1 [FilenameN]
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43
+Input PE/PE32+ image, or TE image, or MicroCode Txt file, or MicroCode bin file, or hii binary packages.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -o FileName, --outputfile FileName
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43
+The EFI image, TeImage, AcpiImage, MicroBin, hii package lists file or other modified PE image\hich\af43\dbch\af31505\loch\f43 will be created.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -e EFI_FILETYPE, --efiImage EFI_FILETYPE
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43
+Create Efi Image. EFI_FILETYPE is one of BASE, SEC, PEI_CORE, PEIM, DXE_CORE, SMM_CORE, DXE_DRIVER, UEFI_APPLICATION, DXE_SAL_DRIVER, UEFI_DRIVER, DXE_RUNTIME_DRIVER, DXE_SMM_DRIVER, SECURITY_CORE,\hich\af43\dbch\af31505\loch\f43
+ COMBINED_PEIM_DRIVER, PIC_PEIM, RELOCATABLE_PEIM, BS_DRIVER, RT_DRIVER, APPLICATION, SAL_RT_DRIVER to support all module types.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid8459339
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -c, --acpi
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Create Acpi table.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -t, --terse
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Create Te Image.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -u, --dump
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Dump TeImage Header.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -z, --zero
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43
+Zero the Debug Data Fields in the PE input image file. It also zeros the time stamp fields.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid8459339
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -b, --exe2bin
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Convert the input EXE to the output BIN file.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -l, --stripped
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Strip off the relocation information data from PE or TE image.}{
+\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid8459339
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -s timedate, --stamp timed\hich\af43\dbch\af31505\loch\f43 ate
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 \hich\f43 timedate format is \'93\loch\f43 \hich\f43 yyyy-mm-dd 00:00:00\'94
+\loch\f43 \hich\f43 . If timedata is set to \'93\loch\f43 \hich\f43 NOW\'94\loch\f43 , current system time is used. The support date scope is 1970-1-1 8:0:0 ~ 2038-1-19 3:14:07.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid8459339
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -m, --mcifile
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Convert input microcode txt definition file to microcode bin file.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -j, --joi\hich\af43\dbch\af31505\loch\f43 n
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Merge multiple microcode bin files to one file.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -a NUM, --align NUM
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43
+NUM is one HEX or DEC format alignment value, which is used to combine multiple microcode bin files.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -p NUM, --pad NUM
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 NUM is one HEX or DEC format padding value, which is used to combin
+\hich\af43\dbch\af31505\loch\f43 e multiple microcode bin files.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 --keepexceptiontable
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Don\hich\f43 \rquote \loch\f43 t clear exception table.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 --keepzeropending
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Don\hich\f43 \rquote \loch\f43 t strip zero pending of .reloc.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -r, --replace
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Overwrite the input file with the output content.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -g HiiPackageListGuid, --hiiguid HiiPackageListGuid
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Guid\hich\af43\dbch\af31505\loch\f43
+ is used to specify hii package list guid.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid8459339
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 --hiipackage }{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid8459339
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43
+Combine all input binary hii packages into a single package list as the text resource data file (RC file format).
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 --hiibinpackage }{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid8459339
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43
+Combine all input binary hii packages into a single package list as the binary resource section.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -v, --verbose
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Turn on verbose output with informational messages.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -d, --debug level
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid8459339 \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Enable debug message with specified level.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 --version
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Show program's version number and exit
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 -h, --help
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Show this help message and exit
+\par }\pard\plain \ltrpar\s2\ql \fi-1440\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid6636700 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf18\insrsid6636700\charrsid6184429 {\*\bkmkstart OLE_LINK7}{\*\bkmkstart OLE_LINK8}\hich\af43\dbch\af31505\loch\f43
+Status codes returned}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf18\insrsid6636700
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6636700\charrsid8600807 \hich\af2\dbch\af13\loch\f2 STATUS_SUCCESS}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6636700 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6636700\charrsid4999604 \tab }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6636700 0}{\rtlch\fcs1 \ab\af2\afs18
+\ltrch\fcs0 \cs25\b\f2\fs18\lang1033\langfe2052\kerning2\langfenp2052\insrsid6636700 \cell }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6636700 \hich\af43\dbch\af13\loch\f43 The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0
+\kerning2\insrsid6636700 \cell }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid6636700 \trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb
+\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row \ltrrow}\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\kerning2\insrsid6636700\charrsid8600807 \hich\af2\dbch\af13\loch\f2
+STATUS_ERROR}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6636700 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\kerning2\insrsid6636700\charrsid4999604 \tab \tab }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6636700 \hich\af2\dbch\af13\loch\f2 2}{\rtlch\fcs1 \af41\afs19 \ltrch\fcs0 \cs25\f41\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid6636700\charrsid8600807 \cell }\pard \ltrpar
+\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid16255639\yts26 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid6636700
+\hich\af43\dbch\af13\loch\f43 The action failed.\cell }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid6636700 \trowd \irow1\irowband1\lastrow \ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10
+\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid8459339 {\*\bkmkend OLE_LINK7}{\*\bkmkend OLE_LINK8}\hich\af43\dbch\af31505\loch\f43 Example
+
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 1. Generate Efi image with the input PE image, module type and the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 GenFw \hich\f43 \endash \loch\f43 e PEI_CORE PeiMain.dll \hich\f43 \endash \loch\f43 o PeiMain.efi
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 2. Generate Te image with the input PE image and the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 GenFw \hich\f43 \endash \loch\f43 t PeiMain.dll \hich\f43 \endash \loch\f43 o PeiMain.te
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 3. Generate acpi tab\hich\af43\dbch\af31505\loch\f43 le image with the input PE image and the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 GenFw \hich\f43 \endash \loch\f43 c Facs.dll \hich\f43 \endash \loch\f43 o Facs.acpi
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 4. Dump TeImage Header with the input Te Image and the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 GenFw \hich\f43 \endash \loch\f43 u PeiMain.te \hich\f43 \endash \loch\f43 o PeiMain.teheader
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 5. Modify PeImage by zero its debug data.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 GenFw \hich\f43 \endash \loch\f43 z Pe\hich\af43\dbch\af31505\loch\f43 iMain.dll \hich\f43 \endash \loch\f43 o Peimain.zero
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 6. Modify PeImage by set new timestamp and override the input image without the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 GenFw \hich\f43 \endash \loch\f43 \hich\f43 s \'93\loch\f43 \hich\f43 2007-8-16 16:06:32\'94\loch\f43 PeiMain.dll \hich\f43 \endash \loch\f43 r
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 7. Extract bin image from PeImage.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 GenFw \hich\f43 \endash \loch\f43 b PeiMain.dll \hich\f43 \endash \loch\f43 o PeiMain.bin
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 8. Generate the \hich\af43\dbch\af31505\loch\f43 microcode binary file from the micro code txt file.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 GenFw \hich\f43 \endash \loch\f43 m Mci.txt \hich\f43 \endash \loch\f43 o Mci.bin
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 9. Merge the multiple mci binary files to one file.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 GenFw \hich\f43 \endash \loch\f43 j Mci.bin1 Mci.bin2 Mci.bin3 \hich\f43 \endash \loch\f43 a 32 \hich\f43 \endash \loch\f43 p 0xFF \hich\f43 \endash
+\loch\f43 o Mci.bin
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 10. Generate the text resource file (RC format) based on all input binary HII packages and their package list guid.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 GenFw \hich\f43 \endash \loch\f43 o SampleHii.rc \hich\f43 \endash \loch\f43 g D49D2EB0-44D5-4621-9FD6-1A92C9109B99 \hich\f43 \endash \loch\f43
+hiipackage SampleStr.hpk SampleVfr.hpk}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid8459339
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 11. Generate the binary resource secti\hich\af43\dbch\af31505\loch\f43 on based on all input binary HII packages and their package list guid.}{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid8459339
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 GenFw \hich\f43 \endash \loch\f43 o SampleHii.bin \hich\f43 \endash \loch\f43 g D49D2EB0-44D5-4621-9FD6-1A92C9109B99 \hich\f43 \endash \loch\f43
+hiibinpackage SampleStr.hpk SampleVfr.hpk}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid8459339
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 No known bugs.
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe1033\revauth1\revdttm1195920026\langfenp1033\insrsid14966438\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-
+\hich\af43\dbch\af31505\loch\f43 devel\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel1\revdttmdel1195920026\insrsid8459339\delrsid14966438
+\hich\af43\dbch\af31505\loch\f43 edk2-buildtools-devel@lists.sourceforge.net}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid8459339
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid15604690 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 2007 - 2011}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 , Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licensed and made available
+\par \hich\af43\dbch\af31505\loch\f43 under the terms and conditions of the BSD License which accompanies this
+\par \hich\af43\dbch\af31505\loch\f43 distr\hich\af43\dbch\af31505\loch\f43 ibution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8459339 \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\insrsid8459339
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210030dd4329a8060000a41b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d331115bebc4eb813bf83291b63624a0d1475a756c734f9bbc2cd28546ecbe1e20a3794ca175f3fae90
+fb6d2dd99bb07b55e5ccf68942bd0877b23c77b908e8db5f9db7f024d9239010f35bd4bbe2fcae387bfff9e2bc289f2fbe24cfaa301468dd8bd846dbb4ddf1c2
+ae7b4c191ba8292337a469bc25ec3d411f06f53a73e224c5292c8de0516732307070a1c0660d125c7d44553488700a4d7bddd3444299910e254ab984c3a219ae
+a4adf1d0f82b7bd46cea4388ad1c12ab5d1ed8e1153d9c9f350a3246aad01c6873462b9ac05999ad5cc988826eafc3acae853a33b7ba11cd1445875ba1b236b1
+399483c90bd560b0b0263435085a21b0f22a9cf9356b38ec6046026d77eba3dc2dc60b17e92219e180643ed27acffba86e9c94c7ca9c225a0f1b0cfae0788ad5
+4adc5a9aec1b703b8b93caec1a0bd8e5de7b132fe5113cf312503b998e2c2927274bd051db6b35979b1ef271daf6c6704e86c73805af4bdd476216c26593af84
+0dfb5393d964f9cc9bad5c313709ea70f561ed3ea7b053075221d51696910d0d339585004b34272bff7213cc7a510a5454a3b349b1b206c1f0af490176745d4b
+c663e2abb2b34b23da76f6352ba57ca2881844c1111ab189d8c7e07e1daaa04f40255c77988aa05fe06e4e5bdb4cb9c5394bbaf28d98c1d971ccd20867e556a7
+689ec9166e0a522183792b8907ba55ca6e943bbf2a26e52f48957218ffcf54d1fb09dc3eac04da033e5c0d0b8c74a6b43d2e54c4a10aa511f5fb021a07533b20
+5ae07e17a621a8e082dafc17e450ffb739676998b48643a4daa7211214f623150942f6a02c99e83b85583ddbbb2c4996113211551257a656ec1139246ca86be0
+aadedb3d1441a89b6a929501833b197fee7b9641a3503739e57c732a59b1f7da1cf8a73b1f9bcca0945b874d4393dbbf10b1680f66bbaa5d6f96e77b6f59113d
+316bb31a795600b3d256d0cad2fe354538e7566b2bd69cc6cbcd5c38f0e2bcc63058344429dc2121fd07f63f2a7c66bf76e80d75c8f7a1b622f878a18941d840
+545fb28d07d205d20e8ea071b283369834296bdaac75d256cb37eb0bee740bbe278cad253b8bbfcf69eca23973d939b97891c6ce2cecd8da8e2d343578f6648a
+c2d0383fc818c798cf64e52f597c740f1cbd05df0c264c49134cf09d4a60e8a107260f20f92d47b374e32f000000ffff0300504b030414000600080000002100
+0dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f7
+8277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89
+d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd500
+1996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0f
+bfff0000001c0200001300000000000000000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6
+a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a
+0000001c00000000000000000000000000190200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d00140006000800000021
+0030dd4329a8060000a41b00001600000000000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d001400060008
+00000021000dd1909fb60000001b0100002700000000000000000000000000b20900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000ad0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e500000000000000000000000000ba
+4262e5f1d101feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/GenPatchPcdTable_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/GenPatchPcdTable_Utility_Man_Page.rtf
new file mode 100644
index 000000000..c16b06e19
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/GenPatchPcdTable_Utility_Man_Page.rtf
@@ -0,0 +1,276 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
+{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}
+{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
+{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\f258\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\f259\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f261\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\f262\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\f263\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f264\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\f265\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\f266\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f268\fbidi \fswiss\fcharset238\fprq2 Arial CE;}{\f269\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;}{\f271\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}
+{\f272\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f273\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f274\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);}{\f275\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}
+{\f276\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f390\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f598\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f599\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}
+{\f601\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f602\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f605\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f606\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}
+{\f648\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f649\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}{\f651\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}
+{\f652\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f653\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}{\f654\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}
+{\f655\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f656\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}{\f657\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}
+{\f688\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}{\f689\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}
+{\f692\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}{\f695\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f696\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}
+{\f1390\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
+{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
+{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;}{\*\defchp \fs21\kerning2\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\snext11 \ssemihidden \sunhideused Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs44 \ltrch\fcs0 \b\f43\fs44\kerning44 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0
+\b\fs32\kerning0\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked \ssemihidden \spriority9 Heading 2 Char;}{\*\cs17 \additive \rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \fs16 \sbasedon10 \ssemihidden \sunhideused \styrsid8131749
+annotation reference;}{\s18\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon0 \snext18 \slink19 \ssemihidden \sunhideused \styrsid8131749 annotation text;}{\*\cs19 \additive \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f43\fs20\lang0\langfe2052\kerning0\langnp0\langfenp2052
+\sbasedon10 \slink18 \slocked \ssemihidden \styrsid8131749 Comment Text Char;}{\s20\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0
+\b\fs20\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon18 \snext18 \slink21 \ssemihidden \sunhideused \styrsid8131749 annotation subject;}{\*\cs21 \additive \rtlch\fcs1 \ab\af0\afs20 \ltrch\fcs0
+\b\f43\fs20\lang0\langfe2052\kerning0\langnp0\langfenp2052 \sbasedon19 \slink20 \slocked \ssemihidden \styrsid8131749 Comment Subject Char;}{\s22\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0
+\fs16\lang1033\langfe2052\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext22 \slink23 \ssemihidden \sunhideused \styrsid8131749 Balloon Text;}{\*\cs23 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0
+\f39\fs16\lang0\langfe2052\kerning0\langnp0\langfenp2052 \sbasedon10 \slink22 \slocked \ssemihidden \styrsid8131749 Balloon Text Char;}}{\*\revtbl {Unknown;}{Zhu, Yonghong;}}{\*\rsidtbl \rsid6439383\rsid8089322\rsid8131749\rsid8260129\rsid9178819\rsid10167770\rsid11893288\rsid12198464}
+{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}{\creatim\yr2011\mo7\dy18\hr16\min16}{\revtim\yr2016\mo8\dy9\hr10\min28}{\version7}{\edmins16}
+{\nofpages2}{\nofwords385}{\nofchars2200}{\nofcharsws2580}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot8260129 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \hich )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0
+\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 GenPatchPcdTable.exe or GenPatchPcdTable.py \hich\f43 \endash \loch\f43 Parse the binary EFI image and its map file to get all used patchable PCDs\hich\f43 \rquote \loch\f43
+ name and their offset in EFI image.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9178819
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 GenPatchPcdTable.exe -m <MapFile> -e <EfiFile> }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid12198464 \hich\af43\dbch\af31505\loch\f43 [}{\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 -o <OutFile>}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid12198464 \hich\af43\dbch\af31505\loch\f43 ]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9178819
+
+\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid11893288 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11893288 \hich\af43\dbch\af31505\loch\f43 GenPatchPcd.exe \hich\f43 \endash \loch\f43 h
+\par \hich\af43\dbch\af31505\loch\f43 GenPatchPcd.exe --version}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11893288\charrsid8089322
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11893288
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 GenPatchPcdTable tool parses the binary EFI image and map file generated by the different compilers (including MSFT, ICC, GCC) in EDKII \hich\af43\dbch\af31505\loch\f43
+code base. This tool searches the image map file to find every patchable PCD name and its real address, then parse the binary EFI image to get each section name and address, and calculate PCD offset in the binary EFI image. Finally, Pcd name, its offset a
+\hich\af43\dbch\af31505\loch\f43 n\hich\af43\dbch\af31505\loch\f43 d section name will be written into the output file. }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9178819
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 GenPatchPcdTable tool usually works together with PatchPcdValue tool to set the specific value of a patchable PCD into the binary EFI image. }{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9178819
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 Options
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid12198464 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid12198464\charrsid12198464 \hich\af43\dbch\af31505\loch\f43 If no options are specified, tool prints usage.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 -m M\hich\af43\dbch\af31505\loch\f43 APFILE, --mapfile=MAPFILE}{
+\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid9178819
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43
+The map file generated by compiler contains the function and global variable information.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9178819
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 -e EFIFILE, --efifile=EFIFILE}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid9178819
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 The binary EFI image may contain the patchable PCD.}{\rtlch\fcs1 \af0\afs18
+\ltrch\fcs0 \f0\fs18\cf1\insrsid9178819
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 -o OUTFILE, --outputfile=OUTFILE}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid9178819
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 The output file stores th\hich\af43\dbch\af31505\loch\f43
+e found patchable PCD information, which includes PcdName, Offset in EFI image and the section name.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9178819
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 -h, --help}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid9178819
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 Show this help message and exit.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid9178819
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 --version
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 Show program's version number and exit.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid12198464 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid12198464 \hich\af43\dbch\af31505\loch\f43 Status codes returned
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid12198464 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid12198464\charrsid12198464 \hich\af43\dbch\af31505\loch\f43 Always return 0}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid12198464 .}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid12198464\charrsid12198464
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 Example
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 1. Get the patchable Pcds from the binary PeiCore image and PeiCore map file, and output the PCD information into the file PcdTable.txt.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 GenPatchPcdTable.exe -m PeiCore.map -e PeiCore.efi -o PcdTable.txt}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid9178819
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 PcdTable.txt file contains the following PCD info\hich\af43\dbch\af31505\loch\f43 rmation:}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid9178819
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 PCD Name Offset Section Name
+\par \hich\af43\dbch\af31505\loch\f43 PcdDebugPrintErrorLevel 0x6F80 .data
+\par \hich\af43\dbch\af31505\loch\f43 PcdLoadFixAddressBootTimeCodePageNumber 0x6F84 .data
+\par \hich\af43\dbch\af31505\loch\f43 PcdLoadFixAddressPeiCodePageNumber 0x6F88 .data
+\par \hich\af43\dbch\af31505\loch\f43 PcdLoadFixAddressRuntimeCodePageN\hich\af43\dbch\af31505\loch\f43 umber 0x6F8C .data
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 No known bugs.
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe1033\revauth1\revdttm1195920028\langfenp1033\insrsid6439383\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-
+\hich\af43\dbch\af31505\loch\f43 devel\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel1\revdttmdel1195920028\insrsid9178819\delrsid6439383
+\hich\af43\dbch\af31505\loch\f43 edk2-buildtools-devel@lists.sourceforge.net}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9178819
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 N\hich\af43\dbch\af31505\loch\f43 one
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid8260129 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 2008 - 2011}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 , Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licen\hich\af43\dbch\af31505\loch\f43 sed and made available
+\par \hich\af43\dbch\af31505\loch\f43 under the terms and conditions of the BSD License which accompanies this
+\par \hich\af43\dbch\af31505\loch\f43 distribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9178819 \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\insrsid9178819
+\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid9178819
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210030dd4329a8060000a41b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d331115bebc4eb813bf83291b63624a0d1475a756c734f9bbc2cd28546ecbe1e20a3794ca175f3fae90
+fb6d2dd99bb07b55e5ccf68942bd0877b23c77b908e8db5f9db7f024d9239010f35bd4bbe2fcae387bfff9e2bc289f2fbe24cfaa301468dd8bd846dbb4ddf1c2
+ae7b4c191ba8292337a469bc25ec3d411f06f53a73e224c5292c8de0516732307070a1c0660d125c7d44553488700a4d7bddd3444299910e254ab984c3a219ae
+a4adf1d0f82b7bd46cea4388ad1c12ab5d1ed8e1153d9c9f350a3246aad01c6873462b9ac05999ad5cc988826eafc3acae853a33b7ba11cd1445875ba1b236b1
+399483c90bd560b0b0263435085a21b0f22a9cf9356b38ec6046026d77eba3dc2dc60b17e92219e180643ed27acffba86e9c94c7ca9c225a0f1b0cfae0788ad5
+4adc5a9aec1b703b8b93caec1a0bd8e5de7b132fe5113cf312503b998e2c2927274bd051db6b35979b1ef271daf6c6704e86c73805af4bdd476216c26593af84
+0dfb5393d964f9cc9bad5c313709ea70f561ed3ea7b053075221d51696910d0d339585004b34272bff7213cc7a510a5454a3b349b1b206c1f0af490176745d4b
+c663e2abb2b34b23da76f6352ba57ca2881844c1111ab189d8c7e07e1daaa04f40255c77988aa05fe06e4e5bdb4cb9c5394bbaf28d98c1d971ccd20867e556a7
+689ec9166e0a522183792b8907ba55ca6e943bbf2a26e52f48957218ffcf54d1fb09dc3eac04da033e5c0d0b8c74a6b43d2e54c4a10aa511f5fb021a07533b20
+5ae07e17a621a8e082dafc17e450ffb739676998b48643a4daa7211214f623150942f6a02c99e83b85583ddbbb2c4996113211551257a656ec1139246ca86be0
+aadedb3d1441a89b6a929501833b197fee7b9641a3503739e57c732a59b1f7da1cf8a73b1f9bcca0945b874d4393dbbf10b1680f66bbaa5d6f96e77b6f59113d
+316bb31a795600b3d256d0cad2fe354538e7566b2bd69cc6cbcd5c38f0e2bcc63058344429dc2121fd07f63f2a7c66bf76e80d75c8f7a1b622f878a18941d840
+545fb28d07d205d20e8ea071b283369834296bdaac75d256cb37eb0bee740bbe278cad253b8bbfcf69eca23973d939b97891c6ce2cecd8da8e2d343578f6648a
+c2d0383fc818c798cf64e52f597c740f1cbd05df0c264c49134cf09d4a60e8a107260f20f92d47b374e32f000000ffff0300504b030414000600080000002100
+0dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f7
+8277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89
+d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd500
+1996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0f
+bfff0000001c0200001300000000000000000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6
+a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a
+0000001c00000000000000000000000000190200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d00140006000800000021
+0030dd4329a8060000a41b00001600000000000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d001400060008
+00000021000dd1909fb60000001b0100002700000000000000000000000000b20900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000ad0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e500000000000000000000000020b9
+72b3e5f1d101feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/GenSec_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/GenSec_Utility_Man_Page.rtf
new file mode 100644
index 000000000..fea5009be
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/GenSec_Utility_Man_Page.rtf
@@ -0,0 +1,408 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}{\f4\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Helvetica;}
+{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
+{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}
+{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}
+{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
+{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\f258\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\f259\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f261\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\f262\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\f263\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f264\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\f265\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\f266\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f278\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}{\f279\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}
+{\f281\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f282\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}{\f283\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}
+{\f284\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f285\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}{\f286\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}
+{\f298\fbidi \fswiss\fcharset238\fprq2 Helvetica CE;}{\f299\fbidi \fswiss\fcharset204\fprq2 Helvetica Cyr;}{\f301\fbidi \fswiss\fcharset161\fprq2 Helvetica Greek;}{\f302\fbidi \fswiss\fcharset162\fprq2 Helvetica Tur;}
+{\f303\fbidi \fswiss\fcharset177\fprq2 Helvetica (Hebrew);}{\f304\fbidi \fswiss\fcharset178\fprq2 Helvetica (Arabic);}{\f305\fbidi \fswiss\fcharset186\fprq2 Helvetica Baltic;}{\f306\fbidi \fswiss\fcharset163\fprq2 Helvetica (Vietnamese);}
+{\f390\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f598\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f599\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f601\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}
+{\f602\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f605\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f606\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}
+{\f628\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\f629\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}{\f631\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}
+{\f632\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}{\f635\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\f636\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\f648\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f649\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}{\f651\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}
+{\f652\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f653\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}{\f654\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}
+{\f655\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f656\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}{\f657\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}
+{\f668\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f669\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f671\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}{\f672\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}
+{\f675\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f676\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f688\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f689\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f695\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f696\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1390\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
+{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
+{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext11 \ssemihidden \sunhideused
+Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\ai\af0\afs28 \ltrch\fcs0
+\b\i\fs28\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\*\cs17 \additive \rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \fs16 \sbasedon10 \ssemihidden \sunhideused \styrsid13127309 annotation reference;}{
+\s18\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext18 \slink19 \ssemihidden \sunhideused \styrsid13127309 annotation text;}{\*\cs19 \additive \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f43\fs20 \sbasedon10 \slink18 \slocked \ssemihidden \styrsid13127309 Comment Text Char;}{
+\s20\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0 \b\fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon18 \snext18 \slink21 \ssemihidden \sunhideused \styrsid13127309 annotation subject;}{\*\cs21 \additive \rtlch\fcs1 \ab\af0\afs20 \ltrch\fcs0 \b\f43\fs20 \sbasedon19 \slink20 \slocked \ssemihidden \styrsid13127309 Comment Subject Char;}{
+\s22\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0 \fs16\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext22 \slink23 \ssemihidden \sunhideused \styrsid13127309 Balloon Text;}{\*\cs23 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \f39\fs16 \sbasedon10 \slink22 \slocked \ssemihidden \styrsid13127309 Balloon Text Char;}{
+\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext24 \spriority0 \styrsid14900051 CellBodyLeft;}{\*\cs25 \additive \b\f2\cf13 \spriority0 \styrsid14900051 CodeCharacter;}{\*\ts26\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh
+\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon11 \snext26 \spriority59 \styrsid14900051 Table Grid;}}{\*\revtbl {Unknown;}{Zhu, Yonghong;}}{\*\rsidtbl \rsid4944739\rsid4999604\rsid5797707\rsid5911148\rsid6517620\rsid7240686\rsid8600807\rsid8723325\rsid9642788\rsid10579097\rsid11029556\rsid11342878\rsid12069099\rsid12198464
+\rsid13127309\rsid14900051\rsid15798865}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}{\creatim\yr2010\mo10\dy6\hr17\min1}
+{\revtim\yr2016\mo8\dy9\hr10\min28}{\version13}{\edmins145}{\nofpages4}{\nofwords710}{\nofchars4047}{\nofcharsws4748}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
+\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot11342878 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \hich )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0
+\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 GenSec.exe \hich\f43 \endash \loch\f43 build one PI section file.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\lang1036\langfe1033\langnp1036\insrsid11342878\charrsid11342878 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid11342878\charrsid11342878 \hich\af43\dbch\af31505\loch\f43 GenSec.exe}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid5797707
+\hich\af43\dbch\af31505\loch\f43 [-v | -d]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid12069099 \hich\af43\dbch\af31505\loch\f43 [-s <SectionType>] [-c }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid5797707 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid12069099 \hich\af43\dbch\af31505\loch\f43
+CompressType}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid5797707 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid12069099 \hich\af43\dbch\af31505\loch\f43 ]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid5797707 \hich\af43\dbch\af31505\loch\f43
+ [-g <GuidValue>] [-l <GuidHeaderLength>] [-r <GuidAttr>]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid11342878\charrsid11342878 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid5797707 \hich\af43\dbch\af31505\loch\f43 [-n }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid11029556 \hich\af43\dbch\af31505\loch\f43 <
+}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid5797707 \hich\af43\dbch\af31505\loch\f43 UiString}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid11029556 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid5797707 \hich\af43\dbch\af31505\loch\f43
+] [-j }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid11029556 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid5797707 \hich\af43\dbch\af31505\loch\f43 Number}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid11029556
+\hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid5797707 \hich\af43\dbch\af31505\loch\f43 ] }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid12069099 \loch\af43\dbch\af31505\hich\f43 \endash \loch\f43 o <OutputFile>}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid11342878\charrsid11342878
+\hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid12069099 \hich\af43\dbch\af31505\loch\f43 <InputFile1> }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid11342878\charrsid11342878 \hich\af43\dbch\af31505\loch\f43 [}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid12069099
+\hich\af43\dbch\af31505\loch\f43 <InputFile2>}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid11342878\charrsid11342878 \hich\af43\dbch\af31505\loch\f43 \hich\f43 ]\'85}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid11342878
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid5797707 \hich\af43\dbch\af31505\loch\f43 GenSec.exe \hich\f43 \endash \loch\f43 h
+\par \hich\af43\dbch\af31505\loch\f43 GenSec.exe --version}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\lang1036\langfe2052\langnp1036\langfenp2052\insrsid5797707\charrsid11342878
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 GenSec }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4944739 \hich\af43\dbch\af31505\loch\f43 generates}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878
+\hich\af43\dbch\af31505\loch\f43
+ valid EFI_SECTION type files, which conform to the firmware file section defined in the PI specification, from PE32/PE32+/COFF image files or other binary files. This utility will produce a file that is the section header concatenated with the contents o
+\hich\af43\dbch\af31505\loch\f43 f\hich\af43\dbch\af31505\loch\f43 the input file. It does not validate that the contents of the input file match the section added.
+\par \hich\af43\dbch\af31505\loch\f43 PI SECTION Types referred to the Volume 3 of the PI 1.0 specification.
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt
+\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15
+\cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\pard \ltrpar\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \hich\af4\dbch\af31505\loch\f4 Mnemonic\cell
+\hich\af4\dbch\af31505\loch\f4 PI Section Type\cell }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878
+\trowd \irow0\irowband0\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt
+\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15
+\cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row \ltrrow}\pard \ltrpar\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \hich\af4\dbch\af31505\loch\f4
+COMPRESS\cell \hich\af4\dbch\af31505\loch\f4 EFI_SECTION_COMPRESSION\cell }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878
+\trowd \irow1\irowband1\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt
+\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15
+\cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row \ltrrow}\pard \ltrpar\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \hich\af4\dbch\af31505\loch\f4
+GUID\cell \hich\af4\dbch\af31505\loch\f4 EFI_SECTION_GUID_DEFINED\cell }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878
+\trowd \irow2\irowband2\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt
+\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15
+\cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row \ltrrow}\pard \ltrpar\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \hich\af4\dbch\af31505\loch\f4
+PE32\cell \hich\af4\dbch\af31505\loch\f4 EFI_SECTION_PE32\cell }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878
+\trowd \irow3\irowband3\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt
+\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15
+\cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row \ltrrow}\pard \ltrpar\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \hich\af4\dbch\af31505\loch\f4
+PIC\cell \hich\af4\dbch\af31505\loch\f4 EFI_SECTION_PIC\cell }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878
+\trowd \irow4\irowband4\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt
+\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15
+\cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row \ltrrow}\pard \ltrpar\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \hich\af4\dbch\af31505\loch\f4
+TE\cell \hich\af4\dbch\af31505\loch\f4 EFI_SECTION_TE\cell }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878
+\trowd \irow5\irowband5\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt
+\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15
+\cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row \ltrrow}\pard \ltrpar\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \hich\af4\dbch\af31505\loch\f4
+DXE_DEPEX\cell \hich\af4\dbch\af31505\loch\f4 EFI_SECTION_DXE_DEPEX\cell }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878
+\trowd \irow6\irowband6\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt
+\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15
+\cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row \ltrrow}\pard \ltrpar\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \hich\af4\dbch\af31505\loch\f4
+VERSION\cell \hich\af4\dbch\af31505\loch\f4 EFI_SECTION_VERSION\cell }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878
+\trowd \irow7\irowband7\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt
+\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15
+\cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row \ltrrow}\pard \ltrpar\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \hich\af4\dbch\af31505\loch\f4
+UI\cell \hich\af4\dbch\af31505\loch\f4 EFI_SECTION_USER_INTERFACE\cell }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878
+\trowd \irow8\irowband8\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt
+\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15
+\cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row \ltrrow}\pard \ltrpar\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \hich\af4\dbch\af31505\loch\f4
+COMPAT16\cell \hich\af4\dbch\af31505\loch\f4 EFI_SECTION_COMPATIBILITY16\cell }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0
+\f4\fs18\insrsid11342878 \trowd \irow9\irowband9\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3
+\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr
+\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row \ltrrow}\pard \ltrpar\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878
+\hich\af4\dbch\af31505\loch\f4 FVIMAGE\cell \hich\af4\dbch\af31505\loch\f4 EFI_SECTION_FIRMWARE_VOLUME_IMAGE\cell }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1
+\af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \trowd \irow10\irowband10\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15
+\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt
+\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row \ltrrow}\pard \ltrpar\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {
+\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \hich\af4\dbch\af31505\loch\f4 SUBGUID\cell \hich\af4\dbch\af31505\loch\f4 EFI_SECTION_FREEFORM_SUBTYPE_GUID\cell }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \trowd \irow11\irowband11\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb
+\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15
+\cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row \ltrrow}\pard \ltrpar
+\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \hich\af4\dbch\af31505\loch\f4 RAW\cell \hich\af4\dbch\af31505\loch\f4 EFI_SECTION_RAW\cell }\pard \ltrpar
+\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \trowd \irow12\irowband12\ltrrow\ts11\trgaph108\trleft36\trbrdrt\brdrs\brdrw15 \trbrdrl
+\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15
+\cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row \ltrrow}\pard \ltrpar
+\ql \li0\ri0\sa60\sl240\slmult0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \hich\af4\dbch\af31505\loch\f4 PEI_DEPEX\cell \hich\af4\dbch\af31505\loch\f4 EFI_SECTION_PEI_DEPEX\cell
+}\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af4\afs18 \ltrch\fcs0 \f4\fs18\insrsid11342878 \trowd \irow13\irowband13\lastrow \ltrrow\ts11\trgaph108\trleft36\trbrdrt
+\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind144\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr
+\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth1392\clshdrawnil \cellx1428\clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth4372\clshdrawnil \cellx5800\row
+}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Options
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid15798865\charrsid12198464 \hich\af43\dbch\af31505\loch\f43 If no options ar}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15798865 \hich\af43\dbch\af31505\loch\f43 e specified, tool prints usage.}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid13127309
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Filename1 [FilenameN]
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Input PE/PE32+ image, or TE image, or other binary files.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 -o FileName, --outputfile FileName
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 The PI section file is created. This option is required.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 -s SectionType, --sectiontype SectionType
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 SectionType defined in PI spec is one type of EFI_SECTION_COMPRE
+\hich\af43\dbch\af31505\loch\f43
+SSION, EFI_SECTION_GUID_DEFINED, EFI_SECTION_PE32, EFI_SECTION_PIC, EFI_SECTION_TE, EFI_SECTION_DXE_DEPEX, EFI_SECTION_COMPATIBILITY16, EFI_SECTION_USER_INTERFACE, EFI_SECTION_VERSION, EFI_SECTION_FIRMWARE_VOLUME_IMAGE, EFI_SECTION_RAW, EFI_SECTION_FREEFO
+\hich\af43\dbch\af31505\loch\f43 R\hich\af43\dbch\af31505\loch\f43 M_SUBTYPE_GUID, EFI_SECTION_PEI_DEPEX. If sectiontype is not given, EFI_SECTION_ALL is default type to contain the input all sections to one section file.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 -c [Type], --compress [Type]
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Compress method type can be PI_NONE or PI_STD. If Type is not given, PI_
+\hich\af43\dbch\af31505\loch\f43 STD is default type.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 -g GuidValue, --vendor GuidValue
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43
+GuidValue is one specific vendor guid value for guided section. Its format is 00000000-0000-0000-0000-000000000000. If it is not given, the default CRC32 guided is used.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 -l GuidHeaderLength, --HeaderLength GuidHeaderLength
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Specify the size of header of GUID-ed data.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 -r GuidAttr, --attributes GuidAttr
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43
+GuidAttr is guided section attributes, which may be PROCESSING_REQUIRED or AUTH_STATUS_VALID. If it is not given, PROCESSING\hich\af43\dbch\af31505\loch\f43 _REQUIRED is the default attribute.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 -n String, --name String
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 String is a NULL terminated string used in Ui section.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 -j Number, --buildnumber Number
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Number is an integer value between 0000 and 9999 used in Ver section.
+
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 -v, --verbose
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Turn on verbose output w\hich\af43\dbch\af31505\loch\f43
+ith informational messages.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 -d, --debug level
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid11342878 \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Enable debug message with specified level.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 --version
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Show program version number and exit
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 -h, --help
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Show this help message and exit
+\par }\pard\plain \ltrpar\s2\ql \fi-1440\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid14900051 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14900051\charrsid6517620 {\*\bkmkstart OLE_LINK7}{\*\bkmkstart OLE_LINK8}\hich\af43\dbch\af31505\loch\f43
+Status codes returned
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid14900051\charrsid8600807 \hich\af2\dbch\af13\loch\f2 STATUS_SUCCESS}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid14900051 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18
+\ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid14900051\charrsid4999604 \tab }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid14900051 0}{\rtlch\fcs1
+\ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\lang1033\langfe2052\kerning2\langfenp2052\insrsid14900051 \cell }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid14900051 \hich\af43\dbch\af13\loch\f43 The action was com\hich\af43\dbch\af13\loch\f43 pleted as requested.}{
+\rtlch\fcs1 \af0 \ltrch\fcs0 \kerning2\insrsid14900051 \cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid14900051 \trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb
+\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row \ltrrow}\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\kerning2\insrsid14900051\charrsid8600807 \hich\af2\dbch\af13\loch\f2
+STATUS_ERROR}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid14900051 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid14900051\charrsid4999604 \tab \tab }{\rtlch\fcs1
+\ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid14900051 \hich\af2\dbch\af13\loch\f2 2}{\rtlch\fcs1 \af41\afs19 \ltrch\fcs0
+\cs25\f41\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid14900051\charrsid8600807 \cell }\pard \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid8723325\yts26 {
+\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid14900051 \hich\af43\dbch\af13\loch\f43 The action failed.\cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0
+\fs20\insrsid14900051 \trowd \irow1\irowband1\lastrow \ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11342878 {\*\bkmkend OLE_LINK7}{\*\bkmkend OLE_LINK8}\hich\af43\dbch\af31505\loch\f43 Example
+
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 1. Generate PE32 section file with the input PE image, PE32 section type and the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid11342878\charrsid11342878 \hich\af43\dbch\af31505\loch\f43 GenSec -s EFI_SECTION_PE32 PeiMain.efi -o PeiMain.pe32
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 2. Generate compression section file with the input section files, compression method and the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid11342878\charrsid11342878 \hich\af43\dbch\af31505\loch\f43 GenSec -s EFI_SECTION_COMPRESSION \hich\f43 \endash \loch\f43
+c PI_STD PeiMain.pe32 PeiMain.ui PeiMain.ver -o PeiMain.com
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 3. Generate the default CRC32 guided section file\hich\af43\dbch\af31505\loch\f43 with the input section files, and the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 GenSec \hich\f43 \endash \loch\f43 s EFI_SECTION_GUID_DEFINED PeiMain.pe32 PeiMain.ui PeiMain.ver \hich\f43 \endash \loch\f43 o PeiMain.guided
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 4. Generate the vendor specific guided section file with the input vendor raw files, the vendor guid, and the \hich\af43\dbch\af31505\loch\f43
+output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 GenSec \hich\f43 \endash \loch\f43 s EFI_SECTION_GUID_DEFINED \hich\f43 \endash \loch\f43 g A31280AD-481E-41B6-95E8-127F-4C984779 \hich\f43 \endash
+\loch\f43 r PROCESSING_REQUIRED \hich\f43 \endash \loch\f43 r AUTH_STATUS_VALID PeiMain.raw \hich\f43 \endash \loch\f43 o PeiMain.guided
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 5. Generate UI section with the input string and the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid11342878\charrsid11342878 \hich\af43\dbch\af31505\loch\f43 Gensec -s EFI_SEC\hich\af43\dbch\af31505\loch\f43 TION_USER_INTERFACE \hich\f43 \endash \loch\f43
+\hich\f43 n \'93\loch\f43 \hich\f43 PeiMain\'94\loch\f43 \hich\f43 \endash \loch\f43 o PeiMain.ui
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 6. Generate VER section with the input build number and the output file name.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid11342878\charrsid11342878 \hich\af43\dbch\af31505\loch\f43 GenSec -s EFI_SECTION_VERSION \hich\f43 \endash \loch\f43 j 20 \hich\f43 \endash \loch\f43 o PeiMain.ver
+
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 No known }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4944739 \hich\af43\dbch\af31505\loch\f43 issues}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 .
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1195920028\insrsid10579097\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-\hich\af43\dbch\af31505\loch\f43 devel
+\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel1\revdttmdel1195920028\insrsid11342878\delrsid10579097 \hich\af43\dbch\af31505\loch\f43
+edk2-buildtools-devel@lists.sourceforge.net}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid11342878
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 2007 - }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid4944739 \hich\af43\dbch\af31505\loch\f43 201}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9642788 \hich\af43\dbch\af31505\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 , Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licensed and made available
+\par \hich\af43\dbch\af31505\loch\f43 under the terms and conditions of the BSD License which accompanies this
+\par \hich\af43\dbch\af31505\loch\f43 dist\hich\af43\dbch\af31505\loch\f43 ribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11342878 \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb
+44f95d843b5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a
+6409fb44d08741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c
+3d9058edf2c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db0256
+5e85f3b9660d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276
+b9f7dec44b7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8
+c33585b5fb9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e
+51440ca2e0088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95
+b21be5ceaf8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff
+6dce591a26ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec6
+9ffb9e65d028d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239
+b75a5bb1e6345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a449
+59d366ad93b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e8
+2db8df9f30254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468
+656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4
+350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d2624
+52282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe5141
+73d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c020000130000000000000000
+0000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000
+000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c0000000000000000000000000019
+0200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b00001600000000
+000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b01000027
+00000000000000000000000000a00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009b0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e50000000000000000000000003050
+9bc5e5f1d101feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/Intel_UEFI_Packaging_Tool_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/Intel_UEFI_Packaging_Tool_Man_Page.rtf
new file mode 100644
index 000000000..5ed136550
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/Intel_UEFI_Packaging_Tool_Man_Page.rtf
@@ -0,0 +1,616 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}
+{\f3\fbidi \froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f10\fbidi \fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Verdana{\*\falt Verdana};}
+{\f41\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
+{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
+{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
+{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f44\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f45\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
+{\f47\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f48\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f49\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f50\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
+{\f51\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f52\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f64\fbidi \fmodern\fcharset238\fprq1 Courier New CE;}{\f65\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr;}
+{\f67\fbidi \fmodern\fcharset161\fprq1 Courier New Greek;}{\f68\fbidi \fmodern\fcharset162\fprq1 Courier New Tur;}{\f69\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew);}{\f70\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic);}
+{\f71\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic;}{\f72\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese);}{\f176\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f384\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}
+{\f385\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f387\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f388\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f391\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}
+{\f392\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f434\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}{\f435\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}
+{\f437\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f438\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}{\f441\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}
+{\f442\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f456\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
+{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
+{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}
+{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}
+{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
+{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
+{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
+{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}
+{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
+{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;
+\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;\red79\green129\blue189;\red192\green80\blue77;\red255\green255\blue255;}{\*\defchp
+\fs21\kerning2\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1
+\af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1
+\af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0
+\rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1
+Default Paragraph Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\snext11 \ssemihidden \sunhideused Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs44 \ltrch\fcs0 \b\f39\fs44\kerning44 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0
+\b\fs32\kerning0\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked \ssemihidden \spriority9 Heading 2 Char;}{\*\cs17 \additive \rtlch\fcs1 \af0\afs21 \ltrch\fcs0 \fs21 \sbasedon10 \ssemihidden \sunhideused \styrsid14245224
+annotation reference;}{\s18\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon0 \snext18 \slink19 \sunhideused \styrsid14245224 annotation text;}{\*\cs19 \additive \rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f39\fs24\kerning0 \sbasedon10 \slink18 \slocked \styrsid14245224 Comment Text Char;}{
+\s20\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs24\alang1025 \ltrch\fcs0 \b\fs24\lang1033\langfe2052\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon18 \snext18 \slink21 \ssemihidden \sunhideused \styrsid14245224 annotation subject;}{\*\cs21 \additive \rtlch\fcs1 \ab\af0\afs24 \ltrch\fcs0 \b\f39\fs24\kerning0 \sbasedon19 \slink20 \slocked \ssemihidden \styrsid14245224 Comment Subject Char;}{
+\s22\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0 \fs16\lang1033\langfe2052\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon0 \snext22 \slink23 \ssemihidden \sunhideused \styrsid14245224 Balloon Text;}{\*\cs23 \additive \rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \f39\fs16\kerning0 \sbasedon10 \slink22 \slocked \ssemihidden \styrsid14245224 Balloon Text Char;}}{\*\listtable
+{\list\listtemplateid-757050274\listhybrid{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\leveltemplateid-1837736466\'02\'00.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0
+\fi-360\li360\lin360 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698713\'02\'01);}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-420\li840\lin840 }
+{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698715\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-420\li1260\lin1260 }{\listlevel
+\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698703\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-420\li1680\lin1680 }{\listlevel\levelnfc4
+\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698713\'02\'04);}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-420\li2100\lin2100 }{\listlevel\levelnfc2\levelnfcn2\leveljc2
+\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698715\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-420\li2520\lin2520 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0
+\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698703\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-420\li2940\lin2940 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0
+\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698713\'02\'07);}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-420\li3360\lin3360 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1
+\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698715\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-420\li3780\lin3780 }{\listname ;}\listid940380088}}{\*\listoverridetable{\listoverride\listid940380088
+\listoverridecount0\ls1}}{\*\revtbl {Unknown;}{Chen, Hesheng;}{lhauch;}}{\*\rsidtbl \rsid1799\rsid91813\rsid396487\rsid483735\rsid552779\rsid655454\rsid685363\rsid805008\rsid1009867\rsid1050478\rsid1054871\rsid1064894\rsid1536027\rsid1734833\rsid1924533\rsid2038300\rsid2172204\rsid2383780
+\rsid2490530\rsid2562233\rsid2574604\rsid2707436\rsid2819890\rsid3217417\rsid3356758\rsid3687826\rsid3947812\rsid3958709\rsid4003508\rsid4355979\rsid4412180\rsid4472091\rsid4527705\rsid4868941\rsid5134899\rsid5203345\rsid5310607\rsid5464326\rsid5852719
+\rsid6362790\rsid6690590\rsid7164825\rsid7174505\rsid7424010\rsid7609983\rsid7997214\rsid8276687\rsid8812445\rsid8814479\rsid8943713\rsid9138298\rsid9446431\rsid9901089\rsid9964275\rsid10190081\rsid10246519\rsid10316983\rsid10440781\rsid10490922
+\rsid10891364\rsid10963834\rsid11147893\rsid11365531\rsid11761618\rsid12071700\rsid12143623\rsid12200614\rsid12483726\rsid12718714\rsid12721085\rsid12721903\rsid12803398\rsid12810495\rsid12914083\rsid13187009\rsid13379505\rsid13771663\rsid13849670
+\rsid14181487\rsid14245224\rsid14313265\rsid15022072\rsid15164179\rsid15283407\rsid15421225\rsid15548121\rsid15563257\rsid15625864\rsid15803579\rsid15860657\rsid16128153\rsid16193110\rsid16255980\rsid16453629\rsid16464444\rsid16524051}{\mmathPr
+\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author kgui1}{\operator Chen, Hesheng}{\creatim\yr2011\mo7\dy1\hr9\min12}{\revtim\yr2017\mo3\dy7\hr14\min11}{\version4}
+{\edmins6}{\nofpages1}{\nofwords2356}{\nofchars13433}{\*\company Intel Corporation}{\nofcharsws15758}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
+\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind5\viewscale100\rsidroot2707436 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \hich )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0
+\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 \hich\f39 UPT.EXE (Intel\'ae\loch\f39 \hich\f39 UEFI Packaging Tool (Intel\'ae\loch\f39 UEFIUPT)) - create, install or remove a UEFI Distribution Package.}{\rtlch\fcs1 \af0\afs18
+\ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af39\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 upt [option] UEFI_PACKAGE_FILE}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The Intel UEFIPT command set has an associated order of execution precedence. For example: -v takes precedence over \hich\f39 \endash \loch\f39
+q which has precedence over \hich\f39 \endash \loch\f39 d which has precedence of \hich\f39 \endash \loch\f39 s.
+\par \hich\af39\dbch\af31505\loch\f39 Execution precedence is defined as follows:
+\par }\pard \ltrpar\ql \li-720\ri0\sb60\nowidctlpar\wrapdefault\faauto\rin0\lin-720\itap0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 upt \hich\f2 \endash \loch\f2 h | --help | --version
+\par }\pard \ltrpar\ql \li-720\ri0\sb60\nowidctlpar\wrapdefault\faauto\rin0\lin-720\itap0\pararsid13187009 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid13187009 \hich\af2\dbch\af31505\loch\f2 upt [-v|\hich\af2\dbch\af31505\loch\f2
+-q|-d DEBUG_LEVEL|-s] [-f] [-x] \hich\f2 \endash \loch\f2 c DistFile \hich\f2 \endash \loch\f2 t DistInfo
+\par }\pard \ltrpar\ql \li-720\ri0\sb60\nowidctlpar\wrapdefault\faauto\rin0\lin-720\itap0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 upt [-v|-q|-d DEBUG_LEVEL|-s] [-f] [-x] \hich\f2 \endash \loch\f2
+c DistFile \hich\f2 \endash \loch\f2 t DistInfo [-m INF_File]+
+\par \hich\af2\dbch\af31505\loch\f2 upt [-v|-q|-d DEBUG_LEVEL|-s] [-f] [-x] \hich\f2 \endash \loch\f2 c DistFile \hich\f2 \endash \loch\f2 t DistInfo [-p DEC_File]+
+\par \hich\af2\dbch\af31505\loch\f2 upt [-v|-q|-d DEBUG_LEVEL|-s] [-f] [-x] \hich\f2 \endash \loch\f2 c\hich\af2\dbch\af31505\loch\f2 DistFile \hich\f2 \endash \loch\f2 t DistInfo [-m INF_File]+ [-p DEC_File]+
+\par \hich\af2\dbch\af31505\loch\f2 upt [-v|-q|-d DEBUG_LEVEL|-s] [-f|-n] [-x] \hich\f2 \endash \loch\f2 i DistFile
+\par \hich\af2\dbch\af31505\loch\f2 upt [-v|-q|-d DEBUG_LEVEL|-s] [}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid5310607 -}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 f] [-x] \hich\f2 \endash
+\loch\f2 r DistFile}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 \hich\f39 Intel\'ae\loch\f39 UEFIPT is used to create, install or remove a UEFI Distribution Package.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 \hich\f39 A \'93\loch\f39 pa\hich\af39\dbch\af31505\loch\f39 \hich\f39 ckage information data\'94\loch\f39 \hich\f39 file (\'94\loch\f39 \hich\f39 .ini\'94
+\loch\f39 \hich\f39 ) comprised of a \'93\loch\f39 \hich\f39 Distribution header\'94\loch\f39 \hich\f39 (required), and optional \'93\loch\f39 \hich\f39 Miscellaneous File Header, and/or \'93\loch\f39 \hich\f39 Tools Header\'94\loch\f39
+ is required to create a distribution package. Instructions on how to create a package information file an\hich\af39\dbch\af31505\loch\f39 d\hich\af39\dbch\af31505\loch\f39 \hich\f39 its required content may be found in the Intel\'ae\loch\f39 \hich\f39
+ UEFI Packaging Tool (Intel\'ae\loch\f39 UEFIPT) Quick Start guide. }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 When entered on the command line, file locations are relative to the program execution path set in the OS environment variable }{\rtlch\fcs1 \af2\afs18
+\ltrch\fcs0 \f2\fs18\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 WORKSPACE}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298 .
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Intel UEFIPT \hich\af39\dbch\af31505\loch\f39 provides development environment support for the EDK II development tree.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf18\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Windows Development Workstations}{\rtlch\fcs1 \ab\af39\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The working directory for the EDK II build tree (containing distribution packages) is defined as a first level folder from the root directory for dri
+\hich\af39\dbch\af31505\loch\f39 ve C. For example:
+\par }\pard \ltrpar\qc \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \f2\fs18\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 C:\\EDKII>
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39
+In this example, the OS environment variable WORKSPACE is set to the working directory for EDK II development. For example:
+\par }\pard \ltrpar\qc \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \f2\fs18\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 C:\\>set WORKSPACE=C:\\EDKII
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf18\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Windows 7 Development Workstations
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 For Windows 7 users, it is recommended that you use the }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf19\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 subst
+}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39
+command, keeping your edk2 downloads in your home directory. Windows 7 only allows administrators to create folders in the root directory. If you can remember to always open the cmd.exe using "r\hich\af39\dbch\af31505\loch\f39
+un as administrator ...", the directions above can be used. Otherwise, if you sources are located in a directory path such as the following:
+\par }\pard \ltrpar\qc \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \f2\fs18\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 C:\\Users\\myname\\Documents\\Work\\edk2>
+\par \hich\af2\dbch\af31505\loch\f2 subst z: C:\\Users\\myname\\Documents\\Work\\edk2
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Then set the OS environment varia\hich\af39\dbch\af31505\loch\f39
+ble WORKSPACE to the newly created drive:
+\par }\pard \ltrpar\qc \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid2707436 {\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \f2\fs18\cf13\insrsid2707436 \hich\af2\dbch\af31505\loch\f2 C:\\Users\\myname\\Documents\\Work\\edk2>z:
+\par }\pard \ltrpar\qc \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \f2\fs18\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 z:\\>set WORKSPACE=z:\\
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf18\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Linux and OS/X Development Workstations
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The working directory for the EDK II build tree (containing distribution packages) is defined as a first level fo\hich\af39\dbch\af31505\loch\f39
+lder from your home directory. For example:
+\par }\pard \ltrpar\qc \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \f2\fs18\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 [/home/myname/edk2] #
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39
+In this example, the OS environment variable WORKSPACE is set to the working directory for EDK II development. For example:
+\par }\pard \ltrpar\qc \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \f2\fs18\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 [/home/myname/edk2] # export WORKSPACE=/home/myname/edk2
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The OS e\hich\af39\dbch\af31505\loch\f39 nvironment variable}{\rtlch\fcs1 \af39
+\ltrch\fcs0 \insrsid9138298 \hich\af39\dbch\af31505\loch\f39 }{\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \f2\fs18\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 WORKSPACE}{\rtlch\fcs1 \af39 \ltrch\fcs0 \insrsid9138298 \hich\af39\dbch\af31505\loch\f39 }{
+\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 is now set to the EDKII WORKSPACE}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 To create a distribution package:}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid483735
+\par }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 >upt -c test.dist -p MdePkg/MdePkg.dec -t Package_Information_Data_File.ini}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid2172204
+\par }\pard \ltrpar\ql \fi-360\li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0\pararsid685363 {\rtlch\fcs1 \af3\afs18 \ltrch\fcs0 \f3\fs18\cf1\insrsid9138298 \loch\af3\dbch\af31505\hich\f3 \'b7\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'93\loch\f39 \hich\f39 test.dist\'94\loch\f39 is the target distribution package that will be generated. If a dest\hich\af39\dbch\af31505\loch\f39
+ination path is not supplied, the test.dist will be created in the }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10246519 \hich\af39\dbch\af31505\loch\f39 current working }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298
+\hich\af39\dbch\af31505\loch\f39 directory}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14181487 ,}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \fi-360\li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af3\afs18 \ltrch\fcs0 \f3\fs18\cf1\insrsid9138298 \loch\af3\dbch\af31505\hich\f3 \'b7\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'93\loch\f39 \hich\f39 MdePkg/MdePkg.dec\'94\loch\f39 is the path and the source file used to generate the distribution package, }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+
+\par }{\rtlch\fcs1 \af3\afs18 \ltrch\fcs0 \f3\fs18\cf1\insrsid9138298 \loch\af3\dbch\af31505\hich\f3 \'b7\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'93\loch\f39 \hich\f39
+Package_Information_Data_File.ini\'94\hich\af39\dbch\af31505\loch\f39 \hich\f39 is the file which specifies the information not included in \'93\loch\f39 \hich\f39 MdePkg/MdePkg.dec\'94\loch\f39
+ but is required by the packaging specification. If a source path for the Package_Information_Data_File.ini is not provided, }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10246519 \hich\af39\dbch\af31505\loch\f39
+Intel UEFIPT will attempt to locate the file in the\hich\af39\dbch\af31505\loch\f39 current working directory or, failing that, the tool will attempt to locate it in}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298
+\hich\af39\dbch\af31505\loch\f39 $(WORKSPACE)}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10246519 \hich\af39\dbch\af31505\loch\f39 directory}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 .}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 UPT User Extensions
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 User extensions are provided so meta}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298 -}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 data files can be created which provide functionality identical to the original meta-data. D\hich\af39\dbch\af31505\loch\f39 \hich\f39 etails about user extensions are located in the Intel\'ae
+\loch\f39 UEFIPT Quick Start Guide. }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Options
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af39\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 --version
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Show program's version number and exit
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -h, --help
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Show this help message and exit
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -d DEBUG_LEVEL, --debug=DEBUG_LEVEL
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Print DEBUG statements, where DEBUG_LEVEL is 0-9
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -v, --verbose
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Print informational statements
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -s, --silent
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39
+Returns only the exit code informational and error messages are not displayed
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -q, --quiet
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Returns the exit code and displays error messages onl
+\hich\af39\dbch\af31505\loch\f39 y}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -i INSTALL_DISTRIBUTION_PACKAGE_FILE}{\rtlch\fcs1 \ab\af0\afs18
+\ltrch\fcs0 \b\f0\fs18\cf1\insrsid9138298 ,\line }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 --install= INSTALL_DISTRIBUTION_PACKAGE_FILE}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Specify the UEFI Distribution Package filename to install
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -c CREATE_DISTRIBUTION_PACKAGE_FILE,}{\rtlch\fcs1 \ab\af0\afs18
+\ltrch\fcs0 \b\f0\fs18\cf1\insrsid9138298 \line }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 --create= CREATE_DISTRIBUTION_PACKAGE_FILE}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Specify the UEFI Distribution Package filename to create
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -r REMOVE_DISTRIBUTION_PACKAGE_FILE,}{\rtlch\fcs1 \ab\af0\afs18
+\ltrch\fcs0 \b\f0\fs18\cf1\insrsid9138298 \line }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 --remove= REMOVE_DISTRIBUTION_PACKAGE_FILE}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Specify the UEFI Distribution Package filename to remove
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -t PACKAGE_INFORMATION_DATA _FILE,}{\rtlch\fcs1 \ab\af0\afs18
+\ltrch\fcs0 \b\f0\fs18\cf1\insrsid9138298 \line }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 --template= PACKAGE_\hich\af39\dbch\af31505\loch\f39 INFORMATION_DATA_FILE}{\rtlch\fcs1 \ab\af0\afs18
+\ltrch\fcs0 \b\f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Specify Package Information Data filename to create package}{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -p EDK2_DEC_FILENAME, --dec-filename= EDK2_DEC_FILENAME}{\rtlch\fcs1
+\ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Specify dec file names to create package}{\rtlch\fcs1 \af0\afs18
+\ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -m EDK2_INF_FILENAME, --inf-filename= EDK2_INF_FILENAME}{\rtlch\fcs1
+\ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Specify inf file \hich\af39\dbch\af31505\loch\f39 names to create package}
+{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -f, --force
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Disable all user prompts}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -n, --custom-path}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Enable user prompting for alternate installation directories}{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -x, --}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid15860657 \hich\af39\dbch\af31505\loch\f39 free}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -lock
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Skip the check for multiple instances}{\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637064\insrsid9138298
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\prauth1\prdate1196637066\rin0\lin0\itap0\pararsid6690590 {\*\oldpprops \pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid6690590 }{\rtlch\fcs1
+\ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\revauth1\revdttm1196637066\insrsid6690590 \hich\af39\dbch\af31505\loch\f39 }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637065\insrsid6690590\charrsid6690590 {\*\oldcprops \b0\f0\crauth1\crdate1196637065\insrsid6690590\charrsid6690590 }-\hich\af39\dbch\af31505\loch\f39 l, --list }{\rtlch\fcs1
+\ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\revauth1\revdttm1196637066\insrsid6690590
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid6690590 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 {\*\oldcprops
+\f0\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 }\hich\af39\dbch\af31505\loch\f39 List the UEFI Distribution Packages that have been}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637066\insrsid6690590
+\hich\af39\dbch\af31505\loch\f39 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 {\*\oldcprops \f0\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 }
+\hich\af39\dbch\af31505\loch\f39 installed
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\prauth1\prdate1196637065\rin0\lin0\itap0\pararsid6690590 {\*\oldpprops \pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid6690590 }{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\revised\revauth1\revdttm1196637064\insrsid6690590\charrsid6690590 \hich\af0\dbch\af31505\loch\f0 }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637065\insrsid6690590\charrsid6690590 {\*\oldcprops \b0\f0\crauth1\crdate1196637065\insrsid6690590\charrsid6690590 }\hich\af39\dbch\af31505\loch\f39
+-u REPLACE_DISTRIBUTION_PACKAGE_FILE, --replace=REPLACE_DISTRIBUTION_PACKAGE_FILE}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\revised\revauth1\revdttm1196637064\insrsid6690590\charrsid6690590
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid6690590 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 {\*\oldcprops
+\f0\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 }\hich\af39\dbch\af31505\loch\f39 Specify the UEFI Distribution Package file name to}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637067\insrsid6690590
+\hich\af39\dbch\af31505\loch\f39 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 {\*\oldcprops \f0\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 }
+\hich\af39\dbch\af31505\loch\f39 replace the existing file name
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\prauth1\prdate1196637065\rin0\lin0\itap0\pararsid6690590 {\*\oldpprops \pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid6690590 }{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\revised\revauth1\revdttm1196637064\insrsid6690590\charrsid6690590 \hich\af0\dbch\af31505\loch\f0 }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637065\insrsid6690590\charrsid6690590 {\*\oldcprops \b0\f0\crauth1\crdate1196637065\insrsid6690590\charrsid6690590 }\hich\af39\dbch\af31505\loch\f39
+-o ORIGINAL_DISTRIBUTION_PACKAGE_FILE, --original=ORIGINAL_DISTRIBUTION_PACKAGE_FILE
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid6690590 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 {\*\oldcprops
+\f0\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 }\hich\af39\dbch\af31505\loch\f39 Specify the UEF\hich\af39\dbch\af31505\loch\f39 I Distribution Package file name to be}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\revised\revauth1\revdttm1196637067\insrsid6690590 \hich\af39\dbch\af31505\loch\f39 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 {\*\oldcprops
+\f0\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 }\hich\af39\dbch\af31505\loch\f39 replaced
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\prauth1\prdate1196637067\rin0\lin0\itap0\pararsid6690590 {\*\oldpprops \pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid6690590 }{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\revised\revauth1\revdttm1196637064\insrsid6690590\charrsid6690590 \hich\af0\dbch\af31505\loch\f0 }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637065\insrsid6690590\charrsid6690590 {\*\oldcprops \b0\f0\crauth1\crdate1196637065\insrsid6690590\charrsid6690590 }\hich\af39\dbch\af31505\loch\f39 --use-guided-paths}{\rtlch\fcs1
+\ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\revauth1\revdttm1196637067\insrsid6690590
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid6690590 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 {\*\oldcprops
+\f0\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 }\hich\af39\dbch\af31505\loch\f39 Install packages to the following directory path by}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637067\insrsid6690590
+\hich\af39\dbch\af31505\loch\f39 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 {\*\oldcprops \f0\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 }
+\hich\af39\dbch\af31505\loch\f39 default:}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637067\insrsid6690590 \hich\af39\dbch\af31505\loch\f39 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 {\*\oldcprops \f0\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 }\hich\af39\dbch\af31505\loch\f39 <PackageName>_<PACKAGE_GUID>_<PACKAGE_VERSION>
+}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\revised\revauth1\revdttm1196637064\insrsid6690590\charrsid6690590
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\prauth1\prdate1196637065\rin0\lin0\itap0\pararsid6690590 {\*\oldpprops \pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid6690590 }{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\revised\revauth1\revdttm1196637064\insrsid6690590\charrsid6690590 \hich\af0\dbch\af31505\loch\f0 }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637065\insrsid6690590\charrsid6690590 {\*\oldcprops \b0\f0\crauth1\crdate1196637065\insrsid6690590\charrsid6690590 }\hich\af39\dbch\af31505\loch\f39 -j\hich\af39\dbch\af31505\loch\f39
+ TEST_INSTALL_DISTRIBUTION_PACKAGE_FILES, --test-install=TEST_INSTALL_DISTRIBUTION_PACKAGE_FILES}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\revised\revauth1\revdttm1196637064\insrsid6690590\charrsid6690590
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid6690590 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 {\*\oldcprops
+\f0\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 }\hich\af39\dbch\af31505\loch\f39 Specify the UEFI Distribution Package filenames to}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637067\insrsid6690590
+\hich\af39\dbch\af31505\loch\f39 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637064\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 {\*\oldcprops \f0\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 }
+\hich\af39\dbch\af31505\loch\f39 install}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 {\*\oldcprops \f0\crauth1\crdate1196637066\insrsid6690590\charrsid6690590 }
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Examples}{\rtlch\fcs1 \ab\af0\afs28 \ltrch\fcs0
+\b\f0\fs28\cf17\insrsid9138298
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 In the examples below, the "\\\hich\af39\dbch\af31505\loch\f39
+" character is used to indicate line extension. On Microsoft* Windows based workstations, the command-line must appear on a single line, while under Linux and OS/X, the shell will correctly handle the "\\
+" line extension character and the command can appea\hich\af39\dbch\af31505\loch\f39 r\hich\af39\dbch\af31505\loch\f39 on separate lines.
+\par \hich\af39\dbch\af31505\loch\f39 All EDK II tools allow the user to specify a forward slash "/" character in directory names on the command-line.
+\par \hich\af39\dbch\af31505\loch\f39 The command-line prompt in the following Intel UEFIPT examples is ">"; command-line prompt character may vary based on the \hich\af39\dbch\af31505\loch\f39 operating system.
+\par }\pard \ltrpar\ql \fi-360\li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 1.\tab \hich\f39 Option \'93\loch\f39 }{\rtlch\fcs1 \ab\af39\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 -c, --create}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'94\loch\f39 }{\rtlch\fcs1 \af10\afs18 \ltrch\fcs0
+\f10\fs18\cf1\insrsid9138298 \loch\af10\dbch\af31505\hich\f10 \'e0}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 create a distribution package}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The command showing the proper syntax used to create a distribution package}
+{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298 .
+\par
+\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 >upt -c test.dist -p MdePkg/MdePkg.dec -t Package_Information_Data_File.ini
+\par }\pard \ltrpar\ql \fi-360\li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af3\afs18 \ltrch\fcs0 \f3\fs18\cf1\insrsid9138298 \loch\af3\dbch\af31505\hich\f3 \'b7\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'93}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 test.dist}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298
+\loch\af39\dbch\af31505\hich\f39 \'94\hich\af39\dbch\af31505\loch\f39 is the target distribution package to be generated, }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af3\afs18 \ltrch\fcs0 \f3\fs18\cf1\insrsid9138298 \loch\af3\dbch\af31505\hich\f3 \'b7\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'93}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0
+\f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 MdePkg/MdePkg.dec}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'94\loch\f39 is the path and source used to generate the distribution package, }
+{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af3\afs18 \ltrch\fcs0 \f3\fs18\cf1\insrsid9138298 \loch\af3\dbch\af31505\hich\f3 \'b7\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'93}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0
+\f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 Package_Information_Data_File.ini}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'94\loch\f39 \hich\f39
+ is the file which specifies the information not included in \'93}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 MdePkg\\MdePkg\hich\af2\dbch\af31505\loch\f2 .dec}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'94\loch\f39 but is required by the packaging specification
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The extended version of the commands:}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid9138298
+\par
+\par \ltrrow}\trowd \irow0\irowband0\lastrow \ltrrow\ts11\trqc\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt
+\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6120\clshdrawnil \cellx6012\pard \ltrpar\ql \li0\ri0\sb60\keep\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0
+\f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 >upt -\hich\f2 \endash \loch\f2 create=test.dist --dec-filename=MdePkg/MdePkg.dec \\
+\par }\pard \ltrpar\ql \li0\ri0\sl276\slmult1\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 --template=Package_Information_Data_File.ini}{\rtlch\fcs1
+\af0\afs16 \ltrch\fcs0 \f0\fs16\cf13\insrsid9138298 \cell }\pard \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \f0\fs16\cf13\insrsid9138298
+\trowd \irow0\irowband0\lastrow \ltrrow\ts11\trqc\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt
+\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth6120\clshdrawnil \cellx6012\row }\pard \ltrpar\ql \fi-360\li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 2.\tab Option }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'93\loch\f39 -m, --inf-filename}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'94\loch\f39 }{\rtlch\fcs1 \af10\afs18 \ltrch\fcs0 \f10\fs18\cf1\insrsid9138298 \loch\af10\dbch\af31505\hich\f10 \'e0}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298
+\hich\af39\dbch\af31505\loch\f39 Specifying the module file name for inclusion in the distribution package.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par \ltrrow}\trowd \irow0\irowband0\lastrow \ltrrow\ts11\trqc\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt
+\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8100\clshdrawnil \cellx7992\pard \ltrpar\ql \li0\ri0\sb60\keep\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0
+\f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 >upt \hich\f2 \endash \loch\f2 c testm.dist \\
+\par \hich\af2\dbch\af31505\loch\f2 -m MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf \\
+\par \hich\af2\dbch\af31505\loch\f2 \hich\f2 \endash \loch\f2 t Package_Information_Data_File.ini
+\par }\pard \ltrpar\ql \li0\ri0\keep\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \f0\fs16\cf13\insrsid9138298 \cell }\pard \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
+\rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \f0\fs16\cf13\insrsid9138298 \trowd \irow0\irowband0\lastrow \ltrrow\ts11\trqc\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10
+\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8100\clshdrawnil \cellx7992\row }\pard \ltrpar
+\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The extended version of the command:}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par
+\par \ltrrow}\trowd \irow0\irowband0\lastrow \ltrrow\ts11\trqc\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt
+\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8483\clshdrawnil \cellx8375\pard \ltrpar\ql \li0\ri0\sb60\keep\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0
+\f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 >upt -\hich\f2 \endash \loch\f2 create=testm.dist \\
+\par \hich\af2\dbch\af31505\loch\f2 --inf-filename=MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf \\
+\par \hich\af2\dbch\af31505\loch\f2 \hich\f2 \endash \loch\f2 -template=Package_Information_Data_File.ini
+\par }\pard \ltrpar\ql \li0\ri0\keep\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \f0\fs16\cf13\insrsid9138298 \cell }\pard \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {
+\rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \f0\fs16\cf13\insrsid9138298 \trowd \irow0\irowband0\lastrow \ltrrow\ts11\trqc\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10
+\trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8483\clshdrawnil \cellx8375\row }\pard \ltrpar
+\ql \fi-360\li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af3\afs18 \ltrch\fcs0 \f3\fs18\cf1\insrsid9138298 \loch\af3\dbch\af31505\hich\f3 \'b7\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298
+\loch\af39\dbch\af31505\hich\f39 \'93}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 testm.dist}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 \hich\f39 \'93
+\loch\f39 is the target distribution package to be generated,}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af3\afs18 \ltrch\fcs0 \f3\fs18\cf1\insrsid9138298 \loch\af3\dbch\af31505\hich\f3 \'b7\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'93}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0
+\f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 MdeModulePkg/Univers\hich\af2\dbch\af31505\loch\f2 al/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'94
+\loch\f39 is the path and filename for the module to be included in the distribution package, and
+\par }{\rtlch\fcs1 \af3\afs18 \ltrch\fcs0 \f3\fs18\cf1\insrsid9138298 \loch\af3\dbch\af31505\hich\f3 \'b7\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'93}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0
+\f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 Package_Information_Data_File.ini}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'94\loch\f39 \hich\f39
+ is the file which specifies the information not included in \'93}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 AcpiPlatformDxe.inf}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298
+\hich\af39\dbch\af31505\loch\f39 \hich\f39 \'94\hich\af39\dbch\af31505\loch\f39 but is required by the packaging specification
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \fi-360\li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 3.\tab \hich\f39 Option \'93}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid9138298 -}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 i, --install}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'94\loch\f39
+}{\rtlch\fcs1 \af10\afs18 \ltrch\fcs0 \f10\fs18\cf1\insrsid9138298 \loch\af10\dbch\af31505\hich\f10 \'e0}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 install a UEFI package file
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39
+File locations are relative to the program execution path set in the OS environment variable WORKSPACE. WORKSPACE is set to the working directory for t\hich\af39\dbch\af31505\loch\f39 he EDK II development tree (containing distribution packages).
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf18\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Windows Development Workstations
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The working directory of the EDKII development tree is a first level folder from the root directory for drive C. For example:
+\par }\pard \ltrpar\qc \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 C:\\EDKII>
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39
+In this example, the OS environment variable WORKSPACE is set to the working directory for EDK II. For example:
+\par }\pard \ltrpar\qc \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 C:\\>set WORKSPACE=C:\\EDKII
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf18\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Windows 7 Development Workstations
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 For Windows 7 users, it is recommended that you use the subst command, keeping you\hich\af39\dbch\af31505\loch\f39
+r edk2 downloads in your home directory. Windows 7 only allows administrators to create folders in the root directory. If you can remember to always open the cmd.exe using "run as administrator ...", the directions above can be used. Otherwise, if you sou
+\hich\af39\dbch\af31505\loch\f39 r\hich\af39\dbch\af31505\loch\f39 ces are located in a directory path such as the following:
+\par }\pard \ltrpar\qc \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \f2\fs18\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 C:\\Users\\myname\\Documents\\Work\\edk2>
+\par \hich\af2\dbch\af31505\loch\f2 subst z: C:\\Users\\myname\\Documents\\Work\\edk2
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Then set the OS environment variable WORKSPACE to the newly created drive:
+
+\par }\pard \ltrpar\qc \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \f2\fs18\cf13\insrsid3217417 \hich\af2\dbch\af31505\loch\f2 C:\\Users\\myname\\Documents\\Work\\edk2>z:}{\rtlch\fcs1 \af2\afs18
+\ltrch\fcs0 \f2\fs18\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 z:\\\hich\af2\dbch\af31505\loch\f2 >set WORKSPACE=z:\\
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf18\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Linux and OS/X Development Workstations
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The working directory for the EDK II build tree (containing distribution packages) is defined as a first level folder from your home directory. For example:
+
+\par }\pard \ltrpar\qc \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \f2\fs18\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 [/home/myname/edk2] #
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 In this example,\hich\af39\dbch\af31505\loch\f39
+ the OS environment variable WORKSPACE is set to the working directory for EDK II development. For example:
+\par }\pard \ltrpar\qc \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \f2\fs18\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 [/home/myname/edk2] # export WORKSPACE=/home/myname/edk2
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The OS environment variable WORKSPACE is now set to the EDKII WORKSPACE}{
+\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298 .
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Copy the distribut\hich\af39\dbch\af31505\loch\f39 \hich\f39 ion package file to the location to which the OS variable \'93\loch\f39 \hich\f39 WORKSPACE\'94
+\loch\f39 has been defined. For example:
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf18\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Windows Development Workstations}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li1440\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin1440\itap0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 >copy test.dist %WORKSPACE%
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf18\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Linux and OS/X Development Workstations
+\par }\pard \ltrpar\ql \li1440\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin1440\itap0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 # cp test.dist $WORKSPACE}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Execute the UPT command to i\hich\af39\dbch\af31505\loch\f39
+nstall the distribution package. For example:
+\par }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 >UPT \hich\f2 \endash \loch\f2 i test.dist
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The extended version of the command:}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 >UPT \hich\f2 \endash \loch\f2 -install=test.dist
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 If the distribution package target folder is already present (for example, MdePkg already exists), Intel UEFIPT will inform you th
+\hich\af39\dbch\af31505\loch\f39 at the specified target already exists and will prompt you to enter another location. If no additional locations are required, pressing [ENTER] will exit the tool. The following is an output display example:}{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf18\insrsid9138298 \hich\af0\dbch\af31505\loch\f0 Windows Development Workstations}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par \ltrrow}\trowd \irow0\irowband0\lastrow \ltrrow\ts11\trqc\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt
+\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth7578\clshdrawnil \cellx7470\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af2\afs16
+\ltrch\fcs0 \f2\fs16\cf1\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 C:\\EDKII>upt \hich\f2 \endash \hich\af2\dbch\af31505\loch\f2 i test.dist\line \hich\f2 Unzipping and parsing distribution package XML file\'85\line \line \loch\f2 Dist.content -> C:\\
+EDKII\\dist.content\line \hich\f2 Installing package \'85\loch\f2 MdePkg Version 1.02\line This directory already exists: MdePkg.\line Please select another location. Press [Enter] with no input to quit:\line
+\par }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 My\hich\af2\dbch\af31505\loch\f2 DistributionPackageSource\\}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf1\insrsid9138298 \cell }\pard \ltrpar
+\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf1\insrsid9138298 \trowd \irow0\irowband0\lastrow \ltrrow\ts11\trqc\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl
+\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth7578\clshdrawnil \cellx7470\row }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf18\insrsid9138298 \hich\af0\dbch\af31505\loch\f0
+Linux and OS/X Development Workstations}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par \ltrrow}\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf1\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 # upt \hich\f2 \endash \loch\f2 i test.dist\line \hich\f2
+Unzipping and parsing distribution package XML file\'85\line \line \loch\f2 Dist.content -> /home/myname/edk2/dist.content\line \hich\f2 Installing package \'85\loch\f2 MdePkg Version 1.02\line This directory already exis\hich\af2\dbch\af31505\loch\f2
+ts: MdePkg.\line Please select another location. Press [Enter] with no input to quit:\line
+\par }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 MyDistributionPackageSource/}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf1\insrsid9138298 \cell }\pard \ltrpar
+\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf1\insrsid9138298 \trowd \irow0\irowband0\lastrow \ltrrow\ts11\trqc\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl
+\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth7578\clshdrawnil \cellx7470\row }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \fi-360\li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 4.\tab \hich\f39 Option \'93\loch\f39 \hich\f39 -r, --remove\'94
+\loch\f39 }{\rtlch\fcs1 \af10\afs18 \ltrch\fcs0 \f10\fs18\cf1\insrsid9138298 \loch\af10\dbch\af31505\hich\f10 \'e0}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 remove a UEFI package file}{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 >upt -r test.dist
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The extended version of the command}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15283407 \hich\af39\dbch\af31505\loch\f39
+ using a second version of a distribution that was also installed}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 :}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 >upt -\hich\f2 \endash \loch\f2 remove=test_80c92dc3-3a9c-42e9-9b92-4d2b82f0025b_1.0.dist
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 \hich\f39 Where \'93}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 test.dist}{\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid9138298 \loch\af39\dbch\af31505\hich\f39 \'93\loch\f39 and }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 test_80c92dc3-3a9c-42e9-9b92-4d2b82f0025b_1.0.dist}{\rtlch\fcs1
+\af2\afs16 \ltrch\fcs0 \f2\fs16\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 }{\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \fs18\insrsid9138298\charrsid10246519 \hich\af39\dbch\af31505\loch\f39 are }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298
+\hich\af39\dbch\af31505\loch\f39 the names of }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10246519 \hich\af39\dbch\af31505\loch\f39 installed }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39
+UEFI distribution package}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10246519 \hich\af39\dbch\af31505\loch\f39 s}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 that will be removed}{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298 .}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\insrsid9138298
+\par }\pard \ltrpar\ql \fi-360\li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 5.\tab \hich\f39 Option \'93\loch\f39 \hich\f39 -n, --custom-path\'94
+\loch\f39 }{\rtlch\fcs1 \af10\afs18 \ltrch\fcs0 \f10\fs18\cf1\insrsid9138298 \loch\af10\dbch\af31505\hich\f10 \'e0}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39
+ prompt for the source path for each package in the distribution}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 upt -i test.dist \hich\f2 \endash \loch\f2 n
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The extended version of the command:}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 upt \hich\f2 \endash }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid12483726 -}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298
+\hich\af2\dbch\af31505\loch\f2 install=test.dist --custom-path
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 You will be presented with a display simi\hich\af39\dbch\af31505\loch\f39 lar to the following:
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf18\insrsid9138298 \hich\af0\dbch\af31505\loch\f0 Windows Development Workstations}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298
+\par \ltrrow}\trowd \irow0\irowband0\lastrow \ltrrow\ts11\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt
+\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth8856\clshdrawnil \cellx8748\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af2\afs16
+\ltrch\fcs0 \f2\fs16\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 C:\\EDKII}{\rtlch\fcs1 \af2\afs22 \ltrch\fcs0 \f2\fs22\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 >upt \hich\f2 \endash \loch\f2 i test.dist \hich\f2 \endash \loch\f2 n\line }{
+\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf1\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 \hich\f2 Unzipping and parsing distribution package XML file\'85\line \loch\f2 dist.pkg -> c:\\EDKII\\dist.pkg\line \line Dist.content -> C:\\EDKII\\
+dist.content\line \hich\f2 Installing package \'85\loch\f2 MdePkg Version 1.02\line \hich\af2\dbch\af31505\loch\f2 Please select package location. Press [Enter] with no input to quit:\line }{\rtlch\fcs1 \af2\afs22 \ltrch\fcs0 \f2\fs22\insrsid9138298
+
+\par }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 MyDistributionPackageSource\\}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298 \cell }\pard \ltrpar
+\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298 \trowd \irow0\irowband0\lastrow \ltrrow\ts11\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl
+\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth8856\clshdrawnil \cellx8748\row }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf18\insrsid9138298 \hich\af0\dbch\af31505\loch\f0
+Linux and OS/X Development Workstations}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par \ltrrow}\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 # }{\rtlch\fcs1 \af2\afs22 \ltrch\fcs0 \f2\fs22\insrsid9138298
+\hich\af2\dbch\af31505\loch\f2 upt \hich\f2 \endash \loch\f2 i test.dist \hich\f2 \endash \loch\f2 n\line }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf1\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 \hich\f2
+Unzipping and parsing distribution package XML file\'85\line \loch\f2 dist.pkg -> /home/myname/edk2/dist.pkg\line \line \hich\af2\dbch\af31505\loch\f2 Dist.content -> /home/myname/edk2/dist.content\line \hich\f2 Installing package \'85\loch\f2
+ MdePkg Version 1.02\line Please select package location. Press [Enter] with no input to quit:\line }{\rtlch\fcs1 \af2\afs22 \ltrch\fcs0 \f2\fs22\insrsid9138298
+\par }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 MyDistributionPackageSource/}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298 \cell }\pard \ltrpar
+\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298 \trowd \irow0\irowband0\lastrow \ltrrow\ts11\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl
+\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth8856\clshdrawnil \cellx8748\row }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 6.\tab \hich\f39 Option \'93\loch\f39 \hich\f39 -x, --free-lock\'94\loch\f39 }{\rtlch\fcs1 \af10\afs18 \ltrch\fcs0 \f10\fs18\cf1\insrsid9138298
+\loch\af10\dbch\af31505\hich\f10 \'e0}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 \hich\f39 instructs the Intel\'ae\loch\f39 UEFIPT to uncondi\hich\af39\dbch\af31505\loch\f39
+tionally free the lock on the UPT database before any UPT operations are executed.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39
+Background: While executing, the Intel UEFIPT locks the UPT database. This precludes any other instance of Intel UEFIPT from executing. If Intel UEFIPT should be stopped for\hich\af39\dbch\af31505\loch\f39 \hich\f39
+ some reason (for example, you press CTRL+C) the UPT database will remain locked. The \'93\loch\f39 \hich\f39 -x, --free-lock\'94\loch\f39 option is used to skip the lock check.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 >upt -i test.dist \hich\f2 \endash \loch\f2 x
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 The extended version of the command:}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 >upt \hich\f2 \endash }{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid11147893 -}{\rtlch\fcs1 \af2\afs16 \ltrch\fcs0 \f2\fs16\cf13\insrsid9138298
+\hich\af2\dbch\af31505\loch\f2 install=test.dist \hich\f2 \endash \loch\f2 -free-lock
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 If the UPT databas\hich\af39\dbch\af31505\loch\f39 e is locked, you will be presented with a display similar to the following:}{\rtlch\fcs1 \af0\afs18
+\ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par
+\par \ltrrow}\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 {\rtlch\fcs1 \af2\afs18 \ltrch\fcs0 \f2\fs18\insrsid9138298 \hich\af2\dbch\af31505\loch\f2 >upt \hich\f2 \endash \loch\f2 c test28.dist \hich\f2 \endash \loch\f2
+p MdePkg/MdePkg.dec \hich\f2 \endash \loch\f2 t Package_Information_Data_File.ini\line \line \hich\f2 upt\'85\line \loch\f2 : error D003: UPT is already running. Only one instance is allowed\line }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid9138298 \cell }\pard \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298 \trowd \irow0\irowband0\lastrow \ltrrow
+\ts11\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trftsWidth1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10
+\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth8856\clshdrawnil \cellx8748\row }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\hich\af0\dbch\af31505\loch\f0 NOTE: Error message forma\hich\af0\dbch\af31505\loch\f0 t varies based on the Development Workstation operating system.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 During stress testing under Microsoft* Windows 7 with anti-virus software enabled, the tool failed after successfully completing 400 create package operations
+\par \hich\af39\dbch\af31505\loch\f39
+An EDK II binary module that uses binary file types of UNI_VER, UNI_UI, LIB and UEFI_APP cannot be distributed using the standard features, however the contents may be distributed using MiscellaneousFiles portion of the UPT.
+\par \hich\af39\dbch\af31505\loch\f39 When installing a UEFI Distribu\hich\af39\dbch\af31505\loch\f39
+tion Package generated by other tools that allow absolute path names for files, the error messages on Windows are different than the error messages on *NIX systems. The Intel UEFIPT does not support absolute path names for files and directories.
+\par \hich\af39\dbch\af31505\loch\f39 If an EDK \hich\af39\dbch\af31505\loch\f39 II Meta-data file is incorrectly formatted, information from the header comment block, such as copyright and license may be lost.
+\par \hich\af39\dbch\af31505\loch\f39 Manually removing or renaming a directory tree that was installed by the Intel UEFIPT will not allow using the Intel UEFIPT fo\hich\af39\dbch\af31505\loch\f39 r other operations.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid9138298
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Windows: %WORKSPACE%\\BaseTools\\Conf}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298 \\}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298
+\hich\af39\dbch\af31505\loch\f39 Empty_Package_Information_Data_File.ini
+\par \hich\af39\dbch\af31505\loch\f39 Linux & OS/X: $(WORKSPACE)/BaseTools/Conf/Empty_Package_Information_Data_File.ini}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 \hich\f39 Intel\'ae\loch\f39 \hich\f39 UEFI Packaging Tool (Intel\'ae\loch\f39 UEFIPT) Quick Start guide (}{\field{\*\fldinst {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\revised\revauth2\revdttm-1493759412\insrsid1799 \hich\af39\dbch\af31505\loch\f39 HYPERLINK "../../BaseTools_r2100/UserManuals/www.tianocore.org"}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\deleted\fs18\cf1\revauthdel2\revdttmdel-1493759412\insrsid9138298\delrsid1799 \hich\af39\dbch\af31505\loch\f39 HYPERLINK "www.tianocore.org"}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth2\revdttm-1493759412\insrsid1799 {\*\datafield
+00d0c9ea79f9bace118c8200aa004ba90b0200000001000000e0c9ea79f9bace118c8200aa004ba90b800000002e002e002f002e002e002f00420061007300650054006f006f006c0073005f00720032003100300030002f0055007300650072004d0061006e00750061006c0073002f007700770077002e00740069006100
+6e006f0063006f00720065002e006f00720067000000795881f43b1d7f48af2c825dc485276300000000a5ab000000}}}{\fldrslt {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\ul\cf2\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 www.tianocore.org}}}\sectd \ltrsect
+\linex0\sectdefaultcl\sftnbj {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 , edk2/Documents)
+\par \hich\af39\dbch\af31505\loch\f39 The \hich\af39\dbch\af31505\loch\f39
+Distribution Package (.dist) for install and create, along with the Package Information Data File (.ini) are not required to be in the EDK II WORKSPACE. All other files are required to be in the directory tree pointed to by the system environment variable
+\hich\af39\dbch\af31505\loch\f39 :\hich\af39\dbch\af31505\loch\f39 WORKSPACE. (The Distribution Package file name used during removal is in the $(WORKSPACE)/Conf directory tree, placed there during package installation by the tool.)
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 \hich\f39 Copyright\'a9\loch\f39 2011}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1196637062\insrsid2038300 \hich\af39\dbch\af31505\loch\f39 - 2017}{\rtlch\fcs1
+\af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Intel Corporation. All rights reserved}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298 .
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 This progra\hich\af39\dbch\af31505\loch\f39
+m and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at:}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid9138298 \line }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 }{\field{\*\fldinst {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\insrsid9138298 \hich\af39\dbch\af31505\loch\f39
+HYPERLINK "http://opensource.org/licenses/bsd-license.ph\hich\af39\dbch\af31505\loch\f39 p"}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\insrsid2707436 {\*\datafield
+00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90b7600000068007400740070003a002f002f006f00700065006e0073006f0075007200630065002e006f00720067002f006c006900630065006e007300650073002f006200730064002d006c006900630065006e007300
+65002e007000680070000000795881f43b1d7f48af2c825dc485276300000000a5ab0000334900}}}{\fldrslt {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\ul\cf2\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 http://opensource.org/licenses/bsd-license.php}}}\sectd \ltrsect
+\linex0\sectdefaultcl\sftnbj {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298
+\par \line }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+\par }{\rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \fs16\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 Revision 1.}{\rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \deleted\fs16\cf1\revauthdel1\revdttmdel1196637062\insrsid10246519\delrsid2038300
+\hich\af39\dbch\af31505\loch\f39 5}{\rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \fs16\cf1\revised\revauth1\revdttm1196637062\insrsid2038300 \hich\af39\dbch\af31505\loch\f39 6}{\rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \fs16\cf1\insrsid9138298
+\hich\af39\dbch\af31505\loch\f39 , }{\rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \fs16\cf1\insrsid10246519 0}{\rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \fs16\cf1\revised\revauth1\revdttm1196637062\insrsid2038300 \hich\af39\dbch\af31505\loch\f39 7}{\rtlch\fcs1
+\af39\afs16 \ltrch\fcs0 \fs16\cf1\revised\super\revauth1\revdttm1196637062\crauth1\crdate1196637062\insrsid2038300\charrsid2038300 {\*\oldcprops \nosupersub\crauth1\crdate1196637062\insrsid2038300\charrsid2038300 }\hich\af39\dbch\af31505\loch\f39 th}{
+\rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \fs16\cf1\revised\revauth1\revdttm1196637062\insrsid2038300 \hich\af39\dbch\af31505\loch\f39 }{\rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \deleted\fs16\cf1\revauthdel1\revdttmdel1196637062\insrsid10246519\delrsid2038300
+\hich\af39\dbch\af31505\loch\f39 1 July}{\rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \fs16\cf1\revised\revauth1\revdttm1196637062\insrsid2038300 \hich\af39\dbch\af31505\loch\f39 March}{\rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \fs16\cf1\insrsid10246519
+\hich\af39\dbch\af31505\loch\f39 }{\rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \fs16\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 201}{\rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \fs16\cf1\revised\revauth1\revdttm1196637062\insrsid2038300
+\hich\af39\dbch\af31505\loch\f39 7}{\rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \deleted\fs16\cf1\revauthdel1\revdttmdel1196637062\insrsid9138298\delrsid2038300 \hich\af39\dbch\af31505\loch\f39 1}{\rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \f0\fs16\cf1\insrsid9138298
+
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210030dd4329a8060000a41b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d331115bebc4eb813bf83291b63624a0d1475a756c734f9bbc2cd28546ecbe1e20a3794ca175f3fae90
+fb6d2dd99bb07b55e5ccf68942bd0877b23c77b908e8db5f9db7f024d9239010f35bd4bbe2fcae387bfff9e2bc289f2fbe24cfaa301468dd8bd846dbb4ddf1c2
+ae7b4c191ba8292337a469bc25ec3d411f06f53a73e224c5292c8de0516732307070a1c0660d125c7d44553488700a4d7bddd3444299910e254ab984c3a219ae
+a4adf1d0f82b7bd46cea4388ad1c12ab5d1ed8e1153d9c9f350a3246aad01c6873462b9ac05999ad5cc988826eafc3acae853a33b7ba11cd1445875ba1b236b1
+399483c90bd560b0b0263435085a21b0f22a9cf9356b38ec6046026d77eba3dc2dc60b17e92219e180643ed27acffba86e9c94c7ca9c225a0f1b0cfae0788ad5
+4adc5a9aec1b703b8b93caec1a0bd8e5de7b132fe5113cf312503b998e2c2927274bd051db6b35979b1ef271daf6c6704e86c73805af4bdd476216c26593af84
+0dfb5393d964f9cc9bad5c313709ea70f561ed3ea7b053075221d51696910d0d339585004b34272bff7213cc7a510a5454a3b349b1b206c1f0af490176745d4b
+c663e2abb2b34b23da76f6352ba57ca2881844c1111ab189d8c7e07e1daaa04f40255c77988aa05fe06e4e5bdb4cb9c5394bbaf28d98c1d971ccd20867e556a7
+689ec9166e0a522183792b8907ba55ca6e943bbf2a26e52f48957218ffcf54d1fb09dc3eac04da033e5c0d0b8c74a6b43d2e54c4a10aa511f5fb021a07533b20
+5ae07e17a621a8e082dafc17e450ffb739676998b48643a4daa7211214f623150942f6a02c99e83b85583ddbbb2c4996113211551257a656ec1139246ca86be0
+aadedb3d1441a89b6a929501833b197fee7b9641a3503739e57c732a59b1f7da1cf8a73b1f9bcca0945b874d4393dbbf10b1680f66bbaa5d6f96e77b6f59113d
+316bb31a795600b3d256d0cad2fe354538e7566b2bd69cc6cbcd5c38f0e2bcc63058344429dc2121fd07f63f2a7c66bf76e80d75c8f7a1b622f878a18941d840
+545fb28d07d205d20e8ea071b283369834296bdaac75d256cb37eb0bee740bbe278cad253b8bbfcf69eca23973d939b97891c6ce2cecd8da8e2d343578f6648a
+c2d0383fc818c798cf64e52f597c740f1cbd05df0c264c49134cf09d4a60e8a107260f20f92d47b374e32f000000ffff0300504b030414000600080000002100
+0dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f7
+8277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89
+d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd500
+1996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0f
+bfff0000001c0200001300000000000000000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6
+a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a
+0000001c00000000000000000000000000190200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d00140006000800000021
+0030dd4329a8060000a41b00001600000000000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d001400060008
+00000021000dd1909fb60000001b0100002700000000000000000000000000b20900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000ad0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e5000000000000000000000000d085
+a0b20997d201feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/LzmaCompress_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/LzmaCompress_Utility_Man_Page.rtf
new file mode 100644
index 000000000..e4f493f3e
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/LzmaCompress_Utility_Man_Page.rtf
@@ -0,0 +1,382 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}
+{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
+{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}
+{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}
+{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
+{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\f258\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\f259\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f261\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\f262\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\f263\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f264\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\f265\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\f266\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f268\fbidi \fswiss\fcharset238\fprq2 Arial CE;}{\f269\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;}{\f271\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}
+{\f272\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f273\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f274\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);}{\f275\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}
+{\f276\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f278\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}{\f279\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}
+{\f281\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f282\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}{\f283\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}
+{\f284\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f285\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}{\f286\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}
+{\f390\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f598\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f599\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f601\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}
+{\f602\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f605\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f606\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}
+{\f628\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\f629\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}{\f631\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}
+{\f632\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}{\f635\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\f636\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\f648\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f649\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}{\f651\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}
+{\f652\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f653\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}{\f654\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}
+{\f655\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f656\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}{\f657\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}
+{\f668\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f669\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f671\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}{\f672\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}
+{\f675\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f676\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f688\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f689\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f695\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f696\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1390\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
+{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
+{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red0\green127\blue127;\red8\green96\blue168;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext11 \ssemihidden \sunhideused
+Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\ai\af0\afs28 \ltrch\fcs0
+\b\i\fs28\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\s17\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0
+\fs16\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext17 \slink18 \ssemihidden \sunhideused \styrsid1535607 Balloon Text;}{\*\cs18 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \f39\fs16
+\sbasedon10 \slink17 \slocked \ssemihidden \styrsid1535607 Balloon Text Char;}{\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0
+\fs16\cf1\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext19 \spriority0 \styrsid13255892 CellBodyLeft;}{\*\cs20 \additive \b\f2\cf13 \spriority0 \styrsid13255892 CodeCharacter;}{\*\ts21\tsrowd\trbrdrt
+\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon11 \snext21 \spriority59 \styrsid13255892 Table Grid;}}{\*\revtbl {Unknown;}{lgao4;}{Zhu, Yonghong;}}{\*\rsidtbl \rsid200707\rsid1530076\rsid1535607\rsid1840106\rsid2567646\rsid3478841\rsid4929157\rsid4999604\rsid5140827\rsid5788588\rsid5911148\rsid7548252\rsid8600807\rsid9728962
+\rsid10095135\rsid10558486\rsid11685714\rsid11874792\rsid12003746\rsid12126252\rsid12198464\rsid13058712\rsid13255892\rsid13715311}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0
+\mnaryLim1}{\info{\operator Zhu, Yonghong}{\creatim\yr2010\mo10\dy6\hr16\min2}{\revtim\yr2016\mo8\dy9\hr10\min30}{\version20}{\edmins44}{\nofpages3}{\nofwords508}{\nofchars2900}{\nofcharsws3402}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.c
+om/office/word/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot5140827 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \hich )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \fi-2830\li1390\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar
+\tx180\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin1390\itap0\pararsid9728962 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28
+\ltrch\fcs0 \b\fs28\cf17\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li90\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin90\itap0\pararsid9728962 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 LzmaCompress.exe \hich\f43 \endash \loch\f43 encode or decode a file by LZMA compress/decompress algorithm
+\par }\pard\plain \ltrpar\s2\ql \fi-1300\li-90\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-90\itap0\pararsid9728962 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 LzmaCompress}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9728962 \hich\af43\dbch\af31505\loch\f43 [-v | -q | }{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm654533262\langfenp2052\insrsid4929157 \hich\af43\dbch\af31505\loch\f43 --f86 | }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9728962 -}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5788588 -}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9728962 \hich\af43\dbch\af31505\loch\f43 d}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5788588 \hich\af43\dbch\af31505\loch\f43 ebug <Level>}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9728962 \hich\af43\dbch\af31505\loch\f43 ]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 -e|-d}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9728962 \hich\af43\dbch\af31505\loch\f43 [-o }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid10095135
+\hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9728962 \hich\af43\dbch\af31505\loch\f43 OutputFile}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid10095135 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9728962 \hich\af43\dbch\af31505\loch\f43 ]}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 <inputFile>}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5140827
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9728962 \hich\af43\dbch\af31505\loch\f43 LzmaCompress}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9728962 \hich\af43\dbch\af31505\loch\f43
+\hich\f43 \endash \loch\f43 h
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid9728962 \hich\af43\dbch\af31505\loch\f43 LzmaCompress}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9728962 \hich\af43\dbch\af31505\loch\f43
+ --version
+\par }\pard\plain \ltrpar\s2\ql \fi-2740\li1300\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx720\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin1300\itap0\pararsid9728962 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 \hich\f43 The LzmaCompress tool is used to encode or decode files with LZMA encode or decode algorithm. When \'93\loch\f43 \hich\f43 -e\'94\loch\f43
+ option is specified in the command line the tool will encode the input file with LZMA encode algorith\hich\af43\dbch\af31505\loch\f43 \hich\f43 m; when \'93\loch\f43 \hich\f43 -d\'94\loch\f43
+ option is specified in the command line the tool will decode the input file with LZMA decode algorithm. }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392165\langfenp2052\insrsid4929157
+\loch\af43\dbch\af31505\hich\f43 \'93}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm654533262\langfenp2052\insrsid4929157 \loch\af43\dbch\af31505\hich\f43 \emdash \loch\f43 f86}{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392165\langfenp2052\insrsid11685714 \hich\af43\dbch\af31505\loch\f43 " option }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392166\langfenp2052\insrsid11685714 \hich\af43\dbch\af31505\loch\f43 is specified to enable }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392180\langfenp2052\insrsid13058712 \hich\af43\dbch\af31505\loch\f43 converter for x}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392166\langfenp2052\insrsid11685714 \hich\af43\dbch\af31505\loch\f43 86 code that can improve the compress ratio }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392167\langfenp2052\insrsid1840106 \hich\af43\dbch\af31505\loch\f43 for }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392171\langfenp2052\insrsid1840106 \hich\af43\dbch\af31505\loch\f43 IA32 or X64 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392167\langfenp2052\insrsid1840106 \hich\af43\dbch\af31505\loch\f43 PE image}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392171\langfenp2052\insrsid1840106 .}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392167\langfenp2052\insrsid1840106
+\hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43
+When decoding file, this tool performs some rudimentary checking on the input files to verify they are compressed by LZMA algorithm. These checks include:
+\par \hich\af43\dbch\af31505\loch\f43 The input file header (5 + 8 bytes header);
+\par \hich\af43\dbch\af31505\loch\f43 The first 5 bytes is the attribute of compressi\hich\af43\dbch\af31505\loch\f43 on.
+\par \hich\af43\dbch\af31505\loch\f43 The following 8 bytes is original size which is the input file size and it is the decompressed file size.
+\par \hich\af43\dbch\af31505\loch\f43 While encoding file, this tool does not perform any checking.
+\par }\pard\plain \ltrpar\s2\ql \fi-4810\li3460\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin3460\itap0\pararsid9728962 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 Options
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid13255892\charrsid12198464 \hich\af43\dbch\af31505\loch\f43 If no options ar}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid13255892 \hich\af43\dbch\af31505\loch\f43 e specified, tool prints usage.}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1535607
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 -e }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43
+ Encode the input file, which means to compress the input file
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 -d}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43
+ Decode the input file, which means to decompress the input file
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 -o, --output Filename}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid5140827
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 The file containing encoded or decoded content of input file
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid13715311 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\revauth1\revdttm1191392161\insrsid13715311 -}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm654533263\langfenp2052\insrsid4929157 -}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm654533262\langfenp2052\insrsid4929157
+\hich\af43\dbch\af31505\loch\f43 f}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392161\langfenp2052\insrsid13715311 \hich\af43\dbch\af31505\loch\f43 86}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392161\langfenp2052\insrsid13715311
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1191392161\insrsid13715311 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1191392161\insrsid10558486
+\hich\af43\dbch\af31505\loch\f43 enable conver}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392179\langfenp2052\insrsid10558486 \hich\af43\dbch\af31505\loch\f43 ter}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\revauth1\revdttm1191392161\insrsid13715311\charrsid13715311 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392179\langfenp2052\insrsid10558486
+\hich\af43\dbch\af31505\loch\f43 for }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1191392161\insrsid13715311\charrsid13715311 \hich\af43\dbch\af31505\loch\f43 x86 code}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\revauth1\revdttm1191392161\insrsid13715311
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 --version
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid5140827 \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 Print version and copyright of this program and exit
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 -v, --verbose
+\par \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3478841 \hich\af43\dbch\af31505\loch\f43 Enable}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43
+ verbose output with informational messages printed. This is a count value, so specifying \hich\f43 \endash \loch\f43 v can be used to increase the verbosity level.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 -q, --quiet}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid5140827
+\par \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 Disabl\hich\af43\dbch\af31505\loch\f43 e all messages except FATAL ERRORS
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 --debug [0-9]
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid5140827 \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 Enable debug messages. Only 0-9 Level is supported.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 -h, --help
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid5140827 \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 Print copyright, version and usage of this program and exit
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid13255892 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf18\lang1033\langfe2052\langfenp2052\insrsid13255892 {\*\bkmkstart OLE_LINK10}{\*\bkmkstart OLE_LINK11}
+{\*\bkmkstart OLE_LINK3}{\*\bkmkstart OLE_LINK4}{\*\bkmkstart OLE_LINK5}{\*\bkmkstart OLE_LINK6}{\*\bkmkstart OLE_LINK9}\hich\af43\dbch\af31505\loch\f43 Status codes retu\hich\af43\dbch\af31505\loch\f43 rned}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf18\lang1033\langfe2052\langfenp2052\insrsid13255892\charrsid4999604
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts21\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\pard\plain \ltrpar\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts21 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid13255892
+{\*\bkmkend OLE_LINK10}{\*\bkmkend OLE_LINK11}0\cell }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid13255892 \hich\af43\dbch\af13\loch\f43 The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \kerning2\insrsid13255892 \cell }\pard\plain \ltrpar
+\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1
+\af37\afs20 \ltrch\fcs0 \fs20\insrsid13255892 \trowd \irow0\irowband0\ltrrow\ts21\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row \ltrrow}\pard\plain \ltrpar\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts21 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid13255892
+\hich\af2\dbch\af13\loch\f2 Nonzero}{\rtlch\fcs1 \af41\afs19 \ltrch\fcs0 \cs20\f41\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid13255892\charrsid8600807 \cell }\pard \ltrpar\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid200707\yts21 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid13255892 \hich\af43\dbch\af13\loch\f43 The action failed.\cell
+}\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid13255892 \trowd \irow1\irowband1\lastrow \ltrrow\ts21\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10
+\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row }\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid9728962 \rtlch\fcs1
+\af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5140827 {\*\bkmkend OLE_LINK3}{\*\bkmkend OLE_LINK4}{\*\bkmkend OLE_LINK5
+}{\*\bkmkend OLE_LINK6}{\*\bkmkend OLE_LINK9}\hich\af43\dbch\af31505\loch\f43 Example
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 \hich\f43 1. Encode the input file \'93\loch\f43 \hich\f43 file.efi\'94\loch\f43 \hich\f43 and specify the output file name with \'93\loch\f43 \hich\f43 file.lzma\'94
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 LzmaCompress \hich\f43 \endash \loch\f43 e \hich\f43 \endash \hich\af43\dbch\af31505\loch\f43 o file.lzma file.efi
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 \hich\f43 2. Decode the input file \'93\loch\f43 \hich\f43 file.lzma\'94\loch\f43 \hich\f43 and specify the output file name with \'93\loch\f43 \hich\f43
+file.orig\'94
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 LzmaCompress \hich\f43 \endash \loch\f43 d \hich\f43 \endash \loch\f43 o file.orig file.lzma
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 3. Decode the input file "file.lzma" in the quiet mode and specify the output file name with "file.orig"
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 Lzma\hich\af43\dbch\af31505\loch\f43 Compress \hich\f43 \endash \loch\f43 d -q \hich\f43 \endash \loch\f43 o file.orig file.lzma}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392162\langfenp2052\insrsid5140827
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid13715311 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392162\langfenp2052\insrsid13715311
+\hich\af43\dbch\af31505\loch\f43 4}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1191392162\insrsid13715311 \hich\af43\dbch\af31505\loch\f43 \hich\f43 . Encode the input file \'93\loch\f43 \hich\f43 file.efi\'94\loch\f43 }{
+\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392162\langfenp2052\insrsid13715311 \hich\af43\dbch\af31505\loch\f43 with }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392180\langfenp2052\insrsid12126252 \hich\af43\dbch\af31505\loch\f43 converter for }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392180\langfenp2052\insrsid13058712 \hich\af43\dbch\af31505\loch\f43 x}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392162\langfenp2052\insrsid13715311 \hich\af43\dbch\af31505\loch\f43 86 code }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1191392162\insrsid13715311
+\hich\af43\dbch\af31505\loch\f43 \hich\f43 and specify the output file name with \'93\loch\f43 \hich\f43 file.lzma\'94
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\revauth1\revdttm1191392162\insrsid13715311 \hich\af43\dbch\af31505\loch\f43 LzmaCompress \hich\f43 \endash
+\loch\f43 e }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392162\langfenp2052\insrsid4929157 \loch\af43\dbch\af31505\hich\f43 \endash }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm654533263\langfenp2052\insrsid4929157 \hich\af43\dbch\af31505\loch\f43 -f86}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392162\langfenp2052\insrsid13715311 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\revauth1\revdttm1191392162\insrsid13715311
+\loch\af43\dbch\af31505\hich\f43 \endash \loch\f43 o file}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191406241\langfenp2052\insrsid2567646 \hich\af43\dbch\af31505\loch\f43 x86}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\revauth1\revdttm1191392162\insrsid13715311 \hich\af43\dbch\af31505\loch\f43 .lzma file}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191406241\langfenp2052\insrsid2567646 \hich\af43\dbch\af31505\loch\f43 x86}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\revauth1\revdttm1191392162\insrsid13715311
+\hich\af43\dbch\af31505\loch\f43 .efi}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191406241\langfenp2052\insrsid13715311
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid2567646 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191406241\langfenp2052\insrsid2567646
+\hich\af43\dbch\af31505\loch\f43 5}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1191406241\insrsid2567646 \hich\af43\dbch\af31505\loch\f43 \hich\f43 . Decode the input file \'93\loch\f43 file}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191406241\langfenp2052\insrsid2567646 \hich\af43\dbch\af31505\loch\f43 x86}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1191406241\insrsid2567646
+\hich\af43\dbch\af31505\loch\f43 \hich\f43 .lzma\'94\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191406242\langfenp2052\insrsid2567646 \hich\af43\dbch\af31505\loch\f43 with
+\hich\af43\dbch\af31505\loch\f43 converter for x86 code}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1191406242\insrsid2567646 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\revauth1\revdttm1191406241\insrsid2567646 \hich\af43\dbch\af31505\loch\f43 \hich\f43 and specify the output file name with \'93\loch\f43 file}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191406241\langfenp2052\insrsid2567646 \hich\af43\dbch\af31505\loch\f43 x86}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1191406241\insrsid2567646
+\hich\af43\dbch\af31505\loch\f43 \hich\f43 .orig\'94
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\revauth1\revdttm1191406241\insrsid2567646 \hich\af43\dbch\af31505\loch\f43 LzmaCompress \hich\f43 \endash \loch\f43 d }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191406242\langfenp2052\insrsid2567646 \hich\af43\dbch\af31505\loch\f43 --f86 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\revauth1\revdttm1191406241\insrsid2567646
+\loch\af43\dbch\af31505\hich\f43 \endash \loch\f43 o file}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191406241\langfenp2052\insrsid2567646 \hich\af43\dbch\af31505\loch\f43 x86}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\revauth1\revdttm1191406241\insrsid2567646 \hich\af43\dbch\af31505\loch\f43 .orig file}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191406241\langfenp2052\insrsid2567646 \hich\af43\dbch\af31505\loch\f43 x86}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\revised\revauth1\revdttm1191406241\insrsid2567646
+\hich\af43\dbch\af31505\loch\f43 .lzma
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2567646\charrsid2567646
+\par }\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid9728962 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 No known }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3478841 \hich\af43\dbch\af31505\loch\f43 issues}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 .
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth2\revdttm1195920030\insrsid7548252\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-\hich\af43\dbch\af31505\loch\f43 devel
+\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel2\revdttmdel1195920030\insrsid5140827\delrsid7548252 \hich\af43\dbch\af31505\loch\f43
+edk2-buildtools-devel@lists.sourceforge.net}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid5140827
+\par }\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid9728962 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid9728962 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af2\afs20 \ltrch\fcs0
+\f2\fs20\insrsid5140827 \hich\af2\dbch\af31505\loch\f2 LZMA algorithm is in http://www.7-zip.org
+\par }\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid9728962 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43 Based on LZMA Utility 4.65 : Igor Pavlov : Public domain : 2009-02-03
+\par
+\par \hich\af43\dbch\af31505\loch\f43 Copyright (c) 2006 - }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3478841 \hich\af43\dbch\af31505\loch\f43 201}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm1191392171\langfenp2052\insrsid12003746 \hich\af43\dbch\af31505\loch\f43 2}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\deleted\fs18\cf1\lang1033\langfe2052\revauthdel1\revdttmdel1191392171\langfenp2052\insrsid11874792\delrsid12003746 \hich\af43\dbch\af31505\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5140827 \hich\af43\dbch\af31505\loch\f43
+, Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials
+\par \hich\af43\dbch\af31505\loch\f43 are license\hich\af43\dbch\af31505\loch\f43 d and made available under the terms and conditions of the BSD License
+\par \hich\af43\dbch\af31505\loch\f43 which accompanies this distribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN\hich\af43\dbch\af31505\loch\f43 "AS IS" BASIS,
+\par \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid5140827
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb
+44f95d843b5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a
+6409fb44d08741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c
+3d9058edf2c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db0256
+5e85f3b9660d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276
+b9f7dec44b7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8
+c33585b5fb9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e
+51440ca2e0088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95
+b21be5ceaf8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff
+6dce591a26ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec6
+9ffb9e65d028d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239
+b75a5bb1e6345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a449
+59d366ad93b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e8
+2db8df9f30254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468
+656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4
+350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d2624
+52282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe5141
+73d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c020000130000000000000000
+0000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000
+000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c0000000000000000000000000019
+0200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b00001600000000
+000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b01000027
+00000000000000000000000000a00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009b0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e30000000000000000000000e0000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff0900060000000000000000000000010000000100000000000000001000000200000001000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdffffff04000000feffffff05000000fefffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffff010000000c6ad98892f1d411a65f0040963251e5000000000000000000000000408c
+d304e6f1d1010300000080020000000000004d0073006f004400610074006100530074006f0072006500000000000000000000000000000000000000000000000000000000000000000000000000000000001a000101ffffffffffffffff020000000000000000000000000000000000000000000000408cd304e6f1d101
+408cd304e6f1d1010000000000000000000000003100c60049005100c400330045005000db00c400c20052004700560056005300de00de005500cd00c500d0003d003d000000000000000000000000000000000032000101ffffffffffffffff030000000000000000000000000000000000000000000000408cd304e6f1
+d101408cd304e6f1d1010000000000000000000000004900740065006d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000201ffffffff04000000ffffffff000000000000000000000000000000000000000000000000
+00000000000000000000000000000000e600000000000000010000000200000003000000feffffff0500000006000000070000000800000009000000feffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3c623a536f75726365732053656c65637465645374796c653d225c4150412e58534c22205374796c654e616d653d224150412046696674682045646974696f6e2220786d6c6e733a623d22687474703a2f2f736368656d61732e6f70656e
+786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f6269626c696f6772617068792220786d6c6e733d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f6269626c696f677261706879223e3c2f
+623a536f75726365733e00000000000000000000000000000000000000000000000000003c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d226e6f223f3e0d0a3c64733a6461746173746f72654974656d2064733a6974656d49443d227b39313130
+363236452d304644312d343845452d393131392d3535353246424535324439377d2220786d6c6e733a64733d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f637573746f6d586d6c223e3c64733a736368656d61526566733e3c
+64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6f70656e500072006f007000650072007400690065007300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000200ffffffffffffffffffffffff000000000000
+0000000000000000000000000000000000000000000000000000000000000400000055010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f6269626c696f677261706879222f3e3c2f64733a736368656d61526566733e3c2f64733a6461746173746f
+72654974656d3e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/PatchPcdValue_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/PatchPcdValue_Utility_Man_Page.rtf
new file mode 100644
index 000000000..80bcb2c22
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/PatchPcdValue_Utility_Man_Page.rtf
@@ -0,0 +1,297 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe2052\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
+{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}
+{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhimajor\f31502\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f258\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\f259\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f261\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\f262\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\f263\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f264\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\f265\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\f266\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f268\fbidi \fswiss\fcharset238\fprq2 Arial CE;}
+{\f269\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;}{\f271\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}{\f272\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f273\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}
+{\f274\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);}{\f275\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}{\f276\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f390\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}
+{\f598\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f599\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f601\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f602\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}
+{\f605\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f606\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f688\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f689\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f695\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f696\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1390\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \fswiss\fcharset238\fprq2 Calibri Light CE;}{\fhimajor\f31529\fbidi \fswiss\fcharset204\fprq2 Calibri Light Cyr;}
+{\fhimajor\f31531\fbidi \fswiss\fcharset161\fprq2 Calibri Light Greek;}{\fhimajor\f31532\fbidi \fswiss\fcharset162\fprq2 Calibri Light Tur;}{\fhimajor\f31535\fbidi \fswiss\fcharset186\fprq2 Calibri Light Baltic;}
+{\fhimajor\f31536\fbidi \fswiss\fcharset163\fprq2 Calibri Light (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa160\sl259\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe2052\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa160\sl259\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext11 \ssemihidden \sunhideused
+Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af31503\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\ai\af31503\afs28 \ltrch\fcs0
+\b\i\fs28\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked \ssemihidden \spriority9 Heading 2 Char;}}{\*\rsidtbl \rsid283165\rsid14894574}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1
+\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}{\creatim\yr2016\mo8\dy9\hr10\min32}{\revtim\yr2016\mo8\dy9\hr10\min32}{\version2}{\edmins0}{\nofpages2}{\nofwords397}{\nofchars2263}{\nofcharsws2655}{\vern57441}}{\*\xmlnstbl {\xmlns1 htt
+p://schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot283165 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \hich )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0
+\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 PatchPcdValue.exe or PatchPcdValue.py \hich\f43 \endash \loch\f43 Patch the specific value into the binary image.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14894574
+
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 PatchPcdValue.exe -f Offset -u Value -t Type [-s MaxSize] <input_file>}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid14894574
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43
+PatchPcdValue tool sets the specific value into the binary image according to the input PCD offset and type. When PCD type is VOID*, MaxSize must be specified to say how much value need to be updated. This tool checks whether the input PCD information is
+\hich\af43\dbch\af31505\loch\f43 v\hich\af43\dbch\af31505\loch\f43 alid for the input binary image, but doesn\hich\f43 \rquote \loch\f43 t check the format of the binary image. }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14894574
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 PatchPcdValue tool usually works together with GenPatchPcdTable tool to set the specific value of a patchable PCD into the binary EFI image. }{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14894574
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Options
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 -f PCDOFFSET, --offset\hich\af43\dbch\af31505\loch\f43 =PCDOFFSET}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid14894574
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Start offset to the image is used to store PCD value.}{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14894574
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 -u PCDVALUE, --value=PCDVALUE}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid14894574
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 \hich\f43
+PCD value will be updated into the image. For VOID* type PCD value, if the start string is \'93\loch\f43 \hich\f43 L \'93\loch\f43 , the input string will be unicode string, if the start string is \loch\af43\dbch\af31505\hich\f43 \'93\{\'93\loch\f43
+\hich\f43 and the end string is \'93\}\'94\loch\f43 , the input string will be byte array, or the input string will be ASCII string.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14894574
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 -t PCDTYPENAME, --type=PCDTYPENAME}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid14894574
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43
+The name of PCD data type may be one of VOID*,BOOLEAN, UINT8, UINT16, UINT32, UINT64.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14894574
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 -s PCDMAXSIZE, --maxsize=\hich\af43\dbch\af31505\loch\f43 PCDMAXSIZE}{
+\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid14894574
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43
+Max size of data buffer is taken by PCD value. It must be set when PCD type is VOID*.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14894574
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 -v, --verbose
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Run verbosely.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 -d LOGLEVEL, --debug=LOGLEVEL [0-9]}{\rtlch\fcs1 \ab\af0\afs18
+\ltrch\fcs0 \b\f0\fs18\cf1\insrsid14894574
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Enable debug messages at specified level.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 -q, --quiet}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid14894574
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Run with little information in quiet mod\hich\af43\dbch\af31505\loch\f43
+e.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14894574
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 --verbose}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid14894574
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Show program's version number and exit
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 -h, --help
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Show this help message and exit}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid14894574
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Example
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 1. Patch 0x80000000 to the patchable PcdDebugPrintErrorLevel in the binary PeiCore image. This PCD type is UINT32. Its offset in PeiCore image is 0x6F80 got by GenPatchPcdTable tool.}{
+\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14894574
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 PatchPcdValue.exe -f 0x6F80 \hich\f43 \endash \loch\f43 u 0x80000000 \hich\f43 \endash \loch\f43 t UINT32 PeiCore.efi}{\rtlch\fcs1 \ab\af0\afs18
+\ltrch\fcs0 \b\f0\fs18\cf1\insrsid14894574
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 2. Patch \hich\af43\dbch\af31505\loch\f43 \hich\f43 the unicode string \'93\loch\f43 \hich\f43 Test\'94\loch\f43
+ to the patchable PcdHelloWorldPrintString in the binary HelloWorld image. This PCD type is VOID*. Its max byte array size is 0x40, and its offset in HelloWorld image is 0x3050.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14894574
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 PatchPcdValue.exe -f 0x3050 -t VOID* -s 0x40 -u "L Te\hich\af43\dbch\af31505\loch\f43 st" HelloWorld.efi
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 No known bugs.
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe1033\langfenp1033\insrsid283165\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-\hich\af43\dbch\af31505\loch\f43 devel
+\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14894574
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe2052\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 2010, Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licensed and made\hich\af43\dbch\af31505\loch\f43 available
+\par \hich\af43\dbch\af31505\loch\f43 under the terms and conditions of the BSD License which accompanies this
+\par \hich\af43\dbch\af31505\loch\f43 distribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"\hich\af43\dbch\af31505\loch\f43 BASIS,
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14894574 \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\insrsid14894574
+\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid14894574
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b030414000600080000002100aa5225dfc60600008b1a0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec595d8bdb46147d2ff43f08bd3bfe92fcb1c41b6cd9ceb6d94d42eca4e4716c8fadc98e344633de8d0981923c160aa569e943037deb
+43691b48a02fe9afd936a54d217fa17746b63c638fbb9b2585a5640d8b343af7ce997bafce1d4997afdc8fa87384134e58dc708b970aae83e3211b9178d2706f
+f7bbb99aeb7081e211a22cc60d778eb97b65f7c30f2ea31d11e2083b601ff31dd4704321a63bf93c1fc230e297d814c7706dcc920809384d26f951828ec16f44
+f3a542a1928f10895d274611b8bd311e932176fad2a5bbbb74dea1701a0b2e078634e949d7d8b050d8d1615122f89c0734718e106db830cf881df7f17de13a14
+7101171a6e41fdb9f9ddcb79b4b330a2628bad66d7557f0bbb85c1e8b0a4e64c26836c52cff3bd4a33f3af00546ce23ad54ea553c9fc29001a0e61a52917dda7
+dfaab7dafe02ab81d2438bef76b55d2e1a78cd7f798373d3973f03af40a97f6f03dfed06104503af4029dedfc07b5eb51478065e81527c65035f2d34db5ed5c0
+2b5048497cb8812ef89572b05c6d061933ba6785d77daf5b2d2d9caf50500d5975c929c62c16db6a2d42f758d2058004522448ec88f9148fd110aa3840940c12
+e2ec93490885374531e3305c2815ba8532fc973f4f1da988a01d8c346bc90b98f08d21c9c7e1c3844c45c3fd18bcba1ae4cdcb1fdfbc7cee9c3c7a71f2e89793
+c78f4f1efd9c3a32acf6503cd1ad5e7fffc5df4f3f75fe7afeddeb275fd9f15cc7fffed367bffdfaa51d082b5d85e0d5d7cffe78f1ecd5379ffff9c3130bbc99
+a0810eef930873e73a3e766eb10816a6426032c783e4ed2cfa2122ba45339e701423398bc57f478406fafa1c5164c1b5b019c13b09488c0d787576cf20dc0b93
+9920168fd7c2c8001e30465b2cb146e19a9c4b0b737f164fec9327331d770ba123dbdc018a8dfc766653d05662731984d8a07993a258a0098eb170e4357688b1
+6575770931e27a408609e36c2c9cbbc46921620d499f0c8c6a5a19ed9108f232b711847c1bb139b8e3b418b5adba8d8f4c24dc15885ac8f73135c27815cd048a
+6c2efb28a27ac0f791086d247bf364a8e33a5c40a6279832a733c29cdb6c6e24b05e2de9d7405eec693fa0f3c84426821cda7cee23c674649b1d06218aa6366c
+8fc4a18efd881f428922e7261336f80133ef10790e7940f1d674df21d848f7e96a701b9455a7b42a107965965872791533a37e7b733a4658490d08bfa1e71189
+4f15f73559f7ff5b5907217df5ed53cbaa2eaaa0371362bda3f6d6647c1b6e5dbc03968cc8c5d7ee369ac53731dc2e9b0decbd74bf976ef77f2fdddbeee7772f
+d82b8d06f9965bc574abae36eed1d67dfb9850da13738af7b9daba73e84ca32e0c4a3bf5cc8ab3e7b8690887f24e86090cdc2441cac64998f88488b017a229ec
+ef8bae7432e10bd713ee4c19876dbf1ab6fa96783a8b0ed8287d5c2d16e5a3692a1e1c89d578c1cfc6e15143a4e84a75f50896b9576c27ea51794940dabe0d09
+6d329344d942a2ba1c9441520fe610340b09b5b277c2a26e615193ee97a9da6001d4b2acc0d6c9810d57c3f53d30012378a242148f649ed2542fb3ab92f92e33
+bd2d984605c03e625901ab4cd725d7adcb93ab4b4bed0c99364868e566925091513d8c87688417d52947cf42e36d735d5fa5d4a02743a1e683d25ad1a8d6fe8d
+c579730d76ebda40635d2968ec1c37dc4ad9879219a269c31dc3633f1c4653a81d2eb7bc884ee0ddd95024e90d7f1e6599265cb4110fd3802bd149d520220227
+0e2551c395cbcfd24063a5218a5bb104827061c9d541562e1a3948ba99643c1ee3a1d0d3ae8dc848a7a7a0f0a95658af2af3f383a5259b41ba7be1e8d819d059
+720b4189f9d5a20ce0887078fb534ca33922f03a3313b255fdad35a685eceaef13550da5e3884e43b4e828ba98a77025e5191d7596c5403b5bac1902aa8564d1
+080713d960f5a01add34eb1a2987ad5df7742319394d34573dd35015d935ed2a66ccb06c036bb13c5f93d7582d430c9aa677f854bad725b7bed4bab57d42d625
+20e059fc2c5df70c0d41a3b69acca026196fcab0d4ecc5a8d93b960b3c85da599a84a6fa95a5dbb5b8653dc23a1d0c9eabf383dd7ad5c2d078b9af549156df3d
+f44f136c700fc4a30d2f81675470954af8f09020d810f5d49e24950db845ee8bc5ad0147ce2c210df741c16f7a41c90f72859adfc97965af90abf9cd72aee9fb
+e562c72f16daadd243682c228c8a7efacda50bafa2e87cf1e5458d6f7c7d89966fdb2e0d599467eaeb4a5e11575f5f8aa5ed5f5f1c02a2f3a052ead6cbf55625
+572f37bb39afddaae5ea41a5956b57826abbdb0efc5abdfbd0758e14d86b9603afd2a9e52ac520c8799582a45fabe7aa5ea9d4f4aacd5ac76b3e5c6c6360e5a9
+7c2c6201e155bc76ff010000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f
+7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be
+9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980
+ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5b
+babac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c0200001300000000000000000000000000000000005b436f6e74656e
+745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f
+2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000190200007468656d652f7468656d652f74
+68656d654d616e616765722e786d6c504b01022d0014000600080000002100aa5225dfc60600008b1a00001600000000000000000000000000d6020000746865
+6d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b0100002700000000000000000000000000d00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000cb0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 3;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 6;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 7;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 8;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal Indent;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footnote text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation text;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 header;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footer;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index heading;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 table of figures;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 envelope address;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 envelope return;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footnote reference;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation reference;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 line number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 page number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 endnote reference;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 endnote text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 table of authorities;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 macro;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 toa heading;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Closing;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Signature;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 3;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Message Header;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Note Heading;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Block Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Hyperlink;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 FollowedHyperlink;
+\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Document Map;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Plain Text;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 E-mail Signature;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Top of Form;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Bottom of Form;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal (Web);
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Acronym;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Address;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Cite;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Code;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Definition;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Keyboard;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Preformatted;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Sample;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Typewriter;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Variable;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal Table;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation subject;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 No List;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 3;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Simple 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Simple 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Simple 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Classic 1;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Classic 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Classic 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Classic 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Colorful 1;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Colorful 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Colorful 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 1;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 6;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 7;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 8;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 1;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 6;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 7;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 8;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table 3D effects 1;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table 3D effects 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table 3D effects 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Contemporary;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Elegant;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Professional;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Subtle 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Subtle 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Web 1;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Web 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Web 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Balloon Text;\lsdpriority39 \lsdlocked0 Table Grid;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Theme;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;\lsdpriority61 \lsdlocked0 Light List;
+\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;\lsdpriority67 \lsdlocked0 Medium Grid 1;
+\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;\lsdpriority73 \lsdlocked0 Colorful Grid;
+\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;
+\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdpriority70 \lsdlocked0 Dark List Accent 1;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;\lsdpriority61 \lsdlocked0 Light List Accent 2;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;\lsdpriority62 \lsdlocked0 Light Grid Accent 3;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e500000000000000000000000020c4
+2455e6f1d101feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/SplitFile_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/SplitFile_Utility_Man_Page.rtf
new file mode 100644
index 000000000..0fe568a51
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/SplitFile_Utility_Man_Page.rtf
@@ -0,0 +1,318 @@
+{\rtf1\adeflang1025\ansi\ansicpg936\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}
+{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
+{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f38\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Verdana{\*\falt Verdana};}
+{\f40\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\f42\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}
+{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
+{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f45\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
+{\f46\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f48\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f49\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f50\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
+{\f51\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f52\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f53\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f65\fbidi \fmodern\fcharset238\fprq1 Courier New CE;}
+{\f66\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr;}{\f68\fbidi \fmodern\fcharset161\fprq1 Courier New Greek;}{\f69\fbidi \fmodern\fcharset162\fprq1 Courier New Tur;}{\f70\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew);}
+{\f71\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic);}{\f72\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic;}{\f73\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese);}{\f177\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}
+{\f385\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f386\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f388\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f389\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}
+{\f392\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f393\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f415\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f416\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}
+{\f418\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f419\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\f422\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\f423\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}
+{\f425\fbidi \fswiss\fcharset238\fprq2 Tahoma CE;}{\f426\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f428\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek;}{\f429\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur;}
+{\f430\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f431\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic);}{\f432\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f433\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}
+{\f434\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai);}{\f435\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}{\f436\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}
+{\f438\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f439\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}{\f442\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}
+{\f443\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f447\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}{\f465\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f466\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}
+{\f468\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}{\f469\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}{\f472\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f473\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}
+{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}
+{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}
+{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
+{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
+{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
+{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}
+{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
+{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;
+\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext11 \ssemihidden \sunhideused
+Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\ai\af0\afs28 \ltrch\fcs0
+\b\i\fs28\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\s17\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af38\afs16\alang1025 \ltrch\fcs0
+\fs16\lang1033\langfe1033\loch\f38\hich\af38\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext17 \slink18 \ssemihidden \sunhideused \styrsid11539687 Balloon Text;}{\*\cs18 \additive \rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16
+\sbasedon10 \slink17 \slocked \ssemihidden \styrsid11539687 Balloon Text Char;}{\*\cs19 \additive \rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \fs16 \sbasedon10 \ssemihidden \sunhideused \styrsid3870620 annotation reference;}{
+\s20\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext20 \slink21 \ssemihidden \sunhideused \styrsid3870620 annotation text;}{\*\cs21 \additive \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f39\fs20 \sbasedon10 \slink20 \slocked \ssemihidden \styrsid3870620 Comment Text Char;}{
+\s22\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0 \b\fs20\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon20 \snext20 \slink23 \ssemihidden \sunhideused \styrsid3870620 annotation subject;}{\*\cs23 \additive \rtlch\fcs1 \ab\af0\afs20 \ltrch\fcs0 \b\f39\fs20 \sbasedon21 \slink22 \slocked \ssemihidden \styrsid3870620 Comment Subject Char;}{
+\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\f39\hich\af39\dbch\af13\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext24 \spriority0 \styrsid10361764 CellBodyLeft;}{\*\cs25 \additive \b\f2\cf13 \spriority0 \styrsid10361764 CodeCharacter;}{\*\ts26\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh
+\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon11 \snext26 \spriority59 \styrsid10361764 Table Grid;}}{\*\rsidtbl \rsid3870620\rsid4395805\rsid4999604\rsid5577864\rsid5911148\rsid6120166\rsid8089322\rsid8600807\rsid8672847\rsid9918578\rsid10361764\rsid11229351\rsid11539687\rsid12068497
+\rsid12198464\rsid13917585\rsid14119595\rsid14383934\rsid15035121}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator ydliu}{\creatim\yr2010\mo10\dy6\hr16\min11}
+{\revtim\yr2011\mo8\dy10\hr9\min53}{\version12}{\edmins36}{\nofpages3}{\nofwords572}{\nofchars3265}{\nofcharsws3830}{\vern49255}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
+\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab360\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale135\rsidroot11539687 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \dbch )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar
+\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 Split.exe
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid11229351 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1
+\ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11229351 {\*\bkmkstart OLE_LINK1}{\*\bkmkstart OLE_LINK2}{\*\bkmkstart OLE_LINK3}\hich\af39\dbch\af31505\loch\f39 Split}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid11229351\charrsid8089322 \hich\af39\dbch\af31505\loch\f39 .exe }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11229351 \hich\af39\dbch\af31505\loch\f39 [}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8672847 \hich\af39\dbch\af31505\loch\f39 -v | -q | -d}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11229351 \hich\af39\dbch\af31505\loch\f39 ]}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8672847 \hich\af39\dbch\af31505\loch\f39 [-s }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14119595 \hich\af39\dbch\af31505\loch\f39 <}{\rtlch\fcs1
+\ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8672847 \hich\af39\dbch\af31505\loch\f39 Value}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14119595
+\hich\af39\dbch\af31505\loch\f39 >}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8672847 \hich\af39\dbch\af31505\loch\f39 ] [-p }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14119595 \hich\af39\dbch\af31505\loch\f39 <}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8672847 \hich\af39\dbch\af31505\loch\f39 OutputDir}{\rtlch\fcs1
+\ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14119595 \hich\af39\dbch\af31505\loch\f39 >}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8672847
+\hich\af39\dbch\af31505\loch\f39 ] [-o }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14119595 \hich\af39\dbch\af31505\loch\f39 <}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8672847 \hich\af39\dbch\af31505\loch\f39 FirstFile}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14119595 \hich\af39\dbch\af31505\loch\f39 >}{\rtlch\fcs1
+\ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8672847 \hich\af39\dbch\af31505\loch\f39 ] [-t }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14119595
+\hich\af39\dbch\af31505\loch\f39 <}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8672847 \hich\af39\dbch\af31505\loch\f39 SecondFile}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14119595 \hich\af39\dbch\af31505\loch\f39 >}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8672847 \hich\af39\dbch\af31505\loch\f39 ] \hich\f39 \endash
+\loch\f39 f <InputFile>}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11229351
+\par }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8672847 \hich\af39\dbch\af31505\loch\f39 Split}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8672847\charrsid8089322
+\hich\af39\dbch\af31505\loch\f39 .exe}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8672847 \hich\af39\dbch\af31505\loch\f39 \hich\f39 \endash \loch\f39 h
+\par \hich\af39\dbch\af31505\loch\f39 Split}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid8672847\charrsid8089322 \hich\af39\dbch\af31505\loch\f39 .exe}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8672847 \hich\af39\dbch\af31505\loch\f39 --version}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\langfenp2052\insrsid8672847\charrsid8089322
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11539687 {\*\bkmkend OLE_LINK1}{\*\bkmkend OLE_LINK2}{\*\bkmkend OLE_LINK3}
+\hich\af39\dbch\af31505\loch\f39 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid15035121 \hich\af39\dbch\af31505\loch\f39 SplitFile creates two Binary files either in the same directory as the current working directory or in the }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3870620
+\hich\af39\dbch\af31505\loch\f39 specified}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15035121 \hich\af39\dbch\af31505\loch\f39 directory. The}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39
+ input file will not be changed by}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15035121 \hich\af39\dbch\af31505\loch\f39 the split}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39
+. Two Binary files will be created in either the same directory as the current working directory, or, if the either of the output files contain a path, then in the URI is used, based }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid15035121
+\hich\af39\dbch\af31505\loch\f39 on }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3870620 \hich\af39\dbch\af31505\loch\f39 the output}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 \hich\f39
+ directory, if specified by \'93\loch\f39 \hich\f39 -p\'94\loch\f39 \hich\f39 , \'93\loch\f39 \hich\f39 --prefix\'94\loch\f39 option.
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6120166 \hich\af39\dbch\af31505\loch\f39 When th\hich\af39\dbch\af31505\loch\f39 e}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \loch\af39\dbch\af31505\hich\f39 \endash \loch\f39
+o or \hich\f39 \endash \loch\f39 t options }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6120166 \hich\af39\dbch\af31505\loch\f39 are }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39
+not specified, then the non-specified split filenames }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6120166 \hich\af39\dbch\af31505\loch\f39 use the filenames of the input file along}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687
+\hich\af39\dbch\af31505\loch\f39 with }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6120166 \hich\af39\dbch\af31505\loch\f39 a suffix, formatted as: }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687
+\hich\af39\dbch\af31505\loch\f39 filename.ext.1 and/or filename.ext.2.
+\par \hich\af39\dbch\af31505\loch\f39 When reading the input filename, if the end of file is reached before \hich\af39\dbch\af31505\loch\f39 the number of bytes has been reached, the first file will be an exact copy of the input file, }{\rtlch\fcs1
+\af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid12068497 \hich\af39\dbch\af31505\loch\f39 and }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 the second file }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid12068497 \hich\af39\dbch\af31505\loch\f39 is created with}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 zero length.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 Options
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid10361764\charrsid12198464 {\*\bkmkstart OLE_LINK12}{\*\bkmkstart OLE_LINK13}\hich\af39\dbch\af31505\loch\f39 If no options ar}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10361764 \hich\af39\dbch\af31505\loch\f39
+e specified, tool prints usage.}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3870620 {\*\bkmkend OLE_LINK12}{\*\bkmkend OLE_LINK13}
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 -f, --filename Fi\hich\af39\dbch\af31505\loch\f39 lename\tab \tab \tab
+\par }\pard \ltrpar\ql \fi426\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 Input file specified by Filename
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 -s, --split VALUE\tab \tab \tab \tab
+\par }\pard \ltrpar\ql \fi425\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 The number of bytes in the first file.
+\par \hich\af39\dbch\af31505\loch\f39 The Split Occurs at the AFTER VALUE BYTES from the start of the file.
+\par \hich\af39\dbch\af31505\loch\f39 Value can be integer, hex }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14383934 \hich\af39\dbch\af31505\loch\f39 address}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687
+\hich\af39\dbch\af31505\loch\f39 , or integer-letter, such as 1K, where:
+\par \hich\af39\dbch\af31505\loch\f39 K=1024B\hich\af39\dbch\af31505\loch\f39 ytes, M=1024K, G=1024M
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 -p, --prefix OutputDir\tab \tab \tab \tab
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 Output directory
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 -o, --firstfile Filename1
+\par \tab \hich\af39\dbch\af31505\loch\f39 First of the Split Files.
+\par \hich\af39\dbch\af31505\loch\f39 -t, --secondfile Filename2
+\par \tab \hich\af39\dbch\af31505\loch\f39 Second of the Split Files.
+\par \hich\af39\dbch\af31505\loch\f39 --version
+\par \tab \hich\af39\dbch\af31505\loch\f39 Print version and copyright of this program and exit
+\par \hich\af39\dbch\af31505\loch\f39 -v, --verbose
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid12068497 \hich\af39\dbch\af31505\loch\f39 Enabl}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14383934
+\hich\af39\dbch\af31505\loch\f39 e}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 verbose output with informational messages printed. This is a count value}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid14383934 .}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5577864 \hich\af39\dbch\af31505\loch\f39 Specifying }{\rtlch\fcs1
+\af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \loch\af39\dbch\af31505\hich\f39 \endash \loch\f39 vv }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5577864 \hich\af39\dbch\af31505\loch\f39 will}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 increase the verbosity level.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 -q, --quiet
+\par \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14383934 \hich\af39\dbch\af31505\loch\f39 D}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 isable all messages except FATAL ERRORS
+\par \hich\af39\dbch\af31505\loch\f39 -d, --debug [#]
+\par \tab \hich\af39\dbch\af31505\loch\f39 Enable debug messages, at level #
+\par \hich\af39\dbch\af31505\loch\f39 -h, --help
+\par \tab \hich\af39\dbch\af31505\loch\f39 Print c\hich\af39\dbch\af31505\loch\f39 opyright, version and usage of this program and exit
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid10361764 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid10361764 {\*\bkmkstart OLE_LINK10}{\*\bkmkstart OLE_LINK11}
+{\*\bkmkstart OLE_LINK4}{\*\bkmkstart OLE_LINK5}{\*\bkmkstart OLE_LINK6}{\*\bkmkstart OLE_LINK9}{\*\bkmkstart OLE_LINK14}\hich\af39\dbch\af31505\loch\f39 Status codes returned}{\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0
+\b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid10361764\charrsid4999604
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af39\hich\af39\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid10361764
+{\*\bkmkend OLE_LINK10}{\*\bkmkend OLE_LINK11}0}{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\lang1033\langfe2052\kerning2\langfenp2052\insrsid10361764 \cell }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid10361764 \hich\af39\dbch\af13\loch\f39
+The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \kerning2\insrsid10361764 \cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1
+\af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid10361764 \trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10
+\trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row \ltrrow}\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af39\hich\af39\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid10361764
+\hich\af2\dbch\af13\loch\f2 Nonzero}{\rtlch\fcs1 \af42\afs19 \ltrch\fcs0 \cs25\f42\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid10361764\charrsid8600807 \cell }\pard \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid4395805\yts26 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid10361764 \hich\af39\dbch\af13\loch\f39 The action
+\hich\af39\dbch\af13\loch\f39 failed.\cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid10361764 \trowd \irow1\irowband1\lastrow \ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10
+\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11539687 {\*\bkmkend OLE_LINK4}{\*\bkmkend OLE_LINK5}{\*\bkmkend OLE_LINK6}
+{\*\bkmkend OLE_LINK9}{\*\bkmkend OLE_LINK14}\hich\af39\dbch\af31505\loch\f39 Example
+\par }\pard\plain \ltrpar\ql \li60\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin60\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 1. c:\\Tools\\Split.exe -f tool_setup.bat
+\par \hich\af39\dbch\af31505\loch\f39 \hich\f39 tool_setup.bat file will be split into two files tool_setup.bat1 and tool_setup.bat2. As no \'93\loch\f39 \hich\f39 -s\'94\loch\f39
+ was specified, tool_setup.bat1 will have the size of the input file while tool_setu\hich\af39\dbch\af31505\loch\f39 p.bat2 will have size zero.
+\par \hich\af39\dbch\af31505\loch\f39 2. c:\\Tools\\Split.exe -f tool_setup.bat -o tool_setup1 -t tool_setup2
+\par \hich\af39\dbch\af31505\loch\f39 \hich\f39 tool_setup.bat file will be split into two files tool_setup1 and tool_setup2. As no \'93\loch\f39 \hich\f39 -s\'94\loch\f39 was specified, tool_setup1 will have the size of the input file whil
+\hich\af39\dbch\af31505\loch\f39 e tool_setup2 will have size zero.
+\par \hich\af39\dbch\af31505\loch\f39 3. c:\\Tools\\Split.exe -f tool_setup.bat -s 5k -o tool_setup1 -t tool_setup2
+\par \hich\af39\dbch\af31505\loch\f39 \hich\f39 tool_setup.bat file will be split into two files tool_setup1 and tool_setup2. Now \'93\loch\f39 \hich\f39 -s 5k\'94\loch\f39 specified and tool_setup.bat is not as large as 5k, s
+\hich\af39\dbch\af31505\loch\f39 o tool_setup1 will have size of the input file while tool_setup2 will have size zero.
+\par \hich\af39\dbch\af31505\loch\f39 4. c:\\Tools\\Split.exe -f tool_setup.bat -s 4k -p c:\\ -o Test/tool_setup1 -t Test1/tool_setup2
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 tool_setup.bat file will be split into two files tool_setup1 and tool_setup2
+\hich\af39\dbch\af31505\loch\f39 \hich\f39 . Now \'93\loch\f39 \hich\f39 -s 4k\'94\loch\f39 \hich\f39
+ specified and tool_setup.bat is 4.9k, tool_setup1 will have the size of 4k and tool_setup2 will have size 0.5k. The output files are both preceded with a directory and \'93\loch\f39 -p c:\\\hich\f39 \'94\loch\f39 \hich\f39 is specified, so the \'93
+\loch\f39 \hich\f39 Test\'94\loch\f39 \hich\f39 and \'93\loch\f39 \hich\f39 Test1\'94\loch\f39 directories will be crea\hich\af39\dbch\af31505\loch\f39 t\hich\af39\dbch\af31505\loch\f39 ed under c:\\ to contain tool_setup1 and tool_setup2 }{\rtlch\fcs1
+\af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid3870620 \hich\af39\dbch\af31505\loch\f39 separately}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 .
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 No known issues
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 None.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 None.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af39\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 Copyright (c) 1999 - }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid5577864 \hich\af39\dbch\af31505\loch\f39 201}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11229351 \hich\af39\dbch\af31505\loch\f39 1}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11539687 \hich\af39\dbch\af31505\loch\f39 , Intel Corporation. All rights reserved.
+\par \hich\af39\dbch\af31505\loch\f39 This program and the accompanying materials are licensed and made available
+\par \hich\af39\dbch\af31505\loch\f39 under the terms and conditions of the BSD License which accompanies this
+\par \hich\af39\dbch\af31505\loch\f39 distribution. The full text of the license may be found at
+\par \hich\af39\dbch\af31505\loch\f39 http://opensource.org/licenses/bsd-license.ph\hich\af39\dbch\af31505\loch\f39 p
+\par
+\par \hich\af39\dbch\af31505\loch\f39 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+\par }\pard \ltrpar\ql \li60\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin60\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid11539687
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb
+44f95d843b5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a
+6409fb44d08741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c
+3d9058edf2c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db0256
+5e85f3b9660d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276
+b9f7dec44b7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8
+c33585b5fb9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e
+51440ca2e0088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95
+b21be5ceaf8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff
+6dce591a26ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec6
+9ffb9e65d028d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239
+b75a5bb1e6345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a449
+59d366ad93b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e8
+2db8df9f30254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468
+656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4
+350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d2624
+52282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe5141
+73d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c020000130000000000000000
+0000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000
+000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c0000000000000000000000000019
+0200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b00001600000000
+000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b01000027
+00000000000000000000000000a00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009b0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;
+\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdlocked0 heading 1;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;
+\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;
+\lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7;
+\lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font;
+\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision;
+\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6;
+\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;
+\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;
+\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e500000000000000000000000040de
+f2460057cc01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/TargetTool_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/TargetTool_Utility_Man_Page.rtf
new file mode 100644
index 000000000..e3965dd2c
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/TargetTool_Utility_Man_Page.rtf
@@ -0,0 +1,348 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}
+{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
+{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}
+{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}
+{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
+{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\f258\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\f259\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f261\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\f262\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\f263\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f264\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\f265\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\f266\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f268\fbidi \fswiss\fcharset238\fprq2 Arial CE;}{\f269\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;}{\f271\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}
+{\f272\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f273\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f274\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);}{\f275\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}
+{\f276\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f278\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}{\f279\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}
+{\f281\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f282\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}{\f283\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}
+{\f284\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f285\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}{\f286\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}
+{\f390\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f598\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f599\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f601\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}
+{\f602\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f605\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f606\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}
+{\f628\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\f629\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}{\f631\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}
+{\f632\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}{\f635\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\f636\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\f648\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f649\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}{\f651\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}
+{\f652\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f653\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}{\f654\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}
+{\f655\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f656\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}{\f657\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}
+{\f668\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f669\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f671\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}{\f672\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}
+{\f675\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f676\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f688\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f689\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f695\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f696\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1390\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
+{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
+{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext11 \ssemihidden \sunhideused
+Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\ai\af0\afs28 \ltrch\fcs0
+\b\i\fs28\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\*\cs17 \additive \rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \fs16 \sbasedon10 \ssemihidden \sunhideused \styrsid11096561 annotation reference;}{
+\s18\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext18 \slink19 \ssemihidden \sunhideused \styrsid11096561 annotation text;}{\*\cs19 \additive \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f43\fs20 \sbasedon10 \slink18 \slocked \ssemihidden \styrsid11096561 Comment Text Char;}{
+\s20\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0 \b\fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon18 \snext18 \slink21 \ssemihidden \sunhideused \styrsid11096561 annotation subject;}{\*\cs21 \additive \rtlch\fcs1 \ab\af0\afs20 \ltrch\fcs0 \b\f43\fs20 \sbasedon19 \slink20 \slocked \ssemihidden \styrsid11096561 Comment Subject Char;}{
+\s22\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0 \fs16\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext22 \slink23 \ssemihidden \sunhideused \styrsid11096561 Balloon Text;}{\*\cs23 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \f39\fs16 \sbasedon10 \slink22 \slocked \ssemihidden \styrsid11096561 Balloon Text Char;}{
+\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext24 \spriority0 \styrsid16388005 CellBodyLeft;}{\*\cs25 \additive \b\f2\cf13 \spriority0 \styrsid16388005 CodeCharacter;}{\*\ts26\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh
+\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon11 \snext26 \spriority59 \styrsid16388005 Table Grid;}}{\*\revtbl {Unknown;}{Zhu, Yonghong;}}{\*\rsidtbl \rsid482144\rsid1639664\rsid3545966\rsid4999604\rsid5911148\rsid7558875\rsid8264487\rsid8600807\rsid8736310\rsid9178918\rsid9377452\rsid11096561\rsid12198464\rsid14565536
+\rsid14895404\rsid16388005}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}{\creatim\yr2010\mo10\dy6\hr17\min13}
+{\revtim\yr2016\mo8\dy9\hr10\min33}{\version12}{\edmins21}{\nofpages3}{\nofwords569}{\nofchars3247}{\nofcharsws3809}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
+\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot1639664 \donotshowmarkup1\fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1
+\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang
+{\pntxta \hich )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}
+{\pntxta \hich )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0
+\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 TargetTool.exe or TargetToo.py \hich\f43 \endash \loch\f43 Command line tool edits EDKII build configuration file: target.txt.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 TargetTool [}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8736310 \hich\af43\dbch\af31505\loch\f43 -m }{\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8736310 \hich\af43\dbch\af31505\loch\f43 ThreadNum}{
+\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 ]}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8736310 \hich\af43\dbch\af31505\loch\f43 [-t }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487
+\hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8736310 \hich\af43\dbch\af31505\loch\f43 Target}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8736310 \hich\af43\dbch\af31505\loch\f43 ] [-a }{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8736310 \hich\af43\dbch\af31505\loch\f43
+Arch}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8736310
+\hich\af43\dbch\af31505\loch\f43 ] [-p }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8736310 \hich\af43\dbch\af31505\loch\f43 DscFile}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8736310 \hich\af43\dbch\af31505\loch\f43 ] [-c }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487
+\hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9178918 \hich\af43\dbch\af31505\loch\f43 ToolDefFile}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8736310 \hich\af43\dbch\af31505\loch\f43 ]}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9178918 \hich\af43\dbch\af31505\loch\f43 [-n }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487
+\hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9178918 \hich\af43\dbch\af31505\loch\f43 TagName}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9178918 \hich\af43\dbch\af31505\loch\f43 ] [-r }{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9178918 \hich\af43\dbch\af31505\loch\f43
+Rule}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9178918
+\hich\af43\dbch\af31505\loch\f43 ]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8736310
+\hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8264487 \hich\af43\dbch\af31505\loch\f43 A}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664
+\hich\af43\dbch\af31505\loch\f43 rgs}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8736310 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid1639664
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9178918 \hich\af43\dbch\af31505\loch\f43 TargetTool \hich\f43 \endash \loch\f43 h
+\par \hich\af43\dbch\af31505\loch\f43 TargetTool --version}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9178918
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 TargetTool print}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14895404 \hich\af43\dbch\af31505\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664
+\hich\af43\dbch\af31505\loch\f43 current build setting in target.txt. It can also be used to clear current setting in target.txt. }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14895404 \hich\af43\dbch\af31505\loch\f43 or}{\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43
+ to modify the current setting in target.txt. After it sets the build configuration, build tool can run without any command line option to build the tip with the current setting in target.txt. TargetTool command line option can be specified together to pr
+\hich\af43\dbch\af31505\loch\f43 i\hich\af43\dbch\af31505\loch\f43 nt or set one or a group of configurations.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1639664
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 Options
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid16388005\charrsid12198464 {\*\bkmkstart OLE_LINK12}{\*\bkmkstart OLE_LINK13}\hich\af43\dbch\af31505\loch\f43 If no options ar}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9377452 \hich\af43\dbch\af31505\loch\f43
+e specified, tool prints }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9377452 \hich\af43\dbch\af31505\loch\f43 error message}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid16388005 .}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11096561 {\*\bkmkend OLE_LINK12}{\*\bkmkend OLE_LINK13}
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 Args}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid1639664
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 This is the required command option, which can be one of the follow values.
+
+\par \hich\af43\dbch\af31505\loch\f43 Clean Clean the all defaul\hich\af43\dbch\af31505\loch\f43 t configuration of target.txt.
+\par \hich\af43\dbch\af31505\loch\f43 Print Print the all default configuration of target.txt.
+\par \hich\af43\dbch\af31505\loch\f43 Set Replace the default configuration with expected value specified by option.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 -a TARGET_ARCH, --arch=TARGET_ARCH
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 ARCHS is one of the list: IA32, X64, IPF or EBC,
+\hich\af43\dbch\af31505\loch\f43 which replaces target.txt's TARGET_ARCH definition. To specify more archs, repeat this option. 0 will clear this setting in target.txt and can't combine with other value.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 -p DSCFILE, --platform=DSCFILE}{\rtlch\fcs1 \af2\afs20 \ltrch\fcs0
+\f2\fs20\insrsid1639664
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43
+Specify a DSC file, which replace target.txt's ACTIVE_PLATFORM definition. 0 will clear this setting in target.txt and can't combine with other value.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 -c TOOL_DEFINITION_FILE, --tooldef=TOOL_DEFINITION_FILE}{\rtlch\fcs1
+\af2\afs20 \ltrch\fcs0 \f2\fs20\insrsid1639664
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 Specify the WORKSPACE relative path of tool_def.t
+\hich\af43\dbch\af31505\loch\f43 xt file, which replace target.txt's TOOL_CHAIN_CONF definition. 0 will clear this setting in target.txt and can't combine with other value.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 -t TARGET, --target=TARGET
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43
+TARGET is one of the list: DEBUG, RELEASE, which replaces target.txt's TARGET definition.\hich\af43\dbch\af31505\loch\f43 To specify more TARGET, repeat this option. 0 will clear this setting in target.txt and can't combine with other value.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 -n TOOL_CHAIN_TAG, --tagname=TOOL_CHAIN_TAG
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43
+Specify the Tool Chain Tagname, which replaces target.txt's TOOL_CHAIN_TAG definition. 0 wi\hich\af43\dbch\af31505\loch\f43 ll clear this setting in target.txt and can't combine with other value.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 -r BUILD_RULE_FILE, --buildrule=BUILD_RULE_FILE
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43
+Specify the build rule configure file, which replaces target.txt's BUILD_RULE_CONF definition. If not specified, the default value Conf/build_rule.txt will be set.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 -m NUM, --multithread=NUM
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 Specify the multi-thread number which replaces target.txt's MAX_CO
+\hich\af43\dbch\af31505\loch\f43 NCURRENT_THREAD_NUMBER. If the value is less than 2, MULTIPLE_THREAD will be disabled. If the value is larger than 1, MULTIPLE_THREAD will be enabled.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1639664
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 --version}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid1639664
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 Show program version number and exit
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 -h, --help
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 Show this help message and exit
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid16388005 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid16388005 {\*\bkmkstart OLE_LINK10}{\*\bkmkstart OLE_LINK11}
+{\*\bkmkstart OLE_LINK3}{\*\bkmkstart OLE_LINK4}{\*\bkmkstart OLE_LINK5}{\*\bkmkstart OLE_LINK6}{\*\bkmkstart OLE_LINK9}{\*\bkmkstart OLE_LINK14}\hich\af43\dbch\af31505\loch\f43 Status codes returned}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid16388005\charrsid4999604
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid16388005
+{\*\bkmkend OLE_LINK10}{\*\bkmkend OLE_LINK11}0}{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\lang1033\langfe2052\kerning2\langfenp2052\insrsid16388005 \cell }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid16388005 \hich\af43\dbch\af13\loch\f43
+The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \kerning2\insrsid16388005 \cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1
+\af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid16388005 \trowd \irow0\irowband0\ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10
+\trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row \ltrrow}\pard\plain \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts26 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs25\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid16388005
+\hich\af2\dbch\af13\loch\f2 1}{\rtlch\fcs1 \af41\afs19 \ltrch\fcs0 \cs25\f41\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid16388005\charrsid8600807 \cell }\pard \ltrpar\s24\ql \li0\ri20\sb60\sa60\sl-200\slmult0
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid14565536\yts26 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid16388005 \hich\af43\dbch\af13\loch\f43 The action failed.\cell
+}\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid16388005 \trowd \irow1\irowband1\lastrow \ltrrow\ts26\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10
+\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1639664 {\*\bkmkend OLE_LINK3}{\*\bkmkend OLE_LINK4}{\*\bkmkend OLE_LINK5}
+{\*\bkmkend OLE_LINK6}{\*\bkmkend OLE_LINK9}{\*\bkmkend OLE_LINK14}\hich\af43\dbch\af31505\loch\f43 Example
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 1. Pr\hich\af43\dbch\af31505\loch\f43 int current build setting in target.txt
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 TargetTool Print}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid1639664
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 2. Clear current build setting in target.txt.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 TargetTool Clean}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1639664
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 3. Set the build thread number to 3.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1639664
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 TargetTool -m 3 set}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid1639664
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 4. Set the build arch to IA32, X64 and IPF both.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 TargetTool -a IA32 -a X64 -a\hich\af43\dbch\af31505\loch\f43 IPF set}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid1639664
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 5. Set the build target to DEBUG and set the active platform to NT32Pkg.dsc}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1639664
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 TargetTool -t DEBUG -p Nt32Pkg/Nt32Pkg.dsc set}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid1639664
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 No known }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14895404 \hich\af43\dbch\af31505\loch\f43 issues}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 .
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1195920033\insrsid482144\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-\hich\af43\dbch\af31505\loch\f43 devel
+\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel1\revdttmdel1195920033\insrsid1639664\delrsid482144 \hich\af43\dbch\af31505\loch\f43
+edk2-buildtools-devel@lists.sourceforge.net}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid1639664
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 Copyright \hich\af43\dbch\af31505\loch\f43 (c) 2007 - }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14895404 \hich\af43\dbch\af31505\loch\f43 201}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid7558875 \hich\af43\dbch\af31505\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 , Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licensed and made available
+\par \hich\af43\dbch\af31505\loch\f43 under the terms and conditions of the BSD License which accompanies this
+\par \hich\af43\dbch\af31505\loch\f43 distribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1639664 \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\insrsid1639664
+\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid1639664
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb
+44f95d843b5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a
+6409fb44d08741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c
+3d9058edf2c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db0256
+5e85f3b9660d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276
+b9f7dec44b7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8
+c33585b5fb9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e
+51440ca2e0088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95
+b21be5ceaf8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff
+6dce591a26ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec6
+9ffb9e65d028d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239
+b75a5bb1e6345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a449
+59d366ad93b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e8
+2db8df9f30254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468
+656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4
+350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d2624
+52282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe5141
+73d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c020000130000000000000000
+0000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000
+000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c0000000000000000000000000019
+0200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b00001600000000
+000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b01000027
+00000000000000000000000000a00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009b0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e50000000000000000000000001012
+376ee6f1d101feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/TianoCompress_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/TianoCompress_Utility_Man_Page.rtf
new file mode 100644
index 000000000..68cefeb9d
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/TianoCompress_Utility_Man_Page.rtf
@@ -0,0 +1,321 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}
+{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}
+{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f258\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\f259\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f261\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\f262\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\f263\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f264\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\f265\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\f266\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f278\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}
+{\f279\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}{\f281\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f282\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}
+{\f283\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}{\f284\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f285\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}
+{\f286\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}{\f390\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f598\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}
+{\f599\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f601\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f602\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f605\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}
+{\f606\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f628\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\f629\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\f631\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\f632\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}{\f635\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}
+{\f636\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}{\f648\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f649\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}
+{\f651\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}{\f652\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f653\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}
+{\f654\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}{\f655\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f656\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}
+{\f657\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}{\f668\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f669\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f671\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}
+{\f672\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}{\f675\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f676\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f688\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f689\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f695\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f696\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1390\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
+{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
+{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red0\green127\blue127;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext11 \ssemihidden \sunhideused
+Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\ai\af0\afs28 \ltrch\fcs0
+\b\i\fs28\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\s17\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0
+\fs16\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext17 \slink18 \ssemihidden \sunhideused \styrsid7632496 Balloon Text;}{\*\cs18 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \f39\fs16
+\sbasedon10 \slink17 \slocked \ssemihidden \styrsid7632496 Balloon Text Char;}{\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0
+\fs16\cf1\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext19 \spriority0 \styrsid6897091 CellBodyLeft;}{\*\cs20 \additive \b\f2\cf13 \spriority0 \styrsid6897091 CodeCharacter;}{\*\ts21\tsrowd\trbrdrt
+\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon11 \snext21 \spriority59 \styrsid6897091 Table Grid;}}{\*\revtbl {Unknown;}{Zhu, Yonghong;}}{\*\rsidtbl \rsid31399\rsid4999604\rsid5324626\rsid5856265\rsid5911148\rsid6034337\rsid6184429\rsid6454980\rsid6845986\rsid6897091\rsid7632496\rsid8600807\rsid9781754\rsid10967835
+\rsid12198464\rsid15148218\rsid16532127}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}{\creatim\yr2010\mo10\dy6\hr16\min15}
+{\revtim\yr2016\mo8\dy9\hr10\min33}{\version13}{\edmins14}{\nofpages3}{\nofwords427}{\nofchars2434}{\nofcharsws2856}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
+\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot6454980 \donotshowmarkup1\fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1
+\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang
+{\pntxta \hich )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}
+{\pntxta \hich )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0
+\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid16532127 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1
+\ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 TianoCompress.exe \hich\f43 \endash \loch\f43 encode or decode a file
+\par }\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid16532127 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 TianoCompress.exe}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5324626 \hich\af43\dbch\af31505\loch\f43 \hich\f43 \endash \loch\f43
+e|-d}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 [}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5324626 \hich\af43\dbch\af31505\loch\f43
+-v | -q | --debug}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 ]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5324626 \hich\af43\dbch\af31505\loch\f43
+ [-o }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9781754 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5324626
+\hich\af43\dbch\af31505\loch\f43 OutputFile}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid9781754 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5324626 \hich\af43\dbch\af31505\loch\f43 ]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5324626 \hich\af43\dbch\af31505\loch\f43 <Input}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 File}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5324626 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid6454980
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5324626 \hich\af43\dbch\af31505\loch\f43 TianoCompress.exe}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5324626 \hich\af43\dbch\af31505\loch\f43
+\hich\f43 \endash \loch\f43 h
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid5324626 \hich\af43\dbch\af31505\loch\f43 TianoCompress.exe}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5324626 \hich\af43\dbch\af31505\loch\f43
+ --version
+\par }\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid16532127 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 TianoCompress tool encode}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980
+\hich\af43\dbch\af31505\loch\f43 or decode}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 files with }{
+\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 EFI extension encode or decode algorithm. When}{\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 the}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 \hich\f43 \'93\loch\f43 \hich\f43 -e\'94\loch\f43 \hich\f43
+ option is specified in command line, the tool will encode the input file with EFI extension encode algorithm; when \'93\loch\f43 \hich\f43 -d\'94\loch\f43 option is speci\hich\af43\dbch\af31505\loch\f43
+fied in the command line, the tool will decode the input file with EFI extension decode algorithm. When decoding a file, }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 the }{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 tool performs some rudimentary checking on the input files to verify that they }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 were }{
+\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 compressed by the EFI extension algorithm. Thes\hich\af43\dbch\af31505\loch\f43 e checks include:
+\par \hich\af43\dbch\af31505\loch\f43 Check}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 ing}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43
+ the input file header (8 bytes header);
+\par \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 Checking t}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43
+he first 4 bytes is component size (not usable);
+\par \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 Checking t}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43
+he following 4 bytes }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 are }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 the original size }{\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 of}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 the input file size and}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 that}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 it is the decompressed file size.
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 The}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 tool does not perform any checking}{\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 when encoding the file.}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 .
+\par }\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid16532127 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 Options
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid10967835\charrsid12198464 {\*\bkmkstart OLE_LINK12}{\*\bkmkstart OLE_LINK13}\hich\af43\dbch\af31505\loch\f43 If no options ar}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid10967835 \hich\af43\dbch\af31505\loch\f43
+e specified, tool prints usage.}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid7632496 {\*\bkmkend OLE_LINK12}{\*\bkmkend OLE_LINK13}
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 -e
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 Encode the input file, which means to compress the i\hich\af43\dbch\af31505\loch\f43 nput file
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 -d
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 Decode the input file, which means to decompress the input file
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 -o, --output Filename}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6454980
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 The file containing encoded or decoded content of input file
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 --version
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6454980 \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 Print version and copyright of this program and exit
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 -v, --verbose
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 Enable}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980
+\hich\af43\dbch\af31505\loch\f43 verbose output with informational messages printed. This is a count value, so specifying \hich\f43 \endash \loch\f43 v can be used to increase the verbosity level.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 -q, --quiet}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid6454980
+\par \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 Disable all messages except FATAL ERRORS
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 --debug [0-9]
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6454980 \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 Enable debug messages. nly 0-9 Level is supported.
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 -h, --help
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6454980 \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 Print copyright, version and usage of this program and exit
+\par }\pard\plain \ltrpar\s2\ql \fi-1440\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid6897091 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6897091\charrsid6184429 {\*\bkmkstart OLE_LINK7}{\*\bkmkstart OLE_LINK8}\hich\af43\dbch\af31505\loch\f43
+Status codes returned}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid6897091
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts21\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\pard\plain \ltrpar\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts21 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6897091\charrsid8600807 \hich\af2\dbch\af13\loch\f2 STATUS_SUCCESS}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6897091 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6897091\charrsid4999604 \tab }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6897091 0\cell }{\rtlch\fcs1 \af0 \ltrch\fcs0
+\insrsid6897091 \hich\af43\dbch\af13\loch\f43 The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \kerning2\insrsid6897091 \cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0
+\fs20\insrsid6897091 \trowd \irow0\irowband0\ltrrow\ts21\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row \ltrrow}\pard\plain \ltrpar\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts21 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs20\b\f2\fs18\cf13\kerning2\insrsid6897091\charrsid8600807 \hich\af2\dbch\af13\loch\f2
+STATUS_ERROR}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6897091 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6897091\charrsid4999604 \tab \tab }{\rtlch\fcs1
+\ab\af2\afs18 \ltrch\fcs0 \cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid6897091 \hich\af2\dbch\af13\loch\f2 2}{\rtlch\fcs1 \af41\afs19 \ltrch\fcs0 \cs20\f41\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid6897091\charrsid8600807
+\cell }\pard \ltrpar\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid6845986\yts21 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid6897091
+\hich\af43\dbch\af13\loch\f43 The action failed.\cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid6897091 \trowd \irow1\irowband1\lastrow \ltrrow\ts21\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10
+\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row }\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid16532127 \rtlch\fcs1
+\af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6454980 {\*\bkmkend OLE_LINK7}{\*\bkmkend OLE_LINK8}
+\hich\af43\dbch\af31505\loch\f43 Example
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 \hich\f43 1. Encode the input file \'93\loch\f43 \hich\f43 file.efi\'94\loch\f43 \hich\f43 and specify the output file name with \'93\loch\f43 file.tiano
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 TianoCompress \hich\f43 \endash \loch\f43 e \hich\f43 \endash \loch\f43 o file.tiano file.efi
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 \hich\f43 2. Decode the input file \'93\loch\f43 \hich\f43 file.tiano\'94\loch\f43 \hich\f43 and specify the output file name with \'93\loch\f43 \hich\f43
+file.orig\'94
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 TianoCompress \loch\af43\dbch\af31505\hich\f43 \endash \loch\f43 d \hich\f43 \endash \loch\f43 o file.orig file.tiano
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 3. Decode the input file "file.tiano" in the quiet mode and specify the output file name with "file.orig"
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 TianoCompress \hich\f43 \endash \loch\f43 d -q \hich\f43 \endash \loch\f43 o file.orig file.tiano
+\par }\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid16532127 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 No known }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 issues}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980 .
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1195920033\insrsid15148218\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-\hich\af43\dbch\af31505\loch\f43 devel
+\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel1\revdttmdel1195920033\insrsid6454980\delrsid15148218 \hich\af43\dbch\af31505\loch\f43
+edk2-buildtools-devel@lists.sourceforge.ne\hich\af43\dbch\af31505\loch\f43 t}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6454980
+\par }\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid16532127 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid16532127 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \fi-1300\li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid16532127 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid6454980 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 1999 - }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 20}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid5856265 \hich\af43\dbch\af31505\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6034337 \hich\af43\dbch\af31505\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6454980
+\hich\af43\dbch\af31505\loch\f43 , Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licensed and made available
+\par \hich\af43\dbch\af31505\loch\f43 under the terms and conditions of the BSD License which accompanies this
+\par \hich\af43\dbch\af31505\loch\f43 dis\hich\af43\dbch\af31505\loch\f43 tribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+\par \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb
+44f95d843b5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a
+6409fb44d08741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c
+3d9058edf2c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db0256
+5e85f3b9660d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276
+b9f7dec44b7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8
+c33585b5fb9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e
+51440ca2e0088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95
+b21be5ceaf8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff
+6dce591a26ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec6
+9ffb9e65d028d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239
+b75a5bb1e6345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a449
+59d366ad93b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e8
+2db8df9f30254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468
+656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4
+350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d2624
+52282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe5141
+73d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c020000130000000000000000
+0000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000
+000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c0000000000000000000000000019
+0200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b00001600000000
+000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b01000027
+00000000000000000000000000a00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009b0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e5000000000000000000000000e0a4
+b77be6f1d101feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/Trim_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/Trim_Utility_Man_Page.rtf
new file mode 100644
index 000000000..4dbc11871
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/Trim_Utility_Man_Page.rtf
@@ -0,0 +1,369 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}
+{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
+{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}
+{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}
+{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
+{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\f258\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\f259\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f261\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\f262\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\f263\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f264\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\f265\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\f266\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f268\fbidi \fswiss\fcharset238\fprq2 Arial CE;}{\f269\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;}{\f271\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}
+{\f272\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f273\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f274\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);}{\f275\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}
+{\f276\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f278\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}{\f279\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}
+{\f281\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f282\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}{\f283\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}
+{\f284\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f285\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}{\f286\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}
+{\f390\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f598\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f599\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f601\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}
+{\f602\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f605\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f606\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}
+{\f628\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\f629\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}{\f631\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}
+{\f632\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}{\f635\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\f636\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\f648\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f649\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}{\f651\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}
+{\f652\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f653\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}{\f654\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}
+{\f655\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f656\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}{\f657\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}
+{\f668\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f669\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f671\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}{\f672\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}
+{\f675\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f676\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f688\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f689\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f691\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f695\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f696\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1390\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
+{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
+{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext11 \ssemihidden \sunhideused
+Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\ai\af0\afs28 \ltrch\fcs0
+\b\i\fs28\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\s17\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0
+\fs16\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext17 \slink18 \ssemihidden \sunhideused \styrsid6643493 Balloon Text;}{\*\cs18 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \f39\fs16
+\sbasedon10 \slink17 \slocked \ssemihidden \styrsid6643493 Balloon Text Char;}{\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0
+\fs16\cf1\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext19 \spriority0 \styrsid8347714 CellBodyLeft;}{\*\cs20 \additive \b\f2\cf13 \spriority0 \styrsid8347714 CodeCharacter;}{\*\ts21\tsrowd\trbrdrt
+\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon11 \snext21 \spriority59 \styrsid8347714 Table Grid;}}{\*\revtbl {Unknown;}{yzeng15;}{Zhu, Yonghong;}}{\*\rsidtbl \rsid2436965\rsid3155658\rsid4999604\rsid5138063\rsid5911148\rsid6037602\rsid6643493\rsid6907013\rsid8089322\rsid8347714\rsid8412573\rsid8600807\rsid8606769\rsid8651272
+\rsid14103422\rsid16001458\rsid16667942}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}{\creatim\yr2010\mo10\dy6\hr17\min15}
+{\revtim\yr2016\mo8\dy9\hr10\min34}{\version14}{\edmins11}{\nofpages3}{\nofwords624}{\nofchars3559}{\nofcharsws4175}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
+\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot6643493 \donotshowmarkup1\fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1
+\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang
+{\pntxta \hich )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}
+{\pntxta \hich )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0
+\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Trim.exe or Trim.py \hich\f43 \endash \loch\f43 Convert the preprocessed source files by C compiler to the expected style file to be processed further by EDKII tool.}{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 trim [-s|-r|\hich\af43\dbch\af31505\loch\f43 -a|-8] [-c] [-v|-d <debug_level>|-q] [-o <output_file>] <input_file>
+\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid3155658 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid3155658 \hich\af43\dbch\af31505\loch\f43 trim \hich\f43 \endash
+\loch\f43 h
+\par \hich\af43\dbch\af31505\loch\f43 trim --version}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\langfenp2052\insrsid3155658\charrsid8089322
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid3155658
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Trim tool }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \hich\af43\dbch\af31505\loch\f43 process}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493
+\hich\af43\dbch\af31505\loch\f43 the preprocessed file by}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \hich\af43\dbch\af31505\loch\f43 a}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43
+ Compiler to remove the unused content }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \hich\af43\dbch\af31505\loch\f43 and }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43
+generate the file to be processed further by EDKII tools.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Trim t\hich\af43\dbch\af31505\loch\f43 ool can also be used generate the expected source file to work with EDKII build system and EDKII core code}{\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \hich\af43\dbch\af31505\loch\f43 . It extends the EDKII build system to support more source file types.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493
+\par
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Options
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 input_file
+\par \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 The input file may be the preprocessed source code, the pr\hich\af43\dbch\af31505\loch\f43 eprocessed VFR file, ASL file or R8 framework source file.}{
+\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 -s, --source-code
+\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 The input file is}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422
+\hich\af43\dbch\af31505\loch\f43 a }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43
+preprocessed source code, including C or assembly code. All generated codes from the include header files are remove all. Only content in source file is k\hich\af43\dbch\af31505\loch\f43 ept.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid6643493
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 -r, --vfr-file
+\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 The input file is }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422
+\hich\af43\dbch\af31505\loch\f43 a }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 preprocessed VFR file. All generated codes from the include header files are remove except for the typedef structure.}{
+\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 -a, --asl-file
+\par }\pard \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 The input file is }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid14103422 \hich\af43\dbch\af31505\loch\f43 an }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 ASL file. The asl source include style Include\hich\af43\dbch\af31505\loch\f43
+(*.asi) will be changed to C style #include *.asi. The preprocessed asl file can be preprocessed by C compiler. }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 -8, --}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\deleted\fs18\cf1\revauthdel1\revdttmdel-2030484795\insrsid6643493\delrsid8412573 \hich\af43\dbch\af31505\loch\f43 r8}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm-2030484795\langfenp2052\insrsid8412573 \hich\af43\dbch\af31505\loch\f43 E}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm-2030484722\langfenp2052\insrsid16001458 \hich\af43\dbch\af31505\loch\f43 dk}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 -source-code
+\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43
+The input file is the EDK style source code to be trimmed for ECP platform. Some EDK framework source file w\hich\af43\dbch\af31505\loch\f43 \hich\f43 ill be modified to work with EDKII thunk and core drivers. A window script tool \'93\loch\f43 \hich\f43
+ImportTool.bat\'94\loch\f43 is created to process a group of EDK framework source files in the same file directory. }{\rtlch\fcs1 \af2\afs20 \ltrch\fcs0 \f2\fs20\insrsid6643493
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 -c, --convert-hex
+\par }\pard \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Convert}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422
+\hich\af43\dbch\af31505\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 standard hex format (0xabcd) to MASM f\hich\af43\dbch\af31505\loch\f43 ormat (abcdh).}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0
+\f0\fs18\cf1\insrsid6643493
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 -o OUTPUTFILE, --output=OUTPUTFILE
+\par }\pard \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 The output file }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422
+\hich\af43\dbch\af31505\loch\f43 stores}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 the trimmed content.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 -v, --verbose}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid6643493
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 \tab }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \hich\af43\dbch\af31505\loch\f43 Enable}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 verbose output with informational messages printed}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2436965
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 -d LOGLEVEL, --debug=LOGLEVEL [0-9]}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid6643493
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Enable debug messages at specified level.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 -q, --quiet}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\insrsid6643493
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Disable all messages except FATAL ERRORS}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493\delrsid6643493 \hich\af43\dbch\af31505\loch\f43 }{
+\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid2436965
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 --version}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid6643493
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Show program version number and exit
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 -h, -?, --help
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Show this help message and exit
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid8347714 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid8347714 {\*\bkmkstart OLE_LINK10}{\*\bkmkstart OLE_LINK11}
+{\*\bkmkstart OLE_LINK3}{\*\bkmkstart OLE_LINK4}{\*\bkmkstart OLE_LINK5}{\*\bkmkstart OLE_LINK6}{\*\bkmkstart OLE_LINK9}{\*\bkmkstart OLE_LINK14}\hich\af43\dbch\af31505\loch\f43 Status codes returned}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid8347714\charrsid4999604
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts21\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\pard\plain \ltrpar\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts21 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid8347714
+{\*\bkmkend OLE_LINK10}{\*\bkmkend OLE_LINK11}0\cell }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid8347714 \hich\af43\dbch\af13\loch\f43 The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \kerning2\insrsid8347714 \cell }\pard\plain \ltrpar
+\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1
+\af37\afs20 \ltrch\fcs0 \fs20\insrsid8347714 \trowd \irow0\irowband0\ltrrow\ts21\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row \ltrrow}\pard\plain \ltrpar\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts21 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid8347714
+\hich\af2\dbch\af13\loch\f2 1}{\rtlch\fcs1 \af41\afs19 \ltrch\fcs0 \cs20\f41\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid8347714\charrsid8600807 \cell }\pard \ltrpar\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid3155658\yts21 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid8347714 \hich\af43\dbch\af13\loch\f43 The action failed.\cell
+}\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid8347714 \trowd \irow1\irowband1\lastrow \ltrrow\ts21\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10
+\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6643493 {\*\bkmkend OLE_LINK3}{\*\bkmkend OLE_LINK4}{\*\bkmkend OLE_LINK5}
+{\*\bkmkend OLE_LINK6}{\*\bkmkend OLE_LINK9}{\*\bkmkend OLE_LINK14}\hich\af43\dbch\af31505\loch\f43 Example
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43
+1. Trim the preprocessed source file (test.i) by C compiler to remove all generated codes from the include header files by this source file (test.s) to the output file test.iii, which only contains the content in this source file (test.s).}{\rtlch\fcs1
+\af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid6643493\charrsid8606769 \hich\af43\dbch\af31505\loch\f43 Trim --source-co\hich\af43\dbch\af31505\loch\f43 de -o test.iii test.i}{\rtlch\fcs1 \ab\af0\afs18
+\ltrch\fcs0 \b\f0\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid6643493\charrsid8606769
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 2. Trim the preprocessed source file (test.i) by }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \hich\af43\dbch\af31505\loch\f43 a }{
+\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43
+C compiler to remove all generated codes from the include header files by this source file (test.asm) and convert standard hex format (0xabcd) to MASM format (abcdh) to the output fil\hich\af43\dbch\af31505\loch\f43
+e test.iii, which only contains the content in this source file (test.s).
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid6643493\charrsid8606769 \hich\af43\dbch\af31505\loch\f43 Trim --source-code --convert-hex -o test.iii test.i}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid6643493\charrsid8606769
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 3. Trim the preprocessed source file (test.i) by}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \hich\af43\dbch\af31505\loch\f43 a}{
+\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 C compiler to remove all generated codes from the include header files by this \hich\af43\dbch\af31505\loch\f43
+source file (test.vfr) except for the typedef structures to the output file (test.iii).}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Trim --vfr-file -o test.iii test.i}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid6643493
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 4. Trim }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8651272 \hich\af43\dbch\af31505\loch\f43 the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 ASL source file (test.asl) to convert the ASL style Include(*.asi) to the C style #include *.asi. The update}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8651272
+\hich\af43\dbch\af31505\loch\f43 d}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 ASL will ou\hich\af43\dbch\af31505\loch\f43 tput to test.i.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493
+
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Trim --asl-file -o test.i test.asl}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid6643493
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 5. Modify an EDK style framework source file to work with EDKII thunk and core drivers.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid6643493\charrsid8606769 \hich\af43\dbch\af31505\loch\f43 Trim --r8-source-code -o test.c test.c}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0
+\b\f0\fs18\cf1\lang1036\langfe1033\langnp1036\insrsid6643493\charrsid8606769
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 5. Modify all EDK style framework source files (*.c and *.h) in current direct\hich\af43\dbch\af31505\loch\f43 \hich\f43
+ory to work with EDKII thunk and core drivers by the script \'93\loch\f43 \hich\f43 ImportTool.bat\'94.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 ImportTool *.c}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid6643493
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 ImportTool *.h
+\par }{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid6643493
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 No known }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8651272 \hich\af43\dbch\af31505\loch\f43 issues}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 .
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth2\revdttm1195920034\insrsid16667942\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-\hich\af43\dbch\af31505\loch\f43 devel
+\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel2\revdttmdel1195920034\insrsid6643493\delrsid16667942 \hich\af43\dbch\af31505\loch\f43
+edk2-buildtools-devel@lists.sourceforge.net}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 2007 - }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8651272 \hich\af43\dbch\af31505\loch\f43 20}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid8606769 \hich\af43\dbch\af31505\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid8651272 \hich\af43\dbch\af31505\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493
+\hich\af43\dbch\af31505\loch\f43 , Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licensed and made available
+\par \hich\af43\dbch\af31505\loch\f43 under the terms and conditions of the BSD License which accompanies this
+\par \hich\af43\dbch\af31505\loch\f43 distribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 htt\hich\af43\dbch\af31505\loch\f43 p://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+\par }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\insrsid6643493
+\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid6643493
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb
+44f95d843b5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a
+6409fb44d08741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c
+3d9058edf2c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db0256
+5e85f3b9660d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276
+b9f7dec44b7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8
+c33585b5fb9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e
+51440ca2e0088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95
+b21be5ceaf8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff
+6dce591a26ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec6
+9ffb9e65d028d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239
+b75a5bb1e6345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a449
+59d366ad93b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e8
+2db8df9f30254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468
+656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4
+350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d2624
+52282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe5141
+73d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c020000130000000000000000
+0000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000
+000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c0000000000000000000000000019
+0200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b00001600000000
+000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b01000027
+00000000000000000000000000a00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009b0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e30000000000000000000000e0000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff0900060000000000000000000000010000000100000000000000001000000200000001000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdffffff04000000feffffff05000000fefffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffff010000000c6ad98892f1d411a65f0040963251e5000000000000000000000000a0b4
+f388e6f1d1010300000080020000000000004d0073006f004400610074006100530074006f0072006500000000000000000000000000000000000000000000000000000000000000000000000000000000001a000101ffffffffffffffff020000000000000000000000000000000000000000000000a0b4f388e6f1d101
+a0b4f388e6f1d101000000000000000000000000ce00d50049005a00c8004700d20058005700c400ca005900c60047004c00c100cd00cb00c400df00c300d0003d003d000000000000000000000000000000000032000101ffffffffffffffff030000000000000000000000000000000000000000000000a0b4f388e6f1
+d101a0b4f388e6f1d1010000000000000000000000004900740065006d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000201ffffffff04000000ffffffff000000000000000000000000000000000000000000000000
+00000000000000000000000000000000d800000000000000010000000200000003000000feffffff0500000006000000070000000800000009000000feffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3c623a536f75726365732053656c65637465645374796c653d225c4150412e58534c22205374796c654e616d653d224150412220786d6c6e733a623d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f7267
+2f6f6666696365446f63756d656e742f323030362f6269626c696f6772617068792220786d6c6e733d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f6269626c696f677261706879223e3c2f623a536f75726365733e00000000
+0000000000000000000000000000000000000000000000000000000000000000000000003c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d226e6f223f3e0d0a3c64733a6461746173746f72654974656d2064733a6974656d49443d227b41303139
+353242422d393736432d344135412d393839382d3632453142364239334638467d2220786d6c6e733a64733d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f637573746f6d586d6c223e3c64733a736368656d61526566733e3c
+64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6f70656e500072006f007000650072007400690065007300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000200ffffffffffffffffffffffff000000000000
+0000000000000000000000000000000000000000000000000000000000000400000055010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f6269626c696f677261706879222f3e3c2f64733a736368656d61526566733e3c2f64733a6461746173746f
+72654974656d3e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/UtilityManPage_template.rtf b/roms/edk2/BaseTools/UserManuals/UtilityManPage_template.rtf
new file mode 100644
index 000000000..08e198052
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/UtilityManPage_template.rtf
@@ -0,0 +1,241 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe2052\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}
+{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\f258\fbidi \fnil\fcharset77\fprq0{\*\panose 00000000000000000000}Verdana-Bold{\*\falt Times New Roman};}
+{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhimajor\f31502\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f391\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f599\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f600\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f602\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}
+{\f603\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f606\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f607\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f689\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f690\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f693\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f696\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f697\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1391\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \fswiss\fcharset238\fprq2 Calibri Light CE;}{\fhimajor\f31529\fbidi \fswiss\fcharset204\fprq2 Calibri Light Cyr;}
+{\fhimajor\f31531\fbidi \fswiss\fcharset161\fprq2 Calibri Light Greek;}{\fhimajor\f31532\fbidi \fswiss\fcharset162\fprq2 Calibri Light Tur;}{\fhimajor\f31535\fbidi \fswiss\fcharset186\fprq2 Calibri Light Baltic;}
+{\fhimajor\f31536\fbidi \fswiss\fcharset163\fprq2 Calibri Light (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\f259\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\f260\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f262\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\f263\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\f264\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f265\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\f266\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\f267\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
+\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
+\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;\red198\green99\blue85;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa160\sl259\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025
+\ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa160\sl259\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext11 \ssemihidden \sunhideused
+Normal Table;}}{\*\rsidtbl \rsid5246601\rsid11936374}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}{\creatim\yr2016\mo8\dy9\hr10\min34}
+{\revtim\yr2016\mo8\dy9\hr10\min34}{\version2}{\edmins0}{\nofpages2}{\nofwords160}{\nofchars917}{\nofcharsws1075}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
+\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot11936374 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \hich )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\nowidctlpar
+\tx1440\wrapdefault\faauto\rin0\lin-1440\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\af31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \ab\af258\afs28 \ltrch\fcs0
+\b\f258\fs28\cf17\insrsid5246601 \hich\af258\dbch\af31505\loch\f258 Name
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\insrsid5246601 \hich\af43\dbch\af31505\loch\f43 \~tool name - short description
+\par }\pard \ltrpar\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\nowidctlpar\tx1440\wrapdefault\faauto\rin0\lin-1440\itap0 {\rtlch\fcs1 \ab\af258\afs28 \ltrch\fcs0 \b\f258\fs28\cf17\insrsid5246601 \hich\af258\dbch\af31505\loch\f258 Synopsis
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\insrsid5246601 \hich\af43\dbch\af31505\loch\f43 \~tool_name [Options] RequiredArguments
+\par }\pard \ltrpar\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\nowidctlpar\tx1440\wrapdefault\faauto\rin0\lin-1440\itap0 {\rtlch\fcs1 \ab\af258\afs28 \ltrch\fcs0 \b\f258\fs28\cf17\insrsid5246601 \hich\af258\dbch\af31505\loch\f258 Description
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\insrsid5246601 \hich\af43\dbch\af31505\loch\f43 tool functions and usage (when does this tool need to be used)
+\par }\pard \ltrpar\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\nowidctlpar\tx1440\wrapdefault\faauto\rin0\lin-1440\itap0 {\rtlch\fcs1 \ab\af258\afs28 \ltrch\fcs0 \b\f258\fs28\cf17\insrsid5246601 \hich\af258\dbch\af31505\loch\f258 Options
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af258\afs18 \ltrch\fcs0 \b\f258\fs18\insrsid5246601 \hich\af258\dbch\af31505\loch\f258 -x abc, --xyz abc
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\insrsid5246601 \tab \hich\af43\dbch\af31505\loch\f43 x equal to xyz, set to required value value: abc
+\par }{\rtlch\fcs1 \ab\af258\afs18 \ltrch\fcs0 \b\f258\fs18\insrsid5246601 \hich\af258\dbch\af31505\loch\f258 -x\hich\af258\dbch\af31505\loch\f258 [abc], --xyz [abc]}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\insrsid5246601
+\par \tab \hich\af43\dbch\af31505\loch\f43 x equal to xyz, abc is optional
+\par }\pard \ltrpar\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\nowidctlpar\tx1440\wrapdefault\faauto\rin0\lin-1440\itap0 {\rtlch\fcs1 \ab\af258\afs28 \ltrch\fcs0 \b\f258\fs28\cf17\insrsid5246601 \hich\af258\dbch\af31505\loch\f258 Examples
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\insrsid5246601 \hich\af43\dbch\af31505\loch\f43 Example 1 Description
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\cf18\insrsid5246601 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af258\afs18 \ltrch\fcs0 \b\f258\fs18\cf18\insrsid5246601 \hich\af258\dbch\af31505\loch\f258 code snippet}{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \f43\fs18\insrsid5246601
+\par \hich\af43\dbch\af31505\loch\f43 Example 2 Description
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\cf18\insrsid5246601 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af258\afs18 \ltrch\fcs0 \b\f258\fs18\cf18\insrsid5246601 \hich\af258\dbch\af31505\loch\f258 code snippet}{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \f43\fs18\insrsid5246601
+\par }\pard \ltrpar\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\nowidctlpar\tx1440\wrapdefault\faauto\rin0\lin-1440\itap0 {\rtlch\fcs1 \ab\af258\afs28 \ltrch\fcs0 \b\f258\fs28\cf17\insrsid5246601 \hich\af258\dbch\af31505\loch\f258 Bugs
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\insrsid5246601 \hich\af43\dbch\af31505\loch\f43 No known bugs.
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\cf1\lang1033\langfe1033\langfenp1033\insrsid11936374\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-\hich\af43\dbch\af31505\loch\f43 devel
+\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\insrsid5246601
+\par }\pard \ltrpar\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\nowidctlpar\tx1440\wrapdefault\faauto\rin0\lin-1440\itap0 {\rtlch\fcs1 \ab\af258\afs28 \ltrch\fcs0 \b\f258\fs28\cf17\insrsid5246601 \hich\af258\dbch\af31505\loch\f258 Files
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\insrsid5246601 \hich\af43\dbch\af31505\loch\f43 configuration files that tool \hich\af43\dbch\af31505\loch\f43
+depends on(optional) - None. if not needed
+\par }\pard \ltrpar\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\nowidctlpar\tx1440\wrapdefault\faauto\rin0\lin-1440\itap0 {\rtlch\fcs1 \ab\af258\afs28 \ltrch\fcs0 \b\f258\fs28\cf17\insrsid5246601 \hich\af258\dbch\af31505\loch\f258 See also
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\insrsid5246601 \hich\af43\dbch\af31505\loch\f43 Tool-golden, Tool-silver, Tool-Copper - None if not applicable.
+\par }\pard \ltrpar\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\nowidctlpar\tx1440\wrapdefault\faauto\rin0\lin-1440\itap0 {\rtlch\fcs1 \ab\af258\afs28 \ltrch\fcs0 \b\f258\fs28\cf17\insrsid5246601 \hich\af258\dbch\af31505\loch\f258 License
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\insrsid5246601 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 1999 - 2007, Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licensed and ma\hich\af43\dbch\af31505\loch\f43 de available
+\par \hich\af43\dbch\af31505\loch\f43 under the terms and conditions of the BSD License which accompanies this
+\par \hich\af43\dbch\af31505\loch\f43 distribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+\par \hich\af43\dbch\af31505\loch\f43 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \f43\fs18\insrsid5246601
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b030414000600080000002100aa5225dfc60600008b1a0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec595d8bdb46147d2ff43f08bd3bfe92fcb1c41b6cd9ceb6d94d42eca4e4716c8fadc98e344633de8d0981923c160aa569e943037deb
+43691b48a02fe9afd936a54d217fa17746b63c638fbb9b2585a5640d8b343af7ce997bafce1d4997afdc8fa87384134e58dc708b970aae83e3211b9178d2706f
+f7bbb99aeb7081e211a22cc60d778eb97b65f7c30f2ea31d11e2083b601ff31dd4704321a63bf93c1fc230e297d814c7706dcc920809384d26f951828ec16f44
+f3a542a1928f10895d274611b8bd311e932176fad2a5bbbb74dea1701a0b2e078634e949d7d8b050d8d1615122f89c0734718e106db830cf881df7f17de13a14
+7101171a6e41fdb9f9ddcb79b4b330a2628bad66d7557f0bbb85c1e8b0a4e64c26836c52cff3bd4a33f3af00546ce23ad54ea553c9fc29001a0e61a52917dda7
+dfaab7dafe02ab81d2438bef76b55d2e1a78cd7f798373d3973f03af40a97f6f03dfed06104503af4029dedfc07b5eb51478065e81527c65035f2d34db5ed5c0
+2b5048497cb8812ef89572b05c6d061933ba6785d77daf5b2d2d9caf50500d5975c929c62c16db6a2d42f758d2058004522448ec88f9148fd110aa3840940c12
+e2ec93490885374531e3305c2815ba8532fc973f4f1da988a01d8c346bc90b98f08d21c9c7e1c3844c45c3fd18bcba1ae4cdcb1fdfbc7cee9c3c7a71f2e89793
+c78f4f1efd9c3a32acf6503cd1ad5e7fffc5df4f3f75fe7afeddeb275fd9f15cc7fffed367bffdfaa51d082b5d85e0d5d7cffe78f1ecd5379ffff9c3130bbc99
+a0810eef930873e73a3e766eb10816a6426032c783e4ed2cfa2122ba45339e701423398bc57f478406fafa1c5164c1b5b019c13b09488c0d787576cf20dc0b93
+9920168fd7c2c8001e30465b2cb146e19a9c4b0b737f164fec9327331d770ba123dbdc018a8dfc766653d05662731984d8a07993a258a0098eb170e4357688b1
+6575770931e27a408609e36c2c9cbbc46921620d499f0c8c6a5a19ed9108f232b711847c1bb139b8e3b418b5adba8d8f4c24dc15885ac8f73135c27815cd048a
+6c2efb28a27ac0f791086d247bf364a8e33a5c40a6279832a733c29cdb6c6e24b05e2de9d7405eec693fa0f3c84426821cda7cee23c674649b1d06218aa6366c
+8fc4a18efd881f428922e7261336f80133ef10790e7940f1d674df21d848f7e96a701b9455a7b42a107965965872791533a37e7b733a4658490d08bfa1e71189
+4f15f73559f7ff5b5907217df5ed53cbaa2eaaa0371362bda3f6d6647c1b6e5dbc03968cc8c5d7ee369ac53731dc2e9b0decbd74bf976ef77f2fdddbeee7772f
+d82b8d06f9965bc574abae36eed1d67dfb9850da13738af7b9daba73e84ca32e0c4a3bf5cc8ab3e7b8690887f24e86090cdc2441cac64998f88488b017a229ec
+ef8bae7432e10bd713ee4c19876dbf1ab6fa96783a8b0ed8287d5c2d16e5a3692a1e1c89d578c1cfc6e15143a4e84a75f50896b9576c27ea51794940dabe0d09
+6d329344d942a2ba1c9441520fe610340b09b5b277c2a26e615193ee97a9da6001d4b2acc0d6c9810d57c3f53d30012378a242148f649ed2542fb3ab92f92e33
+bd2d984605c03e625901ab4cd725d7adcb93ab4b4bed0c99364868e566925091513d8c87688417d52947cf42e36d735d5fa5d4a02743a1e683d25ad1a8d6fe8d
+c579730d76ebda40635d2968ec1c37dc4ad9879219a269c31dc3633f1c4653a81d2eb7bc884ee0ddd95024e90d7f1e6599265cb4110fd3802bd149d520220227
+0e2551c395cbcfd24063a5218a5bb104827061c9d541562e1a3948ba99643c1ee3a1d0d3ae8dc848a7a7a0f0a95658af2af3f383a5259b41ba7be1e8d819d059
+720b4189f9d5a20ce0887078fb534ca33922f03a3313b255fdad35a685eceaef13550da5e3884e43b4e828ba98a77025e5191d7596c5403b5bac1902aa8564d1
+080713d960f5a01add34eb1a2987ad5df7742319394d34573dd35015d935ed2a66ccb06c036bb13c5f93d7582d430c9aa677f854bad725b7bed4bab57d42d625
+20e059fc2c5df70c0d41a3b69acca026196fcab0d4ecc5a8d93b960b3c85da599a84a6fa95a5dbb5b8653dc23a1d0c9eabf383dd7ad5c2d078b9af549156df3d
+f44f136c700fc4a30d2f81675470954af8f09020d810f5d49e24950db845ee8bc5ad0147ce2c210df741c16f7a41c90f72859adfc97965af90abf9cd72aee9fb
+e562c72f16daadd243682c228c8a7efacda50bafa2e87cf1e5458d6f7c7d89966fdb2e0d599467eaeb4a5e11575f5f8aa5ed5f5f1c02a2f3a052ead6cbf55625
+572f37bb39afddaae5ea41a5956b57826abbdb0efc5abdfbd0758e14d86b9603afd2a9e52ac520c8799582a45fabe7aa5ea9d4f4aacd5ac76b3e5c6c6360e5a9
+7c2c6201e155bc76ff010000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f
+7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be
+9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980
+ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5b
+babac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c0200001300000000000000000000000000000000005b436f6e74656e
+745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f
+2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000190200007468656d652f7468656d652f74
+68656d654d616e616765722e786d6c504b01022d0014000600080000002100aa5225dfc60600008b1a00001600000000000000000000000000d6020000746865
+6d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b0100002700000000000000000000000000d00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000cb0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 1;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 6;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 7;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 8;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 9;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal Indent;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footnote text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 header;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footer;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index heading;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 table of figures;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 envelope address;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 envelope return;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footnote reference;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation reference;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 line number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 page number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 endnote reference;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 endnote text;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 table of authorities;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 macro;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 toa heading;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 3;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 3;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 3;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Closing;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Signature;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Message Header;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Note Heading;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent 3;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Block Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Hyperlink;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 FollowedHyperlink;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Document Map;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Plain Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 E-mail Signature;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Top of Form;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Bottom of Form;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal (Web);\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Acronym;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Address;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Cite;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Code;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Definition;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Keyboard;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Preformatted;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Sample;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Typewriter;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Variable;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal Table;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation subject;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 No List;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Simple 1;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Simple 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Simple 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Classic 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Classic 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Classic 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Classic 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Colorful 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Colorful 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Colorful 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 3;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 6;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 7;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 8;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 6;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 7;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 8;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table 3D effects 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table 3D effects 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table 3D effects 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Contemporary;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Elegant;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Professional;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Subtle 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Subtle 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Web 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Web 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Web 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Balloon Text;\lsdpriority39 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Theme;\lsdsemihidden1 \lsdlocked0 Placeholder Text;
+\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;
+\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;
+\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;
+\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;
+\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;
+\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;
+\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;
+\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;
+\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;
+\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;
+\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e500000000000000000000000050c6
+4994e6f1d101feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/VfrCompiler_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/VfrCompiler_Utility_Man_Page.rtf
new file mode 100644
index 000000000..2b056f8f2
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/VfrCompiler_Utility_Man_Page.rtf
@@ -0,0 +1,353 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}
+{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
+{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}
+{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}
+{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
+{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\f259\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}
+{\f260\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f262\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\f263\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\f264\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f265\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}{\f266\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}
+{\f267\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f269\fbidi \fswiss\fcharset238\fprq2 Arial CE;}{\f270\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;}{\f272\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}
+{\f273\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f274\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f275\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);}{\f276\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}
+{\f277\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f279\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}{\f280\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}
+{\f282\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f283\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}{\f284\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}
+{\f285\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f286\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}{\f287\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}
+{\f391\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f599\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f600\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f602\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}
+{\f603\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f606\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f607\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}
+{\f629\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\f630\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}{\f632\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}
+{\f633\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}{\f636\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\f637\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\f649\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f650\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}{\f652\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}
+{\f653\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f654\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}{\f655\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}
+{\f656\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f657\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}{\f658\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}
+{\f669\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f670\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f672\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}{\f673\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}
+{\f676\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f677\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f689\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f690\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f693\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f696\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f697\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1391\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
+{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
+{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\chyperlink\ctint255\cshade255\red0\green0\blue255;\red8\green96\blue168;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext11 \ssemihidden \sunhideused
+Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\ai\af0\afs28 \ltrch\fcs0
+\b\i\fs28\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\*\cs17 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf17 \sbasedon10 \sunhideused \styrsid1204842 Hyperlink;}{
+\s18\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0 \fs16\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033
+\sbasedon0 \snext18 \slink19 \ssemihidden \sunhideused \styrsid3956845 Balloon Text;}{\*\cs19 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \f39\fs16 \sbasedon10 \slink18 \slocked \ssemihidden \styrsid3956845 Balloon Text Char;}{\*\cs20 \additive
+\rtlch\fcs1 \af0\afs16 \ltrch\fcs0 \fs16 \sbasedon10 \ssemihidden \sunhideused \styrsid6635418 annotation reference;}{\s21\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0
+\fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext21 \slink22 \ssemihidden \sunhideused \styrsid6635418 annotation text;}{\*\cs22 \additive \rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f43\fs20
+\sbasedon10 \slink21 \slocked \ssemihidden \styrsid6635418 Comment Text Char;}{\s23\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0
+\b\fs20\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon21 \snext21 \slink24 \ssemihidden \sunhideused \styrsid6635418 annotation subject;}{\*\cs24 \additive \rtlch\fcs1 \ab\af0\afs20 \ltrch\fcs0 \b\f43\fs20
+\sbasedon22 \slink23 \slocked \ssemihidden \styrsid6635418 Comment Subject Char;}{\s25\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0
+\fs16\cf1\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext25 \spriority0 \styrsid4289583 CellBodyLeft;}{\*\cs26 \additive \b\f2\cf13 \spriority0 \styrsid4289583 CodeCharacter;}{\*\ts27\tsrowd\trbrdrt
+\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon11 \snext27 \spriority59 \styrsid4289583 Table Grid;}}{\*\revtbl {Unknown;}{ydong10;}{Zhu, Yonghong;}}{\*\rsidtbl \rsid83254\rsid1204842\rsid2570438\rsid3809922\rsid3956845\rsid4289583\rsid4999604\rsid5008786\rsid5715948\rsid5911148\rsid6448922\rsid6635418\rsid7634258\rsid8089322
+\rsid8600807\rsid9190531\rsid9200893\rsid9379003\rsid10094212\rsid11500129\rsid11950970\rsid12476259\rsid12931970\rsid14109446\rsid14166490}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440
+\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}{\creatim\yr2010\mo10\dy6\hr16\min18}{\revtim\yr2016\mo8\dy9\hr10\min35}{\version16}{\edmins109}{\nofpages3}{\nofwords699}{\nofchars3988}{\nofcharsws4678}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.
+microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot14166490 \donotshowmarkup1\fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1
+\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang
+{\pntxta \hich )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}
+{\pntxta \hich )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0
+\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf18\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 VfrCompile.exe \hich\f43 \endash \loch\f43 Compile the framework VFR and UEFI VFR file to UEFI IFR opcode table and binary.
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf18\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Synopsis
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 VfrCompile}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid11950970\delrsid11950970 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11950970 \hich\af43\dbch\af31505\loch\f43 [-o <OutputDir>] [-b] [-l] [-n] [-c]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11950970 \hich\af43\dbch\af31505\loch\f43 <}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 VfrFile}{\rtlch\fcs1
+\ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11950970 \hich\af43\dbch\af31505\loch\f43 >}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14166490
+\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid9190531 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11500129 \hich\af43\dbch\af31505\loch\f43 VfrCompile.exe \hich\f43
+\endash \loch\f43 h}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\langfenp2052\insrsid11500129\charrsid8089322
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11500129
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf18\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 VfrCompile }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43 parses}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490
+\hich\af43\dbch\af31505\loch\f43 the preprocessed UEFI and Framework VFR file to generate UEFI IFR opcode table, Binary Data and IFR listing file. This tool }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43
+was}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 based on the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43 ANTLR}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\super\insrsid9200893\charrsid12476259 \hich\af43\dbch\af31505\loch\f43 *}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1204842 \hich\af43\dbch\af31505\loch\f43 (Another Tool for Language Recognition)}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43
+parser to implement VFR syntax parser. The generated UEFI IFR opcode table is stored in autogen VfrFileNameBin.c}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43 . }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43 T}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43
+he global data variable}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6635418 \hich\af43\dbch\af31505\loch\f43 , named}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 VfrFileNameBin}{\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 ,}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43
+contains the}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 IFR opcode table. }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43
+The generated file will be placed into the output directory sp\hich\af43\dbch\af31505\loch\f43 ecified by -o option. If output directory is not specified, the generate file will be placed in current }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid6635418 \hich\af43\dbch\af31505\loch\f43 directory. The}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43 d}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490
+\hich\af43\dbch\af31505\loch\f43 river source code always uses this global data to register HII form package}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 and show}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490
+\hich\af43\dbch\af31505\loch\f43 this page. The generated UEFI IFR opcode binary f\hich\af43\dbch\af31505\loch\f43 ile is VfrFileName.hpk, which can also be registered into HII Form package. The generated IFR listing file is VfrFileName.lst, which lists
+}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43 the }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 IFR opcode for each VFR statement for debug purpose.
+
+\par \hich\af43\dbch\af31505\loch\f43 This }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43 is not a }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6635418 \hich\af43\dbch\af31505\loch\f43 standalone. }{
+\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 It is used together with the comp\hich\af43\dbch\af31505\loch\f43 iler preprocessor, }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893
+\hich\af43\dbch\af31505\loch\f43 and }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 EDKII trim too}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893 \hich\af43\dbch\af31505\loch\f43
+. The VFR file is first preprocessed by the c}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm656059242\insrsid3809922 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893
+\hich\af43\dbch\af31505\loch\f43 Compiler and the output file is then trimmed to remove the unused definitions}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1204842 \hich\af43\dbch\af31505\loch\f43 before being compiled by the VfrCompile tool to
+}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel1\revdttmdel656059243\insrsid1204842\delrsid3809922 \hich\af43\dbch\af31505\loch\f43 generated}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\revauth1\revdttm656059243\insrsid3809922 \hich\af43\dbch\af31505\loch\f43 generate}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1204842 \hich\af43\dbch\af31505\loch\f43 the UEFI IFR opcode.}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\revauth1\revdttm656059242\insrsid3809922 \hich\af43\dbch\af31505\loch\f43 So the C\hich\af43\dbch\af31505\loch\f43 style}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm656059243\insrsid3809922
+\hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm656059246\insrsid5008786\charrsid5008786 \hich\af43\dbch\af31505\loch\f43 preprocessor directives }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\revised\revauth1\revdttm656059247\insrsid5008786 \hich\af43\dbch\af31505\loch\f43 are}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm656059243\insrsid3809922 \hich\af43\dbch\af31505\loch\f43
+ supported in VFR file, such as #define, #ifdef}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm656059247\insrsid5008786 .}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\deleted\fs18\cf1\revauthdel1\revdttmdel656059243\insrsid1204842\delrsid3809922 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9200893
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf18\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Options
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs18
+\ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 VfrFile
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 The input file is }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid1204842 \hich\af43\dbch\af31505\loch\f43 a }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 UEFI or Framework VFR file, which has been preprocessed by }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid1204842 \hich\af43\dbch\af31505\loch\f43 a }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Compiler and}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1204842
+\hich\af43\dbch\af31505\loch\f43 the}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Trim tool. The generated output file is VfrFileName.c.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 -o DIR, --output-directory DIR
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 All generated files }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid1204842 \hich\af43\dbch\af31505\loch\f43 are}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43
+ placed into output directory. If this option is not specified, the default output directory is current directory.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 -b, --create-ifr-package
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Create}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1204842
+\hich\af43\dbch\af31505\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 an UEFI IFR Binary HII pack file. The generated file n\hich\af43\dbch\af31505\loch\f43 ame is VfrFileName.hpk.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 -l create an output IFR listing file
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Create}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1204842
+\hich\af43\dbch\af31505\loch\f43 s}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 an output IFR listing file (VfrFileName.lst) to list each IFR opcode for each VFR}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid1204842 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 statement.}{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\cf1\insrsid14166490
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 -n, --no-pre-processing
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Do not preprocess}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid2570438 \hich\af43\dbch\af31505\loch\f43 t}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1204842 \hich\af43\dbch\af31505\loch\f43 he}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43
+ input vfr file. The input VFR file has been pro\hich\af43\dbch\af31505\loch\f43 cessed. If this option is not specified, the default behavior is same to set this option.
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid83254 \hich\af43\dbch\af31505\loch\f43 Selecting this option disables preprocessing of VFR files. }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid2570438
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 -h, --help
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Print version and usage of this program and exit.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid12931970 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\insrsid12931970\charrsid6448922 \hich\af43\dbch\af31505\loch\f43 -s, --string-db
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid12931970 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\insrsid12931970\charrsid6448922 \hich\af43\dbch\af31505\loch\f43 Input uni string package file.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid12931970 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\insrsid12931970\charrsid6448922 \hich\af43\dbch\af31505\loch\f43 -g, --guid
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid12931970 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\insrsid12931970\charrsid6448922 \hich\af43\dbch\af31505\loch\f43
+Override class guid input, format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf6\insrsid12931970\charrsid10094212
+\par }\pard \ltrpar\ql \fi360\li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid12931970
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0\pararsid4289583 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf18\lang1033\langfe2052\langfenp2052\insrsid4289583 {\*\bkmkstart OLE_LINK10}{\*\bkmkstart OLE_LINK11}
+{\*\bkmkstart OLE_LINK3}{\*\bkmkstart OLE_LINK4}{\*\bkmkstart OLE_LINK5}{\*\bkmkstart OLE_LINK6}{\*\bkmkstart OLE_LINK9}{\*\bkmkstart OLE_LINK14}\hich\af43\dbch\af31505\loch\f43 Status codes returned}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf18\lang1033\langfe2052\langfenp2052\insrsid4289583\charrsid4999604
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts27\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\pard\plain \ltrpar\s25\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts27 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs26\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid4289583
+{\*\bkmkend OLE_LINK10}{\*\bkmkend OLE_LINK11}0\cell }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid4289583 \hich\af43\dbch\af13\loch\f43 The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \kerning2\insrsid4289583 \cell }\pard\plain \ltrpar
+\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1
+\af37\afs20 \ltrch\fcs0 \fs20\insrsid4289583 \trowd \irow0\irowband0\ltrrow\ts27\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row \ltrrow}\pard\plain \ltrpar\s25\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts27 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs26\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid4289583
+\hich\af2\dbch\af13\loch\f2 Nonzero}{\rtlch\fcs1 \af41\afs19 \ltrch\fcs0 \cs26\f41\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid4289583\charrsid8600807 \cell }\pard \ltrpar\s25\ql \li0\ri20\sb60\sa60\sl-200\slmult0
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid11500129\yts27 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid4289583 \hich\af43\dbch\af13\loch\f43 The action failed.\cell
+}\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid4289583 \trowd \irow1\irowband1\lastrow \ltrrow\ts27\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10
+\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8820\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5911148\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2970\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf18\insrsid14166490 {\*\bkmkend OLE_LINK3}{\*\bkmkend OLE_LINK4}{\*\bkmkend OLE_LINK5}
+{\*\bkmkend OLE_LINK6}{\*\bkmkend OLE_LINK9}{\*\bkmkend OLE_LINK14}\hich\af43\dbch\af31505\loch\f43 Example
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 1. Parse the preprocessed UEFI VFR file (Vfr_Uefi.iii) to generate the UEFI IFR opcode table in autogen C file (Vfr_Uefi.c).
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 VfrCompile -n Vfr_Uefi.iii
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 2. Parse the preprocessed UEFI VFR file (Vfr_Uefi.iii) to generate the UEFI IFR opcode table in autoge\hich\af43\dbch\af31505\loch\f43
+n C file (Vfr_Uefi.c) and UEFI IFR Binary File (Vfr_Uefi.hpk)
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 VfrCompile -n -b Vfr_Uefi.iii
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43
+3. Parse the preprocessed UEFI VFR file (Vfr_Uefi.iii) to generate the UEFI IFR opcode table in autogen C file (Vfr_Uefi.c) and UEFI IFR Binary File (Vfr_Uefi.hpk) \hich\af43\dbch\af31505\loch\f43 and IFR listing file (Vfr_Uefi.lst)
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 VfrCompile -n -b -l Vfr_Uefi.iii
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 4. Parse the preprocessed Framework VFR file (Vfr_Framework.iii) to generate the UEFI IFR opcode table in autogen C file (Vfr_Framework.c).
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 VfrCompile -n -c Vfr_Framework.iii
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid14109446 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\insrsid14109446\charrsid6448922 \hich\af43\dbch\af31505\loch\f43 5. Parse t\hich\af43\dbch\af31505\loch\f43
+he preprocessed UEFI VFR file (Vfr_Uefi.iii) to generate the UEFI IFR opcode table in autogen C file (Vfr_Uefi.c), also base on the string token number to get efi varstore name from the string binary file (Vfr_Uefi.hpk).
+\par }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\insrsid14109446\charrsid6448922 \hich\af43\dbch\af31505\loch\f43 VfrCompile -n \hich\f43 \endash \loch\f43 s Vfr_Uefi.hpk Vfr_U\hich\af43\dbch\af31505\loch\f43 efi.iii
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\insrsid14109446\charrsid6448922 \hich\af43\dbch\af31505\loch\f43
+6. Parse the preprocessed UEFI VFR file (Vfr_Uefi.iii) to generate the UEFI IFR opcode table in autogen C file (Vfr_Uefi.c), also override class guid with the input one.
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\insrsid14109446\charrsid6448922 \hich\af43\dbch\af31505\loch\f43 VfrCompile -n \hich\f43 \endash \loch\f43
+g C153B68D-EBFC-488E-B110-662867745B87 Vfr_Uefi.iii}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\insrsid14109446\charrsid7634258
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf18\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 No known }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1204842 \hich\af43\dbch\af31505\loch\f43 issues}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 .
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth2\revdttm1195920035\insrsid9379003\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-\hich\af43\dbch\af31505\loch\f43 devel
+\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel2\revdttmdel1195920035\insrsid14166490\delrsid9379003 \hich\af43\dbch\af31505\loch\f43
+edk2-buildtools-devel@lists.sourceforge.net}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14166490
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf18\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf18\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 See also
+\par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 None
+\par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf18\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 2007 - }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid1204842 \hich\af43\dbch\af31505\loch\f43 201}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid12476259 \hich\af43\dbch\af31505\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 , Intel Corporation. All rights reserved.
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licensed and made available
+\par \hich\af43\dbch\af31505\loch\f43 under the terms and conditions of the BSD License which accompanies this
+\par \hich\af43\dbch\af31505\loch\f43 distribution. The full text of the license may be found at
+\par \hich\af43\dbch\af31505\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par \hich\af43\dbch\af31505\loch\f43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+\par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14166490 \hich\af43\dbch\af31505\loch\f43 WITH\hich\af43\dbch\af31505\loch\f43
+OUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid14166490
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb
+44f95d843b5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a
+6409fb44d08741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c
+3d9058edf2c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db0256
+5e85f3b9660d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276
+b9f7dec44b7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8
+c33585b5fb9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e
+51440ca2e0088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95
+b21be5ceaf8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff
+6dce591a26ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec6
+9ffb9e65d028d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239
+b75a5bb1e6345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a449
+59d366ad93b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e8
+2db8df9f30254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468
+656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4
+350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d2624
+52282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe5141
+73d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c020000130000000000000000
+0000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000
+000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c0000000000000000000000000019
+0200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b00001600000000
+000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b01000027
+00000000000000000000000000a00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009b0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e500000000000000000000000000a0
+31a5e6f1d101feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/UserManuals/VolInfo_Utility_Man_Page.rtf b/roms/edk2/BaseTools/UserManuals/VolInfo_Utility_Man_Page.rtf
new file mode 100644
index 000000000..88c6a84b4
--- /dev/null
+++ b/roms/edk2/BaseTools/UserManuals/VolInfo_Utility_Man_Page.rtf
@@ -0,0 +1,312 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New{\*\falt Courier New};}{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}
+{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}
+{\f43\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}{\f113\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}
+{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}
+{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri{\*\falt Century Gothic};}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times};}
+{\f259\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\f260\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}{\f262\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}
+{\f263\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}{\f264\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\f265\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\f266\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\f267\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}{\f279\fbidi \fmodern\fcharset238\fprq1 Courier New CE{\*\falt Courier New};}
+{\f280\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr{\*\falt Courier New};}{\f282\fbidi \fmodern\fcharset161\fprq1 Courier New Greek{\*\falt Courier New};}{\f283\fbidi \fmodern\fcharset162\fprq1 Courier New Tur{\*\falt Courier New};}
+{\f284\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew){\*\falt Courier New};}{\f285\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic){\*\falt Courier New};}{\f286\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic{\*\falt Courier New};}
+{\f287\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese){\*\falt Courier New};}{\f391\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\f599\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}
+{\f600\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f602\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f603\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f606\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}
+{\f607\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f629\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\f630\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\f632\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\f633\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}{\f636\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}
+{\f637\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}{\f649\fbidi \fswiss\fcharset238\fprq2 Tahoma CE{\*\falt Times New Roman};}{\f650\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr{\*\falt Times New Roman};}
+{\f652\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek{\*\falt Times New Roman};}{\f653\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur{\*\falt Times New Roman};}{\f654\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew){\*\falt Times New Roman};}
+{\f655\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic){\*\falt Times New Roman};}{\f656\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic{\*\falt Times New Roman};}{\f657\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese){\*\falt Times New Roman};}
+{\f658\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai){\*\falt Times New Roman};}{\f669\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f670\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f672\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}
+{\f673\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}{\f676\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f677\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f689\fbidi \fswiss\fcharset238\fprq2 Verdana CE{\*\falt Verdana};}
+{\f690\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr{\*\falt Verdana};}{\f692\fbidi \fswiss\fcharset161\fprq2 Verdana Greek{\*\falt Verdana};}{\f693\fbidi \fswiss\fcharset162\fprq2 Verdana Tur{\*\falt Verdana};}
+{\f696\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic{\*\falt Verdana};}{\f697\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese){\*\falt Verdana};}{\f1391\fbidi \fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbmajor\f31520\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
+{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
+{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}
+{\fdbminor\f31560\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE{\*\falt Century Gothic};}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr{\*\falt Century Gothic};}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek{\*\falt Century Gothic};}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur{\*\falt Century Gothic};}
+{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic{\*\falt Century Gothic};}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese){\*\falt Century Gothic};}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times};}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red8\green96\blue168;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\s1\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat heading 1;}{\s2\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025
+\ltrch\fcs0 \fs24\lang1033\langfe1033\loch\f43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink16 \sqformat heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext11 \ssemihidden \sunhideused
+Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs32 \ltrch\fcs0 \b\fs32\kerning32\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\ai\af0\afs28 \ltrch\fcs0
+\b\i\fs28\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\s17\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs16\alang1025 \ltrch\fcs0
+\fs16\lang1033\langfe1033\loch\f39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext17 \slink18 \ssemihidden \sunhideused \styrsid11871115 Balloon Text;}{\*\cs18 \additive \rtlch\fcs1 \af39\afs16 \ltrch\fcs0 \f39\fs16
+\sbasedon10 \slink17 \slocked \ssemihidden \styrsid11871115 Balloon Text Char;}{\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\itap0 \rtlch\fcs1 \af0\afs16\alang1025 \ltrch\fcs0
+\fs16\cf1\lang1033\langfe1033\loch\f43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext19 \spriority0 \styrsid11798724 CellBodyLeft;}{\*\cs20 \additive \b\f2\cf13 \spriority0 \styrsid11798724 CodeCharacter;}{\*\ts21\tsrowd\trbrdrt
+\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
+\sbasedon11 \snext21 \spriority59 \styrsid11798724 Table Grid;}}{\*\revtbl {Unknown;}{Zhu, Yonghong;}}{\*\rsidtbl \rsid539498\rsid1389978\rsid4999604\rsid5911148\rsid8216522\rsid8600807\rsid9242764\rsid11798724\rsid11871115\rsid12198464\rsid13857151\rsid14511453\rsid14812620}{\mmathPr
+\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator Zhu, Yonghong}{\creatim\yr2010\mo11\dy8\hr15\min32}{\revtim\yr2016\mo8\dy9\hr10\min35}{\version9}{\edmins18}
+{\nofpages2}{\nofwords437}{\nofchars2492}{\nofcharsws2924}{\vern57441}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120
+\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot11871115 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang
+{\pntxta \hich .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \hich .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \hich )}}{\*\pnseclvl5
+\pndec\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \hich (}{\pntxta \hich )}}\pard\plain \ltrpar\s2\ql \li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar
+\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 Name
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 VolInfo \hich\f43 \endash \loch\f43 Displays the contents of a firmware volume
+\par }\pard\plain \ltrpar\s2\ql \li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 Synopsis}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid14511453
+\par }\pard\plain \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\cufi200\pararsid14812620 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {
+\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14812620 \hich\af43\dbch\af31505\loch\f43 VolInfo [}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14812620 \hich\af43\dbch\af31505\loch\f43
+-x <XrefFile>}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14812620 \hich\af43\dbch\af31505\loch\f43 ]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14812620 \hich\af43\dbch\af31505\loch\f43
+ [--offset <Offset>]}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14812620 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14812620
+\hich\af43\dbch\af31505\loch\f43 <InputFile>}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\langfenp2052\insrsid14812620\charrsid14812620
+\par }\pard\plain \ltrpar\s2\ql \li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 Description
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 VolInfo \hich\af43\dbch\af31505\loch\f43 displays the contents of a firmware volume residing in a file for informational purposes.
+\par }\pard\plain \ltrpar\s2\ql \li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 Options}{\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0
+\b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid14511453
+\par }\pard\plain \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid11798724 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11798724\charrsid12198464 {\*\bkmkstart OLE_LINK12}{\*\bkmkstart OLE_LINK13}\hich\af43\dbch\af31505\loch\f43 If no options ar}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11798724
+\hich\af43\dbch\af31505\loch\f43 e specified, tool prints usage.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\langfenp2052\insrsid11798724\charrsid11798724 {\*\bkmkend OLE_LINK12}{\*\bkmkend OLE_LINK13}
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 -x xref, --xref xref
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 xref is the path to a file-guid cross reference f
+\hich\af43\dbch\af31505\loch\f43 ile. This file }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11871115 \hich\af43\dbch\af31505\loch\f43 is}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43
+ used to provide human readable names to the GUIDs found in the firmware volume.
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 --offset offset
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43
+offset is the offset within the file to start processing the firmware volume. This }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11871115 \hich\af43\dbch\af31505\loch\f43 is used}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453
+\hich\af43\dbch\af31505\loch\f43 if the specified disk file is a firmware device im\hich\af43\dbch\af31505\loch\f43 age which generally }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11871115 \hich\af43\dbch\af31505\loch\f43 contains}{
+\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 multiple firmware volume}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11871115 \hich\af43\dbch\af31505\loch\f43 s}{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43
+. The offset can be specified as a decimal number or a hexadecimal number (for example, 0x1ffe). If a 'k' suffix is attached to the number, then the number will be multiplied by 1024 (0x400) to turn t\hich\af43\dbch\af31505\loch\f43
+he number into kilobytes.}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14511453
+\par }\pard\plain \ltrpar\s2\ql \li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx0\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0\pararsid11798724 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\lang1033\langfe2052\langfenp2052\insrsid11798724 \hich\af43\dbch\af31505\loch\f43 Status codes returned}{
+\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid11798724\charrsid11798724 {\*\bkmkstart OLE_LINK7}{\*\bkmkstart OLE_LINK8}
+\par \ltrrow}\trowd \irow0\irowband0\ltrrow\ts21\trleft426\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8286\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid11798724\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind534\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2436\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\pard\plain \ltrpar\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts21 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0
+\cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid11798724\charrsid8600807 \hich\af2\dbch\af13\loch\f2 STATUS_SUCCESS}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11798724 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18
+\ltrch\fcs0 \cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid11798724\charrsid4999604 \tab }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid11798724 0\cell }{\rtlch\fcs1
+\af0 \ltrch\fcs0 \insrsid11798724 \hich\af43\dbch\af13\loch\f43 The action was completed as requested.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \kerning2\insrsid11798724 \cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0
+\fs20\insrsid11798724 \trowd \irow0\irowband0\ltrrow\ts21\trleft426\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8286\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid11798724\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind534\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2436\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row \ltrrow}\pard\plain \ltrpar\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid5911148\yts21 \rtlch\fcs1
+\af0\afs16\alang1025 \ltrch\fcs0 \fs16\cf1\lang1033\langfe1033\loch\af43\hich\af43\dbch\af13\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs20\b\f2\fs18\cf13\kerning2\insrsid11798724\charrsid8600807 \hich\af2\dbch\af13\loch\f2
+STATUS_ERROR}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11798724 \hich\af43\dbch\af13\loch\f43 }{\rtlch\fcs1 \ab\af2\afs18 \ltrch\fcs0 \cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid11798724\charrsid4999604 \tab \tab }{\rtlch\fcs1
+\ab\af2\afs18 \ltrch\fcs0 \cs20\b\f2\fs18\cf13\lang1033\langfe2052\kerning2\langfenp2052\insrsid11798724 \hich\af2\dbch\af13\loch\f2 2}{\rtlch\fcs1 \af41\afs19 \ltrch\fcs0
+\cs20\f41\fs19\cf0\lang1033\langfe2052\langfenp2052\insrsid11798724\charrsid8600807 \cell }\pard \ltrpar\s19\ql \li0\ri20\sb60\sa60\sl-200\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin20\lin0\pararsid8216522\yts21 {
+\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\kerning2\langfenp2052\insrsid11798724 \hich\af43\dbch\af13\loch\f43 The action failed.\cell }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1
+\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af37\afs20 \ltrch\fcs0
+\fs20\insrsid11798724 \trowd \irow1\irowband1\lastrow \ltrrow\ts21\trleft426\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
+\trftsWidth3\trwWidth8286\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid11798724\tbllkhdrrows\tbllkhdrcols\tbllknocolband\tblind534\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
+\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2436\clshdrawnil\clhidemark \cellx2862\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
+\cltxlrtb\clftsWidth3\clwWidth5850\clshdrawnil\clhidemark \cellx8712\row }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid11798724
+{\*\bkmkend OLE_LINK7}{\*\bkmkend OLE_LINK8}
+\par }\pard\plain \ltrpar\s2\ql \li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 Examples
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 Assume that $(WORKSPACE) is /home/joeuser/src/edk2 an\hich\af43\dbch\af31505\loch\f43 d the firmware volumes have been built into Build/EdkUnix/DEBUG_UNIXGCC/FV}{\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11871115 \hich\af43\dbch\af31505\loch\f43 :}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 ~/src/edk2$}{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 VolInfo Build/EdkUnix/DEBUG_UNIXGCC/FV/FVMAIN.fv}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f0\insrsid14511453
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43
+Assuming that a firmware device image had been built and that the firmware volume of interest resided at byte offset 6\hich\af43\dbch\af31505\loch\f43 5536 of that file, then the following command would show that firmware volume}{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11871115 \hich\af43\dbch\af31505\loch\f43 :}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 ~/src/edk2$ }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 VolInfo --offset 65536 path/to/FV/EDKUNIX.fd}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14511453
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 Or, equivalently,
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 ~/src/edk2$ }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 VolInfo --offset 64k path/to/FV/EDKUNIX.fd}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14511453
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 Or, equivalently,
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 ~/src/edk2$ }{\rtlch\fcs1 \ab\af43\afs18 \ltrch\fcs0
+\b\fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 VolInfo --offs\hich\af43\dbch\af31505\loch\f43 et 0x10000 path/to/FV/EDKUNIX.fd}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14511453
+\par }\pard\plain \ltrpar\s2\ql \li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 GuidedSectionTools.txt
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 This (optional) file is built as part of the edk2 build process. It }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11871115 \hich\af43\dbch\af31505\loch\f43 is}{\rtlch\fcs1
+\af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 generated in the FV directory alongside the firmware volume file. The VolInfo utility }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11871115
+\hich\af43\dbch\af31505\loch\f43 looks}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 for this file alongside the input fi\hich\af43\dbch\af31505\loch\f43 rmware volume file, and if found it will read }{
+\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11871115 \hich\af43\dbch\af31505\loch\f43 its}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 contents to define tools }{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid11871115 \hich\af43\dbch\af31505\loch\f43 used}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 for extracting GUID defined firmware volume sections.
+\par \hich\af43\dbch\af31505\loch\f43 Each line contains three tokens separated by whitespace. The three tokens are (in order): 1) the GUID associated with the \hich\af43\dbch\af31505\loch\f43
+tool, 2) a name for the tool, and 3) the path to the tool executable. An example of a possible line from the file:
+\par }\pard \ltrpar\ql \li720\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin720\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 a31280ad-481e-41b6-95e8-127f4c984779 TIANO /path/to/TianoCompress
+\par }\pard\plain \ltrpar\s2\ql \li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 GuidedSectionTools.txt
+\par }\pard\plain \ltrpar\s2\ql \li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 Bugs
+\par }\pard\plain \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 No known }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11871115 \hich\af43\dbch\af31505\loch\f43 issues}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453
+\par \hich\af43\dbch\af31505\loch\f43 Report bugs to }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm1195920035\insrsid9242764\charrsid14420013 \hich\af43\dbch\af31505\loch\f43 edk2-\hich\af43\dbch\af31505\loch\f43 devel
+\hich\af43\dbch\af31505\loch\f43 @lists.01.\hich\af43\dbch\af31505\loch\f43 org}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \deleted\fs18\cf1\revauthdel1\revdttmdel1195920035\insrsid14511453\delrsid9242764 \hich\af43\dbch\af31505\loch\f43 edk2-bui
+\hich\af43\dbch\af31505\loch\f43 ldtools-devel@lists.sourceforge.net}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid14511453
+\par }\pard \ltrpar\ql \li0\ri0\sb400\sa60\sl-340\slmult0\nowidctlpar\tx1440\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 Files
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 GuidedSectionTools.txt
+\par }\pard\plain \ltrpar\s2\ql \li0\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx360\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0
+\fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af43\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 License
+\par }\pard\plain \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af43\hich\af43\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 Copyright (c) 1999 - }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid11871115 \hich\af43\dbch\af31505\loch\f43 201}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13857151 \hich\af43\dbch\af31505\loch\f43 1}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 , Intel Corporation. All rights reserved.
+\par
+\par \hich\af43\dbch\af31505\loch\f43 This program and the accompanying materials are licensed and made available under the terms andconditions of the B\hich\af43\dbch\af31505\loch\f43
+SD License which accompanies this distribution. The full text of the license may befound at:}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453\delrsid14511453 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0
+\fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43 http://opensource.org/licenses/bsd-license.php
+\par
+\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0\pararsid13857151 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453 \hich\af43\dbch\af31505\loch\f43
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES}{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid13857151 \hich\af43\dbch\af31505\loch\f43 }{\rtlch\fcs1 \af43\afs18
+\ltrch\fcs0 \fs18\cf1\insrsid13857151 \hich\af43\dbch\af31505\loch\f43 OR REPRESENTATIONS OF ANY\hich\af43\dbch\af31505\loch\f43 KIND, EITHER EXPRESS OR IMPLIED.
+\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid14511453\charrsid13857151
+\par }{\rtlch\fcs1 \af43\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14511453
+\par }\pard \ltrpar\ql \li360\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af0 \ltrch\fcs0 \f0\lang1033\langfe2052\langfenp2052\insrsid14511453
+\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
+9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
+5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
+b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
+0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
+a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
+c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
+0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
+a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
+6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
+4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
+4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f
+7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
+615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
+79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
+5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
+999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
+699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
+8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
+0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
+9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
+15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
+3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
+32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
+f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
+e877f0034e16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb
+44f95d843b5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a
+6409fb44d08741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c
+3d9058edf2c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db0256
+5e85f3b9660d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276
+b9f7dec44b7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8
+c33585b5fb9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e
+51440ca2e0088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95
+b21be5ceaf8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff
+6dce591a26ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec6
+9ffb9e65d028d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239
+b75a5bb1e6345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a449
+59d366ad93b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e8
+2db8df9f30254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468
+656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4
+350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d2624
+52282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe5141
+73d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c020000130000000000000000
+0000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000
+000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c0000000000000000000000000019
+0200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b00001600000000
+000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b01000027
+00000000000000000000000000a00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009b0a00000000}
+{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
+617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
+6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
+656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
+{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdlocked0 heading 1;\lsdqformat1 \lsdlocked0 heading 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;
+\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;
+\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
+\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdpriority59 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;
+\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;
+\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;
+\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
+\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;
+\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;
+\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;
+\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;
+\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;
+\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;
+\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
+\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
+\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
+\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
+\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
+\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
+\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
+\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
+\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
+\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
+\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
+\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
+\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
+\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
+\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
+\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
+\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
+\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
+\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
+\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
+\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
+\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
+4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
+d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e5000000000000000000000000e029
+ccafe6f1d101feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file
diff --git a/roms/edk2/BaseTools/basetools_calling_path_env.yaml b/roms/edk2/BaseTools/basetools_calling_path_env.yaml
new file mode 100644
index 000000000..f33f6ea38
--- /dev/null
+++ b/roms/edk2/BaseTools/basetools_calling_path_env.yaml
@@ -0,0 +1,11 @@
+## @file
+# Set shell variable BASE_TOOL_PATH to this folder
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "global",
+ "flags": ["set_shell_var"],
+ "var_name": "BASE_TOOLS_PATH"
+}
diff --git a/roms/edk2/BaseTools/basetools_path_env.yaml b/roms/edk2/BaseTools/basetools_path_env.yaml
new file mode 100644
index 000000000..6bdddcd09
--- /dev/null
+++ b/roms/edk2/BaseTools/basetools_path_env.yaml
@@ -0,0 +1,11 @@
+## @file
+# Set shell variable EDK_TOOL_PATH to this folder
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "global",
+ "flags": ["set_shell_var", "set_build_var"],
+ "var_name": "EDK_TOOLS_PATH"
+}
diff --git a/roms/edk2/BaseTools/get_vsvars.bat b/roms/edk2/BaseTools/get_vsvars.bat
new file mode 100644
index 000000000..3beb113be
--- /dev/null
+++ b/roms/edk2/BaseTools/get_vsvars.bat
@@ -0,0 +1,100 @@
+@REM @file
+@REM Windows batch file to find the Visual Studio set up script
+@REM
+@REM Copyright (c) 2013-2014, ARM Limited. All rights reserved.
+
+@REM SPDX-License-Identifier: BSD-2-Clause-Patent
+@REM
+
+
+@echo off
+set SCRIPT_ERROR=0
+if "%1"=="" goto main
+if /I "%1"=="VS2019" goto VS2019Vars
+if /I "%1"=="VS2017" goto VS2017Vars
+if /I "%1"=="VS2015" goto VS2015Vars
+if /I "%1"=="VS2013" goto VS2013Vars
+if /I "%1"=="VS2012" goto VS2012Vars
+
+:set_vsvars
+if defined VCINSTALLDIR goto :EOF
+ call %* > vswhereInfo
+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+ if /i "%%i"=="installationPath" (
+ call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ )
+ del vswhereInfo
+goto :EOF
+
+:read_vsvars
+@rem Do nothing if already found, otherwise call vsvars32.bat if there
+if defined VCINSTALLDIR goto :EOF
+ set GET_VSVARS_BAT_CHECK_DIR=%*
+ set GET_VSVARS_BAT_CHECK_DIR=%GET_VSVARS_BAT_CHECK_DIR:"=%
+ if exist "%GET_VSVARS_BAT_CHECK_DIR%\vsvars32.bat" call "%GET_VSVARS_BAT_CHECK_DIR%\vsvars32.bat"
+:vsvars_done
+goto :EOF
+
+
+:ToolNotInstall
+set SCRIPT_ERROR=1
+goto :EOF
+
+REM NOTE: This file will find the most recent Visual Studio installation
+REM apparent from the environment.
+REM To use an older version, modify your environment set up.
+REM (Or invoke the relevant vsvars32 file beforehand).
+
+:main
+if defined VCINSTALLDIR goto :done
+ :VS2019Vars
+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" (
+ call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17
+ ) else (
+ call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17
+ )
+ )
+ if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
+ if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" (
+ call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17
+ ) else (
+ call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17
+ )
+ )
+ if /I "%1"=="VS2019" goto ToolNotInstall
+
+ :VS2017Vars
+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
+ call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16
+ ) else (
+ call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16
+ )
+ )
+ if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
+ if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
+ call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16
+ ) else (
+ call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16
+ )
+ )
+ if /I "%1"=="VS2017" goto ToolNotInstall
+
+ :VS2015Vars
+ if defined VS140COMNTOOLS (call :read_vsvars "%VS140COMNTOOLS%") else (if /I "%1"=="VS2015" goto ToolNotInstall)
+
+ :VS2013Vars
+ if defined VS120COMNTOOLS ( call :read_vsvars "%VS120COMNTOOLS%") else (if /I "%1"=="VS2013" goto ToolNotInstall)
+
+ :VS2012Vars
+ if defined VS110COMNTOOLS (call :read_vsvars "%VS110COMNTOOLS%") else (if /I "%1"=="VS2012" goto ToolNotInstall)
+
+ if defined VS100COMNTOOLS call :read_vsvars "%VS100COMNTOOLS%"
+ if defined VS90COMNTOOLS call :read_vsvars "%VS90COMNTOOLS%"
+ if defined VS80COMNTOOLS call :read_vsvars "%VS80COMNTOOLS%"
+ if defined VS71COMNTOOLS call :read_vsvars "%VS71COMNTOOLS%"
+
+:done
+set GET_VSVARS_BAT_CHECK_DIR=
diff --git a/roms/edk2/BaseTools/set_vsprefix_envs.bat b/roms/edk2/BaseTools/set_vsprefix_envs.bat
new file mode 100644
index 000000000..d4eb84f06
--- /dev/null
+++ b/roms/edk2/BaseTools/set_vsprefix_envs.bat
@@ -0,0 +1,242 @@
+@REM @file
+@REM This stand-alone program is typically called by the toolsetup.bat file,
+@REM however it may be executed directly from the BaseTools project folder
+@REM if the file is not executed within a WORKSPACE\BaseTools folder.
+@REM
+@REM Copyright (c) 2016-2020, Intel Corporation. All rights reserved.<BR>
+@REM
+@REM SPDX-License-Identifier: BSD-2-Clause-Patent
+@REM
+
+@echo off
+pushd .
+set SCRIPT_ERROR=0
+goto main
+
+:ToolNotInstall
+set SCRIPT_ERROR=1
+goto :EOF
+
+:main
+if /I "%1"=="VS2019" goto SetVS2019
+if /I "%1"=="VS2017" goto SetVS2017
+if /I "%1"=="VS2015" goto SetVS2015
+if /I "%1"=="VS2013" goto SetVS2013
+if /I "%1"=="VS2012" goto SetVS2012
+
+if defined VS71COMNTOOLS (
+ if not defined VS2003_PREFIX (
+ set "VS2003_PREFIX=%VS71COMNTOOLS:~0,-14%"
+ )
+)
+
+if defined VS80COMNTOOLS (
+ if not defined VS2005_PREFIX (
+ set "VS2005_PREFIX=%VS80COMNTOOLS:~0,-14%"
+ )
+)
+
+if defined VS90COMNTOOLS (
+ if not defined VS2008_PREFIX (
+ set "VS2008_PREFIX=%VS90COMNTOOLS:~0,-14%"
+ )
+ if not defined WINSDK_PREFIX (
+ set "WINSDK_PREFIX=c:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\"
+ )
+ if not defined WINSDKx86_PREFIX (
+ set "WINSDKx86_PREFIX=c:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\bin\"
+ )
+)
+
+if defined VS100COMNTOOLS (
+ if not defined VS2010_PREFIX (
+ set "VS2010_PREFIX=%VS100COMNTOOLS:~0,-14%"
+ )
+ if not defined WINSDK7_PREFIX (
+ set "WINSDK7_PREFIX=c:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\"
+ )
+ if not defined WINSDK7x86_PREFIX (
+ set "WINSDK7x86_PREFIX=c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\"
+ )
+)
+
+:SetVS2012
+if defined VS110COMNTOOLS (
+ if not defined VS2012_PREFIX (
+ set "VS2012_PREFIX=%VS110COMNTOOLS:~0,-14%"
+ )
+ if not defined WINSDK71_PREFIX (
+ set "WINSDK71_PREFIX=c:\Program Files\Microsoft SDKs\Windows\v7.1A\Bin\"
+ )
+ if not defined WINSDK71x86_PREFIX (
+ set "WINSDK71x86_PREFIX=c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\"
+ )
+) else (
+ if /I "%1"=="VS2012" goto ToolNotInstall
+)
+if /I "%1"=="VS2012" goto SetWinDDK
+
+:SetVS2013
+if defined VS120COMNTOOLS (
+ if not defined VS2013_PREFIX (
+ set "VS2013_PREFIX=%VS120COMNTOOLS:~0,-14%"
+ )
+ if not defined WINSDK8_PREFIX (
+ set "WINSDK8_PREFIX=c:\Program Files\Windows Kits\8.0\bin\"
+ )
+ if not defined WINSDK8x86_PREFIX (
+ set "WINSDK8x86_PREFIX=c:\Program Files (x86)\Windows Kits\8.0\bin\"
+ )
+) else (
+ if /I "%1"=="VS2013" goto ToolNotInstall
+)
+if /I "%1"=="VS2013" goto SetWinDDK
+
+:SetVS2015
+if defined VS140COMNTOOLS (
+ if not defined VS2015_PREFIX (
+ set "VS2015_PREFIX=%VS140COMNTOOLS:~0,-14%"
+ )
+ if not defined WINSDK81_PREFIX (
+ set "WINSDK81_PREFIX=c:\Program Files\Windows Kits\8.1\bin\"
+ )
+ if not defined WINSDK81x86_PREFIX (
+ set "WINSDK81x86_PREFIX=c:\Program Files (x86)\Windows Kits\8.1\bin\"
+ )
+) else (
+ if /I "%1"=="VS2015" goto ToolNotInstall
+)
+if /I "%1"=="VS2015" goto SetWinDDK
+
+:SetVS2017
+if not defined VS150COMNTOOLS (
+ @REM clear two envs so that vcvars32.bat can run successfully.
+ set VSINSTALLDIR=
+ set VCToolsVersion=
+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
+ call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ del vswhereInfo
+ ) else (
+ call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ del vswhereInfo
+ )
+ ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
+ if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
+ call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ del vswhereInfo
+ ) else (
+ call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ del vswhereInfo
+ )
+ ) else (
+ if /I "%1"=="VS2017" goto ToolNotInstall
+ goto SetWinDDK
+ )
+)
+
+if defined VCToolsInstallDir (
+ if not defined VS2017_PREFIX (
+ set "VS2017_PREFIX=%VCToolsInstallDir%"
+ )
+ if not defined WINSDK10_PREFIX (
+ if defined WindowsSdkVerBinPath (
+ set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
+ ) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
+ set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
+ ) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
+ set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
+ )
+ )
+)
+if not defined WINSDK_PATH_FOR_RC_EXE (
+ if defined WINSDK10_PREFIX (
+ set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
+ )
+)
+
+if /I "%1"=="VS2017" goto SetWinDDK
+
+:SetVS2019
+if not defined VS160COMNTOOLS (
+ @REM clear two envs so that vcvars32.bat can run successfully.
+ set VSINSTALLDIR=
+ set VCToolsVersion=
+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" (
+ call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ del vswhereInfo
+ ) else (
+ call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ del vswhereInfo
+ )
+ ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
+ if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" (
+ call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ del vswhereInfo
+ ) else (
+ call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ del vswhereInfo
+ )
+ ) else (
+ if /I "%1"=="VS2019" goto ToolNotInstall
+ goto SetWinDDK
+ )
+)
+
+if defined VCToolsInstallDir (
+ if not defined VS2019_PREFIX (
+ set "VS2019_PREFIX=%VCToolsInstallDir%"
+ )
+ if not defined WINSDK10_PREFIX (
+ if defined WindowsSdkVerBinPath (
+ set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
+ ) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
+ set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
+ ) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
+ set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
+ )
+ )
+)
+if not defined WINSDK_PATH_FOR_RC_EXE (
+ if defined WINSDK10_PREFIX (
+ set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
+ )
+)
+
+if /I "%1"=="VS2019" goto SetWinDDK
+
+:SetWinDDK
+if not defined WINDDK3790_PREFIX (
+ set WINDDK3790_PREFIX=C:\WINDDK\3790.1830\bin\
+)
+
+if not defined IASL_PREFIX (
+ set IASL_PREFIX=C:\ASL\
+)
+
+popd
diff --git a/roms/edk2/BaseTools/toolsetup.bat b/roms/edk2/BaseTools/toolsetup.bat
new file mode 100755
index 000000000..61ebf4ae0
--- /dev/null
+++ b/roms/edk2/BaseTools/toolsetup.bat
@@ -0,0 +1,482 @@
+@REM @file
+@REM This stand-alone program is typically called by the edksetup.bat file,
+@REM however it may be executed directly from the BaseTools project folder
+@REM if the file is not executed within a WORKSPACE\BaseTools folder.
+@REM
+@REM Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
+@REM (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+@REM
+@REM SPDX-License-Identifier: BSD-2-Clause-Patent
+@REM
+
+@echo off
+pushd .
+set SCRIPT_ERROR=0
+
+@REM ##############################################################
+@REM # You should not have to modify anything below this line
+@REM #
+
+if /I "%1"=="-h" goto Usage
+if /I "%1"=="-help" goto Usage
+if /I "%1"=="--help" goto Usage
+if /I "%1"=="/h" goto Usage
+if /I "%1"=="/help" goto Usage
+if /I "%1"=="/?" goto Usage
+
+
+:loop
+ if "%1"=="" goto setup_workspace
+ if /I "%1"=="Reconfig" (
+ shift
+ set RECONFIG=TRUE
+ goto loop
+ )
+ if /I "%1"=="Rebuild" (
+ shift
+ set REBUILD=TRUE
+ goto loop
+ )
+ if /I "%1"=="ForceRebuild" (
+ shift
+ set FORCE_REBUILD=TRUE
+ goto loop
+ )
+ if /I "%1"=="VS2019" (
+ shift
+ set VS2019=TRUE
+ set VSTool=VS2019
+ goto loop
+ )
+ if /I "%1"=="VS2017" (
+ shift
+ set VS2017=TRUE
+ set VSTool=VS2017
+ goto loop
+ )
+ if /I "%1"=="VS2015" (
+ shift
+ set VS2015=TRUE
+ set VSTool=VS2015
+ goto loop
+ )
+ if /I "%1"=="VS2013" (
+ shift
+ set VS2013=TRUE
+ set VSTool=VS2013
+ goto loop
+ )
+ if /I "%1"=="VS2012" (
+ shift
+ set VS2012=TRUE
+ set VSTool=VS2012
+ goto loop
+ )
+ if "%1"=="" goto setup_workspace
+ if exist %1 (
+ if not defined BASE_TOOLS_PATH (
+ if exist %1\Source set BASE_TOOLS_PATH=%1
+ shift
+ goto loop
+ )
+ if not defined EDK_TOOLS_PATH (
+ if exist %1\Bin\Win32 set EDK_TOOLS_PATH=%1
+ shift
+ goto loop
+ )
+ echo.
+ echo !!! ERROR !!! Unknown argument, %1 !!!
+ echo.
+ goto end
+ ) else (
+ echo.
+ echo !!! ERROR !!! Unknown argument, %1 !!!
+ echo.
+ goto end
+ )
+ goto loop
+
+
+@REM
+@REM Check the required system environment variables
+@REM
+
+:setup_workspace
+ REM
+ REM check the EDK_TOOLS_PATH
+ REM
+ if not defined EDK_TOOLS_PATH goto no_EDK_TOOLS_PATH
+ if exist %EDK_TOOLS_PATH% goto set_PATH
+
+:no_EDK_TOOLS_PATH
+ if not defined WORKSPACE (
+ if defined BASE_TOOLS_PATH (
+ set EDK_TOOLS_PATH=%BASE_TOOLS_PATH%
+ goto set_PATH
+ ) else (
+ echo.
+ echo !!! ERROR !!! Neither BASE_TOOLS_PATH nor EDK_TOOLS_PATH are set. !!!
+ echo.
+ goto end
+ )
+ ) else (
+ if exist %WORKSPACE%\BaseTools\Bin (
+ set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
+ goto set_PATH
+ ) else (
+ echo.
+ echo !!! ERROR !!! No tools path available. Please set EDK_TOOLS_PATH !!!
+ echo.
+ goto end
+ )
+ )
+
+:set_PATH
+ if defined WORKSPACE_TOOLS_PATH goto check_PATH
+ if not defined EDK_TOOLS_BIN (
+ set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32
+ if not exist %EDK_TOOLS_PATH%\Bin\Win32 (
+ echo.
+ echo !!! ERROR !!! Cannot find BaseTools Bin Win32!!!
+ echo Please check the directory %EDK_TOOLS_PATH%\Bin\Win32
+ echo Or configure EDK_TOOLS_BIN env to point Win32 directory.
+ echo.
+ )
+ )
+ set PATH=%EDK_TOOLS_BIN%;%PATH%
+ set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%
+ goto PATH_ok
+
+:check_PATH
+ if "%EDK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto PATH_ok
+ if not defined EDK_TOOLS_BIN (
+ set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32
+ if not exist %EDK_TOOLS_PATH%\Bin\Win32 (
+ echo.
+ echo !!! ERROR !!! Cannot find BaseTools Bin Win32!!!
+ echo Please check the directory %EDK_TOOLS_PATH%\Bin\Win32
+ echo Or configure EDK_TOOLS_BIN env to point Win32 directory.
+ echo.
+ )
+ )
+ set PATH=%EDK_TOOLS_BIN%;%PATH%
+ set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%
+ echo Resetting the PATH variable to include the EDK_TOOLS_PATH for this session.
+
+:PATH_ok
+REM
+REM copy *.template to %CONF_PATH%
+REM
+if not defined WORKSPACE (
+ if defined RECONFIG (
+ echo.
+ echo !!! WARNING !!! WORKSPACE environment variable was not set, cannot Reconfig !!!
+ echo.
+ )
+ goto skip_reconfig
+)
+
+IF NOT exist "%EDK_TOOLS_PATH%\set_vsprefix_envs.bat" (
+ @echo.
+ @echo !!! ERROR !!! The set_vsprefix_envs.bat was not found !!!
+ @echo.
+ goto end
+)
+if defined VS2019 (
+ call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2019
+) else if defined VS2017 (
+ call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2017
+) else if defined VS2015 (
+ call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2015
+ call %EDK_TOOLS_PATH%\get_vsvars.bat VS2015
+) else if defined VS2013 (
+ call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2013
+ call %EDK_TOOLS_PATH%\get_vsvars.bat VS2013
+) else if defined VS2012 (
+ call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2012
+ call %EDK_TOOLS_PATH%\get_vsvars.bat VS2012
+) else (
+ call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat
+ call %EDK_TOOLS_PATH%\get_vsvars.bat
+)
+if %SCRIPT_ERROR% NEQ 0 (
+ @echo.
+ @echo !!! ERROR !!! %VSTool% is not installed !!!
+ @echo.
+ goto end
+)
+
+if not defined CONF_PATH (
+ set CONF_PATH=%WORKSPACE%\Conf
+)
+
+if NOT exist %CONF_PATH% (
+ if defined PACKAGES_PATH (
+ for %%i IN (%PACKAGES_PATH%) DO (
+ if exist %%~fi\Conf (
+ set CONF_PATH=%%i\Conf
+ goto CopyConf
+ )
+ )
+ )
+)
+
+:CopyConf
+if NOT exist %CONF_PATH% (
+ mkdir %CONF_PATH%
+) else (
+ if defined RECONFIG (
+ echo.
+ echo Over-writing the files in the CONF_PATH directory
+ echo using the default template files
+ echo.
+ )
+)
+
+if NOT exist %CONF_PATH%\target.txt (
+ echo copying ... target.template to %CONF_PATH%\target.txt
+ if NOT exist %EDK_TOOLS_PATH%\Conf\target.template (
+ echo Error: target.template is missing at folder %EDK_TOOLS_PATH%\Conf\
+ )
+ copy %EDK_TOOLS_PATH%\Conf\target.template %CONF_PATH%\target.txt > nul
+) else (
+ if defined RECONFIG echo over-write ... target.template to %CONF_PATH%\target.txt
+ if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\target.template %CONF_PATH%\target.txt > nul
+)
+
+if NOT exist %CONF_PATH%\tools_def.txt (
+ echo copying ... tools_def.template to %CONF_PATH%\tools_def.txt
+ if NOT exist %EDK_TOOLS_PATH%\Conf\tools_def.template (
+ echo Error: tools_def.template is missing at folder %EDK_TOOLS_PATH%\Conf\
+ )
+ copy %EDK_TOOLS_PATH%\Conf\tools_def.template %CONF_PATH%\tools_def.txt > nul
+) else (
+ if defined RECONFIG echo over-write ... tools_def.template to %CONF_PATH%\tools_def.txt
+ if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\tools_def.template %CONF_PATH%\tools_def.txt > nul
+)
+
+if NOT exist %CONF_PATH%\build_rule.txt (
+ echo copying ... build_rule.template to %CONF_PATH%\build_rule.txt
+ if NOT exist %EDK_TOOLS_PATH%\Conf\build_rule.template (
+ echo Error: build_rule.template is missing at folder %EDK_TOOLS_PATH%\Conf\
+ )
+ copy %EDK_TOOLS_PATH%\Conf\build_rule.template %CONF_PATH%\build_rule.txt > nul
+) else (
+ if defined RECONFIG echo over-write ... build_rule.template to %CONF_PATH%\build_rule.txt
+ if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\build_rule.template %CONF_PATH%\build_rule.txt > nul
+)
+
+echo PATH = %PATH%
+echo.
+if defined WORKSPACE (
+ echo WORKSPACE = %WORKSPACE%
+)
+if defined PACKAGES_PATH (
+ echo PACKAGES_PATH = %PACKAGES_PATH%
+)
+echo EDK_TOOLS_PATH = %EDK_TOOLS_PATH%
+if defined BASE_TOOLS_PATH (
+ echo BASE_TOOLS_PATH = %BASE_TOOLS_PATH%
+)
+if defined EDK_TOOLS_BIN (
+ echo EDK_TOOLS_BIN = %EDK_TOOLS_BIN%
+)
+echo CONF_PATH = %CONF_PATH%
+echo.
+
+:skip_reconfig
+
+@REM
+@REM Test if we are going to have to do a build
+@REM
+if defined FORCE_REBUILD goto check_build_environment
+if defined REBUILD goto check_build_environment
+if not exist "%EDK_TOOLS_PATH%" goto check_build_environment
+if not exist "%EDK_TOOLS_BIN%" goto check_build_environment
+
+IF NOT EXIST "%EDK_TOOLS_BIN%\EfiRom.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenFfs.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenFv.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenFw.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenSec.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\Split.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\TianoCompress.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\VfrCompile.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\VolInfo.exe" goto check_c_tools
+
+goto check_build_environment
+
+:check_c_tools
+ echo.
+ echo !!! ERROR !!! Binary C tools are missing. They are required to be built from BaseTools Source.
+ echo.
+
+:check_build_environment
+ set PYTHONHASHSEED=1
+
+ if not defined BASE_TOOLS_PATH (
+ if not exist "Source\C\Makefile" (
+ if not exist "%EDK_TOOLS_PATH%\Source\C\Makefile" goto no_source_files
+ set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%
+ ) else (
+ set BASE_TOOLS_PATH=%CD%
+ )
+ )
+
+:defined_python
+if defined PYTHON_COMMAND if not defined PYTHON3_ENABLE (
+ goto check_python_available
+)
+if defined PYTHON3_ENABLE (
+ if "%PYTHON3_ENABLE%" EQU "TRUE" (
+ set PYTHON_COMMAND=py -3
+ goto check_python_available
+ ) else (
+ goto check_python2
+ )
+)
+if not defined PYTHON_COMMAND if not defined PYTHON3_ENABLE (
+ set PYTHON_COMMAND=py -3
+ py -3 %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1
+ setlocal enabledelayedexpansion
+ set /p PythonCheck=<"PythonCheck.txt"
+ del PythonCheck.txt
+ if "!PythonCheck!" NEQ "TRUE" (
+ if not defined PYTHON_HOME if not defined PYTHONHOME (
+ endlocal
+ set PYTHON_COMMAND=
+ echo.
+ echo !!! ERROR !!! Binary python tools are missing.
+ echo PYTHON_COMMAND, PYTHON3_ENABLE or PYTHON_HOME
+ echo Environment variable is not set successfully.
+ echo They is required to build or execute the python tools.
+ echo.
+ goto end
+ ) else (
+ goto check_python2
+ )
+ ) else (
+ goto check_freezer_path
+ )
+)
+
+:check_python2
+endlocal
+if defined PYTHON_HOME (
+ if EXIST "%PYTHON_HOME%" (
+ set PYTHON_COMMAND=%PYTHON_HOME%\python.exe
+ goto check_python_available
+ )
+)
+if defined PYTHONHOME (
+ if EXIST "%PYTHONHOME%" (
+ set PYTHON_HOME=%PYTHONHOME%
+ set PYTHON_COMMAND=%PYTHON_HOME%\python.exe
+ goto check_python_available
+ )
+)
+echo.
+echo !!! ERROR !!! PYTHON_HOME is not defined or The value of this variable does not exist
+echo.
+goto end
+:check_python_available
+%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1
+ setlocal enabledelayedexpansion
+ set /p PythonCheck=<"PythonCheck.txt"
+ del PythonCheck.txt
+ if "!PythonCheck!" NEQ "TRUE" (
+ echo.
+ echo ! ERROR ! "%PYTHON_COMMAND%" is not installed or added to environment variables
+ echo.
+ goto end
+ ) else (
+ goto check_freezer_path
+ )
+
+:check_freezer_path
+ endlocal
+ if defined BASETOOLS_PYTHON_SOURCE goto print_python_info
+ set "PATH=%BASE_TOOLS_PATH%\BinWrappers\WindowsLike;%PATH%"
+ set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python
+ set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%
+
+:print_python_info
+ echo PATH = %PATH%
+ if defined PYTHON3_ENABLE if "%PYTHON3_ENABLE%" EQU "TRUE" (
+ echo PYTHON3_ENABLE = %PYTHON3_ENABLE%
+ echo PYTHON3 = %PYTHON_COMMAND%
+ ) else (
+ echo PYTHON3_ENABLE = FALSE
+ echo PYTHON_COMMAND = %PYTHON_COMMAND%
+ )
+ echo PYTHONPATH = %PYTHONPATH%
+ echo.
+
+:VisualStudioAvailable
+ if not defined FORCE_REBUILD (
+ if not defined REBUILD (
+ goto end
+ )
+ )
+
+ if not defined VCINSTALLDIR (
+ @echo.
+ @echo !!! ERROR !!!! Cannot find Visual Studio, required to build C tools !!!
+ @echo.
+ goto end
+ )
+ if not defined FORCE_REBUILD goto IncrementalBuild
+
+:CleanAndBuild
+ pushd .
+ cd %BASE_TOOLS_PATH%
+ call nmake cleanall
+ del /f /q %BASE_TOOLS_PATH%\Bin\Win32\*.*
+ popd
+ @REM Let CleanAndBuild fall through to IncrementalBuild
+
+
+:IncrementalBuild
+ pushd .
+ cd %BASE_TOOLS_PATH%
+ call nmake c
+ popd
+ goto end
+
+
+:no_source_files
+ echo.
+ echo !!! ERROR !!! Cannot build BaseTools applications - no source directory located !!!
+ echo.
+ goto end
+
+:Usage
+ @echo.
+ echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]] [VS2019] [VS2017] [VS2015] [VS2013] [VS2012]"
+ @echo.
+ @echo base_tools_path BaseTools project path, BASE_TOOLS_PATH will be set to this path.
+ @echo edk_tools_path EDK_TOOLS_PATH will be set to this path.
+ @echo Rebuild If sources are available perform an Incremental build, only
+ @echo build those updated tools.
+ @echo ForceRebuild If sources are available, rebuild all tools regardless of
+ @echo whether they have been updated or not.
+ @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.
+ @echo VS2012 Set the env for VS2012 build.
+ @echo VS2013 Set the env for VS2013 build.
+ @echo VS2015 Set the env for VS2015 build.
+ @echo VS2017 Set the env for VS2017 build.
+ @echo VS2019 Set the env for VS2019 build.
+ @echo.
+
+:end
+set REBUILD=
+set FORCE_REBUILD=
+set RECONFIG=
+set VS2019=
+set VS2017=
+set VS2015=
+set VS2013=
+set VS2012=
+set VSTool=
+popd
+